diff --git a/lib/annotations-16.0.3.jar b/lib/annotations-16.0.3.jar new file mode 100644 index 0000000..d6bb55b Binary files /dev/null and b/lib/annotations-16.0.3.jar differ diff --git a/lib/commons-io-2.8.0.jar b/lib/commons-io-2.8.0.jar new file mode 100644 index 0000000..177e58d Binary files /dev/null and b/lib/commons-io-2.8.0.jar differ diff --git a/lib/discord-rpc.jar b/lib/discord-rpc.jar new file mode 100644 index 0000000..ef5c4bb Binary files /dev/null and b/lib/discord-rpc.jar differ diff --git a/lib/json-20180813.jar b/lib/json-20180813.jar new file mode 100644 index 0000000..592f08c Binary files /dev/null and b/lib/json-20180813.jar differ diff --git a/lib/json-20180813/co/gongzh/procbridge/Client.class b/lib/json-20180813/co/gongzh/procbridge/Client.class new file mode 100644 index 0000000..9bec754 Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/Client.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/ClientException.class b/lib/json-20180813/co/gongzh/procbridge/ClientException.class new file mode 100644 index 0000000..c8b6d3e Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/ClientException.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/Delegate.class b/lib/json-20180813/co/gongzh/procbridge/Delegate.class new file mode 100644 index 0000000..3216f3f Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/Delegate.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/Handler.class b/lib/json-20180813/co/gongzh/procbridge/Handler.class new file mode 100644 index 0000000..6a0ceae Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/Handler.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/IDelegate.class b/lib/json-20180813/co/gongzh/procbridge/IDelegate.class new file mode 100644 index 0000000..1b93682 Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/IDelegate.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/Keys.class b/lib/json-20180813/co/gongzh/procbridge/Keys.class new file mode 100644 index 0000000..1ffdc86 Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/Keys.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/Protocol.class b/lib/json-20180813/co/gongzh/procbridge/Protocol.class new file mode 100644 index 0000000..1ef1405 Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/Protocol.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/ProtocolException.class b/lib/json-20180813/co/gongzh/procbridge/ProtocolException.class new file mode 100644 index 0000000..f0f84fc Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/ProtocolException.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/Server$Connection.class b/lib/json-20180813/co/gongzh/procbridge/Server$Connection.class new file mode 100644 index 0000000..18d2e75 Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/Server$Connection.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/Server.class b/lib/json-20180813/co/gongzh/procbridge/Server.class new file mode 100644 index 0000000..3f403f8 Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/Server.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/ServerException.class b/lib/json-20180813/co/gongzh/procbridge/ServerException.class new file mode 100644 index 0000000..5e9a388 Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/ServerException.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/StatusCode.class b/lib/json-20180813/co/gongzh/procbridge/StatusCode.class new file mode 100644 index 0000000..bb946d7 Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/StatusCode.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/TimeoutException.class b/lib/json-20180813/co/gongzh/procbridge/TimeoutException.class new file mode 100644 index 0000000..8dd1e89 Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/TimeoutException.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/TimeoutExecutor$1.class b/lib/json-20180813/co/gongzh/procbridge/TimeoutExecutor$1.class new file mode 100644 index 0000000..c279666 Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/TimeoutExecutor$1.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/TimeoutExecutor.class b/lib/json-20180813/co/gongzh/procbridge/TimeoutExecutor.class new file mode 100644 index 0000000..b7df0c3 Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/TimeoutExecutor.class differ diff --git a/lib/json-20180813/co/gongzh/procbridge/Versions.class b/lib/json-20180813/co/gongzh/procbridge/Versions.class new file mode 100644 index 0000000..7b4faa3 Binary files /dev/null and b/lib/json-20180813/co/gongzh/procbridge/Versions.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/base/AnimatedToggleable$1.class b/lib/json-20180813/com/lukflug/panelstudio/base/AnimatedToggleable$1.class new file mode 100644 index 0000000..3e32296 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/base/AnimatedToggleable$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/base/AnimatedToggleable.class b/lib/json-20180813/com/lukflug/panelstudio/base/AnimatedToggleable.class new file mode 100644 index 0000000..bca8c13 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/base/AnimatedToggleable.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/base/Animation.class b/lib/json-20180813/com/lukflug/panelstudio/base/Animation.class new file mode 100644 index 0000000..6b9d8fe Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/base/Animation.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/base/ConstantToggleable.class b/lib/json-20180813/com/lukflug/panelstudio/base/ConstantToggleable.class new file mode 100644 index 0000000..3de660d Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/base/ConstantToggleable.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/base/Context.class b/lib/json-20180813/com/lukflug/panelstudio/base/Context.class new file mode 100644 index 0000000..f125a26 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/base/Context.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/base/Description.class b/lib/json-20180813/com/lukflug/panelstudio/base/Description.class new file mode 100644 index 0000000..83958c4 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/base/Description.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/base/IBoolean.class b/lib/json-20180813/com/lukflug/panelstudio/base/IBoolean.class new file mode 100644 index 0000000..2b8c36c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/base/IBoolean.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/base/IInterface.class b/lib/json-20180813/com/lukflug/panelstudio/base/IInterface.class new file mode 100644 index 0000000..76d0f8a Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/base/IInterface.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/base/IToggleable.class b/lib/json-20180813/com/lukflug/panelstudio/base/IToggleable.class new file mode 100644 index 0000000..f50525b Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/base/IToggleable.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/base/SettingsAnimation.class b/lib/json-20180813/com/lukflug/panelstudio/base/SettingsAnimation.class new file mode 100644 index 0000000..642fe59 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/base/SettingsAnimation.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/base/SimpleToggleable.class b/lib/json-20180813/com/lukflug/panelstudio/base/SimpleToggleable.class new file mode 100644 index 0000000..7b34f9f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/base/SimpleToggleable.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/CollapsibleComponent.class b/lib/json-20180813/com/lukflug/panelstudio/component/CollapsibleComponent.class new file mode 100644 index 0000000..53360e3 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/CollapsibleComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/ComponentBase.class b/lib/json-20180813/com/lukflug/panelstudio/component/ComponentBase.class new file mode 100644 index 0000000..2d07080 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/ComponentBase.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/ComponentProxy.class b/lib/json-20180813/com/lukflug/panelstudio/component/ComponentProxy.class new file mode 100644 index 0000000..fd15da4 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/ComponentProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/DraggableComponent$1.class b/lib/json-20180813/com/lukflug/panelstudio/component/DraggableComponent$1.class new file mode 100644 index 0000000..73613c8 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/DraggableComponent$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/DraggableComponent.class b/lib/json-20180813/com/lukflug/panelstudio/component/DraggableComponent.class new file mode 100644 index 0000000..e6d3e44 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/DraggableComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/FixedComponent.class b/lib/json-20180813/com/lukflug/panelstudio/component/FixedComponent.class new file mode 100644 index 0000000..6c1b165 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/FixedComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/FocusableComponent.class b/lib/json-20180813/com/lukflug/panelstudio/component/FocusableComponent.class new file mode 100644 index 0000000..a0e27f8 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/FocusableComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/FocusableComponentProxy.class b/lib/json-20180813/com/lukflug/panelstudio/component/FocusableComponentProxy.class new file mode 100644 index 0000000..a36f0fb Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/FocusableComponentProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/HorizontalComponent.class b/lib/json-20180813/com/lukflug/panelstudio/component/HorizontalComponent.class new file mode 100644 index 0000000..388daf6 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/HorizontalComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/IComponent.class b/lib/json-20180813/com/lukflug/panelstudio/component/IComponent.class new file mode 100644 index 0000000..b666d9b Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/IComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/IComponentProxy.class b/lib/json-20180813/com/lukflug/panelstudio/component/IComponentProxy.class new file mode 100644 index 0000000..f767fba Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/IComponentProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/IFixedComponent.class b/lib/json-20180813/com/lukflug/panelstudio/component/IFixedComponent.class new file mode 100644 index 0000000..e5da6e8 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/IFixedComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/IFixedComponentProxy.class b/lib/json-20180813/com/lukflug/panelstudio/component/IFixedComponentProxy.class new file mode 100644 index 0000000..a4c44ce Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/IFixedComponentProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/IHorizontalComponent.class b/lib/json-20180813/com/lukflug/panelstudio/component/IHorizontalComponent.class new file mode 100644 index 0000000..ecfb557 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/IHorizontalComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/IHorizontalComponentProxy.class b/lib/json-20180813/com/lukflug/panelstudio/component/IHorizontalComponentProxy.class new file mode 100644 index 0000000..5ad2891 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/IHorizontalComponentProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/IResizable.class b/lib/json-20180813/com/lukflug/panelstudio/component/IResizable.class new file mode 100644 index 0000000..a894baf Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/IResizable.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/IScrollSize.class b/lib/json-20180813/com/lukflug/panelstudio/component/IScrollSize.class new file mode 100644 index 0000000..b1342bb Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/IScrollSize.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/PopupComponent.class b/lib/json-20180813/com/lukflug/panelstudio/component/PopupComponent.class new file mode 100644 index 0000000..86c81cc Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/PopupComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/component/ScrollableComponent.class b/lib/json-20180813/com/lukflug/panelstudio/component/ScrollableComponent.class new file mode 100644 index 0000000..f4dfa65 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/component/ScrollableComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/config/IConfigList.class b/lib/json-20180813/com/lukflug/panelstudio/config/IConfigList.class new file mode 100644 index 0000000..1f23723 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/config/IConfigList.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/config/IPanelConfig.class b/lib/json-20180813/com/lukflug/panelstudio/config/IPanelConfig.class new file mode 100644 index 0000000..8ba1370 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/config/IPanelConfig.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/container/Container$ComponentState.class b/lib/json-20180813/com/lukflug/panelstudio/container/Container$ComponentState.class new file mode 100644 index 0000000..3f531a7 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/container/Container$ComponentState.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/container/Container$ContextSensitiveConsumer.class b/lib/json-20180813/com/lukflug/panelstudio/container/Container$ContextSensitiveConsumer.class new file mode 100644 index 0000000..f0b6f00 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/container/Container$ContextSensitiveConsumer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/container/Container.class b/lib/json-20180813/com/lukflug/panelstudio/container/Container.class new file mode 100644 index 0000000..343b71b Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/container/Container.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/container/FixedContainer$PopupPair.class b/lib/json-20180813/com/lukflug/panelstudio/container/FixedContainer$PopupPair.class new file mode 100644 index 0000000..132ed38 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/container/FixedContainer$PopupPair.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/container/FixedContainer.class b/lib/json-20180813/com/lukflug/panelstudio/container/FixedContainer.class new file mode 100644 index 0000000..1aa9341 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/container/FixedContainer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/container/GUI.class b/lib/json-20180813/com/lukflug/panelstudio/container/GUI.class new file mode 100644 index 0000000..b2dcbdb Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/container/GUI.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/container/HorizontalContainer.class b/lib/json-20180813/com/lukflug/panelstudio/container/HorizontalContainer.class new file mode 100644 index 0000000..b3eaa26 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/container/HorizontalContainer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/container/IContainer.class b/lib/json-20180813/com/lukflug/panelstudio/container/IContainer.class new file mode 100644 index 0000000..01c1e74 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/container/IContainer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/container/VerticalContainer.class b/lib/json-20180813/com/lukflug/panelstudio/container/VerticalContainer.class new file mode 100644 index 0000000..205afe5 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/container/VerticalContainer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/hud/HUDComponent.class b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDComponent.class new file mode 100644 index 0000000..f88293f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/hud/HUDGUI.class b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDGUI.class new file mode 100644 index 0000000..9beddda Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDGUI.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/hud/HUDList.class b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDList.class new file mode 100644 index 0000000..923111f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDList.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent$1.class b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent$1.class new file mode 100644 index 0000000..af283ea Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent$2.class b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent$2.class new file mode 100644 index 0000000..ef907a9 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent$3.class b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent$3.class new file mode 100644 index 0000000..0e10fdc Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent$4.class b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent$4.class new file mode 100644 index 0000000..8679464 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent.class b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent.class new file mode 100644 index 0000000..b79a433 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel$HUDPanelComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel.class b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel.class new file mode 100644 index 0000000..adf56d0 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/hud/HUDPanel.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/hud/ListComponent.class b/lib/json-20180813/com/lukflug/panelstudio/hud/ListComponent.class new file mode 100644 index 0000000..f0c5ae1 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/hud/ListComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout$1.class b/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout$1.class new file mode 100644 index 0000000..3c132eb Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout$2.class b/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout$2.class new file mode 100644 index 0000000..825a185 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout$3.class b/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout$3.class new file mode 100644 index 0000000..6fdea21 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout$4.class b/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout$4.class new file mode 100644 index 0000000..dd6056b Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout.class b/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout.class new file mode 100644 index 0000000..fc47722 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/CSGOLayout.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/ChildUtil$1.class b/lib/json-20180813/com/lukflug/panelstudio/layout/ChildUtil$1.class new file mode 100644 index 0000000..753a2fc Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/ChildUtil$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/ChildUtil$2.class b/lib/json-20180813/com/lukflug/panelstudio/layout/ChildUtil$2.class new file mode 100644 index 0000000..ad4aa15 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/ChildUtil$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/ChildUtil$ChildMode.class b/lib/json-20180813/com/lukflug/panelstudio/layout/ChildUtil$ChildMode.class new file mode 100644 index 0000000..21ebe5c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/ChildUtil$ChildMode.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/ChildUtil.class b/lib/json-20180813/com/lukflug/panelstudio/layout/ChildUtil.class new file mode 100644 index 0000000..f384297 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/ChildUtil.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/ComponentGenerator$1.class b/lib/json-20180813/com/lukflug/panelstudio/layout/ComponentGenerator$1.class new file mode 100644 index 0000000..ba52b2c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/ComponentGenerator$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/ComponentGenerator$2.class b/lib/json-20180813/com/lukflug/panelstudio/layout/ComponentGenerator$2.class new file mode 100644 index 0000000..fdc50ce Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/ComponentGenerator$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/ComponentGenerator.class b/lib/json-20180813/com/lukflug/panelstudio/layout/ComponentGenerator.class new file mode 100644 index 0000000..653a34e Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/ComponentGenerator.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/IComponentAdder.class b/lib/json-20180813/com/lukflug/panelstudio/layout/IComponentAdder.class new file mode 100644 index 0000000..253dfe8 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/IComponentAdder.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/IComponentGenerator$1.class b/lib/json-20180813/com/lukflug/panelstudio/layout/IComponentGenerator$1.class new file mode 100644 index 0000000..a0ae239 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/IComponentGenerator$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/IComponentGenerator$2.class b/lib/json-20180813/com/lukflug/panelstudio/layout/IComponentGenerator$2.class new file mode 100644 index 0000000..c821d46 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/IComponentGenerator$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/IComponentGenerator.class b/lib/json-20180813/com/lukflug/panelstudio/layout/IComponentGenerator.class new file mode 100644 index 0000000..bb67392 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/IComponentGenerator.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/ILayout.class b/lib/json-20180813/com/lukflug/panelstudio/layout/ILayout.class new file mode 100644 index 0000000..e6989bc Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/ILayout.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/PanelAdder$1.class b/lib/json-20180813/com/lukflug/panelstudio/layout/PanelAdder$1.class new file mode 100644 index 0000000..3b1119f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/PanelAdder$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/PanelAdder.class b/lib/json-20180813/com/lukflug/panelstudio/layout/PanelAdder.class new file mode 100644 index 0000000..0560d8c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/PanelAdder.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/PanelLayout.class b/lib/json-20180813/com/lukflug/panelstudio/layout/PanelLayout.class new file mode 100644 index 0000000..da10101 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/PanelLayout.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout$1.class b/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout$1.class new file mode 100644 index 0000000..d6e2b6e Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout$2.class b/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout$2.class new file mode 100644 index 0000000..b3fc5a2 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout$3.class b/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout$3.class new file mode 100644 index 0000000..7f8efbe Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout$4.class b/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout$4.class new file mode 100644 index 0000000..c567926 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout.class b/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout.class new file mode 100644 index 0000000..ed9cc47 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/SearchableLayout.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/SinglePanelAdder$1.class b/lib/json-20180813/com/lukflug/panelstudio/layout/SinglePanelAdder$1.class new file mode 100644 index 0000000..be48cc0 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/SinglePanelAdder$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/SinglePanelAdder$2.class b/lib/json-20180813/com/lukflug/panelstudio/layout/SinglePanelAdder$2.class new file mode 100644 index 0000000..daddc7a Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/SinglePanelAdder$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/SinglePanelAdder$3.class b/lib/json-20180813/com/lukflug/panelstudio/layout/SinglePanelAdder$3.class new file mode 100644 index 0000000..5876736 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/SinglePanelAdder$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/SinglePanelAdder.class b/lib/json-20180813/com/lukflug/panelstudio/layout/SinglePanelAdder.class new file mode 100644 index 0000000..6f95a89 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/SinglePanelAdder.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/StackedPanelAdder$1.class b/lib/json-20180813/com/lukflug/panelstudio/layout/StackedPanelAdder$1.class new file mode 100644 index 0000000..346c27f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/StackedPanelAdder$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/layout/StackedPanelAdder.class b/lib/json-20180813/com/lukflug/panelstudio/layout/StackedPanelAdder.class new file mode 100644 index 0000000..1cb2ac2 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/layout/StackedPanelAdder.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/popup/CenteredPositioner.class b/lib/json-20180813/com/lukflug/panelstudio/popup/CenteredPositioner.class new file mode 100644 index 0000000..89ab4f2 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/popup/CenteredPositioner.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/popup/FixedPositioner.class b/lib/json-20180813/com/lukflug/panelstudio/popup/FixedPositioner.class new file mode 100644 index 0000000..bf021b6 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/popup/FixedPositioner.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/popup/IPopup.class b/lib/json-20180813/com/lukflug/panelstudio/popup/IPopup.class new file mode 100644 index 0000000..d5c5596 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/popup/IPopup.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/popup/IPopupDisplayer.class b/lib/json-20180813/com/lukflug/panelstudio/popup/IPopupDisplayer.class new file mode 100644 index 0000000..45d4887 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/popup/IPopupDisplayer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/popup/IPopupPositioner.class b/lib/json-20180813/com/lukflug/panelstudio/popup/IPopupPositioner.class new file mode 100644 index 0000000..8016c0d Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/popup/IPopupPositioner.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/popup/MousePositioner.class b/lib/json-20180813/com/lukflug/panelstudio/popup/MousePositioner.class new file mode 100644 index 0000000..39bc51a Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/popup/MousePositioner.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/popup/PanelPositioner.class b/lib/json-20180813/com/lukflug/panelstudio/popup/PanelPositioner.class new file mode 100644 index 0000000..625f6ba Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/popup/PanelPositioner.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/popup/PopupTuple.class b/lib/json-20180813/com/lukflug/panelstudio/popup/PopupTuple.class new file mode 100644 index 0000000..d35bc3f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/popup/PopupTuple.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/AnimatedEnum.class b/lib/json-20180813/com/lukflug/panelstudio/setting/AnimatedEnum.class new file mode 100644 index 0000000..906f2c2 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/AnimatedEnum.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/IBooleanSetting.class b/lib/json-20180813/com/lukflug/panelstudio/setting/IBooleanSetting.class new file mode 100644 index 0000000..fc3ac99 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/IBooleanSetting.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/ICategory.class b/lib/json-20180813/com/lukflug/panelstudio/setting/ICategory.class new file mode 100644 index 0000000..cfcfeca Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/ICategory.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/IClient.class b/lib/json-20180813/com/lukflug/panelstudio/setting/IClient.class new file mode 100644 index 0000000..5987bb8 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/IClient.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/IColorSetting.class b/lib/json-20180813/com/lukflug/panelstudio/setting/IColorSetting.class new file mode 100644 index 0000000..76e36cb Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/IColorSetting.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/IEnumSetting.class b/lib/json-20180813/com/lukflug/panelstudio/setting/IEnumSetting.class new file mode 100644 index 0000000..b16819e Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/IEnumSetting.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/IKeybindSetting.class b/lib/json-20180813/com/lukflug/panelstudio/setting/IKeybindSetting.class new file mode 100644 index 0000000..6746b26 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/IKeybindSetting.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/ILabeled.class b/lib/json-20180813/com/lukflug/panelstudio/setting/ILabeled.class new file mode 100644 index 0000000..b41fe1a Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/ILabeled.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/IModule.class b/lib/json-20180813/com/lukflug/panelstudio/setting/IModule.class new file mode 100644 index 0000000..4f4f60d Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/IModule.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/INumberSetting.class b/lib/json-20180813/com/lukflug/panelstudio/setting/INumberSetting.class new file mode 100644 index 0000000..01206bc Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/INumberSetting.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/ISetting.class b/lib/json-20180813/com/lukflug/panelstudio/setting/ISetting.class new file mode 100644 index 0000000..d44a9cc Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/ISetting.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/IStringSetting.class b/lib/json-20180813/com/lukflug/panelstudio/setting/IStringSetting.class new file mode 100644 index 0000000..10cb60b Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/IStringSetting.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/setting/Labeled.class b/lib/json-20180813/com/lukflug/panelstudio/setting/Labeled.class new file mode 100644 index 0000000..e9c7f2a Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/setting/Labeled.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/tabgui/ITabGUIRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/tabgui/ITabGUIRenderer.class new file mode 100644 index 0000000..0e3cc59 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/tabgui/ITabGUIRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/tabgui/ITabGUITheme.class b/lib/json-20180813/com/lukflug/panelstudio/tabgui/ITabGUITheme.class new file mode 100644 index 0000000..1557ca1 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/tabgui/ITabGUITheme.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/tabgui/StandardTheme$1.class b/lib/json-20180813/com/lukflug/panelstudio/tabgui/StandardTheme$1.class new file mode 100644 index 0000000..be150ef Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/tabgui/StandardTheme$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/tabgui/StandardTheme$2.class b/lib/json-20180813/com/lukflug/panelstudio/tabgui/StandardTheme$2.class new file mode 100644 index 0000000..a50c20a Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/tabgui/StandardTheme$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/tabgui/StandardTheme$RendererBase.class b/lib/json-20180813/com/lukflug/panelstudio/tabgui/StandardTheme$RendererBase.class new file mode 100644 index 0000000..bb27991 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/tabgui/StandardTheme$RendererBase.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/tabgui/StandardTheme.class b/lib/json-20180813/com/lukflug/panelstudio/tabgui/StandardTheme.class new file mode 100644 index 0000000..d3c79ce Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/tabgui/StandardTheme.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/tabgui/Tab.class b/lib/json-20180813/com/lukflug/panelstudio/tabgui/Tab.class new file mode 100644 index 0000000..9fb9436 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/tabgui/Tab.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabGUI$ChildTab$1.class b/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabGUI$ChildTab$1.class new file mode 100644 index 0000000..fc8727d Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabGUI$ChildTab$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabGUI$ChildTab.class b/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabGUI$ChildTab.class new file mode 100644 index 0000000..050a691 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabGUI$ChildTab.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabGUI.class b/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabGUI.class new file mode 100644 index 0000000..adbad6d Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabGUI.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabItem$ContentItem.class b/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabItem$ContentItem.class new file mode 100644 index 0000000..3516497 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabItem$ContentItem.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabItem.class b/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabItem.class new file mode 100644 index 0000000..9f0b3c9 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/tabgui/TabItem.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$1.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$1.class new file mode 100644 index 0000000..532a252 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$10.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$10.class new file mode 100644 index 0000000..5014bda Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$10.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$11.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$11.class new file mode 100644 index 0000000..48a5239 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$11.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$12.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$12.class new file mode 100644 index 0000000..3cc63aa Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$12.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$13.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$13.class new file mode 100644 index 0000000..152fc68 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$13.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$14.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$14.class new file mode 100644 index 0000000..4d00126 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$14.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$15.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$15.class new file mode 100644 index 0000000..a741705 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$15.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$2.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$2.class new file mode 100644 index 0000000..a35cece Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$3.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$3.class new file mode 100644 index 0000000..a56d9a0 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$4.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$4.class new file mode 100644 index 0000000..dbadb61 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$5.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$5.class new file mode 100644 index 0000000..8865b8d Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$5.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$6.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$6.class new file mode 100644 index 0000000..2bac00d Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$6.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$7.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$7.class new file mode 100644 index 0000000..549c74a Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$7.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$8.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$8.class new file mode 100644 index 0000000..b396221 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$8.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$9.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$9.class new file mode 100644 index 0000000..2b05e66 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme$9.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme.class new file mode 100644 index 0000000..10edbb4 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ClearTheme.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$1.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$1.class new file mode 100644 index 0000000..350017d Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$10.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$10.class new file mode 100644 index 0000000..5b3cded Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$10.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$11.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$11.class new file mode 100644 index 0000000..a00e7e7 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$11.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$12.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$12.class new file mode 100644 index 0000000..8d485ca Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$12.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$13.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$13.class new file mode 100644 index 0000000..5a92763 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$13.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$14.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$14.class new file mode 100644 index 0000000..367b879 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$14.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$2.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$2.class new file mode 100644 index 0000000..526f1d0 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$3.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$3.class new file mode 100644 index 0000000..36f4bd8 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$4.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$4.class new file mode 100644 index 0000000..3f4ceab Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$5.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$5.class new file mode 100644 index 0000000..a74f869 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$5.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$6.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$6.class new file mode 100644 index 0000000..989867c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$6.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$7.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$7.class new file mode 100644 index 0000000..c2cf292 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$7.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$8.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$8.class new file mode 100644 index 0000000..f750c4f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$8.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$9.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$9.class new file mode 100644 index 0000000..e0bad52 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme$9.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme.class b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme.class new file mode 100644 index 0000000..75c1860 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/GameSenseTheme.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IButtonRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IButtonRenderer.class new file mode 100644 index 0000000..4b89962 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IButtonRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IButtonRendererProxy.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IButtonRendererProxy.class new file mode 100644 index 0000000..e64c21c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IButtonRendererProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IColorPickerRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IColorPickerRenderer.class new file mode 100644 index 0000000..4be7c66 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IColorPickerRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IColorPickerRendererProxy.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IColorPickerRendererProxy.class new file mode 100644 index 0000000..50c1f63 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IColorPickerRendererProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IColorScheme.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IColorScheme.class new file mode 100644 index 0000000..46088ac Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IColorScheme.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IContainerRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IContainerRenderer.class new file mode 100644 index 0000000..85a2bb2 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IContainerRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IContainerRendererProxy.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IContainerRendererProxy.class new file mode 100644 index 0000000..8b145e8 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IContainerRendererProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IDescriptionRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IDescriptionRenderer.class new file mode 100644 index 0000000..372adf7 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IDescriptionRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IDescriptionRendererProxy.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IDescriptionRendererProxy.class new file mode 100644 index 0000000..7e5edf8 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IDescriptionRendererProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IEmptySpaceRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IEmptySpaceRenderer.class new file mode 100644 index 0000000..2847860 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IEmptySpaceRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IEmptySpaceRendererProxy.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IEmptySpaceRendererProxy.class new file mode 100644 index 0000000..15e27fe Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IEmptySpaceRendererProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IPanelRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IPanelRenderer.class new file mode 100644 index 0000000..dfc0182 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IPanelRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IPanelRendererProxy.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IPanelRendererProxy.class new file mode 100644 index 0000000..ef1d644 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IPanelRendererProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IRadioRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IRadioRenderer.class new file mode 100644 index 0000000..aab376b Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IRadioRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IRadioRendererProxy.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IRadioRendererProxy.class new file mode 100644 index 0000000..88ee946 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IRadioRendererProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IResizeBorderRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IResizeBorderRenderer.class new file mode 100644 index 0000000..f94ccb5 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IResizeBorderRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IResizeBorderRendererProxy.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IResizeBorderRendererProxy.class new file mode 100644 index 0000000..7e9fbc6 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IResizeBorderRendererProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IScrollBarRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IScrollBarRenderer.class new file mode 100644 index 0000000..8e1c6cd Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IScrollBarRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IScrollBarRendererProxy.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IScrollBarRendererProxy.class new file mode 100644 index 0000000..8cfe099 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IScrollBarRendererProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ISliderRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ISliderRenderer.class new file mode 100644 index 0000000..5949a40 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ISliderRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ISliderRendererProxy.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ISliderRendererProxy.class new file mode 100644 index 0000000..2948b47 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ISliderRendererProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ISwitchRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ISwitchRenderer.class new file mode 100644 index 0000000..b931685 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ISwitchRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ISwitchRendererProxy.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ISwitchRendererProxy.class new file mode 100644 index 0000000..dbff29a Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ISwitchRendererProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ITextFieldRenderer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ITextFieldRenderer.class new file mode 100644 index 0000000..173d177 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ITextFieldRenderer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ITextFieldRendererProxy.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ITextFieldRendererProxy.class new file mode 100644 index 0000000..1f0ce7f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ITextFieldRendererProxy.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ITheme.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ITheme.class new file mode 100644 index 0000000..6229c62 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ITheme.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/IThemeMultiplexer.class b/lib/json-20180813/com/lukflug/panelstudio/theme/IThemeMultiplexer.class new file mode 100644 index 0000000..41f236f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/IThemeMultiplexer.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$1.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$1.class new file mode 100644 index 0000000..5d16e69 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$10.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$10.class new file mode 100644 index 0000000..ae119bb Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$10.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$11.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$11.class new file mode 100644 index 0000000..a527da1 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$11.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$12.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$12.class new file mode 100644 index 0000000..f721357 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$12.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$13.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$13.class new file mode 100644 index 0000000..75360dc Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$13.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$14.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$14.class new file mode 100644 index 0000000..0eae8ab Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$14.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$15.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$15.class new file mode 100644 index 0000000..6de9981 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$15.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$2.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$2.class new file mode 100644 index 0000000..97a006e Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$3.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$3.class new file mode 100644 index 0000000..3b6645d Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$4.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$4.class new file mode 100644 index 0000000..8d4a6de Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$5.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$5.class new file mode 100644 index 0000000..d338493 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$5.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$6.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$6.class new file mode 100644 index 0000000..aaf9d21 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$6.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$7.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$7.class new file mode 100644 index 0000000..e5456dc Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$7.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$8.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$8.class new file mode 100644 index 0000000..3ee5be5 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$8.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$9.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$9.class new file mode 100644 index 0000000..dd23f9c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme$9.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme.class new file mode 100644 index 0000000..c944fa0 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ImpactTheme.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/OptimizedTheme$ParameterTuple.class b/lib/json-20180813/com/lukflug/panelstudio/theme/OptimizedTheme$ParameterTuple.class new file mode 100644 index 0000000..f9f825a Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/OptimizedTheme$ParameterTuple.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/OptimizedTheme.class b/lib/json-20180813/com/lukflug/panelstudio/theme/OptimizedTheme.class new file mode 100644 index 0000000..5c5b076 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/OptimizedTheme.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$1.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$1.class new file mode 100644 index 0000000..2448240 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$10.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$10.class new file mode 100644 index 0000000..64b5b1b Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$10.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$11.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$11.class new file mode 100644 index 0000000..f99d180 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$11.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$12.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$12.class new file mode 100644 index 0000000..d92a27e Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$12.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$13.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$13.class new file mode 100644 index 0000000..69fb229 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$13.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$14.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$14.class new file mode 100644 index 0000000..2d2e19c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$14.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$15.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$15.class new file mode 100644 index 0000000..15b694f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$15.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$2.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$2.class new file mode 100644 index 0000000..700dee7 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$3.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$3.class new file mode 100644 index 0000000..080b433 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$4.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$4.class new file mode 100644 index 0000000..17dbac0 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$5.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$5.class new file mode 100644 index 0000000..9a0e87b Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$5.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$6.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$6.class new file mode 100644 index 0000000..746f7c4 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$6.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$7.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$7.class new file mode 100644 index 0000000..ddab837 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$7.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$8.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$8.class new file mode 100644 index 0000000..7004c91 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$8.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$9.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$9.class new file mode 100644 index 0000000..114cbcb Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme$9.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme.class new file mode 100644 index 0000000..1ae1df7 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RainbowTheme.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/RendererTuple.class b/lib/json-20180813/com/lukflug/panelstudio/theme/RendererTuple.class new file mode 100644 index 0000000..d07736c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/RendererTuple.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/StandardColorPicker.class b/lib/json-20180813/com/lukflug/panelstudio/theme/StandardColorPicker.class new file mode 100644 index 0000000..b323004 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/StandardColorPicker.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ThemeBase.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ThemeBase.class new file mode 100644 index 0000000..fbff16c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ThemeBase.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/ThemeTuple.class b/lib/json-20180813/com/lukflug/panelstudio/theme/ThemeTuple.class new file mode 100644 index 0000000..7f7fe0e Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/ThemeTuple.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$1.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$1.class new file mode 100644 index 0000000..e047f90 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$10.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$10.class new file mode 100644 index 0000000..9d9f139 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$10.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$11.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$11.class new file mode 100644 index 0000000..2d3fc9c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$11.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$12.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$12.class new file mode 100644 index 0000000..104a1a2 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$12.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$13.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$13.class new file mode 100644 index 0000000..6f257e7 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$13.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$14.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$14.class new file mode 100644 index 0000000..1e05fd8 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$14.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$15.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$15.class new file mode 100644 index 0000000..3b785b5 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$15.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$2.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$2.class new file mode 100644 index 0000000..4f56397 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$3.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$3.class new file mode 100644 index 0000000..89f804d Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$4.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$4.class new file mode 100644 index 0000000..9c661a6 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$5.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$5.class new file mode 100644 index 0000000..20d606f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$5.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$6.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$6.class new file mode 100644 index 0000000..cde4d38 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$6.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$7.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$7.class new file mode 100644 index 0000000..8cfa5b2 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$7.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$8.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$8.class new file mode 100644 index 0000000..33b84e4 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$8.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$9.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$9.class new file mode 100644 index 0000000..6180518 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme$9.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme.class b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme.class new file mode 100644 index 0000000..232817d Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/theme/Windows31Theme.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/Button.class b/lib/json-20180813/com/lukflug/panelstudio/widget/Button.class new file mode 100644 index 0000000..f8b857f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/Button.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$1.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$1.class new file mode 100644 index 0000000..dea3564 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$2.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$2.class new file mode 100644 index 0000000..f1d82dc Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$3.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$3.class new file mode 100644 index 0000000..1fc87a9 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$4$1.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$4$1.class new file mode 100644 index 0000000..bb3c84a Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$4$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$4.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$4.class new file mode 100644 index 0000000..e4a2b78 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$5.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$5.class new file mode 100644 index 0000000..a4124cf Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$5.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$6.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$6.class new file mode 100644 index 0000000..df8691e Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$6.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$7.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$7.class new file mode 100644 index 0000000..28f3210 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent$7.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent.class new file mode 100644 index 0000000..43d8e70 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ClosableComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ColorComponent$ColorNumber.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ColorComponent$ColorNumber.class new file mode 100644 index 0000000..55c1d14 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ColorComponent$ColorNumber.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ColorComponent$RainbowToggle.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ColorComponent$RainbowToggle.class new file mode 100644 index 0000000..068d7fb Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ColorComponent$RainbowToggle.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ColorComponent.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ColorComponent.class new file mode 100644 index 0000000..adb1d08 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ColorComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ColorPicker.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ColorPicker.class new file mode 100644 index 0000000..2ceb806 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ColorPicker.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ColorPickerComponent.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ColorPickerComponent.class new file mode 100644 index 0000000..89a4f61 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ColorPickerComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ColorSliderComponent.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ColorSliderComponent.class new file mode 100644 index 0000000..1ab1c63 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ColorSliderComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/CycleButton.class b/lib/json-20180813/com/lukflug/panelstudio/widget/CycleButton.class new file mode 100644 index 0000000..783da38 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/CycleButton.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/CycleSwitch.class b/lib/json-20180813/com/lukflug/panelstudio/widget/CycleSwitch.class new file mode 100644 index 0000000..7d585f4 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/CycleSwitch.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$1.class b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$1.class new file mode 100644 index 0000000..7b690c9 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$2.class b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$2.class new file mode 100644 index 0000000..bf1ea54 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$3.class b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$3.class new file mode 100644 index 0000000..b270979 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$4.class b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$4.class new file mode 100644 index 0000000..d1cbefc Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$5.class b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$5.class new file mode 100644 index 0000000..8e8b742 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$5.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$6.class b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$6.class new file mode 100644 index 0000000..2d0d872 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$6.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$7.class b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$7.class new file mode 100644 index 0000000..6d4e9c4 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$7.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$8.class b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$8.class new file mode 100644 index 0000000..538e697 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList$8.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList.class b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList.class new file mode 100644 index 0000000..1986c98 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/DropDownList.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/EmptySpace.class b/lib/json-20180813/com/lukflug/panelstudio/widget/EmptySpace.class new file mode 100644 index 0000000..caba776 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/EmptySpace.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ITextFieldKeys.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ITextFieldKeys.class new file mode 100644 index 0000000..c169ba3 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ITextFieldKeys.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/KeybindComponent.class b/lib/json-20180813/com/lukflug/panelstudio/widget/KeybindComponent.class new file mode 100644 index 0000000..00daca4 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/KeybindComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/NumberSlider.class b/lib/json-20180813/com/lukflug/panelstudio/widget/NumberSlider.class new file mode 100644 index 0000000..62bc931 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/NumberSlider.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/RadioButton.class b/lib/json-20180813/com/lukflug/panelstudio/widget/RadioButton.class new file mode 100644 index 0000000..ff76c58 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/RadioButton.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ResizableComponent.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ResizableComponent.class new file mode 100644 index 0000000..c943eb0 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ResizableComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBar.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBar.class new file mode 100644 index 0000000..a6e27c5 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBar.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$1.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$1.class new file mode 100644 index 0000000..b50ab8a Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$2.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$2.class new file mode 100644 index 0000000..4b067a8 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$3.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$3.class new file mode 100644 index 0000000..1166d46 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$4.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$4.class new file mode 100644 index 0000000..a024a07 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$5.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$5.class new file mode 100644 index 0000000..5e95c1c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$5.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$6.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$6.class new file mode 100644 index 0000000..cc70b3d Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$6.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$7.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$7.class new file mode 100644 index 0000000..27616c0 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent$7.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent.class new file mode 100644 index 0000000..b22cd97 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ScrollBarComponent.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$1.class b/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$1.class new file mode 100644 index 0000000..94ad0ff Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$2.class b/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$2.class new file mode 100644 index 0000000..9cab2c3 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$3.class b/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$3.class new file mode 100644 index 0000000..189292a Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$4.class b/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$4.class new file mode 100644 index 0000000..5af2c87 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$5.class b/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$5.class new file mode 100644 index 0000000..fab2b86 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton$5.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton.class b/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton.class new file mode 100644 index 0000000..416311b Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/SearchableRadioButton.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/Slider.class b/lib/json-20180813/com/lukflug/panelstudio/widget/Slider.class new file mode 100644 index 0000000..520d614 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/Slider.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$1.class b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$1.class new file mode 100644 index 0000000..5fbc26f Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$1.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$2.class b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$2.class new file mode 100644 index 0000000..4442cbd Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$2.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$3.class b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$3.class new file mode 100644 index 0000000..57a1ae2 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$3.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$4.class b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$4.class new file mode 100644 index 0000000..9ee13e3 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$4.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$5.class b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$5.class new file mode 100644 index 0000000..ddb0dcb Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$5.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$6.class b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$6.class new file mode 100644 index 0000000..15c465c Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$6.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$7.class b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$7.class new file mode 100644 index 0000000..87b50fa Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner$7.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner.class b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner.class new file mode 100644 index 0000000..365bbdd Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/Spinner.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/TextField.class b/lib/json-20180813/com/lukflug/panelstudio/widget/TextField.class new file mode 100644 index 0000000..d886fe5 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/TextField.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ToggleButton.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ToggleButton.class new file mode 100644 index 0000000..2473104 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ToggleButton.class differ diff --git a/lib/json-20180813/com/lukflug/panelstudio/widget/ToggleSwitch.class b/lib/json-20180813/com/lukflug/panelstudio/widget/ToggleSwitch.class new file mode 100644 index 0000000..f6f4283 Binary files /dev/null and b/lib/json-20180813/com/lukflug/panelstudio/widget/ToggleSwitch.class differ diff --git a/lib/json-20180813/com/sun/jna/AltCallingConvention.class b/lib/json-20180813/com/sun/jna/AltCallingConvention.class new file mode 100644 index 0000000..d7b2752 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/AltCallingConvention.class differ diff --git a/lib/json-20180813/com/sun/jna/Callback$UncaughtExceptionHandler.class b/lib/json-20180813/com/sun/jna/Callback$UncaughtExceptionHandler.class new file mode 100644 index 0000000..006e9f4 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Callback$UncaughtExceptionHandler.class differ diff --git a/lib/json-20180813/com/sun/jna/Callback.class b/lib/json-20180813/com/sun/jna/Callback.class new file mode 100644 index 0000000..db09e39 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Callback.class differ diff --git a/lib/json-20180813/com/sun/jna/CallbackParameterContext.class b/lib/json-20180813/com/sun/jna/CallbackParameterContext.class new file mode 100644 index 0000000..44d6571 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/CallbackParameterContext.class differ diff --git a/lib/json-20180813/com/sun/jna/CallbackProxy.class b/lib/json-20180813/com/sun/jna/CallbackProxy.class new file mode 100644 index 0000000..371a130 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/CallbackProxy.class differ diff --git a/lib/json-20180813/com/sun/jna/CallbackReference$AttachOptions.class b/lib/json-20180813/com/sun/jna/CallbackReference$AttachOptions.class new file mode 100644 index 0000000..31e9109 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/CallbackReference$AttachOptions.class differ diff --git a/lib/json-20180813/com/sun/jna/CallbackReference$DefaultCallbackProxy.class b/lib/json-20180813/com/sun/jna/CallbackReference$DefaultCallbackProxy.class new file mode 100644 index 0000000..9b996d2 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/CallbackReference$DefaultCallbackProxy.class differ diff --git a/lib/json-20180813/com/sun/jna/CallbackReference$NativeFunctionHandler.class b/lib/json-20180813/com/sun/jna/CallbackReference$NativeFunctionHandler.class new file mode 100644 index 0000000..6ef5b11 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/CallbackReference$NativeFunctionHandler.class differ diff --git a/lib/json-20180813/com/sun/jna/CallbackReference.class b/lib/json-20180813/com/sun/jna/CallbackReference.class new file mode 100644 index 0000000..5d7934f Binary files /dev/null and b/lib/json-20180813/com/sun/jna/CallbackReference.class differ diff --git a/lib/json-20180813/com/sun/jna/CallbackResultContext.class b/lib/json-20180813/com/sun/jna/CallbackResultContext.class new file mode 100644 index 0000000..92cfa4c Binary files /dev/null and b/lib/json-20180813/com/sun/jna/CallbackResultContext.class differ diff --git a/lib/json-20180813/com/sun/jna/CallbackThreadInitializer.class b/lib/json-20180813/com/sun/jna/CallbackThreadInitializer.class new file mode 100644 index 0000000..a21366b Binary files /dev/null and b/lib/json-20180813/com/sun/jna/CallbackThreadInitializer.class differ diff --git a/lib/json-20180813/com/sun/jna/DefaultTypeMapper$Entry.class b/lib/json-20180813/com/sun/jna/DefaultTypeMapper$Entry.class new file mode 100644 index 0000000..1188943 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/DefaultTypeMapper$Entry.class differ diff --git a/lib/json-20180813/com/sun/jna/DefaultTypeMapper.class b/lib/json-20180813/com/sun/jna/DefaultTypeMapper.class new file mode 100644 index 0000000..4bcb055 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/DefaultTypeMapper.class differ diff --git a/lib/json-20180813/com/sun/jna/ELFAnalyser.class b/lib/json-20180813/com/sun/jna/ELFAnalyser.class new file mode 100644 index 0000000..659d420 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/ELFAnalyser.class differ diff --git a/lib/json-20180813/com/sun/jna/FromNativeContext.class b/lib/json-20180813/com/sun/jna/FromNativeContext.class new file mode 100644 index 0000000..7dc47b3 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/FromNativeContext.class differ diff --git a/lib/json-20180813/com/sun/jna/FromNativeConverter.class b/lib/json-20180813/com/sun/jna/FromNativeConverter.class new file mode 100644 index 0000000..1e3a5ee Binary files /dev/null and b/lib/json-20180813/com/sun/jna/FromNativeConverter.class differ diff --git a/lib/json-20180813/com/sun/jna/Function$NativeMappedArray.class b/lib/json-20180813/com/sun/jna/Function$NativeMappedArray.class new file mode 100644 index 0000000..f7735d5 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Function$NativeMappedArray.class differ diff --git a/lib/json-20180813/com/sun/jna/Function$PointerArray.class b/lib/json-20180813/com/sun/jna/Function$PointerArray.class new file mode 100644 index 0000000..5ce9586 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Function$PointerArray.class differ diff --git a/lib/json-20180813/com/sun/jna/Function$PostCallRead.class b/lib/json-20180813/com/sun/jna/Function$PostCallRead.class new file mode 100644 index 0000000..4883c04 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Function$PostCallRead.class differ diff --git a/lib/json-20180813/com/sun/jna/Function.class b/lib/json-20180813/com/sun/jna/Function.class new file mode 100644 index 0000000..baef74c Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Function.class differ diff --git a/lib/json-20180813/com/sun/jna/FunctionMapper.class b/lib/json-20180813/com/sun/jna/FunctionMapper.class new file mode 100644 index 0000000..c6b4942 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/FunctionMapper.class differ diff --git a/lib/json-20180813/com/sun/jna/FunctionParameterContext.class b/lib/json-20180813/com/sun/jna/FunctionParameterContext.class new file mode 100644 index 0000000..29c9997 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/FunctionParameterContext.class differ diff --git a/lib/json-20180813/com/sun/jna/FunctionResultContext.class b/lib/json-20180813/com/sun/jna/FunctionResultContext.class new file mode 100644 index 0000000..72c5b41 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/FunctionResultContext.class differ diff --git a/lib/json-20180813/com/sun/jna/IntegerType.class b/lib/json-20180813/com/sun/jna/IntegerType.class new file mode 100644 index 0000000..5b849b0 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/IntegerType.class differ diff --git a/lib/json-20180813/com/sun/jna/InvocationMapper.class b/lib/json-20180813/com/sun/jna/InvocationMapper.class new file mode 100644 index 0000000..ce84f5a Binary files /dev/null and b/lib/json-20180813/com/sun/jna/InvocationMapper.class differ diff --git a/lib/json-20180813/com/sun/jna/JNIEnv.class b/lib/json-20180813/com/sun/jna/JNIEnv.class new file mode 100644 index 0000000..7c0eba6 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/JNIEnv.class differ diff --git a/lib/json-20180813/com/sun/jna/LastErrorException.class b/lib/json-20180813/com/sun/jna/LastErrorException.class new file mode 100644 index 0000000..a1de98a Binary files /dev/null and b/lib/json-20180813/com/sun/jna/LastErrorException.class differ diff --git a/lib/json-20180813/com/sun/jna/Library$Handler$FunctionInfo.class b/lib/json-20180813/com/sun/jna/Library$Handler$FunctionInfo.class new file mode 100644 index 0000000..961601c Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Library$Handler$FunctionInfo.class differ diff --git a/lib/json-20180813/com/sun/jna/Library$Handler.class b/lib/json-20180813/com/sun/jna/Library$Handler.class new file mode 100644 index 0000000..17ef1c1 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Library$Handler.class differ diff --git a/lib/json-20180813/com/sun/jna/Library.class b/lib/json-20180813/com/sun/jna/Library.class new file mode 100644 index 0000000..046b850 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Library.class differ diff --git a/lib/json-20180813/com/sun/jna/Memory$SharedMemory.class b/lib/json-20180813/com/sun/jna/Memory$SharedMemory.class new file mode 100644 index 0000000..fd1c5b7 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Memory$SharedMemory.class differ diff --git a/lib/json-20180813/com/sun/jna/Memory.class b/lib/json-20180813/com/sun/jna/Memory.class new file mode 100644 index 0000000..a9332d8 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Memory.class differ diff --git a/lib/json-20180813/com/sun/jna/MethodParameterContext.class b/lib/json-20180813/com/sun/jna/MethodParameterContext.class new file mode 100644 index 0000000..2897131 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/MethodParameterContext.class differ diff --git a/lib/json-20180813/com/sun/jna/MethodResultContext.class b/lib/json-20180813/com/sun/jna/MethodResultContext.class new file mode 100644 index 0000000..d492349 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/MethodResultContext.class differ diff --git a/lib/json-20180813/com/sun/jna/Native$1.class b/lib/json-20180813/com/sun/jna/Native$1.class new file mode 100644 index 0000000..2322a6d Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Native$1.class differ diff --git a/lib/json-20180813/com/sun/jna/Native$2.class b/lib/json-20180813/com/sun/jna/Native$2.class new file mode 100644 index 0000000..9f671e8 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Native$2.class differ diff --git a/lib/json-20180813/com/sun/jna/Native$3.class b/lib/json-20180813/com/sun/jna/Native$3.class new file mode 100644 index 0000000..315b439 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Native$3.class differ diff --git a/lib/json-20180813/com/sun/jna/Native$4.class b/lib/json-20180813/com/sun/jna/Native$4.class new file mode 100644 index 0000000..d2ec82f Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Native$4.class differ diff --git a/lib/json-20180813/com/sun/jna/Native$5.class b/lib/json-20180813/com/sun/jna/Native$5.class new file mode 100644 index 0000000..bbea522 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Native$5.class differ diff --git a/lib/json-20180813/com/sun/jna/Native$6.class b/lib/json-20180813/com/sun/jna/Native$6.class new file mode 100644 index 0000000..31baef4 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Native$6.class differ diff --git a/lib/json-20180813/com/sun/jna/Native$7.class b/lib/json-20180813/com/sun/jna/Native$7.class new file mode 100644 index 0000000..bb9a5ca Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Native$7.class differ diff --git a/lib/json-20180813/com/sun/jna/Native$AWT.class b/lib/json-20180813/com/sun/jna/Native$AWT.class new file mode 100644 index 0000000..709ecef Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Native$AWT.class differ diff --git a/lib/json-20180813/com/sun/jna/Native$Buffers.class b/lib/json-20180813/com/sun/jna/Native$Buffers.class new file mode 100644 index 0000000..ba1a833 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Native$Buffers.class differ diff --git a/lib/json-20180813/com/sun/jna/Native$ffi_callback.class b/lib/json-20180813/com/sun/jna/Native$ffi_callback.class new file mode 100644 index 0000000..5db1a53 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Native$ffi_callback.class differ diff --git a/lib/json-20180813/com/sun/jna/Native.class b/lib/json-20180813/com/sun/jna/Native.class new file mode 100644 index 0000000..067fa9f Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Native.class differ diff --git a/lib/json-20180813/com/sun/jna/NativeLibrary$1.class b/lib/json-20180813/com/sun/jna/NativeLibrary$1.class new file mode 100644 index 0000000..5dbf4a4 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/NativeLibrary$1.class differ diff --git a/lib/json-20180813/com/sun/jna/NativeLibrary$2.class b/lib/json-20180813/com/sun/jna/NativeLibrary$2.class new file mode 100644 index 0000000..d0fbc98 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/NativeLibrary$2.class differ diff --git a/lib/json-20180813/com/sun/jna/NativeLibrary.class b/lib/json-20180813/com/sun/jna/NativeLibrary.class new file mode 100644 index 0000000..5699491 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/NativeLibrary.class differ diff --git a/lib/json-20180813/com/sun/jna/NativeLong.class b/lib/json-20180813/com/sun/jna/NativeLong.class new file mode 100644 index 0000000..872affd Binary files /dev/null and b/lib/json-20180813/com/sun/jna/NativeLong.class differ diff --git a/lib/json-20180813/com/sun/jna/NativeMapped.class b/lib/json-20180813/com/sun/jna/NativeMapped.class new file mode 100644 index 0000000..b6aebd8 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/NativeMapped.class differ diff --git a/lib/json-20180813/com/sun/jna/NativeMappedConverter.class b/lib/json-20180813/com/sun/jna/NativeMappedConverter.class new file mode 100644 index 0000000..c4b7439 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/NativeMappedConverter.class differ diff --git a/lib/json-20180813/com/sun/jna/NativeString$StringMemory.class b/lib/json-20180813/com/sun/jna/NativeString$StringMemory.class new file mode 100644 index 0000000..02aff3b Binary files /dev/null and b/lib/json-20180813/com/sun/jna/NativeString$StringMemory.class differ diff --git a/lib/json-20180813/com/sun/jna/NativeString.class b/lib/json-20180813/com/sun/jna/NativeString.class new file mode 100644 index 0000000..6558770 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/NativeString.class differ diff --git a/lib/json-20180813/com/sun/jna/Platform.class b/lib/json-20180813/com/sun/jna/Platform.class new file mode 100644 index 0000000..e48970d Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Platform.class differ diff --git a/lib/json-20180813/com/sun/jna/Pointer$1.class b/lib/json-20180813/com/sun/jna/Pointer$1.class new file mode 100644 index 0000000..c4870d9 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Pointer$1.class differ diff --git a/lib/json-20180813/com/sun/jna/Pointer$Opaque.class b/lib/json-20180813/com/sun/jna/Pointer$Opaque.class new file mode 100644 index 0000000..9732f4d Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Pointer$Opaque.class differ diff --git a/lib/json-20180813/com/sun/jna/Pointer.class b/lib/json-20180813/com/sun/jna/Pointer.class new file mode 100644 index 0000000..04c63f6 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Pointer.class differ diff --git a/lib/json-20180813/com/sun/jna/PointerType.class b/lib/json-20180813/com/sun/jna/PointerType.class new file mode 100644 index 0000000..61811e6 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/PointerType.class differ diff --git a/lib/json-20180813/com/sun/jna/StringArray.class b/lib/json-20180813/com/sun/jna/StringArray.class new file mode 100644 index 0000000..df9bd52 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/StringArray.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure$1.class b/lib/json-20180813/com/sun/jna/Structure$1.class new file mode 100644 index 0000000..152b527 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure$1.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure$2.class b/lib/json-20180813/com/sun/jna/Structure$2.class new file mode 100644 index 0000000..04e6ca7 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure$2.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure$3.class b/lib/json-20180813/com/sun/jna/Structure$3.class new file mode 100644 index 0000000..155a51a Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure$3.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure$AutoAllocated.class b/lib/json-20180813/com/sun/jna/Structure$AutoAllocated.class new file mode 100644 index 0000000..0d23f0a Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure$AutoAllocated.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure$ByReference.class b/lib/json-20180813/com/sun/jna/Structure$ByReference.class new file mode 100644 index 0000000..271329c Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure$ByReference.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure$ByValue.class b/lib/json-20180813/com/sun/jna/Structure$ByValue.class new file mode 100644 index 0000000..951c6a7 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure$ByValue.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure$FFIType$FFITypes.class b/lib/json-20180813/com/sun/jna/Structure$FFIType$FFITypes.class new file mode 100644 index 0000000..808783b Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure$FFIType$FFITypes.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure$FFIType$size_t.class b/lib/json-20180813/com/sun/jna/Structure$FFIType$size_t.class new file mode 100644 index 0000000..515dddc Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure$FFIType$size_t.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure$FFIType.class b/lib/json-20180813/com/sun/jna/Structure$FFIType.class new file mode 100644 index 0000000..47e03ce Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure$FFIType.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure$LayoutInfo.class b/lib/json-20180813/com/sun/jna/Structure$LayoutInfo.class new file mode 100644 index 0000000..d274a2d Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure$LayoutInfo.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure$StructField.class b/lib/json-20180813/com/sun/jna/Structure$StructField.class new file mode 100644 index 0000000..35a2f56 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure$StructField.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure$StructureSet.class b/lib/json-20180813/com/sun/jna/Structure$StructureSet.class new file mode 100644 index 0000000..d374212 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure$StructureSet.class differ diff --git a/lib/json-20180813/com/sun/jna/Structure.class b/lib/json-20180813/com/sun/jna/Structure.class new file mode 100644 index 0000000..2c97b2c Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Structure.class differ diff --git a/lib/json-20180813/com/sun/jna/StructureReadContext.class b/lib/json-20180813/com/sun/jna/StructureReadContext.class new file mode 100644 index 0000000..fd142f3 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/StructureReadContext.class differ diff --git a/lib/json-20180813/com/sun/jna/StructureWriteContext.class b/lib/json-20180813/com/sun/jna/StructureWriteContext.class new file mode 100644 index 0000000..aef687c Binary files /dev/null and b/lib/json-20180813/com/sun/jna/StructureWriteContext.class differ diff --git a/lib/json-20180813/com/sun/jna/ToNativeContext.class b/lib/json-20180813/com/sun/jna/ToNativeContext.class new file mode 100644 index 0000000..7c44e6d Binary files /dev/null and b/lib/json-20180813/com/sun/jna/ToNativeContext.class differ diff --git a/lib/json-20180813/com/sun/jna/ToNativeConverter.class b/lib/json-20180813/com/sun/jna/ToNativeConverter.class new file mode 100644 index 0000000..5988be1 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/ToNativeConverter.class differ diff --git a/lib/json-20180813/com/sun/jna/TypeConverter.class b/lib/json-20180813/com/sun/jna/TypeConverter.class new file mode 100644 index 0000000..0523b1e Binary files /dev/null and b/lib/json-20180813/com/sun/jna/TypeConverter.class differ diff --git a/lib/json-20180813/com/sun/jna/TypeMapper.class b/lib/json-20180813/com/sun/jna/TypeMapper.class new file mode 100644 index 0000000..7356ae2 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/TypeMapper.class differ diff --git a/lib/json-20180813/com/sun/jna/Union.class b/lib/json-20180813/com/sun/jna/Union.class new file mode 100644 index 0000000..392efe9 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Union.class differ diff --git a/lib/json-20180813/com/sun/jna/VarArgsChecker$1.class b/lib/json-20180813/com/sun/jna/VarArgsChecker$1.class new file mode 100644 index 0000000..67d5b67 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/VarArgsChecker$1.class differ diff --git a/lib/json-20180813/com/sun/jna/VarArgsChecker$NoVarArgsChecker.class b/lib/json-20180813/com/sun/jna/VarArgsChecker$NoVarArgsChecker.class new file mode 100644 index 0000000..4171fbe Binary files /dev/null and b/lib/json-20180813/com/sun/jna/VarArgsChecker$NoVarArgsChecker.class differ diff --git a/lib/json-20180813/com/sun/jna/VarArgsChecker$RealVarArgsChecker.class b/lib/json-20180813/com/sun/jna/VarArgsChecker$RealVarArgsChecker.class new file mode 100644 index 0000000..90f2656 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/VarArgsChecker$RealVarArgsChecker.class differ diff --git a/lib/json-20180813/com/sun/jna/VarArgsChecker.class b/lib/json-20180813/com/sun/jna/VarArgsChecker.class new file mode 100644 index 0000000..822dc9d Binary files /dev/null and b/lib/json-20180813/com/sun/jna/VarArgsChecker.class differ diff --git a/lib/json-20180813/com/sun/jna/Version.class b/lib/json-20180813/com/sun/jna/Version.class new file mode 100644 index 0000000..7d6b847 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/Version.class differ diff --git a/lib/json-20180813/com/sun/jna/WString.class b/lib/json-20180813/com/sun/jna/WString.class new file mode 100644 index 0000000..456031f Binary files /dev/null and b/lib/json-20180813/com/sun/jna/WString.class differ diff --git a/lib/json-20180813/com/sun/jna/WeakMemoryHolder.class b/lib/json-20180813/com/sun/jna/WeakMemoryHolder.class new file mode 100644 index 0000000..3bac8e6 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/WeakMemoryHolder.class differ diff --git a/lib/json-20180813/com/sun/jna/aix-ppc/libjnidispatch.a b/lib/json-20180813/com/sun/jna/aix-ppc/libjnidispatch.a new file mode 100644 index 0000000..1d82809 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/aix-ppc/libjnidispatch.a differ diff --git a/lib/json-20180813/com/sun/jna/aix-ppc64/libjnidispatch.a b/lib/json-20180813/com/sun/jna/aix-ppc64/libjnidispatch.a new file mode 100644 index 0000000..414ac11 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/aix-ppc64/libjnidispatch.a differ diff --git a/lib/json-20180813/com/sun/jna/darwin/libjnidispatch.jnilib b/lib/json-20180813/com/sun/jna/darwin/libjnidispatch.jnilib new file mode 100644 index 0000000..ac30c52 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/darwin/libjnidispatch.jnilib differ diff --git a/lib/json-20180813/com/sun/jna/freebsd-x86-64/libjnidispatch.so b/lib/json-20180813/com/sun/jna/freebsd-x86-64/libjnidispatch.so new file mode 100644 index 0000000..9f6c2ef Binary files /dev/null and b/lib/json-20180813/com/sun/jna/freebsd-x86-64/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/freebsd-x86/libjnidispatch.so b/lib/json-20180813/com/sun/jna/freebsd-x86/libjnidispatch.so new file mode 100644 index 0000000..67c3583 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/freebsd-x86/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/linux-aarch64/libjnidispatch.so b/lib/json-20180813/com/sun/jna/linux-aarch64/libjnidispatch.so new file mode 100644 index 0000000..9e956ba Binary files /dev/null and b/lib/json-20180813/com/sun/jna/linux-aarch64/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/linux-arm/libjnidispatch.so b/lib/json-20180813/com/sun/jna/linux-arm/libjnidispatch.so new file mode 100644 index 0000000..2a5dba6 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/linux-arm/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/linux-armel/libjnidispatch.so b/lib/json-20180813/com/sun/jna/linux-armel/libjnidispatch.so new file mode 100644 index 0000000..a060034 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/linux-armel/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/linux-mips64el/libjnidispatch.so b/lib/json-20180813/com/sun/jna/linux-mips64el/libjnidispatch.so new file mode 100644 index 0000000..9d0d04c Binary files /dev/null and b/lib/json-20180813/com/sun/jna/linux-mips64el/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/linux-ppc/libjnidispatch.so b/lib/json-20180813/com/sun/jna/linux-ppc/libjnidispatch.so new file mode 100644 index 0000000..2a8dc61 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/linux-ppc/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/linux-ppc64le/libjnidispatch.so b/lib/json-20180813/com/sun/jna/linux-ppc64le/libjnidispatch.so new file mode 100644 index 0000000..2523460 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/linux-ppc64le/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/linux-s390x/libjnidispatch.so b/lib/json-20180813/com/sun/jna/linux-s390x/libjnidispatch.so new file mode 100644 index 0000000..b268e15 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/linux-s390x/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/linux-x86-64/libjnidispatch.so b/lib/json-20180813/com/sun/jna/linux-x86-64/libjnidispatch.so new file mode 100644 index 0000000..93db79e Binary files /dev/null and b/lib/json-20180813/com/sun/jna/linux-x86-64/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/linux-x86/libjnidispatch.so b/lib/json-20180813/com/sun/jna/linux-x86/libjnidispatch.so new file mode 100644 index 0000000..0e85235 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/linux-x86/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/openbsd-x86-64/libjnidispatch.so b/lib/json-20180813/com/sun/jna/openbsd-x86-64/libjnidispatch.so new file mode 100644 index 0000000..ef361c2 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/openbsd-x86-64/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/openbsd-x86/libjnidispatch.so b/lib/json-20180813/com/sun/jna/openbsd-x86/libjnidispatch.so new file mode 100644 index 0000000..53fe149 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/openbsd-x86/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/ptr/ByReference.class b/lib/json-20180813/com/sun/jna/ptr/ByReference.class new file mode 100644 index 0000000..f07c9e5 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/ptr/ByReference.class differ diff --git a/lib/json-20180813/com/sun/jna/ptr/ByteByReference.class b/lib/json-20180813/com/sun/jna/ptr/ByteByReference.class new file mode 100644 index 0000000..380429d Binary files /dev/null and b/lib/json-20180813/com/sun/jna/ptr/ByteByReference.class differ diff --git a/lib/json-20180813/com/sun/jna/ptr/DoubleByReference.class b/lib/json-20180813/com/sun/jna/ptr/DoubleByReference.class new file mode 100644 index 0000000..042fb31 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/ptr/DoubleByReference.class differ diff --git a/lib/json-20180813/com/sun/jna/ptr/FloatByReference.class b/lib/json-20180813/com/sun/jna/ptr/FloatByReference.class new file mode 100644 index 0000000..f1ea7c9 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/ptr/FloatByReference.class differ diff --git a/lib/json-20180813/com/sun/jna/ptr/IntByReference.class b/lib/json-20180813/com/sun/jna/ptr/IntByReference.class new file mode 100644 index 0000000..58eadfa Binary files /dev/null and b/lib/json-20180813/com/sun/jna/ptr/IntByReference.class differ diff --git a/lib/json-20180813/com/sun/jna/ptr/LongByReference.class b/lib/json-20180813/com/sun/jna/ptr/LongByReference.class new file mode 100644 index 0000000..0a698ed Binary files /dev/null and b/lib/json-20180813/com/sun/jna/ptr/LongByReference.class differ diff --git a/lib/json-20180813/com/sun/jna/ptr/NativeLongByReference.class b/lib/json-20180813/com/sun/jna/ptr/NativeLongByReference.class new file mode 100644 index 0000000..d2e02b9 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/ptr/NativeLongByReference.class differ diff --git a/lib/json-20180813/com/sun/jna/ptr/PointerByReference.class b/lib/json-20180813/com/sun/jna/ptr/PointerByReference.class new file mode 100644 index 0000000..5e039c9 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/ptr/PointerByReference.class differ diff --git a/lib/json-20180813/com/sun/jna/ptr/ShortByReference.class b/lib/json-20180813/com/sun/jna/ptr/ShortByReference.class new file mode 100644 index 0000000..a778820 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/ptr/ShortByReference.class differ diff --git a/lib/json-20180813/com/sun/jna/sunos-sparc/libjnidispatch.so b/lib/json-20180813/com/sun/jna/sunos-sparc/libjnidispatch.so new file mode 100644 index 0000000..c0e897d Binary files /dev/null and b/lib/json-20180813/com/sun/jna/sunos-sparc/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/sunos-sparcv9/libjnidispatch.so b/lib/json-20180813/com/sun/jna/sunos-sparcv9/libjnidispatch.so new file mode 100644 index 0000000..7f2472e Binary files /dev/null and b/lib/json-20180813/com/sun/jna/sunos-sparcv9/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/sunos-x86-64/libjnidispatch.so b/lib/json-20180813/com/sun/jna/sunos-x86-64/libjnidispatch.so new file mode 100644 index 0000000..d3e7a05 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/sunos-x86-64/libjnidispatch.so differ diff --git a/lib/json-20180813/com/sun/jna/win32-x86-64/jnidispatch.dll b/lib/json-20180813/com/sun/jna/win32-x86-64/jnidispatch.dll new file mode 100644 index 0000000..10d49b2 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32-x86-64/jnidispatch.dll differ diff --git a/lib/json-20180813/com/sun/jna/win32-x86/jnidispatch.dll b/lib/json-20180813/com/sun/jna/win32-x86/jnidispatch.dll new file mode 100644 index 0000000..213a2bb Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32-x86/jnidispatch.dll differ diff --git a/lib/json-20180813/com/sun/jna/win32/DLLCallback.class b/lib/json-20180813/com/sun/jna/win32/DLLCallback.class new file mode 100644 index 0000000..871c33b Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32/DLLCallback.class differ diff --git a/lib/json-20180813/com/sun/jna/win32/StdCall.class b/lib/json-20180813/com/sun/jna/win32/StdCall.class new file mode 100644 index 0000000..b6fdbd0 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32/StdCall.class differ diff --git a/lib/json-20180813/com/sun/jna/win32/StdCallFunctionMapper.class b/lib/json-20180813/com/sun/jna/win32/StdCallFunctionMapper.class new file mode 100644 index 0000000..3153cb2 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32/StdCallFunctionMapper.class differ diff --git a/lib/json-20180813/com/sun/jna/win32/StdCallLibrary$StdCallCallback.class b/lib/json-20180813/com/sun/jna/win32/StdCallLibrary$StdCallCallback.class new file mode 100644 index 0000000..39287a6 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32/StdCallLibrary$StdCallCallback.class differ diff --git a/lib/json-20180813/com/sun/jna/win32/StdCallLibrary.class b/lib/json-20180813/com/sun/jna/win32/StdCallLibrary.class new file mode 100644 index 0000000..2f19e8b Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32/StdCallLibrary.class differ diff --git a/lib/json-20180813/com/sun/jna/win32/W32APIFunctionMapper.class b/lib/json-20180813/com/sun/jna/win32/W32APIFunctionMapper.class new file mode 100644 index 0000000..3c17e2d Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32/W32APIFunctionMapper.class differ diff --git a/lib/json-20180813/com/sun/jna/win32/W32APIOptions$1.class b/lib/json-20180813/com/sun/jna/win32/W32APIOptions$1.class new file mode 100644 index 0000000..f8d5970 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32/W32APIOptions$1.class differ diff --git a/lib/json-20180813/com/sun/jna/win32/W32APIOptions$2.class b/lib/json-20180813/com/sun/jna/win32/W32APIOptions$2.class new file mode 100644 index 0000000..1beabb2 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32/W32APIOptions$2.class differ diff --git a/lib/json-20180813/com/sun/jna/win32/W32APIOptions.class b/lib/json-20180813/com/sun/jna/win32/W32APIOptions.class new file mode 100644 index 0000000..b34c1b1 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32/W32APIOptions.class differ diff --git a/lib/json-20180813/com/sun/jna/win32/W32APITypeMapper$1.class b/lib/json-20180813/com/sun/jna/win32/W32APITypeMapper$1.class new file mode 100644 index 0000000..ad35678 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32/W32APITypeMapper$1.class differ diff --git a/lib/json-20180813/com/sun/jna/win32/W32APITypeMapper$2.class b/lib/json-20180813/com/sun/jna/win32/W32APITypeMapper$2.class new file mode 100644 index 0000000..32b28d2 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32/W32APITypeMapper$2.class differ diff --git a/lib/json-20180813/com/sun/jna/win32/W32APITypeMapper.class b/lib/json-20180813/com/sun/jna/win32/W32APITypeMapper.class new file mode 100644 index 0000000..beb0414 Binary files /dev/null and b/lib/json-20180813/com/sun/jna/win32/W32APITypeMapper.class differ diff --git a/lib/json-20180813/darwin/libdiscord-rpc.dylib b/lib/json-20180813/darwin/libdiscord-rpc.dylib new file mode 100644 index 0000000..f01acd6 Binary files /dev/null and b/lib/json-20180813/darwin/libdiscord-rpc.dylib differ diff --git a/lib/json-20180813/fr/litarvan/openauth/AuthPoints.class b/lib/json-20180813/fr/litarvan/openauth/AuthPoints.class new file mode 100644 index 0000000..f50a216 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/AuthPoints.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/AuthenticationException.class b/lib/json-20180813/fr/litarvan/openauth/AuthenticationException.class new file mode 100644 index 0000000..84edd42 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/AuthenticationException.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/Authenticator.class b/lib/json-20180813/fr/litarvan/openauth/Authenticator.class new file mode 100644 index 0000000..ce4945e Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/Authenticator.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/AuthTokens.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/AuthTokens.class new file mode 100644 index 0000000..85ed9ec Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/AuthTokens.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/HttpClient.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/HttpClient.class new file mode 100644 index 0000000..208fd86 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/HttpClient.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/LoginFrame$1.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/LoginFrame$1.class new file mode 100644 index 0000000..b5690c3 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/LoginFrame$1.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/LoginFrame$2.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/LoginFrame$2.class new file mode 100644 index 0000000..bdec85a Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/LoginFrame$2.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/LoginFrame.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/LoginFrame.class new file mode 100644 index 0000000..5d7a052 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/LoginFrame.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/MicrosoftAuthResult.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/MicrosoftAuthResult.class new file mode 100644 index 0000000..efe0168 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/MicrosoftAuthResult.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/MicrosoftAuthenticationException.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/MicrosoftAuthenticationException.class new file mode 100644 index 0000000..4dc0466 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/MicrosoftAuthenticationException.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/MicrosoftAuthenticator.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/MicrosoftAuthenticator.class new file mode 100644 index 0000000..2940ecf Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/MicrosoftAuthenticator.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/MicrosoftPatchedHttpURLConnection.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/MicrosoftPatchedHttpURLConnection.class new file mode 100644 index 0000000..d6889d8 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/MicrosoftPatchedHttpURLConnection.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/PreAuthData.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/PreAuthData.class new file mode 100644 index 0000000..364ee96 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/PreAuthData.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/request/MinecraftLoginRequest.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/request/MinecraftLoginRequest.class new file mode 100644 index 0000000..8cb745b Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/request/MinecraftLoginRequest.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/request/XSTSAuthorizationProperties.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/request/XSTSAuthorizationProperties.class new file mode 100644 index 0000000..2551ef9 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/request/XSTSAuthorizationProperties.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/request/XboxLiveLoginProperties.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/request/XboxLiveLoginProperties.class new file mode 100644 index 0000000..766654a Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/request/XboxLiveLoginProperties.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/request/XboxLoginRequest.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/request/XboxLoginRequest.class new file mode 100644 index 0000000..ef0775e Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/request/XboxLoginRequest.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MicrosoftRefreshResponse.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MicrosoftRefreshResponse.class new file mode 100644 index 0000000..dbeccd0 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MicrosoftRefreshResponse.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftLoginResponse.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftLoginResponse.class new file mode 100644 index 0000000..6e4981d Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftLoginResponse.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftProfile$MinecraftSkin.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftProfile$MinecraftSkin.class new file mode 100644 index 0000000..f706167 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftProfile$MinecraftSkin.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftProfile.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftProfile.class new file mode 100644 index 0000000..d0ee1a9 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftProfile.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftStoreResponse$StoreProduct.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftStoreResponse$StoreProduct.class new file mode 100644 index 0000000..47a4653 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftStoreResponse$StoreProduct.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftStoreResponse.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftStoreResponse.class new file mode 100644 index 0000000..84fade3 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/MinecraftStoreResponse.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/XboxLoginResponse$XboxLiveLoginResponseClaims.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/XboxLoginResponse$XboxLiveLoginResponseClaims.class new file mode 100644 index 0000000..a99d6b4 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/XboxLoginResponse$XboxLiveLoginResponseClaims.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/XboxLoginResponse$XboxLiveUserInfo.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/XboxLoginResponse$XboxLiveUserInfo.class new file mode 100644 index 0000000..1e72931 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/XboxLoginResponse$XboxLiveUserInfo.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/XboxLoginResponse.class b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/XboxLoginResponse.class new file mode 100644 index 0000000..f0a5523 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/microsoft/model/response/XboxLoginResponse.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/model/AuthAgent.class b/lib/json-20180813/fr/litarvan/openauth/model/AuthAgent.class new file mode 100644 index 0000000..fcb8e20 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/model/AuthAgent.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/model/AuthError.class b/lib/json-20180813/fr/litarvan/openauth/model/AuthError.class new file mode 100644 index 0000000..d7e7482 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/model/AuthError.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/model/AuthProfile.class b/lib/json-20180813/fr/litarvan/openauth/model/AuthProfile.class new file mode 100644 index 0000000..68a153e Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/model/AuthProfile.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/model/request/AuthRequest.class b/lib/json-20180813/fr/litarvan/openauth/model/request/AuthRequest.class new file mode 100644 index 0000000..585c690 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/model/request/AuthRequest.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/model/request/InvalidateRequest.class b/lib/json-20180813/fr/litarvan/openauth/model/request/InvalidateRequest.class new file mode 100644 index 0000000..61fbbeb Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/model/request/InvalidateRequest.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/model/request/RefreshRequest.class b/lib/json-20180813/fr/litarvan/openauth/model/request/RefreshRequest.class new file mode 100644 index 0000000..b2d4f57 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/model/request/RefreshRequest.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/model/request/SignoutRequest.class b/lib/json-20180813/fr/litarvan/openauth/model/request/SignoutRequest.class new file mode 100644 index 0000000..3554d00 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/model/request/SignoutRequest.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/model/request/ValidateRequest.class b/lib/json-20180813/fr/litarvan/openauth/model/request/ValidateRequest.class new file mode 100644 index 0000000..0d95777 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/model/request/ValidateRequest.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/model/response/AuthResponse.class b/lib/json-20180813/fr/litarvan/openauth/model/response/AuthResponse.class new file mode 100644 index 0000000..4405729 Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/model/response/AuthResponse.class differ diff --git a/lib/json-20180813/fr/litarvan/openauth/model/response/RefreshResponse.class b/lib/json-20180813/fr/litarvan/openauth/model/response/RefreshResponse.class new file mode 100644 index 0000000..9ce575a Binary files /dev/null and b/lib/json-20180813/fr/litarvan/openauth/model/response/RefreshResponse.class differ diff --git a/lib/json-20180813/javax/vecmath/AxisAngle4d.class b/lib/json-20180813/javax/vecmath/AxisAngle4d.class new file mode 100644 index 0000000..df87e60 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/AxisAngle4d.class differ diff --git a/lib/json-20180813/javax/vecmath/AxisAngle4f.class b/lib/json-20180813/javax/vecmath/AxisAngle4f.class new file mode 100644 index 0000000..252c6a1 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/AxisAngle4f.class differ diff --git a/lib/json-20180813/javax/vecmath/Color3b.class b/lib/json-20180813/javax/vecmath/Color3b.class new file mode 100644 index 0000000..229b6c9 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Color3b.class differ diff --git a/lib/json-20180813/javax/vecmath/Color3f.class b/lib/json-20180813/javax/vecmath/Color3f.class new file mode 100644 index 0000000..610ee66 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Color3f.class differ diff --git a/lib/json-20180813/javax/vecmath/Color4b.class b/lib/json-20180813/javax/vecmath/Color4b.class new file mode 100644 index 0000000..782b1d4 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Color4b.class differ diff --git a/lib/json-20180813/javax/vecmath/Color4f.class b/lib/json-20180813/javax/vecmath/Color4f.class new file mode 100644 index 0000000..56672ac Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Color4f.class differ diff --git a/lib/json-20180813/javax/vecmath/GMatrix.class b/lib/json-20180813/javax/vecmath/GMatrix.class new file mode 100644 index 0000000..96d82a7 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/GMatrix.class differ diff --git a/lib/json-20180813/javax/vecmath/GVector.class b/lib/json-20180813/javax/vecmath/GVector.class new file mode 100644 index 0000000..81de9a6 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/GVector.class differ diff --git a/lib/json-20180813/javax/vecmath/Matrix3d.class b/lib/json-20180813/javax/vecmath/Matrix3d.class new file mode 100644 index 0000000..d0e7ac8 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Matrix3d.class differ diff --git a/lib/json-20180813/javax/vecmath/Matrix3f.class b/lib/json-20180813/javax/vecmath/Matrix3f.class new file mode 100644 index 0000000..3247101 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Matrix3f.class differ diff --git a/lib/json-20180813/javax/vecmath/Matrix4d.class b/lib/json-20180813/javax/vecmath/Matrix4d.class new file mode 100644 index 0000000..2be5439 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Matrix4d.class differ diff --git a/lib/json-20180813/javax/vecmath/Matrix4f.class b/lib/json-20180813/javax/vecmath/Matrix4f.class new file mode 100644 index 0000000..4cdc3ee Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Matrix4f.class differ diff --git a/lib/json-20180813/javax/vecmath/MismatchedSizeException.class b/lib/json-20180813/javax/vecmath/MismatchedSizeException.class new file mode 100644 index 0000000..28bbf16 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/MismatchedSizeException.class differ diff --git a/lib/json-20180813/javax/vecmath/Point2d.class b/lib/json-20180813/javax/vecmath/Point2d.class new file mode 100644 index 0000000..167fa37 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Point2d.class differ diff --git a/lib/json-20180813/javax/vecmath/Point2f.class b/lib/json-20180813/javax/vecmath/Point2f.class new file mode 100644 index 0000000..6ee0556 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Point2f.class differ diff --git a/lib/json-20180813/javax/vecmath/Point3d.class b/lib/json-20180813/javax/vecmath/Point3d.class new file mode 100644 index 0000000..23f33d8 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Point3d.class differ diff --git a/lib/json-20180813/javax/vecmath/Point3f.class b/lib/json-20180813/javax/vecmath/Point3f.class new file mode 100644 index 0000000..add87a6 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Point3f.class differ diff --git a/lib/json-20180813/javax/vecmath/Point3i.class b/lib/json-20180813/javax/vecmath/Point3i.class new file mode 100644 index 0000000..f718ae3 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Point3i.class differ diff --git a/lib/json-20180813/javax/vecmath/Point4d.class b/lib/json-20180813/javax/vecmath/Point4d.class new file mode 100644 index 0000000..9319cc5 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Point4d.class differ diff --git a/lib/json-20180813/javax/vecmath/Point4f.class b/lib/json-20180813/javax/vecmath/Point4f.class new file mode 100644 index 0000000..486f445 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Point4f.class differ diff --git a/lib/json-20180813/javax/vecmath/Point4i.class b/lib/json-20180813/javax/vecmath/Point4i.class new file mode 100644 index 0000000..44122dc Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Point4i.class differ diff --git a/lib/json-20180813/javax/vecmath/Quat4d.class b/lib/json-20180813/javax/vecmath/Quat4d.class new file mode 100644 index 0000000..179b088 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Quat4d.class differ diff --git a/lib/json-20180813/javax/vecmath/Quat4f.class b/lib/json-20180813/javax/vecmath/Quat4f.class new file mode 100644 index 0000000..426da70 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Quat4f.class differ diff --git a/lib/json-20180813/javax/vecmath/SingularMatrixException.class b/lib/json-20180813/javax/vecmath/SingularMatrixException.class new file mode 100644 index 0000000..4eb064c Binary files /dev/null and b/lib/json-20180813/javax/vecmath/SingularMatrixException.class differ diff --git a/lib/json-20180813/javax/vecmath/TexCoord2f.class b/lib/json-20180813/javax/vecmath/TexCoord2f.class new file mode 100644 index 0000000..47050d4 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/TexCoord2f.class differ diff --git a/lib/json-20180813/javax/vecmath/TexCoord3f.class b/lib/json-20180813/javax/vecmath/TexCoord3f.class new file mode 100644 index 0000000..b069f63 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/TexCoord3f.class differ diff --git a/lib/json-20180813/javax/vecmath/Tuple2d.class b/lib/json-20180813/javax/vecmath/Tuple2d.class new file mode 100644 index 0000000..a97f4db Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Tuple2d.class differ diff --git a/lib/json-20180813/javax/vecmath/Tuple2f.class b/lib/json-20180813/javax/vecmath/Tuple2f.class new file mode 100644 index 0000000..b4e1b6a Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Tuple2f.class differ diff --git a/lib/json-20180813/javax/vecmath/Tuple3b.class b/lib/json-20180813/javax/vecmath/Tuple3b.class new file mode 100644 index 0000000..bda2532 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Tuple3b.class differ diff --git a/lib/json-20180813/javax/vecmath/Tuple3d.class b/lib/json-20180813/javax/vecmath/Tuple3d.class new file mode 100644 index 0000000..970e030 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Tuple3d.class differ diff --git a/lib/json-20180813/javax/vecmath/Tuple3f.class b/lib/json-20180813/javax/vecmath/Tuple3f.class new file mode 100644 index 0000000..17d3251 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Tuple3f.class differ diff --git a/lib/json-20180813/javax/vecmath/Tuple3i.class b/lib/json-20180813/javax/vecmath/Tuple3i.class new file mode 100644 index 0000000..606c98f Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Tuple3i.class differ diff --git a/lib/json-20180813/javax/vecmath/Tuple4b.class b/lib/json-20180813/javax/vecmath/Tuple4b.class new file mode 100644 index 0000000..d885421 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Tuple4b.class differ diff --git a/lib/json-20180813/javax/vecmath/Tuple4d.class b/lib/json-20180813/javax/vecmath/Tuple4d.class new file mode 100644 index 0000000..22d9017 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Tuple4d.class differ diff --git a/lib/json-20180813/javax/vecmath/Tuple4f.class b/lib/json-20180813/javax/vecmath/Tuple4f.class new file mode 100644 index 0000000..1d504c6 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Tuple4f.class differ diff --git a/lib/json-20180813/javax/vecmath/Tuple4i.class b/lib/json-20180813/javax/vecmath/Tuple4i.class new file mode 100644 index 0000000..c822ee8 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Tuple4i.class differ diff --git a/lib/json-20180813/javax/vecmath/VecmathTest.class b/lib/json-20180813/javax/vecmath/VecmathTest.class new file mode 100644 index 0000000..5e8fd5b Binary files /dev/null and b/lib/json-20180813/javax/vecmath/VecmathTest.class differ diff --git a/lib/json-20180813/javax/vecmath/Vector2d.class b/lib/json-20180813/javax/vecmath/Vector2d.class new file mode 100644 index 0000000..201eae6 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Vector2d.class differ diff --git a/lib/json-20180813/javax/vecmath/Vector2f.class b/lib/json-20180813/javax/vecmath/Vector2f.class new file mode 100644 index 0000000..c037ed7 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Vector2f.class differ diff --git a/lib/json-20180813/javax/vecmath/Vector3d.class b/lib/json-20180813/javax/vecmath/Vector3d.class new file mode 100644 index 0000000..db1db90 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Vector3d.class differ diff --git a/lib/json-20180813/javax/vecmath/Vector3f.class b/lib/json-20180813/javax/vecmath/Vector3f.class new file mode 100644 index 0000000..74e905c Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Vector3f.class differ diff --git a/lib/json-20180813/javax/vecmath/Vector4d.class b/lib/json-20180813/javax/vecmath/Vector4d.class new file mode 100644 index 0000000..92f4cfa Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Vector4d.class differ diff --git a/lib/json-20180813/javax/vecmath/Vector4f.class b/lib/json-20180813/javax/vecmath/Vector4f.class new file mode 100644 index 0000000..2570275 Binary files /dev/null and b/lib/json-20180813/javax/vecmath/Vector4f.class differ diff --git a/lib/json-20180813/linux/libdiscord-rpc.so b/lib/json-20180813/linux/libdiscord-rpc.so new file mode 100644 index 0000000..188d4e8 Binary files /dev/null and b/lib/json-20180813/linux/libdiscord-rpc.so differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/DiscordEventHandlers$Builder.class b/lib/json-20180813/net/arikia/dev/drpc/DiscordEventHandlers$Builder.class new file mode 100644 index 0000000..aee8692 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/DiscordEventHandlers$Builder.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/DiscordEventHandlers.class b/lib/json-20180813/net/arikia/dev/drpc/DiscordEventHandlers.class new file mode 100644 index 0000000..9a8e9bb Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/DiscordEventHandlers.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/DiscordRPC$DLL.class b/lib/json-20180813/net/arikia/dev/drpc/DiscordRPC$DLL.class new file mode 100644 index 0000000..32437a0 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/DiscordRPC$DLL.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/DiscordRPC$DiscordReply.class b/lib/json-20180813/net/arikia/dev/drpc/DiscordRPC$DiscordReply.class new file mode 100644 index 0000000..84f7d87 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/DiscordRPC$DiscordReply.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/DiscordRPC.class b/lib/json-20180813/net/arikia/dev/drpc/DiscordRPC.class new file mode 100644 index 0000000..01d27e4 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/DiscordRPC.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/DiscordRichPresence$Builder.class b/lib/json-20180813/net/arikia/dev/drpc/DiscordRichPresence$Builder.class new file mode 100644 index 0000000..8afec3e Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/DiscordRichPresence$Builder.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/DiscordRichPresence.class b/lib/json-20180813/net/arikia/dev/drpc/DiscordRichPresence.class new file mode 100644 index 0000000..b96edd5 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/DiscordRichPresence.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/DiscordUser.class b/lib/json-20180813/net/arikia/dev/drpc/DiscordUser.class new file mode 100644 index 0000000..12ed7e2 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/DiscordUser.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/OSUtil.class b/lib/json-20180813/net/arikia/dev/drpc/OSUtil.class new file mode 100644 index 0000000..f298950 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/OSUtil.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/callbacks/DisconnectedCallback.class b/lib/json-20180813/net/arikia/dev/drpc/callbacks/DisconnectedCallback.class new file mode 100644 index 0000000..e924e58 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/callbacks/DisconnectedCallback.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/callbacks/ErroredCallback.class b/lib/json-20180813/net/arikia/dev/drpc/callbacks/ErroredCallback.class new file mode 100644 index 0000000..c9b7a00 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/callbacks/ErroredCallback.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/callbacks/JoinGameCallback.class b/lib/json-20180813/net/arikia/dev/drpc/callbacks/JoinGameCallback.class new file mode 100644 index 0000000..0556215 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/callbacks/JoinGameCallback.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/callbacks/JoinRequestCallback.class b/lib/json-20180813/net/arikia/dev/drpc/callbacks/JoinRequestCallback.class new file mode 100644 index 0000000..739a5e8 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/callbacks/JoinRequestCallback.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/callbacks/ReadyCallback.class b/lib/json-20180813/net/arikia/dev/drpc/callbacks/ReadyCallback.class new file mode 100644 index 0000000..2985b78 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/callbacks/ReadyCallback.class differ diff --git a/lib/json-20180813/net/arikia/dev/drpc/callbacks/SpectateGameCallback.class b/lib/json-20180813/net/arikia/dev/drpc/callbacks/SpectateGameCallback.class new file mode 100644 index 0000000..927ca49 Binary files /dev/null and b/lib/json-20180813/net/arikia/dev/drpc/callbacks/SpectateGameCallback.class differ diff --git a/lib/json-20180813/org/apache/commons/io/ByteOrderMark.class b/lib/json-20180813/org/apache/commons/io/ByteOrderMark.class new file mode 100644 index 0000000..3633c7e Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/ByteOrderMark.class differ diff --git a/lib/json-20180813/org/apache/commons/io/ByteOrderParser.class b/lib/json-20180813/org/apache/commons/io/ByteOrderParser.class new file mode 100644 index 0000000..f12cb16 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/ByteOrderParser.class differ diff --git a/lib/json-20180813/org/apache/commons/io/Charsets.class b/lib/json-20180813/org/apache/commons/io/Charsets.class new file mode 100644 index 0000000..bd2a493 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/Charsets.class differ diff --git a/lib/json-20180813/org/apache/commons/io/CopyUtils.class b/lib/json-20180813/org/apache/commons/io/CopyUtils.class new file mode 100644 index 0000000..e59bd2c Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/CopyUtils.class differ diff --git a/lib/json-20180813/org/apache/commons/io/DirectoryWalker$CancelException.class b/lib/json-20180813/org/apache/commons/io/DirectoryWalker$CancelException.class new file mode 100644 index 0000000..59375b3 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/DirectoryWalker$CancelException.class differ diff --git a/lib/json-20180813/org/apache/commons/io/DirectoryWalker.class b/lib/json-20180813/org/apache/commons/io/DirectoryWalker.class new file mode 100644 index 0000000..826046d Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/DirectoryWalker.class differ diff --git a/lib/json-20180813/org/apache/commons/io/EndianUtils.class b/lib/json-20180813/org/apache/commons/io/EndianUtils.class new file mode 100644 index 0000000..35b95f5 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/EndianUtils.class differ diff --git a/lib/json-20180813/org/apache/commons/io/FileCleaner.class b/lib/json-20180813/org/apache/commons/io/FileCleaner.class new file mode 100644 index 0000000..1847ce9 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/FileCleaner.class differ diff --git a/lib/json-20180813/org/apache/commons/io/FileCleaningTracker$Reaper.class b/lib/json-20180813/org/apache/commons/io/FileCleaningTracker$Reaper.class new file mode 100644 index 0000000..0134bc5 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/FileCleaningTracker$Reaper.class differ diff --git a/lib/json-20180813/org/apache/commons/io/FileCleaningTracker$Tracker.class b/lib/json-20180813/org/apache/commons/io/FileCleaningTracker$Tracker.class new file mode 100644 index 0000000..76dbc58 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/FileCleaningTracker$Tracker.class differ diff --git a/lib/json-20180813/org/apache/commons/io/FileCleaningTracker.class b/lib/json-20180813/org/apache/commons/io/FileCleaningTracker.class new file mode 100644 index 0000000..408469e Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/FileCleaningTracker.class differ diff --git a/lib/json-20180813/org/apache/commons/io/FileDeleteStrategy$ForceFileDeleteStrategy.class b/lib/json-20180813/org/apache/commons/io/FileDeleteStrategy$ForceFileDeleteStrategy.class new file mode 100644 index 0000000..702eb55 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/FileDeleteStrategy$ForceFileDeleteStrategy.class differ diff --git a/lib/json-20180813/org/apache/commons/io/FileDeleteStrategy.class b/lib/json-20180813/org/apache/commons/io/FileDeleteStrategy.class new file mode 100644 index 0000000..cbf86e4 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/FileDeleteStrategy.class differ diff --git a/lib/json-20180813/org/apache/commons/io/FileExistsException.class b/lib/json-20180813/org/apache/commons/io/FileExistsException.class new file mode 100644 index 0000000..959383b Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/FileExistsException.class differ diff --git a/lib/json-20180813/org/apache/commons/io/FileSystem.class b/lib/json-20180813/org/apache/commons/io/FileSystem.class new file mode 100644 index 0000000..16605f7 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/FileSystem.class differ diff --git a/lib/json-20180813/org/apache/commons/io/FileSystemUtils.class b/lib/json-20180813/org/apache/commons/io/FileSystemUtils.class new file mode 100644 index 0000000..f2adb66 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/FileSystemUtils.class differ diff --git a/lib/json-20180813/org/apache/commons/io/FileUtils.class b/lib/json-20180813/org/apache/commons/io/FileUtils.class new file mode 100644 index 0000000..790619b Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/FileUtils.class differ diff --git a/lib/json-20180813/org/apache/commons/io/FilenameUtils.class b/lib/json-20180813/org/apache/commons/io/FilenameUtils.class new file mode 100644 index 0000000..6b75aa7 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/FilenameUtils.class differ diff --git a/lib/json-20180813/org/apache/commons/io/HexDump.class b/lib/json-20180813/org/apache/commons/io/HexDump.class new file mode 100644 index 0000000..db094db Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/HexDump.class differ diff --git a/lib/json-20180813/org/apache/commons/io/IOCase.class b/lib/json-20180813/org/apache/commons/io/IOCase.class new file mode 100644 index 0000000..d79b794 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/IOCase.class differ diff --git a/lib/json-20180813/org/apache/commons/io/IOExceptionList.class b/lib/json-20180813/org/apache/commons/io/IOExceptionList.class new file mode 100644 index 0000000..bdc2e6b Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/IOExceptionList.class differ diff --git a/lib/json-20180813/org/apache/commons/io/IOExceptionWithCause.class b/lib/json-20180813/org/apache/commons/io/IOExceptionWithCause.class new file mode 100644 index 0000000..a5142f5 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/IOExceptionWithCause.class differ diff --git a/lib/json-20180813/org/apache/commons/io/IOIndexedException.class b/lib/json-20180813/org/apache/commons/io/IOIndexedException.class new file mode 100644 index 0000000..1cc1c04 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/IOIndexedException.class differ diff --git a/lib/json-20180813/org/apache/commons/io/IOUtils.class b/lib/json-20180813/org/apache/commons/io/IOUtils.class new file mode 100644 index 0000000..8dff8f4 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/IOUtils.class differ diff --git a/lib/json-20180813/org/apache/commons/io/LineIterator.class b/lib/json-20180813/org/apache/commons/io/LineIterator.class new file mode 100644 index 0000000..f45bc63 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/LineIterator.class differ diff --git a/lib/json-20180813/org/apache/commons/io/TaggedIOException.class b/lib/json-20180813/org/apache/commons/io/TaggedIOException.class new file mode 100644 index 0000000..0b198b4 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/TaggedIOException.class differ diff --git a/lib/json-20180813/org/apache/commons/io/ThreadMonitor.class b/lib/json-20180813/org/apache/commons/io/ThreadMonitor.class new file mode 100644 index 0000000..ab20fa2 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/ThreadMonitor.class differ diff --git a/lib/json-20180813/org/apache/commons/io/comparator/AbstractFileComparator.class b/lib/json-20180813/org/apache/commons/io/comparator/AbstractFileComparator.class new file mode 100644 index 0000000..2458766 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/comparator/AbstractFileComparator.class differ diff --git a/lib/json-20180813/org/apache/commons/io/comparator/CompositeFileComparator.class b/lib/json-20180813/org/apache/commons/io/comparator/CompositeFileComparator.class new file mode 100644 index 0000000..9475672 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/comparator/CompositeFileComparator.class differ diff --git a/lib/json-20180813/org/apache/commons/io/comparator/DefaultFileComparator.class b/lib/json-20180813/org/apache/commons/io/comparator/DefaultFileComparator.class new file mode 100644 index 0000000..5c6fe8b Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/comparator/DefaultFileComparator.class differ diff --git a/lib/json-20180813/org/apache/commons/io/comparator/DirectoryFileComparator.class b/lib/json-20180813/org/apache/commons/io/comparator/DirectoryFileComparator.class new file mode 100644 index 0000000..7644444 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/comparator/DirectoryFileComparator.class differ diff --git a/lib/json-20180813/org/apache/commons/io/comparator/ExtensionFileComparator.class b/lib/json-20180813/org/apache/commons/io/comparator/ExtensionFileComparator.class new file mode 100644 index 0000000..8f6d42d Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/comparator/ExtensionFileComparator.class differ diff --git a/lib/json-20180813/org/apache/commons/io/comparator/LastModifiedFileComparator.class b/lib/json-20180813/org/apache/commons/io/comparator/LastModifiedFileComparator.class new file mode 100644 index 0000000..c4c5692 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/comparator/LastModifiedFileComparator.class differ diff --git a/lib/json-20180813/org/apache/commons/io/comparator/NameFileComparator.class b/lib/json-20180813/org/apache/commons/io/comparator/NameFileComparator.class new file mode 100644 index 0000000..fadb89a Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/comparator/NameFileComparator.class differ diff --git a/lib/json-20180813/org/apache/commons/io/comparator/PathFileComparator.class b/lib/json-20180813/org/apache/commons/io/comparator/PathFileComparator.class new file mode 100644 index 0000000..0f32b85 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/comparator/PathFileComparator.class differ diff --git a/lib/json-20180813/org/apache/commons/io/comparator/ReverseFileComparator.class b/lib/json-20180813/org/apache/commons/io/comparator/ReverseFileComparator.class new file mode 100644 index 0000000..a0983e2 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/comparator/ReverseFileComparator.class differ diff --git a/lib/json-20180813/org/apache/commons/io/comparator/SizeFileComparator.class b/lib/json-20180813/org/apache/commons/io/comparator/SizeFileComparator.class new file mode 100644 index 0000000..c3f39cb Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/comparator/SizeFileComparator.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/AccumulatorPathVisitor.class b/lib/json-20180813/org/apache/commons/io/file/AccumulatorPathVisitor.class new file mode 100644 index 0000000..ef20e60 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/AccumulatorPathVisitor.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/CleaningPathVisitor.class b/lib/json-20180813/org/apache/commons/io/file/CleaningPathVisitor.class new file mode 100644 index 0000000..da70a35 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/CleaningPathVisitor.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/CopyDirectoryVisitor.class b/lib/json-20180813/org/apache/commons/io/file/CopyDirectoryVisitor.class new file mode 100644 index 0000000..ce9e208 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/CopyDirectoryVisitor.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/Counters$1.class b/lib/json-20180813/org/apache/commons/io/file/Counters$1.class new file mode 100644 index 0000000..3c5c5ff Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/Counters$1.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/Counters$AbstractPathCounters.class b/lib/json-20180813/org/apache/commons/io/file/Counters$AbstractPathCounters.class new file mode 100644 index 0000000..7e0ac70 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/Counters$AbstractPathCounters.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/Counters$BigIntegerCounter.class b/lib/json-20180813/org/apache/commons/io/file/Counters$BigIntegerCounter.class new file mode 100644 index 0000000..69b9a9b Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/Counters$BigIntegerCounter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/Counters$BigIntegerPathCounters.class b/lib/json-20180813/org/apache/commons/io/file/Counters$BigIntegerPathCounters.class new file mode 100644 index 0000000..95c8667 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/Counters$BigIntegerPathCounters.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/Counters$Counter.class b/lib/json-20180813/org/apache/commons/io/file/Counters$Counter.class new file mode 100644 index 0000000..e7e3ca6 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/Counters$Counter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/Counters$LongCounter.class b/lib/json-20180813/org/apache/commons/io/file/Counters$LongCounter.class new file mode 100644 index 0000000..675c859 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/Counters$LongCounter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/Counters$LongPathCounters.class b/lib/json-20180813/org/apache/commons/io/file/Counters$LongPathCounters.class new file mode 100644 index 0000000..25da033 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/Counters$LongPathCounters.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/Counters$PathCounters.class b/lib/json-20180813/org/apache/commons/io/file/Counters$PathCounters.class new file mode 100644 index 0000000..4756410 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/Counters$PathCounters.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/Counters.class b/lib/json-20180813/org/apache/commons/io/file/Counters.class new file mode 100644 index 0000000..7d74663 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/Counters.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/CountingPathVisitor.class b/lib/json-20180813/org/apache/commons/io/file/CountingPathVisitor.class new file mode 100644 index 0000000..4e4e359 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/CountingPathVisitor.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/DeleteOption.class b/lib/json-20180813/org/apache/commons/io/file/DeleteOption.class new file mode 100644 index 0000000..ee97e19 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/DeleteOption.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/DeletingPathVisitor.class b/lib/json-20180813/org/apache/commons/io/file/DeletingPathVisitor.class new file mode 100644 index 0000000..63a1f4e Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/DeletingPathVisitor.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/PathUtils$1.class b/lib/json-20180813/org/apache/commons/io/file/PathUtils$1.class new file mode 100644 index 0000000..b3d0492 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/PathUtils$1.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/PathUtils$RelativeSortedPaths.class b/lib/json-20180813/org/apache/commons/io/file/PathUtils$RelativeSortedPaths.class new file mode 100644 index 0000000..0dc21e7 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/PathUtils$RelativeSortedPaths.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/PathUtils.class b/lib/json-20180813/org/apache/commons/io/file/PathUtils.class new file mode 100644 index 0000000..75ff529 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/PathUtils.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/SimplePathVisitor.class b/lib/json-20180813/org/apache/commons/io/file/SimplePathVisitor.class new file mode 100644 index 0000000..3373457 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/SimplePathVisitor.class differ diff --git a/lib/json-20180813/org/apache/commons/io/file/StandardDeleteOption.class b/lib/json-20180813/org/apache/commons/io/file/StandardDeleteOption.class new file mode 100644 index 0000000..64106ec Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/file/StandardDeleteOption.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/AbstractFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/AbstractFileFilter.class new file mode 100644 index 0000000..2846782 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/AbstractFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/AgeFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/AgeFileFilter.class new file mode 100644 index 0000000..325f019 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/AgeFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/AndFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/AndFileFilter.class new file mode 100644 index 0000000..e998ffe Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/AndFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/CanExecuteFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/CanExecuteFileFilter.class new file mode 100644 index 0000000..30d2e8d Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/CanExecuteFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/CanReadFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/CanReadFileFilter.class new file mode 100644 index 0000000..9911ad7 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/CanReadFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/CanWriteFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/CanWriteFileFilter.class new file mode 100644 index 0000000..3fd4e21 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/CanWriteFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/ConditionalFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/ConditionalFileFilter.class new file mode 100644 index 0000000..5d865d8 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/ConditionalFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/DelegateFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/DelegateFileFilter.class new file mode 100644 index 0000000..c220f99 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/DelegateFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/DirectoryFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/DirectoryFileFilter.class new file mode 100644 index 0000000..cf8b965 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/DirectoryFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/EmptyFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/EmptyFileFilter.class new file mode 100644 index 0000000..020a831 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/EmptyFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/FalseFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/FalseFileFilter.class new file mode 100644 index 0000000..4c80a89 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/FalseFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/FileFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/FileFileFilter.class new file mode 100644 index 0000000..0e06f68 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/FileFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/FileFilterUtils.class b/lib/json-20180813/org/apache/commons/io/filefilter/FileFilterUtils.class new file mode 100644 index 0000000..81ca638 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/FileFilterUtils.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/HiddenFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/HiddenFileFilter.class new file mode 100644 index 0000000..c052b6b Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/HiddenFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/IOFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/IOFileFilter.class new file mode 100644 index 0000000..eee0324 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/IOFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/MagicNumberFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/MagicNumberFileFilter.class new file mode 100644 index 0000000..e450d7a Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/MagicNumberFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/NameFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/NameFileFilter.class new file mode 100644 index 0000000..2a79b9d Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/NameFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/NotFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/NotFileFilter.class new file mode 100644 index 0000000..4b37c15 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/NotFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/OrFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/OrFileFilter.class new file mode 100644 index 0000000..6d4062c Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/OrFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/PrefixFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/PrefixFileFilter.class new file mode 100644 index 0000000..23f7d57 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/PrefixFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/RegexFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/RegexFileFilter.class new file mode 100644 index 0000000..c6a2830 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/RegexFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/SizeFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/SizeFileFilter.class new file mode 100644 index 0000000..c34e27e Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/SizeFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/SuffixFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/SuffixFileFilter.class new file mode 100644 index 0000000..40216cc Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/SuffixFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/TrueFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/TrueFileFilter.class new file mode 100644 index 0000000..f96dec3 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/TrueFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/WildcardFileFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/WildcardFileFilter.class new file mode 100644 index 0000000..a136420 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/WildcardFileFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/filefilter/WildcardFilter.class b/lib/json-20180813/org/apache/commons/io/filefilter/WildcardFilter.class new file mode 100644 index 0000000..d9e531c Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/filefilter/WildcardFilter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/function/IOConsumer.class b/lib/json-20180813/org/apache/commons/io/function/IOConsumer.class new file mode 100644 index 0000000..878cef2 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/function/IOConsumer.class differ diff --git a/lib/json-20180813/org/apache/commons/io/function/IOFunction.class b/lib/json-20180813/org/apache/commons/io/function/IOFunction.class new file mode 100644 index 0000000..6352593 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/function/IOFunction.class differ diff --git a/lib/json-20180813/org/apache/commons/io/function/IOSupplier.class b/lib/json-20180813/org/apache/commons/io/function/IOSupplier.class new file mode 100644 index 0000000..1e77a70 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/function/IOSupplier.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/AbstractCharacterFilterReader.class b/lib/json-20180813/org/apache/commons/io/input/AbstractCharacterFilterReader.class new file mode 100644 index 0000000..93832c1 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/AbstractCharacterFilterReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/AutoCloseInputStream.class b/lib/json-20180813/org/apache/commons/io/input/AutoCloseInputStream.class new file mode 100644 index 0000000..cdede8a Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/AutoCloseInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/BOMInputStream.class b/lib/json-20180813/org/apache/commons/io/input/BOMInputStream.class new file mode 100644 index 0000000..ac88830 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/BOMInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/BoundedInputStream.class b/lib/json-20180813/org/apache/commons/io/input/BoundedInputStream.class new file mode 100644 index 0000000..80bb72b Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/BoundedInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/BoundedReader.class b/lib/json-20180813/org/apache/commons/io/input/BoundedReader.class new file mode 100644 index 0000000..aedace8 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/BoundedReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/BrokenInputStream.class b/lib/json-20180813/org/apache/commons/io/input/BrokenInputStream.class new file mode 100644 index 0000000..290eef9 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/BrokenInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/BrokenReader.class b/lib/json-20180813/org/apache/commons/io/input/BrokenReader.class new file mode 100644 index 0000000..8c6ed79 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/BrokenReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/CharSequenceInputStream.class b/lib/json-20180813/org/apache/commons/io/input/CharSequenceInputStream.class new file mode 100644 index 0000000..3ec0042 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/CharSequenceInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/CharSequenceReader.class b/lib/json-20180813/org/apache/commons/io/input/CharSequenceReader.class new file mode 100644 index 0000000..de197f7 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/CharSequenceReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/CharacterFilterReader.class b/lib/json-20180813/org/apache/commons/io/input/CharacterFilterReader.class new file mode 100644 index 0000000..4bbfe7c Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/CharacterFilterReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/CharacterSetFilterReader.class b/lib/json-20180813/org/apache/commons/io/input/CharacterSetFilterReader.class new file mode 100644 index 0000000..718f5bc Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/CharacterSetFilterReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/CircularInputStream.class b/lib/json-20180813/org/apache/commons/io/input/CircularInputStream.class new file mode 100644 index 0000000..db92864 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/CircularInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/ClassLoaderObjectInputStream.class b/lib/json-20180813/org/apache/commons/io/input/ClassLoaderObjectInputStream.class new file mode 100644 index 0000000..a71a72b Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/ClassLoaderObjectInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/CloseShieldInputStream.class b/lib/json-20180813/org/apache/commons/io/input/CloseShieldInputStream.class new file mode 100644 index 0000000..585f7b5 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/CloseShieldInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/CloseShieldReader.class b/lib/json-20180813/org/apache/commons/io/input/CloseShieldReader.class new file mode 100644 index 0000000..c2ae20e Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/CloseShieldReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/ClosedInputStream.class b/lib/json-20180813/org/apache/commons/io/input/ClosedInputStream.class new file mode 100644 index 0000000..ab95a34 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/ClosedInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/ClosedReader.class b/lib/json-20180813/org/apache/commons/io/input/ClosedReader.class new file mode 100644 index 0000000..25aaaaa Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/ClosedReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/CountingInputStream.class b/lib/json-20180813/org/apache/commons/io/input/CountingInputStream.class new file mode 100644 index 0000000..e01e694 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/CountingInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/DemuxInputStream.class b/lib/json-20180813/org/apache/commons/io/input/DemuxInputStream.class new file mode 100644 index 0000000..82888e1 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/DemuxInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/InfiniteCircularInputStream.class b/lib/json-20180813/org/apache/commons/io/input/InfiniteCircularInputStream.class new file mode 100644 index 0000000..932abb8 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/InfiniteCircularInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/MarkShieldInputStream.class b/lib/json-20180813/org/apache/commons/io/input/MarkShieldInputStream.class new file mode 100644 index 0000000..223ffca Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/MarkShieldInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/MessageDigestCalculatingInputStream$MessageDigestMaintainingObserver.class b/lib/json-20180813/org/apache/commons/io/input/MessageDigestCalculatingInputStream$MessageDigestMaintainingObserver.class new file mode 100644 index 0000000..1510e51 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/MessageDigestCalculatingInputStream$MessageDigestMaintainingObserver.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/MessageDigestCalculatingInputStream.class b/lib/json-20180813/org/apache/commons/io/input/MessageDigestCalculatingInputStream.class new file mode 100644 index 0000000..30b6a03 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/MessageDigestCalculatingInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/NullInputStream.class b/lib/json-20180813/org/apache/commons/io/input/NullInputStream.class new file mode 100644 index 0000000..67d14fc Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/NullInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/NullReader.class b/lib/json-20180813/org/apache/commons/io/input/NullReader.class new file mode 100644 index 0000000..ea19274 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/NullReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/ObservableInputStream$Observer.class b/lib/json-20180813/org/apache/commons/io/input/ObservableInputStream$Observer.class new file mode 100644 index 0000000..a68591d Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/ObservableInputStream$Observer.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/ObservableInputStream.class b/lib/json-20180813/org/apache/commons/io/input/ObservableInputStream.class new file mode 100644 index 0000000..89a9506 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/ObservableInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/ProxyInputStream.class b/lib/json-20180813/org/apache/commons/io/input/ProxyInputStream.class new file mode 100644 index 0000000..31001e8 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/ProxyInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/ProxyReader.class b/lib/json-20180813/org/apache/commons/io/input/ProxyReader.class new file mode 100644 index 0000000..8404d40 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/ProxyReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/RandomAccessFileInputStream.class b/lib/json-20180813/org/apache/commons/io/input/RandomAccessFileInputStream.class new file mode 100644 index 0000000..a8997f3 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/RandomAccessFileInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/ReaderInputStream.class b/lib/json-20180813/org/apache/commons/io/input/ReaderInputStream.class new file mode 100644 index 0000000..2e4ae2f Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/ReaderInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/ReversedLinesFileReader$1.class b/lib/json-20180813/org/apache/commons/io/input/ReversedLinesFileReader$1.class new file mode 100644 index 0000000..f3fe8d4 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/ReversedLinesFileReader$1.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/ReversedLinesFileReader$FilePart.class b/lib/json-20180813/org/apache/commons/io/input/ReversedLinesFileReader$FilePart.class new file mode 100644 index 0000000..5d279e6 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/ReversedLinesFileReader$FilePart.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/ReversedLinesFileReader.class b/lib/json-20180813/org/apache/commons/io/input/ReversedLinesFileReader.class new file mode 100644 index 0000000..d88150f Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/ReversedLinesFileReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/SequenceReader.class b/lib/json-20180813/org/apache/commons/io/input/SequenceReader.class new file mode 100644 index 0000000..ff1ea1c Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/SequenceReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/SwappedDataInputStream.class b/lib/json-20180813/org/apache/commons/io/input/SwappedDataInputStream.class new file mode 100644 index 0000000..c9cee99 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/SwappedDataInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/TaggedInputStream.class b/lib/json-20180813/org/apache/commons/io/input/TaggedInputStream.class new file mode 100644 index 0000000..2266bcd Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/TaggedInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/TaggedReader.class b/lib/json-20180813/org/apache/commons/io/input/TaggedReader.class new file mode 100644 index 0000000..434b5c3 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/TaggedReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/Tailer.class b/lib/json-20180813/org/apache/commons/io/input/Tailer.class new file mode 100644 index 0000000..aba674a Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/Tailer.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/TailerListener.class b/lib/json-20180813/org/apache/commons/io/input/TailerListener.class new file mode 100644 index 0000000..780cd14 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/TailerListener.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/TailerListenerAdapter.class b/lib/json-20180813/org/apache/commons/io/input/TailerListenerAdapter.class new file mode 100644 index 0000000..1a5dc5c Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/TailerListenerAdapter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/TeeInputStream.class b/lib/json-20180813/org/apache/commons/io/input/TeeInputStream.class new file mode 100644 index 0000000..dc54c8e Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/TeeInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/TeeReader.class b/lib/json-20180813/org/apache/commons/io/input/TeeReader.class new file mode 100644 index 0000000..5acb53c Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/TeeReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/UnixLineEndingInputStream.class b/lib/json-20180813/org/apache/commons/io/input/UnixLineEndingInputStream.class new file mode 100644 index 0000000..99b7977 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/UnixLineEndingInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/UnsynchronizedByteArrayInputStream.class b/lib/json-20180813/org/apache/commons/io/input/UnsynchronizedByteArrayInputStream.class new file mode 100644 index 0000000..7f720fa Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/UnsynchronizedByteArrayInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/WindowsLineEndingInputStream.class b/lib/json-20180813/org/apache/commons/io/input/WindowsLineEndingInputStream.class new file mode 100644 index 0000000..cf04d7c Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/WindowsLineEndingInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/XmlStreamReader.class b/lib/json-20180813/org/apache/commons/io/input/XmlStreamReader.class new file mode 100644 index 0000000..9395ea5 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/XmlStreamReader.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/XmlStreamReaderException.class b/lib/json-20180813/org/apache/commons/io/input/XmlStreamReaderException.class new file mode 100644 index 0000000..fceac61 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/XmlStreamReaderException.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/buffer/CircularBufferInputStream.class b/lib/json-20180813/org/apache/commons/io/input/buffer/CircularBufferInputStream.class new file mode 100644 index 0000000..2ca3cc2 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/buffer/CircularBufferInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/buffer/CircularByteBuffer.class b/lib/json-20180813/org/apache/commons/io/input/buffer/CircularByteBuffer.class new file mode 100644 index 0000000..9358234 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/buffer/CircularByteBuffer.class differ diff --git a/lib/json-20180813/org/apache/commons/io/input/buffer/PeekableInputStream.class b/lib/json-20180813/org/apache/commons/io/input/buffer/PeekableInputStream.class new file mode 100644 index 0000000..3b1d782 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/input/buffer/PeekableInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/monitor/FileAlterationListener.class b/lib/json-20180813/org/apache/commons/io/monitor/FileAlterationListener.class new file mode 100644 index 0000000..b9cb738 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/monitor/FileAlterationListener.class differ diff --git a/lib/json-20180813/org/apache/commons/io/monitor/FileAlterationListenerAdaptor.class b/lib/json-20180813/org/apache/commons/io/monitor/FileAlterationListenerAdaptor.class new file mode 100644 index 0000000..81b7283 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/monitor/FileAlterationListenerAdaptor.class differ diff --git a/lib/json-20180813/org/apache/commons/io/monitor/FileAlterationMonitor.class b/lib/json-20180813/org/apache/commons/io/monitor/FileAlterationMonitor.class new file mode 100644 index 0000000..feaf860 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/monitor/FileAlterationMonitor.class differ diff --git a/lib/json-20180813/org/apache/commons/io/monitor/FileAlterationObserver.class b/lib/json-20180813/org/apache/commons/io/monitor/FileAlterationObserver.class new file mode 100644 index 0000000..16d8b01 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/monitor/FileAlterationObserver.class differ diff --git a/lib/json-20180813/org/apache/commons/io/monitor/FileEntry.class b/lib/json-20180813/org/apache/commons/io/monitor/FileEntry.class new file mode 100644 index 0000000..13dcb93 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/monitor/FileEntry.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/AbstractByteArrayOutputStream$InputStreamConstructor.class b/lib/json-20180813/org/apache/commons/io/output/AbstractByteArrayOutputStream$InputStreamConstructor.class new file mode 100644 index 0000000..1b9c7da Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/AbstractByteArrayOutputStream$InputStreamConstructor.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/AbstractByteArrayOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/AbstractByteArrayOutputStream.class new file mode 100644 index 0000000..475d1c3 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/AbstractByteArrayOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/AppendableOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/AppendableOutputStream.class new file mode 100644 index 0000000..6036cfb Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/AppendableOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/AppendableWriter.class b/lib/json-20180813/org/apache/commons/io/output/AppendableWriter.class new file mode 100644 index 0000000..3a1e71d Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/AppendableWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/BrokenOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/BrokenOutputStream.class new file mode 100644 index 0000000..9e40ece Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/BrokenOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/BrokenWriter.class b/lib/json-20180813/org/apache/commons/io/output/BrokenWriter.class new file mode 100644 index 0000000..836b8ab Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/BrokenWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/ByteArrayOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/ByteArrayOutputStream.class new file mode 100644 index 0000000..c670275 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/ByteArrayOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/ChunkedOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/ChunkedOutputStream.class new file mode 100644 index 0000000..a52f24b Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/ChunkedOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/ChunkedWriter.class b/lib/json-20180813/org/apache/commons/io/output/ChunkedWriter.class new file mode 100644 index 0000000..41ef7ac Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/ChunkedWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/CloseShieldOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/CloseShieldOutputStream.class new file mode 100644 index 0000000..9021563 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/CloseShieldOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/CloseShieldWriter.class b/lib/json-20180813/org/apache/commons/io/output/CloseShieldWriter.class new file mode 100644 index 0000000..17f1423 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/CloseShieldWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/ClosedOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/ClosedOutputStream.class new file mode 100644 index 0000000..d778c82 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/ClosedOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/ClosedWriter.class b/lib/json-20180813/org/apache/commons/io/output/ClosedWriter.class new file mode 100644 index 0000000..16a4212 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/ClosedWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/CountingOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/CountingOutputStream.class new file mode 100644 index 0000000..af22a3e Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/CountingOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/DeferredFileOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/DeferredFileOutputStream.class new file mode 100644 index 0000000..fa89089 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/DeferredFileOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/DemuxOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/DemuxOutputStream.class new file mode 100644 index 0000000..3710924 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/DemuxOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/FileWriterWithEncoding.class b/lib/json-20180813/org/apache/commons/io/output/FileWriterWithEncoding.class new file mode 100644 index 0000000..f6b6e98 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/FileWriterWithEncoding.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/FilterCollectionWriter.class b/lib/json-20180813/org/apache/commons/io/output/FilterCollectionWriter.class new file mode 100644 index 0000000..dac0dbb Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/FilterCollectionWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/LockableFileWriter.class b/lib/json-20180813/org/apache/commons/io/output/LockableFileWriter.class new file mode 100644 index 0000000..6320745 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/LockableFileWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/NullAppendable.class b/lib/json-20180813/org/apache/commons/io/output/NullAppendable.class new file mode 100644 index 0000000..bc6b313 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/NullAppendable.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/NullOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/NullOutputStream.class new file mode 100644 index 0000000..52546f2 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/NullOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/NullPrintStream.class b/lib/json-20180813/org/apache/commons/io/output/NullPrintStream.class new file mode 100644 index 0000000..cff4c85 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/NullPrintStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/NullWriter.class b/lib/json-20180813/org/apache/commons/io/output/NullWriter.class new file mode 100644 index 0000000..59661ae Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/NullWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/ProxyCollectionWriter.class b/lib/json-20180813/org/apache/commons/io/output/ProxyCollectionWriter.class new file mode 100644 index 0000000..79fd643 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/ProxyCollectionWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/ProxyOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/ProxyOutputStream.class new file mode 100644 index 0000000..e9011bd Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/ProxyOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/ProxyWriter.class b/lib/json-20180813/org/apache/commons/io/output/ProxyWriter.class new file mode 100644 index 0000000..105909c Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/ProxyWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/StringBuilderWriter.class b/lib/json-20180813/org/apache/commons/io/output/StringBuilderWriter.class new file mode 100644 index 0000000..7450b4e Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/StringBuilderWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/TaggedOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/TaggedOutputStream.class new file mode 100644 index 0000000..9720988 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/TaggedOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/TaggedWriter.class b/lib/json-20180813/org/apache/commons/io/output/TaggedWriter.class new file mode 100644 index 0000000..f7b06ec Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/TaggedWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/TeeOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/TeeOutputStream.class new file mode 100644 index 0000000..f790cfc Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/TeeOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/TeeWriter.class b/lib/json-20180813/org/apache/commons/io/output/TeeWriter.class new file mode 100644 index 0000000..8c34cef Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/TeeWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/ThresholdingOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/ThresholdingOutputStream.class new file mode 100644 index 0000000..f66d5d7 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/ThresholdingOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream.class new file mode 100644 index 0000000..5bbd246 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/WriterOutputStream.class b/lib/json-20180813/org/apache/commons/io/output/WriterOutputStream.class new file mode 100644 index 0000000..6ef49b0 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/WriterOutputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/output/XmlStreamWriter.class b/lib/json-20180813/org/apache/commons/io/output/XmlStreamWriter.class new file mode 100644 index 0000000..8028d43 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/output/XmlStreamWriter.class differ diff --git a/lib/json-20180813/org/apache/commons/io/serialization/ClassNameMatcher.class b/lib/json-20180813/org/apache/commons/io/serialization/ClassNameMatcher.class new file mode 100644 index 0000000..201a1fe Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/serialization/ClassNameMatcher.class differ diff --git a/lib/json-20180813/org/apache/commons/io/serialization/FullClassNameMatcher.class b/lib/json-20180813/org/apache/commons/io/serialization/FullClassNameMatcher.class new file mode 100644 index 0000000..94e21c9 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/serialization/FullClassNameMatcher.class differ diff --git a/lib/json-20180813/org/apache/commons/io/serialization/RegexpClassNameMatcher.class b/lib/json-20180813/org/apache/commons/io/serialization/RegexpClassNameMatcher.class new file mode 100644 index 0000000..7b491df Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/serialization/RegexpClassNameMatcher.class differ diff --git a/lib/json-20180813/org/apache/commons/io/serialization/ValidatingObjectInputStream.class b/lib/json-20180813/org/apache/commons/io/serialization/ValidatingObjectInputStream.class new file mode 100644 index 0000000..a41c6f3 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/serialization/ValidatingObjectInputStream.class differ diff --git a/lib/json-20180813/org/apache/commons/io/serialization/WildcardClassNameMatcher.class b/lib/json-20180813/org/apache/commons/io/serialization/WildcardClassNameMatcher.class new file mode 100644 index 0000000..bce5112 Binary files /dev/null and b/lib/json-20180813/org/apache/commons/io/serialization/WildcardClassNameMatcher.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/Flow.class b/lib/json-20180813/org/intellij/lang/annotations/Flow.class new file mode 100644 index 0000000..e734343 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/Flow.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/Identifier.class b/lib/json-20180813/org/intellij/lang/annotations/Identifier.class new file mode 100644 index 0000000..f379388 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/Identifier.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$AdjustableOrientation.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$AdjustableOrientation.class new file mode 100644 index 0000000..bf093aa Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$AdjustableOrientation.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$BoxLayoutAxis.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$BoxLayoutAxis.class new file mode 100644 index 0000000..5ac0726 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$BoxLayoutAxis.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$CalendarMonth.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$CalendarMonth.class new file mode 100644 index 0000000..b2f9312 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$CalendarMonth.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$CursorType.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$CursorType.class new file mode 100644 index 0000000..08dea10 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$CursorType.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$FlowLayoutAlignment.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$FlowLayoutAlignment.class new file mode 100644 index 0000000..da4d062 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$FlowLayoutAlignment.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$FontStyle.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$FontStyle.class new file mode 100644 index 0000000..205e10e Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$FontStyle.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$HorizontalAlignment.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$HorizontalAlignment.class new file mode 100644 index 0000000..878e127 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$HorizontalAlignment.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$HorizontalScrollBarPolicy.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$HorizontalScrollBarPolicy.class new file mode 100644 index 0000000..73a1141 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$HorizontalScrollBarPolicy.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$InputEventMask.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$InputEventMask.class new file mode 100644 index 0000000..b6d1523 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$InputEventMask.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$ListSelectionMode.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$ListSelectionMode.class new file mode 100644 index 0000000..0465edd Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$ListSelectionMode.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$PatternFlags.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$PatternFlags.class new file mode 100644 index 0000000..2dd605e Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$PatternFlags.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TabLayoutPolicy.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TabLayoutPolicy.class new file mode 100644 index 0000000..ae44af4 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TabLayoutPolicy.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TabPlacement.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TabPlacement.class new file mode 100644 index 0000000..a2da7dc Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TabPlacement.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TitledBorderJustification.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TitledBorderJustification.class new file mode 100644 index 0000000..2685535 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TitledBorderJustification.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TitledBorderTitlePosition.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TitledBorderTitlePosition.class new file mode 100644 index 0000000..ec0549c Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TitledBorderTitlePosition.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TreeSelectionMode.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TreeSelectionMode.class new file mode 100644 index 0000000..0a34429 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$TreeSelectionMode.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$VerticalScrollBarPolicy.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$VerticalScrollBarPolicy.class new file mode 100644 index 0000000..15d2a0c Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants$VerticalScrollBarPolicy.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/JdkConstants.class b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants.class new file mode 100644 index 0000000..866d8ba Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/JdkConstants.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/Language.class b/lib/json-20180813/org/intellij/lang/annotations/Language.class new file mode 100644 index 0000000..a4df9a6 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/Language.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/MagicConstant.class b/lib/json-20180813/org/intellij/lang/annotations/MagicConstant.class new file mode 100644 index 0000000..875ec46 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/MagicConstant.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/Pattern.class b/lib/json-20180813/org/intellij/lang/annotations/Pattern.class new file mode 100644 index 0000000..93f05d3 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/Pattern.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/PrintFormat.class b/lib/json-20180813/org/intellij/lang/annotations/PrintFormat.class new file mode 100644 index 0000000..cf10ed5 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/PrintFormat.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/PrintFormatPattern.class b/lib/json-20180813/org/intellij/lang/annotations/PrintFormatPattern.class new file mode 100644 index 0000000..0149729 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/PrintFormatPattern.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/RegExp.class b/lib/json-20180813/org/intellij/lang/annotations/RegExp.class new file mode 100644 index 0000000..5ee1d2f Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/RegExp.class differ diff --git a/lib/json-20180813/org/intellij/lang/annotations/Subst.class b/lib/json-20180813/org/intellij/lang/annotations/Subst.class new file mode 100644 index 0000000..81557e9 Binary files /dev/null and b/lib/json-20180813/org/intellij/lang/annotations/Subst.class differ diff --git a/lib/json-20180813/org/jetbrains/annotations/Async$Execute.class b/lib/json-20180813/org/jetbrains/annotations/Async$Execute.class new file mode 100644 index 0000000..4f3d178 Binary files /dev/null and b/lib/json-20180813/org/jetbrains/annotations/Async$Execute.class differ diff --git a/lib/json-20180813/org/jetbrains/annotations/Async$Schedule.class b/lib/json-20180813/org/jetbrains/annotations/Async$Schedule.class new file mode 100644 index 0000000..719bdef Binary files /dev/null and b/lib/json-20180813/org/jetbrains/annotations/Async$Schedule.class differ diff --git a/lib/json-20180813/org/jetbrains/annotations/Async.class b/lib/json-20180813/org/jetbrains/annotations/Async.class new file mode 100644 index 0000000..cf52954 Binary files /dev/null and b/lib/json-20180813/org/jetbrains/annotations/Async.class differ diff --git a/lib/json-20180813/org/jetbrains/annotations/Contract.class b/lib/json-20180813/org/jetbrains/annotations/Contract.class new file mode 100644 index 0000000..490bab2 Binary files /dev/null and b/lib/json-20180813/org/jetbrains/annotations/Contract.class differ diff --git a/lib/json-20180813/org/jetbrains/annotations/Nls$Capitalization.class b/lib/json-20180813/org/jetbrains/annotations/Nls$Capitalization.class new file mode 100644 index 0000000..ad1f2f4 Binary files /dev/null and b/lib/json-20180813/org/jetbrains/annotations/Nls$Capitalization.class differ diff --git a/lib/json-20180813/org/jetbrains/annotations/Nls.class b/lib/json-20180813/org/jetbrains/annotations/Nls.class new file mode 100644 index 0000000..6eb87bd Binary files /dev/null and b/lib/json-20180813/org/jetbrains/annotations/Nls.class differ diff --git a/lib/json-20180813/org/jetbrains/annotations/NonNls.class b/lib/json-20180813/org/jetbrains/annotations/NonNls.class new file mode 100644 index 0000000..a066fad Binary files /dev/null and b/lib/json-20180813/org/jetbrains/annotations/NonNls.class differ diff --git a/lib/json-20180813/org/jetbrains/annotations/NotNull.class b/lib/json-20180813/org/jetbrains/annotations/NotNull.class new file mode 100644 index 0000000..b4efa69 Binary files /dev/null and b/lib/json-20180813/org/jetbrains/annotations/NotNull.class differ diff --git a/lib/json-20180813/org/jetbrains/annotations/Nullable.class b/lib/json-20180813/org/jetbrains/annotations/Nullable.class new file mode 100644 index 0000000..9df3526 Binary files /dev/null and b/lib/json-20180813/org/jetbrains/annotations/Nullable.class differ diff --git a/lib/json-20180813/org/jetbrains/annotations/PropertyKey.class b/lib/json-20180813/org/jetbrains/annotations/PropertyKey.class new file mode 100644 index 0000000..de9ccad Binary files /dev/null and b/lib/json-20180813/org/jetbrains/annotations/PropertyKey.class differ diff --git a/lib/json-20180813/org/jetbrains/annotations/TestOnly.class b/lib/json-20180813/org/jetbrains/annotations/TestOnly.class new file mode 100644 index 0000000..8bda70d Binary files /dev/null and b/lib/json-20180813/org/jetbrains/annotations/TestOnly.class differ diff --git a/lib/json-20180813/org/json/CDL.class b/lib/json-20180813/org/json/CDL.class new file mode 100644 index 0000000..e03b345 Binary files /dev/null and b/lib/json-20180813/org/json/CDL.class differ diff --git a/lib/json-20180813/org/json/Cookie.class b/lib/json-20180813/org/json/Cookie.class new file mode 100644 index 0000000..6bd0256 Binary files /dev/null and b/lib/json-20180813/org/json/Cookie.class differ diff --git a/lib/json-20180813/org/json/CookieList.class b/lib/json-20180813/org/json/CookieList.class new file mode 100644 index 0000000..9f95e46 Binary files /dev/null and b/lib/json-20180813/org/json/CookieList.class differ diff --git a/lib/json-20180813/org/json/HTTP.class b/lib/json-20180813/org/json/HTTP.class new file mode 100644 index 0000000..630c6bb Binary files /dev/null and b/lib/json-20180813/org/json/HTTP.class differ diff --git a/lib/json-20180813/org/json/HTTPTokener.class b/lib/json-20180813/org/json/HTTPTokener.class new file mode 100644 index 0000000..53e0c33 Binary files /dev/null and b/lib/json-20180813/org/json/HTTPTokener.class differ diff --git a/lib/json-20180813/org/json/JSONArray.class b/lib/json-20180813/org/json/JSONArray.class new file mode 100644 index 0000000..5d16fb8 Binary files /dev/null and b/lib/json-20180813/org/json/JSONArray.class differ diff --git a/lib/json-20180813/org/json/JSONException.class b/lib/json-20180813/org/json/JSONException.class new file mode 100644 index 0000000..0646b30 Binary files /dev/null and b/lib/json-20180813/org/json/JSONException.class differ diff --git a/lib/json-20180813/org/json/JSONML.class b/lib/json-20180813/org/json/JSONML.class new file mode 100644 index 0000000..2c7f02c Binary files /dev/null and b/lib/json-20180813/org/json/JSONML.class differ diff --git a/lib/json-20180813/org/json/JSONObject$1.class b/lib/json-20180813/org/json/JSONObject$1.class new file mode 100644 index 0000000..2618e2c Binary files /dev/null and b/lib/json-20180813/org/json/JSONObject$1.class differ diff --git a/lib/json-20180813/org/json/JSONObject$Null.class b/lib/json-20180813/org/json/JSONObject$Null.class new file mode 100644 index 0000000..eb4a0e2 Binary files /dev/null and b/lib/json-20180813/org/json/JSONObject$Null.class differ diff --git a/lib/json-20180813/org/json/JSONObject.class b/lib/json-20180813/org/json/JSONObject.class new file mode 100644 index 0000000..de059d6 Binary files /dev/null and b/lib/json-20180813/org/json/JSONObject.class differ diff --git a/lib/json-20180813/org/json/JSONPointer$Builder.class b/lib/json-20180813/org/json/JSONPointer$Builder.class new file mode 100644 index 0000000..bfa1036 Binary files /dev/null and b/lib/json-20180813/org/json/JSONPointer$Builder.class differ diff --git a/lib/json-20180813/org/json/JSONPointer.class b/lib/json-20180813/org/json/JSONPointer.class new file mode 100644 index 0000000..eb95f66 Binary files /dev/null and b/lib/json-20180813/org/json/JSONPointer.class differ diff --git a/lib/json-20180813/org/json/JSONPointerException.class b/lib/json-20180813/org/json/JSONPointerException.class new file mode 100644 index 0000000..60a7a6c Binary files /dev/null and b/lib/json-20180813/org/json/JSONPointerException.class differ diff --git a/lib/json-20180813/org/json/JSONPropertyIgnore.class b/lib/json-20180813/org/json/JSONPropertyIgnore.class new file mode 100644 index 0000000..3df0f61 Binary files /dev/null and b/lib/json-20180813/org/json/JSONPropertyIgnore.class differ diff --git a/lib/json-20180813/org/json/JSONPropertyName.class b/lib/json-20180813/org/json/JSONPropertyName.class new file mode 100644 index 0000000..c993e2c Binary files /dev/null and b/lib/json-20180813/org/json/JSONPropertyName.class differ diff --git a/lib/json-20180813/org/json/JSONString.class b/lib/json-20180813/org/json/JSONString.class new file mode 100644 index 0000000..329f686 Binary files /dev/null and b/lib/json-20180813/org/json/JSONString.class differ diff --git a/lib/json-20180813/org/json/JSONStringer.class b/lib/json-20180813/org/json/JSONStringer.class new file mode 100644 index 0000000..0280a1c Binary files /dev/null and b/lib/json-20180813/org/json/JSONStringer.class differ diff --git a/lib/json-20180813/org/json/JSONTokener.class b/lib/json-20180813/org/json/JSONTokener.class new file mode 100644 index 0000000..f18dd05 Binary files /dev/null and b/lib/json-20180813/org/json/JSONTokener.class differ diff --git a/lib/json-20180813/org/json/JSONWriter.class b/lib/json-20180813/org/json/JSONWriter.class new file mode 100644 index 0000000..9419f4b Binary files /dev/null and b/lib/json-20180813/org/json/JSONWriter.class differ diff --git a/lib/json-20180813/org/json/Property.class b/lib/json-20180813/org/json/Property.class new file mode 100644 index 0000000..a655432 Binary files /dev/null and b/lib/json-20180813/org/json/Property.class differ diff --git a/lib/json-20180813/org/json/XML$1$1.class b/lib/json-20180813/org/json/XML$1$1.class new file mode 100644 index 0000000..ab40989 Binary files /dev/null and b/lib/json-20180813/org/json/XML$1$1.class differ diff --git a/lib/json-20180813/org/json/XML$1.class b/lib/json-20180813/org/json/XML$1.class new file mode 100644 index 0000000..7d22cc4 Binary files /dev/null and b/lib/json-20180813/org/json/XML$1.class differ diff --git a/lib/json-20180813/org/json/XML.class b/lib/json-20180813/org/json/XML.class new file mode 100644 index 0000000..1ce5cf9 Binary files /dev/null and b/lib/json-20180813/org/json/XML.class differ diff --git a/lib/json-20180813/org/json/XMLParserConfiguration.class b/lib/json-20180813/org/json/XMLParserConfiguration.class new file mode 100644 index 0000000..5fc3c8f Binary files /dev/null and b/lib/json-20180813/org/json/XMLParserConfiguration.class differ diff --git a/lib/json-20180813/org/json/XMLTokener.class b/lib/json-20180813/org/json/XMLTokener.class new file mode 100644 index 0000000..84d9416 Binary files /dev/null and b/lib/json-20180813/org/json/XMLTokener.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AngelCodeFont$1.class b/lib/json-20180813/org/newdawn/slick/AngelCodeFont$1.class new file mode 100644 index 0000000..33a197f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AngelCodeFont$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AngelCodeFont$CharDef.class b/lib/json-20180813/org/newdawn/slick/AngelCodeFont$CharDef.class new file mode 100644 index 0000000..ea711f7 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AngelCodeFont$CharDef.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AngelCodeFont$DisplayList.class b/lib/json-20180813/org/newdawn/slick/AngelCodeFont$DisplayList.class new file mode 100644 index 0000000..0d38a17 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AngelCodeFont$DisplayList.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AngelCodeFont.class b/lib/json-20180813/org/newdawn/slick/AngelCodeFont.class new file mode 100644 index 0000000..49c6476 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AngelCodeFont.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Animation$Frame.class b/lib/json-20180813/org/newdawn/slick/Animation$Frame.class new file mode 100644 index 0000000..87a7611 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Animation$Frame.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Animation.class b/lib/json-20180813/org/newdawn/slick/Animation.class new file mode 100644 index 0000000..9d3fdaf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Animation.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AppGameContainer$1.class b/lib/json-20180813/org/newdawn/slick/AppGameContainer$1.class new file mode 100644 index 0000000..9203abf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AppGameContainer$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AppGameContainer$2.class b/lib/json-20180813/org/newdawn/slick/AppGameContainer$2.class new file mode 100644 index 0000000..e0a2db3 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AppGameContainer$2.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AppGameContainer$NullOutputStream.class b/lib/json-20180813/org/newdawn/slick/AppGameContainer$NullOutputStream.class new file mode 100644 index 0000000..af6406b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AppGameContainer$NullOutputStream.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AppGameContainer.class b/lib/json-20180813/org/newdawn/slick/AppGameContainer.class new file mode 100644 index 0000000..17c5d52 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AppGameContainer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AppletGameContainer$1.class b/lib/json-20180813/org/newdawn/slick/AppletGameContainer$1.class new file mode 100644 index 0000000..82d932f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AppletGameContainer$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AppletGameContainer$2.class b/lib/json-20180813/org/newdawn/slick/AppletGameContainer$2.class new file mode 100644 index 0000000..cb56916 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AppletGameContainer$2.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AppletGameContainer$ConsolePanel.class b/lib/json-20180813/org/newdawn/slick/AppletGameContainer$ConsolePanel.class new file mode 100644 index 0000000..2d03460 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AppletGameContainer$ConsolePanel.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AppletGameContainer$Container.class b/lib/json-20180813/org/newdawn/slick/AppletGameContainer$Container.class new file mode 100644 index 0000000..d05d029 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AppletGameContainer$Container.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AppletGameContainer$ContainerPanel.class b/lib/json-20180813/org/newdawn/slick/AppletGameContainer$ContainerPanel.class new file mode 100644 index 0000000..4a8acf5 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AppletGameContainer$ContainerPanel.class differ diff --git a/lib/json-20180813/org/newdawn/slick/AppletGameContainer.class b/lib/json-20180813/org/newdawn/slick/AppletGameContainer.class new file mode 100644 index 0000000..c31f507 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/AppletGameContainer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/BasicGame.class b/lib/json-20180813/org/newdawn/slick/BasicGame.class new file mode 100644 index 0000000..06d3503 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/BasicGame.class differ diff --git a/lib/json-20180813/org/newdawn/slick/BigImage$1.class b/lib/json-20180813/org/newdawn/slick/BigImage$1.class new file mode 100644 index 0000000..6209029 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/BigImage$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/BigImage$2.class b/lib/json-20180813/org/newdawn/slick/BigImage$2.class new file mode 100644 index 0000000..9dd4032 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/BigImage$2.class differ diff --git a/lib/json-20180813/org/newdawn/slick/BigImage.class b/lib/json-20180813/org/newdawn/slick/BigImage.class new file mode 100644 index 0000000..1d7bb4c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/BigImage.class differ diff --git a/lib/json-20180813/org/newdawn/slick/CachedRender.class b/lib/json-20180813/org/newdawn/slick/CachedRender.class new file mode 100644 index 0000000..404abcd Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/CachedRender.class differ diff --git a/lib/json-20180813/org/newdawn/slick/CanvasGameContainer$1.class b/lib/json-20180813/org/newdawn/slick/CanvasGameContainer$1.class new file mode 100644 index 0000000..7c04da7 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/CanvasGameContainer$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/CanvasGameContainer$2.class b/lib/json-20180813/org/newdawn/slick/CanvasGameContainer$2.class new file mode 100644 index 0000000..7b4dc42 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/CanvasGameContainer$2.class differ diff --git a/lib/json-20180813/org/newdawn/slick/CanvasGameContainer$Container.class b/lib/json-20180813/org/newdawn/slick/CanvasGameContainer$Container.class new file mode 100644 index 0000000..97a79d9 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/CanvasGameContainer$Container.class differ diff --git a/lib/json-20180813/org/newdawn/slick/CanvasGameContainer.class b/lib/json-20180813/org/newdawn/slick/CanvasGameContainer.class new file mode 100644 index 0000000..baf2f2e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/CanvasGameContainer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Color.class b/lib/json-20180813/org/newdawn/slick/Color.class new file mode 100644 index 0000000..69ace62 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Color.class differ diff --git a/lib/json-20180813/org/newdawn/slick/ControlledInputReciever.class b/lib/json-20180813/org/newdawn/slick/ControlledInputReciever.class new file mode 100644 index 0000000..e96a090 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/ControlledInputReciever.class differ diff --git a/lib/json-20180813/org/newdawn/slick/ControllerListener.class b/lib/json-20180813/org/newdawn/slick/ControllerListener.class new file mode 100644 index 0000000..c019a0c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/ControllerListener.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Font.class b/lib/json-20180813/org/newdawn/slick/Font.class new file mode 100644 index 0000000..1cbe51b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Font.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Game.class b/lib/json-20180813/org/newdawn/slick/Game.class new file mode 100644 index 0000000..694c135 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Game.class differ diff --git a/lib/json-20180813/org/newdawn/slick/GameContainer.class b/lib/json-20180813/org/newdawn/slick/GameContainer.class new file mode 100644 index 0000000..19c0780 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/GameContainer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Graphics$1.class b/lib/json-20180813/org/newdawn/slick/Graphics$1.class new file mode 100644 index 0000000..18b3f1f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Graphics$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Graphics.class b/lib/json-20180813/org/newdawn/slick/Graphics.class new file mode 100644 index 0000000..a556441 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Graphics.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Image.class b/lib/json-20180813/org/newdawn/slick/Image.class new file mode 100644 index 0000000..4406ee1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Image.class differ diff --git a/lib/json-20180813/org/newdawn/slick/ImageBuffer.class b/lib/json-20180813/org/newdawn/slick/ImageBuffer.class new file mode 100644 index 0000000..c2a47ba Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/ImageBuffer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Input$NullOutputStream.class b/lib/json-20180813/org/newdawn/slick/Input$NullOutputStream.class new file mode 100644 index 0000000..9493118 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Input$NullOutputStream.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Input.class b/lib/json-20180813/org/newdawn/slick/Input.class new file mode 100644 index 0000000..de7049c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Input.class differ diff --git a/lib/json-20180813/org/newdawn/slick/InputListener.class b/lib/json-20180813/org/newdawn/slick/InputListener.class new file mode 100644 index 0000000..51ff01a Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/InputListener.class differ diff --git a/lib/json-20180813/org/newdawn/slick/KeyListener.class b/lib/json-20180813/org/newdawn/slick/KeyListener.class new file mode 100644 index 0000000..654c119 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/KeyListener.class differ diff --git a/lib/json-20180813/org/newdawn/slick/MouseListener.class b/lib/json-20180813/org/newdawn/slick/MouseListener.class new file mode 100644 index 0000000..7ab5e5c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/MouseListener.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Music.class b/lib/json-20180813/org/newdawn/slick/Music.class new file mode 100644 index 0000000..aa7de98 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Music.class differ diff --git a/lib/json-20180813/org/newdawn/slick/MusicListener.class b/lib/json-20180813/org/newdawn/slick/MusicListener.class new file mode 100644 index 0000000..db275b3 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/MusicListener.class differ diff --git a/lib/json-20180813/org/newdawn/slick/PackedSpriteSheet$Section.class b/lib/json-20180813/org/newdawn/slick/PackedSpriteSheet$Section.class new file mode 100644 index 0000000..84557b6 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/PackedSpriteSheet$Section.class differ diff --git a/lib/json-20180813/org/newdawn/slick/PackedSpriteSheet.class b/lib/json-20180813/org/newdawn/slick/PackedSpriteSheet.class new file mode 100644 index 0000000..f464713 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/PackedSpriteSheet.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Renderable.class b/lib/json-20180813/org/newdawn/slick/Renderable.class new file mode 100644 index 0000000..ec54de8 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Renderable.class differ diff --git a/lib/json-20180813/org/newdawn/slick/SavedState.class b/lib/json-20180813/org/newdawn/slick/SavedState.class new file mode 100644 index 0000000..fee20c0 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/SavedState.class differ diff --git a/lib/json-20180813/org/newdawn/slick/ScalableGame.class b/lib/json-20180813/org/newdawn/slick/ScalableGame.class new file mode 100644 index 0000000..4e5a8ce Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/ScalableGame.class differ diff --git a/lib/json-20180813/org/newdawn/slick/ShapeFill.class b/lib/json-20180813/org/newdawn/slick/ShapeFill.class new file mode 100644 index 0000000..f9a30de Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/ShapeFill.class differ diff --git a/lib/json-20180813/org/newdawn/slick/SlickException.class b/lib/json-20180813/org/newdawn/slick/SlickException.class new file mode 100644 index 0000000..2ad0525 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/SlickException.class differ diff --git a/lib/json-20180813/org/newdawn/slick/Sound.class b/lib/json-20180813/org/newdawn/slick/Sound.class new file mode 100644 index 0000000..9b41f19 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/Sound.class differ diff --git a/lib/json-20180813/org/newdawn/slick/SpriteSheet.class b/lib/json-20180813/org/newdawn/slick/SpriteSheet.class new file mode 100644 index 0000000..9bc12bc Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/SpriteSheet.class differ diff --git a/lib/json-20180813/org/newdawn/slick/SpriteSheetFont.class b/lib/json-20180813/org/newdawn/slick/SpriteSheetFont.class new file mode 100644 index 0000000..0d72870 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/SpriteSheetFont.class differ diff --git a/lib/json-20180813/org/newdawn/slick/TrueTypeFont$1.class b/lib/json-20180813/org/newdawn/slick/TrueTypeFont$1.class new file mode 100644 index 0000000..1d7abcc Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/TrueTypeFont$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/TrueTypeFont$IntObject.class b/lib/json-20180813/org/newdawn/slick/TrueTypeFont$IntObject.class new file mode 100644 index 0000000..afe2da8 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/TrueTypeFont$IntObject.class differ diff --git a/lib/json-20180813/org/newdawn/slick/TrueTypeFont.class b/lib/json-20180813/org/newdawn/slick/TrueTypeFont.class new file mode 100644 index 0000000..2e33601 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/TrueTypeFont.class differ diff --git a/lib/json-20180813/org/newdawn/slick/UnicodeFont$1.class b/lib/json-20180813/org/newdawn/slick/UnicodeFont$1.class new file mode 100644 index 0000000..5132fab Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/UnicodeFont$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/UnicodeFont$2.class b/lib/json-20180813/org/newdawn/slick/UnicodeFont$2.class new file mode 100644 index 0000000..189ae7c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/UnicodeFont$2.class differ diff --git a/lib/json-20180813/org/newdawn/slick/UnicodeFont$3.class b/lib/json-20180813/org/newdawn/slick/UnicodeFont$3.class new file mode 100644 index 0000000..5a8dd74 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/UnicodeFont$3.class differ diff --git a/lib/json-20180813/org/newdawn/slick/UnicodeFont$DisplayList.class b/lib/json-20180813/org/newdawn/slick/UnicodeFont$DisplayList.class new file mode 100644 index 0000000..61f0f35 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/UnicodeFont$DisplayList.class differ diff --git a/lib/json-20180813/org/newdawn/slick/UnicodeFont.class b/lib/json-20180813/org/newdawn/slick/UnicodeFont.class new file mode 100644 index 0000000..9478cba Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/UnicodeFont.class differ diff --git a/lib/json-20180813/org/newdawn/slick/XMLPackedSheet.class b/lib/json-20180813/org/newdawn/slick/XMLPackedSheet.class new file mode 100644 index 0000000..a05842e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/XMLPackedSheet.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/BasicCommand.class b/lib/json-20180813/org/newdawn/slick/command/BasicCommand.class new file mode 100644 index 0000000..7715002 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/BasicCommand.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/Command.class b/lib/json-20180813/org/newdawn/slick/command/Command.class new file mode 100644 index 0000000..ab12ff0 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/Command.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/Control.class b/lib/json-20180813/org/newdawn/slick/command/Control.class new file mode 100644 index 0000000..f26af64 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/Control.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/ControllerButtonControl.class b/lib/json-20180813/org/newdawn/slick/command/ControllerButtonControl.class new file mode 100644 index 0000000..8cea1b5 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/ControllerButtonControl.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/ControllerControl.class b/lib/json-20180813/org/newdawn/slick/command/ControllerControl.class new file mode 100644 index 0000000..d1bb74d Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/ControllerControl.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/ControllerDirectionControl$Direction.class b/lib/json-20180813/org/newdawn/slick/command/ControllerDirectionControl$Direction.class new file mode 100644 index 0000000..711365b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/ControllerDirectionControl$Direction.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/ControllerDirectionControl.class b/lib/json-20180813/org/newdawn/slick/command/ControllerDirectionControl.class new file mode 100644 index 0000000..fe86611 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/ControllerDirectionControl.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/InputProvider$1.class b/lib/json-20180813/org/newdawn/slick/command/InputProvider$1.class new file mode 100644 index 0000000..07f765f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/InputProvider$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/InputProvider$CommandState.class b/lib/json-20180813/org/newdawn/slick/command/InputProvider$CommandState.class new file mode 100644 index 0000000..d21f626 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/InputProvider$CommandState.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/InputProvider$InputListenerImpl.class b/lib/json-20180813/org/newdawn/slick/command/InputProvider$InputListenerImpl.class new file mode 100644 index 0000000..052e9e4 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/InputProvider$InputListenerImpl.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/InputProvider.class b/lib/json-20180813/org/newdawn/slick/command/InputProvider.class new file mode 100644 index 0000000..ffeba2a Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/InputProvider.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/InputProviderListener.class b/lib/json-20180813/org/newdawn/slick/command/InputProviderListener.class new file mode 100644 index 0000000..b8f0597 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/InputProviderListener.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/KeyControl.class b/lib/json-20180813/org/newdawn/slick/command/KeyControl.class new file mode 100644 index 0000000..9a9ff12 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/KeyControl.class differ diff --git a/lib/json-20180813/org/newdawn/slick/command/MouseButtonControl.class b/lib/json-20180813/org/newdawn/slick/command/MouseButtonControl.class new file mode 100644 index 0000000..6514a26 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/command/MouseButtonControl.class differ diff --git a/lib/json-20180813/org/newdawn/slick/data/defaultfont.fnt b/lib/json-20180813/org/newdawn/slick/data/defaultfont.fnt new file mode 100644 index 0000000..af16759 --- /dev/null +++ b/lib/json-20180813/org/newdawn/slick/data/defaultfont.fnt @@ -0,0 +1,195 @@ +info face="Courier New Bold" size=16 bold=1 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 +common lineHeight=19 base=26 scaleW=256 scaleH=256 pages=1 packed=0 +page id=0 file="defaultfont.png" +chars count=189 +char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=14 xadvance=9 page=0 chnl=0 +char id=253 x=0 y=0 width=12 height=16 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=254 x=12 y=0 width=11 height=15 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=221 x=23 y=0 width=12 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=0 +char id=218 x=35 y=0 width=11 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=0 +char id=217 x=46 y=0 width=11 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=0 +char id=211 x=57 y=0 width=11 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=0 +char id=210 x=68 y=0 width=11 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=0 +char id=205 x=79 y=0 width=10 height=15 xoffset=1 yoffset=0 xadvance=9 page=0 chnl=0 +char id=204 x=89 y=0 width=10 height=15 xoffset=1 yoffset=0 xadvance=9 page=0 chnl=0 +char id=201 x=99 y=0 width=10 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=0 +char id=200 x=109 y=0 width=10 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=0 +char id=199 x=119 y=0 width=11 height=15 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=197 x=130 y=0 width=12 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=0 +char id=193 x=142 y=0 width=12 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=0 +char id=192 x=154 y=0 width=12 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=0 +char id=36 x=166 y=0 width=9 height=15 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=0 +char id=106 x=175 y=0 width=8 height=15 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=255 x=183 y=0 width=12 height=14 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=219 x=195 y=0 width=11 height=14 xoffset=0 yoffset=1 xadvance=9 page=0 chnl=0 +char id=213 x=206 y=0 width=11 height=14 xoffset=0 yoffset=1 xadvance=9 page=0 chnl=0 +char id=212 x=217 y=0 width=11 height=14 xoffset=0 yoffset=1 xadvance=9 page=0 chnl=0 +char id=209 x=228 y=0 width=11 height=14 xoffset=0 yoffset=1 xadvance=9 page=0 chnl=0 +char id=206 x=239 y=0 width=10 height=14 xoffset=1 yoffset=1 xadvance=9 page=0 chnl=0 +char id=202 x=0 y=16 width=10 height=14 xoffset=0 yoffset=1 xadvance=9 page=0 chnl=0 +char id=195 x=10 y=16 width=12 height=14 xoffset=0 yoffset=1 xadvance=9 page=0 chnl=0 +char id=194 x=22 y=16 width=12 height=14 xoffset=0 yoffset=1 xadvance=9 page=0 chnl=0 +char id=162 x=34 y=16 width=10 height=14 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=0 +char id=92 x=44 y=16 width=9 height=14 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=47 x=53 y=16 width=9 height=14 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=93 x=62 y=16 width=6 height=14 xoffset=2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=91 x=68 y=16 width=6 height=14 xoffset=4 yoffset=3 xadvance=9 page=0 chnl=0 +char id=41 x=74 y=16 width=5 height=14 xoffset=2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=40 x=79 y=16 width=5 height=14 xoffset=3 yoffset=3 xadvance=9 page=0 chnl=0 +char id=250 x=84 y=16 width=11 height=13 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=249 x=95 y=16 width=11 height=13 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=243 x=106 y=16 width=10 height=13 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=242 x=116 y=16 width=10 height=13 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=237 x=126 y=16 width=10 height=13 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=0 +char id=236 x=136 y=16 width=10 height=13 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=0 +char id=233 x=146 y=16 width=11 height=13 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=232 x=157 y=16 width=11 height=13 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=229 x=168 y=16 width=10 height=13 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=0 +char id=225 x=178 y=16 width=10 height=13 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=0 +char id=224 x=188 y=16 width=10 height=13 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=0 +char id=220 x=198 y=16 width=11 height=13 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=216 x=209 y=16 width=11 height=13 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=214 x=220 y=16 width=11 height=13 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=207 x=231 y=16 width=10 height=13 xoffset=1 yoffset=2 xadvance=9 page=0 chnl=0 +char id=203 x=241 y=16 width=10 height=13 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=196 x=0 y=30 width=12 height=13 xoffset=0 yoffset=2 xadvance=9 page=0 chnl=0 +char id=182 x=12 y=30 width=10 height=13 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=167 x=22 y=30 width=10 height=13 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=166 x=32 y=30 width=4 height=13 xoffset=4 yoffset=4 xadvance=9 page=0 chnl=0 +char id=124 x=36 y=30 width=4 height=13 xoffset=4 yoffset=4 xadvance=9 page=0 chnl=0 +char id=125 x=40 y=30 width=6 height=13 xoffset=3 yoffset=4 xadvance=9 page=0 chnl=0 +char id=123 x=46 y=30 width=6 height=13 xoffset=2 yoffset=4 xadvance=9 page=0 chnl=0 +char id=81 x=52 y=30 width=11 height=13 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=251 x=63 y=30 width=11 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=245 x=74 y=30 width=10 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=244 x=84 y=30 width=10 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=241 x=94 y=30 width=11 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=240 x=105 y=30 width=10 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=238 x=115 y=30 width=10 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=234 x=125 y=30 width=11 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=231 x=136 y=30 width=10 height=12 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 +char id=227 x=146 y=30 width=10 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=226 x=156 y=30 width=10 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=223 x=166 y=30 width=9 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=181 x=175 y=30 width=11 height=12 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=127 x=186 y=30 width=11 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=35 x=197 y=30 width=10 height=12 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=64 x=207 y=30 width=8 height=12 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=48 x=215 y=30 width=9 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=57 x=224 y=30 width=9 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=56 x=233 y=30 width=9 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=55 x=242 y=30 width=9 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=54 x=0 y=43 width=9 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=53 x=9 y=43 width=9 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=52 x=18 y=43 width=9 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=51 x=27 y=43 width=9 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=50 x=36 y=43 width=8 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=121 x=44 y=43 width=12 height=12 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=113 x=56 y=43 width=11 height=12 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=112 x=67 y=43 width=11 height=12 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=108 x=78 y=43 width=10 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=107 x=88 y=43 width=11 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=105 x=99 y=43 width=10 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=104 x=109 y=43 width=11 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=103 x=120 y=43 width=11 height=12 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=102 x=131 y=43 width=10 height=12 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=100 x=141 y=43 width=11 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=98 x=152 y=43 width=11 height=12 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=0 +char id=252 x=163 y=43 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=248 x=174 y=43 width=10 height=11 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=0 +char id=246 x=184 y=43 width=10 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=239 x=194 y=43 width=10 height=11 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=235 x=204 y=43 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=228 x=215 y=43 width=10 height=11 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=222 x=225 y=43 width=10 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=208 x=235 y=43 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=198 x=0 y=55 width=12 height=11 xoffset=-1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=191 x=12 y=55 width=9 height=11 xoffset=1 yoffset=7 xadvance=9 page=0 chnl=0 +char id=190 x=21 y=55 width=12 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=189 x=33 y=55 width=12 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=188 x=45 y=55 width=12 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=177 x=57 y=55 width=9 height=11 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=174 x=66 y=55 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=169 x=77 y=55 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=165 x=88 y=55 width=12 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=163 x=100 y=55 width=10 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=161 x=110 y=55 width=4 height=11 xoffset=3 yoffset=7 xadvance=9 page=0 chnl=0 +char id=38 x=114 y=55 width=9 height=11 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=37 x=123 y=55 width=9 height=11 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=63 x=132 y=55 width=8 height=11 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=33 x=140 y=55 width=4 height=11 xoffset=3 yoffset=4 xadvance=9 page=0 chnl=0 +char id=49 x=144 y=55 width=10 height=11 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=116 x=154 y=55 width=9 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=90 x=163 y=55 width=9 height=11 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=89 x=172 y=55 width=12 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=88 x=184 y=55 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=87 x=195 y=55 width=13 height=11 xoffset=-1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=86 x=208 y=55 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=85 x=219 y=55 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=84 x=230 y=55 width=10 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=83 x=240 y=55 width=9 height=11 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=82 x=0 y=66 width=12 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=80 x=12 y=66 width=10 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=79 x=22 y=66 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=78 x=33 y=66 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=77 x=44 y=66 width=13 height=11 xoffset=-1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=76 x=57 y=66 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=75 x=68 y=66 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=74 x=79 y=66 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=73 x=90 y=66 width=10 height=11 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=72 x=100 y=66 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=71 x=111 y=66 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=70 x=122 y=66 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=69 x=133 y=66 width=10 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=68 x=143 y=66 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=67 x=154 y=66 width=11 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=66 x=165 y=66 width=10 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=65 x=175 y=66 width=12 height=11 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=247 x=187 y=66 width=10 height=10 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=0 +char id=62 x=197 y=66 width=10 height=10 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=0 +char id=60 x=207 y=66 width=11 height=10 xoffset=0 yoffset=5 xadvance=9 page=0 chnl=0 +char id=59 x=218 y=66 width=6 height=10 xoffset=2 yoffset=7 xadvance=9 page=0 chnl=0 +char id=230 x=224 y=66 width=12 height=9 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=164 x=236 y=66 width=11 height=9 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=0 +char id=43 x=0 y=77 width=9 height=9 xoffset=1 yoffset=5 xadvance=9 page=0 chnl=0 +char id=122 x=9 y=77 width=9 height=9 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=0 +char id=120 x=18 y=77 width=11 height=9 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=119 x=29 y=77 width=13 height=9 xoffset=-1 yoffset=6 xadvance=9 page=0 chnl=0 +char id=118 x=42 y=77 width=11 height=9 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=117 x=53 y=77 width=11 height=9 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=115 x=64 y=77 width=9 height=9 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=0 +char id=114 x=73 y=77 width=10 height=9 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=111 x=83 y=77 width=10 height=9 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=110 x=93 y=77 width=11 height=9 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=109 x=104 y=77 width=12 height=9 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=101 x=116 y=77 width=11 height=9 xoffset=0 yoffset=6 xadvance=9 page=0 chnl=0 +char id=97 x=127 y=77 width=10 height=9 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=0 +char id=42 x=137 y=77 width=10 height=8 xoffset=1 yoffset=4 xadvance=9 page=0 chnl=0 +char id=58 x=147 y=77 width=3 height=8 xoffset=3 yoffset=7 xadvance=9 page=0 chnl=0 +char id=99 x=150 y=77 width=10 height=8 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 +char id=215 x=160 y=77 width=7 height=7 xoffset=1 yoffset=7 xadvance=9 page=0 chnl=0 +char id=187 x=167 y=77 width=10 height=7 xoffset=0 yoffset=8 xadvance=9 page=0 chnl=0 +char id=186 x=177 y=77 width=8 height=7 xoffset=2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=184 x=185 y=77 width=5 height=7 xoffset=3 yoffset=12 xadvance=9 page=0 chnl=0 +char id=178 x=190 y=77 width=7 height=7 xoffset=2 yoffset=3 xadvance=9 page=0 chnl=0 +char id=172 x=197 y=77 width=11 height=7 xoffset=0 yoffset=8 xadvance=9 page=0 chnl=0 +char id=171 x=208 y=77 width=11 height=7 xoffset=0 yoffset=8 xadvance=9 page=0 chnl=0 +char id=94 x=219 y=77 width=8 height=7 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=0 +char id=44 x=227 y=77 width=4 height=7 xoffset=3 yoffset=11 xadvance=9 page=0 chnl=0 +char id=39 x=231 y=77 width=4 height=7 xoffset=4 yoffset=4 xadvance=9 page=0 chnl=0 +char id=34 x=235 y=77 width=8 height=7 xoffset=2 yoffset=4 xadvance=9 page=0 chnl=0 +char id=185 x=243 y=77 width=5 height=6 xoffset=3 yoffset=4 xadvance=9 page=0 chnl=0 +char id=179 x=248 y=77 width=7 height=6 xoffset=3 yoffset=4 xadvance=9 page=0 chnl=0 +char id=170 x=0 y=86 width=7 height=6 xoffset=2 yoffset=4 xadvance=9 page=0 chnl=0 +char id=180 x=7 y=86 width=4 height=5 xoffset=3 yoffset=2 xadvance=9 page=0 chnl=0 +char id=176 x=11 y=86 width=5 height=5 xoffset=2 yoffset=4 xadvance=9 page=0 chnl=0 +char id=126 x=16 y=86 width=9 height=5 xoffset=1 yoffset=7 xadvance=9 page=0 chnl=0 +char id=61 x=25 y=86 width=11 height=5 xoffset=0 yoffset=7 xadvance=9 page=0 chnl=0 +char id=96 x=36 y=86 width=4 height=5 xoffset=3 yoffset=2 xadvance=9 page=0 chnl=0 +char id=183 x=40 y=86 width=3 height=3 xoffset=3 yoffset=8 xadvance=9 page=0 chnl=0 +char id=175 x=43 y=86 width=13 height=3 xoffset=-1 yoffset=1 xadvance=9 page=0 chnl=0 +char id=168 x=56 y=86 width=6 height=3 xoffset=2 yoffset=4 xadvance=9 page=0 chnl=0 +char id=95 x=62 y=86 width=13 height=3 xoffset=-1 yoffset=17 xadvance=9 page=0 chnl=0 +char id=45 x=75 y=86 width=9 height=3 xoffset=1 yoffset=8 xadvance=9 page=0 chnl=0 +char id=46 x=84 y=86 width=3 height=3 xoffset=3 yoffset=12 xadvance=9 page=0 chnl=0 +kernings count=-1 diff --git a/lib/json-20180813/org/newdawn/slick/data/defaultfont.png b/lib/json-20180813/org/newdawn/slick/data/defaultfont.png new file mode 100644 index 0000000..0e56abd Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/data/defaultfont.png differ diff --git a/lib/json-20180813/org/newdawn/slick/data/helvetica_svg b/lib/json-20180813/org/newdawn/slick/data/helvetica_svg new file mode 100644 index 0000000..59e7ade --- /dev/null +++ b/lib/json-20180813/org/newdawn/slick/data/helvetica_svg @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + !"#$%&'()*+,-./0123456789:;<>? +@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ +`abcdefghijklmnopqrstuvwxyz{|}~ + + diff --git a/lib/json-20180813/org/newdawn/slick/data/package.html b/lib/json-20180813/org/newdawn/slick/data/package.html new file mode 100644 index 0000000..fd7ed79 --- /dev/null +++ b/lib/json-20180813/org/newdawn/slick/data/package.html @@ -0,0 +1,4 @@ + +This package contains the default data required for the basic functions of YASL. Currently this includes a default +font to ensure text can always be displayed. + \ No newline at end of file diff --git a/lib/json-20180813/org/newdawn/slick/data/particle.tga b/lib/json-20180813/org/newdawn/slick/data/particle.tga new file mode 100644 index 0000000..7d8ee51 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/data/particle.tga differ diff --git a/lib/json-20180813/org/newdawn/slick/fills/GradientFill.class b/lib/json-20180813/org/newdawn/slick/fills/GradientFill.class new file mode 100644 index 0000000..a0feeb0 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/fills/GradientFill.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/Glyph.class b/lib/json-20180813/org/newdawn/slick/font/Glyph.class new file mode 100644 index 0000000..95073af Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/Glyph.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/GlyphPage$1.class b/lib/json-20180813/org/newdawn/slick/font/GlyphPage$1.class new file mode 100644 index 0000000..56e3018 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/GlyphPage$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/GlyphPage.class b/lib/json-20180813/org/newdawn/slick/font/GlyphPage.class new file mode 100644 index 0000000..a9dc005 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/GlyphPage.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/HieroSettings.class b/lib/json-20180813/org/newdawn/slick/font/HieroSettings.class new file mode 100644 index 0000000..b653b9a Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/HieroSettings.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/ColorEffect.class b/lib/json-20180813/org/newdawn/slick/font/effects/ColorEffect.class new file mode 100644 index 0000000..9684506 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/ColorEffect.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/ConfigurableEffect$Value.class b/lib/json-20180813/org/newdawn/slick/font/effects/ConfigurableEffect$Value.class new file mode 100644 index 0000000..fd2d1bf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/ConfigurableEffect$Value.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/ConfigurableEffect.class b/lib/json-20180813/org/newdawn/slick/font/effects/ConfigurableEffect.class new file mode 100644 index 0000000..22f21c6 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/ConfigurableEffect.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/Effect.class b/lib/json-20180813/org/newdawn/slick/font/effects/Effect.class new file mode 100644 index 0000000..5bf6e8f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/Effect.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$1.class b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$1.class new file mode 100644 index 0000000..5e3dd87 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$2.class b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$2.class new file mode 100644 index 0000000..474b0b0 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$2.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$3.class b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$3.class new file mode 100644 index 0000000..561bf42 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$3.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$4.class b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$4.class new file mode 100644 index 0000000..094d6fa Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$4.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$5.class b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$5.class new file mode 100644 index 0000000..412039c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$5.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$DefaultValue$1.class b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$DefaultValue$1.class new file mode 100644 index 0000000..45687e2 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$DefaultValue$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$DefaultValue.class b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$DefaultValue.class new file mode 100644 index 0000000..fcf64b7 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$DefaultValue.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$ValueDialog$1.class b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$ValueDialog$1.class new file mode 100644 index 0000000..2154b82 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$ValueDialog$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$ValueDialog$2.class b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$ValueDialog$2.class new file mode 100644 index 0000000..57e6982 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$ValueDialog$2.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$ValueDialog.class b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$ValueDialog.class new file mode 100644 index 0000000..3e3c452 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil$ValueDialog.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil.class b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil.class new file mode 100644 index 0000000..3fd96bc Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/EffectUtil.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/FilterEffect.class b/lib/json-20180813/org/newdawn/slick/font/effects/FilterEffect.class new file mode 100644 index 0000000..df59cd9 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/FilterEffect.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/GradientEffect.class b/lib/json-20180813/org/newdawn/slick/font/effects/GradientEffect.class new file mode 100644 index 0000000..19dccde Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/GradientEffect.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/OutlineEffect.class b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineEffect.class new file mode 100644 index 0000000..5475d61 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineEffect.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/OutlineWobbleEffect$1.class b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineWobbleEffect$1.class new file mode 100644 index 0000000..cba6137 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineWobbleEffect$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/OutlineWobbleEffect$WobbleStroke.class b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineWobbleEffect$WobbleStroke.class new file mode 100644 index 0000000..52d049c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineWobbleEffect$WobbleStroke.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/OutlineWobbleEffect.class b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineWobbleEffect.class new file mode 100644 index 0000000..5168b54 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineWobbleEffect.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/OutlineZigzagEffect$1.class b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineZigzagEffect$1.class new file mode 100644 index 0000000..9b23b58 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineZigzagEffect$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/OutlineZigzagEffect$ZigzagStroke.class b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineZigzagEffect$ZigzagStroke.class new file mode 100644 index 0000000..781b427 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineZigzagEffect$ZigzagStroke.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/OutlineZigzagEffect.class b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineZigzagEffect.class new file mode 100644 index 0000000..5f22368 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/OutlineZigzagEffect.class differ diff --git a/lib/json-20180813/org/newdawn/slick/font/effects/ShadowEffect.class b/lib/json-20180813/org/newdawn/slick/font/effects/ShadowEffect.class new file mode 100644 index 0000000..7bb5bcb Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/font/effects/ShadowEffect.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/BasicTriangulator$Point.class b/lib/json-20180813/org/newdawn/slick/geom/BasicTriangulator$Point.class new file mode 100644 index 0000000..38d6c52 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/BasicTriangulator$Point.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/BasicTriangulator$PointList.class b/lib/json-20180813/org/newdawn/slick/geom/BasicTriangulator$PointList.class new file mode 100644 index 0000000..30bc527 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/BasicTriangulator$PointList.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/BasicTriangulator.class b/lib/json-20180813/org/newdawn/slick/geom/BasicTriangulator.class new file mode 100644 index 0000000..858ff1b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/BasicTriangulator.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/Circle.class b/lib/json-20180813/org/newdawn/slick/geom/Circle.class new file mode 100644 index 0000000..9f05bf5 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/Circle.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/Curve.class b/lib/json-20180813/org/newdawn/slick/geom/Curve.class new file mode 100644 index 0000000..ec224a4 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/Curve.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/Ellipse.class b/lib/json-20180813/org/newdawn/slick/geom/Ellipse.class new file mode 100644 index 0000000..3656166 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/Ellipse.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/GeomUtil$HitResult.class b/lib/json-20180813/org/newdawn/slick/geom/GeomUtil$HitResult.class new file mode 100644 index 0000000..7a3061f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/GeomUtil$HitResult.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/GeomUtil.class b/lib/json-20180813/org/newdawn/slick/geom/GeomUtil.class new file mode 100644 index 0000000..dadbc45 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/GeomUtil.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/GeomUtilListener.class b/lib/json-20180813/org/newdawn/slick/geom/GeomUtilListener.class new file mode 100644 index 0000000..e4d10ff Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/GeomUtilListener.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/Line.class b/lib/json-20180813/org/newdawn/slick/geom/Line.class new file mode 100644 index 0000000..0aba900 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/Line.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/MannTriangulator$Point.class b/lib/json-20180813/org/newdawn/slick/geom/MannTriangulator$Point.class new file mode 100644 index 0000000..bef2888 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/MannTriangulator$Point.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/MannTriangulator$PointBag.class b/lib/json-20180813/org/newdawn/slick/geom/MannTriangulator$PointBag.class new file mode 100644 index 0000000..905eb00 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/MannTriangulator$PointBag.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/MannTriangulator.class b/lib/json-20180813/org/newdawn/slick/geom/MannTriangulator.class new file mode 100644 index 0000000..47a4f2f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/MannTriangulator.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/MorphShape.class b/lib/json-20180813/org/newdawn/slick/geom/MorphShape.class new file mode 100644 index 0000000..8231ad4 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/MorphShape.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/NeatTriangulator$Edge.class b/lib/json-20180813/org/newdawn/slick/geom/NeatTriangulator$Edge.class new file mode 100644 index 0000000..5244698 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/NeatTriangulator$Edge.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/NeatTriangulator$InternalException.class b/lib/json-20180813/org/newdawn/slick/geom/NeatTriangulator$InternalException.class new file mode 100644 index 0000000..c3b1740 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/NeatTriangulator$InternalException.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/NeatTriangulator$Triangle.class b/lib/json-20180813/org/newdawn/slick/geom/NeatTriangulator$Triangle.class new file mode 100644 index 0000000..16b0bc4 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/NeatTriangulator$Triangle.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/NeatTriangulator.class b/lib/json-20180813/org/newdawn/slick/geom/NeatTriangulator.class new file mode 100644 index 0000000..d3947c0 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/NeatTriangulator.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/OverTriangulator.class b/lib/json-20180813/org/newdawn/slick/geom/OverTriangulator.class new file mode 100644 index 0000000..3d03e47 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/OverTriangulator.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/Path.class b/lib/json-20180813/org/newdawn/slick/geom/Path.class new file mode 100644 index 0000000..649c685 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/Path.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/Point.class b/lib/json-20180813/org/newdawn/slick/geom/Point.class new file mode 100644 index 0000000..68cc282 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/Point.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/Polygon.class b/lib/json-20180813/org/newdawn/slick/geom/Polygon.class new file mode 100644 index 0000000..49a6bae Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/Polygon.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/Rectangle.class b/lib/json-20180813/org/newdawn/slick/geom/Rectangle.class new file mode 100644 index 0000000..2fc07dc Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/Rectangle.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/RoundedRectangle.class b/lib/json-20180813/org/newdawn/slick/geom/RoundedRectangle.class new file mode 100644 index 0000000..4250dfe Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/RoundedRectangle.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/Shape.class b/lib/json-20180813/org/newdawn/slick/geom/Shape.class new file mode 100644 index 0000000..49d5e11 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/Shape.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$1.class b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$1.class new file mode 100644 index 0000000..f8c2d39 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$2.class b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$2.class new file mode 100644 index 0000000..2071095 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$2.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$3.class b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$3.class new file mode 100644 index 0000000..b3d447c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$3.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$4.class b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$4.class new file mode 100644 index 0000000..0d56616 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$4.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$5.class b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$5.class new file mode 100644 index 0000000..d48822e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$5.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$6.class b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$6.class new file mode 100644 index 0000000..7d1ea47 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$6.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$PointCallback.class b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$PointCallback.class new file mode 100644 index 0000000..8ec2336 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer$PointCallback.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer.class b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer.class new file mode 100644 index 0000000..e901f23 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/ShapeRenderer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/TexCoordGenerator.class b/lib/json-20180813/org/newdawn/slick/geom/TexCoordGenerator.class new file mode 100644 index 0000000..b4581cd Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/TexCoordGenerator.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/Transform.class b/lib/json-20180813/org/newdawn/slick/geom/Transform.class new file mode 100644 index 0000000..891918f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/Transform.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/Triangulator.class b/lib/json-20180813/org/newdawn/slick/geom/Triangulator.class new file mode 100644 index 0000000..56bf586 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/Triangulator.class differ diff --git a/lib/json-20180813/org/newdawn/slick/geom/Vector2f.class b/lib/json-20180813/org/newdawn/slick/geom/Vector2f.class new file mode 100644 index 0000000..9a16335 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/geom/Vector2f.class differ diff --git a/lib/json-20180813/org/newdawn/slick/gui/AbstractComponent.class b/lib/json-20180813/org/newdawn/slick/gui/AbstractComponent.class new file mode 100644 index 0000000..f02f58e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/gui/AbstractComponent.class differ diff --git a/lib/json-20180813/org/newdawn/slick/gui/BasicComponent.class b/lib/json-20180813/org/newdawn/slick/gui/BasicComponent.class new file mode 100644 index 0000000..02ece31 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/gui/BasicComponent.class differ diff --git a/lib/json-20180813/org/newdawn/slick/gui/ComponentListener.class b/lib/json-20180813/org/newdawn/slick/gui/ComponentListener.class new file mode 100644 index 0000000..8c79369 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/gui/ComponentListener.class differ diff --git a/lib/json-20180813/org/newdawn/slick/gui/GUIContext.class b/lib/json-20180813/org/newdawn/slick/gui/GUIContext.class new file mode 100644 index 0000000..e8966bf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/gui/GUIContext.class differ diff --git a/lib/json-20180813/org/newdawn/slick/gui/MouseOverArea.class b/lib/json-20180813/org/newdawn/slick/gui/MouseOverArea.class new file mode 100644 index 0000000..2de9f28 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/gui/MouseOverArea.class differ diff --git a/lib/json-20180813/org/newdawn/slick/gui/TextField.class b/lib/json-20180813/org/newdawn/slick/gui/TextField.class new file mode 100644 index 0000000..430156f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/gui/TextField.class differ diff --git a/lib/json-20180813/org/newdawn/slick/imageout/ImageIOWriter.class b/lib/json-20180813/org/newdawn/slick/imageout/ImageIOWriter.class new file mode 100644 index 0000000..399b429 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/imageout/ImageIOWriter.class differ diff --git a/lib/json-20180813/org/newdawn/slick/imageout/ImageOut.class b/lib/json-20180813/org/newdawn/slick/imageout/ImageOut.class new file mode 100644 index 0000000..bde65ad Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/imageout/ImageOut.class differ diff --git a/lib/json-20180813/org/newdawn/slick/imageout/ImageWriter.class b/lib/json-20180813/org/newdawn/slick/imageout/ImageWriter.class new file mode 100644 index 0000000..60f557a Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/imageout/ImageWriter.class differ diff --git a/lib/json-20180813/org/newdawn/slick/imageout/ImageWriterFactory.class b/lib/json-20180813/org/newdawn/slick/imageout/ImageWriterFactory.class new file mode 100644 index 0000000..681e3b2 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/imageout/ImageWriterFactory.class differ diff --git a/lib/json-20180813/org/newdawn/slick/imageout/TGAWriter.class b/lib/json-20180813/org/newdawn/slick/imageout/TGAWriter.class new file mode 100644 index 0000000..205ed18 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/imageout/TGAWriter.class differ diff --git a/lib/json-20180813/org/newdawn/slick/loading/DeferredResource.class b/lib/json-20180813/org/newdawn/slick/loading/DeferredResource.class new file mode 100644 index 0000000..73f68d6 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/loading/DeferredResource.class differ diff --git a/lib/json-20180813/org/newdawn/slick/loading/LoadingList.class b/lib/json-20180813/org/newdawn/slick/loading/LoadingList.class new file mode 100644 index 0000000..4a4f6f6 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/loading/LoadingList.class differ diff --git a/lib/json-20180813/org/newdawn/slick/muffin/FileMuffin.class b/lib/json-20180813/org/newdawn/slick/muffin/FileMuffin.class new file mode 100644 index 0000000..abdf6eb Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/muffin/FileMuffin.class differ diff --git a/lib/json-20180813/org/newdawn/slick/muffin/Muffin.class b/lib/json-20180813/org/newdawn/slick/muffin/Muffin.class new file mode 100644 index 0000000..ee01ade Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/muffin/Muffin.class differ diff --git a/lib/json-20180813/org/newdawn/slick/muffin/WebstartMuffin.class b/lib/json-20180813/org/newdawn/slick/muffin/WebstartMuffin.class new file mode 100644 index 0000000..cd20a59 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/muffin/WebstartMuffin.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/AiffData.class b/lib/json-20180813/org/newdawn/slick/openal/AiffData.class new file mode 100644 index 0000000..2996f35 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/AiffData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/Audio.class b/lib/json-20180813/org/newdawn/slick/openal/Audio.class new file mode 100644 index 0000000..4c82091 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/Audio.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/AudioImpl.class b/lib/json-20180813/org/newdawn/slick/openal/AudioImpl.class new file mode 100644 index 0000000..38b3f43 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/AudioImpl.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/AudioInputStream.class b/lib/json-20180813/org/newdawn/slick/openal/AudioInputStream.class new file mode 100644 index 0000000..5338b1c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/AudioInputStream.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/AudioLoader.class b/lib/json-20180813/org/newdawn/slick/openal/AudioLoader.class new file mode 100644 index 0000000..9b54214 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/AudioLoader.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/DeferredSound.class b/lib/json-20180813/org/newdawn/slick/openal/DeferredSound.class new file mode 100644 index 0000000..d9924bb Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/DeferredSound.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/MODSound.class b/lib/json-20180813/org/newdawn/slick/openal/MODSound.class new file mode 100644 index 0000000..2a9116e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/MODSound.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/NullAudio.class b/lib/json-20180813/org/newdawn/slick/openal/NullAudio.class new file mode 100644 index 0000000..13142e8 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/NullAudio.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/OggData.class b/lib/json-20180813/org/newdawn/slick/openal/OggData.class new file mode 100644 index 0000000..4076b7c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/OggData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/OggDecoder.class b/lib/json-20180813/org/newdawn/slick/openal/OggDecoder.class new file mode 100644 index 0000000..e42f93e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/OggDecoder.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/OggInputStream.class b/lib/json-20180813/org/newdawn/slick/openal/OggInputStream.class new file mode 100644 index 0000000..db01e36 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/OggInputStream.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/OpenALStreamPlayer.class b/lib/json-20180813/org/newdawn/slick/openal/OpenALStreamPlayer.class new file mode 100644 index 0000000..ebe3caf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/OpenALStreamPlayer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/SoundStore$1.class b/lib/json-20180813/org/newdawn/slick/openal/SoundStore$1.class new file mode 100644 index 0000000..b007915 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/SoundStore$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/SoundStore.class b/lib/json-20180813/org/newdawn/slick/openal/SoundStore.class new file mode 100644 index 0000000..235ae9a Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/SoundStore.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/StreamSound.class b/lib/json-20180813/org/newdawn/slick/openal/StreamSound.class new file mode 100644 index 0000000..62bb3b9 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/StreamSound.class differ diff --git a/lib/json-20180813/org/newdawn/slick/openal/WaveData.class b/lib/json-20180813/org/newdawn/slick/openal/WaveData.class new file mode 100644 index 0000000..310e77b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/openal/WaveData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/CompositeIOException.class b/lib/json-20180813/org/newdawn/slick/opengl/CompositeIOException.class new file mode 100644 index 0000000..755656d Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/CompositeIOException.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/CompositeImageData.class b/lib/json-20180813/org/newdawn/slick/opengl/CompositeImageData.class new file mode 100644 index 0000000..da2a764 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/CompositeImageData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/CursorLoader.class b/lib/json-20180813/org/newdawn/slick/opengl/CursorLoader.class new file mode 100644 index 0000000..53cefc0 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/CursorLoader.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/DeferredTexture.class b/lib/json-20180813/org/newdawn/slick/opengl/DeferredTexture.class new file mode 100644 index 0000000..f1fc143 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/DeferredTexture.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/EmptyImageData.class b/lib/json-20180813/org/newdawn/slick/opengl/EmptyImageData.class new file mode 100644 index 0000000..d9e62a6 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/EmptyImageData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/GLUtils.class b/lib/json-20180813/org/newdawn/slick/opengl/GLUtils.class new file mode 100644 index 0000000..c3e4d15 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/GLUtils.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/ImageData.class b/lib/json-20180813/org/newdawn/slick/opengl/ImageData.class new file mode 100644 index 0000000..2d5c53c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/ImageData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/ImageDataFactory$1.class b/lib/json-20180813/org/newdawn/slick/opengl/ImageDataFactory$1.class new file mode 100644 index 0000000..c3a4d04 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/ImageDataFactory$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/ImageDataFactory.class b/lib/json-20180813/org/newdawn/slick/opengl/ImageDataFactory.class new file mode 100644 index 0000000..2aecafb Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/ImageDataFactory.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/ImageIOImageData.class b/lib/json-20180813/org/newdawn/slick/opengl/ImageIOImageData.class new file mode 100644 index 0000000..a8ee4b4 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/ImageIOImageData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/InternalTextureLoader.class b/lib/json-20180813/org/newdawn/slick/opengl/InternalTextureLoader.class new file mode 100644 index 0000000..3ff81f8 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/InternalTextureLoader.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/LoadableImageData.class b/lib/json-20180813/org/newdawn/slick/opengl/LoadableImageData.class new file mode 100644 index 0000000..fd1d07a Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/LoadableImageData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/PNGDecoder$1.class b/lib/json-20180813/org/newdawn/slick/opengl/PNGDecoder$1.class new file mode 100644 index 0000000..014ec73 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/PNGDecoder$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/PNGDecoder$Format.class b/lib/json-20180813/org/newdawn/slick/opengl/PNGDecoder$Format.class new file mode 100644 index 0000000..2f0accd Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/PNGDecoder$Format.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/PNGDecoder.class b/lib/json-20180813/org/newdawn/slick/opengl/PNGDecoder.class new file mode 100644 index 0000000..5f757f1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/PNGDecoder.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/PNGImageData.class b/lib/json-20180813/org/newdawn/slick/opengl/PNGImageData.class new file mode 100644 index 0000000..0632e4a Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/PNGImageData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/SlickCallable.class b/lib/json-20180813/org/newdawn/slick/opengl/SlickCallable.class new file mode 100644 index 0000000..01f2662 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/SlickCallable.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/TGAImageData.class b/lib/json-20180813/org/newdawn/slick/opengl/TGAImageData.class new file mode 100644 index 0000000..d930798 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/TGAImageData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/Texture.class b/lib/json-20180813/org/newdawn/slick/opengl/Texture.class new file mode 100644 index 0000000..67e6552 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/Texture.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/TextureImpl$1.class b/lib/json-20180813/org/newdawn/slick/opengl/TextureImpl$1.class new file mode 100644 index 0000000..f748110 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/TextureImpl$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/TextureImpl$ReloadData.class b/lib/json-20180813/org/newdawn/slick/opengl/TextureImpl$ReloadData.class new file mode 100644 index 0000000..86d76f7 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/TextureImpl$ReloadData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/TextureImpl.class b/lib/json-20180813/org/newdawn/slick/opengl/TextureImpl.class new file mode 100644 index 0000000..6b8e0db Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/TextureImpl.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/TextureLoader.class b/lib/json-20180813/org/newdawn/slick/opengl/TextureLoader.class new file mode 100644 index 0000000..247f6cf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/TextureLoader.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/pbuffer/FBOGraphics.class b/lib/json-20180813/org/newdawn/slick/opengl/pbuffer/FBOGraphics.class new file mode 100644 index 0000000..831630d Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/pbuffer/FBOGraphics.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/pbuffer/GraphicsFactory.class b/lib/json-20180813/org/newdawn/slick/opengl/pbuffer/GraphicsFactory.class new file mode 100644 index 0000000..a11e058 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/pbuffer/GraphicsFactory.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/pbuffer/PBufferGraphics.class b/lib/json-20180813/org/newdawn/slick/opengl/pbuffer/PBufferGraphics.class new file mode 100644 index 0000000..fccd719 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/pbuffer/PBufferGraphics.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/pbuffer/PBufferUniqueGraphics.class b/lib/json-20180813/org/newdawn/slick/opengl/pbuffer/PBufferUniqueGraphics.class new file mode 100644 index 0000000..9074d6d Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/pbuffer/PBufferUniqueGraphics.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/renderer/DefaultLineStripRenderer.class b/lib/json-20180813/org/newdawn/slick/opengl/renderer/DefaultLineStripRenderer.class new file mode 100644 index 0000000..023777d Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/renderer/DefaultLineStripRenderer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/renderer/ImmediateModeOGLRenderer.class b/lib/json-20180813/org/newdawn/slick/opengl/renderer/ImmediateModeOGLRenderer.class new file mode 100644 index 0000000..0c6f408 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/renderer/ImmediateModeOGLRenderer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/renderer/LineStripRenderer.class b/lib/json-20180813/org/newdawn/slick/opengl/renderer/LineStripRenderer.class new file mode 100644 index 0000000..70f8052 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/renderer/LineStripRenderer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/renderer/QuadBasedLineStripRenderer.class b/lib/json-20180813/org/newdawn/slick/opengl/renderer/QuadBasedLineStripRenderer.class new file mode 100644 index 0000000..76ca6c4 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/renderer/QuadBasedLineStripRenderer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/renderer/Renderer.class b/lib/json-20180813/org/newdawn/slick/opengl/renderer/Renderer.class new file mode 100644 index 0000000..6fc4d0d Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/renderer/Renderer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/renderer/SGL.class b/lib/json-20180813/org/newdawn/slick/opengl/renderer/SGL.class new file mode 100644 index 0000000..a151ac5 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/renderer/SGL.class differ diff --git a/lib/json-20180813/org/newdawn/slick/opengl/renderer/VAOGLRenderer.class b/lib/json-20180813/org/newdawn/slick/opengl/renderer/VAOGLRenderer.class new file mode 100644 index 0000000..c827ed5 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/opengl/renderer/VAOGLRenderer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$1.class b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$1.class new file mode 100644 index 0000000..7891245 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$ColorRecord.class b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$ColorRecord.class new file mode 100644 index 0000000..5a47cc3 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$ColorRecord.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$LinearInterpolator.class b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$LinearInterpolator.class new file mode 100644 index 0000000..cb1eac5 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$LinearInterpolator.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$RandomValue.class b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$RandomValue.class new file mode 100644 index 0000000..cc79b8c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$RandomValue.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$Range.class b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$Range.class new file mode 100644 index 0000000..32d68be Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$Range.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$SimpleValue.class b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$SimpleValue.class new file mode 100644 index 0000000..2d93b6f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$SimpleValue.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$Value.class b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$Value.class new file mode 100644 index 0000000..5f15e4f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter$Value.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter.class b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter.class new file mode 100644 index 0000000..a2ac142 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitter.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitterFactory.class b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitterFactory.class new file mode 100644 index 0000000..7583218 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ConfigurableEmitterFactory.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/Particle.class b/lib/json-20180813/org/newdawn/slick/particles/Particle.class new file mode 100644 index 0000000..ef0a6cb Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/Particle.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ParticleEmitter.class b/lib/json-20180813/org/newdawn/slick/particles/ParticleEmitter.class new file mode 100644 index 0000000..6e6b753 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ParticleEmitter.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ParticleIO$1.class b/lib/json-20180813/org/newdawn/slick/particles/ParticleIO$1.class new file mode 100644 index 0000000..155a3be Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ParticleIO$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ParticleIO$2.class b/lib/json-20180813/org/newdawn/slick/particles/ParticleIO$2.class new file mode 100644 index 0000000..b2cb434 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ParticleIO$2.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ParticleIO.class b/lib/json-20180813/org/newdawn/slick/particles/ParticleIO.class new file mode 100644 index 0000000..6f424ca Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ParticleIO.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ParticleSystem$1.class b/lib/json-20180813/org/newdawn/slick/particles/ParticleSystem$1.class new file mode 100644 index 0000000..ff4d4ab Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ParticleSystem$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ParticleSystem$ParticlePool.class b/lib/json-20180813/org/newdawn/slick/particles/ParticleSystem$ParticlePool.class new file mode 100644 index 0000000..613e408 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ParticleSystem$ParticlePool.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/ParticleSystem.class b/lib/json-20180813/org/newdawn/slick/particles/ParticleSystem.class new file mode 100644 index 0000000..ca01bbf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/ParticleSystem.class differ diff --git a/lib/json-20180813/org/newdawn/slick/particles/effects/FireEmitter.class b/lib/json-20180813/org/newdawn/slick/particles/effects/FireEmitter.class new file mode 100644 index 0000000..21b7cdf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/particles/effects/FireEmitter.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/BasicGameState.class b/lib/json-20180813/org/newdawn/slick/state/BasicGameState.class new file mode 100644 index 0000000..833bc14 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/BasicGameState.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/GameState.class b/lib/json-20180813/org/newdawn/slick/state/GameState.class new file mode 100644 index 0000000..92cc278 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/GameState.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/StateBasedGame$1.class b/lib/json-20180813/org/newdawn/slick/state/StateBasedGame$1.class new file mode 100644 index 0000000..48e4639 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/StateBasedGame$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/StateBasedGame.class b/lib/json-20180813/org/newdawn/slick/state/StateBasedGame.class new file mode 100644 index 0000000..7d71c96 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/StateBasedGame.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/transition/BlobbyTransition$Blob.class b/lib/json-20180813/org/newdawn/slick/state/transition/BlobbyTransition$Blob.class new file mode 100644 index 0000000..467635e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/transition/BlobbyTransition$Blob.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/transition/BlobbyTransition.class b/lib/json-20180813/org/newdawn/slick/state/transition/BlobbyTransition.class new file mode 100644 index 0000000..b7b737e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/transition/BlobbyTransition.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/transition/CombinedTransition.class b/lib/json-20180813/org/newdawn/slick/state/transition/CombinedTransition.class new file mode 100644 index 0000000..5892063 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/transition/CombinedTransition.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/transition/CrossStateTransition.class b/lib/json-20180813/org/newdawn/slick/state/transition/CrossStateTransition.class new file mode 100644 index 0000000..e21c6d1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/transition/CrossStateTransition.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/transition/EmptyTransition.class b/lib/json-20180813/org/newdawn/slick/state/transition/EmptyTransition.class new file mode 100644 index 0000000..458a0bc Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/transition/EmptyTransition.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/transition/FadeInTransition.class b/lib/json-20180813/org/newdawn/slick/state/transition/FadeInTransition.class new file mode 100644 index 0000000..fb940ea Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/transition/FadeInTransition.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/transition/FadeOutTransition.class b/lib/json-20180813/org/newdawn/slick/state/transition/FadeOutTransition.class new file mode 100644 index 0000000..dc11710 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/transition/FadeOutTransition.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/transition/HorizontalSplitTransition.class b/lib/json-20180813/org/newdawn/slick/state/transition/HorizontalSplitTransition.class new file mode 100644 index 0000000..8f4e2bf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/transition/HorizontalSplitTransition.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/transition/RotateTransition.class b/lib/json-20180813/org/newdawn/slick/state/transition/RotateTransition.class new file mode 100644 index 0000000..3ca7698 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/transition/RotateTransition.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/transition/SelectTransition.class b/lib/json-20180813/org/newdawn/slick/state/transition/SelectTransition.class new file mode 100644 index 0000000..d339ddd Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/transition/SelectTransition.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/transition/Transition.class b/lib/json-20180813/org/newdawn/slick/state/transition/Transition.class new file mode 100644 index 0000000..bf3721f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/transition/Transition.class differ diff --git a/lib/json-20180813/org/newdawn/slick/state/transition/VerticalSplitTransition.class b/lib/json-20180813/org/newdawn/slick/state/transition/VerticalSplitTransition.class new file mode 100644 index 0000000..18391b2 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/state/transition/VerticalSplitTransition.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/Diagram.class b/lib/json-20180813/org/newdawn/slick/svg/Diagram.class new file mode 100644 index 0000000..ed59138 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/Diagram.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/Figure.class b/lib/json-20180813/org/newdawn/slick/svg/Figure.class new file mode 100644 index 0000000..b4bd439 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/Figure.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/Gradient$Step.class b/lib/json-20180813/org/newdawn/slick/svg/Gradient$Step.class new file mode 100644 index 0000000..4fa4d94 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/Gradient$Step.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/Gradient.class b/lib/json-20180813/org/newdawn/slick/svg/Gradient.class new file mode 100644 index 0000000..006ede0 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/Gradient.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/InkscapeLoader$1.class b/lib/json-20180813/org/newdawn/slick/svg/InkscapeLoader$1.class new file mode 100644 index 0000000..5bd9b0b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/InkscapeLoader$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/InkscapeLoader.class b/lib/json-20180813/org/newdawn/slick/svg/InkscapeLoader.class new file mode 100644 index 0000000..4bb5a07 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/InkscapeLoader.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/LinearGradientFill.class b/lib/json-20180813/org/newdawn/slick/svg/LinearGradientFill.class new file mode 100644 index 0000000..e0afff8 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/LinearGradientFill.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/Loader.class b/lib/json-20180813/org/newdawn/slick/svg/Loader.class new file mode 100644 index 0000000..a8441f6 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/Loader.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/NonGeometricData.class b/lib/json-20180813/org/newdawn/slick/svg/NonGeometricData.class new file mode 100644 index 0000000..b5aff32 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/NonGeometricData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/ParsingException.class b/lib/json-20180813/org/newdawn/slick/svg/ParsingException.class new file mode 100644 index 0000000..0c0ee92 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/ParsingException.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/RadialGradientFill.class b/lib/json-20180813/org/newdawn/slick/svg/RadialGradientFill.class new file mode 100644 index 0000000..3124d76 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/RadialGradientFill.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/SVGMorph.class b/lib/json-20180813/org/newdawn/slick/svg/SVGMorph.class new file mode 100644 index 0000000..b48d586 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/SVGMorph.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/SimpleDiagramRenderer.class b/lib/json-20180813/org/newdawn/slick/svg/SimpleDiagramRenderer.class new file mode 100644 index 0000000..0325e3d Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/SimpleDiagramRenderer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/inkscape/DefsProcessor.class b/lib/json-20180813/org/newdawn/slick/svg/inkscape/DefsProcessor.class new file mode 100644 index 0000000..74f977c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/inkscape/DefsProcessor.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/inkscape/ElementProcessor.class b/lib/json-20180813/org/newdawn/slick/svg/inkscape/ElementProcessor.class new file mode 100644 index 0000000..20897b7 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/inkscape/ElementProcessor.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/inkscape/EllipseProcessor.class b/lib/json-20180813/org/newdawn/slick/svg/inkscape/EllipseProcessor.class new file mode 100644 index 0000000..91537a5 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/inkscape/EllipseProcessor.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/inkscape/GroupProcessor.class b/lib/json-20180813/org/newdawn/slick/svg/inkscape/GroupProcessor.class new file mode 100644 index 0000000..f47724e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/inkscape/GroupProcessor.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/inkscape/InkscapeNonGeometricData.class b/lib/json-20180813/org/newdawn/slick/svg/inkscape/InkscapeNonGeometricData.class new file mode 100644 index 0000000..4ab9bb6 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/inkscape/InkscapeNonGeometricData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/inkscape/LineProcessor.class b/lib/json-20180813/org/newdawn/slick/svg/inkscape/LineProcessor.class new file mode 100644 index 0000000..5a39e8b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/inkscape/LineProcessor.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/inkscape/PathProcessor.class b/lib/json-20180813/org/newdawn/slick/svg/inkscape/PathProcessor.class new file mode 100644 index 0000000..291cf2d Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/inkscape/PathProcessor.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/inkscape/PolygonProcessor.class b/lib/json-20180813/org/newdawn/slick/svg/inkscape/PolygonProcessor.class new file mode 100644 index 0000000..bde51b1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/inkscape/PolygonProcessor.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/inkscape/RectProcessor.class b/lib/json-20180813/org/newdawn/slick/svg/inkscape/RectProcessor.class new file mode 100644 index 0000000..9dab1f3 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/inkscape/RectProcessor.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/inkscape/UseProcessor.class b/lib/json-20180813/org/newdawn/slick/svg/inkscape/UseProcessor.class new file mode 100644 index 0000000..3855ff6 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/inkscape/UseProcessor.class differ diff --git a/lib/json-20180813/org/newdawn/slick/svg/inkscape/Util.class b/lib/json-20180813/org/newdawn/slick/svg/inkscape/Util.class new file mode 100644 index 0000000..5a9030b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/svg/inkscape/Util.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/AlphaMapTest.class b/lib/json-20180813/org/newdawn/slick/tests/AlphaMapTest.class new file mode 100644 index 0000000..5dfb8f9 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/AlphaMapTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/AnimationTest.class b/lib/json-20180813/org/newdawn/slick/tests/AnimationTest.class new file mode 100644 index 0000000..ac41aa0 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/AnimationTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/AntiAliasTest.class b/lib/json-20180813/org/newdawn/slick/tests/AntiAliasTest.class new file mode 100644 index 0000000..ee9cd87 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/AntiAliasTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/BigImageTest.class b/lib/json-20180813/org/newdawn/slick/tests/BigImageTest.class new file mode 100644 index 0000000..c9cb530 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/BigImageTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/BigSpriteSheetTest.class b/lib/json-20180813/org/newdawn/slick/tests/BigSpriteSheetTest.class new file mode 100644 index 0000000..3da68b6 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/BigSpriteSheetTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/CachedRenderTest$1.class b/lib/json-20180813/org/newdawn/slick/tests/CachedRenderTest$1.class new file mode 100644 index 0000000..526901f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/CachedRenderTest$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/CachedRenderTest.class b/lib/json-20180813/org/newdawn/slick/tests/CachedRenderTest.class new file mode 100644 index 0000000..c796b43 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/CachedRenderTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/CanvasContainerTest$1.class b/lib/json-20180813/org/newdawn/slick/tests/CanvasContainerTest$1.class new file mode 100644 index 0000000..890cfc1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/CanvasContainerTest$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/CanvasContainerTest.class b/lib/json-20180813/org/newdawn/slick/tests/CanvasContainerTest.class new file mode 100644 index 0000000..ddb5ec5 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/CanvasContainerTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/CanvasSizeTest$1.class b/lib/json-20180813/org/newdawn/slick/tests/CanvasSizeTest$1.class new file mode 100644 index 0000000..3c6a5f6 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/CanvasSizeTest$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/CanvasSizeTest.class b/lib/json-20180813/org/newdawn/slick/tests/CanvasSizeTest.class new file mode 100644 index 0000000..53a5b52 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/CanvasSizeTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ClipTest.class b/lib/json-20180813/org/newdawn/slick/tests/ClipTest.class new file mode 100644 index 0000000..897b737 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ClipTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/CopyAreaAlphaTest.class b/lib/json-20180813/org/newdawn/slick/tests/CopyAreaAlphaTest.class new file mode 100644 index 0000000..f4b6730 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/CopyAreaAlphaTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/CurveTest.class b/lib/json-20180813/org/newdawn/slick/tests/CurveTest.class new file mode 100644 index 0000000..8bba76c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/CurveTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/DeferredLoadingTest.class b/lib/json-20180813/org/newdawn/slick/tests/DeferredLoadingTest.class new file mode 100644 index 0000000..1327fde Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/DeferredLoadingTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/DistanceFieldTest.class b/lib/json-20180813/org/newdawn/slick/tests/DistanceFieldTest.class new file mode 100644 index 0000000..5be8b68 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/DistanceFieldTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/DoubleClickTest.class b/lib/json-20180813/org/newdawn/slick/tests/DoubleClickTest.class new file mode 100644 index 0000000..6b53b01 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/DoubleClickTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/DuplicateEmitterTest.class b/lib/json-20180813/org/newdawn/slick/tests/DuplicateEmitterTest.class new file mode 100644 index 0000000..7e90847 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/DuplicateEmitterTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/FlashTest.class b/lib/json-20180813/org/newdawn/slick/tests/FlashTest.class new file mode 100644 index 0000000..08f3a81 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/FlashTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/FontPerformanceTest.class b/lib/json-20180813/org/newdawn/slick/tests/FontPerformanceTest.class new file mode 100644 index 0000000..87ceb9a Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/FontPerformanceTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/FontTest.class b/lib/json-20180813/org/newdawn/slick/tests/FontTest.class new file mode 100644 index 0000000..9f4d9f1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/FontTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/GUITest$1.class b/lib/json-20180813/org/newdawn/slick/tests/GUITest$1.class new file mode 100644 index 0000000..285fd47 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/GUITest$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/GUITest$2.class b/lib/json-20180813/org/newdawn/slick/tests/GUITest$2.class new file mode 100644 index 0000000..dd566f0 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/GUITest$2.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/GUITest.class b/lib/json-20180813/org/newdawn/slick/tests/GUITest.class new file mode 100644 index 0000000..70280d2 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/GUITest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/GeomAccuracyTest.class b/lib/json-20180813/org/newdawn/slick/tests/GeomAccuracyTest.class new file mode 100644 index 0000000..2c6d58e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/GeomAccuracyTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/GeomTest.class b/lib/json-20180813/org/newdawn/slick/tests/GeomTest.class new file mode 100644 index 0000000..e6b5ac3 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/GeomTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/GeomUtilTest.class b/lib/json-20180813/org/newdawn/slick/tests/GeomUtilTest.class new file mode 100644 index 0000000..aa7cd80 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/GeomUtilTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/GeomUtilTileTest.class b/lib/json-20180813/org/newdawn/slick/tests/GeomUtilTileTest.class new file mode 100644 index 0000000..f3a74d1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/GeomUtilTileTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/GradientImageTest.class b/lib/json-20180813/org/newdawn/slick/tests/GradientImageTest.class new file mode 100644 index 0000000..aef9ecf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/GradientImageTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/GradientTest.class b/lib/json-20180813/org/newdawn/slick/tests/GradientTest.class new file mode 100644 index 0000000..af497b6 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/GradientTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/GraphicsTest.class b/lib/json-20180813/org/newdawn/slick/tests/GraphicsTest.class new file mode 100644 index 0000000..8c221c3 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/GraphicsTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ImageBufferEndianTest.class b/lib/json-20180813/org/newdawn/slick/tests/ImageBufferEndianTest.class new file mode 100644 index 0000000..2811ace Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ImageBufferEndianTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ImageBufferTest.class b/lib/json-20180813/org/newdawn/slick/tests/ImageBufferTest.class new file mode 100644 index 0000000..3a05e42 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ImageBufferTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ImageCornerTest.class b/lib/json-20180813/org/newdawn/slick/tests/ImageCornerTest.class new file mode 100644 index 0000000..eab9f04 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ImageCornerTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ImageGraphicsTest.class b/lib/json-20180813/org/newdawn/slick/tests/ImageGraphicsTest.class new file mode 100644 index 0000000..5052a51 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ImageGraphicsTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ImageMemTest.class b/lib/json-20180813/org/newdawn/slick/tests/ImageMemTest.class new file mode 100644 index 0000000..e277bcd Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ImageMemTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ImageOutTest.class b/lib/json-20180813/org/newdawn/slick/tests/ImageOutTest.class new file mode 100644 index 0000000..31dbf21 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ImageOutTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ImageReadTest.class b/lib/json-20180813/org/newdawn/slick/tests/ImageReadTest.class new file mode 100644 index 0000000..af33c63 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ImageReadTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ImageTest.class b/lib/json-20180813/org/newdawn/slick/tests/ImageTest.class new file mode 100644 index 0000000..5a6691f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ImageTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/InkscapeTest.class b/lib/json-20180813/org/newdawn/slick/tests/InkscapeTest.class new file mode 100644 index 0000000..cdf5566 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/InkscapeTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/InputProviderTest.class b/lib/json-20180813/org/newdawn/slick/tests/InputProviderTest.class new file mode 100644 index 0000000..53a3d47 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/InputProviderTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/InputTest$Line.class b/lib/json-20180813/org/newdawn/slick/tests/InputTest$Line.class new file mode 100644 index 0000000..1310141 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/InputTest$Line.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/InputTest.class b/lib/json-20180813/org/newdawn/slick/tests/InputTest.class new file mode 100644 index 0000000..a929c9a Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/InputTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/IsoTiledTest.class b/lib/json-20180813/org/newdawn/slick/tests/IsoTiledTest.class new file mode 100644 index 0000000..47178d8 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/IsoTiledTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/KeyRepeatTest.class b/lib/json-20180813/org/newdawn/slick/tests/KeyRepeatTest.class new file mode 100644 index 0000000..1c52c8f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/KeyRepeatTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/LameTest.class b/lib/json-20180813/org/newdawn/slick/tests/LameTest.class new file mode 100644 index 0000000..a100030 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/LameTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/LineRenderTest.class b/lib/json-20180813/org/newdawn/slick/tests/LineRenderTest.class new file mode 100644 index 0000000..3158116 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/LineRenderTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/MorphSVGTest.class b/lib/json-20180813/org/newdawn/slick/tests/MorphSVGTest.class new file mode 100644 index 0000000..495c06a Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/MorphSVGTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/MorphShapeTest.class b/lib/json-20180813/org/newdawn/slick/tests/MorphShapeTest.class new file mode 100644 index 0000000..10d33c8 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/MorphShapeTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/MusicListenerTest.class b/lib/json-20180813/org/newdawn/slick/tests/MusicListenerTest.class new file mode 100644 index 0000000..0e668bf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/MusicListenerTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/NavMeshTest$DataMap.class b/lib/json-20180813/org/newdawn/slick/tests/NavMeshTest$DataMap.class new file mode 100644 index 0000000..78fdea4 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/NavMeshTest$DataMap.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/NavMeshTest.class b/lib/json-20180813/org/newdawn/slick/tests/NavMeshTest.class new file mode 100644 index 0000000..39e7973 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/NavMeshTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/PackedSheetTest.class b/lib/json-20180813/org/newdawn/slick/tests/PackedSheetTest.class new file mode 100644 index 0000000..0ad0b12 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/PackedSheetTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ParticleTest.class b/lib/json-20180813/org/newdawn/slick/tests/ParticleTest.class new file mode 100644 index 0000000..7ee54ee Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ParticleTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/PedigreeTest.class b/lib/json-20180813/org/newdawn/slick/tests/PedigreeTest.class new file mode 100644 index 0000000..0fa918c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/PedigreeTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/PolygonTest.class b/lib/json-20180813/org/newdawn/slick/tests/PolygonTest.class new file mode 100644 index 0000000..cf20ecf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/PolygonTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/PureFontTest.class b/lib/json-20180813/org/newdawn/slick/tests/PureFontTest.class new file mode 100644 index 0000000..aae159e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/PureFontTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/SavedStateTest.class b/lib/json-20180813/org/newdawn/slick/tests/SavedStateTest.class new file mode 100644 index 0000000..86c9fca Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/SavedStateTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ScalableTest$1.class b/lib/json-20180813/org/newdawn/slick/tests/ScalableTest$1.class new file mode 100644 index 0000000..218a88c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ScalableTest$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ScalableTest.class b/lib/json-20180813/org/newdawn/slick/tests/ScalableTest.class new file mode 100644 index 0000000..d2b1283 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ScalableTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/ShapeTest.class b/lib/json-20180813/org/newdawn/slick/tests/ShapeTest.class new file mode 100644 index 0000000..8943100 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/ShapeTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/SlickCallableTest$1.class b/lib/json-20180813/org/newdawn/slick/tests/SlickCallableTest$1.class new file mode 100644 index 0000000..5380d66 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/SlickCallableTest$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/SlickCallableTest.class b/lib/json-20180813/org/newdawn/slick/tests/SlickCallableTest.class new file mode 100644 index 0000000..f6c121b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/SlickCallableTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/SoundPositionTest.class b/lib/json-20180813/org/newdawn/slick/tests/SoundPositionTest.class new file mode 100644 index 0000000..22598d4 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/SoundPositionTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/SoundTest.class b/lib/json-20180813/org/newdawn/slick/tests/SoundTest.class new file mode 100644 index 0000000..e792cbf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/SoundTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/SoundURLTest.class b/lib/json-20180813/org/newdawn/slick/tests/SoundURLTest.class new file mode 100644 index 0000000..9b9d1ed Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/SoundURLTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/SpriteSheetFontTest.class b/lib/json-20180813/org/newdawn/slick/tests/SpriteSheetFontTest.class new file mode 100644 index 0000000..d5c75c1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/SpriteSheetFontTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/StateBasedTest.class b/lib/json-20180813/org/newdawn/slick/tests/StateBasedTest.class new file mode 100644 index 0000000..e95a8c1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/StateBasedTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/TestBox$1.class b/lib/json-20180813/org/newdawn/slick/tests/TestBox$1.class new file mode 100644 index 0000000..4273772 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/TestBox$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/TestBox.class b/lib/json-20180813/org/newdawn/slick/tests/TestBox.class new file mode 100644 index 0000000..8c3636b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/TestBox.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/TestUtils.class b/lib/json-20180813/org/newdawn/slick/tests/TestUtils.class new file mode 100644 index 0000000..f0bc087 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/TestUtils.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/TexturePaintTest$1.class b/lib/json-20180813/org/newdawn/slick/tests/TexturePaintTest$1.class new file mode 100644 index 0000000..7ca1259 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/TexturePaintTest$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/TexturePaintTest.class b/lib/json-20180813/org/newdawn/slick/tests/TexturePaintTest.class new file mode 100644 index 0000000..70f60b7 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/TexturePaintTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/TileMapTest.class b/lib/json-20180813/org/newdawn/slick/tests/TileMapTest.class new file mode 100644 index 0000000..efcdc08 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/TileMapTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/TransformTest.class b/lib/json-20180813/org/newdawn/slick/tests/TransformTest.class new file mode 100644 index 0000000..6bc1b11 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/TransformTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/TransformTest2.class b/lib/json-20180813/org/newdawn/slick/tests/TransformTest2.class new file mode 100644 index 0000000..787ac4d Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/TransformTest2.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/TransitionTest$ImageState.class b/lib/json-20180813/org/newdawn/slick/tests/TransitionTest$ImageState.class new file mode 100644 index 0000000..204608e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/TransitionTest$ImageState.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/TransitionTest.class b/lib/json-20180813/org/newdawn/slick/tests/TransitionTest.class new file mode 100644 index 0000000..6aa5650 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/TransitionTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/TransparentColorTest.class b/lib/json-20180813/org/newdawn/slick/tests/TransparentColorTest.class new file mode 100644 index 0000000..306584e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/TransparentColorTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/TrueTypeFontPerformanceTest.class b/lib/json-20180813/org/newdawn/slick/tests/TrueTypeFontPerformanceTest.class new file mode 100644 index 0000000..96fe4dc Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/TrueTypeFontPerformanceTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/UnicodeFontTest.class b/lib/json-20180813/org/newdawn/slick/tests/UnicodeFontTest.class new file mode 100644 index 0000000..ef8164f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/UnicodeFontTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/states/TestState1$1.class b/lib/json-20180813/org/newdawn/slick/tests/states/TestState1$1.class new file mode 100644 index 0000000..a71ae62 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/states/TestState1$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/states/TestState1.class b/lib/json-20180813/org/newdawn/slick/tests/states/TestState1.class new file mode 100644 index 0000000..7c9d3aa Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/states/TestState1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/states/TestState2.class b/lib/json-20180813/org/newdawn/slick/tests/states/TestState2.class new file mode 100644 index 0000000..b9d4fdf Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/states/TestState2.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/states/TestState3.class b/lib/json-20180813/org/newdawn/slick/tests/states/TestState3.class new file mode 100644 index 0000000..5220609 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/states/TestState3.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/xml/Entity.class b/lib/json-20180813/org/newdawn/slick/tests/xml/Entity.class new file mode 100644 index 0000000..2556f34 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/xml/Entity.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/xml/GameData.class b/lib/json-20180813/org/newdawn/slick/tests/xml/GameData.class new file mode 100644 index 0000000..dd4c779 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/xml/GameData.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/xml/Inventory.class b/lib/json-20180813/org/newdawn/slick/tests/xml/Inventory.class new file mode 100644 index 0000000..b9f2e6b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/xml/Inventory.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/xml/Item.class b/lib/json-20180813/org/newdawn/slick/tests/xml/Item.class new file mode 100644 index 0000000..d98a377 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/xml/Item.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/xml/ItemContainer.class b/lib/json-20180813/org/newdawn/slick/tests/xml/ItemContainer.class new file mode 100644 index 0000000..6285982 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/xml/ItemContainer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/xml/ObjectParserTest.class b/lib/json-20180813/org/newdawn/slick/tests/xml/ObjectParserTest.class new file mode 100644 index 0000000..7874316 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/xml/ObjectParserTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/xml/Stats.class b/lib/json-20180813/org/newdawn/slick/tests/xml/Stats.class new file mode 100644 index 0000000..17e5669 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/xml/Stats.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tests/xml/XMLTest.class b/lib/json-20180813/org/newdawn/slick/tests/xml/XMLTest.class new file mode 100644 index 0000000..980ce42 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tests/xml/XMLTest.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tiled/Layer.class b/lib/json-20180813/org/newdawn/slick/tiled/Layer.class new file mode 100644 index 0000000..e9ab49c Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tiled/Layer.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tiled/TileSet.class b/lib/json-20180813/org/newdawn/slick/tiled/TileSet.class new file mode 100644 index 0000000..4170667 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tiled/TileSet.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tiled/TiledMap$1.class b/lib/json-20180813/org/newdawn/slick/tiled/TiledMap$1.class new file mode 100644 index 0000000..f3c4ac2 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tiled/TiledMap$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tiled/TiledMap$GroupObject.class b/lib/json-20180813/org/newdawn/slick/tiled/TiledMap$GroupObject.class new file mode 100644 index 0000000..7cc9f2e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tiled/TiledMap$GroupObject.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tiled/TiledMap$ObjectGroup.class b/lib/json-20180813/org/newdawn/slick/tiled/TiledMap$ObjectGroup.class new file mode 100644 index 0000000..19e1907 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tiled/TiledMap$ObjectGroup.class differ diff --git a/lib/json-20180813/org/newdawn/slick/tiled/TiledMap.class b/lib/json-20180813/org/newdawn/slick/tiled/TiledMap.class new file mode 100644 index 0000000..a8a6b8d Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/tiled/TiledMap.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/Bootstrap.class b/lib/json-20180813/org/newdawn/slick/util/Bootstrap.class new file mode 100644 index 0000000..48be4af Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/Bootstrap.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/BufferedImageUtil.class b/lib/json-20180813/org/newdawn/slick/util/BufferedImageUtil.class new file mode 100644 index 0000000..eaf46b6 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/BufferedImageUtil.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/ClasspathLocation.class b/lib/json-20180813/org/newdawn/slick/util/ClasspathLocation.class new file mode 100644 index 0000000..a64812b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/ClasspathLocation.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/DefaultLogSystem.class b/lib/json-20180813/org/newdawn/slick/util/DefaultLogSystem.class new file mode 100644 index 0000000..50c6ab7 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/DefaultLogSystem.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/FastTrig.class b/lib/json-20180813/org/newdawn/slick/util/FastTrig.class new file mode 100644 index 0000000..2c4e0a3 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/FastTrig.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/FileSystemLocation.class b/lib/json-20180813/org/newdawn/slick/util/FileSystemLocation.class new file mode 100644 index 0000000..0e1bee1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/FileSystemLocation.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/FontUtils$Alignment.class b/lib/json-20180813/org/newdawn/slick/util/FontUtils$Alignment.class new file mode 100644 index 0000000..073b85b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/FontUtils$Alignment.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/FontUtils.class b/lib/json-20180813/org/newdawn/slick/util/FontUtils.class new file mode 100644 index 0000000..0100949 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/FontUtils.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/InputAdapter.class b/lib/json-20180813/org/newdawn/slick/util/InputAdapter.class new file mode 100644 index 0000000..e515986 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/InputAdapter.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/LocatedImage.class b/lib/json-20180813/org/newdawn/slick/util/LocatedImage.class new file mode 100644 index 0000000..81576eb Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/LocatedImage.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/Log$1.class b/lib/json-20180813/org/newdawn/slick/util/Log$1.class new file mode 100644 index 0000000..2b82918 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/Log$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/Log.class b/lib/json-20180813/org/newdawn/slick/util/Log.class new file mode 100644 index 0000000..36d0e6e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/Log.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/LogSystem.class b/lib/json-20180813/org/newdawn/slick/util/LogSystem.class new file mode 100644 index 0000000..29785b4 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/LogSystem.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/MaskUtil.class b/lib/json-20180813/org/newdawn/slick/util/MaskUtil.class new file mode 100644 index 0000000..b661df4 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/MaskUtil.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/OperationNotSupportedException.class b/lib/json-20180813/org/newdawn/slick/util/OperationNotSupportedException.class new file mode 100644 index 0000000..524adf1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/OperationNotSupportedException.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/ResourceLoader.class b/lib/json-20180813/org/newdawn/slick/util/ResourceLoader.class new file mode 100644 index 0000000..afc0dd1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/ResourceLoader.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/ResourceLocation.class b/lib/json-20180813/org/newdawn/slick/util/ResourceLocation.class new file mode 100644 index 0000000..fe91c4e Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/ResourceLocation.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarHeuristic.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarHeuristic.class new file mode 100644 index 0000000..cfc48c1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarHeuristic.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarPathFinder$1.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarPathFinder$1.class new file mode 100644 index 0000000..c4add40 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarPathFinder$1.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarPathFinder$Node.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarPathFinder$Node.class new file mode 100644 index 0000000..323e3b1 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarPathFinder$Node.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarPathFinder$PriorityList.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarPathFinder$PriorityList.class new file mode 100644 index 0000000..621e6d9 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarPathFinder$PriorityList.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarPathFinder.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarPathFinder.class new file mode 100644 index 0000000..17fddb0 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/AStarPathFinder.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/Mover.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/Mover.class new file mode 100644 index 0000000..02f0b93 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/Mover.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/Path$Step.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/Path$Step.class new file mode 100644 index 0000000..ba425f4 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/Path$Step.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/Path.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/Path.class new file mode 100644 index 0000000..1fb3ae5 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/Path.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/PathFinder.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/PathFinder.class new file mode 100644 index 0000000..a9a21fe Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/PathFinder.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/PathFindingContext.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/PathFindingContext.class new file mode 100644 index 0000000..f2eed27 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/PathFindingContext.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/TileBasedMap.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/TileBasedMap.class new file mode 100644 index 0000000..bb28819 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/TileBasedMap.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/heuristics/ClosestHeuristic.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/heuristics/ClosestHeuristic.class new file mode 100644 index 0000000..8447864 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/heuristics/ClosestHeuristic.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/heuristics/ClosestSquaredHeuristic.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/heuristics/ClosestSquaredHeuristic.class new file mode 100644 index 0000000..b502a0f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/heuristics/ClosestSquaredHeuristic.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/heuristics/ManhattanHeuristic.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/heuristics/ManhattanHeuristic.class new file mode 100644 index 0000000..5f2c6aa Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/heuristics/ManhattanHeuristic.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/Link.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/Link.class new file mode 100644 index 0000000..c6650d0 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/Link.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.class new file mode 100644 index 0000000..2c2de5d Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.class new file mode 100644 index 0000000..67015ec Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/NavMeshBuilder.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/NavPath.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/NavPath.class new file mode 100644 index 0000000..566e43b Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/NavPath.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/Space.class b/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/Space.class new file mode 100644 index 0000000..784a930 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/pathfinding/navmesh/Space.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/xml/ObjectTreeParser.class b/lib/json-20180813/org/newdawn/slick/util/xml/ObjectTreeParser.class new file mode 100644 index 0000000..4466c40 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/xml/ObjectTreeParser.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/xml/SlickXMLException.class b/lib/json-20180813/org/newdawn/slick/util/xml/SlickXMLException.class new file mode 100644 index 0000000..bcc2dae Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/xml/SlickXMLException.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/xml/XMLElement.class b/lib/json-20180813/org/newdawn/slick/util/xml/XMLElement.class new file mode 100644 index 0000000..0ac590f Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/xml/XMLElement.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/xml/XMLElementList.class b/lib/json-20180813/org/newdawn/slick/util/xml/XMLElementList.class new file mode 100644 index 0000000..3dd4527 Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/xml/XMLElementList.class differ diff --git a/lib/json-20180813/org/newdawn/slick/util/xml/XMLParser.class b/lib/json-20180813/org/newdawn/slick/util/xml/XMLParser.class new file mode 100644 index 0000000..8a4b57a Binary files /dev/null and b/lib/json-20180813/org/newdawn/slick/util/xml/XMLParser.class differ diff --git a/lib/json-20180813/version b/lib/json-20180813/version new file mode 100644 index 0000000..5dd3872 --- /dev/null +++ b/lib/json-20180813/version @@ -0,0 +1,3 @@ +#Mon, 03 Jun 2013 22:20:24 +0100 +#Sun May 11 20:17:03 BST 2008 +build=237 diff --git a/lib/json-20180813/win-x64/discord-rpc.dll b/lib/json-20180813/win-x64/discord-rpc.dll new file mode 100644 index 0000000..8493c54 Binary files /dev/null and b/lib/json-20180813/win-x64/discord-rpc.dll differ diff --git a/lib/json-20180813/win-x86/discord-rpc.dll b/lib/json-20180813/win-x86/discord-rpc.dll new file mode 100644 index 0000000..88c7d0c Binary files /dev/null and b/lib/json-20180813/win-x86/discord-rpc.dll differ diff --git a/lib/openauth-1.1.2.jar b/lib/openauth-1.1.2.jar new file mode 100644 index 0000000..329d090 Binary files /dev/null and b/lib/openauth-1.1.2.jar differ diff --git a/lib/orgjson.jar b/lib/orgjson.jar new file mode 100644 index 0000000..0b85b0e Binary files /dev/null and b/lib/orgjson.jar differ diff --git a/lib/panelstudio-0.2.1 (1).jar b/lib/panelstudio-0.2.1 (1).jar new file mode 100644 index 0000000..a12828e Binary files /dev/null and b/lib/panelstudio-0.2.1 (1).jar differ diff --git a/lib/procbridge-1.1.1.jar b/lib/procbridge-1.1.1.jar new file mode 100644 index 0000000..a15d73b Binary files /dev/null and b/lib/procbridge-1.1.1.jar differ diff --git a/lib/slick.jar b/lib/slick.jar new file mode 100644 index 0000000..1d3d075 Binary files /dev/null and b/lib/slick.jar differ diff --git a/lib/vecmath-1.2-1.14.jar b/lib/vecmath-1.2-1.14.jar new file mode 100644 index 0000000..bf60357 Binary files /dev/null and b/lib/vecmath-1.2-1.14.jar differ diff --git a/src/EntityRenderer.java b/src/EntityRenderer.java new file mode 100644 index 0000000..12d830f --- /dev/null +++ b/src/EntityRenderer.java @@ -0,0 +1,2836 @@ +package net.minecraft.client.renderer; + +import com.google.common.base.Predicates; +import com.google.gson.JsonSyntaxException; + +import animeware.hud.mod.HudManager; +import animeware.mainmenu.MainMenu; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.nio.FloatBuffer; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Random; +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.gui.GuiDownloadTerrain; +import net.minecraft.client.gui.GuiMainMenu; +import net.minecraft.client.gui.MapItemRenderer; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.particle.EffectRenderer; +import net.minecraft.client.renderer.EntityRenderer1; +import net.minecraft.client.renderer.EntityRenderer2; +import net.minecraft.client.renderer.culling.ClippingHelperImpl; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.shader.ShaderGroup; +import net.minecraft.client.shader.ShaderLinkHelper; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.BossStatus; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.server.integrated.IntegratedServer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MouseFilter; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.biome.BiomeGenBase; +import optifine.Config; +import optifine.CustomColors; +import optifine.Lagometer; +import optifine.RandomMobs; +import optifine.Reflector; +import optifine.ReflectorForge; +import optifine.TextureUtils; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.util.glu.GLU; +import org.lwjgl.util.glu.Project; +import shadersmod.client.Shaders; +import shadersmod.client.ShadersRender; + +public class EntityRenderer implements IResourceManagerReloadListener +{ + private static final Logger logger = LogManager.getLogger(); + private static final ResourceLocation locationRainPng = new ResourceLocation("textures/environment/rain.png"); + private static final ResourceLocation locationSnowPng = new ResourceLocation("textures/environment/snow.png"); + public static boolean anaglyphEnable; + + /** Anaglyph field (0=R, 1=GB) */ + public static int anaglyphField; + + /** A reference to the Minecraft object. */ + private Minecraft mc; + private final IResourceManager resourceManager; + private Random random = new Random(); + private float farPlaneDistance; + public ItemRenderer itemRenderer; + private final MapItemRenderer theMapItemRenderer; + + /** Entity renderer update count */ + private int rendererUpdateCount; + + /** Pointed entity */ + private Entity pointedEntity; + private MouseFilter mouseFilterXAxis = new MouseFilter(); + private MouseFilter mouseFilterYAxis = new MouseFilter(); + private float thirdPersonDistance = 4.0F; + + /** Third person distance temp */ + private float thirdPersonDistanceTemp = 4.0F; + + /** Smooth cam yaw */ + private float smoothCamYaw; + + /** Smooth cam pitch */ + private float smoothCamPitch; + + /** Smooth cam filter X */ + private float smoothCamFilterX; + + /** Smooth cam filter Y */ + private float smoothCamFilterY; + + /** Smooth cam partial ticks */ + private float smoothCamPartialTicks; + + /** FOV modifier hand */ + private float fovModifierHand; + + /** FOV modifier hand prev */ + private float fovModifierHandPrev; + private float bossColorModifier; + private float bossColorModifierPrev; + + /** Cloud fog mode */ + private boolean cloudFog; + private boolean renderHand = true; + private boolean drawBlockOutline = true; + + /** Previous frame time in milliseconds */ + private long prevFrameTime = Minecraft.getSystemTime(); + + /** End time of last render (ns) */ + private long renderEndNanoTime; + + /** + * The texture id of the blocklight/skylight texture used for lighting effects + */ + private final DynamicTexture lightmapTexture; + + /** + * Colors computed in updateLightmap() and loaded into the lightmap emptyTexture + */ + private final int[] lightmapColors; + private final ResourceLocation locationLightMap; + + /** + * Is set, updateCameraAndRender() calls updateLightmap(); set by updateTorchFlicker() + */ + private boolean lightmapUpdateNeeded; + + /** Torch flicker X */ + private float torchFlickerX; + private float torchFlickerDX; + + /** Rain sound counter */ + private int rainSoundCounter; + private float[] rainXCoords = new float[1024]; + private float[] rainYCoords = new float[1024]; + + /** Fog color buffer */ + private FloatBuffer fogColorBuffer = GLAllocation.createDirectFloatBuffer(16); + public float fogColorRed; + public float fogColorGreen; + public float fogColorBlue; + + /** Fog color 2 */ + private float fogColor2; + + /** Fog color 1 */ + private float fogColor1; + private int debugViewDirection = 0; + private boolean debugView = false; + private double cameraZoom = 1.0D; + private double cameraYaw; + private double cameraPitch; + private ShaderGroup theShaderGroup; + private static final ResourceLocation[] shaderResourceLocations = new ResourceLocation[] {new ResourceLocation("shaders/post/notch.json"), new ResourceLocation("shaders/post/fxaa.json"), new ResourceLocation("shaders/post/art.json"), new ResourceLocation("shaders/post/bumpy.json"), new ResourceLocation("shaders/post/blobs2.json"), new ResourceLocation("shaders/post/pencil.json"), new ResourceLocation("shaders/post/color_convolve.json"), new ResourceLocation("shaders/post/deconverge.json"), new ResourceLocation("shaders/post/flip.json"), new ResourceLocation("shaders/post/invert.json"), new ResourceLocation("shaders/post/ntsc.json"), new ResourceLocation("shaders/post/outline.json"), new ResourceLocation("shaders/post/phosphor.json"), new ResourceLocation("shaders/post/scan_pincushion.json"), new ResourceLocation("shaders/post/sobel.json"), new ResourceLocation("shaders/post/bits.json"), new ResourceLocation("shaders/post/desaturate.json"), new ResourceLocation("shaders/post/green.json"), new ResourceLocation("shaders/post/blur.json"), new ResourceLocation("shaders/post/wobble.json"), new ResourceLocation("shaders/post/blobs.json"), new ResourceLocation("shaders/post/antialias.json"), new ResourceLocation("shaders/post/creeper.json"), new ResourceLocation("shaders/post/spider.json")}; + public static final int shaderCount = shaderResourceLocations.length; + private int shaderIndex; + private boolean useShader; + public int frameCount; + private static final String __OBFID = "CL_00000947"; + private boolean initialized = false; + private World updatedWorld = null; + private boolean showDebugInfo = false; + public boolean fogStandard = false; + private float clipDistance = 128.0F; + private long lastServerTime = 0L; + private int lastServerTicks = 0; + private int serverWaitTime = 0; + private int serverWaitTimeCurrent = 0; + private float avgServerTimeDiff = 0.0F; + private float avgServerTickDiff = 0.0F; + private long lastErrorCheckTimeMs = 0L; + private ShaderGroup[] fxaaShaders = new ShaderGroup[10]; + + public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn) + { + this.shaderIndex = shaderCount; + this.useShader = false; + this.frameCount = 0; + this.mc = mcIn; + this.resourceManager = resourceManagerIn; + this.itemRenderer = mcIn.getItemRenderer(); + this.theMapItemRenderer = new MapItemRenderer(mcIn.getTextureManager()); + this.lightmapTexture = new DynamicTexture(16, 16); + this.locationLightMap = mcIn.getTextureManager().getDynamicTextureLocation("lightMap", this.lightmapTexture); + this.lightmapColors = this.lightmapTexture.getTextureData(); + this.theShaderGroup = null; + + for (int i = 0; i < 32; ++i) + { + for (int j = 0; j < 32; ++j) + { + float f = (float)(j - 16); + float f1 = (float)(i - 16); + float f2 = MathHelper.sqrt_float(f * f + f1 * f1); + this.rainXCoords[i << 5 | j] = -f1 / f2; + this.rainYCoords[i << 5 | j] = f / f2; + } + } + } + + public boolean isShaderActive() + { + return OpenGlHelper.shadersSupported && this.theShaderGroup != null; + } + + public void func_181022_b() + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.deleteShaderGroup(); + } + + this.theShaderGroup = null; + this.shaderIndex = shaderCount; + } + + public void switchUseShader() + { + this.useShader = !this.useShader; + } + + /** + * What shader to use when spectating this entity + */ + public void loadEntityShader(Entity entityIn) + { + if (OpenGlHelper.shadersSupported) + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.deleteShaderGroup(); + } + + this.theShaderGroup = null; + + if (entityIn instanceof EntityCreeper) + { + this.loadShader(new ResourceLocation("shaders/post/creeper.json")); + } + else if (entityIn instanceof EntitySpider) + { + this.loadShader(new ResourceLocation("shaders/post/spider.json")); + } + else if (entityIn instanceof EntityEnderman) + { + this.loadShader(new ResourceLocation("shaders/post/invert.json")); + } + else if (Reflector.ForgeHooksClient_loadEntityShader.exists()) + { + Reflector.call(Reflector.ForgeHooksClient_loadEntityShader, new Object[] {entityIn, this}); + } + } + } + + public void activateNextShader() + { + if (OpenGlHelper.shadersSupported && this.mc.getRenderViewEntity() instanceof EntityPlayer) + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.deleteShaderGroup(); + } + + this.shaderIndex = (this.shaderIndex + 1) % (shaderResourceLocations.length + 1); + + if (this.shaderIndex != shaderCount) + { + this.loadShader(shaderResourceLocations[this.shaderIndex]); + } + else + { + this.theShaderGroup = null; + } + } + } + + public void loadShader(ResourceLocation resourceLocationIn) + { + if (OpenGlHelper.isFramebufferEnabled()) + { + try + { + this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), resourceLocationIn); + this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); + this.useShader = true; + } + catch (IOException ioexception) + { + logger.warn((String)("Failed to load shader: " + resourceLocationIn), (Throwable)ioexception); + this.shaderIndex = shaderCount; + this.useShader = false; + } + catch (JsonSyntaxException jsonsyntaxexception) + { + logger.warn((String)("Failed to load shader: " + resourceLocationIn), (Throwable)jsonsyntaxexception); + this.shaderIndex = shaderCount; + this.useShader = false; + } + } + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.deleteShaderGroup(); + } + + this.theShaderGroup = null; + + if (this.shaderIndex != shaderCount) + { + this.loadShader(shaderResourceLocations[this.shaderIndex]); + } + else + { + this.loadEntityShader(this.mc.getRenderViewEntity()); + } + } + + /** + * Updates the entity renderer + */ + public void updateRenderer() + { + if (OpenGlHelper.shadersSupported && ShaderLinkHelper.getStaticShaderLinkHelper() == null) + { + ShaderLinkHelper.setNewStaticShaderLinkHelper(); + } + + this.updateFovModifierHand(); + this.updateTorchFlicker(); + this.fogColor2 = this.fogColor1; + this.thirdPersonDistanceTemp = this.thirdPersonDistance; + + if (this.mc.gameSettings.smoothCamera) + { + float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; + float f1 = f * f * f * 8.0F; + this.smoothCamFilterX = this.mouseFilterXAxis.smooth(this.smoothCamYaw, 0.05F * f1); + this.smoothCamFilterY = this.mouseFilterYAxis.smooth(this.smoothCamPitch, 0.05F * f1); + this.smoothCamPartialTicks = 0.0F; + this.smoothCamYaw = 0.0F; + this.smoothCamPitch = 0.0F; + } + else + { + this.smoothCamFilterX = 0.0F; + this.smoothCamFilterY = 0.0F; + this.mouseFilterXAxis.reset(); + this.mouseFilterYAxis.reset(); + } + + if (this.mc.getRenderViewEntity() == null) + { + this.mc.setRenderViewEntity(this.mc.thePlayer); + } + + Entity entity = this.mc.getRenderViewEntity(); + double d0 = entity.posX; + double d1 = entity.posY + (double)entity.getEyeHeight(); + double d2 = entity.posZ; + float f3 = this.mc.theWorld.getLightBrightness(new BlockPos(d0, d1, d2)); + float f4 = (float)this.mc.gameSettings.renderDistanceChunks / 16.0F; + f4 = MathHelper.clamp_float(f4, 0.0F, 1.0F); + float f2 = f3 * (1.0F - f4) + f4; + this.fogColor1 += (f2 - this.fogColor1) * 0.1F; + ++this.rendererUpdateCount; + this.itemRenderer.updateEquippedItem(); + this.addRainParticles(); + this.bossColorModifierPrev = this.bossColorModifier; + + if (BossStatus.hasColorModifier) + { + this.bossColorModifier += 0.05F; + + if (this.bossColorModifier > 1.0F) + { + this.bossColorModifier = 1.0F; + } + + BossStatus.hasColorModifier = false; + } + else if (this.bossColorModifier > 0.0F) + { + this.bossColorModifier -= 0.0125F; + } + } + + public ShaderGroup getShaderGroup() + { + return this.theShaderGroup; + } + + public void updateShaderGroupSize(int width, int height) + { + if (OpenGlHelper.shadersSupported) + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.createBindFramebuffers(width, height); + } + + this.mc.renderGlobal.createBindEntityOutlineFbs(width, height); + } + } + + /** + * Finds what block or object the mouse is over at the specified partial tick time. Args: partialTickTime + */ + public void getMouseOver(float partialTicks) + { + Entity entity = this.mc.getRenderViewEntity(); + + if (entity != null && this.mc.theWorld != null) + { + this.mc.mcProfiler.startSection("pick"); + this.mc.pointedEntity = null; + double d0 = (double)this.mc.playerController.getBlockReachDistance(); + this.mc.objectMouseOver = entity.rayTrace(d0, partialTicks); + double d1 = d0; + Vec3 vec3 = entity.getPositionEyes(partialTicks); + boolean flag = false; + boolean flag1 = true; + + if (this.mc.playerController.extendedReach()) + { + d0 = 6.0D; + d1 = 6.0D; + } + else + { + if (d0 > 3.0D) + { + flag = true; + } + + d0 = d0; + } + + if (this.mc.objectMouseOver != null) + { + d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3); + } + + Vec3 vec31 = entity.getLook(partialTicks); + Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0); + this.pointedEntity = null; + Vec3 vec33 = null; + float f = 1.0F; + List list = this.mc.theWorld.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand((double)f, (double)f, (double)f), Predicates.and(EntitySelectors.NOT_SPECTATING, new EntityRenderer1(this))); + double d2 = d1; + + for (int i = 0; i < list.size(); ++i) + { + Entity entity1 = (Entity)list.get(i); + float f1 = entity1.getCollisionBorderSize(); + AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand((double)f1, (double)f1, (double)f1); + MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32); + + if (axisalignedbb.isVecInside(vec3)) + { + if (d2 >= 0.0D) + { + this.pointedEntity = entity1; + vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec; + d2 = 0.0D; + } + } + else if (movingobjectposition != null) + { + double d3 = vec3.distanceTo(movingobjectposition.hitVec); + + if (d3 < d2 || d2 == 0.0D) + { + boolean flag2 = false; + + if (Reflector.ForgeEntity_canRiderInteract.exists()) + { + flag2 = Reflector.callBoolean(entity1, Reflector.ForgeEntity_canRiderInteract, new Object[0]); + } + + if (entity1 == entity.ridingEntity && !flag2) + { + if (d2 == 0.0D) + { + this.pointedEntity = entity1; + vec33 = movingobjectposition.hitVec; + } + } + else + { + this.pointedEntity = entity1; + vec33 = movingobjectposition.hitVec; + d2 = d3; + } + } + } + } + + if (this.pointedEntity != null && flag && vec3.distanceTo(vec33) > 3.0D) + { + this.pointedEntity = null; + this.mc.objectMouseOver = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec33, (EnumFacing)null, new BlockPos(vec33)); + } + + if (this.pointedEntity != null && (d2 < d1 || this.mc.objectMouseOver == null)) + { + this.mc.objectMouseOver = new MovingObjectPosition(this.pointedEntity, vec33); + + if (this.pointedEntity instanceof EntityLivingBase || this.pointedEntity instanceof EntityItemFrame) + { + this.mc.pointedEntity = this.pointedEntity; + } + } + + this.mc.mcProfiler.endSection(); + } + } + + /** + * Update FOV modifier hand + */ + private void updateFovModifierHand() + { + float f = 1.0F; + + if (this.mc.getRenderViewEntity() instanceof AbstractClientPlayer) + { + AbstractClientPlayer abstractclientplayer = (AbstractClientPlayer)this.mc.getRenderViewEntity(); + f = abstractclientplayer.getFovModifier(); + } + + this.fovModifierHandPrev = this.fovModifierHand; + this.fovModifierHand += (f - this.fovModifierHand) * 0.5F; + + if (this.fovModifierHand > 1.5F) + { + this.fovModifierHand = 1.5F; + } + + if (this.fovModifierHand < 0.1F) + { + this.fovModifierHand = 0.1F; + } + } + + /** + * Changes the field of view of the player depending on if they are underwater or not + */ + private float getFOVModifier(float partialTicks, boolean p_78481_2_) + { + if (this.debugView) + { + return 90.0F; + } + else + { + Entity entity = this.mc.getRenderViewEntity(); + float f = 70.0F; + + if (p_78481_2_) + { + f = this.mc.gameSettings.fovSetting; + + if (Config.isDynamicFov()) + { + f *= this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks; + } + } + + boolean flag = false; + + if (this.mc.currentScreen == null) + { + GameSettings gamesettings = this.mc.gameSettings; + flag = GameSettings.isKeyDown(this.mc.gameSettings.ofKeyBindZoom); + } + + if (flag) + { + if (!Config.zoomMode) + { + Config.zoomMode = true; + this.mc.gameSettings.smoothCamera = true; + } + + if (Config.zoomMode) + { + f /= 4.0F; + } + } + else if (Config.zoomMode) + { + Config.zoomMode = false; + this.mc.gameSettings.smoothCamera = false; + this.mouseFilterXAxis = new MouseFilter(); + this.mouseFilterYAxis = new MouseFilter(); + this.mc.renderGlobal.displayListEntitiesDirty = true; + } + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getHealth() <= 0.0F) + { + float f1 = (float)((EntityLivingBase)entity).deathTime + partialTicks; + f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F; + } + + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + + if (block.getMaterial() == Material.water) + { + f = f * 60.0F / 70.0F; + } + + return f; + } + } + + private void hurtCameraEffect(float partialTicks) + { + if (this.mc.getRenderViewEntity() instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)this.mc.getRenderViewEntity(); + float f = (float)entitylivingbase.hurtTime - partialTicks; + + if (entitylivingbase.getHealth() <= 0.0F) + { + float f1 = (float)entitylivingbase.deathTime + partialTicks; + GlStateManager.rotate(40.0F - 8000.0F / (f1 + 200.0F), 0.0F, 0.0F, 1.0F); + } + + if (f < 0.0F) + { + return; + } + + f = f / (float)entitylivingbase.maxHurtTime; + f = MathHelper.sin(f * f * f * f * (float)Math.PI); + float f2 = entitylivingbase.attackedAtYaw; + GlStateManager.rotate(-f2, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-f * 14.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(f2, 0.0F, 1.0F, 0.0F); + } + } + + /** + * Setups all the GL settings for view bobbing. Args: partialTickTime + */ + private void setupViewBobbing(float partialTicks) + { + if (this.mc.getRenderViewEntity() instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity(); + float f = entityplayer.distanceWalkedModified - entityplayer.prevDistanceWalkedModified; + float f1 = -(entityplayer.distanceWalkedModified + f * partialTicks); + float f2 = entityplayer.prevCameraYaw + (entityplayer.cameraYaw - entityplayer.prevCameraYaw) * partialTicks; + float f3 = entityplayer.prevCameraPitch + (entityplayer.cameraPitch - entityplayer.prevCameraPitch) * partialTicks; + GlStateManager.translate(MathHelper.sin(f1 * (float)Math.PI) * f2 * 0.5F, -Math.abs(MathHelper.cos(f1 * (float)Math.PI) * f2), 0.0F); + GlStateManager.rotate(MathHelper.sin(f1 * (float)Math.PI) * f2 * 3.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(Math.abs(MathHelper.cos(f1 * (float)Math.PI - 0.2F) * f2) * 5.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3, 1.0F, 0.0F, 0.0F); + } + } + + /** + * sets up player's eye (or camera in third person mode) + */ + private void orientCamera(float partialTicks) + { + Entity entity = this.mc.getRenderViewEntity(); + float f = entity.getEyeHeight(); + double d0 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double)partialTicks; + double d1 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double)partialTicks + (double)f; + double d2 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)partialTicks; + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPlayerSleeping()) + { + f = (float)((double)f + 1.0D); + GlStateManager.translate(0.0F, 0.3F, 0.0F); + + if (!this.mc.gameSettings.debugCamEnable) + { + BlockPos blockpos = new BlockPos(entity); + IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (Reflector.ForgeHooksClient_orientBedCamera.exists()) + { + Reflector.callVoid(Reflector.ForgeHooksClient_orientBedCamera, new Object[] {this.mc.theWorld, blockpos, iblockstate, entity}); + } + else if (block == Blocks.bed) + { + int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); + GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); + } + + GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); + GlStateManager.rotate(entity.prevRotationPitch + (entity.prevRotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F); + } + } + else if (this.mc.gameSettings.thirdPersonView > 0) + { + double d3 = (double)(this.thirdPersonDistanceTemp + (this.thirdPersonDistance - this.thirdPersonDistanceTemp) * partialTicks); + + if (this.mc.gameSettings.debugCamEnable) + { + GlStateManager.translate(0.0F, 0.0F, (float)(-d3)); + } + else + { + float f1 = entity.rotationYaw; + float f2 = entity.prevRotationPitch; + + if (this.mc.gameSettings.thirdPersonView == 2) + { + f2 += 180.0F; + } + + double d4 = (double)(-MathHelper.sin(f1 / 180.0F * (float)Math.PI) * MathHelper.cos(f2 / 180.0F * (float)Math.PI)) * d3; + double d5 = (double)(MathHelper.cos(f1 / 180.0F * (float)Math.PI) * MathHelper.cos(f2 / 180.0F * (float)Math.PI)) * d3; + double d6 = (double)(-MathHelper.sin(f2 / 180.0F * (float)Math.PI)) * d3; + + for (int i = 0; i < 8; ++i) + { + float f3 = (float)((i & 1) * 2 - 1); + float f4 = (float)((i >> 1 & 1) * 2 - 1); + float f5 = (float)((i >> 2 & 1) * 2 - 1); + f3 = f3 * 0.1F; + f4 = f4 * 0.1F; + f5 = f5 * 0.1F; + MovingObjectPosition movingobjectposition = this.mc.theWorld.rayTraceBlocks(new Vec3(d0 + (double)f3, d1 + (double)f4, d2 + (double)f5), new Vec3(d0 - d4 + (double)f3 + (double)f5, d1 - d6 + (double)f4, d2 - d5 + (double)f5)); + + if (movingobjectposition != null) + { + double d7 = movingobjectposition.hitVec.distanceTo(new Vec3(d0, d1, d2)); + + if (d7 < d3) + { + d3 = d7; + } + } + } + + if (this.mc.gameSettings.thirdPersonView == 2) + { + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + } + + GlStateManager.rotate(entity.prevRotationPitch - f2, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(entity.rotationYaw - f1, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.0F, 0.0F, (float)(-d3)); + GlStateManager.rotate(f1 - entity.rotationYaw, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f2 - entity.prevRotationPitch, 1.0F, 0.0F, 0.0F); + } + } + else + { + GlStateManager.translate(0.0F, 0.0F, -0.1F); + } + + if (Reflector.EntityViewRenderEvent_CameraSetup_Constructor.exists()) + { + if (!this.mc.gameSettings.debugCamEnable) + { + float f6 = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F; + float f7 = entity.prevRotationPitch + (entity.prevRotationPitch - entity.prevRotationPitch) * partialTicks; + float f8 = 0.0F; + + if (entity instanceof EntityAnimal) + { + EntityAnimal entityanimal = (EntityAnimal)entity; + f6 = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * partialTicks + 180.0F; + } + + Block block1 = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + Object object = Reflector.newInstance(Reflector.EntityViewRenderEvent_CameraSetup_Constructor, new Object[] {this, entity, block1, Float.valueOf(partialTicks), Float.valueOf(f6), Float.valueOf(f7), Float.valueOf(f8)}); + Reflector.postForgeBusEvent(object); + f8 = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_CameraSetup_roll, f8); + f7 = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_CameraSetup_pitch, f7); + f6 = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_CameraSetup_yaw, f6); + GlStateManager.rotate(f8, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(f7, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f6, 0.0F, 1.0F, 0.0F); + } + } + else if (!this.mc.gameSettings.debugCamEnable) + { + GlStateManager.rotate(entity.prevRotationPitch + (entity.prevRotationPitch - entity.prevRotationPitch) * partialTicks, 1.0F, 0.0F, 0.0F); + + if (entity instanceof EntityAnimal) + { + EntityAnimal entityanimal1 = (EntityAnimal)entity; + GlStateManager.rotate(entityanimal1.prevRotationYawHead + (entityanimal1.rotationYawHead - entityanimal1.prevRotationYawHead) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); + } + else + { + GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); + } + } + + GlStateManager.translate(0.0F, -f, 0.0F); + d0 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double)partialTicks; + d1 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double)partialTicks + (double)f; + d2 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)partialTicks; + this.cloudFog = this.mc.renderGlobal.hasCloudFog(d0, d1, d2, partialTicks); + } + + /** + * sets up projection, view effects, camera position/rotation + */ + public void setupCameraTransform(float partialTicks, int pass) + { + this.farPlaneDistance = (float)(this.mc.gameSettings.renderDistanceChunks * 16); + + if (Config.isFogFancy()) + { + this.farPlaneDistance *= 0.95F; + } + + if (Config.isFogFast()) + { + this.farPlaneDistance *= 0.83F; + } + + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + float f = 0.07F; + + if (this.mc.gameSettings.anaglyph) + { + GlStateManager.translate((float)(-(pass * 2 - 1)) * f, 0.0F, 0.0F); + } + + this.clipDistance = this.farPlaneDistance * 2.0F; + + if (this.clipDistance < 173.0F) + { + this.clipDistance = 173.0F; + } + + if (this.mc.theWorld.provider.getDimensionId() == 1) + { + this.clipDistance = 256.0F; + } + + if (this.cameraZoom != 1.0D) + { + GlStateManager.translate((float)this.cameraYaw, (float)(-this.cameraPitch), 0.0F); + GlStateManager.scale(this.cameraZoom, this.cameraZoom, 1.0D); + } + + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + + if (this.mc.gameSettings.anaglyph) + { + GlStateManager.translate((float)(pass * 2 - 1) * 0.1F, 0.0F, 0.0F); + } + + this.hurtCameraEffect(partialTicks); + + if (this.mc.gameSettings.viewBobbing) + { + this.setupViewBobbing(partialTicks); + } + + float f1 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * partialTicks; + + if (f1 > 0.0F) + { + byte b0 = 20; + + if (this.mc.thePlayer.isPotionActive(Potion.confusion)) + { + b0 = 7; + } + + float f2 = 5.0F / (f1 * f1 + 5.0F) - f1 * 0.04F; + f2 = f2 * f2; + GlStateManager.rotate(((float)this.rendererUpdateCount + partialTicks) * (float)b0, 0.0F, 1.0F, 1.0F); + GlStateManager.scale(1.0F / f2, 1.0F, 1.0F); + GlStateManager.rotate(-((float)this.rendererUpdateCount + partialTicks) * (float)b0, 0.0F, 1.0F, 1.0F); + } + + this.orientCamera(partialTicks); + + if (this.debugView) + { + switch (this.debugViewDirection) + { + case 0: + GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); + break; + + case 1: + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + break; + + case 2: + GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); + break; + + case 3: + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + break; + + case 4: + GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); + } + } + } + + /** + * Render player hand + */ + private void renderHand(float partialTicks, int xOffset) + { + this.renderHand(partialTicks, xOffset, true, true, false); + } + + public void renderHand(float p_renderHand_1_, int p_renderHand_2_, boolean p_renderHand_3_, boolean p_renderHand_4_, boolean p_renderHand_5_) + { + if (!this.debugView) + { + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + float f = 0.07F; + + if (this.mc.gameSettings.anaglyph) + { + GlStateManager.translate((float)(-(p_renderHand_2_ * 2 - 1)) * f, 0.0F, 0.0F); + } + + if (Config.isShaders()) + { + Shaders.applyHandDepth(); + } + + Project.gluPerspective(this.getFOVModifier(p_renderHand_1_, false), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + + if (this.mc.gameSettings.anaglyph) + { + GlStateManager.translate((float)(p_renderHand_2_ * 2 - 1) * 0.1F, 0.0F, 0.0F); + } + + boolean flag = false; + + if (p_renderHand_3_) + { + GlStateManager.pushMatrix(); + this.hurtCameraEffect(p_renderHand_1_); + + if (this.mc.gameSettings.viewBobbing) + { + this.setupViewBobbing(p_renderHand_1_); + } + + flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); + boolean flag1 = !ReflectorForge.renderFirstPersonHand(this.mc.renderGlobal, p_renderHand_1_, p_renderHand_2_); + + if (flag1 && this.mc.gameSettings.thirdPersonView == 0 && !flag && !this.mc.gameSettings.hideGUI && !this.mc.playerController.isSpectator()) + { + this.enableLightmap(); + + if (Config.isShaders()) + { + ShadersRender.renderItemFP(this.itemRenderer, p_renderHand_1_, p_renderHand_5_); + } + else + { + this.itemRenderer.renderItemInFirstPerson(p_renderHand_1_); + } + + this.disableLightmap(); + } + + GlStateManager.popMatrix(); + } + + if (!p_renderHand_4_) + { + return; + } + + this.disableLightmap(); + + if (this.mc.gameSettings.thirdPersonView == 0 && !flag) + { + this.itemRenderer.renderOverlays(p_renderHand_1_); + this.hurtCameraEffect(p_renderHand_1_); + } + + if (this.mc.gameSettings.viewBobbing) + { + this.setupViewBobbing(p_renderHand_1_); + } + } + } + + public void disableLightmap() + { + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + + if (Config.isShaders()) + { + Shaders.disableLightmap(); + } + } + + public void enableLightmap() + { + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + float f = 0.00390625F; + GlStateManager.scale(f, f, f); + GlStateManager.translate(8.0F, 8.0F, 8.0F); + GlStateManager.matrixMode(5888); + this.mc.getTextureManager().bindTexture(this.locationLightMap); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + + if (Config.isShaders()) + { + Shaders.enableLightmap(); + } + } + + /** + * Recompute a random value that is applied to block color in updateLightmap() + */ + private void updateTorchFlicker() + { + this.torchFlickerDX = (float)((double)this.torchFlickerDX + (Math.random() - Math.random()) * Math.random() * Math.random()); + this.torchFlickerDX = (float)((double)this.torchFlickerDX * 0.9D); + this.torchFlickerX += (this.torchFlickerDX - this.torchFlickerX) * 1.0F; + this.lightmapUpdateNeeded = true; + } + + private void updateLightmap(float partialTicks) + { + if (this.lightmapUpdateNeeded) + { + this.mc.mcProfiler.startSection("lightTex"); + WorldClient worldclient = this.mc.theWorld; + + if (worldclient != null) + { + if (Config.isCustomColors() && CustomColors.updateLightmap(worldclient, this.torchFlickerX, this.lightmapColors, this.mc.thePlayer.isPotionActive(Potion.nightVision))) + { + this.lightmapTexture.updateDynamicTexture(); + this.lightmapUpdateNeeded = false; + this.mc.mcProfiler.endSection(); + return; + } + + float f = worldclient.getSunBrightness(1.0F); + float f1 = f * 0.95F + 0.05F; + + for (int i = 0; i < 256; ++i) + { + float f2 = worldclient.provider.getLightBrightnessTable()[i / 16] * f1; + float f3 = worldclient.provider.getLightBrightnessTable()[i % 16] * (this.torchFlickerX * 0.1F + 1.5F); + + if (worldclient.getLastLightningBolt() > 0) + { + f2 = worldclient.provider.getLightBrightnessTable()[i / 16]; + } + + float f4 = f2 * (f * 0.65F + 0.35F); + float f5 = f2 * (f * 0.65F + 0.35F); + float f6 = f3 * ((f3 * 0.6F + 0.4F) * 0.6F + 0.4F); + float f7 = f3 * (f3 * f3 * 0.6F + 0.4F); + float f8 = f4 + f3; + float f9 = f5 + f6; + float f10 = f2 + f7; + f8 = f8 * 0.96F + 0.03F; + f9 = f9 * 0.96F + 0.03F; + f10 = f10 * 0.96F + 0.03F; + + if (this.bossColorModifier > 0.0F) + { + float f11 = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * partialTicks; + f8 = f8 * (1.0F - f11) + f8 * 0.7F * f11; + f9 = f9 * (1.0F - f11) + f9 * 0.6F * f11; + f10 = f10 * (1.0F - f11) + f10 * 0.6F * f11; + } + + if (worldclient.provider.getDimensionId() == 1) + { + f8 = 0.22F + f3 * 0.75F; + f9 = 0.28F + f6 * 0.75F; + f10 = 0.25F + f7 * 0.75F; + } + + if (this.mc.thePlayer.isPotionActive(Potion.nightVision)) + { + float f15 = this.getNightVisionBrightness(this.mc.thePlayer, partialTicks); + float f12 = 1.0F / f8; + + if (f12 > 1.0F / f9) + { + f12 = 1.0F / f9; + } + + if (f12 > 1.0F / f10) + { + f12 = 1.0F / f10; + } + + f8 = f8 * (1.0F - f15) + f8 * f12 * f15; + f9 = f9 * (1.0F - f15) + f9 * f12 * f15; + f10 = f10 * (1.0F - f15) + f10 * f12 * f15; + } + + if (f8 > 1.0F) + { + f8 = 1.0F; + } + + if (f9 > 1.0F) + { + f9 = 1.0F; + } + + if (f10 > 1.0F) + { + f10 = 1.0F; + } + + float f16 = this.mc.gameSettings.gammaSetting; + float f17 = 1.0F - f8; + float f13 = 1.0F - f9; + float f14 = 1.0F - f10; + f17 = 1.0F - f17 * f17 * f17 * f17; + f13 = 1.0F - f13 * f13 * f13 * f13; + f14 = 1.0F - f14 * f14 * f14 * f14; + f8 = f8 * (1.0F - f16) + f17 * f16; + f9 = f9 * (1.0F - f16) + f13 * f16; + f10 = f10 * (1.0F - f16) + f14 * f16; + f8 = f8 * 0.96F + 0.03F; + f9 = f9 * 0.96F + 0.03F; + f10 = f10 * 0.96F + 0.03F; + + if (f8 > 1.0F) + { + f8 = 1.0F; + } + + if (f9 > 1.0F) + { + f9 = 1.0F; + } + + if (f10 > 1.0F) + { + f10 = 1.0F; + } + + if (f8 < 0.0F) + { + f8 = 0.0F; + } + + if (f9 < 0.0F) + { + f9 = 0.0F; + } + + if (f10 < 0.0F) + { + f10 = 0.0F; + } + + short short1 = 255; + int j = (int)(f8 * 255.0F); + int k = (int)(f9 * 255.0F); + int l = (int)(f10 * 255.0F); + this.lightmapColors[i] = short1 << 24 | j << 16 | k << 8 | l; + } + + this.lightmapTexture.updateDynamicTexture(); + this.lightmapUpdateNeeded = false; + this.mc.mcProfiler.endSection(); + } + } + } + + public float getNightVisionBrightness(EntityLivingBase entitylivingbaseIn, float partialTicks) + { + int i = entitylivingbaseIn.getActivePotionEffect(Potion.nightVision).getDuration(); + return i > 200 ? 1.0F : 0.7F + MathHelper.sin(((float)i - partialTicks) * (float)Math.PI * 0.2F) * 0.3F; + } + + public void func_181560_a(float p_181560_1_, long p_181560_2_) + { + this.frameInit(); + boolean flag = Display.isActive(); + + if (!flag && this.mc.gameSettings.pauseOnLostFocus && (!this.mc.gameSettings.touchscreen || !Mouse.isButtonDown(1))) + { + if (Minecraft.getSystemTime() - this.prevFrameTime > 500L) + { + this.mc.displayInGameMenu(); + } + } + else + { + this.prevFrameTime = Minecraft.getSystemTime(); + } + + this.mc.mcProfiler.startSection("mouse"); + + if (flag && Minecraft.isRunningOnMac && this.mc.inGameHasFocus && !Mouse.isInsideWindow()) + { + Mouse.setGrabbed(false); + Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2); + Mouse.setGrabbed(true); + } + + if (this.mc.inGameHasFocus && flag) + { + this.mc.mouseHelper.mouseXYChange(); + float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; + float f1 = f * f * f * 8.0F; + float f2 = (float)this.mc.mouseHelper.deltaX * f1; + float f3 = (float)this.mc.mouseHelper.deltaY * f1; + byte b0 = 1; + + if (this.mc.gameSettings.invertMouse) + { + b0 = -1; + } + + if (this.mc.gameSettings.smoothCamera) + { + this.smoothCamYaw += f2; + this.smoothCamPitch += f3; + float f4 = p_181560_1_ - this.smoothCamPartialTicks; + this.smoothCamPartialTicks = p_181560_1_; + f2 = this.smoothCamFilterX * f4; + f3 = this.smoothCamFilterY * f4; + this.mc.thePlayer.setAngles(f2, f3 * (float)b0); + } + else + { + this.smoothCamYaw = 0.0F; + this.smoothCamPitch = 0.0F; + this.mc.thePlayer.setAngles(f2, f3 * (float)b0); + } + } + + this.mc.mcProfiler.endSection(); + + if (!this.mc.skipRenderWorld) + { + anaglyphEnable = this.mc.gameSettings.anaglyph; + final ScaledResolution scaledresolution = new ScaledResolution(this.mc); + int l = scaledresolution.getScaledWidth(); + int i1 = scaledresolution.getScaledHeight(); + final int j1 = Mouse.getX() * l / this.mc.displayWidth; + final int k1 = i1 - Mouse.getY() * i1 / this.mc.displayHeight - 1; + int l1 = this.mc.gameSettings.limitFramerate; + + if (this.mc.theWorld != null) + { + this.mc.mcProfiler.startSection("level"); + int i = Math.min(Minecraft.getDebugFPS(), l1); + i = Math.max(i, 60); + long j = System.nanoTime() - p_181560_2_; + long k = Math.max((long)(1000000000 / i / 4) - j, 0L); + this.renderWorld(p_181560_1_, System.nanoTime() + k); + + if (OpenGlHelper.shadersSupported) + { + this.mc.renderGlobal.renderEntityOutlineFramebuffer(); + + if (this.theShaderGroup != null && this.useShader) + { + GlStateManager.matrixMode(5890); + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + this.theShaderGroup.loadShaderGroup(p_181560_1_); + GlStateManager.popMatrix(); + } + + this.mc.getFramebuffer().bindFramebuffer(true); + } + + this.renderEndNanoTime = System.nanoTime(); + this.mc.mcProfiler.endStartSection("gui"); + + if (!this.mc.gameSettings.hideGUI || this.mc.currentScreen != null) + { + GlStateManager.alphaFunc(516, 0.1F); + this.mc.ingameGUI.renderGameOverlay(p_181560_1_); + + if (this.mc.gameSettings.ofShowFps && !this.mc.gameSettings.showDebugInfo) + { + Config.drawFps(); + } + + if (this.mc.gameSettings.showDebugInfo) + { + Lagometer.showLagometer(scaledresolution); + } + } + + this.mc.mcProfiler.endSection(); + } + else + { + GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + this.setupOverlayRendering(); + this.renderEndNanoTime = System.nanoTime(); + TileEntityRendererDispatcher.instance.renderEngine = this.mc.getTextureManager(); + } + + if (this.mc.currentScreen != null) + { + GlStateManager.clear(256); + + try + { + if (Reflector.ForgeHooksClient_drawScreen.exists()) + { + Reflector.callVoid(Reflector.ForgeHooksClient_drawScreen, new Object[] {this.mc.currentScreen, Integer.valueOf(j1), Integer.valueOf(k1), Float.valueOf(p_181560_1_)}); + } + else + { + this.mc.currentScreen.drawScreen(j1, k1, p_181560_1_); + } + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering screen"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Screen render details"); + crashreportcategory.addCrashSectionCallable("Screen name", new EntityRenderer2(this)); + crashreportcategory.addCrashSectionCallable("Mouse location", new Callable() + { + private static final String __OBFID = "CL_00000950"; + public String call() throws Exception + { + return String.format("Scaled: (%d, %d). Absolute: (%d, %d)", new Object[] {Integer.valueOf(j1), Integer.valueOf(k1), Integer.valueOf(Mouse.getX()), Integer.valueOf(Mouse.getY())}); + } + }); + crashreportcategory.addCrashSectionCallable("Screen size", new Callable() + { + private static final String __OBFID = "CL_00000951"; + public String call() throws Exception + { + return String.format("Scaled: (%d, %d). Absolute: (%d, %d). Scale factor of %d", new Object[] {Integer.valueOf(scaledresolution.getScaledWidth()), Integer.valueOf(scaledresolution.getScaledHeight()), Integer.valueOf(EntityRenderer.this.mc.displayWidth), Integer.valueOf(EntityRenderer.this.mc.displayHeight), Integer.valueOf(scaledresolution.getScaleFactor())}); + } + }); + throw new ReportedException(crashreport); + } + } + } + + this.frameFinish(); + this.waitForServerThread(); + Lagometer.updateLagometer(); + + if (this.mc.gameSettings.ofProfiler) + { + this.mc.gameSettings.showDebugProfilerChart = true; + } + } + + public void renderStreamIndicator(float partialTicks) + { + this.setupOverlayRendering(); + this.mc.ingameGUI.renderStreamIndicator(new ScaledResolution(this.mc)); + } + + private boolean isDrawBlockOutline() + { + if (!this.drawBlockOutline) + { + return false; + } + else + { + Entity entity = this.mc.getRenderViewEntity(); + boolean flag = entity instanceof EntityPlayer && !this.mc.gameSettings.hideGUI; + + if (flag && !((EntityPlayer)entity).capabilities.allowEdit) + { + ItemStack itemstack = ((EntityPlayer)entity).getCurrentEquippedItem(); + + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = this.mc.objectMouseOver.getBlockPos(); + IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) + { + flag = ReflectorForge.blockHasTileEntity(iblockstate) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; + } + else + { + flag = itemstack != null && (itemstack.canDestroy(block) || itemstack.canPlaceOn(block)); + } + } + } + + return flag; + } + } + + private void renderWorldDirections(float partialTicks) + { + if (this.mc.gameSettings.showDebugInfo && !this.mc.gameSettings.hideGUI && !this.mc.thePlayer.hasReducedDebug() && !this.mc.gameSettings.reducedDebugInfo) + { + Entity entity = this.mc.getRenderViewEntity(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GL11.glLineWidth(1.0F); + GlStateManager.disableTexture2D(); + GlStateManager.depthMask(false); + GlStateManager.pushMatrix(); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + this.orientCamera(partialTicks); + GlStateManager.translate(0.0F, entity.getEyeHeight(), 0.0F); + RenderGlobal.func_181563_a(new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.005D, 1.0E-4D, 1.0E-4D), 255, 0, 0, 255); + RenderGlobal.func_181563_a(new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0E-4D, 1.0E-4D, 0.005D), 0, 0, 255, 255); + RenderGlobal.func_181563_a(new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0E-4D, 0.0033D, 1.0E-4D), 0, 255, 0, 255); + GlStateManager.popMatrix(); + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + } + } + + public void renderWorld(float partialTicks, long finishTimeNano) + { + this.updateLightmap(partialTicks); + + if (this.mc.getRenderViewEntity() == null) + { + this.mc.setRenderViewEntity(this.mc.thePlayer); + } + + this.getMouseOver(partialTicks); + + if (Config.isShaders()) + { + Shaders.beginRender(this.mc, partialTicks, finishTimeNano); + } + + GlStateManager.enableDepth(); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + this.mc.mcProfiler.startSection("center"); + + if (this.mc.gameSettings.anaglyph) + { + anaglyphField = 0; + GlStateManager.colorMask(false, true, true, false); + this.renderWorldPass(0, partialTicks, finishTimeNano); + anaglyphField = 1; + GlStateManager.colorMask(true, false, false, false); + this.renderWorldPass(1, partialTicks, finishTimeNano); + GlStateManager.colorMask(true, true, true, false); + } + else + { + this.renderWorldPass(2, partialTicks, finishTimeNano); + } + + this.mc.mcProfiler.endSection(); + } + + private void renderWorldPass(int pass, float partialTicks, long finishTimeNano) + { + boolean flag = Config.isShaders(); + + if (flag) + { + Shaders.beginRenderPass(pass, partialTicks, finishTimeNano); + } + + RenderGlobal renderglobal = this.mc.renderGlobal; + EffectRenderer effectrenderer = this.mc.effectRenderer; + boolean flag1 = this.isDrawBlockOutline(); + GlStateManager.enableCull(); + this.mc.mcProfiler.endStartSection("clear"); + + if (flag) + { + Shaders.setViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + } + else + { + GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + } + + this.updateFogColor(partialTicks); + GlStateManager.clear(16640); + + if (flag) + { + Shaders.clearRenderBuffer(); + } + + this.mc.mcProfiler.endStartSection("camera"); + this.setupCameraTransform(partialTicks, pass); + + if (flag) + { + Shaders.setCamera(partialTicks); + } + + ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2); + this.mc.mcProfiler.endStartSection("frustum"); + ClippingHelperImpl.getInstance(); + this.mc.mcProfiler.endStartSection("culling"); + Frustum frustum = new Frustum(); + Entity entity = this.mc.getRenderViewEntity(); + double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; + + if (flag) + { + ShadersRender.setFrustrumPosition(frustum, d0, d1, d2); + } + else + { + frustum.setPosition(d0, d1, d2); + } + + if ((Config.isSkyEnabled() || Config.isSunMoonEnabled() || Config.isStarsEnabled()) && !Shaders.isShadowPass) + { + this.setupFog(-1, partialTicks); + this.mc.mcProfiler.endStartSection("sky"); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance); + GlStateManager.matrixMode(5888); + + if (flag) + { + Shaders.beginSky(); + } + + renderglobal.renderSky(partialTicks, pass); + + if (flag) + { + Shaders.endSky(); + } + + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance); + GlStateManager.matrixMode(5888); + } + else + { + GlStateManager.disableBlend(); + } + + this.setupFog(0, partialTicks); + GlStateManager.shadeModel(7425); + + if (entity.posY + (double)entity.getEyeHeight() < 128.0D + (double)(this.mc.gameSettings.ofCloudsHeight * 128.0F)) + { + this.renderCloudsCheck(renderglobal, partialTicks, pass); + } + + this.mc.mcProfiler.endStartSection("prepareterrain"); + this.setupFog(0, partialTicks); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + RenderHelper.disableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("terrain_setup"); + + if (flag) + { + ShadersRender.setupTerrain(renderglobal, entity, (double)partialTicks, frustum, this.frameCount++, this.mc.thePlayer.isSpectator()); + } + else + { + renderglobal.setupTerrain(entity, (double)partialTicks, frustum, this.frameCount++, this.mc.thePlayer.isSpectator()); + } + + if (pass == 0 || pass == 2) + { + this.mc.mcProfiler.endStartSection("updatechunks"); + Lagometer.timerChunkUpload.start(); + this.mc.renderGlobal.updateChunks(finishTimeNano); + Lagometer.timerChunkUpload.end(); + } + + this.mc.mcProfiler.endStartSection("terrain"); + Lagometer.timerTerrain.start(); + + if (this.mc.gameSettings.ofSmoothFps && pass > 0) + { + this.mc.mcProfiler.endStartSection("finish"); + GL11.glFinish(); + this.mc.mcProfiler.endStartSection("terrain"); + } + + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + GlStateManager.disableAlpha(); + + if (flag) + { + ShadersRender.beginTerrainSolid(); + } + + renderglobal.renderBlockLayer(EnumWorldBlockLayer.SOLID, (double)partialTicks, pass, entity); + GlStateManager.enableAlpha(); + + if (flag) + { + ShadersRender.beginTerrainCutoutMipped(); + } + + renderglobal.renderBlockLayer(EnumWorldBlockLayer.CUTOUT_MIPPED, (double)partialTicks, pass, entity); + this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); + + if (flag) + { + ShadersRender.beginTerrainCutout(); + } + + renderglobal.renderBlockLayer(EnumWorldBlockLayer.CUTOUT, (double)partialTicks, pass, entity); + this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); + + if (flag) + { + ShadersRender.endTerrain(); + } + + Lagometer.timerTerrain.end(); + GlStateManager.shadeModel(7424); + GlStateManager.alphaFunc(516, 0.1F); + + if (!this.debugView) + { + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); + + if (Reflector.ForgeHooksClient_setRenderPass.exists()) + { + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] {Integer.valueOf(0)}); + } + + renderglobal.renderEntities(entity, frustum, partialTicks); + + if (Reflector.ForgeHooksClient_setRenderPass.exists()) + { + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] {Integer.valueOf(-1)}); + } + + RenderHelper.disableStandardItemLighting(); + this.disableLightmap(); + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + + if (this.mc.objectMouseOver != null && entity.isInsideOfMaterial(Material.water) && flag1) + { + EntityPlayer entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); + + if ((!Reflector.ForgeHooksClient_onDrawBlockHighlight.exists() || !Reflector.callBoolean(Reflector.ForgeHooksClient_onDrawBlockHighlight, new Object[] {renderglobal, entityplayer, this.mc.objectMouseOver, Integer.valueOf(0), entityplayer.getHeldItem(), Float.valueOf(partialTicks)})) && !this.mc.gameSettings.hideGUI) + { + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + } + GlStateManager.enableAlpha(); + } + } + + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + + if (flag1 && this.mc.objectMouseOver != null && !entity.isInsideOfMaterial(Material.water)) + { + EntityPlayer entityplayer1 = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); + + if ((!Reflector.ForgeHooksClient_onDrawBlockHighlight.exists() || !Reflector.callBoolean(Reflector.ForgeHooksClient_onDrawBlockHighlight, new Object[] {renderglobal, entityplayer1, this.mc.objectMouseOver, Integer.valueOf(0), entityplayer1.getHeldItem(), Float.valueOf(partialTicks)})) && !this.mc.gameSettings.hideGUI) + { + renderglobal.drawSelectionBox(entityplayer1, this.mc.objectMouseOver, 0, partialTicks); + } + GlStateManager.enableAlpha(); + } + + if (!renderglobal.damagedBlocks.isEmpty()) + { + this.mc.mcProfiler.endStartSection("destroyProgress"); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0); + this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); + renderglobal.drawBlockDamageTexture(Tessellator.getInstance(), Tessellator.getInstance().getWorldRenderer(), entity, partialTicks); + this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); + GlStateManager.disableBlend(); + } + + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.disableBlend(); + + if (!this.debugView) + { + this.enableLightmap(); + this.mc.mcProfiler.endStartSection("litParticles"); + + if (flag) + { + Shaders.beginLitParticles(); + } + + effectrenderer.renderLitParticles(entity, partialTicks); + RenderHelper.disableStandardItemLighting(); + this.setupFog(0, partialTicks); + this.mc.mcProfiler.endStartSection("particles"); + + if (flag) + { + Shaders.beginParticles(); + } + + effectrenderer.renderParticles(entity, partialTicks); + + if (flag) + { + Shaders.endParticles(); + } + + this.disableLightmap(); + } + + GlStateManager.depthMask(false); + GlStateManager.enableCull(); + this.mc.mcProfiler.endStartSection("weather"); + + if (flag) + { + Shaders.beginWeather(); + } + + this.renderRainSnow(partialTicks); + + if (flag) + { + Shaders.endWeather(); + } + + GlStateManager.depthMask(true); + renderglobal.renderWorldBorder(entity, partialTicks); + + if (flag) + { + ShadersRender.renderHand0(this, partialTicks, pass); + Shaders.preWater(); + } + + GlStateManager.disableBlend(); + GlStateManager.enableCull(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.alphaFunc(516, 0.1F); + this.setupFog(0, partialTicks); + GlStateManager.enableBlend(); + GlStateManager.depthMask(false); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + GlStateManager.shadeModel(7425); + this.mc.mcProfiler.endStartSection("translucent"); + + if (flag) + { + Shaders.beginWater(); + } + + renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); + + if (flag) + { + Shaders.endWater(); + } + + if (Reflector.ForgeHooksClient_setRenderPass.exists() && !this.debugView) + { + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] {Integer.valueOf(1)}); + this.mc.renderGlobal.renderEntities(entity, frustum, partialTicks); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] {Integer.valueOf(-1)}); + RenderHelper.disableStandardItemLighting(); + } + + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); + GlStateManager.disableBlend(); + GlStateManager.disableFog(); + + if (entity.posY + (double)entity.getEyeHeight() >= 128.0D + (double)(this.mc.gameSettings.ofCloudsHeight * 128.0F)) + { + this.mc.mcProfiler.endStartSection("aboveClouds"); + this.renderCloudsCheck(renderglobal, partialTicks, pass); + } + + if (Reflector.ForgeHooksClient_dispatchRenderLast.exists()) + { + this.mc.mcProfiler.endStartSection("forge_render_last"); + Reflector.callVoid(Reflector.ForgeHooksClient_dispatchRenderLast, new Object[] {renderglobal, Float.valueOf(partialTicks)}); + } + + this.mc.mcProfiler.endStartSection("hand"); + boolean flag2 = ReflectorForge.renderFirstPersonHand(this.mc.renderGlobal, partialTicks, pass); + + if (!flag2 && this.renderHand && !Shaders.isShadowPass) + { + if (flag) + { + ShadersRender.renderHand1(this, partialTicks, pass); + Shaders.renderCompositeFinal(); + } + + GlStateManager.clear(256); + + if (flag) + { + ShadersRender.renderFPOverlay(this, partialTicks, pass); + } + else + { + this.renderHand(partialTicks, pass); + } + + this.renderWorldDirections(partialTicks); + } + + if (flag) + { + Shaders.endRender(); + } + } + + private void renderCloudsCheck(RenderGlobal renderGlobalIn, float partialTicks, int pass) + { + if (this.mc.gameSettings.renderDistanceChunks >= 4 && !Config.isCloudsOff() && Shaders.shouldRenderClouds(this.mc.gameSettings)) + { + this.mc.mcProfiler.endStartSection("clouds"); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance * 4.0F); + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + this.setupFog(0, partialTicks); + renderGlobalIn.renderClouds(partialTicks, pass); + GlStateManager.disableFog(); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance); + GlStateManager.matrixMode(5888); + } + } + + private void addRainParticles() + { + float f = this.mc.theWorld.getRainStrength(1.0F); + + if (!Config.isRainFancy()) + { + f /= 2.0F; + } + + if (f != 0.0F && Config.isRainSplash()) + { + this.random.setSeed((long)this.rendererUpdateCount * 312987231L); + Entity entity = this.mc.getRenderViewEntity(); + WorldClient worldclient = this.mc.theWorld; + BlockPos blockpos = new BlockPos(entity); + byte b0 = 10; + double d0 = 0.0D; + double d1 = 0.0D; + double d2 = 0.0D; + int i = 0; + int j = (int)(100.0F * f * f); + + if (this.mc.gameSettings.particleSetting == 1) + { + j >>= 1; + } + else if (this.mc.gameSettings.particleSetting == 2) + { + j = 0; + } + + for (int k = 0; k < j; ++k) + { + BlockPos blockpos1 = worldclient.getPrecipitationHeight(blockpos.add(this.random.nextInt(b0) - this.random.nextInt(b0), 0, this.random.nextInt(b0) - this.random.nextInt(b0))); + BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos1); + BlockPos blockpos2 = blockpos1.down(); + Block block = worldclient.getBlockState(blockpos2).getBlock(); + + if (blockpos1.getY() <= blockpos.getY() + b0 && blockpos1.getY() >= blockpos.getY() - b0 && biomegenbase.canSpawnLightningBolt() && biomegenbase.getFloatTemperature(blockpos1) >= 0.15F) + { + double d3 = this.random.nextDouble(); + double d4 = this.random.nextDouble(); + + if (block.getMaterial() == Material.lava) + { + this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]); + } + else if (block.getMaterial() != Material.air) + { + block.setBlockBoundsBasedOnState(worldclient, blockpos2); + ++i; + + if (this.random.nextInt(i) == 0) + { + d0 = (double)blockpos2.getX() + d3; + d1 = (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D; + d2 = (double)blockpos2.getZ() + d4; + } + + this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double)blockpos2.getX() + d3, (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(), (double)blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + } + + if (i > 0 && this.random.nextInt(3) < this.rainSoundCounter++) + { + this.rainSoundCounter = 0; + + if (d1 > (double)(blockpos.getY() + 1) && worldclient.getPrecipitationHeight(blockpos).getY() > MathHelper.floor_float((float)blockpos.getY())) + { + this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false); + } + else + { + this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false); + } + } + } + } + + /** + * Render rain and snow + */ + protected void renderRainSnow(float partialTicks) + { + if (Reflector.ForgeWorldProvider_getWeatherRenderer.exists()) + { + WorldProvider worldprovider = this.mc.theWorld.provider; + Object object = Reflector.call(worldprovider, Reflector.ForgeWorldProvider_getWeatherRenderer, new Object[0]); + + if (object != null) + { + Reflector.callVoid(object, Reflector.IRenderHandler_render, new Object[] {Float.valueOf(partialTicks), this.mc.theWorld, this.mc}); + return; + } + } + + float f5 = this.mc.theWorld.getRainStrength(partialTicks); + + if (f5 > 0.0F) + { + if (Config.isRainOff()) + { + return; + } + + this.enableLightmap(); + Entity entity = this.mc.getRenderViewEntity(); + WorldClient worldclient = this.mc.theWorld; + int i = MathHelper.floor_double(entity.posX); + int j = MathHelper.floor_double(entity.posY); + int k = MathHelper.floor_double(entity.posZ); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.disableCull(); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.alphaFunc(516, 0.1F); + double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; + int l = MathHelper.floor_double(d1); + byte b0 = 5; + + if (Config.isRainFancy()) + { + b0 = 10; + } + + byte b1 = -1; + float f = (float)this.rendererUpdateCount + partialTicks; + worldrenderer.setTranslation(-d0, -d1, -d2); + + if (Config.isRainFancy()) + { + b0 = 10; + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int i1 = k - b0; i1 <= k + b0; ++i1) + { + for (int j1 = i - b0; j1 <= i + b0; ++j1) + { + int k1 = (i1 - k + 16) * 32 + j1 - i + 16; + double d3 = (double)this.rainXCoords[k1] * 0.5D; + double d4 = (double)this.rainYCoords[k1] * 0.5D; + blockpos$mutableblockpos.func_181079_c(j1, 0, i1); + BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos$mutableblockpos); + + if (biomegenbase.canSpawnLightningBolt() || biomegenbase.getEnableSnow()) + { + int l1 = worldclient.getPrecipitationHeight(blockpos$mutableblockpos).getY(); + int i2 = j - b0; + int j2 = j + b0; + + if (i2 < l1) + { + i2 = l1; + } + + if (j2 < l1) + { + j2 = l1; + } + + int k2 = l1; + + if (l1 < l) + { + k2 = l; + } + + if (i2 != j2) + { + this.random.setSeed((long)(j1 * j1 * 3121 + j1 * 45238971 ^ i1 * i1 * 418711 + i1 * 13761)); + blockpos$mutableblockpos.func_181079_c(j1, i2, i1); + float f1 = biomegenbase.getFloatTemperature(blockpos$mutableblockpos); + + if (worldclient.getWorldChunkManager().getTemperatureAtHeight(f1, l1) >= 0.15F) + { + if (b1 != 0) + { + if (b1 >= 0) + { + tessellator.draw(); + } + + b1 = 0; + this.mc.getTextureManager().bindTexture(locationRainPng); + worldrenderer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + } + + double d5 = ((double)(this.rendererUpdateCount + j1 * j1 * 3121 + j1 * 45238971 + i1 * i1 * 418711 + i1 * 13761 & 31) + (double)partialTicks) / 32.0D * (3.0D + this.random.nextDouble()); + double d6 = (double)((float)j1 + 0.5F) - entity.posX; + double d7 = (double)((float)i1 + 0.5F) - entity.posZ; + float f2 = MathHelper.sqrt_double(d6 * d6 + d7 * d7) / (float)b0; + float f3 = ((1.0F - f2 * f2) * 0.5F + 0.5F) * f5; + blockpos$mutableblockpos.func_181079_c(j1, k2, i1); + int l2 = worldclient.getCombinedLight(blockpos$mutableblockpos, 0); + int i3 = l2 >> 16 & 65535; + int j3 = l2 & 65535; + worldrenderer.pos((double)j1 - d3 + 0.5D, (double)i2, (double)i1 - d4 + 0.5D).tex(0.0D, (double)i2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f3).lightmap(i3, j3).endVertex(); + worldrenderer.pos((double)j1 + d3 + 0.5D, (double)i2, (double)i1 + d4 + 0.5D).tex(1.0D, (double)i2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f3).lightmap(i3, j3).endVertex(); + worldrenderer.pos((double)j1 + d3 + 0.5D, (double)j2, (double)i1 + d4 + 0.5D).tex(1.0D, (double)j2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f3).lightmap(i3, j3).endVertex(); + worldrenderer.pos((double)j1 - d3 + 0.5D, (double)j2, (double)i1 - d4 + 0.5D).tex(0.0D, (double)j2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f3).lightmap(i3, j3).endVertex(); + } + else + { + if (b1 != 1) + { + if (b1 >= 0) + { + tessellator.draw(); + } + + b1 = 1; + this.mc.getTextureManager().bindTexture(locationSnowPng); + worldrenderer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + } + + double d8 = (double)(((float)(this.rendererUpdateCount & 511) + partialTicks) / 512.0F); + double d9 = this.random.nextDouble() + (double)f * 0.01D * (double)((float)this.random.nextGaussian()); + double d10 = this.random.nextDouble() + (double)(f * (float)this.random.nextGaussian()) * 0.001D; + double d11 = (double)((float)j1 + 0.5F) - entity.posX; + double d12 = (double)((float)i1 + 0.5F) - entity.posZ; + float f6 = MathHelper.sqrt_double(d11 * d11 + d12 * d12) / (float)b0; + float f4 = ((1.0F - f6 * f6) * 0.3F + 0.5F) * f5; + blockpos$mutableblockpos.func_181079_c(j1, k2, i1); + int k3 = (worldclient.getCombinedLight(blockpos$mutableblockpos, 0) * 3 + 15728880) / 4; + int l3 = k3 >> 16 & 65535; + int i4 = k3 & 65535; + worldrenderer.pos((double)j1 - d3 + 0.5D, (double)i2, (double)i1 - d4 + 0.5D).tex(0.0D + d9, (double)i2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f4).lightmap(l3, i4).endVertex(); + worldrenderer.pos((double)j1 + d3 + 0.5D, (double)i2, (double)i1 + d4 + 0.5D).tex(1.0D + d9, (double)i2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f4).lightmap(l3, i4).endVertex(); + worldrenderer.pos((double)j1 + d3 + 0.5D, (double)j2, (double)i1 + d4 + 0.5D).tex(1.0D + d9, (double)j2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f4).lightmap(l3, i4).endVertex(); + worldrenderer.pos((double)j1 - d3 + 0.5D, (double)j2, (double)i1 - d4 + 0.5D).tex(0.0D + d9, (double)j2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f4).lightmap(l3, i4).endVertex(); + } + } + } + } + } + + if (b1 >= 0) + { + tessellator.draw(); + } + + worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); + GlStateManager.enableCull(); + GlStateManager.disableBlend(); + GlStateManager.alphaFunc(516, 0.1F); + this.disableLightmap(); + } + } + + /** + * Setup orthogonal projection for rendering GUI screen overlays + */ + public void setupOverlayRendering() + { + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + GlStateManager.clear(256); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + } + + /** + * calculates fog and calls glClearColor + */ + private void updateFogColor(float partialTicks) + { + WorldClient worldclient = this.mc.theWorld; + Entity entity = this.mc.getRenderViewEntity(); + float f = 0.25F + 0.75F * (float)this.mc.gameSettings.renderDistanceChunks / 32.0F; + f = 1.0F - (float)Math.pow((double)f, 0.25D); + Vec3 vec3 = worldclient.getSkyColor(this.mc.getRenderViewEntity(), partialTicks); + vec3 = CustomColors.getWorldSkyColor(vec3, worldclient, this.mc.getRenderViewEntity(), partialTicks); + float f1 = (float)vec3.xCoord; + float f2 = (float)vec3.yCoord; + float f3 = (float)vec3.zCoord; + Vec3 vec31 = worldclient.getFogColor(partialTicks); + vec31 = CustomColors.getWorldFogColor(vec31, worldclient, this.mc.getRenderViewEntity(), partialTicks); + this.fogColorRed = (float)vec31.xCoord; + this.fogColorGreen = (float)vec31.yCoord; + this.fogColorBlue = (float)vec31.zCoord; + + if (this.mc.gameSettings.renderDistanceChunks >= 4) + { + double d0 = -1.0D; + Vec3 vec32 = MathHelper.sin(worldclient.getCelestialAngleRadians(partialTicks)) > 0.0F ? new Vec3(d0, 0.0D, 0.0D) : new Vec3(1.0D, 0.0D, 0.0D); + float f4 = (float)entity.getLook(partialTicks).dotProduct(vec32); + + if (f4 < 0.0F) + { + f4 = 0.0F; + } + + if (f4 > 0.0F) + { + float[] afloat = worldclient.provider.calcSunriseSunsetColors(worldclient.getCelestialAngle(partialTicks), partialTicks); + + if (afloat != null) + { + f4 = f4 * afloat[3]; + this.fogColorRed = this.fogColorRed * (1.0F - f4) + afloat[0] * f4; + this.fogColorGreen = this.fogColorGreen * (1.0F - f4) + afloat[1] * f4; + this.fogColorBlue = this.fogColorBlue * (1.0F - f4) + afloat[2] * f4; + } + } + } + + this.fogColorRed += (f1 - this.fogColorRed) * f; + this.fogColorGreen += (f2 - this.fogColorGreen) * f; + this.fogColorBlue += (f3 - this.fogColorBlue) * f; + float f10 = worldclient.getRainStrength(partialTicks); + + if (f10 > 0.0F) + { + float f5 = 1.0F - f10 * 0.5F; + float f12 = 1.0F - f10 * 0.4F; + this.fogColorRed *= f5; + this.fogColorGreen *= f5; + this.fogColorBlue *= f12; + } + + float f11 = worldclient.getThunderStrength(partialTicks); + + if (f11 > 0.0F) + { + float f13 = 1.0F - f11 * 0.5F; + this.fogColorRed *= f13; + this.fogColorGreen *= f13; + this.fogColorBlue *= f13; + } + + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + + if (this.cloudFog) + { + Vec3 vec33 = worldclient.getCloudColour(partialTicks); + this.fogColorRed = (float)vec33.xCoord; + this.fogColorGreen = (float)vec33.yCoord; + this.fogColorBlue = (float)vec33.zCoord; + } + else if (block.getMaterial() == Material.water) + { + float f8 = (float)EnchantmentHelper.getRespiration(entity) * 0.2F; + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.waterBreathing)) + { + f8 = f8 * 0.3F + 0.6F; + } + + this.fogColorRed = 0.02F + f8; + this.fogColorGreen = 0.02F + f8; + this.fogColorBlue = 0.2F + f8; + Vec3 vec34 = CustomColors.getUnderwaterColor(this.mc.theWorld, this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().posY + 1.0D, this.mc.getRenderViewEntity().posZ); + + if (vec34 != null) + { + this.fogColorRed = (float)vec34.xCoord; + this.fogColorGreen = (float)vec34.yCoord; + this.fogColorBlue = (float)vec34.zCoord; + } + } + else if (block.getMaterial() == Material.lava) + { + this.fogColorRed = 0.6F; + this.fogColorGreen = 0.1F; + this.fogColorBlue = 0.0F; + } + + float f9 = this.fogColor2 + (this.fogColor1 - this.fogColor2) * partialTicks; + this.fogColorRed *= f9; + this.fogColorGreen *= f9; + this.fogColorBlue *= f9; + double d2 = worldclient.provider.getVoidFogYFactor(); + double d1 = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks) * d2; + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) + { + int i = ((EntityLivingBase)entity).getActivePotionEffect(Potion.blindness).getDuration(); + + if (i < 20) + { + d1 *= (double)(1.0F - (float)i / 20.0F); + } + else + { + d1 = 0.0D; + } + } + + if (d1 < 1.0D) + { + if (d1 < 0.0D) + { + d1 = 0.0D; + } + + d1 = d1 * d1; + this.fogColorRed = (float)((double)this.fogColorRed * d1); + this.fogColorGreen = (float)((double)this.fogColorGreen * d1); + this.fogColorBlue = (float)((double)this.fogColorBlue * d1); + } + + if (this.bossColorModifier > 0.0F) + { + float f14 = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * partialTicks; + this.fogColorRed = this.fogColorRed * (1.0F - f14) + this.fogColorRed * 0.7F * f14; + this.fogColorGreen = this.fogColorGreen * (1.0F - f14) + this.fogColorGreen * 0.6F * f14; + this.fogColorBlue = this.fogColorBlue * (1.0F - f14) + this.fogColorBlue * 0.6F * f14; + } + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.nightVision)) + { + float f15 = this.getNightVisionBrightness((EntityLivingBase)entity, partialTicks); + float f6 = 1.0F / this.fogColorRed; + + if (f6 > 1.0F / this.fogColorGreen) + { + f6 = 1.0F / this.fogColorGreen; + } + + if (f6 > 1.0F / this.fogColorBlue) + { + f6 = 1.0F / this.fogColorBlue; + } + + this.fogColorRed = this.fogColorRed * (1.0F - f15) + this.fogColorRed * f6 * f15; + this.fogColorGreen = this.fogColorGreen * (1.0F - f15) + this.fogColorGreen * f6 * f15; + this.fogColorBlue = this.fogColorBlue * (1.0F - f15) + this.fogColorBlue * f6 * f15; + } + + if (this.mc.gameSettings.anaglyph) + { + float f16 = (this.fogColorRed * 30.0F + this.fogColorGreen * 59.0F + this.fogColorBlue * 11.0F) / 100.0F; + float f17 = (this.fogColorRed * 30.0F + this.fogColorGreen * 70.0F) / 100.0F; + float f7 = (this.fogColorRed * 30.0F + this.fogColorBlue * 70.0F) / 100.0F; + this.fogColorRed = f16; + this.fogColorGreen = f17; + this.fogColorBlue = f7; + } + + if (Reflector.EntityViewRenderEvent_FogColors_Constructor.exists()) + { + Object object = Reflector.newInstance(Reflector.EntityViewRenderEvent_FogColors_Constructor, new Object[] {this, entity, block, Float.valueOf(partialTicks), Float.valueOf(this.fogColorRed), Float.valueOf(this.fogColorGreen), Float.valueOf(this.fogColorBlue)}); + Reflector.postForgeBusEvent(object); + this.fogColorRed = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_FogColors_red, this.fogColorRed); + this.fogColorGreen = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_FogColors_green, this.fogColorGreen); + this.fogColorBlue = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_FogColors_blue, this.fogColorBlue); + } + + Shaders.setClearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); + } + + /** + * Sets up the fog to be rendered. If the arg passed in is -1 the fog starts at 0 and goes to 80% of far plane + * distance and is used for sky rendering. + */ + private void setupFog(int p_78468_1_, float partialTicks) + { + Entity entity = this.mc.getRenderViewEntity(); + boolean flag = false; + this.fogStandard = false; + + if (entity instanceof EntityPlayer) + { + flag = ((EntityPlayer)entity).capabilities.isCreativeMode; + } + + GL11.glFog(GL11.GL_FOG_COLOR, (FloatBuffer)this.setFogColorBuffer(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F)); + GL11.glNormal3f(0.0F, -1.0F, 0.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + float f1 = -1.0F; + + if (Reflector.ForgeHooksClient_getFogDensity.exists()) + { + f1 = Reflector.callFloat(Reflector.ForgeHooksClient_getFogDensity, new Object[] {this, entity, block, Float.valueOf(partialTicks), Float.valueOf(0.1F)}); + } + + if (f1 >= 0.0F) + { + GlStateManager.setFogDensity(f1); + } + else if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) + { + float f2 = 5.0F; + int i = ((EntityLivingBase)entity).getActivePotionEffect(Potion.blindness).getDuration(); + + if (i < 20) + { + f2 = 5.0F + (this.farPlaneDistance - 5.0F) * (1.0F - (float)i / 20.0F); + } + + if (Config.isShaders()) + { + Shaders.setFog(9729); + } + else + { + GlStateManager.setFog(9729); + } + + if (p_78468_1_ == -1) + { + GlStateManager.setFogStart(0.0F); + GlStateManager.setFogEnd(f2 * 0.8F); + } + else + { + GlStateManager.setFogStart(f2 * 0.25F); + GlStateManager.setFogEnd(f2); + } + + if (GLContext.getCapabilities().GL_NV_fog_distance && Config.isFogFancy()) + { + GL11.glFogi(34138, 34139); + } + } + else if (this.cloudFog) + { + if (Config.isShaders()) + { + Shaders.setFog(2048); + } + else + { + GlStateManager.setFog(2048); + } + + GlStateManager.setFogDensity(0.1F); + } + else if (block.getMaterial() == Material.water) + { + if (Config.isShaders()) + { + Shaders.setFog(2048); + } + else + { + GlStateManager.setFog(2048); + } + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.waterBreathing)) + { + GlStateManager.setFogDensity(0.01F); + } + else + { + GlStateManager.setFogDensity(0.1F - (float)EnchantmentHelper.getRespiration(entity) * 0.03F); + } + + if (Config.isClearWater()) + { + GlStateManager.setFogDensity(0.02F); + } + } + else if (block.getMaterial() == Material.lava) + { + if (Config.isShaders()) + { + Shaders.setFog(2048); + } + else + { + GlStateManager.setFog(2048); + } + + GlStateManager.setFogDensity(2.0F); + } + else + { + float f = this.farPlaneDistance; + this.fogStandard = true; + + if (Config.isShaders()) + { + Shaders.setFog(9729); + } + else + { + GlStateManager.setFog(9729); + } + + if (p_78468_1_ == -1) + { + GlStateManager.setFogStart(0.0F); + GlStateManager.setFogEnd(f); + } + else + { + GlStateManager.setFogStart(f * Config.getFogStart()); + GlStateManager.setFogEnd(f); + } + + if (GLContext.getCapabilities().GL_NV_fog_distance) + { + if (Config.isFogFancy()) + { + GL11.glFogi(34138, 34139); + } + + if (Config.isFogFast()) + { + GL11.glFogi(34138, 34140); + } + } + + if (this.mc.theWorld.provider.doesXZShowFog((int)entity.posX, (int)entity.posZ)) + { + GlStateManager.setFogStart(f * 0.05F); + GlStateManager.setFogEnd(f); + } + + if (Reflector.ForgeHooksClient_onFogRender.exists()) + { + Reflector.callVoid(Reflector.ForgeHooksClient_onFogRender, new Object[] {this, entity, block, Float.valueOf(partialTicks), Integer.valueOf(p_78468_1_), Float.valueOf(f)}); + } + } + + GlStateManager.enableColorMaterial(); + GlStateManager.enableFog(); + GlStateManager.colorMaterial(1028, 4608); + } + + /** + * Update and return fogColorBuffer with the RGBA values passed as arguments + */ + private FloatBuffer setFogColorBuffer(float red, float green, float blue, float alpha) + { + if (Config.isShaders()) + { + Shaders.setFogColor(red, green, blue); + } + + this.fogColorBuffer.clear(); + this.fogColorBuffer.put(red).put(green).put(blue).put(alpha); + this.fogColorBuffer.flip(); + return this.fogColorBuffer; + } + + public MapItemRenderer getMapItemRenderer() + { + return this.theMapItemRenderer; + } + + private void waitForServerThread() + { + this.serverWaitTimeCurrent = 0; + + if (Config.isSmoothWorld() && Config.isSingleProcessor()) + { + if (this.mc.isIntegratedServerRunning()) + { + IntegratedServer integratedserver = this.mc.getIntegratedServer(); + + if (integratedserver != null) + { + boolean flag = this.mc.isGamePaused(); + + if (!flag && !(this.mc.currentScreen instanceof GuiDownloadTerrain)) + { + if (this.serverWaitTime > 0) + { + Lagometer.timerServer.start(); + Config.sleep((long)this.serverWaitTime); + Lagometer.timerServer.end(); + this.serverWaitTimeCurrent = this.serverWaitTime; + } + + long i = System.nanoTime() / 1000000L; + + if (this.lastServerTime != 0L && this.lastServerTicks != 0) + { + long j = i - this.lastServerTime; + + if (j < 0L) + { + this.lastServerTime = i; + j = 0L; + } + + if (j >= 50L) + { + this.lastServerTime = i; + int k = integratedserver.getTickCounter(); + int l = k - this.lastServerTicks; + + if (l < 0) + { + this.lastServerTicks = k; + l = 0; + } + + if (l < 1 && this.serverWaitTime < 100) + { + this.serverWaitTime += 2; + } + + if (l > 1 && this.serverWaitTime > 0) + { + --this.serverWaitTime; + } + + this.lastServerTicks = k; + } + } + else + { + this.lastServerTime = i; + this.lastServerTicks = integratedserver.getTickCounter(); + this.avgServerTickDiff = 1.0F; + this.avgServerTimeDiff = 50.0F; + } + } + else + { + if (this.mc.currentScreen instanceof GuiDownloadTerrain) + { + Config.sleep(20L); + } + + this.lastServerTime = 0L; + this.lastServerTicks = 0; + } + } + } + } + else + { + this.lastServerTime = 0L; + this.lastServerTicks = 0; + } + } + + private void frameInit() + { + if (!this.initialized) + { + TextureUtils.registerResourceListener(); + + if (Config.getBitsOs() == 64 && Config.getBitsJre() == 32) + { + Config.setNotify64BitJava(true); + } + + this.initialized = true; + } + + Config.checkDisplayMode(); + World world = this.mc.theWorld; + + if (world != null) + { + if (Config.getNewRelease() != null) + { + String s = "HD_U".replace("HD_U", "HD Ultra").replace("L", "Light"); + String s1 = s + " " + Config.getNewRelease(); + ChatComponentText chatcomponenttext = new ChatComponentText(I18n.format("of.message.newVersion", new Object[] {s1})); + this.mc.ingameGUI.getChatGUI().printChatMessage(chatcomponenttext); + Config.setNewRelease((String)null); + } + + if (Config.isNotify64BitJava()) + { + Config.setNotify64BitJava(false); + ChatComponentText chatcomponenttext1 = new ChatComponentText(I18n.format("of.message.java64Bit", new Object[0])); + this.mc.ingameGUI.getChatGUI().printChatMessage(chatcomponenttext1); + } + } + + if (this.mc.currentScreen instanceof MainMenu) + { + this.updateMainMenu((MainMenu)this.mc.currentScreen); + } + + if (this.updatedWorld != world) + { + RandomMobs.worldChanged(this.updatedWorld, world); + Config.updateThreadPriorities(); + this.lastServerTime = 0L; + this.lastServerTicks = 0; + this.updatedWorld = world; + } + + if (!this.setFxaaShader(Shaders.configAntialiasingLevel)) + { + Shaders.configAntialiasingLevel = 0; + } + } + + private void frameFinish() + { + if (this.mc.theWorld != null) + { + long i = System.currentTimeMillis(); + + if (i > this.lastErrorCheckTimeMs + 10000L) + { + this.lastErrorCheckTimeMs = i; + int j = GL11.glGetError(); + + if (j != 0) + { + String s = GLU.gluErrorString(j); + ChatComponentText chatcomponenttext = new ChatComponentText(I18n.format("of.message.openglError", new Object[] {Integer.valueOf(j), s})); + this.mc.ingameGUI.getChatGUI().printChatMessage(chatcomponenttext); + } + } + } + } + + private void updateMainMenu(MainMenu p_updateMainMenu_1_) + { + try + { + String s = null; + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + int i = calendar.get(5); + int j = calendar.get(2) + 1; + + if (i == 8 && j == 4) + { + s = "Happy birthday, OptiFine!"; + } + + if (i == 14 && j == 8) + { + s = "Happy birthday, sp614x!"; + } + + if (s == null) + { + return; + } + + Field[] afield = MainMenu.class.getDeclaredFields(); + + for (int k = 0; k < afield.length; ++k) + { + if (afield[k].getType() == String.class) + { + afield[k].setAccessible(true); + afield[k].set(p_updateMainMenu_1_, s); + break; + } + } + } + catch (Throwable var8) + { + ; + } + } + + public boolean setFxaaShader(int p_setFxaaShader_1_) + { + if (!OpenGlHelper.isFramebufferEnabled()) + { + return false; + } + else if (this.theShaderGroup != null && this.theShaderGroup != this.fxaaShaders[2] && this.theShaderGroup != this.fxaaShaders[4]) + { + return true; + } + else if (p_setFxaaShader_1_ != 2 && p_setFxaaShader_1_ != 4) + { + if (this.theShaderGroup == null) + { + return true; + } + else + { + this.theShaderGroup.deleteShaderGroup(); + this.theShaderGroup = null; + return true; + } + } + else if (this.theShaderGroup != null && this.theShaderGroup == this.fxaaShaders[p_setFxaaShader_1_]) + { + return true; + } + else if (this.mc.theWorld == null) + { + return true; + } + else + { + this.loadShader(new ResourceLocation("shaders/post/fxaa_of_" + p_setFxaaShader_1_ + "x.json")); + this.fxaaShaders[p_setFxaaShader_1_] = this.theShaderGroup; + return this.useShader; + } + } +} diff --git a/src/LayerCape.java b/src/LayerCape.java new file mode 100644 index 0000000..3f2ee1e --- /dev/null +++ b/src/LayerCape.java @@ -0,0 +1,254 @@ +package net.minecraft.client.renderer.entity.layers; + +import animeware.cosmetic.CapeChecker; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class LayerCape implements LayerRenderer +{ + private final RenderPlayer playerRenderer; + private static final String __OBFID = "CL_00002425"; + + public LayerCape(RenderPlayer playerRendererIn) + { + this.playerRenderer = playerRendererIn; + } + + public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE) && CapeChecker.ownsOwnerCape(entitylivingbaseIn)) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/ownercape.png")); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 165.0F) + { + f2 = 165.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + GlStateManager.translate(0.0F, 0.142F, -0.0178F); + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + + else if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE) && CapeChecker.ownsYtCape(entitylivingbaseIn)) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/yt.png")); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 165.0F) + { + f2 = 165.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + GlStateManager.translate(0.0F, 0.142F, -0.0178F); + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + + else if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE) && CapeChecker.ownsQuickCape(entitylivingbaseIn)) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/quick.png")); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 165.0F) + { + f2 = 165.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + GlStateManager.translate(0.0F, 0.142F, -0.0178F); + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + + else if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE) && CapeChecker.ownsDevCape(entitylivingbaseIn)) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/devcape.png")); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 165.0F) + { + f2 = 165.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + GlStateManager.translate(0.0F, 0.142F, -0.0178F); + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + + else if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE) && CapeChecker.ownsZeroTwoCape(entitylivingbaseIn)) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/cape.png")); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 165.0F) + { + f2 = 165.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + GlStateManager.translate(0.0F, 0.142F, -0.0178F); + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + } + + public boolean shouldCombineTextures() + { + return false; + } + + public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + this.doRenderLayer((AbstractClientPlayer)entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale); + } +} diff --git a/src/LayerCapeidk.java b/src/LayerCapeidk.java new file mode 100644 index 0000000..ccf412e --- /dev/null +++ b/src/LayerCapeidk.java @@ -0,0 +1,255 @@ + + +import animeware.cosmetic.CapeChecker; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class LayerCape implements LayerRenderer +{ + private final RenderPlayer playerRenderer; + private static final String __OBFID = "CL_00002425"; + + public LayerCape(RenderPlayer playerRendererIn) + { + this.playerRenderer = playerRendererIn; + } + + public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE) && CapeChecker.ownsOwnerCape(entitylivingbaseIn)) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/ownercape.png")); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 165.0F) + { + f2 = 165.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + GlStateManager.translate(0.0F, 0.142F, -0.0178F); + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + + else if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE) && CapeChecker.ownsYtCape(entitylivingbaseIn)) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/yt.png")); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 165.0F) + { + f2 = 165.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + GlStateManager.translate(0.0F, 0.142F, -0.0178F); + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + + else if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE) && CapeChecker.ownsQuickCape(entitylivingbaseIn)) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/quick.png")); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 165.0F) + { + f2 = 165.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + GlStateManager.translate(0.0F, 0.142F, -0.0178F); + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + + else if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE) && CapeChecker.ownsDevCape(entitylivingbaseIn)) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/devcape.png")); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 165.0F) + { + f2 = 165.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + GlStateManager.translate(0.0F, 0.142F, -0.0178F); + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + + else if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE) && CapeChecker.ownsZeroTwoCape(entitylivingbaseIn)) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/cape.png")); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 165.0F) + { + f2 = 165.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + GlStateManager.translate(0.0F, 0.142F, -0.0178F); + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + } + + public boolean shouldCombineTextures() + { + return false; + } + + public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + this.doRenderLayer((AbstractClientPlayer)entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale); + } +} diff --git a/src/RenderTNTPrimed.java b/src/RenderTNTPrimed.java new file mode 100644 index 0000000..e330d65 --- /dev/null +++ b/src/RenderTNTPrimed.java @@ -0,0 +1,77 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class RenderTNTPrimed extends Render +{ + public RenderTNTPrimed(RenderManager renderManagerIn) + { + super(renderManagerIn); + this.shadowSize = 0.5F; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityTNTPrimed entity, double x, double y, double z, float entityYaw, float partialTicks) + { + BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y + 0.5F, (float)z); + + if ((float)entity.fuse - partialTicks + 1.0F < 10.0F) + { + float f = 1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 10.0F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + f = f * f; + f = f * f; + float f1 = 1.0F + f * 0.3F; + GlStateManager.scale(f1, f1, f1); + } + + float f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F; + this.bindEntityTexture(entity); + GlStateManager.translate(-0.5F, -0.5F, 0.5F); + blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), entity.getBrightness(partialTicks)); + GlStateManager.translate(0.0F, 0.0F, 1.0F); + + if (entity.fuse / 5 % 2 == 0) + { + GlStateManager.disableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 772); + GlStateManager.color(1.0F, 1.0F, 1.0F, f2); + GlStateManager.doPolygonOffset(-3.0F, -3.0F); + GlStateManager.enablePolygonOffset(); + blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), 1.0F); + GlStateManager.doPolygonOffset(0.0F, 0.0F); + GlStateManager.disablePolygonOffset(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + GlStateManager.enableLighting(); + GlStateManager.enableTexture2D(); + } + + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityTNTPrimed entity) + { + return TextureMap.locationBlocksTexture; + } +} diff --git a/src/animewarenoassets.zip b/src/animewarenoassets.zip new file mode 100644 index 0000000..6a80dc4 Binary files /dev/null and b/src/animewarenoassets.zip differ diff --git a/src/dis app id.txt b/src/dis app id.txt new file mode 100644 index 0000000..21afdf6 --- /dev/null +++ b/src/dis app id.txt @@ -0,0 +1 @@ +906999474130391040 \ No newline at end of file diff --git a/src/minecraft/Start.bat b/src/minecraft/Start.bat new file mode 100644 index 0000000..ae0025f --- /dev/null +++ b/src/minecraft/Start.bat @@ -0,0 +1,20 @@ +import java.io.File; +import java.lang.reflect.Field; +import java.util.Arrays; + +import net.minecraft.client.main.Main; + +public class Start +{ + public static void main(String[] args) + { + Main.main(concat(new String[] {"--version", "mcp", "--accessToken", "0", "--assetsDir", "assets", "--assetIndex", "1.8", "--userProperties", "{}"}, args)); + } + + public static T[] concat(T[] first, T[] second) + { + T[] result = Arrays.copyOf(first, first.length + second.length); + System.arraycopy(second, 0, result, first.length, second.length); + return result; + } +} diff --git a/src/minecraft/Start.java b/src/minecraft/Start.java new file mode 100644 index 0000000..ae0025f --- /dev/null +++ b/src/minecraft/Start.java @@ -0,0 +1,20 @@ +import java.io.File; +import java.lang.reflect.Field; +import java.util.Arrays; + +import net.minecraft.client.main.Main; + +public class Start +{ + public static void main(String[] args) + { + Main.main(concat(new String[] {"--version", "mcp", "--accessToken", "0", "--assetsDir", "assets", "--assetIndex", "1.8", "--userProperties", "{}"}, args)); + } + + public static T[] concat(T[] first, T[] second) + { + T[] result = Arrays.copyOf(first, first.length + second.length); + System.arraycopy(second, 0, result, first.length, second.length); + return result; + } +} diff --git a/src/minecraft/animeware/DiscordRP.java b/src/minecraft/animeware/DiscordRP.java new file mode 100644 index 0000000..8460fb1 --- /dev/null +++ b/src/minecraft/animeware/DiscordRP.java @@ -0,0 +1,102 @@ +package animeware; + +import org.lwjgl.opengl.APPLEYcbcr422; + +import com.mojang.authlib.GameProfile; + +import animeware.util.lukflug.Toggleable; +import net.arikia.dev.drpc.DiscordEventHandlers; +import net.arikia.dev.drpc.DiscordRPC; +import net.arikia.dev.drpc.DiscordRichPresence; +import net.arikia.dev.drpc.DiscordUser; +import net.arikia.dev.drpc.callbacks.ReadyCallback; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.entity.player.EntityPlayer; + +public class DiscordRP { + + private boolean running = true; + private long created = 0; + private final GameProfile gameProfile = null; + + public static String id; + public static String idOwner = "Hypnomacka#4765"; + + public void start( ) { + + this.created = System.currentTimeMillis(); + + DiscordEventHandlers handlers = new DiscordEventHandlers.Builder().setReadyEventHandler(new ReadyCallback() { + + + + @Override + public void apply(DiscordUser user) { + DiscordRP.id = user.username + "#" + user.discriminator; + + System.out.println("id = " + user.username + "#" + user.discriminator + " - " + (Minecraft.getMinecraft().getSession().getUsername())); + if(user.username != "null") { + NightSky.DisName = user.username; + } else { + NightSky.DisName = NightSky.mcname; + } + if(user.discriminator != "") { + NightSky.DisTag = "#" + user.discriminator; + } else { + NightSky.DisTag = "#0000"; + } + //System.out.println("-_-"); + update("Starting", ""); + } + + }).build(); + + DiscordRPC.discordInitialize("934484321417445437", handlers, true); + + new Thread("DRPC Callback") { + + @Override + public void run() { + + while(running) { + DiscordRPC.discordRunCallbacks(); + //PanelManager.showComponent(); + } + + } + + }.start(); + + } + public void shutdown() { + running = false; + DiscordRPC.discordShutdown(); + + } + private String getImager() { + if(Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka")) { + return "owner"; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("KnownAsR3named")) { + return "staff"; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("_Marto__")) { + return "yt"; + } else { + return "large"; + } + } + public void update(String firstLine, String secondLine) { + DiscordRichPresence.Builder b = new DiscordRichPresence.Builder(secondLine); + + b.setBigImage("large", ""); + b.setDetails(firstLine); + b.setStartTimestamps(created); + + DiscordRPC.discordUpdatePresence(b.build()); + } + public static String getDiscordName(DiscordUser user) { + + return user.username + "#" + user.discriminator; + + } +} diff --git a/src/minecraft/animeware/NightSky.java b/src/minecraft/animeware/NightSky.java new file mode 100644 index 0000000..1fd82f6 --- /dev/null +++ b/src/minecraft/animeware/NightSky.java @@ -0,0 +1,308 @@ + +/* + * This client was created by Hypnomacka using QickDaffys tutorials as base and snippets of code from his discord server + */ + +package animeware; + +import java.awt.Color; +import java.util.ArrayList; + +import org.lwjgl.LWJGLException; +import org.lwjgl.opengl.Display; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticController; +import animeware.cosmetic.CosmeticManager; +import animeware.cosmetic.impl.Cape; +import animeware.event.Event; +import animeware.event.EventManager; +import animeware.event.EventTarget; +import animeware.event.impl.ClientTick; +import animeware.event.impl.EventUpdate; +import animeware.gui.alt.AltManager; +import animeware.gui.clickgui.ClickGUI; +import animeware.gui.clickgui.GUIType; +import animeware.hud.mod.Freelook; +import animeware.hud.mod.HudManager; +import animeware.hud.mod.HudMod; +import animeware.login.Users; +import animeware.ui.themes.impl.ThemeManager; +import animeware.util.account.Account; +import animeware.util.backend.AntiCheat; +import animeware.util.config.AccountConfig; +import animeware.util.config.Config; +import animeware.util.config.SaveLoad; +import animeware.util.cosmetic.AnimUtil; +import animeware.util.font.FontUtil; +import animeware.util.notification.Notification; +import animeware.util.notification.NotificationManager; +import animeware.util.websockets.user.CheckName; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ChatComponentText; + +public class NightSky { + + //public static boolean SwordAnim = false; + public String NAME = "NightSky", VERSION = "(b-5.0Nn-Cg/master)", AUTHOR = "hypnomacka", NAMEVER = NAME + " " + VERSION, VERSIONSIMPLE = "5.0"; + public static NightSky INSTANCE = new NightSky(); + public Minecraft mc = Minecraft.getMinecraft(); + public static String mcname = Minecraft.getMinecraft().getSession().getUsername(); + private DiscordRP discordRP = new DiscordRP(); + public static String DisName; + public static String DisTag; + //public Configuration config, configSaving = ConfigurationAPI.newConfiguration(new File("/test.aw")); + private HudMod m; + private Event e; + + boolean cracked = false; + + + public static boolean isUser; + + private int previousF5 = 0; + + private final AccountConfig accountConfig = new AccountConfig(); + + public EventManager eventManager; + public Config config; + //public AccountConfig accConfig; + public HudManager hudManager; + public AltManager altManager; + public Users users; + public CosmeticController cosmeticController; + public Cape cape; + public Notification notif; + public CosmeticManager cosManager; + public ThemeManager themeManager; + //public Setting setting; + public NotificationManager manager; + public SaveLoad saveLoad; + //public Account acc; + + + + //public static NetworkClient networkClient; + //public ParticleEngine particleEngine; + public static boolean hasSent; + + public static boolean results; + + public float cameraYaw = 0f; + public float cameraPitch = 0f; + + //public static String encryptionString = "austinsexyforehead9VsTDGMOvDsEOByAZn9b6XFTE1hrPRUTDqQyy0NSCgbF2UVAKBTMCboHfUIOagja5FI3r5edsS9ek9dw"; + + public void startup() { + + + eventManager = new EventManager(); + //config = new Config(); + + //accountConfig.load(); + this.accountConfig.load(); + config = new Config(); + + config.loadModConfig(); + + //accConfig = new AccountConfig(); + + + + hudManager = new HudManager(); + altManager = new AltManager(); + users = new Users(); + cosmeticController = new CosmeticController(); + cape = new Cape(null); + cosManager = new CosmeticManager(); + themeManager = new ThemeManager(); + //setting = new Setting(); + manager = new NotificationManager(); + saveLoad = new SaveLoad("nightsky"); + //acc = new Account(mc.thePlayer.getName(), "", "aeef7bc935f9420eb6314dea7ad7e1e5", mc.thePlayer.getUniqueID().toString(), false); + + this.INSTANCE.hudManager.WindowedFullscreen.onEnable(); + + //AltButton.name = mc.fontRendererObj.getStringWidth(mc.thePlayer.getGameProfile().getName()); + + //System.out.println(hudManager.hudMods); + + if(AntiCheat.checkVape() == true) { + Booleans.ban = true; + + } + //this.DisName = DiscordRP.getDiscordName(null); + + ClickGUI.ownerCheck(); + + NightSky.INSTANCE.getDiscordRP().update("Starting...", NAME + " " + VERSION); + + + + discordRP.start(); + + System.out.println("Starting... " + NAMEVER + " by " + AUTHOR); + + + Display.setTitle(NAMEVER); + + FontUtil.bootstrap(); + + //SessionChanger.getInstance().setUserOffline("hypnomacka"); + + eventManager.register(this); + + + + } + + public static ArrayList accountManager = new ArrayList<>(); + + public void addAccount(Account account) { + for (Account acc : accountManager) { + if (acc.getUsername().equals(account.getUsername())) { + System.out.println("Account with username " + account.getUsername() + " already exists!"); + return; + } + } + accountManager.add(account); + } + + public String getNameString() { + return mc.thePlayer.getName().toString(); + } + + public void shutdown() { + this.accountConfig.save(); + config.saveModConfig(); + //accountConfig.save(); + System.out.println("Shutting down " + NAMEVER); + + discordRP.shutdown(); + + //SaveLoad.save + + CheckName.DoShutDownCheck(); + + + + eventManager.unregister(this); + } + + private void init() throws LWJGLException { + /*if(mc.isFullScreen()) { + System.setProperty("org.lwjgl.opengl.Window.undecorated", "true"); + Display.setDisplayMode(Display.getDesktopDisplayMode()); + Display.setLocation(0, 0); + Display.setFullscreen(false); + Display.setResizable(false); + } else { + System.setProperty("org.lwjgl.opengl.Window.undecorated", "false"); + Display.setDisplayMode(new DisplayMode(mc.displayWidth, mc.displayHeight)); + Display.setResizable(true); + }*/ + + } + public final Color getClientColor() { + return new Color(236, 133, 209); + } + + public final Color getAlternateClientColor() { + return new Color(28, 167, 222); + } + + + public float getCameraYaw() + { + return Freelook.freelooking ? cameraYaw : mc.thePlayer.rotationYaw; + } + + public float getCameraPitch() + { + return Freelook.freelooking ? cameraPitch : mc.thePlayer.rotationPitch; + } + public boolean overrideMouse() + { + if (mc.inGameHasFocus && Display.isActive()) + { + if (!Freelook.freelooking) + { + return true; + } + + // CODE + mc.mouseHelper.mouseXYChange(); + float f1 = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; + float f2 = f1 * f1 * f1 * 8.0F; + float f3 = (float) mc.mouseHelper.deltaX * f2; + float f4 = (float) mc.mouseHelper.deltaY * f2; + + cameraYaw += f3 * 0.15F; + cameraPitch += f4 * 0.15F; + + if (cameraPitch > 90) cameraPitch = 90; + if (cameraPitch < -90) cameraPitch = -90; + } + + return false; + } + + @EventTarget + public void onTick(ClientTick event) { + if(mc.gameSettings.CLICK_GUI.isPressed()) { + if(!(ClickGUI.type == GUIType.SETTINGS)) { + mc.displayGuiScreen(new ClickGUI()); + + } else { + ClickGUI.type = GUIType.THEME; + mc.displayGuiScreen(new ClickGUI()); + } + + } + + } + public static final NightSky getInstance() { + return INSTANCE; + } + public Users getUsers() { + return users; + } + public void setUsers(Users users) { + this.users = users; + } + public DiscordRP getDiscordRP() { + return discordRP; + } + + @EventTarget + private void onUpdate(EventUpdate e) { + + AnimUtil.anim(e); + } + public static void sendMessage(String message) { + StringBuilder messageBuilder = new StringBuilder(); + + messageBuilder.append("&r<&bNightSky&r>").append("&r "); + + messageBuilder.append(message); + + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(messageBuilder.toString().replace("&", "\247"))); + } + public static Color getMainColor() { + return new Color(0, 150, 200, 255); + } + public static String rank() { + if(mcname.equals("hypnomacka")) { + return "bOwner"; + } else if(mcname.equals("_Marto__")) { + return "5YouTube"; + } else if(mcname.equals("KnownAsR3named")) { + return "4Staff"; + } else { + return "User"; + } + + + } + +} diff --git a/src/minecraft/animeware/ServerDataFeatured.java b/src/minecraft/animeware/ServerDataFeatured.java new file mode 100644 index 0000000..2ae8ecb --- /dev/null +++ b/src/minecraft/animeware/ServerDataFeatured.java @@ -0,0 +1,14 @@ +package animeware; + +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.util.ResourceLocation; + +public class ServerDataFeatured extends ServerData { + + public static final ResourceLocation SERVER_ICON = new ResourceLocation("Animeware/icons/server.png"); + + public ServerDataFeatured(String serverName, String serverIP) { + super(serverName, serverIP, false); + } + +} diff --git a/src/minecraft/animeware/cosmetic/Booleans.java b/src/minecraft/animeware/cosmetic/Booleans.java new file mode 100644 index 0000000..12c1965 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/Booleans.java @@ -0,0 +1,93 @@ +package animeware.cosmetic; + +public class Booleans { + + public static boolean isOwner; + public static boolean evening; + public static boolean morning; + public static boolean Cape1; + public static boolean Cape; + public static boolean PlanetsCape; + public static boolean QuavCape; + public static boolean ReptyllCape; + public static boolean SwordCape; + public static boolean EmeraldCape; + public static boolean LCape; + public static boolean NitroCape; + public static boolean DarkCape; + public static boolean Sparkofyt; + public static boolean Sparkofyt2; + public static boolean CosmeticEasterEggs; + public static boolean Susanoo; + public static boolean CosmeticWitchHat; + public static boolean SkinChanger; + public static boolean CrystalWings; + public static boolean GradientBlack; + public static boolean GradientBlue; + public static boolean GradientGreen; + public static boolean GradientPurple; + public static boolean GradientRed; + public static boolean tanjirocape; + public static boolean kocho2cape; + public static boolean kocho3cape; + public static boolean dseyes2cape; + public static boolean dseyescape; + public static boolean wintercape; + public static boolean glasses; + public static boolean retardEyes; + public static boolean DevCape; + public static boolean QuickCape; + public static boolean OwnerCape; + public static boolean YTCape; + public static boolean CosmeticWings; + public static boolean GalaxyWings; + public static boolean Halo; + public static boolean TopHat; + public static boolean Blaze; + public static boolean Bandana; + public static boolean CreeperLightning; + public static boolean EnchantingGlint; + public static boolean Witherpet; + public static boolean ChinaHat; + public static boolean RinneCape; + public static boolean ModArmorStatus; + public static boolean SwordAnim; + public static boolean Hitbox; + public static boolean ModBossbar; + public static boolean TNTTimer; + public static boolean ScrollZoom; + public static boolean BlockOverlay; + public static boolean ToggleSprint; + public static boolean FPSMod; + public static boolean BlockOverlayPurple; + public static boolean BlockOverlayRed; + public static boolean BlockOverlayWhite; + public static boolean BlockOverlayBlue; + public static boolean BlockOverlayCyan; + public static boolean BlockOverlayChroma; + public static boolean random; + public static boolean direction; + public static boolean DynamicFOV; + public static boolean blur; + public static boolean itemphys; + public static boolean MoreParticles; + public static boolean SmallSword; + public static boolean SwordSpin; + public static boolean ban; + public static boolean watermark; + public static boolean night; + public static boolean day; + public static boolean timechanger; + public static boolean freelook; + public static boolean notification; + public static boolean nickhider; + public static boolean Winter; + public static boolean HitColor; + public static boolean HitColorRed; + public static boolean HitColorBlue; + public static boolean HitColorCyan; + public static boolean HitColorPurple; + public static boolean HitColorChroma; + public static boolean minimalBobbing; + +} diff --git a/src/minecraft/animeware/cosmetic/Cosmetic.java b/src/minecraft/animeware/cosmetic/Cosmetic.java new file mode 100644 index 0000000..b5b05f7 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/Cosmetic.java @@ -0,0 +1,141 @@ +package animeware.cosmetic; + +import animeware.hud.Category; +import animeware.util.lukflug.Toggleable; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.util.ResourceLocation; + +public abstract class Cosmetic implements LayerRenderer, Toggleable { + + public static RenderPlayer playerRenderer; + public static Minecraft mc = Minecraft.getMinecraft(); + //public static Cosmetic INSTANCE = new Cosmetic(); + + public static String name; + public static boolean cape; + public static boolean quavcape; + public boolean wearing; + public boolean owns; + public Category c; + + public String location; + + public boolean state; + + public float prog = 0.0F, anim = 22.0F; + + public float dragY; + + public float dragX; + + + + public Cosmetic(String name, String location) { + this.name = name; + this.location = location; + } + + public void render(float ticks) {} + + public void toggle() { + this.state = !this.state; + } + + public void setLocation(String in) { + this.location = in; + } + + public ResourceLocation getLocation() { + return new ResourceLocation(this.location); + } + + + + + public Cosmetic(String name, boolean cape, RenderPlayer playerRenderer) { + this.name = name; + this.cape = cape; + this.playerRenderer = playerRenderer; + } + public static RenderPlayer getPlayerRenderer() { + return playerRenderer; + } + + public static Minecraft getMc() { + return mc; + } + + public static String getName() { + return name; + } + + public static boolean isCape() { + return cape; + } + + public boolean isOwns() { + return owns; + } + + public Category getC() { + return c; + } + + public void setWearing(boolean newWearing) { + wearing = newWearing; + } + + public boolean isWearing() { + return wearing; + } + + public void toggleWearing() { + if(owns) { + wearing = !wearing; + } + } + + public static boolean ownsCosmetic() { + return false; + } + + /*@Override + public void toggle() { + if(owns) { + wearing = !wearing; + } + + }*/ + + @Override + public boolean isOn() { + return wearing && owns; + } + + @Override + public void doRenderLayer(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, + float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + + if(player.hasPlayerInfo() && !player.isInvisible()) { + render(player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale); + } + + } + + public abstract void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, + float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale); + + @Override + public boolean shouldCombineTextures() { + return false; + } + public Category getCategory() { + return c; + + } + + +} diff --git a/src/minecraft/animeware/cosmetic/CosmeticBase.java b/src/minecraft/animeware/cosmetic/CosmeticBase.java new file mode 100644 index 0000000..e251cdb --- /dev/null +++ b/src/minecraft/animeware/cosmetic/CosmeticBase.java @@ -0,0 +1,29 @@ +package animeware.cosmetic; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; + +public abstract class CosmeticBase implements LayerRenderer +{ + protected final RenderPlayer renderPlayer; + + public CosmeticBase(final RenderPlayer player) { + this.renderPlayer = player; + } + + @Override + public void doRenderLayer(final AbstractClientPlayer player, final float limbSwing, final float limbSwingAmount, final float partialTicks, final float ageInTicks, final float headYaw, final float headPitch, final float scale) { + if (player.hasPlayerInfo() && !player.isInvisible()) { + this.render(player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, headYaw, headPitch, scale); + } + } + + @Override + public boolean shouldCombineTextures() { + return false; + } + + public abstract void render(final AbstractClientPlayer p0, final float p1, final float p2, final float p3, final float p4, final float p5, final float p6, final float p7); +} diff --git a/src/minecraft/animeware/cosmetic/CosmeticChecker.java b/src/minecraft/animeware/cosmetic/CosmeticChecker.java new file mode 100644 index 0000000..6695a54 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/CosmeticChecker.java @@ -0,0 +1,301 @@ +package animeware.cosmetic; + +import animeware.NightSky; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; + +public class CosmeticChecker { + + public static boolean ownsOwnerCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka")) { + return true; + } + + + + + else return false; + } + public static boolean ownsYtCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("_Marto__")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("quickDaffy")) { + return true; + } + + + + + else return false; + } + + public static boolean ownsQuickCape(AbstractClientPlayer entityln) { + /*if(Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka")) { + return true; + } else */if(Minecraft.getMinecraft().thePlayer.getName().equals("quickDaffy")) { + return true; + } + + + + + else return false; + } + public static boolean ownsDevCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("abcdegh8")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("KnownAsR3named")) { + return true; + }else if(Minecraft.getMinecraft().thePlayer.getName().equals("Slepica")) { + return true; + } + + + + + else return false; + } + public static boolean isDev(T entity) { + if(Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("abcdegh8")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("KnownAsR3named")) { + return true; + }else if(Minecraft.getMinecraft().thePlayer.getName().equals("Slepica")) { + return true; + } + + + + + else return false; + } + + public static boolean ownsZeroTwoCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals(NightSky.mcname)) { + return true; + } + + + + + + else return false; + } + public static boolean ownsOzhayCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + + + + + + else return false; + } + public static boolean ownsPlanetsCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + + + + + + else return false; + } + public static boolean ownsQuavCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + + + + + + else return false; + } + public static boolean ownsReptyllCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + + + + + + else return false; + } + public static boolean ownsSwordCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + + + + + + else return false; + } + public static boolean ownsEmeraldCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + + + + + + else return false; + } + public static boolean ownsLCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + + + + + + else return false; + } + public static boolean ownsNitroCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + + + + + + else return false; + } + public static boolean ownsDarkCape(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + + + + + + else return false; + } + public static boolean ownsWings(AbstractClientPlayer entityln) { + /*if(Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("quickDaffy")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("KnownAsR3named")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("MartoSVK")) { + return true; + }*/ + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + + + else return false; + } + public static boolean ownsHat(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("quickDaffy")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("KnownAsR3named")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("_Marto__")) { + return true; + } + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + + + else return false; + } + public static boolean ownsHalo(AbstractClientPlayer entityln) { + /*if(Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka")) { + return true; + } else */if(Minecraft.getMinecraft().thePlayer.getName().equals("_Marto__")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("KnownAsR3named")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("quickDaffy")) { + return true; + } + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + + + + + else return false; + } + public static boolean ownsBadge(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } + else return false; + } + public static boolean ownsDevBadge(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals("KnownAsR3named")) { + return true; + } + if(Minecraft.getMinecraft().thePlayer.getName().equals("Slepica")) { + return true; + } + if(Minecraft.getMinecraft().thePlayer.getName().equals("abcdefgh8")) { + return true; + } + if(Minecraft.getMinecraft().thePlayer.getName().equals("quickDaffy")) { + return true; + } + else return false; + } + public static boolean ownsMartoBadge(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals("_Marto__")) { + return true; + } + else return false; + } + public static boolean ownsOwnerBadge(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka")) { + return true; + } + else return false; + } + public static boolean ownsGalaxyWings(AbstractClientPlayer entityln) { + if(Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("_Marto__")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("KnownAsR3named")) { + return true; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("quickDaffy")) { + return true; + } + + + + + + else return false; + } + + public static float[] getTopHatColor(AbstractClientPlayer player) { + return new float[] {1, 1, 1}; + } + public static float[] getHaloColor(AbstractClientPlayer player) { + return new float[] {0, 0, 1}; + } + + +} diff --git a/src/minecraft/animeware/cosmetic/CosmeticController.java b/src/minecraft/animeware/cosmetic/CosmeticController.java new file mode 100644 index 0000000..62a732e --- /dev/null +++ b/src/minecraft/animeware/cosmetic/CosmeticController.java @@ -0,0 +1,78 @@ +package animeware.cosmetic; + +import java.lang.reflect.Array; +import java.util.ArrayList; + +import animeware.cosmetic.impl.TopHat; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; + +public class CosmeticController { + + public Minecraft mc = Minecraft.getMinecraft(); + + + + public static boolean shouldRenderOwnerCape(AbstractClientPlayer player) { + //if(CosmeticManager.ownerCape.isWearing() && CosmeticManager.ownerCape.ownsCosmetic()) { + if(player.getName().equals("hypnomacka")) { + return true; + } else { + return false; + } + } + public static boolean shouldRenderQuickCape(AbstractClientPlayer player) { + //if(CosmeticManager.quickCape.isWearing() && CosmeticManager.quickCape.ownsCosmetic()) { + if(player.getName().equals("quickDaffy")) { + return true; + } else { + return false; + } + } + public static boolean shouldRenderYTCape(AbstractClientPlayer player) { + //if(CosmeticManager.ytCape.isWearing() && CosmeticManager.ytCape.ownsCosmetic()) { + if(player.getName().equals("_Marto__")) { + return true; + } else { + return false; + } + } + public static boolean shouldRenderDevCape(AbstractClientPlayer player) { + //if(CosmeticManager.devCape.isWearing() && CosmeticManager.devCape.ownsCosmetic()) { + if(player.getName().equals("KnownAsR3named")) { + return true; + } else { + return false; + } + } + public static boolean shouldZeroTwoCape(AbstractClientPlayer player) { + //if(CosmeticManager.cape.isWearing() && CosmeticManager.cape.ownsCosmetic()) { + if(player.getName().equals(Minecraft.getMinecraft().getSession().getUsername())) { + return true; + } else { + return false; + } + } + /*public static boolean shouldRenderWings(AbstractClientPlayer entitylivingbaseIn) { + return false; + }*/ + public static boolean shouldRenderTopHat(AbstractClientPlayer player) { + //if(CosmeticManager.topHat.isWearing() && CosmeticManager.topHat.ownsCosmeticHat()) { + if(player.getName().equals("hypnomacka")) { + return true; + } else { + return false; + } + } + public static boolean shouldRenderHalo(AbstractClientPlayer player){ + if(player.getName().equals("hypnomacka")) { + return true; + } else { + return false; + } + + } + /*public static float[] getTopHatColor(AbstractClientPlayer player) { + return new float[] {1, 0, 0}; + }*/ +} diff --git a/src/minecraft/animeware/cosmetic/CosmeticManager.java b/src/minecraft/animeware/cosmetic/CosmeticManager.java new file mode 100644 index 0000000..9da5b87 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/CosmeticManager.java @@ -0,0 +1,158 @@ +package animeware.cosmetic; + +import java.util.ArrayList; + +import animeware.cosmetic.impl.ChinaHat; +import animeware.cosmetic.impl.CosmeticCreeperLightning; +import animeware.cosmetic.impl.CosmeticEnchantingGlint; +import animeware.cosmetic.impl.CosmeticWitherpet; +import animeware.cosmetic.impl.CosmeticMods.Bandana; +import animeware.cosmetic.impl.CosmeticMods.Blaze; +import animeware.cosmetic.impl.CosmeticMods.Cape; +import animeware.cosmetic.impl.CosmeticMods.ChinaHatModule; +import animeware.cosmetic.impl.CosmeticMods.CosmeticEasterEggs; +import animeware.cosmetic.impl.CosmeticMods.CosmeticWitchHat; +import animeware.cosmetic.impl.CosmeticMods.CreeperLight; +import animeware.cosmetic.impl.CosmeticMods.CrystalWings; +import animeware.cosmetic.impl.CosmeticMods.DarkCape; +import animeware.cosmetic.impl.CosmeticMods.DevCape; +import animeware.cosmetic.impl.CosmeticMods.DragonWings; +import animeware.cosmetic.impl.CosmeticMods.EmeraldCape; +import animeware.cosmetic.impl.CosmeticMods.EnchGlint; +import animeware.cosmetic.impl.CosmeticMods.GalaxyWings; +import animeware.cosmetic.impl.CosmeticMods.Glasses; +import animeware.cosmetic.impl.CosmeticMods.GradientBlack; +import animeware.cosmetic.impl.CosmeticMods.GradientBlue; +import animeware.cosmetic.impl.CosmeticMods.GradientGreen; +import animeware.cosmetic.impl.CosmeticMods.GradientPurple; +import animeware.cosmetic.impl.CosmeticMods.GradientRed; +import animeware.cosmetic.impl.CosmeticMods.Halo; +import animeware.cosmetic.impl.CosmeticMods.LCape; +import animeware.cosmetic.impl.CosmeticMods.NitroCape; +import animeware.cosmetic.impl.CosmeticMods.OwnerCape; +import animeware.cosmetic.impl.CosmeticMods.PlanetsCape; +import animeware.cosmetic.impl.CosmeticMods.QuavCape; +import animeware.cosmetic.impl.CosmeticMods.QuickCape; +import animeware.cosmetic.impl.CosmeticMods.ReptyllCape; +import animeware.cosmetic.impl.CosmeticMods.RetardEyes; +import animeware.cosmetic.impl.CosmeticMods.RinneCape; +import animeware.cosmetic.impl.CosmeticMods.Sparkofyt; +import animeware.cosmetic.impl.CosmeticMods.Sparkofyt2; +import animeware.cosmetic.impl.CosmeticMods.SwordCape; +import animeware.cosmetic.impl.CosmeticMods.WitherPet; +import animeware.cosmetic.impl.CosmeticMods.YTCape; +import animeware.cosmetic.impl.CosmeticMods.dseyes2cape; +import animeware.cosmetic.impl.CosmeticMods.dseyescape; +import animeware.cosmetic.impl.CosmeticMods.kocho2cape; +import animeware.cosmetic.impl.CosmeticMods.kocho3cape; +import animeware.cosmetic.impl.CosmeticMods.tanjirocape; + + +public class CosmeticManager { + + public static ArrayList cosmetics = new ArrayList<>(); + + public Cape zerotwo; + public DarkCape darkCape; + public dseyes2cape deamoneyes; + public dseyescape deamoneyes2; + public EmeraldCape ecape; + public GradientBlack gblack; + public GradientBlue gblue; + public GradientGreen ggreen; + public GradientPurple gpurple; + public GradientRed gred; + public kocho2cape kcape; + public kocho3cape kcape2; + public LCape lcape; + public NitroCape ncape; + public PlanetsCape pcape; + public QuavCape quavcape; + public QuickCape quickcape; + public ReptyllCape rcape; + public SwordCape scape; + public tanjirocape tcape; + public Sparkofyt sofyt; + public Sparkofyt2 sofyt2; + + public CrystalWings cwings; + public DragonWings dwings; + public GalaxyWings gwings; + + public CosmeticEasterEggs eggs; + public CosmeticWitchHat witchhat; + public Glasses glasses; + public Halo halo; + public RetardEyes retardeyes; + + public OwnerCape ownerCape; + public DevCape devCape; + public YTCape ytCape; + + public Blaze blaze; + + public Bandana ban; + public CreeperLight creeper; + //public ChinaHat ch; + public WitherPet wpet; + + public ChinaHatModule ch; + public RinneCape rinn; + + public CosmeticManager() { + cosmetics = new ArrayList<>(); + cosmetics.add(zerotwo = new Cape()); + cosmetics.add(darkCape = new DarkCape()); + cosmetics.add(deamoneyes = new dseyes2cape()); + cosmetics.add(deamoneyes2 = new dseyescape()); + cosmetics.add(ecape = new EmeraldCape()); + cosmetics.add(gblack = new GradientBlack()); + cosmetics.add(gblue = new GradientBlue()); + cosmetics.add(ggreen = new GradientGreen()); + cosmetics.add(gpurple = new GradientPurple()); + cosmetics.add(gred = new GradientRed()); + cosmetics.add(kcape = new kocho2cape()); + cosmetics.add(kcape2 = new kocho3cape()); + cosmetics.add(lcape = new LCape()); + cosmetics.add(ncape = new NitroCape()); + cosmetics.add(pcape = new PlanetsCape()); + cosmetics.add(quavcape = new QuavCape()); + cosmetics.add(quickcape = new QuickCape()); + cosmetics.add(rcape = new ReptyllCape()); + cosmetics.add(scape = new SwordCape()); + cosmetics.add(tcape = new tanjirocape()); + cosmetics.add(sofyt = new Sparkofyt()); + cosmetics.add(sofyt2 = new Sparkofyt2()); + + cosmetics.add(cwings = new CrystalWings()); + cosmetics.add(dwings = new DragonWings()); + cosmetics.add(gwings = new GalaxyWings()); + + cosmetics.add(eggs = new CosmeticEasterEggs()); + cosmetics.add(witchhat = new CosmeticWitchHat()); + cosmetics.add(glasses = new Glasses()); + cosmetics.add(halo = new Halo()); + cosmetics.add(retardeyes = new RetardEyes()); + + cosmetics.add(ownerCape = new OwnerCape()); + cosmetics.add(devCape = new DevCape()); + + cosmetics.add(blaze = new Blaze()); + + cosmetics.add(ban = new Bandana()); + cosmetics.add(creeper = new CreeperLight()); + //cosmetics.add(ch = new ChinaHat()); + cosmetics.add(wpet = new WitherPet()); + + cosmetics.add(ch = new ChinaHatModule()); + cosmetics.add(rinn = new RinneCape()); + + } + public static ArrayList getCosmetics() { + return cosmetics; + } + + +} + + diff --git a/src/minecraft/animeware/cosmetic/CosmeticModelBase.java b/src/minecraft/animeware/cosmetic/CosmeticModelBase.java new file mode 100644 index 0000000..a3f656f --- /dev/null +++ b/src/minecraft/animeware/cosmetic/CosmeticModelBase.java @@ -0,0 +1,17 @@ +package animeware.cosmetic; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.entity.RenderPlayer; + +public class CosmeticModelBase extends ModelBase { + + protected final ModelBiped playerModel; + + public CosmeticModelBase(RenderPlayer player) { + + this.playerModel = player.getMainModel(); + + } + +} \ No newline at end of file diff --git a/src/minecraft/animeware/cosmetic/CosmeticModule.java b/src/minecraft/animeware/cosmetic/CosmeticModule.java new file mode 100644 index 0000000..3eb78a7 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/CosmeticModule.java @@ -0,0 +1,180 @@ +package animeware.cosmetic; + +import java.util.List; + +import com.google.common.collect.Lists; + +import animeware.NightSky; +import animeware.event.EventManager; +import animeware.hud.DraggableComponent; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiLabel; +import net.minecraft.util.ResourceLocation; + +public class CosmeticModule { + + public Minecraft mc = Minecraft.getMinecraft(); + public FontRenderer fr = mc.fontRendererObj; + protected List buttonList = Lists.newArrayList(); + protected List labelList = Lists.newArrayList(); + + //public List settings = new ArrayList(); + + public int lenght = 10; + public String name; + //public String description; + public ResourceLocation iconcos; + public CosmeticType type; + //public boolean isEnabled = false; + public boolean enabled; + public DraggableComponent drag; + + public int x, y, w, h; + + public CosmeticModule(String name, ResourceLocation iconcos, CosmeticType type) { + this.name = name; + if(type == CosmeticType.CAPE) { + this.iconcos = new ResourceLocation("Animeware/icons/cape.png"); + } else if(type == CosmeticType.WINGS) { + this.iconcos = new ResourceLocation("Animeware/icons/blank.png"); + } else if(type == CosmeticType.HAT) { + this.iconcos = new ResourceLocation("Animeware/icons/blank.png"); + } else if(type == CosmeticType.PET) { + this.iconcos = new ResourceLocation("Animeware/icons/blank.png"); + } else if(type == CosmeticType.OTHER) { + this.iconcos = new ResourceLocation("Animeware/icons/blank.png"); + } else if(type == CosmeticType.BANDANA) { + this.iconcos = new ResourceLocation("Animeware/icons/blank.png"); + } else if(type == CosmeticType.ANIM) { + this.iconcos = new ResourceLocation("Animeware/icons/blank.png"); + } else if(name.equals("Rinnegan Cape - a")) { + this.iconcos = new ResourceLocation("Animeware/icons/cape.png"); + } else { + this.iconcos = new ResourceLocation("Animeware/icons/blank.png"); + } + this.type = type; + + try { + + setEnabled(((Boolean)NightSky.INSTANCE.config.config.get(String.valueOf(name.toLowerCase()) + " wearing"))); + + } catch (NullPointerException e) { + //System.out.println("CosConfig Load Failed - CosmeticManager = " + name); + e.printStackTrace(); + this.enabled = false; + } + + //drag = new DraggableComponent(this.x, this.y, getWidth(), getHeight(), new Color(0, 0, 0, 0).getRGB()); + } + + + public int getWidth() { + + return 50; + + } + + public int getHeight() { + return 50; + + } + public ResourceLocation getIcon() { + return iconcos; + } + + public void draw() { + + } + + public void renderDummy(int mouseX, int mouseY) { + drag.draw(mouseX, mouseY); + + } + + public int getX() { + return drag.getxPosition(); + } + + public int getY() { + return drag.getyPosition(); + } + + public void setEnabled(boolean enabled) { + /*if(!mc.thePlayer.getName().equals("hypnomacka") && this.name == "Owner Cape") { + + } else if(!mc.thePlayer.getName().equals("hypnomacka") || !mc.thePlayer.getName().equals("KnownAsR3named") || !mc.thePlayer.getName().equals("slepica") || !mc.thePlayer.getName().equals("Fofola") && this.name == "Staff Cape") { + + } else if(!mc.thePlayer.getName().equals("hypnomacka") || !mc.thePlayer.getName().equals("MartoSVK") && this.name == "YT Cape") { + + } else {*/ + this.enabled = enabled; + if(enabled) { + onEnable(); + } + else { + onDisable(); + } + //} + } + public void setDisabled(boolean enabled) { + this.enabled = !enabled; + if(!enabled) { + onDisable(); + } + else { + onEnable(); + } + } + + public void onEnable() {EventManager.register(this);} + + public void toggle() { + this.setEnabled(!enabled); + + } + + + + public boolean isEnabled() { + return enabled; + } + public boolean isDisabled() { + return !enabled; + } + + + public void onDisable() { + NightSky.INSTANCE.eventManager.unregister(this); + + } + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + for (int i = 0; i < this.buttonList.size(); ++i) + { + ((GuiButton)this.buttonList.get(i)).drawButton(this.mc, mouseX, mouseY); + } + + for (int j = 0; j < this.labelList.size(); ++j) + { + ((GuiLabel)this.labelList.get(j)).drawLabel(this.mc, mouseX, mouseY); + } + } + //@Override + public String getToggled() { + return "Toggled"; + } + public void Notif() { + + } + + +} + + + + + + + diff --git a/src/minecraft/animeware/cosmetic/CosmeticType.java b/src/minecraft/animeware/cosmetic/CosmeticType.java new file mode 100644 index 0000000..2297f70 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/CosmeticType.java @@ -0,0 +1,13 @@ +package animeware.cosmetic; + +public enum CosmeticType { + + CAPE, + WINGS, + HAT, + PET, + OTHER, + BANDANA, + ANIM; + +} diff --git a/src/minecraft/animeware/cosmetic/HatChecker.java b/src/minecraft/animeware/cosmetic/HatChecker.java new file mode 100644 index 0000000..398fe38 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/HatChecker.java @@ -0,0 +1,21 @@ +package animeware.cosmetic; + +import net.minecraft.client.entity.AbstractClientPlayer; + +public class HatChecker { + + public static boolean ownsHat(AbstractClientPlayer entitylivingbaseIn) { + if(entitylivingbaseIn.getName().equals("hypnomacka")) { + return true; + } + + + + + else return false; + } + public static float[] getTopHatColor(AbstractClientPlayer entitylivingbaseIn) { + return new float[] {1, 0, 1}; + } + +} diff --git a/src/minecraft/animeware/cosmetic/ServerShitCapes.java b/src/minecraft/animeware/cosmetic/ServerShitCapes.java new file mode 100644 index 0000000..bb74d35 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/ServerShitCapes.java @@ -0,0 +1,320 @@ +package animeware.cosmetic; + +import animeware.util.websockets.SocketClient; + +public class ServerShitCapes { + + public static boolean isWearingCape1(String username) { + String[] arguments = SocketClient.client.request("isWearingCape1", username).toString().split(":"); + if(arguments[0].equals("owns1") && Booleans.QuickCape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape2(String username) { + String[] arguments = SocketClient.client.request("isWearingCape2", username).toString().split(":"); + if(arguments[0].equals("owns2") && Booleans.PlanetsCape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape2 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape3(String username) { + String[] arguments = SocketClient.client.request("isWearingCape3", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.QuavCape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape3 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape4(String username) { + String[] arguments = SocketClient.client.request("isWearingCape4", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.ReptyllCape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape4 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape5(String username) { + String[] arguments = SocketClient.client.request("isWearingCape5", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.SwordCape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape5 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape6(String username) { + String[] arguments = SocketClient.client.request("isWearingCape6", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.EmeraldCape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape6 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape7(String username) { + String[] arguments = SocketClient.client.request("isWearingCape7", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.LCape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape7 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape8(String username) { + String[] arguments = SocketClient.client.request("isWearingCape8", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.NitroCape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape8 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape9(String username) { + String[] arguments = SocketClient.client.request("isWearingCape9", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.DarkCape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape9 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape10(String username) { + String[] arguments = SocketClient.client.request("isWearingCape10", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.Cape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape10 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape11(String username) { + String[] arguments = SocketClient.client.request("isWearingCape11", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.YTCape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape11 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape12(String username) { + String[] arguments = SocketClient.client.request("isWearingCape12", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.DevCape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape12 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape13(String username) { + String[] arguments = SocketClient.client.request("isWearingCape13", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.OwnerCape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape13 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape14(String username) { + String[] arguments = SocketClient.client.request("isWearingCape14", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.GradientBlack == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape14 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape15(String username) { + String[] arguments = SocketClient.client.request("isWearingCape15", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.GradientBlue == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape15 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape16(String username) { + String[] arguments = SocketClient.client.request("isWearingCape16", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.GradientGreen == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape16 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape17(String username) { + String[] arguments = SocketClient.client.request("isWearingCape17", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.GradientPurple == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape17 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape18(String username) { + String[] arguments = SocketClient.client.request("isWearingCape18", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.GradientRed == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape18 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape19(String username) { + String[] arguments = SocketClient.client.request("isWearingCape19", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.tanjirocape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape19 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape20(String username) { + String[] arguments = SocketClient.client.request("isWearingCape20", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.kocho2cape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape20 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape21(String username) { + String[] arguments = SocketClient.client.request("isWearingCape21", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.kocho3cape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape21 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape22(String username) { + String[] arguments = SocketClient.client.request("isWearingCape22", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.dseyes2cape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape22 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape23(String username) { + String[] arguments = SocketClient.client.request("isWearingCape23", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.dseyescape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape23 = there was an error for " + username); + return false; + } + } + public static boolean isWearingCape24(String username) { + String[] arguments = SocketClient.client.request("isWearingCape24", username).toString().split(":"); + if(arguments[0].equals("owns") && Booleans.wintercape == true) { + //System.out.println("isWearingCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingCape24 = there was an error for " + username); + return false; + } + } + +} diff --git a/src/minecraft/animeware/cosmetic/ServerShitOther.java b/src/minecraft/animeware/cosmetic/ServerShitOther.java new file mode 100644 index 0000000..7a33e8a --- /dev/null +++ b/src/minecraft/animeware/cosmetic/ServerShitOther.java @@ -0,0 +1,21 @@ +package animeware.cosmetic; + +import animeware.util.websockets.SocketClient; + +public class ServerShitOther { + + public static boolean isWearingQuickCape(String username) { + String[] arguments = SocketClient.client.request("isWearingQuickCape", username).toString().split(":"); + if(arguments[0].equals("true") && Booleans.QuickCape == true) { + //System.out.println("isWearingQuickCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingQuickCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingQuickCape = there was an error for " + username); + return false; + } + } + +} diff --git a/src/minecraft/animeware/cosmetic/ServerShitWings.java b/src/minecraft/animeware/cosmetic/ServerShitWings.java new file mode 100644 index 0000000..3bf7c9f --- /dev/null +++ b/src/minecraft/animeware/cosmetic/ServerShitWings.java @@ -0,0 +1,21 @@ +package animeware.cosmetic; + +import animeware.util.websockets.SocketClient; + +public class ServerShitWings { + + public static boolean isWearingQuickCape(String username) { + String[] arguments = SocketClient.client.request("isWearingQuickCape", username).toString().split(":"); + if(arguments[0].equals("true") && Booleans.QuickCape == true) { + //System.out.println("isWearingQuickCape = returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("isWearingQuickCape = returned as false for user " + username); + return false; + } else { + System.out.println("isWearingQuickCape = there was an error for " + username); + return false; + } + } + +} diff --git a/src/minecraft/animeware/cosmetic/WingsChecker.java b/src/minecraft/animeware/cosmetic/WingsChecker.java new file mode 100644 index 0000000..b5f1b45 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/WingsChecker.java @@ -0,0 +1,18 @@ +package animeware.cosmetic; + +import net.minecraft.client.entity.AbstractClientPlayer; + +public class WingsChecker { + + public static boolean ownsWings(AbstractClientPlayer entitylivingbaseIn) { + if(entitylivingbaseIn.getName().equals("hypnomacka")) { + return true; + } + + + + + else return false; + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/Bandana.java b/src/minecraft/animeware/cosmetic/impl/Bandana.java new file mode 100644 index 0000000..1ca5bef --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/Bandana.java @@ -0,0 +1,90 @@ +package animeware.cosmetic.impl; + + + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticModelBase; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class Bandana extends CosmeticBase { + private final ModelBandana modelBandana; + + + public Bandana(RenderPlayer renderPlayer) { + super(renderPlayer); + modelBandana = new ModelBandana(renderPlayer); + } + + @Override + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float headYaw, float headPitch, float scale) { + + if(Minecraft.getMinecraft().thePlayer.inventory.armorInventory[3] == null && Booleans.Bandana == true && player == Minecraft.getMinecraft().thePlayer && !player.isInvisible()) { + GL11.glPushMatrix(); + renderPlayer.bindTexture(new ResourceLocation("Animeware/bandana.png")); + float[] color = {255, 255, 255}; + + GL11.glColor3f(color[0], color[1], color[2]); + modelBandana.render(player, limbSwing, limbSwingAmount, ageInTicks, headYaw, headPitch, scale); + GL11.glPopMatrix(); + } + } + + + + + private class ModelBandana extends CosmeticModelBase { + + private ModelRenderer model1; + private ModelRenderer model2; + private ModelRenderer model3; + private ModelRenderer model4; + + public ModelBandana(RenderPlayer player) { + super(player); + this.model1 = new ModelRenderer(playerModel, 0, 0); + this.model1.addBox(-4.5f, -7.0f, -4.7f, 9, 2, 1); + this.model2 = new ModelRenderer(playerModel, 0, 0); + this.model2.addBox(3.5f, -7.0f, -3.5f, 1, 2, 8); + this.model3 = new ModelRenderer(playerModel, 0, 0); + this.model3.addBox(-4.5f, -7.0f, -3.5f, 1, 2, 8); + this.model4 = new ModelRenderer(playerModel, 0, 0); + this.model4.addBox(-4.5f, -7.0f, 4.0f, 9, 2, 1); + } + + + @Override + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float headYaw, float headPitch, float scale) { + if (entityIn.isSneaking()) { + GL11.glTranslated(0.0, 0.225, 0.0); + } + this.model1.rotateAngleX = playerModel.bipedHead.rotateAngleX; + this.model1.rotateAngleY = playerModel.bipedHead.rotateAngleY; + this.model1.rotationPointX = 0.0f; + this.model1.rotationPointY = 0.0f; + this.model1.render(scale); + this.model2.rotateAngleX = playerModel.bipedHead.rotateAngleX; + this.model2.rotateAngleY = playerModel.bipedHead.rotateAngleY; + this.model2.rotationPointX = 0.0f; + this.model2.rotationPointY = 0.0f; + this.model2.render(scale); + this.model3.rotateAngleX = playerModel.bipedHead.rotateAngleX; + this.model3.rotateAngleY = playerModel.bipedHead.rotateAngleY; + this.model3.rotationPointX = 0.0f; + this.model3.rotationPointY = 0.0f; + this.model3.render(scale); + this.model4.rotateAngleX = playerModel.bipedHead.rotateAngleX; + this.model4.rotateAngleY = playerModel.bipedHead.rotateAngleY; + this.model4.rotationPointX = 0.0f; + this.model4.rotationPointY = 0.0f; + this.model4.render(scale); + } + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/cosmetic/impl/Cape.java b/src/minecraft/animeware/cosmetic/impl/Cape.java new file mode 100644 index 0000000..2e02ff0 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/Cape.java @@ -0,0 +1,172 @@ +package animeware.cosmetic.impl; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.Cosmetic; +import animeware.cosmetic.CosmeticChecker; +import animeware.util.cosmetic.AnimUtil; +import animeware.util.render.AnimatedResourceLocation; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.layers.LayerCape; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class Cape extends Cosmetic +{ + public AnimatedResourceLocation gif; + + public boolean nocape; + + LayerCape lCape; + + private final RenderPlayer playerRenderer; + + public Cape(RenderPlayer renderPlayer) { + super("Cape", true, renderPlayer); + this.playerRenderer = renderPlayer; + } + + + public boolean shouldCombineTextures() + { + return false; + } + + + public static void update() { + //timer = timer + mc.thePlayer.ticksExisted; + /*if(NightSky.timer == 50) { + NightSky.timer = 0; + } + int maxFrames = 2; + if (NightSky.timer == 49) + //ticks = 1; + NightSky.ticks++; + System.out.println(NightSky.ticks); + + if (NightSky.ticks > maxFrames) { + NightSky.ticks = 1; + }*/ + } + + @Override + public void render(AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, + float ageInTicks, float netHeadYaw, float headPitch, float scale) { + gif = new AnimatedResourceLocation("Animeware/cosmetic/capes/anim/lightning", 10, 5); + if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE)/* && CapeChecker.ownsZeroTwoCape(entitylivingbaseIn)*/) + { + + //gif = new AnimatedResourceLocation("Animeware/cosmetic/capes/anim/lightning", 10, 5); + //if(CosmeticController.shouldZeroTwoCape(entitylivingbaseIn) && entitylivingbaseIn == Minecraft.getMinecraft().thePlayer) { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + //if (Animeware.QuickCape && ServerShitCapes.isWearingCape1(((AbstractClientPlayer) entitylivingbaseIn).getGameProfile().getName())) { + try { + if(entitylivingbaseIn == Minecraft.getMinecraft().thePlayer && !entitylivingbaseIn.isInvisible()) { + if (Booleans.QuickCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/quick.png")); + } else if (Booleans.PlanetsCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/planetscape.png")); + } else if (Booleans.QuavCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/quav_cape.png")); + } else if (Booleans.ReptyllCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/reptyll.png")); + } else if (Booleans.SwordCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/swordcape.png")); + } else if (Booleans.EmeraldCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/emeraldcape.png")); + } else if (Booleans.LCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/lcape.png")); + } else if (Booleans.NitroCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/nitro.png")); + } else if (Booleans.DarkCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/darkcape.png")); + } else if (Booleans.Cape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/cape.png")); + } else if (Booleans.YTCape && CosmeticChecker.ownsYtCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/yt.png")); + } else if (Booleans.DevCape && CosmeticChecker.ownsDevCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/devcape.png")); + } else if (Booleans.OwnerCape && CosmeticChecker.ownsOwnerCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/ownercape.png")); + } else if (Booleans.GradientBlack && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/gradientblack.png")); + } else if (Booleans.GradientBlue && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/gradientblue.png")); + } else if (Booleans.GradientGreen && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/gradientgreen.png")); + } else if (Booleans.GradientPurple && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/gradientpurple.png")); + } else if (Booleans.GradientRed && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/gradientred.png")); + } else if (Booleans.tanjirocape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/tanjirocape.png")); + } else if (Booleans.kocho2cape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/kocho2cape.png")); + } else if (Booleans.kocho3cape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/kocho3cape.png")); + } else if (Booleans.dseyes2cape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/dseyes2cape.png")); + } else if (Booleans.dseyescape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/dseyescape.png")); + } else if (Booleans.wintercape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/wintercape.png")); + } else if (Booleans.Sparkofyt && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/discord/sparkofytcape.png")); + } else if (Booleans.Sparkofyt2 && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/discord/sparkofyt2cape.png")); + } else if (Booleans.RinneCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/ani/rinnegan/" + AnimUtil.frames + ".png")); //Animeware/cosmetic/capes/blank.png + } else { + //this.nocape = true; + //this.playerRenderer.bindTexture(new ResourceLocation(null)); //Animeware/cosmetic/capes/blank.png + } + } + } catch(NullPointerException e) { + this.playerRenderer.bindTexture(new ResourceLocation(null)); + e.printStackTrace(); + } + + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + } + if (entitylivingbaseIn.isSneaking()) + { + //f1 += 25.0F; + GlStateManager.translate(0.0F, 0.142F, -0.0178F); + //GlStateManager.translate(0.0F, 0.0F, 0.0F); + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + } + } diff --git a/src/minecraft/animeware/cosmetic/impl/CatEars.java b/src/minecraft/animeware/cosmetic/impl/CatEars.java new file mode 100644 index 0000000..d0fbace --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CatEars.java @@ -0,0 +1,122 @@ +package animeware.cosmetic.impl; + + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.Cosmetic; +import animeware.cosmetic.CosmeticModule; +import animeware.event.EventListener; +import animeware.event.impl.Render3DEvent; +import animeware.hud.Category; +import animeware.util.MathUtils; +import animeware.util.render.ColorUtil; +import animeware.util.render.RenderUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class CatEars extends Cosmetic { + + //private final BooleanSetting firstPerson = new BooleanSetting("Show in first person", false); + + public CatEars(RenderPlayer renderPlayer) { + super("ChinaHat", true, renderPlayer); + this.playerRenderer = renderPlayer; + } + + @Override + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, + float ageInTicks, float netHeadYaw, float headPitch, float scale) { + if (mc.thePlayer == null || mc.theWorld == null || mc.thePlayer.isInvisible() || mc.thePlayer.isDead || Booleans.ChinaHat == false) return; + if (mc.gameSettings.thirdPersonView == 0) return; + + if(player == Minecraft.getMinecraft().thePlayer && !player.isInvisible()) { + + double posX = mc.thePlayer.lastTickPosX + (mc.thePlayer.posX - mc.thePlayer.lastTickPosX) * mc.timer.renderPartialTicks - mc.getRenderManager().renderPosX, + posY = mc.thePlayer.lastTickPosY + (mc.thePlayer.posY - mc.thePlayer.lastTickPosY) * mc.timer.renderPartialTicks - mc.getRenderManager().renderPosY - (mc.thePlayer.isSneaking() ? 1 : 1.1), + posZ = mc.thePlayer.lastTickPosZ + (mc.thePlayer.posZ - mc.thePlayer.lastTickPosZ) * mc.timer.renderPartialTicks - mc.getRenderManager().renderPosZ; + + AxisAlignedBB axisalignedbb = mc.thePlayer.getEntityBoundingBox(); + double height = axisalignedbb.maxY - axisalignedbb.minY + 0.02, + radius = axisalignedbb.maxX - axisalignedbb.minX; + + GL11.glPushMatrix(); + GlStateManager.disableCull(); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glEnable(GL11.GL_BLEND); + GlStateManager.disableLighting(); + GlStateManager.color(1, 1, 1, 1); + OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); + + float yaw = MathUtils.interpolate(mc.thePlayer.prevRotationYaw, mc.thePlayer.rotationYaw, mc.timer.renderPartialTicks).floatValue(); + float pitchInterpolate = MathUtils.interpolate(mc.thePlayer.prevRenderArmPitch, mc.thePlayer.renderArmPitch, mc.timer.renderPartialTicks).floatValue(); + + GL11.glTranslated(posX, posY, posZ); + GL11.glEnable(GL11.GL_LINE_SMOOTH); + GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); + GL11.glRotated(yaw, posX, posY, posZ); + GL11.glRotated(pitchInterpolate / 9.0, posX, posY, posZ); + GL11.glTranslatef(0, 0, -0.0F); + GL11.glLineWidth(2); + GL11.glBegin(GL11.GL_LINE_LOOP); + + // outline/border or whatever you call it + for (int i = 0; i <= 180; i++) { + int color1 = ColorUtil.rainbow(7, i * 4, 1, 1, .5f).getRGB(); + GlStateManager.color(1, 1, 1, 1); + RenderUtil.color(color1); + + GL11.glVertex3d( + posX - Math.sin(i * MathHelper.PI2 / 90) * radius, + posY + height - 0.002, + posZ + Math.cos(i * MathHelper.PI2 / 90) * radius + ); + + } + GL11.glEnd(); + + GL11.glBegin(GL11.GL_TRIANGLE_FAN); + int color12 = ColorUtil.rainbow(7, 4, 1, 1, .7f).getRGB(); + RenderUtil.color(color12); + + + GL11.glVertex3d(posX, posY + height - 0.3, posZ); + + + + // draw hat + for (int i = 0; i <= 180; i++) { + int color1 = ColorUtil.rainbow(7, i * 4, 1, 1, .2f).getRGB(); + GlStateManager.color(1, 1, 1, 1); + RenderUtil.color(color1); + GL11.glVertex3d(posX - Math.sin(i * MathHelper.PI2 / 90) * radius, + posY + height - 0, + posZ + Math.cos(i * MathHelper.PI2 / 90) * radius + ); + + } + //GL11.glVertex3d(posX, posY + height + 0.3, posZ); + GL11.glEnd(); + + + GL11.glPopMatrix(); + + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + } + + +} diff --git a/src/minecraft/animeware/cosmetic/impl/ChinaHat.java b/src/minecraft/animeware/cosmetic/impl/ChinaHat.java new file mode 100644 index 0000000..81c7eb5 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/ChinaHat.java @@ -0,0 +1,122 @@ +package animeware.cosmetic.impl; + + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.Cosmetic; +import animeware.cosmetic.CosmeticModule; +import animeware.event.EventListener; +import animeware.event.impl.Render3DEvent; +import animeware.hud.Category; +import animeware.util.MathUtils; +import animeware.util.render.ColorUtil; +import animeware.util.render.RenderUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class ChinaHat extends Cosmetic { + + //private final BooleanSetting firstPerson = new BooleanSetting("Show in first person", false); + + public ChinaHat(RenderPlayer renderPlayer) { + super("ChinaHat", true, renderPlayer); + this.playerRenderer = renderPlayer; + } + + @Override + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, + float ageInTicks, float netHeadYaw, float headPitch, float scale) { + if (mc.thePlayer == null || mc.theWorld == null || mc.thePlayer.isInvisible() || mc.thePlayer.isDead || Booleans.ChinaHat == false) return; + if (mc.gameSettings.thirdPersonView == 0) return; + + if(player == Minecraft.getMinecraft().thePlayer && !player.isInvisible()) { + + double posX = mc.thePlayer.lastTickPosX + (mc.thePlayer.posX - mc.thePlayer.lastTickPosX) * mc.timer.renderPartialTicks - mc.getRenderManager().renderPosX, + posY = mc.thePlayer.lastTickPosY + (mc.thePlayer.posY - mc.thePlayer.lastTickPosY) * mc.timer.renderPartialTicks - mc.getRenderManager().renderPosY - (mc.thePlayer.isSneaking() ? 1 : 1.1), + posZ = mc.thePlayer.lastTickPosZ + (mc.thePlayer.posZ - mc.thePlayer.lastTickPosZ) * mc.timer.renderPartialTicks - mc.getRenderManager().renderPosZ; + + AxisAlignedBB axisalignedbb = mc.thePlayer.getEntityBoundingBox(); + double height = axisalignedbb.maxY - axisalignedbb.minY + 0.02, + radius = axisalignedbb.maxX - axisalignedbb.minX; + + GL11.glPushMatrix(); + GlStateManager.disableCull(); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glEnable(GL11.GL_BLEND); + GlStateManager.disableLighting(); + GlStateManager.color(1, 1, 1, 1); + OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); + + float yaw = MathUtils.interpolate(mc.thePlayer.prevRotationYaw, mc.thePlayer.rotationYaw, mc.timer.renderPartialTicks).floatValue(); + float pitchInterpolate = MathUtils.interpolate(mc.thePlayer.prevRenderArmPitch, mc.thePlayer.renderArmPitch, mc.timer.renderPartialTicks).floatValue(); + + GL11.glTranslated(posX, posY, posZ); + GL11.glEnable(GL11.GL_LINE_SMOOTH); + GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); + GL11.glRotated(yaw, posX, posY, posZ); + GL11.glRotated(pitchInterpolate / 9.0, posX, posY, posZ); + GL11.glTranslatef(0, 0, -0.0F); + GL11.glLineWidth(2); + GL11.glBegin(GL11.GL_LINE_LOOP); + + // outline/border or whatever you call it + for (int i = 0; i <= 180; i++) { + int color1 = ColorUtil.rainbow(7, i * 4, 1, 1, .5f).getRGB(); + GlStateManager.color(1, 1, 1, 1); + RenderUtil.color(color1); + + GL11.glVertex3d( + posX - Math.sin(i * MathHelper.PI2 / 90) * radius, + posY + height - 0.002, + posZ + Math.cos(i * MathHelper.PI2 / 90) * radius + ); + + } + GL11.glEnd(); + + GL11.glBegin(GL11.GL_TRIANGLE_FAN); + int color12 = ColorUtil.rainbow(7, 4, 1, 1, .7f).getRGB(); + RenderUtil.color(color12); + + + GL11.glVertex3d(posX, posY + height - 0.3, posZ); + + + + // draw hat + for (int i = 0; i <= 180; i++) { + int color1 = ColorUtil.rainbow(7, i * 4, 1, 1, .2f).getRGB(); + GlStateManager.color(1, 1, 1, 1); + RenderUtil.color(color1); + GL11.glVertex3d(posX - Math.sin(i * MathHelper.PI2 / 90) * radius, + posY + height - 0, + posZ + Math.cos(i * MathHelper.PI2 / 90) * radius + ); + + } + //GL11.glVertex3d(posX, posY + height + 0.3, posZ); + GL11.glEnd(); + + + GL11.glPopMatrix(); + + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + } + + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticBlaze.java b/src/minecraft/animeware/cosmetic/impl/CosmeticBlaze.java new file mode 100644 index 0000000..fd49bf4 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticBlaze.java @@ -0,0 +1,115 @@ +package animeware.cosmetic.impl; + +import java.awt.Color; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticModelBase; +import animeware.util.ChromaString; +import java.awt.Color; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelPlayer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +//import we.LWhite.RainbowColor; + + +public class CosmeticBlaze extends CosmeticBase +{ + CosmeticBlaze.BlazeModel blazeModel; + private static final ResourceLocation blazeTextures = new ResourceLocation("Animeware/cosmetic/blaze.png"); + + public CosmeticBlaze(RenderPlayer player) + { + super(player); + this.blazeModel = new CosmeticBlaze.BlazeModel(player); + } + + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) + { + + + if(Booleans.Blaze && player == Minecraft.getMinecraft().thePlayer && !player.isInvisible()) { + GlStateManager.pushMatrix(); + this.renderPlayer.bindTexture(blazeTextures); + this.blazeModel.setModelAttributes(this.renderPlayer.getMainModel()); + //Color.getColor(String.valueOf()); + //Color.getColor(null, new Color(0, 100, 0, 255).getRGB()); + this.blazeModel.render(player, limbSwing, limbSwingAmount, ageInTicks, headPitch, headPitch, scale); + GlStateManager.popMatrix(); + } else { + + } + + + + } + + private static class BlazeModel extends CosmeticModelBase + { + private ModelRenderer[] blazeSticks = new ModelRenderer[12]; + + public BlazeModel(RenderPlayer player) + { + super(player); + + for (int i = 0; i < this.blazeSticks.length; ++i) + { + this.blazeSticks[i] = new ModelRenderer(this.playerModel, 0, 16); + this.blazeSticks[i].addBox(0.0F, 0.0F, 0.0F, 2, 8, 2); + } + } + + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + + for (ModelRenderer modelrenderer : this.blazeSticks) + { + modelrenderer.render(scale); + } + } + + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + float f = p_78087_3_ * (float)Math.PI * -0.1F; + + for (int i = 0; i < 4; ++i) + { + this.blazeSticks[i].rotationPointY = -2.0F + MathHelper.cos(((float)(i * 2) + p_78087_3_) * 0.25F); + this.blazeSticks[i].rotationPointX = MathHelper.cos(f) * 9.0F; + this.blazeSticks[i].rotationPointZ = MathHelper.sin(f) * 9.0F; + ++f; + } + + f = ((float)Math.PI / 4F) + p_78087_3_ * (float)Math.PI * 0.03F; + + for (int j = 4; j < 8; ++j) + { + this.blazeSticks[j].rotationPointY = 2.0F + MathHelper.cos(((float)(j * 2) + p_78087_3_) * 0.25F); + this.blazeSticks[j].rotationPointX = MathHelper.cos(f) * 7.0F; + this.blazeSticks[j].rotationPointZ = MathHelper.sin(f) * 7.0F; + ++f; + } + + f = 0.47123894F + p_78087_3_ * (float)Math.PI * -0.05F; + + for (int k = 8; k < 12; ++k) + { + this.blazeSticks[k].rotationPointY = 11.0F + MathHelper.cos(((float)k * 1.5F + p_78087_3_) * 0.5F); + this.blazeSticks[k].rotationPointX = MathHelper.cos(f) * 5.0F; + this.blazeSticks[k].rotationPointZ = MathHelper.sin(f) * 5.0F; + ++f; + } + } + + public void setModelAttributes(ModelPlayer mainModel) { + } + } +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticCreeperLightning.java b/src/minecraft/animeware/cosmetic/impl/CosmeticCreeperLightning.java new file mode 100644 index 0000000..f1d6dca --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticCreeperLightning.java @@ -0,0 +1,56 @@ +package animeware.cosmetic.impl; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticBase; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.util.ResourceLocation; + + +public class CosmeticCreeperLightning extends CosmeticBase +{ + private static final ResourceLocation LIGHTNING_TEXTURE = new ResourceLocation("Animeware/cosmetic/creeper_armor.png"); + private final RenderPlayer renderPlayer; + private ModelPlayer playerModel; + + public CosmeticCreeperLightning(RenderPlayer renderPlayer) + { + super(renderPlayer); + this.renderPlayer = renderPlayer; + this.playerModel = renderPlayer.getMainModel(); + } + + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) + { + + + if(Booleans.CreeperLightning == true) { + boolean flag = player.isInvisible(); + GlStateManager.depthMask(!flag); + this.playerModel = this.renderPlayer.getMainModel(); + this.renderPlayer.bindTexture(LIGHTNING_TEXTURE); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + float f = (float)player.ticksExisted + partialTicks; + double d0 = 0.5; + GlStateManager.translate((double)1 / -100, (double)f * d0, 0.0D); + GlStateManager.matrixMode(5888); + GlStateManager.enableBlend(); + + GlStateManager.disableLighting(); + GlStateManager.blendFunc(1, 1); + this.playerModel.setModelAttributes(this.renderPlayer.getMainModel()); + this.playerModel.render(player, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, 0.0625F); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + GlStateManager.enableLighting(); + GlStateManager.disableBlend(); + GlStateManager.depthMask(flag); + GlStateManager.disableLighting(); + } + + } +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticCrystalWings.java b/src/minecraft/animeware/cosmetic/impl/CosmeticCrystalWings.java new file mode 100644 index 0000000..8175e78 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticCrystalWings.java @@ -0,0 +1,103 @@ +package animeware.cosmetic.impl; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticModelBase; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class CosmeticCrystalWings extends CosmeticBase { + private CrytsalWingsModel crytsalWingsModel; + + public CosmeticCrystalWings(RenderPlayer playerRenderer) { + super(playerRenderer); + this.crytsalWingsModel = new CrytsalWingsModel(playerRenderer); + } + + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + this.crytsalWingsModel.render((Entity)player, limbSwing, limbSwingAmount, ageInTicks, headPitch, headPitch, scale); + } + + public class CrytsalWingsModel extends CosmeticModelBase { + private ModelRenderer model; + + ResourceLocation resourceLocation = new ResourceLocation("Animeware/cosmetic/crystal.png"); + + public CrytsalWingsModel(RenderPlayer player) { + super(player); + int i = 30; + int j = 24; + this.model = (new ModelRenderer((ModelBase)this)).setTextureSize(i, j).setTextureOffset(0, 8); + this.model.setRotationPoint(-0.0F, 1.0F, 0.0F); + this.model.addBox(0.0F, -3.0F, 0.0F, 14, 7, 1); + this.model.isHidden = true; + ModelRenderer modelrenderer = (new ModelRenderer((ModelBase)this)).setTextureSize(i, j).setTextureOffset(0, 16); + modelrenderer.setRotationPoint(-0.0F, 0.0F, 0.2F); + modelrenderer.addBox(0.0F, -3.0F, 0.0F, 14, 7, 1); + this.model.addChild(modelrenderer); + ModelRenderer modelrenderer1 = (new ModelRenderer((ModelBase)this)).setTextureSize(i, j).setTextureOffset(0, 0); + modelrenderer1.setRotationPoint(-0.0F, 0.0F, 0.2F); + modelrenderer1.addBox(0.0F, -3.0F, 0.0F, 14, 7, 1); + modelrenderer.addChild(modelrenderer1); + } + + public void render(Entity entityIn, float p_78088_2_, float walkingSpeed, float tickValue, float p_78088_5_, float p_78088_6_, float scale) { + if(entityIn == Minecraft.getMinecraft().thePlayer && !entityIn.isInvisible() && Booleans.CrystalWings) { + float f = (float)Math.cos((tickValue / 10.0F)) / 20.0F - 0.03F - walkingSpeed / 20.0F; + ModelRenderer modelrenderer = (ModelRenderer) this.model.childModels.get(0); + ModelRenderer modelrenderer1 = (ModelRenderer) modelrenderer.childModels.get(0); + this.model.rotateAngleZ = f * 3.0F; + modelrenderer.rotateAngleZ = f / 2.0F; + modelrenderer1.rotateAngleZ = f / 2.0F; + this.model.rotateAngleY = -0.3F - walkingSpeed / 3.0F; + this.model.rotateAngleX = 0.3F; + GlStateManager.pushMatrix(); + GlStateManager.scale(1.6D, 1.6D, 1.0D); + GlStateManager.translate(0.0D, 0.05000000074505806D, 0.05000000074505806D); + if (entityIn.isSneaking()) { + GlStateManager.translate(0.0D, 0.07999999821186066D, 0.029999999329447746D); + GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F); + this.model.rotateAngleZ = 0.8F; + modelrenderer.rotateAngleZ = 0.0F; + modelrenderer1.rotateAngleZ = 0.0F; + } else { + RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); + if (rendermanager != null) + GlStateManager.rotate(rendermanager.playerViewX / 3.0F, 1.0F, 0.0F, 0.0F); + } + this.model.isHidden = false; + for (int i = -1; i <= 1; i += 2) { + GlStateManager.pushMatrix(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 0.3F); + GlStateManager.depthMask(false); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + GlStateManager.alphaFunc(516, 0.003921569F); + GlStateManager.disableLighting(); + + //Edit the Color + GlStateManager.color(0, 0, 0); + + Minecraft.getMinecraft().getTextureManager().bindTexture(this.resourceLocation); + if (i == 1) + GlStateManager.scale(-1.0F, 1.0F, 1.0F); + GlStateManager.translate(0.05D, 0.0D, 0.0D); + this.model.render(scale); + GlStateManager.disableBlend(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.popMatrix(); + GlStateManager.depthMask(true); + } + this.model.isHidden = true; + GlStateManager.popMatrix(); + } + } + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticDogPet.java b/src/minecraft/animeware/cosmetic/impl/CosmeticDogPet.java new file mode 100644 index 0000000..5512ea6 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticDogPet.java @@ -0,0 +1,143 @@ +package animeware.cosmetic.impl; + +import java.io.IOException; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticModelBase; +import animeware.util.DatabaseUtil; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class CosmeticDogPet extends CosmeticBase { + WolfModel wolfModel; + + public static final ResourceLocation TEXTURE = new ResourceLocation("Animeware/cosmetic/DogPet.png"); + + public CosmeticDogPet(RenderPlayer player) { + super(player); + this.wolfModel = new WolfModel(player); + } + + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + GlStateManager.pushMatrix(); + try { + if (DatabaseUtil.getBoolean(player.getUniqueID().toString(), "dogpet")) { + this.renderPlayer.bindTexture(TEXTURE); + if (player.isSneaking()) + GlStateManager.translate(0.0D, 0.045D, 0.0D); + this.wolfModel.render((Entity)player, limbSwing, limbSwingAmount, ageInTicks, headPitch, headPitch, scale); + GL11.glColor3f(1.0F, 1.0F, 1.0F); + } + } catch (IOException e) { + e.printStackTrace(); + } + GL11.glPopMatrix(); + } + + static class WolfModel extends CosmeticModelBase { + + private final ModelRenderer wolfHeadMain; + private final ModelRenderer wolfBody; + private final ModelRenderer wolfMane; + private final ModelRenderer wolfLeg1; + private final ModelRenderer wolfLeg2; + private final ModelRenderer wolfLeg3; + private final ModelRenderer wolfLeg4; + private final ModelRenderer wolfTail; + + public WolfModel(RenderPlayer player) { + super(player); + float f = 0.0F; + float f1 = 13.5F; + this.wolfHeadMain = new ModelRenderer((ModelBase)this, 0, 0); + this.wolfHeadMain.addBox(-3.0F, -3.0F, -2.0F, 6, 6, 4, f); + this.wolfHeadMain.setRotationPoint(-1.0F, f1, -7.0F); + this.wolfBody = new ModelRenderer((ModelBase)this, 18, 14); + this.wolfBody.addBox(-4.0F, -2.0F, -3.0F, 6, 9, 6, f); + this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F); + this.wolfMane = new ModelRenderer((ModelBase)this, 21, 0); + this.wolfMane.addBox(-4.0F, -3.0F, -3.0F, 8, 6, 7, f); + this.wolfMane.setRotationPoint(-1.0F, 14.0F, 2.0F); + this.wolfLeg1 = new ModelRenderer((ModelBase)this, 0, 18); + this.wolfLeg1.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F); + this.wolfLeg2 = new ModelRenderer((ModelBase)this, 0, 18); + this.wolfLeg2.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F); + this.wolfLeg3 = new ModelRenderer((ModelBase)this, 0, 18); + this.wolfLeg3.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F); + this.wolfLeg4 = new ModelRenderer((ModelBase)this, 0, 18); + this.wolfLeg4.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F); + this.wolfTail = new ModelRenderer((ModelBase)this, 9, 18); + this.wolfTail.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F); + this.wolfHeadMain.setTextureOffset(16, 14).addBox(-3.0F, -5.0F, 0.0F, 2, 2, 1, f); + this.wolfHeadMain.setTextureOffset(16, 14).addBox(1.0F, -5.0F, 0.0F, 2, 2, 1, f); + this.wolfHeadMain.setTextureOffset(0, 10).addBox(-1.5F, 0.0F, -5.0F, 3, 3, 4, f); + } + + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) { + super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale); + setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + setLivingAnimations((EntityLivingBase)entityIn, p_78088_2_, p_78088_3_, 0.0F); + GlStateManager.translate(-1.0F, 0.0F, 0.0F); + this.wolfHeadMain.renderWithRotation(scale); + this.wolfBody.render(scale); + this.wolfLeg1.render(scale); + this.wolfLeg2.render(scale); + this.wolfLeg3.render(scale); + this.wolfLeg4.render(scale); + this.wolfTail.renderWithRotation(scale); + this.wolfMane.render(scale); + } + + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) { + if (entitylivingbaseIn.isSneaking()) { + this.wolfMane.setRotationPoint(-1.0F, 16.0F, -3.0F); + this.wolfMane.rotateAngleX = 1.2566371F; + this.wolfMane.rotateAngleY = 0.0F; + this.wolfBody.setRotationPoint(0.0F, 18.0F, 0.0F); + this.wolfBody.rotateAngleX = 0.7853982F; + this.wolfTail.setRotationPoint(-1.0F, 21.0F, 6.0F); + this.wolfLeg1.setRotationPoint(-2.5F, 22.0F, 2.0F); + this.wolfLeg1.rotateAngleX = 4.712389F; + this.wolfLeg2.setRotationPoint(0.5F, 22.0F, 2.0F); + this.wolfLeg2.rotateAngleX = 4.712389F; + this.wolfLeg3.rotateAngleX = 5.811947F; + this.wolfLeg3.setRotationPoint(-2.49F, 17.0F, -4.0F); + this.wolfLeg4.rotateAngleX = 5.811947F; + this.wolfLeg4.setRotationPoint(0.51F, 17.0F, -4.0F); + } else { + this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F); + this.wolfBody.rotateAngleX = 1.5707964F; + this.wolfMane.setRotationPoint(-1.0F, 14.0F, -3.0F); + this.wolfMane.rotateAngleX = this.wolfBody.rotateAngleX; + this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F); + this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F); + this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F); + this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F); + this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F); + this.wolfLeg1.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F) * 1.4F * p_78086_3_; + this.wolfLeg2.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F + 3.1415927F) * 1.4F * p_78086_3_; + this.wolfLeg3.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F + 3.1415927F) * 1.4F * p_78086_3_; + this.wolfLeg4.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F) * 1.4F * p_78086_3_; + } + } + + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + this.wolfTail.rotateAngleX = p_78087_2_; + } + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticEasterEgg.java b/src/minecraft/animeware/cosmetic/impl/CosmeticEasterEgg.java new file mode 100644 index 0000000..f34a3eb --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticEasterEgg.java @@ -0,0 +1,76 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.cosmetic.impl; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticModelBase; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +public class CosmeticEasterEgg extends CosmeticBase +{ + private final CosmeticVilligerNose2 EggsModel; + + public CosmeticEasterEgg(final RenderPlayer renderPlayer) { + super(renderPlayer); + this.EggsModel = new CosmeticVilligerNose2(renderPlayer); + } + + @Override + public void render(final AbstractClientPlayer player, final float limbSwing, final float limbSwingAmount, final float partialTicks, final float ageInTicks, final float netHeadYaw, final float headPitch, final float scale) { + GL11.glPushMatrix(); + if (player.isSneaking()) { + GlStateManager.translate(0.0, 0.262, 0.0); + } + GlStateManager.rotate(netHeadYaw, 0.0f, 1.0f, 0.0f); + GlStateManager.rotate(headPitch, 1.0f, 0.0f, 0.0f); + GlStateManager.rotate(ageInTicks * 17.0f, 0.0f, 1.0f, 0.0f); + GlStateManager.rotate(180.0f, 1.0f, 0.0f, 0.0f); + final String uuid = player.getUniqueID().toString(); + if (uuid.contains("dwabdwbo8adb8wbdwa")) { + this.EggsModel.render(player, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); + GL11.glColor3d(1.0, 1.0, 1.0); + } + Minecraft.getMinecraft(); + if (player == Minecraft.thePlayer && Booleans.CosmeticEasterEggs) { + this.EggsModel.render(player, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); + } + GL11.glPopMatrix(); + } + + public class CosmeticVilligerNose2 extends CosmeticModelBase + { + public CosmeticVilligerNose2(final RenderPlayer player) { + super(player); + } + + @Override + public void render(final Entity entityIn, final float limbSwing, final float limbSwingAmount, final float ageInTicks, final float headYaw, final float headPitch, final float scale) { + final Minecraft mc = null; + GlStateManager.pushMatrix(); + GlStateManager.scale(0.25, 0.25, 0.25); + GlStateManager.translate(2.0, 1.5, 0.0); + final ItemStack itemsword = new ItemStack(Items.egg); + Minecraft.getMinecraft().getItemRenderer().renderItem((EntityLivingBase)entityIn, itemsword, ItemCameraTransforms.TransformType.NONE); + GlStateManager.translate(-4.0f, 0.0f, 0.0f); + Minecraft.getMinecraft().getItemRenderer().renderItem((EntityLivingBase)entityIn, itemsword, ItemCameraTransforms.TransformType.NONE); + GlStateManager.translate(2.0f, 0.0f, 2.0f); + Minecraft.getMinecraft().getItemRenderer().renderItem((EntityLivingBase)entityIn, itemsword, ItemCameraTransforms.TransformType.NONE); + GlStateManager.translate(0.0f, 0.0f, -4.0f); + Minecraft.getMinecraft().getItemRenderer().renderItem((EntityLivingBase)entityIn, itemsword, ItemCameraTransforms.TransformType.NONE); + GlStateManager.popMatrix(); + } + } +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticEnchantingGlint.java b/src/minecraft/animeware/cosmetic/impl/CosmeticEnchantingGlint.java new file mode 100644 index 0000000..6061f23 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticEnchantingGlint.java @@ -0,0 +1,89 @@ +package animeware.cosmetic.impl; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticController; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ResourceLocation; + + +public class CosmeticEnchantingGlint implements LayerRenderer +{ + protected static final ResourceLocation ENCHANTED_ITEM_GLINT_RES = new ResourceLocation("Animeware/cosmetic/enchantGlint.png"); + private final RenderPlayer renderPlayer; + private final ModelPlayer playerModel; + + public CosmeticEnchantingGlint(RenderPlayer renderPlayer) + { + this.renderPlayer = renderPlayer; + this.playerModel = new ModelPlayer(0.2F, false); + } + + public void doRenderLayer(AbstractClientPlayer player, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + + + if (player == Minecraft.getMinecraft().thePlayer && CosmeticController.shouldRenderTopHat(player) && Booleans.EnchantingGlint == true) { + + this.createEnchantGlint(player, this.renderPlayer.getMainModel(), p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale); + } + + + + + + } + + private void createEnchantGlint(EntityLivingBase entitylivingbaseIn, ModelBase modelbaseIn, float p_177183_3_, float p_177183_4_, float p_177183_5_, float p_177183_6_, float p_177183_7_, float p_177183_8_, float p_177183_9_) + { + + float f = (float)entitylivingbaseIn.ticksExisted + p_177183_5_; + this.renderPlayer.bindTexture(ENCHANTED_ITEM_GLINT_RES); + + + + GlStateManager.enableBlend(); + GlStateManager.depthFunc(514); + GlStateManager.depthMask(false); + float f1 = 0.5F; + GlStateManager.color(f1, f1, f1, 1.0F); + + for (int i = 0; i < 2; ++i) + { + GlStateManager.disableLighting(); + GlStateManager.blendFunc(768, 1); + float f2 = 0.76F; + GlStateManager.color(0.5F * f2, 0.25F * f2, 0.8F * f2, 1.0F); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + float f3 = 0.33333334F; + GlStateManager.scale(f3, f3, f3); + GlStateManager.rotate(30.0F - (float)i * 60.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.translate(0.0F, f * (0.001F + (float)i * 0.003F) * 20.0F, 0.0F); + GlStateManager.matrixMode(5888); + modelbaseIn.render(entitylivingbaseIn, p_177183_3_, p_177183_4_, p_177183_6_, p_177183_7_, p_177183_8_, p_177183_9_); + } + + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + GlStateManager.enableLighting(); + GlStateManager.depthMask(true); + GlStateManager.depthFunc(515); + GlStateManager.disableBlend(); + + + + } + + public boolean shouldCombineTextures() + { + return false; + } +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticEnderCrystal.java b/src/minecraft/animeware/cosmetic/impl/CosmeticEnderCrystal.java new file mode 100644 index 0000000..07ee4e1 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticEnderCrystal.java @@ -0,0 +1,85 @@ +package animeware.cosmetic.impl; + +import java.util.Random; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticController; +import animeware.cosmetic.CosmeticModelBase; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class CosmeticEnderCrystal extends CosmeticBase +{ + private static final ResourceLocation TEXTURE = new ResourceLocation("Animeware/cosmetic/endercrystal.png"); + public int innerRotation; + private CosmeticEnderCrystal.EnderCrystalModel enderCrystalModel; + + public CosmeticEnderCrystal(RenderPlayer player) + { + super(player); + this.enderCrystalModel = new CosmeticEnderCrystal.EnderCrystalModel(player); + this.innerRotation = (new Random()).nextInt(100000); + } + + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) + { + + + + if (player == Minecraft.getMinecraft().thePlayer && CosmeticController.shouldRenderTopHat(player)) { + this.enderCrystalModel = new CosmeticEnderCrystal.EnderCrystalModel(this.renderPlayer); + ++this.innerRotation; + GlStateManager.pushMatrix(); + this.renderPlayer.bindTexture(TEXTURE); + + if (player.isSneaking()) { + GL11.glTranslated(0.0D, 0.3D, 0.0D); + } + + GL11.glTranslated(0.0D, -0.9D, 0.0D); + float f = (float) this.innerRotation; + float f1 = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F; + f1 = f1 * f1 + f1; + this.enderCrystalModel.render(player, 0.0F, f * 0.05F, f1 * 0.002F, 0.0F, 0.0F, 0.1F); + GL11.glPopMatrix(); + } + } + + + + + + public static class EnderCrystalModel extends CosmeticModelBase + { + ModelRenderer glass = new ModelRenderer(this, "glass"); + + public EnderCrystalModel(RenderPlayer player) + { + super(player); + this.glass.setTextureOffset(0, 0).addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8); + } + + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + GlStateManager.pushMatrix(); + GlStateManager.rotate(p_78088_3_, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.0F, 0.8F + p_78088_4_, 0.0F); + GlStateManager.rotate(60.0F, 0.7071F, 0.0F, 0.7071F); + this.glass.render(scale); + float f = 0.875F; + GlStateManager.scale(f, f, f); + GlStateManager.rotate(60.0F, 0.7071F, 0.0F, 0.7071F); + GlStateManager.rotate(p_78088_3_, 0.0F, 1.0F, 0.0F); + this.glass.render(scale); + GlStateManager.popMatrix(); + } + } +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticGlasses.java b/src/minecraft/animeware/cosmetic/impl/CosmeticGlasses.java new file mode 100644 index 0000000..6462bea --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticGlasses.java @@ -0,0 +1,133 @@ +package animeware.cosmetic.impl; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticModelBase; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; + +public class CosmeticGlasses extends CosmeticBase { + private final GlassesRenderer glassesModel; + + public CosmeticGlasses(RenderPlayer renderPlayer) { + super(renderPlayer); + this.glassesModel = new GlassesRenderer(renderPlayer); + } + + @Override + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float headYaw, float headPitch, float scale) { + GL11.glPushMatrix(); + if(player.isSneaking()) { + GlStateManager.translate(0, 0.225, 0); + } + GlStateManager.rotate(headYaw, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(headPitch, 1.0F, 0.0F, 0.0F); + + this.glassesModel.render(player, limbSwing, limbSwingAmount, ageInTicks, headYaw, headPitch, scale); + GL11.glPopMatrix(); + } + + public class GlassesRenderer extends CosmeticModelBase{ + + ModelRenderer Glasses1; + ModelRenderer Glasses2; + ModelRenderer Glasses3; + ModelRenderer Glasses4; + ModelRenderer Glasses5; + ModelRenderer Glasses6; + ModelRenderer Glasses7; + ModelRenderer Glasses8; + ModelRenderer Glasses9; + + public GlassesRenderer(RenderPlayer player) { + super(player); + textureWidth = 64; + textureHeight = 32; + + Glasses1 = new ModelRenderer(this, 0, 0); + Glasses1.addBox(0F, 0F, 0F, 4, 2, 1); + Glasses1.setRotationPoint(-5F, -3F, -5F); + Glasses1.setTextureSize(64, 32); + Glasses1.mirror = true; + setRotation(Glasses1, 0F, 0F, 0F); + Glasses2 = new ModelRenderer(this, 0, 0); + Glasses2.addBox(0F, 0F, 0F, 10, 1, 1); + Glasses2.setRotationPoint(-5F, -3F, -5F); + Glasses2.setTextureSize(64, 32); + Glasses2.mirror = true; + setRotation(Glasses2, 0F, 0F, 0F); + Glasses3 = new ModelRenderer(this, 0, 0); + Glasses3.addBox(0F, 0F, 0F, 4, 2, 1); + Glasses3.setRotationPoint(1F, -3F, -5F); + Glasses3.setTextureSize(64, 32); + Glasses3.mirror = true; + setRotation(Glasses3, 0F, 0F, 0F); + Glasses4 = new ModelRenderer(this, 0, 0); + Glasses4.addBox(-3F, 0F, -2F, 1, 1, 6); + Glasses4.setRotationPoint(-2F, -3F, -3F); + Glasses4.setTextureSize(64, 32); + Glasses4.mirror = true; + setRotation(Glasses4, 0F, 0F, 0F); + Glasses5 = new ModelRenderer(this, 0, 0); + Glasses5.addBox(0F, 0F, 0F, 1, 1, 6); + Glasses5.setRotationPoint(4F, -3F, -5F); + Glasses5.setTextureSize(64, 32); + Glasses5.mirror = true; + setRotation(Glasses5, 0F, 0F, 0F); + Glasses6 = new ModelRenderer(this, 0, 0); + Glasses6.addBox(0F, 0F, 0F, 1, 1, 1); + Glasses6.setRotationPoint(4F, -2F, 1F); + Glasses6.setTextureSize(64, 32); + Glasses6.mirror = true; + setRotation(Glasses6, 0F, 0F, 0F); + Glasses7 = new ModelRenderer(this, 0, 0); + Glasses7.addBox(0F, 0F, 0F, 1, 1, 1); + Glasses7.setRotationPoint(-5F, -2F, 1F); + Glasses7.setTextureSize(64, 32); + Glasses7.mirror = true; + setRotation(Glasses7, 0F, 0F, 0F); + Glasses8 = new ModelRenderer(this, 0, 0); + Glasses8.addBox(0F, 0F, 0F, 4, 2, 1); + Glasses8.setRotationPoint(-5F, -3F, -5F); + Glasses8.setTextureSize(64, 32); + Glasses8.mirror = true; + setRotation(Glasses8, 0F, 0F, 0F); + Glasses9 = new ModelRenderer(this, 0, 0); + Glasses9.addBox(1F, -3F, -5F, 4, 2, 1); + Glasses9.setRotationPoint(0F, 0F, 0F); + Glasses9.setTextureSize(64, 32); + Glasses9.mirror = true; + setRotation(Glasses9, 0F, 0F, 0F); + } + + public void render(Entity entityIn, float limbSwing, float limbSwingAmout, float ageInTicks, float headYaw, float headPitch, float scale) { + if(Booleans.glasses && Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername()) && entityIn == Minecraft.getMinecraft().thePlayer && !entityIn.isInvisible()) { + GlStateManager.pushMatrix(); + GlStateManager.color(0, 0, 0); + Glasses1.render(scale); + Glasses2.render(scale); + Glasses3.render(scale); + Glasses4.render(scale); + Glasses5.render(scale); + Glasses6.render(scale); + Glasses7.render(scale); + Glasses8.render(scale); + Glasses9.render(scale); + GlStateManager.popMatrix(); + } + } + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Bandana.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Bandana.java new file mode 100644 index 0000000..6669590 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Bandana.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class Bandana extends CosmeticModule { + + public Bandana() { + super("Bandana Cosmetic", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.BANDANA); + } + @Override + public void onEnable() { + Booleans.Bandana = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.Bandana = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Blaze.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Blaze.java new file mode 100644 index 0000000..8cb3c14 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Blaze.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class Blaze extends CosmeticModule { + + public Blaze() { + super("Blaze Cosmetic", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.OTHER); + } + @Override + public void onEnable() { + Booleans.Blaze = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.Blaze = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Cape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Cape.java new file mode 100644 index 0000000..bbc588d --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Cape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class Cape extends CosmeticModule { + + public Cape() { + super("ZeroTwo Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.Cape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.Cape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/ChinaHatModule.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/ChinaHatModule.java new file mode 100644 index 0000000..6acff51 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/ChinaHatModule.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class ChinaHatModule extends CosmeticModule { + + public ChinaHatModule() { + super("ChinaHat", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.HAT); + } + @Override + public void onEnable() { + Booleans.ChinaHat = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.ChinaHat = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/CosmeticEasterEggs.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/CosmeticEasterEggs.java new file mode 100644 index 0000000..10f8002 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/CosmeticEasterEggs.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class CosmeticEasterEggs extends CosmeticModule { + + public CosmeticEasterEggs() { + super("Cosmetic Eggs", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.OTHER); + } + @Override + public void onEnable() { + Booleans.CosmeticEasterEggs = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.CosmeticEasterEggs = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/CosmeticWitchHat.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/CosmeticWitchHat.java new file mode 100644 index 0000000..9819cd0 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/CosmeticWitchHat.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class CosmeticWitchHat extends CosmeticModule { + + public CosmeticWitchHat() { + super("Witch Hat", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.HAT); + } + @Override + public void onEnable() { + Booleans.CosmeticWitchHat = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.CosmeticWitchHat = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/CreeperLight.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/CreeperLight.java new file mode 100644 index 0000000..2de95a6 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/CreeperLight.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class CreeperLight extends CosmeticModule { + + public CreeperLight() { + super("Creeper Lightning Cosmetic", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.OTHER); + } + @Override + public void onEnable() { + Booleans.CreeperLightning = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.CreeperLightning = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/CrystalWings.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/CrystalWings.java new file mode 100644 index 0000000..30bd2b0 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/CrystalWings.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class CrystalWings extends CosmeticModule { + + public CrystalWings() { + super("Crystal Wings", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.WINGS); + } + @Override + public void onEnable() { + Booleans.CrystalWings = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.CrystalWings = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/DarkCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/DarkCape.java new file mode 100644 index 0000000..4115f29 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/DarkCape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class DarkCape extends CosmeticModule { + + public DarkCape() { + super("Dark Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.DarkCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.DarkCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/DevCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/DevCape.java new file mode 100644 index 0000000..80df85f --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/DevCape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class DevCape extends CosmeticModule { + + public DevCape() { + super("Staff Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.DevCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.DevCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/DragonWings.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/DragonWings.java new file mode 100644 index 0000000..7c4fa92 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/DragonWings.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class DragonWings extends CosmeticModule { + + public DragonWings() { + super("Dragon Wings", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.WINGS); + } + @Override + public void onEnable() { + Booleans.CosmeticWings = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.CosmeticWings = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/EmeraldCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/EmeraldCape.java new file mode 100644 index 0000000..6e766d7 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/EmeraldCape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class EmeraldCape extends CosmeticModule { + + public EmeraldCape() { + super("Emerald Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.EmeraldCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.EmeraldCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/EnchGlint.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/EnchGlint.java new file mode 100644 index 0000000..d2c64ee --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/EnchGlint.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class EnchGlint extends CosmeticModule { + + public EnchGlint() { + super("Enchanting Glint Cosmetic", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.EnchantingGlint = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.EnchantingGlint = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GalaxyWings.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GalaxyWings.java new file mode 100644 index 0000000..368a34f --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GalaxyWings.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class GalaxyWings extends CosmeticModule { + + public GalaxyWings() { + super("Galaxy Wings", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.WINGS); + } + @Override + public void onEnable() { + Booleans.GalaxyWings = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.GalaxyWings = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Glasses.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Glasses.java new file mode 100644 index 0000000..2ed49d7 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Glasses.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class Glasses extends CosmeticModule { + + public Glasses() { + super("Glasses", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.OTHER); + } + @Override + public void onEnable() { + Booleans.glasses = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.glasses = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientBlack.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientBlack.java new file mode 100644 index 0000000..2581ce2 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientBlack.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class GradientBlack extends CosmeticModule { + + public GradientBlack() { + super("GradientBlack Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.GradientBlack = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.GradientBlack = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientBlue.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientBlue.java new file mode 100644 index 0000000..c385442 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientBlue.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class GradientBlue extends CosmeticModule { + + public GradientBlue() { + super("GradientBlue Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.GradientBlue = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.GradientBlue = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientGreen.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientGreen.java new file mode 100644 index 0000000..766bf6e --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientGreen.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class GradientGreen extends CosmeticModule { + + public GradientGreen() { + super("GradientGreen Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.GradientGreen = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.GradientGreen = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientPurple.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientPurple.java new file mode 100644 index 0000000..f12dc94 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientPurple.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class GradientPurple extends CosmeticModule { + + public GradientPurple() { + super("GradientPurple Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.GradientPurple = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.GradientPurple = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientRed.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientRed.java new file mode 100644 index 0000000..426a210 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/GradientRed.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class GradientRed extends CosmeticModule { + + public GradientRed() { + super("GradientRed Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.GradientRed = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.GradientRed = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Halo.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Halo.java new file mode 100644 index 0000000..9c0fd72 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Halo.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class Halo extends CosmeticModule { + + public Halo() { + super("Halo", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.HAT); + } + @Override + public void onEnable() { + Booleans.Halo = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.Halo = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/LCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/LCape.java new file mode 100644 index 0000000..6a71c1e --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/LCape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class LCape extends CosmeticModule { + + public LCape() { + super("L Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.LCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.LCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/NitroCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/NitroCape.java new file mode 100644 index 0000000..554ac63 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/NitroCape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class NitroCape extends CosmeticModule { + + public NitroCape() { + super("Nitro Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.NitroCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.NitroCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/OwnerCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/OwnerCape.java new file mode 100644 index 0000000..8e63904 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/OwnerCape.java @@ -0,0 +1,26 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import animeware.util.websockets.SocketClient; +import net.minecraft.util.ResourceLocation; + +public class OwnerCape extends CosmeticModule { + + public OwnerCape() { + super("Owner Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.OwnerCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.OwnerCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/PlanetsCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/PlanetsCape.java new file mode 100644 index 0000000..b48a7de --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/PlanetsCape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class PlanetsCape extends CosmeticModule { + + public PlanetsCape() { + super("Planets Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.PlanetsCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.PlanetsCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/QuavCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/QuavCape.java new file mode 100644 index 0000000..9a10ede --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/QuavCape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class QuavCape extends CosmeticModule { + + public QuavCape() { + super("Quav Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.QuavCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.QuavCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/QuickCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/QuickCape.java new file mode 100644 index 0000000..67b8056 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/QuickCape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class QuickCape extends CosmeticModule { + + public QuickCape() { + super("Quick Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.QuickCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.QuickCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/ReptyllCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/ReptyllCape.java new file mode 100644 index 0000000..da0f667 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/ReptyllCape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class ReptyllCape extends CosmeticModule { + + public ReptyllCape() { + super("Reptyll Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.ReptyllCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.ReptyllCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/RetardEyes.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/RetardEyes.java new file mode 100644 index 0000000..ba67985 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/RetardEyes.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class RetardEyes extends CosmeticModule { + + public RetardEyes() { + super("Retard Eyes", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.OTHER); + } + @Override + public void onEnable() { + Booleans.retardEyes = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.retardEyes = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/RinneCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/RinneCape.java new file mode 100644 index 0000000..72f7dce --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/RinneCape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class RinneCape extends CosmeticModule { + + public RinneCape() { + super("Rinnegan Cape - a", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.ANIM); + } + @Override + public void onEnable() { + Booleans.RinneCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.RinneCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Sparkofyt.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Sparkofyt.java new file mode 100644 index 0000000..30955a0 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Sparkofyt.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class Sparkofyt extends CosmeticModule { + + public Sparkofyt() { + super("Sparkofyt cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.Sparkofyt = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.Sparkofyt = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Sparkofyt2.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Sparkofyt2.java new file mode 100644 index 0000000..25f88e8 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/Sparkofyt2.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class Sparkofyt2 extends CosmeticModule { + + public Sparkofyt2() { + super("Sparkofyt cape 2", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.Sparkofyt2 = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.Sparkofyt2 = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/SwordCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/SwordCape.java new file mode 100644 index 0000000..26e9cce --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/SwordCape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class SwordCape extends CosmeticModule { + + public SwordCape() { + super("Sword Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.SwordCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.SwordCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/WitherPet.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/WitherPet.java new file mode 100644 index 0000000..404360c --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/WitherPet.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class WitherPet extends CosmeticModule { + + public WitherPet() { + super("Wither Pet", new ResourceLocation("Animeware/icons/blank.png"), CosmeticType.PET); + } + @Override + public void onEnable() { + Booleans.Witherpet = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.Witherpet = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/YTCape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/YTCape.java new file mode 100644 index 0000000..cfc4ab3 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/YTCape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class YTCape extends CosmeticModule { + + public YTCape() { + super("YT Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.YTCape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.YTCape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/dseyes2cape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/dseyes2cape.java new file mode 100644 index 0000000..29c9b04 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/dseyes2cape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class dseyes2cape extends CosmeticModule { + + public dseyes2cape() { + super("Demon eyes Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.dseyes2cape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.dseyes2cape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/dseyescape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/dseyescape.java new file mode 100644 index 0000000..570e54d --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/dseyescape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class dseyescape extends CosmeticModule { + + public dseyescape() { + super("Demon eyes Cape 2", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.dseyescape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.dseyescape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/kocho2cape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/kocho2cape.java new file mode 100644 index 0000000..2e526d6 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/kocho2cape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class kocho2cape extends CosmeticModule { + + public kocho2cape() { + super("Kocho Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.kocho2cape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.kocho2cape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/kocho3cape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/kocho3cape.java new file mode 100644 index 0000000..1a72156 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/kocho3cape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class kocho3cape extends CosmeticModule { + + public kocho3cape() { + super("Kocho Cape 2", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.kocho3cape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.kocho3cape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticMods/tanjirocape.java b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/tanjirocape.java new file mode 100644 index 0000000..3a63382 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticMods/tanjirocape.java @@ -0,0 +1,25 @@ +package animeware.cosmetic.impl.CosmeticMods; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class tanjirocape extends CosmeticModule { + + public tanjirocape() { + super("tanjiro Cape", new ResourceLocation("Animeware/icons/cape.png"), CosmeticType.CAPE); + } + @Override + public void onEnable() { + Booleans.tanjirocape = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.tanjirocape = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticSheepWool.java b/src/minecraft/animeware/cosmetic/impl/CosmeticSheepWool.java new file mode 100644 index 0000000..45f4705 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticSheepWool.java @@ -0,0 +1,41 @@ +package animeware.cosmetic.impl; + +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.util.ResourceLocation; + +public class CosmeticSheepWool implements LayerRenderer { + private static final ResourceLocation TEXTURE = new ResourceLocation("textures/entity/sheep/sheep_fur.png"); + private final RenderPlayer playerrenderer; + private final ModelPlayer sheepModel; + + public CosmeticSheepWool(RenderPlayer player, ModelPlayer sheepModel) { + this.playerrenderer = player; + this.sheepModel = sheepModel; + } + + @Override + public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { + if (!entitylivingbaseIn.isInvisible()) + { + this.playerrenderer.bindTexture(TEXTURE); + + + //float[] afloat = EntitySheep.func_175513_a(RenderSheep.getFleeceColor()); + GlStateManager.color(1, 0,1); + + + //this.sheepModel.setModelAttributes(this.playerrenderer.getMainModel()); + //this.sheepModel.setLivingAnimations(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks); + //this.sheepModel.render(entitylivingbaseIn, 1, 2, 3,4, 5, 1); + } + } + + @Override + public boolean shouldCombineTextures() { + return false; + } +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticSusanno.java b/src/minecraft/animeware/cosmetic/impl/CosmeticSusanno.java new file mode 100644 index 0000000..1dd9dcb --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticSusanno.java @@ -0,0 +1,248 @@ +package animeware.cosmetic.impl; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticController; +import animeware.cosmetic.CosmeticModelBase; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class CosmeticSusanno extends CosmeticBase +{ + private static final ResourceLocation susanno = new ResourceLocation("Animeware/cosmetic/susanno.png"); + private final CosmeticSusanno.SusannoModel susannoModel; + + public CosmeticSusanno(RenderPlayer player) + { + super(player); + this.susannoModel = new CosmeticSusanno.SusannoModel(player); + } + + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) + { + + + + + if (player == Minecraft.getMinecraft().thePlayer && CosmeticController.shouldRenderTopHat(player)) { + GlStateManager.pushMatrix(); + + this.renderPlayer.bindTexture(susanno); + GlStateManager.enableBlend(); + + GlStateManager.color(1,0,1); + + GlStateManager.blendFunc(77, 77); + this.susannoModel.render(player, limbSwing, limbSwingAmount, ageInTicks, headPitch, headPitch, scale); + + GL11.glPopMatrix(); + } + + + + } + + + public static class SusannoModel extends CosmeticModelBase + { + ModelRenderer leftRib12; + ModelRenderer leftRib22; + ModelRenderer leftRib32; + ModelRenderer leftRib42; + ModelRenderer rightRib12; + ModelRenderer rightRib22; + ModelRenderer rightRib32; + ModelRenderer rightRib42; + ModelRenderer Spine; + ModelRenderer leftRib41; + ModelRenderer rightRib41; + ModelRenderer leftRib31; + ModelRenderer leftRib21; + ModelRenderer leftRib11; + ModelRenderer rightRib31; + ModelRenderer rightRib21; + ModelRenderer rightRib11; + ModelRenderer leftRib43; + ModelRenderer leftRib33; + ModelRenderer leftRib23; + ModelRenderer leftRib13; + ModelRenderer rightRib43; + ModelRenderer rightRib33; + ModelRenderer rightRib23; + ModelRenderer rightRib13; + + public SusannoModel(RenderPlayer player) + { + super(player); + this.textureWidth = 128; + this.textureHeight = 64; + (this.leftRib12 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 1, 3, 10); + this.leftRib12.setRotationPoint(9.0F, 18.0F, -5.0F); + this.leftRib12.setTextureSize(64, 32); + this.leftRib12.mirror = true; + this.setRotation(this.leftRib12, 0.0F, 0.0F, 0.0F); + (this.leftRib22 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 1, 3, 14); + this.leftRib22.setRotationPoint(11.0F, 10.0F, -7.0F); + this.leftRib22.setTextureSize(64, 32); + this.leftRib22.mirror = true; + this.setRotation(this.leftRib22, 0.0F, 0.0F, 0.0F); + (this.leftRib32 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 1, 3, 14); + this.leftRib32.setRotationPoint(11.0F, 2.0F, -7.0F); + this.leftRib32.setTextureSize(64, 32); + this.leftRib32.mirror = true; + this.setRotation(this.leftRib32, 0.0F, 0.0F, 0.0F); + (this.leftRib42 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 1, 3, 10); + this.leftRib42.setRotationPoint(9.0F, -5.0F, -5.0F); + this.leftRib42.setTextureSize(64, 32); + this.leftRib42.mirror = true; + this.setRotation(this.leftRib42, 0.0F, 0.0F, 0.0F); + (this.rightRib12 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 1, 3, 10); + this.rightRib12.setRotationPoint(-10.0F, 18.0F, -5.0F); + this.rightRib12.setTextureSize(64, 32); + this.rightRib12.mirror = true; + this.setRotation(this.rightRib12, 0.0F, 0.0F, 0.0F); + (this.rightRib22 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 1, 3, 14); + this.rightRib22.setRotationPoint(-12.0F, 10.0F, -7.0F); + this.rightRib22.setTextureSize(64, 32); + this.rightRib22.mirror = true; + this.setRotation(this.rightRib22, 0.0F, 0.0F, 0.0F); + (this.rightRib32 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 1, 3, 14); + this.rightRib32.setRotationPoint(-12.0F, 2.0F, -7.0F); + this.rightRib32.setTextureSize(64, 32); + this.rightRib32.mirror = true; + this.setRotation(this.rightRib32, 0.0F, 0.0F, 0.0F); + (this.rightRib42 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 1, 3, 10); + this.rightRib42.setRotationPoint(-10.0F, -5.0F, -5.0F); + this.rightRib42.setTextureSize(64, 32); + this.rightRib42.mirror = true; + this.setRotation(this.rightRib42, 0.0F, 0.0F, 0.0F); + (this.Spine = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 4, 26, 3); + this.Spine.setRotationPoint(-2.0F, -5.0F, 9.0F); + this.Spine.setTextureSize(64, 32); + this.Spine.mirror = true; + this.setRotation(this.Spine, 0.0F, 0.0F, 0.0F); + (this.leftRib41 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 10, 3, 1); + this.leftRib41.setRotationPoint(1.5F, -5.0F, 10.3F); + this.leftRib41.setTextureSize(64, 32); + this.leftRib41.mirror = true; + this.setRotation(this.leftRib41, 0.0F, 0.6632251F, 0.0F); + (this.rightRib41 = new ModelRenderer(this, 0, 0)).addBox(-10.0F, 0.0F, 0.0F, 10, 3, 1); + this.rightRib41.setRotationPoint(-1.6F, -5.0F, 10.5F); + this.rightRib41.setTextureSize(64, 32); + this.rightRib41.mirror = true; + this.setRotation(this.rightRib41, 0.0F, -0.6894051F, 0.0F); + (this.leftRib31 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 11, 3, 1); + this.leftRib31.setRotationPoint(1.3F, 2.0F, 10.0F); + this.leftRib31.setTextureSize(64, 32); + this.leftRib31.mirror = true; + this.setRotation(this.leftRib31, 0.0F, 0.3665191F, 0.0F); + (this.leftRib21 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 11, 3, 1); + this.leftRib21.setRotationPoint(1.3F, 10.0F, 10.0F); + this.leftRib21.setTextureSize(64, 32); + this.leftRib21.mirror = true; + this.setRotation(this.leftRib21, 0.0F, 0.3665191F, 0.0F); + (this.leftRib11 = new ModelRenderer(this, 0, 0)).addBox(0.0F, -1.0F, 0.0F, 10, 3, 1); + this.leftRib11.setRotationPoint(1.5F, 19.0F, 10.3F); + this.leftRib11.setTextureSize(64, 32); + this.leftRib11.mirror = true; + this.setRotation(this.leftRib11, 0.0F, 0.6632251F, 0.0F); + (this.rightRib31 = new ModelRenderer(this, 0, 0)).addBox(-11.0F, 0.0F, 0.0F, 11, 3, 1); + this.rightRib31.setRotationPoint(-1.3F, 2.0F, 10.0F); + this.rightRib31.setTextureSize(64, 32); + this.rightRib31.mirror = true; + this.setRotation(this.rightRib31, 0.0F, -0.3665191F, 0.0F); + (this.rightRib21 = new ModelRenderer(this, 0, 0)).addBox(-11.0F, 0.0F, 0.0F, 11, 3, 1); + this.rightRib21.setRotationPoint(-1.3F, 10.0F, 10.0F); + this.rightRib21.setTextureSize(64, 32); + this.rightRib21.mirror = true; + this.setRotation(this.rightRib21, 0.0F, -0.3665191F, 0.0F); + (this.rightRib11 = new ModelRenderer(this, 0, 0)).addBox(-10.0F, 0.0F, 0.0F, 10, 3, 1); + this.rightRib11.setRotationPoint(-1.6F, 18.0F, 10.5F); + this.rightRib11.setTextureSize(64, 32); + this.rightRib11.mirror = true; + this.setRotation(this.rightRib11, 0.0F, -0.6894051F, 0.0F); + (this.leftRib43 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 7, 3, 1); + this.leftRib43.setRotationPoint(4.6F, -5.0F, -9.5F); + this.leftRib43.setTextureSize(64, 32); + this.leftRib43.mirror = true; + this.setRotation(this.leftRib43, 0.0F, -0.6894051F, 0.0F); + (this.leftRib33 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 7, 3, 1); + this.leftRib33.setRotationPoint(6.5F, 2.0F, -11.4F); + this.leftRib33.setTextureSize(64, 32); + this.leftRib33.mirror = true; + this.setRotation(this.leftRib33, 0.0F, -0.6894051F, 0.0F); + (this.leftRib23 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 7, 3, 1); + this.leftRib23.setRotationPoint(6.5F, 10.0F, -11.4F); + this.leftRib23.setTextureSize(64, 32); + this.leftRib23.mirror = true; + this.setRotation(this.leftRib23, 0.0F, -0.6894051F, 0.0F); + (this.leftRib13 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 7, 3, 1); + this.leftRib13.setRotationPoint(4.6F, 18.0F, -9.5F); + this.leftRib13.setTextureSize(64, 32); + this.leftRib13.mirror = true; + this.setRotation(this.leftRib13, 0.0F, -0.6894051F, 0.0F); + (this.rightRib43 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 7, 3, 1); + this.rightRib43.setRotationPoint(-10.0F, -5.0F, -5.0F); + this.rightRib43.setTextureSize(64, 32); + this.rightRib43.mirror = true; + this.setRotation(this.rightRib43, 0.0F, 0.6632251F, 0.0F); + (this.rightRib33 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 7, 3, 1); + this.rightRib33.setRotationPoint(-12.0F, 2.0F, -7.0F); + this.rightRib33.setTextureSize(64, 32); + this.rightRib33.mirror = true; + this.setRotation(this.rightRib33, 0.0F, 0.6632251F, 0.0F); + (this.rightRib23 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 7, 3, 1); + this.rightRib23.setRotationPoint(-12.0F, 10.0F, -7.0F); + this.rightRib23.setTextureSize(64, 32); + this.rightRib23.mirror = true; + this.setRotation(this.rightRib23, 0.0F, 0.6632251F, 0.0F); + (this.rightRib13 = new ModelRenderer(this, 0, 0)).addBox(0.0F, 0.0F, 0.0F, 7, 3, 1); + this.rightRib13.setRotationPoint(-10.0F, 18.0F, -5.0F); + this.rightRib13.setTextureSize(64, 32); + this.rightRib13.mirror = true; + this.setRotation(this.rightRib13, 0.0F, 0.6632251F, 0.0F); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.leftRib12.render(scale); + this.leftRib22.render(scale); + this.leftRib32.render(scale); + this.leftRib42.render(scale); + this.rightRib12.render(scale); + this.rightRib22.render(scale); + this.rightRib32.render(scale); + this.rightRib42.render(scale); + this.Spine.render(scale); + this.leftRib41.render(scale); + this.rightRib41.render(scale); + this.leftRib31.render(scale); + this.leftRib21.render(scale); + this.leftRib11.render(scale); + this.rightRib31.render(scale); + this.rightRib21.render(scale); + this.rightRib11.render(scale); + this.leftRib43.render(scale); + this.leftRib33.render(scale); + this.leftRib23.render(scale); + this.leftRib13.render(scale); + this.rightRib43.render(scale); + this.rightRib33.render(scale); + this.rightRib23.render(scale); + this.rightRib13.render(scale); + } + } +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticSusanoo.java b/src/minecraft/animeware/cosmetic/impl/CosmeticSusanoo.java new file mode 100644 index 0000000..6453f32 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticSusanoo.java @@ -0,0 +1,143 @@ +package animeware.cosmetic.impl; + +import animeware.NightSky; +import animeware.cosmetic.CosmeticChecker; +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticModelBase; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; + + + + +public class CosmeticSusanoo extends CosmeticBase { + private final NAME2 nameModel; + + public CosmeticSusanoo(RenderPlayer renderPlayer) { + super(renderPlayer); + this.nameModel = new NAME2(renderPlayer); + } + + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + + GlStateManager.pushMatrix(); + GlStateManager.color(1, 0, 0); + GlStateManager.disableLighting(); + GlStateManager.blendFunc(1, 1); + GlStateManager.enableBlend(); + if(player.isSneaking()) { + GlStateManager.rotate(20, 1, 0, 0); + GlStateManager.translate(0, 0.20, -0.05); + } + GlStateManager.translate(0, -0.2, 0); + + + String uuid = player.getUniqueID().toString(); + if(uuid.contains("dwjandowpiahnbdwoiuadw")) { + this.nameModel.render((Entity)player, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); + GlStateManager.color(1, 1, 1); + } + //if(Animeware.Susanoo && CapeChecker.ownsZeroTwoCape(player) && player instanceof EntityPlayerSP) { + GlStateManager.disableColorMaterial(); + GlStateManager.color(255, 0, 0); + this.nameModel.render((Entity)player, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); + //} + GlStateManager.enableLighting(); + GlStateManager.enableLighting(); + GlStateManager.enableColorMaterial(); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + } + class NAME2 extends CosmeticModelBase { + ModelRenderer Back; + ModelRenderer upperlane; + ModelRenderer upperlaneonedown; + ModelRenderer upperlanetwodown; + ModelRenderer left1; + ModelRenderer left2; + ModelRenderer left3; + ModelRenderer right1; + ModelRenderer right2; + ModelRenderer right3; + + public NAME2(RenderPlayer player) { + super(player); + textureWidth = 0; + textureHeight = 0; + Back = new ModelRenderer(this, 0, 0); + Back.addBox(0F, 0F, 0F, 2, 15, 1); + Back.setRotationPoint(-1F, 0F, 6F); + Back.setTextureSize(64, 32); + Back.mirror = true; + upperlane = new ModelRenderer(this, 0, 0); + upperlane.addBox(0F, 0F, 0F, 22, 1, 1); + upperlane.setRotationPoint(-11F, 3F, 6F); + upperlane.setTextureSize(64, 32); + upperlane.mirror = true; + upperlaneonedown = new ModelRenderer(this, 0, 0); + upperlaneonedown.addBox(0F, 0F, 0F, 22, 1, 1); + upperlaneonedown.setRotationPoint(-11F, 6F, 6F); + upperlaneonedown.setTextureSize(64, 32); + upperlaneonedown.mirror = true; + upperlanetwodown = new ModelRenderer(this, 0, 0); + upperlanetwodown.addBox(0F, 0F, 0F, 22, 1, 1); + upperlanetwodown.setRotationPoint(-11F, 10F, 6F); + upperlanetwodown.setTextureSize(64, 32); + upperlanetwodown.mirror = true; + left1 = new ModelRenderer(this, 0, 0); + left1.addBox(0F, 0F, 0F, 1, 1, 9); + left1.setRotationPoint(10F, 3F, -3F); + left1.setTextureSize(64, 32); + left1.mirror = true; + left2 = new ModelRenderer(this, 0, 0); + left2.addBox(0F, 0F, 0F, 1, 1, 9); + left2.setRotationPoint(10F, 6F, -3F); + left2.setTextureSize(64, 32); + left2.mirror = true; + left3 = new ModelRenderer(this, 0, 0); + left3.addBox(0F, 0F, 0F, 1, 1, 9); + left3.setRotationPoint(10F, 10F, -3F); + left3.setTextureSize(64, 32); + left3.mirror = true; + right1 = new ModelRenderer(this, 0, 0); + right1.addBox(0F, 0F, 0F, 1, 1, 9); + right1.setRotationPoint(-11F, 3F, -3F); + right1.setTextureSize(64, 32); + right1.mirror = true; + right2 = new ModelRenderer(this, 0, 0); + right2.addBox(0F, 0F, 0F, 1, 1, 9); + right2.setRotationPoint(-11F, 6F, -3F); + right2.setTextureSize(64, 32); + right2.mirror = true; + right3 = new ModelRenderer(this, 0, 0); + right3.addBox(0F, 0F, 0F, 1, 1, 9); + right3.setRotationPoint(-11F, 10F, -3F); + right3.setTextureSize(64, 32); + right3.mirror = true; + + + } + + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float headYaw, float headPitch, float scale) { + GlStateManager.pushMatrix(); + this.Back.render(scale); + this.right1.render(scale); + this.right2.render(scale); + this.right3.render(scale); + this.upperlane.render(scale); + this.upperlaneonedown.render(scale); + this.upperlanetwodown.render(scale); + this.left1.render(scale); + this.left2.render(scale); + this.left3.render(scale); + + GlStateManager.popMatrix(); + + } + + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticWings.java b/src/minecraft/animeware/cosmetic/impl/CosmeticWings.java new file mode 100644 index 0000000..7e5dcfe --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticWings.java @@ -0,0 +1,100 @@ +package animeware.cosmetic.impl; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.util.ResourceLocation; + +public class CosmeticWings extends ModelBase implements LayerRenderer { + + + private final RenderPlayer playerRenderer; + + private Minecraft mc; + + private ResourceLocation location; + + private ModelRenderer wing; + + private ModelRenderer wingTip; + + private boolean playerUsesFullHeight; + + public CosmeticWings(RenderPlayer playerRendererIn) { + + this.playerRenderer = playerRendererIn; + this.mc = Minecraft.getMinecraft(); + this.location = new ResourceLocation("Animeware/cosmetic/wings.png"); + setTextureOffset("wing.bone", 0, 0); + setTextureOffset("wing.skin", -10, 8); + setTextureOffset("wingtip.bone", 0, 5); + setTextureOffset("wingtip.skin", -10, 18); + this.wing = new ModelRenderer(this, "wing"); + this.wing.setTextureSize(30, 30); + this.wing.setRotationPoint(-2.0F, 0.0F, 0.0F); + this.wing.addBox("bone", -10.0F, -1.0F, -1.0F, 10, 2, 2); + this.wing.addBox("skin", -10.0F, 0.0F, 0.5F, 10, 0, 10); + this.wingTip = new ModelRenderer(this, "wingtip"); + this.wingTip.setTextureSize(30, 30); + this.wingTip.setRotationPoint(-10.0F, 0.0F, 0.0F); + this.wingTip.addBox("bone", -10.0F, -0.5F, -0.5F, 10, 1, 1); + this.wingTip.addBox("skin", -10.0F, 0.0F, 0.5F, 10, 0, 10); + this.wing.addChild(this.wingTip); + } + + private float interpolate(float yaw1, float yaw2, float percent) { + float f = (yaw1 + (yaw2 - yaw1) * percent) % 360.0F; + if (f < 1.0F) + f += 360.0F; + return f; + } + + @Override + public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, + float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scalee) { + + if (entitylivingbaseIn == Minecraft.getMinecraft().thePlayer && !entitylivingbaseIn.isInvisible() && Booleans.CosmeticWings) { + double rotate = interpolate(entitylivingbaseIn.prevRenderYawOffset, entitylivingbaseIn.renderYawOffset, partialTicks); + GL11.glPushMatrix(); + GL11.glScaled(-0.6, -0.6, 0.6); + GL11.glTranslated(0.0D, -1.45, 0.1D); + GL11.glTranslated(0.0D, 1.3D, 0.2D); + if (entitylivingbaseIn.isSneaking()) { + GlStateManager.translate(0.0F, -0.142F, -0.0178F); + } + GL11.glRotated(130, 1, 0, 0); + GL11.glRotated(180, 0, 1, 0); + + GL11.glColor3f(1, 1, 1); + this.mc.getTextureManager().bindTexture(this.location); + for (int j = 0; j < 2; j++) { + GL11.glEnable(2884); + float f11 = (float) (System.currentTimeMillis() % 1000L) / 1000.0F * 3.1415927F * 2.0F; + this.wing.rotateAngleX = (float) Math.toRadians(-80.0D) - (float) Math.cos(f11) * 0.2F; + this.wing.rotateAngleY = (float) Math.toRadians(20.0D) + (float) Math.sin(f11) * 0.4F; + this.wing.rotateAngleZ = (float) Math.toRadians(20.0D); + this.wingTip.rotateAngleZ = -((float) (Math.sin((f11 + 2.0F)) + 0.5D)) * 0.95F; + this.wing.render(0.0625F); + GL11.glScalef(-1.0F, 1.0F, 1.0F); + if (j == 0) + GL11.glCullFace(1028); + } + GL11.glCullFace(1029); + GL11.glDisable(2884); + GL11.glColor3f(255.0F, 255.0F, 255.0F); + GL11.glPopMatrix(); + } + } + + @Override + public boolean shouldCombineTextures() { + return false; + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticWitchHat.java b/src/minecraft/animeware/cosmetic/impl/CosmeticWitchHat.java new file mode 100644 index 0000000..0185530 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticWitchHat.java @@ -0,0 +1,103 @@ +package animeware.cosmetic.impl; + +import java.io.IOException; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticModelBase; +import animeware.util.DatabaseUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + + + +public class CosmeticWitchHat extends CosmeticBase { + private final HatModel hatModel; + + private static final ResourceLocation TEXTURE = new ResourceLocation("Animeware/cosmetic/HexenHut.png"); + public CosmeticWitchHat(RenderPlayer renderPlayer) { + super(renderPlayer); + this.hatModel = new HatModel(renderPlayer); + } + + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + + GL11.glPushMatrix(); + + if(player.isSneaking()) { + GlStateManager.translate(0, 0.262, 0); + } + GlStateManager.rotate(netHeadYaw, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(headPitch, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(-0.3125, -0.55, -0.3125); + this.renderPlayer.bindTexture(TEXTURE); + if(Booleans.CosmeticWitchHat && player == Minecraft.getMinecraft().thePlayer) { + this.hatModel.render((Entity)player, limbSwing, limbSwingAmount, ageInTicks, headPitch, headPitch, scale); + GL11.glColor3d(1, 1, 1); + } + String uuid = player.getUniqueID().toString(); + try { + if(uuid.contains("dwaodbwabdwo8ad")) { + + GL11.glColor3d(DatabaseUtil.getDouble(uuid, "hat-r"), DatabaseUtil.getDouble(uuid, "hat-g"), DatabaseUtil.getDouble(uuid, "hat-b")); + this.hatModel.render((Entity)player, limbSwing, limbSwingAmount, ageInTicks, headPitch, headPitch, scale); + GL11.glColor3d(1, 1, 1); + } + } catch (IOException e) { + e.printStackTrace(); + } + + + GL11.glColor3f(1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } + + } + + class HatModel extends CosmeticModelBase { + + private ModelRenderer witchHat; + + public HatModel(RenderPlayer player) { + super(player); + + this.witchHat = (new ModelRenderer((ModelBase)this)).setTextureSize(64, 128); + this.witchHat.setTextureOffset(0, 64).addBox(0.0F, 0.0F, 0.0F, 10, 2, 10); + ModelRenderer modelrenderer = (new ModelRenderer((ModelBase)this)).setTextureSize(64, 128); + modelrenderer.setRotationPoint(1.75F, -4.0F, 2.0F); + modelrenderer.setTextureOffset(0, 76).addBox(0.0F, 0.0F, 0.0F, 7, 4, 7); + modelrenderer.rotateAngleX = -0.05235988F; + modelrenderer.rotateAngleZ = 0.02617994F; + this.witchHat.addChild(modelrenderer); + ModelRenderer modelrenderer1 = (new ModelRenderer((ModelBase)this)).setTextureSize(64, 128); + modelrenderer1.setRotationPoint(1.75F, -4.0F, 2.0F); + modelrenderer1.setTextureOffset(0, 87).addBox(0.0F, 0.0F, 0.0F, 4, 4, 4); + modelrenderer1.rotateAngleX = -0.10471976F; + modelrenderer1.rotateAngleZ = 0.05235988F; + modelrenderer.addChild(modelrenderer1); + ModelRenderer modelrenderer2 = (new ModelRenderer((ModelBase)this)).setTextureSize(64, 128); + modelrenderer2.setRotationPoint(1.75F, -2.0F, 2.0F); + modelrenderer2.setTextureOffset(0, 95).addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.25F); + modelrenderer2.rotateAngleX = -0.20943952F; + modelrenderer2.rotateAngleZ = 0.10471976F; + modelrenderer1.addChild(modelrenderer2); + } + + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float headYaw, float headPitch, float scale) { + + final ResourceLocation TEXTURE = new ResourceLocation("Animeware/cosmetic/HexenHut.png"); + Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE); + this.witchHat.render(scale); + + + } + } + diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticWither.java b/src/minecraft/animeware/cosmetic/impl/CosmeticWither.java new file mode 100644 index 0000000..4345477 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticWither.java @@ -0,0 +1,58 @@ +package animeware.cosmetic.impl; + +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + + +public class CosmeticWither implements LayerRenderer{ + private static final ResourceLocation WITHER_ARMOR = new ResourceLocation("textures/entity/wither/wither_armor.png"); + + private final RenderPlayer witherRenderer; + + private ModelPlayer witherModel = new ModelPlayer(0.5F, true); + + public CosmeticWither(RenderPlayer renderPlayer) { + this.witherRenderer = renderPlayer; + this.witherModel = renderPlayer.getMainModel(); + } + + public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { + + GlStateManager.depthMask(!entitylivingbaseIn.isInvisible()); + this.witherRenderer.bindTexture(WITHER_ARMOR); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + float f = entitylivingbaseIn.ticksExisted + partialTicks; + float f1 = MathHelper.cos(f * 0.02F) * 3.0F; + float f2 = f * 0.01F; + GlStateManager.translate(f1, f2, 0.0F); + GlStateManager.matrixMode(5888); + GlStateManager.enableBlend(); + float f3 = 0.5F; + GlStateManager.color(f3, f3, f3, 1.0F); + GlStateManager.disableLighting(); + GlStateManager.blendFunc(1, 1); + this.witherModel.setLivingAnimations((EntityLivingBase)entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks); + this.witherModel.setModelAttributes((ModelBase)this.witherRenderer.getMainModel()); + this.witherModel.render((Entity)entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + GlStateManager.enableLighting(); + GlStateManager.disableBlend(); + + } + + public boolean shouldCombineTextures() { + return true; + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticWitherArmor.java b/src/minecraft/animeware/cosmetic/impl/CosmeticWitherArmor.java new file mode 100644 index 0000000..8f3c254 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticWitherArmor.java @@ -0,0 +1,71 @@ +package animeware.cosmetic.impl; + +import java.awt.Color; + +import animeware.cosmetic.CosmeticController; +import animeware.util.RainbowColor; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + + +public class CosmeticWitherArmor implements LayerRenderer +{ + private static final ResourceLocation WITHER_ARMOR = new ResourceLocation("Animeware/cosmetic/creeper_armor.png"); + private final RenderPlayer renderPlayer; + private final ModelPlayer playerModel; + + public CosmeticWitherArmor(RenderPlayer renderPlayer) + { + this.renderPlayer = renderPlayer; + this.playerModel = renderPlayer.getMainModel(); + } + + + + public void doRenderLayer(AbstractClientPlayer player, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + + + + + if (player == Minecraft.getMinecraft().thePlayer && CosmeticController.shouldRenderTopHat(player)) { + GlStateManager.depthMask(!player.isInvisible()); + this.renderPlayer.bindTexture(WITHER_ARMOR); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + float f = (float) player.ticksExisted + partialTicks; + float f1 = MathHelper.cos(f * 0.004F) * 3.0F; + float f2 = f * 0.004F; + GlStateManager.translate(f1, f2, 0.0F); + GlStateManager.matrixMode(5888); + GlStateManager.enableBlend(); + float f3 = 0.5F; + //GlStateManager.color(f3, f3, f3, 1.0F); + Color.getColor(String.valueOf(RainbowColor.colorLerpv2(Color.DARK_GRAY, Color.RED, 1))); + GlStateManager.disableLighting(); + GlStateManager.blendFunc(1, 1); + this.playerModel.setLivingAnimations(player, p_177141_2_, p_177141_3_, partialTicks); + this.playerModel.setModelAttributes(this.renderPlayer.getMainModel()); + this.playerModel.render(player, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + GlStateManager.enableLighting(); + GlStateManager.disableBlend(); + } + + + + } + + public boolean shouldCombineTextures() + { + return false; + } +} diff --git a/src/minecraft/animeware/cosmetic/impl/CosmeticWitherpet.java b/src/minecraft/animeware/cosmetic/impl/CosmeticWitherpet.java new file mode 100644 index 0000000..1465d43 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CosmeticWitherpet.java @@ -0,0 +1,101 @@ +package animeware.cosmetic.impl; + + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticModelBase; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class CosmeticWitherpet extends CosmeticBase +{ + private final CosmeticWitherpet.CosmeticVilligerNose2 wingsModel; + + public CosmeticWitherpet(RenderPlayer renderPlayer) + { + super(renderPlayer); + this.wingsModel = new CosmeticWitherpet.CosmeticVilligerNose2(renderPlayer, 0.0F); + } + + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) + { + if(Booleans.Witherpet == true) { + GL11.glPushMatrix(); + + if (player.isSneaking()) + { + GlStateManager.translate(0.0D, 0.2D, -0.05D); + } + + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("textures/entity/wither/wither.png")); + GlStateManager.scale(0.4D, 0.4D, 0.4D); + GlStateManager.translate(1.7D, -1.0D, 0.0D); + float f = ageInTicks / 60.0F; + float f1 = f * (float)Math.PI * 1.0F; + GlStateManager.translate(0.0F, -((float)(Math.sin((double)(f1 + 2.0F)) + 0.5D)) * 0.08F, 0.0F); + Minecraft.getMinecraft(); + + if (player == Minecraft.getMinecraft().thePlayer) + { + GlStateManager.color(255.0F, 255.0F, 255.0F); + this.wingsModel.render(player, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); + } + + GL11.glPopMatrix(); + } + + } + + public class CosmeticVilligerNose2 extends CosmeticModelBase + { + private ModelRenderer[] field_82905_a; + private ModelRenderer[] field_82904_b; + + public CosmeticVilligerNose2(RenderPlayer player, float p_i46302_1_) + { + super(player); + this.textureWidth = 64; + this.textureHeight = 64; + this.field_82905_a = new ModelRenderer[3]; + (this.field_82905_a[0] = new ModelRenderer(this, 0, 16)).addBox(-10.0F, 3.9F, -0.5F, 20, 3, 3, p_i46302_1_); + (this.field_82905_a[1] = (new ModelRenderer(this)).setTextureSize(this.textureWidth, this.textureHeight)).setRotationPoint(-2.0F, 6.9F, -0.5F); + this.field_82905_a[1].setTextureOffset(0, 22).addBox(0.0F, 0.0F, 0.0F, 3, 10, 3, p_i46302_1_); + this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 1.5F, 0.5F, 11, 2, 2, p_i46302_1_); + this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 4.0F, 0.5F, 11, 2, 2, p_i46302_1_); + this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 6.5F, 0.5F, 11, 2, 2, p_i46302_1_); + (this.field_82905_a[2] = new ModelRenderer(this, 12, 22)).addBox(0.0F, 0.0F, 0.0F, 3, 6, 3, p_i46302_1_); + this.field_82904_b = new ModelRenderer[3]; + (this.field_82904_b[0] = new ModelRenderer(this, 0, 0)).addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8, p_i46302_1_); + (this.field_82904_b[1] = new ModelRenderer(this, 32, 0)).addBox(-4.0F, -4.0F, -4.0F, 6, 6, 6, p_i46302_1_); + this.field_82904_b[1].rotationPointX = -8.0F; + this.field_82904_b[1].rotationPointY = 4.0F; + (this.field_82904_b[2] = new ModelRenderer(this, 32, 0)).addBox(-4.0F, -4.0F, -4.0F, 6, 6, 6, p_i46302_1_); + this.field_82904_b[2].rotationPointX = 10.0F; + this.field_82904_b[2].rotationPointY = 4.0F; + } + + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float headYaw, float headPitch, float scale) + { + GlStateManager.pushMatrix(); + + for (ModelRenderer modelrenderer : this.field_82904_b) + { + modelrenderer.render(scale); + } + + for (ModelRenderer modelrenderer1 : this.field_82905_a) + { + modelrenderer1.render(scale); + } + + GlStateManager.popMatrix(); + } + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/cosmetic/impl/CustomBandana.java b/src/minecraft/animeware/cosmetic/impl/CustomBandana.java new file mode 100644 index 0000000..7648e14 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/CustomBandana.java @@ -0,0 +1,5 @@ +package animeware.cosmetic.impl; + +public class CustomBandana { + +} diff --git a/src/minecraft/animeware/cosmetic/impl/DogPet.java b/src/minecraft/animeware/cosmetic/impl/DogPet.java new file mode 100644 index 0000000..984bd41 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/DogPet.java @@ -0,0 +1,136 @@ +package animeware.cosmetic.impl; + +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticModelBase; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class DogPet extends CosmeticBase +{ + DogPet.WolfModel wolfModel; + public static final ResourceLocation TEXTURE = new ResourceLocation("Animeware/cosmetic/wolfModel.png"); + + public DogPet(RenderPlayer player) + { + super(player); + this.wolfModel = new DogPet.WolfModel(player); + } + + + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) + { + + } + + static class WolfModel extends CosmeticModelBase + { + private final ModelRenderer wolfHeadMain; + private final ModelRenderer wolfBody; + private final ModelRenderer wolfMane; + private final ModelRenderer wolfLeg1; + private final ModelRenderer wolfLeg2; + private final ModelRenderer wolfLeg3; + private final ModelRenderer wolfLeg4; + private final ModelRenderer wolfTail; + + public WolfModel(RenderPlayer player) + { + super(player); + float f = 0.0F; + float f1 = 13.5F; + this.wolfHeadMain = new ModelRenderer(this, 0, 0); + this.wolfHeadMain.addBox(-3.0F, -3.0F, -2.0F, 6, 6, 4, f); + this.wolfHeadMain.setRotationPoint(-1.0F, f1, -7.0F); + this.wolfBody = new ModelRenderer(this, 18, 14); + this.wolfBody.addBox(-4.0F, -2.0F, -3.0F, 6, 9, 6, f); + this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F); + this.wolfMane = new ModelRenderer(this, 21, 0); + this.wolfMane.addBox(-4.0F, -3.0F, -3.0F, 8, 6, 7, f); + this.wolfMane.setRotationPoint(-1.0F, 14.0F, 2.0F); + this.wolfLeg1 = new ModelRenderer(this, 0, 18); + this.wolfLeg1.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F); + this.wolfLeg2 = new ModelRenderer(this, 0, 18); + this.wolfLeg2.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F); + this.wolfLeg3 = new ModelRenderer(this, 0, 18); + this.wolfLeg3.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F); + this.wolfLeg4 = new ModelRenderer(this, 0, 18); + this.wolfLeg4.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F); + this.wolfTail = new ModelRenderer(this, 9, 18); + this.wolfTail.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F); + this.wolfHeadMain.setTextureOffset(16, 14).addBox(-3.0F, -5.0F, 0.0F, 2, 2, 1, f); + this.wolfHeadMain.setTextureOffset(16, 14).addBox(1.0F, -5.0F, 0.0F, 2, 2, 1, f); + this.wolfHeadMain.setTextureOffset(0, 10).addBox(-1.5F, 0.0F, -5.0F, 3, 3, 4, f); + } + + @Override + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale); + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.setLivingAnimations((EntityLivingBase)entityIn, p_78088_2_, p_78088_3_, 0.0F); + this.wolfHeadMain.renderWithRotation(scale); + this.wolfBody.render(scale); + this.wolfLeg1.render(scale); + this.wolfLeg2.render(scale); + this.wolfLeg3.render(scale); + this.wolfLeg4.render(scale); + this.wolfTail.renderWithRotation(scale); + this.wolfMane.render(scale); + } + + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + if (entitylivingbaseIn.isSneaking()) + { + this.wolfMane.setRotationPoint(-1.0F, 16.0F, -3.0F); + this.wolfMane.rotateAngleX = ((float)Math.PI * 2F / 5F); + this.wolfMane.rotateAngleY = 0.0F; + this.wolfBody.setRotationPoint(0.0F, 18.0F, 0.0F); + this.wolfBody.rotateAngleX = ((float)Math.PI / 4F); + this.wolfTail.setRotationPoint(-1.0F, 21.0F, 6.0F); + this.wolfLeg1.setRotationPoint(-2.5F, 22.0F, 2.0F); + this.wolfLeg1.rotateAngleX = ((float)Math.PI * 3F / 2F); + this.wolfLeg2.setRotationPoint(0.5F, 22.0F, 2.0F); + this.wolfLeg2.rotateAngleX = ((float)Math.PI * 3F / 2F); + this.wolfLeg3.rotateAngleX = 5.811947F; + this.wolfLeg3.setRotationPoint(-2.49F, 17.0F, -4.0F); + this.wolfLeg4.rotateAngleX = 5.811947F; + this.wolfLeg4.setRotationPoint(0.51F, 17.0F, -4.0F); + } + else + { + this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F); + this.wolfBody.rotateAngleX = ((float)Math.PI / 2F); + this.wolfMane.setRotationPoint(-1.0F, 14.0F, -3.0F); + this.wolfMane.rotateAngleX = this.wolfBody.rotateAngleX; + this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F); + this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F); + this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F); + this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F); + this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F); + this.wolfLeg1.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F) * 1.4F * p_78086_3_; + this.wolfLeg2.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F + (float)Math.PI) * 1.4F * p_78086_3_; + this.wolfLeg3.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F + (float)Math.PI) * 1.4F * p_78086_3_; + this.wolfLeg4.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F) * 1.4F * p_78086_3_; + } + } + + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + this.wolfHeadMain.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.wolfHeadMain.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.wolfTail.rotateAngleX = p_78087_3_; + } + } +} diff --git a/src/minecraft/animeware/cosmetic/impl/GalaxyWings.java b/src/minecraft/animeware/cosmetic/impl/GalaxyWings.java new file mode 100644 index 0000000..d1aa9d0 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/GalaxyWings.java @@ -0,0 +1,101 @@ +package animeware.cosmetic.impl; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticChecker; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.util.ResourceLocation; + +public class GalaxyWings extends ModelBase implements LayerRenderer { + + + private final RenderPlayer playerRenderer; + + private Minecraft mc; + + private ResourceLocation location; + + private ModelRenderer wing; + + private ModelRenderer wingTip; + + private boolean playerUsesFullHeight; + + public GalaxyWings(RenderPlayer playerRendererIn) { + + this.playerRenderer = playerRendererIn; + this.mc = Minecraft.getMinecraft(); + this.location = new ResourceLocation("Animeware/cosmetic/gwings1.png"); + setTextureOffset("wing.bone", 0, 0); + setTextureOffset("wing.skin", -10, 8); + setTextureOffset("wingtip.bone", 0, 5); + setTextureOffset("wingtip.skin", -10, 18); + this.wing = new ModelRenderer(this, "wing"); + this.wing.setTextureSize(30, 30); + this.wing.setRotationPoint(-1.0F, 0.0F, 0.0F); + this.wing.addBox("bone", -10.0F, -1.0F, -1.0F, 10, 2, 2); + this.wing.addBox("skin", -10.0F, 0.0F, 0.5F, 10, 0, 10); + this.wingTip = new ModelRenderer(this, "wingtip"); + this.wingTip.setTextureSize(30, 30); + this.wingTip.setRotationPoint(-10.0F, 0.0F, 0.0F); + this.wingTip.addBox("bone", -10.0F, -0.5F, -0.5F, 10, 1, 1); + this.wingTip.addBox("skin", -10.0F, 0.0F, 0.5F, 10, 0, 10); + this.wing.addChild(this.wingTip); + } + + private float interpolate(float yaw1, float yaw2, float percent) { + float f = (yaw1 + (yaw2 - yaw1) * percent) % 360.0F; + if (f < 0.0F) + f += 360.0F; + return f; + } + + @Override + public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, + float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scalee) { + + if (entitylivingbaseIn == Minecraft.getMinecraft().thePlayer && !entitylivingbaseIn.isInvisible() && Booleans.GalaxyWings) { + double rotate = interpolate(entitylivingbaseIn.prevRenderYawOffset, entitylivingbaseIn.renderYawOffset, partialTicks); + GL11.glPushMatrix(); + GL11.glScaled(-0.6, -0.6, 0.6); + GL11.glTranslated(0.0D, -1.45, 0.1D); + GL11.glTranslated(0.0D, 1.3D, 0.2D); + if (entitylivingbaseIn.isSneaking()) { + GlStateManager.translate(0.0F, -0.142F, -0.0178F); + } + GL11.glRotated(130, 1, 0, 0); + GL11.glRotated(180, 0, 1, 0); + + GL11.glColor3f(1, 1, 1); + this.mc.getTextureManager().bindTexture(this.location); + for (int j = 0; j < 2; j++) { + GL11.glEnable(2884); + float f11 = (float) (System.currentTimeMillis() % 1000L) / 1000.0F * 3.1415927F * 2.0F; + this.wing.rotateAngleX = (float) Math.toRadians(-80.0D) - (float) Math.cos(f11) * 0.2F; + this.wing.rotateAngleY = (float) Math.toRadians(20.0D) + (float) Math.sin(f11) * 0.4F; + this.wing.rotateAngleZ = (float) Math.toRadians(20.0D); + this.wingTip.rotateAngleZ = -((float) (Math.sin((f11 + 2.0F)) + 0.5D)) * 0.95F; + this.wing.render(0.0615F); + GL11.glScalef(-1.0F, 1.0F, 1.0F); + if (j == 0) + GL11.glCullFace(1028); + } + GL11.glCullFace(1029); + GL11.glDisable(2884); + GL11.glColor3f(255.0F, 255.0F, 255.0F); + GL11.glPopMatrix(); + } + } + + @Override + public boolean shouldCombineTextures() { + return false; + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/cosmetic/impl/Halo.java b/src/minecraft/animeware/cosmetic/impl/Halo.java new file mode 100644 index 0000000..11a295c --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/Halo.java @@ -0,0 +1,95 @@ +package animeware.cosmetic.impl; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticChecker; +import animeware.cosmetic.Cosmetic; +import animeware.cosmetic.CosmeticController; +import animeware.cosmetic.CosmeticModelBase; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class Halo extends Cosmetic { + private final HaloRenderer haloModel; + + public Halo(RenderPlayer renderPlayer) { + super("Halo", false, renderPlayer); + this.haloModel = new HaloRenderer(renderPlayer); + } + @Override + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + if(Booleans.Halo && CosmeticChecker.ownsHalo(player) && player == Minecraft.getMinecraft().thePlayer && !player.isInvisible()) { + GL11.glPushMatrix(); + if(player.isSneaking()) { + GlStateManager.translate(0, 0.225, 0); + } + + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/cosmetic/halo.png")); + float[] color = CosmeticChecker.getHaloColor(player); + GL11.glColor3d(color[0], color[1], color[2]); + this.haloModel.render((Entity)player, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); + GL11.glColor3f(1, 1, 1); + GL11.glPopMatrix(); + } + } + + public class HaloRenderer extends CosmeticModelBase { + ModelRenderer head; + ModelRenderer body; + ModelRenderer rightarm; + ModelRenderer leftarm; + ModelRenderer rightleg; + ModelRenderer leftleg; + ModelRenderer Halo1; + ModelRenderer Halo2; + ModelRenderer Halo3; + ModelRenderer Halo4; + + public HaloRenderer(RenderPlayer player) { + super(player); + textureWidth = 64; + textureHeight = 32; + + Halo1 = new ModelRenderer(this, 0, 0); + Halo1.addBox(0F, 0F, 0F, 10, 1, 1); + Halo1.setRotationPoint(-5F, -11F, 4F); + Halo1.setTextureSize(64, 32); + Halo1.mirror = true; + Halo2 = new ModelRenderer(this, 0, 0); + Halo2.addBox(0F, 0F, 0F, 10, 1, 1); + Halo2.setRotationPoint(-5F, -11F, -5F); + Halo2.setTextureSize(64, 32); + Halo2.mirror = true; + Halo3 = new ModelRenderer(this, 0, 0); + Halo3.addBox(0F, 0F, 0F, 1, 1, 8); + Halo3.setRotationPoint(4F, -11F, -4F); + Halo3.setTextureSize(64, 32); + Halo3.mirror = true; + Halo4 = new ModelRenderer(this, 0, 0); + Halo4.addBox(0F, 0F, 0F, 1, 1, 8); + Halo4.setRotationPoint(-5F, -11F, -4F); + Halo4.setTextureSize(64, 32); + Halo4.mirror = true; + } + + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float HeadYaw, float headPitch, float scale) { + GlStateManager.pushMatrix(); + float f1 = + ageInTicks / 100F; + float f6 = f1 * 3.1415927F* 1.0F; + GlStateManager.translate(0, (-(float)(Math.sin(f6 + 2.0F) + 0.5D) * 0.08F), 0); + GlStateManager.scale(0.9, 0.9, 0.9); + this.Halo1.render(scale); + this.Halo2.render(scale); + this.Halo3.render(scale); + this.Halo4.render(scale); + GlStateManager.popMatrix(); + } + } +} + \ No newline at end of file diff --git a/src/minecraft/animeware/cosmetic/impl/QuickCape.java b/src/minecraft/animeware/cosmetic/impl/QuickCape.java new file mode 100644 index 0000000..1df8751 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/QuickCape.java @@ -0,0 +1,92 @@ +package animeware.cosmetic.impl; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +import com.mojang.realmsclient.dto.RealmsServer.McoServerComparator; + +import animeware.NightSky; +import animeware.cosmetic.CosmeticChecker; +import animeware.cosmetic.Cosmetic; +import animeware.cosmetic.CosmeticController; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class QuickCape extends Cosmetic +{ + private final RenderPlayer playerRenderer; + + public QuickCape(RenderPlayer renderPlayer) { + super("quickcape", true, renderPlayer); + this.playerRenderer = renderPlayer; + this.wearing = shouldWear(); + } + + + public boolean shouldCombineTextures() + { + return false; + } + + @Override + public void render(AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, + float ageInTicks, float netHeadYaw, float headPitch, float scale) { + if (/*Animeware.QuickCape && */entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE)/* && entitylivingbaseIn.getName().equals(Minecraft.getMinecraft().getSession().getUsername())*/ && CosmeticChecker.ownsQuickCape(entitylivingbaseIn)) + { + if(CosmeticController.shouldRenderQuickCape(entitylivingbaseIn) && entitylivingbaseIn == Minecraft.getMinecraft().thePlayer) { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/quick.png")); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + } + } + + public static boolean shouldWear() { + if(mc.getSession().getUsername().equalsIgnoreCase("hypnomacka")) return true; + + else return false; + } +} diff --git a/src/minecraft/animeware/cosmetic/impl/Susanno2.java b/src/minecraft/animeware/cosmetic/impl/Susanno2.java new file mode 100644 index 0000000..ed969af --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/Susanno2.java @@ -0,0 +1,139 @@ +package animeware.cosmetic.impl; + +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticModelBase; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; + + +public class Susanno2 extends CosmeticBase { + private final NAME2 nameModel; + + public Susanno2(RenderPlayer renderPlayer) { + super(renderPlayer); + this.nameModel = new NAME2(renderPlayer); + } + + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + + GlStateManager.pushMatrix(); + GlStateManager.color(1, 0, 0); + GlStateManager.disableLighting(); + GlStateManager.blendFunc(1, 1); + GlStateManager.enableBlend(); + if(player.isSneaking()) { + GlStateManager.rotate(20, 1, 0, 0); + GlStateManager.translate(0, 0.20, -0.05); + } + GlStateManager.translate(0, -0.2, 0); + + + String uuid = player.getUniqueID().toString(); + if(uuid.contains("56440916ebc4470bbac02088214a78d7")) { + this.nameModel.render((Entity)player, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); + GlStateManager.color(1, 0, 1); + } + if(player == Minecraft.getMinecraft().thePlayer) { + GlStateManager.disableColorMaterial(); + GlStateManager.color(255, 0, 0); + this.nameModel.render((Entity)player, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); + } + GlStateManager.enableLighting(); + GlStateManager.enableLighting(); + GlStateManager.enableColorMaterial(); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + } + class NAME2 extends CosmeticModelBase { + ModelRenderer Back; + ModelRenderer upperlane; + ModelRenderer upperlaneonedown; + ModelRenderer upperlanetwodown; + ModelRenderer left1; + ModelRenderer left2; + ModelRenderer left3; + ModelRenderer right1; + ModelRenderer right2; + ModelRenderer right3; + + public NAME2(RenderPlayer player) { + super(player); + textureWidth = 0; + textureHeight = 0; + Back = new ModelRenderer(this, 0, 0); + Back.addBox(0F, 0F, 0F, 2, 15, 1); + Back.setRotationPoint(-1F, 0F, 6F); + Back.setTextureSize(64, 32); + Back.mirror = true; + upperlane = new ModelRenderer(this, 0, 0); + upperlane.addBox(0F, 0F, 0F, 22, 1, 1); + upperlane.setRotationPoint(-11F, 3F, 6F); + upperlane.setTextureSize(64, 32); + upperlane.mirror = true; + upperlaneonedown = new ModelRenderer(this, 0, 0); + upperlaneonedown.addBox(0F, 0F, 0F, 22, 1, 1); + upperlaneonedown.setRotationPoint(-11F, 6F, 6F); + upperlaneonedown.setTextureSize(64, 32); + upperlaneonedown.mirror = true; + upperlanetwodown = new ModelRenderer(this, 0, 0); + upperlanetwodown.addBox(0F, 0F, 0F, 22, 1, 1); + upperlanetwodown.setRotationPoint(-11F, 10F, 6F); + upperlanetwodown.setTextureSize(64, 32); + upperlanetwodown.mirror = true; + left1 = new ModelRenderer(this, 0, 0); + left1.addBox(0F, 0F, 0F, 1, 1, 9); + left1.setRotationPoint(10F, 3F, -3F); + left1.setTextureSize(64, 32); + left1.mirror = true; + left2 = new ModelRenderer(this, 0, 0); + left2.addBox(0F, 0F, 0F, 1, 1, 9); + left2.setRotationPoint(10F, 6F, -3F); + left2.setTextureSize(64, 32); + left2.mirror = true; + left3 = new ModelRenderer(this, 0, 0); + left3.addBox(0F, 0F, 0F, 1, 1, 9); + left3.setRotationPoint(10F, 10F, -3F); + left3.setTextureSize(64, 32); + left3.mirror = true; + right1 = new ModelRenderer(this, 0, 0); + right1.addBox(0F, 0F, 0F, 1, 1, 9); + right1.setRotationPoint(-11F, 3F, -3F); + right1.setTextureSize(64, 32); + right1.mirror = true; + right2 = new ModelRenderer(this, 0, 0); + right2.addBox(0F, 0F, 0F, 1, 1, 9); + right2.setRotationPoint(-11F, 6F, -3F); + right2.setTextureSize(64, 32); + right2.mirror = true; + right3 = new ModelRenderer(this, 0, 0); + right3.addBox(0F, 0F, 0F, 1, 1, 9); + right3.setRotationPoint(-11F, 10F, -3F); + right3.setTextureSize(64, 32); + right3.mirror = true; + + + } + + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float headYaw, float headPitch, float scale) { + GlStateManager.pushMatrix(); + this.Back.render(scale); + this.right1.render(scale); + this.right2.render(scale); + this.right3.render(scale); + this.upperlane.render(scale); + this.upperlaneonedown.render(scale); + this.upperlanetwodown.render(scale); + this.left1.render(scale); + this.left2.render(scale); + this.left3.render(scale); + + GlStateManager.popMatrix(); + + } + + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/cosmetic/impl/TopHat.java b/src/minecraft/animeware/cosmetic/impl/TopHat.java new file mode 100644 index 0000000..f4950df --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/TopHat.java @@ -0,0 +1,95 @@ +package animeware.cosmetic.impl; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticChecker; +import animeware.cosmetic.Cosmetic; +import animeware.cosmetic.CosmeticModelBase; +import animeware.cosmetic.HatChecker; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class TopHat extends Cosmetic { + + private final ModelTopHat modelTopHat; + private static final ResourceLocation TEXTURE = new ResourceLocation("Animeware/cosmetic/hat.png"); + + public TopHat(RenderPlayer renderPlayer) { + super("TopHat", false, renderPlayer); + modelTopHat = new ModelTopHat(renderPlayer); + } + + @Override + public void render(AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, + float ageInTicks, float netHeadYaw, float headPitch, float scale) { + + if(Booleans.TopHat && /*entitylivingbaseIn.getName().equals(Minecraft.getMinecraft().getSession().getUsername()) && */CosmeticChecker.ownsHat(entitylivingbaseIn)) { + GlStateManager.pushMatrix(); + playerRenderer.bindTexture(TEXTURE); + + if(entitylivingbaseIn.isSneaking()) { + GL11.glTranslated(0, 0.225D, 0); + } + + float[] color = CosmeticChecker.getTopHatColor(entitylivingbaseIn); + GL11.glColor3d(color[0], color[1], color[2]); + modelTopHat.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, scale); + GL11.glColor3f(1, 1, 1); + GL11.glPopMatrix(); + } + + } + + private static class ModelTopHat extends CosmeticModelBase { + + private ModelRenderer rim; + private ModelRenderer pointy; + + public ModelTopHat(RenderPlayer renderPlayer) { + super(renderPlayer); + rim = new ModelRenderer(playerModel, 0, 0); + rim.addBox(-5.5f, -9f, -5.5f, 11, 2, 11); + + pointy = new ModelRenderer(playerModel, 0, 13); + pointy.addBox(-3.5f, -17f, -3.5f, 7, 8, 7); + } + + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float headYaw, float headPitch, float headScale, float scale) { + + rim.rotateAngleX = playerModel.bipedHead.rotateAngleX; + rim.rotateAngleY = playerModel.bipedHead.rotateAngleY; + rim.rotationPointX = 0.0f; + rim.rotationPointY = 0.0f; + rim.render(scale); + + pointy.rotateAngleX = playerModel.bipedHead.rotateAngleX; + pointy.rotateAngleY = playerModel.bipedHead.rotateAngleY; + pointy.rotationPointX = 0.0f; + pointy.rotationPointY = 0.0f; + pointy.render(scale); + + } + + /*public boolean ownsCosmeticHat() { + if(mc.getSession().getUsername().equalsIgnoreCase("hypnomacka")) return true; + if(mc.getSession().getUsername().equalsIgnoreCase("Quaversal")) return true; + + else return false; + }*/ + + + } + + public static boolean ownsCosmeticHat() { + if(mc.getSession().getUsername().equalsIgnoreCase("hypnomacka")) return true; + if(mc.getSession().getUsername().equalsIgnoreCase("Quaversal")) return true; + + else return false; + } +} diff --git a/src/minecraft/animeware/cosmetic/impl/eyes/CosmeticEyes.java b/src/minecraft/animeware/cosmetic/impl/eyes/CosmeticEyes.java new file mode 100644 index 0000000..e2cb33e --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/eyes/CosmeticEyes.java @@ -0,0 +1,146 @@ +package animeware.cosmetic.impl.eyes; + +import java.util.Random; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticBase; +import animeware.cosmetic.CosmeticController; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.util.ResourceLocation; + +public class CosmeticEyes extends CosmeticBase { + + private final ModelEyes model; + private static final ResourceLocation TEXTURE = new ResourceLocation("clientname/eyes.png"); + + private static final float[] headJointSneak = new float[] {0F, -1F/16F, 0F}; + private static final float[] headJoint = new float[3]; + private static final float[] eyeOffset = new float[] {0F, 4F/16F, 4F/16F}; + private static final float[] irisColor = new float[] {0.9F, 0.9F, 0.9F}; + private static final float[] pupilColor = new float[] {0.0F, 0.0F, 0.0F}; + private static final float halfInterpupillaryDistance = 2F/16F; + private static final float eyeScale = 0.75F; + private static final float modelScale = 0.0625F; + + private Random rand = new Random(); + private int[] potionTime = new int[2]; + + public CosmeticEyes(RenderPlayer playerRenderer) { + super(playerRenderer); + model = new ModelEyes(playerRenderer); + } + + @Override + public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + + if(!Booleans.retardEyes) { + return; + } + + EyePhysics physics = PhysicsManager.getInstance().getPhysics(player); + + physics.requireUpdate(); + + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); + + for(int i = 0; i < 2; i++) { + GlStateManager.color(0F, 1F, 1F, 1F); + GlStateManager.pushMatrix(); + + float[] joint = getSneakOffset(player, partialTicks); + GlStateManager.translate(-joint[0], -joint[1], -joint[2]); + + GlStateManager.rotate(getHeadYaw(player, partialTicks), 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(getHeadPitch(player, partialTicks), 1.0F, 0.0F, 0.0F); + + GlStateManager.translate(-(eyeOffset[0] + (i == 0 ? halfInterpupillaryDistance : -halfInterpupillaryDistance)), -eyeOffset[1], -eyeOffset[2]); + + GlStateManager.scale(eyeScale, eyeScale, eyeScale * 0.5F); + + Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE); + + GlStateManager.color(irisColor[0], irisColor[1], irisColor[2]); + model.renderIris(modelScale); + + GlStateManager.color(pupilColor[0], pupilColor[1], pupilColor[2]); + float pupilScale = getPupilScale(player, partialTicks, i); + + GlStateManager.pushMatrix(); + GlStateManager.scale(pupilScale, pupilScale, 1F); + + model.movePupil( + physics.eyes[i].prevDeltaX + (physics.eyes[i].deltaX - physics.eyes[i].prevDeltaX) * partialTicks, + physics.eyes[i].prevDeltaY + (physics.eyes[i].deltaY - physics.eyes[i].prevDeltaY) * partialTicks, + pupilScale + ); + + model.renderPupil(modelScale); + + GlStateManager.popMatrix(); + GlStateManager.popMatrix(); + + } + + GlStateManager.color(0F, 1F, 1F, 1F); + + } + + //TODO: + private float getPupilScale(AbstractClientPlayer player, float partialTicks, int eye) { + + if(!player.getActivePotionEffects().isEmpty()) { + + rand.setSeed(Math.abs(player.hashCode()) * 1000); + if(potionTime == null || potionTime.length < 2) { + potionTime = new int[2]; + } + + for(int i = 0; i < potionTime.length; i++) { + potionTime[i] = 20 + rand.nextInt(20); + } + return 0.3F + ((float) Math.sin(Math.toRadians((player.ticksExisted + partialTicks) / potionTime[eye] * 360)) + 1F) / 2F; + + } + + return 1F; + } + + private float interpolateRotation(float prevAngle, float nextAngle, float partialTicks) { + float f = nextAngle - prevAngle; + while(f < -180) { + f += 360.0F; + } + + while(f >= 180) { + f -= 360.0F; + } + + return prevAngle + partialTicks * f; + } + + private float getHeadPitch(AbstractClientPlayer player, float partialTicks) { + return interpolateRotation(player.prevRotationPitch, player.rotationPitch, partialTicks); + } + + private float getHeadYaw(AbstractClientPlayer player, float partialTicks) { + return interpolateRotation(player.prevRotationYawHead, player.rotationYawHead, partialTicks) - interpolateRotation(player.prevRenderYawOffset, player.renderYawOffset, partialTicks); + } + + private float[] getSneakOffset(AbstractClientPlayer player, float partialTicks) { + if(player.isSneaking()) { + GlStateManager.translate(0.0f, 0.2f, 0.0F); + return headJointSneak; + } + return headJoint; + } + + @Override + public boolean shouldCombineTextures() { + return true; + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/eyes/EyePhysics.java b/src/minecraft/animeware/cosmetic/impl/eyes/EyePhysics.java new file mode 100644 index 0000000..e6d6700 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/eyes/EyePhysics.java @@ -0,0 +1,147 @@ +package animeware.cosmetic.impl.eyes; + +import java.util.Random; + +import animeware.cosmetic.CosmeticController; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.util.MathHelper; + +public class EyePhysics { + + private final AbstractClientPlayer player; + private final Random rand; + + private boolean shouldUpdate = true; + private long lastUpdate; + + private double motionX; + private double motionY; + private double motionZ; + + public EyeInfo[] eyes; + + public class EyeInfo { + + private float rotationYaw; + private float rotationPitch; + + public float prevDeltaX; + public float prevDeltaY; + public float deltaX; + public float deltaY; + + private float momentumX; + private float momentumY; + + public EyeInfo() { + prevDeltaY = deltaY = -1f; + } + + public void update(int eve, EyePhysics physics, double motionX, double motionY, double motionZ) { + + float prevRotationYaw = rotationYaw; + float prevRotationPitch = rotationPitch; + + rotationYaw = physics.player.prevRotationYaw; + rotationPitch = physics.player.prevRotationPitch; + + prevDeltaX = deltaX; + prevDeltaY = deltaY; + + float yawDiff = rotationYaw - prevRotationYaw; + float pitchDiff = rotationPitch - prevRotationPitch; + + momentumY += motionY * 1.5F + (motionX + motionZ) * rand.nextGaussian() * 0.75F + (pitchDiff / 45F) + (yawDiff / 180F); + momentumX -= (motionX + motionZ) * rand.nextGaussian() * 0.4F + (yawDiff / 45F); + + float momentumLoss = 0.9F; + float newDeltaX = deltaX + momentumX; + float newDeltaY = deltaY + momentumY; + + if(newDeltaX < -1F || newDeltaX > 1F) { + + float newMo = momentumX * -momentumLoss; + float randomFloat = 0.8F + rand.nextFloat() * 0.2F; + momentumX = newMo * randomFloat; + momentumY += newMo * randomFloat * (rand.nextFloat() > 0.5F ? 1F : -1F); + + } + + if(newDeltaY < -1F || newDeltaY > 1F) { + float newMo = momentumY * -momentumLoss; + float randomFloat = 0.8F + rand.nextFloat() * 0.2F; + momentumX = newMo * randomFloat; + momentumY += newMo * randomFloat * (rand.nextFloat() > 0.5F ? 1F : -1F); + } + else { + momentumY -= MathHelper.clamp_float(1F + deltaY, 0F, 0.1999F); + } + + momentumX *= 0.95F; + deltaX *= 0.95F; + + if(Math.abs(momentumX) < 0.03F) { + momentumX = 0.0F; + } + + if(Math.abs(deltaX) < 0.03F) { + deltaX = 0.0F; + } + + float maxMomentum = 1.3f; + + momentumX = MathHelper.clamp_float(momentumX, -maxMomentum, maxMomentum); + momentumY = MathHelper.clamp_float(momentumY, -maxMomentum, maxMomentum); + + deltaX += momentumX; + deltaY += momentumY; + + deltaX = MathHelper.clamp_float(deltaX, -1F, 1F); + deltaY = MathHelper.clamp_float(deltaY, -1F, 1F); + + } + + } + + public EyePhysics(AbstractClientPlayer player) { + this.player = player; + this.rand = new Random(Math.abs(player.hashCode()) * 8134); + this.eyes = new EyeInfo[2]; + for(int i = 0; i < eyes.length; i++) { + this.eyes[i] = new EyeInfo(); + } + update(); + } + + public void update() { + + if(!shouldUpdate) { + return; + } + + shouldUpdate = false; + + motionX = player.posX - player.prevPosX; + motionY = player.posY - player.prevPosY; + motionZ = player.posZ - player.prevPosZ; + + for(int i = 0; i < eyes.length; i++) { + eyes[i].update(i, this, motionX, motionY, motionZ); + } + + } + + public void requireUpdate() { + shouldUpdate = true; + lastUpdate = player.worldObj.getWorldTime(); + } + + public long getLastUpdate() { + return lastUpdate; + } + + public AbstractClientPlayer getPlayer() { + return player; + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/eyes/ModelEyes.java b/src/minecraft/animeware/cosmetic/impl/eyes/ModelEyes.java new file mode 100644 index 0000000..98e81b7 --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/eyes/ModelEyes.java @@ -0,0 +1,91 @@ +package animeware.cosmetic.impl.eyes; + +import animeware.cosmetic.CosmeticModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.Entity; + +public class ModelEyes extends CosmeticModelBase { + + private ModelRenderer[] iris = new ModelRenderer[12]; + private ModelRenderer[] pupils = new ModelRenderer[6]; + + private final float POP1 = 0.5235987755982988F; + private final float POP2 = 1.0471975511965976F; + private final float POP3 = 1.5707963267948966F; + private final float POP4 = 2.0943951023931953F; + private final float POP5 = 2.6179938779914944F; + private final float POP6 = 3.141592653589793F; + + public ModelEyes(RenderPlayer player) { + super(player); + + for(int i = 0; i < iris.length; i++) { + this.iris[i] = new ModelRenderer(this, 0, 0); + this.iris[i].setRotationPoint(0, 0, 0); + this.iris[i].addBox(-0.5F, -1.88F, -1.0F, 1, 3, 1, 0.0F); + } + + this.setRotationAngle(iris[0], 0.0F, 0.0F, -POP1); + this.setRotationAngle(iris[1], 0.0F, 0.0F, -POP2); + this.setRotationAngle(iris[2], 0.0F, 0.0F, -POP3); + this.setRotationAngle(iris[3], 0.0F, 0.0F, -POP4); + this.setRotationAngle(iris[4], 0.0F, 0.0F, -POP5); + this.setRotationAngle(iris[5], 0.0F, 0.0F, -POP6); + + this.setRotationAngle(iris[6], 0.0F, 0.0F, POP5); + this.setRotationAngle(iris[7], 0.0F, 0.0F, POP4); + this.setRotationAngle(iris[8], 0.0F, 0.0F, POP3); + this.setRotationAngle(iris[9], 0.0F, 0.0F, POP2); + this.setRotationAngle(iris[10], 0.0F, 0.0F, POP1); + + for(int i = 0; i < pupils.length; i++) { + this.pupils[i] = new ModelRenderer(this, 0, 0); + this.pupils[i].setRotationPoint(0, 0, 0); + this.pupils[i].addBox(-0.5f, -0.88f, -1.5f, 1, 1, 1, 0.0F); + } + + this.setRotationAngle(pupils[0], 0.0F, 0.0F, -POP2); + this.setRotationAngle(pupils[1], 0.0F, 0.0F, -POP4); + this.setRotationAngle(pupils[2], 0.0F, 0.0F, -POP6); + this.setRotationAngle(pupils[3], 0.0F, 0.0F, POP4); + this.setRotationAngle(pupils[4], 0.0F, 0.0F, POP2); + } + + private void setRotationAngle(ModelRenderer m, float x, float y, float z) { + m.rotateAngleX = x; + m.rotateAngleY = y; + m.rotateAngleZ = z; + } + + @Override + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) { + /*Nothing here*/ + } + + public void renderIris(float pt) { + for(int i = 0; i < iris.length; i++) { + this.iris[i].render(pt); + } + } + + public void renderPupil(float pt) { + for(int i = 0; i < pupils.length; i++) { + this.pupils[i].render(pt); + } + } + + public void movePupil(float x, float y, float size) { + + float shiftFactor = (1.45F - size * 0.525F) / size; + + for(int i = 0; i < pupils.length; i++) { + + pupils[i].rotationPointX = -x * shiftFactor; + pupils[i].rotationPointY = -y * shiftFactor * (float)Math.cos(Math.toRadians((x / 1F) * 90F)); + + } + + } + +} diff --git a/src/minecraft/animeware/cosmetic/impl/eyes/PhysicsManager.java b/src/minecraft/animeware/cosmetic/impl/eyes/PhysicsManager.java new file mode 100644 index 0000000..c5574ae --- /dev/null +++ b/src/minecraft/animeware/cosmetic/impl/eyes/PhysicsManager.java @@ -0,0 +1,71 @@ +package animeware.cosmetic.impl.eyes; + +import java.util.Iterator; +import java.util.Map; +import java.util.WeakHashMap; + +import animeware.event.EventManager; +import animeware.event.EventTarget; +import animeware.event.impl.ClientTick; +import animeware.event.impl.WorldUnloadEvent; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; + +public class PhysicsManager { + + private WeakHashMap physicsList = new WeakHashMap(); + + private static PhysicsManager instance = null; + + public static PhysicsManager getInstance() { + if(instance == null) { + instance = new PhysicsManager(); + EventManager.register(instance); + } + return instance; + } + + public EyePhysics getPhysics(AbstractClientPlayer player) { + if(!physicsList.containsKey(player)) { + physicsList.put(player, new EyePhysics(player)); + } + return physicsList.get(player); + } + + @EventTarget + public void onTick(ClientTick event) { + + if(Minecraft.getMinecraft().theWorld != null && !Minecraft.getMinecraft().isGamePaused()) { + + Iterator> iterator = physicsList.entrySet().iterator(); + + while(iterator.hasNext()) { + Map.Entry e = iterator.next(); + EyePhysics ep = e.getValue(); + + if(ep.getPlayer().worldObj.getWorldTime() - ep.getLastUpdate() > 3) { + iterator.remove(); + } + else { + ep.update(); + } + } + + } + + } + + @EventTarget + public void onWorldUload(WorldUnloadEvent event) { + Iterator> iterator = physicsList.entrySet().iterator(); + + while(iterator.hasNext()) { + Map.Entry e = iterator.next(); + EyePhysics ep = e.getValue(); + if(ep.getPlayer().worldObj == event.getWorld()) { + iterator.remove(); + } + } + } + +} diff --git a/src/minecraft/animeware/event/ArrayHelper.java b/src/minecraft/animeware/event/ArrayHelper.java new file mode 100644 index 0000000..75274b9 --- /dev/null +++ b/src/minecraft/animeware/event/ArrayHelper.java @@ -0,0 +1,130 @@ +package animeware.event; + +import java.util.Iterator; + +/** + * Created by Hexeption on 18/12/2016. + */ +public class ArrayHelper implements Iterable { + + //TODO: Comment out the code. + + private T[] elements; + + public ArrayHelper(final T[] array) { + + this.elements = array; + } + + public ArrayHelper() { + + this.elements = (T[]) new Object[0]; + } + + public void add(final T t) { + + if (t != null) { + final Object[] array = new Object[this.size() + 1]; + + for (int i = 0; i < array.length; i++) { + if (i < this.size()) { + array[i] = this.get(i); + } else { + array[i] = t; + } + } + + this.set((T[]) array); + } + } + + public boolean contains(final T t) { + + Object[] array; + + for (int lenght = (array = this.array()).length, i = 0; i < lenght; i++) { + final T entry = (T) array[i]; + if (entry.equals(t)) { + return true; + } + } + + return false; + } + + public void remove(final T t) { + + if (this.contains(t)) { + final Object[] array = new Object[this.size() - 1]; + boolean b = true; + + for (int i = 0; i < this.size(); i++) { + if (b && this.get(i).equals(t)) { + b = false; + } else { + array[b ? i : (i - 1)] = this.get(i); + } + } + + this.set((T[]) array); + } + } + + public T[] array() { + + return (T[]) this.elements; + } + + public int size() { + + return this.array().length; + } + + public void set(final T[] array) { + + this.elements = array; + } + + public T get(final int index) { + + return this.array()[index]; + } + + public void clear() { + + this.elements = (T[]) new Object[0]; + } + + public boolean isEmpty() { + + return this.size() == 0; + } + + @Override + public Iterator iterator() { + + return new Iterator() { + + private int index = 0; + + @Override + public boolean hasNext() { + + return this.index < ArrayHelper.this.size() && ArrayHelper.this.get(this.index) != null; + } + + @Override + public T next() { + + return ArrayHelper.this.get(this.index++); + } + + @Override + public void remove() { + + ArrayHelper.this.remove(ArrayHelper.this.get(this.index)); + } + }; + + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/event/Cancelable.java b/src/minecraft/animeware/event/Cancelable.java new file mode 100644 index 0000000..553e87b --- /dev/null +++ b/src/minecraft/animeware/event/Cancelable.java @@ -0,0 +1,11 @@ +package animeware.event; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +@Retention(value = RUNTIME) +@Target(value = TYPE) +public @interface Cancelable{} diff --git a/src/minecraft/animeware/event/Data.java b/src/minecraft/animeware/event/Data.java new file mode 100644 index 0000000..7fc1a4d --- /dev/null +++ b/src/minecraft/animeware/event/Data.java @@ -0,0 +1,23 @@ +package animeware.event; + +import java.lang.reflect.Method; + +/** + * Created by Hexeption on 18/12/2016. + */ +public class Data { + + public final Object source; + + public final Method target; + + public final byte priority; + + Data(Object source, Method target, byte priority) { + + this.source = source; + this.target = target; + this.priority = priority; + } + +} diff --git a/src/minecraft/animeware/event/Event.java b/src/minecraft/animeware/event/Event.java new file mode 100644 index 0000000..7efa276 --- /dev/null +++ b/src/minecraft/animeware/event/Event.java @@ -0,0 +1,81 @@ +package animeware.event; + +import java.lang.reflect.InvocationTargetException; + +import animeware.NightSky; + +/** + * Created by Hexeption on 18/12/2016. + */ +public abstract class Event { + + /** + * + * Main events you may need: + * + * Minecraft: + * - EventKeyboard + * - EventMiddleClick + * - EventTick + * + * EntityPlayerSP: + * - EventUpdate + * - EventPreMotionUpdates + * - EventPostMotionUpdates + * + * GuiIngame: + * - EventRender2D + * + * EntityRenderer: + * - EventRender3D + * + */ + + private boolean cancelled; + + public enum State { + PRE("PRE", 0), + + POST("POST", 1); + + private State(final String string, final int number) { + + } + } + + public Event call() { + + this.cancelled = false; + call(this); + return this; + } + + public boolean isCancelled() { + + return cancelled; + } + + public void setCancelled(boolean cancelled) { + + this.cancelled = cancelled; + } + + private static final void call(final Event event) { + + final ArrayHelper dataList = NightSky.INSTANCE.eventManager.get(event.getClass()); + + if (dataList != null) { + for (final Data data : dataList) { + + try { + data.target.invoke(data.source, event); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } + + } + } + } +} diff --git a/src/minecraft/animeware/event/EventListener.java b/src/minecraft/animeware/event/EventListener.java new file mode 100644 index 0000000..742188b --- /dev/null +++ b/src/minecraft/animeware/event/EventListener.java @@ -0,0 +1,5 @@ +package animeware.event; + +public interface EventListener { + void call(T event); +} diff --git a/src/minecraft/animeware/event/EventManager.java b/src/minecraft/animeware/event/EventManager.java new file mode 100644 index 0000000..69773ac --- /dev/null +++ b/src/minecraft/animeware/event/EventManager.java @@ -0,0 +1,148 @@ +package animeware.event; + +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * Created by Hexeption on 18/12/2016. + */ +public class EventManager { + + //TODO: Comment Event's + + private static final Map, ArrayHelper> REGISTRY_MAP; + + public static void register(final Object o) { + + for (final Method method : o.getClass().getDeclaredMethods()) { + if (!isMethodBad(method)) { + register(method, o); + } + } + } + + public static void register(final Object o, final Class clazz) { + + for (final Method method : o.getClass().getDeclaredMethods()) { + if (!isMethodBad(method, clazz)) { + register(method, o); + } + } + } + + private static void register(final Method method, final Object o) { + + final Class clazz = method.getParameterTypes()[0]; + final Data methodData = new Data(o, method, method.getAnnotation(EventTarget.class).value()); + + if (!methodData.target.isAccessible()) { + methodData.target.setAccessible(true); + } + + if (EventManager.REGISTRY_MAP.containsKey(clazz)) { + if (!EventManager.REGISTRY_MAP.get(clazz).contains(methodData)) { + EventManager.REGISTRY_MAP.get(clazz).add(methodData); + sortListValue((Class) clazz); + } + } else { + EventManager.REGISTRY_MAP.put((Class) clazz, new ArrayHelper() { + + { + this.add(methodData); + } + }); + } + } + + public static void unregister(final Object o) { + + for (final ArrayHelper flexibalArray : EventManager.REGISTRY_MAP.values()) { + for (final Data methodData : flexibalArray) { + if (methodData.source.equals(o)) { + flexibalArray.remove(methodData); + } + } + } + + cleanMap(true); + } + + public static void unregister(final Object o, final Class clazz) { + + if (EventManager.REGISTRY_MAP.containsKey(clazz)) { + for (final Data methodData : EventManager.REGISTRY_MAP.get(clazz)) { + if (methodData.source.equals(o)) { + EventManager.REGISTRY_MAP.get(clazz).remove(methodData); + } + } + + cleanMap(true); + } + } + + + public static void cleanMap(final boolean b) { + + final Iterator, ArrayHelper>> iterator = EventManager.REGISTRY_MAP.entrySet().iterator(); + + while (iterator.hasNext()) { + if (!b || iterator.next().getValue().isEmpty()) { + iterator.remove(); + } + } + } + + public static void removeEnty(final Class clazz) { + + final Iterator, ArrayHelper>> iterator = EventManager.REGISTRY_MAP.entrySet().iterator(); + + while (iterator.hasNext()) { + if (iterator.next().getKey().equals(clazz)) { + iterator.remove(); + break; + } + } + } + + private static void sortListValue(final Class clazz) { + + final ArrayHelper flexibleArray = new ArrayHelper(); + + for (final byte b : Priority.VALUE_ARRAY) { + for (final Data methodData : EventManager.REGISTRY_MAP.get(clazz)) { + if (methodData.priority == b) { + flexibleArray.add(methodData); + } + } + } + + EventManager.REGISTRY_MAP.put(clazz, flexibleArray); + } + + private static boolean isMethodBad(final Method method) { + + return method.getParameterTypes().length != 1 || !method.isAnnotationPresent(EventTarget.class); + } + + private static boolean isMethodBad(final Method method, final Class clazz) { + + return isMethodBad(method) || method.getParameterTypes()[0].equals(clazz); + } + + public static ArrayHelper get(final Class clazz) { + + return EventManager.REGISTRY_MAP.get(clazz); + } + + public static void shutdown() { + + EventManager.REGISTRY_MAP.clear(); + } + + static { + REGISTRY_MAP = new HashMap, ArrayHelper>(); + } + +} diff --git a/src/minecraft/animeware/event/EventTarget.java b/src/minecraft/animeware/event/EventTarget.java new file mode 100644 index 0000000..a5cb015 --- /dev/null +++ b/src/minecraft/animeware/event/EventTarget.java @@ -0,0 +1,16 @@ +package animeware.event; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Created by Hexeption on 18/12/2016. + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface EventTarget { + + byte value() default 2; +} diff --git a/src/minecraft/animeware/event/Priority.java b/src/minecraft/animeware/event/Priority.java new file mode 100644 index 0000000..82f5a9b --- /dev/null +++ b/src/minecraft/animeware/event/Priority.java @@ -0,0 +1,16 @@ +package animeware.event; + +/** + * Created by Hexeption on 18/12/2016. + */ +public class Priority { + + public static final byte FIRST = 0, SECOND = 1, THIRD = 2, FOURTH = 3, FIFTH = 4; + + public static final byte[] VALUE_ARRAY; + + static { + VALUE_ARRAY = new byte[]{0, 1, 2, 3, 4}; + } + +} diff --git a/src/minecraft/animeware/event/impl/AttackEntityEvent.java b/src/minecraft/animeware/event/impl/AttackEntityEvent.java new file mode 100644 index 0000000..a256514 --- /dev/null +++ b/src/minecraft/animeware/event/impl/AttackEntityEvent.java @@ -0,0 +1,16 @@ +package animeware.event.impl; + +import animeware.event.Cancelable; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; + +@Cancelable +public class AttackEntityEvent extends PlayerEvent +{ + public final Entity target; + public AttackEntityEvent(EntityPlayer player, Entity target) + { + super(player); + this.target = target; + } +} diff --git a/src/minecraft/animeware/event/impl/ClientTick.java b/src/minecraft/animeware/event/impl/ClientTick.java new file mode 100644 index 0000000..7caffd2 --- /dev/null +++ b/src/minecraft/animeware/event/impl/ClientTick.java @@ -0,0 +1,7 @@ +package animeware.event.impl; + +import animeware.event.Event; + +public class ClientTick extends Event { + +} diff --git a/src/minecraft/animeware/event/impl/EntityEvent.java b/src/minecraft/animeware/event/impl/EntityEvent.java new file mode 100644 index 0000000..7df664c --- /dev/null +++ b/src/minecraft/animeware/event/impl/EntityEvent.java @@ -0,0 +1,91 @@ +package animeware.event.impl; + +import animeware.event.Event; +import net.minecraft.entity.Entity; + +/** + * EntityEvent is fired when an event involving any Entity occurs.
+ * If a method utilizes this {@link Event} as its parameter, the method will + * receive every child event of this class.
+ *
+ * {@link #entity} contains the entity that caused this event to occur.
+ *
+ * All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.
+ **/ +public class EntityEvent extends Event +{ + public final Entity entity; + + public EntityEvent(Entity entity) + { + this.entity = entity; + } + + /** + * EntityConstructing is fired when an Entity is being created.
+ * This event is fired within the constructor of the Entity.
+ *
+ * This event is not {@link Cancelable}.
+ *
+ * This event does not have a result. {@link HasResult}
+ *
+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
+ **/ + public static class EntityConstructing extends EntityEvent + { + public EntityConstructing(Entity entity) + { + super(entity); + } + } + + /** + * CanUpdate is fired when an Entity is being created.
+ * This event is fired whenever vanilla Minecraft determines that an entity
+ * cannot update in World#updateEntityWithOptionalForce(net.minecraft.entity.Entity, boolean)
+ *
+ * {@link CanUpdate#canUpdate} contains the boolean value of whether this entity can update.
+ * If the modder decides that this Entity can be updated, they may change canUpdate to true,
+ * and the entity with then be updated.
+ *
+ * This event is not {@link Cancelable}.
+ *
+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
+ **/ + public static class CanUpdate extends EntityEvent + { + public boolean canUpdate = false; + public CanUpdate(Entity entity) + { + super(entity); + } + } + + /** + * EnteringChunk is fired when an Entity enters a chunk.
+ * This event is fired whenever vanilla Minecraft determines that an entity
+ * is entering a chunk in Chunk#addEntity(net.minecraft.entity.Entity)
+ *
+ * This event is not {@link Cancelable}.
+ *
+ * This event does not have a result. {@link HasResult} + *
+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}.
+ **/ + public static class EnteringChunk extends EntityEvent + { + public int newChunkX; + public int newChunkZ; + public int oldChunkX; + public int oldChunkZ; + + public EnteringChunk(Entity entity, int newChunkX, int newChunkZ, int oldChunkX, int oldChunkZ) + { + super(entity); + this.newChunkX = newChunkX; + this.newChunkZ = newChunkZ; + this.oldChunkX = oldChunkX; + this.oldChunkZ = oldChunkZ; + } + } +} diff --git a/src/minecraft/animeware/event/impl/EventAttack.java b/src/minecraft/animeware/event/impl/EventAttack.java new file mode 100644 index 0000000..73212ff --- /dev/null +++ b/src/minecraft/animeware/event/impl/EventAttack.java @@ -0,0 +1,27 @@ +package animeware.event.impl; + +import animeware.event.Event; +import net.minecraft.entity.Entity; + +public class EventAttack extends Event { + private Entity entity; + private boolean preAttack; + + public void fire(Entity targetEntity, boolean preAttack) { + this.entity = targetEntity; + this.preAttack = preAttack; + //super.fire(targetEntity, preAttack); + } + + public Entity getEntity() { + return entity; + } + + public boolean isPreAttack() { + return preAttack; + } + + public boolean isPostAttack() { + return !preAttack; + } +} diff --git a/src/minecraft/animeware/event/impl/EventChat.java b/src/minecraft/animeware/event/impl/EventChat.java new file mode 100644 index 0000000..001c77f --- /dev/null +++ b/src/minecraft/animeware/event/impl/EventChat.java @@ -0,0 +1,21 @@ +package animeware.event.impl; + +import animeware.event.Event; + +public class EventChat extends Event { + + public String message; + + public EventChat(String text) { + this.message = text; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + +} diff --git a/src/minecraft/animeware/event/impl/EventKey.java b/src/minecraft/animeware/event/impl/EventKey.java new file mode 100644 index 0000000..0956f42 --- /dev/null +++ b/src/minecraft/animeware/event/impl/EventKey.java @@ -0,0 +1,19 @@ +package animeware.event.impl; + +import animeware.event.Event; + +public class EventKey extends Event { + + public int code; + + public EventKey(int code) { + this.code = code; + } + public int getCode() { + return code; + } + public void setCode(int code) { + this.code = code; + } + +} diff --git a/src/minecraft/animeware/event/impl/EventUpdate.java b/src/minecraft/animeware/event/impl/EventUpdate.java new file mode 100644 index 0000000..390ab3c --- /dev/null +++ b/src/minecraft/animeware/event/impl/EventUpdate.java @@ -0,0 +1,7 @@ +package animeware.event.impl; + +import animeware.event.Event; + +public class EventUpdate extends Event { + +} diff --git a/src/minecraft/animeware/event/impl/GameLoopEvent.java b/src/minecraft/animeware/event/impl/GameLoopEvent.java new file mode 100644 index 0000000..96c1480 --- /dev/null +++ b/src/minecraft/animeware/event/impl/GameLoopEvent.java @@ -0,0 +1,8 @@ +package animeware.event.impl; + +import animeware.event.Event; + +/** Fired every tick. + * @author Nora Cos | Nora#0001 + * @since 1.0.0 **/ +public class GameLoopEvent extends Event { } diff --git a/src/minecraft/animeware/event/impl/KeyEvent.java b/src/minecraft/animeware/event/impl/KeyEvent.java new file mode 100644 index 0000000..2a95725 --- /dev/null +++ b/src/minecraft/animeware/event/impl/KeyEvent.java @@ -0,0 +1,16 @@ +package animeware.event.impl; + +import animeware.event.Event; + +public class KeyEvent extends Event { + + private static int key; + + public KeyEvent(int key) { + this.key = key; + } + + public static int getKey() { + return key; + } +} diff --git a/src/minecraft/animeware/event/impl/LivingEvent.java b/src/minecraft/animeware/event/impl/LivingEvent.java new file mode 100644 index 0000000..d60ecb3 --- /dev/null +++ b/src/minecraft/animeware/event/impl/LivingEvent.java @@ -0,0 +1,61 @@ +package animeware.event.impl; + +import animeware.event.Cancelable; +import animeware.event.Event; +import net.minecraft.entity.EntityLivingBase; + +/** + * LivingEvent is fired whenever an event involving Living entities occurs.
+ * If a method utilizes this {@link Event} as its parameter, the method will + * receive every child event of this class.
+ *
+ * All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.
+ **/ +public class LivingEvent extends EntityEvent +{ + public final EntityLivingBase entityLiving; + public LivingEvent(EntityLivingBase entity) + { + super(entity); + entityLiving = entity; + } + + /** + * LivingUpdateEvent is fired when an Entity is updated.
+ * This event is fired whenever an Entity is updated in + * EntityLivingBase#onUpdate().
+ *
+ * This event is fired via the {@link ForgeHooks#onLivingUpdate(EntityLivingBase)}.
+ *
+ * This event is {@link Cancelable}.
+ * If this event is canceled, the Entity does not update.
+ *
+ * This event does not have a result. {@link HasResult}
+ *
+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + **/ + @Cancelable + public static class LivingUpdateEvent extends LivingEvent + { + public LivingUpdateEvent(EntityLivingBase e){ super(e); } + } + + /** + * LivingJumpEvent is fired when an Entity jumps.
+ * This event is fired whenever an Entity jumps in + * EntityLivingBase#jump(), EntityMagmaCube#jump(), + * and EntityHorse#jump().
+ *
+ * This event is fired via the {@link ForgeHooks#onLivingJump(EntityLivingBase)}.
+ *
+ * This event is not {@link Cancelable}.
+ *
+ * This event does not have a result. {@link HasResult}
+ *
+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + **/ + public static class LivingJumpEvent extends LivingEvent + { + public LivingJumpEvent(EntityLivingBase e){ super(e); } + } +} diff --git a/src/minecraft/animeware/event/impl/PlayerEvent.java b/src/minecraft/animeware/event/impl/PlayerEvent.java new file mode 100644 index 0000000..5d706b6 --- /dev/null +++ b/src/minecraft/animeware/event/impl/PlayerEvent.java @@ -0,0 +1,265 @@ +package animeware.event.impl; + + +import java.io.File; + +import animeware.event.Cancelable; +import animeware.event.Event; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; + +/** + * PlayerEvent is fired whenever an event involving Living entities occurs.
+ * If a method utilizes this {@link Event} as its parameter, the method will + * receive every child event of this class.
+ *
+ * All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}. + **/ +public class PlayerEvent extends LivingEvent +{ + public final EntityPlayer entityPlayer; + public PlayerEvent(EntityPlayer player) + { + super(player); + entityPlayer = player; + } + + /** + * HarvestCheck is fired when a player attempts to harvest a block.
+ * This event is fired whenever a player attempts to harvest a block in + * EntityPlayer#canHarvestBlock(Block).
+ *
+ * This event is fired via the {@link ForgeEventFactory#doPlayerHarvestCheck(EntityPlayer, Block, boolean)}.
+ *
+ * {@link #block} contains the Block that is being checked for harvesting.
+ * {@link #success} contains the boolean value for whether the Block will be successfully harvested.
+ *
+ * This event is not {@link Cancelable}.
+ *
+ * This event does not have a result. {@link HasResult}
+ *
+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + **/ + public static class HarvestCheck extends PlayerEvent + { + public final Block block; + public boolean success; + + public HarvestCheck(EntityPlayer player, Block block, boolean success) + { + super(player); + this.block = block; + this.success = success; + } + } + + /** + * BreakSpeed is fired when a player attempts to harvest a block.
+ * This event is fired whenever a player attempts to harvest a block in + * EntityPlayer#canHarvestBlock(Block).
+ *
+ * This event is fired via the {@link ForgeEventFactory#getBreakSpeed(EntityPlayer, IBlockState, float, BlockPos)}.
+ *
+ * {@link #state} contains the block being broken.
+ * {@link #originalSpeed} contains the original speed at which the player broke the block.
+ * {@link #newSpeed} contains the newSpeed at which the player will break the block.
+ * {@link #pos} contains the coordinates at which this event is occurring. Y value -1 means location is unknown.
+ *
+ * This event is {@link Cancelable}.
+ * If it is canceled, the player is unable to break the block.
+ *
+ * This event does not have a result. {@link HasResult}
+ *
+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + **/ + @Cancelable + public static class BreakSpeed extends PlayerEvent + { + public final IBlockState state; + public final float originalSpeed; + public float newSpeed = 0.0f; + public final BlockPos pos; // Y position of -1 notes unknown location + + public BreakSpeed(EntityPlayer player, IBlockState state, float original, BlockPos pos) + { + super(player); + this.state = state; + this.originalSpeed = original; + this.newSpeed = original; + this.pos = pos; + } + } + + /** + * NameFormat is fired when a player's display name is retrieved.
+ * This event is fired whenever a player's name is retrieved in + * EntityPlayer#getDisplayName() or EntityPlayer#refreshDisplayName().
+ *
+ * This event is fired via the {@link ForgeEventFactory#getPlayerDisplayName(EntityPlayer, String)}.
+ *
+ * {@link #username} contains the username of the player. + * {@link #displayname} contains the display name of the player. + *
+ * This event is not {@link Cancelable}. + *
+ * This event does not have a result. {@link HasResult} + *
+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + **/ + public static class NameFormat extends PlayerEvent + { + public final String username; + public String displayname; + + public NameFormat(EntityPlayer player, String username) { + super(player); + this.username = username; + this.displayname = username; + } + } + + /** + * Fired when the EntityPlayer is cloned, typically caused by the network sending a RESPAWN_PLAYER event. + * Either caused by death, or by traveling from the End to the overworld. + */ + public static class Clone extends PlayerEvent + { + /** + * The old EntityPlayer that this new entity is a clone of. + */ + public final EntityPlayer original; + /** + * True if this event was fired because the player died. + * False if it was fired because the entity switched dimensions. + */ + public final boolean wasDeath; + + public Clone(EntityPlayer _new, EntityPlayer oldPlayer, boolean wasDeath) + { + super(_new); + this.original = oldPlayer; + this.wasDeath = wasDeath; + } + } + + /** + * Fired when an Entity is started to be "tracked" by this player (the player receives updates about this entity, e.g. motion). + * + */ + public static class StartTracking extends PlayerEvent { + + /** + * The Entity now being tracked. + */ + public final Entity target; + + public StartTracking(EntityPlayer player, Entity target) + { + super(player); + this.target = target; + } + + } + + /** + * Fired when an Entity is stopped to be "tracked" by this player (the player no longer receives updates about this entity, e.g. motion). + * + */ + public static class StopTracking extends PlayerEvent { + + /** + * The Entity no longer being tracked. + */ + public final Entity target; + + public StopTracking(EntityPlayer player, Entity target) + { + super(player); + this.target = target; + } + + } + + /** + * The player is being loaded from the world save. Note that the + * player won't have been added to the world yet. Intended to + * allow mods to load an additional file from the players directory + * containing additional mod related player data. + */ + public static class LoadFromFile extends PlayerEvent { + /** + * The directory where player data is being stored. Use this + * to locate your mod additional file. + */ + public final File playerDirectory; + /** + * The UUID is the standard for player related file storage. + * It is broken out here for convenience for quick file generation. + */ + public final String playerUUID; + + public LoadFromFile(EntityPlayer player, File originDirectory, String playerUUID) + { + super(player); + this.playerDirectory = originDirectory; + this.playerUUID = playerUUID; + } + + /** + * Construct and return a recommended file for the supplied suffix + * @param suffix The suffix to use. + * @return + */ + public File getPlayerFile(String suffix) + { + if ("dat".equals(suffix)) throw new IllegalArgumentException("The suffix 'dat' is reserved"); + return new File(this.playerDirectory, this.playerUUID+"."+suffix); + } + } + /** + * The player is being saved to the world store. Note that the + * player may be in the process of logging out or otherwise departing + * from the world. Don't assume it's association with the world. + * This allows mods to load an additional file from the players directory + * containing additional mod related player data. + *
+ * Use this event to save the additional mod related player data to the world. + * + *
+ * WARNING: Do not overwrite the player's .dat file here. You will + * corrupt the world state. + */ + public static class SaveToFile extends PlayerEvent { + /** + * The directory where player data is being stored. Use this + * to locate your mod additional file. + */ + public final File playerDirectory; + /** + * The UUID is the standard for player related file storage. + * It is broken out here for convenience for quick file generation. + */ + public final String playerUUID; + + public SaveToFile(EntityPlayer player, File originDirectory, String playerUUID) + { + super(player); + this.playerDirectory = originDirectory; + this.playerUUID = playerUUID; + } + + /** + * Construct and return a recommended file for the supplied suffix + * @param suffix The suffix to use. + * @return + */ + public File getPlayerFile(String suffix) + { + if ("dat".equals(suffix)) throw new IllegalArgumentException("The suffix 'dat' is reserved"); + return new File(this.playerDirectory, this.playerUUID+"."+suffix); + } + } +} diff --git a/src/minecraft/animeware/event/impl/Render3DEvent.java b/src/minecraft/animeware/event/impl/Render3DEvent.java new file mode 100644 index 0000000..848efe4 --- /dev/null +++ b/src/minecraft/animeware/event/impl/Render3DEvent.java @@ -0,0 +1,23 @@ +package animeware.event.impl; + +import animeware.event.Event; + + +public class Render3DEvent extends Event { + + private float ticks; + + public Render3DEvent(float ticks) { + this.ticks = ticks; + } + + + public float getTicks() { + return ticks; + } + + public void setTicks(float ticks) { + this.ticks = ticks; + } + +} diff --git a/src/minecraft/animeware/event/impl/RenderEvent.java b/src/minecraft/animeware/event/impl/RenderEvent.java new file mode 100644 index 0000000..25951d3 --- /dev/null +++ b/src/minecraft/animeware/event/impl/RenderEvent.java @@ -0,0 +1,5 @@ +package animeware.event.impl; + +public class RenderEvent { + +} diff --git a/src/minecraft/animeware/event/impl/WorldUnloadEvent.java b/src/minecraft/animeware/event/impl/WorldUnloadEvent.java new file mode 100644 index 0000000..2c43c41 --- /dev/null +++ b/src/minecraft/animeware/event/impl/WorldUnloadEvent.java @@ -0,0 +1,17 @@ +package animeware.event.impl; + +import animeware.event.Event; +import net.minecraft.world.World; + +public class WorldUnloadEvent extends Event { + + private final World world; + + public WorldUnloadEvent(World world) { + this.world = world; + } + public World getWorld() { + return world; + } + +} diff --git a/src/minecraft/animeware/gui/alt/Alt.java b/src/minecraft/animeware/gui/alt/Alt.java new file mode 100644 index 0000000..7a4794b --- /dev/null +++ b/src/minecraft/animeware/gui/alt/Alt.java @@ -0,0 +1,38 @@ +package animeware.gui.alt; + +public final class Alt { + private String mask = ""; + private final String username; + private String password; + + public Alt(String username, String password) { + this(username, password, ""); + } + + public Alt(String username, String password, String mask) { + this.username = username; + this.password = password; + this.mask = mask; + } + + public String getMask() { + return this.mask; + } + + public String getPassword() { + return this.password; + } + + public String getUsername() { + return this.username; + } + + public void setMask(String mask) { + this.mask = mask; + } + + public void setPassword(String password) { + this.password = password; + } +} + diff --git a/src/minecraft/animeware/gui/alt/AltLoginThread.java b/src/minecraft/animeware/gui/alt/AltLoginThread.java new file mode 100644 index 0000000..874bd9a --- /dev/null +++ b/src/minecraft/animeware/gui/alt/AltLoginThread.java @@ -0,0 +1,71 @@ +package animeware.gui.alt; + +import java.net.Proxy; + +import com.mojang.authlib.Agent; +import com.mojang.authlib.exceptions.AuthenticationException; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; + +import animeware.NightSky; +import net.minecraft.client.Minecraft; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.Session; + +public final class AltLoginThread +extends Thread { + private final String password; + private String status; + private final String username; + private Minecraft mc = Minecraft.getMinecraft(); + + public AltLoginThread(String username, String password) { + super("Alt Login Thread"); + this.username = username; + this.password = password; + this.status = (Object)((Object)EnumChatFormatting.GRAY) + "Waiting..."; + } + + private Session createSession(String username, String password) { + YggdrasilAuthenticationService service = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); + YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication)service.createUserAuthentication(Agent.MINECRAFT); + auth.setUsername(username); + auth.setPassword(password); + try { + auth.logIn(); + return new Session(auth.getSelectedProfile().getName(), auth.getSelectedProfile().getId().toString(), auth.getAuthenticatedToken(), "mojang"); + } + catch (AuthenticationException localAuthenticationException) { + localAuthenticationException.printStackTrace(); + return null; + } + } + + public String getStatus() { + return this.status; + } + + @Override + public void run() { + if (this.password.equals("")) { + this.mc.session = new Session(this.username, "", "", "mojang"); + this.status = (Object)((Object)EnumChatFormatting.GREEN) + "Logged in. (" + this.username + " - offline name)"; + return; + } + this.status = (Object)((Object)EnumChatFormatting.YELLOW) + "Logging in..."; + Session auth = this.createSession(this.username, this.password); + if (auth == null) { + this.status = (Object)((Object)EnumChatFormatting.RED) + "Login failed!"; + } else { + AltManager altManager = NightSky.INSTANCE.altManager; + AltManager.lastAlt = new Alt(this.username, this.password); + this.status = (Object)((Object)EnumChatFormatting.GREEN) + "Logged in. (" + auth.getUsername() + ")"; + this.mc.session = auth; + } + } + + public void setStatus(String status) { + this.status = status; + } +} + diff --git a/src/minecraft/animeware/gui/alt/AltManager.java b/src/minecraft/animeware/gui/alt/AltManager.java new file mode 100644 index 0000000..73672df --- /dev/null +++ b/src/minecraft/animeware/gui/alt/AltManager.java @@ -0,0 +1,23 @@ + +package animeware.gui.alt; + +import java.util.ArrayList; + + +public class AltManager { + public static Alt lastAlt; + public static ArrayList registry; + + static { + registry = new ArrayList(); + } + + public ArrayList getRegistry() { + return registry; + } + + public void setLastAlt(Alt alt2) { + lastAlt = alt2; + } +} + diff --git a/src/minecraft/animeware/gui/alt/GuiAddAlt.java b/src/minecraft/animeware/gui/alt/GuiAddAlt.java new file mode 100644 index 0000000..1c854c9 --- /dev/null +++ b/src/minecraft/animeware/gui/alt/GuiAddAlt.java @@ -0,0 +1,150 @@ + +package animeware.gui.alt; + +import java.io.IOException; +import java.net.Proxy; + +import org.lwjgl.input.Keyboard; + +import com.mojang.authlib.Agent; +import com.mojang.authlib.exceptions.AuthenticationException; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; + +import animeware.NightSky; +import animeware.util.font.FontUtil; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.util.EnumChatFormatting; + + +public class GuiAddAlt +extends GuiScreen { + private final GuiAltManager manager; + private PasswordField password; + private String status = (Object)((Object)EnumChatFormatting.GRAY) + "Idle..."; + private GuiTextField username; + + public GuiAddAlt(GuiAltManager manager) { + this.manager = manager; + } + + @Override + protected void actionPerformed(GuiButton button) { + switch (button.id) { + case 0: { + AddAltThread login = new AddAltThread(this.username.getText(), this.password.getText()); + login.start(); + break; + } + case 1: { + this.mc.displayGuiScreen(this.manager); + } + } + } + + @Override + public void drawScreen(int i2, int j2, float f2) { + this.drawDefaultBackground(); + this.username.drawTextBox(); + this.password.drawTextBox(); + FontUtil.normal.drawCenteredString("Add Alt", width / 2, 20, -1); + if (this.username.getText().isEmpty()) { + FontUtil.normal.drawString("Username / E-Mail", width / 2 - 96, 66, -7829368); + } + if (this.password.getText().isEmpty()) { + FontUtil.normal.drawString("Password", width / 2 - 96, 106, -7829368); + } + FontUtil.normal.drawCenteredString(this.status, width / 2, 30, -1); + super.drawScreen(i2, j2, f2); + } + + @Override + public void initGui() { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 92 + 12, "Login")); + this.buttonList.add(new GuiButton(1, width / 2 - 100, height / 4 + 116 + 12, "Back")); + this.username = new GuiTextField(this.eventButton, this.mc.fontRendererObj, width / 2 - 100, 60, 200, 20); + this.password = new PasswordField(this.mc.fontRendererObj, width / 2 - 100, 100, 200, 20); + } + + @Override + protected void keyTyped(char par1, int par2) { + this.username.textboxKeyTyped(par1, par2); + this.password.textboxKeyTyped(par1, par2); + if (par1 == '\t' && (this.username.isFocused() || this.password.isFocused())) { + this.username.setFocused(!this.username.isFocused()); + this.password.setFocused(!this.password.isFocused()); + } + if (par1 == '\r') { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + } + + @Override + protected void mouseClicked(int par1, int par2, int par3) { + try { + super.mouseClicked(par1, par2, par3); + } + catch (IOException e) { + e.printStackTrace(); + } + this.username.mouseClicked(par1, par2, par3); + this.password.mouseClicked(par1, par2, par3); + } + + static void access$0(GuiAddAlt guiAddAlt, String status) { + guiAddAlt.status = status; + } + + private class AddAltThread + extends Thread { + private final String password; + private final String username; + + public AddAltThread(String username, String password) { + this.username = username; + this.password = password; + GuiAddAlt.access$0(GuiAddAlt.this, (Object)((Object)EnumChatFormatting.GRAY) + "Idle..."); + } + + private final void checkAndAddAlt(String username, String password) throws IOException { + YggdrasilAuthenticationService service = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); + YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication)service.createUserAuthentication(Agent.MINECRAFT); + auth.setUsername(username); + auth.setPassword(password); + try { + auth.logIn(); + AltManager altManager = NightSky.INSTANCE.altManager; + AltManager.registry.add(new Alt(username, password, auth.getSelectedProfile().getName())); + + GuiAddAlt.access$0(GuiAddAlt.this, "Alt added. (" + username + ")"); + } + catch (AuthenticationException e) { + GuiAddAlt.access$0(GuiAddAlt.this, (Object)((Object)EnumChatFormatting.RED) + "Alt failed!"); + e.printStackTrace(); + } + } + + @Override + public void run() { + if (this.password.equals("")) { + AltManager altManager = NightSky.INSTANCE.altManager; + AltManager.registry.add(new Alt(this.username, "")); + GuiAddAlt.access$0(GuiAddAlt.this, (Object)((Object)EnumChatFormatting.GREEN) + "Alt added. (" + this.username + " - offline name)"); + return; + } + GuiAddAlt.access$0(GuiAddAlt.this, (Object)((Object)EnumChatFormatting.YELLOW) + "Trying alt..."); + try { + this.checkAndAddAlt(this.username, this.password); + } + catch (IOException e) { + e.printStackTrace(); + } + } + } + +} + diff --git a/src/minecraft/animeware/gui/alt/GuiAltLogin.java b/src/minecraft/animeware/gui/alt/GuiAltLogin.java new file mode 100644 index 0000000..3b782b5 --- /dev/null +++ b/src/minecraft/animeware/gui/alt/GuiAltLogin.java @@ -0,0 +1,114 @@ + +package animeware.gui.alt; + +import java.io.IOException; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.input.Keyboard; + +import animeware.util.font.FontUtil; + +public final class GuiAltLogin +extends GuiScreen { + private PasswordField password; + private final GuiScreen previousScreen; + private AltLoginThread thread; + private GuiTextField username; + + public GuiAltLogin(GuiScreen previousScreen) { + this.previousScreen = previousScreen; + } + + @Override + protected void actionPerformed(GuiButton button) { + switch (button.id) { + case 1: { + this.mc.displayGuiScreen(this.previousScreen); + break; + } + case 0: { + this.thread = new AltLoginThread(this.username.getText(), this.password.getText()); + this.thread.start(); + } + } + } + + @Override + public void drawScreen(int x2, int y2, float z2) { + this.drawDefaultBackground(); + this.username.drawTextBox(); + this.password.drawTextBox(); + FontUtil.normal.drawCenteredString("Alt Login", width / 2, 20, -1); + FontUtil.normal.drawCenteredString(this.thread == null ? (Object)((Object)EnumChatFormatting.GRAY) + "Idle..." : this.thread.getStatus(), width / 2, 29, -1); + if (this.username.getText().isEmpty()) { + FontUtil.normal.drawString("Username / E-Mail", width / 2 - 96, 66, -7829368); + } + if (this.password.getText().isEmpty()) { + FontUtil.normal.drawString("Password", width / 2 - 96, 106, -7829368); + } + super.drawScreen(x2, y2, z2); + } + + @Override + public void initGui() { + int var3 = height / 4 + 24; + this.buttonList.add(new GuiButton(0, width / 2 - 100, var3 + 72 + 12, "Login")); + this.buttonList.add(new GuiButton(1, width / 2 - 100, var3 + 72 + 12 + 24, "Back")); + this.username = new GuiTextField(var3, this.mc.fontRendererObj, width / 2 - 100, 60, 200, 20); + this.password = new PasswordField(this.mc.fontRendererObj, width / 2 - 100, 100, 200, 20); + this.username.setFocused(true); + Keyboard.enableRepeatEvents(true); + } + + @Override + protected void keyTyped(char character, int key) { + try { + super.keyTyped(character, key); + } + catch (IOException e) { + e.printStackTrace(); + } + if (character == '\t') { + if (!this.username.isFocused() && !this.password.isFocused()) { + this.username.setFocused(true); + } else { + this.username.setFocused(this.password.isFocused()); + this.password.setFocused(!this.username.isFocused()); + } + } + if (character == '\r') { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + this.username.textboxKeyTyped(character, key); + this.password.textboxKeyTyped(character, key); + } + + @Override + protected void mouseClicked(int x2, int y2, int button) { + try { + super.mouseClicked(x2, y2, button); + } + catch (IOException e) { + e.printStackTrace(); + } + this.username.mouseClicked(x2, y2, button); + this.password.mouseClicked(x2, y2, button); + } + + @Override + public void onGuiClosed() { + Keyboard.enableRepeatEvents(false); + } + + @Override + public void updateScreen() { + this.username.updateCursorCounter(); + this.password.updateCursorCounter(); + } +} + diff --git a/src/minecraft/animeware/gui/alt/GuiAltManager.java b/src/minecraft/animeware/gui/alt/GuiAltManager.java new file mode 100644 index 0000000..e02616d --- /dev/null +++ b/src/minecraft/animeware/gui/alt/GuiAltManager.java @@ -0,0 +1,212 @@ + +package animeware.gui.alt; + +import java.io.IOException; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.gui.*; +import net.minecraft.util.EnumChatFormatting; +import animeware.NightSky; +import animeware.util.font.FontUtil; + +public class GuiAltManager +extends GuiScreen { + private GuiButton login; + private GuiButton remove; + private GuiButton rename; + public AltLoginThread loginThread; + private int offset; + public Alt selectedAlt = null; + private String status = (Object)((Object)EnumChatFormatting.GRAY) + "No alts selected"; + //private TheAlteningAuthentication serviceSwitcher = TheAlteningAuthentication.mojang(); + + @Override + public void actionPerformed(GuiButton button) throws IOException { + switch (button.id) { + case 0: { + if (this.loginThread == null) { + this.mc.displayGuiScreen(null); + break; + } + if (!this.loginThread.getStatus().equals((Object)((Object)EnumChatFormatting.YELLOW) + "Attempting to log in") && !this.loginThread.getStatus().equals((Object)((Object)EnumChatFormatting.RED) + "Do not hit back!" + (Object)((Object)EnumChatFormatting.YELLOW) + " Logging in...")) { + this.mc.displayGuiScreen(null); + break; + } + this.loginThread.setStatus((Object)((Object)EnumChatFormatting.RED) + "Failed to login! Please try again!" + (Object)((Object)EnumChatFormatting.YELLOW) + " Logging in..."); + break; + } + case 1: { + String user = this.selectedAlt.getUsername(); + String pass = this.selectedAlt.getPassword(); + this.loginThread = new AltLoginThread(user, pass); + this.loginThread.start(); + break; + } + case 2: { + if (this.loginThread != null) { + this.loginThread = null; + } + AltManager altManager = NightSky.INSTANCE.altManager; + AltManager.registry.remove(this.selectedAlt); + this.status = "\u00a7aRemoved."; + this.selectedAlt = null; + break; + } + case 3: { + this.mc.displayGuiScreen(new GuiAddAlt(this)); + break; + } + case 4: { + this.mc.displayGuiScreen(new GuiAltLogin(this)); + break; + } + + case 6: { + this.mc.displayGuiScreen(new GuiRenameAlt(this)); + break; + } + } + } + + @Override + public void drawScreen(int par1, int par2, float par3) { + if (Mouse.hasWheel()) { + int wheel = Mouse.getDWheel(); + if (wheel < 0) { + this.offset += 26; + if (this.offset < 0) { + this.offset = 0; + } + } else if (wheel > 0) { + this.offset -= 26; + if (this.offset < 0) { + this.offset = 0; + } + } + } + this.drawDefaultBackground(); + FontUtil.normal.drawString(this.mc.session.getUsername(), 10, 10, -7829368); + FontRenderer fontRendererObj = this.fontRendererObj; + StringBuilder sb2 = new StringBuilder("Account Manager - "); + + FontUtil.normal.drawCenteredString(sb2.append(AltManager.registry.size()).append(" alts").toString(), width / 2, 10, -1); + FontUtil.normal.drawCenteredString(this.loginThread == null ? this.status : this.loginThread.getStatus(), width / 2, 20, -1); + Gui.drawRect(50, 33, width - 50, height - 50, -16777216); + GL11.glPushMatrix(); + this.prepareScissorBox(0.0f, 33.0f, width, height - 50); + GL11.glEnable(3089); + int y2 = 38; + AltManager altManager2 = NightSky.INSTANCE.altManager; + for (Alt alt2 : AltManager.registry) { + if (!this.isAltInArea(y2)) continue; + String name = alt2.getMask().equals("") ? alt2.getUsername() : alt2.getMask(); + String pass = alt2.getPassword().equals("") ? "\u00a7cCracked" : alt2.getPassword().replaceAll(".", "*"); + if (alt2 == this.selectedAlt) { + if (this.isMouseOverAlt(par1, par2, y2 - this.offset) && Mouse.isButtonDown(0)) { + Gui.drawRect((int) 52.0f, y2 - this.offset - 4, width - 52, y2 - this.offset + 20, -2142943931); + } else if (this.isMouseOverAlt(par1, par2, y2 - this.offset)) { + Gui.drawRect((int) 52.0f, y2 - this.offset - 4, width - 52, y2 - this.offset + 20, -2142088622); + } else { + Gui.drawRect((int) 52.0f, y2 - this.offset - 4, width - 52, y2 - this.offset + 20, -2144259791); + } + } else if (this.isMouseOverAlt(par1, par2, y2 - this.offset) && Mouse.isButtonDown(0)) { + Gui.drawRect(y2 - this.offset - 4, width - 52, y2 - this.offset + 20, -16777216, -2146101995); + } else if (this.isMouseOverAlt(par1, par2, y2 - this.offset)) { + Gui.drawRect(y2 - this.offset - 4, width - 52, y2 - this.offset + 20, -16777216, -2145180893); + } + FontUtil.normal.drawCenteredString(name, width / 2, y2 - this.offset, -1); + FontUtil.normal.drawCenteredString(pass, width / 2, y2 - this.offset + 10, 5592405); + y2 += 26; + } + GL11.glDisable(3089); + GL11.glPopMatrix(); + super.drawScreen(par1, par2, par3); + if (this.selectedAlt == null) { + this.login.enabled = false; + this.remove.enabled = false; + this.rename.enabled = false; + } else { + this.login.enabled = true; + this.remove.enabled = true; + this.rename.enabled = true; + } + if (Keyboard.isKeyDown(200)) { + this.offset -= 26; + if (this.offset < 0) { + this.offset = 0; + } + } else if (Keyboard.isKeyDown(208)) { + this.offset += 26; + if (this.offset < 0) { + this.offset = 0; + } + } + } + + @Override + public void initGui() { + this.buttonList.add(new GuiButton(0, width / 2 + 4 + 50, height - 24, 100, 20, "Cancel")); + this.login = new GuiButton(1, width / 2 - 154, height - 48, 100, 20, "Login"); + this.buttonList.add(this.login); + this.remove = new GuiButton(2, width / 2 - 154, height - 24, 100, 20, "Remove"); + this.buttonList.add(this.remove); + this.buttonList.add(new GuiButton(3, width / 2 + 4 + 50, height - 48, 100, 20, "Add")); + this.buttonList.add(new GuiButton(4, width / 2 - 50, height - 48, 100, 20, "Direct Login")); + this.rename = new GuiButton(6, width / 2 - 50, height - 24, 100, 20, "Edit"); + this.buttonList.add(this.rename); + //this.buttonList.add(new GuiButton(7, width - 100, 0, 100, 20, "Use Mojang")); + //this.buttonList.add(new GuiButton(8, width - 200, 0, 100, 20, "Use TheAltening")); + this.login.enabled = false; + this.remove.enabled = false; + this.rename.enabled = false; + } + + private boolean isAltInArea(int y2) { + if (y2 - this.offset <= height - 50) { + return true; + } + return false; + } + + private boolean isMouseOverAlt(int x2, int y2, int y1) { + if (x2 >= 52 && y2 >= y1 - 4 && x2 <= width - 52 && y2 <= y1 + 20 && x2 >= 0 && y2 >= 33 && x2 <= width && y2 <= height - 50) { + return true; + } + return false; + } + + @Override + protected void mouseClicked(int par1, int par2, int par3) throws IOException { + if (this.offset < 0) { + this.offset = 0; + } + int y2 = 38 - this.offset; + AltManager altManager = NightSky.INSTANCE.altManager; + for (Alt alt2 : AltManager.registry) { + if (this.isMouseOverAlt(par1, par2, y2)) { + if (alt2 == this.selectedAlt) { + this.actionPerformed((GuiButton)this.buttonList.get(1)); + return; + } + this.selectedAlt = alt2; + } + y2 += 26; + } + try { + super.mouseClicked(par1, par2, par3); + } + catch (IOException e) { + e.printStackTrace(); + } + } + + public void prepareScissorBox(float x2, float y2, float x22, float y22) { + ScaledResolution scale = new ScaledResolution(this.mc); + int factor = scale.getScaleFactor(); + GL11.glScissor((int)(x2 * (float)factor), (int)(((float)scale.getScaledHeight() - y22) * (float)factor), (int)((x22 - x2) * (float)factor), (int)((y22 - y2) * (float)factor)); + } +} + diff --git a/src/minecraft/animeware/gui/alt/GuiRenameAlt.java b/src/minecraft/animeware/gui/alt/GuiRenameAlt.java new file mode 100644 index 0000000..e67e051 --- /dev/null +++ b/src/minecraft/animeware/gui/alt/GuiRenameAlt.java @@ -0,0 +1,90 @@ + +package animeware.gui.alt; + +import java.io.IOException; +import java.util.List; + +import animeware.util.font.FontUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.util.EnumChatFormatting; + +public class GuiRenameAlt +extends GuiScreen { + private final GuiAltManager manager; + private GuiTextField nameField; + private PasswordField pwField; + private String status = (Object)((Object)EnumChatFormatting.GRAY) + "Waiting..."; + + public GuiRenameAlt(GuiAltManager manager) { + this.manager = manager; + } + + @Override + public void actionPerformed(GuiButton button) { + switch (button.id) { + case 1: { + this.mc.displayGuiScreen(this.manager); + break; + } + case 0: { + this.manager.selectedAlt.setMask(this.nameField.getText()); + this.manager.selectedAlt.setPassword(this.pwField.getText()); + this.status = "Edited!"; + } + } + } + + @Override + public void drawScreen(int par1, int par2, float par3) { + this.drawDefaultBackground(); + FontUtil.normal.drawCenteredString("Edit Alt", width / 2, 10, -1); + FontUtil.normal.drawCenteredString(this.status, width / 2, 20, -1); + this.nameField.drawTextBox(); + this.pwField.drawTextBox(); + if (this.nameField.getText().isEmpty()) { + FontUtil.normal.drawString("New name", width / 2 - 96, 66, -7829368); + } + if (this.pwField.getText().isEmpty()) { + FontUtil.normal.drawString("New password", width / 2 - 96, 106, -7829368); + } + super.drawScreen(par1, par2, par3); + } + + @Override + public void initGui() { + this.buttonList.add(new GuiButton(0, width / 2 - 100, height / 4 + 92 + 12, "Edit")); + this.buttonList.add(new GuiButton(1, width / 2 - 100, height / 4 + 116 + 12, "Cancel")); + this.nameField = new GuiTextField(this.eventButton, this.mc.fontRendererObj, width / 2 - 100, 60, 200, 20); + this.pwField = new PasswordField(this.mc.fontRendererObj, width / 2 - 100, 100, 200, 20); + } + + @Override + protected void keyTyped(char par1, int par2) { + this.nameField.textboxKeyTyped(par1, par2); + this.pwField.textboxKeyTyped(par1, par2); + if (par1 == '\t' && (this.nameField.isFocused() || this.pwField.isFocused())) { + this.nameField.setFocused(!this.nameField.isFocused()); + this.pwField.setFocused(!this.pwField.isFocused()); + } + if (par1 == '\r') { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + } + + @Override + protected void mouseClicked(int par1, int par2, int par3) { + try { + super.mouseClicked(par1, par2, par3); + } + catch (IOException e) { + e.printStackTrace(); + } + this.nameField.mouseClicked(par1, par2, par3); + this.pwField.mouseClicked(par1, par2, par3); + } +} + diff --git a/src/minecraft/animeware/gui/alt/PasswordField.java b/src/minecraft/animeware/gui/alt/PasswordField.java new file mode 100644 index 0000000..931df91 --- /dev/null +++ b/src/minecraft/animeware/gui/alt/PasswordField.java @@ -0,0 +1,506 @@ + +package animeware.gui.alt; + +import net.minecraft.util.*; +import net.minecraft.client.gui.*; +import net.minecraft.client.*; +import org.lwjgl.opengl.*; +import net.minecraft.client.renderer.*; + +import net.minecraft.util.*; +import net.minecraft.client.gui.*; +import net.minecraft.client.*; +import org.lwjgl.opengl.*; +import net.minecraft.client.renderer.*; + +public class PasswordField extends Gui +{ + private final FontRenderer fontRenderer; + private final int xPos; + private final int yPos; + private final int width; + private final int height; + private String text; + private int maxStringLength; + private int cursorCounter; + private boolean enableBackgroundDrawing; + private boolean canLoseFocus; + public boolean isFocused; + private boolean isEnabled; + private int i; + private int cursorPosition; + private int selectionEnd; + private int enabledColor; + private int disabledColor; + private boolean b; + + public PasswordField(final FontRenderer par1FontRenderer, final int par2, final int par3, final int par4, final int par5) { + this.text = ""; + this.maxStringLength = 50; + this.enableBackgroundDrawing = true; + this.canLoseFocus = true; + this.isFocused = false; + this.isEnabled = true; + this.i = 0; + this.cursorPosition = 0; + this.selectionEnd = 0; + this.enabledColor = 14737632; + this.disabledColor = 7368816; + this.b = true; + this.fontRenderer = par1FontRenderer; + this.xPos = par2; + this.yPos = par3; + this.width = par4; + this.height = par5; + } + + public void updateCursorCounter() { + ++this.cursorCounter; + } + + public void setText(final String par1Str) { + if (par1Str.length() > this.maxStringLength) { + this.text = par1Str.substring(0, this.maxStringLength); + } + else { + this.text = par1Str; + } + this.setCursorPositionEnd(); + } + + public String getText() { + final String newtext = this.text.replaceAll(" ", ""); + return newtext; + } + + public String getSelectedtext() { + final int var1 = (this.cursorPosition < this.selectionEnd) ? this.cursorPosition : this.selectionEnd; + final int var2 = (this.cursorPosition < this.selectionEnd) ? this.selectionEnd : this.cursorPosition; + return this.text.substring(var1, var2); + } + + public void writeText(final String par1Str) { + String var2 = ""; + final String var3 = ChatAllowedCharacters.filterAllowedCharacters(par1Str); + final int var4 = (this.cursorPosition < this.selectionEnd) ? this.cursorPosition : this.selectionEnd; + final int var5 = (this.cursorPosition < this.selectionEnd) ? this.selectionEnd : this.cursorPosition; + final int var6 = this.maxStringLength - this.text.length() - (var4 - this.selectionEnd); + final boolean var7 = false; + if (this.text.length() > 0) { + var2 = String.valueOf(String.valueOf(var2)) + this.text.substring(0, var4); + } + int var8; + if (var6 < var3.length()) { + var2 = String.valueOf(String.valueOf(var2)) + var3.substring(0, var6); + var8 = var6; + } + else { + var2 = String.valueOf(String.valueOf(var2)) + var3; + var8 = var3.length(); + } + if (this.text.length() > 0 && var5 < this.text.length()) { + var2 = String.valueOf(String.valueOf(var2)) + this.text.substring(var5); + } + this.text = var2.replaceAll(" ", ""); + this.cursorPos(var4 - this.selectionEnd + var8); + } + + public void func_73779_a(final int par1) { + if (this.text.length() != 0) { + if (this.selectionEnd != this.cursorPosition) { + this.writeText(""); + } + else { + this.deleteFromCursor(this.getNthWordFromCursor(par1) - this.cursorPosition); + } + } + } + + public void deleteFromCursor(final int par1) { + if (this.text.length() != 0) { + if (this.selectionEnd != this.cursorPosition) { + this.writeText(""); + } + else { + final boolean var2 = par1 < 0; + final int var3 = var2 ? (this.cursorPosition + par1) : this.cursorPosition; + final int var4 = var2 ? this.cursorPosition : (this.cursorPosition + par1); + String var5 = ""; + if (var3 >= 0) { + var5 = this.text.substring(0, var3); + } + if (var4 < this.text.length()) { + var5 = String.valueOf(String.valueOf(var5)) + this.text.substring(var4); + } + this.text = var5; + if (var2) { + this.cursorPos(par1); + } + } + } + } + + public int getNthWordFromCursor(final int par1) { + return this.getNthWordFromPos(par1, this.getCursorPosition()); + } + + public int getNthWordFromPos(final int par1, final int par2) { + return this.type(par1, this.getCursorPosition(), true); + } + + public int type(final int par1, final int par2, final boolean par3) { + int var4 = par2; + final boolean var5 = par1 < 0; + for (int var6 = Math.abs(par1), var7 = 0; var7 < var6; ++var7) { + if (!var5) { + final int var8 = this.text.length(); + var4 = this.text.indexOf(32, var4); + if (var4 == -1) { + var4 = var8; + } + else { + while (par3) { + if (var4 >= var8) { + break; + } + if (this.text.charAt(var4) != ' ') { + break; + } + ++var4; + } + } + } + else { + while (par3) { + if (var4 <= 0) { + break; + } + if (this.text.charAt(var4 - 1) != ' ') { + break; + } + --var4; + } + while (var4 > 0 && this.text.charAt(var4 - 1) != ' ') { + --var4; + } + } + } + return var4; + } + + public void cursorPos(final int par1) { + this.setCursorPosition(this.selectionEnd + par1); + } + + public void setCursorPosition(final int par1) { + this.cursorPosition = par1; + final int var2 = this.text.length(); + if (this.cursorPosition < 0) { + this.cursorPosition = 0; + } + if (this.cursorPosition > var2) { + this.cursorPosition = var2; + } + this.func_73800_i(this.cursorPosition); + } + + public void setCursorPositionZero() { + this.setCursorPosition(0); + } + + public void setCursorPositionEnd() { + this.setCursorPosition(this.text.length()); + } + + public boolean textboxKeyTyped(final char par1, final int par2) { + if (!this.isEnabled || !this.isFocused) { + return false; + } + switch (par1) { + case '\u0001': { + this.setCursorPositionEnd(); + this.func_73800_i(0); + return true; + } + case '\u0003': { + GuiScreen.setClipboardString(this.getSelectedtext()); + return true; + } + case '\u0016': { + this.writeText(GuiScreen.getClipboardString()); + return true; + } + case '\u0018': { + GuiScreen.setClipboardString(this.getSelectedtext()); + this.writeText(""); + return true; + } + default: { + switch (par2) { + case 14: { + if (GuiScreen.isCtrlKeyDown()) { + this.func_73779_a(-1); + } + else { + this.deleteFromCursor(-1); + } + return true; + } + case 199: { + if (GuiScreen.isShiftKeyDown()) { + this.func_73800_i(0); + } + else { + this.setCursorPositionZero(); + } + return true; + } + case 203: { + if (GuiScreen.isShiftKeyDown()) { + if (GuiScreen.isCtrlKeyDown()) { + this.func_73800_i(this.getNthWordFromPos(-1, this.getSelectionEnd())); + } + else { + this.func_73800_i(this.getSelectionEnd() - 1); + } + } + else if (GuiScreen.isCtrlKeyDown()) { + this.setCursorPosition(this.getNthWordFromCursor(-1)); + } + else { + this.cursorPos(-1); + } + return true; + } + case 205: { + if (GuiScreen.isShiftKeyDown()) { + if (GuiScreen.isCtrlKeyDown()) { + this.func_73800_i(this.getNthWordFromPos(1, this.getSelectionEnd())); + } + else { + this.func_73800_i(this.getSelectionEnd() + 1); + } + } + else if (GuiScreen.isCtrlKeyDown()) { + this.setCursorPosition(this.getNthWordFromCursor(1)); + } + else { + this.cursorPos(1); + } + return true; + } + case 207: { + if (GuiScreen.isShiftKeyDown()) { + this.func_73800_i(this.text.length()); + } + else { + this.setCursorPositionEnd(); + } + return true; + } + case 211: { + if (GuiScreen.isCtrlKeyDown()) { + this.func_73779_a(1); + } + else { + this.deleteFromCursor(1); + } + return true; + } + default: { + if (ChatAllowedCharacters.isAllowedCharacter(par1)) { + this.writeText(Character.toString(par1)); + return true; + } + return false; + } + } + } + } + } + + public void mouseClicked(final int par1, final int par2, final int par3) { + final boolean var4 = par1 >= this.xPos && par1 < this.xPos + this.width && par2 >= this.yPos && par2 < this.yPos + this.height; + if (this.canLoseFocus) { + this.setFocused(this.isEnabled && var4); + } + if (this.isFocused && par3 == 0) { + int var5 = par1 - this.xPos; + if (this.enableBackgroundDrawing) { + var5 -= 4; + } + final String var6 = this.fontRenderer.trimStringToWidth(this.text.substring(this.i), this.getWidth()); + this.setCursorPosition(this.fontRenderer.trimStringToWidth(var6, var5).length() + this.i); + } + } + + public void drawTextBox() { + if (this.func_73778_q()) { + if (this.getEnableBackgroundDrawing()) { + Gui.drawRect(this.xPos - 1, this.yPos - 1, this.xPos + this.width + 1, this.yPos + this.height + 1, -6250336); + Gui.drawRect(this.xPos, this.yPos, this.xPos + this.width, this.yPos + this.height, -16777216); + } + final int var1 = this.isEnabled ? this.enabledColor : this.disabledColor; + final int var2 = this.cursorPosition - this.i; + int var3 = this.selectionEnd - this.i; + final String var4 = this.fontRenderer.trimStringToWidth(this.text.substring(this.i), this.getWidth()); + final boolean var5 = var2 >= 0 && var2 <= var4.length(); + final boolean var6 = this.isFocused && this.cursorCounter / 6 % 2 == 0 && var5; + final int var7 = this.enableBackgroundDrawing ? (this.xPos + 4) : this.xPos; + final int var8 = this.enableBackgroundDrawing ? (this.yPos + (this.height - 8) / 2) : this.yPos; + int var9 = var7; + if (var3 > var4.length()) { + var3 = var4.length(); + } + if (var4.length() > 0) { + if (var5) { + var4.substring(0, var2); + } + var9 = Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.text.replaceAll("(?s).", "*"), var7, var8, var1); + } + final boolean var10 = this.cursorPosition < this.text.length() || this.text.length() >= this.getMaxStringLength(); + int var11 = var9; + if (!var5) { + var11 = ((var2 > 0) ? (var7 + this.width) : var7); + } + else if (var10) { + var11 = var9 - 1; + --var9; + } + if (var4.length() > 0 && var5 && var2 < var4.length()) { + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(var4.substring(var2), var9, var8, var1); + } + if (var6) { + if (var10) { + Gui.drawRect(var11, var8 - 1, var11 + 1, var8 + 1 + this.fontRenderer.FONT_HEIGHT, -3092272); + } + else { + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow("_", var11, var8, var1); + } + } + if (var3 != var2) { + final int var12 = var7 + this.fontRenderer.getStringWidth(var4.substring(0, var3)); + this.drawCursorVertical(var11, var8 - 1, var12 - 1, var8 + 1 + this.fontRenderer.FONT_HEIGHT); + } + } + } + + private void drawCursorVertical(int par1, int par2, int par3, int par4) { + if (par1 < par3) { + final int var5 = par1; + par1 = par3; + par3 = var5; + } + if (par2 < par4) { + final int var5 = par2; + par2 = par4; + par4 = var5; + } + final Tessellator var6 = Tessellator.getInstance(); + final WorldRenderer var7 = var6.getWorldRenderer(); + GL11.glColor4f(0.0f, 0.0f, 255.0f, 255.0f); + GL11.glDisable(3553); + GL11.glEnable(3058); + GL11.glLogicOp(5387); + var7.begin(7, var7.getVertexFormat()); + var7.pos(par1, par4, 0.0); + var7.pos(par3, par4, 0.0); + var7.pos(par3, par2, 0.0); + var7.pos(par1, par2, 0.0); + var7.finishDrawing(); + GL11.glDisable(3058); + GL11.glEnable(3553); + } + + public void setMaxStringLength(final int par1) { + this.maxStringLength = par1; + if (this.text.length() > par1) { + this.text = this.text.substring(0, par1); + } + } + + public int getMaxStringLength() { + return this.maxStringLength; + } + + public int getCursorPosition() { + return this.cursorPosition; + } + + public boolean getEnableBackgroundDrawing() { + return this.enableBackgroundDrawing; + } + + public void setEnableBackgroundDrawing(final boolean par1) { + this.enableBackgroundDrawing = par1; + } + + public void func_73794_g(final int par1) { + this.enabledColor = par1; + } + + public void setFocused(final boolean par1) { + if (par1 && !this.isFocused) { + this.cursorCounter = 0; + } + this.isFocused = par1; + } + + public boolean isFocused() { + return this.isFocused; + } + + public int getSelectionEnd() { + return this.selectionEnd; + } + + public int getWidth() { + return this.getEnableBackgroundDrawing() ? (this.width - 8) : this.width; + } + + public void func_73800_i(int par1) { + final int var2 = this.text.length(); + if (par1 > var2) { + par1 = var2; + } + if (par1 < 0) { + par1 = 0; + } + this.selectionEnd = par1; + if (this.fontRenderer != null) { + if (this.i > var2) { + this.i = var2; + } + final int var3 = this.getWidth(); + final String var4 = this.fontRenderer.trimStringToWidth(this.text.substring(this.i), var3); + final int var5 = var4.length() + this.i; + if (par1 == this.i) { + this.i -= this.fontRenderer.trimStringToWidth(this.text, var3, true).length(); + } + if (par1 > var5) { + this.i += par1 - var5; + } + else if (par1 <= this.i) { + this.i -= this.i - par1; + } + if (this.i < 0) { + this.i = 0; + } + if (this.i > var2) { + this.i = var2; + } + } + } + + public void setCanLoseFocus(final boolean par1) { + this.canLoseFocus = par1; + } + + public boolean func_73778_q() { + return this.b; + } + + public void func_73790_e(final boolean par1) { + this.b = par1; + } +} diff --git a/src/minecraft/animeware/gui/clickgui/ClickGUI.java b/src/minecraft/animeware/gui/clickgui/ClickGUI.java new file mode 100644 index 0000000..ddd937f --- /dev/null +++ b/src/minecraft/animeware/gui/clickgui/ClickGUI.java @@ -0,0 +1,823 @@ +package animeware.gui.clickgui; + +import java.awt.Color; +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +import animeware.NightSky; +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.cosmetic.CosmeticType; +import animeware.hud.Category; +import animeware.hud.DraggableComponent; +import animeware.hud.HUDConfigScreen; +import animeware.hud.mod.HudMod; +import animeware.ui.comp.CosmeticButton; +import animeware.ui.comp.CosmeticsCGButton; +import animeware.ui.comp.HomeCGButton; +import animeware.ui.comp.LArrowBtn; +import animeware.ui.comp.LogoButtonWhite; +import animeware.ui.comp.SettingsCGButton; +import animeware.ui.comp.PositioningCGButton; +import animeware.ui.comp.ToggleableCGButton; +import animeware.ui.comp.clickgui.ModButton; +import animeware.ui.comp.clickgui.SettingButton; +import animeware.ui.login.PasswordField; +import animeware.ui.themes.impl.ThemeButton; +import animeware.util.render.DrawUtil; +import animeware.util.render.GLUtils; +import animeware.util.render.RenderUtil; +import animeware.util.render.RoundedUtils; +import animeware.util.render.ui.ClickGUIUtil; +import animeware.util.settings.BooleanSetting; +import animeware.util.settings.ModeSetting; +import animeware.util.settings.Setting; +import animeware.util.settings.comp.BooleanButton; +import animeware.util.settings.comp.ModeButton; +import net.arikia.dev.drpc.DiscordUser; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ResourceLocation; + +public class ClickGUI extends GuiScreen { + + boolean guiOpen; + + //DiscordUser user; + + public boolean CGSett; + public boolean cgon; + public static boolean btnHovered; + + private int field_146445_a; + private int field_146444_f; + + float anim = 0.0F; + boolean animated; + + private float currentScroll; + + HudMod m; + + HudMod preM; + + public static boolean settings; + + private static String TntTime = "TntTimer"; + + public int x, y, w, h; + + ArrayList cosButtons = new ArrayList<>(); + ArrayList modButtons = new ArrayList<>(); + ArrayList tButtons = new ArrayList<>(); + public static ArrayList settingButtons = new ArrayList<>(); + public DraggableComponent drag; + + public static GUIType type = GUIType.CLICK; + public static GUITheme theme = GUITheme.DARK; + + boolean hovered; + boolean hud; + public static DraggableComponent top; + //public int x, y; + public Category viewing; + public HudMod configuring; + public static GuiTextField searchBar; + ArrayList textFields = new ArrayList<>(); + EntityLivingBase entity; + static float rotate; + GuiScreen guiScreen; + //int Button; + + public ClickGUI() { + //this.x = x; + //this.y = y; + + this.top = new DraggableComponent(100, 100, 177, 20, new Color(0,140,255, 0).getRGB()); + } + public ClickGUI(HudMod mod) { + this.m = mod; + this.preM = mod; + this.m = preM; + //this.x = x; + //this.y = y; + + //this.top = new DraggableComponent(100, 100, 177, 20, new Color(0,140,255, 0).getRGB()); + } + + public void checkMouseWheel(int mouseX, int mouseY) { + int mouseScroll = Mouse.getDWheel(); + + if(mouseScroll > 0) { + for(ModButton b : modButtons) { + b.y += 15; + } + } else if(mouseScroll < 0) { + for(ModButton b : modButtons) { + b.y -= 15; + } + } + + } + public void checkMouseWheelCosmetic(int mouseX, int mouseY) { + int mouseScrollCos = Mouse.getDWheel(); + + if(mouseScrollCos > 0) { + for(CosmeticButton b : cosButtons) { + b.y += 15; + } + } else if(mouseScrollCos < 0) { + for(CosmeticButton b : cosButtons) { + b.y -= 15; + } + } + } + + @Override + public void initGui() { + this.guiOpen = true; + super.initGui(); + mc.entityRenderer.loadShader(new ResourceLocation("Animeware/blur.json")); + //mc.entityRenderer.loadShader(new ResourceLocation("Animeware/blur.json")); + this.anim = 80.0F; + super.initGui(); + this.field_146445_a = 0; + this.buttonList.clear(); + int i = -16; + int j = 98; + + //if (this.anim > 0.0F) + //this.anim -= 6.0F; + //GL11.glEnable(3089); + //GLUtils.makeScissorBox((this.width / 2 - 190) + this.anim, (this.height / 2 - 110) + this.anim, (this.width / 2 + 190) - this.anim, (this.height / 2 + 110) - this.anim); + if(type == GUIType.CLICK) { + /*this.modButtons.add(new ModButton(this.width/ 2 - 139, 165, 323, 35, NightSky.INSTANCE.hudManager.thud)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 205, 323, 35, NightSky.INSTANCE.hudManager.fps)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 245, 323, 35, NightSky.INSTANCE.hudManager.bps)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 285, 323, 35, NightSky.INSTANCE.hudManager.cps)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 325, 323, 35, NightSky.INSTANCE.hudManager.keystrokes)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 365, 323, 35, NightSky.INSTANCE.hudManager.potionStat)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 405, 323, 35, NightSky.INSTANCE.hudManager.sip)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 445, 323, 35, NightSky.INSTANCE.hudManager.xyz)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 485, 323, 35, NightSky.INSTANCE.hudManager.lilplayer)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 525, 323, 35, NightSky.INSTANCE.hudManager.ping)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 565, 323, 35, NightSky.INSTANCE.hudManager.pd)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 605, 323, 35, NightSky.INSTANCE.hudManager.biome)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 645, 323, 35, NightSky.INSTANCE.hudManager.time)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 685, 323, 35, NightSky.INSTANCE.hudManager.Armorstat)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 725, 323, 35, NightSky.INSTANCE.hudManager.hit)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 765, 323, 35, NightSky.INSTANCE.hudManager.mem)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 805, 323, 35, NightSky.INSTANCE.hudManager.timeChanger)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 845, 323, 35, NightSky.INSTANCE.hudManager.ts)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 885, 323, 35, NightSky.INSTANCE.hudManager.direction)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 925, 323, 35, NightSky.INSTANCE.hudManager.reachDisp)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 965, 323, 35, NightSky.INSTANCE.hudManager.particles)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 1005, 323, 35, NightSky.INSTANCE.hudManager.mldg)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 1045, 323, 35, NightSky.INSTANCE.hudManager.head)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 1085, 323, 35, NightSky.INSTANCE.hudManager.bo)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 1125, 323, 35, NightSky.INSTANCE.hudManager.tnt)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 1165, 323, 35, NightSky.INSTANCE.hudManager.iphys)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 1205, 323, 35, NightSky.INSTANCE.hudManager.smallsword)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 1245, 323, 35, NightSky.INSTANCE.hudManager.swordspin)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 1285, 323, 35, NightSky.INSTANCE.hudManager.mp)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 1325, 323, 35, NightSky.INSTANCE.hudManager.sz)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 1365, 323, 35, NightSky.INSTANCE.hudManager.watermark)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 1405, 323, 35, NightSky.INSTANCE.hudManager.arrows)); + this.modButtons.add(new ModButton(this.width/ 2 - 139, 1445, 323, 35, NightSky.INSTANCE.hudManager.horseStat));*/ + int countModule = 40; + int count = 0; + int total = NightSky.INSTANCE.hudManager.hudMods.size() - 5; + for(HudMod m : NightSky.INSTANCE.hudManager.hudMods) { + + //System.out.println(NightSky.INSTANCE.hudManager.hudMods.size() - 5); + + if(m.name == "MotionBlur" || m.name == "Color Scheme" || m.name == "Astolfo Buttons" || m.name == "Light theme" || m.name == "Notifications" || m.name == "Freelook" || m.name == "WindowedFullscreen") { + //if(!m.name.equals("FPS")) { + } else { + if(count < total / 2) { + this.modButtons.add(new ModButton(this.width/ 2 - 80,this.height / 2 - 115 + countModule, 127, 40, m)); + } else { + this.modButtons.add(new ModButton(this.width/ 2 + 53,this.height / 2 - 115+ countModule - (total / 2 * 45), 127, 40, m)); // - 765 + } + //this.modButtons.add(new ModButton(this.width/ 2 + 53,this.height / 2 - 115 + countModule, 127, 35, m)); + countModule = countModule + 45; + count = count + 1; + //System.out.println(count); + + } + } + + //this.modButtons.add(new ModButton(this.width/ 2 - 139, 1445, 323, 35, NightSky.INSTANCE.hudManager.lilplayer)); + //System.out.println("GUIType - Click"); + } else if(type == GUIType.COSMETIC) { + /*this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 165, 323, 35, NightSky.INSTANCE.cosManager.darkCape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 205, 323, 35, NightSky.INSTANCE.cosManager.deamoneyes)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 245, 323, 35, NightSky.INSTANCE.cosManager.deamoneyes2)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 285, 323, 35, NightSky.INSTANCE.cosManager.ecape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 325, 323, 35, NightSky.INSTANCE.cosManager.gblack)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 365, 323, 35, NightSky.INSTANCE.cosManager.gblue)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 405, 323, 35, NightSky.INSTANCE.cosManager.ggreen)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 445, 323, 35, NightSky.INSTANCE.cosManager.gpurple)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 485, 323, 35, NightSky.INSTANCE.cosManager.gred)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 525, 323, 35, NightSky.INSTANCE.cosManager.kcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 565, 323, 35, NightSky.INSTANCE.cosManager.kcape2)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 605, 323, 35, NightSky.INSTANCE.cosManager.lcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 645, 323, 35, NightSky.INSTANCE.cosManager.ncape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 685, 323, 35, NightSky.INSTANCE.cosManager.pcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 725, 323, 35, NightSky.INSTANCE.cosManager.quavcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 765, 323, 35, NightSky.INSTANCE.cosManager.quickcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 805, 323, 35, NightSky.INSTANCE.cosManager.rcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 845, 323, 35, NightSky.INSTANCE.cosManager.scape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 885, 323, 35, NightSky.INSTANCE.cosManager.tcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 925, 323, 35, NightSky.INSTANCE.cosManager.sofyt)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 965, 323, 35, NightSky.INSTANCE.cosManager.sofyt2)); + + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1005, 323, 35, NightSky.INSTANCE.cosManager.dwings)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1045, 323, 35, NightSky.INSTANCE.cosManager.gwings)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1085, 323, 35, NightSky.INSTANCE.cosManager.cwings)); + + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1125, 323, 35, NightSky.INSTANCE.cosManager.eggs)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1165, 323, 35, NightSky.INSTANCE.cosManager.witchhat)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1205, 323, 35, NightSky.INSTANCE.cosManager.glasses)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1245, 323, 35, NightSky.INSTANCE.cosManager.halo)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1285, 323, 35, NightSky.INSTANCE.cosManager.retardeyes)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1325, 323, 35, NightSky.INSTANCE.cosManager.blaze)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1365, 323, 35, NightSky.INSTANCE.cosManager.ban)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1405, 323, 35, NightSky.INSTANCE.cosManager.wpet)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1445, 323, 35, NightSky.INSTANCE.cosManager.ch)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139, 1485, 323, 35, NightSky.INSTANCE.cosManager.rinn));*/ + int countCape = 40; + for(CosmeticModule m : NightSky.INSTANCE.cosManager.cosmetics) { + if(m.name == "Owner Cape" || m.name == "Staff Cape" || m.name == "Creeper Lightning Cosmetic" || m.name == "YT Cape" || !(m.type == CosmeticType.CAPE)) { + + } else { + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139,this.height / 2 - 145 + countCape, 323, 35, m)); + countCape = countCape + 40; + //System.out.println(countModule); + } + } + int countAnim = 40; + for(CosmeticModule m : NightSky.INSTANCE.cosManager.cosmetics) { + if(m.name == "Owner Cape" || m.name == "Staff Cape" || m.name == "Creeper Lightning Cosmetic" || m.name == "YT Cape" || !(m.type == CosmeticType.ANIM)) { + + } else { + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139,this.height / 2 - 185 + countCape + countAnim, 323, 35, m)); + countAnim = countAnim + 40; + //System.out.println(countModule); + } + } + int countWings = 40; + for(CosmeticModule m : NightSky.INSTANCE.cosManager.cosmetics) { + if(m.name == "Owner Cape" || m.name == "Staff Cape" || m.name == "Creeper Lightning Cosmetic" || m.name == "YT Cape" || !(m.type == CosmeticType.WINGS)) { + + } else { + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139,this.height / 2 - 225 + countCape + countAnim + countWings, 323, 35, m)); + countWings = countWings + 40; + //System.out.println(countModule); + } + } + int countHat = 40; + for(CosmeticModule m : NightSky.INSTANCE.cosManager.cosmetics) { + if(m.name == "Owner Cape" || m.name == "Staff Cape" || m.name == "Creeper Lightning Cosmetic" || m.name == "YT Cape" || !(m.type == CosmeticType.HAT)) { + + } else { + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139,this.height / 2 - 265 + countCape + countAnim + countWings + countHat, 323, 35, m)); + countHat = countHat + 40; + //System.out.println(countModule); + } + } + int countPet = 40; + for(CosmeticModule m : NightSky.INSTANCE.cosManager.cosmetics) { + if(m.name == "Owner Cape" || m.name == "Staff Cape" || m.name == "Creeper Lightning Cosmetic" || m.name == "YT Cape" || !(m.type == CosmeticType.PET)) { + + } else { + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139,this.height / 2 - 305 + countCape + countAnim + countWings + countHat + countPet, 323, 35, m)); + countPet = countPet + 40; + //System.out.println(countModule); + } + } + int countBandana = 40; + for(CosmeticModule m : NightSky.INSTANCE.cosManager.cosmetics) { + if(m.name == "Owner Cape" || m.name == "Staff Cape" || m.name == "Creeper Lightning Cosmetic" || m.name == "YT Cape" || !(m.type == CosmeticType.BANDANA)) { + + } else { + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139,this.height / 2 - 345 + countCape + countAnim + countWings + countHat + countPet + countBandana, 323, 35, m)); + countBandana = countBandana + 40; + //System.out.println(countModule); + } + } + int countOther = 40; + for(CosmeticModule m : NightSky.INSTANCE.cosManager.cosmetics) { + if(m.name == "Owner Cape" || m.name == "Staff Cape" || m.name == "Creeper Lightning Cosmetic" || m.name == "YT Cape" || !(m.type == CosmeticType.OTHER)) { + + } else { + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139,this.height / 2 - 385 + countCape + countAnim + countWings + countHat + countPet + countBandana + countOther, 323, 35, m)); + countOther = countOther + 40; + //System.out.println(countModule); + } + } + //System.out.println("GUIType - Cosmetic"); + } else if(type == GUIType.PROFILE) { + try { + int countCosmetic = 40; + for(CosmeticModule m : NightSky.INSTANCE.cosManager.cosmetics) { + if((m.name.equals("Owner Cape") || m.name.equals("Staff Cape") || m.name.equals("YT Cape")) && mc.thePlayer.getName().equals("hypnomacka")) { + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139,this.height / 2 - 145 + countCosmetic, 323, 35, m)); + countCosmetic = countCosmetic + 40; + + } else if(m.name.equals("YT Cape") && mc.thePlayer.getName().equals("")) { + //if() + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139,this.height / 2 - 145 + countCosmetic, 323, 35, m)); + countCosmetic = countCosmetic + 40; + //System.out.println(countModule); + } + } + } catch(NullPointerException e) { + e.printStackTrace(); + + } + + //System.out.println("GUIType - Profile"); + } else if(type == GUIType.THEME) { + int countModule = 40; + for(HudMod m : NightSky.INSTANCE.hudManager.hudMods) { + if(m.name == "Light theme" || m.name == "Color Scheme" || m.name == "Astolfo Buttons") { + this.modButtons.add(new ModButton(this.width/ 2 - 139,this.height / 2 - 145 + countModule, 323, 35, m)); + countModule = countModule + 40; + + } + } + + } else if(type == GUIType.SETTINGS) { + this.buttonList.add(new LArrowBtn(4, this.width / 2 - 186, this.height / 2 - 109, "")); + } + + if(!(type == GUIType.SETTINGS)) { + this.buttonList.add(new LogoButtonWhite(69, this.width / 2 - 183, this.height / 2 - 105, "NightSky")); + this.buttonList.add(new HomeCGButton(1, this.width / 2 - 183, this.height / 2 - 61, "Modules")); + this.buttonList.add(new CosmeticsCGButton(3, this.width / 2 - 183, this.height / 2 - 38, "Cosmetics")); + this.buttonList.add(new ToggleableCGButton(2, this.width / 2 - 183, this.height / 2 - 15, "Personal")); + this.buttonList.add(new SettingsCGButton(4, this.width / 2 - 183, this.height / 2 + 12, "Settings")); + this.buttonList.add(new PositioningCGButton(5, this.width / 2 - 183, this.height / 2 + 40, "Positioning")); + } + this.searchBar = new GuiTextField(24, this.mc.fontRendererObj, 100, 10, 200, 20); + this.searchBar.setFocused(true); + Keyboard.enableRepeatEvents(true); + //this.buttonList.add(new HudButton(6, this.width / 2 - 188, this.height / 2 + 88, "")); + + //GL11.glDisable(3089); + +} + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + + //Gui.drawRect(drag.getxPosition() - 3, drag.getyPosition() - 3, drag.getxPosition() + 423, drag.getyPosition() + 328, -1); + + //System.out.println(NightSky.DisName + NightSky.DisTag + "= Hypnomacka#4765"); + + //this.btnHovered = mouseX >= ModButton.x && mouseX <= ModButton.x + ModButton.w && mouseY >= ModButton.y && mouseY <= ModButton.y + ModButton.h; + + //FontUtilCedo.normal.drawString("l", 340, 135, new Color(50, 50, 50, 255).getRGB()); + + GL11.glColor4f(1F, 1F, 1F, 1F); + GlStateManager.enableAlpha(); + GlStateManager.enableBlend(); + + ScaledResolution sr = new ScaledResolution(mc); + + ClickGUIUtil.renderClickGUI(); + + //this.searchBar.drawTextBox(); + + + + + + + if(type == GUIType.SETTINGS) { + //for(HudMod m : NightSky.INSTANCE.hudManager.hudMods) { + if(!m.settings.isEmpty()) { + for(Setting setting : m.settings) { + int countb = 1; + if(setting instanceof BooleanSetting) { + new BooleanButton(mouseX, mouseY, 75, 75 * countb + 10, (BooleanSetting) setting, m, 1); + countb += 1; + } + } + for(Setting setting : m.settings) { + int countm = 1; + if(setting instanceof ModeSetting) { + new ModeButton(mouseX, mouseY, this.width / 2 - 140, this.height / 2 - 80 * countm + 10, (ModeSetting) setting, m, 2); + countm += 1; + } + } + } + //} + + } + /*if(MinecraftServer.getServer().isSinglePlayer()) { + NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()); + if(playerInfo != null) { + GL11.glColor4f(1F, 1F, 1F, 1F); + } + } else if(Minecraft.getMinecraft().getCurrentServerData() != null) { + NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()); + if(playerInfo != null) { + GL11.glColor4f(1F, 1F, 1F, 1F); + } + } else { + + }*/ + + if(type == GUIType.CLICK || type == GUIType.THEME) { + GL11.glDisable(GL11.GL_SCISSOR_TEST); + checkMouseWheel(mouseX, mouseY); + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_SCISSOR_BIT); + { + RenderUtil.scissor(this.width / 2 - 190, this.height / 2 - 0, this.width / 2 + 190, this.height / 2 + 110); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + } + + GLUtils.makeScissorBox(this.width / 2 - 190, this.height / 2 - 79, this.width / 2 + 190, this.height / 2 + 110); + + + + super.drawScreen(mouseX, mouseY, partialTicks); + for(ModButton m : modButtons) { + m.draw(); + } + GL11.glDisable(GL11.GL_SCISSOR_TEST); + GL11.glPopAttrib(); + GL11.glPopMatrix(); + //GL11.glDisable(3089); + } else if(type == GUIType.COSMETIC || type == GUIType.PROFILE) { + GL11.glDisable(GL11.GL_SCISSOR_TEST); + checkMouseWheelCosmetic(mouseX, mouseY); + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_SCISSOR_BIT); + { + RenderUtil.scissor(this.width / 2 - 190, this.height / 2 - 0, this.width / 2 + 190, this.height / 2 + 110); + //RenderUtil.scissor2(this.width / 2 - 190, this.height / 2 - 110, 1920, 1080); + //RenderUtil.scissor(this.width / 2 - 100, -300, 1920, 1080); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + } + if (this.anim > 0.0F) + this.anim -= 8.5F; + if(this.guiOpen == true) { + GLUtils.makeScissorBox(this.width / 2 - 190, this.height / 2 - 110, this.width / 2 + 190, this.height / 2 + 110); + } else { + GLUtils.makeScissorBox((this.width / 2 - 190) + this.anim, (this.height / 2 - 107) + this.anim, (this.width / 2 + 190) - this.anim, (this.height / 2 + 107) - this.anim); + } + super.drawScreen(mouseX, mouseY, partialTicks); + for(CosmeticButton cos : cosButtons) { + try { + cos.draw(); + } catch(NullPointerException e) { + e.printStackTrace(); + System.out.println("Line-512"); + + } + } + GL11.glDisable(GL11.GL_SCISSOR_TEST); + GL11.glPopAttrib(); + GL11.glPopMatrix(); + GL11.glDisable(3089); + } else if(type == GUIType.THEME) { + GL11.glDisable(GL11.GL_SCISSOR_TEST); + checkMouseWheelCosmetic(mouseX, mouseY); + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_SCISSOR_BIT); + { + RenderUtil.scissor(this.width / 2 - 190, this.height / 2 - 110, this.width / 2 + 190, this.height / 2 + 110); + //RenderUtil.scissor2(this.width / 2 - 190, this.height / 2 - 110, 1920, 1080); + //RenderUtil.scissor(this.width / 2 - 100, -300, 1920, 1080); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + for(ThemeButton t : tButtons) { + t.draw(); + } + GL11.glDisable(GL11.GL_SCISSOR_TEST); + GL11.glPopAttrib(); + GL11.glPopMatrix(); + } + try { + if(hud) { + this.hovered = (mouseX >= top.getxPosition() + 180 && mouseY >= top.getyPosition() + 2 && mouseX < top.getxPosition() + 180 + 17 && mouseY < top.getyPosition() + 2 + 15); + + //Playerdraw(top.getxPosition(), top.getyPosition() + 100, 10000, 50.0F, 0.0F, (EntityLivingBase)Minecraft.thePlayer); + Playerdraw(top.getxPosition() + 42, top.getyPosition() + 100, 25, 0, 0, mc.thePlayer); + RoundedUtils.drawSmoothRoundedRect(top.getxPosition(), top.getyPosition(), top.getxPosition() + 200, top.getyPosition() + 110, 18.0f, new Color(25, 25, 30, 255).getRGB()); + mc.fontRendererObj.drawString(NightSky.mcname, top.getxPosition() + 70, top.getyPosition() + 82, new Color(255, 255, 254, 255).getRGB()); + mc.fontRendererObj.drawString(NightSky.rank(), top.getxPosition() + 70, top.getyPosition() + 92, new Color(255, 255, 254, 255).getRGB()); + //mc.fontRendererObj.drawString(NightSky.DisName, top.getxPosition() + 70, top.getyPosition() + 45, new Color(255, 255, 254, 255).getRGB()); + //mc.fontRendererObj.drawString(NightSky.DisTag, top.getxPosition() + 70, top.getyPosition() + 55, new Color(255, 255, 254, 255).getRGB()); + if(hovered) { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/quit.png"), top.getxPosition() + 180, top.getyPosition() + 2, 15, 15, new Color(255, 0, 0)); + //if(Button == 1) { + + //} + //mc.displayGuiScreen(new ClickGUI()); + } else { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/quit.png"), top.getxPosition() + 180, top.getyPosition() + 2, 15, 15, Color.white); + } + + //Gui.drawRect(top.getxPosition() - 3, top.getyPosition() - 3, top.getxPosition() + 423, top.getyPosition() + 328, -1); + //Gui.drawRect(top.getxPosition(), top.getyPosition() + 5, top.getxPosition() + 420, top.getyPosition() + 325, new Color(33,33,33).getRGB()); + top.draw(mouseX, mouseY); + } + } catch (NullPointerException e) { + System.out.println("GUI ERROR"); + } + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /*@Override + protected void keyTyped(char character, int key) { + try { + super.keyTyped(character, key); + } + catch (IOException e) { + e.printStackTrace(); + } + if (character == '\t') { + + } + if (character == '\r') { + //this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + //this.searchBar.textboxKeyTyped(character, key); + + }*/ + + @Override + protected void actionPerformed(GuiButton button) throws IOException { + if(button.id == 1) { + //NightSky.sendMessage("Opened ClickGUI"); + type = GUIType.CLICK; + //hud = true; + mc.displayGuiScreen(new ClickGUI()); + + //mc.displayGuiScreen(new ClickGUI()); + + } + if(button.id == 5) { + mc.displayGuiScreen(new HUDConfigScreen()); + } + if(button.id == 3) { + setType(GUIType.COSMETIC); + mc.displayGuiScreen(new ClickGUI()); + //type = GUIType.COSMETIC; + //mc.displayGuiScreen(new CosmeticGUINew()); + } + if(button.id == 2) { + setType(GUIType.PROFILE); + mc.displayGuiScreen(new ClickGUI()); + //type = GUIType.PROFILE; + //mc.displayGuiScreen(new ClickGUI2()); + } + if(button.id == 4) { + setType(GUIType.THEME); + mc.displayGuiScreen(new ClickGUI()); + //mc.displayGuiScreen(new GuiMultiplayerIngame()); + } + if(button.id == 99) { + try { + Desktop desktop = java.awt.Desktop.getDesktop(); + URI oURL = new URI("http://hynomacka.ddns.net"); + desktop.browse(oURL); + } catch (Exception e) { + e.printStackTrace(); + } + } + if(button.id == 6) { + //mc.displayGuiScreen(new Changelog()); + hud = true; + } + if(button.id == 8) { + type = GUIType.COSMETIC; + mc.displayGuiScreen(new ClickGUI()); + //mc.displayGuiScreen(new CosmeticGUINew()); + } + if(button.id == 9) { + mc.displayGuiScreen(new ClickGUI()); + } + if(button.id == 0) { + type = GUIType.PROFILE; + mc.displayGuiScreen(new ClickGUI()); + //mc.displayGuiScreen(new ProfileCGui(null)); + } + } + +//} + public static void setType(GUIType killme) { + if(killme == GUIType.CLICK) { + type = GUIType.CLICK; + //this.m = null; + } else if(killme == GUIType.COSMETIC) { + type = GUIType.COSMETIC; + //this.m = null; + } else if(killme == GUIType.PROFILE) { + type = GUIType.PROFILE ; + //this.m = null; + }else if(killme == GUIType.THEME) { + type = GUIType.THEME ; + } + } + public static void setTheme(GUITheme killme) { + if(killme == GUITheme.DARK) { + theme = GUITheme.DARK; + //this.m = null; + } else if(killme == GUITheme.LIGHT) { + theme = GUITheme.LIGHT; + //this.m = null; + } + } + + //public ParticleEngine engine = new ParticleEngine(); + + + + public static void ownerCheck() { + if(NightSky.DisName + NightSky.DisTag == "Hypnomacka#4765") { + Booleans.isOwner = true; + } else { + Booleans.isOwner = false; + } + } + + + + + @Override + public void draw() { + + GL11.glColor4f(1F, 1F, 1F, 1F); + + Playerdraw(15 + 15, 15 + 50, 25, 50, 0, null); + + super.draw(); + } + + + @Override + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + for(ModButton m : modButtons) { + m.onClick(mouseX, mouseY, mouseButton); + } + for(CosmeticButton cos : cosButtons) { + cos.onClick(mouseX, mouseY, mouseButton); + } + for(SettingButton s : settingButtons) { + s.onClick(mouseX, mouseY, mouseButton); + } + if(hovered) { + if(mouseButton == 0) { + //mc.displayGuiScreen(new ClickGUI()); + hud = false; + } + } + if(type == GUIType.SETTINGS) { + for(HudMod mod : NightSky.INSTANCE.hudManager.hudMods) { + if(!mod.settings.isEmpty()) { + for(Setting setting : mod.settings) { + if(setting instanceof BooleanSetting) { + if(BooleanButton.isHovered(mouseX, mouseY)) { + ((BooleanSetting) setting).toggle(); + } + } + } + } + } + for(HudMod mod : NightSky.INSTANCE.hudManager.hudMods) { + if(!mod.settings.isEmpty()) { + for(Setting setting : mod.settings) { + if(setting instanceof ModeSetting) { + if(ModeButton.isHovered(mouseX, mouseY)) { + ((ModeSetting) setting).cycle(); + } + } + } + } + } + } + super.mouseClicked(mouseX, mouseY, mouseButton); + } + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } + public static void Playerdraw(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent) + { + try { + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)posX, (float)posY, 50.0F); + GlStateManager.scale((float)(-40), (float)42, (float)42); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + float f = ent.renderYawOffset; + float f1 = ent.rotationYaw; + float f2 = ent.rotationPitch; + float f3 = ent.prevRotationYawHead; + float f4 = ent.rotationYawHead; + GlStateManager.rotate(180f, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); + ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F; + ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F; + ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F; + ent.rotationYawHead = ent.rotationYaw; + ent.prevRotationYawHead = ent.rotationYaw; + GlStateManager.translate(0.0F, 0.0F, 0.0F); + RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); + rendermanager.setPlayerViewY(180.0F); + rendermanager.setRenderShadow(false); + rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + rendermanager.setRenderShadow(true); + ent.renderYawOffset = f; + ent.rotationYaw = f1; + ent.rotationPitch = f2; + ent.prevRotationYawHead = f3; + ent.rotationYawHead = f4; + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } catch (NullPointerException e) { + System.out.println("Playerdraw ERROR"); + } + + } + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void onGuiClosed() { + if(type == GUIType.SETTINGS && ModButton.settings) { + //type = GUIType.CLICK; + ModButton.settings = false; + } + + this.guiOpen = false; + super.onGuiClosed(); + mc.entityRenderer.stopUseShader(); + } + + +} diff --git a/src/minecraft/animeware/gui/clickgui/GUITheme.java b/src/minecraft/animeware/gui/clickgui/GUITheme.java new file mode 100644 index 0000000..280e07b --- /dev/null +++ b/src/minecraft/animeware/gui/clickgui/GUITheme.java @@ -0,0 +1,8 @@ +package animeware.gui.clickgui; + +public enum GUITheme { + + LIGHT, + DARK; + +} diff --git a/src/minecraft/animeware/gui/clickgui/GUIType.java b/src/minecraft/animeware/gui/clickgui/GUIType.java new file mode 100644 index 0000000..6d3f123 --- /dev/null +++ b/src/minecraft/animeware/gui/clickgui/GUIType.java @@ -0,0 +1,12 @@ +package animeware.gui.clickgui; + +public enum GUIType { + + THEME, + SETTINGS, + CLICK, + COSMETIC, + PROFILE, + CGSETTINGS; + +} diff --git a/src/minecraft/animeware/gui/clickgui/SettingsGUI.java b/src/minecraft/animeware/gui/clickgui/SettingsGUI.java new file mode 100644 index 0000000..4afcd53 --- /dev/null +++ b/src/minecraft/animeware/gui/clickgui/SettingsGUI.java @@ -0,0 +1,137 @@ +package animeware.gui.clickgui; + +import java.awt.Color; +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; + +import animeware.NightSky; +import animeware.gui.mainmenu.MainMenu; +import animeware.hud.HUDConfigScreen; +import animeware.hud.mod.HudMod; +import animeware.ui.comp.HomeCGButton; +import animeware.ui.comp.LArrowBtn; +import animeware.ui.comp.LogoButtonWhite; +import animeware.ui.comp.clickgui.ModButton; +import animeware.ui.comp.clickgui.SettingFrame; +import animeware.util.render.RoundedUtils; +import animeware.util.render.ui.ClickGUIUtil; +import animeware.util.settings.BooleanSetting; +import animeware.util.settings.ModeSetting; +import animeware.util.settings.Setting; +import animeware.util.settings.comp.BooleanButton; +import animeware.util.settings.comp.ModeButton; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.ResourceLocation; + +public class SettingsGUI extends GuiScreen { + + HudMod mod; + + private Minecraft mc = Minecraft.getMinecraft(); + FontRenderer font = mc.fontRendererObj; + ModButton modButton = new ModButton(); + ArrayList modbuttons = new ArrayList(); + ScaledResolution sr = new ScaledResolution(mc); + + ArrayList frames; + ArrayList bools; + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + public SettingsGUI(HudMod mod) { + this.mod = mod; + + /*frames = new ArrayList<>(); + int offset = 0; + for(Category category : Category.values()) { + frames.add(new SettingFrame(mod, 285, 100)); + offset += 150; + }*/ + } + @Override + public void initGui() { + //mc.entityRenderer.loadShader(new ResourceLocation("Animeware/blur.json")); + //this.buttonList.add(new LogoButtonWhite(69, this.width / 2 - 186, this.height / 2 - 109, "")); + this.buttonList.add(new LArrowBtn(1, this.width / 2 - 186, this.height / 2 - 109, "")); + //this.buttonList.add(new LogoButtonWhite(0, this.width / 2 - 186, this.height / 2 - 109, "")); + //super.initGui(); + } + @Override + protected void actionPerformed(GuiButton button) throws IOException { + if(button.id == 1) { + mc.displayGuiScreen(new MainMenu()); + + } + + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + ClickGUIUtil.renderClickGUI(); + super.drawScreen(mouseX, mouseY, partialTicks); + + if(!mod.settings.isEmpty()) { + for(Setting setting : mod.settings) { + int countb = 1; + if(setting instanceof BooleanSetting) { + new BooleanButton(mouseX, mouseY, 75, 75 * countb + 10, (BooleanSetting) setting, mod, 1); + countb += 1; + } + } + for(Setting setting : mod.settings) { + int countm = 1; + if(setting instanceof ModeSetting) { + new ModeButton(mouseX, mouseY, this.width / 2 - 140, this.height / 2 - 80 * countm + 10, (ModeSetting) setting, mod, 2); + countm += 1; + } + } + } + //this.buttonList.add(new LogoButtonWhite(0, this.width / 2 - 186, this.height / 2 - 109, "")); + + //if(mod.settings.isEmpty()) { + //font.drawString("This mod has no settings!", 420, 250, -1); + //} + } + + + @Override + public void mouseClicked(int x, int y, int button) { + for(HudMod mod : NightSky.INSTANCE.hudManager.hudMods) { + if(!mod.settings.isEmpty()) { + for(Setting setting : mod.settings) { + if(setting instanceof BooleanSetting) { + if(BooleanButton.isHovered(x, y)) { + ((BooleanSetting) setting).toggle(); + } + } + } + } + } + for(HudMod mod : NightSky.INSTANCE.hudManager.hudMods) { + if(!mod.settings.isEmpty()) { + for(Setting setting : mod.settings) { + if(setting instanceof ModeSetting) { + if(ModeButton.isHovered(x, y)) { + ((ModeSetting) setting).cycle(); + } + } + } + } + } + } + @Override + public void onGuiClosed() { + //this.guiOpen = false; + super.onGuiClosed(); + mc.entityRenderer.stopUseShader(); + } +} diff --git a/src/minecraft/animeware/gui/mainmenu/AltButton.java b/src/minecraft/animeware/gui/mainmenu/AltButton.java new file mode 100644 index 0000000..92bc71f --- /dev/null +++ b/src/minecraft/animeware/gui/mainmenu/AltButton.java @@ -0,0 +1,176 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.gui.mainmenu; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.Tessellator; +import org.lwjgl.opengl.GL11; + +import animeware.NightSky; +import animeware.util.font.FontUtil; +import animeware.util.render.RoundedUtils; + +import java.io.File; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; +import net.minecraft.client.renderer.GlStateManager; +import java.awt.Color; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; + +public class AltButton extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + + //public static int name; + + static int widthint = 0; + + float anim = 0.0F; + + public static int name() { + try { + return Minecraft.getMinecraft().fontRendererObj.getStringWidth(NightSky.mcname); + }catch(NullPointerException e) { + e.printStackTrace(); + return 0; + } + } + + public AltButton(final int i, final int j, final int k, final String s) { + this(i, j, k, 21 + name(), 21, s); + } + + public AltButton(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + int j = -1; + if (this.hovered) { + this.name(); + j = new Color(0,210,220,0).getRGB(); + } + if (!this.hovered) { + this.fade = 230; + } + else { + if (this.fade <= 50) { + return; + } + if (this.fade != 160) { + this.fade -= 10; + } + } + if (!this.hovered) { + this.fade2 = 200; + } + else { + if (this.fade2 <= 30) { + return; + } + if (this.fade2 != 200) { + this.fade2 += 10; + } + } + final float b = (float)(this.hovered ? new Color(0, 0, 255, 255).getRGB() : new Color(0, 0, 255, 255).getRGB()); + final Color a = new Color(0, 0, 5, 100); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 5; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + //this.drawRoundedRect(this.xPosition - 1, this.yPosition - 1, this.width + 2, this.height + 2, 3, a2); + //this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a3); + if (this.anim > 0.0F) + this.anim -= 8.5F; + if(!hovered) { + this.drawRoundedRect(this.xPosition, this.yPosition, this.xPosition + 15, this.yPosition + 15, 3, a); + RoundedUtils.drawRoundedOutline(this.xPosition, this.yPosition, this.xPosition + 21, this.yPosition + 21, 8.0F, 2, new Color(0, 0, 0, 255).getRGB()); + } else { + this.drawRoundedRect(this.xPosition, this.yPosition, this.xPosition + 22 + name(), this.height, 3, a); + RoundedUtils.drawRoundedOutline(this.xPosition, this.yPosition, this.xPosition + 28 + name(), this.yPosition + 21, 8.0F, 2, new Color(0, 0, 0, 255).getRGB()); + + } + if(hovered) { + //System.out.println(name()); + FontUtil.normal.drawString(mc.getSession().getUsername(), this.xPosition + 20, this.yPosition + (this.height - 5) / 2, j); + } else + FontUtil.normal.drawString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 5) / 2, j); + if(hovered) { + GlStateManager.color(0.0f, 0.8f, 0.9f); + }else { + GlStateManager.color(1.0f, 1.0f, 1.0f); + } + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/logo.png")); + //Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/account.png")); + Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + + } + } + + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } + private void Extension() { + if(hovered == true) { + this.widthint = 40; + } else + this.widthint = 21; + } +} diff --git a/src/minecraft/animeware/gui/mainmenu/ClassicButton.java b/src/minecraft/animeware/gui/mainmenu/ClassicButton.java new file mode 100644 index 0000000..2f81a74 --- /dev/null +++ b/src/minecraft/animeware/gui/mainmenu/ClassicButton.java @@ -0,0 +1,136 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.gui.mainmenu; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.Tessellator; +import org.lwjgl.opengl.GL11; + +import animeware.util.font.FontUtil; +import animeware.util.render.RoundedUtils; + +import java.io.File; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; +import net.minecraft.client.renderer.GlStateManager; +import java.awt.Color; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; + +public class ClassicButton extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + + + public ClassicButton(final int i, final int j, final int k, final String s) { + this(i, j, k, 200, 21, s); + + } + + public ClassicButton(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + int j = -1; + if (this.hovered) { + j = new Color(0,210,220,0).getRGB(); + } + if (!this.hovered) { + this.fade = 230; + } + else { + if (this.fade <= 50) { + return; + } + if (this.fade != 160) { + this.fade -= 10; + } + } + if (!this.hovered) { + this.fade2 = 200; + } + else { + if (this.fade2 <= 30) { + return; + } + if (this.fade2 != 200) { + this.fade2 += 10; + } + } + final float b = (float)(this.hovered ? new Color(0, 0, 255, 255).getRGB() : new Color(0, 0, 255, 255).getRGB()); + final Color a = new Color(0, 0, 5, 70); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 5; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + //this.drawRoundedRect(this.xPosition - 1, this.yPosition - 1, this.width + 2, this.height + 2, 3, a2); + //this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a3); + + this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a); + //RoundedUtils.drawRoundedOutline(this.xPosition, this.yPosition, this.xPosition + 200, this.yPosition + 20, 8.0F, 2, new Color(0, 0, 0, 255).getRGB()); //this.width / 2 - 94, this.height / 2 + 5, this.width / 2 + 116, this.height / 2 + 85, 18.0F, 2, new Color(0, 140, 170, 255).getRGB() + GlStateManager.color(1.0f, 0.0f, 0.0f); + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/logo.png")); + //Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + FontUtil.normal.drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 5) / 2, j); + } + } + + public void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } +} diff --git a/src/minecraft/animeware/gui/mainmenu/CosmeticButtonMM.java b/src/minecraft/animeware/gui/mainmenu/CosmeticButtonMM.java new file mode 100644 index 0000000..7c95aad --- /dev/null +++ b/src/minecraft/animeware/gui/mainmenu/CosmeticButtonMM.java @@ -0,0 +1,134 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.gui.mainmenu; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.Tessellator; +import org.lwjgl.opengl.GL11; + +import animeware.util.font.FontUtil; +import animeware.util.render.RoundedUtils; + +import java.io.File; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; +import net.minecraft.client.renderer.GlStateManager; +import java.awt.Color; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; + +public class CosmeticButtonMM extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + + + public CosmeticButtonMM(final int i, final int j, final int k, final String s) { + this(i, j, k, 21, 21, s); + + } + + public CosmeticButtonMM(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + int j = -1; + if (this.hovered) { + j = new Color(0,210,220,0).getRGB(); + } + + final float b = (float)(this.hovered ? new Color(0, 0, 255, 255).getRGB() : new Color(0, 0, 255, 255).getRGB()); + final Color c = new Color(0, 0, 5, 70); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + float f = this.hovered ? new Color(153, 9, 193).getRGB() : new Color(255,255,255,255).getRGB(); + Color a = new Color(0,0,0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 5; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + if(!hovered) { + this.fade = 90; + } + else { + if(this.fade <= 30) { + return; + } + if(this.fade != 130) { + this.fade += 5; + } + } + //this.drawRoundedRect(this.xPosition - 1, this.yPosition - 1, this.width + 2, this.height + 2, 3, a2); + //this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a3); + this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a); + RoundedUtils.drawRoundedOutline(this.xPosition, this.yPosition, this.xPosition + 21, this.yPosition + 21, 8.0F, 2, new Color(0, 0, 0, 255).getRGB()); //this.width / 2 - 94, this.height / 2 + 5, this.width / 2 + 116, this.height / 2 + 85, 18.0F, 2, new Color(0, 140, 170, 255).getRGB() + if(hovered) { + GlStateManager.color(0.0f, 0.8f, 0.9f); + }else { + GlStateManager.color(1.0f, 1.0f, 1.0f); + } + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/logo.png")); + //Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/cosmetics.png")); + Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + + FontUtil.normal.drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 5) / 2, j); + } + } + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } +} diff --git a/src/minecraft/animeware/gui/mainmenu/CosmeticButtonNoOutl.java b/src/minecraft/animeware/gui/mainmenu/CosmeticButtonNoOutl.java new file mode 100644 index 0000000..a5e54e5 --- /dev/null +++ b/src/minecraft/animeware/gui/mainmenu/CosmeticButtonNoOutl.java @@ -0,0 +1,130 @@ +package animeware.gui.mainmenu; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.Tessellator; +import org.lwjgl.opengl.GL11; + +import animeware.util.font.FontUtil; +import animeware.util.render.RoundedUtils; + +import java.io.File; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; +import net.minecraft.client.renderer.GlStateManager; +import java.awt.Color; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; + +public class CosmeticButtonNoOutl extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + + + public CosmeticButtonNoOutl(final int i, final int j, final int k, final String s) { + this(i, j, k, 21, 21, s); + + } + + public CosmeticButtonNoOutl(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + int j = -1; + if (this.hovered) { + j = new Color(0,210,220,0).getRGB(); + } + + final float b = (float)(this.hovered ? new Color(0, 0, 255, 255).getRGB() : new Color(0, 0, 255, 255).getRGB()); + final Color c = new Color(0, 0, 5, 70); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + float f = this.hovered ? new Color(153, 9, 193).getRGB() : new Color(255,255,255,255).getRGB(); + Color a = new Color(0,0,0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 5; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + if(!hovered) { + this.fade = 90; + } + else { + if(this.fade <= 30) { + return; + } + if(this.fade != 130) { + this.fade += 5; + } + } + //this.drawRoundedRect(this.xPosition - 1, this.yPosition - 1, this.width + 2, this.height + 2, 3, a2); + //this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a3); + this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a); + //RoundedUtils.drawRoundedOutline(this.xPosition, this.yPosition, this.xPosition + 21, this.yPosition + 21, 8.0F, 2, new Color(0, 0, 0, 255).getRGB()); //this.width / 2 - 94, this.height / 2 + 5, this.width / 2 + 116, this.height / 2 + 85, 18.0F, 2, new Color(0, 140, 170, 255).getRGB() + if(hovered) { + GlStateManager.color(0.0f, 0.8f, 0.9f); + }else { + GlStateManager.color(1.0f, 1.0f, 1.0f); + } + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/logo.png")); + //Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/cosmetics.png")); + Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + + FontUtil.normal.drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 5) / 2, j); + } + } + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } +} diff --git a/src/minecraft/animeware/gui/mainmenu/MMMode.java b/src/minecraft/animeware/gui/mainmenu/MMMode.java new file mode 100644 index 0000000..bd8beed --- /dev/null +++ b/src/minecraft/animeware/gui/mainmenu/MMMode.java @@ -0,0 +1,8 @@ +package animeware.gui.mainmenu; + +public enum MMMode { + + DEFAULT, + COSMETIC; + +} diff --git a/src/minecraft/animeware/gui/mainmenu/MainMenu.java b/src/minecraft/animeware/gui/mainmenu/MainMenu.java new file mode 100644 index 0000000..fb49f3e --- /dev/null +++ b/src/minecraft/animeware/gui/mainmenu/MainMenu.java @@ -0,0 +1,520 @@ +package animeware.gui.mainmenu; + +import java.awt.Color; +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; + +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.glu.Project; + +import animeware.NightSky; +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticModule; +import animeware.gui.clickgui.ClickGUI; +import animeware.ui.comp.CosmeticButton; +import animeware.ui.comp.MainMenuBtn; +import animeware.ui.comp.clickgui.ModButton; +import animeware.ui.login.LoginScreen; +import animeware.util.ClientPanorama; +import animeware.util.animations.Animation; +import animeware.util.font.FontUtil; +import animeware.util.font.JCFont.Fonts; +import animeware.util.font.JCFont.cFontRenderer; +import animeware.util.render.AnimatedResourceLocation; +import animeware.util.render.ColorUtil; +import animeware.util.render.DrawUtil; +import animeware.util.render.RenderUtil; +import animeware.util.render.ui.ClickGUIUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiMultiplayer; +import net.minecraft.client.gui.GuiOptions; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiSelectWorld; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.I18n; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class MainMenu extends GuiScreen { + + public cFontRenderer regular = Fonts.getCustomeFont(20, "regular"); + + public cFontRenderer light = Fonts.getCustomeFont(20, "light"); + + public cFontRenderer bold = Fonts.getCustomeFont(20, "bold"); + + public cFontRenderer bold_ = Fonts.getCustomeFont(20, "bold+"); + + public cFontRenderer regularS = Fonts.getCustomeFont(14, "regular"); + + public cFontRenderer lightS = Fonts.getCustomeFont(14, "light"); + + public cFontRenderer boldS = Fonts.getCustomeFont(14, "bold"); + + public cFontRenderer bold_S = Fonts.getCustomeFont(14, "bold+"); + + private final Object threadLock = new Object(); + + boolean hovered; + private String splashText; + private String openGLWarning1; + private String openGLWarning2; + private DynamicTexture viewportTexture; + private Animation openAnimation; + ArrayList cosButtons = new ArrayList<>(); + //private static final ResourceLocation minecraftTitleTextures = new ResourceLocation("textures/gui/title/minecraft.png"); + private float updateCounter; + private int field_92024_r; + private int field_92023_s; + private int field_92022_t; + private int field_92021_u; + private int field_92020_v; + private int field_92019_w; + private ResourceLocation backgroundTexture; + private int panoramaTimer; + + private AnimatedResourceLocation gif; + + private int bgid = 0; + public static MMMode mode = MMMode.DEFAULT; + + @Override + public void updateScreen() + { + ++this.panoramaTimer; + } + + public static void setMode(MMMode killme2) { + if(killme2 == MMMode.DEFAULT) { + mode = MMMode.DEFAULT; + //this.m = null; + } else if(killme2 == MMMode.COSMETIC) { + mode = MMMode.COSMETIC; + //this.m = null; + } + } + + @Override + public void initGui() { + //setMode(MMMode.DEFAULT); + + //openAnimation = new ElasticAnimation(750, 1, 30.8f, 4.75f, false); + ScaledResolution sr = new ScaledResolution(mc); + NightSky.INSTANCE.getDiscordRP().update("Main Menu", "Version: " + NightSky.INSTANCE.VERSION); + if(!Booleans.ban) { + gif = new AnimatedResourceLocation("Animeware/cosmetic/capes/anim/lightning", 10, 5); + NightSky.INSTANCE.getDiscordRP().update("Main Menu", "Version: " + NightSky.INSTANCE.VERSION); + int i = 24; + int j = this.height / 4 + 48; + //this.buttonList.add(new ClassicButton(1, 370, height / 2 + 25, "Singleplayer")); + //this.buttonList.add(new GuiButton(0, this.width / 2 - 100, 72 + 1, 98, 30, ("options"))); + //this.buttonList.add(new ClassicButton(2, 370, height / 2 + 51, "Multiplayer")); + + if(mode == MMMode.COSMETIC) { + this.buttonList.add(new QuitButton(11, sr.getScaledWidth() - 135, 70, "")); + } + int countCosmetic = 40; + for(CosmeticModule m : NightSky.INSTANCE.cosManager.cosmetics) { + if(m.name == "Owner Cape" || m.name == "Staff Cape" || m.name == "Creeper Lightning Cosmetic" || m.name == "YT Cape") { + + } else if(mode == MMMode.COSMETIC){ + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139,this.height / 2 - 145 + countCosmetic, 323, 35, m)); + countCosmetic = countCosmetic + 40; + //System.out.println(countModule); + } + } + this.buttonList.add(new QuitButton(4, sr.getScaledWidth() - 27, 6, "")); + //this.buttonList.add(new GuiButton(4, 370, height / 2 + 85, "Quit")); + //this.buttonList.add(new AltButton(6, 6, 6, "")); + if(mode == MMMode.DEFAULT) { + + + //this.buttonList.add(new GuiButton(6, 370, height / 2 + 85, "Discord‍")); + //this.buttonList.add(new DisButton(5, this.width / 2 - 452, this.height / 2 + 235, "")); + //this.buttonList.add(new Discord(8, 370, height / 2 + 85, "")); + //this.buttonList.add(new LilButton(7, this.width / 2 - 512, this.height / 2 + 235, "")); + this.buttonList.add(new SettingsButton(3, this.width / 2 - 0, this.height / 2 + 60, "")); + //this.buttonList.add(new CosmeticButtonMM(8, this.width / 2 - 25, this.height / 2 + 60, "")); //235 + //this.buttonList.add(new WebsiteButton(9, this.width / 2 - 542, this.height / 2 + 235, "")); + //this.buttonList.add(new CosmeticsButton(8, 475, height / 2 + 35, "")); + //this.buttonList.add(new GuiButton(8, 435, height / 2 + 235, "Login")); + //this.buttonList.add(new LilButton2(10, 930, height / 2 + 235, "BG")); + + this.buttonList.add(new MainMenuBtn(1, this.width / 2 - 100, this.height / 2 + 10, 200, 20, + I18n.format("Singleplayer", new Object[0]))); + this.buttonList.add(new MainMenuBtn(2, this.width / 2 - 100, this.height / 2 + 34, 200, 20, + I18n.format("Multiplayer", new Object[0]))); + } + + //this.viewportTexture = new DynamicTexture(256, 256); + //this.backgroundTexture = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture); + + //this.buttonList.add(new ClassicButton(10, width - 187, 3, 80, 20, "Change BG")); + + + + //this.buttonList.add(new GuiButton(0, this.width / 2 - 100, 72 + 1, 98, 30, I18n.format("menu.options", new Object[0]))); + //this.buttonList.add(new GuiButton(4, this.width / 2 + 2, j + 72 + 12, 98, 20, I18n.format("menu.quit", new Object[0]))); + //this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, j + 72 + 12)); + + synchronized (this.threadLock) + { + this.field_92023_s = this.fontRendererObj.getStringWidth(this.openGLWarning1); + this.field_92024_r = this.fontRendererObj.getStringWidth(this.openGLWarning2); + int k = Math.max(this.field_92023_s, this.field_92024_r); + this.field_92022_t = (this.width - k) / 2; + this.field_92021_u = ((GuiButton)this.buttonList.get(0)).yPosition - 24; + this.field_92020_v = this.field_92022_t + k; + this.field_92019_w = this.field_92021_u + 24; + } + + this.mc.func_181537_a(false); + + + }else { + this.buttonList.add(new ClassicButton(4, this.width / 2 - 92, this.height / 2 + 25, 200, 20, + I18n.format("Banned", new Object[0]))); + } + super.initGui(); + } + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + + if(!Booleans.ban) { + boolean ingame = Minecraft.getMinecraft().theWorld != null && Minecraft.getMinecraft().thePlayer != null; + + /*if(!ingame) { + GlStateManager.disableAlpha(); + this.renderSkybox(mouseX, mouseY, partialTicks); + GlStateManager.enableAlpha(); + }*/ + Color gradientColor1 = ColorUtil.interpolateColorsBackAndForth(15, 1, NightSky.INSTANCE.getClientColor(), NightSky.INSTANCE.getAlternateClientColor(), false); + Color gradientColor2 = ColorUtil.interpolateColorsBackAndForth(15, 1, NightSky.INSTANCE.getAlternateClientColor(), NightSky.INSTANCE.getClientColor(), false); + + this.mc.getTextureManager().bindTexture(new ResourceLocation("Animeware/background/old/bg69.png")); + Gui.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, width, height, width, height); + + DrawUtil.draw2DImage(new ResourceLocation("Animeware/logonobg.png"), this.width / 2 - 70, this.height / 2 - 117, 137, 135, Color.WHITE); + + GL11.glColor4f(1, 1, 1, 1); + GlStateManager.enableAlpha(); + GlStateManager.enableBlend(); + //FontUtil.normal.drawString(NightSky.INSTANCE.NAME + " " + NightSky.INSTANCE.VERSION ,0 + 3, this.height - 11, -1); + //FontUtil.normal.drawString("Copyright Mojang Studios" ,sr.getScaledWidth() - 135, this.height - 11, -1); + //this.regular.drawStringWithShadow(NightSky.INSTANCE.NAME + " " + NightSky.INSTANCE.VERSION, 3.0F, (this.height - 12), -1); + //this.regular.drawStringWithShadow("Not Affiliated With Mojang AB.", (this.width - this.regular.getStringWidth("Not Affiliated Whit Mojang AB.") - 2), (this.height - 12), -1); + GlStateManager.pushMatrix(); + GlStateManager.scale(3, 3, 1); + GlStateManager.popMatrix(); + if(mode == MMMode.COSMETIC) { + GL11.glColor4f(1F, 1F, 1F, 1F); + GlStateManager.enableAlpha(); + GlStateManager.enableBlend(); + + ClickGUIUtil.renderCosmeticMenu(); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + try { + if(MinecraftServer.getServer().isSinglePlayer()) { + + NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()); + if(playerInfo != null) { + GL11.glColor4f(1F, 1F, 1F, 1F); + } + } else if(Minecraft.getMinecraft().getCurrentServerData() != null) { + NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()); + if(playerInfo != null) { + GL11.glColor4f(1F, 1F, 1F, 1F); + } + + } else { + + } + } catch(NullPointerException e) { + //e.printStackTrace(); + } + + GL11.glDisable(GL11.GL_SCISSOR_TEST); + checkMouseWheelCosmetic(mouseX, mouseY); + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_SCISSOR_BIT); + { + RenderUtil.scissor(this.width / 2 - 190, this.height / 2 - 110, this.width / 2 + 190, this.height / 2 + 110); + //RenderUtil.scissor2(this.width / 2 - 190, this.height / 2 - 110, 1920, 1080); + //RenderUtil.scissor(this.width / 2 - 100, -300, 1920, 1080); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + for(CosmeticButton cos : cosButtons) { + cos.draw(); + } + GL11.glDisable(GL11.GL_SCISSOR_TEST); + GL11.glPopAttrib(); + GL11.glPopMatrix(); + } + + @Override + protected void actionPerformed(GuiButton button) throws IOException { + if(button.id == 1) { + //NightSky.INSTANCE.config.saveAccount(); + mc.displayGuiScreen(new GuiSelectWorld(null)); + } + if(button.id == 2) { + mc.displayGuiScreen(new GuiMultiplayer(this)); + } + if(button.id == 3) { + mc.displayGuiScreen(new GuiOptions(this, mc.gameSettings)); + } + if(button.id == 4) { + //NightSky.INSTANCE.config.saveAccount(); + mc.shutdown(); + } + if(button.id == 6) { + mc.displayGuiScreen(new LoginScreen()); + } + + if(button.id == 5) { + try { + Desktop desktop = java.awt.Desktop.getDesktop(); + URI oURL = new URI("https://discord.gg/bCYU3DrW"); + desktop.browse(oURL); + } catch (Exception e) { + e.printStackTrace(); + } + } + if(button.id == 7) { + this.mc.displayGuiScreen(new ClickGUI()); + } + if(button.id == 8) { + setMode(MMMode.COSMETIC); + mc.displayGuiScreen(new MainMenu()); + } + if(button.id == 9) { + try { + Desktop desktop = java.awt.Desktop.getDesktop(); + URI oURL = new URI("https://github.com/hypnomacka"); + desktop.browse(oURL); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + if(button.id == 10) { + bgid++; + if(bgid == 9) { + bgid = 0; + } + } + if(button.id == 11) { + setMode(MMMode.DEFAULT); + mc.displayGuiScreen(new MainMenu()); + + } + + + + //if(button.id == 8) { + + //} + //if(button.id == 8) { + //this.mc.displayGuiScreen(new AnimewareLoginScreen()); + //} + + super.actionPerformed(button); + } + + private void drawPanorama(int p_73970_1_, int p_73970_2_, float p_73970_3_) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.matrixMode(5889); + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F); + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.disableCull(); + GlStateManager.depthMask(false); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + int i = 8; + + for (int j = 0; j < i * i; ++j) + { + GlStateManager.pushMatrix(); + float f = ((float)(j % i) / (float)i - 0.5F) / 64.0F; + float f1 = ((float)(j / i) / (float)i - 0.5F) / 64.0F; + float f2 = 0.0F; + GlStateManager.translate(f, f1, f2); + GlStateManager.rotate(MathHelper.sin(((float)this.panoramaTimer + p_73970_3_) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-((float)this.panoramaTimer + p_73970_3_) * 0.1F, 0.0F, 1.0F, 0.0F); + + for (int k = 0; k < 6; ++k) + { + GlStateManager.pushMatrix(); + + if (k == 1) + { + GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); + } + + if (k == 2) + { + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + } + + if (k == 3) + { + GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); + } + + if (k == 4) + { + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + } + + if (k == 5) + { + GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); + } + + this.mc.getTextureManager().bindTexture(ClientPanorama.getTiles()[k]); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + int l = 255 / (j + 1); + float f3 = 0.0F; + worldrenderer.pos(-1.0D, -1.0D, 1.0D).tex(0.0D, 0.0D).color(255, 255, 255, l).endVertex(); + worldrenderer.pos(1.0D, -1.0D, 1.0D).tex(1.0D, 0.0D).color(255, 255, 255, l).endVertex(); + worldrenderer.pos(1.0D, 1.0D, 1.0D).tex(1.0D, 1.0D).color(255, 255, 255, l).endVertex(); + worldrenderer.pos(-1.0D, 1.0D, 1.0D).tex(0.0D, 1.0D).color(255, 255, 255, l).endVertex(); + tessellator.draw(); + GlStateManager.popMatrix(); + } + + GlStateManager.popMatrix(); + GlStateManager.colorMask(true, true, true, false); + } + + worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); + GlStateManager.colorMask(true, true, true, true); + GlStateManager.matrixMode(5889); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); + GlStateManager.enableDepth(); + } + + /** + * Rotate and blurs the skybox view in the main menu + */ + private void rotateAndBlurSkybox(float p_73968_1_) + { + this.mc.getTextureManager().bindTexture(this.backgroundTexture); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.colorMask(true, true, true, false); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + GlStateManager.disableAlpha(); + int i = 3; + + for (int j = 0; j < i; ++j) + { + float f = 1.0F / (float)(j + 1); + int k = this.width; + int l = this.height; + float f1 = (float)(j - i / 2) / 256.0F; + worldrenderer.pos((double)k, (double)l, (double)this.zLevel).tex((double)(0.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); + worldrenderer.pos((double)k, 0.0D, (double)this.zLevel).tex((double)(1.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); + worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex((double)(1.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); + worldrenderer.pos(0.0D, (double)l, (double)this.zLevel).tex((double)(0.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); + } + + tessellator.draw(); + GlStateManager.enableAlpha(); + GlStateManager.colorMask(true, true, true, true); + } + + /** + * Renders the skybox in the main menu + */ + private void renderSkybox(int p_73971_1_, int p_73971_2_, float p_73971_3_) + { + this.mc.getFramebuffer().unbindFramebuffer(); + GlStateManager.viewport(0, 0, 256, 256); + this.drawPanorama(p_73971_1_, p_73971_2_, p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.mc.getFramebuffer().bindFramebuffer(true); + GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + float f = this.width > this.height ? 120.0F / (float)this.width : 120.0F / (float)this.height; + float f1 = (float)this.height * f / 256.0F; + float f2 = (float)this.width * f / 256.0F; + int i = this.width; + int j = this.height; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos(0.0D, (double)j, (double)this.zLevel).tex((double)(0.5F - f1), (double)(0.5F + f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); + worldrenderer.pos((double)i, (double)j, (double)this.zLevel).tex((double)(0.5F - f1), (double)(0.5F - f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); + worldrenderer.pos((double)i, 0.0D, (double)this.zLevel).tex((double)(0.5F + f1), (double)(0.5F - f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); + worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex((double)(0.5F + f1), (double)(0.5F + f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); + tessellator.draw(); + } + + public void checkMouseWheelCosmetic(int mouseX, int mouseY) { + int mouseScrollCos = Mouse.getDWheel(); + if(mouseScrollCos > 0) { + for(CosmeticButton b : cosButtons) { + b.y += 15; + } + } else if(mouseScrollCos < 0) { + for(CosmeticButton b : cosButtons) { + b.y -= 15; + } + } + } + @Override + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + + for(CosmeticButton cos : cosButtons) { + cos.onClick(mouseX, mouseY, mouseButton); + } + super.mouseClicked(mouseX, mouseY, mouseButton); + } + +} + diff --git a/src/minecraft/animeware/gui/mainmenu/MicrosoftButton.java b/src/minecraft/animeware/gui/mainmenu/MicrosoftButton.java new file mode 100644 index 0000000..2fc9242 --- /dev/null +++ b/src/minecraft/animeware/gui/mainmenu/MicrosoftButton.java @@ -0,0 +1,140 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.gui.mainmenu; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.Tessellator; +import org.lwjgl.opengl.GL11; + +import animeware.util.font.FontUtil; + +import java.io.File; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; +import net.minecraft.client.renderer.GlStateManager; +import java.awt.Color; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; + +public class MicrosoftButton extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + + + public MicrosoftButton(final int i, final int j, final int k, final String s) { + this(i, j, k, 175, 21, s); + + } + + public MicrosoftButton(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + int j = -1; + if (this.hovered) { + j = new Color(0,210,220,0).getRGB(); + } + if (!this.hovered) { + this.fade = 230; + } + else { + if (this.fade <= 50) { + return; + } + if (this.fade != 160) { + this.fade -= 10; + } + } + if (!this.hovered) { + this.fade2 = 200; + } + else { + if (this.fade2 <= 30) { + return; + } + if (this.fade2 != 200) { + this.fade2 += 10; + } + } + final float b = (float)(this.hovered ? new Color(0, 0, 255, 255).getRGB() : new Color(0, 0, 255, 255).getRGB()); + final Color a = new Color(0, 0, 5, 100); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 5; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + //this.drawRoundedRect(this.xPosition - 1, this.yPosition - 1, this.width + 2, this.height + 2, 3, a2); + //this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a3); + this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a); + if(hovered) { + GlStateManager.color(0.0f, 0.8f, 0.9f); + } else { + GlStateManager.color(1.0f, 0.0f, 0.0f); + } + + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/logo.png")); + //Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/Microsoft.png")); + //Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + FontUtil.normal.drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 5) / 2, j); + } + } + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } +} diff --git a/src/minecraft/animeware/gui/mainmenu/QuitButton.java b/src/minecraft/animeware/gui/mainmenu/QuitButton.java new file mode 100644 index 0000000..8e2c03e --- /dev/null +++ b/src/minecraft/animeware/gui/mainmenu/QuitButton.java @@ -0,0 +1,140 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.gui.mainmenu; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.Tessellator; +import org.lwjgl.opengl.GL11; + +import animeware.util.font.FontUtil; +import animeware.util.render.RoundedUtils; + +import java.io.File; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; +import net.minecraft.client.renderer.GlStateManager; +import java.awt.Color; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; + +public class QuitButton extends GuiButton +{ + private int j6; + private int j10; + int fade; + int red; + int fade2; + + + public QuitButton(final int i, final int j, final int k, final String s) { + this(i, j, k, 21, 21, s); + + } + + public QuitButton(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + int j = -1; + if (this.hovered) { + j = new Color(0,210,220,0).getRGB(); + } + + final float b = (float)(this.hovered ? new Color(0, 0, 255, 255).getRGB() : new Color(0, 0, 255, 255).getRGB()); + final Color c = new Color(0, 0, 5, 70); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(0 , 0, 0, this.fade); + float f = this.hovered ? new Color(153, 9, 193).getRGB() : new Color(255,255,255,255).getRGB(); + Color a = new Color(this.fade,0,0, 70); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 5; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + + if(!hovered) { + this.fade = 2; + } + else { + if(this.fade <= 1) { + return; + } + if(this.fade != 130) { + this.fade += 5; + } + } + if(this.fade >= 120 && hovered) { + this.fade = 120; + } + + //this.drawRoundedRect(this.xPosition - 1, this.yPosition - 1, this.width + 2, this.height + 2, 3, a2); + //this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a3); + this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a); + RoundedUtils.drawRoundedOutline(this.xPosition, this.yPosition, this.xPosition + 21, this.yPosition + 21, 8.0F, 2, new Color(0, 0, 0, 255).getRGB()); //this.width / 2 - 94, this.height / 2 + 5, this.width / 2 + 116, this.height / 2 + 85, 18.0F, 2, new Color(0, 140, 170, 255).getRGB() + if(hovered) { + GlStateManager.color(0.0f, 0.8f, 0.9f); + }else { + GlStateManager.color(1.0f, 1.0f, 1.0f); + } + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/logo.png")); + //Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/quit.png")); + Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + + FontUtil.normal.drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 5) / 2, j); + } + } + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } +} diff --git a/src/minecraft/animeware/gui/mainmenu/SettingsButton.java b/src/minecraft/animeware/gui/mainmenu/SettingsButton.java new file mode 100644 index 0000000..5a4d249 --- /dev/null +++ b/src/minecraft/animeware/gui/mainmenu/SettingsButton.java @@ -0,0 +1,135 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.gui.mainmenu; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.Tessellator; +import org.lwjgl.opengl.GL11; + +import animeware.util.font.FontUtil; +import animeware.util.render.RoundedUtils; + +import java.io.File; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; +import net.minecraft.client.renderer.GlStateManager; +import java.awt.Color; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; + +public class SettingsButton extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + + + public SettingsButton(final int i, final int j, final int k, final String s) { + this(i, j, k, 21, 21, s); + + } + + public SettingsButton(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + int j = -1; + if (this.hovered) { + j = new Color(0,210,220,0).getRGB(); + } + + final float b = (float)(this.hovered ? new Color(0, 0, 255, 255).getRGB() : new Color(0, 0, 255, 255).getRGB()); + final Color c = new Color(0, 0, 5, 70); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + float f = this.hovered ? new Color(153, 9, 193).getRGB() : new Color(255,255,255,255).getRGB(); + Color a = new Color(0,0,0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 5; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + if(!hovered) { + this.fade = 90; + } + else { + if(this.fade <= 30) { + return; + } + if(this.fade != 130) { + this.fade += 5; + } + } + //this.drawRoundedRect(this.xPosition - 1, this.yPosition - 1, this.width + 2, this.height + 2, 3, a2); + //this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a3); + this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a); + RoundedUtils.drawRoundedOutline(this.xPosition, this.yPosition, this.xPosition + 21, this.yPosition + 21, 8.0F, 2, new Color(0, 0, 0, 255).getRGB()); //this.width / 2 - 94, this.height / 2 + 5, this.width / 2 + 116, this.height / 2 + 85, 18.0F, 2, new Color(0, 140, 170, 255).getRGB() + if(hovered) { + GlStateManager.color(0.0f, 0.8f, 0.9f); + }else { + GlStateManager.color(1.0f, 1.0f, 1.0f); + } + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/logo.png")); + //Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/settings.png")); + Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + + FontUtil.normal.drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 5) / 2, j); + } + } + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } +} diff --git a/src/minecraft/animeware/gui/splash/SplashProgress.java b/src/minecraft/animeware/gui/splash/SplashProgress.java new file mode 100644 index 0000000..a0106ed --- /dev/null +++ b/src/minecraft/animeware/gui/splash/SplashProgress.java @@ -0,0 +1,161 @@ +package animeware.gui.splash; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.util.font.ucfont.UCFontRenderer; +import animeware.util.render.DrawUtil; +import animeware.util.render.RoundedUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.util.ResourceLocation; + +public class SplashProgress { + + private static final int MAX = 8; + private static int PROGRESS = 0; + private static String CURRENT = ""; + private static ResourceLocation splash; + private static ResourceLocation logo; + private static UnicodeFontRenderer ufr; + static UCFontRenderer fr = new UCFontRenderer(new ResourceLocation("Animeware/font/font.ttf"), 23.0f); + static UCFontRenderer frn = new UCFontRenderer(new ResourceLocation("Animeware/font/font.ttf"), 26.0f); + + + public static void update() { + if(Minecraft.getMinecraft() == null || Minecraft.getMinecraft().getLanguageManager() == null) { + return; + } + drawSplash(Minecraft.getMinecraft().getTextureManager()); + } + + public static void setProgress(int givenProgress, String givenText) { + PROGRESS = givenProgress; + CURRENT = givenText; + update(); + } + + public static void drawSplash(TextureManager tm) { + + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + int scaleFactor = scaledResolution.getScaleFactor(); + + Framebuffer framebuffer = new Framebuffer(scaledResolution.getScaledWidth() * scaleFactor, scaledResolution.getScaledHeight() * scaleFactor, true); + framebuffer.bindFramebuffer(false); + + GlStateManager.matrixMode(GL11.GL_PROJECTION); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, (double)scaledResolution.getScaledWidth(), (double)scaledResolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(GL11.GL_MODELVIEW); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + GlStateManager.disableDepth(); + GlStateManager.enableTexture2D(); + + if(splash == null) { + splash = new ResourceLocation("Animeware/background/old/bg2l.png"); + } + tm.bindTexture(splash); + //DrawUtil.draw2DImage(new ResourceLocation("Animeware/logonobg.png"), GuiScreen.width / 2 - 70, GuiScreen.height / 2 - 117, 137, 135, Color.WHITE); + //FontUtil.normal.drawCenteredString(".", 213, 148, 0xFFFFFFFF); + + GlStateManager.resetColor(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + + Gui.drawScaledCustomSizeModalRect(0, 0, 0, 0, 1920, 1080, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), 1920, 1080); + drawProgress(); + framebuffer.unbindFramebuffer(); + framebuffer.framebufferRender(scaledResolution.getScaledWidth() * scaleFactor, scaledResolution.getScaledHeight() * scaleFactor); + + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + + Minecraft.getMinecraft().updateDisplay(); + } + + private static void drawProgress() { + + if(Minecraft.getMinecraft().gameSettings == null || Minecraft.getMinecraft().getTextureManager() == null) { + return; + } + + if(ufr == null) { + ufr = UnicodeFontRenderer.getFontOnPC("Calibri", 30); + } + + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + + double nProgress = (double)PROGRESS; + double calc = (nProgress / MAX) * 150; + + //Gui.drawRect(100, sr.getScaledHeight() - 35, sr.getScaledWidth(), sr.getScaledHeight(), new Color(0, 0, 0, 50).getRGB()); + + GlStateManager.resetColor(); + resetTextureState(); + String step = PROGRESS + "/" + MAX; + frn.drawCenteredString("NightSky", 310, 220, 0xFFFFFFFF); + fr.drawCenteredString(CURRENT, 310, 265, 0xFFFFFFFF); + //FontUtil.normal.drawCenteredString(".", 213, 148, 0xFFFFFFFF); + + + //ufr.drawString(step, sr.getScaledWidth() - 208 - ufr.getStringWidth(step), sr.getScaledHeight() - 80, 0xe1e1e1FF); + + GlStateManager.resetColor(); + resetTextureState(); + //DrawUtil.draw2DImage(new ResourceLocation("Animeware/nightskytext.png"), 800 / 2 - 145, 600 / 2 - 75, 320, 100, Color.WHITE); + //DrawUtil.draw2DImage(new ResourceLocation("Animeware/nightskywhite.png"), sr.getScaledWidth(), sr.getScaledHeight(), 10, 10, Color.WHITE); + //Gui.drawRect(0, sr.getScaledHeight() - 2, (int)calc, sr.getScaledHeight(), new Color(0, 0, 144).getRGB()); + //drawRoundedRect(0, sr.getScaledHeight() - 2, (int)calc, sr.getScaledHeight(), PROGRESS, PROGRESS, null); + + DrawUtil.drawRoundedRect(200, 245, 150 + 280, sr.getScaledHeight() - 97, 10, new Color(0, 0, 0, 255).getRGB()); + + DrawUtil.drawRoundedRect(200, 245, (int)calc + 280, sr.getScaledHeight() - 97, 10, new Color(0, 200, 240, 255).getRGB()); + + RoundedUtils.drawRoundedOutline(200, 245, 150 + 280, sr.getScaledHeight() - 97, 10, 3, new Color(0, 0, 0, 255).getRGB()); + + //Gui.drawRect(0, sr.getScaledHeight() - 2, sr.getScaledWidth(), sr.getScaledHeight(), new Color(0, 0, 0, 10).getRGB()); + + } + + private static void resetTextureState() { + GlStateManager.textureState[GlStateManager.activeTextureUnit]. textureName = -1; + } + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + +} diff --git a/src/minecraft/animeware/gui/splash/UiSplashScreen.java b/src/minecraft/animeware/gui/splash/UiSplashScreen.java new file mode 100644 index 0000000..de20e5e --- /dev/null +++ b/src/minecraft/animeware/gui/splash/UiSplashScreen.java @@ -0,0 +1,76 @@ +package animeware.gui.splash; + +import java.awt.Color; + +import animeware.NightSky; +import animeware.util.ClientPanorama; +import animeware.util.render.GuiUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.util.ResourceLocation; + +public class UiSplashScreen { + + private static final int MAX_STEPS = 5; + private static int currentStep = 0; + private static String currentText = ""; + + private static Minecraft mc = Minecraft.getMinecraft(); + + public static void update(String text) { + ++currentStep; + currentText = text; + renderSplashScreen(); + } + + public static void renderSplashScreen() { + ScaledResolution res = new ScaledResolution(mc); + int i = res.getScaleFactor(); + Framebuffer framebuffer = new Framebuffer(res.getScaledWidth() * i, res.getScaledHeight() * i, true); + framebuffer.bindFramebuffer(false); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, (double)res.getScaledWidth(), (double)res.getScaledHeight(), 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + GlStateManager.disableDepth(); + GlStateManager.enableTexture2D(); + GlStateManager.color(1.0F, 1.0F, 1.0F); + + drawScreen(res); + + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + framebuffer.unbindFramebuffer(); + framebuffer.framebufferRender(res.getScaledWidth() * i, res.getScaledHeight() * i); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + + mc.updateDisplay(); + } + + public static void drawScreen(ScaledResolution res) { + mc.getTextureManager().bindTexture(ClientPanorama.getBackground()); + Gui.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, res.getScaledWidth(), res.getScaledHeight(), res.getScaledWidth(), res.getScaledHeight()); + + mc.getTextureManager().bindTexture(new ResourceLocation("lux/logo.png")); + Gui.drawModalRectWithCustomSizedTexture(res.getScaledWidth() / 2 - 26, res.getScaledHeight() / 2 - 60, 0, 0, 52, 52, 52, 52); + mc.fontRendererObj.drawString(NightSky.mcname, res.getScaledWidth() / 2, res.getScaledHeight() / 2 - 8, -1); + + GuiUtils.drawRoundedRect(res.getScaledWidth() / 2 - 90, res.getScaledHeight() / 2 + 20, 180, 10, 3, new Color(255, 255, 255, 30).getRGB()); + + double progressWidth = ((double) currentStep / MAX_STEPS) * 180; + if(progressWidth != 0) + GuiUtils.drawRoundedRect(res.getScaledWidth() / 2 - 90, res.getScaledHeight() / 2 + 19, (int) progressWidth, 12, 3, -1); + + GuiUtils.drawRoundedOutline(res.getScaledWidth() / 2 - 90, res.getScaledHeight() / 2 + 20, res.getScaledWidth() / 2 + 90, res.getScaledHeight() / 2 + 30, 4, res.getScaleFactor(), new Color(255, 255, 255, 150).getRGB()); + mc.fontRendererObj.drawString(currentText.toUpperCase(), res.getScaledWidth() / 2, res.getScaledHeight() / 2 + 32, new Color(255, 255, 255, 150).getRGB()); + } + +} diff --git a/src/minecraft/animeware/gui/splash/UnicodeFontRenderer.java b/src/minecraft/animeware/gui/splash/UnicodeFontRenderer.java new file mode 100644 index 0000000..07a51f3 --- /dev/null +++ b/src/minecraft/animeware/gui/splash/UnicodeFontRenderer.java @@ -0,0 +1,386 @@ +package animeware.gui.splash; + +import java.awt.Font; +import java.awt.FontFormatException; +import java.awt.GraphicsEnvironment; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import org.lwjgl.opengl.GL11; +import org.newdawn.slick.UnicodeFont; +import org.newdawn.slick.font.effects.ColorEffect; + +import animeware.NightSky; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.StringUtils; + + +public class UnicodeFontRenderer { + + public static UnicodeFontRenderer getFontOnPC(String name, int size) { + return getFontOnPC(name, size, Font.PLAIN); + } + + public static UnicodeFontRenderer getFontOnPC(String name, int size, int fontType) { + return getFontOnPC(name, size, fontType, 0); + } + + public static UnicodeFontRenderer getFontOnPC(String name, int size, int fontType, float kerning) { + return getFontOnPC(name, size, fontType, kerning, 3.0f); + } + + public static UnicodeFontRenderer getFontOnPC(String name, int size, int fontType, float kerning, float antiAliasingFactor) { + return new UnicodeFontRenderer(new Font(name, fontType, size), kerning, antiAliasingFactor); + } + + public static UnicodeFontRenderer getFontFromAssets(String name, int size) { + return getFontOnPC(name, size, Font.PLAIN); + } + + public static UnicodeFontRenderer getFontFromAssets(String name, int size, int fontType) { + return getFontOnPC(name, fontType, size, 0); + } + + public static UnicodeFontRenderer getFontFromAssets(String name, int size, float kerning, int fontType) { + return getFontFromAssets(name, size, fontType, kerning, 3.0f); + } + + public static UnicodeFontRenderer getFontFromAssets(String name, int size, int fontType, float kerning, float antiAliasingFactor) { + return new UnicodeFontRenderer(name, fontType, size, kerning, antiAliasingFactor); + } + + + /*-------------------------------------------------------------------------------------------------------------------*/ + + public final int FONT_HEIGHT = 9; + private final int[] colorCodes = new int[32]; + private final float kerning; + private final Map cachedStringWidth = new HashMap<>(); + private float antiAliasingFactor; + private UnicodeFont unicodeFont; + + private UnicodeFontRenderer(String fontName, int fontType, float fontSize, float kerning, float antiAliasingFactor) { + this.antiAliasingFactor = antiAliasingFactor; + try { + this.unicodeFont = new UnicodeFont(getFontByName(fontName).deriveFont(fontSize * this.antiAliasingFactor)); + } catch (FontFormatException | IOException e) { + e.printStackTrace(); + } + this.kerning = kerning; + + this.unicodeFont.addAsciiGlyphs(); + this.unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.WHITE)); + + try { + this.unicodeFont.loadGlyphs(); + } catch (Exception e) { + e.printStackTrace(); + } + + for (int i = 0; i < 32; i++) { + int shadow = (i >> 3 & 1) * 85; + int red = (i >> 2 & 1) * 170 + shadow; + int green = (i >> 1 & 1) * 170 + shadow; + int blue = (i & 1) * 170 + shadow; + + if (i == 6) { + red += 85; + } + + if (i >= 16) { + red /= 4; + green /= 4; + blue /= 4; + } + + this.colorCodes[i] = (red & 255) << 16 | (green & 255) << 8 | blue & 255; + } + } + + private UnicodeFontRenderer(Font font, float kerning, float antiAliasingFactor) { + this.antiAliasingFactor = antiAliasingFactor; + this.unicodeFont = new UnicodeFont(new Font(font.getName(), font.getStyle(), (int) (font.getSize() * antiAliasingFactor))); + this.kerning = kerning; + + this.unicodeFont.addAsciiGlyphs(); + this.unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.WHITE)); + + try { + this.unicodeFont.loadGlyphs(); + } catch (Exception e) { + e.printStackTrace(); + } + + for (int i = 0; i < 32; i++) { + int shadow = (i >> 3 & 1) * 85; + int red = (i >> 2 & 1) * 170 + shadow; + int green = (i >> 1 & 1) * 170 + shadow; + int blue = (i & 1) * 170 + shadow; + + if (i == 6) { + red += 85; + } + + if (i >= 16) { + red /= 4; + green /= 4; + blue /= 4; + } + + this.colorCodes[i] = (red & 255) << 16 | (green & 255) << 8 | blue & 255; + } + } + + private Font getFontByName(String name) throws IOException, FontFormatException { + return getFontFromInput("/assets/minecraft/clientname/fonts/" + name + ".ttf"); + } + + private Font getFontFromInput(String path) throws IOException, FontFormatException { + return Font.createFont(Font.TRUETYPE_FONT, NightSky.class.getResourceAsStream(path)); + } + + public void drawStringScaled(String text, int givenX, int givenY, int color, double givenScale) { + + GL11.glPushMatrix(); + GL11.glTranslated(givenX, givenY, 0); + GL11.glScaled(givenScale, givenScale, givenScale); + drawString(text, 0, 0, color); + GL11.glPopMatrix(); + + } + + public int drawString(String text, float x, float y, int color) { + if (text == null) + return 0; + + x *= 2.0F; + y *= 2.0F; + + float originalX = x; + + GL11.glPushMatrix(); + GlStateManager.scale(1 / antiAliasingFactor, 1 / antiAliasingFactor, 1 / antiAliasingFactor); + GL11.glScaled(0.5F, 0.5F, 0.5F); + x *= antiAliasingFactor; + y *= antiAliasingFactor; + float red = (float) (color >> 16 & 255) / 255.0F; + float green = (float) (color >> 8 & 255) / 255.0F; + float blue = (float) (color & 255) / 255.0F; + float alpha = (float) (color >> 24 & 255) / 255.0F; + GlStateManager.color(red, green, blue, alpha); + + boolean blend = GL11.glIsEnabled(GL11.GL_BLEND); + boolean lighting = GL11.glIsEnabled(GL11.GL_LIGHTING); + boolean texture = GL11.glIsEnabled(GL11.GL_TEXTURE_2D); + if (!blend) + GL11.glEnable(GL11.GL_BLEND); + if (lighting) + GL11.glDisable(GL11.GL_LIGHTING); + if (texture) + GL11.glDisable(GL11.GL_TEXTURE_2D); + + int currentColor = color; + char[] characters = text.toCharArray(); + + int index = 0; + for (char c : characters) { + if (c == '\r') { + x = originalX; + } + if (c == '\n') { + y += getHeight(Character.toString(c)) * 2.0F; + } + if (c != '\247' && (index == 0 || index == characters.length - 1 || characters[index - 1] != '\247')) { + //Line causing error + unicodeFont.drawString(x, y, Character.toString(c), new org.newdawn.slick.Color(currentColor)); + x += (getWidth(Character.toString(c)) * 2.0F * antiAliasingFactor); + } else if (c == ' ') { + x += unicodeFont.getSpaceWidth(); + } else if (c == '\247' && index != characters.length - 1) { + int codeIndex = "0123456789abcdefg".indexOf(text.charAt(index + 1)); + if (codeIndex < 0) continue; + + currentColor = this.colorCodes[codeIndex]; + } + + index++; + } + + GL11.glScaled(2.0F, 2.0F, 2.0F); + if (texture) + GL11.glEnable(GL11.GL_TEXTURE_2D); + if (lighting) + GL11.glEnable(GL11.GL_LIGHTING); + if (!blend) + GL11.glDisable(GL11.GL_BLEND); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + return (int) x / 2; + } + + public int drawStringWithShadow(String text, float x, float y, int color) { + drawString(StringUtils.stripControlCodes(text), x + 0.5F, y + 0.5F, 0x000000); + return drawString(text, x, y, color); + } + + public void drawCenteredString(String text, float x, float y, int color) { + drawString(text, x - (int) getWidth(text) / 2, y, color); + } + + public void drawCenteredTextScaled(String text, int givenX, int givenY, int color, double givenScale) { + + GL11.glPushMatrix(); + GL11.glTranslated(givenX, givenY, 0); + GL11.glScaled(givenScale, givenScale, givenScale); + drawCenteredString(text, 0, 0, color); + GL11.glPopMatrix(); + + } + + public void drawCenteredStringWithShadow(String text, float x, float y, int color) { + drawCenteredString(StringUtils.stripControlCodes(text), x + 0.5F, y + 0.5F, color); + drawCenteredString(text, x, y, color); + } + + public float getWidth(final String s) { + if (cachedStringWidth.size() > 1000) + cachedStringWidth.clear(); + return cachedStringWidth.computeIfAbsent(s, new Function() { + @Override + public Float apply(String e) { + float width = 0.0F; + String str = StringUtils.stripControlCodes(s); + for (char c : str.toCharArray()) { + width += unicodeFont.getWidth(Character.toString(c)) + UnicodeFontRenderer.this.kerning; + } + + return width / 2.0F / antiAliasingFactor; + } + }); + + } + + public int getStringWidth(String text) { + if (text == null) { + return 0; + } else { + int i = 0; + boolean flag = false; + + for (int j = 0; j < text.length(); ++j) { + char c0 = text.charAt(j); + float k = this.getWidth(String.valueOf(c0)); + + if (k < 0 && j < text.length() - 1) { + ++j; + c0 = text.charAt(j); + + if (c0 != 'l' && c0 != 'L') { + if (c0 == 'r' || c0 == 'R') { + flag = false; + } + } else { + flag = true; + } + + k = 0; + } + + i += k; + + if (flag && k > 0) { + ++i; + } + } + + return i; + } + } + + public float getCharWidth(char c) { + return unicodeFont.getWidth(String.valueOf(c)); + } + + public float getHeight(String s) { + return unicodeFont.getHeight(s) / 2.0F; + } + + public UnicodeFont getFont() { + return this.unicodeFont; + } + + public String trimStringToWidth(String par1Str, int par2) { + StringBuilder var4 = new StringBuilder(); + float var5 = 0.0F; + int var6 = 0; + int var7 = 1; + boolean var8 = false; + boolean var9 = false; + + for (int var10 = var6; var10 >= 0 && var10 < par1Str.length() && var5 < (float) par2; var10 += var7) { + char var11 = par1Str.charAt(var10); + float var12 = this.getCharWidth(var11); + + if (var8) { + var8 = false; + + if (var11 != 108 && var11 != 76) { + if (var11 == 114 || var11 == 82) { + var9 = false; + } + } else { + var9 = true; + } + } else if (var12 < 0.0F) { + var8 = true; + } else { + var5 += var12; + + if (var9) { + ++var5; + } + } + + if (var5 > (float) par2) { + break; + } else { + var4.append(var11); + } + } + + return var4.toString(); + } + + public void drawSplitString(ArrayList lines, int x, int y, int color) { + drawString( + String.join("\n\r", lines), + x, + y, + color + ); + } + + public List splitString(String text, int wrapWidth) { + List lines = new ArrayList<>(); + + String[] splitText = text.split(" "); + StringBuilder currentString = new StringBuilder(); + + for (String word : splitText) { + String potential = currentString + " " + word; + + if (getWidth(potential) >= wrapWidth) { + lines.add(currentString.toString()); + currentString = new StringBuilder(); + } + currentString.append(word).append(" "); + } + lines.add(currentString.toString()); + return lines; + } + +} diff --git a/src/minecraft/animeware/hud/Category.java b/src/minecraft/animeware/hud/Category.java new file mode 100644 index 0000000..96199f6 --- /dev/null +++ b/src/minecraft/animeware/hud/Category.java @@ -0,0 +1,19 @@ +package animeware.hud; + +public enum Category { + + HUD("HUD", 130), + MISC("Misc", 130*2), + WORLD("World", 130 * 3), + PLAYER("Player", 130 * 4), + /*COSMETIC("Cosmetic", 200 * 4)*/; + + + public String name; + public int pos; + Category(String name, int pos) { + this.name = name; + this.pos = pos; + } + +} diff --git a/src/minecraft/animeware/hud/DraggableComponent.java b/src/minecraft/animeware/hud/DraggableComponent.java new file mode 100644 index 0000000..d2bba29 --- /dev/null +++ b/src/minecraft/animeware/hud/DraggableComponent.java @@ -0,0 +1,83 @@ +package animeware.hud; + + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import org.lwjgl.input.Mouse; + +public class DraggableComponent { + + private int x; + private int y; + private int width; + private int height; + private int color; + private int lastX; + private int lastY; + + private boolean dragging; + + public DraggableComponent(int x, int y, int width, int height, int color){ + this.width = width; + this.height = height; + this.x = x; + this.y = y; + this.color = color; + } + + public int getxPosition() { + return x; + } + + public int getyPosition() { + return y; + } + + public void setxPosition(int x) { + this.x = x; + } + + public void setyPosition(int y) { + this.y = y; + } + + public int getHeight() { + return height; + } + + public int getWidth() { + return width; + } + + public int getColor() { + return color; + } + + public void setColor(int color) { + this.color = color; + } + + public void draw(int mouseX, int mouseY){ + draggingFix(mouseX, mouseY); + Gui.drawRect(this.getxPosition(), this.getyPosition(), this.getxPosition()+this.getWidth(), this.getyPosition()+this.getHeight(), this.getColor()); + boolean mouseOverX = (mouseX >= this.getxPosition() && mouseX <= this.getxPosition()+this.getWidth()); + boolean mouseOverY = (mouseY >= this.getyPosition() && mouseY <= this.getyPosition()+this.getHeight()); + if(mouseOverX && mouseOverY){ + if(Mouse.isButtonDown(0)){ + if (!this.dragging) { + this.lastX = x - mouseX; + this.lastY = y - mouseY; + this.dragging = true; + } + } + } + } + + private void draggingFix(int mouseX, int mouseY) { + if (this.dragging) { + this.x = mouseX + this.lastX; + this.y = mouseY + this.lastY; + if(!Mouse.isButtonDown(0)) this.dragging = false; + } + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/hud/HUDConfigScreen.java b/src/minecraft/animeware/hud/HUDConfigScreen.java new file mode 100644 index 0000000..efa9d94 --- /dev/null +++ b/src/minecraft/animeware/hud/HUDConfigScreen.java @@ -0,0 +1,97 @@ +package animeware.hud; + +import java.awt.Color; +import java.io.IOException; + +import animeware.NightSky; +import animeware.gui.clickgui.ClickGUI; +import animeware.gui.mainmenu.ClassicButton; +import animeware.hud.mod.HudMod; +import animeware.util.render.DrawUtil; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.ResourceLocation; + +public class HUDConfigScreen extends GuiScreen { + + private HudMod m; + boolean hovered; + + @Override + public void initGui() { + super.initGui(); + mc.entityRenderer.loadShader(new ResourceLocation("Animeware/blur.json")); + //Minecraft.getMinecraft().entityhudMod..loadShader(new ResourceLocation("shaders/post/blur.json")); + this.buttonList.add(new ClassicButton(69, this.width / 2 - 50, this.height / 2 - 10, 100, 20, "Open GUI")); + //this.buttonList.add(new ClassicButton(70, this.width / 2 - 50, this.height / 2 + 12, 100, 20, "Jus test")); + //this.buttonList.add(new ClassicButton(71, this.width / 2 - 50, this.height / 2 + 32, 100, 20, "Open Cosmetics")); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + //this.drawHollowRect(m.getX(), m.getY(), m.getWidth(), m.getHeight(), -1); + //HudMod m = new HudMod(m.name, m.description, m.icon, m.getX(), m.getY()); + //super.drawDefaultBackground(); + //this.drawHollowRect(m.getX(), m.getY(), m.getWidth(), m.getHeight(), -1); + //Gui.drawRect(m.getY(), partialTicks, m.getX(), partialTicks, mouseY); + //mc.getTextureManager().bindTexture(new ResourceLocation ("Animeware/nightskywhite.png")); + //this.drawModalRectWithCustomSizedTexture(355, 70, 0, 0, 250, 250, 250, 250); + + //DrawUtil.draw2DImage(new ResourceLocation("Animeware/nightskywhite.png"), this.width / 2 - 35, this.height / 2 - 90, 70, 70, Color.WHITE); + DrawUtil.draw2DImage(new ResourceLocation("Animeware/logonobg.png"), this.width / 2 - 59, this.height / 2 - 117, 117, 115, Color.WHITE); + + for(HudMod m : NightSky.INSTANCE.hudManager.hudMods) { + if(m.isEnabled()) { + m.renderDummy(mouseX, mouseY); + if(m.getWidth() == 0|| m.getHeight() == 0) { + + } else { + this.drawHollowRect(m.getX(), m.getY(), m.getWidth(), m.getHeight(), -1); + } + } + } + + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + + + @Override + protected void actionPerformed(GuiButton button) throws IOException { + super.actionPerformed(button); + switch(button.id) { + case 69: + mc.displayGuiScreen(new ClickGUI()); + break; + + /*case 71: //VYRIESIT!!!!! + mc.displayGuiScreen(new CosmeticGUI()); + break;*/ + } + } + public void drawHollowRect(int x, int y, int w, int h, int color) { + + this.drawHorizontalLine(x, x + w, y, color); + this.drawHorizontalLine(x, x + w, y + h, color); + + this.drawVerticalLine(x, y + h, y, color); + this.drawVerticalLine(x + w, y + h, y, color); + + } + public static void drawOutlinedRect(int left, int top, int right, int bottom, int rectColor, int outlineColor) { + Gui gui = new Gui(); + gui.drawRect(left + 1, top, right - 1, bottom, rectColor); + gui.drawHorizontalLine(left, right - 1, top, outlineColor); + gui.drawHorizontalLine(left, right - 1, bottom, outlineColor); + gui.drawVerticalLine(left, top, bottom, outlineColor); + gui.drawVerticalLine(right - 1, top, bottom, outlineColor); + } + @Override + public void onGuiClosed() { + super.onGuiClosed(); + mc.entityRenderer.stopUseShader(); + } + +} diff --git a/src/minecraft/animeware/hud/IRenderer.java b/src/minecraft/animeware/hud/IRenderer.java new file mode 100644 index 0000000..b32f58a --- /dev/null +++ b/src/minecraft/animeware/hud/IRenderer.java @@ -0,0 +1,46 @@ +package animeware.hud; + +import animeware.hud.mod.IConfigExchange; + +public interface IRenderer extends IConfigExchange{ + + /** + * Returns the height of the currently rendered HUD. + * + * @return The height in pixel. + */ + int getHeight(); + public default boolean isEnabled() { + return true; + } + + /** + * Returns the width of the currently rendered HUD. + * + * @return The width in pixel. + */ + int getWidth(); + + /** + * Render the HUD at the given position. + */ + void render(ScreenPosition position); + + + /** + * Render the HUD at the given position, + * used to for the configuration screen + * where you can move it around. + */ + void renderDummy(ScreenPosition position); + + /** + * Can be used to disable the renderer + * more conveniently than unregistering + * it from the API. + */ + /*public default boolean isEnabled() { + return true; + }*/ + +} diff --git a/src/minecraft/animeware/hud/ScreenPosition.java b/src/minecraft/animeware/hud/ScreenPosition.java new file mode 100644 index 0000000..6a4cb42 --- /dev/null +++ b/src/minecraft/animeware/hud/ScreenPosition.java @@ -0,0 +1,100 @@ +package animeware.hud; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; + +public final class ScreenPosition{ + + private static final Minecraft mc = Minecraft.getMinecraft(); + + private double x, y; + + private ScreenPosition(double x, double y){ + setRelative(x, y); + } + + private ScreenPosition(int x, int y){ + setAbsolute(x, y); + } + + /** + * Creates a new ScreenPosition object based on relative coordinates. + * From 0 to 1. Example: 0.3 being 30% of the screen size. + * + * @param x Relative screen x value (horizontal) of the position. + * @param y Relative screen y value (vertical) of the position. + * @return The created ScreenPosition object. + */ + public static ScreenPosition fromRelativePosition(double x, double y){ + return new ScreenPosition(x, y); + } + + /** + * Creates a new ScreenPosition object based on absolute coordinates. + * Example: 300 being 300 pixels. + * + * @param x Absolute screen x value (horizontal) of the position. + * @param y Absolute screen y value (vertical) of the position. + * @return The created ScreenPosition object. + */ + public static ScreenPosition fromAbsolutePosition(int x, int y){ + return new ScreenPosition(x, y); + } + + + /** + * @return The absolute x coordinate in pixel. + */ + public int getAbsoluteX(){ + ScaledResolution res = new ScaledResolution(mc); + return (int)(x * res.getScaledWidth()); + } + + /** + * @return The absolute y coordinate in pixel. + */ + public int getAbsoluteY(){ + ScaledResolution res = new ScaledResolution(mc); + return (int)(y * res.getScaledHeight()); + } + + /** + * @return The relative x coordinate, ranging from 0 to 1. + */ + public double getRelativeX(){ + return x; + } + + /** + * @return The relative y coordinate, ranging from 0 to 1. + */ + public double getRelativeY(){ + return y; + } + + /** + * @param x The relative x coordinate to be set. Ranging from 0 to 1. + * @param y The relative y coordinate to be set. Ranging from 0 to 1. + */ + public void setRelative(double x, double y){ + this.x = x; + this.y = y; + } + + /** + * @param x The absolute x coordinate to be set. + * @param y The absolute y coordinate to be set. + */ + public void setAbsolute(int x, int y){ + ScaledResolution res = new ScaledResolution(mc); + this.x = (double)x / res.getScaledWidth(); + this.y = (double)y / res.getScaledHeight(); + } + + @Override + public String toString(){ + return String.format(getClass().getSimpleName() + "[absoluteX=%d,absoluteY=%d,relativeX=%.1f,relativeY=%.1f]", this.getAbsoluteX(), this.getAbsoluteY(), this.getRelativeX(), this.getRelativeY()); + } + +} + diff --git a/src/minecraft/animeware/hud/mod/Freelook.java b/src/minecraft/animeware/hud/mod/Freelook.java new file mode 100644 index 0000000..22e393e --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Freelook.java @@ -0,0 +1,132 @@ +package animeware.hud.mod; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.Display; + +import animeware.cosmetic.Booleans; +import animeware.event.impl.KeyEvent; +import animeware.hud.Category; +import animeware.hud.ScreenPosition; +import net.minecraft.util.ResourceLocation; + +public class Freelook extends HudMod { + + public Freelook() { + super("Freelook", "Toggles perspective", new ResourceLocation("Animeware/icons/direction.png"), 0, 0); + // TODO Auto-generated constructor stub + } + @Override + public void onEnable() { + Booleans.freelook = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.freelook = false; + //super.onDisable(); + } + private boolean returnOnRelease = true; + public static boolean freelooking = false; + + public float cameraYaw = 0f; + public float cameraPitch = 0f; + public int previousF5 = 0; + + /*//@EventTarget + public void onKey(KeyEvent e) { + + if(e.getKey() == mc.gameSettings.FREELOOK.getKeyCode() && this.isEnabled) { + if (Keyboard.getEventKeyState()) + { + System.out.println("frelloked"); + freelooking = !freelooking; + cameraYaw = mc.thePlayer.rotationYaw; + cameraPitch = mc.thePlayer.rotationPitch; + + if (freelooking) + { + previousF5 = mc.gameSettings.thirdPersonView; + mc.gameSettings.thirdPersonView = 1; + } + else + { + mc.gameSettings.thirdPersonView = previousF5; + } + } + else if (returnOnRelease) + { + freelooking = false; + mc.gameSettings.thirdPersonView = previousF5; + } + } + + if (Keyboard.getEventKey() == mc.gameSettings.keyBindTogglePerspective.getKeyCode()) + { + freelooking = false; + } + + } + + */ + + public boolean overrideMouse() + { + if (mc.inGameHasFocus && Display.isActive()) + { + if (!freelooking) + { + return true; + } + + // CODE + mc.mouseHelper.mouseXYChange(); + float f1 = mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; + float f2 = f1 * f1 * f1 * 8.0F; + float f3 = (float) mc.mouseHelper.deltaX * f2; + float f4 = (float) mc.mouseHelper.deltaY * f2; + + cameraYaw += f3 * 0.15F; + cameraPitch += f4 * 0.15F; + + if (cameraPitch > 90) cameraPitch = 90; + if (cameraPitch < -90) cameraPitch = -90; + } + + return false; + } + public float getCameraYaw() + { + return freelooking ? cameraYaw : mc.thePlayer.rotationYaw; + } + + public float getCameraPitch() + { + return freelooking ? cameraPitch : mc.thePlayer.rotationPitch; + } + + /* + @Override + public int getWidth() { + return fr.getStringWidth("[Freelooking]"); + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } + + + + @Override + public void draw() { + // TODO Auto-generated method stub + + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + // TODO Auto-generated method stub + super.renderDummy(mouseX, mouseY); + }*/ + +} diff --git a/src/minecraft/animeware/hud/mod/HudManager.java b/src/minecraft/animeware/hud/mod/HudManager.java new file mode 100644 index 0000000..419d2d8 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/HudManager.java @@ -0,0 +1,334 @@ +package animeware.hud.mod; + +import java.util.ArrayList; + +import animeware.hud.mod.Mods.ArmorStatus; +import animeware.hud.mod.Mods.BPSMod; +import animeware.hud.mod.Mods.Biome; +import animeware.hud.mod.Mods.BlockOverlay; +import animeware.hud.mod.Mods.CPSMod; +import animeware.hud.mod.Mods.FPSMod; +import animeware.hud.mod.Mods.HitColor; +import animeware.hud.mod.Mods.ItemPhysics; +import animeware.hud.mod.Mods.Keystrokes; +import animeware.hud.mod.Mods.MemUsage; +import animeware.hud.mod.Mods.MinimalBobbing; +import animeware.hud.mod.Mods.Miniplayer; +import animeware.hud.mod.Mods.ModArrows; +import animeware.hud.mod.Mods.ModDirection; +import animeware.hud.mod.Mods.ModHorseStats; +import animeware.hud.mod.Mods.ModMLDGHelper; +import animeware.hud.mod.Mods.ModParticles; +import animeware.hud.mod.Mods.MoreParticles; +import animeware.hud.mod.Mods.Motionblurmodule; +import animeware.hud.mod.Mods.NotificationsModule; +import animeware.hud.mod.Mods.PackDisplay; +import animeware.hud.mod.Mods.Ping; +import animeware.hud.mod.Mods.PlayerHead; +import animeware.hud.mod.Mods.PotionStatus; +import animeware.hud.mod.Mods.ReachDisplayMod; +import animeware.hud.mod.Mods.ScrollZoom; +import animeware.hud.mod.Mods.ServerIP; +import animeware.hud.mod.Mods.SmallSword; +import animeware.hud.mod.Mods.SwordSpin; +import animeware.hud.mod.Mods.TNTTimer; +import animeware.hud.mod.Mods.TargetHUD; +import animeware.hud.mod.Mods.TimeChanger; +import animeware.hud.mod.Mods.TimeMod; +import animeware.hud.mod.Mods.ToggleSprint3; +import animeware.hud.mod.Mods.Watermark; +import animeware.hud.mod.Mods.WindowedFullscreenMod; +import animeware.hud.mod.Mods.XYZMod; +import animeware.ui.themes.AstolfoButtons; +import animeware.ui.themes.GUILight; +import animeware.ui.themes.color.ColorScheme; +import net.minecraft.client.Minecraft; + +public class HudManager { + + public ArrayList hudMods = new ArrayList<>(); + + //public ArrayList hudMods; + + //public ToggleSprint togglesprint; + public NotificationsModule notifs; + + public FPSMod fps; + + + public TargetHUD thud; + + + public Keystrokes keystrokes; + + + //public MotionBlur motionblur; + + //public Watermark watermark; + + //public ToggleSprint togglesprint; + + public CPSMod cps; + + + + public static Freelook freelook; + + //public static Animeware animeware; + + public boolean TNTTimer; + + public PotionStatus potionStat; + + + public Miniplayer lilplayer; + + public XYZMod xyz; + + + public BPSMod bps; + + + public Ping ping; + + + //public Fullbright fb; + + public Biome biome; + + + public PackDisplay pd; + + + public ServerIP sip; + + + //public AnimewareText text; + + public TimeMod time; + + + public ModArrows arrows; + + public ArmorStatus Armorstat; + + + //public DynamicFOV fov; + //public DirectionMod direction; + + public ToggleSprint3 ts; + + + public ReachDisplayMod reachDisp; + + + public ModDirection direction; + + + + public ModParticles particles; + + public ModMLDGHelper mldg; + + public PlayerHead head; + + public MemUsage mem; + + public ItemPhysics iphys; + + public BlockOverlay bo; + + + public TNTTimer tnt; + + public ScrollZoom sz; + + public MoreParticles mp; + + public SmallSword smallsword; + + public SwordSpin swordspin; + + public Watermark watermark; + + public TimeChanger timeChanger; + + + public HitColor hit; + + public ModHorseStats horseStat; + + public GUILight guiLight; + + public AstolfoButtons astolfobtn; + + public ColorScheme colorscheme; + + public Motionblurmodule mbm; + + public MinimalBobbing mBobbing; + + public WindowedFullscreenMod WindowedFullscreen; + + //public ModPusula dir2; + + //public Freelook freelook; + + //public static boolean OldAnimations; + //public DirectionMod dirMod; + + public HudManager() { + hudMods = new ArrayList<>(); + + //hudMods.add(togglesprint = new ToggleSprint()); + hudMods.add(notifs = new NotificationsModule()); + + hudMods.add(fps = new FPSMod()); + + + hudMods.add(thud = new TargetHUD()); + + + hudMods.add(keystrokes = new Keystrokes()); + + + //hudMods.add(motionblur = new MotionBlur()); + //hudMods.add(watermark = new Watermark()); + //hudMods.add(togglesprint = new ToggleSprint()); + + hudMods.add(cps = new CPSMod()); + + + //hudMods.add(tnt = new TNTTimer()); + + hudMods.add(potionStat = new PotionStatus()); + + + hudMods.add(lilplayer = new Miniplayer()); + + hudMods.add(xyz = new XYZMod()); + + + hudMods.add(bps = new BPSMod()); + + + hudMods.add(ping = new Ping()); + + + //hudMods.add(fb = new Fullbright()); + + hudMods.add(biome = new Biome()); + + + hudMods.add(pd = new PackDisplay()); + + + hudMods.add(sip = new ServerIP()); + + + hudMods.add(time = new TimeMod()); + + + hudMods.add(arrows = new ModArrows()); + + hudMods.add(Armorstat = new ArmorStatus()); + + + //hudMods.add(bfs = new BorderlessFullscreen()); + + //hudMods.add(fov = new DynamicFOV()); + + //hudMods.add(text = new AnimewareText(null, 0, 0)); + + hudMods.add(reachDisp = new ReachDisplayMod()); + + + hudMods.add(ts = new ToggleSprint3()); + + //hudMods.add(clock = new Clock()); + //hudMods.add(dirMod = new DirectionMod()); + + hudMods.add(freelook = new Freelook()); + + hudMods.add(direction = new ModDirection()); + + + hudMods.add(particles = new ModParticles()); + + hudMods.add(mldg = new ModMLDGHelper()); + + hudMods.add(head = new PlayerHead()); + + hudMods.add(mem = new MemUsage()); + + hudMods.add(iphys = new ItemPhysics()); + + hudMods.add(bo = new BlockOverlay()); + + + hudMods.add(tnt = new TNTTimer()); + + hudMods.add(sz = new ScrollZoom()); + + hudMods.add(mp = new MoreParticles()); + + hudMods.add(smallsword = new SmallSword()); + + hudMods.add(swordspin = new SwordSpin()); + + hudMods.add(watermark = new Watermark()); + + hudMods.add(timeChanger = new TimeChanger()); + + hudMods.add(mBobbing = new MinimalBobbing()); + + + hudMods.add(hit = new HitColor()); + + hudMods.add(horseStat = new ModHorseStats()); + + hudMods.add(guiLight = new GUILight()); + + hudMods.add(astolfobtn = new AstolfoButtons()); + + hudMods.add(colorscheme = new ColorScheme()); + + hudMods.add(WindowedFullscreen = new WindowedFullscreenMod()); + + + + freelook = new Freelook(); + //api.register(freelook); + + } + /*public void register(HUDManager api) { + freelook = new Freelook(); + api.register(freelook); + hudMods.add(freelook); + }*/ + public static Freelook getFreelook() { + return freelook; + } + + + + + public void renderMods() { + for(HudMod m : hudMods) { + if(m.isEnabled() && !Minecraft.getMinecraft().gameSettings.showDebugInfo) { + m.draw(); + } + } + + } + + public HudMod getModule(String name) { + for (HudMod m : hudMods) { + if (m.name.equalsIgnoreCase(name)) { + return m; + } + } + return null; + } + +} diff --git a/src/minecraft/animeware/hud/mod/HudMod.java b/src/minecraft/animeware/hud/mod/HudMod.java new file mode 100644 index 0000000..d54d822 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/HudMod.java @@ -0,0 +1,221 @@ +package animeware.hud.mod; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.common.collect.Lists; + +import animeware.NightSky; +import animeware.event.EventManager; +import animeware.hud.DraggableComponent; +import animeware.util.settings.ModeSetting; +//import animeware.util.backend.FileManager; +import animeware.util.settings.Setting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiLabel; +import net.minecraft.util.ResourceLocation; + +public class HudMod { + + public Minecraft mc = Minecraft.getMinecraft(); + public FontRenderer fr = mc.fontRendererObj; + protected List buttonList = Lists.newArrayList(); + protected List labelList = Lists.newArrayList(); + + public List settings = new ArrayList(); + + public static boolean expanded; + public int lenght = 10; + public String name; + public String description; + public ResourceLocation icon; + //public boolean isEnabled = false; + public int key; + public boolean enabled = true; + public DraggableComponent drag; + HudMod m; + + + public int index; + + public int x, y; + + public HudMod(String name, String description, ResourceLocation icon, int x, int y) { + this.name = name; + this.description = description; + this.icon = icon; + + try { + this.x = ((Integer)NightSky.INSTANCE.config.config.get(String.valueOf(name.toLowerCase()) + " x")).intValue(); + this.y = ((Integer)NightSky.INSTANCE.config.config.get(String.valueOf(name.toLowerCase()) + " y")).intValue(); + setEnabled(((Boolean)NightSky.INSTANCE.config.config.get(String.valueOf(name.toLowerCase()) + " enabled"))); + } catch (NullPointerException e) { + //e.printStackTrace(); + if(!(name == "HitColor" || name == "BlockOverlay")) { + System.out.println("ModConfig Load Failed - HudMod = " + name); + } + if(name.equals("ToggleSprint")) { + e.printStackTrace(); + } + this.x = x; + this.y = y; + this.enabled = false; + } + + + //settings = new ArrayList<>(); + drag = new DraggableComponent(this.x, this.y, getWidth(), getHeight(), new Color(0, 0, 0, 0).getRGB()); + } + + + public int getWidth() { + + return 0; + + } + + + + public String getName() { + return name; + } + public String getSetName() { + return settings.get(index).toString(); + } + + public int getHeight() { + return 0; + + } + public ResourceLocation getIcon() { + return icon; + } + + public void draw() { + + } + + public void renderDummy(int mouseX, int mouseY) { + drag.draw(mouseX, mouseY); + + } + public void setEnabledSilent(boolean enabled) { + this.enabled = enabled; + + if (enabled) + { + NightSky.INSTANCE.eventManager.register(this); + } + + if (!enabled) + { + NightSky.INSTANCE.eventManager.unregister(this); + } + } + public void setKey(int keybind) { + this.key = keybind; + } + + public int getX() { + return drag.getxPosition(); + } + + public int getY() { + return drag.getyPosition(); + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + if(enabled) { + onEnable(); + } + else { + onDisable(); + } + } + public void setDisabled(boolean enabled) { + this.enabled = !enabled; + if(!enabled) { + onDisable(); + } + else { + onEnable(); + } + } + + public void onEnable() { + EventManager.register(this); + + } + + public void toggle() { + this.setEnabled(!enabled); + + } + public void expand() { + if(expanded) { + expanded = false; + } else { + expanded = true; + } + + } + public void deexpand() { + if(expanded) { + expanded = true; + } else { + expanded = false; + } + + } + + public void addSettings(Setting... settings) { + this.settings.addAll(Arrays.asList(settings)); + } + + + public boolean isEnabled() { + return enabled; + } + public boolean isDisabled() { + return !enabled; + } + + + public void onDisable() { + NightSky.INSTANCE.eventManager.unregister(this); + + } + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + for (int i = 0; i < this.buttonList.size(); ++i) + { + ((GuiButton)this.buttonList.get(i)).drawButton(this.mc, mouseX, mouseY); + } + + for (int j = 0; j < this.labelList.size(); ++j) + { + ((GuiLabel)this.labelList.get(j)).drawLabel(this.mc, mouseX, mouseY); + } + } + //@Override + public String getToggled() { + return "Toggled"; + } + public void Notif() { + + } + + +} + + + + + + + diff --git a/src/minecraft/animeware/hud/mod/IConfigExchange.java b/src/minecraft/animeware/hud/mod/IConfigExchange.java new file mode 100644 index 0000000..0a2a21e --- /dev/null +++ b/src/minecraft/animeware/hud/mod/IConfigExchange.java @@ -0,0 +1,26 @@ +package animeware.hud.mod; + +import animeware.hud.ScreenPosition; + +public interface IConfigExchange { + + /** + * Is called for each HUD when the screen is closed. + * + * @param pos Provided by the API. The chosen position for the HUD. + * Preferably save the values in a configuration file. + */ + public abstract void save(ScreenPosition pos); + + /** + * Creates a new ScreenPosition object based on relative coordinates. + * From 0 to 1. Example: 0.3 being 30% of the screen size. + * + * @return The initial ScreenPosition position. + * This is where the HUD will be rendered when opening a screen. + * Preferably load the values from a configuration file. + * Can be null. + */ + public abstract ScreenPosition load(); + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/ArmorStatus.java b/src/minecraft/animeware/hud/mod/Mods/ArmorStatus.java new file mode 100644 index 0000000..fe74e31 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/ArmorStatus.java @@ -0,0 +1,105 @@ +package animeware.hud.mod.Mods; + +import java.text.DecimalFormat; + +import org.lwjgl.opengl.GL11; + +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class ArmorStatus extends HudMod { + + public String damagef; + private int decimals; + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma"); + + public ArmorStatus() { + super("ArmorStatus", "Status of your armor", new ResourceLocation("Animeware/icons/armorstatus.png"), 900, 140); + this.addSettings(color); + + } + + @Override + public void draw() { + + for (int i = 0; i < mc.thePlayer.inventory.armorInventory.length; i++) { + ItemStack itemStack = mc.thePlayer.inventory.armorInventory[i]; + renderItemStack(i, itemStack); + renderItemStack(-1, mc.thePlayer.getCurrentEquippedItem()); + } + super.draw(); + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + + renderItemStack(3, new ItemStack(Items.diamond_helmet)); + renderItemStack(2, new ItemStack(Items.diamond_chestplate)); + renderItemStack(1, new ItemStack(Items.diamond_leggings)); + renderItemStack(0, new ItemStack(Items.diamond_boots)); + renderItemStack(-1, new ItemStack(Items.golden_sword)); + + super.renderDummy(mouseX, mouseY); + } + + private void renderItemStack( int i, ItemStack is) { + + if (is == null) { + return; + } + + GL11.glPushMatrix(); + int yAdd = (-16 * i) + 48; + + if (is.getItem().isDamageable()) { + double damage = ((is.getMaxDamage() - is.getItemDamage()) / (double) is.getMaxDamage()) * 100; + damagef = this.getFormatter().format(damage); + //fr.drawString(String.format("%.2f%%", damage), getX() + 20, getY() + yAdd + 5); + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("1" + damagef + "%", getX() + 20, getY() + yAdd + 5, -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("b" + damagef + "%", getX() + 20, getY() + yAdd + 5, -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("4" + damagef + "%", getX() + 20, getY() + yAdd + 5, -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("5" + damagef + "%", getX() + 20, getY() + yAdd + 5, -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("" + damagef + "%", getX() + 20, getY() + yAdd + 5, -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow("" + damagef + "%", getX() + 20, getY() + yAdd + 5, -1); + } + + } + + RenderHelper.enableGUIStandardItemLighting(); + mc.getRenderItem().renderItemAndEffectIntoGUI(is, getX(), getY() + yAdd); + + GL11.glPopMatrix(); + } + + @Override + public int getWidth() { + return fr.getStringWidth(name); + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT + 70; + } + private DecimalFormat getFormatter() + { + StringBuilder format = new StringBuilder("0"); + for (int i = 0; this.decimals > i; i++) + { + format.append('0'); + } + return new DecimalFormat(format.toString()); + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/BPSMod.java b/src/minecraft/animeware/hud/mod/Mods/BPSMod.java new file mode 100644 index 0000000..33de5be --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/BPSMod.java @@ -0,0 +1,90 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; +import java.text.DecimalFormat; + +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; + +public class BPSMod extends HudMod{ + + static Minecraft mc = Minecraft.getMinecraft(); + private int decimals; + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public BPSMod() { + super("BPSMod", "Movement speed", new ResourceLocation("Animeware/icons/bps.png"), 0, 31); + this.addSettings(color); + } + + @Override + public void draw() { + float rat = Minecraft.getMinecraft().timer.getTicksPerSecond() * Minecraft.getMinecraft().timer.timerSpeed; + //double bps = mc.thePlayer.getDistance(mc.thePlayer.lastTickPosX, mc.thePlayer.posY, mc.thePlayer.lastTickPosZ) * rat; + double speed = Math.sqrt(mc.thePlayer.motionX * mc.thePlayer.motionX + mc.thePlayer.motionZ * mc.thePlayer.motionZ)*rat; + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + if(color.getMode().equals("Blue")) { + mc.fontRendererObj.drawStringWithShadow("8[1BPS:f" + this.getFormatter().format(speed) + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Cyan")) { + mc.fontRendererObj.drawStringWithShadow("8[bBPS:f" + this.getFormatter().format(speed) + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Red")) { + mc.fontRendererObj.drawStringWithShadow("8[4BPS:f" + this.getFormatter().format(speed) + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Purple")) { + mc.fontRendererObj.drawStringWithShadow("8[5BPS:f" + this.getFormatter().format(speed) + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("[BPS:" + this.getFormatter().format(speed) + "]", getX(), getY(), -1); + } else if(color.getMode().equals("White")) { + //fr.drawStringWithShadow("[BPS:" + this.getFormatter().format(speed) + "]", getX(), getY(), -1); + fr.drawStringWithShadow("8[fBPS:f" + this.getFormatter().format(speed) + "8]", getX(), getY(), -1); + } + //mc.fontRendererObj.drawStringWithShadow("8[fBPS:f" + this.getFormatter().format(speed) + "8]", getX(), getY(), -1); + //mc.fontRendererObj.drawStringWithShadow("8[fBPS:f" + mc.thePlayer.capabilities.getWalkSpeed() + "8]", getX(), getY(), -1); + super.draw(); + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + if(color.getMode().equals("Blue")) { + mc.fontRendererObj.drawStringWithShadow("8[1BPS:f" + "0.00" + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Cyan")) { + mc.fontRendererObj.drawStringWithShadow("8[bBPS:f" + "0.00" + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Red")) { + mc.fontRendererObj.drawStringWithShadow("8[4BPS:f" + "0.00" + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Purple")) { + mc.fontRendererObj.drawStringWithShadow("8[5BPS:f" + "0.00" + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("[BPS:" + "0.00" + "]", getX(), getY(), -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow("8[fBPS:f" + "0.00" + "8]", getX(), getY(), -1); + } + //fr.drawStringWithShadow("8[fBPS:f" + "0.00" + "8]", getX(), getY(), -1); + + super.renderDummy(mouseX, mouseY); + } + + @Override + public int getWidth() { + return fr.getStringWidth("8[fBPS:f0.008]") + 1; + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } + private DecimalFormat getFormatter() + { + StringBuilder format = new StringBuilder("0.00"); + for (int i = 100; this.decimals > i; i++) + { + format.append('0'); + } + return new DecimalFormat(format.toString()); + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/Biome.java b/src/minecraft/animeware/hud/mod/Mods/Biome.java new file mode 100644 index 0000000..9a5159e --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/Biome.java @@ -0,0 +1,60 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; + +public class Biome extends HudMod{ + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma"); + + public Biome() { + super("Biome", "Displays what biome you are in", new ResourceLocation("Animeware/icons/xyz.png"), 0, 51); + this.addSettings(color); + } + + @Override + public void draw() { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("8[1Biome:f " + mc.theWorld.getBiomeGenForCoords(mc.thePlayer.getPosition()).biomeName + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("8[bBiome:f " + mc.theWorld.getBiomeGenForCoords(mc.thePlayer.getPosition()).biomeName + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("8[4Biome:f " + mc.theWorld.getBiomeGenForCoords(mc.thePlayer.getPosition()).biomeName + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("8[5Biome:f " + mc.theWorld.getBiomeGenForCoords(mc.thePlayer.getPosition()).biomeName + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("[Biome: " + mc.theWorld.getBiomeGenForCoords(mc.thePlayer.getPosition()).biomeName + "]", getX(), getY(), -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow("8[fBiome:f " + mc.theWorld.getBiomeGenForCoords(mc.thePlayer.getPosition()).biomeName + "8]", getX(), getY(), -1); + } + + //fr.drawStringWithShadow("8[fBiome:f " + mc.theWorld.getBiomeGenForCoords(mc.thePlayer.getPosition()).biomeName + "8]", getX(), getY(), -1); + super.draw(); + } + + + @Override + public void renderDummy(int mouseX, int mouseY) { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + fr.drawStringWithShadow("8[fBiome:f " + "Taiga" + "8]", getX(), getY(), -1); + + super.renderDummy(mouseX, mouseY); + } + + @Override + public int getWidth() { + return fr.getStringWidth("8[fBiome:f " + "BiomeBio" + "8]"); + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } + +} \ No newline at end of file diff --git a/src/minecraft/animeware/hud/mod/Mods/BlockOverlay.java b/src/minecraft/animeware/hud/mod/Mods/BlockOverlay.java new file mode 100644 index 0000000..0319339 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/BlockOverlay.java @@ -0,0 +1,72 @@ +package animeware.hud.mod.Mods; + +import animeware.cosmetic.Booleans; +import animeware.hud.mod.HudMod; +import animeware.util.settings.ModeSetting; +import net.minecraft.util.ResourceLocation; + +public class BlockOverlay extends HudMod { + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma"); + + public BlockOverlay() { + super("BlockOverlay", "Shows overlay over blocks", new ResourceLocation("Animeware/icons/blockoverlay.png"), 0, 0); + this.addSettings(color); + } + @Override + public void onEnable() { + if(color.getMode().equals("Blue")) { + Booleans.BlockOverlayBlue = true; + //fr.drawStringWithShadow("8[1FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Cyan")) { + Booleans.BlockOverlayCyan = true; + //fr.drawStringWithShadow("8[bFPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Red")) { + Booleans.BlockOverlayRed = true; + //fr.drawStringWithShadow("8[4FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Purple")) { + Booleans.BlockOverlayPurple = true; + //fr.drawStringWithShadow("8[5FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Chroma")) { + Booleans.BlockOverlayChroma = true; + //ChromaString.drawChromaString("[FPS:" + mc.getDebugFPS() + "]", getX(), getY(), -1); + } else if(color.getMode().equals("White")) { + Booleans.BlockOverlayWhite = true; + //fr.drawStringWithShadow("8[fFPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } + //NightSky.BlockOverlayWhite = true; + //super.onEnable(); + } + @Override + public void onDisable() { + if(color.getMode().equals("Blue")) { + Booleans.BlockOverlayBlue = false; + //fr.drawStringWithShadow("8[1FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Cyan")) { + Booleans.BlockOverlayCyan = false; + //fr.drawStringWithShadow("8[bFPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Red")) { + Booleans.BlockOverlayRed = false; + //fr.drawStringWithShadow("8[4FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Purple")) { + Booleans.BlockOverlayPurple = false; + //fr.drawStringWithShadow("8[5FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Chroma")) { + Booleans.BlockOverlayChroma = false; + //ChromaString.drawChromaString("[FPS:" + mc.getDebugFPS() + "]", getX(), getY(), -1); + } else if(color.getMode().equals("White")) { + Booleans.BlockOverlayWhite = false; + //fr.drawStringWithShadow("8[fFPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + }//super.onDisable(); + } + @Override + public int getWidth() { + return 0; + } + + @Override + public int getHeight() { + return 0; + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/CPSMod.java b/src/minecraft/animeware/hud/mod/Mods/CPSMod.java new file mode 100644 index 0000000..1e31be2 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/CPSMod.java @@ -0,0 +1,163 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; + +import org.lwjgl.input.Mouse; + +import animeware.DiscordRP; +import animeware.hud.DraggableComponent; +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.misc.WebhookUtil; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; + +public class CPSMod extends HudMod { + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public CPSMod() { + super("CPS", "Displays cps", new ResourceLocation("Animeware/icons/cps.png"), 0, 11); + this.addSettings(color); + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } + + @Override + public int getWidth() { + return 45; + } + + private List clicks = new ArrayList(); + private boolean wasPressed; + private long lastPress; + + private List clicks2 = new ArrayList(); + private boolean wasPressed2; + private long lastPressed2; + + private int getCPS() { + final long time = System.currentTimeMillis(); + this.clicks.removeIf(aLong -> aLong + 1000L < time); + return this.clicks.size(); + } + + private int getCPS2() { + final long time2 = System.currentTimeMillis(); + this.clicks2.removeIf(aLong2 -> aLong2 + 1000 < time2); + return this.clicks2.size(); + } + + public void render(DraggableComponent pos) { + final boolean lpressed = Mouse.isButtonDown(0); + final boolean rpressed = Mouse.isButtonDown(1); + + if(lpressed != this.wasPressed) { + this.lastPress = System.currentTimeMillis() + 10; + this.wasPressed = lpressed; + if(lpressed) { + this.clicks.add(this.lastPress); + } + } + + if(rpressed != this.wasPressed2) { + this.lastPressed2 = System.currentTimeMillis() + 10; + this.wasPressed2 = rpressed; + if(rpressed) { + this.clicks2.add(this.lastPressed2); + } + } + final int cps = this.getCPS(); + final int cpsr = this.getCPS2(); + fr.drawStringWithShadow("8CPSf: " + cps + " : " + cpsr, getX(), getY(), -1); + + } + + @Override + public void draw() { + final boolean lpressed = Mouse.isButtonDown(0); + final boolean rpressed = Mouse.isButtonDown(1); + + if(lpressed != this.wasPressed) { + this.lastPress = System.currentTimeMillis() + 10; + this.wasPressed = lpressed; + if(lpressed) { + this.clicks.add(this.lastPress); + } + } + + if(rpressed != this.wasPressed2) { + this.lastPressed2 = System.currentTimeMillis() + 10; + this.wasPressed2 = rpressed; + if(rpressed) { + this.clicks2.add(this.lastPressed2); + } + } + final int cps = this.getCPS(); + final int cpsr = this.getCPS2(); + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("1CPSf: " + cps + " : " + cpsr, getX(), getY(), -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("bCPSf: " + cps + " : " + cpsr, getX(), getY(), -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("4CPSf: " + cps + " : " + cpsr, getX(), getY(), -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("5CPSf: " + cps + " : " + cpsr, getX(), getY(), -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("CPS: " + cps + " : " + cpsr, getX(), getY(), -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow("8[fCPS:f" + cps + ":" + cpsr + "8]", getX(), getY(), -1); + } + //fr.drawStringWithShadow("8[fCPS:f" + cps + ":" + cpsr + "8]", getX(), getY(), -1); //8[fFPS:f" + mc.getDebugFPS() + "8] + + + + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + final boolean lpressed = Mouse.isButtonDown(0); + final boolean rpressed = Mouse.isButtonDown(1); + + if(lpressed != this.wasPressed) { + this.lastPress = System.currentTimeMillis() + 10; + this.wasPressed = lpressed; + if(lpressed) { + this.clicks.add(this.lastPress); + } + } + + if(rpressed != this.wasPressed2) { + this.lastPressed2 = System.currentTimeMillis() + 10; + this.wasPressed2 = rpressed; + if(rpressed) { + this.clicks2.add(this.lastPressed2); + } + } + final int cps = this.getCPS(); + final int cpsr = this.getCPS2(); + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("1CPSf: " + cps + " : " + cpsr, getX(), getY(), -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("bCPSf: " + cps + " : " + cpsr, getX(), getY(), -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("4CPSf: " + cps + " : " + cpsr, getX(), getY(), -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("5CPSf: " + cps + " : " + cpsr, getX(), getY(), -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("CPS: " + cps + " : " + cpsr, getX(), getY(), -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow("8[fCPS:f" + cps + ":" + cpsr + "8]", getX(), getY(), -1); + } + super.renderDummy(mouseX, mouseY); + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/hud/mod/Mods/FPSMod.java b/src/minecraft/animeware/hud/mod/Mods/FPSMod.java new file mode 100644 index 0000000..574fb1f --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/FPSMod.java @@ -0,0 +1,101 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.BooleanSetting; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; + +public class FPSMod extends HudMod { + + //public ModeSetting Color = new ModeSetting("Blue", "Cyan", "Purple", "Red"); + //public BooleanSetting White = new BooleanSetting("White", true); + //public ModeSetting Color = new ModeSetting("Color", "White", "Blue", "Red"); + + //public BooleanSetting blue = new BooleanSetting("Blue", false); + //public BooleanSetting cyan = new BooleanSetting("Cyan", false); + //public BooleanSetting red = new BooleanSetting("Red", false); + //public BooleanSetting purple = new BooleanSetting("Purple", false); + //public BooleanSetting chroma = new BooleanSetting("Chroma", false); + public ModeSetting color1 = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + BooleanSetting invertXSetting = new BooleanSetting(90.0f, 100.0f, "Invert X"); + + private HudMod hudMod; + + public FPSMod() { + super("FPS", "Displays fps", new ResourceLocation("Animeware/icons/fps.png"), 0, 1); + //this.addSettings(Blue); + //this.addSettings(blue, cyan, red, purple, chroma); + //this.addSettings(Cyan); + //this.addSettings(Red); + //this.addSettings(Purple); + //this.addSettings(Chroma); + this.addSettings(color1); + this.invertXSetting.setEnabled(false); + } + + @Override + public void draw() { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + //if(Blue.isEnabled()) { + //fr.drawStringWithShadow("8[1FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + //} else { + + + if(color1.getMode().equals("Blue")) { + fr.drawStringWithShadow("8[1FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color1.getMode().equals("Cyan")) { + fr.drawStringWithShadow("8[bFPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color1.getMode().equals("Red")) { + fr.drawStringWithShadow("8[4FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color1.getMode().equals("Purple")) { + fr.drawStringWithShadow("8[5FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color1.getMode().equals("Chroma")) { + ChromaString.drawChromaString("[FPS:" + mc.getDebugFPS() + "]", getX(), getY(), -1); + } else if(color1.getMode().equals("White")) { + fr.drawStringWithShadow("8[fFPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } + + //ChromaString.drawChromaString("FPS:" + mc.getDebugFPS() + "]", getX(), getY(), -1); + //} + //super.draw(); + } + + + @Override + public void renderDummy(int mouseX, int mouseY) { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + if(color1.getMode().equals("Blue")) { + fr.drawStringWithShadow("8[1FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color1.getMode().equals("Cyan")) { + fr.drawStringWithShadow("8[bFPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color1.getMode().equals("Red")) { + fr.drawStringWithShadow("8[4FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color1.getMode().equals("Purple")) { + fr.drawStringWithShadow("8[5FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color1.getMode().equals("Chroma")) { + ChromaString.drawChromaString("[FPS:" + mc.getDebugFPS() + "]", getX(), getY(), -1); + } else if(color1.getMode().equals("White")) { + fr.drawStringWithShadow("8[fFPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } + //this.drawHollowRect(hudMod.getX(), hudMod.getY(), hudMod.getX() + hudMod.getWidth(), hudMod.getY() + hudMod.getHeight(), 0x33FFFFFF); + + super.renderDummy(mouseX, mouseY); + } + + @Override + public int getWidth() { + return fr.getStringWidth("8[fFPS:f" + mc.getDebugFPS() + "8]"); + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } + + +} + diff --git a/src/minecraft/animeware/hud/mod/Mods/HitColor.java b/src/minecraft/animeware/hud/mod/Mods/HitColor.java new file mode 100644 index 0000000..1b9c47c --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/HitColor.java @@ -0,0 +1,53 @@ +package animeware.hud.mod.Mods; + +import animeware.cosmetic.Booleans; +import animeware.hud.mod.HudMod; +import animeware.util.settings.ModeSetting; +import net.minecraft.util.ResourceLocation; + +public class HitColor extends HudMod { + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public HitColor() { + super("HitColor", "Changes hit color", new ResourceLocation("Animeware/icons/placeholder.png"), 0, 0); + this.addSettings(color); + } + @Override + public void onEnable() { + if(color.getMode().equals("Blue")) { + Booleans.HitColorBlue = true; + } else if(color.getMode().equals("Cyan")) { + Booleans.HitColorCyan = true; + } else if(color.getMode().equals("Red")) { + Booleans.HitColorRed = true; + } else if(color.getMode().equals("Purple")) { + Booleans.HitColorPurple = true; + } else if(color.getMode().equals("Chroma")) { + Booleans.HitColorChroma = true; + } else if(color.getMode().equals("White")) { + Booleans.HitColor = true; + } + + //super.onEnable(); + } + @Override + public void onDisable() { + if(color.getMode().equals("Blue")) { + Booleans.HitColorBlue = false; + } else if(color.getMode().equals("Cyan")) { + Booleans.HitColorCyan = false; + } else if(color.getMode().equals("Red")) { + Booleans.HitColorRed = false; + } else if(color.getMode().equals("Purple")) { + Booleans.HitColorPurple = false; + } else if(color.getMode().equals("Chroma")) { + Booleans.HitColorChroma = false; + } else if(color.getMode().equals("White")) { + Booleans.HitColor = false; + } + + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/ItemPhysics.java b/src/minecraft/animeware/hud/mod/Mods/ItemPhysics.java new file mode 100644 index 0000000..2c04ddb --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/ItemPhysics.java @@ -0,0 +1,32 @@ +package animeware.hud.mod.Mods; + +import animeware.cosmetic.Booleans; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class ItemPhysics extends HudMod { + + public ItemPhysics() { + super("ItemPhysics", "Adds physics to your items", new ResourceLocation("Animeware/icons/itemphysics.png"), 0, 0); + } + @Override + public void onEnable() { + Booleans.itemphys = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.itemphys = false; + //super.onDisable(); + } + @Override + public int getWidth() { + return 0; + } + + @Override + public int getHeight() { + return 0; + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/Keystrokes.java b/src/minecraft/animeware/hud/mod/Mods/Keystrokes.java new file mode 100644 index 0000000..2243679 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/Keystrokes.java @@ -0,0 +1,171 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.hud.mod.HudMod; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.util.ResourceLocation; + +public class Keystrokes extends HudMod { + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public Keystrokes() { + super("Keystrokes", "Shows when keys are pressed", new ResourceLocation("Animeware/icons/glacier/keystrokes.png"), 900, 467); + this.addSettings(color); + } + + public static enum KeystrokesMode { + + WASD(Key.W, Key.A, Key.S, Key.D), + WASD_MOUSE(Key.W, Key.A, Key.S, Key.D, Key.LMB, Key.RMB), + WASD_JUMP(Key.W, Key.A, Key.S, Key.D, Key.JUMP1), + WASD_JUMP_MOUSE(Key.W, Key.A, Key.S, Key.D, Key.LMB, Key.RMB, Key.JUMP2); + + private final Key[] keys; + private int width,height; + + private KeystrokesMode(Key... keysIn) { + this.keys = keysIn; + + for(Key key: keys) { + this.width = Math.max(this.width, key.getX() + key.getWidth()); + this.height = Math.max(this.height, key.getY() + key.getHeight()); + } + } + + public int getHeight() { + return height; + } + + public int getWidth() { + return width; + } + + public Key[] getKeys() { + return keys; + } + } + + public static class Key { + public static Minecraft mc = Minecraft.getMinecraft(); + + public static final Key W = new Key("W", mc.gameSettings.keyBindForward, 21, 1, 18, 18); + public static final Key A = new Key("A", mc.gameSettings.keyBindLeft, 1, 21, 18, 18); + public static final Key S = new Key("S", mc.gameSettings.keyBindBack, 21, 21, 18, 18); + public static final Key D = new Key("D", mc.gameSettings.keyBindRight, 41, 21, 18, 18); + + public static final Key LMB = new Key("LMB", mc.gameSettings.keyBindAttack, 1, 41, 28, 18); + public static final Key RMB = new Key("RMB", mc.gameSettings.keyBindUseItem, 31, 41, 28, 18); + + public static final Key JUMP1 = new Key("m-----", mc.gameSettings.keyBindJump, 1, 41, 58, 11); + public static final Key JUMP2 = new Key("m-----", mc.gameSettings.keyBindJump, 1, 61, 58, 11); + + + + + + private final String name; + private final KeyBinding keyBind; + private final int x,y,w,h; + + public Key(String name, KeyBinding keybind, int x, int y, int w, int h) { + this.name = name; + this.keyBind = keybind; + this.x = x; + this.y = y; + this.w = w; + this.h = h; + } + + public boolean isDown() { + return keyBind.isKeyDown(); + } + + public int getHeight() { + return h; + } + + public int getWidth() { + return w; + } + + public String getName() { + return name; + } + + public int getX() { + return x; + } + + public int getY() { + return y; + } + + + } + + private KeystrokesMode mode = KeystrokesMode.WASD_JUMP_MOUSE; + + @Override + public int getWidth() { + return 58; + } + + @Override + public int getHeight() { + return 72; + } + + @Override + public void draw() { + GL11.glPushMatrix(); + + for(Key key : mode.getKeys()) { + + int textWidth = fr.getStringWidth(key.getName()); + + Gui.drawRect( + getX() + key.getX(), + getY() + key.getY(), + getX() + key.getX() + key.getWidth(), + getY() + key.getY() + key.getHeight(), + key.isDown() ? new Color(255, 255, 255, 102).getRGB() : new Color(0, 0, 0, 150).getRGB() + ); + fr.drawString(key.getName(), getX() + key.getX() + key.getWidth() / 2 - textWidth / 2, getY() + key.getY() + key.getHeight() / 2 - 4, key.isDown() ? new Color(0, 0, 0, 255).getRGB(): -1); + + } + GL11.glPopMatrix(); + super.draw(); + + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + GL11.glPushMatrix(); + + for(Key key : mode.getKeys()) { + + int textWidth = fr.getStringWidth(key.getName()); + + Gui.drawRect( + getX() + key.getX(), + getY() + key.getY(), + getX() + key.getX() + key.getWidth(), + getY() + key.getY() + key.getHeight(), + key.isDown() ? new Color(255, 255, 255, 102).getRGB() : new Color(0, 0, 0, 150).getRGB() + ); + + fr.drawString(key.getName(), getX() + key.getX() + key.getWidth() / 2 - textWidth / 2, getY() + key.getY() + key.getHeight() / 2 - 4, key.isDown() ? new Color(0, 0, 0, 255).getRGB(): -1); + } + + GL11.glPopMatrix(); + super.renderDummy(mouseX, mouseY); + } + +} \ No newline at end of file diff --git a/src/minecraft/animeware/hud/mod/Mods/MemUsage.java b/src/minecraft/animeware/hud/mod/Mods/MemUsage.java new file mode 100644 index 0000000..93ede06 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/MemUsage.java @@ -0,0 +1,86 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; + +public class MemUsage extends HudMod { + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public MemUsage() { + super("Memory", "Memory usage", new ResourceLocation("Animeware/icons/ram.png"), 50, 137); + this.addSettings(color); + } + + @Override + public int getWidth() { + Runtime runtime = Runtime.getRuntime(); + String str = "Mem: " + (runtime.totalMemory() - runtime.freeMemory()) * 100L / runtime.maxMemory() + "% "; + return fr.getStringWidth(str) + 8; + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT + 9; + } + + @Override + public void draw() { + //Gui.drawRect(getX(), getY(), getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 50).getRGB()); + Gui.drawRect(getX() + 3, getY() + 3, getX() + getWidth() - 5, getY() + getHeight() - 4, new Color(0, 0, 0, 170).getRGB()); + + Runtime runtime = Runtime.getRuntime(); + String str = "Mem: " + (runtime.totalMemory() - runtime.freeMemory()) * 100L / runtime.maxMemory() + "% "; + + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("1" + str, getX() + 6, getY() + 5, -1); + //fr.drawStringWithShadow("8[1FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("b" + str, getX() + 6, getY() + 5, -1); + //fr.drawStringWithShadow("8[bFPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("4" + str, getX() + 6, getY() + 5, -1); + //fr.drawStringWithShadow("8[4FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("5" + str, getX() + 6, getY() + 5, -1); + //fr.drawStringWithShadow("8[5FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString(str, getX() + 6, getY() + 5, -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow(str, getX() + 6, getY() + 5, -1); + } + + + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + Runtime runtime = Runtime.getRuntime(); + String str = "Mem: " + (runtime.totalMemory() - runtime.freeMemory()) * 100L / runtime.maxMemory() + "% "; + + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("1" + str, getX() + 6, getY() + 5, -1); + //fr.drawStringWithShadow("8[1FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("b" + str, getX() + 6, getY() + 5, -1); + //fr.drawStringWithShadow("8[bFPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("4" + str, getX() + 6, getY() + 5, -1); + //fr.drawStringWithShadow("8[4FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("5" + str, getX() + 6, getY() + 5, -1); + //fr.drawStringWithShadow("8[5FPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString(str, getX() + 6, getY() + 5, -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow(str, getX() + 6, getY() + 5, -1); + } + super.renderDummy(mouseX, mouseY); + } + +} \ No newline at end of file diff --git a/src/minecraft/animeware/hud/mod/Mods/MinimalBobbing.java b/src/minecraft/animeware/hud/mod/Mods/MinimalBobbing.java new file mode 100644 index 0000000..4ff758a --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/MinimalBobbing.java @@ -0,0 +1,33 @@ +package animeware.hud.mod.Mods; + +import java.text.DecimalFormat; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class MinimalBobbing extends HudMod { + + public MinimalBobbing() { + super("Minimal Bobbing", "Disables crosshair movement", new ResourceLocation("Animeware/icons/placeholder.png"), 900, 140); + } + + @Override + public void onEnable() { + Booleans.minimalBobbing = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.minimalBobbing = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/Miniplayer.java b/src/minecraft/animeware/hud/mod/Mods/Miniplayer.java new file mode 100644 index 0000000..3585de5 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/Miniplayer.java @@ -0,0 +1,110 @@ +package animeware.hud.mod.Mods; + +import org.lwjgl.opengl.GL11; + +import animeware.hud.mod.HudMod; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ResourceLocation; + +public class Miniplayer extends HudMod { + + /** The X size of the inventory window in pixels. */ + protected int xSize = 176; + + /** The Y size of the inventory window in pixels. */ + protected int ySize = 166; + + protected int guiLeft; + + protected int guiTop; + + /** The old x position of the mouse pointer */ + private float oldMouseX; + + /** The old y position of the mouse pointer */ + private float oldMouseY; + + EntityLivingBase target; + + public Miniplayer() { + super("Mini Player", "Small player figure", new ResourceLocation("Animeware/icons/placeholder.png"), 5, 5); + + } + + public static void Playerdraw(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent) + { + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)posX, (float)posY, 50.0F); + GlStateManager.scale((float)(-35), (float)35, (float)35); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + float f = ent.renderYawOffset; + float f1 = ent.rotationYaw; + float f2 = ent.rotationPitch; + float f3 = ent.prevRotationYawHead; + float f4 = ent.rotationYawHead; + GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); + ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F; + ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F; + ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F; + ent.rotationYawHead = ent.rotationYaw; + ent.prevRotationYawHead = ent.rotationYaw; + GlStateManager.translate(0.0F, 0.0F, 0.0F); + RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); + rendermanager.setPlayerViewY(180.0F); + rendermanager.setRenderShadow(false); + rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + rendermanager.setRenderShadow(true); + ent.renderYawOffset = f; + ent.rotationYaw = f1; + ent.rotationPitch = f2; + ent.prevRotationYawHead = f3; + ent.rotationYawHead = f4; + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } + + @Override + public void draw() { + + GL11.glColor4f(1F, 1F, 1F, 1F); + + Playerdraw(getX() + 15, getY() + 50, 25, 50, 0, mc.thePlayer); + + super.draw(); + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + + GL11.glColor4f(1F, 1F, 1F, 1F); + Playerdraw(getX() + 15, getY() + 50, 24, 50, 0, mc.thePlayer); + + + + super.renderDummy(mouseX, mouseY); + } + + @Override + public int getWidth() { + return 29; + } + + @Override + public int getHeight() { + return 54; + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/ModArrows.java b/src/minecraft/animeware/hud/mod/Mods/ModArrows.java new file mode 100644 index 0000000..9f5a4aa --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/ModArrows.java @@ -0,0 +1,66 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.hud.mod.HudMod; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class ModArrows extends HudMod { + + //ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma"); + + public ModArrows() { + super("ArrowMod", "Number of arrows in your inventory", new ResourceLocation("Animeware/icons/placeholder.png"), 5, 5); + //this.addSettings(color); + } + + @Override + public int getWidth() { + return 20; + } + + @Override + public int getHeight() { + return 23; + } + + @Override + public void draw() { + if(this.getRemainingArrows() < 1) { + fr.drawString(this.getRemainingArrows() + "", getX() + 8, getY() + 15, Color.RED.getRGB()); + } else { + fr.drawString(this.getRemainingArrows() + "", getX() + 8, getY() + 15, Color.WHITE.getRGB()); + } + this.mc.getRenderItem().renderItemIntoGUI(new ItemStack(Items.arrow), getX() + 3, getY() - 1); + + } + + + @Override + public void renderDummy(int mouseX, int mouseY) { + if(this.getRemainingArrows() < 1) { + fr.drawString(this.getRemainingArrows() + "", getX() + 8, getY() + 15, Color.RED.getRGB()); + } else { + fr.drawString(this.getRemainingArrows() + "", getX() + 8, getY() + 15, Color.WHITE.getRGB()); + } + this.mc.getRenderItem().renderItemIntoGUI(new ItemStack(Items.arrow), getX() + 3, getY() - 1); + super.renderDummy(mouseX, mouseY); + } + + + private int getRemainingArrows() { + int i = 0; + + for(ItemStack itemstack : this.mc.thePlayer.inventory.mainInventory) { + if(itemstack != null && itemstack.getItem().equals(Items.arrow)) { + i += itemstack.stackSize; + } + } + + return i; + } + + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/ModDirection.java b/src/minecraft/animeware/hud/mod/Mods/ModDirection.java new file mode 100644 index 0000000..c5fe37e --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/ModDirection.java @@ -0,0 +1,71 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; + +public class ModDirection extends HudMod { + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public ModDirection() { + super("Direction", "Facing direction", new ResourceLocation("Animeware/icons/direction.png"), 0, 91); + this.addSettings(color); + } + + @Override + public int getWidth() { + return fr.getStringWidth("[Direction: north]"); + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } + + @Override + public void draw() { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("8[1Direction f" + mc.thePlayer.getHorizontalFacing() + "8]", getX() + 1, getY() + 1, -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("8[bDirection f" + mc.thePlayer.getHorizontalFacing() + "8]", getX() + 1, getY() + 1, -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("8[4Direction f" + mc.thePlayer.getHorizontalFacing() + "8]", getX() + 1, getY() + 1, -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("8[5Direction f" + mc.thePlayer.getHorizontalFacing() + "8]", getX() + 1, getY() + 1, -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("[Direction " + mc.thePlayer.getHorizontalFacing() + "]", getX() + 1, getY() + 1, -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow("8[fDirection f" + mc.thePlayer.getHorizontalFacing() + "8]", getX() + 1, getY() + 1, -1); + } + + + +} + + @Override + public void renderDummy(int mouseX, int mouseY) { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("8[1Direction f" + mc.thePlayer.getHorizontalFacing() + "8]", getX() + 1, getY() + 1, -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("8[bDirection f" + mc.thePlayer.getHorizontalFacing() + "8]", getX() + 1, getY() + 1, -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("8[4Direction f" + mc.thePlayer.getHorizontalFacing() + "8]", getX() + 1, getY() + 1, -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("8[5Direction f" + mc.thePlayer.getHorizontalFacing() + "8]", getX() + 1, getY() + 1, -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("[Direction " + mc.thePlayer.getHorizontalFacing() + "]", getX() + 1, getY() + 1, -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow("8[fDirection f" + mc.thePlayer.getHorizontalFacing() + "8]", getX() + 1, getY() + 1, -1); + } + super.renderDummy(mouseX, mouseY); +} + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/ModHorseStats.java b/src/minecraft/animeware/hud/mod/Mods/ModHorseStats.java new file mode 100644 index 0000000..93a543e --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/ModHorseStats.java @@ -0,0 +1,62 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; +import java.text.DecimalFormat; + +import animeware.hud.ScreenPosition; +import animeware.hud.mod.HudMod; +import animeware.util.render.RoundedUtils; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.util.ResourceLocation; + +public class ModHorseStats extends HudMod { + + public ModHorseStats() { + super("Horse Status", "Displays horse stats", new ResourceLocation("Animeware/icons/placeholder.png"), 450, 320); + // TODO Auto-generated constructor stub + } + + private final DecimalFormat df = new DecimalFormat("0.0"); + + public int getWidth() { + return 62; + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT * 2 + 4; + } + + @Override + public void draw() { + //RoundedUtils.drawSmoothRoundedRect(getX(), getY(), getX() + getWidth(), getY() + getHeight(), 7,new Color(0, 0, 0, 170).getRGB()); + if(mc.objectMouseOver.entityHit instanceof EntityHorse) { + EntityHorse horse = (EntityHorse) mc.objectMouseOver.entityHit; + + if(mc.thePlayer.isRidingHorse()) return; //Recommended: If you're riding the horse it doesn't work well: it renders only very occasionally and then only for a few frames. + + fr.drawString("Speed: " + getHorseSpeedRounded(horse.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue()) + " BPS" , getX(), getY(), -1); + fr.drawString("Jump: " + df.format(horse.getHorseJumpStrength() * 5.5) + " Blocks" , getX(), getY() + 10, -1); + } + + + } + + private String getHorseSpeedRounded(double baseSpeed) { + //Read https://minecraft.fandom.com/wiki/Horse#Movement_speed for more information. + final float factor = 43.1703703704f; + + float speed = (float) (baseSpeed * factor); + + return df.format(speed); + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + //RoundedUtils.drawSmoothRoundedRect(getX(), getY(), getX() + getWidth(), getY() + getHeight(), 7,new Color(0, 0, 0, 170).getRGB()); + fr.drawString("Jump: 2.3 Blocks" , getX(), getY(), -1); + fr.drawString("Speed: 5.3 BPS" , getX(), getY() + 10, -1); + } + +} \ No newline at end of file diff --git a/src/minecraft/animeware/hud/mod/Mods/ModMLDGHelper.java b/src/minecraft/animeware/hud/mod/Mods/ModMLDGHelper.java new file mode 100644 index 0000000..6855f8f --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/ModMLDGHelper.java @@ -0,0 +1,223 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.hud.ScreenPosition; +import animeware.hud.mod.HudMod; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; + +public class ModMLDGHelper extends HudMod{ + + String prefix; + String suffix; + + + public ModMLDGHelper() { + super("MLDGHelper", "I actually dont know", new ResourceLocation("Animeware/icons/placeholder.png"), 0, 141); + // TODO Auto-generated constructor stub + } + + @Override + public int getWidth() { + return mc.fontRendererObj.getStringWidth(prefix + suffix); + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } + + @Override + public void draw() { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayerSP p = mc.thePlayer; + + MovingObjectPosition mp = p.rayTrace(200.0D, 1.0F); + int height = mp.getBlockPos().getY() + 1; + + + String mlgstatus; + + int down = mp.getBlockPos().getY() + 1; + int up = Minecraft.getMinecraft().thePlayer.getPosition().getY(); + + int df = up - down; + + if(df <= 5) { + mlgstatus = "Save"; + } else { + if ((df >= 6 && df <= 16) || + df == 18 || + df == 19 || + df == 21 || + df == 22 || + df == 24 || + df == 26 || + df == 27 || + df == 29 || + df == 33 || + df == 34 || + df == 36 || + df == 38 || + df == 40 || + df == 42 || + df == 44 || + df == 47 || + df == 49 || + df == 51 || + df == 53 || + df == 55 || + df == 58 || + df == 60 || + df == 62 || + df == 65 || + df == 67 || + df == 69 || + df == 72 || + df == 74 || + df == 77 || + df == 79 || + df == 82 || + df == 85 || + df == 87 || + df == 90 || + df == 93 || + df == 95 || + df == 98 || + df == 101 || + df == 104 || + df == 106 || + df == 109 || + df == 112 || + df == 115 || + df == 118 || + df == 121 || + df == 124 || + df == 127 || + df == 130 || + df == 135 || + df == 138 || + df == 142 || + df == 145 || + df == 148 || + df == 151 || + df == 153 || + df == 154 + ) { + + mlgstatus = "Run"; + + } else { + if (df == 18 || + df == 17 || + df == 20 || + df == 23 || + df == 28 || + df == 30 || + df == 31 || + df == 35 || + df == 37 || + df == 39 || + df == 41 || + df == 43 || + df == 45 || + df == 50 || + df == 52 || + df == 54 || + df == 56 || + df == 59 || + df == 61 || + df == 63 || + df == 66 || + df == 68 || + df == 71 || + df == 73 || + df == 76 || + df == 78 || + df == 81 || + df == 83 || + df == 86 || + df == 91 || + df == 94 || + df == 97 || + df == 100 || + df == 102 || + df == 105 || + df == 108 || + df == 111 || + df == 114 || + df == 119 || + df == 122 || + df == 125 || + df == 128 || + df == 131 || + df == 134 || + df == 137 || + df == 140 || + df == 143 || + df == 146 || + df == 150 || + df == 156 + ) { + + mlgstatus = "Jump"; + + } else { + mlgstatus = "Impossible"; + } + } + } + + + if (mp != null && mp.typeOfHit == MovingObjectType.BLOCK && df >= 0) { + prefix = "c" + down + "8: f"; + + if (Minecraft.getMinecraft().theWorld.getBlockState(mp.getBlockPos()) != Block.getStateById(30)) { + + if (up < down) { + prefix = "cN/A8: f"; + suffix = "Not specified"; + } else { + prefix = "c" + down + "8: f"; + suffix = mlgstatus; + } + + } else { + + suffix = "Cobweb! Choose another block!"; + + } + } else { + prefix = "cN/A8: f"; + suffix = "Not specified"; + } + + + + //df for run + //18,19,21,22,24,26,27,29,33,34,36,38,40, 42,44,47, 49, 51, 53, 55, 58, 60, 62, 65, 67, 69, 72, 74, 77, 79, 82, 85, 87, 90 + //93, 95, 98, 101, 104, 106, 109, 112, 115, 118, 121, 124, 127, 130, 135, 138, 142, 145, 148, 151, 153, 154 + + //df for jump + //17, 20, 23, 28, 30, 31, 35, 37, 39, 41, 43, 45, 50, 52, 54, 56, 59, 61, 63, 66, 68, 71, 73, 76, 78 + //81, 83, 86, 89, 91, 94, 97, 100, 102, 105, 108, 111, 114, 119, 122, 125, 128, 131, 134, 137, 140, 143, 146, 150, 156 + + + + fr.drawStringWithShadow(prefix + suffix, getX(), getY(), -1); + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + fr.drawStringWithShadow("cMLG8: fSave", getX(), getY(), -1); + super.renderDummy(mouseX, mouseY); + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/hud/mod/Mods/ModParticles.java b/src/minecraft/animeware/hud/mod/Mods/ModParticles.java new file mode 100644 index 0000000..c7e0641 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/ModParticles.java @@ -0,0 +1,47 @@ +package animeware.hud.mod.Mods; + +import animeware.hud.ScreenPosition; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class ModParticles extends HudMod { + + public ModParticles() { + super("No Particles", "Removes all particles", new ResourceLocation("Animeware/icons/quit.png"), 5, 5); + // TODO Auto-generated constructor stub + } + + private ScreenPosition pos; + + @Override + public int getWidth() { + + return fr.getStringWidth(""); + + +//Put Text here if wanted Must be same text as font.drawString ↑ + + + + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } + + @Override + public void draw() { + //fr.drawStringWithShadow("", pos.getAbsoluteX() + getWidth() + 3, pos.getAbsoluteY() + 4, -1); + + //Put Text here if wanted Must be same text as font.drawString ↑ + + this.mc.gameSettings.particleSetting = 10; + + + + return; + + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/MoreParticles.java b/src/minecraft/animeware/hud/mod/Mods/MoreParticles.java new file mode 100644 index 0000000..e36f6e3 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/MoreParticles.java @@ -0,0 +1,23 @@ +package animeware.hud.mod.Mods; + +import animeware.cosmetic.Booleans; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class MoreParticles extends HudMod { + + public MoreParticles() { + super("MoreParticles", "Multiplies particles", new ResourceLocation("Animeware/icons/placeholder.png"), 0, 0); + } + @Override + public void onEnable() { + Booleans.MoreParticles = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.MoreParticles = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/MotionBlur.java b/src/minecraft/animeware/hud/mod/Mods/MotionBlur.java new file mode 100644 index 0000000..014a284 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/MotionBlur.java @@ -0,0 +1,44 @@ +package animeware.hud.mod.Mods; + +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +public class MotionBlur { + public static float f; + + public static void createAccumulation() { + float f = getAccumulationValue(); + GL11.glAccum(GL11.GL_MULT, f); + GL11.glAccum(GL11.GL_ACCUM, 1.0F - f); + GL11.glAccum(GL11.GL_RETURN, 1.0F); + } + + public static float getMultiplier() { + return Minecraft.getDebugFPS() > 120 ? (Minecraft.getDebugFPS() > 200 ? 60.0F : 30.0F) : 0.0F; + } + + public static float getAccumulationValue() { + f = getMultiplier() * 10.0F; + long lastTimestampInGame = System.currentTimeMillis(); + + if (f > 996.0F) { + f = 996.0F; + } + + if (f > 990.0F) { + f = 990.0F; + } + + long i = System.currentTimeMillis() - lastTimestampInGame; + + if (i > 10000L) { + return 0.0F; + } else { + if (f < 0.0F) { + f = 0.0F; + } + + return f / 1000.0F; + } + } +} diff --git a/src/minecraft/animeware/hud/mod/Mods/Motionblurmodule.java b/src/minecraft/animeware/hud/mod/Mods/Motionblurmodule.java new file mode 100644 index 0000000..3ff9381 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/Motionblurmodule.java @@ -0,0 +1,26 @@ +package animeware.hud.mod.Mods; + +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class Motionblurmodule extends HudMod { + public Motionblurmodule() { + super("MotionBlur", "", new ResourceLocation("Animeware/icons/placeholder.png"), 0, 0); + } + + @Override + public void onEnable() { + MotionBlur.createAccumulation(); + //Minecraft.getMinecraft().displayGuiScreen(new Cosmetics()); + } + + public void OnUpdate(){ + MotionBlur.createAccumulation(); + //Lwhite.toggletracert(); + } + public void OnDisable() { + + } + + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/NotificationsModule.java b/src/minecraft/animeware/hud/mod/Mods/NotificationsModule.java new file mode 100644 index 0000000..e048752 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/NotificationsModule.java @@ -0,0 +1,27 @@ +package animeware.hud.mod.Mods; + +import org.lwjgl.input.Keyboard; + +import animeware.hud.Category; +import animeware.hud.mod.HudMod; +import animeware.util.misc.Timer; +import animeware.util.settings.BooleanSetting; +import animeware.util.settings.ModeSetting; +import animeware.util.settings.NumberSetting; +import net.minecraft.util.ResourceLocation; + +public class NotificationsModule extends HudMod { + + public NumberSetting time = new NumberSetting("Time", 2.5, 1, 10, 0.5); + //public BooleanSetting modToggle = new BooleanSetting("Module Toggle", true); + public ModeSetting font = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public NotificationsModule() { + super("Notifications", "Customize your Notifications", new ResourceLocation("Animeware/icons/placeholder.png"), 0, 0); + addSettings(time,font); + } + + Timer timer = new Timer(); + + +} \ No newline at end of file diff --git a/src/minecraft/animeware/hud/mod/Mods/PackDisplay.java b/src/minecraft/animeware/hud/mod/Mods/PackDisplay.java new file mode 100644 index 0000000..73fc790 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/PackDisplay.java @@ -0,0 +1,94 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; +import optifine.Config; + +public class PackDisplay extends HudMod { + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public PackDisplay() { + super("PackDisplay", "Shows active pack", new ResourceLocation("Animeware/icons/packoverlay.png"), 0, 71); + this.addSettings(color); + } + + @Override + public void draw() { + String pack = ""; + if(!Config.getResourcePackNames().equalsIgnoreCase("default")) + pack = Config.getResourcePackNames().split(",")[Config.getResourcePacks().length -1]; + else + pack = "default"; + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + if(color.getMode().equals("Blue")) { + if(!Config.getResourcePackNames().equals("default")) { + fr.drawStringWithShadow("8[1Pack:f " + pack + "8]", getX(), getY(), -1); + } else { + fr.drawStringWithShadow("", getX(), getY(), -1); + } + } else if(color.getMode().equals("Cyan")) { + if(!Config.getResourcePackNames().equals("default")) { + fr.drawStringWithShadow("8[bPack:f " + pack + "8]", getX(), getY(), -1); + } else { + fr.drawStringWithShadow("", getX(), getY(), -1); + } + } else if(color.getMode().equals("Red")) { + if(!Config.getResourcePackNames().equals("default")) { + fr.drawStringWithShadow("8[4Pack:f " + pack + "8]", getX(), getY(), -1); + } else { + fr.drawStringWithShadow("", getX(), getY(), -1); + } + } else if(color.getMode().equals("Purple")) { + if(!Config.getResourcePackNames().equals("default")) { + fr.drawStringWithShadow("8[4Pack:f " + pack + "8]", getX(), getY(), -1); + } else { + fr.drawStringWithShadow("", getX(), getY(), -1); + } + } else if(color.getMode().equals("Chroma")) { + if(!Config.getResourcePackNames().equals("default")) { + ChromaString.drawChromaString("[Pack: " + pack + "]", getX(), getY(), -1); + } else { + ChromaString.drawChromaString("", getX(), getY(), -1); + } + } else if(color.getMode().equals("White")) { + if(!Config.getResourcePackNames().equals("default")) { + fr.drawStringWithShadow("8[fPack: " + pack + "8]", getX(), getY(), -1); + } else { + fr.drawStringWithShadow("", getX(), getY(), -1); + } + } + + + super.draw(); + } + + + @Override + public void renderDummy(int mouseX, int mouseY) { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + fr.drawStringWithShadow("8[fPack: Uchiha Pack8]", getX(), getY(), -1); + + super.renderDummy(mouseX, mouseY); + } + + @Override + public int getWidth() { + String pack = ""; + if(!Config.getResourcePackNames().equalsIgnoreCase("default")) + pack = Config.getResourcePackNames().split(",")[Config.getResourcePacks().length -1]; + else + pack = "default"; + return fr.getStringWidth("8[fPack: " + pack + "8]"); + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } +} diff --git a/src/minecraft/animeware/hud/mod/Mods/Ping.java b/src/minecraft/animeware/hud/mod/Mods/Ping.java new file mode 100644 index 0000000..c60faf1 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/Ping.java @@ -0,0 +1,82 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.gui.Gui; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ResourceLocation; + +public class Ping extends HudMod{ + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public Ping() { + super("Ping", "Displays ping", new ResourceLocation("Animeware/icons/glacier/ping.png"), 0, 41); + this.addSettings(color); + } + + @Override + public void draw() { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + if(color.getMode().equals("Blue")) { + if(!MinecraftServer.getServer().isSinglePlayer()) { + fr.drawStringWithShadow("8[1Ping:f" + mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()).getResponseTime() + "ms8]", getX(), getY(), -1); + } else { + fr.drawStringWithShadow("8[1Ping:f00ms8]", getX(), getY(), -1); + } + } else if(color.getMode().equals("Cyan")) { + if(!MinecraftServer.getServer().isSinglePlayer()) { + fr.drawStringWithShadow("8[bPing:f" + mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()).getResponseTime() + "ms8]", getX(), getY(), -1); + } else { + fr.drawStringWithShadow("8[bPing:f00ms8]", getX(), getY(), -1); + } + } else if(color.getMode().equals("Red")) { + if(!MinecraftServer.getServer().isSinglePlayer()) { + fr.drawStringWithShadow("8[4Ping:f" + mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()).getResponseTime() + "ms8]", getX(), getY(), -1); + } else { + fr.drawStringWithShadow("8[4Ping:f00ms8]", getX(), getY(), -1); + } + } else if(color.getMode().equals("Purple")) { + if(!MinecraftServer.getServer().isSinglePlayer()) { + fr.drawStringWithShadow("8[5Ping:f" + mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()).getResponseTime() + "ms8]", getX(), getY(), -1); + } else { + fr.drawStringWithShadow("8[5Ping:f00ms8]", getX(), getY(), -1); + } + } else if(color.getMode().equals("Chroma")) { + if(!MinecraftServer.getServer().isSinglePlayer()) { + ChromaString.drawChromaString("[Ping:" + mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()).getResponseTime() + "ms]", getX(), getY(), -1); + } else { + ChromaString.drawChromaString("[Ping:00ms]", getX(), getY(), -1); + } + } else if(color.getMode().equals("White")) { + if(!MinecraftServer.getServer().isSinglePlayer()) { + fr.drawStringWithShadow("8[fPing:f" + mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()).getResponseTime() + "ms8]", getX(), getY(), -1); + } else { + fr.drawStringWithShadow("8[fPing:f00ms8]", getX(), getY(), -1); + } + } + + super.draw(); + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + fr.drawStringWithShadow("8[fPing:f00ms8]", getX(), getY(), -1); + + super.renderDummy(mouseX, mouseY); + } + + @Override + public int getWidth() { + return fr.getStringWidth("8[fPing:f00ms8]"); + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/PlayerHead.java b/src/minecraft/animeware/hud/mod/Mods/PlayerHead.java new file mode 100644 index 0000000..eaf7516 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/PlayerHead.java @@ -0,0 +1,51 @@ +package animeware.hud.mod.Mods; + +import org.lwjgl.opengl.GL11; + +import animeware.hud.ScreenPosition; +import animeware.hud.mod.HudMod; +import animeware.util.render.DrawUtil; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.util.ResourceLocation; + +public class PlayerHead extends HudMod { + + public PlayerHead() { + super("PlayerHead", "Face of your skin", new ResourceLocation("Animeware/icons/placeholder.png"), 85, 5); + // TODO Auto-generated constructor stub + } + + @Override + public int getWidth() { + return 20; + } + + @Override + public int getHeight() { + return 20; + } + + @Override + public void draw() { + NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()); + if(playerInfo != null) { + mc.getTextureManager().bindTexture(playerInfo.getLocationSkin()); + GL11.glColor4f(1F, 1F, 1F, 1F); + Gui.drawScaledCustomSizeModalRect(getX(), getY(), 8F, 8F, 8, 8, 20, 20, 64F, 64F); + } + } + @Override + public void renderDummy(int mouseX, int mouseY) { + //fr.drawStringWithShadow("8[fFPS:f" + mc.getDebugFPS() + "8]", getX(), getY(), -1); + NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()); + if(playerInfo != null) { + mc.getTextureManager().bindTexture(playerInfo.getLocationSkin()); + GL11.glColor4f(1F, 1F, 1F, 1F); + Gui.drawScaledCustomSizeModalRect(getX(), getY(), 8F, 8F, 8, 8, 20, 20, 64F, 64F); + } + super.renderDummy(mouseX, mouseY); + } + +} + diff --git a/src/minecraft/animeware/hud/mod/Mods/PotCount.java b/src/minecraft/animeware/hud/mod/Mods/PotCount.java new file mode 100644 index 0000000..093cf6c --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/PotCount.java @@ -0,0 +1,66 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.hud.mod.HudMod; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class PotCount extends HudMod { + + //ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma"); + + public PotCount() { + super("Pot Counter", "Number of potions in your inventory", new ResourceLocation("Animeware/icons/placeholder.png"), 5, 5); + //this.addSettings(color); + } + + @Override + public int getWidth() { + return 20; + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } + + @Override + public void draw() { + if(this.getRemainingPots() < 1) { + fr.drawString(this.getRemainingPots() + "", getX() + 8, getY() + 15, Color.RED.getRGB()); + } else { + fr.drawString(this.getRemainingPots() + "", getX() + 8, getY() + 15, Color.WHITE.getRGB()); + } + this.mc.getRenderItem().renderItemIntoGUI(new ItemStack(Items.potionitem), getX() + 3, getY() - 1); + + } + + + @Override + public void renderDummy(int mouseX, int mouseY) { + if(this.getRemainingPots() < 1) { + fr.drawString(this.getRemainingPots() + "", getX() + 8, getY() + 15, Color.RED.getRGB()); + } else { + fr.drawString(this.getRemainingPots() + "", getX() + 8, getY() + 15, Color.WHITE.getRGB()); + } + this.mc.getRenderItem().renderItemIntoGUI(new ItemStack(Items.potionitem), getX() + 3, getY() - 1); + super.renderDummy(mouseX, mouseY); + } + + + private int getRemainingPots() { + int i = 0; + + for(ItemStack itemstack : this.mc.thePlayer.inventory.mainInventory) { + if(itemstack != null && itemstack.getItem().equals(Items.potionitem)) { + i += itemstack.stackSize; + } + } + + return i; + } + + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/PotionStatus.java b/src/minecraft/animeware/hud/mod/Mods/PotionStatus.java new file mode 100644 index 0000000..a5c4ac0 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/PotionStatus.java @@ -0,0 +1,95 @@ +package animeware.hud.mod.Mods; + +import java.util.Collection; +import java.util.Iterator; + +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + +public class PotionStatus extends HudMod { + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public PotionStatus() { + super("Potion Status", "Active potion effects", new ResourceLocation("Animeware/icons/potionhud.png"), 0, 151); + this.addSettings(color); + } + + @Override + public void draw() { + + Collection activeEffects = mc.thePlayer.getActivePotionEffects(); + + if(!activeEffects.isEmpty()) { + int yAdd = 0; + PotionEffect potionEffect; + Potion pe; + String potionName = ""; + String effectDuration = ""; + for(Iterator toRemove = activeEffects.iterator(); toRemove.hasNext();) { + potionEffect = (PotionEffect) toRemove.next(); + pe = Potion.potionTypes[potionEffect.getPotionID()]; + potionName = ""; + potionName = StatCollector.translateToLocal(pe.getName()); + + if(potionEffect.getAmplifier() == 1) { + potionName = "" + potionName + " II" + ""; + }else if(potionEffect.getAmplifier() == 2) { + potionName ="" + potionName + " III" + ""; + }else if(potionEffect.getAmplifier() == 3) { + potionName = "" + potionName + " IV" + ""; + }else if(potionEffect.getAmplifier() == 4) { + potionName = "" + potionName + " V" + ""; + }else if(potionEffect.getAmplifier() == 5) { + potionName = "" + potionName + " VI" + ""; + }else if(potionEffect.getAmplifier() == 6) { + potionName = "" + potionName + " VIII" + ""; + } + + effectDuration = Potion.getDurationString(potionEffect); + + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("8[1" + potionName + " :f " + effectDuration + "8]", getX(), getY() + yAdd, -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("8[b" + potionName + " :f " + effectDuration + "8]", getX(), getY() + yAdd, -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("8[4" + potionName + " :f " + effectDuration + "8]", getX(), getY() + yAdd, -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("8[5" + potionName + " :f " + effectDuration + "8]", getX(), getY() + yAdd, -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("[" + potionName + " : " + effectDuration + "]", getX(), getY() + yAdd, -1); + } else if(color.getMode().equals("White")) { + fr.drawString("[" + potionName + " : " + effectDuration + "]", getX(), getY() + yAdd, -1); + } + + yAdd = yAdd + 15; + } + } + + super.draw(); + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + + fr.drawString("Jump Boost" + " : " + "0:45", getX(), getY(), -1); + fr.drawString("Speed" + " : " + "0:45", getX(), getY() + 15, -1); + fr.drawString("Invisibility" + " : " + "0:30", getX(), getY() + 30, -1); + super.renderDummy(mouseX, mouseY); + } + + @Override + public int getWidth() { + return 95; + } + + @Override + public int getHeight() { + return 38; + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/hud/mod/Mods/ReachDisplayMod.java b/src/minecraft/animeware/hud/mod/Mods/ReachDisplayMod.java new file mode 100644 index 0000000..664d1c6 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/ReachDisplayMod.java @@ -0,0 +1,158 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; +import java.text.DecimalFormat; + +import animeware.event.EventTarget; +import animeware.event.impl.AttackEntityEvent; +import animeware.event.impl.ClientTick; +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; + +public class ReachDisplayMod extends HudMod { + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public ReachDisplayMod() { + super("ReachDisplay", "Displays distance from enemy", new ResourceLocation("Animeware/icons/glacier/reach.png"), 0, 101); + this.addSettings(color); + } + + String ReachDisplay = ""; + private long lastAttack; + private boolean enabled = true; + private int decimals; + + @Override + public int getWidth() + { + return fr.getStringWidth("[0 blocks]"); + + } + + @Override + public int getHeight() + { + return this.fr.FONT_HEIGHT; + } + + @Override + public void draw() + { + //if(mc.gameSettings.keyBindAttack.isKeyDown()) { + + final Vec3 vec3 = this.mc.getRenderViewEntity().getPositionEyes(1.0F); + double hitRange = this.mc.objectMouseOver.hitVec.distanceTo(vec3); + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + + if(color.getMode().equals("Blue")) { + if(mc.gameSettings.keyBindAttack.isKeyDown()) { + this.fr.drawString("8[f" + this.getFormatter().format(hitRange) + " 1blocks8]", getX(),getY(), -1, false); + + //this.lastAttack = System.nanoTime() + 100; + this.lastAttack = System.currentTimeMillis() + 10; + } else { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + this.fr.drawString("8[f0 1blocks8]", getX(),getY(), -1, false); + + } + } else if(color.getMode().equals("Cyan")) { + if(mc.gameSettings.keyBindAttack.isKeyDown()) { + this.fr.drawString("8[f" + this.getFormatter().format(hitRange) + " bblocks8]", getX(),getY(), -1, false); + + //this.lastAttack = System.nanoTime() + 100; + this.lastAttack = System.currentTimeMillis() + 10; + } else { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + this.fr.drawString("8[f0 bblocks8]", getX(),getY(), -1, false); + + } + } else if(color.getMode().equals("Red")) { + if(mc.gameSettings.keyBindAttack.isKeyDown()) { + this.fr.drawString("8[f" + this.getFormatter().format(hitRange) + " 4blocks8]", getX(),getY(), -1, false); + + //this.lastAttack = System.nanoTime() + 100; + this.lastAttack = System.currentTimeMillis() + 10; + } else { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + this.fr.drawString("8[f0 4blocks8]", getX(),getY(), -1, false); + + } + } else if(color.getMode().equals("Purple")) { + if(mc.gameSettings.keyBindAttack.isKeyDown()) { + this.fr.drawString("8[f" + this.getFormatter().format(hitRange) + " 5blocks8]", getX(),getY(), -1, false); + + //this.lastAttack = System.nanoTime() + 100; + this.lastAttack = System.currentTimeMillis() + 10; + } else { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + this.fr.drawString("8[f0 5blocks8]", getX(),getY(), -1, false); + + } + } else if(color.getMode().equals("Chroma")) { + if(mc.gameSettings.keyBindAttack.isKeyDown()) { + ChromaString.drawChromaString("[" + this.getFormatter().format(hitRange) + " blocks]", getX(),getY(), -1); + + //this.lastAttack = System.nanoTime() + 100; + this.lastAttack = System.currentTimeMillis() + 10; + } else { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + ChromaString.drawChromaString("[0 blocks]", getX(),getY(), -1); + + } + } else if(color.getMode().equals("White")) { + if(mc.gameSettings.keyBindAttack.isKeyDown()) { + this.fr.drawStringWithShadow("[" + this.getFormatter().format(hitRange) + " blocks]", getX(),getY(), -1); + this.lastAttack = System.currentTimeMillis() + 10; + } else { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + this.fr.drawStringWithShadow("[0 blocks]", getX(),getY(), -1); + } + } + //this.lastAttack = System.nanoTime() + 100; + + + //} + } + @Override + public void renderDummy(int mouseX, int mouseY) { + fr.drawStringWithShadow("[2 blocks]", getX(), getY(), -1); + + super.renderDummy(mouseX, mouseY); + } + + @EventTarget + public void onHit(AttackEntityEvent event) + { + final Vec3 vec3 = this.mc.getRenderViewEntity().getPositionEyes(1.0F); + double hitRange = this.mc.objectMouseOver.hitVec.distanceTo(vec3); + + ReachDisplay = this.getFormatter().format(hitRange) + " blocks"; + + this.lastAttack = System.nanoTime(); + } + + private DecimalFormat getFormatter() + { + StringBuilder format = new StringBuilder("0"); + for (int i = 0; this.decimals > i; i++) + { + format.append('0'); + } + return new DecimalFormat(format.toString()); + } + + @EventTarget + public void onTick(ClientTick event) + { + if (System.nanoTime() - this.lastAttack >= 2.0E9 && this.enabled) + { + ReachDisplay = "Hasn't attacked"; + } + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/ScrollZoom.java b/src/minecraft/animeware/hud/mod/Mods/ScrollZoom.java new file mode 100644 index 0000000..998963e --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/ScrollZoom.java @@ -0,0 +1,32 @@ +package animeware.hud.mod.Mods; + +import animeware.cosmetic.Booleans; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class ScrollZoom extends HudMod { + + public ScrollZoom() { + super("ScrollZoom", "Multiplies zoom by scrolling", new ResourceLocation("Animeware/icons/search.png"), 0, 0); + } + @Override + public void onEnable() { + Booleans.ScrollZoom = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.ScrollZoom = false; + //super.onDisable(); + } + @Override + public int getWidth() { + return 0; + } + + @Override + public int getHeight() { + return 0; + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/ServerIP.java b/src/minecraft/animeware/hud/mod/Mods/ServerIP.java new file mode 100644 index 0000000..8303f95 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/ServerIP.java @@ -0,0 +1,68 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; + +public class ServerIP extends HudMod{ + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public ServerIP() { + super("ServerIP", "Displays server ip", new ResourceLocation("Animeware/icons/servers.png"), 0, 21); + this.addSettings(color); + } + + @Override + public void draw() { + String address = "Singleplayer"; + if( Minecraft.getMinecraft().getCurrentServerData() != null) { + address = Minecraft.getMinecraft().getCurrentServerData().serverIP; + } + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("8[1IP:f" + address + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("8[bIP:f" + address + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("8[4IP:f" + address + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("8[5IP:f" + address + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("[IP:" + address + "]", getX(), getY(), -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow("8[fIP:f" + address + "8]", getX(), getY(), -1); + } + super.draw(); + } + + + @Override + public void renderDummy(int mouseX, int mouseY) { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + fr.drawStringWithShadow("8[fIP:fhypixel.net8]", getX(), getY(), -1); + + super.renderDummy(mouseX, mouseY); + } + + @Override + public int getWidth() { + String address = "Singleplayer"; + if( Minecraft.getMinecraft().getCurrentServerData() != null) { + address = Minecraft.getMinecraft().getCurrentServerData().serverIP; + } + return fr.getStringWidth("8[fIP:f" + address + "8]"); + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/SmallSword.java b/src/minecraft/animeware/hud/mod/Mods/SmallSword.java new file mode 100644 index 0000000..9313b0d --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/SmallSword.java @@ -0,0 +1,23 @@ +package animeware.hud.mod.Mods; + +import animeware.cosmetic.Booleans; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class SmallSword extends HudMod { + + public SmallSword() { + super("SmallSword", "Makes held items small", new ResourceLocation("Animeware/icons/placeholder.png"), 0, 0); + } + @Override + public void onEnable() { + Booleans.SmallSword = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.SmallSword = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/SwordSpin.java b/src/minecraft/animeware/hud/mod/Mods/SwordSpin.java new file mode 100644 index 0000000..7583e55 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/SwordSpin.java @@ -0,0 +1,23 @@ +package animeware.hud.mod.Mods; + +import animeware.cosmetic.Booleans; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class SwordSpin extends HudMod { + + public SwordSpin() { + super("SwordSpin", "Spins your sword while blocking", new ResourceLocation("Animeware/icons/placeholder.png"), 0, 0); + } + @Override + public void onEnable() { + Booleans.SwordSpin = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.SwordSpin = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/TNTTimer.java b/src/minecraft/animeware/hud/mod/Mods/TNTTimer.java new file mode 100644 index 0000000..160e057 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/TNTTimer.java @@ -0,0 +1,32 @@ +package animeware.hud.mod.Mods; + +import animeware.cosmetic.Booleans; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class TNTTimer extends HudMod { + + public TNTTimer() { + super("TNTTimer", "Displays time until TNT explodes", new ResourceLocation("Animeware/icons/timedisplay.png"), 0, 0); + } + @Override + public void onEnable() { + Booleans.TNTTimer = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.TNTTimer = false; + //super.onDisable(); + } + @Override + public int getWidth() { + return 0; + } + + @Override + public int getHeight() { + return 0; + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/TargetHUD.java b/src/minecraft/animeware/hud/mod/Mods/TargetHUD.java new file mode 100644 index 0000000..417dbac --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/TargetHUD.java @@ -0,0 +1,125 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.render.RoundedUtils; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ResourceLocation; + +public class TargetHUD extends HudMod { + + EntityLivingBase target; + + private Color healthColor; + private int healthRect; + + //public BooleanSetting Test = new BooleanSetting("Test", false); + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public TargetHUD() { + super("TargetHUD", "Enemy health", new ResourceLocation("Animeware/icons/placeholder.png"), 450, 120); + this.addSettings(color); + } + + @Override + public void draw() { + tenderTargetHud(); + + super.draw(); + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + RoundedUtils.drawSmoothRoundedRect(getX(), getY(), getX() + getWidth(), getY() + getHeight(), 7,new Color(0, 0, 0, 170).getRGB()); + fr.drawStringWithShadow("TargetName", getX() + 2, getY() + 2, -1); + fr.drawStringWithShadow("10 \u2764", getX() + 2, getY() + 2 + fr.FONT_HEIGHT, -1); + + super.renderDummy(mouseX, mouseY); + } + + @Override + public int getWidth() { + return 62; + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT * 2 + 4; + } + + + private void tenderTargetHud() { + target = (EntityLivingBase) mc.pointedEntity; + + if(target !=null) { + RoundedUtils.drawSmoothRoundedRect(getX() - 20, getY(), getX() + getWidth(), getY() + getHeight() + 3, 7,new Color(0, 0, 0, 170).getRGB()); + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("1" + target.getName(), getX() + 2, getY() + 2, -1); + fr.drawStringWithShadow((int)target.getHealth() + " \u2764", getX() + 2, getY() + 2 + fr.FONT_HEIGHT, -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("b" + target.getName(), getX() + 2, getY() + 2, -1); + fr.drawStringWithShadow((int)target.getHealth() + " \u2764", getX() + 2, getY() + 2 + fr.FONT_HEIGHT, -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("4" + target.getName(), getX() + 2, getY() + 2, -1); + fr.drawStringWithShadow((int)target.getHealth() + " \u2764", getX() + 2, getY() + 2 + fr.FONT_HEIGHT, -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("5" + target.getName(), getX() + 2, getY() + 2, -1); + fr.drawStringWithShadow((int)target.getHealth() + " \u2764", getX() + 2, getY() + 2 + fr.FONT_HEIGHT, -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString(target.getName(), getX() + 2, getY() + 2, -1); + ChromaString.drawChromaString((int)target.getHealth() + " \u2764", getX() + 2, getY() + 2 + fr.FONT_HEIGHT, -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow(target.getName(), getX() + 2, getY() + 2, -1); + fr.drawStringWithShadow((int)target.getHealth() + " \u2764", getX() + 2, getY() + 2 + fr.FONT_HEIGHT, -1); + } + GuiInventory.drawEntityOnScreen(getX() - 8, getY() + 22, 10, 50, 50, target); + drawEntityHealth(); + /*mc.getRenderItem().renderItemAndEffectIntoGUI(target.getCurrentArmor(3), getX() + 45, getY() + 30); + mc.getRenderItem().renderItemAndEffectIntoGUI(target.getCurrentArmor(2), getX() + 60, getY() + 30); + mc.getRenderItem().renderItemAndEffectIntoGUI(target.getCurrentArmor(1), getX() + 75, getY() + 30); + mc.getRenderItem().renderItemAndEffectIntoGUI(target.getCurrentArmor(0), getX() + 90, getY() + 30);*/ + + //Gui.drawScaledCustomSizeModalRect(330, 365, 8F, 8F, 8, 8, 20, 20, 64F, 64F); + } + } + private void drawEntityHealth() { + EntityLivingBase currentTarget = (EntityLivingBase) this.mc.pointedEntity; + + if(currentTarget.getHealth() >= currentTarget.getMaxHealth()) { + healthColor = new Color(0, 255, 0, 255); + healthRect = 55; + } else if (currentTarget.getHealth() >= 17) { + healthColor = new Color(255, 242, 0, 255); + healthRect = 45; + } else if (currentTarget.getHealth() >= 14) { + healthColor = new Color(173, 117, 3, 255); + healthRect = 35; + } else if (currentTarget.getHealth() >= 11) { + healthColor = new Color(173, 80, 3, 255); + healthRect = 25; + } else if (currentTarget.getHealth() >= 8) { + healthColor = new Color(173, 80, 3, 255); + healthRect = 15; + } else if (currentTarget.getHealth() >= 5) { + healthColor = new Color(184, 43, 0, 255); + healthRect = 5; + } else if (currentTarget.getHealth() <= 2) { + healthColor = new Color(255, 0, 0, 255); + healthRect = 0; + }else if (currentTarget.getHealth() <= 0) { + healthColor = new Color(255, 0, 0, 255); + healthRect = 0; + } + + //Gui.drawRect(getX() + 77, getY(), getX() + 79, getY() + getHeight(), healthColor.getRGB()); + //154 + RoundedUtils.drawSmoothRoundedRect(getX() + 3, getY() + 21, getX() + healthRect + 3, getY() + 23, 2, healthColor.getRGB()); + + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/TimeChanger.java b/src/minecraft/animeware/hud/mod/Mods/TimeChanger.java new file mode 100644 index 0000000..e20d9df --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/TimeChanger.java @@ -0,0 +1,32 @@ +package animeware.hud.mod.Mods; + +import animeware.cosmetic.Booleans; +import animeware.event.EventTarget; +import animeware.event.impl.EventUpdate; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class TimeChanger extends HudMod { + + public TimeChanger() { + super("TimeChanger", "Changes world time", new ResourceLocation("Animeware/icons/glacier/timechanger.png"), 0, 0); + } + + @Override + public void onEnable() { + + + + + Booleans.timechanger = true; + //super.onEnable(); + } + @Override + public void onDisable() { + //mc.thePlayer.setSprinting(false); + + Booleans.timechanger = false; + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/TimeMod.java b/src/minecraft/animeware/hud/mod/Mods/TimeMod.java new file mode 100644 index 0000000..996a556 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/TimeMod.java @@ -0,0 +1,79 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; + +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; + +public class TimeMod extends HudMod { + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public TimeMod() { + super("TimeMod", "Displays real time", new ResourceLocation("Animeware/icons/timedisplay.png"), 0, 61); + this.addSettings(color); + } + + @Override + public void draw() { + + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm"); + LocalTime localTime = LocalTime.now(); + String time = dtf.format(localTime); + //Minecraft.getMinecraft().fontRendererObj.drawString(time, getX(), getY(), -1); + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("8[1" + time + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("8[b" + time + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("8[4" + time + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("8[5" + time + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("[" + time + "]", getX(), getY(), -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow("8[f" + time + "8]", getX(), getY(), -1); + } + + } + @Override + public void renderDummy(int mouseX, int mouseY) { + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm"); + LocalTime localTime = LocalTime.now(); + String time = dtf.format(localTime); + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("8[1" + time + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("8[b" + time + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("8[4" + time + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("8[5" + time + "8]", getX(), getY(), -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("[" + time + "]", getX(), getY(), -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow("8[f" + time + "8]", getX(), getY(), -1); + } + super.renderDummy(mouseX, mouseY); + } + + @Override + public int getWidth() { + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm"); + LocalTime localTime = LocalTime.now(); + String time = dtf.format(localTime); + return fr.getStringWidth("8[f" + time + "8]"); + } + + @Override + public int getHeight() { + return 10; + } +} diff --git a/src/minecraft/animeware/hud/mod/Mods/ToggleSprint3.java b/src/minecraft/animeware/hud/mod/Mods/ToggleSprint3.java new file mode 100644 index 0000000..1b37d27 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/ToggleSprint3.java @@ -0,0 +1,77 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.event.EventTarget; +import animeware.event.impl.EventUpdate; +import animeware.hud.Category; +import animeware.hud.mod.HudMod; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; + +public class ToggleSprint3 extends HudMod { + float prevGamma = mc.gameSettings.gammaSetting; + + boolean sprintingToggle = false; + boolean startup = true; + + public ToggleSprint3() { + super("ToggleSprint", "Toggles sprinting", new ResourceLocation("Animeware/icons/togglesprint.png"), 0, 81); + } + + public void onDisable() { + //if(startup == false) + //mc.thePlayer.setSprinting(false); + super.onDisable(); + } + + @EventTarget + public void update(EventUpdate e) { + if (mc.gameSettings.keyBindSprint.isPressed()) + this.sprintingToggle = !this.sprintingToggle; + if (this.sprintingToggle && + !this.mc.thePlayer.isOnLadder() && mc.gameSettings.keyBindForward.isKeyDown() && !this.mc.thePlayer.isCollidedHorizontally && !this.mc.thePlayer.isBlocking() && !this.mc.thePlayer.isSneaking()) + this.mc.thePlayer.setSprinting(true); + } + + @Override + public void draw() { + startup = true; + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + String state = "(Standing)"; + //Gui.drawRect(this.x, this.y, this.x + this.w, this.y + this.h, -2147483648); + if (this.mc.thePlayer.isSprinting() && !this.sprintingToggle && this.mc.gameSettings.keyBindForward.isKeyDown()) { + state = "(Vanilla)"; + } + else if(this.sprintingToggle && this.mc.gameSettings.keyBindForward.isKeyDown()) { + state = "(Toggled)"; + } + else if(!this.mc.thePlayer.isSprinting() && !this.mc.gameSettings.keyBindForward.isKeyDown()) { + state = "(Standing)"; + } + else if(!this.sprintingToggle && this.mc.gameSettings.keyBindForward.isKeyDown()) { + state = "(Walking)"; + } + + fr.drawStringWithShadow("[Sprinting " + state + "]", getX(), getY(), -1); + //super.draw(); + } + @Override + public void renderDummy(int mouseX, int mouseY) { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + fr.drawStringWithShadow("[Sprinting (Toggled)]", getX(), getY(), -1); + super.renderDummy(mouseX, mouseY); + } + @Override + public int getWidth() { + return fr.getStringWidth("[Sprinting (Toggled)]"); + + + } + + @Override + public int getHeight() { + return fr.FONT_HEIGHT; + } +} diff --git a/src/minecraft/animeware/hud/mod/Mods/Watermark.java b/src/minecraft/animeware/hud/mod/Mods/Watermark.java new file mode 100644 index 0000000..d017b66 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/Watermark.java @@ -0,0 +1,32 @@ +package animeware.hud.mod.Mods; + +import animeware.cosmetic.Booleans; +import animeware.hud.mod.HudMod; +import net.minecraft.util.ResourceLocation; + +public class Watermark extends HudMod { + + public Watermark() { + super("Watermark", "Displays client watermark", new ResourceLocation("Animeware/icons/iconWhite.png"), 0, 0); + } + @Override + public void onEnable() { + Booleans.watermark = true; + //super.onEnable(); + } + @Override + public void onDisable() { + Booleans.watermark = false; + //super.onDisable(); + } + @Override + public int getWidth() { + return 0; + } + + @Override + public int getHeight() { + return 0; + } + +} diff --git a/src/minecraft/animeware/hud/mod/Mods/WindowedFullscreenMod.java b/src/minecraft/animeware/hud/mod/Mods/WindowedFullscreenMod.java new file mode 100644 index 0000000..1c13254 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/WindowedFullscreenMod.java @@ -0,0 +1,46 @@ +package animeware.hud.mod.Mods; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.LWJGLException; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; + +import animeware.event.impl.GameLoopEvent; +import animeware.hud.mod.HudMod; + + +public class WindowedFullscreenMod extends HudMod { + private boolean lastFullscreen; + + public WindowedFullscreenMod() { + super("WindowedFullscreen", "Windowed Fullscreen", new ResourceLocation("Animeware/icons/placeholder.png"), 0, 0); + } + + public void onTick(GameLoopEvent event) { + boolean fullScreenNow = Minecraft.getMinecraft().isFullScreen(); + if (this.lastFullscreen != fullScreenNow) { + this.fullScreen(fullScreenNow); + this.lastFullscreen = fullScreenNow; + } + } + + public void fullScreen(boolean fullscreen) { + try { + if (fullscreen) { + System.setProperty("org.lwjgl.opengl.Window.undecorated", "true"); + Display.setDisplayMode(Display.getDesktopDisplayMode()); + Display.setLocation(0, 0); + Display.setFullscreen(false); + Display.setResizable(false); + } else { + System.setProperty("org.lwjgl.opengl.Window.undecorated", "false"); + Display.setDisplayMode(new DisplayMode(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight)); + Display.setResizable(true); + } + } catch (LWJGLException lwjglexception) { + lwjglexception.printStackTrace(); + } + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/hud/mod/Mods/XYZMod.java b/src/minecraft/animeware/hud/mod/Mods/XYZMod.java new file mode 100644 index 0000000..5877df2 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Mods/XYZMod.java @@ -0,0 +1,74 @@ +package animeware.hud.mod.Mods; + +import java.awt.Color; + +import animeware.hud.ScreenPosition; +import animeware.hud.mod.HudMod; +import animeware.util.ChromaString; +import animeware.util.settings.ModeSetting; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; + +public class XYZMod extends HudMod { + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public XYZMod() { + super("XYZMod", "Displays coordinates", new ResourceLocation("Animeware/icons/coordinates.png"), 0, 111); + this.addSettings(color); + } + + private ScreenPosition position; + private Color background = new Color(45, 45, 45, 180); + + @Override + public void draw() { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + if(color.getMode().equals("Blue")) { + fr.drawStringWithShadow("1X:f" + (int) this.mc.getRenderViewEntity().posX, getX(), getY(), -1); + fr.drawStringWithShadow("1Y:f" + (int) this.mc.getRenderViewEntity().posY, getX(), getY() + 10, -1); + fr.drawStringWithShadow("1Z:f" + (int) this.mc.getRenderViewEntity().posZ, getX(), getY() + 20, -1); + } else if(color.getMode().equals("Cyan")) { + fr.drawStringWithShadow("bX:f" + (int) this.mc.getRenderViewEntity().posX, getX(), getY(), -1); + fr.drawStringWithShadow("bY:f" + (int) this.mc.getRenderViewEntity().posY, getX(), getY() + 10, -1); + fr.drawStringWithShadow("bZ:f" + (int) this.mc.getRenderViewEntity().posZ, getX(), getY() + 20, -1); + } else if(color.getMode().equals("Red")) { + fr.drawStringWithShadow("4X:f" + (int) this.mc.getRenderViewEntity().posX, getX(), getY(), -1); + fr.drawStringWithShadow("4Y:f" + (int) this.mc.getRenderViewEntity().posY, getX(), getY() + 10, -1); + fr.drawStringWithShadow("4Z:f" + (int) this.mc.getRenderViewEntity().posZ, getX(), getY() + 20, -1); + } else if(color.getMode().equals("Purple")) { + fr.drawStringWithShadow("5X:f" + (int) this.mc.getRenderViewEntity().posX, getX(), getY(), -1); + fr.drawStringWithShadow("5Y:f" + (int) this.mc.getRenderViewEntity().posY, getX(), getY() + 10, -1); + fr.drawStringWithShadow("5Z:f" + (int) this.mc.getRenderViewEntity().posZ, getX(), getY() + 20, -1); + } else if(color.getMode().equals("Chroma")) { + ChromaString.drawChromaString("X:" + (int) this.mc.getRenderViewEntity().posX, getX(), getY(), -1); + ChromaString.drawChromaString("Y:" + (int) this.mc.getRenderViewEntity().posY, getX(), getY() + 10, -1); + ChromaString.drawChromaString("Z:" + (int) this.mc.getRenderViewEntity().posZ, getX(), getY() + 20, -1); + } else if(color.getMode().equals("White")) { + fr.drawStringWithShadow("X:" + (int) this.mc.getRenderViewEntity().posX, getX(), getY(), -1); + fr.drawStringWithShadow("Y:" + (int) this.mc.getRenderViewEntity().posY, getX(), getY() + 10, -1); + fr.drawStringWithShadow("Z:" + (int) this.mc.getRenderViewEntity().posZ, getX(), getY() + 20, -1); + } + + super.draw(); + } + + @Override + public void renderDummy(int mouseX, int mouseY) { + Gui.drawRect(getX() - 2, getY() - 2, getX() + getWidth(), getY() + getHeight(), new Color(0, 0, 0, 170).getRGB()); + fr.drawStringWithShadow("X:000", getX(), getY(), -1); + fr.drawStringWithShadow("Y:000", getX(), getY() + 10, -1); + fr.drawStringWithShadow("Z:000", getX(), getY() + 20, -1); + super.renderDummy(mouseX, mouseY); + } + + @Override + public int getWidth() { + return fr.getStringWidth("8[fFPS:f" + mc.getDebugFPS() + "8]"); + } + + @Override + public int getHeight() { + return 30; + } +} diff --git a/src/minecraft/animeware/hud/mod/Module.java b/src/minecraft/animeware/hud/mod/Module.java new file mode 100644 index 0000000..d0c1f14 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Module.java @@ -0,0 +1,142 @@ +package animeware.hud.mod; + +import org.lwjgl.input.Mouse; + +import animeware.event.EventManager; +import animeware.hud.Category; +import animeware.util.MouseUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; + +public class Module { + public Minecraft mc = Minecraft.getMinecraft(); + + public FontRenderer fr = this.mc.fontRendererObj; + + protected MouseUtils msu = new MouseUtils(); + + public String name; + + public String description; + + public boolean state; + + public Category cat; + + public float x; + + public float y; + + public float w; + + public float h; + + public float prog = 0.0F; + + public float anim = 22.0F; + + public float dragY; + + public float dragX; + + private boolean drag; + + public Module(String name, String description, Category cat, float x, float y, float w, float h) { + this.name = name; + this.description = description; + this.cat = cat; + this.x = x; + this.y = y; + this.w = w; + this.h = h; + } + + public void onEnable() { + EventManager.register(this); + } + + public void onDisable() { + EventManager.unregister(this); + } + + public void toggle() { + this.state = !this.state; + if (this.state) { + onEnable(); + } else { + onDisable(); + } + } + + public boolean hovered(int mouseX, int mouseY) { + return (mouseX >= getX() + 0.5D && mouseX <= getX() + getW() - 0.5F && mouseY >= getY() + 0.5F && mouseY <= getY() + getH() - 0.5F); + } + + public void drag(int mouseX, int mouseY) { + boolean hovered = (mouseX >= getX() && mouseX <= getX() + getW() && mouseY >= getY() && mouseY <= getY() + getH()); + if (!this.drag && Mouse.isButtonDown(0)) + this.drag = false; + if (this.drag) { + setX(mouseX + this.dragX); + setY(mouseY + this.dragY); + if (!Mouse.isButtonDown(0)) + this.drag = false; + } + if (hovered && Mouse.isButtonDown(0)) { + if (this.x < 0.0F) + setX(0.0F); + if (this.y < 0.0F) + setY(0.0F); + if (!this.drag) { + this.dragX = this.x - mouseX; + this.dragY = this.y - mouseY; + this.drag = true; + } + } + } + + public void draw() { + GlStateManager.color(1.0F, 1.0F, 1.0F); + } + + public float getX() { + if (this.x < 0.0F) + this.x = 0.0F; + return this.x; + } + + public void setX(float x) { + this.x = x; + } + + public float getY() { + if (this.y < 0.0F) + this.y = 0.0F; + return this.y; + } + + public void setY(float y) { + this.y = y; + } + + public float getW() { + return this.w; + } + + public void setW(float w) { + this.w = w; + } + + public float getH() { + return this.h; + } + + public void setH(float h) { + this.h = h; + } + + public void drawCenteredString(String text, float f, float g, int color) { + this.fr.drawStringWithShadow(text, f - (this.fr.getStringWidth(text) / 2), g, color); + } +} diff --git a/src/minecraft/animeware/hud/mod/Side.java b/src/minecraft/animeware/hud/mod/Side.java new file mode 100644 index 0000000..d85fba7 --- /dev/null +++ b/src/minecraft/animeware/hud/mod/Side.java @@ -0,0 +1,9 @@ +package animeware.hud.mod; + +public enum Side { + + LEFT, + RIGHT, + CLIENT; + +} diff --git a/src/minecraft/animeware/login/User.java b/src/minecraft/animeware/login/User.java new file mode 100644 index 0000000..35583e8 --- /dev/null +++ b/src/minecraft/animeware/login/User.java @@ -0,0 +1,41 @@ +package animeware.login; + +public class User { + + public String name, password, hwid, discord; + public boolean staff, banned; + + public User(String name, String password, boolean staff, boolean banned, String hwid, String discord) { + this.name = name; + this.password = password; + this.staff = staff; + this.banned = banned; + this.hwid = hwid; + this.discord = discord; + } + + public String getDiscord() { + return discord; + } + + public String getHwid() { + return hwid; + } + + public String getName() { + return name; + } + + public String getPassword() { + return password; + } + + public boolean isStaff() { + return staff; + } + + public boolean isBanned() { + return banned; + } + +} diff --git a/src/minecraft/animeware/login/UserChecker.java b/src/minecraft/animeware/login/UserChecker.java new file mode 100644 index 0000000..fdb226d --- /dev/null +++ b/src/minecraft/animeware/login/UserChecker.java @@ -0,0 +1,23 @@ +package animeware.login; + +import animeware.NightSky; +import animeware.util.backend.AntiCheat; + +public class UserChecker { + + + public boolean isUser() { + String hwid = AntiCheat.getHWID(); + + for(User u : NightSky.getInstance().getUsers().getUsers()) { + if(u.getHwid() == hwid) { + return true; + } + else return false; + } + return false; + + } + + +} diff --git a/src/minecraft/animeware/login/Users.java b/src/minecraft/animeware/login/Users.java new file mode 100644 index 0000000..ced5e17 --- /dev/null +++ b/src/minecraft/animeware/login/Users.java @@ -0,0 +1,17 @@ +package animeware.login; + +import java.util.ArrayList; + +public class Users { + + public ArrayList users = new ArrayList(); + + public ArrayList getUsers() { + return users; + } + + public void addUsers() { + users.add(new User("hypnomacka", "isVeryCool69", true, false, "none", "hypnomacka#4765")); + } + +} diff --git a/src/minecraft/animeware/ui/CosmeticGUI.java b/src/minecraft/animeware/ui/CosmeticGUI.java new file mode 100644 index 0000000..19e0067 --- /dev/null +++ b/src/minecraft/animeware/ui/CosmeticGUI.java @@ -0,0 +1,503 @@ +package animeware.ui; + +import java.awt.Color; +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; + +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +import animeware.NightSky; +import animeware.cosmetic.CosmeticModule; +import animeware.gui.clickgui.GUITheme; +import animeware.gui.clickgui.GUIType; +import animeware.hud.HUDConfigScreen; +import animeware.hud.mod.HudMod; +import animeware.ui.comp.CosmeticButton; +import animeware.ui.comp.clickgui.ModButton; +import animeware.ui.comp.clickgui.SettingButton; +import animeware.ui.themes.impl.ThemeButton; +import animeware.util.render.ColorMode; +import animeware.util.render.RenderUtil; +import animeware.util.render.ui.ClickGUIUtil; +import net.arikia.dev.drpc.DiscordUser; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ResourceLocation; + +public class CosmeticGUI extends GuiScreen { + + public boolean isCGOn = false; + public boolean cgon; + + private int field_146445_a; + private int field_146444_f; + + float anim = 0.0F; + + private float currentScroll; + + HudMod m; + + public static boolean settings; + + private static String TntTime = "TntTimer"; + + public int x, y, w, h; + + ArrayList cosButtons = new ArrayList<>(); + ArrayList modButtons = new ArrayList<>(); + ArrayList tButtons = new ArrayList<>(); + ArrayList settingButtons = new ArrayList<>(); + + public static GUIType type = GUIType.CLICK; + public static GUITheme theme = GUITheme.DARK; + + public void checkMouseWheel(int mouseX, int mouseY) { + int mouseScroll = Mouse.getDWheel(); + if(mouseScroll > 0) { + for(ModButton b : modButtons) { + b.y += 15; + } + } else if(mouseScroll < 0) { + for(ModButton b : modButtons) { + b.y -= 15; + } + } + } + public void checkMouseWheelCosmetic(int mouseX, int mouseY) { + int mouseScrollCos = Mouse.getDWheel(); + if(mouseScrollCos > 0) { + for(CosmeticButton b : cosButtons) { + b.y += 15; + } + } else if(mouseScrollCos < 0) { + for(CosmeticButton b : cosButtons) { + b.y -= 15; + } + } + } + + @Override + public void initGui() { + super.initGui(); + mc.entityRenderer.loadShader(new ResourceLocation("Animeware/blur.json")); + this.anim = 80.0F; + super.initGui(); + this.field_146445_a = 0; + this.buttonList.clear(); + int i = -16; + int j = 98; + + + /*this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 165, 323, 35, NightSky.INSTANCE.cosManager.darkCape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 205, 323, 35, NightSky.INSTANCE.cosManager.deamoneyes)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 245, 323, 35, NightSky.INSTANCE.cosManager.deamoneyes2)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 285, 323, 35, NightSky.INSTANCE.cosManager.ecape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 325, 323, 35, NightSky.INSTANCE.cosManager.gblack)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 365, 323, 35, NightSky.INSTANCE.cosManager.gblue)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 405, 323, 35, NightSky.INSTANCE.cosManager.ggreen)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 445, 323, 35, NightSky.INSTANCE.cosManager.gpurple)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 485, 323, 35, NightSky.INSTANCE.cosManager.gred)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 525, 323, 35, NightSky.INSTANCE.cosManager.kcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 565, 323, 35, NightSky.INSTANCE.cosManager.kcape2)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 605, 323, 35, NightSky.INSTANCE.cosManager.lcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 645, 323, 35, NightSky.INSTANCE.cosManager.ncape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 685, 323, 35, NightSky.INSTANCE.cosManager.pcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 725, 323, 35, NightSky.INSTANCE.cosManager.quavcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 765, 323, 35, NightSky.INSTANCE.cosManager.quickcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 805, 323, 35, NightSky.INSTANCE.cosManager.rcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 845, 323, 35, NightSky.INSTANCE.cosManager.scape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 885, 323, 35, NightSky.INSTANCE.cosManager.tcape)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 925, 323, 35, NightSky.INSTANCE.cosManager.sofyt)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 965, 323, 35, NightSky.INSTANCE.cosManager.sofyt2)); + + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 1005, 323, 35, NightSky.INSTANCE.cosManager.dwings)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 1045, 323, 35, NightSky.INSTANCE.cosManager.gwings)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 1085, 323, 35, NightSky.INSTANCE.cosManager.cwings)); + + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 1125, 323, 35, NightSky.INSTANCE.cosManager.eggs)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 1165, 323, 35, NightSky.INSTANCE.cosManager.witchhat)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 1205, 323, 35, NightSky.INSTANCE.cosManager.glasses)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 1245, 323, 35, NightSky.INSTANCE.cosManager.halo)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 1285, 323, 35, NightSky.INSTANCE.cosManager.retardeyes)); + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 161, 1325, 323, 35, NightSky.INSTANCE.cosManager.blaze));*/ + + int countCosmetic = 40; + for(CosmeticModule m : NightSky.INSTANCE.cosManager.cosmetics) { + if(m.name == "Owner Cape" || m.name == "Staff Cape" || m.name == "Creeper Lightning Cosmetic" || m.name == "YT Cape") { + + } else { + this.cosButtons.add(new CosmeticButton(this.width/ 2 - 139,this.height / 2 - 145 + countCosmetic, 323, 35, m)); + countCosmetic = countCosmetic + 40; + //System.out.println(countModule); + } + } + + + //this.buttonList.add(new LogoButtonWhite(69, this.width / 2 - 186, this.height / 2 - 109, "")); + //this.buttonList.add(new HomeCGButton(1, this.width / 2 - 188, this.height / 2 - 70, "")); + //this.buttonList.add(new CosmeticsCGButton(3, this.width / 2 - 188, this.height / 2 - 40, "")); + //this.buttonList.add(new ToggleableCGButton(2, this.width / 2 - 188, this.height / 2 - 12, "")); + //this.buttonList.add(new ServersCGButton(4, this.width / 2 - 188, this.height / 2 + 30, "")); + //this.buttonList.add(new SettingsCGButton(5, this.width / 2 - 188, this.height / 2 + 60, "")); + + +} + + + + @Override + protected void actionPerformed(GuiButton button) throws IOException { + if(button.id == 1) { + type = GUIType.CLICK; + mc.displayGuiScreen(new CosmeticGUI()); + //mc.displayGuiScreen(new ClickGUI()); + + } + if(button.id == 5) { + mc.displayGuiScreen(new HUDConfigScreen()); + } + if(button.id == 3) { + setType(GUIType.COSMETIC); + mc.displayGuiScreen(new CosmeticGUI()); + //type = GUIType.COSMETIC; + //mc.displayGuiScreen(new CosmeticGUINew()); + } + if(button.id == 2) { + setType(GUIType.PROFILE); + mc.displayGuiScreen(new CosmeticGUI()); + //type = GUIType.PROFILE; + //mc.displayGuiScreen(new ClickGUI2()); + } + if(button.id == 4) { + setType(GUIType.THEME); + mc.displayGuiScreen(new CosmeticGUI()); + //mc.displayGuiScreen(new GuiMultiplayerIngame()); + } + if(button.id == 6) { + try { + Desktop desktop = java.awt.Desktop.getDesktop(); + URI oURL = new URI("http://hynomacka.ddns.net"); + desktop.browse(oURL); + } catch (Exception e) { + e.printStackTrace(); + } + } + + if(button.id == 8) { + type = GUIType.COSMETIC; + mc.displayGuiScreen(new CosmeticGUI()); + //mc.displayGuiScreen(new CosmeticGUINew()); + } + if(button.id == 9) { + mc.displayGuiScreen(new CosmeticGUI()); + } + if(button.id == 0) { + type = GUIType.PROFILE; + mc.displayGuiScreen(new CosmeticGUI()); + //mc.displayGuiScreen(new ProfileCGui(null)); + } + } + +//} + public static void setType(GUIType killme) { + if(killme == GUIType.CLICK) { + type = GUIType.CLICK; + //this.m = null; + } else if(killme == GUIType.COSMETIC) { + type = GUIType.COSMETIC; + //this.m = null; + } else if(killme == GUIType.PROFILE) { + type = GUIType.PROFILE ; + //this.m = null; + }else if(killme == GUIType.THEME) { + type = GUIType.THEME ; + } + } + public static void setTheme(GUITheme killme) { + if(killme == GUITheme.DARK) { + theme = GUITheme.DARK; + //this.m = null; + } else if(killme == GUITheme.LIGHT) { + theme = GUITheme.LIGHT; + //this.m = null; + } + } + + //public ParticleEngine engine = new ParticleEngine(); + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + + //FontUtilCedo.normal.drawString("l", 340, 135, new Color(50, 50, 50, 255).getRGB()); + + GL11.glColor4f(1F, 1F, 1F, 1F); + GlStateManager.enableAlpha(); + GlStateManager.enableBlend(); + + ScaledResolution sr = new ScaledResolution(mc); + + ClickGUIUtil.renderCosmeticMenu(); + + /*RoundedUtils.drawSmoothRoundedRect((this.width / 2 - 190), (this.height / 2 - 110), (this.width / 2 + 190), (this.height / 2 + 110), 18.0F, new Color(25, 25, 30, 255).getRGB()); + RoundedUtils.drawSmoothRoundedRect((this.width / 2 - 190), (this.height / 2 - 110), (this.width / 2 - 150), (this.height / 2 + 110), 18.0F, new Color(50, 50, 55, 155).getRGB()); + RoundedUtils.drawSmoothRoundedRect((this.width / 2 + 90), (this.height / 2 - 110), (this.width / 2 + 190), (this.height / 2 + 110), 18.0F, new Color(50, 50, 55, 155).getRGB()); + RoundedUtils.drawSmoothRoundedRect((this.width / 2 - 185), (this.height / 2 - 74), (this.width / 2 - 155), (this.height / 2 - 72), 4.0F, new Color(100, 100, 105, 255).getRGB()); + + + //Gui.drawHorizontalLine(this.width / 2 - 185, this.height / 2 - 63 , this.height / 2 - 77, -1); + + + /*DrawUtil.draw2DImage(new ResourceLocation("Animeware/nightskywhite.png"), this.width / 2 - 189 + 3, this.height / 2 - 112 + 3, 30, 30, Color.WHITE); + if(type == GUIType.CLICK) { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/home.png"), this.width / 2 - 188 + 3, this.height / 2 - 70 + 3, 30, 30, Color.WHITE); + } else { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/home.png"), this.width / 2 - 188 + 3, this.height / 2 - 70 + 3, 30, 30, Color.GRAY); + } + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/positioning.png"), this.width / 2 - 188 + 3, this.height / 2 + 60 + 3, 30, 30, Color.WHITE); + if(type == GUIType.COSMETIC) { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/cosmetics.png"), this.width / 2 - 188 + 3, this.height / 2 - 40 + 3, 30, 30, Color.WHITE); + } else { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/cosmetics.png"), this.width / 2 - 188 + 3, this.height / 2 - 40 + 3, 30, 30, Color.GRAY); + } if(type == GUIType.PROFILE) { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/togglesprint.png"), this.width / 2 - 188 + 3, this.height / 2 - 5 - 2, 30, 30, Color.WHITE); + } else { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/togglesprint.png"), this.width / 2 - 188 + 3, this.height / 2 - 5 - 2, 30, 30, Color.GRAY); + } if(type == GUIType.THEME) { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/settings.png"), this.width / 2 - 188 + 3, this.height / 2 + 30 - 2, 30, 30, Color.WHITE); + } else { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/settings.png"), this.width / 2 - 188 + 3, this.height / 2 + 30 - 2, 30, 30, Color.GRAY); + }*/ + + try { + if(MinecraftServer.getServer().isSinglePlayer()) { + + NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()); + if(playerInfo != null) { + GL11.glColor4f(1F, 1F, 1F, 1F); + } + } else if(Minecraft.getMinecraft().getCurrentServerData() != null) { + NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()); + if(playerInfo != null) { + GL11.glColor4f(1F, 1F, 1F, 1F); + } + + } else { + + } + } catch(NullPointerException e) { + e.printStackTrace(); + } + + GL11.glDisable(GL11.GL_SCISSOR_TEST); + checkMouseWheelCosmetic(mouseX, mouseY); + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_SCISSOR_BIT); + { + RenderUtil.scissor(this.width / 2 - 190, this.height / 2 - 110, this.width / 2 + 190, this.height / 2 + 110); + //RenderUtil.scissor2(this.width / 2 - 190, this.height / 2 - 110, 1920, 1080); + //RenderUtil.scissor(this.width / 2 - 100, -300, 1920, 1080); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + for(CosmeticButton cos : cosButtons) { + cos.draw(); + } + GL11.glDisable(GL11.GL_SCISSOR_TEST); + GL11.glPopAttrib(); + GL11.glPopMatrix(); + /*else if(type == GUIType.PROFILE) { + GL11.glDisable(GL11.GL_SCISSOR_TEST); + checkMouseWheelCosmetic(mouseX, mouseY); + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_SCISSOR_BIT); + { + RenderUtil.scissor(this.width / 2 - 190, this.height / 2 - 110, this.width / 2 + 190, this.height / 2 + 110); + //RenderUtil.scissor2(this.width / 2 - 190, this.height / 2 - 110, 1920, 1080); + //RenderUtil.scissor(this.width / 2 - 100, -300, 1920, 1080); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + for(CosmeticButton cos : cosButtons) { + cos.draw(); + } + GL11.glDisable(GL11.GL_SCISSOR_TEST); + GL11.glPopAttrib(); + GL11.glPopMatrix(); + }*/ + + + +} + + + + + + //@Override + public int dname(DiscordUser user) { + return fontRendererObj.drawString(user.username + "#" + user.discriminator, 352, 373, ColorMode.getWhiteColor()); + } + + @Override + public void draw() { + + GL11.glColor4f(1F, 1F, 1F, 1F); + + Playerdraw(15 + 15, 15 + 50, 25, 50, 0, null); + + super.draw(); + } + public static void Playerdraw(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent) + { + if(MinecraftServer.getServer().isSinglePlayer()) { + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)posX, (float)posY, 50.0F); + GlStateManager.scale((float)(-65), (float)65, (float)65); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + float f = ent.renderYawOffset; + float f1 = ent.rotationYaw; + float f2 = ent.rotationPitch; + float f3 = ent.prevRotationYawHead; + float f4 = ent.rotationYawHead; + GlStateManager.rotate(155.0F, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); + ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F; + ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F; + ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F; + ent.rotationYawHead = ent.rotationYaw; + ent.prevRotationYawHead = ent.rotationYaw; + GlStateManager.translate(0.0F, 0.0F, 0.0F); + RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); + rendermanager.setPlayerViewY(180.0F); + rendermanager.setRenderShadow(false); + rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + rendermanager.setRenderShadow(true); + ent.renderYawOffset = f; + ent.rotationYaw = f1; + ent.rotationPitch = f2; + ent.prevRotationYawHead = f3; + ent.rotationYawHead = f4; + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } else if(Minecraft.getMinecraft().getCurrentServerData() != null) { + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)posX, (float)posY, 50.0F); + GlStateManager.scale((float)(-65), (float)65, (float)65); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + float f = ent.renderYawOffset; + float f1 = ent.rotationYaw; + float f2 = ent.rotationPitch; + float f3 = ent.prevRotationYawHead; + float f4 = ent.rotationYawHead; + GlStateManager.rotate(155.0F, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); + ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F; + ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F; + ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F; + ent.rotationYawHead = ent.rotationYaw; + ent.prevRotationYawHead = ent.rotationYaw; + GlStateManager.translate(0.0F, 0.0F, 0.0F); + RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); + rendermanager.setPlayerViewY(180.0F); + rendermanager.setRenderShadow(false); + rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + rendermanager.setRenderShadow(true); + ent.renderYawOffset = f; + ent.rotationYaw = f1; + ent.rotationPitch = f2; + ent.prevRotationYawHead = f3; + ent.rotationYawHead = f4; + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } else { + + } + } + + + + @Override + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + for(ModButton m : modButtons) { + m.onClick(mouseX, mouseY, mouseButton); + } + for(CosmeticButton cos : cosButtons) { + cos.onClick(mouseX, mouseY, mouseButton); + } + super.mouseClicked(mouseX, mouseY, mouseButton); + } + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } + + @Override + public void onGuiClosed() { + super.onGuiClosed(); + mc.entityRenderer.stopUseShader(); + } + + +} diff --git a/src/minecraft/animeware/ui/DragGUI.java b/src/minecraft/animeware/ui/DragGUI.java new file mode 100644 index 0000000..663f8d5 --- /dev/null +++ b/src/minecraft/animeware/ui/DragGUI.java @@ -0,0 +1,173 @@ +package animeware.ui; + +import java.awt.Color; +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; + +import animeware.NightSky; +import animeware.gui.clickgui.ClickGUI; +import animeware.gui.mainmenu.QuitButton; +import animeware.hud.Category; +import animeware.hud.DraggableComponent; +import animeware.hud.mod.HudMod; +import animeware.hud.mod.Module; +import animeware.ui.comp.CosmeticButton; +import animeware.ui.comp.clickgui.ModButton; +import animeware.ui.comp.clickgui.SettingButton; +import animeware.ui.login.LoginScreen; +import animeware.util.notification.Notification; +import animeware.util.notification.NotificationManager; +import animeware.util.notification.NotificationType; +import animeware.util.render.ColorUtil; +import animeware.util.render.DrawUtil; +import animeware.util.render.RenderUtil; +import animeware.util.render.RoundedUtils; +import animeware.util.settings.Setting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiMultiplayer; +import net.minecraft.client.gui.GuiOptions; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiSelectWorld; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ResourceLocation; + +public class DragGUI extends GuiScreen { + + boolean hovered; + public DraggableComponent top; + public int x, y; + public Category viewing; + public HudMod configuring; + public static GuiTextField username; + ArrayList textFields = new ArrayList<>(); + EntityLivingBase entity; + static float rotate; + GuiScreen guiScreen; + //int Button; + + public DragGUI() { + //this.x = x; + //this.y = y; + + this.top = new DraggableComponent(100, 100, 177, 20, new Color(0,140,255, 0).getRGB()); + } + + @Override + public void initGui() { + //this.buttonList.add(new QuitButton(1, top.getxPosition() - 27, top.getyPosition(), "")); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + try { + this.hovered = (mouseX >= top.getxPosition() + 180 && mouseY >= top.getyPosition() + 2 && mouseX < top.getxPosition() + 180 + 17 && mouseY < top.getyPosition() + 2 + 15); + + //Playerdraw(top.getxPosition(), top.getyPosition() + 100, 10000, 50.0F, 0.0F, (EntityLivingBase)Minecraft.thePlayer); + Playerdraw(top.getxPosition() + 42, top.getyPosition() + 100, 25, 0, 0, mc.thePlayer); + RoundedUtils.drawSmoothRoundedRect(top.getxPosition(), top.getyPosition(), top.getxPosition() + 200, top.getyPosition() + 110, 18.0f, new Color(25, 25, 30, 255).getRGB()); + mc.fontRendererObj.drawString(NightSky.mcname, top.getxPosition() + 70, top.getyPosition() + 82, new Color(255, 255, 254, 255).getRGB()); + mc.fontRendererObj.drawString(NightSky.rank(), top.getxPosition() + 70, top.getyPosition() + 92, new Color(255, 255, 254, 255).getRGB()); + //mc.fontRendererObj.drawString(NightSky.DisName, top.getxPosition() + 70, top.getyPosition() + 45, new Color(255, 255, 254, 255).getRGB()); + //mc.fontRendererObj.drawString(NightSky.DisTag, top.getxPosition() + 70, top.getyPosition() + 55, new Color(255, 255, 254, 255).getRGB()); + if(hovered) { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/quit.png"), top.getxPosition() + 180, top.getyPosition() + 2, 15, 15, new Color(255, 0, 0)); + //if(Button == 1) { + + //} + //mc.displayGuiScreen(new ClickGUI()); + } else { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/quit.png"), top.getxPosition() + 180, top.getyPosition() + 2, 15, 15, Color.white); + } + + //Gui.drawRect(top.getxPosition() - 3, top.getyPosition() - 3, top.getxPosition() + 423, top.getyPosition() + 328, -1); + //Gui.drawRect(top.getxPosition(), top.getyPosition() + 5, top.getxPosition() + 420, top.getyPosition() + 325, new Color(33,33,33).getRGB()); + top.draw(mouseX, mouseY); + } catch (NullPointerException e) { + System.out.println("GUI ERROR"); + } + super.drawScreen(mouseX, mouseY, partialTicks); + } + @Override + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + if(hovered) { + if(mouseButton == 0) { + mc.displayGuiScreen(new ClickGUI()); + } + } + super.mouseClicked(mouseX, mouseY, mouseButton); + + } + @Override + protected void actionPerformed(GuiButton button) throws IOException { + if(button.id == 1) { + //mc.displayGuiScreen(new GuiSelectWorld(this)); + } + super.actionPerformed(button); + } + + + + + + public static void Playerdraw(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent) + { + try { + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)posX, (float)posY, 50.0F); + GlStateManager.scale((float)(-40), (float)42, (float)42); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + float f = ent.renderYawOffset; + float f1 = ent.rotationYaw; + float f2 = ent.rotationPitch; + float f3 = ent.prevRotationYawHead; + float f4 = ent.rotationYawHead; + GlStateManager.rotate(180f, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); + ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F; + ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F; + ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F; + ent.rotationYawHead = ent.rotationYaw; + ent.prevRotationYawHead = ent.rotationYaw; + GlStateManager.translate(0.0F, 0.0F, 0.0F); + RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); + rendermanager.setPlayerViewY(180.0F); + rendermanager.setRenderShadow(false); + rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + rendermanager.setRenderShadow(true); + ent.renderYawOffset = f; + ent.rotationYaw = f1; + ent.rotationPitch = f2; + ent.prevRotationYawHead = f3; + ent.rotationYawHead = f4; + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } catch (NullPointerException e) { + System.out.println("Playerdraw ERROR"); + } + + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + +} diff --git a/src/minecraft/animeware/ui/GuiLoginMicrosoft.java b/src/minecraft/animeware/ui/GuiLoginMicrosoft.java new file mode 100644 index 0000000..eda006f --- /dev/null +++ b/src/minecraft/animeware/ui/GuiLoginMicrosoft.java @@ -0,0 +1,95 @@ +package animeware.ui; + +import java.io.IOException; + +import org.lwjgl.input.Keyboard; + +import animeware.util.account.SessionChanger; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.resources.I18n; + +public class GuiLoginMicrosoft extends GuiScreen { + private GuiTextField username, password; + + @Override + protected void actionPerformed(final GuiButton button) { + if (button.id == 0) { + if(this.username.getText().equals("")) { + this.mc.displayGuiScreen(new GuiLoginMicrosoft()); + } else { + SessionChanger.getInstance().setUserMicrosoft(this.username.getText(), this.password.getText()); + } + + } + } + + @Override + public void drawScreen(final int x2, final int y2, final float z2) { + final ScaledResolution sr = new ScaledResolution(this.mc); + this.username.drawTextBox(); + this.password.drawTextBox(); + GuiLoginMicrosoft.drawCenteredString(this.mc.fontRendererObj, "Email & Password", (int)(this.width / 2), (int)(sr.getScaledHeight() / 2 - 65), -1); + super.drawScreen(x2, y2, z2); + } + + @Override + public void initGui() { + final ScaledResolution sr = new ScaledResolution(this.mc); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 50 - 10, this.height / 2, 120, 20, I18n.format("Login Microsoft", new Object[0]))); + (this.username = new GuiTextField(100, this.fontRendererObj, this.width / 2 - 50 - 10, sr.getScaledHeight() / 2 - 50, 120, 20)).setFocused(true); + (this.password = new GuiTextField(100, this.fontRendererObj, this.width / 2 - 50 - 10, sr.getScaledHeight() / 2 - 25, 120, 20)).setFocused(false); + Keyboard.enableRepeatEvents(true); + } + + + @Override + protected void keyTyped(final char character, final int key) { + try { + super.keyTyped(character, key); + } + catch (IOException e) { + e.printStackTrace(); + } + if (character == '\t' && !this.username.isFocused()) { + this.username.setFocused(true); + this.password.setFocused(false); + } + if (character == '\t' && !this.password.isFocused()) { + this.password.setFocused(true); + this.username.setFocused(false); + } + if (character == '\r') { + this.actionPerformed(this.buttonList.get(0)); + } + this.username.textboxKeyTyped(character, key); + this.password.textboxKeyTyped(character, key); + } + + @Override + protected void mouseClicked(final int x2, final int y2, final int button) { + try { + super.mouseClicked(x2, y2, button); + } + catch (IOException e) { + e.printStackTrace(); + } + this.username.mouseClicked(x2, y2, button); + this.password.mouseClicked(x2, y2, button); + } + + @Override + public void onGuiClosed() { + mc.entityRenderer.loadEntityShader(null); + Keyboard.enableRepeatEvents(false); + } + + @Override + public void updateScreen() { + this.username.updateCursorCounter(); + this.password.updateCursorCounter(); + } +} diff --git a/src/minecraft/animeware/ui/GuiMultiplayerIngame.java b/src/minecraft/animeware/ui/GuiMultiplayerIngame.java new file mode 100644 index 0000000..6121e85 --- /dev/null +++ b/src/minecraft/animeware/ui/GuiMultiplayerIngame.java @@ -0,0 +1,42 @@ +package animeware.ui; + +import java.io.IOException; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiMultiplayer; + +public class GuiMultiplayerIngame extends GuiMultiplayer{ + + public GuiMultiplayerIngame() { + super(null); + } + + @Override + protected void actionPerformed(GuiButton button) throws IOException { + + if(button.id == 1 || button.id == 4) { + disconnect(); + } + + super.actionPerformed(button); + } + + @Override + public void connectToSelected() { + disconnect(); + super.connectToSelected(); + } + + private void disconnect() { + if(this.mc.theWorld != null) { + + this.mc.theWorld.sendQuittingDisconnectingPacket(); + this.mc.loadWorld(null); + this.mc.displayGuiScreen(null); + this.parentScreen = null; + + } + + } + +} diff --git a/src/minecraft/animeware/ui/comp/ClickGUIButtonLightShort.java b/src/minecraft/animeware/ui/comp/ClickGUIButtonLightShort.java new file mode 100644 index 0000000..9d43517 --- /dev/null +++ b/src/minecraft/animeware/ui/comp/ClickGUIButtonLightShort.java @@ -0,0 +1,133 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.ui.comp; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.Tessellator; +import org.lwjgl.opengl.GL11; + +import animeware.util.font.FontUtil; + +import java.io.File; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; +import net.minecraft.client.renderer.GlStateManager; +import java.awt.Color; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; + +public class ClickGUIButtonLightShort extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + + + public ClickGUIButtonLightShort(final int i, final int j, final int k, final String s) { + this(i, j, k, 21, 21, s); + + } + + public ClickGUIButtonLightShort(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + int j = -1; + if (this.hovered) { + j = new Color(0,0,0,0).getRGB(); + } + if (!this.hovered) { + this.fade = 230; + } + else { + if (this.fade <= 50) { + return; + } + if (this.fade != 160) { + this.fade -= 10; + } + } + if (!this.hovered) { + this.fade2 = 200; + } + else { + if (this.fade2 <= 30) { + return; + } + if (this.fade2 != 200) { + this.fade2 += 10; + } + } + final float b = (float)(this.hovered ? new Color(100, 100, 100, 100).getRGB() : new Color(100, 100, 100, 100).getRGB()); + final Color a = new Color(100, 100, 100, this.fade); + final Color a2 = new Color(100, 100, 100, this.fade2); + final Color a3 = new Color(100, 100, 100, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 5; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + this.drawRoundedRect(this.xPosition - 1, this.yPosition - 1, this.width + 2, this.height + 2, 3, a2); + this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a3); + this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a); + GlStateManager.color(1.0f, 1.0f, 1.0f); + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/logo.png")); + //Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + FontUtil.normal.drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 5) / 2, j); + } + } + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } +} diff --git a/src/minecraft/animeware/ui/comp/CosmeticButton.java b/src/minecraft/animeware/ui/comp/CosmeticButton.java new file mode 100644 index 0000000..177ba97 --- /dev/null +++ b/src/minecraft/animeware/ui/comp/CosmeticButton.java @@ -0,0 +1,105 @@ +package animeware.ui.comp; + +import java.awt.Color; + +import animeware.cosmetic.CosmeticModule; +import animeware.hud.mod.HudMod; +import animeware.ui.themes.impl.ThemeManager; +import animeware.util.font.FontUtil; +import animeware.util.render.ColorUtils; +import animeware.util.render.DrawUtil; +import animeware.util.render.RoundedUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreen; + +public class CosmeticButton { + + public int x, y, w, h; + public CosmeticModule m; + private boolean enabled; + boolean allowClick; + boolean allowDraw; + + int width = GuiScreen.width; + int height = GuiScreen.height; + + Minecraft mc = Minecraft.getMinecraft(); + + public CosmeticButton(int x, int y, int w, int h, CosmeticModule m) { + this.x = x; + this.y = y; + this.w = w; + this.h = h; + this.m = m; + this.enabled = false; + + } + + public void draw() { + Gui.drawRect(x, y, x + w, y + h, new Color(0, 0, 0, 0).getRGB()); + //RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 90, y + h, 18.0F, new Color(40, 40, 45, 255).getRGB()); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w, y + h, 18.0F, new Color(50, 50, 55, 155).getRGB()); //70, 70, 75, 155 + if(m.isEnabled()) { + if(ThemeManager.astolfoBtn == true) { + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 210, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 100L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 190, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 900L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 192, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 800L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 196, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 700L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 200, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 600L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 202, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 500L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 204, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 400L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 206, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 300L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 208, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 200L)); + + } else { + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 288, y + h, 18.0F, new Color(0, 150, 200, 255).getRGB()); + }//RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 190, y + h, 18.0F, new Color(0, 150, 200, 255).getRGB()); + //DrawUtil.drawRoundedRect(x - 1, y - 5, x + w + 1, y + h + 1, 7 , new Color(200, 0, 0, 100).getRGB()); + }else { + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 288, y + h, 18.0F, new Color(50, 50, 55, 255).getRGB()); + //DrawUtil.drawRoundedRect(x - 1, y - 5, x + w + 1, y + h + 1, 7 , new Color(105, 105, 105, 100).getRGB()); + } + //DrawUtil.drawRoundedRect(x, y - 4, x + w, y + h, 7 , new Color(205, 205, 205, 0).getRGB()); + //DrawUtil.drawRoundedRect(x, y - 4, x + w, y + h, 7 , new Color(15, 15, 15, 255).getRGB()); + FontUtil.normal.drawString(m.name, x + 45, y + 16, getColor()); + //FontUtil.normal.drawString(m.description, x + 45, y + 25, new Color(70, 70, 75, 255).getRGB()); + if(!m.getIcon().getResourcePath().equals("")) { + DrawUtil.draw2DImage(m.getIcon(), x + 5, y + 5, 25, 25, Color.WHITE); + } + //GuiScreen.buttonList.add(new SettingsCGButton(2, 262, height / 3 - 10, "")); + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation ("Animeware/background/logo.png")); + } + + + private int getColor() { + if(m.isEnabled()) { + return new Color(155, 155, 155, 250).getRGB(); + }else { + return new Color(155, 155, 155, 250).getRGB(); + } + + } + + public void onClick(int mouseX, int mouseY, int Button) { + if(mouseX >= x && mouseX <= x + w && mouseY >= y && mouseY <= y +h) { + m.toggle(); + System.out.println(this.getModNameToggle()); + } + + } + private String getModNameToggle() { + if(m.enabled) { + return m.name + ": enabled"; + } else if(!m.enabled) { + return m.name + ": disabled"; + }else { + return m.name; + } + } + private String getModName() { + return m.name; + } + + +} diff --git a/src/minecraft/animeware/ui/comp/CosmeticsCGButton.java b/src/minecraft/animeware/ui/comp/CosmeticsCGButton.java new file mode 100644 index 0000000..e8d8ae0 --- /dev/null +++ b/src/minecraft/animeware/ui/comp/CosmeticsCGButton.java @@ -0,0 +1,124 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.ui.comp; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.gui.clickgui.ClickGUI; +import animeware.gui.clickgui.GUIType; +import animeware.util.font.ucfont.UCFontRenderer; +import animeware.util.render.ColorMode; +import animeware.util.render.DrawUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; + +public class CosmeticsCGButton extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + private final UCFontRenderer fr; + + public CosmeticsCGButton(final int i, final int j, final int k, final String s) { + this(i, j, k, 95, 27, s); + + } + + public CosmeticsCGButton(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.fr = new UCFontRenderer(new ResourceLocation("Animeware/font/font.ttf"), 19); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + final float b = (float)(this.hovered ? new Color(30, 0, 0, 100).getRGB() : new Color(30, 0, 0, 30).getRGB()); + final Color a = new Color(15, 0, 0, this.fade); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 10; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + if(!hovered) { + this.fade = 128; + } + else { + if(this.fade <= 30) { + return; + } + if(this.fade <= 250) { + this.fade += 5; + } + } + int f = 160; + if(ClickGUI.type == GUIType.CLICK || this.hovered) { + this.fr.drawCenteredString(this.displayString, this.xPosition + this.width / 3 + 19, this.yPosition + (this.height - 8) / 2, new Color(this.fade, this.fade, this.fade, 255).getRGB()); + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/cosmetics.png"), this.xPosition, this.yPosition, 25, 25, new Color( this.fade, this.fade, this.fade, 255)); + } else { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/cosmetics.png"), this.xPosition, this.yPosition, 25, 25, Color.gray); + this.fr.drawCenteredString(this.displayString, this.xPosition + this.width / 3 + 19, this.yPosition + (this.height - 8) / 2, new Color(128, 128, 128).getRGB()); + } + } + } + + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 370, 560, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 280, 370, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 880, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } + +} diff --git a/src/minecraft/animeware/ui/comp/HomeCGButton.java b/src/minecraft/animeware/ui/comp/HomeCGButton.java new file mode 100644 index 0000000..a8772f0 --- /dev/null +++ b/src/minecraft/animeware/ui/comp/HomeCGButton.java @@ -0,0 +1,124 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.ui.comp; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.gui.clickgui.ClickGUI; +import animeware.gui.clickgui.GUIType; +import animeware.util.font.FontUtil; +import animeware.util.font.ucfont.UCFontRenderer; +import animeware.util.render.DrawUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; + +public class HomeCGButton extends GuiButton +{ + float anim = 0.0F; + private int j6; + private int j10; + int fade; + int fade2; + private final UCFontRenderer fr; + + public HomeCGButton(final int i, final int j, final int k, final String s) { + this(i, j, k, 95, 27, s); + + } + + public HomeCGButton(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.fr = new UCFontRenderer(new ResourceLocation("Animeware/font/font.ttf"), 19); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + final float b = (float)(this.hovered ? new Color(30, 0, 0, 100).getRGB() : new Color(30, 0, 0, 30).getRGB()); + final Color a = new Color(15, 0, 0, this.fade); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 10; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + if(!hovered) { + this.fade = 128; + } + else { + if(this.fade <= 30) { + return; + } + if(this.fade <= 250) { + this.fade += 5; + } + } + int f = 160; + if(ClickGUI.type == GUIType.CLICK || this.hovered) { + this.fr.drawCenteredString(this.displayString, this.xPosition + this.width / 3 + 15, this.yPosition + (this.height - 8) / 2, new Color(this.fade, this.fade, this.fade, 255).getRGB()); + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/home.png"), this.xPosition, this.yPosition, 25, 25, new Color( this.fade, this.fade, this.fade, 255)); + } else { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/home.png"), this.xPosition, this.yPosition, 25, 25, Color.gray); + this.fr.drawCenteredString(this.displayString, this.xPosition + this.width / 3 + 15, this.yPosition + (this.height - 8) / 2, new Color(128, 128, 128).getRGB()); + } + } + } + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 370, 560, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 280, 370, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 880, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } + +} diff --git a/src/minecraft/animeware/ui/comp/LArrowBtn.java b/src/minecraft/animeware/ui/comp/LArrowBtn.java new file mode 100644 index 0000000..957b8d2 --- /dev/null +++ b/src/minecraft/animeware/ui/comp/LArrowBtn.java @@ -0,0 +1,119 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.ui.comp; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.gui.clickgui.ClickGUI; +import animeware.gui.clickgui.GUIType; +import animeware.util.render.DrawUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; + +public class LArrowBtn extends GuiButton +{ + float anim = 0.0F; + private int j6; + private int j10; + int fade; + int fade2; + + + public LArrowBtn(final int i, final int j, final int k, final String s) { + this(i, j, k, 35, 35, s); + + } + + public LArrowBtn(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + final float b = (float)(this.hovered ? new Color(30, 0, 0, 100).getRGB() : new Color(30, 0, 0, 30).getRGB()); + final Color a = new Color(15, 0, 0, this.fade); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 10; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + if(!hovered) { + this.fade = 128; + } + else { + if(this.fade <= 30) { + return; + } + if(this.fade <= 250) { + this.fade += 5; + } + } + int f = 160; + if(ClickGUI.type == GUIType.CLICK || this.hovered) { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/zonix/left.png"), this.xPosition + 3, this.yPosition + 3, 30, 30, new Color( this.fade, this.fade, this.fade, 255)); + } else { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/zonix/left.png"), this.xPosition + 3, this.yPosition + 3, 30, 30, Color.gray); + } + } + } + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 370, 560, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 280, 370, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 880, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } + +} diff --git a/src/minecraft/animeware/ui/comp/LogoButtonWhite.java b/src/minecraft/animeware/ui/comp/LogoButtonWhite.java new file mode 100644 index 0000000..d75cdde --- /dev/null +++ b/src/minecraft/animeware/ui/comp/LogoButtonWhite.java @@ -0,0 +1,149 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.ui.comp; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.NightSky; +import animeware.util.font.FontUtil; +import animeware.util.font.ucfont.UCFontRenderer; +import animeware.util.render.ColorMode; +import animeware.util.render.DrawUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; + +public class LogoButtonWhite extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + private final UCFontRenderer fr; + + public LogoButtonWhite(final int i, final int j, final int k, final String s) { + this(i, j, k, 35, 35, s); + + } + + public LogoButtonWhite(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.fr = new UCFontRenderer(new ResourceLocation("Animeware/font/font.ttf"), 19); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + int j = -1; + if (this.hovered) { + j = 35071; + } + if (!this.hovered) { + this.fade = 230; + } + else { + if (this.fade <= 50) { + return; + } + if (this.fade != 160) { + this.fade -= 10; + } + } + if (!this.hovered) { + this.fade2 = 200; + } + else { + if (this.fade2 <= 30) { + return; + } + if (this.fade2 != 200) { + this.fade2 += 10; + } + } + final float b = (float)(this.hovered ? new Color(30, 0, 0, 100).getRGB() : new Color(30, 0, 0, 30).getRGB()); + final Color a = new Color(15, 0, 0, this.fade); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 10; + final FontRenderer fr = mc.fontRendererObj; + //this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + //this.drawRoundedRect(this.xPosition - 1, this.yPosition - 1, this.width + 2, this.height + 2, 3, a); + //this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a2); + //this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a3); + if(this.hovered) { + //GlStateManager.color(0.0f, 0.0f, 0.0f); + } else { + //GlStateManager.color(1.0f, 1.0f, 1.0f); + } + //DrawUtil.draw2DImage(new ResourceLocation("Animeware/nightskywhite.png"), this.width / 2 - 189 + 3, this.height / 2 - 112 + 3, 30, 30, Color.WHITE); + + + //DrawUtil.draw2DImage(new ResourceLocation("Animeware/nightskywhite.png"), this.xPosition + 3, this.yPosition + 3, 27, 27, Color.WHITE); + DrawUtil.draw2DImage(new ResourceLocation("Animeware/logonobg.png"), this.xPosition- 4, this.yPosition - 3, 36, 35, Color.WHITE); + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskywhite.png")); + //Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 1.0f, 30, 30, 30.0f, 30.0f); + //GlStateManager.disableDepth(); + this.fr.drawString(this.displayString, this.xPosition + this.width / 3 + 20, this.yPosition + (this.height - 21) / 2, new Color(255, 255, 255, 255).getRGB()); + this.fr.drawString(NightSky.INSTANCE.VERSIONSIMPLE, this.xPosition + this.width / 3 + 20, this.yPosition + (this.height - 2) / 2, new Color(255, 255, 255, 255).getRGB()); + + } + } + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 370, 560, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 280, 370, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 880, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } +} diff --git a/src/minecraft/animeware/ui/comp/MainMenuBtn.java b/src/minecraft/animeware/ui/comp/MainMenuBtn.java new file mode 100644 index 0000000..29624eb --- /dev/null +++ b/src/minecraft/animeware/ui/comp/MainMenuBtn.java @@ -0,0 +1,126 @@ +package animeware.ui.comp; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.Tessellator; +import org.lwjgl.opengl.GL11; + +import animeware.util.font.FontUtil; +import animeware.util.font.TenaFontUtil; +import animeware.util.render.RoundedUtils; + +import java.io.File; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.ResourceLocation; +import net.minecraft.client.renderer.GlStateManager; +import java.awt.Color; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; + +public class MainMenuBtn extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + + + public MainMenuBtn(final int i, final int j, final int k, final String s) { + this(i, j, k, 200, 21, s); + + } + + public MainMenuBtn(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + int j = -1; + if (this.hovered) { + j = new Color(0,210,220,0).getRGB(); + } + + final float b = (float)(this.hovered ? new Color(0, 0, 255, 255).getRGB() : new Color(0, 0, 255, 255).getRGB()); + final Color c = new Color(0, 0, 5, 70); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + float f = this.hovered ? new Color(153, 9, 193).getRGB() : new Color(255,255,255,255).getRGB(); + Color a = new Color(0,0,0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 5; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + if(!hovered) { + this.fade = 90; + } + else { + if(this.fade <= 30) { + return; + } + if(this.fade != 130) { + this.fade += 5; + } + } + //this.drawRoundedRect(this.xPosition - 1, this.yPosition - 1, this.width + 2, this.height + 2, 3, a2); + //this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a3); + this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a); + RoundedUtils.drawRoundedOutline(this.xPosition, this.yPosition, this.xPosition + 200, this.yPosition + 20, 8.0F, 2, new Color(0, 0, 0, 255).getRGB()); //this.width / 2 - 94, this.height / 2 + 5, this.width / 2 + 116, this.height / 2 + 85, 18.0F, 2, new Color(0, 140, 170, 255).getRGB() + GlStateManager.color(1.0f, 0.0f, 0.0f); + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/logo.png")); + //Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0.0f, 0.0f, 15, 15, 15.0f, 15.0f); + FontUtil.normal.drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 5) / 2, j); + //FontUtil.tenacity.drawSmoothString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 5) / 2, j); + //TenaFontUtil.tenacityBoldFont40.drawString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 5) / 2, j); + } + } + + public void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } +} diff --git a/src/minecraft/animeware/ui/comp/PositioningCGButton.java b/src/minecraft/animeware/ui/comp/PositioningCGButton.java new file mode 100644 index 0000000..96bae98 --- /dev/null +++ b/src/minecraft/animeware/ui/comp/PositioningCGButton.java @@ -0,0 +1,123 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.ui.comp; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.gui.clickgui.ClickGUI; +import animeware.gui.clickgui.GUIType; +import animeware.util.font.ucfont.UCFontRenderer; +import animeware.util.render.ColorMode; +import animeware.util.render.DrawUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; + +public class PositioningCGButton extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + private final UCFontRenderer fr; + + public PositioningCGButton(final int i, final int j, final int k, final String s) { + this(i, j, k, 95, 27, s); + + } + + public PositioningCGButton(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.fr = new UCFontRenderer(new ResourceLocation("Animeware/font/font.ttf"), 19); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + final float b = (float)(this.hovered ? new Color(30, 0, 0, 100).getRGB() : new Color(30, 0, 0, 30).getRGB()); + final Color a = new Color(15, 0, 0, this.fade); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 10; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + if(!hovered) { + this.fade = 128; + } + else { + if(this.fade <= 30) { + return; + } + if(this.fade <= 250) { + this.fade += 5; + } + } + int f = 160; + if(ClickGUI.type == GUIType.CLICK || this.hovered) { + this.fr.drawCenteredString(this.displayString, this.xPosition + this.width / 3 + 21, this.yPosition + (this.height - 8) / 2, new Color(this.fade, this.fade, this.fade, 255).getRGB()); + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/positioning.png"), this.xPosition, this.yPosition, 25, 25, new Color( this.fade, this.fade, this.fade, 255)); + } else { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/positioning.png"), this.xPosition, this.yPosition, 25, 25, Color.gray); + this.fr.drawCenteredString(this.displayString, this.xPosition + this.width / 3 + 21, this.yPosition + (this.height - 8) / 2, new Color(128, 128, 128).getRGB()); + } + } + } + + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 370, 560, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 280, 370, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 880, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } +} diff --git a/src/minecraft/animeware/ui/comp/SettingsCGButton.java b/src/minecraft/animeware/ui/comp/SettingsCGButton.java new file mode 100644 index 0000000..b6918e6 --- /dev/null +++ b/src/minecraft/animeware/ui/comp/SettingsCGButton.java @@ -0,0 +1,124 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.ui.comp; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.gui.clickgui.ClickGUI; +import animeware.gui.clickgui.GUIType; +import animeware.util.font.ucfont.UCFontRenderer; +import animeware.util.render.ColorMode; +import animeware.util.render.DrawUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; + +public class SettingsCGButton extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + private final UCFontRenderer fr; + + public SettingsCGButton(final int i, final int j, final int k, final String s) { + this(i, j, k, 95, 27, s); + + } + + public SettingsCGButton(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.fr = new UCFontRenderer(new ResourceLocation("Animeware/font/font.ttf"), 19); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + final float b = (float)(this.hovered ? new Color(30, 0, 0, 100).getRGB() : new Color(30, 0, 0, 30).getRGB()); + final Color a = new Color(15, 0, 0, this.fade); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 10; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + if(!hovered) { + this.fade = 128; + } + else { + if(this.fade <= 30) { + return; + } + if(this.fade <= 250) { + this.fade += 5; + } + } + int f = 160; + if(ClickGUI.type == GUIType.CLICK || this.hovered) { + this.fr.drawCenteredString(this.displayString, this.xPosition + this.width / 3 + 15, this.yPosition + (this.height - 8) / 2, new Color(this.fade, this.fade, this.fade, 255).getRGB()); + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/settings.png"), this.xPosition, this.yPosition, 25, 25, new Color( this.fade, this.fade, this.fade, 255)); + } else { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/settings.png"), this.xPosition, this.yPosition, 25, 25, Color.gray); + this.fr.drawCenteredString(this.displayString, this.xPosition + this.width / 3 + 15, this.yPosition + (this.height - 8) / 2, new Color(128, 128, 128).getRGB()); + } + } + } + + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 370, 560, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 280, 370, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 880, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } + +} diff --git a/src/minecraft/animeware/ui/comp/ToggleableCGButton.java b/src/minecraft/animeware/ui/comp/ToggleableCGButton.java new file mode 100644 index 0000000..0ab2dc4 --- /dev/null +++ b/src/minecraft/animeware/ui/comp/ToggleableCGButton.java @@ -0,0 +1,123 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.ui.comp; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.gui.clickgui.ClickGUI; +import animeware.gui.clickgui.GUIType; +import animeware.util.font.ucfont.UCFontRenderer; +import animeware.util.render.ColorMode; +import animeware.util.render.DrawUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; + +public class ToggleableCGButton extends GuiButton +{ + private int j6; + private int j10; + int fade; + int fade2; + private final UCFontRenderer fr; + + public ToggleableCGButton(final int i, final int j, final int k, final String s) { + this(i, j, k, 95, 27, s); + + } + + public ToggleableCGButton(final int i, final int j, final int k, final int l, final int i1, final String s) { + super(i, j, k, l, i1, s); + this.fr = new UCFontRenderer(new ResourceLocation("Animeware/font/font.ttf"), 19); + this.enabled = true; + this.visible = true; + } + + @Override + protected int getHoverState(final boolean flag) { + byte byte0 = 1; + if (!this.enabled) { + byte0 = 0; + } + else if (flag) { + byte0 = 2; + } + return byte0; + } + + @Override + public void drawButton(final Minecraft mc, final int mouseX, final int mouseY) { + final float b = (float)(this.hovered ? new Color(30, 0, 0, 100).getRGB() : new Color(30, 0, 0, 30).getRGB()); + final Color a = new Color(15, 0, 0, this.fade); + final Color a2 = new Color(100, 0, 0, this.fade2); + final Color a3 = new Color(80, 0, 0, this.fade); + if (this.xPosition >= this.xPosition && this.yPosition >= this.yPosition && this.xPosition < this.xPosition + this.width && this.yPosition < this.yPosition + this.height) { + final int n = 10; + final FontRenderer fr = mc.fontRendererObj; + this.hovered = (mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height); + if(!hovered) { + this.fade = 128; + } + else { + if(this.fade <= 30) { + return; + } + if(this.fade <= 250) { + this.fade += 5; + } + } + int f = 160; + if(ClickGUI.type == GUIType.CLICK || this.hovered) { + this.fr.drawCenteredString(this.displayString, this.xPosition + this.width / 3 + 17, this.yPosition + (this.height - 8) / 2, new Color(this.fade, this.fade, this.fade, 255).getRGB()); + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/togglesprint.png"), this.xPosition, this.yPosition, 25, 25, new Color( this.fade, this.fade, this.fade, 255)); + } else { + DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/togglesprint.png"), this.xPosition, this.yPosition, 25, 25, Color.gray); + this.fr.drawCenteredString(this.displayString, this.xPosition + this.width / 3 + 17, this.yPosition + (this.height - 8) / 2, new Color(128, 128, 128).getRGB()); + } + } + } + + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 370, 560, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 280, 370, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 880, color); + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } + +} diff --git a/src/minecraft/animeware/ui/comp/clickgui/ModButton.java b/src/minecraft/animeware/ui/comp/clickgui/ModButton.java new file mode 100644 index 0000000..52a3ba4 --- /dev/null +++ b/src/minecraft/animeware/ui/comp/clickgui/ModButton.java @@ -0,0 +1,208 @@ +package animeware.ui.comp.clickgui; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.gui.clickgui.ClickGUI; +import animeware.gui.clickgui.GUIType; +import animeware.gui.clickgui.SettingsGUI; +import animeware.hud.mod.HudMod; +import animeware.ui.themes.impl.ThemeManager; +import animeware.util.font.FontUtil; +import animeware.util.notification.Notification; +import animeware.util.notification.NotificationManager; +import animeware.util.notification.NotificationType; +import animeware.util.render.ColorUtils; +import animeware.util.render.DrawUtil; +import animeware.util.render.RoundedUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; + +public class ModButton { + + public int x, y, w, h; + public HudMod m; + private boolean enabled; + boolean allowClick; + boolean allowDraw; + public static boolean settings; + + int width = GuiScreen.width; + int height = GuiScreen.height; + + Minecraft mc = Minecraft.getMinecraft(); + + public ModButton(int x, int y, int w, int h, HudMod m) { + this.x = x; + this.y = y; + this.w = w; + this.h = h; + this.m = m; + this.enabled = false; + + } + public ModButton() { + + } + + public void draw() { + + Gui.drawRect(x, y, x + w, y + h, new Color(0, 0, 0, 0).getRGB()); + //RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 90, y + h, 18.0F, new Color(40, 40, 45, 255).getRGB()); + //RoundedUtils.drawSmoothRoundedRect(x, y, x + w, y + h, 18.0F, new Color(50, 50, 55, 155).getRGB()); //70, 70, 75, 155 + RoundedUtils.drawSmoothRoundedRect(x, y, x + w, y + h, 12.0F, new Color(26, 26, 26, 255).getRGB()); + RoundedUtils.drawSmoothRoundedRect(x + 105, y + 18, x + w -6, y + h - 18, 4.0F, new Color(40, 40, 40, 255).getRGB()); + if(m.isEnabled()) { + if(ThemeManager.astolfoBtn == true) { + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 288, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 1000L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 290, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 900L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 292, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 800L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 296, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 700L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 300, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 600L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 302, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 500L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 304, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 400L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 306, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 300L)); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 308, y + h, 18.0F, ColorUtils.astolfoColors(10, 100, 200L)); + + } else { + this.drawCircle(x + 109, y + 16, 8, 8, new Color(0, 255, 255)); + + //RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 288, y + h, 18.0F, new Color(0, 150, 200, 255).getRGB()); + //RoundedUtils.drawRoundedGradientRectCorner(x, y, x + w - 190, y + h, 18.0F, new Color(0, 150, 200, 255).getRGB(), new Color(50, 100, 200, 255).getRGB(), new Color(100, 50, 200, 255).getRGB(), new Color(150, 0, 200, 255).getRGB()); + + } + //RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 190, y + h, 18.0F, new Color(0, 150, 200, 255).getRGB()); + //RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 190, y + h, 18.0F, new Color(0, 0, 0, 155).getRGB()); + //DrawUtil.drawRoundedRect(x - 1, y - 5, x + w + 1, y + h + 1, 7 , new Color(200, 0, 0, 100).getRGB()); + }else { + this.drawCircle(x + 100, y + 16, 8, 8, new Color(100,100,100)); + //RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 288, y + h, 18.0F, new Color(50, 50, 55, 255).getRGB()); + //DrawUtil.drawRoundedRect(x - 1, y - 5, x + w + 1, y + h + 1, 7 , new Color(105, 105, 105, 100).getRGB()); + } + FontUtil.normal.drawString(m.name, x + 35, y + 12, getColor()); + FontUtil.normal.drawString("Description", x + 35, y + 23, new Color(70, 70, 75, 255).getRGB()); + //FontUtil.normal.drawString(m.description, x + 35, y + 23, new Color(70, 70, 75, 255).getRGB()); + + if(!m.getIcon().getResourcePath().equals("")) { + DrawUtil.draw2DImage(m.getIcon(), x + 5, y + 3, 30, 30, Color.WHITE); + } + /*int yAdd1 = 0; + if(m.expanded) + for (Setting set : m.settings) { + + if(set instanceof BooleanSetting) { + ClickGUI.settingButtons.add(new SettingButton(this.width / 2 + 100, this.height / 2 - 90 + yAdd1, 60, 20, set)); + yAdd1 += 40; + } + + }*/ + + //GuiScreen.buttonList.add(new SettingsCGButton(2, 262, height / 3 - 10, "")); + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation ("Animeware/background/logo.png")); + + } + + + private int getColor() { + if(m.isEnabled()) { + return new Color(155, 155, 155, 250).getRGB(); + }else { + return new Color(155, 155, 155, 250).getRGB(); + } + + } + + public void onClick(int mouseX, int mouseY, int Button) { + + if(mouseX >= x && mouseX <= x + w && mouseY >= y && mouseY <= y +h) { + if(Button == 0) { + m.toggle(); + + if(m.enabled) { + NotificationManager.show(new Notification(NotificationType.SUCCESS, m.name, m.name + " was enabled.", m.icon, 1)); + } else if(!m.enabled) { + NotificationManager.show(new Notification(NotificationType.FAIL, m.name, m.name + " was disabled.", m.icon, 1)); + }else { + + } + + System.out.println(this.getModNameToggle()); + } + if(mouseX >= x && mouseX <= x + w && mouseY >= y && mouseY <= y +h) { + if(Button == 1) { + + //ClickGUI.settings = true; + //for(HudMod m : HudManager.hudMods) { + //if(m.settings.size()>0) + //m.expand(); + + //} + + } + if(Button == 1) { + if(m.settings.size()>0 && m.name == "Color Scheme" || m.settings.size()>0 && m.name == "FPS") //HitColor + //if(!m.expanded) { + //m.expand(); + //} else { + //m.deexpand(); + //} + + + //mc.displayGuiScreen(new SettingsGUI(m, new ClickGUI(), x, y)); + //mc.displayGuiScreen(new SettingsGUI(m)); + ClickGUI.type = GUIType.SETTINGS; + mc.displayGuiScreen(new ClickGUI(m)); + settings = true; + } + + } + + } + + + + } + private String getModNameToggle() { + //NotificationManager.show(new Notification(NotificationType.SUCCESS, name, name + " was enabled.", 1)); + if(m.enabled) { + return m.name + ": enabled"; + } else if(!m.enabled) { + return m.name + ": disabled"; + }else { + return m.name; + } + } + + private String getModName() { + return m.name; + } + + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } + +} diff --git a/src/minecraft/animeware/ui/comp/clickgui/SettingButton.java b/src/minecraft/animeware/ui/comp/clickgui/SettingButton.java new file mode 100644 index 0000000..b1626ce --- /dev/null +++ b/src/minecraft/animeware/ui/comp/clickgui/SettingButton.java @@ -0,0 +1,165 @@ +package animeware.ui.comp.clickgui; + +import java.awt.Color; + +import animeware.NightSky; +import animeware.util.font.FontUtil; +import animeware.util.font.MinecraftFontRenderer; +import animeware.util.settings.BooleanSetting; +import animeware.util.settings.ModeSetting; +import animeware.util.settings.NumberSetting; +import animeware.util.settings.Setting; +import net.minecraft.client.gui.Gui; +import net.minecraft.util.MathHelper; + +public class SettingButton { + + public int x, y, w, h; + public Setting set; + public boolean isSliding = false; + public double val; + int anim=0,anim2=0; + + public SettingButton(int x, int y, int w, int h, Setting set) { + this.x = x; + this.y = y; + this.w = w; + this.h = h; + this.set = set; + } + + public void draw(int mouseX, int mouseY) { + MinecraftFontRenderer fr = FontUtil.normal; + + if(set instanceof BooleanSetting) { + fr.drawString(set.name, x, y+h / 2 - fr.getHeight() / 2, -1); + + Gui.drawRect(x + fr.getStringWidth(set.name) + 4, y + 2.5f, x + fr.getStringWidth(set.name) + 15 + 4, y + h - 2.5f, new Color(117, 117, 117).getRGB()); + + if(((BooleanSetting) set).isEnabled()) { + Gui.drawRect(x + fr.getStringWidth(set.name) + 6, y + 4.5f, x+fr.getStringWidth(set.name) + 15 + 2, y + h - 4.5f, NightSky.getMainColor().getRGB()); + } + } + + if(set instanceof ModeSetting) { + fr.drawString(set.name + ": " + ((ModeSetting) set).getMode(), x, y+h / 2 - fr.getHeight() / 2, -1); + } + if(set instanceof NumberSetting){ + + boolean hovered = (mouseX >= x && mouseX <= x + w && mouseY >= y && mouseY <= y + h); + NumberSetting ns = (NumberSetting) set; + if(isSliding){ + float value = (float)(mouseX - (x)) / (float)((w)/ns.getMaximum()); + value = (float) MathHelper.clamp_double(value, ns.getMinimum(), ns.getMaximum()); + val = (float)(mouseX - (x)) / (float)((w)/ns.getMaximum()); + val = (float) MathHelper.clamp_double(value, ns.getMinimum(), ns.getMaximum()); + //float f = this.denormalizeValue(value); + ns.setValue(val); + //value = this.normalizeValue(f); + } + + + Gui.drawRect(x, y + h - 3, x + w, y + h, new Color(117, 117, 117).getRGB()); + if(anim2 > 0)anim2-=4; + + Gui.drawRect(x, y + h - 3, (x+(ns.getValue()/ns.getMaximum()*w)), (y + h), NightSky.getMainColor().getRGB()); + + fr.drawString("" + ns.getValue(), (x+(ns.getValue()/ns.getMaximum()*w)) - fr.getStringWidth("" + ns.getValue()), y + h + 2, -1); + + + fr.drawString(set.name, x, y+h/4, -1); + } + + } + + public void onClick(int mouseX, int mouseY, int button) { + if(set instanceof BooleanSetting) { + if(mouseX >= x + FontUtil.normal.getStringWidth(set.name) + 4 && mouseX <= x + FontUtil.normal.getStringWidth(set.name) + 4 + 15 && mouseY >= y && mouseY <= y + h) { + ((BooleanSetting) set).setEnabled(!((BooleanSetting) set).isEnabled()); + } + } + + if(set instanceof ModeSetting) { + if(mouseX >= x && mouseX <= x + FontUtil.normal.getStringWidth(set.name + ((ModeSetting) set).getMode()) && mouseY >= y && mouseY <= y + h) { + //((ModeSetting) set).increment(); + } + } + if(set instanceof NumberSetting) { + if(mouseX >= x && mouseX <= x + w && mouseY >= y && mouseY <= y + h) { + this.isSliding = true; + } + } + } + + public void onRelease(int mouseX, int mouseY, int state) { + isSliding = false; + } + +} + +/*package animeware.ui.comp.clickgui; + +import java.awt.Color; +import java.io.IOException; + +import animeware.hud.mod.HudMod; +import animeware.ui.comp.setting.BooleanSetting; +import animeware.ui.comp.setting.ModeSetting; +import animeware.ui.comp.setting.NumberSetting; +import animeware.ui.comp.setting.Setting; +import animeware.util.font.FontUtil; +import animeware.util.font.MinecraftFontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.MathHelper; + +public class SettingButton { + + public int x, y, w, h; + //public Setting set; + HudMod m; + GuiScreen gui; + Setting s; + String str; + public boolean isSliding = false; + public double val; + int anim=0,anim2=0; + + public SettingButton(int x, int y, int w, int h, String str) { + this.x = x; + this.y = y; + this.w = w; + this.h = h; + this.str = str; + } + + public void draw(int mouseX, int mouseY) { + int index = 0; + for(Setting s : m.settings) { + if(((BooleanSetting)s).enabled) { + FontUtil.normal.drawStringWithShadow(Setting.name, x, y + index, new Color(0, 0, 255, 255).getRGB()); + } else { + FontUtil.normal.drawStringWithShadow(Setting.name, x, y + index, -1); + } + //drawRect(100,100+index,100+60,100+20,-1); + index+=24; + } + + } + + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + int index = 0; + for(Setting s : m.settings) { + //if(mouseX >= x && mouseX <= x + w && mouseY >= y && mouseY <= y +h) { + if(mouseX >= x && mouseX <= x + w && mouseY >=y + index && mouseY <= y + h +index) + ((BooleanSetting)s).enabled = !((BooleanSetting)s).enabled; + index+=24; + } + //super.mouseClicked(mouseX, mouseY, mouseButton); + } + + public void onRelease(int mouseX, int mouseY, int state) { + isSliding = false; + } + +}*/ \ No newline at end of file diff --git a/src/minecraft/animeware/ui/comp/clickgui/SettingFrame.java b/src/minecraft/animeware/ui/comp/clickgui/SettingFrame.java new file mode 100644 index 0000000..138f463 --- /dev/null +++ b/src/minecraft/animeware/ui/comp/clickgui/SettingFrame.java @@ -0,0 +1,26 @@ +package animeware.ui.comp.clickgui; + +import animeware.hud.mod.HudMod; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; + +public class SettingFrame extends GuiScreen { + + int x, y, width, height; + int mouseX, mouseY; + + Minecraft mc = Minecraft.getMinecraft(); + //public static VoyageFontFromAsset font = new VoyageFontFromAsset(new ResourceLocation("Voyage/font/AntipastoPro-DemiBold_trial.ttf"), 23.0F); + + public SettingFrame(HudMod mod, int x, int y) { + this.x = x; + this.y = y; + this.width = 395; + this.height = 300; + } + + + public void render(int mouseX, int mouseY) { + //DrawUtil.drawRoundedRect(x, y, x + width, y + height, 10, new Color(0, 0, 0, 75).getRGB()); + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/ui/cosmetic.zip b/src/minecraft/animeware/ui/cosmetic.zip new file mode 100644 index 0000000..e067d5e Binary files /dev/null and b/src/minecraft/animeware/ui/cosmetic.zip differ diff --git a/src/minecraft/animeware/ui/cosmeticgui.zip b/src/minecraft/animeware/ui/cosmeticgui.zip new file mode 100644 index 0000000..9f92f80 Binary files /dev/null and b/src/minecraft/animeware/ui/cosmeticgui.zip differ diff --git a/src/minecraft/animeware/ui/login/Comp/Microsoft.java b/src/minecraft/animeware/ui/login/Comp/Microsoft.java new file mode 100644 index 0000000..502a68f --- /dev/null +++ b/src/minecraft/animeware/ui/login/Comp/Microsoft.java @@ -0,0 +1,21 @@ +package animeware.ui.login.Comp; + +import fr.litarvan.openauth.microsoft.MicrosoftAuthResult; +import fr.litarvan.openauth.microsoft.MicrosoftAuthenticationException; +import fr.litarvan.openauth.microsoft.MicrosoftAuthenticator; + +public class Microsoft { + + private void initGui() throws MicrosoftAuthenticationException { + MicrosoftAuthenticator authenticator = new MicrosoftAuthenticator(); + MicrosoftAuthResult result = authenticator.loginWithWebview(); + // Or using a webview: authenticator.loginWithWebView(); + // Or using refresh token: authenticator.loginWithRefreshToken("refresh token"); + // Or using your own way: authenticator.loginWithTokens("access token", "refresh token"); + + System.out.printf("Logged in with '%s'%n", result.getProfile().getName()); + + } + + +} \ No newline at end of file diff --git a/src/minecraft/animeware/ui/login/LoginScreen.java b/src/minecraft/animeware/ui/login/LoginScreen.java new file mode 100644 index 0000000..fa8dac9 --- /dev/null +++ b/src/minecraft/animeware/ui/login/LoginScreen.java @@ -0,0 +1,160 @@ +package animeware.ui.login; + +import java.awt.Color; +import java.io.IOException; + +import org.lwjgl.input.Keyboard; + +import animeware.NightSky; +import animeware.gui.alt.Alt; +import animeware.gui.alt.AltLoginThread; +import animeware.gui.mainmenu.AltButton; +import animeware.gui.mainmenu.ClassicButton; +import animeware.gui.mainmenu.MainMenu; +import animeware.gui.mainmenu.MicrosoftButton; +import animeware.gui.mainmenu.QuitButton; +import animeware.ui.comp.MainMenuBtn; +import animeware.util.account.SessionChanger; +import animeware.util.font.FontUtil; +import animeware.util.render.DrawUtil; +import animeware.util.render.RoundedUtils; +import animeware.util.websockets.SocketClient; +import animeware.util.websockets.user.CheckName; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.EnumChatFormatting; + +public final class LoginScreen extends GuiScreen { + private PasswordField password; + private GuiScreen previousScreen; + //private UserLoginThread thread; + public static GuiTextField username; + public AltLoginThread loginThread; + public Alt selectedAlt = null; + private AltLoginThread thread; + + public LoginScreen() { + this.previousScreen = previousScreen; + } + + @Override + protected void actionPerformed(GuiButton button) { + switch (button.id) { + case 0: { + if(this.username.getText() == "" && this.password.getText() == "" || this.username.getText() == " " && this.password.getText() == " " || this.username.getText() == " " && this.password.getText() == "" || this.username.getText() == "" && this.password.getText() == " ") { + } else { + + this.thread = new AltLoginThread(this.username.getText(), this.password.getText()); + this.thread.start(); + NightSky.mcname = this.username.getText(); + } + + break; + } + case 1: { + if(this.username.getText() == "" && this.password.getText() == "" || this.username.getText() == " " && this.password.getText() == " " || this.username.getText() == " " && this.password.getText() == "" || this.username.getText() == "" && this.password.getText() == " ") { + } else { + + SessionChanger.getInstance().setUserMicrosoft(this.username.getText(), this.password.getText()); + NightSky.mcname = this.username.getText(); + + } + + break; + } + case 2: { + mc.displayGuiScreen(new MainMenu()); + break; + } + } + + } + @Override + public void initGui() { + this.username = new GuiTextField(height / 4 + 24, this.mc.fontRendererObj, this.width / 2 - 100, this.height / 2 - 20, 200, 20); + this.password = new PasswordField(this.mc.fontRendererObj, this.width / 2 - 100, this.height / 2 + 5, 200, 20); + this.buttonList.add(new MainMenuBtn(0, this.width / 2 - 100, this.height / 2 + 34, "Login")); + //this.buttonList.add(new MainMenuBtn(1, this.width / 2 - 100, this.height / 2 + 60, "Login with Microsoft")); + + this.username.setFocused(true); + Keyboard.enableRepeatEvents(true); + } + + + + @Override + public void drawScreen(int x2, int y2, float z2) { + //this.drawDefaultBackground(); + ScaledResolution sr = new ScaledResolution(mc); + GlStateManager.enableAlpha(); + GlStateManager.enableBlend(); + //DrawUtil.drawRoundedRect(325, 90, sr.getScaledWidth() -310, sr.getScaledHeight() - 220, 10, new Color(30, 30, 30, 150).getRGB()); + RoundedUtils.drawSmoothRoundedRect((this.width / 2 - 140), (this.height / 2 - 50), (this.width / 2 + 140), (this.height / 2 + 80), 18.0F, new Color(25, 25, 27, 255).getRGB()); + this.username.drawTextBox(); + this.password.drawTextBox(); + //FontUtil.normal.drawCenteredString("Animeware Client Login", width / 2, 130, -1); + FontUtil.normal.drawCenteredString(this.thread == null ? (Object)((Object)EnumChatFormatting.GRAY) + "Idle..." : this.thread.getStatus(), width / 2, this.height / 2 - 39, -1); + if (this.username.getText().isEmpty()) { + FontUtil.normal.drawString("Mail", this.width / 2 - 98, this.height / 2 - 12, -7829368); + } + if (this.password.getText().isEmpty()) { + FontUtil.normal.drawString("Password", this.width / 2 - 98, this.height / 2 + 13, -1); + } + + super.drawScreen(x2, y2, z2); + } + + + + @Override + protected void keyTyped(char character, int key) { + try { + super.keyTyped(character, key); + } + catch (IOException e) { + e.printStackTrace(); + } + if (character == '\t') { + if (!this.username.isFocused() && !this.password.isFocused()) { + this.username.setFocused(true); + } else { + this.username.setFocused(this.password.isFocused()); + this.password.setFocused(!this.username.isFocused()); + } + } + if (character == '\r') { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + this.username.textboxKeyTyped(character, key); + this.password.textboxKeyTyped(character, key); + } + + @Override + protected void mouseClicked(int x2, int y2, int button) { + try { + super.mouseClicked(x2, y2, button); + } + catch (IOException e) { + e.printStackTrace(); + } + this.username.mouseClicked(x2, y2, button); + this.password.mouseClicked(x2, y2, button); + } + + @Override + public void onGuiClosed() { + Keyboard.enableRepeatEvents(false); + } + + @Override + public void updateScreen() { + this.username.updateCursorCounter(); + this.password.updateCursorCounter(); + } + + +} + diff --git a/src/minecraft/animeware/ui/login/PasswordField.java b/src/minecraft/animeware/ui/login/PasswordField.java new file mode 100644 index 0000000..b7459c6 --- /dev/null +++ b/src/minecraft/animeware/ui/login/PasswordField.java @@ -0,0 +1,499 @@ +package animeware.ui.login; + +import net.minecraft.util.*; +import net.minecraft.client.gui.*; +import net.minecraft.client.*; +import org.lwjgl.opengl.*; +import net.minecraft.client.renderer.*; + +public class PasswordField extends Gui +{ + private final FontRenderer fontRenderer; + private final int xPos; + private final int yPos; + private final int width; + private final int height; + private String text; + private int maxStringLength; + private int cursorCounter; + private boolean enableBackgroundDrawing; + private boolean canLoseFocus; + public boolean isFocused; + private boolean isEnabled; + private int i; + private int cursorPosition; + private int selectionEnd; + private int enabledColor; + private int disabledColor; + private boolean b; + + public PasswordField(final FontRenderer par1FontRenderer, final int par2, final int par3, final int par4, final int par5) { + this.text = ""; + this.maxStringLength = 50; + this.enableBackgroundDrawing = true; + this.canLoseFocus = true; + this.isFocused = false; + this.isEnabled = true; + this.i = 0; + this.cursorPosition = 0; + this.selectionEnd = 0; + this.enabledColor = 14737632; + this.disabledColor = 7368816; + this.b = true; + this.fontRenderer = par1FontRenderer; + this.xPos = par2; + this.yPos = par3; + this.width = par4; + this.height = par5; + } + + public void updateCursorCounter() { + ++this.cursorCounter; + } + + public void setText(final String par1Str) { + if (par1Str.length() > this.maxStringLength) { + this.text = par1Str.substring(0, this.maxStringLength); + } + else { + this.text = par1Str; + } + this.setCursorPositionEnd(); + } + + public String getText() { + final String newtext = this.text.replaceAll(" ", ""); + return newtext; + } + + public String getSelectedtext() { + final int var1 = (this.cursorPosition < this.selectionEnd) ? this.cursorPosition : this.selectionEnd; + final int var2 = (this.cursorPosition < this.selectionEnd) ? this.selectionEnd : this.cursorPosition; + return this.text.substring(var1, var2); + } + + public void writeText(final String par1Str) { + String var2 = ""; + final String var3 = ChatAllowedCharacters.filterAllowedCharacters(par1Str); + final int var4 = (this.cursorPosition < this.selectionEnd) ? this.cursorPosition : this.selectionEnd; + final int var5 = (this.cursorPosition < this.selectionEnd) ? this.selectionEnd : this.cursorPosition; + final int var6 = this.maxStringLength - this.text.length() - (var4 - this.selectionEnd); + final boolean var7 = false; + if (this.text.length() > 0) { + var2 = String.valueOf(String.valueOf(var2)) + this.text.substring(0, var4); + } + int var8; + if (var6 < var3.length()) { + var2 = String.valueOf(String.valueOf(var2)) + var3.substring(0, var6); + var8 = var6; + } + else { + var2 = String.valueOf(String.valueOf(var2)) + var3; + var8 = var3.length(); + } + if (this.text.length() > 0 && var5 < this.text.length()) { + var2 = String.valueOf(String.valueOf(var2)) + this.text.substring(var5); + } + this.text = var2.replaceAll(" ", ""); + this.cursorPos(var4 - this.selectionEnd + var8); + } + + public void func_73779_a(final int par1) { + if (this.text.length() != 0) { + if (this.selectionEnd != this.cursorPosition) { + this.writeText(""); + } + else { + this.deleteFromCursor(this.getNthWordFromCursor(par1) - this.cursorPosition); + } + } + } + + public void deleteFromCursor(final int par1) { + if (this.text.length() != 0) { + if (this.selectionEnd != this.cursorPosition) { + this.writeText(""); + } + else { + final boolean var2 = par1 < 0; + final int var3 = var2 ? (this.cursorPosition + par1) : this.cursorPosition; + final int var4 = var2 ? this.cursorPosition : (this.cursorPosition + par1); + String var5 = ""; + if (var3 >= 0) { + var5 = this.text.substring(0, var3); + } + if (var4 < this.text.length()) { + var5 = String.valueOf(String.valueOf(var5)) + this.text.substring(var4); + } + this.text = var5; + if (var2) { + this.cursorPos(par1); + } + } + } + } + + public int getNthWordFromCursor(final int par1) { + return this.getNthWordFromPos(par1, this.getCursorPosition()); + } + + public int getNthWordFromPos(final int par1, final int par2) { + return this.type(par1, this.getCursorPosition(), true); + } + + public int type(final int par1, final int par2, final boolean par3) { + int var4 = par2; + final boolean var5 = par1 < 0; + for (int var6 = Math.abs(par1), var7 = 0; var7 < var6; ++var7) { + if (!var5) { + final int var8 = this.text.length(); + var4 = this.text.indexOf(32, var4); + if (var4 == -1) { + var4 = var8; + } + else { + while (par3) { + if (var4 >= var8) { + break; + } + if (this.text.charAt(var4) != ' ') { + break; + } + ++var4; + } + } + } + else { + while (par3) { + if (var4 <= 0) { + break; + } + if (this.text.charAt(var4 - 1) != ' ') { + break; + } + --var4; + } + while (var4 > 0 && this.text.charAt(var4 - 1) != ' ') { + --var4; + } + } + } + return var4; + } + + public void cursorPos(final int par1) { + this.setCursorPosition(this.selectionEnd + par1); + } + + public void setCursorPosition(final int par1) { + this.cursorPosition = par1; + final int var2 = this.text.length(); + if (this.cursorPosition < 0) { + this.cursorPosition = 0; + } + if (this.cursorPosition > var2) { + this.cursorPosition = var2; + } + this.func_73800_i(this.cursorPosition); + } + + public void setCursorPositionZero() { + this.setCursorPosition(0); + } + + public void setCursorPositionEnd() { + this.setCursorPosition(this.text.length()); + } + + public boolean textboxKeyTyped(final char par1, final int par2) { + if (!this.isEnabled || !this.isFocused) { + return false; + } + switch (par1) { + case '\u0001': { + this.setCursorPositionEnd(); + this.func_73800_i(0); + return true; + } + case '\u0003': { + GuiScreen.setClipboardString(this.getSelectedtext()); + return true; + } + case '\u0016': { + this.writeText(GuiScreen.getClipboardString()); + return true; + } + case '\u0018': { + GuiScreen.setClipboardString(this.getSelectedtext()); + this.writeText(""); + return true; + } + default: { + switch (par2) { + case 14: { + if (GuiScreen.isCtrlKeyDown()) { + this.func_73779_a(-1); + } + else { + this.deleteFromCursor(-1); + } + return true; + } + case 199: { + if (GuiScreen.isShiftKeyDown()) { + this.func_73800_i(0); + } + else { + this.setCursorPositionZero(); + } + return true; + } + case 203: { + if (GuiScreen.isShiftKeyDown()) { + if (GuiScreen.isCtrlKeyDown()) { + this.func_73800_i(this.getNthWordFromPos(-1, this.getSelectionEnd())); + } + else { + this.func_73800_i(this.getSelectionEnd() - 1); + } + } + else if (GuiScreen.isCtrlKeyDown()) { + this.setCursorPosition(this.getNthWordFromCursor(-1)); + } + else { + this.cursorPos(-1); + } + return true; + } + case 205: { + if (GuiScreen.isShiftKeyDown()) { + if (GuiScreen.isCtrlKeyDown()) { + this.func_73800_i(this.getNthWordFromPos(1, this.getSelectionEnd())); + } + else { + this.func_73800_i(this.getSelectionEnd() + 1); + } + } + else if (GuiScreen.isCtrlKeyDown()) { + this.setCursorPosition(this.getNthWordFromCursor(1)); + } + else { + this.cursorPos(1); + } + return true; + } + case 207: { + if (GuiScreen.isShiftKeyDown()) { + this.func_73800_i(this.text.length()); + } + else { + this.setCursorPositionEnd(); + } + return true; + } + case 211: { + if (GuiScreen.isCtrlKeyDown()) { + this.func_73779_a(1); + } + else { + this.deleteFromCursor(1); + } + return true; + } + default: { + if (ChatAllowedCharacters.isAllowedCharacter(par1)) { + this.writeText(Character.toString(par1)); + return true; + } + return false; + } + } + } + } + } + + public void mouseClicked(final int par1, final int par2, final int par3) { + final boolean var4 = par1 >= this.xPos && par1 < this.xPos + this.width && par2 >= this.yPos && par2 < this.yPos + this.height; + if (this.canLoseFocus) { + this.setFocused(this.isEnabled && var4); + } + if (this.isFocused && par3 == 0) { + int var5 = par1 - this.xPos; + if (this.enableBackgroundDrawing) { + var5 -= 4; + } + final String var6 = this.fontRenderer.trimStringToWidth(this.text.substring(this.i), this.getWidth()); + this.setCursorPosition(this.fontRenderer.trimStringToWidth(var6, var5).length() + this.i); + } + } + + public void drawTextBox() { + if (this.func_73778_q()) { + if (this.getEnableBackgroundDrawing()) { + Gui.drawRect(this.xPos - 1, this.yPos - 1, this.xPos + this.width + 1, this.yPos + this.height + 1, -6250336); + Gui.drawRect(this.xPos, this.yPos, this.xPos + this.width, this.yPos + this.height, -16777216); + } + final int var1 = this.isEnabled ? this.enabledColor : this.disabledColor; + final int var2 = this.cursorPosition - this.i; + int var3 = this.selectionEnd - this.i; + final String var4 = this.fontRenderer.trimStringToWidth(this.text.substring(this.i), this.getWidth()); + final boolean var5 = var2 >= 0 && var2 <= var4.length(); + final boolean var6 = this.isFocused && this.cursorCounter / 6 % 2 == 0 && var5; + final int var7 = this.enableBackgroundDrawing ? (this.xPos + 4) : this.xPos; + final int var8 = this.enableBackgroundDrawing ? (this.yPos + (this.height - 8) / 2) : this.yPos; + int var9 = var7; + if (var3 > var4.length()) { + var3 = var4.length(); + } + if (var4.length() > 0) { + if (var5) { + var4.substring(0, var2); + } + var9 = Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.text.replaceAll("(?s).", "*"), var7, var8, var1); + } + final boolean var10 = this.cursorPosition < this.text.length() || this.text.length() >= this.getMaxStringLength(); + int var11 = var9; + if (!var5) { + var11 = ((var2 > 0) ? (var7 + this.width) : var7); + } + else if (var10) { + var11 = var9 - 1; + --var9; + } + if (var4.length() > 0 && var5 && var2 < var4.length()) { + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(var4.substring(var2), var9, var8, var1); + } + if (var6) { + if (var10) { + Gui.drawRect(var11, var8 - 1, var11 + 1, var8 + 1 + this.fontRenderer.FONT_HEIGHT, -3092272); + } + else { + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow("_", var11, var8, var1); + } + } + if (var3 != var2) { + final int var12 = var7 + this.fontRenderer.getStringWidth(var4.substring(0, var3)); + this.drawCursorVertical(var11, var8 - 1, var12 - 1, var8 + 1 + this.fontRenderer.FONT_HEIGHT); + } + } + } + + private void drawCursorVertical(int par1, int par2, int par3, int par4) { + if (par1 < par3) { + final int var5 = par1; + par1 = par3; + par3 = var5; + } + if (par2 < par4) { + final int var5 = par2; + par2 = par4; + par4 = var5; + } + final Tessellator var6 = Tessellator.getInstance(); + final WorldRenderer var7 = var6.getWorldRenderer(); + GL11.glColor4f(0.0f, 0.0f, 255.0f, 255.0f); + GL11.glDisable(3553); + GL11.glEnable(3058); + GL11.glLogicOp(5387); + var7.begin(7, var7.getVertexFormat()); + var7.pos(par1, par4, 0.0); + var7.pos(par3, par4, 0.0); + var7.pos(par3, par2, 0.0); + var7.pos(par1, par2, 0.0); + var7.finishDrawing(); + GL11.glDisable(3058); + GL11.glEnable(3553); + } + + public void setMaxStringLength(final int par1) { + this.maxStringLength = par1; + if (this.text.length() > par1) { + this.text = this.text.substring(0, par1); + } + } + + public int getMaxStringLength() { + return this.maxStringLength; + } + + public int getCursorPosition() { + return this.cursorPosition; + } + + public boolean getEnableBackgroundDrawing() { + return this.enableBackgroundDrawing; + } + + public void setEnableBackgroundDrawing(final boolean par1) { + this.enableBackgroundDrawing = par1; + } + + public void func_73794_g(final int par1) { + this.enabledColor = par1; + } + + public void setFocused(final boolean par1) { + if (par1 && !this.isFocused) { + this.cursorCounter = 0; + } + this.isFocused = par1; + } + + public boolean isFocused() { + return this.isFocused; + } + + public int getSelectionEnd() { + return this.selectionEnd; + } + + public int getWidth() { + return this.getEnableBackgroundDrawing() ? (this.width - 8) : this.width; + } + + public void func_73800_i(int par1) { + final int var2 = this.text.length(); + if (par1 > var2) { + par1 = var2; + } + if (par1 < 0) { + par1 = 0; + } + this.selectionEnd = par1; + if (this.fontRenderer != null) { + if (this.i > var2) { + this.i = var2; + } + final int var3 = this.getWidth(); + final String var4 = this.fontRenderer.trimStringToWidth(this.text.substring(this.i), var3); + final int var5 = var4.length() + this.i; + if (par1 == this.i) { + this.i -= this.fontRenderer.trimStringToWidth(this.text, var3, true).length(); + } + if (par1 > var5) { + this.i += par1 - var5; + } + else if (par1 <= this.i) { + this.i -= this.i - par1; + } + if (this.i < 0) { + this.i = 0; + } + if (this.i > var2) { + this.i = var2; + } + } + } + + public void setCanLoseFocus(final boolean par1) { + this.canLoseFocus = par1; + } + + public boolean func_73778_q() { + return this.b; + } + + public void func_73790_e(final boolean par1) { + this.b = par1; + } +} diff --git a/src/minecraft/animeware/ui/login/UserLoginThread.java b/src/minecraft/animeware/ui/login/UserLoginThread.java new file mode 100644 index 0000000..7981797 --- /dev/null +++ b/src/minecraft/animeware/ui/login/UserLoginThread.java @@ -0,0 +1,63 @@ +package animeware.ui.login; + +import java.net.Proxy; + +import com.mojang.authlib.Agent; +import com.mojang.authlib.exceptions.AuthenticationException; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; + +import animeware.NightSky; +import animeware.gui.mainmenu.MainMenu; +import animeware.login.User; +import animeware.util.misc.Timer; +import net.minecraft.client.Minecraft; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.Session; + +public final class UserLoginThread extends Thread { + private final String password; + private String status; + private final String username; + private Minecraft mc = Minecraft.getMinecraft(); + private Timer timer = new Timer(); + + public UserLoginThread(String username, String password) { + super("Alt Login Thread"); + this.username = username; + this.password = password; + this.status = (Object)((Object)EnumChatFormatting.GRAY) + "Waiting..."; + } + + private boolean User(String username, String password) { + for(User u : NightSky.INSTANCE.users.getUsers()) { + if(u.getName().equals(username) && u.getPassword().equals(password)) { + return true; + } + } + return false; + } + + public String getStatus() { + return this.status; + } + + @Override + public void run() { + if (User(this.username, this.password)) { + //this.mc.session = new Session(this.username, "", "", "mojang"); + this.status = (Object)((Object)EnumChatFormatting.GREEN) + "Logged in! (" + this.username + ")"; + mc.displayGuiScreen(new MainMenu()); + return; + } + this.status = (Object)((Object)EnumChatFormatting.YELLOW) + "Logging in..."; + if (!User(this.username, this.password)) { + this.status = (Object)((Object)EnumChatFormatting.RED) + "Login failed!"; + } + } + + public void setStatus(String status) { + this.status = status; + } +} + diff --git a/src/minecraft/animeware/ui/themes/AstolfoButtons.java b/src/minecraft/animeware/ui/themes/AstolfoButtons.java new file mode 100644 index 0000000..4d352ff --- /dev/null +++ b/src/minecraft/animeware/ui/themes/AstolfoButtons.java @@ -0,0 +1,25 @@ +package animeware.ui.themes; + +import animeware.hud.mod.HudMod; +import animeware.ui.themes.impl.ThemeManager; +import net.minecraft.util.ResourceLocation; + +public class AstolfoButtons extends HudMod { + + public AstolfoButtons() { + super("Astolfo Buttons", "", new ResourceLocation("Animeware/icons/blank.png"), 0, 0); + } + @Override + public void onEnable() { + ThemeManager.astolfoBtn = true; + //ClickGUI.setTheme(GUITheme.DARK); + //super.onEnable(); + } + @Override + public void onDisable() { + ThemeManager.astolfoBtn = false; + //ClickGUI.setTheme(GUITheme.LIGHT); + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/ui/themes/GUIDark.java b/src/minecraft/animeware/ui/themes/GUIDark.java new file mode 100644 index 0000000..0ab593a --- /dev/null +++ b/src/minecraft/animeware/ui/themes/GUIDark.java @@ -0,0 +1,27 @@ +package animeware.ui.themes; + +import animeware.gui.clickgui.ClickGUI; +import animeware.gui.clickgui.GUITheme; +import animeware.ui.themes.impl.ThemeManager; +import animeware.ui.themes.impl.ThemeMod; +import net.minecraft.util.ResourceLocation; + +public class GUIDark extends ThemeMod { + + public GUIDark() { + super("TNTTimer", "", new ResourceLocation("Animeware/icons/blank.png"), 0, 0); + } + @Override + public void onEnable() { + ThemeManager.guidark = true; + ClickGUI.setTheme(GUITheme.DARK); + //super.onEnable(); + } + @Override + public void onDisable() { + ThemeManager.guidark = false; + ClickGUI.setTheme(GUITheme.LIGHT); + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/ui/themes/GUILight.java b/src/minecraft/animeware/ui/themes/GUILight.java new file mode 100644 index 0000000..9536a93 --- /dev/null +++ b/src/minecraft/animeware/ui/themes/GUILight.java @@ -0,0 +1,28 @@ +package animeware.ui.themes; + +import animeware.gui.clickgui.ClickGUI; +import animeware.gui.clickgui.GUITheme; +import animeware.hud.mod.HudMod; +import animeware.ui.themes.impl.ThemeManager; +import animeware.ui.themes.impl.ThemeMod; +import net.minecraft.util.ResourceLocation; + +public class GUILight extends HudMod { + + public GUILight() { + super("Light theme", "", new ResourceLocation("Animeware/icons/blank.png"), 0, 0); + } + @Override + public void onEnable() { + ThemeManager.guilight = true; + //ClickGUI.setTheme(GUITheme.LIGHT); + //super.onEnable(); + } + @Override + public void onDisable() { + ThemeManager.guilight = false; + //ClickGUI.setTheme(GUITheme.DARK); + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/ui/themes/color/ColorScheme.java b/src/minecraft/animeware/ui/themes/color/ColorScheme.java new file mode 100644 index 0000000..c319ba8 --- /dev/null +++ b/src/minecraft/animeware/ui/themes/color/ColorScheme.java @@ -0,0 +1,29 @@ +package animeware.ui.themes.color; + +import animeware.hud.mod.HudMod; +import animeware.ui.themes.impl.ThemeManager; +import animeware.util.settings.ModeSetting; +import net.minecraft.util.ResourceLocation; + +public class ColorScheme extends HudMod { + + public ModeSetting color = new ModeSetting("Color", "White", "White", "Blue", "Cyan", "Red", "Purple", "Chroma");; + + public ColorScheme() { + super("Color Scheme", "Right-click for settings", new ResourceLocation("Animeware/icons/blank.png"), 0, 0); + this.addSettings(color); + } + @Override + public void onEnable() { + //ThemeManager.guilight = true; + //ClickGUI.setTheme(GUITheme.LIGHT); + //super.onEnable(); + } + @Override + public void onDisable() { + //ThemeManager.guilight = false; + //ClickGUI.setTheme(GUITheme.DARK); + //super.onDisable(); + } + +} diff --git a/src/minecraft/animeware/ui/themes/impl/ThemeButton.java b/src/minecraft/animeware/ui/themes/impl/ThemeButton.java new file mode 100644 index 0000000..421478b --- /dev/null +++ b/src/minecraft/animeware/ui/themes/impl/ThemeButton.java @@ -0,0 +1,94 @@ +package animeware.ui.themes.impl; + +import java.awt.Color; + +import animeware.util.font.FontUtil; +import animeware.util.render.DrawUtil; +import animeware.util.render.RoundedUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreen; + +public class ThemeButton { + + public int x, y, w, h; + public ThemeMod m; + private boolean enabled; + boolean allowClick; + boolean allowDraw; + + int width = GuiScreen.width; + int height = GuiScreen.height; + + Minecraft mc = Minecraft.getMinecraft(); + + public ThemeButton(int x, int y, int w, int h, ThemeMod m) { + this.x = x; + this.y = y; + this.w = w; + this.h = h; + this.m = m; + this.enabled = false; + + } + + public void draw() { + Gui.drawRect(x, y, x + w, y + h, new Color(0, 0, 0, 0).getRGB()); + //RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 90, y + h, 18.0F, new Color(40, 40, 45, 255).getRGB()); + RoundedUtils.drawSmoothRoundedRect(x, y, x + w, y + h, 18.0F, new Color(50, 50, 55, 155).getRGB()); //70, 70, 75, 155 + if(m.isEnabled()) { + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 190, y + h, 18.0F, new Color(0, 150, 200, 255).getRGB()); + //DrawUtil.drawRoundedRect(x - 1, y - 5, x + w + 1, y + h + 1, 7 , new Color(200, 0, 0, 100).getRGB()); + }else { + RoundedUtils.drawSmoothRoundedRect(x, y, x + w - 190, y + h, 18.0F, new Color(50, 50, 55, 255).getRGB()); + //DrawUtil.drawRoundedRect(x - 1, y - 5, x + w + 1, y + h + 1, 7 , new Color(105, 105, 105, 100).getRGB()); + } + + //DrawUtil.drawRoundedRect(x, y - 4, x + w, y + h, 7 , new Color(205, 205, 205, 0).getRGB()); + //DrawUtil.drawRoundedRect(x, y - 4, x + w, y + h, 7 , new Color(15, 15, 15, 255).getRGB()); + FontUtil.normal.drawString(m.name, x + 45, y + 14, getColor()); + FontUtil.normal.drawString(m.description, x + 45, y + 25, new Color(70, 70, 75, 255).getRGB()); + if(!m.getIcon().getResourcePath().equals("")) { + DrawUtil.draw2DImage(m.getIcon(), x + 5, y + 5, 25, 25, Color.WHITE); + } + //GuiScreen.buttonList.add(new SettingsCGButton(2, 262, height / 3 - 10, "")); + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation ("Animeware/background/logo.png")); + + } + + + private int getColor() { + if(m.isEnabled()) { + return new Color(155, 155, 155, 250).getRGB(); + }else { + return new Color(155, 155, 155, 250).getRGB(); + } + + } + + public void onClick(int mouseX, int mouseY, int Button) { + if(mouseX >= x && mouseX <= x + w && mouseY >= y && mouseY <= y +h) { + if(Button == 0) { + m.toggle(); + System.out.println(this.getModNameToggle()); + } + + } + + } + private String getModNameToggle() { + if(m.enabled) { + return m.name + ": enabled"; + } else if(!m.enabled) { + return m.name + ": disabled"; + }else { + return m.name; + } + } + + private String getModName() { + return m.name; + } + + +} diff --git a/src/minecraft/animeware/ui/themes/impl/ThemeManager.java b/src/minecraft/animeware/ui/themes/impl/ThemeManager.java new file mode 100644 index 0000000..1bb77f0 --- /dev/null +++ b/src/minecraft/animeware/ui/themes/impl/ThemeManager.java @@ -0,0 +1,30 @@ +package animeware.ui.themes.impl; + +import java.util.ArrayList; + +import animeware.ui.themes.GUIDark; +import animeware.ui.themes.GUILight; + +public class ThemeManager { + + public static boolean guidark; + public static boolean guilight; + public static boolean astolfoBtn; + + public static ArrayList themes = new ArrayList<>(); + + public GUIDark guiDark; + public GUILight guiLight; + + public ThemeManager() { + themes = new ArrayList<>(); + + themes.add(guiDark = new GUIDark()); + //themes.add(guiLight = new GUILight()); + + } + public static ArrayList getThemes() { + return themes; + } + +} diff --git a/src/minecraft/animeware/ui/themes/impl/ThemeMod.java b/src/minecraft/animeware/ui/themes/impl/ThemeMod.java new file mode 100644 index 0000000..747cde7 --- /dev/null +++ b/src/minecraft/animeware/ui/themes/impl/ThemeMod.java @@ -0,0 +1,167 @@ +package animeware.ui.themes.impl; + +import java.awt.Color; +import java.util.List; + +import com.google.common.collect.Lists; + +import animeware.NightSky; +import animeware.event.EventManager; +import animeware.hud.DraggableComponent; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiLabel; +import net.minecraft.util.ResourceLocation; + +public class ThemeMod { + + public Minecraft mc = Minecraft.getMinecraft(); + public FontRenderer fr = mc.fontRendererObj; + protected List buttonList = Lists.newArrayList(); + protected List labelList = Lists.newArrayList(); + + //public List settings = new ArrayList(); + + public static boolean expanded; + public int lenght = 10; + public String name; + public String description; + public ResourceLocation icon; + //public boolean isEnabled = false; + public boolean enabled; + public DraggableComponent drag; + + public int index; + + public int x, y, w, h; + + public ThemeMod(String name, String description, ResourceLocation icon, int x, int y) { + this.name = name; + this.description = description; + this.icon = icon; + + try { + this.x = ((Integer)NightSky.INSTANCE.config.config.get(String.valueOf(name.toLowerCase()) + " x")).intValue(); + this.y = ((Integer)NightSky.INSTANCE.config.config.get(String.valueOf(name.toLowerCase()) + " y")).intValue(); + setEnabled(((Boolean)NightSky.INSTANCE.config.config.get(String.valueOf(name.toLowerCase()) + " enabled")).booleanValue()); + } catch (NullPointerException e) { + //e.printStackTrace(); + System.out.println("Conlig Load Failed - ThemeMod"); + this.x = x; + this.y = y; + this.enabled = false; + } + + drag = new DraggableComponent(this.x, this.y, getWidth(), getHeight(), new Color(0, 0, 0, 0).getRGB()); + } + + + public int getWidth() { + + return 50; + + } + + public int getHeight() { + return 50; + + } + public ResourceLocation getIcon() { + return icon; + } + + public void draw() { + + } + + public void renderDummy(int mouseX, int mouseY) { + drag.draw(mouseX, mouseY); + + } + + public int getX() { + return drag.getxPosition(); + } + + public int getY() { + return drag.getyPosition(); + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + if(enabled) { + onEnable(); + } + else { + onDisable(); + } + } + public void setDisabled(boolean enabled) { + this.enabled = !enabled; + if(!enabled) { + onDisable(); + } + else { + onEnable(); + } + } + + public void onEnable() {EventManager.register(this);} + + public void toggle() { + this.setEnabled(!enabled); + + } + public void expand() { + if(expanded) { + expanded = false; + } else { + expanded = true; + } + + } + + + + public boolean isEnabled() { + return enabled; + } + public boolean isDisabled() { + return !enabled; + } + + + public void onDisable() { + NightSky.INSTANCE.eventManager.unregister(this); + + } + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + for (int i = 0; i < this.buttonList.size(); ++i) + { + ((GuiButton)this.buttonList.get(i)).drawButton(this.mc, mouseX, mouseY); + } + + for (int j = 0; j < this.labelList.size(); ++j) + { + ((GuiLabel)this.labelList.get(j)).drawLabel(this.mc, mouseX, mouseY); + } + } + //@Override + public String getToggled() { + return "Toggled"; + } + public void Notif() { + + } + + +} + + + + + + + diff --git a/src/minecraft/animeware/util/ChromaString.java b/src/minecraft/animeware/util/ChromaString.java new file mode 100644 index 0000000..0913639 --- /dev/null +++ b/src/minecraft/animeware/util/ChromaString.java @@ -0,0 +1,22 @@ +/* */ package animeware.util; +/* */ +/* */ import java.awt.Color; +/* */ import net.minecraft.client.Minecraft; +/* */ +/* */ +/* */ public class ChromaString +/* */ { +/* */ public static void drawChromaString(String string, int x, int y, int k) { +/* 10 */ Minecraft mc = Minecraft.getMinecraft(); +/* */ +/* 12 */ int xTmp = x; byte b; int i; char[] arrayOfChar; +/* 13 */ for (i = (arrayOfChar = string.toCharArray()).length, b = 0; b < i; ) { char textChar = arrayOfChar[b]; +/* 14 */ long l = System.currentTimeMillis() - (xTmp * 10 - y * 10); +/* 15 */ int j = Color.HSBtoRGB((float)(l % 2000L) / 2000.0F, 0.8F, 0.8F); +/* 16 */ String tmp = String.valueOf(textChar); +/* 17 */ mc.fontRendererObj.drawString(tmp, xTmp, y, j); +/* 18 */ xTmp += mc.fontRendererObj.getCharWidth(textChar); +/* */ b++; } +/* */ +/* */ } +/* */ } diff --git a/src/minecraft/animeware/util/ClientPanorama.java b/src/minecraft/animeware/util/ClientPanorama.java new file mode 100644 index 0000000..64c78ad --- /dev/null +++ b/src/minecraft/animeware/util/ClientPanorama.java @@ -0,0 +1,54 @@ +package animeware.util; + +import net.minecraft.util.ResourceLocation; + +import java.util.Calendar; +import java.util.Date; + +public class ClientPanorama { + + private static final ResourceLocation BACKGROUND_NORMAL = new ResourceLocation("Animeware/panorama/normal/background.png"); + private static final ResourceLocation BACKGROUND_CHRISTMAS = new ResourceLocation("Animeware/panorama/christmas/background.png"); + + private static final ResourceLocation[] TILES_NORMAL = new ResourceLocation[] { + new ResourceLocation("Animeware/panorama/normal/panorama_0.png"), + new ResourceLocation("Animeware/panorama/normal/panorama_1.png"), + new ResourceLocation("Animeware/panorama/normal/panorama_2.png"), + new ResourceLocation("Animeware/panorama/normal/panorama_3.png"), + new ResourceLocation("Animeware/panorama/normal/panorama_4.png"), + new ResourceLocation("Animeware/panorama/normal/panorama_5.png") + }; + private static final ResourceLocation[] TILES_CHRISTMAS = new ResourceLocation[] { + new ResourceLocation("Animeware/panorama/christmas/panorama_0.png"), + new ResourceLocation("Animeware/panorama/christmas/panorama_1.png"), + new ResourceLocation("Animeware/panorama/christmas/panorama_2.png"), + new ResourceLocation("Animeware/panorama/christmas/panorama_3.png"), + new ResourceLocation("Animeware/panorama/christmas/panorama_4.png"), + new ResourceLocation("Animeware/panorama/christmas/panorama_5.png") + }; + + public static ResourceLocation[] getTiles() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + + if(isChristmas(calendar)) + return TILES_CHRISTMAS; + + return TILES_NORMAL; + } + + public static ResourceLocation getBackground() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + + if(isChristmas(calendar)) + return BACKGROUND_CHRISTMAS; + + return BACKGROUND_NORMAL; + } + + private static boolean isChristmas(Calendar calendar) { + return calendar.get(2) + 1 == 12; + } + +} diff --git a/src/minecraft/animeware/util/DatabaseUtil.java b/src/minecraft/animeware/util/DatabaseUtil.java new file mode 100644 index 0000000..8df9b81 --- /dev/null +++ b/src/minecraft/animeware/util/DatabaseUtil.java @@ -0,0 +1,78 @@ +// +// Decompiled by Procyon v0.5.36 +// + +package animeware.util; + +import java.io.IOException; +import java.net.URL; +import java.util.Scanner; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +public class DatabaseUtil +{ + private static String stringurl; + private static JsonArray data; + + static { + DatabaseUtil.stringurl = "https://raw.githubusercontent.com/cornly/coscoremod/main/cos.json"; + } + + public static void parseData() { + URL url = null; + try { + url = new URL(DatabaseUtil.stringurl); + final Scanner scanner = new Scanner(url.openStream(), "UTF-8").useDelimiter("\\A"); + final String result = scanner.next(); + final JsonParser parser = new JsonParser(); + DatabaseUtil.data = parser.parse(result).getAsJsonArray(); + scanner.close(); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static boolean getBoolean(final String playerUUID, final String key) throws IOException { + for (int i = 0; i < DatabaseUtil.data.size(); ++i) { + final JsonObject jsonObject = DatabaseUtil.data.get(i).getAsJsonObject(); + if (jsonObject.get("uuid").getAsString().equals(playerUUID) && jsonObject.get(key).getAsBoolean()) { + return true; + } + } + return false; + } + + public static double getDouble(final String playerUUID, final String key) throws IOException { + for (int i = 0; i < DatabaseUtil.data.size(); ++i) { + final JsonObject jsonObject = DatabaseUtil.data.get(i).getAsJsonObject(); + if (jsonObject.get("uuid").getAsString().equals(playerUUID)) { + return jsonObject.get(key).getAsDouble(); + } + } + return (Double) null; + } + + public static String getString(final String playerUUID, final String key) throws IOException { + for (int i = 0; i < DatabaseUtil.data.size(); ++i) { + final JsonObject jsonObject = DatabaseUtil.data.get(i).getAsJsonObject(); + if (jsonObject.get("uuid").getAsString().equals(playerUUID)) { + return jsonObject.get(key).getAsString(); + } + } + return null; + } + + public static Integer getInt(final String playerUUID, final String key) throws IOException { + for (int i = 0; i < DatabaseUtil.data.size(); ++i) { + final JsonObject jsonObject = DatabaseUtil.data.get(i).getAsJsonObject(); + if (jsonObject.get("uuid").getAsString().equals(playerUUID)) { + return jsonObject.get(key).getAsInt(); + } + } + return null; + } +} diff --git a/src/minecraft/animeware/util/FakeUtils/FakeChunkProvider.java b/src/minecraft/animeware/util/FakeUtils/FakeChunkProvider.java new file mode 100644 index 0000000..f17c0e2 --- /dev/null +++ b/src/minecraft/animeware/util/FakeUtils/FakeChunkProvider.java @@ -0,0 +1,87 @@ +package animeware.util.FakeUtils; + + + +import java.util.List; + +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; + +public class FakeChunkProvider implements IChunkProvider { + + @Override + public boolean chunkExists(int x, int z) { + return false; + } + + @Override + public Chunk provideChunk(int x, int z) { + return null; + } + + @Override + public Chunk provideChunk(BlockPos blockPosIn) { + return null; + } + + @Override + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { + + } + + @Override + public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) { + return false; + } + + @Override + public boolean saveChunks(boolean p_73151_1_, IProgressUpdate progressCallback) { + return false; + } + + @Override + public boolean unloadQueuedChunks() { + return false; + } + + @Override + public boolean canSave() { + return false; + } + + @Override + public String makeString() { + return null; + } + + @Override + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { + return null; + } + + @Override + public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) { + return null; + } + + @Override + public int getLoadedChunkCount() { + return 0; + } + + @Override + public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) { + + } + + @Override + public void saveExtraData() { + + } + +} diff --git a/src/minecraft/animeware/util/FakeUtils/FakeNetworkManager.java b/src/minecraft/animeware/util/FakeUtils/FakeNetworkManager.java new file mode 100644 index 0000000..3a8879d --- /dev/null +++ b/src/minecraft/animeware/util/FakeUtils/FakeNetworkManager.java @@ -0,0 +1,15 @@ +package animeware.util.FakeUtils; + + +import net.minecraft.network.EnumPacketDirection; +import net.minecraft.network.NetworkManager; + +public class FakeNetworkManager extends NetworkManager { + + //Not sure if I need to override anything in here. It seems to work fine without overriding packets being sent + + public FakeNetworkManager(EnumPacketDirection packetDirection) { + super(packetDirection); + } + +} diff --git a/src/minecraft/animeware/util/FakeUtils/FakeNetworkPlayerInfo.java b/src/minecraft/animeware/util/FakeUtils/FakeNetworkPlayerInfo.java new file mode 100644 index 0000000..df69e0a --- /dev/null +++ b/src/minecraft/animeware/util/FakeUtils/FakeNetworkPlayerInfo.java @@ -0,0 +1,43 @@ +package animeware.util.FakeUtils; + +import com.mojang.authlib.GameProfile; + +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.WorldSettings.GameType; + +public class FakeNetworkPlayerInfo extends NetworkPlayerInfo { + + public FakeNetworkPlayerInfo(GameProfile gp) { + super(gp); + } + + @Override + public IChatComponent getDisplayName() { + return new ChatComponentText(getGameProfile().getName()); + } + + @Override + public GameType getGameType() { + return GameType.CREATIVE; + } + + @Override + public int getResponseTime() { + return 0; + } + + //slim, default + @Override + public String getSkinType() { + return "default"; + } + + @Override + public ScorePlayerTeam getPlayerTeam() { + return null; + } + +} diff --git a/src/minecraft/animeware/util/FakeUtils/FakePlayer.java b/src/minecraft/animeware/util/FakeUtils/FakePlayer.java new file mode 100644 index 0000000..3ab5f3c --- /dev/null +++ b/src/minecraft/animeware/util/FakeUtils/FakePlayer.java @@ -0,0 +1,72 @@ +package animeware.util.FakeUtils; + +import java.util.UUID; + +import com.mojang.authlib.GameProfile; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.network.EnumPacketDirection; +import net.minecraft.util.MovementInput; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class FakePlayer extends EntityPlayerSP { + + public FakePlayer(Minecraft mc, World world) { + this(mc, world, checkNullGameProfile()); + } + + public FakePlayer(Minecraft mc, World world, GameProfile gp) { + super(mc, world, new NetHandlerPlayClient(mc, mc.currentScreen, new FakeNetworkManager(EnumPacketDirection.CLIENTBOUND), gp) { + @Override + public NetworkPlayerInfo getPlayerInfo(String p_175104_1_) { + return new FakeNetworkPlayerInfo(gp); + } + @Override + public NetworkPlayerInfo getPlayerInfo(UUID p_175102_1_) { + return new FakeNetworkPlayerInfo(gp); + } + }, null); + + this.dimension = 0; + this.movementInput = new MovementInput(); + this.posX = 0; + this.posY = 0; + this.posZ = 0; + } + + @Override + public float getEyeHeight() { + return 1.82F; + } + + @Override + public boolean isWearing(EnumPlayerModelParts p_175148_1_) { + return true; + } + + //getPlayerInfo() is aparently not called in hasPlayerInfo? Not super sure why + @Override + public boolean hasPlayerInfo() { + return true; + } + + //might not be nessessary, not sure as of now + @Override + protected NetworkPlayerInfo getPlayerInfo() { + return new FakeNetworkPlayerInfo(getGameProfile()); + } + + //Some people were experiencing a null GameProfile for their session + //Not sure why, but his is a fix for it + private static GameProfile checkNullGameProfile() { + if(Minecraft.getMinecraft().getSession() == null || Minecraft.getMinecraft().getSession().getProfile() == null) { + return new GameProfile(UUID.randomUUID(), "FakePlayer"); + } + return Minecraft.getMinecraft().getSession().getProfile(); + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/FakeUtils/FakeSaveHandler.java b/src/minecraft/animeware/util/FakeUtils/FakeSaveHandler.java new file mode 100644 index 0000000..315c784 --- /dev/null +++ b/src/minecraft/animeware/util/FakeUtils/FakeSaveHandler.java @@ -0,0 +1,67 @@ +package animeware.util.FakeUtils; + + + +import java.io.File; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.chunk.storage.IChunkLoader; +import net.minecraft.world.storage.IPlayerFileData; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; + +public class FakeSaveHandler implements ISaveHandler { + + @Override + public WorldInfo loadWorldInfo() { + return null; + } + + @Override + public void checkSessionLock() throws MinecraftException { + + } + + @Override + public IChunkLoader getChunkLoader(WorldProvider provider) { + return null; + } + + @Override + public void saveWorldInfoWithPlayer(WorldInfo worldInformation, NBTTagCompound tagCompound) { + + } + + @Override + public void saveWorldInfo(WorldInfo worldInformation) { + + } + + @Override + public IPlayerFileData getPlayerNBTManager() { + return null; + } + + @Override + public void flush() { + + } + + @Override + public File getWorldDirectory() { + return null; + } + + @Override + public File getMapFileFromName(String mapName) { + return null; + } + + @Override + public String getWorldDirectoryName() { + return ""; + } + +} diff --git a/src/minecraft/animeware/util/FakeUtils/FakeWorld.java b/src/minecraft/animeware/util/FakeUtils/FakeWorld.java new file mode 100644 index 0000000..0924249 --- /dev/null +++ b/src/minecraft/animeware/util/FakeUtils/FakeWorld.java @@ -0,0 +1,658 @@ +package animeware.util.FakeUtils; + + + +import java.util.List; + +import com.google.common.base.Predicate; + +import java.util.ArrayList; +import java.util.Collection; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.profiler.Profiler; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldSavedData; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.BiomeGenPlains; +import net.minecraft.world.border.WorldBorder; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; + +public class FakeWorld extends World { + + public FakeWorld(WorldInfo info) { + super(new FakeSaveHandler(), info, new FakeWorldProvider(), new Profiler(), true); + this.provider.registerWorld(this); + } + + @Override + protected IChunkProvider createChunkProvider() { + return new FakeChunkProvider(); + } + + @Override + protected int getRenderDistanceChunks() { + return 0; + } + + @Override + public BiomeGenBase getBiomeGenForCoords(BlockPos pos) { + return BiomeGenBase.plains; + } + + @Override + protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) { + return false; + } + + @Override + public BlockPos getTopSolidOrLiquidBlock(BlockPos pos) { + return new BlockPos(pos.getX(), 63, pos.getZ()); + } + + @Override + public boolean isAirBlock(BlockPos pos) { + return pos.getY() > 63; + } + + @Override + public IBlockState getBlockState(BlockPos pos) { + return pos.getY() > 63 ? Blocks.air.getDefaultState() : Blocks.grass.getDefaultState(); + } + + @Override + public boolean setBlockState(BlockPos pos, IBlockState newState, int flags) { + return true; + } + + @Override + public boolean setBlockState(BlockPos pos, IBlockState state) { + return true; + } + + @Override + public boolean setBlockToAir(BlockPos pos) { + return true; + } + + @Override + public void markChunkDirty(BlockPos pos, TileEntity unusedTileEntity) { + + } + + @Override + public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) { + + } + + @Override + public boolean destroyBlock(BlockPos pos, boolean dropBlock) { + return this.isAirBlock(pos); + } + + @Override + public void notifyBlockOfStateChange(BlockPos pos, Block blockIn) { + + } + + @Override + public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide) { + + } + + @Override + public void markBlockForUpdate(BlockPos pos) { + + } + + @Override + public void notifyLightSet(BlockPos pos) { + + } + + @Override + public void notifyNeighborsRespectDebug(BlockPos pos, Block blockType) { + + } + + @Override + public void markBlockRangeForRenderUpdate(BlockPos rangeMin, BlockPos rangeMax) { + + } + + @Override + public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) { + + } + + @Override + public void markBlocksDirtyVertical(int x1, int z1, int x2, int z2) { + + } + + @Override + public void markTileEntityForRemoval(TileEntity tileEntityIn) { + + } + + @Override + public boolean isBlockTickPending(BlockPos pos, Block blockType) { + return false; + } + + @Override + public int getLight(BlockPos pos) { + return 14; + } + + @Override + public int getLight(BlockPos pos, boolean checkNeighbors) { + return 14; + } + + @Override + public int getLightFor(EnumSkyBlock type, BlockPos pos) { + return 14; + } + + @Override + public int getLightFromNeighbors(BlockPos pos) { + return 14; + } + + @Override + public int getLightFromNeighborsFor(EnumSkyBlock type, BlockPos pos) { + return 14; + } + + @Override + public boolean canBlockSeeSky(BlockPos pos) { + return pos.getY() > 62; + } + + @Override + public BlockPos getHeight(BlockPos pos) { + return new BlockPos(pos.getX(), 63, pos.getZ()); + } + + @Override + public int getChunksLowestHorizon(int x, int z) { + return 63; + } + + @Override + protected void updateBlocks() { + + } + + @Override + public void setLightFor(EnumSkyBlock type, BlockPos pos, int lightValue) { + + } + + @Override + public float getLightBrightness(BlockPos pos) { + return 1f; + } + + @Override + public float getSunBrightness(float p_72971_1_) { + return 1f; + } + + @Override + public boolean isDaytime() { + return true; + } + + @Override + public void playSound(double x, double y, double z, String soundName, float volume, float pitch, boolean distanceDelay) { + + } + + @Override + public void playSoundAtEntity(Entity entityIn, String name, float volume, float pitch) { + + } + + @Override + public void playSoundEffect(double x, double y, double z, String soundName, float volume, float pitch) { + + } + + @Override + public void playSoundToNearExcept(EntityPlayer player, String name, float volume, float pitch) { + + } + + @Override + public void spawnParticle(EnumParticleTypes particleType, boolean p_175682_2_, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int... p_175682_15_) { + + } + + @Override + public void spawnParticle(EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int... p_175688_14_) { + + } + + @Override + public void playRecord(BlockPos pos, String name) { + + } + + @Override + public MovingObjectPosition rayTraceBlocks(Vec3 p_72933_1_, Vec3 p_72933_2_) { + return null; + } + + @Override + public MovingObjectPosition rayTraceBlocks(Vec3 start, Vec3 end, boolean stopOnLiquid) { + return null; + } + + @Override + public MovingObjectPosition rayTraceBlocks(Vec3 vec31, Vec3 vec32, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) { + return null; + } + + @Override + public boolean addWeatherEffect(Entity entityIn) { + return false; + } + + @Override + public boolean spawnEntityInWorld(Entity entityIn) { + return false; + } + + @Override + protected void onEntityAdded(Entity entityIn) { + + } + + @Override + protected void onEntityRemoved(Entity entityIn) { + + } + + @Override + public void removeEntity(Entity entityIn) { + + } + + @Override + public void removePlayerEntityDangerously(Entity entityIn) { + + } + + @Override + public int calculateSkylightSubtracted(float p_72967_1_) { + return 6; + } + + @Override + public void scheduleBlockUpdate(BlockPos pos, Block blockIn, int delay, int priority) { + + } + + @Override + public void updateEntities() { + + } + + @Override + public void updateEntityWithOptionalForce(Entity entityIn, boolean forceUpdate) { + if (forceUpdate) { + ++entityIn.ticksExisted; + } + } + + @Override + public boolean checkNoEntityCollision(AxisAlignedBB bb) { + return true; + } + + @Override + public boolean checkNoEntityCollision(AxisAlignedBB bb, Entity entityIn) { + return true; + } + + @Override + public boolean checkBlockCollision(AxisAlignedBB bb) { + return false; + } + + @Override + public boolean isAnyLiquid(AxisAlignedBB bb) { + return false; + } + + @Override + public boolean handleMaterialAcceleration(AxisAlignedBB par1AxisAlignedBB, Material par2Material, Entity par3Entity) { + return false; + } + + @Override + public boolean isMaterialInBB(AxisAlignedBB par1AxisAlignedBB, Material par2Material) { + return false; + } + + @Override + public boolean isAABBInMaterial(AxisAlignedBB par1AxisAlignedBB, Material par2Material) { + return false; + } + + @Override + public TileEntity getTileEntity(BlockPos pos) { + return null; + } + + @Override + public boolean extinguishFire(EntityPlayer player, BlockPos pos, EnumFacing side) { + return true; + } + + @Override + public String getDebugLoadedEntities() { + return ""; + } + + @Override + public String getProviderName() { + return ""; + } + + @Override + public void setTileEntity(BlockPos pos, TileEntity tileEntityIn) { + + } + + @Override + public void removeTileEntity(BlockPos pos) { + + } + + @Override + public boolean isBlockNormalCube(BlockPos pos, boolean _default) { + return true; + } + + @Override + public void tick() { + + } + + @Override + protected void updateWeather() { + + } + + @Override + public boolean canBlockFreezeWater(BlockPos pos) { + return false; + } + + @Override + public boolean canBlockFreezeNoWater(BlockPos pos) { + return false; + } + + @Override + public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) { + return false; + } + + @Override + public boolean canSnowAt(BlockPos pos, boolean checkLight) { + return false; + } + + @Override + public boolean tickUpdates(boolean par1) { + return false; + } + + @Override + public List getPendingBlockUpdates(Chunk par1Chunk, boolean par2) { + return null; + } + + @Override + public Entity findNearestEntityWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, Entity par3Entity) { + return null; + } + + @Override + public void loadEntities(Collection entityCollection) { + + } + + @Override + public void unloadEntities(Collection entityCollection) { + + } + + @Override + public int countEntities(Class par1Class) { + return 0; + } + + @Override + public int getStrongPower(BlockPos pos) { + return 0; + } + + @Override + public int getStrongPower(BlockPos pos, EnumFacing direction) { + return 0; + } + + @Override + public boolean isSidePowered(BlockPos pos, EnumFacing side) { + return false; + } + + @Override + public int getRedstonePower(BlockPos pos, EnumFacing facing) { + return 0; + } + + @Override + public boolean isBlockPowered(BlockPos pos) { + return false; + } + + @Override + public int isBlockIndirectlyGettingPowered(BlockPos pos) { + return 0; + } + + @Override + public void checkSessionLock() throws MinecraftException { + } + + @Override + public long getSeed() { + return 1; + } + + @Override + public long getTotalWorldTime() { + return 1; + } + + @Override + public long getWorldTime() { + return 1; + } + + @Override + public void setWorldTime(long par1) { + } + + @Override + public BlockPos getSpawnPoint() { + return new BlockPos(0, 64, 0); + } + + @Override + public void joinEntityInSurroundings(Entity par1Entity) { + } + + @Override + public boolean canSeeSky(BlockPos pos) { + return pos.getY() > 62; + } + + @Override + public void setEntityState(Entity par1Entity, byte par2) { + } + + @Override + public float getThunderStrength(float delta) { + return 0.0F; + } + + @Override + public void addBlockEvent(BlockPos pos, Block blockIn, int eventID, int eventParam) { + } + + @Override + public void updateAllPlayersSleepingFlag() { + } + + @Override + public void setThunderStrength(float p_147442_1_) { + } + + @Override + public float getRainStrength(float par1) { + return 0.0F; + } + + @Override + public void setRainStrength(float par1) { + } + + @Override + public boolean isThundering() { + return false; + } + + @Override + public boolean isRaining() { + return false; + } + + @Override + public boolean isBlockinHighHumidity(BlockPos pos) { + return false; + } + + @Override + public void setItemData(String par1Str, WorldSavedData par2WorldSavedData) { + } + + @Override + public void playBroadcastSound(int p_175669_1_, BlockPos pos, int p_175669_3_) { + } + + @Override + public void playAuxSFX(int p_175718_1_, BlockPos pos, int p_175718_3_) { + + } + + @Override + public void playAuxSFXAtEntity(EntityPlayer player, int sfxType, BlockPos pos, int p_180498_4_) { + + } + + @Override + public int getHeight() { + return 256; + } + + @Override + public int getActualHeight() { + return 256; + } + + @Override + public void makeFireworks(double par1, double par3, double par5, double par7, double par9, double par11, NBTTagCompound par13nbtTagCompound) { + } + + @Override + public boolean addTileEntity(TileEntity tile) { + return true; + } + + @Override + public void addTileEntities(Collection tileEntityCollection) { + } + + @Override + public boolean isBlockFullCube(BlockPos pos) { + return pos.getY() <= 63; + } + + @Override + public boolean isInsideBorder(WorldBorder worldBorderIn, Entity entityIn) { + return true; + } + + @Override + public List getEntities(Class entityType, Predicate filter) { + return new ArrayList(); + } + + @Override + public List getEntitiesInAABBexcluding(Entity entityIn, AxisAlignedBB boundingBox, Predicate predicate) { + return new ArrayList(); + } + + @Override + public List getEntitiesWithinAABB(Class classEntity, AxisAlignedBB bb) { + return new ArrayList(); + } + + @Override + public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) { + return new ArrayList(); + } + + @Override + public List getEntitiesWithinAABBExcludingEntity(Entity entityIn, AxisAlignedBB bb) { + return new ArrayList(); + } + + @Override + public IChunkProvider getChunkProvider() { + return new FakeChunkProvider(); + } + + @Override + public Chunk getChunkFromChunkCoords(int par1, int par2) { + return null; + } + +} diff --git a/src/minecraft/animeware/util/FakeUtils/FakeWorldProvider.java b/src/minecraft/animeware/util/FakeUtils/FakeWorldProvider.java new file mode 100644 index 0000000..766c5ef --- /dev/null +++ b/src/minecraft/animeware/util/FakeUtils/FakeWorldProvider.java @@ -0,0 +1,66 @@ +package animeware.util.FakeUtils; + + + +import net.minecraft.util.BlockPos; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.chunk.IChunkProvider; + +public class FakeWorldProvider extends WorldProvider { + + @Override + public String getDimensionName() { + return ""; + } + + @Override + public String getInternalNameSuffix() { + return ""; + } + + @Override + public BlockPos getSpawnCoordinate() { + return new BlockPos(0, 64, 0); + } + + @Override + public IChunkProvider createChunkGenerator() { + return new FakeChunkProvider(); + } + + @Override + public boolean canCoordinateBeSpawn(int x, int z) { + return true; + } + + @Override + public boolean canRespawnHere() { + return true; + } + + @Override + public boolean isSurfaceWorld() { + return true; + } + + @Override + public int getAverageGroundLevel() { + return 63; + } + + @Override + public boolean doesXZShowFog(int x, int z) { + return false; + } + + @Override + public boolean isSkyColored() { + return false; + } + + @Override + public boolean doesWaterVaporize() { + return false; + } + +} diff --git a/src/minecraft/animeware/util/FakeUtils/_ExampleGui.java b/src/minecraft/animeware/util/FakeUtils/_ExampleGui.java new file mode 100644 index 0000000..ebdcec1 --- /dev/null +++ b/src/minecraft/animeware/util/FakeUtils/_ExampleGui.java @@ -0,0 +1,155 @@ +package animeware.util.FakeUtils; + +import java.util.UUID; + +import com.mojang.authlib.GameProfile; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityRabbit; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraft.world.storage.WorldInfo; + +public class _ExampleGui extends GuiScreen { + + private World world; + private FakePlayer player; + private EntitySheep sheep; + private EntityRabbit rabbit; + + @Override + public void initGui() { + + world = new FakeWorld(new WorldInfo(new NBTTagCompound())); + + player = new FakePlayer(mc, world, new GameProfile(UUID.randomUUID(), "FakePlayer")); + player.setArrowCountInEntity(4); + + sheep = new EntitySheep(world); + sheep.setFleeceColor(EnumDyeColor.YELLOW); + sheep.setFire(1); + + rabbit = new EntityRabbit(world); + rabbit.setRabbitType(3); + + mc.getRenderManager().cacheActiveRenderInfo(world, mc.fontRendererObj, player, player, mc.gameSettings, 0.0F); + + } + + int rotate = 0; + + @Override + public void drawScreen(int mouseX2, int mouseY2, float partialTicks) { + + drawBackground(0); + + mc.thePlayer = player; + world.updateEntity(player); + + + + if (mc.getRenderManager().worldObj == null || mc.getRenderManager().playerRenderer == null) { + mc.getRenderManager().cacheActiveRenderInfo(world, mc.fontRendererObj, player, player, mc.gameSettings, 0.0F); + } + if ((world != null) && (player != null)) { + mc.thePlayer = player; + ScaledResolution sr = new ScaledResolution(mc); + + int distanceToSide = ((mc.currentScreen.width / 2)) / 2; + float targetHeight = (float) (sr.getScaledHeight_double() / 5.0F) / 1.8F; + + drawEntityOnScreen( + sr.getScaledWidth() - distanceToSide - 200, + (int) ((sr.getScaledHeight() / 2) + (player.height * targetHeight)), + targetHeight, + rotate, + 180, + player); + + drawEntityOnScreen( + sr.getScaledWidth() - distanceToSide - 300, + (int) ((sr.getScaledHeight() / 2) + (player.height * targetHeight)), + targetHeight, + 0, + rotate, + sheep); + + drawEntityOnScreen( + sr.getScaledWidth() - distanceToSide - 10, + (int) ((sr.getScaledHeight() / 2) + (player.height * targetHeight)), + rotate, + rotate, + 180, + rabbit); + + + rotate+=5; + if(rotate<= -360 || rotate >= 360) { + rotate = 0; + } + + } + + super.drawScreen(mouseX2, mouseY2, partialTicks); + + //get rid of the player after were done rendering it. We don't want to confuse the singleplayer gods + mc.thePlayer = null; + } + + public static void drawEntityOnScreen(int posX, int posY, float scale, float yawRotate, float pitchRotate, EntityLivingBase ent) { + GlStateManager.disableBlend(); + GlStateManager.depthMask(true); + GlStateManager.enableDepth(); + GlStateManager.enableAlpha(); + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.translate(posX, posY, 50.0F); + GlStateManager.scale(-scale, scale, scale); + GlStateManager.rotate(pitchRotate, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(yawRotate, 0.0F, 1.0F, 0.0F); + float f2 = ent.renderYawOffset; + float f3 = ent.rotationYaw; + float f4 = ent.rotationPitch; + float f5 = ent.prevRotationYawHead; + float f6 = ent.rotationYawHead; + RenderHelper.enableStandardItemLighting(); + ent.renderYawOffset = (float) Math.atan(yawRotate / 40.0F); + ent.rotationYaw = (float) Math.atan(yawRotate / 40.0F); + ent.rotationPitch = -((float) Math.atan(0 / 40.0F)) * 20.0F; + ent.rotationYawHead = ent.rotationYaw; + ent.prevRotationYawHead = ent.rotationYaw; + GlStateManager.translate(0.0F, 0.0F, 0.0F); + try { + RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); + rendermanager.setPlayerViewY(180.0F); + rendermanager.setRenderShadow(false); + rendermanager.doRenderEntity(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, true); + rendermanager.setRenderShadow(true); + } + finally { + ent.renderYawOffset = f2; + ent.rotationYaw = f3; + ent.rotationPitch = f4; + ent.prevRotationYawHead = f5; + ent.rotationYawHead = f6; + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + GlStateManager.translate(0.0F, 0.0F, 20.0F); + } + } + +} diff --git a/src/minecraft/animeware/util/MathUtils.java b/src/minecraft/animeware/util/MathUtils.java new file mode 100644 index 0000000..4fdded6 --- /dev/null +++ b/src/minecraft/animeware/util/MathUtils.java @@ -0,0 +1,69 @@ +package animeware.util; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.security.SecureRandom; + +public class MathUtils { + + public static int getRandomInRange(int min, int max) { + return (int) ((Math.random() * (max - min)) + min); + } + + public static float getRandomInRange(float min, float max) { + SecureRandom random = new SecureRandom(); + return random.nextFloat() * (max - min) + min; + } + + public static double getRandomInRange(double min, double max) { + SecureRandom random = new SecureRandom(); + return random.nextDouble() * (max - min) + min; + } + + public static double lerp(double old, double newVal, double amount) { + return (1.0 - amount) * old + amount * newVal; + } + + public static Double interpolate(double oldValue, double newValue, double interpolationValue){ + return (oldValue + (newValue - oldValue) * interpolationValue); + } + + public static float interpolateFloat(float oldValue, float newValue, double interpolationValue){ + return interpolate(oldValue, newValue, (float) interpolationValue).floatValue(); + } + + public static int interpolateInt(int oldValue, int newValue, double interpolationValue){ + return interpolate(oldValue, newValue, (float) interpolationValue).intValue(); + } + + public static float calculateGaussianValue(float x, float sigma) { + double PI = 3.141592653; + double output = 1.0 / Math.sqrt(2.0 * PI * (sigma * sigma)); + return (float) (output * Math.exp(-(x * x) / (2.0 * (sigma * sigma)))); + } + + public static double roundToHalf(double d) { + return Math.round(d * 2) / 2.0; + } + + public static double round(double num, double increment) { + BigDecimal bd = new BigDecimal(num); + bd = (bd.setScale((int) increment, RoundingMode.HALF_UP)); + return bd.doubleValue(); + } + + public static double round(double value, int places) { + if (places < 0) { + throw new IllegalArgumentException(); + } + BigDecimal bd = new BigDecimal(value); + bd = bd.setScale(places, RoundingMode.HALF_UP); + return bd.doubleValue(); + } + + public static float getRandomFloat(float max, float min) { + SecureRandom random = new SecureRandom(); + return random.nextFloat() * (max - min) + min; + } + +} diff --git a/src/minecraft/animeware/util/MouseUtils.java b/src/minecraft/animeware/util/MouseUtils.java new file mode 100644 index 0000000..034334f --- /dev/null +++ b/src/minecraft/animeware/util/MouseUtils.java @@ -0,0 +1,21 @@ +package animeware.util; + +import java.util.ArrayList; +import org.lwjgl.input.Mouse; + +public class MouseUtils { + private boolean[] pressed = new boolean[] { Mouse.isButtonDown(0), Mouse.isButtonDown(1) }; + + private long lastLmbPressed; + + private long lastRmbPressed; + + private boolean wasLmbPressed; + + private boolean wasRmbPressed; + + private ArrayList lmb = new ArrayList<>(); + + private ArrayList rmb = new ArrayList<>(); + +} diff --git a/src/minecraft/animeware/util/RainbowColor.java b/src/minecraft/animeware/util/RainbowColor.java new file mode 100644 index 0000000..65615f3 --- /dev/null +++ b/src/minecraft/animeware/util/RainbowColor.java @@ -0,0 +1,22 @@ +package animeware.util; + +import java.awt.Color; + +public class RainbowColor +{ + + + public static Color rainbowColor(int value) + { + Color clr = Color.getHSBColor(System.currentTimeMillis() % value * value, 1.0F, 1.0F); + return clr; + } + + public static Color colorLerpv2(Color start, Color end, float ratio) + { + int i = (int)Math.abs(ratio * (float)start.getRed() + (1.0F - ratio) * (float)end.getRed()); + int j = (int)Math.abs(ratio * (float)start.getGreen() + (1.0F - ratio) * (float)end.getGreen()); + int k = (int)Math.abs(ratio * (float)start.getBlue() + (1.0F - ratio) * (float)end.getBlue()); + return new Color(i, j, k); + } +} diff --git a/src/minecraft/animeware/util/RenderUtil.java b/src/minecraft/animeware/util/RenderUtil.java new file mode 100644 index 0000000..04d7dd3 --- /dev/null +++ b/src/minecraft/animeware/util/RenderUtil.java @@ -0,0 +1,37 @@ +package animeware.util; + +import java.awt.Color; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; + +public class RenderUtil { + + public static void drawChromaString(String string, int x, int y, boolean shadow) + { + Minecraft mc = Minecraft.getMinecraft(); + + int xTmp = x; + for (char textChar : string.toCharArray()) + { + long l = System.currentTimeMillis() - (xTmp * 10 - y * 10); + int i = Color.HSBtoRGB(l % (int) 2000.0F / 2000.0F, 0.8F, 0.8F); + String tmp = String.valueOf(textChar); + mc.fontRendererObj.drawString(tmp, xTmp, y, i, shadow); + xTmp += mc.fontRendererObj.getCharWidth(textChar); + } + } + + public static void drawHollowRect(int x, int y, int w, int h, int color) { + + Gui.drawHorizontalLine(x, x + w, y, color); + Gui.drawHorizontalLine(x, x + w, y + h, color); + + Gui.drawVerticalLine(x, y + h, y, color); + Gui.drawVerticalLine(x + w, y + h, y, color); + + } + + + +} diff --git a/src/minecraft/animeware/util/Utils.java b/src/minecraft/animeware/util/Utils.java new file mode 100644 index 0000000..9429ba0 --- /dev/null +++ b/src/minecraft/animeware/util/Utils.java @@ -0,0 +1,9 @@ +package animeware.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; + +public interface Utils { + Minecraft mc = Minecraft.getMinecraft(); + FontRenderer fr = mc.fontRendererObj; +} diff --git a/src/minecraft/animeware/util/account/Account.java b/src/minecraft/animeware/util/account/Account.java new file mode 100644 index 0000000..cca49bc --- /dev/null +++ b/src/minecraft/animeware/util/account/Account.java @@ -0,0 +1,99 @@ +package animeware.util.account; + +import java.awt.Color; +import java.util.ArrayList; + +import animeware.hud.mod.HudMod; +import animeware.util.render.GuiUtils; +import animeware.util.render.ResourceUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; + +public class Account { + + public ArrayList accounts = new ArrayList<>(); + + String username; + + String email; + + String accessToken; + + String uuid; + + float x; + + float y; + + Boolean cracked; + + Boolean active; + + public String getUsername() { + return this.username; + } + + public String getEmail() { + return this.email; + } + + public String getAccessToken() { + return this.accessToken; + } + + public String getUuid() { + return this.uuid; + } + + public float getX() { + return this.x; + } + + public float getY() { + return this.y; + } + + public void setX(float x) { + this.x = x; + } + + public void setY(float y) { + this.y = y; + } + + public Boolean getCracked() { + return this.cracked; + } + + public Boolean getActive() { + return this.active; + } + + public Account(String username, String email, String accessToken, String uuid, boolean cracked) { + this.username = username; + this.email = email; + this.accessToken = accessToken; + this.uuid = uuid; + this.cracked = Boolean.valueOf(cracked); + } + + public void render(float x, float y, float mx, float my) { + this.x = x; + this.y = y; + Color background = isHovering(mx, my) ? new Color(200, 200, 200, 120) : new Color(200, 200, 200, 75); + GuiUtils.drawRoundedRect(x, y, x + 10 + 45.0F, y + 24.0F, 5.0F, background.getRGB()); + GuiUtils.drawRoundedOutline(x, y, x + 10 + 45.0F, y + 24.0F, 5.0F, 2.0F, -1); + //UrbanMainMenu.fontRenderer.drawString(getUsername(), x + 25.0F, y + 5.0F, (new Color(200, 200, 200, 200)).getRGB()); + Minecraft.getMinecraft().getTextureManager().bindTexture(ResourceUtils.getHeadLocation(getUsername())); + Gui.drawModalRectWithCustomSizedTexture((int)x + 2, (int)y + 2, 0.0F, 0.0F, 20, 20, 20.0F, 20.0F); + } + + public boolean isHovering(float mouseX, float mouseY) { + return (mouseX >= this.x && mouseX <= 20 + 45.0F && mouseY >= this.y && mouseY <= this.y + 24.0F); + //return (mouseX >= this.x && mouseX <= this.x + UrbanMainMenu.fontRenderer.getStringWidth(getUsername()) + 45.0F && mouseY >= this.y && mouseY <= this.y + 24.0F); + } + + public void setActive(Boolean active) { + this.active = active; + } +} diff --git a/src/minecraft/animeware/util/account/SessionChanger.java b/src/minecraft/animeware/util/account/SessionChanger.java new file mode 100644 index 0000000..b2af668 --- /dev/null +++ b/src/minecraft/animeware/util/account/SessionChanger.java @@ -0,0 +1,150 @@ +package animeware.util.account; + +import java.io.IOException; +import java.util.UUID; + +import com.mojang.authlib.Agent; +import com.mojang.authlib.AuthenticationService; +import com.mojang.authlib.UserAuthentication; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.util.UUIDTypeAdapter; + +import animeware.NightSky; +import fr.litarvan.openauth.microsoft.MicrosoftAuthResult; +import fr.litarvan.openauth.microsoft.MicrosoftAuthenticationException; +import fr.litarvan.openauth.microsoft.MicrosoftAuthenticator; +import net.minecraft.client.Minecraft; +import net.minecraft.util.Session; + + + +public class SessionChanger { + + private static SessionChanger instance; + public final UserAuthentication auth; + + public static SessionChanger getInstance() { + if (instance == null) { + instance = new SessionChanger(); + } + + return instance; + } + + //Creates a new Authentication Service. + private SessionChanger() { + UUID notSureWhyINeedThis = UUID.randomUUID(); //Idk, needs a UUID. Seems to be fine making it random + AuthenticationService authService = new YggdrasilAuthenticationService(Minecraft.getMinecraft().getProxy(), notSureWhyINeedThis.toString()); + auth = authService.createUserAuthentication(Agent.MINECRAFT); + authService.createMinecraftSessionService(); + } + + + //Online mode + //Checks if your already loggin in to the account. + /*public void setUser(String email, String password) { + if(!Minecraft.getMinecraft().getSession().getUsername().equals(email) || Minecraft.getMinecraft().getSession().getToken().equals("0")){ + + this.auth.logOut(); + this.auth.setUsername(email); + this.auth.setPassword(password); + try { + this.auth.logIn(); + Session session = new Session(this.auth.getSelectedProfile().getName(), UUIDTypeAdapter.fromUUID(auth.getSelectedProfile().getId()), this.auth.getAuthenticatedToken(), this.auth.getUserType().getName()); + setSession(session); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + }*/ + public void setUser(String email, String password) { + if(!Minecraft.getMinecraft().getSession().getUsername().equals(email) || Minecraft.getMinecraft().getSession().getToken().equals("0")){ + + this.auth.logOut(); + this.auth.setUsername(email); + this.auth.setPassword(password); + try { + this.auth.logIn(); + Session session = new Session(this.auth.getSelectedProfile().getName(), UUIDTypeAdapter.fromUUID(auth.getSelectedProfile().getId()), this.auth.getAuthenticatedToken(), this.auth.getUserType().getName()); + setSession(session); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + } + + public void setUserMicrosoft(String email, String password) { + + MicrosoftAuthenticator authenticator = new MicrosoftAuthenticator(); + try { + MicrosoftAuthResult acc = authenticator.loginWithCredentials(email, password); + Minecraft.getMinecraft().session = new Session(acc.getProfile().getName(), acc.getProfile().getId(), acc.getAccessToken(), "legacy"); + + } catch (MicrosoftAuthenticationException e) { + + } + } + + + public void setUserMicrosoft(String accessToken) { + MicrosoftAuthenticator authenticator = new MicrosoftAuthenticator(); + try { + MicrosoftAuthResult acc = authenticator.loginWithRefreshToken(accessToken); + Session session = new Session(acc.getProfile().getName(), acc.getProfile().getId(), acc.getAccessToken(), "legacy"); + setSession(session); + NightSky.getInstance().addAccount(new Account(acc.getProfile().getName(), "N/A", accessToken, acc.getProfile().getId(), true)); + } catch (MicrosoftAuthenticationException microsoftAuthenticationException) {} + } + + + + public void microsoftLogin() { + + MicrosoftAuthenticator authenticator = new MicrosoftAuthenticator(); + try { + MicrosoftAuthResult acc = authenticator.loginWithWebview(); + Session session = new Session(acc.getProfile().getName(), acc.getProfile().getId(), acc.getAccessToken(), "legacy"); + setSession(session); + //UrbanClient.getInstance().addAccount(new Account(acc.getProfile().getName(), "N/A", acc.getRefreshToken(), acc.getProfile().getId(), true)); + } catch (MicrosoftAuthenticationException microsoftAuthenticationException) { + microsoftAuthenticationException.printStackTrace(); + } + + + + }/* + public void microsoftLogin(String mail, String pass) { + MicrosoftAuthenticator authenticator = new MicrosoftAuthenticator(); + MicrosoftAuthResult result = null; + try { + result = authenticator.loginWithCredentials(mail,pass); + System.out.printf("Logged in with '%s'%n", result.getProfile().getName()); + Minecraft.getMinecraft().session = new Session(result.getProfile().getName(),result.getProfile().getId(), result.getAccessToken(),"legacy"); + + + } catch (MicrosoftAuthenticationException e) { + e.printStackTrace(); + } + + }*/ + + + //Sets the session. + //You need to make this public, and remove the final modifier on the session Object. + public void setSession(Session session) { + Minecraft.getMinecraft().session = session; + } + + //Login offline mode + //Just like MCP does + public void setUserOffline(String username) { + this.auth.logOut(); + Session session = new Session(username, username, "0", "legacy"); + setSession(session); + } + +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/animations/Animation.java b/src/minecraft/animeware/util/animations/Animation.java new file mode 100644 index 0000000..88b2b74 --- /dev/null +++ b/src/minecraft/animeware/util/animations/Animation.java @@ -0,0 +1,99 @@ +package animeware.util.animations; + +import animeware.util.timer.TimerUtil; + +/** + * This animation superclass was made by Foggy and advanced by cedo + * + * @author Foggy + * @author cedo + * @since 7/21/2020 (yes 2020) + * @since 7/29/2021 + */ +public abstract class Animation { + + public TimerUtil timerUtil = new TimerUtil(); + protected int duration; + protected double endPoint; + protected Direction direction; + + public Animation(int ms, double endPoint) { + this.duration = ms; + this.endPoint = endPoint; + this.direction = Direction.FORWARDS; + } + + + public Animation(int ms, double endPoint, Direction direction) { + this.duration = ms; //Time in milliseconds of how long you want the animation to take. + this.endPoint = endPoint; //The desired distance for the animated object to go. + this.direction = direction; //Direction in which the graph is going. If backwards, will start from endPoint and go to 0. + } + + public boolean finished(Direction direction) { + return isDone() && this.direction.equals(direction); + } + + public double getLinearOutput() { + return 1 - ((timerUtil.getTime() / (double) duration) * endPoint); + } + + public double getEndPoint() { + return endPoint; + } + + public void setEndPoint(double endPoint) { + this.endPoint = endPoint; + } + + public void reset() { + timerUtil.reset(); + } + + public boolean isDone() { + return timerUtil.hasTimeElapsed(duration); + } + + public void changeDirection() { + setDirection(direction.opposite()); + } + + public Direction getDirection() { + return direction; + } + + public void setDirection(Direction direction) { + if (this.direction != direction) { + this.direction = direction; + timerUtil.setTime(System.currentTimeMillis() - (duration - Math.min(duration, timerUtil.getTime()))); + } + } + + public void setDuration(int duration) { + this.duration = duration; + } + + protected boolean correctOutput() { + return false; + } + + public double getOutput() { + if (direction == Direction.FORWARDS) { + if (isDone()) + return endPoint; + return (getEquation(timerUtil.getTime()) * endPoint); + } else { + if (isDone()) return 0; + if (correctOutput()) { + double revTime = Math.min(duration, Math.max(0, duration - timerUtil.getTime())); + return getEquation(revTime) * endPoint; + } else return (1 - getEquation(timerUtil.getTime())) * endPoint; + } + } + + + //This is where the animation equation should go, for example, a logistic function. Output should range from 0 - 1. + //This will take the timer's time as an input, x. + protected abstract double getEquation(double x); + +} diff --git a/src/minecraft/animeware/util/animations/Direction.java b/src/minecraft/animeware/util/animations/Direction.java new file mode 100644 index 0000000..7b8ffe3 --- /dev/null +++ b/src/minecraft/animeware/util/animations/Direction.java @@ -0,0 +1,13 @@ +package animeware.util.animations; + +public enum Direction { + FORWARDS, + BACKWARDS; + + public Direction opposite() { + if (this == Direction.FORWARDS) { + return Direction.BACKWARDS; + } else return Direction.FORWARDS; + } + +} diff --git a/src/minecraft/animeware/util/animations/impl/DecelerateAnimation.java b/src/minecraft/animeware/util/animations/impl/DecelerateAnimation.java new file mode 100644 index 0000000..d6d7c34 --- /dev/null +++ b/src/minecraft/animeware/util/animations/impl/DecelerateAnimation.java @@ -0,0 +1,21 @@ +package animeware.util.animations.impl; + + +import animeware.util.animations.Animation; +import animeware.util.animations.Direction; + +public class DecelerateAnimation extends Animation { + + public DecelerateAnimation(int ms, double endPoint) { + super(ms, endPoint); + } + + public DecelerateAnimation(int ms, double endPoint, Direction direction) { + super(ms, endPoint, direction); + } + + protected double getEquation(double x) { + double x1 = x / duration; + return 1 - ((x1 - 1) * (x1 - 1)); + } +} diff --git a/src/minecraft/animeware/util/animations/impl/EaseBackIn.java b/src/minecraft/animeware/util/animations/impl/EaseBackIn.java new file mode 100644 index 0000000..2a400a6 --- /dev/null +++ b/src/minecraft/animeware/util/animations/impl/EaseBackIn.java @@ -0,0 +1,31 @@ +package animeware.util.animations.impl; + +import animeware.util.animations.Animation; +import animeware.util.animations.Direction; + +public class EaseBackIn extends Animation { + private final float easeAmount; + + public EaseBackIn(int ms, double endPoint, float easeAmount) { + super(ms, endPoint); + this.easeAmount = easeAmount; + } + + public EaseBackIn(int ms, double endPoint, float easeAmount, Direction direction) { + super(ms, endPoint, direction); + this.easeAmount = easeAmount; + } + + @Override + protected boolean correctOutput() { + return true; + } + + @Override + protected double getEquation(double x) { + double x1 = x / duration; + float shrink = easeAmount + 1; + return Math.max(0, 1 + shrink * Math.pow(x1 - 1, 3) + easeAmount * Math.pow(x1 - 1, 2)); + } + +} diff --git a/src/minecraft/animeware/util/animations/impl/EaseInOutQuad.java b/src/minecraft/animeware/util/animations/impl/EaseInOutQuad.java new file mode 100644 index 0000000..023c36e --- /dev/null +++ b/src/minecraft/animeware/util/animations/impl/EaseInOutQuad.java @@ -0,0 +1,21 @@ +package animeware.util.animations.impl; + +import animeware.util.animations.Animation; +import animeware.util.animations.Direction; + +public class EaseInOutQuad extends Animation { + + public EaseInOutQuad(int ms, double endPoint) { + super(ms, endPoint); + } + + public EaseInOutQuad(int ms, double endPoint, Direction direction) { + super(ms, endPoint, direction); + } + + protected double getEquation(double x1) { + double x = x1 / duration; + return x < 0.5 ? 2 * Math.pow(x, 2) : 1 - Math.pow(-2 * x + 2, 2) / 2; + } + +} diff --git a/src/minecraft/animeware/util/animations/impl/ElasticAnimation.java b/src/minecraft/animeware/util/animations/impl/ElasticAnimation.java new file mode 100644 index 0000000..37d43a2 --- /dev/null +++ b/src/minecraft/animeware/util/animations/impl/ElasticAnimation.java @@ -0,0 +1,32 @@ +package animeware.util.animations.impl; + +import animeware.util.animations.Animation; +import animeware.util.animations.Direction; + +public class ElasticAnimation extends Animation { + + float easeAmount; + float smooth; + boolean reallyElastic; + + public ElasticAnimation(int ms, double endPoint, float elasticity, float smooth, boolean moreElasticity) { + super(ms, endPoint); + this.easeAmount = elasticity; + this.smooth = smooth; + this.reallyElastic = moreElasticity; + } + + public ElasticAnimation(int ms, double endPoint, float elasticity, float smooth, boolean moreElasticity, Direction direction) { + super(ms, endPoint, direction); + this.easeAmount = elasticity; + this.smooth = smooth; + this.reallyElastic = moreElasticity; + } + + @Override + protected double getEquation(double x) { + double x1 = Math.pow(x / duration, smooth); //Used to force input to range from 0 - 1 + double elasticity = easeAmount * .1f; + return Math.pow(2, -10 * (reallyElastic ? Math.sqrt(x1) : x1)) * Math.sin((x1 - (elasticity / 4)) * ((2 * Math.PI) / elasticity)) + 1; + } +} diff --git a/src/minecraft/animeware/util/animations/impl/SmoothStepAnimation.java b/src/minecraft/animeware/util/animations/impl/SmoothStepAnimation.java new file mode 100644 index 0000000..e15cc15 --- /dev/null +++ b/src/minecraft/animeware/util/animations/impl/SmoothStepAnimation.java @@ -0,0 +1,21 @@ +package animeware.util.animations.impl; + +import animeware.util.animations.Animation; +import animeware.util.animations.Direction; + +public class SmoothStepAnimation extends Animation { + + public SmoothStepAnimation(int ms, double endPoint) { + super(ms, endPoint); + } + + public SmoothStepAnimation(int ms, double endPoint, Direction direction) { + super(ms, endPoint, direction); + } + + protected double getEquation(double x) { + double x1 = x / (double) duration; //Used to force input to range from 0 - 1 + return -2 * Math.pow(x1, 3) + (3 * Math.pow(x1, 2)); + } + +} diff --git a/src/minecraft/animeware/util/backend/AntiCheat.java b/src/minecraft/animeware/util/backend/AntiCheat.java new file mode 100644 index 0000000..361a9e7 --- /dev/null +++ b/src/minecraft/animeware/util/backend/AntiCheat.java @@ -0,0 +1,167 @@ +package animeware.util.backend; + +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.security.MessageDigest; +import java.util.Vector; + +import org.apache.commons.io.FileUtils; + +import animeware.DiscordRP; +import animeware.cosmetic.Booleans; +import animeware.util.misc.WebhookUtil; +import net.minecraft.client.Minecraft; + +public class AntiCheat { + + public static String HWID; + + public static boolean checkVape() { + try { + final ClassLoader classLoader = ClassLoader.getSystemClassLoader(); + final Field classesField = ClassLoader.class.getDeclaredField("classes"); + classesField.setAccessible(true); + final Vector> classes = (Vector>) classesField.get(classLoader); + for (Class classFor : classes) { + if (classFor.getName().equalsIgnoreCase("a.A")) { + for (Method method : classFor.getMethods()) { + if (method.getName().equals("test") && method.getParameterCount() == 0) { + System.out.println("Succesfully checked for Vape v4 = Injected"); + return true; + } + } + } + } + System.out.println("Succesfully checked for Vape v4 = Not Injected"); + } catch (Exception e) { + System.out.println("Failed the check for Vape v4"); + e.printStackTrace(); + } + + return false; + } + + public static boolean checkSigma() { + if(!(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/sigma").isEmpty()) { + return true; + } else if(!(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/versions/Sigma").isEmpty()) { + return true; + } if(!(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/versions/Sigma5").isEmpty()) { + return true; + } else return false; + } + public static boolean checkZeroDay() { + if(!(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/ZeroDay").isEmpty()) { + return true; + } else if(!(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/versions/ZeroDay").isEmpty()) { + return true; + } else return true; + } + public static boolean checkImpact() { + if(!(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/Impact").isEmpty()) { + return true; + } else if(!(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/versions/1.16.5-Impact_4.9.1-OptiFine_HD_U_G8").isEmpty()) { + return true; + } else return false; + } + + public static void doAnticheat() { + checkVape(); + checkSigma(); + checkZeroDay(); + checkImpact(); + + if(checkVape() == true) { + Booleans.ban = true; + System.out.println(DiscordRP.getDiscordName(null) + " - " + (Minecraft.getMinecraft().getSession().getUsername()) + "HWID: "+ AntiCheat.getHWID() + " was banned for: Vape"); + } + if(checkSigma() == true) { + //Animeware.ban = true; + System.out.println(DiscordRP.getDiscordName(null) + " - " + (Minecraft.getMinecraft().getSession().getUsername()) + " has: Sigma"); + } + if(checkZeroDay() == true) { + //Animeware.ban = true; + System.out.println(DiscordRP.getDiscordName(null) + " - " + (Minecraft.getMinecraft().getSession().getUsername()) + " has: ZeroDay"); + } + if(checkImpact() == true) { + //Animeware.ban = true; + System.out.println(DiscordRP.getDiscordName(null) + " - " + (Minecraft.getMinecraft().getSession().getUsername()) + " has: Impact"); + } + } + public static void deleteSigma() { + + File sigmaDataDir = new File(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/sigma"); + File sigmaVerDir = new File(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/versions/Sigma"); + File sigmaNewVerDir = new File(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/versions/Sigma5"); + try { + FileUtils.deleteDirectory(sigmaDataDir); + FileUtils.deleteDirectory(sigmaVerDir); + FileUtils.deleteDirectory(sigmaNewVerDir); + System.out.println("HackDelete Succesfull! - Sigma"); + } catch (Exception ex) { + ex.printStackTrace(); + System.out.println("HackDelete Failed! - Sigma"); + } + + } + + public static void deleteZeroDay() { + + File zeroDayData = new File(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/ZeroDay"); + File zeroDayVer = new File(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/versions/ZeroDay"); + try { + FileUtils.deleteDirectory(zeroDayData); + FileUtils.deleteDirectory(zeroDayVer); + System.out.println("HackDelete Succesfull! - ZeroDay"); + } catch (Exception ex) { + ex.printStackTrace(); + System.out.println("HackDelete Failed! - ZeroDay"); + } + } + public static void deleteImpact() { + + File impactData = new File(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/Impact"); + File impactVer = new File(FileUtils.getUserDirectoryPath() + "/AppData/Roaming/.minecraft/versions/1.16.5-Impact_4.9.1-OptiFine_HD_U_G8"); + try { + FileUtils.deleteDirectory(impactData); + FileUtils.deleteDirectory(impactVer); + System.out.println("HackDelete Succesfull! - Impact"); + } catch (Exception ex) { + ex.printStackTrace(); + System.out.println("HackDelete Failed! - Impact"); + } + } + public static void removeCheats() { + deleteSigma(); + deleteZeroDay(); + deleteImpact(); + } + public static String getHWID() { + try{ + String toEncrypt = System.getenv("COMPUTERNAME") + System.getProperty("user.name") + System.getenv("PROCESSOR_IDENTIFIER") + System.getenv("PROCESSOR_LEVEL"); + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(toEncrypt.getBytes()); + StringBuffer hexString = new StringBuffer(); + + byte byteData[] = md.digest(); + + for (byte aByteData : byteData) { + String hex = Integer.toHexString(0xff & aByteData); + if (hex.length() == 1) hexString.append('0'); + hexString.append(hex); + } + + HWID = hexString.toString(); + System.out.println(HWID); + + return hexString.toString(); + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("error"); + return "Error"; + } + } + +} diff --git a/src/minecraft/animeware/util/backend/Security.java b/src/minecraft/animeware/util/backend/Security.java new file mode 100644 index 0000000..0802f2c --- /dev/null +++ b/src/minecraft/animeware/util/backend/Security.java @@ -0,0 +1,79 @@ +package animeware.util.backend; +import org.apache.commons.codec.Charsets; +import org.apache.http.Header; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.json.JSONObject; + +import animeware.util.misc.Identification; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.security.MessageDigest; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.security.MessageDigest; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.security.MessageDigest; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.security.MessageDigest; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.security.MessageDigest; + + +public class Security { + + public static boolean isVPN() { + try { + HttpClient client = HttpClientBuilder.create().build(); + HttpGet post = new HttpGet("https://ipqualityscore.com/api/json/ip/oOswzMILsf8QA7JGtaQDdXARfDtbKW1K/" + Identification.getIP()); + + post.setHeader("Content-type", "application/json"); + + HttpResponse response = client.execute(post); + + HttpEntity entity = response.getEntity(); + Header encodingHeader = entity.getContentEncoding(); + + // you need to know the encoding to parse correctly + Charset encoding = encodingHeader == null ? StandardCharsets.UTF_8 : + Charsets.toCharset(encodingHeader.getValue()); + + // use org.apache.http.util.EntityUtils to read json as string + String json = EntityUtils.toString(entity, StandardCharsets.UTF_8); + + JSONObject o = new JSONObject(json); + + if(o.getBoolean("proxy") || o.getBoolean("vpn") || o.getBoolean("active_vpn")) { + System.out.println("epic vpn $$"); + return true; + } else return false; + } catch (Exception e) { + return false; + } + } + +} diff --git a/src/minecraft/animeware/util/backend/WebSockets.java b/src/minecraft/animeware/util/backend/WebSockets.java new file mode 100644 index 0000000..69bf491 --- /dev/null +++ b/src/minecraft/animeware/util/backend/WebSockets.java @@ -0,0 +1,35 @@ +package animeware.util.backend; + +import animeware.util.websockets.SocketClient; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.gui.Gui; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ResourceLocation; + +public class WebSockets { + + public static String getImage() { + //if((boolean)SocketClient.isUser(((AbstractClientPlayer) AbstractClientPlayer).getGameProfile().getName())) { + if(Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka")) { + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskyowner.png")); + return "Animeware/nightskyowner.png"; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("KnownAsR3named") || Minecraft.getMinecraft().thePlayer.getName().equals("Fofola") || Minecraft.getMinecraft().thePlayer.getName().equals("abcdefgh8") || Minecraft.getMinecraft().thePlayer.getName().equals("slepica") || Minecraft.getMinecraft().thePlayer.getName().equals("nhm")) { + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskystaff.png")); + return "Animeware/nightskystaff.png"; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals("_Marto__")) { + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskyyt.png")); + return "Animeware/nightskyyt.png"; + } else if(Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().thePlayer.getName())) { + //Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskywhite.png")); + return "Animeware/nightskywhite.png"; + } else { + return "Animeware/cosmetic/capes/blank.png"; + } + //} + + + + } + +} diff --git a/src/minecraft/animeware/util/config/AccountConfig.java b/src/minecraft/animeware/util/config/AccountConfig.java new file mode 100644 index 0000000..d38b50f --- /dev/null +++ b/src/minecraft/animeware/util/config/AccountConfig.java @@ -0,0 +1,102 @@ +package animeware.util.config; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.mojang.authlib.UserAuthentication; +import com.mojang.util.UUIDTypeAdapter; + +import animeware.NightSky; +import animeware.util.account.Account; +import animeware.util.account.SessionChanger; +import net.minecraft.util.Session; + +public class AccountConfig { + public final Gson gson = (new GsonBuilder()).setPrettyPrinting().create(); + + public final File file = new File("NightSky/Account.ns"); + + public void save() { + JsonArray accounts = new JsonArray(); + for (Account a : NightSky.accountManager) { + a.setActive(Boolean.valueOf(false)); + JsonObject jsonAccount = new JsonObject(); + jsonAccount.addProperty("accessToken", a.getAccessToken()); + jsonAccount.addProperty("username", a.getUsername()); + jsonAccount.addProperty("uuid", a.getUuid()); + jsonAccount.addProperty("email", a.getEmail()); + jsonAccount.addProperty("microsoft", a.getCracked()); + if (a.equals(NightSky.accountManager.get(NightSky.accountManager.size() - 1))) + a.setActive(Boolean.valueOf(true)); + jsonAccount.addProperty("active", a.getActive()); + accounts.add((JsonElement)jsonAccount); + } + if (!this.file.getParentFile().exists()) + this.file.getParentFile().mkdirs(); + String s = this.gson.toJson((JsonElement)accounts); + try { + this.file.createNewFile(); + FileWriter fw = new FileWriter(this.file.getPath()); + fw.write(s); + fw.flush(); + fw.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void load() { + try { + BufferedReader br = new BufferedReader(new FileReader(this.file.getPath())); + JsonArray accounts = (JsonArray)this.gson.fromJson(br, JsonArray.class); + if (!accounts.isJsonNull() && + accounts.size() > 0) { + JsonObject account = accounts.get(accounts.size() - 1).getAsJsonObject(); + for (JsonElement je : accounts) { + if (je.getAsJsonObject().get("active").getAsBoolean()) { + account = je.getAsJsonObject(); + String str5 = account.get("accessToken").getAsString(); + String str6 = account.get("username").getAsString(); + String str7 = account.get("uuid").getAsString(); + String str8 = account.get("email").getAsString(); + boolean bool1 = account.get("microsoft").getAsBoolean(); + NightSky.accountManager.add(new Account(str6, str8, str5, str7, bool1)); + continue; + } + String str1 = je.getAsJsonObject().get("accessToken").getAsString(); + String str2 = je.getAsJsonObject().get("username").getAsString(); + String str3 = je.getAsJsonObject().get("uuid").getAsString(); + String str4 = je.getAsJsonObject().get("email").getAsString(); + boolean bool = je.getAsJsonObject().get("microsoft").getAsBoolean(); + NightSky.accountManager.add(new Account(str2, str4, str1, str3, bool)); + } + String accessToken = account.get("accessToken").getAsString(); + String username = account.get("username").getAsString(); + String uuid = account.get("uuid").getAsString(); + String email = account.get("email").getAsString(); + boolean microsoft = account.get("microsoft").getAsBoolean(); + if (microsoft) { + SessionChanger.getInstance().setUserMicrosoft(accessToken); + } else { + SessionChanger.getInstance().setSession(new Session(username, uuid, accessToken, "mojang")); + UserAuthentication auth = (SessionChanger.getInstance()).auth; + auth.setUsername(email); + auth.logIn(); + Session session = new Session(auth.getSelectedProfile().getName(), UUIDTypeAdapter.fromUUID(auth.getSelectedProfile().getId()), auth.getAuthenticatedToken(), auth.getSelectedProfile().getName()); + SessionChanger.getInstance().setSession(session); + } + } + } catch (FileNotFoundException|com.mojang.authlib.exceptions.AuthenticationException e) { + e.printStackTrace(); + } + } +} diff --git a/src/minecraft/animeware/util/config/Config.java b/src/minecraft/animeware/util/config/Config.java new file mode 100644 index 0000000..1145f61 --- /dev/null +++ b/src/minecraft/animeware/util/config/Config.java @@ -0,0 +1,141 @@ +package animeware.util.config; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +import animeware.NightSky; +import animeware.cosmetic.CosmeticModule; +import animeware.hud.mod.HudMod; +import animeware.util.account.Account; +import animeware.util.settings.ModeSetting; +import animeware.util.settings.Setting; +import net.minecraft.client.Minecraft; + +public class Config { + public File configFolder = new File("NightSky"); + + //public File modsFolder = new File("NightSky/Mods"); + + public Configuration config; + + public Configuration configToSave = ConfigurationAPI.newConfiguration(new File("NightSky/Config.ns")); + + public final File file = new File("NightSky/Accounts.json"); + + public final Gson gson = (new GsonBuilder()).setPrettyPrinting().create(); + + public void saveModConfig() { + if (!this.configFolder.exists()) + this.configFolder.mkdirs(); + + System.out.println("Saving Module Configuration"); + for (HudMod m : NightSky.INSTANCE.hudManager.hudMods) { + this.configToSave.set(String.valueOf(m.name.toLowerCase()) + " x", m.getX()); + this.configToSave.set(String.valueOf(m.name.toLowerCase()) + " y", m.getY()); + this.configToSave.set(String.valueOf(m.name.toLowerCase()) + " enabled", m.isEnabled()); + for(Setting setting : m.settings) { + if(setting instanceof ModeSetting) { + ModeSetting mode = (ModeSetting) setting; + + try { + //configToSave.add("setting:" + m.name + ":" + setting.name + ":" + mode.getMode()); + this.configToSave.set(String.valueOf(m.name.toLowerCase()) + " setting " + setting.name, mode.getMode()); + } catch(ArrayIndexOutOfBoundsException e) { + System.out.println("Setting save failed - Config"); + } + } + } + } + System.out.println("Saving Cosmetics Configuration"); + for (CosmeticModule m : NightSky.INSTANCE.cosManager.cosmetics) { + this.configToSave.set(String.valueOf(m.name.toLowerCase()) + " wearing", m.isEnabled()); + } + try { + this.configToSave.save(); + } catch (IOException e) { + e.printStackTrace(); + System.out.println("Config Save Failed"); + } + /*System.out.println("Saving Cosmetic Configuration"); + for (CosmeticModule m : NightSky.INSTANCE.cosManager.cosmetics) { + this.configToSave.set(String.valueOf(m.name.toLowerCase()) + " on", m.isEnabled()); + } + try { + this.cosmeticToSave.save(); + } catch (IOException e) { + e.printStackTrace(); + System.out.println("Cosmetic Config Save Failed"); + } */ +} + + public void saveAccount() { + try { + JsonArray accounts = new JsonArray(); + try { + for (Account a : NightSky.accountManager) { + a.setActive(Boolean.valueOf(false)); + JsonObject jsonAccount = new JsonObject(); + jsonAccount.addProperty("accessToken", a.getAccessToken()); + jsonAccount.addProperty("username", a.getUsername()); + jsonAccount.addProperty("uuid", a.getUuid()); + jsonAccount.addProperty("email", a.getEmail()); + jsonAccount.addProperty("microsoft", a.getCracked()); + if (a.equals(NightSky.accountManager.get(NightSky.accountManager.size() - 1))) + a.setActive(Boolean.valueOf(true)); + jsonAccount.addProperty("active", a.getActive()); + accounts.add((JsonElement)jsonAccount); + } + /*for(Account a : NightSky.INSTANCE.acc.accounts) { + this.accountToSave.get("Name: " + a.getUsername()); + this.accountToSave.get("UUID: " + a.getUuid()); + this.accountToSave.get("Cracked: " + a.getCracked()); + }*/ + } catch(NullPointerException e) { + e.printStackTrace(); + System.out.println("FAIL"); + } + System.out.println("Saving Account Configuration"); + if (!this.file.getParentFile().exists()) + this.file.getParentFile().mkdirs(); + String s = this.gson.toJson((JsonElement)accounts); + try { + this.file.createNewFile(); + FileWriter fw = new FileWriter(this.file.getPath()); + fw.write(s); + fw.flush(); + fw.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } catch(NullPointerException e) { + e.printStackTrace(); + System.out.println("Ahhh shit, here we go again"); + } + /*try { + this.accountToSave.save(); + } catch (IOException e) { + e.printStackTrace(); + System.out.println("Account Save Failed"); + }*/ + } + + + public void loadModConfig() { + try { + this.config = ConfigurationAPI.loadExistingConfiguration(new File("NightSky/Config.ns")); + System.out.println("Load Sucessful"); + } catch (IOException e) { + e.printStackTrace(); + System.out.println("Failed to load config - Config"); + } + } + + +} diff --git a/src/minecraft/animeware/util/config/Configuration.java b/src/minecraft/animeware/util/config/Configuration.java new file mode 100644 index 0000000..3751a72 --- /dev/null +++ b/src/minecraft/animeware/util/config/Configuration.java @@ -0,0 +1,41 @@ +package animeware.util.config; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.json.JSONObject; + +public class Configuration { + private File file; + + public Map options; + + public Configuration(File file, Map options) { + this.file = file; + this.options = options; + } + + public Configuration(File file) { + this.file = file; + this.options = new HashMap<>(); + } + + public Object get(String pos) { + return this.options.get(pos); + } + + public void set(String key, Object value) { + this.options.put(key, value); + } + + public void save() throws IOException { + JSONObject jsonObject = new JSONObject(this.options); + this.file.createNewFile(); + FileWriter fileWriter = new FileWriter(this.file); + fileWriter.write(jsonObject.toString()); + fileWriter.flush(); + fileWriter.close(); + } +} diff --git a/src/minecraft/animeware/util/config/ConfigurationAPI.java b/src/minecraft/animeware/util/config/ConfigurationAPI.java new file mode 100644 index 0000000..56bbead --- /dev/null +++ b/src/minecraft/animeware/util/config/ConfigurationAPI.java @@ -0,0 +1,18 @@ +package animeware.util.config; + +import java.io.File; +import java.io.IOException; +import org.apache.commons.io.Charsets; +import org.apache.commons.io.FileUtils; +import org.json.JSONObject; + +public class ConfigurationAPI { + public static Configuration loadExistingConfiguration(File file) throws IOException { + JSONObject jsonObject = new JSONObject(FileUtils.readFileToString(file, Charsets.UTF_8)); + return new Configuration(file, jsonObject.toMap()); + } + + public static Configuration newConfiguration(File file) { + return new Configuration(file); + } +} diff --git a/src/minecraft/animeware/util/config/SaveLoad.java b/src/minecraft/animeware/util/config/SaveLoad.java new file mode 100644 index 0000000..c884646 --- /dev/null +++ b/src/minecraft/animeware/util/config/SaveLoad.java @@ -0,0 +1,154 @@ +package animeware.util.config; + + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; + +import animeware.NightSky; +import animeware.hud.mod.HudMod; +import animeware.hud.mod.HudMod; +import animeware.util.settings.BooleanSetting; +import animeware.util.settings.ModeSetting; +import animeware.util.settings.NumberSetting; +import animeware.util.settings.Setting; +import net.minecraft.client.Minecraft; +//import wtf.monsoon.NightSky; + + +public class SaveLoad { + + public String configFileName; + private File dir, configDir; + private static File dataFile; + + public SaveLoad(String configFileName) { + this.configFileName = configFileName; + dir = new File(Minecraft.getMinecraft().mcDataDir, "this.folder.is.useless.but.the.game.crashes.without.it"); + configDir = new File(dir, "Configs"); + if(!dir.exists()) { + dir.mkdir(); + } + if(!configDir.exists()) { + configDir.mkdir(); + } + dataFile = new File(configDir, configFileName + ".txt"); + if(!dataFile.exists()) { + try { + dataFile.createNewFile(); + } catch (IOException e) {e.printStackTrace();} + } + + this.load(); + } + + public static void save() { + ArrayList toSave = new ArrayList(); + + for(HudMod mod : NightSky.INSTANCE.hudManager.hudMods) { + toSave.add("module:" + mod.getName() + ":" + mod.isEnabled() + ":" + mod.getY() + ":" + mod.getX()); + } + + for(HudMod mod : NightSky.INSTANCE.hudManager.hudMods) { + for(Setting setting : mod.settings) { + + if(setting instanceof BooleanSetting) { + BooleanSetting bool = (BooleanSetting) setting; + toSave.add("setting:" + mod.name + ":" + setting.name + ":" + bool.isEnabled()); + } + + if(setting instanceof NumberSetting) { + NumberSetting numb = (NumberSetting) setting; + toSave.add("setting:" + mod.name + ":" + setting.name + ":" + numb.getValue()); + } + + if(setting instanceof ModeSetting) { + ModeSetting mode = (ModeSetting) setting; + + try { + toSave.add("setting:" + mod.name + ":" + setting.name + ":" + mode.getMode()); + } catch(ArrayIndexOutOfBoundsException e) { + NightSky.sendMessage("Invalid mode"); + NightSky.sendMessage("Could either be an old config, or someone wanted your game to crash."); + } + } + } + } + toSave.add("COMMANDPREFIX:" + "."); + + try { + PrintWriter pw = new PrintWriter(dataFile); + for(String str : toSave) { + pw.println(str); + } + pw.close(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + + public static void load() { + ArrayList lines = new ArrayList(); + + try { + BufferedReader reader = new BufferedReader(new FileReader(dataFile)); + String line = reader.readLine(); + while(line != null) { + lines.add(line); + line = reader.readLine(); + } + reader.close(); + } catch(Exception e) { + e.printStackTrace(); + } + + for(String s : lines) { + String[] args = s.split(":"); + if(s.toLowerCase().startsWith("module:")) { + HudMod m = NightSky.INSTANCE.hudManager.getModule(args[3]); + if(m != null) { + if(m.name.equals("ClickGUI") && m.name.equals("hudEditor")) + m.setEnabledSilent(!Boolean.parseBoolean(args[4])); + + if(!m.name.equals("ClickGUI") && !m.name.equals("hudEditor")) + m.setEnabledSilent(Boolean.parseBoolean(args[4])); + //m.setKey(Integer.parseInt(args[3])); + } + }else if(s.toLowerCase().startsWith("setting:")) { + HudMod m = NightSky.INSTANCE.hudManager.getModule(args[1]); + if(m != null) { + for(Setting setting : m.settings) { + if(setting.name.equalsIgnoreCase(args[2]) && setting != null) { + if(setting instanceof BooleanSetting) { + ((BooleanSetting) setting).setEnabled(Boolean.parseBoolean(args[3])); + } + if(setting instanceof NumberSetting) { + try { + ((NumberSetting)setting).setValue(Double.parseDouble(args[3])); + } catch(ArrayIndexOutOfBoundsException e) { + NightSky.sendMessage("Invalid amount " + args[3]); + NightSky.sendMessage("Could either be an old config, or someone wanted your game to crash."); + } + } + if(setting instanceof ModeSetting) { + //System.out.println(args[3]); + try { + //((ModeSetting) setting).setMode(args[3]); AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + } catch(ArrayIndexOutOfBoundsException e) { + NightSky.sendMessage("Invalid mode " + args[3]); + NightSky.sendMessage("Could either be an old config, or someone wanted your game to crash."); + } + } + } + } + } + }else if(s.toLowerCase().startsWith("commandprefix:")) { + //NightSky.INSTANCE.commandManager.setPrefix(args[1]); + } + } + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/cosmetic/AnimUtil.java b/src/minecraft/animeware/util/cosmetic/AnimUtil.java new file mode 100644 index 0000000..ba9fee8 --- /dev/null +++ b/src/minecraft/animeware/util/cosmetic/AnimUtil.java @@ -0,0 +1,51 @@ +package animeware.util.cosmetic; + +import animeware.NightSky; +import animeware.event.EventTarget; +import animeware.event.impl.EventUpdate; +import net.minecraft.client.Minecraft; +import net.minecraft.util.Util; + +public class AnimUtil { + + public Minecraft mc = Minecraft.getMinecraft(); + + private static String folder; + private static String fileType; + public static int timer; + public static int frames; + + + @EventTarget + public static void anim(EventUpdate e) { + Minecraft mc = Minecraft.getMinecraft(); + int maxFrames = 15; + if(mc.thePlayer != null && mc.theWorld != null) { + timer++; + //System.out.println(timer); + if(timer > 1) { + timer = 0; + } + if(timer == 0) { + frames++; + } + if(frames > maxFrames) { + frames = 0; + } + if(frames == 0) { + //System.out.println("its 0"); + } + + //MotionBlur.createAccumulation(); + //SocketClient.main(null); + /*System.out.println(SocketClient.client.request("start_animeware", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":true")); + System.out.println(SocketClient.client.request("start_animeware", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":trueowner")); + System.out.println(SocketClient.client.request("start_animeware", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":truedev")); + System.out.println(SocketClient.client.request("start_animeware", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":truepurple"));*/ + //hasSent = true; + } + + } + + +} diff --git a/src/minecraft/animeware/util/file/FileUtils.java b/src/minecraft/animeware/util/file/FileUtils.java new file mode 100644 index 0000000..ef1772a --- /dev/null +++ b/src/minecraft/animeware/util/file/FileUtils.java @@ -0,0 +1,39 @@ +package animeware.util.file; + +import java.io.*; + +public class FileUtils { + + public static String readFile(File file) { + StringBuilder stringBuilder = new StringBuilder(); + + try { + FileInputStream fileInputStream = new FileInputStream(file); + try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileInputStream))) { + String line; + while ((line = bufferedReader.readLine()) != null) + stringBuilder.append(line).append('\n'); + } + + } catch (Exception e) { + e.printStackTrace(); + } + return stringBuilder.toString(); + } + + public static String readInputStream(InputStream inputStream) { + StringBuilder stringBuilder = new StringBuilder(); + + try { + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + String line; + while ((line = bufferedReader.readLine()) != null) + stringBuilder.append(line).append('\n'); + + } catch (Exception e) { + e.printStackTrace(); + } + return stringBuilder.toString(); + } + +} diff --git a/src/minecraft/animeware/util/file/NightSkyAssets.java b/src/minecraft/animeware/util/file/NightSkyAssets.java new file mode 100644 index 0000000..a8a55d5 --- /dev/null +++ b/src/minecraft/animeware/util/file/NightSkyAssets.java @@ -0,0 +1,18 @@ +package animeware.util.file; + +public class NightSkyAssets { + + public static String getNightSkyAssets() { + return "Animeware/"; + } + public static String getNightSkyIcons() { + return "Animeware/icons"; + } + public static String getNightSkyCosmetics() { + return "Animeware/cosmetic"; + } + public static String getNightSkyCapes() { + return "Animeware/cosmetic/capes"; + } + +} diff --git a/src/minecraft/animeware/util/font/CFont$CharData.java b/src/minecraft/animeware/util/font/CFont$CharData.java new file mode 100644 index 0000000..983ddbe --- /dev/null +++ b/src/minecraft/animeware/util/font/CFont$CharData.java @@ -0,0 +1,13 @@ +// Decompiled with: CFR 0.152 +// Class Version: 8 +package animeware.util.font; + +class CFont$CharData { + public int width; + public int height; + public int storedX; + public int storedY; + + protected CFont$CharData() { + } +} diff --git a/src/minecraft/animeware/util/font/CFont.java b/src/minecraft/animeware/util/font/CFont.java new file mode 100644 index 0000000..b62fd84 --- /dev/null +++ b/src/minecraft/animeware/util/font/CFont.java @@ -0,0 +1,145 @@ +// Decompiled with: CFR 0.152 +// Class Version: 8 +package animeware.util.font; + +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; +import net.minecraft.client.renderer.texture.DynamicTexture; +import org.lwjgl.opengl.GL11; + +public class CFont { + float imgSize = 512.0f; + CharData[] charData = new CharData[256]; + Font font; + boolean antiAlias; + boolean fractionalMetrics; + int fontHeight = -1; + int charOffset = 0; + DynamicTexture tex; + + public CFont(Font font, boolean antiAlias, boolean fractionalMetrics) { + this.font = font; + this.antiAlias = antiAlias; + this.fractionalMetrics = fractionalMetrics; + this.tex = this.setupTexture(font, antiAlias, fractionalMetrics, this.charData); + } + + protected DynamicTexture setupTexture(Font font, boolean antiAlias, boolean fractionalMetrics, CharData[] chars) { + BufferedImage img = this.generateFontImage(font, antiAlias, fractionalMetrics, chars); + try { + return new DynamicTexture(img); + } + catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + protected BufferedImage generateFontImage(Font font, boolean antiAlias, boolean fractionalMetrics, CharData[] chars) { + int imgSize = (int)this.imgSize; + BufferedImage bufferedImage = new BufferedImage(imgSize, imgSize, 2); + Graphics2D graphics = (Graphics2D)bufferedImage.getGraphics(); + graphics.setFont(font); + graphics.setColor(new Color(255, 255, 255, 0)); + graphics.fillRect(0, 0, imgSize, imgSize); + graphics.setColor(Color.WHITE); + graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, fractionalMetrics ? RenderingHints.VALUE_FRACTIONALMETRICS_ON : RenderingHints.VALUE_FRACTIONALMETRICS_OFF); + graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, antiAlias ? RenderingHints.VALUE_TEXT_ANTIALIAS_ON : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antiAlias ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); + FontMetrics fontMetrics = graphics.getFontMetrics(); + int charHeight = 0; + int positionX = 0; + int positionY = 1; + int index = 0; + while (index < chars.length) { + char c = (char)index; + CharData charData = new CharData(); + Rectangle2D dimensions = fontMetrics.getStringBounds(String.valueOf(c), graphics); + charData.width = dimensions.getBounds().width + 8; + charData.height = dimensions.getBounds().height; + if (positionX + charData.width >= imgSize) { + positionX = 0; + positionY += charHeight; + charHeight = 0; + } + if (charData.height > charHeight) { + charHeight = charData.height; + } + charData.storedX = positionX; + charData.storedY = positionY; + if (charData.height > this.fontHeight) { + this.fontHeight = charData.height; + } + chars[index] = charData; + graphics.drawString(String.valueOf(c), positionX + 2, positionY + fontMetrics.getAscent()); + positionX += charData.width; + ++index; + } + return bufferedImage; + } + + public void drawChar(CharData[] chars, char c, float x, float y) throws ArrayIndexOutOfBoundsException { + try { + this.drawQuad(x, y, chars[c].width, chars[c].height, chars[c].storedX, chars[c].storedY, chars[c].width, chars[c].height); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + protected void drawQuad(float x2, float y2, float width, float height, float srcX, float srcY, float srcWidth, float srcHeight) { + float renderSRCX = srcX / this.imgSize; + float renderSRCY = srcY / this.imgSize; + float renderSRCWidth = srcWidth / this.imgSize; + float renderSRCHeight = srcHeight / this.imgSize; + GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY); + GL11.glVertex2d(x2 + width, y2); + GL11.glTexCoord2f(renderSRCX, renderSRCY); + GL11.glVertex2d(x2, y2); + GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight); + GL11.glVertex2d(x2, y2 + height); + GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight); + GL11.glVertex2d(x2, y2 + height); + GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY + renderSRCHeight); + GL11.glVertex2d(x2 + width, y2 + height); + GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY); + GL11.glVertex2d(x2 + width, y2); + } + + public void setAntiAlias(boolean antiAlias) { + if (this.antiAlias != antiAlias) { + this.antiAlias = antiAlias; + this.tex = this.setupTexture(this.font, antiAlias, this.fractionalMetrics, this.charData); + } + } + + public boolean isFractionalMetrics() { + return this.fractionalMetrics; + } + + public void setFractionalMetrics(boolean fractionalMetrics) { + if (this.fractionalMetrics != fractionalMetrics) { + this.fractionalMetrics = fractionalMetrics; + this.tex = this.setupTexture(this.font, this.antiAlias, fractionalMetrics, this.charData); + } + } + + public void setFont(Font font) { + this.font = font; + this.tex = this.setupTexture(font, this.antiAlias, this.fractionalMetrics, this.charData); + } + + protected static class CharData { + public int width; + public int height; + public int storedX; + public int storedY; + + + } +} diff --git a/src/minecraft/animeware/util/font/FontUtil.java b/src/minecraft/animeware/util/font/FontUtil.java new file mode 100644 index 0000000..abe3b9a --- /dev/null +++ b/src/minecraft/animeware/util/font/FontUtil.java @@ -0,0 +1,158 @@ +// Decompiled with: CFR 0.152 +// Class Version: 8 +package animeware.util.font; + +import java.awt.Font; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +public class FontUtil { + public static volatile int completed; + public static MinecraftFontRenderer normal; + private static Font normal_; + + private static Font getFont(Map locationMap, String location, int size) { + Font font = null; + try { + if (locationMap.containsKey(location)) { + font = locationMap.get(location).deriveFont(0, size); + } else { + InputStream is = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("Animeware/font/" + location)).getInputStream(); + font = Font.createFont(0, is); + locationMap.put(location, font); + font = font.deriveFont(0, size); + } + } + catch (Exception e) { + e.printStackTrace(); + System.out.println("Error loading font"); + font = new Font("default", 0, 10); + } + return font; + } + + public static boolean hasLoaded() { + return completed >= 3; + } + + public static void bootstrap() { + new Thread(() -> { + HashMap locationMap = new HashMap(); + normal_ = FontUtil.getFont(locationMap, "font.ttf", 19); + ++completed; + }).start(); + new Thread(() -> { + HashMap locationMap = new HashMap(); + ++completed; + }).start(); + new Thread(() -> { + HashMap locationMap = new HashMap(); + ++completed; + }).start(); + while (!FontUtil.hasLoaded()) { + try { + Thread.sleep(5L); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + } + normal = new MinecraftFontRenderer(normal_, true, true); + } +} + +/*package animeware.util.font; + + +import java.awt.Font; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +@SuppressWarnings("NonAtomicOperationOnVolatileField") +public class FontUtil { + public static volatile int completed; + public static MinecraftFontRenderer normal, tenacity; + public static Font normal_; + + private static Font getFont(Map locationMap, String location, int size) { + Font font = null; + + try { + if (locationMap.containsKey(location)) { + font = locationMap.get(location).deriveFont(Font.PLAIN, size); + } else { + InputStream is = Minecraft.getMinecraft().getResourceManager() + .getResource(new ResourceLocation("Animeware/font/" + location)).getInputStream(); + font = Font.createFont(0, is); + locationMap.put(location, font); + font = font.deriveFont(Font.PLAIN, size); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("Error loading font"); + font = new Font("default", Font.PLAIN, +15); + } + + return font; + } + public static Font getFontTena(Map locationMap, String location, int size) { + Font font; + try { + if (locationMap.containsKey(location)) { + font = locationMap.get(location).deriveFont(Font.PLAIN, size); + } else { + InputStream is = Minecraft.getMinecraft().getResourceManager() + .getResource(new ResourceLocation("Animeware/fonts/" + location)).getInputStream(); + locationMap.put(location, font = Font.createFont(0, is)); + font = font.deriveFont(Font.PLAIN, size); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("Error loading font"); + font = new Font("default", Font.PLAIN, +10); + } + return font; + } + + public static boolean hasLoaded() { + return completed >= 3; + } + + public static void bootstrap() { + new Thread(() -> + { + Map locationMap = new HashMap<>(); + normal_ = getFont(locationMap, "font.ttf", 19); + //normal_ = getFont(locationMap, "thic.ttf", 19); + completed++; + }).start(); + new Thread(() -> + { + Map locationMap = new HashMap<>(); + completed++; + }).start(); + new Thread(() -> + { + Map locationMap = new HashMap<>(); + completed++; + }).start(); + + while (!hasLoaded()) { + try { + //noinspection BusyWait + Thread.sleep(5); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + normal = new MinecraftFontRenderer(normal_, true, true); + } +}*/ \ No newline at end of file diff --git a/src/minecraft/animeware/util/font/FontUtilCedo.java b/src/minecraft/animeware/util/font/FontUtilCedo.java new file mode 100644 index 0000000..2bf3216 --- /dev/null +++ b/src/minecraft/animeware/util/font/FontUtilCedo.java @@ -0,0 +1,74 @@ +package animeware.util.font; + + +import java.awt.Font; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +@SuppressWarnings("NonAtomicOperationOnVolatileField") +public class FontUtilCedo { + public static volatile int completed; + public static MinecraftFontRenderer normal; + public static Font normal_; + + private static Font getFont(Map locationMap, String location, int size) { + Font font = null; + + try { + if (locationMap.containsKey(location)) { + font = locationMap.get(location).deriveFont(Font.PLAIN, size); + } else { + InputStream is = Minecraft.getMinecraft().getResourceManager() + .getResource(new ResourceLocation("Animeware/font/" + location)).getInputStream(); + font = Font.createFont(0, is); + locationMap.put(location, font); + font = font.deriveFont(Font.PLAIN, size); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("Error loading font"); + font = new Font("default", Font.PLAIN, +15); + } + + return font; + } + + public static boolean hasLoaded() { + return completed >= 3; + } + + public static void bootstrap() { + new Thread(() -> + { + Map locationMap = new HashMap<>(); + normal_ = getFont(locationMap, "cedo.ttf", 19); + //normal_ = getFont(locationMap, "thic.ttf", 19); + completed++; + }).start(); + new Thread(() -> + { + Map locationMap = new HashMap<>(); + completed++; + }).start(); + new Thread(() -> + { + Map locationMap = new HashMap<>(); + completed++; + }).start(); + + while (!hasLoaded()) { + try { + //noinspection BusyWait + Thread.sleep(5); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + normal = new MinecraftFontRenderer(normal_, true, true); + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/font/FontUtilIcon.java b/src/minecraft/animeware/util/font/FontUtilIcon.java new file mode 100644 index 0000000..5132468 --- /dev/null +++ b/src/minecraft/animeware/util/font/FontUtilIcon.java @@ -0,0 +1,74 @@ +package animeware.util.font; + + +import java.awt.Font; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +@SuppressWarnings("NonAtomicOperationOnVolatileField") +public class FontUtilIcon { + public static volatile int completed; + public static MinecraftFontRenderer normal; + public static Font normal_; + + private static Font getFont(Map locationMap, String location, int size) { + Font font = null; + + try { + if (locationMap.containsKey(location)) { + font = locationMap.get(location).deriveFont(Font.PLAIN, size); + } else { + InputStream is = Minecraft.getMinecraft().getResourceManager() + .getResource(new ResourceLocation("Animeware/font/" + location)).getInputStream(); + font = Font.createFont(0, is); + locationMap.put(location, font); + font = font.deriveFont(Font.PLAIN, size); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("Error loading font"); + font = new Font("default", Font.PLAIN, +15); + } + + return font; + } + + public static boolean hasLoaded() { + return completed >= 3; + } + + public static void bootstrap() { + new Thread(() -> + { + Map locationMap = new HashMap<>(); + normal_ = getFont(locationMap, "font.ttf", 19); + //normal_ = getFont(locationMap, "thic.ttf", 19); + completed++; + }).start(); + new Thread(() -> + { + Map locationMap = new HashMap<>(); + completed++; + }).start(); + new Thread(() -> + { + Map locationMap = new HashMap<>(); + completed++; + }).start(); + + while (!hasLoaded()) { + try { + //noinspection BusyWait + Thread.sleep(5); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + normal = new MinecraftFontRenderer(normal_, true, true); + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/font/JCFont/FontAtacher.java b/src/minecraft/animeware/util/font/JCFont/FontAtacher.java new file mode 100644 index 0000000..686b2d6 --- /dev/null +++ b/src/minecraft/animeware/util/font/JCFont/FontAtacher.java @@ -0,0 +1,240 @@ +package animeware.util.font.JCFont; + +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.image.BufferedImage; +import java.awt.image.ImageObserver; +import net.minecraft.client.renderer.texture.TextureUtil; +import org.lwjgl.opengl.GL11; + +public class FontAtacher { + public int IMAGE_WIDTH = 1024; + + public int IMAGE_HEIGHT = 1024; + + private int texID; + + private final IntObject[] chars = new IntObject[2048]; + + private final Font font; + + private boolean antiAlias; + + private int fontHeight = -1; + + private int charOffset = 8; + + public FontAtacher(Font font, boolean antiAlias, int charOffset) { + this.font = font; + this.antiAlias = antiAlias; + this.charOffset = charOffset; + setupTexture(antiAlias); + } + + public FontAtacher(Font font, boolean antiAlias) { + this.font = font; + this.antiAlias = antiAlias; + this.charOffset = 8; + setupTexture(antiAlias); + } + + private void setupTexture(boolean antiAlias) { + if (this.font.getSize() <= 15) { + this.IMAGE_WIDTH = 256; + this.IMAGE_HEIGHT = 256; + } + if (this.font.getSize() <= 43) { + this.IMAGE_WIDTH = 512; + this.IMAGE_HEIGHT = 512; + } else if (this.font.getSize() <= 91) { + this.IMAGE_WIDTH = 1024; + this.IMAGE_HEIGHT = 1024; + } else { + this.IMAGE_WIDTH = 2048; + this.IMAGE_HEIGHT = 2048; + } + BufferedImage img = new BufferedImage(this.IMAGE_WIDTH, this.IMAGE_HEIGHT, 2); + Graphics2D g = (Graphics2D)img.getGraphics(); + g.setFont(this.font); + g.setColor(new Color(255, 255, 255, 0)); + g.fillRect(0, 0, this.IMAGE_WIDTH, this.IMAGE_HEIGHT); + g.setColor(Color.white); + int rowHeight = 0; + int positionX = 0; + int positionY = 0; + for (int i = 0; i < 2048; i++) { + char ch = (char)i; + BufferedImage fontImage = getFontImage(ch, antiAlias); + IntObject newIntObject = new IntObject(null); + newIntObject.width = fontImage.getWidth(); + newIntObject.height = fontImage.getHeight(); + if (positionX + newIntObject.width >= this.IMAGE_WIDTH) { + positionX = 0; + positionY += rowHeight; + rowHeight = 0; + } + newIntObject.storedX = positionX; + newIntObject.storedY = positionY; + if (newIntObject.height > this.fontHeight) + this.fontHeight = newIntObject.height; + if (newIntObject.height > rowHeight) + rowHeight = newIntObject.height; + this.chars[i] = newIntObject; + g.drawImage(fontImage, positionX, positionY, (ImageObserver)null); + positionX += newIntObject.width; + } + try { + this.texID = TextureUtil.uploadTextureImageAllocate(TextureUtil.glGenTextures(), img, true, true); + } catch (NullPointerException var11) { + var11.printStackTrace(); + } + } + + private BufferedImage getFontImage(char ch, boolean antiAlias) { + BufferedImage tempfontImage = new BufferedImage(1, 1, 2); + Graphics2D g = (Graphics2D)tempfontImage.getGraphics(); + if (antiAlias) { + g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + } else { + g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + } + g.setFont(this.font); + FontMetrics fontMetrics = g.getFontMetrics(); + int charwidth = fontMetrics.charWidth(ch) + 8; + if (charwidth <= 0) + charwidth = 7; + int charheight = fontMetrics.getHeight() + 3; + if (charheight <= 0) + charheight = this.font.getSize(); + BufferedImage fontImage = new BufferedImage(charwidth, charheight, 2); + Graphics2D gt = (Graphics2D)fontImage.getGraphics(); + if (antiAlias) { + gt.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + } else { + gt.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + } + gt.setFont(this.font); + gt.setColor(Color.WHITE); + int charx = 3; + int chary = 1; + gt.drawString(String.valueOf(ch), 3, 1 + fontMetrics.getAscent()); + return fontImage; + } + + public void drawChar(char c, float x, float y) throws ArrayIndexOutOfBoundsException { + try { + drawQuad(x, y, (this.chars[c]).width, (this.chars[c]).height, (this.chars[c]).storedX, (this.chars[c]).storedY, (this.chars[c]).width, (this.chars[c]).height); + } catch (Exception var5) { + var5.printStackTrace(); + } + } + + private void drawQuad(float x, float y, float width, float height, float srcX, float srcY, float srcWidth, float srcHeight) { + float renderSRCX = srcX / this.IMAGE_WIDTH; + float renderSRCY = srcY / this.IMAGE_HEIGHT; + float renderSRCWidth = srcWidth / this.IMAGE_WIDTH; + float renderSRCHeight = srcHeight / this.IMAGE_HEIGHT; + GL11.glBegin(4); + GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY); + GL11.glVertex2d((x + width), y); + GL11.glTexCoord2f(renderSRCX, renderSRCY); + GL11.glVertex2d(x, y); + GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight); + GL11.glVertex2d(x, (y + height)); + GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight); + GL11.glVertex2d(x, (y + height)); + GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY + renderSRCHeight); + GL11.glVertex2d((x + width), (y + height)); + GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY); + GL11.glVertex2d((x + width), y); + GL11.glEnd(); + } + + public void drawString(String text, double x, double y, Color color, boolean shadow) { + x *= 2.0D; + y = y * 2.0D - 6.0D; + GL11.glPushMatrix(); + GL11.glScaled(0.5D, 0.5D, 0.5D); + TextureUtil.bindTexture(this.texID); + glColor(shadow ? new Color(0.05F, 0.05F, 0.05F, color.getAlpha() / 255.0F) : color); + int size = text.length(); + for (int indexInString = 0; indexInString < size; indexInString++) { + char character = text.charAt(indexInString); + if (character < this.chars.length && character >= '\000') { + drawChar(character, (float)x, (float)y); + x += ((this.chars[character]).width - this.charOffset); + } + } + GL11.glPopMatrix(); + } + + public void glColor(Color color) { + float red = color.getRed() / 255.0F; + float green = color.getGreen() / 255.0F; + float blue = color.getBlue() / 255.0F; + float alpha = color.getAlpha() / 255.0F; + GL11.glColor4f(red, green, blue, alpha); + } + + public int getStringHeight(String text) { + int lines = 1; + char[] var6; + int var5 = (var6 = text.toCharArray()).length; + for (int var4 = 0; var4 < var5; var4++) { + char c = var6[var4]; + if (c == '\n') + lines++; + } + return (this.fontHeight - this.charOffset) / 2 * lines; + } + + public int getHeight() { + return (this.fontHeight - this.charOffset) / 2; + } + + public int getStringWidth(String text) { + int width = 0; + char[] var6; + int var5 = (var6 = text.toCharArray()).length; + for (int var4 = 0; var4 < var5; var4++) { + char c = var6[var4]; + if (c < this.chars.length && c >= '\000') + width += (this.chars[c]).width - this.charOffset; + } + return width / 2; + } + + public boolean isAntiAlias() { + return this.antiAlias; + } + + public void setAntiAlias(boolean antiAlias) { + if (this.antiAlias != antiAlias) { + this.antiAlias = antiAlias; + setupTexture(antiAlias); + } + } + + public Font getFont() { + return this.font; + } + + private class IntObject { + public int width; + + public int height; + + public int storedX; + + public int storedY; + + private IntObject() {} + + IntObject(IntObject var2) { + this(); + } + } +} diff --git a/src/minecraft/animeware/util/font/JCFont/Fonts.java b/src/minecraft/animeware/util/font/JCFont/Fonts.java new file mode 100644 index 0000000..9b20f1d --- /dev/null +++ b/src/minecraft/animeware/util/font/JCFont/Fonts.java @@ -0,0 +1,26 @@ +package animeware.util.font.JCFont; + +import java.awt.Font; +import java.io.InputStream; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +public class Fonts { + public static Font getFont(int size, String l) { + Font font = null; + try { + InputStream ex = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("Animeware/font/" + l + ".ttf")).getInputStream(); + font = Font.createFont(0, ex); + font = font.deriveFont(0, size); + } catch (Exception var3) { + var3.printStackTrace(); + System.err.println("Font not loaded. Using serif font."); + font = new Font("default", 0, size); + } + return font; + } + + public static cFontRenderer getCustomeFont(int size, String l) { + return new cFontRenderer(getFont(size, l), true, 8); + } +} diff --git a/src/minecraft/animeware/util/font/JCFont/cFontRenderer.java b/src/minecraft/animeware/util/font/JCFont/cFontRenderer.java new file mode 100644 index 0000000..d4f14d3 --- /dev/null +++ b/src/minecraft/animeware/util/font/JCFont/cFontRenderer.java @@ -0,0 +1,605 @@ +/* */ package animeware.util.font.JCFont; +/* */ +/* */ import java.awt.Color; +/* */ import java.awt.Font; +/* */ import java.util.ArrayList; +/* */ import java.util.Arrays; +/* */ import java.util.Iterator; +/* */ import java.util.List; +/* */ import java.util.Random; + +/* */ import org.lwjgl.opengl.GL11; + +/* */ import net.minecraft.client.Minecraft; +/* */ import net.minecraft.client.gui.FontRenderer; +/* */ import net.minecraft.client.renderer.GlStateManager; +/* */ import net.minecraft.client.resources.IResourceManager; +/* */ import net.minecraft.util.ChatAllowedCharacters; +/* */ import net.minecraft.util.ResourceLocation; +/* */ +/* */ public class cFontRenderer extends FontRenderer { +/* */ public final Random fontRandom; +/* */ private final Color[] customColorCodes; +/* */ private final int[] colorCode; +/* */ private FontAtacher font; +/* */ private FontAtacher boldFont; +/* */ private FontAtacher italicFont; +/* */ private FontAtacher boldItalicFont; +/* */ private String colorcodeIdentifiers; +/* 27 */ public static Minecraft mc = Minecraft.getMinecraft(); +/* */ private boolean bidi; +/* */ +/* */ public cFontRenderer(Font font, boolean antiAlias, int charOffset) { +/* 31 */ super(mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().getTextureManager(), false); +/* 32 */ this.fontRandom = new Random(); +/* 33 */ this.customColorCodes = new Color[256]; +/* 34 */ this.colorCode = new int[32]; +/* 35 */ this.colorcodeIdentifiers = "0123456789abcdefklmnor"; +/* 36 */ setFont(font, antiAlias, charOffset); +/* 37 */ this.customColorCodes[113] = new Color(0, 90, 163); +/* 38 */ this.colorcodeIdentifiers = setupColorcodeIdentifier(); +/* 39 */ setupMinecraftColorcodes(); +/* 40 */ this.FONT_HEIGHT = (int)getHeight(); +/* */ } +/* */ +/* */ public int drawString(String s, float x, float y, int color) { +/* 44 */ drawString(s, x, y, color, false); +/* 45 */ return drawString(s, x, y, color, false) + 1; +/* */ } +/* */ +/* */ public void drawCenteredStringXY(String s, float x, float y, int color, boolean shadow) { +/* 49 */ drawCenteredString(s, x, y - getHeight() / 2.0F, color, shadow); +/* */ } +/* */ +/* */ public int drawStringWithShadow(String s, float x, float y, int color) { +/* 53 */ drawString(s, x + 1.0F, y + 1.0F, color, true); +/* 54 */ return drawString(s, x, y, color, false) + 1; +/* */ } +/* */ +/* */ public void drawCenteredString(String s, float x, float y, int color, boolean shadow) { +/* 58 */ if (shadow) { +/* 59 */ drawStringWithShadow(s, x - (getStringWidth(s) / 2), y, color); +/* */ } else { +/* 61 */ drawString(s, x - (getStringWidth(s) / 2), y, color); +/* */ } +/* */ } +/* */ +/* */ public void drawCenteredString(String s, double d, double e, int color) { +/* 66 */ drawStringWithShadow(s, (float)(d - (getStringWidth(s) / 2)), (float)e, color); +/* */ } +/* */ +/* */ public int func_175063_a(String message, float posX, float posY, int textColor) { +/* 70 */ return drawStringWithShadow(message, posX, posY, textColor); +/* */ } +/* */ +/* */ public int drawString(String text, float x, float y, int color, boolean shadow) { +/* 74 */ int result = 0; +/* 75 */ String[] lines = text.split("\n"); +/* */ +/* 77 */ for (int i = 0; i < lines.length; i++) { +/* 78 */ result = drawLine(lines[i], x, y + i * getHeight(), color, shadow); +/* */ } +/* */ +/* 81 */ return result; +/* */ } +/* */ +/* */ private int drawLine(String text, float x, float y, int color, boolean shadow) { +/* 85 */ if (text == null) { +/* 86 */ return 0; +/* */ } +/* 88 */ GL11.glPushMatrix(); +/* 89 */ GL11.glTranslated(x - 1.5D, y + 0.5D, 0.0D); +/* 90 */ boolean wasBlend = GL11.glGetBoolean(3042); +/* 91 */ GlStateManager.enableAlpha(); +/* 92 */ GL11.glEnable(3042); +/* 93 */ GL11.glBlendFunc(770, 771); +/* 94 */ GL11.glEnable(3553); +/* 95 */ if ((color & 0xFC000000) == 0) { +/* 96 */ color |= 0xFF000000; +/* */ } +/* */ +/* 99 */ if (shadow) { +/* 100 */ color = (color & 0xFCFCFC) >> 2 | color & 0xFF000000; +/* */ } +/* */ +/* 103 */ float red = (color >> 16 & 0xFF) / 255.0F; +/* 104 */ float green = (color >> 8 & 0xFF) / 255.0F; +/* 105 */ float blue = (color & 0xFF) / 255.0F; +/* 106 */ float alpha = (color >> 24 & 0xFF) / 255.0F; +/* 107 */ Color c = new Color(red, green, blue, alpha); +/* 108 */ if (text.contains("§")) { +/* 109 */ String[] parts = text.split("§"); +/* 110 */ Color currentColor = c; +/* 111 */ FontAtacher currentFont = this.font; +/* 112 */ int width = 0; +/* 113 */ boolean randomCase = false; +/* 114 */ boolean bold = false; +/* 115 */ boolean italic = false; +/* 116 */ boolean strikethrough = false; +/* 117 */ boolean underline = false; +/* */ +/* 119 */ for (int index = 0; index < parts.length; index++) { +/* 120 */ if (parts[index].length() > 0) { +/* 121 */ if (index == 0) { +/* 122 */ currentFont.drawString(parts[index], width, 0.0D, currentColor, shadow); +/* 123 */ width += currentFont.getStringWidth(parts[index]); +/* */ } else { +/* 125 */ String words = parts[index].substring(1); +/* 126 */ char type = parts[index].charAt(0); +/* 127 */ int colorIndex = this.colorcodeIdentifiers.indexOf(type); +/* 128 */ if (colorIndex != -1) { +/* 129 */ if (colorIndex < 16) { +/* 130 */ int colorcode = this.colorCode[colorIndex]; +/* 131 */ currentColor = getColor(colorcode, alpha); +/* 132 */ bold = false; +/* 133 */ italic = false; +/* 134 */ randomCase = false; +/* 135 */ underline = false; +/* 136 */ strikethrough = false; +/* 137 */ } else if (colorIndex == 16) { +/* 138 */ randomCase = true; +/* 139 */ } else if (colorIndex == 17) { +/* 140 */ bold = true; +/* 141 */ } else if (colorIndex == 18) { +/* 142 */ strikethrough = true; +/* 143 */ } else if (colorIndex == 19) { +/* 144 */ underline = true; +/* 145 */ } else if (colorIndex == 20) { +/* 146 */ italic = true; +/* 147 */ } else if (colorIndex == 21) { +/* 148 */ bold = false; +/* 149 */ italic = false; +/* 150 */ randomCase = false; +/* 151 */ underline = false; +/* 152 */ strikethrough = false; +/* 153 */ currentColor = c; +/* 154 */ } else if (colorIndex > 21) { +/* 155 */ Color customColor = this.customColorCodes[type]; +/* 156 */ currentColor = new Color(customColor.getRed() / 255.0F, customColor.getGreen() / 255.0F, customColor.getBlue() / 255.0F, alpha); +/* */ } +/* */ } +/* */ +/* 160 */ if (bold && italic) { +/* 161 */ this.boldItalicFont.drawString(randomCase ? toRandom(currentFont, words) : words, width, 0.0D, currentColor, shadow); +/* 162 */ currentFont = this.boldItalicFont; +/* 163 */ } else if (bold) { +/* 164 */ this.boldFont.drawString(randomCase ? toRandom(currentFont, words) : words, width, 0.0D, currentColor, shadow); +/* 165 */ currentFont = this.boldFont; +/* 166 */ } else if (italic) { +/* 167 */ this.italicFont.drawString(randomCase ? toRandom(currentFont, words) : words, width, 0.0D, currentColor, shadow); +/* 168 */ currentFont = this.italicFont; +/* */ } else { +/* 170 */ this.font.drawString(randomCase ? toRandom(currentFont, words) : words, width, 0.0D, currentColor, shadow); +/* 171 */ currentFont = this.font; +/* */ } +/* */ +/* 174 */ float u = this.font.getHeight() / 16.0F; +/* 175 */ int h = currentFont.getStringHeight(words); +/* 176 */ if (strikethrough) { +/* 177 */ drawLine(width / 2.0D + 1.0D, (h / 3), (width + currentFont.getStringWidth(words)) / 2.0D + 1.0D, (h / 3), u); +/* */ } +/* */ +/* 180 */ if (underline) { +/* 181 */ drawLine(width / 2.0D + 1.0D, (h / 2), (width + currentFont.getStringWidth(words)) / 2.0D + 1.0D, (h / 2), u); +/* */ } +/* */ +/* 184 */ width += currentFont.getStringWidth(words); +/* */ } +/* */ } +/* */ } +/* */ } else { +/* 189 */ this.font.drawString(text, 0.0D, 0.0D, c, shadow); +/* */ } +/* */ +/* 192 */ if (!wasBlend) { +/* 193 */ GL11.glDisable(3042); +/* */ } +/* */ +/* 196 */ GL11.glPopMatrix(); +/* 197 */ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); +/* 198 */ return (int)(x + getStringWidth(text)); +/* */ } +/* */ +/* */ +/* */ private String toRandom(FontAtacher font, String text) { +/* 203 */ String newText = ""; +/* 204 */ String allowedCharacters = "ÀÁÂÈÊËÍÓÔÕÚßãõğİıŒœŞşŴŵžȇ\000\000\000\000\000\000\000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\000ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αβΓπΣσμτΦΘΩδ∞∅∈∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\000"; +/* */ char[] var8; +/* 206 */ int var7 = (var8 = text.toCharArray()).length; +/* */ +/* 208 */ for (int var6 = 0; var6 < var7; var6++) { +/* 209 */ char c = var8[var6]; +/* 210 */ if (ChatAllowedCharacters.isAllowedCharacter(c)) { +/* 211 */ int index = this.fontRandom.nextInt("ÀÁÂÈÊËÍÓÔÕÚßãõğİıŒœŞşŴŵžȇ\000\000\000\000\000\000\000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\000ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αβΓπΣσμτΦΘΩδ∞∅∈∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\000".length()); +/* 212 */ newText = String.valueOf(String.valueOf(newText)) + "ÀÁÂÈÊËÍÓÔÕÚßãõğİıŒœŞşŴŵžȇ\000\000\000\000\000\000\000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\000ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αβΓπΣσμτΦΘΩδ∞∅∈∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\000".toCharArray()[index]; +/* */ } +/* */ } +/* 215 */ return newText; +/* */ } +/* */ +/* */ public float getStringHeight(String text) { +/* 219 */ if (text == null) { +/* 220 */ return 0.0F; +/* */ } +/* 222 */ return this.font.getStringHeight(text); +/* */ } +/* */ +/* */ +/* */ public float getHeight() { +/* 227 */ return this.font.getHeight(); +/* */ } +/* */ +/* */ public static String getFormatFromString(String p_78282_0_) { +/* 231 */ String var1 = ""; +/* 232 */ int var2 = -1; +/* 233 */ int var3 = p_78282_0_.length(); +/* */ +/* 235 */ while ((var2 = p_78282_0_.indexOf('§', var2 + 1)) != -1) { +/* 236 */ if (var2 < var3 - 1) { +/* 237 */ char var4 = p_78282_0_.charAt(var2 + 1); +/* 238 */ if (isFormatColor(var4)) { +/* 239 */ var1 = "§" + var4; continue; +/* 240 */ } if (isFormatSpecial(var4)) { +/* 241 */ var1 = String.valueOf(var1) + "§" + var4; +/* */ } +/* */ } +/* */ } +/* */ +/* 246 */ return var1; +/* */ } +/* */ +/* */ private static boolean isFormatSpecial(char formatChar) { +/* 250 */ return !((formatChar < 'k' || formatChar > 'o') && (formatChar < 'K' || formatChar > 'O') && formatChar != 'r' && formatChar != 'R'); +/* */ } +/* */ +/* */ public int getColorCode(char p_175064_1_) { +/* 254 */ return this.colorCode["0123456789abcdef".indexOf(p_175064_1_)]; +/* */ } +/* */ +/* */ public void setBidiFlag(boolean state) { +/* 258 */ this.bidi = state; +/* */ } +/* */ +/* */ public boolean getBidiFlag() { +/* 262 */ return this.bidi; +/* */ } +/* */ +/* */ private int sizeStringToWidth(String str, int wrapWidth) { +/* 266 */ int var3 = str.length(); +/* 267 */ int var4 = 0; +/* 268 */ int var5 = 0; +/* 269 */ int var6 = -1; +/* */ +/* 271 */ for (boolean var7 = false; var5 < var3; var5++) { +/* 272 */ char var8 = str.charAt(var5); +/* 273 */ switch (var8) { +/* */ case '\n': +/* 275 */ var5--; +/* */ break; +/* */ case ' ': +/* 278 */ var6 = var5; +/* */ default: +/* 280 */ var4 += getStringWidth(Character.toString(var8)); +/* 281 */ if (var7) { +/* 282 */ var4++; +/* */ } +/* */ break; +/* */ case '§': +/* 286 */ if (var5 < var3 - 1) { +/* 287 */ var5++; +/* 288 */ char var9 = str.charAt(var5); +/* 289 */ if (var9 != 'l' && var9 != 'L') { +/* 290 */ if (var9 == 'r' || var9 == 'R' || isFormatColor(var9)) +/* 291 */ var7 = false; +/* */ break; +/* */ } +/* 294 */ var7 = true; +/* */ } +/* */ break; +/* */ } +/* */ +/* 299 */ if (var8 == '\n') { +/* */ +/* 301 */ var6 = ++var5; +/* */ +/* */ break; +/* */ } +/* 305 */ if (var4 > wrapWidth) { +/* */ break; +/* */ } +/* */ } +/* */ +/* 310 */ return (var5 != var3 && var6 != -1 && var6 < var5) ? var6 : var5; +/* */ } +/* */ +/* */ private static boolean isFormatColor(char colorChar) { +/* 314 */ return !((colorChar < '0' || colorChar > '9') && (colorChar < 'a' || colorChar > 'f') && (colorChar < 'A' || colorChar > 'F')); +/* */ } +/* */ +/* */ public int getCharWidth(char c) { +/* 318 */ return getStringWidth(Character.toString(c)); +/* */ } +/* */ +/* */ public int getStringWidth(String text) { +/* 322 */ if (text == null) +/* 323 */ return 0; +/* 324 */ if (!text.contains("§")) { +/* 325 */ return this.font.getStringWidth(text); +/* */ } +/* 327 */ String[] parts = text.split("§"); +/* 328 */ FontAtacher currentFont = this.font; +/* 329 */ int width = 0; +/* 330 */ boolean bold = false; +/* 331 */ boolean italic = false; +/* */ +/* 333 */ for (int index = 0; index < parts.length; index++) { +/* 334 */ if (parts[index].length() > 0) { +/* 335 */ if (index == 0) { +/* 336 */ width += currentFont.getStringWidth(parts[index]); +/* */ } else { +/* 338 */ String words = parts[index].substring(1); +/* 339 */ char type = parts[index].charAt(0); +/* 340 */ int colorIndex = this.colorcodeIdentifiers.indexOf(type); +/* 341 */ if (colorIndex != -1) { +/* 342 */ if (colorIndex < 16) { +/* 343 */ bold = false; +/* 344 */ italic = false; +/* 345 */ } else if (colorIndex != 16) { +/* 346 */ if (colorIndex == 17) { +/* 347 */ bold = true; +/* 348 */ } else if (colorIndex != 18 && colorIndex != 19) { +/* 349 */ if (colorIndex == 20) { +/* 350 */ italic = true; +/* 351 */ } else if (colorIndex == 21) { +/* 352 */ bold = false; +/* 353 */ italic = false; +/* */ } +/* */ } +/* */ } +/* */ } +/* */ +/* 359 */ if (bold && italic) { +/* 360 */ currentFont = this.boldItalicFont; +/* 361 */ } else if (bold) { +/* 362 */ currentFont = this.boldFont; +/* 363 */ } else if (italic) { +/* 364 */ currentFont = this.italicFont; +/* */ } else { +/* 366 */ currentFont = this.font; +/* */ } +/* */ +/* 369 */ width += currentFont.getStringWidth(words); +/* */ } +/* */ } +/* */ } +/* */ +/* 374 */ return width; +/* */ } +/* */ +/* */ +/* */ public void setFont(Font font, boolean antiAlias, int charOffset) { +/* 379 */ synchronized (this) { +/* 380 */ this.font = new FontAtacher(font, antiAlias, charOffset); +/* 381 */ this.boldFont = new FontAtacher(font.deriveFont(1), antiAlias, charOffset); +/* 382 */ this.italicFont = new FontAtacher(font.deriveFont(2), antiAlias, charOffset); +/* 383 */ this.boldItalicFont = new FontAtacher(font.deriveFont(3), antiAlias, charOffset); +/* 384 */ this.FONT_HEIGHT = (int)getHeight(); +/* */ } +/* */ } +/* */ +/* */ public FontAtacher getFont() { +/* 389 */ return this.font; +/* */ } +/* */ +/* */ public String getFontName() { +/* 393 */ return this.font.getFont().getFontName(); +/* */ } +/* */ +/* */ public int getSize() { +/* 397 */ return this.font.getFont().getSize(); +/* */ } +/* */ +/* */ public List wrapWords(String text, double width) { +/* 401 */ List finalWords = new ArrayList(); +/* 402 */ if (getStringWidth(text) > width) { +/* 403 */ String[] words = text.split(" "); +/* 404 */ String currentWord = ""; +/* 405 */ char lastColorCode = Character.MAX_VALUE; +/* 406 */ String[] var11 = words; +/* 407 */ int var10 = words.length; +/* */ +/* */ +/* 410 */ for (int var9 = 0; var9 < var10; var9++) { +/* 411 */ String s = var11[var9]; +/* */ +/* 413 */ for (int i = 0; i < (s.toCharArray()).length; i++) { +/* 414 */ char c = s.toCharArray()[i]; +/* 415 */ if (c == '§' && i < (s.toCharArray()).length - 1) { +/* 416 */ lastColorCode = s.toCharArray()[i + 1]; +/* */ } +/* */ } +/* */ +/* 420 */ if (getStringWidth(String.valueOf(currentWord) + s + " ") < width) { +/* 421 */ currentWord = String.valueOf(currentWord) + s + " "; +/* */ } else { +/* 423 */ finalWords.add(currentWord); +/* 424 */ currentWord = (lastColorCode == -1) ? (String.valueOf(s) + " ") : ("§" + lastColorCode + s + " "); +/* */ } +/* */ } +/* */ +/* 428 */ if (!currentWord.equals("")) { +/* 429 */ if (getStringWidth(currentWord) < width) { +/* 430 */ finalWords.add((lastColorCode == -1) ? (String.valueOf(currentWord) + " ") : ("§" + lastColorCode + currentWord + " ")); +/* 431 */ currentWord = ""; +/* */ } else { +/* 433 */ Iterator var14 = formatString(currentWord, width).iterator(); +/* */ +/* 435 */ while (var14.hasNext()) { +/* 436 */ String s = var14.next(); +/* 437 */ finalWords.add(s); +/* */ } +/* */ } +/* */ } +/* */ } else { +/* 442 */ finalWords.add(text); +/* */ } +/* */ +/* 445 */ return finalWords; +/* */ } +/* */ +/* */ public List formatString(String s, double width) { +/* 449 */ List finalWords = new ArrayList(); +/* 450 */ String currentWord = ""; +/* 451 */ char lastColorCode = Character.MAX_VALUE; +/* */ +/* 453 */ for (int i = 0; i < (s.toCharArray()).length; i++) { +/* 454 */ char c = s.toCharArray()[i]; +/* 455 */ if (c == '§' && i < (s.toCharArray()).length - 1) { +/* 456 */ lastColorCode = s.toCharArray()[i + 1]; +/* */ } +/* */ +/* 459 */ if (getStringWidth(String.valueOf(currentWord) + c) < width) { +/* 460 */ currentWord = String.valueOf(currentWord) + c; +/* */ } else { +/* 462 */ finalWords.add(currentWord); +/* 463 */ currentWord = (lastColorCode == -1) ? String.valueOf(c) : ("§" + lastColorCode + c); +/* */ } +/* */ } +/* */ +/* 467 */ if (!currentWord.equals("")) { +/* 468 */ finalWords.add(currentWord); +/* */ } +/* */ +/* 471 */ return finalWords; +/* */ } +/* */ +/* */ private void drawLine(double x, double y, double x1, double y1, float width) { +/* 475 */ GL11.glDisable(3553); +/* 476 */ GL11.glLineWidth(width); +/* 477 */ GL11.glBegin(1); +/* 478 */ GL11.glVertex2d(x, y); +/* 479 */ GL11.glVertex2d(x1, y1); +/* 480 */ GL11.glEnd(); +/* 481 */ GL11.glEnable(3553); +/* */ } +/* */ +/* */ public boolean isAntiAliasing() { +/* 485 */ return (this.font.isAntiAlias() && this.boldFont.isAntiAlias() && this.italicFont.isAntiAlias() && this.boldItalicFont.isAntiAlias()); +/* */ } +/* */ +/* */ public void setAntiAliasing(boolean antiAlias) { +/* 489 */ this.font.setAntiAlias(antiAlias); +/* 490 */ this.boldFont.setAntiAlias(antiAlias); +/* 491 */ this.italicFont.setAntiAlias(antiAlias); +/* 492 */ this.boldItalicFont.setAntiAlias(antiAlias); +/* */ } +/* */ +/* */ private void setupMinecraftColorcodes() { +/* 496 */ for (int index = 0; index < 32; index++) { +/* 497 */ int var6 = (index >> 3 & 0x1) * 85; +/* 498 */ int var7 = (index >> 2 & 0x1) * 170 + var6; +/* 499 */ int var8 = (index >> 1 & 0x1) * 170 + var6; +/* 500 */ int var9 = (index >> 0 & 0x1) * 170 + var6; +/* 501 */ if (index == 6) { +/* 502 */ var7 += 85; +/* */ } +/* */ +/* 505 */ if (index >= 16) { +/* 506 */ var7 /= 4; +/* 507 */ var8 /= 4; +/* 508 */ var9 /= 4; +/* */ } +/* */ +/* 511 */ this.colorCode[index] = (var7 & 0xFF) << 16 | (var8 & 0xFF) << 8 | var9 & 0xFF; +/* */ } +/* */ } +/* */ +/* */ +/* */ public String trimStringToWidth(String p_78269_1_, int p_78269_2_) { +/* 517 */ return trimStringToWidth(p_78269_1_, p_78269_2_, false); +/* */ } +/* */ +/* */ public String trimStringToWidth(String p_78262_1_, int p_78262_2_, boolean p_78262_3_) { +/* 521 */ StringBuilder var4 = new StringBuilder(); +/* 522 */ int var5 = 0; +/* 523 */ int var6 = p_78262_3_ ? (p_78262_1_.length() - 1) : 0; +/* 524 */ int var7 = p_78262_3_ ? -1 : 1; +/* 525 */ boolean var8 = false; +/* 526 */ boolean var9 = false; +/* */ +/* 528 */ for (int var10 = var6; var10 >= 0 && var10 < p_78262_1_.length() && var5 < p_78262_2_; var10 += var7) { +/* 529 */ char var11 = p_78262_1_.charAt(var10); +/* 530 */ int var12 = getStringWidth(Character.toString(var11)); +/* 531 */ if (var8) { +/* 532 */ var8 = false; +/* 533 */ if (var11 != 'l' && var11 != 'L') { +/* 534 */ if (var11 == 'r' || var11 == 'R') { +/* 535 */ var9 = false; +/* */ } +/* */ } else { +/* 538 */ var9 = true; +/* */ } +/* 540 */ } else if (var12 < 0) { +/* 541 */ var8 = true; +/* */ } else { +/* 543 */ var5 += var12; +/* 544 */ if (var9) { +/* 545 */ var5++; +/* */ } +/* */ } +/* */ +/* 549 */ if (var5 > p_78262_2_) { +/* */ break; +/* */ } +/* */ +/* 553 */ if (p_78262_3_) { +/* 554 */ var4.insert(0, var11); +/* */ } else { +/* 556 */ var4.append(var11); +/* */ } +/* */ } +/* */ +/* 560 */ return var4.toString(); +/* */ } +/* */ +/* */ public List listFormattedStringToWidth(String str, int wrapWidth) { +/* 564 */ return Arrays.asList(wrapFormattedStringToWidth(str, wrapWidth).split("\n")); +/* */ } +/* */ +/* */ public String wrapFormattedStringToWidth(String str, int wrapWidth) { +/* 568 */ int var3 = sizeStringToWidth(str, wrapWidth); +/* 569 */ if (str.length() <= var3) { +/* 570 */ return str; +/* */ } +/* 572 */ String var4 = str.substring(0, var3); +/* 573 */ char var5 = str.charAt(var3); +/* 574 */ boolean var6 = !(var5 != ' ' && var5 != '\n'); +/* 575 */ String var7 = String.valueOf(getFormatFromString(var4)) + str.substring(var3 + (var6 ? 1 : 0)); +/* 576 */ return String.valueOf(var4) + "\n" + wrapFormattedStringToWidth(var7, wrapWidth); +/* */ } +/* */ +/* */ +/* */ public Color getColor(int colorCode, float alpha) { +/* 581 */ return new Color((colorCode >> 16) / 255.0F, (colorCode >> 8 & 0xFF) / 255.0F, (colorCode & 0xFF) / 255.0F, alpha); +/* */ } +/* */ +/* */ private String setupColorcodeIdentifier() { +/* 585 */ String minecraftColorCodes = "0123456789abcdefklmnor"; +/* */ +/* 587 */ for (int i = 0; i < this.customColorCodes.length; i++) { +/* 588 */ if (this.customColorCodes[i] != null) { +/* 589 */ minecraftColorCodes = String.valueOf(minecraftColorCodes) + (char)i; +/* */ } +/* */ } +/* */ +/* 593 */ return minecraftColorCodes; +/* */ } +/* */ +/* */ public void onResourceManagerReload(IResourceManager p_110549_1_) {} +/* */ } + + +/* Location: D:\Client\jelly-recode-beta-1.6\Jelly-Recoded\Jelly-Recoded.jar!\wtf\jelly\fonts\cFontRenderer.class + * Java compiler version: 8 (52.0) + * JD-Core Version: 1.1.3 + */ \ No newline at end of file diff --git a/src/minecraft/animeware/util/font/MinecraftFontRenderer.java b/src/minecraft/animeware/util/font/MinecraftFontRenderer.java new file mode 100644 index 0000000..951e124 --- /dev/null +++ b/src/minecraft/animeware/util/font/MinecraftFontRenderer.java @@ -0,0 +1,695 @@ +package animeware.util.font; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.texture.DynamicTexture; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +public class MinecraftFontRenderer extends CFont { + CFont.CharData[] boldChars = new CFont.CharData[256], + italicChars = new CFont.CharData[256], + boldItalicChars = new CFont.CharData[256]; + int[] colorCode = new int[32]; + String colorcodeIdentifiers = "0123456789abcdefklmnor"; + DynamicTexture texBold, texItalic, texItalicBold; + + public MinecraftFontRenderer(Font font, boolean antiAlias, boolean fractionalMetrics) { + super(font, antiAlias, fractionalMetrics); + this.setupMinecraftColorcodes(); + this.setupBoldItalicIDs(); + } + + public int drawStringWithShadow(String text, double x2, float y2, int color) { + + float shadowWidth = this.drawString(text, x2 + 0.9f, (double) y2 + 0.5f, color, true, 8.3f); + + return (int) Math.max(shadowWidth, this.drawString(text, x2, y2, color, false, 8.3f)); + } + + public int drawString(String text, double x2, float y2, int color) { + return (int) this.drawString(text, x2, y2, color, false, 8.3f); + } + + public int drawPassword(String text, double x2, float y2, int color) { + return (int) this.drawString(text.replaceAll(".", "."), x2, y2, color, false, 8f); + } + + public int drawNoBSString(String text, double x2, float y2, int color) { + return (int) this.drawNoBSString(text, x2, y2, color, false); + } + + public int drawSmoothString(String text, double x2, float y2, int color) { + return (int) this.drawSmoothString(text, x2, y2, color, false); + } + + public double getPasswordWidth(String text) { + return this.getStringWidth(text.replaceAll(".", "."), 8); + } + + public float drawCenteredString(String text, float x2, float y2, int color) { + return this.drawString(text, x2 - (float) (this.getStringWidth(text) / 2), y2, color); + } + + public float drawNoBSCenteredString(String text, float x2, float y2, int color) { + return this.drawNoBSString(text, x2 - (float) (this.getStringWidth(text) / 2), y2, color); + } + + public float drawCenteredStringWithShadow(String text, float x2, float y2, int color) { + return this.drawStringWithShadow(text, x2 - (float) (this.getStringWidth(text) / 2), y2, color); + } + + public float drawString(String text, double x, double y, int color, boolean shadow, float kerning) { + x -= 1.0; + + if (text == null) { + return 0; + } + + if (color == 0x20FFFFFF) { + color = 0xFFFFFF; + } + + if ((color & 0xFC000000) == 0) { + color |= 0xFF000000; + } + + if (shadow) { + color = (color & 0xFCFCFC) >> 2 | color & 0xFF000000; + } + + CFont.CharData[] currentData = this.charData; + float alpha = (float) (color >> 24 & 255) / 255f; + boolean randomCase = false, + bold = false, + italic = false, + strikethrough = false, + underline = false, + render = true; + x *= 2; + y = (y - 3) * 2; + GL11.glPushMatrix(); + GlStateManager.scale(0.5, 0.5, 0.5); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.color((float) (color >> 16 & 255) / 255f, (float) (color >> 8 & 255) / 255f, (float) (color & 255) / 255f, alpha); + GlStateManager.enableTexture2D(); + GlStateManager.bindTexture(this.tex.getGlTextureId()); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.tex.getGlTextureId()); + + for (int index = 0; index < text.length(); index++) { + char character = text.charAt(index); + + if (character == '\u00a7') { + int colorIndex = 21; + + try { + colorIndex = "0123456789abcdefklmnor".indexOf(text.charAt(index + 1)); + } catch (Exception e) { + e.printStackTrace(); + } + + if (colorIndex < 16) { + bold = false; + italic = false; + randomCase = false; + underline = false; + strikethrough = false; + GlStateManager.bindTexture(this.tex.getGlTextureId()); + currentData = this.charData; + + if (colorIndex < 0) { + colorIndex = 15; + } + + if (shadow) { + colorIndex += 16; + } + + int colorcode = this.colorCode[colorIndex]; + GlStateManager.color((float) (colorcode >> 16 & 255) / 255f, (float) (colorcode >> 8 & 255) / 255f, (float) (colorcode & 255) / 255f, alpha); + } else if (colorIndex == 16) { + randomCase = true; + } else if (colorIndex == 17) { + bold = true; + + if (italic) { + GlStateManager.bindTexture(this.texItalicBold.getGlTextureId()); + currentData = this.boldItalicChars; + } else { + GlStateManager.bindTexture(this.texBold.getGlTextureId()); + currentData = this.boldChars; + } + } else if (colorIndex == 18) { + strikethrough = true; + } else if (colorIndex == 19) { + underline = true; + } else if (colorIndex == 20) { + italic = true; + + if (bold) { + GlStateManager.bindTexture(this.texItalicBold.getGlTextureId()); + currentData = this.boldItalicChars; + } else { + GlStateManager.bindTexture(this.texItalic.getGlTextureId()); + currentData = this.italicChars; + } + } else { + bold = false; + italic = false; + randomCase = false; + underline = false; + strikethrough = false; + GlStateManager.color((float) (color >> 16 & 255) / 255f, (float) (color >> 8 & 255) / 255f, (float) (color & 255) / 255f, alpha); + GlStateManager.bindTexture(this.tex.getGlTextureId()); + currentData = this.charData; + } + + ++index; + } else if (character < currentData.length) { + GL11.glBegin(GL11.GL_TRIANGLES); + this.drawChar(currentData, character, (float) x, (float) y); + GL11.glEnd(); + + if (strikethrough) { + this.drawLine(x, y + (double) (currentData[character].height / 2), x + (double) currentData[character].width - 8, y + (double) (currentData[character].height / 2), 1); + } + + if (underline) { + this.drawLine(x, y + (double) currentData[character].height - 2, x + (double) currentData[character].width - 8, y + (double) currentData[character].height - 2, 1); + } + + x += currentData[character].width - kerning + this.charOffset; + } + } + + GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_DONT_CARE); + GL11.glPopMatrix(); + GL11.glColor4f(1, 1, 1, 1); + return (float) x / 2f; + } + + public float drawSmoothString(String text, double x, double y, int color, boolean shadow) { + x -= 1; + + if (text == null) { + return 0; + } + + CFont.CharData[] currentData = this.charData; + float alpha = (float) (color >> 24 & 255) / 255f; + boolean randomCase = false, + bold = false, + italic = false, + strikethrough = false, + underline = false, + render = true; + x *= 2; + y = (y - 3) * 2; + GL11.glPushMatrix(); + GlStateManager.scale(0.5, 0.5, 0.5); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.color((float) (color >> 16 & 255) / 255f, (float) (color >> 8 & 255) / 255f, (float) (color & 255) / 255f, alpha); + GlStateManager.enableTexture2D(); + GlStateManager.bindTexture(this.tex.getGlTextureId()); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.tex.getGlTextureId()); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + + for (int index = 0; index < text.length(); index++) { + char character = text.charAt(index); + + if (character == '\u00a7') { + int colorIndex = 21; + + try { + colorIndex = "0123456789abcdefklmnor".indexOf(text.charAt(index + 1)); + } catch (Exception e) { + e.printStackTrace(); + } + + if (colorIndex < 16) { + bold = false; + italic = false; + randomCase = false; + underline = false; + strikethrough = false; + GlStateManager.bindTexture(this.tex.getGlTextureId()); + currentData = this.charData; + + if (colorIndex < 0) { + colorIndex = 15; + } + + if (shadow) { + colorIndex += 16; + } + + int colorcode = this.colorCode[colorIndex]; + GlStateManager.color((float) (colorcode >> 16 & 255) / 255f, (float) (colorcode >> 8 & 255) / 255f, (float) (colorcode & 255) / 255f, alpha); + } else if (colorIndex == 16) { + randomCase = true; + } else if (colorIndex == 17) { + bold = true; + + if (italic) { + GlStateManager.bindTexture(this.texItalicBold.getGlTextureId()); + currentData = this.boldItalicChars; + } else { + GlStateManager.bindTexture(this.texBold.getGlTextureId()); + currentData = this.boldChars; + } + } else if (colorIndex == 18) { + strikethrough = true; + } else if (colorIndex == 19) { + underline = true; + } else if (colorIndex == 20) { + italic = true; + + if (bold) { + GlStateManager.bindTexture(this.texItalicBold.getGlTextureId()); + currentData = this.boldItalicChars; + } else { + GlStateManager.bindTexture(this.texItalic.getGlTextureId()); + currentData = this.italicChars; + } + } else { + bold = false; + italic = false; + randomCase = false; + underline = false; + strikethrough = false; + GlStateManager.color((float) (color >> 16 & 255) / 255f, (float) (color >> 8 & 255) / 255f, (float) (color & 255) / 255f, alpha); + GlStateManager.bindTexture(this.tex.getGlTextureId()); + currentData = this.charData; + } + + ++index; + } else if (character < currentData.length) { + GL11.glBegin(GL11.GL_TRIANGLES); + this.drawChar(currentData, character, (float) x, (float) y); + GL11.glEnd(); + + if (strikethrough) { + this.drawLine(x, y + (double) (currentData[character].height / 2), x + (double) currentData[character].width - 8, y + (double) (currentData[character].height / 2), 1); + } + + if (underline) { + this.drawLine(x, y + (double) currentData[character].height - 2, x + (double) currentData[character].width - 8, y + (double) currentData[character].height - 2, 1); + } + + x += currentData[character].width - 8.3f + this.charOffset; + } + } + + GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_DONT_CARE); + GL11.glPopMatrix(); + GL11.glColor4f(1, 1, 1, 1); + return (float) x / 2f; + } + + public float drawNoBSString(String text, double x, double y, int color, boolean shadow) { + x -= 1; + + if (text == null) { + return 0; + } + + CFont.CharData[] currentData = this.charData; + float alpha = (float) (color >> 24 & 0xFF) / 255f; + boolean randomCase = false, + bold = false, + italic = false, + strikethrough = false, + underline = false, + render = true; + x *= 2; + y = (y - 3) * 2; + GL11.glPushMatrix(); + GlStateManager.scale(0.5, 0.5, 0.5); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.color((float) (color >> 16 & 255) / 255f, (float) (color >> 8 & 255) / 255f, (float) (color & 255) / 255f, alpha); + GlStateManager.enableTexture2D(); + GlStateManager.bindTexture(this.tex.getGlTextureId()); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.tex.getGlTextureId()); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + + for (int index = 0; index < text.length(); index++) { + char character = text.charAt(index); + + if (character == '\u00a7') { + int colorIndex = 21; + + try { + colorIndex = "0123456789abcdefklmnor".indexOf(text.charAt(index + 1)); + } catch (Exception e) { + e.printStackTrace(); + } + + if (colorIndex < 16) { + bold = false; + italic = false; + randomCase = false; + underline = false; + strikethrough = false; + GlStateManager.bindTexture(this.tex.getGlTextureId()); + currentData = this.charData; + + if (colorIndex < 0) { + colorIndex = 15; + } + + if (shadow) { + colorIndex += 16; + } + + int colorcode = this.colorCode[colorIndex]; + GlStateManager.color((float) (colorcode >> 16 & 255) / 255f, (float) (colorcode >> 8 & 255) / 255f, (float) (colorcode & 255) / 255f, alpha); + } else if (colorIndex == 16) { + randomCase = true; + } else if (colorIndex == 17) { + bold = true; + + if (italic) { + GlStateManager.bindTexture(this.texItalicBold.getGlTextureId()); + currentData = this.boldItalicChars; + } else { + GlStateManager.bindTexture(this.texBold.getGlTextureId()); + currentData = this.boldChars; + } + } else if (colorIndex == 18) { + strikethrough = true; + } else if (colorIndex == 19) { + underline = true; + } else if (colorIndex == 20) { + italic = true; + + if (bold) { + GlStateManager.bindTexture(this.texItalicBold.getGlTextureId()); + currentData = this.boldItalicChars; + } else { + GlStateManager.bindTexture(this.texItalic.getGlTextureId()); + currentData = this.italicChars; + } + } else { + bold = false; + italic = false; + randomCase = false; + underline = false; + strikethrough = false; + GlStateManager.color((float) (color >> 16 & 255) / 255f, (float) (color >> 8 & 255) / 255f, (float) (color & 255) / 255f, alpha); + GlStateManager.bindTexture(this.tex.getGlTextureId()); + currentData = this.charData; + } + + ++index; + } else if (character < currentData.length) { + GL11.glBegin(GL11.GL_TRIANGLES); + this.drawChar(currentData, character, (float) x, (float) y); + GL11.glEnd(); + + if (strikethrough) { + this.drawLine(x, y + (double) (currentData[character].height / 2), x + (double) currentData[character].width - 8, y + (double) (currentData[character].height / 2), 1); + } + + if (underline) { + this.drawLine(x, y + (double) currentData[character].height - 2, x + (double) currentData[character].width - 8, y + (double) currentData[character].height - 2, 1); + } + + x += currentData[character].width - 8.3f + this.charOffset; + } + } + + GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_DONT_CARE); + GL11.glPopMatrix(); + GL11.glColor4f(1, 1, 1, 1); + return (float) x / 2f; + } + + public double getStringWidth(String text) { + if (text == null) { + return 0; + } + + float width = 0; + CFont.CharData[] currentData = charData; + boolean bold = false, italic = false; + + for (int index = 0; index < text.length(); index++) { + char character = text.charAt(index); + + if (character == '\u00a7') { + int colorIndex = "0123456789abcdefklmnor".indexOf(character); + + bold = false; + italic = false; + + ++index; + } else if (character < currentData.length) { + width += currentData[character].width - 8.3f + charOffset; + } + } + + return width / 2; + } + + public double getStringWidth(String text, float kerning) { + if (text == null) { + return 0; + } + + float width = 0; + CFont.CharData[] currentData = charData; + boolean bold = false, italic = false; + + for (int index = 0; index < text.length(); index++) { + char c = text.charAt(index); + + if (c == '\u00a7') { + int colorIndex = "0123456789abcdefklmnor".indexOf(c); + + bold = false; + italic = false; + + ++index; + } else if (c < currentData.length) { + width += currentData[c].width - kerning + charOffset; + } + } + + return width / 2; + } + + public int getHeight() { + return (this.fontHeight - 8) / 2; + } + + @Override + public void setFont(Font font) { + super.setFont(font); + this.setupBoldItalicIDs(); + } + + @Override + public void setAntiAlias(boolean antiAlias) { + super.setAntiAlias(antiAlias); + this.setupBoldItalicIDs(); + } + + @Override + public void setFractionalMetrics(boolean fractionalMetrics) { + super.setFractionalMetrics(fractionalMetrics); + this.setupBoldItalicIDs(); + } + + private void setupBoldItalicIDs() { + this.texBold = this.setupTexture(this.font.deriveFont(Font.BOLD), this.antiAlias, this.fractionalMetrics, this.boldChars); + this.texItalic = this.setupTexture(this.font.deriveFont(Font.ITALIC), this.antiAlias, this.fractionalMetrics, this.italicChars); + this.texItalicBold = this.setupTexture(this.font.deriveFont(Font.BOLD | Font.ITALIC), this.antiAlias, this.fractionalMetrics, this.boldItalicChars); + } + + private void drawLine(double x2, double y2, double x1, double y1, float width) { + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glLineWidth(width); + GL11.glBegin(GL11.GL_LINES); + GL11.glVertex2d(x2, y2); + GL11.glVertex2d(x1, y1); + GL11.glEnd(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + public List wrapWords(String text, double width) { + ArrayList finalWords = new ArrayList<>(); + + if (getStringWidth(text) > width) { + String[] words = text.split(" "); + StringBuilder currentWord = new StringBuilder(); + char lastColorCode = 65535; + + for (String word : words) { + for (int innerIndex = 0; innerIndex < word.toCharArray().length; innerIndex++) { + char c = word.toCharArray()[innerIndex]; + + if (c == '\u00a7' && innerIndex < word.toCharArray().length - 1) { + lastColorCode = word.toCharArray()[innerIndex + 1]; + } + } + + if (getStringWidth(currentWord + word + " ") < width) { + currentWord.append(word).append(" "); + } else { + finalWords.add(currentWord.toString()); + currentWord = new StringBuilder("\u00a7" + lastColorCode + word + " "); + } + } + + if (currentWord.length() > 0) { + if (getStringWidth(currentWord.toString()) < width) { + finalWords.add("\u00a7" + lastColorCode + currentWord + " "); + currentWord = new StringBuilder(); + } else { + finalWords.addAll(formatString(currentWord.toString(), width)); + } + } + } else { + finalWords.add(text); + } + + return finalWords; + } + + public List formatString(String string, double width) { + ArrayList finalWords = new ArrayList<>(); + StringBuilder currentWord = new StringBuilder(); + char lastColorCode = 65535; + char[] chars = string.toCharArray(); + + for (int index = 0; index < chars.length; index++) { + char c = chars[index]; + + if (c == '\u00a7' && index < chars.length - 1) { + lastColorCode = chars[index + 1]; + } + + if (getStringWidth(currentWord.toString() + c) < width) { + currentWord.append(c); + } else { + finalWords.add(currentWord.toString()); + currentWord = new StringBuilder("\u00a7" + lastColorCode + c); + } + } + + if (currentWord.length() > 0) { + finalWords.add(currentWord.toString()); + } + + return finalWords; + } + + private void setupMinecraftColorcodes() { + int index = 0; + + while (index < 32) { + int noClue = (index >> 3 & 1) * 85; + int red = (index >> 2 & 1) * 170 + noClue; + int green = (index >> 1 & 1) * 170 + noClue; + int blue = (index & 1) * 170 + noClue; + + if (index == 6) { + red += 85; + } + + if (index >= 16) { + red /= 4; + green /= 4; + blue /= 4; + } + + this.colorCode[index] = (red & 255) << 16 | (green & 255) << 8 | blue & 255; + ++index; + } + } + + public String trimStringToWidth(String text, int width) { + return this.trimStringToWidth(text, width, false); + } + + public String trimStringToWidthPassword(String text, int width, boolean custom) { + text = text.replaceAll(".", "."); + return this.trimStringToWidth(text, width, custom); + } + + private float getCharWidthFloat(char c) { + if (c == 167) { + return -1; + } else if (c == 32) { + return 2; + } else { + int var2 = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000" + .indexOf(c); + + if (c > 0 && var2 != -1) { + return ((charData[var2].width / 2.f) - 4.f); + } else if (((charData[c].width / 2.f) - 4.f) != 0) { + int var3 = ((int) ((charData[c].width / 2.f) - 4.f)) >>> 4; + int var4 = ((int) ((charData[c].width / 2.f) - 4.f)) & 15; + var3 &= 15; + ++var4; + return (float) ((var4 - var3) / 2 + 1); + } else { + return 0; + } + } + } + + public String trimStringToWidth(String text, int width, boolean custom) { + StringBuilder buffer = new StringBuilder(); + float lineWidth = 0.0F; + int offset = custom ? text.length() - 1 : 0; + int increment = custom ? -1 : 1; + boolean var8 = false; + boolean var9 = false; + + for (int index = offset; index >= 0 && index < text.length() && lineWidth < (float) width; index += increment) { + char character = text.charAt(index); + float charWidth = this.getCharWidthFloat(character); + + if (var8) { + var8 = false; + + if (character != 108 && character != 76) { + if (character == 114 || character == 82) { + var9 = false; + } + } else { + var9 = true; + } + } else if (charWidth < 0) { + var8 = true; + } else { + lineWidth += charWidth; + + if (var9) { + ++lineWidth; + } + } + + if (lineWidth > (float) width) { + break; + } + + if (custom) { + buffer.insert(0, character); + } else { + buffer.append(character); + } + } + + return buffer.toString(); + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/font/TenaFontUtil.java b/src/minecraft/animeware/util/font/TenaFontUtil.java new file mode 100644 index 0000000..6b6d071 --- /dev/null +++ b/src/minecraft/animeware/util/font/TenaFontUtil.java @@ -0,0 +1,69 @@ +package animeware.util.font; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +import java.awt.*; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +public class TenaFontUtil { + public static volatile int completed; + //These are for the icon font for ease of access + public final static String + BUG = "a", + LIST = "b", + BOMB = "c", + EYE = "d", + PERSON = "e", + WHEELCHAIR = "f", + SCRIPT = "g", + SKIP_LEFT = "h", + PAUSE = "i", + PLAY = "j", + SKIP_RIGHT = "k", + SHUFFLE = "l", + INFO = "m", + SETTINGS = "n", + CHECKMARK = "o", + XMARK = "p", + TRASH = "q", + WARNING = "r", + FOLDER = "s", + LOAD = "t", + SAVE = "u"; + + + public static MinecraftFontRenderer tenacityFont14, tenacityFont16, tenacityFont18, tenacityBoldFont18, tenacityFont20, tenacityBoldFont20, tenacityFont22, tenacityBoldFont22, tenacityFont24, tenacityBoldFont26, tenacityBoldFont32, tenacityFont40, tenacityBoldFont40, iconFont16, iconFont20, iconFont26, iconFont35, iconFont40; + public static Font tenacityBoldFont40_; + + + public TenaFontUtil() { + + + } + + public static Font getFont(Map locationMap, String location, int size) { + Font font; + try { + if (locationMap.containsKey(location)) { + font = locationMap.get(location).deriveFont(Font.PLAIN, size); + } else { + InputStream is = Minecraft.getMinecraft().getResourceManager() + .getResource(new ResourceLocation("Animeware/fonts/" + location)).getInputStream(); + locationMap.put(location, font = Font.createFont(0, is)); + font = font.deriveFont(Font.PLAIN, size); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println("Error loading font"); + font = new Font("default", Font.PLAIN, +10); + } + return font; + } + + public static boolean hasLoaded() { + return completed >= 3; + } +} diff --git a/src/minecraft/animeware/util/font/ucfont/UCFont$CharData.java b/src/minecraft/animeware/util/font/ucfont/UCFont$CharData.java new file mode 100644 index 0000000..e0bd3de --- /dev/null +++ b/src/minecraft/animeware/util/font/ucfont/UCFont$CharData.java @@ -0,0 +1,11 @@ +package animeware.util.font.ucfont; + +class UCFont$CharData { + public int width; + public int height; + public int storedX; + public int storedY; + + protected UCFont$CharData() { + } +} diff --git a/src/minecraft/animeware/util/font/ucfont/UCFont.java b/src/minecraft/animeware/util/font/ucfont/UCFont.java new file mode 100644 index 0000000..5381171 --- /dev/null +++ b/src/minecraft/animeware/util/font/ucfont/UCFont.java @@ -0,0 +1,176 @@ +package animeware.util.font.ucfont; + +import java.awt.Color; +import java.awt.Font; +import java.awt.FontFormatException; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class UCFont { + protected CharData[] charData = new CharData[256]; + protected DynamicTexture tex; + protected Font font; + protected boolean antiAlias; + protected boolean fractionalMetrics; + protected int fontHeight = -1; + protected int charOffset = 0; + private float imgSize = 1048.0f; + + public UCFont(ResourceLocation resourceLocation, float size) { + Font tmp; + try { + InputStream is = Minecraft.getMinecraft().getResourceManager().getResource(resourceLocation).getInputStream(); + tmp = Font.createFont(0, is).deriveFont(size); + } + catch (FontFormatException | IOException e) { + tmp = new Font("Arial", 0, (int)size); + e.printStackTrace(); + } + this.font = tmp; + this.antiAlias = true; + this.fractionalMetrics = true; + this.tex = this.setupTexture(this.font, true, true, this.charData); + } + + protected DynamicTexture setupTexture(Font font, boolean antiAlias, boolean fractionalMetrics, CharData[] chars) { + BufferedImage img = this.generateFontImage(font, antiAlias, fractionalMetrics, chars); + try { + return new DynamicTexture(img); + } + catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + private BufferedImage generateFontImage(Font font, boolean antiAlias, boolean fractionalMetrics, CharData[] chars) { + int imgSize = (int)this.imgSize; + BufferedImage bufferedImage = new BufferedImage(imgSize, imgSize, 2); + Graphics2D g = (Graphics2D)bufferedImage.getGraphics(); + g.setFont(font); + g.setColor(new Color(255, 255, 255, 0)); + g.fillRect(0, 0, imgSize, imgSize); + g.setColor(Color.WHITE); + g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, fractionalMetrics ? RenderingHints.VALUE_FRACTIONALMETRICS_ON : RenderingHints.VALUE_FRACTIONALMETRICS_OFF); + g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, antiAlias ? RenderingHints.VALUE_TEXT_ANTIALIAS_ON : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antiAlias ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF); + FontMetrics fontMetrics = g.getFontMetrics(); + int charHeight = 0; + int positionX = 0; + int positionY = 1; + for (int i = 0; i < chars.length; ++i) { + char ch = (char)i; + CharData charData = new CharData(); + Rectangle2D dimensions = fontMetrics.getStringBounds(String.valueOf(ch), g); + charData.width = dimensions.getBounds().width + 8; + charData.height = dimensions.getBounds().height; + if (positionX + charData.width >= imgSize) { + positionX = 0; + positionY += charHeight; + charHeight = 0; + } + if (charData.height > charHeight) { + charHeight = charData.height; + } + charData.storedX = positionX; + charData.storedY = positionY; + if (charData.height > this.fontHeight) { + this.fontHeight = charData.height; + } + chars[i] = charData; + g.drawString(String.valueOf(ch), positionX + 2, positionY + fontMetrics.getAscent()); + positionX += charData.width; + } + return bufferedImage; + } + + protected void drawChar(CharData[] chars, char c, float x, float y) throws ArrayIndexOutOfBoundsException { + try { + this.drawQuad(x, y, chars[c].width, chars[c].height, chars[c].storedX, chars[c].storedY, chars[c].width, chars[c].height); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private void drawQuad(float x, float y, float width, float height, float srcX, float srcY, float srcWidth, float srcHeight) { + float renderSRCX = srcX / this.imgSize; + float renderSRCY = srcY / this.imgSize; + float renderSRCWidth = srcWidth / this.imgSize; + float renderSRCHeight = srcHeight / this.imgSize; + GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY); + GL11.glVertex2d(x + width, y); + GL11.glTexCoord2f(renderSRCX, renderSRCY); + GL11.glVertex2d(x, y); + GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight); + GL11.glVertex2d(x, y + height); + GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight); + GL11.glVertex2d(x, y + height); + GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY + renderSRCHeight); + GL11.glVertex2d(x + width, y + height); + GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY); + GL11.glVertex2d(x + width, y); + } + + public int getHeight() { + return (this.fontHeight - 8) / 2; + } + + public int getStringWidth(String text) { + int width = 0; + for (char c : text.toCharArray()) { + if (c >= this.charData.length) continue; + width += this.charData[c].width - 8 + this.charOffset; + } + return width / 2; + } + + public boolean isAntiAlias() { + return this.antiAlias; + } + + public void setAntiAlias(boolean antiAlias) { + if (this.antiAlias != antiAlias) { + this.antiAlias = antiAlias; + this.tex = this.setupTexture(this.font, antiAlias, this.fractionalMetrics, this.charData); + } + } + + public boolean isFractionalMetrics() { + return this.fractionalMetrics; + } + + public void setFractionalMetrics(boolean fractionalMetrics) { + if (this.fractionalMetrics != fractionalMetrics) { + this.fractionalMetrics = fractionalMetrics; + this.tex = this.setupTexture(this.font, this.antiAlias, fractionalMetrics, this.charData); + } + } + + public Font getFont() { + return this.font; + } + + public void setFont(Font font) { + this.font = font; + this.tex = this.setupTexture(font, this.antiAlias, this.fractionalMetrics, this.charData); + } + + protected class CharData { + public int width; + public int height; + public int storedX; + public int storedY; + + + } +} diff --git a/src/minecraft/animeware/util/font/ucfont/UCFontRenderer.java b/src/minecraft/animeware/util/font/ucfont/UCFontRenderer.java new file mode 100644 index 0000000..e9ea4f5 --- /dev/null +++ b/src/minecraft/animeware/util/font/ucfont/UCFontRenderer.java @@ -0,0 +1,382 @@ +package animeware.util.font.ucfont; + +import java.util.ArrayList; +import java.util.List; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; + +public final class UCFontRenderer +extends UCFont { + protected final UCFont.CharData[] boldItalicChars = new UCFont.CharData[256]; + protected final UCFont.CharData[] italicChars = new UCFont.CharData[256]; + protected final UCFont.CharData[] boldChars = new UCFont.CharData[256]; + private final int[] colorCode = new int[32]; + private char COLOR_CODE_START = (char)167; + protected DynamicTexture texBold; + protected DynamicTexture texItalic; + protected DynamicTexture texItalicBold; + + public UCFontRenderer(ResourceLocation resourceLocation, float size) { + super(resourceLocation, size); + this.setupMinecraftColorCodes(); + this.setupBoldItalicIDs(); + } + + public float drawStringWithShadow(String text, double x, double y, int color, int shadowColor) { + float shadowWidth = this.drawString(text, x + 1.0, y + 1.0, shadowColor, false); + return Math.max(shadowWidth, this.drawString(text, x, y, color, false)); + } + + public float drawStringWithShadow(String text, double x, double y, int color) { + float shadowWidth = this.drawString(text, x + 1.0, y + 1.0, color, true); + return Math.max(shadowWidth, this.drawString(text, x, y, color, false)); + } + + public float drawString(String text, float x, float y, int color) { + return this.drawString(text, x, y, color, false); + } + + public float drawCenteredString(String text, float x, float y, int color) { + return this.drawString(text, x - (float)this.getStringWidth(text) / 2.0f, y, color); + } + + public float drawCenteredStringWithShadow(String text, float x, float y, int color) { + this.drawString(text, (double)(x - (float)this.getStringWidth(text) / 2.0f) + 1.0, (double)y + 1.0, color, true); + return this.drawString(text, x - (float)this.getStringWidth(text) / 2.0f, y, color); + } + + public float drawString(String text, double x, double y, int color, boolean shadow) { + x -= 1.0; + if (text == null) { + return 0.0f; + } + if (color == 0x20FFFFFF) { + color = 0xFFFFFF; + } + if ((color & 0xFC000000) == 0) { + color |= 0xFF000000; + } + if (shadow) { + color = (color & 0xFCFCFC) >> 2 | color & 0xFF000000; + } + UCFont.CharData[] currentData = this.charData; + float alpha = (float)(color >> 24 & 0xFF) / 255.0f; + boolean bold = false; + boolean italic = false; + boolean strike = false; + boolean underline = false; + boolean render = true; + x *= 2.0; + y = (y - 3.0) * 2.0; + if (render) { + GL11.glPushMatrix(); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + GL11.glScaled(0.5, 0.5, 0.5); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 771); + GL11.glColor4f((float)(color >> 16 & 0xFF) / 255.0f, (float)(color >> 8 & 0xFF) / 255.0f, (float)(color & 0xFF) / 255.0f, alpha); + int size = text.length(); + GL11.glEnable(3553); + GL11.glBindTexture(3553, this.tex.getGlTextureId()); + for (int i = 0; i < size; ++i) { + char character = text.charAt(i); + if (character == this.COLOR_CODE_START && i < size) { + int colorIndex = 21; + try { + colorIndex = "0123456789abcdefklmnor".indexOf(text.charAt(i + 1)); + } + catch (Exception e) { + e.printStackTrace(); + } + if (colorIndex < 16) { + bold = false; + italic = false; + underline = false; + strike = false; + GL11.glBindTexture(3553, this.tex.getGlTextureId()); + currentData = this.charData; + if (colorIndex < 0 || colorIndex > 15) { + colorIndex = 15; + } + if (shadow) { + colorIndex += 16; + } + int cc = this.colorCode[colorIndex]; + GL11.glColor4f((float)(cc >> 16 & 0xFF) / 255.0f, (float)(cc >> 8 & 0xFF) / 255.0f, (float)(cc & 0xFF) / 255.0f, alpha); + } else if (colorIndex != 16) { + if (colorIndex == 17) { + bold = true; + if (italic) { + GL11.glBindTexture(3553, this.texItalicBold.getGlTextureId()); + currentData = this.boldItalicChars; + } else { + GL11.glBindTexture(3553, this.texBold.getGlTextureId()); + currentData = this.boldChars; + } + } else if (colorIndex == 18) { + strike = true; + } else if (colorIndex == 19) { + underline = true; + } else if (colorIndex == 20) { + italic = true; + if (bold) { + GL11.glBindTexture(3553, this.texItalicBold.getGlTextureId()); + currentData = this.boldItalicChars; + } else { + GL11.glBindTexture(3553, this.texItalic.getGlTextureId()); + currentData = this.italicChars; + } + } else if (colorIndex == 21) { + bold = false; + italic = false; + underline = false; + strike = false; + GL11.glColor4f((float)(color >> 16 & 0xFF) / 255.0f, (float)(color >> 8 & 0xFF) / 255.0f, (float)(color & 0xFF) / 255.0f, alpha); + GL11.glBindTexture(3553, this.tex.getGlTextureId()); + currentData = this.charData; + } + } + ++i; + continue; + } + if (character >= currentData.length || character < '\u0000') continue; + GL11.glBegin(4); + this.drawChar(currentData, character, (float)x, (float)y + 6.0f); + GL11.glEnd(); + if (strike) { + this.drawLine(x, y + (double)(currentData[character].height / 2), x + (double)currentData[character].width - 8.0, y + (double)(currentData[character].height / 2)); + } + if (underline) { + this.drawLine(x, y + (double)currentData[character].height - 2.0, x + (double)currentData[character].width - 8.0, y + (double)currentData[character].height - 2.0); + } + x += (double)(currentData[character].width - 8 + this.charOffset); + } + GL11.glHint(3155, 4352); + GL11.glPopMatrix(); + } + return (float)x / 2.0f; + } + + @Override + public int getStringWidth(String text) { + if (text == null) { + return 0; + } + int width = 0; + UCFont.CharData[] currentData = this.charData; + boolean bold = false; + boolean italic = false; + int size = text.length(); + for (int i = 0; i < size; ++i) { + char character = text.charAt(i); + if (character == this.COLOR_CODE_START) { + int colorIndex = "0123456789abcdefklmnor".indexOf(character); + if (colorIndex < 16) { + bold = false; + italic = false; + } else if (colorIndex == 17) { + bold = true; + currentData = italic ? this.boldItalicChars : this.boldChars; + } else if (colorIndex == 20) { + italic = true; + currentData = bold ? this.boldItalicChars : this.italicChars; + } else if (colorIndex == 21) { + bold = false; + italic = false; + currentData = this.charData; + } + ++i; + continue; + } + if (character >= currentData.length) continue; + width += currentData[character].width - 8 + this.charOffset; + } + return width / 2; + } + + public String trimStringToWidth(String string, double d) { + return this.trimStringToWidth(string, d, false); + } + + public String trimStringToWidth(String string, double d, boolean bl) { + StringBuilder stringBuilder = new StringBuilder(); + float f = 0.0f; + int n = bl ? string.length() - 1 : 0; + int n2 = bl ? -1 : 1; + boolean bl2 = false; + boolean bl3 = false; + for (int i = n; i >= 0 && i < string.length() && f < (float)d; i += n2) { + char c = string.charAt(i); + double d2 = this.getStringWidth(String.valueOf(c)); + if (bl2) { + bl2 = false; + if (c != 'l' && c != 'L') { + if (c == 'r' || c == 'R') { + bl3 = false; + } + } else { + bl3 = true; + } + } else if (d2 < 0.0) { + bl2 = true; + } else { + f = (float)((double)f + d2); + if (bl3) { + f += 1.0f; + } + } + if (f > (float)d) break; + if (bl) { + stringBuilder.insert(0, c); + continue; + } + stringBuilder.append(c); + } + return stringBuilder.toString(); + } + + @Override + public void setAntiAlias(boolean antiAlias) { + super.setAntiAlias(antiAlias); + this.setupBoldItalicIDs(); + } + + @Override + public void setFractionalMetrics(boolean fractionalMetrics) { + super.setFractionalMetrics(fractionalMetrics); + this.setupBoldItalicIDs(); + } + + private void setupBoldItalicIDs() { + this.texBold = this.setupTexture(this.font.deriveFont(1), this.antiAlias, this.fractionalMetrics, this.boldChars); + this.texItalic = this.setupTexture(this.font.deriveFont(2), this.antiAlias, this.fractionalMetrics, this.italicChars); + this.texItalicBold = this.setupTexture(this.font.deriveFont(3), this.antiAlias, this.fractionalMetrics, this.boldItalicChars); + } + + private void drawLine(double x, double y, double x1, double y1) { + GL11.glDisable(3553); + GL11.glLineWidth(1.0f); + GL11.glBegin(1); + GL11.glVertex2d(x, y); + GL11.glVertex2d(x1, y1); + GL11.glEnd(); + GL11.glEnable(3553); + } + + public String lIIIIIIIIIlIllIIllIlIIlIl(String string, double width) { + StringBuilder stringBuilder = new StringBuilder(); + StringBuilder stringBuilder2 = new StringBuilder(); + boolean wasLastCharColorCode = false; + for (char c : string.toCharArray()) { + String string2; + String string3; + if (wasLastCharColorCode) { + stringBuilder.append(c); + wasLastCharColorCode = false; + continue; + } + if (c == '') { + stringBuilder.append(c); + wasLastCharColorCode = true; + continue; + } + stringBuilder.append(c); + int stringWidth = this.getStringWidth(stringBuilder.toString()); + if (!((double)stringWidth >= width)) continue; + String string4 = stringBuilder.toString(); + if (string4.contains(" ")) { + string3 = string4.substring(0, string4.lastIndexOf(" ")); + string2 = string4.substring(string4.lastIndexOf(" ")); + if (string2.startsWith(" ")) { + string2 = string2.replaceFirst(" ", ""); + } + } else { + string3 = string4.substring(0, string4.length() - 1); + string2 = string4.substring(string4.length() - 1); + } + stringBuilder2.append(string3).append("\n"); + String string5 = EnumChatFormatting.getTextWithoutFormattingCodes(stringBuilder.toString()); + stringBuilder.setLength(0); + stringBuilder.append(string2).append(string5); + } + stringBuilder2.append((CharSequence)stringBuilder); + return stringBuilder2.length() == 0 ? string : stringBuilder2.toString(); + } + + public List wrapWords(String text, double width) { + ArrayList finalWords = new ArrayList(); + if ((double)this.getStringWidth(text) > width) { + String[] words = text.split(" "); + StringBuilder currentWord = new StringBuilder(); + int lastColorCode = 65535; + for (String word : words) { + for (int i = 0; i < word.toCharArray().length; ++i) { + char c = word.toCharArray()[i]; + if (c != this.COLOR_CODE_START || i >= word.toCharArray().length - 1) continue; + lastColorCode = word.toCharArray()[i + 1]; + } + if ((double)this.getStringWidth(currentWord + word + " ") < width) { + currentWord.append(word).append(" "); + continue; + } + finalWords.add(currentWord.toString()); + currentWord = new StringBuilder(this.COLOR_CODE_START + lastColorCode + word + " "); + } + if (currentWord.length() > 0) { + if ((double)this.getStringWidth(currentWord.toString()) < width) { + finalWords.add(this.COLOR_CODE_START + lastColorCode + currentWord.toString() + " "); + } else { + finalWords.addAll(this.formatString(currentWord.toString(), width)); + } + } + } else { + finalWords.add(text); + } + return finalWords; + } + + public List formatString(String string, double width) { + ArrayList finalWords = new ArrayList(); + StringBuilder currentWord = new StringBuilder(); + int lastColorCode = 65535; + char[] chars = string.toCharArray(); + for (int i = 0; i < chars.length; ++i) { + char c = chars[i]; + if (c == this.COLOR_CODE_START && i < chars.length - 1) { + lastColorCode = chars[i + 1]; + } + if ((double)this.getStringWidth(currentWord.toString() + c) < width) { + currentWord.append(c); + continue; + } + finalWords.add(currentWord.toString()); + currentWord = new StringBuilder(this.COLOR_CODE_START + lastColorCode + String.valueOf(c)); + } + if (currentWord.length() > 0) { + finalWords.add(currentWord.toString()); + } + return finalWords; + } + + private void setupMinecraftColorCodes() { + for (int index = 0; index < 32; ++index) { + int alpha = (index >> 3 & 1) * 85; + int red = (index >> 2 & 1) * 170 + alpha; + int green = (index >> 1 & 1) * 170 + alpha; + int blue = (index & 1) * 170 + alpha; + if (index == 6) { + red += 85; + } + if (index >= 16) { + red /= 4; + green /= 4; + blue /= 4; + } + this.colorCode[index] = (red & 0xFF) << 16 | (green & 0xFF) << 8 | blue & 0xFF; + } + } +} diff --git a/src/minecraft/animeware/util/frames/BetterframesConfig.java b/src/minecraft/animeware/util/frames/BetterframesConfig.java new file mode 100644 index 0000000..44023e4 --- /dev/null +++ b/src/minecraft/animeware/util/frames/BetterframesConfig.java @@ -0,0 +1,76 @@ +package animeware.util.frames; + +public class BetterframesConfig +{ + private BetterframesConfig.BFRenderType renderImprovements = BetterframesConfig.BFRenderType.EXPERIMENTAL; + private boolean weather = true; + private boolean reducedChunkUpdates = true; + private boolean fogEnabled = true; + private boolean worldSwitchDirtScreen = true; + + public boolean isRenderImprovements() + { + return this.renderImprovements == BetterframesConfig.BFRenderType.EXPERIMENTAL; + } + + public BetterframesConfig.BFRenderType getRenderImprovements() + { + return this.renderImprovements; + } + + public void setRenderImprovements(boolean enabled) + { + this.setRenderImprovements(enabled ? BetterframesConfig.BFRenderType.EXPERIMENTAL : BetterframesConfig.BFRenderType.DEFAULT); + } + + public void setRenderImprovements(BetterframesConfig.BFRenderType renderImprovements) + { + this.renderImprovements = renderImprovements; + } + + public boolean isWeather() + { + return this.weather; + } + + public void setWeather(boolean weather) + { + this.weather = weather; + } + + public boolean isReducedChunkUpdates() + { + return this.reducedChunkUpdates; + } + + public void setReducedChunkUpdates(boolean reducedChunkUpdates) + { + this.reducedChunkUpdates = reducedChunkUpdates; + } + + public boolean isFogEnabled() + { + return this.fogEnabled; + } + + public void setFogEnabled(boolean fogEnabled) + { + this.fogEnabled = fogEnabled; + } + + public boolean isWorldSwitchDirtScreen() + { + return this.worldSwitchDirtScreen; + } + + public void setWorldSwitchDirtScreen(boolean worldSwitchDirtScreen) + { + this.worldSwitchDirtScreen = worldSwitchDirtScreen; + } + + private static enum BFRenderType + { + EXPERIMENTAL, + DEFAULT; + } +} diff --git a/src/minecraft/animeware/util/lukflug/ColorSetting.java b/src/minecraft/animeware/util/lukflug/ColorSetting.java new file mode 100644 index 0000000..9cd5bc4 --- /dev/null +++ b/src/minecraft/animeware/util/lukflug/ColorSetting.java @@ -0,0 +1,39 @@ +package animeware.util.lukflug; + +import java.awt.Color; + +/** + * Setting representing a color. + * @author lukflug + */ +public interface ColorSetting { + /** + * Get the current value for the color setting. + * @return the current color + */ + Color getValue(); + + /** + * Set the non-rainbow color. + * @param value the value + */ + void setValue (Color value); + + /** + * Get the color, ignoring the rainbow. + * @return the color ignoring the rainbow + */ + public Color getColor(); + + /** + * Check if rainbow is enabled. + * @return set, if the rainbow is enabled + */ + public boolean getRainbow(); + + /** + * Enable or disable the rainbow. + * @param rainbow set, if rainbow should be enabled + */ + public void setRainbow (boolean rainbow); +} diff --git a/src/minecraft/animeware/util/lukflug/EnumSetting.java b/src/minecraft/animeware/util/lukflug/EnumSetting.java new file mode 100644 index 0000000..bb81833 --- /dev/null +++ b/src/minecraft/animeware/util/lukflug/EnumSetting.java @@ -0,0 +1,18 @@ +package animeware.util.lukflug; + +/** + * A setting representing an enumeration. + * @author lukflug + */ +public interface EnumSetting { + /** + * Cycle through the values of the enumeration. + */ + public void increment(); + + /** + * Get the current value. + * @return the name of the current enum value + */ + public String getValueName(); +} diff --git a/src/minecraft/animeware/util/lukflug/NumberSetting.java b/src/minecraft/animeware/util/lukflug/NumberSetting.java new file mode 100644 index 0000000..f05e145 --- /dev/null +++ b/src/minecraft/animeware/util/lukflug/NumberSetting.java @@ -0,0 +1,38 @@ +package animeware.util.lukflug; + +/** + * Setting representing an adjustable number. + * @author lukflug + */ +public interface NumberSetting { + /** + * Get the number as double. + * @return the current setting + */ + public double getNumber(); + + /** + * Set the number. + * @param value the new number + */ + public void setNumber (double value); + + /** + * Get the maximum allowed value for the setting. + * @return maximum value + */ + public double getMaximumValue(); + + /** + * Get the minimum allowed value for the setting. + * @return minimum value + */ + public double getMinimumValue(); + + + /** + * Get the setting's precision. + * @return decimal precision + */ + public int getPrecision(); +} diff --git a/src/minecraft/animeware/util/lukflug/Toggleable.java b/src/minecraft/animeware/util/lukflug/Toggleable.java new file mode 100644 index 0000000..94b04f2 --- /dev/null +++ b/src/minecraft/animeware/util/lukflug/Toggleable.java @@ -0,0 +1,18 @@ +package animeware.util.lukflug; + +/** + * Interface representing a boolean value that can be toggled. + * @author lukflug + */ +public interface Toggleable { + /** + * Toggle the boolean value. + */ + public void toggle(); + + /** + * Get the boolean value. + * @return the value + */ + public boolean isOn(); +} diff --git a/src/minecraft/animeware/util/misc/Encryption.java b/src/minecraft/animeware/util/misc/Encryption.java new file mode 100644 index 0000000..8cdf447 --- /dev/null +++ b/src/minecraft/animeware/util/misc/Encryption.java @@ -0,0 +1,74 @@ +package animeware.util.misc; + +import java.io.UnsupportedEncodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; +import java.util.Base64; + +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; +public class Encryption { + + private static SecretKeySpec keySpec; + private static byte[] key; + + public static String hashMD5(String input) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(input.getBytes()); + StringBuilder hexString = new StringBuilder(); + + byte[] byteData = md.digest(); + + for (byte aByteData : byteData) { + String hex = Integer.toHexString(0xff & aByteData); + if (hex.length() == 1) hexString.append('0'); + hexString.append(hex); + } + + return hexString.toString(); + } catch (Exception e) { + e.printStackTrace(); + return "Error"; + } + } + + public static void setKey(String niggakey) { + MessageDigest sha = null; + try { + key = niggakey.getBytes("UTF-8"); + sha = MessageDigest.getInstance("SHA-1"); + key = sha.digest(key); + key = Arrays.copyOf(key, 16); + keySpec = new SecretKeySpec(key, "AES"); + } catch(NoSuchAlgorithmException | UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + + public static String encrypt(String strToEncrypt, String secret) { + try { + setKey(secret); + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); + cipher.init(Cipher.ENCRYPT_MODE, keySpec); + return Base64.getEncoder().encodeToString(cipher.doFinal(strToEncrypt.getBytes("UTF-8"))); + } catch(Exception e) { + System.out.println("Error while encrypting: " + e.toString()); + } + return null; + } + + public static String decrypt(String strToDecrypt, String secret) { + try { + setKey(secret); + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5PADDING"); + cipher.init(Cipher.DECRYPT_MODE, keySpec); + return new String(cipher.doFinal(Base64.getDecoder().decode(strToDecrypt))); + } catch(Exception e) { + System.out.println("Error while decrypting: " + e.toString()); + } + return null; + } + +} diff --git a/src/minecraft/animeware/util/misc/Identification.java b/src/minecraft/animeware/util/misc/Identification.java new file mode 100644 index 0000000..dff0465 --- /dev/null +++ b/src/minecraft/animeware/util/misc/Identification.java @@ -0,0 +1,26 @@ +package animeware.util.misc; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; + +public class Identification { + + public static String getHWID() { + String hwid = System.getenv("COMPUTERNAME") + System.getProperty("user.name") + System.getProperty("os.name") + System.getenv("PROCESSOR_IDENTIFIER") + System.getenv("PROCESSOR_LEVEL"); + return Encryption.hashMD5(hwid); + } + + public static String getIP() { + try { + URL ip = new URL("http://checkip.amazonaws.com"); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader( + ip.openStream())); + if(bufferedReader.readLine().equals("this would be where quick's or austin's ip was, but i removed it.")) { + return "69.420.666.21"; + } else return bufferedReader.readLine(); + } catch (Exception e) { + return "127.0.0.1"; + } + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/misc/RenderUtil.java b/src/minecraft/animeware/util/misc/RenderUtil.java new file mode 100644 index 0000000..98315c0 --- /dev/null +++ b/src/minecraft/animeware/util/misc/RenderUtil.java @@ -0,0 +1,376 @@ +package animeware.util.misc; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.util.render.ColorUtils; +import animeware.util.render.GLUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Timer; + +public class RenderUtil { + static final Minecraft mc = Minecraft.getMinecraft(); + + public static void drawHead(EntityPlayer player, float x, float y, float w, float h) { + NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(player.getUniqueID()); + if (playerInfo != null) { + mc.getTextureManager().bindTexture(playerInfo.getLocationSkin()); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Gui.drawScaledCustomSizeModalRect(x, y, 8.0F, 8.0F, 8, 8, w, h, 64.0F, 64.0F); + } + } + + public static void drawLines(AxisAlignedBB boundingBox) { + int i = 3; + GL11.glPushMatrix(); + GL11.glBegin(i); + GL11.glVertex3d(boundingBox.minX, boundingBox.minY, boundingBox.minZ); + GL11.glVertex3d(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); + GL11.glVertex3d(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); + GL11.glVertex3d(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); + GL11.glVertex3d(boundingBox.minX, boundingBox.minY, boundingBox.minZ); + GL11.glEnd(); + GL11.glBegin(i); + GL11.glVertex3d(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); + GL11.glVertex3d(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); + GL11.glVertex3d(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); + GL11.glVertex3d(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); + GL11.glVertex3d(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); + GL11.glEnd(); + GL11.glBegin(1); + GL11.glVertex3d(boundingBox.minX, boundingBox.minY, boundingBox.minZ); + GL11.glVertex3d(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); + GL11.glVertex3d(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); + GL11.glVertex3d(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); + GL11.glVertex3d(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); + GL11.glVertex3d(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); + GL11.glVertex3d(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); + GL11.glVertex3d(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); + GL11.glEnd(); + GL11.glPopMatrix(); + } + + public static void drawBoxFilled(AxisAlignedBB axisAlignedBB) { + GL11.glBegin(7); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ); + GL11.glVertex3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ); + GL11.glVertex3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ); + GL11.glEnd(); + } + + public static void drawPlatform(Entity entity, Color color) { + RenderManager renderManager = mc.getRenderManager(); + Timer timer = mc.timer; + double d = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * timer.renderPartialTicks - renderManager.renderPosX; + double d2 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * timer.renderPartialTicks - renderManager.renderPosY; + double d3 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * timer.renderPartialTicks - renderManager.renderPosZ; + AxisAlignedBB axisAlignedBB = entity.getEntityBoundingBox().offset(-entity.posX, -entity.posY, -entity.posZ).offset(d, d2, d3); + } + + public static void drawCircle(double ballX, double ballY, float radius, int sections, int color) { + double dAngle = 6.283185307179586D / sections; + GL11.glPushAttrib(8192); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glEnable(2848); + GL11.glLineWidth(2.0F); + GL11.glBegin(6); + int i; + for (i = 0; i < sections; i++) { + float x = (float)(radius * Math.sin(i * dAngle)); + float y = (float)(radius * Math.cos(i * dAngle)); + ColorUtils.glColor(color); + GL11.glVertex2d(ballX + x, ballY + y); + } + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnd(); + GL11.glBegin(2); + for (i = 0; i < sections; i++) { + float x = (float)(radius * Math.sin(i * dAngle)); + float y = (float)(radius * Math.cos(i * dAngle)); + ColorUtils.glColor(color); + GL11.glVertex2d(ballX + x, ballY + y); + } + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnd(); + GL11.glPopAttrib(); + } + + public static int getRainbow(int x, int y, float saturation) { + long l = System.currentTimeMillis() - x * 10L - y * 10L; + return Color.HSBtoRGB((float)(l % 6000L) / 6000.0F, saturation, 1.0F); + } + + public static void drawFullCircle(float cx, float cy, float r, int c) { + r *= 2.0F; + cx *= 2.0F; + cy *= 2.0F; + float theta = 0.19634953F; + float p = (float)Math.cos(theta); + float s = (float)Math.sin(theta); + float x = r; + float y = 0.0F; + GLUtils.pre2D(); + GL11.glEnable(2848); + GL11.glHint(3154, 4354); + GL11.glEnable(3024); + GL11.glScalef(0.5F, 0.5F, 0.5F); + ColorUtils.glColorInt(c); + GL11.glBegin(9); + for (int ii = 0; ii < 32; ii++) { + GL11.glVertex2f(x + cx, y + cy); + float t = x; + x = p * x - s * y; + y = s * t + p * y; + } + GL11.glEnd(); + GL11.glScalef(2.0F, 2.0F, 2.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GLUtils.post2D(); + } + + public static void drawGradient(double x, double y, double x2, double y2, int col1, int col2) { + float f = (col1 >> 24 & 0xFF) / 255.0F; + float f1 = (col1 >> 16 & 0xFF) / 255.0F; + float f2 = (col1 >> 8 & 0xFF) / 255.0F; + float f3 = (col1 & 0xFF) / 255.0F; + float f4 = (col2 >> 24 & 0xFF) / 255.0F; + float f5 = (col2 >> 16 & 0xFF) / 255.0F; + float f6 = (col2 >> 8 & 0xFF) / 255.0F; + float f7 = (col2 & 0xFF) / 255.0F; + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glEnable(2848); + GL11.glShadeModel(7425); + GL11.glPushMatrix(); + GL11.glBegin(7); + GL11.glColor4f(f1, f2, f3, f); + GL11.glVertex2d(x2, y); + GL11.glVertex2d(x, y); + GL11.glColor4f(f5, f6, f7, f4); + GL11.glVertex2d(x, y2); + GL11.glVertex2d(x2, y2); + GL11.glEnd(); + GL11.glPopMatrix(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glShadeModel(7424); + } + + public static void drawGradientSideways(double left, double top, double right, double bottom, int col1, int col2) { + float f = (col1 >> 24 & 0xFF) / 255.0F; + float f1 = (col1 >> 16 & 0xFF) / 255.0F; + float f2 = (col1 >> 8 & 0xFF) / 255.0F; + float f3 = (col1 & 0xFF) / 255.0F; + float f4 = (col2 >> 24 & 0xFF) / 255.0F; + float f5 = (col2 >> 16 & 0xFF) / 255.0F; + float f6 = (col2 >> 8 & 0xFF) / 255.0F; + float f7 = (col2 & 0xFF) / 255.0F; + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glEnable(2848); + GL11.glShadeModel(7425); + GL11.glPushMatrix(); + GL11.glBegin(7); + GL11.glColor4f(f1, f2, f3, f); + GL11.glVertex2d(left, top); + GL11.glVertex2d(left, bottom); + GL11.glColor4f(f5, f6, f7, f4); + GL11.glVertex2d(right, bottom); + GL11.glVertex2d(right, top); + GL11.glEnd(); + GL11.glPopMatrix(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glShadeModel(7424); + } + + public static void filledBox(AxisAlignedBB boundingBox, int color, boolean shouldColor) { + GlStateManager.pushMatrix(); + float var11 = (color >> 24 & 0xFF) / 255.0F; + float var6 = (color >> 16 & 0xFF) / 255.0F; + float var7 = (color >> 8 & 0xFF) / 255.0F; + float var8 = (color & 0xFF) / 255.0F; + WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + if (shouldColor) + GlStateManager.color(var6, var7, var8, var11); + byte draw = 7; + worldRenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldRenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ); + worldRenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); + Tessellator.getInstance().draw(); + worldRenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldRenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); + worldRenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); + worldRenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ); + worldRenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); + Tessellator.getInstance().draw(); + worldRenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldRenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); + worldRenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); + Tessellator.getInstance().draw(); + worldRenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldRenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ); + worldRenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); + Tessellator.getInstance().draw(); + worldRenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldRenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ); + worldRenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); + worldRenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); + Tessellator.getInstance().draw(); + worldRenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldRenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); + worldRenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); + worldRenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); + Tessellator.getInstance().draw(); + GlStateManager.depthMask(true); + GlStateManager.popMatrix(); + } + + public static void drawOutlinedBoundingBox1(AxisAlignedBB boundingBox) { + Tessellator var1 = Tessellator.getInstance(); + WorldRenderer var2 = var1.getWorldRenderer(); + var2.begin(3, DefaultVertexFormats.POSITION_COLOR); + var2.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ); + var2.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); + var2.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); + var2.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); + var2.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ); + var1.draw(); + var2.begin(3, DefaultVertexFormats.POSITION_COLOR); + var2.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); + var2.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); + var2.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); + var2.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); + var2.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); + var1.draw(); + var2.begin(1, DefaultVertexFormats.POSITION_COLOR); + var2.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ); + var2.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); + var2.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); + var2.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); + var2.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); + var2.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); + var2.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); + var2.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); + var1.draw(); + } + + public static void drawRect(float x, float y, float x1, float y1) { + GL11.glBegin(7); + GL11.glVertex2f(x, y1); + GL11.glVertex2f(x1, y1); + GL11.glVertex2f(x1, y); + GL11.glVertex2f(x, y); + GL11.glEnd(); + } + + public static void draw2DImage(ResourceLocation image, float x, float y, float width, float height, Color c) { + GL11.glDisable(2929); + GL11.glEnable(3042); + GL11.glDepthMask(false); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glColor4f(c.getRed() / 255.0F, c.getGreen() / 255.0F, c.getBlue() / 255.0F, c.getAlpha()); + Minecraft.getMinecraft().getTextureManager().bindTexture(image); + Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 0.0F, width, height, width, height); + GL11.glDepthMask(true); + GL11.glDisable(3042); + GL11.glEnable(2929); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } +} diff --git a/src/minecraft/animeware/util/misc/Timer.java b/src/minecraft/animeware/util/misc/Timer.java new file mode 100644 index 0000000..3760dd3 --- /dev/null +++ b/src/minecraft/animeware/util/misc/Timer.java @@ -0,0 +1,36 @@ +package animeware.util.misc; + +import net.minecraft.client.Minecraft; + +public class Timer { + + public long lastMS = System.currentTimeMillis(); + + public void reset() { + lastMS = System.currentTimeMillis(); + } + + public boolean hasTimeElapsed(long time, boolean reset) { + if (System.currentTimeMillis() - lastMS > time) { + if (reset) + reset(); + + + return true; + } + + return false; + } + + public long getTime() { + return System.currentTimeMillis() - lastMS; + } + + public void setTime(long time) { + lastMS = time; + } + + public void mcTimeSpeed(double speed) { + Minecraft.getMinecraft().timer.timerSpeed = (float) speed; + } +} diff --git a/src/minecraft/animeware/util/misc/WebhookUtil.java b/src/minecraft/animeware/util/misc/WebhookUtil.java new file mode 100644 index 0000000..41d3afb --- /dev/null +++ b/src/minecraft/animeware/util/misc/WebhookUtil.java @@ -0,0 +1,105 @@ +package animeware.util.misc; + + +import javax.imageio.ImageIO; + +import net.minecraft.client.Minecraft; + +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.*; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class WebhookUtil { + + public static Minecraft mc = Minecraft.getMinecraft(); + + + public static void sendMessage(String message) { + PrintWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try { + URL realUrl = new URL("https://discord.com/api/webhooks/817096267472568361/fb45M-IZIc3B0caOAuRaaBZWrwVQypRq-r_y7qfrEEDB8QDCbPOrByCDRaZ9NWbjbuR4"); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); + conn.setDoOutput(true); + conn.setDoInput(true); + out = new PrintWriter(conn.getOutputStream()); + String postData = URLEncoder.encode("content", "UTF-8") + "=" + URLEncoder.encode(message, "UTF-8"); + out.print(postData); + out.flush(); + in = new BufferedReader(new InputStreamReader(conn.getInputStream())); + String line; + while ((line = in.readLine()) != null) { + result.append("/n").append(line); + } + + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (out != null) { + out.close(); + } + if (in != null) { + in.close(); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } + System.out.println(result.toString()); + } + public static void sendFlag(String message) { + PrintWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try { + URL realUrl = new URL("https://discord.com/api/webhooks/814991711281086495/Z3yrGUHHTgm4ui6tAE5QIizWTE09l26YGebHwEH-0-8Fz-MgrgsYiNJzD0ysIHybgo2g"); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); + conn.setDoOutput(true); + conn.setDoInput(true); + out = new PrintWriter(conn.getOutputStream()); + String postData = URLEncoder.encode("content", "UTF-8") + "=" + URLEncoder.encode(message, "UTF-8"); + out.print(postData); + out.flush(); + in = new BufferedReader(new InputStreamReader(conn.getInputStream())); + String line; + while ((line = in.readLine()) != null) { + result.append("/n").append(line); + } + + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (out != null) { + out.close(); + } + if (in != null) { + in.close(); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } + System.out.println(result.toString()); + } + +} diff --git a/src/minecraft/animeware/util/notification/Notification.java b/src/minecraft/animeware/util/notification/Notification.java new file mode 100644 index 0000000..a3b66f7 --- /dev/null +++ b/src/minecraft/animeware/util/notification/Notification.java @@ -0,0 +1,151 @@ +package animeware.util.notification; + +import java.awt.Color; + +import animeware.NightSky; +import animeware.hud.mod.HudMod; +import animeware.util.font.FontUtil; +import animeware.util.font.MinecraftFontRenderer; +import animeware.util.misc.Timer; +import animeware.util.render.AnimationUtil; +import animeware.util.render.DrawUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class Notification { + private NotificationType type; + private String title; + private String messsage; + private ResourceLocation icon; + private long start; + HudMod m; + + private long fadedIn; + private long fadeOut; + public long end; + + public Timer timer = new Timer(); + + + public Notification(NotificationType type, String title, String messsage, ResourceLocation icon, int length) { + this.type = type; + this.title = title; + this.messsage = messsage; + this.icon = icon; + + timer.reset(); + end = (long) (NightSky.INSTANCE.hudManager.notifs.time.getValue() * 1000); + } + + public void show() { + start = System.currentTimeMillis(); + } + + public boolean isShown() { + return getTime() <= end; + } + + long getTime() { + return System.currentTimeMillis() - start; + } + + public void render(int count) { + Minecraft mc = Minecraft.getMinecraft(); + ScaledResolution sr = new ScaledResolution(mc); + //FontRenderer fr = Monsoon.INSTANCE.getFont(); + MinecraftFontRenderer fr = getSelectedFont(); + int width = 120; + double offset = width; + int height = 0; + long time = getTime(); + float barThickness = 3; + + Color color = new Color(0, 0, 0, 200); + Color color1 = new Color(0, 140, 255); + + if (type == NotificationType.INFO) { + color1 = new Color(255, 255, 255); + } + else if (type == NotificationType.WARNING) + color1 = new Color(255, 255, 0); + else if (type == NotificationType.ERROR) { + color1 = new Color(204, 0, 18); + int i = Math.max(0, Math.min(255, (int) (Math.sin(time / 100.0) * 255.0 / 2 + 127.5))); + color = new Color(i, 0, 0, 220); + } + else if (type == NotificationType.SUCCESS) { + color1 = new Color(0, 200, 200); + } + else if (type == NotificationType.FAIL) { + color1 = new Color(200, 0, 0); + } + + double x = sr.getScaledWidth() - 45 - fr.getStringWidth(messsage), + y = sr.getScaledHeight() - 47 * count + 2, + w = sr.getScaledWidth() - 5, + h = 30; + + float health = timer.getTime(); + double hpPercentage = health / end; + hpPercentage = MathHelper.clamp_double(hpPercentage, 0.0, 1.0); + final double hpWidth = (45 + fr.getStringWidth(messsage)) * hpPercentage; + double progress = AnimationUtil.INSTANCE.animate(hpWidth, 5, end / 1000); + + + //if(!m.getIcon().getResourcePath().equals("")) { + //DrawUtil.draw2DImageDouble(m.getIcon(), x + 5, y + 5, 25, 25, Color.WHITE); + //} + //if(HudMod m : NightSky.INSTANCE.hudManager.hudMods) + + + Gui.drawRect(x, y, w, y + h, color.getRGB()); + + //Gui.drawRect(x + 2, y + 3, x + 24, y + 24, -1); + + Gui.drawRect(x, y + 30, x + progress, y + 28, color1.getRGB()); + + fr.drawStringWithShadow(title,(float) x + 28, (float) y + 5, -1); + fr.drawStringWithShadow(messsage, (float) x + 28, (float) y + 15, -1); + DrawUtil.draw2DImageFloat(icon, (float) x - 1, (float) y - 1, 31, 30, Color.WHITE); + + if (type == NotificationType.INFO) { + + DrawUtil.drawBorderedRoundedRect((float) x +4, (float) y +5, (float) x + 22, (float) y + 22, 19, 2, -1, new Color(0,0,0,0).getRGB()); + //mc.fontRendererObj.drawString("i", x + 12.5f, y + 9.5f, new Color(0,0,0,255).getRGB()); + + } else if (type == NotificationType.WARNING) { + + // DrawUtil.drawRoundedRect((float) x + 2, (float) y + 3, (float) x + 24, (float) y + 24, 19, new Color(255,255,0,255).getRGB()); + //mc.fontRendererObj.drawString("\u26A0", x + 12.5f, y + 9.5f, new Color(255,255,0,255).getRGB()); + + } else if (type == NotificationType.ERROR) { + + //mc.fontRendererObj.drawString("\u26A0", x + 10f, y + 9.5f, new Color(204,0,18,255).getRGB()); + + } else if (type == NotificationType.SUCCESS) { + + //DrawUtil.drawRoundedRect((float) x + 2, (float) y + 3, (float) x + 24, (float) y + 24, 19, new Color(0,255,0,255).getRGB()); + //mc.fontRendererObj.drawString("\u2714", x + 9.5f, y + 9.5f, new Color(0,255,0,255).getRGB()); + + } else if (type == NotificationType.FAIL) { + // DrawUtil.drawRoundedRect((float) x + 2, (float) y + 3, (float) x + 24, (float) y + 24, 19, new Color(255,0,0,255).getRGB()); + //mc.fontRendererObj.drawString("\u2716", x + 9, y + 9, new Color(255,0,0,255).getRGB()); + } + } + + private static MinecraftFontRenderer getSelectedFont() { + switch (NightSky.INSTANCE.hudManager.notifs.font.getMode()) { + case "Monsoon": + return FontUtil.normal; + case "Moon": + return FontUtil.normal; + } + return FontUtil.normal; + } + + + +} diff --git a/src/minecraft/animeware/util/notification/NotificationManager.java b/src/minecraft/animeware/util/notification/NotificationManager.java new file mode 100644 index 0000000..8032753 --- /dev/null +++ b/src/minecraft/animeware/util/notification/NotificationManager.java @@ -0,0 +1,28 @@ +package animeware.util.notification; + + +import java.util.concurrent.LinkedBlockingQueue; + +public class NotificationManager { + public static LinkedBlockingQueue pendingNotifications = new LinkedBlockingQueue<>(); + public static Notification currentNotification = null; + + public static void show(Notification notification) { + pendingNotifications.add(notification); + } + + public static void update() { + pendingNotifications.removeIf(notif -> notif.timer.hasTimeElapsed(notif.end, false)); + } + + public static void render() { + update(); + + int count = 0; + + for(Notification notif : pendingNotifications) { + count++; + notif.render(count); + } + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/notification/NotificationType.java b/src/minecraft/animeware/util/notification/NotificationType.java new file mode 100644 index 0000000..11bb3c4 --- /dev/null +++ b/src/minecraft/animeware/util/notification/NotificationType.java @@ -0,0 +1,5 @@ +package animeware.util.notification; + +public enum NotificationType { + INFO, WARNING, ERROR, SUCCESS, FAIL; +} diff --git a/src/minecraft/animeware/util/render/AnimatedResourceLocation.java b/src/minecraft/animeware/util/render/AnimatedResourceLocation.java new file mode 100644 index 0000000..e3ec84f --- /dev/null +++ b/src/minecraft/animeware/util/render/AnimatedResourceLocation.java @@ -0,0 +1,65 @@ +package animeware.util.render; + +import net.minecraft.util.ResourceLocation; + +public class AnimatedResourceLocation { + + private final String folder; + protected final int frames; + protected final int fpt; + + protected int currentTick = 0; + protected int currentFrame = 0; + + protected ResourceLocation[] textures; + + public AnimatedResourceLocation(String folder, int frames, int fpt) { + this(folder, frames, fpt, false); + } + + public AnimatedResourceLocation(String folder, int frames, int fpt, boolean reverse) { + this.folder = folder; + this.frames = frames; + this.fpt = fpt; + textures = new ResourceLocation[frames]; + + for(int i = 0; i < frames; i++) { + if(reverse) { + textures[i] = new ResourceLocation(folder + "/" + (textures.length - i) + ".png"); + } + else { + textures[i] = new ResourceLocation(folder + "/" + i + ".png"); + } + } + + } + + + public ResourceLocation getTexture() { + return textures[currentFrame]; + } + + public int getCurrentFrame() { + return currentFrame; + } + + public void update() { + if(currentTick > fpt) { + currentTick = 0; + currentFrame++; + if(currentFrame > frames - 1) { + currentFrame = 0; + } + } + currentTick++; + } + + public void setCurrentFrame(int currentFrame) { + this.currentFrame = currentFrame; + } + + public int getFrames() { + return frames; + } + +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/render/AnimationUtil.java b/src/minecraft/animeware/util/render/AnimationUtil.java new file mode 100644 index 0000000..2d487c1 --- /dev/null +++ b/src/minecraft/animeware/util/render/AnimationUtil.java @@ -0,0 +1,57 @@ +package animeware.util.render; + +public enum AnimationUtil { + + INSTANCE; + + public float calculateCompensation(float target, float current, long delta, int speed) { + float diff = current - target; + if (delta < 1L) { + delta = 1L; + } + + double xD; + if (diff > (float) speed) { + xD = (double) ((long) speed * delta / 16L) < 0.25D ? 0.5D : (double) ((long) speed * delta / 16L); + current = (float) ((double) current - xD); + if (current < target) { + current = target; + } + } else if (diff < (float) (-speed)) { + xD = (double) ((long) speed * delta / 16L) < 0.25D ? 0.5D : (double) ((long) speed * delta / 16L); + current = (float) ((double) current + xD); + if (current > target) { + current = target; + } + } else { + current = target; + } + + return current; + } + + public double animate(final double target, double current, double speed) { + final boolean larger = target > current; + if (speed < 0.0) { + speed = 0.0; + } else if (speed > 1.0) { + speed = 1.0; + } + final double dif = Math.max(target, current) - Math.min(target, current); + double factor = dif * speed; + if (factor < 0.1) { + factor = 0.1; + } + if (larger) { + current += factor; + } else { + current -= factor; + } + return current; + } + + public float value(long startTime) { + return Math.min(1.0F, (float) Math.pow((double) (System.currentTimeMillis() - startTime) / 10.0D, 1.4D) / 80.0F); + } + +} diff --git a/src/minecraft/animeware/util/render/ChromaText.java b/src/minecraft/animeware/util/render/ChromaText.java new file mode 100644 index 0000000..bf72926 --- /dev/null +++ b/src/minecraft/animeware/util/render/ChromaText.java @@ -0,0 +1,22 @@ +/* */ package animeware.util.render; +/* */ +/* */ import java.awt.Color; +/* */ import net.minecraft.client.Minecraft; +/* */ +/* */ +/* */ public class ChromaText +/* */ { +/* */ public static void drawChromaString(String string, int x, int y, boolean shadow) { +/* 10 */ Minecraft mc = Minecraft.getMinecraft(); +/* */ +/* 12 */ int xTmp = x; byte b; int i; char[] arrayOfChar; +/* 13 */ for (i = (arrayOfChar = string.toCharArray()).length, b = 0; b < i; ) { char textChar = arrayOfChar[b]; +/* 14 */ long l = System.currentTimeMillis() - (xTmp * 10 - y * 10); +/* 15 */ int j = Color.HSBtoRGB((float)(l % 2000L) / 2000.0F, 0.8F, 0.8F); +/* 16 */ String tmp = String.valueOf(textChar); +/* 17 */ mc.fontRendererObj.drawString(tmp, xTmp, y, j, shadow); +/* 18 */ xTmp += mc.fontRendererObj.getCharWidth(textChar); +/* */ b++; } +/* */ +/* */ } +/* */ } diff --git a/src/minecraft/animeware/util/render/ColorMode.java b/src/minecraft/animeware/util/render/ColorMode.java new file mode 100644 index 0000000..c522fed --- /dev/null +++ b/src/minecraft/animeware/util/render/ColorMode.java @@ -0,0 +1,74 @@ +package animeware.util.render; + +import java.awt.Color; + +public class ColorMode { + + public static boolean mode = false; + + public static boolean getMode() { + return mode; + } + + public static void setMode(boolean mode) { + ColorMode.mode = mode; + } + + public static void toggleMode() { + setMode(!mode); + } + + public static int getBgColor() { + if(mode) { + return new Color(90, 90, 90, 180).getRGB(); + } + if(!mode) { + return new Color(0, 0, 0, 150).getRGB(); + } else { + return -1; + } + } + public static int getModColor() { + if(mode) { + return new Color(111, 111, 111, 255).getRGB(); + } + if(!mode) { + return new Color(0, 0, 0, 255).getRGB(); + } else { + return -1; + } + } + public static int getClickGuiColor() { + return new Color(25, 25, 25, 255).getRGB(); + } + public static int getClickGuiInnerColor() { + return new Color(50, 50, 50, 255).getRGB(); + } + public static int getClickGuiMidColor() { + return new Color(35, 35, 35, 255).getRGB(); + } + public static int getLoginColor() { + return new Color(0, 0, 0, 70).getRGB(); + } + public static int getWhiteColor() { + return new Color(255, 255, 255, 255).getRGB(); + } + public static int getRedColor() { + return new Color(200, 0, 0, 0).getRGB(); + } + public static int getBGColor() { + return new Color(200, 200, 200, 100).getRGB(); + } + public static int getDarkColor() { + return new Color(0, 0, 0, 170).getRGB(); + } + public static int getMidDarkColor() { + return new Color(0, 0, 0, 80).getRGB(); + } + public static int getSettingButtonAqua() { + return new Color(0, 200, 230, 255).getRGB(); + } + public static int getSettingButtonAquaInside() { + return new Color(0, 140, 180, 255).getRGB(); + } +} diff --git a/src/minecraft/animeware/util/render/ColorUtil.java b/src/minecraft/animeware/util/render/ColorUtil.java new file mode 100644 index 0000000..1502ea8 --- /dev/null +++ b/src/minecraft/animeware/util/render/ColorUtil.java @@ -0,0 +1,260 @@ +package animeware.util.render; + +import java.awt.Color; +import java.awt.image.BufferedImage; + +import animeware.util.MathUtils; + +public class ColorUtil { + + public static int getRainbow(float seconds, float saturation, float brightness) { + float hue = (System.currentTimeMillis() % (int)(seconds * 1000)) / (float)(seconds * 4000f); + int color = Color.HSBtoRGB(hue, saturation, brightness); + return color; + } + + public static int getRGB(float seconds, float saturation, float brightness, long index) { + float hue = ((System.currentTimeMillis() + index) % (int)(seconds * 1000)) / (float)(seconds * 1000); + int color = Color.HSBtoRGB(hue, saturation, brightness); + return color; + } + + public static Color astolfo(int index, int speed, float saturation, float brightness, float opacity) { + int angle = (int) ((System.currentTimeMillis() / speed + index) % 360); + angle = (angle > 180 ? 360 - angle : angle) + 180; + float hue = angle / 360f; + + int color = Color.HSBtoRGB(brightness, saturation, hue); + Color obj = new Color(color); + return new Color(obj.getRed(), obj.getGreen(), obj.getBlue(), Math.max(0, Math.min(255, (int) (opacity * 255)))); + } + public static Color interpolateColorC(Color color1, Color color2, float amount) { + amount = Math.min(1, Math.max(0, amount)); + return new Color(MathUtils.interpolateInt(color1.getRed(), color2.getRed(), amount), + MathUtils.interpolateInt(color1.getGreen(), color2.getGreen(), amount), + MathUtils.interpolateInt(color1.getBlue(), color2.getBlue(), amount), + MathUtils.interpolateInt(color1.getAlpha(), color2.getAlpha(), amount)); + } + public static Color interpolateColorsBackAndForth(int speed, int index, Color start, Color end, boolean trueColor) { + int angle = (int) (((System.currentTimeMillis()) / speed + index) % 360); + angle = (angle >= 180 ? 360 - angle : angle) * 2; + return trueColor ? ColorUtil.interpolateColorHue(start, end, angle / 360f) : ColorUtil.interpolateColorC(start, end, angle / 360f); + } + public static Color interpolateColorHue(Color color1, Color color2, float amount) { + amount = Math.min(1, Math.max(0, amount)); + + float[] color1HSB = Color.RGBtoHSB(color1.getRed(), color1.getGreen(), color1.getBlue(), null); + float[] color2HSB = Color.RGBtoHSB(color2.getRed(), color2.getGreen(), color2.getBlue(), null); + + Color resultColor = Color.getHSBColor(MathUtils.interpolateFloat(color1HSB[0], color2HSB[0], amount), + MathUtils.interpolateFloat(color1HSB[1], color2HSB[1], amount), MathUtils.interpolateFloat(color1HSB[2], color2HSB[2], amount)); + + return new Color(resultColor.getRed(), resultColor.getGreen(), resultColor.getBlue(), + MathUtils.interpolateInt(color1.getAlpha(), color2.getAlpha(), amount)); + } + public static Color[] getAnalogousColor(Color color) { + Color[] colors = new Color[2]; + float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null); + + float degree = 30 / 360f; + + float newHueAdded = hsb[0] + degree; + colors[0] = new Color(Color.HSBtoRGB(newHueAdded, hsb[1], hsb[2])); + + float newHueSubtracted = hsb[0] - degree; + + colors[1] = new Color(Color.HSBtoRGB(newHueSubtracted, hsb[1], hsb[2])); + + return colors; + } + + + //RGB TO HSL AND HSL TO RGB FOUND HERE: https://gist.github.com/mjackson/5311256 + public static Color hslToRGB(float[] hsl) { + float red, green, blue; + + if (hsl[1] == 0) { + red = green = blue = 1; + } else { + float q = hsl[2] < .5 ? hsl[2] * (1 + hsl[1]) : hsl[2] + hsl[1] - hsl[2] * hsl[1]; + float p = 2 * hsl[2] - q; + + red = hueToRGB(p, q, hsl[0] + 1 / 3f); + green = hueToRGB(p, q, hsl[0]); + blue = hueToRGB(p, q, hsl[0] - 1 / 3f); + } + + red *= 255; + green *= 255; + blue *= 255; + + return new Color((int) red, (int) green, (int) blue); + } + + + public static float hueToRGB(float p, float q, float t) { + float newT = t; + if (newT < 0) newT += 1; + if (newT > 1) newT -= 1; + if (newT < 1 / 6f) return p + (q - p) * 6 * newT; + if (newT < .5f) return q; + if (newT < 2 / 3f) return p + (q - p) * (2 / 3f - newT) * 6; + return p; + } + + public static float[] rgbToHSL(Color rgb) { + float red = rgb.getRed() / 255f; + float green = rgb.getGreen() / 255f; + float blue = rgb.getBlue() / 255f; + + float max = Math.max(Math.max(red, green), blue); + float min = Math.min(Math.min(red, green), blue); + float c = (max + min) / 2f; + float[] hsl = new float[]{c, c, c}; + + if (max == min) { + hsl[0] = hsl[1] = 0; + } else { + float d = max - min; + hsl[1] = hsl[2] > .5 ? d / (2 - max - min) : d / (max + min); + + if (max == red) { + hsl[0] = (green - blue) / d + (green < blue ? 6 : 0); + } else if (max == blue) { + hsl[0] = (blue - red) / d + 2; + } else if (max == green) { + hsl[0] = (red - green) / d + 4; + } + hsl[0] /= 6; + } + return hsl; + } + + + public static Color imitateTransparency(Color backgroundColor, Color accentColor, float percentage) { + return new Color(ColorUtil.interpolateColor(backgroundColor, accentColor, (255 * percentage) / 255)); + } + + public static int applyOpacity(int color, float opacity) { + Color old = new Color(color); + return applyOpacity(old, opacity).getRGB(); + } + + //Opacity value ranges from 0-1 + public static Color applyOpacity(Color color, float opacity) { + opacity = Math.min(1, Math.max(0, opacity)); + return new Color(color.getRed(), color.getGreen(), color.getBlue(), (int) (color.getAlpha() * opacity)); + } + + public static Color darker(Color color, float FACTOR) { + return new Color(Math.max((int) (color.getRed() * FACTOR), 0), + Math.max((int) (color.getGreen() * FACTOR), 0), + Math.max((int) (color.getBlue() * FACTOR), 0), + color.getAlpha()); + } + + public static Color brighter(Color color, float FACTOR) { + int r = color.getRed(); + int g = color.getGreen(); + int b = color.getBlue(); + int alpha = color.getAlpha(); + + /* From 2D group: + * 1. black.brighter() should return grey + * 2. applying brighter to blue will always return blue, brighter + * 3. non pure color (non zero rgb) will eventually return white + */ + int i = (int) (1.0 / (1.0 - FACTOR)); + if (r == 0 && g == 0 && b == 0) { + return new Color(i, i, i, alpha); + } + if (r > 0 && r < i) r = i; + if (g > 0 && g < i) g = i; + if (b > 0 && b < i) b = i; + + return new Color(Math.min((int) (r / FACTOR), 255), + Math.min((int) (g / FACTOR), 255), + Math.min((int) (b / FACTOR), 255), + alpha); + } + + /** + * This method gets the average color of an image + * performance of this goes as O((width * height) / step) + */ + public static Color averageColor(BufferedImage bi, int width, int height, int pixelStep) { + int[] color = new int[3]; + for (int x = 0; x < width; x += pixelStep) { + for (int y = 0; y < height; y += pixelStep) { + Color pixel = new Color(bi.getRGB(x, y)); + color[0] += pixel.getRed(); + color[1] += pixel.getGreen(); + color[2] += pixel.getBlue(); + } + } + int num = (width * height) / (pixelStep * pixelStep); + return new Color(color[0] / num, color[1] / num, color[2] / num); + } + + public static Color rainbow(int speed, int index, float saturation, float brightness, float opacity) { + int angle = (int) ((System.currentTimeMillis() / speed + index) % 360); + float hue = angle / 360f; + Color color = new Color(Color.HSBtoRGB(hue, saturation, brightness)); + return new Color(color.getRed(), color.getGreen(), color.getBlue(), Math.max(0, Math.min(255, (int) (opacity * 255)))); + } + + + + //The next few methods are for interpolating colors + public static int interpolateColor(Color color1, Color color2, float amount) { + amount = Math.min(1, Math.max(0, amount)); + return interpolateColorC(color1, color2, amount).getRGB(); + } + + public static int interpolateColor(int color1, int color2, float amount) { + amount = Math.min(1, Math.max(0, amount)); + Color cColor1 = new Color(color1); + Color cColor2 = new Color(color2); + return interpolateColorC(cColor1, cColor2, amount).getRGB(); + } + + + + + //Fade a color in and out with a specified alpha value ranging from 0-1 + public static Color fade(int speed, int index, Color color, float alpha) { + float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null); + int angle = (int) ((System.currentTimeMillis() / speed + index) % 360); + angle = (angle > 180 ? 360 - angle : angle) + 180; + + Color colorHSB = new Color(Color.HSBtoRGB(hsb[0], hsb[1], angle / 360f)); + + return new Color(colorHSB.getRed(), colorHSB.getGreen(), colorHSB.getBlue(), Math.max(0, Math.min(255, (int) (alpha * 255)))); + } + + + private static float getAnimationEquation(int index, int speed) { + int angle = (int) ((System.currentTimeMillis() / speed + index) % 360); + return ((angle > 180 ? 360 - angle : angle) + 180) / 360f; + } + + public static int[] createColorArray(int color) { + return new int[]{bitChangeColor(color, 16), bitChangeColor(color, 8), bitChangeColor(color, 0), bitChangeColor(color, 24)}; + } + + public static int getOppositeColor(int color) { + int R = bitChangeColor(color, 0); + int G = bitChangeColor(color, 8); + int B = bitChangeColor(color, 16); + int A = bitChangeColor(color, 24); + R = 255 - R; + G = 255 - G; + B = 255 - B; + return R + (G << 8) + (B << 16) + (A << 24); + } + + private static int bitChangeColor(int color, int bitChange) { + return (color >> bitChange) & 255; + } + +} diff --git a/src/minecraft/animeware/util/render/ColorUtils.java b/src/minecraft/animeware/util/render/ColorUtils.java new file mode 100644 index 0000000..3c4810b --- /dev/null +++ b/src/minecraft/animeware/util/render/ColorUtils.java @@ -0,0 +1,126 @@ +package animeware.util.render; + +import java.awt.Color; +import java.util.concurrent.atomic.AtomicInteger; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import org.lwjgl.opengl.GL11; + +public class ColorUtils { + static Minecraft mc = Minecraft.getMinecraft(); + + static FontRenderer fr = mc.fontRendererObj; + + public static void glColor(int hex) { + float alpha = (hex >> 24 & 0xFF) / 255.0F; + float red = (hex >> 16 & 0xFF) / 255.0F; + float green = (hex >> 8 & 0xFF) / 255.0F; + float blue = (hex & 0xFF) / 255.0F; + GL11.glColor4f(red, green, blue, alpha); + } + + public static Color getColor(int red, int green, int blue, int alpha) { + int color = 0; + color |= alpha << 24; + color |= red << 16; + color |= green << 8; + color |= blue; + return new Color(red, green, blue, alpha); + } + + public static int astolfoColors(int yOffset, int yTotal) { + float speed = 2900.0F; + float hue = (float)(System.currentTimeMillis() % (int)speed) + ((yTotal - yOffset) * 9); + while (hue > speed) + hue -= speed; + hue /= speed; + if (hue > 0.5D) + hue = 0.5F - hue - 0.5F; + hue += 0.5F; + return Color.HSBtoRGB(hue, 0.5F, 1.0F); + } + + public static int astolfoColors(int yOffset, int yTotal, long index) { + float speed = 10000.0F; + float hue = (float)((System.currentTimeMillis() + index) % (int)speed) + ((yTotal - yOffset) * 9); + while (hue > speed) + hue -= speed; + hue /= speed; + if (hue > 0.5D) + hue = 0.5F - hue - 0.5F; + hue += 0.5F; + return Color.HSBtoRGB(hue, 0.6F, 1.0F); + } + + public static int rainbowWawe(int delay) { + AtomicInteger ColorIndex = new AtomicInteger(); + int clrd = ColorIndex.get() / delay; + ColorIndex.getAndIncrement(); + return rainbowColor(clrd); + } + + public static int rainbowStatic(int delay) { + return rainbowColor(delay); + } + + public static int rainbowColor(int delay) { + double rainbowState = Math.ceil(((System.currentTimeMillis() + delay) / 10L)); + rainbowState %= 360.0D; + return Color.getHSBColor((float)(rainbowState / 360.0D), 1.0F, 1.0F).getRGB(); + } + + public static Color rainbowColor2(int delay) { + double rainbowState = Math.ceil(((System.currentTimeMillis() + delay) / 40L)); + rainbowState %= 360.0D; + return Color.getHSBColor((float)(rainbowState / 360.0D), 1.0F, 1.0F); + } + + public static void glColor(Color color) { + GL11.glColor4f(color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F, color.getAlpha() / 255.0F); + } + + public static void glColorInt(int hex) { + float alpha = (hex >> 24 & 0xFF) / 255.0F; + float red = (hex >> 16 & 0xFF) / 255.0F; + float green = (hex >> 8 & 0xFF) / 255.0F; + float blue = (hex & 0xFF) / 255.0F; + GL11.glColor4f(red, green, blue, alpha); + } + + public static Color transition(Color c1, Color c2, double prog) { + double progress = (prog > 1.0D) ? 1.0D : ((prog < 0.0D) ? 0.0D : prog); + int redDiff = c1.getRed() - c2.getRed(); + int greenDiff = c1.getGreen() - c2.getGreen(); + int blueDiff = c1.getBlue() - c2.getBlue(); + int alphaDiff = c1.getAlpha() - c2.getAlpha(); + int newRed = (int)(c2.getRed() + redDiff * progress); + int newGreen = (int)(c2.getGreen() + greenDiff * progress); + int newBlue = (int)(c2.getBlue() + blueDiff * progress); + int newAlpha = (int)(c2.getAlpha() + alphaDiff * progress); + return new Color(newRed, newGreen, newBlue, newAlpha); + } + + public static Color getColorFromInt(int col1) { + float f = (col1 >> 24 & 0xFF) / 255.0F; + float f1 = (col1 >> 16 & 0xFF) / 255.0F; + float f2 = (col1 >> 8 & 0xFF) / 255.0F; + return new Color(f, f1, f2); + } + + public static void drawChromaString(String string, int x, int y, boolean shadow) { + Minecraft mc = Minecraft.getMinecraft(); + int xTmp = x; + byte b; + int i; + char[] arrayOfChar; + for (i = (arrayOfChar = string.toCharArray()).length, b = 0; b < i; ) { + char textChar = arrayOfChar[b]; + long l = System.currentTimeMillis() - (xTmp * 10 - y * 10); + int j = Color.HSBtoRGB((float)(l % 2000L) / 2000.0F, 0.8F, 0.8F); + String tmp = String.valueOf(textChar); + mc.fontRendererObj.drawString(tmp, xTmp, y, j, shadow); + xTmp += mc.fontRendererObj.getCharWidth(textChar); + b++; + } + } +} diff --git a/src/minecraft/animeware/util/render/DrawUtil.java b/src/minecraft/animeware/util/render/DrawUtil.java new file mode 100644 index 0000000..f930a49 --- /dev/null +++ b/src/minecraft/animeware/util/render/DrawUtil.java @@ -0,0 +1,167 @@ +package animeware.util.render; + +import org.lwjgl.opengl.GL11; +import java.awt.Color; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ResourceLocation; + +public class DrawUtil extends GuiScreen { + + public static DrawUtil instance = new DrawUtil(); + public static void drawRoundedRect(double x, double y, double x1, double y1, double radius, int color) { + GL11.glPushAttrib(0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x *= 2.0D; + y *= 2.0D; + x1 *= 2.0D; + y1 *= 2.0D; + GL11.glEnable(3042); + GL11.glDisable(3553); + setColor(color); + GL11.glEnable(2848); + GL11.glBegin(9); + int i; + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + } + + public static void drawBorderedRoundedRect(float x, float y, float x1, float y1, float borderSize, int borderC, int insideC) { + drawRoundedRect(x, y, x1, y1, borderSize, borderC); + drawRoundedRect((x + 0.5F), (y + 0.5F), (x1 - 0.5F), (y1 - 0.5F), borderSize, insideC); + } + + public static void drawBorderedRoundedRect(float x, float y, float x1, float y1, float radius, float borderSize, int borderC, int insideC) { + drawRoundedRect(x, y, x1, y1, radius, borderC); + drawRoundedRect((x + borderSize), (y + borderSize), (x1 - borderSize), (y1 - borderSize), radius, insideC); + } + + public static void setColor(int color) { + float a = (color >> 24 & 0xFF) / 255.0F; + float r = (color >> 16 & 0xFF) / 255.0F; + float g = (color >> 8 & 0xFF) / 255.0F; + float b = (color & 0xFF) / 255.0F; + GL11.glColor4f(r, g, b, a); + } + + public static void drawEntityOnScreen(int posX, int posY, int scale, float rotation, EntityLivingBase ent) + { + float rY = ent.rotationYaw % 360; + float rYH = ent.rotationYawHead % 360; + float rYO = ent.renderYawOffset; + ent.rotationYawHead = rotation + rYH - rYO; + ent.rotationYaw = rotation; + ent.renderYawOffset = rotation; + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)posX, (float)posY, 50.0F); + GlStateManager.scale((float)(-scale), (float)scale, (float)scale); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.0F, 0.0F, 0.0F); + RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); + rendermanager.setPlayerViewY(180.0F); + rendermanager.setRenderShadow(false); + rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + rendermanager.setRenderShadow(true); + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + ent.rotationYaw = rY; + ent.rotationYawHead = rYH; + ent.renderYawOffset = rYO; + } + + public void drawPlayerHead(int x, int y, int width) { + GlStateManager.pushMatrix(); + float scale = width / 32; + GlStateManager.scale(scale, scale, scale); + Minecraft.getMinecraft().getTextureManager().bindTexture(Minecraft.getMinecraft().thePlayer.getLocationSkin()); + GL11.glEnable(GL11.GL_BLEND); + this.drawTexturedModalRect(x / scale, y / scale, 32, 32, 32, 32); + GL11.glDisable(GL11.GL_BLEND); + GlStateManager.popMatrix(); + } + public static void draw2DImageColor(ResourceLocation image, int x, int y, int width, int height, int i) { + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDepthMask(false); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + //GL11.glColor4f(i.getRed() / 255f, i.getGreen() / 255f, i.getBlue() / 255f, i.getAlpha()); + Minecraft.getMinecraft().getTextureManager().bindTexture(image); + Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 0.0F, width, height, width, height); + GL11.glDepthMask(true); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + public static void draw2DImage(ResourceLocation image, int x, int y, int width, int height, Color c) { + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDepthMask(false); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glColor4f(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, c.getAlpha()); + Minecraft.getMinecraft().getTextureManager().bindTexture(image); + Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 0.0F, width, height, width, height); + GL11.glDepthMask(true); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + } + public static void draw2DImageFloat(ResourceLocation image, float f, float g, int width, int height, Color c) { + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDepthMask(false); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glColor4f(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, c.getAlpha()); + Minecraft.getMinecraft().getTextureManager().bindTexture(image); + Gui.drawModalRectWithCustomSizedTexture(f, g, 0.0F, 0.0F, width, height, width, height); + GL11.glDepthMask(true); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + +public static void draw2DImageDouble(ResourceLocation image, double x, double y, int width, int height, Color c) { + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDepthMask(false); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glColor4f(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, c.getAlpha()); + Minecraft.getMinecraft().getTextureManager().bindTexture(image); + Gui.drawModalRectWithCustomSizedTextureDouble(x, y, 0.0F, 0.0F, width, height, width, height); + GL11.glDepthMask(true); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + +} + +} diff --git a/src/minecraft/animeware/util/render/GLUtils.java b/src/minecraft/animeware/util/render/GLUtils.java new file mode 100644 index 0000000..fb55bb4 --- /dev/null +++ b/src/minecraft/animeware/util/render/GLUtils.java @@ -0,0 +1,73 @@ +package animeware.util.render; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; + +import org.lwjgl.opengl.GL11; +import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; + +public class GLUtils { + public static void pre2D() { + GL11.glDisable(2929); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glDepthMask(true); + GL11.glEnable(2848); + GL11.glHint(3154, 4354); + GL11.glHint(3155, 4354); + } + + public static void post2D() { + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glEnable(2929); + GL11.glDisable(2848); + GL11.glHint(3154, 4352); + GL11.glHint(3155, 4352); + } + + public static void pre3D() { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 771); + GL11.glShadeModel(7425); + GL11.glDisable(3553); + GL11.glEnable(2848); + GL11.glDisable(2929); + GL11.glDisable(2896); + GL11.glDepthMask(false); + GL11.glHint(3154, 4354); + } + + public static void post3D() { + GL11.glDepthMask(true); + GL11.glEnable(2929); + GL11.glDisable(2848); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + public static void makeScissorBox(float x, float y, float x2, float y2) { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + int factor = scaledResolution.getScaleFactor(); + GL11.glScissor((int)(x * factor), (int)((scaledResolution.getScaledHeight() - y2) * factor), (int)((x2 - x) * factor), (int)((y2 - y) * factor)); + } + public static void render(int mode, Runnable render){ + glBegin(mode); + render.run(); + glEnd(); + } + public static void setup2DRendering(Runnable f) { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glDisable(GL_TEXTURE_2D); + f.run(); + glEnable(GL_TEXTURE_2D); + GlStateManager.disableBlend(); + } +} diff --git a/src/minecraft/animeware/util/render/GradientUtil.java b/src/minecraft/animeware/util/render/GradientUtil.java new file mode 100644 index 0000000..bb4a87a --- /dev/null +++ b/src/minecraft/animeware/util/render/GradientUtil.java @@ -0,0 +1,98 @@ +package animeware.util.render; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; + +public class GradientUtil implements Utils { + + private static final ShaderUtil gradientMaskShader = new ShaderUtil("Tenacity/Shaders/gradientMask.frag"); + private static final ShaderUtil gradientShader = new ShaderUtil("Tenacity/Shaders/gradient.frag"); + + + + public static void drawGradient(float x, float y, float width, float height, float alpha, Color bottomLeft, Color topLeft, Color bottomRight, Color topRight) { + ScaledResolution sr = new ScaledResolution(mc); + + RenderUtil.resetColor(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + gradientShader.init(); + gradientShader.setUniformf("location", x * sr.getScaleFactor(), (Minecraft.getMinecraft().displayHeight - (height * sr.getScaleFactor())) - (y * sr.getScaleFactor())); + gradientShader.setUniformf("rectSize", width * sr.getScaleFactor(), height * sr.getScaleFactor()); + gradientShader.setUniformf("alpha", alpha); + // Bottom Left + gradientShader.setUniformf("color1", bottomLeft.getRed() / 255f, bottomLeft.getGreen() / 255f, bottomLeft.getBlue() / 255f); + //Top left + gradientShader.setUniformf("color2", topLeft.getRed() / 255f, topLeft.getGreen() / 255f, topLeft.getBlue() / 255f); + //Bottom Right + gradientShader.setUniformf("color3", bottomRight.getRed() / 255f, bottomRight.getGreen() / 255f, bottomRight.getBlue() / 255f); + //Top Right + gradientShader.setUniformf("color4", topRight.getRed() / 255f, topRight.getGreen() / 255f, topRight.getBlue() / 255f); + + //Apply the gradient to whatever is put here + ShaderUtil.drawQuads(x, y, width, height); + + gradientShader.unload(); + GlStateManager.disableBlend(); + } + + public static void drawGradientLR(float x, float y, float width, float height, float alpha, Color left, Color right) { + drawGradient(x, y, width, height, alpha, left, left, right, right); + } + + public static void drawGradientTB(float x, float y, float width, float height, float alpha, Color top, Color bottom) { + drawGradient(x, y, width, height, alpha, bottom, top, bottom, top); + } + + + public static void applyGradientHorizontal(float x, float y, float width, float height, float alpha, Color left, Color right, Runnable content) { + applyGradient(x, y, width, height, alpha, left, left, right, right, content); + } + + public static void applyGradientVertical(float x, float y, float width, float height, float alpha, Color top, Color bottom, Runnable content) { + applyGradient(x, y, width, height, alpha, bottom, top, bottom, top, content); + } + + + public static void applyGradientCornerRL(float x, float y, float width, float height, float alpha, Color bottomLeft, Color topRight, Runnable content) { + Color mixedColor = ColorUtil.interpolateColorC(topRight, bottomLeft, .5f); + applyGradient(x, y, width, height, alpha, bottomLeft, mixedColor, mixedColor, topRight, content); + } + + public static void applyGradient(float x, float y, float width, float height, float alpha, Color bottomLeft, Color topLeft, Color bottomRight, Color topRight, Runnable content) { + RenderUtil.resetColor(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + gradientMaskShader.init(); + + ScaledResolution sr = new ScaledResolution(mc); + + gradientMaskShader.setUniformf("location", x * sr.getScaleFactor(), (Minecraft.getMinecraft().displayHeight - (height * sr.getScaleFactor())) - (y * sr.getScaleFactor())); + gradientMaskShader.setUniformf("rectSize", width * sr.getScaleFactor(), height * sr.getScaleFactor()); + gradientMaskShader.setUniformf("alpha", alpha); + gradientMaskShader.setUniformi("tex", 0); + // Bottom Left + gradientMaskShader.setUniformf("color1", bottomLeft.getRed() / 255f, bottomLeft.getGreen() / 255f, bottomLeft.getBlue() / 255f); + //Top left + gradientMaskShader.setUniformf("color2", topLeft.getRed() / 255f, topLeft.getGreen() / 255f, topLeft.getBlue() / 255f); + //Bottom Right + gradientMaskShader.setUniformf("color3", bottomRight.getRed() / 255f, bottomRight.getGreen() / 255f, bottomRight.getBlue() / 255f); + //Top Right + gradientMaskShader.setUniformf("color4", topRight.getRed() / 255f, topRight.getGreen() / 255f, topRight.getBlue() / 255f); + + //Apply the gradient to whatever is put here + content.run(); + + gradientMaskShader.unload(); + GlStateManager.disableBlend(); + + } + + +} diff --git a/src/minecraft/animeware/util/render/GuiUtils.java b/src/minecraft/animeware/util/render/GuiUtils.java new file mode 100644 index 0000000..40d0865 --- /dev/null +++ b/src/minecraft/animeware/util/render/GuiUtils.java @@ -0,0 +1,469 @@ +package animeware.util.render; + +import java.awt.Color; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.SimpleTexture; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class GuiUtils { + static final Minecraft mc = Minecraft.getMinecraft(); + + static final FontRenderer fr = mc.fontRendererObj; + + public static Color brandingForegroundColor = new Color(255, 255, 255, 30), + brandingForegroundOutline = new Color(255, 255, 255, 150), + brandingBackgroundColor = new Color(0, 0, 0, 100), + brandingSecondBackgroundColor =new Color(175, 175, 175, 26), + brandingIconColor = new Color(255, 255, 255, 150), + + brandingEnabledColor = new Color(101, 220, 138, 200), + brandingDisabledColor = new Color(248, 92, 92, 200); + + public static void drawChromaString(String string, int x, int y, boolean shadow) { + int xTmp = x; + for (char textChar : string.toCharArray()) { + long l = System.currentTimeMillis() - (xTmp * 10 - y * 10); + int i = Color.HSBtoRGB((float)(l % 2000L) / 2000.0F, 0.8F, 0.8F); + String tmp = String.valueOf(textChar); + mc.fontRendererObj.drawString(tmp, xTmp, y, i, shadow); + xTmp += mc.fontRendererObj.getCharWidth(textChar); + } + } + + public static int chromaColor() { + int i = Color.HSBtoRGB((float)(System.currentTimeMillis() % 2000L) / 2000.0F, 0.8F, 0.8F); + return i; + } + + + + + + + + public static void enableGL2D() { + GL11.glDisable(2929); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glDepthMask(true); + GL11.glEnable(2848); + GL11.glHint(3154, 4354); + GL11.glHint(3155, 4354); + } + + public static void disableGL2D() { + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glEnable(2929); + GL11.glDisable(2848); + GL11.glHint(3154, 4352); + GL11.glHint(3155, 4352); + } + + public static void bindTexture(ResourceLocation resourceLocation) { + ITextureObject texture = Minecraft.getMinecraft().getTextureManager().getTexture(resourceLocation); + if (texture == null) { + texture = new SimpleTexture(resourceLocation); + Minecraft.getMinecraft().getTextureManager().loadTexture(resourceLocation, texture); + } + GL11.glBindTexture(3553, texture.getGlTextureId()); + } + + public static void drawTexture(ResourceLocation resourceLocation, float x, float y, float width, float height) { + GL11.glPushMatrix(); + float size = width / 2.0f; + GL11.glEnable(3042); + GL11.glEnable(3553); + GL11.glEnable(2848); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + GuiUtils.bindTexture(resourceLocation); + GL11.glBegin(7); + GL11.glTexCoord2d(0.0f / size, 0.0f / size); + GL11.glVertex2d(x, y); + GL11.glTexCoord2d(0.0f / size, (0.0f + size) / size); + GL11.glVertex2d(x, y + height); + GL11.glTexCoord2d((0.0f + size) / size, (0.0f + size) / size); + GL11.glVertex2d(x + width, y + height); + GL11.glTexCoord2d((0.0f + size) / size, 0.0f / size); + GL11.glVertex2d(x + width, y); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + + public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) { + GL11.glPushAttrib(0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x = (float)(x * 2.0D); + y = (float)(y * 2.0D); + x1 = (float)(x1 * 2.0D); + y1 = (float)(y1 * 2.0D); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glEnable(2848); + setColor(color); + GL11.glEnable(2848); + GL11.glBegin(9); + int i; + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius); + GL11.glEnd(); + GL11.glBegin(2); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + } + + public static void drawRoundedRect(float x, float y, float x1, float y1, float radius, int color) { + GL11.glPushAttrib(0); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x = (float)(x * 2.0D); + y = (float)(y * 2.0D); + x1 = (float)(x1 * 2.0D); + y1 = (float)(y1 * 2.0D); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glEnable(2848); + setColor(color); + GL11.glEnable(2848); + GL11.glBegin(9); + int i; + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + } + + public static void drawRoundedOutline(float x, float y, float x1, float y1, float radius, float lineWidth, int color) { + GL11.glPushAttrib(0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x = (float)(x * 2.0D); + y = (float)(y * 2.0D); + x1 = (float)(x1 * 2.0D); + y1 = (float)(y1 * 2.0D); + GL11.glEnable(3042); + GL11.glDisable(3553); + setColor(color); + GL11.glEnable(2848); + GL11.glLineWidth(lineWidth); + GL11.glBegin(2); + int i; + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + } + + public static void drawSelectRoundedRect(float x, float y, float x1, float y1, float radius1, float radius2, float radius3, float radius4, int color) { + GL11.glPushAttrib(0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x = (float)(x * 2.0D); + y = (float)(y * 2.0D); + x1 = (float)(x1 * 2.0D); + y1 = (float)(y1 * 2.0D); + GL11.glEnable(3042); + GL11.glDisable(3553); + setColor(color); + GL11.glEnable(2848); + GL11.glBegin(9); + int i; + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x + radius1) + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, (y + radius1) + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x + radius2) + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, (y1 - radius2) + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x1 - radius3) + Math.sin(i * Math.PI / 180.0D) * radius3, (y1 - radius3) + Math.cos(i * Math.PI / 180.0D) * radius3); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x1 - radius4) + Math.sin(i * Math.PI / 180.0D) * radius4, (y + radius4) + Math.cos(i * Math.PI / 180.0D) * radius4); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + } + + + + public static void drawSelectRoundedOutline(float x, float y, float x1, float y1, float radius1, float radius2, float radius3, float radius4, float lineWidth, int color) { + GL11.glPushAttrib(0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x = (float)(x * 2.0D); + y = (float)(y * 2.0D); + x1 = (float)(x1 * 2.0D); + y1 = (float)(y1 * 2.0D); + GL11.glEnable(3042); + GL11.glDisable(3553); + setColor(color); + GL11.glEnable(2848); + GL11.glLineWidth(lineWidth); + GL11.glBegin(2); + int i; + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x + radius1) + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, (y + radius1) + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x + radius2) + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, (y1 - radius2) + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x1 - radius3) + Math.sin(i * Math.PI / 180.0D) * radius3, (y1 - radius3) + Math.cos(i * Math.PI / 180.0D) * radius3); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x1 - radius4) + Math.sin(i * Math.PI / 180.0D) * radius4, (y + radius4) + Math.cos(i * Math.PI / 180.0D) * radius4); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + } + + public static void setColor(int color) { + float a = (color >> 24 & 0xFF) / 255.0F; + float r = (color >> 16 & 0xFF) / 255.0F; + float g = (color >> 8 & 0xFF) / 255.0F; + float b = (color & 0xFF) / 255.0F; + GL11.glColor4f(r, g, b, a); + } + + public static void drawRoundedGradientRectCorner(float x, float y, float x1, float y1, float radius, int color, int color2, int color3, int color4) { + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glEnable(2848); + GL11.glShadeModel(7425); + GL11.glPushAttrib(0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x = (float)(x * 2.0D); + y = (float)(y * 2.0D); + x1 = (float)(x1 * 2.0D); + y1 = (float)(y1 * 2.0D); + GL11.glEnable(3042); + GL11.glDisable(3553); + setColor(color); + GL11.glEnable(2848); + GL11.glShadeModel(7425); + GL11.glBegin(9); + int i; + for (i = 0; i <= 90; i += 3) + setColor(color); + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 90; i <= 180; i += 3) + setColor(color2); + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 0; i <= 90; i += 3) + setColor(color3); + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius); + for (i = 90; i <= 180; i += 3) + setColor(color4); + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glShadeModel(7424); + } + + + + public static int glToRGB(float red, float green, float blue, float alpha) { + return (new Color((int)red * 255, (int)green * 255, (int)blue * 255, (int)alpha * 255)).getRGB(); + } + + public static float rgbToGl(int rgb) { + return rgb / 255.0F; + } + + public static void setGlColor(int color) { + float alpha = (color >> 24 & 0xFF) / 255.0F; + float red = (color >> 16 & 0xFF) / 255.0F; + float green = (color >> 8 & 0xFF) / 255.0F; + float blue = (color & 0xFF) / 255.0F; + GlStateManager.color(red, green, blue, alpha); + } + + public static void setGlColor(int color, float alpha) { + float red = (color >> 16 & 0xFF) / 255.0F; + float green = (color >> 8 & 0xFF) / 255.0F; + float blue = (color & 0xFF) / 255.0F; + GlStateManager.color(red, green, blue, alpha); + } + + public static int getRGB(int color, int alpha) { + return (new Color(color >> 16 & 0xFF, color >> 8 & 0xFF, color & 0xFF, alpha)).getRGB(); + } + + public static Color getColor(int color) { + return new Color(color, true); + } + + public static int getAlpha(int color) { + return color >> 24 & 0xFF; + } + + public static int hsvToRgb(int hue, int saturation, int value) { + float m; + hue %= 360; + float s = saturation / 100.0F; + float v = value / 100.0F; + float c = v * s; + float h = hue / 60.0F; + float x = c * (1.0F - Math.abs(h % 2.0F - 1.0F)); + float r = 0.0F; + float g = 0.0F; + float b = 0.0F; + switch (hue / 60) { + case 0: + r = c; + g = x; + b = 0.0F; + m = v - c; + return (int)((r + m) * 255.0F) << 16 | (int)((g + m) * 255.0F) << 8 | (int)((b + m) * 255.0F); + case 1: + r = x; + g = c; + b = 0.0F; + m = v - c; + return (int)((r + m) * 255.0F) << 16 | (int)((g + m) * 255.0F) << 8 | (int)((b + m) * 255.0F); + case 2: + r = 0.0F; + g = c; + b = x; + m = v - c; + return (int)((r + m) * 255.0F) << 16 | (int)((g + m) * 255.0F) << 8 | (int)((b + m) * 255.0F); + case 3: + r = 0.0F; + g = x; + b = c; + m = v - c; + return (int)((r + m) * 255.0F) << 16 | (int)((g + m) * 255.0F) << 8 | (int)((b + m) * 255.0F); + case 4: + r = x; + g = 0.0F; + b = c; + m = v - c; + return (int)((r + m) * 255.0F) << 16 | (int)((g + m) * 255.0F) << 8 | (int)((b + m) * 255.0F); + case 5: + r = c; + g = 0.0F; + b = x; + m = v - c; + return (int)((r + m) * 255.0F) << 16 | (int)((g + m) * 255.0F) << 8 | (int)((b + m) * 255.0F); + } + return 0; + } + + public static int[] rgbToHsv(int rgb) { + float h, r = ((rgb & 0xFF0000) >> 16) / 255.0F; + float g = ((rgb & 0xFF00) >> 8) / 255.0F; + float b = (rgb & 0xFF) / 255.0F; + float M = (r > g) ? Math.max(r, b) : Math.max(g, b); + float m = (r < g) ? Math.min(r, b) : Math.min(g, b); + float c = M - m; + if (M == r) { + for (h = (g - b) / c; h < 0.0F; h += 6.0F); + h %= 6.0F; + } else if (M == g) { + h = (b - r) / c + 2.0F; + } else { + h = (r - g) / c + 4.0F; + } + h *= 60.0F; + float s = c / M; + return new int[] { (c == 0.0F) ? -1 : (int)h, (int)(s * 100.0F), (int)(M * 100.0F) }; + } + + public static int getIntermediateColor(int a, int b, float percent) { + float avgRed = (a >> 16 & 0xFF) * percent + (b >> 16 & 0xFF) * (1.0F - percent); + float avgGreen = (a >> 8 & 0xFF) * percent + (b >> 8 & 0xFF) * (1.0F - percent); + float avgBlue = (a >> 0 & 0xFF) * percent + (b >> 0 & 0xFF) * (1.0F - percent); + float avgAlpha = (a >> 24 & 0xFF) * percent + (b >> 24 & 0xFF) * (1.0F - percent); + try { + return (new Color(avgRed / 255.0F, avgGreen / 255.0F, avgBlue / 255.0F, avgAlpha / 255.0F)).getRGB(); + } catch (IllegalArgumentException e) { + return Integer.MIN_VALUE; + } + } + + public static int convertPercentToValue(float percent) { + return (int)(percent * 255.0F); + } + + public static void scissorHelper(int x1, int y1, int x2, int y2) { + x2 -= x1; + y2 -= y1; + Minecraft mc = Minecraft.getMinecraft(); + ScaledResolution resolution = new ScaledResolution(mc); + GL11.glScissor(x1 * resolution.getScaleFactor(), mc.displayHeight - y1 * resolution + .getScaleFactor() - y2 * resolution.getScaleFactor(), x2 * resolution + .getScaleFactor(), y2 * resolution + .getScaleFactor()); + } +} diff --git a/src/minecraft/animeware/util/render/JColor.java b/src/minecraft/animeware/util/render/JColor.java new file mode 100644 index 0000000..c4a26f1 --- /dev/null +++ b/src/minecraft/animeware/util/render/JColor.java @@ -0,0 +1,61 @@ +package animeware.util.render; + +import java.awt.Color; + +import net.minecraft.client.renderer.GlStateManager; + +/** +* @author lukflug +*/ +// this is taken from gs from a while ago lol + +public class JColor extends Color { + /** + * + */ + private static final long serialVersionUID = 1L; + + public JColor (int rgb) { + super(rgb); + } + + public JColor (int rgba, boolean hasalpha) { + super(rgba,hasalpha); + } + + public JColor (int r, int g, int b) { + super(r,g,b); + } + + public JColor (int r, int g, int b, int a) { + super(r,g,b,a); + } + + public JColor (Color color) { + super(color.getRed(),color.getGreen(),color.getBlue(),color.getAlpha()); + } + + public JColor (JColor color, int a) { + super(color.getRed(),color.getGreen(),color.getBlue(),a); + } + + public static JColor fromHSB (float hue, float saturation, float brightness) { + return new JColor(Color.getHSBColor(hue,saturation,brightness)); + } + + public float getHue() { + return RGBtoHSB(getRed(),getGreen(),getBlue(),null)[0]; + } + + public float getSaturation() { + return RGBtoHSB(getRed(),getGreen(),getBlue(),null)[1]; + } + + public float getBrightness() { + return RGBtoHSB(getRed(),getGreen(),getBlue(),null)[2]; + } + + public void glColor() { + GlStateManager.color(getRed()/255.0f,getGreen()/255.0f,getBlue()/255.0f,getAlpha()/255.0f); + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/render/RenderUtil.java b/src/minecraft/animeware/util/render/RenderUtil.java new file mode 100644 index 0000000..8fc9a80 --- /dev/null +++ b/src/minecraft/animeware/util/render/RenderUtil.java @@ -0,0 +1,222 @@ +package animeware.util.render; + + +import static org.lwjgl.opengl.GL11.GL_BLEND; +import static org.lwjgl.opengl.GL11.GL_LINE_SMOOTH; +import static org.lwjgl.opengl.GL11.GL_LINE_SMOOTH_HINT; +import static org.lwjgl.opengl.GL11.GL_NICEST; +import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA; +import static org.lwjgl.opengl.GL11.GL_POINT_SMOOTH; +import static org.lwjgl.opengl.GL11.GL_POINT_SMOOTH_HINT; +import static org.lwjgl.opengl.GL11.GL_POLYGON_SMOOTH; +import static org.lwjgl.opengl.GL11.GL_POLYGON_SMOOTH_HINT; +import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA; +import static org.lwjgl.opengl.GL11.glBlendFunc; +import static org.lwjgl.opengl.GL11.glDisable; +import static org.lwjgl.opengl.GL11.glEnable; +import static org.lwjgl.opengl.GL11.glHint; +import static org.lwjgl.opengl.GL11.glScissor; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.util.ResourceLocation; + +public class RenderUtil { + + private static Minecraft mc = Minecraft.getMinecraft(); + + public static Framebuffer createFrameBuffer(Framebuffer framebuffer) { + if (framebuffer == null || framebuffer.framebufferWidth != mc.displayWidth || framebuffer.framebufferHeight != mc.displayHeight) { + if (framebuffer != null) { + framebuffer.deleteFramebuffer(); + } + return new Framebuffer(mc.displayWidth, mc.displayHeight, true); + } + return framebuffer; + } + public static void cbLogo(ResourceLocation resourceLocation, float f, float f2, float f3) { + float f4 = f * 2.0f; + float f5 = f * 2.0f; + float f6 = 0.0f; + float f7 = 0.0f; + GL11.glEnable(3042); + Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation); + GL11.glBegin(7); + GL11.glTexCoord2d(f6 / f, f7 / f); + GL11.glVertex2d(f2, f3); + GL11.glTexCoord2d(f6 / f, (f7 + f) / f); + GL11.glVertex2d(f2, f3 + f5); + GL11.glTexCoord2d((f6 + f) / f, (f7 + f) / f); + GL11.glVertex2d(f2 + f4, f3 + f5); + GL11.glTexCoord2d((f6 + f) / f, f7 / f); + GL11.glVertex2d(f2 + f4, f3); + //GL11.glRotated(10, f, f2, f3); + GL11.glEnd(); + GL11.glDisable(3042); + } + + public static void drawImg(ResourceLocation loc, double posX, double posY, double width, double height) { + mc.getTextureManager().bindTexture(loc); + float f = 1.0F / (float) width; + float f1 = 1.0F / (float) height; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(posX, (posY + height), 0.0D).tex(0 * f, ((0 + (float) height) * f1)).endVertex(); + worldrenderer.pos((posX + width), (posY + height), 0.0D).tex((0 + (float) width) * f, (0 + (float) height) * f1).endVertex(); + worldrenderer.pos((posX + width), posY, 0.0D).tex((0 + (float) width) * f, 0 * f1).endVertex(); + worldrenderer.pos(posX, posY, 0.0D).tex(0 * f, 0 * f1).endVertex(); + tessellator.draw(); + } + public static void resetColor() { + GlStateManager.color(1, 1, 1, 1); + } + public static void color(int color, float alpha) { + float r = (float) (color >> 16 & 255) / 255.0F; + float g = (float) (color >> 8 & 255) / 255.0F; + float b = (float) (color & 255) / 255.0F; + GlStateManager.color(r, g, b, alpha); + } + + // Colors the next texture without a specified alpha value + public static void color(int color) { + color(color, (float) (color >> 24 & 255) / 255.0F); + } + + public static void drawGradientRect(double left, double top, double right, double bottom, int startColor, int endColor) { + float f = (float) (startColor >> 24 & 255) / 255.0F; + float f1 = (float) (startColor >> 16 & 255) / 255.0F; + float f2 = (float) (startColor >> 8 & 255) / 255.0F; + float f3 = (float) (startColor & 255) / 255.0F; + float f4 = (float) (endColor >> 24 & 255) / 255.0F; + float f5 = (float) (endColor >> 16 & 255) / 255.0F; + float f6 = (float) (endColor >> 8 & 255) / 255.0F; + float f7 = (float) (endColor & 255) / 255.0F; + GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.shadeModel(7425); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos(right, top, 0.0D).color(f1, f2, f3, f).endVertex(); + worldrenderer.pos(left, top, 0.0D).color(f1, f2, f3, f).endVertex(); + worldrenderer.pos(left, bottom, 0.0D).color(f5, f6, f7, f4).endVertex(); + worldrenderer.pos(right, bottom, 0.0D).color(f5, f6, f7, f4).endVertex(); + tessellator.draw(); + GlStateManager.shadeModel(7424); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + } + + public static void startSmooth() { + glEnable(GL_LINE_SMOOTH); + glEnable(GL_POLYGON_SMOOTH); + glEnable(GL_POINT_SMOOTH); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); + glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); + glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); + } + + public static void endSmooth() { + glDisable(GL_LINE_SMOOTH); + glDisable(GL_POLYGON_SMOOTH); + glEnable(GL_POINT_SMOOTH); + } + + public static Color fade(final Color color, int index, int count) { + float[] hsb = new float[3]; + Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsb); + + float brightness = Math.abs((((System.currentTimeMillis() % 2000) / 1000F + (index / (float) count) * 2F) % 2F) - 1); + brightness = 0.5f + (0.5f * brightness); + + hsb[2] = brightness % 2F; + return new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2])); + } + + public static void scissor(double x, double y, double width, double height) { + ScaledResolution sr = new ScaledResolution(mc); + final double scale = sr.getScaleFactor(); + + y = sr.getScaledHeight() - y; + + x *= scale; + y *= scale; + width *= scale; + height *= scale; + + glScissor((int) x, (int) (y - height), (int) width, (int) height); + } + + public static int getOppositeColor(int color) { + int R = color & 255; + int G = (color >> 8) & 255; + int B = (color >> 16) & 255; + int A = (color >> 24) & 255; + R = 255 - R; + G = 255 - G; + B = 255 - B; + return R + (G << 8) + (B << 16) + (A << 24); + } + public static void drawCircle(double ballX, double ballY, float radius, int sections, int color) { + double dAngle = 6.283185307179586D / sections; + GL11.glPushAttrib(8192); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glEnable(2848); + GL11.glLineWidth(2.0F); + GL11.glBegin(6); + int i; + for (i = 0; i < sections; i++) { + float x = (float)(radius * Math.sin(i * dAngle)); + float y = (float)(radius * Math.cos(i * dAngle)); + ColorUtils.glColor(color); + GL11.glVertex2d(ballX + x, ballY + y); + } + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnd(); + GL11.glBegin(2); + for (i = 0; i < sections; i++) { + float x = (float)(radius * Math.sin(i * dAngle)); + float y = (float)(radius * Math.cos(i * dAngle)); + ColorUtils.glColor(color); + GL11.glVertex2d(ballX + x, ballY + y); + } + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnd(); + GL11.glPopAttrib(); + } + + public static int getRainbow(int x, int y, float saturation) { + long l = System.currentTimeMillis() - x * 10L - y * 10L; + return Color.HSBtoRGB((float)(l % 6000L) / 6000.0F, saturation, 1.0F); + } + public static void scissor(int x, int y, int x2, int y2) { + GL11.glScissor(x * new ScaledResolution(mc).getScaleFactor(), + (new ScaledResolution(mc).getScaledHeight() - y2) * new ScaledResolution(mc).getScaleFactor(), + (x2 - x) * new ScaledResolution(mc).getScaleFactor(), + (y2 - y) * new ScaledResolution(mc).getScaleFactor()); + } + public static void scissor2(int x, int y, int x2, int y2) { + GL11.glScissor(x * new ScaledResolution(mc).getScaleFactor(), + (new ScaledResolution(mc).getScaledHeight() - y2) * new ScaledResolution(mc).getScaleFactor(), + (x - x2) * new ScaledResolution(mc).getScaleFactor(), + (y - y2) * new ScaledResolution(mc).getScaleFactor()); + } + +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/render/ResourceUtils.java b/src/minecraft/animeware/util/render/ResourceUtils.java new file mode 100644 index 0000000..57710b3 --- /dev/null +++ b/src/minecraft/animeware/util/render/ResourceUtils.java @@ -0,0 +1,98 @@ +package animeware.util.render; + +import com.google.common.base.Charsets; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufInputStream; +import io.netty.buffer.Unpooled; +import io.netty.handler.codec.base64.Base64; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.ThreadDownloadImageData; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.ResourcePackRepository; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ResourceLocation; + +public class ResourceUtils { + private static final Map playerSkins = new HashMap<>(); + + static final Minecraft mc = Minecraft.getMinecraft(); + + public static void drawColoredBlockOverlay(AxisAlignedBB axisAlignedBBIn, int red, int green, int blue, int alpha) { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.func_181668_a(5, DefaultVertexFormats.field_181706_f); + worldrenderer.func_181662_b(axisAlignedBBIn.minX, axisAlignedBBIn.minY, axisAlignedBBIn.minZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.maxX, axisAlignedBBIn.minY, axisAlignedBBIn.minZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.minX, axisAlignedBBIn.minY, axisAlignedBBIn.maxZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.maxX, axisAlignedBBIn.minY, axisAlignedBBIn.maxZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + tessellator.draw(); + worldrenderer.func_181668_a(5, DefaultVertexFormats.field_181706_f); + worldrenderer.func_181662_b(axisAlignedBBIn.minX, axisAlignedBBIn.maxY, axisAlignedBBIn.minZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.minX, axisAlignedBBIn.maxY, axisAlignedBBIn.maxZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.maxX, axisAlignedBBIn.maxY, axisAlignedBBIn.minZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.maxX, axisAlignedBBIn.maxY, axisAlignedBBIn.maxZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + tessellator.draw(); + worldrenderer.func_181668_a(5, DefaultVertexFormats.field_181706_f); + worldrenderer.func_181662_b(axisAlignedBBIn.minX, axisAlignedBBIn.minY, axisAlignedBBIn.minZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.minX, axisAlignedBBIn.maxY, axisAlignedBBIn.minZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.maxX, axisAlignedBBIn.minY, axisAlignedBBIn.minZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.maxX, axisAlignedBBIn.maxY, axisAlignedBBIn.minZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.maxX, axisAlignedBBIn.minY, axisAlignedBBIn.maxZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.maxX, axisAlignedBBIn.maxY, axisAlignedBBIn.maxZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.minX, axisAlignedBBIn.minY, axisAlignedBBIn.maxZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.minX, axisAlignedBBIn.maxY, axisAlignedBBIn.maxZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.minX, axisAlignedBBIn.minY, axisAlignedBBIn.minZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + worldrenderer.func_181662_b(axisAlignedBBIn.minX, axisAlignedBBIn.maxY, axisAlignedBBIn.minZ).func_181666_a(red, green, blue, alpha).func_181675_d(); + tessellator.draw(); + } + + public static ResourceLocation getHeadLocation(String displayName) { + ResourceLocation playerSkin = playerSkins.getOrDefault(displayName, new ResourceLocation("urban/ui/defaults/heads/" + displayName + ".png")); + if (!playerSkins.containsKey(displayName)) { + ThreadDownloadImageData skinData = new ThreadDownloadImageData(null, "https://minotar.net/helm/" + displayName + "/32.png", new ResourceLocation("urban/ui/defaults/heads/steve.png"), null); + Minecraft.getMinecraft().getTextureManager().loadTexture(playerSkin, (ITextureObject)skinData); + playerSkins.put(displayName, playerSkin); + } + return playerSkin; + } + + public static DynamicTexture getServerTexture(ServerData server) { + DynamicTexture texture = null; + ByteBuf bytebuf = Unpooled.copiedBuffer(server.getBase64EncodedIconData(), Charsets.UTF_8); + ByteBuf bytebuf1 = Base64.decode(bytebuf); + BufferedImage bufferedimage = null; + try { + bufferedimage = TextureUtil.readBufferedImage((InputStream)new ByteBufInputStream(bytebuf1)); + } catch (Throwable throwable) { + //Logger.error("Failed to load server icon for " + server.serverName); + } finally { + bytebuf.release(); + bytebuf1.release(); + } + texture = new DynamicTexture(bufferedimage.getWidth(), bufferedimage.getHeight()); + bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), texture.getTextureData(), 0, bufferedimage.getWidth()); + texture.updateDynamicTexture(); + return texture; + } + + public static DynamicTexture getResourcePackImg(int i) { + DynamicTexture texture; + try { + texture = new DynamicTexture(((ResourcePackRepository.Entry)mc.getResourcePackRepository().getRepositoryEntries().get(i)).getResourcePack().getPackImage()); + } catch (IOException var4) { + texture = TextureUtil.missingTexture; + } + return texture; + } +} diff --git a/src/minecraft/animeware/util/render/RoundedUtils.java b/src/minecraft/animeware/util/render/RoundedUtils.java new file mode 100644 index 0000000..3a4e228 --- /dev/null +++ b/src/minecraft/animeware/util/render/RoundedUtils.java @@ -0,0 +1,261 @@ +package animeware.util.render; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import org.lwjgl.opengl.GL11; + +public class RoundedUtils { + static final Minecraft mc = Minecraft.getMinecraft(); + + static final FontRenderer fr = mc.fontRendererObj; + + public static void enableGL2D() { + GL11.glDisable(2929); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glDepthMask(true); + GL11.glEnable(2848); + GL11.glHint(3154, 4354); + GL11.glHint(3155, 4354); + } + + public static void disableGL2D() { + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glEnable(2929); + GL11.glDisable(2848); + GL11.glHint(3154, 4352); + GL11.glHint(3155, 4352); + } + + public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) { + GL11.glPushAttrib(0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x = (float)(x * 2.0D); + y = (float)(y * 2.0D); + x1 = (float)(x1 * 2.0D); + y1 = (float)(y1 * 2.0D); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glEnable(2848); + setColor(color); + GL11.glEnable(2848); + GL11.glBegin(9); + int i; + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius); + GL11.glEnd(); + GL11.glBegin(2); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + GL11.glLineWidth(1.0F); + } + + public static void drawRoundedRect(float x, float y, float x1, float y1, float radius, int color) { + GL11.glPushAttrib(0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x = (float)(x * 2.0D); + y = (float)(y * 2.0D); + x1 = (float)(x1 * 2.0D); + y1 = (float)(y1 * 2.0D); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glEnable(2848); + setColor(color); + GL11.glEnable(2848); + GL11.glBegin(9); + int i; + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + GL11.glLineWidth(1.0F); + } + + public static void drawRoundedOutline(float x, float y, float x1, float y1, float radius, float lineWidth, int color) { + GL11.glPushAttrib(0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x = (float)(x * 2.0D); + y = (float)(y * 2.0D); + x1 = (float)(x1 * 2.0D); + y1 = (float)(y1 * 2.0D); + GL11.glEnable(3042); + GL11.glDisable(3553); + setColor(color); + GL11.glEnable(2848); + GL11.glLineWidth(lineWidth); + GL11.glBegin(2); + int i; + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + GL11.glLineWidth(1.0F); + } + + public static void drawSelectRoundedRect(float x, float y, float x1, float y1, float radius1, float radius2, float radius3, float radius4, int color) { + GL11.glPushAttrib(0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x = (float)(x * 2.0D); + y = (float)(y * 2.0D); + x1 = (float)(x1 * 2.0D); + y1 = (float)(y1 * 2.0D); + GL11.glEnable(3042); + GL11.glDisable(3553); + setColor(color); + GL11.glEnable(2848); + GL11.glBegin(9); + int i; + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x + radius1) + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, (y + radius1) + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x + radius2) + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, (y1 - radius2) + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x1 - radius3) + Math.sin(i * Math.PI / 180.0D) * radius3, (y1 - radius3) + Math.cos(i * Math.PI / 180.0D) * radius3); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x1 - radius4) + Math.sin(i * Math.PI / 180.0D) * radius4, (y + radius4) + Math.cos(i * Math.PI / 180.0D) * radius4); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + GL11.glLineWidth(1.0F); + } + + public static void drawSelectRoundedOutline(float x, float y, float x1, float y1, float radius1, float radius2, float radius3, float radius4, float lineWidth, int color) { + GL11.glPushAttrib(0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x = (float)(x * 2.0D); + y = (float)(y * 2.0D); + x1 = (float)(x1 * 2.0D); + y1 = (float)(y1 * 2.0D); + GL11.glEnable(3042); + GL11.glDisable(3553); + setColor(color); + GL11.glEnable(2848); + GL11.glLineWidth(lineWidth); + GL11.glBegin(2); + int i; + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x + radius1) + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, (y + radius1) + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x + radius2) + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, (y1 - radius2) + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D); + for (i = 0; i <= 90; i += 3) + GL11.glVertex2d((x1 - radius3) + Math.sin(i * Math.PI / 180.0D) * radius3, (y1 - radius3) + Math.cos(i * Math.PI / 180.0D) * radius3); + for (i = 90; i <= 180; i += 3) + GL11.glVertex2d((x1 - radius4) + Math.sin(i * Math.PI / 180.0D) * radius4, (y + radius4) + Math.cos(i * Math.PI / 180.0D) * radius4); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + GL11.glLineWidth(1.0F); + } + + public static void setColor(int color) { + float a = (color >> 24 & 0xFF) / 255.0F; + float r = (color >> 16 & 0xFF) / 255.0F; + float g = (color >> 8 & 0xFF) / 255.0F; + float b = (color & 0xFF) / 255.0F; + GL11.glColor4f(r, g, b, a); + } + + public static void drawRoundedGradientRectCorner(float x, float y, float x1, float y1, float radius, int color, int color2, int color3, int color4) { + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glEnable(2848); + GL11.glShadeModel(7425); + GL11.glPushAttrib(0); + GL11.glScaled(0.5D, 0.5D, 0.5D); + x = (float)(x * 2.0D); + y = (float)(y * 2.0D); + x1 = (float)(x1 * 2.0D); + y1 = (float)(y1 * 2.0D); + GL11.glEnable(3042); + GL11.glDisable(3553); + setColor(color); + GL11.glEnable(2848); + GL11.glShadeModel(7425); + GL11.glBegin(9); + int i; + for (i = 0; i <= 90; i += 3) + setColor(color); + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 90; i <= 180; i += 3) + setColor(color2); + GL11.glVertex2d((x + radius) + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 0; i <= 90; i += 3) + setColor(color3); + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y1 - radius) + Math.cos(i * Math.PI / 180.0D) * radius); + for (i = 90; i <= 180; i += 3) + setColor(color4); + GL11.glVertex2d((x1 - radius) + Math.sin(i * Math.PI / 180.0D) * radius, (y + radius) + Math.cos(i * Math.PI / 180.0D) * radius); + GL11.glEnd(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glDisable(3042); + GL11.glEnable(3553); + GL11.glScaled(2.0D, 2.0D, 2.0D); + GL11.glPopAttrib(); + GL11.glLineWidth(1.0F); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glDisable(2848); + GL11.glShadeModel(7424); + } +} diff --git a/src/minecraft/animeware/util/render/ShaderUtil.java b/src/minecraft/animeware/util/render/ShaderUtil.java new file mode 100644 index 0000000..81fd93d --- /dev/null +++ b/src/minecraft/animeware/util/render/ShaderUtil.java @@ -0,0 +1,213 @@ +package animeware.util.render; + +import static org.lwjgl.opengl.GL11.GL_QUADS; +import static org.lwjgl.opengl.GL11.glBegin; +import static org.lwjgl.opengl.GL11.glEnd; +import static org.lwjgl.opengl.GL11.glTexCoord2f; +import static org.lwjgl.opengl.GL11.glVertex2f; +import static org.lwjgl.opengl.GL20.GL_COMPILE_STATUS; +import static org.lwjgl.opengl.GL20.GL_FRAGMENT_SHADER; +import static org.lwjgl.opengl.GL20.GL_LINK_STATUS; +import static org.lwjgl.opengl.GL20.GL_VERTEX_SHADER; +import static org.lwjgl.opengl.GL20.glAttachShader; +import static org.lwjgl.opengl.GL20.glCompileShader; +import static org.lwjgl.opengl.GL20.glCreateProgram; +import static org.lwjgl.opengl.GL20.glCreateShader; +import static org.lwjgl.opengl.GL20.glGetProgrami; +import static org.lwjgl.opengl.GL20.glGetShaderInfoLog; +import static org.lwjgl.opengl.GL20.glGetShaderi; +import static org.lwjgl.opengl.GL20.glGetUniformLocation; +import static org.lwjgl.opengl.GL20.glLinkProgram; +import static org.lwjgl.opengl.GL20.glShaderSource; +import static org.lwjgl.opengl.GL20.glUniform1f; +import static org.lwjgl.opengl.GL20.glUniform1i; +import static org.lwjgl.opengl.GL20.glUniform2f; +import static org.lwjgl.opengl.GL20.glUniform2i; +import static org.lwjgl.opengl.GL20.glUniform3f; +import static org.lwjgl.opengl.GL20.glUniform4f; +import static org.lwjgl.opengl.GL20.glUseProgram; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; + +import animeware.util.Utils; +import animeware.util.file.FileUtils; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.ResourceLocation; + +public class ShaderUtil implements Utils { + private final int programID; + + public ShaderUtil(String fragmentShaderLoc, String vertexShaderLoc) { + int program = glCreateProgram(); + try { + int fragmentShaderID; + switch (fragmentShaderLoc) { + case "roundedRect": + fragmentShaderID = createShader(new ByteArrayInputStream(roundedRect.getBytes()), GL_FRAGMENT_SHADER); + break; + case "roundedRectGradient": + fragmentShaderID = createShader(new ByteArrayInputStream(roundedRectGradient.getBytes()), GL_FRAGMENT_SHADER); + break; + default: + fragmentShaderID = createShader(mc.getResourceManager().getResource(new ResourceLocation(fragmentShaderLoc)).getInputStream(), GL_FRAGMENT_SHADER); + break; + } + glAttachShader(program, fragmentShaderID); + + int vertexShaderID = createShader(mc.getResourceManager().getResource(new ResourceLocation(vertexShaderLoc)).getInputStream(), GL_VERTEX_SHADER); + glAttachShader(program, vertexShaderID); + + + } catch (IOException e) { + e.printStackTrace(); + } + + glLinkProgram(program); + int status = glGetProgrami(program, GL_LINK_STATUS); + + if (status == 0) { + throw new IllegalStateException("Shader failed to link!"); + } + this.programID = program; + } + + public ShaderUtil(String fragmentShaderLoc) { + this(fragmentShaderLoc, "Tenacity/Shaders/vertex.vsh"); + } + + + public void init() { + glUseProgram(programID); + } + + public void unload() { + glUseProgram(0); + } + + public int getUniform(String name) { + return glGetUniformLocation(programID, name); + } + + + public void setUniformf(String name, float... args) { + int loc = glGetUniformLocation(programID, name); + switch (args.length) { + case 1: + glUniform1f(loc, args[0]); + break; + case 2: + glUniform2f(loc, args[0], args[1]); + break; + case 3: + glUniform3f(loc, args[0], args[1], args[2]); + break; + case 4: + glUniform4f(loc, args[0], args[1], args[2], args[3]); + break; + } + } + + public void setUniformi(String name, int... args) { + int loc = glGetUniformLocation(programID, name); + if (args.length > 1) glUniform2i(loc, args[0], args[1]); + else glUniform1i(loc, args[0]); + } + + public static void drawQuads(float x, float y, float width, float height) { + if (mc.gameSettings.ofFastRender) return; + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(x, y); + glTexCoord2f(0, 1); + glVertex2f(x, y + height); + glTexCoord2f(1, 1); + glVertex2f(x + width, y + height); + glTexCoord2f(1, 0); + glVertex2f(x + width, y); + glEnd(); + } + + public static void drawQuads() { + if (mc.gameSettings.ofFastRender) return; + ScaledResolution sr = new ScaledResolution(mc); + float width = (float) sr.getScaledWidth_double(); + float height = (float) sr.getScaledHeight_double(); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); + glVertex2f(0, 0); + glTexCoord2f(0, 0); + glVertex2f(0, height); + glTexCoord2f(1, 0); + glVertex2f(width, height); + glTexCoord2f(1, 1); + glVertex2f(width, 0); + glEnd(); + } + + private int createShader(InputStream inputStream, int shaderType) { + int shader = glCreateShader(shaderType); + glShaderSource(shader, FileUtils.readInputStream(inputStream)); + glCompileShader(shader); + + + if (glGetShaderi(shader, GL_COMPILE_STATUS) == 0) { + System.out.println(glGetShaderInfoLog(shader, 4096)); + throw new IllegalStateException(String.format("Shader (%s) failed to compile!", shaderType)); + } + + return shader; + } + + + private final String roundedRectGradient = "#version 120\n" + + "\n" + + "uniform vec2 location, rectSize;\n" + + "uniform vec4 color1, color2, color3, color4;\n" + + "uniform float radius;\n" + + "\n" + + "#define NOISE .5/255.0\n" + + "\n" + + "float roundSDF(vec2 p, vec2 b, float r) {\n" + + " return length(max(abs(p) - b , 0.0)) - r;\n" + + "}\n" + + "\n" + + "vec3 createGradient(vec2 coords, vec3 color1, vec3 color2, vec3 color3, vec3 color4){\n" + + " vec3 color = mix(mix(color1.rgb, color2.rgb, coords.y), mix(color3.rgb, color4.rgb, coords.y), coords.x);\n" + + " //Dithering the color\n" + + " // from https://shader-tutorial.dev/advanced/color-banding-dithering/\n" + + " color += mix(NOISE, -NOISE, fract(sin(dot(coords.xy, vec2(12.9898, 78.233))) * 43758.5453));\n" + + " return color;\n" + + "}\n" + + "\n" + + "void main() {\n" + + " vec2 st = gl_TexCoord[0].st;\n" + + " vec2 halfSize = rectSize * .5;\n" + + " \n" + + " float smoothedAlpha = (1.0-smoothstep(0.0, 2., roundSDF(halfSize - (gl_TexCoord[0].st * rectSize), halfSize - radius - 1., radius))) * color1.a;\n" + + " gl_FragColor = vec4(createGradient(st, color1.rgb, color2.rgb, color3.rgb, color4.rgb), smoothedAlpha);\n" + + "}"; + + + private String roundedRect = "#version 120\n" + + "\n" + + "uniform vec2 location, rectSize;\n" + + "uniform vec4 color;\n" + + "uniform float radius;\n" + + "uniform bool blur;\n" + + "\n" + + "float roundSDF(vec2 p, vec2 b, float r) {\n" + + " return length(max(abs(p) - b, 0.0)) - r;\n" + + "}\n" + + "\n" + + "\n" + + "void main() {\n" + + " vec2 rectHalf = rectSize * .5;\n" + + " // Smooth the result (free antialiasing).\n" + + " float smoothedAlpha = (1.0-smoothstep(0.0, 1.0, roundSDF(rectHalf - (gl_TexCoord[0].st * rectSize), rectHalf - radius - 1., radius))) * color.a;\n" + + " gl_FragColor = vec4(color.rgb, smoothedAlpha);// mix(quadColor, shadowColor, 0.0);\n" + + "\n" + + "}"; + +} diff --git a/src/minecraft/animeware/util/render/scrolling/Scroll.java b/src/minecraft/animeware/util/render/scrolling/Scroll.java new file mode 100644 index 0000000..e46da5c --- /dev/null +++ b/src/minecraft/animeware/util/render/scrolling/Scroll.java @@ -0,0 +1,59 @@ + package animeware.util.render.scrolling; + +import java.io.IOException; + +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +import animeware.hud.mod.HudManager; +import animeware.hud.mod.HudMod; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; + +public class Scroll extends GuiScreen { + public static Scroll instance = new Scroll(); // for displayGuiScreen() func + + private float currentScroll; + private final int x = 10, y = 10, width = 100, height = 300; + + HudManager mM; + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + super.drawScreen(mouseX, mouseY, partialTicks); + if (currentScroll > 0) currentScroll = 0.0f; + Gui.drawRect(x, y, width, height, 0xff212121); + int textHeight = 0; + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_SCISSOR_TEST); + GL11.glTranslatef(0, currentScroll, 0); // Scroll + ScaledResolution r = new ScaledResolution(mc); + int s = r.getScaleFactor(); + int translatedY = r.getScaledHeight() - y - height; + GL11.glScissor(x * s, translatedY * s + 18, width * s, height * s - 18); // Scissor with scaleFactor + for (HudMod m : mM.hudMods) { // TODO:Import your modules + fontRendererObj.drawStringWithShadow(m.name, x + 3, y + textHeight + 2, -1); + textHeight += fontRendererObj.FONT_HEIGHT + 20; + } + if (currentScroll < -(textHeight / 2.67f)) currentScroll = -(textHeight / 2.67f); + GL11.glDisable(GL11.GL_SCISSOR_TEST); + GL11.glPopMatrix(); + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void handleMouseInput() throws IOException { + super.handleMouseInput(); + + int i = Mouse.getEventDWheel(); + + i = Integer.compare(i, 0); + + currentScroll += i * 10f; + } +} diff --git a/src/minecraft/animeware/util/render/theme/CurrentTheme.java b/src/minecraft/animeware/util/render/theme/CurrentTheme.java new file mode 100644 index 0000000..466e16d --- /dev/null +++ b/src/minecraft/animeware/util/render/theme/CurrentTheme.java @@ -0,0 +1,18 @@ +package animeware.util.render.theme; + +public class CurrentTheme { + + public static Theme current = new RainbowTheme(); + + public CurrentTheme() { + } + + public static Theme getCurrent() { + return current; + } + + public void setCurrent(Theme current) { + this.current = current; + } + +} diff --git a/src/minecraft/animeware/util/render/theme/RainbowTheme.java b/src/minecraft/animeware/util/render/theme/RainbowTheme.java new file mode 100644 index 0000000..e5bfc00 --- /dev/null +++ b/src/minecraft/animeware/util/render/theme/RainbowTheme.java @@ -0,0 +1,21 @@ +package animeware.util.render.theme; + +import java.awt.Color; + +import animeware.util.render.ColorUtil; +import net.minecraft.util.ResourceLocation; + +public class RainbowTheme extends Theme { + + public RainbowTheme() { + super("Raindbow", 0.1, new ResourceLocation("Animeware/background/old/bg5.png"), ColorUtil.getRGB(7, 0.9f, 1, 100), -1); + } + + @Override + public int getMainColor() { + float hue = ((System.currentTimeMillis() + 100) % (int)(4 * 1000)) / (float)(4 * 1000); + int color = new Color(255, 254, 255, 255).getRGB();//Color.HSBtoRGB(hue, 0.9f, 1); + return color; + } + +} diff --git a/src/minecraft/animeware/util/render/theme/Theme.java b/src/minecraft/animeware/util/render/theme/Theme.java new file mode 100644 index 0000000..4a2e64b --- /dev/null +++ b/src/minecraft/animeware/util/render/theme/Theme.java @@ -0,0 +1,46 @@ +package animeware.util.render.theme; + + +import com.google.gson.annotations.Expose; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.ResourceLocation; + +public class Theme { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public String name; + public double version; + public ResourceLocation mainMenuBg; + public int mainColor; + public int secondaryColor; + + public Theme(String name, double version, ResourceLocation mainMenuBg, int mainColor, int secondaryColor) { + this.name = name; + this.version = version; + this.mainMenuBg = mainMenuBg; + this.mainColor = mainColor; + this.secondaryColor = secondaryColor; + } + + public String getName() { + return name; + } + + public double getVersion() { + return version; + } + + public ResourceLocation getMainMenuBg() { + return mainMenuBg; + } + + public int getMainColor() { + return mainColor; + } + + public int getSecondaryColor() { + return secondaryColor; + } +} diff --git a/src/minecraft/animeware/util/render/ui/ClickGUIUtil.java b/src/minecraft/animeware/util/render/ui/ClickGUIUtil.java new file mode 100644 index 0000000..5c95f33 --- /dev/null +++ b/src/minecraft/animeware/util/render/ui/ClickGUIUtil.java @@ -0,0 +1,88 @@ +package animeware.util.render.ui; + +import java.awt.Color; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; + +import org.lwjgl.opengl.GL11; + +import animeware.NightSky; +import animeware.gui.clickgui.ClickGUI; +import animeware.ui.themes.impl.ThemeManager; +import animeware.util.font.ucfont.UCFontRenderer; +import animeware.util.render.RoundedUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.util.ResourceLocation; + +public class ClickGUIUtil { + + Minecraft mc = Minecraft.getMinecraft(); + static UCFontRenderer fr = new UCFontRenderer(new ResourceLocation("Animeware/font/font.ttf"), 19.0f); + + public static void renderClickGUI() { + if(ThemeManager.guilight) { + RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 145), (ClickGUI.height / 2 - 110), (ClickGUI.width / 2 + 190), (ClickGUI.height / 2 + 110), 18.0F, new Color(100, 100, 100, 255).getRGB()); + RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 190), (ClickGUI.height / 2 - 110), (ClickGUI.width / 2 - 150), (ClickGUI.height / 2 + 110), 18.0F, new Color(50, 50, 55, 200).getRGB()); + //RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 + 90), (ClickGUI.height / 2 - 110), (ClickGUI.width / 2 + 190), (ClickGUI.height / 2 + 110), 18.0F, new Color(150, 150, 155, 155).getRGB()); + RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 185), (ClickGUI.height / 2 - 74), (ClickGUI.width / 2 - 155), (ClickGUI.height / 2 - 72), 4.0F, new Color(100, 100, 105, 255).getRGB()); + + RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 190), (ClickGUI.height / 2 + 115), (ClickGUI.width / 2 + 190), (ClickGUI.height / 2 + 155), 18.0F, new Color(80, 80, 79, 255).getRGB()); + } else { + RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 190), (ClickGUI.height / 2 - 110), (ClickGUI.width / 2 + 190), (ClickGUI.height / 2 + 115), 12.0F, new Color(26, 24, 25, 255).getRGB()); + + RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 184), (ClickGUI.height / 2 - 104), (ClickGUI.width / 2 - 90), (ClickGUI.height / 2 - 75), 12.0F, new Color(32, 32, 32, 255).getRGB()); + + RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 184), (ClickGUI.height / 2 - 68), (ClickGUI.width / 2 - 90), (ClickGUI.height / 2 + 72), 12.0F, new Color(32, 32, 32, 255).getRGB()); + + RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 184), (ClickGUI.height / 2 + 79), (ClickGUI.width / 2 - 90), (ClickGUI.height / 2 + 109), 12.0F, new Color(32, 32, 32, 255).getRGB()); + + RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 84), (ClickGUI.height / 2 - 104), (ClickGUI.width / 2 + 184), (ClickGUI.height / 2 - 86), 12.0F, new Color(32, 32, 32, 255).getRGB()); + + RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 84), (ClickGUI.height / 2 - 79), (ClickGUI.width / 2 + 184), (ClickGUI.height / 2 + 109), 12.0F, new Color(32, 32, 32, 255).getRGB()); + + + //0,255,255 + + + + + //RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 145), (ClickGUI.height / 2 - 110), (ClickGUI.width / 2 + 190), (ClickGUI.height / 2 + 110), 18.0F, new Color(25, 25, 30, 255).getRGB()); + //RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 190), (ClickGUI.height / 2 - 110), (ClickGUI.width / 2 - 150), (ClickGUI.height / 2 + 110), 18.0F, new Color(50, 50, 55, 200).getRGB()); + + //RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 185), (ClickGUI.height / 2 - 74), (ClickGUI.width / 2 - 155), (ClickGUI.height / 2 - 72), 4.0F, new Color(100, 100, 105, 255).getRGB()); + + //RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 190), (ClickGUI.height / 2 + 115), (ClickGUI.width / 2 + 190), (ClickGUI.height / 2 + 155), 18.0F, new Color(25, 25, 30, 255).getRGB()); + + } + + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm"); + LocalTime localTime = LocalTime.now(); + String time = dtf.format(localTime); + + fr.drawString(NightSky.mcname , ClickGUI.width / 2 - 150, ClickGUI.height / 2 + 83, new Color(255, 255, 254, 255).getRGB()); + fr.drawString(NightSky.rank() , ClickGUI.width / 2 - 150, ClickGUI.height / 2 + 94, -1); + + //Minecraft.getMinecraft().fontRendererObj.drawString("FPS" , ClickGUI.width / 2 + 164, ClickGUI.height / 2 + 125, new Color(255, 255, 254, 255).getRGB()); + //Minecraft.getMinecraft().fontRendererObj.drawString(Minecraft.getMinecraft().getDebugFPS() + "", ClickGUI.width / 2 + 144, ClickGUI.height / 2 + 125, new Color(255, 255, 254, 255).getRGB()); + //Minecraft.getMinecraft().fontRendererObj.draw + //Minecraft.getMinecraft().fontRendererObj.drawString(time , ClickGUI.width / 2 + 156, ClickGUI.height / 2 + 137, -1); + + NetworkPlayerInfo playerInfo = Minecraft.getMinecraft().getNetHandler().getPlayerInfo(Minecraft.getMinecraft().thePlayer.getUniqueID()); + if(playerInfo != null) { + Minecraft.getMinecraft().getTextureManager().bindTexture(playerInfo.getLocationSkin()); + GL11.glColor4f(1F, 1F, 1F, 1F); + Gui.drawScaledCustomSizeModalRect(ClickGUI.width / 2 - 180, ClickGUI.height / 2 + 82, 8F, 8F, 8, 8, 24, 24, 64F, 64F); + } + + } + public static void renderCosmeticMenu() { + if(ThemeManager.guilight) { + RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 145), (ClickGUI.height / 2 - 110), (ClickGUI.width / 2 + 190), (ClickGUI.height / 2 + 110), 18.0F, new Color(100, 100, 100, 255).getRGB()); + } else { + RoundedUtils.drawSmoothRoundedRect((ClickGUI.width / 2 - 145), (ClickGUI.height / 2 - 110), (ClickGUI.width / 2 + 190), (ClickGUI.height / 2 + 110), 18.0F, new Color(25, 25, 30, 255).getRGB()); + } + } + +} diff --git a/src/minecraft/animeware/util/settings/BooleanSetting.java b/src/minecraft/animeware/util/settings/BooleanSetting.java new file mode 100644 index 0000000..a2e5ef6 --- /dev/null +++ b/src/minecraft/animeware/util/settings/BooleanSetting.java @@ -0,0 +1,93 @@ +package animeware.util.settings; + +import java.awt.Color; + +import animeware.util.render.GuiUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.ResourceLocation; + +public class BooleanSetting extends Setting { + + private boolean value; + public float x; + public float y; + static float size = 15.0f; + String string; + + public BooleanSetting(float x, float y, String idk) { + this.x = x; + this.y = y; + this.string = idk; + } + + public void render(float x, float y) { + this.x = x; + this.y = y; + GlStateManager.resetColor(); + GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); + GuiUtils.drawRoundedRect(x, y, x + size, y + size, 2.0f, new Color(0, 0, 0, 100).getRGB()); + GuiUtils.drawRoundedOutline(x, y, x + size, y + size, 2.0f, 1.0f, new Color(200, 200, 200, 200).getRGB()); + GuiUtils.drawTexture(this.getEnabledIcon(), x - 5.0f, y - 5.0f, size + 10.0f, size + 10.0f); + GlStateManager.resetColor(); + GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); + //Minecraft.getMinecraft().fontRendererObj.drawString(this.string, x + 20.0f, y, new Color(200, 200, 200, 200).getRGB()); + Minecraft.getMinecraft().fontRendererObj.drawString(this.string, x + 20.0f, y, new Color(200, 200, 200, 200).getRGB(), false); + } + + public ResourceLocation getEnabledIcon() { + return this.value ? new ResourceLocation("urban/ui/icons/tick.png") : new ResourceLocation("urban/ui/icons/notick.png"); + } + + public void onClick(float mx, float my, int mb) { + if (mb == 0 && mx > this.x && mx < this.x + size && my > this.y && my < this.y + size) { + this.value = !this.value; + } + } + + public boolean isEnabled() { + return this.value; + } + + public void setEnabled(boolean value) { + this.value = value; + } + public void toggle() { + value = !value; + } + + public float getX() { + return this.x; + } + + public float getY() { + return this.y; + } + + public void setX(float x) { + this.x = x; + } + + public void setY(float y) { + this.y = y; + } + + /*public boolean enabled; + + public BooleanSetting(String name, boolean enabled) { + this.name = name; + this.enabled = enabled; + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + public void toggle() { + enabled = !enabled; + }*/ + +} diff --git a/src/minecraft/animeware/util/settings/ModeSetting.java b/src/minecraft/animeware/util/settings/ModeSetting.java new file mode 100644 index 0000000..6d2a672 --- /dev/null +++ b/src/minecraft/animeware/util/settings/ModeSetting.java @@ -0,0 +1,34 @@ +package animeware.util.settings; + +import java.util.Arrays; +import java.util.List; + +public class ModeSetting extends Setting { + + public int index; + public List modes; + + public ModeSetting(String name, String defaultMode, String... modes) { + this.name = name; + this.modes = Arrays.asList(modes); + index = this.modes.indexOf(defaultMode); + } + + public String getMode() { + return modes.get(index); + } + + public boolean is(String mode) { + return index == modes.indexOf(mode); + } + + public void cycle() { + if(index < modes.size() - 1) { + index++; + } else { + index = 0; + } + } + + +} diff --git a/src/minecraft/animeware/util/settings/NumberSetting.java b/src/minecraft/animeware/util/settings/NumberSetting.java new file mode 100644 index 0000000..8024bd1 --- /dev/null +++ b/src/minecraft/animeware/util/settings/NumberSetting.java @@ -0,0 +1,54 @@ +package animeware.util.settings; + +public class NumberSetting extends Setting { + + public double value, minimum, maximum, increment; + + public NumberSetting(String name, double value, double minimum, double maximum, double increment) { + this.name = name; + this.value = value; + this.minimum = minimum; + this.maximum = maximum; + this.increment = increment; + } + + public double getValue() { + return value; + } + + public void setValue(double value) { + double precision = 1 / increment; + this.value = Math.round(Math.max(minimum, Math.min(maximum, value)) * precision) / precision; + } + + public void increment(boolean positive) { + setValue(getValue() + (positive ? 1 : -1) * increment); + } + + public double getMinimum() { + return minimum; + } + + public void setMinimum(double minimum) { + this.minimum = minimum; + } + + public double getMaximum() { + return maximum; + } + + public void setMaximum(double maximum) { + this.maximum = maximum; + } + + public double getIncrement() { + return increment; + } + + public void setIncrement(double increment) { + this.increment = increment; + } + + + +} diff --git a/src/minecraft/animeware/util/settings/Setting.java b/src/minecraft/animeware/util/settings/Setting.java new file mode 100644 index 0000000..fd63a4b --- /dev/null +++ b/src/minecraft/animeware/util/settings/Setting.java @@ -0,0 +1,7 @@ +package animeware.util.settings; + +public class Setting { + + public String name; + +} diff --git a/src/minecraft/animeware/util/settings/comp/BooleanButton.java b/src/minecraft/animeware/util/settings/comp/BooleanButton.java new file mode 100644 index 0000000..7d96cb0 --- /dev/null +++ b/src/minecraft/animeware/util/settings/comp/BooleanButton.java @@ -0,0 +1,74 @@ +package animeware.util.settings.comp; + +import java.awt.Color; + +import org.lwjgl.input.Mouse; + +import animeware.hud.mod.HudMod; +import animeware.util.render.ColorMode; +import animeware.util.render.DrawUtil; +import animeware.util.settings.BooleanSetting; +import animeware.util.settings.Setting; +import net.minecraft.client.Minecraft; + +public class BooleanButton { + + + private HudMod mod; + + private Minecraft mc = Minecraft.getMinecraft(); + + private boolean pressed; + private static boolean hovered; + private static boolean hovered2; + + public static int x; + public static int y; + private int width; + private int height; + + private BooleanSetting bool; + + private int pressColor = new Color(0, 255, 0 ,255).getRGB(); + private int neutralColor = new Color(255, 0, 0, 100).getRGB(); + + public BooleanButton(int mouseX, int mouseY, int x, int y, BooleanSetting bool, HudMod mod, int buttonId) { + this.x = x; + this.y = y; + this.width = 100; + this.height = 25; + this.mod = mod; + this.bool = bool; + + if(!mod.settings.isEmpty()) { + for(Setting setting : mod.settings) { + if(setting instanceof BooleanSetting) { + BooleanSetting boolsett = (BooleanSetting) setting; + //Gui.drawRect(this.x, this.y, this.x + this.width, this.y + this.height, color); + DrawUtil.drawBorderedRoundedRect(x, y, x + this.width, y + this.height, 10, 1, getWearingColor(bool), ColorMode.getModColor()); // 0, 0, 0, 255 + mc.fontRendererObj.drawString(boolsett.name, x + 13, y + 8, boolsett.isEnabled() ? new Color(0, 255, 0, 255).getRGB() : new Color(255, 0, 0, 255).getRGB()); + this.pressed = (Mouse.getEventButton() == 0) && (this.hovered2 == true) && (Mouse.getEventButtonState() == true); + } + } + } + } + + + private int getWearingColor(BooleanSetting bool) { + if(bool.isEnabled()) { + return new Color(0, 255, 0, 255).getRGB(); + } else { + return new Color(255, 0, 0, 255).getRGB(); + } + } + + public static boolean isHovered2() { + return hovered2; + } + + public static boolean isHovered(int mouseX, int mouseY) { + if(mouseX >= x && mouseX <= x + 100 && mouseY >= y && mouseY <= y + 25) { + return true; + } else return false; + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/settings/comp/ModeButton.java b/src/minecraft/animeware/util/settings/comp/ModeButton.java new file mode 100644 index 0000000..088eec6 --- /dev/null +++ b/src/minecraft/animeware/util/settings/comp/ModeButton.java @@ -0,0 +1,71 @@ +package animeware.util.settings.comp; + +import java.awt.Color; + +import org.lwjgl.input.Mouse; + +import animeware.hud.mod.HudMod; +import animeware.util.render.ColorMode; +import animeware.util.render.DrawUtil; +import animeware.util.render.RoundedUtils; +import animeware.util.render.theme.CurrentTheme; +import animeware.util.settings.ModeSetting; +import animeware.util.settings.Setting; +import net.minecraft.client.Minecraft; + +public class ModeButton { + + + private HudMod mod; + + private Minecraft mc = Minecraft.getMinecraft(); + + private boolean pressed; + private static boolean hovered; + private static boolean hovered2; + + public static int x; + public static int y; + private int width; + private int height; + + private ModeSetting mode; + + private int pressColor = new Color(0, 255, 0 ,255).getRGB(); + private int neutralColor = new Color(255, 0, 0, 100).getRGB(); + + public ModeButton(int mouseX, int mouseY, int x, int y, ModeSetting mode, HudMod mod, int buttonId) { + this.x = x; + this.y = y; + this.width = 100; + this.height = 25; + this.mod = mod; + this.mode = mode; + + if(!mod.settings.isEmpty()) { + for(Setting setting : mod.settings) { + if(setting instanceof ModeSetting) { + ModeSetting modesett = (ModeSetting) setting; + + //Gui.drawRect(this.x, this.y, this.x + this.width, this.y + this.height, color); + DrawUtil.drawBorderedRoundedRect(x, y, x + this.width - 17, y + this.height, 10, 1, ColorMode.getSettingButtonAqua(), ColorMode.getSettingButtonAquaInside()); + mc.fontRendererObj.drawString(modesett.name + ": " + modesett.getMode(), x + 13, y + 8, new Color(254, 255, 255, 255).getRGB()); + //DrawUtil.drawBorderedRoundedRect(x, y, x + this.width, y + this.height, 10, 1, ColorMode.getSettingButtonAqua(), ColorMode.getSettingButtonAquaInside()); // 0, 0, 0, 255 + + + this.pressed = (Mouse.getEventButton() == 0) && (this.hovered2 == true) && (Mouse.getEventButtonState() == true); + } + } + } + } + + public static boolean isHovered2() { + return hovered2; + } + + public static boolean isHovered(int mouseX, int mouseY) { + if(mouseX >= x && mouseX <= x + 100 && mouseY >= y && mouseY <= y + 25) { + return true; + } else return false; + } +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/timer/TimerUtil.java b/src/minecraft/animeware/util/timer/TimerUtil.java new file mode 100644 index 0000000..2e41711 --- /dev/null +++ b/src/minecraft/animeware/util/timer/TimerUtil.java @@ -0,0 +1,38 @@ +package animeware.util.timer; + + + +public class TimerUtil { + + public long lastMS = System.currentTimeMillis(); + + + public void reset() { + lastMS = System.currentTimeMillis(); + } + + + public boolean hasTimeElapsed(long time, boolean reset) { + if (System.currentTimeMillis() - lastMS > time) { + if (reset) reset(); + return true; + } + + return false; + } + + + public boolean hasTimeElapsed(long time) { + return System.currentTimeMillis() - lastMS > time; + } + + + public long getTime() { + return System.currentTimeMillis() - lastMS; + } + + public void setTime(long time) { + lastMS = time; + } + +} diff --git a/src/minecraft/animeware/util/websockets/SocketClient.java b/src/minecraft/animeware/util/websockets/SocketClient.java new file mode 100644 index 0000000..eead770 --- /dev/null +++ b/src/minecraft/animeware/util/websockets/SocketClient.java @@ -0,0 +1,107 @@ +package animeware.util.websockets; + +import java.io.IOException; +import co.gongzh.procbridge.Client; +import net.minecraft.client.Minecraft; + +import java.net.ServerSocket; + +import animeware.NightSky; + +public class SocketClient { + + public static final Client client = new Client("127.0.0.1", 7331); //130.61.181.86 + + public static void main(String[] args) { + //client.request("startmonsoon", "its_quick:quick:true"); + + //client.request("isUser", "its_quick"); + /*String[] arguments = client.request("isUser", "its_quick").toString().split(":"); + if(arguments[0].equals("true")) { + System.out.println("returned as true"); + } else if (arguments[0].equals("false")) { + System.out.println("returned as false"); + }*/ + + while(true) { + //client.getHost() + } + } + + public static Object sendRequest(String... args) { + return client.request("echo", String.join(" ", args)); + } + + public static boolean isUser(String username) { + //if(NightSky.hasSent == false) { + String[] arguments = client.request("isUser", username).toString().split(":"); + if(arguments[0].equals("true")) { + NightSky.isUser = true; + //System.out.println("returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("returned as false for user " + username); + return false; + } else { + System.out.println("there was an error for " + username); + return false; + } + + + + } + public static boolean isOwner(String username) { + String[] arguments = client.request("isOwner", username).toString().split(":"); + if(arguments[0].equals("trueowner")) { + //System.out.println("returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("returned as false for user " + username); + return false; + } else { + System.out.println("there was an error for " + username); + return false; + } + } + public static boolean isDev(String username) { + String[] arguments = client.request("isDev", username).toString().split(":"); + if(arguments[0].equals("truedev")) { + //System.out.println("returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("returned as false for user " + username); + return false; + } else { + System.out.println("there was an error for " + username); + return false; + } + } + public static boolean isPurple(String username) { + String[] arguments = client.request("isPurple", username).toString().split(":"); + if(arguments[0].equals("truepurple")) { + //System.out.println("returned as true for user " + username); + return true; + } else if (arguments[0].equals("false")) { + //System.out.println("returned as false for user " + username); + return false; + } else { + System.out.println("there was an error for " + username); + return false; + } + } + + + public static double randomNumber(double max, double min) { + return (Math.random() * (max - min)) + min; + } + public static String isUserResult() { + if(NightSky.results == false) { + if(isUser(Minecraft.getMinecraft().thePlayer.getName()) == true) { + return "true"; + } else + return "false"; + } + return null; + } + +} \ No newline at end of file diff --git a/src/minecraft/animeware/util/websockets/user/CheckName.java b/src/minecraft/animeware/util/websockets/user/CheckName.java new file mode 100644 index 0000000..3df16a8 --- /dev/null +++ b/src/minecraft/animeware/util/websockets/user/CheckName.java @@ -0,0 +1,34 @@ +package animeware.util.websockets.user; + +import animeware.NightSky; +import animeware.ui.login.LoginScreen; +import animeware.util.misc.Identification; +import animeware.util.websockets.SocketClient; +import net.minecraft.client.Minecraft; + +public class CheckName { + + Minecraft mc = Minecraft.getMinecraft(); + + public static void DoCheckNameOnLogin() { + NightSky.hasSent = false; + } + public static void DoCheckName() { + + System.out.println(SocketClient.client.request("start_animeware", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":true")); + System.out.println(SocketClient.client.request("start_animeware", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":trueowner")); + System.out.println(SocketClient.client.request("start_animeware", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":truedev")); + System.out.println(SocketClient.client.request("start_animeware", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":truepurple")); + + } + public static void DoShutDownCheck() { + + System.out.println(SocketClient.client.request("stop_animeware", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":true")); + //System.out.println(SocketClient.client.request("stop_animeware_owner", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":trueowner")); + //System.out.println(SocketClient.client.request("stop_animeware_dev", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":truedev")); + //System.out.println(SocketClient.client.request("stop_animeware_purple", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":truepurple")); + + + } + +} diff --git a/src/minecraft/animeware/util/websockets/user/NightSkyUser.java b/src/minecraft/animeware/util/websockets/user/NightSkyUser.java new file mode 100644 index 0000000..fb2f77e --- /dev/null +++ b/src/minecraft/animeware/util/websockets/user/NightSkyUser.java @@ -0,0 +1,33 @@ +package animeware.util.websockets.user; + +public class NightSkyUser { + + public String mcName; + public boolean isUser; + + public NightSkyUser(String mcName, boolean isUser) {; + this.mcName = mcName; + this.isUser = isUser; + } + + public String getProperties() { + return mcName + ":" + (isUser ? "true" : "false"); + } + + public String getMcName() { + return mcName; + } + + public boolean isUser() { + return isUser; + } + + public void setMcName(String mcName) { + this.mcName = mcName; + } + + + public void setUser(boolean user) { + isUser = user; + } +} diff --git a/src/minecraft/assets/minecraft/Animeware/Microsoft.png b/src/minecraft/assets/minecraft/Animeware/Microsoft.png new file mode 100644 index 0000000..af86e90 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/Microsoft.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg1.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg1.jpg new file mode 100644 index 0000000..7adea0e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg1.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg10.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg10.jpg new file mode 100644 index 0000000..8f5bb8c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg10.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg11.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg11.jpg new file mode 100644 index 0000000..813ae9d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg11.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg12.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg12.jpg new file mode 100644 index 0000000..e6fb4ec Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg12.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg13.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg13.jpg new file mode 100644 index 0000000..22ad97a Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg13.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg14.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg14.jpg new file mode 100644 index 0000000..51b54a4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg14.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg15.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg15.jpg new file mode 100644 index 0000000..22dd2c9 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg15.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg16.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg16.jpg new file mode 100644 index 0000000..fbdf913 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg16.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg17.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg17.jpg new file mode 100644 index 0000000..74fd564 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg17.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg18.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg18.jpg new file mode 100644 index 0000000..4d82cde Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg18.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg19.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg19.jpg new file mode 100644 index 0000000..bc00c3c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg19.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg2.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg2.jpg new file mode 100644 index 0000000..3df1559 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg2.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg2.png b/src/minecraft/assets/minecraft/Animeware/background/old/bg2.png new file mode 100644 index 0000000..8d70b25 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg2.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg20.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg20.jpg new file mode 100644 index 0000000..44d03cc Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg20.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg21.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg21.jpg new file mode 100644 index 0000000..fc3bcef Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg21.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg22.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg22.jpg new file mode 100644 index 0000000..95a6a32 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg22.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg23.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg23.jpg new file mode 100644 index 0000000..1b3a2e2 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg23.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg24.png b/src/minecraft/assets/minecraft/Animeware/background/old/bg24.png new file mode 100644 index 0000000..46576ee Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg24.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg25.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg25.jpg new file mode 100644 index 0000000..70f57ed Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg25.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg26.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg26.jpg new file mode 100644 index 0000000..5a27696 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg26.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg2l.png b/src/minecraft/assets/minecraft/Animeware/background/old/bg2l.png new file mode 100644 index 0000000..47575b9 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg2l.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg2logo.png b/src/minecraft/assets/minecraft/Animeware/background/old/bg2logo.png new file mode 100644 index 0000000..d7efe5b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg2logo.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg3.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg3.jpg new file mode 100644 index 0000000..85c49a2 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg3.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg4.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg4.jpg new file mode 100644 index 0000000..ed7d05c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg4.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg5.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg5.jpg new file mode 100644 index 0000000..a7efbcb Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg5.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg5.png b/src/minecraft/assets/minecraft/Animeware/background/old/bg5.png new file mode 100644 index 0000000..b207829 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg5.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg6.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg6.jpg new file mode 100644 index 0000000..daea7ef Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg6.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg69.png b/src/minecraft/assets/minecraft/Animeware/background/old/bg69.png new file mode 100644 index 0000000..fd88ad6 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg69.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg7.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg7.jpg new file mode 100644 index 0000000..1fb01b0 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg7.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg8.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg8.jpg new file mode 100644 index 0000000..9d75881 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg8.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bg9.jpg b/src/minecraft/assets/minecraft/Animeware/background/old/bg9.jpg new file mode 100644 index 0000000..3404895 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bg9.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/background/old/bgblur.png b/src/minecraft/assets/minecraft/Animeware/background/old/bgblur.png new file mode 100644 index 0000000..ef836b9 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/background/old/bgblur.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/bandana.pdn b/src/minecraft/assets/minecraft/Animeware/bandana.pdn new file mode 100644 index 0000000..1cf6382 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/bandana.pdn differ diff --git a/src/minecraft/assets/minecraft/Animeware/bandana.png b/src/minecraft/assets/minecraft/Animeware/bandana.png new file mode 100644 index 0000000..0ca0ad6 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/bandana.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/blur.json b/src/minecraft/assets/minecraft/Animeware/blur.json new file mode 100644 index 0000000..cee54f4 --- /dev/null +++ b/src/minecraft/assets/minecraft/Animeware/blur.json @@ -0,0 +1,87 @@ +{ + "targets": [ + "swap" + ], + "passes": [ + { + "name": "blur", + "intarget": "minecraft:main", + "outtarget": "swap", + "uniforms": [ + { + "name": "BlurDir", + "values": [ + 1.0, + 0.0 + ] + }, + { + "name": "Radius", + "values": [ + 5.0 + ] + } + ] + }, + { + "name": "blur", + "intarget": "swap", + "outtarget": "minecraft:main", + "uniforms": [ + { + "name": "BlurDir", + "values": [ + 0.0, + 1.0 + ] + }, + { + "name": "Radius", + "values": [ + 5.0 + ] + } + ] + }, + { + "name": "blur", + "intarget": "swap", + "outtarget": "minecraft:main", + "uniforms": [ + { + "name": "BlurDir", + "values": [ + -1.0, + 0.0 + ] + }, + { + "name": "Radius", + "values": [ + 5.0 + ] + } + ] + }, + { + "name": "blur", + "intarget": "swap", + "outtarget": "minecraft:main", + "uniforms": [ + { + "name": "BlurDir", + "values": [ + 0.0, + -1.0 + ] + }, + { + "name": "Radius", + "values": [ + 5.0 + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/HexenHut.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/HexenHut.png new file mode 100644 index 0000000..ba8b8b4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/HexenHut.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/blaze.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/blaze.png new file mode 100644 index 0000000..044134a Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/blaze.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/blaze2.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/blaze2.png new file mode 100644 index 0000000..6ba52fa Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/blaze2.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/2.jpg b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/2.jpg new file mode 100644 index 0000000..2274363 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/2.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/idiolgameover.webp b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/idiolgameover.webp new file mode 100644 index 0000000..30f070e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/idiolgameover.webp differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/0.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/0.png new file mode 100644 index 0000000..6cf219f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/0.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/1.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/1.png new file mode 100644 index 0000000..1010de3 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/1.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/10.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/10.png new file mode 100644 index 0000000..94231ed Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/10.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/11.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/11.png new file mode 100644 index 0000000..17d306f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/11.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/12.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/12.png new file mode 100644 index 0000000..4306c08 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/12.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/13.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/13.png new file mode 100644 index 0000000..e422c8c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/13.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/14.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/14.png new file mode 100644 index 0000000..ea54dd6 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/14.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/15.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/15.png new file mode 100644 index 0000000..f48e675 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/15.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/2.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/2.png new file mode 100644 index 0000000..b2865f8 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/2.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/3.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/3.png new file mode 100644 index 0000000..561455b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/3.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/4.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/4.png new file mode 100644 index 0000000..a15fda5 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/4.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/5.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/5.png new file mode 100644 index 0000000..939bca4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/5.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/6.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/6.png new file mode 100644 index 0000000..d99ac95 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/6.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/7.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/7.png new file mode 100644 index 0000000..bac2441 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/7.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/8.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/8.png new file mode 100644 index 0000000..6c55c04 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/8.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/9.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/9.png new file mode 100644 index 0000000..34fde3e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/rinnegan/9.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/sunsetlakepurple.webp b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/sunsetlakepurple.webp new file mode 100644 index 0000000..b38809f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/sunsetlakepurple.webp differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/sunsetlakepurple.webp.mcmeta b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/sunsetlakepurple.webp.mcmeta new file mode 100644 index 0000000..cdd55a6 --- /dev/null +++ b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/sunsetlakepurple.webp.mcmeta @@ -0,0 +1 @@ +{ "animation": {"frametime": 2, "width": 176, "height": 136 } } \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/xenbeneonlights.webp b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/xenbeneonlights.webp new file mode 100644 index 0000000..c5189b2 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/xenbeneonlights.webp differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/xenbeneonlights.webp.mcmeta b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/xenbeneonlights.webp.mcmeta new file mode 100644 index 0000000..ac5b673 --- /dev/null +++ b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/xenbeneonlights.webp.mcmeta @@ -0,0 +1 @@ +{ "animation": {"frametime": 3, "width": 88, "height": 68 } } \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/xshatterbiobay.webp b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/xshatterbiobay.webp new file mode 100644 index 0000000..0d0cdea Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/xshatterbiobay.webp differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/xshatterbiobay.webp.mcmeta b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/xshatterbiobay.webp.mcmeta new file mode 100644 index 0000000..ac5b673 --- /dev/null +++ b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/xshatterbiobay.webp.mcmeta @@ -0,0 +1 @@ +{ "animation": {"frametime": 3, "width": 88, "height": 68 } } \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/yuseipurpleeye.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/yuseipurpleeye.png new file mode 100644 index 0000000..b3f7687 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/yuseipurpleeye.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/yuseipurpleeye.png.mcmeta b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/yuseipurpleeye.png.mcmeta new file mode 100644 index 0000000..1586708 --- /dev/null +++ b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/yuseipurpleeye.png.mcmeta @@ -0,0 +1 @@ +{ "animation": {"frametime": 2, "width": 88, "height": 68 } } \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/yuseipurpleeye.webp b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/yuseipurpleeye.webp new file mode 100644 index 0000000..9ef3ea0 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/yuseipurpleeye.webp differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/zovapurple.webp b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/zovapurple.webp new file mode 100644 index 0000000..bbf1c9d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/zovapurple.webp differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/zovapurple.webp.mcmeta b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/zovapurple.webp.mcmeta new file mode 100644 index 0000000..1586708 --- /dev/null +++ b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ani/zovapurple.webp.mcmeta @@ -0,0 +1 @@ +{ "animation": {"frametime": 2, "width": 88, "height": 68 } } \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/blank.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/blank.png new file mode 100644 index 0000000..047150a Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/blank.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/cape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/cape.png new file mode 100644 index 0000000..77307b4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/cape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/darkcape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/darkcape.png new file mode 100644 index 0000000..ad49fc8 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/darkcape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/devcape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/devcape.png new file mode 100644 index 0000000..244301f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/devcape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/discord/sparkofyt2cape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/discord/sparkofyt2cape.png new file mode 100644 index 0000000..89683ac Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/discord/sparkofyt2cape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/discord/sparkofytcape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/discord/sparkofytcape.png new file mode 100644 index 0000000..9728d11 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/discord/sparkofytcape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/dseyes2cape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/dseyes2cape.png new file mode 100644 index 0000000..4ccba00 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/dseyes2cape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/dseyescape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/dseyescape.png new file mode 100644 index 0000000..5737f72 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/dseyescape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/emeraldcape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/emeraldcape.png new file mode 100644 index 0000000..e238f02 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/emeraldcape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ghostlyflame.webp b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ghostlyflame.webp new file mode 100644 index 0000000..2274363 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ghostlyflame.webp differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientblack.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientblack.png new file mode 100644 index 0000000..1ffe875 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientblack.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientblue.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientblue.png new file mode 100644 index 0000000..e353625 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientblue.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientgreen.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientgreen.png new file mode 100644 index 0000000..ef2bd3f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientgreen.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientpurple.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientpurple.png new file mode 100644 index 0000000..43895c6 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientpurple.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientred.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientred.png new file mode 100644 index 0000000..cdba006 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/gradientred.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/kocho2cape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/kocho2cape.png new file mode 100644 index 0000000..14eb289 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/kocho2cape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/kocho3cape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/kocho3cape.png new file mode 100644 index 0000000..0173e2a Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/kocho3cape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/kochocape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/kochocape.png new file mode 100644 index 0000000..b75907a Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/kochocape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/lcape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/lcape.png new file mode 100644 index 0000000..3070c5b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/lcape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/lunarstaffblack.webp b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/lunarstaffblack.webp new file mode 100644 index 0000000..5d2c320 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/lunarstaffblack.webp differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/nitro.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/nitro.png new file mode 100644 index 0000000..792b58e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/nitro.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ownercape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ownercape.png new file mode 100644 index 0000000..1282cf4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ownercape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ozhay.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ozhay.png new file mode 100644 index 0000000..91b752d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/ozhay.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/planetscape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/planetscape.png new file mode 100644 index 0000000..4f479f2 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/planetscape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/quav_cape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/quav_cape.png new file mode 100644 index 0000000..5801060 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/quav_cape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/quick.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/quick.png new file mode 100644 index 0000000..4e4abde Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/quick.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/reptyll.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/reptyll.png new file mode 100644 index 0000000..ba73f5f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/reptyll.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/swordcape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/swordcape.png new file mode 100644 index 0000000..c7b01e9 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/swordcape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/tanjirocape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/tanjirocape.png new file mode 100644 index 0000000..63486db Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/tanjirocape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/wintercape.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/wintercape.png new file mode 100644 index 0000000..7298ac4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/wintercape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/yt.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/yt.png new file mode 100644 index 0000000..a7261ec Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/capes/yt.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/creeper_armor.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/creeper_armor.png new file mode 100644 index 0000000..6ee536e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/creeper_armor.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/crystal.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/crystal.png new file mode 100644 index 0000000..164bb7e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/crystal.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/dwings.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/dwings.png new file mode 100644 index 0000000..d799ba9 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/dwings.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/enchantGlint.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/enchantGlint.png new file mode 100644 index 0000000..f9ca97c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/enchantGlint.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/endercrystal.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/endercrystal.png new file mode 100644 index 0000000..1d3a168 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/endercrystal.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/guardian.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/guardian.png new file mode 100644 index 0000000..f904a20 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/guardian.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/gwings.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/gwings.png new file mode 100644 index 0000000..6b4033d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/gwings.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/gwings1.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/gwings1.png new file mode 100644 index 0000000..a6dc8dd Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/gwings1.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/hat.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/hat.png new file mode 100644 index 0000000..f0608fc Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/hat.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/slime.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/slime.png new file mode 100644 index 0000000..7b3e9ba Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/slime.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/susanno.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/susanno.png new file mode 100644 index 0000000..35cf898 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/susanno.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/wings.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/wings.png new file mode 100644 index 0000000..63bec98 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/wings.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/cosmetic/wolfModel.png b/src/minecraft/assets/minecraft/Animeware/cosmetic/wolfModel.png new file mode 100644 index 0000000..028105b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/cosmetic/wolfModel.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/1font.ttf b/src/minecraft/assets/minecraft/Animeware/font/1font.ttf new file mode 100644 index 0000000..da60214 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/1font.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/2font.ttf b/src/minecraft/assets/minecraft/Animeware/font/2font.ttf new file mode 100644 index 0000000..206c25b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/2font.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/3font.ttf b/src/minecraft/assets/minecraft/Animeware/font/3font.ttf new file mode 100644 index 0000000..d843e57 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/3font.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Extralight_trial.ttf b/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Extralight_trial.ttf new file mode 100644 index 0000000..0def797 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Extralight_trial.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Hairline_trial.ttf b/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Hairline_trial.ttf new file mode 100644 index 0000000..def9e39 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Hairline_trial.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Light_trial.ttf b/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Light_trial.ttf new file mode 100644 index 0000000..fa7b0b4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Light_trial.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Thin_trial 2.ttf b/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Thin_trial 2.ttf new file mode 100644 index 0000000..c5b824f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Thin_trial 2.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Thin_trial.ttf b/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Thin_trial.ttf new file mode 100644 index 0000000..81c1204 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro-Thin_trial.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro_trial.ttf b/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro_trial.ttf new file mode 100644 index 0000000..1087b3f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/AntipastoPro_trial.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/banks.ttf b/src/minecraft/assets/minecraft/Animeware/font/banks.ttf new file mode 100644 index 0000000..73ed595 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/banks.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/bold+.ttf b/src/minecraft/assets/minecraft/Animeware/font/bold+.ttf new file mode 100644 index 0000000..21f6f84 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/bold+.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/bold.ttf b/src/minecraft/assets/minecraft/Animeware/font/bold.ttf new file mode 100644 index 0000000..fd79d43 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/bold.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/cedo.ttf b/src/minecraft/assets/minecraft/Animeware/font/cedo.ttf new file mode 100644 index 0000000..4ee2f0e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/cedo.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/check.ttf b/src/minecraft/assets/minecraft/Animeware/font/check.ttf new file mode 100644 index 0000000..3b6bb6e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/check.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/desktop.ini b/src/minecraft/assets/minecraft/Animeware/font/desktop.ini new file mode 100644 index 0000000..2901dc4 --- /dev/null +++ b/src/minecraft/assets/minecraft/Animeware/font/desktop.ini @@ -0,0 +1,2 @@ +[LocalizedFileNames] +Comfortaa.ttf=@Comfortaa.ttf,0 diff --git a/src/minecraft/assets/minecraft/Animeware/font/font.ttf b/src/minecraft/assets/minecraft/Animeware/font/font.ttf new file mode 100644 index 0000000..5e81491 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/font.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/icon.ttf b/src/minecraft/assets/minecraft/Animeware/font/icon.ttf new file mode 100644 index 0000000..b73fae2 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/icon.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/light.ttf b/src/minecraft/assets/minecraft/Animeware/font/light.ttf new file mode 100644 index 0000000..0d38189 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/light.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/neverlose.ttf b/src/minecraft/assets/minecraft/Animeware/font/neverlose.ttf new file mode 100644 index 0000000..a753c30 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/neverlose.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/regular.ttf b/src/minecraft/assets/minecraft/Animeware/font/regular.ttf new file mode 100644 index 0000000..db43334 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/regular.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/tenacity.ttf b/src/minecraft/assets/minecraft/Animeware/font/tenacity.ttf new file mode 100644 index 0000000..2edf84b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/tenacity.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/tenacitybold.ttf b/src/minecraft/assets/minecraft/Animeware/font/tenacitybold.ttf new file mode 100644 index 0000000..9cc7c46 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/tenacitybold.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/font/thic.ttf b/src/minecraft/assets/minecraft/Animeware/font/thic.ttf new file mode 100644 index 0000000..00af3a2 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/font/thic.ttf differ diff --git a/src/minecraft/assets/minecraft/Animeware/gui/options_background.png b/src/minecraft/assets/minecraft/Animeware/gui/options_background.png new file mode 100644 index 0000000..f8e8c6a Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/gui/options_background.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icon16.png b/src/minecraft/assets/minecraft/Animeware/icon16.png new file mode 100644 index 0000000..7c6c62f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icon16.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icon32.png b/src/minecraft/assets/minecraft/Animeware/icon32.png new file mode 100644 index 0000000..f1a9ea9 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icon32.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/account.png b/src/minecraft/assets/minecraft/Animeware/icons/account.png new file mode 100644 index 0000000..feb9bc4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/account.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/armorstatus.png b/src/minecraft/assets/minecraft/Animeware/icons/armorstatus.png new file mode 100644 index 0000000..5d9a259 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/armorstatus.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/asas.png b/src/minecraft/assets/minecraft/Animeware/icons/asas.png new file mode 100644 index 0000000..181d086 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/asas.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/autotext.png b/src/minecraft/assets/minecraft/Animeware/icons/autotext.png new file mode 100644 index 0000000..fa54f70 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/autotext.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/blank.png b/src/minecraft/assets/minecraft/Animeware/icons/blank.png new file mode 100644 index 0000000..047150a Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/blank.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/blockoverlay.png b/src/minecraft/assets/minecraft/Animeware/icons/blockoverlay.png new file mode 100644 index 0000000..600ed23 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/blockoverlay.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/bps.png b/src/minecraft/assets/minecraft/Animeware/icons/bps.png new file mode 100644 index 0000000..b14d325 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/bps.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/cape.png b/src/minecraft/assets/minecraft/Animeware/icons/cape.png new file mode 100644 index 0000000..efba44d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/cape.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/caret-down.png b/src/minecraft/assets/minecraft/Animeware/icons/caret-down.png new file mode 100644 index 0000000..af41707 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/caret-down.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/caret-left.png b/src/minecraft/assets/minecraft/Animeware/icons/caret-left.png new file mode 100644 index 0000000..b7031ff Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/caret-left.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/caret-right.png b/src/minecraft/assets/minecraft/Animeware/icons/caret-right.png new file mode 100644 index 0000000..e9c4d27 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/caret-right.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/cart.png b/src/minecraft/assets/minecraft/Animeware/icons/cart.png new file mode 100644 index 0000000..5dc0f01 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/cart.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/close.png b/src/minecraft/assets/minecraft/Animeware/icons/close.png new file mode 100644 index 0000000..45bcecc Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/close.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/combat.png b/src/minecraft/assets/minecraft/Animeware/icons/combat.png new file mode 100644 index 0000000..62db096 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/combat.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/coordinates.png b/src/minecraft/assets/minecraft/Animeware/icons/coordinates.png new file mode 100644 index 0000000..bd9c43d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/coordinates.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/cos/nitro.png b/src/minecraft/assets/minecraft/Animeware/icons/cos/nitro.png new file mode 100644 index 0000000..b3fd505 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/cos/nitro.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/cos/quick.png b/src/minecraft/assets/minecraft/Animeware/icons/cos/quick.png new file mode 100644 index 0000000..0d48fca Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/cos/quick.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/cos/reptyl.png b/src/minecraft/assets/minecraft/Animeware/icons/cos/reptyl.png new file mode 100644 index 0000000..da1cd15 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/cos/reptyl.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/cosmetics.png b/src/minecraft/assets/minecraft/Animeware/icons/cosmetics.png new file mode 100644 index 0000000..a44a231 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/cosmetics.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/cosmeticsold.png b/src/minecraft/assets/minecraft/Animeware/icons/cosmeticsold.png new file mode 100644 index 0000000..7581b35 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/cosmeticsold.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/cps.png b/src/minecraft/assets/minecraft/Animeware/icons/cps.png new file mode 100644 index 0000000..e13c9a5 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/cps.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/direction.png b/src/minecraft/assets/minecraft/Animeware/icons/direction.png new file mode 100644 index 0000000..7f18feb Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/direction.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/discord.png b/src/minecraft/assets/minecraft/Animeware/icons/discord.png new file mode 100644 index 0000000..d87e425 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/discord.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/edit.png b/src/minecraft/assets/minecraft/Animeware/icons/edit.png new file mode 100644 index 0000000..f52bedc Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/edit.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/exploit.png b/src/minecraft/assets/minecraft/Animeware/icons/exploit.png new file mode 100644 index 0000000..dc7b879 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/exploit.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/fps.png b/src/minecraft/assets/minecraft/Animeware/icons/fps.png new file mode 100644 index 0000000..4f6514a Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/fps.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/glacier/keystrokes.png b/src/minecraft/assets/minecraft/Animeware/icons/glacier/keystrokes.png new file mode 100644 index 0000000..4cb2c99 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/glacier/keystrokes.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/glacier/ping.png b/src/minecraft/assets/minecraft/Animeware/icons/glacier/ping.png new file mode 100644 index 0000000..b33c9dd Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/glacier/ping.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/glacier/reach.png b/src/minecraft/assets/minecraft/Animeware/icons/glacier/reach.png new file mode 100644 index 0000000..90bf658 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/glacier/reach.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/glacier/timechanger.png b/src/minecraft/assets/minecraft/Animeware/icons/glacier/timechanger.png new file mode 100644 index 0000000..a7b65ac Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/glacier/timechanger.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/home.png b/src/minecraft/assets/minecraft/Animeware/icons/home.png new file mode 100644 index 0000000..410544a Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/home.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/hud.png b/src/minecraft/assets/minecraft/Animeware/icons/hud.png new file mode 100644 index 0000000..cf618fe Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/hud.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/icon32.png b/src/minecraft/assets/minecraft/Animeware/icons/icon32.png new file mode 100644 index 0000000..f64f2e9 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/icon32.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/iconWhite.png b/src/minecraft/assets/minecraft/Animeware/icons/iconWhite.png new file mode 100644 index 0000000..d88e392 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/iconWhite.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/icon_16x16.png b/src/minecraft/assets/minecraft/Animeware/icons/icon_16x16.png new file mode 100644 index 0000000..ff43c0b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/icon_16x16.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/icon_32x32.png b/src/minecraft/assets/minecraft/Animeware/icons/icon_32x32.png new file mode 100644 index 0000000..f2ba870 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/icon_32x32.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/idk.png b/src/minecraft/assets/minecraft/Animeware/icons/idk.png new file mode 100644 index 0000000..70a8c3e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/idk.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/image.png b/src/minecraft/assets/minecraft/Animeware/icons/image.png new file mode 100644 index 0000000..4e696bd Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/image.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/imagedev.png b/src/minecraft/assets/minecraft/Animeware/icons/imagedev.png new file mode 100644 index 0000000..5508de3 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/imagedev.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/info.png b/src/minecraft/assets/minecraft/Animeware/icons/info.png new file mode 100644 index 0000000..10e44a1 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/info.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/itemphydsfsics.png b/src/minecraft/assets/minecraft/Animeware/icons/itemphydsfsics.png new file mode 100644 index 0000000..6ea03ad Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/itemphydsfsics.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/itemphysics.png b/src/minecraft/assets/minecraft/Animeware/icons/itemphysics.png new file mode 100644 index 0000000..ab725eb Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/itemphysics.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/keystrokes.png b/src/minecraft/assets/minecraft/Animeware/icons/keystrokes.png new file mode 100644 index 0000000..1541c95 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/keystrokes.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/keystrokes2.png b/src/minecraft/assets/minecraft/Animeware/icons/keystrokes2.png new file mode 100644 index 0000000..c0ef3c7 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/keystrokes2.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/language.png b/src/minecraft/assets/minecraft/Animeware/icons/language.png new file mode 100644 index 0000000..0d94b7c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/language.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/memoryusage.png b/src/minecraft/assets/minecraft/Animeware/icons/memoryusage.png new file mode 100644 index 0000000..2a26d8e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/memoryusage.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/misc.png b/src/minecraft/assets/minecraft/Animeware/icons/misc.png new file mode 100644 index 0000000..0322ba6 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/misc.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/mods.png b/src/minecraft/assets/minecraft/Animeware/icons/mods.png new file mode 100644 index 0000000..3650e19 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/mods.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/move_arrow.png b/src/minecraft/assets/minecraft/Animeware/icons/move_arrow.png new file mode 100644 index 0000000..209e1ab Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/move_arrow.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/movement.png b/src/minecraft/assets/minecraft/Animeware/icons/movement.png new file mode 100644 index 0000000..bb37ee4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/movement.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/nickhider.png b/src/minecraft/assets/minecraft/Animeware/icons/nickhider.png new file mode 100644 index 0000000..bcb3b62 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/nickhider.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/nightskywhiteicon.png b/src/minecraft/assets/minecraft/Animeware/icons/nightskywhiteicon.png new file mode 100644 index 0000000..e84de43 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/nightskywhiteicon.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/oldanimations.png b/src/minecraft/assets/minecraft/Animeware/icons/oldanimations.png new file mode 100644 index 0000000..1aa97e4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/oldanimations.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_LVL_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_LVL_white_48dp.png new file mode 100644 index 0000000..af741c7 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_LVL_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_add_box_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_add_box_white_48dp.png new file mode 100644 index 0000000..384415d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_add_box_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_attach_money_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_attach_money_white_48dp.png new file mode 100644 index 0000000..ba2a6ac Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_attach_money_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_color_lens_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_color_lens_white_48dp.png new file mode 100644 index 0000000..42f37eb Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_color_lens_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_colorize_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_colorize_white_48dp.png new file mode 100644 index 0000000..7616527 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_colorize_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_flashlight_on_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_flashlight_on_white_48dp.png new file mode 100644 index 0000000..e31d065 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_flashlight_on_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_headset_mic_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_headset_mic_white_48dp.png new file mode 100644 index 0000000..818ec6e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_headset_mic_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_invert_colors_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_invert_colors_white_48dp.png new file mode 100644 index 0000000..aebd0eb Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_invert_colors_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_keyboard_arrow_right_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_keyboard_arrow_right_white_48dp.png new file mode 100644 index 0000000..7c3c54c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_keyboard_arrow_right_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_local_fire_department_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_local_fire_department_white_48dp.png new file mode 100644 index 0000000..031514d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_local_fire_department_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_mod_settings_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_mod_settings_white_48dp.png new file mode 100644 index 0000000..db1e848 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_mod_settings_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_question_answer_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_question_answer_white_48dp.png new file mode 100644 index 0000000..23ef16f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_question_answer_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_rounded_corner_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_rounded_corner_white_48dp.png new file mode 100644 index 0000000..ac96d46 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_rounded_corner_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_shift_bar_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_shift_bar_white_48dp.png new file mode 100644 index 0000000..f7dc9b8 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_shift_bar_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_shopping_cart_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_shopping_cart_white_48dp.png new file mode 100644 index 0000000..9efe419 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_shopping_cart_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/outline_space_bar_white_48dp.png b/src/minecraft/assets/minecraft/Animeware/icons/outline_space_bar_white_48dp.png new file mode 100644 index 0000000..c3141f4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/outline_space_bar_white_48dp.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/packoverlay.png b/src/minecraft/assets/minecraft/Animeware/icons/packoverlay.png new file mode 100644 index 0000000..e9476eb Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/packoverlay.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/pingdisplay.png b/src/minecraft/assets/minecraft/Animeware/icons/pingdisplay.png new file mode 100644 index 0000000..ecd4692 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/pingdisplay.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/placeholder.png b/src/minecraft/assets/minecraft/Animeware/icons/placeholder.png new file mode 100644 index 0000000..654cdc9 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/placeholder.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/play.png b/src/minecraft/assets/minecraft/Animeware/icons/play.png new file mode 100644 index 0000000..d2969ed Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/play.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/positioning.png b/src/minecraft/assets/minecraft/Animeware/icons/positioning.png new file mode 100644 index 0000000..465e1ae Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/positioning.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/potionhud.png b/src/minecraft/assets/minecraft/Animeware/icons/potionhud.png new file mode 100644 index 0000000..a2c3db2 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/potionhud.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/quit.png b/src/minecraft/assets/minecraft/Animeware/icons/quit.png new file mode 100644 index 0000000..7419596 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/quit.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/ram.png b/src/minecraft/assets/minecraft/Animeware/icons/ram.png new file mode 100644 index 0000000..8a71d49 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/ram.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/search.png b/src/minecraft/assets/minecraft/Animeware/icons/search.png new file mode 100644 index 0000000..8fb7d59 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/search.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/server.png b/src/minecraft/assets/minecraft/Animeware/icons/server.png new file mode 100644 index 0000000..7abc02d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/server.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/servers.png b/src/minecraft/assets/minecraft/Animeware/icons/servers.png new file mode 100644 index 0000000..6cc740e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/servers.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/settings.png b/src/minecraft/assets/minecraft/Animeware/icons/settings.png new file mode 100644 index 0000000..5508de3 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/settings.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/shield.png b/src/minecraft/assets/minecraft/Animeware/icons/shield.png new file mode 100644 index 0000000..49d1759 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/shield.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/shopping-cart.png b/src/minecraft/assets/minecraft/Animeware/icons/shopping-cart.png new file mode 100644 index 0000000..16abf5d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/shopping-cart.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/timechanger.png b/src/minecraft/assets/minecraft/Animeware/icons/timechanger.png new file mode 100644 index 0000000..0e944bc Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/timechanger.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/timedisplay.png b/src/minecraft/assets/minecraft/Animeware/icons/timedisplay.png new file mode 100644 index 0000000..c3c3cd8 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/timedisplay.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/toggle-off.png b/src/minecraft/assets/minecraft/Animeware/icons/toggle-off.png new file mode 100644 index 0000000..4ca16e7 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/toggle-off.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/toggle-on.png b/src/minecraft/assets/minecraft/Animeware/icons/toggle-on.png new file mode 100644 index 0000000..b4c478f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/toggle-on.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/togglesasprint.png b/src/minecraft/assets/minecraft/Animeware/icons/togglesasprint.png new file mode 100644 index 0000000..fba990c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/togglesasprint.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/togglesprint.png b/src/minecraft/assets/minecraft/Animeware/icons/togglesprint.png new file mode 100644 index 0000000..1a3673e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/togglesprint.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/togglesprintold.png b/src/minecraft/assets/minecraft/Animeware/icons/togglesprintold.png new file mode 100644 index 0000000..8f85fe6 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/togglesprintold.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/user.png b/src/minecraft/assets/minecraft/Animeware/icons/user.png new file mode 100644 index 0000000..13da4f5 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/user.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/users.png b/src/minecraft/assets/minecraft/Animeware/icons/users.png new file mode 100644 index 0000000..df1e0bd Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/users.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/xyz.png b/src/minecraft/assets/minecraft/Animeware/icons/xyz.png new file mode 100644 index 0000000..8de4148 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/xyz.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/zonix/close.png b/src/minecraft/assets/minecraft/Animeware/icons/zonix/close.png new file mode 100644 index 0000000..93fb503 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/zonix/close.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/zonix/down.png b/src/minecraft/assets/minecraft/Animeware/icons/zonix/down.png new file mode 100644 index 0000000..af41707 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/zonix/down.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/zonix/left.png b/src/minecraft/assets/minecraft/Animeware/icons/zonix/left.png new file mode 100644 index 0000000..b7031ff Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/zonix/left.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/zonix/mods.png b/src/minecraft/assets/minecraft/Animeware/icons/zonix/mods.png new file mode 100644 index 0000000..3650e19 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/zonix/mods.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/zonix/play.png b/src/minecraft/assets/minecraft/Animeware/icons/zonix/play.png new file mode 100644 index 0000000..d2969ed Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/zonix/play.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/zonix/right.png b/src/minecraft/assets/minecraft/Animeware/icons/zonix/right.png new file mode 100644 index 0000000..e9c4d27 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/zonix/right.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/zonix/settings.png b/src/minecraft/assets/minecraft/Animeware/icons/zonix/settings.png new file mode 100644 index 0000000..aca6840 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/zonix/settings.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/zonix/shield.png b/src/minecraft/assets/minecraft/Animeware/icons/zonix/shield.png new file mode 100644 index 0000000..49d1759 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/zonix/shield.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/zonix/toggle-off.png b/src/minecraft/assets/minecraft/Animeware/icons/zonix/toggle-off.png new file mode 100644 index 0000000..4ca16e7 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/zonix/toggle-off.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/zonix/toggle-on.png b/src/minecraft/assets/minecraft/Animeware/icons/zonix/toggle-on.png new file mode 100644 index 0000000..b4c478f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/zonix/toggle-on.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/zonix/user.png b/src/minecraft/assets/minecraft/Animeware/icons/zonix/user.png new file mode 100644 index 0000000..13da4f5 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/zonix/user.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/icons/zonix/users.png b/src/minecraft/assets/minecraft/Animeware/icons/zonix/users.png new file mode 100644 index 0000000..df1e0bd Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/icons/zonix/users.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/logo.pdn b/src/minecraft/assets/minecraft/Animeware/logo.pdn new file mode 100644 index 0000000..bf1ad1d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/logo.pdn differ diff --git a/src/minecraft/assets/minecraft/Animeware/logo.png b/src/minecraft/assets/minecraft/Animeware/logo.png new file mode 100644 index 0000000..1af57a2 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/logo.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/logonew.pdn b/src/minecraft/assets/minecraft/Animeware/logonew.pdn new file mode 100644 index 0000000..31a6ae5 --- /dev/null +++ b/src/minecraft/assets/minecraft/Animeware/logonew.pdn @@ -0,0 +1,1158 @@ +PDN3_ PPaintDotNet.Data, Version=4.216.7781.39227, Culture=neutral, PublicKeyToken=nullPaintDotNet.Document +isDisposedlayerswidthheight savedWithuserMetadataItemsPaintDotNet.LayerListSystem.VersionSystem.Collections.Generic.KeyValuePair`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]][]     PaintDotNet.LayerListparentArrayList+_itemsArrayList+_sizeArrayList+_versionPaintDotNet.Document   System.Version_Major_Minor_Build _Revisione;System.Collections.Generic.KeyValuePair`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]System.Collections.Generic.KeyValuePair`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]keyvalue $exif.tag0[0] +D $exif.tag1[0] / $exif.tag2[0]7 $exif.tag3[0]7     PPaintDotNet.Core, Version=4.216.7781.39227, Culture=neutral, PublicKeyToken=nullPaintDotNet.BitmapLayer +propertiessurfaceLayer+isDisposed Layer+width Layer+heightLayer+properties-PaintDotNet.BitmapLayer+BitmapLayerPropertiesPaintDotNet.Surface!PaintDotNet.Layer+LayerProperties              ! " #   $-PaintDotNet.BitmapLayer+BitmapLayerPropertiesblendOp&PaintDotNet.UserBlendOps+NormalBlendOp %PaintDotNet.Surfacewidthheightstridescan0PaintDotNet.MemoryBlock  4 &!PaintDotNet.Layer+LayerPropertiesnameuserMetadataItemsvisible isBackgroundopacity blendModeSystem.Collections.Generic.KeyValuePair`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]][]PaintDotNet.LayerBlendMode'Layer 4 (PaintDotNet.LayerBlendModevalue__ *  4 +, +Background ( *   4 0! , (" 4#  4 5$6Layer 2 (%&PaintDotNet.UserBlendOps+NormalBlendOp&PaintDotNet.MemoryBlocklength64 hasParentdeferred (System.Collections.Generic.KeyValuePair`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]*%+&0&4%5&  Ǖ-h !5FBbia_3G"YXXgFvEeteW/2#=|ldeEܸI"                                   .\Xˋ'|r>W^Y\xq.?AAJqbwwwq9{c=6^hcǎ-N:x7W^]m~I? ywYۋ7|s; k-N>Y{ʼn'?<⩧r{t,z9rd㏻駟v/_t>;w=sٳ;[o9ʕ+ׯKk [k׮'}^w%nݺ%  /33>^zyI{s?|<j K1q nEܻwOAAor0=t$  PG'A WEAAhz71HO gP|$M %@/(t"9Ud-k$ V"!`%ڑ!=`1:~rbE7AG;{ŃA< `Gq2;A& ~ I8?`Vr kv"̇xwς B @s> w5p~P; _~3;#3g嬭^"A?{>Nv=}rt]wW5)bu??~.A3ʟѣGoj BXW%19D|UW=WX*~YS~z '$f(E^_y[;:Al}m9)˸"z!Z+ +k +:! +_ +p\J]h7o:-vy[z|tZ*A:9I{|r m<ϪyΗ`.:g-yDg} B pKnkdl jS5ڟgaϓ tɗ>u;c> }' ?sX=>v>yro|z~z@?sǂzQ V!'NёgX3{ yg(EL7 4AAFթESyYIT8=ϐfg i?҃L+ځ,(4t}ADu g:2k4r̹ +(cg3? }pOV^:wFK&0aW`z!3pz[Gzb;蟃O!RxX7xٟhX|ց*~ACϰ77ߛN/ޠ}by˿ ^DIxK}緥Dcp֌mry^h[wm<_3a⛑?-F+A˧[ʵؿsٷO6aWHt}OcM&A7ϱVf _dkYk3 '}ܙ bif#aV7LgOTe^*n >Mnv{!L B0 A=~dZ>9F28^Wk]|NzT38ҿ{ k0{K]A0wL];^ps Ma> UYC^/,n3x JJ޹!a{'4yz8Y?cI.TwaO3Pޞ >!D2gJ7=WxCgًYWZI/ gH_=C%g3Pɝ"CΪg' jA˔ xn$g@^VX ]CCGWmH3 3 38v$+};,5 Lq7z!< s^giI7=[%G)ƍ%!Ev5Hx ƭcɳ]͠o< ^775 34醡='[qeiA ÓxFk|  e06ZgǮsȔy; :Bg!k/z>0y|&gN.,J훺g>>cKq{J&BHd=OVggX':- Z!<M5p%Z?:͐!"d=OAF>7X2d#9^pwp}*a\݀<ða?9~zCmӵM;? +j ۑg(<'>݆¸yja6tYdCgg !t65Rj= wOBu U!='n .Yzߋ%hN5QrG/&4(?YKL8g8c3Xw}3 g(9+Gi ^z( +Ժ/^H9Ⱥay5!<{Ǽ'r֕g6P :`͢L  F ԬA}WBSmb< aXBBo~H 3n^[^3og҈ iDy2 \5sZ6vI履z03j ]|y.>CCq]/LCfh3h.zxǰf fOVY0G0焻?U/՚!j]{&jgMUsyԩ^ 6gL3tMT6Lhs*sB(LzgPmBvn UM2!.H`Y =1=ZA[kYGwa3ǜ&5 +kMeV0Baߏg +$^5yPE6^myMxc܅^M5CnA4).0)|ty_h ]{-5; ͎wapo;f҃O-.fGG1;zͰGg/1M" BבAb}«{ʚGq.>CWAya^k//Kk4;zћ E>6O~!K+,сYJVWV+. 9ϰH']6'?[?+~VN݅= u%aݏfS +¬y!nХ6M qvPWl/.ꆏ +koP5|g(#PxY\fu?e^PAyunnum:asBSzAygP!} k Y[g jֵ7+gqgfDMO7Kys WxjJyu@}3C{{{/hzay +H>ƮK(ϰurRO/ Ӛ@_Pa]/G|C*g?j)]EnnhoLvCyf.&gX 䔬05+R b +/πBv=o~(lK4a Cj_ [S3x\4~ JFw<3WRV==\Y?7<'5PO-ϰMZߥeT&)V&gys.>ڬ&g(#~81kz4gX֙&fe+`,Jtݰ}yz6[w^63ìg0_ꅿtÖWҚxEVa Ocw7<ún|>W.]$ l rlV5 E +zp! +֚a;))|)l),f*i>Cy +5&:i@>Cu <^:P8j4l&rv<' M?ųo?jF9zyT7Ğg(fQmKO=W/Xtvyt N9_30<:jx [&3#酮uZ A-9g_ 3(0L x;\ ەg3`F1L@6/1x_|.E`g`&*g:?Qz4"32oZ3_]zfgP!l! Ӿ%.y:ߤOuxuIΠЏzN54Q><ԩ~جVfWNU^h%^?7OC=^{muՅ V/gz=>}ի/}K뫽+zoױvC=[wu}EmꙪլU} /`EsiNk߱#G!e_% /^\=_SO=eW_}uzk=cPx(u>7 +x 5^a3HBg83 {UϰwNaOhj j=C_Pyq}Bg83tog'{嗍>gN:!^oݺu/8y@q%~CKV'#3-~W2/g +0 /aZϟ_+X3Ц_r:W +_țl{gP߰t_t|&`e~yb!៿/\ͱtޛ 3̄g ]~AyqD>^u 3^w5c&<q~_~?ՅƜh 3(0?7(Jށ3g9 +r̽7)]Ѭ%\M_p|P| =2וڑ{ 3(Ϡy 6aɳٳfUm1?a\3r]}qAsgPAy 3ljԋY33̙3z+l^"P=7૮÷b8+%gPAy 6΀yTf_tnz=8p5{(1rk>y_|H,KgPAyg >GotyۇyQwo$uy-N8/(Ϡ<%g 9:vɋ;oz/_\zfAs >umXjnBs +i q5`,Z ZkycGK/gZ1vZkZ˪gJ֥ǿrx:׽PWb3 B&k hzn߰ZKzD?DqZKZ!II\.x~]{cfgwtn8x,Khhwt_΢7{. Oo*Ut}U,aw32^㱴wt,<>zG7ib]E]ͫE? +BhK^g*L^Bgatv3-ӛg@e_$3f :n$ogb 1ixLph : {<|NI9;roOZ|{ḍ[9_Hgtƒ 3(Ϡ<<b˗}=t ~Q2X; 9 +K3(Ϡ< S Kϵb." ]If^bKL3Jy83h^bR! PaN>\}f3 ]xǸ$w ^JgSͫaIgP3?z/Qe< ={ +>|Ua"άqkƹWg#+XgZbaB1-d=B(y.<ݻwB (< C y!q)Yx,=UxK.'ϰw .qݩgg3H94x9Ί~a?y6r_q贈ZJ<cʵ6O̦G|=>sCg^R3|\Т_oKs7g^PZLgZ%"m=ޱO!wzGsv XhhI?7;*b 9{G׉9Q%܃\+ra EQw By){G[Pf'3cT{G/g@ȅw+x>L߭8k.sI~o{ﱗmvt se\s ~!Yؖg@x("橳} c5Ν[LKfz@VE0kK2{~cدݒ_=a}C +*#?Y/}vlyi誊%$6y\.uxDCe.23/gX π|%_W!.c5YM6^i+mgʒx\\Y*ED:#ΐd^"~o*Vw8q/1f<b \ӷ]3g<Xc><;}Ϲ^3|V6%u= g(p)Q O15^Kڟ!mBL 89KgDN=$ 3L3c 3("rHgAپO>GS?&<ÆF7ÇNV5")gr2(ϰx+z6p.<:ψgAi{OgHg = ̱e/Y(uMFb6EK28Y4<?cv"jb hs>zgg8c TCE|?=o>0 `|C,y-0^^3 rS{ |Dg3H<$|C6!C4a3,gmgQ9e5&8'x- 9g_'?o"g',Sro3{yx8>HE<gݷiHN?ggg3 3*!=0$ A,lL> ytaC 3xNLq0/1 3prI7m O }g$/m!ahnbf34=àgr uXl.g-I?s1YM1m7787Q3 j&y!F!g粷SKgcZΔhp3Hb bl|k>;&f({XX*աxf}Ou&M ʢsH2l}3yrѕ_rӋ/U,viZ–g1~[C nx,k-$lFKn0b3h"l e*?wZ.R`|1]=S3d4^#ZKdI3 7,A|\U=W ʳ,lV.AgѲC|C~?bdQ9dv +6Hz"8 I e_>\,Ar(BW蝗PAyz3l$ yĹęiļVye ʦo wJ}k/މWSb.vgPAym_ 3*\E7 L?[3T 읒{n23YO_PAy73m{| G:bU}qf*fPAyf߰;,G  Mb 3etʎ}{gP%P')w y ;x-gPA30ޓ~.Ay'_g별yC6bˠ< Ar$nz~Z-Ay e@᯽/5Df3 Gz\ ]s!ɼ C %_q#H91A f'+Nɓg۷:r0K^qg3^`0zB%3wy{"-3gPAyAޡ"wpu% +y ^_P'7(ϐo3, /1\|֜瞇=r~_1g s?5-ţn3?{9H#Kb9Q[SXƯ9y|*yc~~Ay xgP9 a" 3x!b~nD}3oGI?6z2٭w~:3M=ÅuIkoPAyx7gPAy)yz Π< ab  v[y-8l8Cy g?/<%g3Po康7E?s!ED?>GgH7(ϠAyݮ{kn}#ghKз^vFygPAy @ۿӢOX9ΐπ_3(Ϡ< 3(3H^ˢ(tʕWU;;X_:7[JhqzM]wꐟw~ӡ_o~|ז.\X8qz}s疯ru?wu]]U=͟vf-7/^{O]]^=絟vZ߭tIU=JWi^Aӣm]/R]Mdt2}KMv]D/,v[?X/iF/. =C_p3Pa3n߾|g֗^zi{%n޼=p8Co8L3<}tyƍQ qoh q#[ pnݺ{35 }60+nV!`\ ]/xz<Cg3TAgas]Gzb=М 8âҶ_X|s:=Ð8Cw0 b ۻ .\C3|34ֶ7|syrf~/^,Vp/>^>x` /l䷇ҥKg ی?poD ÆCgh3z*ƀ_];f0rn˜gH(27ac ^b }q<î_sng|zD+g)27c،3|K_*=>6yΝ;ˏ>1З-={ȷ5x_WnbM|=W܄rM(7D܄-7B&`O381k&r]50+:t: ]^!+b CL&,+D^J X3Z˴j-=z䴎dJԩSƟ̙3k׮M3L_r2j-Uk9Zw}7ZKxneW^]e};⿙{WUj-e@@]4ySg + B ^!弄?3?b qrŶ[o5^!鼄gaļDտ?~5΀ȋį$fS6>p[˔yP1y8C/ϰ3Wj@~y}oܿ_!c|뼽.)ORaY}pFAJgND3$3\{}i 33?߬1ymGα"V[gݰ͞5!έgj~A09}k3d3kzgȓgϵVkQCg7z@aoo<y%_UZ9 \++k6mGBS6yZ w^"_ ;+;/88 +g1|5gpc3:SVXֆ :mr =f?gh1q)\~¬}ôxT|g $7*.Z) SPCDGü*`ҿ.k(3g3Tg: kgi3g3?b |PJāc # !p#!3D 8tK %v|6UkZ)ZL~1Uk\CGj-Uk9V%sɓ'<] UkZ)Z'\dk=vѮgr,PɗwzGPkyG ѹƇSWt=Cǥpxc ~\>sY7UM@[vit1O2Ϯ }y~g߃:߿N4&6is}bYҶ7,9Ƴx!wy}C&1|xT|}ElK˫] 0.:B3L(Fggx]6&NkB uNoYuV<L|Dʞ vDTqR@O< ! +π_psT)^;P^gͬ|gI3`SOi*1}x8)4^Hy 1xW3XwYGq|綺^̾yz9E~ b]sg8d.!lxn  9rEfxIm1R;?'%x{J^b@ƾWxDf>f lS.duVsV~.0eZ3vY* x^xnr*LI !4`9ͩ3?p/sRyh}ϔ3 SWWX^;`)mk8(y@\إ/$7w![Ghxo33gp\z>r΅S3}Öw  +_?sR;  gpe;o .rYE:<1uċXyΣ;HM[HyKg3bzf=ly5uj]x[{e>!F]P͍g_sTo3go`\T͓Y'YW<g1Ma^G1#3^ɋyggV;gAOg :"?bMI%g>ObUj#ϝg`}`RߟZM05.^i{]b-Ȇgp{ұk(r~xsawBg3\3ľSkC]oYOIbN#Xϴ~g _Hy*8O'3}$zIX7KE;Tʅg`ާuu Nspͬ3܇%jyY8^VL`TZ6<ߓŚz6m>4g9I4bı˼o3p豖/SO|Çe,f9ɓ'%'I:.wG~ &Z[b>{ +]x{/nw?:I+U~cj~sqoX{/kϓEf_`^ʁ{l8V{3Ygch n7(}&յ^xA~q&~a%m=3&: Ui 11<'5K#.1gbf &,0&k&l .1#kMOm8?Cr>=Mc}m>6%?.堺N3% Sa{0:Z}l4\qQk97yZ [pg}%i`ES$N|܅Ϟ Wrabj-al4\pʾk-Xb_N&ۤNR +)ZË;[x)/EΧwKÅ+c 0ԥO7Auw;v:_BYv +ës'9 .9֩.!s$DjJ҃o;ǨC րGJ誏$e)Gr)v XV9I]PIxo9\jRWt9ư3bKIr%LWt`ZXb Sm"re?hcc_K(r 9O'h||kCć~8BS~涿SW}6q?0K<k=3$Mxvļ{&pɋ—g1`a~mb ?\ysbxDV8Dc%&EoV`] Mu!gCGgud3_ཛCLHp.|yfy gxM~؞ww\זPϏ_'.ɯ]jcYGY $qRj ΚWg17ĕ`#oԶ.ɯ?<9~؟yLN|"5.g-f:?7x΢Wɺ_#9kq蓔z^8eIZ}PpK3PH}LOE9M{Y( ĺ){@Fe$DZL|rvB}0}3I2HRbK6嬷+f>BJsU<ľ7`8c7m>|XdwLՈHJ5/!/ID=&ky_^L0^.<:;]h{9w^eLgό}o$)my j6=5A*}*9Xek;1$Y=\~'{Ycm!GeR^/HR">zH}]z2 zνm|dIB0s%I:1s#X*.- +QіY9!Ɗpr$,#bot}-CyTi+$I;hxρC-O4Vy쒔SG~s/I/#1y"Ii\8jU*o%I{ +*$rq2/qԩ'_$IӧO8ɖ rz<b_$Y rD' <%$)ɖǏcUJ]3CoIC 7$EX#-Ic͛Ax~oZ 흉R@'6 Y;?J%r"11fu9U4U.izn߾7U-܏?*C`?C߹j.--e[_K?χ]vweVk"B"uÃkX7eF#wS˼JUtrr2[YYy"z{6T"_ﻻY7fo߾M*7oDEJ ֢:oe\KDuCH`L\3/Q뷷\Kd7ƄjQ.,, $aqq1wQJWhra sssѿjM v;11{LN|_`>ΓVlssU ۞TcccY郃KbD#E/1VC>wsiCN*c΋ZegU$16K¬S!qZ3̪u:rnnnx/ Cj1Z3̪uVj)njjQh-!gV>}UEqZ3)R"|׼>~T)=n^fzϬZƥ0$0T%tk`h|IޗZk2PC2gV###YZJe߇ !qZN3VYjPs= +Y3uBߑTTc/Nkǖ eMغ}؟Qr>/H%!`]iWWWzTɑ2an5AH<5FϨZUY/t:GnK-{{{34Qjrn R ~hcBcPv^8>>Fժ޽%5|H 7 A~\[[隁ZfsU8{Pb !1ڏԃ|hy 5Ī[,5!1ڏ1,omϨZAcQb ?\ VGꓑe2K M)/--oH`>W YE#ɆƮWj`>jmy%6Ej D.[H_媪je@ +ϪZdPZIUᄍɵ`ߪ:8(EAnC}ƺ'5H RԗyH`̫jRϺ2 eq:81Eu8TUiyΛVWWy/24D?}OKW ggg* 8 ߫' 6G/J6'RU5Qn˵Hϊo޼~?* 6[cLU4dߘ: A$Q+WTU5$uZVDUUsEJAٌ}Njs-RTU$g$H 6Bjζ);'U*ūH &}QTU" *h4_UҞRUzQTUupTa)NzjzRUޟ^###AUTed6.?%_HVU_~g"2z^UU+!:Cݎ~J AD +WMURk{U~f~}GlzL ill,{~~D$e&GϷܠE$2ywk<"A/K~."@̯lF+TUaނHP72$0_jcRCsGonnAHynʧOedU%zqq1]gH5B9FU#녵5c "sr6gCsOLOOg(TVn =Z>D6o =Z>#Dv稧CC-?suuuWEU>^j$/Bz$Csj]\\4 "ܣhoԄ:>>666"h>_ Av]^^o""&#e-&+T9ggș]Ch%@&r9L?lgg=y^Rke~wD9#iFr@oM&''-zH\:EDİ`>f Ck\2nžuc.w!AZ.7įy/""5gf(=Qoɛ%EnWMeĩDDD·֝%?K>kyгvh6R{wSk/J<󺜷Ȩ2M ?YObAPB#1n,*.(hDŸUT'8L5$ pr+{{{hZ?/JV8997 qww+oq||\{yy)5&.//˚v?666V^3[ji\__t:ba^~+~Gݎp|+6c<C9#k^tG3677cmm+N/;\Y_h4Yn[z4WWW1 "L&3F'L򹶷9OYKqqqQY_s-{y^"95z,=Ud>$ybooy=w֯=3yK)ǖs9{>C&\ +,] iS\ՕOUR+ +D%r0 &90ـ1hqggg{gۥV -u-DWݪusa%K,Ydɒ%K,Ydɒ%K,Ydɒ%K,Ydɒ%K,Ydɒ%K,Ydɒ%K,Ydɒ%Klò+ UUU"V(:l}n2;Υ&ð Hdɒ%K + Eq +4ThC>8%%K,Yo(sgk0B\B\RUz\OW_^S=|gٜCx*2gz} eo{wː,Ydɒ`|8P,!.qAܠ P-N:Q/ikC>G3lΡ^Z'cϪʜd؉?ϰ8[ %J,YdɆӲs/ffPWu@װᵬFYhZ;(3Z9FǏC}g]BΣC&M.Qg>^[SwU_Edɒ%K[9/oEvee51\NKVo`f'1x=6Iu똩zi:~^7]1s>Ϟ"LyLꜺow; 徯V*ɡ(Sɒ%K,:2y5s+ G8-lo7 +mz]u3Q@wz8La[61[mzߟFag0CxozM ƤMhZ *59Lޯ*|®]dɒ%KVBIGqr{X&8mQh=7TM&u z[5u>-]z~o&_XgsEIV/sOb^m9)ƁG|8Sn`> Cmu9D, }wJdɒ%ۘ ~Xhjjߢ.ZmyWiy~zFN`*Wfb ?{L4tPaL/,k6aK=kkU[絿=T8JONֱu {;E೏ֹ.(I.,;[-rѿ7c0_'MdVQpDy]<܈\]hף ѹovJ,Yd#gK0P4TJqђ# 6֌91bvM75+^йndɒ%Ka[6̓֊L@DP+Ϻ>AkJu=/u|f 6o',}>zpH{p8 [t s8e »؝½:~z1 >}{t7 Ws|'w:>=}pppp=T;*S,aaZ1p 5ZrMuE5V-TwG677[ZZ +^ύ,Yd6bȴ5 +}u_^=/5l״텝uz!‘ƟpV6åe++7굷 +w  sѱ>#|!7)Axpn}˄wܾߥcqpNC  +*SX" qx y~1UA[zSˊ*qJq +q +8݁ɒ%Kl}>u!XgځfmZ+:8=QSױ_b̝x<` +cgƱg>X?>w_.ϿAY&.iKp~u!Q)g煗/똯 +0,|sgA9=p~{{m.wX*3}1 g +'/r>{K##wdlNu.t-t[-+ omjjw*n;2YdɒoV5=yX ^'h "lǨOXh0n'S{7fOLYy!Yѿ{?(>*<)<%~1DžO/ +_%"@H«!ƫY?w _Vυ;|¾?,|(Dy| .WqU 2 \qp|YN=*uu]O& h]y1J@G]]]+>'ф d?gH,Yd oCߜEg 0^kd5 +;^:f_?8H8L'<{_.{broqc}CczFNQ/_4|+!X&6FV +?~%ÿ_gBY}pV4*3ۗl.W]z}n\"~z={2_ U/ȯYp|+B0 ~W["p>x9WOb5 ECux,?J]YMg-I:YdɆ +fuQO!WOn9rĺkМ,u .Zp0 +'guO>g@|u{5~A9ksK jpA?YCc©2:cSzia<bqyp/kZ>3`-dMd}t. \?yPo [}c-}r!p_Ddzŗ:/`mc+x뢯>޽@ky? c菓 s_A\ \̣?|nٵsėu=_>iŃZn=xKs .n5pUb`pW\ҹCOuM[L<$K,Y>UEqt*2=F5/g ؏(O`..O('P?C$@n!g>cu)+|_`a 8)C,!: t=&<~FYUϟA%q->]_S @mJ4B'XG"mz_R{QN9=N.wɶ !Yd6R=zt/GUghooYMհk. +Q!OXz =qy rm'PO=9QH.5p +?y` ^ߧ;%eyC9Ai?mϠo"Y[7¯ ^{U o/18s +y67'Ҵ..|Is9݃>$<,48ɥD-ljoѕ'D=+\[8->08YI2ԡEv8CN/ }$ސ,YʘAW'BռXyRec3ul UUU5G׼J?>v!*y~Bޟ^`9?|8K M>1uQ,!yB>R +mWc~4vwG[7¿ ^^?~$Pz_ϵJZw{{?+uXNi=HiMGHOrS?Ǥea<"_?z N^h) 0t=~1C"L8AIqtŝk{o*Ѭֿ]H,Yjq***FczEǴ3P1lz3;?8z,D}ݟ@b?!D?5>k E` c]ɯW=o |5/X_h~i<&*DOz·tׅ _YGxEcJ=3/<z%RuN>W&9 +qIx8?asyz]ޢA ;ХDO +MJtB3@)|N^~Au[zۼ'|ge~wx%[.kOņG("Vѥ8 l#s$3aPI-'=єBߋ>BxgWaG 4s43tw2AyСDp5=/j jr&fud6tX?cz}z: #~O /o!Zf6kqW+V#JCեWoZ#yΉUr8ztq:BcvOq^cwz~S{e{|Jzϝ%Klòu-? Lf "=Ds^:vjGY đh' 7]YSu&PO(0><kzQ+q{\cG4k hտ뱛 :Z W7ۄtCzx?(D}:@yM@/'B]X }ue\|ku.(k*(. +]켟Cl>#Q:Okur.-8 ;Y@ӇN7fI:Yd+T|FY&LkҼ7P3pa=&=w9FǞל^@g)O; O0O(w( +qΑ_<~8/kScv6ỴܪqEc|ٍ W\/c빳t̩)]3:"2L^+ܨߩoѱZݪV}9d1?XCZ 3ApÁujeˋX]K__ޞ_sFK}'/np]݅;O:Ztf-z(Q,Yd듕rFzM3Fkn\ {݄›؉zlse:&>>Y +w(' ԋs}ys}k >5Wt" /npsZ[[Nmkk;Q+.p?D<aOu :{>[cu;_] t/`3>B5—D EzT? 6`?TTs˵4RQz|$ s=)| ߷sz(Dɻ4n7k5LcyY8Zc{m'An[ Qĵq,YdĢsA}:mzzMOќHֳ# +»Pg0zCpr}'x=,5u^W =nzliԘupi?T +uvvwooo_wmsu̮ž:~_;Ho8L0]t:\΃<Yj <&zY7H!%zsIcvDb;jaԨQ +[ z|xL)lqtBaKaNwX,ΰDMKtvl5.f 0-Zj>A+Ip_I? 6.^7=FR?DiK\D9M|s]?K9ݨ'5i,n1jz^!k`̈́!jEwFT[ͨHuɒ%jC.\T+B3:3z~[t~ެ$9Jz/Stܗo5޼?c>z? +A['o( ?YoElu\Ku:T㵷ƍ6^5O-9p3G1cf;v&vuu'Lj_=NN)tcf7-NBi6ust.& 憨:ٵ$DMf=$D!#!%m"A4C8p?{}CO smL3ƷVG9Pf^KqCEǏ +f闥} zjW1DgTqwCtτdɒ%[v r.;껼DPSW[1]|9R8Yǟ/\ޤ[X.<%|JXazB̟?@j_?t.EoVw ['^lb5؄x ypnWVZZmkF]Jwkk$Ǝ7n:X@-A:~G 2Q\d3''|$dÔghKp!D=/|/D$h0xwC!ȉ;t+ܟƄ9>`)KYwhO\|CבZY|['cJE:t8ZjxW;uuz]#Q +맄dɒ%{W0dzL+/Ƌ>m4+Ո2{B+Cz==>m#+_3ᗶf KWx܏N#xʿ9\k;>Y8 g@=Xc/~F6ŖðցtŢ>etsssY-Z'L4qD ԏ?N׊Ԋ΄w?Cku~k<5}O^Fϋ焧Gṱ9ݾ'qzaYO^ χ:QLt!dɒ^czi7[+ghf>{&h +Q׹ǯb>K'L}rgS5[`e+k󔛃ő/2ǑCc?Iok|h>Dnxī6ޟN_Z2g(;whX5`1NtƠ"kooogh7.P;i$P#>PxX1ָEG}ggg(}1zC󪷘`` {S]􄄛!F҃_%? }CCkCPq;uwPCK s>kZUE{8ϥ,W;6~fkBBG6 y@އd~cEשAdd<Ή.8|Z@wAN cu\@,|W ݹ>aXNB_y0ߖ[/w׼櫿퐯Nm%g3-?Fޥ@>#'>}߃:kugk1 +:=Ǝ 2e +('O.qPy p =W).Q)Q)RI/ʆbV=:J"o +u=ry> 'k.>܈o4¨M.mfzQ) )7-? /Wl7+WuW w ~2A߫K (3溑!Yd0 `N6 !-FuM5,q5i.ZJB2B\Zt!朱OcϿ2~J?zB>|ޛ99Oع<|kkk_!\=?5f` `]XC?s ZJoz=6G;P|`5Z+2nW +@|ԩS vl:qG>z"=wgs AEyAx4 ^Vz=]sWsۅͦrG3SUXhBspH;隓k/~2j`4y@K:tYл!uշm1/YL.g;i8t ֛Y-a=&ԫ86Zg3zf?:5}[ +OI8p.<܈r~b35~4~[hQ'Rᡦp>S/qWkc^r0uVQ]?cC~Rnq us+9^sϕt>/zc;;8j9 +x k.VǝK~`Qw΂WY. +x젿 +%M1c +'roHl#2-X]6uV ׮7dV;)'_)=|MӜ$|sc>_ԯPԧp. <9a/GLy~Yj'177}vw6Qcvޤ?0RAKϿ Z <6&Ԙ ].:wֻ]Y&[dxCxCQisCsoָi:5f&L:Uzn 4Lxo_{hXb|:N+4 [7#~_wRf|#`b3<,XW[X$/D=I2 w(Z,u Cd#ۨ VkPy`Эy"%jyb n s!1r~ⷥ9~y_z p +MOaYg&G3zt>4S}`pV% +Q/!k.8Nϩ᧾CaZ.g8~B-t +ac3axQCqjjڄNt-44hUQ#Ts)ŠzNӂ^by4G *PAC>f߁;E3b햗Ad { |tпu%3|=k%Klݛo$oj>;Ym> zbB NSxX(y'fe J +ugrcjou ?tH\qyc>V}@_@t ' Ϛ-WuǾi_c9᪝Ssi5 /ky@c2QZ7FX*6RjQƨUƭEG}o7Z Yj9B}1в&nܡ˓\+Yd +:˦> _r\DS>8Q@BԞC3IBԘue{+SXV} +/'Ou$YѕdOoZOF 0s;s<>Wt3M<KӸAj +uhρ:Za|Qm_pr(ľpйHvmo#矾TP#j=B-D5o!Vc5: +3ZcBV+5^TN ~?h[.b58e~:04ãA.*`x){q ϙ,!Ww \ >e!pI1b>y%:+of!qd6(+{J/[-Ԛ_005Rn t%X!C G%'};}WJ^쁨p}\t}Hs5=%\kuC߬qP1O݃Oys&g9{T~=!GWw*9z ӱԄ|$Ĝ2Bd5$2>J߉B:OW7/%pZƋ/Ͻ +0s ת +fs*z20Sz- kw+.K=?=\bypr&}1wsp9>|j3aX׼EBu@Krs] 򝼾ƀ`\2ސbɒke֢ -쩇zO?򣘿wE`Eyrs|b\ +-_ Ǿ)gܧsy7>.B_G8A8\؏7=\{\L `ypz-G®6&䉑@$=׃jm>I\W +Q>U '>X*ΰ8LyTB3PUN۲).[@9x5@LK@KhWI0+{P7zq C |6~[VdEH,ِ~VYBi_7e1ICS@-X}FX˩id__ +B?tƳU5j +$^bu..W9[I^G i4w LC uwef\4]#rB->:7;Rîn(Dir^q0%1-F2|G eG^?:K:KzB0 }5b1=tiM'kA}/@9@n"y1 |kܝqj@ !\@>jdO;D,xROq~[Y70ɒ%[}#>gV-0_gb*Tz/qK94DZvkZW'J~ jؙې}>M9ǡ5iz{hى3qza&>\!XGE쫑i`V~ԑݙ$z ؇߃?"_?1} &.$YKܨp0%h4CP|j3NǙΉ֏^[{7T;xܢ4`x~58CZ!S,}nVCL* t}60+Vy{·z~D=2y;xY.+zj>f܁A+x99qMPkfIղfAHɒmP_|YhkF4wB?)^wK\ўr;4Ě/Ϗb] e\mKy O+{ +Ir8sOrY3SkT45{n3k-5hZ3âm*ӫh=s5Z@c}ދ6F7< }DY#$䇒q]-胍&QSZ| pՍ` \AWc ײFOƗ^x,5;L8|49P|]6411ɒ%[/yZh4ݦc6[oyOVR1H;+rZtՃk؃3)s·Bog!y~,v| S5L9]6G;װTX.̉:| ,t+MjO0veZ ̫]~zT{`3| h\}| ROB~(>;j6ӘLƒ˵8j(8C۫j蛩4snyt?]֡s$Wu k}j& mϛrwz-;/ ;CpWW7^>t _lC'zj=\b]'u4E)1B ɒ 'f:i=w˚VTU~| o + +[깈3G6([`ߍdWz󩖇XW8AbomztlB/u/ +2 =jX_o6Yd7bsԜF].y:c~|![X({=$^;W `N> = |)B s +{- V#cw%yh-1'FF\?+ ԘPNqFbXbN'q8l!V ^W8{}܏ Qw?5ڧBߢrna >bBPxCdCcL] ~u';FB~Y-1G3T/&)|ۇ o}!?)D=D!jLSyUB\wW+zk$TV]Uڭ6.ÉND&d^Ѹ?8pO #:uhW\s?Fc6˙V1PF5~TYQh{3A}9}qW,ֹ+ccY+8Ry_CV3w`aqܫ~D@|}EZkG@.#v}=5?{s[8 ĪZbTP;T,bUdֿw,_a3&ޢcױhV=o:G[LGr~dt|L@1`qp=wp1> +!b?u!j]WZk8[DFLׂ; {w.yldџ.?r(Л߇kD.)dqj\tWpm`$8R#~mdyq6a>[5[=єSt|FxƖZu߆P@ +ra$7gw|ɼ߁|;boީ Nj>+||T9ܡ4_  Q.}uo5?V]}MFҽAzMcm$K1{Lj1Nv$N㗠#^_.oayե=܅+~[o[[&uǯj0e}o̷CGsBϬsӰCC8 e#7 Ы{7o9c Jr:uc͠ߧc"W-vdi! we}N+n)̲86I忹?G{iΉ7o @:9/qOVc`k{ s9׿?3 )*Zoaq6ݸ\i>54sK} +FMX:#CU=xvuỾu=?Z"ƺ9c: XarkxI'_UzV[?|T^zu+^9k3‰:޷'A ~vB |oH>d6jAn>~z 8DyA%:~2?\#[7K,\9eάJ{tmzz2q| g۾"e B&l )y+oS? W!g `|.پM,9h!#9_<μO/@mf?6ryH!XЏt&>_b!eu5o`UY{)㸃&sp> +fݺ˩@ZX!jqO}<%V77Xװ1(|bgԮSc\.R&T&\Ck? +=KX`sK|ID#9mO^,ຏb^Cw&i@%K66i@E/-%Ũ7.hXȵg\ +ѣgcNa__ޣ}p><3y\7ڍB4pY,5p o/{'Npf>i>< _0{:9bO'0p2t]Wz^H[꽷=Dze-2ݽ7k䓐ڠ ȷ;G:tn+,~}'+oO?9Ґ+Q-b}GVwX6{$aWfSz@=, +S<^s܃O.OYAKB frg_rt~SlҒShU"'.4%kC<#*,/Q?r@myO&&g$"z9++z'@Zr}X=d۵М#5짹`Wy6w1ezpD^gY5||~v0:xY-drϞ2q^exsx'@:|yNF} \AkThYL&ZTԘ }GrB+Q6zS=:Otzu*grɊ@wB] uԦ#?V{1s7X2<':5N7MF[kOE췆^9154`D"zX|cs +egNnEX.):׳Gۺ"g/G|+-NR/ϼz}=Ccp2L4--PSG]"w~qJ7JT_ ׼8, 6ta÷,,N.&Ve[55& 9WpAC]B"FAN$9~k O.j'kt@+.a9CF#ZWPϊ:hq[ ׊ؙX|~Gc^H}2= GJ@_g*JOYdɆ|Pi ޻mbݶdOI=6b财B>ZĈoF!R[=B>o\jKHжY"5x!v<z=M7߂~VgoB_& +QOpo!,֜)¹~sd! %ޒ8{>B̫$G\23]Q>kBI'P\ %[Tr,6ML +{jg^g_S!pQ%w(TXLJu}Gt'!>8C qflcmA[qz ^ZLmQ{.BoO[i*x-u>sYtlz |wЗ-E]1Yf^#Y}l!Wa|!E[9^4X<:!~x +5\}^y o3 04+ˠ7UmSw45ozoy?r槷UC,4=;\P{^s~煸s7wH"X$1I99x.3V +>y2pITy^VTk[svcI*q7/u軡G^|֬3T.&k w/Xz֕-ŷzěǘ_$|,[Bqs{e~=K8r6m>.xdn3'D7hԠSߖ!rǜk K/͇}co۹#u淯^nwNO|- F=CfƂ8,l3ZN[(738|u{|]9n߃~C׼hA=)~#36 3gZ{+΅~'sz4bzo?FotgCo:,3h!:Eshˁq%ys򜁸xPpQse.GKw:g_k^= ϰ8CO5|zJb[A1sYڛ-nu{*>#<*-r Q} C7$lur\|8~!>9 leȫ_ K$} _Ar&==ls/W1swiܜr@~PWWG<ډ5V'_rBMyB^+s8zp1AL$v}W0plAu*&ֲFW^+KMQH +,@-sCA}c*}L>FʼTϒ׃*ЀHF5oH` /Pk{DN"s*Z=I{9Y]~|M'4O/r{SjGj7&\BX5ngx|['yrAMNJ u{2u򜡧n" r6񅑗^#} d$ޕ|JjO, 1σ/M%3w0 ,r$Lם<^Mȭ}xi!ƤhʵWD~$O7|.k{]- xZsc:"kf +Y4B +\ S cWB?XWd>i 4;FՕ!yj-ɧ<ӝ쳈Ia-'G{0FC9햅Ob yV\W|H9yC/k=!fǿ|e +̱~CF>ïX4x}SE9Xz.bВ0A.khTے:ϷMCdI1ެ9PρZ|=\mG>uk1!Hd-uL9E4=>1=zkmNj.gxnGO9aF}}}ƴr$ MMDhFFǚ==qZ?_Տ,-[}:W&o%X XGU3p3cR^gρ?{4;&&~B{qC|Nc?]??VoH6m( .cރo>TMxJE 67E1BPg ~oW3XoNzs sѷ3}q{5t/;G;5,^X<4}Лy_\ _P +7c!d=B4tN!`oԿ@߈RR@u?~~ zpp:ngAa8& -#5555 +uB n="qU?lЩ&,sKtoŴ=?q>[7>j4{>m9Op~^hn/d!w]X70biU@]6 1e/(e`{K^!;Md !%_2~QK~{ަ-v׼H#@nnniilmm(~_|OjJ<}c09g#7W@  c+ly9߯ǗPx@#S'\8aQoBc,|*ocm8RsuT`GtF1F .¹no|zoH6m8 zWgu!}w"g6O]AnM/Єv!Z;+* + #򷅖?Eh*TX>؍}z  b./>Z; M 'xB|)z:z=ZB)+Aj,s},᫥uPSeyN:4Lwzq}MM:>17~QU᱊ +]7$6]rͨo7D,05 al}.ո.o>3ܙ,ԱG=ix=ߎ?CXF +Z/y:PKj2zV黠r?IÊޫZ/xC7$6\q9yhduw5ĔOXĞn/70oQ+5 #)Mw_Vև_ypF߷|OAcЈυ=^ӌ&89k{G>t6tgg9ږp+& L,U`9 ?빃u!:v?awN4=z{q(k2a>*ĚGzCCTN1Yo9]߻r<@=&zeP`ߐl$ں/+ V=<[ݒy\,FqӘvPMnZzUHlll!SϵNKץ׏!抯 qOxJ?ȝ{cVg{PGco38m0Sgax^lnX(7Gc?](:F \{( `+ͷ^d~aZC//3{ig~*2[Mez|[QG{p{U%u3[|z԰-!s%g=b +-hYО}{b!v+q֣KmZ:/б7^GN8_D ޠ_s\}!,*XKtnY:f7t08jѹvX"ܡ[ ?nS㭳ufa4 +B+Y-q"%Eu],Gy"_J߇:jZ5nZqnA:I/h&SO$!ܹņ(ta3n QYY Ԉ'Cfڿ@<F+>>`CM\$Pq'vL$ISa:WXo8ԑG+셴'S/yt: X4lV!j;0߰_^!j!/GZ߳ggS7b|/1v@nFP shYN3y::whds6u:V}s3!qzqj!ہ D`>7 '^H|gJTg +uh'E3ӻkI&˄M9 ~}u9+V 5Peqj&+%;{\g FO hbo%!+':zS<l| +=:$v^qInaKvZv]*J:j[?W#8}q}W?\boa{ցCC9~'Qs DmBαdpW 0sD^>wOV;y?p膉T*ۋ0a8̵ ќ/o4%69 ?8O()ĽykckmwpWC]_aՖd*%լ٬ݬߐl_7GYt"6@0Ͼy1q,XlMbWh,x` +]dWثw? ~,]bKB'GϞ ?Į!a8Fg+ө<&!wV+˼=ķ}M,"ACcgZe+va/6z4#S#L#UWw0_>s ++wH+{l{=o~b]9V6'~⮩V5u.y(FS#7X>U1?D\h.^|ߐlCտ@.|$|8kڵCWa_/})W`>z0pMk`ݻm߬8^qp4n߷鹻gDK{u)xǗkx}]!\;FU/}7 fZ[6m)x≚7Gg`- ͪuzk.Ǿh9Y'k sfW58TYComK8㫂.BWOLJ࡬ BKbav1{巊@\ހ$oHyE˿_ x |!yf{հ_]#g.' \ɾu= z3%\#ܬyN-‡<}A.D,9|Jf|,ĚBp;B]e~2qY+ȩ]>6gj>&c:ʅBw@?ΊѣG'MT^ןi9M3sf_~M:.0= !Ũ}f!{O7`Nac2,1D>4܁=5q |&C\YY߰G نž7hߐl6fK.|~3BkZujc])wjWrCo_=~̅_};1a1MzWx <#4@n\4Y&SB!ڻ׉3Ԍ5r̘1'O.N:uF +QSzv MOqȽ|*'Dn=\e-}='exw!9 A rCy\> j&C <[pJ[cBkXeROs r-,C\=*>^+ƞ_+s=;9/3n.rƂqCQaKa&RHs񅦎z &T/TL>8k֬œ9s6aY`޸f5 -p\!ʸC1 )K =` &l K>X˼xbHy2Xp7Ø(vkhPwn*5kmil Œ/WOyԇ;+S&/$s:W|ȿأ=YGYaW_f-E!!I6U"o.$;ky?Lo0g V13&Jo +YD߳t۰ח o\j?=ǺTOp_>'p Еïxs?{4b ͋%8{߉ZcpBt< ;>=i:::d&LhdMjfΜY5w܊6۬8)fLOL"djSv{!Fy]D +#cYCj}Ŝt{ j- { +=ǐ6$_w>y\ >z~7$+5& -Tz_OR̮_a-罕{jKE*W`,+Pxu>Z/b}'5}+ +y@n9wZeKCs0zG3t[ݳ gL?f̘I&M2iM75kVBy*,XPXpa,99773~JbD%V}"}k\>=__}kس}E-4f.{ cCX ΁.nuY8C2Z{hkN@Vs&vK>rc_ga/÷@Vӌ48[FysrYc `1\>~3}+_>YxR@]'kS$rE¹jCߢ1:J8H>I4mZWWqƍ6mZ̙3fϞ]+P5 +aݎ61E]+rrB#.@1SBS: VCpG` d9cݤ4sC pi6;_(\+r8oxޓ>'Dހހ/ixC5$z"1C=V4'u腚k>}@2 +aGzkf=饅a; 5p@_|7ĵtߜ +[cn!Vo8Hk VG֖aMc|_`AƆ.;a|ω,$ްqoL::~{$==m-ɲ6+iu!KMۤ qP'P.i&)!$i( CB0C鸴@2CLZaa2 L9ի$$o挭??8.$'!Neu_C]5˟crlpxDY+~ ߐ;:k5i&0=|j,E6L/#!=~^s7ځPz}NIle wA^ ^yĎ` +M&=ě̡ Ϡ9E_Z+e}ћ^p:W{v%aq{X=44оs΢Ⅶz {g1j,6.>~{f$k|1BBe +S}&ySp Hbc::\H՜#koV7`zxԻ@\Kh8 zƴRW)NAv<}2oDDwS +yuԛ +_w[: *1ُv~HMX5Aw;׀#7 +'^՝qs$Lb Z&&4Zz595\ڑ!=]6Hd~W__թW, /P@^.3Y̰r!Zò3˺CLH/Jj%Ѓfb#X% X(V+v p܆9K&Rwa-↥ s\V ߱-SSᓩӆ̽Km*5&U8iqC.6!YPKV%.~u3ݫI <817Ӱ/>O >7W8|(-TBxVpcJ } n齆-|\ wzB2Vo/#f/9Q)75G+޿^llLޕzVۗki˅Bܮݺu֡HDq3$BeX1%Љ4:m!<^pG:{cI,6^H ߳L|{(蔣L^-Y}o}o np,!7xx:Wr`1pN8Gez7$:6FgƬI`6zђG:7#E_gy, H,؂߯}kQu$8h_ۆD.ZZZ{lctN{[yoV8 }8CWQوSu{dr~2iC/<-_Y|xU`1=-C(QfKMטO԰_ 煞("hf.u[-,ORe~ǎ: & j,f+/]-KQ^|q.bc!(ga%wF%1Zb(:?7b &>^ 樻N ^ʞkS])ס=A{Y.qmcccX,Ɗ{mt_Ap'p(kp(p[LN4A ًqq(߫j8 W cs>*ۋxsU ]z^~ݯTx@=}٫qx&V l7rؗ$q`b5hixj8Ic \oooUxV9ptMy-8wWq%pb3L΀_q7xߎpn!nX^`/<9eo55exHʺMMM͵Y̰aF:n`VoN0[Q;:%9 ͫ,Z.Zց_=DM>C2ȇPC~d* *{{UM] t}~[e7Ɏ5l-p\H Xy/ +jM$X镣AJo%_뉉0_6r>p2x?:V|ץs'ρ&S3W3}5=ۧ{C1Bz 5\{{{5l\చJw=^eo U8k(U0xNyr3E:#Uͯ~]sQ ˮ1 ~__xuT*ŝqwwwӓK⮮\.y)B#t޿o_EQݲ7[!z qw+ۙ_|yj͹^|Ml,H ^7vsCnGXBbggE~~!=O'e^1c!0ۢ@\{ {DΥ^ e{zrhRw~U/ѽܧA KJlp&bhvNF- 835r?<|ʱ-5/:^LsNCc'el]$>Eӌ+XޚNIiA+f).+>Hrn<%E[[jjn|A^wB lAV7Ɏڵk}1;-\\賑 >Z{̀>XpD~P@:3QX|?pcNGAVkXo }ec FiN6B>gt]=|1 w+fء[AFܐsP7heZ㣃/s@<@-8571PYü#Oaàc}I˚_{ "K]{ _]5ص" + r⃳x\u5W^{(nj< ]-5oGFd[gw^`D u.W|&N$5h:Qý3=Zb$ ~ƹ'X/sW5{9R~ʾ6r0VTܿk鴘1^ gWW Θ׼bͧۀ/'5L}V)pG]zWOOȺ[d 8yz  25%xNx!y00;,I4so!;'t_C;]y4&ۂ&Є4_xA&5sZޠؠI֬8ō/4^WsV@od&Vw'D07z-qYi*Ù 6Z(6C;xG "1NGaO &֎Ny!<|>}ۢCZiGϘ7-Cϴunvm=8gO>t8fu/ZNu DCabR3bRC>ߖ[Ifߵ1=:;ZL:a1iIzqI &~z<״*(uǍ+<958MVWx)o~l\|R y(pt)]s8Eo6.YL+$Bpkb3kyh Bu Q3w"p4vg94}1czQa=Z}-/t$p-]!D×<(-D.D'R9 i}.ed)FOO$ ^Úl,zG"f0lQ^=ۍ8(2G='u+1,DIi}i^бi9[ir_EY#9zU֥H]~Wʮ%s)q|=o P '˞134TG$0fYԷu5ܒz ]t=t.;e^ ?(0_+u G#LjyRǸQǣ%:V [c `Z& ^D|z޻Wk~H=⦿U1f5q,?pBI8oR2 Ո/3Ax]aĂC my,@e}01k;{SYfxd; ` 릯|\ IuYI˭YZ_9 +u{e}_ʾυ@-q~5Њ6ײ +,dfpzjlj>{c(vp^f$*u/=&8uh/faRߝ:6z }țk꼦z;f9)tOo0Nl> +6yhk^]zͥ帞׆$Ixu)#//ӓZ8L S5糱aD2`nǃ9 +|ƃL@k>(G^/}^{ȻH%t 0Eh?{uᵞܟI(ݫuҽK?WZVvBvB8z=~7ЇESxkG;YWw4LGZ]ZW'5ਰEgm޸~|S+uœH. `mROE1aH*̄Xc*7W,CC |>? C>p21/|x(qxS/ +k`dOr'|WjOQz4W}8|ai #kBzʷ ?O'\o+Yq9ꋸwp ]FzW><y=4^ 8UpɻQ#$Z `pxNA5-r`o~񣹠FuQ<mp G9d>ͷ6x{0몟l 3ԠFֻQ]dG4ޭ)]K$S`|s鑟3׻98"zby{Ξ5J^@i9: 5ֿ0;z>Ŷ;.۰mhK3>-I=aa1/Zh+{(|׫_U37ysgߪRUU@C8X8UBX,KxP(|I$I~)6OC/?~'Z3gG[ cuwЭk+444$!oc +BM~'ݟeOjjjN=\'t?&}Ou!qxq¿{~.|[am!lwЦio:Ρ> +|\}p^ +OOsޢAi;B/]& BA(;~Տ>V[t]Y]; ++#'{;9Aq6gjsz}0E4 uBZL5m|6;Ow  O >|\x^=7 q.]X(L;j;$ 29> +ձ% Ås/GO^8O8ZXĜ%481_-Z(kՏ }:=[/|Zo:?ԹÄT +ajn7`ք1˞Q©!+:LX~a0M ^s܏u@9ӿBУ=LaWap>r6=f۬{D_n]KᏅ/ /[oTI׫ny5FN^HZ[[| MB4 έ}bm8[cZݻtٯvkjWx>>! 'ڞڕJa0]j/>z$1vN>"|V&xU ~υOCCyf* `a0YſQ~Z/3ZX1ޠlU_NV_U?.e"|԰ u9Cײ!%=z=I>Wm(/m8cX=Boo`qT~|0o{on_ӛ+ :#}~I +_^75`7蹮څI<;(\g=#ecGuvȬ?5(Q'Y}uyZ~+g46c4hn} cd'`/ZZZz mZvj|+GZ5_0+~~! ^ůB u5Z\KžZV!>/` Es{;7v? 1X{tv4MfL&tkc<*qb}U_.U_\Ȝ؉k4ӗu~/$&~ bW1o9c}yx-`sB 6LIb|ہ^!9NY5I8_8O $HX=M +1^G9|bO]{ICg oQ߽BB!Wdm`k(6QO ag؇ia@n8nF? iUB$Kt_V+>LL",&!b-R绰_"h6={D %6Cdr[&Dom;;6`>cgBZm~e흄_ł8`JIԘCS;L?K߻VǸO\/ӫs_I2Iwu-ktMF15H439*wh:^Q1ay{ klmppAZaoa^Y+L9{)7m}a&1kaGk>{7ުb{QU[ֈlw>{9bEٓSS|};7 +\;aC%5ƄPn Ta~Ǝ<[ZݳM?Ib + {re^ q9 8 { +:~;߫NH26C-141 E$| +hC }+#[%/& ̀O޻Y'7q/ϝ\c=Hmh=EHLbi |J(m%jC~G݄ž+"f뵩B '|XĄ&n]⇞5b7kS.ROxX}ַB['1 +_'+󌎗wa좹g:>[Q'\5GٺVbk9c$}2I~IlSOfb +3wqK?r_}f~R}7q]/py;GpiE*{Ih nұq4{[w \:St56iΘ )nF1@qNth 8=Lx">I|󌏏0O# +BkGߙ^߭廩=4T}&\|w)l#hpe{o"_=*{UxtgwG+S6{m!X5bE[t p(8P0- rvMNϾG6Oa+: <%AyuzN-jXWsss!y}<[L(G' r=]TsVX"̲{,鶪6=4[bWoƶVc7 + W{'O6Ϳ>,I5z08'ke!XO}Ac6& f[n 1r6Ƕfo`3|߸y<>9C:7\J Q:"84YX%Gc³nGKc2!Ɛ_,O1 b._4Rfnx+?Pg~IMA˭A@>a[k/=7˭@;KkFA}cplBH(ͯxůȓͽOK:B؋\5E~7 oY GkoWJbt\ >I1V٧ ,1yЧÐd8eNs/b3̀Bdx2D| l_m}OD@ə3\,Ao?_e:dE ^|Ӆ{7>= t>|B)SyŁNR'811o%q̢!!l?VcoEwo{h3厫m@W}Is!>Z/Q8a<$G@>!TDh6.2;j ^g>;58)bLI0 ސj7Y,ϫ| ĘĹ!]S rj6 Ico̳An${dll#C30fuF -RT k_"tn"Ժ`Q۹p@^-2+7lM+t-k!ozm*-Znpۡ`4~a>*V0W M[bkG8ׅ ^;B?K|7GĿF7## +17Uu-9xcy3%5[f]umg[׎.Ls—| 1xL2pMP|OټRw@zB7s ![g#oZKhaX-͛cS\W}j< %NxWEv´N=K =L󇒗!`p$ͽ/Jk>|WeO|5~Y=.|nxhMӕs󱼙Fh!/)hb sׇci=7)ד6o^>{L6Ke31]5.g^ָlikkuSM7! k/~~uhRb[6!c8]8(D*R]d-o;zy8D}+;j1?0OPP>F!ϣ'̾9-@ fL|S-*8 ~1c GpYXӀ?5":wY $]!}=M +O8]!k3Nc"Fv+>bC!Mb$Swj\^I!e0_6T14jl'&F߆X?p݄5s@\Uq9s#k!b-oyx͞l0I"(7Ll $QO2'i^FGsÌ.!u^(6ö58!^st%Q3g| Q ]BlB ܿrzxMzhMߤD[haorL7bo&I z,&Y6Y>ta3ϜSugQPTqMZ^ a+`Ǟh@}#56WilQ6>f?JbMy<;~}a6xVNwz:dB-oyb 앰:OcGZO<چ}|^i}֕5lpe/4i^P0J}1aVLL_V6X?.gh}n0C=)uTC՝n + sLWoY}nm98sxnbav]V2ќ"_ +1;u`{X;5k}K:U|8_7>%vi8aO?N Q?ùCmjYN(_{(ڽwװ1 ygs/SgGƇLir9yoPDjbB4CŚ+u-2-ĸk'9wx iSe=5ul~ǝnډՖ Դ_`nMn8W*".e_>3Zm%UVRjYSfB5zF\ Gñ"/q 1U'M~E mALec[F('ͣp7ZOpȽg>$sA`<9j|Ls;4LZL9áJ| 0f: ^(CMZۺU#XiԆ`=kpF|GޣЃPqu٣Hs&qA mi[^.!obm!֮#_-C,.BA=BWMǚqf*5^oSm9W$1?%NZT:ǯ&1u{!S#U>睷"Zi,1 +)]899/i}ZCo{#5'\@Qqf(E†Vd1'4 ⿧~|~p<½a}q1S.~: ;Q1SÔhoXNuhb7`M5k>:W'&:q4^ki8;o8a,S/AjDK#Nd +|OnT# !Ƅ@ݙ]YBŴts{!oy[ݐͣ FyĿ7^-ͽ,ՇLcIY#SIͷOj+4ya9m,Y}Y5>lGm1V_ v/ ?߁k u@xzPhoB:R=:yk3/k陶b7PsR=W簋~>hW3~4ш:߼ϒu ΃^rmjo)1w3?ETjD0)^!k`|l8L?\+GAЕ/hWNr>yYQj>YsZS|PstoF/ym4lQuO/~>B}zX &jP{$\R/>%7?Z<8L7f@@ḇ]LuЩKaZ3,N@Lݕ~!x: |_} cE!k/oc7o@KMv@]]8oܠ?"Gܾs:;oV뚦P|CNXs򖷊lY5ñ&칗9{jjG4gL75_}FzUj_p\{e4zw: iR hRlկOUN~_g-C6g!pܣ! BDF^\{npե'@~uo|B- +r&8^f =0Kb>FEqQЌ7Rv~ǹ<}aEKd9Ls]a +]a]kn3-oy?U|HV^"Ca?Ҽ%[ռ7k:.t:_eZ[[KoW#,w;J}|k P UVcuG{ QbM3j1sN7iPCErH$>SN.fwuSM[Z4zźN꼟>})Kyt^/n9۩kXkYkzpcS3眷b[׀݀>$Z5\2{}h7_ko {5w]-w\ 64EV6x1?]RF_J~$?gr6&u+ރǀ3C19D!z8˄Bo!֫:rőU-uCU~"K6> x_ld8}ָ,.;AKM>&y gZa}jXb3|jjI}u-hLuF^i#[6 ^-{>!YGHGN?ܵAx?Fa +G ,t@˯D;<zp4>|9ףBi΋וp*o V;$D}| |=a/aQ@o(ĚR[BjX{`4f`xwM4f.PK\B}>c] o2ܮHJ],=lKc:OԢ'xr蚉[́bJmC]@<{%~]{w/~֭x6kxw=F8$ȕ&Qo?CZakdb.TVohB[F}{}+zI/5mO.=C.A#tѠ󖷼mEs^^!Ĺ(Dro11)pńDž[5]$C?zV0զs^HKY4 E|t?V_RU18BGx'Ժ5:un.NX+ &z 9_ir7]uPG5҉:5aQqmږb› OX/~ *Շ,WğF~5$R^Mq G#l4W@@`PK{wıj6|h#b/U}Vx;}H@ r&[,E,ǰ[1֤KdzRa)>1]Irz>TX kpt ZT][`-oym0}HrX_/>$3_א{!3>Wk8y  +z NᱏN7T^=9j̬aԮO8I\xā͖1̀OȉMnwOu!F Ǜ@lbg@2.C3<Ƭ0.ZV rv I(!Ĝ~elϸlCK<'{i^`9/-B}!֥m-oհ"F1+zhR>$9Ї$-BYAhBӸPs^N/zR_ϣ slݦ!9WcA\͵'=`36CzP + +ܛ#'1E4PK9L"ar+g3@.s:CW>Wdon3^bv?y[gxJ˘eޜs\|9_|H| ~_9ru/Kk%~x iam=^jkk^ЎѩAsJ54৺ kHN ]I})Y#B@>,HɇaM!\ECD}bTkC߰g(Xvd]b Znxqr6׿d\a6-oy\fL%;`nLփ>$k׀Γ׽5vP ^֏Ϫϟ]v0:h}hwd~gzj[C?":j},g3&W3/*z +.KQ'_#ֆ7av ~ϯ74~^U9_ +ׇ4lf[޶%qBEV6իML_4k@L~Д?)A +цm=Qf4B;h~|a:@.˭;B~A'>b/o(3 +@n{-ށA ĦmPuv^3ԋ%cщݠ㑃@.B=Wz/fx!DNR:tCmmZ^=IEwȅNZM1 +ׇK5CAKxMk`9 eN{WOVQ諭A6C_f(=?)z tG5]o| l6jFc[/sA WxE RXOY~֯5p+ͽ5V +G JNqAAsmHj=~D~\ +d 7 ;r0w|G~9O0z^m mtŽö}Y)n>"ϕ'C}Sr#.qu$K/0}nŽpwvf[6rRѴZ4h^kF3}tVd/v!1Z9I9p +u\Hgy λO߭~C~Xj\ȶRͺ +ݛg+xQrnXѾybcp{BvZȇo#U;&ȏ%-j,`G<"{Cຜkh|{Hxq15пv?j3p͕j3kYrd| n/ԚInz=רcG_6->wnT.@l +w +!ΠtBn9g@ E}:5/k}P߯F}s!Nvɮ]qjxBcn3>B\ɯd͇3w{y ΅tA&6~pJRha[@B_Cw4žf`l6C򶙖xu[mu +EOHz35$Os$ p4Qe7aՠS8L'$<|^ G~n\m+_+sƅY|GV{St!DAQK2+Dn!y+rI=>RMl y7l|E,!3.A !ϐ{$j|ި{Zדt_8OT=WmzwWi&PV) e6C6H7| MBI;y?5m0|nsU+5,jDGR+4_-OKӬ5=4X5' :TzRǸK bs55u>P'93Q<`"9ПBmr6N٘!vl xnO`K`G`?3uO'PF~FcgW|Gzͩg_C f-67f[6{yTB 5j f + Ϟܶ/6An`^K&j= 냳V/ S(R?'V}v;'ԯ~l kX) _w>,PBO{0[zu2Ql~w^H +YN| 1\i0{n\c;@˺/5~1rJa +TOe" niȇ]b| .-\[n3mҤIɔ)SiӦObƌ}O:0yI*9fY~jMi^[*쭹Z +h.7_A#Y\ +ר=dyU wУI]p #gԗP()_S$/b;G ՙfVDl]rY '+ Q'}zs<-Y![)}#}f2Y?=k*e6BE -4-!Mg)o[hۛ l*[W" |oy:ghN)_)xm' G ;:ZQ\r|p>q4666 g +n +7/|| ?'?" :Xoد'>N<]+\%b]| ]=5d q]ÉD[D9ﳵ>X1 n(#vpvy?}3#p^wA[cT=GV,ͽDĒm[n!jkm$nzUkdN4^h^\M{{;zh6>{ 6ofl@eV(mK9,pa_ga5^Sv" [QoUcf|м#GϙװE]kc/>vf5‘k1't&ҹ_ɞu<͕lǰ(gS{LOoKc<{| 'f0KcCh-VHNDȏ%/ +o؂Xï5jmC0-5tttuuu54>h*ߪכ~> N*|'I Ըm|6Uo!NO}|p@SÅ}7[fͫ6mn`lhfi,9@s=Wiܫ>x| 6mA_{Kϟp]H| TB so^'נc׀fL3]wj@m"w!2TpY~rpp66M߸NV z:;;'>=MNz}R{{{N/6mg1 6u@s~ m4x*=YV < 䌝&_7 ikq +QSRU#k5,ao c4.uQ}8/'k8!w655PǙz9:Ρ ?h|{Lhlzdx=r̪r+K\*:ui8m a8lR]sM^컅u.V,ޞJMs!j;~aZ m 2wuhZRGsss쁩 f>Iv|a@_Y^:;$6{XThch=^] aq70 o.N29{N׹|$9 XL'ON#VS_Z3 䐐 +ivϻ^%5 _k^3: SnRӎ-A431j5qZI&ׅi{:D57g-<'ȷ OPW Yp7me<ڭ*% $4Oi(\rt,ۚIuuu34魯|Z#_&{a1ghES#ֻ98cg+\sppFӤy\xI +n݀իX{!j\{mŢВ*ee7e7 lo65[_8ch<Jy ΅ğ\/{$_V9q +s2\H<(!q.6uԃLk{~lJ%pnp}(@| Lt&ܠwt04WwֵP 'DcZ %>A}NR4稤kqmyEk_+ GN8V8FN#pw}[]C|N&Pj3x;:G"BQCxppkaYj7$(@eJVק+ղd3Tf(C>-6ôiӆP0.$Gk8Z[T}q5{JBiE(tO25[Q:_88';dy1cˢuLb]78Z6sJs(]'7Xpoa0+쁪*fχzfQd}z'iXs.;t?wK/ +Q?мAÏ\~֖4_(\"\VS7t󇠵neyz}nHr6,aWa]ɋm.:{ m,q,<9Ή8Ye3.IK +DO^vCz d7Vn2eJj; {phȑ#5Uװk8ִ%\=Tt>y 5Xɻvs!/7m_a'V\vD)$|SpbZ]/DDÅ,!ύa`>nk +ϣۊn$֯~.fl6cOsIkk10ZٍX_ҖՓu zTo8 &ݔ 5]F +w +  g{)>+8~o 7+DtZ!jcO+|,Ύ~uc=8-1 +3a ^0mOn'$֔_@Wm^ZP^e34kM.ml솑L@mpxȯ?W5.%" { XOg.dzA"^zL@a0KQm3 j2YplՏkePpd(}֯;M{xHޢkksI#c3 +yeoq}_R]M!'Ib={)4_<>е=nG#ޥ5w>CN5CCsᧇF݉;̀ qJxf 1&cރNpsaYx +ۅBԚ9c ^ÁeuIߩqߪo!7x@^xd7wuunhn4iR͔)S7@bI9ølԻWz,)|?5j| +^ Bw_#l'L1_[Xfp]nGsKrwrtԟg'1<8dsf<&v7#ZN 67 XI6`3dΞ$_rǓk)fTn%S[azy۶u=?8Xn~^9\GoX, %@?b3c.`\*ks4rw;7BAaЛߊϡhOUV58q308W  2f{vn@ VN$:b]eާC/2>bBfbbmx&'?lߚ`K9Ugp>cr6P0f~WP6@Cro׆~${ +crCo1-87ZA^CN?PoFp\=Kyӓ%o8xE˚&|>z;x1s:>+,`7f^ƶ/8㽞ɖlѵY?F?g{Ȟn[-jI66^buw W+}o} M6.K]B(=ϑ0}RZwwwz| mv_Saڱ!{-J'|Υ$>X6\i|%qޢvwiLy5Vw&9 MTYnz q\z9󗄯il|_S'j@!*h# +s)~.ӆb3mrUkOE|0a$y̽|ԶhV ր/"\&lv^w)pz*5_Ɲ1 .| ݐ íݐk/$œOVZh;of`첧bDe}hAI/ +ze$9f-d}^-!>haOSwV\ CEnw9b3DiB4C/6Xq v]%| ї{t/g~GMfy'(InðޯFؾ{?l)?Cg5Z~ Ci?eliR-W80m,' /BP@{V'd3[ao?16CY}'w8ٗ0^\3~*E[7/}DŽ> MOii|]B3zK8A¾?^}Gƶ6y۶b]az;fExNY[G1s5| c7^bZs(xk@Gs{&scz[w_x-Y/S> f{0.MokD9sޙw zsz'oD-2݆gV6'gy?c^iA'B;?2K槩\Q|PĦKtg%1o$kom -} +^ ˟T2Ľk;q6&RY9d^k?e犊nW/i}Hƃ^O {444)=Ѐ zqa\6 `=s2>2bu{4y~5_|H|-f`of/z샳~̉`;?丐ӊ uВo 9̯ׄȷ!>TF?kpo1OgמFjK_Y*ag;"DB +#΀֧۔?a$BrGS:}882葖dk^֦v.)[}_ c Va&B|FP {ҹ[ls,+,9?M)%J"w}ks͞0Xȣ? z& f@;yxXӷqR;5?X.c17w@[@<D"8n&ÊVߧ{d@{4qz4@uuniM,߆>%cV1V 0'`n/6,I䅦yz0=5!-.Q0q$^gE1S?/x]Il_Y\όĿk9l~(W!S2D\>Lؖ|Ŗ*m·^? H|ilNsd3f`OymV1_>5 N$ 4;OGgOY$Q{8nw%Q{]!ˈ·55?qn8)1 PjLL}S u/.tuuJG`[Z?qena]%ksNȯg)ggSr4]6U·6./S S49`{g@NI&5eO%9 U^7' tL'<Ь=jF>Y|ʴ,%Pd1 )OxY?A~k6ќdKL{ta.8׽--m|$aH%–y٘} Z$|\~NIrdo> v\6vΑr{t/2S̟,ulwRk/x3zkx贐^:=wޅ^ 3u \"TaV3m0>b^ [4ޱ==i-Ak=m: +iT$u.ĺE[.DGe;|Ϭ왲>tG?0w03gb?_|^ ja_GSDZ%+{`#b}drgdE+ZzрMXFS3bM + joP3u?c˅7<'-a ۍ!Gl~^8c4`ک>׽-MvJbc:.7ܾ:֡|l> u}Y=h o@VS;#ۘǯwΎ/߿/?gR} c\1xtM; +u*wi` Ӊ}ʸ>Y|pt)Ac!=3oX'ZJ;ΥJD>\x}ݶZI'spqws{a32oCfGρ15|߶ag0_~}f`́I|3ڑ盽6#Яe҂ҮT!\s&}lԡO.kSUǸPK7{T ѰK}^[α!/5t=8quvMcĹtwx wRFxp{|`2gle房v+,8&g1~}lbw&Q'usPPm>_흩&L&AչWˡx.2d]ZIBm^IܿEе)g}afe-cM`C 3?&j^8Sc@aL[qPkJ7}BBZ'2Ԛl}dr?iUIYŞuz#wǒ-wlAVs7O̷Ͽ2l &өE\]k'qc λg\FYrqs{H.*[Ϲ49a{;Doíߙl94z [j kcs0U罋A x4Fg +_8rl +87xWslu zԽbހ3ܱ!uA68}l_; X| i*2i5yJi W[xӹR{7͸hoyFxDqvpbt̩_~<㣺V俣 څXx1J3ks :pbqOwi\q~i;a"P!X֒QzM[->E׸|G 0gg?jIrƽY|]G'[>Ǿx `pK,>ӥ#3ƨ{{j] +  Gؗĸ">!Zlְ>1zα7.F[쐃u94?q-5e3SlFSCLNq:|X\ưl-(|O=pqw$|© g`#$n]3^ن{ʎ/uI op0MrC1S/~:~;=j=2Kq x7+XPrXPm'uo-FEpиudXAk@v4h2)o4yYh`cgca #`\)b yGil Ю>>~JV7CQ'pG̥Γ04vH-g<4,`Lf}h}cüa}`I >'5zcg<0.l߽McgbSG c6*sO'~m}8*1I.~iSSS| 2hh'vR??\qc>+oo:(!r_ߥV;vS;;h%zx#F|>ool&v3{ 187A]1^239֠U>ok|VkґtuS={T{M +3]L<ptq3r1_s%߲zdZ W$=wx1֟l%|'2^>4kĵQHcb.:ABZ9ob|oJ߰f⋁+v}[%|Eu5fW̿Ixk=煸NourΘ޿e>Sc䩑ɞ Mll=7q_S~}O۞,O|_z"e'MBɺNį_u~| `ۦ 46t uS^]I5bklܮqƙ;[caz^:L'(=o16#Y +mOrK~!:>աֱ>6lN/[S`|5i`l Z g#+VXs ?%{|dž+z?Ľbh޾pc V^j/#VkId  61ƨ{_RCۧO9oe1yvϬ9M׍݀ݔSHQlI ^ +{Nlk usn6@!kǀ(~/'QlzszY![cmrz8w]>q-7ã;VHs)~ZfrJ<N(>ov:=fb }w9[1c?ѧ$5_ԩ뾯ߣ|6II|F\WF=%ᎍB<nN:Gh{k*52[s!|:j;j]zW1WfPvK\ #eje?O{664ztfi<CYG +C˟kOmkG븫ȹoCm!cn3`/@|=lq| \ 8p3ȅ$?o-1P!7!k._Mljw <3,mkjb sD{Xp !֔7gjm|O/j-1Ǽf}>ֈU97gp&v SXN5sR}VW:mIF>dݧyRw 3k2^˛O/Nb*"}W<61$uE$`cvŠ>){7[y} K3~e oO`G6G{]<w9f׳G|L"재!::5O'?w`o,>g &ӜKӐBK ےrӚӾq]!Mveg* s:ϻO$lr }}"g#l\kЌeoMƐ}v8y]1BT;F)d| a 4x~%uBЅ$ָw-45`7^Ct-/+D > + ¼Y0mꌅq|Jmc55G5 ́>n:W@fgQwCc&bӋ u=\Zl$y f3e3Tfl\۪f96:_4밗K}d| +D<dEǓ? #u;eO^{8y 6hEMĮikss# '1X3?C>q1>ї;ތ!Rx$ADT\ͪ45 7 X˱% 5Ɨg]eihcN[!ۈWz^üb>TfӼxcא6Ơn@5o(Z2)&y|ܲqw3~)ʴ(WqQX{-ox'agֽ]m3"Ӎ, +E#!z&pGZSoڴi  Uje34fh\۩yvic/I|5u[x \n| +u#|O.Z5pѺu\bƬUl ׬'} G'nC?GϘVR]h'@Ʃ:|Kt2P o*L/6Bvnbնn5n1C">NkHe ^p^_o:/1TgsaCwި ִؚ2/wX`X7< =Sr^5⿨&Z?Fɓe7fhЮ=ڤ:y:%fQ0&!ƗO~Rz[uV`fϜLL5};Bfp߇}3Zxv;Y}ޯعP}Tq>!:1NCE\rO'L6\@rQkw1R]]2ܭ~A.C*6Hi)gA*YbZ؛pk@_-ٹ;qk9n#d} +i +4L+ t=xk(k̞Sl|R6Cea^ໆa7rgf?.#*gOZ3-k|z㩷]\?8uh.‡opna651`}grng̘L6mZ ݭe3L̀=iEvZY!D u]?.*^U7{Ysٻ +Ma/ 2a kẈcc,r|߾f6Cr8 ;lÌkGOQ./#A~ &lr{k,cL%$.xfFIˠ`!O1 ds] z԰ "H܎uy=Pi<xYNW) o+xzKވ&> >Ĺhܶ$֮$㡮3Ć[3OO~1ng+o + +b_G>3qSxw]Sj&#|R[r ӎ?AbYe|Qq26Cl e3\+yi]#'Ty<@"{s } C\Y<cnB)u<_{ u_Bܡ!3'}sQA ctv`f΢լrIc!QMtB1|+z3,~ W8 ꓬ.!eD:h2*ˀ~ޖ~ok/:Jfk6v6[^c]3Vs]X/Cșf̸5nq)0:s}a786v`GkؓV9C}qD$^}v;{Vm5Uj+9Ԝe}γk>}z(]6Clv#9SŞs}^EOO{ 9Wsc06gFڕgˀ6:Js>o%?sӏ^\^jQBMMc[s@<5s5a|-?+l*;,0+e@V +Cq7aӾQSIic/| 趲!v: ) +l2%aܲ_>?Pj?x*k+7r gb?g+S= Dlcα V'h#vWwЊ)%6ZkBS:hPgm\ۅ4Ԙzl=k6553>Q.6&~?-u87^*hjxom֬"$#j\t%@&P^kӍ9!~h26,DwӤSiUmM|{?O83{t-6ڳ6CokHy f'\r(ȑC!{ύ_"04{|{lmiX +~GZ&׉v k2Xe.kj;6C c?/׼>q +/:]BE3-c3f"C6d3uMKkA:@IuIclw +GBڎo~"9Yسey }@gބ .~vxPJzp].랡{oMdj'8*Jr.kgCn|\R75Srf |t8[PǛey@hΤN'TmvM{ +.:?S3n#6eik}-Mt?œ5*!w-yփa֎B̝&v3a,OzqrֱWF>bv߹9Y>6 J7kYn3̮u9E~LŧG +Gp1߾ߣ܌+f6pϫ\\K˛(UblZ{Dee$ꯥu}jb޷b lb/ W! vػr[4ג <6jgct Λ: 4u9G{{{^ݔln3}u.l1v!# mgU: !Yi(zK{6wf7=E)6fOb]/o hg9L 7yꟲy=|,4-&Ymmb'So>f᫦< cp4|\Go 1-=v9$^/N {uYSP"r lekV˰`P&rVp}5 $ja./LӰO1ª̾=o26C$MF Z;Ol̻X`K0u*;k[u<4χHe׍ a3繃, t|Ehm=I"vݕk׹$uuM>YwU1F;6 ➡Ӏ=.6B+f٫!3[0u. +@Bnfﲞ\'<$yu ;MmbK\#.Q%el*kĆV۞ՍvыX05l )v+~+DooM>|WcB~GnC:?]l޴{~0PѵHu=zsv1'b1[vj}Ç ! f +6il![F;J6Cl: Z>]k,>?>ٳ,NL͍3xƄA~`r%Ӄ_Cބ3Z֬h"߈~ +1o4hMkll'tȬa92:U: R]]ētݩNC!4$f+5,\n'VM5 ty &6[Sj$1ra-B<af`CFc[ZoT!]X>%pLRI00>L} pWy0v612- pRs!TgZtV.̧~?YF;\7EWG';6x*e4_1 +4 +Mʟm^J6CQ6CluRx{8 SF هXML2|Z@~r_(3a7FnM5*¼-DvM0yjm9^?p7ѓ9C[G{Qd{/tB؏lY,اWB-]Ŭ\'Cy?!, ч1\m|p.pNci3B|Vךpa.<| .赸DCW&O͐f(fǚX͜_ b7PKMcOzUzV<}5;ks-tX +xhӬW[5ּ.{wdY{zgGi4Ƞ!ElB @Xb{fD0I,#1 !@Lplݲ˕ĩJp*#wsEsU4}}s[|qs?A'?;@~fy 0 ΅g>gy5&[Qo[o3 qkٕc赜9^NQoO&Ʈ]z֯5>w~HxLП隖? X=;;wk_/nRaZ}/~.8{5- 5 +܆m#:>ِ|f$ƍ95%u?u@AߖyFCaxNCߎ8_wx]򘎿8OfoR^̓SIF U~y,>ڡuG4xiVr>2vZr]poاExJwd?OwgڴzCMcaw&6 >{Z ukugo)P;n0ݝ:-z(?29-]L fPw}gcMƴR>qynKq䌮nZ,srZEnSFuX@ +\Q=st'U|8Dp{ĭqwG9 FтʏVB<ȮV[nh˴OiZ,P8O)ʟ&7+?'dpdTȓ??2^Z-#hDjcdbzqyjr{VwE7JߡEI*}iMOxf ӝM\ݓD⼏Zl;V)/BA8ϧcgdNri9Τ~}l~xG'l4u\a!(;|ϻXGsZ{ow8O;mq,/ѣqYb3~g_3Y5vDiikjjiӈ?귾\#-Rq_<^u5xЗZKz]:j=){.|sG\-OJc1 e0:Gi`6mM'cģqR-<&G(h->ކܳݻk`O7gNxAy=*uަ!7g4?|Q+=.!IO%'}?8q捽VWPZ~%z { &|Gw*#gӃn.޷8xM[˒‹;86^wxu]-SNvGN|6+ÿr 6;jwD7#ԨW^W4vy~2u\ٕ'3{s ++<i%j#|ӁxH֭fҫu秴c +3?ʻc`C~F>+0Rch*{g3+`ܓI/Hv=֩+2ܻj}=w6}mo/g]q!ކK*\|ydxg~_Ͽ!,|9yzh?޷'?5L'zs9{cc*Wű{z#ߍWxnCܣ[_^(n<pnqiy~˻AC߹" r^zޗwO~ƽ?Co({D5"w;~玓04.&<{.ȹxWRgs4Ǜ๑:3YK/S}{A}k5?$,SI^3DA|C[h͙wWzYb321q)q\b^+lZ.R_`$k? rb +Kg0Ϗ5=ܻL'.Ss:2?j_}qkxni=Ԩiosvjv57(A9<*#6og}9ڑE.ߋB񑸎x8S/xVGF.{pwoAzsվk9m8_ܭe4ߋ^kf^wjj5eb^[SpH~MZ\ffSߗ[iECv +1O8~z.8=rMG79 ꝸrP/-lqd8|Q\ѽ,O:ԿsBgH:|E 7N5\H72GΫY֗~wgvp^ė}:{>ͺ*}zٞ=3s|d(ݺe^Umc{k݂Ei:sJInH5.s <ݫȫLױ(}#r -<νtqDj; 9rYi"~j3ꓙ7*M?>bS??^CMVG29Z_||'uɜgm\i7:p[;8zS rHk9#^Z3#n̾Kx xnʞIj 7]ܴ2VqYĹ/ǢL;kqqO;4 +.#j zo#aɾ,LnMOGʉkO܈ݹ`Jqo;ν@ hrcշ2성*_ƤޡicyʍO+dC?4˩tz#—0Ui9Žjl-=.)(99m7̕o=#%GN!Czq~>.x_؀NS7nxY6m:+KkV_{}|ScW?^:y|kޅ`t mԮSy_ #{;j׃q}ǿhZ= +n,X^0oW}S3 |L~ƒRaoR`A!^)j8|xpZ}y`ǵxvA'6xJ<ۗoٲ傈[n廼5!^q%}&cc_:;gfg'. [W?x 4_6~>@r|0}?魀)iVg|y??>|=zLImOӇ\i%Fan/N%f,?_+(1 ?H/ԝyA\7aǮf4|< .DWkq^u&aLFV nPSoXx~5Mukɟblf]sң~_~!ݱ?Ν;gvS?1; vs8^0wˇ훓3xmo/t~{lj "}Yz:>R阪㴩kZJ!}oⅷ비|~qoɝx,Rc3lKn""'O8<0Zr,!o8gZ +gzϨQ^RL31l߾fGskxRƼ̸>kKcC?.pAsGvS ]ݴaX3z\R?~д}r]{nk skސƫ"GS$>Yhƺt&l[wgnJ25 !/:"x]qmnkZ=q~6x|ku7gQs8|jNivy] Oߴ|[s}#qcڵȎq2gsL;mI?3"eG /ߓo'ƉV)=3ՇFn7g\ݴ^8Ĺeg(wnnnn*0C?0)W'cD0ܔ܁ڸHntgozw +/ rİ@j%Чw18jtoǸQ:FKe~c΍yQcچ~xa&m:G}}j~3B _^^~ޞz +NZ +td.1y|GS|}zι8֧q"8ΏңO+fA0C~˳qӦ=Ю}Bxl]N0yP)o^72H3uiw6m]TH);msᦝqEFÛVϴw3ӼurFji1JU Ǧfh KSEŧ+HG;ԕ+k֥͑xݺ_͈m{5b_<>>ó'qn$v]!lէq z>~F8"?^Eq|oP/Ftw|+o_~"=R9F:;>nzo};`rAϔ_xoz2r(y^A/ns$R4L0Ø84ʗ7ikKύkɏNo^>Ez᦭WЀhH. {Z!-͞fܯ=ܖM&nz7cһ>+3<|9rX +pZI|ū3|A[_mX\QNz7n\]鵴G^|擘W='.l>s Sj8{*=s/rCo&/A\ C8-ɵm6e hV GpìZEy.۟OٳȩY׺ux ] &t5~4߆g.`V}inqsv|:#]P>UwѾTOB/z& k^49^3/Wշ={-xqƽ9q߷?g%^D ǰ/I>3Oq<#ywb1&ALdQ75F_itjjO<[ͭSY[PcPkз[9.fV+6⢸/Z8O M09eG7T{굜i{a>-W7myHBCM`h|&<(9JkODv%?C }i=[hQZM؏0 =Zzp玞=gh8 $͜,?rsPoκ;ڿ8M\/QM_ v~J'GtF̀Ǫ)o5a ޝ^oJCZΓ".ԟo9 fXn(\A_ kz9k. +A{FBߎ#^6z]3N܈E'cmàw36*G-k0[R]?,G8Ed.9ZyY.^L+ =cݕ0O="9 }z2'PvaG8ܛߜ٥!m?^zoY^U] }S+!]^i?#aŜ2yb6 ZNʡ@fw%2\59Frgy:X١f1% 5gYӬm z`5VX|ByNđ8G|o2|-^Ի0 ?tB XSc1@oWf nZ5N_0(Y?Z/,`jTm:`-ΔT:SSb\Ӑ{(y3Rx~iQ'uXrX۩_JCslk> k+?Ïu +3t,R~8 Խj^.=KxYčOxb~q5q55ö^{,p_NØJ^h1Ո7`!N< s bM؟٬{6CwJ*3&vtqU+yyQW=WdgC\PBmK‰XǗ!pP,4Vxcīcm9O/Hp݆ x 㵇e?Q?%Kd&c;[v7 =Ϟ'gʳe_ N|l'5Z0ZA^0=bu}&~s=&[-axgjC'>cX)?<ϚN@'>~^ ~J3޳ wŽ{[ȷ0 /yϊ5Ձ |ً7nxaFw'~S V|J[W;TEw\gG +{qDlQ/l4pS/znnn*cmG{Dv2N1k(͋x]3Cc/;!WOM~ݏL'aaz*_^9>|8^^q+7T +9o{䁬v8~:95" =שwGm﹉_W9h` 'l߾}kmXc1]5Ix4k$@db:ufRSp}Xm^ @fѵ0U:Z_!'j67^vW{uK~DR:.Gq6~Y1 4ƈ7A7;l޼y}[8agm2N1*}>}^}3#9o><8f sCZM'rnV +3nZZk$:3 I/ ;۲ߛ/Eɯr|}04 Y]H5; \wڃ< аCR}v־7gʳ:xeyVt:Y۳g v=vܹT^Zcx}Rkgf25iPB { DzSBAP"*6(*b/Dڸv%^Zw߽zߙ5'g&3^}٫=-¸oz7~CI( $1˲B0T*6* +Kjjjv +<@-Lۄ]Auk쳪76B, %raJx@/\}WŸO ?>{넳t7&544[B0CBK8FDMxH a[oif+:ui-9>ת5/37; +e' + +W ;›7O{⽺4]sA]ZXjjjhP:ujՕ3GGGڲ)SNvyzCCIг67m\5( MBХwً/vz|pp<^7_!t9oq<[, 쳗 ݜA`_gK':/^}e+ iڿMR֞6k6y䬥}Vמ>YS}1_}f_¹zu[w O ^ Q`]-Z6dBA-hoo ϠyUW +1B0Y" V{M:(mn'qNүӅ"; {  +GjM>A8M8C8Ki2ay~ a8qWq5><7 raJ B%g~}Y&]f]}̑ګԾoͿÂ3Pcm'5Bf?_े go"OF>mz65еRV#ԭu)cq+Z2% u$qzA|A^yPTuF؞V.Oqg)ffc55LYǎ?;dLNMX(TW_R8I8\V!W}5>B,k_ X.ОJx@sg~&|Msy_=elͻ)agƞ _V{( ;_NQ_]>{=!rχ*|)>^#ܪҵvTnkOWN 3Y[9kQm 2^QhZiUBtƶQSP^#4Gb?goL 6  ۇ{Bank{+61G?G8L8Y8Wk򋅗6 :}p ֟--v q`o_V1A 'aOV' ?뾩|Z}Xzy>'4klkӧO/806jl IZZu橯U=F}t +ѽGO_ ҳx^.>{ucտ蚋տs9X6.v08& M]؝3M`\whM&4h 5K%`R7 [v7kqQ6ܣ7*}!W Ex\xSxB;^/yc0G43b ZOK,Vu'ܧyu>,͹C4wԼ\2uԺiӦ̘1 tKֿČhf?vS/T?]S}$w &<'T>׾WgеfښbE+Zes^mv$n0La|a3ysitX\PPyPJĈ ת/~g`ZþT84uTIؑĮ!mcsehcלy?vCo^$$6x3l>u)iIGCA_"o8.ı$Dմc^ [;[۹]sc͋ +nלD7g<y_{zP׺Q?Ou®[vvvNj_4}3gf`&t٣{<$znGOT_-]g!-=oX~轷i$,o + YSV'~;̹1E+ڐk 6ZUSxHw[67[ o4#'m8XK !-p&Ć]\¥(Σ p+86؏o]Fq ~$q9e˅CKvb~]27D~opvd}Rl Mbf]sg͕++4OVi<57+͍JO/YV^ }tttKNj/޾ŒSN_jJf*8}Ik{t0WZ-ל>^}uQ~ #w?G/܏-V)]kZ +{ sf wOkq3haJx$Zg l1͙5Vc~,5Z4&Ɇ/w?||ؒE"OY5'ɋfOxppUyԧhw\ހ/ڈ7 ncE[=>*|6DOB< F#;!7vk܃C5`bUkq@|q?ڿ!K/wX9Jsq͕3q {gW>?,p"]d}޾ۉ3gh_h1cFBtKZ/0M؜GbU+Ow*|4qG wZb[ɉ!Vy{zuuda15glE+ڐ8fI}ltm'&,1`݅˛ 8h 6tWڤ=ޑ x-!??zyib:+p /k"o9SaF}d&~G= NHc_Bv/E ĸ3N {"7e/c<>+ƴs"ܬK/oX~xG9gМG Ԝ^=wWڧc_-tg+ Cofc(Y-NB0GX,#PQ}z7 R/oǖ} oɋk#F86<5|]'Gm&M^${99]#f pm1oo | ij擆BeHgʷ?poo``"sGQ5]K/1#ؕ!zrܰ/TڇYzlW1{@[_gBW&YvmX ްD|bW7<3hP/AszOz/gX#^]]}e Ks34 +;g'A®!nW &'V}G¾_ {A +~%> +'wڵ¡z])B3ۢmXv/]7}s(G8ܴpV + +I"e MmPydn>JxУ'C̋&'5Mb Qkۃۣ7@|{6SиOц|| ߿7` c9Dےm>]0g<<0-'wh¿E\A!L1q8 siӦosWWWznxÊUsΠz_7gм<@8uuW3Q9W,84Mmw&{D_[R04?^.=>+I0Xz48Q]r,LAŦCX:&\bcq_Vfja0C@}8pp:$5h rۏR;hp۾lms%|%k8fl r~i!;̀7CX{~ +ܹOƦ8p#6JXwS| 5qس\7߬pL5!]4Dq2 J@!؂Μ3-gPΠ gx\׸_:],q9gftԔ Q}FL"tM7lW%q1ƀ= X+?'X<fpppp/PmE+ڰ4l]Z;6[ { G8\>:97 / ѶO~7g:h_V3;cğ/q18Ӿ>7f}/ ~|^t׉359ôi: +0Ć=" *@ fꯝ'h9Y`k7Copʸb ^9<ư1/mtemhEVcq-f [ l/{pq:w f|ݰ~w~URwYbN p$N4 ${_ a7`oX}% 1zJNEe^emL,kW-+slp#گ"2YhfM9cG#sFxwjP-f -SO7XX>Cؽ'+Cmh3`Â3Cݸ#pгg3twqz05_)\f>}4G{9Khݑs_c +9@:gx^ pku^8 0w 9g={vI(8 kS?GѴf?>U}q+?ԗB#z`H9ǘ$O)8P?8y>i]mLBJ`wmbMaLN|h$q'6sbŜљcۯƍ8D,u N/8Gl}#|ۏN>ASliCDzU3Mxx`[fm1|!= _ј6lvl)Jiq>hus4R79C&_XkW׺G׽F?CLe8q8ìY̙S +0jPCA4iX(lEF=_%& M]L qcs>'Nu'?rYdl\CV0XC#_Cy}}}?cVI3dk~e: cת@G}8sc~Yr~#7v[{:r侔ZoKǖo׭$7j:Q3j5gg\yVzw3\8Ma8 g̘!0{3̝; lģIX}^QCggϥ֘b".8tͩRZr!|/Tl/F/:$/FNk(lEvKhnyq̙Q-{c#7&&u5~ܸgV!UTr{xylp O"[ q9g( c*/lWpb,B }!M[>z~ j|[xZc}4o%2tNZƀnhՎDq\R@={?k=ޡz8 3l'0K8CBђ:_֙ngj~@vnT}A}zO5V'Q4acE=|}ŗRFQ_k[Fl"jn\,p#~6bͱKC5{&'g betΐT /=hL| +0-/s-Gb[u=!ڞRDg%46mk4VΚ i&oyQ FU^oBYM}5>=k&p8 {3l- 0cB=a޼y% lIzYW{"MT+GBe\<5 {<;bЩƋ=c=ՎsX^ME϶9uX~\Ӂ#ër?cz-MƕG{ڃ^3r8 b ''l?0t_Gm={uk@1U֛dp:ϝ?Abkeb_N63SsxRkXS}x64VwYukacӮZؽZ#/On|=oʔ)Gutt&ް45YfMg/a`wQCrM}xkw?ޣ/3nӄ /TҸ?`|C%v2^ME9ʋ\?.g}ϳd>#LJφw|sa\zZֆˏEK5ı[p.z3}q}? '&ۅ4bkPcemV)}bh7Bs?I #8+=ms뿫Nz>:ճ4gmooQa!zN -gY3L~&8g0խpB I{p8[Շo>>Z!{/q}q {xckB\gheG!bE+5 dkBD򋶡qL`p c3`W3?ڵl|3xÏ{=@5\&kIΥi2"OЎVd,cgn )pBb#'}G `xxqԩ5ӦM+͜9 h䖣='`Z,\&B{!Ǘ9D_蒲;F^{?h#Ұ1Vj=[ Ӵa_óٚ7YYύ5k F2g~$wGQW4k k~l l58o ɜ#:]{&s} 4BcG.B~[jkn{cK2 ۊ8S;RiF0u\5ify,0OL5כvaD\.9C/ЭK:_u>cY}#{ׯ1CsxxxCMggp3XmtoVRjp5?\qC}CO[UQX=_WmD6=5Ik9h"A͛/<# q_KdGW}ȣC)^modžox>8Hx97G{ac,=ZBcc(㣥s( ؟7`"W TF;:<8e[oߥy0\ 3_(X]\I̟quf9zIݚ4g(kڄ vMyK-Vz4G+6DMw![O7u/GfCr.e|WD+5pVai/sVzخg h Wi}KԻKҼ!>ϼm!}(XcKC<> +]sBl.c{\n? 8K?1b wJ8Ro{.c~bf<1.XC'vl#GC}ubRcntAj ԠP繕Uj=]hp@ۄ +GbU '>EZ^ϗuЇ,ڈ7ϱꬆ[Ņ ;jy9by͝gT3)]\}^J4=6.?1e?rذbwz8[rfv6~ +| ='6y7^f߁ǘop&> l+:Ng_@?3.9pb߆;0>v`y^XTxFGُk|$汏2\3 1f!r]K &m"rXG_]q䀡Ɉ^1\o{v aaWvJ^kT/ mH%3`Dd–yFGi9OMZ$R%T戹b%7f}i>u-v3]-= +oOt}k91prXSX76kn|܁A?bwg_smSI4ɟ,[`tD?GoUb'FWy2\m89C=j1g B]Fv_vp1*!91fzTu3Ořh<2e}Yj[{k$Rˠc%zjħu(O7@s4]`ΪCrc^zz 'Ε 0S{4k#BG(x5Ψ>߼vwa- '{܁s +̰{ob-:P9N# Kz79yͯ}s6 ΐS`+CsA9hSgNCRP-u}@>1v6wǶpք+6V6[%w`LlF{] zn V:(#]}$81o⬌&J/Π{?Cgb?- 16cc v`45x\;V˽dq.ZNъA Y ڏs]a3q]13exg5g_qjsސrcϣHw: '39Ym!# +Z;0N ɿ'+J 1о/8C߶>@>0 ΀H3{]_q P ~s/!ՇKע/!6l -'%%-ge/4]7.5|~Ś,^m)\{9q-u^k^k{G{Rysst}6qFqIexC{{{1붞Weë9GXO.Bb=}#kcn)q53[S T9 [?18քEl4,r10q }(C:r-1t(AE۠ytiȱQc6ڷ,/Zou4Xϧc͵Ѥ;뻜٢kBo~Pi.B6y*E4[Y^qp1yCh9g@is4.5-|!^z6 'jUӢku%a1 7GǞ)eqma[I:::ryj+Ɇ6iJNTj &iiV$ē)t=1/9M,W-~7zLd~Z:+zL/:qjSSӁ. 3)|VSuS+m}hER3\LyХΦC|@-΂ 13O 3mr9mh 9"ԇunppց]шњ>c8+6=p4/ ]qb{C@^ir5n??C&kL{!B2Z5'+c +' +i.Jxn'Xso1iZеίQu}^\<^Xuc{3T\×.vn8hEKa묱uUcyVGk_1rbxB\ۿ19Л3_l~ 蚲63W9gx.o?Qݟ>ݪ|q{QF ⬨ y^c p17|OAc5ښ`ks/u399d/0v8vj0R7,M6R 6-y֡8Sv7K\Z=Ӆ+u>-6Dn;XΝ~oP_}I}q;fܥ~|֍B^WV|^G~ic}iZ4fghnPQc|hO&'{3g .vӠ M'9+(/viu#{0I[(r纛+e7kM#^KE8$v@})blнԋOs)kڿV%R9꿷T_X8CXD:_\j1hEg57'nOk̒[Lhx'ǵR^6d|a_0B={(hG;g 9ݑ~ž=ס|8/껮=W/Vh-?Ho'Z߻IRП8VM!r:ϽV:\\)C̈́G8Z+`Wh+?C36 K~,vvbyOnEn<h<!jF{.`zw>O~-m`x‰2=#.4aO4gɆpъ6>S;t~5L_1{a/C# GS! +׸Sx0jia[XYG~]bXK&v}\ͱ7k>b|pސ Լ}Xkݣt|>LM:>iUoy^O8m}#B_V>dk|/1k$smQmp~ysԟOk>/lXzbm^|Բ^(x47u yakpbo1}nod=woo#UGmbU +x^/Ǐ#o[Q b0h`hLMU[#'VLOzZX>gZ27h~jR}T31 aE썎9*npH9}]lR|rHAN~9oct_ ?9OLÛowxž[!3^|_=L8jH!5DES},f ]`uމm {Fn&V˻1PVY1BUYxGCiGNh1NyhN4uGkB>]<S߁3[  !OM8JOޠ1?E〸5!RE+DOi8lQ4,t֦K5V_%mos$Pc6^_,k),uw"imdùg,f<=tTOEX/&\ _"ͻ4|]>w~537f=#V-Q4;_8b|6Uh[1ZUs!pBܫj8gUw"Xܓw&(B 4'bC54]G=[^~TxH3tսUlT ݹhuw8Uk~֚bO5W赗D?JgE-Cxs6Ӻ3;CvK/AjӮ1 [ uU^Xrta+~RG/I}Hk$tQrZ7XN}z_#wW)DOfIS]1zݵZ,3w͟YR+1=ʢTעna.g͉6=>ܚ,/6n#P[׉}ښoѐu>#<3kh[ y rַmu%bkH!5Ƚ\#OY%w},> 4Qx.0ÌT~ e1~t,"9JBYw起 +7'$gNr VM؄|wE,6f0sׁ™zw藀{Uyfy>9%g3 Nl點9Dߟ2|Si=b[7 Y=Z_Dmt:6򁅅>-anZr:Nfs{Zy]j]t r2,hv}lxC'#j6`jZFN9Ι!慼FB}m9C-'f}zn _]͖1ϋu0{UQÇͱf;K֘~x^/+y!$j 2.e6ȉ>VCfzS!^@!rL&dk34;ri.W{k.Ĺ_c9\ܻ'_?<y} /&6Oo9Lk>Z3wzn\bwivk]*[l\j-]4çڄAcXT>j=_65XG8b%G82eCP%;*4PkC܃ 17Q_Ě}esI`3Xiwyxq \k5|hXxp;wsVEf;f8[/B~0%7%nboF;LmkS~U!rJ0ZXb& wZ_k=Ǹ&y[ ;3+X-ϵ.]M' y g]Ġ:KXj$7k;ET;S 櫫-ΧhxblM2/-\QxVߏBuT'cG7EщRN|xyCCT3[C\,beCOrngfRY2 p 48cd&FbL5~vakh{M8l%?[Ce C>Wxyr&O</ +>kQM[ٴk|{y@!ڏO>Ձ ^/݆>b,q䩽C~Ӛ9/6LCiBPjO՘>~wl[ {j^S +5؝3x$] u&k3i% R`Pfkbj8J5S[G;gkUh`&W +] 7)Eͪ&ӟ[hg|Lӯl-a}k>$箏ojaEl֌fCyk_D˅יoY_?m=;ׅ7B}B)\"73y Lcь3%bK7v8\c—> |vH*ur +~x7ᄥO7{=l{*Bwk@6 Gsr[c;K f=^v^ kgZǕc|xa^-vԢm6- #֎;:po1e7{[&}8 ؑ KA |^pX!c / mQ18Od q@M>}ei幗1RmC )_Xd>%Gj#,y fgsu6הnjN=Flo7eТ}pٯeJsʩnqag?,zVYkwJQ3;ެU\g1>;Y?SzEF&|,lцމqO^vefc'w['1VG+9kpwj}uѺ4]ڿVku +_:f\bjmx?$v;\r3^a}A@̕Xzc9![g.z7΢5*-6Ηa+#,8vg Q'Ϭ^>#0ch,&l6+ۧ i68O?s=h^NrtMnKwy49C97 Gg_` 1.1j7{8= xj}1~\OmዦNanǫ\N\ 'wTis{qb~.0[f\Y&hR:&KʱEh"XXg6f4&dO(d1+˼fOQBEꭺƅYN] /cŹOrHV`SKM96(ŜU>&<ֵTd1N3z{j]룟y֪Y,tR*xgh;ՙ_Yz߶Ԭu[=a5tӇ+71Ͻ,G<ǩ8m0Ψ(bl/8|ǟے8lU~;b^[ +טpj\6MD8Q5j/B 8jSY!O9HXdI^EgrjeQt>CSL9U^L zq)w(:xr4k<Э5v[ׇML0}bWZL|cIỶ9c,%&XyP riWxR(CѬYsCF~3ǹ%Wwi.kޗObrKL/ #1Qye.|"~b~^W=_u ׯlַ~ל((CͿgc5kfe%Vx6ZM85x0vtQL1tލ8s} gÖE|P[@ |{JZ Q`>>r;{әn;θĦkUk3ސmvGS}}w3^x>Sî?:#1|q'k-#рB3[wo7x^i90D}8teCQ{v|i)Hm1P]MYnjٔ)S2j^:fdXx<2IWYg"F|lZZlrRøJ]_٪%%9 +{q}}Wdu'zdg1Ϝdc|ka6v`nv&KjCǼRE7Wǰ^h8midu/=|}"f#Ux WA+F:6cZE;9clbt;PO)Cgh9 %=^o(5 cjW@ 1R%d q]ӺMׇ1&Z`; |a@4FEl ImMb C|9E}Kq+ͧ+ظ@3`}0l/6tW#!F1ڰD /νcK?R}5fEC^36kj :jL?#D ϡ!!З}~W%MhIAb38X$P'&Y:VJ9 +*?f14Cՙ`cNaۧmg}5ȇml5z}p@3n֕vk?'dO ic[qKrY>/b f,^hm7Zl~lՆ:ke5}HbO>=!~!A ~ %'gQ 8rFK:ޭO 菑74?v=9bp5F;MB^zy]F˛l`X3)>Yqw8eK3.{6>d+Ś|384f͇_3RʖpZanI6vAKE)gr=H vAr,|΅I +Ԣr]J"gDXژ("Bު󶴦xYb̾sO)PGrBKwF[8 ˘3_ٴyn5=AkPz48Yʏ6@_{MaCIXx=E}[mlgˍ6 Dw _͖Ț|m<˫:Wt5_-1 8;Iܖ*{y{yTC>Yg\ ~+!"laXmOϐe+e{p]ύ&A1^CÍJ},~;~/1?®V ZF5A?u@nޥwxpJl,:'}Uw<5yt|h;w@/~ZFM,׌^Ebu}L+҇+n}P]A37Pߊzh_$b254a'} 8/^x]d}aXWnS w{bI}fはe{GL M|׾J-iTcܻlmU'bb ۰Ou[~f_vzQ3AC ys9&:%,uVrƢٺV6iOmVXjS4ѲS!]Fh4*s`}~+hcrZ.<@s}Tg]#ԟgoVh޴Wy:n0i,FIw6ކ4, qkj;::I zBg心ް!c7k 3|=^O. EBoߎf-%D2_alYX,~W|a?Vj"2.cO%>\r;1gHXo3g~.CrLwFH+uSK2Ęnm~h#~dHSEle5v+s">f'L+|oۖc]˝?Mn\͹V;'m> <5aE)vb/34+4 +MB8)zMkC/kvO3 + [ +vC~9J <,|Г=)3o,ܚE}0P{7hWuj/x..6~$͸)W5'3ZkN';./#9g<+c9OMry-O#Bonv і?l@mbb1'|\uoǁ01uؽքh!{<hfؙ'ׇĿx={)Cnꗠ@LбY1fuo^81?~d}~>KuSkF8 Z9 Q58 *c6yW׬Zf؊f=AuwC̳o;?:' oy))F}1~h5mNӻ%>GET?K +IvxK}AC0U|a?e6@AtS08rv{ q4|oOЌ9M 胠+f'86CA3 2:'D}nI,܋"ak]{q1QAϯ?~^Qk< +Gzk9M6Wh$Z}|^9#挸NsUhaVCLS ^af j +cc@oA.C,cc`6\!Շľ!ׇ;biفVj>I;ZRQ/C[eQP[[2;8_2vK] /n\~JьQ|،Q|h375o!3׶ Q{uy !m"195 \sύ-+EmKF\|"Y#OmO΋=Bo>uqX _=:ȳ׼&~0S3·`,ONp,zo6]h̠5vGpʸc=3`,OBb/o=y{a'ݵ/-A#X±JBEz9IJuc+Q/:C >ўz\'5@< +;yS`Ěqjc5ɉ}!3|`lcsnQ?zD~:Vv-f~v=HNk9{< :E +6/l 3, QO{ 1HW}>nkPJ}H> \!eh5Xd_r]sdݷ:G^;v:!-֏p4& Hn#یql ɵ#^|bo8aPS!szi w':V12 eTrJ^01f<Ͱ#GQq2+Ԝ=Y}HzlwiaaD~,n.&1ڟOzp +l?WHL_%zrvzMz :(g=b@; 7 hߺkG3 M;6zaXIjcnq ~zb3F͚ *o\Q57kqM5#76@[a][ p7W?D1&g>;W[\=Ɛb>$/ (ź!p\RsZ`U9,^_ #׆S'`p!0ëC;obEҏ#ᓨ_3> 5`#_'~r,XO&7%l +z+R߹̀]h01;_rڋO:K8OXRSX&lfCKG.EGj$\Ġ3LiYfO| 4sNÇاYC5,LybYȯ$kLZ\φ~VCr6NҘ[&pjQL6 #8l/WZ%˓b0> H7y\u65Y>t~:rɟ&.>rj\FvǑD@D 霩;k}8g>Y挄gHٹm7 tQ~AcMyTؽ89O5vnnw{z-hvU'O 2g%ԾeFcxZb +UB$roa}?:j|[˶4 +) gp]n-o/cnyy_ˇCL6fƄ~Q)!r5 yh y^NCsFOPk.Mn XSF8k^uZ :K!5嬠wpx54m1{9P6vцZUƌ]&D\ǔ{9dկ;*EM-;TXnjyHq£g`o 5! 3C|n'~5v|#Bԕ>Gٕ#KL21 RW؃4VԘWxVz]z1}XO^ 3_-,5ʽ,|k,CR#^lOФdNC̃2&?2ϓ@u}boboN$hp5Pp\5g(YXիXOvy~M~W?qbװ?XOoc\͞iSXf'5Z{av{ma{1{ + >Sf+ ck̏좛x̱_\>J-zpjDrWDk,j`|y$8gʳ5s jWr⾰`|5Xg:.N׻krO͍:Oͅs#: >Jt1~lծf 㕺[7um}k^Zf^{/3{(b.9%4- 0>M+71Hdv(XMY5IO׀րF` Bߡb~{SWQC{0~?f?k<|'5+_߯ +"`7xl`'`Ó h=a7_(}&~;CvNoY%_F Ɓ1י8;p ~ -c|^v/ԢGǝ-a/;LӬ.Ux :]Uut*k{V÷7ہ;yicu u(k^I>-tOb:ho0ސ(45_,E/yh[GnLhߣʸk}q`}q V!R^0\b_`Mng}&v5 hk74.7~(TX+`7q_w~'c}௡'u9/?1{'b +oP&0f,d>bd<`/}>}Pxsu'SeM4YI ,weJ#f=5R=k̗: [/uK>}e/̢cH}^P=uSnWaĘůÜfqY7Y?Go5H\K4ƚ|UbMY e5Ͱ*!n +IO{5@0;Ŵs=y'cy;3Vm)V1rϽ0=W;`p{&s4gMG|_Y<>Y8¯-n ~rV?Co'Y)<(0kNPۘzpx3kf.ymO lC$-3v~ %&9$ ϯZsl*E+we1e9f-\3jw X|OkFv So#Z|]mq^oJ_9O,vG쏩.CzNثirq2rir?7SeK8 #zh MTs,9u٫,b8b÷fhj8ot΀s_AӘ5mա.C53$XJlZ{7(s^v/ nm &Сp^b4-@Yk1 '˸BV}'!Oon;3k4>¾6ĝ߮ 1zbkAb6;SEHί|M>uWy`n4XnX$1^~mo`"},։5Kxڏ@Ec,yoP9 a3 ;&^9d1'reׅ;Od1sw |\x\xXXJ qgUjyg?Q0U(!JYl.bXCh|s&xh;\>>J0k}鸎G;PMz>C,+Hldt11hcBw՞6Ư7?^Ib yA3uAe|4^#-Yױ,E +K2r,!}]Iqha^Ζ~$׫V?9}5gS 1SeCYF'ytFAz7SfpBsӟ]sWܶk5Ɩ^CUup(W ۙcE`,czC0oPA҃6}Ԧ}9X1oNƂjШ7/oO|= S'L0wrj]}o}9"= @/g̏rj򂗀9 5sY0Fx5y\^uH.k#`[y܆uF-s-0/Ϊz1k6e:{uzv~3M5L:VؒׄaXycuQe(˨blj1S3{\Ы{(yIlco%5ҽ@7$oA.?{1{'59oPWSiP}!O8XgӬq-I\_"_)gt|Ub ]1*ŞW?Tz{2 יrM~n۫װ%'ݙWUq={T5m ~{A+YސLK<ςOtDuD_tCd#ͱ9MԜ1\ܡSٯ簇~~4{R-:\C_)k'%|=yޟٗϟg쏤ǘB!֧=gy֔7g/vKU1o\>CͳiNu/BmUPWzjֈyڟQ#|,}}GCsynx ͞x U +c Xc:9w,G=2Yub/h{yr1^=1:fu.xCe.R+6ڑ'OOfϞg/_W>6 >+r>iSs u׹;5 r +E~&=`cpp{ʔ)CCCc9g<ط*ְi4Oy߯zW2y=_(:{Yd="9*#uS rop[ו r%|i+ = Z _rFc{3LUuV\)տ톺ZmV.<=S-qT{$ ׇav^{4C5xn/ldN5` ٟך0%g(h5sU֞/G~ynL*çO g3??{^e @Oc-^m%o_Fԗ8YLΰ'”>niӦB5ܷɮzrŸ~y~H>-ulW4pV\{M_I?Ws{SH{6{Wϳr&<✱rCoh!HDұk7Gu" xOKݿeW?Au?UX6o6h/N1cs}#h"bi.aϕ~PSWuww||FX=7'K/ۗs.| /"g596&&ØhrZC}~^s\OgBeo&mUӧw>{"S/az]IEEא0^'{nAm +-]{<,`bi<9VQQچu@Q4ewyݭC*(uܫjmƂZ_[;>O/b??.ד3E >L Y1yy/x}C"Gp 3#gN0a<9CW 9#O8zO[X=ߝPln_ZAfH}s![cɾ2z{]"ʘ?j=<{p!7WOUU/Fe>Y+2Pe(hT{Y;)Ɗأ!BaYb}gG+IW'rǐdlg\Uw6[5T5%[)P+YI>b 9*Wу34h~M\SKsj\SW{_}f*b@rĶ:N\=PZUZVe~ cXy6oihL7=׽=ؽ=9s!ٟ=Էx= G86A/gu([ɕf8/{\V5!vHw`˱V} Ll̅?![.MW#BOTu!=o.쟣Nyss<M +ֶK]ۿRl;[~펺MZ5rՆ IbcĎڷKcCߚqsm=kG3G!~%q5%v2$0!yE/gzzO-g`]w٨s!d̻Ck^6ׅlp!Tk\aG$0~{9dzf֢`MkumuD78dcmҷ1֧8=,"ngAXKcSRhы[#gk76iSkyz>^{;YbZwP+jP_I. Rh^ؗ#Ś25f /eyz.oWvG+qX;b$i;L:48_7޳IKS%smWO#f~bX^8e|7q1؜+*yW@սIm}(盂F Y1 B^I 98P;abuh`R't/2ެ3/zOjɷ&d:˂#3G){Us&>5i< 9_7K=+[ NG{ `rԡ/= to=hW:J1.&\W`Oq\.֕!05fe8|xqi>K5͙+*؝Qk=ޘ6wnMn=x.Ŏ_7XC8߰)w<>}r#FWSa:z.вELx?ƙ`!CGA5 +_Qׅ9ٺ#Dm׃)0j ;Zk /Ơgi`Ob@pwx 1Ai k?L\cYP,oҘ;?[}y2=EGM@| enL>)KtMfuƹp$YԩȿgU5xbWl+q!V[[sz? 5ZF.d΋$\ORp1wa].ydˢTP1|y֦1 + +y:gso$>o_d<$yY #W7lDeXUNzQݳx[C=d43L%"6ױ>,}zK'_矀9짃&MjJ.C0 L9dz9gtF٧xvtDM;δTuK_PBfSn y.8!D]yaXR҅L]I#eRuK{ zeV}X^AAsTfFny}?jO>d? &ѦV[h+iݫ7aAͪ^s9s]6D aUo5U'Qa09D_yu!i`H955oۗ3ߥRf, +F9gL|X[~ 33>y,l{G~G0~ppe%J99jVM9Ly83rIACNj ̉:٢ݢ.ٟ!2SBzm-}?:0Z /.ׇp<b_[AZc~VlQAM՟Lܮ<^yz*3K3Xc&_ls .^`e1ixf\z{+&gZ+-ՂVHvԭ?q+2I` Xz]Zk:!y4/GMs%Buf^Ϧ[e((]ܭy.~ O=z{cT}=}K{u5_K&%8?fdu)x. A<yVRuZ,ybY +Zt!E.DoW ?q*8 f'ץzdojn ]֟!KԮ'HE`1!=>BLWtjpbWoWGG}dB_}fR>KL%'/(xhc9W N#N?8}8J^I@3 A!VZC5X[ +ZY%kI;=_n +q8,#Ns>m6[7RI z3 yǏ?b},yIw[Iw'.<>!  iviĽA;fW:3&2gB0Y +Zվyo֒vX ؟8P9 ,ǚ=qQ_?Lb&3L%gCΰ?9ñ g3\YcʼDAhc{x C+ km'vԪqlFseߩwNC5^CA;k^ Qߩџ`}H^pkaOWAG^|NGp09 +rW۸G|Ɔe^`P+Vy X?B< Gnv|^ \>&kp, +l~BOnw2GAǀ瀩B%M֐k jۗWk,$_8e k!=S݇+x 'm"9벨uYvZ:L`aMi5VE 2?~+j/MNJ/ViAyuգ'N uG%.å>>½/ٗ(ϛ&vW3^נ͖x EoywkFeo_]^i &pҩ.)gƠK^3, @?QAcx a;`]a$.h5']v~zRM~~#e===^s\1len>?|a=J=z˂Hz c۠]kȵP.'jcOwow?D% u+9 ]r˰Wsw۹9; +a[-z Ň"Ͽ.O OHv4cz?3{ wq_=wi< Ԉ0̻K`Qx k[EA;3珰~9egM/l0Y6w]?ZOw8;#x=pw` ^={fVyh0&48N~x ~ +?8y߮׏aG W=W 󗹷a}o c rh2B0VaO߫Oo|mX6Jk_&c GN0 F@hry9sʙfhbLq0&np[I=ÿgKFW!>(F__ g!e zC- >(Նzg~w@1:\5CGob]x&=ֿ8nTXVw +lzac LC_X6m@8 sY Fg&>{u^=]xm/~)`MvT"z_skF|f78T/(gBu?% cItsoay ݮ%ư0YbV9|\-tA0߷9߿ MXëH~3;0:;IH~< +7gAA3a!aoCp唗Og0db Wʱ{28C1,ç2ʡ ?3S;Qm{~ϕ/K+;k*w5dM +06*ASx}DnFy:s>op_- 0Z[rlz0n{N@3\fгɔLD|HFg$>$뺕s2uNTv>JuȊm63$?%\j}_9`JiRz9Xy~`KOkgkIhϪ({ кk}ԃH -a9Y>OAj udB3\1x:,e!"}A =xnw=(G(' +|l% k} cZV{ +~/~ +ns}w$Կj+E !QTW. 9lyC:v+{~wk0:#> Eo34LRak cA=Lf}:qfyatv=gpk)!mk:?Abm--X LVbz67Nma?,ygg!O8۵ 뷮q>A]or T,XCT% ciz!Yפz<=J+Ơ'PΊ1s{3d?LC(֠BѰ)p\| +|%跶3 +> q͑3y +k{#&?P<+yO3^KX:Z;h2{T]b {TAcY *rl6N=y;i|9_ L4:Kҧ.e-oϺVԯMTDa~־ c(=HVjN ^ 8ص{Tc$:ʔCφ068p5>~<_щ)ӠOOÕ>SX۰Χp4o'й||^渣5J[3?\Km[c3tB!' \&sL sG_Ç~|pFQ|ѴקA>J}Nunlͫ܋5=k{:k|'T/2^[5 ;_K7g8gDLw.S@u{X3̗md5cpFS`gFg#s<اA=6pYx9XZPkޏz>KX<3E$5ޚc`R5L0zC=(P1L3tեePf(@=ah>nݰ;4C*1GNm׼kKf IVZ;@ L `$hK3TCL/t566 ڪftC_t3 +7yFWj"QXH~+lA}_ASt>s%OP_(`'=R~>R\ZA50;N¬TZr  555uhA0:Qf%(TG{o$5֥z>+_M֫b^:4[ymۊ9cS:Zz8^@t&$4) \`kM/t2xF|xFV~óA7(A|$A*Fv>sA;?|9\z)Rx6gKXں6 Oi)Xy 輏uU}d:I<]3ҏRȨ3 麺P[SS:Ab"aG~ÃO7D)}-(JA꾯]*I=p k:)๠+o#v}( iSpQ=u{Q½d X+C7z(@pfҤB P(g7y~ob7o;FGSRk7yS#~Yw}07 (q +=OlVs 꽪&$_:}p/Y0J?/|rPi0ɭI!~HQ4t ~q[ߕfvT7hC]6:q|}T8< b2dKs{;6 Z5J7t14#D~;1h[AmPAy7hzb Poyk;o(Ҍ/0pklё|mkS/X Cϑ׃^4-?0Nizb}Tz^۔Kzq_әVe͠^O+Σ79VΣ of nyog43 +ƊkA?We~)0KЫL2n֙ΫjNSoh׌0CvmUrrQ/jz4J7oYwoC` $*UyʇX{&6hmYcE'ok 7:~z(A/hZSXv08cCaP4.{lz Z+&&zCwG/A%b%in1V u/媃Q~b@#{o~PoC^I߆,+7+ϋA{t- m 쩅}|TKw6hu7 ^A/Zշz7<@Ykաz`túշb߆kB߆gנ&yo0V4 lm~'</!At x ÕM*Xg:Pnr"3 FCtqlvk~YG ת0PW9HgP$VrW_} h\n Z mZهusbT|nЙtks,0 sZG9}_N3`sp?r^ȪFB9`za%7ͤ@3 3 +4zqľ o_X3@Fx^wK{>i<+0C5kl0SN^΀C.0r*F9 :0jxF^PNdozz):z} :v>WF93ʝљroK{>u~1 XYcG^8-<Ά#^Rz^ ա  P}QޣiU#˥ YiIGk7 Maup1|Όrm?vh̉3 +0c3 |yqF ]}?,7͐ {/<ݠPM gJ4#렜uQ լ& :L5,83}>q-5ʉL6`b( z+nw0 `iy3A/yR6`&c-XV9x ua3ylL( 0V<}~E60 'Uq៿_x -FtpLeeu>˟kZoЬ*m*=™}Ұ0βX/A}C7kgu[gDv2 XH=)0K nC\>8 _UU6auuFsj*ڵ7RL*7 3/uͳY|F>np8Dj[na%}5~|_~ ?$>WNC\(61555AO+rlVY{V/OX?ndm f"' aߜ6 ^w៯§off +0F]]]?tB#T766f̖ISTB5t>7dMC3Z<5}4ͬGY/fI7ߓt,`h7|? |~(|L|4x0H/wkjjnݺw=̖XWi +C=@3 ѬhTߋf8uy STqOO ge0ob ϝzV_h|Y{௧6oDUUh:B*^H4RKfgkUEz[o4:E3`=ĺ,UTUHXY0 㛲D½:gA/4y*z>{${XWWW^hnn.C+{izl *ݐn@/@gM>aXY;. }"/u~ͥxaƲT΂7OGoMzz2t̖I7hfuuor\#/oGZ)c9,`,M| SSay~zju\?F`zlX )ngՠ[O/G7a,;_=a*l_h|wA%qBAcU33[NV1'Pz,֟Dj0\ɐ o0 XzQ|y0F@stSֳ2B*ϫhTX4sˤpꆥ7ӚO9 +༮`L <atz|a#W]ʙf0XnXlAutLk>ahttCq0`Hiߤ_&<H/`hQ7oP&C_$d2ÄþtVGssP.yVa0Jaɳ -|_^Y|"XO P>0|:9pץ gOV!qvVaFWb~W??35ཀྵ!׎TG̺-7~X׵Ф>Ӱ:k]Äa84 +\{Ͽ|_ݠ37ѕHEľzW|"~|_>Q|pE. G0&H-Ώs,`ֵXO7~OVa a[^S"u! 8tVz̶8tO0 (ku^U/s|O|_ >&pzee06q]E)ٜ|倝i.dZ4k9ú.Χ\+}`0 xmkۉda_W| ;Io0 3^OUo{>nu #) +VUUU^=k !kͺS| +͵{f7{`ɾwXG`-g+u 茔t3V̟{gޢ3Z|Y#gTWWoX ك빦9XgF>4YW6?\+dC +{w~?ƺúߘ251G&u7k|o>MnPhG?NON]֨{->{\SƵ6l1mx^9(:|74C_`Zh 읭 ;'Ep#ujŔnZL0:Ҿ \GbI/Wz+W ]p >\4 77GNXwZW,>3aiX)HCT*Yլ4C;Dn]!#qq-10o"brLJFq^/(48 +akZ/?6)wY@#uV޽{ *c 555i9[a4K7p놉 pm$kƕ5s~zyi0)k}:qMpIV.@FwAeɚ<2fXzazl4?b9+a04K\~?s-gɘUnp(µ\Ag:;T~䗮eV9,,Iނb qg=<?{ab$X~0˯b_\.J3-HO~oFA/>Vǂf+fPg߷ *`ya, -\[PlAcQ^NCaj#@1S5A3ӕ2^lz5o bd!6zcQ$^R|fB9XaKÒ-D&zFys7e٠}a:~jP1J@]1&Ha͍03[Bf~|+(G +]ݡ? 㵵 qMUWq_s**y`F)Kp[~|/SEߤp (eqJ[BނKp2?4ByЌN zAgf^03+P |>'fE34iVcoP==߿1<syYYa[г0~]-NlCx_]WՁtZfXCLrnPͲb<{Oǵsu`c +;;s8Zsx-Y?ye+KǮ84YH.Bz *C3k#L/-Lm|UCFN=4CAuJ9|A0};sij+pV,C  \` `4 ~TUP(u!3`f-Dg~gV]3' 4B1t> ?P:"[L;FdY44[гQ2gnPUQzZll{O5Rf߷9K1~︖~9ȏ(Vg,G0$of[8w>oaKc k9[ ݡ47G}5GG}3ܙp9K YC20Eb!p[BsI`5qKūQg +( >*e}:yE;ĘCkybmŋ?3HFay-$k"f1%oA-T[2}0`f5Ps|C9<\KA~bOcL;F4PJ>t[h&4oAy .[p-ZYRcC9<aB1!s$_u"Y_oU_0V%Z ڗڟ DR_SоN[H-B2oauj"\IނZA~ǴYױ*s9(I3bg92B~PViCR'$ Vо3k|o (ܩ-8-uekM;$k+Jsnpuzn{] +:hv|h궬.0}Z+zGoK,N^A gPBiB߂-y9(I=_?3Ip )5':=۪0`ߌ%+8_{s'6xd2p \a;i]kg [03[5Csyp{AB;pd\? !ީ*W_ŹW0KWp^P9 [Oeee7e0x}h\D6-8[03[lqy  8~Ma*>d8ůV<nA1]Pob}}tf^4a|bOb\^l5iY`> nF\ 疗0&X9}2oA>b ff-vyWKUr(\⠮efX[q6KWY`+I>|=> +MpT8b[0ׇrM?9`y fffn?ny-+Y?!l_x{p _wq#X<w |_*mW(W +؞`'iدG @f0F`^\W+;,o,iA>"1j^%a=ʦ- 6]7{|8o;KF.YL7 +gK+Spwr؏7f~] 0)ˍC/tzgJeBz3333un(,:sjp 0 2?7-aGۋkyן.fjz=|=PI"م[+3ɳJurpԿQqkUO[jP骝d?Ⱦ܍=::Yh |oh:]s]qe )4/ zCj pm +|F'ừy!AA1֘/Y,`lS(ml+)1p}[53t8&+$f 5 B3Uy +]~H~kM+-x)Ϣjht~0G8S||_8N ڡwC3⭐/~Q?YT?VoaJ)u{OCb +σYWpA+8?v&nُAZ&t{/}PBNz K)igfffIc ~?XE0VPV{&pˁfr=:P^SSSV033[fS|mXe7StCrN~ 4ߤ0^ؙ3 8 +uT^=!8bElMmFg4O- <{u '>wCy+hU"qg۫j̚\3eug6Okm_rQ/TWWg^3`ff\LJPrv@3TE&|SO| +`a!+v8P޻ǿi4bJk5=g@[y +`ZAp{mxϏz1ݢ +aG|d\A!]Wd\_gጱ}! )gfff P7=.+fP}S7 a0k,sbmϙq~-s&cEz=0'iVQz +yld_e 7p> +w |XWp~ޜ=FJfk+\VILٷl!G*-ߣ,"YTŸ!\2օTN=p6=;υ˵hW]vf=UiX^,k%_9UL}C%p8^&p> +ϝTW͆P_bO&@|fW5V033[j|P_ _&g1|j4'Z~{YS~<<|Z\^[(cB:9bqF[,N#siOAgQ'(WIM=Kk G2yxlv_؅o d]Ss!gfƹ窾곒ISN3333`S>,v(?U=vPfwyo׬;r&u3`/gpg%E;座Cfz=BY>:3^<(?~0ڣ\ Gj,;y] +:_S_3UWT,x7' wGSշ_A=rM8B +Q̬SZ Q;(ZO+WAuQ;s |pՅxj"LkCyQܗ򳸟  4P׮x~QHjU%xܯXoT2Yu<{*̅;?wypjk??׀xo?|Gq%%sffffBo*!v%<c\ʙ,gp Öy8zA{=<^Uy? ><+J1dC2rICGیoG'ùdcA2&R}[ Z7Ҡ4\z^cOC1Q3}Pϗ3;g6yרQ:` BC'D34C=6zBJ?΄JYY7|\*w!_, H[Ur˥Z~0՛F9dW.i/ C==\0< /B1|χgF!kncI(MGtZ!GbCk \Oйسp;kON ٪'暣@]Ma5ƞCfAuVJBz{|&uެyh(:!b - uD`zE{qx[3oVNքֆ(hŐ[Zam"Ա=T5>ٯ~շ87J3;JSBBsT'W !b "Bݵh +ݣJ+m$V%]іh ?-.:OFЙ[ʅ 9y(|+S>L8]Ywk>Ut E2P F)?؜I333mѐɤC0_G֙/~AO_WHޗ^_k_ 7f|jݎs{ +n;x~Ͻʏ~4bʧTzRwLC:׈B_Z̏1)ZstUڋDcIڊ޵e->+#HFsx,J#ra.\(P}@f(sXsҭa,V\L&CQ+(ِS{q[PO-Z׃XԨnxM9}f6]w_/O⫧î:iS!u%PWj8~éJ)2gHK& s+[IhT{yxAR'&N0~3pVHG} -3C>m_ qJMA#(sC.2)?AP~V=ԟqkNڵWв c sYcO7idffffФTO  y]E-Lf2} XBX!-d PDIA(!PTM +ƪ^wϼIAYF|Uwoӧor\"'!U(Ґ)YAJPfֵݠ\.יf{`D&N'RS2H$v=sp0 'cp&}/ ~ ^ a|sS9 /5x~o¯{ނmx':V87wox=k^_%x>x~Oqx/pp3v=\ Wz9\+'Gh8 |_XtdQ0mpup͵s@aE!b4A L&_ !JRR!Y2~]V½|~=;8$; f<؏p=}VXz_ϰ`3~_p _oC{<? INQ?>[ B"O$o$ o^Jm>[ y8na{ +oaU(y]a6LgDv#:a X̵V+q5%$%>~L&$A J;<YyݻOt/={u+v bH'tWq0&Tb|Xo)1gN95l}.bup \ +W&,\7p뼏9o#{'\R3=kǜě /w /@&_4 m<|F#ϥpmlnr??`F .v<o|a:L,ju-IJ2j 94ʏ%Xgd2jBC({0WgWs湷ǗB K?Dz$s9CYv$)Y+51NUp ;%6U{;PNV{w>*/7P}Ax\K;_-Mns+hhp .?`p& +'rBaVy` +};ף~C7 @{Bt=t}:ӘY#yZ&ɴ*ާu 9麱7r'=EbPݪ |og`wpvّq)07 +q/fg .aa8pb \輏X7tS\P Uă=+'!?x;йCc7J86õpuh+B\F;l':8N~"ˏ#X <<6J\?U-PeYEOO5k.W0L -MI28=JX۝m!0< n`ҿMs_b'h܁cȇ'$6`2L#űP u),)3Ch%nC2#n۫r a +̀0JϐX{#Kpmj8ց$sA~F+I罁(^rR&)W6H,.0 +%#N3('!/n{=9ƾ!wm1<\%rV7sʯGǃu`&}¼] ̣3S`ao4v0 R?BYy(z  TW@mL&T3 d-AYKl.t>G#5Yúޯ1<ƉFO#蒡P-q&>W\9y+VfL&d<8Ԕlnn)APX 5yv/Я#%bNbh'qq$hcLis#W{BسXrՁ̀0Fr4thN<5qh +RxGG6O +#lG\X;kL& +ϐ+Dx={֞GVTu ECyD s6:5o}`A@+w01xՁ7u1y+y6糴rE k +%<;:2aܦ;DS]`y8^+&d2m-媕s2N?bY(:RD/ v-9wGpfhzf;=sٻ'0A詣;xNP=HYc<0(9-z޳AX1,.K >+Qy&dK3^!zHnFX2TY֤k=g]-'3x=)[u:yfKת31\ sZ2֠lAP %ǑL&Ѵ)|e2Y{iD:-ҙ(KOCLջ3x#Rp>"L9HjTN9֜#mmmL&~S?lh|#лbD&k&A:@o"l_މq!L&DP A}4uDD`4d2L3:_ߥv d2L&d2L&d2L&d2L&d2L&d2L&d2L&d2L&d2L&d2k{ĨM]UտLfJLI jE)RE*"UDAQD+`CQذ{W,bW۫y;ssI&m&w=sg^{ +!K,Ydɒ%K,Ydɒ%K,Ydɒ%K,Ydɒ%K,Ydɒ%K,Ydɒ%K,Ydɒ%K,Y>1cF4iR?~p2a„ܶn>,YdɒeرcC{{{=zthmmS*hkk 2epR,Ydɲ{f͚U·ƍWfltX5jTpfW߫444T*8sKƌ1D,YdɲD ԉ' +f`+ +Pfv  +ͮ%dԁ u`:qLGGW`Ugɒ%K,Y봎w}=5G?v[7nܸzoۛu-m{ +ͮfεl|GCZvY)I$E[fɒ%K,#Eva? f1^{j-!k{Bwľ&B9~k-5up}`V Q_~YZGzpxAoٞYdɒ%H͢dq5~}zvLaC#vM֯1-|G8nN&OaLllo7sܐ\q&7 ĵGpnm]gVۢho;Q_`1X"fdɒ%KT3#+8х?6p4o4{|~9m":0̰ݑ؅`=/S5^װ|7sY%.\[tx-]gB׶)p۔R_WJ~,Ydɒe1s)T1Lq% gP3MvXztTԆΗyMK1hlg;:|>ƾ8f@>3w6-|aw+,ONaSr̐)w{ +w"zrz׹;p^ELDm|E{8ΈZUضm]/Fs ,$\06׋?I&ƙfɒ%K,8A0s/(@AЮ0C+h7-Q tƱ|8lh:ݚ|]ξ+8?^O_J?pv^R%2} {/w_µ\9K렧GBP: 'c +86'K(핾vt"d38|j18?=ώ`У~Xϟ;.]kv3ﻕ1C{QÛ9Зg]_I{㻊ڮ"J Tɓ \/a|k,YdvD̠Z:2a„:lD=c3Int=]1|!vIJP.D%N^cv;^4gb ЋϥR܂O |5~s~kp.EoEokL^\mp>=cDOBFFؙ}Kl й,tj(1DWG:ZkkE@F`8] aڴifX`A2/v,Yl3rrcMh چvŮtw<6'ߺ.FX>=c;x:z6R^_=E_7з7o8c*kl>=>8Do=G}7Q1'v;yg:Mszb?=Wq$z8Ŷ76SL4mF(wxڪ׊ƔL mFT?'u&M*ӧO/CҩS~,Yd2bEZ;FhaoCǀ$0Tt?TJ[uX(}gpE֋W=ף7G.w7/?F>C\B~~9^rP37nS +FGύm TP61=m? 0{ƢJEZ A. 0Cĉ{{{ ^HYdɒeDHmj< O~O#Lnoo ^؎+#o!f#<1b~WWעסo@y7;ƾ߁~RCC'*?c?s裨'^>)x ?Xu{B?ƶwa}-z z2EbCq ߱{{k^b0\9%x?ѼPs[r`t#Ǐ >h0a¨ny8ؒ{#fɒ%KS +.9L~8眃XV [{p8Ob?⧅#>+q*>DD?~ !5>?F'_A;??à+s|$󟪮cClߡ2XC qO(,OD?áS>RP{ʜS3==xw_TS2 K?fFn/8p! +^F߂]xv>я҇J(m~u?x8N9sm1Q;l#{=ф9b}+b6Mlck ? +%F3~}샮oʽŜ˹z.NM>'쎮@!}e6ksVIe%K,[͟`Nhb\Y;9 pNQU؋7d1@l-rN\@;嚽8Al]ELO[[X!kÍ 6>䫨CKY,&C"1{ЗG!5xL^ sZZZtpSڎ@]of7OũrB +%K,YFj} + +r2N=8qpP+؀`3>Mm?A]O#wNFH` –dtLR4C{ Cx{Kg榢߉Ƥ~}]ojnnѣGpz2۞g?v{C0?>:K,Y]=؂Goaҥaܹa޼yo\Y+څH?:?BJ®́<}R(" w!z9jBƷ=Ѯ<SbALq jcIugޯn1#ag;O#~z/zOA|N &xccMMM59xS7cPra/Ї!ıT|j CEGJ>R9䌚={:(>3Ydɲ-xa]w +V .,0C3ttt8:1&Wͽ_J.9}'cwr(q@OxS( uh quׁ_ڇ0\u5*o47T'1|ϸc[] ԍGTjLTY䅆2DC>x/`y0*7QsipktPrB]YQOGj;dɒɸ!K,ۊ89fJZ9sfu(_3s[?!;X1 SIBu2A[Bͻ;-@(vC41&ġ +jj~bD>6$[߳ϟѿb;7b~#mHQCkcȷY3%4o吻\9\J4}a\q:[O{a +?~|;'iGgFfh0d|blMx'J>@R|7_Bc 2ߘE׹]#5}GF#m(m'.x{(vImWa>%}^; ]<o~wG9<\D7Z#74^_#MiW~$Cn)p_Jގke(st. Цm :wgF]3bTYd2RuYc|u11OCG̟Z63L2La,Ř:}'gCk$l|NA?aU(cͽ3a} [ +^ +S7WQ<ajjjz---< >~|\.k^?ɶrܗ[=)dۯ>)ߩ\PM6^_Jܖ~K__q}ȳȫa?2'5-sJ~/r\r؁Z$9<ij2~,2nܸvy'&Q:kcdɒekÀ +c +zm#` _;:@ +]yc1|I"q5'u +z'<'hos' 7.XOJ ĵx]cNC$?า_YOTsL) !C1Ĵ/V?^Oݎ>E=wr:vF;VkyQ{T8kZYdb +hVARs;@d\<u,91BuJq;&k36>A{-1ڟ=Кpc vзnCY; ǎ_]v;s=~=m &\^9qėӞǶsT1{$~4_Uܯk~z7ȥh.ˆ֝-Uo{-~jE8mqS两c ~e,gCaõyܫWOOڇݎ{3蚅y4<Ef Ydيe5dhƘ8nhBE½y==lċ%WsSwOp*˵X?ֈ^9Һ +k[]}.l|!yyyL4ާO3/ ^Xѵ'N} |ݍiݡGh~L~&귡S#m;YC@<[^Çh+L]K> y>4qn.֪5W]1kqdɲI +&3ǴVkMcú0a^ئCѧ􅌉߻0.O_C{[OH1i{S'lK5hyΧK M;N{=v;v0``A`N6ӧ3s̽f̘3/w}0U8`:`ԩS77eʔ A{`߃a[#Ʒ'h"\ƸV0Z7KSVdzaR;aڸx6&goQHϿ|-<жb#嫶*۷WLg [p\Qr=rTgɒ%˖*|ΩC#YԐdlJߌ'碗2}+ǘ ϱ78F^3+{^{X_wPm|Å C$/ +eL{N^;`VXי]&[յ ; l ݬYf~`:}ǀ/ط0yf)s;]̾KKwaomkk gƆ1r)G{(k!?<c[I0P8^$M1b1k!? smءv?v{%.ƟDgb͋Gم}s,/J劒NV,Yl)_!~$q{2=H}{?bfcKwq_K n##*nֹH~q{ Yd2/Z ,(>]k6ŵWW㗜5gFgK8Em}#Ev`}|=y#/#֟#o?nHyoKM;=6[Bͤ Ӟbcǎ5?{hFs_[0A7FFM:\0 +NhbfiEGا}ҤI흝Km|9C9OI>O#;?" y@O?"D!0gA?D5oopA*7Hk9"օ[gs3b]>ރW}Gz}.`עLv[Yker(9&M]w`zckKI(kdɒeCEP,Sf0K"^!<֯`-I}̎ևK9%?0潕6P9`è㴼{i!5R"1o܇Ko?́Rބac:z4)YLtbGSP,0{YF/YDޫaѢE7-jPS~ ƌ3ʜbjumЇ!EG}txG~SS3Bjc#2&œ;8_f@;~ChǑ> t嬎~1Dq-WC[~;KAgk;"\g(w5,h9A@ȼPYd(q q:?'SA0 c'^]yOZ@D:G?pC5 fH0p/+- N2' q]Pf3ԁ.\X˖-+ -^xտ*` + `' u`XS,|PaZ],!C_yu}wqrp-P13u5Fhˏb?^cj}H1_zV}_APgP&o"v k3rɥ.n?~N,&(IߚX0c,Yl8HPj)iu.x:1qZq+8sL4qi͓3&MV) %{~p`@b% +Yͽ&Uy\'Aj geqïs} )5xM֓97}W`Oc6ak~M>=H~kM/_^ uv*^cb궝w޹.KX~1k86=VR\m5EוGH>"ij{2qҎҎgsr/o-l8}6|Δ`(jm6iN~ca-_5sU(cZ\gB3kk)7H?S=z1ou,cJ9iQ)PG9ؾ]8'L,ic:4T Gu} | ׸.\,2f +Z71˒%gB\󬓧VF}ݖdel1r1+$M1qt9Sǽ4[t | +5WMĿ8o \Wq/_˗|!泱BL~Q*s Cȣ7 3q]붎ꝜܫOvww3LDZ X~m(՘z]# H:{iGߑyAy=dً/`+CioLj>R8 mO<i"YߡEMf_;"Ǥ\rX:D,bi*:޸U^[?Ƣ`䦺'Yda a<, +ℨңcOF3t2~Zso[j8sØT65 +;j󛓞r7֯ο\wyiX.8X7cߚxVKO:溎5qVk3Vүok9qk0ƞs';ldܸqrr[ߨɵ%5Fb56pkyfv x&~\9v=ϏfisKiU6@ũrhO#q +<굷ݡj͂~6}4ʑ\˾w|t2wk$C8Fdɒec#;菬I$'1S+co"cu&w@Geۙ|yyگ+G[Rd 5Kq9u<^X7LN 1N]5x#ײ=yvX`&m6m51~hC{F{uv!$90i9z/aw3NXJsuBJlqvb}yFwp=N~k8Ys4+LNzH ]ȶi\[+g|Tg.K,ۖ8Է`+1_[X 7Fck&|E3{aiEr3ȓ^d3^֯0PN9*%Xǿ{,7׆>%ƄJ P +r]zfo.tmZ7뺚 |Z3.8}=}{>~a,HKTl(XTb1Yd"^9O93m̂5']`ha`r AgmϏfxZy}<|w,L5 +P̣RYkC)0 M\{GY.SB9_.@'ꗖk&2uF\vza E;v<Opp@OA[ƥX[YB[\2e4=MoUI{w ԔPb, +eNVJ3ыWF筡V?)٬׃{Xۚ]wqByGė_ÚD)εC_/0FXį[pq-ی\-y D]v s-3y}Ï8/3x9zvwtn v1twww`nI rUɅe>1=96B~U`.f8 <|c&W_ eC۬q;TYW;PG҇^grf'Fn&:QP:4B|9"K, T0xA}1vz9XC0NX`W9qנ\y󗇌ūܺ_>YQÇ] EG)Uyl+rA>y!q޷ڟJ`T^]]{]-?b/Gŵa8 foi}|nvh ȱ[䒚ctE%&M2<2(rUΟ1GRE?YWP=fh ~0A_Lພkw(ⱮL%ݷUbnWXbrt.k2τqE"fqC,#ObS1 ̫jbl+:v~PHWϿotC#^PTou$)ݷ8_qݜ[9Ϸpf%?*%/ޡ#_ugr@w\w|יX_3DWC?#P}Ɏ_5&93M>E wXx_6ٯvu;̛7 3g,4UŘPRbW(GeLT#C߃~=CYPֈq}y(cwW2ט^1jMn!m 3j9i]O_!#Lڞga>>UDe =r,YFuĠ/'vw-Dwb5vasˇ2yQ]y3܃TWHL~bE$uA38si@ɜgO5y(5$+ hW^9n|ze|;\ayW݉_Kfù~6ƺmmmS +mƍk2oB<#r,3i ~cRjwHϜ}Qo +'.FgQ: dɲ5cc'-@A~\}סr>rSXq\t0~Ô|KnǮD/Bq(ɧ0z y"K-P.b\M :_TǹߴTbkߎvsBpn]=>m-k!qmt$ Jk(3:V91'p0O?цo*nءUIq4.rB8ƊPQ{)uui8糸RWhN0>} j?C6խ2Q6K_@13)o{FBs ib׾wb; 7xNx}x9\A.PS_!1xA[zE#隟~!wcU,YV nYOB fawwJGZDLl:ٱ6^oV\w0v[@ʇ@~$+f̥~Zc0c=ײ;87~B|94(yEywry$nt{ v捴zgԚ87wpceؓkaGjxA;`+)n +3Q%rocR[6BP]K޺6PDYZ~qxyyVk Sqr~0*+Bəmk*Xsܘ!D.(]~ L",YV9ڂ`'`vϜVy~2~~C?];Ϯc_cd/0/Sq kqʉWW+#O9Ƙo9ݖXvf.;mF7tCrlG}bxpN\/obsc5m]༏v4_BdT^:cNqƊ81o!V> >*9`qmF{ʳhܭ0HT)ɷ5um]j]r5w %OTZHᵡ;xwX3"qWY+)IϮϾ{忶x +3{P\ܝ,YN}uMB0mڴ: s(sn]/5V[9w-7]1OGq>A Ư7-0*+3_qGPr/?3ڹ?6Husufͪpd834[]q qkm&摫۱9 qN +^~ Sb Fs%'?uc/DPfo6yxRNF"j:APwpbF(D>1bYqy3+s;$asl Dշ65s.6>ҜLy3-a}®>7dɲg-ՋN:k6,1^e:y2En"}r C33GX;ά+naS) X_R ߝؤv Iϯ`y5c+{(V}\?lC 1ຒ+x9f[iZe|XoN7Ѝ/Iy6K9<{svvvNZІ47>aŘ-Vr'։b:v~p}yoCzJmd!;Tc}y/q"\NԮWX#APro +|,X99= ͙%K$ȏ_-G1f`3 Sw{ݏgl2-8O0*qgP;99IXBÕ*[r;[#7TWHL9.˞⨊<K%8@ۥ \`jґn\<399>gk +}k8߰ڿ8[ǯ/}ߙqnznӿ#^G_i'qqN3 s8YrS8 n˸!I-~0I|x]\;8;)5K;Cװ}`kEC1wJηg['q_J4i}jd6!խȒ%cnj!3ȚR<<1We=y=ROZ8YoB[~ |l%B_amLSc_Y|'V31b"v%43>8[Ct=Y_462aj:8s~05罸ۙOb/aL1X +f8˱@ 1e}r r[A'zHqsQ~cSEMM>%Q5&~*_h^89\s|}-q } ;/nM1ӦM+|dɲi$ҭUx& <OaxGe<,/ehBmnzXޟ:6_>:fY7> +*V0xWp_!GTsRrsϸfs|я3ᯍ7b'_>h Ɍpߧ.jaolA%3lTGTT㻾6p>9{]\f<8 TB3)cr^h H5nHQ~.O6>7o9F-/Ys'a]ˍY[q;r`u:du{ruא wfݮRuƉ+q..8||aAϖS)N]`ƈkB9yjm7ds?±3c=Wq>7n6s|z@ mA"b}pd>;y1m>mA KٮVp9F̅0)տ:7}Ә`.p?oތד"Ƶx/[3}|i9ķ;jfɒe":ɭEY+/ry;؛gg qzE9;|Zc[H//u#ag1F:fl+c2uc[Zi|.xC9vN,/78G? O$zւk7 +<ssN)NE_Kz*{0m?!zp>ػkƷS.h@eBENg#V1g8/DO C%vxNlB6 27l}de @sl\&l܏}x=O7{ry*%©vun`j 4>_|Bo1mGwI5'<n7)8YTg7%Pp@ˉ,Z[,>|vq{9} ?aC>Yz}xS의ñxB%Xl׵CvwkN``lh[c\5  +ݶ^ hסqgηw\C(o֢O·g(yz>̇7NC%~w mƹ3GbSĈʽB?&mm=߼[| }2>釴'27khe}yDt~!l]}eHL p[ڻqSt x3k>;{tEQ5./~-?KrSCƼDNs>PO]9y` C\mFA})bo}7dɒeM1vXBTY1~5==i/̵z2ی3-]^jrֵ^Ysr^bsע/{ϋU558is9}䃓J[$ޝaqܣSKq}W8P˯5dmעb1ys Bν ܓB/_NOmyF>c<9gyGq9~gM.kts^R=Z#⮊h率7+baG ,I)󦟩-z}aa܋q܋g̏|s(gB~1>sX=np#ocս_7E9惃7n + 5_Xrp\t%K>p"rx!r_,^j. ݐyU9~864nAwrlyc(ye30~c/"ikGS%V0mtR_s/V()1n,~ ډ⯔˙Ϋ?U+iqr[3gaEc<…c c]vXC})j.c^:xx$U1s)ӘT,a<_T?5JR#{19o"w~p5x&ɏcMJq,X|hs%?i|Rum6amÏs9iHԚWp.8p0+0 {֑5K,} u&E$Bl̹:腡+(?T>ɣJ +PZzw-CkU;{ 9[n+*gTK^N}lǡgX-\/#uuAL&W<\2yy)YGР0w]I"qwlkI i7h9qMvk!^^@SLb}]C/Bɭ)'SnWu9rIQUmFNU AA9.j Bm܂wx5} i-ugզq>r%z_w#grcݬյ׶fvY?Pflb\5/uwy N]΢}0WɬW+Qs8 /IԺ/8?JS\ߪ|Y愸nc|xC?൦x,H'qu٫3'vU1n]L7(>;,-Rq 7 '6-RrYy#1739>=pxa!֢ƽS(Rmj,I5LGDC`Q确wAt/ f-/Pbk/vgm +ך]KOyqñ{~gaS~|:ZY +c]qgrvsƬؗ]WJ^umQγ' +xPUs~ Sq^l3m4h;78՟ڌm<4)2cuϖy 7ENj`icPqf/_98zZ.kWS^f5ܺVsPe/l|\N%#ض;v%X[Zd)eurʵb3;cP8HyR/ȋ'yPE$/ }q 5>ZxaCWj|9]r?$ŝ".r5Vcy=fcϦ: vu%n ]Ujz(1\ͭ\5o.3u=8:934Mе/`vUkq c|vuwncѣ{>m@:)x o4L\V́| C5Js~뺔u7?<_XZXfH>.[٧]3#c}y>{OE5*%PȺH~(1411/3Vqi}jkic-Mr?,'*gY|vq fCmYVB_3hl3Z5gE͋V\Jr^ZcICnC1f훨poGv6A?!-s| kxuyH4fݺapMXs֦-Qm߄N bפd d/;w0:)G>,~PZ~3cM$1Z_`r:.TɹıSg2wGNk5AWo^V1zh:]Jml7F,9{/8oȲ-`3sJɡg\buUǜ8W{u"䈿1>粏q C[jZ+05dqj̺n扁ZrC\ + +ֵ~M̅4V.&:ֺSӳ??A?C5f~M(b֢d3)nρj^bsPcKN %׷z|WI>syd0З_ YUϿP +5X7Qcjj^[')-4z;Ɖ+:'hɡև2'%K`k@%a u;0~PB_ۭKgHksAί +e.]ꛃg 61bW|,OŷU:̏i qƯsY(/8sHu吰?Q;mܧدn8"!lҟ!ŕ_֬h(6:ɘseL +8Acxּ?1cOYȘ1S}56sl5"n0S0{nbЌV0}jl'yp|SbkkTAmvusO2C̐m&q}SAlFƇs+%l[J$B)۪POZ79\_ ? ߐe[uC93ٵ֝{̳軛qC7Z{"ƍS'ΌR%3qZ/-flwRLO Я&1GgB uZr+99=fnrj^Eg n,l 2X/Tsx~߯FkV+\cqƍ;v,ØQ24Vj7O-]ϋy&yC^}}GS5+epkXK[c,1c}is\5)mqA-}WVa~K zc`xo7dC,ɏX@y +8=~߇x}#*7Y ̰֔Ø1ctwwOESmJaUzrYRmC%W v-j=.9/xzifs>ޏ~mW0A{4# ڂ<I!6UOs'Pơ\s?c֘Ƈ#LZ;+ߐTY/ԮEXԠu-X5hO9> ̰ܬ`k׏0aBĉ['O[{kDTr,Ip؁NE[= EPUG>_y~z_>i;kg1d0cYwsbewpSys)Ŋ7صU 9!˶#ۿP%}Q ~ +u ЧyݕzfpB)S u +"9hd1_47,L>ϟF;q }s1[lN3pl?cgk._}i0{%~ BoF?& O>PG&_r>E(3?6n!=S>l~ -b>WXԵQkdglmmmhP5kV78wչ#NDsF=zu67<>e?s2룟'ɾoB/Il;HA8ǐ[$fLqXK{8UC_= l_rЗWQu)l#{||1`stl~Py۟>=wDgsqikkwBC1xa޼ya#/X"0aQ| +֐V?uǢlwN7`vN/>}1*z> +*ryyv;fc&}9q˔s"kr]: +}Yl>w 8<J P[[;lk2TGK\/{y"v1U+\[qCCΧȲ/T:&b{C_j}\y՘57!G:ܧzc\tcSyuGߗhytPzZRu 9"H͝Q_/3 B}-*)Eسgy4 lM: Γ ʴi u9" ,گ)7/,IQbX^ivls\^!_2x1-;fSlf'l'hC#=W,3#VWfa>5${yzSfN fpgr+Ляo\ܐjc0XߐeKȏ/&hMBT?A5,/`܏gmOnV0C@+jaUF"b c8>bncD9fGmoOKX;9䫰ٟCES d7+v?zYM?mF۸.F/Mok+m^ָZX߰ ߐek6EB/%WkrXcsgiMjccuwNXI:WIa{ r2\I*l9cQ=د^ƸؾfhY9謨3P܎[r8'Пb9c ALA5d(Nm]SPb%p[KEͱMrL6յAG bO|zmD;& 6plSCɍ{HO%ߝPQց_d k׳[(뜟$6^ܐ ߐlM2UlUWq=7-`xTI>Pcuj_uKh +s_wmv.e(nZ{&,FC8k!ڇxƤZQ{cra즪}5mC%ƒ=Cb1WhAgX~F͈Ǐ5O>5IuG$+rW>h9\aC8, 3bˡMިԮ7$|jWc]6X975E-Q2?b x'mcσᢶqdsמ od-|~+q6B}P]ׅK8[驡GrhḶ|ۙ9z"weCS-JYOKarBc'xz^ 77zYT\/TZ/jqBZw7Kh8ʺ yʱTng2[ +o@ߍX}?XX#᫡lzW/} +~7r?\J MpO\.G3W\+ `rSʱ)yuki7ߐlM2T U/2Ghao+ +xyPƆJE[ڀ6:Ǹag|6qg|swXњ?@~!?胐1M53^>s89s;,/X`wp +taz{{DƦ˃z + +qòeGtV E?65ƪN߭@>? =/dkMg/}VΗ8h1>%&կe<+Cnqj(]B 9^Cm|`r>E!S[̓r5rzaxˏxLBJ6\khI9u_Af@xOq62f@W%m)]繭_gl!slm ?m~cׯCy_a?qwl#a7ӓszq6xTq'+i`|6:F@-bf̘Q?gΜKV ;c;ӈ!5HMWeN4>:IWoqm (JiMmeO⋡=܂^J[ʼz} }ÖO-pfp/$97p0#ʿ`̔Rѫ1%us]yɯ0#9[b6qp^(^p*ǽcm[+FQԱE{Η +%~p,s(pLbL~~r3?~.h_h=~4CA&%fL ??K|~ #}u4Unz"↥?;5eʔNho3xaŊ;C1ƣZNϫ}dǽ~ZTx7?bTN_X>$L69LjC|Gs3w6(? !oK+nfj,bkі\+ nNK ׿*Ͽ0b# "pٗ6xr۱xm >㘢 \ɟ˶Mcoy1BO[֥鸄!f7\ q.1 }uXf @]>wK,L8qiz.\8fѢEmfPfԑXtKc>3yS1uMmkh \Z!WFO%jz s+Vpswきopc>c>\ ?յdIeʏȿ0"#|T9mx䵱>b;-$[Ec +9\] +Cc8\ 0 a4G +bjt\{ p=?Fë1dk{6k_ϾWWf/]cɣ..:uٳgO/,]to?m'k/o8Ca38RNkrs<-X{ôx~#LZj-VMs ~,qk]/eq}fN;5 +eKʧvnDt4˶-08M[fw4BH9|զ_͏$nyˉu1O^1m7m55}i1#lJ@x!xƧ1 ou}8~}l#_sp /G_XG>=>)ߵ===KfΜ`޼y,Y2uٲe=N03țc!7?_+ցȝպg3WZM6t >ؾ+^Hu}i-O;Gsste(ǖݐC6߰)a}9 UMעo;s[ye$R_ɑo:`)رeWNXSzS#¿AԸ +: ]Oz*mqJs(vU=lJB~4w񷜿87'ױ:{'A\M\y2ՙNq/P)5>)sz聼_ +ڞ~w9s-\pxa 63>Q'EM/F7X#| +y0UyB]\J~1⅁ yo(st9/=\2 0^=9C=r2qèE^mD1LDgOR\{#!b&kҮi1`?LF>?v-Vp 11c:p H8aSZH~qwC9yO8F:@\J{gOf]b_W=9~O>:g쿂l{zzN>},Zh&xaڊ+& Ơ `2f|b?~j&Aw^jYi_Z|y}>Hn*y0g/N)OdSt1/r?*w/1٣"4E-Y̥Qb- 0Scy#f,p^hLgWߍq͙azL0ܜX7j6O9}]>7BBs +)< +8383cU1OCidzkCYo⹎γCcOOBzveصPMs963h#2S'M4y̙S.\8eɒ%hm^H1C]C{[c} ֚]>}Ik2U?6Ͼ׶yW+ln$A`>^ +w|]+>9[rH۵mkkNF{bwyw~u{j1jiooo0aB3Fϟ?mɒ%`vBPp4=6$̐Pqu;{9cM}]u^e_K`R0))oHm>Ő#ol`8~ޮ֮l]۵+:mApӍpLt@eaAl:" +[PЀDHFd1P!"@ _dQ޶vv92Hj6-OlnfCt}8ΑrԿ$&^v_@sO9#y|e9RENǩGp5ZD,0X!iO쌶7|>6)yV~c#Z61gr&6WUU5 +g=V. Pkq,ӧf|xE?iӦϚ5bΜ9cΝ[!\PayI4a%W@ !UҧSwqu>ӆ{?YG4ȟ ?l{1*6̀D?Lö`ok`m +]FY.>^'kЇxi8^*Ir=x߸'hF%BBquҝҗ^gۗ_aX} 7{oDH + ૦v {Xy[!` $P)0>p`9@\SwRڨ1twwgzzzʄʅ ʅʓx%P f`ۑ2t:Zu5YP|ZR Pך%wk$ 8ʩbQ-"6}r_0NmL@r,&/둯ϧ/>_px -vb +}&FK) +>. Yïæ`ψ- ߙ=#ιf(Ka8@o5`6 +T3;5=+OH3N6 +}`T?7sXlܟ'^b1yT$112T|1d_ [ѯr3a@<3`j[ZZbܐʨr1ΟC"n@>|`J_74Awه8uu''!׿ xk| 0N5.لtJNj%%zn95!vMqĎa^o!| pdS7jx;C.j~,$g51\ /X8fX$]0'\ڐK| ̀!3djB7g w|lOXWA,|ކZc?2eJGXLz[fk?q,rڌo<z|i^y/+ayDzkB-l]R &;!7rU46Ƿ.{:o '8wD"{ǯBOQm@%' |ؘ%[ͤ vMFF +&M$f(DRo ?CrLv5bIHb63ix[>_vC6Y븚|$̄ "BWWW}->S XK&~9r['^xC{[^q5 G7˼LIOiӦsrԩ1E1Μ\õi[/Ƶ0ܱd689;5vOhl~qMMeϑFpytݤEZ +׋ɫ6\̀my?gL s$1CINdEȁǨxɿ]J~{9>Yb7oO|sίR H!U,cp%W"7gr?_p_u <㮺Zᅬrɓ,mNeTHrO||,}[[ݾ=cQ2_y!ᯚ[hn==aͯ46HO%cMp&.xL`l`atn)5vKݧqQ*'H]5h|^טhL$NZK8 +10\| +bxCchn{N{ʣsnJ3|9[ڮnG]!Ĭ9cң%O3)eF\G@_0P,x?Cw:ߩ K4^p*hQ62N%fNq҉ok"̱[ #|u${O*%_ֱIpǀ4$a ?PLO~ܡ=^ohY/ p&i:86)766 +n2 e9O: qVcaR/$ہ}nn挢r:}5~G8I4p*DuViϚT!>ax5fHn>p"g}gƞSnr08_g w`jtoKtI~VYݭwHok$}A&\(B`F/5YgQ|K4=ye=r%a=i#KL8GryHI~7~\_Vp>~ao/ZH{,OE+pĘ4)zmFs]Vvĉ.immVWq0]GONKG7\z0 _vܩ}[,0Ocp`ooOi~-ӜepB\JJ̊q^[FMa*\Fx8=MgPFÌJͿgXS+Bɑ#٭Ҧ{8^coRc{I|8L%r\=o^s[skIB98m/{/:D.]%,+'=hz$LZIgj.g+_k=+ y[ЯAsޣ{YS5Η #~H:]Lg;a{Sl)>|%g? _=>j vYOI q )g%Iک{$uj\M?&:mm^%z瞯 oC#%g"q yPszzUjlј.:Icz~Pjy/C2&Qh^yV˻K] ka* q~A0߈k{^ߩ1Szc..^8Z G>8B̭ +s{b/$Va # /`ñR{6VcqycܨŸJ*$`w[P_M}"9U]]Ӿb=r/ H*-bu%qB/f93IeWGi /?O{pCs~&rO 5oY[Ŗ^)'2V) d^V p&M4 |aJL"_e_{P!lj\ҜX=ȑ &Çj:,/? +<za}qڻ뻬w:[zt 9'߯'s YPم\aS6]!4#b:`ժ{9Y> BJv :瀅wnr9<l eݘGyy E0Z(}  N(9FrUIOC5Wh .6ǥ6֗o5n_߳HHopîĜ r%\U|% R 3t:_xӏމq^Aqr8+г|8V\"_VsB[}/ 9rZ uͱz3.>jf&Qu^'zHSCr*Rʙett!*b5ÿ?"v)pP+ww ίզRV8%ީzGR8fYӇJ9S|QU ܢuq{yϧ6Y#/yN x`%^.pg'\H;7E)}KKWHMK\:/Y;Jqy k3_B- ϣ?Yec=3Aكb-m՚z?VZo?걗\3Mn;l8YLrK;H}^?r^]+0ƅXp7hM>}4.-/Oja7Ǻ%a8RάJ!{? +Y(kǐ{GLIs7ڻZ}>z3p<~7 +xD +/`rWJ_MzzH7u?wޥAߨ㳤>"ѤT[W=5 .\O/]Rz$yP08P^|xNlGGk׃3A<^I<.6~}l|4pp># 00[$]Uי>i)3IB^ID@@@ +" +Aԫz޽޻^owafBfLrINgUɠa[cci*p ׾cRo7+=x| +.'}0sf~̙3vmjmtG-[ϟ͛NZ0&]]]-&L0m[p`KK/c ^K > ZA ;փFyͽs"p-|s ~5^?wnW3`G0{jܹsC4iR8qb>l>~k9+ur)x3w(5ԇM ]ϕ V%tpߖו%}+or7VkٜW/Ym2g{'g y*p{#? +///ϻ-Z">p9}t/Es@d~`m+_+z= ;˿_ n!+~I% ɫK_/ksQ\cGc뷳4O<fϞf͚574`Bo6mZMc9|қÏ25uKà{P!Γoρ۸Y{0LfPQW(7h^&2_I >Z>)}6(&+S`9ʌ!+"^:̙3'L>=8&=ww7+熸^>? q]:RBr_{gx.8$0!f#Ckjklљ`1kGB_n\w_+yd>ss׾J}،b"UֱP'ڧ`opR^ n>u{eGZn)c+~ x;x 8k8 dD~aʔ)ktϹ6M]AxFBzSa^7wk\暻wG5~}/Pxf%;V9{}!>hCk_1\z:Dž3Xh%PV :NDs5}"D!> ~ah;H ۃuӇ ;.Ob>gY +f^zf+GkzZ%zgzstμ9WNg5j>JRy=7 ]}aޠ5ndp~&{լwh:{؛_ܙ7[ u&k +:Pghdka<ٖ9qv{܋ÛO1/ƸfP>|.p׹Lk y^7:@ P 6NK/im zgsW{C~ \Gg7Gak0 ttPgP'/7Bgv(̅ȍy~ /1j6)Ε I^(7&lϬ`W^Hp2g>Vx})gBGn͸ȲS6La/b6~4zȲwO?K}~i6ez2W۪qks#;;i>zdk#W_1c>ž[k3-X/ĉ̉2'8j2cäKe;t[=O-I?k5wps)IhLv1~BkvZ'KGC P_u:n\w>Z3 җzX}5r}\|\!8~QI>9>9y]y% =YȜQ/tZn7$76&+dTL`tLx`s kp?D{r?קS}܏YŹhnewLdrdN.nPV(ǀg.m,sƹ3{),z׹7w&:!A SVШ׽K9+jmtsBhA78.x} /g`=/U ٞ'^5rBGZj+SVm }S\īU`qC>n쾭M!7^b+L6-D|C_'y?>]{g|/5q Q?mD|3}E{FӸ}̓u̙3gW-Sk6͵c1*RLt3kU'sX;0k;,;K׋o^k\FEnqڡ] z#{,ۗ~|:}BFX0c=mw}> +}sI\Ofٹ 3}Iy ,V`.EN:[B8 AǙՌyeq0gvk7&)\gwwjcLu)v1쒶`2 wN{3#az[πk(~))hT(Yonb֧xN0,{IƓ򹻵ݤ̜'1p,嘤{[KyV}TۡbnLFnj'DT-ZTIQk \t_YmLq 3x9`YW&Ζْ/s}+Mnc p_;_ >oQL˓(lM!0|9!70&kus<eZIgT#[79cunwnN_vc.FLm J+zGRQV$V5<_'0I6 /^\xZf:u=> ޞAFm\1YˍY@]GGyz:Cن%2vDcA_.Qbv'p6xEgDϊX/;-Z]\M%;o^[%=&F7.o5cR1<s%8<)y טИ"O8DgYl煨"ea}{q{mȏ _NE?ؓD{'dHU5[S\]m_s'}M6ΓLӖh<&$!wƛmsG#RkV-ߔoQW^ +kr WoBW\`}d3~s1la)Ɗ˥'/> +s(1NJ93}Zya~|ޛa07VIڌEƠ&U"P`ҾCJbC}O#!ڸ3E? Z") /ز _"_۳B?M;psu0?3y@5Ȗ]BDKyojqSO; +p3|S60>e-wpY{hR1L41s%j[=d[ve +uDuPŦBA}xC}I!Wi@Ι[ȣD>f60'xk+x|?NhGMPpxV_8'cY[$6ie[翓K6#8D @$t 'Tm8W__us˛(e . "WBM0 fYO7T"տIܯ6̽_"1y0p-x6 O90;<ְZڐ-ݔ &Ny&<2DgEy0OWy{\;s׬0]92ƫFF0#^0'D/މJts=v.AzBkiL8ޛ6y󹆞"ChcȺh1XݪG_Nc0֘R9$g5DhcuZZ<[qgEvy}o1B'ˣ<9MY~߳ΙN^ (N@6E[qm\3U7d@>1>=½BSD.veMM#`gt,wvN1݉o~ccW +qoy`W׃eXbG)=܏y~Zo|]\Ur52/؃y ޼ekWǬw۷c+RߞV c\;9t]~*Ǫjc(r%BxfWxa Z jP^hGYI/k>}֜Mo5 ߹M{{R;5TP{- +H7֞ +:ڨ7v`91oeL/c/=O1'-lΐKZeW}ލ5nDۘ8Kmz-I1fw αjTe^"A}a֬Yu &Dc,$Gc%'ygfʲ];ɶOW5'c$jjm6dzCΣPb<>Vn˯,=rbdqV/,V)k_ gLot<>cnH֛ #8cn1=Խ5>aӟ%gg_ooֶ=@hHm\ Qޤ `/W!i:>+;>1}ԇ^z:#DZ[,.보4wb&a`>5SB:ɱA\J=<Ϛ^/1Y8ZZe < +ٔ)W>o.![S]go\+/2(q;3,B.Ouʼ1* kY'K8ʹmNCc0.Pq $~?﹞뿖1:}vk3S@;{1-ם#@PМD\;CSx΋kZj#S/2ҳ6H#~kד[V>F/9T >K%R,`1N@}̺YӮэ},z~ u'ױy25RcZ i̤ (n-zQjk00|uCjþ3ۑ/C?=@dq3&N:aƌQ[aM"<ub^1pvh;h;\K"_^kM}עX1M}C.uXc@n%|X5n= :՛1ԗٚ♦p-msVNCWIu˔~N˗x<\SZg(b*9@_=. &Z+ŞlXZ(<7_o hk0)V+BKVXgBoooS΁\Q`_IgCgX\GOa Nc<^C1: Íe X(¸^uOwf\ee +cZ0e<+9vchsB%ni|F]^L"DNk`絼zB2R70ߕQ=VAGךfw!)!r| }>c/ucVxSc}'m!˹a]Hj{!88A87z?k7El)Ƴطy>O7Yθ +7pO&8w11D[. RΩ'9|uAgbnptSh.}>OS~%7k$A5ti<2t)zWkVk[L3x 2?/~\rȬYAV5S^drujrk_}LA}=Xn"}:ݎ>>>{;M~mK=C1Sh0q7\9lsIe݊quy6GsA{Ewowl7=dzsBY`틹! +f}a|Cn'݃g?m>gnh kvr?޾=~&q]^μ85Ӡ1w?'KZ-姁9ru9Cz4O͜Z`g5Q֟?Av} qې!Nଳ31loY3Vms@_PghDw,7^}:w +2 %rm(1hܾ(SCij{zæhW.b=?io00:*7Xc[>uow M?DQg3D=yX#8 @K09>>{8>~~b8hKgҰC G 1Wz-Ws:vVkVkq <3569rpwy'uzõ/gÔ`6*5=L`@{Y {1vbO=>|.|=x;ƃ*s'8W3?#zvzfz-ݤgΗUo3gx)WVٿВZoNg_zUL@y/#(a=%2rݸ-p_ + re}nޒ4:YZ6ehR߯>cBE7WO~qac]?g^d[`^o'2u2]l,C@4 }%}vR s78>Q`%)ߚ;HՒyGA5ckۧNcL{Nf^|>D_K5(XZ=́[ %gnsz8gΜq>TkVk[DXJ[NiɌ=5䠕F;p>uyZY'L0׋K5k-sA;6yf`o85wҗ_CkcؐNk~[$UI5JAwTc0x\MNK3=9J,,m4zTG6t7&yv{RoooԩSRWkVk!=C7;D5r>G1;}e>{9{͗3&"_[EcVp>ڔƅfe oc?n7WAYn=<>x\+k`=%.K(t)ҿI?E~Nd^ю}-v#:ܗ#v@Ȟ3uj;LAKjjg˾ay1iQ*ĺkkG~ڃȰcz8lzu OolM͹/ Rh=`%{ig6=h CSmnװ'>Kn(3TrR܄Mּ_w'oԏ/29e{0Gx;ƙ{xB˵^ZZۈs/"C Gq#H[A9oXNAg1? Ǭ{y98^Бj prb3PJ4n0oc/8os}>O1m=a8Џ1}\&|'{j+kMÍܳ>'h戨3G%XO']M,`LQJu_|2 Uutjbͥ$`"ŵ%jj֞`+(my蛫Mrr3?Z{/'"c؛7M0kW<+b:GJ+dicp1y9|?!PKK}53.=\KF0%RrM!ָr ȑ S"rHX3?3DnWrSٌSZUEGa-!r6i Asl0BI<b;ɯ^tq [s؟اZsA =纅 k8;S\`kW^> l,cX7>uP|XcCroB_ۉy||U}!\Oʛ9_˜Iv_J!55jjmZΣPƸ?oLs/иoܘ߆"ٛdZ6a„%N\ԡ5 +ڔ|ACڌf6ȋ!n=\݃5[#Gͅe >]}&8q/ޗ/ښ jw2>vN+~,ց\yo VkVkޔڞ=KTྱ?xVx|q ʴ5~snomƮJ#߂^V 5>ο^im +z'[*.佧i!!:UTSPAf(#Pp:VjjmЖk|sm-ms(95|,׉k_b9 8^Vԡ`?Y8iҤ>􅶾ٳgW@GB_~\ >b>uty_x#|]{BM̷5VŜ\ms_Q\KƵƉPjj1-.6Գloam!5X@rˡ8k}~C1a„gwttɓg/tYfG^ưhѢQ}*iڣni9:p?bֻlQ @>{&ꅯק3O/so`s@/אw.<(SUXjjmM+ +EsP#Xo׺uyI3` A,A?}½(>*˶r'^@sgx)S&6=k2m\ 1hcx+|#XG8TcF"x֯B-u?-<y9`~)c(#^ X4:E_(Sggg3 Pŭ3ZZąkZo -!9Wu9ky>ڂ"!OOSsn_>\/Fgt}Vc!g-mhÃ!Pka<B C!s[Pԗ3?Dǭ!1NLcGy ki#_ge]ȸ eȹ\0.og4u֏z2`<%%4MN_e?Wu݇4zB[`L81 7h{uiUHY</Y!OO,$g'[XGȵ3ZZ'}9qOAM#=l62n{X2nbGGG;r@=3,YdeT2V1~ }v.?||\ `rslr-e9A˜,Eܘ8 JІu +u uu2ؾQ. ͚N;1Zr݃*lP5Ik֪ev9<;ϖ=p[dܶ ۴-AAε#皭C[:H[B3n-u48z.KORmBuK)Iޥ5R"&պ [H+笘7䗅gG;x|aO  y!{V5,<wp:{L7E+ʿ)W/ 1Pj}amSٽ-̋WY7YG"+ƴ +xg*cRe1FU!ܪ [`cvc]paeuK.bɒ%Wg)jh^g kYgL+>Eo9R܅2em\^{mr7x|3ߓgz|'cc;¾awdڠB}~0}yq=5z +7ḳ*+M1Q>6h!,f+GAm \Xiqt`WҼ591Rrh 5vOța\͹j1 [\s2Nztӧ7Ϛ5 ݠc޼y]{"2;x_n=sg3k +[H[Gg;;d+ۧooo׀s;X%>^~v|#vƭO_mKKz9Pg'&0طw>~5Ooc>}}d|P2q! +߳X3B;Is~lc | y͕;%DwXa]ثۻ2?q~q|ur2؇1]6VNBgP2ޮ3u;G|E<'i9eRk[HcVܯ ؑO={v/z4~gz `m$uX?h5zJ^ȸׂ \ NOzłБ6d?H卩/d@6_c̋99q6wTw&h{CͻD}cJWMc!j |=jt/sԼ>I7fAxoy>9g\mڐ*xMm=+d=и,|1[Y | qrC2 Vxѿ}Y3Dĕ!!xZ -)m-u,잇 R/`ᄒG0L9# +y|g:tl!-EoLg!}>ہvSUȻifn]:όbSnco VhhcZK(uOl*^^ CTd,*pg#u-𑰖pظ>gMw D5WsXHX?948O߂7s7ܙ)RG 1_NkAн˽Tۑ`#^H?ۏ>܆>7>o2}ڢS]1]n)߀ЀPPum 5aS4uPyք~48x鏽˹okZq}^bANہ%Bu'O6.lgH =l =(kRkcpNj{v_|vvOs*\@[dm>t29*OXw0}>/}-bou9Z=ѽ^ߺIțݧW], Zэ}57W!8 TU^kbXS9.Qȗ1ٳGI_.^C˭y/B_{0EdB|15=Ft5zCs-Jgcuy7Ks{O嚋u<8T^czm_cL V٩6^M`c˲inkYƵ}/D۳B5K 3o&?ߛxL01qW0+j:Oйk7nz}]@<²ͮjmZS7tCq"j3g5?w ޏ,w;Gogn "#G!#cj]׵9! =mߢK?_K8vJqm1ʾr6̫ "!Ih6vm4 X& 5]}L}YI;Ug4HbMܻ~kLx+xx/FRx%, Ɩ3kAdH/K!֫+u:#":TqݏZ۸8\۟yM s>\x5> ,gR!׻VhRoh ksx77a}:ѵ5x*.דSJq(Vφ6'JEpU"1*)ߵ8hn%)Kz^ט&O:C5kVzC`nŦl:>sMS^6sC |ԗsg2/gkeO+C/7ab\b\H>ij_gẻg3-M~XQW[Cy,cg<<f:+V\}mZYgKɓ᳹?OǦewz={u̱YdlR~ǜUkm[>{(/S~b޶v'cޟ4 ~yCΏ~y=/_ LVK :Z&^?m8A?<=ӹXXUmvd`)q>YIg6]V>w=C; g{z\u}k`,CoX;aӧc9S*RL/0JCG^20rG"CjȹN[bp٠ޕPK؎9q$s[_GӺ& kBy8/sv^md;oW&7x&O6cjdK-9N6.ݗ&[({r>؅Ô)SV͟0sf:c"r3ӆ3'ti {?P;Xq.]Kx'#bNxmqKĜy}3㮍Ap}9X]HYMq[2l$mn3:rWC!redZ5reqȕv'̯'#w;SVqưaۙN[jp*xIru^mDֿ\e3My#ǎs!Ƨ黿%|fk=Գέ5y4tچ ;?I1zH+3ӜJ̭WohMgpMWkv^05<~)=skZ:ǍnK?95~PkzctϷYgPWpw-ycRnʤ7h/JzX0x{m '4sgݧW> aɓ'/0}ڴiӧOo/tQZQپ 76}ox?xv'I/6PhyI~'?Jzæԛq=F78~!}<4/e>aT։T'l̍18CZҶ̘X6c͝C^ȋ}8kDf 2:g̘s[s(jzømYg{_cŒe0GueZ=ZumKYgiWg?32WWbL&'%۴"<ț85,ǃ4\{/sƤ/fl!gbmk%Op "wuu"u!WH31sҳ-!Ϩ>b+{ԗvY/'^HȴQ/} շ׵GousSKW8xK%77rפKkkjp^hC_Lk9\6j9OZ}q5mkk{}{{38q.Ȍ9Ȍ5Zt즮]SkAdqCqv䞙37y7%XK}ԛ[=ǫ3̶sM#ae>k|S{0_qut$ОpkX>ː6跁w}B~0%uussykD0|O{91wښ/Uɟ !{C%;<{n~Jx3,e=klC\>~B} +]%\'O|m*{sE۹7_UkkT#/C ?FlKsCvb^8__0GV܇p:77yȌyԩu֢-Qk 3d>r^6Lg37~GsO 6f׉u|xm`÷!:C59Dz}i_|uzN _@ k`QX?fֲܒw/$̩6>t? W멏,(x(o.G]\b$@;;2c Չ*R$O.GgoUe0/u+"z$%n u,smȽ=?g`$ͩ}!MMMwCnΰqL1Y^Ep68c0龅2T~w5Xz|B Qeu&ִJluԙG%xoӐF?ߪ/2a.@^<y#X0) eZm8;C3lΠ0&SYǻ9ly7,B8uZxnPhkTV؁CN2J̧h4ſƀtyL;c,!}O@Yx5xe|z#nbohd?DE"gMVr))+>6B|`}'J__Yɵ&uyߊjk Ȼw+g( y6nL:1 !}s+q{ mէx++1wS=#1Pt k3?#  gY5״*ISsH_]N}kjTOÚ}(ښ{a\z3Do + +Pn[mvsx _f^:Xw;7uy{vQ9䢓OS.L 3|:,I24>Zr\G]s +}ZV4у h;ĵ߳3ސ׽W>'-6U̓7@|Mr}8+a +;'Џb}!~AbXko2[ۻ 6Fw3 A_o'_s,KxBKS lts,ra5?x +}a}e~"yU\Y v~N߷ߟV:˟6V+xΓ\og=1-h0ᰖe?0AeY3x-s?O:2:2X YgjX"1·1<]]]y9CwsvV埻1;6>ܙl0ߙ89nb%e^vux?ǪK2\{ ===ƪNྦྷWKGy}ڠ†NjVy)R +}i'u7Pg':ՃՉS1G3N9SIg:gAy69?s|k/DJ<}<LȚSl]Bp9X8%L})" F,RkOeAEK?|K׻k;6|NpNoK#ڋ+e>up2^Y^:A w+'-2kǦu;{<_Eg=)7PΧvZLeBY%}.YoYSnos%Զ$7 Elj\ogc13r@Ϲ5?yj?7·|8܁d~RgXTuc}ϦV8>^dyCU2&jjkޝ׬Cm CѮ]@{qeW/_ubSkձ=#DNem EZwW>inǰ!Ǻ +Oe^3 1[a$sbQރYV;5G̵.mC6Jug3fodz=7'%bS6,!pp̸?ڼ'2NZmN5XGr`raȞ"y,*lS.kYYƻkc`ühm9RqAujIh7q*kuYyd>0tDgܸ&}ȅ 6:xMAoM!ƜN`r wkOP0/mWkWɘ}9N׸4,3VuyxMa +wO yVު,Uhq\-Ǭ>j灶V'Cl3d.j5\8kzCնf8Ps[8`,뀺g5mNV+i\H{| ̋Y =ZZ0QА\?Ud+GVBs %}UfֺqW[/}H)cYo g#/3~]6}a}*sZ\`irOug9!7emmX+drm\-XW87[znQZ^xg`6acӔy1ր*D>tJ6a2gQʟ8۔?/;?)V]0Wof>\5Odn +imzc1{S-M{s~J~<~ #?m\;ϫ? ۄ/"z!BkXvz)c;A=l>hXѺ'rY jI"Ǽf3ժoowzMIgptlc̟XxfN`.7%DNaڸGc>s\:7372K\Co/hcpI}sE +}A#WgPG3GcຂrP]AtW:z6^f|>} }? 9+rH2w>$P˹$ +IUY;X)+ 99Uʟ0F 79!i#:^)qͽ3gOZ=(⵪'ȹ~w'߃y3~Fdc._=IoΔ~׵3%#׳w޸n]3[Cp;^k+-IvOӵfgX[7ênnH3VA;Qj`ܚe/XOy_ 1I_=.sIWS[%ʧw< >ȺRo~dNy/꫗{[ee+b!fƶ]`0qێ/s{)ɡs=-Fc 6m+AI`nn\B/뢰343TW_p/L]paQ1J ]z^m0?ڔncylO0C7J{2lRc<yfw*̻ g/d>ݑZ9!f. *$jaΟhҌ[ʟ8y% ȟl5n~58kgeHRrUE uar9{Tb! TjpV˘DcH#޴r>nFulwȶ9!%㬵,=?37}NLj-޸rC>|sBvKmce]ck۱qƙTSCk,<)Ì\G{Y/W(Kՙn En[6?DiD2WHفy$6\NreQپ\u>rSqVR.[{~FBwnCl6Bn G9V*锃u0S^?2ױ Π= 9Q[ܧkT=ulT/hLz3c Tne}cաӿ]'e;ߘTSr6́*{\gxVLEy2d#ӖPP|mFghCWFg1N8sxܫ~TK?5Ęmc/eԞ`~yn'<b`#NI!/>wfcm''1נ`m<9ssvj旵fwVp5#WZ\ +q[U3綾6y]ĚZY }b,[{o|:Cα/XsQt3Ge W ׃P}>RPutDb}XKco0[')GloG g> 68Ǫ6j$Z:}| +3*穆a r:$d|ӑ3gt%g]qjz5zg3 r9׈h;saMk=:Ccdl7:4tRߗ,e|9!MA:4iuO,3{̉Hy +1^z:s/q˛_`,y 2~c"1Ju\q\C4xY:%!ͳ*ʸ{mi@CooozC/}هy&e˻s_Yh]gXac`_h?tdYxbXjVUWunk6&wG!]k~{^<" 9> }˳ 3}.:֡VѱȞ0oIbfr~WYMqj7?-24M<`No:=]<;闇7`6r_d^;/O{j2ϞAb5x~:X\C5( g1\ .AS>wWx9amdrɹYo0X~gsBV7&%lWscS333t#g ym<3ɳXKX#}n +̩mAs|Sm + K{>u}%ͫ=c\/ZҜi6H|uBH?1:/*l9CA, zϱ 77L?I|74mwչ 4c43TRZtt\k 4w#-58Yo( ).Ѵ>|O'5n5r|c6agtR/[]QTooƜϜ9s>_%Փ2V_C%;nv[QZ&3`Yao8˳>g'.o1Ͽn8^ZXK|zpN;ּiU[Mgu4ځ| K@n\0beL19GQ0!$(g{;O&[T]iϐs-Z:'3Lc>ٻٷ1po0FYv1rֳDeo$?CΫ ާӘjs'/J):3#1Zƙ3g͚5|⊑'3 /i*Hgs>3g/i9粈 ޚg˵ &wՠ#'XI/@74s(!Ks,LYйJ5􅾙"wz,m-kO l:DeԊhm8;^y.ǺV7 7k~_6Rm}iW\ib#O]7Q~ޖXZq$5zOe.c˴+c"*W0lugr(DR7{v O0؆9e77 yM}=Fn`< ,J3_gp~bk!YC1ݸ>>k̜9zܻOkg < r9l굜̨n,dQPxdS̋U-BM,֒2aO͋y^fW[7gNy/})9>v1|%d-9c˩_){:.|H_`vy<Dׁ9!Զod74ZH_l C_k@Vr 4ys-dmO?x3Z?9&A/ +QO0̺"߹ovM#mViPgЦ-<#=s1啇i06Vu3_z;f/[r L{<$2e|PY7W?>K=Rԣէ3ɻs8/?XP`./S1C@s'x`{kй:U3!r˳w&@vVU%$ݝBva4MLT 2@:0RF220#ˆ .K`qAdjfj9_?^w:_Vl;WN~~~sZLNjsbgF7jiL7cZ\0tk2g a +_)DM̹C䀒Olp8©4qG?5|3&*y98UҬVW59jojљ->fz/ף@< +-m!c|l/\.F}~~S~[u]W/е`wwwt?sV{t7e?9 1ZW1O!:a$wV=s9Okl CY}U-_hM**]!.e.el?f[Twyrs 4p{AJcVB:'5_]v(<{[)u 8gql;#^؁}UsB=0CSW mb8p zCէZ: x\^{g+s5X"Gzz0НYsy ϧt&R]%W4gRwH)xqӲ^%Gdx;0D5⧂|m"6Q|_+}ZwYp֤Z灓xU9sqgrz+SOGk3 kd$'QE_}֌Q_&C;|Ṿqb^k +u#{oaô.S<gu\F)B3m+o[FQztՋ5f,}b챬5xh +<Ώ$ZwyL0.>1L<`]c}XrrFՇԐ_~5o?9<7V{ɍ{<|vT=SF~3|p> }ק V7۸9%x![*7HWo |t=eM%n13pbp &ڻ&;D%>=8{Bc˚6^Z]&:>k\xN{dg qV!V3b.j\}]S|PuL8- 46:j89q5 %^ʺ~q!1B#}p0Qz7XVs'Z5_z՗h̢ٹCcn{*쳮P)_[Wn2صgE@OZg~ yj4E9i{y1f6{O8Np_._{eNDb-|<̴70>ϧu U^sC[9l:v68>`GOԭb| =f燸ρx*u-~/k‡ed[5N_n6*Li +1 g'I?NTs|']?~PܦRt֐cu߇dh[sYEeb +qS|+pkM{X+I[kc.6YIwS +V'SUcK`9s3S߁x8]8o/gm!p.чÝ\R߫5_LL}M#7x'hs?J"j2x.j|KOC!\Ԋ's LRoÏr =#8hI&x#hjLrm/)~H4@C佰g +yq16s h&^>5lO_ 79IٍK1z| Up/28K0ǃ?sO<-s]oQ|꟫n+BnFw]l`OL0z:u3|Z\T5=bße!zjNy] ΃4d~4WvmW?wW<232Zh g;;ԏ;ԟ9̇_gn{OO%}}oˈ;j*mj,'fui~߲n<: `bƽKvƽe_<λp`i?fH| `Q}q|}|`s?x8l/[oC{5z28C8} \N|XٙǜM_Qr.1.պ[dkNvR՝p=r]X}p]rE\ +;8礭!R_h+q0kq0 7f}sӯ=?okb'lGz׽{XN%;m賩BzݲosҼ481Q_ gd11\+oi }Ncd_%֠"ߙ7^s5s* :0ï w<0VGb؅y{=VDFvMG7,F3ks6\$O<*:p pgGoµk_sN\ "e7 +u L[$6a=-rB<%,֘n nPOQ)!wH,`7N ?i8VOq>=Xcy?ݳ>{xSSS[d[MP4z:KU +ܛ#gYV 38pJk21iqt[>q8.٧zzq{}&q̘/D_7KbNhpj r&s^ !Aƺm{vL]u~,llrp1vWe(SIR?t9+7hIa 3=Nܘ{BiX'$ܰ%<@J7 Cz~qFnM:?^Ogz~LAݿ߯{M􂶶ϖ-&LK6 f`S f`-w>8+|̻ 8v;5ޮZwq:I×&&{-$8^'DmWw86gt._%=VODݷ_-ᡲn~OaOx^!;X{Fڗ)H58_C0kűg))Ҙ`|g%g\q }MscbpLHle7z>4S~Cn(ژ!Ǟ*fKoׅ1|4_ݹ`Goh-] '㘮(kvtgu{&!=]qܜh mC4ohh8^?ނ֏9Ws<`x}j*Y$5yzI!N-XeV300hsA +.t34f Oc1V蠣ZDG p^{v[Q ^qo:4.CXE_ z5mNc&$epçFq+-V1UCg2S_ޞ[ +u%_!vÚײn777o}dooﲁ QO:rFcڬl38']'{=whJ,'j mF=A\/~Ot^)_7.'8?%/ةߩKtlaE՚[| Z4S/;Uy` P碧g.z矧gB#qS ^2-jF8S56 #賲pњ¹0 DU[f MrN<^'̰TAvaY{Y6+۾b>֒W\r6kmp5o: =&֎hᱽ^ }<:bs>&KX(."}z5@yVS.5r : p3l Q|o昁C)K/KY]d嚗n:T͟?Uߧ{FdklK<;᧚(t"$>lai7OA}^SF+TczոPGuY\g53IұGĹsݏMc5oWh-^ojXhQyr˖-K⑜ڬl,-s.&]0tDknAZaeAt46p.FW +@acj:bz\Q&{zk0ԤϪW[[[Yawq(./<} `ХEݤ$PVuM5 gjaNhrћඐm}7sR01f@. +8\vKdÇ~Gw>kU2ϡxV`:ῃx5Тny 5 U+Vdxav} ?ef3LtO٫SvhMة5̀|2`+z,r4Q /PL'{?Kc{>'^3P|rh+699m^$Jqٗw +kwַ ~%6+e}ɝK븖QRpt/N}٢v5>vތ1 3?0,ho% k5[4.4>5M. +=v u?ׁ9d 7</XÉiؖE{beNW/^8dɒիW'>pCfuf|4 :X)=F^Vz͹5q+6ŝ[4Fz4s(ExR/xL cyUS?CZߵMX?_esCM,xH4E>yjNWSf 3UV%xȬ6U6]^`rc5Xz3NRs45МF71BD/؁3"؁}[hDh; چdԝ87ZSx^y>Z:6#f`&_]F?pT9VCJm]hgkZUIM-e]=GGc{)uoԤ5P|(zJމ5V:,;\_??ebS5ѻD[0ɲզ]?%&em״b}86o Oc8KukSω+8$fρ3 ׸q}pr` {-!>7CC wL js& ;<<8rҲV6@ r;:)miquJrQ_ Dۅ\mhYÅbK0[q~zC{ +^/2՚C3h|fW]n;d ͚ha}V=/Re!bW/z-9%zIJ>}y4;ӕ.-:Z_dŲuF/Aw(uט{z OBJ49f`e[j}TE=^/_[cjRS'k "px>q֙K~k2ԩ^X7sbpɈ #fg36.8sD 3Ph&5/$טm7s `u*PnGDC/up軰~g񕺮C-p@P +iipg 44~c_v z{NGZ u[2̐5Z1̀VBp5>d!50P3@؏lOCcq@m<('S^P AM* 3'FQ߿]DvGxu|p՝M+1չXwbc<rڨUea4πV@N92򷮱'f]ןC5cqvꛛ4.Q?zwjYCŲV<ݣ;`__4k@N74{ga4MS . +꫃߁o`kU;:5 +C9&k@0=3=(ͭV; W6P=&qY6f@cn#pS_/ n6 u ; ={ΈLb9 [k jLjRX!_3 +:-?unu^|3\?t: k;\D7<xNC.+)f0I]TY;C cQrT]399Ըgm 3|gqk3@ >SXN<5iұX- +=hhNg?H[VvF60{<-dx!kZ1@l <?&tDɃ~oD^%4)̴NgHc5'~g8 Dk2S8/9;и6-SѰ\޶hp': !s: rC\h|Aù% a]u!f`. +.>~٩ċS-h ڟ~ޓY|iŒ-.zA;\&=kmv]0`t #(gL׃j^bM_hDknIJoȾQ'|AOc/<|Y߈6FrC6q+ `up:#Xn)@bIZ .?䥓ڥ9=}-_!rb=+aP@M/qbDl{:[dm:16k:}/ ѫOvc/{Gf]q9V8fmZh]b~bBEZbYKCpCm$<\kSxe>֩~TkÚ1wSPÁ~ ] V|铵&[m\r6[[3p C`s9S{}m!r_PA| 3¯7{w/gr;k _syK^Gk] O}@ f@˻1è.C1DA.)5Rg)Yyy;pA9W@̂!u/ ,8 kO1?!ߕ%r-B_\4=Z?>!5W}5/$?}P+9#ϛ"yYTYU30@.<| ̯. 1v_sr;Ob1r{kYHc&+T1=S ui@ R1瑂-sVJ;dTAL";'Z:G߁r]*b:GvQ )5݈Qg9 LA<iO2GQ4ީC^⦦;`B~ N5zz< ;o,kY\P_ou +[^f +y0 cgVΓٽҚk1C4a]}͚u?3d!f :1kO' ׆XsDFNY956D~m!b`4X? A.Įㅥ]Rxiܢ߯]FNF{ [jmm$;~޼yh/^u~\8 Yw_@nq[06Yr21}e$DP6l 1.^`4tjx{}ѹx8cĮp%ʍ Z.?Gg9SkB `#!A5A _CcW⃥4 /ܬ==ߩm~R~&YyFhS-u 7DZ%zg"#n` /dm + ,XusR暢~'\y9v[ 3o31ilj{;0ow$KCh E78/v4X^ إ_,piRT#L7C/ uwwzdmͭ---ƗJj=\ku $Az{k̽̿0}- f(v[Y}rMw`qÍA: pC~oxF^4ͶYx#tak?U{ dj_-Ɨ0_WKXuhR #atSx(܅,(kϠcLǿ556Vgq}Xc̟5!N5;lMxa #h_0~,7Z}hnnnlkkꪛ?~@ dUMCu| 8G`a /xNkgmzZ.fC=sB3;nk=Э0SCm0Xl{8\~?Ke 3TWW/+D]?!#WR jaja*a… s 9t`&( Ys6g|_8G gs&&u40 ko18; 9+-+0#~&,@=wri@VmThᢑN= /Y$,]4Z*1rZ֦)׬_Ǯps*g#x2!1?ijf!_`rbʼ Q)>í/"Je u uh9ӄjh>B/]I?f@[vxx8 +W ֭ ###^Z)5fmu4MErn&a`{!200\/#f\%4_j=tm|maWx+Ch7P%u=ZC8Y~d`KWׄ1PI>5\b| +7#q"̐`}~Ԙ 3W&B dg9xԙ#"ל;ϒF8qK/ϚᅬAu>5Lj-jԍj5 +34dt$ <J3.cx\ f\-30qx =/BqBZIxאe-k%n?hɐWEcQ",@vY0CApB?}*a0ZHGeAGsfqлQ# Qhb݃;B1C@ 7Z%fif-k%k?p7a188]hp;1͡i|UN4it=(-eʒRFY +"PT E=!G޸sioC&m&s^9{>;C((kPSTAcMM͸uuu]`j}}L0,lhhX6663{ku\Uz|'x`XVu|#;/?_sJp$ Z߆qUZZZŋvm7}[ѷ`Ok}? _}| +<5]oLS~wԴƏ/hv,<.7O!>5:{9Ya\Ô)SɓGaVA;.aaƌaΜ9a֬Yſ1wWp eqM9>;bo|  lϿgd)xC<{gi`X-?ޚ9߹x`&U>Vkqw 3e;i$C}og<06;2F' [=!rYs ݁y7=iY;a„W*e+hmr[y̙39y\kӧL62uԊq=*{G >6}oTɨ 9nwh]`*rxrx Y| 8p89x8(\;7w5 9CB Z# +~ +6㳷zrymmmfZ]eA Cۦ9E]VZ.\Xo7c<ٌ,vyUpe9G~V=]\]肇:;;Ymaٲe[V7x:\!ZP' u|P#gPn(w#ت<4({ZBK2Z[Sl5wrlj|}-D0l ^{8,K}Eο߸(83 sk7S>u.g:ۙ=e*k}}6m,g4qea-oۑqD!cvcnR<~ +g>g;/yk:o63ZE|leMF `|"Jz7)̅|y$w8d~ giX+j9G^p {ď7qow>K>/4׹koÚۓ8^ mbzSWkr7Ϙ;1zr}ݗB[Kv(uG>|~8ОúAW[셲-VU=2?W_%@8K\$6d#Aj@=u1uuq>XGg(WxHn̞r;y׼w2q‚iӦM/4s7o^ Wo!qAebj7ٌr8tȽw2r3~QPo3c|o;717^|ugWxd W6ښgjx:A}<3s{7RT8]3LmxC~][zτr9{3H q/9'}C?seo1Q8icr[~1~#x/|0DoWF߾>"ox89]SC.^2g`hcuXV>gOq {8/X[wnf]LΞO>}|ah;wnF*a-Pj v1O^|+4<gα¿ZA>S>-Iq"9'hߍڼ菲cWèo `sz?cX+e.\^ɜ!|d1Lx@[O6g-\^a[5X'ck k,_1 |>|FU;850vЯwZ[l-_P9P_wm #|(}k!ʦ{̫gςw1yCSdȡ|m^˜[GS;C[!Kp7!>&xz(T|kx~\ohWǯgu |\M(Ҝd`bUoNʶ%qa5t:9"ZE{ӝ`4cwZ+I`ܤ{}&/M>R}ywbv/e/# ~ ߮)SVLqs{NMT޿C_FS .$zsgs!kb0=oNʶ*0PS[ >Dp`.KddnB~ yPn^χ1?#w{:꿥̯"NA}C_a9l[]NU7tFc+zYߠOk8[GЋK 507a{ +xjƏ)As oZnU:׳f\f=fOl?C=OX{dpplrHl[%}$򜙷8B5זn?MߡX^:m1<#Ľ=!d&-1Ꭓ ;۱}Oy7yR>-54.o=9&f\zc[~&\~B9>cb>9X3 p/6 ӧO/8̙3KΰmʕaҥLL0o5>!_䖷Joeu\Ɣ]_ |~q9Ǎ%We첕mkM_خ! (/ P__6D_ss `qiGk7R'NZ.~ٱ_o)Odo|ļ S3atj 8zg'Sd1?xlնz =mrMMN0iҤ6y3P6cXdI|b`ܬ)1"c/񌏺+'C;c苯zў6D]yCmƍkm6T:gtvvue9LNlL§uHP\ Z ~ .^@?wqu rok5п[9q}/_o $ 3dݓߓs|,|8,K6Jw0̈́K'`9׸|9/8>,} 7wє/X+=Ob655pxmmf#czmd_ۍjΐz +2}ymUPQ՚pum eZ_8u{c xvXύ7>јgGe9s_1؟r^d7)rnޜ43֗?~(ֱ9C_s!ϒ]7^d8,ݠ5{>:~ʔ)`{ +Ϋgtg"n>[gg qcnfjeNkrVgh;Y2xuNe.F)c皺o;D~ !)!^e1k((k9^""6̙sd rbmpoùn_18}3(W!\;|{{.uj^əU_r-ߪ& 곜kZڨSnr?9xϙe_Xǰw/)>g0.ٖs:Ypv0kjM$g;ގ[[Nz4r3ϵWUorc{u_p )3{3&W2v֗2^Wƚ,fZ7jSB7g3otʷ^P.@r;b_4Ӕ)SfO;t֬Y͝;e޼y .ro +0'ʉ֔Xr]':,se6UmT:נae62\ٶhSމz`Y;YXhӆ}'7Vw}~7ǯ3h/DoY_Hf!ʰ?q昶6k UtqҷEEcg}9/;9vU1½;0'yX.g(갵՚'ڭ~kkR5 +֨ꧮe E > ?{7f8eiL||a1gi-ZTaϷZΠU=u@ hǃ00n3^=b+0BAW2wLFZar)jy9GY?baX#ˁ&O5znY}qY6[޿rn/1=rs7 K[uJrc蓨@Y`̢6g} PoJݧ)I.^O{/z՛p]6 }9;Ƒ_g+sZꫜN.| [N8[~J@b*}BZxpsfk٧/b8U7ւgGZٳSʊgSa/j@=oX;+jy>k:B?]Ͻ|ƺN2e/x>KvVP;1}qk\'}Q%խ4:`9z;.BNy_YSզMOi8.c0Tbe+ۀo}L4qȦ)pY/^Zykݬ;X'/h{(?)*l} ŬN@9/`::CCwWnO1߰aNeȵ.Q}@2jTB]6+ir":wצ>+/fμ?|zNkVVX#ְ ڬPS[;ƚYVs]9uF/P웃Ϯ5v>}T@̛7Pkn1Lq:EhWj5%y[jJP >D'fk~uNg(|V76cmȥepm晬Y/7^f/|B pַz+Eݖ!ѧ]gKu r!)۲}>s:sS&{R]g}Syڔ܃?Q +P_O釙o=iG_9s|a2>V?9c$q +kbO `58w Іgȹ?䞾=ݤٗnDuus̩1N;4\qؙ̓m kJCi|S2.T6&ћT9҇穯@8~7V6<הmX~SNµ :k˃3<pkm5qQ}ׅs\>pj7׈gKV[BMR%w+Ձdߋ\jmX7{E!?V0Te9d(s 5|TdoI[Wŋ~;{r\ߎ=0ZŚkopCk փv0 ABg 3<|>{;r_G<8}<}Z9|M :֯4nVI/+'3|[|W_v ~֛cp^8]_mo2!y*uef|[}k-rLDF.MOEF] +gx7+X7TT9scu ڏ=9KrNcs?vQ/`ϔvq>9:?a,y +G\P:;Wroa:2夜kKbV^z"\78N{x $07lJM qgoՉ+uMʡ k(۰7e_-E +W<t.j6BN}?ы-/˺\o%9␰a`p=u^Geܔ4{{;ure6蔇YR13IZ?9Brpz]_>])/B 2BWワsSa8Ci>}B_govs<sKsUr*rҧ3W/'\n8BOEO_17ysYpRfmXy{)1ʵmc/1bƞ>|yo@ujF6D_Gqs Ygjmn>uaI{> ,&"\pIzgQ!_w&1Z/RۮP$t^ݝ>oZ(r>H `:93r>\|r5[={~¾gs~Л:Bz' R&گ e~l9EGG ]Y{544|;I%7YW-zQh| }Z;Trw} :[.bcC>IoP>EXb~V<9r\=$Kzu7vZ5wpn8sDubz-}1w-,ɷ~0\Ѿr1s<{W!p1rlA_,iWͺ2lvzS!oֿ5u{/CfKϵ/9WB~i?^ \,MG~ңUeYYx +eA}V%X{zuz)|!眪 eXm3dI}TkKz߿!y*w9 ps3 3U̠?8nH1+C}z}5R?߬r,ې6dE'^!m$;Ԁ:B+\ o؏K8Ȟ~'&yFR-˾lp<:x w ӼR'OW1{ʢE + "}[y2}!}&7KPh%g8g^~l9UqȄRk<1қJFCۜǜƌq^_(ې5scj ;CYg.r0h3i}Me+hi98$uZyF89sxu3o ։u +c3x,g(慣O~LAuRdB)Yf 7zc1я7Y߰?$W /}q5Gcn[Br,VאsWPǐs9Z8~ר25{VR0ݓɼ-i C33;XW͘o7#c78gzrbM@u l0~E~H> =Y;I]oۮ6[),qَ>ԘꔕsuNGX\c,א`(t9ʺLݿ1ff^*pg\v퓝x)mue2Kߝs RM2b}Dл'g0|Y^b0 evl&g3 [m-5 .9b1+ꏋMlĦ"(r-aߌ5uԆdڔ3m[ oWqRP og4ǜ; TdM`85-sr<i>gkЧf6}M{nP/ϼXs<+2*>֟yjup&s&E9޴WJRS3I SWKccB\GYmy<o_M5\/g9YpΫE>5V ZL>=2jo/b_|;L{烾v35 +~ wx&kPVdMAdìIg184ZōOOVvcL<=^N3O aGm"h?XokoFs>ztrp1x2{G02}F:c&ӵ"5ǝx%ko>/n%sp798}}0m.Τcۅ}ϚMGD:~MC'/sMUsnu3LQf&}7}`giw1,]4\rV~[̧֙:LF^-ӗ|:Ȩ!d{6MoW9s#>.C֟5,S>a{Tkc'kb> o3s[φgg{&hkޖcYǐ1x6OyC_zy< >bx +h/An89 0>?w8Nbœ;m??si{WysIk51sYd.f pu{0/=WGRpf9qܲrNIp"CF6-RڰK +ә!GqwQ?׏Gz4XgcY2z 8OM9XNy߃3hvs+AM}X`<,DA`< U}7%~ՕTTF{#Ọ̃#f6xR_kߎ<žs(''\ y>k'x"g/3/;GO16ճv7g\Pv6k0! E_дKhShW}z*(7sM5!K VUxOgwuttXϪI?Y3(m%o(p6XS f"B><5ws Xse7^ph ߹5.B>k> +7tKAևm8شg& eӓO!4%`㲯NCVSve${|8sOﵣkvt-w3*wm._ǐJПhG;5o_g|>X35䓬vƃzk{6mv<`H4 ^}no_2X%/w.\b49m5< )8cMꬬ/I6ړMoP-o 7p_^O300Q;oJ0FsHSorSF3__z?s.s0rw7?s3Xw[3^?Fp5h2n`}3X>P=!!s6Hb9SHku%6W?;^8V`}Òi<:B1.G<ձ\ |[?d}K!3`U,H&(ܩj ߖ0wTwE_|}Wksx*9v3Ӎ 5 v3w2t;=ڢN[Aʼ%l8O\ +̜|5)MoeE]%'Y y=\\ |Nΐc7%(F[AiP܇_bOCa m +_yG)ퟧ\L37Ai4I>=Bb OyY_~ \R_bp+>OnkmPׅ7-R7a\(7XʜvȢȄÙ?a9ń0qG9lA8ߏRO{5xxÐ+y035贕yC_2}6ZC9֧oxE[9/C_19/qݫ=vx} &M oE"\4trř< 4/Π9~+1&YIؐBAacM~V(3r87DZ%ՌЗ~|AkyO%gJuvMӮfNX +d\޹Q$ u)2c8K/b/s:-/C_6DO}~k۝ꘐ @v^v ϴYf.Tcqkl1ͺ9HyVO[9CSg8 ĜGQ>g|Ixǩd.o6uAcWWWEG9\~'s*=Y !恻-(+2Drڥikg\0q?a02\ (nLg$!F/|a~!D8kߖZε=<< Q狹Ns6gH5+)3[zgܶw1o1ZTm+Ƶ7G vȈk<,\񎔡ј}9 N,,yC6%jΠN8x^Qgo r}py{`|뷞[:bM%3<8C۩V}c g-\\pzs*ѐSn%/gЇ>IuzV,z?}|Zl`msCZ!\5< J"_P8;$d:&ss;( :n57Yʉ|^ϲ>uf3:햴!y?+g?~徿 +h} >G?N`3@+_yϫI:"ӵUlB-װ]g)mLJoZ9*!~>^Vo<֗a$rUR][Y!}^Y}G<@_ύq)rٷlчyYM'hG՞j ū\6? s>iFo1vgSK*甖ci[m~AA/|(ro(>ׯ2x)ޔc  9ޮ|[YO3#]@~5<]YajRmϲr~,<p3voy%۴ɀzcM**ʶI-D\yfՖTE9s5?ѾrFfΠﯺRւRooRgQI~vǂ8Co1߽><(tA0_>!{:79)?ct5旫GNگG[C_3vysQswc7w# ;WV l}Gzs΅l }=hЦ>3g}q9R-v7A+ v֧9O]2$< eƇ_ֿ~{%}TA;y,s|ڗMnx^\X<=׏'jEsޜF|gW] E~{o\#W`@?N}?t/( Ffוu䏬#swTe\bڟh֨S 7*cc xZĻyO=KS+|ZJP4ܻ)߉NB̭֞Ld.>!6/Xzίiw>TZY_YWy4[i=s|oϚwN~J:ob}>>0~LnqKuɺ^ jN92.q\_]??Jl!D'B$L4;˛v6_2 T _5_GúM+oH϶tkri^XnJr z mopoޚzj\ڂ >DqVCM7z*cw4/r|k`c{;s+mW%qz]*umec|' ԡΏٙt(}`Go|XZgB>_ͳg<e{[ +\"F9lir.ClBC.v.sJ'Pև[*$}:?W##H)qdݗygr/n=go765^*t{۳&rΆTѼ3N=߷񓸞>I&2[#q fycGA!߲ }](R,Jώp43,xU 97@Ƿ"#(Y#>(=3hǩglu,cIz;k4992K1HeTސ93Jͳa˓Sjb] kdCèJ7+ԁa3UsܹsWuy"uS(yS9%k[{|'7|'r\T!1G)w \dc 7jsjWEDdTd"dAѧs_~Y[究ӇuO8ܵځܿޕ\SmSGsk|'g4Pٯ8_iUD|s}RTǑmG?ٔloE^w^s,:MMNqH<6>bSߗ[KP۹׆~ڙkzu 7M;lb7sc'Oah.36w5eƂ:"zNUN\.33DŽfc4: +ZPrAB૜ojK+!SlyOM>L|9pQ?|Q/IR=Nu} \km"ON^l3} OVUӜ|K|u{i]Tk%nVvRc˶U.s7m{xs!/t=r0u)'s ?_J?#ygHwO^ ZS"?d1M?EF&}էq ]YqH1Xn(<~v7Dt 4yWå&I<'^/Ly'gڴ><%[_uM\S.PwVb2kdÜbNYmdְ1g6^ʫ̿)˲o:%gs_Ϝ`ѢE~=Oϝm\O:U +2&w[}۶Zs,j=j>))A̋${ ZW!SyGҏw'0> gj9Q],p};arEyr x]?u+ҭxg7OQsn'Quo{&0_K1YPᐓ=W }/ѧf^ NsjTH\lXC*Cu dvʯ>O̙[~/db;7s_gw;sJtk{zOK1'~Cq[*h@mF 'i}Ə<0ό+ -Lyܬ$.lhDv~5Z0#żp:4e{6="ՖjAWOu:~F0ʗpcGpu#C<9cүż&7DzNysfaYֹ1'>rkx絩zsg_'ys|{K$2XlY ڠ{;(Ϡ%gڟM4qpqpk26F[ɶk780-Wg7}PN~ȟoRN?]0#՜¸}}mmֺ[ߓ{}uk+AWYx[ !Qkr\r9vEcB\Ӯ|&>FF'm?ڥy\KS9*a_ۼ3'P~66}kO_ 0T !h73{xjpy?>:k?{ `= +<%X7?}կk!DA`nρ;XwauBA8rpf^|RI啔#p]MM3=z${k9>hɒ%E#m 3g}ϵUP˿ gA)7^[xfm~mɞP;h&3km:kd-m=8CK:.OX9er X3C\u`mB$8{ա/~7{+1.MuM[mVlV[yolp!:S1[C NgUKճyPYš6-`땨XHV|c_r2=^*<5NV+p=?Aþ_z}׽QۂvB̙3G?Ը7뚤S5G)SMk+>A6uMLaN绾vkO): LI -s"z38ֵqX )krK ṣ'Y]nBIgWKo" 'ZPGpg̗K=Dۡ~n'Ξյs~@#u o q]kZ:ԡDH}oL&8Z \N9ڥ>;z1܋/?gc7ß|n{{Jۊ\\ç ,i +!YG|,XnW9h>=+hc]^s#UC.Ji9:Z|T=$!kɡS_i̗RxCݵ W|m:9gG8CPg3kPgGz,h^ggZNyyfsw7,v}bи. 飝 &X/3[Jӳ-g'6֥2|. X o ؗ~>oQ"yw}G:}s;9^)Kגzdτ}Z2*_b cC8յ3|r:Cu :OeXסLT,W=@[5߉^|#wyGκ/ R}x\R6UOsE>cޣ?#θ:eX5Tꖋ{hr\]W[k>՞Oׄ(;"wsItp"(oŚڃmT[|6V'0խW6V^Y{V6C†q `3fh- mg]HІmIr\b|^U<1| sz(x)5^/Bx7U%Q/3$}Vv`ޏ',}WbMk(d]i>εkSB3Rۣg%~5}Ōd_-%G(?/D맠kpgvsW RC6u8qba_+ro]pnޟߧgٷf6%px<N'O1Vx~-@T݁/?u!vG b j -َN)<~ +Djg;ȵ:巺_ ϤsźCoJ~j/am=<#Wn==q 9gf:U9Riݟ8K'\EKpI|Wqc)YJPM !S~ W? A_LJSnuKJ2ߖ|{;8/Qm9Xx8ۍU} 0G?<gǨkoG>.]`knM}>op{q?޼=yɤIVGqx44!_c̏Ly\Rp}+r&fWiyXSc h'x c4kS9?hY/o'`XK8cWb-|+кA>ce's=圬Iz-ژdH> $g%w QԵTPS-c/&+hB>w5IGb[8X}ċF1^Z>ǽUhM_ܚ%9o7X Dۧ1TϯC!sĖǞ!Ekw~A{~cίX{}m=[goek򕚘S)KFۏ6bL`=5g8/M)a0a'Ҏް?{a1NaO>}<ӎp;pKxKxu*q#0i޻r|kWn9IOw{*5 ` G9*Vsf[S/vx׸Wm[=m͸%G-|:a̶?9GT˶uu10Hӝ 1$ݲ6mYӱ.N}M{Exrִj_Wlo= }Ͽ'}z[u(_{ {J5Þ9nܸCcہ \ +敮ll.\K=wA~k2FVےz_eG٘_1`>T)~uVęBߩ\z?l!Y*1Q'-&vrk|_ſO5F|N=kvÒʓؓ>|Kx}-~3ᅤ5W|8p0w%̒7pƝ$9EbM@*7 +8Ü7<*f+[y2|0oX%h$}KmNɧAkq2]7X?qs3BOTۋ3.If^lXgt mS̷EZWkXн͓yՖdLQs, +i0D=y\?k–I\=5ڪs~ ƻǪ/uql3gV+[?55Xnw(i/EW{`Ξun ѧ햤χ{|9{n~q}?{pV|.pve\ھO$+Y=V^揳6g]%=[+ϩPmcX*돾ߒKo}<ƽ,0σܧ-o#oV<}BmlroK;e6O+ 8qse l9'hU> )C8!/(?<<wԾUycN,HyWİ0n1_kX8+.cHf'_cfLR:t9!iː3[Fg7>xeR>*?~]o4g{yAy}C~ y|j<~>zod<חOsU5 &D}W-fmә̼o1Sq\U=»>~%{{yO.zB~-\k_RG`{晫GIp3םrkj!^C>oZ圀#S ߾4okb|j\v}5(_>ٯAQאBQ?Ƹ4o}{x + 8Y^=>s6͛G='+ᡴ5lX"g[{ѽ#'c?c^[/\LzW YyA2g~BG~ւb҉jy)UHLO} GZP6 c9O]S=ڷm{}BU~֑_73Ǖ"Ï|U9t"S٘GbdDz?G$?T}[>W.Js@_G{V/ћ eG禺Pɍ?p f=Q*9צ>Lk[`.+'Xc]P&hw^Ikf54OcmE---2FO31qS3cٱ)m~?z2\}T;\'5~5w/aSKk3Oޠ'sVs@qXgOm8_J1*x8[:~)k{ٌ}5 {->Z.{VYc10Wy1MBhh9OpiNɽg|εr>BO\wOp-c~ +!!}zy\苛I]:סKZR,DMõx ucoe /9fڼߔRnMA~ 1אmƤ,ַ2e1FXμnbODGzH㡄7:j0u`qĥ-tq_vSP/ePWT亜CتsOg]k(֥5V?}:lT֚lqܶg7 7kC1Z=wR54щ+mONzD/1t6W{~Ch90n3٦_lݍm26X=Y^"IcK{|/sVנg3>of<=飭^w2;d=ĖDOͺVxqN>CBywo0ѭژ}Tuw{3u`Q?uGS[eǚwnoׅ;93>.N*rRlɼ =[jMs/Z;Ow/t >]}m[\$}pMyI!U)%vMo'yv%덩kPfelrth͜!,OZ12 4*֓{`Fel[QT[Iοߞ'+?][ŵ9\6y!j}׷nz|25ɷ)J>[:^bvYYZ$'SVryٔ5ƴh0ltfg( +:? Js\/ssyu'x'r}&skio%gXשoo^v%4/ + +Ӧ&SSda̖ +.ۭ3hI죾5Tס0ިאr|" o0m[IUblZ9S~y(%6:;;?p;n[o<vC2C?VN_yk_ 1P9 +TpPuihĶ=lMO5T!G7k6gSxVKsX@̳M[%錑bQ6s}5.<ijx}9ڬH:F[Л_ØCdw9T`拀wm)7\ +</ZO : -pyy.x&x u!%b/W庚T!TVk.O?kc2BF]eРڼgk x>S磸|`\\F~up ϙX/Q[ٯ!Yp cJ92;5ߏ9CѸ-ձ,16џz<Ǹ>W,a_ jnz7gmerC.G~2%/'#g!6~]io\{ ?+ ՗f7cJ~XQsg@qn)9{lkRkaO ?aoo5W36+hF1:~K|ſ2>/񅟄c>VFݏ9bj{kJ5䳎K#?0'tWf+p)8+? g=^˔/̛7/̝;WD-K1~i~%}e`v^|}w^5/ں)?[%k>X5a%kG 4i7SB=c =(?wA{ו}!SOcՏ-_C_~ Ei\]B?l7Xޜ*OXD7dyLs)1] X@k +rP6mZԩS:;;'L0=}ocwa}8Է/~c-TC*ܶc%ƃ&Xsμb쇭A6Rm٧x5WOcĚ/2}_)K⿩闠\O;5NclI}k0hC]B_U\fcǭ:5ɚaeJ5T}:|n}K0;o0Ϣ̙3+fͪ/4N2=|:aG[ZZԤ.=uչ{2cxZk-߽k|yz{{^߁'~7FK42ˢ|~і' іc_KGXo4:N)FfjkC[cE]igZRޕ?迼&l~ =_0ZP<鞔ڐ8ֈ^bkAUTss꟥_rBԛ^ owӧWf̘!gh3tL8q.nǏ?V@ssO-{/ |oԯ[;q„ U&z8 ClvR'fU]sajֲVd|?s^nr`pc_{ \uotOLo==,!KHhbp 2`,K `c el,vf vb\"16(8qU8ޕ޴{F yU_ݦs&z\2>gy `?j͔3xeAKܞu.bWnPoйIJqA8q4v5l`ggbx;yyލ:Ek{^76c|c)~a=e/d'Mg$;c@]>~BWZ;|lZogX7b4kϪ2 =_;Z$14z6נ͙zih M0^TeJ_Ey<ȅyX> A犚mU޿Vej zw +<{ +Eĵ:kOv]D*٩zx{Cax E q̘1 qq:۾~BK\_A꾷^)['ևߥZ"";U9g?rͭǰ!6 YyՓhx}Rމo&Mo׃im _Y~ OJKfZ Aׂ_Ŏ &cUӰ?fIXƬ:g):^Bw;,g8w+Jӻ }}} 3gɮFr3SY.(^="hZLE~Zg V/2igܯ((H4}pkPFy cw kv8fvtvrYVJoFSe0Lxn}A5.I W|ƚVf}S<\Li|~/%e2'kF "7e]+2b|xm*JZzzzZRsi3H^z1'W~e;~IL~m<M;05\CCf٫NUnj6TzgʵxK_ƾqdO/̒>C ! +hO(Psaqu~'-og5ō^3Tq.(ީ_JSgPlq-#AgIoIXj~x]xf+.]祯0Ƌt~pIQt򭥯i#' vc߀_͜{);P^+-"}1d/01W\cHAR14YC5cΜ&~Bo6~21]~k6Sm&_~ mKdepm~٩,t QX>uaB}AwNsB>.< 3ٙ4y5B~&MSQmh^sƸ,]0y<|/jVRiI@a6 'Q-0<}^5 q|}׺W}.̅T_4KϋXs=֠FstToTyFМLja4"o]IX8jy?[1|"j;[RR#<]A?v@7y EO{nϭ_{|.dtjǵߥF+JkN'4B;95M0NGck#Sͱr47Zd'i._Ĝ9s"} ]>k[T7uF}tC{<}KpƝy[**Pn ~tv9(6 Mp6|g<~_c͍®gؾgV6BM )Ap)ʭNwuujMyT:e:2iQ[Z^Z o}-9<_ti.fmWQģKQ}oc4|NCq5nsgSL -if6>$rOzZOX.~EWjuaA bt>QfdP}dEoo=Xc:Ykثoй뙬C_f}[żH%cy'7̛ۘ?+u1ð?S=-ގqvk5z6?=798ƸSTuttd*J +Q+%; 9 GhuvXCFu?'VK)BYow/b +S=j[:!A +~jZ$9t:5.u)~fZt>Ѣ8?X.E /sóyM+Zފra4>A>|w;џ/7ʍ3?O3?wb:IT(R¾&tO֭Кu|Vz|FW:K #IĵZt- +=w:84vbLzބnCkp7+Z_BQyT0>ɳXe<kUs,H>~{dKd HCB8vB]1 `AHB}_Do`K\Q5 WD=Nn0ӓ(Xta|}N('A(-?5- å.ԉXsx}ԾX3Q}7c g}$q~X z^c;sg/HUz=KMZ iH?A:{/3/_ 0GBZ^BzK,X;$JTd_A4=΀/.1&{o xVT|lrM•dnߠJ~{zQi=k, +& +|cҖ9s\ʳY-Ϻ7.\Ǵ#Iu!Sx̅E+ ȍ}Gkd٣ƹ=K;%T3(P[VY3=3}a5ܤy3Jǰ3]KLEZqԤh?6,XϐƥjJf>3\nO$Ѩ~B}nx ]x>XC)/^7"EuY̹<>zWv'awQU$3ÍH{{{DzZT& +]ث,s=nb-zhd c1(w(c{JUZhRj?3tjSm+^V™.5Ϲ0[XP͎oĵշJwO޷Q|r"P|-u&)2 ZaR~qW.e5vV/aI<_Ʌ1c0j.C=0T.-_fdca[y 0i ϲjX)iKBud:չ\<-ŬkWAzfuy?Z_hP7/n(WթJe‘w>M 0+0ƝxjGcpaDks`>Aj kn]? gy Fr }Qva6 + gT"4|x˸k4c{F=Kx]՗IQ^5H'V`?p8v}GB;߮+Hz/3lB5Z* +PWw{{){%x/0ywy?IeHy o05$c;5azp.]Uc[AzAL!~_P;H'aW8 w-}u.\:_0M1ϵ1y kP^Zgz F2x ^lUpj&;/?_/P.[vҐHE:qSP(zw.!s6`?ވ%06=10Uנn^#n^0?D{O+;tz)v~~~;_V[HCV>G-Kk*3 agS;qoayr/-0Ƈ|>!Ca$uKpP^cLB//JSr7W.N< }ٌ^٭O9"ƽ I_"]s3ƦdCz wǰ)Fz ևH:A6mXM + +J҇?io DKk9j=3f3=/yRF}>U>;dl +IHHPB4! "]ґ.z;A@PQ%$$a <癝L{|s=9axK hyHA"쫚_ U W*́ϝ;qb_?#hX,HEEŵdL&g.۠jbV[[[K577G!]KKKDS\S(Jm3./sw`M7IN`SX @d™^XX$  8ΆO6t- ?H$HRg[3 睊)2 Fi' )±z!5HR[s|;~o?07gxϹ`GX Be7i8$Za"Lsb C|s>?"o~oDZX쥊tL&= +C 6p!QrPaU_y/|ƴa, \8?}XA u gZ㩅ΏlXÙp+<9?c1V2 M#?H$NRA7ڠu@ +'*++Et5\nyh'h9zzk[vc2^}7,h35 7*?J&~ +PQ9{}pt_SA.b t6_ cqy 5do 0_76p#<ùY{n2+Z>Z6F0 1}k=8| ,5~?kok_8+(c-8a<%aH Mua8.0 5X^dlZyehZH\x B׭߇¹\r{lPk^)-xy }1,qEqrD&Lɰ8w=[]ОF;\^篃 ]c!z庂뷆8~qy9 cqIhN)Ơ.ϻ_<%j JL&3rlGtYq9|rT?u~ƬdaG8v`i%*y>'Dy]7-8f;2!'8i^ 'a:l6+"B2P\n%onn8 pe,nxIkloҽ9P-p6I0J;2u) >2Ƣs;ޞ ?`MFgy K̂=d8$5 & n@/Ղ<|_31E%>  .t~ޣ|8Ɛj^1,w NkR)[,K|0>G#h4z>>SUXQZH>uaO7Lf<098 +ټ0E# kekk+;b {TBcXE3D IոlW2\bX,7>xC;wPS5^ށ&16坟P}Eh9km_bEkΏ|;Z]X4I(v&(}5r~\Pk-_OTΑ1,!>|koow7D E&JRQU[#iWUT87H=^3]Y:@{.̃ !kt1'Yh]B.Kؾ"Xtʵrz=m3RI,A3fLfpʍl2,\ՎT}ihH>R>V#wjy F|ϥjɩ.bhE8eT2|6-ʼn]A9Zy =W_Ak'#OB9 [X6e5y{(2L4'J~p\O U^{$[+wW-ϗxDO/H$6TQsKƢSǠXN=T E$8_/Ty$L/,anP>i|GT T ^l9g>I؊{/j֟N mPB'Ԫwz4sdd20dQT1 ciF<=J_cX10>^2JPq. fo߇c/a^K#͠*:ϊ(QU`Z:B3&4t8w1k\+a6{p>Hm}lW]ixjɵa{8 v'_o-޿F?{UPb#48U̯aIkߛI}" $g#CaKA֜{uz(\.( +UKÚ! DY+F ˥ q~ӝ_Zbx{|iXv`nɱ+r`۞cz^qj /28ؓLNޗ f<^6@hMMM6 %wJe+++7{ce{/]C kqiMZNXp-e2X|0ᚄ +&uMO@ X C@y2[e^CG!yC3aa54h 'OV҆> +SեUeLK+,Wt؛~2o`{, S|R1֚smX&0ZAy)rzڼOzHKKK9(Z A3lf8|(}Fae4r[9 (ߊ1==9Hct^ghxؓƺa|urK}9r1b6l4C ܆dT +4l6az:O=z5>|jZO`j-hA=.ycWk[0`lma|_5ZwU2wV1ߞbno٠6:^{ TA/tfolll* 0D;}ïdP`Z؏|ї^I:ꩌGZ{[O5[1B3z} ‹ڻTlP- +/pޙ?~R(T_Z( nBX,h {ÿ^w{/KQXk+k4(OLAI2E3ȇR]W4f_pi΄k*Z̳o[{j.XsQUo4P/ +n@RAnj5t U pew \[l5Bzz7t$m{2WcpnvPA㺷[ S^ZsN^מe~/nfn;6ߒ +yՐqt(^V,=FQח`PTZݰ(A3lWAcbF_"a(%x{97c?ŗUk]"1K׆VיCK2ԋH$tB;5ʡS|FqnŻY߶1x`oT444 |C+++Ew>PYkڿc+&e@y O۝1Tsdk1p ~:$zLXa|9a.|sR}rfmfFZm)(687ym>0AGbh$!WUU>[ 9AmaXF_"!7{ۗjm|1> ^kKSH[XĶ͝_9.Qmh>̯3Va΍fʱ/J/TWW4unY7ѣG{{0͠h>(*OE}|'s7W-_pV5_k:tX5B#2 iOpZcrœG~śv?\}W[0оJȖMEՋAu:;;Y0QFy:OZ_ X!C;~%x4Bӵu`֖0VRm2x1 5N&zZxaojr( \=%[_%k,l )WkP(m?LN5^}Fф^la Kj +oXP~[eu}oJJ2N߁{-WJPVkҼa^_U2wW9Ap E}U߉|2Lt@jLB{^T ]U ^3|U|m 7#w1^Tm^0 +nj.>UAΣrqk fnJaKo>!,$ Ъ٤9լ;}." $Dz\Jz?I+U3'm0kn\kI؂rku g0hHs^x P= 64Tu o~_L/ 0SA6b(JUKsl|>m6,G;={n3lB֕p_SX0a|AzA5;w`WPE0bSNkNʉU,T:U[vf, g9aPWTo{ گk4Ï j_%:a4ܙSWj=`Ӟ٠SMMMЅfXͰ2bܜZ# aaF{|AzA7J8 ߿?/hL&I3ֽvՈͮ@3jr43F3Valx yjq- :7aG $?epUF7ͳ8~: 6CZ!xueeco6pmҤI^Cz1hTaAhʥ 2f6empxaF%y^xdPm`-䷠ PJT'^j_%_XR" šE }4eUV,`#ԏPu+O7`(PA\[P|A{|^m1cƸFqS',)2^Za>poxKxb]o0 = X OOa; +uϐI%O"fnPGo ѥS|I/UK{nURå0A0p+<;>aZi0@矄8s;4]PߕKBI4M/|;M߿h-!F[mɂ[nμ 8[0 s_?94p]9LR]h$!MLAcAZ7aNA{s^a}o:ω䵩Tdsl%P{#UqOܯ߄/P73~FÚ085x6b_b a}?G|^xl:grܡ|~;XGql5o&̾oraCaL 34So 5 +0#?~/HH/܇6CP8rϪ `}!B ;`fUo@ T0r}Ca9tưWsA#VoA sFaWJD\O)VWWoYWW7F544cQokoo@=HbA{t[ЩKY|" ,`07֋/>k g +CJA{SSS2=٤:ff c꟭>$ +)tg5 ey?k&9 +p!x< Ʃ_֘tC8{{>a dºMJ/ +>y6+VZ`G´嚛;ZZZ2퉎(DgclaL]cU@y?Vbm1G3\6qfT aK .~'_f8g;7@3,ffh4hP%!VwvvFT#XzAuHmmmtuuueXTUU5*ϯn؟xr}hg`0%|ׅ~nYnL&>~{1Ƨ7 +h:!6tШ-R^?3-1Z(A14C-1ƣB3lf8qy"Aug__ a "< }60|A?k?e?b6t_ȕp_0_s_Wݧkh9O9mCz ÿןf piJ7o`{b՟.S?Lx^;H;h-ϴai(֊_ _|fõ? Aoȵ{|agflu c\ua]QQU"8 Lxx:o™n0 c`*E>|8nۙs^/ ^xc}~Y4T*u:9v皧+l* h +/ZO]9|Cp ,^r~2&)qo,_[SCH5L뇙[޹\W?W0ng.Wusc8\3ƽꇩ>ڕTUU&Ba'O8w\Gx^?;Qi0|};Ou&TV@\<3|Nn96_5%MW o f"V1R)WԴ֎ +bq`εNa]wSί),`FEK9Z z_:>i|<7]^_y~ itq BT]^af6L=~QF+ +ha gL@3ZGVxR,`FS8ԃ=jtp4\/7v0 S|mWNS4VD9?Y߬&Ǣn fɦOƏF :;;h +ƼɜFm̡Qܺl +{1 w87?By|AzA}@[?T*h1hNAcSSS _mkkKvttۣ턞jf6, G4CWW4 Xee9cr` 7h‹70^9X+0V{L)w[{LzA=~ճ oy(4` h Q uCKK33v)Se]֋9*1?\:0d"07ހFnǕo ;L{m0ޢ<_|os+~}S9>Qr+**36FdfO+ 2$81bef6MA#Gjhh/?R9W Y*Q__Gzz/yŜ/ޠӪ):a/Q<y}cqN19_3<0)BXwA0羽-q ?u)^r؆skm:l9*Z*"uuu. cǎu&MrfffYxZoc26M$ap:/ #-0%IOy i*o~:Y9uPIc2E8/*/lnye~Gh+ `&:si^r9ՍT-0-4=7.A+K'lk~c*VdGl!HUyӊ^0 sb#{_{t_P*Q(Z_'! *0ZK5,A=u䳢0onr~¾_k-^不؂GL++NJ9y=w1_C0-hrps[5a9u0oA>F砽ZhQsVt~~S kA)^g+L?FgAy VPނb sX3-VEy kfffʵC"sPA@1砽sP귨+8>a}YDAʁVނ'[z S=ݵL+ 4sjsP=:?AB1I՟vк]փ*ߛi0: A>F+$ɱ+Ճy ZԞ-hOByނ3os$ ?9ho"vzr$O ߃F5]ԓFR uZPw( D|>wb(pL=(-lq-(w`fm |'Wl?r~R+.ķ( oqOM?7C +.;ɜ Bǟۗsrz\+=L/};mAA;^j:?j>H|p5~>^7EO2{۟@f~1?w1WAŵjCܸٗ~뵍S:-K؀ۡfqSQsr$s +Ջ? =;n0eqG궪p,1ǟ07wAo<]92`:X,@muuuT*╕14Ey+efff #V^Hs +z|`[r|S| 9ڛr 57=|0`:0z+ +q_I[XAAі\:;І6hD/ Jy4C +*;np1޹ffff c & U<42_47mux7}RyYA9> հ [Ay='_s ++w%1?]W32Wb^Ew1O[uJAhhhAщ:WSVffff gѳG_C/$7^+y_N E3(zE|:Y;BY >9Z-~a t±T_eu? [&7/jݝ_u}[58y9y<-2_[C$q4CTzA4559!P*_$%BL>si|PAhf|||`SExzeՆr3a? @f>V;sӠn㻁>p+(_l7O+[:*ί:kZyY`~*1|gjGShnnvuvL3=x&99TR,> +ThO.8XwTr%`w{멟r>ʛ1PP 0~̋7//+gr1Wr~wP _ϵ%9igyg*^aF ͠؂$Filln?sHީ\)L&MRq$&|[?U 胵dz2ܞy< +=|ԺEfa5JD؏z`P+0_b~S'4̾ ^~,OoLTR MlC{4YYplmmȽVݼ^X]n^MWՈ~qF_\+|Y &}b^14y̍S+G3 +[Y Ù3WJ +n^ohff֧LP!ͫ&Hq>FB+BK>}q+}a|&h'¹p傽Py=z7taBSPlLw#+r"H!̏1Ov-`a +e=)!0e50 ȫyqixx]POp*רġ󅙠Zʪe5ù Ьhs9mllLWmV`zJw2eWۡ ##^adTh:wTT}UwTS`l_N9p=)x<,(Ҵ÷roaI]bƸ.Sybְ|':: jTDs\Jkxxkkktz:La5333dr5tYnPU2J7O;g)=gZ{A<{1՚=~ s+ܧ^AQ8w`Dy.iEOq0iA.zA{#/By~ sgNcP^~'o]]]Zjzj6rUg=E "W0333L%u~B5sht:]|0#aLji9q!ڻ__zWI^W!֏20p螓}ʗ- +ox ԟU=b Ϙ:u0{[F$&h}I5Mo[Y1aÆy>ؙM>4o2[MP C Nl"plc>{/_O~=_{(]Tn׀x7K1> +rPn{)Fx(+t8~5W0ζe}qcq XFG gsM 4H+bg٫i\U, cƌu7Y(\9^zRo\. +P6Z-@P((o:[a~{2a>so8%8ܴj? +Eί[} k/zfyCBv(ϡ, 7N&PB07 @#T#L{W#Q0^nU}S+ ۂN8kcGɸkE6B RuHR +ayrAuz^Ы٢Y(7\yX,zuL^b5554rJ4E)N[pC?oxdիOn%l K BU>-p<]9)B No]ˍC!z7 +E7<=_Q J }OI圻q\9'1Ne3םx?#2UT|i|`, \0ުTs a a׾b׊5jffffxL4?^ B Ve]o.rM + )"Z$EHM*9L3t31)/Y@e^2+5$#N.Sd#>ߜ=gϙ`,oa}lm=˵p%mNq͜_RRr. 3Yg}*اEeee)HpmYƸ=E>8qn2L][[0Zollt qGL>_P{v*5 5A;t8_3AC_}9Y :ַ}'_W]U ߂\?<O3</w.+92v8D{n8px/c #ag̟~f-cd^n]vaVvblw-J-m!86w۲)b)d[k+A;]]CCɓm2L7Tf}!8w{=bĹ뾞'_R?pPZ_CdMLO8r8s56c>N߀\s? < + 74<zȽx5y%<Z)+ *s% |>mg >=nm}6wˍ_v"~c߷sM~M¾} -\GulS,H-N[Lף],^0LcCtgsvឯWt~+'+Iv/%4ҿ _01d85?E=,a?q,e n/\}/Pqx +=g+~x)P[qEIQL \G6wwas7c-Ql"]r ,B.\y&Lw}o \/\N+ *++SWʏ 1=3k~3IL&T{P̠{BZ*fޮ{%1|P]pab S3e/;㝂 L傚a湰6VZyͰPNz y YrOuoS>e{ض?76iz_ΣEY|(NA2༦C?E[dqiƉmid<Qq2أ_mJYAށO(ov}#FL|Ply""۫>Fy*]/L&hR=-;;;gMGsYTiGu402^C-~ͨ_w[B}&ߡL9iA8%;rK]#զ=b}lC=]rAMMM~@=*jY[(&PBWW[tL&|H__浣ڈ~r)#EqCn!^ z㖩_{zV"K_}C"oQ!̩4sN 7%;⫂hlRR}*?/.XN>h}HD54@ߦbCL&t;Bwbø+WJٚv?>-9U8IG$n4FzO%߯8N_  4`2L&"Fo|bLu׼|*E_yP@  1C4'5ݗVQs =P̠1m.d2TF_s7,W 7g{3xIF)U`2L&Ro]KB3ȭE,tyE5:_zd2L&d2L&d2L&d2L&d2L&d2L&d2L&d2L&d2L&d2L&d2L&d2{ ߾>M݉%E7nDW\D@\PfSQAqk}tu7qo/"3ޓ'y&y~O5]UMխ=Dd۱x..\$Ȧr.0bNP^r=ȫA^ڒJn,u%/yCST攷5m%oOyG;KnNyWʻKޓޔ?Rܒrkm)L=C)wܙ~w|8#)wܓro})|4R>O|2S)Ny$3)g)WRMy,剔'S>ϧco|&6k͡ _vf(wR[{yds9vC \qDkM5ㅔdz`g(+̜ݚ8^6D2hnPk u.7 :Pasvؼhޱ{kxӋBuU; q`7xzMsqƌ9@;ڊU8lvxB0^8XY9;ܺ.Z[}('`#TRS&#,vx)sCϣgRs8 œCz+ZyJs {NonaEXS-ѽ^EHs\m!dPP] I /P!$;PuXsufo79GýQCd~EKB>:ߣ`]Hs!}Z +)Tms`+`'@+PF.%ʯ`Kv6@w0Kj٬C}bTY_ѣdmܰ#s;۬cB>ҙP0Jkm!4+@'T+`#@ZJ~p(G@?@;9`7p /Ž֨5<>7H5^vXкƢe֡g(5`xeZ/"cB>1NxC@/\Iy4Jjgp5k x^l߀VJ~j~pKbItC؛AsmPPkO){69pns=j =L=kqubq}fڡ:v_Ϝw5 ۱!~ya}mq>X[>˜#5!,Vu߃ہ9@7Ga5ܳQmMWsA=qb^;xϤXuh9tuCa8ߋ0⎵fz> -^V`k qS)^oj-ChVP=?>}/9 SPffQg sWj}%m%9s~P찹wHaC9zg=}T[Q[^j x!QEP3^7k  dI^XjXw +  Zobډf ,1M%u!л/ i5xݰ晇Kv}|ҟsH!Cܕ2Epk,YKbiAZj"̯^as^H>BK;dcB9-k#,^X[଀wCM_Kz1RcړX$7Êcag0%R*!ro=)RH)ܬ_qȚ*n6 Bfm^8FmAC\z|c//^^/YG܋^x9No&@=||>V(54Ucf{z V3X %|z?͇KLvfvHn!%uu+Z#z qm =jqi[ej 5e⅔CzBv?@o}DsןmWm83X`;fݷv~X)Cˑu9U̎pv\Gz^j cHyKuR4/H#^j +d2C>87Hܟ[cfzaf` Z찴0[6pH^HozEH-B> >W[X|y!Ixj ԞM RO{Pnf1,񂵶ucpx2DL^a>qTsdZ{Ҍ0Wqv ^Hy5;B/"5-k"z!a-XCyRc1@3Hs V/[kgGnK8b@)>hֺCuá`Cګ27: }8ה ^wCZvCh<5jƐJїj K`Mൖ/k #c= p/ )"=sJvi qz5jZeơsNN/7hiΑ_k >-^D// p!%3p}3% ֓y… /|#)/<{\]A)pN|9&#vDkBgc:Ut ao8#h"KB-H 5h^/Ag?fn"fh1H= 8`Bs) YeK >H}^v! \aI5@!zڵg;N'셔ח ^Hi] kOZj ؗS3PP}f܀Pt>J5ܓf^HJ W`q' > ~Kڡ,eAuCݳ*z863\ Go/P n Ru^!IkB/GjK:foo»S ;/~NK 3^rʳ%+x@q0]W%Z5젭`]sUqƽ&nE6;q/LF`ma7/h -Xp9G \oBl kBQIKKmZ[A'PN|8cT}iq8Kxzuc87h5 + a\6f߹!L=;yy!)=zk! TOc&H2 ZIsoH3 pm%\'g 1B%RM%pF|(3 Xbu^; enZsyFZ +jA x \ k8E/fM-s\A-x jϠ4XSQ~'zB7Zf8/|'yab/@+H9 z'OpaK5;Xkqع!kfn a>붹|q10^HyG;SnNiEQ[𮇐8/H}%fNh |OKր݀퀝PSi]%7@3xM%lnx OP5$|Jؽ9 #4?hvూglb q>lOAQܐꆫ6H Oqm꽦=) /p}lǡR͉6'X Bq&%8?xu Ox`uXү*x\jSq6۰q,/X^0v0-׋8Dm3Hn oDPoH8ۀ@\$e??ߠ /`/K}P[,k+% +V'pF M0ȥH aYA9X V3PYbn5\s0HG8<ϧϯ<Ϸ PpRDZ<{/~ ^D{w~q^gMڂ 87x 7a=74AMߗZդZۯ85aJ>龃`B#Syg l~ A2C>%;| vn=$wnHwW_/ n|~8*9xPďxyG ֵB0B~-E-,;~w n^d*cϯu."{TB/S^( >+sq%`5ZA)=nk!ڂ~S꽫-` %ʉmN~"QD(KPj]s`5P. +栮kc>Ob7io7Pk1277G<^x[gq6@/"콐;9B_V/x*&q`7X7 .Fv-T+H /Ee-e qRg0)@+<\ Xı7Ky.q,=`;yܯ5V7Hfj2@'!yRϳk|G9^{{-۱em58]j'j 9k /x0qH^V \~oT'>D-XgYg RZm +%#w"wÀ?`;8 Ws, + ݐϣybzGB<`F !;~5砹:jWa +0uC>_b7*|pNXl@%q/pk#\ a|Aދ8vm7='8y`qv~R?%k /Eg`/ޫOJ-xs@$'H6%yCYBwjT Zk\BUXk*S7'vC>Rne=N Q^S^K^ 0]g%AiB//X}bl!=FKԏ+YL4}/N`pXsJʉw-pʝ\s>a(CP~v= *87K3B,vXZs1g#ncrbֽ-k#,l/"9)W[Xach&lXsع!=>_MnjY̐֋ KBʃ9OMr;!C7X{/,e>nj4]ްd.rsp^fBY[h:~n>K2YsH tCϚ%f'pVx)k uB]p +<@N)Xj +>v| ᱃VsUXܠDR=V7Hvj(;H37xbO\auïlBQ9@ǣV_X ֵڈمSk ^'|k*c݀{ճ~R?~8wYV\$Cx :! N͒\  Ti.R\G۫hqFnn ؼ06ȝO^DPsG:+xY!!59|W݀{ Ŕ;T?@C@K>t+>sk 3+r(8'<8aBuf  +d򜭡 aW,qgwA37൘OڽZ"lV7}x M/ZJˬ`5jpv ݐ aZsv~9YS[ȏU[Y!@/Y9aBTSh[P>/H}#u]z/b <$գ@XSZKm!>VjJ}5+X@YzZs%| Rk= C $77tâ=u2|j=_+y!Ex!k_n&z"L^s3,4ౚ̀_[ygZWo~l' +ڂh + jA0szV.%.lzZ ^;P7P>on,J_{/H8xڃ=_;"k 2 %̉^LK 9f!*-n8 +oMRsV7h -{?i}aVqחk !6!f"Z?ip{!?̏+ y!? +kz fF dB{A;a焒j"So+HNx'?pnoaD'|@YB ^oOuyϧ( ٣ABG/`3^Hy!=U/Hs-fVzӋ gu 47H}^}0CĽ{= +X`愒[k iM7Xj R >o=V?X`q޿Zwd!7bH4ڂ>X셔[m셷xeֱekxΐ`-V: ! muֹkmbv#ܒ׵;Áףj ޙV3Xj uܹd8377"WuCk f7= A/D{z,^j o]}5/j az}?@%(3Hnd⴦fm[al (P>5q]+P6x;a~5Xoj ޙ9iA2i7y#CK~ @1muCry&Yk q4 )7ߚJ z^8 '=W[>b_£Տ;ݿ}VX߂=+烉J.T',`+hF`GAl~uy2Ӱ KLX`U,{7k)uz#4pNP0x!0`/'^5B^KC%/x^zVi a^{/ + fxۋY!@u;+u9a0'83su  (pF9Dۏ +o1Fs?D-1Y5Hv`qĒZ9sV/7䟉䆺ir-P_/C7tml qy^=]!PV/QKgZ0zg8#H{+e +aRgr6i'+'=(uC(yOhfZgw$?x<-vzs3rn6ps`4/Lzqa:`wG^7xVObI {>(3w}a]s/gk/b;'ܜXAx>ǵ?bz^נ^h1%X*BrCݻAsCݻsCTGTa=ԣ cǽY<{6 ul5%^Ax/L(+s M`2;s:Vx Rjg,53pnXbFKOn{>U7{ZGsC])] ~_Vmq~Z{(x!jk*[_^hSaIOzV:b>՜+pnhKxj GMzMUS ,C֌f~3Wo +ڞO~VgVYy\1g/qo^5xou6Ò kX('PF#(7Z传5 /gOjPZe+:uC׿]5 <'%hezf)f3ciڻ\K낰(3Pn>ۀ )j{_Pǜa^Ȟx!ڽ52S_ _>ߗV3pijV@Eoh?@;Pu y!n3^s } 4#LP򖜨(  jVJ\ڗA{nb݇[ =5lC&G,i b Ϫ:{2àZ+/PX9  ^3H5' YGx@ o p m9M5B!{P=z&&2ڗb+H\zeZr-n+6ңF[oO:ojbzsun-|^|a˞M9[ 5[+A 桩gf?T+PN>J%>h TKXj ZO%B>Gu]# :Ͻ9!}/T#iKs#8+z0P~ 0;HnPx?P{ Cyz`BKD^ lmHm=75`5Km,VtC$?[sXڧ0D[ʵ;gz6tY!2^cz!vZn8=zzr{#zb ^7H}% +P-"?dj@}+Vczp؋^V0#:=@2 ?Lh3Ps3u0Cj exP5ޙRymp|r+T7Lz0q ؓ5ð1 +3q|y!r >{*rf_R ?j8uC} +~X#%?~v@,VcspG'\ \m>j 7*j %R3/=o\O3xf +8D>2{UsZ8)R3x&rw[@W_𮫬_2à<ƹy;|>ϯ=$<YKqb5>S1Tk!^X; ?!c\wna7XؗՓ^z^PpEq@D7,ff\bG܋Ь B8KHv_.ǴrjvCsÚ Ņ}́uC2B佰vOb y\7I/s{{2{/5|9 _>3pn~sT}Z[X;_;lj WüP3 >Zj k5m~A¤H&l3N:% f ArC//pFCZ hن: +SA2CDs ݓfGZ/{!w^k|}|ݔܽ2_xQϷs TmAvtAϔr5xPLNJK=a{z5[5 k ta& 5Q:BaWkH?hj$臖^f聏CBWhn*(7>eLd1s >۰: ֐BGloF[OJiAڷ 1jF3Pv`iGc3䙆%3 m~T,"gj@فs:7Z(~s_Zz^ONϟK#"+\H,aXғha35^h57Wkn7$VhEPs `tBvo`C@7@3Z /+1e^z +dvp5-n`i̐g43XNH}3.B-@+PN{Q!8;P +˽7zصq?|%6lQ(:afz$Zg&k ܞ x\W5Z'N. ր077|A1W5ۓ^sG=ڂTWP}e V ' -3 Rro"$"pmtGPvuO`7ד1Ralzk nyBe[#T䆵 e0-xfuk k +P=_%`R@5䯫,5xp$by$+hFx5$N=ĹaVkH?' \AZo)AR3 ?qngg8+@|l`oP q`;۰: +v H;DPW y'ݯI0+B1X@.HV̰tog[3^{unC9)@'TO DvnV3ܣ'0hB17b(x]l!f L7)4H }Ok br'wAt GὯ!QLl qCEPcVxA['Ѻף4$`DZ4i OFJv"(9R +B;Xj-n0(|} lázMFnv/P3 = #RۇH`xKp^3@+ﳇ׋؇^5ꄗAJrUke-5»> )/XrVOz'؟k$Ws"L9Jh {`ZfݣO2ף`<au}\8+psTmABmBnEk7X"ن7A/7p/{(paߚ );iwOBZW0XHx ^+hf9X pv"jm  Aj'p3T3Y/gIP*g3 ^X5}sW-f'KaZks > 0Խ&=-؇V.A9vîG ^7G!`0QH(Z |kw?u 5\#jlóg*|0 : J~jݽ-YuycbACU +B KhDPnԶݶۥfɌwŊ'"n/2yq~RR>6ǧTLZkOMi8e?\L>>Ǧ;T#S}xMS}`MKST]SswL:[zToS~;SnN^5O^>˦zT/ESpL7Mܩ֭[?;}OSs=YPT5=Oigz<;?s~^:ϯ~>ܞߗ7S{߿>><=~;|h{>N٩>7z|/LT_KS}ys}u_W챿<ח\Oǡ(౯_t|e_ST_STߜ[S=9oN~kߞS`ߛLSh?Oө~<_LSMϧ˩jiyv~n1G<é`~7?ߞ_wu}~?{󥩾0cS}vLAS}dMS*;o?< g >Wڱsy.M©^0zT?7sj<ٹ~f맠Mg>ϜM?Zsƒ,gC6ݞ;M? zT/SdN^>+^9իzTuSݞToSi_SezToSczTsg_^ow<<<4[ si7ίs Pv7{}_hcXlL5ndy]he1 ښdz^uq{\ֶś\Q53\sCc~f,7ء^RO5j~ݯ߇;}j;  w> Q^X+ Z3C>|_kcQ^^Ÿ5/WC9k 1f<33\7h rbZCFcf. rbR`kz^f;d^qC;LkXpC=]O27QFZIyި |QO`̐gU"^$Lc@O4${< $>Q|~ϗ8gtA8"^x/'Ox4'a>5][a+/ xcHc3xB6^0O^,Ю=^(/sko+ПL ??=/,%|14_"=|$zN<Ў,/sȰ3 j n֡4T [-kC"Vn'{,+2܀ E]zZ9< +0QCZC;wTC&< +u +#$LcSמD{'ƀ9$~q>YƓHe*#`BF[p9AqU[+10p?1}sr;(ۼ + `^b{aˬ(7d"l瑌!} U5+D$Pcܣ@^<  +J֑ 3G7րpnb4z/G, U^$>(=6! +(Oozb"_򵗵} _`^X;4(fbτ2(_BW^Xchvijzv>/zb v‘ß0u3 0 j}TAq +DB^TF|U&^Wgܰգت5d!D!Cր"[s=7\V]r [= '0f n`fh ʋBTvs 0IX?ePk@B1f q6-_c휦6︎tx0VƘ%5Dy; ?d ¨eag^QD>3sk Ó#Tکx ~#( ^Ai =}P{7COcЃ0^A!;7?1se"_媿Ri 2k V$Ta#QǎnϠG +{a3;aUfk^^#0 ѵ7H1DTx7'ni>]g̿+dy!^>(ȼZ++|S 3/eK?,%5U\iÊcXf؇ fx(NX(3$}pkퟓ'*憗اP;0?dNњⳂχȲB:azkk"!Q19#(=b u;/d4N4ly/2=S57 \i_B=I(^@]q +4X3Cc뙰cePgYcXJYc1xĊi K 33 yut/eVfpoy7D7oيY+-(xyPڱ.g#7 3[G>yȽZ|HOkPwzt]UB4j ']K+^XTְؓۧϫ'a^x?ȗy ^$0xῈ2 {2d} 민W4Ǫ1C4} 33lͬnDo%z@/^PpN!ܣ5x>r=5#s3uKf +/dĬ+j '0XO-짘Ɫ>Q"O`'l [>1fPZCjLE3lF 'F,g^ci{XZAJcdwk sxiTGBxIcUanPCY~8™L +G2 Wk[}n0^{/3Z^nK, + ^_78Ix,/+6? 7(s<_b+/dsX3LG2| <^؟PX9<'Ğ ?zs0C_s$/_]f(fzΪ- /7D0 ]n1;dH=[f@gCkt/ 9)!{ X +/(Os1xpvz*`0}.r߇*Y0q'0} O<3`1ˠf2(s OC17?a 3>Ke0f,CKy_"1ԙ]^0I ?b[B 7ء.s~"u#l)f䅽<rְu^C KkPsFcؓ[k.x> /àLA +?k~̏DЗᅏ]7]2 #̀=ُe@_1/b)3C/Fg3>KPǖe#a2uKGB^pAه +sˁpUc^pC9Dڃ Q/'0+(^0COk`gC+1w?`3MkΔp˨zDvޣ{< ,C~) ߞϓ *i V[t O0Yb9Mc`Oyo i0fhc3X%Όƞ /^GYk_\ٗdCP~^˿x +@sXuzca~n +3K5bN@Vxa+3xYh̼cz=f +/'1:q|uϲ>f^`]w+d3'~[{3̀D>ru}Z2#=TY}dfhn@Ip͠, fʸ/1<`Zk0W0-l+xa77ԥ{Yeҟ|$'(իDya+3,91C&yZCϣ@n`vx~sUyWZ/CZà2`ĊaOcrkۧ˒0i5 8 Q| 1 +`!7(fhy3lg,/zk/XN`=wŗX0TC$+ #V `O1Lx x{\neyyo"n@vP+\< Oc=~l>O3]f$2^PBn0v@nPĽ9,\ T :}{ VƘ,gcɾ3ES\*yg3z&pSe(Wڱc+P?ZnmbB;l$N@VPflB0w=f8Bk iZ_;df#O"[YߋH9]'Ξ0D^`V;nYk OP"D^eۏw5(f0f+3Gf/ˠ4d,5DoJln4πTz}#=3e3'T鿽5#/DfM[p;Dܐ%=N(3Dg!=n=6 O֛ T/qFgyF1|h>^6lõ{/ 5Bv@f`c_/3+##p fܠ4 3 {0YZτU2[9Hp$3<'fƵ 31 -+:;3uNf { 'qCFg;` x:QTF'r0 Gi '՟א2`̠>7'sqgx/F~ ʟL _. SqgdUZv1w Td쵌,U} XkLNla&+3Lu43(nUcnX6ATu;/l冭̐al {\qgϟP}[3Cq䞗JkP\/[ V)^h +b-ZCo_gEYPHABz󝢾=oJkzi ύ(5rկEc> $<^@VK/tYj V5qgA>p9ϩ<̰{ap&vأ5Du"^X!d=ƪYyA1CVk`"껼[rzZ ;x;TO,%i Q5/$/`l'Xk`sJ+'fLY2åPN`,B TpnfPd8eŔz-7Q^ˑF١/S9xaċPPGsb/'b^ӏ7żY yYȞ`Pk jKdnxI\0xS{wdmO̟`f3g̰% Ai O֘}-  qjO͎tjtO%a9!Y\ J[XȩM0/[! ЛǗ*S^o\׼4f( wƓQ5`ߥi '55'z=.~ִ50]2JNc 527J,`k ,JqXkr>+f1g8T2;u~1Hdas9}mkq;c3+l +xҠF! #9/'5!R/3kӫz䊘b%v[53dfI8Rk2)wU5XfVyIC{54JUc@N2Q̠ K'xs)n`'X-t~`%'8z'z3rޖ[2 ݞ23C[y[GE^h`^P慈"Fnvc=F,/.Km,Y]T|y Q<=?3dȟ8ҸK'r ^RkyZ=#t;}WsC7aҘ| pJqBzxpқрЮݟ*zf`4X;ALCO Eh Knf~} 3d +jYfO^A䄺\CAm<cPżn" \ߥ񤴆7ֵrw N1lTGOcP1q {dY3PG%'a|~* T8׉eZv&b-oedN* i Pf80}qG0sÞJc2(7A1BO"0 ^P LK`F0x//ŷ]D=2LC֟wZf!G;S5"ٛ6 Cp>N(u﨧LD 3Daԟ,bBff<Cz>ëSj mǣ|,37<Ӊ,UQeؗx-<&Xk`3 Q[\6,vм|,3xAFiP {D?RPP^{^h}'/3d+" ;h v}Vaf00/ k e +XsRT!I_7`v!*F=)w]eZ4 !s9ZRc(e1py 'x>鳌 ƀǓ:~cT3*[ m}-9 _Y3ߕ53eПPNd2 jN'gB2pS̵>vcv/3d,#Q^2 Y^a>p/ΏއYbqAd1aKakevSƟwEk Ox$}.:~ W>a=3Dz/ƠX; 5xiNps:^O>3(n2 <r$`Cˢϟ( yhJC]Ux=-G!~S0 +dϏ>sYAyszAPǪ=xA^1Ys]ޭ}A]FZ!T7 ;gh=DqOϯ-ϗ1Z?(ˠY!!zZEs${9Hw"넳 b4`rk!Ӑ'րPk=zF~~8#s6yez^'d! ]v1+d6x J[m~({^Ϳe~0HvZ(3dr ˌk , $Xc%)SWqRY,3h6Ė,CKqbzz<Ok4x[r~Kc0j@fxv4D̟h Cy=n@Af꼧U9Rv!"cydzʠz찕zshmAվظK1e~x42q 3(OBi _B| >zӬPkP:iLNXe;xNiq'bTkȣqCVsXC]J{8!z̰uqB2*fO9 - +ًdC}Sv;AHvgl+䃢5dBf`7 ;X5WQc;hqe3yN\?*AX3pV_Bi xϟ`o%T[N,H"2 =B͑ 5 e={(أ> + Q.RiP}*C'zsy󼜁h #B^Vv =/u[^> DmCGn@v4/ +,zDw/Fse!GBh | +fؓ4k_b~^A3̠T܀`B4qtO`G><?={3 8ɘ!OdsOX;EZԼQx}nh!;y_zZG!b Gx }鿏1D9au + {6q{=^P^k <xPv!P{0vp5^ְ' ^}!1L=3L'5 7pBW10NrL ʟOL8 c-QB23΅f +6L$2qS'*zCR{= x/ Af@n`^i ["$? +|u>N,7`zn׃95d5sυļ=!d+ +{_Pc 8PWB&àrUA[E=T`(pQNM#Zsb?YȽZ(T8[y=!dzݳ5c=0|?~Pc3TPfj x>f<(Y\{i  +ٙK`ቩ8U0Ӡ+XxXOiד cvvg/ /)cݠ'.'̟n9w'S唅DAܠݟ,QxDrzVvhkMC}0 U\䆑[*8U4IXޱ v޶6u 7GZe-(n!';5<u25Dֺf/Yc/U 6s507 ;?(f0F+[#Psx 5uFTO|wi{](qb'T25>D GpkOg{+%; =< ;TK 3À֠aޖ/꯬~gDDtn0x[֠x!wiО[ϟ8^^_7 ;X!+x} ea"307X}_{E{s#דyth\pmR梳 5`=( c{Yȶr.\ f'FCGن{eTD:TFϲÖ]gj 0 +5ΐa~ 1(_6/(MYN} +PZn]^W{𮪙aDkOl%% HkP +ڕƀf,fo{'ր܀8c">325}yk_ +V߬{#=\_lf26U\-sBiCV)LklC5پv[e4 d6X1;x^A! ZY{9I1vW6k{5 Yaq ?󃽶8ABj/72\F,CƗPC ^֌1cԌK.K~+3apNf๐_xs!3W/(_`Io6ȽrDezyVyٓuvYjolFf{A͛V2f0ne[Ǽ}ϲ77_cf`n2 w 3d%fG;(bğhq 3l5n]Bo/O%_W~5fDi ̪ e"+)d ֒0Cюs Qp!"f@?֠< +̣(,n}x^z57{ሞ!v YVk _AEn2ݞMg1è֐40CVk#iwk2`Y,3(nP߷ۣ؋VUqϋ`] ң`mş 95lHۇB!*Wkqㆶ6󬧈x!b'TCGDr7Db=ފp43r(;,j$͕r23<^'՛Psںz-Kp7=Пx *ɚ{/DL f(_dAe7]Ai sL9g>Cb닣<dWUz@"33XaL'522X;YMzZCfL 70;Y! !3sc5x5y:/D"^@/" +;W!Rye5p= +6`%re"3bf4,dOk8'7DȡpCOEFk_na,7(va Q1u.J(Лth^iUm^p=ZC&Ӱzs!OG>/U +ʓ4ܠnǬ񂱨w>2H_Pr7d-/K <${mPHϧ>LF";(~/=Og`fy eT/EƧ8xa?q$;0DtUM|0{zDw,J( oFCOxS>ٞ^!5i| 37q#ף4kf_*Zk@n* +ʋ'其N V ^0/uQ9OG |`Ls=0+(^<3'y79~qU?V"k'.Co-wdw֟fET2i{ F}s Y?f /Hke29-i (f Vȗ Z>D vre/X]B[o1^@&xYPG!՜'&CZ6`&RRDܠ4<^rw*Gy"v7, uQ4n<;\CFΎ!,G?2 2Yt?u&Ӑg5x`]Q srBfPYG۠j ќdZ6(vdլ9a?Q43xܠ +YAi #C/"u񂷟`fBϏ7DZ!31yQ3K8m=f$JkxʣPنs/7#{ن#-B_5D矫۵ Yn`vxB1<6F+eX +=/": e{\RFvYz{iv~~n(lg"`s4dv 15G 4n4بǿj杗m@f5h#ߕzsd=r Q(n0v@~@{E;ŗcFsG2VCۃBi ʣS}3Ơs;DpSSڞã`y^xi(^rCG pS4jpP`EύXc1*ZCϣL7N}R{ o\!\C֟Pbᦪ QisOLOkGI缧$ Pt f4di ? wfP0<7|jV=K_bAq4^@A3C 7l"GDb/E"7Wb+d, g4X 5DyHܚmPJQ~Cra?ez̰pCDnj Oր3УP`d{Gy!}{ݧ1(^FA[a Z\ }QfP ^/5/ [= fE}[z/լz( Q& 6T^i6/X߄b4(6ţd!{gyTGM Y7GZGGk`Ĉ={}:>! Y"e/Kklb +՚2 X+l/D/cy[y! zن=[[fLnPb\y 6 CCۣ'Λxf!4YpCFkh Qx`?SYy{Ftrެhf䃇 Od{'nԼ̌'{,E|2^`f@_B1 G2/,.Wk)Obư7lpoh*bdzD{N3,kPZC"5e:wFYlH0{ᨾ֐B7fQ07( +9}8sËs|ڈi G1C[^ˈ>_Vߣ@n`vXxf xE `YhHHf"!O9rmt-495udf Bo 8KA]*b$ͲQ=ٟ'f3rM(7h w濏mr G| +E\>chtG3/`Odg4 7{qe%#D̀;Yz*G2 [gC "37Aw9Df75ʫ0 +d(yA1j YfLC'.9G2 ?ICН%(.J" ";/3/c{^{ +f0u2B { v(>+D3̀Gb401 7נBV`^yN1d!AO{fJ_Kz`4ds^?)ZCx,vs OOiɣsꚰ3Uoa`V4Ofh +x0eXAMIx{InAV1CO.k!QxZ=n>LS׸39`ΡϨ;Xށ9"*dJzf 9Ϡ-7N1ѓa98gAdôl< +/pQΩjǶi=1*յ:_9\a/2ѽ,cT7l7,ء9aFA4أ1le 7dx!bLk^HE6nЯCZO1#^yN1`{-o^a_k t?s"/D05 l ܇TŜX\e8/p 7 }-30+DܰWkᲜs`5=h [#̠;sD9֠޹&;F͔CnO q4+șNG}bՐ0}/?#>7rUpQNe #pgЛ٣%:ZklÊŠncF} oc˶ޭKfz05GъĬƒK`e/=n`ve+ Qgsuk"fy8W9󃕭ԟP'dY {^1D3 Lda'ٞGъAq⅞1CԷzqz3.JΗPY-̠vŒ@JQ2̐n^7rϲx9`^١ga1qSʚzg'YN[| 2 w~fh Yv8kbuBh ޜx/۠ ؇d1́Ux3)j Ge"3z?Cd +9=u Qqg!dfxA^=72p?3(فչVՂ#^D]Q\eYtc!N9_m=V`1qQŜ0 +-D~[x!c4_b 3Dܠa KruS a+7臜qP{= C GxEFPd9F{GleQf 5TD 7֠fv x^B{~gC) [Kd_Ơ%ZAh@fTY[&A/ ^&23-= ,zOьuլ +'xp,C/810ÊJ +{y&&O =nhsBp=33t0ϲLE,8U{pHһ(=xq k 3X\{Yf5d/VO̥1bq 3xL2 ֠ak1KG;? #XsP~w> O{1D~,V>p?1{04ܐeê۲,?;p.U*V ,ѫ-Bw}6rCKd ʗ@>*Odr +v(Qaxi@nPgZ;ߑ98S7x^H7ly3i3Bj#0'-,>u zIb! rQUf CDcss9!K͔D_{]jcA1=10|i,7(d7Vn2qbъ>)㇛`-^s +:(v| !0׫>_(Yƞ^P<\ /x/?ʁ~Ǣ\Q"Gh[ +9xizգ^2w#*b3d/r1x+ ,$k  +/dγZl43}gbxŷE}Yv]z53*2=ʯPY ; !%F +{QGP_UB2*x_j[K=~Xel.joz#d젴+f[jVUcV2CKg?c8^qHRi +n(-̠|~[~'Nf4oũ9VPم2ܰ~Xu=YfHs [GnaG(lxzC QĪr^#ˢ2̐'zE {ya4;6oO헒 2N盙i99.:ٻ˰:pϷ/NC0GX=OP!0#\?+d-1&-`F5:w'qтzgymY];h{UAQ}(@A4 W@4cEDAT٠ 11&yD{/[5{9u}^s}7W)ˢL,gvHYoϺYO(MonF9Ԭ[̺[MLdҥn;v.tIOä;NӤ;OˤNۤ{L{MNߤOzM:=ItդNzؤ'=F7#&=r55ѓ3鱓x&=DѿYƣf]3Gίᳮ0CYEKsYItͤGNzĤOz&IWMz+']1MzLM̺{)~νg߼/~OzUxǤOۤNˤ;OӤ;Nä'~en7鶓.tɤL[M[L:5n6k|֩gbymsn;~^8;{{ߠ4+HW?&~'kf]>gmg]:}uymռNb:k͌=_o^Yt͟^椛}7q.\qNym k;2rľuLsV9a_Py 3T^ 8Xኃr@0{x̐<n 6(3(7gdP 3s/ә|~sTy1찆tOvpY Jfw` ołIZFhqZ5"ݪ'NmXy ̐C{hW1?Lw(,:afffz W1Ca>/z O5 5Drr1k`fʸAZeaս; 78f( C?9B!E)Fܷ x$XaWF`}Nz"v<^nh1?j!Fqc =ʘc=;!a%*3DDeW,Cf^bcx9 +' '; WzHxfEف=UpCzG\;C=D XD2V//DFȸK3͟.1x"S9Fy!zQX.(7h>1 .ia>*30/0f`A]a /D0i.@Z9tY8ࡳF!~_ޢ^กSe{=̘!1{?7p.*1#(#p="} +'8!iLdQr7bkX k#zb3BYy -fg3c ̰&xAaIucQO1GPF<|#H ďyx1;ױܐu"Zm?g=2{V/V@4Kr> +k:ˌnߙeFS(C(?8v8Uڌq\ ѡb#\1YTnopz O2Úc0oGs 0C2aNþ "nXOpCE'0#<"=ZcFqsЬBAsBaUx=`mg!ek'~]6F2^pD + (\n.ws{0c&#;f;z9V#۝-Nt=1sD,R> t^ұB 1WkuGX!b:w +~窌)2`~`v`ez#e=Ю qD'z"c v03rC5D=^f?rA!?F]3\zzMcX5DMݳ؁ +#_fpϞ)lwsy y5p 3C;De!#Fk۔p)儑hV-c"NP>Fue8r|9*9kxNdka^刑]X0}"nȼypα31C NcaW!ܜw'(#㉳%=Ic{b~߇c+sଂ;05(S] vP~p 1n]rׄz!iWf +)0'D6H"OWA^I0. q,bCnܐy Ya-3 x\Ba8 /̰u;0?'x +`O%/X0EWmA7`M:Z{ɭa3sgqFn8!"6h5x\A{rKa) QFy = +3X-v k}2C̄ݗ!V>˼e s>Qnp{ף5P)J2o)s{xs8]<7hNQg)\Fynջ(;T);8!b޽Kb/Hq>8< z˽s^{ *ٌ㈈2v<=\F}V> kxa G%zg@!("a-3Yϰk1CO>qC3/d5D!s#NSkl #2 +0;:icn03k /\Lf"2þفAŏ#3VPOg=Yg&C0?<,~o+)YE/7`m7hA?7{ 7D02ce?(C)'G|B2ؠWovFXg9 f6/~ZO[OgkΈfOkPn'zav}7LCn 3pF}1î7f8 {}k3 + .}܌$Z6x֬ }%ǂ'-0 Q'R׿}{ '9C{)'* ~ZXeгgޮrwgh^ Dpܰ1>xa-GC3^2~Gtf؍zx/n! ٜd/+D6x#|K(?0; @^qDb(.e7TY{p 1CupBF!f~H-t {f >ay 2?d=ffp^'z; 738VhH'qsz + YA= zެ?,̂ +z>,DF݆{(3t[yN=8;'[C1? zAEг/WVp4쁃Et~'KU?(;z :w \bv.v0Cn03g},kXO3wr̰2vBEP_rY_3kו!k@!>4O7d݆Skeↈ?1~/ OPD3ί2=utcF8XU vl=Cv(F"do }I5ss֞Na߳'d3B=HGsu rn_69es@YE7~7K&hzi7Sv񿹚sB"fh/^{EpxYY9<|TGCtyK98nXQkXǯkl2sÈװOfVypϰ=o⤘!csP~ĜjtsmxY/x~6YAƝrлM#>X/[ "bGLrL+$X"WMs}c5d#̠)c7z Nè6S[6'y_Ke?$3<^hC6ْ.pšƌ/Y*8ċ˦Upǡ |hv2lBo63 r^Vh1H<0p˼ǝ9a5~rt-]7ΓNf9hVqSd݆ݯB^8fa_YfaM2n3fhuj#>CO"={Cr3{ C X9|pvַzѷ/-|x+Upǡ udn8]g)o@&/+v$Fa6/|(fp륮[8},+Lriwן=eA=*F!6Cm8Ya-/ {g'ٚ5oy {iȘaM1GfhB #hlBst3V`Nb+'}{W!z*q`np9E];YKݻS#݆fg-V8 ^Xw..Cc9[7%K"ρxm8Ɍb͞ p/ځ<ى5;5%U #cP+DN#j֫'@//=8dPN/cL"^z:CZ[ZCKDB}Hi72C = )"/%[pYD-7 + +`7zˤzˬ7!PvPz*7p/Rp'mhh@Y}=8N.lCD^þ7z |] ;rm2 n'=^onhC჈zX1F: ]=ȃ=J"fK`50C #\A93e{ r>G=Gx -_XYo]>mea798nxAt̬=յZlqCGk8Y!kk8Dy X{2+'o8)n<C{L}9x gJ|Ϸ^|?y%|; ُ7N"!Gl 1sB+ޏM&zNϵg-fԓOdrЛK8AY*xfg(he  +ZgQwA[pNLY?ܬl3[ UU/nN$ftH r|0~.3rS`~|SesМbz_4+y Iwy~N ܪYę-cewMD*,v]eFVpLpg]*K(?hn[\ڮɎY{߸O#3 >xYYVzXW8ρ + RpR6P>`F|ZCoaͼeāg GBKd+Y3s.ⅨzXTEv\ws\sg}hҏ}v@fa 7YNr_+7O؁Fwu{_=_?Y9 de^J`}lz >ߵN%g~Mx4m|6 zqgK&WspܠYT8n๣";CKliGL +B+8ifىV>a{'1\i1 c8^5g6eu9@o2f><},𡲰|xU8nx]Y}lYf0N$wYopQ;%-(#(ܓt/ѽ\f?n$uZy[c#2 UÀ3e;_P^`oAfWUߞx0ٲ|;df܀r 1ckA}OB9"c>"=\ f* \=Z^7{cPf<f+0C/70Z0C9]hR\wYt>2룓~裳>R{,9s.ȈߠQ8;v`?">pLp}2K(?r]GZ/{L|<c#gy0#ܬ;|0}#z~&C{B +x>N Λ@^"Pp<\d\1rB + =ħ338^3k( ų|W*z={87\ڛEzfJ߻H Fy!cޟMe;s `GͺfG< +NWmf`naeP^oAse;@o + ?5,9ㆵHkzme + Hz4I0G0CdfQyΟzzkzcVxDp GueWlw{+` +lygJ?7:bhvGNҔ#O@7ϔw[E[xNPVp01D3d}5 p$9?W=/f͟nh12ǰ^n"Y^Ю#BVXI3F`d[<7[rNnCܫ9dW̺SWoDCvm8UD t~;keYǺzck=t2 t /0/-KĬP7e7HzC0{kֲWpbdYg?/%=VF9VxxHݟa!y _G$"^x0rC ip̐c^^7qyxe!7~.ϖMxY<mn@eqv"_X}"q=L707plwڝ9B@2>x0*C\>;DÚz9͠y,eY^Y'1h&Q?G;1V#l/ze%0CvxMdd8ϡ7hqC+PaK?8p޺[9%eH]r2f.bH9hRfY_[yPe2np=QfX EdV ], + ??|>PRh'rz}q=SlCg=tu"<cރ?_OfSe'-r짹c\XϔL2}=>5;cv,6eۍV6YeWzk;c+Ҟ9$ݿ},zɨrp!(\=|1Kˣܽlu\Oe^wcLy w+~ $YK n4eAeK&Ol߯Ǽf*yEKV +ǥY$AghXcCr=I]:߹Y_<73Of38yAYPY!ㆵ̐y kyuu~yү,eaUԟ9E,~ ,v"G![yL.WY8ң>"vh͢]AI;UV2  =C4[yD=.1YUV#~~N!?,-as9> !E2G}.jEQ]Bz; -0/x .Йh}1CǠ̠ T͵q=r 1~֨C<8Wg@Z{#{7,})7C{2F`創XzrK~OEvfIǠ=FDLV "Z#|_ټ_;r7pw`v@סsG?s-v㺽t_;~jw\+:ת0; 8NPoaZDt/lZfP^>2/ǐ_ \B3}Gx}}w +T&Y6?w:Ce?sC4KQo܉Y + ?g([e}i?D'e-\>yUvZq,2^Lc1p1$Ζ^_S}Vq,QVFs, ~`);p!FggȟlNL3Gr⹢GǢlZq=]e兌c2d̐qÈ1CIla2C=8<7xv+# -^@woBeߘ~l|x7߀9LlB;90;`M?_[>lG{ޤ,LtپCLz qA{e8 sxיΕW; =e1|qC!(?=>p]h92߃@=ez<7/e01(3xP\7d2ϔ\y nrWad^B=.I6?Y̯qC;u"G:ʱ9hN9?D}I &v9DYE4q}èǀF<IxǢ8VT{g~!pҞCʺAn)r=KskK0Q7cDqB-x=1t{y=]#fr x aX ~MuR^Sz ]s~g,yG7`>17f) o;~vu- 9*װ?l>"O9Ognd98~z$ǰˬ<=L^?g 8d_9r,09iy}=:fy%}TVi>FѽDgE$~{ V]<"1p&x~P|12 p)|DT /x|g59(7pN`FH a(`?=V?` >gUO'=È ,=6t>u>FS/P#[|ly =r&Q?G|]?أ HCs+z؁?cn2=s=l_2f}IcD\[D1+^p3cec//liWnX X9<tzx!4ㅺ~+?pf!P_3KSdϹ\@{0hp' Lx8S6!ch?Ut##!R>: $1ܫ,C}M1`R=c#I,wq;|znPP |GryuFf+";^3e|?(Cfy+EWmpA![s 9$e7FG9SZ8ư9K=٧8osO3 GYAy!' 3d-^L"ioPp1Y*3 c2 tJ兺.0/B]_Z[`OlP9d7`,E/7d/^qkv\03וeFs78xnMoWN͙ +7R +fHx xGd<[C'z$8[PVgH+K^1S]1D9=Gt~Ig3zN|c+z;#?G; `" }Kt0CNCey 1dzxd^Z^`oY\I"Ч&?: ؿ^wRd3QN_CkK}/>`6Ʋfх^(`1'`}0;P_OuXW؁)o;!}G%keIU=~@'S"h+Q_#|o%~N +- _l/fx3WZ}32î{0 +*'`npۻe{b OQn v`K_s{ ^T}<^7^DzټO[=3U0;0?@ +#^6; 1T6yrʯ&=$s;>pP@?KG(?0;CfsupyZvqzBYNp_ǎ)xLԩk"NrQS3V\pz +WXgG +=2z _`ftT Į3n [+ %OIrg ؿp`F܀9^qe]\l^Jz8cYwt"ଂ}0'ck8<9+{>cLB}>q+`5 +|wM+Εv!b>n׵1D4cęwjB}Q(Y,Q$2_{&'B/+8nh1CO.e*7D^ 3 %2u82#TV^GP *e 7q ؿ^;f]q~kv#΁|=;ΖeLgIZpׂz8w#{Ag*s`v`=Y x uMPW7G=/[`V8_{@$#{p9C=V37=pvb?h' 8%B+''QOv/"1#M-V`^`x\f%xakw/bpc!?\y IdhFU:#p3? wC6 o(qߋ?~ )WG+f,5N>qky4/Rl*Δ5q 7L<e' {pM'r_ x <+x + ~,N\6'D':|>v4e!#03sE=3Q47l+YWqDˋPO Of7e(2toͲx3נQfpw-{ Y&uF:/st/pA߿P~Pv`ndɹ3K<ab tٲG]K&pl2f,?!0E"UrC=x `ų½y9 dv1d8F1q1+T&ղץ}_-쀾f4d]_z؁n=~۝-23%>&W(.;=;P(YE# u-7:kD #E^C/3h.1`.{jdupA Kp==FDaإ\^`o}f5Å7 ܋䮸Θ9vpADg Uڲ x/- +8bV^@&cW\Qx //2 %ef_/ گM?8!0$Cԓ~2D13E? iyF81ΎdX#^DšT~#ODЛKDDz/H7Dc']%}ly L"0Zuy +ސ򃲃?,7D{77pߋ{:s.ηuC`|lY9 qh?d8p" 7.KAفuo` W%?o1ߚ|eY+ccнP/(+0#fY无1G8~]Iu4cޒ8vxFs oֈ!#K')_#uJMPSN| +j0KّȋzF_0Aa rbV.=CzuUܐu0o1Lp]g˒Khy HaX +/俙F ٞOP&]wkv8q@YoYo >ܼH"@a-7{ρbV@yA{:+Vx |rϿG0"Kĺlw ZAqCKKD慭{{078u3:/\Bg%cpsL; u:JzV^X/HF3;l'3n&UDymtށ3{fz۬'cnpC4s:}xA{-vDQ+_;crt,reQ.^+0#nپ< WP~"cx>3,C=~"KE~ٲ be Vko$9(W-V'H6bPp\;( i`fȺ 1XV frV Opa-3]%f%ZIDDà{0<%xBH!rf0[܀^Χ+5k&yXC]?P>xZݳc>z*qpHݿA}BNnnxH͏uG1JtQA3 -W>}ykܕ>?<# ϖycu**}K%@4WQẊYOcM}˱C503h Y.Y.Pټ/rCOpa]%}~ pznN"$z:y{ +`B>9nqS`ƌbz5wX1A=;/}0?hiqrw#$ׯ(4hy :_zBYJ>_kx9ǥ^-`?d젙w1ya3`Po<9t9+C]rDgFr}oKuqٞn0u6t;*(0#D|pn~-?@8^x^㸁 FPЍTv/e#f+]yWbǢ\&t4?.5C8VZCԕ\nɈ"uǔch.+^c@)3{b q'sꩁ"Pv7 Wl2 ;Aea*Z: kg&^V Kk{ #tl^Dv0#/69~`n;)F +Zyukw"q@~p~_S{f7{x[yT=d-nTע5^誒G22 d1>-q߻ic8_A#/6F*ePB\!JK?i3MpߛPs(>)=}^<?D p,QuzQ8PnPfpsepD1^ :nNA9x/'0 x707ԵI7TvP/<%=$2>⸬78^w9c10GJ 2'WSe^}ITvx"|&38W69P4GzkyOR\D!"bme#Yb:V!E,qC52%fc9-Uq +s=0&0?ˀ\̀[Niy z C -V+sPn0Yn 7ҙ59Sҏ=Cj8hqC]:Uר617`-+7TvPy3GGY硝C]+1`rmcP^cPyYO=cYR/vŲyO z.?g1mweldDa2g#Yb:>qC2rǠpk|cxv2 ?u.~ k<ttN3 v3fg^+0'_{iپ_,ف;QA48\y1;\WG;4fZ^c(kd N2bEst^}֬g! YA+#^`op0pޚO8zb8Wsz̹ǐIp&^ );oMfΖ]nm-w 0><.#:rC]"n9,rC=LYAszW q #p|wJ=.cl{ kǀ1g$1ȼ^Q&%p qA=8~'>·ϩc fw0zW5%h1E6%a؋έU_1Bف} OdeJx a30+l'AӠ̠3.CKp1;F=(9 axAY?6>oPnଂ=V>G^ 8>Z>:.c}~wGx?1c?+=cLt'p[y /28yлEJaЎF·am~z܅`Y` ;070 \cP^=T6;N|o9<Dž ̠3 7(3p.G-AnҹJ0hAy9vPa7zY9Wk[ڈ׵L,10|l~-?9.觍xG̳"98nPר>ug" ز}ǔ{ 'T^L9IiMGJǐ1v/ql(;DC/?8psqGDpNI]F43]8[=Uw`nPuxR:cLj[/\63}}tkPf^ y>ГKc|^ǐy ʦǐu -8NY?$7OqPA]=EXZb6P>#|O~^/ m<+ i:U?s:ng07,A=ǕA2k6/ <ᄬYǵ[`VE.==8~B?yUh}0P Q%94SaٻI'xt},\> e\\&pҾO nv/3D\.ӻf+3aC8Fr> u=sirl m܅= 2WCD,<:j]dlҚar,fΕM?uΖ~t#vؚØγϛv׀| uWVyA9&˲?hvyǝ >5x8UqR.Q6q2lfD"/p^8=f`ε nЌ܃aeyAYX,f7 AF́׿2YfGD5>x Q&v(b}rC]ay-vYT?p|r~p)~ 7󨛥hu"wsCc} YD}x xAehL11`R?XX-3 #"^`&r 젽 3CaD D)[D]ֱb.Oq1/Pg7{zN\ kNcܟJ\.{ K `p!kp8D5GU_ԭYkrcLu(8X VUbzr fC#;a{S8n@u}seR{ ډtPzg~G<,P; )rv뺞us^l{"z!b#K0O\ /bL1E f!?p~=l^C Qpf`ːǠp=܃OhNp +f`Oޙ\y .P^P.ϢvX l_+Fs\=?-ڦAEm1_{ϗ^ W? mpEԉqR\CgΔUyẲsWfG|YQݱxx5*C0?x="`B9BL+S0WDrF/⒞'N[rj 39Ke{r9`(8p)*tȌl_#\;D}(p9">`[Չ2dpE t"nzpVv?ux /8^@&tR; :=](loV>yg_CZCA8PX+_D~\K"\3b_B{.e; @WR=7D^A!2>NcpxU,(k8]6> Y/n,^9A,WuBʸ -뜻6Xw!q5GD8w`A9mpMY݆0OYų&?YV 8 {cpK_"^cp"N#zaMvqx~<epq-"hI9$c5OD=lΉJ/;ڕ<[2f6`Vs >F+3uQ8\c nf"% }[Ak,fCDei[bµHGJ=q4O3ζhcP^hB;pV)"qÅn7Y_t=r!]_3:R(7p/kf)fډtPXAVUegmVx^$"coM1;\(ㅿ6N"T8±+[DREL儭y;ʼ-Zܕsଂẕ׀kfxQ!c28+Le<+pl:s=hޒ;XISwaQfph1JD#Qܰ&=3=k* ::몾^kupXЉ\Qhg)ysP~SYyL=1p}}?c1p& +c;CT8±3;2eH=>_`hu{م=w%y΂g49GxU冯; {AQ.10/ܒ5;7 5df.N +k`fzJ˰ǐBFf"4qANZءan9n9L(\!됲dUmVyA3V}w=Gڟ>b!.m`P`plqF.$e +QoY!z؁*3( Nz=O< x}ӵOr{7zGf'2(z ډdn{+[Y>/^Q,uxsù9t5>αzǎ!?Nc>#PP±EU/5"㈨sy-v@fYB=UpODK0gyykzw QTA.@QeAOyA$I8nx 1%\_{xA?j1ICGd,<"c"a/Y?tւ,8pCUd܀c3 +pMgtЃl1Yv\1fCkn;hFO%:  uvBgģ}kf^z<^^hCz:sPvh͎x-pAGJ"ux(6,ٲ U0;[Y>c]4hy G{>c9LZ [FKQGt{a+s7s""ql5AA"8dI=3p} `A,fkV^P$3N̗fX"ә/]!F<ЛBɹ@׬:NXxRny +DrQdpY7M~xY>Oz|!C&JyV=P}!>:Ag$"^PH-XY2!2X1ENsda)ܬH4C;9Ş8ȸHShF^`cv1̠{3h12 n:3e;hFἆ%'NCei@=n7;Q^ck뙵< fᅌF!*2ϡwɸ ZZf,zCmGF][tO^R$2===zd>x -^p\uzb>D-hqEc?2ϲO?8v2 +;89pù݋B}D1p؃,n3N #fN`ޛg& f@!}ǐXዠve5 ^CO}\=H4D/dZP̰Z9d{d.>N5'[zZWt}k707ewЛ9@^RV8[⇬Ff܏"9eO* fCf̀Ztfbˠcx gftrg5 @R \NC'jOwЃN ,cefX[kY/3*2vp}Xfr< >Efsvgp,K)+:^x}Y$I1ٓ3c]G9b-?d eΏp<1E-cGFM׽2EQ^u_Xax7<wQ88iPf f̠9iu\18a[yPdV Q׀|]H'0s|eti@ڣ#Y5_ =;vk1.GZz~x nC+2Y匂S|7Oy١[ΖMVU^˦ǀO=Vbc8{Ǒ #2ȸb5z4#OE{@iGe7Xy +6pF^8^72f&1dVhz]n;07pF^v!{ 4U5o ^,feVVѓWΊz[6kv3xM mЌd4 2 +8nzyf\ÀL{=>Vxc%a]?pD\+o:Z |zܑtYE v/mP\C-f>Cv5S%Dϟes7pF^BFQ>'z: =̜oںֲ/s֬X:Лj'eL ډ(YFnw"k";0?҈Y>WU,s$1y ` eR&_1.!F8"Q.!\Vq)Η=!x֮3C=&уD3Lbf#`2=Æ0¡3@9TnЌB Oh>\uOρ4 {ofֶ7a^5:Vq<] .},:9h bρ!k&/[; y G#}9tC//[= &eQ5+xbͱI|7sQF't. +3bzάά]XFz />^˭H(kDq!ڧamau-e}ik{5_`Wo猸BY!(ЇԌk(mp3޸>an\YEUe'fS*/`B]nq}͑p}{g\cp}[7CX"'{rHk"^ Q]+3TL9:W3$?j'J$PXysgf%ܠE5辐Bfij'{OԵNi`uMSi3亶ϡkS៶"^x 6S?CpF{6pFts@^vp[,݅7Gt8cc`uGB=Zu1D-e^9zQ/I[q`n9cmp^^F3Qm^ MT߽f :^oWe\cf^8:nAr݆kDԅtw'f.g5CQtY]ԭEn˲f|ҳg2 +]kaS?90;Tx yo.Kye۩WF_]Qbnc9FY$a CS$wrDF9Dȼe >3ho3LkfG]\=7x9Nbn;TnntP'OOp>=D]ӀkխozM CϜXfоQE:J;֞ Z\ Ʋ*p›f¹I<E]#EI>!c#zXb)N;zYkX ڋO`6 O Ͻ}kkWke3uڗ'֢u4h!=\F݆y9xKHo"@g=u8rv# vۍө!Z).wD14ȼQڅdAjJYj>ee3Us}?W9: /u_y~W +ڗ': QA3 +8ulpy(_(7ߠ|' +xe;F2 z=OQd}.+Gd e,>n0 5 3~mPq`z\g&xe(G^KK>ױ¤WM?;pFnC5|z Y,B)K2' YW'[F|9 \Q+6G>/t_0r A2 +#*d{6T~u݆sv_GD2 xuecpq/Nzb%N/va!:f[m/Wy .B 3TmqE3[]rt ^kgg,Gr Zpcsh(m`rF' Yz7Nח=8uO3kYZI5(Z\F\Dk^`L /C=w?8W+,J Is{ ׭e~慓1p>xcvzk|'zj3h6Qm QU+3pK#\\qr^Ay᳡0A 5TnP8.$jPΔͽOjc]'$Sٚ{VǞy ' #C;=:Z=?+[\N Q\(.u _A1+, 0LtrZ!;:)~a,qc!6㆞NRen/PY5-@֌2C~qٞ@e8%ʑ_ϱ\r]< xf/$^!5נ]' %{5|BntտO2FX^.̰avQDڳEГQ8!ݺ݆7u=B}>) 02 t"!)q+ %.[Qv(N҅ _?if2fd \U^Vf8[z[]\uWK C/|¡$f 5pF5辐_ZۅԽ]ttO2طI_:~Ne5E=φmq'q}b\sB}>_x$~,GޏaCKDc/!va}1Q~pnX;7uu̠s`z][^Vf9˚^#ke2lXpKz QcbIU5ϟ 5pFv!PϚ}! y Q^ϋ}Bb!d}Ú\b~C5˚>dQ0?D*7`'U6Y>/hL]_7WB{ ڑpǖpR/~ؕ!nh؅u̶<5|Yzׯ53׳j3uR.֌e9:sk.:{u;zo y 7Xf9vPn`۰gBYk>"Bbz0k8Sl]{Pغf{P\}E7EY[Nccn~}b8tpp&|=1#/=| '.Lu`h;\ܛ!?k`tt_3esRs Kz =>x 5[!^L+wנs?UhaNb]wyx >F>=V vk/G̠{:)3d3e;2s /%j>Ne>j.Qyz 7==j+Ln2KAp45.^ã ]׀˖ҷǓ5~ҙװfokCzf/{k0Oe -xJVs lQ֫K ^n C!"8@$yGpu'D Mad +10\0 "QA uVsoWw9}WuDRZ_RY_RԿ-}]_KP)~.~+~OzS)s~, ~*Kw3՛KToWUQW -Q=Dj~ŨeQo~i*\>~a*\3vp ,)\[u_KZ_.S.KR?Pi}M5k;JR-KזR_^KK}aWRRg+BO/l?YO#>,uKJ}d[JRR귔ͥ~cza.޽ԻzR-Nޡԯ+jRzzJ=SJ=K=KmǕzlL%|O8ՓJ=SJ=Խ+RJ=izoo_K=gz￾Jo/g{%g>ԟ.ɥ|(J}fQoO7+KR__i>ޢ.~/%&zuwN#K\NqzZk\譑KuPjEHC=zCa5k Sr-REh}aMµuh6WQ_GkLF}_3ۯޫ{GJRoͽ.& ھ?~6G7c`CE72wJfõaOq}:{-ZGp}{럖'Yރ>{&QثnRRϔR.q@JRQwPZZGb_}ZoG0+LZ`w'O`c^x ;X4ޯR~{5}Fo>Ï>?Nk.9Z JR-J%+3_X+Nb#u\;YZsO\kbv]75pkO{~}T+7`µuJ䇨^)o]^xkzϣ5{*13Ҝ{5sZ Si}}zl(ߟpo{ !W`r<~Y/. =؃aOjH\uZOb>Vj ؏/{uMcx,VVTp?i Wæϊ|)4_kRksi 庘_=n3f*=5vG5zq-\cS >pmbΚ^ENkm·Q =CO/K$h}0Cq֘OfzܛK=)[`GK9}Qc?ƀ1%/!5 _&ػZ,}A#'fxT;HnZiYZZçR^kBkkuNր(5zs}=0F랞Gaqg,n:5fV6`i 4}o!j=Qci'<_W2O^f^2C%g K@f_Y95K๗}O/?//ai %/5%O9{ +Uc젙!5r -ZCk\;Z8ɬ5Ga_!Ql$j=Z^jm𸁟mV17ІX[0xIc80G 2/q җK|>m| <Dz/2Z?/GksRc3ؗJ==j^x P Gql3Wkr Ȑxϙ~w5b#ts=G1=_ci 4+\Vei<$k ^ὩMkAZX>Fkrh XkuZk 2ys=>9Z\*5n'MyFO:`qkñf"$C_ixI{ D[{1ג0Z ڗX/3Z?_8} S-}NfYcd>V5Z˱KAf y3 +5HBޕi `5Kkہրlʃ˦9WFk齌<޲9^LqLг6e{yN|p kh$C_{O)yAf%/x[4Z{}CW ,釖 ~ dg#/}>b(Zk >ƀg0@@/4 .6`oӮG1g^C5Oj `Zk@fZC{5U^<$NKkE6ya:7DLSCs\d&Rs?p&{;0?H-f7І8h-OmUcwZXjzOr|odw>j_}<ݙ wd>Bc3rK.g8QNcy./L̀ <)ϣ`~5x 箵  VC3S볽ŨۍZǣX*6VYȈفz߷X;i?ykO5}d^{odx=WcG%,Ad> j }de4Rk }3lhcj7`[`QZsA!FvQCφ(h ?}Rk*k ,ңZm֣Vn8v5S+y:iq_Ux B{ֵ'ai җ1axLhr1ʞNż|'ޠg6G~不5 B>d>|<_Lci[k9OܤyjCz̵T>a_j4r7ȌsdVA^SZ3 ړٚrgu}v0'Zi ʬ:[1 ԯ1lJ1zמ o5ibU6ZÇNGFkh zȞd^!kŨ>  UKRzl r{<~;h[S^k rB/xD6pb J1ϣ1Ij ݵƀ^9Zc`_اM&^(UㅷRHU[0e$j{)<^DҬ5Z5|4mLi+yFgQCQxQ^Y6v;3hnGaej 7hA^INXፔ+y #+O3j L(όeDvxaGLƇ|a7ְZσ{9GkocgJL2= +oyX_pNg܆ sצkk֠.e"#nКf^}( +ڋ~J VQoړhNsFZ9;_:[b9g4.Jh zNtcHi ] z*Zk Һ!Gyg=e[Oei  ]8f[(Xk͔geg{/<ŃTG6\*yUXa$7cs n4$Cz#msfR6/ CV;p\a_p{GKcܣLl?XcN,/X^:>1qg#ﱬys7isٕ;s%cvF|/4#flQkcϮ={ 7++YcsDVcм0]O.7&ym`BfK\GqNmdldkun5 ;h~ 6'H]AB//,{<1qG=~ߨ$+Id=Bc^ +=bGob{#HԪ1$vXv :YأOy[ZCC|HQ Y{< +RgdeO&Kq~fhxs!b~gRS`i xan:=xUk0JIM7s;8==fz+M1XCRj U}elP(<佁G9޹T6\·3أ~{z_J꿌 znèLd֛uSa֐$nf~9b Zya'q'/xsjhv-$,O›x6D{ƠsMpּ 5M'Ox( nr(5*"v*ײt +KIc5?LZDk10d*$ؓIHOšA\ʓZ3ݢZ47(y9Nf 3)L$s`z`9v< +C?xaVV)3t̵O^8n=zֿ +3 UB^ ݚϓ-g7E}GR ;x-3z(< QxdpE6XȨ"ۃyNun 'nȭ!7x?֛TiVh 'fX:c慨Gy>|F9 ^ >O6i',4/ ܐ( _Zgأ3L ++Rܢz>7g?Vb 7`ZgTiNi #yIz^_9x#ae#b=0D}ЯcgΓxZ=&^Gy}iyVT6֙V&ҚqՃ9d]?+ܹ4ڥAC-dk ++⅑3, -K,/̣+X`eJٲ2$tDIư,ϓ8uJrH~%PI0zC3/Z6tQy6j{F${dm7XgRyO2 nLKa`27̧ۙC27Dd?:'X`i '^z0Z'/D3Zg :ϒ ^0xxݤϬsR*f 叻şŜ>G!̮_Z_Js|&Es" ^ +kvCvyq/7ȌÉ毵Q/KstCdK¾y  Xj3G0x<~}ik5ZUJ^Γ CCz&/'dA_죨G6Hms m2DFLݐᆌOopC"g;fvXb} 幡9D`Ckg8q(/"36a4/@e^z$Y:gOYGkCKEdqm''1l>4sR`qX Pz3kEtfvO6n& e"HK!{)j=#{72YvH=^c<tQ%}/à*3zY 43@@6fݪ6xgRDHpg"e// n^,7@[qw(nz*Z2{!a?8"*m }y=Y  } #eC̣70UjOГ\ľ1x0"vh6d(3Lrn;mD9^/Eԃܠg7fL)pz0'y ^Ũd;2Ck8 +;[ X<^Zxg0dxATz=БG/ؚa`^Oyœf1P/௠fpa(~(j5Rg H9'RR{0%7Ozn& =K{#١uoiKqC<~ȰD +sx1,î#Ed{)%/>e4a//]yz#! ܩSHp1y2 9 IlUb'1ퟗôID5B3zm_FgRp&[puDjnL$RB`y(nrCԋeFx-90ZృYYN +'^؏"t'^7/yA` }y1#eəGd :`2 9qi?|Դ?>r/zOZWcXc//dGQlC˙ḧ́`TDJn^ +˛4s-➊9w;D﭅Z!^Saĵ +-9ǖ ];۱ |^3 S ym2/d60L{ړs*p1X 4@chdO1ңh9v&E&L7=e&{0Q܀Er' pcn%U,s84;pC+;!-pⅫ +7y{#2pv5BG}N%TJ^=Zug[iz'^xFkMR 5^kG!ab/3Df{)47 xd,7Xs5nf8WqNv6*Z*j{ѡa47DKq’p;¨khњs]/لt/%4Rx<慗6/ G"=1y$Vk]\“/ $33/ϠJ3A%,;0o5p!-ݝ5#27z)47󬬙O <+r473P며2#*2Uz5~D׈Ksx8X'ED xV z^o,y:w +=G"۴Zצi/HOym 5f^zRoX6d [wn327^ks1 ޜi "nԟqhGޮCa4?9p'¨륕z.d-: 5/X3j=xΔ=ܦ[5=2/Ba$43 +;d^3tpΌȻ6XgR3f7\l4sp_h ^L~Nm%4v8~0C20#Zv}0^ K.XYGyod g rƣ<6!#Ϫx=3 et_eJcм0}Gqlې$Af"/D Q rV\nS9ڸ Ϙpո!8U9,7,*FƇVaƇh-xBhh/|3yA9(S鑸Z I <-Pc7f^JW7͈|jףZK{03 gE}#pݢ^Lܧ ٌ9m{X/jУ9d$G Yn?dXGWj =Z[( hy<^}AτnSI#1=>{zN+0tU:vz"2/ nH0ÎprنLE/Y {)Ғysax!f%gn0W57ྲf8l</yQ>қբ9}WRzu,+-B&"x V/2< /h/D=GbDaV_Vf!ن8" Ldb0 $7O ʴpu>4jep3 HpC&UF~81pj Z8a ׇf?G3x3 KBm&̦$/H<\c/1Co!;勺b nN`OZ/Fʌ>d4(+d:{ s59B4k'Paet13{^ <yAx|~#/s$H,a{ LD {ZlC"5g[͘rK?↛p=V6Rfjs47P-CmC":f?rP띜Cz(Y[3j^xA]:F³w ^.<,/Xx/葘;!쓰z-=n0y37L?;Q̝/mRX=%A΋ᓦ Oߤ]n=2io3r[{V>Z`V~{9aIV:`y Z[9G-x]^/ Ȃ!l2bȊs*{Αyf9CЋa nXmΣ{>"3!=;| N/{ܐ}heUOFhN +BZfܧm9Z3ً.YG |wȥYI^3Z{*k02h2g/f `T>W3HrCo/E4vZEJnΧ=nTd2^?fVsrZs`v`YPYgѫ=lq\s8WSMasڞ-Xڂu~u֋uz# /B) dTaٽ=aZ (7d3==5nx6q7/Rrop憨2WgN根GsskaKsU +/^0=rB +Boʛ{{$xԼ3^>u=ܠyda7Lhn|9ڸ %7XlqhTzOa4C%SL9-*X[`V2^n!-M/›Ӕ:Z7h3 Z\e< g?~l8Xs +9*9xt_+t9z|^?2D/G'FR#EQi +|σe_Y"[ڂت-ȜѤ"؋s:zF  +҇H[gKYB]u_Eȹ 2P:F^}a 43dx̀n7Ys{0[ϦXpzNܠ{1kHkSͫ3|>Jj3$kd֡>e1'[3-2WΑʰBڂ 9✣^ges^J=+si}}:jqTp6 g#`yWGjA΁Wܢm:D9,;|bVW,U-?[Y0B/'j += +Vc!2s".謣g5I^ yǡ +S at_e6Դ Ч(?SJޡ;.7df8ԲV!*p +/뀧9XWxL,;d0#zYb1=~~ke 'bw,|m29F^죔stv`eeoD֚/ֽG "/3xn0^)\$ pz1TD* ٘ګg@|$ϝ90;xV!X?-v@e2o]DCLD,}KrB)DY9`BXȇj 'cay܅(^u{)wx^`^x>Ϻw^yatQcxD^BT.!żNnH/* (/iixzC֯e"v< "b$?a#"D/WCe~賱>ˈ2Z5 +z.ChmAJ[+,/"]z#gHG e24yX 7D? +7x hdnO l쩐TD* W3p|d9xү}_efZfZbGX)Q߷3zYa9@XAfAg>5o-Դ9꾈RzVv:~VRDY6,dRm9&ϋAgLLMHVv!:j^g9c1fj,7E Z ެld&P*xǏe$#فz&'ey,b?h+^"FhyZS +{!|cBg,njgQz9GEԲ !yjX{5/lG -SfEyAWΉtr yW܀sCmCK6:mgUླ*9W2iVog$YsO[C-'iXDz-,v\CèCD,Q^Xy&-jH]c(ߘ!tƑЫ-MY/B].H^͂/poD|ǃۅpxzfLjٌ 1Wg@9WYA<!e$k~E"š UBF[3d_"d`{;YG:,/4zxA3ñH??zn(?hUDtOE6^})Ϲ<9C2+(ua9ߡշPٴa.CDa '2\s+~X^Q (z=_+dYLJ}>7oMa] LƼ5YSԹSp,sZ{0E^›y Gcn Ŭe#s,!{V>RjܓiiBΐ ++v\I[XsjE" CrD5# x\ ^F^MALVf"B!ϕ==R[A9Gh-x^u.YGZ?]<8/'^}- ;ʏ/9'UxH'SjVo!3_e< A)yI9[-|\N +ǷX!Y!Znm(X닰0@g7"K9|a0;饰jpa7U/YWa#qr>29yx:ae$-A^֡ųLȷQ ZtYxb[Fke5D\09yx`!W0;_}X3\I+i^<~1D+Ghx"_,Y <-A"NXAs)HAm<^V!#{8Yΰ^] Bkop^X zyNy.@ܐFdZ9!3_+d֡d`-䜇(5X )jl=W@Ai Nj +p6gFc+ș +҇I3QO-`ȋh.zM3ٜ 㰼c/B`C 7hv`b k*z5do ڞ!ie$_~>k)TyE0, 1$C<-"OxLQc%*z@Aji s UํYV8ju}=o-Zk4y^Ouv`07p׌^7ʟ-e"BU<}nEW2o2'Ycg!;` Zje"AZO0D#Es9Ȍ Hz;x9Ig;`dvо=܃ה ?XD!`|>q[Zαŋ.hF̙8뼩/}- v aWUd4֜՗)WhvY,;xYI=Wv3ڷ]xD!Z8BD'lfy'X}=އg8{&G5YCd}ln!-MA9VuL͂ ^~ k|bP5XqC3W+jYV!dEtUtVXBD[XeU!@rh@#x:f 5N/hW +2CxlODF[`//⎶@ut4/z)Op<#(pqqCKaWH'9WC+;x=z&y8m=HBl!! GX,Q +,c~gH !s9Az)HAYLK }Vm!꡴?˜A/kvaf5Y9~<^^G [Cy{9fj^(a_1ͨע=XޅMF "4GD,d +_DS׷ "6#hFh ^>!=x9)xYknc|#ӹ0J[h"Xa*# G ׸מ٫ 9.7xWѣ9Ȝ5ϡWQ^RAz:0P5GD,yB2/*&@r0x|i5Fh YN{8#[S*Xs{YY!S>i 2xRPxCya5ӏмp#{ѧHsCy[7D^ž4+˯:aoKz= ]D`,~4!,-Bs.!y +/<)kkZ56| 5kh '| i +WR2gh[Ci ./6+iJe`꜠{"MA:σz&[Y7BG9q y.XE5x_8Koh9G{|!^E:LꭰfH2Pe++JF٫y|.2?)7{BGXzD'Pr6Bf޲~J1h@A0',(KMA:{ |/eo"CD2@+z6Β. Tx{҉5gS&Kv(o/ },n4(#g: +/ sǢJv[^H{s&#~Or8BaSHla1.:Ko 4H #d<+ 'D9rzS^h΂Yf-X>7˱'"~޺Ҽp;u ف!;w:[e$=uNhaݣAf<"V~I Y4 KxLB-T"7P #Դ3>ktnҚ,M(ȬLiwRe|m+H/=+=/^ʰ "UaSC^E'3sFۚC_#AΆAv^-`4?p!ygAD:",XB[}תM3_jy-{$9KS`AfdQm=!YABxFY|(أ-M@>Ų Y^{ˉk7% [^>5/3_QcNm {4\I//ɾo4?p AH #᱄ +4[HХy#SS 4d q,g4zރ)x*ܠ͌goB/+XF +8zYTR[Z[Yz{)OpW!ln(voY5a_ђu9Ɉ %gR[˷9'X{4Y +2fo&dYh!FLV=Njja +;@1;,9̑AɬIZP,MfX̃-EK9FKO{i +{ #XAk^;@hZ#W>"}Ky{zFRʿ+4FssWxY%؁gCa Zڷ{=?pai= q5"L!B/\/ #ds9FKO`y)hAzn +`ez}ȰBfc5@hYaxW7? pM@0Rs͐2`$ϕڇ5PZ_Gn흇dU.(Q !$A@aVD9g]sBQTAY$"DA/~v׫43:;3{vutݚ_ULD_a}u7Yb}]Xg#֏Y?e }_goYcYd=ϬXY`i3gYe=yߣ^`%?^fb+֫Q^z#ͨGwwsI-H7W=:o/Kb {||˳uz:nOQj^y@ _7 yB!ߐwȿPK'E"/볬O>źu.'Xgd(V-nbȺ!ֵkXWd]uŬXg`ce:A٬Xg`:֩SX'Gz?}Q'N:u\ԱQD7=QG's|#.CصkAIw^hϞ= qd^[{Q37 x8)6:JhtVIg)tp<1 +g(]cgӢpqqQP PPP#P+P7P?PG.\JMAAt5jjjԴPSP6}~ZUjj7ߦ.NfPBM=9WÃY~Brd, +Q畞Tf$#$>O P' o' W/ y;@M>"/S+#ߟ&?IMMY0Χd_ +88}YABb 6%VмYjX +l /n0)vnPbt%;$O쐸AC 7#Po$;wRS+Q3Q;QCQKQS;=j.ޣ=jP^uh~9"%/"qDbsyB2 +Zow$ 4H@0£ԝ)$N@$N=)yEc +88as)YVBjXѽ5Ry0/PWs *!sf?|1B-'$Fxq= R<)X5y|Gރ+\|s=!V Ya>DFH@}ެ@0UXRQ}ءsӯP4;jYbԸ}P;lRS3Q;;X} Pϓ}/Q9^GXBd +-,"ZOrf_x |B ')9)XkVyI9O'Vg'V[ +V,Cͬ@ +xV F^ 9!9CfQҬCwrA-!=xi?x= ˏXBd +_hQcǗKrfa\  y +LfjYWyC,x!1C0Hy  +B]c/ƞs(y]fJ`IJv@,jy} of2=ޅ5;9?ҋIx<⋡֏@Ad 3BP`(XޜirVaJV ѵ[2x!3 4/99(E +v9 ja(;f&v@-A<-jok+Cx^#4KHLBYו+Pcq{󌖧䮤UsCXc]jok +UBs A",^s 4!/1G&nyC)SܵrA[I{;d"QOH\!Y{JIsid/#ރܑ<f\&v ibLVhBp93CiB+Ko?_\z G7m +a}j'Fb3ˁ2`ØzSCnšy} =w>t(qf '4SHzkǒ#=7h65^B 'xBSFk_ N^ׄkYװf]źu2֥KX.b]Ⱥu><k/ܨ/f:uti,Zk +Q V:>jQ[dx!Vg +^H%71ї$Zϡ^~Pv;%b;^Q{.A0XBdJ_z< <>KJޓ%V@^.YyW?ĺu= p]hxA+ +^ȱ’XVxİ EuL8 bn!|Tjsxaf9ƈ!^u1s4;$׳zB=X`.f!Cx!Y +,y?-k?@{rf117zz +C5+`x;6ւXnf%V1Ѕ\o!y-$^Xz ! a +NMpVa3/̱]$eI@8;PCb9twAKz3};A0J Q%,آVuca~rr3䬂 +| mV5 +[Xa ,^8Zj'"d" ^WXa93r9JrNfr w4s4yC_⇜a1KHzxYו#x^; ֬ޕ\{YfŪex -Xufpjh{ 'ʹ[/P]! +`͠84#حp2C3xAPS_/;xC}JC~҃%4OHzBǐ@{P}[eND^fPVyaܥ-p}!!Em BcXskӒD _gZ;h*x!tdUst tޫAԈܐ!q$7Xֹuk»u/j9QwWwy51Cm9N(*L +5s %oׂ1or !_S㰎\~>E=ȭ\,~"jXEx3[ c$ c1^MsQ s ApChEW٥@{FЧG1t. Zv`1D Kx_ZVr35?$r! %a+w*'Bhs,{ l55$n >& C!5gؼ`GL1;c8ւz s>M3iaYȽ;3Br>;}!=-4`7L ]A>7O9cg1CʩfwBGn {&|f +cs \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/Animeware/logonewnobg.pdn b/src/minecraft/assets/minecraft/Animeware/logonewnobg.pdn new file mode 100644 index 0000000..e9505e3 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/logonewnobg.pdn differ diff --git a/src/minecraft/assets/minecraft/Animeware/logonobg.png b/src/minecraft/assets/minecraft/Animeware/logonobg.png new file mode 100644 index 0000000..09320d6 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/logonobg.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/nightskyblack.png b/src/minecraft/assets/minecraft/Animeware/nightskyblack.png new file mode 100644 index 0000000..2695b78 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/nightskyblack.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/nightskynobg.png b/src/minecraft/assets/minecraft/Animeware/nightskynobg.png new file mode 100644 index 0000000..839575d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/nightskynobg.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/nightskyowner.png b/src/minecraft/assets/minecraft/Animeware/nightskyowner.png new file mode 100644 index 0000000..652d697 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/nightskyowner.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/nightskystaff.png b/src/minecraft/assets/minecraft/Animeware/nightskystaff.png new file mode 100644 index 0000000..f22b267 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/nightskystaff.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/nightskytext.pdn b/src/minecraft/assets/minecraft/Animeware/nightskytext.pdn new file mode 100644 index 0000000..6b0eb33 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/nightskytext.pdn differ diff --git a/src/minecraft/assets/minecraft/Animeware/nightskytext.png b/src/minecraft/assets/minecraft/Animeware/nightskytext.png new file mode 100644 index 0000000..6dba4df Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/nightskytext.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/nightskywhite.png b/src/minecraft/assets/minecraft/Animeware/nightskywhite.png new file mode 100644 index 0000000..7624d71 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/nightskywhite.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/nightskywhitebig.png b/src/minecraft/assets/minecraft/Animeware/nightskywhitebig.png new file mode 100644 index 0000000..6298b32 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/nightskywhitebig.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/nightskywhiteold (2).png b/src/minecraft/assets/minecraft/Animeware/nightskywhiteold (2).png new file mode 100644 index 0000000..0c0f37a Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/nightskywhiteold (2).png differ diff --git a/src/minecraft/assets/minecraft/Animeware/nightskywhiteold.png b/src/minecraft/assets/minecraft/Animeware/nightskywhiteold.png new file mode 100644 index 0000000..69b7111 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/nightskywhiteold.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/nightskyyt.png b/src/minecraft/assets/minecraft/Animeware/nightskyyt.png new file mode 100644 index 0000000..a2d5f4b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/nightskyyt.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/old_blur.json b/src/minecraft/assets/minecraft/Animeware/old_blur.json new file mode 100644 index 0000000..cee54f4 --- /dev/null +++ b/src/minecraft/assets/minecraft/Animeware/old_blur.json @@ -0,0 +1,87 @@ +{ + "targets": [ + "swap" + ], + "passes": [ + { + "name": "blur", + "intarget": "minecraft:main", + "outtarget": "swap", + "uniforms": [ + { + "name": "BlurDir", + "values": [ + 1.0, + 0.0 + ] + }, + { + "name": "Radius", + "values": [ + 5.0 + ] + } + ] + }, + { + "name": "blur", + "intarget": "swap", + "outtarget": "minecraft:main", + "uniforms": [ + { + "name": "BlurDir", + "values": [ + 0.0, + 1.0 + ] + }, + { + "name": "Radius", + "values": [ + 5.0 + ] + } + ] + }, + { + "name": "blur", + "intarget": "swap", + "outtarget": "minecraft:main", + "uniforms": [ + { + "name": "BlurDir", + "values": [ + -1.0, + 0.0 + ] + }, + { + "name": "Radius", + "values": [ + 5.0 + ] + } + ] + }, + { + "name": "blur", + "intarget": "swap", + "outtarget": "minecraft:main", + "uniforms": [ + { + "name": "BlurDir", + "values": [ + 0.0, + -1.0 + ] + }, + { + "name": "Radius", + "values": [ + 5.0 + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0000.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0000.png new file mode 100644 index 0000000..c405aee Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0000.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0001.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0001.png new file mode 100644 index 0000000..cb94450 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0001.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0002.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0002.png new file mode 100644 index 0000000..f6a6000 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0002.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0003.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0003.png new file mode 100644 index 0000000..2dd606e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0003.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0004.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0004.png new file mode 100644 index 0000000..9c8e6ac Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0004.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0005.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0005.png new file mode 100644 index 0000000..2e3122c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0005.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0006.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0006.png new file mode 100644 index 0000000..38bfbce Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0006.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0007.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0007.png new file mode 100644 index 0000000..3eab774 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0007.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0008.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0008.png new file mode 100644 index 0000000..cd139bd Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0008.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0009.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0009.png new file mode 100644 index 0000000..09e379d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0009.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0010.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0010.png new file mode 100644 index 0000000..4ca9be7 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0010.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0011.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0011.png new file mode 100644 index 0000000..5b40c9f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0011.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0012.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0012.png new file mode 100644 index 0000000..f691548 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0012.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0013.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0013.png new file mode 100644 index 0000000..2375c25 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0013.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0014.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0014.png new file mode 100644 index 0000000..604cd2c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0014.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0015.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0015.png new file mode 100644 index 0000000..3bf3324 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0015.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0016.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0016.png new file mode 100644 index 0000000..f9354c4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0016.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0017.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0017.png new file mode 100644 index 0000000..3c7dc8d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0017.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0018.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0018.png new file mode 100644 index 0000000..28341e2 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0018.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0019.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0019.png new file mode 100644 index 0000000..9ac8d29 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0019.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0020.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0020.png new file mode 100644 index 0000000..54716ac Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0020.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0021.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0021.png new file mode 100644 index 0000000..962aa8d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0021.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0022.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0022.png new file mode 100644 index 0000000..8b9a9ec Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0022.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0023.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0023.png new file mode 100644 index 0000000..adcecd1 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0023.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0024.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0024.png new file mode 100644 index 0000000..f60511f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0024.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0025.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0025.png new file mode 100644 index 0000000..7d11a58 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0025.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0026.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0026.png new file mode 100644 index 0000000..1103a43 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0026.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0027.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0027.png new file mode 100644 index 0000000..60445b0 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0027.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0028.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0028.png new file mode 100644 index 0000000..ef47b07 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0028.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0029.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0029.png new file mode 100644 index 0000000..eff65e1 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0029.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0030.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0030.png new file mode 100644 index 0000000..07fceb4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0030.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0031.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0031.png new file mode 100644 index 0000000..76088b9 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0031.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0032.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0032.png new file mode 100644 index 0000000..8c5c46b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0032.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0033.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0033.png new file mode 100644 index 0000000..b458ef7 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0033.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0034.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0034.png new file mode 100644 index 0000000..607a745 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0034.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0035.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0035.png new file mode 100644 index 0000000..497029f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0035.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0036.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0036.png new file mode 100644 index 0000000..7433383 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0036.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0037.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0037.png new file mode 100644 index 0000000..72a90dd Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0037.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0038.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0038.png new file mode 100644 index 0000000..2df85a2 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0038.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0039.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0039.png new file mode 100644 index 0000000..5f7529b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0039.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0040.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0040.png new file mode 100644 index 0000000..ce7c318 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0040.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0041.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0041.png new file mode 100644 index 0000000..b4c3346 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0041.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0042.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0042.png new file mode 100644 index 0000000..862e5c4 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0042.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0043.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0043.png new file mode 100644 index 0000000..1408e0d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0043.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0044.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0044.png new file mode 100644 index 0000000..91661b5 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0044.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0045.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0045.png new file mode 100644 index 0000000..fcbbe3f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0045.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0046.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0046.png new file mode 100644 index 0000000..ffcd03c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0046.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0047.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0047.png new file mode 100644 index 0000000..bcb2c70 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0047.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0048.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0048.png new file mode 100644 index 0000000..0fa4442 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0048.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0049.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0049.png new file mode 100644 index 0000000..2c6fc38 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0049.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0050.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0050.png new file mode 100644 index 0000000..57e8307 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0050.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0051.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0051.png new file mode 100644 index 0000000..c19fb6b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0051.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0052.png b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0052.png new file mode 100644 index 0000000..c0fc27c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/paimon/paimon_0052.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/christmas/background.png b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/background.png new file mode 100644 index 0000000..3f57196 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/background.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_0.png b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_0.png new file mode 100644 index 0000000..b6a2a1a Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_0.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_1.png b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_1.png new file mode 100644 index 0000000..6ee6545 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_1.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_2.png b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_2.png new file mode 100644 index 0000000..408c0f2 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_2.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_3.png b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_3.png new file mode 100644 index 0000000..3f09099 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_3.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_4.png b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_4.png new file mode 100644 index 0000000..e7b5210 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_4.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_5.png b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_5.png new file mode 100644 index 0000000..c3282c8 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/christmas/panorama_5.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/normal/background.png b/src/minecraft/assets/minecraft/Animeware/panorama/normal/background.png new file mode 100644 index 0000000..f35c188 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/normal/background.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_0.png b/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_0.png new file mode 100644 index 0000000..aac7ade Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_0.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_1.png b/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_1.png new file mode 100644 index 0000000..af2f196 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_1.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_2.png b/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_2.png new file mode 100644 index 0000000..d00814e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_2.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_3.png b/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_3.png new file mode 100644 index 0000000..c2478e5 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_3.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_4.png b/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_4.png new file mode 100644 index 0000000..10a9981 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_4.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_5.png b/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_5.png new file mode 100644 index 0000000..c18dea7 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/panorama/normal/panorama_5.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/0.png b/src/minecraft/assets/minecraft/Animeware/rise/0.png new file mode 100644 index 0000000..652d697 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/0.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/1.png b/src/minecraft/assets/minecraft/Animeware/rise/1.png new file mode 100644 index 0000000..f22b267 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/1.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/2.png b/src/minecraft/assets/minecraft/Animeware/rise/2.png new file mode 100644 index 0000000..7624d71 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/2.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/3.png b/src/minecraft/assets/minecraft/Animeware/rise/3.png new file mode 100644 index 0000000..a2d5f4b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/3.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/0.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/0.jpg new file mode 100644 index 0000000..bfe7ba2 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/0.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/1.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/1.jpg new file mode 100644 index 0000000..8ae2254 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/1.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/10.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/10.jpg new file mode 100644 index 0000000..453b7ca Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/10.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/11.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/11.jpg new file mode 100644 index 0000000..c1f182e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/11.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/12.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/12.jpg new file mode 100644 index 0000000..fd85fd5 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/12.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/13.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/13.jpg new file mode 100644 index 0000000..df4a65b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/13.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/14.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/14.jpg new file mode 100644 index 0000000..f8ba9f5 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/14.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/15.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/15.jpg new file mode 100644 index 0000000..ca9ea94 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/15.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/16.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/16.jpg new file mode 100644 index 0000000..f2a698d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/16.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/17.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/17.jpg new file mode 100644 index 0000000..621a845 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/17.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/18.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/18.jpg new file mode 100644 index 0000000..4ada595 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/18.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/19.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/19.jpg new file mode 100644 index 0000000..a3b0d08 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/19.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/2.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/2.jpg new file mode 100644 index 0000000..ed9518c Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/2.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/20.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/20.jpg new file mode 100644 index 0000000..b8a4b9f Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/20.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/21.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/21.jpg new file mode 100644 index 0000000..b541df9 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/21.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/22.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/22.jpg new file mode 100644 index 0000000..0117a07 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/22.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/23.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/23.jpg new file mode 100644 index 0000000..e83511d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/23.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/24.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/24.jpg new file mode 100644 index 0000000..10cc459 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/24.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/25.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/25.jpg new file mode 100644 index 0000000..b46274e Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/25.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/26.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/26.jpg new file mode 100644 index 0000000..3fa88d3 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/26.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/27.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/27.jpg new file mode 100644 index 0000000..673cabd Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/27.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/28.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/28.jpg new file mode 100644 index 0000000..38481fb Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/28.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/29.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/29.jpg new file mode 100644 index 0000000..bfabfa6 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/29.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/3.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/3.jpg new file mode 100644 index 0000000..139f77d Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/3.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/30.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/30.jpg new file mode 100644 index 0000000..a385143 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/30.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/31.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/31.jpg new file mode 100644 index 0000000..e0bd8ca Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/31.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/32.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/32.jpg new file mode 100644 index 0000000..ae78ebe Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/32.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/33.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/33.jpg new file mode 100644 index 0000000..8ad8d39 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/33.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/34.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/34.jpg new file mode 100644 index 0000000..881e102 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/34.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/35.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/35.jpg new file mode 100644 index 0000000..585e8cb Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/35.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/36.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/36.jpg new file mode 100644 index 0000000..d44f8c9 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/36.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/37.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/37.jpg new file mode 100644 index 0000000..7adcbbd Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/37.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/38.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/38.jpg new file mode 100644 index 0000000..c15506a Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/38.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/39.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/39.jpg new file mode 100644 index 0000000..2a4f90b Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/39.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/4.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/4.jpg new file mode 100644 index 0000000..93c7118 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/4.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/40.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/40.jpg new file mode 100644 index 0000000..33cde05 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/40.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/5.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/5.jpg new file mode 100644 index 0000000..775e6ea Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/5.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/6.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/6.jpg new file mode 100644 index 0000000..a95fcef Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/6.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/7.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/7.jpg new file mode 100644 index 0000000..92750ee Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/7.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/8.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/8.jpg new file mode 100644 index 0000000..53159ef Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/8.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/rise/orig/9.jpg b/src/minecraft/assets/minecraft/Animeware/rise/orig/9.jpg new file mode 100644 index 0000000..05a1bfd Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/rise/orig/9.jpg differ diff --git a/src/minecraft/assets/minecraft/Animeware/splash/splash.png b/src/minecraft/assets/minecraft/Animeware/splash/splash.png new file mode 100644 index 0000000..2f72ef0 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/splash/splash.png differ diff --git a/src/minecraft/assets/minecraft/Animeware/splash/ssplash.png b/src/minecraft/assets/minecraft/Animeware/splash/ssplash.png new file mode 100644 index 0000000..c232d28 Binary files /dev/null and b/src/minecraft/assets/minecraft/Animeware/splash/ssplash.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0.png new file mode 100644 index 0000000..acadb01 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/0.png new file mode 100644 index 0000000..482314c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/1.png new file mode 100644 index 0000000..e2a575c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/10.png new file mode 100644 index 0000000..aa7bea6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/11.png new file mode 100644 index 0000000..74f57a3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/16.png new file mode 100644 index 0000000..d8bf7d1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/17.png new file mode 100644 index 0000000..0f82cfc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/18.png new file mode 100644 index 0000000..19290f4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/19.png new file mode 100644 index 0000000..ed7f623 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/2.png new file mode 100644 index 0000000..fb205fe Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/20.png new file mode 100644 index 0000000..4ddd184 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/21.png new file mode 100644 index 0000000..c033321 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/22.png new file mode 100644 index 0000000..551d863 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/23.png new file mode 100644 index 0000000..b51bed4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/24.png new file mode 100644 index 0000000..52ee206 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/25.png new file mode 100644 index 0000000..cc5fd49 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/26.png new file mode 100644 index 0000000..443b5b9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/27.png new file mode 100644 index 0000000..b7e1e8b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/3.png new file mode 100644 index 0000000..ab11024 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/32.png new file mode 100644 index 0000000..8a89dbb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/33.png new file mode 100644 index 0000000..f426e72 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/34.png new file mode 100644 index 0000000..8d51784 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/35.png new file mode 100644 index 0000000..201decc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/36.png new file mode 100644 index 0000000..97341db Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/37.png new file mode 100644 index 0000000..0c091e3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/38.png new file mode 100644 index 0000000..19589ae Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/39.png new file mode 100644 index 0000000..3f24f73 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/4.png new file mode 100644 index 0000000..89313f3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/40.png new file mode 100644 index 0000000..684b05b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/41.png new file mode 100644 index 0000000..68935ec Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/42.png new file mode 100644 index 0000000..02146e6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/43.png new file mode 100644 index 0000000..eb033a0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/48.png new file mode 100644 index 0000000..b9f9e15 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/49.png new file mode 100644 index 0000000..d8d43f3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/5.png new file mode 100644 index 0000000..dc8a5a2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/50.png new file mode 100644 index 0000000..34dfd51 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/51.png new file mode 100644 index 0000000..adce730 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/52.png new file mode 100644 index 0000000..b2642ee Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/53.png new file mode 100644 index 0000000..b986b35 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/54.png new file mode 100644 index 0000000..51d3ace Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/55.png new file mode 100644 index 0000000..44c38f8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/56.png new file mode 100644 index 0000000..8323d93 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/57.png new file mode 100644 index 0000000..5a8a105 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/58.png new file mode 100644 index 0000000..8581ae8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/6.png new file mode 100644 index 0000000..80d0dba Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/7.png new file mode 100644 index 0000000..128f2ce Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/8.png new file mode 100644 index 0000000..05db2b1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/9.png new file mode 100644 index 0000000..9f12d4f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/glass_pane_white.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/glass_pane_white.properties new file mode 100644 index 0000000..3e0b141 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/glass_pane_white.properties @@ -0,0 +1,6 @@ +# Stained glass white +matchBlocks=160 +metadata=0 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/glass_white.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/glass_white.properties new file mode 100644 index 0000000..d762a6d --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/0_glass_white/glass_white.properties @@ -0,0 +1,6 @@ +# Stained glass white +matchBlocks=95 +metadata=0 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1.png new file mode 100644 index 0000000..291d775 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10.png new file mode 100644 index 0000000..602786b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/0.png new file mode 100644 index 0000000..fcae3d2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/1.png new file mode 100644 index 0000000..c6388c7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/10.png new file mode 100644 index 0000000..025cc5d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/11.png new file mode 100644 index 0000000..63222ea Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/16.png new file mode 100644 index 0000000..71a93f5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/17.png new file mode 100644 index 0000000..453b868 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/18.png new file mode 100644 index 0000000..c88f7b7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/19.png new file mode 100644 index 0000000..41de663 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/2.png new file mode 100644 index 0000000..3f58b21 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/20.png new file mode 100644 index 0000000..52c0ada Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/21.png new file mode 100644 index 0000000..623d894 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/22.png new file mode 100644 index 0000000..2b1cbaa Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/23.png new file mode 100644 index 0000000..9cffa1b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/24.png new file mode 100644 index 0000000..bc6aa71 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/25.png new file mode 100644 index 0000000..eaef4e7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/26.png new file mode 100644 index 0000000..f4633b2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/27.png new file mode 100644 index 0000000..85f4fea Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/3.png new file mode 100644 index 0000000..6a12c18 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/32.png new file mode 100644 index 0000000..6161cf2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/33.png new file mode 100644 index 0000000..e17b7b3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/34.png new file mode 100644 index 0000000..99d1a53 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/35.png new file mode 100644 index 0000000..3543bc4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/36.png new file mode 100644 index 0000000..35986d9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/37.png new file mode 100644 index 0000000..f328c50 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/38.png new file mode 100644 index 0000000..219ab34 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/39.png new file mode 100644 index 0000000..5b7580a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/4.png new file mode 100644 index 0000000..4e202ca Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/40.png new file mode 100644 index 0000000..811321b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/41.png new file mode 100644 index 0000000..6f0e33f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/42.png new file mode 100644 index 0000000..1f6854a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/43.png new file mode 100644 index 0000000..f0a1fcc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/48.png new file mode 100644 index 0000000..9561168 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/49.png new file mode 100644 index 0000000..a32e9ae Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/5.png new file mode 100644 index 0000000..35ae121 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/50.png new file mode 100644 index 0000000..532325c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/51.png new file mode 100644 index 0000000..f900cfa Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/52.png new file mode 100644 index 0000000..b0de565 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/53.png new file mode 100644 index 0000000..3764a55 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/54.png new file mode 100644 index 0000000..5ab97a6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/55.png new file mode 100644 index 0000000..ba3bc7c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/56.png new file mode 100644 index 0000000..5500739 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/57.png new file mode 100644 index 0000000..ff82291 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/58.png new file mode 100644 index 0000000..e8389d7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/6.png new file mode 100644 index 0000000..b81516b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/7.png new file mode 100644 index 0000000..0efca44 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/8.png new file mode 100644 index 0000000..fa3ab6b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/9.png new file mode 100644 index 0000000..b2d3050 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/glass_pane_purple.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/glass_pane_purple.properties new file mode 100644 index 0000000..58ff933 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/glass_pane_purple.properties @@ -0,0 +1,6 @@ +# Stained glass purple +matchBlocks=160 +metadata=10 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/glass_purple.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/glass_purple.properties new file mode 100644 index 0000000..27d4480 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/10_glass_purple/glass_purple.properties @@ -0,0 +1,6 @@ +# Stained glass purple +matchBlocks=95 +metadata=10 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11.png new file mode 100644 index 0000000..a179881 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/0.png new file mode 100644 index 0000000..38885de Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/1.png new file mode 100644 index 0000000..78b8685 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/10.png new file mode 100644 index 0000000..f111abb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/11.png new file mode 100644 index 0000000..1682741 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/16.png new file mode 100644 index 0000000..b69e09e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/17.png new file mode 100644 index 0000000..696d771 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/18.png new file mode 100644 index 0000000..39676be Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/19.png new file mode 100644 index 0000000..dfa2b62 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/2.png new file mode 100644 index 0000000..85232a5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/20.png new file mode 100644 index 0000000..4ffc019 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/21.png new file mode 100644 index 0000000..58eb303 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/22.png new file mode 100644 index 0000000..5f88c04 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/23.png new file mode 100644 index 0000000..c52be72 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/24.png new file mode 100644 index 0000000..c60f717 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/25.png new file mode 100644 index 0000000..1f2b02c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/26.png new file mode 100644 index 0000000..e67b915 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/27.png new file mode 100644 index 0000000..e496c97 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/3.png new file mode 100644 index 0000000..274c3d4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/32.png new file mode 100644 index 0000000..28aef71 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/33.png new file mode 100644 index 0000000..aa469a2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/34.png new file mode 100644 index 0000000..b9e05b2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/35.png new file mode 100644 index 0000000..2e81675 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/36.png new file mode 100644 index 0000000..95efd6a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/37.png new file mode 100644 index 0000000..8052ce7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/38.png new file mode 100644 index 0000000..b022639 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/39.png new file mode 100644 index 0000000..9a6bf54 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/4.png new file mode 100644 index 0000000..c0a62e1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/40.png new file mode 100644 index 0000000..ad63f29 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/41.png new file mode 100644 index 0000000..efb34d8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/42.png new file mode 100644 index 0000000..d6a19d5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/43.png new file mode 100644 index 0000000..a6cf4c9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/48.png new file mode 100644 index 0000000..3fcc4b5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/49.png new file mode 100644 index 0000000..8f7ee1d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/5.png new file mode 100644 index 0000000..3882007 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/50.png new file mode 100644 index 0000000..6383a5e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/51.png new file mode 100644 index 0000000..5bbff6e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/52.png new file mode 100644 index 0000000..cc9ba7e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/53.png new file mode 100644 index 0000000..7752599 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/54.png new file mode 100644 index 0000000..fe34801 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/55.png new file mode 100644 index 0000000..cb2fce7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/56.png new file mode 100644 index 0000000..7e6c682 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/57.png new file mode 100644 index 0000000..3d261ad Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/58.png new file mode 100644 index 0000000..17de9bc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/6.png new file mode 100644 index 0000000..66f6fc8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/7.png new file mode 100644 index 0000000..70eaea5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/8.png new file mode 100644 index 0000000..4c13eea Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/9.png new file mode 100644 index 0000000..16a4c83 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/glass_blue.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/glass_blue.properties new file mode 100644 index 0000000..b9441ea --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/glass_blue.properties @@ -0,0 +1,6 @@ +# Stained glass blue +matchBlocks=95 +metadata=11 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/glass_pane_blue.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/glass_pane_blue.properties new file mode 100644 index 0000000..0bb8a38 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/11_glass_blue/glass_pane_blue.properties @@ -0,0 +1,6 @@ +# Stained glass blue +matchBlocks=160 +metadata=11 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12.png new file mode 100644 index 0000000..93a1003 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/0.png new file mode 100644 index 0000000..259b61c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/1.png new file mode 100644 index 0000000..2268ce6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/10.png new file mode 100644 index 0000000..7ac2776 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/11.png new file mode 100644 index 0000000..6dcaeac Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/16.png new file mode 100644 index 0000000..d1d3741 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/17.png new file mode 100644 index 0000000..b94809b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/18.png new file mode 100644 index 0000000..5459fac Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/19.png new file mode 100644 index 0000000..afb4bc8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/2.png new file mode 100644 index 0000000..c07848c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/20.png new file mode 100644 index 0000000..2f381e2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/21.png new file mode 100644 index 0000000..abaa5cd Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/22.png new file mode 100644 index 0000000..666c8e9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/23.png new file mode 100644 index 0000000..2447f12 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/24.png new file mode 100644 index 0000000..b017b2e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/25.png new file mode 100644 index 0000000..acaaf58 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/26.png new file mode 100644 index 0000000..70ec772 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/27.png new file mode 100644 index 0000000..c5e69d1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/3.png new file mode 100644 index 0000000..b7f2e56 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/32.png new file mode 100644 index 0000000..e175b98 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/33.png new file mode 100644 index 0000000..799c6a1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/34.png new file mode 100644 index 0000000..ff9667f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/35.png new file mode 100644 index 0000000..f890940 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/36.png new file mode 100644 index 0000000..26d3a7a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/37.png new file mode 100644 index 0000000..5e2cd71 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/38.png new file mode 100644 index 0000000..ee987d8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/39.png new file mode 100644 index 0000000..940b86c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/4.png new file mode 100644 index 0000000..167feab Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/40.png new file mode 100644 index 0000000..4610850 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/41.png new file mode 100644 index 0000000..e87f9cb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/42.png new file mode 100644 index 0000000..a007319 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/43.png new file mode 100644 index 0000000..62a6c95 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/48.png new file mode 100644 index 0000000..3003b36 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/49.png new file mode 100644 index 0000000..0c87b12 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/5.png new file mode 100644 index 0000000..363d09b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/50.png new file mode 100644 index 0000000..bff4e7a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/51.png new file mode 100644 index 0000000..85f2aba Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/52.png new file mode 100644 index 0000000..1422a56 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/53.png new file mode 100644 index 0000000..4a08413 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/54.png new file mode 100644 index 0000000..43bcdb8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/55.png new file mode 100644 index 0000000..21487fe Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/56.png new file mode 100644 index 0000000..aaece81 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/57.png new file mode 100644 index 0000000..d4ba78d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/58.png new file mode 100644 index 0000000..746ae6a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/6.png new file mode 100644 index 0000000..ac145b8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/7.png new file mode 100644 index 0000000..b9ad6b6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/8.png new file mode 100644 index 0000000..f9febbc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/9.png new file mode 100644 index 0000000..1a00286 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/glass_brown.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/glass_brown.properties new file mode 100644 index 0000000..0b33e3c --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/glass_brown.properties @@ -0,0 +1,6 @@ +# Stained glass brown +matchBlocks=95 +metadata=12 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/glass_pane_brown.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/glass_pane_brown.properties new file mode 100644 index 0000000..838f52c --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/12_glass_brown/glass_pane_brown.properties @@ -0,0 +1,6 @@ +# Stained glass brown +matchBlocks=160 +metadata=12 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13.png new file mode 100644 index 0000000..d7f8277 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/0.png new file mode 100644 index 0000000..7c1f4e6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/1.png new file mode 100644 index 0000000..2040368 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/10.png new file mode 100644 index 0000000..3c9fdef Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/11.png new file mode 100644 index 0000000..4bfcc6d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/16.png new file mode 100644 index 0000000..edc28eb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/17.png new file mode 100644 index 0000000..3b29a9e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/18.png new file mode 100644 index 0000000..f9513cb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/19.png new file mode 100644 index 0000000..83d1cd4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/2.png new file mode 100644 index 0000000..62f1d66 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/20.png new file mode 100644 index 0000000..f5d223a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/21.png new file mode 100644 index 0000000..001eba0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/22.png new file mode 100644 index 0000000..b1e8274 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/23.png new file mode 100644 index 0000000..a4d6cc3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/24.png new file mode 100644 index 0000000..d470857 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/25.png new file mode 100644 index 0000000..1c52d05 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/26.png new file mode 100644 index 0000000..e1a22b6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/27.png new file mode 100644 index 0000000..92eddbc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/3.png new file mode 100644 index 0000000..9efad31 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/32.png new file mode 100644 index 0000000..2d4ab46 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/33.png new file mode 100644 index 0000000..8d28289 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/34.png new file mode 100644 index 0000000..b2aa6f9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/35.png new file mode 100644 index 0000000..120a9bd Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/36.png new file mode 100644 index 0000000..19ca5f5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/37.png new file mode 100644 index 0000000..8a8c17e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/38.png new file mode 100644 index 0000000..8e6f98a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/39.png new file mode 100644 index 0000000..cb61692 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/4.png new file mode 100644 index 0000000..f3003ac Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/40.png new file mode 100644 index 0000000..ccb2dc6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/41.png new file mode 100644 index 0000000..6373bf1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/42.png new file mode 100644 index 0000000..ccebff1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/43.png new file mode 100644 index 0000000..ae5e948 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/48.png new file mode 100644 index 0000000..a818c9f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/49.png new file mode 100644 index 0000000..7705c14 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/5.png new file mode 100644 index 0000000..c637517 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/50.png new file mode 100644 index 0000000..2c3c4b8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/51.png new file mode 100644 index 0000000..ec24732 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/52.png new file mode 100644 index 0000000..dd1ae3b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/53.png new file mode 100644 index 0000000..50f722c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/54.png new file mode 100644 index 0000000..8cc645a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/55.png new file mode 100644 index 0000000..3a8aa9b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/56.png new file mode 100644 index 0000000..8298ffd Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/57.png new file mode 100644 index 0000000..f81edbc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/58.png new file mode 100644 index 0000000..a3ff7e6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/6.png new file mode 100644 index 0000000..89bf889 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/7.png new file mode 100644 index 0000000..7d264a9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/8.png new file mode 100644 index 0000000..9a9725f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/9.png new file mode 100644 index 0000000..9645de2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/glass_green.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/glass_green.properties new file mode 100644 index 0000000..0e2e5b3 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/glass_green.properties @@ -0,0 +1,6 @@ +# Stained glass green +matchBlocks=95 +metadata=13 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/glass_pane_green.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/glass_pane_green.properties new file mode 100644 index 0000000..c22af49 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/13_glass_green/glass_pane_green.properties @@ -0,0 +1,6 @@ +# Stained glass green +matchBlocks=160 +metadata=13 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14.png new file mode 100644 index 0000000..ea6408b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/0.png new file mode 100644 index 0000000..db4c5eb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/1.png new file mode 100644 index 0000000..3e8c769 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/10.png new file mode 100644 index 0000000..247b815 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/11.png new file mode 100644 index 0000000..e4497bf Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/16.png new file mode 100644 index 0000000..3d567be Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/17.png new file mode 100644 index 0000000..b593cb8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/18.png new file mode 100644 index 0000000..42924ab Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/19.png new file mode 100644 index 0000000..db7d4e9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/2.png new file mode 100644 index 0000000..72f461b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/20.png new file mode 100644 index 0000000..619b2e7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/21.png new file mode 100644 index 0000000..363c81e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/22.png new file mode 100644 index 0000000..e60f627 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/23.png new file mode 100644 index 0000000..f439b47 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/24.png new file mode 100644 index 0000000..b62e65b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/25.png new file mode 100644 index 0000000..ae1c143 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/26.png new file mode 100644 index 0000000..cc952b3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/27.png new file mode 100644 index 0000000..32ad0f2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/3.png new file mode 100644 index 0000000..69b8bb3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/32.png new file mode 100644 index 0000000..6f31642 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/33.png new file mode 100644 index 0000000..3bae303 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/34.png new file mode 100644 index 0000000..074a527 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/35.png new file mode 100644 index 0000000..336f054 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/36.png new file mode 100644 index 0000000..6aea777 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/37.png new file mode 100644 index 0000000..382bf64 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/38.png new file mode 100644 index 0000000..88faee4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/39.png new file mode 100644 index 0000000..c452b15 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/4.png new file mode 100644 index 0000000..de22d1e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/40.png new file mode 100644 index 0000000..da6f876 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/41.png new file mode 100644 index 0000000..a25b3af Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/42.png new file mode 100644 index 0000000..c437e2c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/43.png new file mode 100644 index 0000000..dbff65d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/48.png new file mode 100644 index 0000000..c2aa088 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/49.png new file mode 100644 index 0000000..64f2e3c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/5.png new file mode 100644 index 0000000..64c2d64 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/50.png new file mode 100644 index 0000000..3903aab Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/51.png new file mode 100644 index 0000000..5491189 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/52.png new file mode 100644 index 0000000..61a217d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/53.png new file mode 100644 index 0000000..de9db5e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/54.png new file mode 100644 index 0000000..3c3f5bb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/55.png new file mode 100644 index 0000000..b221b3d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/56.png new file mode 100644 index 0000000..b4799e5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/57.png new file mode 100644 index 0000000..c0b5370 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/58.png new file mode 100644 index 0000000..fec4f8f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/6.png new file mode 100644 index 0000000..3d59656 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/7.png new file mode 100644 index 0000000..c83cac5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/8.png new file mode 100644 index 0000000..59e1bc3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/9.png new file mode 100644 index 0000000..eecb4a7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/glass_pane_red.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/glass_pane_red.properties new file mode 100644 index 0000000..fea8c53 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/glass_pane_red.properties @@ -0,0 +1,6 @@ +# Stained glass red +matchBlocks=160 +metadata=14 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/glass_red.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/glass_red.properties new file mode 100644 index 0000000..cf43547 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/14_glass_red/glass_red.properties @@ -0,0 +1,6 @@ +# Stained glass red +matchBlocks=95 +metadata=14 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15.png new file mode 100644 index 0000000..4c87f0f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/0.png new file mode 100644 index 0000000..06f3427 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/1.png new file mode 100644 index 0000000..7e63ee7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/10.png new file mode 100644 index 0000000..9142b6f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/11.png new file mode 100644 index 0000000..f031f1c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/16.png new file mode 100644 index 0000000..273dc8c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/17.png new file mode 100644 index 0000000..0c36799 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/18.png new file mode 100644 index 0000000..6275d95 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/19.png new file mode 100644 index 0000000..8ba895b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/2.png new file mode 100644 index 0000000..32c6872 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/20.png new file mode 100644 index 0000000..bc2543e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/21.png new file mode 100644 index 0000000..2f7fe8e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/22.png new file mode 100644 index 0000000..0d5f9f2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/23.png new file mode 100644 index 0000000..3aa27e5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/24.png new file mode 100644 index 0000000..f0ded67 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/25.png new file mode 100644 index 0000000..dbb6121 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/26.png new file mode 100644 index 0000000..69bfbc0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/27.png new file mode 100644 index 0000000..07f46ac Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/3.png new file mode 100644 index 0000000..011ca1e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/32.png new file mode 100644 index 0000000..5512cbb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/33.png new file mode 100644 index 0000000..239fd78 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/34.png new file mode 100644 index 0000000..defc068 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/35.png new file mode 100644 index 0000000..73dd6df Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/36.png new file mode 100644 index 0000000..8185b75 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/37.png new file mode 100644 index 0000000..f55e960 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/38.png new file mode 100644 index 0000000..6a12574 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/39.png new file mode 100644 index 0000000..f7dadbb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/4.png new file mode 100644 index 0000000..21e9e9e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/40.png new file mode 100644 index 0000000..a0f9b0a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/41.png new file mode 100644 index 0000000..a191e23 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/42.png new file mode 100644 index 0000000..d12d6b8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/43.png new file mode 100644 index 0000000..8d55d97 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/48.png new file mode 100644 index 0000000..bf8fe4a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/49.png new file mode 100644 index 0000000..833a3e2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/5.png new file mode 100644 index 0000000..0b09c25 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/50.png new file mode 100644 index 0000000..5814d06 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/51.png new file mode 100644 index 0000000..c2decd5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/52.png new file mode 100644 index 0000000..b87f6e4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/53.png new file mode 100644 index 0000000..99fd221 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/54.png new file mode 100644 index 0000000..7b5e630 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/55.png new file mode 100644 index 0000000..10be40b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/56.png new file mode 100644 index 0000000..96c8041 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/57.png new file mode 100644 index 0000000..5d2638a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/58.png new file mode 100644 index 0000000..9360f4a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/6.png new file mode 100644 index 0000000..143555f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/7.png new file mode 100644 index 0000000..443fa69 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/8.png new file mode 100644 index 0000000..6888680 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/9.png new file mode 100644 index 0000000..41b217d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/glass_black.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/glass_black.properties new file mode 100644 index 0000000..4566909 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/glass_black.properties @@ -0,0 +1,6 @@ +# Stained glass black +matchBlocks=95 +metadata=15 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/glass_pane_black.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/glass_pane_black.properties new file mode 100644 index 0000000..b3a8335 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/15_glass_black/glass_pane_black.properties @@ -0,0 +1,6 @@ +# Stained glass black +matchBlocks=160 +metadata=15 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/16.png new file mode 100644 index 0000000..316522f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/17.png new file mode 100644 index 0000000..b3c3165 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/18.png new file mode 100644 index 0000000..70de401 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/19.png new file mode 100644 index 0000000..c8704a1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/0.png new file mode 100644 index 0000000..3a29e31 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/1.png new file mode 100644 index 0000000..ac20892 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/10.png new file mode 100644 index 0000000..5107903 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/11.png new file mode 100644 index 0000000..76a4ecb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/16.png new file mode 100644 index 0000000..34b4e01 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/17.png new file mode 100644 index 0000000..d5ba7a0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/18.png new file mode 100644 index 0000000..31ea8b5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/19.png new file mode 100644 index 0000000..3fa6a20 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/2.png new file mode 100644 index 0000000..da2c361 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/20.png new file mode 100644 index 0000000..2eb2915 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/21.png new file mode 100644 index 0000000..09652b3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/22.png new file mode 100644 index 0000000..92e199c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/23.png new file mode 100644 index 0000000..9068d19 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/24.png new file mode 100644 index 0000000..f07d979 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/25.png new file mode 100644 index 0000000..520102c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/26.png new file mode 100644 index 0000000..be490ad Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/27.png new file mode 100644 index 0000000..3eac57f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/3.png new file mode 100644 index 0000000..0cb6300 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/32.png new file mode 100644 index 0000000..38fe9f4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/33.png new file mode 100644 index 0000000..ad6398d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/34.png new file mode 100644 index 0000000..53d76db Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/35.png new file mode 100644 index 0000000..c7adaab Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/36.png new file mode 100644 index 0000000..de55e7b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/37.png new file mode 100644 index 0000000..1202c0d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/38.png new file mode 100644 index 0000000..8977b0f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/39.png new file mode 100644 index 0000000..c091f83 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/4.png new file mode 100644 index 0000000..595ce65 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/40.png new file mode 100644 index 0000000..f51e589 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/41.png new file mode 100644 index 0000000..663b197 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/42.png new file mode 100644 index 0000000..f6a65d1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/43.png new file mode 100644 index 0000000..4b6a0d5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/48.png new file mode 100644 index 0000000..4e6c92a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/49.png new file mode 100644 index 0000000..1a5751d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/5.png new file mode 100644 index 0000000..c9353d4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/50.png new file mode 100644 index 0000000..b73c34f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/51.png new file mode 100644 index 0000000..ab60c8e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/52.png new file mode 100644 index 0000000..282c59d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/53.png new file mode 100644 index 0000000..3df68a2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/54.png new file mode 100644 index 0000000..36a6ae1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/55.png new file mode 100644 index 0000000..73ff42d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/56.png new file mode 100644 index 0000000..4bc7b52 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/57.png new file mode 100644 index 0000000..3df9c2a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/58.png new file mode 100644 index 0000000..067054d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/6.png new file mode 100644 index 0000000..f310397 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/7.png new file mode 100644 index 0000000..6d06d7b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/8.png new file mode 100644 index 0000000..ac561ba Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/9.png new file mode 100644 index 0000000..42034d2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/glass_orange.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/glass_orange.properties new file mode 100644 index 0000000..41553be --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/glass_orange.properties @@ -0,0 +1,6 @@ +# Stained glass orange +matchBlocks=95 +metadata=1 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/glass_pane_orange.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/glass_pane_orange.properties new file mode 100644 index 0000000..a25460f --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/1_glass_orange/glass_pane_orange.properties @@ -0,0 +1,6 @@ +# Stained glass orange +matchBlocks=160 +metadata=1 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2.png new file mode 100644 index 0000000..dc088c6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/20.png new file mode 100644 index 0000000..8b54006 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/21.png new file mode 100644 index 0000000..193abdc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/22.png new file mode 100644 index 0000000..13940d4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/23.png new file mode 100644 index 0000000..a64d95f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/24.png new file mode 100644 index 0000000..0291a2e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/25.png new file mode 100644 index 0000000..ea459b6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/26.png new file mode 100644 index 0000000..683cfe1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/27.png new file mode 100644 index 0000000..45a0af6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/0.png new file mode 100644 index 0000000..5cd9945 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/1.png new file mode 100644 index 0000000..73799d2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/10.png new file mode 100644 index 0000000..f307b82 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/11.png new file mode 100644 index 0000000..612745d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/16.png new file mode 100644 index 0000000..5eaccfc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/17.png new file mode 100644 index 0000000..1e206b4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/18.png new file mode 100644 index 0000000..30e55de Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/19.png new file mode 100644 index 0000000..7fa751c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/2.png new file mode 100644 index 0000000..dd37796 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/20.png new file mode 100644 index 0000000..145d9a6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/21.png new file mode 100644 index 0000000..a389d82 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/22.png new file mode 100644 index 0000000..e1379a8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/23.png new file mode 100644 index 0000000..b9ba5b9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/24.png new file mode 100644 index 0000000..c80687a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/25.png new file mode 100644 index 0000000..39f403c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/26.png new file mode 100644 index 0000000..638b3da Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/27.png new file mode 100644 index 0000000..e88b2e6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/3.png new file mode 100644 index 0000000..12f1aa9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/32.png new file mode 100644 index 0000000..e4621f3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/33.png new file mode 100644 index 0000000..a64a170 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/34.png new file mode 100644 index 0000000..e642e14 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/35.png new file mode 100644 index 0000000..7ee2dba Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/36.png new file mode 100644 index 0000000..c7e553e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/37.png new file mode 100644 index 0000000..5d91ebf Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/38.png new file mode 100644 index 0000000..3a167e8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/39.png new file mode 100644 index 0000000..19fe7f1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/4.png new file mode 100644 index 0000000..b1ff09c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/40.png new file mode 100644 index 0000000..999f9c7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/41.png new file mode 100644 index 0000000..27a39e1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/42.png new file mode 100644 index 0000000..495859f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/43.png new file mode 100644 index 0000000..0de323b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/48.png new file mode 100644 index 0000000..c0cda90 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/49.png new file mode 100644 index 0000000..0acb361 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/5.png new file mode 100644 index 0000000..5f09b94 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/50.png new file mode 100644 index 0000000..8e138e5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/51.png new file mode 100644 index 0000000..1b0d1ba Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/52.png new file mode 100644 index 0000000..3bc00be Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/53.png new file mode 100644 index 0000000..f81704e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/54.png new file mode 100644 index 0000000..5520a91 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/55.png new file mode 100644 index 0000000..d83d0da Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/56.png new file mode 100644 index 0000000..3b2f2d6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/57.png new file mode 100644 index 0000000..492142e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/58.png new file mode 100644 index 0000000..30fc4c9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/6.png new file mode 100644 index 0000000..bce21a5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/7.png new file mode 100644 index 0000000..659eb3a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/8.png new file mode 100644 index 0000000..0763cb6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/9.png new file mode 100644 index 0000000..6628eb8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/glass_magenta.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/glass_magenta.properties new file mode 100644 index 0000000..ddf78f7 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/glass_magenta.properties @@ -0,0 +1,6 @@ +# Stained glass magenta +matchBlocks=95 +metadata=2 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/glass_pane_magenta.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/glass_pane_magenta.properties new file mode 100644 index 0000000..9f5a428 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/2_glass_magenta/glass_pane_magenta.properties @@ -0,0 +1,6 @@ +# Stained glass magenta +matchBlocks=160 +metadata=2 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3.png new file mode 100644 index 0000000..6611ddc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/32.png new file mode 100644 index 0000000..6f2391c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/33.png new file mode 100644 index 0000000..9572123 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/34.png new file mode 100644 index 0000000..a620f44 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/35.png new file mode 100644 index 0000000..af69add Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/36.png new file mode 100644 index 0000000..5c7effd Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/37.png new file mode 100644 index 0000000..663c27d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/38.png new file mode 100644 index 0000000..21b4b1b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/39.png new file mode 100644 index 0000000..8ded4a6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/0.png new file mode 100644 index 0000000..b62703d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/1.png new file mode 100644 index 0000000..b54d3e0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/10.png new file mode 100644 index 0000000..61a2de6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/11.png new file mode 100644 index 0000000..0d65d44 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/16.png new file mode 100644 index 0000000..3e2154f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/17.png new file mode 100644 index 0000000..5bfc9b9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/18.png new file mode 100644 index 0000000..0eaf5fc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/19.png new file mode 100644 index 0000000..899033b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/2.png new file mode 100644 index 0000000..5ff1e34 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/20.png new file mode 100644 index 0000000..1053015 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/21.png new file mode 100644 index 0000000..2ca7ba6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/22.png new file mode 100644 index 0000000..972314f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/23.png new file mode 100644 index 0000000..471b0a1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/24.png new file mode 100644 index 0000000..60fc60d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/25.png new file mode 100644 index 0000000..c7a6d9b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/26.png new file mode 100644 index 0000000..881c659 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/27.png new file mode 100644 index 0000000..b7dfaa3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/3.png new file mode 100644 index 0000000..abd672d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/32.png new file mode 100644 index 0000000..63a1c25 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/33.png new file mode 100644 index 0000000..d0c743f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/34.png new file mode 100644 index 0000000..98555c3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/35.png new file mode 100644 index 0000000..f2c50a2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/36.png new file mode 100644 index 0000000..21d6813 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/37.png new file mode 100644 index 0000000..cb54313 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/38.png new file mode 100644 index 0000000..a148c54 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/39.png new file mode 100644 index 0000000..6328228 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/4.png new file mode 100644 index 0000000..a996a89 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/40.png new file mode 100644 index 0000000..520b483 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/41.png new file mode 100644 index 0000000..6b68671 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/42.png new file mode 100644 index 0000000..84aaf0d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/43.png new file mode 100644 index 0000000..585fe05 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/48.png new file mode 100644 index 0000000..4734b0a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/49.png new file mode 100644 index 0000000..1b47e77 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/5.png new file mode 100644 index 0000000..40927d6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/50.png new file mode 100644 index 0000000..a806848 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/51.png new file mode 100644 index 0000000..b521d2f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/52.png new file mode 100644 index 0000000..eb9e2f6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/53.png new file mode 100644 index 0000000..dba86fd Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/54.png new file mode 100644 index 0000000..58e9d74 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/55.png new file mode 100644 index 0000000..49f8af3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/56.png new file mode 100644 index 0000000..4729ae0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/57.png new file mode 100644 index 0000000..de1a51f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/58.png new file mode 100644 index 0000000..d7f7c6e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/6.png new file mode 100644 index 0000000..3005d8c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/7.png new file mode 100644 index 0000000..70c377b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/8.png new file mode 100644 index 0000000..4eeb2f2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/9.png new file mode 100644 index 0000000..f6bb6ab Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/glass_light_blue.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/glass_light_blue.properties new file mode 100644 index 0000000..7f84e32 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/glass_light_blue.properties @@ -0,0 +1,6 @@ +# Stained glass light_blue +matchBlocks=95 +metadata=3 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/glass_pane_light_blue.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/glass_pane_light_blue.properties new file mode 100644 index 0000000..c8ae52a --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/3_glass_light_blue/glass_pane_light_blue.properties @@ -0,0 +1,6 @@ +# Stained glass light_blue +matchBlocks=160 +metadata=3 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4.png new file mode 100644 index 0000000..ba09a5e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/40.png new file mode 100644 index 0000000..1fb540b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/41.png new file mode 100644 index 0000000..1ae5be7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/42.png new file mode 100644 index 0000000..bd95188 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/43.png new file mode 100644 index 0000000..00e2097 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/48.png new file mode 100644 index 0000000..3b0c6ab Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/49.png new file mode 100644 index 0000000..72b55b5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/0.png new file mode 100644 index 0000000..8e48e12 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/1.png new file mode 100644 index 0000000..7ee50cf Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/10.png new file mode 100644 index 0000000..d5e9266 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/11.png new file mode 100644 index 0000000..11561fe Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/16.png new file mode 100644 index 0000000..e1e7e8a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/17.png new file mode 100644 index 0000000..5c6b658 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/18.png new file mode 100644 index 0000000..f053791 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/19.png new file mode 100644 index 0000000..9d2c4d6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/2.png new file mode 100644 index 0000000..d7899b5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/20.png new file mode 100644 index 0000000..97ab9ab Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/21.png new file mode 100644 index 0000000..31a4fea Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/22.png new file mode 100644 index 0000000..0e4844f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/23.png new file mode 100644 index 0000000..d3ba750 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/24.png new file mode 100644 index 0000000..5b54d6a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/25.png new file mode 100644 index 0000000..acd47fd Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/26.png new file mode 100644 index 0000000..d975f89 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/27.png new file mode 100644 index 0000000..b544aba Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/3.png new file mode 100644 index 0000000..c6cd55e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/32.png new file mode 100644 index 0000000..0500954 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/33.png new file mode 100644 index 0000000..92ec338 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/34.png new file mode 100644 index 0000000..499f061 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/35.png new file mode 100644 index 0000000..e0a0567 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/36.png new file mode 100644 index 0000000..a3f7fce Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/37.png new file mode 100644 index 0000000..faf281b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/38.png new file mode 100644 index 0000000..77aa437 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/39.png new file mode 100644 index 0000000..ee7d8fe Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/4.png new file mode 100644 index 0000000..e19d2eb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/40.png new file mode 100644 index 0000000..fb1f1ae Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/41.png new file mode 100644 index 0000000..7974f3c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/42.png new file mode 100644 index 0000000..6d999ba Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/43.png new file mode 100644 index 0000000..c85d599 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/48.png new file mode 100644 index 0000000..bf1e5f5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/49.png new file mode 100644 index 0000000..63ffd31 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/5.png new file mode 100644 index 0000000..bc4916a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/50.png new file mode 100644 index 0000000..fd296c3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/51.png new file mode 100644 index 0000000..5989037 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/52.png new file mode 100644 index 0000000..849b498 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/53.png new file mode 100644 index 0000000..149ed0c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/54.png new file mode 100644 index 0000000..ff41948 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/55.png new file mode 100644 index 0000000..25ef075 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/56.png new file mode 100644 index 0000000..ac21fe8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/57.png new file mode 100644 index 0000000..82e59f9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/58.png new file mode 100644 index 0000000..e9ec17d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/6.png new file mode 100644 index 0000000..9038f0c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/7.png new file mode 100644 index 0000000..55bbba6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/8.png new file mode 100644 index 0000000..7c65826 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/9.png new file mode 100644 index 0000000..f18633e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/glass_pane_yellow.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/glass_pane_yellow.properties new file mode 100644 index 0000000..b341462 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/glass_pane_yellow.properties @@ -0,0 +1,6 @@ +# Stained glass yellow +matchBlocks=160 +metadata=4 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/glass_yellow.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/glass_yellow.properties new file mode 100644 index 0000000..064de85 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/4_glass_yellow/glass_yellow.properties @@ -0,0 +1,6 @@ +# Stained glass yellow +matchBlocks=95 +metadata=4 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5.png new file mode 100644 index 0000000..3f475db Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/50.png new file mode 100644 index 0000000..9de42fe Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/51.png new file mode 100644 index 0000000..3eb78ec Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/52.png new file mode 100644 index 0000000..c6deb56 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/53.png new file mode 100644 index 0000000..ccb3ad4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/54.png new file mode 100644 index 0000000..db2b9cc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/55.png new file mode 100644 index 0000000..c4ba83b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/56.png new file mode 100644 index 0000000..896a612 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/57.png new file mode 100644 index 0000000..40c7712 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/58.png new file mode 100644 index 0000000..66cf887 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/0.png new file mode 100644 index 0000000..f1d3c46 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/1.png new file mode 100644 index 0000000..28ff5aa Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/10.png new file mode 100644 index 0000000..52548e9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/11.png new file mode 100644 index 0000000..3fc29f5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/16.png new file mode 100644 index 0000000..bef180c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/17.png new file mode 100644 index 0000000..365032b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/18.png new file mode 100644 index 0000000..99006ad Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/19.png new file mode 100644 index 0000000..3daa953 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/2.png new file mode 100644 index 0000000..2a5941b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/20.png new file mode 100644 index 0000000..da36e37 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/21.png new file mode 100644 index 0000000..158596d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/22.png new file mode 100644 index 0000000..68383dd Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/23.png new file mode 100644 index 0000000..2d60be0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/24.png new file mode 100644 index 0000000..5a41ebe Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/25.png new file mode 100644 index 0000000..4512b61 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/26.png new file mode 100644 index 0000000..6a34f7a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/27.png new file mode 100644 index 0000000..d50f751 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/3.png new file mode 100644 index 0000000..4ad6261 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/32.png new file mode 100644 index 0000000..4a477d2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/33.png new file mode 100644 index 0000000..b3d3c4c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/34.png new file mode 100644 index 0000000..cdbf635 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/35.png new file mode 100644 index 0000000..8d04801 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/36.png new file mode 100644 index 0000000..96fe6bd Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/37.png new file mode 100644 index 0000000..7c6557a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/38.png new file mode 100644 index 0000000..d0f480b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/39.png new file mode 100644 index 0000000..6a84d7c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/4.png new file mode 100644 index 0000000..045109c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/40.png new file mode 100644 index 0000000..11542e1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/41.png new file mode 100644 index 0000000..99fd347 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/42.png new file mode 100644 index 0000000..a4dc944 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/43.png new file mode 100644 index 0000000..5d1eef1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/48.png new file mode 100644 index 0000000..cf228f5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/49.png new file mode 100644 index 0000000..4256865 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/5.png new file mode 100644 index 0000000..ba16e32 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/50.png new file mode 100644 index 0000000..3b23cb5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/51.png new file mode 100644 index 0000000..c29337a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/52.png new file mode 100644 index 0000000..0f33f4d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/53.png new file mode 100644 index 0000000..b4887a3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/54.png new file mode 100644 index 0000000..797aaa1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/55.png new file mode 100644 index 0000000..9817194 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/56.png new file mode 100644 index 0000000..8e3eba1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/57.png new file mode 100644 index 0000000..b7454e1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/58.png new file mode 100644 index 0000000..f578645 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/6.png new file mode 100644 index 0000000..d2e9ade Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/7.png new file mode 100644 index 0000000..9f26f1b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/8.png new file mode 100644 index 0000000..6e44ca1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/9.png new file mode 100644 index 0000000..3a61657 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/glass_lime.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/glass_lime.properties new file mode 100644 index 0000000..968e822 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/glass_lime.properties @@ -0,0 +1,6 @@ +# Stained glass lime +matchBlocks=95 +metadata=5 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/glass_pane_lime.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/glass_pane_lime.properties new file mode 100644 index 0000000..1526f27 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/5_glass_lime/glass_pane_lime.properties @@ -0,0 +1,6 @@ +# Stained glass lime +matchBlocks=160 +metadata=5 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6.png new file mode 100644 index 0000000..ffd366d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/66.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/66.png new file mode 100644 index 0000000..13d68d0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/66.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/0.png new file mode 100644 index 0000000..42d8739 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/1.png new file mode 100644 index 0000000..7744913 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/10.png new file mode 100644 index 0000000..a87f362 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/11.png new file mode 100644 index 0000000..9f572a8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/16.png new file mode 100644 index 0000000..9cc8ef9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/17.png new file mode 100644 index 0000000..947f4ac Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/18.png new file mode 100644 index 0000000..fea9bca Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/19.png new file mode 100644 index 0000000..fd0ee45 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/2.png new file mode 100644 index 0000000..50ef16b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/20.png new file mode 100644 index 0000000..378e5ef Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/21.png new file mode 100644 index 0000000..557d38d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/22.png new file mode 100644 index 0000000..a9f4eb0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/23.png new file mode 100644 index 0000000..6b74afc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/24.png new file mode 100644 index 0000000..d6bb643 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/25.png new file mode 100644 index 0000000..be3c1a2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/26.png new file mode 100644 index 0000000..7f87f51 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/27.png new file mode 100644 index 0000000..ac497a7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/3.png new file mode 100644 index 0000000..078a36a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/32.png new file mode 100644 index 0000000..2bb9b0d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/33.png new file mode 100644 index 0000000..88a776d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/34.png new file mode 100644 index 0000000..35c3098 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/35.png new file mode 100644 index 0000000..0ad4c4e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/36.png new file mode 100644 index 0000000..1360eea Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/37.png new file mode 100644 index 0000000..3ba09fc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/38.png new file mode 100644 index 0000000..734a7cf Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/39.png new file mode 100644 index 0000000..fd3329f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/4.png new file mode 100644 index 0000000..02d6d03 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/40.png new file mode 100644 index 0000000..2c41cc1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/41.png new file mode 100644 index 0000000..113d0c2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/42.png new file mode 100644 index 0000000..c1ab110 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/43.png new file mode 100644 index 0000000..600cfe2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/48.png new file mode 100644 index 0000000..80182e5 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/49.png new file mode 100644 index 0000000..f655fb9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/5.png new file mode 100644 index 0000000..b94667c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/50.png new file mode 100644 index 0000000..2314156 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/51.png new file mode 100644 index 0000000..bfda4f2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/52.png new file mode 100644 index 0000000..3e16767 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/53.png new file mode 100644 index 0000000..37c84ec Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/54.png new file mode 100644 index 0000000..c971dfc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/55.png new file mode 100644 index 0000000..c0f4df8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/56.png new file mode 100644 index 0000000..16374c3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/57.png new file mode 100644 index 0000000..68155ba Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/58.png new file mode 100644 index 0000000..016889e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/6.png new file mode 100644 index 0000000..5b0cb15 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/7.png new file mode 100644 index 0000000..4e3885e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/8.png new file mode 100644 index 0000000..a2c6f48 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/9.png new file mode 100644 index 0000000..0051d1d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/glass_pane_pink.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/glass_pane_pink.properties new file mode 100644 index 0000000..e4515fc --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/glass_pane_pink.properties @@ -0,0 +1,6 @@ +# Stained glass pink +matchBlocks=160 +metadata=6 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/glass_pink.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/glass_pink.properties new file mode 100644 index 0000000..1bbca38 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/6_glass_pink/glass_pink.properties @@ -0,0 +1,6 @@ +# Stained glass pink +matchBlocks=95 +metadata=6 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7.png new file mode 100644 index 0000000..7d0ffb2 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/0.png new file mode 100644 index 0000000..3f07a5d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/1.png new file mode 100644 index 0000000..64fffa3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/10.png new file mode 100644 index 0000000..b0c0d27 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/11.png new file mode 100644 index 0000000..112c6ce Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/16.png new file mode 100644 index 0000000..5a5d27f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/17.png new file mode 100644 index 0000000..9479f0e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/18.png new file mode 100644 index 0000000..d5f2a66 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/19.png new file mode 100644 index 0000000..5c6b9e1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/2.png new file mode 100644 index 0000000..131366f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/20.png new file mode 100644 index 0000000..e4ffc2f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/21.png new file mode 100644 index 0000000..14cc29c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/22.png new file mode 100644 index 0000000..3b41dac Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/23.png new file mode 100644 index 0000000..58a5125 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/24.png new file mode 100644 index 0000000..e1a4030 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/25.png new file mode 100644 index 0000000..736d80c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/26.png new file mode 100644 index 0000000..b2b0aa8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/27.png new file mode 100644 index 0000000..87549c4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/3.png new file mode 100644 index 0000000..f37a2c8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/32.png new file mode 100644 index 0000000..09c3d65 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/33.png new file mode 100644 index 0000000..fa44bdb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/34.png new file mode 100644 index 0000000..542b9f9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/35.png new file mode 100644 index 0000000..5b157bd Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/36.png new file mode 100644 index 0000000..6d485e9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/37.png new file mode 100644 index 0000000..1b5d8ec Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/38.png new file mode 100644 index 0000000..a0fe8a1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/39.png new file mode 100644 index 0000000..92091b8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/4.png new file mode 100644 index 0000000..6d822a4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/40.png new file mode 100644 index 0000000..5172ef3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/41.png new file mode 100644 index 0000000..a281ced Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/42.png new file mode 100644 index 0000000..62a50e3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/43.png new file mode 100644 index 0000000..8fc8b05 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/48.png new file mode 100644 index 0000000..a40bbcd Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/49.png new file mode 100644 index 0000000..5b337fb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/5.png new file mode 100644 index 0000000..82fcfc3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/50.png new file mode 100644 index 0000000..278e7eb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/51.png new file mode 100644 index 0000000..b6f30cc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/52.png new file mode 100644 index 0000000..f0ca09d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/53.png new file mode 100644 index 0000000..7396d2c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/54.png new file mode 100644 index 0000000..7958f25 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/55.png new file mode 100644 index 0000000..8dcc4de Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/56.png new file mode 100644 index 0000000..b5f7d16 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/57.png new file mode 100644 index 0000000..82acb63 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/58.png new file mode 100644 index 0000000..c6bfce6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/6.png new file mode 100644 index 0000000..ccb1f6a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/7.png new file mode 100644 index 0000000..bf67595 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/8.png new file mode 100644 index 0000000..01acf18 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/9.png new file mode 100644 index 0000000..d237ab9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/glass_gray.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/glass_gray.properties new file mode 100644 index 0000000..5284f51 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/glass_gray.properties @@ -0,0 +1,6 @@ +# Stained glass gray +matchBlocks=95 +metadata=7 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/glass_pane_gray.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/glass_pane_gray.properties new file mode 100644 index 0000000..8d37d35 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/7_glass_gray/glass_pane_gray.properties @@ -0,0 +1,6 @@ +# Stained glass gray +matchBlocks=160 +metadata=7 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8.png new file mode 100644 index 0000000..f9bf0fb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/0.png new file mode 100644 index 0000000..8461664 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/1.png new file mode 100644 index 0000000..12a88d0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/10.png new file mode 100644 index 0000000..e2c2673 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/11.png new file mode 100644 index 0000000..076bdbe Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/16.png new file mode 100644 index 0000000..f1ce496 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/17.png new file mode 100644 index 0000000..ab39de7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/18.png new file mode 100644 index 0000000..23231db Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/19.png new file mode 100644 index 0000000..5034a66 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/2.png new file mode 100644 index 0000000..fc9e60e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/20.png new file mode 100644 index 0000000..c885d28 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/21.png new file mode 100644 index 0000000..7db45f0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/22.png new file mode 100644 index 0000000..fefa27c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/23.png new file mode 100644 index 0000000..875306d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/24.png new file mode 100644 index 0000000..ba8e1ce Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/25.png new file mode 100644 index 0000000..c244eee Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/26.png new file mode 100644 index 0000000..5789108 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/27.png new file mode 100644 index 0000000..13cd6f9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/3.png new file mode 100644 index 0000000..9f22722 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/32.png new file mode 100644 index 0000000..f9f64d6 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/33.png new file mode 100644 index 0000000..ab006a3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/34.png new file mode 100644 index 0000000..08dd059 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/35.png new file mode 100644 index 0000000..78ccad0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/36.png new file mode 100644 index 0000000..4606e7a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/37.png new file mode 100644 index 0000000..a6f7531 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/38.png new file mode 100644 index 0000000..bce4bcb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/39.png new file mode 100644 index 0000000..3f3b0ec Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/4.png new file mode 100644 index 0000000..b93f9cd Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/40.png new file mode 100644 index 0000000..662e200 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/41.png new file mode 100644 index 0000000..8fe077a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/42.png new file mode 100644 index 0000000..007d225 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/43.png new file mode 100644 index 0000000..9521d9d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/48.png new file mode 100644 index 0000000..3a492b8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/49.png new file mode 100644 index 0000000..f81553a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/5.png new file mode 100644 index 0000000..b99c20e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/50.png new file mode 100644 index 0000000..3749f75 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/51.png new file mode 100644 index 0000000..a40c84f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/52.png new file mode 100644 index 0000000..99d2700 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/53.png new file mode 100644 index 0000000..1c5770d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/54.png new file mode 100644 index 0000000..7f80e64 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/55.png new file mode 100644 index 0000000..c003c7f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/56.png new file mode 100644 index 0000000..c28a131 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/57.png new file mode 100644 index 0000000..84540bc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/58.png new file mode 100644 index 0000000..5544bc9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/6.png new file mode 100644 index 0000000..1447715 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/7.png new file mode 100644 index 0000000..0e5a7a7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/8.png new file mode 100644 index 0000000..fe3a46f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/9.png new file mode 100644 index 0000000..267f2ae Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/glass_pane_silver.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/glass_pane_silver.properties new file mode 100644 index 0000000..4957508 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/glass_pane_silver.properties @@ -0,0 +1,6 @@ +# Stained glass silver +matchBlocks=160 +metadata=8 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/glass_silver.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/glass_silver.properties new file mode 100644 index 0000000..d2696f7 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/8_glass_silver/glass_silver.properties @@ -0,0 +1,6 @@ +# Stained glass silver +matchBlocks=95 +metadata=8 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9.png new file mode 100644 index 0000000..d4f7c4e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/0.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/0.png new file mode 100644 index 0000000..d30caa4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/0.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/1.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/1.png new file mode 100644 index 0000000..941354d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/1.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/10.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/10.png new file mode 100644 index 0000000..e6e23b0 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/10.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/11.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/11.png new file mode 100644 index 0000000..f0eddb7 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/11.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/16.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/16.png new file mode 100644 index 0000000..fa7272e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/16.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/17.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/17.png new file mode 100644 index 0000000..beebe55 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/17.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/18.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/18.png new file mode 100644 index 0000000..59dd8a8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/18.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/19.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/19.png new file mode 100644 index 0000000..4961e39 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/19.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/2.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/2.png new file mode 100644 index 0000000..771ff3b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/2.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/20.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/20.png new file mode 100644 index 0000000..e8c3134 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/20.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/21.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/21.png new file mode 100644 index 0000000..bd9b84a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/21.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/22.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/22.png new file mode 100644 index 0000000..98f227d Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/22.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/23.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/23.png new file mode 100644 index 0000000..dc7929e Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/23.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/24.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/24.png new file mode 100644 index 0000000..c6c02d9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/24.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/25.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/25.png new file mode 100644 index 0000000..7c5e5ba Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/25.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/26.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/26.png new file mode 100644 index 0000000..b45b386 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/26.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/27.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/27.png new file mode 100644 index 0000000..ba47110 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/27.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/3.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/3.png new file mode 100644 index 0000000..81db31f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/3.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/32.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/32.png new file mode 100644 index 0000000..9cc6fda Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/32.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/33.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/33.png new file mode 100644 index 0000000..97c6860 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/33.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/34.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/34.png new file mode 100644 index 0000000..8790bd3 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/34.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/35.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/35.png new file mode 100644 index 0000000..36aafff Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/35.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/36.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/36.png new file mode 100644 index 0000000..533ce59 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/36.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/37.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/37.png new file mode 100644 index 0000000..21ea0a1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/37.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/38.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/38.png new file mode 100644 index 0000000..c804c82 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/38.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/39.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/39.png new file mode 100644 index 0000000..497a1ff Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/39.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/4.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/4.png new file mode 100644 index 0000000..b1a0f02 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/4.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/40.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/40.png new file mode 100644 index 0000000..ab09ebd Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/40.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/41.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/41.png new file mode 100644 index 0000000..d65c5de Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/41.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/42.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/42.png new file mode 100644 index 0000000..92184c1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/42.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/43.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/43.png new file mode 100644 index 0000000..fb3587a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/43.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/48.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/48.png new file mode 100644 index 0000000..f6d84b8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/48.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/49.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/49.png new file mode 100644 index 0000000..9016a5f Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/49.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/5.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/5.png new file mode 100644 index 0000000..4469277 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/5.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/50.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/50.png new file mode 100644 index 0000000..bba832b Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/50.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/51.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/51.png new file mode 100644 index 0000000..706c0bc Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/51.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/52.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/52.png new file mode 100644 index 0000000..6dc0362 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/52.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/53.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/53.png new file mode 100644 index 0000000..1fcc91a Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/53.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/54.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/54.png new file mode 100644 index 0000000..f1cfbd9 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/54.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/55.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/55.png new file mode 100644 index 0000000..aec8126 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/55.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/56.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/56.png new file mode 100644 index 0000000..0ddd669 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/56.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/57.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/57.png new file mode 100644 index 0000000..7c7bc74 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/57.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/58.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/58.png new file mode 100644 index 0000000..6495fef Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/58.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/6.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/6.png new file mode 100644 index 0000000..663a5d1 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/6.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/7.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/7.png new file mode 100644 index 0000000..9a120cb Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/7.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/8.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/8.png new file mode 100644 index 0000000..39755b8 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/8.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/9.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/9.png new file mode 100644 index 0000000..74bddb4 Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/9.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/glass_cyan.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/glass_cyan.properties new file mode 100644 index 0000000..807c2d4 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/glass_cyan.properties @@ -0,0 +1,6 @@ +# Stained glass cyan +matchBlocks=95 +metadata=9 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/glass_pane_cyan.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/glass_pane_cyan.properties new file mode 100644 index 0000000..cc7d8d6 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/9_glass_cyan/glass_pane_cyan.properties @@ -0,0 +1,6 @@ +# Stained glass cyan +matchBlocks=160 +metadata=9 +connect=block +method=ctm +tiles=0-11 16-27 32-43 48-58 diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/bookshelf.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/bookshelf.properties new file mode 100644 index 0000000..9ce8074 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/bookshelf.properties @@ -0,0 +1,6 @@ +# Converted from /ctm.png +# Individual tiles are in /ctm/default +matchBlocks=47 +method=horizontal +tiles=12-15 +connect=block diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/empty.png b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/empty.png new file mode 100644 index 0000000..dbaa21c Binary files /dev/null and b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/empty.png differ diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/glass.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/glass.properties new file mode 100644 index 0000000..8064c63 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/glass.properties @@ -0,0 +1,6 @@ +# Converted from /ctm.png +# Individual tiles are in /ctm/default +matchBlocks=20 +method=ctm +tiles=0-11 16-27 32-43 48-58 +connect=block diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/glasspane.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/glasspane.properties new file mode 100644 index 0000000..17bceec --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/glasspane.properties @@ -0,0 +1,6 @@ +# Converted from /ctm.png +# Individual tiles are in /ctm/default +matchBlocks=102 +method=ctm +tiles=0-11 16-27 32-43 48-58 +connect=block diff --git a/src/minecraft/assets/minecraft/mcpatcher/ctm/default/sandstone.properties b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/sandstone.properties new file mode 100644 index 0000000..9176eb9 --- /dev/null +++ b/src/minecraft/assets/minecraft/mcpatcher/ctm/default/sandstone.properties @@ -0,0 +1,7 @@ +# Converted from /ctm.png +# Individual tiles are in /ctm/default +matchTiles=sandstone_normal +metadata=0 +method=top +tiles=66 +connect=tile diff --git a/src/minecraft/assets/minecraft/optifine/lang/cs_CZ.lang b/src/minecraft/assets/minecraft/optifine/lang/cs_CZ.lang new file mode 100644 index 0000000..369693e --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/cs_CZ.lang @@ -0,0 +1,586 @@ +# Hlavní +of.general.ambiguous=dvojznačný +of.general.custom=Vlastní +of.general.from=Z +of.general.id=Id +of.general.restart=restart +of.general.smart=Chytrá + +# Klávesy +of.key.zoom=Přiblížení + +# Zprávy +of.message.aa.shaders1=Antialiasing není kompatibilní se Stíny. +of.message.aa.shaders2=Prosím vypni Stíny pro použití téhle možnosti. + +of.message.af.shaders1=Anizotropní Filtrování není kompatibilní se Stíny. +of.message.af.shaders2=Prosím vypni Stíny pro použití téhle možnosti. + +of.message.fr.shaders1=Rychlý Render není kompatibilní se Stíny. +of.message.fr.shaders2=Prosím vypni Stíny pro použití téhle možnosti + +of.message.an.shaders1=3D zobrazení není kompatibilní se Stíny. +of.message.an.shaders2=Prosím vypni Stíny pro použití téhle možnosti. + +of.message.shaders.aa1=Stíny nejsou kompatibilní s Antialiasingem. +of.message.shaders.aa2=Jdi do nastavení Kvality -> Antialiasing na VYPNUTO. + +of.message.shaders.af1=Stíny nejsou kompatibilní s Anizotropním Filtrováním. +of.message.shaders.af2=Jdi do nastavení Kvality -> Anizotropní Filtrování na VYPNUTO. + +of.message.shaders.fr1=Stíny nejsou komoatibilní s Rychlým Renderem. +of.message.shaders.fr2=Jdi do nastavení Výkonu -> Rychlý Render na VYPNUTO. + +of.message.shaders.an1=Stíny nejsou kompatibilní se 3D zobrazením. +of.message.shaders.an2=Jdi do nastavení Ostatního -> 3D zobrazení na VYPNUTO. + +of.message.newVersion=Nová verze §eOptiFinu§f je k dispozici: §e%s§f +of.message.java64Bit=Můžeš si nainstalovat §e64-bitovou Javu§f pro zvýšení výkonu. +of.message.openglError=§eChyba OpenGL§f: %s (%s) + +of.message.shaders.loading=Načítám stíny: %s + +of.message.other.reset=Vyresetovat všechno nastavení videa (grafiky) na výchozí hodnoty? + +of.message.loadingVisibleChunks=Načítám vididetlné chunky + +# Nastavení Grafiky + +options.graphics.tooltip.1=Vizuální kvality +options.graphics.tooltip.2= Rychlá - nižší kvalita, rychlejší +options.graphics.tooltip.3= Pěkná - vyšší kvalita, pomalejší +options.graphics.tooltip.4=Mění vzhled mraků, listí, vody, +options.graphics.tooltip.5=stínů a stran trávníků. + +of.options.renderDistance.tiny=Maličký +of.options.renderDistance.short=Malý +of.options.renderDistance.normal=Normální +of.options.renderDistance.far=Velký +of.options.renderDistance.extreme=Extrémní + +options.renderDistance.tooltip.1=Dohled +options.renderDistance.tooltip.2= 2 Maličký - 32m (nejrychlejší) +options.renderDistance.tooltip.3= 4 Malý - 64m (rychlejší) +options.renderDistance.tooltip.4= 8 Normální - 128m +options.renderDistance.tooltip.5= 16 Velký - 256m (pomalejší) +options.renderDistance.tooltip.6= 32 Extrémní - 512m (nejpomalejší!) +options.renderDistance.tooltip.7=Extrémní Viditelná vzdálenost je velmi výkonově náročná! +options.renderDistance.tooltip.8=Hodnoty nad 16 Velká jsou pouze pro lokální světy. + +options.ao.tooltip.1=Vyhlazené osvětlení. +options.ao.tooltip.2= VYPNUTO - žádné vyhlazené osvětlení (rychlé) +options.ao.tooltip.3= Minimální - jednoduché vyhlazené osvětlení (pomalejší) +options.ao.tooltip.4= Maximální - kompletně vyhlazené osvětlení (nejpomalejší) + +options.framerateLimit.tooltip.1=Maximální FPS +options.framerateLimit.tooltip.2= VSync - limitované pro max počet FPS pro monitor (60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - nastavitelné +options.framerateLimit.tooltip.4= Neomezené - bez limitu (nejrychlejší) +options.framerateLimit.tooltip.5=FPS nepřekročí +options.framerateLimit.tooltip.6=stanovenou hondotu. +of.options.framerateLimit.vsync=VSync + +of.options.AO_LEVEL=Úroveň Vyhlazeného Osvětlení +of.options.AO_LEVEL.tooltip.1=Úroveň vyhlazeného osvětlení +of.options.AO_LEVEL.tooltip.2= VYPNUTO - žádné stíny +of.options.AO_LEVEL.tooltip.3= 50%% - světlé stíny +of.options.AO_LEVEL.tooltip.4= 100%% - tmavé stíny + +options.viewBobbing.tooltip.1=Více realistický pohyb +options.viewBobbing.tooltip.2=Pokud používáš mipmaping, nastav na VYPNUTO pro nejlepší výsledky. + +options.guiScale.tooltip.1=Velikost GUI +options.guiScale.tooltip.2= Automatická - maximální velikost +options.guiScale.tooltip.3= Malá, Normální, Velká - 1x až 3x +options.guiScale.tooltip.4= 4x do 10x - dostupné na 4K obrazovkách +options.guiScale.tooltip.5=Liché hodnoty (1x, 3x, 5x ...) nejsou kompatibilní s písmem Unicode. +options.guiScale.tooltip.6=Menší GUI mohou být rychlejší. + +options.vbo.tooltip.1=Vertexově Vyrovnávající objekty +options.vbo.tooltip.2=Používá alternativní model renderování, který je +options.vbo.tooltip.3=rychlejší (5-10%%) oproti výchozímu renderování. + +options.gamma.tooltip.1=Zvýší jas tmavých objektů. +options.gamma.tooltip.2= Tmavý - standardní jas +options.gamma.tooltip.3= 1-99%% - nastavitelné +options.gamma.tooltip.4= Jasný - maximální jas tmavých objektů +options.gamma.tooltip.5=Tato možnost nezmění jas +options.gamma.tooltip.6=úplně tmavých objektů. + +options.anaglyph.tooltip.1=3D Zobrazení +options.anaglyph.tooltip.2=Zapne stereoskopické 3D, které používá dané barvy +options.anaglyph.tooltip.3=pro dané oko. +options.anaglyph.tooltip.4=Vyžaduje červeno-modré brýle pro lepší vidění. + +of.options.ALTERNATE_BLOCKS=Alternativní Bloky +options.blockAlternatives.tooltip.1=Alternativní Bloky +options.blockAlternatives.tooltip.2=Používá alternativní model bloku pro některé modely. +options.blockAlternatives.tooltip.3=Záleží na vybraném balíčku zdrojů. + +of.options.FOG_FANCY=Mlha +of.options.FOG_FANCY.tooltip.1=Typ mlhy +of.options.FOG_FANCY.tooltip.2= Rychlá - rychlejší mlha +of.options.FOG_FANCY.tooltip.3= Pěkná - pomalejší mlha, vypadá pěkněji +of.options.FOG_FANCY.tooltip.4= VYPNUTO - žádná mlha, rychlejší +of.options.FOG_FANCY.tooltip.5=Pěkná mlha se aktivuje jen když je podporována +of.options.FOG_FANCY.tooltip.6=grafickou kartou. + +of.options.FOG_START=Začátek Mlhy +of.options.FOG_START.tooltip.1=Start Mlhy +of.options.FOG_START.tooltip.2= 0.2 - mlha začne přímo u hráče +of.options.FOG_START.tooltip.3= 0.8 - mlha začne daleko od hráče +of.options.FOG_START.tooltip.4=Tato možnost většinou neovlivňuje výkon. + +of.options.CHUNK_LOADING=Načítaní Chunků +of.options.CHUNK_LOADING.tooltip.1= Načítaní Chunků +of.options.CHUNK_LOADING.tooltip.2= Výchozí - nestabilní FPS při načítání chunků +of.options.CHUNK_LOADING.tooltip.3= Plynulé - stabilní FPS +of.options.CHUNK_LOADING.tooltip.4= Multi-Jádra - stabilní FPS, 3x rychlejší načítání světa +of.options.CHUNK_LOADING.tooltip.5=Plynulé a Multi-Jádra - odstraní sekání a +of.options.CHUNK_LOADING.tooltip.6=zmrazování způsobené načítáním chunků. +of.options.CHUNK_LOADING.tooltip.7=Multi-Jádro může 3x zrychlit načítání světa a +of.options.CHUNK_LOADING.tooltip.8=zvýšit FPS používáním druhého jádra. +of.options.chunkLoading.smooth=Plynulé +of.options.chunkLoading.multiCore=Multi-Jádro + +of.options.shaders=Stíny... +of.options.shadersTitle=Stíny + +of.options.shaders.packNone=VYPNUTO +of.options.shaders.packDefault=(vložené) + +of.options.shaders.ANTIALIASING=Antialiasing +of.options.shaders.NORMAL_MAP=Normální Mapa +of.options.shaders.SPECULAR_MAP=Zrcadlová Mapa +of.options.shaders.RENDER_RES_MUL=Kvalita Renderu +of.options.shaders.SHADOW_RES_MUL=Kvalita Osvětlení +of.options.shaders.HAND_DEPTH_MUL=Ruční Hloubka +of.options.shaders.CLOUD_SHADOW=Stíny mraků +of.options.shaders.OLD_HAND_LIGHT=Staré Přední Osvětlení +of.options.shaders.OLD_LIGHTING=Staré Osvětlení +of.options.shaders.SHADER_PACK=Balíček Stínů + +of.options.shaders.shadersFolder=Složka Stínů +of.options.shaders.shaderOptions=Možnosti Stínů... + +of.options.shaderOptionsTitle=Možnosti Stínů + +of.options.quality=Kvalita... +of.options.qualityTitle=Nastavení Kvality + +of.options.details=Detaily... +of.options.detailsTitle=Nastavení Detailů + +of.options.performance=Výkon... +of.options.performanceTitle=Nastavení Výkonu + +of.options.animations=Animace... +of.options.animationsTitle=Nastavení Animací + +of.options.other=Ostatní... +of.options.otherTitle=Další Nastavení + +of.options.other.reset=Vyresetovat Nastavení Videa/Grafiky ... + +of.shaders.profile=Profil + +# Kvalita + +of.options.mipmap.bilinear=Bilineání +of.options.mipmap.linear=Lineární +of.options.mipmap.nearest=Nejbližší +of.options.mipmap.trilinear=Trilineární + +options.mipmapLevels.tooltip.1=Vizuální efekty mohou udělat vzdálenější objekty pěknější +options.mipmapLevels.tooltip.2=vyhlazováním a detailními texturami. +options.mipmapLevels.tooltip.3= VYPNUTO - žádné vyhlazování +options.mipmapLevels.tooltip.4= 1 - minimální vyhlazování +options.mipmapLevels.tooltip.5= 4 - maximální vyhlazování +options.mipmapLevels.tooltip.6=Tato možnost většinou neovlivňuje výkon. + +of.options.MIPMAP_TYPE=Typ Mipmapy +of.options.MIPMAP_TYPE.tooltip.1=Vizuální efekty mohou udělat vzdálenější objekty pěknější +of.options.MIPMAP_TYPE.tooltip.2=vyhlazováním a detailními texturami. +of.options.MIPMAP_TYPE.tooltip.3= Nejbližší - hrubé vyhlazování (nejrychlejší) +of.options.MIPMAP_TYPE.tooltip.4= Lineární - normální vyhlazování +of.options.MIPMAP_TYPE.tooltip.5= Bilineární - dobré vyhlazování +of.options.MIPMAP_TYPE.tooltip.6= Trilineární - nejlepší vyhlazování (nejpomalejší) + + +of.options.AA_LEVEL=Antialiasing +of.options.AA_LEVEL.tooltip.1=Antialiasing +of.options.AA_LEVEL.tooltip.2= VYPNUTO - (výchozí) žádný Antialiasing (rychlé) +of.options.AA_LEVEL.tooltip.3= 2-16 - vyhlazované hrany a lajny (pomalé) +of.options.AA_LEVEL.tooltip.4=Antialiasing vyhlazuje rozviklané hrany a +of.options.AA_LEVEL.tooltip.5=přechody ostrých barev. +of.options.AA_LEVEL.tooltip.6=Pokud je zapnuto, výrazně zmenší FPS. +of.options.AA_LEVEL.tooltip.7=Ne všechny úrovně jsou podporované všemi grafickými kartami. +of.options.AA_LEVEL.tooltip.8=Efektivní po RESTARTU! + +of.options.AF_LEVEL=Antizotropní Filtrování +of.options.AF_LEVEL.tooltip.1= Antizotropní Filtrování +of.options.AF_LEVEL.tooltip.2= VYPNUTO - (výchozí) standartní detaily textur (rychlé) +of.options.AF_LEVEL.tooltip.3= 2-16 - lepší detaily v mipmapovaných texturách (pomalé) +of.options.AF_LEVEL.tooltip.4= Antizotropní Filtrování zachová všechny detaily v +of.options.AF_LEVEL.tooltip.5=mipmapovaných texturách. +of.options.AF_LEVEL.tooltip.6=Pokud je zapnuto, výrazně sníží FPS. + +of.options.CLEAR_WATER=Čistá Voda +of.options.CLEAR_WATER.tooltip.1= Čistá Voda +of.options.CLEAR_WATER.tooltip.2= ZAPNUTO - čistá, průhledná voda +of.options.CLEAR_WATER.tooltip.3= VYPNUTO - výchozí voda + +of.options.RANDOM_MOBS=Náhodní Mobové +of.options.RANDOM_MOBS.tooltip.1= Náhodní Mobové +of.options.RANDOM_MOBS.tooltip.2= VYPNUTO - žádní náhodní mobové, rychlejší +of.options.RANDOM_MOBS.tooltip.3= ZAPNUTO - náhodní mobové, pomalejší +of.options.RANDOM_MOBS.tooltip.4=Funkce náhodní mobové používá náhodně textury pro moby ve hře. +of.options.RANDOM_MOBS.tooltip.5=Vyžaduje balíček textur, který má více textur mobů. + +of.options.BETTER_GRASS=Lepší Trávník +of.options.BETTER_GRASS.tooltip.1=Lepší Trávník +of.options.BETTER_GRASS.tooltip.2= VYPNUTO - výchozí strana trávníku, rychlejší +of.options.BETTER_GRASS.tooltip.3= Rychlá - plná strana trávníku, pomalejší +of.options.BETTER_GRASS.tooltip.4= Pěkná - dynamická strana trávníku, nepomalejší + +of.options.BETTER_SNOW=Lepší Sníh +of.options.BETTER_SNOW.tooltip.1=Lepší sníh +of.options.BETTER_SNOW.tooltip.2= VYPNUTO - výchozí sníh, rychlejší +of.options.BETTER_SNOW.tooltip.3= ZAPNUTO - lepší sníh, pomalejší +of.options.BETTER_SNOW.tooltip.4=Zobrazuje sníh pod průhlednými bloky (plot, vysoká tráva) +of.options.BETTER_SNOW.tooltip.5=když sousedí se sněhovými bloky. + +of.options.CUSTOM_FONTS=Vlastní Písmo +of.options.CUSTOM_FONTS.tooltip.1= Vlastní Písmo +of.options.CUSTOM_FONTS.tooltip.2= ZAPNUTO - používá vlastní písmo (výchozí), pomalejší +of.options.CUSTOM_FONTS.tooltip.3= VYPNUTO - používá výchozí písmo, rychlejší +of.options.CUSTOM_FONTS.tooltip.4=Vlastní písmo záleží na vybraném +of.options.CUSTOM_FONTS.tooltip.5=balíčku zdrojů. + +of.options.CUSTOM_COLORS=Vlastní Barvy +of.options.CUSTOM_COLORS.tooltip.1= Vlastní Barvy +of.options.CUSTOM_COLORS.tooltip.2= ZAPNUTO - používá vlastní barvy (výchozí), pomalejší +of.options.CUSTOM_COLORS.tooltip.3= VYPNUTO - používá výchozí barvy, rychlejší +of.options.CUSTOM_COLORS.tooltip.4=Vlastní barvy záleží na vybraném +of.options.CUSTOM_COLORS.tooltip.5=balíčku zdrojů. + +of.options.SWAMP_COLORS=Barvy v Bažinách +of.options.SWAMP_COLORS.tooltip.1= Barvy v Bažinách +of.options.SWAMP_COLORS.tooltip.2= ZAPNUTO - používá barvy v bažinách (výchozí), pomalejší +of.options.SWAMP_COLORS.tooltip.3= VYPNUTO - nepoužívá barvy v bažinách, rychlejší +of.options.SWAMP_COLORS.tooltip.4=Barvy v bažinách ovlivňují trávník, listy, lijány a vodu. + +of.options.SMOOTH_BIOMES=Vyhlazené Biomy +of.options.SMOOTH_BIOMES.tooltip.1=Vyhlazené Biomy +of.options.SMOOTH_BIOMES.tooltip.2= ZAPNUTO - vyhlazování hranic biomů (výchozí), pomalejší +of.options.SMOOTH_BIOMES.tooltip.3= VYPNUTO - žádné vyhlazování hranic biomů, rychlejší. +of.options.SMOOTH_BIOMES.tooltip.4=Vyhlazování hranic biomů je dáno změnou a +of.options.SMOOTH_BIOMES.tooltip.5=průměru všech sousedících bloků. +of.options.SMOOTH_BIOMES.tooltip.6=Ovlivňuje trávník, listí, lijány a vodu. + +of.options.CONNECTED_TEXTURES=Spojené Textury +of.options.CONNECTED_TEXTURES.tooltip.1=Spojené Textury +of.options.CONNECTED_TEXTURES.tooltip.2= VYPNUTO - žádné spojené textury (výchozí), rychlejší +of.options.CONNECTED_TEXTURES.tooltip.3= Rychlá - rychle spojené textury +of.options.CONNECTED_TEXTURES.tooltip.4= Pěkná - pěkně spojené textury +of.options.CONNECTED_TEXTURES.tooltip.5=Spojené textury spojují textury skla, +of.options.CONNECTED_TEXTURES.tooltip.6=pískovce a knihoven když jsou +of.options.CONNECTED_TEXTURES.tooltip.7=vedle sebe. Spojené textury záleží +of.options.CONNECTED_TEXTURES.tooltip.8=na vybraném balíčku zdrojů. + +of.options.NATURAL_TEXTURES=Naturální Textury +of.options.NATURAL_TEXTURES.tooltip.1=Naturální Textury +of.options.NATURAL_TEXTURES.tooltip.2= VYPNUTO - žádné naturální textury, rychlejší +of.options.NATURAL_TEXTURES.tooltip.3= ZAPNUTO - používá naturální textury +of.options.NATURAL_TEXTURES.tooltip.4=Naturální textury odstraňují vzor +of.options.NATURAL_TEXTURES.tooltip.5=vytvořený opakováním bloků stejných typů. +of.options.NATURAL_TEXTURES.tooltip.6=Používá otočené a převrácené základy +of.options.NATURAL_TEXTURES.tooltip.7=textury bloků. Nastavení pro naturální textury +of.options.NATURAL_TEXTURES.tooltip.8=je ovlivňováno vybraným balíčkem zdrojů. + +of.options.CUSTOM_SKY=Vlastní Obloha +of.options.CUSTOM_SKY.tooltip.1=Vlastní Obloha +of.options.CUSTOM_SKY.tooltip.2= ZAPNUTO - používá vlastní textury oblohy (výchozí), pomalejší +of.options.CUSTOM_SKY.tooltip.3= VYPNUTO - výchozí obloha, rychlejší +of.options.CUSTOM_SKY.tooltip.4=Vlastní textura oblohy je ovlivňována vybraným +of.options.CUSTOM_SKY.tooltip.5=balíčkem zdrojů. + +of.options.CUSTOM_ITEMS=Vlastní Itemy +of.options.CUSTOM_ITEMS.tooltip.1=Vlastní Itemy +of.options.CUSTOM_ITEMS.tooltip.2= ZAPNUTO - vlastní textury itemů (výchozí), pomalejší +of.options.CUSTOM_ITEMS.tooltip.3= VYPNUTO - výchozí textury itemů, rychlejší +of.options.CUSTOM_ITEMS.tooltip.4=Vlastní itemy záleží na vybraném +of.options.CUSTOM_ITEMS.tooltip.5=balíčku zdrojů. + +of.options.CUSTOM_ENTITY_MODELS=Vlastní modely entit +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=Vlastní modely entit +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= ZAPNUTO - vlastní modely entit (výchozí), pomalé +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= VYPNUTO - výchozí modely entit, rychlejší +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=Vlastní modely entit záleží na vybraném +of.options.CUSTOM_ENTITY_MODELS.tooltip.5=balíčku zdrojů. + +# Detaily + +of.options.CLOUDS=Mraky +of.options.CLOUDS.tooltip.1=Mraky +of.options.CLOUDS.tooltip.2= Výchozí - z nastavení Grafiky +of.options.CLOUDS.tooltip.3= Rychlá - nižší kvalita, rychlejší +of.options.CLOUDS.tooltip.4= Pěkná - vyšší kvalita, pěknější +of.options.CLOUDS.tooltip.5= VYPNUTO - žádné mraky, nejrychlejší +of.options.CLOUDS.tooltip.6=Rychlé mraky jsou 2D. +of.options.CLOUDS.tooltip.7=Pěkné mraky jsou 3D. + +of.options.CLOUD_HEIGHT=Výška Mraků +of.options.CLOUD_HEIGHT.tooltip.1=Výška Mraků +of.options.CLOUD_HEIGHT.tooltip.2= VYPNUTO - výchozí výška +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - nad limitem stavění + +of.options.TREES=Stromy +of.options.TREES.tooltip.1=Stromy +of.options.TREES.tooltip.2= Výchozí - z nastavení Grafiky +of.options.TREES.tooltip.3= Rychlá - nejnižší kvalita, nejrychlejší +of.options.TREES.tooltip.4= Chytrá - vyšší kvalita, rychlé +of.options.TREES.tooltip.5= Pěkná - nejvyšší kvalita, nejpomalejší +of.options.TREES.tooltip.6=Rychlé stromy nemají průhledné listí. +of.options.TREES.tooltip.7=Pěkné a Chytré stromy mají průhledné listí. + +of.options.RAIN=Sníh a Déšť +of.options.RAIN.tooltip.1=Sníh a Déšť +of.options.RAIN.tooltip.2= Výchozí - z nastavení Grafiky +of.options.RAIN.tooltip.3= Rychlá - lehký sníh/déšť, rychlejší +of.options.RAIN.tooltip.4= Pěkná - velký sníh/déšť, pomalejší +of.options.RAIN.tooltip.5= VYPNUTO - žádný sníh/déšť, nejrychlejší +of.options.RAIN.tooltip.6=Pokud je déšť vypnutý, jeho zvuky stále +of.options.RAIN.tooltip.7=hrají. + +of.options.SKY=Obloha +of.options.SKY.tooltip.1=Obloha +of.options.SKY.tooltip.2= ZAPNUTO - obloha je viditelná, pomalejší +of.options.SKY.tooltip.3= VYPNUTO - obloha nejde vidět, rychlejší +of.options.SKY.tooltip.4=Pokud je obloha vypnutá, měsíc a slunce půjdou stále vidět. + +of.options.STARS=Hvězdy +of.options.STARS.tooltip.1=Hvězdy +of.options.STARS.tooltip.2= ZAPNUTO - hvězdy jsou viditelné, pomalejší +of.options.STARS.tooltip.3= VYPNUTO - hvězdy nejdou vidět, rychlejší + +of.options.SUN_MOON=Slunce a Měsíc +of.options.SUN_MOON.tooltip.1=Slunce a Měsíc +of.options.SUN_MOON.tooltip.2= ZAPNUTO - slunce a měsíc lze vidět (výchozí) +of.options.SUN_MOON.tooltip.3= VYPNUTO - slunce a měsíc nelze vidět, rychlejší + +of.options.SHOW_CAPES=Zobrazovat Kápě +of.options.SHOW_CAPES.tooltip.1=Zobrazovat Kápě +of.options.SHOW_CAPES.tooltip.2= ZAPNUTO - zobrazovat kápě hráčů (výchozí) +of.options.SHOW_CAPES.tooltip.3= VYPNUTO - nezobrazovat kápě hráčů + +of.options.TRANSLUCENT_BLOCKS=Průsvitné Bloky +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Průsvitné Bloky +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Pěkná - správné míchání barev (výchozí) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Rychlá - rychlé míchání barev (rychlejší) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Ovládá míchání barev průhledných bloků +of.options.TRANSLUCENT_BLOCKS.tooltip.5=s rozdílnou barvou (barevné sklo, voda, led) +of.options.TRANSLUCENT_BLOCKS.tooltip.6=když jsou položeny za sebou s mezerou mezi nimi. + +of.options.HELD_ITEM_TOOLTIPS=Popisek k Drženému Itemu +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Popisek k Drženému Itemu +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= ZAPNUTO - zobrazovat popisky (výchozí) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= VYPNUTO - nezobrazovat popisky + +of.options.ADVANCED_TOOLTIPS=Pokročilé Popisky +of.options.ADVANCED_TOOLTIPS.tooltip.1=Pokročilé Popisky +of.options.ADVANCED_TOOLTIPS.tooltip.2= ZAPNUTO - zobrazit pokročilé popisky +of.options.ADVANCED_TOOLTIPS.tooltip.3= VYPNUTO - nezobrazovat pokročilé popisky (výchozí) +of.options.ADVANCED_TOOLTIPS.tooltip.4=Pokročilé popisky zobrazí pokročilé informace pro +of.options.ADVANCED_TOOLTIPS.tooltip.5=itemy (id, durabilita) a pro možnosti stínů +of.options.ADVANCED_TOOLTIPS.tooltip.6=(id, zdroj, výchozí hodnota). + +of.options.DROPPED_ITEMS=Vyhozené Itemy +of.options.DROPPED_ITEMS.tooltip.1=Vyhozené Itemy +of.options.DROPPED_ITEMS.tooltip.2= Výchozí - podle nastavení Grafiky +of.options.DROPPED_ITEMS.tooltip.3= Rychlá - vyhozené itemy ve 2D, rychlejší +of.options.DROPPED_ITEMS.tooltip.4= Pěkná - vyhozené itemy ve 3D, pomalejší + +options.entityShadows.tooltip.1=Stíny Entit +options.entityShadows.tooltip.2= ZAPNUTO - zobrazovat stíny entit +options.entityShadows.tooltip.3= VYPNUTO - nezobrazovat stíny entit + +of.options.VIGNETTE=Ztmavení +of.options.VIGNETTE.tooltip.1=Vizuální efekt, který ztmaví okraje obrazovky. +of.options.VIGNETTE.tooltip.2= Výchozí - záleží na nastavení Grafiky (výchozí) +of.options.VIGNETTE.tooltip.3= Rychlá - ztmavení vypnuto (rychlejší) +of.options.VIGNETTE.tooltip.4= Pěkná - ztmavení zapnuto (pomalejší) +of.options.VIGNETTE.tooltip.5=Ztmavení může mít veliký vliv na FPS, +of.options.VIGNETTE.tooltip.6=speciálně při hraní ve fullscreenu. +of.options.VIGNETTE.tooltip.7=Efekt ztmavení je velmi jemný a dá se bezpečně +of.options.VIGNETTE.tooltip.8=vypnout. + +of.options.DYNAMIC_FOV=Dynamické FOV +of.options.DYNAMIC_FOV.tooltip.1=Dynamické FOV +of.options.DYNAMIC_FOV.tooltip.2= ZAPNUTO - zapne dynamické FOV (výchozí) +of.options.DYNAMIC_FOV.tooltip.3= VYPNUTO - vypne dynamické FOV +of.options.DYNAMIC_FOV.tooltip.4=Mění pole pohledu (FOV) při létání, sprintování +of.options.DYNAMIC_FOV.tooltip.5=nebo při natahování luku. + +of.options.DYNAMIC_LIGHTS=Dynamické Světla +of.options.DYNAMIC_LIGHTS.tooltip.1=Dynamické Světla +of.options.DYNAMIC_LIGHTS.tooltip.2= VYPNUTO - žádná dynamícká světla (výchozí) +of.options.DYNAMIC_LIGHTS.tooltip.3= Rychlá - rychlá dynamická světla (aktualizace každých 500ms) +of.options.DYNAMIC_LIGHTS.tooltip.4= Pěkná - pěkná dynamická světla (aktualizováno vždy) +of.options.DYNAMIC_LIGHTS.tooltip.5=Pokud je zapnuto a v ruce, na zemi nebo v ruce +of.options.DYNAMIC_LIGHTS.tooltip.6=jiného hráče je držen svítící item (louč, světlit, atd.) +of.options.DYNAMIC_LIGHTS.tooltip.7=tak se osvětlí vše kolem. + +# Výkon + +of.options.SMOOTH_FPS=Vyhlazené FPS +of.options.SMOOTH_FPS.tooltip.1=Stabilizuje FPS velikým nátlakem na grafický adaptér. +of.options.SMOOTH_FPS.tooltip.2= VYPNUTO - žádná stabilizace, FPS mohou kolísat +of.options.SMOOTH_FPS.tooltip.3= ZAPNUTO - stabilizace FPS +of.options.SMOOTH_FPS.tooltip.4=Tato možnost záleží na grafickém adaptéru a jeho efekt +of.options.SMOOTH_FPS.tooltip.5=není vždy vidět. + +of.options.SMOOTH_WORLD=Vyhlazený Svět +of.options.SMOOTH_WORLD.tooltip.1=Odstraní lagy způsobené interním serverem. +of.options.SMOOTH_WORLD.tooltip.2= VYPNUTO - žádná stabilizace, FPS mohou kolísat +of.options.SMOOTH_WORLD.tooltip.3= ZAPNUTO - stabilizace FPS +of.options.SMOOTH_WORLD.tooltip.4=Stabilizuje FPS rozdělením načítání světa. +of.options.SMOOTH_WORLD.tooltip.5=Funguje jen na lokálních světech (hra pro jednoho hráče). + +of.options.FAST_RENDER=Rychlý Render +of.options.FAST_RENDER.tooltip.1=Rychlý Render +of.options.FAST_RENDER.tooltip.2= VYPNUTO - standardní render +of.options.FAST_RENDER.tooltip.3= ZAPNUTO - vyvážený render (rychlejší) +of.options.FAST_RENDER.tooltip.4=Používáním vyváženěho renderovacího algoritmu se může snížít +of.options.FAST_RENDER.tooltip.5=využití GPU, což může zvýšit FPS. + +of.options.FAST_MATH=Rychlá Matematika +of.options.FAST_MATH.tooltip.1=Rychlá Matematika +of.options.FAST_MATH.tooltip.2= VYPNUTO - standardní matematika +of.options.FAST_MATH.tooltip.3= ZAPNUTO - rychlá matematika +of.options.FAST_MATH.tooltip.4=Používá vyvážené sin() a cos() funkce, což může +of.options.FAST_MATH.tooltip.5=lépe šetřit CPU a zvýšit FPS. + +of.options.CHUNK_UPDATES=Načítání Chunků +of.options.CHUNK_UPDATES.tooltip.1=Načítání Chunků +of.options.CHUNK_UPDATES.tooltip.2= 1 - pomalejší načítání světa, vyšší FPS (výchozí) +of.options.CHUNK_UPDATES.tooltip.3= 3 - rychlejší načítání světa, nižší FPS +of.options.CHUNK_UPDATES.tooltip.4= 5 - nejrychlejší načítání světa, nejnižší FPS +of.options.CHUNK_UPDATES.tooltip.5=Číslo chunků načtených za 1 FPS, +of.options.CHUNK_UPDATES.tooltip.6=Vyšší hodnoty mohou FPS snížit. + +of.options.CHUNK_UPDATES_DYNAMIC=Dynamické Načítání +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Dynamické načítání chunků +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= VYPNUTO - (výchozí) standardní počet chunků na FPS +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= ZAPNUTO - více chunků, když se hráč nehýbe +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=Dynamické načítání načte více chunků +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=když se hráč nehýbe, svět se načte rychleji. + +of.options.LAZY_CHUNK_LOADING=Líné Načítání Chunků +of.options.LAZY_CHUNK_LOADING.tooltip.1=Pomalé načítání chunků +of.options.LAZY_CHUNK_LOADING.tooltip.2= VYPNUTO - výchozí načítání serverových chunků +of.options.LAZY_CHUNK_LOADING.tooltip.3= ZAPNUTO - pomalé načítání serverových chunků (plynulejší) +of.options.LAZY_CHUNK_LOADING.tooltip.4=Udělá plynulejší načítání chunků na integrovaném serveru +of.options.LAZY_CHUNK_LOADING.tooltip.5=jejich rozdělováním na několik tiků. +of.options.LAZY_CHUNK_LOADING.tooltip.6=Pokud je VYPNUTO, některé části světa se nenačtou správně. +of.options.LAZY_CHUNK_LOADING.tooltip.7=Efektivní pouze pro lokální světy a 1-jádrové CPU. + +# Animace + +of.options.animation.allOn=Vše ZAPNUTO +of.options.animation.allOff=Vše VYPNUTO +of.options.animation.dynamic=Dynamické + +of.options.ANIMATED_WATER=Animovaná Voda +of.options.ANIMATED_LAVA=Animovaná Láva +of.options.ANIMATED_FIRE=Animovaný Oheň +of.options.ANIMATED_PORTAL=Animovaný Portál +of.options.ANIMATED_REDSTONE=Animovaný Redstone +of.options.ANIMATED_EXPLOSION=Animované Exploze +of.options.ANIMATED_FLAME=Animovaný Požár +of.options.ANIMATED_SMOKE=Animovaný Kouř +of.options.VOID_PARTICLES=Částice Voidu +of.options.WATER_PARTICLES=Částice Vody +of.options.RAIN_SPLASH=Částice Deště +of.options.PORTAL_PARTICLES=Částice Portálu +of.options.POTION_PARTICLES=Částice Lektvarů +of.options.DRIPPING_WATER_LAVA=Tekoucí Voda/Láva +of.options.ANIMATED_TERRAIN=Animovaný Terén +of.options.ANIMATED_TEXTURES=Animované Textury +of.options.FIREWORK_PARTICLES=Částice Rachejtle + +# Ostatní + +of.options.LAGOMETER=Lagometer +of.options.LAGOMETER.tooltip.1=Zobrazí lagometer na ladící obrazovce (F3). +of.options.LAGOMETER.tooltip.2=* Oranžová - Sbírka zbytečné paměti +of.options.LAGOMETER.tooltip.3=* Světle Modrá - Tik +of.options.LAGOMETER.tooltip.4=* Modrá - Plánované soubory +of.options.LAGOMETER.tooltip.5=* Fialová - Načítání chunků +of.options.LAGOMETER.tooltip.6=* Červená - Přednačtené chunky +of.options.LAGOMETER.tooltip.7=* Žlutá - Kontrola viditelnosti +of.options.LAGOMETER.tooltip.8=* Zelená - Načítání terénu + +of.options.PROFILER=Ladící Profil +of.options.PROFILER.tooltip.1=Ladící Profil +of.options.PROFILER.tooltip.2= ZAPNUTO - ladící profil je aktivní, pomalejší +of.options.PROFILER.tooltip.3= VYPNUTO - ladící profil je neaktivní, rychlejší +of.options.PROFILER.tooltip.4=Ladící profil sbírá a zobrazuje informace když +of.options.PROFILER.tooltip.5=je otevřena ladící obrazovka (F3). + +of.options.WEATHER=Počasí +of.options.WEATHER.tooltip.1=Počasí +of.options.WEATHER.tooltip.2= ZAPNUTO - počasí je aktivní, pomalejší +of.options.WEATHER.tooltip.3= VYPNUTO - počasí je neaktivní, rychlejší +of.options.WEATHER.tooltip.4=Počasí ovládá deště, sněžení a bouřky. +of.options.WEATHER.tooltip.5=Ovládání počasí je možné pouze pro lokální světy. + +of.options.time.dayOnly=Pouze Den +of.options.time.nightOnly=Pouze Noc + +of.options.TIME=Čas +of.options.TIME.tooltip.1=Čas +of.options.TIME.tooltip.2= Výchozí - normální denní/noční cyklus +of.options.TIME.tooltip.3= Pouze Den - pouze den +of.options.TIME.tooltip.4= Pouze Noc - pouze noc +of.options.TIME.tooltip.5=Nastavení času je efektivní jen v KREATIVNíM módu +of.options.TIME.tooltip.6=a pro lokální světy. + +options.fullscreen.tooltip.1=Fullscreen +options.fullscreen.tooltip.2= ZAPNUTO - použít celoobrázkový mód +options.fullscreen.tooltip.3= VYPNUTO - použít mód v okně +options.fullscreen.tooltip.4=Fullscreen mód může být rychlejší než +options.fullscreen.tooltip.5=mód v okně, záleží na GPU. + +of.options.FULLSCREEN_MODE=Fullscreen Mód +of.options.FULLSCREEN_MODE.tooltip.1=Celoobrázkový mód +of.options.FULLSCREEN_MODE.tooltip.2= Výchozí - používá hlavní rozlišení, pomalejší +of.options.FULLSCREEN_MODE.tooltip.3= ŠxV - používá vlastní rozlišení, může být rychlejší +of.options.FULLSCREEN_MODE.tooltip.4=Vybrané rozlišení je používáno ve fullscreenu (F11). +of.options.FULLSCREEN_MODE.tooltip.5=Nižší rozlišení mohou být rychlejší. + +of.options.SHOW_FPS=Zobrazit FPS +of.options.SHOW_FPS.tooltip.1=Kompaktně zobrazí informace o FPS a renderu. +of.options.SHOW_FPS.tooltip.2= C: - načítání chunků +of.options.SHOW_FPS.tooltip.3= E: - načtené entity + blokové entity +of.options.SHOW_FPS.tooltip.4= U: - přednačtené chunky +of.options.SHOW_FPS.tooltip.5=Informace o FPS se zobrazí jen, +of.options.SHOW_FPS.tooltip.6=když je ladící obrazovka (F3) zneviditelněná. + +of.options.save.default=Výchozí (2s) +of.options.save.20s=20s +of.options.save.3min=3min +of.options.save.30min=30min + +of.options.AUTOSAVE_TICKS=Auto-ukládání +of.options.AUTOSAVE_TICKS.tooltip.1=Interval auto-ukládání +of.options.AUTOSAVE_TICKS.tooltip.2=Výchozí interval auto-ukládání (2s) se NEDOPORUčUJE +of.options.AUTOSAVE_TICKS.tooltip.3=Auto-ukládání způsobuje slavné sekací Smrti (Lag Spikes of Death). + +of.options.SCREENSHOT_SIZE=Velikost Screenshotu +of.options.SCREENSHOT_SIZE.tooltip.1=Velikost Snímku Obrazovky +of.options.SCREENSHOT_SIZE.tooltip.2= Výchozí - výchozí velikost screenshotu +of.options.SCREENSHOT_SIZE.tooltip.3= 2x-4x - vlastním velikost screenshotu +of.options.SCREENSHOT_SIZE.tooltip.4=Focení větších screenshotů může vyžadovat více paměti. +of.options.SCREENSHOT_SIZE.tooltip.5=Není kompatinilní s Rychlým Renderem a Antialiasingem. +of.options.SCREENSHOT_SIZE.tooltip.6=Vyžaduje podporu GPU framebufferu. diff --git a/src/minecraft/assets/minecraft/optifine/lang/de_DE.lang b/src/minecraft/assets/minecraft/optifine/lang/de_DE.lang new file mode 100644 index 0000000..b367588 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/de_DE.lang @@ -0,0 +1,611 @@ +# Contributors of German localization # +# ThexXTURBOXx (Collaborator of Reforged) 2016-2-29 ---- 2016-3-3 +# RoiEXLab 2016-3-8 +# violine1101 (German Minecraft Wiki admin) 2016-4-4 ---- 2016-10-12 +# TheHADILP 2016-5-20 ---- 2017-01-27 + +# General +of.general.ambiguous=Unklar +of.general.custom=Anderes +of.general.from=Von +of.general.id=ID +of.general.restart=Neustart +of.general.smart=Fein + +# Keys +of.key.zoom=Zoom + +# Message +of.message.aa.shaders1=Antialiasing ist nicht mit Shader-Effekten kompatibel. +of.message.aa.shaders2=Bitte deaktiviere Shader-Effekte, um diese Einstellung zu aktivieren. + +of.message.af.shaders1=Anistropische Filterung ist nicht mit Shader-Effekten kompatibel. +of.message.af.shaders2=Bitte deaktiviere Shader-Effekte, um diese Einstellung zu aktivieren. + +of.message.fr.shaders1=Schnelles Rendern ist nicht mit Shader-Effekten kompatibel. +of.message.fr.shaders2=Bitte deaktiviere Shader-Effekte, um diese Einstellung zu aktivieren. + +of.message.an.shaders1=3D-Effekt ist nicht mit Shader-Effekten kompatibel. +of.message.an.shaders2=Bitte deaktiviere Shader-Effekte, um diese Einstellung zu aktivieren. + +of.message.shaders.aa1=Antialiasing ist nicht mit Shader-Effekten kompatibel. +of.message.shaders.aa2=Bitte deaktiviere Qualität -> Antialiasing und starte das Spiel neu. + +of.message.shaders.af1=Anistropische Filterung ist nicht mit Shader-Effekten kompatibel. +of.message.shaders.af2=Bitte deaktiviere Qualität -> Anistropische Filterung. + +of.message.shaders.fr1=Schnelles Rendern ist nicht mit Shader-Effekten kompatibel. +of.message.shaders.fr2=Bitte deaktiviere Leistung -> Schnelles Rendern. + +of.message.shaders.an1=Shader-Effekte sind nicht mit dem 3D-Effekt kompatibel. +of.message.shaders.an2=Bitte deaktiviere Sonstiges -> 3D-Effekt. + +of.message.newVersion=Eine neue Version von §eOptiFine§f ist verfügbar: §e%s§f +of.message.java64Bit=Du kannst die §e64-bit-Version von Java§f installieren, um die Leistung zu verbessern +of.message.openglError=§eOpenGL-Fehler§f: %s (%s) + +of.message.shaders.loading=Lade Shader-Effekte: %s + +of.message.other.reset=Alle Grafikeinstellungen auf die Standardwerte zurücksetzen? + +of.message.loadingVisibleChunks=Lade sichtbare Chunks + +# Video settings + +options.graphics.tooltip.1=Grafikmodus +options.graphics.tooltip.2= Schnell - Schlechtere Qualität, schneller +options.graphics.tooltip.3= Schön - Höhere Qualität, langsamer +options.graphics.tooltip.4=Verändert das Aussehen von Wolken, Blättern, Wasser, +options.graphics.tooltip.5=Schatten und Grasblöcken. + +of.options.renderDistance.tiny=Mini +of.options.renderDistance.short=Klein +of.options.renderDistance.normal=Normal +of.options.renderDistance.far=Weit +of.options.renderDistance.extreme=Extrem + +options.renderDistance.tooltip.1=Sichtweite +options.renderDistance.tooltip.2= 2 Mini - 32m (am schnellsten) +options.renderDistance.tooltip.3= 4 Klein - 64m (schnell) +options.renderDistance.tooltip.4= 8 Normal - 128m +options.renderDistance.tooltip.5= 16 Weit - 256m (langsam) +options.renderDistance.tooltip.6= 32 Extrem - 512m (am langsamsten!) +options.renderDistance.tooltip.7=Die extreme Sichtweite ist sehr ressourcenaufwendig! +options.renderDistance.tooltip.8=Werte über 16 funktionieren nur im Einzelspielermodus. + +options.ao.tooltip.1=Weiche Beleuchtung +options.ao.tooltip.2= Aus - Keine weiche Beleuchtung (schnell) +options.ao.tooltip.3= Minimum - Einfache weiche Beleuchtung (langsam) +options.ao.tooltip.4= Maximum - Komplexe weiche Beleuchtung (am langsamsten) + +options.framerateLimit.tooltip.1=Maximale Bildrate +options.framerateLimit.tooltip.2= V-Sync - Auf Monitor-Bildrate begrenzen (60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - Auf eingestellte Bildrate begrenzen +options.framerateLimit.tooltip.4= Unendlich - Keine Begrenzung (am schnellsten) +options.framerateLimit.tooltip.5=Die Bildrate grenzt die FPS ein, sogar wenn +options.framerateLimit.tooltip.6=die Begrenzung nicht erreicht ist. +of.options.framerateLimit.vsync=V-Sync + +of.options.AO_LEVEL=Schattenhelligkeit +of.options.AO_LEVEL.tooltip.1=Schattenhelligkeit +of.options.AO_LEVEL.tooltip.2= Aus - Keine Schatten +of.options.AO_LEVEL.tooltip.3= 50%% - Helle Schatten +of.options.AO_LEVEL.tooltip.4= 100%% - Dunkle Schatten + +options.viewBobbing.tooltip.1=Gehbewegung +options.viewBobbing.tooltip.2=Wenn Mipmaps verwendet werden, deaktiviere diese +options.viewBobbing.tooltip.3=Einstellung für bessere Leitung. + +options.guiScale.tooltip.1=GUI-Größe +options.guiScale.tooltip.2= Auto - Maximale Größe +options.guiScale.tooltip.3= Klein, Normal, Groß - 1x-3x +options.guiScale.tooltip.4= 4x-10x - Verfügbar auf 4K Monitoren +options.guiScale.tooltip.5=Ungerade Werte (1x, 3x ...) sind nicht mit Unicode kompatibel. +options.guiScale.tooltip.6=Ein kleineres GUI ist eventuell schneller. + +options.vbo.tooltip.1=Vertexbufferobjekte +options.vbo.tooltip.2=Benutzt ein alternatives Rendermodell, das normalerweise +options.vbo.tooltip.3=schneller (5-10%%) als das Standard-Rendermodell ist. + +options.gamma.tooltip.1=Ändert die Helligkeit dunkler Objekte +options.gamma.tooltip.2= Düster - Standardhelligkeit +options.gamma.tooltip.3= 1-99%% - veränderlich +options.gamma.tooltip.4= Hell - Maximale Helligkeit für dunkle Objekte +options.gamma.tooltip.5=Diese Einstellungen ändern nicht die Helligkeit von ganz +options.gamma.tooltip.6=schwarzen Objekten. + +options.anaglyph.tooltip.1=3D-Effekt +options.anaglyph.tooltip.2=Aktiviert einen stereoskopischen 3D-Effekt durch +options.anaglyph.tooltip.3=Verwenden unterschiedlicher Farben für jedes Auge. +options.anaglyph.tooltip.4=Kann nur mit einer Rot-Cyan-Brille benutzt werden. + +options.blockAlternatives.tooltip.1=Blockvarianten +options.blockAlternatives.tooltip.2=Benutzt alternative Blockmodelle für einige Blöcke. +options.blockAlternatives.tooltip.3=Hängt vom ausgewählten Ressourcenpaket ab. + +of.options.ALTERNATE_BLOCKS=Blockvarianten +of.options.ALTERNATE_BLOCKS.tooltip.1=Blockvarianten +of.options.ALTERNATE_BLOCKS.tooltip.2=Benutzt alternative Blockmodelle für einige Blöcke. +of.options.ALTERNATE_BLOCKS.tooltip.3=Abhängig vom ausgewählten Ressourcenpaket. + +of.options.FOG_FANCY=Nebel +of.options.FOG_FANCY.tooltip.1=Nebel +of.options.FOG_FANCY.tooltip.2= Schnell - Schneller Nebel +of.options.FOG_FANCY.tooltip.3= Schön - Langsamer Nebel, sieht besser aus +of.options.FOG_FANCY.tooltip.4= Aus - Kein Nebel, am schnellsten +of.options.FOG_FANCY.tooltip.5=Der schöne Nebel ist nur verfügbar, wenn er von der +of.options.FOG_FANCY.tooltip.6=Grafikkarte unterstützt wird. + +of.options.FOG_START=Nebelstart +of.options.FOG_START.tooltip.1=Nebelstart +of.options.FOG_START.tooltip.2= 0.2 - Der Nebel startet nahe beim Spieler +of.options.FOG_START.tooltip.3= 0.8 - Der Nebel startet weit weg vom Spieler +of.options.FOG_START.tooltip.4=Diese Einstellung beeinflusst normalerweise nicht die +of.options.FOG_START.tooltip.5=Leistung. + +of.options.CHUNK_LOADING=Chunkladen +of.options.CHUNK_LOADING.tooltip.1=Chunkladen +of.options.CHUNK_LOADING.tooltip.2= Standard - Instabile FPS, wenn Chunks geladen werden +of.options.CHUNK_LOADING.tooltip.3= Weich - Stabile FPS +of.options.CHUNK_LOADING.tooltip.4= Multi-Core - Stabile FPS, 3x schnelleres Weltladen +of.options.CHUNK_LOADING.tooltip.5=Weich und Multi-Core entfernen Ruckler und +of.options.CHUNK_LOADING.tooltip.6=Standbilder, welche durch Chunkladen verursacht werden. +of.options.CHUNK_LOADING.tooltip.7=Multi-Core kann das Weltladen 3x schneller machen und +of.options.CHUNK_LOADING.tooltip.8=die FPS erhöhen, indem es einen zweiten CPU-Kern benutzt. +of.options.chunkLoading.smooth=Weich +of.options.chunkLoading.multiCore=Multi-Core + +of.options.shaders=Shader-Effekte ... +of.options.shadersTitle=Shader-Effekte + +of.options.shaders.packNone=Aus +of.options.shaders.packDefault=(Interner Shader-Effekt) + +of.options.shaders.ANTIALIASING=Antialiasing +of.options.shaders.NORMAL_MAP=Normale Karte +of.options.shaders.SPECULAR_MAP=Spiegelnde Karte +of.options.shaders.RENDER_RES_MUL=Renderqualität +of.options.shaders.SHADOW_RES_MUL=Schattenqualität +of.options.shaders.HAND_DEPTH_MUL=Handtiefe +of.options.shaders.CLOUD_SHADOW=Wolkenschatten +of.options.shaders.OLD_HAND_LIGHT=Alte Handbel. +of.options.shaders.OLD_LIGHTING=Alte Beleuchtung +of.options.shaders.SHADER_PACK=Shaderpaket + +of.options.shaders.shadersFolder=Shader-Effekt-Ordner +of.options.shaders.shaderOptions=Shadereinstellung ... + +of.options.shaderOptionsTitle=Shader-Effekte + +of.options.quality=Qualität ... +of.options.qualityTitle=Qualitätseinstellungen + +of.options.details=Details ... +of.options.detailsTitle=Detaileinstellungen + +of.options.performance=Leistung ... +of.options.performanceTitle=Leistungseinstellungen + +of.options.animations=Animationen ... +of.options.animationsTitle=Animationseinstellungen + +of.options.other=Sonstiges ... +of.options.otherTitle=Andere Einstellungen + +of.options.other.reset=Grafikeinstellungen zurücksetzen ... + +of.shaders.profile=Profil + +# Quality + +of.options.mipmap.bilinear=Bilinear +of.options.mipmap.linear=Linear +of.options.mipmap.nearest=Am nächsten +of.options.mipmap.trilinear=Trilinear + +options.mipmapLevels.tooltip.1=Visueller Effekt, der weit entfernte Objekte besser aus- +options.mipmapLevels.tooltip.2=sehen lässt, indem Texturdetails verringert werden +options.mipmapLevels.tooltip.3= Aus - Keine Verringerung von Details +options.mipmapLevels.tooltip.4= 1 - Minimale Verringerung von Details +options.mipmapLevels.tooltip.5= 4 - Maximale Verringerung von Details +options.mipmapLevels.tooltip.6=Diese Einstellung beeinflusst normalerweise nicht die +options.mipmapLevels.tooltip.7=Leistung. + +of.options.MIPMAP_TYPE=Mipmap-Typ +of.options.MIPMAP_TYPE.tooltip.1=Visueller Effekt, der weit entfernte Objekte besser aus- +of.options.MIPMAP_TYPE.tooltip.2=sehen lässt, indem Texturdetails verringert werden +of.options.MIPMAP_TYPE.tooltip.3= Am nächsten - Grobe Verringerung (am schnellsten) +of.options.MIPMAP_TYPE.tooltip.4= Linear - Normale Verringerung +of.options.MIPMAP_TYPE.tooltip.5= Bilinear - Feine Verringerung +of.options.MIPMAP_TYPE.tooltip.6= Trilinear - Feinste Verringerung (am langsamsten) + + +of.options.AA_LEVEL=Antialiasing +of.options.AA_LEVEL.tooltip.1=Antialiasing +of.options.AA_LEVEL.tooltip.2= Aus - (Standard) Kein Antialiasing (schneller) +of.options.AA_LEVEL.tooltip.3= 2-16 - Antialiasierte Linien und Ecken (langsamer) +of.options.AA_LEVEL.tooltip.4=Das Antialiasing weicht gezackte Linien ab und schärft +of.options.AA_LEVEL.tooltip.5=Farbübergänge. Wenn aktiviert, kann es die Bildrate +of.options.AA_LEVEL.tooltip.6=erheblich beeinträchtigen. +of.options.AA_LEVEL.tooltip.7=Nicht alle Stufen werden von allen Grafikkarten unterstützt. +of.options.AA_LEVEL.tooltip.8=Änderung wird erst nach einem Neustart effektiv! + +of.options.AF_LEVEL=Anisotropische Filterung +of.options.AF_LEVEL.tooltip.1=Anisotropische Filterung +of.options.AF_LEVEL.tooltip.2= Aus - (Standard) Standard-Texturdetails (schneller) +of.options.AF_LEVEL.tooltip.3= 2-16 - Feinere Details in Texturen (langsamer) +of.options.AF_LEVEL.tooltip.4=Die anisotropische Filterung stellt Details in Texturen, +of.options.AF_LEVEL.tooltip.5=die durch Mipmap ihre Details verloren haben, wieder her. +of.options.AF_LEVEL.tooltip.6=Wenn aktiviert, kann es die FPS erheblich verringern. + +of.options.CLEAR_WATER=Klares Wasser +of.options.CLEAR_WATER.tooltip.1=Klares Wasser +of.options.CLEAR_WATER.tooltip.2= An - Klares, transparentes Wasser +of.options.CLEAR_WATER.tooltip.3= Aus - Normales Wasser + +of.options.RANDOM_MOBS=Kreaturvarianten +of.options.RANDOM_MOBS.tooltip.1=Kreaturvarianten +of.options.RANDOM_MOBS.tooltip.2= Aus - Keine Kreaturvarianten, schneller +of.options.RANDOM_MOBS.tooltip.3= An - Keine Kreaturvarianten, langsamer +of.options.RANDOM_MOBS.tooltip.4=Die gleichen Kreaturen können unterschiedliche Texturen +of.options.RANDOM_MOBS.tooltip.5=haben. Dies benötigt ein Ressourcenpaket mit entspre- +of.options.RANDOM_MOBS.tooltip.6=chenden Texturen. + +of.options.BETTER_GRASS=Besseres Gras +of.options.BETTER_GRASS.tooltip.1=Besseres Gras +of.options.BETTER_GRASS.tooltip.2= Aus - Standard-Grasseitentextur, am schnellsten +of.options.BETTER_GRASS.tooltip.3= Schnell - Volle Grasseitentextur, langsamer +of.options.BETTER_GRASS.tooltip.4= Schön - Dynamische Grasseitentextur, am langsamsten + +of.options.BETTER_SNOW=Besserer Schnee +of.options.BETTER_SNOW.tooltip.1=Besserer Schnee +of.options.BETTER_SNOW.tooltip.2= Aus - Normaler Schnee, schneller +of.options.BETTER_SNOW.tooltip.3= An - Besserer Schnee, langsamer +of.options.BETTER_SNOW.tooltip.4=Setzt Schnee unter transparente Blöcke (wie Zäune +of.options.BETTER_SNOW.tooltip.5=oder hohes Gras), wenn sie an Schneeblöcke grenzen. + +of.options.CUSTOM_FONTS=Schriftartressourcen +of.options.CUSTOM_FONTS.tooltip.1=Schriftartressourcen +of.options.CUSTOM_FONTS.tooltip.2= An - Ressourcenpaket-Schriftart (Standard), langsamer +of.options.CUSTOM_FONTS.tooltip.3= Aus - Standardschriftart, schneller +of.options.CUSTOM_FONTS.tooltip.4=Die Schriftart wird aus den aktivierten Ressourcenpaketen +of.options.CUSTOM_FONTS.tooltip.5=geladen + +of.options.CUSTOM_COLORS=Farbressourcen +of.options.CUSTOM_COLORS.tooltip.1=Farbressourcen +of.options.CUSTOM_COLORS.tooltip.2= An - Ressourcenpaket-Farben (Standard), langsamer +of.options.CUSTOM_COLORS.tooltip.3= Aus - Standardfarben, schneller +of.options.CUSTOM_COLORS.tooltip.4=Die Farben werden aus den aktivierten Ressourcenpaketen +of.options.CUSTOM_COLORS.tooltip.5=geladen. + +of.options.SWAMP_COLORS=Sumpffarben +of.options.SWAMP_COLORS.tooltip.1=Sumpffarben +of.options.SWAMP_COLORS.tooltip.2= An - Färbt den Sumpf dunkler (Standard), langsamer +of.options.SWAMP_COLORS.tooltip.3= Aus - Färbt den Sumpf in normalen Farben, schneller +of.options.SWAMP_COLORS.tooltip.4=Die Sumpffarben betreffen Gras, Laub, Ranken und +of.options.SWAMP_COLORS.tooltip.5=Wasser. + +of.options.SMOOTH_BIOMES=Biomübergänge +of.options.SMOOTH_BIOMES.tooltip.1=Biomübergänge +of.options.SMOOTH_BIOMES.tooltip.2= An - Flüssige Biomübergänge (Standard), langsamer +of.options.SMOOTH_BIOMES.tooltip.3= Aus - Keine flüssigen Biomübergänge, schneller +of.options.SMOOTH_BIOMES.tooltip.4=Die Farbübergänge werden durch Probennahme und +of.options.SMOOTH_BIOMES.tooltip.5=Durchschnittsberechnung der Farben der umliegenden +of.options.SMOOTH_BIOMES.tooltip.6=Blöcke berechnet. Betroffen sind Gras, Laub, Ranken und +of.options.SMOOTH_BIOMES.tooltip.7=Wasser. + +of.options.CONNECTED_TEXTURES=Verbundene Texturen +of.options.CONNECTED_TEXTURES.tooltip.1=Verbundene Texturen +of.options.CONNECTED_TEXTURES.tooltip.2= Aus - Keine verbundenen Texturen (Standard) +of.options.CONNECTED_TEXTURES.tooltip.3= Schnell - Schnelle verbundene Texturen +of.options.CONNECTED_TEXTURES.tooltip.4= Schöne - Schöne verbundene Texturen +of.options.CONNECTED_TEXTURES.tooltip.5=Verbundene Texturen verbinden die Texturen von Glas, +of.options.CONNECTED_TEXTURES.tooltip.6=Sandstein und Bücherregalen, wenn sie nebeneinander +of.options.CONNECTED_TEXTURES.tooltip.7=platziert werden. Die verbundenen Texturen werden aus +of.options.CONNECTED_TEXTURES.tooltip.8=den aktivierten Ressourcenpaketen geladen. + +of.options.NATURAL_TEXTURES=Natürliche Texturen +of.options.NATURAL_TEXTURES.tooltip.1=Natürliche Texturen +of.options.NATURAL_TEXTURES.tooltip.2= Aus - Keine natürlichen Texturen (Standard) +of.options.NATURAL_TEXTURES.tooltip.3= An - Benutzt natürliche Texturen +of.options.NATURAL_TEXTURES.tooltip.4=Natürliche Texturen entfernen die rasterartige Anordnung, +of.options.NATURAL_TEXTURES.tooltip.5=erzeugt durch Platzieren gleicher Blöcke. Dies benutzt +of.options.NATURAL_TEXTURES.tooltip.6=gedrehte und umgekehrte Varianten der Standard- +of.options.NATURAL_TEXTURES.tooltip.7=Blocktextur. Die Einstellungen für die natürlichen Texturen +of.options.NATURAL_TEXTURES.tooltip.8=werden aus den aktivierten Ressourcenpaketen geladen. + +of.options.CUSTOM_SKY=Himmelstexturen +of.options.CUSTOM_SKY.tooltip.1=Himmelstexturen +of.options.CUSTOM_SKY.tooltip.2= An - Ressourcenpaket-Himmel (Standard), langsam +of.options.CUSTOM_SKY.tooltip.3= Aus - Standardhimmel, schneller +of.options.CUSTOM_SKY.tooltip.4=Die Himmelstexturen werden aus den aktivierten +of.options.CUSTOM_SKY.tooltip.5=Ressourcenpaketen geladen. + +of.options.CUSTOM_ITEMS=Gegenstandstexturen +of.options.CUSTOM_ITEMS.tooltip.1=Gegenstandstexturen +of.options.CUSTOM_ITEMS.tooltip.2= An - Ressourcenpaket-G.texturen (Standard), langsam +of.options.CUSTOM_ITEMS.tooltip.3= Aus - Standard-Gegenstandstexturen, schneller +of.options.CUSTOM_ITEMS.tooltip.4=Die Gegenstandstexturen werden aus den aktivierten +of.options.CUSTOM_ITEMS.tooltip.5=Ressourcenpaketen geladen. + +of.options.CUSTOM_ENTITY_MODELS=Wesens- & Objektmodelle +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=Wesens- und Objektmodelle +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= An - Ressourcenpaketmodelle (Standard), langsam +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= Aus - Standardmodelle, schneller +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=Die Wesens- und Objektmodelle werden aus den +of.options.CUSTOM_ENTITY_MODELS.tooltip.5=aktivierten Ressourcenpaketen geladen. + +# Details + +of.options.CLOUDS=Wolken +of.options.CLOUDS.tooltip.1=Wolken +of.options.CLOUDS.tooltip.2= Standard - Wie Grafikmodus +of.options.CLOUDS.tooltip.3= Schnell - Schlechtere Qualität, schneller +of.options.CLOUDS.tooltip.4= Schön - Höhere Qualität, langsamer +of.options.CLOUDS.tooltip.5= Aus - Keine Wolken, am schnellsten +of.options.CLOUDS.tooltip.6=Schnelle Wolken werden zweidimensional dargestellt. +of.options.CLOUDS.tooltip.7=Schöne Wolken werden dreidimensional dargestellt. + +of.options.CLOUD_HEIGHT=Wolkenhöhe +of.options.CLOUD_HEIGHT.tooltip.1=Wolkenhöhe +of.options.CLOUD_HEIGHT.tooltip.2= Aus - Standardhöhe +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - Über der maximalen Welthöhe + +of.options.TREES=Bäume +of.options.TREES.tooltip.1=Bäume +of.options.TREES.tooltip.2= Standard - Wie Grafikmodus +of.options.TREES.tooltip.3= Schnell - Schlechtere Qualität, schneller +of.options.TREES.tooltip.4= Fein - Hohe Qualität, schnell +of.options.TREES.tooltip.5= Schön - Höchste Qualität, langsamer +of.options.TREES.tooltip.6=Schnelle Bäume haben solide Blätter. +of.options.TREES.tooltip.7=Schöne Bäume haben teilweise transparente Blätter. + +of.options.RAIN=Regen & Schnee +of.options.RAIN.tooltip.1=Regen & Schnee +of.options.RAIN.tooltip.2= Standard - Wie Grafikmodus +of.options.RAIN.tooltip.3= Schnell - Leichter Regen/Schnee, schneller +of.options.RAIN.tooltip.4= Schön - Starker Regen/Schnee, langsamer +of.options.RAIN.tooltip.5= Aus - Kein Regen/Schnee, am schnellsten +of.options.RAIN.tooltip.6=Wenn diese Einstellung deaktiviert ist, sind die Regen- +of.options.RAIN.tooltip.7=geräusche und -partikel dennoch zu hören bzw. zu sehen. + +of.options.SKY=Himmel +of.options.SKY.tooltip.1=Himmel +of.options.SKY.tooltip.2= An - Himmel ist sichtbar, langsamer +of.options.SKY.tooltip.3= Aus - Himmel ist nicht sichtbar, schneller +of.options.SKY.tooltip.4=Wenn dies deaktiviert ist, sind Mond und Sonne dennoch +of.options.SKY.tooltip.5=sichtbar. + +of.options.STARS=Sterne +of.options.STARS.tooltip.1=Sterne +of.options.STARS.tooltip.2= An - Sterne sind sichtbar, langsamer +of.options.STARS.tooltip.3= Aus - Sterne ist nicht sichtbar, schneller + +of.options.SUN_MOON=Sonne & Mond +of.options.SUN_MOON.tooltip.1=Sonne & Mond +of.options.SUN_MOON.tooltip.2= An - Sonne und Mond sind sichtbar (Standard) +of.options.SUN_MOON.tooltip.3= Aus - Sonne und Mond sind nicht sichtbar (schneller) + +of.options.SHOW_CAPES=Umhänge +of.options.SHOW_CAPES.tooltip.1=Umhänge +of.options.SHOW_CAPES.tooltip.2= An - Umhänge werden dargestellt (Standard) +of.options.SHOW_CAPES.tooltip.3= Aus - Umhänge werden nicht dargestellt + +of.options.TRANSLUCENT_BLOCKS=Blocktransparenz +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Blocktransparenz +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Schön - Korrekte Farbmischung (Standard) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Schnell - Schnelle Farbmischung (schnell) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Kontrolliert die Farbmischung von transparenten Blöcken +of.options.TRANSLUCENT_BLOCKS.tooltip.5=mit verschiedenen Farben (Gefärbtes Glas, Wasser, Eis), +of.options.TRANSLUCENT_BLOCKS.tooltip.6=wenn sie hintereinander mit Luft dazwischen platziert +of.options.TRANSLUCENT_BLOCKS.tooltip.7=werden. + +of.options.HELD_ITEM_TOOLTIPS=Gegenstandsbeschr. +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Gegenstandsbeschreibung +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= An - Zeige Gegenstandsbeschreibung (Standard) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= Aus - Zeige keine Gegenstandsbeschreibung +of.options.HELD_ITEM_TOOLTIPS.tooltip.4=Wird über der Schnellzugriffsleiste angezeigt. + +of.options.ADVANCED_TOOLTIPS=Erweiterte Schnellinfo +of.options.ADVANCED_TOOLTIPS.tooltip.1=Erweiterte Schnellinfo +of.options.ADVANCED_TOOLTIPS.tooltip.2= An - Zeige erweiterte Schnellinfo +of.options.ADVANCED_TOOLTIPS.tooltip.3= Aus - Keine erweiterte Schnellinfo (Standard) +of.options.ADVANCED_TOOLTIPS.tooltip.4=Zeigt ausführliche Informationen über Gegenstände +of.options.ADVANCED_TOOLTIPS.tooltip.5=(ID, Haltbarkeit) und Shader Einstellungen (ID, Quelle, +of.options.ADVANCED_TOOLTIPS.tooltip.6=Standardwert) an. + +of.options.DROPPED_ITEMS=Gegenstände +of.options.DROPPED_ITEMS.tooltip.1=Liegende Gegenstände +of.options.DROPPED_ITEMS.tooltip.2= Standard - Wie Grafikmodus +of.options.DROPPED_ITEMS.tooltip.3= Schnell - Zweidimensionale Animation, schneller +of.options.DROPPED_ITEMS.tooltip.4= Schön - Dreidimensionale Animation, langsamer + +options.entityShadows.tooltip.1=Objektschatten +options.entityShadows.tooltip.2= An - Zeige Objektschatten +options.entityShadows.tooltip.3= Aus - Zeige keine Objektschatten + +of.options.VIGNETTE=Vignette +of.options.VIGNETTE.tooltip.1=Visueller Effekt, der die Bildschirmecken abdunkelt +of.options.VIGNETTE.tooltip.2= Standard - Wie Grafikmodus (Standard) +of.options.VIGNETTE.tooltip.3= Schnell - Vignette deaktiviert (schneller) +of.options.VIGNETTE.tooltip.4= Schön - Vignette aktiviert (langsamer) +of.options.VIGNETTE.tooltip.5=Die Vignette kann sich extrem auf die Leistung auswirken, +of.options.VIGNETTE.tooltip.6=besonders im Vollbildschirmmodus. +of.options.VIGNETTE.tooltip.7=Der Vignetteneffekt ist fast unmerklich und kann sicher +of.options.VIGNETTE.tooltip.8=deaktiviert werden. + +of.options.DYNAMIC_FOV=Dynamisches Sichtfeld +of.options.DYNAMIC_FOV.tooltip.1=Dynamisches Sichtfeld +of.options.DYNAMIC_FOV.tooltip.2= An - Dynamisches Sichtfeld aktivieren (Standard) +of.options.DYNAMIC_FOV.tooltip.3= Aus - Dynamisches Sichtfeld ausschalten +of.options.DYNAMIC_FOV.tooltip.4=Ändert das Sichtfeld beim Fliegen, Sprinten oder beim +of.options.DYNAMIC_FOV.tooltip.5=Spannen eines Bogens. + +of.options.DYNAMIC_LIGHTS=Dyn. Beleuchtung +of.options.DYNAMIC_LIGHTS.tooltip.1=Dynamische Beleuchtung +of.options.DYNAMIC_LIGHTS.tooltip.2= Aus - Keine dynamische Beleuchtung (Standard) +of.options.DYNAMIC_LIGHTS.tooltip.3= Schnell - Schnelle dyn. Beleuchtung (alle 500ms aktual.) +of.options.DYNAMIC_LIGHTS.tooltip.4= Schön - Schöne dyn. Beleuchtung (Echtzeitaktual.) +of.options.DYNAMIC_LIGHTS.tooltip.5=Leuchtende Gegenstände (Fackel, Glowstone, etc.) +of.options.DYNAMIC_LIGHTS.tooltip.6=beleuchten die Umgebung, wenn sie in der Hand gehalten, +of.options.DYNAMIC_LIGHTS.tooltip.7=von anderen Spielern ausgerüstet oder gedroppt werden. + +# Performance + +of.options.SMOOTH_FPS=Stabile Bildrate +of.options.SMOOTH_FPS.tooltip.1=Stabilisiert Bildrate durch Grafiktreiberpuffer +of.options.SMOOTH_FPS.tooltip.2= Aus - Keine Stabilisierung, Bildrate könnte schwanken +of.options.SMOOTH_FPS.tooltip.3= An - Stabilisierung der Bildrate +of.options.SMOOTH_FPS.tooltip.4=Diese Einstellung ist abhängig vom Grafikkartentreiber. +of.options.SMOOTH_FPS.tooltip.5=Eine Wirkung ist nicht immer spürbar. + +of.options.SMOOTH_WORLD=Weltstabilisierung +of.options.SMOOTH_WORLD.tooltip.1=Entfernt vom internen Server verursachte starke Lags +of.options.SMOOTH_WORLD.tooltip.2= Aus - Keine Stabilisierung, Bildrate könnte schwanken +of.options.SMOOTH_WORLD.tooltip.3= An - Weltstabilisierung aktiviert +of.options.SMOOTH_WORLD.tooltip.4=Stabilisiert die Bildrate, indem die interne Server- +of.options.SMOOTH_WORLD.tooltip.5=auslastung aufgeteilt wird. +of.options.SMOOTH_WORLD.tooltip=6=Funktioniert nur im Einzelspielermodus. + +of.options.FAST_RENDER=Schnelles Rendern +of.options.FAST_RENDER.tooltip.1=Schnelles Rendern +of.options.FAST_RENDER.tooltip.2= Aus - Standard-Rendern (Standard) +of.options.FAST_RENDER.tooltip.3= An - Optimiertes Rendern (schneller) +of.options.FAST_RENDER.tooltip.4=Benutzt optimierte Renderalgorithmen, die die GPU-Aus- +of.options.FAST_RENDER.tooltip.5=lastung verringern und die Leistung erheblich steigern. + +of.options.FAST_MATH=Schnelle Mathematik +of.options.FAST_MATH.tooltip.1=Schnelle Mathematik +of.options.FAST_MATH.tooltip.2= Aus - Standard-Mathematik (Standard) +of.options.FAST_MATH.tooltip.3= An - Schnellere Mathematik +of.options.FAST_MATH.tooltip.4=Benutzt optimierte Sinus- und Kosinusfunktionen, die den +of.options.FAST_MATH.tooltip.5=CPU-Zwischenspeicher besser nutzen und die Leistung +of.options.FAST_MATH.tooltip.6=steigern. + +of.options.CHUNK_UPDATES=Chunk-Aktualisierungen +of.options.CHUNK_UPDATES.tooltip.1=Chunk-Aktualisierungen +of.options.CHUNK_UPDATES.tooltip.2= 1 - Langsameres Weltladen, höhere Bildrate (Standard) +of.options.CHUNK_UPDATES.tooltip.3= 3 - Schnelleres Weltladen, niedrigere Bildrate +of.options.CHUNK_UPDATES.tooltip.4= 5 - Schnellstes Weltladen, niedrigste Bildrate +of.options.CHUNK_UPDATES.tooltip.5=Zahl an Chunk-Aktualisierungen pro gerendertem Bild. +of.options.CHUNK_UPDATES.tooltip.6=Höhere Werte könnten die Bildrate destabilisieren. + +of.options.CHUNK_UPDATES_DYNAMIC=Dyn. Aktualisierungen +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Dynamische Chunk-Aktualisierungen +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= Aus - (Standard) Normale Chunk-Aktualisierungen +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= An - Mehr Chunk-Aktualisierungen +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=Wenn diese Einstellung aktiviert ist, werden mehr Chunk- +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=Aktualisierungen ausgeführt, während der Spieler still +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.6=steht, um die Welt schneller zu laden. + +of.options.LAZY_CHUNK_LOADING=Träges Chunkladen +of.options.LAZY_CHUNK_LOADING.tooltip.1=Träges Chunkladen +of.options.LAZY_CHUNK_LOADING.tooltip.2= Aus - Standard-Server-Chunkladen +of.options.LAZY_CHUNK_LOADING.tooltip.3= An - Träges Server-Chunkladen (flüssiger) +of.options.LAZY_CHUNK_LOADING.tooltip.4=Server-Chunkladen wird flüssiger, indem die Chunks über +of.options.LAZY_CHUNK_LOADING.tooltip.5=ein paar Ticks hinweg geladen werden. Deaktiviere dies, +of.options.LAZY_CHUNK_LOADING.tooltip.6=wenn Teile der Welt nicht korrekt geladen werden. +of.options.LAZY_CHUNK_LOADING.tooltip.7=Nur für Einzelspielermodus und Ein-Kern-CPUs effektiv. + +# Animations + +of.options.animation.allOn=Alle an +of.options.animation.allOff=Alle aus +of.options.animation.dynamic=Dynamisch + +of.options.ANIMATED_WATER=Animiertes Wasser +of.options.ANIMATED_LAVA=Animierte Lava +of.options.ANIMATED_FIRE=Animiertes Feuer +of.options.ANIMATED_PORTAL=Animierte Portale +of.options.ANIMATED_REDSTONE=Animiertes Redstone +of.options.ANIMATED_EXPLOSION=Animierte Explosion +of.options.ANIMATED_FLAME=Animierte Flammen +of.options.ANIMATED_SMOKE=Animierter Rauch +of.options.VOID_PARTICLES=Leerepartikel +of.options.WATER_PARTICLES=Wasserpartikel +of.options.RAIN_SPLASH=Regengeplätscher +of.options.PORTAL_PARTICLES=Portalpartikel +of.options.POTION_PARTICLES=Trankpartikel +of.options.DRIPPING_WATER_LAVA=Wasser- & Lavatropfen +of.options.ANIMATED_TERRAIN=Animiertes Gelände +of.options.ANIMATED_TEXTURES=Animierte Texturen +of.options.FIREWORK_PARTICLES=Feuerwerkspartikel + +# Other + +of.options.LAGOMETER=Lagometer +of.options.LAGOMETER.tooltip.1=Zeigt das Lagometer auf dem Debugbildschirm (F3). +of.options.LAGOMETER.tooltip.2=* Orange - Speichermüllsammlung +of.options.LAGOMETER.tooltip.3=* Cyan - Tick +of.options.LAGOMETER.tooltip.4=* Blau - Geplante Ausführungen +of.options.LAGOMETER.tooltip.5=* Lila - Chunks hochladen +of.options.LAGOMETER.tooltip.6=* Rot - Chunkaktualisierungen +of.options.LAGOMETER.tooltip.7=* Gelb - Sichtbarkeitstest +of.options.LAGOMETER.tooltip.8=* Grün - Gelände rendern + +of.options.PROFILER=Debug-Diagramm +of.options.PROFILER.tooltip.1=Debug-Diagramm +of.options.PROFILER.tooltip.2= An - Debug-Diagramm ist aktiviert, langsamer +of.options.PROFILER.tooltip.3= Aus - Debug-Diagramm ist nicht aktiviert, schneller +of.options.PROFILER.tooltip.4=Das Debug-Diagramm sammelt und stellt Debuginforma- +of.options.PROFILER.tooltip.5=tionen dar, wenn der Debugbildschirm geöffnet ist (F3). + +of.options.WEATHER=Wetter +of.options.WEATHER.tooltip.1=Wetter +of.options.WEATHER.tooltip.2= An - Wetter ist aktiv, langsamer +of.options.WEATHER.tooltip.3= Aus - Wetter ist nicht aktiv, schneller +of.options.WEATHER.tooltip.4=Das Wetter kontrolliert Regen, Schnee und Gewitter. +of.options.WEATHER.tooltip.5=Wetterkontrolle ist nur im Einzelspielermodus möglich. + +of.options.time.dayOnly=Nur Tag +of.options.time.nightOnly=Nur Nacht + +of.options.TIME=Zeit +of.options.TIME.tooltip.1=Zeit +of.options.TIME.tooltip.2= Standard - Normaler Tag-Nacht-Zyklus +of.options.TIME.tooltip.3= Nur Tag - Nur Tag +of.options.TIME.tooltip.4= Nur Nacht - Nur Nacht +of.options.TIME.tooltip.5=Diese Einstellung ist nur im Kreativmodus und +of.options.TIME.tooltip.6=im Einzelspielermodus wirksam. + +options.fullscreen.tooltip.1=Vollbildschirm +options.fullscreen.tooltip.2= An - Benutze Vollbildschirmmodus +options.fullscreen.tooltip.3= Aus - Benutze Fenstermodus +options.fullscreen.tooltip.4=Der Vollbildschirmmodus könnte schneller oder langsamer +options.fullscreen.tooltip.5=als der Fenstermodus sein, das kommt auf die Grafik- +options.fullscreen.tooltip.6=karte an. + +of.options.FULLSCREEN_MODE=Vollbild-Auflösung +of.options.FULLSCREEN_MODE.tooltip.1=Vollbild-Auflösung +of.options.FULLSCREEN_MODE.tooltip.2= Standard - Benutze Bildschirmauflösung, langsamer +of.options.FULLSCREEN_MODE.tooltip.3= BxH - Benutze andere Auflösung, könnte schneller sein +of.options.FULLSCREEN_MODE.tooltip.4=Die ausgewählte Auflösung wird im Vollbildschirmmodus +of.options.FULLSCREEN_MODE.tooltip.5=verwendet (F11). Kleinere Auflösungen sollten generell +of.options.FULLSCREEN_MODE.tooltip.6=schneller sein. + +of.options.SHOW_FPS=Bildrate anzeigen +of.options.SHOW_FPS.tooltip.1=Zeige kurze Bildrate- und Render-Informationen +of.options.SHOW_FPS.tooltip.2= C: - Chunkrenderer +of.options.SHOW_FPS.tooltip.3= E: - Objektrenderer + Blockrenderer +of.options.SHOW_FPS.tooltip.4= U: - Chunk-Aktualisierungen +of.options.SHOW_FPS.tooltip.5=Die Bildrate-Informationen werden nur gezeigt, wenn der +of.options.SHOW_FPS.tooltip.6=Debugbildschirm (F3) sichtbar ist. + +of.options.save.default=Standard (2s) +of.options.save.20s=20s +of.options.save.3min=3min +of.options.save.30min=30min + +of.options.AUTOSAVE_TICKS=Autospeichern +of.options.AUTOSAVE_TICKS.tooltip.1=Autospeicherintervall +of.options.AUTOSAVE_TICKS.tooltip.2=Normales Autospeicherintervall (2s) ist NICHT EMPFOHLEN. +of.options.AUTOSAVE_TICKS.tooltip.3=Autospeichern verursacht den berühmten Lag des Todes. + +of.options.SCREENSHOT_SIZE=Screenshot Größe +of.options.SCREENSHOT_SIZE.tooltip.1=Screenshot Auflösung +of.options.SCREENSHOT_SIZE.tooltip.2= Standard - Standard Screenshot Auflösung +of.options.SCREENSHOT_SIZE.tooltip.3= 2x-4x - Benutzerdefinierte Screenshot Auflösung +of.options.SCREENSHOT_SIZE.tooltip.4=Das Aufnehmen größerer Screenshots kann mehr +of.options.SCREENSHOT_SIZE.tooltip.5=Speicher benötigen. +of.options.SCREENSHOT_SIZE.tooltip.6=Nicht kompatibel mit Schnellem Rendern und Antialiasing. +of.options.SCREENSHOT_SIZE.tooltip.7=Erfordert Grafiktreiberpuffer Unterstützung. diff --git a/src/minecraft/assets/minecraft/optifine/lang/en_GB.lang b/src/minecraft/assets/minecraft/optifine/lang/en_GB.lang new file mode 100644 index 0000000..c506e51 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/en_GB.lang @@ -0,0 +1,36 @@ +# Video Settings + +options.anaglyph.tooltip.2=Enables a stereoscopic 3D effect using different colours + +# Quality + +of.options.AA_LEVEL.tooltip.5=sharp colour transitions. + +of.options.CUSTOM_COLORS=Custom Colours +of.options.CUSTOM_COLORS.tooltip.1=Custom Colours +of.options.CUSTOM_COLORS.tooltip.2= ON - uses custom colours (default), slower +of.options.CUSTOM_COLORS.tooltip.3= OFF - uses default colours, faster +of.options.CUSTOM_COLORS.tooltip.4=The custom colours are supplied by the current +of.options.CUSTOM_COLORS.tooltip.5=resource pack + +of.options.SWAMP_COLORS=Swamp Colours +of.options.SWAMP_COLORS.tooltip.1=Swamp Colours +of.options.SWAMP_COLORS.tooltip.2= ON - use swamp colours (default), slower +of.options.SWAMP_COLORS.tooltip.3= OFF - do not use swamp colours, faster +of.options.SWAMP_COLORS.tooltip.4=The swamp colours affect grass, leaves, vines and water. + +of.options.SMOOTH_BIOMES.tooltip.5=averaging the colour of all surrounding blocks. + +# Details + +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Fancy - correct colour blending (default) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Fast - fast colour blending (faster) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Controls the colour blending of translucent blocks +of.options.TRANSLUCENT_BLOCKS.tooltip.5=with different colour (stained glass, water, ice) + +# Performance + +of.options.FAST_MATH=Fast Maths +of.options.FAST_MATH.tooltip.1=Fast Maths +of.options.FAST_MATH.tooltip.2= OFF - standard maths (default) +of.options.FAST_MATH.tooltip.3= ON - faster maths \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/optifine/lang/en_US.lang b/src/minecraft/assets/minecraft/optifine/lang/en_US.lang new file mode 100644 index 0000000..41e87c8 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/en_US.lang @@ -0,0 +1,586 @@ +# General +of.general.ambiguous=ambiguous +of.general.custom=Custom +of.general.from=From +of.general.id=Id +of.general.restart=restart +of.general.smart=Smart + +# Keys +of.key.zoom=Zoom + +# Message +of.message.aa.shaders1=Antialiasing is not compatible with Shaders. +of.message.aa.shaders2=Please disable Shaders to enable this option. + +of.message.af.shaders1=Anisotropic Filtering is not compatible with Shaders. +of.message.af.shaders2=Please disable Shaders to enable this option. + +of.message.fr.shaders1=Fast Render is not compatible with Shaders. +of.message.fr.shaders2=Please disable Shaders to enable this option. + +of.message.an.shaders1=3D Anaglyph is not compatible with Shaders. +of.message.an.shaders2=Please disable Shaders to enable this option. + +of.message.shaders.aa1=Shaders are not compatible with Antialiasing. +of.message.shaders.aa2=Please set Quality -> Antialiasing to OFF and restart the game. + +of.message.shaders.af1=Shaders are not compatible with Anisotropic Filtering. +of.message.shaders.af2=Please set Quality -> Anisotropic Filtering to OFF. + +of.message.shaders.fr1=Shaders are not compatible with Fast Render. +of.message.shaders.fr2=Please set Performance -> Fast Render to OFF. + +of.message.shaders.an1=Shaders are not compatible with 3D Anaglyph. +of.message.shaders.an2=Please set Other -> 3D Anaglyph to OFF. + +of.message.newVersion=A new §eOptiFine§f version is available: §e%s§f +of.message.java64Bit=You can install §e64-bit Java§f to increase performance. +of.message.openglError=§eOpenGL Error§f: %s (%s) + +of.message.shaders.loading=Loading shaders: %s + +of.message.other.reset=Reset all video settings to their default values? + +of.message.loadingVisibleChunks=Loading visible chunks + +# Video settings + +options.graphics.tooltip.1=Visual quality +options.graphics.tooltip.2= Fast - lower quality, faster +options.graphics.tooltip.3= Fancy - higher quality, slower +options.graphics.tooltip.4=Changes the appearance of clouds, leaves, water, +options.graphics.tooltip.5=shadows and grass sides. + +of.options.renderDistance.extreme=Extreme + +options.renderDistance.tooltip.1=Visible distance +options.renderDistance.tooltip.2= 2 Tiny - 32m (fastest) +options.renderDistance.tooltip.3= 4 Short - 64m (faster) +options.renderDistance.tooltip.4= 8 Normal - 128m +options.renderDistance.tooltip.5= 16 Far - 256m (slower) +options.renderDistance.tooltip.6= 32 Extreme - 512m (slowest!) +options.renderDistance.tooltip.7=The Extreme view distance is very resource demanding! +options.renderDistance.tooltip.8=Values over 16 Far are only effective in local worlds. + +options.ao.tooltip.1=Smooth lighting +options.ao.tooltip.2= OFF - no smooth lighting (faster) +options.ao.tooltip.3= Minimum - simple smooth lighting (slower) +options.ao.tooltip.4= Maximum - complex smooth lighting (slowest) + +options.framerateLimit.tooltip.1=Max framerate +options.framerateLimit.tooltip.2= VSync - limit to monitor framerate (60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - variable +options.framerateLimit.tooltip.4= Unlimited - no limit (fastest) +options.framerateLimit.tooltip.5=The framerate limit decreases the FPS even if +options.framerateLimit.tooltip.6=the limit value is not reached. +of.options.framerateLimit.vsync=VSync + +of.options.AO_LEVEL=Smooth Lighting Level +of.options.AO_LEVEL.tooltip.1=Smooth lighting level +of.options.AO_LEVEL.tooltip.2= OFF - no shadows +of.options.AO_LEVEL.tooltip.3= 50%% - light shadows +of.options.AO_LEVEL.tooltip.4= 100%% - dark shadows + +options.viewBobbing.tooltip.1=More realistic movement. +options.viewBobbing.tooltip.2=When using mipmaps set it to OFF for best results. + +options.guiScale.tooltip.1=GUI Scale +options.guiScale.tooltip.2= Auto - maximal size +options.guiScale.tooltip.3= Small, Normal, Large - 1x to 3x +options.guiScale.tooltip.4= 4x to 10x - available on 4K displays +options.guiScale.tooltip.5=Odd values (1x, 3x, 5x ...) are not compatible with Unicode. +options.guiScale.tooltip.6=A smaller GUI may be faster. + +options.vbo.tooltip.1=Vertex Buffer Objects +options.vbo.tooltip.2=Uses an alternative rendering model which is usually +options.vbo.tooltip.3=faster (5-10%%) than the default rendering. + +options.gamma.tooltip.1=Changes the brightness of darker objects. +options.gamma.tooltip.2= Moody - standard brightness +options.gamma.tooltip.3= 1-99%% - variable +options.gamma.tooltip.4= Bright - maximum brightness for darker objects +options.gamma.tooltip.5=This option does not change the brightness of +options.gamma.tooltip.6=fully black objects. + +options.anaglyph.tooltip.1=3D Anaglyph +options.anaglyph.tooltip.2=Enables a stereoscopic 3D effect using different colors +options.anaglyph.tooltip.3=for each eye. +options.anaglyph.tooltip.4=Requires red-cyan glasses for proper viewing. + +options.blockAlternatives.tooltip.1=Alternate Blocks +options.blockAlternatives.tooltip.2=Uses alternative block models for some blocks. +options.blockAlternatives.tooltip.3=Depends on the selected resource pack. + +of.options.ALTERNATE_BLOCKS=Alternate Blocks +of.options.ALTERNATE_BLOCKS.tooltip.1=Alternate Blocks +of.options.ALTERNATE_BLOCKS.tooltip.2=Uses alternative block models for some blocks. +of.options.ALTERNATE_BLOCKS.tooltip.3=Depends on the selected resource pack. + +of.options.FOG_FANCY=Fog +of.options.FOG_FANCY.tooltip.1=Fog type +of.options.FOG_FANCY.tooltip.2= Fast - faster fog +of.options.FOG_FANCY.tooltip.3= Fancy - slower fog, looks better +of.options.FOG_FANCY.tooltip.4= OFF - no fog, fastest +of.options.FOG_FANCY.tooltip.5=The fancy fog is available only if it is supported by the +of.options.FOG_FANCY.tooltip.6=graphic card. + +of.options.FOG_START=Fog Start +of.options.FOG_START.tooltip.1=Fog start +of.options.FOG_START.tooltip.2= 0.2 - the fog starts near the player +of.options.FOG_START.tooltip.3= 0.8 - the fog starts far from the player +of.options.FOG_START.tooltip.4=This option usually does not affect the performance. + +of.options.CHUNK_LOADING=Chunk Loading +of.options.CHUNK_LOADING.tooltip.1=Chunk Loading +of.options.CHUNK_LOADING.tooltip.2= Default - unstable FPS when loading chunks +of.options.CHUNK_LOADING.tooltip.3= Smooth - stable FPS +of.options.CHUNK_LOADING.tooltip.4= Multi-Core - stable FPS, 3x faster world loading +of.options.CHUNK_LOADING.tooltip.5=Smooth and Multi-Core remove the stuttering and +of.options.CHUNK_LOADING.tooltip.6=freezes caused by chunk loading. +of.options.CHUNK_LOADING.tooltip.7=Multi-Core can speed up 3x the world loading and +of.options.CHUNK_LOADING.tooltip.8=increase FPS by using a second CPU core. +of.options.chunkLoading.smooth=Smooth +of.options.chunkLoading.multiCore=Multi-Core + +of.options.shaders=Shaders... +of.options.shadersTitle=Shaders + +of.options.shaders.packNone=OFF +of.options.shaders.packDefault=(internal) + +of.options.shaders.ANTIALIASING=Antialiasing +of.options.shaders.NORMAL_MAP=Normal Map +of.options.shaders.SPECULAR_MAP=Specular Map +of.options.shaders.RENDER_RES_MUL=Render Quality +of.options.shaders.SHADOW_RES_MUL=Shadow Quality +of.options.shaders.HAND_DEPTH_MUL=Hand Depth +of.options.shaders.CLOUD_SHADOW=Cloud Shadow +of.options.shaders.OLD_HAND_LIGHT=Old Hand Light +of.options.shaders.OLD_LIGHTING=Old Lighting +of.options.shaders.SHADER_PACK=Shader Pack + +of.options.shaders.shadersFolder=Shaders Folder +of.options.shaders.shaderOptions=Shader Options... + +of.options.shaderOptionsTitle=Shader Options + +of.options.quality=Quality... +of.options.qualityTitle=Quality Settings + +of.options.details=Details... +of.options.detailsTitle=Detail Settings + +of.options.performance=Performance... +of.options.performanceTitle=Performance Settings + +of.options.animations=Animations... +of.options.animationsTitle=Animation Settings + +of.options.other=Other... +of.options.otherTitle=Other Settings + +of.options.other.reset=Reset Video Settings... + +of.shaders.profile=Profile + +# Quality + +of.options.mipmap.bilinear=Bilinear +of.options.mipmap.linear=Linear +of.options.mipmap.nearest=Nearest +of.options.mipmap.trilinear=Trilinear + +options.mipmapLevels.tooltip.1=Visual effect which makes distant objects look better +options.mipmapLevels.tooltip.2=by smoothing the texture details +options.mipmapLevels.tooltip.3= OFF - no smoothing +options.mipmapLevels.tooltip.4= 1 - minimum smoothing +options.mipmapLevels.tooltip.5= 4 - maximum smoothing +options.mipmapLevels.tooltip.6=This option usually does not affect the performance. + +of.options.MIPMAP_TYPE=Mipmap Type +of.options.MIPMAP_TYPE.tooltip.1=Visual effect which makes distant objects look better +of.options.MIPMAP_TYPE.tooltip.2=by smoothing the texture details +of.options.MIPMAP_TYPE.tooltip.3= Nearest - rough smoothing (fastest) +of.options.MIPMAP_TYPE.tooltip.4= Linear - normal smoothing +of.options.MIPMAP_TYPE.tooltip.5= Bilinear - fine smoothing +of.options.MIPMAP_TYPE.tooltip.6= Trilinear - finest smoothing (slowest) + + +of.options.AA_LEVEL=Antialiasing +of.options.AA_LEVEL.tooltip.1=Antialiasing +of.options.AA_LEVEL.tooltip.2= OFF - (default) no antialiasing (faster) +of.options.AA_LEVEL.tooltip.3= 2-16 - antialiased lines and edges (slower) +of.options.AA_LEVEL.tooltip.4=The Antialiasing smooths jagged lines and +of.options.AA_LEVEL.tooltip.5=sharp color transitions. +of.options.AA_LEVEL.tooltip.6=When enabled it may substantially decrease the FPS. +of.options.AA_LEVEL.tooltip.7=Not all levels are supported by all graphics cards. +of.options.AA_LEVEL.tooltip.8=Effective after a RESTART! + +of.options.AF_LEVEL=Anisotropic Filtering +of.options.AF_LEVEL.tooltip.1=Anisotropic Filtering +of.options.AF_LEVEL.tooltip.2= OFF - (default) standard texture detail (faster) +of.options.AF_LEVEL.tooltip.3= 2-16 - finer details in mipmapped textures (slower) +of.options.AF_LEVEL.tooltip.4=The Anisotropic Filtering restores details in +of.options.AF_LEVEL.tooltip.5=mipmapped textures. +of.options.AF_LEVEL.tooltip.6=When enabled it may substantially decrease the FPS. + +of.options.CLEAR_WATER=Clear Water +of.options.CLEAR_WATER.tooltip.1=Clear Water +of.options.CLEAR_WATER.tooltip.2= ON - clear, transparent water +of.options.CLEAR_WATER.tooltip.3= OFF - default water + +of.options.RANDOM_MOBS=Random Mobs +of.options.RANDOM_MOBS.tooltip.1=Random Mobs +of.options.RANDOM_MOBS.tooltip.2= OFF - no random mobs, faster +of.options.RANDOM_MOBS.tooltip.3= ON - random mobs, slower +of.options.RANDOM_MOBS.tooltip.4=Random mobs uses random textures for the game creatures. +of.options.RANDOM_MOBS.tooltip.5=It needs a resource pack which has multiple mob textures. + +of.options.BETTER_GRASS=Better Grass +of.options.BETTER_GRASS.tooltip.1=Better Grass +of.options.BETTER_GRASS.tooltip.2= OFF - default side grass texture, fastest +of.options.BETTER_GRASS.tooltip.3= Fast - full side grass texture, slower +of.options.BETTER_GRASS.tooltip.4= Fancy - dynamic side grass texture, slowest + +of.options.BETTER_SNOW=Better Snow +of.options.BETTER_SNOW.tooltip.1=Better Snow +of.options.BETTER_SNOW.tooltip.2= OFF - default snow, faster +of.options.BETTER_SNOW.tooltip.3= ON - better snow, slower +of.options.BETTER_SNOW.tooltip.4=Shows snow under transparent blocks (fence, tall grass) +of.options.BETTER_SNOW.tooltip.5=when bordering with snow blocks. + +of.options.CUSTOM_FONTS=Custom Fonts +of.options.CUSTOM_FONTS.tooltip.1=Custom Fonts +of.options.CUSTOM_FONTS.tooltip.2= ON - uses custom fonts (default), slower +of.options.CUSTOM_FONTS.tooltip.3= OFF - uses default font, faster +of.options.CUSTOM_FONTS.tooltip.4=The custom fonts are supplied by the current +of.options.CUSTOM_FONTS.tooltip.5=resource pack. + +of.options.CUSTOM_COLORS=Custom Colors +of.options.CUSTOM_COLORS.tooltip.1=Custom Colors +of.options.CUSTOM_COLORS.tooltip.2= ON - uses custom colors (default), slower +of.options.CUSTOM_COLORS.tooltip.3= OFF - uses default colors, faster +of.options.CUSTOM_COLORS.tooltip.4=The custom colors are supplied by the current +of.options.CUSTOM_COLORS.tooltip.5=resource pack. + +of.options.SWAMP_COLORS=Swamp Colors +of.options.SWAMP_COLORS.tooltip.1=Swamp Colors +of.options.SWAMP_COLORS.tooltip.2= ON - use swamp colors (default), slower +of.options.SWAMP_COLORS.tooltip.3= OFF - do not use swamp colors, faster +of.options.SWAMP_COLORS.tooltip.4=The swamp colors affect grass, leaves, vines and water. + +of.options.SMOOTH_BIOMES=Smooth Biomes +of.options.SMOOTH_BIOMES.tooltip.1=Smooth Biomes +of.options.SMOOTH_BIOMES.tooltip.2= ON - smoothing of biome borders (default), slower +of.options.SMOOTH_BIOMES.tooltip.3= OFF - no smoothing of biome borders, faster +of.options.SMOOTH_BIOMES.tooltip.4=The smoothing of biome borders is done by sampling and +of.options.SMOOTH_BIOMES.tooltip.5=averaging the color of all surrounding blocks. +of.options.SMOOTH_BIOMES.tooltip.6=Affected are grass, leaves, vines and water. + +of.options.CONNECTED_TEXTURES=Connected Textures +of.options.CONNECTED_TEXTURES.tooltip.1=Connected Textures +of.options.CONNECTED_TEXTURES.tooltip.2= OFF - no connected textures (default) +of.options.CONNECTED_TEXTURES.tooltip.3= Fast - fast connected textures +of.options.CONNECTED_TEXTURES.tooltip.4= Fancy - fancy connected textures +of.options.CONNECTED_TEXTURES.tooltip.5=Connected textures joins the textures of glass, +of.options.CONNECTED_TEXTURES.tooltip.6=sandstone and bookshelves when placed next to +of.options.CONNECTED_TEXTURES.tooltip.7=each other. The connected textures are supplied +of.options.CONNECTED_TEXTURES.tooltip.8=by the current resource pack. + +of.options.NATURAL_TEXTURES=Natural Textures +of.options.NATURAL_TEXTURES.tooltip.1=Natural Textures +of.options.NATURAL_TEXTURES.tooltip.2= OFF - no natural textures (default) +of.options.NATURAL_TEXTURES.tooltip.3= ON - use natural textures +of.options.NATURAL_TEXTURES.tooltip.4=Natural textures remove the gridlike pattern +of.options.NATURAL_TEXTURES.tooltip.5=created by repeating blocks of the same type. +of.options.NATURAL_TEXTURES.tooltip.6=It uses rotated and flipped variants of the base +of.options.NATURAL_TEXTURES.tooltip.7=block texture. The configuration for the natural +of.options.NATURAL_TEXTURES.tooltip.8=textures is supplied by the current resource pack. + +of.options.CUSTOM_SKY=Custom Sky +of.options.CUSTOM_SKY.tooltip.1=Custom Sky +of.options.CUSTOM_SKY.tooltip.2= ON - custom sky textures (default), slow +of.options.CUSTOM_SKY.tooltip.3= OFF - default sky, faster +of.options.CUSTOM_SKY.tooltip.4=The custom sky textures are supplied by the current +of.options.CUSTOM_SKY.tooltip.5=resource pack. + +of.options.CUSTOM_ITEMS=Custom Items +of.options.CUSTOM_ITEMS.tooltip.1=Custom Items +of.options.CUSTOM_ITEMS.tooltip.2= ON - custom item textures (default), slow +of.options.CUSTOM_ITEMS.tooltip.3= OFF - default item textures, faster +of.options.CUSTOM_ITEMS.tooltip.4=The custom item textures are supplied by the current +of.options.CUSTOM_ITEMS.tooltip.5=resource pack. + +of.options.CUSTOM_ENTITY_MODELS=Custom Entity Models +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=Custom Entity Models +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= ON - custom entity models (default), slow +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= OFF - default entity models, faster +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=The custom entity models are supplied by the current +of.options.CUSTOM_ENTITY_MODELS.tooltip.5=resource pack. + +# Details + +of.options.CLOUDS=Clouds +of.options.CLOUDS.tooltip.1=Clouds +of.options.CLOUDS.tooltip.2= Default - as set by setting Graphics +of.options.CLOUDS.tooltip.3= Fast - lower quality, faster +of.options.CLOUDS.tooltip.4= Fancy - higher quality, slower +of.options.CLOUDS.tooltip.5= OFF - no clouds, fastest +of.options.CLOUDS.tooltip.6=Fast clouds are rendered 2D. +of.options.CLOUDS.tooltip.7=Fancy clouds are rendered 3D. + +of.options.CLOUD_HEIGHT=Cloud Height +of.options.CLOUD_HEIGHT.tooltip.1=Cloud Height +of.options.CLOUD_HEIGHT.tooltip.2= OFF - default height +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - above world height limit + +of.options.TREES=Trees +of.options.TREES.tooltip.1=Trees +of.options.TREES.tooltip.2= Default - as set by setting Graphics +of.options.TREES.tooltip.3= Fast - lower quality, faster +of.options.TREES.tooltip.4= Smart - higher quality, fast +of.options.TREES.tooltip.5= Fancy - highest quality, slower +of.options.TREES.tooltip.6=Fast trees have opaque leaves. +of.options.TREES.tooltip.7=Fancy and smart trees have transparent leaves. + +of.options.RAIN=Rain & Snow +of.options.RAIN.tooltip.1=Rain & Snow +of.options.RAIN.tooltip.2= Default - as set by setting Graphics +of.options.RAIN.tooltip.3= Fast - light rain/snow, faster +of.options.RAIN.tooltip.4= Fancy - heavy rain/snow, slower +of.options.RAIN.tooltip.5= OFF - no rain/snow, fastest +of.options.RAIN.tooltip.6=When rain is OFF the splashes and rain sounds +of.options.RAIN.tooltip.7=are still active. + +of.options.SKY=Sky +of.options.SKY.tooltip.1=Sky +of.options.SKY.tooltip.2= ON - sky is visible, slower +of.options.SKY.tooltip.3= OFF - sky is not visible, faster +of.options.SKY.tooltip.4=When sky is OFF the moon and sun are still visible. + +of.options.STARS=Stars +of.options.STARS.tooltip.1=Stars +of.options.STARS.tooltip.2= ON - stars are visible, slower +of.options.STARS.tooltip.3= OFF - stars are not visible, faster + +of.options.SUN_MOON=Sun & Moon +of.options.SUN_MOON.tooltip.1=Sun & Moon +of.options.SUN_MOON.tooltip.2= ON - sun and moon are visible (default) +of.options.SUN_MOON.tooltip.3= OFF - sun and moon are not visible (faster) + +of.options.SHOW_CAPES=Show Capes +of.options.SHOW_CAPES.tooltip.1=Show Capes +of.options.SHOW_CAPES.tooltip.2= ON - show player capes (default) +of.options.SHOW_CAPES.tooltip.3= OFF - do not show player capes + +of.options.TRANSLUCENT_BLOCKS=Translucent Blocks +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Translucent Blocks +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Fancy - correct color blending (default) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Fast - fast color blending (faster) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Controls the color blending of translucent blocks +of.options.TRANSLUCENT_BLOCKS.tooltip.5=with different color (stained glass, water, ice) +of.options.TRANSLUCENT_BLOCKS.tooltip.6=when placed behind each other with air between them. + +of.options.HELD_ITEM_TOOLTIPS=Held Item Tooltips +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Held item tooltips +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= ON - show tooltips for held items (default) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= OFF - do not show tooltips for held items + +of.options.ADVANCED_TOOLTIPS=Advanced Tooltips +of.options.ADVANCED_TOOLTIPS.tooltip.1=Advanced tooltips +of.options.ADVANCED_TOOLTIPS.tooltip.2= ON - show advanced tooltips +of.options.ADVANCED_TOOLTIPS.tooltip.3= OFF - do not show advanced tooltips (default) +of.options.ADVANCED_TOOLTIPS.tooltip.4=Advanced tooltips show extended information for +of.options.ADVANCED_TOOLTIPS.tooltip.5=items (id, durability) and for shader options +of.options.ADVANCED_TOOLTIPS.tooltip.6=(id, source, default value). + +of.options.DROPPED_ITEMS=Dropped Items +of.options.DROPPED_ITEMS.tooltip.1=Dropped Items +of.options.DROPPED_ITEMS.tooltip.2= Default - as set by setting Graphics +of.options.DROPPED_ITEMS.tooltip.3= Fast - 2D dropped items, faster +of.options.DROPPED_ITEMS.tooltip.4= Fancy - 3D dropped items, slower + +options.entityShadows.tooltip.1=Entity Shadows +options.entityShadows.tooltip.2= ON - show entity shadows +options.entityShadows.tooltip.3= OFF - do not show entity shadows + +of.options.VIGNETTE=Vignette +of.options.VIGNETTE.tooltip.1=Visual effect which slightly darkens the screen corners +of.options.VIGNETTE.tooltip.2= Default - as set by the setting Graphics (default) +of.options.VIGNETTE.tooltip.3= Fast - vignette disabled (faster) +of.options.VIGNETTE.tooltip.4= Fancy - vignette enabled (slower) +of.options.VIGNETTE.tooltip.5=The vignette may have a significant effect on the FPS, +of.options.VIGNETTE.tooltip.6=especially when playing fullscreen. +of.options.VIGNETTE.tooltip.7=The vignette effect is very subtle and can safely +of.options.VIGNETTE.tooltip.8=be disabled. + +of.options.DYNAMIC_FOV=Dynamic FOV +of.options.DYNAMIC_FOV.tooltip.1=Dynamic FOV +of.options.DYNAMIC_FOV.tooltip.2= ON - enable dynamic FOV (default) +of.options.DYNAMIC_FOV.tooltip.3= OFF - disable dynamic FOV +of.options.DYNAMIC_FOV.tooltip.4=Changes the field of view (FOV) when flying, sprinting +of.options.DYNAMIC_FOV.tooltip.5=or pulling a bow. + +of.options.DYNAMIC_LIGHTS=Dynamic Lights +of.options.DYNAMIC_LIGHTS.tooltip.1=Dynamic Lights +of.options.DYNAMIC_LIGHTS.tooltip.2= OFF - no dynamic lights (default) +of.options.DYNAMIC_LIGHTS.tooltip.3= Fast - fast dynamic lights (updated every 500ms) +of.options.DYNAMIC_LIGHTS.tooltip.4= Fancy - fancy dynamic lights (updated in real-time) +of.options.DYNAMIC_LIGHTS.tooltip.5=Enables light emitting items (torch, glowstone, etc.) +of.options.DYNAMIC_LIGHTS.tooltip.6=to illuminate everything around them when held in hand, +of.options.DYNAMIC_LIGHTS.tooltip.7=equipped by other player or dropped on the ground. + +# Performance + +of.options.SMOOTH_FPS=Smooth FPS +of.options.SMOOTH_FPS.tooltip.1=Stabilizes FPS by flushing the graphic driver buffers. +of.options.SMOOTH_FPS.tooltip.2= OFF - no stabilization, FPS may fluctuate +of.options.SMOOTH_FPS.tooltip.3= ON - FPS stabilization +of.options.SMOOTH_FPS.tooltip.4=This option is graphics driver dependant and its effect +of.options.SMOOTH_FPS.tooltip.5=is not always visible. + +of.options.SMOOTH_WORLD=Smooth World +of.options.SMOOTH_WORLD.tooltip.1=Removes lag spikes caused by the internal server. +of.options.SMOOTH_WORLD.tooltip.2= OFF - no stabilization, FPS may fluctuate +of.options.SMOOTH_WORLD.tooltip.3= ON - FPS stabilization +of.options.SMOOTH_WORLD.tooltip.4=Stabilizes FPS by distributing the internal server load. +of.options.SMOOTH_WORLD.tooltip.5=Effective only for local worlds (single player). + +of.options.FAST_RENDER=Fast Render +of.options.FAST_RENDER.tooltip.1=Fast Render +of.options.FAST_RENDER.tooltip.2= OFF - standard rendering (default) +of.options.FAST_RENDER.tooltip.3= ON - optimized rendering (faster) +of.options.FAST_RENDER.tooltip.4=Uses optimized rendering algorithm which decreases +of.options.FAST_RENDER.tooltip.5=the GPU load and may substantially increase the FPS. + +of.options.FAST_MATH=Fast Math +of.options.FAST_MATH.tooltip.1=Fast Math +of.options.FAST_MATH.tooltip.2= OFF - standard math (default) +of.options.FAST_MATH.tooltip.3= ON - faster math +of.options.FAST_MATH.tooltip.4=Uses optimized sin() and cos() functions which can +of.options.FAST_MATH.tooltip.5=better utilize the CPU cache and increase the FPS. + +of.options.CHUNK_UPDATES=Chunk Updates +of.options.CHUNK_UPDATES.tooltip.1=Chunk updates +of.options.CHUNK_UPDATES.tooltip.2= 1 - slower world loading, higher FPS (default) +of.options.CHUNK_UPDATES.tooltip.3= 3 - faster world loading, lower FPS +of.options.CHUNK_UPDATES.tooltip.4= 5 - fastest world loading, lowest FPS +of.options.CHUNK_UPDATES.tooltip.5=Number of chunk updates per rendered frame, +of.options.CHUNK_UPDATES.tooltip.6=higher values may destabilize the framerate. + +of.options.CHUNK_UPDATES_DYNAMIC=Dynamic Updates +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Dynamic chunk updates +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= OFF - (default) standard chunk updates per frame +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= ON - more updates while the player is standing still +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=Dynamic updates force more chunk updates while +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=the player is standing still to load the world faster. + +of.options.LAZY_CHUNK_LOADING=Lazy Chunk Loading +of.options.LAZY_CHUNK_LOADING.tooltip.1=Lazy Chunk Loading +of.options.LAZY_CHUNK_LOADING.tooltip.2= OFF - default server chunk loading +of.options.LAZY_CHUNK_LOADING.tooltip.3= ON - lazy server chunk loading (smoother) +of.options.LAZY_CHUNK_LOADING.tooltip.4=Smooths the integrated server chunk loading by +of.options.LAZY_CHUNK_LOADING.tooltip.5=distributing the chunks over several ticks. +of.options.LAZY_CHUNK_LOADING.tooltip.6=Turn it OFF if parts of the world do not load correctly. +of.options.LAZY_CHUNK_LOADING.tooltip.7=Effective only for local worlds and single-core CPU. + +# Animations + +of.options.animation.allOn=All ON +of.options.animation.allOff=All OFF +of.options.animation.dynamic=Dynamic + +of.options.ANIMATED_WATER=Water Animated +of.options.ANIMATED_LAVA=Lava Animated +of.options.ANIMATED_FIRE=Fire Animated +of.options.ANIMATED_PORTAL=Portal Animated +of.options.ANIMATED_REDSTONE=Redstone Animated +of.options.ANIMATED_EXPLOSION=Explosion Animated +of.options.ANIMATED_FLAME=Flame Animated +of.options.ANIMATED_SMOKE=Smoke Animated +of.options.VOID_PARTICLES=Void Particles +of.options.WATER_PARTICLES=Water Particles +of.options.RAIN_SPLASH=Rain Splash +of.options.PORTAL_PARTICLES=Portal Particles +of.options.POTION_PARTICLES=Potion Particles +of.options.DRIPPING_WATER_LAVA=Dripping Water/Lava +of.options.ANIMATED_TERRAIN=Terrain Animated +of.options.ANIMATED_TEXTURES=Textures Animated +of.options.FIREWORK_PARTICLES=Firework Particles + +# Other + +of.options.LAGOMETER=Lagometer +of.options.LAGOMETER.tooltip.1=Shows the lagometer on the debug screen (F3). +of.options.LAGOMETER.tooltip.2=* Orange - Memory garbage collection +of.options.LAGOMETER.tooltip.3=* Cyan - Tick +of.options.LAGOMETER.tooltip.4=* Blue - Scheduled executables +of.options.LAGOMETER.tooltip.5=* Purple - Chunk upload +of.options.LAGOMETER.tooltip.6=* Red - Chunk updates +of.options.LAGOMETER.tooltip.7=* Yellow - Visibility check +of.options.LAGOMETER.tooltip.8=* Green - Render terrain + +of.options.PROFILER=Debug Profiler +of.options.PROFILER.tooltip.1=Debug Profiler +of.options.PROFILER.tooltip.2= ON - debug profiler is active, slower +of.options.PROFILER.tooltip.3= OFF - debug profiler is not active, faster +of.options.PROFILER.tooltip.4=The debug profiler collects and shows debug information +of.options.PROFILER.tooltip.5=when the debug screen is open (F3). + +of.options.WEATHER=Weather +of.options.WEATHER.tooltip.1=Weather +of.options.WEATHER.tooltip.2= ON - weather is active, slower +of.options.WEATHER.tooltip.3= OFF - weather is not active, faster +of.options.WEATHER.tooltip.4=The weather controls rain, snow and thunderstorms. +of.options.WEATHER.tooltip.5=Weather control is only possible for local worlds. + +of.options.time.dayOnly=Day Only +of.options.time.nightOnly=Night Only + +of.options.TIME=Time +of.options.TIME.tooltip.1=Time +of.options.TIME.tooltip.2= Default - normal day/night cycles +of.options.TIME.tooltip.3= Day Only - day only +of.options.TIME.tooltip.4= Night Only - night only +of.options.TIME.tooltip.5=The time setting is only effective in CREATIVE mode +of.options.TIME.tooltip.6=and for local worlds. + +options.fullscreen.tooltip.1=Fullscreen +options.fullscreen.tooltip.2= ON - use fullscreen mode +options.fullscreen.tooltip.3= OFF - use window mode +options.fullscreen.tooltip.4=Fullscreen mode may be faster or slower than +options.fullscreen.tooltip.5=window mode, depending on the graphics card. + +of.options.FULLSCREEN_MODE=Fullscreen Mode +of.options.FULLSCREEN_MODE.tooltip.1=Fullscreen mode +of.options.FULLSCREEN_MODE.tooltip.2= Default - use desktop screen resolution, slower +of.options.FULLSCREEN_MODE.tooltip.3= WxH - use custom screen resolution, may be faster +of.options.FULLSCREEN_MODE.tooltip.4=The selected resolution is used in fullscreen mode (F11). +of.options.FULLSCREEN_MODE.tooltip.5=Lower resolutions should generally be faster. + +of.options.SHOW_FPS=Show FPS +of.options.SHOW_FPS.tooltip.1=Shows compact FPS and render information. +of.options.SHOW_FPS.tooltip.2= C: - chunk renderers +of.options.SHOW_FPS.tooltip.3= E: - rendered entities + block entities +of.options.SHOW_FPS.tooltip.4= U: - chunk updates +of.options.SHOW_FPS.tooltip.5=The compact FPS information is only shown when the +of.options.SHOW_FPS.tooltip.6=debug screen is not visible. + +of.options.save.default=Default (2s) +of.options.save.20s=20s +of.options.save.3min=3min +of.options.save.30min=30min + +of.options.AUTOSAVE_TICKS=Autosave +of.options.AUTOSAVE_TICKS.tooltip.1=Autosave interval +of.options.AUTOSAVE_TICKS.tooltip.2=Default autosave interval (2s) is NOT RECOMMENDED. +of.options.AUTOSAVE_TICKS.tooltip.3=Autosave causes the famous Lag Spike of Death. + +of.options.SCREENSHOT_SIZE=Screenshot Size +of.options.SCREENSHOT_SIZE.tooltip.1=Screenshot Size +of.options.SCREENSHOT_SIZE.tooltip.2= Default - default screenshot size +of.options.SCREENSHOT_SIZE.tooltip.3= 2x-4x - custom screenshot size +of.options.SCREENSHOT_SIZE.tooltip.4=Capturing bigger screenshots may need more memory. +of.options.SCREENSHOT_SIZE.tooltip.5=Not compatible with Fast Render and Antialiasing. +of.options.SCREENSHOT_SIZE.tooltip.6=Requires GPU framebuffer support. \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/optifine/lang/es_ES.lang b/src/minecraft/assets/minecraft/optifine/lang/es_ES.lang new file mode 100644 index 0000000..adb45ce --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/es_ES.lang @@ -0,0 +1,580 @@ +# General +of.general.ambiguous=ambiguo +of.general.custom=Personalizado +of.general.from=De +of.general.id=ID +of.general.restart=Reiniciar +of.general.smart=Inteligente + +# Keys +of.key.zoom=Hacer zoom + +# Message +of.message.aa.shaders1=Antialiasing no es compatible con shaders. +of.message.aa.shaders2=Desactívalas para usar esta función. + +of.message.af.shaders1=Anisotrópico no es compatible con shaders. +of.message.af.shaders2=Desactívalas para usar esta función. + +of.message.fr.shaders1=Renderizado rápido no es compatible con shaders. +of.message.fr.shaders2=Desactívalas para usar esta función. + +of.message.shaders.aa1=Las shaders no son compatibles con antialiasing. +of.message.shaders.aa2=Para desactivarlo, haz clic en Calidad -> Antialiasing. + +of.message.shaders.af1=Las shaders no son compatibles con anisotrópico. +of.message.shaders.af2=Para desactivarlo, haz clic en Calidad -> Anisotrópico. + +of.message.shaders.fr1=Las shaders no son compatibles con el renderizado rápido. +of.message.shaders.fr2=Para desactivarlo, haz clic en Rendimiento -> Renderizado rápido. + +of.message.newVersion=Hay una nueva versión de §eOptiFine§f disponible: §e%s§f +of.message.java64Bit=Instala §eJava de 64-bits§f para mejorar el rendimiento +of.message.openglError=§eError de OpenGL§f: %s (%s) + +of.message.shaders.loading=Cargando shader: %s + +of.message.other.reset=¿Restablecer toda la configuración gráfica? + +# Video settings + +options.graphics.tooltip.1=Calidad gráfica +options.graphics.tooltip.2= Rápida - peor calidad, mejor rendimiento +options.graphics.tooltip.3= Detallada - mejor calidad, peor rendimiento +options.graphics.tooltip.4= +options.graphics.tooltip.5=Los cambios se aprecian en las nubes, en las hojas, +options.graphics.tooltip.6=en la lluvia, en los objetos sueltos y en las esquinas +options.graphics.tooltip.7=de la pantalla del juego. + +of.options.renderDistance.extreme=Extremo + +options.renderDistance.tooltip.1=Distancia de chunks renderizada +options.renderDistance.tooltip.2= 2 Mínimo - 32m (increíblemente rápido) +options.renderDistance.tooltip.3= 4 Corto - 64m (rápido) +options.renderDistance.tooltip.4= 8 Normal - 128m +options.renderDistance.tooltip.5= 16 Lejano - 256m (lento) +options.renderDistance.tooltip.6= 32 Extremo - 512m (¡extremadamente lento!) +options.renderDistance.tooltip.7=¡El renderizado extremo necesita un buen equipo! +options.renderDistance.tooltip.8=Los valores mayores de 16 no funcionan en multijugador. + +options.ao.tooltip.1=Iluminación suave +options.ao.tooltip.2= NO - sin iluminación suave (rápido) +options.ao.tooltip.3= Mínimo - iluminación suave simple (lento) +options.ao.tooltip.4= Máximo - iluminación suave avanzada (más lento) + +options.framerateLimit.tooltip.1=Límite de FPS +options.framerateLimit.tooltip.2= VSync - limita los FPS según el monitor (60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - límite personalizado +options.framerateLimit.tooltip.4= Sin límite - todos los FPS posibles (rápido) +options.framerateLimit.tooltip.5= +options.framerateLimit.tooltip.6=Al establecer un límite, los FPS pueden disminuir llegar +options.framerateLimit.tooltip.7=a este. +of.options.framerateLimit.vsync=VSync + +of.options.AO_LEVEL=Nivel de suavidad +of.options.AO_LEVEL.tooltip.1=Nivel de la iluminación suave +of.options.AO_LEVEL.tooltip.2= NO - sin sombras +of.options.AO_LEVEL.tooltip.3= 50%% - pocas sombras +of.options.AO_LEVEL.tooltip.4= 100%% - sombras oscuras + +options.viewBobbing.tooltip.1=Movimiento más realista. +options.viewBobbing.tooltip.2=Desactivar al usar mipmap para obtener mejor resultado. + +options.guiScale.tooltip.1=Escala de la interfaz (GUI) +options.guiScale.tooltip.2=Una interfaz más pequeña puede mejorar el rendimiento. + +options.vbo.tooltip.1=Vertex Buffer Objects (abreviado como VBO) +options.vbo.tooltip.2=Forma alternativa de renderizado que suele ser más +options.vbo.tooltip.3=rápida (5-10%%) que la predeterminada. + +options.gamma.tooltip.1=Modificar el brillo +options.gamma.tooltip.2= Oscuro - brillo por defecto +options.gamma.tooltip.3= 1-99%% - brillo personalizado +options.gamma.tooltip.4= Claro - brillo al máximo +options.gamma.tooltip.5= +options.gamma.tooltip.6=Esta opción no cambia completamente el brillo de los +options.gamma.tooltip.7=objetos más oscuros. + +options.anaglyph.tooltip.1=Visión en 3D +options.anaglyph.tooltip.2=Activar un efecto estereoscópico usando un color +options.anaglyph.tooltip.3=diferente para cada ojo. +options.anaglyph.tooltip.4=NOTA: Requiere gafas anaglíficas (rojas y azules). + +of.options.ALTERNATE_BLOCKS=Bloques alternos +of.options.ALTERNATE_BLOCKS.tooltip.1=Bloques con texturas alternas +of.options.ALTERNATE_BLOCKS.tooltip.2=Usar texturas alternativas para un mismo bloque. +of.options.ALTERNATE_BLOCKS.tooltip.3=Depende del paquete de recursos usado. + +of.options.FOG_FANCY=Niebla +of.options.FOG_FANCY.tooltip.1=Tipo de niebla +of.options.FOG_FANCY.tooltip.2= Rápida - niebla más rápida, luce cutre +of.options.FOG_FANCY.tooltip.3= Detallada - niebla más lenta, luce mejor +of.options.FOG_FANCY.tooltip.4= NO - sin niebla, superrápido +of.options.FOG_FANCY.tooltip.5=La niebla detallada sólo está disponible si la tarjeta +of.options.FOG_FANCY.tooltip.6=gráfica lo permite. + +of.options.FOG_START=Distancia de niebla +of.options.FOG_START.tooltip.1=Distancia a la que empieza la niebla +of.options.FOG_START.tooltip.2= 0.2 - la niebla empieza cerca del jugador +of.options.FOG_START.tooltip.3= 0.8 - la niebla empieza lejos del jugador +of.options.FOG_START.tooltip.4=Normalmente esta opción no afecta al rendimiento. + +of.options.CHUNK_LOADING=Carga de chunks +of.options.CHUNK_LOADING.tooltip.1=Velocidad de carga de chunks +of.options.CHUNK_LOADING.tooltip.2= Por defecto - FPS inestables al cargar chunks +of.options.CHUNK_LOADING.tooltip.3= Suave - FPS estables +of.options.CHUNK_LOADING.tooltip.4= Multinúcleo - FPS estables y una velocidad 3 veces superior +of.options.CHUNK_LOADING.tooltip.5=Las opciones "Suave" y "Multinúcleo" eliminan los tirones y la +of.options.CHUNK_LOADING.tooltip.6=lentitud causada por la carga de chunks. +of.options.CHUNK_LOADING.tooltip.7=Multinúcleo puede acelerar la carga hasta 3 veces más y mejorar +of.options.CHUNK_LOADING.tooltip.8=los FPS al usar un segundo núcleo del CPU. +of.options.chunkLoading.smooth=Suave +of.options.chunkLoading.multiCore=Multinúcleo + +of.options.shaders=Shaders... +of.options.shadersTitle=Shaders + +of.options.shaders.packNone=(ninguna shader) +of.options.shaders.packDefault=(shader interna) + +of.options.shaders.ANTIALIASING=Antialiasing +of.options.shaders.NORMAL_MAP=Normal mapping +of.options.shaders.SPECULAR_MAP=Specular mapping +of.options.shaders.RENDER_RES_MUL=Calidad render. +of.options.shaders.SHADOW_RES_MUL=Calidad sombras +of.options.shaders.HAND_DEPTH_MUL=Prof. de campo +of.options.shaders.CLOUD_SHADOW=Sombras de nubes +of.options.shaders.OLD_HAND_LIGHT=Lclás. en mano +of.options.shaders.OLD_LIGHTING=Luz clásica +of.options.shaders.SHADER_PACK=Paquete de shader + +of.options.shaders.shadersFolder=Carpeta de shaders +of.options.shaders.shaderOptions=Opciones de shader... + +of.options.shaderOptionsTitle=Opciones de shader + +of.options.quality=Calidad... +of.options.qualityTitle=Opciones de la calidad gráfica + +of.options.details=Detalles... +of.options.detailsTitle=Opciones de la calidad gráfica + +of.options.performance=Rendimiento... +of.options.performanceTitle=Opciones de rendimiento + +of.options.animations=Animaciones... +of.options.animationsTitle=Activar o desactivar animaciones + +of.options.other=Opciones varias... +of.options.otherTitle=Opciones varias + +of.options.other.reset=Restablecer toda la configuración... + +of.shaders.profile=Perfil + +# Quality + +of.options.mipmap.bilinear=Bilineal +of.options.mipmap.linear=Lineal +of.options.mipmap.nearest=Cercano +of.options.mipmap.trilinear=Trilineal + +options.mipmapLevels.tooltip.1=Efecto visual que hace que los objetos lejanos luzcan +options.mipmapLevels.tooltip.2=mejor gracias a que suaviza los detalles de su textura +options.mipmapLevels.tooltip.3= +options.mipmapLevels.tooltip.4= NO - sin suavizado +options.mipmapLevels.tooltip.5= 1 - suavizado mínimo +options.mipmapLevels.tooltip.6= 4 - suavizado máximo +options.mipmapLevels.tooltip.7= +options.mipmapLevels.tooltip.8=Normalmente esta opción no afecta al rendimiento. + +of.options.MIPMAP_TYPE=Tipo de mipmap +of.options.MIPMAP_TYPE.tooltip.1=Efecto visual que hace que los objetos lejanos luzcan +of.options.MIPMAP_TYPE.tooltip.2=mejor gracias a que suaviza los detalles de su textura +of.options.MIPMAP_TYPE.tooltip.3= +of.options.MIPMAP_TYPE.tooltip.4= Cercano - suavizado bruto (más rápido) +of.options.MIPMAP_TYPE.tooltip.5= Lineal - suavizado normal +of.options.MIPMAP_TYPE.tooltip.6= Bilineal - suavizado fino +of.options.MIPMAP_TYPE.tooltip.7= Trilineal - suavizado muy fino (más lento) + + +of.options.AA_LEVEL=Antialiasing +of.options.AA_LEVEL.tooltip.1=Antialiasing suaviza líneas y bordes de los bloques +of.options.AA_LEVEL.tooltip.2= NO - (por defecto) sin antialiasing (más rápido) +of.options.AA_LEVEL.tooltip.3= 2-16 - nivel de suavizado del antialiasing (más lento) +of.options.AA_LEVEL.tooltip.4= +of.options.AA_LEVEL.tooltip.5= Suaviza los dientes de sierra y mejora la nitidez. +of.options.AA_LEVEL.tooltip.6=Los FPS pueden disminuir considerablemente al activarse. +of.options.AA_LEVEL.tooltip.7=Algunas tarjetas gráficas no soportan todos los niveles. +of.options.AA_LEVEL.tooltip.8= ¡El cambio será aplicado al REINICIAR el juego! + +of.options.AF_LEVEL=Anisotrópico +of.options.AF_LEVEL.tooltip.1=Filtrado anisotrópico +of.options.AF_LEVEL.tooltip.2= NO - (por defecto) detalle normal de texturas (rápido) +of.options.AF_LEVEL.tooltip.3= 2-16 - refinar texturas al usar mipmap (más lento) +of.options.AF_LEVEL.tooltip.4= +of.options.AF_LEVEL.tooltip.6=Este filtro recupera detalles al usar mipmap. +of.options.AF_LEVEL.tooltip.7=Los FPS pueden disminuir considerablemente al activarse. + +of.options.CLEAR_WATER=Aguas cristalinas +of.options.CLEAR_WATER.tooltip.1=Aguas cristalinas +of.options.CLEAR_WATER.tooltip.2= SÍ - agua limpia y transparente +of.options.CLEAR_WATER.tooltip.3= NO - agua predeterminada del juego + +of.options.RANDOM_MOBS=Criaturas aleatorias +of.options.RANDOM_MOBS.tooltip.1=Aleatorizar las texturas de las criaturas +of.options.RANDOM_MOBS.tooltip.2= NO - sin aleatorizar, más rápido +of.options.RANDOM_MOBS.tooltip.3= SÍ - con aleatorización, más lento +of.options.RANDOM_MOBS.tooltip.4= +of.options.RANDOM_MOBS.tooltip.5=Esta opción permite que las criaturas cambien de textura. +of.options.RANDOM_MOBS.tooltip.6=Requiere un paquete de recursos que tenga varias texturas +of.options.RANDOM_MOBS.tooltip.7=para una misma criatura. + +of.options.BETTER_GRASS=Césped mejorado +of.options.BETTER_GRASS.tooltip.1=Textura de los lados del césped mejorada +of.options.BETTER_GRASS.tooltip.2= NO - césped normal (por defecto), más rápido +of.options.BETTER_GRASS.tooltip.3= Rápida - todo el bloque lleno de césped, más lento +of.options.BETTER_GRASS.tooltip.4= Detallada - textura dinámica, mucho más lento + +of.options.BETTER_SNOW=Nieve mejorada +of.options.BETTER_SNOW.tooltip.1=Nieve mejorada +of.options.BETTER_SNOW.tooltip.2= NO - nieve predeterminada, más rápido +of.options.BETTER_SNOW.tooltip.3= SÍ - nieve mejorada, más lento +of.options.BETTER_SNOW.tooltip.4= +of.options.BETTER_SNOW.tooltip.5=Mostrar nieve debajo de los bloques transparantes +of.options.BETTER_SNOW.tooltip.6=(vallas, hierbas) al bordearlos con nieve. + +of.options.CUSTOM_FONTS=Fuentes personalizadas +of.options.CUSTOM_FONTS.tooltip.1=Fuentes personalizadas +of.options.CUSTOM_FONTS.tooltip.2= SÍ - usar personalizadas (por defecto), más lento +of.options.CUSTOM_FONTS.tooltip.3= NO - usar la predeterminada, más rápido +of.options.CUSTOM_FONTS.tooltip.4= +of.options.CUSTOM_FONTS.tooltip.5=Algunos paquetes de recursos tienen fuentes +of.options.CUSTOM_FONTS.tooltip.6=personalizadas. + +of.options.CUSTOM_COLORS=Colores personalizados +of.options.CUSTOM_COLORS.tooltip.1=Colores personalizados +of.options.CUSTOM_COLORS.tooltip.2= SÍ - usar colores personalizados (por defecto), más lento +of.options.CUSTOM_COLORS.tooltip.3= NO - usar colores predeterminados, más rápido +of.options.CUSTOM_COLORS.tooltip.4= +of.options.CUSTOM_COLORS.tooltip.5=Algunos paquetes de recursos tienen colores +of.options.CUSTOM_COLORS.tooltip.6=personalizados. + +of.options.SWAMP_COLORS=Color de pantanos +of.options.SWAMP_COLORS.tooltip.1=Color de pantanos +of.options.SWAMP_COLORS.tooltip.2= SÍ - color en pantanos (por defecto), más lento +of.options.SWAMP_COLORS.tooltip.3= NO - sin color en los pantanos, más rápido +of.options.SWAMP_COLORS.tooltip.4=Afecta a: césped, agua, hojas y enredaderas. + +of.options.SMOOTH_BIOMES=Suavizar biomas +of.options.SMOOTH_BIOMES.tooltip.1=Suavizar bordes de biomas +of.options.SMOOTH_BIOMES.tooltip.2= SÍ - suavizar bordes de biomas (por defecto), más lento +of.options.SMOOTH_BIOMES.tooltip.3= NO - no suavizar bordes de biomas, más rápido +of.options.SMOOTH_BIOMES.tooltip.4= +of.options.SMOOTH_BIOMES.tooltip.5=El suavizado se realiza mediante el degradado del color de +of.options.SMOOTH_BIOMES.tooltip.6=los bloques cercanos al borde. +of.options.SMOOTH_BIOMES.tooltip.7=Afecta a: césped, agua, hojas y enredaderas. + +of.options.CONNECTED_TEXTURES=Unir texturas +of.options.CONNECTED_TEXTURES.tooltip.1=Unir algunas texturas (Connected Textures) +of.options.CONNECTED_TEXTURES.tooltip.2= NO - no unirlas (por defecto) +of.options.CONNECTED_TEXTURES.tooltip.3= Rápida - unirlas de forma rápida +of.options.CONNECTED_TEXTURES.tooltip.4= Detallada - unirlas de forma mejorada +of.options.CONNECTED_TEXTURES.tooltip.5= +of.options.CONNECTED_TEXTURES.tooltip.6=Unir las texturas de los cristales, de la arenisca y de +of.options.CONNECTED_TEXTURES.tooltip.7=las librerías al juntar los bloques. +of.options.CONNECTED_TEXTURES.tooltip.8=No todos los paquetes de recursos soportan esta opción. + +of.options.NATURAL_TEXTURES=Texturas naturales +of.options.NATURAL_TEXTURES.tooltip.1=Texturas naturales +of.options.NATURAL_TEXTURES.tooltip.2= NO - sin texturas naturales (por defecto) +of.options.NATURAL_TEXTURES.tooltip.3= SÍ - con texturas naturales +of.options.NATURAL_TEXTURES.tooltip.4=Esta opción elimina el patrón de los bloques +of.options.NATURAL_TEXTURES.tooltip.5=que se crea al poner bloques del mismo tipo. +of.options.NATURAL_TEXTURES.tooltip.6=Se usan variantes rotadas y voleteadas de la textura +of.options.NATURAL_TEXTURES.tooltip.7=base del bloque. +of.options.NATURAL_TEXTURES.tooltip.8=No todos los paquetes de recursos soportan esta opción. + +of.options.CUSTOM_SKY=Cielo personalizado +of.options.CUSTOM_SKY.tooltip.1=Textura personalizada del cielo +of.options.CUSTOM_SKY.tooltip.2= SÍ - cielo personalizado (por defecto), más lento +of.options.CUSTOM_SKY.tooltip.3= NO - cielo predeterminado, más rápido +of.options.CUSTOM_SKY.tooltip.4= +of.options.CUSTOM_SKY.tooltip.5=No todos los paquetes de recursos soportan esta opción. + +of.options.CUSTOM_ITEMS=Objetos personalizados +of.options.CUSTOM_ITEMS.tooltip.1=Textura personalizada de objetos (ítems) +of.options.CUSTOM_ITEMS.tooltip.2= SÍ - objetos personalizadas (por defecto), más lento +of.options.CUSTOM_ITEMS.tooltip.3= NO - objetos predeterminados, más rápido +of.options.CUSTOM_ITEMS.tooltip.4= +of.options.CUSTOM_ITEMS.tooltip.5=No todos los paquetes de recursos soportan esta opción. + +# Details + +of.options.CLOUDS=Capa de nubes +of.options.CLOUDS.tooltip.1=Capa de nubes +of.options.CLOUDS.tooltip.2= Por defecto - depende del ajuste de la calidad gráfica +of.options.CLOUDS.tooltip.3= Rápida - peor calidad, rápido +of.options.CLOUDS.tooltip.4= Detallada - mayor calidad, lento +of.options.CLOUDS.tooltip.5= NO - sin nubes, superrápido +of.options.CLOUDS.tooltip.6= +of.options.CLOUDS.tooltip.7=Las nubes rápidas se renderizan en 2D. +of.options.CLOUDS.tooltip.8=Las nubes detalladas se renderizan en 3D. + +of.options.CLOUD_HEIGHT=Elevación de nubes +of.options.CLOUD_HEIGHT.tooltip.1=Aumento en la altura de la capa de nubes +of.options.CLOUD_HEIGHT.tooltip.2= NO - altura por defecto +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - encima del límite del mundo + +of.options.TREES=Arboleda +of.options.TREES.tooltip.1=Calidad de hojas de árboles +of.options.TREES.tooltip.2= Por defecto - depende del ajuste de la calidad gráfica +of.options.TREES.tooltip.3= Rápida - baja calidad, muy rápido +of.options.TREES.tooltip.4= Inteligente - más calidad, rápido +of.options.TREES.tooltip.5= Detallada - máxima calidad, más lento +of.options.TREES.tooltip.6= +of.options.TREES.tooltip.7=La arboleda rápida dejará las hojas sin transparencia. +of.options.TREES.tooltip.8="Detallada" e "Inteligente" sí mantienen la transparencia. + +of.options.RAIN=Lluvia/Nieve +of.options.RAIN.tooltip.1=Lluvia y nieve +of.options.RAIN.tooltip.2= Por defecto - depende del ajuste de la calidad gráfica +of.options.RAIN.tooltip.3= Rápida - lluvia/nieve ligera, más rápido +of.options.RAIN.tooltip.4= Detallada - lluvia/nieve intensa, más lento +of.options.RAIN.tooltip.5= NO - sin lluvia/nieve, fastest +of.options.RAIN.tooltip.6= +of.options.RAIN.tooltip.7=Aunque se desactive la lluvia, el sonido sigue estando +of.options.RAIN.tooltip.8=activado. + +of.options.SKY=Cielo +of.options.SKY.tooltip.1=Cielo +of.options.SKY.tooltip.2= SÍ - cielo visible, más lento +of.options.SKY.tooltip.3= NO - cielo no visible, más lento +of.options.SKY.tooltip.4= +of.options.SKY.tooltip.5=Aunque se desactive, la Luna y el Sol se podrán seguir +of.options.SKY.tooltip.6=viendo. + +of.options.STARS=Cielo estrellado +of.options.STARS.tooltip.1=Visibilidad de estrellas en el cielo nocturno +of.options.STARS.tooltip.2= SÍ - estrellas, más lento +of.options.STARS.tooltip.3= NO - sin estrellas, más rápido + +of.options.SUN_MOON=Sol/Luna +of.options.SUN_MOON.tooltip.1=Visibilidad del Sol y la Luna +of.options.SUN_MOON.tooltip.2= SÍ - el Sol y la Luna SÍ son visibles (por defecto) +of.options.SUN_MOON.tooltip.3= NO - el Sol y la Luna NO son visibles (rápido) + +of.options.SHOW_CAPES=Capas +of.options.SHOW_CAPES.tooltip.1=Capas de jugadores +of.options.SHOW_CAPES.tooltip.2= SÍ - mostrar las capas de los jugadores (por defecto) +of.options.SHOW_CAPES.tooltip.3= NO - ocultar las capas de los jugadores + +of.options.TRANSLUCENT_BLOCKS=Translucidez +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Calidad de los bloques translúcidos +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Detallada - mezcla de colores perfecta (por defecto) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Rápida - mezcla de colores cutre (más rápido) +of.options.TRANSLUCENT_BLOCKS.tooltip.4= +of.options.TRANSLUCENT_BLOCKS.tooltip.5=Esta opción afecta a los bloques translúcidos que tienen +of.options.TRANSLUCENT_BLOCKS.tooltip.6=color pero sólo cuando se colocan uno detrás del otro con +of.options.TRANSLUCENT_BLOCKS.tooltip.7=un bloque vacío entre ambos. +of.options.TRANSLUCENT_BLOCKS.tooltip.8=Afecta a: cristal tintado, agua, hielo... + +of.options.HELD_ITEM_TOOLTIPS=Texto en barra inferior +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Nombre de objetos en la barra inferior +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= SÍ - mostrar nombres (por defecto) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= NO - no mostrar nombres (como antiguamente) + +of.options.DROPPED_ITEMS=Cosas tiradas +of.options.DROPPED_ITEMS.tooltip.1=Calidad de los objetos en el suelo sin recoger +of.options.DROPPED_ITEMS.tooltip.2= Por defecto - depende del ajuste de la calidad gráfica +of.options.DROPPED_ITEMS.tooltip.3= Rápida - objetos en 2D, más rápido +of.options.DROPPED_ITEMS.tooltip.4= Detallada - objetos en 3D, más lento pero más bonito + +options.entityShadows.tooltip.1=Sombras de entidades +options.entityShadows.tooltip.2= SÍ - mostrar sombras en las entidades +options.entityShadows.tooltip.3= NO - no mostrar sombras en las entidades + +of.options.VIGNETTE=Esquinas +of.options.VIGNETTE.tooltip.1=(Efecto viñeta) oscurece las esquinas de la pantalla +of.options.VIGNETTE.tooltip.2= Por defecto - depende del ajuste de la calidad gráfica +of.options.VIGNETTE.tooltip.3= Rápida - efecto viñeta desactivado (más rápido) +of.options.VIGNETTE.tooltip.4= Detallada - efecto viñeta activado (más lento) +of.options.VIGNETTE.tooltip.5= +of.options.VIGNETTE.tooltip.6=Los FPS pueden disminuir considerablemente al activarse, +of.options.VIGNETTE.tooltip.7=sobretodo en pantalla completa. +of.options.VIGNETTE.tooltip.8=El efecto viñeta se puede deshabilitar sin ningún problema. + +of.options.DYNAMIC_FOV=Campo de visión dinámico +of.options.DYNAMIC_FOV.tooltip.1=Campo de visión dinámico +of.options.DYNAMIC_FOV.tooltip.2= SÍ - activarlo (por defecto) +of.options.DYNAMIC_FOV.tooltip.3= NO - desactivarlo +of.options.DYNAMIC_FOV.tooltip.4=Cambiar el campo de visión (FOV) al volar, correr o apuntar +of.options.DYNAMIC_FOV.tooltip.5=con un arco. + +of.options.DYNAMIC_LIGHTS=Iluminación dinámica +of.options.DYNAMIC_LIGHTS.tooltip.1=Iluminación dinámica +of.options.DYNAMIC_LIGHTS.tooltip.2= NO - sin i. dinámica (por defecto) +of.options.DYNAMIC_LIGHTS.tooltip.3= Rápida - i. dinámica rápida (se actualiza cada 500ms) +of.options.DYNAMIC_LIGHTS.tooltip.4= Detallada - i. dinámica detallada (se actualiza en tiempo real) +of.options.DYNAMIC_LIGHTS.tooltip.5= +of.options.DYNAMIC_LIGHTS.tooltip.6=Esta opción permite a algunos objetos emitir luz sin estar colocados. +of.options.DYNAMIC_LIGHTS.tooltip.7=Al equipar uno de esos objetos en la mano, o al tirarlos al suelo +of.options.DYNAMIC_LIGHTS.tooltip.8=el entorno se iluminará (afecta a: antorchas, piedra luminosa...). + +# Performance + +of.options.SMOOTH_FPS=Estabilizar FPS +of.options.SMOOTH_FPS.tooltip.1=Establizar FPS nivelando el búfer del controlador gráfico +of.options.SMOOTH_FPS.tooltip.2= NO - sin estabilización +of.options.SMOOTH_FPS.tooltip.3= SÍ - con estabilización +of.options.SMOOTH_FPS.tooltip.4= +of.options.SMOOTH_FPS.tooltip.5=Esta opción depende del controlador gráfico y su efecto +of.options.SMOOTH_FPS.tooltip.6=no siempre es notorio. + +of.options.SMOOTH_WORLD=Estabilizar mundos +of.options.SMOOTH_WORLD.tooltip.1=Eliminar los picos de lag causados por el servidor interno +of.options.SMOOTH_WORLD.tooltip.2= NO - sin estabilización +of.options.SMOOTH_WORLD.tooltip.3= SÍ - con estabilización +of.options.SMOOTH_WORLD.tooltip.4= +of.options.SMOOTH_WORLD.tooltip.5=Esta opción estabiliza los FPS distribuyendo la carga del +of.options.SMOOTH_WORLD.tooltip.6=servidor interno. +of.options.SMOOTH_WORLD.tooltip.7=No funciona en multijugador. + +of.options.FAST_RENDER=Renderizado rápido +of.options.FAST_RENDER.tooltip.1=Renderizar rápidamente +of.options.FAST_RENDER.tooltip.2= NO - renderizado estandar (por defecto) +of.options.FAST_RENDER.tooltip.3= SÍ - renderizado optimizado (rápido) +of.options.FAST_RENDER.tooltip.4= +of.options.FAST_RENDER.tooltip.5=Usa un algoritmo de renderizado mejorado que reduce el +of.options.FAST_RENDER.tooltip.6=consumo de GPU y aumenta los FPS. + +of.options.FAST_MATH=Matemática rápida +of.options.FAST_MATH.tooltip.1=Matemática rápida +of.options.FAST_MATH.tooltip.2= NO - estandar (por defecto) +of.options.FAST_MATH.tooltip.3= SÍ - sistema rápido +of.options.FAST_MATH.tooltip.4= +of.options.FAST_MATH.tooltip.5=Usar las funciones sin() y cos() de Java de forma +of.options.FAST_MATH.tooltip.6=optimizada para mejorar el uso de caché del CPU y mejorar +of.options.FAST_MATH.tooltip.7=los FPS. + +of.options.CHUNK_UPDATES=Actualizaciones de chunks +of.options.CHUNK_UPDATES.tooltip.1=Actualizaciones de chunks +of.options.CHUNK_UPDATES.tooltip.2= 1 - carga lenta, más FPS (por defecto) +of.options.CHUNK_UPDATES.tooltip.3= 3 - carga rápida, menos FPS +of.options.CHUNK_UPDATES.tooltip.4= 5 - carga superrápida, muchos menos FPS +of.options.CHUNK_UPDATES.tooltip.5= +of.options.CHUNK_UPDATES.tooltip.6=Número de chunks renderizados por cada fotograma. +of.options.CHUNK_UPDATES.tooltip.7=Los valores más altos pueden desestabilizar los FPS. + +of.options.CHUNK_UPDATES_DYNAMIC=Actualización dinámica +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Actualizaciones de chunks dinámicas +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= NO - (por defecto) carga normal por fotograma +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= SÍ - más actualizaciones mientras estés quieto +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4= +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=Esta opción fuerza la actualización de chunks mientras +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.6=estás quieto para cargar el mundo más rápidamente. + +of.options.LAZY_CHUNK_LOADING=Carga de chunks vaga +of.options.LAZY_CHUNK_LOADING.tooltip.1=Carga de chunks vaga +of.options.LAZY_CHUNK_LOADING.tooltip.2= NO - carga de chunks predeterminada +of.options.LAZY_CHUNK_LOADING.tooltip.3= SÍ - carga de chunks vaga (estabiliza la carga) +of.options.LAZY_CHUNK_LOADING.tooltip.4= +of.options.LAZY_CHUNK_LOADING.tooltip.5=Suaviza la carga interna de chunks distribuyéndola durante +of.options.LAZY_CHUNK_LOADING.tooltip.6=varios ticks. Desactívala si algunas partes del mundo no se +of.options.LAZY_CHUNK_LOADING.tooltip.7=cargan correctamente. +of.options.LAZY_CHUNK_LOADING.tooltip.8=Sólo funciona en mundos locales con CPUs de un núcleo. + +# Animations + +of.options.animation.allOn=TODAS +of.options.animation.allOff=NINGUNA +of.options.animation.dynamic=Dinámicas + +of.options.ANIMATED_WATER=Agua +of.options.ANIMATED_LAVA=Lava +of.options.ANIMATED_FIRE=Fuego +of.options.ANIMATED_PORTAL=Portales +of.options.ANIMATED_REDSTONE=Redstone +of.options.ANIMATED_EXPLOSION=Explosiones +of.options.ANIMATED_FLAME=Llamaradas +of.options.ANIMATED_SMOKE=Humo +of.options.VOID_PARTICLES=Partículas del vacío +of.options.WATER_PARTICLES=Partículas del agua +of.options.RAIN_SPLASH=Salpicaduras de lluvia +of.options.PORTAL_PARTICLES=Partículas de portales +of.options.POTION_PARTICLES=Partículas de pociones +of.options.DRIPPING_WATER_LAVA=Goteo de agua/lava +of.options.ANIMATED_TERRAIN=Terreno animado +of.options.ANIMATED_TEXTURES=Texturas animadas +of.options.FIREWORK_PARTICLES=Partículas de cohetes + +# Other + +of.options.LAGOMETER=Medidor de lag +of.options.LAGOMETER.tooltip.1=Muestra el medidor de lag al usar F3. +of.options.LAGOMETER.tooltip.2=* Naranja - Basura en la memoria +of.options.LAGOMETER.tooltip.3=* Cian - Ticks +of.options.LAGOMETER.tooltip.4=* Azul - Ejecutables programados +of.options.LAGOMETER.tooltip.5=* Morado - Carga de chunks +of.options.LAGOMETER.tooltip.6=* Rojo - Actualizaciones de chunks +of.options.LAGOMETER.tooltip.7=* Amarillo - Chequeo de visibilidad +of.options.LAGOMETER.tooltip.8=* Verde - Terreno renderizado + +of.options.PROFILER=Perfil debug +of.options.PROFILER.tooltip.1=Debug (también llamado depuración) +of.options.PROFILER.tooltip.2= SÍ - perfil debug activado, más lento +of.options.PROFILER.tooltip.3= NO - perfil debug desactivado, más rápido +of.options.PROFILER.tooltip.4=El perfil debug reúne y muestra más datos cuando se +of.options.PROFILER.tooltip.5=usa F3. + +of.options.WEATHER=Clima +of.options.WEATHER.tooltip.1=Clima (tiempo atmosférico) +of.options.WEATHER.tooltip.2= SÍ - clima activado, más lento +of.options.WEATHER.tooltip.3= NO - clima desactivado, más rápido +of.options.WEATHER.tooltip.4=El clima controla la lluvia, la nieve y las tormentas. +of.options.WEATHER.tooltip.5=Esta opción no funciona en multijugador. + +of.options.time.dayOnly=Sólo día +of.options.time.nightOnly=Sólo noche + +of.options.TIME=Reloj +of.options.TIME.tooltip.1=Reloj (tiempo) +of.options.TIME.tooltip.2= Por defecto - ciclos normales de día/noche +of.options.TIME.tooltip.3= Sólo día - sólo es de día +of.options.TIME.tooltip.4= Sólo noche - sólo es de noche +of.options.TIME.tooltip.5=Esta opción sólo funciona en modo creativo y solamente +of.options.TIME.tooltip.6=en mundos locales (en multijugador NO). + +options.fullscreen.tooltip.1=Pantalla completa +options.fullscreen.tooltip.2= SÍ - jugar en pantalla completa +options.fullscreen.tooltip.3= NO - jugar en una ventana +options.fullscreen.tooltip.4=Al jugar en pantalla completa el juego puede funcionar +options.fullscreen.tooltip.5=mejor o peor, depende de la tarjeta gráfica. + +of.options.FULLSCREEN_MODE=Resolución +of.options.FULLSCREEN_MODE.tooltip.1=Resolución de la pantalla completa +of.options.FULLSCREEN_MODE.tooltip.2= Por defecto - resolución del monitor, más lento +of.options.FULLSCREEN_MODE.tooltip.3= Ancho x alto - otra resolución, puede ir más rápido +of.options.FULLSCREEN_MODE.tooltip.4=La resolución cambiará en la pantalla completa (F11). +of.options.FULLSCREEN_MODE.tooltip.5=Normalmente las más bajas aumentan el rendimiento. + +of.options.SHOW_FPS=Mostrar FPS +of.options.SHOW_FPS.tooltip.1=Mostrar FPS y datos de renderizado +of.options.SHOW_FPS.tooltip.2= C: - chunks renderizados +of.options.SHOW_FPS.tooltip.3= E: - entidades renderizadas + "block entities" +of.options.SHOW_FPS.tooltip.4= U: - actualizaciones de chunks +of.options.SHOW_FPS.tooltip.5= +of.options.SHOW_FPS.tooltip.6=Estos reducidos datos sólo se muestran cuando no se +of.options.SHOW_FPS.tooltip.7=usa F3. + +of.options.save.default=Original (2s) +of.options.save.20s=20s +of.options.save.3min=3min +of.options.save.30min=30min + +of.options.AUTOSAVE_TICKS=Autoguardado +of.options.AUTOSAVE_TICKS.tooltip.1=Intervalo del autoguardado +of.options.AUTOSAVE_TICKS.tooltip.2=El intervalo original del juego (2s) NO SE RECOMIENDA. +of.options.AUTOSAVE_TICKS.tooltip.3=Un intervalo corto puede causar mal rendimiento. + +options.anaglyph.tooltip.1=Visión en 3D diff --git a/src/minecraft/assets/minecraft/optifine/lang/es_MX.lang b/src/minecraft/assets/minecraft/optifine/lang/es_MX.lang new file mode 100644 index 0000000..a4f419d --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/es_MX.lang @@ -0,0 +1,527 @@ +# General +of.general.ambiguous=ambiguo +of.general.custom=Personalizado +of.general.from=De +of.general.id=ID +of.general.restart=reiniciar +of.general.smart=Dinámico + +# Message +of.message.aa.shaders1=El anti-aliasing no es compatible con Shaders. +of.message.aa.shaders2=Desactiva Shaders para habilitar esta opción. + +of.message.af.shaders1=El filtrado anisotrópico no es compatible con Shaders. +of.message.af.shaders2=Desactiva Shaders para habilitar esta opción. + +of.message.fr.shaders1=El renderizado rápido no es compatible con Shaders. +of.message.fr.shaders2=Desactiva Shaders para habilitar esta opción. + +of.message.shaders.aa1=Shaders no es compatible con el anti-aliasing activo. +of.message.shaders.aa2=Desactiva la opción ‘anti-aliasing’ en el menú ‘calidad’ y reinicia el juego. + +of.message.shaders.af1=Shaders no es compatible con el filtrado anisótropico activo. +of.message.shaders.af2=Desactiva la opción ‘filtrado antisotrópico’ en el menú ‘calidad’. + +of.message.shaders.fr1=Shaders no es compatible con el renderizado rapido activo. +of.message.shaders.fr2=Desactiva la opción ‘renderizado rapido' en el menú ‘rendimiento’. + +of.message.newVersion=§fUna nueva versión de §eOptiFine §festá disponible: §e%s§f +of.message.java64Bit=§fPrueba instalar §eJava versión de 64bits §fpara incrementar el rendimiento. +of.message.openglError=§eError de OpenGL§f: %s (%s) + +of.message.shaders.loading=Cargando shaders: %s + +of.message.other.reset=¿Quieres reiniciar la configuración de video a los valores de inicio? + +# Video settings + +options.graphics.tooltip.1=Calidad visual. +options.graphics.tooltip.2= Rápida - Mayor velocidad. +options.graphics.tooltip.3= Detallada - Mejor apariencia. +options.graphics.tooltip.4=Cambia la apariencia de nubes, hojas, agua, +options.graphics.tooltip.5=sombras y bloques con pasto. + +of.options.renderDistance.extreme=Extremo + +options.renderDistance.tooltip.1=Distancia de renderizado. +options.renderDistance.tooltip.2= 2 Mínimo - 32 bloques. (más rápido) +options.renderDistance.tooltip.3= 4 Corto - 64 bloques. +options.renderDistance.tooltip.4= 8 Normal - 128 bloques. +options.renderDistance.tooltip.5= 16 Lejano - 256 bloques. +options.renderDistance.tooltip.6= 32 Extremo - 512 bloques. (más lento) +options.renderDistance.tooltip.7=La distancia de renderizado extrema demanda más recursos. +options.renderDistance.tooltip.8=Valores sobre de 16 solo son efectivos en mundos locales. + +options.ao.tooltip.1=Iluminación suave. +options.ao.tooltip.2= NO - Sin suavizado de iluminación. (rápido) +options.ao.tooltip.3= Mínima - Simple, rudo, inceirto. (lento) +options.ao.tooltip.4= Máxima - Agradable, uniforme, neto. (más lento) + +options.framerateLimit.tooltip.1=Restricción de FPS. +options.framerateLimit.tooltip.2= VSync - Reduce los FPS a 60, 30 o 20. +options.framerateLimit.tooltip.3= 5-255 - Cambiante. +options.framerateLimit.tooltip.4= Ilimitados - Excento, sin límites. +options.framerateLimit.tooltip.5=Los cuadros por segundo son reducidos aun si el +options.framerateLimit.tooltip.6=límite no es alcanzado. +of.options.framerateLimit.vsync=VSync + +of.options.AO_LEVEL=Suavizado de iluminación +of.options.AO_LEVEL.tooltip.1=Nivel de iluminación suave. +of.options.AO_LEVEL.tooltip.2= NO - Sin sombras. +of.options.AO_LEVEL.tooltip.3= 50%% - Sombras claras. +of.options.AO_LEVEL.tooltip.4= 100%% - Sombras oscuras. + +options.viewBobbing.tooltip.1=Movimiento de la cámara al caminar. Más realista. +options.viewBobbing.tooltip.2=Para mejores resultados, desactivar cundo utilice mipmaps. + +options.guiScale.tooltip.1=Escala de interfaz. +options.guiScale.tooltip.2=Entre más pequeño podría ser más rápido. + +options.vbo.tooltip.1=Vertex Buffer Objects (OpenGL). +options.vbo.tooltip.2=Utiliza un modelo alternativo de renderizado que incrementa +options.vbo.tooltip.3=la velocidad de 5 a 10%% que el renderizado habitual. + +options.gamma.tooltip.1=Incrementa el brillo en objetos oscuros. +options.gamma.tooltip.2= Moderado - Brillo por defecto. +options.gamma.tooltip.3= Claro - Máximo brillo. +options.gamma.tooltip.4=Esta opción no afecta el brillo de objetos +options.gamma.tooltip.5=completamente oscurecidos. + +options.anaglyph.tooltip.1=Anaglifo 3D. +options.anaglyph.tooltip.2=Habilita un efecto estereoscópico 3D con diferente color +options.anaglyph.tooltip.3=para cada ojo. +options.anaglyph.tooltip.4=Requiere de lentes 3D rojo-azul para una vista apropiada. + +options.blockAlternatives.tooltip.1=Bloques alternativos. +options.blockAlternatives.tooltip.2=Usa modelos alternativos en algunos bloques. +options.blockAlternatives.tooltip.3=Depende del paquete de texturas seleccionado. + +of.options.FOG_FANCY=Neblina +of.options.FOG_FANCY.tooltip.1=Tipo de neblina. +of.options.FOG_FANCY.tooltip.2= NO - Sin neblina, rápido. +of.options.FOG_FANCY.tooltip.3= Rápida - Neblina ligera. +of.options.FOG_FANCY.tooltip.4= Detallada - Neblina lenta, se ve mejor. +of.options.FOG_FANCY.tooltip.5=La neblina detallada solo está disponible si su tarjeta +of.options.FOG_FANCY.tooltip.6=de video lo soporta. + +of.options.FOG_START=Distancia de neblina +of.options.FOG_START.tooltip.1=Donde empieza a verse la neblina. +of.options.FOG_START.tooltip.2= 0.2 - Desde cerca del jugador. +of.options.FOG_START.tooltip.3= 0.8 - Desde lejos del jugador. +of.options.FOG_START.tooltip.4=Esta opción normalmente no afecta el rendimiento. + +of.options.CHUNK_LOADING=Carga de Chunks +of.options.CHUNK_LOADING.tooltip.1=Opción de carga de los pedazos del mapa (chunks). +of.options.CHUNK_LOADING.tooltip.2= Normal - Cuadros por segundo (FPS) inestables al cargar chunks. +of.options.CHUNK_LOADING.tooltip.3= Agradable - FPS constantes. +of.options.CHUNK_LOADING.tooltip.4= Multi-Core - FPS invariables y acelera la carga de los mapas. +of.options.CHUNK_LOADING.tooltip.5=Las opciónes de Agradable y Multi-Core estabilizan y evitan que el juego +of.options.CHUNK_LOADING.tooltip.6=se trabe al cargar chunks. +of.options.CHUNK_LOADING.tooltip.7=Multi-Core aumenta hasta tres veces la velocidad de carga de los mapas +of.options.CHUNK_LOADING.tooltip.8=y también aumenta los FPS ocupando un segundo núcleo del procesador. +of.options.chunkLoading.smooth=Agradable +of.options.chunkLoading.multiCore=Multi-Core + +of.options.shaders=Shaders... +of.options.shadersTitle=Shaders + +of.options.shaders.packNone=NINGUNO +of.options.shaders.packDefault=(interno) + +of.options.shaders.ANTIALIASING=Anti-aliasing +of.options.shaders.NORMAL_MAP=Mapa normal +of.options.shaders.SPECULAR_MAP=Mapa espectacular +of.options.shaders.RENDER_RES_MUL=Rendimiento +of.options.shaders.SHADOW_RES_MUL=Sombras +of.options.shaders.HAND_DEPTH_MUL=Profundidad +of.options.shaders.CLOUD_SHADOW=Sombra de nubes +of.options.shaders.OLD_LIGHTING=Iluminación vieja +of.options.shaders.SHADER_PACK=Paquete de shader + +of.options.shaders.shadersFolder=Folder de Shaders +of.options.shaders.shaderOptions=Opciones del Shader... + +of.options.shaderOptionsTitle=Opciones del Shader + +of.options.quality=Calidad... +of.options.qualityTitle=Configurar calidad. + +of.options.details=Detalles... +of.options.detailsTitle=Configurar detalles. + +of.options.performance=Rendimiento... +of.options.performanceTitle=Configuración del rendimiento. + +of.options.animations=Animaciones... +of.options.animationsTitle=Configuraciones de animaciones. + +of.options.other=Otro... +of.options.otherTitle=Otras configuraciones + +of.options.other.reset=Reiniciar la configuracion de video... + +of.shaders.profile=Perfil + +# Quality + +of.options.mipmap.bilinear=Bilinial +of.options.mipmap.linear=Lineal +of.options.mipmap.nearest=Más cercano +of.options.mipmap.trilinear=Trilineal + +options.mipmapLevels.tooltip.1=Efecto visual que mejora la apariencia de objetos lejanos +options.mipmapLevels.tooltip.2=suavizando los detalles de la textura al redimensionarla. +options.mipmapLevels.tooltip.3= NO - Sin suavizar. +options.mipmapLevels.tooltip.4= 1 – Suavizado mínimo. +options.mipmapLevels.tooltip.5= 4 – Suavizado máximo. +options.mipmapLevels.tooltip.6=Esta opción no suele afectar el rendimiento. + +of.options.MIPMAP_TYPE=Tipo de mipmap +of.options.MIPMAP_TYPE.tooltip.1=Efecto visual que mejora la apariencia de objetos lejanos +of.options.MIPMAP_TYPE.tooltip.2=suavizando los detalles de la textura. +of.options.MIPMAP_TYPE.tooltip.3= Más cercano - Suavizado mínimo. (más rápido) +of.options.MIPMAP_TYPE.tooltip.4= Lineal – Suavizado bajo. +of.options.MIPMAP_TYPE.tooltip.5= Bilineal – Suavizado alto. +of.options.MIPMAP_TYPE.tooltip.6= Trilineal – Suavizado máximo. (más lento) + + +of.options.AA_LEVEL=Anti-aliasing +of.options.AA_LEVEL.tooltip.1=Anti-aliasing. +of.options.AA_LEVEL.tooltip.2= NO - Por defecto. (rápido) +of.options.AA_LEVEL.tooltip.3= 2-16 – Líneas y esquinas más definidas. (lento) +of.options.AA_LEVEL.tooltip.4=El antialiasing mejora y define los bordes de las líneas +of.options.AA_LEVEL.tooltip.5=y las profundas trancisiones de color. +of.options.AA_LEVEL.tooltip.6=Esta opción puede sustancialemnte disminuir los FPS. +of.options.AA_LEVEL.tooltip.7=No todos los niveles son soportados por todas las tarjetas de video. +of.options.AA_LEVEL.tooltip.8=Los cambios serán efectivos al reinicio. + +of.options.AF_LEVEL=Filtro anisotrópico +of.options.AF_LEVEL.tooltip.1=Filtrado anisotrópico. +of.options.AF_LEVEL.tooltip.2= NO - Por defecto. Sin efectos. (rápido) +of.options.AF_LEVEL.tooltip.3= 2-16 – Detalles más finos en texturas con mipmap. (lento) +of.options.AF_LEVEL.tooltip.4=El filtro anisotrópico reafirma detalles en texturas +of.options.AF_LEVEL.tooltip.5=que usan mipmap. +of.options.AF_LEVEL.tooltip.6=Esta opción puede disminuir los FPS. + +of.options.CLEAR_WATER=Claridad del agua +of.options.CLEAR_WATER.tooltip.1=Al sumergirse en ella. +of.options.CLEAR_WATER.tooltip.2= NO – Agua normal. +of.options.CLEAR_WATER.tooltip.3= SÍ – Agua más transparente. + +of.options.RANDOM_MOBS=Mobs aleatorios +of.options.RANDOM_MOBS.tooltip.1=Mobs aleaotrios. +of.options.RANDOM_MOBS.tooltip.2= NO – Sin skins aleatorios de mobs. (rápido) +of.options.RANDOM_MOBS.tooltip.3= SÍ – Skins de mobs aleatorios. (lento) +of.options.RANDOM_MOBS.tooltip.4=Esta opción habilita el uso de skins aleatorias para mobs por +of.options.RANDOM_MOBS.tooltip.5=lo que requiere de un paquete de texturas que los contenga. + +of.options.BETTER_GRASS=Pasto bonito +of.options.BETTER_GRASS.tooltip.1=Modifica como se ven los lados de los bloques de tierra con pasto. +of.options.BETTER_GRASS.tooltip.2= NO – Predeterminada. (rápido) +of.options.BETTER_GRASS.tooltip.3= Rápida – Todos los lados se ven de pasto. +of.options.BETTER_GRASS.tooltip.4= Detallada – Textura dinámica de pasto en los lados. (lento) + +of.options.BETTER_SNOW=Mejora de nieve +of.options.BETTER_SNOW.tooltip.1=Nieve especial. +of.options.BETTER_SNOW.tooltip.2= NO – Nieve por defecto. (rápido) +of.options.BETTER_SNOW.tooltip.3= SÍ – Mejora la nieve. (lento) +of.options.BETTER_SNOW.tooltip.4=Muestra nieve debajo de los bloques transparentes como vallas, +of.options.BETTER_SNOW.tooltip.5=pasto alto, cuando su base está rodeada por bloques de nieve. + +of.options.CUSTOM_FONTS=Fuentes personalizadas +of.options.CUSTOM_FONTS.tooltip.1=Cambia la tipografía del texto. +of.options.CUSTOM_FONTS.tooltip.2= NO – Utiliza la fuente de letra por defecto. (rápido) +of.options.CUSTOM_FONTS.tooltip.3= SÍ – Usar fuentes de letra personalizadas. (lento) +of.options.CUSTOM_FONTS.tooltip.4=Esta opción utiliza la fuente de letra que contenga el +of.options.CUSTOM_FONTS.tooltip.5=paquete de texturas seleccionado. + +of.options.CUSTOM_COLORS=Colores personalizadas +of.options.CUSTOM_COLORS.tooltip.1=Cambia los colores. +of.options.CUSTOM_COLORS.tooltip.2= NO - Por defecto. (rápido) +of.options.CUSTOM_COLORS.tooltip.3= SÍ – Utiliza otros colores. (lento) +of.options.CUSTOM_COLORS.tooltip.4=Esta opción emplea los colores que disponga del +of.options.CUSTOM_COLORS.tooltip.5=paquete de texturas seleccionado. + +of.options.SWAMP_COLORS=Colores pantanosos +of.options.SWAMP_COLORS.tooltip.1=Colores pantanosos. +of.options.SWAMP_COLORS.tooltip.2= NO – No usa colores pantanosos. (rápido) +of.options.SWAMP_COLORS.tooltip.3= SÍ - Usa colores pantanosos. (lento) +of.options.SWAMP_COLORS.tooltip.4=Esta opción afecta los colores del pasto, lianas, hojas y agua. + +of.options.SMOOTH_BIOMES=Biomas suavizados +of.options.SMOOTH_BIOMES.tooltip.1=Cambio entre biomas moderado y suavizado. +of.options.SMOOTH_BIOMES.tooltip.2= NO – Sin suavizado. (rápido) +of.options.SMOOTH_BIOMES.tooltip.3= SÍ – Suavizado. (lento) +of.options.SMOOTH_BIOMES.tooltip.4=El suavizado de las fronteras de los biomas colindantes se realiza +of.options.SMOOTH_BIOMES.tooltip.5=combinando y contemplando el color de los bloques de alrededor. +of.options.SMOOTH_BIOMES.tooltip.6=Solo afecta a hojas, pastos, lianas y agua. + +of.options.CONNECTED_TEXTURES=Texturas conectadas +of.options.CONNECTED_TEXTURES.tooltip.1=Textruas conectadas. +of.options.CONNECTED_TEXTURES.tooltip.2= NO – Sin texturas conectadas. Por defecto. +of.options.CONNECTED_TEXTURES.tooltip.3= Rápido – Texturas conectadas rápidas. +of.options.CONNECTED_TEXTURES.tooltip.4= Detallada – Texturas conectadas finas. +of.options.CONNECTED_TEXTURES.tooltip.5=Es la forma en la que la textura de los bloques de cristal, +of.options.CONNECTED_TEXTURES.tooltip.6=arena, librerías, se conectan entre sí cuando son puestas +of.options.CONNECTED_TEXTURES.tooltip.7=junto a otras del mismo. Las texturas como se unen +of.options.CONNECTED_TEXTURES.tooltip.8=depende del paquete de texturas seleccionado. + +of.options.NATURAL_TEXTURES=Texturas naturales +of.options.NATURAL_TEXTURES.tooltip.1=Apariencia normal y natural de la textura. +of.options.NATURAL_TEXTURES.tooltip.2= NO – Sin texturas mejoradas. Por defecto. +of.options.NATURAL_TEXTURES.tooltip.3= SÍ – Mejora la textura. +of.options.NATURAL_TEXTURES.tooltip.4=Esta opción evita que se tenga una visión repetitiva +of.options.NATURAL_TEXTURES.tooltip.5=de los bloques al juntar bloques del mismo tipo. +of.options.NATURAL_TEXTURES.tooltip.6=Usa variantes en el giro y la rotacón de la textura del +of.options.NATURAL_TEXTURES.tooltip.7=bloque. La configuración del ajuste depende del paquete +of.options.NATURAL_TEXTURES.tooltip.8=de texturas seleccionado. + +of.options.CUSTOM_SKY=Cielo personalizado +of.options.CUSTOM_SKY.tooltip.1=Cielo personalizado. +of.options.CUSTOM_SKY.tooltip.2= NO – Cielo predeterminado. (rápido) +of.options.CUSTOM_SKY.tooltip.3= SÍ – Texturas del cielo personalizadas. Por defecto. (lento) +of.options.CUSTOM_SKY.tooltip.4=La textura para el cielo personalizado es obtenida del +of.options.CUSTOM_SKY.tooltip.5=paquete de texturas seleccionado. + +of.options.CUSTOM_ITEMS=Obejetos personalizados +of.options.CUSTOM_ITEMS.tooltip.1=Usa texturas para los objetos. +of.options.CUSTOM_ITEMS.tooltip.2= NO – Texturas de objetos predeterminadas. (rápido) +of.options.CUSTOM_ITEMS.tooltip.3= SÍ – Texturas de objetos personalizadas. Por defecto. (lento) +of.options.CUSTOM_ITEMS.tooltip.4=Las texturas de los objetos personalizados se obtienen del +of.options.CUSTOM_ITEMS.tooltip.5=paquete de texturas seleccionado. + +# Details + +of.options.CLOUDS=Nube +of.options.CLOUDS.tooltip.1=Como se ven las nubes. +of.options.CLOUDS.tooltip.2= NO - Sin nubes. (más rápido) +of.options.CLOUDS.tooltip.3= Normal - Establecido en la configuración de calidad visual. +of.options.CLOUDS.tooltip.4= Rápida - Menor calidad. (rápido) +of.options.CLOUDS.tooltip.5= Detallada - Alta calidad. (lento) +of.options.CLOUDS.tooltip.6=Las nubes con menor calidad son renderizadas en 2D. +of.options.CLOUDS.tooltip.7=Las nubes con calidad alta son renderizadas en 3D. + +of.options.CLOUD_HEIGHT=Altitud de nube +of.options.CLOUD_HEIGHT.tooltip.1=Que tan arriba se muestran las nubes. +of.options.CLOUD_HEIGHT.tooltip.2= NO - Altitud por defecto. +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - Por encima del límite de altitud. + +of.options.TREES=Árboles +of.options.TREES.tooltip.1=Como se ven las hojas de los árboles. +of.options.TREES.tooltip.2= Normal - Establecido en la configuración de calidad visual. +of.options.TREES.tooltip.3= Rápida - Menor calidad. (más rápido) +of.options.TREES.tooltip.4= Dinámico - Mayor calidad. +of.options.TREES.tooltip.5= Detallada - Calidad alta. (más lento) +of.options.TREES.tooltip.6=Los árboles con menor calidad tienen las hojas opacas. +of.options.TREES.tooltip.7=Los árboles con mayor calidad o dinámicos tienen hojas transparentes. + +of.options.RAIN=Nieve y lluvia +of.options.RAIN.tooltip.1=Lluvia y nieve. +of.options.RAIN.tooltip.2= NO - Sin nieve o lluvia. (más rápido) +of.options.RAIN.tooltip.3= Normal - Establecido en la configuración de calidad visual. +of.options.RAIN.tooltip.4= Rápida - Lluvia y nive ligera. (rápido) +of.options.RAIN.tooltip.5= Detallada - Lluvia y nieve pesada. (lento) +of.options.RAIN.tooltip.6=Esta opción no afecta a las salpicaduras o al ruido de la +of.options.RAIN.tooltip.7=lluvia que se siguen mostrando. + +of.options.SKY=Cielo +of.options.SKY.tooltip.1=Cielo. +of.options.SKY.tooltip.2= NO - No se ve el cielo. (rápido) +of.options.SKY.tooltip.3= SÍ - Se ve el cielo. (lento) +of.options.SKY.tooltip.4=Si se desactiva, el sol y la luna aun pueden estar visibles. + +of.options.STARS=Estrellas +of.options.STARS.tooltip.1=Visibilidad de estrellas del cielo nocturno. +of.options.STARS.tooltip.2= NO - Las estrellas no son visibles. (rápido) +of.options.STARS.tooltip.3= SÍ - Las estrellas son visibles. (lento) + +of.options.SUN_MOON=Sol y luna +of.options.SUN_MOON.tooltip.1=Visibilidad de la luna y del sol. +of.options.SUN_MOON.tooltip.2= NO - El sol y la luna no son visibles. (más rápido) +of.options.SUN_MOON.tooltip.3= SÍ - El sol y la luna son visibles. Por defecto. + +of.options.SHOW_CAPES=Mostrar capas +of.options.SHOW_CAPES.tooltip.1=Muestra las capas en los jugadores. +of.options.SHOW_CAPES.tooltip.2= NO - No mostrar la capa de los jugadores. +of.options.SHOW_CAPES.tooltip.3= SÍ - Mostrar la capa de los jugadores. Por defecto. + +of.options.TRANSLUCENT_BLOCKS=Bloque translúcido +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Bloques con transparencia. +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Normal - Establecido en la configuración de calidad visual. +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Rápida - Mezcla de colores ligera. (rápido) +of.options.TRANSLUCENT_BLOCKS.tooltip.4= Detallada - Corrección definida de colores. (lento) +of.options.TRANSLUCENT_BLOCKS.tooltip.5=Controla el cambio de color entre bloques translúcidos (cristal +of.options.TRANSLUCENT_BLOCKS.tooltip.6=teñido, agua, hielo) cuando son puestos separados por aire. + +of.options.HELD_ITEM_TOOLTIPS=Item en mano +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Muestra información encima del hotbar al cambiar de item en mano. +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= NO - No muestra información. +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= SÍ - Muestra información. Por defecto. + +of.options.DROPPED_ITEMS=Items caídos +of.options.DROPPED_ITEMS.tooltip.1=Afecta como se ven los items. +of.options.DROPPED_ITEMS.tooltip.2= Normal - Establecido en la configuración de calidad visual. +of.options.DROPPED_ITEMS.tooltip.3= Rápida - Los items caídos se ven en 2D. (rápido) +of.options.DROPPED_ITEMS.tooltip.4= Detallada - Los items caídos se ven en 3D. (lento) + +options.entityShadows.tooltip.1=Sombra de entidades (mobs, jugadores, etcétera). +options.entityShadows.tooltip.2= NO - No muestra sombras de entidades. +options.entityShadows.tooltip.3= SÍ - Muestra sombras de entidades. + +of.options.VIGNETTE=Viñeta +of.options.VIGNETTE.tooltip.1=Efecto visual, ligeramente oscurece las esquinas en la pantalla. +of.options.VIGNETTE.tooltip.2= Normal - Establecido en la configuración de calidad visual. +of.options.VIGNETTE.tooltip.3= Rápida - Efecto desactivado. (rápido) +of.options.VIGNETTE.tooltip.4= Detallda - Efecto activado. (lento) +of.options.VIGNETTE.tooltip.5=Esta opción puede tener un impacto significativo en los FPS, +of.options.VIGNETTE.tooltip.6=especialmente cuando juega en pantalla completa. +of.options.VIGNETTE.tooltip.7=Este efecto es liviano por lo que puede ser desactivado +of.options.VIGNETTE.tooltip.8=con seguridad en cualquier momento. + +# Performance + +of.options.SMOOTH_FPS=Estabilizar FPS +of.options.SMOOTH_FPS.tooltip.1=Fija los FPS nivelando el buffer del driver de video. +of.options.SMOOTH_FPS.tooltip.2= NO - Sin estabilización. FPS cambiantes. +of.options.SMOOTH_FPS.tooltip.3= SÍ - Estabilización de FPS. +of.options.SMOOTH_FPS.tooltip.4=Esta opción depende del controlador de la tarjeta de gráficos. +of.options.SMOOTH_FPS.tooltip.5=Su efecto podría no siempre ser notorio. + +of.options.SMOOTH_WORLD=Carga ágil +of.options.SMOOTH_WORLD.tooltip.1=Disminuye el lag repentino causado por el servidor interno. +of.options.SMOOTH_WORLD.tooltip.2= NO - Sin estabilización. FPS variantes. +of.options.SMOOTH_WORLD.tooltip.3= SÍ - Estabiliza los FPS. +of.options.SMOOTH_WORLD.tooltip.4=Estabiliza los FPS, dividiendo la carga del servidor interno. +of.options.SMOOTH_WORLD.tooltip.5=Efectivo solo en mundos locales. + +of.options.FAST_RENDER=Renderizado rápido +of.options.FAST_RENDER.tooltip.1=Renderizado rápido. +of.options.FAST_RENDER.tooltip.2= NO - Renderizado estandard. Por defecto. +of.options.FAST_RENDER.tooltip.3= SÍ - Renderizado optimizado. (rápido) +of.options.FAST_RENDER.tooltip.4=Utiliza un algoritmo de renderizado optimizado que reduce +of.options.FAST_RENDER.tooltip.5=la carga del GPU, aumentando sustancialmente los FPS. + +of.options.FAST_MATH=Matemática avanzada +of.options.FAST_MATH.tooltip.1=Matemática avanzada. +of.options.FAST_MATH.tooltip.2= NO - Matemática estandard. Por defecto. +of.options.FAST_MATH.tooltip.3= SÍ - Matemática rápida. +of.options.FAST_MATH.tooltip.4=Utiliza funciones sin() y cos() optimizadas usando +of.options.FAST_MATH.tooltip.5=el cache del CPU e incrementa los FPS. + +of.options.CHUNK_UPDATES=Actualizaciones de chunks +of.options.CHUNK_UPDATES.tooltip.1=Carga de chunks del mapa por FPS (cuadros por segundo). +of.options.CHUNK_UPDATES.tooltip.2= 1 - Carga del mundo lenta. Más FPS. Por defecto. +of.options.CHUNK_UPDATES.tooltip.3= 3 - Carga del mundo rápida. Menos FPS. +of.options.CHUNK_UPDATES.tooltip.4= 5 - Carga del mundo más rápida. Menos FPS. +of.options.CHUNK_UPDATES.tooltip.5=Es el número de actualizaciones de los pedazos del mapa renderizados +of.options.CHUNK_UPDATES.tooltip.6=por FPS, valores muy altos pueden desestabilizar los FPS. + +of.options.CHUNK_UPDATES_DYNAMIC=Actualizaciones dinámicas +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Actualizaciones dinámicas de chunks. +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= NO - Actualizaciones de chunks por FPS estandar. Por defecto. +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= SÍ - Actualizaciones incluso cuando el jugador no se mueve. +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=Esta opción facilita actualizaciones de chunks incluso mientras el +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=jugador no se mueve, para cargar el mundo mucho más rápido. + +of.options.LAZY_CHUNK_LOADING=Carga retardada +of.options.LAZY_CHUNK_LOADING.tooltip.1=Carga de los pedazos del mapa con retardo. +of.options.LAZY_CHUNK_LOADING.tooltip.2= NO - Carga de chunks determinada por el servidor. +of.options.LAZY_CHUNK_LOADING.tooltip.3= SÍ - Carga de chunks lenta. Más atractiva. +of.options.LAZY_CHUNK_LOADING.tooltip.4=Retraza en varios ticks la carga de chunks integrada por el +of.options.LAZY_CHUNK_LOADING.tooltip.5=servidor. +of.options.LAZY_CHUNK_LOADING.tooltip.6=Desactiva esta opción si el mapa no se carga correctamente. +of.options.LAZY_CHUNK_LOADING.tooltip.7=Efectivo solo en mundos locales y con procesadores de 1 solo núcleo. + +# Animations + +of.options.animation.allOn=Activar todo +of.options.animation.allOff=Desactivar todo +of.options.animation.dynamic=Dinámico + +of.options.ANIMATED_WATER=Animación de agua +of.options.ANIMATED_LAVA=Animación de lava +of.options.ANIMATED_FIRE=Animación de fuego +of.options.ANIMATED_PORTAL=Animación del portal +of.options.ANIMATED_REDSTONE=Animación del redstone +of.options.ANIMATED_EXPLOSION=Animación de explosiones +of.options.ANIMATED_FLAME=Animación de fuego +of.options.ANIMATED_SMOKE=Animación de humo +of.options.VOID_PARTICLES=Partículas del Fin +of.options.WATER_PARTICLES=Partículas de agua +of.options.RAIN_SPLASH=Salpicadura de lluvia +of.options.PORTAL_PARTICLES=Partículas de portal +of.options.POTION_PARTICLES=Partículas de pociones +of.options.DRIPPING_WATER_LAVA=Goteo de agua y lava +of.options.ANIMATED_TERRAIN=Animación del terreno +of.options.ANIMATED_TEXTURES=Animación de texturas +of.options.FIREWORK_PARTICLES=Partículas de cohetes + +# Other + +of.options.LAGOMETER=Medidor de lag +of.options.LAGOMETER.tooltip.1=Muestra una gráfica en la pantalla de depuración (F3). +of.options.LAGOMETER.tooltip.2=* Naranja - Memoria desperdiciada. +of.options.LAGOMETER.tooltip.3=* Cian - Tick. +of.options.LAGOMETER.tooltip.4=* Azul - Tareas programadas. +of.options.LAGOMETER.tooltip.5=* Purpura - Carga de chunks. +of.options.LAGOMETER.tooltip.6=* Rojo - Actualizaciones de chunks. +of.options.LAGOMETER.tooltip.7=* Amarillo - Visibilidad. +of.options.LAGOMETER.tooltip.8=* Verde - Terreno de renderizado. + +of.options.PROFILER=Debug +of.options.PROFILER.tooltip.1=Perfil de debug. +of.options.PROFILER.tooltip.2= NO - Debug desactivado. (rápido) +of.options.PROFILER.tooltip.3= SÍ - Debug activado. (lento) +of.options.PROFILER.tooltip.4=Recopila información de debug y la muestra en +of.options.PROFILER.tooltip.5=la pantalla de dupuración (F3). + +of.options.WEATHER=Clima +of.options.WEATHER.tooltip.1=Clima. +of.options.WEATHER.tooltip.2= NO - Desactiva el clima. (rápido) +of.options.WEATHER.tooltip.3= SÍ - Activa el clima. (lento) +of.options.WEATHER.tooltip.4=Esta opción afecta a las lluvias, la nieve y las tormentas. +of.options.WEATHER.tooltip.5=Solo funciona en mundos locales. + +of.options.time.dayOnly=Día +of.options.time.nightOnly=Noche + +of.options.TIME=Tiempo +of.options.TIME.tooltip.1=Establece el momento del día. +of.options.TIME.tooltip.2= Normal - Ciclo de dia y noche normal. +of.options.TIME.tooltip.3= Día - Siempre es de día. +of.options.TIME.tooltip.4= Noche - Siempre es de noche. +of.options.TIME.tooltip.5=Esta opción solo es efectiva estando en modo creativo +of.options.TIME.tooltip.6=y en mundos locales. + +options.fullscreen.tooltip.1=Pantalla completa. +options.fullscreen.tooltip.2= NO - Modo de ventana. +options.fullscreen.tooltip.3= SÍ - Modo de pantalla completa. +options.fullscreen.tooltip.4=En pantalla completa funciona más rapido que en modo +options.fullscreen.tooltip.5=de ventana, dependiendo de la tarjeta de video. + +of.options.FULLSCREEN_MODE=Resolución +of.options.FULLSCREEN_MODE.tooltip.1=Dimensiones al entrar en modo pantalla completa. +of.options.FULLSCREEN_MODE.tooltip.2= Default - Se ajusta a la pantalla. (lento) +of.options.FULLSCREEN_MODE.tooltip.3= Ancho por Altura - Utiliza la resolución personalizada. +of.options.FULLSCREEN_MODE.tooltip.4=La resoulución de pantalla seleccionada es usada al entrar en pantalla +of.options.FULLSCREEN_MODE.tooltip.5=completa. Resouluciónes pequeñas generalmente son más rápidas. + +of.options.SHOW_FPS=Medidor de FPS +of.options.SHOW_FPS.tooltip.1=Despliega los FPS, además de otra información, resumida. +of.options.SHOW_FPS.tooltip.2= C: - Renderizado de chunks. +of.options.SHOW_FPS.tooltip.3= E: - Entidades y de bloques renderizadas. +of.options.SHOW_FPS.tooltip.4= U: - Actualizaciones de chunks. +of.options.SHOW_FPS.tooltip.5=La información solo se muestra cuando la pantalla +of.options.SHOW_FPS.tooltip.6=de depuración (F3) no es visible. + +of.options.save.default=Predeterminado (2s) +of.options.save.20s=20 s +of.options.save.3min=3 min +of.options.save.30min=30 min + +of.options.AUTOSAVE_TICKS=Autoguardado +of.options.AUTOSAVE_TICKS.tooltip.1=Intervalo de autoguardado de mundos locales. +of.options.AUTOSAVE_TICKS.tooltip.2= Predeterminado - Intervalo por defecto. NO RECOMENDADO. +of.options.AUTOSAVE_TICKS.tooltip.3=Esta función causa el famoso lag de la muerte. + +options.anaglyph.tooltip.1=La función de anaglifo 3D requiere de lentes 3D rojo-azul. diff --git a/src/minecraft/assets/minecraft/optifine/lang/et_EE.lang b/src/minecraft/assets/minecraft/optifine/lang/et_EE.lang new file mode 100644 index 0000000..4b02dfb --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/et_EE.lang @@ -0,0 +1,590 @@ +# General +of.general.ambiguous=ebamäärane +of.general.custom=Kohandatud +of.general.from=Kohast +of.general.id=ID +of.general.restart=taaskäivita +of.general.smart=tark + +# Keys +of.key.zoom=Suum + +# Message +of.message.aa.shaders1=Anti-aliasing ei ühildu varjutajatega. +of.message.aa.shaders2=Palun keela varjutajad selle valiku lubamiseks. + +of.message.af.shaders1=Anisotroopiline filtreerimine ei ühildu varjutajatega. +of.message.af.shaders2=Palun keela varjutajad selle valiku lubamiseks. + +of.message.fr.shaders1=Kiire renderdus ei ühildu varjutajatega. +of.message.fr.shaders2=Palun keela varjutajad selle valiku lubamiseks. + +of.message.an.shaders1=3D-anaglüüf ei ühildu varjutajatega. +of.message.an.shaders2=Palun keela varjutajad selle valiku lubamiseks. + +of.message.shaders.aa1=Varjutajad ei ühildu anti-aliasing'uga. +of.message.shaders.aa2=Palun lülita Kvaliteet -> Anti-aliasing VÄLJA ja taaskäivita mäng. + +of.message.shaders.af1=Varjutajad ei ühildu anisotroopilise filtreerimisega. +of.message.shaders.af2=Palun lülita Kvaliteet -> Anisotroopiline filtr. VÄLJA. + +of.message.shaders.fr1=Varjutajad ei ühildu kiire renderdusega. +of.message.shaders.fr2=Palun lülita Jõudlus -> Kiire renderdus VÄLJA. + +of.message.shaders.an1=Varjutajad ei ühildu 3D-anaglüüfiga. +of.message.shaders.an2=Palun lülita Muu -> 3D-anaglüüf VÄLJA. + +of.message.newVersion=Uus §eOptiFine§f'i versioon on saadaval: §e%s§f +of.message.java64Bit=Sa võid jõudluse parandamiseks installida §e64-bitise Java§f. +of.message.openglError=§eOpenGL'i viga§f: %s (%s) + +of.message.shaders.loading=Varjutajate laadimine: %s + +of.message.other.reset=Lähtestad kõik graafikaseaded vaikimisi väärtustele? + +of.message.loadingVisibleChunks=Laadin nähtavaid kamakaid + +# Video settings + +options.graphics.tooltip.1=Visuaalne kvaliteet +options.graphics.tooltip.2= Kiire - madalam kvaliteet, kiirem +options.graphics.tooltip.3= Uhke - kõrgem kvaliteet, aeglasem +options.graphics.tooltip.4=Muudab pilvede, lehtede, vee, varjude ja muru külgede +options.graphics.tooltip.5=välimust. + +of.options.renderDistance.tiny=pisike +of.options.renderDistance.short=lühike +of.options.renderDistance.normal=tavaline +of.options.renderDistance.far=kauge +of.options.renderDistance.extreme=ekstreemne + +options.renderDistance.tooltip.1=Nähtav kaugus +options.renderDistance.tooltip.2= 2 pisike - 32m (kiireim) +options.renderDistance.tooltip.3= 4 lühike - 64m (kiirem) +options.renderDistance.tooltip.4= 8 tavaline - 128m +options.renderDistance.tooltip.5= 16 kauge - 256m (aeglasem) +options.renderDistance.tooltip.6= 32 ekstreemne - 512m (aeglaseim!) +options.renderDistance.tooltip.7=Ekstreemne nähtavuskaugus on väga ressursinõudlik! +options.renderDistance.tooltip.8=Väärtused üle "16 kauge" toimivad ainult kohalikes maailmades. + +options.ao.tooltip.1=Sujuv valgustus +options.ao.tooltip.2= VÄLJAS - sujuv valgustus puudub (kiirem) +options.ao.tooltip.3= Minimaalne - lihtne sujuv valgustus (aeglasem) +options.ao.tooltip.4= Maksimaalne - keeruline sujuv valgustus (aeglaseim) + +options.framerateLimit.tooltip.1=Maksimaalne kaadrisagedus +options.framerateLimit.tooltip.2= VSync - piira kuvari kaadrisagedusele (60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - muutuja +options.framerateLimit.tooltip.4= Piiramatu - piirang puudub (kiireim) +options.framerateLimit.tooltip.5=Kaadrisageduse piirang alandab kaadrisagedust ka siis, +options.framerateLimit.tooltip.6=kui piirväärtuseni pole jõutud. +of.options.framerateLimit.vsync=VSync + +of.options.AO_LEVEL=Sujuva valgustuse tase +of.options.AO_LEVEL.tooltip.1=Sujuva valgustuse tase +of.options.AO_LEVEL.tooltip.2= VÄLJAS - varjud puuduvad +of.options.AO_LEVEL.tooltip.3= 50%% - heledad varjud +of.options.AO_LEVEL.tooltip.4= 100%% - tumedad varjud + +options.viewBobbing.tooltip.1=Realistlikum liikumine. +options.viewBobbing.tooltip.2=Mipmappimist kasutades lülita see VÄLJA parimate tulemuste +options.viewBobbing.tooltip.3=saavutamiseks. +# Added extra row to tooltip + +options.guiScale.tooltip.1=Kasutajaliidese suurus +options.guiScale.tooltip.2= automaatne - maksimaalsuurus +options.guiScale.tooltip.3= väike, keskmine, suur - 1x kuni 3x +options.guiScale.tooltip.4= 4x kuni 10x - saadaval 4K ekraanidel +options.guiScale.tooltip.5=Paaritud arvud (1x, 3x, 5x, ...) ei ühildu Unicode'ga. +options.guiScale.tooltip.6=Väiksem kasutajaliides võib olla kiirem. + +options.vbo.tooltip.1=Vertex Buffer Objects +options.vbo.tooltip.2=Kasutab alternatiivset renderdusmudelit, mis on tavaliselt +options.vbo.tooltip.3=vaikimisi renderdusest kiirem (5-10%%). + +options.gamma.tooltip.1=Muudab tumedamate objektide heledust. +options.gamma.tooltip.2= Tujukas - standardne heledus +options.gamma.tooltip.3= 1-99%% - muutuja +options.gamma.tooltip.4= Hele - maksimaalne heledus tumedamatele objektidele +options.gamma.tooltip.5=See valik ei muuda täiesti mustade objektide heledust. +options.gamma.tooltip.6= + +options.anaglyph.tooltip.1=3D-anaglüüf +options.anaglyph.tooltip.2=Lubab stereoskoopilise 3D-efekti, kasutades erinevaid +options.anaglyph.tooltip.3=värve eri silmadel. +options.anaglyph.tooltip.4=Vajab punasiniseid prille korralikuks vaatamiseks. + +of.options.ALTERNATE_BLOCKS=Alternatiivsed plokid +of.options.ALTERNATE_BLOCKS.tooltip.1=Alternatiivsed plokid +of.options.ALTERNATE_BLOCKS.tooltip.2=Kasutab alternatiivseid plokimudeleid teatud plokkidel. +of.options.ALTERNATE_BLOCKS.tooltip.3=Sõltub valitud ressursipakist. + +of.options.FOG_FANCY=Udu +of.options.FOG_FANCY.tooltip.1=Udu tüüp +of.options.FOG_FANCY.tooltip.2= Kiire - kiirem udu +of.options.FOG_FANCY.tooltip.3= Uhke - aeglasem udu, näeb parem välja +of.options.FOG_FANCY.tooltip.4= VÄLJAS - udu puudub, kiireim +of.options.FOG_FANCY.tooltip.5=Uhke udu on saadaval vaid siis, kui see on toetatud +of.options.FOG_FANCY.tooltip.6=graafikakaardi poolt. + +of.options.FOG_START=Udu algus +of.options.FOG_START.tooltip.1=Udu algus +of.options.FOG_START.tooltip.2= 0.2 - udu algab mängija lähedalt +of.options.FOG_START.tooltip.3= 0.8 - udu algab mängijast kaugel +of.options.FOG_START.tooltip.4=See valik ei mõjuta tavaliselt jõudlust. + +of.options.CHUNK_LOADING=Kamakate laadimine +of.options.CHUNK_LOADING.tooltip.1=Kamakate laadimine +of.options.CHUNK_LOADING.tooltip.2= Vaikimisi - ebastabiilne kaadrisagedus kamakate laadimisel +of.options.CHUNK_LOADING.tooltip.3= Sujuv - stabiilne kaadrisagedus +of.options.CHUNK_LOADING.tooltip.4= Mitme tuumaga - stabiilne kaadrisagedus, 3x kiirem maailma laadimine +of.options.CHUNK_LOADING.tooltip.5=Sujuv ja mitme tuumaga eemaldavad kamakate laadimiselt +of.options.CHUNK_LOADING.tooltip.6=hakkimise ja külmumise. +of.options.CHUNK_LOADING.tooltip.7=Mitme tuuma režiim võib kiirendada maailma laadimist kuni 3x +of.options.CHUNK_LOADING.tooltip.8=ja suurendada kaadrisagedust, kasutades teist protsessori tuuma. +of.options.chunkLoading.smooth=sujuv +of.options.chunkLoading.multiCore=mitme tuumaga + +of.options.shaders=Varjutajad... +of.options.shadersTitle=Varjutajad + +of.options.shaders.packNone=VÄLJAS +of.options.shaders.packDefault=(sisemised) + +of.options.shaders.ANTIALIASING=Anti-aliasing +of.options.shaders.NORMAL_MAP=Tavaline kaart +of.options.shaders.SPECULAR_MAP=Peegelduv kaart +of.options.shaders.RENDER_RES_MUL=Renderduskvaliteet +of.options.shaders.SHADOW_RES_MUL=Varjukvaliteet +of.options.shaders.HAND_DEPTH_MUL=Käesügavus +of.options.shaders.CLOUD_SHADOW=Pilvevari +of.options.shaders.OLD_HAND_LIGHT=Vana käevalgustus +of.options.shaders.OLD_LIGHTING=Vana valgustus +of.options.shaders.SHADER_PACK=Varjutajapakk + +of.options.shaders.shadersFolder=Varjutajate kaust +of.options.shaders.shaderOptions=Varjutajate valikud... + +of.options.shaderOptionsTitle=Varjutajate valikud + +of.options.quality=Kvaliteet... +of.options.qualityTitle=Kvaliteedi seaded + +of.options.details=Detailid... +of.options.detailsTitle=Detailiseaded + +of.options.performance=Jõudlus... +of.options.performanceTitle=Jõudluse seaded + +of.options.animations=Animatsioonid... +of.options.animationsTitle=Animatiooniseaded + +of.options.other=Muu... +of.options.otherTitle=Muud seaded + +of.options.other.reset=Lähtesta graafikaseaded... + +of.shaders.profile=Profiil + +# Quality + +of.options.mipmap.bilinear=bilineaarne +of.options.mipmap.linear=lineaarne +of.options.mipmap.nearest=lähim +of.options.mipmap.trilinear=trilineaarne + +options.mipmapLevels.tooltip.1=Visuaalne efekt, mis muudab kauged objektid ilusamaks, +options.mipmapLevels.tooltip.2=siludes tekstuuridetaile. +options.mipmapLevels.tooltip.3= VÄLJAS - silumine puudub +options.mipmapLevels.tooltip.4= 1 - minimaalne silumine +options.mipmapLevels.tooltip.5= 4 - maksimaalne silumine +options.mipmapLevels.tooltip.6=See valik ei mõjuta tavaliselt jõudlust. + +of.options.MIPMAP_TYPE=Mipmappimistüüp +of.options.MIPMAP_TYPE.tooltip.1=Visuaalne efekt, mis muudab kauged objektid ilusamaks, +of.options.MIPMAP_TYPE.tooltip.2=siludes tekstuuridetaile. +of.options.MIPMAP_TYPE.tooltip.3= Lähim - jäme silumine (kiireim) +of.options.MIPMAP_TYPE.tooltip.4= Lineaarne - tavaline silumine +of.options.MIPMAP_TYPE.tooltip.5= Bilineaarne - peen silumine +of.options.MIPMAP_TYPE.tooltip.6= Trilineaarne - peeneim silumine (aeglaseim) + + +of.options.AA_LEVEL=Anti-aliasing +of.options.AA_LEVEL.tooltip.1=Anti-aliasing filter +of.options.AA_LEVEL.tooltip.2= VÄLJAS - (vaikimisi) anti-aliasing puudub (kiirem) +of.options.AA_LEVEL.tooltip.3= 2-16 - anti-aliasetud jooned ja servad (aeglasem) +of.options.AA_LEVEL.tooltip.4=Anti-aliasing silub sakilisi jooni ja teravaid värviüleminekuid. +of.options.AA_LEVEL.tooltip.5=Lubamisel võib see oluliselt alandada kaadrisagedust. +of.options.AA_LEVEL.tooltip.6=Kõik tasemed pole toetatud kõikidel graafikakaartidel. +of.options.AA_LEVEL.tooltip.7= +of.options.AA_LEVEL.tooltip.8=Jõustub pärast TAASKÄIVITUST! + +of.options.AF_LEVEL=Anisotroopiline filtr. +of.options.AF_LEVEL.tooltip.1=Anisotroopiline filtreerimine +of.options.AF_LEVEL.tooltip.2= VÄLJAS - (vaikimisi) standardsed tekstuuridetailid (kiirem) +of.options.AF_LEVEL.tooltip.3= 2-16 - peenemad detailid mipmapitud tekstuurides (aeglasem) +of.options.AF_LEVEL.tooltip.4=Anisotroopiline filtreerimine taastab detailid mipmapitud +of.options.AF_LEVEL.tooltip.5=tekstuurides. +of.options.AF_LEVEL.tooltip.6=Lubamisel võib see oluliselt alandada kaadrisagedust. + +of.options.CLEAR_WATER=Selge vesi +of.options.CLEAR_WATER.tooltip.1=Selge vesi +of.options.CLEAR_WATER.tooltip.2= SEES - selge, läbipaistev vesi +of.options.CLEAR_WATER.tooltip.3= VÄLJAS - vaikimisi vesi + +of.options.RANDOM_MOBS=Juhuslikud elukad +of.options.RANDOM_MOBS.tooltip.1=Juhuslikud elukad +of.options.RANDOM_MOBS.tooltip.2= VÄLJAS - juhuslikud elukad puuduvad, kiirem +of.options.RANDOM_MOBS.tooltip.3= SEES - juhuslikud elukad, aeglasem +of.options.RANDOM_MOBS.tooltip.4=Juhuslikud elukad kasutab suvalisi tekstuure mängu olemitel. +of.options.RANDOM_MOBS.tooltip.5=Vajab ressursipakki, millel on mitu elukatekstuuri. + +of.options.BETTER_GRASS=Parem muru +of.options.BETTER_GRASS.tooltip.1=Parem muru +of.options.BETTER_GRASS.tooltip.2= VÄLJAS - vaikimisi muru küljetekstuur, kiireim +of.options.BETTER_GRASS.tooltip.3= Kiire - täielik muru küljetekstuur, aeglasem +of.options.BETTER_GRASS.tooltip.4= Uhke - dünaamiline muru küljetekstuur, aeglaseim + +of.options.BETTER_SNOW=Parem lumi +of.options.BETTER_SNOW.tooltip.1=Parem lumi +of.options.BETTER_SNOW.tooltip.2= VÄLJAS - vaikimisi lumi, kiirem +of.options.BETTER_SNOW.tooltip.3= SEES - parem lumi, aeglasem +of.options.BETTER_SNOW.tooltip.4=Näitab lund läbipaistvate plokkide all (aed, kõrge muru), +of.options.BETTER_SNOW.tooltip.5=kui ääristada lumeplokkidega. + +of.options.CUSTOM_FONTS=Kohandatud fondid +of.options.CUSTOM_FONTS.tooltip.1=Kohandatud fondid +of.options.CUSTOM_FONTS.tooltip.2= SEES - kasutab kohandatud fonte (vaikimisi), aeglasem +of.options.CUSTOM_FONTS.tooltip.3= VÄLJAS - kasutab vaikimisi fonte, kiirem +of.options.CUSTOM_FONTS.tooltip.4=Kohandatud fonte pakub kasutatav ressursipakk. +of.options.CUSTOM_FONTS.tooltip.5= + +of.options.CUSTOM_COLORS=Kohandatud värvid +of.options.CUSTOM_COLORS.tooltip.1=Kohandatud värvid +of.options.CUSTOM_COLORS.tooltip.2= SEES - kasutab kohandatud värve (vaikimisi), aeglasem +of.options.CUSTOM_COLORS.tooltip.3= VÄLJAS - kasutab vaikimisi värve, kiirem +of.options.CUSTOM_COLORS.tooltip.4=Kohandatud värve pakub kasutatav ressursipakk. +of.options.CUSTOM_COLORS.tooltip.5= + +of.options.SWAMP_COLORS=Soo värvid +of.options.SWAMP_COLORS.tooltip.1=Soo värvid +of.options.SWAMP_COLORS.tooltip.2= SEES - kasuta soo värve (vaikimisi), aeglasem +of.options.SWAMP_COLORS.tooltip.3= VÄLJAS - ära kasuta soo värve, kiirem +of.options.SWAMP_COLORS.tooltip.4=Soo värvid mõjutavad muru, lehti, vääte ja vett. + +of.options.SMOOTH_BIOMES=Sujuvad bioomid +of.options.SMOOTH_BIOMES.tooltip.1=Sujuvad bioomid +of.options.SMOOTH_BIOMES.tooltip.2= SEES - bioomide äärte silumine (vaikimisi), aeglasem +of.options.SMOOTH_BIOMES.tooltip.3= VÄLJAS - bioomide äärte silumine puudub, kiirem +of.options.SMOOTH_BIOMES.tooltip.4=Bioomide äärte silumine toimub kõikide ümbritsevate plokkide +of.options.SMOOTH_BIOMES.tooltip.5=juhuslike värvide ja värvide keskmise leidmisega. +of.options.SMOOTH_BIOMES.tooltip.6=Mõjutab muru, lehti, vääte ja vett. + +of.options.CONNECTED_TEXTURES=Ühendatud tekstuurid +of.options.CONNECTED_TEXTURES.tooltip.1=Ühendatud tekstuurid +of.options.CONNECTED_TEXTURES.tooltip.2= VÄLJAS - ühendatud tekstuurid puuduvad (vaikimisi) +of.options.CONNECTED_TEXTURES.tooltip.3= Kiire - kiired ühendatud tekstuurid +of.options.CONNECTED_TEXTURES.tooltip.4= Uhke - uhked ühendatud tekstuurid +of.options.CONNECTED_TEXTURES.tooltip.5=Ühendatud tekstuurid ühendab klaasi, liivakivi ja +of.options.CONNECTED_TEXTURES.tooltip.6=raamaturiiulid, kui need on asetatud kõrvuti. +of.options.CONNECTED_TEXTURES.tooltip.7=Ühendatud tekstuure pakub kasutatav ressursipakk. +of.options.CONNECTED_TEXTURES.tooltip.8= + +of.options.NATURAL_TEXTURES=Naturaalsed tekstuurid +of.options.NATURAL_TEXTURES.tooltip.1=Naturaalsed tekstuurid +of.options.NATURAL_TEXTURES.tooltip.2= VÄLJAS - naturaalsed tekstuurid puuduvad (vaikimisi) +of.options.NATURAL_TEXTURES.tooltip.3= SEES - kasuta naturaalseid tekstuure +of.options.NATURAL_TEXTURES.tooltip.4=Naturaalsed tekstuurid eemaldavad võretaolise mustri, +of.options.NATURAL_TEXTURES.tooltip.5=mille loovad sama tüüpi korduvad plokid. See kasutab +of.options.NATURAL_TEXTURES.tooltip.6=pööratud ja peegeldatud variante põhiploki tekstuurist. +of.options.NATURAL_TEXTURES.tooltip.7=Naturaalsete tekstuuride konfiguratsiooni pakub +of.options.NATURAL_TEXTURES.tooltip.8=kasutatav ressursipakk. + +of.options.CUSTOM_SKY=Kohandatud taevas +of.options.CUSTOM_SKY.tooltip.1=Kohandatud taevas +of.options.CUSTOM_SKY.tooltip.2= SEES - kohandatud taevatekstuurid (vaikimisi), aeglane +of.options.CUSTOM_SKY.tooltip.3= VÄLJAS - vaikimisi taevas, kiirem +of.options.CUSTOM_SKY.tooltip.4=Kohandatud taevatekstuure pakub kasutatav ressursipakk. +of.options.CUSTOM_SKY.tooltip.5= + +of.options.CUSTOM_ITEMS=Kohandatud esemed +of.options.CUSTOM_ITEMS.tooltip.1=Kohandatud esemed +of.options.CUSTOM_ITEMS.tooltip.2= SEES - kohandatud esemetekstuurid (vaikimisi), aeglane +of.options.CUSTOM_ITEMS.tooltip.3= VÄLJAS - vaikimisi esemetekstuurid, kiirem +of.options.CUSTOM_ITEMS.tooltip.4=Kohandatud esemetekstuure pakub kasutatav ressursipakk. +of.options.CUSTOM_ITEMS.tooltip.5= + +of.options.CUSTOM_ENTITY_MODELS=Kohandatud olemimudelid +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=Kohandatud olemimudelid +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= ON - kohandatud olemimudelid (vaikimisi), aeglane +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= OFF - vaikimisi olemimudelid, kiirem +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=Kohandatud olemimudeleid pakub kasutatav ressursipakk. +of.options.CUSTOM_ENTITY_MODELS.tooltip.5= + +# Details + +of.options.CLOUDS=Pilved +of.options.CLOUDS.tooltip.1=Pilved +of.options.CLOUDS.tooltip.2= Vaikimisi - nagu määrab seade Graafika +of.options.CLOUDS.tooltip.3= Kiire - madalam kvaliteet, kiirem +of.options.CLOUDS.tooltip.4= Uhke - kõrgem kvaliteet, aeglasem +of.options.CLOUDS.tooltip.5= VÄLJAS - pilved puuduvad, kiireim +of.options.CLOUDS.tooltip.6=Kiired pilved renderdatakse 2Dna. +of.options.CLOUDS.tooltip.7=Uhked pilved renderdatakse 3Dna. + +of.options.CLOUD_HEIGHT=Pilvekõrgus +of.options.CLOUD_HEIGHT.tooltip.1=Pilvekõrgus +of.options.CLOUD_HEIGHT.tooltip.2= VÄLJAS - vaikimisi kõrgus +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - maailma kõrguspiirangust kõrgemal + +of.options.TREES=Puud +of.options.TREES.tooltip.1=Puud +of.options.TREES.tooltip.2= Vaikimisi - nagu määrab seade Graafika +of.options.TREES.tooltip.3= Kiire - madalam kvaliteet, kiirem +of.options.TREES.tooltip.4= Tark - kõrgem kvaliteet, kiire +of.options.TREES.tooltip.5= Uhke - kõrgeim kvaliteet, aeglasem +of.options.TREES.tooltip.6=Kiiretel puudel on läbipaistmatud lehed. +of.options.TREES.tooltip.7=Uhketel ja tarkadel puudel on läbipaistvad lehed. + +of.options.RAIN=Vihm ja lumi +of.options.RAIN.tooltip.1=Vihm ja lumi +of.options.RAIN.tooltip.2= Vaikimisi - nagu määrab seade Graafika +of.options.RAIN.tooltip.3= Kiire - kerge vihm/lumi, kiirem +of.options.RAIN.tooltip.4= Uhke - tugev vihm/lumi, aeglasem +of.options.RAIN.tooltip.5= VÄLJAS - vihm/lumi puuduvad, kiireim +of.options.RAIN.tooltip.6=Kui vihm on VÄLJAS, on vihma helid ja plärtsatused siiski +of.options.RAIN.tooltip.7=toimivad. + +of.options.SKY=Taevas +of.options.SKY.tooltip.1=Taevas +of.options.SKY.tooltip.2= SEES - taevas on nähtav, aeglasem +of.options.SKY.tooltip.3= VÄLJAS - taevas pole nähtav, kiirem +of.options.SKY.tooltip.4=Kui taevas on VÄLJAS, on kuu ja päike siiski nähtavad. + +of.options.STARS=Tähed +of.options.STARS.tooltip.1=Tähed +of.options.STARS.tooltip.2= SEES - tähed on nähtavad, aeglasem +of.options.STARS.tooltip.3= VÄLJAS - tähed pole nähtavad, kiirem + +of.options.SUN_MOON=Päike ja kuu +of.options.SUN_MOON.tooltip.1=Päike ja kuu +of.options.SUN_MOON.tooltip.2= SEES - päike ja kuu on nähtavad (vaikimisi) +of.options.SUN_MOON.tooltip.3= VÄLJAS - päike ja kuu pole nähtavad (kiirem) + +of.options.SHOW_CAPES=Keebid +of.options.SHOW_CAPES.tooltip.1=Keebid +of.options.SHOW_CAPES.tooltip.2= SEES - kuva mängijate keebid (vaikimisi) +of.options.SHOW_CAPES.tooltip.3= VÄLJAS - ära kuva mängijate keepe + +of.options.TRANSLUCENT_BLOCKS=Läbikumavad plokid +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Läbikumavad plokid +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Uhke - korrektne värvide üleminek (vaikimisi) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Kiire - kiire värvide üleminek (kiirem) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Juhib erinevate värvidega poolläbipaistvate plokkide +of.options.TRANSLUCENT_BLOCKS.tooltip.5=(toonitud klaas, vesi, jää) värvide üleminekut, +of.options.TRANSLUCENT_BLOCKS.tooltip.6=kui need on asetatud õhuvahega üksteise taha. + +of.options.HELD_ITEM_TOOLTIPS=Esemete näpunäited +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Käeshoitavate esemete näpunäited +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= SEES - kuva näpunäiteid käeshoitavatel esemetel (vaikimisi) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= VÄLJAS - ära kuva näpunäiteid käeshoitavatel esemetel + +of.options.ADVANCED_TOOLTIPS=Täpsemad näpunäited +of.options.ADVANCED_TOOLTIPS.tooltip.1=Täpsemad näpunäited +of.options.ADVANCED_TOOLTIPS.tooltip.2= SEES - kuva täpsemad näpunäited +of.options.ADVANCED_TOOLTIPS.tooltip.3= VÄLJAS - peida täpsemad näpunäited (vaikimisi) +of.options.ADVANCED_TOOLTIPS.tooltip.4=Täpsemad näpunäited kuvavad laiendatud infot +of.options.ADVANCED_TOOLTIPS.tooltip.5=esemete kohta (ID, vastupidavus) ja varjutajate +of.options.ADVANCED_TOOLTIPS.tooltip.6=valikute kohta (ID, allikas, vaikeväärtus). + +of.options.DROPPED_ITEMS=Visatud esemed +of.options.DROPPED_ITEMS.tooltip.1=Maha visatud esemed +of.options.DROPPED_ITEMS.tooltip.2= Vaikimisi - nagu määrab seade Graafika +of.options.DROPPED_ITEMS.tooltip.3= Kiire - visatud esemed 2Dna, kiirem +of.options.DROPPED_ITEMS.tooltip.4= Uhke - visatud esemed 3Dna, aeglasem + +options.entityShadows.tooltip.1=Olemite varjud +options.entityShadows.tooltip.2= SEES - kuva olemite varje +options.entityShadows.tooltip.3= VÄLJAS - ära kuva olemite varje + +of.options.VIGNETTE=Vinjett +of.options.VIGNETTE.tooltip.1=Visuaalne efekt, mis tumendab kergelt ekraani nurki. +of.options.VIGNETTE.tooltip.2= Vaikimisi - nagu määrab seade Graafika (vaikimisi) +of.options.VIGNETTE.tooltip.3= Kiire - vinjett keelatud (kiirem) +of.options.VIGNETTE.tooltip.4= Uhke - vinjett lubatud (aeglasem) +of.options.VIGNETTE.tooltip.5=Vinjett võib oluliselt mõjutada kaadrisagedust, +of.options.VIGNETTE.tooltip.6=eriti kui mängida täisekraanil. +of.options.VIGNETTE.tooltip.7=Vinjetiefekt on vaevu hoomatav, seda võib ohutult keelata. +of.options.VIGNETTE.tooltip.8= + +of.options.DYNAMIC_FOV=Dünaamiline vaateväli +of.options.DYNAMIC_FOV.tooltip.1=Dünaamiline vaateväli +of.options.DYNAMIC_FOV.tooltip.2= SEES - luba dünaamiline vaateväli (vaikimisi) +of.options.DYNAMIC_FOV.tooltip.3= VÄLJAS - keela dünaamiline vaateväli +of.options.DYNAMIC_FOV.tooltip.4=Muudab vaatevälja lennates, joostes või vibu tõmmates. +of.options.DYNAMIC_FOV.tooltip.5= + +of.options.DYNAMIC_LIGHTS=Dünaamiline valgustus +of.options.DYNAMIC_LIGHTS.tooltip.1=Dünaamiline valgustus +of.options.DYNAMIC_LIGHTS.tooltip.2= VÄLJAS - dünaamiline valgustus puudub (vaikimisi) +of.options.DYNAMIC_LIGHTS.tooltip.3= Kiire - kiire dünaamiline valgustus (uuendatud 500 ms järel) +of.options.DYNAMIC_LIGHTS.tooltip.4= Uhke - uhke dünaamiline valgustus (uuendatud reaalajas) +of.options.DYNAMIC_LIGHTS.tooltip.5=Lubab valgust kiirgavatel esemetel (tõrvik, hõõgkivi jne) +of.options.DYNAMIC_LIGHTS.tooltip.6=käes hoides või maha visates valgustada ümbritsevat ala. +of.options.DYNAMIC_LIGHTS.tooltip.7= + +# Performance + +of.options.SMOOTH_FPS=Sujuv kaadrisagedus +of.options.SMOOTH_FPS.tooltip.1=Stabiliseerib ks, tühjendades graafikadraiveri puhvrit. +of.options.SMOOTH_FPS.tooltip.2= VÄLJAS - stabiliseerimine puudub, ks võib kõikuda +of.options.SMOOTH_FPS.tooltip.3= SEES - kaadrisageduse stabiliseerimine +of.options.SMOOTH_FPS.tooltip.4=See valik sõltub graafikadraiveritest ning selle efekt +of.options.SMOOTH_FPS.tooltip.5=ei pruugi alati nähtav olla. + +of.options.SMOOTH_WORLD=Sujuv maailm +of.options.SMOOTH_WORLD.tooltip.1=Eemaldab siseserveri poolt põhjustatud "latentsusokkaid". +of.options.SMOOTH_WORLD.tooltip.2= VÄLJAS - stabiliseerimine puudub, ks võib kõikuda +of.options.SMOOTH_WORLD.tooltip.3= SEES - kaadrisageduse stabiliseerimine +of.options.SMOOTH_WORLD.tooltip.4=Stabiliseerib kaadrisagedust, jaotades sisemise serveri +of.options.SMOOTH_WORLD.tooltip.5=koormust. Toimib ainult kohalikes maailmades (üksikmäng). + +of.options.FAST_RENDER=Kiire renderdus +of.options.FAST_RENDER.tooltip.1=Kiire renderdus +of.options.FAST_RENDER.tooltip.2= VÄLJAS - standardne renderdus (vaikimisi) +of.options.FAST_RENDER.tooltip.3= SEES - optimeeritud renderdus (kiirem) +of.options.FAST_RENDER.tooltip.4=Kasutab optimeeritud renderduse algoritmi, mis vähendab +of.options.FAST_RENDER.tooltip.5=graafikaprotsessori koormust ja võib oluliselt tõsta ks. + +of.options.FAST_MATH=Kiire matemaatika +of.options.FAST_MATH.tooltip.1=Kiire matemaatika +of.options.FAST_MATH.tooltip.2= VÄLJAS - standardne matemaatika (vaikimisi) +of.options.FAST_MATH.tooltip.3= SEES - kiirem matemaatika +of.options.FAST_MATH.tooltip.4=Kasutab optimeeritud sin() ja cos() funktsioone, mis võivad +of.options.FAST_MATH.tooltip.5=paremini rakendada protsessori vahemälu ja tõsta ks. + +of.options.CHUNK_UPDATES=Kamakauuendused +of.options.CHUNK_UPDATES.tooltip.1=Kamakate uuendused +of.options.CHUNK_UPDATES.tooltip.2= 1 - aeglasem maailma laadimine, kõrgem ks (vaikimisi) +of.options.CHUNK_UPDATES.tooltip.3= 3 - kiirem maailma laadimine, madalam ks +of.options.CHUNK_UPDATES.tooltip.4= 5 - kiireim maailma laadimine, madalaim ks +of.options.CHUNK_UPDATES.tooltip.5=Kamakate uuenduste arv renderdatud kaadri kohta, +of.options.CHUNK_UPDATES.tooltip.6=kõrgemad väärtused võivad ks destabiliseerida. + +of.options.CHUNK_UPDATES_DYNAMIC=Dünaamilised uuendused +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Dünaamilised kamakauuendused +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= VÄLJAS - (vaikimisi) standardsed uuendused kaadri kohta +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= SEES - rohkem uuendusi, kuni mängija seisab paigal +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=Dünaamilised uuendused sunnivad rohkem kamakauuendusi, +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=kuni mängija seisab paigal, et laadida maailma kiiremini. + +of.options.LAZY_CHUNK_LOADING=Laisk kamakalaadimine +of.options.LAZY_CHUNK_LOADING.tooltip.1=Laisk kamakate laadimine +of.options.LAZY_CHUNK_LOADING.tooltip.2= VÄLJAS - vaikimisi serveri kamakalaadimine +of.options.LAZY_CHUNK_LOADING.tooltip.3= SEES - laisk serveri kamakalaadimine (sujuvam) +of.options.LAZY_CHUNK_LOADING.tooltip.4=Silub integreeritud serveri kamakalaadimist, jaotades +of.options.LAZY_CHUNK_LOADING.tooltip.5=kamakaid mitmete tick'ide vahel. +of.options.LAZY_CHUNK_LOADING.tooltip.6=Lülita VÄLJA, kui osa maailmast ei laadi korralikult. Töötab +of.options.LAZY_CHUNK_LOADING.tooltip.7=ainult kohalikes maailmades ühetuumalise protsessoriga. + +# Animations + +of.options.animation.allOn=Kõik SISSE +of.options.animation.allOff=Kõik VÄLJA +of.options.animation.dynamic=Dünaamiline + +of.options.ANIMATED_WATER=Veeanimatsioon +of.options.ANIMATED_LAVA=Laavaanimatsioon +of.options.ANIMATED_FIRE=Tuleanimatsioon +of.options.ANIMATED_PORTAL=Portaalianimatsioon +of.options.ANIMATED_REDSTONE=Redstone-animatsioon +of.options.ANIMATED_EXPLOSION=Plahvatuse animatsioon +of.options.ANIMATED_FLAME=Leegi animatsioon +of.options.ANIMATED_SMOKE=Suitsuanimatsioon +of.options.VOID_PARTICLES=Tühjuse osakesed +of.options.WATER_PARTICLES=Veeosakesed +of.options.RAIN_SPLASH=Vihmaplärtsatused +of.options.PORTAL_PARTICLES=Portaaliosakesed +of.options.POTION_PARTICLES=Võlujoogiosakesed +of.options.DRIPPING_WATER_LAVA=Tilkuv vesi/laava +of.options.ANIMATED_TERRAIN=Maastikuanimatsioon +of.options.ANIMATED_TEXTURES=Tekstuurianimatsioon +of.options.FIREWORK_PARTICLES=Ilutulestiku osakesed + +# Other + +of.options.LAGOMETER=Latentsusmõõdik +of.options.LAGOMETER.tooltip.1=Kuvab latentsusmõõdikut silumisvaatel (F3). +of.options.LAGOMETER.tooltip.2=* Oranž - mälu prahikogumine +of.options.LAGOMETER.tooltip.3=* Tsüaansinine - tick'id +of.options.LAGOMETER.tooltip.4=* Sinine - ajastatud käivitatavad +of.options.LAGOMETER.tooltip.5=* Lilla - kamaka üleslaadimine +of.options.LAGOMETER.tooltip.6=* Punane - kamakauuendused +of.options.LAGOMETER.tooltip.7=* Kollane - nähtavuskontroll +of.options.LAGOMETER.tooltip.8=* Roheline - maastiku renderdus + +of.options.PROFILER=Silumisprofiilija +of.options.PROFILER.tooltip.1=Silumisprofiilija +of.options.PROFILER.tooltip.2= SEES - silumisprofiilija on aktiivne, aeglasem +of.options.PROFILER.tooltip.3= VÄLJAS - silumisprofiilija pole aktiivne, kiirem +of.options.PROFILER.tooltip.4=Silumisprofiilija kogub ja kuvab silumisinfot, kui +of.options.PROFILER.tooltip.5=silumisvaade on avatud (F3). + +of.options.WEATHER=Ilm +of.options.WEATHER.tooltip.1=Ilm +of.options.WEATHER.tooltip.2= SEES - ilm on aktiivne, aeglasem +of.options.WEATHER.tooltip.3= VÄLJAS - ilm pole aktiivne, kiirem +of.options.WEATHER.tooltip.4=Ilm juhib vihma, lund ja äikest. +of.options.WEATHER.tooltip.5=Ilma juhtimine on võimalik ainult kohalikes maailmades. + +of.options.time.dayOnly=ainult päev +of.options.time.nightOnly=ainult öö + +of.options.TIME=Aeg +of.options.TIME.tooltip.1=Aeg +of.options.TIME.tooltip.2= Vaikimisi - tavaline ööpäevatsükkel +of.options.TIME.tooltip.3= Ainult päev - ainult päev +of.options.TIME.tooltip.4= Ainult öö - ainult öö +of.options.TIME.tooltip.5=Aja seadistus töötab ainult kohalikes maailmades LOOMINGU- +of.options.TIME.tooltip.6=režiimis. + +options.fullscreen.tooltip.1=Täisekraan +options.fullscreen.tooltip.2= SEES - kasuta täisekraanirežiimi +options.fullscreen.tooltip.3= VÄLJAS - kasuta aknarežiimi +options.fullscreen.tooltip.4=Täisekraanirežiim võib olla kiirem või aeglasem +options.fullscreen.tooltip.5=aknarežiimist, olenevalt graafikakaardist. + +of.options.FULLSCREEN_MODE=Täisekraanirežiim +of.options.FULLSCREEN_MODE.tooltip.1=Täisekraanirežiim +of.options.FULLSCREEN_MODE.tooltip.2= Vaikimisi - kasuta töölaua ekraaniresolutsiooni, aeglasem +of.options.FULLSCREEN_MODE.tooltip.3= L x K - kasuta kohandatud ekraaniresolutsiooni, võib olla kiirem +of.options.FULLSCREEN_MODE.tooltip.4=Valitud resolutsiooni kasutatakse täisekraanirežiimis (F11). +of.options.FULLSCREEN_MODE.tooltip.5=Madalamad resolutsioonid peaksid tavaliselt olema kiiremad. + +of.options.SHOW_FPS=Kaadrisageduse kuva +of.options.SHOW_FPS.tooltip.1=Kuvab kompaktselt kaadrisageduse ja renderduse infot. +of.options.SHOW_FPS.tooltip.2= C: - kamaka renderdajaid +of.options.SHOW_FPS.tooltip.3= E: - renderdatud olemeid + plokiolemeid +of.options.SHOW_FPS.tooltip.4= U: - kamakauuendusi +of.options.SHOW_FPS.tooltip.5=Kompaktset kaadrisageduse infot kuvatakse vaid siis, +of.options.SHOW_FPS.tooltip.6=kui silumisvaade pole nähtav. + +of.options.save.default=vaik. (2 s) +of.options.save.20s=20 s +of.options.save.3min=3 min +of.options.save.30min=30 min + +of.options.AUTOSAVE_TICKS=Automaatne salvestus +of.options.AUTOSAVE_TICKS.tooltip.1=Automaatse salvestuse intervall +of.options.AUTOSAVE_TICKS.tooltip.2=Vaikimisi automaatse salvestuse intervall (2 s) POLE +of.options.AUTOSAVE_TICKS.tooltip.3=SOOVITATAV. Automaatne salvestus põhjustab kurikuulsa +of.options.AUTOSAVE_TICKS.tooltip.4="surmava latentsusokka". +# Added extra row to tooltip + +of.options.SCREENSHOT_SIZE=Kuvatõmmise suurus +of.options.SCREENSHOT_SIZE.tooltip.1=Kuvatõmmise suurus +of.options.SCREENSHOT_SIZE.tooltip.2= Vaikimisi - vaikimisi kuvatõmmise suurus +of.options.SCREENSHOT_SIZE.tooltip.3= 2x-4x - kohandatud kuvatõmmise suurus +of.options.SCREENSHOT_SIZE.tooltip.4=Suurema kuvatõmmise loomine võib vajada rohkem mälu. +of.options.SCREENSHOT_SIZE.tooltip.5=Ei ühildu kiire renderduse ega anti-aliasing'uga. +of.options.SCREENSHOT_SIZE.tooltip.6=Vajab graafikakaardi framebuffer'i tuge. \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/optifine/lang/fr_CA.lang b/src/minecraft/assets/minecraft/optifine/lang/fr_CA.lang new file mode 100644 index 0000000..d2affc8 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/fr_CA.lang @@ -0,0 +1,592 @@ +#Traduit en français par Z0ul0u25 + +# General +of.general.ambiguous=Ambigue +of.general.custom=Personnalisé +of.general.from=De +of.general.id=ID +of.general.restart=Redémarer +of.general.smart=Intelligent + +# Keys +of.key.zoom=Zoom + +# Message +of.message.aa.shaders1=L'Anticrénelage n'est pas compatible avec les Shaders. +of.message.aa.shaders2=Veuillez désactivez les Shaders pour activer cette option. + +of.message.af.shaders1=Le Filtrage Anisotropique n'est pas compatible avec les Shaders. +of.message.af.shaders2=Veuillez désactivez les Shaders pour activer cette option. + +of.message.fr.shaders1=Le Rendu Rapide n'est pas compatible avec les Shaders. +of.message.fr.shaders2=Veuillez désactivez les Shaders pour activer cette option. + +of.message.an.shaders1=L'Anaglyphe 3D n'est pas compatible avec les Shaders. +of.message.an.shaders2=Veuillez désactivez les Shaders pour activer cette option. + +of.message.shaders.aa1=Les Shaders ne sont pas compatible avec l'Anticrénelage. +of.message.shaders.aa2=Veuillez fixé Qualité -> Anticrénelage à OFF puis redémarrer le jeu. + +of.message.shaders.af1=Les Shaders ne sont pas compatible avec le Filtrage Anisotropique. +of.message.shaders.af2=Veuillez fixé Qualité -> Filtrage Anisotropique à OFF. + +of.message.shaders.fr1=Les Shaders ne sont pas compatible avec le Rendu Rapide. +of.message.shaders.fr2=Veuillez fixé Performance -> Rendu Rapide à OFF. + +of.message.shaders.an1=Les Shaders ne sont pas compatible avec l'Anaglyphe 3D. +of.message.shaders.an2=Veuillez configurer Autre -> Anaglyphe 3D à OFF. + +of.message.newVersion=Une nouvelle version d'§eOptiFine§f est disponible: §e%s§f +of.message.java64Bit=Pour de meilleure performance, installer une version §e64-bit de Java§f +of.message.openglError=§eErreur OpenGL§f: %s (%s) + +of.message.shaders.loading=Chargement des Shaders: %s + +of.message.other.reset=Réinitialiser tous les réglages vidéos à leurs valeurs par défaut? + +of.message.loadingVisibleChunks=Chargement des Chunks visible + +# Video settings + +options.graphics.tooltip.1=Qualité visuel +options.graphics.tooltip.2= Rapide - Basse qualité (Rapide) +options.graphics.tooltip.3= Détaillée - Haute qualité (Lent) +options.graphics.tooltip.4=Change l'apparence des nuages, des feuilles, +options.graphics.tooltip.5=de l'eau, des ombres et du côté de l'herbe. + +of.options.renderDistance.tiny=Mini +of.options.renderDistance.short=Courte +of.options.renderDistance.normal=Normale +of.options.renderDistance.far=Loin +of.options.renderDistance.extreme=Extrême + +options.renderDistance.tooltip.1=Distance de Rendu +options.renderDistance.tooltip.2= 2 Mini - 32m (Très rapide) +options.renderDistance.tooltip.3= 4 courte - 64m (Rapide) +options.renderDistance.tooltip.4= 8 Normale - 128m +options.renderDistance.tooltip.5= 16 Loin - 256m (Lent) +options.renderDistance.tooltip.6= 32 Extrême - 512m (Très lent) +options.renderDistance.tooltip.7=La distance de rendu Extrême est très gourmande en ressources! +options.renderDistance.tooltip.8=Les valeurs au-dessus de 16 n'ont effet qu'en solo. + +options.ao.tooltip.1=Luminosité adoucie +options.ao.tooltip.2= OFF - aucun adoucissement (rapide) +options.ao.tooltip.3= Minimum - Adoucissement simple (Lent) +options.ao.tooltip.4= Maximum - Adoucissement complexe (Très lent) + +options.framerateLimit.tooltip.1=FPS Max +options.framerateLimit.tooltip.2= VSync - limite du moniteur (60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - variable +options.framerateLimit.tooltip.4= Illimitée - sans limite (Très rapide) +options.framerateLimit.tooltip.5=La limite de FPS diminue le taux d'image par seconde +options.framerateLimit.tooltip.6=même si la valeur limite n'est pas atteinte. +of.options.framerateLimit.vsync=VSync + +of.options.AO_LEVEL=Ombres adoucies +of.options.AO_LEVEL.tooltip.1=Ombres adoucies +of.options.AO_LEVEL.tooltip.2= OFF - aucune ombre +of.options.AO_LEVEL.tooltip.3= 50%% - légères ombres +of.options.AO_LEVEL.tooltip.4= 100%% - fortes ombres + +options.viewBobbing.tooltip.1=Mouvements plus réalistes. +options.viewBobbing.tooltip.2=Lors de l'utilisation du mipmaps, configurer à OFF pour de meilleurs résultats. + +options.guiScale.tooltip.1=Taille du GUI +options.guiScale.tooltip.2= Auto - taille maximale +options.guiScale.tooltip.3= Petite, Normale, Grande - 1x à 3x +options.guiScale.tooltip.4= 4x à 10x - Disponible pour moniteur 4K +options.guiScale.tooltip.5=Les valeurs impaires (1x, 3x, 5x ...) ne sont pas compatible avec l'Unicode. +options.guiScale.tooltip.2=Un GUI petit serai plus rapide + +options.vbo.tooltip.1=Objets de Mémoire Tampon +options.vbo.tooltip.2=Utilises des modèles de rendu qui sont habituellement +options.vbo.tooltip.3=plus rapides (5-10%%) que le rendu par défaut. + +options.gamma.tooltip.1=Change la luminosité des endroits sombres +options.gamma.tooltip.2= Sombre - luminosité standard +options.gamma.tooltip.3= 1-99%% - variable +options.gamma.tooltip.4= Lumineux - luminosité maximale pour les objets sombres +options.gamma.tooltip.5=Cette option ne change pas la luminosité des +options.gamma.tooltip.6=objets complètement noirs + +options.anaglyph.tooltip.1=Anaglyphe 3D +options.anaglyph.tooltip.2=Active un effet stéréoscopique 3D utilisant différentes couleurs +options.anaglyph.tooltip.3=pour chaque œil. +options.anaglyph.tooltip.4=Nécessite des lunettes rouge-cyan pour une vue adéquate. + +of.options.ALTERNATE_BLOCKS=Blocs Alternatif +of.options.ALTERNATE_BLOCKS.tooltip.1=Alterne les Blocs +of.options.ALTERNATE_BLOCKS.tooltip.2=Utilises des modèles alternatifs pour certains blocs. +of.options.ALTERNATE_BLOCKS.tooltip.3=Dépend du pack de ressources sélectionné. + +of.options.FOG_FANCY=Brouillard +of.options.FOG_FANCY.tooltip.1=Type de Brouillard +of.options.FOG_FANCY.tooltip.2= Rapide - brouillard rapide +of.options.FOG_FANCY.tooltip.3= Détaillé - meilleure apparence (Plus lent) +of.options.FOG_FANCY.tooltip.4= OFF - Aucun Brouillard (très rapide) +of.options.FOG_FANCY.tooltip.5=Le brouillard détaillé n'est disponible que +of.options.FOG_FANCY.tooltip.6=si la carte graphique peut le supporter. + +of.options.FOG_START=Commencement de Brouillard +of.options.FOG_START.tooltip.1=Commencement de Brouillard +of.options.FOG_START.tooltip.2= 0.2 - commence proche du joueur +of.options.FOG_START.tooltip.3= 0.8 - commence loin du joueur +of.options.FOG_START.tooltip.4=Cette option n'affecte généralement pas les performances. + +of.options.CHUNK_LOADING=Chargement des Chunks +of.options.CHUNK_LOADING.tooltip.1=Chargement des Chunks +of.options.CHUNK_LOADING.tooltip.2= Défaut - FPS instable lors du chargement des chunks +of.options.CHUNK_LOADING.tooltip.3= Adoucie - FPS stable +of.options.CHUNK_LOADING.tooltip.4= Multi-Coeur - FPS stable, Chargement 3x plus rapide +of.options.CHUNK_LOADING.tooltip.5=Adoucie et Multi-Coeur évite le bégaiement et +of.options.CHUNK_LOADING.tooltip.6=les lags causés par le chargement des chunks. +of.options.CHUNK_LOADING.tooltip.7=Multi-Coeur peut augmenter de 3x la vitesse de chargement +of.options.CHUNK_LOADING.tooltip.8=et augmenter les FPS en utilisant un deuxième Coeur du CPU. +of.options.chunkLoading.smooth=Adoucie +of.options.chunkLoading.multiCore=Multi-Core + +of.options.shaders=Shaders... +of.options.shadersTitle=Shaders + +of.options.shaders.packNone=OFF +of.options.shaders.packDefault=(interne) + +of.options.shaders.ANTIALIASING=Anticrénelage +of.options.shaders.NORMAL_MAP=Map Normale +of.options.shaders.SPECULAR_MAP=Map Spectaculaire +of.options.shaders.RENDER_RES_MUL=Qualité du Rendu +of.options.shaders.SHADOW_RES_MUL=Qualité des Ombres +of.options.shaders.HAND_DEPTH_MUL=Profondeur de la Main +of.options.shaders.CLOUD_SHADOW=Ombres des nuages +of.options.shaders.OLD_HAND_LIGHT=Ancien Éclairage de la Main +of.options.shaders.OLD_LIGHTING=Ancien Éclairage +of.options.shaders.SHADER_PACK=Pack de Shader + +of.options.shaders.shadersFolder=Dossier des Shaders +of.options.shaders.shaderOptions=Options du Shader... + +of.options.shaderOptionsTitle=Options du Shader + +of.options.quality=Qualité... +of.options.qualityTitle=Paramètre de la Qualité + +of.options.details=Détails... +of.options.detailsTitle=Paramètre des Détails + +of.options.performance=Performance... +of.options.performanceTitle=Paramètre des Performances + +of.options.animations=Animations... +of.options.animationsTitle=Paramètre des Animations + +of.options.other=Autre... +of.options.otherTitle=Autre Paramètre + +of.options.other.reset=Réinitialiser les réglages vidéos... + +of.shaders.profile=Profil + +# Quality + +of.options.mipmap.bilinear=Bilinéaire +of.options.mipmap.linear=Linéaire +of.options.mipmap.nearest=Rapproché +of.options.mipmap.trilinear=Trilinéaire + +options.mipmapLevels.tooltip.1=Effet visuelle qui rend les objets lointains plus beau +options.mipmapLevels.tooltip.2=en adoucissent les détails +options.mipmapLevels.tooltip.3= OFF - Aucun adoucissement +options.mipmapLevels.tooltip.4= 1 - adoucissement minimum +options.mipmapLevels.tooltip.5= 4 - adoucissement maximum +options.mipmapLevels.tooltip.6=Cette option n'affecte généralement pas les performances. + +of.options.MIPMAP_TYPE=Type de Mipmap +of.options.MIPMAP_TYPE.tooltip.1=Effet visuel qui rend les objets lointains plus beau +of.options.MIPMAP_TYPE.tooltip.2=en adoucissent les détails +of.options.MIPMAP_TYPE.tooltip.3= Rapproché - adoucissement esquissé (rapide) +of.options.MIPMAP_TYPE.tooltip.4= Linéaire - adoucissement normal +of.options.MIPMAP_TYPE.tooltip.5= Bilinéaire - adoucissement travaillé +of.options.MIPMAP_TYPE.tooltip.6= Trilinéaire - adoucissement magnifique (lent) + +of.options.AA_LEVEL=Anticrénelage +of.options.AA_LEVEL.tooltip.1=Anticrénelage +of.options.AA_LEVEL.tooltip.2= OFF - (défaut) sans anticrénelage (rapide) +of.options.AA_LEVEL.tooltip.3= 2-16 - anticrénelage les lignes et cotés (lent) +of.options.AA_LEVEL.tooltip.4=L'Anticrénelage adouci l'effet rugueux et +of.options.AA_LEVEL.tooltip.5=les transitions rapides de couleurs. +of.options.AA_LEVEL.tooltip.6=Lorsque activer, les FPS peuvent ralentir. +of.options.AA_LEVEL.tooltip.7=Tous les niveaux ne sont pas supportés par toutes les cartes graphiques. +of.options.AA_LEVEL.tooltip.8=N'a d'effets qu'après un REDÉMARRAGE! + +of.options.AF_LEVEL=Filtrage Anisotropique +of.options.AF_LEVEL.tooltip.1=Filtrage Anisotropique +of.options.AF_LEVEL.tooltip.2= OFF - (défaut) détail de texture standard (rapide) +of.options.AF_LEVEL.tooltip.3= 2-16 - détails plus fins dans les textures mipmappées (lent) +of.options.AF_LEVEL.tooltip.4=Le Filtrage Anisotropique rétablie les détails dans +of.options.AF_LEVEL.tooltip.5=les textures mipmappé. +of.options.AF_LEVEL.tooltip.6=Lorsque activer, les FPS peuvent ralentir. + +of.options.CLEAR_WATER=Eau Claire +of.options.CLEAR_WATER.tooltip.1=Eau Claire +of.options.CLEAR_WATER.tooltip.2= ON - claire, eau transparente +of.options.CLEAR_WATER.tooltip.3= OFF - eau par défaut + +of.options.RANDOM_MOBS=Mobs Aléatoires +of.options.RANDOM_MOBS.tooltip.1=Mobs Aléatoires +of.options.RANDOM_MOBS.tooltip.2= OFF - aucun mob aléatoire (rapide) +of.options.RANDOM_MOBS.tooltip.3= ON - avec mob aléatoire (lent) +of.options.RANDOM_MOBS.tooltip.4=Les Mobs utilisent des textures aléatoires +of.options.RANDOM_MOBS.tooltip.5=A besoin d'un pack de ressources avec plusieurs textures de mob + +of.options.BETTER_GRASS=Meilleur Gazon +of.options.BETTER_GRASS.tooltip.1=Meilleur Gazon +of.options.BETTER_GRASS.tooltip.2= OFF - texture par défaut (rapide) +of.options.BETTER_GRASS.tooltip.3= Rapide - bord de gazon complet (lent) +of.options.BETTER_GRASS.tooltip.4= Détaillé - bord de gazon détaillé (très lent) + +of.options.BETTER_SNOW=Meilleur Neige +of.options.BETTER_SNOW.tooltip.1=Meilleur Neige +of.options.BETTER_SNOW.tooltip.2= OFF - Neige par défaut (rapide) +of.options.BETTER_SNOW.tooltip.3= ON - Meilleure Neige (lent) +of.options.BETTER_SNOW.tooltip.4=Apparait en dessous des blocs transparents (clôture, haute herbe) +of.options.BETTER_SNOW.tooltip.5=lorsque qu'entouré de neige. + +of.options.CUSTOM_FONTS=Police Personnalisé +of.options.CUSTOM_FONTS.tooltip.1=Police Personnalisé +of.options.CUSTOM_FONTS.tooltip.2= ON - utilise la police personnalisée (défaut, lent) +of.options.CUSTOM_FONTS.tooltip.3= OFF - utilise la police par défaut (rapide) +of.options.CUSTOM_FONTS.tooltip.4=La Police Personnalisée est fournis par +of.options.CUSTOM_FONTS.tooltip.5=le pack de ressources utilisé. + +of.options.CUSTOM_COLORS=Couleurs Personnalisés +of.options.CUSTOM_COLORS.tooltip.1=Couleurs Personnalisés +of.options.CUSTOM_COLORS.tooltip.2= ON - utilise des couleurs personnalisées (défaut, lent) +of.options.CUSTOM_COLORS.tooltip.3= OFF - utilise les couleurs par défaut (rapide) +of.options.CUSTOM_COLORS.tooltip.4=Les Couleurs Personnalisées sont fournis par +of.options.CUSTOM_COLORS.tooltip.5=le pack de ressources utilisé. + +of.options.SWAMP_COLORS=Couleurs Marécageuses +of.options.SWAMP_COLORS.tooltip.1=Couleurs Marécageuses +of.options.SWAMP_COLORS.tooltip.2= ON - utilise les couleurs marécageuses (défaut, lent) +of.options.SWAMP_COLORS.tooltip.3= OFF - n'utilise pas les couleurs marécageuses (rapide) +of.options.SWAMP_COLORS.tooltip.4=La couleur marécageuse modifie le gazon, les feuilles, +of.options.SWAMP_COLORS.tooltip.5=les lianes et l'eau. + +of.options.SMOOTH_BIOMES=Biomes Adoucis +of.options.SMOOTH_BIOMES.tooltip.1=Biomes Adoucis +of.options.SMOOTH_BIOMES.tooltip.2= ON - adoucie la bordure des biomes (défaut, lent) +of.options.SMOOTH_BIOMES.tooltip.3= OFF - aucun adoucissement de bordure des biomes (rapide) +of.options.SMOOTH_BIOMES.tooltip.4=L'adoucissement des bordures de biomes est fait en échantillonnant et +of.options.SMOOTH_BIOMES.tooltip.5=moyenant la couleur des blocs aux frontières entre deux biomes. +of.options.SMOOTH_BIOMES.tooltip.6=N'affecte que le gazon, les feuilles, les lianes et l'eau. + +of.options.CONNECTED_TEXTURES=Textures Connectés +of.options.CONNECTED_TEXTURES.tooltip.1=Textures Connectés +of.options.CONNECTED_TEXTURES.tooltip.2= OFF - aucune connexion (défaut) +of.options.CONNECTED_TEXTURES.tooltip.3= Rapide - connexion rapide +of.options.CONNECTED_TEXTURES.tooltip.4= Fancy - connexion détaillée +of.options.CONNECTED_TEXTURES.tooltip.5=Les Textures Connectés connecte les textures de +of.options.CONNECTED_TEXTURES.tooltip.6=la vitre, le grès et les bibliothèques placés une +of.options.CONNECTED_TEXTURES.tooltip.7=à coté de l'autre. Les Textures Connectés sont +of.options.CONNECTED_TEXTURES.tooltip.8=fournis par le pack de ressources utilisé. + +of.options.NATURAL_TEXTURES=Textures Naturelles +of.options.NATURAL_TEXTURES.tooltip.1=Textures Naturelles +of.options.NATURAL_TEXTURES.tooltip.2= OFF - sans textures naturelles (défaut) +of.options.NATURAL_TEXTURES.tooltip.3= ON - avec textures naturelles +of.options.NATURAL_TEXTURES.tooltip.4=Les textures naturelles enlèvent le pattern grillagé +of.options.NATURAL_TEXTURES.tooltip.5=créé par la répétition de bloc identique. +of.options.NATURAL_TEXTURES.tooltip.6=L'utilisation de textures retournées et renversées +of.options.NATURAL_TEXTURES.tooltip.7=est utilisé. La configuration pour les textures naturelles +of.options.NATURAL_TEXTURES.tooltip.8=sont fournies par le pack de ressources utilisé. + +of.options.CUSTOM_SKY=Ciel Personnalisé +of.options.CUSTOM_SKY.tooltip.1=Ciel Personnalisé +of.options.CUSTOM_SKY.tooltip.2= ON - Texture personnalisée (défaut, lent) +of.options.CUSTOM_SKY.tooltip.3= OFF - ciel par défaut (rapide) +of.options.CUSTOM_SKY.tooltip.4=La texture du ciel personnalisé est +of.options.CUSTOM_SKY.tooltip.5=fourni par le pack de ressources utilisé. + +of.options.CUSTOM_ITEMS=Items Personnalisés +of.options.CUSTOM_ITEMS.tooltip.1=Items Personnalisés +of.options.CUSTOM_ITEMS.tooltip.2= ON - textures d'items personnalisés (défaut, lent) +of.options.CUSTOM_ITEMS.tooltip.3= OFF - textures d'items par défaut (rapide) +of.options.CUSTOM_ITEMS.tooltip.4=Les textures d'items personnalisés sont +of.options.CUSTOM_ITEMS.tooltip.5=fournis par le pack de ressources utilisé. + +of.options.CUSTOM_ENTITY_MODELS=Modèles d'Entités Personnalisées +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=Modèles d'Entités Personnalisées +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= ON - modèles d'entités personnalisées (défaut, lent) +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= OFF - modèles d'entités par défaut (rapide) +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=Les modèles d'entités personnalisées sont +of.options.CUSTOM_ENTITY_MODELS.tooltip.5=fournis par le pack de ressources utilisé. + +# Details + +of.options.CLOUDS=Nuages +of.options.CLOUDS.tooltip.1=Nuages +of.options.CLOUDS.tooltip.2= Défaut - comme dans les configurations Graphiques +of.options.CLOUDS.tooltip.3= Rapides - basse qualité (rapde) +of.options.CLOUDS.tooltip.4= Détaillés - haute qualité (lent) +of.options.CLOUDS.tooltip.5= OFF - sans nuages (plus rapide) +of.options.CLOUDS.tooltip.6=Les nuages rapides sont rendus en 2D. +of.options.CLOUDS.tooltip.7=Les nuages détaillés sont rendus en 3D. + +of.options.CLOUD_HEIGHT=Hauteur des Nuages +of.options.CLOUD_HEIGHT.tooltip.1=Hauteur des Nuages +of.options.CLOUD_HEIGHT.tooltip.2= OFF - hauteur par défaut +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - au-dessus de la hauteur limite du monde + +of.options.TREES=Arbres +of.options.TREES.tooltip.1=Arbres +of.options.TREES.tooltip.2= Défaut - comme dans les configurations Graphiques +of.options.TREES.tooltip.3= Rapides - basse qualité (plus rapide) +of.options.TREES.tooltip.4= Intelligents - haute qualité (rapide) +of.options.TREES.tooltip.5= Détaillés - très haute qualité (lent) +of.options.TREES.tooltip.6=Les arbres rapides ont des feuilles opaques. +of.options.TREES.tooltip.7=Les arbres intelligents et détaillés +of.options.TREES.tooltip.8=ont des feuilles transparentes. + +of.options.RAIN=Pluie & Neige +of.options.RAIN.tooltip.1=Pluie & Neige +of.options.RAIN.tooltip.2= Défaut - comme dans les configurations Graphiques +of.options.RAIN.tooltip.3= Rapide - légère pluie/neige (rapide) +of.options.RAIN.tooltip.4= Détaillé - grosse pluie/neige (lent) +of.options.RAIN.tooltip.5= OFF - sans pluie/neige (plus rapide) +of.options.RAIN.tooltip.6=Même si la pluie & la neige est à OFF, +of.options.RAIN.tooltip.7=les éclaboussures et le son sont toujours actifs. + +of.options.SKY=Ciel +of.options.SKY.tooltip.1=Ciel +of.options.SKY.tooltip.2= ON - Le ciel est visible (lent) +of.options.SKY.tooltip.3= OFF - Le ciel n'est pas visible (rapide) +of.options.SKY.tooltip.4=Quand le ciel est à OFF, +of.options.SKY.tooltip.5=le soleil et la lune sont toujours visibles. + +of.options.STARS=Étoiles +of.options.STARS.tooltip.1=Étoiles +of.options.STARS.tooltip.2= ON - Les étoiles sont visible (lent) +of.options.STARS.tooltip.3= OFF - Les étoiles ne sont pas visibles (rapide) + +of.options.SUN_MOON=Soleil & lune +of.options.SUN_MOON.tooltip.1=Soleil & lune +of.options.SUN_MOON.tooltip.2= ON - le soleil et la lune sont visibles (défaut) +of.options.SUN_MOON.tooltip.3= OFF - le soleil et la lune ne sont pas visibles (rapide) + +of.options.SHOW_CAPES=Capes Visibles +of.options.SHOW_CAPES.tooltip.1=Capes visibles +of.options.SHOW_CAPES.tooltip.2= ON - voir la cape de joueurs (défaut) +of.options.SHOW_CAPES.tooltip.3= OFF - ne pas voir la cape des joueurs + +of.options.TRANSLUCENT_BLOCKS=Blocs Translucides +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Blocs Translucides +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Détaillés - mélange correct des couleurs (défaut) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Rapides - mélange rapide ds couleurs (rapide) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Controle le mélange des couleurs des blocs translucides +of.options.TRANSLUCENT_BLOCKS.tooltip.5=avec différentes couleurs (verre teindu, eau, glace) +of.options.TRANSLUCENT_BLOCKS.tooltip.6=lorsque placé un à côté de l'autre avec de l'air entre eux. + +of.options.HELD_ITEM_TOOLTIPS=Info-bulles d'Item +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Info-bulles d'Item +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= ON - affiche des infos sur l'item en main (défaut) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= OFF - n'affiche pas d'info sur l'item en main + +of.options.ADVANCED_TOOLTIPS=Info-bulles Avancé +of.options.ADVANCED_TOOLTIPS.tooltip.1=Info-bulles Avancé +of.options.ADVANCED_TOOLTIPS.tooltip.2= ON - affiche les infobulles avancées +of.options.ADVANCED_TOOLTIPS.tooltip.3= OFF - n'affiche pas les infobulles avancées (défaut) +of.options.ADVANCED_TOOLTIPS.tooltip.4=Les infobulles avancées affiche des informations détaillées +of.options.ADVANCED_TOOLTIPS.tooltip.5=sur l'item (id, durabilité) et les options des shaders +of.options.ADVANCED_TOOLTIPS.tooltip.6=(id, source, valeurs par défaut). + +of.options.DROPPED_ITEMS=Items Droppés +of.options.DROPPED_ITEMS.tooltip.1=Dropped Items +of.options.DROPPED_ITEMS.tooltip.2= Défaut - comme dans les configurations Graphiques +of.options.DROPPED_ITEMS.tooltip.3= Rapides - items 2D (rapide) +of.options.DROPPED_ITEMS.tooltip.4= Détaillés - items 3D (lent) + +options.entityShadows.tooltip.1=Ombres des Entités +options.entityShadows.tooltip.2= ON - affiche l'ombre des entités +options.entityShadows.tooltip.3= OFF - n'affiche pas l'ombre des entités + +of.options.VIGNETTE=Vignette +of.options.VIGNETTE.tooltip.1=Effet visuel qui assombrie les coins de l'écran +of.options.VIGNETTE.tooltip.2= Défaut - comme dans les configurations Graphiques +of.options.VIGNETTE.tooltip.3= Rapide - vignette désactivée (rapide) +of.options.VIGNETTE.tooltip.4= Détaillée - vignette activée (lent) +of.options.VIGNETTE.tooltip.5=La vignette à un effet significatif sur les FPS, +of.options.VIGNETTE.tooltip.6=surtout lorsque le jeu est en plein écran. +of.options.VIGNETTE.tooltip.7=L'effet de vignette est très subtile et +of.options.VIGNETTE.tooltip.8=peut être désactivé en toute sécurité. + +of.options.DYNAMIC_FOV=CV Dynamique +of.options.DYNAMIC_FOV.tooltip.1=CV Dynamique +of.options.DYNAMIC_FOV.tooltip.2= ON - activer le CV dynamique (défaut) +of.options.DYNAMIC_FOV.tooltip.3= OFF - désactiver le CV dynamique +of.options.DYNAMIC_FOV.tooltip.4=Changer le champ visuel (CV) lors du vol, du sprint +of.options.DYNAMIC_FOV.tooltip.5=de la nage et du bandage d'un arc. + +of.options.DYNAMIC_LIGHTS=Lumières Dynamiques +of.options.DYNAMIC_LIGHTS.tooltip.1=Lumières Dynamiques +of.options.DYNAMIC_LIGHTS.tooltip.2= OFF - aucune lumière dynamique (défaut) +of.options.DYNAMIC_LIGHTS.tooltip.3= Rapides - lumières dynamiques rapides (rafraichi à tous les 500ms) +of.options.DYNAMIC_LIGHTS.tooltip.4= Détaillées - Lumières dynamiques détaillées (rafraichi en temps réel) +of.options.DYNAMIC_LIGHTS.tooltip.5=Active la lumière des items (torche, pierre lumineuse, etc.) +of.options.DYNAMIC_LIGHTS.tooltip.6=pour illuminer tout autour quand l'item et en main, +of.options.DYNAMIC_LIGHTS.tooltip.7=equipper par d'autres joueurs ou jeter au sol. + +# Performance + +of.options.SMOOTH_FPS=FPS Atténué +of.options.SMOOTH_FPS.tooltip.1=Stabilise les FPS en supprimant les tampons de mémoires graphiques. +of.options.SMOOTH_FPS.tooltip.2= OFF - aucune stabilisation, Les FPS peuvent varier +of.options.SMOOTH_FPS.tooltip.3= ON - stabilisation des FPS +of.options.SMOOTH_FPS.tooltip.4=Cette option dépend du gestionnaire graphique, les +of.options.SMOOTH_FPS.tooltip.5=effets ne sont pas toujours visibles. + +of.options.SMOOTH_WORLD=Monde Atténué +of.options.SMOOTH_WORLD.tooltip.1=Élimine les piques de lag causé par le serveur interne. +of.options.SMOOTH_WORLD.tooltip.2= OFF - aucune stabilisation, Les FPS peuvent varier +of.options.SMOOTH_WORLD.tooltip.3= ON - stabilisation des FPS +of.options.SMOOTH_WORLD.tooltip.4=Stabilises les FPS en distribuent les charges du serveur interne. +of.options.SMOOTH_WORLD.tooltip.5=Fonctionne seulement en local (monde solo). + +of.options.FAST_RENDER=Rendu Rapide +of.options.FAST_RENDER.tooltip.1=Rendu Rapide +of.options.FAST_RENDER.tooltip.2= OFF - rendu standard (défaut) +of.options.FAST_RENDER.tooltip.3= ON - rendu optimisé (rapide) +of.options.FAST_RENDER.tooltip.4=Utilise des algorithmes de rendu optimisé pour diminuer +of.options.FAST_RENDER.tooltip.5=la charge du GPU et peut augmenter les FPS. + +of.options.FAST_MATH=Maths Rapides +of.options.FAST_MATH.tooltip.1=Mats Rapides +of.options.FAST_MATH.tooltip.2= OFF - math standard (défaut) +of.options.FAST_MATH.tooltip.3= ON - math optimisé +of.options.FAST_MATH.tooltip.4=Utilise des fonctions optimisées de sin() et cos() qui peuvent +of.options.FAST_MATH.tooltip.5=mieu utilisé la cache du CPU et augmenter les FPS. + +of.options.CHUNK_UPDATES=Mise à Jour des Chunks +of.options.CHUNK_UPDATES.tooltip.1=Mise à Jour des Chunks +of.options.CHUNK_UPDATES.tooltip.2= 1 - chargement lent du monde, meilleur FPS (défaut) +of.options.CHUNK_UPDATES.tooltip.3= 3 - chargement rapide du monde, bas FPS +of.options.CHUNK_UPDATES.tooltip.4= 5 - chargement très rapide du monde, très bas FPS +of.options.CHUNK_UPDATES.tooltip.5=Nombre de Mise à jour par image de rendu (tick), +of.options.CHUNK_UPDATES.tooltip.6=Les valeurs élevées peut déstabilisé les FPS. + +of.options.CHUNK_UPDATES_DYNAMIC=Mises à Jour Dynamiques +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Mises à Jours Dynamiques +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= OFF - mise à jour standard (défaut) +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= ON - plus de mise à jour lorsque le joueur ne bouge pas +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=Les mises à jour dynamiques force plus de +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=chunks à ce mettre à jour quand le joueur +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.6=est inactif pour charger le monde plus vite. + +of.options.LAZY_CHUNK_LOADING=Chargement des Chunks Lâches +of.options.LAZY_CHUNK_LOADING.tooltip.1=Chargement Lâche des Chunks +of.options.LAZY_CHUNK_LOADING.tooltip.2= OFF - chargement des chunks serveurs par défaut +of.options.LAZY_CHUNK_LOADING.tooltip.3= ON - chargement des chunks serveur lâche (plus doux) +of.options.LAZY_CHUNK_LOADING.tooltip.4=Adoucie le chargement des chunks serveurs intégrés +of.options.LAZY_CHUNK_LOADING.tooltip.5=en distribuant les chunks sur plusieurs ticks. +of.options.LAZY_CHUNK_LOADING.tooltip.6=Tourné à OFF si des parties du monde ne se charge pas correctement. +of.options.LAZY_CHUNK_LOADING.tooltip.7=Fonctionne seulement en local (monde solo) et les CPU à un coeur. + +# Animations + +of.options.animation.allOn=Tous à ON +of.options.animation.allOff=Tous à OFF +of.options.animation.dynamic=Dynamique + +of.options.ANIMATED_WATER=Eau Animée +of.options.ANIMATED_LAVA=Lave Animée +of.options.ANIMATED_FIRE=Feux Animé +of.options.ANIMATED_PORTAL=Portail Animé +of.options.ANIMATED_REDSTONE=Redstone Animé +of.options.ANIMATED_EXPLOSION=Explosion Animée +of.options.ANIMATED_FLAME=Flamme Animé +of.options.ANIMATED_SMOKE=Fumée Animée +of.options.VOID_PARTICLES=Particules de Vide +of.options.WATER_PARTICLES=Particules d'Eau +of.options.RAIN_SPLASH=Particules de Pluie +of.options.PORTAL_PARTICLES=Particules de Portail +of.options.POTION_PARTICLES=Particules de Potion +of.options.DRIPPING_WATER_LAVA=Eau/Lave qui Coule +of.options.ANIMATED_TERRAIN=Terrain Animé +of.options.ANIMATED_TEXTURES=Textures Animées +of.options.FIREWORK_PARTICLES=Particules de Feux d'Artifice + +# Other + +of.options.LAGOMETER=Lagomèter +of.options.LAGOMETER.tooltip.1=Affiche le Lagomètre sur l'écran de débogage (F3). +of.options.LAGOMETER.tooltip.2=* Orange - Récupérateur de mémoire +of.options.LAGOMETER.tooltip.3=* Cyan - Tick +of.options.LAGOMETER.tooltip.4=* Blue - Executables programmés +of.options.LAGOMETER.tooltip.5=* Purple - Chunk téléchargé +of.options.LAGOMETER.tooltip.6=* Red - Mises à jour de chunk +of.options.LAGOMETER.tooltip.7=* Yellow - Contrôle de visibilité +of.options.LAGOMETER.tooltip.8=* Green - Terrain rendu + +of.options.PROFILER=Profileur de Débogage +of.options.PROFILER.tooltip.1=Profileur de Débogage +of.options.PROFILER.tooltip.2= ON - profileur actif (lent) +of.options.PROFILER.tooltip.3= OFF - profileur non actif (rapide) +of.options.PROFILER.tooltip.4=Le profileur de débogage collecte et affiche des informations de +of.options.PROFILER.tooltip.5=débogage lorsque l'écran de débogage (F3) est ouvert. + +of.options.WEATHER=Météo +of.options.WEATHER.tooltip.1=Météo +of.options.WEATHER.tooltip.2= ON - Météo active (lent) +of.options.WEATHER.tooltip.3= OFF - Météo non active (rapide) +of.options.WEATHER.tooltip.4=La météo contrôle la pluie, la neige et l'orage. +of.options.WEATHER.tooltip.5=Le contrôle de la météo n'est possible qu'en local. + +of.options.time.dayOnly=Jour Seulement +of.options.time.nightOnly=Nuit Seulement + +of.options.TIME=temps +of.options.TIME.tooltip.1=Temps +of.options.TIME.tooltip.2= Défaut - Cycle jour/nuit normal +of.options.TIME.tooltip.3= Jour Seulement - jour seulement +of.options.TIME.tooltip.4= Nuit Seulement - nuit seulement +of.options.TIME.tooltip.5=La séléction du temps n'est possible qu'en CRÉATIF +of.options.TIME.tooltip.6=dans un monde local. + +options.fullscreen.tooltip.1=Plein Écran +options.fullscreen.tooltip.2= ON - jeu en plein écran +options.fullscreen.tooltip.3= OFF - jeu fenêtré +options.fullscreen.tooltip.4=Le mode plein écran peut être plus rapide ou plus lent +options.fullscreen.tooltip.5=que le mode fenêtré, cela dépend de la carte graphique. + +of.options.FULLSCREEN_MODE=Option Plein Écran +of.options.FULLSCREEN_MODE.tooltip.1=Option Plein Écran +of.options.FULLSCREEN_MODE.tooltip.2= Défaut - utilise la résolution du moniteur (lent) +of.options.FULLSCREEN_MODE.tooltip.3= LxH - utilise une résolution personnalisée (rapide) +of.options.FULLSCREEN_MODE.tooltip.4=La résolution sélectionnée est utilisé en mode plein écran (F11). +of.options.FULLSCREEN_MODE.tooltip.5=Une résolution plus basse devrait être plus rapide. + +of.options.SHOW_FPS=Afficher les FPS +of.options.SHOW_FPS.tooltip.1=Affiche les FPS et informations de rendu. +of.options.SHOW_FPS.tooltip.2= C: - chunk rendu +of.options.SHOW_FPS.tooltip.3= E: - entités rendu + bloc entités +of.options.SHOW_FPS.tooltip.4= U: - mises à jour de chunk +of.options.SHOW_FPS.tooltip.5=Les informations sont présenté de manière compacte dans le coin +of.options.SHOW_FPS.tooltip.6=supérieur gauche lorsque l'écran de débogage n'est pas visible + +of.options.save.default=Défaut (2s) +of.options.save.20s=20s +of.options.save.3min=3min +of.options.save.30min=30min + +of.options.AUTOSAVE_TICKS=Sauvegarde Automatique +of.options.AUTOSAVE_TICKS.tooltip.1=Intervale entre les sauvegardes +of.options.AUTOSAVE_TICKS.tooltip.2=L'intervalle par défaut (2s) n'est PAS RECOMMENDER. +of.options.AUTOSAVE_TICKS.tooltip.3=Les sauvegardes automatiques sont la cause +of.options.AUTOSAVE_TICKS.tooltip.4=du Pique de Lag de la Mort qui Tue. + +of.options.SCREENSHOT_SIZE=Taille des Captures d'Écrans +of.options.SCREENSHOT_SIZE.tooltip.1=Taille des Captures d'Écrans +of.options.SCREENSHOT_SIZE.tooltip.2= Défaut - taille de la fenêtre +of.options.SCREENSHOT_SIZE.tooltip.3= 2x-4x - taille personnalisée +of.options.SCREENSHOT_SIZE.tooltip.4=Prendre une capture d'écran plus grande utilise plus de mémoire. +of.options.SCREENSHOT_SIZE.tooltip.5=Incompatible avec le Rendu Rapide et l'Anticrénelage. +of.options.SCREENSHOT_SIZE.tooltip.6=Nécessite un GPU avec un tampon d'image. \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/optifine/lang/fr_FR.lang b/src/minecraft/assets/minecraft/optifine/lang/fr_FR.lang new file mode 100644 index 0000000..af15604 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/fr_FR.lang @@ -0,0 +1,592 @@ +#Traduit en français par Z0ul0u25 + +# General +of.general.ambiguous=Ambigue +of.general.custom=Personnalisé +of.general.from=De +of.general.id=ID +of.general.restart=Redémarer +of.general.smart=Intelligent + +# Keys +of.key.zoom=Zoom + +# Message +of.message.aa.shaders1=L'Anticrénelage n'est pas compatible avec les Shaders. +of.message.aa.shaders2=Veuillez désactivez les Shaders pour activer cette option. + +of.message.af.shaders1=Le Filtrage Anisotropique n'est pas compatible avec les Shaders. +of.message.af.shaders2=Veuillez désactivez les Shaders pour activer cette option. + +of.message.fr.shaders1=Le Rendu Rapide n'est pas compatible avec les Shaders. +of.message.fr.shaders2=Veuillez désactivez les Shaders pour activer cette option. + +of.message.an.shaders1=L'Anaglyphe 3D n'est pas compatible avec les Shaders. +of.message.an.shaders2=Veuillez désactivez les Shaders pour activer cette option. + +of.message.shaders.aa1=Les Shaders ne sont pas compatible avec l'Anticrénelage. +of.message.shaders.aa2=Veuillez fixé Qualité -> Anticrénelage à OFF puis redémarrer le jeu. + +of.message.shaders.af1=Les Shaders ne sont pas compatible avec le Filtrage Anisotropique. +of.message.shaders.af2=Veuillez fixé Qualité -> Filtrage Anisotropique à OFF. + +of.message.shaders.fr1=Les Shaders ne sont pas compatible avec le Rendu Rapide. +of.message.shaders.fr2=Veuillez fixé Performance -> Rendu Rapide à OFF. + +of.message.shaders.an1=Les Shaders ne sont pas compatible avec l'Anaglyphe 3D. +of.message.shaders.an2=Veuillez configurer Autre -> Anaglyphe 3D à OFF. + +of.message.newVersion=Une nouvelle version d'§eOptiFine§f est disponible: §e%s§f +of.message.java64Bit=Pour de meilleure performance, installer une version §e64-bit de Java§f +of.message.openglError=§eErreur OpenGL§f: %s (%s) + +of.message.shaders.loading=Chargement des Shaders: %s + +of.message.other.reset=Réinitialiser tous les réglages vidéos à leurs valeurs par défaut? + +of.message.loadingVisibleChunks=Chargement des Chunks visible + +# Video settings + +options.graphics.tooltip.1=Qualité visuel +options.graphics.tooltip.2= Rapide - Basse qualité (Rapide) +options.graphics.tooltip.3= Détaillée - Haute qualité (Lent) +options.graphics.tooltip.4=Change l'apparence des nuages, des feuilles, +options.graphics.tooltip.5=de l'eau, des ombres et du côté de l'herbe. + +of.options.renderDistance.tiny=Mini +of.options.renderDistance.short=Courte +of.options.renderDistance.normal=Normale +of.options.renderDistance.far=Loin +of.options.renderDistance.extreme=Extrême + +options.renderDistance.tooltip.1=Distance de Rendu +options.renderDistance.tooltip.2= 2 Mini - 32m (Très rapide) +options.renderDistance.tooltip.3= 4 courte - 64m (Rapide) +options.renderDistance.tooltip.4= 8 Normale - 128m +options.renderDistance.tooltip.5= 16 Loin - 256m (Lent) +options.renderDistance.tooltip.6= 32 Extrême - 512m (Très lent) +options.renderDistance.tooltip.7=La distance de rendu Extrême est très gourmande en ressources! +options.renderDistance.tooltip.8=Les valeurs au-dessus de 16 n'ont effet qu'en solo. + +options.ao.tooltip.1=Luminosité adoucie +options.ao.tooltip.2= OFF - aucun adoucissement (rapide) +options.ao.tooltip.3= Minimum - Adoucissement simple (Lent) +options.ao.tooltip.4= Maximum - Adoucissement complexe (Très lent) + +options.framerateLimit.tooltip.1=FPS Max +options.framerateLimit.tooltip.2= VSync - limite du moniteur (60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - variable +options.framerateLimit.tooltip.4= Illimitée - sans limite (Très rapide) +options.framerateLimit.tooltip.5=La limite de FPS diminue le taux d'image par seconde +options.framerateLimit.tooltip.6=même si la valeur limite n'est pas atteinte. +of.options.framerateLimit.vsync=VSync + +of.options.AO_LEVEL=Ombres adoucies +of.options.AO_LEVEL.tooltip.1=Ombres adoucies +of.options.AO_LEVEL.tooltip.2= OFF - aucune ombre +of.options.AO_LEVEL.tooltip.3= 50%% - légères ombres +of.options.AO_LEVEL.tooltip.4= 100%% - fortes ombres + +options.viewBobbing.tooltip.1=Mouvements plus réalistes. +options.viewBobbing.tooltip.2=Lors de l'utilisation du mipmaps, configurer à OFF pour de meilleurs résultats. + +options.guiScale.tooltip.1=Taille du GUI +options.guiScale.tooltip.2= Auto - taille maximale +options.guiScale.tooltip.3= Petite, Normale, Grande - 1x à 3x +options.guiScale.tooltip.4= 4x à 10x - Disponible pour moniteur 4K +options.guiScale.tooltip.5=Les valeurs impaires (1x, 3x, 5x ...) ne sont pas compatible avec l'Unicode. +options.guiScale.tooltip.2=Un GUI petit serai plus rapide + +options.vbo.tooltip.1=Objets de Mémoire Tampon +options.vbo.tooltip.2=Utilises des modèles de rendu qui sont habituellement +options.vbo.tooltip.3=plus rapides (5-10%%) que le rendu par défaut. + +options.gamma.tooltip.1=Change la luminosité des endroits sombres +options.gamma.tooltip.2= Sombre - luminosité standard +options.gamma.tooltip.3= 1-99%% - variable +options.gamma.tooltip.4= Lumineux - luminosité maximale pour les objets sombres +options.gamma.tooltip.5=Cette option ne change pas la luminosité des +options.gamma.tooltip.6=objets complètement noirs + +options.anaglyph.tooltip.1=Anaglyphe 3D +options.anaglyph.tooltip.2=Active un effet stéréoscopique 3D utilisant différentes couleurs +options.anaglyph.tooltip.3=pour chaque œil. +options.anaglyph.tooltip.4=Nécessite des lunettes rouge-cyan pour une vue adéquate. + +of.options.ALTERNATE_BLOCKS=Blocs Alternatif +of.options.ALTERNATE_BLOCKS.tooltip.1=Alterne les Blocs +of.options.ALTERNATE_BLOCKS.tooltip.2=Utilises des modèles alternatifs pour certains blocs. +of.options.ALTERNATE_BLOCKS.tooltip.3=Dépend du pack de ressources sélectionné. + +of.options.FOG_FANCY=Brouillard +of.options.FOG_FANCY.tooltip.1=Type de Brouillard +of.options.FOG_FANCY.tooltip.2= Rapide - brouillard rapide +of.options.FOG_FANCY.tooltip.3= Détaillé - meilleure apparence (Plus lent) +of.options.FOG_FANCY.tooltip.4= OFF - Aucun Brouillard (très rapide) +of.options.FOG_FANCY.tooltip.5=Le brouillard détaillé n'est disponible que +of.options.FOG_FANCY.tooltip.6=si la carte graphique peut le supporter. + +of.options.FOG_START=Commencement de Brouillard +of.options.FOG_START.tooltip.1=Commencement de Brouillard +of.options.FOG_START.tooltip.2= 0.2 - commence proche du joueur +of.options.FOG_START.tooltip.3= 0.8 - commence loin du joueur +of.options.FOG_START.tooltip.4=Cette option n'affecte généralement pas les performances. + +of.options.CHUNK_LOADING=Chargement des Chunks +of.options.CHUNK_LOADING.tooltip.1=Chargement des Chunks +of.options.CHUNK_LOADING.tooltip.2= Défaut - FPS instable lors du chargement des chunks +of.options.CHUNK_LOADING.tooltip.3= Adoucie - FPS stable +of.options.CHUNK_LOADING.tooltip.4= Multi-Coeur - FPS stable, Chargement 3x plus rapide +of.options.CHUNK_LOADING.tooltip.5=Adoucie et Multi-Coeur évite le bégaiement et +of.options.CHUNK_LOADING.tooltip.6=les lags causés par le chargement des chunks. +of.options.CHUNK_LOADING.tooltip.7=Multi-Coeur peut augmenter de 3x la vitesse de chargement +of.options.CHUNK_LOADING.tooltip.8=et augmenter les FPS en utilisant un deuxième Coeur du CPU. +of.options.chunkLoading.smooth=Adoucie +of.options.chunkLoading.multiCore=Multi-Core + +of.options.shaders=Shaders... +of.options.shadersTitle=Shaders + +of.options.shaders.packNone=OFF +of.options.shaders.packDefault=(interne) + +of.options.shaders.ANTIALIASING=Anticrénelage +of.options.shaders.NORMAL_MAP=Map Normale +of.options.shaders.SPECULAR_MAP=Map Spectaculaire +of.options.shaders.RENDER_RES_MUL=Qualité du Rendu +of.options.shaders.SHADOW_RES_MUL=Qualité des Ombres +of.options.shaders.HAND_DEPTH_MUL=Profondeur de la Main +of.options.shaders.CLOUD_SHADOW=Ombres des nuages +of.options.shaders.OLD_HAND_LIGHT=Ancien Éclairage de la Main +of.options.shaders.OLD_LIGHTING=Ancien Éclairage +of.options.shaders.SHADER_PACK=Pack de Shader + +of.options.shaders.shadersFolder=Dossier des Shaders +of.options.shaders.shaderOptions=Options du Shader... + +of.options.shaderOptionsTitle=Options du Shader + +of.options.quality=Qualité... +of.options.qualityTitle=Paramètre de la Qualité + +of.options.details=Détails... +of.options.detailsTitle=Paramètre des Détails + +of.options.performance=Performance... +of.options.performanceTitle=Paramètre des Performances + +of.options.animations=Animations... +of.options.animationsTitle=Paramètre des Animations + +of.options.other=Autre... +of.options.otherTitle=Autre Paramètre + +of.options.other.reset=Réinitialiser les réglages vidéos... + +of.shaders.profile=Profil + +# Quality + +of.options.mipmap.bilinear=Bilinéaire +of.options.mipmap.linear=Linéaire +of.options.mipmap.nearest=Rapproché +of.options.mipmap.trilinear=Trilinéaire + +options.mipmapLevels.tooltip.1=Effet visuelle qui rend les objets lointains plus beau +options.mipmapLevels.tooltip.2=en adoucissent les détails +options.mipmapLevels.tooltip.3= OFF - Aucun adoucissement +options.mipmapLevels.tooltip.4= 1 - adoucissement minimum +options.mipmapLevels.tooltip.5= 4 - adoucissement maximum +options.mipmapLevels.tooltip.6=Cette option n'affecte généralement pas les performances. + +of.options.MIPMAP_TYPE=Type de Mipmap +of.options.MIPMAP_TYPE.tooltip.1=Effet visuel qui rend les objets lointains plus beau +of.options.MIPMAP_TYPE.tooltip.2=en adoucissent les détails +of.options.MIPMAP_TYPE.tooltip.3= Rapproché - adoucissement esquissé (rapide) +of.options.MIPMAP_TYPE.tooltip.4= Linéaire - adoucissement normal +of.options.MIPMAP_TYPE.tooltip.5= Bilinéaire - adoucissement travaillé +of.options.MIPMAP_TYPE.tooltip.6= Trilinéaire - adoucissement magnifique (lent) + +of.options.AA_LEVEL=Anticrénelage +of.options.AA_LEVEL.tooltip.1=Anticrénelage +of.options.AA_LEVEL.tooltip.2= OFF - (défaut) sans anticrénelage (rapide) +of.options.AA_LEVEL.tooltip.3= 2-16 - anticrénelage les lignes et cotés (lent) +of.options.AA_LEVEL.tooltip.4=L'Anticrénelage adouci l'effet rugueux et +of.options.AA_LEVEL.tooltip.5=les transitions rapides de couleurs. +of.options.AA_LEVEL.tooltip.6=Lorsque activer, les FPS peuvent ralentir. +of.options.AA_LEVEL.tooltip.7=Tous les niveaux ne sont pas supportés par toutes les cartes graphiques. +of.options.AA_LEVEL.tooltip.8=N'a d'effets qu'après un REDÉMARRAGE! + +of.options.AF_LEVEL=Filtrage Anisotropique +of.options.AF_LEVEL.tooltip.1=Filtrage Anisotropique +of.options.AF_LEVEL.tooltip.2= OFF - (défaut) détail de texture standard (rapide) +of.options.AF_LEVEL.tooltip.3= 2-16 - détails plus fins dans les textures mipmappées (lent) +of.options.AF_LEVEL.tooltip.4=Le Filtrage Anisotropique rétablie les détails dans +of.options.AF_LEVEL.tooltip.5=les textures mipmappé. +of.options.AF_LEVEL.tooltip.6=Lorsque activer, les FPS peuvent ralentir. + +of.options.CLEAR_WATER=Eau Claire +of.options.CLEAR_WATER.tooltip.1=Eau Claire +of.options.CLEAR_WATER.tooltip.2= ON - claire, eau transparente +of.options.CLEAR_WATER.tooltip.3= OFF - eau par défaut + +of.options.RANDOM_MOBS=Mobs Aléatoires +of.options.RANDOM_MOBS.tooltip.1=Mobs Aléatoires +of.options.RANDOM_MOBS.tooltip.2= OFF - aucun mob aléatoire (rapide) +of.options.RANDOM_MOBS.tooltip.3= ON - avec mob aléatoire (lent) +of.options.RANDOM_MOBS.tooltip.4=Les Mobs utilisent des textures aléatoires +of.options.RANDOM_MOBS.tooltip.5=A besoin d'un pack de ressources avec plusieurs textures de mob + +of.options.BETTER_GRASS=Meilleur Gazon +of.options.BETTER_GRASS.tooltip.1=Meilleur Gazon +of.options.BETTER_GRASS.tooltip.2= OFF - texture par défaut (rapide) +of.options.BETTER_GRASS.tooltip.3= Rapide - bord de pelouse complet (lent) +of.options.BETTER_GRASS.tooltip.4= Détaillé - bord de pelouse détaillé (très lent) + +of.options.BETTER_SNOW=Meilleur Neige +of.options.BETTER_SNOW.tooltip.1=Meilleur Neige +of.options.BETTER_SNOW.tooltip.2= OFF - Neige par défaut (rapide) +of.options.BETTER_SNOW.tooltip.3= ON - Meilleure Neige (lent) +of.options.BETTER_SNOW.tooltip.4=Apparait en dessous des blocs transparents (clôture, haute herbe) +of.options.BETTER_SNOW.tooltip.5=lorsque qu'entouré de neige. + +of.options.CUSTOM_FONTS=Police Personnalisé +of.options.CUSTOM_FONTS.tooltip.1=Police Personnalisé +of.options.CUSTOM_FONTS.tooltip.2= ON - utilise la police personnalisée (défaut, lent) +of.options.CUSTOM_FONTS.tooltip.3= OFF - utilise la police par défaut (rapide) +of.options.CUSTOM_FONTS.tooltip.4=La Police Personnalisée est fournis par +of.options.CUSTOM_FONTS.tooltip.5=le pack de ressources utilisé. + +of.options.CUSTOM_COLORS=Couleurs Personnalisés +of.options.CUSTOM_COLORS.tooltip.1=Couleurs Personnalisés +of.options.CUSTOM_COLORS.tooltip.2= ON - utilise des couleurs personnalisées (défaut, lent) +of.options.CUSTOM_COLORS.tooltip.3= OFF - utilise les couleurs par défaut (rapide) +of.options.CUSTOM_COLORS.tooltip.4=Les Couleurs Personnalisées sont fournis par +of.options.CUSTOM_COLORS.tooltip.5=le pack de ressources utilisé. + +of.options.SWAMP_COLORS=Couleurs Marécageuses +of.options.SWAMP_COLORS.tooltip.1=Couleurs Marécageuses +of.options.SWAMP_COLORS.tooltip.2= ON - utilise les couleurs marécageuses (défaut, lent) +of.options.SWAMP_COLORS.tooltip.3= OFF - n'utilise pas les couleurs marécageuses (rapide) +of.options.SWAMP_COLORS.tooltip.4=La couleur marécageuse modifie la pelouse, les feuilles, +of.options.SWAMP_COLORS.tooltip.5=les lianes et l'eau. + +of.options.SMOOTH_BIOMES=Biomes Adoucis +of.options.SMOOTH_BIOMES.tooltip.1=Biomes Adoucis +of.options.SMOOTH_BIOMES.tooltip.2= ON - adoucie la bordure des biomes (défaut, lent) +of.options.SMOOTH_BIOMES.tooltip.3= OFF - aucun adoucissement de bordure des biomes (rapide) +of.options.SMOOTH_BIOMES.tooltip.4=L'adoucissement des bordures de biomes est fait en échantillonnant et +of.options.SMOOTH_BIOMES.tooltip.5=moyenant la couleur des blocs aux frontières entre deux biomes. +of.options.SMOOTH_BIOMES.tooltip.6=N'affecte que la pelouse, les feuilles, les lianes et l'eau. + +of.options.CONNECTED_TEXTURES=Textures Connectés +of.options.CONNECTED_TEXTURES.tooltip.1=Textures Connectés +of.options.CONNECTED_TEXTURES.tooltip.2= OFF - aucune connexion (défaut) +of.options.CONNECTED_TEXTURES.tooltip.3= Rapide - connexion rapide +of.options.CONNECTED_TEXTURES.tooltip.4= Fancy - connexion détaillée +of.options.CONNECTED_TEXTURES.tooltip.5=Les Textures Connectés connecte les textures de +of.options.CONNECTED_TEXTURES.tooltip.6=la vitre, le grès et les bibliothèques placés une +of.options.CONNECTED_TEXTURES.tooltip.7=à coté de l'autre. Les Textures Connectés sont +of.options.CONNECTED_TEXTURES.tooltip.8=fournis par le pack de ressources utilisé. + +of.options.NATURAL_TEXTURES=Textures Naturelles +of.options.NATURAL_TEXTURES.tooltip.1=Textures Naturelles +of.options.NATURAL_TEXTURES.tooltip.2= OFF - sans textures naturelles (défaut) +of.options.NATURAL_TEXTURES.tooltip.3= ON - avec textures naturelles +of.options.NATURAL_TEXTURES.tooltip.4=Les textures naturelles enlèvent le motif grillagé +of.options.NATURAL_TEXTURES.tooltip.5=créé par la répétition de bloc identique. +of.options.NATURAL_TEXTURES.tooltip.6=L'utilisation de textures retournées et renversées +of.options.NATURAL_TEXTURES.tooltip.7=est utilisé. La configuration pour les textures naturelles +of.options.NATURAL_TEXTURES.tooltip.8=sont fournies par le pack de ressources utilisé. + +of.options.CUSTOM_SKY=Ciel Personnalisé +of.options.CUSTOM_SKY.tooltip.1=Ciel Personnalisé +of.options.CUSTOM_SKY.tooltip.2= ON - Texture personnalisée (défaut, lent) +of.options.CUSTOM_SKY.tooltip.3= OFF - ciel par défaut (rapide) +of.options.CUSTOM_SKY.tooltip.4=La texture du ciel personnalisé est +of.options.CUSTOM_SKY.tooltip.5=fourni par le pack de ressources utilisé. + +of.options.CUSTOM_ITEMS=Items Personnalisés +of.options.CUSTOM_ITEMS.tooltip.1=Items Personnalisés +of.options.CUSTOM_ITEMS.tooltip.2= ON - textures d'items personnalisés (défaut, lent) +of.options.CUSTOM_ITEMS.tooltip.3= OFF - textures d'items par défaut (rapide) +of.options.CUSTOM_ITEMS.tooltip.4=Les textures d'items personnalisés sont +of.options.CUSTOM_ITEMS.tooltip.5=fournis par le pack de ressources utilisé. + +of.options.CUSTOM_ENTITY_MODELS=Modèles d'Entités Personnalisées +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=Modèles d'Entités Personnalisées +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= ON - modèles d'entités personnalisées (défaut, lent) +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= OFF - modèles d'entités par défaut (rapide) +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=Les modèles d'entités personnalisées sont +of.options.CUSTOM_ENTITY_MODELS.tooltip.5=fournis par le pack de ressources utilisé. + +# Details + +of.options.CLOUDS=Nuages +of.options.CLOUDS.tooltip.1=Nuages +of.options.CLOUDS.tooltip.2= Défaut - comme dans les configurations Graphiques +of.options.CLOUDS.tooltip.3= Rapides - basse qualité (rapde) +of.options.CLOUDS.tooltip.4= Détaillés - haute qualité (lent) +of.options.CLOUDS.tooltip.5= OFF - sans nuages (plus rapide) +of.options.CLOUDS.tooltip.6=Les nuages rapides sont rendus en 2D. +of.options.CLOUDS.tooltip.7=Les nuages détaillés sont rendus en 3D. + +of.options.CLOUD_HEIGHT=Hauteur des Nuages +of.options.CLOUD_HEIGHT.tooltip.1=Hauteur des Nuages +of.options.CLOUD_HEIGHT.tooltip.2= OFF - hauteur par défaut +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - au-dessus de la hauteur limite du monde + +of.options.TREES=Arbres +of.options.TREES.tooltip.1=Arbres +of.options.TREES.tooltip.2= Défaut - comme dans les configurations Graphiques +of.options.TREES.tooltip.3= Rapides - basse qualité (plus rapide) +of.options.TREES.tooltip.4= Intelligents - haute qualité (rapide) +of.options.TREES.tooltip.5= Détaillés - très haute qualité (lent) +of.options.TREES.tooltip.6=Les arbres rapides ont des feuilles opaques. +of.options.TREES.tooltip.7=Les arbres intelligents et détaillés +of.options.TREES.tooltip.8=ont des feuilles transparentes. + +of.options.RAIN=Pluie & Neige +of.options.RAIN.tooltip.1=Pluie & Neige +of.options.RAIN.tooltip.2= Défaut - comme dans les configurations Graphiques +of.options.RAIN.tooltip.3= Rapide - légère pluie/neige (rapide) +of.options.RAIN.tooltip.4= Détaillé - grosse pluie/neige (lent) +of.options.RAIN.tooltip.5= OFF - sans pluie/neige (plus rapide) +of.options.RAIN.tooltip.6=Même si la pluie & la neige est à OFF, +of.options.RAIN.tooltip.7=les éclaboussures et le son sont toujours actifs. + +of.options.SKY=Ciel +of.options.SKY.tooltip.1=Ciel +of.options.SKY.tooltip.2= ON - Le ciel est visible (lent) +of.options.SKY.tooltip.3= OFF - Le ciel n'est pas visible (rapide) +of.options.SKY.tooltip.4=Quand le ciel est à OFF, +of.options.SKY.tooltip.5=le soleil et la lune sont toujours visibles. + +of.options.STARS=Étoiles +of.options.STARS.tooltip.1=Étoiles +of.options.STARS.tooltip.2= ON - Les étoiles sont visible (lent) +of.options.STARS.tooltip.3= OFF - Les étoiles ne sont pas visibles (rapide) + +of.options.SUN_MOON=Soleil & lune +of.options.SUN_MOON.tooltip.1=Soleil & lune +of.options.SUN_MOON.tooltip.2= ON - le soleil et la lune sont visibles (défaut) +of.options.SUN_MOON.tooltip.3= OFF - le soleil et la lune ne sont pas visibles (rapide) + +of.options.SHOW_CAPES=Capes Visibles +of.options.SHOW_CAPES.tooltip.1=Capes visibles +of.options.SHOW_CAPES.tooltip.2= ON - voir la cape de joueurs (défaut) +of.options.SHOW_CAPES.tooltip.3= OFF - ne pas voir la cape des joueurs + +of.options.TRANSLUCENT_BLOCKS=Blocs Translucides +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Blocs Translucides +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Détaillés - mélange correct des couleurs (défaut) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Rapides - mélange rapide ds couleurs (rapide) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Controle le mélange des couleurs des blocs translucides +of.options.TRANSLUCENT_BLOCKS.tooltip.5=avec différentes couleurs (verre teindu, eau, glace) +of.options.TRANSLUCENT_BLOCKS.tooltip.6=lorsque placé un à côté de l'autre avec de l'air entre eux. + +of.options.HELD_ITEM_TOOLTIPS=Info-bulles d'Item +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Info-bulles d'Item +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= ON - affiche des infos sur l'item en main (défaut) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= OFF - n'affiche pas d'info sur l'item en main + +of.options.ADVANCED_TOOLTIPS=Info-bulles Avancé +of.options.ADVANCED_TOOLTIPS.tooltip.1=Info-bulles Avancé +of.options.ADVANCED_TOOLTIPS.tooltip.2= ON - affiche les infobulles avancées +of.options.ADVANCED_TOOLTIPS.tooltip.3= OFF - n'affiche pas les infobulles avancées (défaut) +of.options.ADVANCED_TOOLTIPS.tooltip.4=Les infobulles avancées affiche des informations détaillées +of.options.ADVANCED_TOOLTIPS.tooltip.5=sur l'item (id, durabilité) et les options des shaders +of.options.ADVANCED_TOOLTIPS.tooltip.6=(id, source, valeurs par défaut). + +of.options.DROPPED_ITEMS=Items Droppés +of.options.DROPPED_ITEMS.tooltip.1=Dropped Items +of.options.DROPPED_ITEMS.tooltip.2= Défaut - comme dans les configurations Graphiques +of.options.DROPPED_ITEMS.tooltip.3= Rapides - items 2D (rapide) +of.options.DROPPED_ITEMS.tooltip.4= Détaillés - items 3D (lent) + +options.entityShadows.tooltip.1=Ombres des Entités +options.entityShadows.tooltip.2= ON - affiche l'ombre des entités +options.entityShadows.tooltip.3= OFF - n'affiche pas l'ombre des entités + +of.options.VIGNETTE=Vignette +of.options.VIGNETTE.tooltip.1=Effet visuel qui assombrie les coins de l'écran +of.options.VIGNETTE.tooltip.2= Défaut - comme dans les configurations Graphiques +of.options.VIGNETTE.tooltip.3= Rapide - vignette désactivée (rapide) +of.options.VIGNETTE.tooltip.4= Détaillée - vignette activée (lent) +of.options.VIGNETTE.tooltip.5=La vignette à un effet significatif sur les FPS, +of.options.VIGNETTE.tooltip.6=surtout lorsque le jeu est en plein écran. +of.options.VIGNETTE.tooltip.7=L'effet de vignette est très subtile et +of.options.VIGNETTE.tooltip.8=peut être désactivé en toute sécurité. + +of.options.DYNAMIC_FOV=CV Dynamique +of.options.DYNAMIC_FOV.tooltip.1=CV Dynamique +of.options.DYNAMIC_FOV.tooltip.2= ON - activer le CV dynamique (défaut) +of.options.DYNAMIC_FOV.tooltip.3= OFF - désactiver le CV dynamique +of.options.DYNAMIC_FOV.tooltip.4=Changer le champ visuel (CV) lors du vol, du sprint +of.options.DYNAMIC_FOV.tooltip.5=de la nage et du bandage d'un arc. + +of.options.DYNAMIC_LIGHTS=Lumières Dynamiques +of.options.DYNAMIC_LIGHTS.tooltip.1=Lumières Dynamiques +of.options.DYNAMIC_LIGHTS.tooltip.2= OFF - aucune lumière dynamique (défaut) +of.options.DYNAMIC_LIGHTS.tooltip.3= Rapides - lumières dynamiques rapides (rafraichi à tous les 500ms) +of.options.DYNAMIC_LIGHTS.tooltip.4= Détaillées - Lumières dynamiques détaillées (rafraichi en temps réel) +of.options.DYNAMIC_LIGHTS.tooltip.5=Active la lumière des items (torche, pierre lumineuse, etc.) +of.options.DYNAMIC_LIGHTS.tooltip.6=pour illuminer tout autour quand l'item et en main, +of.options.DYNAMIC_LIGHTS.tooltip.7=equipper par d'autres joueurs ou jeter au sol. + +# Performance + +of.options.SMOOTH_FPS=FPS Atténué +of.options.SMOOTH_FPS.tooltip.1=Stabilise les FPS en supprimant les tampons de mémoires graphiques. +of.options.SMOOTH_FPS.tooltip.2= OFF - aucune stabilisation, Les FPS peuvent varier +of.options.SMOOTH_FPS.tooltip.3= ON - stabilisation des FPS +of.options.SMOOTH_FPS.tooltip.4=Cette option dépend du gestionnaire graphique, les +of.options.SMOOTH_FPS.tooltip.5=effets ne sont pas toujours visibles. + +of.options.SMOOTH_WORLD=Monde Atténué +of.options.SMOOTH_WORLD.tooltip.1=Élimine les piques de lag causé par le serveur interne. +of.options.SMOOTH_WORLD.tooltip.2= OFF - aucune stabilisation, Les FPS peuvent varier +of.options.SMOOTH_WORLD.tooltip.3= ON - stabilisation des FPS +of.options.SMOOTH_WORLD.tooltip.4=Stabilises les FPS en distribuent les charges du serveur interne. +of.options.SMOOTH_WORLD.tooltip.5=Fonctionne seulement en local (monde solo). + +of.options.FAST_RENDER=Rendu Rapide +of.options.FAST_RENDER.tooltip.1=Rendu Rapide +of.options.FAST_RENDER.tooltip.2= OFF - rendu standard (défaut) +of.options.FAST_RENDER.tooltip.3= ON - rendu optimisé (rapide) +of.options.FAST_RENDER.tooltip.4=Utilise des algorithmes de rendu optimisé pour diminuer +of.options.FAST_RENDER.tooltip.5=la charge du GPU et peut augmenter les FPS. + +of.options.FAST_MATH=Maths Rapides +of.options.FAST_MATH.tooltip.1=Mats Rapides +of.options.FAST_MATH.tooltip.2= OFF - math standard (défaut) +of.options.FAST_MATH.tooltip.3= ON - math optimisé +of.options.FAST_MATH.tooltip.4=Utilise des fonctions optimisées de sin() et cos() qui peuvent +of.options.FAST_MATH.tooltip.5=mieu utilisé la cache du CPU et augmenter les FPS. + +of.options.CHUNK_UPDATES=Mise à Jour des Chunks +of.options.CHUNK_UPDATES.tooltip.1=Mise à Jour des Chunks +of.options.CHUNK_UPDATES.tooltip.2= 1 - chargement lent du monde, meilleur FPS (défaut) +of.options.CHUNK_UPDATES.tooltip.3= 3 - chargement rapide du monde, bas FPS +of.options.CHUNK_UPDATES.tooltip.4= 5 - chargement très rapide du monde, très bas FPS +of.options.CHUNK_UPDATES.tooltip.5=Nombre de Mise à jour par image de rendu (tick), +of.options.CHUNK_UPDATES.tooltip.6=Les valeurs élevées peut déstabilisé les FPS. + +of.options.CHUNK_UPDATES_DYNAMIC=Mises à Jour Dynamiques +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Mises à Jours Dynamiques +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= OFF - mise à jour standard (défaut) +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= ON - plus de mise à jour lorsque le joueur ne bouge pas +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=Les mises à jour dynamiques force plus de +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=chunks à ce mettre à jour quand le joueur +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.6=est inactif pour charger le monde plus vite. + +of.options.LAZY_CHUNK_LOADING=Chargement des Chunks Lâches +of.options.LAZY_CHUNK_LOADING.tooltip.1=Chargement Lâche des Chunks +of.options.LAZY_CHUNK_LOADING.tooltip.2= OFF - chargement des chunks serveurs par défaut +of.options.LAZY_CHUNK_LOADING.tooltip.3= ON - chargement des chunks serveur lâche (plus doux) +of.options.LAZY_CHUNK_LOADING.tooltip.4=Adoucie le chargement des chunks serveurs intégrés +of.options.LAZY_CHUNK_LOADING.tooltip.5=en distribuant les chunks sur plusieurs ticks. +of.options.LAZY_CHUNK_LOADING.tooltip.6=Tourné à OFF si des parties du monde ne se charge pas correctement. +of.options.LAZY_CHUNK_LOADING.tooltip.7=Fonctionne seulement en local (monde solo) et les CPU à un coeur. + +# Animations + +of.options.animation.allOn=Tous à ON +of.options.animation.allOff=Tous à OFF +of.options.animation.dynamic=Dynamique + +of.options.ANIMATED_WATER=Eau Animée +of.options.ANIMATED_LAVA=Lave Animée +of.options.ANIMATED_FIRE=Feux Animé +of.options.ANIMATED_PORTAL=Portail Animé +of.options.ANIMATED_REDSTONE=Redstone Animé +of.options.ANIMATED_EXPLOSION=Explosion Animée +of.options.ANIMATED_FLAME=Flamme Animé +of.options.ANIMATED_SMOKE=Fumée Animée +of.options.VOID_PARTICLES=Particules de Vide +of.options.WATER_PARTICLES=Particules d'Eau +of.options.RAIN_SPLASH=Particules de Pluie +of.options.PORTAL_PARTICLES=Particules de Portail +of.options.POTION_PARTICLES=Particules de Potion +of.options.DRIPPING_WATER_LAVA=Eau/Lave qui Coule +of.options.ANIMATED_TERRAIN=Terrain Animé +of.options.ANIMATED_TEXTURES=Textures Animées +of.options.FIREWORK_PARTICLES=Particules de Feux d'Artifice + +# Other + +of.options.LAGOMETER=Lagomèter +of.options.LAGOMETER.tooltip.1=Affiche le Lagomètre sur l'écran de débogage (F3). +of.options.LAGOMETER.tooltip.2=* Orange - Récupérateur de mémoire +of.options.LAGOMETER.tooltip.3=* Cyan - Tick +of.options.LAGOMETER.tooltip.4=* Blue - Executables programmés +of.options.LAGOMETER.tooltip.5=* Purple - Chunk téléchargé +of.options.LAGOMETER.tooltip.6=* Red - Mises à jour de chunk +of.options.LAGOMETER.tooltip.7=* Yellow - Contrôle de visibilité +of.options.LAGOMETER.tooltip.8=* Green - Terrain rendu + +of.options.PROFILER=Profileur de Débogage +of.options.PROFILER.tooltip.1=Profileur de Débogage +of.options.PROFILER.tooltip.2= ON - profileur actif (lent) +of.options.PROFILER.tooltip.3= OFF - profileur non actif (rapide) +of.options.PROFILER.tooltip.4=Le profileur de débogage collecte et affiche des informations de +of.options.PROFILER.tooltip.5=débogage lorsque l'écran de débogage (F3) est ouvert. + +of.options.WEATHER=Météo +of.options.WEATHER.tooltip.1=Météo +of.options.WEATHER.tooltip.2= ON - Météo active (lent) +of.options.WEATHER.tooltip.3= OFF - Météo non active (rapide) +of.options.WEATHER.tooltip.4=La météo contrôle la pluie, la neige et l'orage. +of.options.WEATHER.tooltip.5=Le contrôle de la météo n'est possible qu'en local. + +of.options.time.dayOnly=Jour Seulement +of.options.time.nightOnly=Nuit Seulement + +of.options.TIME=temps +of.options.TIME.tooltip.1=Temps +of.options.TIME.tooltip.2= Défaut - Cycle jour/nuit normal +of.options.TIME.tooltip.3= Jour Seulement - jour seulement +of.options.TIME.tooltip.4= Nuit Seulement - nuit seulement +of.options.TIME.tooltip.5=La séléction du temps n'est possible qu'en CRÉATIF +of.options.TIME.tooltip.6=dans un monde local. + +options.fullscreen.tooltip.1=Plein Écran +options.fullscreen.tooltip.2= ON - jeu en plein écran +options.fullscreen.tooltip.3= OFF - jeu fenêtré +options.fullscreen.tooltip.4=Le mode plein écran peut être plus rapide ou plus lent +options.fullscreen.tooltip.5=que le mode fenêtré, cela dépend de la carte graphique. + +of.options.FULLSCREEN_MODE=Option Plein Écran +of.options.FULLSCREEN_MODE.tooltip.1=Option Plein Écran +of.options.FULLSCREEN_MODE.tooltip.2= Défaut - utilise la résolution du moniteur (lent) +of.options.FULLSCREEN_MODE.tooltip.3= LxH - utilise une résolution personnalisée (rapide) +of.options.FULLSCREEN_MODE.tooltip.4=La résolution sélectionnée est utilisé en mode plein écran (F11). +of.options.FULLSCREEN_MODE.tooltip.5=Une résolution plus basse devrait être plus rapide. + +of.options.SHOW_FPS=Afficher les FPS +of.options.SHOW_FPS.tooltip.1=Affiche les FPS et informations de rendu. +of.options.SHOW_FPS.tooltip.2= C: - chunk rendu +of.options.SHOW_FPS.tooltip.3= E: - entités rendu + bloc entités +of.options.SHOW_FPS.tooltip.4= U: - mises à jour de chunk +of.options.SHOW_FPS.tooltip.5=Les informations sont présenté de manière compacte dans le coin +of.options.SHOW_FPS.tooltip.6=supérieur gauche lorsque l'écran de débogage n'est pas visible + +of.options.save.default=Défaut (2s) +of.options.save.20s=20s +of.options.save.3min=3min +of.options.save.30min=30min + +of.options.AUTOSAVE_TICKS=Sauvegarde Automatique +of.options.AUTOSAVE_TICKS.tooltip.1=Intervale entre les sauvegardes +of.options.AUTOSAVE_TICKS.tooltip.2=L'intervalle par défaut (2s) n'est PAS RECOMMENDER. +of.options.AUTOSAVE_TICKS.tooltip.3=Les sauvegardes automatiques sont la cause +of.options.AUTOSAVE_TICKS.tooltip.4=du Pique de Lag de la Mort qui Tue. + +of.options.SCREENSHOT_SIZE=Taille des Captures d'Écrans +of.options.SCREENSHOT_SIZE.tooltip.1=Taille des Captures d'Écrans +of.options.SCREENSHOT_SIZE.tooltip.2= Défaut - taille de la fenêtre +of.options.SCREENSHOT_SIZE.tooltip.3= 2x-4x - taille personnalisée +of.options.SCREENSHOT_SIZE.tooltip.4=Prendre une capture d'écran plus grande utilise plus de mémoire. +of.options.SCREENSHOT_SIZE.tooltip.5=Incompatible avec le Rendu Rapide et l'Anticrénelage. +of.options.SCREENSHOT_SIZE.tooltip.6=Nécessite un GPU avec un tampon d'image. \ No newline at end of file diff --git a/src/minecraft/assets/minecraft/optifine/lang/hu_HU.lang b/src/minecraft/assets/minecraft/optifine/lang/hu_HU.lang new file mode 100644 index 0000000..b181ae5 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/hu_HU.lang @@ -0,0 +1,559 @@ +# General +of.general.ambiguous=zavaros +of.general.custom=Egyéni +of.general.from=-ból +of.general.id=Id +of.general.restart=újraindítás +of.general.smart=Okos + +# Keys +of.key.zoom=Zoom + +# Message +of.message.aa.shaders1=Az Élsimítás nem kompatibilis a shaderekkel. +of.message.aa.shaders2=Kérlek kapcsold ki a shadereket a beállítás bekapcsolásához. + +of.message.af.shaders1=Az Anizotróp Szűrés nem kompatibilis a shaderekkel. +of.message.af.shaders2=Kérlek kapcsold ki a shadereket a beállítás bekapcsolásához. + +of.message.fr.shaders1=A Gyors Renderelés nem kompatibilis a shaderekkel. +of.message.fr.shaders2=Kérlek kapcsold ki a shadereket a beállítás bekapcsolásához. + +of.message.an.shaders1=A Sztereoszkopikus 3D nem kompatibilis a shaderekkel. +of.message.an.shaders2=Kérlek kapcsold ki a shadereket a beállítás bekapcsolásához. + +of.message.shaders.aa1=A shaderek nem kompatibilisek az Élsimítással. +of.message.shaders.aa2=Kérlek kapcsold Minőség -> Élsimítás-t ki és indísd újra a játékot. + +of.message.shaders.af1=A shaderek nem kompatibilisek az Anizotróp Szűréssel. +of.message.shaders.af2=Kérlek kapcsold Minőség -> Anizotróp Szűrés-t ki. + +of.message.shaders.fr1=A shaderek nem kompatibilisek a Gyors Rendereléssel. +of.message.shaders.fr2=Kérlek kapcsold Teljesítmény -> Gyors Renderelés-t ki. + +of.message.shaders.an1=A shaderek nem kompatibilisek a sztereoszkopikus 3D-vel. +of.message.shaders.an2=Kérlek kapcsold Egyéb -> Sztereoszkopikus 3D-t ki. + +of.message.newVersion=Egy új §eOptiFine§f verzió elérhető: §e%s§f +of.message.java64Bit=Tudsz telepíteni §e64-bit Java§f -t a teljesítmény növeléséhez. +of.message.openglError=§eOpenGL Error§f: %s (%s) + +of.message.shaders.loading=Shader betöltése: %s + +of.message.other.reset=Törli az összes videóbeállítást az alapértelmezett értékekre? + +# Video settings + +options.graphics.tooltip.1=Vizuális minőség +options.graphics.tooltip.2= Gyors - alacsonyabb minőség, gyorsabb +options.graphics.tooltip.3= Szép - magasabb minőség, lassabb +options.graphics.tooltip.4=Megváltoztatja a megjelenését a felhőknek, leveleknek, víznek, +options.graphics.tooltip.5=árnyékoknak és a fű oldalainak. + +of.options.renderDistance.tiny=Apró +of.options.renderDistance.short=Rövid +of.options.renderDistance.normal=Normál +of.options.renderDistance.far=Messzi +of.options.renderDistance.extreme=Extrém + +options.renderDistance.tooltip.1=Látótávolság +options.renderDistance.tooltip.2= 2 Apró - 32m (leggyorsabb) +options.renderDistance.tooltip.3= 4 Rövid - 64m (gyorsabb) +options.renderDistance.tooltip.4= 8 Normál - 128m +options.renderDistance.tooltip.5= 16 Messzi - 256m (lassabb) +options.renderDistance.tooltip.6= 32 Extrém - 512m (leglassab!) +options.renderDistance.tooltip.7=Az Extrém látótávolság nagyon erőforrás igényes! +options.renderDistance.tooltip.8=Értékek 16 Messzi fölött csak helyi világokban effektív. + +options.ao.tooltip.1=Simított megvilágítás +options.ao.tooltip.2= KI - Nincs simított megvilágítás (gyorsabb) +options.ao.tooltip.3= Minimum - Egyszerű simított megvilágítás (lassabb) +options.ao.tooltip.4= Maximum - Bonyolult simított megvilágítás (leglassab) + +options.framerateLimit.tooltip.1=Maximum FPS +options.framerateLimit.tooltip.2= VSync - A monitor képkocka frissítéséhez szabott (60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - változó +options.framerateLimit.tooltip.4= Korlátlan - nincs határ (leggyorsabb) +options.framerateLimit.tooltip.5=Az FPS korlátozás csökkenti az FPS-t akkor is, ha +options.framerateLimit.tooltip.6=a korlát érték nincs elérve. +of.options.framerateLimit.vsync=VSync + +of.options.AO_LEVEL=Simított Megvilágítás Szintje +of.options.AO_LEVEL.tooltip.1=Simított megvilágítás szintje +of.options.AO_LEVEL.tooltip.2= KI - nincsenek árnyékok +of.options.AO_LEVEL.tooltip.3= 50%% - halvány árnyékok +of.options.AO_LEVEL.tooltip.4= 100%% - sötét árnyékok + +options.viewBobbing.tooltip.1=Valósághűbb mozgás. +options.viewBobbing.tooltip.2=Amikor MIP-leképzést használsz, kapcsold ki a legjobb eredményekért. + +options.guiScale.tooltip.1=GUI Mérete +options.guiScale.tooltip.2=Kisebb GUI gyorsabb lehet. + +options.vbo.tooltip.1=Vertex Buffer Objects +options.vbo.tooltip.2=Egy alternatív renderelési mintát használ, ami általában +options.vbo.tooltip.3=gyorsabb (5-10%%) az alapértelmezett renderelésnél. + +options.gamma.tooltip.1=A sötétebb objektumok fényerejét változtatja +options.gamma.tooltip.2= Borongós - normál fényerő +options.gamma.tooltip.3= 1-99%% - változó +options.gamma.tooltip.4= Fényes - maximum fényerő a sötétebb objektumoknak +options.gamma.tooltip.5=Ez a beállítás nem változtatja a fényerejét a +options.gamma.tooltip.6=teljesen fekete objektumoknak. + +options.anaglyph.tooltip.1=Sztereoszkopikus 3D +options.anaglyph.tooltip.2=Bekapcsolja a sztereoszopikus 3D effektet különböző színek használatával +options.anaglyph.tooltip.3=szemenként. +options.anaglyph.tooltip.4=Vörös-cián szemüveget igényel a megfelelő látásért. + +of.options.ALTERNATE_BLOCKS=Váltakozó Blokkok +of.options.ALTERNATE_BLOCKS.tooltip.1=Váltakozó Blokkok +of.options.ALTERNATE_BLOCKS.tooltip.2=Alernatív blokk mintákat használ egyes blokkokhoz. +of.options.ALTERNATE_BLOCKS.tooltip.3=A kiválasztott forráscsomagtól függ. + +of.options.FOG_FANCY=Köd +of.options.FOG_FANCY.tooltip.1=Köd típusa +of.options.FOG_FANCY.tooltip.2= Gyors - gyorsabb köd +of.options.FOG_FANCY.tooltip.3= Szép - lassabb köd, jobban mutat +of.options.FOG_FANCY.tooltip.4= KI - nincs köd, leggyorsabb +of.options.FOG_FANCY.tooltip.5=A szép köd csak akkor elérhető, ha támogatja a +of.options.FOG_FANCY.tooltip.6=videókártya. + +of.options.FOG_START=Köd Kezdete +of.options.FOG_START.tooltip.1=Köd kezdete +of.options.FOG_START.tooltip.2= 0.2 - a köd a játékostól közel kezdődik +of.options.FOG_START.tooltip.3= 0.8 - a köd a játékostól messze kezdődik +of.options.FOG_START.tooltip.4=Ez a beállítás általában nem gyakorol hatást a teljesítményre. + +of.options.CHUNK_LOADING=Terület Betöltése +of.options.CHUNK_LOADING.tooltip.1=Terület Betöltése +of.options.CHUNK_LOADING.tooltip.2= Alapértelmezett - instabil FPS területek betöltésekor +of.options.CHUNK_LOADING.tooltip.3= Lágy - stabil FPS +of.options.CHUNK_LOADING.tooltip.4= Kétmagos - stabil FPS, 3x gyorsabb világbetöltés +of.options.CHUNK_LOADING.tooltip.5=A Lágy és Kétmagos eltávolítja az akadozásokat, és +of.options.CHUNK_LOADING.tooltip.6=a befagyásokat, amit a területbetöltés okoz. +of.options.CHUNK_LOADING.tooltip.7=A Kétmagos fel tudja gyorsítani a világbetöltést a 3x-osára, és +of.options.CHUNK_LOADING.tooltip.8=képes az FPS növelésére a 2. processzormag használatával. +of.options.chunkLoading.smooth=Lágy +of.options.chunkLoading.multiCore=Kétmagos + +of.options.shaders=Shaderek... +of.options.shadersTitle=Árnyékok és egyéb finomságok + +of.options.shaders.packNone=KI +of.options.shaders.packDefault=(belső) + +of.options.shaders.ANTIALIASING=Élsimítás +of.options.shaders.NORMAL_MAP=Normal Map +of.options.shaders.SPECULAR_MAP=Specular Map +of.options.shaders.RENDER_RES_MUL=Render Minőség +of.options.shaders.SHADOW_RES_MUL=Árnyék Minőség +of.options.shaders.HAND_DEPTH_MUL=Kézmélység +of.options.shaders.CLOUD_SHADOW=Felhőárnyék +of.options.shaders.OLD_HAND_LIGHT=Régi Kézmegvilágítás +of.options.shaders.OLD_LIGHTING=Régi Megvilágítás +of.options.shaders.SHADER_PACK=Shader Csomag + +of.options.shaders.shadersFolder=Shaderek mappája +of.options.shaders.shaderOptions=Shader Beállítások... + +of.options.shaderOptionsTitle=Shader Beállítások + +of.options.quality=Minőség... +of.options.qualityTitle=Minőségi Beállítások + +of.options.details=Részletek... +of.options.detailsTitle=Részletbeállítások + +of.options.performance=Teljesítmény... +of.options.performanceTitle=Teljesítmény Beállítások + +of.options.animations=Animációk... +of.options.animationsTitle=Animáció Beállítások + +of.options.other=Egyéb... +of.options.otherTitle=Egyéb Beállítások + +of.options.other.reset=Videóbeállítások Törlése... + +of.shaders.profile=Profil + +# Quality + +of.options.mipmap.bilinear=Bilineáris +of.options.mipmap.linear=Lineáris +of.options.mipmap.nearest=Legközelebbi +of.options.mipmap.trilinear=Trilineáris + +options.mipmapLevels.tooltip.1=Vizuális effekt, ami a távolabbi dolgokat szebbé teszi +options.mipmapLevels.tooltip.2=a textúrák részletességének simításával. +options.mipmapLevels.tooltip.3= KI - nincs simítás +options.mipmapLevels.tooltip.4= 1 - minimum simítás +options.mipmapLevels.tooltip.5= 4 - maximum simítás +options.mipmapLevels.tooltip.6=Ez a beállítás általában nem gyakorol hatást a teljesítményre. + +of.options.MIPMAP_TYPE=MIP-leképzés típusa +of.options.MIPMAP_TYPE.tooltip.1=Vizuális effekt, ami a távolabbi dolgokat szebbé teszi +of.options.MIPMAP_TYPE.tooltip.2=a textúrák részletességének simításával. +of.options.MIPMAP_TYPE.tooltip.3= Legközelebbi - durva simítás (leggyorsabb) +of.options.MIPMAP_TYPE.tooltip.4= Lineáris - normál simítás +of.options.MIPMAP_TYPE.tooltip.5= Bilineáris - finom simítás +of.options.MIPMAP_TYPE.tooltip.6= Trilineáris - legfinomabb simítás (leglassabb) + + +of.options.AA_LEVEL=Élsimítás +of.options.AA_LEVEL.tooltip.1=Élsimítás +of.options.AA_LEVEL.tooltip.2= KI - (alapértelmezett) nincs élsimítás (gyorsabb) +of.options.AA_LEVEL.tooltip.3= 2-16 - élsimított vonalak és élek (lassabb) +of.options.AA_LEVEL.tooltip.4=Az Élsimítás kisimítja az egyenletlen vonalakat, és +of.options.AA_LEVEL.tooltip.5=az éles színátmeneteket. +of.options.AA_LEVEL.tooltip.6=Bekapcsolás esetén lényegesen csökkentheti az FPS-t. +of.options.AA_LEVEL.tooltip.7=Nem minden szint támogatott egyes videókártyákon. +of.options.AA_LEVEL.tooltip.8=ÚJRAINDÍTÁS után effektív! + +of.options.AF_LEVEL=Aniszotróp Szűrés +of.options.AF_LEVEL.tooltip.1=Anizotróp Szűrés +of.options.AF_LEVEL.tooltip.2= KI - (alapértelmezett) alap textúra részletesség (gyorsabb) +of.options.AF_LEVEL.tooltip.3= 2-16 - finomabb részletek a MIP-leképzett textúrákon (lassabb) +of.options.AF_LEVEL.tooltip.4=Az Anizotróp Szűrés helyreállítja a részleteket a +of.options.AF_LEVEL.tooltip.5=MIP-leképzett textúrákon. +of.options.AF_LEVEL.tooltip.6=Bekapcsolás esetén lényegesen csökkentheti az FPS-t. + +of.options.CLEAR_WATER=Tiszta Víz +of.options.CLEAR_WATER.tooltip.1=Tiszta Víz +of.options.CLEAR_WATER.tooltip.2= BE - tiszta, átlátszó víz +of.options.CLEAR_WATER.tooltip.3= KI - alapértelmezett víz + +of.options.RANDOM_MOBS=Véletlenszerű Mobok +of.options.RANDOM_MOBS.tooltip.1=Véletlenszerű Mobok +of.options.RANDOM_MOBS.tooltip.2= KI - nincsenek véletlenszerű mobok, gyorsabb +of.options.RANDOM_MOBS.tooltip.3= BE - véletlenszerű mobok, lassabb +of.options.RANDOM_MOBS.tooltip.4=A véletlenszerű mobok véletlenszerű textúrákat használ a játék lényeinek. +of.options.RANDOM_MOBS.tooltip.5=Olyan erőforráscsomagot igényel, amiben vannak dupla mob textúrák . + +of.options.BETTER_GRASS=Jobb Fű +of.options.BETTER_GRASS.tooltip.1=Jobb Fű +of.options.BETTER_GRASS.tooltip.2= KI - alapértelmezett fű oldaltextúra, leggyorsabb +of.options.BETTER_GRASS.tooltip.3= Gyors - teljes fű oldaltextúra, lassabb +of.options.BETTER_GRASS.tooltip.4= Szép - dinamikus fű oldaltextúra, leglassabb + +of.options.BETTER_SNOW=Jobb Hó +of.options.BETTER_SNOW.tooltip.1=Jobb Hó +of.options.BETTER_SNOW.tooltip.2= KI - alapértelmezett hó, gyorsabb +of.options.BETTER_SNOW.tooltip.3= BE - jobb hó, lassabb +of.options.BETTER_SNOW.tooltip.4=Mutatja a havat az átlátszó blokkok alatt (kerítés, magas fú), +of.options.BETTER_SNOW.tooltip.5=amikor hóval van körülvéve. + +of.options.CUSTOM_FONTS=Egyéni Betűtípus +of.options.CUSTOM_FONTS.tooltip.1=Egyéni Betűtípus +of.options.CUSTOM_FONTS.tooltip.2= BE - egyéni betűtípust használ (alapértelmezett), lassabb +of.options.CUSTOM_FONTS.tooltip.3= KI - alapértelmezett betűtípust használ, gyorsabb +of.options.CUSTOM_FONTS.tooltip.4=Az egyéni betűtípust a jelenlegi forráscsomag +of.options.CUSTOM_FONTS.tooltip.5=biztosítja. + +of.options.CUSTOM_COLORS=Egyéni Színek +of.options.CUSTOM_COLORS.tooltip.1=Egyéni Színek +of.options.CUSTOM_COLORS.tooltip.2= BE - egyéni színeket használ (default), lassabb +of.options.CUSTOM_COLORS.tooltip.3= KI - alapértelmezett színeket használ, gyorsabb +of.options.CUSTOM_COLORS.tooltip.4=Az egyéni színeket a jelenlegi forráscsomag +of.options.CUSTOM_COLORS.tooltip.5=biztosítja. + +of.options.SWAMP_COLORS=Mocsár Színek +of.options.SWAMP_COLORS.tooltip.1=Mocsár Színek +of.options.SWAMP_COLORS.tooltip.2= BE - mocsárszíneket használ (alapértelmezett), lassabb +of.options.SWAMP_COLORS.tooltip.3= KI - nem használ mocsárszíneket, gyorsabb +of.options.SWAMP_COLORS.tooltip.4=A mocsár színek a füvet, leveleket, indákat és a vizet érintik. + +of.options.SMOOTH_BIOMES=Simított Biomok +of.options.SMOOTH_BIOMES.tooltip.1=Simított Biomok +of.options.SMOOTH_BIOMES.tooltip.2= BE - a biome szélek simítása (default), lassabb +of.options.SMOOTH_BIOMES.tooltip.3= KI - nincs simítás a biomok szélénél, gyorsabb +of.options.SMOOTH_BIOMES.tooltip.4=A simítás a biomok szélénél mintavétellel, és +of.options.SMOOTH_BIOMES.tooltip.5=a színek átlagosításával történik a környező blokkokon. +of.options.SMOOTH_BIOMES.tooltip.6=Érintettek: fű, levelek, indák és a víz. + +of.options.CONNECTED_TEXTURES=Csatlakozó Textúrák +of.options.CONNECTED_TEXTURES.tooltip.1=Csatlakozó Textúrák +of.options.CONNECTED_TEXTURES.tooltip.2= KI - nincsenek csatlakozó textúrák (alapértelmezett) +of.options.CONNECTED_TEXTURES.tooltip.3= Gyors - gyors csatlakozó textúrák +of.options.CONNECTED_TEXTURES.tooltip.4= Szép - szép csatlakozó textúrák +of.options.CONNECTED_TEXTURES.tooltip.5=A csatlakozó textúrák egybeköti az üveget, +of.options.CONNECTED_TEXTURES.tooltip.6=homokkövet és a könyvespolcokat, ha egymás mellet +of.options.CONNECTED_TEXTURES.tooltip.7=vannak. Acsatlakozó textúrákat a jelenlegi +of.options.CONNECTED_TEXTURES.tooltip.8=forráscsomag biztosítja. + +of.options.NATURAL_TEXTURES=Természetes Textúrák +of.options.NATURAL_TEXTURES.tooltip.1=Természetes Textúrák +of.options.NATURAL_TEXTURES.tooltip.2= KI - nincsenek természetes textúrák (alapértelmezett) +of.options.NATURAL_TEXTURES.tooltip.3= BE - természetes textúrákat használ +of.options.NATURAL_TEXTURES.tooltip.4=A természetes textúrák eltüntetik a rácsszerű mintázatot, +of.options.NATURAL_TEXTURES.tooltip.5=amit az azonos típusú irmétlődő blokkok okoznak. +of.options.NATURAL_TEXTURES.tooltip.6=A blokkok alaptextúráinak forgatott változatát +of.options.NATURAL_TEXTURES.tooltip.7=használja. A konfigurációját a természetes textúráknak +of.options.NATURAL_TEXTURES.tooltip.8=a jelenlegi forráscsomag biztosítja. + +of.options.CUSTOM_SKY=Egyéni Ég +of.options.CUSTOM_SKY.tooltip.1=Egyéni Ég +of.options.CUSTOM_SKY.tooltip.2= BE - egyéni ég textúrák (alapértelmezett), lassú +of.options.CUSTOM_SKY.tooltip.3= KI - alapértelmezett ég textúrák, gyorsabb +of.options.CUSTOM_SKY.tooltip.4=Az egyéni ég textúrákat a jelenlegi +of.options.CUSTOM_SKY.tooltip.5=erőforráscsomag biztosítja. + +of.options.CUSTOM_ITEMS=Egyéni Tárgyak +of.options.CUSTOM_ITEMS.tooltip.1=Egyéni Tárgyak +of.options.CUSTOM_ITEMS.tooltip.2= BE - egyéni tárgy textúrák (alapértelmezett), lassú +of.options.CUSTOM_ITEMS.tooltip.3= KI - alapértelmezett tárgy textúrák, gyorsabb +of.options.CUSTOM_ITEMS.tooltip.4=Az egyéni tárgy textúrákat a jelenlegi +of.options.CUSTOM_ITEMS.tooltip.5=erőforráscsomag biztosítja. + +# Details + +of.options.CLOUDS=Felhők +of.options.CLOUDS.tooltip.1=Felhők +of.options.CLOUDS.tooltip.2= Alapértelmezett - ahogy az be van állítva a Grafikában +of.options.CLOUDS.tooltip.3= Gyors - alacsonyabb minőség, gyorsabb +of.options.CLOUDS.tooltip.4= Szép - magasabb minőség, lassabb +of.options.CLOUDS.tooltip.5= KI - nincsenek felhők, leggyorsabb +of.options.CLOUDS.tooltip.6=A gyors felhők 2D-sek. +of.options.CLOUDS.tooltip.7=A szép felhők 3D-sek. + +of.options.CLOUD_HEIGHT=Felhőmagasság +of.options.CLOUD_HEIGHT.tooltip.1=Felhőmagasság +of.options.CLOUD_HEIGHT.tooltip.2= KI - alapértelmezett magasság +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - a limitált világmagasság felett van + +of.options.TREES=Fák +of.options.TREES.tooltip.1=Fák +of.options.TREES.tooltip.2= Alapértelmezett - ahogy az be van állítva a Grafikában +of.options.TREES.tooltip.3= Gyors - alacsonyabb minőség, gyorsabb +of.options.TREES.tooltip.4= Okos - magasabb minőség, gyors +of.options.TREES.tooltip.5= Szép - legmagasabb minőség, lassabb +of.options.TREES.tooltip.6=A gyors fáknak átlátszatlan levelei vannak. +of.options.TREES.tooltip.7=A szép és az okos fáknak átlátszó levelei vannak. + +of.options.RAIN=Eső & Hó +of.options.RAIN.tooltip.1=Eső & Hó +of.options.RAIN.tooltip.2= Alapértelmezett - ahogy az be van állítva a Grafikában +of.options.RAIN.tooltip.3= Gyors - ritka eső/hó, gyorsabb +of.options.RAIN.tooltip.4= Szép - sűrű eső/hó, lassabb +of.options.RAIN.tooltip.5= KI - nincs eső/hó, leggyorsabb +of.options.RAIN.tooltip.6=Amikor az eső ki van kapcsolva, atól még a fröccsenések +of.options.RAIN.tooltip.7=és a hangok aktívak. + +of.options.SKY=Ég +of.options.SKY.tooltip.1=Ég +of.options.SKY.tooltip.2= BE - az ég látszik, lassabb +of.options.SKY.tooltip.3= KI - az ég nem látszik, gyorsabb +of.options.SKY.tooltip.4=Ha az ég ki van kapcsolva, attól még a nap és a hold látszik. + +of.options.STARS=Csillagok +of.options.STARS.tooltip.1=Csillagok +of.options.STARS.tooltip.2= BE - a csillagok látszódnak, lassabb +of.options.STARS.tooltip.3= KI - a csillagok nem látszódnak, gyorsabb + +of.options.SUN_MOON=Nap & Hold +of.options.SUN_MOON.tooltip.1=Nap & Hold +of.options.SUN_MOON.tooltip.2= BE - a hold és a nap látszik (alapértelmezett) +of.options.SUN_MOON.tooltip.3= KI - a hold és a nap nem látszik (gyorsabb) + +of.options.SHOW_CAPES=Köpeny Mutatása +of.options.SHOW_CAPES.tooltip.1=Köpeny Mutatása +of.options.SHOW_CAPES.tooltip.2= BE - mutatja ajátékosok köpenyeit (alapértelmezett) +of.options.SHOW_CAPES.tooltip.3= KI - nem mutatja ajátékosok köpenyeit + +of.options.TRANSLUCENT_BLOCKS=Áttetsző Blokkok +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Áttetsző Blokkok +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Szép - korrekt színhajlítás (alapértelmezett) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Gyors - gyors színhajlítás (gyorsabb) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Irányitja a színhajlását az áttetsző blokkoknak +of.options.TRANSLUCENT_BLOCKS.tooltip.5=különböző színekkel (színezett üveg, víz, jég), +of.options.TRANSLUCENT_BLOCKS.tooltip.6=amikor egymás mögé helyezzük őket levegővel közöttük. + +of.options.HELD_ITEM_TOOLTIPS=Fogott Tárgytippek +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Fogott Tárgytippek +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= BE - tippet mutat a tartott tárgynál (alapértelmezett) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= KI - nem mutat tippet mutat a tartott tárgynál + +of.options.DROPPED_ITEMS=Eldobott Tárgyak +of.options.DROPPED_ITEMS.tooltip.1=Eldobott Tárgyak +of.options.DROPPED_ITEMS.tooltip.2= Alapértelmezett - ahogy az be van állítva a Grafikában +of.options.DROPPED_ITEMS.tooltip.3= Gyors - 2D-s eldobott tárgyak, gyorsabb +of.options.DROPPED_ITEMS.tooltip.4= Szép - 3D-s eldobott tárgyak, lassabb + +options.entityShadows.tooltip.1=Entitás Árnyékok +options.entityShadows.tooltip.2= BE - entitás árnyékok mutatása +options.entityShadows.tooltip.3= KI - entitás árnyékok nem mutatása + +of.options.VIGNETTE=Vignette +of.options.VIGNETTE.tooltip.1=Vizuális effekt, ami kissé elsötétíti a képernyő sarkait +of.options.VIGNETTE.tooltip.2= Alapértelmezett - ahogy az be van állítva a Grafikában (alapértelmezett) +of.options.VIGNETTE.tooltip.3= Fast - vignette kikapcsolva (gyorsabb) +of.options.VIGNETTE.tooltip.4= Fancy - vignette bekapcsolva (lassabb) +of.options.VIGNETTE.tooltip.5=A vignette-nek jelentős nyoma lehet az FPS-en, +of.options.VIGNETTE.tooltip.6=főleg teljes képernyős módon játszva. +of.options.VIGNETTE.tooltip.7=A vignette effekt teljesen apró, és nyugodtan +of.options.VIGNETTE.tooltip.8=kikapcsolható + +of.options.DYNAMIC_FOV=Dinamikus FOV +of.options.DYNAMIC_FOV.tooltip.1=Dinamikus FOV +of.options.DYNAMIC_FOV.tooltip.2= BE - bekapcsolja a dinamikus FOV-t (alapértelmezett) +of.options.DYNAMIC_FOV.tooltip.3= KI - kikapcsolja a dinamikus FOV-t +of.options.DYNAMIC_FOV.tooltip.4=Megváltoztatja a látómezőt (FOV) repülés, futás +of.options.DYNAMIC_FOV.tooltip.5=vagy íjászkodás közben. + +of.options.DYNAMIC_LIGHTS=Dinamikus Fények +of.options.DYNAMIC_LIGHTS.tooltip.1=Dinamikus Fények +of.options.DYNAMIC_LIGHTS.tooltip.2= KI - nincs dinamikus fény (alapértelmezett) +of.options.DYNAMIC_LIGHTS.tooltip.3= Gyors - gyors dinamikus fény (frissítve minden 500ms-ként) +of.options.DYNAMIC_LIGHTS.tooltip.4= Szép - szép dinamikus fény (valós időben frissítve) +of.options.DYNAMIC_LIGHTS.tooltip.5=Engedélyezi a fénykibocsájtó tárgyaknak (fáklya, izzókő, stb.), +of.options.DYNAMIC_LIGHTS.tooltip.6=hogy fényt bocsássanak ki, mikor kézben cipelik, +of.options.DYNAMIC_LIGHTS.tooltip.7=másik karakter használja, vagy a füldre van dobva. + +# Performance + +of.options.SMOOTH_FPS=Sima FPS +of.options.SMOOTH_FPS.tooltip.1=Stabilizálja az FPS-t a grafikus beghajtő buffereinek öblítésével. +of.options.SMOOTH_FPS.tooltip.2= KI - nincs stabilizálás, FPS inoghat +of.options.SMOOTH_FPS.tooltip.3= BE - FPS stabilizáció +of.options.SMOOTH_FPS.tooltip.4=Ez a beállítás grafikus meghajtó függő, és a hatása +of.options.SMOOTH_FPS.tooltip.5=nem mindíg látható. + +of.options.SMOOTH_WORLD=Sima Világ +of.options.SMOOTH_WORLD.tooltip.1=Eltávolítja a "lagtüskéket", amit a helyi szerver okoz. +of.options.SMOOTH_WORLD.tooltip.2= OFF - nincs stabilizáció, FPS inoghat +of.options.SMOOTH_WORLD.tooltip.3= ON - FPS stabilizáció +of.options.SMOOTH_WORLD.tooltip.4=Stabilizálja az FPS-t, amit a helyi szerver okoz. +of.options.SMOOTH_WORLD.tooltip.5=Csak helyi világokban effektív (egyjátékos mód). + +of.options.FAST_RENDER=Gyors Renderelés +of.options.FAST_RENDER.tooltip.1=Gyors Renderelés +of.options.FAST_RENDER.tooltip.2= KI - alap renderelés (alapértelmezett) +of.options.FAST_RENDER.tooltip.3= BE - optimalizált renderelés (gyorsabb) +of.options.FAST_RENDER.tooltip.4=Optimalizált renderelési algoritmust használ, ami csökkenti +of.options.FAST_RENDER.tooltip.5=a GPU töltési időt, és lényegesen növelheti az FPS-t. + +of.options.FAST_MATH=Gyors Matek +of.options.FAST_MATH.tooltip.1=Gyors Matek +of.options.FAST_MATH.tooltip.2= KI - alap matek (alapértelmezett) +of.options.FAST_MATH.tooltip.3= BE - gyorsabb matek +of.options.FAST_MATH.tooltip.4=Optimalizált sin() és cos() függvényeket használ, ami jobban +of.options.FAST_MATH.tooltip.5=hasznosítja a CPU gyorsítótárat, és növelheti az FPS-t. + +of.options.CHUNK_UPDATES=Terület Frissítések +of.options.CHUNK_UPDATES.tooltip.1=Terület Frissítések +of.options.CHUNK_UPDATES.tooltip.2= 1 - lassabb világbetöltés, magasabb FPS (alapértelmezett) +of.options.CHUNK_UPDATES.tooltip.3= 3 - gyorsabb világbetöltés, alacsonyabb FPS +of.options.CHUNK_UPDATES.tooltip.4= 5 - leggyorsabb világbetöltés, legalacsonyabb FPS +of.options.CHUNK_UPDATES.tooltip.5=Terület frissítések száma lerenderelt képkockánként; +of.options.CHUNK_UPDATES.tooltip.6=magasabb értékek instabilizálhatja az FPS-t. + +of.options.CHUNK_UPDATES_DYNAMIC=Dinamikus Frissítések +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Dinamikus terület frissítések +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= KI - (alapértelmezett) alap területfrissítések képkockánként +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= BE - több frissítés, amíg a játékos egy helyben áll +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=A Dinamikus Frissítések több területfrissítést eröltet, amíg +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=a játékos egy helyben áll, hogy a világ gyorsabban betöltsön. + +of.options.LAZY_CHUNK_LOADING="Lusta Területek" Betöltése +of.options.LAZY_CHUNK_LOADING.tooltip.1="Lusta Területek" betöltése +of.options.LAZY_CHUNK_LOADING.tooltip.2= KI - alapértelmezett szerver terület betöltés +of.options.LAZY_CHUNK_LOADING.tooltip.3= BE - "lusta" szerver terület betöltés (simább) +of.options.LAZY_CHUNK_LOADING.tooltip.4=Simítja az inegrált szerver területbetöltését +of.options.LAZY_CHUNK_LOADING.tooltip.5=a területek idönközötti "kattogásának" lekötésével. +of.options.LAZY_CHUNK_LOADING.tooltip.6=Kapcsold ki, ha a világ bizonyos részei nem töltenek be megfelelően. +of.options.LAZY_CHUNK_LOADING.tooltip.7=Csak helyi világokban és egymagos CPU esetén effektív. + +# Animations + +of.options.animation.allOn=Mind BE +of.options.animation.allOff=Mind KI +of.options.animation.dynamic=Dinamikus + +of.options.ANIMATED_WATER=Animált Víz +of.options.ANIMATED_LAVA=Animált Láva +of.options.ANIMATED_FIRE=Animált Tűz +of.options.ANIMATED_PORTAL=Animált Portál +of.options.ANIMATED_REDSTONE=Animált Vöröskő +of.options.ANIMATED_EXPLOSION=Animált Robbanás +of.options.ANIMATED_FLAME=Animált Lángok +of.options.ANIMATED_SMOKE=Animált Füst +of.options.VOID_PARTICLES=Űr Részecskék +of.options.WATER_PARTICLES=Víz Részecskék +of.options.RAIN_SPLASH=Eső Felcsapódás +of.options.PORTAL_PARTICLES=Portál Részecskék +of.options.POTION_PARTICLES=Bájital Részecskék +of.options.DRIPPING_WATER_LAVA=Kicsapó Víz/Láva +of.options.ANIMATED_TERRAIN=Animált Terep +of.options.ANIMATED_TEXTURES=Animált Textúrák +of.options.FIREWORK_PARTICLES=Tüzijáték Részecskék + +# Other + +of.options.LAGOMETER=Lagmérő +of.options.LAGOMETER.tooltip.1=Mutatja a lagmérőt a hibakereső képernyőn (F3). +of.options.LAGOMETER.tooltip.2=* Orange - Memóriaszemét gyűjtemény +of.options.LAGOMETER.tooltip.3=* Cyan - "kegyegés" +of.options.LAGOMETER.tooltip.4=* Blue - Ütemezett végrehajthatók +of.options.LAGOMETER.tooltip.5=* Purple - Területfeltöltés +of.options.LAGOMETER.tooltip.6=* Red - Terület frissítés +of.options.LAGOMETER.tooltip.7=* Yellow - Láthatóságfigyelő +of.options.LAGOMETER.tooltip.8=* Green - Terep renderelése + +of.options.PROFILER=Hibakereső Profil +of.options.PROFILER.tooltip.1=Hibakereső Profil +of.options.PROFILER.tooltip.2= BE - hibakereső profil aktív, lassabb +of.options.PROFILER.tooltip.3= KI - hibakereső profil nem aktív, gyorsabb +of.options.PROFILER.tooltip.4=A hibakereső profil hibakereső információkat gyűjt, és mutat, +of.options.PROFILER.tooltip.5=amikor a hibakereső képernyő aktív (F3) + +of.options.WEATHER=Időjárás +of.options.WEATHER.tooltip.1=Időjárás +of.options.WEATHER.tooltip.2= BE - az időjárás aktív, lassabb +of.options.WEATHER.tooltip.3= KI - az időjárás nem aktív, gyorsabb +of.options.WEATHER.tooltip.4=Az időjárás irányítja az esőket, havazásokat, és a viharokat. +of.options.WEATHER.tooltip.5=Az időjárás irányítása csak helyi világokban lehetséges. + +of.options.time.dayOnly=Csak Nappal +of.options.time.nightOnly=Csak Éjszaka + +of.options.TIME=Idő +of.options.TIME.tooltip.1=Idő +of.options.TIME.tooltip.2= Alapértelmezett - normális éjjel-nappal körforgás +of.options.TIME.tooltip.3= Csak Nappal - csak nappal +of.options.TIME.tooltip.4= Csak Éjszaka - csak éjszaka +of.options.TIME.tooltip.5=Az Idő beállítás csak KREATÍV módban, +of.options.TIME.tooltip.6=és helyi világokban effektív. + +options.fullscreen.tooltip.1=Teljes Képernyő +options.fullscreen.tooltip.2= BE - teljes képernyős mód használata +options.fullscreen.tooltip.3= KI - ablakos mód használata +options.fullscreen.tooltip.4=A teljes képergyős mód gyorsabb, vagy lassabb lehet, mint +options.fullscreen.tooltip.5=az ablakos mód a videókártyától függően. + +of.options.FULLSCREEN_MODE=Teljes Képernyős Mód +of.options.FULLSCREEN_MODE.tooltip.1=Teljes Képernyős mód +of.options.FULLSCREEN_MODE.tooltip.2= Alapértelmezett - asztal méretének használata, lassabb +of.options.FULLSCREEN_MODE.tooltip.3= WxH - egyéni felbontás használata, lehet gyorsabb +of.options.FULLSCREEN_MODE.tooltip.4=A kiválasztott felbontás a teljes képernyős módban használatos (F11). +of.options.FULLSCREEN_MODE.tooltip.5=Kisebb felbontások általában gyorsabbak. + +of.options.SHOW_FPS=FPS Mutatása +of.options.SHOW_FPS.tooltip.1=Mutatja a jelenlegi FPS számot, és renderelési információkat +of.options.SHOW_FPS.tooltip.2= C: - területek renderelése +of.options.SHOW_FPS.tooltip.3= E: - lerenderelt entitások + blokk entitások +of.options.SHOW_FPS.tooltip.4= U: - terület frissítések +of.options.SHOW_FPS.tooltip.5=A jeéenlegi FPS információ csak akkor mutatkozik, ha a +of.options.SHOW_FPS.tooltip.6=a hibakeresési képernyő nem látszik. + +of.options.save.default=Alapértelmezett (2mp) +of.options.save.20s=20mp +of.options.save.3min=3p +of.options.save.30min=30p + +of.options.AUTOSAVE_TICKS=Auto mentés +of.options.AUTOSAVE_TICKS.tooltip.1=Az auto mentés intervalluma +of.options.AUTOSAVE_TICKS.tooltip.2=Az alapértelmezett auto mentés intervallum (2mp) NEM JAVASOLT. +of.options.AUTOSAVE_TICKS.tooltip.3=Az auto mentés okozza a híres "Halál lagtüskéjét" famous Lag Spike of Death. + +options.anaglyph.tooltip.1=A 3D mód piros-cián szemüveggel használatos. diff --git a/src/minecraft/assets/minecraft/optifine/lang/ja_JP.lang b/src/minecraft/assets/minecraft/optifine/lang/ja_JP.lang new file mode 100644 index 0000000..ae1bba5 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/ja_JP.lang @@ -0,0 +1,591 @@ +# Contributors of Japanese localization # +# takanasayo 2012-12-01 ---- 2013-07-15 +# CrafterKina 2014-01-04 ---- 2017-01-28 + +# General +of.general.ambiguous=不明確 +of.general.custom=カスタム +of.general.from=から +of.general.id=ID +of.general.restart=再起動 +of.general.smart=スマート + +# Keys +of.key.zoom=ズーム + +# Message +of.message.aa.shaders1=アンチエイリアスはシェーダーと共存できません。 +of.message.aa.shaders2=このオプションを有効にするには、シェーダを無効にしてください。 + +of.message.af.shaders1=異方性フィルタリングはシェーダーと共存できません。 +of.message.af.shaders2=このオプションを有効にするには、シェーダを無効にしてください。 + +of.message.fr.shaders1=描画の最適化はシェーダーと共存できません。 +of.message.fr.shaders1=このオプションを有効にするには、シェーダを無効にしてください。 + +of.message.an.shaders1=3Dアナグリフはシェーダーと共存できません。 +of.message.an.shaders2=このオプションを有効にするには、シェーダを無効にしてください。 + +of.message.shaders.aa1=シェーダーはアンチエイリアスと共存できません。 +of.message.shaders.aa2=品質の設定 → アンチエイリアス をオフにし、ゲームを再起動してください。 + +of.message.shaders.af1=シェーダーは異方性フィルタリングと共存できません。 +of.message.shaders.af2=品質の設定 → 異方性フィルタリング をオフにしてください。 + +of.message.shaders.fr1=シェーダーは描画の最適化と共存できません。 +of.message.shaders.fr2=演出の設定 → 描画の最適化 をオフにしてください。 + +of.message.shaders.an1=シェーダーは3Dアナグリフと共存できません。 +of.message.shaders.an2=その他の設定 → 3Dアナグリフ をオフにしてください。 + +of.message.newVersion=新しい§eOptiFine§fが公開されました:§e%s§f +of.message.java64Bit=パフォーマンスを高めるために§e64-bit Java§fが利用できます。 +of.message.openglError=§eOpenGLエラー§f:%s(%s) + +of.message.shaders.loading=シェーダーをロード中:%s + +of.message.other.reset=全ての設定を元の状態に戻してもよろしいですか? + +of.message.loadingVisibleChunks=可視チャンクを読み込み中 + +# Video settings + +options.graphics.tooltip.1=グラフィックス +options.graphics.tooltip.2= 処理優先 - 低品質、 低負荷 +options.graphics.tooltip.3= 描画優先 - 高品質、 高負荷 +options.graphics.tooltip.4=葉の透過、アイテムやMobの影、ドロップアイテムの3D描写、 +options.graphics.tooltip.5=厚みのある雲、水の2パスレンダリング、といったグラフィック効果を変更します。 + +of.options.renderDistance.tiny=最短 +of.options.renderDistance.short=短い +of.options.renderDistance.normal=普通 +of.options.renderDistance.far=遠い +of.options.renderDistance.extreme=最遠 + +options.renderDistance.tooltip.1=描画距離 +options.renderDistance.tooltip.2= 2 最短 - 32m(より低負荷) +options.renderDistance.tooltip.3= 4 短い - 64m(低負荷) +options.renderDistance.tooltip.4= 8 普通 - 128m +options.renderDistance.tooltip.5= 16 遠い - 256m(高負荷) +options.renderDistance.tooltip.6= 32 最遠 - 512m(超高負荷!) +options.renderDistance.tooltip.7=最遠設定は非常に高いグラフィックス性能を要求します! +options.renderDistance.tooltip.8=遠いを超える描画距離はシングルのワールドでのみ効果があります。 + +options.ao.tooltip.1=スムースライティング +options.ao.tooltip.2= オフ - スムースライティングを使用しない(低負荷) +options.ao.tooltip.3= 最小 - 単純なスムースライティング(高負荷) +options.ao.tooltip.4= 最大 - 複雑なスムースライティング(最高負荷) + +options.framerateLimit.tooltip.1=最大のフレームレート +options.framerateLimit.tooltip.2= 垂直同期 - モニターのフレームレートに合わせる(60, 30, 20) +options.framerateLimit.tooltip.3= 5~255 - フレームレートを設定した値までに制限する +options.framerateLimit.tooltip.4= 無制限 - フレームレートを制限しない(最低負荷) +options.framerateLimit.tooltip.5=たとえ制限に達していなくとも、 +options.framerateLimit.tooltip.6=フレームレートを抑制します。 +of.options.framerateLimit.vsync=垂直同期 + +of.options.AO_LEVEL=スムースライティングの程度 +of.options.AO_LEVEL.tooltip.1=スムースライティングの程度 +of.options.AO_LEVEL.tooltip.2= オフ - 影なし +of.options.AO_LEVEL.tooltip.3= 50%% - 明るい影 +of.options.AO_LEVEL.tooltip.4= 100%% - 暗い影 + +options.viewBobbing.tooltip.1=より現実的な動き +options.viewBobbing.tooltip.2=ミップマップをオフにした時に最もよい結果が出ます。 + +options.guiScale.tooltip.1=GUIの大きさ +options.guiScale.tooltip.2= 自動 - 最大サイズ +options.guiScale.tooltip.3= 小さい,普通,大きい - 一倍から三倍 +options.guiScale.tooltip.4= 4x から 10x - 4k画面で有効 +options.guiScale.tooltip.5=奇数倍 (1x, 3x, 5x ...) はUnicodeと互換がありません。 +options.guiScale.tooltip.6=GUIは小さいほうが処理が速くなるかもしれません。 + +options.vbo.tooltip.1=頂点バッファオブジェクト +options.vbo.tooltip.2=描画方式を新しいものに変更し、 +options.vbo.tooltip.3=5~10%%処理を軽くできます。 + +options.gamma.tooltip.1=暗い物体の明るさの変更 +options.gamma.tooltip.2= 暗い - 通常の明るさ +options.gamma.tooltip.3= 1~99%% - 明るさを調整する +options.gamma.tooltip.4= 明るい - 最大の明るさ +options.gamma.tooltip.5=完全に真っ暗な物体の明るさは、 +options.gamma.tooltip.6=変更できません。 + +options.anaglyph.tooltip.1=3Dアナグリフ +options.anaglyph.tooltip.2=それぞれの目に別々の色を使うことで +options.anaglyph.tooltip.3=立体視を可能にする機能を有効にします。 +options.anaglyph.tooltip.4=赤青3Dメガネが必要です。 + +options.blockAlternatives.tooltip.1=代替ブロック +options.blockAlternatives.tooltip.2=幾つかのブロックで代替モデルを使用します。 +options.blockAlternatives.tooltip.3=選択されたリソースパックに依存します。 + +of.options.ALTERNATE_BLOCKS=代替ブロック +of.options.ALTERNATE_BLOCKS.tooltip.1=代替ブロックの設定 +of.options.ALTERNATE_BLOCKS.tooltip.2=幾つかのブロックで代替モデルを使用します。 +of.options.ALTERNATE_BLOCKS.tooltip.3=選択されたリソースパックに依存します。 + +of.options.FOG_FANCY=霧の種類 +of.options.FOG_FANCY.tooltip.1=霧の種類の設定 +of.options.FOG_FANCY.tooltip.2= 処理優先 - 低負荷な霧 +of.options.FOG_FANCY.tooltip.3= 描画優先 - 高負荷な霧 より良く見える +of.options.FOG_FANCY.tooltip.4= オフ - 霧なし 最低負荷 +of.options.FOG_FANCY.tooltip.5=グラフィックカードが対応している場合のみ +of.options.FOG_FANCY.tooltip.6=美麗な霧を使用できます。 + +of.options.FOG_START=霧の距離 +of.options.FOG_START.tooltip.1=プレイヤーと霧の距離の設定 +of.options.FOG_START.tooltip.2= 0.2 - プレイヤーと霧の距離を最も近くする +of.options.FOG_START.tooltip.3= 0.8 - プレイヤーと霧の距離を最も遠くする +of.options.FOG_START.tooltip.4=この設定は大抵の場合パフォーマンスに影響を与えません。 + +of.options.CHUNK_LOADING=チャンク読込方法 +of.options.CHUNK_LOADING.tooltip.1=チャンクの読み込み方法 +of.options.CHUNK_LOADING.tooltip.2= デフォルト - チャンクロード時、FPSは安定しない。 +of.options.CHUNK_LOADING.tooltip.3= 滑らか - フレームレート低下を抑制。 +of.options.CHUNK_LOADING.tooltip.4= マルチコア - フレームレートのさらなる安定化 ワールドのロード処理が三倍ほど速くなる。 +of.options.CHUNK_LOADING.tooltip.5=滑らかやマルチコアであれば、チャンクロードに起因する +of.options.CHUNK_LOADING.tooltip.6=カクつきとフリーズを除けます。 +of.options.CHUNK_LOADING.tooltip.7=マルチコアでは二番目のCPUを用いることでワールドのロード処理が +of.options.CHUNK_LOADING.tooltip.8=三倍ほど速くでき、FPSも改善できます。 +of.options.chunkLoading.smooth=滑らか +of.options.chunkLoading.multiCore=マルチコア + +of.options.shaders=シェーダーの詳細設定... +of.options.shadersTitle=シェーダーの詳細設定 + +of.options.shaders.packNone=なし +of.options.shaders.packDefault=(内部シェーダー) + +of.options.shaders.ANTIALIASING=アンチエイリアス処理 +of.options.shaders.NORMAL_MAP=法線マッピング +of.options.shaders.SPECULAR_MAP=鏡面反射マッピング +of.options.shaders.RENDER_RES_MUL=描画の品質 +of.options.shaders.SHADOW_RES_MUL=陰影の品質 +of.options.shaders.HAND_DEPTH_MUL=手部被写界深度 +of.options.shaders.CLOUD_SHADOW=雲の影 +of.options.shaders.OLD_HAND_LIGHT=古い手持ち光源 +of.options.shaders.OLD_LIGHTING=古いライティング +of.options.shaders.SHADER_PACK=シェーダーパック + +of.options.shaders.shadersFolder=シェーダーのフォルダー +of.options.shaders.shaderOptions=シェーダーのオプション設定... + +of.options.shaderOptionsTitle=シェーダーのオプション設定 + +of.options.quality=品質の設定... +of.options.qualityTitle=品質 + +of.options.details=細部の設定... +of.options.detailsTitle=細部 + +of.options.performance=演出の設定... +of.options.performanceTitle=演出 + +of.options.animations=アニメーションの設定... +of.options.animationsTitle=アニメーション + +of.options.other=その他の設定... +of.options.otherTitle=その他 + +of.options.other.reset=ビデオ設定を初期化する... + +of.shaders.profile=プロファイル + +# Quality + +of.options.mipmap.bilinear=バイリニア補間 +of.options.mipmap.linear=線形補間 +of.options.mipmap.nearest=ニアレストネイバー補間 +of.options.mipmap.trilinear=トライリニア補間 + +options.mipmapLevels.tooltip.1=遠くの物体における視覚効果を +options.mipmapLevels.tooltip.2=テクスチャのスムージングによって改善します。 +options.mipmapLevels.tooltip.3= オフ - スムージングを行わない +options.mipmapLevels.tooltip.4= 1 - 最小限のスムージング +options.mipmapLevels.tooltip.5= 4 - 最大限のスムージング +options.mipmapLevels.tooltip.6=この設定は大抵の場合パフォーマンスに影響を与えません。 + +of.options.MIPMAP_TYPE=ミップマップの種類 +of.options.MIPMAP_TYPE.tooltip.1=遠くの物体における視覚効果を +of.options.MIPMAP_TYPE.tooltip.2=テクスチャのスムージングによって改善します。 +of.options.MIPMAP_TYPE.tooltip.3= ニアレストネイバー補間 - おおまかなスムージング(低負荷) +of.options.MIPMAP_TYPE.tooltip.4= 線形補間 - 通常のスムージング +of.options.MIPMAP_TYPE.tooltip.5= バイリニア補間 - 繊細なスムージング +of.options.MIPMAP_TYPE.tooltip.6= トライリニア補間 - 最高級のスムージング(高負荷) + +of.options.AA_LEVEL=アンチエイリアス +of.options.AA_LEVEL.tooltip.1=アンチエイリアス +of.options.AA_LEVEL.tooltip.2= オフ - (通常) 輪郭のギザギザ軽減を行わない(低負荷) +of.options.AA_LEVEL.tooltip.3= 2~16 - 輪郭のギザギザ軽減を行う(高負荷) +of.options.AA_LEVEL.tooltip.4=輪郭のギザギザやシャープな色の変化に +of.options.AA_LEVEL.tooltip.5=アンチエイリアスを行います。 +of.options.AA_LEVEL.tooltip.6=有効化すると実質的なFPSは下がります。 +of.options.AA_LEVEL.tooltip.7=すべてのレベルがすべてのグラフィックカードでサポートされているわけではありません。 +of.options.AA_LEVEL.tooltip.8=再起動後に有効化されます! + +of.options.AF_LEVEL=異方性フィルタリング +of.options.AF_LEVEL.tooltip.1=異方性フィルタリング +of.options.AF_LEVEL.tooltip.2= オフ - 通常のテクスチャ描画(低負荷) +of.options.AF_LEVEL.tooltip.3= 2~16 - 滑らかなテクスチャ描画(高負荷) +of.options.AF_LEVEL.tooltip.4=ミップマップされたテクスチャにおいて、 +of.options.AF_LEVEL.tooltip.5=ちらつきを抑えます。 +of.options.AF_LEVEL.tooltip.6=有効化すると実質的にFPSは下がります。 + +of.options.CLEAR_WATER=水の透過 +of.options.CLEAR_WATER.tooltip.1=水の透過 +of.options.CLEAR_WATER.tooltip.2= オン - すっきりとした透明な水 +of.options.CLEAR_WATER.tooltip.3= オフ - 普通の水 + +of.options.RANDOM_MOBS=Random Mobs +of.options.RANDOM_MOBS.tooltip.1=Random Mobs +of.options.RANDOM_MOBS.tooltip.2= オフ - Mobにランダムなテクスチャを適応しない 低負荷 +of.options.RANDOM_MOBS.tooltip.3= オン - Mobにランダムなテクスチャを適応する 高負荷 +of.options.RANDOM_MOBS.tooltip.4=Random mobsはランダムなテクスチャを生物に適用します。 +of.options.RANDOM_MOBS.tooltip.5=複数のMobテクスチャを含むリソースパックが必要です。 + +of.options.BETTER_GRASS=より良い芝生 +of.options.BETTER_GRASS.tooltip.1=より良い芝生 +of.options.BETTER_GRASS.tooltip.2= オフ - 通常の側面のテクスチャを使用する 低負荷 +of.options.BETTER_GRASS.tooltip.3= 処理優先 - 側面も草で覆う 高負荷 +of.options.BETTER_GRASS.tooltip.4= 描画優先 - 草ブロックと繋がるように側面を草で覆う 最高負荷 + +of.options.BETTER_SNOW=より良い雪 +of.options.BETTER_SNOW.tooltip.1=より良い雪 +of.options.BETTER_SNOW.tooltip.2= オフ - 通常の雪 低負荷 +of.options.BETTER_SNOW.tooltip.3= オン - より良い雪 高負荷 +of.options.BETTER_SNOW.tooltip.4=隣接したブロックに雪が積もっているものがあった時に +of.options.BETTER_SNOW.tooltip.5=透過性のあるブロック(フェンス, 背の高い草)の下でも雪を描画します。 + +of.options.CUSTOM_FONTS=カスタムフォント +of.options.CUSTOM_FONTS.tooltip.1=カスタムフォント +of.options.CUSTOM_FONTS.tooltip.2= オン - カスタムフォントを使う(通常) 高負荷 +of.options.CUSTOM_FONTS.tooltip.3= オフ - デフォルトのフォントを使う 低負荷 +of.options.CUSTOM_FONTS.tooltip.4=カスタムフォントは現在使用中の +of.options.CUSTOM_FONTS.tooltip.5=リソースパックに依存します。 + +of.options.CUSTOM_COLORS=カスタムカラー +of.options.CUSTOM_COLORS.tooltip.1=カスタムカラー +of.options.CUSTOM_COLORS.tooltip.2= オン - カスタムカラーを使う(通常) 高負荷 +of.options.CUSTOM_COLORS.tooltip.3= オフ - デフォルトの色を使う 低負荷 +of.options.CUSTOM_COLORS.tooltip.4=カスタムカラーは現在使用中の +of.options.CUSTOM_COLORS.tooltip.5=リソースパックに依存します。 + +of.options.SWAMP_COLORS=湿地帯色 +of.options.SWAMP_COLORS.tooltip.1=湿地帯色 +of.options.SWAMP_COLORS.tooltip.2= オン - 湿地帯色を使う 高負荷 +of.options.SWAMP_COLORS.tooltip.3= オフ - 湿地帯色を使わない 低負荷 +of.options.SWAMP_COLORS.tooltip.4=湿地帯色は草,葉,蔦,水に影響を与えます。 + +of.options.SMOOTH_BIOMES=バイオームを滑らかに表示 +of.options.SMOOTH_BIOMES.tooltip.1=バイオームを滑らかに表示 +of.options.SMOOTH_BIOMES.tooltip.2= オン - バイオームの境界を滑らかにする(通常) 高負荷 +of.options.SMOOTH_BIOMES.tooltip.3= オフ - バイオームの境界を滑らかにしない 低負荷 +of.options.SMOOTH_BIOMES.tooltip.4=周囲の色の平均をとって +of.options.SMOOTH_BIOMES.tooltip.5=バイオーム間の境界を滑らかにします。 +of.options.SMOOTH_BIOMES.tooltip.6=草,葉,蔦,水に影響を与えます。 + +of.options.CONNECTED_TEXTURES=継ぎ目ないテクスチャ +of.options.CONNECTED_TEXTURES.tooltip.1=継ぎ目ないテクスチャ +of.options.CONNECTED_TEXTURES.tooltip.2= オフ - テクスチャの継ぎ目をなくさない(通常) +of.options.CONNECTED_TEXTURES.tooltip.3= 処理優先 - 処理優先でテクスチャの継ぎ目をなくす +of.options.CONNECTED_TEXTURES.tooltip.4= 描画優先 - 描画優先でテクスチャの継ぎ目をなくす +of.options.CONNECTED_TEXTURES.tooltip.5=草、砂岩、本棚で隣り合ったものを +of.options.CONNECTED_TEXTURES.tooltip.6=つなぎあわせて表示します。 +of.options.CONNECTED_TEXTURES.tooltip.7=つながった状態のテクスチャは現在使用中の +of.options.CONNECTED_TEXTURES.tooltip.8=リソースパックに依存します。 + +of.options.NATURAL_TEXTURES=自然なテクスチャ +of.options.NATURAL_TEXTURES.tooltip.1=自然なテクスチャ +of.options.NATURAL_TEXTURES.tooltip.2= オフ - 自然なテクスチャを使用しない(通常) +of.options.NATURAL_TEXTURES.tooltip.3= オン - 自然なテクスチャを使用する +of.options.NATURAL_TEXTURES.tooltip.4=ブロックのテクスチャが同じ形を繰り返し、 +of.options.NATURAL_TEXTURES.tooltip.5=格子状の模様が形成される現象を除去します。 +of.options.NATURAL_TEXTURES.tooltip.6=基となるブロックのテクスチャを回転したり裏返したり +of.options.NATURAL_TEXTURES.tooltip.7=するのに用いられます。自然なテクスチャの設定は +of.options.NATURAL_TEXTURES.tooltip.8=現在使用中のリソースパックに依存します。 + +of.options.CUSTOM_SKY=カスタムスカイ +of.options.CUSTOM_SKY.tooltip.1=カスタムスカイ +of.options.CUSTOM_SKY.tooltip.2= オン - カスタムスカイを使用する(通常) 高負荷 +of.options.CUSTOM_SKY.tooltip.3= オフ - 通常の空 低負荷 +of.options.CUSTOM_SKY.tooltip.4=カスタムスカイ用のテクスチャは現在使用中の +of.options.CUSTOM_SKY.tooltip.5=リソースパックに依存します。 + +of.options.CUSTOM_ITEMS=カスタムアイテム +of.options.CUSTOM_ITEMS.tooltip.1=カスタムアイテム +of.options.CUSTOM_ITEMS.tooltip.2= オン - カスタムアイテムを使用する(通常) 高負荷 +of.options.CUSTOM_ITEMS.tooltip.3= オフ - 通常のアイテムテクスチャを使用する 低負荷 +of.options.CUSTOM_ITEMS.tooltip.4=カスタムアイテム用のテクスチャは現在使用中の +of.options.CUSTOM_ITEMS.tooltip.5=リソースパックに依存します。 + +of.options.CUSTOM_ENTITY_MODELS=カスタムエンティティモデル +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=カスタムエンティティモデル +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= オン - カスタムエンティティモデルを使用する(通常), 高負荷 +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= オフ - 通常のエンティティモデル, 低負荷 +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=カスタムエンティティモデルは現在使用中の +of.options.CUSTOM_ENTITY_MODELS.tooltip.5=リソースパックに依存します。 + +# Details + +of.options.CLOUDS=雲 +of.options.CLOUDS.tooltip.1=雲 +of.options.CLOUDS.tooltip.2= デフォルト - グラフィックスの設定に合わせる +of.options.CLOUDS.tooltip.3= 処理優先 - 低品質 低負荷 +of.options.CLOUDS.tooltip.4= 描画優先 - 高品質 高負荷 +of.options.CLOUDS.tooltip.5= オフ - 雲なし 最低負荷 +of.options.CLOUDS.tooltip.6=処理優先の雲は平面的に描画されます。 +of.options.CLOUDS.tooltip.7=描画優先の雲は立体的に描画されます。 + +of.options.CLOUD_HEIGHT=雲の高さ +of.options.CLOUD_HEIGHT.tooltip.1=雲の高さの設定 +of.options.CLOUD_HEIGHT.tooltip.2= オフ - 通常の高さ +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - ワールドの高さ上限 + +of.options.TREES=樹 +of.options.TREES.tooltip.1=樹 +of.options.TREES.tooltip.2= デフォルト - グラフィックスの設定に合わせる +of.options.TREES.tooltip.3= 処理優先 - 低品質 最低負荷 +of.options.TREES.tooltip.4= スマート - 高品質 低負荷 +of.options.TREES.tooltip.5= 描画優先 - 高品質 高負荷 +of.options.TREES.tooltip.6=処理優先の木の葉は透過しません。 +of.options.TREES.tooltip.7=描画優先や賢く描画された木の葉は透過します。 + +of.options.RAIN=雨と雪 +of.options.RAIN.tooltip.1=雨と雪 +of.options.RAIN.tooltip.2= デフォルト - グラフィックスの設定に合わせる +of.options.RAIN.tooltip.3= 処理優先 - 小雨/小雪 低負荷 +of.options.RAIN.tooltip.4= 描画優先 - 大雨/大雪 高負荷 +of.options.RAIN.tooltip.5= オフ - 雨や雪を描画しない 最低負荷 +of.options.RAIN.tooltip.6=オフにしても地面での雨の飛び散りや雨音 +of.options.RAIN.tooltip.7=は有効のままです。 + +of.options.SKY=空 +of.options.SKY.tooltip.1=空 +of.options.SKY.tooltip.2= オン - 空を描画する 高負荷 +of.options.SKY.tooltip.3= オフ - 空を描画しない 低負荷 +of.options.SKY.tooltip.4=オフにしても太陽や月はそのままです。 + +of.options.STARS=星 +of.options.STARS.tooltip.1=星 +of.options.STARS.tooltip.2= オン - 星を描画する(通常) +of.options.STARS.tooltip.3= オフ - 星を描画しない(低負荷) +of.options.SUN_MOON=太陽と月 +of.options.SUN_MOON.tooltip.1=太陽と月 +of.options.SUN_MOON.tooltip.2= オン - 太陽と月を描画する(通常) +of.options.SUN_MOON.tooltip.3= オフ - 太陽と月を描画しない(低負荷) +of.options.SHOW_CAPES=Optifineマントの表示 +of.options.SHOW_CAPES.tooltip.1=Optifineマントの表示 +of.options.SHOW_CAPES.tooltip.2= オン - Optifineマントを表示する(通常) +of.options.SHOW_CAPES.tooltip.3= オフ - Optifineマントを表示しない + +of.options.TRANSLUCENT_BLOCKS=半透明のブロック +of.options.TRANSLUCENT_BLOCKS.tooltip.1=半透明のブロック +of.options.TRANSLUCENT_BLOCKS.tooltip.2= 描画優先 - 完全なカラーブレンド(通常) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= 処理優先 - 速さ重視のカラーブレンド(低負荷) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=違う色を持った半透明ブロック(色付きガラス,水,氷) +of.options.TRANSLUCENT_BLOCKS.tooltip.5=が空気を挟んで隣接した際の +of.options.TRANSLUCENT_BLOCKS.tooltip.6=カラーブレンドの設定です。 + +of.options.HELD_ITEM_TOOLTIPS=持ち替え時アイテム名表示 +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=持ち替え時アイテム名表示 +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= オン - 持ち替え時にアイテム名を表示する(通常) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= オフ - 持ち替え時にアイテム名を表示しない + +of.options.ADVANCED_TOOLTIPS=高度なツールチップ +of.options.ADVANCED_TOOLTIPS.tooltip.1=高度なツールチップ +of.options.ADVANCED_TOOLTIPS.tooltip.2= オン - 高度なツールチップを表示 +of.options.ADVANCED_TOOLTIPS.tooltip.3= オフ - 高度なツールチップを非表示(通常) +of.options.ADVANCED_TOOLTIPS.tooltip.4=高度なツールチップはアイテム(ID,耐久値)と +of.options.ADVANCED_TOOLTIPS.tooltip.5=シェーダーのオプション(ID,source,default value)において +of.options.ADVANCED_TOOLTIPS.tooltip.6=拡張された情報を表示します。 + +of.options.DROPPED_ITEMS=落ちているアイテムの表示 +of.options.DROPPED_ITEMS.tooltip.1=落ちているアイテムの表示 +of.options.DROPPED_ITEMS.tooltip.2= デフォルト - グラフィックスの設定に合わせる +of.options.DROPPED_ITEMS.tooltip.3= 処理優先 - 落ちているアイテムを2Dで表示する 低負荷 +of.options.DROPPED_ITEMS.tooltip.4= 描画優先 - 落ちているアイテムを3Dで表示する 高負荷 + +options.entityShadows.tooltip.1=Entityの影 +options.entityShadows.tooltip.2= オン - Entityの影を表示する +options.entityShadows.tooltip.3= オフ - Entityの影を表示しない + +of.options.VIGNETTE=視界端の影 +of.options.VIGNETTE.tooltip.1=スクリーンの角を少し暗くさせる視覚効果 +of.options.VIGNETTE.tooltip.2= デフォルト - グラフィックスの設定に合わせる(通常) +of.options.VIGNETTE.tooltip.3= 処理優先 - 視界端の影を表示しない(低負荷) +of.options.VIGNETTE.tooltip.4= 描画優先 - 視界端の影を表示する(高負荷) +of.options.VIGNETTE.tooltip.5=視界端の影はFPSにとって重要な視覚効果です。 +of.options.VIGNETTE.tooltip.6=例外としてフルスクリーンで遊ぶ際には、 +of.options.VIGNETTE.tooltip.7=視界端の影は非常に微かであるため、 +of.options.VIGNETTE.tooltip.8=無効にしても無害です。 + +of.options.DYNAMIC_FOV=臨場感ある視野角 +of.options.DYNAMIC_FOV.tooltip.1=臨場感ある視野角 +of.options.DYNAMIC_FOV.tooltip.2= オン - 臨場感ある視野角を有効化(通常) +of.options.DYNAMIC_FOV.tooltip.3= オフ - 臨場感ある視野角を無効化 +of.options.DYNAMIC_FOV.tooltip.4=飛翔時や、ダッシュ時、弓の引き絞り時に、 +of.options.DYNAMIC_FOV.tooltip.5=視野角(FOV)を変えます。 + +of.options.DYNAMIC_LIGHTS=臨場感ある光源 +of.options.DYNAMIC_LIGHTS.tooltip.1=臨場感ある光源 +of.options.DYNAMIC_LIGHTS.tooltip.2= オフ - 持っている光源を光らせない(通常) +of.options.DYNAMIC_LIGHTS.tooltip.3= 処理優先 - 500ミリ秒ごとに位置を更新する +of.options.DYNAMIC_LIGHTS.tooltip.4= 描画優先 - リアルタイムに位置を更新する +of.options.DYNAMIC_LIGHTS.tooltip.5=光源となるアイテム(松明、グローストーンなど)について、 +of.options.DYNAMIC_LIGHTS.tooltip.6=手に持っているか、他のプレイヤーが装備しているか、 +of.options.DYNAMIC_LIGHTS.tooltip.7=地上に投げ出されている時に、周囲を照らします。 + +# Performance + +of.options.SMOOTH_FPS=FPS安定化処理 +of.options.SMOOTH_FPS.tooltip.1=バッファを使ってFPSを安定化する。 +of.options.SMOOTH_FPS.tooltip.2= オフ - 安定化しない。FPSは変動的になるでしょう。 +of.options.SMOOTH_FPS.tooltip.3= オン - 安定化する。 +of.options.SMOOTH_FPS.tooltip.4=この設定はグラフィックドライバーに依存し、 +of.options.SMOOTH_FPS.tooltip.5=常には有効ではありません。 + +of.options.SMOOTH_WORLD=サーバー負荷を分散 +of.options.SMOOTH_WORLD.tooltip.1=内部サーバーによるラグの除去。 +of.options.SMOOTH_WORLD.tooltip.2= オフ - 安定化しない。FPSは変動的になるでしょう。 +of.options.SMOOTH_WORLD.tooltip.3= オン - 安定化する。 +of.options.SMOOTH_WORLD.tooltip.4=内部サーバーロードを安定化。 +of.options.SMOOTH_WORLD.tooltip.5=シングルプレイの時のみ効果があります。 + +of.options.FAST_RENDER=描画の最適化 +of.options.FAST_RENDER.tooltip.1=描画の最適化 +of.options.FAST_RENDER.tooltip.2= オフ - 通常の描画(通常) +of.options.FAST_RENDER.tooltip.3= オン - 最適化された描画(低負荷) +of.options.FAST_RENDER.tooltip.4=GPUのロード回数を減らした方式によって +of.options.FAST_RENDER.tooltip.5=実質的なFPSを向上します。 + +of.options.FAST_MATH=計算の最適化 +of.options.FAST_MATH.tooltip.1=計算の最適化 +of.options.FAST_MATH.tooltip.2= オフ - 通常の処理(通常) +of.options.FAST_MATH.tooltip.3= オン - 最適化された計算方式 +of.options.FAST_MATH.tooltip.4=CPUのキャッシュをうまく使った +of.options.FAST_MATH.tooltip.5=FPSを向上させる計算処理を使用します。 + +of.options.CHUNK_UPDATES=チャンク読込方法 +of.options.CHUNK_UPDATES.tooltip.1=チャンク読込方法 +of.options.CHUNK_UPDATES.tooltip.2= 1 - 高負荷なチャンク読み込み 高いFPS(通常) +of.options.CHUNK_UPDATES.tooltip.3= 3 - 低負荷めなチャンク読み込み 低めのFPS +of.options.CHUNK_UPDATES.tooltip.4= 5 - 低負荷なチャンク読み込み 低いFPS +of.options.CHUNK_UPDATES.tooltip.5=1フレームごとに行われるチャンク読み込み回数を指定します。 +of.options.CHUNK_UPDATES.tooltip.6=高い値はフレームレートの非安定化を招きます。 + +of.options.CHUNK_UPDATES_DYNAMIC=動的な読み込み +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=動的な読み込み +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= オフ - (通常) 1フレームに通常の回数のチャンク読み込み処理 +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= オン - 静止中により多くのアップデート処理を行う。 +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=プレイヤーが静止している時に +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=素早くチャンク読み込むようになります。 + +of.options.LAZY_CHUNK_LOADING=チャンク読み込みの遅延 +of.options.LAZY_CHUNK_LOADING.tooltip.1=チャンク読み込みの遅延 +of.options.LAZY_CHUNK_LOADING.tooltip.2= オフ - 通常のサーバーチャンク読み込み +of.options.LAZY_CHUNK_LOADING.tooltip.3= オン - 遅延サーバーチャンク読み込み(滑らか) +of.options.LAZY_CHUNK_LOADING.tooltip.4=チャンク読み込み処理を数Tickに分散させることで +of.options.LAZY_CHUNK_LOADING.tooltip.5=総合的にサーバーのチャンク読み込み処理を滑らかにします。 +of.options.LAZY_CHUNK_LOADING.tooltip.6=ワールドの一部に欠けが発生するようならOFFにしてください。 +of.options.LAZY_CHUNK_LOADING.tooltip.7=シングルプレイヤーでシングルコアCPUの時のみ有効です。 + +# Animations + +of.options.animation.allOn=全てオン +of.options.animation.allOff=全てオフ +of.options.animation.dynamic=動的 + +of.options.ANIMATED_WATER=水 +of.options.ANIMATED_LAVA=溶岩 +of.options.ANIMATED_FIRE=炎 +of.options.ANIMATED_PORTAL=ネザーゲート +of.options.ANIMATED_REDSTONE=レッドストーン +of.options.ANIMATED_EXPLOSION=爆発 +of.options.ANIMATED_FLAME=松明やかまど +of.options.ANIMATED_SMOKE=煙 +of.options.VOID_PARTICLES=奈落のパーティクル +of.options.WATER_PARTICLES=水中のパーティクル +of.options.RAIN_SPLASH=雨の水しぶき +of.options.PORTAL_PARTICLES=ポータルのパーティクル +of.options.POTION_PARTICLES=ポーションのパーティクル +of.options.DRIPPING_WATER_LAVA=水/溶岩の滴り +of.options.ANIMATED_TERRAIN=地形アニメーション +of.options.ANIMATED_TEXTURES=テクスチャアニメーション +of.options.FIREWORK_PARTICLES=花火のパーティクル + +# Other + +of.options.LAGOMETER=ラグメーター +of.options.LAGOMETER.tooltip.1=デバッグ画面(F3)にラグメーターを表示する。 +of.options.LAGOMETER.tooltip.2=* 橙 - ガベージコレクション +of.options.LAGOMETER.tooltip.3=* 藍 - Tick処理 +of.options.LAGOMETER.tooltip.4=* 青 - スケジューリングされた処理 +of.options.LAGOMETER.tooltip.5=* 紫 - チャンクアップローディング +of.options.LAGOMETER.tooltip.6=* 赤 - チャンクアップデート +of.options.LAGOMETER.tooltip.7=* 黄 - 描画確認 +of.options.LAGOMETER.tooltip.8=* 緑 - 地形描画 + +of.options.PROFILER=デバッグプロファイラ +of.options.PROFILER.tooltip.1=デバッグプロファイラ +of.options.PROFILER.tooltip.2= オン - デバッグプロファイラは有効 高負荷 +of.options.PROFILER.tooltip.3= オフ - デバッグプロファイラは無効 低負荷 +of.options.PROFILER.tooltip.4=デバッグ画面(F3)が開かれている時に +of.options.PROFILER.tooltip.5=デバッグ情報を収集し円グラフ上に表示します。 + +of.options.WEATHER=天候 +of.options.WEATHER.tooltip.1=天候 +of.options.WEATHER.tooltip.2= オン - 天候あり 高負荷 +of.options.WEATHER.tooltip.3= オフ - 天候なし 低負荷 +of.options.WEATHER.tooltip.4=天候コントロール機能の有効/無効。 +of.options.WEATHER.tooltip.5=シングルプレイでのみ有効。 + +of.options.time.dayOnly=昼のみ +of.options.time.nightOnly=夜のみ + +of.options.TIME=クリエイティブの時刻 +of.options.TIME.tooltip.1=クリエイティブの時刻 +of.options.TIME.tooltip.2= デフォルト - 通常の昼夜サイクル +of.options.TIME.tooltip.3= 昼のみ - 昼のみ +of.options.TIME.tooltip.4= 夜のみ - 夜のみ +of.options.TIME.tooltip.5=クリエイティブモードで +of.options.TIME.tooltip.6=シングルプレイの時のみ有効。 + +options.fullscreen.tooltip.1=フルスクリーン +options.fullscreen.tooltip.2= オン - フルスクリーンモード +options.fullscreen.tooltip.3= オフ - ウィンドウモード +options.fullscreen.tooltip.4=フルスクリーンではグラフィックカードによって +options.fullscreen.tooltip.5=処理の速い遅いが変わります。 + +of.options.FULLSCREEN_MODE=フルスクリーンの種類 +of.options.FULLSCREEN_MODE.tooltip.1=フルスクリーンの種類 +of.options.FULLSCREEN_MODE.tooltip.2= デフォルト - デスクトップスクリーンの解像度 高負荷 +of.options.FULLSCREEN_MODE.tooltip.3= WxH - カスタム解像度 おそらく低負荷 +of.options.FULLSCREEN_MODE.tooltip.4=フルスクリーンモードにて使用される解像度です。 +of.options.FULLSCREEN_MODE.tooltip.5=一般的に、低い解像度は速い処理に繋がります。 + +of.options.SHOW_FPS=FPSを表示 +of.options.SHOW_FPS.tooltip.1=コンパクトなFPSと描画情報を表示 +of.options.SHOW_FPS.tooltip.2= C: - チャンク描画 +of.options.SHOW_FPS.tooltip.3= E: - エンティティ描画 +of.options.SHOW_FPS.tooltip.4= U: - チャンクアップデート +of.options.SHOW_FPS.tooltip.5=コンパクトなFPS情報は +of.options.SHOW_FPS.tooltip.6=デバッグ画面が非表示の時のみ表示されます。 + +of.options.save.default=デフォルト(2秒) +of.options.save.20s=20秒 +of.options.save.3min=3分 +of.options.save.30min=30分 + +of.options.AUTOSAVE_TICKS=オートセーブ +of.options.AUTOSAVE_TICKS.tooltip.1=セーブ間隔 +of.options.AUTOSAVE_TICKS.tooltip.2=2秒ごとのセーブは推奨されません。 +of.options.AUTOSAVE_TICKS.tooltip.3=オートセーブはラグを引き起こします。 + +of.options.SCREENSHOT_SIZE=スクリーンショットのサイズ +of.options.SCREENSHOT_SIZE.tooltip.1=スクリーンショットのサイズ +of.options.SCREENSHOT_SIZE.tooltip.2= デフォルト - 通常の大きさ +of.options.SCREENSHOT_SIZE.tooltip.3= 2x~4x - 任意の大きさ +of.options.SCREENSHOT_SIZE.tooltip.4=より大きなスクリーンショットの撮影には、より多くのメモリが必要です。 +of.options.SCREENSHOT_SIZE.tooltip.5=描画の最適化、アンチエイリアスとは競合します。 +of.options.SCREENSHOT_SIZE.tooltip.6=GPUがフレームバッファをサポートしている必要があります。 diff --git a/src/minecraft/assets/minecraft/optifine/lang/lb_LU.lang b/src/minecraft/assets/minecraft/optifine/lang/lb_LU.lang new file mode 100644 index 0000000..5e3f385 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/lb_LU.lang @@ -0,0 +1,578 @@ +# Contributors of Luxembourgish localization # +# Hyperspacemaster ---- 2016-4-6 ---- 2016-9-12 + +# General +of.general.ambiguous=onkloer +of.general.custom=Aneres +of.general.from=Vun +of.general.id=ID +of.general.restart=Neistart +of.general.smart=Fein + +# Keys +of.key.zoom=Zoom + +# Message +of.message.aa.shaders1=Antialiasing ass net kompatibel mat de Shader. +of.message.aa.shaders2=W.e.g. schalt de Shader aus fir des Optioun ze aktivéieren. + +of.message.af.shaders1=Anisotropescht Filteren ass net kompatibel mat de Shader. +of.message.af.shaders2=W.e.g. schalt de Shader aus fir des Optioun ze aktivéieren. + +of.message.fr.shaders1=Schnellt Renderen ass net kompatibel mat de de Shader. +of.message.fr.shaders2=W.e.g. schalt de Shader aus fir des Optioun ze aktivéieren. + +of.message.an.shaders1=3D Anaglyph ass net kompatibel mat de Shader. +of.message.an.shaders2=W.e.g. schalt de Shader aus fir des Optioun ze aktivéieren. + +of.message.shaders.aa1=Antialiasing ass net kompatibel mat de Shader . +of.message.shaders.aa2=W.e.g desaktivéier Qualitéit -> Antialiasing a start däi Spill nei. + +of.message.shaders.af1=Anisotropescht Filteren ass net kompatibel mat de Shader. +of.message.shaders.af2=W.e.g desaktivéier Qualitéit -> Anisotropescht Filteren. + +of.message.shaders.fr1=Shader sinn net kompatibel mat schnellem Renderen. +of.message.shaders.fr2=W.e.g desaktivéier Qualitéit -> Schnellt Renderen. + +of.message.shaders.an1=Shader sinn net kompatibel mam 3D Anaglyph. +of.message.shaders.an2=W.e.g desaktivéier Verschiddenes -> 3D Anaglyph. + +of.message.newVersion=Eng nei §eOptiFine§f Versioun ass verfügbar: §e%s§f +of.message.java64Bit=Du kanns §e64-bit Java§f installéiere fir eng besser Performance. +of.message.openglError=§eOpenGL Fehler§f: %s (%s) + +of.message.shaders.loading=D'Shader gi gelueden: %s + +of.message.other.reset=All Videoastellungen zerécksetzen ob hier Standardwäerter? + +# Video settings + +options.graphics.tooltip.1=Grafikmodus +options.graphics.tooltip.2= Schnell - méi schlecht Qualitéit, méi schnell +options.graphics.tooltip.3= Schéin - héich Qualitéit, méi lues +options.graphics.tooltip.4=Verännert d'Ausgesi vun de Wolleken, Blieder, Grasbléck, +options.graphics.tooltip.5=Schieter a vum Waasser. + +of.options.renderDistance.tiny=Winzeg +of.options.renderDistance.short=Geréng +of.options.renderDistance.normal=Normal +of.options.renderDistance.far=Wéit +of.options.renderDistance.extreme=Extrem + +options.renderDistance.tooltip.1=Siichtwéit +options.renderDistance.tooltip.2= 2 Winzeg - 32m (am schnellsten) +options.renderDistance.tooltip.3= 4 Geréng - 64m (schnell) +options.renderDistance.tooltip.4= 8 Normal - 128m +options.renderDistance.tooltip.5= 16 Wéit - 256m (lues) +options.renderDistance.tooltip.6= 32 Extrem - 512m (am luesten!) +options.renderDistance.tooltip.7=D'extrem Siichtwéit erfuerdert vill Ressource. +options.renderDistance.tooltip.8=Wäerter iwwer 16 funktionéieren nëmmen am Singleplayer + +options.ao.tooltip.1=Fléissend Beliichtung +options.ao.tooltip.2= Aus - keng fléissend Beliichtung (schnell) +options.ao.tooltip.3= Minimum - einfach fléissend Beliichtung (lues) +options.ao.tooltip.4= Maximum - komplexe fléissend Beliichtung (am luesten) + +options.framerateLimit.tooltip.1=Max. FPS +options.framerateLimit.tooltip.2= VSync - limitéiert ob d'Bildfrequenz vum +options.framerateLimit.tooltip.3= Monitor (60, 30, 20) +options.framerateLimit.tooltip.4= 5-255 - variabel +options.framerateLimit.tooltip.5= Illimitéiert - keng Begrenzung (am schnellsten) +options.framerateLimit.tooltip.6=D'Bildfrequenz grenzt FPS an, souguer wann +options.framerateLimit.tooltip.7=d'Begrenzung net erreecht ass. +of.options.framerateLimit.vsync=V-Sync + +of.options.AO_LEVEL=Schiet-Hellegkeet +of.options.AO_LEVEL.tooltip.1=Hellegkeet vun de Schieter +of.options.AO_LEVEL.tooltip.2= Aus - keng Schieter +of.options.AO_LEVEL.tooltip.3= 50%% - hell Schieter +of.options.AO_LEVEL.tooltip.4= 100%% - donkel Schieter + +options.viewBobbing.tooltip.1=Realistesch Bewegungen +options.viewBobbing.tooltip.2=Wann Mipmaps genotzt ginn deaktivéiert d'Astellung +options.viewBobbing.tooltip.3=fir eng besser Leeschtung + +options.guiScale.tooltip.1=GUI-Gréisst +options.guiScale.tooltip.2=Ee méi klengt GUI ka méi schnell sinn. + +options.vbo.tooltip.1=Vertexbufferobjeten +options.vbo.tooltip.2=Benotz een alternative Rendermodel, deen normalerweis +options.vbo.tooltip.3=méi schnell (5-10%%) wei d'Standard-Renderen ass. + +options.gamma.tooltip.1=Erhéicht Hellegkeet vun donkelen Objeten +options.gamma.tooltip.2= Aus - Standardhellegkeet +options.gamma.tooltip.3= 1-99%% - variabel +options.gamma.tooltip.4= Hell - maximal Hellegkeet fir donkel Objeten +options.gamma.tooltip.5=Dës Optioun ännert Hellegkeet vun ganz donkelen +options.gamma.tooltip.6=Objeten net. + +options.anaglyph.tooltip.1=3D Anaglyph +options.anaglyph.tooltip.2=Aktivéiert ee stereoskopeschen 3D-Effekt duerch +options.anaglyph.tooltip.3=benotze vun ënnerschiddleche Faarwe fir d'Aen. +options.anaglyph.tooltip.4=Kann nëmme mat engem Roud-Turquoise-Brëll benotzt ginn. + +options.blockAlternatives.tooltip.1=Block Variatiounen +options.blockAlternatives.tooltip.2=Benotz Variatioune fir puer Bléck +options.blockAlternatives.tooltip.3=Hänkt vum ausgewielte Ressourcenpack of. + +of.options.ALTERNATE_BLOCKS=Block Variatiounen +of.options.ALTERNATE_BLOCKS.tooltip.1=Block Variatiounen +of.options.ALTERNATE_BLOCKS.tooltip.2=Benotz Variatioune fir puer Bléck +of.options.ALTERNATE_BLOCKS.tooltip.3=Hänkt vum ausgewielte Ressourcenpack of. + +of.options.FOG_FANCY=Niwwel +of.options.FOG_FANCY.tooltip.1=Niwwel +of.options.FOG_FANCY.tooltip.2= Schnell - schnellen Niwwel +of.options.FOG_FANCY.tooltip.3= Schéin - luesen Niwwel, gesäit besser aus +of.options.FOG_FANCY.tooltip.4= Aus - keen Niwwel, am schnellsten +of.options.FOG_FANCY.tooltip.5=De schéinen Niwwel ass nëmme verfügbar, wann en vun +of.options.FOG_FANCY.tooltip.6=der Grafikkaart ënnerstëtzt gëtt. + +of.options.FOG_START=Niwwel Startpunkt +of.options.FOG_START.tooltip.1=Niwwel Startpunkt +of.options.FOG_START.tooltip.2= 0.2 - Niwwel start no beim Spiller +of.options.FOG_START.tooltip.3= 0.8 - Niwwel start weit vum Spiller ewech +of.options.FOG_START.tooltip.4=Dës Optioun beaflosst normalerweis net d'Leeschtung + +of.options.CHUNK_LOADING=Chunklueden +of.options.CHUNK_LOADING.tooltip.1=Chunklueden +of.options.CHUNK_LOADING.tooltip.2= Standard - onstabil FPS beim luede vun de Chunks +of.options.CHUNK_LOADING.tooltip.3= Fléissend - stabil FPS +of.options.CHUNK_LOADING.tooltip.4= Multi-Core - stabil FPS, 3x méi schnellt luede vun der Welt +of.options.CHUNK_LOADING.tooltip.5=Fléissend a Multi-Core mécht Ruckler a Standbiller +of.options.CHUNK_LOADING.tooltip.6=fort déi durch d'Luede vun de Chunks verursaacht ginn. +of.options.CHUNK_LOADING.tooltip.7=Multi-Core kann d'Luede vun der Welt bis zu 3x méi schnell +of.options.CHUNK_LOADING.tooltip.8=maachen a FPS erhéijen duerch een zweete CPU-Kär. +of.options.chunkLoading.smooth=Fléissend +of.options.chunkLoading.multiCore=Multi-Core + +of.options.shaders=Schieter ... +of.options.shadersTitle=Schieter + +of.options.shaders.packNone=Aus +of.options.shaders.packDefault=(intern) + +of.options.shaders.ANTIALIASING=Antialiasing +of.options.shaders.NORMAL_MAP=Normal Kaart +of.options.shaders.SPECULAR_MAP=Spiegelnd Kaart +of.options.shaders.RENDER_RES_MUL=Render Qualitéit +of.options.shaders.SHADOW_RES_MUL=Schiet Qualitéit +of.options.shaders.HAND_DEPTH_MUL=Handdéift +of.options.shaders.CLOUD_SHADOW=Wolleke schiet +of.options.shaders.OLD_HAND_LIGHT=Aal Handbel. +of.options.shaders.OLD_LIGHTING=Aal Beliichtung +of.options.shaders.SHADER_PACK=Shaderpack + +of.options.shaders.shadersFolder=Shader-Fichier +of.options.shaders.shaderOptions=Shaderastellungen ... + +of.options.shaderOptionsTitle=Shaderastellungen + +of.options.quality=Qualitéit ... +of.options.qualityTitle=Qualitéitsastellungen + +of.options.details=Detailer ... +of.options.detailsTitle=Detailastellungen + +of.options.performance=Performance ... +of.options.performanceTitle=Performanceastellungen + +of.options.animations=Animatiounen ... +of.options.animationsTitle=Animatiounsastellungen + +of.options.other=Verschiddenes ... +of.options.otherTitle=Veschidden Astellungen + +of.options.other.reset=Videoastellungen zerécksetzen ... + +of.shaders.profile=Profil + +# Quality + +of.options.mipmap.bilinear=Bilinear +of.options.mipmap.linear=Linear +of.options.mipmap.nearest=Am noosten +of.options.mipmap.trilinear=Trilinear + +options.mipmapLevels.tooltip.1=Visuellen Effekt dee weit entfernten Objete besser +options.mipmapLevels.tooltip.2=ausgesi léisst duerch verréngere vun den Texturdetailer. +options.mipmapLevels.tooltip.3= Aus - keng Verréngerung vun Detailer +options.mipmapLevels.tooltip.4= 1 - minimal Verréngerung vun Detailler +options.mipmapLevels.tooltip.5= 4 - maximal Verréngerung vun Detailler +options.mipmapLevels.tooltip.6=Dës Optioun beaflosst normalerweis d'Performance net. + +of.options.MIPMAP_TYPE=Mipmap-Typ +of.options.MIPMAP_TYPE.tooltip.1=Visuellen Effekt dee weit distanzéiert Objete besser +of.options.MIPMAP_TYPE.tooltip.2=ausgesi léisst duerch verréngere vun den Texturdetailer. +of.options.MIPMAP_TYPE.tooltip.3= Am noosten - graff Verréngerung (am schnellsten) +of.options.MIPMAP_TYPE.tooltip.4= Linear - normal Verréngerung (schnell) +of.options.MIPMAP_TYPE.tooltip.5= Bilinear - fein Verréngerung (lues) +of.options.MIPMAP_TYPE.tooltip.6= Trilinear - feinst Verréngerung (am luesten) + +of.options.AA_LEVEL=Antialiasing +of.options.AA_LEVEL.tooltip.1=Antialiasing +of.options.AA_LEVEL.tooltip.2= Aus - (Standard) Keen Antialiasing (méi schnell) +of.options.AA_LEVEL.tooltip.3= 2-16 - antialiséiert Kanten an Ecker (méi lues) +of.options.AA_LEVEL.tooltip.4=Den Antialiasing mécht Kanten a Faarfiwergäng +of.options.AA_LEVEL.tooltip.5=méi fléissend. +of.options.AA_LEVEL.tooltip.6=Wann aktivéiert kënnen deng FPS staark erof goen. +of.options.AA_LEVEL.tooltip.7=Net all Stufe gi vun all Grafikaart ënnerstëtzt +of.options.AA_LEVEL.tooltip.8=Ännerunge sinn ereicht no engem Neistart effektiv! + +of.options.AF_LEVEL=Anisotropescht Filteren +of.options.AF_LEVEL.tooltip.1=Anisotropescht Filteren +of.options.AF_LEVEL.tooltip.2= Aus - (Standard) Standard-Texturdetailer (méi schnell) +of.options.AF_LEVEL.tooltip.3= 2-16 - méi fein Texturdetailer (méi lues) +of.options.AF_LEVEL.tooltip.4=D'anisoptropescht Filtere stellt Texturdetailer +of.options.AF_LEVEL.tooltip.5=déi duerch Mipmap verluer gaange sinn erëm hier. +of.options.AF_LEVEL.tooltip.6=Wann aktivéiert kenne FPS staark erof goen. + +of.options.CLEAR_WATER=Kloert Waasser +of.options.CLEAR_WATER.tooltip.1=Kloert Waasser +of.options.CLEAR_WATER.tooltip.2= Un - kloer, transparent Waasser +of.options.CLEAR_WATER.tooltip.3= Aus - normaalt Waasser + +of.options.RANDOM_MOBS=Zoufälleg Mobs +of.options.RANDOM_MOBS.tooltip.1=Zoufälleg Mobs +of.options.RANDOM_MOBS.tooltip.2= Aus - keng zoufälleg Mobs, méi schnell +of.options.RANDOM_MOBS.tooltip.3= Un - zoufälleg Mobs, méi lues +of.options.RANDOM_MOBS.tooltip.4=Zoufälleg Mobs benotzt zoufälleg Texture fir Kreaturen +of.options.RANDOM_MOBS.tooltip.5=am Spill. +of.options.RANDOM_MOBS.tooltip.6=Et braucht een ee Ressourcepak mat e puer Mobtexturen. + +of.options.BETTER_GRASS=Bessert Grass +of.options.BETTER_GRASS.tooltip.1=Bessert Grass +of.options.BETTER_GRASS.tooltip.2= Aus - Standard-Säitentextur vum Gras, am schnellsten +of.options.BETTER_GRASS.tooltip.3= Schnell - komplett Säitentextur vum Gras, lues +of.options.BETTER_GRASS.tooltip.4= Schéin - dynamesch Säitentextur vum Gras, am luesten + +of.options.BETTER_SNOW=Bessere Schnéi +of.options.BETTER_SNOW.tooltip.1=Bessere Schnéi +of.options.BETTER_SNOW.tooltip.2= Aus - normale Schnéi, méi schnell +of.options.BETTER_SNOW.tooltip.3= Un - bessere Schnéi, méi lues +of.options.BETTER_SNOW.tooltip.4=Wéist Schnéi ënnert transparente Bléck (Zonk, +of.options.BETTER_SNOW.tooltip.5=héijem Grass) un wann se un Schnéibléck ugrenzen. + +of.options.CUSTOM_FONTS=Schrëftressource +of.options.CUSTOM_FONTS.tooltip.1=Schrëftressource +of.options.CUSTOM_FONTS.tooltip.2= Un - Ressourcepak-Schrëft (Standard), méi lues +of.options.CUSTOM_FONTS.tooltip.3= Aus - Standardschrëft, méi schnell +of.options.CUSTOM_FONTS.tooltip.4=D'Schrëft gëtt vum ausgewielte Ressourcepak gelueden +of.options.CUSTOM_FONTS.tooltip.5= + +of.options.CUSTOM_COLORS=Faarfressource +of.options.CUSTOM_COLORS.tooltip.1=Faarfressource +of.options.CUSTOM_COLORS.tooltip.2= Un - Ressourcepak-Faarwen (Standard), méi lues +of.options.CUSTOM_COLORS.tooltip.3= Aus - Standardfaarwen, méi schnell +of.options.CUSTOM_COLORS.tooltip.4=Faarwe gi vum ausgewielte Ressourcepak gelueden +of.options.CUSTOM_COLORS.tooltip.5= + +of.options.SWAMP_COLORS=Sumpffaarwen +of.options.SWAMP_COLORS.tooltip.1=Sumpffaarwen +of.options.SWAMP_COLORS.tooltip.2= Un - Sumpffaarwe benotzen (Standard), méi lues +of.options.SWAMP_COLORS.tooltip.3= Aus - Sumpffaarwen nëtt benotzen, méi schnell +of.options.SWAMP_COLORS.tooltip.4=Sumpfaarwe concernéiere Grass, Blieder, Lianen +of.options.SWAMP_COLORS.tooltip.5=a Waasser. + +of.options.SMOOTH_BIOMES=Biomeiwwergäng +of.options.SMOOTH_BIOMES.tooltip.1= Biomeiwwergäng +of.options.SMOOTH_BIOMES.tooltip.2= Un - fléissenden Iwwergang (Standard), méi lues +of.options.SMOOTH_BIOMES.tooltip.3= Aus - kee fléissenden Iwwergang, méi schnell +of.options.SMOOTH_BIOMES.tooltip.4=De fléissenden Iwwergang gëtt duerch Prouwen an +of.options.SMOOTH_BIOMES.tooltip.5=Duerchschnëttsfaarfwäerter vun den ugrenzende +of.options.SMOOTH_BIOMES.tooltip.6=Bléck realiséiert +of.options.SMOOTH_BIOMES.tooltip.7=Concernéiert si Grass, Blieder, Lianen a Waasser + +of.options.CONNECTED_TEXTURES=Verbonnen Texturen +of.options.CONNECTED_TEXTURES.tooltip.1=Verbonnen Texturen +of.options.CONNECTED_TEXTURES.tooltip.2= Aus - keng verbonnen Texturen (Standard) +of.options.CONNECTED_TEXTURES.tooltip.3= Schnell - schnell verbonnen Texturen +of.options.CONNECTED_TEXTURES.tooltip.4= Schéin - schéi verbonnen Texturen +of.options.CONNECTED_TEXTURES.tooltip.5=Verbonnen Texture verbënnt d'Texture vu Glas, +of.options.CONNECTED_TEXTURES.tooltip.6=Sandsteen a Bicherregaler wann se niewenteneen +of.options.CONNECTED_TEXTURES.tooltip.7=plazéiert ginn. D'verbonnen Texture gi vum +of.options.CONNECTED_TEXTURES.tooltip.8=Ressourcepak gelueden. + +of.options.NATURAL_TEXTURES=Natierlech Texturen +of.options.NATURAL_TEXTURES.tooltip.1=Natierlech Texturen +of.options.NATURAL_TEXTURES.tooltip.2= Aus - keng natierlech Texturen (Standard) +of.options.NATURAL_TEXTURES.tooltip.3= Un - benotz natierlech Texturen +of.options.NATURAL_TEXTURES.tooltip.4=Natierlech Texture maachen d'Raster-Unuerdnung +of.options.NATURAL_TEXTURES.tooltip.5=déi duerch widderhuele vum selwechte Block entsti fort. +of.options.NATURAL_TEXTURES.tooltip.6=Et gi rotéiert a gespigelt Variante vun der +of.options.NATURAL_TEXTURES.tooltip.7=Basisblocktextur genotzt. Konfiguratioun fir natierlech +of.options.NATURAL_TEXTURES.tooltip.8=Texture gi vum Ressourcepak gelueden. + +of.options.CUSTOM_SKY=Himmeltexturen +of.options.CUSTOM_SKY.tooltip.1=Himmeltexturen +of.options.CUSTOM_SKY.tooltip.2= Un - Ressourcepak-Himmeltexturen (Standard), lues +of.options.CUSTOM_SKY.tooltip.3= Aus - Standardhimmel, méi schnell +of.options.CUSTOM_SKY.tooltip.4=D'Himmeltexture gi vum Ressourcepak gelueden +of.options.CUSTOM_SKY.tooltip.5= + +of.options.CUSTOM_ITEMS=Géigestänntexturen +of.options.CUSTOM_ITEMS.tooltip.1=Géigestänntexturen +of.options.CUSTOM_ITEMS.tooltip.2= Un - Géigestänntexturen aus dem Ressourcepak +of.options.CUSTOM_ITEMS.tooltip.3= (Standard), lues +of.options.CUSTOM_ITEMS.tooltip.4= Aus - Standard-Géigestänntexturen, méi schnell +of.options.CUSTOM_ITEMS.tooltip.5=Géigestänntexture gi vum Ressourcepak gelueden + +# Details + +of.options.CLOUDS=Wolleken +of.options.CLOUDS.tooltip.1=Wolleken +of.options.CLOUDS.tooltip.2= Standard - wéi vum Grafikmodus definéiert +of.options.CLOUDS.tooltip.3= Schnell - méi geréng Qualitéit, méi schnell +of.options.CLOUDS.tooltip.4= Schéin - héich Qualitéit, méi lues +of.options.CLOUDS.tooltip.5= Aus - keng Wolleken, am schnellsten +of.options.CLOUDS.tooltip.6=Schnell Wolleke sinn am 2D gerendert. +of.options.CLOUDS.tooltip.7=Schéi Wolleke sinn am 3D gerendert. + +of.options.CLOUD_HEIGHT=Wollekenhéicht +of.options.CLOUD_HEIGHT.tooltip.1=Wollekenhéicht +of.options.CLOUD_HEIGHT.tooltip.2= Aus - Standardhéicht +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - iwwert der max. Welt héicht + +of.options.TREES=Beem +of.options.TREES.tooltip.1=Beem +of.options.TREES.tooltip.2= Standard - wéi vum Grafikmodus definéiert +of.options.TREES.tooltip.3= Schnell - méi geréng Qualitéit, méi schnell +of.options.TREES.tooltip.4= Fein - méi héich Qualitéit, schnell +of.options.TREES.tooltip.5= Schéin - héchste Qualitéit, méi lues +of.options.TREES.tooltip.6=Schnell Beem hunn onduerchsichteg Blieder +of.options.TREES.tooltip.7=Schéin a fein Beem hunn transparent Blieder. + +of.options.RAIN=Reen a Schnéi +of.options.RAIN.tooltip.1=Reen a Schnéi +of.options.RAIN.tooltip.2= Standard - wéi vum Grafikmodus definéiert +of.options.RAIN.tooltip.3= Schnell - liichte Reen/Schnéi, méi schnell +of.options.RAIN.tooltip.4= Schéin - heftege Reen/Schnéi, méi lues +of.options.RAIN.tooltip.5= Aus - keen Reen/Schnéi, schnellst +of.options.RAIN.tooltip.6=Och wann de Reen aus ass, héiert een nach ëmmer +of.options.RAIN.tooltip.7=Geräischer + +of.options.SKY=Himmel +of.options.SKY.tooltip.1=Himmel +of.options.SKY.tooltip.2= Un - Himmel siichtbar, méi lues +of.options.SKY.tooltip.3= Aus - Himmel net siichtbar, méi schnell +of.options.SKY.tooltip.4=Och wann den Himmel aus ass, sinn de Mount an d'Sonn +of.options.SKY.tooltip.5=nach ëmmer siichtbar. + +of.options.STARS=Stären +of.options.STARS.tooltip.1=Stären +of.options.STARS.tooltip.2= Un - Stäre siichtbar, méi lues +of.options.STARS.tooltip.3= Aus - Stären net siichtbar, méi schnell + +of.options.SUN_MOON=Sonn a Mound +of.options.SUN_MOON.tooltip.1=Sonn a Mound +of.options.SUN_MOON.tooltip.2= Un - Sonn a Mound siichtbar (Standard) +of.options.SUN_MOON.tooltip.3= Aus - Sonn a Mound net siichtbar (méi schnell) + +of.options.SHOW_CAPES=Emhang weisen +of.options.SHOW_CAPES.tooltip.1=Emhang weisen +of.options.SHOW_CAPES.tooltip.2= Un - weis d'Emhäng vun de Spiller (Standard) +of.options.SHOW_CAPES.tooltip.3= Aus - d'Emhäng vun de Spiller ginn net ugewisen + +of.options.TRANSLUCENT_BLOCKS=Blocktransparenz +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Blocktransparenz +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Schéin - korrekt Faarfmëschung (Standard) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Schnell - schnell Faarfmëschung (méi schnell) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Kontrolléiert Faarfmëschung vun transparente Bléck +of.options.TRANSLUCENT_BLOCKS.tooltip.5=aus verschiddene Faarwen (gefierfte Glas, Waasser, Äis) +of.options.TRANSLUCENT_BLOCKS.tooltip.6=wann se hannert ënne placéiert sinn oder Loft +of.options.TRANSLUCENT_BLOCKS.tooltip.7=dertëschent ass. + +of.options.HELD_ITEM_TOOLTIPS=Géigestandbeschreiw. +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Géigestandbeschreiwung +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= Un - weis Géigestandbeschreiwung un (Standard) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= Aus - weis keng Géigestandbeschreiwung + +of.options.DROPPED_ITEMS=Géigenstänn +of.options.DROPPED_ITEMS.tooltip.1=Falengelosse Géigenstänn +of.options.DROPPED_ITEMS.tooltip.2= Standard - wéi vum Grafikmodus definéiert +of.options.DROPPED_ITEMS.tooltip.3= Schnell - 2D falengelosse Géigestänn, méi schnell +of.options.DROPPED_ITEMS.tooltip.4= Schéin - 3D falengelosse Géigestänn, méi lues + +options.entityShadows.tooltip.1=Objetschieter +options.entityShadows.tooltip.2= Un - weis Objetschieter un +options.entityShadows.tooltip.3= Aus - keng Objetschieter + +of.options.VIGNETTE=Vignette +of.options.VIGNETTE.tooltip.1=Visuellen Effekt deen d'Ecker liicht ofdonkelt +of.options.VIGNETTE.tooltip.2= Standard - wéi vum Grafikmodus definéiert (Standard) +of.options.VIGNETTE.tooltip.3= Schnell - Vignette deaktivéiert (méi schnell) +of.options.VIGNETTE.tooltip.4= Schéin - Vignette aktivéiert (méi lues) +of.options.VIGNETTE.tooltip.5=D'Vignette kann ee staarken Impakt ob d'FPS hunn, +of.options.VIGNETTE.tooltip.6=virun allem wann am Vollbildmodus gespillt gëtt. +of.options.VIGNETTE.tooltip.7=De Vignette Effekt ass relativ geréng a kann dofir +of.options.VIGNETTE.tooltip.8=ouni Problem deaktivéiert ginn. + +of.options.DYNAMIC_FOV=Dynamescht Siichtfeld +of.options.DYNAMIC_FOV.tooltip.1=Dynamescht Siichtfeld +of.options.DYNAMIC_FOV.tooltip.2= Un - dynamescht Siichtfeld un (Standard) +of.options.DYNAMIC_FOV.tooltip.3= Aus - dynamescht Siichtfeld aus +of.options.DYNAMIC_FOV.tooltip.4=Wiesselt Siichtfeld beim Fléien, Sprinten +of.options.DYNAMIC_FOV.tooltip.5=oder spannen vun engem Bou. + +of.options.DYNAMIC_LIGHTS=Dyn. Beliichtung +of.options.DYNAMIC_LIGHTS.tooltip.1=Dynamesch Beliichtung +of.options.DYNAMIC_LIGHTS.tooltip.2= Un - keng dyn. Beliichtung (Standard) +of.options.DYNAMIC_LIGHTS.tooltip.3= Schnell - schnell dyn- Beliichtung (Update all 500ms) +of.options.DYNAMIC_LIGHTS.tooltip.4= Schéin - schéin dyn. Beliichtung (Update a Realzäit) +of.options.DYNAMIC_LIGHTS.tooltip.5=Liicht-Géigestänn (Fackelen, Glowstone etc.) +of.options.DYNAMIC_LIGHTS.tooltip.6=beliichten d'Ëmgéigend wann se an der Hand gehalen, +of.options.DYNAMIC_LIGHTS.tooltip.7=een anere Spiller se equipéiert huet oder se +of.options.DYNAMIC_LIGHTS.tooltip.8=um Buedem Leien. + +# Performance + +of.options.SMOOTH_FPS=Stabil FPS +of.options.SMOOTH_FPS.tooltip.1=Stabiliséiert FPS duerch eidel maache +of.options.SMOOTH_FPS.tooltip.2=vum Grafikdreiwerpuffer +of.options.SMOOTH_FPS.tooltip.3= Aus - keng Stabilisatioun, FPS kënnen onstabil sinn +of.options.SMOOTH_FPS.tooltip.4= Un - FPS stabiliséiert +of.options.SMOOTH_FPS.tooltip.5=Dës Optioun hänkt vun de Grafikdreiwer of an d'Effekter +of.options.SMOOTH_FPS.tooltip.6=sinn net ëmmer siichtbar. + +of.options.SMOOTH_WORLD=Welt Stabiliséierung +of.options.SMOOTH_WORLD.tooltip.1=Hellt Lag Spëtzten déi duerch den interne Server +of.options.SMOOTH_WORLD.tooltip.2=verursaacht gi fort. +of.options.SMOOTH_WORLD.tooltip.3= Aus - keng Stabilisatioun, FPS kënnen onstabil sinn +of.options.SMOOTH_WORLD.tooltip.4= Un - FPS stabiliséiert +of.options.SMOOTH_WORLD.tooltip.5=Stabiliséiert FPS duerch verdeele vun der Laascht ob +of.options.SMOOTH_WORLD.tooltip.6=den interne Server. +of.options.SMOOTH_WORLD.tooltip.7=Nëmmen effektiv am Singleplayer. + +of.options.FAST_RENDER=Schnellt Renderen +of.options.FAST_RENDER.tooltip.1=Schnellt Renderen +of.options.FAST_RENDER.tooltip.2= Aus - Standard-Renderen (Standard) +of.options.FAST_RENDER.tooltip.3= Un - optiméiert Renderen (méi schnell) +of.options.FAST_RENDER.tooltip.4=Benotzt een optimiséierte Renderalgorithmus dee GPU +of.options.FAST_RENDER.tooltip.5=Laascht verklengert an domadder méi héich FPS +of.options.FAST_RENDER.tooltip.6=erméiglecht. + +of.options.FAST_MATH=Schnell Mathematik +of.options.FAST_MATH.tooltip.1=Schnell Mathematik +of.options.FAST_MATH.tooltip.2= Aus - Standard-Mathematik (Standard) +of.options.FAST_MATH.tooltip.3= Un - schnell Mathematik +of.options.FAST_MATH.tooltip.4=Benotzt optiméiert sin() a cos() Funktiounen déi de +of.options.FAST_MATH.tooltip.5=CPU cache stabiliséieren a méi héich FPS erméiglechen. + +of.options.CHUNK_UPDATES=Chunk Updates +of.options.CHUNK_UPDATES.tooltip.1=Chunk Updates +of.options.CHUNK_UPDATES.tooltip.2= 1 - luest Luede vun der Welt, héich FPS (Standard) +of.options.CHUNK_UPDATES.tooltip.3= 3 - schnellt Luede vun der Welt, manner FPS +of.options.CHUNK_UPDATES.tooltip.4= 5 - schnellst Luede vun der Welt, am mannste FPS +of.options.CHUNK_UPDATES.tooltip.5=Unzuel vu Chunk Updates pro gerendert Bild. +of.options.CHUNK_UPDATES.tooltip.6=Méi héicht Wäerter kënnen d'Billerunzuel destabiliséieren. + +of.options.CHUNK_UPDATES_DYNAMIC=Dynamesch Updates +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Dynamesch Chunk Updates +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= Aus - (Standard) Standard Chunk Updates pro Bild +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= Un - méi Updates wann de Spiller roueg steet +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=Dynamesch Updates forcéiert méi Chunk Updates während +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=de Spiller roueg steet fir d'Welt méi schnell ze lueden. + +of.options.LAZY_CHUNK_LOADING=Faulenzeg Chunklueden +of.options.LAZY_CHUNK_LOADING.tooltip.1=Faulenzeg Chunklueden +of.options.LAZY_CHUNK_LOADING.tooltip.2= Aus - normaalt Server-Chunklueden +of.options.LAZY_CHUNK_LOADING.tooltip.3= Un - faulenzeg Server-Chunklueden (méi fléissend) +of.options.LAZY_CHUNK_LOADING.tooltip.4=Mécht datt d'integréiert Luede vun de Server-Chunks méi +of.options.LAZY_CHUNK_LOADING.tooltip.5=fléissend ass duerch Verdeelung vun de Chunks iwwer +of.options.LAZY_CHUNK_LOADING.tooltip.6=puer Ticks. Deaktivéier et wann Deeler vun der Welt net +of.options.LAZY_CHUNK_LOADING.tooltip.7=richteg lueden. Nëmmen effektiv am Singleplayer a bei +of.options.LAZY_CHUNK_LOADING.tooltip.8=engem Enzel-Kär CPU. + +# Animations + +of.options.animation.allOn=All un +of.options.animation.allOff=All aus +of.options.animation.dynamic=Dynamesch + +of.options.ANIMATED_WATER=Waasser animéiert +of.options.ANIMATED_LAVA=Lava animéiert +of.options.ANIMATED_FIRE=Féier animéiert +of.options.ANIMATED_PORTAL=Portal animéiert +of.options.ANIMATED_REDSTONE=Redstone animéiert +of.options.ANIMATED_EXPLOSION=Explosiounen animéiert +of.options.ANIMATED_FLAME=Flamen animéiert +of.options.ANIMATED_SMOKE=Damp animéiert +of.options.VOID_PARTICLES=Voidpartikel +of.options.WATER_PARTICLES=Waasserpartikel +of.options.RAIN_SPLASH=Reengeplätscher +of.options.PORTAL_PARTICLES=Portalpartikel +of.options.POTION_PARTICLES=Dronkpartikel +of.options.DRIPPING_WATER_LAVA=Waasser/Lavadrëpsen +of.options.ANIMATED_TERRAIN=Terrain animéiert +of.options.ANIMATED_TEXTURES=Texturen animéiert +of.options.FIREWORK_PARTICLES=Féierwierkpartikel + +# Other + +of.options.LAGOMETER=Lagometer +of.options.LAGOMETER.tooltip.1=Wéist de Lagometer um Debugbildschierm un (F3). +of.options.LAGOMETER.tooltip.2=* Orange - Memoiredrécksammlung +of.options.LAGOMETER.tooltip.3=* Turqoise - Tick +of.options.LAGOMETER.tooltip.4=* Blo - geplangten Ausféierungen +of.options.LAGOMETER.tooltip.5=* Mof - Chunk eroplueden +of.options.LAGOMETER.tooltip.6=* Roud - Chunk updaten +of.options.LAGOMETER.tooltip.7=* Giel - Siichtbarkeetstest +of.options.LAGOMETER.tooltip.8=* Gréng - Terrain rendern + +of.options.PROFILER=Debug Profiler +of.options.PROFILER.tooltip.1=Debug Profiler +of.options.PROFILER.tooltip.2= Un - Debug Profiler ass aktiv, méi lues +of.options.PROFILER.tooltip.3= Aus - Debug Profiler ass net aktiv, méi schnell +of.options.PROFILER.tooltip.4=Den Debug Profiler sammel a weist Debug Informatiounen +of.options.PROFILER.tooltip.5=un wann den Debugbildschierm un ass (F3) + +of.options.WEATHER=Wieder +of.options.WEATHER.tooltip.1=Wieder +of.options.WEATHER.tooltip.2= Un - Wieder ass aktiv, méi lues +of.options.WEATHER.tooltip.3= Aus - Wieder ass net aktiv, méi schnell +of.options.WEATHER.tooltip.4=D'Wieder kontrolléiert de Reen, Schnéi an Donnerwieder. +of.options.WEATHER.tooltip.5=D'Wiederkontroll ass nëmmen am Singleplayer méiglech. + +of.options.time.dayOnly=Nëmmen Dag +of.options.time.nightOnly=Nëmmen Nuecht + +of.options.TIME=Zäit +of.options.TIME.tooltip.1=Zäit +of.options.TIME.tooltip.2= Standard - normalen Dag/Nuecht Zyklus +of.options.TIME.tooltip.3= Nëmmen Dag - Nëmmen Dag +of.options.TIME.tooltip.4= Nëmmen Nuecht - Nëmmen Nuecht +of.options.TIME.tooltip.5=D'Zäitastellunge sinn nëmmen effektiven am Kreativemodus +of.options.TIME.tooltip.6=an am Singleplayer. + +options.fullscreen.tooltip.1=Vollbild +options.fullscreen.tooltip.2= Un - benotz de Vollbildmodus +options.fullscreen.tooltip.3= Aus - benotz de Fenstermodus +options.fullscreen.tooltip.4=De Vollbildmodus ka méi schnell oder awer méi lues sinn +options.fullscreen.tooltip.5=wéi de Fenstermodus ofhängeg vun denger Grafikkaart. + +of.options.FULLSCREEN_MODE=Vollbildmodus +of.options.FULLSCREEN_MODE.tooltip.1=Vollbildmodus +of.options.FULLSCREEN_MODE.tooltip.2= Standard - benotz d'Desktop-Opléisung, méi lues +of.options.FULLSCREEN_MODE.tooltip.3= WxH - benotz eng eege Opléisung, ka méi schnell sinn +of.options.FULLSCREEN_MODE.tooltip.4=D'ausgewielten Opléisung gëtt am Vollbildmodus +of.options.FULLSCREEN_MODE.tooltip.5=benotzt (F11). +of.options.FULLSCREEN_MODE.tooltip.6=Eng méi eng geréng Opléisung sollt méi schnell sinn. + +of.options.SHOW_FPS=FPS uweisen +of.options.SHOW_FPS.tooltip.1=Weis kompriméiert FPS a Render Informatiounen +of.options.SHOW_FPS.tooltip.2= C: - gerendert Chunks +of.options.SHOW_FPS.tooltip.3= E: - gerendert Objet a Bléck +of.options.SHOW_FPS.tooltip.4= U: - Chunk Updates +of.options.SHOW_FPS.tooltip.5=D'kompakt FPS Informatioune ginn nëmmen ugewisen +of.options.SHOW_FPS.tooltip.6=wann de Debug-Bildschierm net siichtbar ass. + +of.options.save.default=Standard (2s) +of.options.save.20s=20s +of.options.save.3min=3min +of.options.save.30min=30min + +of.options.AUTOSAVE_TICKS=Autospäicheren +of.options.AUTOSAVE_TICKS.tooltip.1=Autospäicher Intervall +of.options.AUTOSAVE_TICKS.tooltip.2=Den normalen Autospäicher Intervall (2s) ass net +of.options.AUTOSAVE_TICKS.tooltip.3=recommandéiert +of.options.AUTOSAVE_TICKS.tooltip.4=Autospäichere verursaacht de bekannte Lag vum Doud. diff --git a/src/minecraft/assets/minecraft/optifine/lang/pl_PL.lang b/src/minecraft/assets/minecraft/optifine/lang/pl_PL.lang new file mode 100644 index 0000000..5f658f4 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/pl_PL.lang @@ -0,0 +1,585 @@ +# Contributors of Polish localization # +# Kamil7430 2016-03-14 -- 2017-03-12 # + +# General +of.general.ambiguous=dwuznaczny +of.general.custom=Inny +of.general.from=Od +of.general.id=Id +of.general.restart=restart +of.general.smart=Smart + +# Keys +of.key.zoom=Zoom (przybliżenie) + +# Message +of.message.aa.shaders1=Antyaliasing nie jest kompatybilny z Shaderami. +of.message.aa.shaders2=Proszę, wyłącz Shadery, aby używać tej opcji. + +of.message.af.shaders1=Filtrowanie anizotropowe nie jest kompatybilne z Shaderami. +of.message.af.shaders2=Proszę, wyłącz Shadery, aby używać tej opcji. + +of.message.fr.shaders1=Szybkie renderowanie nie jest kompatybilne z Shaderami. +of.message.fr.shaders2=Proszę, wyłącz Shadery, aby używać tej opcji. + +of.message.an.shaders1=Anaglifowe 3D nie jest kompatybilne z Shaderami. +of.message.an.shaders2=Proszę, wyłącz Shadery, aby używać tej opcji. + +of.message.shaders.aa1=Shadery nie są kompatybilne z antyaliasingiem. +of.message.shaders.aa2=Proszę, wyłącz opcję Jakość -> Antyaliasing, a następnie zrestartuj grę. + +of.message.shaders.af1=Shadery nie są kompatybilne z filtrowaniem anizotropowym. +of.message.shaders.af2=Proszę, wyłącz opcję Jakość -> Filtrowanie anizotropowe. + +of.message.shaders.fr1=Shadery nie są kompatybilne z szybkim renderowaniem. +of.message.shaders.fr2=Proszę, wyłącz opcję Wydajność -> Szybkie renderowanie. + +of.message.shaders.an1=Shadery nie są kompatybilne z anaglifowym 3D. +of.message.shaders.an2=Proszę, wyłącz opcję Inne -> Anaglifowe 3D. + +of.message.newVersion=Nowa wersja §eOptiFine§f jest dostępna: §e%s§f +of.message.java64Bit=Zalecamy zainstalowanie §e64-bitowego środowiska Java§f, aby podwyższyć wydajność. +of.message.openglError=§eBłąd OpenGL§f: %s (%s) + +of.message.shaders.loading=Wczytuję shadery: %s + +of.message.other.reset=Czy chcesz przywrócić wszystkie ustawienia graficzne do ich domyślnych wartości? + +of.message.loadingVisibleChunks=Wczytywanie widzialnych chunków + +# Video settings + +options.graphics.tooltip.1=Jakość grafiki +options.graphics.tooltip.2= Szybka - niższa jakość, większa wydajność +options.graphics.tooltip.3= Dokładna - wyższa jakość, mniejsza wydajność +options.graphics.tooltip.4=Zmienia wygląd chmur, liści, wody, +options.graphics.tooltip.5=cieni oraz boków bloków trawy. + +of.options.renderDistance.extreme=Ekstremalna + +options.renderDistance.tooltip.1=Odległość renderowania +options.renderDistance.tooltip.2= 2 Niewielka - 32m (najwyższa wydajność) +options.renderDistance.tooltip.3= 4 Krótka - 64m (wysoka wydajność) +options.renderDistance.tooltip.4= 8 Normalna - 128m +options.renderDistance.tooltip.5= 16 Długa - 256m (niska wydajność) +options.renderDistance.tooltip.6= 32 Ekstremalna - 512m (najniższa wydajność) +options.renderDistance.tooltip.7=Odległość renderowania ekstremalna jest bardzo zasobożerna! +options.renderDistance.tooltip.8=Wartości powyżej 16 Długa są zalecane tylko do lokalnych światów. + +options.ao.tooltip.1=Gładkie oświetlenie +options.ao.tooltip.2= Wył. - brak wygładzania oświetlenia (wysoka wydajność) +options.ao.tooltip.3= Min. - podstawowe wygładzanie oświetlenia (niska wydajność) +options.ao.tooltip.4= Maks. - pełne wygładzanie oświetlenia (najniższa wydajność) + +options.framerateLimit.tooltip.1=Limit klatek/s (FPS) +options.framerateLimit.tooltip.2= VSync - ograniczone do możliwości monitora (60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - ograniczone do podanej wartości +options.framerateLimit.tooltip.4= Nielimitowane - brak limitu (najwyższa wydajność) +options.framerateLimit.tooltip.5=Limit klatek zmiejsza FPS, nawet, gdy wartość +options.framerateLimit.tooltip.6=graniczna nie została osiągnięta. +of.options.framerateLimit.vsync=VSync + +of.options.AO_LEVEL=Poziom wygładzania oświetlenia +of.options.AO_LEVEL.tooltip.1=Poziom wygładzania oświetlenia +of.options.AO_LEVEL.tooltip.2= Wył. - brak cieni +of.options.AO_LEVEL.tooltip.3= 50%% - jasne cienie +of.options.AO_LEVEL.tooltip.4= 100%% - ciemne cienie + +options.viewBobbing.tooltip.1=Bardziej realistyczne poruszanie się. +options.viewBobbing.tooltip.2=Gdy uzywasz mipmap, wyłącz tę opcję, aby podwyższyć wydajność. + +options.guiScale.tooltip.1=Wielkość Interfejsu +options.guiScale.tooltip.2=Mniejszy interfejs może podyższyć wydajność + +options.vbo.tooltip.1=Vertex Buffer Objects +options.vbo.tooltip.2=Używa alternatywnej metody renderowania, która jest +options.vbo.tooltip.3=szybsza (o 5-10%%) niż zwykła metoda. + +options.gamma.tooltip.1=Podwyższa jasność ciemnych obiektów +options.gamma.tooltip.2= Nastrojowa - standardowa jasność +options.gamma.tooltip.3= 1%%-99%% - możliwość dostosowania jasności +options.gamma.tooltip.4= Jaskrawa - maksymalna jasność ciemnych obiektów +options.gamma.tooltip.5=Ta opcja nie podwyższa jasności obiektów, które +options.gamma.tooltip.6=są w pełni czarne. + +options.anaglyph.tooltip.1=Anaglify 3D +options.anaglyph.tooltip.2=Włącza stereoskopowy efekt 3D używając różnych kolorów +options.anaglyph.tooltip.3=dla każdego oka. +options.anaglyph.tooltip.4=Wymaga czerwono-niebieskich okularów. + +options.blockAlternatives.tooltip.1=Alternatywne bloki +options.blockAlternatives.tooltip.2=Używa alternatywnych modeli dla niektóych bloków. +options.blockAlternatives.tooltip.3=Bazowane na wybranyej paczce tekstur. + +of.options.ALTERNATE_BLOCKS=Alternatywne bloki +of.options.blockAlternatives.tooltip.1=Alternatywne bloki +of.options.blockAlternatives.tooltip.2=Używa alternatywnych modeli dla niektóych bloków. +of.options.blockAlternatives.tooltip.3=Bazowane na wybranyej paczce tekstur. + +of.options.FOG_FANCY=Mgła +of.options.FOG_FANCY.tooltip.1=Typ mgły +of.options.FOG_FANCY.tooltip.2= Szybka - szybka mgła +of.options.FOG_FANCY.tooltip.3= Dokładna - ładniejsza mgła, zmniejsza wydajność +of.options.FOG_FANCY.tooltip.4= Wył. - brak mgły, najwyższa wydajność +of.options.FOG_FANCY.tooltip.5=Dokładna mgła jest dostępna jedynie, jeżeli +of.options.FOG_FANCY.tooltip.6=obsługuje ją karta graficzna. + +of.options.FOG_START=Początkowa mgła +of.options.FOG_START.tooltip.1=Początkowa mgła +of.options.FOG_START.tooltip.2= 0.2 - mgła startuje w pobliżu gracza +of.options.FOG_START.tooltip.3= 0.8 - mgła startuje z dala od gracza +of.options.FOG_START.tooltip.4=Ta opcja zazwyczaj nie zmienia wydajności. + +of.options.CHUNK_LOADING=Ładowanie chunków +of.options.CHUNK_LOADING.tooltip.1=Ładowanie chunków +of.options.CHUNK_LOADING.tooltip.2= Domyślne - niestabilne FPS podczas ładowania chunków +of.options.CHUNK_LOADING.tooltip.3= Gładkie - stabilne FPS +of.options.CHUNK_LOADING.tooltip.4= Wielordzeniowe - stabilne FPS, 3 razy szybsze ładowanie świata +of.options.CHUNK_LOADING.tooltip.5=Opcje Gładkie i Wielordzeniowe zredukują +of.options.CHUNK_LOADING.tooltip.6=przycięcia spowodowane ładowaniem chunków. +of.options.CHUNK_LOADING.tooltip.7=Opcja Wielordzeniowe może trzykrotnie przyspieszyć ładowanie +of.options.CHUNK_LOADING.tooltip.8=oraz podwyższyć FPS używając dodatkowego rdzenia. +of.options.chunkLoading.smooth=Gładkie +of.options.chunkLoading.multiCore=Wielordzeniowe + +of.options.shaders=Shadery... +of.options.shadersTitle=Shadery + +of.options.shaders.packNone=Wyłączone +of.options.shaders.packDefault=Wewnętrzne + +of.options.shaders.ANTIALIASING=Antyaliasing +of.options.shaders.NORMAL_MAP=Normalna mapa +of.options.shaders.SPECULAR_MAP=Lustrzana mapa +of.options.shaders.RENDER_RES_MUL=Jakość renderowania +of.options.shaders.SHADOW_RES_MUL=Jakość cieni +of.options.shaders.HAND_DEPTH_MUL=Głębokość ręki +of.options.shaders.CLOUD_SHADOW=Cienie chmur +of.options.shaders.OLD_HAND_LIGHT=Stare oświetlanie ręki +of.options.shaders.OLD_LIGHTING=Stare oświetlanie +of.options.shaders.SHADER_PACK=Paczka shaderów + +of.options.shaders.shadersFolder=Folder na shadery +of.options.shaders.shaderOptions=Ustawienia shaderów... + +of.options.shaderOptionsTitle=Ustawienia shaderów + +of.options.quality=Jakość... +of.options.qualityTitle=Ustawienia jakości + +of.options.details=Detale... +of.options.detailsTitle=Ustawienia detali + +of.options.performance=Wydajność... +of.options.performanceTitle=Ustawienia wydajności + +of.options.animations=Animacje... +of.options.animationsTitle=Ustawienia animacji + +of.options.other=Inne... +of.options.otherTitle=Inne ustawienia + +of.options.other.reset=Przywróć domyślne ustawienia graficzne... + +of.shaders.profile=Profil + +# Quality + +of.options.mipmap.bilinear=Dwuliniowe +of.options.mipmap.linear=Liniowy +of.options.mipmap.nearest=Najbliższy +of.options.mipmap.trilinear=Trójliniowy + +options.mipmapLevels.tooltip.1=Efekt wizualny, który sprawia, że odległe bloki wyglądają +options.mipmapLevels.tooltip.2=lepiej poprzez wygładzanie detali tekstur +options.mipmapLevels.tooltip.3= Wył. - brak wygładzania +options.mipmapLevels.tooltip.4= 1 - minimalne wygładzanie +options.mipmapLevels.tooltip.5= 4 - maksymalne wygładzanie +options.mipmapLevels.tooltip.6=Ta opcja nie ma wpływu na wydajność. + +of.options.MIPMAP_TYPE=Typ mipmapy +of.options.MIPMAP_TYPE.tooltip.1=Efekt wizualny, który sprawia, że odległe bloki wyglądają +of.options.MIPMAP_TYPE.tooltip.2=lepiej poprzez wygładzanie detali tekstur +of.options.MIPMAP_TYPE.tooltip.3= Najbliższy - szorstkie wygładzanie (najwyższa wydajność) +of.options.MIPMAP_TYPE.tooltip.4= Liniowy - normalne wygładzanie +of.options.MIPMAP_TYPE.tooltip.5= Dwuliniowy - ładne wygładzanie +of.options.MIPMAP_TYPE.tooltip.6= Trójliniowe - najładniejsze wygładzanie (najniższa wydajność) + + +of.options.AA_LEVEL=Antyaliasing +of.options.AA_LEVEL.tooltip.1=Antyaliasing +of.options.AA_LEVEL.tooltip.2= OFF - (domyślne) brak antyaliasingu (wyższa wydajność) +of.options.AA_LEVEL.tooltip.3= 2-16 - antyaliasing linii i rogów (nizsza wydajność) +of.options.AA_LEVEL.tooltip.4=Antyaliasing wygładza poszarpane linie i +of.options.AA_LEVEL.tooltip.5=ostre przejścia kolorów. +of.options.AA_LEVEL.tooltip.6=Gdy włączone, może mocno obniżyć ilość FPS. +of.options.AA_LEVEL.tooltip.7=Niektóre poziomy są nieobsługiwane przez niektóre karty graficzne. +of.options.AA_LEVEL.tooltip.8=Wymaga restartu! + +of.options.AF_LEVEL=Wygładzanie Anizotropowe +of.options.AF_LEVEL.tooltip.1=Wygładzanie anizotropowe +of.options.AF_LEVEL.tooltip.2= Wył. - (domyślne) standarowe detale tekstur (najwyższa wydajność) +of.options.AF_LEVEL.tooltip.3= 2-16 - ładniejsze detale w mipmapowanych teksturach (niższa wydajność) +of.options.AF_LEVEL.tooltip.4=Filtrowanie anizotropowe pokazuje detale w +of.options.AF_LEVEL.tooltip.5=mipmapowanych teksturach. +of.options.AF_LEVEL.tooltip.6=Gdy włączone, może mocno obniżyć FPS. + +of.options.CLEAR_WATER=Czysta woda +of.options.CLEAR_WATER.tooltip.1=Czysta woda +of.options.CLEAR_WATER.tooltip.2= Wł. - czysta, przezroczysta woda +of.options.CLEAR_WATER.tooltip.3= Wył. - domyślna woda + +of.options.RANDOM_MOBS=Losowe moby +of.options.RANDOM_MOBS.tooltip.1=Losowe tekstury mobów +of.options.RANDOM_MOBS.tooltip.2= Wył. - brak losowych tekstur mobów, wyższa wydajność +of.options.RANDOM_MOBS.tooltip.3= Wł. - włączone losowe tekstury mobów, niższa wydajność +of.options.RANDOM_MOBS.tooltip.4=Ta opcja używa losowych tekstur dla mobów w grze. +of.options.RANDOM_MOBS.tooltip.5=Wymaga paczki tesktur z wieloma teksturami dla jednego moba. + +of.options.BETTER_GRASS=Ładniejsza trawa +of.options.BETTER_GRASS.tooltip.1=Ładniejsza trawa +of.options.BETTER_GRASS.tooltip.2= Wył. - domyślne boki bloków trawy, najwyższa wydajność +of.options.BETTER_GRASS.tooltip.3= Szybka - pełne boki bloków trawy, niższa wydajność +of.options.BETTER_GRASS.tooltip.4= Dokładna - dynamiczne boki bloków trawy, najniższa wydajność + +of.options.BETTER_SNOW=Ładniejszy śnieg +of.options.BETTER_SNOW.tooltip.1=Ładniejszy śnieg +of.options.BETTER_SNOW.tooltip.2= Wył. - domyślny śnieg, wyższa wydajność +of.options.BETTER_SNOW.tooltip.3= Wł. - ładniejszy śnieg, mniejsza wydajność +of.options.BETTER_SNOW.tooltip.4=Pokazuje śnieg pod przezroczystymi blokami (płot, wysoka +of.options.BETTER_SNOW.tooltip.5=trawa) gdy graniczą ze śniegiem + +of.options.CUSTOM_FONTS=Własne czcionki +of.options.CUSTOM_FONTS.tooltip.1=Własne czcionki +of.options.CUSTOM_FONTS.tooltip.2= Wł. - używa innych czcionek (domyślne), niższa wydajność +of.options.CUSTOM_FONTS.tooltip.3= Wył. - używa domyślnej czcionki, wyższa wydajność +of.options.CUSTOM_FONTS.tooltip.4=Własne czcionki są często dodawane do +of.options.CUSTOM_FONTS.tooltip.5=paczek tekstur + +of.options.CUSTOM_COLORS=Własne kolory +of.options.CUSTOM_COLORS.tooltip.1=Własne kolory +of.options.CUSTOM_COLORS.tooltip.2= Wł. - używa własnych kolorów (domyślne), nizsza wydajność +of.options.CUSTOM_COLORS.tooltip.3= Wył. - uzywa domyślnych kolorów, wyższa wydajność +of.options.CUSTOM_COLORS.tooltip.4=Własne kolory są często dodawane do +of.options.CUSTOM_COLORS.tooltip.5=paczek tekstur + +of.options.SWAMP_COLORS=Bagienne kolory +of.options.SWAMP_COLORS.tooltip.1=Bagienne kolory +of.options.SWAMP_COLORS.tooltip.2= Wł. - używa kolorów bagiennych (domyślne), niższa wydajność +of.options.SWAMP_COLORS.tooltip.3= Wył. - nie używa kolorów baginnych, wyższa wydajność +of.options.SWAMP_COLORS.tooltip.4=Kolory bagienne są użwane na liściach, trawie, winoroślach oraz wodzie. + +of.options.SMOOTH_BIOMES=Gładkie biomy +of.options.SMOOTH_BIOMES.tooltip.1=Gładkie przejścia biomów +of.options.SMOOTH_BIOMES.tooltip.2= Wł. - gładkie przejścia biomów (domyślne), niższa wydajność +of.options.SMOOTH_BIOMES.tooltip.3= Wył. - brak gładkiego przejścia biomów, wyższa wydajność +of.options.SMOOTH_BIOMES.tooltip.4=Wygładzanie krawędzi biomów działa na zasadzie +of.options.SMOOTH_BIOMES.tooltip.5=gładkiego przejścia kolorów liści, winorośli, +of.options.SMOOTH_BIOMES.tooltip.6=wody oraz trawy. + +of.options.CONNECTED_TEXTURES=Połączone tekstury +of.options.CONNECTED_TEXTURES.tooltip.1=Połączone tekstury +of.options.CONNECTED_TEXTURES.tooltip.2= Wył. - brak połączonych tekstur (domyślne) +of.options.CONNECTED_TEXTURES.tooltip.3= Szybka - szybkie połączone tekstury +of.options.CONNECTED_TEXTURES.tooltip.4= Dokładna - ładne połączone tekstury +of.options.CONNECTED_TEXTURES.tooltip.5=Ta opcja łączy postawione obok siebie szkło, +of.options.CONNECTED_TEXTURES.tooltip.6=piaskowiec i biblioteczki. +of.options.CONNECTED_TEXTURES.tooltip.7=Połączone tekstury są pobierane z +of.options.CONNECTED_TEXTURES.tooltip.8=aktualnej paczki tekstur. + +of.options.NATURAL_TEXTURES=Naturalne tekstury +of.options.NATURAL_TEXTURES.tooltip.1=Naturalne tekstury +of.options.NATURAL_TEXTURES.tooltip.2= Wył. - brak naturalnych tekstur (domyślne) +of.options.NATURAL_TEXTURES.tooltip.3= Wł. - używa naturalnych tekstur +of.options.NATURAL_TEXTURES.tooltip.4=Ta opcja usuwa wyglądające jak siatka tekstury +of.options.NATURAL_TEXTURES.tooltip.5=stworzone poprzez używanie w kółko tej samej tekstury. +of.options.NATURAL_TEXTURES.tooltip.6=Ta opcje używa obróconych tekstur bloków. +of.options.NATURAL_TEXTURES.tooltip.7=Konfiguracja naturalnych tekstur jest pobierana +of.options.NATURAL_TEXTURES.tooltip.8=z aktualnej paczki tekstur. + +of.options.CUSTOM_SKY=Własne niebo +of.options.CUSTOM_SKY.tooltip.1=Własne niebo +of.options.CUSTOM_SKY.tooltip.2= Wł. - tekstury własnego nieba włączone (domyślne), niższa wydajność +of.options.CUSTOM_SKY.tooltip.3= Wył. - domyślne niebo, wyższa wydajność +of.options.CUSTOM_SKY.tooltip.4=Własne niebo jest pobierane +of.options.CUSTOM_SKY.tooltip.5=z aktualnej paczki tesktur. + +of.options.CUSTOM_ITEMS=Własne przedmioty +of.options.CUSTOM_ITEMS.tooltip.1=Własne przedmioty +of.options.CUSTOM_ITEMS.tooltip.2= Wł. - własne tekstury przedmiotów (domyślne), niższa wydajność +of.options.CUSTOM_ITEMS.tooltip.3= Wył. - domyślne tesktury przedmiotów, wyższa wydajność +of.options.CUSTOM_ITEMS.tooltip.4=Własne tekstury przedmiotów są pobierane +of.options.CUSTOM_ITEMS.tooltip.5=z aktualnej paczki tekstur. + +of.options.CUSTOM_ENTITY_MODELS=Własne modele mobów +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=Własne modele mobów i innych podmiotów +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= Wł. - opcja włączona (domyślne), wolniej +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= Wył. - opcja wyłączona, szybciej +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=Własne modele są pobierane z +of.options.CUSTOM_ENTITY_MODELS.tooltip.5=aktualnej paczki tekstur. + +# Details + +of.options.CLOUDS=Chmury +of.options.CLOUDS.tooltip.1=Chmury +of.options.CLOUDS.tooltip.2= Domyślne - dopasowane do ustawienia graficznego +of.options.CLOUDS.tooltip.3= Szybka - niska jakość, wysoka wydajność +of.options.CLOUDS.tooltip.4= Dokładna - wyższa jakość, niska wydajność +of.options.CLOUDS.tooltip.5= Wył. - brak chmur, najwyższa wydajność +of.options.CLOUDS.tooltip.6=Szybkie chmury są renderowane w 2D. +of.options.CLOUDS.tooltip.7=Dokładne chmury są renderowane w 3D. + +of.options.CLOUD_HEIGHT=Wysokość chmur +of.options.CLOUD_HEIGHT.tooltip.1=Wyskość chmur +of.options.CLOUD_HEIGHT.tooltip.2= Wył. - domyślna wysokość +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - powyżej limitu wysokości świata + +of.options.TREES=Drzewa +of.options.TREES.tooltip.1=Drzewa +of.options.TREES.tooltip.2= Domyślne - dostosowane do ustawienia graficznego +of.options.TREES.tooltip.3= Szybka - niższa jakość, wyższa wydajność +of.options.TREES.tooltip.4= Smart - wyższa jakość, niższa wydajność +of.options.TREES.tooltip.5= Dokładna - najwyższa jakość, najniższa wydajność +of.options.TREES.tooltip.6=Szybkie drzewa mają wypełnione liście. +of.options.TREES.tooltip.7=Szybkie i smart drzewa mają przezroczyste liście. + +of.options.RAIN=Deszcz i śnieg +of.options.RAIN.tooltip.1=Deszcz i śnieg +of.options.RAIN.tooltip.2= Domyślne - dostosowane do ustawienia graficznego +of.options.RAIN.tooltip.3= Szybka - lekki deszcz/śnieg, wyższa wydajność +of.options.RAIN.tooltip.4= Dokładna - ciężki deszcz/śnieg, niższa wydajność +of.options.RAIN.tooltip.5= Wył. - brak deszczu/śniegu, najwyższa wydajność +of.options.RAIN.tooltip.6=Gdy deszcz jest wyłączony, dźwięki nadal +of.options.RAIN.tooltip.7=są aktywne. + +of.options.SKY=Niebo +of.options.SKY.tooltip.1=Niebo +of.options.SKY.tooltip.2= Wł. - niebo jest widoczne, niższa wydajność +of.options.SKY.tooltip.3= Wył. - niebo jest niewidoczne, wyższa wydajność +of.options.SKY.tooltip.4=Gdy niebo jest wyłączone, słońce i księżyc nadal są widoczne. + +of.options.STARS=Gwiazdy +of.options.STARS.tooltip.1=Gwiazdy +of.options.STARS.tooltip.2= Wł. - gwiazdy są widoczne, niższa wydajność +of.options.STARS.tooltip.3= Wył. - gwiazdy są niewidoczne, wyższa wydajność + +of.options.SUN_MOON=Słońce i Księżyc +of.options.SUN_MOON.tooltip.1=Słońce i Księżyc +of.options.SUN_MOON.tooltip.2= Wł. - słońce i księżyc są widoczne (domyślne) +of.options.SUN_MOON.tooltip.3= Wył. - słońce i księżyc są niewidoczne (wyższa wydajność) + +of.options.SHOW_CAPES=Pokazuj peleryny +of.options.SHOW_CAPES.tooltip.1=Pokazuj peleryny +of.options.SHOW_CAPES.tooltip.2= Wł. - pokazuje peleryny graczy (domyślne) +of.options.SHOW_CAPES.tooltip.3= Wył. - nie pokazuje peleryn graczy + +of.options.TRANSLUCENT_BLOCKS=Prześwitujące bloki +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Prześwitujące bloki +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Dokładna - poprawne mieszanie kolorów (domyślne) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Szybka - szybkie mieszanie kolorów (wyższa wydajność) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Kontroluje mieszanie kolorów bloków przezroczystych +of.options.TRANSLUCENT_BLOCKS.tooltip.5=w różnych kolorach (utawrdzone szkło, woda, lód) +of.options.TRANSLUCENT_BLOCKS.tooltip.6=gdy pod nimi są bloki inne niż powietrze. + +of.options.HELD_ITEM_TOOLTIPS=Nazwy trzym. przedm. +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Nazwy trzymanych przedmiotów nad interfejsem +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= Wł. - pokazuj nazwy przedmiotów (domyślne) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= Wył. - nie pokazuj nazw przedmiotów + +of.options.ADVANCED_TOOLTIPS=Dokładne dane przedmiotów +of.options.ADVANCED_TOOLTIPS.tooltip.1=Dokładne dane przedmiotów, bloków oraz narzędzi +of.options.ADVANCED_TOOLTIPS.tooltip.2= Wł. - pokazuj dokładne dane +of.options.ADVANCED_TOOLTIPS.tooltip.3= Wył. - nie pokazuj dokładnych danych (domyślne) +of.options.ADVANCED_TOOLTIPS.tooltip.4=Ta opcja pokazuje więcej informacji o dowolnym +of.options.ADVANCED_TOOLTIPS.tooltip.5=przedmiocie (id, wytrzymałość), a także dane o nim +of.options.ADVANCED_TOOLTIPS.tooltip.6=dla shaderów (id, źródło, domyślna wartość). + +of.options.DROPPED_ITEMS=Upuszczone przedmioty +of.options.DROPPED_ITEMS.tooltip.1=Upuszczone przedmioty +of.options.DROPPED_ITEMS.tooltip.2= Domyślne - przystosowane do ustawienia graficznego +of.options.DROPPED_ITEMS.tooltip.3= Szybka - upuszczone przedmioty w 2D, wyższa wydajność +of.options.DROPPED_ITEMS.tooltip.4= Dokładna - upuszczone przedmioty w 3D, niższa wydajność + +options.entityShadows.tooltip.1=Cienie bytów +options.entityShadows.tooltip.2= Wł. - Włącza cienie pod bytami +options.entityShadows.tooltip.3= Wył. - Wyłącza cienie pod bytami + +of.options.VIGNETTE=Winieta +of.options.VIGNETTE.tooltip.1=Efekt wizualny, który delikatnie przyciemnia rogi ekranu +of.options.VIGNETTE.tooltip.2= Domyślne - dostosowane do ustawienia graficznego (domyślne) +of.options.VIGNETTE.tooltip.3= Szybka - winieta wyłączona (wyższa wydajność) +of.options.VIGNETTE.tooltip.4= Dokładna - winieta włączona (niższa wydajność) +of.options.VIGNETTE.tooltip.5=Winieta może w małym stopniu obniżyć FPS, +of.options.VIGNETTE.tooltip.6=szczególnie przy grze na pełnym ekranie. +of.options.VIGNETTE.tooltip.7=Efekt winiety jest subtelny i może być +of.options.VIGNETTE.tooltip.8=bezproblemowo wyłączony. + +of.options.DYNAMIC_FOV=Dynamiczne FOV +of.options.DYNAMIC_FOV.tooltip.1=Dynamiczne FOV +of.options.DYNAMIC_FOV.tooltip.2= Wł. - włącza dynamiczne FOV (domyślne) +of.options.DYNAMIC_FOV.tooltip.3= Wył. - wyłącza dynamiczne FOV +of.options.DYNAMIC_FOV.tooltip.4=Zmienia pole widzenia (FOV), gdy latasz +of.options.DYNAMIC_FOV.tooltip.5=sprintujesz lub naciągasz łuk. + +of.options.DYNAMIC_LIGHTS=Dynamiczne światło +of.options.DYNAMIC_LIGHTS.tooltip.1=Dynamiczne światło +of.options.DYNAMIC_LIGHTS.tooltip.2= Wył. - funkcja dynamicznego światła wyłączona (domyślne) +of.options.DYNAMIC_LIGHTS.tooltip.3= Szybka - proste dynamiczne światła - aktualizowane co 500ms +of.options.DYNAMIC_LIGHTS.tooltip.4= Dokładna - zaawansowane dynamiczne światło - aktualizowane na bieżąco +of.options.DYNAMIC_LIGHTS.tooltip.5=Przedmioty świecące (pochodnia, jasnopył, itp.) +of.options.DYNAMIC_LIGHTS.tooltip.6=oświetlają teren, gdy są w Twojej dłoni, +of.options.DYNAMIC_LIGHTS.tooltip.7=dłoni innego gracza lub gdy są upuszczone na podłoże. + +# Performance + +of.options.SMOOTH_FPS=Stabilne FPS +of.options.SMOOTH_FPS.tooltip.1=Stablilizuje FPS poprzez oczyszczanie buforów sterownika +of.options.SMOOTH_FPS.tooltip.2= Wył. - brak stabilizacji, FPS mogą oscylować +of.options.SMOOTH_FPS.tooltip.3= Wł. - FPS jest stabilizowane +of.options.SMOOTH_FPS.tooltip.4=Ta opcja jest zależna od karty graficznej, więc +of.options.SMOOTH_FPS.tooltip.5=różnica nie zawsze może być zauważalna + +of.options.SMOOTH_WORLD=Stabilny świat +of.options.SMOOTH_WORLD.tooltip.1=Usuwa nagłe lagi spowodowane serwerem wewnętrznym. +of.options.SMOOTH_WORLD.tooltip.2= Wył. - brak stabilizacji, FPS mogą oscylować +of.options.SMOOTH_WORLD.tooltip.3= Wł. - FPS jest stabilizowane +of.options.SMOOTH_WORLD.tooltip.4=Stabilizuje FPS poprzez rozdzielenie obciążenia wewnętrznego serwera. +of.options.SMOOTH_WORLD.tooltip.5=Działa tylko w lokalnych światach (tryb jednoosobowy). + +of.options.FAST_RENDER=Szybkie renderowanie +of.options.FAST_RENDER.tooltip.1=Szybkie renderowanie +of.options.FAST_RENDER.tooltip.2= Wył. - standardowe rederowanie (domyślne) +of.options.FAST_RENDER.tooltip.3= Wł. - zoptymalizowane renderowanie (wyższa wydajność) +of.options.FAST_RENDER.tooltip.4=Używa zoptymalizowanego algorytmu renderowania, który zmniejsza +of.options.FAST_RENDER.tooltip.5=obciązenie CPU, a tym samym zwiększa FPS. + +of.options.FAST_MATH=Szybka matematyka +of.options.FAST_MATH.tooltip.1=Szybka matematyka +of.options.FAST_MATH.tooltip.2= Wył. - standardowa matematyka (domyślne) +of.options.FAST_MATH.tooltip.3= Wł. - przyspieszona matematyka +of.options.FAST_MATH.tooltip.4=Używa zoptymalizowanych działań sin() i cos(), które +of.options.FAST_MATH.tooltip.5=lepiej wykorzystują pamięć procesora i zwiększa FPS. + +of.options.CHUNK_UPDATES=Aktualizacje chunków +of.options.CHUNK_UPDATES.tooltip.1=Aktualizacje chunków +of.options.CHUNK_UPDATES.tooltip.2= 1 - wolniejsze wczytywanie świata, więcej FPS (domyślne) +of.options.CHUNK_UPDATES.tooltip.3= 3 - szybsze wczytywanie świata, mniej FPS +of.options.CHUNK_UPDATES.tooltip.4= 5 - najszybsze wczytywanie świata, najmniej FPS +of.options.CHUNK_UPDATES.tooltip.5=Liczba aktualizowanych chunków na klatkę, +of.options.CHUNK_UPDATES.tooltip.6=większa ilość może zmniejszyć stabilność FPS. + +of.options.CHUNK_UPDATES_DYNAMIC=Dynamiczne Aktualizacje +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Dynamiczne aktualizacje chunków +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= Wył. - (domyślne) standardowa aktualizacja chunków na klatkę +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= Wł. - więcej aktualizacji, gdy gracz stoi w miejscu +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=Dynamiczna aktualizacja wczytuje więcej chunków, +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=gdy gracz stoi w miejscu, aby szybciej załadować świat. + +of.options.LAZY_CHUNK_LOADING=Leniwe ładow. chunków +of.options.LAZY_CHUNK_LOADING.tooltip.1=Leniwe ładowanie chunków +of.options.LAZY_CHUNK_LOADING.tooltip.2= Wył. - domyślne wczytywanie chunków na serwerze +of.options.LAZY_CHUNK_LOADING.tooltip.3= Wł. - leniwe ładowanie chunków na serwerze (płynniej) +of.options.LAZY_CHUNK_LOADING.tooltip.4=Wygładza zintegrowane ładowanie serwerowych chunków +of.options.LAZY_CHUNK_LOADING.tooltip.5=rozdzielając chunki na kilka ticków. +of.options.LAZY_CHUNK_LOADING.tooltip.6=Wyłącz to, jeżeli części świata nie ładują się prawidłowo. +of.options.LAZY_CHUNK_LOADING.tooltip.7=Efektyne tylko na lokalnych światach i jednordzeniowych komputerach. + +# Animations + +of.options.animation.allOn=Włącz wszystko +of.options.animation.allOff=Wyłącz wszystko +of.options.animation.dynamic=Dynamicznie + +of.options.ANIMATED_WATER=Animacja wody +of.options.ANIMATED_LAVA=Animacja lawy +of.options.ANIMATED_FIRE=Animacja ognia +of.options.ANIMATED_PORTAL=Animacja portali +of.options.ANIMATED_REDSTONE=Animacja czerwonego proszku +of.options.ANIMATED_EXPLOSION=Animacja eksplozji +of.options.ANIMATED_FLAME=Animacja płomieni +of.options.ANIMATED_SMOKE=Animacja dymu +of.options.VOID_PARTICLES=Cząsteczki próżni +of.options.WATER_PARTICLES=Cząsteczki wody +of.options.RAIN_SPLASH=Cząsteczki deszczu +of.options.PORTAL_PARTICLES=Cząsteczki portali +of.options.POTION_PARTICLES=Cząsteczki mikstur +of.options.DRIPPING_WATER_LAVA=Kapiąca woda/lawa +of.options.ANIMATED_TERRAIN=Animacja terenu +of.options.ANIMATED_TEXTURES=Animacja tekstur +of.options.FIREWORK_PARTICLES=Cząsteczki fajerwerków + +# Other + +of.options.LAGOMETER=Lagomierz +of.options.LAGOMETER.tooltip.1=Pokazuje lagomierz na ekranie debugowania (F3). +of.options.LAGOMETER.tooltip.2=* Pomarańczowy - Zajęta pamięć +of.options.LAGOMETER.tooltip.3=* Cyan - Ticki +of.options.LAGOMETER.tooltip.4=* Niebieski - Zaplanowane działania +of.options.LAGOMETER.tooltip.5=* Fioletowy - Przesyłanie chunków +of.options.LAGOMETER.tooltip.6=* Czerwony - Aktualizacje chunków +of.options.LAGOMETER.tooltip.7=* Żółty - Kontrola widoczności +of.options.LAGOMETER.tooltip.8=* Zielony - Renderowanie terenu + +of.options.PROFILER=Debug Profiler +of.options.PROFILER.tooltip.1=Debug Profiler +of.options.PROFILER.tooltip.2= Wł. - debug profiler jest aktywny, niższa wydajność +of.options.PROFILER.tooltip.3= Wył. - debug profiler jest nieaktywny, wyższa wydajność +of.options.PROFILER.tooltip.4=Debug profiler zbiera i pokazuje informacje debugowania, +of.options.PROFILER.tooltip.5=gdy ekran debugowania jest włączony. (F3) + +of.options.WEATHER=Pogoda +of.options.WEATHER.tooltip.1=Pogoda +of.options.WEATHER.tooltip.2= Wł. - pogoda jest aktywna, niższa wydajność +of.options.WEATHER.tooltip.3= Wył. - pogoda jest nieaktywna, wyższa wydajność +of.options.WEATHER.tooltip.4=Pogoda kontroluje słońce, deszcz i burzę. +of.options.WEATHER.tooltip.5=Kontrola pogody jest aktywna tylko w trybie jednoosobowym. + +of.options.time.dayOnly=Jedynie dzień +of.options.time.nightOnly=Jedynie noc + +of.options.TIME=Czas +of.options.TIME.tooltip.1=Ustawienia cyklu dnia i nocy +of.options.TIME.tooltip.2= Domyślne - normalny cykl dnia i nocy +of.options.TIME.tooltip.3= Jedynie dzień - czas zatryma się na dniu +of.options.TIME.tooltip.4= Jedynie noc - czas zatrzyma się na nocy +of.options.TIME.tooltip.5=To ustawienie działa tylko w trybie kreatywnym +of.options.TIME.tooltip.6=i tylko w lokalnych światach. + +options.fullscreen.tooltip.1=Pełny ekran +options.fullscreen.tooltip.2= Wł. - uzywa trybu pełny ekran +options.fullscreen.tooltip.3= Wył. - używa trybu okienkowego +options.fullscreen.tooltip.4=Tryb pełnoekranowy może być szybszy lub wolniejszy +options.fullscreen.tooltip.5=niż tryb okienkowy, w zależności od karty graficznej. + +of.options.FULLSCREEN_MODE=Tryb pełnego ekranu +of.options.FULLSCREEN_MODE.tooltip.1=Tryby pełnego ekranu +of.options.FULLSCREEN_MODE.tooltip.2= Domyślne - używa rozdzielczości pulpitu, niższa wydajność +of.options.FULLSCREEN_MODE.tooltip.3= WxH - używa wybranej rozdzielczości, może podwyższyć wydajność +of.options.FULLSCREEN_MODE.tooltip.4=Wybrana rozdzielczość jest używana w trybie pełnoekranowym (F11). +of.options.FULLSCREEN_MODE.tooltip.5=Niższe rozdzielczości mogą przyspieszyć grę. + +of.options.SHOW_FPS=Pokazuj FPS +of.options.SHOW_FPS.tooltip.1=Pokazuje kompaktową nakładkę FPS i informacje o renderowaniu +of.options.SHOW_FPS.tooltip.2= C: - renderzy chunków +of.options.SHOW_FPS.tooltip.3= E: - zrenderowane byty + bloki +of.options.SHOW_FPS.tooltip.4= U: - aktualizacje chunków +of.options.SHOW_FPS.tooltip.5=Ta nakładka jest wyświetlana tylko wtedy, +of.options.SHOW_FPS.tooltip.6=gdy ekran debugowania jest niewidoczny. + +of.options.save.default=Domyślne (2s) +of.options.save.20s=20s +of.options.save.3min=3min +of.options.save.30min=30min + +of.options.AUTOSAVE_TICKS=Autozapis +of.options.AUTOSAVE_TICKS.tooltip.1=Częstotliwość autozapisu +of.options.AUTOSAVE_TICKS.tooltip.2=Domyślna częstotliwość (2s) jest NIEZALECANA. +of.options.AUTOSAVE_TICKS.tooltip.3=Autozapisy często powodują ścięcia gry. + +of.options.SCREENSHOT_SIZE=Rozmiar zrzutów ekranu +of.options.SCREENSHOT_SIZE.tooltip.1=Rozmiar zrzutów ekranu +of.options.SCREENSHOT_SIZE.tooltip.2= Domyślne - domyślny rozmiar +of.options.SCREENSHOT_SIZE.tooltip.3= 2x-4x - własny rozmiar +of.options.SCREENSHOT_SIZE.tooltip.4=Zapisywanie większych zrzutów może wymagać więcej pamięci, +of.options.SCREENSHOT_SIZE.tooltip.5=opcja nie jest kompatybilna z szybkim renderowaniem ani +of.options.SCREENSHOT_SIZE.tooltip.6=antyaliasingiem. Wymaga wsparcia bufora ramki GPU. diff --git a/src/minecraft/assets/minecraft/optifine/lang/ru_RU.lang b/src/minecraft/assets/minecraft/optifine/lang/ru_RU.lang new file mode 100644 index 0000000..2f93745 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/ru_RU.lang @@ -0,0 +1,594 @@ +# Contributors of Russian localization # +# Jerozgen 2016-03-01 ---- 2017-03-11 +# Dibro 2016-03-20 + +# General +of.general.ambiguous=неопределённый +of.general.custom=Пользовательский +of.general.from=Файл +of.general.id=ID +of.general.restart=после перезапуска +of.general.smart=Умно + +# Keys +of.key.zoom=Приблизить + +# Message +of.message.aa.shaders1=Антиалиасинг не совместим с шейдерами. +of.message.aa.shaders2=Пожалуйста, отключите шейдеры, чтобы включить этот параметр. + +of.message.af.shaders1=Анизотропная фильтрация не совместима с шейдерами. +of.message.af.shaders2=Пожалуйста, отключите шейдеры, чтобы включить этот параметр. + +of.message.fr.shaders1=Быстрый рендер не совместим с шейдерами. +of.message.fr.shaders2=Отключите шейдеры, чтобы включить этот параметр. + +of.message.an.shaders1=3D анаглиф не совместим с шейдерами. +of.message.an.shaders2=Отключите шейдеры, чтобы включить этот параметр. + +of.message.shaders.aa1=Шейдеры не совместимы с антиалиасингом. +of.message.shaders.aa2=Переключите Качество -> Антиалиасинг на "Выкл" и перезапустите игру. + +of.message.shaders.af1=Шейдеры не совместимы с анизотропной фильтрацией. +of.message.shaders.af2=Переключите Качество -> Анизотропная фильтрация на "Выкл". + +of.message.shaders.fr1=Шейдеры не совместимы с быстрым рендером. +of.message.shaders.fr2=Переключите Производительность -> Быстрый рендер на "Выкл". + +of.message.shaders.an1=Шейдеры не совместимы с 3D анаглифом. +of.message.shaders.an2=Переключите Прочее -> 3D анаглиф на "Выкл". + +of.message.newVersion=Доступна новая версия §eOptiFine§f: §e%s§f +of.message.java64Bit=Установите §e64-битную Java§f, чтобы повысить производительность. +of.message.openglError=§eОшибка OpenGL§f: %s (%s) + +of.message.shaders.loading=Загрузка шейдеров: %s + +of.message.other.reset=Сбросить все настройки графики к первоначальным значениям? + +of.message.loadingVisibleChunks=Загрузка видимых чанков + +# Video settings + +options.graphics.tooltip.1=Качество графики +options.graphics.tooltip.2= Быстро - низкое качество, быстрее +options.graphics.tooltip.3= Детально - высокое качество, медленнее +options.graphics.tooltip.4=Изменяет облик граней дёрна, листьев, воды, теней и облаков. +options.graphics.tooltip.5= + +of.options.renderDistance.tiny=Очень маленькая +of.options.renderDistance.short=Малая +of.options.renderDistance.normal=Нормальная +of.options.renderDistance.far=Дальняя +of.options.renderDistance.extreme=Предельная + +options.renderDistance.tooltip.1=Дальность прорисовки +options.renderDistance.tooltip.2= 2 Очень маленькая - 32м (ещё быстрее) +options.renderDistance.tooltip.3= 4 Малая - 64м (быстрее) +options.renderDistance.tooltip.4= 8 Нормальная - 128м +options.renderDistance.tooltip.5= 16 Дальняя - 256м (медленнее) +options.renderDistance.tooltip.6= 32 Предельная - 512м (ещё медленнее!) +options.renderDistance.tooltip.7=Предельная прорисовка очень требовательна к ресурсам компьютера! +options.renderDistance.tooltip.8=Значения более 16 эффективны только в локальных мирах. + +options.ao.tooltip.1=Мягкое освещение +options.ao.tooltip.2= Выкл - без мягкого освещения, быстрее +options.ao.tooltip.3= Минимум - простое мягкое освещение, медленнее +options.ao.tooltip.4= Максимум - комплексное мягкое освещение, ещё медленнее + +options.framerateLimit.tooltip.1=Частота кадров +options.framerateLimit.tooltip.2= VSync - синхронизация с частотой верт. развертки монитора (60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - пользовательские значения +options.framerateLimit.tooltip.4= Максимум - без ограничений, быстрее +options.framerateLimit.tooltip.5=Уменьшает частоту кадров, даже если ограничение не достигнуто. +options.framerateLimit.tooltip.6= +of.options.framerateLimit.vsync=VSync + +of.options.AO_LEVEL=Мягкое освещение +of.options.AO_LEVEL.tooltip.1=Уровень мягкого освещения +of.options.AO_LEVEL.tooltip.2= Выкл - без теней +of.options.AO_LEVEL.tooltip.3= 50%% - светлые тени +of.options.AO_LEVEL.tooltip.4= 100%% - тёмные тени + +options.viewBobbing.tooltip.1=Более реалистичное движение. +options.viewBobbing.tooltip.2=При использовании рекомендуется выключить MIP-текстурирование. + +options.guiScale.tooltip.1=Размер интерфейса +options.guiScale.tooltip.2= Авто - максимальный размер +options.guiScale.tooltip.3= Мелкий, обычный, крупный - от 1x до 3x +options.guiScale.tooltip.4= с 4x до 10x - доступно на мониторах с разрешением 4K +options.guiScale.tooltip.5=Нечётные значения (1x, 3x, 5x ...) не совместимы с шрифтом Unicode. +options.guiScale.tooltip.6=Чем меньше интерфейс, тем он быстрее. + +options.vbo.tooltip.1=Vertex Buffer Objects +options.vbo.tooltip.2=Использует альтернативную модель рендеринга, которая быстрее, +options.vbo.tooltip.3=чем стандартная. (5-10%%) + +options.gamma.tooltip.1=Изменяет яркость тёмных объектов. +options.gamma.tooltip.2= Тускло - стандартная яркость +options.gamma.tooltip.3= 1-99%% - пользовательские значения +options.gamma.tooltip.4= Ярко - максимальная яркость тёмных объектов +options.gamma.tooltip.5=Данный параметр не изменяет яркость полностью чёрных объектов. +options.gamma.tooltip.6= + +options.anaglyph.tooltip.1=3D Анаглиф +options.anaglyph.tooltip.2=Включает стереоскопический 3D-эффект, используя различные цвета +options.anaglyph.tooltip.3=для каждого глаза. +options.anaglyph.tooltip.4=Требуются красно-голубые очки для просмотра. + +options.blockAlternatives.tooltip.1=Альтернативные блоки +options.blockAlternatives.tooltip.2=Использование альтернативных моделей для некоторых блоков. +options.blockAlternatives.tooltip.3=Зависит от выбранного пакета ресурсов. + +of.options.ALTERNATE_BLOCKS=Альтернативные блоки +of.options.ALTERNATE_BLOCKS.tooltip.1=Альтернативные модели блоков +of.options.ALTERNATE_BLOCKS.tooltip.2=Используются альтернативные модели для некоторых блоков. +of.options.ALTERNATE_BLOCKS.tooltip.3=Зависит от выбранного пакета ресурсов. + +of.options.FOG_FANCY=Туман +of.options.FOG_FANCY.tooltip.1=Тип тумана +of.options.FOG_FANCY.tooltip.2= Быстро - быстрый туман +of.options.FOG_FANCY.tooltip.3= Детально - густой туман, выглядит лучше +of.options.FOG_FANCY.tooltip.4= Выкл - без тумана, быстрее +of.options.FOG_FANCY.tooltip.5=Густой туман будет работать, только если ваша видеокарта поддерживает его. +of.options.FOG_FANCY.tooltip.6= + +of.options.FOG_START=Удалённость тумана +of.options.FOG_START.tooltip.1=Удалённость тумана +of.options.FOG_START.tooltip.2= 0.2 - туман начинается рядом с игроком +of.options.FOG_START.tooltip.3= 0.8 - туман начинается вдали от игрока +of.options.FOG_START.tooltip.4=Этот параметр, обычно, не влияет на производительность. + +of.options.CHUNK_LOADING=Загрузка чанков +of.options.CHUNK_LOADING.tooltip.1=Загрузка чанков +of.options.CHUNK_LOADING.tooltip.2= По умолчанию - нестабильный FPS при загрузке чанков +of.options.CHUNK_LOADING.tooltip.3= Плавная - стабильный FPS +of.options.CHUNK_LOADING.tooltip.4= Многоядерная - стабильный FPS, загрузка мира в 3 раза быстрее +of.options.CHUNK_LOADING.tooltip.5=Плавная и многоядерная загрузки убирают подвисания и лаги, +of.options.CHUNK_LOADING.tooltip.6=вызванные загрузкой чанков. +of.options.CHUNK_LOADING.tooltip.7=Многоядерная загрузка способна ускорить загрузку мира в 3 раза +of.options.CHUNK_LOADING.tooltip.8=и увеличить FPS, используя второе ядро процессора. +of.options.chunkLoading.smooth=Плавная +of.options.chunkLoading.multiCore=Мультиядерная + +of.options.shaders=Шейдеры... +of.options.shadersTitle=Шейдеры + +of.options.shaders.packNone=Нет +of.options.shaders.packDefault=(встроенный) + +of.options.shaders.ANTIALIASING=Антиалиасинг +of.options.shaders.NORMAL_MAP=Нормальная карта +of.options.shaders.SPECULAR_MAP=Карта отражений +of.options.shaders.RENDER_RES_MUL=Качество рендера +of.options.shaders.SHADOW_RES_MUL=Качество теней +of.options.shaders.HAND_DEPTH_MUL=Глубина руки +of.options.shaders.CLOUD_SHADOW=Тени облаков +of.options.shaders.OLD_HAND_LIGHT=Старое освещение руки +of.options.shaders.OLD_LIGHTING=Старое освещение +of.options.shaders.SHADER_PACK=Пакет шейдеров + +of.options.shaders.shadersFolder=Папка с шейдерами +of.options.shaders.shaderOptions=Настройки шейдера... + +of.options.shaderOptionsTitle=Настройки шейдера + +of.options.quality=Качество... +of.options.qualityTitle=Настройки качества + +of.options.details=Детали... +of.options.detailsTitle=Настройки деталей + +of.options.performance=Производительность... +of.options.performanceTitle=Настройки производительности + +of.options.animations=Анимация... +of.options.animationsTitle=Настройки анимации + +of.options.other=Прочее... +of.options.otherTitle=Прочие настройки + +of.options.other.reset=Сбросить настройки графики... + +of.shaders.profile=Профиль + +# Quality + +of.options.mipmap.bilinear=Билинейное +of.options.mipmap.linear=Линейное +of.options.mipmap.nearest=Ближнее +of.options.mipmap.trilinear=Трилинейное + +options.mipmapLevels.tooltip.1=Заставляет удалённых объектов выглядеть лучше посредством сглаживания +options.mipmapLevels.tooltip.2=деталей текстуры. +options.mipmapLevels.tooltip.3= Выкл - без сглаживания +options.mipmapLevels.tooltip.4= 1 - минимальное сглаживание +options.mipmapLevels.tooltip.5= 4 - максимальное сглаживание +options.mipmapLevels.tooltip.6=Этот параметр, обычно, не влияет на производительность. + +of.options.MIPMAP_TYPE=MIP-текстурирование +of.options.MIPMAP_TYPE.tooltip.1=Заставляет удалённых объектов выглядеть лучше посредством сглаживания +of.options.MIPMAP_TYPE.tooltip.2=деталей текстуры. +of.options.MIPMAP_TYPE.tooltip.3= Ближнее - грубое сглаживание, быстрее +of.options.MIPMAP_TYPE.tooltip.4= Линейное - нормальное сглаживание +of.options.MIPMAP_TYPE.tooltip.5= Билинейное - хорошее сглаживание +of.options.MIPMAP_TYPE.tooltip.6= Трилинейное - лучшее сглаживание, медленнее + + +of.options.AA_LEVEL=Антиалиасинг +of.options.AA_LEVEL.tooltip.1=Антиалиасинг +of.options.AA_LEVEL.tooltip.2= Выкл - без сглаживания (по умолчанию), быстрее +of.options.AA_LEVEL.tooltip.3= 2-16 - сглаживание линий и краёв, медленнее +of.options.AA_LEVEL.tooltip.4=Сглаживает неровные линии и резкие цветовые переходы. +of.options.AA_LEVEL.tooltip.5=Может существенно понизить производительность. +of.options.AA_LEVEL.tooltip.6=Не все видеокарты поддерживают все уровни антиалиасинга. +of.options.AA_LEVEL.tooltip.7= +of.options.AA_LEVEL.tooltip.8=Изменения эффективны только после ПЕРЕЗАПУСКА! + +of.options.AF_LEVEL=Анизотропная фильтрация +of.options.AF_LEVEL.tooltip.1=Анизотропная фильтрация +of.options.AF_LEVEL.tooltip.2= Выкл - стандартная детализация MIP-текстур (по умолчанию), быстрее +of.options.AF_LEVEL.tooltip.3= 2-16 - улучшенная детализация MIP-текстур, медленнее +of.options.AF_LEVEL.tooltip.4=Восстанавливает детали в MIP-текстурах. +of.options.AF_LEVEL.tooltip.5=Может существенно понизить производительность. +of.options.AF_LEVEL.tooltip.6= + +of.options.CLEAR_WATER=Очищенная вода +of.options.CLEAR_WATER.tooltip.1=Очищенная вода +of.options.CLEAR_WATER.tooltip.2= Вкл - чистая, прозрачная вода +of.options.CLEAR_WATER.tooltip.3= Выкл - стандартная вода + +of.options.RANDOM_MOBS=Случайные мобы +of.options.RANDOM_MOBS.tooltip.1=Случайные текстуры мобов +of.options.RANDOM_MOBS.tooltip.2= Выкл - случайных мобы отключены, быстрее +of.options.RANDOM_MOBS.tooltip.3= Вкл - случайные мобы включены, медленнее +of.options.RANDOM_MOBS.tooltip.4=Используются случайные текстуры для мобов. +of.options.RANDOM_MOBS.tooltip.5=Требуется пакет ресурсов, в котором такие текстуры есть. + +of.options.BETTER_GRASS=Улучшенный дёрн +of.options.BETTER_GRASS.tooltip.1=Улучшенный дёрн +of.options.BETTER_GRASS.tooltip.2= Выкл - дёрн по умолчанию, быстрее +of.options.BETTER_GRASS.tooltip.3= Быстро - полностью заполненные текстуры сторон дёрна, медленнее +of.options.BETTER_GRASS.tooltip.4= Детально - динамично заполненные текстуры сторон дёрна, ещё медленнее + +of.options.BETTER_SNOW=Улучшенный снег +of.options.BETTER_SNOW.tooltip.1=Улучшенный снег +of.options.BETTER_SNOW.tooltip.2= Выкл - стандартный снег, быстрее +of.options.BETTER_SNOW.tooltip.3= Вкл - улучшенный снег, медленнее +of.options.BETTER_SNOW.tooltip.4=Показывает снег под прилегающими к нему прозрачными блоками +of.options.BETTER_SNOW.tooltip.5=(забор, трава). + +of.options.CUSTOM_FONTS=Пользовательские шрифты +of.options.CUSTOM_FONTS.tooltip.1=Пользовательские шрифты +of.options.CUSTOM_FONTS.tooltip.2= Вкл - пользовательские шрифты (по умолчанию), медленнее +of.options.CUSTOM_FONTS.tooltip.3= Выкл - шрифт по умолчанию, быстрее +of.options.CUSTOM_FONTS.tooltip.4=Шрифты предоставляются текущим пакетом ресурсов. +of.options.CUSTOM_FONTS.tooltip.5= + +of.options.CUSTOM_COLORS=Пользовательские цвета +of.options.CUSTOM_COLORS.tooltip.1=Пользовательские цвета +of.options.CUSTOM_COLORS.tooltip.2= Вкл - пользовательские цвета (по умолчанию), медленнее +of.options.CUSTOM_COLORS.tooltip.3= Выкл - цвета по умолчанию, быстрее +of.options.CUSTOM_COLORS.tooltip.4=Цвета предоставляются текущим пакетом ресурсов. +of.options.CUSTOM_COLORS.tooltip.5= + +of.options.SWAMP_COLORS=Болотные цвета +of.options.SWAMP_COLORS.tooltip.1=Болотные цвета +of.options.SWAMP_COLORS.tooltip.2= Вкл - болотные цвета (по умолчанию), медленнее +of.options.SWAMP_COLORS.tooltip.3= Выкл - без использования болотных цветов, быстрее +of.options.SWAMP_COLORS.tooltip.4=Влияет на цвет травы, листьев, лиан и воды в биоме болота. + +of.options.SMOOTH_BIOMES=Сглаженные биомы +of.options.SMOOTH_BIOMES.tooltip.1=Сглаженные границы биомов +of.options.SMOOTH_BIOMES.tooltip.2= Вкл - сглаженные цвета границ биомов (по умолчанию), медленнее +of.options.SMOOTH_BIOMES.tooltip.3= Выкл - несглаженные цвета границы биомов, быстрее +of.options.SMOOTH_BIOMES.tooltip.4=Сглаживание границ биомов осуществляется путём выбора и усреднения +of.options.SMOOTH_BIOMES.tooltip.5=значений цветов всех окружающих блоков. +of.options.SMOOTH_BIOMES.tooltip.6=Влияет на цвет травы, листьев, лиан и воды. + +of.options.CONNECTED_TEXTURES=Соединение текстур +of.options.CONNECTED_TEXTURES.tooltip.1=Соединение текстур +of.options.CONNECTED_TEXTURES.tooltip.2= Выкл - несоединённые текстуры (по умолчанию) +of.options.CONNECTED_TEXTURES.tooltip.3= Быстро - быстрое соединение текстур +of.options.CONNECTED_TEXTURES.tooltip.4= Детально - детальное соединение текстур +of.options.CONNECTED_TEXTURES.tooltip.5=Данный параметр соединяет текстуры (стекло, песчаник, книжные полки) +of.options.CONNECTED_TEXTURES.tooltip.6=друг с другом. +of.options.CONNECTED_TEXTURES.tooltip.7=Информация о соединениях текстур предоставляются текущим пакетом ресурсов. +of.options.CONNECTED_TEXTURES.tooltip.8= + +of.options.NATURAL_TEXTURES=Естественные текстуры +of.options.NATURAL_TEXTURES.tooltip.1=Естественные текстуры +of.options.NATURAL_TEXTURES.tooltip.2= Выкл - без естественных текстур (по умолчанию) +of.options.NATURAL_TEXTURES.tooltip.3= Вкл - использование естественных текстур +of.options.NATURAL_TEXTURES.tooltip.4=Данный параметр убирает повторяющиеся текстуры блоков, и вместо +of.options.NATURAL_TEXTURES.tooltip.5=них использует повёрнутые и отражённые варианты текстур. +of.options.NATURAL_TEXTURES.tooltip.6=Конфигурация предоставляется текущим пакетом ресурсов. +of.options.NATURAL_TEXTURES.tooltip.7= +of.options.NATURAL_TEXTURES.tooltip.8= + +of.options.CUSTOM_SKY=Пользовательское небо +of.options.CUSTOM_SKY.tooltip.1=Пользовательские текстуры неба +of.options.CUSTOM_SKY.tooltip.2= Вкл - небо с пользовательскими текстурами (по умолчанию), медленнее +of.options.CUSTOM_SKY.tooltip.3= Выкл - стандартное небо, быстрее +of.options.CUSTOM_SKY.tooltip.4=Текстуры неба предоставляются текущим пакетом ресурсов. +of.options.CUSTOM_SKY.tooltip.5= + +of.options.CUSTOM_ITEMS=Пользовательские предметы +of.options.CUSTOM_ITEMS.tooltip.1=Пользовательские текстуры предметов +of.options.CUSTOM_ITEMS.tooltip.2= Вкл - предметы с пользовательскими текстурами (по умолчанию), медленнее +of.options.CUSTOM_ITEMS.tooltip.3= Выкл - стандартные текстуры предметов, быстрее +of.options.CUSTOM_ITEMS.tooltip.4=Текстуры предметов предоставляются текущим пакетом ресурсов. +of.options.CUSTOM_ITEMS.tooltip.5= + +of.options.CUSTOM_ENTITY_MODELS=Пользовательские сущности +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=Пользовательские модели сущностей +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= Вкл - сущности с пользовательскими моделями (по умолчанию), медленнее +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= Выкл - стандартные модели сущностей, быстрее +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=Модели сущностей предоставляются текущим пакетом ресурсов. +of.options.CUSTOM_ENTITY_MODELS.tooltip.5= + +# Details + +of.options.CLOUDS=Облака +of.options.CLOUDS.tooltip.1=Отображение облаков +of.options.CLOUDS.tooltip.2= По умолчанию - согласно настройкам графики +of.options.CLOUDS.tooltip.3= Быстро - низкое качество, быстрее +of.options.CLOUDS.tooltip.4= Детально - высокое качество, медленнее +of.options.CLOUDS.tooltip.5= Выкл - облака отключены, ещё быстрее +of.options.CLOUDS.tooltip.6=Быстрые облака рендерятся в двухмерном виде. +of.options.CLOUDS.tooltip.7=Детальные облака рендерятся в трёхмерном виде. + +of.options.CLOUD_HEIGHT=Высота облаков +of.options.CLOUD_HEIGHT.tooltip.1=Высота облаков +of.options.CLOUD_HEIGHT.tooltip.2= Выкл - высота по умолчанию +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - над ограничением высоты мира + +of.options.TREES=Листья +of.options.TREES.tooltip.1=Отображение листьев +of.options.TREES.tooltip.2= По умолчанию - согласно настройкам графики +of.options.TREES.tooltip.3= Быстро - непрозрачные листья, быстрее +of.options.TREES.tooltip.4= Умно - прозрачные листья, между которыми нет текстур, быстро +of.options.TREES.tooltip.5= Детально - прозрачные листья, медленнее +of.options.TREES.tooltip.6= +of.options.TREES.tooltip.7= + +of.options.RAIN=Дождь и снег +of.options.RAIN.tooltip.1=Отображение дождя и снега +of.options.RAIN.tooltip.2= По умолчанию - согласно настройкам графики +of.options.RAIN.tooltip.3= Быстро - лёгкий дождь/снег, быстрее +of.options.RAIN.tooltip.4= Детально - сильный дождь/снег, медленнее +of.options.RAIN.tooltip.5= Выкл - без дождя/снега, ещё быстрее +of.options.RAIN.tooltip.6=Данный параметр не влияет на брызги и звуки дождя. +of.options.RAIN.tooltip.7= + +of.options.SKY=Небо +of.options.SKY.tooltip.1=Отображение неба +of.options.SKY.tooltip.2= Вкл - небо видно, медленнее +of.options.SKY.tooltip.3= Выкл - небо не видно, быстрее +of.options.SKY.tooltip.4=Данный параметр не влияет на солнце и луну. + +of.options.STARS=Звёзды +of.options.STARS.tooltip.1=Отображение звёзд +of.options.STARS.tooltip.2= Вкл - звёзды видны, медленнее +of.options.STARS.tooltip.3= Выкл - звёзды не видны, быстрее + +of.options.SUN_MOON=Солнце и луна +of.options.SUN_MOON.tooltip.1=Отображение солнца и луны +of.options.SUN_MOON.tooltip.2= Вкл - солнце и луна видны (по умолчанию) +of.options.SUN_MOON.tooltip.3= Выкл - солнце и луна не видны, быстрее + +of.options.SHOW_CAPES=Плащи +of.options.SHOW_CAPES.tooltip.1=Отображение плащей +of.options.SHOW_CAPES.tooltip.2= Вкл - плащи игроков видны (по умолчанию) +of.options.SHOW_CAPES.tooltip.3= Выкл - плащи игроков не видны + +of.options.TRANSLUCENT_BLOCKS=Прозрачные блоки +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Прозрачные блоки +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Детально - правильное смешивание цветов (по умолчанию) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Быстро - быстрое смешивание цветов, быстрее +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Данный параметр управляет смешиванием цветов прозрачных блоков разного +of.options.TRANSLUCENT_BLOCKS.tooltip.5=цвета (цветное стекло, вода, лёд), размещённых друг за другом с воздухом +of.options.TRANSLUCENT_BLOCKS.tooltip.6=между ними. + +of.options.HELD_ITEM_TOOLTIPS=Подсказка о предмете +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Всплывающая подсказка об удерживаемом предмете. +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= Вкл - показывать всплывающую подсказку о предмете (по умолчанию) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= Выкл - не показывать всплывающую подсказку о предмете + +of.options.ADVANCED_TOOLTIPS=Расширенные подсказки +of.options.ADVANCED_TOOLTIPS.tooltip.1=Расширенные подсказки +of.options.ADVANCED_TOOLTIPS.tooltip.2= Вкл - расширенные подсказки включены +of.options.ADVANCED_TOOLTIPS.tooltip.3= Выкл - расширенные подсказки отключены (по умолчанию) +of.options.ADVANCED_TOOLTIPS.tooltip.4=Показывает дополнительную информацию о предметах (ID, прочность) +of.options.ADVANCED_TOOLTIPS.tooltip.5=и о параметрах шейдеров (ID, файл, значение по умолчанию). +of.options.ADVANCED_TOOLTIPS.tooltip.6= + +of.options.DROPPED_ITEMS=Выкинутые предметы +of.options.DROPPED_ITEMS.tooltip.1=Отображение выкинутых предметов +of.options.DROPPED_ITEMS.tooltip.2= По умолчанию - согласно настройкам графики +of.options.DROPPED_ITEMS.tooltip.3= Быстро - двухмерные выкинутые предметы, быстрее +of.options.DROPPED_ITEMS.tooltip.4= Детально - трёхмерные выкинутые предметы, медленнее + +options.entityShadows.tooltip.1=Тени сущностей +options.entityShadows.tooltip.2= Вкл - показывать тени сущностей +options.entityShadows.tooltip.3= Выкл - не показывать тени сущностей + +of.options.VIGNETTE=Виньетирование +of.options.VIGNETTE.tooltip.1=Визуальный эффект, слегка затемняющий края экрана. +of.options.VIGNETTE.tooltip.2= По умолчанию - согласно настройкам графики +of.options.VIGNETTE.tooltip.3= Быстро - виньетирование отключено, быстрее +of.options.VIGNETTE.tooltip.4= Детально - виньетирование включено, медленнее +of.options.VIGNETTE.tooltip.5=Виньетирование может оказывать значительное влияние на частоту кадров, +of.options.VIGNETTE.tooltip.6=особенно при игре в полноэкранном режиме. +of.options.VIGNETTE.tooltip.7= +of.options.VIGNETTE.tooltip.8= + +of.options.DYNAMIC_FOV=Динамика поля зрения +of.options.DYNAMIC_FOV.tooltip.1=Динамика поля зрения +of.options.DYNAMIC_FOV.tooltip.2= Вкл - подвижное поле зрения (по умолчанию) +of.options.DYNAMIC_FOV.tooltip.3= Выкл - фиксированное поле зрения +of.options.DYNAMIC_FOV.tooltip.4=Изменяет поле зрения в полёте, во время бега или стрельбы из лука. +of.options.DYNAMIC_FOV.tooltip.5= + +of.options.DYNAMIC_LIGHTS=Динамич. освещение +of.options.DYNAMIC_LIGHTS.tooltip.1=Динамическое освещение +of.options.DYNAMIC_LIGHTS.tooltip.2= Выкл - динамическое освещение отключено (по умолчанию) +of.options.DYNAMIC_LIGHTS.tooltip.3= Быстро - освещение обновляется каждые 500 мс., медленнее +of.options.DYNAMIC_LIGHTS.tooltip.4= Детально - освещение обновляется в реальном времени, ещё медленнее +of.options.DYNAMIC_LIGHTS.tooltip.5=Экипированные и выброшенные предметы, излучающие свет (факел, светокамень +of.options.DYNAMIC_LIGHTS.tooltip.6=и т.д.), освещают территорию вокруг. +of.options.DYNAMIC_LIGHTS.tooltip.7= + +# Performance + +of.options.SMOOTH_FPS=Стабилизизация FPS +of.options.SMOOTH_FPS.tooltip.1=Стабилизирует FPS посредством очистки буфера видеокарты. +of.options.SMOOTH_FPS.tooltip.2= Выкл - без стабилизации, частота кадров может колебаться +of.options.SMOOTH_FPS.tooltip.3= Вкл - стабилизация частоты кадров +of.options.SMOOTH_FPS.tooltip.4=Данный параметр зависит от видеодрайвера, и эффект стабилизации +of.options.SMOOTH_FPS.tooltip.5=не всегда виден. + +of.options.SMOOTH_WORLD=Стабилизация мира +of.options.SMOOTH_WORLD.tooltip.1=Убирает задержки, созданные внутренним сервером. +of.options.SMOOTH_WORLD.tooltip.2= Выкл - без стабилизации, частота кадров может колебаться +of.options.SMOOTH_WORLD.tooltip.3= Вкл - стабилизация частоты кадров +of.options.SMOOTH_WORLD.tooltip.4=Распределяет нагрузку на внутренний сервер. +of.options.SMOOTH_WORLD.tooltip.5=Эффективно только для локальных миров (одиночная игра). + +of.options.FAST_RENDER=Быстрый рендер +of.options.FAST_RENDER.tooltip.1=Быстрый рендер +of.options.FAST_RENDER.tooltip.2= Выкл - стандартный рендеринг (по умолчанию) +of.options.FAST_RENDER.tooltip.3= Вкл - оптимизированный рендеринг, быстрее +of.options.FAST_RENDER.tooltip.4=Использует оптимизированный алгоритм рендеринга, который уменьшает +of.options.FAST_RENDER.tooltip.5=нагрузку на GPU и может существенно повысить FPS. + +of.options.FAST_MATH=Быстрое вычисление +of.options.FAST_MATH.tooltip.1=Быстрое вычисление +of.options.FAST_MATH.tooltip.2= Выкл - стандартное вычисление (по умолчанию) +of.options.FAST_MATH.tooltip.3= Вкл - быстрое вычисление +of.options.FAST_MATH.tooltip.4=Использует оптимизированные функции синуса и косинуса, из-за чего +of.options.FAST_MATH.tooltip.5=появляется возможность лучше использовать кэш процессора и повысить FPS. + +of.options.CHUNK_UPDATES=Обновление чанков +of.options.CHUNK_UPDATES.tooltip.1=Частота обновления чанков +of.options.CHUNK_UPDATES.tooltip.2= 1 - медленная загрузка мира, высокая частота кадров (по умолчанию) +of.options.CHUNK_UPDATES.tooltip.3= 3 - быстрая загрузка мира, низкая частота кадров +of.options.CHUNK_UPDATES.tooltip.4= 5 - быстрейшая загрузка мира, очень низкая частота кадров +of.options.CHUNK_UPDATES.tooltip.5=Количество обновлений чанков за один кадр. +of.options.CHUNK_UPDATES.tooltip.6=Высокие значения могут дестабилизировать частоту кадров. + +of.options.CHUNK_UPDATES_DYNAMIC=Динамическое обновление +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Динамическое обновление чанков +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= Выкл - стандартное обновление чанков за кадр (по умолчанию) +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= Вкл - пока игрок стоит на месте, чанки обновляются чаще +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=Когда игрок стоит на месте, чанки обновляются чаще, +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=для того чтобы мир загрузился быстрее. + +of.options.LAZY_CHUNK_LOADING=Медленные чанки +of.options.LAZY_CHUNK_LOADING.tooltip.1=Медленная загрузка чанков +of.options.LAZY_CHUNK_LOADING.tooltip.2= Выкл - стандартная загрузка чанков сервера +of.options.LAZY_CHUNK_LOADING.tooltip.3= Вкл - медленная загрузка чанков сервера (плавнее) +of.options.LAZY_CHUNK_LOADING.tooltip.4=Стабилизирует загрузку чанков внутреннего сервера, распределяя её +of.options.LAZY_CHUNK_LOADING.tooltip.5=на несколько тиков. +of.options.LAZY_CHUNK_LOADING.tooltip.6=Выключите, если некоторые части мира загружаются некорректно. +of.options.LAZY_CHUNK_LOADING.tooltip.7=Данный параметр эффективен для локальных миров и одноядерных ЦП. + +# Animations + +of.options.animation.allOn=Включить всё +of.options.animation.allOff=Выключить всё +of.options.animation.dynamic=Динамическая + +of.options.ANIMATED_WATER=Анимация воды +of.options.ANIMATED_LAVA=Анимация лавы +of.options.ANIMATED_FIRE=Анимация огня +of.options.ANIMATED_PORTAL=Анимация портала +of.options.ANIMATED_REDSTONE=Анимация редстоуна +of.options.ANIMATED_EXPLOSION=Анимация взрыва +of.options.ANIMATED_FLAME=Анимация пламени +of.options.ANIMATED_SMOKE=Анимация дыма +of.options.VOID_PARTICLES=Частицы пустоты +of.options.WATER_PARTICLES=Частицы воды +of.options.RAIN_SPLASH=Брызги дождя +of.options.PORTAL_PARTICLES=Частицы портала +of.options.POTION_PARTICLES=Частицы зелья +of.options.DRIPPING_WATER_LAVA=Капающая вода/лава +of.options.ANIMATED_TERRAIN=Анимация местности +of.options.ANIMATED_TEXTURES=Анимация текстур +of.options.FIREWORK_PARTICLES=Частицы фейерверка + +# Other + +of.options.LAGOMETER=Лагометр +of.options.LAGOMETER.tooltip.1=Показывает лагометр на экране откладки (F3). +of.options.LAGOMETER.tooltip.2=* Оранжевый - Сборщик мусора памяти +of.options.LAGOMETER.tooltip.3=* Голубой - Тик +of.options.LAGOMETER.tooltip.4=* Синий - Запланированные исполняемые файлы +of.options.LAGOMETER.tooltip.5=* Фиолетовый - Загрузка чанков +of.options.LAGOMETER.tooltip.6=* Красный - Обновление чанков +of.options.LAGOMETER.tooltip.7=* Желтый - Проверка видимости +of.options.LAGOMETER.tooltip.8=* Зеленый - Рендеринг местности + +of.options.PROFILER=Профиль откладки +of.options.PROFILER.tooltip.1=Профиль откладки +of.options.PROFILER.tooltip.2= Вкл - профиль откладки активен, медленнее +of.options.PROFILER.tooltip.3= Выкл - профиль откладки неактивен, быстрее +of.options.PROFILER.tooltip.4=Показывает дополнительную информацию, когда экран отладки открыт (F3). +of.options.PROFILER.tooltip.5= + +of.options.WEATHER=Погода +of.options.WEATHER.tooltip.1=Погода +of.options.WEATHER.tooltip.2= Вкл - погода активна, медленнее +of.options.WEATHER.tooltip.3= Выкл - погода неактивна, быстрее +of.options.WEATHER.tooltip.4=Этот параметр контролирует дождь, снег и грозу. +of.options.WEATHER.tooltip.5=Контролирование погодой возможно только в локальных мирах. + +of.options.time.dayOnly=Всегда день +of.options.time.nightOnly=Всегда ночь + +of.options.TIME=Время суток +of.options.TIME.tooltip.1=Время суток +of.options.TIME.tooltip.2= По умолчанию - нормальный цикл дня и ночи +of.options.TIME.tooltip.3= Всегда день - только дневное время +of.options.TIME.tooltip.4= Всегда ночь - только ночное время +of.options.TIME.tooltip.5=Настройка времени действует только в ТВОРЧЕСКОМ режиме и только +of.options.TIME.tooltip.6=для локальных миров. + +options.fullscreen.tooltip.1=Полноэкранный режим +options.fullscreen.tooltip.2= Вкл - использовать полноэкранный режим +options.fullscreen.tooltip.3= Выкл - использовать оконный режим +options.fullscreen.tooltip.4=Полноэкранный режим может быть как производительнее чем оконный, +options.fullscreen.tooltip.5=так и нет, это зависит от видеокарты. + +of.options.FULLSCREEN_MODE=Разрешение экрана +of.options.FULLSCREEN_MODE.tooltip.1=Разрешение экрана в полноэкранном режиме +of.options.FULLSCREEN_MODE.tooltip.2= По умолчанию - разрешение рабочего стола, медленнее +of.options.FULLSCREEN_MODE.tooltip.3= ШxВ - выбранное разрешение, возможно быстрее +of.options.FULLSCREEN_MODE.tooltip.4=Выбранное разрешение будет использовано в полноэкранном режиме (F11). +of.options.FULLSCREEN_MODE.tooltip.5=Меньшие значения способствуют быстродействию. + +of.options.SHOW_FPS=Отображение FPS +of.options.SHOW_FPS.tooltip.1=Компактно показывает FPS и информацию о рендере. +of.options.SHOW_FPS.tooltip.2= C: - рендеринг чанков +of.options.SHOW_FPS.tooltip.3= E: - рендеринг сущностей + блоки с доп. данными +of.options.SHOW_FPS.tooltip.4= U: - обновление чанков +of.options.SHOW_FPS.tooltip.5=Компактная информация о FPS показывается, только тогда, когда экран откладки +of.options.SHOW_FPS.tooltip.6=отключен. + +of.options.save.default=По умолчанию (2 с.) +of.options.save.20s=20 секунд +of.options.save.3min=3 минуты +of.options.save.30min=30 минут + +of.options.AUTOSAVE_TICKS=Автосохранение +of.options.AUTOSAVE_TICKS.tooltip.1=Интервал автосохранений +of.options.AUTOSAVE_TICKS.tooltip.2=Интервал автосохранений по умолчанию (2 с.) НЕ РЕКОМЕНДУЕТСЯ. +of.options.AUTOSAVE_TICKS.tooltip.3=Автосохранение может создавать кратковременные зависания. + +of.options.SCREENSHOT_SIZE=Разрешение скриншота +of.options.SCREENSHOT_SIZE.tooltip.1=Разрешение скриншота +of.options.SCREENSHOT_SIZE.tooltip.2= По умолчанию - стандартное разрешение скриншота +of.options.SCREENSHOT_SIZE.tooltip.3= 2x-4x - множитель разрешения +of.options.SCREENSHOT_SIZE.tooltip.4=Создание скриншота большего разрешения требует больше памяти. +of.options.SCREENSHOT_SIZE.tooltip.5=Требуется поддержка кадрового буфера графического процессора. +of.options.SCREENSHOT_SIZE.tooltip.6=Не совместимо с параметром "Быстрый рендер" и "Антиалиасинг". diff --git a/src/minecraft/assets/minecraft/optifine/lang/sv_SE.lang b/src/minecraft/assets/minecraft/optifine/lang/sv_SE.lang new file mode 100644 index 0000000..d81720b --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/sv_SE.lang @@ -0,0 +1,597 @@ +# Contributors of Swedish localization # +# Regnander (_Spitz) 2016-01-18 ---- 2017-02-06 + +# General +of.general.ambiguous=tvetydig +of.general.custom=Anpassad +of.general.from=Från +of.general.id=ID +of.general.restart=starta om +of.general.smart=Smart + +# Keys +of.key.zoom=Zooma in + +# Message +of.message.aa.shaders1=Kantutjämning är inte kompatibel med Shaders. +of.message.aa.shaders2=Inaktivera Shaders för att aktivera detta alternativ. + +of.message.af.shaders1=Anisotropisk filtrering är inte kompatibel med Shaders. +of.message.af.shaders2=Inaktivera Shaders för att aktivera detta alternativ. + +of.message.fr.shaders1=Snabb rendering är inte kompatibel med Shaders. +of.message.fr.shaders1=Inaktivera Shaders för att aktivera detta alternativ. + +of.message.an.shaders1=3D-effekt är inte kompatibel med Shaders. +of.message.an.shaders2=Inaktivera Shaders för att aktivera detta alternativ. + +of.message.shaders.aa1=Shaders är inte kompatibla med Kantutjämning. +of.message.shaders.aa2=Ändra "Kvalitet -> Kantutjämning" till AV och starta om spelet. + +of.message.shaders.af1=Shaders är inte kompatibla med Anisotropisk filtrering. +of.message.shaders.af2=Ändra "Kvalitet -> Anisotropisk filtrering" till AV. + +of.message.shaders.fr1=Shaders är inte kompatibla med Snabb rendering. +of.message.shaders.fr2=Ändra "Prestanda -> Snabb rendering" till AV. + +of.message.shaders.an1=Shaders är inte kompatibla med 3D-effekt. +of.message.shaders.an2=Ändra "Övrigt -> 3D-effekt" till AV. + +of.message.newVersion=En ny version av §eOptiFine§f finns tillgänglig: §e%s§f +of.message.java64Bit=Du kan installera §e64-bitarsversionen av Java§f för att förbättra prestandan. +of.message.openglError=§eOpenGL-fel§f: %s (%s) + +of.message.shaders.loading=Läser in shaders: %s + +of.message.other.reset=Återställ alla grafikinställningar till dess standardvärden? + +of.message.loadingVisibleChunks=Läser in synliga chunkar + +# Video settings + +options.graphics.tooltip.1=Visuell kvalitet +options.graphics.tooltip.2= Snabbt - lägre kvalitet, snabbare +options.graphics.tooltip.3= Snyggt - högre kvalitet, långsammare +options.graphics.tooltip.4=Ändrar utseendet för moln, löv, vatten, skuggor och +options.graphics.tooltip.5=gräskanter. + +of.options.renderDistance.tiny=Litet +of.options.renderDistance.short=Kort +of.options.renderDistance.normal=Normalt +of.options.renderDistance.far=Långt +of.options.renderDistance.extreme=Extremt + +options.renderDistance.tooltip.1=Synligt avstånd +options.renderDistance.tooltip.2= 2 Litet - 32m (snabbast) +options.renderDistance.tooltip.3= 4 Kort - 64m (snabbare) +options.renderDistance.tooltip.4= 8 Normalt - 128m +options.renderDistance.tooltip.5= 16 Långt - 256m (långsammare) +options.renderDistance.tooltip.6= 32 Extremt - 512m (långsammast!) +options.renderDistance.tooltip.7=Avståndet Extremt är mycket resurskrävande! +options.renderDistance.tooltip.8=Värden över 16 fungerar endast i lokala världar. + +options.ao.tooltip.1=Ljusutjämning +options.ao.tooltip.2= AV - ingen ljusutjämning (snabbast) +options.ao.tooltip.3= Minimum - enkel ljusutjämning (långsammare) +options.ao.tooltip.4= Maximum - avancerad ljusutjämning (långsammast) + +options.framerateLimit.tooltip.1=Maximal bildfrekvens +options.framerateLimit.tooltip.2= VSync - använder skärmens bildfrekvens (60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - variabel +options.framerateLimit.tooltip.4= Oändlig - ingen begränsning (snabbast) +options.framerateLimit.tooltip.5=Bildfrekvensens gräns reducerar bildfrekvensen även +options.framerateLimit.tooltip.6=om gränsens värde inte nås. +of.options.framerateLimit.vsync=VSync + +of.options.AO_LEVEL=Ljusutjämningsnivå +of.options.AO_LEVEL.tooltip.1=Ljusutjämningsnivå +of.options.AO_LEVEL.tooltip.2= AV - inga skuggor +of.options.AO_LEVEL.tooltip.3= 50%% - ljusa skuggor +of.options.AO_LEVEL.tooltip.4= 100%% - mörka skuggor + +options.viewBobbing.tooltip.1=Mer verklighetstrogna rörelser. +options.viewBobbing.tooltip.2=Inaktivera detta om mipmaps används för bästa resultat. + +options.guiScale.tooltip.1=GUI-skala +options.guiScale.tooltip.2= Automatisk - maximal storlek +options.guiScale.tooltip.3= Liten, Normal, Stor - 1x till 3x +options.guiScale.tooltip.4= 4x till 10x - tillgänglig på 4K-skärmar +options.guiScale.tooltip.5=Udda värden (1x, 3x, 5x...) är inte kompatibla med Unicode. +options.guiScale.tooltip.6=Ett mindre GUI kan vara snabbare. + +options.vbo.tooltip.1=Vertex Buffer Objects +options.vbo.tooltip.2=Använder en alternativ renderingsmodell som vanligtvis +options.vbo.tooltip.3=är snabbare (5-10%%) än standardrenderingen. + +options.gamma.tooltip.1=Ändrar ljusstyrkan för mörkare objekt. +options.gamma.tooltip.2= Mörkt - standardljusstyrka +options.gamma.tooltip.3= 1-99%% - variabel +options.gamma.tooltip.4= Ljust - maximal ljusstyrka för mörkare objekt +options.gamma.tooltip.5=Detta alternativ ändrar inte ljusstyrkan för helt svarta +options.gamma.tooltip.6=objekt. + +options.anaglyph.tooltip.1=3D-effekt +options.anaglyph.tooltip.2=Aktiverar en stereoskopisk 3D-effekt med hjälp av olika +options.anaglyph.tooltip.3=färger för varje öga. +options.anaglyph.tooltip.4=Kräver röd-turkosa glasögon för bästa resultat. + +options.blockAlternatives.tooltip.1=Alternativa block +options.blockAlternatives.tooltip.2=Använder alternativa blockmodeller för samma block. +options.blockAlternatives.tooltip.3=Beror på valt resurspaket. + +of.options.ALTERNATE_BLOCKS=Alternerade block +of.options.ALTERNATE_BLOCKS.tooltip.1=Alternerade block +of.options.ALTERNATE_BLOCKS.tooltip.2=Använder alternativa blockmodeller för en del block. +of.options.ALTERNATE_BLOCKS.tooltip.3=Förlitar sig på aktuellt resurspaket. + +of.options.FOG_FANCY=Dimma +of.options.FOG_FANCY.tooltip.1=Typ av dimma +of.options.FOG_FANCY.tooltip.2= Snabbt - snabbare dimma +of.options.FOG_FANCY.tooltip.3= Snyggt - långsammare dimma, ser bättre ut +of.options.FOG_FANCY.tooltip.4= AV - ingen dimma, snabbast +of.options.FOG_FANCY.tooltip.5=Snygg dimma finns bara tillgänglig om det stöds av +of.options.FOG_FANCY.tooltip.6=grafikkortet. + +of.options.FOG_START=Startgräns för dimma +of.options.FOG_START.tooltip.1=Startgräns för dimma +of.options.FOG_START.tooltip.2= 0.2 - dimman börjar nära spelaren +of.options.FOG_START.tooltip.3= 0.8 - dimman börjar långt bort från spelaren +of.options.FOG_START.tooltip.4=Detta alternativ påverkar vanligtvis inte prestandan. + +of.options.CHUNK_LOADING=Chunkinläsning +of.options.CHUNK_LOADING.tooltip.1=Chunkinläsning +of.options.CHUNK_LOADING.tooltip.2= Standard - ostabil bildfrekvens när chunks läses in +of.options.CHUNK_LOADING.tooltip.3= Jämn - stabil bildfrekvens +of.options.CHUNK_LOADING.tooltip.4= Flerkärnig - stabil bildfrekvens, 3x snabbare inläsning +of.options.CHUNK_LOADING.tooltip.5=Jämn och Flerkärnig tar bort ryckningar och +of.options.CHUNK_LOADING.tooltip.6=frysningar som orsakas av inlästa chunkar. +of.options.CHUNK_LOADING.tooltip.7=Flerkärnig kan påskynda världens inläsning med 3x +of.options.CHUNK_LOADING.tooltip.8=och höja bildfrekvensen med en andra processorkärna. +of.options.chunkLoading.smooth=Jämn +of.options.chunkLoading.multiCore=Flerkärnig + +of.options.shaders=Shaders... +of.options.shadersTitle=Shaders + +of.options.shaders.packNone=AV +of.options.shaders.packDefault=(intern) + +of.options.shaders.ANTIALIASING=Kantutjämning +of.options.shaders.NORMAL_MAP=Normap map +of.options.shaders.SPECULAR_MAP=Specular map +of.options.shaders.RENDER_RES_MUL=Renderingskvalitet +of.options.shaders.SHADOW_RES_MUL=Skuggkvalitet +of.options.shaders.HAND_DEPTH_MUL=Handdjup +of.options.shaders.CLOUD_SHADOW=Molnskugga +of.options.shaders.OLD_HAND_LIGHT=Gammalt handljus +of.options.shaders.OLD_LIGHTING=Gammalt ljus +of.options.shaders.SHADER_PACK=Shaderpaket + +of.options.shaders.shadersFolder=Shadermapp +of.options.shaders.shaderOptions=Shaderalternativ... + +of.options.shaderOptionsTitle=Shaderalternativ + +of.options.quality=Kvalitet... +of.options.qualityTitle=Kvalitetsinställningar + +of.options.details=Detaljer... +of.options.detailsTitle=Detaljinställningar + +of.options.performance=Prestanda... +of.options.performanceTitle=Prestandainställningar + +of.options.animations=Animeringar... +of.options.animationsTitle=Animeringsinställningar + +of.options.other=Övrigt... +of.options.otherTitle=Övriga inställningar + +of.options.other.reset=Återställ grafikinställningar... + +of.shaders.profile=Profil + +# Quality + +of.options.mipmap.bilinear=Bilinjärt +of.options.mipmap.linear=Linjärt +of.options.mipmap.nearest=Närmast +of.options.mipmap.trilinear=Trilinjärt + +options.mipmapLevels.tooltip.1=Visuell effekt som gör att objekt på avstånd ser bättre +options.mipmapLevels.tooltip.2=ut genom att jämna ut texturdetaljerna. +options.mipmapLevels.tooltip.3= AV - ingen utjämning +options.mipmapLevels.tooltip.4= 1 - minimal utjämning +options.mipmapLevels.tooltip.5= 4 - maximal utjämning +options.mipmapLevels.tooltip.6=Detta alternativ påverkar vanligtvis inte prestandan. + +of.options.MIPMAP_TYPE=Mipmaptyp +of.options.MIPMAP_TYPE.tooltip.1=Visuell effekt som gör att objekt på avstånd ser bättre +of.options.MIPMAP_TYPE.tooltip.2=ut genom att jämna ut texturdetaljerna. +of.options.MIPMAP_TYPE.tooltip.3= Närmast - grov utjämning (snabbast) +of.options.MIPMAP_TYPE.tooltip.4= Linjärt - normal utjämning +of.options.MIPMAP_TYPE.tooltip.5= Bilinjärt - fin utjämning +of.options.MIPMAP_TYPE.tooltip.6= Trilinjärt - finast utjämning (långsammast) + + +of.options.AA_LEVEL=Kantutjämning +of.options.AA_LEVEL.tooltip.1=Kantutjämning +of.options.AA_LEVEL.tooltip.2= AV - (standard) ingen kantutjämning (snabbare) +of.options.AA_LEVEL.tooltip.3= 2-16 - kantutjämnade linjer och kanter (långsammare) +of.options.AA_LEVEL.tooltip.4=Kantutjämningen jämnar ur ojämna linjer och skarpa +of.options.AA_LEVEL.tooltip.5=färgövergångar. +of.options.AA_LEVEL.tooltip.6=Bildfrekvensen kan sjunka avsevärt när detta aktiveras. +of.options.AA_LEVEL.tooltip.7=Alla nivåer stöds inte av alla grafikkort. +of.options.AA_LEVEL.tooltip.8=Kräver OMSTART! + +of.options.AF_LEVEL=Anisotropisk filtrering +of.options.AF_LEVEL.tooltip.1=Anisotropisk filtrering +of.options.AF_LEVEL.tooltip.2= AV - (standard) standarddetaljer för texturer (snabbare) +of.options.AF_LEVEL.tooltip.3= 2-16 - finare detaljer i mipmaptexturer (långsammare) +of.options.AF_LEVEL.tooltip.4=Anisotropiska filtreringen återställer detaljer i +of.options.AF_LEVEL.tooltip.5=mipmaptexturer. +of.options.AF_LEVEL.tooltip.6=Bildfrekvensen kan sjunka avsevärt när detta aktiveras. + +of.options.CLEAR_WATER=Kristallklart vatten +of.options.CLEAR_WATER.tooltip.1=Kristallklart vatten +of.options.CLEAR_WATER.tooltip.2= PÅ - kristallklart, genomskinligt vatten +of.options.CLEAR_WATER.tooltip.3= AV - standardvatten + +of.options.RANDOM_MOBS=Slumpade monster +of.options.RANDOM_MOBS.tooltip.1=Slumpade monster +of.options.RANDOM_MOBS.tooltip.2= AV - inga slumpade monster, snabbare +of.options.RANDOM_MOBS.tooltip.3= PÅ - slumpade monster, långsammare +of.options.RANDOM_MOBS.tooltip.4=Använder slumpade texturer för spelets varelser. +of.options.RANDOM_MOBS.tooltip.5=Kräver ett resurspaket med flera monstertexturer. + +of.options.BETTER_GRASS=Bättre gräs +of.options.BETTER_GRASS.tooltip.1=Bättre gräs +of.options.BETTER_GRASS.tooltip.2= AV - standardtextur för gräskanter, snabbast +of.options.BETTER_GRASS.tooltip.3= Snabbt - fullständig textur för gräskanter, långsammare +of.options.BETTER_GRASS.tooltip.4= Snyggt - dynamisk textur för gräskanter, långsammast + +of.options.BETTER_SNOW=Bättre snö +of.options.BETTER_SNOW.tooltip.1=Bättre snö +of.options.BETTER_SNOW.tooltip.2= AV - standardsnö, snabbare +of.options.BETTER_SNOW.tooltip.3= PÅ - bättre snö, långsammare +of.options.BETTER_SNOW.tooltip.4=Visar snö under genomskinliga block (staket, högt gräs) +of.options.BETTER_SNOW.tooltip.5=som angränsar till snöblock. + +of.options.CUSTOM_FONTS=Anpassade typsnitt +of.options.CUSTOM_FONTS.tooltip.1=Anpassade typsnitt +of.options.CUSTOM_FONTS.tooltip.2= PÅ - använd anpassade typsnitt (standard), långsammare +of.options.CUSTOM_FONTS.tooltip.3= AV - använd standardtypsnittet, snabbare +of.options.CUSTOM_FONTS.tooltip.4=De anpassade typsnitten tillhandahålls av det aktuella +of.options.CUSTOM_FONTS.tooltip.5=resurspaketet. + +of.options.CUSTOM_COLORS=Anpassade färger +of.options.CUSTOM_COLORS.tooltip.1=Anpassade färger +of.options.CUSTOM_COLORS.tooltip.2= PÅ - anpassade färger används (standard), långsammare +of.options.CUSTOM_COLORS.tooltip.3= AV - standardfärger används, snabbare +of.options.CUSTOM_COLORS.tooltip.4=De anpassade färgerna tillhandahålls av det aktuella +of.options.CUSTOM_COLORS.tooltip.5=resurspaketet + +of.options.SWAMP_COLORS=Träskfärger +of.options.SWAMP_COLORS.tooltip.1=Träskfärger +of.options.SWAMP_COLORS.tooltip.2= PÅ - använd träskfärger (standard), långsammare +of.options.SWAMP_COLORS.tooltip.3= AV - använd inte träskfärger, snabbare +of.options.SWAMP_COLORS.tooltip.4=Träskfärgerna påverkar gräs, löv, klätterväxter och +of.options.SWAMP_COLORS.tooltip.5=vatten. + +of.options.SMOOTH_BIOMES=Utjämnade biomer +of.options.SMOOTH_BIOMES.tooltip.1=Utjämnade biomer +of.options.SMOOTH_BIOMES.tooltip.2= PÅ - biomkanter jämnas ut (standard), långsammare +of.options.SMOOTH_BIOMES.tooltip.3= AV - biomkanter jämnas inte ut, snabbare +of.options.SMOOTH_BIOMES.tooltip.4=Biomkanterna jämnas ut genom att sampla och beräkna +of.options.SMOOTH_BIOMES.tooltip.5=medelvärdet av färgen för alla block runtomkring. +of.options.SMOOTH_BIOMES.tooltip.6=Gräs, löv, klätterväxter och vatten påverkas. + +of.options.CONNECTED_TEXTURES=Anslutande texturer +of.options.CONNECTED_TEXTURES.tooltip.1=Anslutande texturer +of.options.CONNECTED_TEXTURES.tooltip.2= AV - inga anslutande texturer (standard) +of.options.CONNECTED_TEXTURES.tooltip.3= Snabbt - snabba anslutande texturer +of.options.CONNECTED_TEXTURES.tooltip.4= Snyggt - snygga anslutande texturer +of.options.CONNECTED_TEXTURES.tooltip.5=Anslutande texturer sammanfogar texturerna för glas, +of.options.CONNECTED_TEXTURES.tooltip.6=sandsten och bokhyllor när de placeras intill varandra. +of.options.CONNECTED_TEXTURES.tooltip.7=De anslutna texturerna tillhandahålls av det aktuella +of.options.CONNECTED_TEXTURES.tooltip.8=resurspaketet. + +of.options.NATURAL_TEXTURES=Naturliga texturer +of.options.NATURAL_TEXTURES.tooltip.1=Naturliga texturer +of.options.NATURAL_TEXTURES.tooltip.2= AV - inga naturliga texturer (standard) +of.options.NATURAL_TEXTURES.tooltip.3= PÅ - använd naturliga texturer +of.options.NATURAL_TEXTURES.tooltip.4=Naturliga texturer tar bort rutnätsliknande mönster som +of.options.NATURAL_TEXTURES.tooltip.5=skapas från upprepade block av samma typ. +of.options.NATURAL_TEXTURES.tooltip.6=Den använder roterade och speglade varianter av den +of.options.NATURAL_TEXTURES.tooltip.7=ursprungliga blocktexturen. Konfigurationen för naturliga +of.options.NATURAL_TEXTURES.tooltip.8=texturer tillhandahålls av det aktuella resurspaketet. + +of.options.CUSTOM_SKY=Anpassad himmel +of.options.CUSTOM_SKY.tooltip.1=Anpassad himmel +of.options.CUSTOM_SKY.tooltip.2= PÅ - anpassade himmeltexturer (standard), långsamt +of.options.CUSTOM_SKY.tooltip.3= AV - standardhimmel, snabbare +of.options.CUSTOM_SKY.tooltip.4=Texturerna för den anpassade himlen tillhandahålls av +of.options.CUSTOM_SKY.tooltip.5=det aktuella resurspaketet. + +of.options.CUSTOM_ITEMS=Anpassade föremål +of.options.CUSTOM_ITEMS.tooltip.1=Anpassade föremål +of.options.CUSTOM_ITEMS.tooltip.2= PÅ - anpassade föremålstexturer (standard), långsamt +of.options.CUSTOM_ITEMS.tooltip.3= AV - standardtexturer för föremål, snabbare +of.options.CUSTOM_ITEMS.tooltip.4=Det anpassade föremålstexturerna tillhandahålls av det +of.options.CUSTOM_ITEMS.tooltip.5=aktuella texturpaketet. + +of.options.CUSTOM_ENTITY_MODELS=Anpassade entitetsmodeller +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=Anpassade entitetsmodeller +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= PÅ - anpassade entitetsmodeller (standard), långsamt +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= AV - standardentitetsmodeller, snabbare +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=De anpassade entitetsmodellerna tillhandahålls av det +of.options.CUSTOM_ENTITY_MODELS.tooltip.5=aktuella resurspaketet. + +# Details + +of.options.CLOUDS=Moln +of.options.CLOUDS.tooltip.1=Moln +of.options.CLOUDS.tooltip.2= Standard - följer grafikinställningarna +of.options.CLOUDS.tooltip.3= Snabbt - lägre kvalitet, snabbare +of.options.CLOUDS.tooltip.4= Snyggt - högre kvalitet, långsammare +of.options.CLOUDS.tooltip.5= AV - inga moln, snabbast +of.options.CLOUDS.tooltip.6=Snabba moln renderas i 2D. +of.options.CLOUDS.tooltip.7=Snygga moln renderas i 3D. + +of.options.CLOUD_HEIGHT=Molnhöjd +of.options.CLOUD_HEIGHT.tooltip.1=Molnhöjd +of.options.CLOUD_HEIGHT.tooltip.2= AV - standardhöjd +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - ovanför världens höjdgräns + +of.options.TREES=Träd +of.options.TREES.tooltip.1=Träd +of.options.TREES.tooltip.2= Standard - följer grafikinställningarna +of.options.TREES.tooltip.3= Snabbt - lägre kvalitet, snabbare +of.options.TREES.tooltip.4= Smart - högre kvalitet, snabbt +of.options.TREES.tooltip.5= Snyggt - högst kvalitet, långsammare +of.options.TREES.tooltip.6=Snabba träd har ogenomskinliga löv. +of.options.TREES.tooltip.7=Snygga och smarta träd har genomskinliga löv. + +of.options.RAIN=Regn och snö +of.options.RAIN.tooltip.1=Regn och snö +of.options.RAIN.tooltip.2= Standard - följer grafikinställningarna +of.options.RAIN.tooltip.3= Snabbt - lätt regn/snö, snabbare +of.options.RAIN.tooltip.4= Snyggt - tungt regn/snö, långsammare +of.options.RAIN.tooltip.5= AV - inget regn/snö, snabbast +of.options.RAIN.tooltip.6=Regnljud och regnstänk kommer fortfarande höras och +of.options.RAIN.tooltip.7=synas om regn stängs av. + +of.options.SKY=Himmel +of.options.SKY.tooltip.1=Himmel +of.options.SKY.tooltip.2= PÅ - himlen syns, långsammare +of.options.SKY.tooltip.3= AV - himlen syns inte, snabbare +of.options.SKY.tooltip.4=Om himlen inaktiveras syns fortfarande månen och solen. + +of.options.STARS=Stjärnor +of.options.STARS.tooltip.1=Stjärnor +of.options.STARS.tooltip.2= PÅ - stjärnor syns, långsammare +of.options.STARS.tooltip.3= AV - stjärnor syns inte, snabbare + +of.options.SUN_MOON=Sol och måne +of.options.SUN_MOON.tooltip.1=Sol och måne +of.options.SUN_MOON.tooltip.2= PÅ - solen och månen syns (standard) +of.options.SUN_MOON.tooltip.3= AV - solen och månen syns inte (snabbare) + +of.options.SHOW_CAPES=Visa mantlar +of.options.SHOW_CAPES.tooltip.1=Visa mantlar +of.options.SHOW_CAPES.tooltip.2= PÅ - visa spelarmantlar (standard) +of.options.SHOW_CAPES.tooltip.3= AV - visa inte spelarmantlar + +of.options.TRANSLUCENT_BLOCKS=Genomskinliga block +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Genomskinliga block +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Snyggt - korrekt färgblandning (standard) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Snabbt - snabb färgblandning (snabbare) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Kontrollerar färgblandningen för genomskinliga block med +of.options.TRANSLUCENT_BLOCKS.tooltip.5=olika färger (färgat glas, vatten, is) när de placeras +of.options.TRANSLUCENT_BLOCKS.tooltip.6=bakom varandra med luft emellan. + +of.options.HELD_ITEM_TOOLTIPS=Infotext för föremål +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Infotext för föremål +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= PÅ - visa infotext för hållna föremål (standard) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= AV - visa inte infotext för hållna föremål + +of.options.ADVANCED_TOOLTIPS=Avancerade inforutor +of.options.ADVANCED_TOOLTIPS.tooltip.1=Avancerade inforutor +of.options.ADVANCED_TOOLTIPS.tooltip.2= PÅ - visa avancerade inforutor +of.options.ADVANCED_TOOLTIPS.tooltip.3= AV - visa inte avancerade inforutor (standard) +of.options.ADVANCED_TOOLTIPS.tooltip.4=Avancerade inforutor visar utvidgad information om +of.options.ADVANCED_TOOLTIPS.tooltip.5=föremål (id, hållbarhet) och shaderalternativ +of.options.ADVANCED_TOOLTIPS.tooltip.6=(id, källa, standardvärden). + +of.options.DROPPED_ITEMS=Släppta föremål +of.options.DROPPED_ITEMS.tooltip.1=Släppta föremål +of.options.DROPPED_ITEMS.tooltip.2= Standard - följer grafikinställningarna +of.options.DROPPED_ITEMS.tooltip.3= Snabbt - renderas i 2D, snabbare +of.options.DROPPED_ITEMS.tooltip.4= Snyggt - renderas i 3D, långsammare + +options.entityShadows.tooltip.1=Entitetsskuggor +options.entityShadows.tooltip.2= PÅ - visa entitetsskuggor +options.entityShadows.tooltip.3= AV - visa inte entitetsskuggor + +of.options.VIGNETTE=Vinjett +of.options.VIGNETTE.tooltip.1=Visuell effekt som mörklägger skärmens hörn en aning +of.options.VIGNETTE.tooltip.2= Standard - följer grafikinställningarna (standard) +of.options.VIGNETTE.tooltip.3= Snabbt - vinjetten är inaktiverad (snabbare) +of.options.VIGNETTE.tooltip.4= Snyggt - vinjetten är aktiverad (långsammare) +of.options.VIGNETTE.tooltip.5=Vinjetten kan ha en betydande verkan på bildfrekvensen, +of.options.VIGNETTE.tooltip.6=speciellt när fullskärm är aktiverad. +of.options.VIGNETTE.tooltip.7=Vinjetteffekten är riktigt diskret och kan stängas av +of.options.VIGNETTE.tooltip.8=utan någon fara. + +of.options.DYNAMIC_FOV=Dynamiskt synfält +of.options.DYNAMIC_FOV.tooltip.1=Dynamiskt synfält +of.options.DYNAMIC_FOV.tooltip.2= PÅ - aktivera dynamiskt synfält (standard) +of.options.DYNAMIC_FOV.tooltip.3= AV - inaktivera dynamiskt synfält +of.options.DYNAMIC_FOV.tooltip.4=Ändrar synfältet när du flyger, springer eller siktar +of.options.DYNAMIC_FOV.tooltip.5=med en pilbåge. + +of.options.DYNAMIC_LIGHTS=Dynamiskt ljus +of.options.DYNAMIC_LIGHTS.tooltip.1=Dynamiskt ljus +of.options.DYNAMIC_LIGHTS.tooltip.2= AV - inget dynamiskt ljus (standard) +of.options.DYNAMIC_LIGHTS.tooltip.3= Snabbt - snabbt dynamiskt ljus (uppdateras varje 500ms) +of.options.DYNAMIC_LIGHTS.tooltip.4= Snyggt - snyggt dynamiskt ljus (uppdateras i realtid) +of.options.DYNAMIC_LIGHTS.tooltip.5=Låter föremål som avger ljus (facklor, glödsten, etc.) +of.options.DYNAMIC_LIGHTS.tooltip.6=lysa upp omgivningen när de antingen hålls av dig eller +of.options.DYNAMIC_LIGHTS.tooltip.7=andra spelare eller släpps ned på marken. + +# Performance + +of.options.SMOOTH_FPS=Jämn bildfrekvens +of.options.SMOOTH_FPS.tooltip.1=Stabiliserar bildfrekvensen genom att rensa +of.options.SMOOTH_FPS.tooltip.2=grafikdrivrutinernas buffrar. +of.options.SMOOTH_FPS.tooltip.3= AV - ingen stabilisering, bildfrekvensen kan variera +of.options.SMOOTH_FPS.tooltip.4= PÅ - bildfrekvensen stabiliseras +of.options.SMOOTH_FPS.tooltip.5=Beror på grafikdrivrutinerna och märks inte alltid. + +of.options.SMOOTH_WORLD=Jämn värld +of.options.SMOOTH_WORLD.tooltip.1=Tar bort lag spikes som orsakas av den interna servern. +of.options.SMOOTH_WORLD.tooltip.2= AV - ingen stabilisering, bildfrekvensen kan variera +of.options.SMOOTH_WORLD.tooltip.3= PÅ - stabiliserar bildfrekvensen +of.options.SMOOTH_WORLD.tooltip.4=Stabiliserar bildfrekvensen genom att fördela inläsningen +of.options.SMOOTH_WORLD.tooltip.5=av den interna servern. +of.options.SMOOTH_WORLD.tooltip.6=Fungerar endast på lokala världar (enspelarläge). + +of.options.FAST_RENDER=Snabb rendering +of.options.FAST_RENDER.tooltip.1=Snabb rendering +of.options.FAST_RENDER.tooltip.2= AV - standardrendering (standard) +of.options.FAST_RENDER.tooltip.3= PÅ - optimerad rendering (snabbare) +of.options.FAST_RENDER.tooltip.4=Använder en optimerad renderingsalgoritm som höjer +of.options.FAST_RENDER.tooltip.5=grafikprocessorns läsninghastighet och kan höja +of.options.FAST_RENDER.tooltip.6=bildfrekvensen avsevärt. + +of.options.FAST_MATH=Snabb matematik +of.options.FAST_MATH.tooltip.1=Snabb matematik +of.options.FAST_MATH.tooltip.2= AV - standardmatematik (standard) +of.options.FAST_MATH.tooltip.3= PÅ - snabbare matematik +of.options.FAST_MATH.tooltip.4=Använder optimerade sin()- och cos()-funktioner för att +of.options.FAST_MATH.tooltip.5=utnyttja processorcachen mer och höja bildfrekvensen. + +of.options.CHUNK_UPDATES=Chunkuppdateringar +of.options.CHUNK_UPDATES.tooltip.1=Chunkuppdateringar +of.options.CHUNK_UPDATES.tooltip.2= 1 - långsammare inläsning, högre bildfrekvens (standard) +of.options.CHUNK_UPDATES.tooltip.3= 3 - snabbare inläsning, lägre bildfrekvens +of.options.CHUNK_UPDATES.tooltip.4= 5 - snabbaste inläsning, lägst bildfrekvens +of.options.CHUNK_UPDATES.tooltip.5=Antalet chunkuppdateringar per renderad bildruta. +of.options.CHUNK_UPDATES.tooltip.6=Högre värden kan göra bildfrekvensen ostabil. + +of.options.CHUNK_UPDATES_DYNAMIC=Dynamiska uppdateringar +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Dynamiska chunkuppdateringar +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= AV - standardantal uppdateringar per bildruta (standard) +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= PÅ - fler uppdateringar när spelaren står stilla +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=Dynamiska uppdateringar tvingar fler chunkuppdateringar +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=när spelaren står stilla för att läsa in världen snabbare. + +of.options.LAZY_CHUNK_LOADING=Slö chunkinläsning +of.options.LAZY_CHUNK_LOADING.tooltip.1=Slö chunkinläsning +of.options.LAZY_CHUNK_LOADING.tooltip.2= AV - standardinläsning på servrar +of.options.LAZY_CHUNK_LOADING.tooltip.3= PÅ - slö chunkinläsning på servrar (stabilare) +of.options.LAZY_CHUNK_LOADING.tooltip.4=Jämnar ut den integrerade chunkläsningen för servern +of.options.LAZY_CHUNK_LOADING.tooltip.5=genom att fördela chunkar över flera tickningar. +of.options.LAZY_CHUNK_LOADING.tooltip.6=Inaktivera om delar av världen inte läser in på rätt sätt. +of.options.LAZY_CHUNK_LOADING.tooltip.7=Fungerar bara i lokala världar och enkärniga +of.options.LAZY_CHUNK_LOADING.tooltip.8=processorer. + +# Animations + +of.options.animation.allOn=Allt PÅ +of.options.animation.allOff=Allt AV +of.options.animation.dynamic=Dynamiskt + +of.options.ANIMATED_WATER=Animerat vatten +of.options.ANIMATED_LAVA=Animerad lava +of.options.ANIMATED_FIRE=Animerad eld +of.options.ANIMATED_PORTAL=Animerade portaler +of.options.ANIMATED_REDSTONE=Animerad redstone +of.options.ANIMATED_EXPLOSION=Animerade explosioner +of.options.ANIMATED_FLAME=Animerade eldflammor +of.options.ANIMATED_SMOKE=Animerad rök +of.options.VOID_PARTICLES=Voidpartiklar +of.options.WATER_PARTICLES=Vattenpartiklar +of.options.RAIN_SPLASH=Regnstänk +of.options.PORTAL_PARTICLES=Portalpartiklar +of.options.POTION_PARTICLES=Brygdpartiklar +of.options.DRIPPING_WATER_LAVA=Droppande vatten/lava +of.options.ANIMATED_TERRAIN=Animerad terräng +of.options.ANIMATED_TEXTURES=Animerade texturer +of.options.FIREWORK_PARTICLES=Fyrverkeripartiklar + +# Other + +of.options.LAGOMETER=Laggmätare +of.options.LAGOMETER.tooltip.1=Visar laggmätaren på felsökningsskärmen (F3). +of.options.LAGOMETER.tooltip.2= * Orange - Minnesskräpsamling +of.options.LAGOMETER.tooltip.3= * Turkos - Antal tickningar +of.options.LAGOMETER.tooltip.4= * Blå - Schemalagda körningar +of.options.LAGOMETER.tooltip.5= * Lila - Chunkuppladddningar +of.options.LAGOMETER.tooltip.6= * Röd - Chunkuppdateringar +of.options.LAGOMETER.tooltip.7= * Gul - Synlighetskontroller +of.options.LAGOMETER.tooltip.8= * Grön - Terrängrendering + +of.options.PROFILER=Felsökningsprofilerare +of.options.PROFILER.tooltip.1=Felsökningsprofilerare +of.options.PROFILER.tooltip.2= PÅ - felsökningsprofilerare är igång, långsammare +of.options.PROFILER.tooltip.3= AV - felsökningsprofilerare är inte igång, snabbare +of.options.PROFILER.tooltip.4=Felsökningsprofileraren samlar in och visar +of.options.PROFILER.tooltip.5=felsökningsinfo när felsökningsskärmen är öppen (F3). + +of.options.WEATHER=Väder +of.options.WEATHER.tooltip.1=Väder +of.options.WEATHER.tooltip.2= PÅ - väder är aktiverat, långsammare +of.options.WEATHER.tooltip.3= AV - väder är inaktiverat, snabbare +of.options.WEATHER.tooltip.4=Denna inställning omfattar regn, snö och åska. +of.options.WEATHER.tooltip.5=Detta fungerar bara i lokala världar. + +of.options.time.dayOnly=Endast dag +of.options.time.nightOnly=Endast natt + +of.options.TIME=Tid +of.options.TIME.tooltip.1=Tid +of.options.TIME.tooltip.2= Standard - vanliga dag/natt-cykler +of.options.TIME.tooltip.3= Endast dag - dag hela tiden +of.options.TIME.tooltip.4= Endast natt - natt hela tiden +of.options.TIME.tooltip.5=Tidsinställningen fungerar endast i KREATIVT läge och +of.options.TIME.tooltip.6=för lokala världar. + +options.fullscreen.tooltip.1=Fullskärm +options.fullscreen.tooltip.2= PÅ - använd fullskärmsläge +options.fullscreen.tooltip.3= AV - använd fönsterläge +options.fullscreen.tooltip.4=Fullskärmsläge kan vara snabbare eller långsammare än +options.fullscreen.tooltip.5=fönsterläge beroende på grafikkortet. + +of.options.FULLSCREEN_MODE=Fullskärmsläge +of.options.FULLSCREEN_MODE.tooltip.1=Fullskärmsläge +of.options.FULLSCREEN_MODE.tooltip.2= Standard - använd datorns upplösning, långsammare +of.options.FULLSCREEN_MODE.tooltip.3= BxH - använd anpassad upplösning, kan vara snabbare +of.options.FULLSCREEN_MODE.tooltip.4=Den valda upplösningen används i fullskärmsläge (F11). +of.options.FULLSCREEN_MODE.tooltip.5=Lägre upplösningar bör vanligtvis vara snabbare. + +of.options.SHOW_FPS=Visa bildfrekvens +of.options.SHOW_FPS.tooltip.1=Visar kort information om bildfrekvens och rendering. +of.options.SHOW_FPS.tooltip.2= C: - antal chunkrenderingar +of.options.SHOW_FPS.tooltip.3= E: - antal renderade entiteter + blockentiteter +of.options.SHOW_FPS.tooltip.4= U: - antal chunkuppdateringar +of.options.SHOW_FPS.tooltip.5=Informationen visas endast när felsökningsskärmen (F3) +of.options.SHOW_FPS.tooltip.6=inte är öppen. + +of.options.save.default=Standard (2s) +of.options.save.20s=20s +of.options.save.3min=3min +of.options.save.30min=30min + +of.options.AUTOSAVE_TICKS=Autosparning +of.options.AUTOSAVE_TICKS.tooltip.1=Intervall för automatisk sparning. +of.options.AUTOSAVE_TICKS.tooltip.2=Standardintervallet (2s) REKOMMENDERAS INTE. +of.options.AUTOSAVE_TICKS.tooltip.3=Autosparning är ökänd för att orsaka lag spikes. + +of.options.SCREENSHOT_SIZE=Skärmdumpsstorlek +of.options.SCREENSHOT_SIZE.tooltip.1=Skärmdumpsstorlek +of.options.SCREENSHOT_SIZE.tooltip.2= Standard - standardstorlek för skärmdumpar +of.options.SCREENSHOT_SIZE.tooltip.3= 2x-4x - anpassad storlek för skärmdumpar +of.options.SCREENSHOT_SIZE.tooltip.4=Större skärmdumpar kan kräva mer minne. +of.options.SCREENSHOT_SIZE.tooltip.5=Inte kompatibel med Snabb rendering och Kantutjämning. +of.options.SCREENSHOT_SIZE.tooltip.6=Kräver att grafikprocessorn har stöd för framebuffer. diff --git a/src/minecraft/assets/minecraft/optifine/lang/uk_UA.lang b/src/minecraft/assets/minecraft/optifine/lang/uk_UA.lang new file mode 100644 index 0000000..0246a26 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/uk_UA.lang @@ -0,0 +1,592 @@ +#Translated by Cool_boy +# General +of.general.ambiguous=невизначений +of.general.custom=Користувацький +of.general.from=З +of.general.id=Id +of.general.restart=перезапуск +of.general.smart=Розумно + +# Keys +of.key.zoom=Приблизити + +# Message +of.message.aa.shaders1=Згладжування не сумісне з шейдерами. +of.message.aa.shaders2=Будь ласка, відключіть шейдери щоб увімкнути цю функцію. + +of.message.af.shaders1=Анізотропна фільтрація не сумісне з шейдерами. +of.message.af.shaders2=Будь ласка, відключіть шейдери щоб увімкнути цю функцію. + +of.message.an.shaders1=3D ефект не сумісний з шейдерами. +of.message.an.shaders2=Вимкніть шейдери щоб увімкнути цю функцію. + +of.message.fr.shaders1=Швидкий рендер не сумісний з шейдерами. +of.message.fr.shaders2=Будь ласка, вимкнуть шейдери щоб увімкнути цю функцію. + +of.message.shaders.aa1=Шейдери не сумісні зі згладжуванням. +of.message.shaders.aa2=Будь ласка, встановіть Якість -> Згладжування на Вимк і перезапустіть гру. + +of.message.shaders.af1=Шейдери не сумісні із анізотропною фільтрацією. +of.message.shaders.af2=Будь ласка, встановіть Якість -> Анізотропна фільтрація на Вимк і перезапустіть гру. + +of.message.shaders.fr1=Шейдери не сумісні з швидким рендером. +of.message.shaders.fr2=Будь ласка, встановіть Продуктивність -> Швидкий рендер на Вимк і перезапустіть гру. + +of.message.shaders.an1=Шейдери не сумісні з 3D анагліфом. +of.message.shaders.an2=Будь-ласка, встановіть Інші -> 3D ефект на Вимк. + +of.message.newVersion=Нова версія §eOptiFine§f доступна: §e%s§f +of.message.java64Bit=Встанови §e64-bit Java§f щоб покращити продуктивність +of.message.openglError=§eOpenGL Error§f: %s (%s) + +of.message.shaders.loading=Завантажуємо шейдери: %s + +of.message.other.reset=Встановити всі налаштування на їхні початкові значення? + +of.message.loadingVisibleChunks=Завантажувати видимі чанки + +# Video settings + +options.graphics.tooltip.1=Візуальна якість +options.graphics.tooltip.2= Швидка - нижча якість, швидше +options.graphics.tooltip.3= Красива - вижча якість, повільніше +options.graphics.tooltip.4=Змінює зовнішній вигляд хмар, листя води +options.graphics.tooltip.5=тіней і сторін трави. + +of.options.renderDistance.tiny=Маленька +of.options.renderDistance.short=Коротка +of.options.renderDistance.normal=Нормальна +of.options.renderDistance.far=Далека +of.options.renderDistance.extreme=Надзвичайна + +options.renderDistance.tooltip.1=Видима відстань +options.renderDistance.tooltip.2= 2 Маленька - 32м (Найшвидше) +options.renderDistance.tooltip.3= 4 Коротка - 64м (Швидша) +options.renderDistance.tooltip.4= 8 Нормальна - 128м +options.renderDistance.tooltip.5= 16 Далека - 256м (повільніше) +options.renderDistance.tooltip.6= 32 Надзвичайна - 512м (найповільніше!) +options.renderDistance.tooltip.7=Для Надзвичайної видимої відстані потрібна велика кількість ресурсів комп'ютера! +options.renderDistance.tooltip.8=Значення більша за 16 Далеко ефективні лиш для одиночних світів. + +options.ao.tooltip.1=М'яке освітлення +options.ao.tooltip.2= Вимк - без м'якого освітлення (Швидка) +options.ao.tooltip.3= Мінімум - просте м'яке освітлення (повільніше) +options.ao.tooltip.4= Максимум - комплексне м'яке освітлення (дуже повільно) + +options.framerateLimit.tooltip.1=Максимальна швидкість передачі кадрів +options.framerateLimit.tooltip.2= VSync - ліміт до максимальної кількості кадрів монітора (60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - змінні +options.framerateLimit.tooltip.4= Необмежено - без ліміту (Найшвидше) +options.framerateLimit.tooltip.5=Гранична частота зміни кадрів зменшує FPS навіть якщо +options.framerateLimit.tooltip.6=значення ліміту не досягнуто. +of.options.framerateLimit.vsync=VSync + +of.options.AO_LEVEL=Рівень м'якого освітлення +of.options.AO_LEVEL.tooltip.1=Рівень м'якого освітлення +of.options.AO_LEVEL.tooltip.2= Вимк - без тіней +of.options.AO_LEVEL.tooltip.3= 50%% - легкі тіні +of.options.AO_LEVEL.tooltip.4= 100%% - темні тіні + +options.viewBobbing.tooltip.1=Реалістичний рух +options.viewBobbing.tooltip.2=При використанні міпмапів встановіть його в положення Вимк для досягнення найкращих результатів. + +options.guiScale.tooltip.1=Розмір GUI +options.guiScale.tooltip.2=Найменше GUI буде швидше +options.guiScale.tooltip.2= Авто - максимальний розмір +options.guiScale.tooltip.3= Малий, Нормальний, Великий - 1x до 3x +options.guiScale.tooltip.4= 4x до 10x - доступні на 4K дисплеях +options.guiScale.tooltip.5=Непарні значення (1x, 3x, 5x ...) не підтримуються юнікодом. +options.guiScale.tooltip.6=Менший GUI швидший. + +options.vbo.tooltip.1=Об'єкти буфера вершин +options.vbo.tooltip.2=Використовує альтернативну технологію рендерингу, що зазвичай +options.vbo.tooltip.3=швидше (5-10%%) чим простий рендер. + +options.gamma.tooltip.1=Зменшує яскравість темніших об'єктів +options.gamma.tooltip.2= Похмурий - Стандартна яскравість +options.gamma.tooltip.3= 1-99%% - змінні +options.gamma.tooltip.4= Яскраво - максимальна яскравість темних об'єктів +options.gamma.tooltip.5=Ця опція не змінює яскравість +options.gamma.tooltip.6=повністю чорних об'єктів + +options.anaglyph.tooltip.1=3D анагліф +options.anaglyph.tooltip.2=Вмикає стереоскопічний 3D ефекти використовуючи різні кольори +options.anaglyph.tooltip.3=для кожного ока. +options.anaglyph.tooltip.4=Потребує червоно-сині окуляри для перегляду. + +options.blockAlternatives.tooltip.1=Альтернативні блоки +options.blockAlternatives.tooltip.2=Використовує альтернативні моделі для деяких блоків. +options.blockAlternatives.tooltip.3=Базується на обраному ресурспаці. + +of.options.ALTERNATE_BLOCKS=Альтернативні блоки +of.options.ALTERNATE_BLOCKS.tooltip.1=Альтернативні блоки +of.options.ALTERNATE_BLOCKS.tooltip.2=Використовує альтернативні моделі для деяких блоків. +of.options.ALTERNATE_BLOCKS.tooltip.3=Базується на обраному ресурспаці. + +of.options.FOG_FANCY=Туман +of.options.FOG_FANCY.tooltip.1=Тип туману +of.options.FOG_FANCY.tooltip.2= Швидкий - Швидкий туман +of.options.FOG_FANCY.tooltip.3= Красивий - Повільніший туман, виглядає краще +of.options.FOG_FANCY.tooltip.4= Вимк - без туману, найшвидше +of.options.FOG_FANCY.tooltip.5=Красивий туман буде доступний лиш тоді, коли +of.options.FOG_FANCY.tooltip.6=його підтримує відеокарта. + +of.options.FOG_START=Поява туману +of.options.FOG_START.tooltip.1=Поява туману +of.options.FOG_START.tooltip.2= 0.2 - туман з'являється недалеко від гравця +of.options.FOG_START.tooltip.3= 0.8 - туман з'являється далеко від гравця +of.options.FOG_START.tooltip.4=Ця опція зазвичай не зменшує продуктивність. + +of.options.CHUNK_LOADING=Завантаження чанків +of.options.CHUNK_LOADING.tooltip.1=Завантаження чанків +of.options.CHUNK_LOADING.tooltip.2= Базове - нестабільше FPS коли завантажується чанк +of.options.CHUNK_LOADING.tooltip.3= Згладжене - стабільше FPS +of.options.CHUNK_LOADING.tooltip.4= Multi-Core - стабільше FPS, 3x швидше завантжаення світу +of.options.CHUNK_LOADING.tooltip.5=Згладжене і Multi-Core видаляють заікання і +of.options.CHUNK_LOADING.tooltip.6=фрізи спричинені завантаженням чанків. +of.options.CHUNK_LOADING.tooltip.7=Multi-Core може збільшити до 3 разів швидкість завантаження світу +of.options.CHUNK_LOADING.tooltip.8=збільшуючи FPS завдяки використання другого ядра процессора. +of.options.chunkLoading.smooth=Згладжене +of.options.chunkLoading.multiCore=Multi-Core + +of.options.shaders=Шейдери... +of.options.shadersTitle=Шейдери + +of.options.shaders.packNone=Вимк +of.options.shaders.packDefault=(внутрішній) + +of.options.shaders.ANTIALIASING=Згладжування +of.options.shaders.NORMAL_MAP=Нормальна карта +of.options.shaders.SPECULAR_MAP=Дзеркальна карта +of.options.shaders.RENDER_RES_MUL=Якість рендеру +of.options.shaders.SHADOW_RES_MUL=Якість тіней +of.options.shaders.HAND_DEPTH_MUL=Ручна глибина +of.options.shaders.CLOUD_SHADOW=Тінь від хмар +of.options.shaders.OLD_HAND_LIGHT=Старе освітлення руки +of.options.shaders.OLD_LIGHTING=Старе освітлення +of.options.shaders.SHADER_PACK=Шейдерпак + +of.options.shaders.shadersFolder=Папка з шейдерами +of.options.shaders.shaderOptions=Налаштування шейдерів... + +of.options.shaderOptionsTitle=Налаштування шейдерів + +of.options.quality=Якість... +of.options.qualityTitle=Налаштування якості + +of.options.details=Деталі... +of.options.detailsTitle=Налаштування деталей + +of.options.performance=Продуктивність... +of.options.performanceTitle=Налаштування продуктивності + +of.options.animations=Анімації... +of.options.animationsTitle=Налаштування анімації + +of.options.other=Інші... +of.options.otherTitle=Інші налаштування + +of.options.other.reset=Скинути всі налаштування... + +of.shaders.profile=Профіль + +# Quality + +of.options.mipmap.bilinear=Білінійна +of.options.mipmap.linear=Лінійна +of.options.mipmap.nearest=Найближча +of.options.mipmap.trilinear=Трилінійна + +options.mipmapLevels.tooltip.1=Візуальний ефект який змушує далекі об'єкти виглядати краще +options.mipmapLevels.tooltip.2=розмиваючи деталі текстур +options.mipmapLevels.tooltip.3= Вимк - без згладжування +options.mipmapLevels.tooltip.4= 1 - мінімальне згладжування +options.mipmapLevels.tooltip.5= 4 - максивальне згладжування +options.mipmapLevels.tooltip.6=Ця опція зазвичай не впливає на продуктивність. + +of.options.MIPMAP_TYPE=Тип Міпмап +of.options.MIPMAP_TYPE.tooltip.1=Візуальний ефект який змушує далекі об'єкти виглядати краще +of.options.MIPMAP_TYPE.tooltip.2=розмиваючи деталі текстур +of.options.MIPMAP_TYPE.tooltip.3= Найближчий - грубе згладжування (найшвидша) +of.options.MIPMAP_TYPE.tooltip.4= Лінійне - нормальне згладжування +of.options.MIPMAP_TYPE.tooltip.5= Білінійне - краще згладжування +of.options.MIPMAP_TYPE.tooltip.6= Трилінійне - найкраще згладжування (повільніше) + + +of.options.AA_LEVEL=Згладжування +of.options.AA_LEVEL.tooltip.1=Згладжування +of.options.AA_LEVEL.tooltip.2= Вимк - (базове) без згладжування (швидке) +of.options.AA_LEVEL.tooltip.3= 2-16 - згладжує лінії і границі (повільніше) +of.options.AA_LEVEL.tooltip.4=Згладжування розмиває зазубрені границі і +of.options.AA_LEVEL.tooltip.5=гострі зміни кольору. +of.options.AA_LEVEL.tooltip.6=Коли увімкнуто, то по суті зменшує FPS. +of.options.AA_LEVEL.tooltip.7=Не всі рівні підтримуються різними відеокартами. +of.options.AA_LEVEL.tooltip.8=Ефективне після ПЕРЕЗАПУСКУ! + +of.options.AF_LEVEL=Анізотропна фільтрація +of.options.AF_LEVEL.tooltip.1=Анізотропна фільтрація +of.options.AF_LEVEL.tooltip.2= Вимк - (базово) стандартна деталь текстури (швидка) +of.options.AF_LEVEL.tooltip.3= 2-16 - кращі деталі у Міпмап текстурах (повільніше) +of.options.AF_LEVEL.tooltip.4=Анізотропна фільтрація відновлює деталі у +of.options.AF_LEVEL.tooltip.5=Міпмап текстурах. +of.options.AF_LEVEL.tooltip.6=Коли ввімкнуто, зменшує FPS. + +of.options.CLEAR_WATER=Чиста вода +of.options.CLEAR_WATER.tooltip.1=Чиста вода +of.options.CLEAR_WATER.tooltip.2= Увімк - чиста, прозора вода +of.options.CLEAR_WATER.tooltip.3= Вимк - стандартна вода + +of.options.RANDOM_MOBS=Випадкові текстури мобів +of.options.RANDOM_MOBS.tooltip.1=Випадкові текстури мобів +of.options.RANDOM_MOBS.tooltip.2= Вимк - одна текстура для моба, швидше +of.options.RANDOM_MOBS.tooltip.3= Увімк - випадкові текстури, повільніше +of.options.RANDOM_MOBS.tooltip.4=Випадкові текстури мобів використовує різні текстури для моба. +of.options.RANDOM_MOBS.tooltip.5=Це потребує ресурспак з різними текстурами для одного моба. + +of.options.BETTER_GRASS=Краща трава +of.options.BETTER_GRASS.tooltip.1=Краща трава +of.options.BETTER_GRASS.tooltip.2= Вимк - базова текстура блока трави, швидше +of.options.BETTER_GRASS.tooltip.3= Швидка - зелена бокова текстура блока трави, повільніше +of.options.BETTER_GRASS.tooltip.4= Красива - динаміча текстура сторони блока, повільніше + +of.options.BETTER_SNOW=Кращий сніг +of.options.BETTER_SNOW.tooltip.1=Кращий сніг +of.options.BETTER_SNOW.tooltip.2= Вимк - базовий сніг, швидше +of.options.BETTER_SNOW.tooltip.3= Увімк - кращий сніг, повільніше +of.options.BETTER_SNOW.tooltip.4=Показує сніг під прозорими блоками (огорожа, висока трава) +of.options.BETTER_SNOW.tooltip.5=коли межує з блоком снігу + +of.options.CUSTOM_FONTS=Власні шрифти +of.options.CUSTOM_FONTS.tooltip.1=Власні шрифти +of.options.CUSTOM_FONTS.tooltip.2= Увімк - використовує власні шрифти (базово), повільніше +of.options.CUSTOM_FONTS.tooltip.3= Вимк - використовує базовий шрифт, швидше +of.options.CUSTOM_FONTS.tooltip.4=Власні шрифти встановлюються ресурспаком +of.options.CUSTOM_FONTS.tooltip.5= + +of.options.CUSTOM_COLORS=Власні кольори +of.options.CUSTOM_COLORS.tooltip.1=Custom Colors +of.options.CUSTOM_COLORS.tooltip.2= Увімк - використовує власні кольори (базово), повільніше +of.options.CUSTOM_COLORS.tooltip.3= Вимк - використовує базові кольори, швидше +of.options.CUSTOM_COLORS.tooltip.4=Власні кольори встановлюються ресурспаком +of.options.CUSTOM_COLORS.tooltip.5= + +of.options.SWAMP_COLORS=Кольори болота +of.options.SWAMP_COLORS.tooltip.1=Кольори болота +of.options.SWAMP_COLORS.tooltip.2= Увімк - використовуються кольори болота (базово), повільніше +of.options.SWAMP_COLORS.tooltip.3= Вимк - не використовує кольори болота, швидше +of.options.SWAMP_COLORS.tooltip.4=Кольори болота впливають на траву, листя, воду і ліани. + +of.options.SMOOTH_BIOMES=Плавні біоми +of.options.SMOOTH_BIOMES.tooltip.1=Плавні біоми +of.options.SMOOTH_BIOMES.tooltip.2= Увімк - згладжування границі біомів (базово), повільніше +of.options.SMOOTH_BIOMES.tooltip.3= Вимк - без згладжування границь біомів, швидше +of.options.SMOOTH_BIOMES.tooltip.4=Згладжування зміняє кольори декількох блоків на границі +of.options.SMOOTH_BIOMES.tooltip.5=щоб зменшити різку зміну кольорів. +of.options.SMOOTH_BIOMES.tooltip.6=Впливає на траву, листя, воду і ліани. + +of.options.CONNECTED_TEXTURES=З'єднані текстури +of.options.CONNECTED_TEXTURES.tooltip.1=З'єднані текстури +of.options.CONNECTED_TEXTURES.tooltip.2= Вимк - без поєднаних текстур (базово) +of.options.CONNECTED_TEXTURES.tooltip.3= Швидка - швидкі поєднані текстури +of.options.CONNECTED_TEXTURES.tooltip.4= Красива - красиві поєднані текстури +of.options.CONNECTED_TEXTURES.tooltip.5=З'єднані текстури впливають на скло, +of.options.CONNECTED_TEXTURES.tooltip.6=пісковик і полички, що розташовані +of.options.CONNECTED_TEXTURES.tooltip.7=разом. Приєднанні текстури підтримують +of.options.CONNECTED_TEXTURES.tooltip.8=обрані ресурспаки. + +of.options.NATURAL_TEXTURES=Натуральні текстури +of.options.NATURAL_TEXTURES.tooltip.1=Натуральні текстури +of.options.NATURAL_TEXTURES.tooltip.2= Вимк - без натуральних текстур (базово) +of.options.NATURAL_TEXTURES.tooltip.3= Увімк - використовує натуральні текстури +of.options.NATURAL_TEXTURES.tooltip.4=Натуральні текстури видаляють сітку як шаблон +of.options.NATURAL_TEXTURES.tooltip.5=створений повторенням блоків одного типу. +of.options.NATURAL_TEXTURES.tooltip.6=Це використовує перевернуті і повернуті текстури +of.options.NATURAL_TEXTURES.tooltip.7=блока. Налаштування натуральних текстур +of.options.NATURAL_TEXTURES.tooltip.8=надходить з обраного пакету текстур. + +of.options.CUSTOM_SKY=Власне небо +of.options.CUSTOM_SKY.tooltip.1=Власне небо +of.options.CUSTOM_SKY.tooltip.2= Увімк - власні текстури неба (базово), повільно +of.options.CUSTOM_SKY.tooltip.3= Вимк - базове небо, швидше +of.options.CUSTOM_SKY.tooltip.4=Власна текстура неба може бути змінена +of.options.CUSTOM_SKY.tooltip.5=ресурспаком + +of.options.CUSTOM_ITEMS=Власні текстури речей +of.options.CUSTOM_ITEMS.tooltip.1=Власні текстури речей +of.options.CUSTOM_ITEMS.tooltip.2= Увімк - власні текстури речей (базово), повільно +of.options.CUSTOM_ITEMS.tooltip.3= Вимк - базові речі, швидше +of.options.CUSTOM_ITEMS.tooltip.4=Власна текстура неба може бути змінена +of.options.CUSTOM_ITEMS.tooltip.5=ресурспаком + +of.options.CUSTOM_ENTITY_MODELS=Власні моделі істот +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=Власні моделі істот +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= Увімк - власні моделі для істот (базово), повільно +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= Вимк - стандартні моделі істот, швидше +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=Моделі істот можуть бути змінені +of.options.CUSTOM_ENTITY_MODELS.tooltip.5=ресурспаком + +# Details + +of.options.CLOUDS=Хмари +of.options.CLOUDS.tooltip.1=Хмари +of.options.CLOUDS.tooltip.2= Стандартні - як в налаштуваннях відео +of.options.CLOUDS.tooltip.3= Швидкі - нижча якість, швидше +of.options.CLOUDS.tooltip.4= Красива - вища якість, повільніше +of.options.CLOUDS.tooltip.5= Вимк - без хмар, найшвидше +of.options.CLOUDS.tooltip.6=Швидкі хмари відображаються у 2D. +of.options.CLOUDS.tooltip.7=Красиві хмари відображаються у 3D. + +of.options.CLOUD_HEIGHT=Висота хмар +of.options.CLOUD_HEIGHT.tooltip.1=Висота хмар +of.options.CLOUD_HEIGHT.tooltip.2= Вимк - стандартна висота +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - вище ліміту світу + +of.options.TREES=Дерева +of.options.TREES.tooltip.1=Дерева +of.options.TREES.tooltip.2= Стандартні - як в налаштуваннях відео +of.options.TREES.tooltip.3= Швидкі - нижча якість, швидше +of.options.TREES.tooltip.4= Розумні - вища якість, швидше +of.options.TREES.tooltip.5= Красива - найвища якість, повільніше +of.options.TREES.tooltip.6=Швидкі дерева мають непрозоре листя. +of.options.TREES.tooltip.7=Красиві дерева мають прозорі листя. + +of.options.RAIN=Дощ і сніг +of.options.RAIN.tooltip.1=Дощ і сніг +of.options.RAIN.tooltip.2= Стандартні - як в налаштуваннях відео +of.options.RAIN.tooltip.3= Швидкі - нижча якість, швидше +of.options.RAIN.tooltip.4= Красиві - важкий дощ/сніг, повільніше +of.options.RAIN.tooltip.5= Вимк - без дощу/снігу, найшвидше +of.options.RAIN.tooltip.6=Коли дощ вимкнено звуки крапель залишатимуться +of.options.RAIN.tooltip.7= + +of.options.SKY=Небо +of.options.SKY.tooltip.1=Небо +of.options.SKY.tooltip.2= Увімк - небо видиме, повільніше +of.options.SKY.tooltip.3= Вимк - небо невидиме, швидше +of.options.SKY.tooltip.4=Коли небо вимкнене, сонце і місяць досі помітні. + +of.options.STARS=Зірки +of.options.STARS.tooltip.1=Зірки +of.options.STARS.tooltip.2= Увімк - зірки видимі, повільніше +of.options.STARS.tooltip.3= Вимк - зірки невидимі, швидше + +of.options.SUN_MOON=Сонце і місяць +of.options.SUN_MOON.tooltip.1=Сонце і місяць +of.options.SUN_MOON.tooltip.2= Увімк - сонце і місяць видимі (базово) +of.options.SUN_MOON.tooltip.3= Вимк - сонце і місяць невидимі (швидше) + +of.options.SHOW_CAPES=Показувати плащі +of.options.SHOW_CAPES.tooltip.1=Показувати плащі +of.options.SHOW_CAPES.tooltip.2= Увімк - показувати плащі (базово) +of.options.SHOW_CAPES.tooltip.3= Вимк - не показувати плащі (швидше) + +of.options.TRANSLUCENT_BLOCKS=Напівпрозорі блоки +of.options.TRANSLUCENT_BLOCKS.tooltip.1=Напівпрозорі блоки +of.options.TRANSLUCENT_BLOCKS.tooltip.2= Красива - правильне змішування кольорів (базово) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= Швидка - швидше змішування кольорів (швидше) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=Контролює змішування кольорів напівпрозорих блоків +of.options.TRANSLUCENT_BLOCKS.tooltip.5=з різним кольором (скло, вода, лід) +of.options.TRANSLUCENT_BLOCKS.tooltip.6=коли між ними є повітря. + +of.options.HELD_ITEM_TOOLTIPS=Спливаючі підказки +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=Спливаючі підказки +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= Увімк - показувати спливаючі підказки (базово) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= Вимк - не показувати підказок + +of.options.ADVANCED_TOOLTIPS=Розширені підказки +of.options.ADVANCED_TOOLTIPS.tooltip.1=Розширені спливаючі підказки +of.options.ADVANCED_TOOLTIPS.tooltip.2= Увімк - показувати розширені підказки +of.options.ADVANCED_TOOLTIPS.tooltip.3= Вимк - не показувати розширені підказки (базово) +of.options.ADVANCED_TOOLTIPS.tooltip.4=Розширені підказки показують більше інформації про +of.options.ADVANCED_TOOLTIPS.tooltip.5=речі (id, міцність) і для налаштування шейдерів +of.options.ADVANCED_TOOLTIPS.tooltip.6=(id, джерело, стандартне значення) + +of.options.DROPPED_ITEMS=Викинуті речі +of.options.DROPPED_ITEMS.tooltip.1=Викинуті речі +of.options.DROPPED_ITEMS.tooltip.2= Базові - як у налаштуваннях відео +of.options.DROPPED_ITEMS.tooltip.3= Швидка - викинуті речі у 2D, швидше +of.options.DROPPED_ITEMS.tooltip.4= Красива - викинуті речі у 3D, повільніше + +options.entityShadows.tooltip.1=Тіні сутностей +options.entityShadows.tooltip.2= Увімк - показувати тіні сутностей +options.entityShadows.tooltip.3= Вимк - вимкнути тіні сутностей + +of.options.VIGNETTE=Віньєтка +of.options.VIGNETTE.tooltip.1=Візуальний ефект який затемняє краї +of.options.VIGNETTE.tooltip.2= Базово - як в налаштуваннях графіки +of.options.VIGNETTE.tooltip.3= Швидка - віньтка вимкнена (швидша) +of.options.VIGNETTE.tooltip.4= Красива - віньєтка увімкнена (повільніше) +of.options.VIGNETTE.tooltip.5=Віньєтка може зробити істотний вплив на FPS, +of.options.VIGNETTE.tooltip.6=особливо при грі у повноекранному режимі. +of.options.VIGNETTE.tooltip.7=Ефект не дуже важливий і легко +of.options.VIGNETTE.tooltip.8=може бути вимкненим + +of.options.DYNAMIC_FOV=Динамічний FOV +of.options.DYNAMIC_FOV.tooltip.1=Динамічний FOV +of.options.DYNAMIC_FOV.tooltip.2= Увімк - динамічний FOV увімкнуто(базово) +of.options.DYNAMIC_FOV.tooltip.3= Вимк - динамічний FOV вимкнуто +of.options.DYNAMIC_FOV.tooltip.4=Змінює поле зору (FOV) коли літаємо, біжимо +of.options.DYNAMIC_FOV.tooltip.5=чи натягуємо лук. + +of.options.DYNAMIC_LIGHTS=Динамічне освітлення +of.options.DYNAMIC_LIGHTS.tooltip.1=Динамічне освітлення +of.options.DYNAMIC_LIGHTS.tooltip.2= Вимк - без динамічного освітлення (базово) +of.options.DYNAMIC_LIGHTS.tooltip.3= Швидка - швидке динамічне освітлення (оновлення кожні 500мс) +of.options.DYNAMIC_LIGHTS.tooltip.4= Красива - красиве динамічне освітлення (оновлення в реальному часу) +of.options.DYNAMIC_LIGHTS.tooltip.5=Дозволяє випромінювати світло речам (факел, світлокамінь, т.д.) +of.options.DYNAMIC_LIGHTS.tooltip.6=щоб освітлювати все навкруги, коли знаходяться в руці, +of.options.DYNAMIC_LIGHTS.tooltip.7=вдягнуті іншим гравцем або викинуті на землю. + +# Performance + +of.options.SMOOTH_FPS=Згладжене FPS +of.options.SMOOTH_FPS.tooltip.1=Стабілізує FPS промиванням графічних буферів драйвера +of.options.SMOOTH_FPS.tooltip.2= Вимк - нема стабілізації, FPS може коливатись +of.options.SMOOTH_FPS.tooltip.3= Увімк - FPS стабілізується +of.options.SMOOTH_FPS.tooltip.4=Цей параметр залежить від графічного драйвера +of.options.SMOOTH_FPS.tooltip.5=і його вплив не завжди помітний + +of.options.SMOOTH_WORLD=Згладжений світ +of.options.SMOOTH_WORLD.tooltip.1=Прибирає фрізи при завантаження чатків. +of.options.SMOOTH_WORLD.tooltip.2= Вимк - нема стабілізації, FPS може коливатись +of.options.SMOOTH_WORLD.tooltip.3= Увімк - FPS стабілізується +of.options.SMOOTH_WORLD.tooltip.4=Стабілізує FPS лише на одиночній грі. +of.options.SMOOTH_WORLD.tooltip.5= + +of.options.FAST_RENDER=Швидкий рендер +of.options.FAST_RENDER.tooltip.1=Швидки рендер +of.options.FAST_RENDER.tooltip.2= Вимк - стандартний рендер (базово) +of.options.FAST_RENDER.tooltip.3= Увімк - оптимізований рендер (швидший) +of.options.FAST_RENDER.tooltip.4=Використовує оптимізований алгоритм рендерингу +of.options.FAST_RENDER.tooltip.5=зменшує навантаження на процессор і збільшить FPS. + +of.options.FAST_MATH=Швидка математика +of.options.FAST_MATH.tooltip.1=Швидка математика +of.options.FAST_MATH.tooltip.2= Вимк - стандартна математика(базово) +of.options.FAST_MATH.tooltip.3= Увімк - швидша математика +of.options.FAST_MATH.tooltip.4=Використовує оптимізовані функції sin() і cos(), що може краще +of.options.FAST_MATH.tooltip.5=утилізовувати кеш, і збільшити FPS. + +of.options.CHUNK_UPDATES=Оновлення чанків +of.options.CHUNK_UPDATES.tooltip.1=Оновлення чанків +of.options.CHUNK_UPDATES.tooltip.2= 1 - Повільніше завантаження світу, більший FPS (базово) +of.options.CHUNK_UPDATES.tooltip.3= 3 - Швидше оновлення чанків, нижчий FPS +of.options.CHUNK_UPDATES.tooltip.4= 5 - Найшвидше оновлення чанків, найнижчий FPS +of.options.CHUNK_UPDATES.tooltip.5=Кількість оновленн чанку за один кадр, +of.options.CHUNK_UPDATES.tooltip.6=найбільші значення можуть зменшити FPS. + +of.options.CHUNK_UPDATES_DYNAMIC=Динамічні оновлення +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=Динамічні оновлення чанків +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= Вимк - (базово) стандартне оновлення чанків за кадр +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= Увімк - більше оновленнь коли гравець стоїть +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=Динамічні оновлення змушують виконувати більше оновлень чанків +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=коли гравець стоїть, світ провантажується швидше. + +of.options.LAZY_CHUNK_LOADING=Ліниве завантаження чанків +of.options.LAZY_CHUNK_LOADING.tooltip.1=Ліниве завантаження чанків +of.options.LAZY_CHUNK_LOADING.tooltip.2= Вимк - базове серверне завантаження чанків +of.options.LAZY_CHUNK_LOADING.tooltip.3= Увімк - ліниве завантаження серверних чанків (плавніше) +of.options.LAZY_CHUNK_LOADING.tooltip.4=Згладжує завантаження чанків вбудований сервером +of.options.LAZY_CHUNK_LOADING.tooltip.5=розподіляючи чанки на декілька тіків. +of.options.LAZY_CHUNK_LOADING.tooltip.6=Вимкніть це якщо деякі частини світу не завантажуються правильно. +of.options.LAZY_CHUNK_LOADING.tooltip.7=Ефективно тільки для локальних світів і одноядрених процессорів. + +# Animations + +of.options.animation.allOn=Всі Увімк +of.options.animation.allOff=Всі Вимк +of.options.animation.dynamic=Динамічні + +of.options.ANIMATED_WATER=Анімація води +of.options.ANIMATED_LAVA=Анімація лави +of.options.ANIMATED_FIRE=Анімація вогню +of.options.ANIMATED_PORTAL=Анімація порталу +of.options.ANIMATED_REDSTONE=Анімація редстоуну +of.options.ANIMATED_EXPLOSION=Анімація вибуху +of.options.ANIMATED_FLAME=Анімація полум'я +of.options.ANIMATED_SMOKE=Анімація диму +of.options.VOID_PARTICLES=Частинки безодні +of.options.WATER_PARTICLES=Частинки води +of.options.RAIN_SPLASH=Краплі дощу +of.options.PORTAL_PARTICLES=Чатинки порталу +of.options.POTION_PARTICLES=Частинки зілль +of.options.DRIPPING_WATER_LAVA=Капаюча лава/вода +of.options.ANIMATED_TERRAIN=Анімація місцевості +of.options.ANIMATED_TEXTURES=Анімація текстур +of.options.FIREWORK_PARTICLES=Частинки феєрверку + +# Other + +of.options.LAGOMETER=Лагометр +of.options.LAGOMETER.tooltip.1=Показує лагометр на екрані дебагу (F3). +of.options.LAGOMETER.tooltip.2=* Оранджевий - зберігання мусору в пам'яті +of.options.LAGOMETER.tooltip.3=* Блакитний - Тік +of.options.LAGOMETER.tooltip.4=* Синій - Заплановані дії +of.options.LAGOMETER.tooltip.5=* Фіолетовий - Завантаження чанків +of.options.LAGOMETER.tooltip.6=* Червоний - Оновлення чанків +of.options.LAGOMETER.tooltip.7=* Жовтий - Перевірка видимості +of.options.LAGOMETER.tooltip.8=* Зелений - Рендеринг місцевості + +of.options.PROFILER=Профіль дебагу +of.options.PROFILER.tooltip.1=Профіль дебагу +of.options.PROFILER.tooltip.2= Увімк - профіль дебагу увімкнуто, повільніше +of.options.PROFILER.tooltip.3= Вимк - профіль дебагу вимкнуто, швидше +of.options.PROFILER.tooltip.4=Профіль дебагу збирає інформацію і показує її на +of.options.PROFILER.tooltip.5=екрані дебагу (F3) + +of.options.WEATHER=Погода +of.options.WEATHER.tooltip.1=Погода +of.options.WEATHER.tooltip.2= Увімк - погода активна, повільніше +of.options.WEATHER.tooltip.3= Вимк - погода не активна, швидше +of.options.WEATHER.tooltip.4=Погода контролює дощі, грози і сніг. +of.options.WEATHER.tooltip.5=Працює лиш в ОДИНОЧНИХ СВІТАХ. + +of.options.time.dayOnly=Тільки день +of.options.time.nightOnly=Тільки ніч + +of.options.TIME=Час +of.options.TIME.tooltip.1=Час +of.options.TIME.tooltip.2= Базово - стандартний день +of.options.TIME.tooltip.3= Тільки день - тільки день +of.options.TIME.tooltip.4= Тільки ніч - тільки ніч +of.options.TIME.tooltip.5=Встановлення часу працює лиш для гравців у +of.options.TIME.tooltip.6=КРЕАТИВІ та у локальних світах. + +options.fullscreen.tooltip.1=Повноекранний режим +options.fullscreen.tooltip.2= Увімк - використовувати повноекранний режим +options.fullscreen.tooltip.3= Вимк - не використовувати повноекранний режим +options.fullscreen.tooltip.4=В залежності від відеокарти, може +options.fullscreen.tooltip.5=покращити продуктивність. + +of.options.FULLSCREEN_MODE=Роздільна здатність +of.options.FULLSCREEN_MODE.tooltip.1=Роздільна здатність +of.options.FULLSCREEN_MODE.tooltip.2= Базово - використовувати роздільну здатність монітора, повільніше +of.options.FULLSCREEN_MODE.tooltip.3= WxH - використовувати власну роздільну якість, може бути швидше +of.options.FULLSCREEN_MODE.tooltip.4=Обрана якість буде використовуватись в повноекраному режимі (F11). +of.options.FULLSCREEN_MODE.tooltip.5=Найнижча якість завжди швидша. + +of.options.SHOW_FPS=Показувати FPS +of.options.SHOW_FPS.tooltip.1=Показує компактно FPS і інформацію рендеру +of.options.SHOW_FPS.tooltip.2= C: - чанків рендериться +of.options.SHOW_FPS.tooltip.3= E: - сутностей в рендері + блоковано сутностей +of.options.SHOW_FPS.tooltip.4= U: - чанків оновлюється +of.options.SHOW_FPS.tooltip.5=Компактне FPS показується лиш коли +of.options.SHOW_FPS.tooltip.6=екран дебагу вимкнено. + +of.options.save.default=Базове (2с) +of.options.save.20s=20с +of.options.save.3min=3хв +of.options.save.30min=30хв + +of.options.AUTOSAVE_TICKS=Автозбереження +of.options.AUTOSAVE_TICKS.tooltip.1=Інтервал автозбереження +of.options.AUTOSAVE_TICKS.tooltip.2=Базовий інтервал збереження (2с) НЕ РЕКОМЕНДОВАНО. +of.options.AUTOSAVE_TICKS.tooltip.3=Автозбереження спричиняє "фріз смерті". + +of.options.SCREENSHOT_SIZE=Розмір знімку екрану +of.options.SCREENSHOT_SIZE.tooltip.1=Розмір скріншоту +of.options.SCREENSHOT_SIZE.tooltip.2= Базовий - стандартний розмір скріншоту +of.options.SCREENSHOT_SIZE.tooltip.3= 2x-4x - власний розмір скріншоту +of.options.SCREENSHOT_SIZE.tooltip.4=Зйомка більшого скріншоту потребує більше пам'яті +of.options.SCREENSHOT_SIZE.tooltip.5=Не сумісне з швидким рендером і згладжуванням +of.options.SCREENSHOT_SIZE.tooltip.6=Потребує підтримку фреймбуфера GPU. diff --git a/src/minecraft/assets/minecraft/optifine/lang/zh_CN.lang b/src/minecraft/assets/minecraft/optifine/lang/zh_CN.lang new file mode 100644 index 0000000..06d6c4b --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/zh_CN.lang @@ -0,0 +1,597 @@ +# Contributors of Chinese localization # +# Degh_Cilon_ From WAWCraft 2016-2-18 ---- 2016-1-25 +# xuyu_staryG(gxy17886) From InfinityStudio 2016-1-18 ---- 2016-1-19 +# hukk From MCBBS 2013-7-13 ---- 2016-11-9 +# shengjing1 From MCBBS 2012-11-20 ---- 2013-4-20 +# Language File Begins Here... + +# General +of.general.ambiguous=模糊 +of.general.custom=自定义 +of.general.from=来自 +of.general.id=Id +of.general.restart=重启游戏 +of.general.smart=智能 + +# Keys +of.key.zoom=缩放 + +# Message +of.message.aa.shaders1=抗锯齿与光影不兼容。 +of.message.aa.shaders2=请关闭光影来启用这个选项。 + +of.message.af.shaders1=各向异性过滤与光影不兼容。 +of.message.af.shaders2=请关闭光影来启用这个选项。 + +of.message.fr.shaders1=快速渲染与光影不兼容。 +of.message.fr.shaders2=请关闭光影来启用这个选项。 + +of.message.an.shaders1=3D立体与光影不兼容。 +of.message.an.shaders2=请关闭光影来启用这个选项。 + +of.message.shaders.aa1=光影与抗锯齿不兼容。 +of.message.shaders.aa2=请把 品质 -> 抗锯齿 选项设置为 关 并重启您的游戏。 + +of.message.shaders.af1=光影与各向异性过滤不兼容。 +of.message.shaders.af2=请把 品质 -> 各向异性过滤 选项设置为 关。 + +of.message.shaders.fr1=光影与快速渲染不兼容。 +of.message.shaders.fr2=请把 性能 -> 快速渲染 选项设置为 关。 + +of.message.shaders.an1=光影与3D立体不兼容。 +of.message.shaders.an2=请把 其他 -> 3D立体 选项设置为 关。 + +of.message.newVersion=新的§eOptiFine§f版本现已可用:§e%s§f +of.message.java64Bit=您可以安装§e64位Java§f来提升性能。 +of.message.openglError=§eOpenGL错误§f:%s(%s) + +of.message.shaders.loading=载入光影:%s + +of.message.other.reset=确认重置所有视频设置为默认值吗? + +of.message.loadingVisibleChunks=正在加载可见区块 + +# Video settings + +options.graphics.tooltip.1=图像品质 +options.graphics.tooltip.2= 流畅 - 低品质,较快 +options.graphics.tooltip.3= 高品质 - 高品质,较慢 +options.graphics.tooltip.4=改变云、树叶、水、 +options.graphics.tooltip.5=阴影和草地的外观。 + +of.options.renderDistance.tiny=最近 +of.options.renderDistance.short=近 +of.options.renderDistance.normal=中等 +of.options.renderDistance.far=远 +of.options.renderDistance.extreme=极限 + +options.renderDistance.tooltip.1=能见度 +options.renderDistance.tooltip.2= 2 最近 - 32m(最快) +options.renderDistance.tooltip.3= 4 近 - 64m(较快) +options.renderDistance.tooltip.4= 8 中等 - 128m +options.renderDistance.tooltip.5= 16 远 - 256m(较慢) +options.renderDistance.tooltip.6= 32 极限 - 512m(最慢!) +options.renderDistance.tooltip.7=极限能见度非常消耗资源! +options.renderDistance.tooltip.8=超过 16 的能见度值只在本地世界有效。 + +options.ao.tooltip.1=平滑光照 +options.ao.tooltip.2= 关 - 没有平滑光照(较快) +options.ao.tooltip.3= 最小 - 简单流畅的平滑光照(较慢) +options.ao.tooltip.4= 最大 - 复杂柔和的平滑光照(最慢) + +options.framerateLimit.tooltip.1=最大帧率 +options.framerateLimit.tooltip.2= 垂直同步 - 受限于显示器帧率(60,30,20) +options.framerateLimit.tooltip.3= 5-255 - 可变 +options.framerateLimit.tooltip.4= 无限制 - 无限制(最快) +options.framerateLimit.tooltip.5=帧率上限将降低FPS +options.framerateLimit.tooltip.6=即使其未达上限值。 +of.options.framerateLimit.vsync=垂直同步 + +of.options.AO_LEVEL=平滑光照 +of.options.AO_LEVEL.tooltip.1=平滑光照 +of.options.AO_LEVEL.tooltip.2= 关 - 没有阴影 +of.options.AO_LEVEL.tooltip.3= 50%% - 明亮的阴影 +of.options.AO_LEVEL.tooltip.4= 100%% - 阴暗的阴影 + +options.viewBobbing.tooltip.1=更真实的运动。 +options.viewBobbing.tooltip.2=当使用多级纹理贴图时,关闭它以获得最佳效果。 + +options.guiScale.tooltip.1=界面尺寸 +options.guiScale.tooltip.2= 自动 - 最大尺寸 +options.guiScale.tooltip.3= 小,中,大 - 1x到3x +options.guiScale.tooltip.4= 4x到10x - 在4K分辨率下可用 +options.guiScale.tooltip.5=奇数值(1x,3x,5x之类)与Unicode不兼容。 +options.guiScale.tooltip.6=一个较小的界面或许会更快。 + +options.vbo.tooltip.1=启用缓冲区顶点对象 +options.vbo.tooltip.2=使用一种替选的渲染模式,通常 +options.vbo.tooltip.3=可以比默认渲染快(5-10%%)。 + +options.gamma.tooltip.1=增加较暗物体的亮度 +options.gamma.tooltip.2= 标准 - 标准亮度 +options.gamma.tooltip.3= 1-99%% - 可变亮度 +options.gamma.tooltip.4= 明亮 - 最大亮度 +options.gamma.tooltip.5=此选项不会改变 +options.gamma.tooltip.6=完全黑色的物体的亮度。 + +options.anaglyph.tooltip.1=3D立体 +options.anaglyph.tooltip.2=通过为每只眼睛分色 +options.anaglyph.tooltip.3=来启用3D立体效果。 +options.anaglyph.tooltip.4=需要使用红蓝眼镜正常观看. + +options.blockAlternatives.tooltip.1=替选方块 +options.blockAlternatives.tooltip.2=为一些方块使用备选的方块模型。 +options.blockAlternatives.tooltip.3=取决于所选的资源包。 + +of.options.ALTERNATE_BLOCKS=替选方块 +of.options.ALTERNATE_BLOCKS.tooltip.1=替选方块 +of.options.ALTERNATE_BLOCKS.tooltip.2=为一些方块使用备选的方块模型。 +of.options.ALTERNATE_BLOCKS.tooltip.3=取决于所选的资源包。 + +of.options.FOG_FANCY=迷雾 +of.options.FOG_FANCY.tooltip.1=迷雾类型 +of.options.FOG_FANCY.tooltip.2= 流畅 - 较流畅的迷雾 +of.options.FOG_FANCY.tooltip.3= 高品质 - 较慢的迷雾,质量更佳 +of.options.FOG_FANCY.tooltip.4= 关 - 无迷雾,最快 +of.options.FOG_FANCY.tooltip.5=细致的迷雾只在 +of.options.FOG_FANCY.tooltip.6=显卡支持下可用。 + +of.options.FOG_START=迷雾起始位置 +of.options.FOG_START.tooltip.1=迷雾起始位置 +of.options.FOG_START.tooltip.2= 0.2 - 迷雾起始于玩家周围 +of.options.FOG_START.tooltip.3= 0.8 - 迷雾在离玩家较远的地方起始 +of.options.FOG_START.tooltip.4=此选项通常不会影响性能。 + +of.options.CHUNK_LOADING=区块加载 +of.options.CHUNK_LOADING.tooltip.1=区块加载 +of.options.CHUNK_LOADING.tooltip.2= 默认 - 当加载区块时FPS不稳定 +of.options.CHUNK_LOADING.tooltip.3= 平滑 - 稳定FPS +of.options.CHUNK_LOADING.tooltip.4= 多核心 - 稳定FPS,3倍的世界加载速度 +of.options.CHUNK_LOADING.tooltip.5=平滑和多核心可消除由区块 +of.options.CHUNK_LOADING.tooltip.6=加载引起的延迟和卡顿。 +of.options.CHUNK_LOADING.tooltip.7=多核心可以令世界加载速度提升3倍 +of.options.CHUNK_LOADING.tooltip.8=并通过使用多个CPU核心来提升FPS。 +of.options.chunkLoading.smooth=平滑 +of.options.chunkLoading.multiCore=多核心 + +of.options.shaders=光影... +of.options.shadersTitle=光影 + +of.options.shaders.packNone=关闭 +of.options.shaders.packDefault=(内置) + +of.options.shaders.ANTIALIASING=抗锯齿 +of.options.shaders.NORMAL_MAP=法线贴图 +of.options.shaders.SPECULAR_MAP=高光贴图 +of.options.shaders.RENDER_RES_MUL=渲染精细度 +of.options.shaders.SHADOW_RES_MUL=阴影精细度 +of.options.shaders.HAND_DEPTH_MUL=手部景深 +of.options.shaders.CLOUD_SHADOW=云朵阴影 +of.options.shaders.OLD_HAND_LIGHT=经典手持光源 +of.options.shaders.OLD_LIGHTING=经典光效 +of.options.shaders.SHADER_PACK=光影包文件夹 + +of.options.shaders.shadersFolder=光影包文件夹 +of.options.shaders.shaderOptions=光影设置... + +of.options.shaderOptionsTitle=光影设置 + +of.options.quality=品质... +of.options.qualityTitle=品质设置 + +of.options.details=细节... +of.options.detailsTitle=细节设置 + +of.options.performance=性能... +of.options.performanceTitle=性能设置 + +of.options.animations=动画... +of.options.animationsTitle=动画设置 + +of.options.other=其他... +of.options.otherTitle=其他设置 + +of.options.other.reset=重置视频设置... + +of.shaders.profile=配置文件 + +# Quality + +of.options.mipmap.bilinear=双线性 +of.options.mipmap.linear=线性 +of.options.mipmap.nearest=最近 +of.options.mipmap.trilinear=三线性 + +options.mipmapLevels.tooltip.1=通过平滑材质细节,使远处的 +options.mipmapLevels.tooltip.2=物体获得更好的视觉效果。 +options.mipmapLevels.tooltip.3= 关 - 无平滑 +options.mipmapLevels.tooltip.4= 1 - 最小平滑 +options.mipmapLevels.tooltip.5= 4 - 最大平滑 +options.mipmapLevels.tooltip.6=此选项通常不影响性能。 + +of.options.MIPMAP_TYPE=多级渐进纹理过滤类型 +of.options.MIPMAP_TYPE.tooltip.1=通过平滑材质细节,使远处的 +of.options.MIPMAP_TYPE.tooltip.2=物体获得更好的视觉效果。 +of.options.MIPMAP_TYPE.tooltip.3= 最近 - 粗糙平滑(最快) +of.options.MIPMAP_TYPE.tooltip.4= 线性 - 正常平滑 +of.options.MIPMAP_TYPE.tooltip.5= 双线性 - 精细平滑 +of.options.MIPMAP_TYPE.tooltip.6= 三线性 - 最佳平滑(最慢) + + +of.options.AA_LEVEL=抗锯齿 +of.options.AA_LEVEL.tooltip.1=抗锯齿 +of.options.AA_LEVEL.tooltip.2= 关 - (默认)无抗锯齿(较快) +of.options.AA_LEVEL.tooltip.3= 2-16 - 对线和边缘使用抗锯齿(较慢) +of.options.AA_LEVEL.tooltip.4=抗锯齿将平滑锯齿线 +of.options.AA_LEVEL.tooltip.5=和锐利的色彩过渡。 +of.options.AA_LEVEL.tooltip.6=启用它可能会大幅降低FPS。 +of.options.AA_LEVEL.tooltip.7=并非所有级别都被显卡支持。 +of.options.AA_LEVEL.tooltip.8=重启后生效! + +of.options.AF_LEVEL=各向异性过滤 +of.options.AF_LEVEL.tooltip.1=各向异性过滤 +of.options.AF_LEVEL.tooltip.2= 关 - (默认)标准材质细节(较快) +of.options.AF_LEVEL.tooltip.3= 2-16 - 为多级纹理过滤后的材质提供精细细节(较慢) +of.options.AF_LEVEL.tooltip.4=各向异性过滤还原了经多级 +of.options.AF_LEVEL.tooltip.5=纹理过滤后的材质细节。 +of.options.AF_LEVEL.tooltip.6=启用它可能会大幅降低FPS。 + +of.options.CLEAR_WATER=清澈水体 +of.options.CLEAR_WATER.tooltip.1=清澈水体 +of.options.CLEAR_WATER.tooltip.2= 开 - 清澈、透明水体 +of.options.CLEAR_WATER.tooltip.3= 关 - 默认水体 + +of.options.RANDOM_MOBS=随机生物 +of.options.RANDOM_MOBS.tooltip.1=随机生物材质 +of.options.RANDOM_MOBS.tooltip.2= 关 - 关闭随机生物材质,较快 +of.options.RANDOM_MOBS.tooltip.3= 开 - 随机生物材质,较慢 +of.options.RANDOM_MOBS.tooltip.4=游戏中的生物材质使用随机的贴图。 +of.options.RANDOM_MOBS.tooltip.5=它需要资源包内有多个生物贴图。 + +of.options.BETTER_GRASS=更好的草地 +of.options.BETTER_GRASS.tooltip.1=更好的草地 +of.options.BETTER_GRASS.tooltip.2= 关 - 默认草地材质,较快 +of.options.BETTER_GRASS.tooltip.3= 流畅 - 草方块侧面全部使用草地材质,较慢 +of.options.BETTER_GRASS.tooltip.4= 高品质 - 草方块侧面材质动态化,最慢 + +of.options.BETTER_SNOW=更好的雪地 +of.options.BETTER_SNOW.tooltip.1=更好的雪地 +of.options.BETTER_SNOW.tooltip.2= 关 - 默认的雪地,较快 +of.options.BETTER_SNOW.tooltip.3= 开 - 更好的雪地,较慢 +of.options.BETTER_SNOW.tooltip.4=在“透明方块”(如栅栏、高草) +of.options.BETTER_SNOW.tooltip.5=与雪接壤时,在其下显示雪。 + +of.options.CUSTOM_FONTS=自定义字体 +of.options.CUSTOM_FONTS.tooltip.1=自定义字体 +of.options.CUSTOM_FONTS.tooltip.2= 开 - 使用自定义字体(默认),较慢 +of.options.CUSTOM_FONTS.tooltip.3= 关 - 使用默认字体,较快 +of.options.CUSTOM_FONTS.tooltip.4=自定义字体一般由 +of.options.CUSTOM_FONTS.tooltip.5=当前的资源包提供。 + +of.options.CUSTOM_COLORS=自定义色彩 +of.options.CUSTOM_COLORS.tooltip.1=自定义色彩 +of.options.CUSTOM_COLORS.tooltip.2= 开 - 使用自定义色彩(默认),较慢 +of.options.CUSTOM_COLORS.tooltip.3= 关 - 使用默认色彩,较快 +of.options.CUSTOM_COLORS.tooltip.4=自定义色彩一般由 +of.options.CUSTOM_COLORS.tooltip.5=当前的资源包提供。 + +of.options.SWAMP_COLORS=沼泽颜色 +of.options.SWAMP_COLORS.tooltip.1=沼泽颜色 +of.options.SWAMP_COLORS.tooltip.2= 开 - 使用沼泽颜色(默认),较慢 +of.options.SWAMP_COLORS.tooltip.3= 关 - 不使用沼泽颜色,较快 +of.options.SWAMP_COLORS.tooltip.4=沼泽的颜色会影响草、树叶、藤蔓和水。 + +of.options.SMOOTH_BIOMES=平滑生物群系 +of.options.SMOOTH_BIOMES.tooltip.1=平滑生物群系 +of.options.SMOOTH_BIOMES.tooltip.2= 开 - 平滑生物群系的边界(默认),较慢 +of.options.SMOOTH_BIOMES.tooltip.3= 关 - 不平滑生物群系的边界,较快 +of.options.SMOOTH_BIOMES.tooltip.4=生物群系的边界平滑取样于 +of.options.SMOOTH_BIOMES.tooltip.5=附近所有方块颜色的平均值。 +of.options.SMOOTH_BIOMES.tooltip.6=草、树叶、藤蔓和水会被受到影响。 + +of.options.CONNECTED_TEXTURES=连接纹理 +of.options.CONNECTED_TEXTURES.tooltip.1=连接纹理 +of.options.CONNECTED_TEXTURES.tooltip.2= 关 - 关闭连接纹理(默认) +of.options.CONNECTED_TEXTURES.tooltip.3= 流畅 - 快速处理纹理连接 +of.options.CONNECTED_TEXTURES.tooltip.4= 高品质 - 精细处理纹理连接 +of.options.CONNECTED_TEXTURES.tooltip.5=连接纹理为玻璃、沙石和书架增加了连接材质, +of.options.CONNECTED_TEXTURES.tooltip.6=当它们互相放在一起时会将材质连接为一体。 +of.options.CONNECTED_TEXTURES.tooltip.7=连接材质一般由 +of.options.CONNECTED_TEXTURES.tooltip.8=当前的资源包提供。 + +of.options.NATURAL_TEXTURES=天然纹理 +of.options.NATURAL_TEXTURES.tooltip.1=天然纹理 +of.options.NATURAL_TEXTURES.tooltip.2= 关 - 关闭天然纹理(默认) +of.options.NATURAL_TEXTURES.tooltip.3= 开 - 使用天然纹理 +of.options.NATURAL_TEXTURES.tooltip.4=天然纹理会移除由同一类型的方块重复 +of.options.NATURAL_TEXTURES.tooltip.5=而创建的栅格状图案。它通过旋转和翻转 +of.options.NATURAL_TEXTURES.tooltip.6=方块的基础材质来创建材质变体。 +of.options.NATURAL_TEXTURES.tooltip.7=天然纹理的配置和材质一般由 +of.options.NATURAL_TEXTURES.tooltip.8=当前的资源包提供。 + +of.options.CUSTOM_SKY=自定义天空 +of.options.CUSTOM_SKY.tooltip.1=自定义天空 +of.options.CUSTOM_SKY.tooltip.2= 开 - 自定义天空材质(默认),较慢 +of.options.CUSTOM_SKY.tooltip.3= 关闭 - 默认天空材质,较快 +of.options.CUSTOM_SKY.tooltip.4=自定义天空的材质一般 +of.options.CUSTOM_SKY.tooltip.5=由当前的资源包提供。 + +of.options.CUSTOM_ITEMS=自定义物品 +of.options.CUSTOM_ITEMS.tooltip.1=自定义物品 +of.options.CUSTOM_ITEMS.tooltip.2= 开 - 自定义物品材质(默认),较慢 +of.options.CUSTOM_ITEMS.tooltip.3= 关 - 默认物品材质,较快 +of.options.CUSTOM_ITEMS.tooltip.4=自定义物品的材质一般 +of.options.CUSTOM_ITEMS.tooltip.5=由当前的资源包提供。 + +of.options.CUSTOM_ENTITY_MODELS=自定义实体模型 +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=自定义实体模型 +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= 开 - 自定义实体模型(默认),较慢 +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= 关 - 默的实体模型,较快 +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=自定义实体模型的材质一般 +of.options.CUSTOM_ENTITY_MODELS.tooltip.5=由当前的资源包提供。 + +# Details + +of.options.CLOUDS=云 +of.options.CLOUDS.tooltip.1=云 +of.options.CLOUDS.tooltip.2= 默认 - 以“图形品质”的设定为准 +of.options.CLOUDS.tooltip.3= 流畅 - 低品质,较快 +of.options.CLOUDS.tooltip.4= 高品质 - 高品质,较慢 +of.options.CLOUDS.tooltip.5= 关闭 - 没有云,最快 +of.options.CLOUDS.tooltip.6=低品质云使用2D渲染, +of.options.CLOUDS.tooltip.7=高品质云使用3D渲染。 + +of.options.CLOUD_HEIGHT=云高度 +of.options.CLOUD_HEIGHT.tooltip.1=云高度 +of.options.CLOUD_HEIGHT.tooltip.2= 关闭 - 默认高度 +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - 超过世界限定高度 + +of.options.TREES=树 +of.options.TREES.tooltip.1=树 +of.options.TREES.tooltip.2= 默认 - 以“图形品质”的设定为准 +of.options.TREES.tooltip.3= 流畅 - 低品质,最快 +of.options.TREES.tooltip.4= 智能 - 较高品质,较快 +of.options.TREES.tooltip.5= 高品质 - 高品质,较慢 +of.options.TREES.tooltip.6=低品质的树叶不透明, +of.options.TREES.tooltip.7=高品质的树叶透明镂空。 + +of.options.RAIN=雨雪 +of.options.RAIN.tooltip.1=雨雪 +of.options.RAIN.tooltip.2= 默认 - 以“图形品质”的设定为准 +of.options.RAIN.tooltip.3= 流畅 - 少量的雨/雪,较快 +of.options.RAIN.tooltip.4= 高品质 - 大量的雨/雪,较慢 +of.options.RAIN.tooltip.5= 关闭 - 没有雨/雪,最快 +of.options.RAIN.tooltip.6=当雨雪选项为 关闭 时, +of.options.RAIN.tooltip.7=雨声仍然存在。 + +of.options.SKY=天空 +of.options.SKY.tooltip.1=天空 +of.options.SKY.tooltip.2= 开 - 天空可见,较慢 +of.options.SKY.tooltip.3= 关 - 天空不可见,较快 +of.options.SKY.tooltip.4=当天空关闭时,月亮和太阳依然可见。 + +of.options.STARS=星星 +of.options.STARS.tooltip.1=星星 +of.options.STARS.tooltip.2= 开 - 星星可见,较慢 +of.options.STARS.tooltip.3= 关 - 星星不可见,较快 + +of.options.SUN_MOON=日月 +of.options.SUN_MOON.tooltip.1=日月 +of.options.SUN_MOON.tooltip.2= 开 - 太阳和月亮可见(默认) +of.options.SUN_MOON.tooltip.3= 关 - 太阳和月亮不可见(较快) + +of.options.SHOW_CAPES=显示披风 +of.options.SHOW_CAPES.tooltip.1=显示披风 +of.options.SHOW_CAPES.tooltip.2= 开 - 显示玩家披风(默认) +of.options.SHOW_CAPES.tooltip.3= 关 - 不显示玩家披风 + +of.options.TRANSLUCENT_BLOCKS=半透明方块 +of.options.TRANSLUCENT_BLOCKS.tooltip.1=半透明方块 +of.options.TRANSLUCENT_BLOCKS.tooltip.2= 高品质 - 准确的混合颜色(默认) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= 流畅 - 快速的混合颜色(较快) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=用于控制不同颜色的半透明 +of.options.TRANSLUCENT_BLOCKS.tooltip.5=方块(染色玻璃、水、冰)间 +of.options.TRANSLUCENT_BLOCKS.tooltip.6=有空气存在时,彼此颜色的混合。 + +of.options.HELD_ITEM_TOOLTIPS=持有物信息显示 +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=持有物信息显示 +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= 开 - 显示持有物信息(默认) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= 关 - 隐藏持有物信息 + +of.options.ADVANCED_TOOLTIPS=高级信息提示 +of.options.ADVANCED_TOOLTIPS.tooltip.1=高级信息提示 +of.options.ADVANCED_TOOLTIPS.tooltip.2= 开 - 显示高级信息提示 +of.options.ADVANCED_TOOLTIPS.tooltip.3= 关 - 隐藏高级信息提示(默认) +of.options.ADVANCED_TOOLTIPS.tooltip.4=高级信息提示显示物品 +of.options.ADVANCED_TOOLTIPS.tooltip.5=(ID、耐久度)和光影设置 +of.options.ADVANCED_TOOLTIPS.tooltip.6=(ID、源、默认值)的拓展信息。 + +of.options.DROPPED_ITEMS=掉落物品 +of.options.DROPPED_ITEMS.tooltip.1=掉落物品 +of.options.DROPPED_ITEMS.tooltip.2= 默认 - 以“图形品质”的设定为准 +of.options.DROPPED_ITEMS.tooltip.3= 流畅 - 2D掉落物品,较快 +of.options.DROPPED_ITEMS.tooltip.4= 高品质 - 3D掉落物品,较慢 + +options.entityShadows.tooltip.1=实体阴影 +options.entityShadows.tooltip.2= 开 - 显示实体阴影 +options.entityShadows.tooltip.3= 关 - 隐藏实体阴影 + +of.options.VIGNETTE=晕影 +of.options.VIGNETTE.tooltip.1=屏幕四角轻微变暗的视觉效果 +of.options.VIGNETTE.tooltip.2= 默认 - 以“图形品质”的设定为准(默认) +of.options.VIGNETTE.tooltip.3= 流畅 - 晕影关闭(较快) +of.options.VIGNETTE.tooltip.4= 高品质 - 晕影开启(较慢) +of.options.VIGNETTE.tooltip.5=晕影可能对FPS有显著的影响, +of.options.VIGNETTE.tooltip.6=尤其是全屏游戏的时候。 +of.options.VIGNETTE.tooltip.7=晕影的效果非常细微, +of.options.VIGNETTE.tooltip.8=并且可以被安全地禁用。 + +of.options.DYNAMIC_FOV=动态视场 +of.options.DYNAMIC_FOV.tooltip.1=动态视场 +of.options.DYNAMIC_FOV.tooltip.2= 开 - 启用动态视场(默认) +of.options.DYNAMIC_FOV.tooltip.3= 关 - 禁用动态视场 +of.options.DYNAMIC_FOV.tooltip.4=当正在飞行、疾跑或 +of.options.DYNAMIC_FOV.tooltip.5=拉弓时改变视场。 + +of.options.DYNAMIC_LIGHTS=动态光源 +of.options.DYNAMIC_LIGHTS.tooltip.1=动态光源 +of.options.DYNAMIC_LIGHTS.tooltip.2= 关 - 无动态光源(默认) +of.options.DYNAMIC_LIGHTS.tooltip.3= 流畅 - 较快的动态光源(每500ms更新一次) +of.options.DYNAMIC_LIGHTS.tooltip.4= 高品质 - 高品质的动态光源(实时更新) +of.options.DYNAMIC_LIGHTS.tooltip.5=允许发光的物品(火把、萤石等) +of.options.DYNAMIC_LIGHTS.tooltip.6=当被玩家左右手持握、装备或 +of.options.DYNAMIC_LIGHTS.tooltip.7=成为掉落物时照亮周围的一切。 + +# Performance + +of.options.SMOOTH_FPS=平滑FPS +of.options.SMOOTH_FPS.tooltip.1=通过清除显卡缓冲区来稳定FPS +of.options.SMOOTH_FPS.tooltip.2= 关 - 不稳定,FPS可能波动 +of.options.SMOOTH_FPS.tooltip.3= 开 - FPS稳定 +of.options.SMOOTH_FPS.tooltip.4=此选项依赖于显卡驱动, +of.options.SMOOTH_FPS.tooltip.5=通常效果并不明显。 + +of.options.SMOOTH_WORLD=平滑世界 +of.options.SMOOTH_WORLD.tooltip.1=移除内部服务造成的数据延时。 +of.options.SMOOTH_WORLD.tooltip.2= 关 - 不稳定,FPS可能波动 +of.options.SMOOTH_WORLD.tooltip.3= 开 - FPS稳定 +of.options.SMOOTH_WORLD.tooltip.4=分担内部服务器负载来稳定FPS。 +of.options.SMOOTH_WORLD.tooltip.5=只在本地世界(单人游戏)有效。 + +of.options.FAST_RENDER=快速渲染 +of.options.FAST_RENDER.tooltip.1=快速渲染 +of.options.FAST_RENDER.tooltip.2= 关 - 标准渲染(默认) +of.options.FAST_RENDER.tooltip.3= 开 - 优化渲染(较快) +of.options.FAST_RENDER.tooltip.4=采用优化渲染算法从而降低GPU的负载 +of.options.FAST_RENDER.tooltip.5=并且可能大幅提升FPS。 + +of.options.FAST_MATH=快速运算 +of.options.FAST_MATH.tooltip.1=快速运算 +of.options.FAST_MATH.tooltip.2= 关 - 标准的运算(默认) +of.options.FAST_MATH.tooltip.3= 开 - 更快的运算 +of.options.FAST_MATH.tooltip.4=采用优化的sin()和cos()函数可以 +of.options.FAST_MATH.tooltip.5=更好地利用CPU缓存并且提升FPS。 + +of.options.CHUNK_UPDATES=区块更新 +of.options.CHUNK_UPDATES.tooltip.1=区块更新 +of.options.CHUNK_UPDATES.tooltip.2= 1 - 世界载入速度较慢,FPS较高(默认) +of.options.CHUNK_UPDATES.tooltip.3= 3 - 世界载入速度较快,FPS较低 +of.options.CHUNK_UPDATES.tooltip.4= 5 - 世界载入速度最快,FPS最低 +of.options.CHUNK_UPDATES.tooltip.5=渲染每帧时更新的区块数, +of.options.CHUNK_UPDATES.tooltip.6=更高的值将会导致帧数不稳定。 + +of.options.CHUNK_UPDATES_DYNAMIC=动态更新 +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=动态区块更新 +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= 关 - (默认)每帧标准区块更新 +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= 开 - 当玩家站立不动时更多的区块更新 +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=当玩家站立不动时,强迫更多的 +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=区块更新,使得世界加载更快。 + +of.options.LAZY_CHUNK_LOADING=缓慢区块加载 +of.options.LAZY_CHUNK_LOADING.tooltip.1=缓慢区块加载 +of.options.LAZY_CHUNK_LOADING.tooltip.2= 关 - 默认的服务器区块载入 +of.options.LAZY_CHUNK_LOADING.tooltip.3= 开 - 缓慢的服务器区块载入(更平滑) +of.options.LAZY_CHUNK_LOADING.tooltip.4=将区块分布在多个“游戏刻”进行加载 +of.options.LAZY_CHUNK_LOADING.tooltip.5=从而平滑服务器整体区块加载。 +of.options.LAZY_CHUNK_LOADING.tooltip.6=如果部分世界不能正确地载入,请把它设置为关。 +of.options.LAZY_CHUNK_LOADING.tooltip.7=仅适用于本地世界和单核CPU的电脑。 + +# Animations + +of.options.animation.allOn=全部开启 +of.options.animation.allOff=全部关闭 +of.options.animation.dynamic=动态 + +of.options.ANIMATED_WATER=水面动画 +of.options.ANIMATED_LAVA=岩浆动画 +of.options.ANIMATED_FIRE=火焰动画 +of.options.ANIMATED_PORTAL=传送门动画 +of.options.ANIMATED_REDSTONE=红石动画 +of.options.ANIMATED_EXPLOSION=爆炸动画 +of.options.ANIMATED_FLAME=燃烧动画 +of.options.ANIMATED_SMOKE=烟雾动画 +of.options.VOID_PARTICLES=虚空粒子 +of.options.WATER_PARTICLES=水面粒子 +of.options.RAIN_SPLASH=雨滴飞溅 +of.options.PORTAL_PARTICLES=传送门粒子 +of.options.POTION_PARTICLES=药水粒子 +of.options.DRIPPING_WATER_LAVA=流动水/岩浆 +of.options.ANIMATED_TERRAIN=地形动画 +of.options.ANIMATED_TEXTURES=材质动画 +of.options.FIREWORK_PARTICLES=烟花粒子 + +# Other + +of.options.LAGOMETER=快速调试信息 +of.options.LAGOMETER.tooltip.1=在调试界面(F3)显示快速调试信息。 +of.options.LAGOMETER.tooltip.2=* 橙 - 内存垃圾回收 +of.options.LAGOMETER.tooltip.3=* 青 - 游戏刻 +of.options.LAGOMETER.tooltip.4=* 蓝 - 预定可执行 +of.options.LAGOMETER.tooltip.5=* 紫 - 区块加载 +of.options.LAGOMETER.tooltip.6=* 红 - 区块更新 +of.options.LAGOMETER.tooltip.7=* 黄 - 能见度检查 +of.options.LAGOMETER.tooltip.8=* 绿 - 渲染地形 + +of.options.PROFILER=调试分析器 +of.options.PROFILER.tooltip.1=调试分析器 +of.options.PROFILER.tooltip.2= 开 - 调试分析器启用,较慢 +of.options.PROFILER.tooltip.3= 关 - 调试分析器禁用,较快 +of.options.PROFILER.tooltip.4=在调试界面开启状态(F3)时 +of.options.PROFILER.tooltip.5=调试分析器收集并且显示调试信息。 + +of.options.WEATHER=天气 +of.options.WEATHER.tooltip.1=天气 +of.options.WEATHER.tooltip.2= 开 - 开启天气,较慢 +of.options.WEATHER.tooltip.3= 关 - 关闭天气,较快 +of.options.WEATHER.tooltip.4=天气选项影响雨,雪和雷电。 +of.options.WEATHER.tooltip.5=天气选项仅在本地游戏中生效。 + +of.options.time.dayOnly=只有白天 +of.options.time.nightOnly=只有夜晚 + +of.options.TIME=时间 +of.options.TIME.tooltip.1=时间 +of.options.TIME.tooltip.2= 默认 - 正常的日夜交替 +of.options.TIME.tooltip.3= 只有白天 - 只有白天 +of.options.TIME.tooltip.4= 只有夜晚 - 只有夜晚 +of.options.TIME.tooltip.5=时间设置只在创造模式下 +of.options.TIME.tooltip.6=且为本地游戏时有效。 + +options.fullscreen.tooltip.1=全屏 +options.fullscreen.tooltip.2= 开 - 使用全屏模式 +options.fullscreen.tooltip.3= 关 - 使用窗口模式 +options.fullscreen.tooltip.4=全屏模式可能比窗口模式更快 +options.fullscreen.tooltip.5=或者更慢,取决于显卡。 + +of.options.FULLSCREEN_MODE=全屏模式 +of.options.FULLSCREEN_MODE.tooltip.1=全屏模式 +of.options.FULLSCREEN_MODE.tooltip.2= 默认 - 使用桌面分辨率,较慢 +of.options.FULLSCREEN_MODE.tooltip.3= 自定义 - 使用自定义屏幕分辨率,可能会较快 +of.options.FULLSCREEN_MODE.tooltip.4=这个选项只有在全屏模式下生效(F11)。 +of.options.FULLSCREEN_MODE.tooltip.5=较低的分辨率通常会更快。 + +of.options.SHOW_FPS=显示FPS +of.options.SHOW_FPS.tooltip.1=显示迷你的FPS和渲染信息 +of.options.SHOW_FPS.tooltip.2= C:- 区块渲染器 +of.options.SHOW_FPS.tooltip.3= E:- 一般实体 + 方块实体 +of.options.SHOW_FPS.tooltip.4= U:- 区块更新 +of.options.SHOW_FPS.tooltip.5=只有调试屏幕隐藏时 +of.options.SHOW_FPS.tooltip.6=迷你FPS信息才会显示。 + +of.options.save.default=默认(2秒) +of.options.save.20s=20秒 +of.options.save.3min=3分钟 +of.options.save.30min=30分钟 + +of.options.AUTOSAVE_TICKS=自动保存 +of.options.AUTOSAVE_TICKS.tooltip.1=自动保存间隔 +of.options.AUTOSAVE_TICKS.tooltip.2=不推荐使用默认自动保存间隔(2秒)。 +of.options.AUTOSAVE_TICKS.tooltip.3=自动保存导致了著名的“死亡卡顿”。 + +of.options.SCREENSHOT_SIZE=截图尺寸 +of.options.SCREENSHOT_SIZE.tooltip.1=截图尺寸 +of.options.SCREENSHOT_SIZE.tooltip.2= 默认 - 默认的截图尺寸 +of.options.SCREENSHOT_SIZE.tooltip.3= 2x-4x - 自定义截图尺寸 +of.options.SCREENSHOT_SIZE.tooltip.4=抓取更大的截图可能需要更多的内存。 +of.options.SCREENSHOT_SIZE.tooltip.5=与快速渲染和抗锯齿不兼容。 +of.options.SCREENSHOT_SIZE.tooltip.6=需要显卡帧缓冲区支持。 diff --git a/src/minecraft/assets/minecraft/optifine/lang/zh_TW.lang b/src/minecraft/assets/minecraft/optifine/lang/zh_TW.lang new file mode 100644 index 0000000..3167447 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/lang/zh_TW.lang @@ -0,0 +1,597 @@ +# Contributors of Traditional Chinese localization # +# Degh_Cilon_ From WAWCraft 2016-02-18 ---- 2016-01-25 +# Shujinko_kun From MCHK 2016-02-25 ---- 2016-03-27 +# NatsuArashi 2016-03-03 +##-------------- zh_TW --------------- + +# General +of.general.ambiguous=不明確 +of.general.custom=自定義 +of.general.from=來自 +of.general.id=Id +of.general.restart=重新啟動 +of.general.smart=智能 + +# Keys +of.key.zoom=縮放 + +# Message +of.message.aa.shaders1=抗鋸齒與光影不兼容. +of.message.aa.shaders2=請關閉光影來啟用這個選項. + +of.message.af.shaders1=各向異性過濾與光影不兼容. +of.message.af.shaders2=請關閉光影來啟用這個選項. + +of.message.fr.shaders1=快速渲染與光影不兼容. +of.message.fr.shaders2=請關閉光影來啟用這個選項. + +of.message.an.shaders1=3D立體與光影不兼容. +of.message.an.shaders2=請關閉光影來啟用這個選項. + +of.message.shaders.aa1=光影與抗鋸齒不兼容. +of.message.shaders.aa2=請把 品質 -> 抗鋸齒 選項設定為 關閉 並且重啟你的遊戲. + +of.message.shaders.af1=光影與各向異性過濾不兼容. +of.message.shaders.af2=請把 品質 -> 各向異性過濾 選項設置為 關閉. + +of.message.shaders.fr1=光影與快速渲染不兼容. +of.message.shaders.fr2=請把 性能 -> 快速渲染 選項設定為 關閉. + +of.message.shaders.an1=光影與3D立體不兼容. +of.message.shaders.an2=請把 其他 -> 3D立體 選項設定為 關閉. + +of.message.newVersion=新的§eOptiFine§f版本可以使用了: §e%s§f +of.message.java64Bit=你可以安裝§e64位元Java§f來提升性能. +of.message.openglError=§eOpenGL錯誤§f: %s (%s) + +of.message.shaders.loading=載入光影: %s + +of.message.other.reset=確認重置所有描繪設定為預設值嗎? + +of.message.loadingVisibleChunks=正在加載可見區塊 + +# Video settings + +options.graphics.tooltip.1=圖像畫質 +options.graphics.tooltip.2= 性能優先 - 低畫質, 較快 +options.graphics.tooltip.3= 畫質優先 - 高畫質, 較慢 +options.graphics.tooltip.4=改變雲、樹葉、水、 +options.graphics.tooltip.5=陰影和草地的外觀. + +of.options.renderDistance.tiny=最近 +of.options.renderDistance.short=近 +of.options.renderDistance.normal=中等 +of.options.renderDistance.far=遠 +of.options.renderDistance.extreme=最遠 + +options.renderDistance.tooltip.1=視野 +options.renderDistance.tooltip.2= 2 最近 - 32m (最快) +options.renderDistance.tooltip.3= 4 近 - 64m (較快) +options.renderDistance.tooltip.4= 8 中等 - 128m +options.renderDistance.tooltip.5= 16 遠 - 256m (較慢) +options.renderDistance.tooltip.6= 32 最遠 - 512m (最慢!) +options.renderDistance.tooltip.7=最遠的視野設定非常消耗資源! +options.renderDistance.tooltip.8= 16 以上的視野值只在本地世界有效. + +options.ao.tooltip.1=柔和化照明效果 +options.ao.tooltip.2= 關閉 - 沒有柔和化照明 (較快) +options.ao.tooltip.3= 最小值 - 簡單柔和化照明 (較慢) +options.ao.tooltip.4= 最大值 - 複雜柔和化照明 (最慢) + +options.framerateLimit.tooltip.1=最大FPS +options.framerateLimit.tooltip.2= 垂直同步 - 受限於顯示器FPS(60, 30, 20) +options.framerateLimit.tooltip.3= 5-255 - 可變 +options.framerateLimit.tooltip.4= 無限制 - 無限制(最快) +options.framerateLimit.tooltip.5=FPS上限會影響性能 +options.framerateLimit.tooltip.6=即使其未達上限值. +of.options.framerateLimit.vsync=垂直同步 + +of.options.AO_LEVEL=柔和化照明等級 +of.options.AO_LEVEL.tooltip.1=柔和化照明等級 +of.options.AO_LEVEL.tooltip.2= 關閉 - 沒有陰影 +of.options.AO_LEVEL.tooltip.3= 50%% - 較亮的陰影 +of.options.AO_LEVEL.tooltip.4= 100%% - 較暗的陰影 + +options.viewBobbing.tooltip.1=更真實的運動. +options.viewBobbing.tooltip.2=當使用多精度材質時,關閉它以取得更佳效果. + +options.guiScale.tooltip.1=介面大小 +options.guiScale.tooltip.2= 自動 - 最大大小 +options.guiScale.tooltip.3= 小, 中, 大 - 1x到3x +options.guiScale.tooltip.4= 4x到10x - 在4K分辯率下可用 +options.guiScale.tooltip.5=奇數值的放大倍數(1x, 3x, 5x等)與Unicode不相容. +options.guiScale.tooltip.6=較小的介面或許會更快. + +options.vbo.tooltip.1=啟用緩衝區頂點對象 +options.vbo.tooltip.2=使用一種替選的渲染模式通常 +options.vbo.tooltip.3=可以比默認渲染快(5-10%%). + +options.gamma.tooltip.1=增加較暗物體的亮度 +options.gamma.tooltip.2= 標準 - 標準亮度 +options.gamma.tooltip.3= 1-99%% - 可變亮度 +options.gamma.tooltip.4= 明亮 - 最大亮度 +options.gamma.tooltip.5=此選項不會改變 +options.gamma.tooltip.6=完全黑色的物體的亮度. + +options.anaglyph.tooltip.1=3D立體 +options.anaglyph.tooltip.2=通過為每隻眼睛分色 +options.anaglyph.tooltip.3=來啟用3D立體效果. +options.anaglyph.tooltip.4=需要使用紅藍眼鏡正常觀看. + +options.blockAlternatives.tooltip.1=替選方塊 +options.blockAlternatives.tooltip.2=為一些方塊使用備選的方塊模型. +options.blockAlternatives.tooltip.3=取決於所選的資源包. + +of.options.ALTERNATE_BLOCKS=替選方塊 +of.options.ALTERNATE_BLOCKS.tooltip.1=替選方塊 +of.options.ALTERNATE_BLOCKS.tooltip.2=為一些方塊使用備選的方塊模型. +of.options.ALTERNATE_BLOCKS.tooltip.3=取決於所選的資源包. + +of.options.FOG_FANCY=迷霧 +of.options.FOG_FANCY.tooltip.1=迷霧類型 +of.options.FOG_FANCY.tooltip.2= 性能優先 - 較流暢的迷霧 +of.options.FOG_FANCY.tooltip.3= 畫質優先 - 較慢的迷霧,質量更佳 +of.options.FOG_FANCY.tooltip.4= 關閉 - 無迷霧,最快 +of.options.FOG_FANCY.tooltip.5=畫質優先的迷霧只在 +of.options.FOG_FANCY.tooltip.6=顯卡支持下可用. + +of.options.FOG_START=迷霧起始位置 +of.options.FOG_START.tooltip.1=迷霧起始位置 +of.options.FOG_START.tooltip.2= 0.2 - 迷霧起始於玩家周圍 +of.options.FOG_START.tooltip.3= 0.8 - 迷霧在離玩家較遠的地方起始 +of.options.FOG_START.tooltip.4=此選項通常不會影響性能. + +of.options.CHUNK_LOADING=區塊載入 +of.options.CHUNK_LOADING.tooltip.1=區塊載入 +of.options.CHUNK_LOADING.tooltip.2= 預設 - 當載入區塊時FPS不穩定 +of.options.CHUNK_LOADING.tooltip.3= 柔和化 - 穩定FPS +of.options.CHUNK_LOADING.tooltip.4= 多核心 - 穩定FPS,3倍的世界載入速度 +of.options.CHUNK_LOADING.tooltip.5=柔和化和多核心可消除由區塊 +of.options.CHUNK_LOADING.tooltip.6=載入引起的延遲和卡頓. +of.options.CHUNK_LOADING.tooltip.7=多核心可以令世界載入速度提升3倍 +of.options.CHUNK_LOADING.tooltip.8=並通過使用多個CPU核心來提升FPS. +of.options.chunkLoading.smooth=柔和化 +of.options.chunkLoading.multiCore=多核心 + +of.options.shaders=光影... +of.options.shadersTitle=光影 + +of.options.shaders.packNone=關閉 +of.options.shaders.packDefault=(內置) + + +of.options.shaders.ANTIALIASING=抗鋸齒 +of.options.shaders.NORMAL_MAP=法線貼圖 +of.options.shaders.SPECULAR_MAP=高光貼圖 +of.options.shaders.RENDER_RES_MUL=渲染精細度 +of.options.shaders.SHADOW_RES_MUL=陰影精細度 +of.options.shaders.HAND_DEPTH_MUL=手部景深 +of.options.shaders.CLOUD_SHADOW=雲的陰影 +of.options.shaders.OLD_HAND_LIGHT=經典手持光源 +of.options.shaders.OLD_LIGHTING=經典光照 +of.options.shaders.SHADER_PACK=光影包文件夾 + +of.options.shaders.shadersFolder=光影資料夾 +of.options.shaders.shaderOptions=光影設定... + +of.options.shaderOptionsTitle=光影設定 + +of.options.quality=品質... +of.options.qualityTitle=品質設置 + +of.options.details=細節... +of.options.detailsTitle=細節設置 + +of.options.performance=性能... +of.options.performanceTitle=性能設置 + +of.options.animations=動畫... +of.options.animationsTitle=動畫設置 + +of.options.other=其他... +of.options.otherTitle=其他設置 + +of.options.other.reset=重設視頻設定... + +of.shaders.profile=配置文件 + +# Quality + +of.options.mipmap.bilinear=雙線性 +of.options.mipmap.linear=線性 +of.options.mipmap.nearest=最近 +of.options.mipmap.trilinear=三線性 + +options.mipmapLevels.tooltip.1=通過柔和化材質細節,使遠處的 +options.mipmapLevels.tooltip.2=物體看起來更好的視覺效果. +options.mipmapLevels.tooltip.3= 關閉 - 無柔和化 +options.mipmapLevels.tooltip.4= 1 - 最小柔和化 +options.mipmapLevels.tooltip.5= 4 - 最大柔和化 +options.mipmapLevels.tooltip.6=此選項通常不影響性能. + +of.options.MIPMAP_TYPE=多精度材質類型 +of.options.MIPMAP_TYPE.tooltip.1=通過柔和化材質細節,使遠處的 +of.options.MIPMAP_TYPE.tooltip.2=物體看起來更好的視覺效果. +of.options.MIPMAP_TYPE.tooltip.3= 最近 - 粗糙柔和化(最快) +of.options.MIPMAP_TYPE.tooltip.4= 線性 - 正常柔和化 +of.options.MIPMAP_TYPE.tooltip.5= 雙線性 - 精細 +of.options.MIPMAP_TYPE.tooltip.6= 三線性 - 最佳柔和化(最慢) + + +of.options.AA_LEVEL=抗鋸齒 +of.options.AA_LEVEL.tooltip.1=抗鋸齒 +of.options.AA_LEVEL.tooltip.2= 關閉 - (預設)無抗鋸齒(較快) +of.options.AA_LEVEL.tooltip.3= 2-16 - 對線和邊緣使用抗鋸齒(較慢) +of.options.AA_LEVEL.tooltip.4=反鋸齒將平滑鋸齒線 +of.options.AA_LEVEL.tooltip.5=和銳利的色彩過渡. +of.options.AA_LEVEL.tooltip.6=啟用它可能會大幅降低FPS. +of.options.AA_LEVEL.tooltip.7=並非所有級別都被顯卡支持. +of.options.AA_LEVEL.tooltip.8=重啟後生效! + +of.options.AF_LEVEL=各向異性過濾 +of.options.AF_LEVEL.tooltip.1=各向異性過濾 +of.options.AF_LEVEL.tooltip.2= 關閉 - (預設)標準材質細節(較快) +of.options.AF_LEVEL.tooltip.3= 2-16 - 為多級材質過濾後的材質提供精細細節(較慢) +of.options.AF_LEVEL.tooltip.4=各向異性過濾還原了經多級 +of.options.AF_LEVEL.tooltip.5=材質過濾後的材質細節. +of.options.AF_LEVEL.tooltip.6=啟用它可能會大幅降低FPS. + +of.options.CLEAR_WATER=清澈水體 +of.options.CLEAR_WATER.tooltip.1=清澈水體 +of.options.CLEAR_WATER.tooltip.2= 關閉 - 清澈、透明水體 +of.options.CLEAR_WATER.tooltip.3= 開啟 - 預設水體 + +of.options.RANDOM_MOBS=隨機生物 +of.options.RANDOM_MOBS.tooltip.1=隨機生物 +of.options.RANDOM_MOBS.tooltip.2= 關閉 - 關閉隨機生物,較快 +of.options.RANDOM_MOBS.tooltip.3= 開啟 - 隨機生物,較慢 +of.options.RANDOM_MOBS.tooltip.4=遊戲中的生物、怪物材質使用隨機的貼圖. +of.options.RANDOM_MOBS.tooltip.5=這需要資源包內有多個生物、怪物貼圖. + +of.options.BETTER_GRASS=更好的草地 +of.options.BETTER_GRASS.tooltip.1=更好的草地 +of.options.BETTER_GRASS.tooltip.2= 關閉 - 預設草地材質,較快 +of.options.BETTER_GRASS.tooltip.3= 性能優先 - 草方塊側面全部使用草地材質,較慢 +of.options.BETTER_GRASS.tooltip.4= 畫質優先 - 草方塊側面材質動態化,最慢 + +of.options.BETTER_SNOW=更好的雪地 +of.options.BETTER_SNOW.tooltip.1=更好的雪地 +of.options.BETTER_SNOW.tooltip.2= 關閉 - 預設的雪地,較快 +of.options.BETTER_SNOW.tooltip.3= 開啟 - 更好的雪地,較慢 +of.options.BETTER_SNOW.tooltip.4=在"透明方塊"(如柵欄,高草)與雪 +of.options.BETTER_SNOW.tooltip.5=接壤時在其下顯示雪. + +of.options.CUSTOM_FONTS=自定義字體 +of.options.CUSTOM_FONTS.tooltip.1=自定義字體 +of.options.CUSTOM_FONTS.tooltip.2= 開啟 - 使用自定義字體(預設),較慢 +of.options.CUSTOM_FONTS.tooltip.3= 關閉 - 使用預設字體,較快 +of.options.CUSTOM_FONTS.tooltip.4=自定義字體一般由 +of.options.CUSTOM_FONTS.tooltip.5=當前的資源包提供. + +of.options.CUSTOM_COLORS=自定義色彩 +of.options.CUSTOM_COLORS.tooltip.1=自定義色彩 +of.options.CUSTOM_COLORS.tooltip.2= 開啟 - 使用自定義色彩(預設),較慢 +of.options.CUSTOM_COLORS.tooltip.3= 關閉 - 使用預設色彩,較快 +of.options.CUSTOM_COLORS.tooltip.4=自定義色彩一般由 +of.options.CUSTOM_COLORS.tooltip.5=當前的資源包提供. + +of.options.SWAMP_COLORS=沼澤顏色 +of.options.SWAMP_COLORS.tooltip.1=沼澤顏色 +of.options.SWAMP_COLORS.tooltip.2= 開啟 - 使用沼澤顏色(預設),較慢 +of.options.SWAMP_COLORS.tooltip.3= 關閉 - 不使用沼澤顏色,較快 +of.options.SWAMP_COLORS.tooltip.4=沼澤的顏色會影響草,樹葉,籐蔓和水. + +of.options.SMOOTH_BIOMES=柔和化生物群落 +of.options.SMOOTH_BIOMES.tooltip.1=柔和化生物群落 +of.options.SMOOTH_BIOMES.tooltip.2= 開啟 - 柔和化生物群落的邊界(預設),較慢 +of.options.SMOOTH_BIOMES.tooltip.3= 關閉 - 不柔和化生物群落的邊界,較快 +of.options.SMOOTH_BIOMES.tooltip.4=柔和化生物群落的邊界平滑取樣於 +of.options.SMOOTH_BIOMES.tooltip.5=附近所有方塊顏色的平均值. +of.options.SMOOTH_BIOMES.tooltip.6=草、樹葉、籐蔓和水將會受到影響. + +of.options.CONNECTED_TEXTURES=連接紋理 +of.options.CONNECTED_TEXTURES.tooltip.1=連接紋理 +of.options.CONNECTED_TEXTURES.tooltip.2= 關閉 - 關閉連續材質(預設) +of.options.CONNECTED_TEXTURES.tooltip.3= 性能優先 - 快速處理連續材質 +of.options.CONNECTED_TEXTURES.tooltip.4= 畫質優先 - 精細處理連續材質 +of.options.CONNECTED_TEXTURES.tooltip.5=連接材質為玻璃、沙石和書架增加了連續材質, +of.options.CONNECTED_TEXTURES.tooltip.6=當它們互相放在一起時會將材質連接為一體. +of.options.CONNECTED_TEXTURES.tooltip.7=連續材質一般由 +of.options.CONNECTED_TEXTURES.tooltip.8=當前的資源包提供. + +of.options.NATURAL_TEXTURES=自然材質 +of.options.NATURAL_TEXTURES.tooltip.1=自然材質 +of.options.NATURAL_TEXTURES.tooltip.2= 開啟 - 關閉自然材質(預設) +of.options.NATURAL_TEXTURES.tooltip.3= 關閉 - 使用自然材質 +of.options.NATURAL_TEXTURES.tooltip.4=自然材質移除由同一類型的 +of.options.NATURAL_TEXTURES.tooltip.5=方塊重複創建的柵格狀圖案. +of.options.NATURAL_TEXTURES.tooltip.6=它通過旋轉和翻轉方塊的基礎材質來創建材質變體. +of.options.NATURAL_TEXTURES.tooltip.7=自然材質的配置和材質一般由 +of.options.NATURAL_TEXTURES.tooltip.8=當前的資源包提供. + +of.options.CUSTOM_SKY=自定義天空 +of.options.CUSTOM_SKY.tooltip.1=自定義天空 +of.options.CUSTOM_SKY.tooltip.2= 開啟 - 自定義天空材質(預設),較慢 +of.options.CUSTOM_SKY.tooltip.3= 關閉 - 默認天空材質,較快 +of.options.CUSTOM_SKY.tooltip.4=自定義天空材質一般由 +of.options.CUSTOM_SKY.tooltip.5=當前的資源包提供. + +of.options.CUSTOM_ITEMS=自定義物品 +of.options.CUSTOM_ITEMS.tooltip.1=自定義物品 +of.options.CUSTOM_ITEMS.tooltip.2= 關閉 - 自定義物品材質(預設),較慢 +of.options.CUSTOM_ITEMS.tooltip.3= 開啟 - 默認物品材質,較快 +of.options.CUSTOM_ITEMS.tooltip.4=自定義物品材質一般由 +of.options.CUSTOM_ITEMS.tooltip.5=當前的資源包提供. + +of.options.CUSTOM_ENTITY_MODELS=自定義實體模型 +of.options.CUSTOM_ENTITY_MODELS.tooltip.1=自定義實體模型 +of.options.CUSTOM_ENTITY_MODELS.tooltip.2= 關閉 - 自定義實體模型(預設),較慢 +of.options.CUSTOM_ENTITY_MODELS.tooltip.3= 開啟 - 默認實體模型,較快 +of.options.CUSTOM_ENTITY_MODELS.tooltip.4=自定義實體模型材質一般由 +of.options.CUSTOM_ENTITY_MODELS.tooltip.5=當前的資源包提供. + +# Details + +of.options.CLOUDS=雲塊 +of.options.CLOUDS.tooltip.1=雲塊 +of.options.CLOUDS.tooltip.2= 預設 - 以圖像畫質的設定為準 +of.options.CLOUDS.tooltip.3= 性能優先 - 低品質,較快 +of.options.CLOUDS.tooltip.4= 畫質優先 - 高品質,較慢 +of.options.CLOUDS.tooltip.5= 關閉 - 沒有雲, 最快 +of.options.CLOUDS.tooltip.6=性能優先的雲塊使用2D渲染. +of.options.CLOUDS.tooltip.7=畫質優先的雲塊使用3D渲染. + +of.options.CLOUD_HEIGHT=雲層高度 +of.options.CLOUD_HEIGHT.tooltip.1=雲層高度 +of.options.CLOUD_HEIGHT.tooltip.2= 關閉 - 預設高度 +of.options.CLOUD_HEIGHT.tooltip.3= 100%% - 超過世界限定高度 + +of.options.TREES=樹 +of.options.TREES.tooltip.1=樹 +of.options.TREES.tooltip.2= 預設 - 以圖像畫質設定為標準 +of.options.TREES.tooltip.3= 性能優先 - 低品質, 最快 +of.options.TREES.tooltip.4= 智能 - 較高品質, 較快 +of.options.TREES.tooltip.4= 畫質優先 - 高品質, 較慢 +of.options.TREES.tooltip.5=性能優先的樹葉不透明. +of.options.TREES.tooltip.6=畫質優先的樹葉透明. + +of.options.RAIN=雨 & 雪 +of.options.RAIN.tooltip.1=雨 & 雪 +of.options.RAIN.tooltip.2= 預設 - 以圖像畫質的設定為準 +of.options.RAIN.tooltip.3= 性能優先 - 少量的雨/雪,較快 +of.options.RAIN.tooltip.4= 畫質優先 - 大量的雨/雪,較慢 +of.options.RAIN.tooltip.5= 關閉 - 沒有雨/雪, 最快 +of.options.RAIN.tooltip.6=當雨雪選項為 關閉 時, +of.options.RAIN.tooltip.7=雨聲仍然存在. + +of.options.SKY=天空 +of.options.SKY.tooltip.1=天空 +of.options.SKY.tooltip.2= 開啟 - 天空可見,較慢 +of.options.SKY.tooltip.3= 關閉 - 天空不可見,較快 +of.options.SKY.tooltip.4=當天空關閉時,月亮和太陽依然可見. + +of.options.STARS=星星 +of.options.STARS.tooltip.1=星星 +of.options.STARS.tooltip.2= 開啟 - 星星可見,較慢 +of.options.STARS.tooltip.3= 關閉 - 星星不可見,較快 + +of.options.SUN_MOON=太陽 & 月亮 +of.options.SUN_MOON.tooltip.1=太陽 & 月亮 +of.options.SUN_MOON.tooltip.2= 開啟 - 太陽和月亮可見(預設) +of.options.SUN_MOON.tooltip.3= 關閉 - 太陽和月亮不可見(較快) + +of.options.SHOW_CAPES=顯示披風 +of.options.SHOW_CAPES.tooltip.1=顯示披風 +of.options.SHOW_CAPES.tooltip.2= 開啟 - 顯示玩家披風(默認) +of.options.SHOW_CAPES.tooltip.3= 關閉 - 不顯示玩家披風 + +of.options.TRANSLUCENT_BLOCKS=半透明方塊 +of.options.TRANSLUCENT_BLOCKS.tooltip.1=半透明方塊 +of.options.TRANSLUCENT_BLOCKS.tooltip.2= 畫質優先 - 準確的混合顏色(預設) +of.options.TRANSLUCENT_BLOCKS.tooltip.3= 性能優先 - 快速的混合顏色(較快) +of.options.TRANSLUCENT_BLOCKS.tooltip.4=控制有顏色的 +of.options.TRANSLUCENT_BLOCKS.tooltip.5=半透明方塊 (彩色玻璃,水,冰) +of.options.TRANSLUCENT_BLOCKS.tooltip.6=當它們互相放置在一起或半空之間. + +of.options.HELD_ITEM_TOOLTIPS=持有物信息顯示 +of.options.HELD_ITEM_TOOLTIPS.tooltip.1=持有物信息顯示 +of.options.HELD_ITEM_TOOLTIPS.tooltip.2= 開啟 - 顯示持有物信息(預設) +of.options.HELD_ITEM_TOOLTIPS.tooltip.3= 關閉 - 隱藏持有物信息 + +of.options.ADVANCED_TOOLTIPS=高級資訊提示 +of.options.ADVANCED_TOOLTIPS.tooltip.1=高級資訊提示 +of.options.ADVANCED_TOOLTIPS.tooltip.2= 開啟 - 顯示高級資訊提示 +of.options.ADVANCED_TOOLTIPS.tooltip.3= 關閉 - 隱藏高級資訊提示(預設) +of.options.ADVANCED_TOOLTIPS.tooltip.4=高級資訊提示顯示物品 +of.options.ADVANCED_TOOLTIPS.tooltip.5=(ID、耐久度)和光影設定 +of.options.ADVANCED_TOOLTIPS.tooltip.6=(ID、源、預設值)的拓展資訊. + +of.options.DROPPED_ITEMS=掉落物品 +of.options.DROPPED_ITEMS.tooltip.1=掉落物品 +of.options.DROPPED_ITEMS.tooltip.2= 預設 - 以圖像畫質的設定為準 +of.options.DROPPED_ITEMS.tooltip.3= 性能優先 - 2D掉落物品, 較快 +of.options.DROPPED_ITEMS.tooltip.4= 畫質優先 - 3D掉落物品, 較慢 + +options.entityShadows.tooltip.1=實體陰影 +options.entityShadows.tooltip.2= 開啟 - 顯示實體陰影 +options.entityShadows.tooltip.3= 關閉 - 隱藏實體陰影 + +of.options.VIGNETTE=暈影 +of.options.VIGNETTE.tooltip.1=螢幕四角輕微變暗的視覺效果 +of.options.VIGNETTE.tooltip.2= 預設 - 以圖像畫質的設定為準(預設) +of.options.VIGNETTE.tooltip.3= 性能優先 - 暈影關閉(較快) +of.options.VIGNETTE.tooltip.4= 畫質優先 - 暈影開啟(較慢) +of.options.VIGNETTE.tooltip.5=暈影可能對FPS有顯著的影響, +of.options.VIGNETTE.tooltip.6=尤其是全螢幕遊戲的時候. +of.options.VIGNETTE.tooltip.7=暈影的效果是非常細微的 +of.options.VIGNETTE.tooltip.8=並且是可以被安全地禁用. + +of.options.DYNAMIC_FOV=動態視場 +of.options.DYNAMIC_FOV.tooltip.1=動態視場 +of.options.DYNAMIC_FOV.tooltip.2= 開啟 - 啟用動態視場(預設) +of.options.DYNAMIC_FOV.tooltip.3= 關閉 - 禁用動態視場 +of.options.DYNAMIC_FOV.tooltip.4=當正在飛行、疾跑或 +of.options.DYNAMIC_FOV.tooltip.5=拉弓時改變視場. + +of.options.DYNAMIC_LIGHTS=動態光源 +of.options.DYNAMIC_LIGHTS.tooltip.1=動態光源 +of.options.DYNAMIC_LIGHTS.tooltip.2= 關閉 - 無動態光源(預設) +of.options.DYNAMIC_LIGHTS.tooltip.3= 性能優先 - 較快的動態光源(每500ms更新一次) +of.options.DYNAMIC_LIGHTS.tooltip.4= 畫質優先 - 高品質的動態光源(即時更新) +of.options.DYNAMIC_LIGHTS.tooltip.5=允許發光的物品(火把,螢石等) +of.options.DYNAMIC_LIGHTS.tooltip.6=當被玩家左右手持握、裝備或 +of.options.DYNAMIC_LIGHTS.tooltip.7=成爲掉落物時照亮周圍的一切. + +# Performance + +of.options.SMOOTH_FPS=柔和化FPS +of.options.SMOOTH_FPS.tooltip.1=通過清除圖形卡緩衝區來穩定FPS +of.options.SMOOTH_FPS.tooltip.2= 開啟 - 不穩定,FPS可能波動 +of.options.SMOOTH_FPS.tooltip.3= 關閉 - FPS穩定 +of.options.SMOOTH_FPS.tooltip.4=此選項依賴於顯卡驅動 +of.options.SMOOTH_FPS.tooltip.5=通常效果並不明顯. + +of.options.SMOOTH_WORLD=柔和化世界 +of.options.SMOOTH_WORLD.tooltip.1=移除內部服務造成的數據延時. +of.options.SMOOTH_WORLD.tooltip.2= 開啟 - 不穩定,FPS可能波動 +of.options.SMOOTH_WORLD.tooltip.3= 關閉 - FPS穩定 +of.options.SMOOTH_WORLD.tooltip.4=分擔內部服務器負載來穩定FPS. +of.options.SMOOTH_WORLD.tooltip.5=只在本地世界(單人遊戲)有效. + +of.options.FAST_RENDER=快速渲染 +of.options.FAST_RENDER.tooltip.1=快速渲染 +of.options.FAST_RENDER.tooltip.2= 開啟 - 標準渲染(預設) +of.options.FAST_RENDER.tooltip.3= 關閉 - 優化渲染(較快) +of.options.FAST_RENDER.tooltip.4=採用優化渲染算法從而降低GPU的負載 +of.options.FAST_RENDER.tooltip.5=並且可能大幅提升FPS. + +of.options.FAST_MATH=快速運算 +of.options.FAST_MATH.tooltip.1=快速運算 +of.options.FAST_MATH.tooltip.2= 開啟 - 標準的運算(預設) +of.options.FAST_MATH.tooltip.3= 關開啟閉 - 更快的運算 +of.options.FAST_MATH.tooltip.4=採用優化的sin()和cos()函數可以 +of.options.FAST_MATH.tooltip.5=更好的利用CPU緩存並且提升FPS. + +of.options.CHUNK_UPDATES=區塊更新 +of.options.CHUNK_UPDATES.tooltip.1=區塊更新 +of.options.CHUNK_UPDATES.tooltip.2= 1 - 世界載入速度較慢, FPS較高 (預設) +of.options.CHUNK_UPDATES.tooltip.3= 3 - 世界載入速度較快, FPS較低 +of.options.CHUNK_UPDATES.tooltip.4= 5 - 世界載入速度最快, FPS最低 +of.options.CHUNK_UPDATES.tooltip.5=渲染每幀時更新的區塊數, +of.options.CHUNK_UPDATES.tooltip.6=更高的值將會導致FPS不穩定. + +of.options.CHUNK_UPDATES_DYNAMIC=動態更新 +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.1=動態更新 +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.2= 關閉 - (預設)每幀標準區塊更新 +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.3= 開啟 - 當玩家站立不動時更多的區塊更新 +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.4=當玩家站立不動時會使更多的 +of.options.CHUNK_UPDATES_DYNAMIC.tooltip.5=區塊更新使得世界載入更快. + +of.options.LAZY_CHUNK_LOADING=平緩區塊更新 +of.options.LAZY_CHUNK_LOADING.tooltip.1=平緩區塊更新 +of.options.LAZY_CHUNK_LOADING.tooltip.2= 關閉 - 默認的服務器區塊載入 +of.options.LAZY_CHUNK_LOADING.tooltip.3= 開啟 - 平緩服務器區塊載入(更柔和) +of.options.LAZY_CHUNK_LOADING.tooltip.4=將區塊分佈在多個"遊戲刻"進行載入 +of.options.LAZY_CHUNK_LOADING.tooltip.5=從而柔和化服務器整體區塊載入. +of.options.LAZY_CHUNK_LOADING.tooltip.6=如果部分世界不能正確的載入,請把它設置為關閉. +of.options.LAZY_CHUNK_LOADING.tooltip.7=僅適用於本地世界和單核CPU的電腦. + +# Animations + +of.options.animation.allOn=全部開啟 +of.options.animation.allOff=全部關閉 +of.options.animation.dynamic=動態 + +of.options.ANIMATED_WATER=水面動畫 +of.options.ANIMATED_LAVA=岩漿動畫 +of.options.ANIMATED_FIRE=火焰動畫 +of.options.ANIMATED_PORTAL=傳送門動畫 +of.options.ANIMATED_REDSTONE=紅石動畫 +of.options.ANIMATED_EXPLOSION=爆炸動畫 +of.options.ANIMATED_FLAME=燃燒動畫 +of.options.ANIMATED_SMOKE=煙霧動畫 +of.options.VOID_PARTICLES=虛空粒子 +of.options.WATER_PARTICLES=水濺粒子 +of.options.RAIN_SPLASH=雨滴飛濺 +of.options.PORTAL_PARTICLES=傳送門粒子 +of.options.POTION_PARTICLES=藥水粒子 +of.options.DRIPPING_WATER_LAVA=流動水/岩漿 +of.options.ANIMATED_TERRAIN=地形動畫 +of.options.ANIMATED_TEXTURES=材質動畫 +of.options.FIREWORK_PARTICLES=煙花粒子 + +# Other + +of.options.LAGOMETER=快速調試信息 +of.options.LAGOMETER.tooltip.1=在調試界面顯示調試信息 (F3). +of.options.LAGOMETER.tooltip.2=* 橙 - 內存垃圾回收 +of.options.LAGOMETER.tooltip.3=* 青 - 勾 +of.options.LAGOMETER.tooltip.4=* 藍 - 預定的可執行文件 +of.options.LAGOMETER.tooltip.5=* 紫 - 區塊載入 +of.options.LAGOMETER.tooltip.6=* 紅 - 區塊更新 +of.options.LAGOMETER.tooltip.7=* 黃 - 能見度檢查 +of.options.LAGOMETER.tooltip.8=* 綠 - 渲染地形 + +of.options.PROFILER=調試分析器 +of.options.PROFILER.tooltip.1=調試分析器 +of.options.PROFILER.tooltip.2= 開啟 - 調試分析器啟用, 較慢 +of.options.PROFILER.tooltip.3= 關閉 - 調試分析器禁用, 較快 +of.options.PROFILER.tooltip.4=在調試界面開啟狀態(F3)時 +of.options.PROFILER.tooltip.5=調試分析器收集並且顯示調試信息. + +of.options.WEATHER=天氣 +of.options.WEATHER.tooltip.1=天氣 +of.options.WEATHER.tooltip.2= 開啟 - 開啟天氣, 較慢 +of.options.WEATHER.tooltip.3= 關閉 - 關閉天氣, 較快 +of.options.WEATHER.tooltip.4=天氣選項影響雨,雪和雷電. +of.options.WEATHER.tooltip.5=天氣選項僅在本地遊戲中生效. + +of.options.time.dayOnly=白天 +of.options.time.nightOnly=夜晚 + +of.options.TIME=時間 +of.options.TIME.tooltip.1=時間 +of.options.TIME.tooltip.2= 預設 - 正常的日夜交替 +of.options.TIME.tooltip.3= 白天 - 只有白天 +of.options.TIME.tooltip.4= 夜晚 - 只有夜晚 +of.options.TIME.tooltip.5=時間設置只在創造模式下 +of.options.TIME.tooltip.6=且為本地遊戲時有效. + +options.fullscreen.tooltip.1=全螢幕 +options.fullscreen.tooltip.2= 開啟 - 使用全螢幕模式 +options.fullscreen.tooltip.3= 關閉 - 使用視窗模式 +options.fullscreen.tooltip.4=全螢幕模式可能比視窗模式更快 +options.fullscreen.tooltip.5=或者更慢,這取決於顯卡. + +of.options.FULLSCREEN_MODE=全螢幕模式 +of.options.FULLSCREEN_MODE.tooltip.1=全螢幕模式 +of.options.FULLSCREEN_MODE.tooltip.2= 預設 - 使用桌面分辨率, 較慢 +of.options.FULLSCREEN_MODE.tooltip.3= 自定義 - 使用自定義螢幕分辨率, 可能會較快 +of.options.FULLSCREEN_MODE.tooltip.4=這個選項只有在全螢幕模式下生效(F11). +of.options.FULLSCREEN_MODE.tooltip.5=較低的分辨率通常會更快. + +of.options.SHOW_FPS=顯示FPS +of.options.SHOW_FPS.tooltip.1=顯示迷你的FPS和渲染信息 +of.options.SHOW_FPS.tooltip.2= C: - 區塊渲染器 +of.options.SHOW_FPS.tooltip.3= E: - 一般實體 + 方塊實體 +of.options.SHOW_FPS.tooltip.4= U: - 區塊更新 +of.options.SHOW_FPS.tooltip.5=只有調試螢幕隱藏時 +of.options.SHOW_FPS.tooltip.6=迷你FPS信息才會顯示. + +of.options.save.default=預設(2秒) +of.options.save.20s=20秒 +of.options.save.3min=3分鐘 +of.options.save.30min=30分鐘 + +of.options.AUTOSAVE_TICKS=自動保存 +of.options.AUTOSAVE_TICKS.tooltip.1=自動保存間隔 +of.options.AUTOSAVE_TICKS.tooltip.2=默認自動保存間隔(2秒) 不推薦. +of.options.AUTOSAVE_TICKS.tooltip.3=自動保存會導致卡頓. + +of.options.SCREENSHOT_SIZE=截圖尺寸 +of.options.SCREENSHOT_SIZE.tooltip.1=截圖尺寸 +of.options.SCREENSHOT_SIZE.tooltip.2= 預設 - 預設認的截圖尺寸 +of.options.SCREENSHOT_SIZE.tooltip.3= 2x-4x - 自定義截圖尺寸 +of.options.SCREENSHOT_SIZE.tooltip.4=抓取更大的截圖可能需要更多的記憶體. +of.options.SCREENSHOT_SIZE.tooltip.5=與快速渲染及抗鋸齒不相容. +of.options.SCREENSHOT_SIZE.tooltip.6=需要顯卡幀緩衝區支持. diff --git a/src/minecraft/assets/minecraft/optifine/natural.properties b/src/minecraft/assets/minecraft/optifine/natural.properties new file mode 100644 index 0000000..54bf805 --- /dev/null +++ b/src/minecraft/assets/minecraft/optifine/natural.properties @@ -0,0 +1,81 @@ +# Configuration for OptiFine's Natural Textures feature +# Location: /assets/minecraft/optifine/natural.properties +# +# Configuration format +# = +# +# Values +# 4 = Rotate x 90 (4 variants) +# 2 = Rotate x 180 (2 variants) +# F = Flip texture horizontally (2 variants) +# 4F = 4 + Flip (8 variants) +# 2F = 2 + Flip (4 variants) +# +# Example for obsidian texture which can rotate with 4 variants and flip +# obsidian = 4F +# + +# Grass +grass_side = F +grass_side_overlay = F +grass_side_snowed = F +mycelium_side = F +mycelium_top = 4F +# Snow +snow = 4F +# Dirt +coarse_dirt = 4F +dirt_podzol_top = 4F +farmland_wet = 2F +farmland_dry = 2F +# Stone +stone_granite = 2F +stone_diorite = 2F +stone_andesite = 2F +sandstone_top = 4 +sandstone_bottom = 4F +stone_slab_top = F +end_stone = 4 +# Gravel +gravel = 2 +clay = 4F +# Logs +log_oak = 2F +log_spruce = 2F +log_birch = F +log_jungle = 2F +log_acacia = 2F +log_big_oak = 2F +log_oak_top = 4F +log_spruce_top = 4F +log_birch_top = 4F +log_jungle_top = 4F +log_acacia_top = 4F +log_big_oak_top = 4F +# Leaves +leaves_oak = 2F +leaves_spruce = 2F +leaves_birch = 2F +leaves_jungle = 2 +leaves_big_oak = 2F +leaves_acacia = 2F +# Ores +gold_ore = 2F +iron_ore = 2F +coal_ore = 2F +diamond_ore = 2F +redstone_ore = 2F +lapis_ore = 2F +# Nether +netherrack = 4F +quartz_ore = 2 +soul_sand = 4F +glowstone = 4 +# Redstone +redstone_lamp_on = 4F +redstone_lamp_off = 4F +# Prismarine +prismarine_rough = 4F +# Misc +obsidian = 4F +cactus_side = 2F \ No newline at end of file diff --git a/src/minecraft/net/minecraft/block/Block.java b/src/minecraft/net/minecraft/block/Block.java new file mode 100644 index 0000000..e5f090c --- /dev/null +++ b/src/minecraft/net/minecraft/block/Block.java @@ -0,0 +1,1545 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ObjectIntIdentityMap; +import net.minecraft.util.RegistryNamespacedDefaultedByKey; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import net.minecraft.util.Vec3; +import net.minecraft.world.Explosion; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class Block +{ + /** ResourceLocation for the Air block */ + private static final ResourceLocation AIR_ID = new ResourceLocation("air"); + public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID); + public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap(); + private CreativeTabs displayOnCreativeTab; + public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F); + + /** the wood sound type */ + public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F); + + /** the gravel sound type */ + public static final Block.SoundType soundTypeGravel = new Block.SoundType("gravel", 1.0F, 1.0F); + public static final Block.SoundType soundTypeGrass = new Block.SoundType("grass", 1.0F, 1.0F); + public static final Block.SoundType soundTypePiston = new Block.SoundType("stone", 1.0F, 1.0F); + public static final Block.SoundType soundTypeMetal = new Block.SoundType("stone", 1.0F, 1.5F); + public static final Block.SoundType soundTypeGlass = new Block.SoundType("stone", 1.0F, 1.0F) + { + public String getBreakSound() + { + return "dig.glass"; + } + public String getPlaceSound() + { + return "step.stone"; + } + }; + public static final Block.SoundType soundTypeCloth = new Block.SoundType("cloth", 1.0F, 1.0F); + public static final Block.SoundType soundTypeSand = new Block.SoundType("sand", 1.0F, 1.0F); + public static final Block.SoundType soundTypeSnow = new Block.SoundType("snow", 1.0F, 1.0F); + public static final Block.SoundType soundTypeLadder = new Block.SoundType("ladder", 1.0F, 1.0F) + { + public String getBreakSound() + { + return "dig.wood"; + } + }; + public static final Block.SoundType soundTypeAnvil = new Block.SoundType("anvil", 0.3F, 1.0F) + { + public String getBreakSound() + { + return "dig.stone"; + } + public String getPlaceSound() + { + return "random.anvil_land"; + } + }; + public static final Block.SoundType SLIME_SOUND = new Block.SoundType("slime", 1.0F, 1.0F) + { + public String getBreakSound() + { + return "mob.slime.big"; + } + public String getPlaceSound() + { + return "mob.slime.big"; + } + public String getStepSound() + { + return "mob.slime.small"; + } + }; + protected boolean fullBlock; + + /** How much light is subtracted for going through this block */ + protected int lightOpacity; + protected boolean translucent; + + /** Amount of light emitted */ + protected int lightValue; + + /** + * Flag if block should use the brightest neighbor light value as its own + */ + protected boolean useNeighborBrightness; + + /** Indicates how many hits it takes to break a block. */ + protected float blockHardness; + + /** Indicates how much this block can resist explosions */ + protected float blockResistance; + protected boolean enableStats; + + /** + * Flags whether or not this block is of a type that needs random ticking. Ref-counted by ExtendedBlockStorage in + * order to broadly cull a chunk from the random chunk update list for efficiency's sake. + */ + protected boolean needsRandomTick; + + /** true if the Block contains a Tile Entity */ + protected boolean isBlockContainer; + protected double minX; + protected double minY; + protected double minZ; + protected double maxX; + protected double maxY; + protected double maxZ; + + /** Sound of stepping on the block */ + public Block.SoundType stepSound; + public float blockParticleGravity; + protected final Material blockMaterial; + protected final MapColor field_181083_K; + + /** + * Determines how much velocity is maintained while moving on top of this block + */ + public float slipperiness; + protected final BlockState blockState; + private IBlockState defaultBlockState; + private String unlocalizedName; + + public static int getIdFromBlock(Block blockIn) + { + return blockRegistry.getIDForObject(blockIn); + } + + /** + * Get a unique ID for the given BlockState, containing both BlockID and metadata + */ + public static int getStateId(IBlockState state) + { + Block block = state.getBlock(); + return getIdFromBlock(block) + (block.getMetaFromState(state) << 12); + } + + public static Block getBlockById(int id) + { + return (Block)blockRegistry.getObjectById(id); + } + + /** + * Get a BlockState by it's ID (see getStateId) + */ + public static IBlockState getStateById(int id) + { + int i = id & 4095; + int j = id >> 12 & 15; + return getBlockById(i).getStateFromMeta(j); + } + + public static Block getBlockFromItem(Item itemIn) + { + return itemIn instanceof ItemBlock ? ((ItemBlock)itemIn).getBlock() : null; + } + + public static Block getBlockFromName(String name) + { + ResourceLocation resourcelocation = new ResourceLocation(name); + + if (blockRegistry.containsKey(resourcelocation)) + { + return (Block)blockRegistry.getObject(resourcelocation); + } + else + { + try + { + return (Block)blockRegistry.getObjectById(Integer.parseInt(name)); + } + catch (NumberFormatException var3) + { + return null; + } + } + } + + public boolean isFullBlock() + { + return this.fullBlock; + } + + public int getLightOpacity() + { + return this.lightOpacity; + } + + /** + * Used in the renderer to apply ambient occlusion + */ + public boolean isTranslucent() + { + return this.translucent; + } + + public int getLightValue() + { + return this.lightValue; + } + + /** + * Should block use the brightest neighbor light value as its own + */ + public boolean getUseNeighborBrightness() + { + return this.useNeighborBrightness; + } + + /** + * Get a material of block + */ + public Material getMaterial() + { + return this.blockMaterial; + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return this.field_181083_K; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState(); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + if (state != null && !state.getPropertyNames().isEmpty()) + { + throw new IllegalArgumentException("Don\'t know how to convert " + state + " back into data..."); + } + else + { + return 0; + } + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + return state; + } + + public Block(Material p_i46399_1_, MapColor p_i46399_2_) + { + this.enableStats = true; + this.stepSound = soundTypeStone; + this.blockParticleGravity = 1.0F; + this.slipperiness = 0.6F; + this.blockMaterial = p_i46399_1_; + this.field_181083_K = p_i46399_2_; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + this.fullBlock = this.isOpaqueCube(); + this.lightOpacity = this.isOpaqueCube() ? 255 : 0; + this.translucent = !p_i46399_1_.blocksLight(); + this.blockState = this.createBlockState(); + this.setDefaultState(this.blockState.getBaseState()); + } + + protected Block(Material materialIn) + { + this(materialIn, materialIn.getMaterialMapColor()); + } + + /** + * Sets the footstep sound for the block. Returns the object for convenience in constructing. + */ + protected Block setStepSound(Block.SoundType sound) + { + this.stepSound = sound; + return this; + } + + /** + * Sets how much light is blocked going through this block. Returns the object for convenience in constructing. + */ + protected Block setLightOpacity(int opacity) + { + this.lightOpacity = opacity; + return this; + } + + /** + * Sets the light value that the block emits. Returns resulting block instance for constructing convenience. Args: + * level + */ + protected Block setLightLevel(float value) + { + this.lightValue = (int)(15.0F * value); + return this; + } + + /** + * Sets the the blocks resistance to explosions. Returns the object for convenience in constructing. + */ + protected Block setResistance(float resistance) + { + this.blockResistance = resistance * 3.0F; + return this; + } + + /** + * Indicate if a material is a normal solid opaque cube + */ + public boolean isBlockNormalCube() + { + return this.blockMaterial.blocksMovement() && this.isFullCube(); + } + + /** + * Used for nearly all game logic (non-rendering) purposes. Use Forge-provided isNormalCube(IBlockAccess, BlockPos) + * instead. + */ + public boolean isNormalCube() + { + return this.blockMaterial.isOpaque() && this.isFullCube() && !this.canProvidePower(); + } + + public boolean isVisuallyOpaque() + { + return this.blockMaterial.blocksMovement() && this.isFullCube(); + } + + public boolean isFullCube() + { + return true; + } + + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + { + return !this.blockMaterial.blocksMovement(); + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + /** + * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) + */ + public boolean isReplaceable(World worldIn, BlockPos pos) + { + return false; + } + + /** + * Sets how many hits it takes to break a block. + */ + protected Block setHardness(float hardness) + { + this.blockHardness = hardness; + + if (this.blockResistance < hardness * 5.0F) + { + this.blockResistance = hardness * 5.0F; + } + + return this; + } + + protected Block setBlockUnbreakable() + { + this.setHardness(-1.0F); + return this; + } + + public float getBlockHardness(World worldIn, BlockPos pos) + { + return this.blockHardness; + } + + /** + * Sets whether this block type will receive random update ticks + */ + protected Block setTickRandomly(boolean shouldTick) + { + this.needsRandomTick = shouldTick; + return this; + } + + /** + * Returns whether or not this block is of a type that needs random ticking. Called for ref-counting purposes by + * ExtendedBlockStorage in order to broadly cull a chunk from the random chunk update list for efficiency's sake. + */ + public boolean getTickRandomly() + { + return this.needsRandomTick; + } + + public boolean hasTileEntity() + { + return this.isBlockContainer; + } + + protected final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) + { + this.minX = (double)minX; + this.minY = (double)minY; + this.minZ = (double)minZ; + this.maxX = (double)maxX; + this.maxY = (double)maxY; + this.maxZ = (double)maxZ; + } + + public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos).getBlock(); + int i = worldIn.getCombinedLight(pos, block.getLightValue()); + + if (i == 0 && block instanceof BlockSlab) + { + pos = pos.down(); + block = worldIn.getBlockState(pos).getBlock(); + return worldIn.getCombinedLight(pos, block.getLightValue()); + } + else + { + return i; + } + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return side == EnumFacing.DOWN && this.minY > 0.0D ? true : (side == EnumFacing.UP && this.maxY < 1.0D ? true : (side == EnumFacing.NORTH && this.minZ > 0.0D ? true : (side == EnumFacing.SOUTH && this.maxZ < 1.0D ? true : (side == EnumFacing.WEST && this.minX > 0.0D ? true : (side == EnumFacing.EAST && this.maxX < 1.0D ? true : !worldIn.getBlockState(pos).getBlock().isOpaqueCube()))))); + } + + /** + * Whether this Block is solid on the given Side + */ + public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return worldIn.getBlockState(pos).getBlock().getMaterial().isSolid(); + } + + public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) + { + return new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ); + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + AxisAlignedBB axisalignedbb = this.getCollisionBoundingBox(worldIn, pos, state); + + if (axisalignedbb != null && mask.intersectsWith(axisalignedbb)) + { + list.add(axisalignedbb); + } + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return true; + } + + public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid) + { + return this.isCollidable(); + } + + /** + * Returns if this block is collidable (only used by Fire). Args: x, y, z + */ + public boolean isCollidable() + { + return true; + } + + /** + * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) + */ + public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random) + { + this.updateTick(worldIn, pos, state, random); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + } + + /** + * Called when a player destroys this Block + */ + public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) + { + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return 10; + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 1; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Item.getItemFromBlock(this); + } + + /** + * Get the hardness of this Block relative to the ability of the given player + */ + public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos) + { + float f = this.getBlockHardness(worldIn, pos); + return f < 0.0F ? 0.0F : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F : playerIn.getToolDigEfficiency(this) / f / 30.0F); + } + + /** + * Spawn this Block's drops into the World as EntityItems + */ + public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture) + { + this.dropBlockAsItemWithChance(worldIn, pos, state, 1.0F, forture); + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + if (!worldIn.isRemote) + { + int i = this.quantityDroppedWithBonus(fortune, worldIn.rand); + + for (int j = 0; j < i; ++j) + { + if (worldIn.rand.nextFloat() <= chance) + { + Item item = this.getItemDropped(state, worldIn.rand, fortune); + + if (item != null) + { + spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); + } + } + } + } + } + + /** + * Spawns the given ItemStack as an EntityItem into the World at the given position + */ + public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) + { + if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doTileDrops")) + { + float f = 0.5F; + double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack); + entityitem.setDefaultPickupDelay(); + worldIn.spawnEntityInWorld(entityitem); + } + } + + /** + * Spawns the given amount of experience into the World as XP orb entities + */ + protected void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount) + { + if (!worldIn.isRemote) + { + while (amount > 0) + { + int i = EntityXPOrb.getXPSplit(amount); + amount -= i; + worldIn.spawnEntityInWorld(new EntityXPOrb(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, i)); + } + } + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return 0; + } + + /** + * Returns how much this block can resist explosions from the passed in entity. + */ + public float getExplosionResistance(Entity exploder) + { + return this.blockResistance / 5.0F; + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. + */ + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + start = start.addVector((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); + end = end.addVector((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); + Vec3 vec3 = start.getIntermediateWithXValue(end, this.minX); + Vec3 vec31 = start.getIntermediateWithXValue(end, this.maxX); + Vec3 vec32 = start.getIntermediateWithYValue(end, this.minY); + Vec3 vec33 = start.getIntermediateWithYValue(end, this.maxY); + Vec3 vec34 = start.getIntermediateWithZValue(end, this.minZ); + Vec3 vec35 = start.getIntermediateWithZValue(end, this.maxZ); + + if (!this.isVecInsideYZBounds(vec3)) + { + vec3 = null; + } + + if (!this.isVecInsideYZBounds(vec31)) + { + vec31 = null; + } + + if (!this.isVecInsideXZBounds(vec32)) + { + vec32 = null; + } + + if (!this.isVecInsideXZBounds(vec33)) + { + vec33 = null; + } + + if (!this.isVecInsideXYBounds(vec34)) + { + vec34 = null; + } + + if (!this.isVecInsideXYBounds(vec35)) + { + vec35 = null; + } + + Vec3 vec36 = null; + + if (vec3 != null && (vec36 == null || start.squareDistanceTo(vec3) < start.squareDistanceTo(vec36))) + { + vec36 = vec3; + } + + if (vec31 != null && (vec36 == null || start.squareDistanceTo(vec31) < start.squareDistanceTo(vec36))) + { + vec36 = vec31; + } + + if (vec32 != null && (vec36 == null || start.squareDistanceTo(vec32) < start.squareDistanceTo(vec36))) + { + vec36 = vec32; + } + + if (vec33 != null && (vec36 == null || start.squareDistanceTo(vec33) < start.squareDistanceTo(vec36))) + { + vec36 = vec33; + } + + if (vec34 != null && (vec36 == null || start.squareDistanceTo(vec34) < start.squareDistanceTo(vec36))) + { + vec36 = vec34; + } + + if (vec35 != null && (vec36 == null || start.squareDistanceTo(vec35) < start.squareDistanceTo(vec36))) + { + vec36 = vec35; + } + + if (vec36 == null) + { + return null; + } + else + { + EnumFacing enumfacing = null; + + if (vec36 == vec3) + { + enumfacing = EnumFacing.WEST; + } + + if (vec36 == vec31) + { + enumfacing = EnumFacing.EAST; + } + + if (vec36 == vec32) + { + enumfacing = EnumFacing.DOWN; + } + + if (vec36 == vec33) + { + enumfacing = EnumFacing.UP; + } + + if (vec36 == vec34) + { + enumfacing = EnumFacing.NORTH; + } + + if (vec36 == vec35) + { + enumfacing = EnumFacing.SOUTH; + } + + return new MovingObjectPosition(vec36.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()), enumfacing, pos); + } + } + + /** + * Checks if a vector is within the Y and Z bounds of the block. + */ + private boolean isVecInsideYZBounds(Vec3 point) + { + return point == null ? false : point.yCoord >= this.minY && point.yCoord <= this.maxY && point.zCoord >= this.minZ && point.zCoord <= this.maxZ; + } + + /** + * Checks if a vector is within the X and Z bounds of the block. + */ + private boolean isVecInsideXZBounds(Vec3 point) + { + return point == null ? false : point.xCoord >= this.minX && point.xCoord <= this.maxX && point.zCoord >= this.minZ && point.zCoord <= this.maxZ; + } + + /** + * Checks if a vector is within the X and Y bounds of the block. + */ + private boolean isVecInsideXYBounds(Vec3 point) + { + return point == null ? false : point.xCoord >= this.minX && point.xCoord <= this.maxX && point.yCoord >= this.minY && point.yCoord <= this.maxY; + } + + /** + * Called when this Block is destroyed by an Explosion + */ + public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) + { + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.SOLID; + } + + public boolean canReplace(World worldIn, BlockPos pos, EnumFacing side, ItemStack stack) + { + return this.canPlaceBlockOnSide(worldIn, pos, side); + } + + /** + * Check whether this Block can be placed on the given side + */ + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { + return this.canPlaceBlockAt(worldIn, pos); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable(); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + return false; + } + + /** + * Triggered whenever an entity collides with this block (enters into the block) + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) + { + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getStateFromMeta(meta); + } + + public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) + { + } + + public Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion) + { + return motion; + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + } + + /** + * returns the block bounderies minX value + */ + public final double getBlockBoundsMinX() + { + return this.minX; + } + + /** + * returns the block bounderies maxX value + */ + public final double getBlockBoundsMaxX() + { + return this.maxX; + } + + /** + * returns the block bounderies minY value + */ + public final double getBlockBoundsMinY() + { + return this.minY; + } + + /** + * returns the block bounderies maxY value + */ + public final double getBlockBoundsMaxY() + { + return this.maxY; + } + + /** + * returns the block bounderies minZ value + */ + public final double getBlockBoundsMinZ() + { + return this.minZ; + } + + /** + * returns the block bounderies maxZ value + */ + public final double getBlockBoundsMaxZ() + { + return this.maxZ; + } + + public int getBlockColor() + { + return 16777215; + } + + public int getRenderColor(IBlockState state) + { + return 16777215; + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return 16777215; + } + + public final int colorMultiplier(IBlockAccess worldIn, BlockPos pos) + { + return this.colorMultiplier(worldIn, pos, 0); + } + + public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return 0; + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return false; + } + + /** + * Called When an Entity Collided with the Block + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + } + + public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return 0; + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + } + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { + player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]); + player.addExhaustion(0.025F); + + if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) + { + ItemStack itemstack = this.createStackedBlock(state); + + if (itemstack != null) + { + spawnAsEntity(worldIn, pos, itemstack); + } + } + else + { + int i = EnchantmentHelper.getFortuneModifier(player); + this.dropBlockAsItem(worldIn, pos, state, i); + } + } + + protected boolean canSilkHarvest() + { + return this.isFullCube() && !this.isBlockContainer; + } + + protected ItemStack createStackedBlock(IBlockState state) + { + int i = 0; + Item item = Item.getItemFromBlock(this); + + if (item != null && item.getHasSubtypes()) + { + i = this.getMetaFromState(state); + } + + return new ItemStack(item, 1, i); + } + + /** + * Get the quantity dropped based on the given fortune level + */ + public int quantityDroppedWithBonus(int fortune, Random random) + { + return this.quantityDropped(random); + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + } + + public boolean func_181623_g() + { + return !this.blockMaterial.isSolid() && !this.blockMaterial.isLiquid(); + } + + public Block setUnlocalizedName(String name) + { + this.unlocalizedName = name; + return this; + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal(this.getUnlocalizedName() + ".name"); + } + + /** + * Returns the unlocalized name of the block with "tile." appended to the front. + */ + public String getUnlocalizedName() + { + return "tile." + this.unlocalizedName; + } + + /** + * Called on both Client and Server when World#addBlockEvent is called + */ + public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) + { + return false; + } + + /** + * Return the state of blocks statistics flags - if the block is counted for mined and placed. + */ + public boolean getEnableStats() + { + return this.enableStats; + } + + protected Block disableStats() + { + this.enableStats = false; + return this; + } + + public int getMobilityFlag() + { + return this.blockMaterial.getMaterialMobility(); + } + + /** + * Returns the default ambient occlusion value based on block opacity + */ + public float getAmbientOcclusionLightValue() + { + return this.isBlockNormalCube() ? 0.2F : 1.0F; + } + + /** + * Block's chance to react to a living entity falling on it. + */ + public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) + { + entityIn.fall(fallDistance, 1.0F); + } + + /** + * Called when an Entity lands on this Block. This method *must* update motionY because the entity will not do that + * on its own + */ + public void onLanded(World worldIn, Entity entityIn) + { + entityIn.motionY = 0.0D; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Item.getItemFromBlock(this); + } + + public int getDamageValue(World worldIn, BlockPos pos) + { + return this.damageDropped(worldIn.getBlockState(pos)); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + list.add(new ItemStack(itemIn, 1, 0)); + } + + /** + * Returns the CreativeTab to display the given block on. + */ + public CreativeTabs getCreativeTabToDisplayOn() + { + return this.displayOnCreativeTab; + } + + public Block setCreativeTab(CreativeTabs tab) + { + this.displayOnCreativeTab = tab; + return this; + } + + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + } + + /** + * Called similar to random ticks, but only when it is raining. + */ + public void fillWithRain(World worldIn, BlockPos pos) + { + } + + /** + * Returns true only if block is flowerPot + */ + public boolean isFlowerPot() + { + return false; + } + + public boolean requiresUpdates() + { + return true; + } + + /** + * Return whether this block can drop from an explosion. + */ + public boolean canDropFromExplosion(Explosion explosionIn) + { + return true; + } + + public boolean isAssociatedBlock(Block other) + { + return this == other; + } + + public static boolean isEqualTo(Block blockIn, Block other) + { + return blockIn != null && other != null ? (blockIn == other ? true : blockIn.isAssociatedBlock(other)) : false; + } + + public boolean hasComparatorInputOverride() + { + return false; + } + + public int getComparatorInputOverride(World worldIn, BlockPos pos) + { + return 0; + } + + /** + * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...) + */ + public IBlockState getStateForEntityRender(IBlockState state) + { + return state; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[0]); + } + + public BlockState getBlockState() + { + return this.blockState; + } + + protected final void setDefaultState(IBlockState state) + { + this.defaultBlockState = state; + } + + public final IBlockState getDefaultState() + { + return this.defaultBlockState; + } + + /** + * Get the OffsetType for this Block. Determines if the model is rendered slightly offset. + */ + public Block.EnumOffsetType getOffsetType() + { + return Block.EnumOffsetType.NONE; + } + + public String toString() + { + return "Block{" + blockRegistry.getNameForObject(this) + "}"; + } + + public static void registerBlocks() + { + registerBlock(0, AIR_ID, (new BlockAir()).setUnlocalizedName("air")); + registerBlock(1, "stone", (new BlockStone()).setHardness(1.5F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stone")); + registerBlock(2, "grass", (new BlockGrass()).setHardness(0.6F).setStepSound(soundTypeGrass).setUnlocalizedName("grass")); + registerBlock(3, "dirt", (new BlockDirt()).setHardness(0.5F).setStepSound(soundTypeGravel).setUnlocalizedName("dirt")); + Block block = (new Block(Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stonebrick").setCreativeTab(CreativeTabs.tabBlock); + registerBlock(4, "cobblestone", block); + Block block1 = (new BlockPlanks()).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("wood"); + registerBlock(5, "planks", block1); + registerBlock(6, "sapling", (new BlockSapling()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("sapling")); + registerBlock(7, "bedrock", (new Block(Material.rock)).setBlockUnbreakable().setResistance(6000000.0F).setStepSound(soundTypePiston).setUnlocalizedName("bedrock").disableStats().setCreativeTab(CreativeTabs.tabBlock)); + registerBlock(8, "flowing_water", (new BlockDynamicLiquid(Material.water)).setHardness(100.0F).setLightOpacity(3).setUnlocalizedName("water").disableStats()); + registerBlock(9, "water", (new BlockStaticLiquid(Material.water)).setHardness(100.0F).setLightOpacity(3).setUnlocalizedName("water").disableStats()); + registerBlock(10, "flowing_lava", (new BlockDynamicLiquid(Material.lava)).setHardness(100.0F).setLightLevel(1.0F).setUnlocalizedName("lava").disableStats()); + registerBlock(11, "lava", (new BlockStaticLiquid(Material.lava)).setHardness(100.0F).setLightLevel(1.0F).setUnlocalizedName("lava").disableStats()); + registerBlock(12, "sand", (new BlockSand()).setHardness(0.5F).setStepSound(soundTypeSand).setUnlocalizedName("sand")); + registerBlock(13, "gravel", (new BlockGravel()).setHardness(0.6F).setStepSound(soundTypeGravel).setUnlocalizedName("gravel")); + registerBlock(14, "gold_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreGold")); + registerBlock(15, "iron_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreIron")); + registerBlock(16, "coal_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreCoal")); + registerBlock(17, "log", (new BlockOldLog()).setUnlocalizedName("log")); + registerBlock(18, "leaves", (new BlockOldLeaf()).setUnlocalizedName("leaves")); + registerBlock(19, "sponge", (new BlockSponge()).setHardness(0.6F).setStepSound(soundTypeGrass).setUnlocalizedName("sponge")); + registerBlock(20, "glass", (new BlockGlass(Material.glass, false)).setHardness(0.3F).setStepSound(soundTypeGlass).setUnlocalizedName("glass")); + registerBlock(21, "lapis_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreLapis")); + registerBlock(22, "lapis_block", (new Block(Material.iron, MapColor.lapisColor)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("blockLapis").setCreativeTab(CreativeTabs.tabBlock)); + registerBlock(23, "dispenser", (new BlockDispenser()).setHardness(3.5F).setStepSound(soundTypePiston).setUnlocalizedName("dispenser")); + Block block2 = (new BlockSandStone()).setStepSound(soundTypePiston).setHardness(0.8F).setUnlocalizedName("sandStone"); + registerBlock(24, "sandstone", block2); + registerBlock(25, "noteblock", (new BlockNote()).setHardness(0.8F).setUnlocalizedName("musicBlock")); + registerBlock(26, "bed", (new BlockBed()).setStepSound(soundTypeWood).setHardness(0.2F).setUnlocalizedName("bed").disableStats()); + registerBlock(27, "golden_rail", (new BlockRailPowered()).setHardness(0.7F).setStepSound(soundTypeMetal).setUnlocalizedName("goldenRail")); + registerBlock(28, "detector_rail", (new BlockRailDetector()).setHardness(0.7F).setStepSound(soundTypeMetal).setUnlocalizedName("detectorRail")); + registerBlock(29, "sticky_piston", (new BlockPistonBase(true)).setUnlocalizedName("pistonStickyBase")); + registerBlock(30, "web", (new BlockWeb()).setLightOpacity(1).setHardness(4.0F).setUnlocalizedName("web")); + registerBlock(31, "tallgrass", (new BlockTallGrass()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("tallgrass")); + registerBlock(32, "deadbush", (new BlockDeadBush()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("deadbush")); + registerBlock(33, "piston", (new BlockPistonBase(false)).setUnlocalizedName("pistonBase")); + registerBlock(34, "piston_head", (new BlockPistonExtension()).setUnlocalizedName("pistonBase")); + registerBlock(35, "wool", (new BlockColored(Material.cloth)).setHardness(0.8F).setStepSound(soundTypeCloth).setUnlocalizedName("cloth")); + registerBlock(36, "piston_extension", new BlockPistonMoving()); + registerBlock(37, "yellow_flower", (new BlockYellowFlower()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("flower1")); + registerBlock(38, "red_flower", (new BlockRedFlower()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("flower2")); + Block block3 = (new BlockMushroom()).setHardness(0.0F).setStepSound(soundTypeGrass).setLightLevel(0.125F).setUnlocalizedName("mushroom"); + registerBlock(39, "brown_mushroom", block3); + Block block4 = (new BlockMushroom()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("mushroom"); + registerBlock(40, "red_mushroom", block4); + registerBlock(41, "gold_block", (new Block(Material.iron, MapColor.goldColor)).setHardness(3.0F).setResistance(10.0F).setStepSound(soundTypeMetal).setUnlocalizedName("blockGold").setCreativeTab(CreativeTabs.tabBlock)); + registerBlock(42, "iron_block", (new Block(Material.iron, MapColor.ironColor)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundTypeMetal).setUnlocalizedName("blockIron").setCreativeTab(CreativeTabs.tabBlock)); + registerBlock(43, "double_stone_slab", (new BlockDoubleStoneSlab()).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stoneSlab")); + registerBlock(44, "stone_slab", (new BlockHalfStoneSlab()).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stoneSlab")); + Block block5 = (new Block(Material.rock, MapColor.redColor)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("brick").setCreativeTab(CreativeTabs.tabBlock); + registerBlock(45, "brick_block", block5); + registerBlock(46, "tnt", (new BlockTNT()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("tnt")); + registerBlock(47, "bookshelf", (new BlockBookshelf()).setHardness(1.5F).setStepSound(soundTypeWood).setUnlocalizedName("bookshelf")); + registerBlock(48, "mossy_cobblestone", (new Block(Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stoneMoss").setCreativeTab(CreativeTabs.tabBlock)); + registerBlock(49, "obsidian", (new BlockObsidian()).setHardness(50.0F).setResistance(2000.0F).setStepSound(soundTypePiston).setUnlocalizedName("obsidian")); + registerBlock(50, "torch", (new BlockTorch()).setHardness(0.0F).setLightLevel(0.9375F).setStepSound(soundTypeWood).setUnlocalizedName("torch")); + registerBlock(51, "fire", (new BlockFire()).setHardness(0.0F).setLightLevel(1.0F).setStepSound(soundTypeCloth).setUnlocalizedName("fire").disableStats()); + registerBlock(52, "mob_spawner", (new BlockMobSpawner()).setHardness(5.0F).setStepSound(soundTypeMetal).setUnlocalizedName("mobSpawner").disableStats()); + registerBlock(53, "oak_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.OAK))).setUnlocalizedName("stairsWood")); + registerBlock(54, "chest", (new BlockChest(0)).setHardness(2.5F).setStepSound(soundTypeWood).setUnlocalizedName("chest")); + registerBlock(55, "redstone_wire", (new BlockRedstoneWire()).setHardness(0.0F).setStepSound(soundTypeStone).setUnlocalizedName("redstoneDust").disableStats()); + registerBlock(56, "diamond_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreDiamond")); + registerBlock(57, "diamond_block", (new Block(Material.iron, MapColor.diamondColor)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundTypeMetal).setUnlocalizedName("blockDiamond").setCreativeTab(CreativeTabs.tabBlock)); + registerBlock(58, "crafting_table", (new BlockWorkbench()).setHardness(2.5F).setStepSound(soundTypeWood).setUnlocalizedName("workbench")); + registerBlock(59, "wheat", (new BlockCrops()).setUnlocalizedName("crops")); + Block block6 = (new BlockFarmland()).setHardness(0.6F).setStepSound(soundTypeGravel).setUnlocalizedName("farmland"); + registerBlock(60, "farmland", block6); + registerBlock(61, "furnace", (new BlockFurnace(false)).setHardness(3.5F).setStepSound(soundTypePiston).setUnlocalizedName("furnace").setCreativeTab(CreativeTabs.tabDecorations)); + registerBlock(62, "lit_furnace", (new BlockFurnace(true)).setHardness(3.5F).setStepSound(soundTypePiston).setLightLevel(0.875F).setUnlocalizedName("furnace")); + registerBlock(63, "standing_sign", (new BlockStandingSign()).setHardness(1.0F).setStepSound(soundTypeWood).setUnlocalizedName("sign").disableStats()); + registerBlock(64, "wooden_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("doorOak").disableStats()); + registerBlock(65, "ladder", (new BlockLadder()).setHardness(0.4F).setStepSound(soundTypeLadder).setUnlocalizedName("ladder")); + registerBlock(66, "rail", (new BlockRail()).setHardness(0.7F).setStepSound(soundTypeMetal).setUnlocalizedName("rail")); + registerBlock(67, "stone_stairs", (new BlockStairs(block.getDefaultState())).setUnlocalizedName("stairsStone")); + registerBlock(68, "wall_sign", (new BlockWallSign()).setHardness(1.0F).setStepSound(soundTypeWood).setUnlocalizedName("sign").disableStats()); + registerBlock(69, "lever", (new BlockLever()).setHardness(0.5F).setStepSound(soundTypeWood).setUnlocalizedName("lever")); + registerBlock(70, "stone_pressure_plate", (new BlockPressurePlate(Material.rock, BlockPressurePlate.Sensitivity.MOBS)).setHardness(0.5F).setStepSound(soundTypePiston).setUnlocalizedName("pressurePlateStone")); + registerBlock(71, "iron_door", (new BlockDoor(Material.iron)).setHardness(5.0F).setStepSound(soundTypeMetal).setUnlocalizedName("doorIron").disableStats()); + registerBlock(72, "wooden_pressure_plate", (new BlockPressurePlate(Material.wood, BlockPressurePlate.Sensitivity.EVERYTHING)).setHardness(0.5F).setStepSound(soundTypeWood).setUnlocalizedName("pressurePlateWood")); + registerBlock(73, "redstone_ore", (new BlockRedstoneOre(false)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreRedstone").setCreativeTab(CreativeTabs.tabBlock)); + registerBlock(74, "lit_redstone_ore", (new BlockRedstoneOre(true)).setLightLevel(0.625F).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreRedstone")); + registerBlock(75, "unlit_redstone_torch", (new BlockRedstoneTorch(false)).setHardness(0.0F).setStepSound(soundTypeWood).setUnlocalizedName("notGate")); + registerBlock(76, "redstone_torch", (new BlockRedstoneTorch(true)).setHardness(0.0F).setLightLevel(0.5F).setStepSound(soundTypeWood).setUnlocalizedName("notGate").setCreativeTab(CreativeTabs.tabRedstone)); + registerBlock(77, "stone_button", (new BlockButtonStone()).setHardness(0.5F).setStepSound(soundTypePiston).setUnlocalizedName("button")); + registerBlock(78, "snow_layer", (new BlockSnow()).setHardness(0.1F).setStepSound(soundTypeSnow).setUnlocalizedName("snow").setLightOpacity(0)); + registerBlock(79, "ice", (new BlockIce()).setHardness(0.5F).setLightOpacity(3).setStepSound(soundTypeGlass).setUnlocalizedName("ice")); + registerBlock(80, "snow", (new BlockSnowBlock()).setHardness(0.2F).setStepSound(soundTypeSnow).setUnlocalizedName("snow")); + registerBlock(81, "cactus", (new BlockCactus()).setHardness(0.4F).setStepSound(soundTypeCloth).setUnlocalizedName("cactus")); + registerBlock(82, "clay", (new BlockClay()).setHardness(0.6F).setStepSound(soundTypeGravel).setUnlocalizedName("clay")); + registerBlock(83, "reeds", (new BlockReed()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("reeds").disableStats()); + registerBlock(84, "jukebox", (new BlockJukebox()).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("jukebox")); + registerBlock(85, "fence", (new BlockFence(Material.wood, BlockPlanks.EnumType.OAK.func_181070_c())).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("fence")); + Block block7 = (new BlockPumpkin()).setHardness(1.0F).setStepSound(soundTypeWood).setUnlocalizedName("pumpkin"); + registerBlock(86, "pumpkin", block7); + registerBlock(87, "netherrack", (new BlockNetherrack()).setHardness(0.4F).setStepSound(soundTypePiston).setUnlocalizedName("hellrock")); + registerBlock(88, "soul_sand", (new BlockSoulSand()).setHardness(0.5F).setStepSound(soundTypeSand).setUnlocalizedName("hellsand")); + registerBlock(89, "glowstone", (new BlockGlowstone(Material.glass)).setHardness(0.3F).setStepSound(soundTypeGlass).setLightLevel(1.0F).setUnlocalizedName("lightgem")); + registerBlock(90, "portal", (new BlockPortal()).setHardness(-1.0F).setStepSound(soundTypeGlass).setLightLevel(0.75F).setUnlocalizedName("portal")); + registerBlock(91, "lit_pumpkin", (new BlockPumpkin()).setHardness(1.0F).setStepSound(soundTypeWood).setLightLevel(1.0F).setUnlocalizedName("litpumpkin")); + registerBlock(92, "cake", (new BlockCake()).setHardness(0.5F).setStepSound(soundTypeCloth).setUnlocalizedName("cake").disableStats()); + registerBlock(93, "unpowered_repeater", (new BlockRedstoneRepeater(false)).setHardness(0.0F).setStepSound(soundTypeWood).setUnlocalizedName("diode").disableStats()); + registerBlock(94, "powered_repeater", (new BlockRedstoneRepeater(true)).setHardness(0.0F).setStepSound(soundTypeWood).setUnlocalizedName("diode").disableStats()); + registerBlock(95, "stained_glass", (new BlockStainedGlass(Material.glass)).setHardness(0.3F).setStepSound(soundTypeGlass).setUnlocalizedName("stainedGlass")); + registerBlock(96, "trapdoor", (new BlockTrapDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("trapdoor").disableStats()); + registerBlock(97, "monster_egg", (new BlockSilverfish()).setHardness(0.75F).setUnlocalizedName("monsterStoneEgg")); + Block block8 = (new BlockStoneBrick()).setHardness(1.5F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stonebricksmooth"); + registerBlock(98, "stonebrick", block8); + registerBlock(99, "brown_mushroom_block", (new BlockHugeMushroom(Material.wood, MapColor.dirtColor, block3)).setHardness(0.2F).setStepSound(soundTypeWood).setUnlocalizedName("mushroom")); + registerBlock(100, "red_mushroom_block", (new BlockHugeMushroom(Material.wood, MapColor.redColor, block4)).setHardness(0.2F).setStepSound(soundTypeWood).setUnlocalizedName("mushroom")); + registerBlock(101, "iron_bars", (new BlockPane(Material.iron, true)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundTypeMetal).setUnlocalizedName("fenceIron")); + registerBlock(102, "glass_pane", (new BlockPane(Material.glass, false)).setHardness(0.3F).setStepSound(soundTypeGlass).setUnlocalizedName("thinGlass")); + Block block9 = (new BlockMelon()).setHardness(1.0F).setStepSound(soundTypeWood).setUnlocalizedName("melon"); + registerBlock(103, "melon_block", block9); + registerBlock(104, "pumpkin_stem", (new BlockStem(block7)).setHardness(0.0F).setStepSound(soundTypeWood).setUnlocalizedName("pumpkinStem")); + registerBlock(105, "melon_stem", (new BlockStem(block9)).setHardness(0.0F).setStepSound(soundTypeWood).setUnlocalizedName("pumpkinStem")); + registerBlock(106, "vine", (new BlockVine()).setHardness(0.2F).setStepSound(soundTypeGrass).setUnlocalizedName("vine")); + registerBlock(107, "fence_gate", (new BlockFenceGate(BlockPlanks.EnumType.OAK)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("fenceGate")); + registerBlock(108, "brick_stairs", (new BlockStairs(block5.getDefaultState())).setUnlocalizedName("stairsBrick")); + registerBlock(109, "stone_brick_stairs", (new BlockStairs(block8.getDefaultState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.DEFAULT))).setUnlocalizedName("stairsStoneBrickSmooth")); + registerBlock(110, "mycelium", (new BlockMycelium()).setHardness(0.6F).setStepSound(soundTypeGrass).setUnlocalizedName("mycel")); + registerBlock(111, "waterlily", (new BlockLilyPad()).setHardness(0.0F).setStepSound(soundTypeGrass).setUnlocalizedName("waterlily")); + Block block10 = (new BlockNetherBrick()).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("netherBrick").setCreativeTab(CreativeTabs.tabBlock); + registerBlock(112, "nether_brick", block10); + registerBlock(113, "nether_brick_fence", (new BlockFence(Material.rock, MapColor.netherrackColor)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("netherFence")); + registerBlock(114, "nether_brick_stairs", (new BlockStairs(block10.getDefaultState())).setUnlocalizedName("stairsNetherBrick")); + registerBlock(115, "nether_wart", (new BlockNetherWart()).setUnlocalizedName("netherStalk")); + registerBlock(116, "enchanting_table", (new BlockEnchantmentTable()).setHardness(5.0F).setResistance(2000.0F).setUnlocalizedName("enchantmentTable")); + registerBlock(117, "brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLightLevel(0.125F).setUnlocalizedName("brewingStand")); + registerBlock(118, "cauldron", (new BlockCauldron()).setHardness(2.0F).setUnlocalizedName("cauldron")); + registerBlock(119, "end_portal", (new BlockEndPortal(Material.portal)).setHardness(-1.0F).setResistance(6000000.0F)); + registerBlock(120, "end_portal_frame", (new BlockEndPortalFrame()).setStepSound(soundTypeGlass).setLightLevel(0.125F).setHardness(-1.0F).setUnlocalizedName("endPortalFrame").setResistance(6000000.0F).setCreativeTab(CreativeTabs.tabDecorations)); + registerBlock(121, "end_stone", (new Block(Material.rock, MapColor.sandColor)).setHardness(3.0F).setResistance(15.0F).setStepSound(soundTypePiston).setUnlocalizedName("whiteStone").setCreativeTab(CreativeTabs.tabBlock)); + registerBlock(122, "dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setStepSound(soundTypePiston).setLightLevel(0.125F).setUnlocalizedName("dragonEgg")); + registerBlock(123, "redstone_lamp", (new BlockRedstoneLight(false)).setHardness(0.3F).setStepSound(soundTypeGlass).setUnlocalizedName("redstoneLight").setCreativeTab(CreativeTabs.tabRedstone)); + registerBlock(124, "lit_redstone_lamp", (new BlockRedstoneLight(true)).setHardness(0.3F).setStepSound(soundTypeGlass).setUnlocalizedName("redstoneLight")); + registerBlock(125, "double_wooden_slab", (new BlockDoubleWoodSlab()).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("woodSlab")); + registerBlock(126, "wooden_slab", (new BlockHalfWoodSlab()).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("woodSlab")); + registerBlock(127, "cocoa", (new BlockCocoa()).setHardness(0.2F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("cocoa")); + registerBlock(128, "sandstone_stairs", (new BlockStairs(block2.getDefaultState().withProperty(BlockSandStone.TYPE, BlockSandStone.EnumType.SMOOTH))).setUnlocalizedName("stairsSandStone")); + registerBlock(129, "emerald_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("oreEmerald")); + registerBlock(130, "ender_chest", (new BlockEnderChest()).setHardness(22.5F).setResistance(1000.0F).setStepSound(soundTypePiston).setUnlocalizedName("enderChest").setLightLevel(0.5F)); + registerBlock(131, "tripwire_hook", (new BlockTripWireHook()).setUnlocalizedName("tripWireSource")); + registerBlock(132, "tripwire", (new BlockTripWire()).setUnlocalizedName("tripWire")); + registerBlock(133, "emerald_block", (new Block(Material.iron, MapColor.emeraldColor)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundTypeMetal).setUnlocalizedName("blockEmerald").setCreativeTab(CreativeTabs.tabBlock)); + registerBlock(134, "spruce_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.SPRUCE))).setUnlocalizedName("stairsWoodSpruce")); + registerBlock(135, "birch_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.BIRCH))).setUnlocalizedName("stairsWoodBirch")); + registerBlock(136, "jungle_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.JUNGLE))).setUnlocalizedName("stairsWoodJungle")); + registerBlock(137, "command_block", (new BlockCommandBlock()).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("commandBlock")); + registerBlock(138, "beacon", (new BlockBeacon()).setUnlocalizedName("beacon").setLightLevel(1.0F)); + registerBlock(139, "cobblestone_wall", (new BlockWall(block)).setUnlocalizedName("cobbleWall")); + registerBlock(140, "flower_pot", (new BlockFlowerPot()).setHardness(0.0F).setStepSound(soundTypeStone).setUnlocalizedName("flowerPot")); + registerBlock(141, "carrots", (new BlockCarrot()).setUnlocalizedName("carrots")); + registerBlock(142, "potatoes", (new BlockPotato()).setUnlocalizedName("potatoes")); + registerBlock(143, "wooden_button", (new BlockButtonWood()).setHardness(0.5F).setStepSound(soundTypeWood).setUnlocalizedName("button")); + registerBlock(144, "skull", (new BlockSkull()).setHardness(1.0F).setStepSound(soundTypePiston).setUnlocalizedName("skull")); + registerBlock(145, "anvil", (new BlockAnvil()).setHardness(5.0F).setStepSound(soundTypeAnvil).setResistance(2000.0F).setUnlocalizedName("anvil")); + registerBlock(146, "trapped_chest", (new BlockChest(1)).setHardness(2.5F).setStepSound(soundTypeWood).setUnlocalizedName("chestTrap")); + registerBlock(147, "light_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.iron, 15, MapColor.goldColor)).setHardness(0.5F).setStepSound(soundTypeWood).setUnlocalizedName("weightedPlate_light")); + registerBlock(148, "heavy_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.iron, 150)).setHardness(0.5F).setStepSound(soundTypeWood).setUnlocalizedName("weightedPlate_heavy")); + registerBlock(149, "unpowered_comparator", (new BlockRedstoneComparator(false)).setHardness(0.0F).setStepSound(soundTypeWood).setUnlocalizedName("comparator").disableStats()); + registerBlock(150, "powered_comparator", (new BlockRedstoneComparator(true)).setHardness(0.0F).setLightLevel(0.625F).setStepSound(soundTypeWood).setUnlocalizedName("comparator").disableStats()); + registerBlock(151, "daylight_detector", new BlockDaylightDetector(false)); + registerBlock(152, "redstone_block", (new BlockCompressedPowered(Material.iron, MapColor.tntColor)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundTypeMetal).setUnlocalizedName("blockRedstone").setCreativeTab(CreativeTabs.tabRedstone)); + registerBlock(153, "quartz_ore", (new BlockOre(MapColor.netherrackColor)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundTypePiston).setUnlocalizedName("netherquartz")); + registerBlock(154, "hopper", (new BlockHopper()).setHardness(3.0F).setResistance(8.0F).setStepSound(soundTypeMetal).setUnlocalizedName("hopper")); + Block block11 = (new BlockQuartz()).setStepSound(soundTypePiston).setHardness(0.8F).setUnlocalizedName("quartzBlock"); + registerBlock(155, "quartz_block", block11); + registerBlock(156, "quartz_stairs", (new BlockStairs(block11.getDefaultState().withProperty(BlockQuartz.VARIANT, BlockQuartz.EnumType.DEFAULT))).setUnlocalizedName("stairsQuartz")); + registerBlock(157, "activator_rail", (new BlockRailPowered()).setHardness(0.7F).setStepSound(soundTypeMetal).setUnlocalizedName("activatorRail")); + registerBlock(158, "dropper", (new BlockDropper()).setHardness(3.5F).setStepSound(soundTypePiston).setUnlocalizedName("dropper")); + registerBlock(159, "stained_hardened_clay", (new BlockColored(Material.rock)).setHardness(1.25F).setResistance(7.0F).setStepSound(soundTypePiston).setUnlocalizedName("clayHardenedStained")); + registerBlock(160, "stained_glass_pane", (new BlockStainedGlassPane()).setHardness(0.3F).setStepSound(soundTypeGlass).setUnlocalizedName("thinStainedGlass")); + registerBlock(161, "leaves2", (new BlockNewLeaf()).setUnlocalizedName("leaves")); + registerBlock(162, "log2", (new BlockNewLog()).setUnlocalizedName("log")); + registerBlock(163, "acacia_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.ACACIA))).setUnlocalizedName("stairsWoodAcacia")); + registerBlock(164, "dark_oak_stairs", (new BlockStairs(block1.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.DARK_OAK))).setUnlocalizedName("stairsWoodDarkOak")); + registerBlock(165, "slime", (new BlockSlime()).setUnlocalizedName("slime").setStepSound(SLIME_SOUND)); + registerBlock(166, "barrier", (new BlockBarrier()).setUnlocalizedName("barrier")); + registerBlock(167, "iron_trapdoor", (new BlockTrapDoor(Material.iron)).setHardness(5.0F).setStepSound(soundTypeMetal).setUnlocalizedName("ironTrapdoor").disableStats()); + registerBlock(168, "prismarine", (new BlockPrismarine()).setHardness(1.5F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("prismarine")); + registerBlock(169, "sea_lantern", (new BlockSeaLantern(Material.glass)).setHardness(0.3F).setStepSound(soundTypeGlass).setLightLevel(1.0F).setUnlocalizedName("seaLantern")); + registerBlock(170, "hay_block", (new BlockHay()).setHardness(0.5F).setStepSound(soundTypeGrass).setUnlocalizedName("hayBlock").setCreativeTab(CreativeTabs.tabBlock)); + registerBlock(171, "carpet", (new BlockCarpet()).setHardness(0.1F).setStepSound(soundTypeCloth).setUnlocalizedName("woolCarpet").setLightOpacity(0)); + registerBlock(172, "hardened_clay", (new BlockHardenedClay()).setHardness(1.25F).setResistance(7.0F).setStepSound(soundTypePiston).setUnlocalizedName("clayHardened")); + registerBlock(173, "coal_block", (new Block(Material.rock, MapColor.blackColor)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("blockCoal").setCreativeTab(CreativeTabs.tabBlock)); + registerBlock(174, "packed_ice", (new BlockPackedIce()).setHardness(0.5F).setStepSound(soundTypeGlass).setUnlocalizedName("icePacked")); + registerBlock(175, "double_plant", new BlockDoublePlant()); + registerBlock(176, "standing_banner", (new BlockBanner.BlockBannerStanding()).setHardness(1.0F).setStepSound(soundTypeWood).setUnlocalizedName("banner").disableStats()); + registerBlock(177, "wall_banner", (new BlockBanner.BlockBannerHanging()).setHardness(1.0F).setStepSound(soundTypeWood).setUnlocalizedName("banner").disableStats()); + registerBlock(178, "daylight_detector_inverted", new BlockDaylightDetector(true)); + Block block12 = (new BlockRedSandstone()).setStepSound(soundTypePiston).setHardness(0.8F).setUnlocalizedName("redSandStone"); + registerBlock(179, "red_sandstone", block12); + registerBlock(180, "red_sandstone_stairs", (new BlockStairs(block12.getDefaultState().withProperty(BlockRedSandstone.TYPE, BlockRedSandstone.EnumType.SMOOTH))).setUnlocalizedName("stairsRedSandStone")); + registerBlock(181, "double_stone_slab2", (new BlockDoubleStoneSlabNew()).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stoneSlab2")); + registerBlock(182, "stone_slab2", (new BlockHalfStoneSlabNew()).setHardness(2.0F).setResistance(10.0F).setStepSound(soundTypePiston).setUnlocalizedName("stoneSlab2")); + registerBlock(183, "spruce_fence_gate", (new BlockFenceGate(BlockPlanks.EnumType.SPRUCE)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("spruceFenceGate")); + registerBlock(184, "birch_fence_gate", (new BlockFenceGate(BlockPlanks.EnumType.BIRCH)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("birchFenceGate")); + registerBlock(185, "jungle_fence_gate", (new BlockFenceGate(BlockPlanks.EnumType.JUNGLE)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("jungleFenceGate")); + registerBlock(186, "dark_oak_fence_gate", (new BlockFenceGate(BlockPlanks.EnumType.DARK_OAK)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("darkOakFenceGate")); + registerBlock(187, "acacia_fence_gate", (new BlockFenceGate(BlockPlanks.EnumType.ACACIA)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("acaciaFenceGate")); + registerBlock(188, "spruce_fence", (new BlockFence(Material.wood, BlockPlanks.EnumType.SPRUCE.func_181070_c())).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("spruceFence")); + registerBlock(189, "birch_fence", (new BlockFence(Material.wood, BlockPlanks.EnumType.BIRCH.func_181070_c())).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("birchFence")); + registerBlock(190, "jungle_fence", (new BlockFence(Material.wood, BlockPlanks.EnumType.JUNGLE.func_181070_c())).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("jungleFence")); + registerBlock(191, "dark_oak_fence", (new BlockFence(Material.wood, BlockPlanks.EnumType.DARK_OAK.func_181070_c())).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("darkOakFence")); + registerBlock(192, "acacia_fence", (new BlockFence(Material.wood, BlockPlanks.EnumType.ACACIA.func_181070_c())).setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood).setUnlocalizedName("acaciaFence")); + registerBlock(193, "spruce_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("doorSpruce").disableStats()); + registerBlock(194, "birch_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("doorBirch").disableStats()); + registerBlock(195, "jungle_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("doorJungle").disableStats()); + registerBlock(196, "acacia_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("doorAcacia").disableStats()); + registerBlock(197, "dark_oak_door", (new BlockDoor(Material.wood)).setHardness(3.0F).setStepSound(soundTypeWood).setUnlocalizedName("doorDarkOak").disableStats()); + blockRegistry.validateKey(); + + for (Block block13 : blockRegistry) + { + if (block13.blockMaterial == Material.air) + { + block13.useNeighborBrightness = false; + } + else + { + boolean flag = false; + boolean flag1 = block13 instanceof BlockStairs; + boolean flag2 = block13 instanceof BlockSlab; + boolean flag3 = block13 == block6; + boolean flag4 = block13.translucent; + boolean flag5 = block13.lightOpacity == 0; + + if (flag1 || flag2 || flag3 || flag4 || flag5) + { + flag = true; + } + + block13.useNeighborBrightness = flag; + } + } + + for (Block block14 : blockRegistry) + { + for (IBlockState iblockstate : block14.getBlockState().getValidStates()) + { + int i = blockRegistry.getIDForObject(block14) << 4 | block14.getMetaFromState(iblockstate); + BLOCK_STATE_IDS.put(iblockstate, i); + } + } + } + + private static void registerBlock(int id, ResourceLocation textualID, Block block_) + { + blockRegistry.register(id, textualID, block_); + } + + private static void registerBlock(int id, String textualID, Block block_) + { + registerBlock(id, new ResourceLocation(textualID), block_); + } + + public static enum EnumOffsetType + { + NONE, + XZ, + XYZ; + } + + public static class SoundType + { + public final String soundName; + public final float volume; + public final float frequency; + + public SoundType(String name, float volume, float frequency) + { + this.soundName = name; + this.volume = volume; + this.frequency = frequency; + } + + public float getVolume() + { + return this.volume; + } + + public float getFrequency() + { + return this.frequency; + } + + public String getBreakSound() + { + return "dig." + this.soundName; + } + + public String getStepSound() + { + return "step." + this.soundName; + } + + public String getPlaceSound() + { + return this.getBreakSound(); + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockAir.java b/src/minecraft/net/minecraft/block/BlockAir.java new file mode 100644 index 0000000..00311da --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockAir.java @@ -0,0 +1,56 @@ +package net.minecraft.block; + +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockAir extends Block +{ + protected BlockAir() + { + super(Material.air); + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return -1; + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid) + { + return false; + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + } + + /** + * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) + */ + public boolean isReplaceable(World worldIn, BlockPos pos) + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockAnvil.java b/src/minecraft/net/minecraft/block/BlockAnvil.java new file mode 100644 index 0000000..dfcbb19 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockAnvil.java @@ -0,0 +1,190 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerRepair; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IInteractionObject; +import net.minecraft.world.World; + +public class BlockAnvil extends BlockFalling +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyInteger DAMAGE = PropertyInteger.create("damage", 0, 2); + + protected BlockAnvil() + { + super(Material.anvil); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(DAMAGE, Integer.valueOf(0))); + this.setLightOpacity(0); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + public boolean isFullCube() + { + return false; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + EnumFacing enumfacing = placer.getHorizontalFacing().rotateY(); + return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(FACING, enumfacing).withProperty(DAMAGE, Integer.valueOf(meta >> 2)); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (!worldIn.isRemote) + { + playerIn.displayGui(new BlockAnvil.Anvil(worldIn, pos)); + } + + return true; + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((Integer)state.getValue(DAMAGE)).intValue(); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING); + + if (enumfacing.getAxis() == EnumFacing.Axis.X) + { + this.setBlockBounds(0.0F, 0.0F, 0.125F, 1.0F, 1.0F, 0.875F); + } + else + { + this.setBlockBounds(0.125F, 0.0F, 0.0F, 0.875F, 1.0F, 1.0F); + } + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + list.add(new ItemStack(itemIn, 1, 0)); + list.add(new ItemStack(itemIn, 1, 1)); + list.add(new ItemStack(itemIn, 1, 2)); + } + + protected void onStartFalling(EntityFallingBlock fallingEntity) + { + fallingEntity.setHurtEntities(true); + } + + public void onEndFalling(World worldIn, BlockPos pos) + { + worldIn.playAuxSFX(1022, pos, 0); + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return true; + } + + /** + * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...) + */ + public IBlockState getStateForEntityRender(IBlockState state) + { + return this.getDefaultState().withProperty(FACING, EnumFacing.SOUTH); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta & 3)).withProperty(DAMAGE, Integer.valueOf((meta & 15) >> 2)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); + i = i | ((Integer)state.getValue(DAMAGE)).intValue() << 2; + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, DAMAGE}); + } + + public static class Anvil implements IInteractionObject + { + private final World world; + private final BlockPos position; + + public Anvil(World worldIn, BlockPos pos) + { + this.world = worldIn; + this.position = pos; + } + + public String getName() + { + return "anvil"; + } + + public boolean hasCustomName() + { + return false; + } + + public IChatComponent getDisplayName() + { + return new ChatComponentTranslation(Blocks.anvil.getUnlocalizedName() + ".name", new Object[0]); + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + return new ContainerRepair(playerInventory, this.world, this.position, playerIn); + } + + public String getGuiID() + { + return "minecraft:anvil"; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockBanner.java b/src/minecraft/net/minecraft/block/BlockBanner.java new file mode 100644 index 0000000..7dc9441 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockBanner.java @@ -0,0 +1,253 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityBanner; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.StatCollector; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockBanner extends BlockContainer +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyInteger ROTATION = PropertyInteger.create("rotation", 0, 15); + + protected BlockBanner() + { + super(Material.wood); + float f = 0.25F; + float f1 = 1.0F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal("item.banner.white.name"); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getSelectedBoundingBox(worldIn, pos); + } + + public boolean isFullCube() + { + return false; + } + + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + { + return true; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean func_181623_g() + { + return true; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityBanner(); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.banner; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.banner; + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityBanner) + { + ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor()); + NBTTagCompound nbttagcompound = new NBTTagCompound(); + tileentity.writeToNBT(nbttagcompound); + nbttagcompound.removeTag("x"); + nbttagcompound.removeTag("y"); + nbttagcompound.removeTag("z"); + nbttagcompound.removeTag("id"); + itemstack.setTagInfo("BlockEntityTag", nbttagcompound); + spawnAsEntity(worldIn, pos, itemstack); + } + else + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + } + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return !this.func_181087_e(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos); + } + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { + if (te instanceof TileEntityBanner) + { + TileEntityBanner tileentitybanner = (TileEntityBanner)te; + ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)te).getBaseColor()); + NBTTagCompound nbttagcompound = new NBTTagCompound(); + TileEntityBanner.func_181020_a(nbttagcompound, tileentitybanner.getBaseColor(), tileentitybanner.func_181021_d()); + itemstack.setTagInfo("BlockEntityTag", nbttagcompound); + spawnAsEntity(worldIn, pos, itemstack); + } + else + { + super.harvestBlock(worldIn, player, pos, state, (TileEntity)null); + } + } + + public static class BlockBannerHanging extends BlockBanner + { + public BlockBannerHanging() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING); + float f = 0.0F; + float f1 = 0.78125F; + float f2 = 0.0F; + float f3 = 1.0F; + float f4 = 0.125F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + + switch (enumfacing) + { + case NORTH: + default: + this.setBlockBounds(f2, f, 1.0F - f4, f3, f1, 1.0F); + break; + + case SOUTH: + this.setBlockBounds(f2, f, 0.0F, f3, f1, f4); + break; + + case WEST: + this.setBlockBounds(1.0F - f4, f, f2, 1.0F, f1, f3); + break; + + case EAST: + this.setBlockBounds(0.0F, f, f2, f4, f1, f3); + } + } + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + + if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().getMaterial().isSolid()) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + + super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + } + + public IBlockState getStateFromMeta(int meta) + { + EnumFacing enumfacing = EnumFacing.getFront(meta); + + if (enumfacing.getAxis() == EnumFacing.Axis.Y) + { + enumfacing = EnumFacing.NORTH; + } + + return this.getDefaultState().withProperty(FACING, enumfacing); + } + + public int getMetaFromState(IBlockState state) + { + return ((EnumFacing)state.getValue(FACING)).getIndex(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING}); + } + } + + public static class BlockBannerStanding extends BlockBanner + { + public BlockBannerStanding() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(ROTATION, Integer.valueOf(0))); + } + + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!worldIn.getBlockState(pos.down()).getBlock().getMaterial().isSolid()) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + + super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + } + + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(ROTATION, Integer.valueOf(meta)); + } + + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(ROTATION)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {ROTATION}); + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockBarrier.java b/src/minecraft/net/minecraft/block/BlockBarrier.java new file mode 100644 index 0000000..a92926f --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockBarrier.java @@ -0,0 +1,49 @@ +package net.minecraft.block; + +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockBarrier extends Block +{ + protected BlockBarrier() + { + super(Material.barrier); + this.setBlockUnbreakable(); + this.setResistance(6000001.0F); + this.disableStats(); + this.translucent = true; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return -1; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Returns the default ambient occlusion value based on block opacity + */ + public float getAmbientOcclusionLightValue() + { + return 1.0F; + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + } +} diff --git a/src/minecraft/net/minecraft/block/BlockBasePressurePlate.java b/src/minecraft/net/minecraft/block/BlockBasePressurePlate.java new file mode 100644 index 0000000..702478a --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockBasePressurePlate.java @@ -0,0 +1,242 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public abstract class BlockBasePressurePlate extends Block +{ + protected BlockBasePressurePlate(Material materialIn) + { + this(materialIn, materialIn.getMaterialMapColor()); + } + + protected BlockBasePressurePlate(Material p_i46401_1_, MapColor p_i46401_2_) + { + super(p_i46401_1_, p_i46401_2_); + this.setCreativeTab(CreativeTabs.tabRedstone); + this.setTickRandomly(true); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + this.setBlockBoundsBasedOnState0(worldIn.getBlockState(pos)); + } + + protected void setBlockBoundsBasedOnState0(IBlockState state) + { + boolean flag = this.getRedstoneStrength(state) > 0; + float f = 0.0625F; + + if (flag) + { + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.03125F, 0.9375F); + } + else + { + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.0625F, 0.9375F); + } + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return 20; + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + { + return true; + } + + public boolean func_181623_g() + { + return true; + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return this.canBePlacedOn(worldIn, pos.down()); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!this.canBePlacedOn(worldIn, pos.down())) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + } + + private boolean canBePlacedOn(World worldIn, BlockPos pos) + { + return World.doesBlockHaveSolidTopSurface(worldIn, pos) || worldIn.getBlockState(pos).getBlock() instanceof BlockFence; + } + + /** + * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) + */ + public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random) + { + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!worldIn.isRemote) + { + int i = this.getRedstoneStrength(state); + + if (i > 0) + { + this.updateState(worldIn, pos, state, i); + } + } + } + + /** + * Called When an Entity Collided with the Block + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + if (!worldIn.isRemote) + { + int i = this.getRedstoneStrength(state); + + if (i == 0) + { + this.updateState(worldIn, pos, state, i); + } + } + } + + /** + * Updates the pressure plate when stepped on + */ + protected void updateState(World worldIn, BlockPos pos, IBlockState state, int oldRedstoneStrength) + { + int i = this.computeRedstoneStrength(worldIn, pos); + boolean flag = oldRedstoneStrength > 0; + boolean flag1 = i > 0; + + if (oldRedstoneStrength != i) + { + state = this.setRedstoneStrength(state, i); + worldIn.setBlockState(pos, state, 2); + this.updateNeighbors(worldIn, pos); + worldIn.markBlockRangeForRenderUpdate(pos, pos); + } + + if (!flag1 && flag) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.5F); + } + else if (flag1 && !flag) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.6F); + } + + if (flag1) + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + } + } + + /** + * Returns the cubic AABB inset by 1/8 on all sides + */ + protected AxisAlignedBB getSensitiveAABB(BlockPos pos) + { + float f = 0.125F; + return new AxisAlignedBB((double)((float)pos.getX() + 0.125F), (double)pos.getY(), (double)((float)pos.getZ() + 0.125F), (double)((float)(pos.getX() + 1) - 0.125F), (double)pos.getY() + 0.25D, (double)((float)(pos.getZ() + 1) - 0.125F)); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + if (this.getRedstoneStrength(state) > 0) + { + this.updateNeighbors(worldIn, pos); + } + + super.breakBlock(worldIn, pos, state); + } + + /** + * Notify block and block below of changes + */ + protected void updateNeighbors(World worldIn, BlockPos pos) + { + worldIn.notifyNeighborsOfStateChange(pos, this); + worldIn.notifyNeighborsOfStateChange(pos.down(), this); + } + + public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return this.getRedstoneStrength(state); + } + + public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return side == EnumFacing.UP ? this.getRedstoneStrength(state) : 0; + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + float f = 0.5F; + float f1 = 0.125F; + float f2 = 0.5F; + this.setBlockBounds(0.0F, 0.375F, 0.0F, 1.0F, 0.625F, 1.0F); + } + + public int getMobilityFlag() + { + return 1; + } + + protected abstract int computeRedstoneStrength(World worldIn, BlockPos pos); + + protected abstract int getRedstoneStrength(IBlockState state); + + protected abstract IBlockState setRedstoneStrength(IBlockState state, int strength); +} diff --git a/src/minecraft/net/minecraft/block/BlockBeacon.java b/src/minecraft/net/minecraft/block/BlockBeacon.java new file mode 100644 index 0000000..f09c30d --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockBeacon.java @@ -0,0 +1,156 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityBeacon; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.HttpUtil; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; + +public class BlockBeacon extends BlockContainer +{ + public BlockBeacon() + { + super(Material.glass, MapColor.diamondColor); + this.setHardness(3.0F); + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityBeacon(); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityBeacon) + { + playerIn.displayGUIChest((TileEntityBeacon)tileentity); + playerIn.triggerAchievement(StatList.field_181730_N); + } + + return true; + } + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + super.onBlockPlacedBy(worldIn, pos, state, placer, stack); + + if (stack.hasDisplayName()) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityBeacon) + { + ((TileEntityBeacon)tileentity).setName(stack.getDisplayName()); + } + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityBeacon) + { + ((TileEntityBeacon)tileentity).updateBeacon(); + worldIn.addBlockEvent(pos, this, 1, 0); + } + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + public static void updateColorAsync(final World worldIn, final BlockPos glassPos) + { + HttpUtil.field_180193_a.submit(new Runnable() + { + public void run() + { + Chunk chunk = worldIn.getChunkFromBlockCoords(glassPos); + + for (int i = glassPos.getY() - 1; i >= 0; --i) + { + final BlockPos blockpos = new BlockPos(glassPos.getX(), i, glassPos.getZ()); + + if (!chunk.canSeeSky(blockpos)) + { + break; + } + + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock() == Blocks.beacon) + { + ((WorldServer)worldIn).addScheduledTask(new Runnable() + { + public void run() + { + TileEntity tileentity = worldIn.getTileEntity(blockpos); + + if (tileentity instanceof TileEntityBeacon) + { + ((TileEntityBeacon)tileentity).updateBeacon(); + worldIn.addBlockEvent(blockpos, Blocks.beacon, 1, 0); + } + } + }); + } + } + } + }); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockBed.java b/src/minecraft/net/minecraft/block/BlockBed.java new file mode 100644 index 0000000..056b439 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockBed.java @@ -0,0 +1,336 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; + +public class BlockBed extends BlockDirectional +{ + public static final PropertyEnum PART = PropertyEnum.create("part", BlockBed.EnumPartType.class); + public static final PropertyBool OCCUPIED = PropertyBool.create("occupied"); + + public BlockBed() + { + super(Material.cloth); + this.setDefaultState(this.blockState.getBaseState().withProperty(PART, BlockBed.EnumPartType.FOOT).withProperty(OCCUPIED, Boolean.valueOf(false))); + this.setBedBounds(); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + if (state.getValue(PART) != BlockBed.EnumPartType.HEAD) + { + pos = pos.offset((EnumFacing)state.getValue(FACING)); + state = worldIn.getBlockState(pos); + + if (state.getBlock() != this) + { + return true; + } + } + + if (worldIn.provider.canRespawnHere() && worldIn.getBiomeGenForCoords(pos) != BiomeGenBase.hell) + { + if (((Boolean)state.getValue(OCCUPIED)).booleanValue()) + { + EntityPlayer entityplayer = this.getPlayerInBed(worldIn, pos); + + if (entityplayer != null) + { + playerIn.addChatComponentMessage(new ChatComponentTranslation("tile.bed.occupied", new Object[0])); + return true; + } + + state = state.withProperty(OCCUPIED, Boolean.valueOf(false)); + worldIn.setBlockState(pos, state, 4); + } + + EntityPlayer.EnumStatus entityplayer$enumstatus = playerIn.trySleep(pos); + + if (entityplayer$enumstatus == EntityPlayer.EnumStatus.OK) + { + state = state.withProperty(OCCUPIED, Boolean.valueOf(true)); + worldIn.setBlockState(pos, state, 4); + return true; + } + else + { + if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW) + { + playerIn.addChatComponentMessage(new ChatComponentTranslation("tile.bed.noSleep", new Object[0])); + } + else if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_SAFE) + { + playerIn.addChatComponentMessage(new ChatComponentTranslation("tile.bed.notSafe", new Object[0])); + } + + return true; + } + } + else + { + worldIn.setBlockToAir(pos); + BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); + + if (worldIn.getBlockState(blockpos).getBlock() == this) + { + worldIn.setBlockToAir(blockpos); + } + + worldIn.newExplosion((Entity)null, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 5.0F, true, true); + return true; + } + } + } + + private EntityPlayer getPlayerInBed(World worldIn, BlockPos pos) + { + for (EntityPlayer entityplayer : worldIn.playerEntities) + { + if (entityplayer.isPlayerSleeping() && entityplayer.playerLocation.equals(pos)) + { + return entityplayer; + } + } + + return null; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + this.setBedBounds(); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + + if (state.getValue(PART) == BlockBed.EnumPartType.HEAD) + { + if (worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock() != this) + { + worldIn.setBlockToAir(pos); + } + } + else if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() != this) + { + worldIn.setBlockToAir(pos); + + if (!worldIn.isRemote) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + } + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return state.getValue(PART) == BlockBed.EnumPartType.HEAD ? null : Items.bed; + } + + private void setBedBounds() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5625F, 1.0F); + } + + /** + * Returns a safe BlockPos to disembark the bed + */ + public static BlockPos getSafeExitLocation(World worldIn, BlockPos pos, int tries) + { + EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING); + int i = pos.getX(); + int j = pos.getY(); + int k = pos.getZ(); + + for (int l = 0; l <= 1; ++l) + { + int i1 = i - enumfacing.getFrontOffsetX() * l - 1; + int j1 = k - enumfacing.getFrontOffsetZ() * l - 1; + int k1 = i1 + 2; + int l1 = j1 + 2; + + for (int i2 = i1; i2 <= k1; ++i2) + { + for (int j2 = j1; j2 <= l1; ++j2) + { + BlockPos blockpos = new BlockPos(i2, j, j2); + + if (hasRoomForPlayer(worldIn, blockpos)) + { + if (tries <= 0) + { + return blockpos; + } + + --tries; + } + } + } + } + + return null; + } + + protected static boolean hasRoomForPlayer(World worldIn, BlockPos pos) + { + return World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !worldIn.getBlockState(pos).getBlock().getMaterial().isSolid() && !worldIn.getBlockState(pos.up()).getBlock().getMaterial().isSolid(); + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + if (state.getValue(PART) == BlockBed.EnumPartType.FOOT) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); + } + } + + public int getMobilityFlag() + { + return 1; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.bed; + } + + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + if (player.capabilities.isCreativeMode && state.getValue(PART) == BlockBed.EnumPartType.HEAD) + { + BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); + + if (worldIn.getBlockState(blockpos).getBlock() == this) + { + worldIn.setBlockToAir(blockpos); + } + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + EnumFacing enumfacing = EnumFacing.getHorizontal(meta); + return (meta & 8) > 0 ? this.getDefaultState().withProperty(PART, BlockBed.EnumPartType.HEAD).withProperty(FACING, enumfacing).withProperty(OCCUPIED, Boolean.valueOf((meta & 4) > 0)) : this.getDefaultState().withProperty(PART, BlockBed.EnumPartType.FOOT).withProperty(FACING, enumfacing); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + if (state.getValue(PART) == BlockBed.EnumPartType.FOOT) + { + IBlockState iblockstate = worldIn.getBlockState(pos.offset((EnumFacing)state.getValue(FACING))); + + if (iblockstate.getBlock() == this) + { + state = state.withProperty(OCCUPIED, iblockstate.getValue(OCCUPIED)); + } + } + + return state; + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); + + if (state.getValue(PART) == BlockBed.EnumPartType.HEAD) + { + i |= 8; + + if (((Boolean)state.getValue(OCCUPIED)).booleanValue()) + { + i |= 4; + } + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, PART, OCCUPIED}); + } + + public static enum EnumPartType implements IStringSerializable + { + HEAD("head"), + FOOT("foot"); + + private final String name; + + private EnumPartType(String name) + { + this.name = name; + } + + public String toString() + { + return this.name; + } + + public String getName() + { + return this.name; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockBookshelf.java b/src/minecraft/net/minecraft/block/BlockBookshelf.java new file mode 100644 index 0000000..dcaef7a --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockBookshelf.java @@ -0,0 +1,33 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; +import net.minecraft.item.Item; + +public class BlockBookshelf extends Block +{ + public BlockBookshelf() + { + super(Material.wood); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 3; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.book; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockBreakable.java b/src/minecraft/net/minecraft/block/BlockBreakable.java new file mode 100644 index 0000000..1a44aba --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockBreakable.java @@ -0,0 +1,54 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; + +public class BlockBreakable extends Block +{ + private boolean ignoreSimilarity; + + protected BlockBreakable(Material materialIn, boolean ignoreSimilarityIn) + { + this(materialIn, ignoreSimilarityIn, materialIn.getMaterialMapColor()); + } + + protected BlockBreakable(Material p_i46393_1_, boolean p_i46393_2_, MapColor p_i46393_3_) + { + super(p_i46393_1_, p_i46393_3_); + this.ignoreSimilarity = p_i46393_2_; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if (this == Blocks.glass || this == Blocks.stained_glass) + { + if (worldIn.getBlockState(pos.offset(side.getOpposite())) != iblockstate) + { + return true; + } + + if (block == this) + { + return false; + } + } + + return !this.ignoreSimilarity && block == this ? false : super.shouldSideBeRendered(worldIn, pos, side); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockBrewingStand.java b/src/minecraft/net/minecraft/block/BlockBrewingStand.java new file mode 100644 index 0000000..ac1800b --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockBrewingStand.java @@ -0,0 +1,216 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryHelper; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityBrewingStand; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class BlockBrewingStand extends BlockContainer +{ + public static final PropertyBool[] HAS_BOTTLE = new PropertyBool[] {PropertyBool.create("has_bottle_0"), PropertyBool.create("has_bottle_1"), PropertyBool.create("has_bottle_2")}; + + public BlockBrewingStand() + { + super(Material.iron); + this.setDefaultState(this.blockState.getBaseState().withProperty(HAS_BOTTLE[0], Boolean.valueOf(false)).withProperty(HAS_BOTTLE[1], Boolean.valueOf(false)).withProperty(HAS_BOTTLE[2], Boolean.valueOf(false))); + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal("item.brewingStand.name"); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityBrewingStand(); + } + + public boolean isFullCube() + { + return false; + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + this.setBlockBounds(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + this.setBlockBoundsForItemRender(); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityBrewingStand) + { + playerIn.displayGUIChest((TileEntityBrewingStand)tileentity); + playerIn.triggerAchievement(StatList.field_181729_M); + } + + return true; + } + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + if (stack.hasDisplayName()) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityBrewingStand) + { + ((TileEntityBrewingStand)tileentity).setName(stack.getDisplayName()); + } + } + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + double d0 = (double)((float)pos.getX() + 0.4F + rand.nextFloat() * 0.2F); + double d1 = (double)((float)pos.getY() + 0.7F + rand.nextFloat() * 0.3F); + double d2 = (double)((float)pos.getZ() + 0.4F + rand.nextFloat() * 0.2F); + worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityBrewingStand) + { + InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityBrewingStand)tileentity); + } + + super.breakBlock(worldIn, pos, state); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.brewing_stand; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.brewing_stand; + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World worldIn, BlockPos pos) + { + return Container.calcRedstone(worldIn.getTileEntity(pos)); + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + IBlockState iblockstate = this.getDefaultState(); + + for (int i = 0; i < 3; ++i) + { + iblockstate = iblockstate.withProperty(HAS_BOTTLE[i], Boolean.valueOf((meta & 1 << i) > 0)); + } + + return iblockstate; + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + + for (int j = 0; j < 3; ++j) + { + if (((Boolean)state.getValue(HAS_BOTTLE[j])).booleanValue()) + { + i |= 1 << j; + } + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {HAS_BOTTLE[0], HAS_BOTTLE[1], HAS_BOTTLE[2]}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockBush.java b/src/minecraft/net/minecraft/block/BlockBush.java new file mode 100644 index 0000000..4ff4f92 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockBush.java @@ -0,0 +1,98 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; + +public class BlockBush extends Block +{ + protected BlockBush() + { + this(Material.plants); + } + + protected BlockBush(Material materialIn) + { + this(materialIn, materialIn.getMaterialMapColor()); + } + + protected BlockBush(Material p_i46452_1_, MapColor p_i46452_2_) + { + super(p_i46452_1_, p_i46452_2_); + this.setTickRandomly(true); + float f = 0.2F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3.0F, 0.5F + f); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); + } + + /** + * is the block grass, dirt or farmland + */ + protected boolean canPlaceBlockOn(Block ground) + { + return ground == Blocks.grass || ground == Blocks.dirt || ground == Blocks.farmland; + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + this.checkAndDropBlock(worldIn, pos, state); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + this.checkAndDropBlock(worldIn, pos, state); + } + + protected void checkAndDropBlock(World worldIn, BlockPos pos, IBlockState state) + { + if (!this.canBlockStay(worldIn, pos, state)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockState(pos, Blocks.air.getDefaultState(), 3); + } + } + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { + return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockButton.java b/src/minecraft/net/minecraft/block/BlockButton.java new file mode 100644 index 0000000..b0aef2c --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockButton.java @@ -0,0 +1,386 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public abstract class BlockButton extends Block +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing"); + public static final PropertyBool POWERED = PropertyBool.create("powered"); + private final boolean wooden; + + protected BlockButton(boolean wooden) + { + super(Material.circuits); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(POWERED, Boolean.valueOf(false))); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabRedstone); + this.wooden = wooden; + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return this.wooden ? 30 : 20; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Check whether this Block can be placed on the given side + */ + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { + return func_181088_a(worldIn, pos, side.getOpposite()); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + if (func_181088_a(worldIn, pos, enumfacing)) + { + return true; + } + } + + return false; + } + + protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_) + { + BlockPos blockpos = p_181088_1_.offset(p_181088_2_); + return p_181088_2_ == EnumFacing.DOWN ? World.doesBlockHaveSolidTopSurface(p_181088_0_, blockpos) : p_181088_0_.getBlockState(blockpos).getBlock().isNormalCube(); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return func_181088_a(worldIn, pos, facing.getOpposite()) ? this.getDefaultState().withProperty(FACING, facing).withProperty(POWERED, Boolean.valueOf(false)) : this.getDefaultState().withProperty(FACING, EnumFacing.DOWN).withProperty(POWERED, Boolean.valueOf(false)); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (this.checkForDrop(worldIn, pos, state) && !func_181088_a(worldIn, pos, ((EnumFacing)state.getValue(FACING)).getOpposite())) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + } + + private boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state) + { + if (this.canPlaceBlockAt(worldIn, pos)) + { + return true; + } + else + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + return false; + } + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + this.updateBlockBounds(worldIn.getBlockState(pos)); + } + + private void updateBlockBounds(IBlockState state) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + boolean flag = ((Boolean)state.getValue(POWERED)).booleanValue(); + float f = 0.25F; + float f1 = 0.375F; + float f2 = (float)(flag ? 1 : 2) / 16.0F; + float f3 = 0.125F; + float f4 = 0.1875F; + + switch (enumfacing) + { + case EAST: + this.setBlockBounds(0.0F, 0.375F, 0.3125F, f2, 0.625F, 0.6875F); + break; + + case WEST: + this.setBlockBounds(1.0F - f2, 0.375F, 0.3125F, 1.0F, 0.625F, 0.6875F); + break; + + case SOUTH: + this.setBlockBounds(0.3125F, 0.375F, 0.0F, 0.6875F, 0.625F, f2); + break; + + case NORTH: + this.setBlockBounds(0.3125F, 0.375F, 1.0F - f2, 0.6875F, 0.625F, 1.0F); + break; + + case UP: + this.setBlockBounds(0.3125F, 0.0F, 0.375F, 0.6875F, 0.0F + f2, 0.625F); + break; + + case DOWN: + this.setBlockBounds(0.3125F, 1.0F - f2, 0.375F, 0.6875F, 1.0F, 0.625F); + } + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + return true; + } + else + { + worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(true)), 3); + worldIn.markBlockRangeForRenderUpdate(pos, pos); + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.6F); + this.notifyNeighbors(worldIn, pos, (EnumFacing)state.getValue(FACING)); + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + return true; + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + this.notifyNeighbors(worldIn, pos, (EnumFacing)state.getValue(FACING)); + } + + super.breakBlock(worldIn, pos, state); + } + + public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return ((Boolean)state.getValue(POWERED)).booleanValue() ? 15 : 0; + } + + public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return !((Boolean)state.getValue(POWERED)).booleanValue() ? 0 : (state.getValue(FACING) == side ? 15 : 0); + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) + */ + public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random) + { + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!worldIn.isRemote) + { + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + if (this.wooden) + { + this.checkForArrows(worldIn, pos, state); + } + else + { + worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(false))); + this.notifyNeighbors(worldIn, pos, (EnumFacing)state.getValue(FACING)); + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.5F); + worldIn.markBlockRangeForRenderUpdate(pos, pos); + } + } + } + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + float f = 0.1875F; + float f1 = 0.125F; + float f2 = 0.125F; + this.setBlockBounds(0.5F - f, 0.5F - f1, 0.5F - f2, 0.5F + f, 0.5F + f1, 0.5F + f2); + } + + /** + * Called When an Entity Collided with the Block + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + if (!worldIn.isRemote) + { + if (this.wooden) + { + if (!((Boolean)state.getValue(POWERED)).booleanValue()) + { + this.checkForArrows(worldIn, pos, state); + } + } + } + } + + private void checkForArrows(World worldIn, BlockPos pos, IBlockState state) + { + this.updateBlockBounds(state); + List list = worldIn.getEntitiesWithinAABB(EntityArrow.class, new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ)); + boolean flag = !list.isEmpty(); + boolean flag1 = ((Boolean)state.getValue(POWERED)).booleanValue(); + + if (flag && !flag1) + { + worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(true))); + this.notifyNeighbors(worldIn, pos, (EnumFacing)state.getValue(FACING)); + worldIn.markBlockRangeForRenderUpdate(pos, pos); + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.6F); + } + + if (!flag && flag1) + { + worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(false))); + this.notifyNeighbors(worldIn, pos, (EnumFacing)state.getValue(FACING)); + worldIn.markBlockRangeForRenderUpdate(pos, pos); + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.5F); + } + + if (flag) + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + } + } + + private void notifyNeighbors(World worldIn, BlockPos pos, EnumFacing facing) + { + worldIn.notifyNeighborsOfStateChange(pos, this); + worldIn.notifyNeighborsOfStateChange(pos.offset(facing.getOpposite()), this); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + EnumFacing enumfacing; + + switch (meta & 7) + { + case 0: + enumfacing = EnumFacing.DOWN; + break; + + case 1: + enumfacing = EnumFacing.EAST; + break; + + case 2: + enumfacing = EnumFacing.WEST; + break; + + case 3: + enumfacing = EnumFacing.SOUTH; + break; + + case 4: + enumfacing = EnumFacing.NORTH; + break; + + case 5: + default: + enumfacing = EnumFacing.UP; + } + + return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i; + + switch ((EnumFacing)state.getValue(FACING)) + { + case EAST: + i = 1; + break; + + case WEST: + i = 2; + break; + + case SOUTH: + i = 3; + break; + + case NORTH: + i = 4; + break; + + case UP: + default: + i = 5; + break; + + case DOWN: + i = 0; + } + + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, POWERED}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockButtonStone.java b/src/minecraft/net/minecraft/block/BlockButtonStone.java new file mode 100644 index 0000000..36e566b --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockButtonStone.java @@ -0,0 +1,9 @@ +package net.minecraft.block; + +public class BlockButtonStone extends BlockButton +{ + protected BlockButtonStone() + { + super(false); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockButtonWood.java b/src/minecraft/net/minecraft/block/BlockButtonWood.java new file mode 100644 index 0000000..7ba8894 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockButtonWood.java @@ -0,0 +1,9 @@ +package net.minecraft.block; + +public class BlockButtonWood extends BlockButton +{ + protected BlockButtonWood() + { + super(true); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockCactus.java b/src/minecraft/net/minecraft/block/BlockCactus.java new file mode 100644 index 0000000..2401b46 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockCactus.java @@ -0,0 +1,151 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; + +public class BlockCactus extends Block +{ + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); + + protected BlockCactus() + { + super(Material.cactus); + this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0))); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + BlockPos blockpos = pos.up(); + + if (worldIn.isAirBlock(blockpos)) + { + int i; + + for (i = 1; worldIn.getBlockState(pos.down(i)).getBlock() == this; ++i) + { + ; + } + + if (i < 3) + { + int j = ((Integer)state.getValue(AGE)).intValue(); + + if (j == 15) + { + worldIn.setBlockState(blockpos, this.getDefaultState()); + IBlockState iblockstate = state.withProperty(AGE, Integer.valueOf(0)); + worldIn.setBlockState(pos, iblockstate, 4); + this.onNeighborBlockChange(worldIn, blockpos, iblockstate, this); + } + else + { + worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(j + 1)), 4); + } + } + } + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + float f = 0.0625F; + return new AxisAlignedBB((double)((float)pos.getX() + f), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)((float)(pos.getY() + 1) - f), (double)((float)(pos.getZ() + 1) - f)); + } + + public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) + { + float f = 0.0625F; + return new AxisAlignedBB((double)((float)pos.getX() + f), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)(pos.getY() + 1), (double)((float)(pos.getZ() + 1) - f)); + } + + public boolean isFullCube() + { + return false; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return super.canPlaceBlockAt(worldIn, pos) ? this.canBlockStay(worldIn, pos) : false; + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!this.canBlockStay(worldIn, pos)) + { + worldIn.destroyBlock(pos, true); + } + } + + public boolean canBlockStay(World worldIn, BlockPos pos) + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (worldIn.getBlockState(pos.offset((EnumFacing) enumfacing)).getBlock().getMaterial().isSolid()) + { + return false; + } + } + + Block block = worldIn.getBlockState(pos.down()).getBlock(); + return block == Blocks.cactus || block == Blocks.sand; + } + + /** + * Called When an Entity Collided with the Block + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + entityIn.attackEntityFrom(DamageSource.cactus, 1.0F); + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(AGE)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {AGE}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockCake.java b/src/minecraft/net/minecraft/block/BlockCake.java new file mode 100644 index 0000000..35628a6 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockCake.java @@ -0,0 +1,182 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.stats.StatList; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockCake extends Block +{ + public static final PropertyInteger BITES = PropertyInteger.create("bites", 0, 6); + + protected BlockCake() + { + super(Material.cake); + this.setDefaultState(this.blockState.getBaseState().withProperty(BITES, Integer.valueOf(0))); + this.setTickRandomly(true); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + float f = 0.0625F; + float f1 = (float)(1 + ((Integer)worldIn.getBlockState(pos).getValue(BITES)).intValue() * 2) / 16.0F; + float f2 = 0.5F; + this.setBlockBounds(f1, 0.0F, f, 1.0F - f, f2, 1.0F - f); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + float f = 0.0625F; + float f1 = 0.5F; + this.setBlockBounds(f, 0.0F, f, 1.0F - f, f1, 1.0F - f); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + float f = 0.0625F; + float f1 = (float)(1 + ((Integer)state.getValue(BITES)).intValue() * 2) / 16.0F; + float f2 = 0.5F; + return new AxisAlignedBB((double)((float)pos.getX() + f1), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)((float)pos.getY() + f2), (double)((float)(pos.getZ() + 1) - f)); + } + + public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) + { + return this.getCollisionBoundingBox(worldIn, pos, worldIn.getBlockState(pos)); + } + + public boolean isFullCube() + { + return false; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + this.eatCake(worldIn, pos, state, playerIn); + return true; + } + + public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) + { + this.eatCake(worldIn, pos, worldIn.getBlockState(pos), playerIn); + } + + private void eatCake(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + if (player.canEat(false)) + { + player.triggerAchievement(StatList.field_181724_H); + player.getFoodStats().addStats(2, 0.1F); + int i = ((Integer)state.getValue(BITES)).intValue(); + + if (i < 6) + { + worldIn.setBlockState(pos, state.withProperty(BITES, Integer.valueOf(i + 1)), 3); + } + else + { + worldIn.setBlockToAir(pos); + } + } + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return super.canPlaceBlockAt(worldIn, pos) ? this.canBlockStay(worldIn, pos) : false; + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!this.canBlockStay(worldIn, pos)) + { + worldIn.setBlockToAir(pos); + } + } + + private boolean canBlockStay(World worldIn, BlockPos pos) + { + return worldIn.getBlockState(pos.down()).getBlock().getMaterial().isSolid(); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return null; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.cake; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(BITES, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(BITES)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {BITES}); + } + + public int getComparatorInputOverride(World worldIn, BlockPos pos) + { + return (7 - ((Integer)worldIn.getBlockState(pos).getValue(BITES)).intValue()) * 2; + } + + public boolean hasComparatorInputOverride() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockCarpet.java b/src/minecraft/net/minecraft/block/BlockCarpet.java new file mode 100644 index 0000000..0de7b83 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockCarpet.java @@ -0,0 +1,151 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockCarpet extends Block +{ + public static final PropertyEnum COLOR = PropertyEnum.create("color", EnumDyeColor.class); + + protected BlockCarpet() + { + super(Material.carpet); + this.setDefaultState(this.blockState.getBaseState().withProperty(COLOR, EnumDyeColor.WHITE)); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabDecorations); + this.setBlockBoundsFromMeta(0); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return ((EnumDyeColor)state.getValue(COLOR)).getMapColor(); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBoundsFromMeta(0); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + this.setBlockBoundsFromMeta(0); + } + + protected void setBlockBoundsFromMeta(int meta) + { + int i = 0; + float f = (float)(1 * (1 + i)) / 16.0F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return super.canPlaceBlockAt(worldIn, pos) && this.canBlockStay(worldIn, pos); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + this.checkForDrop(worldIn, pos, state); + } + + private boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state) + { + if (!this.canBlockStay(worldIn, pos)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + return false; + } + else + { + return true; + } + } + + private boolean canBlockStay(World worldIn, BlockPos pos) + { + return !worldIn.isAirBlock(pos.down()); + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return side == EnumFacing.UP ? true : super.shouldSideBeRendered(worldIn, pos, side); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((EnumDyeColor)state.getValue(COLOR)).getMetadata(); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (int i = 0; i < 16; ++i) + { + list.add(new ItemStack(itemIn, 1, i)); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(COLOR, EnumDyeColor.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((EnumDyeColor)state.getValue(COLOR)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {COLOR}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockCarrot.java b/src/minecraft/net/minecraft/block/BlockCarrot.java new file mode 100644 index 0000000..2d8ab48 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockCarrot.java @@ -0,0 +1,17 @@ +package net.minecraft.block; + +import net.minecraft.init.Items; +import net.minecraft.item.Item; + +public class BlockCarrot extends BlockCrops +{ + protected Item getSeed() + { + return Items.carrot; + } + + protected Item getCrop() + { + return Items.carrot; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockCauldron.java b/src/minecraft/net/minecraft/block/BlockCauldron.java new file mode 100644 index 0000000..86a362f --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockCauldron.java @@ -0,0 +1,283 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemBanner; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntityBanner; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class BlockCauldron extends Block +{ + public static final PropertyInteger LEVEL = PropertyInteger.create("level", 0, 3); + + public BlockCauldron() + { + super(Material.iron, MapColor.stoneColor); + this.setDefaultState(this.blockState.getBaseState().withProperty(LEVEL, Integer.valueOf(0))); + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + float f = 0.125F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + this.setBlockBoundsForItemRender(); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Called When an Entity Collided with the Block + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + int i = ((Integer)state.getValue(LEVEL)).intValue(); + float f = (float)pos.getY() + (6.0F + (float)(3 * i)) / 16.0F; + + if (!worldIn.isRemote && entityIn.isBurning() && i > 0 && entityIn.getEntityBoundingBox().minY <= (double)f) + { + entityIn.extinguish(); + this.setWaterLevel(worldIn, pos, state, i - 1); + } + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + ItemStack itemstack = playerIn.inventory.getCurrentItem(); + + if (itemstack == null) + { + return true; + } + else + { + int i = ((Integer)state.getValue(LEVEL)).intValue(); + Item item = itemstack.getItem(); + + if (item == Items.water_bucket) + { + if (i < 3) + { + if (!playerIn.capabilities.isCreativeMode) + { + playerIn.inventory.setInventorySlotContents(playerIn.inventory.currentItem, new ItemStack(Items.bucket)); + } + + playerIn.triggerAchievement(StatList.field_181725_I); + this.setWaterLevel(worldIn, pos, state, 3); + } + + return true; + } + else if (item == Items.glass_bottle) + { + if (i > 0) + { + if (!playerIn.capabilities.isCreativeMode) + { + ItemStack itemstack2 = new ItemStack(Items.potionitem, 1, 0); + + if (!playerIn.inventory.addItemStackToInventory(itemstack2)) + { + worldIn.spawnEntityInWorld(new EntityItem(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.5D, (double)pos.getZ() + 0.5D, itemstack2)); + } + else if (playerIn instanceof EntityPlayerMP) + { + ((EntityPlayerMP)playerIn).sendContainerToPlayer(playerIn.inventoryContainer); + } + + playerIn.triggerAchievement(StatList.field_181726_J); + --itemstack.stackSize; + + if (itemstack.stackSize <= 0) + { + playerIn.inventory.setInventorySlotContents(playerIn.inventory.currentItem, (ItemStack)null); + } + } + + this.setWaterLevel(worldIn, pos, state, i - 1); + } + + return true; + } + else + { + if (i > 0 && item instanceof ItemArmor) + { + ItemArmor itemarmor = (ItemArmor)item; + + if (itemarmor.getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER && itemarmor.hasColor(itemstack)) + { + itemarmor.removeColor(itemstack); + this.setWaterLevel(worldIn, pos, state, i - 1); + playerIn.triggerAchievement(StatList.field_181727_K); + return true; + } + } + + if (i > 0 && item instanceof ItemBanner && TileEntityBanner.getPatterns(itemstack) > 0) + { + ItemStack itemstack1 = itemstack.copy(); + itemstack1.stackSize = 1; + TileEntityBanner.removeBannerData(itemstack1); + + if (itemstack.stackSize <= 1 && !playerIn.capabilities.isCreativeMode) + { + playerIn.inventory.setInventorySlotContents(playerIn.inventory.currentItem, itemstack1); + } + else + { + if (!playerIn.inventory.addItemStackToInventory(itemstack1)) + { + worldIn.spawnEntityInWorld(new EntityItem(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.5D, (double)pos.getZ() + 0.5D, itemstack1)); + } + else if (playerIn instanceof EntityPlayerMP) + { + ((EntityPlayerMP)playerIn).sendContainerToPlayer(playerIn.inventoryContainer); + } + + playerIn.triggerAchievement(StatList.field_181728_L); + + if (!playerIn.capabilities.isCreativeMode) + { + --itemstack.stackSize; + } + } + + if (!playerIn.capabilities.isCreativeMode) + { + this.setWaterLevel(worldIn, pos, state, i - 1); + } + + return true; + } + else + { + return false; + } + } + } + } + } + + public void setWaterLevel(World worldIn, BlockPos pos, IBlockState state, int level) + { + worldIn.setBlockState(pos, state.withProperty(LEVEL, Integer.valueOf(MathHelper.clamp_int(level, 0, 3))), 2); + worldIn.updateComparatorOutputLevel(pos, this); + } + + /** + * Called similar to random ticks, but only when it is raining. + */ + public void fillWithRain(World worldIn, BlockPos pos) + { + if (worldIn.rand.nextInt(20) == 1) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (((Integer)iblockstate.getValue(LEVEL)).intValue() < 3) + { + worldIn.setBlockState(pos, iblockstate.cycleProperty(LEVEL), 2); + } + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.cauldron; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.cauldron; + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World worldIn, BlockPos pos) + { + return ((Integer)worldIn.getBlockState(pos).getValue(LEVEL)).intValue(); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(LEVEL, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(LEVEL)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {LEVEL}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockChest.java b/src/minecraft/net/minecraft/block/BlockChest.java new file mode 100644 index 0000000..02572e9 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockChest.java @@ -0,0 +1,609 @@ +package net.minecraft.block; + +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryHelper; +import net.minecraft.inventory.InventoryLargeChest; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.ILockableContainer; +import net.minecraft.world.World; + +public class BlockChest extends BlockContainer +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + + /** 0 : Normal chest, 1 : Trapped chest */ + public final int chestType; + + protected BlockChest(int type) + { + super(Material.wood); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); + this.chestType = type; + this.setCreativeTab(CreativeTabs.tabDecorations); + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 2; + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + if (worldIn.getBlockState(pos.north()).getBlock() == this) + { + this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F); + } + else if (worldIn.getBlockState(pos.south()).getBlock() == this) + { + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F); + } + else if (worldIn.getBlockState(pos.west()).getBlock() == this) + { + this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + } + else if (worldIn.getBlockState(pos.east()).getBlock() == this) + { + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F); + } + else + { + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + } + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + this.checkForSurroundingChests(worldIn, pos, state); + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + BlockPos blockpos = pos.offset((EnumFacing) enumfacing); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock() == this) + { + this.checkForSurroundingChests(worldIn, blockpos, iblockstate); + } + } + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()); + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + EnumFacing enumfacing = EnumFacing.getHorizontal(MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3).getOpposite(); + state = state.withProperty(FACING, enumfacing); + BlockPos blockpos = pos.north(); + BlockPos blockpos1 = pos.south(); + BlockPos blockpos2 = pos.west(); + BlockPos blockpos3 = pos.east(); + boolean flag = this == worldIn.getBlockState(blockpos).getBlock(); + boolean flag1 = this == worldIn.getBlockState(blockpos1).getBlock(); + boolean flag2 = this == worldIn.getBlockState(blockpos2).getBlock(); + boolean flag3 = this == worldIn.getBlockState(blockpos3).getBlock(); + + if (!flag && !flag1 && !flag2 && !flag3) + { + worldIn.setBlockState(pos, state, 3); + } + else if (enumfacing.getAxis() != EnumFacing.Axis.X || !flag && !flag1) + { + if (enumfacing.getAxis() == EnumFacing.Axis.Z && (flag2 || flag3)) + { + if (flag2) + { + worldIn.setBlockState(blockpos2, state, 3); + } + else + { + worldIn.setBlockState(blockpos3, state, 3); + } + + worldIn.setBlockState(pos, state, 3); + } + } + else + { + if (flag) + { + worldIn.setBlockState(blockpos, state, 3); + } + else + { + worldIn.setBlockState(blockpos1, state, 3); + } + + worldIn.setBlockState(pos, state, 3); + } + + if (stack.hasDisplayName()) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityChest) + { + ((TileEntityChest)tileentity).setCustomName(stack.getDisplayName()); + } + } + } + + public IBlockState checkForSurroundingChests(World worldIn, BlockPos pos, IBlockState state) + { + if (worldIn.isRemote) + { + return state; + } + else + { + IBlockState iblockstate = worldIn.getBlockState(pos.north()); + IBlockState iblockstate1 = worldIn.getBlockState(pos.south()); + IBlockState iblockstate2 = worldIn.getBlockState(pos.west()); + IBlockState iblockstate3 = worldIn.getBlockState(pos.east()); + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + Block block = iblockstate.getBlock(); + Block block1 = iblockstate1.getBlock(); + Block block2 = iblockstate2.getBlock(); + Block block3 = iblockstate3.getBlock(); + + if (block != this && block1 != this) + { + boolean flag = block.isFullBlock(); + boolean flag1 = block1.isFullBlock(); + + if (block2 == this || block3 == this) + { + BlockPos blockpos1 = block2 == this ? pos.west() : pos.east(); + IBlockState iblockstate6 = worldIn.getBlockState(blockpos1.north()); + IBlockState iblockstate7 = worldIn.getBlockState(blockpos1.south()); + enumfacing = EnumFacing.SOUTH; + EnumFacing enumfacing2; + + if (block2 == this) + { + enumfacing2 = (EnumFacing)iblockstate2.getValue(FACING); + } + else + { + enumfacing2 = (EnumFacing)iblockstate3.getValue(FACING); + } + + if (enumfacing2 == EnumFacing.NORTH) + { + enumfacing = EnumFacing.NORTH; + } + + Block block6 = iblockstate6.getBlock(); + Block block7 = iblockstate7.getBlock(); + + if ((flag || block6.isFullBlock()) && !flag1 && !block7.isFullBlock()) + { + enumfacing = EnumFacing.SOUTH; + } + + if ((flag1 || block7.isFullBlock()) && !flag && !block6.isFullBlock()) + { + enumfacing = EnumFacing.NORTH; + } + } + } + else + { + BlockPos blockpos = block == this ? pos.north() : pos.south(); + IBlockState iblockstate4 = worldIn.getBlockState(blockpos.west()); + IBlockState iblockstate5 = worldIn.getBlockState(blockpos.east()); + enumfacing = EnumFacing.EAST; + EnumFacing enumfacing1; + + if (block == this) + { + enumfacing1 = (EnumFacing)iblockstate.getValue(FACING); + } + else + { + enumfacing1 = (EnumFacing)iblockstate1.getValue(FACING); + } + + if (enumfacing1 == EnumFacing.WEST) + { + enumfacing = EnumFacing.WEST; + } + + Block block4 = iblockstate4.getBlock(); + Block block5 = iblockstate5.getBlock(); + + if ((block2.isFullBlock() || block4.isFullBlock()) && !block3.isFullBlock() && !block5.isFullBlock()) + { + enumfacing = EnumFacing.EAST; + } + + if ((block3.isFullBlock() || block5.isFullBlock()) && !block2.isFullBlock() && !block4.isFullBlock()) + { + enumfacing = EnumFacing.WEST; + } + } + + state = state.withProperty(FACING, enumfacing); + worldIn.setBlockState(pos, state, 3); + return state; + } + } + + public IBlockState correctFacing(World worldIn, BlockPos pos, IBlockState state) + { + EnumFacing enumfacing = null; + + for (Object enumfacing1 : EnumFacing.Plane.HORIZONTAL) + { + IBlockState iblockstate = worldIn.getBlockState(pos.offset((EnumFacing) enumfacing1)); + + if (iblockstate.getBlock() == this) + { + return state; + } + + if (iblockstate.getBlock().isFullBlock()) + { + if (enumfacing != null) + { + enumfacing = null; + break; + } + + enumfacing = (EnumFacing) enumfacing1; + } + } + + if (enumfacing != null) + { + return state.withProperty(FACING, enumfacing.getOpposite()); + } + else + { + EnumFacing enumfacing2 = (EnumFacing)state.getValue(FACING); + + if (worldIn.getBlockState(pos.offset(enumfacing2)).getBlock().isFullBlock()) + { + enumfacing2 = enumfacing2.getOpposite(); + } + + if (worldIn.getBlockState(pos.offset(enumfacing2)).getBlock().isFullBlock()) + { + enumfacing2 = enumfacing2.rotateY(); + } + + if (worldIn.getBlockState(pos.offset(enumfacing2)).getBlock().isFullBlock()) + { + enumfacing2 = enumfacing2.getOpposite(); + } + + return state.withProperty(FACING, enumfacing2); + } + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + int i = 0; + BlockPos blockpos = pos.west(); + BlockPos blockpos1 = pos.east(); + BlockPos blockpos2 = pos.north(); + BlockPos blockpos3 = pos.south(); + + if (worldIn.getBlockState(blockpos).getBlock() == this) + { + if (this.isDoubleChest(worldIn, blockpos)) + { + return false; + } + + ++i; + } + + if (worldIn.getBlockState(blockpos1).getBlock() == this) + { + if (this.isDoubleChest(worldIn, blockpos1)) + { + return false; + } + + ++i; + } + + if (worldIn.getBlockState(blockpos2).getBlock() == this) + { + if (this.isDoubleChest(worldIn, blockpos2)) + { + return false; + } + + ++i; + } + + if (worldIn.getBlockState(blockpos3).getBlock() == this) + { + if (this.isDoubleChest(worldIn, blockpos3)) + { + return false; + } + + ++i; + } + + return i <= 1; + } + + private boolean isDoubleChest(World worldIn, BlockPos pos) + { + if (worldIn.getBlockState(pos).getBlock() != this) + { + return false; + } + else + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (worldIn.getBlockState(pos.offset((EnumFacing) enumfacing)).getBlock() == this) + { + return true; + } + } + + return false; + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityChest) + { + tileentity.updateContainingBlockInfo(); + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof IInventory) + { + InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileentity); + worldIn.updateComparatorOutputLevel(pos, this); + } + + super.breakBlock(worldIn, pos, state); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + ILockableContainer ilockablecontainer = this.getLockableContainer(worldIn, pos); + + if (ilockablecontainer != null) + { + playerIn.displayGUIChest(ilockablecontainer); + + if (this.chestType == 0) + { + playerIn.triggerAchievement(StatList.field_181723_aa); + } + else if (this.chestType == 1) + { + playerIn.triggerAchievement(StatList.field_181737_U); + } + } + + return true; + } + } + + public ILockableContainer getLockableContainer(World worldIn, BlockPos pos) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (!(tileentity instanceof TileEntityChest)) + { + return null; + } + else + { + ILockableContainer ilockablecontainer = (TileEntityChest)tileentity; + + if (this.isBlocked(worldIn, pos)) + { + return null; + } + else + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + BlockPos blockpos = pos.offset((EnumFacing) enumfacing); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block == this) + { + if (this.isBlocked(worldIn, blockpos)) + { + return null; + } + + TileEntity tileentity1 = worldIn.getTileEntity(blockpos); + + if (tileentity1 instanceof TileEntityChest) + { + if (enumfacing != EnumFacing.WEST && enumfacing != EnumFacing.NORTH) + { + ilockablecontainer = new InventoryLargeChest("container.chestDouble", ilockablecontainer, (TileEntityChest)tileentity1); + } + else + { + ilockablecontainer = new InventoryLargeChest("container.chestDouble", (TileEntityChest)tileentity1, ilockablecontainer); + } + } + } + } + + return ilockablecontainer; + } + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityChest(); + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return this.chestType == 1; + } + + public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + if (!this.canProvidePower()) + { + return 0; + } + else + { + int i = 0; + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityChest) + { + i = ((TileEntityChest)tileentity).numPlayersUsing; + } + + return MathHelper.clamp_int(i, 0, 15); + } + } + + public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return side == EnumFacing.UP ? this.getWeakPower(worldIn, pos, state, side) : 0; + } + + private boolean isBlocked(World worldIn, BlockPos pos) + { + return this.isBelowSolidBlock(worldIn, pos) || this.isOcelotSittingOnChest(worldIn, pos); + } + + private boolean isBelowSolidBlock(World worldIn, BlockPos pos) + { + return worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); + } + + private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) + { + for (Entity entity : worldIn.getEntitiesWithinAABB(EntityOcelot.class, new AxisAlignedBB((double)pos.getX(), (double)(pos.getY() + 1), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 2), (double)(pos.getZ() + 1)))) + { + EntityOcelot entityocelot = (EntityOcelot)entity; + + if (entityocelot.isSitting()) + { + return true; + } + } + + return false; + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World worldIn, BlockPos pos) + { + return Container.calcRedstoneFromInventory(this.getLockableContainer(worldIn, pos)); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + EnumFacing enumfacing = EnumFacing.getFront(meta); + + if (enumfacing.getAxis() == EnumFacing.Axis.Y) + { + enumfacing = EnumFacing.NORTH; + } + + return this.getDefaultState().withProperty(FACING, enumfacing); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((EnumFacing)state.getValue(FACING)).getIndex(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockClay.java b/src/minecraft/net/minecraft/block/BlockClay.java new file mode 100644 index 0000000..3501a8c --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockClay.java @@ -0,0 +1,33 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; +import net.minecraft.item.Item; + +public class BlockClay extends Block +{ + public BlockClay() + { + super(Material.clay); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.clay_ball; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 4; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockCocoa.java b/src/minecraft/net/minecraft/block/BlockCocoa.java new file mode 100644 index 0000000..bfbda63 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockCocoa.java @@ -0,0 +1,226 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockCocoa extends BlockDirectional implements IGrowable +{ + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 2); + + public BlockCocoa() + { + super(Material.plants); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(AGE, Integer.valueOf(0))); + this.setTickRandomly(true); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!this.canBlockStay(worldIn, pos, state)) + { + this.dropBlock(worldIn, pos, state); + } + else if (worldIn.rand.nextInt(5) == 0) + { + int i = ((Integer)state.getValue(AGE)).intValue(); + + if (i < 2) + { + worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i + 1)), 2); + } + } + } + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { + pos = pos.offset((EnumFacing)state.getValue(FACING)); + IBlockState iblockstate = worldIn.getBlockState(pos); + return iblockstate.getBlock() == Blocks.log && iblockstate.getValue(BlockPlanks.VARIANT) == BlockPlanks.EnumType.JUNGLE; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getCollisionBoundingBox(worldIn, pos, state); + } + + public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getSelectedBoundingBox(worldIn, pos); + } + + @SuppressWarnings("incomplete-switch") + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(FACING); + int i = ((Integer)iblockstate.getValue(AGE)).intValue(); + int j = 4 + i * 2; + int k = 5 + i * 2; + float f = (float)j / 2.0F; + + switch (enumfacing) + { + case SOUTH: + this.setBlockBounds((8.0F - f) / 16.0F, (12.0F - (float)k) / 16.0F, (15.0F - (float)j) / 16.0F, (8.0F + f) / 16.0F, 0.75F, 0.9375F); + break; + + case NORTH: + this.setBlockBounds((8.0F - f) / 16.0F, (12.0F - (float)k) / 16.0F, 0.0625F, (8.0F + f) / 16.0F, 0.75F, (1.0F + (float)j) / 16.0F); + break; + + case WEST: + this.setBlockBounds(0.0625F, (12.0F - (float)k) / 16.0F, (8.0F - f) / 16.0F, (1.0F + (float)j) / 16.0F, 0.75F, (8.0F + f) / 16.0F); + break; + + case EAST: + this.setBlockBounds((15.0F - (float)j) / 16.0F, (12.0F - (float)k) / 16.0F, (8.0F - f) / 16.0F, 0.9375F, 0.75F, (8.0F + f) / 16.0F); + } + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + EnumFacing enumfacing = EnumFacing.fromAngle((double)placer.rotationYaw); + worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + if (!facing.getAxis().isHorizontal()) + { + facing = EnumFacing.NORTH; + } + + return this.getDefaultState().withProperty(FACING, facing.getOpposite()).withProperty(AGE, Integer.valueOf(0)); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!this.canBlockStay(worldIn, pos, state)) + { + this.dropBlock(worldIn, pos, state); + } + } + + private void dropBlock(World worldIn, BlockPos pos, IBlockState state) + { + worldIn.setBlockState(pos, Blocks.air.getDefaultState(), 3); + this.dropBlockAsItem(worldIn, pos, state, 0); + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + int i = ((Integer)state.getValue(AGE)).intValue(); + int j = 1; + + if (i >= 2) + { + j = 3; + } + + for (int k = 0; k < j; ++k) + { + spawnAsEntity(worldIn, pos, new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage())); + } + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.dye; + } + + public int getDamageValue(World worldIn, BlockPos pos) + { + return EnumDyeColor.BROWN.getDyeDamage(); + } + + /** + * Whether this IGrowable can grow + */ + public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) + { + return ((Integer)state.getValue(AGE)).intValue() < 2; + } + + public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + return true; + } + + public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(((Integer)state.getValue(AGE)).intValue() + 1)), 2); + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)).withProperty(AGE, Integer.valueOf((meta & 15) >> 2)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); + i = i | ((Integer)state.getValue(AGE)).intValue() << 2; + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, AGE}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockColored.java b/src/minecraft/net/minecraft/block/BlockColored.java new file mode 100644 index 0000000..ca3db7c --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockColored.java @@ -0,0 +1,74 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class BlockColored extends Block +{ + public static final PropertyEnum COLOR = PropertyEnum.create("color", EnumDyeColor.class); + + public BlockColored(Material materialIn) + { + super(materialIn); + this.setDefaultState(this.blockState.getBaseState().withProperty(COLOR, EnumDyeColor.WHITE)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((EnumDyeColor)state.getValue(COLOR)).getMetadata(); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (EnumDyeColor enumdyecolor : EnumDyeColor.values()) + { + list.add(new ItemStack(itemIn, 1, enumdyecolor.getMetadata())); + } + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return ((EnumDyeColor)state.getValue(COLOR)).getMapColor(); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(COLOR, EnumDyeColor.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((EnumDyeColor)state.getValue(COLOR)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {COLOR}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockCommandBlock.java b/src/minecraft/net/minecraft/block/BlockCommandBlock.java new file mode 100644 index 0000000..0a5b0bb --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockCommandBlock.java @@ -0,0 +1,171 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.command.server.CommandBlockLogic; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityCommandBlock; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class BlockCommandBlock extends BlockContainer +{ + public static final PropertyBool TRIGGERED = PropertyBool.create("triggered"); + + public BlockCommandBlock() + { + super(Material.iron, MapColor.adobeColor); + this.setDefaultState(this.blockState.getBaseState().withProperty(TRIGGERED, Boolean.valueOf(false))); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityCommandBlock(); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!worldIn.isRemote) + { + boolean flag = worldIn.isBlockPowered(pos); + boolean flag1 = ((Boolean)state.getValue(TRIGGERED)).booleanValue(); + + if (flag && !flag1) + { + worldIn.setBlockState(pos, state.withProperty(TRIGGERED, Boolean.valueOf(true)), 4); + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + } + else if (!flag && flag1) + { + worldIn.setBlockState(pos, state.withProperty(TRIGGERED, Boolean.valueOf(false)), 4); + } + } + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityCommandBlock) + { + ((TileEntityCommandBlock)tileentity).getCommandBlockLogic().trigger(worldIn); + worldIn.updateComparatorOutputLevel(pos, this); + } + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return 1; + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + return tileentity instanceof TileEntityCommandBlock ? ((TileEntityCommandBlock)tileentity).getCommandBlockLogic().tryOpenEditCommandBlock(playerIn) : false; + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World worldIn, BlockPos pos) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + return tileentity instanceof TileEntityCommandBlock ? ((TileEntityCommandBlock)tileentity).getCommandBlockLogic().getSuccessCount() : 0; + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityCommandBlock) + { + CommandBlockLogic commandblocklogic = ((TileEntityCommandBlock)tileentity).getCommandBlockLogic(); + + if (stack.hasDisplayName()) + { + commandblocklogic.setName(stack.getDisplayName()); + } + + if (!worldIn.isRemote) + { + commandblocklogic.setTrackOutput(worldIn.getGameRules().getBoolean("sendCommandFeedback")); + } + } + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(TRIGGERED, Boolean.valueOf((meta & 1) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + + if (((Boolean)state.getValue(TRIGGERED)).booleanValue()) + { + i |= 1; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {TRIGGERED}); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(TRIGGERED, Boolean.valueOf(false)); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockCompressedPowered.java b/src/minecraft/net/minecraft/block/BlockCompressedPowered.java new file mode 100644 index 0000000..d598b0c --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockCompressedPowered.java @@ -0,0 +1,29 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; + +public class BlockCompressedPowered extends Block +{ + public BlockCompressedPowered(Material p_i46386_1_, MapColor p_i46386_2_) + { + super(p_i46386_1_, p_i46386_2_); + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return 15; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockContainer.java b/src/minecraft/net/minecraft/block/BlockContainer.java new file mode 100644 index 0000000..36da03f --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockContainer.java @@ -0,0 +1,57 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public abstract class BlockContainer extends Block implements ITileEntityProvider +{ + protected BlockContainer(Material materialIn) + { + this(materialIn, materialIn.getMaterialMapColor()); + } + + protected BlockContainer(Material p_i46402_1_, MapColor p_i46402_2_) + { + super(p_i46402_1_, p_i46402_2_); + this.isBlockContainer = true; + } + + protected boolean func_181086_a(World p_181086_1_, BlockPos p_181086_2_, EnumFacing p_181086_3_) + { + return p_181086_1_.getBlockState(p_181086_2_.offset(p_181086_3_)).getBlock().getMaterial() == Material.cactus; + } + + protected boolean func_181087_e(World p_181087_1_, BlockPos p_181087_2_) + { + return this.func_181086_a(p_181087_1_, p_181087_2_, EnumFacing.NORTH) || this.func_181086_a(p_181087_1_, p_181087_2_, EnumFacing.SOUTH) || this.func_181086_a(p_181087_1_, p_181087_2_, EnumFacing.WEST) || this.func_181086_a(p_181087_1_, p_181087_2_, EnumFacing.EAST); + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return -1; + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + super.breakBlock(worldIn, pos, state); + worldIn.removeTileEntity(pos); + } + + /** + * Called on both Client and Server when World#addBlockEvent is called + */ + public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) + { + super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam); + TileEntity tileentity = worldIn.getTileEntity(pos); + return tileentity == null ? false : tileentity.receiveClientEvent(eventID, eventParam); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockCrops.java b/src/minecraft/net/minecraft/block/BlockCrops.java new file mode 100644 index 0000000..d713795 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockCrops.java @@ -0,0 +1,220 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class BlockCrops extends BlockBush implements IGrowable +{ + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 7); + + protected BlockCrops() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0))); + this.setTickRandomly(true); + float f = 0.5F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); + this.setCreativeTab((CreativeTabs)null); + this.setHardness(0.0F); + this.setStepSound(soundTypeGrass); + this.disableStats(); + } + + /** + * is the block grass, dirt or farmland + */ + protected boolean canPlaceBlockOn(Block ground) + { + return ground == Blocks.farmland; + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + super.updateTick(worldIn, pos, state, rand); + + if (worldIn.getLightFromNeighbors(pos.up()) >= 9) + { + int i = ((Integer)state.getValue(AGE)).intValue(); + + if (i < 7) + { + float f = getGrowthChance(this, worldIn, pos); + + if (rand.nextInt((int)(25.0F / f) + 1) == 0) + { + worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i + 1)), 2); + } + } + } + } + + public void grow(World worldIn, BlockPos pos, IBlockState state) + { + int i = ((Integer)state.getValue(AGE)).intValue() + MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); + + if (i > 7) + { + i = 7; + } + + worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i)), 2); + } + + protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos) + { + float f = 1.0F; + BlockPos blockpos = pos.down(); + + for (int i = -1; i <= 1; ++i) + { + for (int j = -1; j <= 1; ++j) + { + float f1 = 0.0F; + IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j)); + + if (iblockstate.getBlock() == Blocks.farmland) + { + f1 = 1.0F; + + if (((Integer)iblockstate.getValue(BlockFarmland.MOISTURE)).intValue() > 0) + { + f1 = 3.0F; + } + } + + if (i != 0 || j != 0) + { + f1 /= 4.0F; + } + + f += f1; + } + } + + BlockPos blockpos1 = pos.north(); + BlockPos blockpos2 = pos.south(); + BlockPos blockpos3 = pos.west(); + BlockPos blockpos4 = pos.east(); + boolean flag = blockIn == worldIn.getBlockState(blockpos3).getBlock() || blockIn == worldIn.getBlockState(blockpos4).getBlock(); + boolean flag1 = blockIn == worldIn.getBlockState(blockpos1).getBlock() || blockIn == worldIn.getBlockState(blockpos2).getBlock(); + + if (flag && flag1) + { + f /= 2.0F; + } + else + { + boolean flag2 = blockIn == worldIn.getBlockState(blockpos3.north()).getBlock() || blockIn == worldIn.getBlockState(blockpos4.north()).getBlock() || blockIn == worldIn.getBlockState(blockpos4.south()).getBlock() || blockIn == worldIn.getBlockState(blockpos3.south()).getBlock(); + + if (flag2) + { + f /= 2.0F; + } + } + + return f; + } + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { + return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); + } + + protected Item getSeed() + { + return Items.wheat_seeds; + } + + protected Item getCrop() + { + return Items.wheat; + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); + + if (!worldIn.isRemote) + { + int i = ((Integer)state.getValue(AGE)).intValue(); + + if (i >= 7) + { + int j = 3 + fortune; + + for (int k = 0; k < j; ++k) + { + if (worldIn.rand.nextInt(15) <= i) + { + spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0)); + } + } + } + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return ((Integer)state.getValue(AGE)).intValue() == 7 ? this.getCrop() : this.getSeed(); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return this.getSeed(); + } + + /** + * Whether this IGrowable can grow + */ + public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) + { + return ((Integer)state.getValue(AGE)).intValue() < 7; + } + + public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + return true; + } + + public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + this.grow(worldIn, pos, state); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(AGE)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {AGE}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDaylightDetector.java b/src/minecraft/net/minecraft/block/BlockDaylightDetector.java new file mode 100644 index 0000000..6c3f969 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDaylightDetector.java @@ -0,0 +1,186 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityDaylightDetector; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockDaylightDetector extends BlockContainer +{ + public static final PropertyInteger POWER = PropertyInteger.create("power", 0, 15); + private final boolean inverted; + + public BlockDaylightDetector(boolean inverted) + { + super(Material.wood); + this.inverted = inverted; + this.setDefaultState(this.blockState.getBaseState().withProperty(POWER, Integer.valueOf(0))); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.375F, 1.0F); + this.setCreativeTab(CreativeTabs.tabRedstone); + this.setHardness(0.2F); + this.setStepSound(soundTypeWood); + this.setUnlocalizedName("daylightDetector"); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.375F, 1.0F); + } + + public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return ((Integer)state.getValue(POWER)).intValue(); + } + + public void updatePower(World worldIn, BlockPos pos) + { + if (!worldIn.provider.getHasNoSky()) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted(); + float f = worldIn.getCelestialAngleRadians(1.0F); + float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F); + f = f + (f1 - f) * 0.2F; + i = Math.round((float)i * MathHelper.cos(f)); + i = MathHelper.clamp_int(i, 0, 15); + + if (this.inverted) + { + i = 15 - i; + } + + if (((Integer)iblockstate.getValue(POWER)).intValue() != i) + { + worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3); + } + } + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (playerIn.isAllowEdit()) + { + if (worldIn.isRemote) + { + return true; + } + else + { + if (this.inverted) + { + worldIn.setBlockState(pos, Blocks.daylight_detector.getDefaultState().withProperty(POWER, state.getValue(POWER)), 4); + Blocks.daylight_detector.updatePower(worldIn, pos); + } + else + { + worldIn.setBlockState(pos, Blocks.daylight_detector_inverted.getDefaultState().withProperty(POWER, state.getValue(POWER)), 4); + Blocks.daylight_detector_inverted.updatePower(worldIn, pos); + } + + return true; + } + } + else + { + return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Item.getItemFromBlock(Blocks.daylight_detector); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Item.getItemFromBlock(Blocks.daylight_detector); + } + + public boolean isFullCube() + { + return false; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityDaylightDetector(); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(POWER, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(POWER)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {POWER}); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + if (!this.inverted) + { + super.getSubBlocks(itemIn, tab, list); + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDeadBush.java b/src/minecraft/net/minecraft/block/BlockDeadBush.java new file mode 100644 index 0000000..5ef7b5b --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDeadBush.java @@ -0,0 +1,70 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockDeadBush extends BlockBush +{ + protected BlockDeadBush() + { + super(Material.vine); + float f = 0.4F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return MapColor.woodColor; + } + + /** + * is the block grass, dirt or farmland + */ + protected boolean canPlaceBlockOn(Block ground) + { + return ground == Blocks.sand || ground == Blocks.hardened_clay || ground == Blocks.stained_hardened_clay || ground == Blocks.dirt; + } + + /** + * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) + */ + public boolean isReplaceable(World worldIn, BlockPos pos) + { + return true; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return null; + } + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { + if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0)); + } + else + { + super.harvestBlock(worldIn, player, pos, state, te); + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDirectional.java b/src/minecraft/net/minecraft/block/BlockDirectional.java new file mode 100644 index 0000000..2331990 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDirectional.java @@ -0,0 +1,21 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.util.EnumFacing; + +public abstract class BlockDirectional extends Block +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + + protected BlockDirectional(Material materialIn) + { + super(materialIn); + } + + protected BlockDirectional(Material p_i46398_1_, MapColor p_i46398_2_) + { + super(p_i46398_1_, p_i46398_2_); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDirt.java b/src/minecraft/net/minecraft/block/BlockDirt.java new file mode 100644 index 0000000..0e8d870 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDirt.java @@ -0,0 +1,175 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockDirt extends Block +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDirt.DirtType.class); + public static final PropertyBool SNOWY = PropertyBool.create("snowy"); + + protected BlockDirt() + { + super(Material.ground); + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockDirt.DirtType.DIRT).withProperty(SNOWY, Boolean.valueOf(false))); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return ((BlockDirt.DirtType)state.getValue(VARIANT)).func_181066_d(); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + if (state.getValue(VARIANT) == BlockDirt.DirtType.PODZOL) + { + Block block = worldIn.getBlockState(pos.up()).getBlock(); + state = state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); + } + + return state; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + list.add(new ItemStack(this, 1, BlockDirt.DirtType.DIRT.getMetadata())); + list.add(new ItemStack(this, 1, BlockDirt.DirtType.COARSE_DIRT.getMetadata())); + list.add(new ItemStack(this, 1, BlockDirt.DirtType.PODZOL.getMetadata())); + } + + public int getDamageValue(World worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + return iblockstate.getBlock() != this ? 0 : ((BlockDirt.DirtType)iblockstate.getValue(VARIANT)).getMetadata(); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(VARIANT, BlockDirt.DirtType.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockDirt.DirtType)state.getValue(VARIANT)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT, SNOWY}); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + BlockDirt.DirtType blockdirt$dirttype = (BlockDirt.DirtType)state.getValue(VARIANT); + + if (blockdirt$dirttype == BlockDirt.DirtType.PODZOL) + { + blockdirt$dirttype = BlockDirt.DirtType.DIRT; + } + + return blockdirt$dirttype.getMetadata(); + } + + public static enum DirtType implements IStringSerializable + { + DIRT(0, "dirt", "default", MapColor.dirtColor), + COARSE_DIRT(1, "coarse_dirt", "coarse", MapColor.dirtColor), + PODZOL(2, "podzol", MapColor.obsidianColor); + + private static final BlockDirt.DirtType[] METADATA_LOOKUP = new BlockDirt.DirtType[values().length]; + private final int metadata; + private final String name; + private final String unlocalizedName; + private final MapColor field_181067_h; + + private DirtType(int p_i46396_3_, String p_i46396_4_, MapColor p_i46396_5_) + { + this(p_i46396_3_, p_i46396_4_, p_i46396_4_, p_i46396_5_); + } + + private DirtType(int p_i46397_3_, String p_i46397_4_, String p_i46397_5_, MapColor p_i46397_6_) + { + this.metadata = p_i46397_3_; + this.name = p_i46397_4_; + this.unlocalizedName = p_i46397_5_; + this.field_181067_h = p_i46397_6_; + } + + public int getMetadata() + { + return this.metadata; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + public MapColor func_181066_d() + { + return this.field_181067_h; + } + + public String toString() + { + return this.name; + } + + public static BlockDirt.DirtType byMetadata(int metadata) + { + if (metadata < 0 || metadata >= METADATA_LOOKUP.length) + { + metadata = 0; + } + + return METADATA_LOOKUP[metadata]; + } + + public String getName() + { + return this.name; + } + + static { + for (BlockDirt.DirtType blockdirt$dirttype : values()) + { + METADATA_LOOKUP[blockdirt$dirttype.getMetadata()] = blockdirt$dirttype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDispenser.java b/src/minecraft/net/minecraft/block/BlockDispenser.java new file mode 100644 index 0000000..2e1f1e1 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDispenser.java @@ -0,0 +1,303 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.dispenser.IBehaviorDispenseItem; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.dispenser.IPosition; +import net.minecraft.dispenser.PositionImpl; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryHelper; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityDispenser; +import net.minecraft.tileentity.TileEntityDropper; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.RegistryDefaulted; +import net.minecraft.world.World; + +public class BlockDispenser extends BlockContainer +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing"); + public static final PropertyBool TRIGGERED = PropertyBool.create("triggered"); + public static final RegistryDefaulted dispenseBehaviorRegistry = new RegistryDefaulted(new BehaviorDefaultDispenseItem()); + protected Random rand = new Random(); + + protected BlockDispenser() + { + super(Material.rock); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(TRIGGERED, Boolean.valueOf(false))); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return 4; + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + super.onBlockAdded(worldIn, pos, state); + this.setDefaultDirection(worldIn, pos, state); + } + + private void setDefaultDirection(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isRemote) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + boolean flag = worldIn.getBlockState(pos.north()).getBlock().isFullBlock(); + boolean flag1 = worldIn.getBlockState(pos.south()).getBlock().isFullBlock(); + + if (enumfacing == EnumFacing.NORTH && flag && !flag1) + { + enumfacing = EnumFacing.SOUTH; + } + else if (enumfacing == EnumFacing.SOUTH && flag1 && !flag) + { + enumfacing = EnumFacing.NORTH; + } + else + { + boolean flag2 = worldIn.getBlockState(pos.west()).getBlock().isFullBlock(); + boolean flag3 = worldIn.getBlockState(pos.east()).getBlock().isFullBlock(); + + if (enumfacing == EnumFacing.WEST && flag2 && !flag3) + { + enumfacing = EnumFacing.EAST; + } + else if (enumfacing == EnumFacing.EAST && flag3 && !flag2) + { + enumfacing = EnumFacing.WEST; + } + } + + worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing).withProperty(TRIGGERED, Boolean.valueOf(false)), 2); + } + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityDispenser) + { + playerIn.displayGUIChest((TileEntityDispenser)tileentity); + + if (tileentity instanceof TileEntityDropper) + { + playerIn.triggerAchievement(StatList.field_181731_O); + } + else + { + playerIn.triggerAchievement(StatList.field_181733_Q); + } + } + + return true; + } + } + + protected void dispense(World worldIn, BlockPos pos) + { + BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos); + TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity(); + + if (tileentitydispenser != null) + { + int i = tileentitydispenser.getDispenseSlot(); + + if (i < 0) + { + worldIn.playAuxSFX(1001, pos, 0); + } + else + { + ItemStack itemstack = tileentitydispenser.getStackInSlot(i); + IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack); + + if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider) + { + ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack); + tileentitydispenser.setInventorySlotContents(i, itemstack1.stackSize <= 0 ? null : itemstack1); + } + } + } + } + + protected IBehaviorDispenseItem getBehavior(ItemStack stack) + { + return (IBehaviorDispenseItem)dispenseBehaviorRegistry.getObject(stack == null ? null : stack.getItem()); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + boolean flag = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(pos.up()); + boolean flag1 = ((Boolean)state.getValue(TRIGGERED)).booleanValue(); + + if (flag && !flag1) + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + worldIn.setBlockState(pos, state.withProperty(TRIGGERED, Boolean.valueOf(true)), 4); + } + else if (!flag && flag1) + { + worldIn.setBlockState(pos, state.withProperty(TRIGGERED, Boolean.valueOf(false)), 4); + } + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!worldIn.isRemote) + { + this.dispense(worldIn, pos); + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityDispenser(); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(FACING, BlockPistonBase.getFacingFromEntity(worldIn, pos, placer)).withProperty(TRIGGERED, Boolean.valueOf(false)); + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + worldIn.setBlockState(pos, state.withProperty(FACING, BlockPistonBase.getFacingFromEntity(worldIn, pos, placer)), 2); + + if (stack.hasDisplayName()) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityDispenser) + { + ((TileEntityDispenser)tileentity).setCustomName(stack.getDisplayName()); + } + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityDispenser) + { + InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityDispenser)tileentity); + worldIn.updateComparatorOutputLevel(pos, this); + } + + super.breakBlock(worldIn, pos, state); + } + + /** + * Get the position where the dispenser at the given Coordinates should dispense to. + */ + public static IPosition getDispensePosition(IBlockSource coords) + { + EnumFacing enumfacing = getFacing(coords.getBlockMetadata()); + double d0 = coords.getX() + 0.7D * (double)enumfacing.getFrontOffsetX(); + double d1 = coords.getY() + 0.7D * (double)enumfacing.getFrontOffsetY(); + double d2 = coords.getZ() + 0.7D * (double)enumfacing.getFrontOffsetZ(); + return new PositionImpl(d0, d1, d2); + } + + /** + * Get the facing of a dispenser with the given metadata + */ + public static EnumFacing getFacing(int meta) + { + return EnumFacing.getFront(meta & 7); + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World worldIn, BlockPos pos) + { + return Container.calcRedstone(worldIn.getTileEntity(pos)); + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + /** + * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...) + */ + public IBlockState getStateForEntityRender(IBlockState state) + { + return this.getDefaultState().withProperty(FACING, EnumFacing.SOUTH); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, getFacing(meta)).withProperty(TRIGGERED, Boolean.valueOf((meta & 8) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getIndex(); + + if (((Boolean)state.getValue(TRIGGERED)).booleanValue()) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, TRIGGERED}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDoor.java b/src/minecraft/net/minecraft/block/BlockDoor.java new file mode 100644 index 0000000..f0d3440 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDoor.java @@ -0,0 +1,477 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.StatCollector; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockDoor extends Block +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyBool OPEN = PropertyBool.create("open"); + public static final PropertyEnum HINGE = PropertyEnum.create("hinge", BlockDoor.EnumHingePosition.class); + public static final PropertyBool POWERED = PropertyBool.create("powered"); + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoor.EnumDoorHalf.class); + + protected BlockDoor(Material materialIn) + { + super(materialIn); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(OPEN, Boolean.valueOf(false)).withProperty(HINGE, BlockDoor.EnumHingePosition.LEFT).withProperty(POWERED, Boolean.valueOf(false)).withProperty(HALF, BlockDoor.EnumDoorHalf.LOWER)); + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal((this.getUnlocalizedName() + ".name").replaceAll("tile", "item")); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + { + return isOpen(combineMetadata(worldIn, pos)); + } + + public boolean isFullCube() + { + return false; + } + + public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getSelectedBoundingBox(worldIn, pos); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getCollisionBoundingBox(worldIn, pos, state); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + this.setBoundBasedOnMeta(combineMetadata(worldIn, pos)); + } + + private void setBoundBasedOnMeta(int combinedMeta) + { + float f = 0.1875F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); + EnumFacing enumfacing = getFacing(combinedMeta); + boolean flag = isOpen(combinedMeta); + boolean flag1 = isHingeLeft(combinedMeta); + + if (flag) + { + if (enumfacing == EnumFacing.EAST) + { + if (!flag1) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + } + } + else if (enumfacing == EnumFacing.SOUTH) + { + if (!flag1) + { + this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); + } + } + else if (enumfacing == EnumFacing.WEST) + { + if (!flag1) + { + this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); + } + } + else if (enumfacing == EnumFacing.NORTH) + { + if (!flag1) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + } + else if (enumfacing == EnumFacing.EAST) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); + } + else if (enumfacing == EnumFacing.SOUTH) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); + } + else if (enumfacing == EnumFacing.WEST) + { + this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else if (enumfacing == EnumFacing.NORTH) + { + this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + } + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (this.blockMaterial == Material.iron) + { + return true; + } + else + { + BlockPos blockpos = state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down(); + IBlockState iblockstate = pos.equals(blockpos) ? state : worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock() != this) + { + return false; + } + else + { + state = iblockstate.cycleProperty(OPEN); + worldIn.setBlockState(blockpos, state, 2); + worldIn.markBlockRangeForRenderUpdate(blockpos, pos); + worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0); + return true; + } + } + } + + public void toggleDoor(World worldIn, BlockPos pos, boolean open) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == this) + { + BlockPos blockpos = iblockstate.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down(); + IBlockState iblockstate1 = pos == blockpos ? iblockstate : worldIn.getBlockState(blockpos); + + if (iblockstate1.getBlock() == this && ((Boolean)iblockstate1.getValue(OPEN)).booleanValue() != open) + { + worldIn.setBlockState(blockpos, iblockstate1.withProperty(OPEN, Boolean.valueOf(open)), 2); + worldIn.markBlockRangeForRenderUpdate(blockpos, pos); + worldIn.playAuxSFXAtEntity((EntityPlayer)null, open ? 1003 : 1006, pos, 0); + } + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER) + { + BlockPos blockpos = pos.down(); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock() != this) + { + worldIn.setBlockToAir(pos); + } + else if (neighborBlock != this) + { + this.onNeighborBlockChange(worldIn, blockpos, iblockstate, neighborBlock); + } + } + else + { + boolean flag1 = false; + BlockPos blockpos1 = pos.up(); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + + if (iblockstate1.getBlock() != this) + { + worldIn.setBlockToAir(pos); + flag1 = true; + } + + if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down())) + { + worldIn.setBlockToAir(pos); + flag1 = true; + + if (iblockstate1.getBlock() == this) + { + worldIn.setBlockToAir(blockpos1); + } + } + + if (flag1) + { + if (!worldIn.isRemote) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + } + } + else + { + boolean flag = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(blockpos1); + + if ((flag || neighborBlock.canProvidePower()) && neighborBlock != this && flag != ((Boolean)iblockstate1.getValue(POWERED)).booleanValue()) + { + worldIn.setBlockState(blockpos1, iblockstate1.withProperty(POWERED, Boolean.valueOf(flag)), 2); + + if (flag != ((Boolean)state.getValue(OPEN)).booleanValue()) + { + worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(flag)), 2); + worldIn.markBlockRangeForRenderUpdate(pos, pos); + worldIn.playAuxSFXAtEntity((EntityPlayer)null, flag ? 1003 : 1006, pos, 0); + } + } + } + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER ? null : this.getItem(); + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. + */ + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.collisionRayTrace(worldIn, pos, start, end); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return pos.getY() >= 255 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up()); + } + + public int getMobilityFlag() + { + return 1; + } + + public static int combineMetadata(IBlockAccess worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + int i = iblockstate.getBlock().getMetaFromState(iblockstate); + boolean flag = isTop(i); + IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); + int j = iblockstate1.getBlock().getMetaFromState(iblockstate1); + int k = flag ? j : i; + IBlockState iblockstate2 = worldIn.getBlockState(pos.up()); + int l = iblockstate2.getBlock().getMetaFromState(iblockstate2); + int i1 = flag ? i : l; + boolean flag1 = (i1 & 1) != 0; + boolean flag2 = (i1 & 2) != 0; + return removeHalfBit(k) | (flag ? 8 : 0) | (flag1 ? 16 : 0) | (flag2 ? 32 : 0); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return this.getItem(); + } + + private Item getItem() + { + return this == Blocks.iron_door ? Items.iron_door : (this == Blocks.spruce_door ? Items.spruce_door : (this == Blocks.birch_door ? Items.birch_door : (this == Blocks.jungle_door ? Items.jungle_door : (this == Blocks.acacia_door ? Items.acacia_door : (this == Blocks.dark_oak_door ? Items.dark_oak_door : Items.oak_door))))); + } + + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + BlockPos blockpos = pos.down(); + + if (player.capabilities.isCreativeMode && state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER && worldIn.getBlockState(blockpos).getBlock() == this) + { + worldIn.setBlockToAir(blockpos); + } + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + if (state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER) + { + IBlockState iblockstate = worldIn.getBlockState(pos.up()); + + if (iblockstate.getBlock() == this) + { + state = state.withProperty(HINGE, iblockstate.getValue(HINGE)).withProperty(POWERED, iblockstate.getValue(POWERED)); + } + } + else + { + IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); + + if (iblockstate1.getBlock() == this) + { + state = state.withProperty(FACING, iblockstate1.getValue(FACING)).withProperty(OPEN, iblockstate1.getValue(OPEN)); + } + } + + return state; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return (meta & 8) > 0 ? this.getDefaultState().withProperty(HALF, BlockDoor.EnumDoorHalf.UPPER).withProperty(HINGE, (meta & 1) > 0 ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT).withProperty(POWERED, Boolean.valueOf((meta & 2) > 0)) : this.getDefaultState().withProperty(HALF, BlockDoor.EnumDoorHalf.LOWER).withProperty(FACING, EnumFacing.getHorizontal(meta & 3).rotateYCCW()).withProperty(OPEN, Boolean.valueOf((meta & 4) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + + if (state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER) + { + i = i | 8; + + if (state.getValue(HINGE) == BlockDoor.EnumHingePosition.RIGHT) + { + i |= 1; + } + + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + i |= 2; + } + } + else + { + i = i | ((EnumFacing)state.getValue(FACING)).rotateY().getHorizontalIndex(); + + if (((Boolean)state.getValue(OPEN)).booleanValue()) + { + i |= 4; + } + } + + return i; + } + + protected static int removeHalfBit(int meta) + { + return meta & 7; + } + + public static boolean isOpen(IBlockAccess worldIn, BlockPos pos) + { + return isOpen(combineMetadata(worldIn, pos)); + } + + public static EnumFacing getFacing(IBlockAccess worldIn, BlockPos pos) + { + return getFacing(combineMetadata(worldIn, pos)); + } + + public static EnumFacing getFacing(int combinedMeta) + { + return EnumFacing.getHorizontal(combinedMeta & 3).rotateYCCW(); + } + + protected static boolean isOpen(int combinedMeta) + { + return (combinedMeta & 4) != 0; + } + + protected static boolean isTop(int meta) + { + return (meta & 8) != 0; + } + + protected static boolean isHingeLeft(int combinedMeta) + { + return (combinedMeta & 16) != 0; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {HALF, FACING, OPEN, HINGE, POWERED}); + } + + public static enum EnumDoorHalf implements IStringSerializable + { + UPPER, + LOWER; + + public String toString() + { + return this.getName(); + } + + public String getName() + { + return this == UPPER ? "upper" : "lower"; + } + } + + public static enum EnumHingePosition implements IStringSerializable + { + LEFT, + RIGHT; + + public String toString() + { + return this.getName(); + } + + public String getName() + { + return this == LEFT ? "left" : "right"; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDoublePlant.java b/src/minecraft/net/minecraft/block/BlockDoublePlant.java new file mode 100644 index 0000000..7b10d75 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDoublePlant.java @@ -0,0 +1,402 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeColorHelper; + +public class BlockDoublePlant extends BlockBush implements IGrowable +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockDoublePlant.EnumPlantType.class); + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class); + public static final PropertyEnum field_181084_N = BlockDirectional.FACING; + + public BlockDoublePlant() + { + super(Material.vine); + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockDoublePlant.EnumPlantType.SUNFLOWER).withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(field_181084_N, EnumFacing.NORTH)); + this.setHardness(0.0F); + this.setStepSound(soundTypeGrass); + this.setUnlocalizedName("doublePlant"); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public BlockDoublePlant.EnumPlantType getVariant(IBlockAccess worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == this) + { + iblockstate = this.getActualState(iblockstate, worldIn, pos); + return (BlockDoublePlant.EnumPlantType)iblockstate.getValue(VARIANT); + } + else + { + return BlockDoublePlant.EnumPlantType.FERN; + } + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return super.canPlaceBlockAt(worldIn, pos) && worldIn.isAirBlock(pos.up()); + } + + /** + * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) + */ + public boolean isReplaceable(World worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() != this) + { + return true; + } + else + { + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)this.getActualState(iblockstate, worldIn, pos).getValue(VARIANT); + return blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.FERN || blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS; + } + } + + protected void checkAndDropBlock(World worldIn, BlockPos pos, IBlockState state) + { + if (!this.canBlockStay(worldIn, pos, state)) + { + boolean flag = state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER; + BlockPos blockpos = flag ? pos : pos.up(); + BlockPos blockpos1 = flag ? pos.down() : pos; + Block block = (Block)(flag ? this : worldIn.getBlockState(blockpos).getBlock()); + Block block1 = (Block)(flag ? worldIn.getBlockState(blockpos1).getBlock() : this); + + if (block == this) + { + worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2); + } + + if (block1 == this) + { + worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3); + + if (!flag) + { + this.dropBlockAsItem(worldIn, blockpos1, state, 0); + } + } + } + } + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { + if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) + { + return worldIn.getBlockState(pos.down()).getBlock() == this; + } + else + { + IBlockState iblockstate = worldIn.getBlockState(pos.up()); + return iblockstate.getBlock() == this && super.canBlockStay(worldIn, pos, iblockstate); + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) + { + return null; + } + else + { + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)state.getValue(VARIANT); + return blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.FERN ? null : (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? (rand.nextInt(8) == 0 ? Items.wheat_seeds : null) : Item.getItemFromBlock(this)); + } + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.UPPER && state.getValue(VARIANT) != BlockDoublePlant.EnumPlantType.GRASS ? ((BlockDoublePlant.EnumPlantType)state.getValue(VARIANT)).getMeta() : 0; + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = this.getVariant(worldIn, pos); + return blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN ? 16777215 : BiomeColorHelper.getGrassColorAtPos(worldIn, pos); + } + + public void placeAt(World worldIn, BlockPos lowerPos, BlockDoublePlant.EnumPlantType variant, int flags) + { + worldIn.setBlockState(lowerPos, this.getDefaultState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(VARIANT, variant), flags); + worldIn.setBlockState(lowerPos.up(), this.getDefaultState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), flags); + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + worldIn.setBlockState(pos.up(), this.getDefaultState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), 2); + } + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { + if (worldIn.isRemote || player.getCurrentEquippedItem() == null || player.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) + { + super.harvestBlock(worldIn, player, pos, state, te); + } + } + + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) + { + if (worldIn.getBlockState(pos.down()).getBlock() == this) + { + if (!player.capabilities.isCreativeMode) + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)iblockstate.getValue(VARIANT); + + if (blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS) + { + worldIn.destroyBlock(pos.down(), true); + } + else if (!worldIn.isRemote) + { + if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { + this.onHarvest(worldIn, pos, iblockstate, player); + worldIn.setBlockToAir(pos.down()); + } + else + { + worldIn.destroyBlock(pos.down(), true); + } + } + else + { + worldIn.setBlockToAir(pos.down()); + } + } + else + { + worldIn.setBlockToAir(pos.down()); + } + } + } + else if (player.capabilities.isCreativeMode && worldIn.getBlockState(pos.up()).getBlock() == this) + { + worldIn.setBlockState(pos.up(), Blocks.air.getDefaultState(), 2); + } + + super.onBlockHarvested(worldIn, pos, state, player); + } + + private boolean onHarvest(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)state.getValue(VARIANT); + + if (blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS) + { + return false; + } + else + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta(); + spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i)); + return true; + } + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype : BlockDoublePlant.EnumPlantType.values()) + { + list.add(new ItemStack(itemIn, 1, blockdoubleplant$enumplanttype.getMeta())); + } + } + + public int getDamageValue(World worldIn, BlockPos pos) + { + return this.getVariant(worldIn, pos).getMeta(); + } + + /** + * Whether this IGrowable can grow + */ + public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) + { + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = this.getVariant(worldIn, pos); + return blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN; + } + + public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + return true; + } + + public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + spawnAsEntity(worldIn, pos, new ItemStack(this, 1, this.getVariant(worldIn, pos).getMeta())); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return (meta & 8) > 0 ? this.getDefaultState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER) : this.getDefaultState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER).withProperty(VARIANT, BlockDoublePlant.EnumPlantType.byMetadata(meta & 7)); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + + if (iblockstate.getBlock() == this) + { + state = state.withProperty(VARIANT, iblockstate.getValue(VARIANT)); + } + } + + return state; + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER ? 8 | ((EnumFacing)state.getValue(field_181084_N)).getHorizontalIndex() : ((BlockDoublePlant.EnumPlantType)state.getValue(VARIANT)).getMeta(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {HALF, VARIANT, field_181084_N}); + } + + /** + * Get the OffsetType for this Block. Determines if the model is rendered slightly offset. + */ + public Block.EnumOffsetType getOffsetType() + { + return Block.EnumOffsetType.XZ; + } + + public static enum EnumBlockHalf implements IStringSerializable + { + UPPER, + LOWER; + + public String toString() + { + return this.getName(); + } + + public String getName() + { + return this == UPPER ? "upper" : "lower"; + } + } + + public static enum EnumPlantType implements IStringSerializable + { + SUNFLOWER(0, "sunflower"), + SYRINGA(1, "syringa"), + GRASS(2, "double_grass", "grass"), + FERN(3, "double_fern", "fern"), + ROSE(4, "double_rose", "rose"), + PAEONIA(5, "paeonia"); + + private static final BlockDoublePlant.EnumPlantType[] META_LOOKUP = new BlockDoublePlant.EnumPlantType[values().length]; + private final int meta; + private final String name; + private final String unlocalizedName; + + private EnumPlantType(int meta, String name) + { + this(meta, name, name); + } + + private EnumPlantType(int meta, String name, String unlocalizedName) + { + this.meta = meta; + this.name = name; + this.unlocalizedName = unlocalizedName; + } + + public int getMeta() + { + return this.meta; + } + + public String toString() + { + return this.name; + } + + public static BlockDoublePlant.EnumPlantType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + static { + for (BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype : values()) + { + META_LOOKUP[blockdoubleplant$enumplanttype.getMeta()] = blockdoubleplant$enumplanttype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDoubleStoneSlab.java b/src/minecraft/net/minecraft/block/BlockDoubleStoneSlab.java new file mode 100644 index 0000000..f4d95ef --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDoubleStoneSlab.java @@ -0,0 +1,9 @@ +package net.minecraft.block; + +public class BlockDoubleStoneSlab extends BlockStoneSlab +{ + public boolean isDouble() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDoubleStoneSlabNew.java b/src/minecraft/net/minecraft/block/BlockDoubleStoneSlabNew.java new file mode 100644 index 0000000..e78985b --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDoubleStoneSlabNew.java @@ -0,0 +1,9 @@ +package net.minecraft.block; + +public class BlockDoubleStoneSlabNew extends BlockStoneSlabNew +{ + public boolean isDouble() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDoubleWoodSlab.java b/src/minecraft/net/minecraft/block/BlockDoubleWoodSlab.java new file mode 100644 index 0000000..3e58398 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDoubleWoodSlab.java @@ -0,0 +1,9 @@ +package net.minecraft.block; + +public class BlockDoubleWoodSlab extends BlockWoodSlab +{ + public boolean isDouble() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDragonEgg.java b/src/minecraft/net/minecraft/block/BlockDragonEgg.java new file mode 100644 index 0000000..8a03385 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDragonEgg.java @@ -0,0 +1,149 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockDragonEgg extends Block +{ + public BlockDragonEgg() + { + super(Material.dragonEgg, MapColor.blackColor); + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + this.checkFall(worldIn, pos); + } + + private void checkFall(World worldIn, BlockPos pos) + { + if (BlockFalling.canFallInto(worldIn, pos.down()) && pos.getY() >= 0) + { + int i = 32; + + if (!BlockFalling.fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i))) + { + worldIn.spawnEntityInWorld(new EntityFallingBlock(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), this.getDefaultState())); + } + else + { + worldIn.setBlockToAir(pos); + BlockPos blockpos; + + for (blockpos = pos; BlockFalling.canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down()) + { + ; + } + + if (blockpos.getY() > 0) + { + worldIn.setBlockState(blockpos, this.getDefaultState(), 2); + } + } + } + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + this.teleport(worldIn, pos); + return true; + } + + public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) + { + this.teleport(worldIn, pos); + } + + private void teleport(World worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == this) + { + for (int i = 0; i < 1000; ++i) + { + BlockPos blockpos = pos.add(worldIn.rand.nextInt(16) - worldIn.rand.nextInt(16), worldIn.rand.nextInt(8) - worldIn.rand.nextInt(8), worldIn.rand.nextInt(16) - worldIn.rand.nextInt(16)); + + if (worldIn.getBlockState(blockpos).getBlock().blockMaterial == Material.air) + { + if (worldIn.isRemote) + { + for (int j = 0; j < 128; ++j) + { + double d0 = worldIn.rand.nextDouble(); + float f = (worldIn.rand.nextFloat() - 0.5F) * 0.2F; + float f1 = (worldIn.rand.nextFloat() - 0.5F) * 0.2F; + float f2 = (worldIn.rand.nextFloat() - 0.5F) * 0.2F; + double d1 = (double)blockpos.getX() + (double)(pos.getX() - blockpos.getX()) * d0 + (worldIn.rand.nextDouble() - 0.5D) * 1.0D + 0.5D; + double d2 = (double)blockpos.getY() + (double)(pos.getY() - blockpos.getY()) * d0 + worldIn.rand.nextDouble() * 1.0D - 0.5D; + double d3 = (double)blockpos.getZ() + (double)(pos.getZ() - blockpos.getZ()) * d0 + (worldIn.rand.nextDouble() - 0.5D) * 1.0D + 0.5D; + worldIn.spawnParticle(EnumParticleTypes.PORTAL, d1, d2, d3, (double)f, (double)f1, (double)f2, new int[0]); + } + } + else + { + worldIn.setBlockState(blockpos, iblockstate, 2); + worldIn.setBlockToAir(pos); + } + + return; + } + } + } + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return 5; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return true; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return null; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDropper.java b/src/minecraft/net/minecraft/block/BlockDropper.java new file mode 100644 index 0000000..8842dd0 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDropper.java @@ -0,0 +1,89 @@ +package net.minecraft.block; + +import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.dispenser.IBehaviorDispenseItem; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityDispenser; +import net.minecraft.tileentity.TileEntityDropper; +import net.minecraft.tileentity.TileEntityHopper; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class BlockDropper extends BlockDispenser +{ + private final IBehaviorDispenseItem dropBehavior = new BehaviorDefaultDispenseItem(); + + protected IBehaviorDispenseItem getBehavior(ItemStack stack) + { + return this.dropBehavior; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityDropper(); + } + + protected void dispense(World worldIn, BlockPos pos) + { + BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos); + TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity(); + + if (tileentitydispenser != null) + { + int i = tileentitydispenser.getDispenseSlot(); + + if (i < 0) + { + worldIn.playAuxSFX(1001, pos, 0); + } + else + { + ItemStack itemstack = tileentitydispenser.getStackInSlot(i); + + if (itemstack != null) + { + EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING); + BlockPos blockpos = pos.offset(enumfacing); + IInventory iinventory = TileEntityHopper.getInventoryAtPosition(worldIn, (double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ()); + ItemStack itemstack1; + + if (iinventory == null) + { + itemstack1 = this.dropBehavior.dispense(blocksourceimpl, itemstack); + + if (itemstack1 != null && itemstack1.stackSize <= 0) + { + itemstack1 = null; + } + } + else + { + itemstack1 = TileEntityHopper.putStackInInventoryAllSlots(iinventory, itemstack.copy().splitStack(1), enumfacing.getOpposite()); + + if (itemstack1 == null) + { + itemstack1 = itemstack.copy(); + + if (--itemstack1.stackSize <= 0) + { + itemstack1 = null; + } + } + else + { + itemstack1 = itemstack.copy(); + } + } + + tileentitydispenser.setInventorySlotContents(i, itemstack1); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockDynamicLiquid.java b/src/minecraft/net/minecraft/block/BlockDynamicLiquid.java new file mode 100644 index 0000000..ace9b60 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockDynamicLiquid.java @@ -0,0 +1,293 @@ +package net.minecraft.block; + +import java.util.EnumSet; +import java.util.Random; +import java.util.Set; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class BlockDynamicLiquid extends BlockLiquid +{ + int adjacentSourceBlocks; + + protected BlockDynamicLiquid(Material materialIn) + { + super(materialIn); + } + + private void placeStaticBlock(World worldIn, BlockPos pos, IBlockState currentState) + { + worldIn.setBlockState(pos, getStaticBlock(this.blockMaterial).getDefaultState().withProperty(LEVEL, currentState.getValue(LEVEL)), 2); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + int i = ((Integer)state.getValue(LEVEL)).intValue(); + int j = 1; + + if (this.blockMaterial == Material.lava && !worldIn.provider.doesWaterVaporize()) + { + j = 2; + } + + int k = this.tickRate(worldIn); + + if (i > 0) + { + int l = -100; + this.adjacentSourceBlocks = 0; + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + l = this.checkAdjacentBlock(worldIn, pos.offset((EnumFacing) enumfacing), l); + } + + int i1 = l + j; + + if (i1 >= 8 || l < 0) + { + i1 = -1; + } + + if (this.getLevel(worldIn, pos.up()) >= 0) + { + int j1 = this.getLevel(worldIn, pos.up()); + + if (j1 >= 8) + { + i1 = j1; + } + else + { + i1 = j1 + 8; + } + } + + if (this.adjacentSourceBlocks >= 2 && this.blockMaterial == Material.water) + { + IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); + + if (iblockstate1.getBlock().getMaterial().isSolid()) + { + i1 = 0; + } + else if (iblockstate1.getBlock().getMaterial() == this.blockMaterial && ((Integer)iblockstate1.getValue(LEVEL)).intValue() == 0) + { + i1 = 0; + } + } + + if (this.blockMaterial == Material.lava && i < 8 && i1 < 8 && i1 > i && rand.nextInt(4) != 0) + { + k *= 4; + } + + if (i1 == i) + { + this.placeStaticBlock(worldIn, pos, state); + } + else + { + i = i1; + + if (i1 < 0) + { + worldIn.setBlockToAir(pos); + } + else + { + state = state.withProperty(LEVEL, Integer.valueOf(i1)); + worldIn.setBlockState(pos, state, 2); + worldIn.scheduleUpdate(pos, this, k); + worldIn.notifyNeighborsOfStateChange(pos, this); + } + } + } + else + { + this.placeStaticBlock(worldIn, pos, state); + } + + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + + if (this.canFlowInto(worldIn, pos.down(), iblockstate)) + { + if (this.blockMaterial == Material.lava && worldIn.getBlockState(pos.down()).getBlock().getMaterial() == Material.water) + { + worldIn.setBlockState(pos.down(), Blocks.stone.getDefaultState()); + this.triggerMixEffects(worldIn, pos.down()); + return; + } + + if (i >= 8) + { + this.tryFlowInto(worldIn, pos.down(), iblockstate, i); + } + else + { + this.tryFlowInto(worldIn, pos.down(), iblockstate, i + 8); + } + } + else if (i >= 0 && (i == 0 || this.isBlocked(worldIn, pos.down(), iblockstate))) + { + Set set = this.getPossibleFlowDirections(worldIn, pos); + int k1 = i + j; + + if (i >= 8) + { + k1 = 1; + } + + if (k1 >= 8) + { + return; + } + + for (EnumFacing enumfacing1 : set) + { + this.tryFlowInto(worldIn, pos.offset(enumfacing1), worldIn.getBlockState(pos.offset(enumfacing1)), k1); + } + } + } + + private void tryFlowInto(World worldIn, BlockPos pos, IBlockState state, int level) + { + if (this.canFlowInto(worldIn, pos, state)) + { + if (state.getBlock() != Blocks.air) + { + if (this.blockMaterial == Material.lava) + { + this.triggerMixEffects(worldIn, pos); + } + else + { + state.getBlock().dropBlockAsItem(worldIn, pos, state, 0); + } + } + + worldIn.setBlockState(pos, this.getDefaultState().withProperty(LEVEL, Integer.valueOf(level)), 3); + } + } + + private int func_176374_a(World worldIn, BlockPos pos, int distance, EnumFacing calculateFlowCost) + { + int i = 1000; + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (enumfacing != calculateFlowCost) + { + BlockPos blockpos = pos.offset((EnumFacing) enumfacing); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (!this.isBlocked(worldIn, blockpos, iblockstate) && (iblockstate.getBlock().getMaterial() != this.blockMaterial || ((Integer)iblockstate.getValue(LEVEL)).intValue() > 0)) + { + if (!this.isBlocked(worldIn, blockpos.down(), iblockstate)) + { + return distance; + } + + if (distance < 4) + { + int j = this.func_176374_a(worldIn, blockpos, distance + 1, ((EnumFacing) enumfacing).getOpposite()); + + if (j < i) + { + i = j; + } + } + } + } + } + + return i; + } + + private Set getPossibleFlowDirections(World worldIn, BlockPos pos) + { + int i = 1000; + Set set = EnumSet.noneOf(EnumFacing.class); + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + BlockPos blockpos = pos.offset((EnumFacing) enumfacing); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (!this.isBlocked(worldIn, blockpos, iblockstate) && (iblockstate.getBlock().getMaterial() != this.blockMaterial || ((Integer)iblockstate.getValue(LEVEL)).intValue() > 0)) + { + int j; + + if (this.isBlocked(worldIn, blockpos.down(), worldIn.getBlockState(blockpos.down()))) + { + j = this.func_176374_a(worldIn, blockpos, 1, ((EnumFacing) enumfacing).getOpposite()); + } + else + { + j = 0; + } + + if (j < i) + { + set.clear(); + } + + if (j <= i) + { + set.add((EnumFacing) enumfacing); + i = j; + } + } + } + + return set; + } + + private boolean isBlocked(World worldIn, BlockPos pos, IBlockState state) + { + Block block = worldIn.getBlockState(pos).getBlock(); + return !(block instanceof BlockDoor) && block != Blocks.standing_sign && block != Blocks.ladder && block != Blocks.reeds ? (block.blockMaterial == Material.portal ? true : block.blockMaterial.blocksMovement()) : true; + } + + protected int checkAdjacentBlock(World worldIn, BlockPos pos, int currentMinLevel) + { + int i = this.getLevel(worldIn, pos); + + if (i < 0) + { + return currentMinLevel; + } + else + { + if (i == 0) + { + ++this.adjacentSourceBlocks; + } + + if (i >= 8) + { + i = 0; + } + + return currentMinLevel >= 0 && i >= currentMinLevel ? currentMinLevel : i; + } + } + + private boolean canFlowInto(World worldIn, BlockPos pos, IBlockState state) + { + Material material = state.getBlock().getMaterial(); + return material != this.blockMaterial && material != Material.lava && !this.isBlocked(worldIn, pos, state); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + if (!this.checkForMixing(worldIn, pos, state)) + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockEnchantmentTable.java b/src/minecraft/net/minecraft/block/BlockEnchantmentTable.java new file mode 100644 index 0000000..7595d2d --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockEnchantmentTable.java @@ -0,0 +1,128 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityEnchantmentTable; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class BlockEnchantmentTable extends BlockContainer +{ + protected BlockEnchantmentTable() + { + super(Material.rock, MapColor.redColor); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F); + this.setLightOpacity(0); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + public boolean isFullCube() + { + return false; + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + super.randomDisplayTick(worldIn, pos, state, rand); + + for (int i = -2; i <= 2; ++i) + { + for (int j = -2; j <= 2; ++j) + { + if (i > -2 && i < 2 && j == -1) + { + j = 2; + } + + if (rand.nextInt(16) == 0) + { + for (int k = 0; k <= 1; ++k) + { + BlockPos blockpos = pos.add(i, k, j); + + if (worldIn.getBlockState(blockpos).getBlock() == Blocks.bookshelf) + { + if (!worldIn.isAirBlock(pos.add(i / 2, 0, j / 2))) + { + break; + } + + worldIn.spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, (double)pos.getX() + 0.5D, (double)pos.getY() + 2.0D, (double)pos.getZ() + 0.5D, (double)((float)i + rand.nextFloat()) - 0.5D, (double)((float)k - rand.nextFloat() - 1.0F), (double)((float)j + rand.nextFloat()) - 0.5D, new int[0]); + } + } + } + } + } + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityEnchantmentTable(); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityEnchantmentTable) + { + playerIn.displayGui((TileEntityEnchantmentTable)tileentity); + } + + return true; + } + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + super.onBlockPlacedBy(worldIn, pos, state, placer, stack); + + if (stack.hasDisplayName()) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityEnchantmentTable) + { + ((TileEntityEnchantmentTable)tileentity).setCustomName(stack.getDisplayName()); + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockEndPortal.java b/src/minecraft/net/minecraft/block/BlockEndPortal.java new file mode 100644 index 0000000..69d1127 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockEndPortal.java @@ -0,0 +1,108 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityEndPortal; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockEndPortal extends BlockContainer +{ + protected BlockEndPortal(Material materialIn) + { + super(materialIn); + this.setLightLevel(1.0F); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityEndPortal(); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + float f = 0.0625F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F); + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return side == EnumFacing.DOWN ? super.shouldSideBeRendered(worldIn, pos, side) : false; + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + /** + * Called When an Entity Collided with the Block + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + if (entityIn.ridingEntity == null && entityIn.riddenByEntity == null && !worldIn.isRemote) + { + entityIn.travelToDimension(1); + } + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + double d0 = (double)((float)pos.getX() + rand.nextFloat()); + double d1 = (double)((float)pos.getY() + 0.8F); + double d2 = (double)((float)pos.getZ() + rand.nextFloat()); + double d3 = 0.0D; + double d4 = 0.0D; + double d5 = 0.0D; + worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, d3, d4, d5, new int[0]); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return null; + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return MapColor.blackColor; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockEndPortalFrame.java b/src/minecraft/net/minecraft/block/BlockEndPortalFrame.java new file mode 100644 index 0000000..c621bcc --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockEndPortalFrame.java @@ -0,0 +1,119 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class BlockEndPortalFrame extends Block +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyBool EYE = PropertyBool.create("eye"); + + public BlockEndPortalFrame() + { + super(Material.rock, MapColor.greenColor); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(EYE, Boolean.valueOf(false))); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F); + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + + if (((Boolean)worldIn.getBlockState(pos).getValue(EYE)).booleanValue()) + { + this.setBlockBounds(0.3125F, 0.8125F, 0.3125F, 0.6875F, 1.0F, 0.6875F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + + this.setBlockBoundsForItemRender(); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return null; + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(EYE, Boolean.valueOf(false)); + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World worldIn, BlockPos pos) + { + return ((Boolean)worldIn.getBlockState(pos).getValue(EYE)).booleanValue() ? 15 : 0; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(EYE, Boolean.valueOf((meta & 4) != 0)).withProperty(FACING, EnumFacing.getHorizontal(meta & 3)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); + + if (((Boolean)state.getValue(EYE)).booleanValue()) + { + i |= 4; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, EYE}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockEnderChest.java b/src/minecraft/net/minecraft/block/BlockEnderChest.java new file mode 100644 index 0000000..19a5e92 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockEnderChest.java @@ -0,0 +1,175 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.InventoryEnderChest; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityEnderChest; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class BlockEnderChest extends BlockContainer +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + + protected BlockEnderChest() + { + super(Material.rock); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); + this.setCreativeTab(CreativeTabs.tabDecorations); + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 2; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Item.getItemFromBlock(Blocks.obsidian); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 8; + } + + protected boolean canSilkHarvest() + { + return true; + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + InventoryEnderChest inventoryenderchest = playerIn.getInventoryEnderChest(); + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (inventoryenderchest != null && tileentity instanceof TileEntityEnderChest) + { + if (worldIn.getBlockState(pos.up()).getBlock().isNormalCube()) + { + return true; + } + else if (worldIn.isRemote) + { + return true; + } + else + { + inventoryenderchest.setChestTileEntity((TileEntityEnderChest)tileentity); + playerIn.displayGUIChest(inventoryenderchest); + playerIn.triggerAchievement(StatList.field_181738_V); + return true; + } + } + else + { + return true; + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityEnderChest(); + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + for (int i = 0; i < 3; ++i) + { + int j = rand.nextInt(2) * 2 - 1; + int k = rand.nextInt(2) * 2 - 1; + double d0 = (double)pos.getX() + 0.5D + 0.25D * (double)j; + double d1 = (double)((float)pos.getY() + rand.nextFloat()); + double d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)k; + double d3 = (double)(rand.nextFloat() * (float)j); + double d4 = ((double)rand.nextFloat() - 0.5D) * 0.125D; + double d5 = (double)(rand.nextFloat() * (float)k); + worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + EnumFacing enumfacing = EnumFacing.getFront(meta); + + if (enumfacing.getAxis() == EnumFacing.Axis.Y) + { + enumfacing = EnumFacing.NORTH; + } + + return this.getDefaultState().withProperty(FACING, enumfacing); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((EnumFacing)state.getValue(FACING)).getIndex(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockEventData.java b/src/minecraft/net/minecraft/block/BlockEventData.java new file mode 100644 index 0000000..76c661a --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockEventData.java @@ -0,0 +1,62 @@ +package net.minecraft.block; + +import net.minecraft.util.BlockPos; + +public class BlockEventData +{ + private BlockPos position; + private Block blockType; + + /** Different for each blockID */ + private int eventID; + private int eventParameter; + + public BlockEventData(BlockPos pos, Block blockType, int eventId, int p_i45756_4_) + { + this.position = pos; + this.eventID = eventId; + this.eventParameter = p_i45756_4_; + this.blockType = blockType; + } + + public BlockPos getPosition() + { + return this.position; + } + + /** + * Get the Event ID (different for each BlockID) + */ + public int getEventID() + { + return this.eventID; + } + + public int getEventParameter() + { + return this.eventParameter; + } + + public Block getBlock() + { + return this.blockType; + } + + public boolean equals(Object p_equals_1_) + { + if (!(p_equals_1_ instanceof BlockEventData)) + { + return false; + } + else + { + BlockEventData blockeventdata = (BlockEventData)p_equals_1_; + return this.position.equals(blockeventdata.position) && this.eventID == blockeventdata.eventID && this.eventParameter == blockeventdata.eventParameter && this.blockType == blockeventdata.blockType; + } + } + + public String toString() + { + return "TE(" + this.position + ")," + this.eventID + "," + this.eventParameter + "," + this.blockType; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockFalling.java b/src/minecraft/net/minecraft/block/BlockFalling.java new file mode 100644 index 0000000..44c52e5 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockFalling.java @@ -0,0 +1,103 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockFalling extends Block +{ + public static boolean fallInstantly; + + public BlockFalling() + { + super(Material.sand); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + public BlockFalling(Material materialIn) + { + super(materialIn); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!worldIn.isRemote) + { + this.checkFallable(worldIn, pos); + } + } + + private void checkFallable(World worldIn, BlockPos pos) + { + if (canFallInto(worldIn, pos.down()) && pos.getY() >= 0) + { + int i = 32; + + if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i))) + { + if (!worldIn.isRemote) + { + EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getBlockState(pos)); + this.onStartFalling(entityfallingblock); + worldIn.spawnEntityInWorld(entityfallingblock); + } + } + else + { + worldIn.setBlockToAir(pos); + BlockPos blockpos; + + for (blockpos = pos.down(); canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down()) + { + ; + } + + if (blockpos.getY() > 0) + { + worldIn.setBlockState(blockpos.up(), this.getDefaultState()); + } + } + } + } + + protected void onStartFalling(EntityFallingBlock fallingEntity) + { + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return 2; + } + + public static boolean canFallInto(World worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos).getBlock(); + Material material = block.blockMaterial; + return block == Blocks.fire || material == Material.air || material == Material.water || material == Material.lava; + } + + public void onEndFalling(World worldIn, BlockPos pos) + { + } +} diff --git a/src/minecraft/net/minecraft/block/BlockFarmland.java b/src/minecraft/net/minecraft/block/BlockFarmland.java new file mode 100644 index 0000000..187a3f8 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockFarmland.java @@ -0,0 +1,177 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockFarmland extends Block +{ + public static final PropertyInteger MOISTURE = PropertyInteger.create("moisture", 0, 7); + + protected BlockFarmland() + { + super(Material.ground); + this.setDefaultState(this.blockState.getBaseState().withProperty(MOISTURE, Integer.valueOf(0))); + this.setTickRandomly(true); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F); + this.setLightOpacity(255); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1)); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + int i = ((Integer)state.getValue(MOISTURE)).intValue(); + + if (!this.hasWater(worldIn, pos) && !worldIn.canLightningStrike(pos.up())) + { + if (i > 0) + { + worldIn.setBlockState(pos, state.withProperty(MOISTURE, Integer.valueOf(i - 1)), 2); + } + else if (!this.hasCrops(worldIn, pos)) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); + } + } + else if (i < 7) + { + worldIn.setBlockState(pos, state.withProperty(MOISTURE, Integer.valueOf(7)), 2); + } + } + + /** + * Block's chance to react to a living entity falling on it. + */ + public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) + { + if (entityIn instanceof EntityLivingBase) + { + if (!worldIn.isRemote && worldIn.rand.nextFloat() < fallDistance - 0.5F) + { + if (!(entityIn instanceof EntityPlayer) && !worldIn.getGameRules().getBoolean("mobGriefing")) + { + return; + } + + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); + } + + super.onFallenUpon(worldIn, pos, entityIn, fallDistance); + } + } + + private boolean hasCrops(World worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.up()).getBlock(); + return block instanceof BlockCrops || block instanceof BlockStem; + } + + private boolean hasWater(World worldIn, BlockPos pos) + { + for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(pos.add(-4, 0, -4), pos.add(4, 1, 4))) + { + if (worldIn.getBlockState(blockpos$mutableblockpos).getBlock().getMaterial() == Material.water) + { + return true; + } + } + + return false; + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + + if (worldIn.getBlockState(pos.up()).getBlock().getMaterial().isSolid()) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); + } + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + switch (side) + { + case UP: + return true; + + case NORTH: + case SOUTH: + case WEST: + case EAST: + Block block = worldIn.getBlockState(pos).getBlock(); + return !block.isOpaqueCube() && block != Blocks.farmland; + + default: + return super.shouldSideBeRendered(worldIn, pos, side); + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Blocks.dirt.getItemDropped(Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), rand, fortune); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Item.getItemFromBlock(Blocks.dirt); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(MOISTURE, Integer.valueOf(meta & 7)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(MOISTURE)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {MOISTURE}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockFence.java b/src/minecraft/net/minecraft/block/BlockFence.java new file mode 100644 index 0000000..060fc23 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockFence.java @@ -0,0 +1,198 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemLead; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockFence extends Block +{ + /** Whether this fence connects in the northern direction */ + public static final PropertyBool NORTH = PropertyBool.create("north"); + + /** Whether this fence connects in the eastern direction */ + public static final PropertyBool EAST = PropertyBool.create("east"); + + /** Whether this fence connects in the southern direction */ + public static final PropertyBool SOUTH = PropertyBool.create("south"); + + /** Whether this fence connects in the western direction */ + public static final PropertyBool WEST = PropertyBool.create("west"); + + public BlockFence(Material materialIn) + { + this(materialIn, materialIn.getMaterialMapColor()); + } + + public BlockFence(Material p_i46395_1_, MapColor p_i46395_2_) + { + super(p_i46395_1_, p_i46395_2_); + this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + boolean flag = this.canConnectTo(worldIn, pos.north()); + boolean flag1 = this.canConnectTo(worldIn, pos.south()); + boolean flag2 = this.canConnectTo(worldIn, pos.west()); + boolean flag3 = this.canConnectTo(worldIn, pos.east()); + float f = 0.375F; + float f1 = 0.625F; + float f2 = 0.375F; + float f3 = 0.625F; + + if (flag) + { + f2 = 0.0F; + } + + if (flag1) + { + f3 = 1.0F; + } + + if (flag || flag1) + { + this.setBlockBounds(f, 0.0F, f2, f1, 1.5F, f3); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + + f2 = 0.375F; + f3 = 0.625F; + + if (flag2) + { + f = 0.0F; + } + + if (flag3) + { + f1 = 1.0F; + } + + if (flag2 || flag3 || !flag && !flag1) + { + this.setBlockBounds(f, 0.0F, f2, f1, 1.5F, f3); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + + if (flag) + { + f2 = 0.0F; + } + + if (flag1) + { + f3 = 1.0F; + } + + this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + boolean flag = this.canConnectTo(worldIn, pos.north()); + boolean flag1 = this.canConnectTo(worldIn, pos.south()); + boolean flag2 = this.canConnectTo(worldIn, pos.west()); + boolean flag3 = this.canConnectTo(worldIn, pos.east()); + float f = 0.375F; + float f1 = 0.625F; + float f2 = 0.375F; + float f3 = 0.625F; + + if (flag) + { + f2 = 0.0F; + } + + if (flag1) + { + f3 = 1.0F; + } + + if (flag2) + { + f = 0.0F; + } + + if (flag3) + { + f1 = 1.0F; + } + + this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + { + return false; + } + + public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos).getBlock(); + return block == Blocks.barrier ? false : ((!(block instanceof BlockFence) || block.blockMaterial != this.blockMaterial) && !(block instanceof BlockFenceGate) ? (block.blockMaterial.isOpaque() && block.isFullCube() ? block.blockMaterial != Material.gourd : false) : true); + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return true; + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + return worldIn.isRemote ? true : ItemLead.attachToFence(playerIn, worldIn, pos); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return 0; + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + return state.withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west()))); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockFenceGate.java b/src/minecraft/net/minecraft/block/BlockFenceGate.java new file mode 100644 index 0000000..5b135d4 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockFenceGate.java @@ -0,0 +1,197 @@ +package net.minecraft.block; + +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockFenceGate extends BlockDirectional +{ + public static final PropertyBool OPEN = PropertyBool.create("open"); + public static final PropertyBool POWERED = PropertyBool.create("powered"); + public static final PropertyBool IN_WALL = PropertyBool.create("in_wall"); + + public BlockFenceGate(BlockPlanks.EnumType p_i46394_1_) + { + super(Material.wood, p_i46394_1_.func_181070_c()); + this.setDefaultState(this.blockState.getBaseState().withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false))); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis(); + + if (enumfacing$axis == EnumFacing.Axis.Z && (worldIn.getBlockState(pos.west()).getBlock() == Blocks.cobblestone_wall || worldIn.getBlockState(pos.east()).getBlock() == Blocks.cobblestone_wall) || enumfacing$axis == EnumFacing.Axis.X && (worldIn.getBlockState(pos.north()).getBlock() == Blocks.cobblestone_wall || worldIn.getBlockState(pos.south()).getBlock() == Blocks.cobblestone_wall)) + { + state = state.withProperty(IN_WALL, Boolean.valueOf(true)); + } + + return state; + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return worldIn.getBlockState(pos.down()).getBlock().getMaterial().isSolid() ? super.canPlaceBlockAt(worldIn, pos) : false; + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + if (((Boolean)state.getValue(OPEN)).booleanValue()) + { + return null; + } + else + { + EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis(); + return enumfacing$axis == EnumFacing.Axis.Z ? new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)((float)pos.getZ() + 0.375F), (double)(pos.getX() + 1), (double)((float)pos.getY() + 1.5F), (double)((float)pos.getZ() + 0.625F)) : new AxisAlignedBB((double)((float)pos.getX() + 0.375F), (double)pos.getY(), (double)pos.getZ(), (double)((float)pos.getX() + 0.625F), (double)((float)pos.getY() + 1.5F), (double)(pos.getZ() + 1)); + } + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + EnumFacing.Axis enumfacing$axis = ((EnumFacing)worldIn.getBlockState(pos).getValue(FACING)).getAxis(); + + if (enumfacing$axis == EnumFacing.Axis.Z) + { + this.setBlockBounds(0.0F, 0.0F, 0.375F, 1.0F, 1.0F, 0.625F); + } + else + { + this.setBlockBounds(0.375F, 0.0F, 0.0F, 0.625F, 1.0F, 1.0F); + } + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + { + return ((Boolean)worldIn.getBlockState(pos).getValue(OPEN)).booleanValue(); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()).withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false)); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (((Boolean)state.getValue(OPEN)).booleanValue()) + { + state = state.withProperty(OPEN, Boolean.valueOf(false)); + worldIn.setBlockState(pos, state, 2); + } + else + { + EnumFacing enumfacing = EnumFacing.fromAngle((double)playerIn.rotationYaw); + + if (state.getValue(FACING) == enumfacing.getOpposite()) + { + state = state.withProperty(FACING, enumfacing); + } + + state = state.withProperty(OPEN, Boolean.valueOf(true)); + worldIn.setBlockState(pos, state, 2); + } + + worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0); + return true; + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!worldIn.isRemote) + { + boolean flag = worldIn.isBlockPowered(pos); + + if (flag || neighborBlock.canProvidePower()) + { + if (flag && !((Boolean)state.getValue(OPEN)).booleanValue() && !((Boolean)state.getValue(POWERED)).booleanValue()) + { + worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(true)).withProperty(POWERED, Boolean.valueOf(true)), 2); + worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1003, pos, 0); + } + else if (!flag && ((Boolean)state.getValue(OPEN)).booleanValue() && ((Boolean)state.getValue(POWERED)).booleanValue()) + { + worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)), 2); + worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1006, pos, 0); + } + else if (flag != ((Boolean)state.getValue(POWERED)).booleanValue()) + { + worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(flag)), 2); + } + } + } + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return true; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)).withProperty(OPEN, Boolean.valueOf((meta & 4) != 0)).withProperty(POWERED, Boolean.valueOf((meta & 8) != 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); + + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + i |= 8; + } + + if (((Boolean)state.getValue(OPEN)).booleanValue()) + { + i |= 4; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, OPEN, POWERED, IN_WALL}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockFire.java b/src/minecraft/net/minecraft/block/BlockFire.java new file mode 100644 index 0000000..73d48e2 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockFire.java @@ -0,0 +1,506 @@ +package net.minecraft.block; + +import com.google.common.collect.Maps; +import java.util.Map; +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraft.world.WorldProviderEnd; + +public class BlockFire extends Block +{ + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); + public static final PropertyBool FLIP = PropertyBool.create("flip"); + public static final PropertyBool ALT = PropertyBool.create("alt"); + public static final PropertyBool NORTH = PropertyBool.create("north"); + public static final PropertyBool EAST = PropertyBool.create("east"); + public static final PropertyBool SOUTH = PropertyBool.create("south"); + public static final PropertyBool WEST = PropertyBool.create("west"); + public static final PropertyInteger UPPER = PropertyInteger.create("upper", 0, 2); + private final Map encouragements = Maps.newIdentityHashMap(); + private final Map flammabilities = Maps.newIdentityHashMap(); + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + int i = pos.getX(); + int j = pos.getY(); + int k = pos.getZ(); + + if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) + { + boolean flag = (i + j + k & 1) == 1; + boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1; + int l = 0; + + if (this.canCatchFire(worldIn, pos.up())) + { + l = flag ? 1 : 2; + } + + return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Integer.valueOf(l)).withProperty(FLIP, Boolean.valueOf(flag1)).withProperty(ALT, Boolean.valueOf(flag)); + } + else + { + return this.getDefaultState(); + } + } + + protected BlockFire() + { + super(Material.fire); + this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0)).withProperty(FLIP, Boolean.valueOf(false)).withProperty(ALT, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(UPPER, Integer.valueOf(0))); + this.setTickRandomly(true); + } + + public static void init() + { + Blocks.fire.setFireInfo(Blocks.planks, 5, 20); + Blocks.fire.setFireInfo(Blocks.double_wooden_slab, 5, 20); + Blocks.fire.setFireInfo(Blocks.wooden_slab, 5, 20); + Blocks.fire.setFireInfo(Blocks.oak_fence_gate, 5, 20); + Blocks.fire.setFireInfo(Blocks.spruce_fence_gate, 5, 20); + Blocks.fire.setFireInfo(Blocks.birch_fence_gate, 5, 20); + Blocks.fire.setFireInfo(Blocks.jungle_fence_gate, 5, 20); + Blocks.fire.setFireInfo(Blocks.dark_oak_fence_gate, 5, 20); + Blocks.fire.setFireInfo(Blocks.acacia_fence_gate, 5, 20); + Blocks.fire.setFireInfo(Blocks.oak_fence, 5, 20); + Blocks.fire.setFireInfo(Blocks.spruce_fence, 5, 20); + Blocks.fire.setFireInfo(Blocks.birch_fence, 5, 20); + Blocks.fire.setFireInfo(Blocks.jungle_fence, 5, 20); + Blocks.fire.setFireInfo(Blocks.dark_oak_fence, 5, 20); + Blocks.fire.setFireInfo(Blocks.acacia_fence, 5, 20); + Blocks.fire.setFireInfo(Blocks.oak_stairs, 5, 20); + Blocks.fire.setFireInfo(Blocks.birch_stairs, 5, 20); + Blocks.fire.setFireInfo(Blocks.spruce_stairs, 5, 20); + Blocks.fire.setFireInfo(Blocks.jungle_stairs, 5, 20); + Blocks.fire.setFireInfo(Blocks.log, 5, 5); + Blocks.fire.setFireInfo(Blocks.log2, 5, 5); + Blocks.fire.setFireInfo(Blocks.leaves, 30, 60); + Blocks.fire.setFireInfo(Blocks.leaves2, 30, 60); + Blocks.fire.setFireInfo(Blocks.bookshelf, 30, 20); + Blocks.fire.setFireInfo(Blocks.tnt, 15, 100); + Blocks.fire.setFireInfo(Blocks.tallgrass, 60, 100); + Blocks.fire.setFireInfo(Blocks.double_plant, 60, 100); + Blocks.fire.setFireInfo(Blocks.yellow_flower, 60, 100); + Blocks.fire.setFireInfo(Blocks.red_flower, 60, 100); + Blocks.fire.setFireInfo(Blocks.deadbush, 60, 100); + Blocks.fire.setFireInfo(Blocks.wool, 30, 60); + Blocks.fire.setFireInfo(Blocks.vine, 15, 100); + Blocks.fire.setFireInfo(Blocks.coal_block, 5, 5); + Blocks.fire.setFireInfo(Blocks.hay_block, 60, 20); + Blocks.fire.setFireInfo(Blocks.carpet, 60, 20); + } + + public void setFireInfo(Block blockIn, int encouragement, int flammability) + { + this.encouragements.put(blockIn, Integer.valueOf(encouragement)); + this.flammabilities.put(blockIn, Integer.valueOf(flammability)); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return 30; + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (worldIn.getGameRules().getBoolean("doFireTick")) + { + if (!this.canPlaceBlockAt(worldIn, pos)) + { + worldIn.setBlockToAir(pos); + } + + Block block = worldIn.getBlockState(pos.down()).getBlock(); + boolean flag = block == Blocks.netherrack; + + if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock) + { + flag = true; + } + + if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos)) + { + worldIn.setBlockToAir(pos); + } + else + { + int i = ((Integer)state.getValue(AGE)).intValue(); + + if (i < 15) + { + state = state.withProperty(AGE, Integer.valueOf(i + rand.nextInt(3) / 2)); + worldIn.setBlockState(pos, state, 4); + } + + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn) + rand.nextInt(10)); + + if (!flag) + { + if (!this.canNeighborCatchFire(worldIn, pos)) + { + if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) || i > 3) + { + worldIn.setBlockToAir(pos); + } + + return; + } + + if (!this.canCatchFire(worldIn, pos.down()) && i == 15 && rand.nextInt(4) == 0) + { + worldIn.setBlockToAir(pos); + return; + } + } + + boolean flag1 = worldIn.isBlockinHighHumidity(pos); + int j = 0; + + if (flag1) + { + j = -50; + } + + this.catchOnFire(worldIn, pos.east(), 300 + j, rand, i); + this.catchOnFire(worldIn, pos.west(), 300 + j, rand, i); + this.catchOnFire(worldIn, pos.down(), 250 + j, rand, i); + this.catchOnFire(worldIn, pos.up(), 250 + j, rand, i); + this.catchOnFire(worldIn, pos.north(), 300 + j, rand, i); + this.catchOnFire(worldIn, pos.south(), 300 + j, rand, i); + + for (int k = -1; k <= 1; ++k) + { + for (int l = -1; l <= 1; ++l) + { + for (int i1 = -1; i1 <= 4; ++i1) + { + if (k != 0 || i1 != 0 || l != 0) + { + int j1 = 100; + + if (i1 > 1) + { + j1 += (i1 - 1) * 100; + } + + BlockPos blockpos = pos.add(k, i1, l); + int k1 = this.getNeighborEncouragement(worldIn, blockpos); + + if (k1 > 0) + { + int l1 = (k1 + 40 + worldIn.getDifficulty().getDifficultyId() * 7) / (i + 30); + + if (flag1) + { + l1 /= 2; + } + + if (l1 > 0 && rand.nextInt(j1) <= l1 && (!worldIn.isRaining() || !this.canDie(worldIn, blockpos))) + { + int i2 = i + rand.nextInt(5) / 4; + + if (i2 > 15) + { + i2 = 15; + } + + worldIn.setBlockState(blockpos, state.withProperty(AGE, Integer.valueOf(i2)), 3); + } + } + } + } + } + } + } + } + } + + protected boolean canDie(World worldIn, BlockPos pos) + { + return worldIn.canLightningStrike(pos) || worldIn.canLightningStrike(pos.west()) || worldIn.canLightningStrike(pos.east()) || worldIn.canLightningStrike(pos.north()) || worldIn.canLightningStrike(pos.south()); + } + + public boolean requiresUpdates() + { + return false; + } + + private int getFlammability(Block blockIn) + { + Integer integer = (Integer)this.flammabilities.get(blockIn); + return integer == null ? 0 : integer.intValue(); + } + + private int getEncouragement(Block blockIn) + { + Integer integer = (Integer)this.encouragements.get(blockIn); + return integer == null ? 0 : integer.intValue(); + } + + private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age) + { + int i = this.getFlammability(worldIn.getBlockState(pos).getBlock()); + + if (random.nextInt(chance) < i) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (random.nextInt(age + 10) < 5 && !worldIn.canLightningStrike(pos)) + { + int j = age + random.nextInt(5) / 4; + + if (j > 15) + { + j = 15; + } + + worldIn.setBlockState(pos, this.getDefaultState().withProperty(AGE, Integer.valueOf(j)), 3); + } + else + { + worldIn.setBlockToAir(pos); + } + + if (iblockstate.getBlock() == Blocks.tnt) + { + Blocks.tnt.onBlockDestroyedByPlayer(worldIn, pos, iblockstate.withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true))); + } + } + } + + private boolean canNeighborCatchFire(World worldIn, BlockPos pos) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + if (this.canCatchFire(worldIn, pos.offset(enumfacing))) + { + return true; + } + } + + return false; + } + + private int getNeighborEncouragement(World worldIn, BlockPos pos) + { + if (!worldIn.isAirBlock(pos)) + { + return 0; + } + else + { + int i = 0; + + for (EnumFacing enumfacing : EnumFacing.values()) + { + i = Math.max(this.getEncouragement(worldIn.getBlockState(pos.offset(enumfacing)).getBlock()), i); + } + + return i; + } + } + + /** + * Returns if this block is collidable (only used by Fire). Args: x, y, z + */ + public boolean isCollidable() + { + return false; + } + + /** + * Checks if the block can be caught on fire + */ + public boolean canCatchFire(IBlockAccess worldIn, BlockPos pos) + { + return this.getEncouragement(worldIn.getBlockState(pos).getBlock()) > 0; + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) || this.canNeighborCatchFire(worldIn, pos); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !this.canNeighborCatchFire(worldIn, pos)) + { + worldIn.setBlockToAir(pos); + } + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + if (worldIn.provider.getDimensionId() > 0 || !Blocks.portal.func_176548_d(worldIn, pos)) + { + if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !this.canNeighborCatchFire(worldIn, pos)) + { + worldIn.setBlockToAir(pos); + } + else + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn) + worldIn.rand.nextInt(10)); + } + } + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (rand.nextInt(24) == 0) + { + worldIn.playSound((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); + } + + if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down())) + { + if (Blocks.fire.canCatchFire(worldIn, pos.west())) + { + for (int j = 0; j < 2; ++j) + { + double d3 = (double)pos.getX() + rand.nextDouble() * 0.10000000149011612D; + double d8 = (double)pos.getY() + rand.nextDouble(); + double d13 = (double)pos.getZ() + rand.nextDouble(); + worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d3, d8, d13, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + if (Blocks.fire.canCatchFire(worldIn, pos.east())) + { + for (int k = 0; k < 2; ++k) + { + double d4 = (double)(pos.getX() + 1) - rand.nextDouble() * 0.10000000149011612D; + double d9 = (double)pos.getY() + rand.nextDouble(); + double d14 = (double)pos.getZ() + rand.nextDouble(); + worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d4, d9, d14, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + if (Blocks.fire.canCatchFire(worldIn, pos.north())) + { + for (int l = 0; l < 2; ++l) + { + double d5 = (double)pos.getX() + rand.nextDouble(); + double d10 = (double)pos.getY() + rand.nextDouble(); + double d15 = (double)pos.getZ() + rand.nextDouble() * 0.10000000149011612D; + worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d5, d10, d15, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + if (Blocks.fire.canCatchFire(worldIn, pos.south())) + { + for (int i1 = 0; i1 < 2; ++i1) + { + double d6 = (double)pos.getX() + rand.nextDouble(); + double d11 = (double)pos.getY() + rand.nextDouble(); + double d16 = (double)(pos.getZ() + 1) - rand.nextDouble() * 0.10000000149011612D; + worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d6, d11, d16, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + if (Blocks.fire.canCatchFire(worldIn, pos.up())) + { + for (int j1 = 0; j1 < 2; ++j1) + { + double d7 = (double)pos.getX() + rand.nextDouble(); + double d12 = (double)(pos.getY() + 1) - rand.nextDouble() * 0.10000000149011612D; + double d17 = (double)pos.getZ() + rand.nextDouble(); + worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d7, d12, d17, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + } + else + { + for (int i = 0; i < 3; ++i) + { + double d0 = (double)pos.getX() + rand.nextDouble(); + double d1 = (double)pos.getY() + rand.nextDouble() * 0.5D + 0.5D; + double d2 = (double)pos.getZ() + rand.nextDouble(); + worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return MapColor.tntColor; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(AGE)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockFlower.java b/src/minecraft/net/minecraft/block/BlockFlower.java new file mode 100644 index 0000000..ae1b8b6 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockFlower.java @@ -0,0 +1,196 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import com.google.common.collect.Collections2; +import com.google.common.collect.Lists; +import java.util.Collection; +import java.util.List; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IStringSerializable; + +public abstract class BlockFlower extends BlockBush +{ + protected PropertyEnum type; + + protected BlockFlower() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(this.getTypeProperty(), this.getBlockType() == BlockFlower.EnumFlowerColor.RED ? BlockFlower.EnumFlowerType.POPPY : BlockFlower.EnumFlowerType.DANDELION)); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockFlower.EnumFlowerType)state.getValue(this.getTypeProperty())).getMeta(); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (BlockFlower.EnumFlowerType blockflower$enumflowertype : BlockFlower.EnumFlowerType.getTypes(this.getBlockType())) + { + list.add(new ItemStack(itemIn, 1, blockflower$enumflowertype.getMeta())); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(this.getTypeProperty(), BlockFlower.EnumFlowerType.getType(this.getBlockType(), meta)); + } + + /** + * Get the Type of this flower (Yellow/Red) + */ + public abstract BlockFlower.EnumFlowerColor getBlockType(); + + public IProperty getTypeProperty() + { + if (this.type == null) + { + this.type = PropertyEnum.create("type", BlockFlower.EnumFlowerType.class, new Predicate() + { + public boolean apply(BlockFlower.EnumFlowerType p_apply_1_) + { + return p_apply_1_.getBlockType() == BlockFlower.this.getBlockType(); + } + }); + } + + return this.type; + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockFlower.EnumFlowerType)state.getValue(this.getTypeProperty())).getMeta(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {this.getTypeProperty()}); + } + + /** + * Get the OffsetType for this Block. Determines if the model is rendered slightly offset. + */ + public Block.EnumOffsetType getOffsetType() + { + return Block.EnumOffsetType.XZ; + } + + public static enum EnumFlowerColor + { + YELLOW, + RED; + + public BlockFlower getBlock() + { + return this == YELLOW ? Blocks.yellow_flower : Blocks.red_flower; + } + } + + public static enum EnumFlowerType implements IStringSerializable + { + DANDELION(BlockFlower.EnumFlowerColor.YELLOW, 0, "dandelion"), + POPPY(BlockFlower.EnumFlowerColor.RED, 0, "poppy"), + BLUE_ORCHID(BlockFlower.EnumFlowerColor.RED, 1, "blue_orchid", "blueOrchid"), + ALLIUM(BlockFlower.EnumFlowerColor.RED, 2, "allium"), + HOUSTONIA(BlockFlower.EnumFlowerColor.RED, 3, "houstonia"), + RED_TULIP(BlockFlower.EnumFlowerColor.RED, 4, "red_tulip", "tulipRed"), + ORANGE_TULIP(BlockFlower.EnumFlowerColor.RED, 5, "orange_tulip", "tulipOrange"), + WHITE_TULIP(BlockFlower.EnumFlowerColor.RED, 6, "white_tulip", "tulipWhite"), + PINK_TULIP(BlockFlower.EnumFlowerColor.RED, 7, "pink_tulip", "tulipPink"), + OXEYE_DAISY(BlockFlower.EnumFlowerColor.RED, 8, "oxeye_daisy", "oxeyeDaisy"); + + private static final BlockFlower.EnumFlowerType[][] TYPES_FOR_BLOCK = new BlockFlower.EnumFlowerType[BlockFlower.EnumFlowerColor.values().length][]; + private final BlockFlower.EnumFlowerColor blockType; + private final int meta; + private final String name; + private final String unlocalizedName; + + private EnumFlowerType(BlockFlower.EnumFlowerColor blockType, int meta, String name) + { + this(blockType, meta, name, name); + } + + private EnumFlowerType(BlockFlower.EnumFlowerColor blockType, int meta, String name, String unlocalizedName) + { + this.blockType = blockType; + this.meta = meta; + this.name = name; + this.unlocalizedName = unlocalizedName; + } + + public BlockFlower.EnumFlowerColor getBlockType() + { + return this.blockType; + } + + public int getMeta() + { + return this.meta; + } + + public static BlockFlower.EnumFlowerType getType(BlockFlower.EnumFlowerColor blockType, int meta) + { + BlockFlower.EnumFlowerType[] ablockflower$enumflowertype = TYPES_FOR_BLOCK[blockType.ordinal()]; + + if (meta < 0 || meta >= ablockflower$enumflowertype.length) + { + meta = 0; + } + + return ablockflower$enumflowertype[meta]; + } + + public static BlockFlower.EnumFlowerType[] getTypes(BlockFlower.EnumFlowerColor flowerColor) + { + return TYPES_FOR_BLOCK[flowerColor.ordinal()]; + } + + public String toString() + { + return this.name; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + static { + for (final BlockFlower.EnumFlowerColor blockflower$enumflowercolor : BlockFlower.EnumFlowerColor.values()) + { + Collection collection = Collections2.filter(Lists.newArrayList(values()), new Predicate() + { + public boolean apply(BlockFlower.EnumFlowerType p_apply_1_) + { + return p_apply_1_.getBlockType() == blockflower$enumflowercolor; + } + }); + TYPES_FOR_BLOCK[blockflower$enumflowercolor.ordinal()] = (BlockFlower.EnumFlowerType[])collection.toArray(new BlockFlower.EnumFlowerType[collection.size()]); + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockFlowerPot.java b/src/minecraft/net/minecraft/block/BlockFlowerPot.java new file mode 100644 index 0000000..a896aa2 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockFlowerPot.java @@ -0,0 +1,494 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityFlowerPot; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.StatCollector; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockFlowerPot extends BlockContainer +{ + public static final PropertyInteger LEGACY_DATA = PropertyInteger.create("legacy_data", 0, 15); + public static final PropertyEnum CONTENTS = PropertyEnum.create("contents", BlockFlowerPot.EnumFlowerType.class); + + public BlockFlowerPot() + { + super(Material.circuits); + this.setDefaultState(this.blockState.getBaseState().withProperty(CONTENTS, BlockFlowerPot.EnumFlowerType.EMPTY).withProperty(LEGACY_DATA, Integer.valueOf(0))); + this.setBlockBoundsForItemRender(); + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal("item.flowerPot.name"); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + float f = 0.375F; + float f1 = f / 2.0F; + this.setBlockBounds(0.5F - f1, 0.0F, 0.5F - f1, 0.5F + f1, f, 0.5F + f1); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + public boolean isFullCube() + { + return false; + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityFlowerPot) + { + Item item = ((TileEntityFlowerPot)tileentity).getFlowerPotItem(); + + if (item instanceof ItemBlock) + { + return Block.getBlockFromItem(item).colorMultiplier(worldIn, pos, renderPass); + } + } + + return 16777215; + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + ItemStack itemstack = playerIn.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() instanceof ItemBlock) + { + TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); + + if (tileentityflowerpot == null) + { + return false; + } + else if (tileentityflowerpot.getFlowerPotItem() != null) + { + return false; + } + else + { + Block block = Block.getBlockFromItem(itemstack.getItem()); + + if (!this.canNotContain(block, itemstack.getMetadata())) + { + return false; + } + else + { + tileentityflowerpot.setFlowerPotData(itemstack.getItem(), itemstack.getMetadata()); + tileentityflowerpot.markDirty(); + worldIn.markBlockForUpdate(pos); + playerIn.triggerAchievement(StatList.field_181736_T); + + if (!playerIn.capabilities.isCreativeMode && --itemstack.stackSize <= 0) + { + playerIn.inventory.setInventorySlotContents(playerIn.inventory.currentItem, (ItemStack)null); + } + + return true; + } + } + } + else + { + return false; + } + } + + private boolean canNotContain(Block blockIn, int meta) + { + return blockIn != Blocks.yellow_flower && blockIn != Blocks.red_flower && blockIn != Blocks.cactus && blockIn != Blocks.brown_mushroom && blockIn != Blocks.red_mushroom && blockIn != Blocks.sapling && blockIn != Blocks.deadbush ? blockIn == Blocks.tallgrass && meta == BlockTallGrass.EnumType.FERN.getMeta() : true; + } + + public Item getItem(World worldIn, BlockPos pos) + { + TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); + return tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null ? tileentityflowerpot.getFlowerPotItem() : Items.flower_pot; + } + + public int getDamageValue(World worldIn, BlockPos pos) + { + TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); + return tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null ? tileentityflowerpot.getFlowerPotData() : 0; + } + + /** + * Returns true only if block is flowerPot + */ + public boolean isFlowerPot() + { + return true; + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return super.canPlaceBlockAt(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down())) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); + + if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null) + { + spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData())); + } + + super.breakBlock(worldIn, pos, state); + } + + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + super.onBlockHarvested(worldIn, pos, state, player); + + if (player.capabilities.isCreativeMode) + { + TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos); + + if (tileentityflowerpot != null) + { + tileentityflowerpot.setFlowerPotData((Item)null, 0); + } + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.flower_pot; + } + + private TileEntityFlowerPot getTileEntity(World worldIn, BlockPos pos) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + return tileentity instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)tileentity : null; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + Block block = null; + int i = 0; + + switch (meta) + { + case 1: + block = Blocks.red_flower; + i = BlockFlower.EnumFlowerType.POPPY.getMeta(); + break; + + case 2: + block = Blocks.yellow_flower; + break; + + case 3: + block = Blocks.sapling; + i = BlockPlanks.EnumType.OAK.getMetadata(); + break; + + case 4: + block = Blocks.sapling; + i = BlockPlanks.EnumType.SPRUCE.getMetadata(); + break; + + case 5: + block = Blocks.sapling; + i = BlockPlanks.EnumType.BIRCH.getMetadata(); + break; + + case 6: + block = Blocks.sapling; + i = BlockPlanks.EnumType.JUNGLE.getMetadata(); + break; + + case 7: + block = Blocks.red_mushroom; + break; + + case 8: + block = Blocks.brown_mushroom; + break; + + case 9: + block = Blocks.cactus; + break; + + case 10: + block = Blocks.deadbush; + break; + + case 11: + block = Blocks.tallgrass; + i = BlockTallGrass.EnumType.FERN.getMeta(); + break; + + case 12: + block = Blocks.sapling; + i = BlockPlanks.EnumType.ACACIA.getMetadata(); + break; + + case 13: + block = Blocks.sapling; + i = BlockPlanks.EnumType.DARK_OAK.getMetadata(); + } + + return new TileEntityFlowerPot(Item.getItemFromBlock(block), i); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {CONTENTS, LEGACY_DATA}); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(LEGACY_DATA)).intValue(); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + BlockFlowerPot.EnumFlowerType blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.EMPTY; + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityFlowerPot) + { + TileEntityFlowerPot tileentityflowerpot = (TileEntityFlowerPot)tileentity; + Item item = tileentityflowerpot.getFlowerPotItem(); + + if (item instanceof ItemBlock) + { + int i = tileentityflowerpot.getFlowerPotData(); + Block block = Block.getBlockFromItem(item); + + if (block == Blocks.sapling) + { + switch (BlockPlanks.EnumType.byMetadata(i)) + { + case OAK: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.OAK_SAPLING; + break; + + case SPRUCE: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.SPRUCE_SAPLING; + break; + + case BIRCH: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.BIRCH_SAPLING; + break; + + case JUNGLE: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.JUNGLE_SAPLING; + break; + + case ACACIA: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.ACACIA_SAPLING; + break; + + case DARK_OAK: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.DARK_OAK_SAPLING; + break; + + default: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.EMPTY; + } + } + else if (block == Blocks.tallgrass) + { + switch (i) + { + case 0: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.DEAD_BUSH; + break; + + case 2: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.FERN; + break; + + default: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.EMPTY; + } + } + else if (block == Blocks.yellow_flower) + { + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.DANDELION; + } + else if (block == Blocks.red_flower) + { + switch (BlockFlower.EnumFlowerType.getType(BlockFlower.EnumFlowerColor.RED, i)) + { + case POPPY: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.POPPY; + break; + + case BLUE_ORCHID: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.BLUE_ORCHID; + break; + + case ALLIUM: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.ALLIUM; + break; + + case HOUSTONIA: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.HOUSTONIA; + break; + + case RED_TULIP: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.RED_TULIP; + break; + + case ORANGE_TULIP: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.ORANGE_TULIP; + break; + + case WHITE_TULIP: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.WHITE_TULIP; + break; + + case PINK_TULIP: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.PINK_TULIP; + break; + + case OXEYE_DAISY: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.OXEYE_DAISY; + break; + + default: + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.EMPTY; + } + } + else if (block == Blocks.red_mushroom) + { + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.MUSHROOM_RED; + } + else if (block == Blocks.brown_mushroom) + { + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.MUSHROOM_BROWN; + } + else if (block == Blocks.deadbush) + { + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.DEAD_BUSH; + } + else if (block == Blocks.cactus) + { + blockflowerpot$enumflowertype = BlockFlowerPot.EnumFlowerType.CACTUS; + } + } + } + + return state.withProperty(CONTENTS, blockflowerpot$enumflowertype); + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + public static enum EnumFlowerType implements IStringSerializable + { + EMPTY("empty"), + POPPY("rose"), + BLUE_ORCHID("blue_orchid"), + ALLIUM("allium"), + HOUSTONIA("houstonia"), + RED_TULIP("red_tulip"), + ORANGE_TULIP("orange_tulip"), + WHITE_TULIP("white_tulip"), + PINK_TULIP("pink_tulip"), + OXEYE_DAISY("oxeye_daisy"), + DANDELION("dandelion"), + OAK_SAPLING("oak_sapling"), + SPRUCE_SAPLING("spruce_sapling"), + BIRCH_SAPLING("birch_sapling"), + JUNGLE_SAPLING("jungle_sapling"), + ACACIA_SAPLING("acacia_sapling"), + DARK_OAK_SAPLING("dark_oak_sapling"), + MUSHROOM_RED("mushroom_red"), + MUSHROOM_BROWN("mushroom_brown"), + DEAD_BUSH("dead_bush"), + FERN("fern"), + CACTUS("cactus"); + + private final String name; + + private EnumFlowerType(String name) + { + this.name = name; + } + + public String toString() + { + return this.name; + } + + public String getName() + { + return this.name; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockFurnace.java b/src/minecraft/net/minecraft/block/BlockFurnace.java new file mode 100644 index 0000000..87bd6f2 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockFurnace.java @@ -0,0 +1,272 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryHelper; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityFurnace; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class BlockFurnace extends BlockContainer +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + private final boolean isBurning; + private static boolean keepInventory; + + protected BlockFurnace(boolean isBurning) + { + super(Material.rock); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); + this.isBurning = isBurning; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Item.getItemFromBlock(Blocks.furnace); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + this.setDefaultFacing(worldIn, pos, state); + } + + private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isRemote) + { + Block block = worldIn.getBlockState(pos.north()).getBlock(); + Block block1 = worldIn.getBlockState(pos.south()).getBlock(); + Block block2 = worldIn.getBlockState(pos.west()).getBlock(); + Block block3 = worldIn.getBlockState(pos.east()).getBlock(); + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + + if (enumfacing == EnumFacing.NORTH && block.isFullBlock() && !block1.isFullBlock()) + { + enumfacing = EnumFacing.SOUTH; + } + else if (enumfacing == EnumFacing.SOUTH && block1.isFullBlock() && !block.isFullBlock()) + { + enumfacing = EnumFacing.NORTH; + } + else if (enumfacing == EnumFacing.WEST && block2.isFullBlock() && !block3.isFullBlock()) + { + enumfacing = EnumFacing.EAST; + } + else if (enumfacing == EnumFacing.EAST && block3.isFullBlock() && !block2.isFullBlock()) + { + enumfacing = EnumFacing.WEST; + } + + worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2); + } + } + + @SuppressWarnings("incomplete-switch") + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (this.isBurning) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + double d0 = (double)pos.getX() + 0.5D; + double d1 = (double)pos.getY() + rand.nextDouble() * 6.0D / 16.0D; + double d2 = (double)pos.getZ() + 0.5D; + double d3 = 0.52D; + double d4 = rand.nextDouble() * 0.6D - 0.3D; + + switch (enumfacing) + { + case WEST: + worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); + worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); + break; + + case EAST: + worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); + worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); + break; + + case NORTH: + worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D, new int[0]); + worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D, new int[0]); + break; + + case SOUTH: + worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D, new int[0]); + worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityFurnace) + { + playerIn.displayGUIChest((TileEntityFurnace)tileentity); + playerIn.triggerAchievement(StatList.field_181741_Y); + } + + return true; + } + } + + public static void setState(boolean active, World worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + TileEntity tileentity = worldIn.getTileEntity(pos); + keepInventory = true; + + if (active) + { + worldIn.setBlockState(pos, Blocks.lit_furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); + worldIn.setBlockState(pos, Blocks.lit_furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); + } + else + { + worldIn.setBlockState(pos, Blocks.furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); + worldIn.setBlockState(pos, Blocks.furnace.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); + } + + keepInventory = false; + + if (tileentity != null) + { + tileentity.validate(); + worldIn.setTileEntity(pos, tileentity); + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityFurnace(); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2); + + if (stack.hasDisplayName()) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityFurnace) + { + ((TileEntityFurnace)tileentity).setCustomInventoryName(stack.getDisplayName()); + } + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + if (!keepInventory) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityFurnace) + { + InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityFurnace)tileentity); + worldIn.updateComparatorOutputLevel(pos, this); + } + } + + super.breakBlock(worldIn, pos, state); + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World worldIn, BlockPos pos) + { + return Container.calcRedstone(worldIn.getTileEntity(pos)); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Item.getItemFromBlock(Blocks.furnace); + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + /** + * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...) + */ + public IBlockState getStateForEntityRender(IBlockState state) + { + return this.getDefaultState().withProperty(FACING, EnumFacing.SOUTH); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + EnumFacing enumfacing = EnumFacing.getFront(meta); + + if (enumfacing.getAxis() == EnumFacing.Axis.Y) + { + enumfacing = EnumFacing.NORTH; + } + + return this.getDefaultState().withProperty(FACING, enumfacing); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((EnumFacing)state.getValue(FACING)).getIndex(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockGlass.java b/src/minecraft/net/minecraft/block/BlockGlass.java new file mode 100644 index 0000000..ffe49a5 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockGlass.java @@ -0,0 +1,38 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.util.EnumWorldBlockLayer; + +public class BlockGlass extends BlockBreakable +{ + public BlockGlass(Material materialIn, boolean ignoreSimilarity) + { + super(materialIn, ignoreSimilarity); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + public boolean isFullCube() + { + return false; + } + + protected boolean canSilkHarvest() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockGlowstone.java b/src/minecraft/net/minecraft/block/BlockGlowstone.java new file mode 100644 index 0000000..56f9602 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockGlowstone.java @@ -0,0 +1,51 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.MathHelper; + +public class BlockGlowstone extends Block +{ + public BlockGlowstone(Material materialIn) + { + super(materialIn); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the quantity dropped based on the given fortune level + */ + public int quantityDroppedWithBonus(int fortune, Random random) + { + return MathHelper.clamp_int(this.quantityDropped(random) + random.nextInt(fortune + 1), 1, 4); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 2 + random.nextInt(3); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.glowstone_dust; + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return MapColor.sandColor; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockGrass.java b/src/minecraft/net/minecraft/block/BlockGrass.java new file mode 100644 index 0000000..748716e --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockGrass.java @@ -0,0 +1,174 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.ColorizerGrass; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeColorHelper; + +public class BlockGrass extends Block implements IGrowable +{ + public static final PropertyBool SNOWY = PropertyBool.create("snowy"); + + protected BlockGrass() + { + super(Material.grass); + this.setDefaultState(this.blockState.getBaseState().withProperty(SNOWY, Boolean.valueOf(false))); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.up()).getBlock(); + return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); + } + + public int getBlockColor() + { + return ColorizerGrass.getGrassColor(0.5D, 1.0D); + } + + public int getRenderColor(IBlockState state) + { + return this.getBlockColor(); + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return BiomeColorHelper.getGrassColorAtPos(worldIn, pos); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!worldIn.isRemote) + { + if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); + } + else + { + if (worldIn.getLightFromNeighbors(pos.up()) >= 9) + { + for (int i = 0; i < 4; ++i) + { + BlockPos blockpos = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1); + Block block = worldIn.getBlockState(blockpos.up()).getBlock(); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) + { + worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState()); + } + } + } + } + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Blocks.dirt.getItemDropped(Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), rand, fortune); + } + + /** + * Whether this IGrowable can grow + */ + public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) + { + return true; + } + + public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + return true; + } + + public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + BlockPos blockpos = pos.up(); + + for (int i = 0; i < 128; ++i) + { + BlockPos blockpos1 = blockpos; + int j = 0; + + while (true) + { + if (j >= i / 16) + { + if (worldIn.getBlockState(blockpos1).getBlock().blockMaterial == Material.air) + { + if (rand.nextInt(8) == 0) + { + BlockFlower.EnumFlowerType blockflower$enumflowertype = worldIn.getBiomeGenForCoords(blockpos1).pickRandomFlower(rand, blockpos1); + BlockFlower blockflower = blockflower$enumflowertype.getBlockType().getBlock(); + IBlockState iblockstate = blockflower.getDefaultState().withProperty(blockflower.getTypeProperty(), blockflower$enumflowertype); + + if (blockflower.canBlockStay(worldIn, blockpos1, iblockstate)) + { + worldIn.setBlockState(blockpos1, iblockstate, 3); + } + } + else + { + IBlockState iblockstate1 = Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.GRASS); + + if (Blocks.tallgrass.canBlockStay(worldIn, blockpos1, iblockstate1)) + { + worldIn.setBlockState(blockpos1, iblockstate1, 3); + } + } + } + + break; + } + + blockpos1 = blockpos1.add(rand.nextInt(3) - 1, (rand.nextInt(3) - 1) * rand.nextInt(3) / 2, rand.nextInt(3) - 1); + + if (worldIn.getBlockState(blockpos1.down()).getBlock() != Blocks.grass || worldIn.getBlockState(blockpos1).getBlock().isNormalCube()) + { + break; + } + + ++j; + } + } + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT_MIPPED; + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return 0; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {SNOWY}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockGravel.java b/src/minecraft/net/minecraft/block/BlockGravel.java new file mode 100644 index 0000000..015244f --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockGravel.java @@ -0,0 +1,31 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Items; +import net.minecraft.item.Item; + +public class BlockGravel extends BlockFalling +{ + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + if (fortune > 3) + { + fortune = 3; + } + + return rand.nextInt(10 - fortune * 3) == 0 ? Items.flint : Item.getItemFromBlock(this); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return MapColor.stoneColor; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockHalfStoneSlab.java b/src/minecraft/net/minecraft/block/BlockHalfStoneSlab.java new file mode 100644 index 0000000..d4c4565 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockHalfStoneSlab.java @@ -0,0 +1,9 @@ +package net.minecraft.block; + +public class BlockHalfStoneSlab extends BlockStoneSlab +{ + public boolean isDouble() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockHalfStoneSlabNew.java b/src/minecraft/net/minecraft/block/BlockHalfStoneSlabNew.java new file mode 100644 index 0000000..52105ab --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockHalfStoneSlabNew.java @@ -0,0 +1,9 @@ +package net.minecraft.block; + +public class BlockHalfStoneSlabNew extends BlockStoneSlabNew +{ + public boolean isDouble() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockHalfWoodSlab.java b/src/minecraft/net/minecraft/block/BlockHalfWoodSlab.java new file mode 100644 index 0000000..3422084 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockHalfWoodSlab.java @@ -0,0 +1,9 @@ +package net.minecraft.block; + +public class BlockHalfWoodSlab extends BlockWoodSlab +{ + public boolean isDouble() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockHardenedClay.java b/src/minecraft/net/minecraft/block/BlockHardenedClay.java new file mode 100644 index 0000000..3f2f7ee --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockHardenedClay.java @@ -0,0 +1,23 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; + +public class BlockHardenedClay extends Block +{ + public BlockHardenedClay() + { + super(Material.rock); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return MapColor.adobeColor; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockHay.java b/src/minecraft/net/minecraft/block/BlockHay.java new file mode 100644 index 0000000..dc07178 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockHay.java @@ -0,0 +1,83 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class BlockHay extends BlockRotatedPillar +{ + public BlockHay() + { + super(Material.grass, MapColor.yellowColor); + this.setDefaultState(this.blockState.getBaseState().withProperty(AXIS, EnumFacing.Axis.Y)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Y; + int i = meta & 12; + + if (i == 4) + { + enumfacing$axis = EnumFacing.Axis.X; + } + else if (i == 8) + { + enumfacing$axis = EnumFacing.Axis.Z; + } + + return this.getDefaultState().withProperty(AXIS, enumfacing$axis); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)state.getValue(AXIS); + + if (enumfacing$axis == EnumFacing.Axis.X) + { + i |= 4; + } + else if (enumfacing$axis == EnumFacing.Axis.Z) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {AXIS}); + } + + protected ItemStack createStackedBlock(IBlockState state) + { + return new ItemStack(Item.getItemFromBlock(this), 1, 0); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(AXIS, facing.getAxis()); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockHopper.java b/src/minecraft/net/minecraft/block/BlockHopper.java new file mode 100644 index 0000000..9201f6a --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockHopper.java @@ -0,0 +1,253 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryHelper; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityHopper; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockHopper extends BlockContainer +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", new Predicate() + { + public boolean apply(EnumFacing p_apply_1_) + { + return p_apply_1_ != EnumFacing.UP; + } + }); + public static final PropertyBool ENABLED = PropertyBool.create("enabled"); + + public BlockHopper() + { + super(Material.iron, MapColor.stoneColor); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.DOWN).withProperty(ENABLED, Boolean.valueOf(true))); + this.setCreativeTab(CreativeTabs.tabRedstone); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + float f = 0.125F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + EnumFacing enumfacing = facing.getOpposite(); + + if (enumfacing == EnumFacing.UP) + { + enumfacing = EnumFacing.DOWN; + } + + return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(ENABLED, Boolean.valueOf(true)); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityHopper(); + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + super.onBlockPlacedBy(worldIn, pos, state, placer, stack); + + if (stack.hasDisplayName()) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityHopper) + { + ((TileEntityHopper)tileentity).setCustomName(stack.getDisplayName()); + } + } + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + this.updateState(worldIn, pos, state); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityHopper) + { + playerIn.displayGUIChest((TileEntityHopper)tileentity); + playerIn.triggerAchievement(StatList.field_181732_P); + } + + return true; + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + this.updateState(worldIn, pos, state); + } + + private void updateState(World worldIn, BlockPos pos, IBlockState state) + { + boolean flag = !worldIn.isBlockPowered(pos); + + if (flag != ((Boolean)state.getValue(ENABLED)).booleanValue()) + { + worldIn.setBlockState(pos, state.withProperty(ENABLED, Boolean.valueOf(flag)), 4); + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityHopper) + { + InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityHopper)tileentity); + worldIn.updateComparatorOutputLevel(pos, this); + } + + super.breakBlock(worldIn, pos, state); + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return true; + } + + public static EnumFacing getFacing(int meta) + { + return EnumFacing.getFront(meta & 7); + } + + /** + * Get's the hopper's active status from the 8-bit of the metadata. Note that the metadata stores whether the block + * is powered, so this returns true when that bit is 0. + */ + public static boolean isEnabled(int meta) + { + return (meta & 8) != 8; + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World worldIn, BlockPos pos) + { + return Container.calcRedstone(worldIn.getTileEntity(pos)); + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT_MIPPED; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, getFacing(meta)).withProperty(ENABLED, Boolean.valueOf(isEnabled(meta))); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getIndex(); + + if (!((Boolean)state.getValue(ENABLED)).booleanValue()) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, ENABLED}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockHugeMushroom.java b/src/minecraft/net/minecraft/block/BlockHugeMushroom.java new file mode 100644 index 0000000..857c33b --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockHugeMushroom.java @@ -0,0 +1,160 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.World; + +public class BlockHugeMushroom extends Block +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockHugeMushroom.EnumType.class); + private final Block smallBlock; + + public BlockHugeMushroom(Material p_i46392_1_, MapColor p_i46392_2_, Block p_i46392_3_) + { + super(p_i46392_1_, p_i46392_2_); + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockHugeMushroom.EnumType.ALL_OUTSIDE)); + this.smallBlock = p_i46392_3_; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return Math.max(0, random.nextInt(10) - 7); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + switch ((BlockHugeMushroom.EnumType)state.getValue(VARIANT)) + { + case ALL_STEM: + return MapColor.clothColor; + + case ALL_INSIDE: + return MapColor.sandColor; + + case STEM: + return MapColor.sandColor; + + default: + return super.getMapColor(state); + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Item.getItemFromBlock(this.smallBlock); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Item.getItemFromBlock(this.smallBlock); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState(); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(VARIANT, BlockHugeMushroom.EnumType.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockHugeMushroom.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT}); + } + + public static enum EnumType implements IStringSerializable + { + NORTH_WEST(1, "north_west"), + NORTH(2, "north"), + NORTH_EAST(3, "north_east"), + WEST(4, "west"), + CENTER(5, "center"), + EAST(6, "east"), + SOUTH_WEST(7, "south_west"), + SOUTH(8, "south"), + SOUTH_EAST(9, "south_east"), + STEM(10, "stem"), + ALL_INSIDE(0, "all_inside"), + ALL_OUTSIDE(14, "all_outside"), + ALL_STEM(15, "all_stem"); + + private static final BlockHugeMushroom.EnumType[] META_LOOKUP = new BlockHugeMushroom.EnumType[16]; + private final int meta; + private final String name; + + private EnumType(int meta, String name) + { + this.meta = meta; + this.name = name; + } + + public int getMetadata() + { + return this.meta; + } + + public String toString() + { + return this.name; + } + + public static BlockHugeMushroom.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + BlockHugeMushroom.EnumType blockhugemushroom$enumtype = META_LOOKUP[meta]; + return blockhugemushroom$enumtype == null ? META_LOOKUP[0] : blockhugemushroom$enumtype; + } + + public String getName() + { + return this.name; + } + + static { + for (BlockHugeMushroom.EnumType blockhugemushroom$enumtype : values()) + { + META_LOOKUP[blockhugemushroom$enumtype.getMetadata()] = blockhugemushroom$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockIce.java b/src/minecraft/net/minecraft/block/BlockIce.java new file mode 100644 index 0000000..58a377d --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockIce.java @@ -0,0 +1,94 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.World; + +public class BlockIce extends BlockBreakable +{ + public BlockIce() + { + super(Material.ice, false); + this.slipperiness = 0.98F; + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.TRANSLUCENT; + } + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + player.addExhaustion(0.025F); + + if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) + { + ItemStack itemstack = this.createStackedBlock(state); + + if (itemstack != null) + { + spawnAsEntity(worldIn, pos, itemstack); + } + } + else + { + if (worldIn.provider.doesWaterVaporize()) + { + worldIn.setBlockToAir(pos); + return; + } + + int i = EnchantmentHelper.getFortuneModifier(player); + this.dropBlockAsItem(worldIn, pos, state, i); + Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial(); + + if (material.blocksMovement() || material.isLiquid()) + { + worldIn.setBlockState(pos, Blocks.flowing_water.getDefaultState()); + } + } + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11 - this.getLightOpacity()) + { + if (worldIn.provider.doesWaterVaporize()) + { + worldIn.setBlockToAir(pos); + } + else + { + this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); + worldIn.setBlockState(pos, Blocks.water.getDefaultState()); + } + } + } + + public int getMobilityFlag() + { + return 0; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockJukebox.java b/src/minecraft/net/minecraft/block/BlockJukebox.java new file mode 100644 index 0000000..b93a9b9 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockJukebox.java @@ -0,0 +1,205 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class BlockJukebox extends BlockContainer +{ + public static final PropertyBool HAS_RECORD = PropertyBool.create("has_record"); + + protected BlockJukebox() + { + super(Material.wood, MapColor.dirtColor); + this.setDefaultState(this.blockState.getBaseState().withProperty(HAS_RECORD, Boolean.valueOf(false))); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (((Boolean)state.getValue(HAS_RECORD)).booleanValue()) + { + this.dropRecord(worldIn, pos, state); + state = state.withProperty(HAS_RECORD, Boolean.valueOf(false)); + worldIn.setBlockState(pos, state, 2); + return true; + } + else + { + return false; + } + } + + public void insertRecord(World worldIn, BlockPos pos, IBlockState state, ItemStack recordStack) + { + if (!worldIn.isRemote) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof BlockJukebox.TileEntityJukebox) + { + ((BlockJukebox.TileEntityJukebox)tileentity).setRecord(new ItemStack(recordStack.getItem(), 1, recordStack.getMetadata())); + worldIn.setBlockState(pos, state.withProperty(HAS_RECORD, Boolean.valueOf(true)), 2); + } + } + } + + private void dropRecord(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isRemote) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof BlockJukebox.TileEntityJukebox) + { + BlockJukebox.TileEntityJukebox blockjukebox$tileentityjukebox = (BlockJukebox.TileEntityJukebox)tileentity; + ItemStack itemstack = blockjukebox$tileentityjukebox.getRecord(); + + if (itemstack != null) + { + worldIn.playAuxSFX(1005, pos, 0); + worldIn.playRecord(pos, (String)null); + blockjukebox$tileentityjukebox.setRecord((ItemStack)null); + float f = 0.7F; + double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.2D + 0.6D; + double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D; + ItemStack itemstack1 = itemstack.copy(); + EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, itemstack1); + entityitem.setDefaultPickupDelay(); + worldIn.spawnEntityInWorld(entityitem); + } + } + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + this.dropRecord(worldIn, pos, state); + super.breakBlock(worldIn, pos, state); + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + if (!worldIn.isRemote) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new BlockJukebox.TileEntityJukebox(); + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World worldIn, BlockPos pos) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof BlockJukebox.TileEntityJukebox) + { + ItemStack itemstack = ((BlockJukebox.TileEntityJukebox)tileentity).getRecord(); + + if (itemstack != null) + { + return Item.getIdFromItem(itemstack.getItem()) + 1 - Item.getIdFromItem(Items.record_13); + } + } + + return 0; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(HAS_RECORD, Boolean.valueOf(meta > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Boolean)state.getValue(HAS_RECORD)).booleanValue() ? 1 : 0; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {HAS_RECORD}); + } + + public static class TileEntityJukebox extends TileEntity + { + private ItemStack record; + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + + if (compound.hasKey("RecordItem", 10)) + { + this.setRecord(ItemStack.loadItemStackFromNBT(compound.getCompoundTag("RecordItem"))); + } + else if (compound.getInteger("Record") > 0) + { + this.setRecord(new ItemStack(Item.getItemById(compound.getInteger("Record")), 1, 0)); + } + } + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + + if (this.getRecord() != null) + { + compound.setTag("RecordItem", this.getRecord().writeToNBT(new NBTTagCompound())); + } + } + + public ItemStack getRecord() + { + return this.record; + } + + public void setRecord(ItemStack recordStack) + { + this.record = recordStack; + this.markDirty(); + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockLadder.java b/src/minecraft/net/minecraft/block/BlockLadder.java new file mode 100644 index 0000000..5413bdb --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockLadder.java @@ -0,0 +1,164 @@ +package net.minecraft.block; + +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockLadder extends Block +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + + protected BlockLadder() + { + super(Material.circuits); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getCollisionBoundingBox(worldIn, pos, state); + } + + public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getSelectedBoundingBox(worldIn, pos); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == this) + { + float f = 0.125F; + + switch ((EnumFacing)iblockstate.getValue(FACING)) + { + case NORTH: + this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + break; + + case SOUTH: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); + break; + + case WEST: + this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + + case EAST: + default: + this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); + } + } + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return worldIn.getBlockState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getBlockState(pos.south()).getBlock().isNormalCube())); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + if (facing.getAxis().isHorizontal() && this.canBlockStay(worldIn, pos, facing)) + { + return this.getDefaultState().withProperty(FACING, facing); + } + else + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (this.canBlockStay(worldIn, pos, (EnumFacing) enumfacing)) + { + return this.getDefaultState().withProperty(FACING, (EnumFacing)enumfacing); + } + } + + return this.getDefaultState(); + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + + if (!this.canBlockStay(worldIn, pos, enumfacing)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + + super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + } + + protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing) + { + return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube(); + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + EnumFacing enumfacing = EnumFacing.getFront(meta); + + if (enumfacing.getAxis() == EnumFacing.Axis.Y) + { + enumfacing = EnumFacing.NORTH; + } + + return this.getDefaultState().withProperty(FACING, enumfacing); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((EnumFacing)state.getValue(FACING)).getIndex(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockLeaves.java b/src/minecraft/net/minecraft/block/BlockLeaves.java new file mode 100644 index 0000000..265c5bc --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockLeaves.java @@ -0,0 +1,304 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.ColorizerFoliage; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeColorHelper; + +public abstract class BlockLeaves extends BlockLeavesBase +{ + public static final PropertyBool DECAYABLE = PropertyBool.create("decayable"); + public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay"); + int[] surroundings; + protected int iconIndex; + protected boolean isTransparent; + + public BlockLeaves() + { + super(Material.leaves, false); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabDecorations); + this.setHardness(0.2F); + this.setLightOpacity(1); + this.setStepSound(soundTypeGrass); + } + + public int getBlockColor() + { + return ColorizerFoliage.getFoliageColor(0.5D, 1.0D); + } + + public int getRenderColor(IBlockState state) + { + return ColorizerFoliage.getFoliageColorBasic(); + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return BiomeColorHelper.getFoliageColorAtPos(worldIn, pos); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + int i = 1; + int j = i + 1; + int k = pos.getX(); + int l = pos.getY(); + int i1 = pos.getZ(); + + if (worldIn.isAreaLoaded(new BlockPos(k - j, l - j, i1 - j), new BlockPos(k + j, l + j, i1 + j))) + { + for (int j1 = -i; j1 <= i; ++j1) + { + for (int k1 = -i; k1 <= i; ++k1) + { + for (int l1 = -i; l1 <= i; ++l1) + { + BlockPos blockpos = pos.add(j1, k1, l1); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue()) + { + worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4); + } + } + } + } + } + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!worldIn.isRemote) + { + if (((Boolean)state.getValue(CHECK_DECAY)).booleanValue() && ((Boolean)state.getValue(DECAYABLE)).booleanValue()) + { + int i = 4; + int j = i + 1; + int k = pos.getX(); + int l = pos.getY(); + int i1 = pos.getZ(); + int j1 = 32; + int k1 = j1 * j1; + int l1 = j1 / 2; + + if (this.surroundings == null) + { + this.surroundings = new int[j1 * j1 * j1]; + } + + if (worldIn.isAreaLoaded(new BlockPos(k - j, l - j, i1 - j), new BlockPos(k + j, l + j, i1 + j))) + { + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int i2 = -i; i2 <= i; ++i2) + { + for (int j2 = -i; j2 <= i; ++j2) + { + for (int k2 = -i; k2 <= i; ++k2) + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)).getBlock(); + + if (block != Blocks.log && block != Blocks.log2) + { + if (block.getMaterial() == Material.leaves) + { + this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2; + } + else + { + this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -1; + } + } + else + { + this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = 0; + } + } + } + } + + for (int i3 = 1; i3 <= 4; ++i3) + { + for (int j3 = -i; j3 <= i; ++j3) + { + for (int k3 = -i; k3 <= i; ++k3) + { + for (int l3 = -i; l3 <= i; ++l3) + { + if (this.surroundings[(j3 + l1) * k1 + (k3 + l1) * j1 + l3 + l1] == i3 - 1) + { + if (this.surroundings[(j3 + l1 - 1) * k1 + (k3 + l1) * j1 + l3 + l1] == -2) + { + this.surroundings[(j3 + l1 - 1) * k1 + (k3 + l1) * j1 + l3 + l1] = i3; + } + + if (this.surroundings[(j3 + l1 + 1) * k1 + (k3 + l1) * j1 + l3 + l1] == -2) + { + this.surroundings[(j3 + l1 + 1) * k1 + (k3 + l1) * j1 + l3 + l1] = i3; + } + + if (this.surroundings[(j3 + l1) * k1 + (k3 + l1 - 1) * j1 + l3 + l1] == -2) + { + this.surroundings[(j3 + l1) * k1 + (k3 + l1 - 1) * j1 + l3 + l1] = i3; + } + + if (this.surroundings[(j3 + l1) * k1 + (k3 + l1 + 1) * j1 + l3 + l1] == -2) + { + this.surroundings[(j3 + l1) * k1 + (k3 + l1 + 1) * j1 + l3 + l1] = i3; + } + + if (this.surroundings[(j3 + l1) * k1 + (k3 + l1) * j1 + (l3 + l1 - 1)] == -2) + { + this.surroundings[(j3 + l1) * k1 + (k3 + l1) * j1 + (l3 + l1 - 1)] = i3; + } + + if (this.surroundings[(j3 + l1) * k1 + (k3 + l1) * j1 + l3 + l1 + 1] == -2) + { + this.surroundings[(j3 + l1) * k1 + (k3 + l1) * j1 + l3 + l1 + 1] = i3; + } + } + } + } + } + } + } + + int l2 = this.surroundings[l1 * k1 + l1 * j1 + l1]; + + if (l2 >= 0) + { + worldIn.setBlockState(pos, state.withProperty(CHECK_DECAY, Boolean.valueOf(false)), 4); + } + else + { + this.destroy(worldIn, pos); + } + } + } + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (worldIn.canLightningStrike(pos.up()) && !World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && rand.nextInt(15) == 1) + { + double d0 = (double)((float)pos.getX() + rand.nextFloat()); + double d1 = (double)pos.getY() - 0.05D; + double d2 = (double)((float)pos.getZ() + rand.nextFloat()); + worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + private void destroy(World worldIn, BlockPos pos) + { + this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); + worldIn.setBlockToAir(pos); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return random.nextInt(20) == 0 ? 1 : 0; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Item.getItemFromBlock(Blocks.sapling); + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + if (!worldIn.isRemote) + { + int i = this.getSaplingDropChance(state); + + if (fortune > 0) + { + i -= 2 << fortune; + + if (i < 10) + { + i = 10; + } + } + + if (worldIn.rand.nextInt(i) == 0) + { + Item item = this.getItemDropped(state, worldIn.rand, fortune); + spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state))); + } + + i = 200; + + if (fortune > 0) + { + i -= 10 << fortune; + + if (i < 40) + { + i = 40; + } + } + + this.dropApple(worldIn, pos, state, i); + } + } + + protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) + { + } + + protected int getSaplingDropChance(IBlockState state) + { + return 20; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return !this.fancyGraphics; + } + + /** + * Pass true to draw this block using fancy graphics, or false for fast graphics. + */ + public void setGraphicsLevel(boolean fancy) + { + this.isTransparent = fancy; + this.fancyGraphics = fancy; + this.iconIndex = fancy ? 0 : 1; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return this.isTransparent ? EnumWorldBlockLayer.CUTOUT_MIPPED : EnumWorldBlockLayer.SOLID; + } + + public boolean isVisuallyOpaque() + { + return false; + } + + public abstract BlockPlanks.EnumType getWoodType(int meta); +} diff --git a/src/minecraft/net/minecraft/block/BlockLeavesBase.java b/src/minecraft/net/minecraft/block/BlockLeavesBase.java new file mode 100644 index 0000000..5200e42 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockLeavesBase.java @@ -0,0 +1,54 @@ +package net.minecraft.block; + +import java.util.IdentityHashMap; +import java.util.Map; +import net.minecraft.block.material.Material; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; +import optifine.Config; + +public class BlockLeavesBase extends Block +{ + protected boolean fancyGraphics; + private static final String __OBFID = "CL_00000326"; + private static Map mapOriginalOpacity = new IdentityHashMap(); + + protected BlockLeavesBase(Material materialIn, boolean fancyGraphics) + { + super(materialIn); + this.fancyGraphics = fancyGraphics; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return Config.isCullFacesLeaves() && worldIn.getBlockState(pos).getBlock() == this ? false : super.shouldSideBeRendered(worldIn, pos, side); + } + + public static void setLightOpacity(Block p_setLightOpacity_0_, int p_setLightOpacity_1_) + { + if (!mapOriginalOpacity.containsKey(p_setLightOpacity_0_)) + { + mapOriginalOpacity.put(p_setLightOpacity_0_, Integer.valueOf(p_setLightOpacity_0_.getLightOpacity())); + } + + p_setLightOpacity_0_.setLightOpacity(p_setLightOpacity_1_); + } + + public static void restoreLightOpacity(Block p_restoreLightOpacity_0_) + { + if (mapOriginalOpacity.containsKey(p_restoreLightOpacity_0_)) + { + int i = ((Integer)mapOriginalOpacity.get(p_restoreLightOpacity_0_)).intValue(); + setLightOpacity(p_restoreLightOpacity_0_, i); + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockLever.java b/src/minecraft/net/minecraft/block/BlockLever.java new file mode 100644 index 0000000..9f604f0 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockLever.java @@ -0,0 +1,380 @@ +package net.minecraft.block; + +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockLever extends Block +{ + public static final PropertyEnum FACING = PropertyEnum.create("facing", BlockLever.EnumOrientation.class); + public static final PropertyBool POWERED = PropertyBool.create("powered"); + + protected BlockLever() + { + super(Material.circuits); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, BlockLever.EnumOrientation.NORTH).withProperty(POWERED, Boolean.valueOf(false))); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Check whether this Block can be placed on the given side + */ + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { + return func_181090_a(worldIn, pos, side.getOpposite()); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + if (func_181090_a(worldIn, pos, enumfacing)) + { + return true; + } + } + + return false; + } + + protected static boolean func_181090_a(World p_181090_0_, BlockPos p_181090_1_, EnumFacing p_181090_2_) + { + return BlockButton.func_181088_a(p_181090_0_, p_181090_1_, p_181090_2_); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + IBlockState iblockstate = this.getDefaultState().withProperty(POWERED, Boolean.valueOf(false)); + + if (func_181090_a(worldIn, pos, facing.getOpposite())) + { + return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(facing, placer.getHorizontalFacing())); + } + else + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (enumfacing != facing && func_181090_a(worldIn, pos, ((EnumFacing) enumfacing).getOpposite())) + { + return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings((EnumFacing) enumfacing, placer.getHorizontalFacing())); + } + } + + if (World.doesBlockHaveSolidTopSurface(worldIn, pos.down())) + { + return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(EnumFacing.UP, placer.getHorizontalFacing())); + } + else + { + return iblockstate; + } + } + } + + public static int getMetadataForFacing(EnumFacing facing) + { + switch (facing) + { + case DOWN: + return 0; + + case UP: + return 5; + + case NORTH: + return 4; + + case SOUTH: + return 3; + + case WEST: + return 2; + + case EAST: + return 1; + + default: + return -1; + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (this.func_181091_e(worldIn, pos, state) && !func_181090_a(worldIn, pos, ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing().getOpposite())) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + } + + private boolean func_181091_e(World p_181091_1_, BlockPos p_181091_2_, IBlockState p_181091_3_) + { + if (this.canPlaceBlockAt(p_181091_1_, p_181091_2_)) + { + return true; + } + else + { + this.dropBlockAsItem(p_181091_1_, p_181091_2_, p_181091_3_, 0); + p_181091_1_.setBlockToAir(p_181091_2_); + return false; + } + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + float f = 0.1875F; + + switch ((BlockLever.EnumOrientation)worldIn.getBlockState(pos).getValue(FACING)) + { + case EAST: + this.setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f); + break; + + case WEST: + this.setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f); + break; + + case SOUTH: + this.setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F); + break; + + case NORTH: + this.setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F); + break; + + case UP_Z: + case UP_X: + f = 0.25F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f); + break; + + case DOWN_X: + case DOWN_Z: + f = 0.25F; + this.setBlockBounds(0.5F - f, 0.4F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f); + } + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + state = state.cycleProperty(POWERED); + worldIn.setBlockState(pos, state, 3); + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, ((Boolean)state.getValue(POWERED)).booleanValue() ? 0.6F : 0.5F); + worldIn.notifyNeighborsOfStateChange(pos, this); + EnumFacing enumfacing = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing(); + worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing.getOpposite()), this); + return true; + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + worldIn.notifyNeighborsOfStateChange(pos, this); + EnumFacing enumfacing = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing(); + worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing.getOpposite()), this); + } + + super.breakBlock(worldIn, pos, state); + } + + public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return ((Boolean)state.getValue(POWERED)).booleanValue() ? 15 : 0; + } + + public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return !((Boolean)state.getValue(POWERED)).booleanValue() ? 0 : (((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing() == side ? 15 : 0); + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, BlockLever.EnumOrientation.byMetadata(meta & 7)).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((BlockLever.EnumOrientation)state.getValue(FACING)).getMetadata(); + + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, POWERED}); + } + + public static enum EnumOrientation implements IStringSerializable + { + DOWN_X(0, "down_x", EnumFacing.DOWN), + EAST(1, "east", EnumFacing.EAST), + WEST(2, "west", EnumFacing.WEST), + SOUTH(3, "south", EnumFacing.SOUTH), + NORTH(4, "north", EnumFacing.NORTH), + UP_Z(5, "up_z", EnumFacing.UP), + UP_X(6, "up_x", EnumFacing.UP), + DOWN_Z(7, "down_z", EnumFacing.DOWN); + + private static final BlockLever.EnumOrientation[] META_LOOKUP = new BlockLever.EnumOrientation[values().length]; + private final int meta; + private final String name; + private final EnumFacing facing; + + private EnumOrientation(int meta, String name, EnumFacing facing) + { + this.meta = meta; + this.name = name; + this.facing = facing; + } + + public int getMetadata() + { + return this.meta; + } + + public EnumFacing getFacing() + { + return this.facing; + } + + public String toString() + { + return this.name; + } + + public static BlockLever.EnumOrientation byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public static BlockLever.EnumOrientation forFacings(EnumFacing clickedSide, EnumFacing entityFacing) + { + switch (clickedSide) + { + case DOWN: + switch (entityFacing.getAxis()) + { + case X: + return DOWN_X; + + case Z: + return DOWN_Z; + + default: + throw new IllegalArgumentException("Invalid entityFacing " + entityFacing + " for facing " + clickedSide); + } + + case UP: + switch (entityFacing.getAxis()) + { + case X: + return UP_X; + + case Z: + return UP_Z; + + default: + throw new IllegalArgumentException("Invalid entityFacing " + entityFacing + " for facing " + clickedSide); + } + + case NORTH: + return NORTH; + + case SOUTH: + return SOUTH; + + case WEST: + return WEST; + + case EAST: + return EAST; + + default: + throw new IllegalArgumentException("Invalid facing: " + clickedSide); + } + } + + public String getName() + { + return this.name; + } + + static { + for (BlockLever.EnumOrientation blocklever$enumorientation : values()) + { + META_LOOKUP[blocklever$enumorientation.getMetadata()] = blocklever$enumorientation; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockLilyPad.java b/src/minecraft/net/minecraft/block/BlockLilyPad.java new file mode 100644 index 0000000..d2f229a --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockLilyPad.java @@ -0,0 +1,84 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockLilyPad extends BlockBush +{ + protected BlockLilyPad() + { + float f = 0.5F; + float f1 = 0.015625F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + if (collidingEntity == null || !(collidingEntity instanceof EntityBoat)) + { + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ); + } + + public int getBlockColor() + { + return 7455580; + } + + public int getRenderColor(IBlockState state) + { + return 7455580; + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return 2129968; + } + + /** + * is the block grass, dirt or farmland + */ + protected boolean canPlaceBlockOn(Block ground) + { + return ground == Blocks.water; + } + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { + if (pos.getY() >= 0 && pos.getY() < 256) + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + return iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0; + } + else + { + return false; + } + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return 0; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockLiquid.java b/src/minecraft/net/minecraft/block/BlockLiquid.java new file mode 100644 index 0000000..4abd95b --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockLiquid.java @@ -0,0 +1,410 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeColorHelper; + +public abstract class BlockLiquid extends Block +{ + public static final PropertyInteger LEVEL = PropertyInteger.create("level", 0, 15); + + protected BlockLiquid(Material materialIn) + { + super(materialIn); + this.setDefaultState(this.blockState.getBaseState().withProperty(LEVEL, Integer.valueOf(0))); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + this.setTickRandomly(true); + } + + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + { + return this.blockMaterial != Material.lava; + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return this.blockMaterial == Material.water ? BiomeColorHelper.getWaterColorAtPos(worldIn, pos) : 16777215; + } + + /** + * Returns the percentage of the liquid block that is air, based on the given flow decay of the liquid + */ + public static float getLiquidHeightPercent(int meta) + { + if (meta >= 8) + { + meta = 0; + } + + return (float)(meta + 1) / 9.0F; + } + + protected int getLevel(IBlockAccess worldIn, BlockPos pos) + { + return worldIn.getBlockState(pos).getBlock().getMaterial() == this.blockMaterial ? ((Integer)worldIn.getBlockState(pos).getValue(LEVEL)).intValue() : -1; + } + + protected int getEffectiveFlowDecay(IBlockAccess worldIn, BlockPos pos) + { + int i = this.getLevel(worldIn, pos); + return i >= 8 ? 0 : i; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid) + { + return hitIfLiquid && ((Integer)state.getValue(LEVEL)).intValue() == 0; + } + + /** + * Whether this Block is solid on the given Side + */ + public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + Material material = worldIn.getBlockState(pos).getBlock().getMaterial(); + return material == this.blockMaterial ? false : (side == EnumFacing.UP ? true : (material == Material.ice ? false : super.isBlockSolid(worldIn, pos, side))); + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return worldIn.getBlockState(pos).getBlock().getMaterial() == this.blockMaterial ? false : (side == EnumFacing.UP ? true : super.shouldSideBeRendered(worldIn, pos, side)); + } + + public boolean func_176364_g(IBlockAccess blockAccess, BlockPos pos) + { + for (int i = -1; i <= 1; ++i) + { + for (int j = -1; j <= 1; ++j) + { + IBlockState iblockstate = blockAccess.getBlockState(pos.add(i, 0, j)); + Block block = iblockstate.getBlock(); + Material material = block.getMaterial(); + + if (material != this.blockMaterial && !block.isFullBlock()) + { + return true; + } + } + } + + return false; + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 1; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return null; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + protected Vec3 getFlowVector(IBlockAccess worldIn, BlockPos pos) + { + Vec3 vec3 = new Vec3(0.0D, 0.0D, 0.0D); + int i = this.getEffectiveFlowDecay(worldIn, pos); + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + BlockPos blockpos = pos.offset((EnumFacing) enumfacing); + int j = this.getEffectiveFlowDecay(worldIn, blockpos); + + if (j < 0) + { + if (!worldIn.getBlockState(blockpos).getBlock().getMaterial().blocksMovement()) + { + j = this.getEffectiveFlowDecay(worldIn, blockpos.down()); + + if (j >= 0) + { + int k = j - (i - 8); + vec3 = vec3.addVector((double)((blockpos.getX() - pos.getX()) * k), (double)((blockpos.getY() - pos.getY()) * k), (double)((blockpos.getZ() - pos.getZ()) * k)); + } + } + } + else if (j >= 0) + { + int l = j - i; + vec3 = vec3.addVector((double)((blockpos.getX() - pos.getX()) * l), (double)((blockpos.getY() - pos.getY()) * l), (double)((blockpos.getZ() - pos.getZ()) * l)); + } + } + + if (((Integer)worldIn.getBlockState(pos).getValue(LEVEL)).intValue() >= 8) + { + for (Object enumfacing1 : EnumFacing.Plane.HORIZONTAL) + { + BlockPos blockpos1 = pos.offset((EnumFacing) enumfacing1); + + if (this.isBlockSolid(worldIn, blockpos1, (EnumFacing) enumfacing1) || this.isBlockSolid(worldIn, blockpos1.up(), (EnumFacing) enumfacing1)) + { + vec3 = vec3.normalize().addVector(0.0D, -6.0D, 0.0D); + break; + } + } + } + + return vec3.normalize(); + } + + public Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion) + { + return motion.add(this.getFlowVector(worldIn, pos)); + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return this.blockMaterial == Material.water ? 5 : (this.blockMaterial == Material.lava ? (worldIn.provider.getHasNoSky() ? 10 : 30) : 0); + } + + public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) + { + int i = worldIn.getCombinedLight(pos, 0); + int j = worldIn.getCombinedLight(pos.up(), 0); + int k = i & 255; + int l = j & 255; + int i1 = i >> 16 & 255; + int j1 = j >> 16 & 255; + return (k > l ? k : l) | (i1 > j1 ? i1 : j1) << 16; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return this.blockMaterial == Material.water ? EnumWorldBlockLayer.TRANSLUCENT : EnumWorldBlockLayer.SOLID; + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + double d0 = (double)pos.getX(); + double d1 = (double)pos.getY(); + double d2 = (double)pos.getZ(); + + if (this.blockMaterial == Material.water) + { + int i = ((Integer)state.getValue(LEVEL)).intValue(); + + if (i > 0 && i < 8) + { + if (rand.nextInt(64) == 0) + { + worldIn.playSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "liquid.water", rand.nextFloat() * 0.25F + 0.75F, rand.nextFloat() * 1.0F + 0.5F, false); + } + } + else if (rand.nextInt(10) == 0) + { + worldIn.spawnParticle(EnumParticleTypes.SUSPENDED, d0 + (double)rand.nextFloat(), d1 + (double)rand.nextFloat(), d2 + (double)rand.nextFloat(), 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + if (this.blockMaterial == Material.lava && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air && !worldIn.getBlockState(pos.up()).getBlock().isOpaqueCube()) + { + if (rand.nextInt(100) == 0) + { + double d8 = d0 + (double)rand.nextFloat(); + double d4 = d1 + this.maxY; + double d6 = d2 + (double)rand.nextFloat(); + worldIn.spawnParticle(EnumParticleTypes.LAVA, d8, d4, d6, 0.0D, 0.0D, 0.0D, new int[0]); + worldIn.playSound(d8, d4, d6, "liquid.lavapop", 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false); + } + + if (rand.nextInt(200) == 0) + { + worldIn.playSound(d0, d1, d2, "liquid.lava", 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false); + } + } + + if (rand.nextInt(10) == 0 && World.doesBlockHaveSolidTopSurface(worldIn, pos.down())) + { + Material material = worldIn.getBlockState(pos.down(2)).getBlock().getMaterial(); + + if (!material.blocksMovement() && !material.isLiquid()) + { + double d3 = d0 + (double)rand.nextFloat(); + double d5 = d1 - 1.05D; + double d7 = d2 + (double)rand.nextFloat(); + + if (this.blockMaterial == Material.water) + { + worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d3, d5, d7, 0.0D, 0.0D, 0.0D, new int[0]); + } + else + { + worldIn.spawnParticle(EnumParticleTypes.DRIP_LAVA, d3, d5, d7, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + } + } + + public static double getFlowDirection(IBlockAccess worldIn, BlockPos pos, Material materialIn) + { + Vec3 vec3 = getFlowingBlock(materialIn).getFlowVector(worldIn, pos); + return vec3.xCoord == 0.0D && vec3.zCoord == 0.0D ? -1000.0D : MathHelper.func_181159_b(vec3.zCoord, vec3.xCoord) - (Math.PI / 2D); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + this.checkForMixing(worldIn, pos, state); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + this.checkForMixing(worldIn, pos, state); + } + + public boolean checkForMixing(World worldIn, BlockPos pos, IBlockState state) + { + if (this.blockMaterial == Material.lava) + { + boolean flag = false; + + for (EnumFacing enumfacing : EnumFacing.values()) + { + if (enumfacing != EnumFacing.DOWN && worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getMaterial() == Material.water) + { + flag = true; + break; + } + } + + if (flag) + { + Integer integer = (Integer)state.getValue(LEVEL); + + if (integer.intValue() == 0) + { + worldIn.setBlockState(pos, Blocks.obsidian.getDefaultState()); + this.triggerMixEffects(worldIn, pos); + return true; + } + + if (integer.intValue() <= 4) + { + worldIn.setBlockState(pos, Blocks.cobblestone.getDefaultState()); + this.triggerMixEffects(worldIn, pos); + return true; + } + } + } + + return false; + } + + protected void triggerMixEffects(World worldIn, BlockPos pos) + { + double d0 = (double)pos.getX(); + double d1 = (double)pos.getY(); + double d2 = (double)pos.getZ(); + worldIn.playSoundEffect(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F); + + for (int i = 0; i < 8; ++i) + { + worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0 + Math.random(), d1 + 1.2D, d2 + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(LEVEL, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(LEVEL)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {LEVEL}); + } + + public static BlockDynamicLiquid getFlowingBlock(Material materialIn) + { + if (materialIn == Material.water) + { + return Blocks.flowing_water; + } + else if (materialIn == Material.lava) + { + return Blocks.flowing_lava; + } + else + { + throw new IllegalArgumentException("Invalid material"); + } + } + + public static BlockStaticLiquid getStaticBlock(Material materialIn) + { + if (materialIn == Material.water) + { + return Blocks.water; + } + else if (materialIn == Material.lava) + { + return Blocks.lava; + } + else + { + throw new IllegalArgumentException("Invalid material"); + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockLog.java b/src/minecraft/net/minecraft/block/BlockLog.java new file mode 100644 index 0000000..c62f0cd --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockLog.java @@ -0,0 +1,95 @@ +package net.minecraft.block; + +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.World; + +public abstract class BlockLog extends BlockRotatedPillar +{ + public static final PropertyEnum LOG_AXIS = PropertyEnum.create("axis", BlockLog.EnumAxis.class); + + public BlockLog() + { + super(Material.wood); + this.setCreativeTab(CreativeTabs.tabBlock); + this.setHardness(2.0F); + this.setStepSound(soundTypeWood); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + int i = 4; + int j = i + 1; + + if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j))) + { + for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i))) + { + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue()) + { + worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4); + } + } + } + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis())); + } + + public static enum EnumAxis implements IStringSerializable + { + X("x"), + Y("y"), + Z("z"), + NONE("none"); + + private final String name; + + private EnumAxis(String name) + { + this.name = name; + } + + public String toString() + { + return this.name; + } + + public static BlockLog.EnumAxis fromFacingAxis(EnumFacing.Axis axis) + { + switch (axis) + { + case X: + return X; + + case Y: + return Y; + + case Z: + return Z; + + default: + return NONE; + } + } + + public String getName() + { + return this.name; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockMelon.java b/src/minecraft/net/minecraft/block/BlockMelon.java new file mode 100644 index 0000000..48494bb --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockMelon.java @@ -0,0 +1,42 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; +import net.minecraft.item.Item; + +public class BlockMelon extends Block +{ + protected BlockMelon() + { + super(Material.gourd, MapColor.limeColor); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.melon; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 3 + random.nextInt(5); + } + + /** + * Get the quantity dropped based on the given fortune level + */ + public int quantityDroppedWithBonus(int fortune, Random random) + { + return Math.min(9, this.quantityDropped(random) + random.nextInt(1 + fortune)); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockMobSpawner.java b/src/minecraft/net/minecraft/block/BlockMobSpawner.java new file mode 100644 index 0000000..a33a48d --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockMobSpawner.java @@ -0,0 +1,79 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityMobSpawner; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; + +public class BlockMobSpawner extends BlockContainer +{ + protected BlockMobSpawner() + { + super(Material.rock); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityMobSpawner(); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return null; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + int i = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15); + this.dropXpOnBlockBreak(worldIn, pos, i); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return null; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockMushroom.java b/src/minecraft/net/minecraft/block/BlockMushroom.java new file mode 100644 index 0000000..b23af85 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockMushroom.java @@ -0,0 +1,127 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenBigMushroom; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class BlockMushroom extends BlockBush implements IGrowable +{ + protected BlockMushroom() + { + float f = 0.2F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); + this.setTickRandomly(true); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (rand.nextInt(25) == 0) + { + int i = 5; + int j = 4; + + for (BlockPos blockpos : BlockPos.getAllInBoxMutable(pos.add(-4, -1, -4), pos.add(4, 1, 4))) + { + if (worldIn.getBlockState(blockpos).getBlock() == this) + { + --i; + + if (i <= 0) + { + return; + } + } + } + + BlockPos blockpos1 = pos.add(rand.nextInt(3) - 1, rand.nextInt(2) - rand.nextInt(2), rand.nextInt(3) - 1); + + for (int k = 0; k < 4; ++k) + { + if (worldIn.isAirBlock(blockpos1) && this.canBlockStay(worldIn, blockpos1, this.getDefaultState())) + { + pos = blockpos1; + } + + blockpos1 = pos.add(rand.nextInt(3) - 1, rand.nextInt(2) - rand.nextInt(2), rand.nextInt(3) - 1); + } + + if (worldIn.isAirBlock(blockpos1) && this.canBlockStay(worldIn, blockpos1, this.getDefaultState())) + { + worldIn.setBlockState(blockpos1, this.getDefaultState(), 2); + } + } + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return super.canPlaceBlockAt(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getDefaultState()); + } + + /** + * is the block grass, dirt or farmland + */ + protected boolean canPlaceBlockOn(Block ground) + { + return ground.isFullBlock(); + } + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { + if (pos.getY() >= 0 && pos.getY() < 256) + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock())); + } + else + { + return false; + } + } + + public boolean generateBigMushroom(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + worldIn.setBlockToAir(pos); + WorldGenerator worldgenerator = null; + + if (this == Blocks.brown_mushroom) + { + worldgenerator = new WorldGenBigMushroom(Blocks.brown_mushroom_block); + } + else if (this == Blocks.red_mushroom) + { + worldgenerator = new WorldGenBigMushroom(Blocks.red_mushroom_block); + } + + if (worldgenerator != null && worldgenerator.generate(worldIn, rand, pos)) + { + return true; + } + else + { + worldIn.setBlockState(pos, state, 3); + return false; + } + } + + /** + * Whether this IGrowable can grow + */ + public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) + { + return true; + } + + public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + return (double)rand.nextFloat() < 0.4D; + } + + public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + this.generateBigMushroom(worldIn, pos, state, rand); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockMycelium.java b/src/minecraft/net/minecraft/block/BlockMycelium.java new file mode 100644 index 0000000..6422fdf --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockMycelium.java @@ -0,0 +1,98 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockMycelium extends Block +{ + public static final PropertyBool SNOWY = PropertyBool.create("snowy"); + + protected BlockMycelium() + { + super(Material.grass, MapColor.purpleColor); + this.setDefaultState(this.blockState.getBaseState().withProperty(SNOWY, Boolean.valueOf(false))); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.up()).getBlock(); + return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!worldIn.isRemote) + { + if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2) + { + worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + } + else + { + if (worldIn.getLightFromNeighbors(pos.up()) >= 9) + { + for (int i = 0; i < 4; ++i) + { + BlockPos blockpos = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + Block block = worldIn.getBlockState(blockpos.up()).getBlock(); + + if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2) + { + worldIn.setBlockState(blockpos, this.getDefaultState()); + } + } + } + } + } + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + super.randomDisplayTick(worldIn, pos, state, rand); + + if (rand.nextInt(10) == 0) + { + worldIn.spawnParticle(EnumParticleTypes.TOWN_AURA, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + 1.1F), (double)((float)pos.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Blocks.dirt.getItemDropped(Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), rand, fortune); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return 0; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {SNOWY}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockNetherBrick.java b/src/minecraft/net/minecraft/block/BlockNetherBrick.java new file mode 100644 index 0000000..105d112 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockNetherBrick.java @@ -0,0 +1,23 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; + +public class BlockNetherBrick extends Block +{ + public BlockNetherBrick() + { + super(Material.rock); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return MapColor.netherrackColor; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockNetherWart.java b/src/minecraft/net/minecraft/block/BlockNetherWart.java new file mode 100644 index 0000000..582732c --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockNetherWart.java @@ -0,0 +1,125 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockNetherWart extends BlockBush +{ + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 3); + + protected BlockNetherWart() + { + super(Material.plants, MapColor.redColor); + this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0))); + this.setTickRandomly(true); + float f = 0.5F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); + this.setCreativeTab((CreativeTabs)null); + } + + /** + * is the block grass, dirt or farmland + */ + protected boolean canPlaceBlockOn(Block ground) + { + return ground == Blocks.soul_sand; + } + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { + return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + int i = ((Integer)state.getValue(AGE)).intValue(); + + if (i < 3 && rand.nextInt(10) == 0) + { + state = state.withProperty(AGE, Integer.valueOf(i + 1)); + worldIn.setBlockState(pos, state, 2); + } + + super.updateTick(worldIn, pos, state, rand); + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + if (!worldIn.isRemote) + { + int i = 1; + + if (((Integer)state.getValue(AGE)).intValue() >= 3) + { + i = 2 + worldIn.rand.nextInt(3); + + if (fortune > 0) + { + i += worldIn.rand.nextInt(fortune + 1); + } + } + + for (int j = 0; j < i; ++j) + { + spawnAsEntity(worldIn, pos, new ItemStack(Items.nether_wart)); + } + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return null; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.nether_wart; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(AGE)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {AGE}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockNetherrack.java b/src/minecraft/net/minecraft/block/BlockNetherrack.java new file mode 100644 index 0000000..5fba5aa --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockNetherrack.java @@ -0,0 +1,23 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; + +public class BlockNetherrack extends Block +{ + public BlockNetherrack() + { + super(Material.rock); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return MapColor.netherrackColor; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockNewLeaf.java b/src/minecraft/net/minecraft/block/BlockNewLeaf.java new file mode 100644 index 0000000..f9aa479 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockNewLeaf.java @@ -0,0 +1,122 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import java.util.List; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockNewLeaf extends BlockLeaves +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockPlanks.EnumType.class, new Predicate() + { + public boolean apply(BlockPlanks.EnumType p_apply_1_) + { + return p_apply_1_.getMetadata() >= 4; + } + }); + + public BlockNewLeaf() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockPlanks.EnumType.ACACIA).withProperty(CHECK_DECAY, Boolean.valueOf(true)).withProperty(DECAYABLE, Boolean.valueOf(true))); + } + + protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) + { + if (state.getValue(VARIANT) == BlockPlanks.EnumType.DARK_OAK && worldIn.rand.nextInt(chance) == 0) + { + spawnAsEntity(worldIn, pos, new ItemStack(Items.apple, 1, 0)); + } + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + public int getDamageValue(World worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + return iblockstate.getBlock().getMetaFromState(iblockstate) & 3; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + list.add(new ItemStack(itemIn, 1, 0)); + list.add(new ItemStack(itemIn, 1, 1)); + } + + protected ItemStack createStackedBlock(IBlockState state) + { + return new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(VARIANT, this.getWoodType(meta)).withProperty(DECAYABLE, Boolean.valueOf((meta & 4) == 0)).withProperty(CHECK_DECAY, Boolean.valueOf((meta & 8) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4; + + if (!((Boolean)state.getValue(DECAYABLE)).booleanValue()) + { + i |= 4; + } + + if (((Boolean)state.getValue(CHECK_DECAY)).booleanValue()) + { + i |= 8; + } + + return i; + } + + public BlockPlanks.EnumType getWoodType(int meta) + { + return BlockPlanks.EnumType.byMetadata((meta & 3) + 4); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT, CHECK_DECAY, DECAYABLE}); + } + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { + if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)); + } + else + { + super.harvestBlock(worldIn, player, pos, state, te); + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockNewLog.java b/src/minecraft/net/minecraft/block/BlockNewLog.java new file mode 100644 index 0000000..e0d37cb --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockNewLog.java @@ -0,0 +1,139 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class BlockNewLog extends BlockLog +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockPlanks.EnumType.class, new Predicate() + { + public boolean apply(BlockPlanks.EnumType p_apply_1_) + { + return p_apply_1_.getMetadata() >= 4; + } + }); + + public BlockNewLog() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockPlanks.EnumType.ACACIA).withProperty(LOG_AXIS, BlockLog.EnumAxis.Y)); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + BlockPlanks.EnumType blockplanks$enumtype = (BlockPlanks.EnumType)state.getValue(VARIANT); + + switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS)) + { + case X: + case Z: + case NONE: + default: + switch (blockplanks$enumtype) + { + case ACACIA: + default: + return MapColor.stoneColor; + + case DARK_OAK: + return BlockPlanks.EnumType.DARK_OAK.func_181070_c(); + } + + case Y: + return blockplanks$enumtype.func_181070_c(); + } + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + list.add(new ItemStack(itemIn, 1, BlockPlanks.EnumType.ACACIA.getMetadata() - 4)); + list.add(new ItemStack(itemIn, 1, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4)); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockPlanks.EnumType.byMetadata((meta & 3) + 4)); + + switch (meta & 12) + { + case 0: + iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y); + break; + + case 4: + iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.X); + break; + + case 8: + iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z); + break; + + default: + iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE); + } + + return iblockstate; + } + + @SuppressWarnings("incomplete-switch") + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4; + + switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS)) + { + case X: + i |= 4; + break; + + case Z: + i |= 8; + break; + + case NONE: + i |= 12; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT, LOG_AXIS}); + } + + protected ItemStack createStackedBlock(IBlockState state) + { + return new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockNote.java b/src/minecraft/net/minecraft/block/BlockNote.java new file mode 100644 index 0000000..6dcb7ad --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockNote.java @@ -0,0 +1,123 @@ +package net.minecraft.block; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityNote; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class BlockNote extends BlockContainer +{ + private static final List INSTRUMENTS = Lists.newArrayList(new String[] {"harp", "bd", "snare", "hat", "bassattack"}); + + public BlockNote() + { + super(Material.wood); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + boolean flag = worldIn.isBlockPowered(pos); + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityNote) + { + TileEntityNote tileentitynote = (TileEntityNote)tileentity; + + if (tileentitynote.previousRedstoneState != flag) + { + if (flag) + { + tileentitynote.triggerNote(worldIn, pos); + } + + tileentitynote.previousRedstoneState = flag; + } + } + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityNote) + { + TileEntityNote tileentitynote = (TileEntityNote)tileentity; + tileentitynote.changePitch(); + tileentitynote.triggerNote(worldIn, pos); + playerIn.triggerAchievement(StatList.field_181735_S); + } + + return true; + } + } + + public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) + { + if (!worldIn.isRemote) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityNote) + { + ((TileEntityNote)tileentity).triggerNote(worldIn, pos); + playerIn.triggerAchievement(StatList.field_181734_R); + } + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityNote(); + } + + private String getInstrument(int id) + { + if (id < 0 || id >= INSTRUMENTS.size()) + { + id = 0; + } + + return (String)INSTRUMENTS.get(id); + } + + /** + * Called on both Client and Server when World#addBlockEvent is called + */ + public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) + { + float f = (float)Math.pow(2.0D, (double)(eventParam - 12) / 12.0D); + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "note." + this.getInstrument(eventID), 3.0F, f); + worldIn.spawnParticle(EnumParticleTypes.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, (double)eventParam / 24.0D, 0.0D, 0.0D, new int[0]); + return true; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockObsidian.java b/src/minecraft/net/minecraft/block/BlockObsidian.java new file mode 100644 index 0000000..247bf9b --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockObsidian.java @@ -0,0 +1,34 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; + +public class BlockObsidian extends Block +{ + public BlockObsidian() + { + super(Material.rock); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Item.getItemFromBlock(Blocks.obsidian); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return MapColor.blackColor; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockOldLeaf.java b/src/minecraft/net/minecraft/block/BlockOldLeaf.java new file mode 100644 index 0000000..a727707 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockOldLeaf.java @@ -0,0 +1,160 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import java.util.List; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.ColorizerFoliage; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockOldLeaf extends BlockLeaves +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockPlanks.EnumType.class, new Predicate() + { + public boolean apply(BlockPlanks.EnumType p_apply_1_) + { + return p_apply_1_.getMetadata() < 4; + } + }); + + public BlockOldLeaf() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockPlanks.EnumType.OAK).withProperty(CHECK_DECAY, Boolean.valueOf(true)).withProperty(DECAYABLE, Boolean.valueOf(true))); + } + + public int getRenderColor(IBlockState state) + { + if (state.getBlock() != this) + { + return super.getRenderColor(state); + } + else + { + BlockPlanks.EnumType blockplanks$enumtype = (BlockPlanks.EnumType)state.getValue(VARIANT); + return blockplanks$enumtype == BlockPlanks.EnumType.SPRUCE ? ColorizerFoliage.getFoliageColorPine() : (blockplanks$enumtype == BlockPlanks.EnumType.BIRCH ? ColorizerFoliage.getFoliageColorBirch() : super.getRenderColor(state)); + } + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == this) + { + BlockPlanks.EnumType blockplanks$enumtype = (BlockPlanks.EnumType)iblockstate.getValue(VARIANT); + + if (blockplanks$enumtype == BlockPlanks.EnumType.SPRUCE) + { + return ColorizerFoliage.getFoliageColorPine(); + } + + if (blockplanks$enumtype == BlockPlanks.EnumType.BIRCH) + { + return ColorizerFoliage.getFoliageColorBirch(); + } + } + + return super.colorMultiplier(worldIn, pos, renderPass); + } + + protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) + { + if (state.getValue(VARIANT) == BlockPlanks.EnumType.OAK && worldIn.rand.nextInt(chance) == 0) + { + spawnAsEntity(worldIn, pos, new ItemStack(Items.apple, 1, 0)); + } + } + + protected int getSaplingDropChance(IBlockState state) + { + return state.getValue(VARIANT) == BlockPlanks.EnumType.JUNGLE ? 40 : super.getSaplingDropChance(state); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + list.add(new ItemStack(itemIn, 1, BlockPlanks.EnumType.OAK.getMetadata())); + list.add(new ItemStack(itemIn, 1, BlockPlanks.EnumType.SPRUCE.getMetadata())); + list.add(new ItemStack(itemIn, 1, BlockPlanks.EnumType.BIRCH.getMetadata())); + list.add(new ItemStack(itemIn, 1, BlockPlanks.EnumType.JUNGLE.getMetadata())); + } + + protected ItemStack createStackedBlock(IBlockState state) + { + return new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(VARIANT, this.getWoodType(meta)).withProperty(DECAYABLE, Boolean.valueOf((meta & 4) == 0)).withProperty(CHECK_DECAY, Boolean.valueOf((meta & 8) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); + + if (!((Boolean)state.getValue(DECAYABLE)).booleanValue()) + { + i |= 4; + } + + if (((Boolean)state.getValue(CHECK_DECAY)).booleanValue()) + { + i |= 8; + } + + return i; + } + + public BlockPlanks.EnumType getWoodType(int meta) + { + return BlockPlanks.EnumType.byMetadata((meta & 3) % 4); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT, CHECK_DECAY, DECAYABLE}); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { + if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())); + } + else + { + super.harvestBlock(worldIn, player, pos, state, te); + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockOldLog.java b/src/minecraft/net/minecraft/block/BlockOldLog.java new file mode 100644 index 0000000..a1bfac6 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockOldLog.java @@ -0,0 +1,147 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class BlockOldLog extends BlockLog +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockPlanks.EnumType.class, new Predicate() + { + public boolean apply(BlockPlanks.EnumType p_apply_1_) + { + return p_apply_1_.getMetadata() < 4; + } + }); + + public BlockOldLog() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockPlanks.EnumType.OAK).withProperty(LOG_AXIS, BlockLog.EnumAxis.Y)); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + BlockPlanks.EnumType blockplanks$enumtype = (BlockPlanks.EnumType)state.getValue(VARIANT); + + switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS)) + { + case X: + case Z: + case NONE: + default: + switch (blockplanks$enumtype) + { + case OAK: + default: + return BlockPlanks.EnumType.SPRUCE.func_181070_c(); + + case SPRUCE: + return BlockPlanks.EnumType.DARK_OAK.func_181070_c(); + + case BIRCH: + return MapColor.quartzColor; + + case JUNGLE: + return BlockPlanks.EnumType.SPRUCE.func_181070_c(); + } + + case Y: + return blockplanks$enumtype.func_181070_c(); + } + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + list.add(new ItemStack(itemIn, 1, BlockPlanks.EnumType.OAK.getMetadata())); + list.add(new ItemStack(itemIn, 1, BlockPlanks.EnumType.SPRUCE.getMetadata())); + list.add(new ItemStack(itemIn, 1, BlockPlanks.EnumType.BIRCH.getMetadata())); + list.add(new ItemStack(itemIn, 1, BlockPlanks.EnumType.JUNGLE.getMetadata())); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockPlanks.EnumType.byMetadata((meta & 3) % 4)); + + switch (meta & 12) + { + case 0: + iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y); + break; + + case 4: + iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.X); + break; + + case 8: + iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z); + break; + + default: + iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE); + } + + return iblockstate; + } + + @SuppressWarnings("incomplete-switch") + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); + + switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS)) + { + case X: + i |= 4; + break; + + case Z: + i |= 8; + break; + + case NONE: + i |= 12; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT, LOG_AXIS}); + } + + protected ItemStack createStackedBlock(IBlockState state) + { + return new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockOre.java b/src/minecraft/net/minecraft/block/BlockOre.java new file mode 100644 index 0000000..626ec72 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockOre.java @@ -0,0 +1,116 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class BlockOre extends Block +{ + public BlockOre() + { + this(Material.rock.getMaterialMapColor()); + } + + public BlockOre(MapColor p_i46390_1_) + { + super(Material.rock, p_i46390_1_); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return this == Blocks.coal_ore ? Items.coal : (this == Blocks.diamond_ore ? Items.diamond : (this == Blocks.lapis_ore ? Items.dye : (this == Blocks.emerald_ore ? Items.emerald : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this))))); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return this == Blocks.lapis_ore ? 4 + random.nextInt(5) : 1; + } + + /** + * Get the quantity dropped based on the given fortune level + */ + public int quantityDroppedWithBonus(int fortune, Random random) + { + if (fortune > 0 && Item.getItemFromBlock(this) != this.getItemDropped((IBlockState)this.getBlockState().getValidStates().iterator().next(), random, fortune)) + { + int i = random.nextInt(fortune + 2) - 1; + + if (i < 0) + { + i = 0; + } + + return this.quantityDropped(random) * (i + 1); + } + else + { + return this.quantityDropped(random); + } + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + + if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) + { + int i = 0; + + if (this == Blocks.coal_ore) + { + i = MathHelper.getRandomIntegerInRange(worldIn.rand, 0, 2); + } + else if (this == Blocks.diamond_ore) + { + i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); + } + else if (this == Blocks.emerald_ore) + { + i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7); + } + else if (this == Blocks.lapis_ore) + { + i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); + } + else if (this == Blocks.quartz_ore) + { + i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); + } + + this.dropXpOnBlockBreak(worldIn, pos, i); + } + } + + public int getDamageValue(World worldIn, BlockPos pos) + { + return 0; + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return this == Blocks.lapis_ore ? EnumDyeColor.BLUE.getDyeDamage() : 0; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockPackedIce.java b/src/minecraft/net/minecraft/block/BlockPackedIce.java new file mode 100644 index 0000000..914470c --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockPackedIce.java @@ -0,0 +1,23 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; + +public class BlockPackedIce extends Block +{ + public BlockPackedIce() + { + super(Material.packedIce); + this.slipperiness = 0.98F; + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockPane.java b/src/minecraft/net/minecraft/block/BlockPane.java new file mode 100644 index 0000000..b9e8b22 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockPane.java @@ -0,0 +1,204 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockPane extends Block +{ + public static final PropertyBool NORTH = PropertyBool.create("north"); + public static final PropertyBool EAST = PropertyBool.create("east"); + public static final PropertyBool SOUTH = PropertyBool.create("south"); + public static final PropertyBool WEST = PropertyBool.create("west"); + private final boolean canDrop; + + protected BlockPane(Material materialIn, boolean canDrop) + { + super(materialIn); + this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); + this.canDrop = canDrop; + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()))); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return !this.canDrop ? null : super.getItemDropped(state, rand, fortune); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return worldIn.getBlockState(pos).getBlock() == this ? false : super.shouldSideBeRendered(worldIn, pos, side); + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()); + boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()); + boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()); + boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()); + + if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) + { + if (flag2) + { + this.setBlockBounds(0.0F, 0.0F, 0.4375F, 0.5F, 1.0F, 0.5625F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + else if (flag3) + { + this.setBlockBounds(0.5F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + + if ((!flag || !flag1) && (flag2 || flag3 || flag || flag1)) + { + if (flag) + { + this.setBlockBounds(0.4375F, 0.0F, 0.0F, 0.5625F, 1.0F, 0.5F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + else if (flag1) + { + this.setBlockBounds(0.4375F, 0.0F, 0.5F, 0.5625F, 1.0F, 1.0F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + } + else + { + this.setBlockBounds(0.4375F, 0.0F, 0.0F, 0.5625F, 1.0F, 1.0F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + float f = 0.4375F; + float f1 = 0.5625F; + float f2 = 0.4375F; + float f3 = 0.5625F; + boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()); + boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()); + boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()); + boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock()); + + if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) + { + if (flag2) + { + f = 0.0F; + } + else if (flag3) + { + f1 = 1.0F; + } + } + else + { + f = 0.0F; + f1 = 1.0F; + } + + if ((!flag || !flag1) && (flag2 || flag3 || flag || flag1)) + { + if (flag) + { + f2 = 0.0F; + } + else if (flag1) + { + f3 = 1.0F; + } + } + else + { + f2 = 0.0F; + f3 = 1.0F; + } + + this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3); + } + + public final boolean canPaneConnectToBlock(Block blockIn) + { + return blockIn.isFullBlock() || blockIn == this || blockIn == Blocks.glass || blockIn == Blocks.stained_glass || blockIn == Blocks.stained_glass_pane || blockIn instanceof BlockPane; + } + + protected boolean canSilkHarvest() + { + return true; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT_MIPPED; + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return 0; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockPistonBase.java b/src/minecraft/net/minecraft/block/BlockPistonBase.java new file mode 100644 index 0000000..4c81b3d --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockPistonBase.java @@ -0,0 +1,488 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockPistonStructureHelper; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityPiston; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockPistonBase extends Block +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing"); + public static final PropertyBool EXTENDED = PropertyBool.create("extended"); + + /** This piston is the sticky one? */ + private final boolean isSticky; + + public BlockPistonBase(boolean isSticky) + { + super(Material.piston); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(EXTENDED, Boolean.valueOf(false))); + this.isSticky = isSticky; + this.setStepSound(soundTypePiston); + this.setHardness(0.5F); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + worldIn.setBlockState(pos, state.withProperty(FACING, getFacingFromEntity(worldIn, pos, placer)), 2); + + if (!worldIn.isRemote) + { + this.checkForMove(worldIn, pos, state); + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!worldIn.isRemote) + { + this.checkForMove(worldIn, pos, state); + } + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isRemote && worldIn.getTileEntity(pos) == null) + { + this.checkForMove(worldIn, pos, state); + } + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(FACING, getFacingFromEntity(worldIn, pos, placer)).withProperty(EXTENDED, Boolean.valueOf(false)); + } + + private void checkForMove(World worldIn, BlockPos pos, IBlockState state) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + boolean flag = this.shouldBeExtended(worldIn, pos, enumfacing); + + if (flag && !((Boolean)state.getValue(EXTENDED)).booleanValue()) + { + if ((new BlockPistonStructureHelper(worldIn, pos, enumfacing, true)).canMove()) + { + worldIn.addBlockEvent(pos, this, 0, enumfacing.getIndex()); + } + } + else if (!flag && ((Boolean)state.getValue(EXTENDED)).booleanValue()) + { + worldIn.setBlockState(pos, state.withProperty(EXTENDED, Boolean.valueOf(false)), 2); + worldIn.addBlockEvent(pos, this, 1, enumfacing.getIndex()); + } + } + + private boolean shouldBeExtended(World worldIn, BlockPos pos, EnumFacing facing) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + if (enumfacing != facing && worldIn.isSidePowered(pos.offset(enumfacing), enumfacing)) + { + return true; + } + } + + if (worldIn.isSidePowered(pos, EnumFacing.DOWN)) + { + return true; + } + else + { + BlockPos blockpos = pos.up(); + + for (EnumFacing enumfacing1 : EnumFacing.values()) + { + if (enumfacing1 != EnumFacing.DOWN && worldIn.isSidePowered(blockpos.offset(enumfacing1), enumfacing1)) + { + return true; + } + } + + return false; + } + } + + /** + * Called on both Client and Server when World#addBlockEvent is called + */ + public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + + if (!worldIn.isRemote) + { + boolean flag = this.shouldBeExtended(worldIn, pos, enumfacing); + + if (flag && eventID == 1) + { + worldIn.setBlockState(pos, state.withProperty(EXTENDED, Boolean.valueOf(true)), 2); + return false; + } + + if (!flag && eventID == 0) + { + return false; + } + } + + if (eventID == 0) + { + if (!this.doMove(worldIn, pos, enumfacing, true)) + { + return false; + } + + worldIn.setBlockState(pos, state.withProperty(EXTENDED, Boolean.valueOf(true)), 2); + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "tile.piston.out", 0.5F, worldIn.rand.nextFloat() * 0.25F + 0.6F); + } + else if (eventID == 1) + { + TileEntity tileentity1 = worldIn.getTileEntity(pos.offset(enumfacing)); + + if (tileentity1 instanceof TileEntityPiston) + { + ((TileEntityPiston)tileentity1).clearPistonTileEntity(); + } + + worldIn.setBlockState(pos, Blocks.piston_extension.getDefaultState().withProperty(BlockPistonMoving.FACING, enumfacing).withProperty(BlockPistonMoving.TYPE, this.isSticky ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT), 3); + worldIn.setTileEntity(pos, BlockPistonMoving.newTileEntity(this.getStateFromMeta(eventParam), enumfacing, false, true)); + + if (this.isSticky) + { + BlockPos blockpos = pos.add(enumfacing.getFrontOffsetX() * 2, enumfacing.getFrontOffsetY() * 2, enumfacing.getFrontOffsetZ() * 2); + Block block = worldIn.getBlockState(blockpos).getBlock(); + boolean flag1 = false; + + if (block == Blocks.piston_extension) + { + TileEntity tileentity = worldIn.getTileEntity(blockpos); + + if (tileentity instanceof TileEntityPiston) + { + TileEntityPiston tileentitypiston = (TileEntityPiston)tileentity; + + if (tileentitypiston.getFacing() == enumfacing && tileentitypiston.isExtending()) + { + tileentitypiston.clearPistonTileEntity(); + flag1 = true; + } + } + } + + if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston)) + { + this.doMove(worldIn, pos, enumfacing, false); + } + } + else + { + worldIn.setBlockToAir(pos.offset(enumfacing)); + } + + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "tile.piston.in", 0.5F, worldIn.rand.nextFloat() * 0.15F + 0.6F); + } + + return true; + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == this && ((Boolean)iblockstate.getValue(EXTENDED)).booleanValue()) + { + float f = 0.25F; + EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(FACING); + + if (enumfacing != null) + { + switch (enumfacing) + { + case DOWN: + this.setBlockBounds(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + + case UP: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F); + break; + + case NORTH: + this.setBlockBounds(0.0F, 0.0F, 0.25F, 1.0F, 1.0F, 1.0F); + break; + + case SOUTH: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.75F); + break; + + case WEST: + this.setBlockBounds(0.25F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + + case EAST: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.75F, 1.0F, 1.0F); + } + } + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getCollisionBoundingBox(worldIn, pos, state); + } + + public boolean isFullCube() + { + return false; + } + + public static EnumFacing getFacing(int meta) + { + int i = meta & 7; + return i > 5 ? null : EnumFacing.getFront(i); + } + + public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn) + { + if (MathHelper.abs((float)entityIn.posX - (float)clickedBlock.getX()) < 2.0F && MathHelper.abs((float)entityIn.posZ - (float)clickedBlock.getZ()) < 2.0F) + { + double d0 = entityIn.posY + (double)entityIn.getEyeHeight(); + + if (d0 - (double)clickedBlock.getY() > 2.0D) + { + return EnumFacing.UP; + } + + if ((double)clickedBlock.getY() - d0 > 0.0D) + { + return EnumFacing.DOWN; + } + } + + return entityIn.getHorizontalFacing().getOpposite(); + } + + public static boolean canPush(Block blockIn, World worldIn, BlockPos pos, EnumFacing direction, boolean allowDestroy) + { + if (blockIn == Blocks.obsidian) + { + return false; + } + else if (!worldIn.getWorldBorder().contains(pos)) + { + return false; + } + else if (pos.getY() >= 0 && (direction != EnumFacing.DOWN || pos.getY() != 0)) + { + if (pos.getY() <= worldIn.getHeight() - 1 && (direction != EnumFacing.UP || pos.getY() != worldIn.getHeight() - 1)) + { + if (blockIn != Blocks.piston && blockIn != Blocks.sticky_piston) + { + if (blockIn.getBlockHardness(worldIn, pos) == -1.0F) + { + return false; + } + + if (blockIn.getMobilityFlag() == 2) + { + return false; + } + + if (blockIn.getMobilityFlag() == 1) + { + if (!allowDestroy) + { + return false; + } + + return true; + } + } + else if (((Boolean)worldIn.getBlockState(pos).getValue(EXTENDED)).booleanValue()) + { + return false; + } + + return !(blockIn instanceof ITileEntityProvider); + } + else + { + return false; + } + } + else + { + return false; + } + } + + private boolean doMove(World worldIn, BlockPos pos, EnumFacing direction, boolean extending) + { + if (!extending) + { + worldIn.setBlockToAir(pos.offset(direction)); + } + + BlockPistonStructureHelper blockpistonstructurehelper = new BlockPistonStructureHelper(worldIn, pos, direction, extending); + List list = blockpistonstructurehelper.getBlocksToMove(); + List list1 = blockpistonstructurehelper.getBlocksToDestroy(); + + if (!blockpistonstructurehelper.canMove()) + { + return false; + } + else + { + int i = list.size() + list1.size(); + Block[] ablock = new Block[i]; + EnumFacing enumfacing = extending ? direction : direction.getOpposite(); + + for (int j = list1.size() - 1; j >= 0; --j) + { + BlockPos blockpos = (BlockPos)list1.get(j); + Block block = worldIn.getBlockState(blockpos).getBlock(); + block.dropBlockAsItem(worldIn, blockpos, worldIn.getBlockState(blockpos), 0); + worldIn.setBlockToAir(blockpos); + --i; + ablock[i] = block; + } + + for (int k = list.size() - 1; k >= 0; --k) + { + BlockPos blockpos2 = (BlockPos)list.get(k); + IBlockState iblockstate = worldIn.getBlockState(blockpos2); + Block block1 = iblockstate.getBlock(); + block1.getMetaFromState(iblockstate); + worldIn.setBlockToAir(blockpos2); + blockpos2 = blockpos2.offset(enumfacing); + worldIn.setBlockState(blockpos2, Blocks.piston_extension.getDefaultState().withProperty(FACING, direction), 4); + worldIn.setTileEntity(blockpos2, BlockPistonMoving.newTileEntity(iblockstate, direction, extending, false)); + --i; + ablock[i] = block1; + } + + BlockPos blockpos1 = pos.offset(direction); + + if (extending) + { + BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = this.isSticky ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT; + IBlockState iblockstate1 = Blocks.piston_head.getDefaultState().withProperty(BlockPistonExtension.FACING, direction).withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype); + IBlockState iblockstate2 = Blocks.piston_extension.getDefaultState().withProperty(BlockPistonMoving.FACING, direction).withProperty(BlockPistonMoving.TYPE, this.isSticky ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT); + worldIn.setBlockState(blockpos1, iblockstate2, 4); + worldIn.setTileEntity(blockpos1, BlockPistonMoving.newTileEntity(iblockstate1, direction, true, false)); + } + + for (int l = list1.size() - 1; l >= 0; --l) + { + worldIn.notifyNeighborsOfStateChange((BlockPos)list1.get(l), ablock[i++]); + } + + for (int i1 = list.size() - 1; i1 >= 0; --i1) + { + worldIn.notifyNeighborsOfStateChange((BlockPos)list.get(i1), ablock[i++]); + } + + if (extending) + { + worldIn.notifyNeighborsOfStateChange(blockpos1, Blocks.piston_head); + worldIn.notifyNeighborsOfStateChange(pos, this); + } + + return true; + } + } + + /** + * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...) + */ + public IBlockState getStateForEntityRender(IBlockState state) + { + return this.getDefaultState().withProperty(FACING, EnumFacing.UP); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, getFacing(meta)).withProperty(EXTENDED, Boolean.valueOf((meta & 8) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getIndex(); + + if (((Boolean)state.getValue(EXTENDED)).booleanValue()) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, EXTENDED}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockPistonExtension.java b/src/minecraft/net/minecraft/block/BlockPistonExtension.java new file mode 100644 index 0000000..7759472 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockPistonExtension.java @@ -0,0 +1,279 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockPistonExtension extends Block +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing"); + public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockPistonExtension.EnumPistonType.class); + public static final PropertyBool SHORT = PropertyBool.create("short"); + + public BlockPistonExtension() + { + super(Material.piston); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(TYPE, BlockPistonExtension.EnumPistonType.DEFAULT).withProperty(SHORT, Boolean.valueOf(false))); + this.setStepSound(soundTypePiston); + this.setHardness(0.5F); + } + + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + if (player.capabilities.isCreativeMode) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + + if (enumfacing != null) + { + BlockPos blockpos = pos.offset(enumfacing.getOpposite()); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block == Blocks.piston || block == Blocks.sticky_piston) + { + worldIn.setBlockToAir(blockpos); + } + } + } + + super.onBlockHarvested(worldIn, pos, state, player); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + super.breakBlock(worldIn, pos, state); + EnumFacing enumfacing = ((EnumFacing)state.getValue(FACING)).getOpposite(); + pos = pos.offset(enumfacing); + IBlockState iblockstate = worldIn.getBlockState(pos); + + if ((iblockstate.getBlock() == Blocks.piston || iblockstate.getBlock() == Blocks.sticky_piston) && ((Boolean)iblockstate.getValue(BlockPistonBase.EXTENDED)).booleanValue()) + { + iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); + worldIn.setBlockToAir(pos); + } + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return false; + } + + /** + * Check whether this Block can be placed on the given side + */ + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { + return false; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + this.applyHeadBounds(state); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + this.applyCoreBounds(state); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + private void applyCoreBounds(IBlockState state) + { + float f = 0.25F; + float f1 = 0.375F; + float f2 = 0.625F; + float f3 = 0.25F; + float f4 = 0.75F; + + switch ((EnumFacing)state.getValue(FACING)) + { + case DOWN: + this.setBlockBounds(0.375F, 0.25F, 0.375F, 0.625F, 1.0F, 0.625F); + break; + + case UP: + this.setBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 0.75F, 0.625F); + break; + + case NORTH: + this.setBlockBounds(0.25F, 0.375F, 0.25F, 0.75F, 0.625F, 1.0F); + break; + + case SOUTH: + this.setBlockBounds(0.25F, 0.375F, 0.0F, 0.75F, 0.625F, 0.75F); + break; + + case WEST: + this.setBlockBounds(0.375F, 0.25F, 0.25F, 0.625F, 0.75F, 1.0F); + break; + + case EAST: + this.setBlockBounds(0.0F, 0.375F, 0.25F, 0.75F, 0.625F, 0.75F); + } + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + this.applyHeadBounds(worldIn.getBlockState(pos)); + } + + public void applyHeadBounds(IBlockState state) + { + float f = 0.25F; + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + + if (enumfacing != null) + { + switch (enumfacing) + { + case DOWN: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F); + break; + + case UP: + this.setBlockBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + + case NORTH: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.25F); + break; + + case SOUTH: + this.setBlockBounds(0.0F, 0.0F, 0.75F, 1.0F, 1.0F, 1.0F); + break; + + case WEST: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.25F, 1.0F, 1.0F); + break; + + case EAST: + this.setBlockBounds(0.75F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + BlockPos blockpos = pos.offset(enumfacing.getOpposite()); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock() != Blocks.piston && iblockstate.getBlock() != Blocks.sticky_piston) + { + worldIn.setBlockToAir(pos); + } + else + { + iblockstate.getBlock().onNeighborBlockChange(worldIn, blockpos, iblockstate, neighborBlock); + } + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return true; + } + + public static EnumFacing getFacing(int meta) + { + int i = meta & 7; + return i > 5 ? null : EnumFacing.getFront(i); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return worldIn.getBlockState(pos).getValue(TYPE) == BlockPistonExtension.EnumPistonType.STICKY ? Item.getItemFromBlock(Blocks.sticky_piston) : Item.getItemFromBlock(Blocks.piston); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, getFacing(meta)).withProperty(TYPE, (meta & 8) > 0 ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getIndex(); + + if (state.getValue(TYPE) == BlockPistonExtension.EnumPistonType.STICKY) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, TYPE, SHORT}); + } + + public static enum EnumPistonType implements IStringSerializable + { + DEFAULT("normal"), + STICKY("sticky"); + + private final String VARIANT; + + private EnumPistonType(String name) + { + this.VARIANT = name; + } + + public String toString() + { + return this.VARIANT; + } + + public String getName() + { + return this.VARIANT; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockPistonMoving.java b/src/minecraft/net/minecraft/block/BlockPistonMoving.java new file mode 100644 index 0000000..9be19c2 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockPistonMoving.java @@ -0,0 +1,312 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityPiston; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockPistonMoving extends BlockContainer +{ + public static final PropertyDirection FACING = BlockPistonExtension.FACING; + public static final PropertyEnum TYPE = BlockPistonExtension.TYPE; + + public BlockPistonMoving() + { + super(Material.piston); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(TYPE, BlockPistonExtension.EnumPistonType.DEFAULT)); + this.setHardness(-1.0F); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return null; + } + + public static TileEntity newTileEntity(IBlockState state, EnumFacing facing, boolean extending, boolean renderHead) + { + return new TileEntityPiston(state, facing, extending, renderHead); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityPiston) + { + ((TileEntityPiston)tileentity).clearPistonTileEntity(); + } + else + { + super.breakBlock(worldIn, pos, state); + } + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return false; + } + + /** + * Check whether this Block can be placed on the given side + */ + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { + return false; + } + + /** + * Called when a player destroys this Block + */ + public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) + { + BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock() instanceof BlockPistonBase && ((Boolean)iblockstate.getValue(BlockPistonBase.EXTENDED)).booleanValue()) + { + worldIn.setBlockToAir(blockpos); + } + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (!worldIn.isRemote && worldIn.getTileEntity(pos) == null) + { + worldIn.setBlockToAir(pos); + return true; + } + else + { + return false; + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return null; + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + if (!worldIn.isRemote) + { + TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); + + if (tileentitypiston != null) + { + IBlockState iblockstate = tileentitypiston.getPistonState(); + iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); + } + } + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. + */ + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + { + return null; + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!worldIn.isRemote) + { + worldIn.getTileEntity(pos); + } + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); + + if (tileentitypiston == null) + { + return null; + } + else + { + float f = tileentitypiston.getProgress(0.0F); + + if (tileentitypiston.isExtending()) + { + f = 1.0F - f; + } + + return this.getBoundingBox(worldIn, pos, tileentitypiston.getPistonState(), f, tileentitypiston.getFacing()); + } + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos); + + if (tileentitypiston != null) + { + IBlockState iblockstate = tileentitypiston.getPistonState(); + Block block = iblockstate.getBlock(); + + if (block == this || block.getMaterial() == Material.air) + { + return; + } + + float f = tileentitypiston.getProgress(0.0F); + + if (tileentitypiston.isExtending()) + { + f = 1.0F - f; + } + + block.setBlockBoundsBasedOnState(worldIn, pos); + + if (block == Blocks.piston || block == Blocks.sticky_piston) + { + f = 0.0F; + } + + EnumFacing enumfacing = tileentitypiston.getFacing(); + this.minX = block.getBlockBoundsMinX() - (double)((float)enumfacing.getFrontOffsetX() * f); + this.minY = block.getBlockBoundsMinY() - (double)((float)enumfacing.getFrontOffsetY() * f); + this.minZ = block.getBlockBoundsMinZ() - (double)((float)enumfacing.getFrontOffsetZ() * f); + this.maxX = block.getBlockBoundsMaxX() - (double)((float)enumfacing.getFrontOffsetX() * f); + this.maxY = block.getBlockBoundsMaxY() - (double)((float)enumfacing.getFrontOffsetY() * f); + this.maxZ = block.getBlockBoundsMaxZ() - (double)((float)enumfacing.getFrontOffsetZ() * f); + } + } + + public AxisAlignedBB getBoundingBox(World worldIn, BlockPos pos, IBlockState extendingBlock, float progress, EnumFacing direction) + { + if (extendingBlock.getBlock() != this && extendingBlock.getBlock().getMaterial() != Material.air) + { + AxisAlignedBB axisalignedbb = extendingBlock.getBlock().getCollisionBoundingBox(worldIn, pos, extendingBlock); + + if (axisalignedbb == null) + { + return null; + } + else + { + double d0 = axisalignedbb.minX; + double d1 = axisalignedbb.minY; + double d2 = axisalignedbb.minZ; + double d3 = axisalignedbb.maxX; + double d4 = axisalignedbb.maxY; + double d5 = axisalignedbb.maxZ; + + if (direction.getFrontOffsetX() < 0) + { + d0 -= (double)((float)direction.getFrontOffsetX() * progress); + } + else + { + d3 -= (double)((float)direction.getFrontOffsetX() * progress); + } + + if (direction.getFrontOffsetY() < 0) + { + d1 -= (double)((float)direction.getFrontOffsetY() * progress); + } + else + { + d4 -= (double)((float)direction.getFrontOffsetY() * progress); + } + + if (direction.getFrontOffsetZ() < 0) + { + d2 -= (double)((float)direction.getFrontOffsetZ() * progress); + } + else + { + d5 -= (double)((float)direction.getFrontOffsetZ() * progress); + } + + return new AxisAlignedBB(d0, d1, d2, d3, d4, d5); + } + } + else + { + return null; + } + } + + private TileEntityPiston getTileEntity(IBlockAccess worldIn, BlockPos pos) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + return tileentity instanceof TileEntityPiston ? (TileEntityPiston)tileentity : null; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return null; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, BlockPistonExtension.getFacing(meta)).withProperty(TYPE, (meta & 8) > 0 ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getIndex(); + + if (state.getValue(TYPE) == BlockPistonExtension.EnumPistonType.STICKY) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, TYPE}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockPlanks.java b/src/minecraft/net/minecraft/block/BlockPlanks.java new file mode 100644 index 0000000..bdd73d4 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockPlanks.java @@ -0,0 +1,145 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IStringSerializable; + +public class BlockPlanks extends Block +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockPlanks.EnumType.class); + + public BlockPlanks() + { + super(Material.wood); + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockPlanks.EnumType.OAK)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (BlockPlanks.EnumType blockplanks$enumtype : BlockPlanks.EnumType.values()) + { + list.add(new ItemStack(itemIn, 1, blockplanks$enumtype.getMetadata())); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(VARIANT, BlockPlanks.EnumType.byMetadata(meta)); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return ((BlockPlanks.EnumType)state.getValue(VARIANT)).func_181070_c(); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT}); + } + + public static enum EnumType implements IStringSerializable + { + OAK(0, "oak", MapColor.woodColor), + SPRUCE(1, "spruce", MapColor.obsidianColor), + BIRCH(2, "birch", MapColor.sandColor), + JUNGLE(3, "jungle", MapColor.dirtColor), + ACACIA(4, "acacia", MapColor.adobeColor), + DARK_OAK(5, "dark_oak", "big_oak", MapColor.brownColor); + + private static final BlockPlanks.EnumType[] META_LOOKUP = new BlockPlanks.EnumType[values().length]; + private final int meta; + private final String name; + private final String unlocalizedName; + private final MapColor field_181071_k; + + private EnumType(int p_i46388_3_, String p_i46388_4_, MapColor p_i46388_5_) + { + this(p_i46388_3_, p_i46388_4_, p_i46388_4_, p_i46388_5_); + } + + private EnumType(int p_i46389_3_, String p_i46389_4_, String p_i46389_5_, MapColor p_i46389_6_) + { + this.meta = p_i46389_3_; + this.name = p_i46389_4_; + this.unlocalizedName = p_i46389_5_; + this.field_181071_k = p_i46389_6_; + } + + public int getMetadata() + { + return this.meta; + } + + public MapColor func_181070_c() + { + return this.field_181071_k; + } + + public String toString() + { + return this.name; + } + + public static BlockPlanks.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + static { + for (BlockPlanks.EnumType blockplanks$enumtype : values()) + { + META_LOOKUP[blockplanks$enumtype.getMetadata()] = blockplanks$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockPortal.java b/src/minecraft/net/minecraft/block/BlockPortal.java new file mode 100644 index 0000000..529e3a5 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockPortal.java @@ -0,0 +1,484 @@ +package net.minecraft.block; + +import com.google.common.cache.LoadingCache; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockWorldState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.pattern.BlockPattern; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemMonsterPlacer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockPortal extends BlockBreakable +{ + public static final PropertyEnum AXIS = PropertyEnum.create("axis", EnumFacing.Axis.class, new EnumFacing.Axis[] {EnumFacing.Axis.X, EnumFacing.Axis.Z}); + + public BlockPortal() + { + super(Material.portal, false); + this.setDefaultState(this.blockState.getBaseState().withProperty(AXIS, EnumFacing.Axis.X)); + this.setTickRandomly(true); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + super.updateTick(worldIn, pos, state, rand); + + if (worldIn.provider.isSurfaceWorld() && worldIn.getGameRules().getBoolean("doMobSpawning") && rand.nextInt(2000) < worldIn.getDifficulty().getDifficultyId()) + { + int i = pos.getY(); + BlockPos blockpos; + + for (blockpos = pos; !World.doesBlockHaveSolidTopSurface(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down()) + { + ; + } + + if (i > 0 && !worldIn.getBlockState(blockpos.up()).getBlock().isNormalCube()) + { + Entity entity = ItemMonsterPlacer.spawnCreature(worldIn, 57, (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 1.1D, (double)blockpos.getZ() + 0.5D); + + if (entity != null) + { + entity.timeUntilPortal = entity.getPortalCooldown(); + } + } + } + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)worldIn.getBlockState(pos).getValue(AXIS); + float f = 0.125F; + float f1 = 0.125F; + + if (enumfacing$axis == EnumFacing.Axis.X) + { + f = 0.5F; + } + + if (enumfacing$axis == EnumFacing.Axis.Z) + { + f1 = 0.5F; + } + + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1); + } + + public static int getMetaForAxis(EnumFacing.Axis axis) + { + return axis == EnumFacing.Axis.X ? 1 : (axis == EnumFacing.Axis.Z ? 2 : 0); + } + + public boolean isFullCube() + { + return false; + } + + public boolean func_176548_d(World worldIn, BlockPos p_176548_2_) + { + BlockPortal.Size blockportal$size = new BlockPortal.Size(worldIn, p_176548_2_, EnumFacing.Axis.X); + + if (blockportal$size.func_150860_b() && blockportal$size.field_150864_e == 0) + { + blockportal$size.func_150859_c(); + return true; + } + else + { + BlockPortal.Size blockportal$size1 = new BlockPortal.Size(worldIn, p_176548_2_, EnumFacing.Axis.Z); + + if (blockportal$size1.func_150860_b() && blockportal$size1.field_150864_e == 0) + { + blockportal$size1.func_150859_c(); + return true; + } + else + { + return false; + } + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)state.getValue(AXIS); + + if (enumfacing$axis == EnumFacing.Axis.X) + { + BlockPortal.Size blockportal$size = new BlockPortal.Size(worldIn, pos, EnumFacing.Axis.X); + + if (!blockportal$size.func_150860_b() || blockportal$size.field_150864_e < blockportal$size.field_150868_h * blockportal$size.field_150862_g) + { + worldIn.setBlockState(pos, Blocks.air.getDefaultState()); + } + } + else if (enumfacing$axis == EnumFacing.Axis.Z) + { + BlockPortal.Size blockportal$size1 = new BlockPortal.Size(worldIn, pos, EnumFacing.Axis.Z); + + if (!blockportal$size1.func_150860_b() || blockportal$size1.field_150864_e < blockportal$size1.field_150868_h * blockportal$size1.field_150862_g) + { + worldIn.setBlockState(pos, Blocks.air.getDefaultState()); + } + } + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + EnumFacing.Axis enumfacing$axis = null; + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (worldIn.getBlockState(pos).getBlock() == this) + { + enumfacing$axis = (EnumFacing.Axis)iblockstate.getValue(AXIS); + + if (enumfacing$axis == null) + { + return false; + } + + if (enumfacing$axis == EnumFacing.Axis.Z && side != EnumFacing.EAST && side != EnumFacing.WEST) + { + return false; + } + + if (enumfacing$axis == EnumFacing.Axis.X && side != EnumFacing.SOUTH && side != EnumFacing.NORTH) + { + return false; + } + } + + boolean flag = worldIn.getBlockState(pos.west()).getBlock() == this && worldIn.getBlockState(pos.west(2)).getBlock() != this; + boolean flag1 = worldIn.getBlockState(pos.east()).getBlock() == this && worldIn.getBlockState(pos.east(2)).getBlock() != this; + boolean flag2 = worldIn.getBlockState(pos.north()).getBlock() == this && worldIn.getBlockState(pos.north(2)).getBlock() != this; + boolean flag3 = worldIn.getBlockState(pos.south()).getBlock() == this && worldIn.getBlockState(pos.south(2)).getBlock() != this; + boolean flag4 = flag || flag1 || enumfacing$axis == EnumFacing.Axis.X; + boolean flag5 = flag2 || flag3 || enumfacing$axis == EnumFacing.Axis.Z; + return flag4 && side == EnumFacing.WEST ? true : (flag4 && side == EnumFacing.EAST ? true : (flag5 && side == EnumFacing.NORTH ? true : flag5 && side == EnumFacing.SOUTH)); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.TRANSLUCENT; + } + + /** + * Called When an Entity Collided with the Block + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + if (entityIn.ridingEntity == null && entityIn.riddenByEntity == null) + { + entityIn.func_181015_d(pos); + } + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (rand.nextInt(100) == 0) + { + worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "portal.portal", 0.5F, rand.nextFloat() * 0.4F + 0.8F, false); + } + + for (int i = 0; i < 4; ++i) + { + double d0 = (double)((float)pos.getX() + rand.nextFloat()); + double d1 = (double)((float)pos.getY() + rand.nextFloat()); + double d2 = (double)((float)pos.getZ() + rand.nextFloat()); + double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D; + double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D; + double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D; + int j = rand.nextInt(2) * 2 - 1; + + if (worldIn.getBlockState(pos.west()).getBlock() != this && worldIn.getBlockState(pos.east()).getBlock() != this) + { + d0 = (double)pos.getX() + 0.5D + 0.25D * (double)j; + d3 = (double)(rand.nextFloat() * 2.0F * (float)j); + } + else + { + d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)j; + d5 = (double)(rand.nextFloat() * 2.0F * (float)j); + } + + worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]); + } + } + + public Item getItem(World worldIn, BlockPos pos) + { + return null; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(AXIS, (meta & 3) == 2 ? EnumFacing.Axis.Z : EnumFacing.Axis.X); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return getMetaForAxis((EnumFacing.Axis)state.getValue(AXIS)); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {AXIS}); + } + + public BlockPattern.PatternHelper func_181089_f(World p_181089_1_, BlockPos p_181089_2_) + { + EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z; + BlockPortal.Size blockportal$size = new BlockPortal.Size(p_181089_1_, p_181089_2_, EnumFacing.Axis.X); + LoadingCache loadingcache = BlockPattern.func_181627_a(p_181089_1_, true); + + if (!blockportal$size.func_150860_b()) + { + enumfacing$axis = EnumFacing.Axis.X; + blockportal$size = new BlockPortal.Size(p_181089_1_, p_181089_2_, EnumFacing.Axis.Z); + } + + if (!blockportal$size.func_150860_b()) + { + return new BlockPattern.PatternHelper(p_181089_2_, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1); + } + else + { + int[] aint = new int[EnumFacing.AxisDirection.values().length]; + EnumFacing enumfacing = blockportal$size.field_150866_c.rotateYCCW(); + BlockPos blockpos = blockportal$size.field_150861_f.up(blockportal$size.func_181100_a() - 1); + + for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values()) + { + BlockPattern.PatternHelper blockpattern$patternhelper = new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos : blockpos.offset(blockportal$size.field_150866_c, blockportal$size.func_181101_b() - 1), EnumFacing.func_181076_a(enumfacing$axisdirection, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.func_181101_b(), blockportal$size.func_181100_a(), 1); + + for (int i = 0; i < blockportal$size.func_181101_b(); ++i) + { + for (int j = 0; j < blockportal$size.func_181100_a(); ++j) + { + BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1); + + if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getBlock().getMaterial() != Material.air) + { + ++aint[enumfacing$axisdirection.ordinal()]; + } + } + } + } + + EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE; + + for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values()) + { + if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()]) + { + enumfacing$axisdirection1 = enumfacing$axisdirection2; + } + } + + return new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos : blockpos.offset(blockportal$size.field_150866_c, blockportal$size.func_181101_b() - 1), EnumFacing.func_181076_a(enumfacing$axisdirection1, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.func_181101_b(), blockportal$size.func_181100_a(), 1); + } + } + + public static class Size + { + private final World world; + private final EnumFacing.Axis axis; + private final EnumFacing field_150866_c; + private final EnumFacing field_150863_d; + private int field_150864_e = 0; + private BlockPos field_150861_f; + private int field_150862_g; + private int field_150868_h; + + public Size(World worldIn, BlockPos p_i45694_2_, EnumFacing.Axis p_i45694_3_) + { + this.world = worldIn; + this.axis = p_i45694_3_; + + if (p_i45694_3_ == EnumFacing.Axis.X) + { + this.field_150863_d = EnumFacing.EAST; + this.field_150866_c = EnumFacing.WEST; + } + else + { + this.field_150863_d = EnumFacing.NORTH; + this.field_150866_c = EnumFacing.SOUTH; + } + + for (BlockPos blockpos = p_i45694_2_; p_i45694_2_.getY() > blockpos.getY() - 21 && p_i45694_2_.getY() > 0 && this.func_150857_a(worldIn.getBlockState(p_i45694_2_.down()).getBlock()); p_i45694_2_ = p_i45694_2_.down()) + { + ; + } + + int i = this.func_180120_a(p_i45694_2_, this.field_150863_d) - 1; + + if (i >= 0) + { + this.field_150861_f = p_i45694_2_.offset(this.field_150863_d, i); + this.field_150868_h = this.func_180120_a(this.field_150861_f, this.field_150866_c); + + if (this.field_150868_h < 2 || this.field_150868_h > 21) + { + this.field_150861_f = null; + this.field_150868_h = 0; + } + } + + if (this.field_150861_f != null) + { + this.field_150862_g = this.func_150858_a(); + } + } + + protected int func_180120_a(BlockPos p_180120_1_, EnumFacing p_180120_2_) + { + int i; + + for (i = 0; i < 22; ++i) + { + BlockPos blockpos = p_180120_1_.offset(p_180120_2_, i); + + if (!this.func_150857_a(this.world.getBlockState(blockpos).getBlock()) || this.world.getBlockState(blockpos.down()).getBlock() != Blocks.obsidian) + { + break; + } + } + + Block block = this.world.getBlockState(p_180120_1_.offset(p_180120_2_, i)).getBlock(); + return block == Blocks.obsidian ? i : 0; + } + + public int func_181100_a() + { + return this.field_150862_g; + } + + public int func_181101_b() + { + return this.field_150868_h; + } + + protected int func_150858_a() + { + label24: + + for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g) + { + for (int i = 0; i < this.field_150868_h; ++i) + { + BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i).up(this.field_150862_g); + Block block = this.world.getBlockState(blockpos).getBlock(); + + if (!this.func_150857_a(block)) + { + break label24; + } + + if (block == Blocks.portal) + { + ++this.field_150864_e; + } + + if (i == 0) + { + block = this.world.getBlockState(blockpos.offset(this.field_150863_d)).getBlock(); + + if (block != Blocks.obsidian) + { + break label24; + } + } + else if (i == this.field_150868_h - 1) + { + block = this.world.getBlockState(blockpos.offset(this.field_150866_c)).getBlock(); + + if (block != Blocks.obsidian) + { + break label24; + } + } + } + } + + for (int j = 0; j < this.field_150868_h; ++j) + { + if (this.world.getBlockState(this.field_150861_f.offset(this.field_150866_c, j).up(this.field_150862_g)).getBlock() != Blocks.obsidian) + { + this.field_150862_g = 0; + break; + } + } + + if (this.field_150862_g <= 21 && this.field_150862_g >= 3) + { + return this.field_150862_g; + } + else + { + this.field_150861_f = null; + this.field_150868_h = 0; + this.field_150862_g = 0; + return 0; + } + } + + protected boolean func_150857_a(Block p_150857_1_) + { + return p_150857_1_.blockMaterial == Material.air || p_150857_1_ == Blocks.fire || p_150857_1_ == Blocks.portal; + } + + public boolean func_150860_b() + { + return this.field_150861_f != null && this.field_150868_h >= 2 && this.field_150868_h <= 21 && this.field_150862_g >= 3 && this.field_150862_g <= 21; + } + + public void func_150859_c() + { + for (int i = 0; i < this.field_150868_h; ++i) + { + BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i); + + for (int j = 0; j < this.field_150862_g; ++j) + { + this.world.setBlockState(blockpos.up(j), Blocks.portal.getDefaultState().withProperty(BlockPortal.AXIS, this.axis), 2); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockPotato.java b/src/minecraft/net/minecraft/block/BlockPotato.java new file mode 100644 index 0000000..f5923f2 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockPotato.java @@ -0,0 +1,37 @@ +package net.minecraft.block; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockPotato extends BlockCrops +{ + protected Item getSeed() + { + return Items.potato; + } + + protected Item getCrop() + { + return Items.potato; + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + + if (!worldIn.isRemote) + { + if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.nextInt(50) == 0) + { + spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato)); + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockPressurePlate.java b/src/minecraft/net/minecraft/block/BlockPressurePlate.java new file mode 100644 index 0000000..ba96ed9 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockPressurePlate.java @@ -0,0 +1,96 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockPressurePlate extends BlockBasePressurePlate +{ + public static final PropertyBool POWERED = PropertyBool.create("powered"); + private final BlockPressurePlate.Sensitivity sensitivity; + + protected BlockPressurePlate(Material materialIn, BlockPressurePlate.Sensitivity sensitivityIn) + { + super(materialIn); + this.setDefaultState(this.blockState.getBaseState().withProperty(POWERED, Boolean.valueOf(false))); + this.sensitivity = sensitivityIn; + } + + protected int getRedstoneStrength(IBlockState state) + { + return ((Boolean)state.getValue(POWERED)).booleanValue() ? 15 : 0; + } + + protected IBlockState setRedstoneStrength(IBlockState state, int strength) + { + return state.withProperty(POWERED, Boolean.valueOf(strength > 0)); + } + + protected int computeRedstoneStrength(World worldIn, BlockPos pos) + { + AxisAlignedBB axisalignedbb = this.getSensitiveAABB(pos); + List list; + + switch (this.sensitivity) + { + case EVERYTHING: + list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb); + break; + + case MOBS: + list = worldIn.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); + break; + + default: + return 0; + } + + if (!list.isEmpty()) + { + for (Entity entity : list) + { + if (!entity.doesEntityNotTriggerPressurePlate()) + { + return 15; + } + } + } + + return 0; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(POWERED, Boolean.valueOf(meta == 1)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Boolean)state.getValue(POWERED)).booleanValue() ? 1 : 0; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {POWERED}); + } + + public static enum Sensitivity + { + EVERYTHING, + MOBS; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockPressurePlateWeighted.java b/src/minecraft/net/minecraft/block/BlockPressurePlateWeighted.java new file mode 100644 index 0000000..0a97944 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockPressurePlateWeighted.java @@ -0,0 +1,84 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class BlockPressurePlateWeighted extends BlockBasePressurePlate +{ + public static final PropertyInteger POWER = PropertyInteger.create("power", 0, 15); + private final int field_150068_a; + + protected BlockPressurePlateWeighted(Material p_i46379_1_, int p_i46379_2_) + { + this(p_i46379_1_, p_i46379_2_, p_i46379_1_.getMaterialMapColor()); + } + + protected BlockPressurePlateWeighted(Material p_i46380_1_, int p_i46380_2_, MapColor p_i46380_3_) + { + super(p_i46380_1_, p_i46380_3_); + this.setDefaultState(this.blockState.getBaseState().withProperty(POWER, Integer.valueOf(0))); + this.field_150068_a = p_i46380_2_; + } + + protected int computeRedstoneStrength(World worldIn, BlockPos pos) + { + int i = Math.min(worldIn.getEntitiesWithinAABB(Entity.class, this.getSensitiveAABB(pos)).size(), this.field_150068_a); + + if (i > 0) + { + float f = (float)Math.min(this.field_150068_a, i) / (float)this.field_150068_a; + return MathHelper.ceiling_float_int(f * 15.0F); + } + else + { + return 0; + } + } + + protected int getRedstoneStrength(IBlockState state) + { + return ((Integer)state.getValue(POWER)).intValue(); + } + + protected IBlockState setRedstoneStrength(IBlockState state, int strength) + { + return state.withProperty(POWER, Integer.valueOf(strength)); + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return 10; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(POWER, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(POWER)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {POWER}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockPrismarine.java b/src/minecraft/net/minecraft/block/BlockPrismarine.java new file mode 100644 index 0000000..e0d2236 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockPrismarine.java @@ -0,0 +1,141 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.StatCollector; + +public class BlockPrismarine extends Block +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockPrismarine.EnumType.class); + public static final int ROUGH_META = BlockPrismarine.EnumType.ROUGH.getMetadata(); + public static final int BRICKS_META = BlockPrismarine.EnumType.BRICKS.getMetadata(); + public static final int DARK_META = BlockPrismarine.EnumType.DARK.getMetadata(); + + public BlockPrismarine() + { + super(Material.rock); + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockPrismarine.EnumType.ROUGH)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal(this.getUnlocalizedName() + "." + BlockPrismarine.EnumType.ROUGH.getUnlocalizedName() + ".name"); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return state.getValue(VARIANT) == BlockPrismarine.EnumType.ROUGH ? MapColor.cyanColor : MapColor.diamondColor; + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockPrismarine.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockPrismarine.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT}); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(VARIANT, BlockPrismarine.EnumType.byMetadata(meta)); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + list.add(new ItemStack(itemIn, 1, ROUGH_META)); + list.add(new ItemStack(itemIn, 1, BRICKS_META)); + list.add(new ItemStack(itemIn, 1, DARK_META)); + } + + public static enum EnumType implements IStringSerializable + { + ROUGH(0, "prismarine", "rough"), + BRICKS(1, "prismarine_bricks", "bricks"), + DARK(2, "dark_prismarine", "dark"); + + private static final BlockPrismarine.EnumType[] META_LOOKUP = new BlockPrismarine.EnumType[values().length]; + private final int meta; + private final String name; + private final String unlocalizedName; + + private EnumType(int meta, String name, String unlocalizedName) + { + this.meta = meta; + this.name = name; + this.unlocalizedName = unlocalizedName; + } + + public int getMetadata() + { + return this.meta; + } + + public String toString() + { + return this.name; + } + + public static BlockPrismarine.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + static { + for (BlockPrismarine.EnumType blockprismarine$enumtype : values()) + { + META_LOOKUP[blockprismarine$enumtype.getMetadata()] = blockprismarine$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockPumpkin.java b/src/minecraft/net/minecraft/block/BlockPumpkin.java new file mode 100644 index 0000000..fa19f03 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockPumpkin.java @@ -0,0 +1,190 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockWorldState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.pattern.BlockPattern; +import net.minecraft.block.state.pattern.BlockStateHelper; +import net.minecraft.block.state.pattern.FactoryBlockPattern; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.monster.EntitySnowman; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class BlockPumpkin extends BlockDirectional +{ + private BlockPattern snowmanBasePattern; + private BlockPattern snowmanPattern; + private BlockPattern golemBasePattern; + private BlockPattern golemPattern; + private static final Predicate field_181085_Q = new Predicate() + { + public boolean apply(IBlockState p_apply_1_) + { + return p_apply_1_ != null && (p_apply_1_.getBlock() == Blocks.pumpkin || p_apply_1_.getBlock() == Blocks.lit_pumpkin); + } + }; + + protected BlockPumpkin() + { + super(Material.gourd, MapColor.adobeColor); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + super.onBlockAdded(worldIn, pos, state); + this.trySpawnGolem(worldIn, pos); + } + + public boolean canDispenserPlace(World worldIn, BlockPos pos) + { + return this.getSnowmanBasePattern().match(worldIn, pos) != null || this.getGolemBasePattern().match(worldIn, pos) != null; + } + + private void trySpawnGolem(World worldIn, BlockPos pos) + { + BlockPattern.PatternHelper blockpattern$patternhelper; + + if ((blockpattern$patternhelper = this.getSnowmanPattern().match(worldIn, pos)) != null) + { + for (int i = 0; i < this.getSnowmanPattern().getThumbLength(); ++i) + { + BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(0, i, 0); + worldIn.setBlockState(blockworldstate.getPos(), Blocks.air.getDefaultState(), 2); + } + + EntitySnowman entitysnowman = new EntitySnowman(worldIn); + BlockPos blockpos1 = blockpattern$patternhelper.translateOffset(0, 2, 0).getPos(); + entitysnowman.setLocationAndAngles((double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 0.05D, (double)blockpos1.getZ() + 0.5D, 0.0F, 0.0F); + worldIn.spawnEntityInWorld(entitysnowman); + + for (int j = 0; j < 120; ++j) + { + worldIn.spawnParticle(EnumParticleTypes.SNOW_SHOVEL, (double)blockpos1.getX() + worldIn.rand.nextDouble(), (double)blockpos1.getY() + worldIn.rand.nextDouble() * 2.5D, (double)blockpos1.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); + } + + for (int i1 = 0; i1 < this.getSnowmanPattern().getThumbLength(); ++i1) + { + BlockWorldState blockworldstate1 = blockpattern$patternhelper.translateOffset(0, i1, 0); + worldIn.notifyNeighborsRespectDebug(blockworldstate1.getPos(), Blocks.air); + } + } + else if ((blockpattern$patternhelper = this.getGolemPattern().match(worldIn, pos)) != null) + { + for (int k = 0; k < this.getGolemPattern().getPalmLength(); ++k) + { + for (int l = 0; l < this.getGolemPattern().getThumbLength(); ++l) + { + worldIn.setBlockState(blockpattern$patternhelper.translateOffset(k, l, 0).getPos(), Blocks.air.getDefaultState(), 2); + } + } + + BlockPos blockpos = blockpattern$patternhelper.translateOffset(1, 2, 0).getPos(); + EntityIronGolem entityirongolem = new EntityIronGolem(worldIn); + entityirongolem.setPlayerCreated(true); + entityirongolem.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.05D, (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F); + worldIn.spawnEntityInWorld(entityirongolem); + + for (int j1 = 0; j1 < 120; ++j1) + { + worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double)blockpos.getX() + worldIn.rand.nextDouble(), (double)blockpos.getY() + worldIn.rand.nextDouble() * 3.9D, (double)blockpos.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); + } + + for (int k1 = 0; k1 < this.getGolemPattern().getPalmLength(); ++k1) + { + for (int l1 = 0; l1 < this.getGolemPattern().getThumbLength(); ++l1) + { + BlockWorldState blockworldstate2 = blockpattern$patternhelper.translateOffset(k1, l1, 0); + worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.air); + } + } + } + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING}); + } + + protected BlockPattern getSnowmanBasePattern() + { + if (this.snowmanBasePattern == null) + { + this.snowmanBasePattern = FactoryBlockPattern.start().aisle(new String[] {" ", "#", "#"}).where('#', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.snow))).build(); + } + + return this.snowmanBasePattern; + } + + protected BlockPattern getSnowmanPattern() + { + if (this.snowmanPattern == null) + { + this.snowmanPattern = FactoryBlockPattern.start().aisle(new String[] {"^", "#", "#"}).where('^', BlockWorldState.hasState(field_181085_Q)).where('#', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.snow))).build(); + } + + return this.snowmanPattern; + } + + protected BlockPattern getGolemBasePattern() + { + if (this.golemBasePattern == null) + { + this.golemBasePattern = FactoryBlockPattern.start().aisle(new String[] {"~ ~", "###", "~#~"}).where('#', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.iron_block))).where('~', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.air))).build(); + } + + return this.golemBasePattern; + } + + protected BlockPattern getGolemPattern() + { + if (this.golemPattern == null) + { + this.golemPattern = FactoryBlockPattern.start().aisle(new String[] {"~^~", "###", "~#~"}).where('^', BlockWorldState.hasState(field_181085_Q)).where('#', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.iron_block))).where('~', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.air))).build(); + } + + return this.golemPattern; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockQuartz.java b/src/minecraft/net/minecraft/block/BlockQuartz.java new file mode 100644 index 0000000..9684648 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockQuartz.java @@ -0,0 +1,164 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.World; + +public class BlockQuartz extends Block +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockQuartz.EnumType.class); + + public BlockQuartz() + { + super(Material.rock); + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockQuartz.EnumType.DEFAULT)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + if (meta == BlockQuartz.EnumType.LINES_Y.getMetadata()) + { + switch (facing.getAxis()) + { + case Z: + return this.getDefaultState().withProperty(VARIANT, BlockQuartz.EnumType.LINES_Z); + + case X: + return this.getDefaultState().withProperty(VARIANT, BlockQuartz.EnumType.LINES_X); + + case Y: + default: + return this.getDefaultState().withProperty(VARIANT, BlockQuartz.EnumType.LINES_Y); + } + } + else + { + return meta == BlockQuartz.EnumType.CHISELED.getMetadata() ? this.getDefaultState().withProperty(VARIANT, BlockQuartz.EnumType.CHISELED) : this.getDefaultState().withProperty(VARIANT, BlockQuartz.EnumType.DEFAULT); + } + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + BlockQuartz.EnumType blockquartz$enumtype = (BlockQuartz.EnumType)state.getValue(VARIANT); + return blockquartz$enumtype != BlockQuartz.EnumType.LINES_X && blockquartz$enumtype != BlockQuartz.EnumType.LINES_Z ? blockquartz$enumtype.getMetadata() : BlockQuartz.EnumType.LINES_Y.getMetadata(); + } + + protected ItemStack createStackedBlock(IBlockState state) + { + BlockQuartz.EnumType blockquartz$enumtype = (BlockQuartz.EnumType)state.getValue(VARIANT); + return blockquartz$enumtype != BlockQuartz.EnumType.LINES_X && blockquartz$enumtype != BlockQuartz.EnumType.LINES_Z ? super.createStackedBlock(state) : new ItemStack(Item.getItemFromBlock(this), 1, BlockQuartz.EnumType.LINES_Y.getMetadata()); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + list.add(new ItemStack(itemIn, 1, BlockQuartz.EnumType.DEFAULT.getMetadata())); + list.add(new ItemStack(itemIn, 1, BlockQuartz.EnumType.CHISELED.getMetadata())); + list.add(new ItemStack(itemIn, 1, BlockQuartz.EnumType.LINES_Y.getMetadata())); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return MapColor.quartzColor; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(VARIANT, BlockQuartz.EnumType.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockQuartz.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT}); + } + + public static enum EnumType implements IStringSerializable + { + DEFAULT(0, "default", "default"), + CHISELED(1, "chiseled", "chiseled"), + LINES_Y(2, "lines_y", "lines"), + LINES_X(3, "lines_x", "lines"), + LINES_Z(4, "lines_z", "lines"); + + private static final BlockQuartz.EnumType[] META_LOOKUP = new BlockQuartz.EnumType[values().length]; + private final int meta; + private final String field_176805_h; + private final String unlocalizedName; + + private EnumType(int meta, String name, String unlocalizedName) + { + this.meta = meta; + this.field_176805_h = name; + this.unlocalizedName = unlocalizedName; + } + + public int getMetadata() + { + return this.meta; + } + + public String toString() + { + return this.unlocalizedName; + } + + public static BlockQuartz.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.field_176805_h; + } + + static { + for (BlockQuartz.EnumType blockquartz$enumtype : values()) + { + META_LOOKUP[blockquartz$enumtype.getMetadata()] = blockquartz$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRail.java b/src/minecraft/net/minecraft/block/BlockRail.java new file mode 100644 index 0000000..2d92139 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRail.java @@ -0,0 +1,53 @@ +package net.minecraft.block; + +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockRail extends BlockRailBase +{ + public static final PropertyEnum SHAPE = PropertyEnum.create("shape", BlockRailBase.EnumRailDirection.class); + + protected BlockRail() + { + super(false); + this.setDefaultState(this.blockState.getBaseState().withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH)); + } + + protected void onNeighborChangedInternal(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (neighborBlock.canProvidePower() && (new BlockRailBase.Rail(worldIn, pos, state)).countAdjacentRails() == 3) + { + this.func_176564_a(worldIn, pos, state, false); + } + } + + public IProperty getShapeProperty() + { + return SHAPE; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(SHAPE, BlockRailBase.EnumRailDirection.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {SHAPE}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRailBase.java b/src/minecraft/net/minecraft/block/BlockRailBase.java new file mode 100644 index 0000000..08e0e78 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRailBase.java @@ -0,0 +1,674 @@ +package net.minecraft.block; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public abstract class BlockRailBase extends Block +{ + protected final boolean isPowered; + + public static boolean isRailBlock(World worldIn, BlockPos pos) + { + return isRailBlock(worldIn.getBlockState(pos)); + } + + public static boolean isRailBlock(IBlockState state) + { + Block block = state.getBlock(); + return block == Blocks.rail || block == Blocks.golden_rail || block == Blocks.detector_rail || block == Blocks.activator_rail; + } + + protected BlockRailBase(boolean isPowered) + { + super(Material.circuits); + this.isPowered = isPowered; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + this.setCreativeTab(CreativeTabs.tabTransport); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. + */ + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.collisionRayTrace(worldIn, pos, start, end); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() == this ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(this.getShapeProperty()) : null; + + if (blockrailbase$enumraildirection != null && blockrailbase$enumraildirection.isAscending()) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + } + } + + public boolean isFullCube() + { + return false; + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isRemote) + { + state = this.func_176564_a(worldIn, pos, state, true); + + if (this.isPowered) + { + this.onNeighborBlockChange(worldIn, pos, state, this); + } + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!worldIn.isRemote) + { + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.getShapeProperty()); + boolean flag = false; + + if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down())) + { + flag = true; + } + + if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !World.doesBlockHaveSolidTopSurface(worldIn, pos.east())) + { + flag = true; + } + else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !World.doesBlockHaveSolidTopSurface(worldIn, pos.west())) + { + flag = true; + } + else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !World.doesBlockHaveSolidTopSurface(worldIn, pos.north())) + { + flag = true; + } + else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !World.doesBlockHaveSolidTopSurface(worldIn, pos.south())) + { + flag = true; + } + + if (flag) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + else + { + this.onNeighborChangedInternal(worldIn, pos, state, neighborBlock); + } + } + } + + protected void onNeighborChangedInternal(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + } + + protected IBlockState func_176564_a(World worldIn, BlockPos p_176564_2_, IBlockState p_176564_3_, boolean p_176564_4_) + { + return worldIn.isRemote ? p_176564_3_ : (new BlockRailBase.Rail(worldIn, p_176564_2_, p_176564_3_)).func_180364_a(worldIn.isBlockPowered(p_176564_2_), p_176564_4_).getBlockState(); + } + + public int getMobilityFlag() + { + return 0; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + super.breakBlock(worldIn, pos, state); + + if (((BlockRailBase.EnumRailDirection)state.getValue(this.getShapeProperty())).isAscending()) + { + worldIn.notifyNeighborsOfStateChange(pos.up(), this); + } + + if (this.isPowered) + { + worldIn.notifyNeighborsOfStateChange(pos, this); + worldIn.notifyNeighborsOfStateChange(pos.down(), this); + } + } + + public abstract IProperty getShapeProperty(); + + public static enum EnumRailDirection implements IStringSerializable + { + NORTH_SOUTH(0, "north_south"), + EAST_WEST(1, "east_west"), + ASCENDING_EAST(2, "ascending_east"), + ASCENDING_WEST(3, "ascending_west"), + ASCENDING_NORTH(4, "ascending_north"), + ASCENDING_SOUTH(5, "ascending_south"), + SOUTH_EAST(6, "south_east"), + SOUTH_WEST(7, "south_west"), + NORTH_WEST(8, "north_west"), + NORTH_EAST(9, "north_east"); + + private static final BlockRailBase.EnumRailDirection[] META_LOOKUP = new BlockRailBase.EnumRailDirection[values().length]; + private final int meta; + private final String name; + + private EnumRailDirection(int meta, String name) + { + this.meta = meta; + this.name = name; + } + + public int getMetadata() + { + return this.meta; + } + + public String toString() + { + return this.name; + } + + public boolean isAscending() + { + return this == ASCENDING_NORTH || this == ASCENDING_EAST || this == ASCENDING_SOUTH || this == ASCENDING_WEST; + } + + public static BlockRailBase.EnumRailDirection byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + static { + for (BlockRailBase.EnumRailDirection blockrailbase$enumraildirection : values()) + { + META_LOOKUP[blockrailbase$enumraildirection.getMetadata()] = blockrailbase$enumraildirection; + } + } + } + + public class Rail + { + private final World world; + private final BlockPos pos; + private final BlockRailBase block; + private IBlockState state; + private final boolean isPowered; + private final List field_150657_g = Lists.newArrayList(); + + public Rail(World worldIn, BlockPos pos, IBlockState state) + { + this.world = worldIn; + this.pos = pos; + this.state = state; + this.block = (BlockRailBase)state.getBlock(); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty()); + this.isPowered = this.block.isPowered; + this.func_180360_a(blockrailbase$enumraildirection); + } + + private void func_180360_a(BlockRailBase.EnumRailDirection p_180360_1_) + { + this.field_150657_g.clear(); + + switch (p_180360_1_) + { + case NORTH_SOUTH: + this.field_150657_g.add(this.pos.north()); + this.field_150657_g.add(this.pos.south()); + break; + + case EAST_WEST: + this.field_150657_g.add(this.pos.west()); + this.field_150657_g.add(this.pos.east()); + break; + + case ASCENDING_EAST: + this.field_150657_g.add(this.pos.west()); + this.field_150657_g.add(this.pos.east().up()); + break; + + case ASCENDING_WEST: + this.field_150657_g.add(this.pos.west().up()); + this.field_150657_g.add(this.pos.east()); + break; + + case ASCENDING_NORTH: + this.field_150657_g.add(this.pos.north().up()); + this.field_150657_g.add(this.pos.south()); + break; + + case ASCENDING_SOUTH: + this.field_150657_g.add(this.pos.north()); + this.field_150657_g.add(this.pos.south().up()); + break; + + case SOUTH_EAST: + this.field_150657_g.add(this.pos.east()); + this.field_150657_g.add(this.pos.south()); + break; + + case SOUTH_WEST: + this.field_150657_g.add(this.pos.west()); + this.field_150657_g.add(this.pos.south()); + break; + + case NORTH_WEST: + this.field_150657_g.add(this.pos.west()); + this.field_150657_g.add(this.pos.north()); + break; + + case NORTH_EAST: + this.field_150657_g.add(this.pos.east()); + this.field_150657_g.add(this.pos.north()); + } + } + + private void func_150651_b() + { + for (int i = 0; i < this.field_150657_g.size(); ++i) + { + BlockRailBase.Rail blockrailbase$rail = this.findRailAt((BlockPos)this.field_150657_g.get(i)); + + if (blockrailbase$rail != null && blockrailbase$rail.func_150653_a(this)) + { + this.field_150657_g.set(i, blockrailbase$rail.pos); + } + else + { + this.field_150657_g.remove(i--); + } + } + } + + private boolean hasRailAt(BlockPos pos) + { + return BlockRailBase.isRailBlock(this.world, pos) || BlockRailBase.isRailBlock(this.world, pos.up()) || BlockRailBase.isRailBlock(this.world, pos.down()); + } + + private BlockRailBase.Rail findRailAt(BlockPos pos) + { + IBlockState iblockstate = this.world.getBlockState(pos); + + if (BlockRailBase.isRailBlock(iblockstate)) + { + return BlockRailBase.this.new Rail(this.world, pos, iblockstate); + } + else + { + BlockPos lvt_2_1_ = pos.up(); + iblockstate = this.world.getBlockState(lvt_2_1_); + + if (BlockRailBase.isRailBlock(iblockstate)) + { + return BlockRailBase.this.new Rail(this.world, lvt_2_1_, iblockstate); + } + else + { + lvt_2_1_ = pos.down(); + iblockstate = this.world.getBlockState(lvt_2_1_); + return BlockRailBase.isRailBlock(iblockstate) ? BlockRailBase.this.new Rail(this.world, lvt_2_1_, iblockstate) : null; + } + } + } + + private boolean func_150653_a(BlockRailBase.Rail p_150653_1_) + { + return this.func_180363_c(p_150653_1_.pos); + } + + private boolean func_180363_c(BlockPos p_180363_1_) + { + for (int i = 0; i < this.field_150657_g.size(); ++i) + { + BlockPos blockpos = (BlockPos)this.field_150657_g.get(i); + + if (blockpos.getX() == p_180363_1_.getX() && blockpos.getZ() == p_180363_1_.getZ()) + { + return true; + } + } + + return false; + } + + protected int countAdjacentRails() + { + int i = 0; + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (this.hasRailAt(this.pos.offset((EnumFacing) enumfacing))) + { + ++i; + } + } + + return i; + } + + private boolean func_150649_b(BlockRailBase.Rail rail) + { + return this.func_150653_a(rail) || this.field_150657_g.size() != 2; + } + + private void func_150645_c(BlockRailBase.Rail p_150645_1_) + { + this.field_150657_g.add(p_150645_1_.pos); + BlockPos blockpos = this.pos.north(); + BlockPos blockpos1 = this.pos.south(); + BlockPos blockpos2 = this.pos.west(); + BlockPos blockpos3 = this.pos.east(); + boolean flag = this.func_180363_c(blockpos); + boolean flag1 = this.func_180363_c(blockpos1); + boolean flag2 = this.func_180363_c(blockpos2); + boolean flag3 = this.func_180363_c(blockpos3); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = null; + + if (flag || flag1) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_SOUTH; + } + + if (flag2 || flag3) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.EAST_WEST; + } + + if (!this.isPowered) + { + if (flag1 && flag3 && !flag && !flag2) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_EAST; + } + + if (flag1 && flag2 && !flag && !flag3) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_WEST; + } + + if (flag && flag2 && !flag1 && !flag3) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_WEST; + } + + if (flag && flag3 && !flag1 && !flag2) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_EAST; + } + } + + if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) + { + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_NORTH; + } + + if (BlockRailBase.isRailBlock(this.world, blockpos1.up())) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_SOUTH; + } + } + + if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) + { + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_EAST; + } + + if (BlockRailBase.isRailBlock(this.world, blockpos2.up())) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_WEST; + } + } + + if (blockrailbase$enumraildirection == null) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_SOUTH; + } + + this.state = this.state.withProperty(this.block.getShapeProperty(), blockrailbase$enumraildirection); + this.world.setBlockState(this.pos, this.state, 3); + } + + private boolean func_180361_d(BlockPos p_180361_1_) + { + BlockRailBase.Rail blockrailbase$rail = this.findRailAt(p_180361_1_); + + if (blockrailbase$rail == null) + { + return false; + } + else + { + blockrailbase$rail.func_150651_b(); + return blockrailbase$rail.func_150649_b(this); + } + } + + public BlockRailBase.Rail func_180364_a(boolean p_180364_1_, boolean p_180364_2_) + { + BlockPos blockpos = this.pos.north(); + BlockPos blockpos1 = this.pos.south(); + BlockPos blockpos2 = this.pos.west(); + BlockPos blockpos3 = this.pos.east(); + boolean flag = this.func_180361_d(blockpos); + boolean flag1 = this.func_180361_d(blockpos1); + boolean flag2 = this.func_180361_d(blockpos2); + boolean flag3 = this.func_180361_d(blockpos3); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = null; + + if ((flag || flag1) && !flag2 && !flag3) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_SOUTH; + } + + if ((flag2 || flag3) && !flag && !flag1) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.EAST_WEST; + } + + if (!this.isPowered) + { + if (flag1 && flag3 && !flag && !flag2) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_EAST; + } + + if (flag1 && flag2 && !flag && !flag3) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_WEST; + } + + if (flag && flag2 && !flag1 && !flag3) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_WEST; + } + + if (flag && flag3 && !flag1 && !flag2) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_EAST; + } + } + + if (blockrailbase$enumraildirection == null) + { + if (flag || flag1) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_SOUTH; + } + + if (flag2 || flag3) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.EAST_WEST; + } + + if (!this.isPowered) + { + if (p_180364_1_) + { + if (flag1 && flag3) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_EAST; + } + + if (flag2 && flag1) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_WEST; + } + + if (flag3 && flag) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_EAST; + } + + if (flag && flag2) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_WEST; + } + } + else + { + if (flag && flag2) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_WEST; + } + + if (flag3 && flag) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_EAST; + } + + if (flag2 && flag1) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_WEST; + } + + if (flag1 && flag3) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.SOUTH_EAST; + } + } + } + } + + if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) + { + if (BlockRailBase.isRailBlock(this.world, blockpos.up())) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_NORTH; + } + + if (BlockRailBase.isRailBlock(this.world, blockpos1.up())) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_SOUTH; + } + } + + if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) + { + if (BlockRailBase.isRailBlock(this.world, blockpos3.up())) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_EAST; + } + + if (BlockRailBase.isRailBlock(this.world, blockpos2.up())) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.ASCENDING_WEST; + } + } + + if (blockrailbase$enumraildirection == null) + { + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_SOUTH; + } + + this.func_180360_a(blockrailbase$enumraildirection); + this.state = this.state.withProperty(this.block.getShapeProperty(), blockrailbase$enumraildirection); + + if (p_180364_2_ || this.world.getBlockState(this.pos) != this.state) + { + this.world.setBlockState(this.pos, this.state, 3); + + for (int i = 0; i < this.field_150657_g.size(); ++i) + { + BlockRailBase.Rail blockrailbase$rail = this.findRailAt((BlockPos)this.field_150657_g.get(i)); + + if (blockrailbase$rail != null) + { + blockrailbase$rail.func_150651_b(); + + if (blockrailbase$rail.func_150649_b(this)) + { + blockrailbase$rail.func_150645_c(this); + } + } + } + } + + return this; + } + + public IBlockState getBlockState() + { + return this.state; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRailDetector.java b/src/minecraft/net/minecraft/block/BlockRailDetector.java new file mode 100644 index 0000000..b0e21ee --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRailDetector.java @@ -0,0 +1,209 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import java.util.List; +import java.util.Random; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityMinecartCommandBlock; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockRailDetector extends BlockRailBase +{ + public static final PropertyEnum SHAPE = PropertyEnum.create("shape", BlockRailBase.EnumRailDirection.class, new Predicate() + { + public boolean apply(BlockRailBase.EnumRailDirection p_apply_1_) + { + return p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_WEST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_WEST; + } + }); + public static final PropertyBool POWERED = PropertyBool.create("powered"); + + public BlockRailDetector() + { + super(true); + this.setDefaultState(this.blockState.getBaseState().withProperty(POWERED, Boolean.valueOf(false)).withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH)); + this.setTickRandomly(true); + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return 20; + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * Called When an Entity Collided with the Block + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + if (!worldIn.isRemote) + { + if (!((Boolean)state.getValue(POWERED)).booleanValue()) + { + this.updatePoweredState(worldIn, pos, state); + } + } + } + + /** + * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) + */ + public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random) + { + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!worldIn.isRemote && ((Boolean)state.getValue(POWERED)).booleanValue()) + { + this.updatePoweredState(worldIn, pos, state); + } + } + + public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return ((Boolean)state.getValue(POWERED)).booleanValue() ? 15 : 0; + } + + public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return !((Boolean)state.getValue(POWERED)).booleanValue() ? 0 : (side == EnumFacing.UP ? 15 : 0); + } + + private void updatePoweredState(World worldIn, BlockPos pos, IBlockState state) + { + boolean flag = ((Boolean)state.getValue(POWERED)).booleanValue(); + boolean flag1 = false; + List list = this.findMinecarts(worldIn, pos, EntityMinecart.class, new Predicate[0]); + + if (!list.isEmpty()) + { + flag1 = true; + } + + if (flag1 && !flag) + { + worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(true)), 3); + worldIn.notifyNeighborsOfStateChange(pos, this); + worldIn.notifyNeighborsOfStateChange(pos.down(), this); + worldIn.markBlockRangeForRenderUpdate(pos, pos); + } + + if (!flag1 && flag) + { + worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(false)), 3); + worldIn.notifyNeighborsOfStateChange(pos, this); + worldIn.notifyNeighborsOfStateChange(pos.down(), this); + worldIn.markBlockRangeForRenderUpdate(pos, pos); + } + + if (flag1) + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + } + + worldIn.updateComparatorOutputLevel(pos, this); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + super.onBlockAdded(worldIn, pos, state); + this.updatePoweredState(worldIn, pos, state); + } + + public IProperty getShapeProperty() + { + return SHAPE; + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World worldIn, BlockPos pos) + { + if (((Boolean)worldIn.getBlockState(pos).getValue(POWERED)).booleanValue()) + { + List list = this.findMinecarts(worldIn, pos, EntityMinecartCommandBlock.class, new Predicate[0]); + + if (!list.isEmpty()) + { + return ((EntityMinecartCommandBlock)list.get(0)).getCommandBlockLogic().getSuccessCount(); + } + + List list1 = this.findMinecarts(worldIn, pos, EntityMinecart.class, new Predicate[] {EntitySelectors.selectInventories}); + + if (!list1.isEmpty()) + { + return Container.calcRedstoneFromInventory((IInventory)list1.get(0)); + } + } + + return 0; + } + + protected List findMinecarts(World worldIn, BlockPos pos, Class clazz, Predicate... filter) + { + AxisAlignedBB axisalignedbb = this.getDectectionBox(pos); + return filter.length != 1 ? worldIn.getEntitiesWithinAABB(clazz, axisalignedbb) : worldIn.getEntitiesWithinAABB(clazz, axisalignedbb, filter[0]); + } + + private AxisAlignedBB getDectectionBox(BlockPos pos) + { + float f = 0.2F; + return new AxisAlignedBB((double)((float)pos.getX() + 0.2F), (double)pos.getY(), (double)((float)pos.getZ() + 0.2F), (double)((float)(pos.getX() + 1) - 0.2F), (double)((float)(pos.getY() + 1) - 0.2F), (double)((float)(pos.getZ() + 1) - 0.2F)); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(SHAPE, BlockRailBase.EnumRailDirection.byMetadata(meta & 7)).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).getMetadata(); + + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {SHAPE, POWERED}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRailPowered.java b/src/minecraft/net/minecraft/block/BlockRailPowered.java new file mode 100644 index 0000000..32dd353 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRailPowered.java @@ -0,0 +1,199 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockRailPowered extends BlockRailBase +{ + public static final PropertyEnum SHAPE = PropertyEnum.create("shape", BlockRailBase.EnumRailDirection.class, new Predicate() + { + public boolean apply(BlockRailBase.EnumRailDirection p_apply_1_) + { + return p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.NORTH_WEST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_EAST && p_apply_1_ != BlockRailBase.EnumRailDirection.SOUTH_WEST; + } + }); + public static final PropertyBool POWERED = PropertyBool.create("powered"); + + protected BlockRailPowered() + { + super(true); + this.setDefaultState(this.blockState.getBaseState().withProperty(SHAPE, BlockRailBase.EnumRailDirection.NORTH_SOUTH).withProperty(POWERED, Boolean.valueOf(false))); + } + + @SuppressWarnings("incomplete-switch") + protected boolean func_176566_a(World worldIn, BlockPos pos, IBlockState state, boolean p_176566_4_, int p_176566_5_) + { + if (p_176566_5_ >= 8) + { + return false; + } + else + { + int i = pos.getX(); + int j = pos.getY(); + int k = pos.getZ(); + boolean flag = true; + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(SHAPE); + + switch (blockrailbase$enumraildirection) + { + case NORTH_SOUTH: + if (p_176566_4_) + { + ++k; + } + else + { + --k; + } + + break; + + case EAST_WEST: + if (p_176566_4_) + { + --i; + } + else + { + ++i; + } + + break; + + case ASCENDING_EAST: + if (p_176566_4_) + { + --i; + } + else + { + ++i; + ++j; + flag = false; + } + + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.EAST_WEST; + break; + + case ASCENDING_WEST: + if (p_176566_4_) + { + --i; + ++j; + flag = false; + } + else + { + ++i; + } + + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.EAST_WEST; + break; + + case ASCENDING_NORTH: + if (p_176566_4_) + { + ++k; + } + else + { + --k; + ++j; + flag = false; + } + + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_SOUTH; + break; + + case ASCENDING_SOUTH: + if (p_176566_4_) + { + ++k; + ++j; + flag = false; + } + else + { + --k; + } + + blockrailbase$enumraildirection = BlockRailBase.EnumRailDirection.NORTH_SOUTH; + } + + return this.func_176567_a(worldIn, new BlockPos(i, j, k), p_176566_4_, p_176566_5_, blockrailbase$enumraildirection) ? true : flag && this.func_176567_a(worldIn, new BlockPos(i, j - 1, k), p_176566_4_, p_176566_5_, blockrailbase$enumraildirection); + } + } + + protected boolean func_176567_a(World worldIn, BlockPos p_176567_2_, boolean p_176567_3_, int distance, BlockRailBase.EnumRailDirection p_176567_5_) + { + IBlockState iblockstate = worldIn.getBlockState(p_176567_2_); + + if (iblockstate.getBlock() != this) + { + return false; + } + else + { + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.getValue(SHAPE); + return p_176567_5_ != BlockRailBase.EnumRailDirection.EAST_WEST || blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.NORTH_SOUTH && blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.ASCENDING_NORTH && blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.ASCENDING_SOUTH ? (p_176567_5_ != BlockRailBase.EnumRailDirection.NORTH_SOUTH || blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.EAST_WEST && blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.ASCENDING_EAST && blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.ASCENDING_WEST ? (((Boolean)iblockstate.getValue(POWERED)).booleanValue() ? (worldIn.isBlockPowered(p_176567_2_) ? true : this.func_176566_a(worldIn, p_176567_2_, iblockstate, p_176567_3_, distance + 1)) : false) : false) : false; + } + } + + protected void onNeighborChangedInternal(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + boolean flag = ((Boolean)state.getValue(POWERED)).booleanValue(); + boolean flag1 = worldIn.isBlockPowered(pos) || this.func_176566_a(worldIn, pos, state, true, 0) || this.func_176566_a(worldIn, pos, state, false, 0); + + if (flag1 != flag) + { + worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(flag1)), 3); + worldIn.notifyNeighborsOfStateChange(pos.down(), this); + + if (((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).isAscending()) + { + worldIn.notifyNeighborsOfStateChange(pos.up(), this); + } + } + } + + public IProperty getShapeProperty() + { + return SHAPE; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(SHAPE, BlockRailBase.EnumRailDirection.byMetadata(meta & 7)).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((BlockRailBase.EnumRailDirection)state.getValue(SHAPE)).getMetadata(); + + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {SHAPE, POWERED}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRedFlower.java b/src/minecraft/net/minecraft/block/BlockRedFlower.java new file mode 100644 index 0000000..ac76512 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRedFlower.java @@ -0,0 +1,12 @@ +package net.minecraft.block; + +public class BlockRedFlower extends BlockFlower +{ + /** + * Get the Type of this flower (Yellow/Red) + */ + public BlockFlower.EnumFlowerColor getBlockType() + { + return BlockFlower.EnumFlowerColor.RED; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRedSandstone.java b/src/minecraft/net/minecraft/block/BlockRedSandstone.java new file mode 100644 index 0000000..c1d4fa1 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRedSandstone.java @@ -0,0 +1,121 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IStringSerializable; + +public class BlockRedSandstone extends Block +{ + public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockRedSandstone.EnumType.class); + + public BlockRedSandstone() + { + super(Material.rock, BlockSand.EnumType.RED_SAND.getMapColor()); + this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, BlockRedSandstone.EnumType.DEFAULT)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockRedSandstone.EnumType)state.getValue(TYPE)).getMetadata(); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (BlockRedSandstone.EnumType blockredsandstone$enumtype : BlockRedSandstone.EnumType.values()) + { + list.add(new ItemStack(itemIn, 1, blockredsandstone$enumtype.getMetadata())); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(TYPE, BlockRedSandstone.EnumType.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockRedSandstone.EnumType)state.getValue(TYPE)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {TYPE}); + } + + public static enum EnumType implements IStringSerializable + { + DEFAULT(0, "red_sandstone", "default"), + CHISELED(1, "chiseled_red_sandstone", "chiseled"), + SMOOTH(2, "smooth_red_sandstone", "smooth"); + + private static final BlockRedSandstone.EnumType[] META_LOOKUP = new BlockRedSandstone.EnumType[values().length]; + private final int meta; + private final String name; + private final String unlocalizedName; + + private EnumType(int meta, String name, String unlocalizedName) + { + this.meta = meta; + this.name = name; + this.unlocalizedName = unlocalizedName; + } + + public int getMetadata() + { + return this.meta; + } + + public String toString() + { + return this.name; + } + + public static BlockRedSandstone.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + static { + for (BlockRedSandstone.EnumType blockredsandstone$enumtype : values()) + { + META_LOOKUP[blockredsandstone$enumtype.getMetadata()] = blockredsandstone$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRedstoneComparator.java b/src/minecraft/net/minecraft/block/BlockRedstoneComparator.java new file mode 100644 index 0000000..cc667dc --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRedstoneComparator.java @@ -0,0 +1,339 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityComparator; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.StatCollector; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockRedstoneComparator extends BlockRedstoneDiode implements ITileEntityProvider +{ + public static final PropertyBool POWERED = PropertyBool.create("powered"); + public static final PropertyEnum MODE = PropertyEnum.create("mode", BlockRedstoneComparator.Mode.class); + + public BlockRedstoneComparator(boolean powered) + { + super(powered); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE)); + this.isBlockContainer = true; + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal("item.comparator.name"); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.comparator; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.comparator; + } + + protected int getDelay(IBlockState state) + { + return 2; + } + + protected IBlockState getPoweredState(IBlockState unpoweredState) + { + Boolean obool = (Boolean)unpoweredState.getValue(POWERED); + BlockRedstoneComparator.Mode blockredstonecomparator$mode = (BlockRedstoneComparator.Mode)unpoweredState.getValue(MODE); + EnumFacing enumfacing = (EnumFacing)unpoweredState.getValue(FACING); + return Blocks.powered_comparator.getDefaultState().withProperty(FACING, enumfacing).withProperty(POWERED, obool).withProperty(MODE, blockredstonecomparator$mode); + } + + protected IBlockState getUnpoweredState(IBlockState poweredState) + { + Boolean obool = (Boolean)poweredState.getValue(POWERED); + BlockRedstoneComparator.Mode blockredstonecomparator$mode = (BlockRedstoneComparator.Mode)poweredState.getValue(MODE); + EnumFacing enumfacing = (EnumFacing)poweredState.getValue(FACING); + return Blocks.unpowered_comparator.getDefaultState().withProperty(FACING, enumfacing).withProperty(POWERED, obool).withProperty(MODE, blockredstonecomparator$mode); + } + + protected boolean isPowered(IBlockState state) + { + return this.isRepeaterPowered || ((Boolean)state.getValue(POWERED)).booleanValue(); + } + + protected int getActiveSignal(IBlockAccess worldIn, BlockPos pos, IBlockState state) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + return tileentity instanceof TileEntityComparator ? ((TileEntityComparator)tileentity).getOutputSignal() : 0; + } + + private int calculateOutput(World worldIn, BlockPos pos, IBlockState state) + { + return state.getValue(MODE) == BlockRedstoneComparator.Mode.SUBTRACT ? Math.max(this.calculateInputStrength(worldIn, pos, state) - this.getPowerOnSides(worldIn, pos, state), 0) : this.calculateInputStrength(worldIn, pos, state); + } + + protected boolean shouldBePowered(World worldIn, BlockPos pos, IBlockState state) + { + int i = this.calculateInputStrength(worldIn, pos, state); + + if (i >= 15) + { + return true; + } + else if (i == 0) + { + return false; + } + else + { + int j = this.getPowerOnSides(worldIn, pos, state); + return j == 0 ? true : i >= j; + } + } + + protected int calculateInputStrength(World worldIn, BlockPos pos, IBlockState state) + { + int i = super.calculateInputStrength(worldIn, pos, state); + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + BlockPos blockpos = pos.offset(enumfacing); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block.hasComparatorInputOverride()) + { + i = block.getComparatorInputOverride(worldIn, blockpos); + } + else if (i < 15 && block.isNormalCube()) + { + blockpos = blockpos.offset(enumfacing); + block = worldIn.getBlockState(blockpos).getBlock(); + + if (block.hasComparatorInputOverride()) + { + i = block.getComparatorInputOverride(worldIn, blockpos); + } + else if (block.getMaterial() == Material.air) + { + EntityItemFrame entityitemframe = this.findItemFrame(worldIn, enumfacing, blockpos); + + if (entityitemframe != null) + { + i = entityitemframe.func_174866_q(); + } + } + } + + return i; + } + + private EntityItemFrame findItemFrame(World worldIn, final EnumFacing facing, BlockPos pos) + { + List list = worldIn.getEntitiesWithinAABB(EntityItemFrame.class, new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1)), new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_ != null && p_apply_1_.getHorizontalFacing() == facing; + } + }); + return list.size() == 1 ? (EntityItemFrame)list.get(0) : null; + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (!playerIn.capabilities.allowEdit) + { + return false; + } + else + { + state = state.cycleProperty(MODE); + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, state.getValue(MODE) == BlockRedstoneComparator.Mode.SUBTRACT ? 0.55F : 0.5F); + worldIn.setBlockState(pos, state, 2); + this.onStateChange(worldIn, pos, state); + return true; + } + } + + protected void updateState(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isBlockTickPending(pos, this)) + { + int i = this.calculateOutput(worldIn, pos, state); + TileEntity tileentity = worldIn.getTileEntity(pos); + int j = tileentity instanceof TileEntityComparator ? ((TileEntityComparator)tileentity).getOutputSignal() : 0; + + if (i != j || this.isPowered(state) != this.shouldBePowered(worldIn, pos, state)) + { + if (this.isFacingTowardsRepeater(worldIn, pos, state)) + { + worldIn.updateBlockTick(pos, this, 2, -1); + } + else + { + worldIn.updateBlockTick(pos, this, 2, 0); + } + } + } + } + + private void onStateChange(World worldIn, BlockPos pos, IBlockState state) + { + int i = this.calculateOutput(worldIn, pos, state); + TileEntity tileentity = worldIn.getTileEntity(pos); + int j = 0; + + if (tileentity instanceof TileEntityComparator) + { + TileEntityComparator tileentitycomparator = (TileEntityComparator)tileentity; + j = tileentitycomparator.getOutputSignal(); + tileentitycomparator.setOutputSignal(i); + } + + if (j != i || state.getValue(MODE) == BlockRedstoneComparator.Mode.COMPARE) + { + boolean flag1 = this.shouldBePowered(worldIn, pos, state); + boolean flag = this.isPowered(state); + + if (flag && !flag1) + { + worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(false)), 2); + } + else if (!flag && flag1) + { + worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(true)), 2); + } + + this.notifyNeighbors(worldIn, pos, state); + } + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (this.isRepeaterPowered) + { + worldIn.setBlockState(pos, this.getUnpoweredState(state).withProperty(POWERED, Boolean.valueOf(true)), 4); + } + + this.onStateChange(worldIn, pos, state); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + super.onBlockAdded(worldIn, pos, state); + worldIn.setTileEntity(pos, this.createNewTileEntity(worldIn, 0)); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + super.breakBlock(worldIn, pos, state); + worldIn.removeTileEntity(pos); + this.notifyNeighbors(worldIn, pos, state); + } + + /** + * Called on both Client and Server when World#addBlockEvent is called + */ + public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) + { + super.onBlockEventReceived(worldIn, pos, state, eventID, eventParam); + TileEntity tileentity = worldIn.getTileEntity(pos); + return tileentity == null ? false : tileentity.receiveClientEvent(eventID, eventParam); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntityComparator(); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0)).withProperty(MODE, (meta & 4) > 0 ? BlockRedstoneComparator.Mode.SUBTRACT : BlockRedstoneComparator.Mode.COMPARE); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); + + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + i |= 8; + } + + if (state.getValue(MODE) == BlockRedstoneComparator.Mode.SUBTRACT) + { + i |= 4; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, MODE, POWERED}); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE); + } + + public static enum Mode implements IStringSerializable + { + COMPARE("compare"), + SUBTRACT("subtract"); + + private final String name; + + private Mode(String name) + { + this.name = name; + } + + public String toString() + { + return this.name; + } + + public String getName() + { + return this.name; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRedstoneDiode.java b/src/minecraft/net/minecraft/block/BlockRedstoneDiode.java new file mode 100644 index 0000000..93e16e5 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRedstoneDiode.java @@ -0,0 +1,290 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public abstract class BlockRedstoneDiode extends BlockDirectional +{ + /** Tells whether the repeater is powered or not */ + protected final boolean isRepeaterPowered; + + protected BlockRedstoneDiode(boolean powered) + { + super(Material.circuits); + this.isRepeaterPowered = powered; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + } + + public boolean isFullCube() + { + return false; + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? super.canPlaceBlockAt(worldIn, pos) : false; + } + + public boolean canBlockStay(World worldIn, BlockPos pos) + { + return World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); + } + + /** + * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) + */ + public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random) + { + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!this.isLocked(worldIn, pos, state)) + { + boolean flag = this.shouldBePowered(worldIn, pos, state); + + if (this.isRepeaterPowered && !flag) + { + worldIn.setBlockState(pos, this.getUnpoweredState(state), 2); + } + else if (!this.isRepeaterPowered) + { + worldIn.setBlockState(pos, this.getPoweredState(state), 2); + + if (!flag) + { + worldIn.updateBlockTick(pos, this.getPoweredState(state).getBlock(), this.getTickDelay(state), -1); + } + } + } + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return side.getAxis() != EnumFacing.Axis.Y; + } + + protected boolean isPowered(IBlockState state) + { + return this.isRepeaterPowered; + } + + public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return this.getWeakPower(worldIn, pos, state, side); + } + + public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return !this.isPowered(state) ? 0 : (state.getValue(FACING) == side ? this.getActiveSignal(worldIn, pos, state) : 0); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (this.canBlockStay(worldIn, pos)) + { + this.updateState(worldIn, pos, state); + } + else + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + + for (EnumFacing enumfacing : EnumFacing.values()) + { + worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this); + } + } + } + + protected void updateState(World worldIn, BlockPos pos, IBlockState state) + { + if (!this.isLocked(worldIn, pos, state)) + { + boolean flag = this.shouldBePowered(worldIn, pos, state); + + if ((this.isRepeaterPowered && !flag || !this.isRepeaterPowered && flag) && !worldIn.isBlockTickPending(pos, this)) + { + int i = -1; + + if (this.isFacingTowardsRepeater(worldIn, pos, state)) + { + i = -3; + } + else if (this.isRepeaterPowered) + { + i = -2; + } + + worldIn.updateBlockTick(pos, this, this.getDelay(state), i); + } + } + } + + public boolean isLocked(IBlockAccess worldIn, BlockPos pos, IBlockState state) + { + return false; + } + + protected boolean shouldBePowered(World worldIn, BlockPos pos, IBlockState state) + { + return this.calculateInputStrength(worldIn, pos, state) > 0; + } + + protected int calculateInputStrength(World worldIn, BlockPos pos, IBlockState state) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + BlockPos blockpos = pos.offset(enumfacing); + int i = worldIn.getRedstonePower(blockpos, enumfacing); + + if (i >= 15) + { + return i; + } + else + { + IBlockState iblockstate = worldIn.getBlockState(blockpos); + return Math.max(i, iblockstate.getBlock() == Blocks.redstone_wire ? ((Integer)iblockstate.getValue(BlockRedstoneWire.POWER)).intValue() : 0); + } + } + + protected int getPowerOnSides(IBlockAccess worldIn, BlockPos pos, IBlockState state) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + EnumFacing enumfacing1 = enumfacing.rotateY(); + EnumFacing enumfacing2 = enumfacing.rotateYCCW(); + return Math.max(this.getPowerOnSide(worldIn, pos.offset(enumfacing1), enumfacing1), this.getPowerOnSide(worldIn, pos.offset(enumfacing2), enumfacing2)); + } + + protected int getPowerOnSide(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + return this.canPowerSide(block) ? (block == Blocks.redstone_wire ? ((Integer)iblockstate.getValue(BlockRedstoneWire.POWER)).intValue() : worldIn.getStrongPower(pos, side)) : 0; + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + if (this.shouldBePowered(worldIn, pos, state)) + { + worldIn.scheduleUpdate(pos, this, 1); + } + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + this.notifyNeighbors(worldIn, pos, state); + } + + protected void notifyNeighbors(World worldIn, BlockPos pos, IBlockState state) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + BlockPos blockpos = pos.offset(enumfacing.getOpposite()); + worldIn.notifyBlockOfStateChange(blockpos, this); + worldIn.notifyNeighborsOfStateExcept(blockpos, this, enumfacing); + } + + /** + * Called when a player destroys this Block + */ + public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) + { + if (this.isRepeaterPowered) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this); + } + } + + super.onBlockDestroyedByPlayer(worldIn, pos, state); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + protected boolean canPowerSide(Block blockIn) + { + return blockIn.canProvidePower(); + } + + protected int getActiveSignal(IBlockAccess worldIn, BlockPos pos, IBlockState state) + { + return 15; + } + + public static boolean isRedstoneRepeaterBlockID(Block blockIn) + { + return Blocks.unpowered_repeater.isAssociated(blockIn) || Blocks.unpowered_comparator.isAssociated(blockIn); + } + + public boolean isAssociated(Block other) + { + return other == this.getPoweredState(this.getDefaultState()).getBlock() || other == this.getUnpoweredState(this.getDefaultState()).getBlock(); + } + + public boolean isFacingTowardsRepeater(World worldIn, BlockPos pos, IBlockState state) + { + EnumFacing enumfacing = ((EnumFacing)state.getValue(FACING)).getOpposite(); + BlockPos blockpos = pos.offset(enumfacing); + return isRedstoneRepeaterBlockID(worldIn.getBlockState(blockpos).getBlock()) ? worldIn.getBlockState(blockpos).getValue(FACING) != enumfacing : false; + } + + protected int getTickDelay(IBlockState state) + { + return this.getDelay(state); + } + + protected abstract int getDelay(IBlockState state); + + protected abstract IBlockState getPoweredState(IBlockState unpoweredState); + + protected abstract IBlockState getUnpoweredState(IBlockState poweredState); + + public boolean isAssociatedBlock(Block other) + { + return this.isAssociated(other); + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRedstoneLight.java b/src/minecraft/net/minecraft/block/BlockRedstoneLight.java new file mode 100644 index 0000000..454880c --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRedstoneLight.java @@ -0,0 +1,88 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockRedstoneLight extends Block +{ + private final boolean isOn; + + public BlockRedstoneLight(boolean isOn) + { + super(Material.redstoneLight); + this.isOn = isOn; + + if (isOn) + { + this.setLightLevel(1.0F); + } + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isRemote) + { + if (this.isOn && !worldIn.isBlockPowered(pos)) + { + worldIn.setBlockState(pos, Blocks.redstone_lamp.getDefaultState(), 2); + } + else if (!this.isOn && worldIn.isBlockPowered(pos)) + { + worldIn.setBlockState(pos, Blocks.lit_redstone_lamp.getDefaultState(), 2); + } + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!worldIn.isRemote) + { + if (this.isOn && !worldIn.isBlockPowered(pos)) + { + worldIn.scheduleUpdate(pos, this, 4); + } + else if (!this.isOn && worldIn.isBlockPowered(pos)) + { + worldIn.setBlockState(pos, Blocks.lit_redstone_lamp.getDefaultState(), 2); + } + } + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!worldIn.isRemote) + { + if (this.isOn && !worldIn.isBlockPowered(pos)) + { + worldIn.setBlockState(pos, Blocks.redstone_lamp.getDefaultState(), 2); + } + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Item.getItemFromBlock(Blocks.redstone_lamp); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Item.getItemFromBlock(Blocks.redstone_lamp); + } + + protected ItemStack createStackedBlock(IBlockState state) + { + return new ItemStack(Blocks.redstone_lamp); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRedstoneOre.java b/src/minecraft/net/minecraft/block/BlockRedstoneOre.java new file mode 100644 index 0000000..e8f8c7b --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRedstoneOre.java @@ -0,0 +1,178 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class BlockRedstoneOre extends Block +{ + private final boolean isOn; + + public BlockRedstoneOre(boolean isOn) + { + super(Material.rock); + + if (isOn) + { + this.setTickRandomly(true); + } + + this.isOn = isOn; + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return 30; + } + + public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) + { + this.activate(worldIn, pos); + super.onBlockClicked(worldIn, pos, playerIn); + } + + /** + * Triggered whenever an entity collides with this block (enters into the block) + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) + { + this.activate(worldIn, pos); + super.onEntityCollidedWithBlock(worldIn, pos, entityIn); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + this.activate(worldIn, pos); + return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); + } + + private void activate(World worldIn, BlockPos pos) + { + this.spawnParticles(worldIn, pos); + + if (this == Blocks.redstone_ore) + { + worldIn.setBlockState(pos, Blocks.lit_redstone_ore.getDefaultState()); + } + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (this == Blocks.lit_redstone_ore) + { + worldIn.setBlockState(pos, Blocks.redstone_ore.getDefaultState()); + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.redstone; + } + + /** + * Get the quantity dropped based on the given fortune level + */ + public int quantityDroppedWithBonus(int fortune, Random random) + { + return this.quantityDropped(random) + random.nextInt(fortune + 1); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 4 + random.nextInt(2); + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + + if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this)) + { + int i = 1 + worldIn.rand.nextInt(5); + this.dropXpOnBlockBreak(worldIn, pos, i); + } + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (this.isOn) + { + this.spawnParticles(worldIn, pos); + } + } + + private void spawnParticles(World worldIn, BlockPos pos) + { + Random random = worldIn.rand; + double d0 = 0.0625D; + + for (int i = 0; i < 6; ++i) + { + double d1 = (double)((float)pos.getX() + random.nextFloat()); + double d2 = (double)((float)pos.getY() + random.nextFloat()); + double d3 = (double)((float)pos.getZ() + random.nextFloat()); + + if (i == 0 && !worldIn.getBlockState(pos.up()).getBlock().isOpaqueCube()) + { + d2 = (double)pos.getY() + d0 + 1.0D; + } + + if (i == 1 && !worldIn.getBlockState(pos.down()).getBlock().isOpaqueCube()) + { + d2 = (double)pos.getY() - d0; + } + + if (i == 2 && !worldIn.getBlockState(pos.south()).getBlock().isOpaqueCube()) + { + d3 = (double)pos.getZ() + d0 + 1.0D; + } + + if (i == 3 && !worldIn.getBlockState(pos.north()).getBlock().isOpaqueCube()) + { + d3 = (double)pos.getZ() - d0; + } + + if (i == 4 && !worldIn.getBlockState(pos.east()).getBlock().isOpaqueCube()) + { + d1 = (double)pos.getX() + d0 + 1.0D; + } + + if (i == 5 && !worldIn.getBlockState(pos.west()).getBlock().isOpaqueCube()) + { + d1 = (double)pos.getX() - d0; + } + + if (d1 < (double)pos.getX() || d1 > (double)(pos.getX() + 1) || d2 < 0.0D || d2 > (double)(pos.getY() + 1) || d3 < (double)pos.getZ() || d3 > (double)(pos.getZ() + 1)) + { + worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d1, d2, d3, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + } + + protected ItemStack createStackedBlock(IBlockState state) + { + return new ItemStack(Blocks.redstone_ore); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRedstoneRepeater.java b/src/minecraft/net/minecraft/block/BlockRedstoneRepeater.java new file mode 100644 index 0000000..2114e97 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRedstoneRepeater.java @@ -0,0 +1,156 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.StatCollector; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockRedstoneRepeater extends BlockRedstoneDiode +{ + public static final PropertyBool LOCKED = PropertyBool.create("locked"); + public static final PropertyInteger DELAY = PropertyInteger.create("delay", 1, 4); + + protected BlockRedstoneRepeater(boolean powered) + { + super(powered); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(DELAY, Integer.valueOf(1)).withProperty(LOCKED, Boolean.valueOf(false))); + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal("item.diode.name"); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + return state.withProperty(LOCKED, Boolean.valueOf(this.isLocked(worldIn, pos, state))); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (!playerIn.capabilities.allowEdit) + { + return false; + } + else + { + worldIn.setBlockState(pos, state.cycleProperty(DELAY), 3); + return true; + } + } + + protected int getDelay(IBlockState state) + { + return ((Integer)state.getValue(DELAY)).intValue() * 2; + } + + protected IBlockState getPoweredState(IBlockState unpoweredState) + { + Integer integer = (Integer)unpoweredState.getValue(DELAY); + Boolean obool = (Boolean)unpoweredState.getValue(LOCKED); + EnumFacing enumfacing = (EnumFacing)unpoweredState.getValue(FACING); + return Blocks.powered_repeater.getDefaultState().withProperty(FACING, enumfacing).withProperty(DELAY, integer).withProperty(LOCKED, obool); + } + + protected IBlockState getUnpoweredState(IBlockState poweredState) + { + Integer integer = (Integer)poweredState.getValue(DELAY); + Boolean obool = (Boolean)poweredState.getValue(LOCKED); + EnumFacing enumfacing = (EnumFacing)poweredState.getValue(FACING); + return Blocks.unpowered_repeater.getDefaultState().withProperty(FACING, enumfacing).withProperty(DELAY, integer).withProperty(LOCKED, obool); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.repeater; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.repeater; + } + + public boolean isLocked(IBlockAccess worldIn, BlockPos pos, IBlockState state) + { + return this.getPowerOnSides(worldIn, pos, state) > 0; + } + + protected boolean canPowerSide(Block blockIn) + { + return isRedstoneRepeaterBlockID(blockIn); + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (this.isRepeaterPowered) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + double d0 = (double)((float)pos.getX() + 0.5F) + (double)(rand.nextFloat() - 0.5F) * 0.2D; + double d1 = (double)((float)pos.getY() + 0.4F) + (double)(rand.nextFloat() - 0.5F) * 0.2D; + double d2 = (double)((float)pos.getZ() + 0.5F) + (double)(rand.nextFloat() - 0.5F) * 0.2D; + float f = -5.0F; + + if (rand.nextBoolean()) + { + f = (float)(((Integer)state.getValue(DELAY)).intValue() * 2 - 1); + } + + f = f / 16.0F; + double d3 = (double)(f * (float)enumfacing.getFrontOffsetX()); + double d4 = (double)(f * (float)enumfacing.getFrontOffsetZ()); + worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + super.breakBlock(worldIn, pos, state); + this.notifyNeighbors(worldIn, pos, state); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)).withProperty(LOCKED, Boolean.valueOf(false)).withProperty(DELAY, Integer.valueOf(1 + (meta >> 2))); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); + i = i | ((Integer)state.getValue(DELAY)).intValue() - 1 << 2; + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, DELAY, LOCKED}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRedstoneTorch.java b/src/minecraft/net/minecraft/block/BlockRedstoneTorch.java new file mode 100644 index 0000000..a387dd6 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRedstoneTorch.java @@ -0,0 +1,228 @@ +package net.minecraft.block; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; +import java.util.Random; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockRedstoneTorch extends BlockTorch +{ + private static Map> toggles = Maps.>newHashMap(); + private final boolean isOn; + + private boolean isBurnedOut(World worldIn, BlockPos pos, boolean turnOff) + { + if (!toggles.containsKey(worldIn)) + { + toggles.put(worldIn, Lists.newArrayList()); + } + + List list = (List)toggles.get(worldIn); + + if (turnOff) + { + list.add(new BlockRedstoneTorch.Toggle(pos, worldIn.getTotalWorldTime())); + } + + int i = 0; + + for (int j = 0; j < list.size(); ++j) + { + BlockRedstoneTorch.Toggle blockredstonetorch$toggle = (BlockRedstoneTorch.Toggle)list.get(j); + + if (blockredstonetorch$toggle.pos.equals(pos)) + { + ++i; + + if (i >= 8) + { + return true; + } + } + } + + return false; + } + + protected BlockRedstoneTorch(boolean isOn) + { + this.isOn = isOn; + this.setTickRandomly(true); + this.setCreativeTab((CreativeTabs)null); + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return 2; + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + if (this.isOn) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this); + } + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + if (this.isOn) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this); + } + } + } + + public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return this.isOn && state.getValue(FACING) != side ? 15 : 0; + } + + private boolean shouldBeOff(World worldIn, BlockPos pos, IBlockState state) + { + EnumFacing enumfacing = ((EnumFacing)state.getValue(FACING)).getOpposite(); + return worldIn.isSidePowered(pos.offset(enumfacing), enumfacing); + } + + /** + * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) + */ + public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random) + { + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + boolean flag = this.shouldBeOff(worldIn, pos, state); + List list = (List)toggles.get(worldIn); + + while (list != null && !list.isEmpty() && worldIn.getTotalWorldTime() - ((BlockRedstoneTorch.Toggle)list.get(0)).time > 60L) + { + list.remove(0); + } + + if (this.isOn) + { + if (flag) + { + worldIn.setBlockState(pos, Blocks.unlit_redstone_torch.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3); + + if (this.isBurnedOut(worldIn, pos, true)) + { + worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F); + + for (int i = 0; i < 5; ++i) + { + double d0 = (double)pos.getX() + rand.nextDouble() * 0.6D + 0.2D; + double d1 = (double)pos.getY() + rand.nextDouble() * 0.6D + 0.2D; + double d2 = (double)pos.getZ() + rand.nextDouble() * 0.6D + 0.2D; + worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); + } + + worldIn.scheduleUpdate(pos, worldIn.getBlockState(pos).getBlock(), 160); + } + } + } + else if (!flag && !this.isBurnedOut(worldIn, pos, false)) + { + worldIn.setBlockState(pos, Blocks.redstone_torch.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3); + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!this.onNeighborChangeInternal(worldIn, pos, state)) + { + if (this.isOn == this.shouldBeOff(worldIn, pos, state)) + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + } + } + } + + public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return side == EnumFacing.DOWN ? this.getWeakPower(worldIn, pos, state, side) : 0; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Item.getItemFromBlock(Blocks.redstone_torch); + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (this.isOn) + { + double d0 = (double)pos.getX() + 0.5D + (rand.nextDouble() - 0.5D) * 0.2D; + double d1 = (double)pos.getY() + 0.7D + (rand.nextDouble() - 0.5D) * 0.2D; + double d2 = (double)pos.getZ() + 0.5D + (rand.nextDouble() - 0.5D) * 0.2D; + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + + if (enumfacing.getAxis().isHorizontal()) + { + EnumFacing enumfacing1 = enumfacing.getOpposite(); + double d3 = 0.27D; + d0 += 0.27D * (double)enumfacing1.getFrontOffsetX(); + d1 += 0.22D; + d2 += 0.27D * (double)enumfacing1.getFrontOffsetZ(); + } + + worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Item.getItemFromBlock(Blocks.redstone_torch); + } + + public boolean isAssociatedBlock(Block other) + { + return other == Blocks.unlit_redstone_torch || other == Blocks.redstone_torch; + } + + static class Toggle + { + BlockPos pos; + long time; + + public Toggle(BlockPos pos, long time) + { + this.pos = pos; + this.time = time; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRedstoneWire.java b/src/minecraft/net/minecraft/block/BlockRedstoneWire.java new file mode 100644 index 0000000..481517c --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRedstoneWire.java @@ -0,0 +1,518 @@ +package net.minecraft.block; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.util.EnumSet; +import java.util.List; +import java.util.Random; +import java.util.Set; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockRedstoneWire extends Block +{ + public static final PropertyEnum NORTH = PropertyEnum.create("north", BlockRedstoneWire.EnumAttachPosition.class); + public static final PropertyEnum EAST = PropertyEnum.create("east", BlockRedstoneWire.EnumAttachPosition.class); + public static final PropertyEnum SOUTH = PropertyEnum.create("south", BlockRedstoneWire.EnumAttachPosition.class); + public static final PropertyEnum WEST = PropertyEnum.create("west", BlockRedstoneWire.EnumAttachPosition.class); + public static final PropertyInteger POWER = PropertyInteger.create("power", 0, 15); + private boolean canProvidePower = true; + private final Set blocksNeedingUpdate = Sets.newHashSet(); + + public BlockRedstoneWire() + { + super(Material.circuits); + this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, BlockRedstoneWire.EnumAttachPosition.NONE).withProperty(EAST, BlockRedstoneWire.EnumAttachPosition.NONE).withProperty(SOUTH, BlockRedstoneWire.EnumAttachPosition.NONE).withProperty(WEST, BlockRedstoneWire.EnumAttachPosition.NONE).withProperty(POWER, Integer.valueOf(0))); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + state = state.withProperty(WEST, this.getAttachPosition(worldIn, pos, EnumFacing.WEST)); + state = state.withProperty(EAST, this.getAttachPosition(worldIn, pos, EnumFacing.EAST)); + state = state.withProperty(NORTH, this.getAttachPosition(worldIn, pos, EnumFacing.NORTH)); + state = state.withProperty(SOUTH, this.getAttachPosition(worldIn, pos, EnumFacing.SOUTH)); + return state; + } + + private BlockRedstoneWire.EnumAttachPosition getAttachPosition(IBlockAccess worldIn, BlockPos pos, EnumFacing direction) + { + BlockPos blockpos = pos.offset(direction); + Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); + + if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (block.isBlockNormalCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down())))) + { + Block block1 = worldIn.getBlockState(pos.up()).getBlock(); + return !block1.isBlockNormalCube() && block.isBlockNormalCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE; + } + else + { + return BlockRedstoneWire.EnumAttachPosition.SIDE; + } + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + return iblockstate.getBlock() != this ? super.colorMultiplier(worldIn, pos, renderPass) : this.colorMultiplier(((Integer)iblockstate.getValue(POWER)).intValue()); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) || worldIn.getBlockState(pos.down()).getBlock() == Blocks.glowstone; + } + + private IBlockState updateSurroundingRedstone(World worldIn, BlockPos pos, IBlockState state) + { + state = this.calculateCurrentChanges(worldIn, pos, pos, state); + List list = Lists.newArrayList(this.blocksNeedingUpdate); + this.blocksNeedingUpdate.clear(); + + for (BlockPos blockpos : list) + { + worldIn.notifyNeighborsOfStateChange(blockpos, this); + } + + return state; + } + + private IBlockState calculateCurrentChanges(World worldIn, BlockPos pos1, BlockPos pos2, IBlockState state) + { + IBlockState iblockstate = state; + int i = ((Integer)state.getValue(POWER)).intValue(); + int j = 0; + j = this.getMaxCurrentStrength(worldIn, pos2, j); + this.canProvidePower = false; + int k = worldIn.isBlockIndirectlyGettingPowered(pos1); + this.canProvidePower = true; + + if (k > 0 && k > j - 1) + { + j = k; + } + + int l = 0; + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + BlockPos blockpos = pos1.offset((EnumFacing) enumfacing); + boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ(); + + if (flag) + { + l = this.getMaxCurrentStrength(worldIn, blockpos, l); + } + + if (worldIn.getBlockState(blockpos).getBlock().isNormalCube() && !worldIn.getBlockState(pos1.up()).getBlock().isNormalCube()) + { + if (flag && pos1.getY() >= pos2.getY()) + { + l = this.getMaxCurrentStrength(worldIn, blockpos.up(), l); + } + } + else if (!worldIn.getBlockState(blockpos).getBlock().isNormalCube() && flag && pos1.getY() <= pos2.getY()) + { + l = this.getMaxCurrentStrength(worldIn, blockpos.down(), l); + } + } + + if (l > j) + { + j = l - 1; + } + else if (j > 0) + { + --j; + } + else + { + j = 0; + } + + if (k > j - 1) + { + j = k; + } + + if (i != j) + { + state = state.withProperty(POWER, Integer.valueOf(j)); + + if (worldIn.getBlockState(pos1) == iblockstate) + { + worldIn.setBlockState(pos1, state, 2); + } + + this.blocksNeedingUpdate.add(pos1); + + for (EnumFacing enumfacing1 : EnumFacing.values()) + { + this.blocksNeedingUpdate.add(pos1.offset(enumfacing1)); + } + } + + return state; + } + + /** + * Calls World.notifyNeighborsOfStateChange() for all neighboring blocks, but only if the given block is a redstone + * wire. + */ + private void notifyWireNeighborsOfStateChange(World worldIn, BlockPos pos) + { + if (worldIn.getBlockState(pos).getBlock() == this) + { + worldIn.notifyNeighborsOfStateChange(pos, this); + + for (EnumFacing enumfacing : EnumFacing.values()) + { + worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this); + } + } + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isRemote) + { + this.updateSurroundingRedstone(worldIn, pos, state); + + for (Object enumfacing : EnumFacing.Plane.VERTICAL) + { + worldIn.notifyNeighborsOfStateChange(pos.offset((EnumFacing) enumfacing), this); + } + + for (Object enumfacing10 : EnumFacing.Plane.HORIZONTAL) + { + EnumFacing enumfacing1 = (EnumFacing) enumfacing10; + this.notifyWireNeighborsOfStateChange(worldIn, pos.offset(enumfacing1)); + } + + for (Object enumfacing20 : EnumFacing.Plane.HORIZONTAL) + { + EnumFacing enumfacing2 = (EnumFacing) enumfacing20; + BlockPos blockpos = pos.offset(enumfacing2); + + if (worldIn.getBlockState(blockpos).getBlock().isNormalCube()) + { + this.notifyWireNeighborsOfStateChange(worldIn, blockpos.up()); + } + else + { + this.notifyWireNeighborsOfStateChange(worldIn, blockpos.down()); + } + } + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + super.breakBlock(worldIn, pos, state); + + if (!worldIn.isRemote) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this); + } + + this.updateSurroundingRedstone(worldIn, pos, state); + + for (Object enumfacing1 : EnumFacing.Plane.HORIZONTAL) + { + this.notifyWireNeighborsOfStateChange(worldIn, pos.offset((EnumFacing) enumfacing1)); + } + + for (Object enumfacing2 : EnumFacing.Plane.HORIZONTAL) + { + BlockPos blockpos = pos.offset((EnumFacing) enumfacing2); + + if (worldIn.getBlockState(blockpos).getBlock().isNormalCube()) + { + this.notifyWireNeighborsOfStateChange(worldIn, blockpos.up()); + } + else + { + this.notifyWireNeighborsOfStateChange(worldIn, blockpos.down()); + } + } + } + } + + private int getMaxCurrentStrength(World worldIn, BlockPos pos, int strength) + { + if (worldIn.getBlockState(pos).getBlock() != this) + { + return strength; + } + else + { + int i = ((Integer)worldIn.getBlockState(pos).getValue(POWER)).intValue(); + return i > strength ? i : strength; + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!worldIn.isRemote) + { + if (this.canPlaceBlockAt(worldIn, pos)) + { + this.updateSurroundingRedstone(worldIn, pos, state); + } + else + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.redstone; + } + + public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return !this.canProvidePower ? 0 : this.getWeakPower(worldIn, pos, state, side); + } + + public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + if (!this.canProvidePower) + { + return 0; + } + else + { + int i = ((Integer)state.getValue(POWER)).intValue(); + + if (i == 0) + { + return 0; + } + else if (side == EnumFacing.UP) + { + return i; + } + else + { + EnumSet enumset = EnumSet.noneOf(EnumFacing.class); + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (this.func_176339_d(worldIn, pos, (EnumFacing) enumfacing)) + { + enumset.add((EnumFacing) enumfacing); + } + } + + if (side.getAxis().isHorizontal() && enumset.isEmpty()) + { + return i; + } + else if (enumset.contains(side) && !enumset.contains(side.rotateYCCW()) && !enumset.contains(side.rotateY())) + { + return i; + } + else + { + return 0; + } + } + } + } + + private boolean func_176339_d(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + BlockPos blockpos = pos.offset(side); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + boolean flag = block.isNormalCube(); + boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); + return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down()))); + } + + protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos) + { + return canConnectUpwardsTo(worldIn.getBlockState(pos)); + } + + protected static boolean canConnectUpwardsTo(IBlockState state) + { + return canConnectTo(state, (EnumFacing)null); + } + + protected static boolean canConnectTo(IBlockState blockState, EnumFacing side) + { + Block block = blockState.getBlock(); + + if (block == Blocks.redstone_wire) + { + return true; + } + else if (Blocks.unpowered_repeater.isAssociated(block)) + { + EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING); + return enumfacing == side || enumfacing.getOpposite() == side; + } + else + { + return block.canProvidePower() && side != null; + } + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return this.canProvidePower; + } + + private int colorMultiplier(int powerLevel) + { + float f = (float)powerLevel / 15.0F; + float f1 = f * 0.6F + 0.4F; + + if (powerLevel == 0) + { + f1 = 0.3F; + } + + float f2 = f * f * 0.7F - 0.5F; + float f3 = f * f * 0.6F - 0.7F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f3 < 0.0F) + { + f3 = 0.0F; + } + + int i = MathHelper.clamp_int((int)(f1 * 255.0F), 0, 255); + int j = MathHelper.clamp_int((int)(f2 * 255.0F), 0, 255); + int k = MathHelper.clamp_int((int)(f3 * 255.0F), 0, 255); + return -16777216 | i << 16 | j << 8 | k; + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + int i = ((Integer)state.getValue(POWER)).intValue(); + + if (i != 0) + { + double d0 = (double)pos.getX() + 0.5D + ((double)rand.nextFloat() - 0.5D) * 0.2D; + double d1 = (double)((float)pos.getY() + 0.0625F); + double d2 = (double)pos.getZ() + 0.5D + ((double)rand.nextFloat() - 0.5D) * 0.2D; + float f = (float)i / 15.0F; + float f1 = f * 0.6F + 0.4F; + float f2 = Math.max(0.0F, f * f * 0.7F - 0.5F); + float f3 = Math.max(0.0F, f * f * 0.6F - 0.7F); + worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d0, d1, d2, (double)f1, (double)f2, (double)f3, new int[0]); + } + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.redstone; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(POWER, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(POWER)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {NORTH, EAST, SOUTH, WEST, POWER}); + } + + static enum EnumAttachPosition implements IStringSerializable + { + UP("up"), + SIDE("side"), + NONE("none"); + + private final String name; + + private EnumAttachPosition(String name) + { + this.name = name; + } + + public String toString() + { + return this.getName(); + } + + public String getName() + { + return this.name; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockReed.java b/src/minecraft/net/minecraft/block/BlockReed.java new file mode 100644 index 0000000..da7102b --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockReed.java @@ -0,0 +1,177 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockReed extends Block +{ + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15); + + protected BlockReed() + { + super(Material.plants); + this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0))); + float f = 0.375F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f); + this.setTickRandomly(true); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (worldIn.getBlockState(pos.down()).getBlock() == Blocks.reeds || this.checkForDrop(worldIn, pos, state)) + { + if (worldIn.isAirBlock(pos.up())) + { + int i; + + for (i = 1; worldIn.getBlockState(pos.down(i)).getBlock() == this; ++i) + { + ; + } + + if (i < 3) + { + int j = ((Integer)state.getValue(AGE)).intValue(); + + if (j == 15) + { + worldIn.setBlockState(pos.up(), this.getDefaultState()); + worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(0)), 4); + } + else + { + worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(j + 1)), 4); + } + } + } + } + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.down()).getBlock(); + + if (block == this) + { + return true; + } + else if (block != Blocks.grass && block != Blocks.dirt && block != Blocks.sand) + { + return false; + } + else + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (worldIn.getBlockState(pos.offset((EnumFacing) enumfacing).down()).getBlock().getMaterial() == Material.water) + { + return true; + } + } + + return false; + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + this.checkForDrop(worldIn, pos, state); + } + + protected final boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state) + { + if (this.canBlockStay(worldIn, pos)) + { + return true; + } + else + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + return false; + } + } + + public boolean canBlockStay(World worldIn, BlockPos pos) + { + return this.canPlaceBlockAt(worldIn, pos); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.reeds; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.reeds; + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return worldIn.getBiomeGenForCoords(pos).getGrassColorAtPos(pos); + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(AGE)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {AGE}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockRotatedPillar.java b/src/minecraft/net/minecraft/block/BlockRotatedPillar.java new file mode 100644 index 0000000..d54efd5 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockRotatedPillar.java @@ -0,0 +1,21 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.util.EnumFacing; + +public abstract class BlockRotatedPillar extends Block +{ + public static final PropertyEnum AXIS = PropertyEnum.create("axis", EnumFacing.Axis.class); + + protected BlockRotatedPillar(Material materialIn) + { + super(materialIn, materialIn.getMaterialMapColor()); + } + + protected BlockRotatedPillar(Material p_i46385_1_, MapColor p_i46385_2_) + { + super(p_i46385_1_, p_i46385_2_); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSand.java b/src/minecraft/net/minecraft/block/BlockSand.java new file mode 100644 index 0000000..c85a023 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSand.java @@ -0,0 +1,133 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IStringSerializable; + +public class BlockSand extends BlockFalling +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockSand.EnumType.class); + + public BlockSand() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockSand.EnumType.SAND)); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockSand.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (BlockSand.EnumType blocksand$enumtype : BlockSand.EnumType.values()) + { + list.add(new ItemStack(itemIn, 1, blocksand$enumtype.getMetadata())); + } + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return ((BlockSand.EnumType)state.getValue(VARIANT)).getMapColor(); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(VARIANT, BlockSand.EnumType.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockSand.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT}); + } + + public static enum EnumType implements IStringSerializable + { + SAND(0, "sand", "default", MapColor.sandColor), + RED_SAND(1, "red_sand", "red", MapColor.adobeColor); + + private static final BlockSand.EnumType[] META_LOOKUP = new BlockSand.EnumType[values().length]; + private final int meta; + private final String name; + private final MapColor mapColor; + private final String unlocalizedName; + + private EnumType(int meta, String name, String unlocalizedName, MapColor mapColor) + { + this.meta = meta; + this.name = name; + this.mapColor = mapColor; + this.unlocalizedName = unlocalizedName; + } + + public int getMetadata() + { + return this.meta; + } + + public String toString() + { + return this.name; + } + + public MapColor getMapColor() + { + return this.mapColor; + } + + public static BlockSand.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + static { + for (BlockSand.EnumType blocksand$enumtype : values()) + { + META_LOOKUP[blocksand$enumtype.getMetadata()] = blocksand$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSandStone.java b/src/minecraft/net/minecraft/block/BlockSandStone.java new file mode 100644 index 0000000..0de7b60 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSandStone.java @@ -0,0 +1,130 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IStringSerializable; + +public class BlockSandStone extends Block +{ + public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockSandStone.EnumType.class); + + public BlockSandStone() + { + super(Material.rock); + this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, BlockSandStone.EnumType.DEFAULT)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockSandStone.EnumType)state.getValue(TYPE)).getMetadata(); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (BlockSandStone.EnumType blocksandstone$enumtype : BlockSandStone.EnumType.values()) + { + list.add(new ItemStack(itemIn, 1, blocksandstone$enumtype.getMetadata())); + } + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return MapColor.sandColor; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(TYPE, BlockSandStone.EnumType.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockSandStone.EnumType)state.getValue(TYPE)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {TYPE}); + } + + public static enum EnumType implements IStringSerializable + { + DEFAULT(0, "sandstone", "default"), + CHISELED(1, "chiseled_sandstone", "chiseled"), + SMOOTH(2, "smooth_sandstone", "smooth"); + + private static final BlockSandStone.EnumType[] META_LOOKUP = new BlockSandStone.EnumType[values().length]; + private final int metadata; + private final String name; + private final String unlocalizedName; + + private EnumType(int meta, String name, String unlocalizedName) + { + this.metadata = meta; + this.name = name; + this.unlocalizedName = unlocalizedName; + } + + public int getMetadata() + { + return this.metadata; + } + + public String toString() + { + return this.name; + } + + public static BlockSandStone.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + static { + for (BlockSandStone.EnumType blocksandstone$enumtype : values()) + { + META_LOOKUP[blocksandstone$enumtype.getMetadata()] = blocksandstone$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSapling.java b/src/minecraft/net/minecraft/block/BlockSapling.java new file mode 100644 index 0000000..0c4f124 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSapling.java @@ -0,0 +1,269 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenBigTree; +import net.minecraft.world.gen.feature.WorldGenCanopyTree; +import net.minecraft.world.gen.feature.WorldGenForest; +import net.minecraft.world.gen.feature.WorldGenMegaJungle; +import net.minecraft.world.gen.feature.WorldGenMegaPineTree; +import net.minecraft.world.gen.feature.WorldGenSavannaTree; +import net.minecraft.world.gen.feature.WorldGenTaiga2; +import net.minecraft.world.gen.feature.WorldGenTrees; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class BlockSapling extends BlockBush implements IGrowable +{ + public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockPlanks.EnumType.class); + public static final PropertyInteger STAGE = PropertyInteger.create("stage", 0, 1); + + protected BlockSapling() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, BlockPlanks.EnumType.OAK).withProperty(STAGE, Integer.valueOf(0))); + float f = 0.4F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal(this.getUnlocalizedName() + "." + BlockPlanks.EnumType.OAK.getUnlocalizedName() + ".name"); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!worldIn.isRemote) + { + super.updateTick(worldIn, pos, state, rand); + + if (worldIn.getLightFromNeighbors(pos.up()) >= 9 && rand.nextInt(7) == 0) + { + this.grow(worldIn, pos, state, rand); + } + } + } + + public void grow(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (((Integer)state.getValue(STAGE)).intValue() == 0) + { + worldIn.setBlockState(pos, state.cycleProperty(STAGE), 4); + } + else + { + this.generateTree(worldIn, pos, state, rand); + } + } + + public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + WorldGenerator worldgenerator = (WorldGenerator)(rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true)); + int i = 0; + int j = 0; + boolean flag = false; + + switch ((BlockPlanks.EnumType)state.getValue(TYPE)) + { + case SPRUCE: + label114: + for (i = 0; i >= -1; --i) + { + for (j = 0; j >= -1; --j) + { + if (this.func_181624_a(worldIn, pos, i, j, BlockPlanks.EnumType.SPRUCE)) + { + worldgenerator = new WorldGenMegaPineTree(false, rand.nextBoolean()); + flag = true; + break label114; + } + } + } + + if (!flag) + { + j = 0; + i = 0; + worldgenerator = new WorldGenTaiga2(true); + } + + break; + + case BIRCH: + worldgenerator = new WorldGenForest(true, false); + break; + + case JUNGLE: + IBlockState iblockstate = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); + IBlockState iblockstate1 = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + label269: + + for (i = 0; i >= -1; --i) + { + for (j = 0; j >= -1; --j) + { + if (this.func_181624_a(worldIn, pos, i, j, BlockPlanks.EnumType.JUNGLE)) + { + worldgenerator = new WorldGenMegaJungle(true, 10, 20, iblockstate, iblockstate1); + flag = true; + break label269; + } + } + } + + if (!flag) + { + j = 0; + i = 0; + worldgenerator = new WorldGenTrees(true, 4 + rand.nextInt(7), iblockstate, iblockstate1, false); + } + + break; + + case ACACIA: + worldgenerator = new WorldGenSavannaTree(true); + break; + + case DARK_OAK: + label390: + for (i = 0; i >= -1; --i) + { + for (j = 0; j >= -1; --j) + { + if (this.func_181624_a(worldIn, pos, i, j, BlockPlanks.EnumType.DARK_OAK)) + { + worldgenerator = new WorldGenCanopyTree(true); + flag = true; + break label390; + } + } + } + + if (!flag) + { + return; + } + + case OAK: + } + + IBlockState iblockstate2 = Blocks.air.getDefaultState(); + + if (flag) + { + worldIn.setBlockState(pos.add(i, 0, j), iblockstate2, 4); + worldIn.setBlockState(pos.add(i + 1, 0, j), iblockstate2, 4); + worldIn.setBlockState(pos.add(i, 0, j + 1), iblockstate2, 4); + worldIn.setBlockState(pos.add(i + 1, 0, j + 1), iblockstate2, 4); + } + else + { + worldIn.setBlockState(pos, iblockstate2, 4); + } + + if (!worldgenerator.generate(worldIn, rand, pos.add(i, 0, j))) + { + if (flag) + { + worldIn.setBlockState(pos.add(i, 0, j), state, 4); + worldIn.setBlockState(pos.add(i + 1, 0, j), state, 4); + worldIn.setBlockState(pos.add(i, 0, j + 1), state, 4); + worldIn.setBlockState(pos.add(i + 1, 0, j + 1), state, 4); + } + else + { + worldIn.setBlockState(pos, state, 4); + } + } + } + + private boolean func_181624_a(World p_181624_1_, BlockPos p_181624_2_, int p_181624_3_, int p_181624_4_, BlockPlanks.EnumType p_181624_5_) + { + return this.isTypeAt(p_181624_1_, p_181624_2_.add(p_181624_3_, 0, p_181624_4_), p_181624_5_) && this.isTypeAt(p_181624_1_, p_181624_2_.add(p_181624_3_ + 1, 0, p_181624_4_), p_181624_5_) && this.isTypeAt(p_181624_1_, p_181624_2_.add(p_181624_3_, 0, p_181624_4_ + 1), p_181624_5_) && this.isTypeAt(p_181624_1_, p_181624_2_.add(p_181624_3_ + 1, 0, p_181624_4_ + 1), p_181624_5_); + } + + /** + * Check whether the given BlockPos has a Sapling of the given type + */ + public boolean isTypeAt(World worldIn, BlockPos pos, BlockPlanks.EnumType type) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + return iblockstate.getBlock() == this && iblockstate.getValue(TYPE) == type; + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockPlanks.EnumType)state.getValue(TYPE)).getMetadata(); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (BlockPlanks.EnumType blockplanks$enumtype : BlockPlanks.EnumType.values()) + { + list.add(new ItemStack(itemIn, 1, blockplanks$enumtype.getMetadata())); + } + } + + /** + * Whether this IGrowable can grow + */ + public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) + { + return true; + } + + public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + return (double)worldIn.rand.nextFloat() < 0.45D; + } + + public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + this.grow(worldIn, pos, state, rand); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(TYPE, BlockPlanks.EnumType.byMetadata(meta & 7)).withProperty(STAGE, Integer.valueOf((meta & 8) >> 3)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((BlockPlanks.EnumType)state.getValue(TYPE)).getMetadata(); + i = i | ((Integer)state.getValue(STAGE)).intValue() << 3; + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {TYPE, STAGE}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSeaLantern.java b/src/minecraft/net/minecraft/block/BlockSeaLantern.java new file mode 100644 index 0000000..5896cad --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSeaLantern.java @@ -0,0 +1,56 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.MathHelper; + +public class BlockSeaLantern extends Block +{ + public BlockSeaLantern(Material materialIn) + { + super(materialIn); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 2 + random.nextInt(2); + } + + /** + * Get the quantity dropped based on the given fortune level + */ + public int quantityDroppedWithBonus(int fortune, Random random) + { + return MathHelper.clamp_int(this.quantityDropped(random) + random.nextInt(fortune + 1), 1, 5); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.prismarine_crystals; + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return MapColor.quartzColor; + } + + protected boolean canSilkHarvest() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSign.java b/src/minecraft/net/minecraft/block/BlockSign.java new file mode 100644 index 0000000..0d83091 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSign.java @@ -0,0 +1,99 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockSign extends BlockContainer +{ + protected BlockSign() + { + super(Material.wood); + float f = 0.25F; + float f1 = 1.0F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getSelectedBoundingBox(worldIn, pos); + } + + public boolean isFullCube() + { + return false; + } + + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + { + return true; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean func_181623_g() + { + return true; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntitySign(); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.sign; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.sign; + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + TileEntity tileentity = worldIn.getTileEntity(pos); + return tileentity instanceof TileEntitySign ? ((TileEntitySign)tileentity).executeCommand(playerIn) : false; + } + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return !this.func_181087_e(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSilverfish.java b/src/minecraft/net/minecraft/block/BlockSilverfish.java new file mode 100644 index 0000000..54887a3 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSilverfish.java @@ -0,0 +1,235 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.monster.EntitySilverfish; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.World; + +public class BlockSilverfish extends Block +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockSilverfish.EnumType.class); + + public BlockSilverfish() + { + super(Material.clay); + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockSilverfish.EnumType.STONE)); + this.setHardness(0.0F); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + public static boolean canContainSilverfish(IBlockState blockState) + { + Block block = blockState.getBlock(); + return blockState == Blocks.stone.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.STONE) || block == Blocks.cobblestone || block == Blocks.stonebrick; + } + + protected ItemStack createStackedBlock(IBlockState state) + { + switch ((BlockSilverfish.EnumType)state.getValue(VARIANT)) + { + case COBBLESTONE: + return new ItemStack(Blocks.cobblestone); + + case STONEBRICK: + return new ItemStack(Blocks.stonebrick); + + case MOSSY_STONEBRICK: + return new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.EnumType.MOSSY.getMetadata()); + + case CRACKED_STONEBRICK: + return new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.EnumType.CRACKED.getMetadata()); + + case CHISELED_STONEBRICK: + return new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.EnumType.CHISELED.getMetadata()); + + default: + return new ItemStack(Blocks.stone); + } + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doTileDrops")) + { + EntitySilverfish entitysilverfish = new EntitySilverfish(worldIn); + entitysilverfish.setLocationAndAngles((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, 0.0F, 0.0F); + worldIn.spawnEntityInWorld(entitysilverfish); + entitysilverfish.spawnExplosionParticle(); + } + } + + public int getDamageValue(World worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + return iblockstate.getBlock().getMetaFromState(iblockstate); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (BlockSilverfish.EnumType blocksilverfish$enumtype : BlockSilverfish.EnumType.values()) + { + list.add(new ItemStack(itemIn, 1, blocksilverfish$enumtype.getMetadata())); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(VARIANT, BlockSilverfish.EnumType.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockSilverfish.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT}); + } + + public static enum EnumType implements IStringSerializable + { + STONE(0, "stone") + { + public IBlockState getModelBlock() + { + return Blocks.stone.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.STONE); + } + }, + COBBLESTONE(1, "cobblestone", "cobble") + { + public IBlockState getModelBlock() + { + return Blocks.cobblestone.getDefaultState(); + } + }, + STONEBRICK(2, "stone_brick", "brick") + { + public IBlockState getModelBlock() + { + return Blocks.stonebrick.getDefaultState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.DEFAULT); + } + }, + MOSSY_STONEBRICK(3, "mossy_brick", "mossybrick") + { + public IBlockState getModelBlock() + { + return Blocks.stonebrick.getDefaultState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.MOSSY); + } + }, + CRACKED_STONEBRICK(4, "cracked_brick", "crackedbrick") + { + public IBlockState getModelBlock() + { + return Blocks.stonebrick.getDefaultState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.CRACKED); + } + }, + CHISELED_STONEBRICK(5, "chiseled_brick", "chiseledbrick") + { + public IBlockState getModelBlock() + { + return Blocks.stonebrick.getDefaultState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.CHISELED); + } + }; + + private static final BlockSilverfish.EnumType[] META_LOOKUP = new BlockSilverfish.EnumType[values().length]; + private final int meta; + private final String name; + private final String unlocalizedName; + + private EnumType(int meta, String name) + { + this(meta, name, name); + } + + private EnumType(int meta, String name, String unlocalizedName) + { + this.meta = meta; + this.name = name; + this.unlocalizedName = unlocalizedName; + } + + public int getMetadata() + { + return this.meta; + } + + public String toString() + { + return this.name; + } + + public static BlockSilverfish.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + public abstract IBlockState getModelBlock(); + + public static BlockSilverfish.EnumType forModelBlock(IBlockState model) + { + for (BlockSilverfish.EnumType blocksilverfish$enumtype : values()) + { + if (model == blocksilverfish$enumtype.getModelBlock()) + { + return blocksilverfish$enumtype; + } + } + + return STONE; + } + + static { + for (BlockSilverfish.EnumType blocksilverfish$enumtype : values()) + { + META_LOOKUP[blocksilverfish$enumtype.getMetadata()] = blocksilverfish$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSkull.java b/src/minecraft/net/minecraft/block/BlockSkull.java new file mode 100644 index 0000000..7f17ba2 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSkull.java @@ -0,0 +1,301 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockWorldState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.pattern.BlockPattern; +import net.minecraft.block.state.pattern.BlockStateHelper; +import net.minecraft.block.state.pattern.FactoryBlockPattern; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.stats.AchievementList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntitySkull; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.StatCollector; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockSkull extends BlockContainer +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing"); + public static final PropertyBool NODROP = PropertyBool.create("nodrop"); + private static final Predicate IS_WITHER_SKELETON = new Predicate() + { + public boolean apply(BlockWorldState p_apply_1_) + { + return p_apply_1_.getBlockState() != null && p_apply_1_.getBlockState().getBlock() == Blocks.skull && p_apply_1_.getTileEntity() instanceof TileEntitySkull && ((TileEntitySkull)p_apply_1_.getTileEntity()).getSkullType() == 1; + } + }; + private BlockPattern witherBasePattern; + private BlockPattern witherPattern; + + protected BlockSkull() + { + super(Material.circuits); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(NODROP, Boolean.valueOf(false))); + this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal("tile.skull.skeleton.name"); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + switch ((EnumFacing)worldIn.getBlockState(pos).getValue(FACING)) + { + case UP: + default: + this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); + break; + + case NORTH: + this.setBlockBounds(0.25F, 0.25F, 0.5F, 0.75F, 0.75F, 1.0F); + break; + + case SOUTH: + this.setBlockBounds(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 0.5F); + break; + + case WEST: + this.setBlockBounds(0.5F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F); + break; + + case EAST: + this.setBlockBounds(0.0F, 0.25F, 0.25F, 0.5F, 0.75F, 0.75F); + } + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getCollisionBoundingBox(worldIn, pos, state); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()).withProperty(NODROP, Boolean.valueOf(false)); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn, int meta) + { + return new TileEntitySkull(); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.skull; + } + + public int getDamageValue(World worldIn, BlockPos pos) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos); + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + } + + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + if (player.capabilities.isCreativeMode) + { + state = state.withProperty(NODROP, Boolean.valueOf(true)); + worldIn.setBlockState(pos, state, 4); + } + + super.onBlockHarvested(worldIn, pos, state, player); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isRemote) + { + if (!((Boolean)state.getValue(NODROP)).booleanValue()) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntitySkull) + { + TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; + ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos)); + + if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null) + { + itemstack.setTagCompound(new NBTTagCompound()); + NBTTagCompound nbttagcompound = new NBTTagCompound(); + NBTUtil.writeGameProfile(nbttagcompound, tileentityskull.getPlayerProfile()); + itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound); + } + + spawnAsEntity(worldIn, pos, itemstack); + } + } + + super.breakBlock(worldIn, pos, state); + } + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.skull; + } + + public boolean canDispenserPlace(World worldIn, BlockPos pos, ItemStack stack) + { + return stack.getMetadata() == 1 && pos.getY() >= 2 && worldIn.getDifficulty() != EnumDifficulty.PEACEFUL && !worldIn.isRemote ? this.getWitherBasePattern().match(worldIn, pos) != null : false; + } + + public void checkWitherSpawn(World worldIn, BlockPos pos, TileEntitySkull te) + { + if (te.getSkullType() == 1 && pos.getY() >= 2 && worldIn.getDifficulty() != EnumDifficulty.PEACEFUL && !worldIn.isRemote) + { + BlockPattern blockpattern = this.getWitherPattern(); + BlockPattern.PatternHelper blockpattern$patternhelper = blockpattern.match(worldIn, pos); + + if (blockpattern$patternhelper != null) + { + for (int i = 0; i < 3; ++i) + { + BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, 0, 0); + worldIn.setBlockState(blockworldstate.getPos(), blockworldstate.getBlockState().withProperty(NODROP, Boolean.valueOf(true)), 2); + } + + for (int j = 0; j < blockpattern.getPalmLength(); ++j) + { + for (int k = 0; k < blockpattern.getThumbLength(); ++k) + { + BlockWorldState blockworldstate1 = blockpattern$patternhelper.translateOffset(j, k, 0); + worldIn.setBlockState(blockworldstate1.getPos(), Blocks.air.getDefaultState(), 2); + } + } + + BlockPos blockpos = blockpattern$patternhelper.translateOffset(1, 0, 0).getPos(); + EntityWither entitywither = new EntityWither(worldIn); + BlockPos blockpos1 = blockpattern$patternhelper.translateOffset(1, 2, 0).getPos(); + entitywither.setLocationAndAngles((double)blockpos1.getX() + 0.5D, (double)blockpos1.getY() + 0.55D, (double)blockpos1.getZ() + 0.5D, blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? 0.0F : 90.0F, 0.0F); + entitywither.renderYawOffset = blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? 0.0F : 90.0F; + entitywither.func_82206_m(); + + for (EntityPlayer entityplayer : worldIn.getEntitiesWithinAABB(EntityPlayer.class, entitywither.getEntityBoundingBox().expand(50.0D, 50.0D, 50.0D))) + { + entityplayer.triggerAchievement(AchievementList.spawnWither); + } + + worldIn.spawnEntityInWorld(entitywither); + + for (int l = 0; l < 120; ++l) + { + worldIn.spawnParticle(EnumParticleTypes.SNOWBALL, (double)blockpos.getX() + worldIn.rand.nextDouble(), (double)(blockpos.getY() - 2) + worldIn.rand.nextDouble() * 3.9D, (double)blockpos.getZ() + worldIn.rand.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); + } + + for (int i1 = 0; i1 < blockpattern.getPalmLength(); ++i1) + { + for (int j1 = 0; j1 < blockpattern.getThumbLength(); ++j1) + { + BlockWorldState blockworldstate2 = blockpattern$patternhelper.translateOffset(i1, j1, 0); + worldIn.notifyNeighborsRespectDebug(blockworldstate2.getPos(), Blocks.air); + } + } + } + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, EnumFacing.getFront(meta & 7)).withProperty(NODROP, Boolean.valueOf((meta & 8) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getIndex(); + + if (((Boolean)state.getValue(NODROP)).booleanValue()) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, NODROP}); + } + + protected BlockPattern getWitherBasePattern() + { + if (this.witherBasePattern == null) + { + this.witherBasePattern = FactoryBlockPattern.start().aisle(new String[] {" ", "###", "~#~"}).where('#', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.soul_sand))).where('~', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.air))).build(); + } + + return this.witherBasePattern; + } + + protected BlockPattern getWitherPattern() + { + if (this.witherPattern == null) + { + this.witherPattern = FactoryBlockPattern.start().aisle(new String[] {"^^^", "###", "~#~"}).where('#', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.soul_sand))).where('^', IS_WITHER_SKELETON).where('~', BlockWorldState.hasState(BlockStateHelper.forBlock(Blocks.air))).build(); + } + + return this.witherPattern; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSlab.java b/src/minecraft/net/minecraft/block/BlockSlab.java new file mode 100644 index 0000000..7e77d3c --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSlab.java @@ -0,0 +1,188 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public abstract class BlockSlab extends Block +{ + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockSlab.EnumBlockHalf.class); + + public BlockSlab(Material materialIn) + { + super(materialIn); + + if (this.isDouble()) + { + this.fullBlock = true; + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + } + + this.setLightOpacity(255); + } + + protected boolean canSilkHarvest() + { + return false; + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + if (this.isDouble()) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == this) + { + if (iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) + { + this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + } + } + } + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + if (this.isDouble()) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + } + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return this.isDouble(); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + IBlockState iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); + return this.isDouble() ? iblockstate : (facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double)hitY <= 0.5D) ? iblockstate : iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.TOP)); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return this.isDouble() ? 2 : 1; + } + + public boolean isFullCube() + { + return this.isDouble(); + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + if (this.isDouble()) + { + return super.shouldSideBeRendered(worldIn, pos, side); + } + else if (side != EnumFacing.UP && side != EnumFacing.DOWN && !super.shouldSideBeRendered(worldIn, pos, side)) + { + return false; + } + else + { + BlockPos blockpos = pos.offset(side.getOpposite()); + IBlockState iblockstate = worldIn.getBlockState(pos); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos); + boolean flag = isSlab(iblockstate.getBlock()) && iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; + boolean flag1 = isSlab(iblockstate1.getBlock()) && iblockstate1.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP; + return flag1 ? (side == EnumFacing.DOWN ? true : (side == EnumFacing.UP && super.shouldSideBeRendered(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || !flag)) : (side == EnumFacing.UP ? true : (side == EnumFacing.DOWN && super.shouldSideBeRendered(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || flag)); + } + } + + protected static boolean isSlab(Block blockIn) + { + return blockIn == Blocks.stone_slab || blockIn == Blocks.wooden_slab || blockIn == Blocks.stone_slab2; + } + + /** + * Returns the slab block name with the type associated with it + */ + public abstract String getUnlocalizedName(int meta); + + public int getDamageValue(World worldIn, BlockPos pos) + { + return super.getDamageValue(worldIn, pos) & 7; + } + + public abstract boolean isDouble(); + + public abstract IProperty getVariantProperty(); + + public abstract Object getVariant(ItemStack stack); + + public static enum EnumBlockHalf implements IStringSerializable + { + TOP("top"), + BOTTOM("bottom"); + + private final String name; + + private EnumBlockHalf(String name) + { + this.name = name; + } + + public String toString() + { + return this.name; + } + + public String getName() + { + return this.name; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSlime.java b/src/minecraft/net/minecraft/block/BlockSlime.java new file mode 100644 index 0000000..c8bc001 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSlime.java @@ -0,0 +1,70 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; + +public class BlockSlime extends BlockBreakable +{ + public BlockSlime() + { + super(Material.clay, false, MapColor.grassColor); + this.setCreativeTab(CreativeTabs.tabDecorations); + this.slipperiness = 0.8F; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.TRANSLUCENT; + } + + /** + * Block's chance to react to a living entity falling on it. + */ + public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) + { + if (entityIn.isSneaking()) + { + super.onFallenUpon(worldIn, pos, entityIn, fallDistance); + } + else + { + entityIn.fall(fallDistance, 0.0F); + } + } + + /** + * Called when an Entity lands on this Block. This method *must* update motionY because the entity will not do that + * on its own + */ + public void onLanded(World worldIn, Entity entityIn) + { + if (entityIn.isSneaking()) + { + super.onLanded(worldIn, entityIn); + } + else if (entityIn.motionY < 0.0D) + { + entityIn.motionY = -entityIn.motionY; + } + } + + /** + * Triggered whenever an entity collides with this block (enters into the block) + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) + { + if (Math.abs(entityIn.motionY) < 0.1D && !entityIn.isSneaking()) + { + double d0 = 0.4D + Math.abs(entityIn.motionY) * 0.2D; + entityIn.motionX *= d0; + entityIn.motionZ *= d0; + } + + super.onEntityCollidedWithBlock(worldIn, pos, entityIn); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSnow.java b/src/minecraft/net/minecraft/block/BlockSnow.java new file mode 100644 index 0000000..e130e01 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSnow.java @@ -0,0 +1,176 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockSnow extends Block +{ + public static final PropertyInteger LAYERS = PropertyInteger.create("layers", 1, 8); + + protected BlockSnow() + { + super(Material.snow); + this.setDefaultState(this.blockState.getBaseState().withProperty(LAYERS, Integer.valueOf(1))); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabDecorations); + this.setBlockBoundsForItemRender(); + } + + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + { + return ((Integer)worldIn.getBlockState(pos).getValue(LAYERS)).intValue() < 5; + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + int i = ((Integer)state.getValue(LAYERS)).intValue() - 1; + float f = 0.125F; + return new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)((float)pos.getY() + (float)i * f), (double)pos.getZ() + this.maxZ); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.getBoundsForLayers(0); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + this.getBoundsForLayers(((Integer)iblockstate.getValue(LAYERS)).intValue()); + } + + protected void getBoundsForLayers(int p_150154_1_) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, (float)p_150154_1_ / 8.0F, 1.0F); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos.down()); + Block block = iblockstate.getBlock(); + return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false; + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + this.checkAndDropBlock(worldIn, pos, state); + } + + private boolean checkAndDropBlock(World worldIn, BlockPos pos, IBlockState state) + { + if (!this.canPlaceBlockAt(worldIn, pos)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + return false; + } + else + { + return true; + } + } + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { + spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0)); + worldIn.setBlockToAir(pos); + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.snowball; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11) + { + this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); + worldIn.setBlockToAir(pos); + } + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return side == EnumFacing.UP ? true : super.shouldSideBeRendered(worldIn, pos, side); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(LAYERS, Integer.valueOf((meta & 7) + 1)); + } + + /** + * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) + */ + public boolean isReplaceable(World worldIn, BlockPos pos) + { + return ((Integer)worldIn.getBlockState(pos).getValue(LAYERS)).intValue() == 1; + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(LAYERS)).intValue() - 1; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {LAYERS}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSnowBlock.java b/src/minecraft/net/minecraft/block/BlockSnowBlock.java new file mode 100644 index 0000000..b986888 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSnowBlock.java @@ -0,0 +1,46 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.World; + +public class BlockSnowBlock extends Block +{ + protected BlockSnowBlock() + { + super(Material.craftedSnow); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.snowball; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 4; + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11) + { + this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); + worldIn.setBlockToAir(pos); + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSoulSand.java b/src/minecraft/net/minecraft/block/BlockSoulSand.java new file mode 100644 index 0000000..428cdc2 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSoulSand.java @@ -0,0 +1,34 @@ +package net.minecraft.block; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockSoulSand extends Block +{ + public BlockSoulSand() + { + super(Material.sand, MapColor.brownColor); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + float f = 0.125F; + return new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)((float)(pos.getY() + 1) - f), (double)(pos.getZ() + 1)); + } + + /** + * Called When an Entity Collided with the Block + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + entityIn.motionX *= 0.4D; + entityIn.motionZ *= 0.4D; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSourceImpl.java b/src/minecraft/net/minecraft/block/BlockSourceImpl.java new file mode 100644 index 0000000..cf75468 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSourceImpl.java @@ -0,0 +1,55 @@ +package net.minecraft.block; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockSourceImpl implements IBlockSource +{ + private final World worldObj; + private final BlockPos pos; + + public BlockSourceImpl(World worldIn, BlockPos posIn) + { + this.worldObj = worldIn; + this.pos = posIn; + } + + public World getWorld() + { + return this.worldObj; + } + + public double getX() + { + return (double)this.pos.getX() + 0.5D; + } + + public double getY() + { + return (double)this.pos.getY() + 0.5D; + } + + public double getZ() + { + return (double)this.pos.getZ() + 0.5D; + } + + public BlockPos getBlockPos() + { + return this.pos; + } + + public int getBlockMetadata() + { + IBlockState iblockstate = this.worldObj.getBlockState(this.pos); + return iblockstate.getBlock().getMetaFromState(iblockstate); + } + + public T getBlockTileEntity() + { + return (T)this.worldObj.getTileEntity(this.pos); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockSponge.java b/src/minecraft/net/minecraft/block/BlockSponge.java new file mode 100644 index 0000000..ebf0600 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockSponge.java @@ -0,0 +1,203 @@ +package net.minecraft.block; + +import com.google.common.collect.Lists; +import java.util.ArrayList; +import java.util.List; +import java.util.Queue; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.StatCollector; +import net.minecraft.util.Tuple; +import net.minecraft.world.World; + +public class BlockSponge extends Block +{ + public static final PropertyBool WET = PropertyBool.create("wet"); + + protected BlockSponge() + { + super(Material.sponge); + this.setDefaultState(this.blockState.getBaseState().withProperty(WET, Boolean.valueOf(false))); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal(this.getUnlocalizedName() + ".dry.name"); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((Boolean)state.getValue(WET)).booleanValue() ? 1 : 0; + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + this.tryAbsorb(worldIn, pos, state); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + this.tryAbsorb(worldIn, pos, state); + super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + } + + protected void tryAbsorb(World worldIn, BlockPos pos, IBlockState state) + { + if (!((Boolean)state.getValue(WET)).booleanValue() && this.absorb(worldIn, pos)) + { + worldIn.setBlockState(pos, state.withProperty(WET, Boolean.valueOf(true)), 2); + worldIn.playAuxSFX(2001, pos, Block.getIdFromBlock(Blocks.water)); + } + } + + private boolean absorb(World worldIn, BlockPos pos) + { + Queue> queue = Lists.>newLinkedList(); + ArrayList arraylist = Lists.newArrayList(); + queue.add(new Tuple(pos, Integer.valueOf(0))); + int i = 0; + + while (!((Queue)queue).isEmpty()) + { + Tuple tuple = (Tuple)queue.poll(); + BlockPos blockpos = (BlockPos)tuple.getFirst(); + int j = ((Integer)tuple.getSecond()).intValue(); + + for (EnumFacing enumfacing : EnumFacing.values()) + { + BlockPos blockpos1 = blockpos.offset(enumfacing); + + if (worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.water) + { + worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 2); + arraylist.add(blockpos1); + ++i; + + if (j < 6) + { + queue.add(new Tuple(blockpos1, Integer.valueOf(j + 1))); + } + } + } + + if (i > 64) + { + break; + } + } + + for (BlockPos blockpos2 : arraylist) + { + worldIn.notifyNeighborsOfStateChange(blockpos2, Blocks.air); + } + + return i > 0; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + list.add(new ItemStack(itemIn, 1, 0)); + list.add(new ItemStack(itemIn, 1, 1)); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(WET, Boolean.valueOf((meta & 1) == 1)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Boolean)state.getValue(WET)).booleanValue() ? 1 : 0; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {WET}); + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (((Boolean)state.getValue(WET)).booleanValue()) + { + EnumFacing enumfacing = EnumFacing.random(rand); + + if (enumfacing != EnumFacing.UP && !World.doesBlockHaveSolidTopSurface(worldIn, pos.offset(enumfacing))) + { + double d0 = (double)pos.getX(); + double d1 = (double)pos.getY(); + double d2 = (double)pos.getZ(); + + if (enumfacing == EnumFacing.DOWN) + { + d1 = d1 - 0.05D; + d0 += rand.nextDouble(); + d2 += rand.nextDouble(); + } + else + { + d1 = d1 + rand.nextDouble() * 0.8D; + + if (enumfacing.getAxis() == EnumFacing.Axis.X) + { + d2 += rand.nextDouble(); + + if (enumfacing == EnumFacing.EAST) + { + ++d0; + } + else + { + d0 += 0.05D; + } + } + else + { + d0 += rand.nextDouble(); + + if (enumfacing == EnumFacing.SOUTH) + { + ++d2; + } + else + { + d2 += 0.05D; + } + } + } + + worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockStainedGlass.java b/src/minecraft/net/minecraft/block/BlockStainedGlass.java new file mode 100644 index 0000000..2a1766a --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockStainedGlass.java @@ -0,0 +1,117 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; + +public class BlockStainedGlass extends BlockBreakable +{ + public static final PropertyEnum COLOR = PropertyEnum.create("color", EnumDyeColor.class); + + public BlockStainedGlass(Material materialIn) + { + super(materialIn, false); + this.setDefaultState(this.blockState.getBaseState().withProperty(COLOR, EnumDyeColor.WHITE)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((EnumDyeColor)state.getValue(COLOR)).getMetadata(); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (EnumDyeColor enumdyecolor : EnumDyeColor.values()) + { + list.add(new ItemStack(itemIn, 1, enumdyecolor.getMetadata())); + } + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return ((EnumDyeColor)state.getValue(COLOR)).getMapColor(); + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.TRANSLUCENT; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + protected boolean canSilkHarvest() + { + return true; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(COLOR, EnumDyeColor.byMetadata(meta)); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isRemote) + { + BlockBeacon.updateColorAsync(worldIn, pos); + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isRemote) + { + BlockBeacon.updateColorAsync(worldIn, pos); + } + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((EnumDyeColor)state.getValue(COLOR)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {COLOR}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockStainedGlassPane.java b/src/minecraft/net/minecraft/block/BlockStainedGlassPane.java new file mode 100644 index 0000000..2adc1ff --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockStainedGlassPane.java @@ -0,0 +1,98 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; + +public class BlockStainedGlassPane extends BlockPane +{ + public static final PropertyEnum COLOR = PropertyEnum.create("color", EnumDyeColor.class); + + public BlockStainedGlassPane() + { + super(Material.glass, false); + this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(COLOR, EnumDyeColor.WHITE)); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((EnumDyeColor)state.getValue(COLOR)).getMetadata(); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (int i = 0; i < EnumDyeColor.values().length; ++i) + { + list.add(new ItemStack(itemIn, 1, i)); + } + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return ((EnumDyeColor)state.getValue(COLOR)).getMapColor(); + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.TRANSLUCENT; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(COLOR, EnumDyeColor.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((EnumDyeColor)state.getValue(COLOR)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH, COLOR}); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isRemote) + { + BlockBeacon.updateColorAsync(worldIn, pos); + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + if (!worldIn.isRemote) + { + BlockBeacon.updateColorAsync(worldIn, pos); + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockStairs.java b/src/minecraft/net/minecraft/block/BlockStairs.java new file mode 100644 index 0000000..595d4fc --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockStairs.java @@ -0,0 +1,844 @@ +package net.minecraft.block; + +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.Explosion; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockStairs extends Block +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockStairs.EnumHalf.class); + public static final PropertyEnum SHAPE = PropertyEnum.create("shape", BlockStairs.EnumShape.class); + private static final int[][] field_150150_a = new int[][] {{4, 5}, {5, 7}, {6, 7}, {4, 6}, {0, 1}, {1, 3}, {2, 3}, {0, 2}}; + private final Block modelBlock; + private final IBlockState modelState; + private boolean hasRaytraced; + private int rayTracePass; + + protected BlockStairs(IBlockState modelState) + { + super(modelState.getBlock().blockMaterial); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(HALF, BlockStairs.EnumHalf.BOTTOM).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT)); + this.modelBlock = modelState.getBlock(); + this.modelState = modelState; + this.setHardness(this.modelBlock.blockHardness); + this.setResistance(this.modelBlock.blockResistance / 3.0F); + this.setStepSound(this.modelBlock.stepSound); + this.setLightOpacity(255); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + if (this.hasRaytraced) + { + this.setBlockBounds(0.5F * (float)(this.rayTracePass % 2), 0.5F * (float)(this.rayTracePass / 4 % 2), 0.5F * (float)(this.rayTracePass / 2 % 2), 0.5F + 0.5F * (float)(this.rayTracePass % 2), 0.5F + 0.5F * (float)(this.rayTracePass / 4 % 2), 0.5F + 0.5F * (float)(this.rayTracePass / 2 % 2)); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Set the block bounds as the collision bounds for the stairs at the given position + */ + public void setBaseCollisionBounds(IBlockAccess worldIn, BlockPos pos) + { + if (worldIn.getBlockState(pos).getValue(HALF) == BlockStairs.EnumHalf.TOP) + { + this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + } + } + + /** + * Checks if a block is stairs + */ + public static boolean isBlockStairs(Block blockIn) + { + return blockIn instanceof BlockStairs; + } + + /** + * Check whether there is a stair block at the given position and it has the same properties as the given BlockState + */ + public static boolean isSameStair(IBlockAccess worldIn, BlockPos pos, IBlockState state) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + return isBlockStairs(block) && iblockstate.getValue(HALF) == state.getValue(HALF) && iblockstate.getValue(FACING) == state.getValue(FACING); + } + + public int func_176307_f(IBlockAccess blockAccess, BlockPos pos) + { + IBlockState iblockstate = blockAccess.getBlockState(pos); + EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(FACING); + BlockStairs.EnumHalf blockstairs$enumhalf = (BlockStairs.EnumHalf)iblockstate.getValue(HALF); + boolean flag = blockstairs$enumhalf == BlockStairs.EnumHalf.TOP; + + if (enumfacing == EnumFacing.EAST) + { + IBlockState iblockstate1 = blockAccess.getBlockState(pos.east()); + Block block = iblockstate1.getBlock(); + + if (isBlockStairs(block) && blockstairs$enumhalf == iblockstate1.getValue(HALF)) + { + EnumFacing enumfacing1 = (EnumFacing)iblockstate1.getValue(FACING); + + if (enumfacing1 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.south(), iblockstate)) + { + return flag ? 1 : 2; + } + + if (enumfacing1 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.north(), iblockstate)) + { + return flag ? 2 : 1; + } + } + } + else if (enumfacing == EnumFacing.WEST) + { + IBlockState iblockstate2 = blockAccess.getBlockState(pos.west()); + Block block1 = iblockstate2.getBlock(); + + if (isBlockStairs(block1) && blockstairs$enumhalf == iblockstate2.getValue(HALF)) + { + EnumFacing enumfacing2 = (EnumFacing)iblockstate2.getValue(FACING); + + if (enumfacing2 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.south(), iblockstate)) + { + return flag ? 2 : 1; + } + + if (enumfacing2 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.north(), iblockstate)) + { + return flag ? 1 : 2; + } + } + } + else if (enumfacing == EnumFacing.SOUTH) + { + IBlockState iblockstate3 = blockAccess.getBlockState(pos.south()); + Block block2 = iblockstate3.getBlock(); + + if (isBlockStairs(block2) && blockstairs$enumhalf == iblockstate3.getValue(HALF)) + { + EnumFacing enumfacing3 = (EnumFacing)iblockstate3.getValue(FACING); + + if (enumfacing3 == EnumFacing.WEST && !isSameStair(blockAccess, pos.east(), iblockstate)) + { + return flag ? 2 : 1; + } + + if (enumfacing3 == EnumFacing.EAST && !isSameStair(blockAccess, pos.west(), iblockstate)) + { + return flag ? 1 : 2; + } + } + } + else if (enumfacing == EnumFacing.NORTH) + { + IBlockState iblockstate4 = blockAccess.getBlockState(pos.north()); + Block block3 = iblockstate4.getBlock(); + + if (isBlockStairs(block3) && blockstairs$enumhalf == iblockstate4.getValue(HALF)) + { + EnumFacing enumfacing4 = (EnumFacing)iblockstate4.getValue(FACING); + + if (enumfacing4 == EnumFacing.WEST && !isSameStair(blockAccess, pos.east(), iblockstate)) + { + return flag ? 1 : 2; + } + + if (enumfacing4 == EnumFacing.EAST && !isSameStair(blockAccess, pos.west(), iblockstate)) + { + return flag ? 2 : 1; + } + } + } + + return 0; + } + + public int func_176305_g(IBlockAccess blockAccess, BlockPos pos) + { + IBlockState iblockstate = blockAccess.getBlockState(pos); + EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(FACING); + BlockStairs.EnumHalf blockstairs$enumhalf = (BlockStairs.EnumHalf)iblockstate.getValue(HALF); + boolean flag = blockstairs$enumhalf == BlockStairs.EnumHalf.TOP; + + if (enumfacing == EnumFacing.EAST) + { + IBlockState iblockstate1 = blockAccess.getBlockState(pos.west()); + Block block = iblockstate1.getBlock(); + + if (isBlockStairs(block) && blockstairs$enumhalf == iblockstate1.getValue(HALF)) + { + EnumFacing enumfacing1 = (EnumFacing)iblockstate1.getValue(FACING); + + if (enumfacing1 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.north(), iblockstate)) + { + return flag ? 1 : 2; + } + + if (enumfacing1 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.south(), iblockstate)) + { + return flag ? 2 : 1; + } + } + } + else if (enumfacing == EnumFacing.WEST) + { + IBlockState iblockstate2 = blockAccess.getBlockState(pos.east()); + Block block1 = iblockstate2.getBlock(); + + if (isBlockStairs(block1) && blockstairs$enumhalf == iblockstate2.getValue(HALF)) + { + EnumFacing enumfacing2 = (EnumFacing)iblockstate2.getValue(FACING); + + if (enumfacing2 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.north(), iblockstate)) + { + return flag ? 2 : 1; + } + + if (enumfacing2 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.south(), iblockstate)) + { + return flag ? 1 : 2; + } + } + } + else if (enumfacing == EnumFacing.SOUTH) + { + IBlockState iblockstate3 = blockAccess.getBlockState(pos.north()); + Block block2 = iblockstate3.getBlock(); + + if (isBlockStairs(block2) && blockstairs$enumhalf == iblockstate3.getValue(HALF)) + { + EnumFacing enumfacing3 = (EnumFacing)iblockstate3.getValue(FACING); + + if (enumfacing3 == EnumFacing.WEST && !isSameStair(blockAccess, pos.west(), iblockstate)) + { + return flag ? 2 : 1; + } + + if (enumfacing3 == EnumFacing.EAST && !isSameStair(blockAccess, pos.east(), iblockstate)) + { + return flag ? 1 : 2; + } + } + } + else if (enumfacing == EnumFacing.NORTH) + { + IBlockState iblockstate4 = blockAccess.getBlockState(pos.south()); + Block block3 = iblockstate4.getBlock(); + + if (isBlockStairs(block3) && blockstairs$enumhalf == iblockstate4.getValue(HALF)) + { + EnumFacing enumfacing4 = (EnumFacing)iblockstate4.getValue(FACING); + + if (enumfacing4 == EnumFacing.WEST && !isSameStair(blockAccess, pos.west(), iblockstate)) + { + return flag ? 1 : 2; + } + + if (enumfacing4 == EnumFacing.EAST && !isSameStair(blockAccess, pos.east(), iblockstate)) + { + return flag ? 2 : 1; + } + } + } + + return 0; + } + + public boolean func_176306_h(IBlockAccess blockAccess, BlockPos pos) + { + IBlockState iblockstate = blockAccess.getBlockState(pos); + EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(FACING); + BlockStairs.EnumHalf blockstairs$enumhalf = (BlockStairs.EnumHalf)iblockstate.getValue(HALF); + boolean flag = blockstairs$enumhalf == BlockStairs.EnumHalf.TOP; + float f = 0.5F; + float f1 = 1.0F; + + if (flag) + { + f = 0.0F; + f1 = 0.5F; + } + + float f2 = 0.0F; + float f3 = 1.0F; + float f4 = 0.0F; + float f5 = 0.5F; + boolean flag1 = true; + + if (enumfacing == EnumFacing.EAST) + { + f2 = 0.5F; + f5 = 1.0F; + IBlockState iblockstate1 = blockAccess.getBlockState(pos.east()); + Block block = iblockstate1.getBlock(); + + if (isBlockStairs(block) && blockstairs$enumhalf == iblockstate1.getValue(HALF)) + { + EnumFacing enumfacing1 = (EnumFacing)iblockstate1.getValue(FACING); + + if (enumfacing1 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.south(), iblockstate)) + { + f5 = 0.5F; + flag1 = false; + } + else if (enumfacing1 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.north(), iblockstate)) + { + f4 = 0.5F; + flag1 = false; + } + } + } + else if (enumfacing == EnumFacing.WEST) + { + f3 = 0.5F; + f5 = 1.0F; + IBlockState iblockstate2 = blockAccess.getBlockState(pos.west()); + Block block1 = iblockstate2.getBlock(); + + if (isBlockStairs(block1) && blockstairs$enumhalf == iblockstate2.getValue(HALF)) + { + EnumFacing enumfacing2 = (EnumFacing)iblockstate2.getValue(FACING); + + if (enumfacing2 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.south(), iblockstate)) + { + f5 = 0.5F; + flag1 = false; + } + else if (enumfacing2 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.north(), iblockstate)) + { + f4 = 0.5F; + flag1 = false; + } + } + } + else if (enumfacing == EnumFacing.SOUTH) + { + f4 = 0.5F; + f5 = 1.0F; + IBlockState iblockstate3 = blockAccess.getBlockState(pos.south()); + Block block2 = iblockstate3.getBlock(); + + if (isBlockStairs(block2) && blockstairs$enumhalf == iblockstate3.getValue(HALF)) + { + EnumFacing enumfacing3 = (EnumFacing)iblockstate3.getValue(FACING); + + if (enumfacing3 == EnumFacing.WEST && !isSameStair(blockAccess, pos.east(), iblockstate)) + { + f3 = 0.5F; + flag1 = false; + } + else if (enumfacing3 == EnumFacing.EAST && !isSameStair(blockAccess, pos.west(), iblockstate)) + { + f2 = 0.5F; + flag1 = false; + } + } + } + else if (enumfacing == EnumFacing.NORTH) + { + IBlockState iblockstate4 = blockAccess.getBlockState(pos.north()); + Block block3 = iblockstate4.getBlock(); + + if (isBlockStairs(block3) && blockstairs$enumhalf == iblockstate4.getValue(HALF)) + { + EnumFacing enumfacing4 = (EnumFacing)iblockstate4.getValue(FACING); + + if (enumfacing4 == EnumFacing.WEST && !isSameStair(blockAccess, pos.east(), iblockstate)) + { + f3 = 0.5F; + flag1 = false; + } + else if (enumfacing4 == EnumFacing.EAST && !isSameStair(blockAccess, pos.west(), iblockstate)) + { + f2 = 0.5F; + flag1 = false; + } + } + } + + this.setBlockBounds(f2, f, f4, f3, f1, f5); + return flag1; + } + + public boolean func_176304_i(IBlockAccess blockAccess, BlockPos pos) + { + IBlockState iblockstate = blockAccess.getBlockState(pos); + EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(FACING); + BlockStairs.EnumHalf blockstairs$enumhalf = (BlockStairs.EnumHalf)iblockstate.getValue(HALF); + boolean flag = blockstairs$enumhalf == BlockStairs.EnumHalf.TOP; + float f = 0.5F; + float f1 = 1.0F; + + if (flag) + { + f = 0.0F; + f1 = 0.5F; + } + + float f2 = 0.0F; + float f3 = 0.5F; + float f4 = 0.5F; + float f5 = 1.0F; + boolean flag1 = false; + + if (enumfacing == EnumFacing.EAST) + { + IBlockState iblockstate1 = blockAccess.getBlockState(pos.west()); + Block block = iblockstate1.getBlock(); + + if (isBlockStairs(block) && blockstairs$enumhalf == iblockstate1.getValue(HALF)) + { + EnumFacing enumfacing1 = (EnumFacing)iblockstate1.getValue(FACING); + + if (enumfacing1 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.north(), iblockstate)) + { + f4 = 0.0F; + f5 = 0.5F; + flag1 = true; + } + else if (enumfacing1 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.south(), iblockstate)) + { + f4 = 0.5F; + f5 = 1.0F; + flag1 = true; + } + } + } + else if (enumfacing == EnumFacing.WEST) + { + IBlockState iblockstate2 = blockAccess.getBlockState(pos.east()); + Block block1 = iblockstate2.getBlock(); + + if (isBlockStairs(block1) && blockstairs$enumhalf == iblockstate2.getValue(HALF)) + { + f2 = 0.5F; + f3 = 1.0F; + EnumFacing enumfacing2 = (EnumFacing)iblockstate2.getValue(FACING); + + if (enumfacing2 == EnumFacing.NORTH && !isSameStair(blockAccess, pos.north(), iblockstate)) + { + f4 = 0.0F; + f5 = 0.5F; + flag1 = true; + } + else if (enumfacing2 == EnumFacing.SOUTH && !isSameStair(blockAccess, pos.south(), iblockstate)) + { + f4 = 0.5F; + f5 = 1.0F; + flag1 = true; + } + } + } + else if (enumfacing == EnumFacing.SOUTH) + { + IBlockState iblockstate3 = blockAccess.getBlockState(pos.north()); + Block block2 = iblockstate3.getBlock(); + + if (isBlockStairs(block2) && blockstairs$enumhalf == iblockstate3.getValue(HALF)) + { + f4 = 0.0F; + f5 = 0.5F; + EnumFacing enumfacing3 = (EnumFacing)iblockstate3.getValue(FACING); + + if (enumfacing3 == EnumFacing.WEST && !isSameStair(blockAccess, pos.west(), iblockstate)) + { + flag1 = true; + } + else if (enumfacing3 == EnumFacing.EAST && !isSameStair(blockAccess, pos.east(), iblockstate)) + { + f2 = 0.5F; + f3 = 1.0F; + flag1 = true; + } + } + } + else if (enumfacing == EnumFacing.NORTH) + { + IBlockState iblockstate4 = blockAccess.getBlockState(pos.south()); + Block block3 = iblockstate4.getBlock(); + + if (isBlockStairs(block3) && blockstairs$enumhalf == iblockstate4.getValue(HALF)) + { + EnumFacing enumfacing4 = (EnumFacing)iblockstate4.getValue(FACING); + + if (enumfacing4 == EnumFacing.WEST && !isSameStair(blockAccess, pos.west(), iblockstate)) + { + flag1 = true; + } + else if (enumfacing4 == EnumFacing.EAST && !isSameStair(blockAccess, pos.east(), iblockstate)) + { + f2 = 0.5F; + f3 = 1.0F; + flag1 = true; + } + } + } + + if (flag1) + { + this.setBlockBounds(f2, f, f4, f3, f1, f5); + } + + return flag1; + } + + /** + * Add all collision boxes of this Block to the list that intersect with the given mask. + */ + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + this.setBaseCollisionBounds(worldIn, pos); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + boolean flag = this.func_176306_h(worldIn, pos); + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + + if (flag && this.func_176304_i(worldIn, pos)) + { + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + this.modelBlock.randomDisplayTick(worldIn, pos, state, rand); + } + + public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) + { + this.modelBlock.onBlockClicked(worldIn, pos, playerIn); + } + + /** + * Called when a player destroys this Block + */ + public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) + { + this.modelBlock.onBlockDestroyedByPlayer(worldIn, pos, state); + } + + public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos) + { + return this.modelBlock.getMixedBrightnessForBlock(worldIn, pos); + } + + /** + * Returns how much this block can resist explosions from the passed in entity. + */ + public float getExplosionResistance(Entity exploder) + { + return this.modelBlock.getExplosionResistance(exploder); + } + + public EnumWorldBlockLayer getBlockLayer() + { + return this.modelBlock.getBlockLayer(); + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World worldIn) + { + return this.modelBlock.tickRate(worldIn); + } + + public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) + { + return this.modelBlock.getSelectedBoundingBox(worldIn, pos); + } + + public Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion) + { + return this.modelBlock.modifyAcceleration(worldIn, pos, entityIn, motion); + } + + /** + * Returns if this block is collidable (only used by Fire). Args: x, y, z + */ + public boolean isCollidable() + { + return this.modelBlock.isCollidable(); + } + + public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid) + { + return this.modelBlock.canCollideCheck(state, hitIfLiquid); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + return this.modelBlock.canPlaceBlockAt(worldIn, pos); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + this.onNeighborBlockChange(worldIn, pos, this.modelState, Blocks.air); + this.modelBlock.onBlockAdded(worldIn, pos, this.modelState); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + this.modelBlock.breakBlock(worldIn, pos, this.modelState); + } + + /** + * Triggered whenever an entity collides with this block (enters into the block) + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) + { + this.modelBlock.onEntityCollidedWithBlock(worldIn, pos, entityIn); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + this.modelBlock.updateTick(worldIn, pos, state, rand); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + return this.modelBlock.onBlockActivated(worldIn, pos, this.modelState, playerIn, EnumFacing.DOWN, 0.0F, 0.0F, 0.0F); + } + + /** + * Called when this Block is destroyed by an Explosion + */ + public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) + { + this.modelBlock.onBlockDestroyedByExplosion(worldIn, pos, explosionIn); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return this.modelBlock.getMapColor(this.modelState); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + IBlockState iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer); + iblockstate = iblockstate.withProperty(FACING, placer.getHorizontalFacing()).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT); + return facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double)hitY <= 0.5D) ? iblockstate.withProperty(HALF, BlockStairs.EnumHalf.BOTTOM) : iblockstate.withProperty(HALF, BlockStairs.EnumHalf.TOP); + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. + */ + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + { + MovingObjectPosition[] amovingobjectposition = new MovingObjectPosition[8]; + IBlockState iblockstate = worldIn.getBlockState(pos); + int i = ((EnumFacing)iblockstate.getValue(FACING)).getHorizontalIndex(); + boolean flag = iblockstate.getValue(HALF) == BlockStairs.EnumHalf.TOP; + int[] aint = field_150150_a[i + (flag ? 4 : 0)]; + this.hasRaytraced = true; + + for (int j = 0; j < 8; ++j) + { + this.rayTracePass = j; + + if (Arrays.binarySearch(aint, j) < 0) + { + amovingobjectposition[j] = super.collisionRayTrace(worldIn, pos, start, end); + } + } + + for (int k : aint) + { + amovingobjectposition[k] = null; + } + + MovingObjectPosition movingobjectposition1 = null; + double d1 = 0.0D; + + for (MovingObjectPosition movingobjectposition : amovingobjectposition) + { + if (movingobjectposition != null) + { + double d0 = movingobjectposition.hitVec.squareDistanceTo(end); + + if (d0 > d1) + { + movingobjectposition1 = movingobjectposition; + d1 = d0; + } + } + } + + return movingobjectposition1; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + IBlockState iblockstate = this.getDefaultState().withProperty(HALF, (meta & 4) > 0 ? BlockStairs.EnumHalf.TOP : BlockStairs.EnumHalf.BOTTOM); + iblockstate = iblockstate.withProperty(FACING, EnumFacing.getFront(5 - (meta & 3))); + return iblockstate; + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + + if (state.getValue(HALF) == BlockStairs.EnumHalf.TOP) + { + i |= 4; + } + + i = i | 5 - ((EnumFacing)state.getValue(FACING)).getIndex(); + return i; + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + if (this.func_176306_h(worldIn, pos)) + { + switch (this.func_176305_g(worldIn, pos)) + { + case 0: + state = state.withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT); + break; + + case 1: + state = state.withProperty(SHAPE, BlockStairs.EnumShape.INNER_RIGHT); + break; + + case 2: + state = state.withProperty(SHAPE, BlockStairs.EnumShape.INNER_LEFT); + } + } + else + { + switch (this.func_176307_f(worldIn, pos)) + { + case 0: + state = state.withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT); + break; + + case 1: + state = state.withProperty(SHAPE, BlockStairs.EnumShape.OUTER_RIGHT); + break; + + case 2: + state = state.withProperty(SHAPE, BlockStairs.EnumShape.OUTER_LEFT); + } + } + + return state; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, HALF, SHAPE}); + } + + public static enum EnumHalf implements IStringSerializable + { + TOP("top"), + BOTTOM("bottom"); + + private final String name; + + private EnumHalf(String name) + { + this.name = name; + } + + public String toString() + { + return this.name; + } + + public String getName() + { + return this.name; + } + } + + public static enum EnumShape implements IStringSerializable + { + STRAIGHT("straight"), + INNER_LEFT("inner_left"), + INNER_RIGHT("inner_right"), + OUTER_LEFT("outer_left"), + OUTER_RIGHT("outer_right"); + + private final String name; + + private EnumShape(String name) + { + this.name = name; + } + + public String toString() + { + return this.name; + } + + public String getName() + { + return this.name; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockStandingSign.java b/src/minecraft/net/minecraft/block/BlockStandingSign.java new file mode 100644 index 0000000..649b2ae --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockStandingSign.java @@ -0,0 +1,53 @@ +package net.minecraft.block; + +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockStandingSign extends BlockSign +{ + public static final PropertyInteger ROTATION = PropertyInteger.create("rotation", 0, 15); + + public BlockStandingSign() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(ROTATION, Integer.valueOf(0))); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!worldIn.getBlockState(pos.down()).getBlock().getMaterial().isSolid()) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + + super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(ROTATION, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(ROTATION)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {ROTATION}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockStaticLiquid.java b/src/minecraft/net/minecraft/block/BlockStaticLiquid.java new file mode 100644 index 0000000..b8f345e --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockStaticLiquid.java @@ -0,0 +1,106 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class BlockStaticLiquid extends BlockLiquid +{ + protected BlockStaticLiquid(Material materialIn) + { + super(materialIn); + this.setTickRandomly(false); + + if (materialIn == Material.lava) + { + this.setTickRandomly(true); + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!this.checkForMixing(worldIn, pos, state)) + { + this.updateLiquid(worldIn, pos, state); + } + } + + private void updateLiquid(World worldIn, BlockPos pos, IBlockState state) + { + BlockDynamicLiquid blockdynamicliquid = getFlowingBlock(this.blockMaterial); + worldIn.setBlockState(pos, blockdynamicliquid.getDefaultState().withProperty(LEVEL, state.getValue(LEVEL)), 2); + worldIn.scheduleUpdate(pos, blockdynamicliquid, this.tickRate(worldIn)); + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (this.blockMaterial == Material.lava) + { + if (worldIn.getGameRules().getBoolean("doFireTick")) + { + int i = rand.nextInt(3); + + if (i > 0) + { + BlockPos blockpos = pos; + + for (int j = 0; j < i; ++j) + { + blockpos = blockpos.add(rand.nextInt(3) - 1, 1, rand.nextInt(3) - 1); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block.blockMaterial == Material.air) + { + if (this.isSurroundingBlockFlammable(worldIn, blockpos)) + { + worldIn.setBlockState(blockpos, Blocks.fire.getDefaultState()); + return; + } + } + else if (block.blockMaterial.blocksMovement()) + { + return; + } + } + } + else + { + for (int k = 0; k < 3; ++k) + { + BlockPos blockpos1 = pos.add(rand.nextInt(3) - 1, 0, rand.nextInt(3) - 1); + + if (worldIn.isAirBlock(blockpos1.up()) && this.getCanBlockBurn(worldIn, blockpos1)) + { + worldIn.setBlockState(blockpos1.up(), Blocks.fire.getDefaultState()); + } + } + } + } + } + } + + protected boolean isSurroundingBlockFlammable(World worldIn, BlockPos pos) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + if (this.getCanBlockBurn(worldIn, pos.offset(enumfacing))) + { + return true; + } + } + + return false; + } + + private boolean getCanBlockBurn(World worldIn, BlockPos pos) + { + return worldIn.getBlockState(pos).getBlock().getMaterial().getCanBurn(); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockStem.java b/src/minecraft/net/minecraft/block/BlockStem.java new file mode 100644 index 0000000..cb70647 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockStem.java @@ -0,0 +1,237 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.properties.PropertyInteger; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockStem extends BlockBush implements IGrowable +{ + public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 7); + public static final PropertyDirection FACING = PropertyDirection.create("facing", new Predicate() + { + public boolean apply(EnumFacing p_apply_1_) + { + return p_apply_1_ != EnumFacing.DOWN; + } + }); + private final Block crop; + + protected BlockStem(Block crop) + { + this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0)).withProperty(FACING, EnumFacing.UP)); + this.crop = crop; + this.setTickRandomly(true); + float f = 0.125F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); + this.setCreativeTab((CreativeTabs)null); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + state = state.withProperty(FACING, EnumFacing.UP); + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (worldIn.getBlockState(pos.offset((EnumFacing) enumfacing)).getBlock() == this.crop) + { + state = state.withProperty(FACING, (EnumFacing) enumfacing); + break; + } + } + + return state; + } + + /** + * is the block grass, dirt or farmland + */ + protected boolean canPlaceBlockOn(Block ground) + { + return ground == Blocks.farmland; + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + super.updateTick(worldIn, pos, state, rand); + + if (worldIn.getLightFromNeighbors(pos.up()) >= 9) + { + float f = BlockCrops.getGrowthChance(this, worldIn, pos); + + if (rand.nextInt((int)(25.0F / f) + 1) == 0) + { + int i = ((Integer)state.getValue(AGE)).intValue(); + + if (i < 7) + { + state = state.withProperty(AGE, Integer.valueOf(i + 1)); + worldIn.setBlockState(pos, state, 2); + } + else + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (worldIn.getBlockState(pos.offset((EnumFacing) enumfacing)).getBlock() == this.crop) + { + return; + } + } + + pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand)); + Block block = worldIn.getBlockState(pos.down()).getBlock(); + + if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) + { + worldIn.setBlockState(pos, this.crop.getDefaultState()); + } + } + } + } + } + + public void growStem(World worldIn, BlockPos pos, IBlockState state) + { + int i = ((Integer)state.getValue(AGE)).intValue() + MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); + worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(Math.min(7, i))), 2); + } + + public int getRenderColor(IBlockState state) + { + if (state.getBlock() != this) + { + return super.getRenderColor(state); + } + else + { + int i = ((Integer)state.getValue(AGE)).intValue(); + int j = i * 32; + int k = 255 - i * 8; + int l = i * 4; + return j << 16 | k << 8 | l; + } + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return this.getRenderColor(worldIn.getBlockState(pos)); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + float f = 0.125F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + this.maxY = (double)((float)(((Integer)worldIn.getBlockState(pos).getValue(AGE)).intValue() * 2 + 2) / 16.0F); + float f = 0.125F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, (float)this.maxY, 0.5F + f); + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + + if (!worldIn.isRemote) + { + Item item = this.getSeedItem(); + + if (item != null) + { + int i = ((Integer)state.getValue(AGE)).intValue(); + + for (int j = 0; j < 3; ++j) + { + if (worldIn.rand.nextInt(15) <= i) + { + spawnAsEntity(worldIn, pos, new ItemStack(item)); + } + } + } + } + } + + protected Item getSeedItem() + { + return this.crop == Blocks.pumpkin ? Items.pumpkin_seeds : (this.crop == Blocks.melon_block ? Items.melon_seeds : null); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return null; + } + + public Item getItem(World worldIn, BlockPos pos) + { + Item item = this.getSeedItem(); + return item != null ? item : null; + } + + /** + * Whether this IGrowable can grow + */ + public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) + { + return ((Integer)state.getValue(AGE)).intValue() != 7; + } + + public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + return true; + } + + public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + this.growStem(worldIn, pos, state); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(AGE, Integer.valueOf(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Integer)state.getValue(AGE)).intValue(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {AGE, FACING}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockStone.java b/src/minecraft/net/minecraft/block/BlockStone.java new file mode 100644 index 0000000..3ff65ad --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockStone.java @@ -0,0 +1,165 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.StatCollector; + +public class BlockStone extends Block +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockStone.EnumType.class); + + public BlockStone() + { + super(Material.rock); + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockStone.EnumType.STONE)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal(this.getUnlocalizedName() + "." + BlockStone.EnumType.STONE.getUnlocalizedName() + ".name"); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return ((BlockStone.EnumType)state.getValue(VARIANT)).func_181072_c(); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return state.getValue(VARIANT) == BlockStone.EnumType.STONE ? Item.getItemFromBlock(Blocks.cobblestone) : Item.getItemFromBlock(Blocks.stone); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockStone.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (BlockStone.EnumType blockstone$enumtype : BlockStone.EnumType.values()) + { + list.add(new ItemStack(itemIn, 1, blockstone$enumtype.getMetadata())); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(VARIANT, BlockStone.EnumType.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockStone.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT}); + } + + public static enum EnumType implements IStringSerializable + { + STONE(0, MapColor.stoneColor, "stone"), + GRANITE(1, MapColor.dirtColor, "granite"), + GRANITE_SMOOTH(2, MapColor.dirtColor, "smooth_granite", "graniteSmooth"), + DIORITE(3, MapColor.quartzColor, "diorite"), + DIORITE_SMOOTH(4, MapColor.quartzColor, "smooth_diorite", "dioriteSmooth"), + ANDESITE(5, MapColor.stoneColor, "andesite"), + ANDESITE_SMOOTH(6, MapColor.stoneColor, "smooth_andesite", "andesiteSmooth"); + + private static final BlockStone.EnumType[] META_LOOKUP = new BlockStone.EnumType[values().length]; + private final int meta; + private final String name; + private final String unlocalizedName; + private final MapColor field_181073_l; + + private EnumType(int p_i46383_3_, MapColor p_i46383_4_, String p_i46383_5_) + { + this(p_i46383_3_, p_i46383_4_, p_i46383_5_, p_i46383_5_); + } + + private EnumType(int p_i46384_3_, MapColor p_i46384_4_, String p_i46384_5_, String p_i46384_6_) + { + this.meta = p_i46384_3_; + this.name = p_i46384_5_; + this.unlocalizedName = p_i46384_6_; + this.field_181073_l = p_i46384_4_; + } + + public int getMetadata() + { + return this.meta; + } + + public MapColor func_181072_c() + { + return this.field_181073_l; + } + + public String toString() + { + return this.name; + } + + public static BlockStone.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + static { + for (BlockStone.EnumType blockstone$enumtype : values()) + { + META_LOOKUP[blockstone$enumtype.getMetadata()] = blockstone$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockStoneBrick.java b/src/minecraft/net/minecraft/block/BlockStoneBrick.java new file mode 100644 index 0000000..556eeb3 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockStoneBrick.java @@ -0,0 +1,126 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IStringSerializable; + +public class BlockStoneBrick extends Block +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockStoneBrick.EnumType.class); + public static final int DEFAULT_META = BlockStoneBrick.EnumType.DEFAULT.getMetadata(); + public static final int MOSSY_META = BlockStoneBrick.EnumType.MOSSY.getMetadata(); + public static final int CRACKED_META = BlockStoneBrick.EnumType.CRACKED.getMetadata(); + public static final int CHISELED_META = BlockStoneBrick.EnumType.CHISELED.getMetadata(); + + public BlockStoneBrick() + { + super(Material.rock); + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, BlockStoneBrick.EnumType.DEFAULT)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockStoneBrick.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (BlockStoneBrick.EnumType blockstonebrick$enumtype : BlockStoneBrick.EnumType.values()) + { + list.add(new ItemStack(itemIn, 1, blockstonebrick$enumtype.getMetadata())); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(VARIANT, BlockStoneBrick.EnumType.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockStoneBrick.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {VARIANT}); + } + + public static enum EnumType implements IStringSerializable + { + DEFAULT(0, "stonebrick", "default"), + MOSSY(1, "mossy_stonebrick", "mossy"), + CRACKED(2, "cracked_stonebrick", "cracked"), + CHISELED(3, "chiseled_stonebrick", "chiseled"); + + private static final BlockStoneBrick.EnumType[] META_LOOKUP = new BlockStoneBrick.EnumType[values().length]; + private final int meta; + private final String name; + private final String unlocalizedName; + + private EnumType(int meta, String name, String unlocalizedName) + { + this.meta = meta; + this.name = name; + this.unlocalizedName = unlocalizedName; + } + + public int getMetadata() + { + return this.meta; + } + + public String toString() + { + return this.name; + } + + public static BlockStoneBrick.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + static { + for (BlockStoneBrick.EnumType blockstonebrick$enumtype : values()) + { + META_LOOKUP[blockstonebrick$enumtype.getMetadata()] = blockstonebrick$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockStoneSlab.java b/src/minecraft/net/minecraft/block/BlockStoneSlab.java new file mode 100644 index 0000000..9bbc9dc --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockStoneSlab.java @@ -0,0 +1,227 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.World; + +public abstract class BlockStoneSlab extends BlockSlab +{ + public static final PropertyBool SEAMLESS = PropertyBool.create("seamless"); + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockStoneSlab.EnumType.class); + + public BlockStoneSlab() + { + super(Material.rock); + IBlockState iblockstate = this.blockState.getBaseState(); + + if (this.isDouble()) + { + iblockstate = iblockstate.withProperty(SEAMLESS, Boolean.valueOf(false)); + } + else + { + iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); + } + + this.setDefaultState(iblockstate.withProperty(VARIANT, BlockStoneSlab.EnumType.STONE)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Item.getItemFromBlock(Blocks.stone_slab); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Item.getItemFromBlock(Blocks.stone_slab); + } + + /** + * Returns the slab block name with the type associated with it + */ + public String getUnlocalizedName(int meta) + { + return super.getUnlocalizedName() + "." + BlockStoneSlab.EnumType.byMetadata(meta).getUnlocalizedName(); + } + + public IProperty getVariantProperty() + { + return VARIANT; + } + + public Object getVariant(ItemStack stack) + { + return BlockStoneSlab.EnumType.byMetadata(stack.getMetadata() & 7); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + if (itemIn != Item.getItemFromBlock(Blocks.double_stone_slab)) + { + for (BlockStoneSlab.EnumType blockstoneslab$enumtype : BlockStoneSlab.EnumType.values()) + { + if (blockstoneslab$enumtype != BlockStoneSlab.EnumType.WOOD) + { + list.add(new ItemStack(itemIn, 1, blockstoneslab$enumtype.getMetadata())); + } + } + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockStoneSlab.EnumType.byMetadata(meta & 7)); + + if (this.isDouble()) + { + iblockstate = iblockstate.withProperty(SEAMLESS, Boolean.valueOf((meta & 8) != 0)); + } + else + { + iblockstate = iblockstate.withProperty(HALF, (meta & 8) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); + } + + return iblockstate; + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((BlockStoneSlab.EnumType)state.getValue(VARIANT)).getMetadata(); + + if (this.isDouble()) + { + if (((Boolean)state.getValue(SEAMLESS)).booleanValue()) + { + i |= 8; + } + } + else if (state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return this.isDouble() ? new BlockState(this, new IProperty[] {SEAMLESS, VARIANT}): new BlockState(this, new IProperty[] {HALF, VARIANT}); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockStoneSlab.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return ((BlockStoneSlab.EnumType)state.getValue(VARIANT)).func_181074_c(); + } + + public static enum EnumType implements IStringSerializable + { + STONE(0, MapColor.stoneColor, "stone"), + SAND(1, MapColor.sandColor, "sandstone", "sand"), + WOOD(2, MapColor.woodColor, "wood_old", "wood"), + COBBLESTONE(3, MapColor.stoneColor, "cobblestone", "cobble"), + BRICK(4, MapColor.redColor, "brick"), + SMOOTHBRICK(5, MapColor.stoneColor, "stone_brick", "smoothStoneBrick"), + NETHERBRICK(6, MapColor.netherrackColor, "nether_brick", "netherBrick"), + QUARTZ(7, MapColor.quartzColor, "quartz"); + + private static final BlockStoneSlab.EnumType[] META_LOOKUP = new BlockStoneSlab.EnumType[values().length]; + private final int meta; + private final MapColor field_181075_k; + private final String name; + private final String unlocalizedName; + + private EnumType(int p_i46381_3_, MapColor p_i46381_4_, String p_i46381_5_) + { + this(p_i46381_3_, p_i46381_4_, p_i46381_5_, p_i46381_5_); + } + + private EnumType(int p_i46382_3_, MapColor p_i46382_4_, String p_i46382_5_, String p_i46382_6_) + { + this.meta = p_i46382_3_; + this.field_181075_k = p_i46382_4_; + this.name = p_i46382_5_; + this.unlocalizedName = p_i46382_6_; + } + + public int getMetadata() + { + return this.meta; + } + + public MapColor func_181074_c() + { + return this.field_181075_k; + } + + public String toString() + { + return this.name; + } + + public static BlockStoneSlab.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + static { + for (BlockStoneSlab.EnumType blockstoneslab$enumtype : values()) + { + META_LOOKUP[blockstoneslab$enumtype.getMetadata()] = blockstoneslab$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockStoneSlabNew.java b/src/minecraft/net/minecraft/block/BlockStoneSlabNew.java new file mode 100644 index 0000000..d728473 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockStoneSlabNew.java @@ -0,0 +1,219 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public abstract class BlockStoneSlabNew extends BlockSlab +{ + public static final PropertyBool SEAMLESS = PropertyBool.create("seamless"); + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockStoneSlabNew.EnumType.class); + + public BlockStoneSlabNew() + { + super(Material.rock); + IBlockState iblockstate = this.blockState.getBaseState(); + + if (this.isDouble()) + { + iblockstate = iblockstate.withProperty(SEAMLESS, Boolean.valueOf(false)); + } + else + { + iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); + } + + this.setDefaultState(iblockstate.withProperty(VARIANT, BlockStoneSlabNew.EnumType.RED_SANDSTONE)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal(this.getUnlocalizedName() + ".red_sandstone.name"); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Item.getItemFromBlock(Blocks.stone_slab2); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Item.getItemFromBlock(Blocks.stone_slab2); + } + + /** + * Returns the slab block name with the type associated with it + */ + public String getUnlocalizedName(int meta) + { + return super.getUnlocalizedName() + "." + BlockStoneSlabNew.EnumType.byMetadata(meta).getUnlocalizedName(); + } + + public IProperty getVariantProperty() + { + return VARIANT; + } + + public Object getVariant(ItemStack stack) + { + return BlockStoneSlabNew.EnumType.byMetadata(stack.getMetadata() & 7); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + if (itemIn != Item.getItemFromBlock(Blocks.double_stone_slab2)) + { + for (BlockStoneSlabNew.EnumType blockstoneslabnew$enumtype : BlockStoneSlabNew.EnumType.values()) + { + list.add(new ItemStack(itemIn, 1, blockstoneslabnew$enumtype.getMetadata())); + } + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockStoneSlabNew.EnumType.byMetadata(meta & 7)); + + if (this.isDouble()) + { + iblockstate = iblockstate.withProperty(SEAMLESS, Boolean.valueOf((meta & 8) != 0)); + } + else + { + iblockstate = iblockstate.withProperty(HALF, (meta & 8) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); + } + + return iblockstate; + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((BlockStoneSlabNew.EnumType)state.getValue(VARIANT)).getMetadata(); + + if (this.isDouble()) + { + if (((Boolean)state.getValue(SEAMLESS)).booleanValue()) + { + i |= 8; + } + } + else if (state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return this.isDouble() ? new BlockState(this, new IProperty[] {SEAMLESS, VARIANT}): new BlockState(this, new IProperty[] {HALF, VARIANT}); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return ((BlockStoneSlabNew.EnumType)state.getValue(VARIANT)).func_181068_c(); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockStoneSlabNew.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + public static enum EnumType implements IStringSerializable + { + RED_SANDSTONE(0, "red_sandstone", BlockSand.EnumType.RED_SAND.getMapColor()); + + private static final BlockStoneSlabNew.EnumType[] META_LOOKUP = new BlockStoneSlabNew.EnumType[values().length]; + private final int meta; + private final String name; + private final MapColor field_181069_e; + + private EnumType(int p_i46391_3_, String p_i46391_4_, MapColor p_i46391_5_) + { + this.meta = p_i46391_3_; + this.name = p_i46391_4_; + this.field_181069_e = p_i46391_5_; + } + + public int getMetadata() + { + return this.meta; + } + + public MapColor func_181068_c() + { + return this.field_181069_e; + } + + public String toString() + { + return this.name; + } + + public static BlockStoneSlabNew.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.name; + } + + static { + for (BlockStoneSlabNew.EnumType blockstoneslabnew$enumtype : values()) + { + META_LOOKUP[blockstoneslabnew$enumtype.getMetadata()] = blockstoneslabnew$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockTNT.java b/src/minecraft/net/minecraft/block/BlockTNT.java new file mode 100644 index 0000000..b031c02 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockTNT.java @@ -0,0 +1,161 @@ +package net.minecraft.block; + +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; + +public class BlockTNT extends Block +{ + public static final PropertyBool EXPLODE = PropertyBool.create("explode"); + + public BlockTNT() + { + super(Material.tnt); + this.setDefaultState(this.blockState.getBaseState().withProperty(EXPLODE, Boolean.valueOf(false))); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + super.onBlockAdded(worldIn, pos, state); + + if (worldIn.isBlockPowered(pos)) + { + this.onBlockDestroyedByPlayer(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true))); + worldIn.setBlockToAir(pos); + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (worldIn.isBlockPowered(pos)) + { + this.onBlockDestroyedByPlayer(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true))); + worldIn.setBlockToAir(pos); + } + } + + /** + * Called when this Block is destroyed by an Explosion + */ + public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) + { + if (!worldIn.isRemote) + { + EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy()); + entitytntprimed.fuse = worldIn.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8; + worldIn.spawnEntityInWorld(entitytntprimed); + } + } + + /** + * Called when a player destroys this Block + */ + public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) + { + this.explode(worldIn, pos, state, (EntityLivingBase)null); + } + + public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter) + { + if (!worldIn.isRemote) + { + if (((Boolean)state.getValue(EXPLODE)).booleanValue()) + { + EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter); + worldIn.spawnEntityInWorld(entitytntprimed); + worldIn.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); + } + } + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (playerIn.getCurrentEquippedItem() != null) + { + Item item = playerIn.getCurrentEquippedItem().getItem(); + + if (item == Items.flint_and_steel || item == Items.fire_charge) + { + this.explode(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)), playerIn); + worldIn.setBlockToAir(pos); + + if (item == Items.flint_and_steel) + { + playerIn.getCurrentEquippedItem().damageItem(1, playerIn); + } + else if (!playerIn.capabilities.isCreativeMode) + { + --playerIn.getCurrentEquippedItem().stackSize; + } + + return true; + } + } + + return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); + } + + /** + * Called When an Entity Collided with the Block + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + if (!worldIn.isRemote && entityIn instanceof EntityArrow) + { + EntityArrow entityarrow = (EntityArrow)entityIn; + + if (entityarrow.isBurning()) + { + this.explode(worldIn, pos, worldIn.getBlockState(pos).withProperty(EXPLODE, Boolean.valueOf(true)), entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase)entityarrow.shootingEntity : null); + worldIn.setBlockToAir(pos); + } + } + } + + /** + * Return whether this block can drop from an explosion. + */ + public boolean canDropFromExplosion(Explosion explosionIn) + { + return false; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(EXPLODE, Boolean.valueOf((meta & 1) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((Boolean)state.getValue(EXPLODE)).booleanValue() ? 1 : 0; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {EXPLODE}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockTallGrass.java b/src/minecraft/net/minecraft/block/BlockTallGrass.java new file mode 100644 index 0000000..832ebc8 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockTallGrass.java @@ -0,0 +1,223 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.ColorizerGrass; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockTallGrass extends BlockBush implements IGrowable +{ + public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class); + + protected BlockTallGrass() + { + super(Material.vine); + this.setDefaultState(this.blockState.getBaseState().withProperty(TYPE, BlockTallGrass.EnumType.DEAD_BUSH)); + float f = 0.4F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f); + } + + public int getBlockColor() + { + return ColorizerGrass.getGrassColor(0.5D, 1.0D); + } + + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { + return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock()); + } + + /** + * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) + */ + public boolean isReplaceable(World worldIn, BlockPos pos) + { + return true; + } + + public int getRenderColor(IBlockState state) + { + if (state.getBlock() != this) + { + return super.getRenderColor(state); + } + else + { + BlockTallGrass.EnumType blocktallgrass$enumtype = (BlockTallGrass.EnumType)state.getValue(TYPE); + return blocktallgrass$enumtype == BlockTallGrass.EnumType.DEAD_BUSH ? 16777215 : ColorizerGrass.getGrassColor(0.5D, 1.0D); + } + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return worldIn.getBiomeGenForCoords(pos).getGrassColorAtPos(pos); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return rand.nextInt(8) == 0 ? Items.wheat_seeds : null; + } + + /** + * Get the quantity dropped based on the given fortune level + */ + public int quantityDroppedWithBonus(int fortune, Random random) + { + return 1 + random.nextInt(fortune * 2 + 1); + } + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { + if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta())); + } + else + { + super.harvestBlock(worldIn, player, pos, state, te); + } + } + + public int getDamageValue(World worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + return iblockstate.getBlock().getMetaFromState(iblockstate); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (int i = 1; i < 3; ++i) + { + list.add(new ItemStack(itemIn, 1, i)); + } + } + + /** + * Whether this IGrowable can grow + */ + public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) + { + return state.getValue(TYPE) != BlockTallGrass.EnumType.DEAD_BUSH; + } + + public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + return true; + } + + public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) + { + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = BlockDoublePlant.EnumPlantType.GRASS; + + if (state.getValue(TYPE) == BlockTallGrass.EnumType.FERN) + { + blockdoubleplant$enumplanttype = BlockDoublePlant.EnumPlantType.FERN; + } + + if (Blocks.double_plant.canPlaceBlockAt(worldIn, pos)) + { + Blocks.double_plant.placeAt(worldIn, pos, blockdoubleplant$enumplanttype, 2); + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(TYPE, BlockTallGrass.EnumType.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {TYPE}); + } + + /** + * Get the OffsetType for this Block. Determines if the model is rendered slightly offset. + */ + public Block.EnumOffsetType getOffsetType() + { + return Block.EnumOffsetType.XYZ; + } + + public static enum EnumType implements IStringSerializable + { + DEAD_BUSH(0, "dead_bush"), + GRASS(1, "tall_grass"), + FERN(2, "fern"); + + private static final BlockTallGrass.EnumType[] META_LOOKUP = new BlockTallGrass.EnumType[values().length]; + private final int meta; + private final String name; + + private EnumType(int meta, String name) + { + this.meta = meta; + this.name = name; + } + + public int getMeta() + { + return this.meta; + } + + public String toString() + { + return this.name; + } + + public static BlockTallGrass.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + static { + for (BlockTallGrass.EnumType blocktallgrass$enumtype : values()) + { + META_LOOKUP[blocktallgrass$enumtype.getMeta()] = blocktallgrass$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockTorch.java b/src/minecraft/net/minecraft/block/BlockTorch.java new file mode 100644 index 0000000..ac416e7 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockTorch.java @@ -0,0 +1,312 @@ +package net.minecraft.block; + +import com.google.common.base.Predicate; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class BlockTorch extends Block +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", new Predicate() + { + public boolean apply(EnumFacing p_apply_1_) + { + return p_apply_1_ != EnumFacing.DOWN; + } + }); + + protected BlockTorch() + { + super(Material.circuits); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP)); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + private boolean canPlaceOn(World worldIn, BlockPos pos) + { + if (World.doesBlockHaveSolidTopSurface(worldIn, pos)) + { + return true; + } + else + { + Block block = worldIn.getBlockState(pos).getBlock(); + return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass; + } + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + for (EnumFacing enumfacing : FACING.getAllowedValues()) + { + if (this.canPlaceAt(worldIn, pos, enumfacing)) + { + return true; + } + } + + return false; + } + + private boolean canPlaceAt(World worldIn, BlockPos pos, EnumFacing facing) + { + BlockPos blockpos = pos.offset(facing.getOpposite()); + boolean flag = facing.getAxis().isHorizontal(); + return flag && worldIn.isBlockNormalCube(blockpos, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + if (this.canPlaceAt(worldIn, pos, facing)) + { + return this.getDefaultState().withProperty(FACING, facing); + } + else + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (worldIn.isBlockNormalCube(pos.offset(((EnumFacing) enumfacing).getOpposite()), true)) + { + return this.getDefaultState().withProperty(FACING, (EnumFacing) enumfacing); + } + } + + return this.getDefaultState(); + } + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + this.checkForDrop(worldIn, pos, state); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + this.onNeighborChangeInternal(worldIn, pos, state); + } + + protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state) + { + if (!this.checkForDrop(worldIn, pos, state)) + { + return true; + } + else + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + EnumFacing.Axis enumfacing$axis = enumfacing.getAxis(); + EnumFacing enumfacing1 = enumfacing.getOpposite(); + boolean flag = false; + + if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) + { + flag = true; + } + else if (enumfacing$axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1))) + { + flag = true; + } + + if (flag) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + return true; + } + else + { + return false; + } + } + } + + protected boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state) + { + if (state.getBlock() == this && this.canPlaceAt(worldIn, pos, (EnumFacing)state.getValue(FACING))) + { + return true; + } + else + { + if (worldIn.getBlockState(pos).getBlock() == this) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + + return false; + } + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. + */ + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + { + EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING); + float f = 0.15F; + + if (enumfacing == EnumFacing.EAST) + { + this.setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f); + } + else if (enumfacing == EnumFacing.WEST) + { + this.setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f); + } + else if (enumfacing == EnumFacing.SOUTH) + { + this.setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F); + } + else if (enumfacing == EnumFacing.NORTH) + { + this.setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F); + } + else + { + f = 0.1F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f); + } + + return super.collisionRayTrace(worldIn, pos, start, end); + } + + public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + double d0 = (double)pos.getX() + 0.5D; + double d1 = (double)pos.getY() + 0.7D; + double d2 = (double)pos.getZ() + 0.5D; + double d3 = 0.22D; + double d4 = 0.27D; + + if (enumfacing.getAxis().isHorizontal()) + { + EnumFacing enumfacing1 = enumfacing.getOpposite(); + worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4 * (double)enumfacing1.getFrontOffsetX(), d1 + d3, d2 + d4 * (double)enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D, new int[0]); + worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4 * (double)enumfacing1.getFrontOffsetX(), d1 + d3, d2 + d4 * (double)enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D, new int[0]); + } + else + { + worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); + worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + IBlockState iblockstate = this.getDefaultState(); + + switch (meta) + { + case 1: + iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST); + break; + + case 2: + iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST); + break; + + case 3: + iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH); + break; + + case 4: + iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH); + break; + + case 5: + default: + iblockstate = iblockstate.withProperty(FACING, EnumFacing.UP); + } + + return iblockstate; + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + + switch ((EnumFacing)state.getValue(FACING)) + { + case EAST: + i = i | 1; + break; + + case WEST: + i = i | 2; + break; + + case SOUTH: + i = i | 3; + break; + + case NORTH: + i = i | 4; + break; + + case DOWN: + case UP: + default: + i = i | 5; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockTrapDoor.java b/src/minecraft/net/minecraft/block/BlockTrapDoor.java new file mode 100644 index 0000000..50093c7 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockTrapDoor.java @@ -0,0 +1,312 @@ +package net.minecraft.block; + +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockTrapDoor extends Block +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyBool OPEN = PropertyBool.create("open"); + public static final PropertyEnum HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class); + + protected BlockTrapDoor(Material materialIn) + { + super(materialIn); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(OPEN, Boolean.valueOf(false)).withProperty(HALF, BlockTrapDoor.DoorHalf.BOTTOM)); + float f = 0.5F; + float f1 = 1.0F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + { + return !((Boolean)worldIn.getBlockState(pos).getValue(OPEN)).booleanValue(); + } + + public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getSelectedBoundingBox(worldIn, pos); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.getCollisionBoundingBox(worldIn, pos, state); + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + this.setBounds(worldIn.getBlockState(pos)); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + float f = 0.1875F; + this.setBlockBounds(0.0F, 0.40625F, 0.0F, 1.0F, 0.59375F, 1.0F); + } + + public void setBounds(IBlockState state) + { + if (state.getBlock() == this) + { + boolean flag = state.getValue(HALF) == BlockTrapDoor.DoorHalf.TOP; + Boolean obool = (Boolean)state.getValue(OPEN); + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + float f = 0.1875F; + + if (flag) + { + this.setBlockBounds(0.0F, 0.8125F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.1875F, 1.0F); + } + + if (obool.booleanValue()) + { + if (enumfacing == EnumFacing.NORTH) + { + this.setBlockBounds(0.0F, 0.0F, 0.8125F, 1.0F, 1.0F, 1.0F); + } + + if (enumfacing == EnumFacing.SOUTH) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.1875F); + } + + if (enumfacing == EnumFacing.WEST) + { + this.setBlockBounds(0.8125F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + if (enumfacing == EnumFacing.EAST) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.1875F, 1.0F, 1.0F); + } + } + } + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (this.blockMaterial == Material.iron) + { + return true; + } + else + { + state = state.cycleProperty(OPEN); + worldIn.setBlockState(pos, state, 2); + worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0); + return true; + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!worldIn.isRemote) + { + BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()); + + if (!isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock())) + { + worldIn.setBlockToAir(pos); + this.dropBlockAsItem(worldIn, pos, state, 0); + } + else + { + boolean flag = worldIn.isBlockPowered(pos); + + if (flag || neighborBlock.canProvidePower()) + { + boolean flag1 = ((Boolean)state.getValue(OPEN)).booleanValue(); + + if (flag1 != flag) + { + worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(flag)), 2); + worldIn.playAuxSFXAtEntity((EntityPlayer)null, flag ? 1003 : 1006, pos, 0); + } + } + } + } + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. + */ + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + return super.collisionRayTrace(worldIn, pos, start, end); + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + IBlockState iblockstate = this.getDefaultState(); + + if (facing.getAxis().isHorizontal()) + { + iblockstate = iblockstate.withProperty(FACING, facing).withProperty(OPEN, Boolean.valueOf(false)); + iblockstate = iblockstate.withProperty(HALF, hitY > 0.5F ? BlockTrapDoor.DoorHalf.TOP : BlockTrapDoor.DoorHalf.BOTTOM); + } + + return iblockstate; + } + + /** + * Check whether this Block can be placed on the given side + */ + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { + return !side.getAxis().isVertical() && isValidSupportBlock(worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock()); + } + + protected static EnumFacing getFacing(int meta) + { + switch (meta & 3) + { + case 0: + return EnumFacing.NORTH; + + case 1: + return EnumFacing.SOUTH; + + case 2: + return EnumFacing.WEST; + + case 3: + default: + return EnumFacing.EAST; + } + } + + protected static int getMetaForFacing(EnumFacing facing) + { + switch (facing) + { + case NORTH: + return 0; + + case SOUTH: + return 1; + + case WEST: + return 2; + + case EAST: + default: + return 3; + } + } + + private static boolean isValidSupportBlock(Block blockIn) + { + return blockIn.blockMaterial.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, getFacing(meta)).withProperty(OPEN, Boolean.valueOf((meta & 4) != 0)).withProperty(HALF, (meta & 8) == 0 ? BlockTrapDoor.DoorHalf.BOTTOM : BlockTrapDoor.DoorHalf.TOP); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | getMetaForFacing((EnumFacing)state.getValue(FACING)); + + if (((Boolean)state.getValue(OPEN)).booleanValue()) + { + i |= 4; + } + + if (state.getValue(HALF) == BlockTrapDoor.DoorHalf.TOP) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, OPEN, HALF}); + } + + public static enum DoorHalf implements IStringSerializable + { + TOP("top"), + BOTTOM("bottom"); + + private final String name; + + private DoorHalf(String name) + { + this.name = name; + } + + public String toString() + { + return this.name; + } + + public String getName() + { + return this.name; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockTripWire.java b/src/minecraft/net/minecraft/block/BlockTripWire.java new file mode 100644 index 0000000..cbe8114 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockTripWire.java @@ -0,0 +1,300 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockTripWire extends Block +{ + public static final PropertyBool POWERED = PropertyBool.create("powered"); + public static final PropertyBool SUSPENDED = PropertyBool.create("suspended"); + public static final PropertyBool ATTACHED = PropertyBool.create("attached"); + public static final PropertyBool DISARMED = PropertyBool.create("disarmed"); + public static final PropertyBool NORTH = PropertyBool.create("north"); + public static final PropertyBool EAST = PropertyBool.create("east"); + public static final PropertyBool SOUTH = PropertyBool.create("south"); + public static final PropertyBool WEST = PropertyBool.create("west"); + + public BlockTripWire() + { + super(Material.circuits); + this.setDefaultState(this.blockState.getBaseState().withProperty(POWERED, Boolean.valueOf(false)).withProperty(SUSPENDED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)).withProperty(DISARMED, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.15625F, 1.0F); + this.setTickRandomly(true); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + return state.withProperty(NORTH, Boolean.valueOf(isConnectedTo(worldIn, pos, state, EnumFacing.NORTH))).withProperty(EAST, Boolean.valueOf(isConnectedTo(worldIn, pos, state, EnumFacing.EAST))).withProperty(SOUTH, Boolean.valueOf(isConnectedTo(worldIn, pos, state, EnumFacing.SOUTH))).withProperty(WEST, Boolean.valueOf(isConnectedTo(worldIn, pos, state, EnumFacing.WEST))); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.TRANSLUCENT; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.string; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Items.string; + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + boolean flag = ((Boolean)state.getValue(SUSPENDED)).booleanValue(); + boolean flag1 = !World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); + + if (flag != flag1) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + boolean flag = ((Boolean)iblockstate.getValue(ATTACHED)).booleanValue(); + boolean flag1 = ((Boolean)iblockstate.getValue(SUSPENDED)).booleanValue(); + + if (!flag1) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.09375F, 1.0F); + } + else if (!flag) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0625F, 0.0F, 1.0F, 0.15625F, 1.0F); + } + } + + public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) + { + state = state.withProperty(SUSPENDED, Boolean.valueOf(!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()))); + worldIn.setBlockState(pos, state, 3); + this.notifyHook(worldIn, pos, state); + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + this.notifyHook(worldIn, pos, state.withProperty(POWERED, Boolean.valueOf(true))); + } + + public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) + { + if (!worldIn.isRemote) + { + if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { + worldIn.setBlockState(pos, state.withProperty(DISARMED, Boolean.valueOf(true)), 4); + } + } + } + + private void notifyHook(World worldIn, BlockPos pos, IBlockState state) + { + for (EnumFacing enumfacing : new EnumFacing[] {EnumFacing.SOUTH, EnumFacing.WEST}) + { + for (int i = 1; i < 42; ++i) + { + BlockPos blockpos = pos.offset(enumfacing, i); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock() == Blocks.tripwire_hook) + { + if (iblockstate.getValue(BlockTripWireHook.FACING) == enumfacing.getOpposite()) + { + Blocks.tripwire_hook.func_176260_a(worldIn, blockpos, iblockstate, false, true, i, state); + } + + break; + } + + if (iblockstate.getBlock() != Blocks.tripwire) + { + break; + } + } + } + } + + /** + * Called When an Entity Collided with the Block + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + if (!worldIn.isRemote) + { + if (!((Boolean)state.getValue(POWERED)).booleanValue()) + { + this.updateState(worldIn, pos); + } + } + } + + /** + * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) + */ + public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random) + { + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!worldIn.isRemote) + { + if (((Boolean)worldIn.getBlockState(pos).getValue(POWERED)).booleanValue()) + { + this.updateState(worldIn, pos); + } + } + } + + private void updateState(World worldIn, BlockPos pos) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + boolean flag = ((Boolean)iblockstate.getValue(POWERED)).booleanValue(); + boolean flag1 = false; + List list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ)); + + if (!list.isEmpty()) + { + for (Entity entity : list) + { + if (!entity.doesEntityNotTriggerPressurePlate()) + { + flag1 = true; + break; + } + } + } + + if (flag1 != flag) + { + iblockstate = iblockstate.withProperty(POWERED, Boolean.valueOf(flag1)); + worldIn.setBlockState(pos, iblockstate, 3); + this.notifyHook(worldIn, pos, iblockstate); + } + + if (flag1) + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + } + } + + public static boolean isConnectedTo(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing direction) + { + BlockPos blockpos = pos.offset(direction); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (block == Blocks.tripwire_hook) + { + EnumFacing enumfacing = direction.getOpposite(); + return iblockstate.getValue(BlockTripWireHook.FACING) == enumfacing; + } + else if (block == Blocks.tripwire) + { + boolean flag = ((Boolean)state.getValue(SUSPENDED)).booleanValue(); + boolean flag1 = ((Boolean)iblockstate.getValue(SUSPENDED)).booleanValue(); + return flag == flag1; + } + else + { + return false; + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(POWERED, Boolean.valueOf((meta & 1) > 0)).withProperty(SUSPENDED, Boolean.valueOf((meta & 2) > 0)).withProperty(ATTACHED, Boolean.valueOf((meta & 4) > 0)).withProperty(DISARMED, Boolean.valueOf((meta & 8) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + i |= 1; + } + + if (((Boolean)state.getValue(SUSPENDED)).booleanValue()) + { + i |= 2; + } + + if (((Boolean)state.getValue(ATTACHED)).booleanValue()) + { + i |= 4; + } + + if (((Boolean)state.getValue(DISARMED)).booleanValue()) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {POWERED, SUSPENDED, ATTACHED, DISARMED, NORTH, EAST, WEST, SOUTH}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockTripWireHook.java b/src/minecraft/net/minecraft/block/BlockTripWireHook.java new file mode 100644 index 0000000..43705fb --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockTripWireHook.java @@ -0,0 +1,373 @@ +package net.minecraft.block; + +import com.google.common.base.Objects; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockTripWireHook extends Block +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + public static final PropertyBool POWERED = PropertyBool.create("powered"); + public static final PropertyBool ATTACHED = PropertyBool.create("attached"); + public static final PropertyBool SUSPENDED = PropertyBool.create("suspended"); + + public BlockTripWireHook() + { + super(Material.circuits); + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(POWERED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)).withProperty(SUSPENDED, Boolean.valueOf(false))); + this.setCreativeTab(CreativeTabs.tabRedstone); + this.setTickRandomly(true); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + return state.withProperty(SUSPENDED, Boolean.valueOf(!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()))); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Check whether this Block can be placed on the given side + */ + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { + return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (worldIn.getBlockState(pos.offset((EnumFacing) enumfacing)).getBlock().isNormalCube()) + { + return true; + } + } + + return false; + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + IBlockState iblockstate = this.getDefaultState().withProperty(POWERED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)).withProperty(SUSPENDED, Boolean.valueOf(false)); + + if (facing.getAxis().isHorizontal()) + { + iblockstate = iblockstate.withProperty(FACING, facing); + } + + return iblockstate; + } + + /** + * Called by ItemBlocks after a block is set in the world, to allow post-place logic + */ + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + this.func_176260_a(worldIn, pos, state, false, false, -1, (IBlockState)null); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (neighborBlock != this) + { + if (this.checkForDrop(worldIn, pos, state)) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + + if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + } + } + } + + public void func_176260_a(World worldIn, BlockPos pos, IBlockState hookState, boolean p_176260_4_, boolean p_176260_5_, int p_176260_6_, IBlockState p_176260_7_) + { + EnumFacing enumfacing = (EnumFacing)hookState.getValue(FACING); + boolean flag = ((Boolean)hookState.getValue(ATTACHED)).booleanValue(); + boolean flag1 = ((Boolean)hookState.getValue(POWERED)).booleanValue(); + boolean flag2 = !World.doesBlockHaveSolidTopSurface(worldIn, pos.down()); + boolean flag3 = !p_176260_4_; + boolean flag4 = false; + int i = 0; + IBlockState[] aiblockstate = new IBlockState[42]; + + for (int j = 1; j < 42; ++j) + { + BlockPos blockpos = pos.offset(enumfacing, j); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock() == Blocks.tripwire_hook) + { + if (iblockstate.getValue(FACING) == enumfacing.getOpposite()) + { + i = j; + } + + break; + } + + if (iblockstate.getBlock() != Blocks.tripwire && j != p_176260_6_) + { + aiblockstate[j] = null; + flag3 = false; + } + else + { + if (j == p_176260_6_) + { + iblockstate = (IBlockState)Objects.firstNonNull(p_176260_7_, iblockstate); + } + + boolean flag5 = !((Boolean)iblockstate.getValue(BlockTripWire.DISARMED)).booleanValue(); + boolean flag6 = ((Boolean)iblockstate.getValue(BlockTripWire.POWERED)).booleanValue(); + boolean flag7 = ((Boolean)iblockstate.getValue(BlockTripWire.SUSPENDED)).booleanValue(); + flag3 &= flag7 == flag2; + flag4 |= flag5 && flag6; + aiblockstate[j] = iblockstate; + + if (j == p_176260_6_) + { + worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + flag3 &= flag5; + } + } + } + + flag3 = flag3 & i > 1; + flag4 = flag4 & flag3; + IBlockState iblockstate1 = this.getDefaultState().withProperty(ATTACHED, Boolean.valueOf(flag3)).withProperty(POWERED, Boolean.valueOf(flag4)); + + if (i > 0) + { + BlockPos blockpos1 = pos.offset(enumfacing, i); + EnumFacing enumfacing1 = enumfacing.getOpposite(); + worldIn.setBlockState(blockpos1, iblockstate1.withProperty(FACING, enumfacing1), 3); + this.func_176262_b(worldIn, blockpos1, enumfacing1); + this.func_180694_a(worldIn, blockpos1, flag3, flag4, flag, flag1); + } + + this.func_180694_a(worldIn, pos, flag3, flag4, flag, flag1); + + if (!p_176260_4_) + { + worldIn.setBlockState(pos, iblockstate1.withProperty(FACING, enumfacing), 3); + + if (p_176260_5_) + { + this.func_176262_b(worldIn, pos, enumfacing); + } + } + + if (flag != flag3) + { + for (int k = 1; k < i; ++k) + { + BlockPos blockpos2 = pos.offset(enumfacing, k); + IBlockState iblockstate2 = aiblockstate[k]; + + if (iblockstate2 != null && worldIn.getBlockState(blockpos2).getBlock() != Blocks.air) + { + worldIn.setBlockState(blockpos2, iblockstate2.withProperty(ATTACHED, Boolean.valueOf(flag3)), 3); + } + } + } + } + + /** + * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) + */ + public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random) + { + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + this.func_176260_a(worldIn, pos, state, false, true, -1, (IBlockState)null); + } + + private void func_180694_a(World worldIn, BlockPos pos, boolean p_180694_3_, boolean p_180694_4_, boolean p_180694_5_, boolean p_180694_6_) + { + if (p_180694_4_ && !p_180694_6_) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, "random.click", 0.4F, 0.6F); + } + else if (!p_180694_4_ && p_180694_6_) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, "random.click", 0.4F, 0.5F); + } + else if (p_180694_3_ && !p_180694_5_) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, "random.click", 0.4F, 0.7F); + } + else if (!p_180694_3_ && p_180694_5_) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D, "random.bowhit", 0.4F, 1.2F / (worldIn.rand.nextFloat() * 0.2F + 0.9F)); + } + } + + private void func_176262_b(World worldIn, BlockPos p_176262_2_, EnumFacing p_176262_3_) + { + worldIn.notifyNeighborsOfStateChange(p_176262_2_, this); + worldIn.notifyNeighborsOfStateChange(p_176262_2_.offset(p_176262_3_.getOpposite()), this); + } + + private boolean checkForDrop(World worldIn, BlockPos pos, IBlockState state) + { + if (!this.canPlaceBlockAt(worldIn, pos)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + return false; + } + else + { + return true; + } + } + + @SuppressWarnings("incomplete-switch") + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + float f = 0.1875F; + + switch ((EnumFacing)worldIn.getBlockState(pos).getValue(FACING)) + { + case EAST: + this.setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f); + break; + + case WEST: + this.setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f); + break; + + case SOUTH: + this.setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F); + break; + + case NORTH: + this.setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F); + } + } + + public void breakBlock(World worldIn, BlockPos pos, IBlockState state) + { + boolean flag = ((Boolean)state.getValue(ATTACHED)).booleanValue(); + boolean flag1 = ((Boolean)state.getValue(POWERED)).booleanValue(); + + if (flag || flag1) + { + this.func_176260_a(worldIn, pos, state, true, false, -1, (IBlockState)null); + } + + if (flag1) + { + worldIn.notifyNeighborsOfStateChange(pos, this); + worldIn.notifyNeighborsOfStateChange(pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite()), this); + } + + super.breakBlock(worldIn, pos, state); + } + + public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return ((Boolean)state.getValue(POWERED)).booleanValue() ? 15 : 0; + } + + public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) + { + return !((Boolean)state.getValue(POWERED)).booleanValue() ? 0 : (state.getValue(FACING) == side ? 15 : 0); + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT_MIPPED; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta & 3)).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0)).withProperty(ATTACHED, Boolean.valueOf((meta & 4) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex(); + + if (((Boolean)state.getValue(POWERED)).booleanValue()) + { + i |= 8; + } + + if (((Boolean)state.getValue(ATTACHED)).booleanValue()) + { + i |= 4; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING, POWERED, ATTACHED, SUSPENDED}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockVine.java b/src/minecraft/net/minecraft/block/BlockVine.java new file mode 100644 index 0000000..5e4d04c --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockVine.java @@ -0,0 +1,513 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.ColorizerFoliage; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockVine extends Block +{ + public static final PropertyBool UP = PropertyBool.create("up"); + public static final PropertyBool NORTH = PropertyBool.create("north"); + public static final PropertyBool EAST = PropertyBool.create("east"); + public static final PropertyBool SOUTH = PropertyBool.create("south"); + public static final PropertyBool WEST = PropertyBool.create("west"); + public static final PropertyBool[] ALL_FACES = new PropertyBool[] {UP, NORTH, SOUTH, WEST, EAST}; + + public BlockVine() + { + super(Material.vine); + this.setDefaultState(this.blockState.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + return state.withProperty(UP, Boolean.valueOf(worldIn.getBlockState(pos.up()).getBlock().isBlockNormalCube())); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) + */ + public boolean isReplaceable(World worldIn, BlockPos pos) + { + return true; + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + float f = 0.0625F; + float f1 = 1.0F; + float f2 = 1.0F; + float f3 = 1.0F; + float f4 = 0.0F; + float f5 = 0.0F; + float f6 = 0.0F; + boolean flag = false; + + if (((Boolean)worldIn.getBlockState(pos).getValue(WEST)).booleanValue()) + { + f4 = Math.max(f4, 0.0625F); + f1 = 0.0F; + f2 = 0.0F; + f5 = 1.0F; + f3 = 0.0F; + f6 = 1.0F; + flag = true; + } + + if (((Boolean)worldIn.getBlockState(pos).getValue(EAST)).booleanValue()) + { + f1 = Math.min(f1, 0.9375F); + f4 = 1.0F; + f2 = 0.0F; + f5 = 1.0F; + f3 = 0.0F; + f6 = 1.0F; + flag = true; + } + + if (((Boolean)worldIn.getBlockState(pos).getValue(NORTH)).booleanValue()) + { + f6 = Math.max(f6, 0.0625F); + f3 = 0.0F; + f1 = 0.0F; + f4 = 1.0F; + f2 = 0.0F; + f5 = 1.0F; + flag = true; + } + + if (((Boolean)worldIn.getBlockState(pos).getValue(SOUTH)).booleanValue()) + { + f3 = Math.min(f3, 0.9375F); + f6 = 1.0F; + f1 = 0.0F; + f4 = 1.0F; + f2 = 0.0F; + f5 = 1.0F; + flag = true; + } + + if (!flag && this.canPlaceOn(worldIn.getBlockState(pos.up()).getBlock())) + { + f2 = Math.min(f2, 0.9375F); + f5 = 1.0F; + f1 = 0.0F; + f4 = 1.0F; + f3 = 0.0F; + f6 = 1.0F; + } + + this.setBlockBounds(f1, f2, f3, f4, f5, f6); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + /** + * Check whether this Block can be placed on the given side + */ + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) + { + switch (side) + { + case UP: + return this.canPlaceOn(worldIn.getBlockState(pos.up()).getBlock()); + + case NORTH: + case SOUTH: + case EAST: + case WEST: + return this.canPlaceOn(worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock()); + + default: + return false; + } + } + + private boolean canPlaceOn(Block blockIn) + { + return blockIn.isFullCube() && blockIn.blockMaterial.blocksMovement(); + } + + private boolean recheckGrownSides(World worldIn, BlockPos pos, IBlockState state) + { + IBlockState iblockstate = state; + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + PropertyBool propertybool = getPropertyFor((EnumFacing) enumfacing); + + if (((Boolean)state.getValue(propertybool)).booleanValue() && !this.canPlaceOn(worldIn.getBlockState(pos.offset((EnumFacing) enumfacing)).getBlock())) + { + IBlockState iblockstate1 = worldIn.getBlockState(pos.up()); + + if (iblockstate1.getBlock() != this || !((Boolean)iblockstate1.getValue(propertybool)).booleanValue()) + { + state = state.withProperty(propertybool, Boolean.valueOf(false)); + } + } + } + + if (getNumGrownFaces(state) == 0) + { + return false; + } + else + { + if (iblockstate != state) + { + worldIn.setBlockState(pos, state, 2); + } + + return true; + } + } + + public int getBlockColor() + { + return ColorizerFoliage.getFoliageColorBasic(); + } + + public int getRenderColor(IBlockState state) + { + return ColorizerFoliage.getFoliageColorBasic(); + } + + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return worldIn.getBiomeGenForCoords(pos).getFoliageColorAtPos(pos); + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + if (!worldIn.isRemote && !this.recheckGrownSides(worldIn, pos, state)) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + } + + public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) + { + if (!worldIn.isRemote) + { + if (worldIn.rand.nextInt(4) == 0) + { + int i = 4; + int j = 5; + boolean flag = false; + label62: + + for (int k = -i; k <= i; ++k) + { + for (int l = -i; l <= i; ++l) + { + for (int i1 = -1; i1 <= 1; ++i1) + { + if (worldIn.getBlockState(pos.add(k, i1, l)).getBlock() == this) + { + --j; + + if (j <= 0) + { + flag = true; + break label62; + } + } + } + } + } + + EnumFacing enumfacing1 = EnumFacing.random(rand); + BlockPos blockpos1 = pos.up(); + + if (enumfacing1 == EnumFacing.UP && pos.getY() < 255 && worldIn.isAirBlock(blockpos1)) + { + if (!flag) + { + IBlockState iblockstate2 = state; + + for (Object enumfacing3 : EnumFacing.Plane.HORIZONTAL) + { + if (rand.nextBoolean() || !this.canPlaceOn(worldIn.getBlockState(blockpos1.offset((EnumFacing) enumfacing3)).getBlock())) + { + iblockstate2 = iblockstate2.withProperty(getPropertyFor((EnumFacing) enumfacing3), Boolean.valueOf(false)); + } + } + + if (((Boolean)iblockstate2.getValue(NORTH)).booleanValue() || ((Boolean)iblockstate2.getValue(EAST)).booleanValue() || ((Boolean)iblockstate2.getValue(SOUTH)).booleanValue() || ((Boolean)iblockstate2.getValue(WEST)).booleanValue()) + { + worldIn.setBlockState(blockpos1, iblockstate2, 2); + } + } + } + else if (enumfacing1.getAxis().isHorizontal() && !((Boolean)state.getValue(getPropertyFor(enumfacing1))).booleanValue()) + { + if (!flag) + { + BlockPos blockpos3 = pos.offset(enumfacing1); + Block block1 = worldIn.getBlockState(blockpos3).getBlock(); + + if (block1.blockMaterial == Material.air) + { + EnumFacing enumfacing2 = enumfacing1.rotateY(); + EnumFacing enumfacing4 = enumfacing1.rotateYCCW(); + boolean flag1 = ((Boolean)state.getValue(getPropertyFor(enumfacing2))).booleanValue(); + boolean flag2 = ((Boolean)state.getValue(getPropertyFor(enumfacing4))).booleanValue(); + BlockPos blockpos4 = blockpos3.offset(enumfacing2); + BlockPos blockpos = blockpos3.offset(enumfacing4); + + if (flag1 && this.canPlaceOn(worldIn.getBlockState(blockpos4).getBlock())) + { + worldIn.setBlockState(blockpos3, this.getDefaultState().withProperty(getPropertyFor(enumfacing2), Boolean.valueOf(true)), 2); + } + else if (flag2 && this.canPlaceOn(worldIn.getBlockState(blockpos).getBlock())) + { + worldIn.setBlockState(blockpos3, this.getDefaultState().withProperty(getPropertyFor(enumfacing4), Boolean.valueOf(true)), 2); + } + else if (flag1 && worldIn.isAirBlock(blockpos4) && this.canPlaceOn(worldIn.getBlockState(pos.offset(enumfacing2)).getBlock())) + { + worldIn.setBlockState(blockpos4, this.getDefaultState().withProperty(getPropertyFor(enumfacing1.getOpposite()), Boolean.valueOf(true)), 2); + } + else if (flag2 && worldIn.isAirBlock(blockpos) && this.canPlaceOn(worldIn.getBlockState(pos.offset(enumfacing4)).getBlock())) + { + worldIn.setBlockState(blockpos, this.getDefaultState().withProperty(getPropertyFor(enumfacing1.getOpposite()), Boolean.valueOf(true)), 2); + } + else if (this.canPlaceOn(worldIn.getBlockState(blockpos3.up()).getBlock())) + { + worldIn.setBlockState(blockpos3, this.getDefaultState(), 2); + } + } + else if (block1.blockMaterial.isOpaque() && block1.isFullCube()) + { + worldIn.setBlockState(pos, state.withProperty(getPropertyFor(enumfacing1), Boolean.valueOf(true)), 2); + } + } + } + else + { + if (pos.getY() > 1) + { + BlockPos blockpos2 = pos.down(); + IBlockState iblockstate = worldIn.getBlockState(blockpos2); + Block block = iblockstate.getBlock(); + + if (block.blockMaterial == Material.air) + { + IBlockState iblockstate1 = state; + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (rand.nextBoolean()) + { + iblockstate1 = iblockstate1.withProperty(getPropertyFor((EnumFacing) enumfacing), Boolean.valueOf(false)); + } + } + + if (((Boolean)iblockstate1.getValue(NORTH)).booleanValue() || ((Boolean)iblockstate1.getValue(EAST)).booleanValue() || ((Boolean)iblockstate1.getValue(SOUTH)).booleanValue() || ((Boolean)iblockstate1.getValue(WEST)).booleanValue()) + { + worldIn.setBlockState(blockpos2, iblockstate1, 2); + } + } + else if (block == this) + { + IBlockState iblockstate3 = iblockstate; + + for (Object enumfacing5 : EnumFacing.Plane.HORIZONTAL) + { + PropertyBool propertybool = getPropertyFor((EnumFacing) enumfacing5); + + if (rand.nextBoolean() && ((Boolean)state.getValue(propertybool)).booleanValue()) + { + iblockstate3 = iblockstate3.withProperty(propertybool, Boolean.valueOf(true)); + } + } + + if (((Boolean)iblockstate3.getValue(NORTH)).booleanValue() || ((Boolean)iblockstate3.getValue(EAST)).booleanValue() || ((Boolean)iblockstate3.getValue(SOUTH)).booleanValue() || ((Boolean)iblockstate3.getValue(WEST)).booleanValue()) + { + worldIn.setBlockState(blockpos2, iblockstate3, 2); + } + } + } + } + } + } + } + + /** + * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the + * IBlockstate + */ + public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + { + IBlockState iblockstate = this.getDefaultState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)); + return facing.getAxis().isHorizontal() ? iblockstate.withProperty(getPropertyFor(facing.getOpposite()), Boolean.valueOf(true)) : iblockstate; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return null; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + { + if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears) + { + player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]); + spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0)); + } + else + { + super.harvestBlock(worldIn, player, pos, state, te); + } + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(SOUTH, Boolean.valueOf((meta & 1) > 0)).withProperty(WEST, Boolean.valueOf((meta & 2) > 0)).withProperty(NORTH, Boolean.valueOf((meta & 4) > 0)).withProperty(EAST, Boolean.valueOf((meta & 8) > 0)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + + if (((Boolean)state.getValue(SOUTH)).booleanValue()) + { + i |= 1; + } + + if (((Boolean)state.getValue(WEST)).booleanValue()) + { + i |= 2; + } + + if (((Boolean)state.getValue(NORTH)).booleanValue()) + { + i |= 4; + } + + if (((Boolean)state.getValue(EAST)).booleanValue()) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {UP, NORTH, EAST, SOUTH, WEST}); + } + + public static PropertyBool getPropertyFor(EnumFacing side) + { + switch (side) + { + case UP: + return UP; + + case NORTH: + return NORTH; + + case SOUTH: + return SOUTH; + + case EAST: + return EAST; + + case WEST: + return WEST; + + default: + throw new IllegalArgumentException(side + " is an invalid choice"); + } + } + + public static int getNumGrownFaces(IBlockState state) + { + int i = 0; + + for (PropertyBool propertybool : ALL_FACES) + { + if (((Boolean)state.getValue(propertybool)).booleanValue()) + { + ++i; + } + } + + return i; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockWall.java b/src/minecraft/net/minecraft/block/BlockWall.java new file mode 100644 index 0000000..699e3a3 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockWall.java @@ -0,0 +1,237 @@ +package net.minecraft.block; + +import java.util.List; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.StatCollector; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockWall extends Block +{ + public static final PropertyBool UP = PropertyBool.create("up"); + public static final PropertyBool NORTH = PropertyBool.create("north"); + public static final PropertyBool EAST = PropertyBool.create("east"); + public static final PropertyBool SOUTH = PropertyBool.create("south"); + public static final PropertyBool WEST = PropertyBool.create("west"); + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockWall.EnumType.class); + + public BlockWall(Block modelBlock) + { + super(modelBlock.blockMaterial); + this.setDefaultState(this.blockState.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(VARIANT, BlockWall.EnumType.NORMAL)); + this.setHardness(modelBlock.blockHardness); + this.setResistance(modelBlock.blockResistance / 3.0F); + this.setStepSound(modelBlock.stepSound); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal(this.getUnlocalizedName() + "." + BlockWall.EnumType.NORMAL.getUnlocalizedName() + ".name"); + } + + public boolean isFullCube() + { + return false; + } + + public boolean isPassable(IBlockAccess worldIn, BlockPos pos) + { + return false; + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + boolean flag = this.canConnectTo(worldIn, pos.north()); + boolean flag1 = this.canConnectTo(worldIn, pos.south()); + boolean flag2 = this.canConnectTo(worldIn, pos.west()); + boolean flag3 = this.canConnectTo(worldIn, pos.east()); + float f = 0.25F; + float f1 = 0.75F; + float f2 = 0.25F; + float f3 = 0.75F; + float f4 = 1.0F; + + if (flag) + { + f2 = 0.0F; + } + + if (flag1) + { + f3 = 1.0F; + } + + if (flag2) + { + f = 0.0F; + } + + if (flag3) + { + f1 = 1.0F; + } + + if (flag && flag1 && !flag2 && !flag3) + { + f4 = 0.8125F; + f = 0.3125F; + f1 = 0.6875F; + } + else if (!flag && !flag1 && flag2 && flag3) + { + f4 = 0.8125F; + f2 = 0.3125F; + f3 = 0.6875F; + } + + this.setBlockBounds(f, 0.0F, f2, f1, f4, f3); + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + this.setBlockBoundsBasedOnState(worldIn, pos); + this.maxY = 1.5D; + return super.getCollisionBoundingBox(worldIn, pos, state); + } + + public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos).getBlock(); + return block == Blocks.barrier ? false : (block != this && !(block instanceof BlockFenceGate) ? (block.blockMaterial.isOpaque() && block.isFullCube() ? block.blockMaterial != Material.gourd : false) : true); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + for (BlockWall.EnumType blockwall$enumtype : BlockWall.EnumType.values()) + { + list.add(new ItemStack(itemIn, 1, blockwall$enumtype.getMetadata())); + } + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockWall.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) + { + return side == EnumFacing.DOWN ? super.shouldSideBeRendered(worldIn, pos, side) : true; + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + return this.getDefaultState().withProperty(VARIANT, BlockWall.EnumType.byMetadata(meta)); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((BlockWall.EnumType)state.getValue(VARIANT)).getMetadata(); + } + + /** + * Get the actual Block state of this Block at the given position. This applies properties not visible in the + * metadata, such as fence connections. + */ + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + return state.withProperty(UP, Boolean.valueOf(!worldIn.isAirBlock(pos.up()))).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west()))); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {UP, NORTH, EAST, WEST, SOUTH, VARIANT}); + } + + public static enum EnumType implements IStringSerializable + { + NORMAL(0, "cobblestone", "normal"), + MOSSY(1, "mossy_cobblestone", "mossy"); + + private static final BlockWall.EnumType[] META_LOOKUP = new BlockWall.EnumType[values().length]; + private final int meta; + private final String name; + private String unlocalizedName; + + private EnumType(int meta, String name, String unlocalizedName) + { + this.meta = meta; + this.name = name; + this.unlocalizedName = unlocalizedName; + } + + public int getMetadata() + { + return this.meta; + } + + public String toString() + { + return this.name; + } + + public static BlockWall.EnumType byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String getName() + { + return this.name; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + static { + for (BlockWall.EnumType blockwall$enumtype : values()) + { + META_LOOKUP[blockwall$enumtype.getMetadata()] = blockwall$enumtype; + } + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockWallSign.java b/src/minecraft/net/minecraft/block/BlockWallSign.java new file mode 100644 index 0000000..1ad2ea5 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockWallSign.java @@ -0,0 +1,94 @@ +package net.minecraft.block; + +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BlockWallSign extends BlockSign +{ + public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + + public BlockWallSign() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); + } + + @SuppressWarnings("incomplete-switch") + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) + { + EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING); + float f = 0.28125F; + float f1 = 0.78125F; + float f2 = 0.0F; + float f3 = 1.0F; + float f4 = 0.125F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + + switch (enumfacing) + { + case NORTH: + this.setBlockBounds(f2, f, 1.0F - f4, f3, f1, 1.0F); + break; + + case SOUTH: + this.setBlockBounds(f2, f, 0.0F, f3, f1, f4); + break; + + case WEST: + this.setBlockBounds(1.0F - f4, f, f2, 1.0F, f1, f3); + break; + + case EAST: + this.setBlockBounds(0.0F, f, f2, f4, f1, f3); + } + } + + /** + * Called when a neighboring block changes. + */ + public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + { + EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); + + if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().getMaterial().isSolid()) + { + this.dropBlockAsItem(worldIn, pos, state, 0); + worldIn.setBlockToAir(pos); + } + + super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + EnumFacing enumfacing = EnumFacing.getFront(meta); + + if (enumfacing.getAxis() == EnumFacing.Axis.Y) + { + enumfacing = EnumFacing.NORTH; + } + + return this.getDefaultState().withProperty(FACING, enumfacing); + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + return ((EnumFacing)state.getValue(FACING)).getIndex(); + } + + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] {FACING}); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockWeb.java b/src/minecraft/net/minecraft/block/BlockWeb.java new file mode 100644 index 0000000..6d4fcf6 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockWeb.java @@ -0,0 +1,66 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; + +public class BlockWeb extends Block +{ + public BlockWeb() + { + super(Material.web); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Called When an Entity Collided with the Block + */ + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) + { + entityIn.setInWeb(); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return null; + } + + public boolean isFullCube() + { + return false; + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Items.string; + } + + protected boolean canSilkHarvest() + { + return true; + } + + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } +} diff --git a/src/minecraft/net/minecraft/block/BlockWoodSlab.java b/src/minecraft/net/minecraft/block/BlockWoodSlab.java new file mode 100644 index 0000000..df2574b --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockWoodSlab.java @@ -0,0 +1,133 @@ +package net.minecraft.block; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public abstract class BlockWoodSlab extends BlockSlab +{ + public static final PropertyEnum VARIANT = PropertyEnum.create("variant", BlockPlanks.EnumType.class); + + public BlockWoodSlab() + { + super(Material.wood); + IBlockState iblockstate = this.blockState.getBaseState(); + + if (!this.isDouble()) + { + iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM); + } + + this.setDefaultState(iblockstate.withProperty(VARIANT, BlockPlanks.EnumType.OAK)); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Get the MapColor for this Block and the given BlockState + */ + public MapColor getMapColor(IBlockState state) + { + return ((BlockPlanks.EnumType)state.getValue(VARIANT)).func_181070_c(); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(IBlockState state, Random rand, int fortune) + { + return Item.getItemFromBlock(Blocks.wooden_slab); + } + + public Item getItem(World worldIn, BlockPos pos) + { + return Item.getItemFromBlock(Blocks.wooden_slab); + } + + /** + * Returns the slab block name with the type associated with it + */ + public String getUnlocalizedName(int meta) + { + return super.getUnlocalizedName() + "." + BlockPlanks.EnumType.byMetadata(meta).getUnlocalizedName(); + } + + public IProperty getVariantProperty() + { + return VARIANT; + } + + public Object getVariant(ItemStack stack) + { + return BlockPlanks.EnumType.byMetadata(stack.getMetadata() & 7); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + { + if (itemIn != Item.getItemFromBlock(Blocks.double_wooden_slab)) + { + for (BlockPlanks.EnumType blockplanks$enumtype : BlockPlanks.EnumType.values()) + { + list.add(new ItemStack(itemIn, 1, blockplanks$enumtype.getMetadata())); + } + } + } + + /** + * Convert the given metadata into a BlockState for this Block + */ + public IBlockState getStateFromMeta(int meta) + { + IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockPlanks.EnumType.byMetadata(meta & 7)); + + if (!this.isDouble()) + { + iblockstate = iblockstate.withProperty(HALF, (meta & 8) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); + } + + return iblockstate; + } + + /** + * Convert the BlockState into the correct metadata value + */ + public int getMetaFromState(IBlockState state) + { + int i = 0; + i = i | ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); + + if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP) + { + i |= 8; + } + + return i; + } + + protected BlockState createBlockState() + { + return this.isDouble() ? new BlockState(this, new IProperty[] {VARIANT}): new BlockState(this, new IProperty[] {HALF, VARIANT}); + } + + /** + * Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It + * returns the metadata of the dropped item based on the old metadata of the block. + */ + public int damageDropped(IBlockState state) + { + return ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata(); + } +} diff --git a/src/minecraft/net/minecraft/block/BlockWorkbench.java b/src/minecraft/net/minecraft/block/BlockWorkbench.java new file mode 100644 index 0000000..3f85bab --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockWorkbench.java @@ -0,0 +1,77 @@ +package net.minecraft.block; + +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerWorkbench; +import net.minecraft.stats.StatList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.IInteractionObject; +import net.minecraft.world.World; + +public class BlockWorkbench extends Block +{ + protected BlockWorkbench() + { + super(Material.wood); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + playerIn.displayGui(new BlockWorkbench.InterfaceCraftingTable(worldIn, pos)); + playerIn.triggerAchievement(StatList.field_181742_Z); + return true; + } + } + + public static class InterfaceCraftingTable implements IInteractionObject + { + private final World world; + private final BlockPos position; + + public InterfaceCraftingTable(World worldIn, BlockPos pos) + { + this.world = worldIn; + this.position = pos; + } + + public String getName() + { + return null; + } + + public boolean hasCustomName() + { + return false; + } + + public IChatComponent getDisplayName() + { + return new ChatComponentTranslation(Blocks.crafting_table.getUnlocalizedName() + ".name", new Object[0]); + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + return new ContainerWorkbench(playerInventory, this.world, this.position); + } + + public String getGuiID() + { + return "minecraft:crafting_table"; + } + } +} diff --git a/src/minecraft/net/minecraft/block/BlockYellowFlower.java b/src/minecraft/net/minecraft/block/BlockYellowFlower.java new file mode 100644 index 0000000..2e3bad2 --- /dev/null +++ b/src/minecraft/net/minecraft/block/BlockYellowFlower.java @@ -0,0 +1,12 @@ +package net.minecraft.block; + +public class BlockYellowFlower extends BlockFlower +{ + /** + * Get the Type of this flower (Yellow/Red) + */ + public BlockFlower.EnumFlowerColor getBlockType() + { + return BlockFlower.EnumFlowerColor.YELLOW; + } +} diff --git a/src/minecraft/net/minecraft/block/IGrowable.java b/src/minecraft/net/minecraft/block/IGrowable.java new file mode 100644 index 0000000..ee6fc46 --- /dev/null +++ b/src/minecraft/net/minecraft/block/IGrowable.java @@ -0,0 +1,18 @@ +package net.minecraft.block; + +import java.util.Random; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public interface IGrowable +{ + /** + * Whether this IGrowable can grow + */ + boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient); + + boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state); + + void grow(World worldIn, Random rand, BlockPos pos, IBlockState state); +} diff --git a/src/minecraft/net/minecraft/block/ITileEntityProvider.java b/src/minecraft/net/minecraft/block/ITileEntityProvider.java new file mode 100644 index 0000000..262406e --- /dev/null +++ b/src/minecraft/net/minecraft/block/ITileEntityProvider.java @@ -0,0 +1,12 @@ +package net.minecraft.block; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public interface ITileEntityProvider +{ + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + TileEntity createNewTileEntity(World worldIn, int meta); +} diff --git a/src/minecraft/net/minecraft/block/material/MapColor.java b/src/minecraft/net/minecraft/block/material/MapColor.java new file mode 100644 index 0000000..348afa2 --- /dev/null +++ b/src/minecraft/net/minecraft/block/material/MapColor.java @@ -0,0 +1,96 @@ +package net.minecraft.block.material; + +public class MapColor +{ + /** + * Holds all the 16 colors used on maps, very similar of a pallete system. + */ + public static final MapColor[] mapColorArray = new MapColor[64]; + public static final MapColor airColor = new MapColor(0, 0); + public static final MapColor grassColor = new MapColor(1, 8368696); + public static final MapColor sandColor = new MapColor(2, 16247203); + public static final MapColor clothColor = new MapColor(3, 13092807); + public static final MapColor tntColor = new MapColor(4, 16711680); + public static final MapColor iceColor = new MapColor(5, 10526975); + public static final MapColor ironColor = new MapColor(6, 10987431); + public static final MapColor foliageColor = new MapColor(7, 31744); + public static final MapColor snowColor = new MapColor(8, 16777215); + public static final MapColor clayColor = new MapColor(9, 10791096); + public static final MapColor dirtColor = new MapColor(10, 9923917); + public static final MapColor stoneColor = new MapColor(11, 7368816); + public static final MapColor waterColor = new MapColor(12, 4210943); + public static final MapColor woodColor = new MapColor(13, 9402184); + public static final MapColor quartzColor = new MapColor(14, 16776437); + public static final MapColor adobeColor = new MapColor(15, 14188339); + public static final MapColor magentaColor = new MapColor(16, 11685080); + public static final MapColor lightBlueColor = new MapColor(17, 6724056); + public static final MapColor yellowColor = new MapColor(18, 15066419); + public static final MapColor limeColor = new MapColor(19, 8375321); + public static final MapColor pinkColor = new MapColor(20, 15892389); + public static final MapColor grayColor = new MapColor(21, 5000268); + public static final MapColor silverColor = new MapColor(22, 10066329); + public static final MapColor cyanColor = new MapColor(23, 5013401); + public static final MapColor purpleColor = new MapColor(24, 8339378); + public static final MapColor blueColor = new MapColor(25, 3361970); + public static final MapColor brownColor = new MapColor(26, 6704179); + public static final MapColor greenColor = new MapColor(27, 6717235); + public static final MapColor redColor = new MapColor(28, 10040115); + public static final MapColor blackColor = new MapColor(29, 1644825); + public static final MapColor goldColor = new MapColor(30, 16445005); + public static final MapColor diamondColor = new MapColor(31, 6085589); + public static final MapColor lapisColor = new MapColor(32, 4882687); + public static final MapColor emeraldColor = new MapColor(33, 55610); + public static final MapColor obsidianColor = new MapColor(34, 8476209); + public static final MapColor netherrackColor = new MapColor(35, 7340544); + + /** Holds the color in RGB value that will be rendered on maps. */ + public int colorValue; + + /** Holds the index of the color used on map. */ + public final int colorIndex; + private static final String __OBFID = "CL_00000544"; + + private MapColor(int index, int color) + { + if (index >= 0 && index <= 63) + { + this.colorIndex = index; + this.colorValue = color; + mapColorArray[index] = this; + } + else + { + throw new IndexOutOfBoundsException("Map colour ID must be between 0 and 63 (inclusive)"); + } + } + + public int func_151643_b(int p_151643_1_) + { + short short1 = 220; + + if (p_151643_1_ == 3) + { + short1 = 135; + } + + if (p_151643_1_ == 2) + { + short1 = 255; + } + + if (p_151643_1_ == 1) + { + short1 = 220; + } + + if (p_151643_1_ == 0) + { + short1 = 180; + } + + int i = (this.colorValue >> 16 & 255) * short1 / 255; + int j = (this.colorValue >> 8 & 255) * short1 / 255; + int k = (this.colorValue & 255) * short1 / 255; + return -16777216 | i << 16 | j << 8 | k; + } +} diff --git a/src/minecraft/net/minecraft/block/material/Material.java b/src/minecraft/net/minecraft/block/material/Material.java new file mode 100644 index 0000000..f4f0a8a --- /dev/null +++ b/src/minecraft/net/minecraft/block/material/Material.java @@ -0,0 +1,226 @@ +package net.minecraft.block.material; + +public class Material +{ + public static final Material air = new MaterialTransparent(MapColor.airColor); + public static final Material grass = new Material(MapColor.grassColor); + public static final Material ground = new Material(MapColor.dirtColor); + public static final Material wood = (new Material(MapColor.woodColor)).setBurning(); + public static final Material rock = (new Material(MapColor.stoneColor)).setRequiresTool(); + public static final Material iron = (new Material(MapColor.ironColor)).setRequiresTool(); + public static final Material anvil = (new Material(MapColor.ironColor)).setRequiresTool().setImmovableMobility(); + public static final Material water = (new MaterialLiquid(MapColor.waterColor)).setNoPushMobility(); + public static final Material lava = (new MaterialLiquid(MapColor.tntColor)).setNoPushMobility(); + public static final Material leaves = (new Material(MapColor.foliageColor)).setBurning().setTranslucent().setNoPushMobility(); + public static final Material plants = (new MaterialLogic(MapColor.foliageColor)).setNoPushMobility(); + public static final Material vine = (new MaterialLogic(MapColor.foliageColor)).setBurning().setNoPushMobility().setReplaceable(); + public static final Material sponge = new Material(MapColor.yellowColor); + public static final Material cloth = (new Material(MapColor.clothColor)).setBurning(); + public static final Material fire = (new MaterialTransparent(MapColor.airColor)).setNoPushMobility(); + public static final Material sand = new Material(MapColor.sandColor); + public static final Material circuits = (new MaterialLogic(MapColor.airColor)).setNoPushMobility(); + public static final Material carpet = (new MaterialLogic(MapColor.clothColor)).setBurning(); + public static final Material glass = (new Material(MapColor.airColor)).setTranslucent().setAdventureModeExempt(); + public static final Material redstoneLight = (new Material(MapColor.airColor)).setAdventureModeExempt(); + public static final Material tnt = (new Material(MapColor.tntColor)).setBurning().setTranslucent(); + public static final Material coral = (new Material(MapColor.foliageColor)).setNoPushMobility(); + public static final Material ice = (new Material(MapColor.iceColor)).setTranslucent().setAdventureModeExempt(); + public static final Material packedIce = (new Material(MapColor.iceColor)).setAdventureModeExempt(); + public static final Material snow = (new MaterialLogic(MapColor.snowColor)).setReplaceable().setTranslucent().setRequiresTool().setNoPushMobility(); + + /** The material for crafted snow. */ + public static final Material craftedSnow = (new Material(MapColor.snowColor)).setRequiresTool(); + public static final Material cactus = (new Material(MapColor.foliageColor)).setTranslucent().setNoPushMobility(); + public static final Material clay = new Material(MapColor.clayColor); + public static final Material gourd = (new Material(MapColor.foliageColor)).setNoPushMobility(); + public static final Material dragonEgg = (new Material(MapColor.foliageColor)).setNoPushMobility(); + public static final Material portal = (new MaterialPortal(MapColor.airColor)).setImmovableMobility(); + public static final Material cake = (new Material(MapColor.airColor)).setNoPushMobility(); + public static final Material web = (new Material(MapColor.clothColor) + { + public boolean blocksMovement() + { + return false; + } + }).setRequiresTool().setNoPushMobility(); + + /** Pistons' material. */ + public static final Material piston = (new Material(MapColor.stoneColor)).setImmovableMobility(); + public static final Material barrier = (new Material(MapColor.airColor)).setRequiresTool().setImmovableMobility(); + + /** Bool defining if the block can burn or not. */ + private boolean canBurn; + + /** + * Determines whether blocks with this material can be "overwritten" by other blocks when placed - eg snow, vines + * and tall grass. + */ + private boolean replaceable; + + /** Indicates if the material is translucent */ + private boolean isTranslucent; + + /** The color index used to draw the blocks of this material on maps. */ + private final MapColor materialMapColor; + + /** + * Determines if the material can be harvested without a tool (or with the wrong tool) + */ + private boolean requiresNoTool = true; + + /** + * Mobility information flag. 0 indicates that this block is normal, 1 indicates that it can't push other blocks, 2 + * indicates that it can't be pushed. + */ + private int mobilityFlag; + private boolean isAdventureModeExempt; + + public Material(MapColor color) + { + this.materialMapColor = color; + } + + /** + * Returns if blocks of these materials are liquids. + */ + public boolean isLiquid() + { + return false; + } + + /** + * Returns true if the block is a considered solid. This is true by default. + */ + public boolean isSolid() + { + return true; + } + + /** + * Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true + */ + public boolean blocksLight() + { + return true; + } + + /** + * Returns if this material is considered solid or not + */ + public boolean blocksMovement() + { + return true; + } + + /** + * Marks the material as translucent + */ + private Material setTranslucent() + { + this.isTranslucent = true; + return this; + } + + /** + * Makes blocks with this material require the correct tool to be harvested. + */ + protected Material setRequiresTool() + { + this.requiresNoTool = false; + return this; + } + + /** + * Set the canBurn bool to True and return the current object. + */ + protected Material setBurning() + { + this.canBurn = true; + return this; + } + + /** + * Returns if the block can burn or not. + */ + public boolean getCanBurn() + { + return this.canBurn; + } + + /** + * Sets {@link #replaceable} to true. + */ + public Material setReplaceable() + { + this.replaceable = true; + return this; + } + + /** + * Returns whether the material can be replaced by other blocks when placed - eg snow, vines and tall grass. + */ + public boolean isReplaceable() + { + return this.replaceable; + } + + /** + * Indicate if the material is opaque + */ + public boolean isOpaque() + { + return this.isTranslucent ? false : this.blocksMovement(); + } + + /** + * Returns true if the material can be harvested without a tool (or with the wrong tool) + */ + public boolean isToolNotRequired() + { + return this.requiresNoTool; + } + + /** + * Returns the mobility information of the material, 0 = free, 1 = can't push but can move over, 2 = total + * immobility and stop pistons. + */ + public int getMaterialMobility() + { + return this.mobilityFlag; + } + + /** + * This type of material can't be pushed, but pistons can move over it. + */ + protected Material setNoPushMobility() + { + this.mobilityFlag = 1; + return this; + } + + /** + * This type of material can't be pushed, and pistons are blocked to move. + */ + protected Material setImmovableMobility() + { + this.mobilityFlag = 2; + return this; + } + + /** + * @see #isAdventureModeExempt() + */ + protected Material setAdventureModeExempt() + { + this.isAdventureModeExempt = true; + return this; + } + + /** + * Retrieves the color index of the block. This is is the same color used by vanilla maps to represent this block. + */ + public MapColor getMaterialMapColor() + { + return this.materialMapColor; + } +} diff --git a/src/minecraft/net/minecraft/block/material/MaterialLiquid.java b/src/minecraft/net/minecraft/block/material/MaterialLiquid.java new file mode 100644 index 0000000..e263cf6 --- /dev/null +++ b/src/minecraft/net/minecraft/block/material/MaterialLiquid.java @@ -0,0 +1,35 @@ +package net.minecraft.block.material; + +public class MaterialLiquid extends Material +{ + public MaterialLiquid(MapColor color) + { + super(color); + this.setReplaceable(); + this.setNoPushMobility(); + } + + /** + * Returns if blocks of these materials are liquids. + */ + public boolean isLiquid() + { + return true; + } + + /** + * Returns if this material is considered solid or not + */ + public boolean blocksMovement() + { + return false; + } + + /** + * Returns true if the block is a considered solid. This is true by default. + */ + public boolean isSolid() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/block/material/MaterialLogic.java b/src/minecraft/net/minecraft/block/material/MaterialLogic.java new file mode 100644 index 0000000..df940e9 --- /dev/null +++ b/src/minecraft/net/minecraft/block/material/MaterialLogic.java @@ -0,0 +1,34 @@ +package net.minecraft.block.material; + +public class MaterialLogic extends Material +{ + public MaterialLogic(MapColor color) + { + super(color); + this.setAdventureModeExempt(); + } + + /** + * Returns true if the block is a considered solid. This is true by default. + */ + public boolean isSolid() + { + return false; + } + + /** + * Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true + */ + public boolean blocksLight() + { + return false; + } + + /** + * Returns if this material is considered solid or not + */ + public boolean blocksMovement() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/block/material/MaterialPortal.java b/src/minecraft/net/minecraft/block/material/MaterialPortal.java new file mode 100644 index 0000000..008828c --- /dev/null +++ b/src/minecraft/net/minecraft/block/material/MaterialPortal.java @@ -0,0 +1,33 @@ +package net.minecraft.block.material; + +public class MaterialPortal extends Material +{ + public MaterialPortal(MapColor color) + { + super(color); + } + + /** + * Returns true if the block is a considered solid. This is true by default. + */ + public boolean isSolid() + { + return false; + } + + /** + * Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true + */ + public boolean blocksLight() + { + return false; + } + + /** + * Returns if this material is considered solid or not + */ + public boolean blocksMovement() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/block/material/MaterialTransparent.java b/src/minecraft/net/minecraft/block/material/MaterialTransparent.java new file mode 100644 index 0000000..df4658d --- /dev/null +++ b/src/minecraft/net/minecraft/block/material/MaterialTransparent.java @@ -0,0 +1,34 @@ +package net.minecraft.block.material; + +public class MaterialTransparent extends Material +{ + public MaterialTransparent(MapColor color) + { + super(color); + this.setReplaceable(); + } + + /** + * Returns true if the block is a considered solid. This is true by default. + */ + public boolean isSolid() + { + return false; + } + + /** + * Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true + */ + public boolean blocksLight() + { + return false; + } + + /** + * Returns if this material is considered solid or not + */ + public boolean blocksMovement() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/block/properties/IProperty.java b/src/minecraft/net/minecraft/block/properties/IProperty.java new file mode 100644 index 0000000..2c09ef0 --- /dev/null +++ b/src/minecraft/net/minecraft/block/properties/IProperty.java @@ -0,0 +1,17 @@ +package net.minecraft.block.properties; + +import java.util.Collection; + +public interface IProperty> +{ + String getName(); + + Collection getAllowedValues(); + + Class getValueClass(); + + /** + * Get the name for the given value. + */ + String getName(T value); +} diff --git a/src/minecraft/net/minecraft/block/properties/PropertyBool.java b/src/minecraft/net/minecraft/block/properties/PropertyBool.java new file mode 100644 index 0000000..c6253ba --- /dev/null +++ b/src/minecraft/net/minecraft/block/properties/PropertyBool.java @@ -0,0 +1,32 @@ +package net.minecraft.block.properties; + +import com.google.common.collect.ImmutableSet; +import java.util.Collection; + +public class PropertyBool extends PropertyHelper +{ + private final ImmutableSet allowedValues = ImmutableSet.of(Boolean.valueOf(true), Boolean.valueOf(false)); + + protected PropertyBool(String name) + { + super(name, Boolean.class); + } + + public Collection getAllowedValues() + { + return this.allowedValues; + } + + public static PropertyBool create(String name) + { + return new PropertyBool(name); + } + + /** + * Get the name for the given value. + */ + public String getName(Boolean value) + { + return value.toString(); + } +} diff --git a/src/minecraft/net/minecraft/block/properties/PropertyDirection.java b/src/minecraft/net/minecraft/block/properties/PropertyDirection.java new file mode 100644 index 0000000..46c2dd1 --- /dev/null +++ b/src/minecraft/net/minecraft/block/properties/PropertyDirection.java @@ -0,0 +1,40 @@ +package net.minecraft.block.properties; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.common.collect.Collections2; +import com.google.common.collect.Lists; +import java.util.Collection; +import net.minecraft.util.EnumFacing; + +public class PropertyDirection extends PropertyEnum +{ + protected PropertyDirection(String name, Collection values) + { + super(name, EnumFacing.class, values); + } + + /** + * Create a new PropertyDirection with the given name + */ + public static PropertyDirection create(String name) + { + return create(name, Predicates.alwaysTrue()); + } + + /** + * Create a new PropertyDirection with all directions that match the given Predicate + */ + public static PropertyDirection create(String name, Predicate filter) + { + return create(name, Collections2.filter(Lists.newArrayList(EnumFacing.values()), filter)); + } + + /** + * Create a new PropertyDirection for the given direction values + */ + public static PropertyDirection create(String name, Collection values) + { + return new PropertyDirection(name, values); + } +} diff --git a/src/minecraft/net/minecraft/block/properties/PropertyEnum.java b/src/minecraft/net/minecraft/block/properties/PropertyEnum.java new file mode 100644 index 0000000..ba58d8c --- /dev/null +++ b/src/minecraft/net/minecraft/block/properties/PropertyEnum.java @@ -0,0 +1,68 @@ +package net.minecraft.block.properties; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.common.collect.Collections2; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.Collection; +import java.util.Map; +import net.minecraft.util.IStringSerializable; + +public class PropertyEnum & IStringSerializable> extends PropertyHelper +{ + private final ImmutableSet allowedValues; + private final Map nameToValue = Maps.newHashMap(); + + protected PropertyEnum(String name, Class valueClass, Collection allowedValues) + { + super(name, valueClass); + this.allowedValues = ImmutableSet.copyOf(allowedValues); + + for (T t : allowedValues) + { + String s = ((IStringSerializable)t).getName(); + + if (this.nameToValue.containsKey(s)) + { + throw new IllegalArgumentException("Multiple values have the same name \'" + s + "\'"); + } + + this.nameToValue.put(s, t); + } + } + + public Collection getAllowedValues() + { + return this.allowedValues; + } + + /** + * Get the name for the given value. + */ + public String getName(T value) + { + return ((IStringSerializable)value).getName(); + } + + public static & IStringSerializable> PropertyEnum create(String name, Class clazz) + { + return create(name, clazz, Predicates.alwaysTrue()); + } + + public static & IStringSerializable> PropertyEnum create(String name, Class clazz, Predicate filter) + { + return create(name, clazz, Collections2.filter(Lists.newArrayList(clazz.getEnumConstants()), filter)); + } + + public static & IStringSerializable> PropertyEnum create(String name, Class clazz, T... values) + { + return create(name, clazz, Lists.newArrayList(values)); + } + + public static & IStringSerializable> PropertyEnum create(String name, Class clazz, Collection values) + { + return new PropertyEnum(name, clazz, values); + } +} diff --git a/src/minecraft/net/minecraft/block/properties/PropertyHelper.java b/src/minecraft/net/minecraft/block/properties/PropertyHelper.java new file mode 100644 index 0000000..30f50fa --- /dev/null +++ b/src/minecraft/net/minecraft/block/properties/PropertyHelper.java @@ -0,0 +1,52 @@ +package net.minecraft.block.properties; + +import com.google.common.base.Objects; + +public abstract class PropertyHelper> implements IProperty +{ + private final Class valueClass; + private final String name; + + protected PropertyHelper(String name, Class valueClass) + { + this.valueClass = valueClass; + this.name = name; + } + + public String getName() + { + return this.name; + } + + public Class getValueClass() + { + return this.valueClass; + } + + public String toString() + { + return Objects.toStringHelper(this).add("name", this.name).add("clazz", this.valueClass).add("values", this.getAllowedValues()).toString(); + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) + { + PropertyHelper propertyhelper = (PropertyHelper)p_equals_1_; + return this.valueClass.equals(propertyhelper.valueClass) && this.name.equals(propertyhelper.name); + } + else + { + return false; + } + } + + public int hashCode() + { + return 31 * this.valueClass.hashCode() + this.name.hashCode(); + } +} diff --git a/src/minecraft/net/minecraft/block/properties/PropertyInteger.java b/src/minecraft/net/minecraft/block/properties/PropertyInteger.java new file mode 100644 index 0000000..098b8b2 --- /dev/null +++ b/src/minecraft/net/minecraft/block/properties/PropertyInteger.java @@ -0,0 +1,85 @@ +package net.minecraft.block.properties; + +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; +import java.util.Collection; +import java.util.Set; + +public class PropertyInteger extends PropertyHelper +{ + private final ImmutableSet allowedValues; + + protected PropertyInteger(String name, int min, int max) + { + super(name, Integer.class); + + if (min < 0) + { + throw new IllegalArgumentException("Min value of " + name + " must be 0 or greater"); + } + else if (max <= min) + { + throw new IllegalArgumentException("Max value of " + name + " must be greater than min (" + min + ")"); + } + else + { + Set set = Sets.newHashSet(); + + for (int i = min; i <= max; ++i) + { + set.add(Integer.valueOf(i)); + } + + this.allowedValues = ImmutableSet.copyOf(set); + } + } + + public Collection getAllowedValues() + { + return this.allowedValues; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) + { + if (!super.equals(p_equals_1_)) + { + return false; + } + else + { + PropertyInteger propertyinteger = (PropertyInteger)p_equals_1_; + return this.allowedValues.equals(propertyinteger.allowedValues); + } + } + else + { + return false; + } + } + + public int hashCode() + { + int i = super.hashCode(); + i = 31 * i + this.allowedValues.hashCode(); + return i; + } + + public static PropertyInteger create(String name, int min, int max) + { + return new PropertyInteger(name, min, max); + } + + /** + * Get the name for the given value. + */ + public String getName(Integer value) + { + return value.toString(); + } +} diff --git a/src/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java b/src/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java new file mode 100644 index 0000000..28b8c73 --- /dev/null +++ b/src/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java @@ -0,0 +1,224 @@ +package net.minecraft.block.state; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class BlockPistonStructureHelper +{ + private final World world; + private final BlockPos pistonPos; + private final BlockPos blockToMove; + private final EnumFacing moveDirection; + private final List toMove = Lists.newArrayList(); + private final List toDestroy = Lists.newArrayList(); + + public BlockPistonStructureHelper(World worldIn, BlockPos posIn, EnumFacing pistonFacing, boolean extending) + { + this.world = worldIn; + this.pistonPos = posIn; + + if (extending) + { + this.moveDirection = pistonFacing; + this.blockToMove = posIn.offset(pistonFacing); + } + else + { + this.moveDirection = pistonFacing.getOpposite(); + this.blockToMove = posIn.offset(pistonFacing, 2); + } + } + + public boolean canMove() + { + this.toMove.clear(); + this.toDestroy.clear(); + Block block = this.world.getBlockState(this.blockToMove).getBlock(); + + if (!BlockPistonBase.canPush(block, this.world, this.blockToMove, this.moveDirection, false)) + { + if (block.getMobilityFlag() != 1) + { + return false; + } + else + { + this.toDestroy.add(this.blockToMove); + return true; + } + } + else if (!this.func_177251_a(this.blockToMove)) + { + return false; + } + else + { + for (int i = 0; i < this.toMove.size(); ++i) + { + BlockPos blockpos = (BlockPos)this.toMove.get(i); + + if (this.world.getBlockState(blockpos).getBlock() == Blocks.slime_block && !this.func_177250_b(blockpos)) + { + return false; + } + } + + return true; + } + } + + private boolean func_177251_a(BlockPos origin) + { + Block block = this.world.getBlockState(origin).getBlock(); + + if (block.getMaterial() == Material.air) + { + return true; + } + else if (!BlockPistonBase.canPush(block, this.world, origin, this.moveDirection, false)) + { + return true; + } + else if (origin.equals(this.pistonPos)) + { + return true; + } + else if (this.toMove.contains(origin)) + { + return true; + } + else + { + int i = 1; + + if (i + this.toMove.size() > 12) + { + return false; + } + else + { + while (block == Blocks.slime_block) + { + BlockPos blockpos = origin.offset(this.moveDirection.getOpposite(), i); + block = this.world.getBlockState(blockpos).getBlock(); + + if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos)) + { + break; + } + + ++i; + + if (i + this.toMove.size() > 12) + { + return false; + } + } + + int i1 = 0; + + for (int j = i - 1; j >= 0; --j) + { + this.toMove.add(origin.offset(this.moveDirection.getOpposite(), j)); + ++i1; + } + + int j1 = 1; + + while (true) + { + BlockPos blockpos1 = origin.offset(this.moveDirection, j1); + int k = this.toMove.indexOf(blockpos1); + + if (k > -1) + { + this.func_177255_a(i1, k); + + for (int l = 0; l <= k + i1; ++l) + { + BlockPos blockpos2 = (BlockPos)this.toMove.get(l); + + if (this.world.getBlockState(blockpos2).getBlock() == Blocks.slime_block && !this.func_177250_b(blockpos2)) + { + return false; + } + } + + return true; + } + + block = this.world.getBlockState(blockpos1).getBlock(); + + if (block.getMaterial() == Material.air) + { + return true; + } + + if (!BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, true) || blockpos1.equals(this.pistonPos)) + { + return false; + } + + if (block.getMobilityFlag() == 1) + { + this.toDestroy.add(blockpos1); + return true; + } + + if (this.toMove.size() >= 12) + { + return false; + } + + this.toMove.add(blockpos1); + ++i1; + ++j1; + } + } + } + } + + private void func_177255_a(int p_177255_1_, int p_177255_2_) + { + List list = Lists.newArrayList(); + List list1 = Lists.newArrayList(); + List list2 = Lists.newArrayList(); + list.addAll(this.toMove.subList(0, p_177255_2_)); + list1.addAll(this.toMove.subList(this.toMove.size() - p_177255_1_, this.toMove.size())); + list2.addAll(this.toMove.subList(p_177255_2_, this.toMove.size() - p_177255_1_)); + this.toMove.clear(); + this.toMove.addAll(list); + this.toMove.addAll(list1); + this.toMove.addAll(list2); + } + + private boolean func_177250_b(BlockPos p_177250_1_) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + if (enumfacing.getAxis() != this.moveDirection.getAxis() && !this.func_177251_a(p_177250_1_.offset(enumfacing))) + { + return false; + } + } + + return true; + } + + public List getBlocksToMove() + { + return this.toMove; + } + + public List getBlocksToDestroy() + { + return this.toDestroy; + } +} diff --git a/src/minecraft/net/minecraft/block/state/BlockState.java b/src/minecraft/net/minecraft/block/state/BlockState.java new file mode 100644 index 0000000..0d4dde1 --- /dev/null +++ b/src/minecraft/net/minecraft/block/state/BlockState.java @@ -0,0 +1,203 @@ +package net.minecraft.block.state; + +import com.google.common.base.Function; +import com.google.common.base.Joiner; +import com.google.common.base.Objects; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableTable; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Table; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.util.Cartesian; +import net.minecraft.util.MapPopulator; + +public class BlockState +{ + private static final Joiner COMMA_JOINER = Joiner.on(", "); + private static final Function GET_NAME_FUNC = new Function() + { + public String apply(IProperty p_apply_1_) + { + return p_apply_1_ == null ? "" : p_apply_1_.getName(); + } + }; + private final Block block; + private final ImmutableList properties; + private final ImmutableList validStates; + + public BlockState(Block blockIn, IProperty... properties) + { + this.block = blockIn; + Arrays.sort(properties, new Comparator() + { + public int compare(IProperty p_compare_1_, IProperty p_compare_2_) + { + return p_compare_1_.getName().compareTo(p_compare_2_.getName()); + } + }); + this.properties = ImmutableList.copyOf(properties); + Map, BlockState.StateImplementation> map = Maps., BlockState.StateImplementation>newLinkedHashMap(); + List list = Lists.newArrayList(); + + for (List list1 : Cartesian.cartesianProduct(this.getAllowedValues())) + { + Map map1 = MapPopulator.createMap(this.properties, list1); + BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1)); + map.put(map1, blockstate$stateimplementation); + list.add(blockstate$stateimplementation); + } + + for (BlockState.StateImplementation blockstate$stateimplementation1 : list) + { + blockstate$stateimplementation1.buildPropertyValueTable(map); + } + + this.validStates = ImmutableList.copyOf(list); + } + + public ImmutableList getValidStates() + { + return this.validStates; + } + + private List> getAllowedValues() + { + List> list = Lists.>newArrayList(); + + for (int i = 0; i < this.properties.size(); ++i) + { + list.add(((IProperty)this.properties.get(i)).getAllowedValues()); + } + + return list; + } + + public IBlockState getBaseState() + { + return (IBlockState)this.validStates.get(0); + } + + public Block getBlock() + { + return this.block; + } + + public Collection getProperties() + { + return this.properties; + } + + public String toString() + { + return Objects.toStringHelper(this).add("block", Block.blockRegistry.getNameForObject(this.block)).add("properties", Iterables.transform(this.properties, GET_NAME_FUNC)).toString(); + } + + static class StateImplementation extends BlockStateBase + { + private final Block block; + private final ImmutableMap properties; + private ImmutableTable propertyValueTable; + + private StateImplementation(Block blockIn, ImmutableMap propertiesIn) + { + this.block = blockIn; + this.properties = propertiesIn; + } + + public Collection getPropertyNames() + { + return Collections.unmodifiableCollection(this.properties.keySet()); + } + + public > T getValue(IProperty property) + { + if (!this.properties.containsKey(property)) + { + throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.block.getBlockState()); + } + else + { + return (T)((Comparable)property.getValueClass().cast(this.properties.get(property))); + } + } + + public , V extends T> IBlockState withProperty(IProperty property, V value) + { + if (!this.properties.containsKey(property)) + { + throw new IllegalArgumentException("Cannot set property " + property + " as it does not exist in " + this.block.getBlockState()); + } + else if (!property.getAllowedValues().contains(value)) + { + throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block " + Block.blockRegistry.getNameForObject(this.block) + ", it is not an allowed value"); + } + else + { + return (IBlockState)(this.properties.get(property) == value ? this : (IBlockState)this.propertyValueTable.get(property, value)); + } + } + + public ImmutableMap getProperties() + { + return this.properties; + } + + public Block getBlock() + { + return this.block; + } + + public boolean equals(Object p_equals_1_) + { + return this == p_equals_1_; + } + + public int hashCode() + { + return this.properties.hashCode(); + } + + public void buildPropertyValueTable(Map, BlockState.StateImplementation> map) + { + if (this.propertyValueTable != null) + { + throw new IllegalStateException(); + } + else + { + Table table = HashBasedTable.create(); + + for (IProperty iproperty : this.properties.keySet()) + { + for (Comparable comparable : iproperty.getAllowedValues()) + { + if (comparable != this.properties.get(iproperty)) + { + table.put(iproperty, comparable, map.get(this.getPropertiesWithValue(iproperty, comparable))); + } + } + } + + this.propertyValueTable = ImmutableTable.copyOf(table); + } + } + + private Map getPropertiesWithValue(IProperty property, Comparable value) + { + Map map = Maps.newHashMap(this.properties); + map.put(property, value); + return map; + } + } +} diff --git a/src/minecraft/net/minecraft/block/state/BlockStateBas# b/src/minecraft/net/minecraft/block/state/BlockStateBas# new file mode 100644 index 0000000..805f317 --- /dev/null +++ b/src/minecraft/net/minecraft/block/state/BlockStateBas# @@ -0,0 +1,17 @@ +*************** +*** 24,30 **** + }; + + public > IBlockState func_177231_a(IProperty p_177231_1_) { +- return this.func_177226_a(p_177231_1_, (Comparable)func_177232_a(p_177231_1_.func_177700_c(), this.func_177229_b(p_177231_1_))); + } + + protected static T func_177232_a(Collection p_177232_0_, T p_177232_1_) { +--- 24,30 ---- + }; + + public > IBlockState func_177231_a(IProperty p_177231_1_) { ++ return this.func_177226_a(p_177231_1_, func_177232_a(p_177231_1_.func_177700_c(), this.func_177229_b(p_177231_1_))); + } + + protected static T func_177232_a(Collection p_177232_0_, T p_177232_1_) { diff --git a/src/minecraft/net/minecraft/block/state/BlockStateBase.java b/src/minecraft/net/minecraft/block/state/BlockStateBase.java new file mode 100644 index 0000000..cc90da5 --- /dev/null +++ b/src/minecraft/net/minecraft/block/state/BlockStateBase.java @@ -0,0 +1,134 @@ +package net.minecraft.block.state; + +import com.google.common.base.Function; +import com.google.common.base.Joiner; +import com.google.common.collect.ImmutableTable; +import com.google.common.collect.Iterables; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map.Entry; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.util.ResourceLocation; + +public abstract class BlockStateBase implements IBlockState +{ + private static final Joiner COMMA_JOINER = Joiner.on(','); + private static final Function MAP_ENTRY_TO_STRING = new Function() + { + private static final String __OBFID = "CL_00002031"; + public String apply(Entry p_apply_1_) + { + if (p_apply_1_ == null) + { + return ""; + } + else + { + IProperty iproperty = (IProperty)p_apply_1_.getKey(); + return iproperty.getName() + "=" + iproperty.getName((Comparable)p_apply_1_.getValue()); + } + } + public Object apply(Object p_apply_1_) + { + return this.apply((Entry)p_apply_1_); + } + }; + private static final String __OBFID = "CL_00002032"; + private int blockId = -1; + private int blockStateId = -1; + private int metadata = -1; + private ResourceLocation blockLocation = null; + + public int getBlockId() + { + if (this.blockId < 0) + { + this.blockId = Block.getIdFromBlock(this.getBlock()); + } + + return this.blockId; + } + + public int getBlockStateId() + { + if (this.blockStateId < 0) + { + this.blockStateId = Block.getStateId(this); + } + + return this.blockStateId; + } + + public int getMetadata() + { + if (this.metadata < 0) + { + this.metadata = this.getBlock().getMetaFromState(this); + } + + return this.metadata; + } + + public ResourceLocation getBlockLocation() + { + if (this.blockLocation == null) + { + this.blockLocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.getBlock()); + } + + return this.blockLocation; + } + + /** + * Create a version of this BlockState with the given property cycled to the next value in order. If the property + * was at the highest possible value, it is set to the lowest one instead. + */ + public IBlockState cycleProperty(IProperty property) + { + return this.withProperty(property, (Comparable)cyclePropertyValue(property.getAllowedValues(), this.getValue(property))); + } + + /** + * Helper method for cycleProperty. + */ + protected static Object cyclePropertyValue(Collection values, Object currentValue) + { + Iterator iterator = values.iterator(); + + while (iterator.hasNext()) + { + if (iterator.next().equals(currentValue)) + { + if (iterator.hasNext()) + { + return iterator.next(); + } + + return values.iterator().next(); + } + } + + return iterator.next(); + } + + public String toString() + { + StringBuilder stringbuilder = new StringBuilder(); + stringbuilder.append(Block.blockRegistry.getNameForObject(this.getBlock())); + + if (!this.getProperties().isEmpty()) + { + stringbuilder.append("["); + COMMA_JOINER.appendTo(stringbuilder, Iterables.transform(this.getProperties().entrySet(), MAP_ENTRY_TO_STRING)); + stringbuilder.append("]"); + } + + return stringbuilder.toString(); + } + + public ImmutableTable getPropertyValueTable() + { + return null; + } +} diff --git a/src/minecraft/net/minecraft/block/state/BlockStateBas~ b/src/minecraft/net/minecraft/block/state/BlockStateBas~ new file mode 100644 index 0000000..4ad90f6 --- /dev/null +++ b/src/minecraft/net/minecraft/block/state/BlockStateBas~ @@ -0,0 +1,106 @@ +package net.minecraft.block.state; + +import com.google.common.base.Function; +import com.google.common.base.Joiner; +import com.google.common.collect.ImmutableTable; +import com.google.common.collect.Iterables; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map.Entry; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.ResourceLocation; + +public abstract class BlockStateBase implements IBlockState { + private static final Joiner field_177234_a = Joiner.on(','); + private static final Function field_177233_b = new Function() { + private static final String __OBFID = "CL_00002031"; + + public String apply(Entry p_apply_1_) { + if(p_apply_1_ == null) { + return ""; + } else { + IProperty iproperty = (IProperty)p_apply_1_.getKey(); + return iproperty.func_177701_a() + "=" + iproperty.func_177702_a((Comparable)p_apply_1_.getValue()); + } + } + + public Object apply(Object p_apply_1_) { + return this.apply((Entry)p_apply_1_); + } + }; + private static final String __OBFID = "CL_00002032"; + private int blockId = -1; + private int blockStateId = -1; + private int metadata = -1; + private ResourceLocation blockLocation = null; + + public int getBlockId() { + if(this.blockId < 0) { + this.blockId = Block.func_149682_b(this.func_177230_c()); + } + + return this.blockId; + } + + public int getBlockStateId() { + if(this.blockStateId < 0) { + this.blockStateId = Block.func_176210_f(this); + } + + return this.blockStateId; + } + + public int getMetadata() { + if(this.metadata < 0) { + this.metadata = this.func_177230_c().func_176201_c(this); + } + + return this.metadata; + } + + public ResourceLocation getBlockLocation() { + if(this.blockLocation == null) { + this.blockLocation = (ResourceLocation)Block.field_149771_c.func_177774_c(this.func_177230_c()); + } + + return this.blockLocation; + } + + public IBlockState func_177231_a(IProperty p_177231_1_) { + return this.func_177226_a(p_177231_1_, (Comparable)func_177232_a(p_177231_1_.func_177700_c(), this.func_177229_b(p_177231_1_))); + } + + protected static Object func_177232_a(Collection p_177232_0_, Object p_177232_1_) { + Iterator iterator = p_177232_0_.iterator(); + + while(iterator.hasNext()) { + if(iterator.next().equals(p_177232_1_)) { + if(iterator.hasNext()) { + return iterator.next(); + } + + return p_177232_0_.iterator().next(); + } + } + + return iterator.next(); + } + + public String toString() { + StringBuilder stringbuilder = new StringBuilder(); + stringbuilder.append(Block.field_149771_c.func_177774_c(this.func_177230_c())); + if(!this.func_177228_b().isEmpty()) { + stringbuilder.append("["); + field_177234_a.appendTo(stringbuilder, Iterables.transform(this.func_177228_b().entrySet(), field_177233_b)); + stringbuilder.append("]"); + } + + return stringbuilder.toString(); + } + + public ImmutableTable getPropertyValueTable() { + return null; + } +} diff --git a/src/minecraft/net/minecraft/block/state/BlockWorldState.java b/src/minecraft/net/minecraft/block/state/BlockWorldState.java new file mode 100644 index 0000000..148ae88 --- /dev/null +++ b/src/minecraft/net/minecraft/block/state/BlockWorldState.java @@ -0,0 +1,60 @@ +package net.minecraft.block.state; + +import com.google.common.base.Predicate; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BlockWorldState +{ + private final World world; + private final BlockPos pos; + private final boolean field_181628_c; + private IBlockState state; + private TileEntity tileEntity; + private boolean tileEntityInitialized; + + public BlockWorldState(World p_i46451_1_, BlockPos p_i46451_2_, boolean p_i46451_3_) + { + this.world = p_i46451_1_; + this.pos = p_i46451_2_; + this.field_181628_c = p_i46451_3_; + } + + public IBlockState getBlockState() + { + if (this.state == null && (this.field_181628_c || this.world.isBlockLoaded(this.pos))) + { + this.state = this.world.getBlockState(this.pos); + } + + return this.state; + } + + public TileEntity getTileEntity() + { + if (this.tileEntity == null && !this.tileEntityInitialized) + { + this.tileEntity = this.world.getTileEntity(this.pos); + this.tileEntityInitialized = true; + } + + return this.tileEntity; + } + + public BlockPos getPos() + { + return this.pos; + } + + public static Predicate hasState(final Predicate p_177510_0_) + { + return new Predicate() + { + public boolean apply(BlockWorldState p_apply_1_) + { + return p_apply_1_ != null && p_177510_0_.apply(p_apply_1_.getBlockState()); + } + }; + } +} diff --git a/src/minecraft/net/minecraft/block/state/IBlockState.java b/src/minecraft/net/minecraft/block/state/IBlockState.java new file mode 100644 index 0000000..ba4fcfa --- /dev/null +++ b/src/minecraft/net/minecraft/block/state/IBlockState.java @@ -0,0 +1,21 @@ +package net.minecraft.block.state; + +import com.google.common.collect.ImmutableMap; +import java.util.Collection; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; + +public interface IBlockState +{ + Collection getPropertyNames(); + + > T getValue(IProperty property); + + , V extends T> IBlockState withProperty(IProperty property, V value); + + > IBlockState cycleProperty(IProperty property); + + ImmutableMap getProperties(); + + Block getBlock(); +} diff --git a/src/minecraft/net/minecraft/block/state/pattern/BlockHelper.java b/src/minecraft/net/minecraft/block/state/pattern/BlockHelper.java new file mode 100644 index 0000000..ed5a334 --- /dev/null +++ b/src/minecraft/net/minecraft/block/state/pattern/BlockHelper.java @@ -0,0 +1,25 @@ +package net.minecraft.block.state.pattern; + +import com.google.common.base.Predicate; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; + +public class BlockHelper implements Predicate +{ + private final Block block; + + private BlockHelper(Block blockType) + { + this.block = blockType; + } + + public static BlockHelper forBlock(Block blockType) + { + return new BlockHelper(blockType); + } + + public boolean apply(IBlockState p_apply_1_) + { + return p_apply_1_ != null && p_apply_1_.getBlock() == this.block; + } +} diff --git a/src/minecraft/net/minecraft/block/state/pattern/BlockPattern.java b/src/minecraft/net/minecraft/block/state/pattern/BlockPattern.java new file mode 100644 index 0000000..882183a --- /dev/null +++ b/src/minecraft/net/minecraft/block/state/pattern/BlockPattern.java @@ -0,0 +1,205 @@ +package net.minecraft.block.state.pattern; + +import com.google.common.base.Objects; +import com.google.common.base.Predicate; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.LoadingCache; +import net.minecraft.block.state.BlockWorldState; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3i; +import net.minecraft.world.World; + +public class BlockPattern +{ + private final Predicate[][][] blockMatches; + private final int fingerLength; + private final int thumbLength; + private final int palmLength; + + public BlockPattern(Predicate[][][] predicatesIn) + { + this.blockMatches = predicatesIn; + this.fingerLength = predicatesIn.length; + + if (this.fingerLength > 0) + { + this.thumbLength = predicatesIn[0].length; + + if (this.thumbLength > 0) + { + this.palmLength = predicatesIn[0][0].length; + } + else + { + this.palmLength = 0; + } + } + else + { + this.thumbLength = 0; + this.palmLength = 0; + } + } + + public int getThumbLength() + { + return this.thumbLength; + } + + public int getPalmLength() + { + return this.palmLength; + } + + /** + * checks that the given pattern & rotation is at the block co-ordinates. + */ + private BlockPattern.PatternHelper checkPatternAt(BlockPos pos, EnumFacing finger, EnumFacing thumb, LoadingCache lcache) + { + for (int i = 0; i < this.palmLength; ++i) + { + for (int j = 0; j < this.thumbLength; ++j) + { + for (int k = 0; k < this.fingerLength; ++k) + { + if (!this.blockMatches[k][j][i].apply(lcache.getUnchecked(translateOffset(pos, finger, thumb, i, j, k)))) + { + return null; + } + } + } + } + + return new BlockPattern.PatternHelper(pos, finger, thumb, lcache, this.palmLength, this.thumbLength, this.fingerLength); + } + + /** + * Calculates whether the given world position matches the pattern. Warning, fairly heavy function. @return a + * BlockPattern.PatternHelper if found, null otherwise. + */ + public BlockPattern.PatternHelper match(World worldIn, BlockPos pos) + { + LoadingCache loadingcache = func_181627_a(worldIn, false); + int i = Math.max(Math.max(this.palmLength, this.thumbLength), this.fingerLength); + + for (BlockPos blockpos : BlockPos.getAllInBox(pos, pos.add(i - 1, i - 1, i - 1))) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + for (EnumFacing enumfacing1 : EnumFacing.values()) + { + if (enumfacing1 != enumfacing && enumfacing1 != enumfacing.getOpposite()) + { + BlockPattern.PatternHelper blockpattern$patternhelper = this.checkPatternAt(blockpos, enumfacing, enumfacing1, loadingcache); + + if (blockpattern$patternhelper != null) + { + return blockpattern$patternhelper; + } + } + } + } + } + + return null; + } + + public static LoadingCache func_181627_a(World p_181627_0_, boolean p_181627_1_) + { + return CacheBuilder.newBuilder().build(new BlockPattern.CacheLoader(p_181627_0_, p_181627_1_)); + } + + /** + * Offsets the position of pos in the direction of finger and thumb facing by offset amounts, follows the right-hand + * rule for cross products (finger, thumb, palm) @return A new BlockPos offset in the facing directions + */ + protected static BlockPos translateOffset(BlockPos pos, EnumFacing finger, EnumFacing thumb, int palmOffset, int thumbOffset, int fingerOffset) + { + if (finger != thumb && finger != thumb.getOpposite()) + { + Vec3i vec3i = new Vec3i(finger.getFrontOffsetX(), finger.getFrontOffsetY(), finger.getFrontOffsetZ()); + Vec3i vec3i1 = new Vec3i(thumb.getFrontOffsetX(), thumb.getFrontOffsetY(), thumb.getFrontOffsetZ()); + Vec3i vec3i2 = vec3i.crossProduct(vec3i1); + return pos.add(vec3i1.getX() * -thumbOffset + vec3i2.getX() * palmOffset + vec3i.getX() * fingerOffset, vec3i1.getY() * -thumbOffset + vec3i2.getY() * palmOffset + vec3i.getY() * fingerOffset, vec3i1.getZ() * -thumbOffset + vec3i2.getZ() * palmOffset + vec3i.getZ() * fingerOffset); + } + else + { + throw new IllegalArgumentException("Invalid forwards & up combination"); + } + } + + static class CacheLoader extends com.google.common.cache.CacheLoader + { + private final World world; + private final boolean field_181626_b; + + public CacheLoader(World p_i46460_1_, boolean p_i46460_2_) + { + this.world = p_i46460_1_; + this.field_181626_b = p_i46460_2_; + } + + public BlockWorldState load(BlockPos p_load_1_) throws Exception + { + return new BlockWorldState(this.world, p_load_1_, this.field_181626_b); + } + } + + public static class PatternHelper + { + private final BlockPos pos; + private final EnumFacing finger; + private final EnumFacing thumb; + private final LoadingCache lcache; + private final int field_181120_e; + private final int field_181121_f; + private final int field_181122_g; + + public PatternHelper(BlockPos p_i46378_1_, EnumFacing p_i46378_2_, EnumFacing p_i46378_3_, LoadingCache p_i46378_4_, int p_i46378_5_, int p_i46378_6_, int p_i46378_7_) + { + this.pos = p_i46378_1_; + this.finger = p_i46378_2_; + this.thumb = p_i46378_3_; + this.lcache = p_i46378_4_; + this.field_181120_e = p_i46378_5_; + this.field_181121_f = p_i46378_6_; + this.field_181122_g = p_i46378_7_; + } + + public BlockPos func_181117_a() + { + return this.pos; + } + + public EnumFacing getFinger() + { + return this.finger; + } + + public EnumFacing getThumb() + { + return this.thumb; + } + + public int func_181118_d() + { + return this.field_181120_e; + } + + public int func_181119_e() + { + return this.field_181121_f; + } + + public BlockWorldState translateOffset(int palmOffset, int thumbOffset, int fingerOffset) + { + return (BlockWorldState)this.lcache.getUnchecked(BlockPattern.translateOffset(this.pos, this.getFinger(), this.getThumb(), palmOffset, thumbOffset, fingerOffset)); + } + + public String toString() + { + return Objects.toStringHelper(this).add("up", this.thumb).add("forwards", this.finger).add("frontTopLeft", this.pos).toString(); + } + } +} diff --git a/src/minecraft/net/minecraft/block/state/pattern/BlockStateHelper.java b/src/minecraft/net/minecraft/block/state/pattern/BlockStateHelper.java new file mode 100644 index 0000000..6b5f8b8 --- /dev/null +++ b/src/minecraft/net/minecraft/block/state/pattern/BlockStateHelper.java @@ -0,0 +1,61 @@ +package net.minecraft.block.state.pattern; + +import com.google.common.base.Predicate; +import com.google.common.collect.Maps; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; + +public class BlockStateHelper implements Predicate +{ + private final BlockState blockstate; + private final Map propertyPredicates = Maps.newHashMap(); + + private BlockStateHelper(BlockState blockStateIn) + { + this.blockstate = blockStateIn; + } + + public static BlockStateHelper forBlock(Block blockIn) + { + return new BlockStateHelper(blockIn.getBlockState()); + } + + public boolean apply(IBlockState p_apply_1_) + { + if (p_apply_1_ != null && p_apply_1_.getBlock().equals(this.blockstate.getBlock())) + { + for (Entry entry : this.propertyPredicates.entrySet()) + { + Object object = p_apply_1_.getValue((IProperty)entry.getKey()); + + if (!((Predicate)entry.getValue()).apply(object)) + { + return false; + } + } + + return true; + } + else + { + return false; + } + } + + public > BlockStateHelper where(IProperty property, Predicate is) + { + if (!this.blockstate.getProperties().contains(property)) + { + throw new IllegalArgumentException(this.blockstate + " cannot support property " + property); + } + else + { + this.propertyPredicates.put(property, is); + return this; + } + } +} diff --git a/src/minecraft/net/minecraft/block/state/pattern/FactoryBlockPattern.java b/src/minecraft/net/minecraft/block/state/pattern/FactoryBlockPattern.java new file mode 100644 index 0000000..da4fe13 --- /dev/null +++ b/src/minecraft/net/minecraft/block/state/pattern/FactoryBlockPattern.java @@ -0,0 +1,123 @@ +package net.minecraft.block.state.pattern; + +import com.google.common.base.Joiner; +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.lang.reflect.Array; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.block.state.BlockWorldState; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.StringUtils; + +public class FactoryBlockPattern +{ + private static final Joiner COMMA_JOIN = Joiner.on(","); + private final List depth = Lists.newArrayList(); + private final Map> symbolMap = Maps.>newHashMap(); + private int aisleHeight; + private int rowWidth; + + private FactoryBlockPattern() + { + this.symbolMap.put(' ', Predicates.alwaysTrue()); + } + + public FactoryBlockPattern aisle(String... aisle) + { + if (!ArrayUtils.isEmpty((Object[])aisle) && !StringUtils.isEmpty(aisle[0])) + { + if (this.depth.isEmpty()) + { + this.aisleHeight = aisle.length; + this.rowWidth = aisle[0].length(); + } + + if (aisle.length != this.aisleHeight) + { + throw new IllegalArgumentException("Expected aisle with height of " + this.aisleHeight + ", but was given one with a height of " + aisle.length + ")"); + } + else + { + for (String s : aisle) + { + if (s.length() != this.rowWidth) + { + throw new IllegalArgumentException("Not all rows in the given aisle are the correct width (expected " + this.rowWidth + ", found one with " + s.length() + ")"); + } + + for (char c0 : s.toCharArray()) + { + if (!this.symbolMap.containsKey(Character.valueOf(c0))) + { + this.symbolMap.put(Character.valueOf(c0), (Predicate)null); + } + } + } + + this.depth.add(aisle); + return this; + } + } + else + { + throw new IllegalArgumentException("Empty pattern for aisle"); + } + } + + public static FactoryBlockPattern start() + { + return new FactoryBlockPattern(); + } + + public FactoryBlockPattern where(char symbol, Predicate blockMatcher) + { + this.symbolMap.put(Character.valueOf(symbol), blockMatcher); + return this; + } + + public BlockPattern build() + { + return new BlockPattern(this.makePredicateArray()); + } + + private Predicate[][][] makePredicateArray() + { + this.checkMissingPredicates(); + Predicate[][][] predicate = (Predicate[][][])((Predicate[][][])Array.newInstance(Predicate.class, new int[] {this.depth.size(), this.aisleHeight, this.rowWidth})); + + for (int i = 0; i < this.depth.size(); ++i) + { + for (int j = 0; j < this.aisleHeight; ++j) + { + for (int k = 0; k < this.rowWidth; ++k) + { + predicate[i][j][k] = (Predicate)this.symbolMap.get(Character.valueOf(((String[])this.depth.get(i))[j].charAt(k))); + } + } + } + + return predicate; + } + + private void checkMissingPredicates() + { + List list = Lists.newArrayList(); + + for (Entry> entry : this.symbolMap.entrySet()) + { + if (entry.getValue() == null) + { + list.add(entry.getKey()); + } + } + + if (!list.isEmpty()) + { + throw new IllegalStateException("Predicates for character(s) " + COMMA_JOIN.join(list) + " are missing"); + } + } +} diff --git a/src/minecraft/net/minecraft/client/AnvilConverterException.java b/src/minecraft/net/minecraft/client/AnvilConverterException.java new file mode 100644 index 0000000..13b7666 --- /dev/null +++ b/src/minecraft/net/minecraft/client/AnvilConverterException.java @@ -0,0 +1,9 @@ +package net.minecraft.client; + +public class AnvilConverterException extends Exception +{ + public AnvilConverterException(String exceptionMessage) + { + super(exceptionMessage); + } +} diff --git a/src/minecraft/net/minecraft/client/ClientBrandRetriever.java b/src/minecraft/net/minecraft/client/ClientBrandRetriever.java new file mode 100644 index 0000000..ea49cae --- /dev/null +++ b/src/minecraft/net/minecraft/client/ClientBrandRetriever.java @@ -0,0 +1,9 @@ +package net.minecraft.client; + +public class ClientBrandRetriever +{ + public static String getClientModName() + { + return "vanilla"; + } +} diff --git a/src/minecraft/net/minecraft/client/LoadingScreenRenderer.java b/src/minecraft/net/minecraft/client/LoadingScreenRenderer.java new file mode 100644 index 0000000..7fabf24 --- /dev/null +++ b/src/minecraft/net/minecraft/client/LoadingScreenRenderer.java @@ -0,0 +1,219 @@ +package net.minecraft.client; + +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.MinecraftError; + +public class LoadingScreenRenderer implements IProgressUpdate +{ + private String message = ""; + + /** A reference to the Minecraft object. */ + private Minecraft mc; + + /** + * The text currently displayed (i.e. the argument to the last call to printText or displayString) + */ + private String currentlyDisplayedText = ""; + + /** The system's time represented in milliseconds. */ + private long systemTime = Minecraft.getSystemTime(); + private boolean field_73724_e; + private ScaledResolution scaledResolution; + private Framebuffer framebuffer; + + public LoadingScreenRenderer(Minecraft mcIn) + { + this.mc = mcIn; + this.scaledResolution = new ScaledResolution(mcIn); + this.framebuffer = new Framebuffer(mcIn.displayWidth, mcIn.displayHeight, false); + this.framebuffer.setFramebufferFilter(9728); + } + + /** + * this string, followed by "working..." and then the "% complete" are the 3 lines shown. This resets progress to 0, + * and the WorkingString to "working...". + */ + public void resetProgressAndMessage(String message) + { + this.field_73724_e = false; + this.displayString(message); + } + + /** + * Shows the 'Saving level' string. + */ + public void displaySavingString(String message) + { + this.field_73724_e = true; + this.displayString(message); + } + + private void displayString(String message) + { + this.currentlyDisplayedText = message; + + if (!this.mc.running) + { + if (!this.field_73724_e) + { + throw new MinecraftError(); + } + } + else + { + GlStateManager.clear(256); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + + if (OpenGlHelper.isFramebufferEnabled()) + { + int i = this.scaledResolution.getScaleFactor(); + GlStateManager.ortho(0.0D, (double)(this.scaledResolution.getScaledWidth() * i), (double)(this.scaledResolution.getScaledHeight() * i), 0.0D, 100.0D, 300.0D); + } + else + { + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); + } + + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -200.0F); + } + } + + /** + * Displays a string on the loading screen supposed to indicate what is being done currently. + */ + public void displayLoadingString(String message) + { + if (!this.mc.running) + { + if (!this.field_73724_e) + { + throw new MinecraftError(); + } + } + else + { + this.systemTime = 0L; + this.message = message; + this.setLoadingProgress(-1); + this.systemTime = 0L; + } + } + + /** + * Updates the progress bar on the loading screen to the specified amount. Args: loadProgress + */ + public void setLoadingProgress(int progress) + { + if (!this.mc.running) + { + if (!this.field_73724_e) + { + throw new MinecraftError(); + } + } + else + { + long i = Minecraft.getSystemTime(); + + if (i - this.systemTime >= 100L) + { + this.systemTime = i; + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + int j = scaledresolution.getScaleFactor(); + int k = scaledresolution.getScaledWidth(); + int l = scaledresolution.getScaledHeight(); + + if (OpenGlHelper.isFramebufferEnabled()) + { + this.framebuffer.framebufferClear(); + } + else + { + GlStateManager.clear(256); + } + + this.framebuffer.bindFramebuffer(false); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -200.0F); + + if (!OpenGlHelper.isFramebufferEnabled()) + { + GlStateManager.clear(16640); + } + + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + float f = 32.0F; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos(0.0D, (double)l, 0.0D).tex(0.0D, (double)((float)l / f)).color(64, 64, 64, 255).endVertex(); + worldrenderer.pos((double)k, (double)l, 0.0D).tex((double)((float)k / f), (double)((float)l / f)).color(64, 64, 64, 255).endVertex(); + worldrenderer.pos((double)k, 0.0D, 0.0D).tex((double)((float)k / f), 0.0D).color(64, 64, 64, 255).endVertex(); + worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, 0.0D).color(64, 64, 64, 255).endVertex(); + tessellator.draw(); + + if (progress >= 0) + { + int i1 = 100; + int j1 = 2; + int k1 = k / 2 - i1 / 2; + int l1 = l / 2 + 16; + GlStateManager.disableTexture2D(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos((double)k1, (double)l1, 0.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)k1, (double)(l1 + j1), 0.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)(k1 + i1), (double)(l1 + j1), 0.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)(k1 + i1), (double)l1, 0.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)k1, (double)l1, 0.0D).color(128, 255, 128, 255).endVertex(); + worldrenderer.pos((double)k1, (double)(l1 + j1), 0.0D).color(128, 255, 128, 255).endVertex(); + worldrenderer.pos((double)(k1 + progress), (double)(l1 + j1), 0.0D).color(128, 255, 128, 255).endVertex(); + worldrenderer.pos((double)(k1 + progress), (double)l1, 0.0D).color(128, 255, 128, 255).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + } + + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((k - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(l / 2 - 4 - 16), 16777215); + this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((k - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(l / 2 - 4 + 8), 16777215); + this.framebuffer.unbindFramebuffer(); + + if (OpenGlHelper.isFramebufferEnabled()) + { + this.framebuffer.framebufferRender(k * j, l * j); + } + + this.mc.updateDisplay(); + + try + { + Thread.yield(); + } + catch (Exception var15) + { + ; + } + } + } + } + + public void setDoneWorking() + { + } +} diff --git a/src/minecraft/net/minecraft/client/Minecraft.java b/src/minecraft/net/minecraft/client/Minecraft.java new file mode 100644 index 0000000..9f02f65 --- /dev/null +++ b/src/minecraft/net/minecraft/client/Minecraft.java @@ -0,0 +1,3329 @@ +package net.minecraft.client; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.Proxy; +import java.net.SocketAddress; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Queue; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.Executors; +import java.util.concurrent.FutureTask; + +import javax.imageio.ImageIO; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.Validate; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.LWJGLException; +import org.lwjgl.Sys; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.ContextCapabilities; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL20; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.opengl.OpenGLException; +import org.lwjgl.opengl.PixelFormat; +import org.lwjgl.util.glu.GLU; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Queues; +import com.google.common.collect.Sets; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListenableFutureTask; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.properties.Property; +import com.mojang.authlib.properties.PropertyMap; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; + +import animeware.NightSky; +import animeware.event.impl.ClientTick; +import animeware.event.impl.WorldUnloadEvent; +import animeware.gui.mainmenu.MainMenu; +import animeware.gui.splash.SplashProgress; +import animeware.gui.splash.UiSplashScreen; +import animeware.hud.mod.Mods.MotionBlur; +import animeware.util.file.NightSkyAssets; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.audio.MusicTicker; +import net.minecraft.client.audio.SoundHandler; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiControls; +import net.minecraft.client.gui.GuiGameOver; +import net.minecraft.client.gui.GuiIngame; +import net.minecraft.client.gui.GuiIngameMenu; +import net.minecraft.client.gui.GuiMemoryErrorScreen; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiSleepMP; +import net.minecraft.client.gui.GuiYesNo; +import net.minecraft.client.gui.GuiYesNoCallback; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.achievement.GuiAchievement; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.client.gui.stream.GuiStreamUnavailable; +import net.minecraft.client.main.GameConfiguration; +import net.minecraft.client.multiplayer.GuiConnecting; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.network.NetHandlerLoginClient; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.particle.EffectRenderer; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.DefaultResourcePack; +import net.minecraft.client.resources.FoliageColorReloadListener; +import net.minecraft.client.resources.GrassColorReloadListener; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.resources.IReloadableResourceManager; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.client.resources.LanguageManager; +import net.minecraft.client.resources.ResourceIndex; +import net.minecraft.client.resources.ResourcePackRepository; +import net.minecraft.client.resources.SimpleReloadableResourceManager; +import net.minecraft.client.resources.SkinManager; +import net.minecraft.client.resources.data.AnimationMetadataSection; +import net.minecraft.client.resources.data.AnimationMetadataSectionSerializer; +import net.minecraft.client.resources.data.FontMetadataSection; +import net.minecraft.client.resources.data.FontMetadataSectionSerializer; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.client.resources.data.LanguageMetadataSection; +import net.minecraft.client.resources.data.LanguageMetadataSectionSerializer; +import net.minecraft.client.resources.data.PackMetadataSection; +import net.minecraft.client.resources.data.PackMetadataSectionSerializer; +import net.minecraft.client.resources.data.TextureMetadataSection; +import net.minecraft.client.resources.data.TextureMetadataSectionSerializer; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.client.stream.IStream; +import net.minecraft.client.stream.NullStream; +import net.minecraft.client.stream.TwitchStream; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLeashKnot; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.boss.BossStatus; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityPainting; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Bootstrap; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.network.EnumConnectionState; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.network.login.client.C00PacketLoginStart; +import net.minecraft.network.play.client.C16PacketClientStatus; +import net.minecraft.profiler.IPlayerUsage; +import net.minecraft.profiler.PlayerUsageSnooper; +import net.minecraft.profiler.Profiler; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.integrated.IntegratedServer; +import net.minecraft.stats.AchievementList; +import net.minecraft.stats.IStatStringFormat; +import net.minecraft.stats.StatFileWriter; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.FrameTimer; +import net.minecraft.util.IThreadListener; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MinecraftError; +import net.minecraft.util.MouseHelper; +import net.minecraft.util.MovementInputFromOptions; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.ScreenShotHelper; +import net.minecraft.util.Session; +import net.minecraft.util.Timer; +import net.minecraft.util.Util; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.WorldProviderEnd; +import net.minecraft.world.WorldProviderHell; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.chunk.storage.AnvilSaveConverter; +import net.minecraft.world.storage.ISaveFormat; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; + +public class Minecraft implements IThreadListener, IPlayerUsage +{ + private static final Logger logger = LogManager.getLogger(); + private static final ResourceLocation locationMojangPng = new ResourceLocation("textures/gui/title/mojang.png"); + public static final boolean isRunningOnMac = Util.getOSType() == Util.EnumOS.OSX; + + /** A 10MiB preallocation to ensure the heap is reasonably sized. */ + public static byte[] memoryReserve = new byte[10485760]; + private static final List macDisplayModes = Lists.newArrayList(new DisplayMode[] {new DisplayMode(2560, 1600), new DisplayMode(2880, 1800)}); + private final File fileResourcepacks; + private final PropertyMap twitchDetails; + private final PropertyMap field_181038_N; + private ServerData currentServerData; + + /** The RenderEngine instance used by Minecraft */ + private TextureManager renderEngine; + + /** + * Set to 'this' in Minecraft constructor; used by some settings get methods + */ + private static Minecraft theMinecraft; + public PlayerControllerMP playerController; + private boolean fullscreen; + private boolean enableGLErrorChecking = true; + private boolean hasCrashed; + + /** Instance of CrashReport. */ + private CrashReport crashReporter; + public int displayWidth; + public int displayHeight; + private boolean field_181541_X = false; + public Timer timer = new Timer(20.0F); + + /** Instance of PlayerUsageSnooper. */ + private PlayerUsageSnooper usageSnooper = new PlayerUsageSnooper("client", this, MinecraftServer.getCurrentTimeMillis()); + public WorldClient theWorld; + public RenderGlobal renderGlobal; + private RenderManager renderManager; + private RenderItem renderItem; + private ItemRenderer itemRenderer; + public static EntityPlayerSP thePlayer; + private Entity renderViewEntity; + public Entity pointedEntity; + public EffectRenderer effectRenderer; + public Session session; + private boolean isGamePaused; + + /** The font renderer used for displaying and measuring text */ + public FontRenderer fontRendererObj; + public FontRenderer standardGalacticFontRenderer; + + /** The GuiScreen that's being displayed at the moment. */ + public GuiScreen currentScreen; + public LoadingScreenRenderer loadingScreen; + public EntityRenderer entityRenderer; + + /** Mouse left click counter */ + private int leftClickCounter; + + /** Display width */ + private int tempDisplayWidth; + + /** Display height */ + private int tempDisplayHeight; + + /** Instance of IntegratedServer. */ + private IntegratedServer theIntegratedServer; + + /** Gui achievement */ + public GuiAchievement guiAchievement; + public GuiIngame ingameGUI; + + /** Skip render world */ + public boolean skipRenderWorld; + + /** The ray trace hit that the mouse is over. */ + public MovingObjectPosition objectMouseOver; + + /** The game settings that currently hold effect. */ + public GameSettings gameSettings; + + /** Mouse helper instance. */ + public MouseHelper mouseHelper; + public final File mcDataDir; + private final File fileAssets; + private final String launchedVersion; + private final Proxy proxy; + private ISaveFormat saveLoader; + + /** + * This is set to fpsCounter every debug screen update, and is shown on the debug screen. It's also sent as part of + * the usage snooping. + */ + private static int debugFPS; + + private static int debugBPS; + + /** + * When you place a block, it's set to 6, decremented once per tick, when it's 0, you can place another block. + */ + private int rightClickDelayTimer; + private String serverName; + private int serverPort; + + /** + * Does the actual gameplay have focus. If so then mouse and keys will effect the player instead of menus. + */ + public boolean inGameHasFocus; + long systemTime = getSystemTime(); + + /** Join player counter */ + private int joinPlayerCounter; + public final FrameTimer field_181542_y = new FrameTimer(); + long field_181543_z = System.nanoTime(); + private final boolean jvm64bit; + private final boolean isDemo; + private NetworkManager myNetworkManager; + private boolean integratedServerIsRunning; + + /** The profiler instance */ + public final Profiler mcProfiler = new Profiler(); + + /** + * Keeps track of how long the debug crash keycombo (F3+C) has been pressed for, in order to crash after 10 seconds. + */ + private long debugCrashKeyPressTime = -1L; + private IReloadableResourceManager mcResourceManager; + private final IMetadataSerializer metadataSerializer_ = new IMetadataSerializer(); + private final List defaultResourcePacks = Lists.newArrayList(); + private final DefaultResourcePack mcDefaultResourcePack; + //public final AnimewareResourcePack mcAnimewareResourcePack; + private ResourcePackRepository mcResourcePackRepository; + private LanguageManager mcLanguageManager; + private IStream stream; + private Framebuffer framebufferMc; + private TextureMap textureMapBlocks; + private SoundHandler mcSoundHandler; + private MusicTicker mcMusicTicker; + private ResourceLocation mojangLogo; + private final MinecraftSessionService sessionService; + private SkinManager skinManager; + private final Queue < FutureTask> scheduledTasks = Queues. < FutureTask> newArrayDeque(); + private long field_175615_aJ = 0L; + private final Thread mcThread = Thread.currentThread(); + private ModelManager modelManager; + + /** + * The BlockRenderDispatcher instance that will be used based off gamesettings + */ + private BlockRendererDispatcher blockRenderDispatcher; + + /** + * Set to true to keep the game loop running. Set to false by shutdown() to allow the game loop to exit cleanly. + */ + volatile boolean running = true; + + /** String that shows the debug information */ + public String debug = ""; + public boolean field_175613_B = false; + public boolean field_175614_C = false; + public boolean field_175611_D = false; + public boolean renderChunksMany = true; + + /** Approximate time (in ms) of last update to debug string */ + long debugUpdateTime = getSystemTime(); + + /** holds the current fps */ + int fpsCounter; + int bpsCounter; + long prevFrameTime = -1L; + + /** Profiler currently displayed in the debug screen pie chart */ + private String debugProfilerName = "root"; + + public Minecraft(GameConfiguration gameConfig) + { + theMinecraft = this; + this.mcDataDir = gameConfig.folderInfo.mcDataDir; + this.fileAssets = gameConfig.folderInfo.assetsDir; + this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir; + this.launchedVersion = gameConfig.gameInfo.version; + this.twitchDetails = gameConfig.userInfo.userProperties; + this.field_181038_N = gameConfig.userInfo.field_181172_c; + this.mcDefaultResourcePack = new DefaultResourcePack((new ResourceIndex(gameConfig.folderInfo.assetsDir, gameConfig.folderInfo.assetIndex)).getResourceMap()); + //this.mcAnimewareResourcePack = new AnimewareResourcePack((new ResourceIndex(gameConfig.folderInfo.assetsDir, gameConfig.folderInfo.assetIndex)).getResourceMap());; + this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy; + this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService(); + this.session = gameConfig.userInfo.session; + logger.info("Setting user: " + this.session.getUsername()); + logger.info("(Session ID is " + this.session.getSessionID() + ")"); + this.isDemo = gameConfig.gameInfo.isDemo; + this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1; + this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1; + this.tempDisplayWidth = gameConfig.displayInfo.width; + this.tempDisplayHeight = gameConfig.displayInfo.height; + this.fullscreen = gameConfig.displayInfo.fullscreen; + this.jvm64bit = isJvm64bit(); + this.theIntegratedServer = new IntegratedServer(this); + + if (gameConfig.serverInfo.serverName != null) + { + this.serverName = gameConfig.serverInfo.serverName; + this.serverPort = gameConfig.serverInfo.serverPort; + } + + + ImageIO.setUseCache(false); + Bootstrap.register(); + } + + public void run() + { + this.running = true; + + try + { + this.startGame(); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Initializing game"); + crashreport.makeCategory("Initialization"); + this.displayCrashReport(this.addGraphicsAndWorldToCrashReport(crashreport)); + return; + } + + while (true) + { + try + { + while (this.running) + { + if (!this.hasCrashed || this.crashReporter == null) + { + try + { + this.runGameLoop(); + } + catch (OutOfMemoryError var10) + { + this.freeMemory(); + this.displayGuiScreen(new GuiMemoryErrorScreen()); + System.gc(); + } + } + else + { + this.displayCrashReport(this.crashReporter); + } + } + } + catch (MinecraftError var12) + { + break; + } + catch (ReportedException reportedexception) + { + this.addGraphicsAndWorldToCrashReport(reportedexception.getCrashReport()); + this.freeMemory(); + logger.fatal((String)"Reported exception thrown!", (Throwable)reportedexception); + this.displayCrashReport(reportedexception.getCrashReport()); + break; + } + catch (Throwable throwable1) + { + CrashReport crashreport1 = this.addGraphicsAndWorldToCrashReport(new CrashReport("Unexpected error", throwable1)); + this.freeMemory(); + logger.fatal("Unreported exception thrown!", throwable1); + this.displayCrashReport(crashreport1); + break; + } + finally + { + this.shutdownMinecraftApplet(); + } + + return; + } + } + + /** + * Starts the game: initializes the canvas, the title, the settings, etcetera. + */ + private void startGame() throws LWJGLException, IOException + { + //Animeware.INSTANCE.startup(); + this.gameSettings = new GameSettings(this, this.mcDataDir); + this.defaultResourcePacks.add(this.mcDefaultResourcePack); + this.startTimerHackThread(); + + if (this.gameSettings.overrideHeight > 0 && this.gameSettings.overrideWidth > 0) + { + this.displayWidth = this.gameSettings.overrideWidth; + this.displayHeight = this.gameSettings.overrideHeight; + } + + logger.info("LWJGL Version: " + Sys.getVersion()); + this.setWindowIcon(); + this.setInitialDisplayMode(); + this.createDisplay(); + OpenGlHelper.initializeTextures(); + this.framebufferMc = new Framebuffer(this.displayWidth, this.displayHeight, true); + this.framebufferMc.setFramebufferColor(0.0F, 0.0F, 0.0F, 0.0F); + this.registerMetadataSerializers(); + this.mcResourcePackRepository = new ResourcePackRepository(this.fileResourcepacks, new File(this.mcDataDir, "server-resource-packs"), this.mcDefaultResourcePack, this.metadataSerializer_, this.gameSettings); + this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); + this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); + this.mcResourceManager.registerReloadListener(this.mcLanguageManager); + this.refreshResources(); + this.renderEngine = new TextureManager(this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.renderEngine); + //this.drawSplashScreen(this.renderEngine); + SplashProgress.drawSplash(getTextureManager()); + //UiSplashScreen.renderSplashScreen(); + this.initStream(); + this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService); + this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); + this.mcSoundHandler = new SoundHandler(this.mcResourceManager, this.gameSettings); + this.mcResourceManager.registerReloadListener(this.mcSoundHandler); + this.mcMusicTicker = new MusicTicker(this); + this.fontRendererObj = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii.png"), this.renderEngine, false); + + if (this.gameSettings.language != null) + { + this.fontRendererObj.setUnicodeFlag(this.isUnicode()); + this.fontRendererObj.setBidiFlag(this.mcLanguageManager.isCurrentLanguageBidirectional()); + } + + this.standardGalacticFontRenderer = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii_sga.png"), this.renderEngine, false); + this.mcResourceManager.registerReloadListener(this.fontRendererObj); + this.mcResourceManager.registerReloadListener(this.standardGalacticFontRenderer); + this.mcResourceManager.registerReloadListener(new GrassColorReloadListener()); + this.mcResourceManager.registerReloadListener(new FoliageColorReloadListener()); + AchievementList.openInventory.setStatStringFormatter(new IStatStringFormat() + { + public String formatString(String p_74535_1_) + { + try + { + return String.format(p_74535_1_, new Object[] {GameSettings.getKeyDisplayString(Minecraft.this.gameSettings.keyBindInventory.getKeyCode())}); + } + catch (Exception exception) + { + return "Error: " + exception.getLocalizedMessage(); + } + } + }); + this.mouseHelper = new MouseHelper(); + this.checkGLError("Pre startup"); + GlStateManager.enableTexture2D(); + GlStateManager.shadeModel(7425); + GlStateManager.clearDepth(1.0D); + GlStateManager.enableDepth(); + GlStateManager.depthFunc(515); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.cullFace(1029); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + this.checkGLError("Startup"); + this.textureMapBlocks = new TextureMap("textures"); + SplashProgress.setProgress(1, "TextureMap"); + this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels); + this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks); + this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); + this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0); + this.modelManager = new ModelManager(this.textureMapBlocks); + SplashProgress.setProgress(2, "ModelManager"); + this.mcResourceManager.registerReloadListener(this.modelManager); + this.renderItem = new RenderItem(this.renderEngine, this.modelManager); + this.renderManager = new RenderManager(this.renderEngine, this.renderItem); + SplashProgress.setProgress(3, "RenderManager"); + this.itemRenderer = new ItemRenderer(this); + SplashProgress.setProgress(4, "ItemRenderer"); + this.mcResourceManager.registerReloadListener(this.renderItem); + this.entityRenderer = new EntityRenderer(this, this.mcResourceManager); + SplashProgress.setProgress(5, "EntityRenderer"); + this.mcResourceManager.registerReloadListener(this.entityRenderer); + SplashProgress.setProgress(6, "ModConfig"); + this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings); + this.mcResourceManager.registerReloadListener(this.blockRenderDispatcher); + this.renderGlobal = new RenderGlobal(this); + SplashProgress.setProgress(7, "Mods"); + this.mcResourceManager.registerReloadListener(this.renderGlobal); + this.guiAchievement = new GuiAchievement(this); + SplashProgress.setProgress(8, "Cosmetics"); + GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight); + this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); + this.checkGLError("Post startup"); + this.ingameGUI = new GuiIngame(this); + + NightSky.INSTANCE.startup(); + + if (this.serverName != null) + { + this.displayGuiScreen(new GuiConnecting(new MainMenu(), this, this.serverName, this.serverPort)); + } + else + { + this.displayGuiScreen(new MainMenu()); + } + + this.renderEngine.deleteTexture(this.mojangLogo); + this.mojangLogo = null; + this.loadingScreen = new LoadingScreenRenderer(this); + + if (this.gameSettings.fullScreen && !this.fullscreen) + { + this.toggleFullscreen(); + } + + try + { + Display.setVSyncEnabled(this.gameSettings.enableVsync); + } + catch (OpenGLException var2) + { + this.gameSettings.enableVsync = false; + this.gameSettings.saveOptions(); + } + + this.renderGlobal.makeEntityOutlineShader(); + } + + private void registerMetadataSerializers() + { + this.metadataSerializer_.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class); + this.metadataSerializer_.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class); + this.metadataSerializer_.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class); + this.metadataSerializer_.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class); + this.metadataSerializer_.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class); + } + + private void initStream() + { + try + { + this.stream = new TwitchStream(this, (Property)Iterables.getFirst(this.twitchDetails.get("twitch_access_token"), null)); + } + catch (Throwable throwable) + { + this.stream = new NullStream(throwable); + logger.error("Couldn\'t initialize twitch stream"); + } + } + + private void createDisplay() throws LWJGLException + { + Display.setResizable(true); + Display.setTitle("Starting..."); + + try + { + Display.create((new PixelFormat()).withDepthBits(24)); + } + catch (LWJGLException lwjglexception) + { + logger.error((String)"Couldn\'t set pixel format", (Throwable)lwjglexception); + + try + { + Thread.sleep(1000L); + } + catch (InterruptedException var3) + { + ; + } + + if (this.fullscreen) + { + this.updateDisplayMode(); + } + + Display.create(); + } + } + + private void setInitialDisplayMode() throws LWJGLException + { + if (this.fullscreen) + { + Display.setFullscreen(true); + DisplayMode displaymode = Display.getDisplayMode(); + this.displayWidth = Math.max(1, displaymode.getWidth()); + this.displayHeight = Math.max(1, displaymode.getHeight()); + } + else + { + Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight)); + } + } + + private void setWindowIcon() + { + Util.EnumOS util$enumos = Util.getOSType(); + + if (util$enumos != Util.EnumOS.OSX) + { + InputStream inputstream = null; + InputStream inputstream1 = null; + + try + { + inputstream = this.mcDefaultResourcePack.getInputStream(new ResourceLocation(NightSkyAssets.getNightSkyAssets() + "/icon16.png")); + inputstream1 = this.mcDefaultResourcePack.getInputStream(new ResourceLocation(NightSkyAssets.getNightSkyAssets() + "/icon32.png")); + + if (inputstream != null && inputstream1 != null) + { + Display.setIcon(new ByteBuffer[] {this.readImageToBuffer(inputstream), this.readImageToBuffer(inputstream1)}); + } + } + catch (IOException ioexception) + { + logger.error((String)"Couldn\'t set icon", (Throwable)ioexception); + } + finally + { + IOUtils.closeQuietly(inputstream); + IOUtils.closeQuietly(inputstream1); + } + } + } + + private static boolean isJvm64bit() + { + String[] astring = new String[] {"sun.arch.data.model", "com.ibm.vm.bitmode", "os.arch"}; + + for (String s : astring) + { + String s1 = System.getProperty(s); + + if (s1 != null && s1.contains("64")) + { + return true; + } + } + + return false; + } + + public Framebuffer getFramebuffer() + { + return this.framebufferMc; + } + + public String getVersion() + { + return this.launchedVersion; + } + + private void startTimerHackThread() + { + Thread thread = new Thread("Timer hack thread") + { + public void run() + { + while (Minecraft.this.running) + { + try + { + Thread.sleep(2147483647L); + } + catch (InterruptedException var2) + { + ; + } + } + } + }; + thread.setDaemon(true); + thread.start(); + } + + public void crashed(CrashReport crash) + { + this.hasCrashed = true; + this.crashReporter = crash; + } + + /** + * Wrapper around displayCrashReportInternal + */ + public void displayCrashReport(CrashReport crashReportIn) + { + File file1 = new File(getMinecraft().mcDataDir, "crash-reports"); + File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); + Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport()); + + if (crashReportIn.getFile() != null) + { + Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReportIn.getFile()); + System.exit(-1); + } + else if (crashReportIn.saveToFile(file2)) + { + Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath()); + System.exit(-1); + } + else + { + Bootstrap.printToSYSOUT("#@?@# Game crashed! Crash report could not be saved. #@?@#"); + System.exit(-2); + } + } + + public boolean isUnicode() + { + return this.mcLanguageManager.isCurrentLocaleUnicode() || this.gameSettings.forceUnicodeFont; + } + + public void refreshResources() + { + List list = Lists.newArrayList(this.defaultResourcePacks); + + for (ResourcePackRepository.Entry resourcepackrepository$entry : this.mcResourcePackRepository.getRepositoryEntries()) + { + list.add(resourcepackrepository$entry.getResourcePack()); + } + + if (this.mcResourcePackRepository.getResourcePackInstance() != null) + { + list.add(this.mcResourcePackRepository.getResourcePackInstance()); + } + + try + { + this.mcResourceManager.reloadResources(list); + } + catch (RuntimeException runtimeexception) + { + logger.info((String)"Caught error stitching, removing all assigned resourcepacks", (Throwable)runtimeexception); + list.clear(); + list.addAll(this.defaultResourcePacks); + this.mcResourcePackRepository.setRepositories(Collections.emptyList()); + this.mcResourceManager.reloadResources(list); + this.gameSettings.resourcePacks.clear(); + this.gameSettings.field_183018_l.clear(); + this.gameSettings.saveOptions(); + } + + this.mcLanguageManager.parseLanguageMetadata(list); + + if (this.renderGlobal != null) + { + this.renderGlobal.loadRenderers(); + } + } + + private ByteBuffer readImageToBuffer(InputStream imageStream) throws IOException + { + BufferedImage bufferedimage = ImageIO.read(imageStream); + int[] aint = bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), (int[])null, 0, bufferedimage.getWidth()); + ByteBuffer bytebuffer = ByteBuffer.allocate(4 * aint.length); + + for (int i : aint) + { + bytebuffer.putInt(i << 8 | i >> 24 & 255); + } + + bytebuffer.flip(); + return bytebuffer; + } + + private void updateDisplayMode() throws LWJGLException + { + Set set = Sets.newHashSet(); + Collections.addAll(set, Display.getAvailableDisplayModes()); + DisplayMode displaymode = Display.getDesktopDisplayMode(); + + if (!set.contains(displaymode) && Util.getOSType() == Util.EnumOS.OSX) + { + label53: + + for (DisplayMode displaymode1 : macDisplayModes) + { + boolean flag = true; + + for (DisplayMode displaymode2 : set) + { + if (displaymode2.getBitsPerPixel() == 32 && displaymode2.getWidth() == displaymode1.getWidth() && displaymode2.getHeight() == displaymode1.getHeight()) + { + flag = false; + break; + } + } + + if (!flag) + { + Iterator iterator = set.iterator(); + DisplayMode displaymode3; + + while (true) + { + if (!iterator.hasNext()) + { + continue label53; + } + + displaymode3 = (DisplayMode)iterator.next(); + + if (displaymode3.getBitsPerPixel() == 32 && displaymode3.getWidth() == displaymode1.getWidth() / 2 && displaymode3.getHeight() == displaymode1.getHeight() / 2) + { + break; + } + } + + displaymode = displaymode3; + } + } + } + + Display.setDisplayMode(displaymode); + this.displayWidth = displaymode.getWidth(); + this.displayHeight = displaymode.getHeight(); + } + + private void drawSplashScreen(TextureManager textureManagerInstance) throws LWJGLException + { + ScaledResolution scaledresolution = new ScaledResolution(this); + int i = scaledresolution.getScaleFactor(); + Framebuffer framebuffer = new Framebuffer(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i, true); + framebuffer.bindFramebuffer(false); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, (double)scaledresolution.getScaledWidth(), (double)scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + GlStateManager.disableDepth(); + GlStateManager.enableTexture2D(); + InputStream inputstream = null; + + try + { + inputstream = this.mcDefaultResourcePack.getInputStream(locationMojangPng); + this.mojangLogo = textureManagerInstance.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(inputstream))); + textureManagerInstance.bindTexture(this.mojangLogo); + } + catch (IOException ioexception) + { + logger.error((String)("Unable to load logo: " + locationMojangPng), (Throwable)ioexception); + } + finally + { + IOUtils.closeQuietly(inputstream); + } + + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos(0.0D, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex(); + worldrenderer.pos((double)this.displayWidth, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex(); + worldrenderer.pos((double)this.displayWidth, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex(); + worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex(); + tessellator.draw(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + int j = 256; + int k = 256; + this.func_181536_a((scaledresolution.getScaledWidth() - j) / 2, (scaledresolution.getScaledHeight() - k) / 2, 0, 0, j, k, 255, 255, 255, 255); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + framebuffer.unbindFramebuffer(); + framebuffer.framebufferRender(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + this.updateDisplay(); + } + + public void func_181536_a(int p_181536_1_, int p_181536_2_, int p_181536_3_, int p_181536_4_, int p_181536_5_, int p_181536_6_, int p_181536_7_, int p_181536_8_, int p_181536_9_, int p_181536_10_) + { + float f = 0.00390625F; + float f1 = 0.00390625F; + WorldRenderer worldrenderer = Tessellator.getInstance().getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)p_181536_1_, (double)(p_181536_2_ + p_181536_6_), 0.0D).tex((double)((float)p_181536_3_ * f), (double)((float)(p_181536_4_ + p_181536_6_) * f1)).color(p_181536_7_, p_181536_8_, p_181536_9_, p_181536_10_).endVertex(); + worldrenderer.pos((double)(p_181536_1_ + p_181536_5_), (double)(p_181536_2_ + p_181536_6_), 0.0D).tex((double)((float)(p_181536_3_ + p_181536_5_) * f), (double)((float)(p_181536_4_ + p_181536_6_) * f1)).color(p_181536_7_, p_181536_8_, p_181536_9_, p_181536_10_).endVertex(); + worldrenderer.pos((double)(p_181536_1_ + p_181536_5_), (double)p_181536_2_, 0.0D).tex((double)((float)(p_181536_3_ + p_181536_5_) * f), (double)((float)p_181536_4_ * f1)).color(p_181536_7_, p_181536_8_, p_181536_9_, p_181536_10_).endVertex(); + worldrenderer.pos((double)p_181536_1_, (double)p_181536_2_, 0.0D).tex((double)((float)p_181536_3_ * f), (double)((float)p_181536_4_ * f1)).color(p_181536_7_, p_181536_8_, p_181536_9_, p_181536_10_).endVertex(); + Tessellator.getInstance().draw(); + } + + /** + * Returns the save loader that is currently being used + */ + public ISaveFormat getSaveLoader() + { + return this.saveLoader; + } + + /** + * Sets the argument GuiScreen as the main (topmost visible) screen. + */ + public void displayGuiScreen(GuiScreen guiScreenIn) + { + if (this.currentScreen != null) + { + this.currentScreen.onGuiClosed(); + } + + if (guiScreenIn == null && this.theWorld == null) + { + guiScreenIn = new MainMenu(); + } + else if (guiScreenIn == null && this.thePlayer.getHealth() <= 0.0F) + { + guiScreenIn = new GuiGameOver(); + } + + if (guiScreenIn instanceof MainMenu) + { + this.gameSettings.showDebugInfo = false; + this.ingameGUI.getChatGUI().clearChatMessages(); + } + + this.currentScreen = (GuiScreen)guiScreenIn; + + if (guiScreenIn != null) + { + this.setIngameNotInFocus(); + ScaledResolution scaledresolution = new ScaledResolution(this); + int i = scaledresolution.getScaledWidth(); + int j = scaledresolution.getScaledHeight(); + ((GuiScreen)guiScreenIn).setWorldAndResolution(this, i, j); + this.skipRenderWorld = false; + } + else + { + this.mcSoundHandler.resumeSounds(); + this.setIngameFocus(); + } + } + + /** + * Checks for an OpenGL error. If there is one, prints the error ID and error string. + */ + private void checkGLError(String message) + { + if (this.enableGLErrorChecking) + { + int i = GL11.glGetError(); + + if (i != 0) + { + String s = GLU.gluErrorString(i); + logger.error("########## GL ERROR ##########"); + logger.error("@ " + message); + logger.error(i + ": " + s); + } + } + } + + /** + * Shuts down the minecraft applet by stopping the resource downloads, and clearing up GL stuff; called when the + * application (or web page) is exited. + */ + public void shutdownMinecraftApplet() + { + try + { + + NightSky.INSTANCE.shutdown(); + + this.stream.shutdownStream(); + logger.info("Stopping!"); + + try + { + this.loadWorld((WorldClient)null); + } + catch (Throwable var5) + { + ; + } + + this.mcSoundHandler.unloadSounds(); + } + finally + { + Display.destroy(); + + if (!this.hasCrashed) + { + System.exit(0); + } + } + + System.gc(); + } + + /** + * Called repeatedly from run() + */ + private void runGameLoop() throws IOException + { + MotionBlur.createAccumulation(); + long i = System.nanoTime(); + this.mcProfiler.startSection("root"); + + if (Display.isCreated() && Display.isCloseRequested()) + { + this.shutdown(); + } + + if (this.isGamePaused && this.theWorld != null) + { + float f = this.timer.renderPartialTicks; + this.timer.updateTimer(); + this.timer.renderPartialTicks = f; + } + else + { + this.timer.updateTimer(); + } + + this.mcProfiler.startSection("scheduledExecutables"); + + synchronized (this.scheduledTasks) + { + while (!this.scheduledTasks.isEmpty()) + { + Util.func_181617_a((FutureTask)this.scheduledTasks.poll(), logger); + } + } + + this.mcProfiler.endSection(); + long l = System.nanoTime(); + this.mcProfiler.startSection("tick"); + + for (int j = 0; j < this.timer.elapsedTicks; ++j) + { + this.runTick(); + } + + this.mcProfiler.endStartSection("preRenderErrors"); + long i1 = System.nanoTime() - l; + this.checkGLError("Pre render"); + this.mcProfiler.endStartSection("sound"); + this.mcSoundHandler.setListener(this.thePlayer, this.timer.renderPartialTicks); + this.mcProfiler.endSection(); + this.mcProfiler.startSection("render"); + GlStateManager.pushMatrix(); + GlStateManager.clear(16640); + this.framebufferMc.bindFramebuffer(true); + this.mcProfiler.startSection("display"); + GlStateManager.enableTexture2D(); + + if (this.thePlayer != null && this.thePlayer.isEntityInsideOpaqueBlock()) + { + this.gameSettings.thirdPersonView = 0; + } + + this.mcProfiler.endSection(); + + if (!this.skipRenderWorld) + { + this.mcProfiler.endStartSection("gameRenderer"); + this.entityRenderer.func_181560_a(this.timer.renderPartialTicks, i); + this.mcProfiler.endSection(); + } + + this.mcProfiler.endSection(); + + if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart && !this.gameSettings.hideGUI) + { + if (!this.mcProfiler.profilingEnabled) + { + this.mcProfiler.clearProfiling(); + } + + this.mcProfiler.profilingEnabled = true; + this.displayDebugInfo(i1); + } + else + { + this.mcProfiler.profilingEnabled = false; + this.prevFrameTime = System.nanoTime(); + } + + this.guiAchievement.updateAchievementWindow(); + this.framebufferMc.unbindFramebuffer(); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + this.framebufferMc.framebufferRender(this.displayWidth, this.displayHeight); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + this.entityRenderer.renderStreamIndicator(this.timer.renderPartialTicks); + GlStateManager.popMatrix(); + this.mcProfiler.startSection("root"); + this.updateDisplay(); + Thread.yield(); + this.mcProfiler.startSection("stream"); + this.mcProfiler.startSection("update"); + this.stream.func_152935_j(); + this.mcProfiler.endStartSection("submit"); + this.stream.func_152922_k(); + this.mcProfiler.endSection(); + this.mcProfiler.endSection(); + this.checkGLError("Post render"); + ++this.fpsCounter; + this.isGamePaused = this.isSingleplayer() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame() && !this.theIntegratedServer.getPublic(); + long k = System.nanoTime(); + this.field_181542_y.func_181747_a(k - this.field_181543_z); + this.field_181543_z = k; + + while (getSystemTime() >= this.debugUpdateTime + 1000L) + { + debugFPS = this.fpsCounter; + this.debug = String.format("%d fps (%d chunk update%s) T: %s%s%s%s%s", new Object[] {Integer.valueOf(debugFPS), Integer.valueOf(RenderChunk.renderChunksUpdated), RenderChunk.renderChunksUpdated != 1 ? "s" : "", (float)this.gameSettings.limitFramerate == GameSettings.Options.FRAMERATE_LIMIT.getValueMax() ? "inf" : Integer.valueOf(this.gameSettings.limitFramerate), this.gameSettings.enableVsync ? " vsync" : "", this.gameSettings.fancyGraphics ? "" : " fast", this.gameSettings.clouds == 0 ? "" : (this.gameSettings.clouds == 1 ? " fast-clouds" : " fancy-clouds"), OpenGlHelper.useVbo() ? " vbo" : ""}); + RenderChunk.renderChunksUpdated = 0; + this.debugUpdateTime += 1000L; + this.fpsCounter = 0; + this.usageSnooper.addMemoryStatsToSnooper(); + + debugBPS = this.fpsCounter; + this.debug = String.format("%d fps (%d chunk update%s) T: %s%s%s%s%s", new Object[] {Integer.valueOf(debugFPS), Integer.valueOf(RenderChunk.renderChunksUpdated), RenderChunk.renderChunksUpdated != 1 ? "s" : "", (float)this.gameSettings.limitFramerate == GameSettings.Options.FRAMERATE_LIMIT.getValueMax() ? "inf" : Integer.valueOf(this.gameSettings.limitFramerate), this.gameSettings.enableVsync ? " vsync" : "", this.gameSettings.fancyGraphics ? "" : " fast", this.gameSettings.clouds == 0 ? "" : (this.gameSettings.clouds == 1 ? " fast-clouds" : " fancy-clouds"), OpenGlHelper.useVbo() ? " vbo" : ""}); + RenderChunk.renderChunksUpdated = 0; + this.debugUpdateTime += 1000L; + this.fpsCounter = 0; + this.usageSnooper.addMemoryStatsToSnooper(); + + if (!this.usageSnooper.isSnooperRunning()) + { + this.usageSnooper.startSnooper(); + } + } + + if (this.isFramerateLimitBelowMax()) + { + this.mcProfiler.startSection("fpslimit_wait"); + Display.sync(this.getLimitFramerate()); + this.mcProfiler.endSection(); + } + + this.mcProfiler.endSection(); + } + + public void updateDisplay() + { + this.mcProfiler.startSection("display_update"); + Display.update(); + this.mcProfiler.endSection(); + this.checkWindowResize(); + } + + protected void checkWindowResize() + { + if (!this.fullscreen && Display.wasResized()) + { + int i = this.displayWidth; + int j = this.displayHeight; + this.displayWidth = Display.getWidth(); + this.displayHeight = Display.getHeight(); + + if (this.displayWidth != i || this.displayHeight != j) + { + if (this.displayWidth <= 0) + { + this.displayWidth = 1; + } + + if (this.displayHeight <= 0) + { + this.displayHeight = 1; + } + + this.resize(this.displayWidth, this.displayHeight); + } + } + } + + public int getLimitFramerate() + { + return this.theWorld == null && this.currentScreen != null ? 30 : this.gameSettings.limitFramerate; + } + + public boolean isFramerateLimitBelowMax() + { + return (float)this.getLimitFramerate() < GameSettings.Options.FRAMERATE_LIMIT.getValueMax(); + } + + public void freeMemory() + { + try + { + memoryReserve = new byte[0]; + this.renderGlobal.deleteAllDisplayLists(); + } + catch (Throwable var3) + { + ; + } + + try + { + System.gc(); + this.loadWorld((WorldClient)null); + } + catch (Throwable var2) + { + ; + } + + System.gc(); + } + + /** + * Update debugProfilerName in response to number keys in debug screen + */ + private void updateDebugProfilerName(int keyCount) + { + List list = this.mcProfiler.getProfilingData(this.debugProfilerName); + + if (list != null && !list.isEmpty()) + { + Profiler.Result profiler$result = (Profiler.Result)list.remove(0); + + if (keyCount == 0) + { + if (profiler$result.field_76331_c.length() > 0) + { + int i = this.debugProfilerName.lastIndexOf("."); + + if (i >= 0) + { + this.debugProfilerName = this.debugProfilerName.substring(0, i); + } + } + } + else + { + --keyCount; + + if (keyCount < list.size() && !((Profiler.Result)list.get(keyCount)).field_76331_c.equals("unspecified")) + { + if (this.debugProfilerName.length() > 0) + { + this.debugProfilerName = this.debugProfilerName + "."; + } + + this.debugProfilerName = this.debugProfilerName + ((Profiler.Result)list.get(keyCount)).field_76331_c; + } + } + } + } + + /** + * Parameter appears to be unused + */ + private void displayDebugInfo(long elapsedTicksTime) + { + if (this.mcProfiler.profilingEnabled) + { + List list = this.mcProfiler.getProfilingData(this.debugProfilerName); + Profiler.Result profiler$result = (Profiler.Result)list.remove(0); + GlStateManager.clear(256); + GlStateManager.matrixMode(5889); + GlStateManager.enableColorMaterial(); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, (double)this.displayWidth, (double)this.displayHeight, 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + GL11.glLineWidth(1.0F); + GlStateManager.disableTexture2D(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int i = 160; + int j = this.displayWidth - i - 10; + int k = this.displayHeight - i * 2; + GlStateManager.enableBlend(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos((double)((float)j - (float)i * 1.1F), (double)((float)k - (float)i * 0.6F - 16.0F), 0.0D).color(200, 0, 0, 0).endVertex(); + worldrenderer.pos((double)((float)j - (float)i * 1.1F), (double)(k + i * 2), 0.0D).color(200, 0, 0, 0).endVertex(); + worldrenderer.pos((double)((float)j + (float)i * 1.1F), (double)(k + i * 2), 0.0D).color(200, 0, 0, 0).endVertex(); + worldrenderer.pos((double)((float)j + (float)i * 1.1F), (double)((float)k - (float)i * 0.6F - 16.0F), 0.0D).color(200, 0, 0, 0).endVertex(); + tessellator.draw(); + GlStateManager.disableBlend(); + double d0 = 0.0D; + + for (int l = 0; l < list.size(); ++l) + { + Profiler.Result profiler$result1 = (Profiler.Result)list.get(l); + int i1 = MathHelper.floor_double(profiler$result1.field_76332_a / 4.0D) + 1; + worldrenderer.begin(6, DefaultVertexFormats.POSITION_COLOR); + int j1 = profiler$result1.func_76329_a(); + int k1 = j1 >> 16 & 255; + int l1 = j1 >> 8 & 255; + int i2 = j1 & 255; + worldrenderer.pos((double)j, (double)k, 0.0D).color(k1, l1, i2, 255).endVertex(); + + for (int j2 = i1; j2 >= 0; --j2) + { + float f = (float)((d0 + profiler$result1.field_76332_a * (double)j2 / (double)i1) * Math.PI * 2.0D / 100.0D); + float f1 = MathHelper.sin(f) * (float)i; + float f2 = MathHelper.cos(f) * (float)i * 0.5F; + worldrenderer.pos((double)((float)j + f1), (double)((float)k - f2), 0.0D).color(k1, l1, i2, 255).endVertex(); + } + + tessellator.draw(); + worldrenderer.begin(5, DefaultVertexFormats.POSITION_COLOR); + + for (int i3 = i1; i3 >= 0; --i3) + { + float f3 = (float)((d0 + profiler$result1.field_76332_a * (double)i3 / (double)i1) * Math.PI * 2.0D / 100.0D); + float f4 = MathHelper.sin(f3) * (float)i; + float f5 = MathHelper.cos(f3) * (float)i * 0.5F; + worldrenderer.pos((double)((float)j + f4), (double)((float)k - f5), 0.0D).color(k1 >> 1, l1 >> 1, i2 >> 1, 255).endVertex(); + worldrenderer.pos((double)((float)j + f4), (double)((float)k - f5 + 10.0F), 0.0D).color(k1 >> 1, l1 >> 1, i2 >> 1, 255).endVertex(); + } + + tessellator.draw(); + d0 += profiler$result1.field_76332_a; + } + + DecimalFormat decimalformat = new DecimalFormat("##0.00"); + GlStateManager.enableTexture2D(); + String s = ""; + + if (!profiler$result.field_76331_c.equals("unspecified")) + { + s = s + "[0] "; + } + + if (profiler$result.field_76331_c.length() == 0) + { + s = s + "ROOT "; + } + else + { + s = s + profiler$result.field_76331_c + " "; + } + + int l2 = 16777215; + this.fontRendererObj.drawStringWithShadow(s, (float)(j - i), (float)(k - i / 2 - 16), l2); + this.fontRendererObj.drawStringWithShadow(s = decimalformat.format(profiler$result.field_76330_b) + "%", (float)(j + i - this.fontRendererObj.getStringWidth(s)), (float)(k - i / 2 - 16), l2); + + for (int k2 = 0; k2 < list.size(); ++k2) + { + Profiler.Result profiler$result2 = (Profiler.Result)list.get(k2); + String s1 = ""; + + if (profiler$result2.field_76331_c.equals("unspecified")) + { + s1 = s1 + "[?] "; + } + else + { + s1 = s1 + "[" + (k2 + 1) + "] "; + } + + s1 = s1 + profiler$result2.field_76331_c; + this.fontRendererObj.drawStringWithShadow(s1, (float)(j - i), (float)(k + i / 2 + k2 * 8 + 20), profiler$result2.func_76329_a()); + this.fontRendererObj.drawStringWithShadow(s1 = decimalformat.format(profiler$result2.field_76332_a) + "%", (float)(j + i - 50 - this.fontRendererObj.getStringWidth(s1)), (float)(k + i / 2 + k2 * 8 + 20), profiler$result2.func_76329_a()); + this.fontRendererObj.drawStringWithShadow(s1 = decimalformat.format(profiler$result2.field_76330_b) + "%", (float)(j + i - this.fontRendererObj.getStringWidth(s1)), (float)(k + i / 2 + k2 * 8 + 20), profiler$result2.func_76329_a()); + } + } + } + + /** + * Called when the window is closing. Sets 'running' to false which allows the game loop to exit cleanly. + */ + public void shutdown() + { + this.running = false; + } + + /** + * Will set the focus to ingame if the Minecraft window is the active with focus. Also clears any GUI screen + * currently displayed + */ + public void setIngameFocus() + { + if (Display.isActive()) + { + if (!this.inGameHasFocus) + { + this.inGameHasFocus = true; + this.mouseHelper.grabMouseCursor(); + this.displayGuiScreen((GuiScreen)null); + this.leftClickCounter = 10000; + } + } + } + + /** + * Resets the player keystate, disables the ingame focus, and ungrabs the mouse cursor. + */ + public void setIngameNotInFocus() + { + if (this.inGameHasFocus) + { + KeyBinding.unPressAllKeys(); + this.inGameHasFocus = false; + this.mouseHelper.ungrabMouseCursor(); + } + } + + /** + * Displays the ingame menu + */ + public void displayInGameMenu() + { + if (this.currentScreen == null) + { + this.displayGuiScreen(new GuiIngameMenu()); + + if (this.isSingleplayer() && !this.theIntegratedServer.getPublic()) + { + this.mcSoundHandler.pauseSounds(); + } + } + } + + private void sendClickBlockToController(boolean leftClick) + { + if (!leftClick) + { + this.leftClickCounter = 0; + } + + if (this.leftClickCounter <= 0 && !this.thePlayer.isUsingItem()) + { + if (leftClick && this.objectMouseOver != null && this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + + if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit)) + { + this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit); + this.thePlayer.swingItem(); + } + } + else + { + this.playerController.resetBlockRemoving(); + } + } + } + + private void clickMouse() + { + if (this.leftClickCounter <= 0) + { + this.thePlayer.swingItem(); + + if (this.objectMouseOver == null) + { + logger.error("Null returned as \'hitResult\', this shouldn\'t happen!"); + + if (this.playerController.isNotCreative()) + { + this.leftClickCounter = 10; + } + } + else + { + switch (this.objectMouseOver.typeOfHit) + { + case ENTITY: + this.playerController.attackEntity(this.thePlayer, this.objectMouseOver.entityHit); + break; + + case BLOCK: + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + + if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) + { + this.playerController.clickBlock(blockpos, this.objectMouseOver.sideHit); + break; + } + + case MISS: + default: + if (this.playerController.isNotCreative()) + { + this.leftClickCounter = 10; + } + } + } + } + } + + @SuppressWarnings("incomplete-switch") + + /** + * Called when user clicked he's mouse right button (place) + */ + private void rightClickMouse() + { + if (!this.playerController.func_181040_m()) + { + this.rightClickDelayTimer = 4; + boolean flag = true; + ItemStack itemstack = this.thePlayer.inventory.getCurrentItem(); + + if (this.objectMouseOver == null) + { + logger.warn("Null returned as \'hitResult\', this shouldn\'t happen!"); + } + else + { + switch (this.objectMouseOver.typeOfHit) + { + case ENTITY: + if (this.playerController.func_178894_a(this.thePlayer, this.objectMouseOver.entityHit, this.objectMouseOver)) + { + flag = false; + } + else if (this.playerController.interactWithEntitySendPacket(this.thePlayer, this.objectMouseOver.entityHit)) + { + flag = false; + } + + break; + + case BLOCK: + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + + if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air) + { + int i = itemstack != null ? itemstack.stackSize : 0; + + if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec)) + { + flag = false; + this.thePlayer.swingItem(); + } + + if (itemstack == null) + { + return; + } + + if (itemstack.stackSize == 0) + { + this.thePlayer.inventory.mainInventory[this.thePlayer.inventory.currentItem] = null; + } + else if (itemstack.stackSize != i || this.playerController.isInCreativeMode()) + { + this.entityRenderer.itemRenderer.resetEquippedProgress(); + } + } + } + } + + if (flag) + { + ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); + + if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1)) + { + this.entityRenderer.itemRenderer.resetEquippedProgress2(); + } + } + } + } + + /** + * Toggles fullscreen mode. + */ + public void toggleFullscreen() + { + try + { + this.fullscreen = !this.fullscreen; + this.gameSettings.fullScreen = this.fullscreen; + + if (this.fullscreen) + { + this.updateDisplayMode(); + this.displayWidth = Display.getDisplayMode().getWidth(); + this.displayHeight = Display.getDisplayMode().getHeight(); + + if (this.displayWidth <= 0) + { + this.displayWidth = 1; + } + + if (this.displayHeight <= 0) + { + this.displayHeight = 1; + } + } + else + { + Display.setDisplayMode(new DisplayMode(this.tempDisplayWidth, this.tempDisplayHeight)); + this.displayWidth = this.tempDisplayWidth; + this.displayHeight = this.tempDisplayHeight; + + if (this.displayWidth <= 0) + { + this.displayWidth = 1; + } + + if (this.displayHeight <= 0) + { + this.displayHeight = 1; + } + } + + if (this.currentScreen != null) + { + this.resize(this.displayWidth, this.displayHeight); + } + else + { + this.updateFramebufferSize(); + } + + Display.setFullscreen(this.fullscreen); + Display.setVSyncEnabled(this.gameSettings.enableVsync); + this.updateDisplay(); + } + catch (Exception exception) + { + logger.error((String)"Couldn\'t toggle fullscreen", (Throwable)exception); + } + } + + /** + * Called to resize the current screen. + */ + private void resize(int width, int height) + { + this.displayWidth = Math.max(1, width); + this.displayHeight = Math.max(1, height); + + if (this.currentScreen != null) + { + ScaledResolution scaledresolution = new ScaledResolution(this); + this.currentScreen.onResize(this, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight()); + } + + this.loadingScreen = new LoadingScreenRenderer(this); + this.updateFramebufferSize(); + } + + private void updateFramebufferSize() + { + this.framebufferMc.createBindFramebuffer(this.displayWidth, this.displayHeight); + + if (this.entityRenderer != null) + { + this.entityRenderer.updateShaderGroupSize(this.displayWidth, this.displayHeight); + } + } + + public MusicTicker func_181535_r() + { + return this.mcMusicTicker; + } + + /** + * Runs the current tick. + */ + public void runTick() throws IOException + { + if (this.rightClickDelayTimer > 0) + { + --this.rightClickDelayTimer; + } + + this.mcProfiler.startSection("gui"); + + if (!this.isGamePaused) + { + this.ingameGUI.updateTick(); + } + + this.mcProfiler.endSection(); + this.entityRenderer.getMouseOver(1.0F); + this.mcProfiler.startSection("gameMode"); + + if (!this.isGamePaused && this.theWorld != null) + { + this.playerController.updateController(); + } + + this.mcProfiler.endStartSection("textures"); + + if (!this.isGamePaused) + { + this.renderEngine.tick(); + } + + if (this.currentScreen == null && this.thePlayer != null) + { + if (this.thePlayer.getHealth() <= 0.0F) + { + this.displayGuiScreen((GuiScreen)null); + } + else if (this.thePlayer.isPlayerSleeping() && this.theWorld != null) + { + this.displayGuiScreen(new GuiSleepMP()); + } + } + else if (this.currentScreen != null && this.currentScreen instanceof GuiSleepMP && !this.thePlayer.isPlayerSleeping()) + { + this.displayGuiScreen((GuiScreen)null); + } + + if (this.currentScreen != null) + { + this.leftClickCounter = 10000; + } + + if (this.currentScreen != null) + { + try + { + this.currentScreen.handleInput(); + } + catch (Throwable throwable1) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Updating screen events"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Affected screen"); + crashreportcategory.addCrashSectionCallable("Screen name", new Callable() + { + public String call() throws Exception + { + return Minecraft.this.currentScreen.getClass().getCanonicalName(); + } + }); + throw new ReportedException(crashreport); + } + + if (this.currentScreen != null) + { + try + { + this.currentScreen.updateScreen(); + } + catch (Throwable throwable) + { + CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Ticking screen"); + CrashReportCategory crashreportcategory1 = crashreport1.makeCategory("Affected screen"); + crashreportcategory1.addCrashSectionCallable("Screen name", new Callable() + { + public String call() throws Exception + { + return Minecraft.this.currentScreen.getClass().getCanonicalName(); + } + }); + throw new ReportedException(crashreport1); + } + } + } + + if (this.currentScreen == null || this.currentScreen.allowUserInput) + { + this.mcProfiler.endStartSection("mouse"); + + while (Mouse.next()) + { + int i = Mouse.getEventButton(); + KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState()); + + if (Mouse.getEventButtonState()) + { + if (this.thePlayer.isSpectator() && i == 2) + { + this.ingameGUI.getSpectatorGui().func_175261_b(); + } + else + { + KeyBinding.onTick(i - 100); + } + } + + long i1 = getSystemTime() - this.systemTime; + + if (i1 <= 200L) + { + int j = Mouse.getEventDWheel(); + + if (j != 0) + { + if (this.thePlayer.isSpectator()) + { + j = j < 0 ? -1 : 1; + + if (this.ingameGUI.getSpectatorGui().func_175262_a()) + { + this.ingameGUI.getSpectatorGui().func_175259_b(-j); + } + else + { + float f = MathHelper.clamp_float(this.thePlayer.capabilities.getFlySpeed() + (float)j * 0.005F, 0.0F, 0.2F); + this.thePlayer.capabilities.setFlySpeed(f); + } + } + else + { + this.thePlayer.inventory.changeCurrentItem(j); + } + } + + if (this.currentScreen == null) + { + if (!this.inGameHasFocus && Mouse.getEventButtonState()) + { + this.setIngameFocus(); + } + } + else if (this.currentScreen != null) + { + this.currentScreen.handleMouseInput(); + } + } + } + + if (this.leftClickCounter > 0) + { + --this.leftClickCounter; + } + + this.mcProfiler.endStartSection("keyboard"); + + while (Keyboard.next()) + { + int k = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey(); + KeyBinding.setKeyBindState(k, Keyboard.getEventKeyState()); + + if (Keyboard.getEventKeyState()) + { + KeyBinding.onTick(k); + } + + + if (this.debugCrashKeyPressTime > 0L) + { + if (getSystemTime() - this.debugCrashKeyPressTime >= 6000L) + { + throw new ReportedException(new CrashReport("Manually triggered debug crash", new Throwable())); + } + + if (!Keyboard.isKeyDown(46) || !Keyboard.isKeyDown(61)) + { + this.debugCrashKeyPressTime = -1L; + } + } + else if (Keyboard.isKeyDown(46) && Keyboard.isKeyDown(61)) + { + this.debugCrashKeyPressTime = getSystemTime(); + } + + this.dispatchKeypresses(); + + if (Keyboard.getEventKeyState()) + { + if (k == 62 && this.entityRenderer != null) + { + this.entityRenderer.switchUseShader(); + } + + if (this.currentScreen != null) + { + this.currentScreen.handleKeyboardInput(); + } + else + { + if (k == 1) + { + this.displayInGameMenu(); + } + + if (k == 32 && Keyboard.isKeyDown(61) && this.ingameGUI != null) + { + this.ingameGUI.getChatGUI().clearChatMessages(); + } + + if (k == 31 && Keyboard.isKeyDown(61)) + { + this.refreshResources(); + } + + if (k == 17 && Keyboard.isKeyDown(61)) + { + ; + } + + if (k == 18 && Keyboard.isKeyDown(61)) + { + ; + } + + if (k == 47 && Keyboard.isKeyDown(61)) + { + ; + } + + if (k == 38 && Keyboard.isKeyDown(61)) + { + ; + } + + if (k == 22 && Keyboard.isKeyDown(61)) + { + ; + } + + if (k == 20 && Keyboard.isKeyDown(61)) + { + this.refreshResources(); + } + + if (k == 33 && Keyboard.isKeyDown(61)) + { + this.gameSettings.setOptionValue(GameSettings.Options.RENDER_DISTANCE, GuiScreen.isShiftKeyDown() ? -1 : 1); + } + + if (k == 30 && Keyboard.isKeyDown(61)) + { + this.renderGlobal.loadRenderers(); + } + + if (k == 35 && Keyboard.isKeyDown(61)) + { + this.gameSettings.advancedItemTooltips = !this.gameSettings.advancedItemTooltips; + this.gameSettings.saveOptions(); + } + + if (k == 48 && Keyboard.isKeyDown(61)) + { + this.renderManager.setDebugBoundingBox(!this.renderManager.isDebugBoundingBox()); + } + + if (k == 25 && Keyboard.isKeyDown(61)) + { + this.gameSettings.pauseOnLostFocus = !this.gameSettings.pauseOnLostFocus; + this.gameSettings.saveOptions(); + } + + if (k == 59) + { + this.gameSettings.hideGUI = !this.gameSettings.hideGUI; + } + + if (k == 61) + { + this.gameSettings.showDebugInfo = !this.gameSettings.showDebugInfo; + this.gameSettings.showDebugProfilerChart = GuiScreen.isShiftKeyDown(); + this.gameSettings.field_181657_aC = GuiScreen.isAltKeyDown(); + } + + if (this.gameSettings.keyBindTogglePerspective.isPressed()) + { + ++this.gameSettings.thirdPersonView; + + if (this.gameSettings.thirdPersonView > 2) + { + this.gameSettings.thirdPersonView = 0; + } + + if (this.gameSettings.thirdPersonView == 0) + { + this.entityRenderer.loadEntityShader(this.getRenderViewEntity()); + } + else if (this.gameSettings.thirdPersonView == 1) + { + this.entityRenderer.loadEntityShader((Entity)null); + } + + this.renderGlobal.setDisplayListEntitiesDirty(); + } + + if (this.gameSettings.keyBindSmoothCamera.isPressed()) + { + this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera; + } + } + + if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart) + { + if (k == 11) + { + this.updateDebugProfilerName(0); + } + + for (int j1 = 0; j1 < 9; ++j1) + { + if (k == 2 + j1) + { + this.updateDebugProfilerName(j1 + 1); + } + } + } + } + } + + for (int l = 0; l < 9; ++l) + { + if (this.gameSettings.keyBindsHotbar[l].isPressed()) + { + if (this.thePlayer.isSpectator()) + { + this.ingameGUI.getSpectatorGui().func_175260_a(l); + } + else + { + this.thePlayer.inventory.currentItem = l; + } + } + } + + boolean flag = this.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN; + + while (this.gameSettings.keyBindInventory.isPressed()) + { + if (this.playerController.isRidingHorse()) + { + this.thePlayer.sendHorseInventory(); + } + else + { + this.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT)); + this.displayGuiScreen(new GuiInventory(this.thePlayer)); + } + } + + while (this.gameSettings.keyBindDrop.isPressed()) + { + if (!this.thePlayer.isSpectator()) + { + this.thePlayer.dropOneItem(GuiScreen.isCtrlKeyDown()); + } + } + + while (this.gameSettings.keyBindChat.isPressed() && flag) + { + this.displayGuiScreen(new GuiChat()); + } + + if (this.currentScreen == null && this.gameSettings.keyBindCommand.isPressed() && flag) + { + this.displayGuiScreen(new GuiChat("/")); + } + + if (this.thePlayer.isUsingItem()) + { + if (!this.gameSettings.keyBindUseItem.isKeyDown()) + { + this.playerController.onStoppedUsingItem(this.thePlayer); + } + + while (this.gameSettings.keyBindAttack.isPressed()) + { + ; + } + + while (this.gameSettings.keyBindUseItem.isPressed()) + { + ; + } + + while (this.gameSettings.keyBindPickBlock.isPressed()) + { + ; + } + } + else + { + while (this.gameSettings.keyBindAttack.isPressed()) + { + this.clickMouse(); + } + + while (this.gameSettings.keyBindUseItem.isPressed()) + { + this.rightClickMouse(); + } + + while (this.gameSettings.keyBindPickBlock.isPressed()) + { + this.middleClickMouse(); + } + } + + if (this.gameSettings.keyBindUseItem.isKeyDown() && this.rightClickDelayTimer == 0 && !this.thePlayer.isUsingItem()) + { + this.rightClickMouse(); + } + + this.sendClickBlockToController(this.currentScreen == null && this.gameSettings.keyBindAttack.isKeyDown() && this.inGameHasFocus); + } + + if (this.theWorld != null) + { + if (this.thePlayer != null) + { + ++this.joinPlayerCounter; + + if (this.joinPlayerCounter == 30) + { + this.joinPlayerCounter = 0; + this.theWorld.joinEntityInSurroundings(this.thePlayer); + } + } + + this.mcProfiler.endStartSection("gameRenderer"); + + if (!this.isGamePaused) + { + this.entityRenderer.updateRenderer(); + } + + this.mcProfiler.endStartSection("levelRenderer"); + + if (!this.isGamePaused) + { + this.renderGlobal.updateClouds(); + } + + this.mcProfiler.endStartSection("level"); + + if (!this.isGamePaused) + { + if (this.theWorld.getLastLightningBolt() > 0) + { + this.theWorld.setLastLightningBolt(this.theWorld.getLastLightningBolt() - 1); + } + + this.theWorld.updateEntities(); + } + } + else if (this.entityRenderer.isShaderActive()) + { + this.entityRenderer.func_181022_b(); + } + + if (!this.isGamePaused) + { + this.mcMusicTicker.update(); + this.mcSoundHandler.update(); + } + + if (this.theWorld != null) + { + if (!this.isGamePaused) + { + this.theWorld.setAllowedSpawnTypes(this.theWorld.getDifficulty() != EnumDifficulty.PEACEFUL, true); + + try + { + this.theWorld.tick(); + } + catch (Throwable throwable2) + { + CrashReport crashreport2 = CrashReport.makeCrashReport(throwable2, "Exception in world tick"); + + if (this.theWorld == null) + { + CrashReportCategory crashreportcategory2 = crashreport2.makeCategory("Affected level"); + crashreportcategory2.addCrashSection("Problem", "Level is null!"); + } + else + { + this.theWorld.addWorldInfoToCrashReport(crashreport2); + } + + throw new ReportedException(crashreport2); + } + } + + this.mcProfiler.endStartSection("animateTick"); + + if (!this.isGamePaused && this.theWorld != null) + { + this.theWorld.doVoidFogParticles(MathHelper.floor_double(this.thePlayer.posX), MathHelper.floor_double(this.thePlayer.posY), MathHelper.floor_double(this.thePlayer.posZ)); + } + + this.mcProfiler.endStartSection("particles"); + + if (!this.isGamePaused) + { + this.effectRenderer.updateEffects(); + } + } + else if (this.myNetworkManager != null) + { + this.mcProfiler.endStartSection("pendingConnection"); + this.myNetworkManager.processReceivedPackets(); + } + + ClientTick event = new ClientTick(); + event.call(); + + this.mcProfiler.endSection(); + this.systemTime = getSystemTime(); + } + + /** + * Arguments: World foldername, World ingame name, WorldSettings + */ + public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn) + { + this.loadWorld((WorldClient)null); + System.gc(); + ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); + + if (worldinfo == null && worldSettingsIn != null) + { + worldinfo = new WorldInfo(worldSettingsIn, folderName); + isavehandler.saveWorldInfo(worldinfo); + } + + if (worldSettingsIn == null) + { + worldSettingsIn = new WorldSettings(worldinfo); + } + + try + { + this.theIntegratedServer = new IntegratedServer(this, folderName, worldName, worldSettingsIn); + this.theIntegratedServer.startServerThread(); + this.integratedServerIsRunning = true; + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Starting integrated server"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Starting integrated server"); + crashreportcategory.addCrashSection("Level ID", folderName); + crashreportcategory.addCrashSection("Level Name", worldName); + throw new ReportedException(crashreport); + } + + this.loadingScreen.displaySavingString(I18n.format("menu.loadingLevel", new Object[0])); + + while (!this.theIntegratedServer.serverIsInRunLoop()) + { + String s = this.theIntegratedServer.getUserMessage(); + + if (s != null) + { + this.loadingScreen.displayLoadingString(I18n.format(s, new Object[0])); + } + else + { + this.loadingScreen.displayLoadingString(""); + } + + try + { + Thread.sleep(200L); + } + catch (InterruptedException var9) + { + ; + } + } + + this.displayGuiScreen((GuiScreen)null); + SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint(); + NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress); + networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null)); + networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN)); + networkmanager.sendPacket(new C00PacketLoginStart(this.getSession().getProfile())); + this.myNetworkManager = networkmanager; + //if(!Animeware.hasSent) { + //System.out.println(SocketClient.client.request("start_animeware", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":true")); + //System.out.println(SocketClient.client.request("start_animeware_cape1", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":owns1")); + //Animeware.hasSent = true; + //} + NightSky.INSTANCE.getDiscordRP().update("Playing Singleplayer", "Version: " + NightSky.INSTANCE.VERSION); + } + + /** + * unloads the current world first + */ + public void loadWorld(WorldClient worldClientIn) + { + this.loadWorld(worldClientIn, ""); + } + + /** + * par2Str is displayed on the loading screen to the user unloads the current world first + */ + public void loadWorld(WorldClient worldClientIn, String loadingMessage) + { + if(worldClientIn != null) { + new WorldUnloadEvent(worldClientIn); + } + if (worldClientIn == null) + { + NetHandlerPlayClient nethandlerplayclient = this.getNetHandler(); + + if (nethandlerplayclient != null) + { + nethandlerplayclient.cleanup(); + } + + if (this.theIntegratedServer != null && this.theIntegratedServer.isAnvilFileSet()) + { + this.theIntegratedServer.initiateShutdown(); + this.theIntegratedServer.setStaticInstance(); + } + + this.theIntegratedServer = null; + this.guiAchievement.clearAchievements(); + this.entityRenderer.getMapItemRenderer().clearLoadedMaps(); + } + + this.renderViewEntity = null; + this.myNetworkManager = null; + + if (this.loadingScreen != null) + { + this.loadingScreen.resetProgressAndMessage(loadingMessage); + this.loadingScreen.displayLoadingString(""); + } + + if (worldClientIn == null && this.theWorld != null) + { + this.mcResourcePackRepository.func_148529_f(); + this.ingameGUI.func_181029_i(); + this.setServerData((ServerData)null); + this.integratedServerIsRunning = false; + } + + this.mcSoundHandler.stopSounds(); + this.theWorld = worldClientIn; + + if (worldClientIn != null) + { + if (this.renderGlobal != null) + { + this.renderGlobal.setWorldAndLoadRenderers(worldClientIn); + } + + if (this.effectRenderer != null) + { + this.effectRenderer.clearEffects(worldClientIn); + } + + if (this.thePlayer == null) + { + this.thePlayer = this.playerController.func_178892_a(worldClientIn, new StatFileWriter()); + this.playerController.flipPlayer(this.thePlayer); + } + + this.thePlayer.preparePlayerToSpawn(); + worldClientIn.spawnEntityInWorld(this.thePlayer); + this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); + this.playerController.setPlayerCapabilities(this.thePlayer); + this.renderViewEntity = this.thePlayer; + } + else + { + this.saveLoader.flushCache(); + this.thePlayer = null; + } + + System.gc(); + this.systemTime = 0L; + } + + public void setDimensionAndSpawnPlayer(int dimension) + { + this.theWorld.setInitialSpawnLocation(); + this.theWorld.removeAllEntities(); + int i = 0; + String s = null; + + if (this.thePlayer != null) + { + i = this.thePlayer.getEntityId(); + this.theWorld.removeEntity(this.thePlayer); + s = this.thePlayer.getClientBrand(); + } + + this.renderViewEntity = null; + EntityPlayerSP entityplayersp = this.thePlayer; + this.thePlayer = this.playerController.func_178892_a(this.theWorld, this.thePlayer == null ? new StatFileWriter() : this.thePlayer.getStatFileWriter()); + this.thePlayer.getDataWatcher().updateWatchedObjectsFromList(entityplayersp.getDataWatcher().getAllWatched()); + this.thePlayer.dimension = dimension; + this.renderViewEntity = this.thePlayer; + this.thePlayer.preparePlayerToSpawn(); + this.thePlayer.setClientBrand(s); + this.theWorld.spawnEntityInWorld(this.thePlayer); + this.playerController.flipPlayer(this.thePlayer); + this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); + this.thePlayer.setEntityId(i); + this.playerController.setPlayerCapabilities(this.thePlayer); + this.thePlayer.setReducedDebug(entityplayersp.hasReducedDebug()); + + if (this.currentScreen instanceof GuiGameOver) + { + this.displayGuiScreen((GuiScreen)null); + } + } + + /** + * Gets whether this is a demo or not. + */ + public final boolean isDemo() + { + return this.isDemo; + } + + public NetHandlerPlayClient getNetHandler() + { + return this.thePlayer != null ? this.thePlayer.sendQueue : null; + } + + public static boolean isGuiEnabled() + { + return theMinecraft == null || !theMinecraft.gameSettings.hideGUI; + } + + public static boolean isFancyGraphicsEnabled() + { + return theMinecraft != null && theMinecraft.gameSettings.fancyGraphics; + } + + /** + * Returns if ambient occlusion is enabled + */ + public static boolean isAmbientOcclusionEnabled() + { + return theMinecraft != null && theMinecraft.gameSettings.ambientOcclusion != 0; + } + + /** + * Called when user clicked he's mouse middle button (pick block) + */ + private void middleClickMouse() + { + if (this.objectMouseOver != null) + { + boolean flag = this.thePlayer.capabilities.isCreativeMode; + int i = 0; + boolean flag1 = false; + TileEntity tileentity = null; + Item item; + + if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + Block block = this.theWorld.getBlockState(blockpos).getBlock(); + + if (block.getMaterial() == Material.air) + { + return; + } + + item = block.getItem(this.theWorld, blockpos); + + if (item == null) + { + return; + } + + if (flag && GuiScreen.isCtrlKeyDown()) + { + tileentity = this.theWorld.getTileEntity(blockpos); + } + + Block block1 = item instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem(item) : block; + i = block1.getDamageValue(this.theWorld, blockpos); + flag1 = item.getHasSubtypes(); + } + else + { + if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag) + { + return; + } + + if (this.objectMouseOver.entityHit instanceof EntityPainting) + { + item = Items.painting; + } + else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) + { + item = Items.lead; + } + else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) + { + EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit; + ItemStack itemstack = entityitemframe.getDisplayedItem(); + + if (itemstack == null) + { + item = Items.item_frame; + } + else + { + item = itemstack.getItem(); + i = itemstack.getMetadata(); + flag1 = true; + } + } + else if (this.objectMouseOver.entityHit instanceof EntityMinecart) + { + EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit; + + switch (entityminecart.getMinecartType()) + { + case FURNACE: + item = Items.furnace_minecart; + break; + + case CHEST: + item = Items.chest_minecart; + break; + + case TNT: + item = Items.tnt_minecart; + break; + + case HOPPER: + item = Items.hopper_minecart; + break; + + case COMMAND_BLOCK: + item = Items.command_block_minecart; + break; + + default: + item = Items.minecart; + } + } + else if (this.objectMouseOver.entityHit instanceof EntityBoat) + { + item = Items.boat; + } + else if (this.objectMouseOver.entityHit instanceof EntityArmorStand) + { + item = Items.armor_stand; + } + else + { + item = Items.spawn_egg; + i = EntityList.getEntityID(this.objectMouseOver.entityHit); + flag1 = true; + + if (!EntityList.entityEggs.containsKey(Integer.valueOf(i))) + { + return; + } + } + } + + InventoryPlayer inventoryplayer = this.thePlayer.inventory; + + if (tileentity == null) + { + inventoryplayer.setCurrentItem(item, i, flag1, flag); + } + else + { + ItemStack itemstack1 = this.func_181036_a(item, i, tileentity); + inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1); + } + + if (flag) + { + int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem; + this.playerController.sendSlotPacket(inventoryplayer.getStackInSlot(inventoryplayer.currentItem), j); + } + } + } + + private ItemStack func_181036_a(Item p_181036_1_, int p_181036_2_, TileEntity p_181036_3_) + { + ItemStack itemstack = new ItemStack(p_181036_1_, 1, p_181036_2_); + NBTTagCompound nbttagcompound = new NBTTagCompound(); + p_181036_3_.writeToNBT(nbttagcompound); + + if (p_181036_1_ == Items.skull && nbttagcompound.hasKey("Owner")) + { + NBTTagCompound nbttagcompound2 = nbttagcompound.getCompoundTag("Owner"); + NBTTagCompound nbttagcompound3 = new NBTTagCompound(); + nbttagcompound3.setTag("SkullOwner", nbttagcompound2); + itemstack.setTagCompound(nbttagcompound3); + return itemstack; + } + else + { + itemstack.setTagInfo("BlockEntityTag", nbttagcompound); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + NBTTagList nbttaglist = new NBTTagList(); + nbttaglist.appendTag(new NBTTagString("(+NBT)")); + nbttagcompound1.setTag("Lore", nbttaglist); + itemstack.setTagInfo("display", nbttagcompound1); + return itemstack; + } + } + + /** + * adds core server Info (GL version , Texture pack, isModded, type), and the worldInfo to the crash report + */ + public CrashReport addGraphicsAndWorldToCrashReport(CrashReport theCrash) + { + theCrash.getCategory().addCrashSectionCallable("Launched Version", new Callable() + { + public String call() throws Exception + { + return Minecraft.this.launchedVersion; + } + }); + theCrash.getCategory().addCrashSectionCallable("LWJGL", new Callable() + { + public String call() + { + return Sys.getVersion(); + } + }); + theCrash.getCategory().addCrashSectionCallable("OpenGL", new Callable() + { + public String call() + { + return GL11.glGetString(GL11.GL_RENDERER) + " GL version " + GL11.glGetString(GL11.GL_VERSION) + ", " + GL11.glGetString(GL11.GL_VENDOR); + } + }); + theCrash.getCategory().addCrashSectionCallable("GL Caps", new Callable() + { + public String call() + { + return OpenGlHelper.getLogText(); + } + }); + theCrash.getCategory().addCrashSectionCallable("Using VBOs", new Callable() + { + public String call() + { + return Minecraft.this.gameSettings.useVbo ? "Yes" : "No"; + } + }); + theCrash.getCategory().addCrashSectionCallable("Is Modded", new Callable() + { + public String call() throws Exception + { + String s = ClientBrandRetriever.getClientModName(); + return !s.equals("vanilla") ? "Definitely; Client brand changed to \'" + s + "\'" : (Minecraft.class.getSigners() == null ? "Very likely; Jar signature invalidated" : "Probably not. Jar signature remains and client brand is untouched."); + } + }); + theCrash.getCategory().addCrashSectionCallable("Type", new Callable() + { + public String call() throws Exception + { + return "Client (map_client.txt)"; + } + }); + theCrash.getCategory().addCrashSectionCallable("Resource Packs", new Callable() + { + public String call() throws Exception + { + StringBuilder stringbuilder = new StringBuilder(); + + for (Object s : Minecraft.this.gameSettings.resourcePacks) + { + if (stringbuilder.length() > 0) + { + stringbuilder.append(", "); + } + + stringbuilder.append(s); + + if (Minecraft.this.gameSettings.field_183018_l.contains(s)) + { + stringbuilder.append(" (incompatible)"); + } + } + + return stringbuilder.toString(); + } + }); + theCrash.getCategory().addCrashSectionCallable("Current Language", new Callable() + { + public String call() throws Exception + { + return Minecraft.this.mcLanguageManager.getCurrentLanguage().toString(); + } + }); + theCrash.getCategory().addCrashSectionCallable("Profiler Position", new Callable() + { + public String call() throws Exception + { + return Minecraft.this.mcProfiler.profilingEnabled ? Minecraft.this.mcProfiler.getNameOfLastSection() : "N/A (disabled)"; + } + }); + theCrash.getCategory().addCrashSectionCallable("CPU", new Callable() + { + public String call() + { + return OpenGlHelper.func_183029_j(); + } + }); + + if (this.theWorld != null) + { + this.theWorld.addWorldInfoToCrashReport(theCrash); + } + + return theCrash; + } + + /** + * Return the singleton Minecraft instance for the game + */ + public static Minecraft getMinecraft() + { + return theMinecraft; + } + + public ListenableFuture scheduleResourcesRefresh() + { + return this.addScheduledTask(new Runnable() + { + public void run() + { + Minecraft.this.refreshResources(); + } + }); + } + + public void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper) + { + playerSnooper.addClientStat("fps", Integer.valueOf(debugFPS)); + playerSnooper.addClientStat("vsync_enabled", Boolean.valueOf(this.gameSettings.enableVsync)); + playerSnooper.addClientStat("display_frequency", Integer.valueOf(Display.getDisplayMode().getFrequency())); + playerSnooper.addClientStat("display_type", this.fullscreen ? "fullscreen" : "windowed"); + playerSnooper.addClientStat("run_time", Long.valueOf((MinecraftServer.getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L)); + playerSnooper.addClientStat("current_action", this.func_181538_aA()); + String s = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN ? "little" : "big"; + playerSnooper.addClientStat("endianness", s); + playerSnooper.addClientStat("resource_packs", Integer.valueOf(this.mcResourcePackRepository.getRepositoryEntries().size())); + int i = 0; + + for (ResourcePackRepository.Entry resourcepackrepository$entry : this.mcResourcePackRepository.getRepositoryEntries()) + { + playerSnooper.addClientStat("resource_pack[" + i++ + "]", resourcepackrepository$entry.getResourcePackName()); + } + + if (this.theIntegratedServer != null && this.theIntegratedServer.getPlayerUsageSnooper() != null) + { + playerSnooper.addClientStat("snooper_partner", this.theIntegratedServer.getPlayerUsageSnooper().getUniqueID()); + } + } + + private String func_181538_aA() + { + return this.theIntegratedServer != null ? (this.theIntegratedServer.getPublic() ? "hosting_lan" : "singleplayer") : (this.currentServerData != null ? (this.currentServerData.func_181041_d() ? "playing_lan" : "multiplayer") : "out_of_game"); + } + + public void addServerTypeToSnooper(PlayerUsageSnooper playerSnooper) + { + playerSnooper.addStatToSnooper("opengl_version", GL11.glGetString(GL11.GL_VERSION)); + playerSnooper.addStatToSnooper("opengl_vendor", GL11.glGetString(GL11.GL_VENDOR)); + playerSnooper.addStatToSnooper("client_brand", ClientBrandRetriever.getClientModName()); + playerSnooper.addStatToSnooper("launched_version", this.launchedVersion); + ContextCapabilities contextcapabilities = GLContext.getCapabilities(); + playerSnooper.addStatToSnooper("gl_caps[ARB_arrays_of_arrays]", Boolean.valueOf(contextcapabilities.GL_ARB_arrays_of_arrays)); + playerSnooper.addStatToSnooper("gl_caps[ARB_base_instance]", Boolean.valueOf(contextcapabilities.GL_ARB_base_instance)); + playerSnooper.addStatToSnooper("gl_caps[ARB_blend_func_extended]", Boolean.valueOf(contextcapabilities.GL_ARB_blend_func_extended)); + playerSnooper.addStatToSnooper("gl_caps[ARB_clear_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_clear_buffer_object)); + playerSnooper.addStatToSnooper("gl_caps[ARB_color_buffer_float]", Boolean.valueOf(contextcapabilities.GL_ARB_color_buffer_float)); + playerSnooper.addStatToSnooper("gl_caps[ARB_compatibility]", Boolean.valueOf(contextcapabilities.GL_ARB_compatibility)); + playerSnooper.addStatToSnooper("gl_caps[ARB_compressed_texture_pixel_storage]", Boolean.valueOf(contextcapabilities.GL_ARB_compressed_texture_pixel_storage)); + playerSnooper.addStatToSnooper("gl_caps[ARB_compute_shader]", Boolean.valueOf(contextcapabilities.GL_ARB_compute_shader)); + playerSnooper.addStatToSnooper("gl_caps[ARB_copy_buffer]", Boolean.valueOf(contextcapabilities.GL_ARB_copy_buffer)); + playerSnooper.addStatToSnooper("gl_caps[ARB_copy_image]", Boolean.valueOf(contextcapabilities.GL_ARB_copy_image)); + playerSnooper.addStatToSnooper("gl_caps[ARB_depth_buffer_float]", Boolean.valueOf(contextcapabilities.GL_ARB_depth_buffer_float)); + playerSnooper.addStatToSnooper("gl_caps[ARB_compute_shader]", Boolean.valueOf(contextcapabilities.GL_ARB_compute_shader)); + playerSnooper.addStatToSnooper("gl_caps[ARB_copy_buffer]", Boolean.valueOf(contextcapabilities.GL_ARB_copy_buffer)); + playerSnooper.addStatToSnooper("gl_caps[ARB_copy_image]", Boolean.valueOf(contextcapabilities.GL_ARB_copy_image)); + playerSnooper.addStatToSnooper("gl_caps[ARB_depth_buffer_float]", Boolean.valueOf(contextcapabilities.GL_ARB_depth_buffer_float)); + playerSnooper.addStatToSnooper("gl_caps[ARB_depth_clamp]", Boolean.valueOf(contextcapabilities.GL_ARB_depth_clamp)); + playerSnooper.addStatToSnooper("gl_caps[ARB_depth_texture]", Boolean.valueOf(contextcapabilities.GL_ARB_depth_texture)); + playerSnooper.addStatToSnooper("gl_caps[ARB_draw_buffers]", Boolean.valueOf(contextcapabilities.GL_ARB_draw_buffers)); + playerSnooper.addStatToSnooper("gl_caps[ARB_draw_buffers_blend]", Boolean.valueOf(contextcapabilities.GL_ARB_draw_buffers_blend)); + playerSnooper.addStatToSnooper("gl_caps[ARB_draw_elements_base_vertex]", Boolean.valueOf(contextcapabilities.GL_ARB_draw_elements_base_vertex)); + playerSnooper.addStatToSnooper("gl_caps[ARB_draw_indirect]", Boolean.valueOf(contextcapabilities.GL_ARB_draw_indirect)); + playerSnooper.addStatToSnooper("gl_caps[ARB_draw_instanced]", Boolean.valueOf(contextcapabilities.GL_ARB_draw_instanced)); + playerSnooper.addStatToSnooper("gl_caps[ARB_explicit_attrib_location]", Boolean.valueOf(contextcapabilities.GL_ARB_explicit_attrib_location)); + playerSnooper.addStatToSnooper("gl_caps[ARB_explicit_uniform_location]", Boolean.valueOf(contextcapabilities.GL_ARB_explicit_uniform_location)); + playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_layer_viewport]", Boolean.valueOf(contextcapabilities.GL_ARB_fragment_layer_viewport)); + playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_program]", Boolean.valueOf(contextcapabilities.GL_ARB_fragment_program)); + playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_shader]", Boolean.valueOf(contextcapabilities.GL_ARB_fragment_shader)); + playerSnooper.addStatToSnooper("gl_caps[ARB_fragment_program_shadow]", Boolean.valueOf(contextcapabilities.GL_ARB_fragment_program_shadow)); + playerSnooper.addStatToSnooper("gl_caps[ARB_framebuffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_framebuffer_object)); + playerSnooper.addStatToSnooper("gl_caps[ARB_framebuffer_sRGB]", Boolean.valueOf(contextcapabilities.GL_ARB_framebuffer_sRGB)); + playerSnooper.addStatToSnooper("gl_caps[ARB_geometry_shader4]", Boolean.valueOf(contextcapabilities.GL_ARB_geometry_shader4)); + playerSnooper.addStatToSnooper("gl_caps[ARB_gpu_shader5]", Boolean.valueOf(contextcapabilities.GL_ARB_gpu_shader5)); + playerSnooper.addStatToSnooper("gl_caps[ARB_half_float_pixel]", Boolean.valueOf(contextcapabilities.GL_ARB_half_float_pixel)); + playerSnooper.addStatToSnooper("gl_caps[ARB_half_float_vertex]", Boolean.valueOf(contextcapabilities.GL_ARB_half_float_vertex)); + playerSnooper.addStatToSnooper("gl_caps[ARB_instanced_arrays]", Boolean.valueOf(contextcapabilities.GL_ARB_instanced_arrays)); + playerSnooper.addStatToSnooper("gl_caps[ARB_map_buffer_alignment]", Boolean.valueOf(contextcapabilities.GL_ARB_map_buffer_alignment)); + playerSnooper.addStatToSnooper("gl_caps[ARB_map_buffer_range]", Boolean.valueOf(contextcapabilities.GL_ARB_map_buffer_range)); + playerSnooper.addStatToSnooper("gl_caps[ARB_multisample]", Boolean.valueOf(contextcapabilities.GL_ARB_multisample)); + playerSnooper.addStatToSnooper("gl_caps[ARB_multitexture]", Boolean.valueOf(contextcapabilities.GL_ARB_multitexture)); + playerSnooper.addStatToSnooper("gl_caps[ARB_occlusion_query2]", Boolean.valueOf(contextcapabilities.GL_ARB_occlusion_query2)); + playerSnooper.addStatToSnooper("gl_caps[ARB_pixel_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_pixel_buffer_object)); + playerSnooper.addStatToSnooper("gl_caps[ARB_seamless_cube_map]", Boolean.valueOf(contextcapabilities.GL_ARB_seamless_cube_map)); + playerSnooper.addStatToSnooper("gl_caps[ARB_shader_objects]", Boolean.valueOf(contextcapabilities.GL_ARB_shader_objects)); + playerSnooper.addStatToSnooper("gl_caps[ARB_shader_stencil_export]", Boolean.valueOf(contextcapabilities.GL_ARB_shader_stencil_export)); + playerSnooper.addStatToSnooper("gl_caps[ARB_shader_texture_lod]", Boolean.valueOf(contextcapabilities.GL_ARB_shader_texture_lod)); + playerSnooper.addStatToSnooper("gl_caps[ARB_shadow]", Boolean.valueOf(contextcapabilities.GL_ARB_shadow)); + playerSnooper.addStatToSnooper("gl_caps[ARB_shadow_ambient]", Boolean.valueOf(contextcapabilities.GL_ARB_shadow_ambient)); + playerSnooper.addStatToSnooper("gl_caps[ARB_stencil_texturing]", Boolean.valueOf(contextcapabilities.GL_ARB_stencil_texturing)); + playerSnooper.addStatToSnooper("gl_caps[ARB_sync]", Boolean.valueOf(contextcapabilities.GL_ARB_sync)); + playerSnooper.addStatToSnooper("gl_caps[ARB_tessellation_shader]", Boolean.valueOf(contextcapabilities.GL_ARB_tessellation_shader)); + playerSnooper.addStatToSnooper("gl_caps[ARB_texture_border_clamp]", Boolean.valueOf(contextcapabilities.GL_ARB_texture_border_clamp)); + playerSnooper.addStatToSnooper("gl_caps[ARB_texture_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_texture_buffer_object)); + playerSnooper.addStatToSnooper("gl_caps[ARB_texture_cube_map]", Boolean.valueOf(contextcapabilities.GL_ARB_texture_cube_map)); + playerSnooper.addStatToSnooper("gl_caps[ARB_texture_cube_map_array]", Boolean.valueOf(contextcapabilities.GL_ARB_texture_cube_map_array)); + playerSnooper.addStatToSnooper("gl_caps[ARB_texture_non_power_of_two]", Boolean.valueOf(contextcapabilities.GL_ARB_texture_non_power_of_two)); + playerSnooper.addStatToSnooper("gl_caps[ARB_uniform_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_uniform_buffer_object)); + playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_blend]", Boolean.valueOf(contextcapabilities.GL_ARB_vertex_blend)); + playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_vertex_buffer_object)); + playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_program]", Boolean.valueOf(contextcapabilities.GL_ARB_vertex_program)); + playerSnooper.addStatToSnooper("gl_caps[ARB_vertex_shader]", Boolean.valueOf(contextcapabilities.GL_ARB_vertex_shader)); + playerSnooper.addStatToSnooper("gl_caps[EXT_bindable_uniform]", Boolean.valueOf(contextcapabilities.GL_EXT_bindable_uniform)); + playerSnooper.addStatToSnooper("gl_caps[EXT_blend_equation_separate]", Boolean.valueOf(contextcapabilities.GL_EXT_blend_equation_separate)); + playerSnooper.addStatToSnooper("gl_caps[EXT_blend_func_separate]", Boolean.valueOf(contextcapabilities.GL_EXT_blend_func_separate)); + playerSnooper.addStatToSnooper("gl_caps[EXT_blend_minmax]", Boolean.valueOf(contextcapabilities.GL_EXT_blend_minmax)); + playerSnooper.addStatToSnooper("gl_caps[EXT_blend_subtract]", Boolean.valueOf(contextcapabilities.GL_EXT_blend_subtract)); + playerSnooper.addStatToSnooper("gl_caps[EXT_draw_instanced]", Boolean.valueOf(contextcapabilities.GL_EXT_draw_instanced)); + playerSnooper.addStatToSnooper("gl_caps[EXT_framebuffer_multisample]", Boolean.valueOf(contextcapabilities.GL_EXT_framebuffer_multisample)); + playerSnooper.addStatToSnooper("gl_caps[EXT_framebuffer_object]", Boolean.valueOf(contextcapabilities.GL_EXT_framebuffer_object)); + playerSnooper.addStatToSnooper("gl_caps[EXT_framebuffer_sRGB]", Boolean.valueOf(contextcapabilities.GL_EXT_framebuffer_sRGB)); + playerSnooper.addStatToSnooper("gl_caps[EXT_geometry_shader4]", Boolean.valueOf(contextcapabilities.GL_EXT_geometry_shader4)); + playerSnooper.addStatToSnooper("gl_caps[EXT_gpu_program_parameters]", Boolean.valueOf(contextcapabilities.GL_EXT_gpu_program_parameters)); + playerSnooper.addStatToSnooper("gl_caps[EXT_gpu_shader4]", Boolean.valueOf(contextcapabilities.GL_EXT_gpu_shader4)); + playerSnooper.addStatToSnooper("gl_caps[EXT_multi_draw_arrays]", Boolean.valueOf(contextcapabilities.GL_EXT_multi_draw_arrays)); + playerSnooper.addStatToSnooper("gl_caps[EXT_packed_depth_stencil]", Boolean.valueOf(contextcapabilities.GL_EXT_packed_depth_stencil)); + playerSnooper.addStatToSnooper("gl_caps[EXT_paletted_texture]", Boolean.valueOf(contextcapabilities.GL_EXT_paletted_texture)); + playerSnooper.addStatToSnooper("gl_caps[EXT_rescale_normal]", Boolean.valueOf(contextcapabilities.GL_EXT_rescale_normal)); + playerSnooper.addStatToSnooper("gl_caps[EXT_separate_shader_objects]", Boolean.valueOf(contextcapabilities.GL_EXT_separate_shader_objects)); + playerSnooper.addStatToSnooper("gl_caps[EXT_shader_image_load_store]", Boolean.valueOf(contextcapabilities.GL_EXT_shader_image_load_store)); + playerSnooper.addStatToSnooper("gl_caps[EXT_shadow_funcs]", Boolean.valueOf(contextcapabilities.GL_EXT_shadow_funcs)); + playerSnooper.addStatToSnooper("gl_caps[EXT_shared_texture_palette]", Boolean.valueOf(contextcapabilities.GL_EXT_shared_texture_palette)); + playerSnooper.addStatToSnooper("gl_caps[EXT_stencil_clear_tag]", Boolean.valueOf(contextcapabilities.GL_EXT_stencil_clear_tag)); + playerSnooper.addStatToSnooper("gl_caps[EXT_stencil_two_side]", Boolean.valueOf(contextcapabilities.GL_EXT_stencil_two_side)); + playerSnooper.addStatToSnooper("gl_caps[EXT_stencil_wrap]", Boolean.valueOf(contextcapabilities.GL_EXT_stencil_wrap)); + playerSnooper.addStatToSnooper("gl_caps[EXT_texture_3d]", Boolean.valueOf(contextcapabilities.GL_EXT_texture_3d)); + playerSnooper.addStatToSnooper("gl_caps[EXT_texture_array]", Boolean.valueOf(contextcapabilities.GL_EXT_texture_array)); + playerSnooper.addStatToSnooper("gl_caps[EXT_texture_buffer_object]", Boolean.valueOf(contextcapabilities.GL_EXT_texture_buffer_object)); + playerSnooper.addStatToSnooper("gl_caps[EXT_texture_integer]", Boolean.valueOf(contextcapabilities.GL_EXT_texture_integer)); + playerSnooper.addStatToSnooper("gl_caps[EXT_texture_lod_bias]", Boolean.valueOf(contextcapabilities.GL_EXT_texture_lod_bias)); + playerSnooper.addStatToSnooper("gl_caps[EXT_texture_sRGB]", Boolean.valueOf(contextcapabilities.GL_EXT_texture_sRGB)); + playerSnooper.addStatToSnooper("gl_caps[EXT_vertex_shader]", Boolean.valueOf(contextcapabilities.GL_EXT_vertex_shader)); + playerSnooper.addStatToSnooper("gl_caps[EXT_vertex_weighting]", Boolean.valueOf(contextcapabilities.GL_EXT_vertex_weighting)); + playerSnooper.addStatToSnooper("gl_caps[gl_max_vertex_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_UNIFORM_COMPONENTS))); + GL11.glGetError(); + playerSnooper.addStatToSnooper("gl_caps[gl_max_fragment_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS))); + GL11.glGetError(); + playerSnooper.addStatToSnooper("gl_caps[gl_max_vertex_attribs]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_ATTRIBS))); + GL11.glGetError(); + playerSnooper.addStatToSnooper("gl_caps[gl_max_vertex_texture_image_units]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS))); + GL11.glGetError(); + playerSnooper.addStatToSnooper("gl_caps[gl_max_texture_image_units]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS))); + GL11.glGetError(); + playerSnooper.addStatToSnooper("gl_caps[gl_max_texture_image_units]", Integer.valueOf(GL11.glGetInteger(35071))); + GL11.glGetError(); + playerSnooper.addStatToSnooper("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); + } + + /** + * Used in the usage snooper. + */ + public static int getGLMaximumTextureSize() + { + for (int i = 16384; i > 0; i >>= 1) + { + GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)((ByteBuffer)null)); + int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); + + if (j != 0) + { + return i; + } + } + + return -1; + } + + /** + * Returns whether snooping is enabled or not. + */ + public boolean isSnooperEnabled() + { + return this.gameSettings.snooperEnabled; + } + + /** + * Set the current ServerData instance. + */ + public void setServerData(ServerData serverDataIn) + { + this.currentServerData = serverDataIn; + } + + public ServerData getCurrentServerData() + { + return this.currentServerData; + } + + public boolean isIntegratedServerRunning() + { + return this.integratedServerIsRunning; + } + + /** + * Returns true if there is only one player playing, and the current server is the integrated one. + */ + public boolean isSingleplayer() + { + return this.integratedServerIsRunning && this.theIntegratedServer != null; + } + + /** + * Returns the currently running integrated server + */ + public IntegratedServer getIntegratedServer() + { + return this.theIntegratedServer; + } + + public static void stopIntegratedServer() + { + if (theMinecraft != null) + { + IntegratedServer integratedserver = theMinecraft.getIntegratedServer(); + + if (integratedserver != null) + { + integratedserver.stopServer(); + } + } + } + + /** + * Returns the PlayerUsageSnooper instance. + */ + public PlayerUsageSnooper getPlayerUsageSnooper() + { + return this.usageSnooper; + } + + /** + * Gets the system time in milliseconds. + */ + public static long getSystemTime() + { + return Sys.getTime() * 1000L / Sys.getTimerResolution(); + } + + /** + * Returns whether we're in full screen or not. + */ + public boolean isFullScreen() + { + return this.fullscreen; + } + + public Session getSession() + { + return this.session; + } + + public PropertyMap getTwitchDetails() + { + return this.twitchDetails; + } + + public PropertyMap func_181037_M() + { + if (this.field_181038_N.isEmpty()) + { + GameProfile gameprofile = this.getSessionService().fillProfileProperties(this.session.getProfile(), false); + this.field_181038_N.putAll(gameprofile.getProperties()); + } + + return this.field_181038_N; + } + + public Proxy getProxy() + { + return this.proxy; + } + + public TextureManager getTextureManager() + { + return this.renderEngine; + } + + public IResourceManager getResourceManager() + { + return this.mcResourceManager; + } + + public ResourcePackRepository getResourcePackRepository() + { + return this.mcResourcePackRepository; + } + + public LanguageManager getLanguageManager() + { + return this.mcLanguageManager; + } + + public TextureMap getTextureMapBlocks() + { + return this.textureMapBlocks; + } + + public boolean isJava64bit() + { + return this.jvm64bit; + } + + public boolean isGamePaused() + { + return this.isGamePaused; + } + + public SoundHandler getSoundHandler() + { + return this.mcSoundHandler; + } + + public MusicTicker.MusicType getAmbientMusicType() + { + return this.thePlayer != null ? (this.thePlayer.worldObj.provider instanceof WorldProviderHell ? MusicTicker.MusicType.NETHER : (this.thePlayer.worldObj.provider instanceof WorldProviderEnd ? (BossStatus.bossName != null && BossStatus.statusBarTime > 0 ? MusicTicker.MusicType.END_BOSS : MusicTicker.MusicType.END) : (this.thePlayer.capabilities.isCreativeMode && this.thePlayer.capabilities.allowFlying ? MusicTicker.MusicType.CREATIVE : MusicTicker.MusicType.GAME))) : MusicTicker.MusicType.MENU; + } + + public IStream getTwitchStream() + { + return this.stream; + } + + public void dispatchKeypresses() + { + int i = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() : Keyboard.getEventKey(); + + if (i != 0 && !Keyboard.isRepeatEvent()) + { + if (!(this.currentScreen instanceof GuiControls) || ((GuiControls)this.currentScreen).time <= getSystemTime() - 20L) + { + if (Keyboard.getEventKeyState()) + { + if (i == this.gameSettings.keyBindStreamStartStop.getKeyCode()) + { + if (this.getTwitchStream().isBroadcasting()) + { + this.getTwitchStream().stopBroadcasting(); + } + else if (this.getTwitchStream().isReadyToBroadcast()) + { + this.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback() + { + public void confirmClicked(boolean result, int id) + { + if (result) + { + Minecraft.this.getTwitchStream().func_152930_t(); + } + + Minecraft.this.displayGuiScreen((GuiScreen)null); + } + }, I18n.format("stream.confirm_start", new Object[0]), "", 0)); + } + else if (this.getTwitchStream().func_152928_D() && this.getTwitchStream().func_152936_l()) + { + if (this.theWorld != null) + { + this.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText("Not ready to start streaming yet!")); + } + } + else + { + GuiStreamUnavailable.func_152321_a(this.currentScreen); + } + } + else if (i == this.gameSettings.keyBindStreamPauseUnpause.getKeyCode()) + { + if (this.getTwitchStream().isBroadcasting()) + { + if (this.getTwitchStream().isPaused()) + { + this.getTwitchStream().unpause(); + } + else + { + this.getTwitchStream().pause(); + } + } + } + else if (i == this.gameSettings.keyBindStreamCommercials.getKeyCode()) + { + if (this.getTwitchStream().isBroadcasting()) + { + this.getTwitchStream().requestCommercial(); + } + } + else if (i == this.gameSettings.keyBindStreamToggleMic.getKeyCode()) + { + this.stream.muteMicrophone(true); + } + else if (i == this.gameSettings.keyBindFullscreen.getKeyCode()) + { + this.toggleFullscreen(); + } + else if (i == this.gameSettings.keyBindScreenshot.getKeyCode()) + { + this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight, this.framebufferMc)); + } + } + else if (i == this.gameSettings.keyBindStreamToggleMic.getKeyCode()) + { + this.stream.muteMicrophone(false); + } + } + } + } + + public MinecraftSessionService getSessionService() + { + return this.sessionService; + } + + public SkinManager getSkinManager() + { + return this.skinManager; + } + + public Entity getRenderViewEntity() + { + return this.renderViewEntity; + } + + public void setRenderViewEntity(Entity viewingEntity) + { + this.renderViewEntity = viewingEntity; + this.entityRenderer.loadEntityShader(viewingEntity); + } + + public ListenableFuture addScheduledTask(Callable callableToSchedule) + { + Validate.notNull(callableToSchedule); + + if (!this.isCallingFromMinecraftThread()) + { + ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callableToSchedule); + + synchronized (this.scheduledTasks) + { + this.scheduledTasks.add(listenablefuturetask); + return listenablefuturetask; + } + } + else + { + try + { + return Futures.immediateFuture(callableToSchedule.call()); + } + catch (Exception exception) + { + return Futures.immediateFailedCheckedFuture(exception); + } + } + } + + public ListenableFuture addScheduledTask(Runnable runnableToSchedule) + { + Validate.notNull(runnableToSchedule); + return this.addScheduledTask(Executors.callable(runnableToSchedule)); + } + + public boolean isCallingFromMinecraftThread() + { + return Thread.currentThread() == this.mcThread; + } + + public BlockRendererDispatcher getBlockRendererDispatcher() + { + return this.blockRenderDispatcher; + } + + public RenderManager getRenderManager() + { + return this.renderManager; + } + + public RenderItem getRenderItem() + { + return this.renderItem; + } + + public ItemRenderer getItemRenderer() + { + return this.itemRenderer; + } + + public static int getDebugFPS() + { + return debugFPS; + } + + + public FrameTimer func_181539_aj() + { + return this.field_181542_y; + } + + public static Map getSessionInfo() + { + Map map = Maps.newHashMap(); + map.put("X-Minecraft-Username", getMinecraft().getSession().getUsername()); + map.put("X-Minecraft-UUID", getMinecraft().getSession().getPlayerID()); + map.put("X-Minecraft-Version", "1.8.8"); + return map; + } + + public boolean func_181540_al() + { + return this.field_181541_X; + } + + public void func_181537_a(boolean p_181537_1_) + { + this.field_181541_X = p_181537_1_; + } +} diff --git a/src/minecraft/net/minecraft/client/audio/GuardianSound.java b/src/minecraft/net/minecraft/client/audio/GuardianSound.java new file mode 100644 index 0000000..915432f --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/GuardianSound.java @@ -0,0 +1,38 @@ +package net.minecraft.client.audio; + +import net.minecraft.entity.monster.EntityGuardian; +import net.minecraft.util.ResourceLocation; + +public class GuardianSound extends MovingSound +{ + private final EntityGuardian guardian; + + public GuardianSound(EntityGuardian guardian) + { + super(new ResourceLocation("minecraft:mob.guardian.attack")); + this.guardian = guardian; + this.attenuationType = ISound.AttenuationType.NONE; + this.repeat = true; + this.repeatDelay = 0; + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + if (!this.guardian.isDead && this.guardian.hasTargetedEntity()) + { + this.xPosF = (float)this.guardian.posX; + this.yPosF = (float)this.guardian.posY; + this.zPosF = (float)this.guardian.posZ; + float f = this.guardian.func_175477_p(0.0F); + this.volume = 0.0F + 1.0F * f * f; + this.pitch = 0.7F + 0.5F * f; + } + else + { + this.donePlaying = true; + } + } +} diff --git a/src/minecraft/net/minecraft/client/audio/ISound.java b/src/minecraft/net/minecraft/client/audio/ISound.java new file mode 100644 index 0000000..72abffb --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/ISound.java @@ -0,0 +1,42 @@ +package net.minecraft.client.audio; + +import net.minecraft.util.ResourceLocation; + +public interface ISound +{ + ResourceLocation getSoundLocation(); + + boolean canRepeat(); + + int getRepeatDelay(); + + float getVolume(); + + float getPitch(); + + float getXPosF(); + + float getYPosF(); + + float getZPosF(); + + ISound.AttenuationType getAttenuationType(); + + public static enum AttenuationType + { + NONE(0), + LINEAR(2); + + private final int type; + + private AttenuationType(int typeIn) + { + this.type = typeIn; + } + + public int getTypeInt() + { + return this.type; + } + } +} diff --git a/src/minecraft/net/minecraft/client/audio/ISoundEventAccessor.java b/src/minecraft/net/minecraft/client/audio/ISoundEventAccessor.java new file mode 100644 index 0000000..92285c0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/ISoundEventAccessor.java @@ -0,0 +1,8 @@ +package net.minecraft.client.audio; + +public interface ISoundEventAccessor +{ + int getWeight(); + + T cloneEntry(); +} diff --git a/src/minecraft/net/minecraft/client/audio/ITickableSound.java b/src/minecraft/net/minecraft/client/audio/ITickableSound.java new file mode 100644 index 0000000..b55e0f1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/ITickableSound.java @@ -0,0 +1,8 @@ +package net.minecraft.client.audio; + +import net.minecraft.util.ITickable; + +public interface ITickableSound extends ISound, ITickable +{ + boolean isDonePlaying(); +} diff --git a/src/minecraft/net/minecraft/client/audio/MovingSound.java b/src/minecraft/net/minecraft/client/audio/MovingSound.java new file mode 100644 index 0000000..169b244 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/MovingSound.java @@ -0,0 +1,18 @@ +package net.minecraft.client.audio; + +import net.minecraft.util.ResourceLocation; + +public abstract class MovingSound extends PositionedSound implements ITickableSound +{ + protected boolean donePlaying = false; + + protected MovingSound(ResourceLocation location) + { + super(location); + } + + public boolean isDonePlaying() + { + return this.donePlaying; + } +} diff --git a/src/minecraft/net/minecraft/client/audio/MovingSoundMinecart.java b/src/minecraft/net/minecraft/client/audio/MovingSoundMinecart.java new file mode 100644 index 0000000..4521880 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/MovingSoundMinecart.java @@ -0,0 +1,48 @@ +package net.minecraft.client.audio; + +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class MovingSoundMinecart extends MovingSound +{ + private final EntityMinecart minecart; + private float distance = 0.0F; + + public MovingSoundMinecart(EntityMinecart minecartIn) + { + super(new ResourceLocation("minecraft:minecart.base")); + this.minecart = minecartIn; + this.repeat = true; + this.repeatDelay = 0; + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + if (this.minecart.isDead) + { + this.donePlaying = true; + } + else + { + this.xPosF = (float)this.minecart.posX; + this.yPosF = (float)this.minecart.posY; + this.zPosF = (float)this.minecart.posZ; + float f = MathHelper.sqrt_double(this.minecart.motionX * this.minecart.motionX + this.minecart.motionZ * this.minecart.motionZ); + + if ((double)f >= 0.01D) + { + this.distance = MathHelper.clamp_float(this.distance + 0.0025F, 0.0F, 1.0F); + this.volume = 0.0F + MathHelper.clamp_float(f, 0.0F, 0.5F) * 0.7F; + } + else + { + this.distance = 0.0F; + this.volume = 0.0F; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/audio/MovingSoundMinecartRiding.java b/src/minecraft/net/minecraft/client/audio/MovingSoundMinecartRiding.java new file mode 100644 index 0000000..d4be3f7 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/MovingSoundMinecartRiding.java @@ -0,0 +1,46 @@ +package net.minecraft.client.audio; + +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class MovingSoundMinecartRiding extends MovingSound +{ + private final EntityPlayer player; + private final EntityMinecart minecart; + + public MovingSoundMinecartRiding(EntityPlayer playerRiding, EntityMinecart minecart) + { + super(new ResourceLocation("minecraft:minecart.inside")); + this.player = playerRiding; + this.minecart = minecart; + this.attenuationType = ISound.AttenuationType.NONE; + this.repeat = true; + this.repeatDelay = 0; + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + if (!this.minecart.isDead && this.player.isRiding() && this.player.ridingEntity == this.minecart) + { + float f = MathHelper.sqrt_double(this.minecart.motionX * this.minecart.motionX + this.minecart.motionZ * this.minecart.motionZ); + + if ((double)f >= 0.01D) + { + this.volume = 0.0F + MathHelper.clamp_float(f, 0.0F, 1.0F) * 0.75F; + } + else + { + this.volume = 0.0F; + } + } + else + { + this.donePlaying = true; + } + } +} diff --git a/src/minecraft/net/minecraft/client/audio/MusicTicker.java b/src/minecraft/net/minecraft/client/audio/MusicTicker.java new file mode 100644 index 0000000..996b172 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/MusicTicker.java @@ -0,0 +1,102 @@ +package net.minecraft.client.audio; + +import java.util.Random; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ITickable; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class MusicTicker implements ITickable +{ + private final Random rand = new Random(); + private final Minecraft mc; + private ISound currentMusic; + private int timeUntilNextMusic = 100; + + public MusicTicker(Minecraft mcIn) + { + this.mc = mcIn; + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + MusicTicker.MusicType musicticker$musictype = this.mc.getAmbientMusicType(); + + if (this.currentMusic != null) + { + if (!musicticker$musictype.getMusicLocation().equals(this.currentMusic.getSoundLocation())) + { + this.mc.getSoundHandler().stopSound(this.currentMusic); + this.timeUntilNextMusic = MathHelper.getRandomIntegerInRange(this.rand, 0, musicticker$musictype.getMinDelay() / 2); + } + + if (!this.mc.getSoundHandler().isSoundPlaying(this.currentMusic)) + { + this.currentMusic = null; + this.timeUntilNextMusic = Math.min(MathHelper.getRandomIntegerInRange(this.rand, musicticker$musictype.getMinDelay(), musicticker$musictype.getMaxDelay()), this.timeUntilNextMusic); + } + } + + if (this.currentMusic == null && this.timeUntilNextMusic-- <= 0) + { + this.func_181558_a(musicticker$musictype); + } + } + + public void func_181558_a(MusicTicker.MusicType p_181558_1_) + { + this.currentMusic = PositionedSoundRecord.create(p_181558_1_.getMusicLocation()); + this.mc.getSoundHandler().playSound(this.currentMusic); + this.timeUntilNextMusic = Integer.MAX_VALUE; + } + + public void func_181557_a() + { + if (this.currentMusic != null) + { + this.mc.getSoundHandler().stopSound(this.currentMusic); + this.currentMusic = null; + this.timeUntilNextMusic = 0; + } + } + + public static enum MusicType + { + MENU(new ResourceLocation("minecraft:music.menu"), 20, 600), + GAME(new ResourceLocation("minecraft:music.game"), 12000, 24000), + CREATIVE(new ResourceLocation("minecraft:music.game.creative"), 1200, 3600), + CREDITS(new ResourceLocation("minecraft:music.game.end.credits"), Integer.MAX_VALUE, Integer.MAX_VALUE), + NETHER(new ResourceLocation("minecraft:music.game.nether"), 1200, 3600), + END_BOSS(new ResourceLocation("minecraft:music.game.end.dragon"), 0, 0), + END(new ResourceLocation("minecraft:music.game.end"), 6000, 24000); + + private final ResourceLocation musicLocation; + private final int minDelay; + private final int maxDelay; + + private MusicType(ResourceLocation location, int minDelayIn, int maxDelayIn) + { + this.musicLocation = location; + this.minDelay = minDelayIn; + this.maxDelay = maxDelayIn; + } + + public ResourceLocation getMusicLocation() + { + return this.musicLocation; + } + + public int getMinDelay() + { + return this.minDelay; + } + + public int getMaxDelay() + { + return this.maxDelay; + } + } +} diff --git a/src/minecraft/net/minecraft/client/audio/PositionedSound.java b/src/minecraft/net/minecraft/client/audio/PositionedSound.java new file mode 100644 index 0000000..e783888 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/PositionedSound.java @@ -0,0 +1,68 @@ +package net.minecraft.client.audio; + +import net.minecraft.util.ResourceLocation; + +public abstract class PositionedSound implements ISound +{ + protected final ResourceLocation positionedSoundLocation; + protected float volume = 1.0F; + protected float pitch = 1.0F; + protected float xPosF; + protected float yPosF; + protected float zPosF; + protected boolean repeat = false; + + /** The number of ticks between repeating the sound */ + protected int repeatDelay = 0; + protected ISound.AttenuationType attenuationType = ISound.AttenuationType.LINEAR; + + protected PositionedSound(ResourceLocation soundResource) + { + this.positionedSoundLocation = soundResource; + } + + public ResourceLocation getSoundLocation() + { + return this.positionedSoundLocation; + } + + public boolean canRepeat() + { + return this.repeat; + } + + public int getRepeatDelay() + { + return this.repeatDelay; + } + + public float getVolume() + { + return this.volume; + } + + public float getPitch() + { + return this.pitch; + } + + public float getXPosF() + { + return this.xPosF; + } + + public float getYPosF() + { + return this.yPosF; + } + + public float getZPosF() + { + return this.zPosF; + } + + public ISound.AttenuationType getAttenuationType() + { + return this.attenuationType; + } +} diff --git a/src/minecraft/net/minecraft/client/audio/PositionedSoundRecord.java b/src/minecraft/net/minecraft/client/audio/PositionedSoundRecord.java new file mode 100644 index 0000000..9bd4c9f --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/PositionedSoundRecord.java @@ -0,0 +1,39 @@ +package net.minecraft.client.audio; + +import net.minecraft.util.ResourceLocation; + +public class PositionedSoundRecord extends PositionedSound +{ + public static PositionedSoundRecord create(ResourceLocation soundResource, float pitch) + { + return new PositionedSoundRecord(soundResource, 0.25F, pitch, false, 0, ISound.AttenuationType.NONE, 0.0F, 0.0F, 0.0F); + } + + public static PositionedSoundRecord create(ResourceLocation soundResource) + { + return new PositionedSoundRecord(soundResource, 1.0F, 1.0F, false, 0, ISound.AttenuationType.NONE, 0.0F, 0.0F, 0.0F); + } + + public static PositionedSoundRecord create(ResourceLocation soundResource, float xPosition, float yPosition, float zPosition) + { + return new PositionedSoundRecord(soundResource, 4.0F, 1.0F, false, 0, ISound.AttenuationType.LINEAR, xPosition, yPosition, zPosition); + } + + public PositionedSoundRecord(ResourceLocation soundResource, float volume, float pitch, float xPosition, float yPosition, float zPosition) + { + this(soundResource, volume, pitch, false, 0, ISound.AttenuationType.LINEAR, xPosition, yPosition, zPosition); + } + + private PositionedSoundRecord(ResourceLocation soundResource, float volume, float pitch, boolean repeat, int repeatDelay, ISound.AttenuationType attenuationType, float xPosition, float yPosition, float zPosition) + { + super(soundResource); + this.volume = volume; + this.pitch = pitch; + this.xPosF = xPosition; + this.yPosF = yPosition; + this.zPosF = zPosition; + this.repeat = repeat; + this.repeatDelay = repeatDelay; + this.attenuationType = attenuationType; + } +} diff --git a/src/minecraft/net/minecraft/client/audio/SoundCategory.java b/src/minecraft/net/minecraft/client/audio/SoundCategory.java new file mode 100644 index 0000000..ae0d312 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/SoundCategory.java @@ -0,0 +1,56 @@ +package net.minecraft.client.audio; + +import com.google.common.collect.Maps; +import java.util.Map; + +public enum SoundCategory +{ + MASTER("master", 0), + MUSIC("music", 1), + RECORDS("record", 2), + WEATHER("weather", 3), + BLOCKS("block", 4), + MOBS("hostile", 5), + ANIMALS("neutral", 6), + PLAYERS("player", 7), + AMBIENT("ambient", 8); + + private static final Map NAME_CATEGORY_MAP = Maps.newHashMap(); + private static final Map ID_CATEGORY_MAP = Maps.newHashMap(); + private final String categoryName; + private final int categoryId; + + private SoundCategory(String name, int id) + { + this.categoryName = name; + this.categoryId = id; + } + + public String getCategoryName() + { + return this.categoryName; + } + + public int getCategoryId() + { + return this.categoryId; + } + + public static SoundCategory getCategory(String name) + { + return (SoundCategory)NAME_CATEGORY_MAP.get(name); + } + + static { + for (SoundCategory soundcategory : values()) + { + if (NAME_CATEGORY_MAP.containsKey(soundcategory.getCategoryName()) || ID_CATEGORY_MAP.containsKey(Integer.valueOf(soundcategory.getCategoryId()))) + { + throw new Error("Clash in Sound Category ID & Name pools! Cannot insert " + soundcategory); + } + + NAME_CATEGORY_MAP.put(soundcategory.getCategoryName(), soundcategory); + ID_CATEGORY_MAP.put(Integer.valueOf(soundcategory.getCategoryId()), soundcategory); + } + } +} diff --git a/src/minecraft/net/minecraft/client/audio/SoundEventAccessor.java b/src/minecraft/net/minecraft/client/audio/SoundEventAccessor.java new file mode 100644 index 0000000..570986b --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/SoundEventAccessor.java @@ -0,0 +1,23 @@ +package net.minecraft.client.audio; + +public class SoundEventAccessor implements ISoundEventAccessor +{ + private final SoundPoolEntry entry; + private final int weight; + + SoundEventAccessor(SoundPoolEntry entry, int weight) + { + this.entry = entry; + this.weight = weight; + } + + public int getWeight() + { + return this.weight; + } + + public SoundPoolEntry cloneEntry() + { + return new SoundPoolEntry(this.entry); + } +} diff --git a/src/minecraft/net/minecraft/client/audio/SoundEventAccessorComposite.java b/src/minecraft/net/minecraft/client/audio/SoundEventAccessorComposite.java new file mode 100644 index 0000000..8052f03 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/SoundEventAccessorComposite.java @@ -0,0 +1,80 @@ +package net.minecraft.client.audio; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Random; +import net.minecraft.util.ResourceLocation; + +public class SoundEventAccessorComposite implements ISoundEventAccessor +{ + private final List> soundPool = Lists.>newArrayList(); + private final Random rnd = new Random(); + private final ResourceLocation soundLocation; + private final SoundCategory category; + private double eventPitch; + private double eventVolume; + + public SoundEventAccessorComposite(ResourceLocation soundLocation, double pitch, double volume, SoundCategory category) + { + this.soundLocation = soundLocation; + this.eventVolume = volume; + this.eventPitch = pitch; + this.category = category; + } + + public int getWeight() + { + int i = 0; + + for (ISoundEventAccessor isoundeventaccessor : this.soundPool) + { + i += isoundeventaccessor.getWeight(); + } + + return i; + } + + public SoundPoolEntry cloneEntry() + { + int i = this.getWeight(); + + if (!this.soundPool.isEmpty() && i != 0) + { + int j = this.rnd.nextInt(i); + + for (ISoundEventAccessor isoundeventaccessor : this.soundPool) + { + j -= isoundeventaccessor.getWeight(); + + if (j < 0) + { + SoundPoolEntry soundpoolentry = (SoundPoolEntry)isoundeventaccessor.cloneEntry(); + soundpoolentry.setPitch(soundpoolentry.getPitch() * this.eventPitch); + soundpoolentry.setVolume(soundpoolentry.getVolume() * this.eventVolume); + return soundpoolentry; + } + } + + return SoundHandler.missing_sound; + } + else + { + return SoundHandler.missing_sound; + } + } + + public void addSoundToEventPool(ISoundEventAccessor sound) + { + this.soundPool.add(sound); + } + + public ResourceLocation getSoundEventLocation() + { + return this.soundLocation; + } + + public SoundCategory getSoundCategory() + { + return this.category; + } +} diff --git a/src/minecraft/net/minecraft/client/audio/SoundHandler.java b/src/minecraft/net/minecraft/client/audio/SoundHandler.java new file mode 100644 index 0000000..8bbf7ef --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/SoundHandler.java @@ -0,0 +1,288 @@ +package net.minecraft.client.audio; + +import com.google.common.collect.Lists; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Map.Entry; +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ITickable; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class SoundHandler implements IResourceManagerReloadListener, ITickable +{ + private static final Logger logger = LogManager.getLogger(); + private static final Gson GSON = (new GsonBuilder()).registerTypeAdapter(SoundList.class, new SoundListSerializer()).create(); + private static final ParameterizedType TYPE = new ParameterizedType() + { + public Type[] getActualTypeArguments() + { + return new Type[] {String.class, SoundList.class}; + } + public Type getRawType() + { + return Map.class; + } + public Type getOwnerType() + { + return null; + } + }; + public static final SoundPoolEntry missing_sound = new SoundPoolEntry(new ResourceLocation("meta:missing_sound"), 0.0D, 0.0D, false); + private final SoundRegistry sndRegistry = new SoundRegistry(); + private final SoundManager sndManager; + private final IResourceManager mcResourceManager; + + public SoundHandler(IResourceManager manager, GameSettings gameSettingsIn) + { + this.mcResourceManager = manager; + this.sndManager = new SoundManager(this, gameSettingsIn); + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + this.sndManager.reloadSoundSystem(); + this.sndRegistry.clearMap(); + + for (String s : resourceManager.getResourceDomains()) + { + try + { + for (IResource iresource : resourceManager.getAllResources(new ResourceLocation(s, "sounds.json"))) + { + try + { + Map map = this.getSoundMap(iresource.getInputStream()); + + for (Entry entry : map.entrySet()) + { + this.loadSoundResource(new ResourceLocation(s, (String)entry.getKey()), (SoundList)entry.getValue()); + } + } + catch (RuntimeException runtimeexception) + { + logger.warn((String)"Invalid sounds.json", (Throwable)runtimeexception); + } + } + } + catch (IOException var11) + { + ; + } + } + } + + protected Map getSoundMap(InputStream stream) + { + Map map; + + try + { + map = (Map)GSON.fromJson((Reader)(new InputStreamReader(stream)), TYPE); + } + finally + { + IOUtils.closeQuietly(stream); + } + + return map; + } + + private void loadSoundResource(ResourceLocation location, SoundList sounds) + { + boolean flag = !this.sndRegistry.containsKey(location); + SoundEventAccessorComposite soundeventaccessorcomposite; + + if (!flag && !sounds.canReplaceExisting()) + { + soundeventaccessorcomposite = (SoundEventAccessorComposite)this.sndRegistry.getObject(location); + } + else + { + if (!flag) + { + logger.debug("Replaced sound event location {}", new Object[] {location}); + } + + soundeventaccessorcomposite = new SoundEventAccessorComposite(location, 1.0D, 1.0D, sounds.getSoundCategory()); + this.sndRegistry.registerSound(soundeventaccessorcomposite); + } + + for (final SoundList.SoundEntry soundlist$soundentry : sounds.getSoundList()) + { + String s = soundlist$soundentry.getSoundEntryName(); + ResourceLocation resourcelocation = new ResourceLocation(s); + final String s1 = s.contains(":") ? resourcelocation.getResourceDomain() : location.getResourceDomain(); + Object lvt_10_1_; + + switch (soundlist$soundentry.getSoundEntryType()) + { + case FILE: + ResourceLocation resourcelocation1 = new ResourceLocation(s1, "sounds/" + resourcelocation.getResourcePath() + ".ogg"); + InputStream inputstream = null; + + try + { + inputstream = this.mcResourceManager.getResource(resourcelocation1).getInputStream(); + } + catch (FileNotFoundException var18) + { + logger.warn("File {} does not exist, cannot add it to event {}", new Object[] {resourcelocation1, location}); + continue; + } + catch (IOException ioexception) + { + logger.warn((String)("Could not load sound file " + resourcelocation1 + ", cannot add it to event " + location), (Throwable)ioexception); + continue; + } + finally + { + IOUtils.closeQuietly(inputstream); + } + + lvt_10_1_ = new SoundEventAccessor(new SoundPoolEntry(resourcelocation1, (double)soundlist$soundentry.getSoundEntryPitch(), (double)soundlist$soundentry.getSoundEntryVolume(), soundlist$soundentry.isStreaming()), soundlist$soundentry.getSoundEntryWeight()); + break; + + case SOUND_EVENT: + lvt_10_1_ = new ISoundEventAccessor() + { + final ResourceLocation field_148726_a = new ResourceLocation(s1, soundlist$soundentry.getSoundEntryName()); + public int getWeight() + { + SoundEventAccessorComposite soundeventaccessorcomposite1 = (SoundEventAccessorComposite)SoundHandler.this.sndRegistry.getObject(this.field_148726_a); + return soundeventaccessorcomposite1 == null ? 0 : soundeventaccessorcomposite1.getWeight(); + } + public SoundPoolEntry cloneEntry() + { + SoundEventAccessorComposite soundeventaccessorcomposite1 = (SoundEventAccessorComposite)SoundHandler.this.sndRegistry.getObject(this.field_148726_a); + return soundeventaccessorcomposite1 == null ? SoundHandler.missing_sound : soundeventaccessorcomposite1.cloneEntry(); + } + }; + + break; + default: + throw new IllegalStateException("IN YOU FACE"); + } + + soundeventaccessorcomposite.addSoundToEventPool((ISoundEventAccessor)lvt_10_1_); + } + } + + public SoundEventAccessorComposite getSound(ResourceLocation location) + { + return (SoundEventAccessorComposite)this.sndRegistry.getObject(location); + } + + /** + * Play a sound + */ + public void playSound(ISound sound) + { + this.sndManager.playSound(sound); + } + + /** + * Plays the sound in n ticks + */ + public void playDelayedSound(ISound sound, int delay) + { + this.sndManager.playDelayedSound(sound, delay); + } + + public void setListener(EntityPlayer player, float p_147691_2_) + { + this.sndManager.setListener(player, p_147691_2_); + } + + public void pauseSounds() + { + this.sndManager.pauseAllSounds(); + } + + public void stopSounds() + { + this.sndManager.stopAllSounds(); + } + + public void unloadSounds() + { + this.sndManager.unloadSoundSystem(); + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + this.sndManager.updateAllSounds(); + } + + public void resumeSounds() + { + this.sndManager.resumeAllSounds(); + } + + public void setSoundLevel(SoundCategory category, float volume) + { + if (category == SoundCategory.MASTER && volume <= 0.0F) + { + this.stopSounds(); + } + + this.sndManager.setSoundCategoryVolume(category, volume); + } + + public void stopSound(ISound p_147683_1_) + { + this.sndManager.stopSound(p_147683_1_); + } + + /** + * Returns a random sound from one or more categories + */ + public SoundEventAccessorComposite getRandomSoundFromCategories(SoundCategory... categories) + { + List list = Lists.newArrayList(); + + for (ResourceLocation resourcelocation : this.sndRegistry.getKeys()) + { + SoundEventAccessorComposite soundeventaccessorcomposite = (SoundEventAccessorComposite)this.sndRegistry.getObject(resourcelocation); + + if (ArrayUtils.contains(categories, soundeventaccessorcomposite.getSoundCategory())) + { + list.add(soundeventaccessorcomposite); + } + } + + if (list.isEmpty()) + { + return null; + } + else + { + return (SoundEventAccessorComposite)list.get((new Random()).nextInt(list.size())); + } + } + + public boolean isSoundPlaying(ISound sound) + { + return this.sndManager.isSoundPlaying(sound); + } +} diff --git a/src/minecraft/net/minecraft/client/audio/SoundList.java b/src/minecraft/net/minecraft/client/audio/SoundList.java new file mode 100644 index 0000000..5149285 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/SoundList.java @@ -0,0 +1,136 @@ +package net.minecraft.client.audio; + +import com.google.common.collect.Lists; +import java.util.List; + +public class SoundList +{ + private final List soundList = Lists.newArrayList(); + + /** + * if true it will override all the sounds from the resourcepacks loaded before + */ + private boolean replaceExisting; + private SoundCategory category; + + public List getSoundList() + { + return this.soundList; + } + + public boolean canReplaceExisting() + { + return this.replaceExisting; + } + + public void setReplaceExisting(boolean p_148572_1_) + { + this.replaceExisting = p_148572_1_; + } + + public SoundCategory getSoundCategory() + { + return this.category; + } + + public void setSoundCategory(SoundCategory soundCat) + { + this.category = soundCat; + } + + public static class SoundEntry + { + private String name; + private float volume = 1.0F; + private float pitch = 1.0F; + private int weight = 1; + private SoundList.SoundEntry.Type type = SoundList.SoundEntry.Type.FILE; + private boolean streaming = false; + + public String getSoundEntryName() + { + return this.name; + } + + public void setSoundEntryName(String nameIn) + { + this.name = nameIn; + } + + public float getSoundEntryVolume() + { + return this.volume; + } + + public void setSoundEntryVolume(float volumeIn) + { + this.volume = volumeIn; + } + + public float getSoundEntryPitch() + { + return this.pitch; + } + + public void setSoundEntryPitch(float pitchIn) + { + this.pitch = pitchIn; + } + + public int getSoundEntryWeight() + { + return this.weight; + } + + public void setSoundEntryWeight(int weightIn) + { + this.weight = weightIn; + } + + public SoundList.SoundEntry.Type getSoundEntryType() + { + return this.type; + } + + public void setSoundEntryType(SoundList.SoundEntry.Type typeIn) + { + this.type = typeIn; + } + + public boolean isStreaming() + { + return this.streaming; + } + + public void setStreaming(boolean isStreaming) + { + this.streaming = isStreaming; + } + + public static enum Type + { + FILE("file"), + SOUND_EVENT("event"); + + private final String field_148583_c; + + private Type(String p_i45109_3_) + { + this.field_148583_c = p_i45109_3_; + } + + public static SoundList.SoundEntry.Type getType(String p_148580_0_) + { + for (SoundList.SoundEntry.Type soundlist$soundentry$type : values()) + { + if (soundlist$soundentry$type.field_148583_c.equals(p_148580_0_)) + { + return soundlist$soundentry$type; + } + } + + return null; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/audio/SoundListSerializer.java b/src/minecraft/net/minecraft/client/audio/SoundListSerializer.java new file mode 100644 index 0000000..c4a06e6 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/SoundListSerializer.java @@ -0,0 +1,82 @@ +package net.minecraft.client.audio; + +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.lang.reflect.Type; +import net.minecraft.util.JsonUtils; +import org.apache.commons.lang3.Validate; + +public class SoundListSerializer implements JsonDeserializer +{ + public SoundList deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "entry"); + SoundList soundlist = new SoundList(); + soundlist.setReplaceExisting(JsonUtils.getBoolean(jsonobject, "replace", false)); + SoundCategory soundcategory = SoundCategory.getCategory(JsonUtils.getString(jsonobject, "category", SoundCategory.MASTER.getCategoryName())); + soundlist.setSoundCategory(soundcategory); + Validate.notNull(soundcategory, "Invalid category", new Object[0]); + + if (jsonobject.has("sounds")) + { + JsonArray jsonarray = JsonUtils.getJsonArray(jsonobject, "sounds"); + + for (int i = 0; i < jsonarray.size(); ++i) + { + JsonElement jsonelement = jsonarray.get(i); + SoundList.SoundEntry soundlist$soundentry = new SoundList.SoundEntry(); + + if (JsonUtils.isString(jsonelement)) + { + soundlist$soundentry.setSoundEntryName(JsonUtils.getString(jsonelement, "sound")); + } + else + { + JsonObject jsonobject1 = JsonUtils.getJsonObject(jsonelement, "sound"); + soundlist$soundentry.setSoundEntryName(JsonUtils.getString(jsonobject1, "name")); + + if (jsonobject1.has("type")) + { + SoundList.SoundEntry.Type soundlist$soundentry$type = SoundList.SoundEntry.Type.getType(JsonUtils.getString(jsonobject1, "type")); + Validate.notNull(soundlist$soundentry$type, "Invalid type", new Object[0]); + soundlist$soundentry.setSoundEntryType(soundlist$soundentry$type); + } + + if (jsonobject1.has("volume")) + { + float f = JsonUtils.getFloat(jsonobject1, "volume"); + Validate.isTrue(f > 0.0F, "Invalid volume", new Object[0]); + soundlist$soundentry.setSoundEntryVolume(f); + } + + if (jsonobject1.has("pitch")) + { + float f1 = JsonUtils.getFloat(jsonobject1, "pitch"); + Validate.isTrue(f1 > 0.0F, "Invalid pitch", new Object[0]); + soundlist$soundentry.setSoundEntryPitch(f1); + } + + if (jsonobject1.has("weight")) + { + int j = JsonUtils.getInt(jsonobject1, "weight"); + Validate.isTrue(j > 0, "Invalid weight", new Object[0]); + soundlist$soundentry.setSoundEntryWeight(j); + } + + if (jsonobject1.has("stream")) + { + soundlist$soundentry.setStreaming(JsonUtils.getBoolean(jsonobject1, "stream")); + } + } + + soundlist.getSoundList().add(soundlist$soundentry); + } + } + + return soundlist; + } +} diff --git a/src/minecraft/net/minecraft/client/audio/SoundManager.java b/src/minecraft/net/minecraft/client/audio/SoundManager.java new file mode 100644 index 0000000..320e8a1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/SoundManager.java @@ -0,0 +1,544 @@ +package net.minecraft.client.audio; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Multimap; +import io.netty.util.internal.ThreadLocalRandom; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.MarkerManager; +import paulscode.sound.SoundSystem; +import paulscode.sound.SoundSystemConfig; +import paulscode.sound.SoundSystemException; +import paulscode.sound.SoundSystemLogger; +import paulscode.sound.Source; +import paulscode.sound.codecs.CodecJOrbis; +import paulscode.sound.libraries.LibraryLWJGLOpenAL; + +public class SoundManager +{ + /** The marker used for logging */ + private static final Marker LOG_MARKER = MarkerManager.getMarker("SOUNDS"); + private static final Logger logger = LogManager.getLogger(); + + /** A reference to the sound handler. */ + private final SoundHandler sndHandler; + + /** Reference to the GameSettings object. */ + private final GameSettings options; + + /** A reference to the sound system. */ + private SoundManager.SoundSystemStarterThread sndSystem; + + /** Set to true when the SoundManager has been initialised. */ + private boolean loaded; + + /** A counter for how long the sound manager has been running */ + private int playTime = 0; + private final Map playingSounds = HashBiMap.create(); + private final Map invPlayingSounds; + private Map playingSoundPoolEntries; + private final Multimap categorySounds; + private final List tickableSounds; + private final Map delayedSounds; + private final Map playingSoundsStopTime; + + public SoundManager(SoundHandler p_i45119_1_, GameSettings p_i45119_2_) + { + this.invPlayingSounds = ((BiMap)this.playingSounds).inverse(); + this.playingSoundPoolEntries = Maps.newHashMap(); + this.categorySounds = HashMultimap.create(); + this.tickableSounds = Lists.newArrayList(); + this.delayedSounds = Maps.newHashMap(); + this.playingSoundsStopTime = Maps.newHashMap(); + this.sndHandler = p_i45119_1_; + this.options = p_i45119_2_; + + try + { + SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); + SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); + } + catch (SoundSystemException soundsystemexception) + { + logger.error(LOG_MARKER, (String)"Error linking with the LibraryJavaSound plug-in", (Throwable)soundsystemexception); + } + } + + public void reloadSoundSystem() + { + this.unloadSoundSystem(); + this.loadSoundSystem(); + } + + /** + * Tries to add the paulscode library and the relevant codecs. If it fails, the master volume will be set to zero. + */ + + private synchronized void loadSoundSystem() + { + if (!this.loaded) + { + try + { + (new Thread(new Runnable() + { + public void run() + { + SoundSystemConfig.setLogger(new SoundSystemLogger() + { + public void message(String p_message_1_, int p_message_2_) + { + if (!p_message_1_.isEmpty()) + { + SoundManager.logger.info(p_message_1_); + } + } + public void importantMessage(String p_importantMessage_1_, int p_importantMessage_2_) + { + if (!p_importantMessage_1_.isEmpty()) + { + SoundManager.logger.warn(p_importantMessage_1_); + } + } + public void errorMessage(String p_errorMessage_1_, String p_errorMessage_2_, int p_errorMessage_3_) + { + if (!p_errorMessage_2_.isEmpty()) + { + SoundManager.logger.error("Error in class \'" + p_errorMessage_1_ + "\'"); + SoundManager.logger.error(p_errorMessage_2_); + } + } + }); + SoundManager.this.sndSystem = SoundManager.this.new SoundSystemStarterThread(); + SoundManager.this.loaded = true; + SoundManager.this.sndSystem.setMasterVolume(SoundManager.this.options.getSoundLevel(SoundCategory.MASTER)); + SoundManager.logger.info(SoundManager.LOG_MARKER, "Sound engine started"); + } + }, "Sound Library Loader")).start(); + } + catch (RuntimeException runtimeexception) + { + logger.error(LOG_MARKER, (String)"Error starting SoundSystem. Turning off sounds & music", (Throwable)runtimeexception); + this.options.setSoundLevel(SoundCategory.MASTER, 0.0F); + this.options.saveOptions(); + } + } + } + + /** + * Returns the sound level (between 0.0 and 1.0) for a category, but 1.0 for the master sound category + */ + private float getSoundCategoryVolume(SoundCategory category) + { + return category != null && category != SoundCategory.MASTER ? this.options.getSoundLevel(category) : 1.0F; + } + + /** + * Adjusts volume for currently playing sounds in this category + */ + public void setSoundCategoryVolume(SoundCategory category, float volume) + { + if (this.loaded) + { + if (category == SoundCategory.MASTER) + { + this.sndSystem.setMasterVolume(volume); + } + else + { + for (String s : this.categorySounds.get(category)) + { + ISound isound = (ISound)this.playingSounds.get(s); + float f = this.getNormalizedVolume(isound, (SoundPoolEntry)this.playingSoundPoolEntries.get(isound), category); + + if (f <= 0.0F) + { + this.stopSound(isound); + } + else + { + this.sndSystem.setVolume(s, f); + } + } + } + } + } + + /** + * Cleans up the Sound System + */ + public void unloadSoundSystem() + { + if (this.loaded) + { + this.stopAllSounds(); + this.sndSystem.cleanup(); + this.loaded = false; + } + } + + /** + * Stops all currently playing sounds + */ + public void stopAllSounds() + { + if (this.loaded) + { + for (String s : this.playingSounds.keySet()) + { + this.sndSystem.stop(s); + } + + this.playingSounds.clear(); + this.delayedSounds.clear(); + this.tickableSounds.clear(); + this.categorySounds.clear(); + this.playingSoundPoolEntries.clear(); + this.playingSoundsStopTime.clear(); + } + } + + public void updateAllSounds() + { + ++this.playTime; + + for (ITickableSound itickablesound : this.tickableSounds) + { + itickablesound.update(); + + if (itickablesound.isDonePlaying()) + { + this.stopSound(itickablesound); + } + else + { + String s = (String)this.invPlayingSounds.get(itickablesound); + this.sndSystem.setVolume(s, this.getNormalizedVolume(itickablesound, (SoundPoolEntry)this.playingSoundPoolEntries.get(itickablesound), this.sndHandler.getSound(itickablesound.getSoundLocation()).getSoundCategory())); + this.sndSystem.setPitch(s, this.getNormalizedPitch(itickablesound, (SoundPoolEntry)this.playingSoundPoolEntries.get(itickablesound))); + this.sndSystem.setPosition(s, itickablesound.getXPosF(), itickablesound.getYPosF(), itickablesound.getZPosF()); + } + } + + Iterator> iterator = this.playingSounds.entrySet().iterator(); + + while (iterator.hasNext()) + { + Entry entry = (Entry)iterator.next(); + String s1 = (String)entry.getKey(); + ISound isound = (ISound)entry.getValue(); + + if (!this.sndSystem.playing(s1)) + { + int i = ((Integer)this.playingSoundsStopTime.get(s1)).intValue(); + + if (i <= this.playTime) + { + int j = isound.getRepeatDelay(); + + if (isound.canRepeat() && j > 0) + { + this.delayedSounds.put(isound, Integer.valueOf(this.playTime + j)); + } + + iterator.remove(); + logger.debug(LOG_MARKER, "Removed channel {} because it\'s not playing anymore", new Object[] {s1}); + this.sndSystem.removeSource(s1); + this.playingSoundsStopTime.remove(s1); + this.playingSoundPoolEntries.remove(isound); + + try + { + this.categorySounds.remove(this.sndHandler.getSound(isound.getSoundLocation()).getSoundCategory(), s1); + } + catch (RuntimeException var8) + { + ; + } + + if (isound instanceof ITickableSound) + { + this.tickableSounds.remove(isound); + } + } + } + } + + Iterator> iterator1 = this.delayedSounds.entrySet().iterator(); + + while (iterator1.hasNext()) + { + Entry entry1 = (Entry)iterator1.next(); + + if (this.playTime >= ((Integer)entry1.getValue()).intValue()) + { + ISound isound1 = (ISound)entry1.getKey(); + + if (isound1 instanceof ITickableSound) + { + ((ITickableSound)isound1).update(); + } + + this.playSound(isound1); + iterator1.remove(); + } + } + } + + /** + * Returns true if the sound is playing or still within time + */ + public boolean isSoundPlaying(ISound sound) + { + if (!this.loaded) + { + return false; + } + else + { + String s = (String)this.invPlayingSounds.get(sound); + return s == null ? false : this.sndSystem.playing(s) || this.playingSoundsStopTime.containsKey(s) && ((Integer)this.playingSoundsStopTime.get(s)).intValue() <= this.playTime; + } + } + + public void stopSound(ISound sound) + { + if (this.loaded) + { + String s = (String)this.invPlayingSounds.get(sound); + + if (s != null) + { + this.sndSystem.stop(s); + } + } + } + + public void playSound(ISound sound) + { + if (this.loaded) + { + if (this.sndSystem.getMasterVolume() <= 0.0F) + { + logger.debug(LOG_MARKER, "Skipped playing soundEvent: {}, master volume was zero", new Object[] {sound.getSoundLocation()}); + } + else + { + SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation()); + + if (soundeventaccessorcomposite == null) + { + logger.warn(LOG_MARKER, "Unable to play unknown soundEvent: {}", new Object[] {sound.getSoundLocation()}); + } + else + { + SoundPoolEntry soundpoolentry = soundeventaccessorcomposite.cloneEntry(); + + if (soundpoolentry == SoundHandler.missing_sound) + { + logger.warn(LOG_MARKER, "Unable to play empty soundEvent: {}", new Object[] {soundeventaccessorcomposite.getSoundEventLocation()}); + } + else + { + float f = sound.getVolume(); + float f1 = 16.0F; + + if (f > 1.0F) + { + f1 *= f; + } + + SoundCategory soundcategory = soundeventaccessorcomposite.getSoundCategory(); + float f2 = this.getNormalizedVolume(sound, soundpoolentry, soundcategory); + double d0 = (double)this.getNormalizedPitch(sound, soundpoolentry); + ResourceLocation resourcelocation = soundpoolentry.getSoundPoolEntryLocation(); + + if (f2 == 0.0F) + { + logger.debug(LOG_MARKER, "Skipped playing sound {}, volume was zero.", new Object[] {resourcelocation}); + } + else + { + boolean flag = sound.canRepeat() && sound.getRepeatDelay() == 0; + String s = MathHelper.getRandomUuid(ThreadLocalRandom.current()).toString(); + + if (soundpoolentry.isStreamingSound()) + { + this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); + } + else + { + this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1); + } + + logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.getSoundPoolEntryLocation(), soundeventaccessorcomposite.getSoundEventLocation(), s}); + this.sndSystem.setPitch(s, (float)d0); + this.sndSystem.setVolume(s, f2); + this.sndSystem.play(s); + this.playingSoundsStopTime.put(s, Integer.valueOf(this.playTime + 20)); + this.playingSounds.put(s, sound); + this.playingSoundPoolEntries.put(sound, soundpoolentry); + + if (soundcategory != SoundCategory.MASTER) + { + this.categorySounds.put(soundcategory, s); + } + + if (sound instanceof ITickableSound) + { + this.tickableSounds.add((ITickableSound)sound); + } + } + } + } + } + } + } + + /** + * Normalizes pitch from parameters and clamps to [0.5, 2.0] + */ + private float getNormalizedPitch(ISound sound, SoundPoolEntry entry) + { + return (float)MathHelper.clamp_double((double)sound.getPitch() * entry.getPitch(), 0.5D, 2.0D); + } + + /** + * Normalizes volume level from parameters. Range [0.0, 1.0] + */ + private float getNormalizedVolume(ISound sound, SoundPoolEntry entry, SoundCategory category) + { + return (float)MathHelper.clamp_double((double)sound.getVolume() * entry.getVolume(), 0.0D, 1.0D) * this.getSoundCategoryVolume(category); + } + + /** + * Pauses all currently playing sounds + */ + public void pauseAllSounds() + { + for (String s : this.playingSounds.keySet()) + { + logger.debug(LOG_MARKER, "Pausing channel {}", new Object[] {s}); + this.sndSystem.pause(s); + } + } + + /** + * Resumes playing all currently playing sounds (after pauseAllSounds) + */ + public void resumeAllSounds() + { + for (String s : this.playingSounds.keySet()) + { + logger.debug(LOG_MARKER, "Resuming channel {}", new Object[] {s}); + this.sndSystem.play(s); + } + } + + /** + * Adds a sound to play in n tick + */ + public void playDelayedSound(ISound sound, int delay) + { + this.delayedSounds.put(sound, Integer.valueOf(this.playTime + delay)); + } + + private static URL getURLForSoundResource(final ResourceLocation p_148612_0_) + { + String s = String.format("%s:%s:%s", new Object[] {"mcsounddomain", p_148612_0_.getResourceDomain(), p_148612_0_.getResourcePath()}); + URLStreamHandler urlstreamhandler = new URLStreamHandler() + { + protected URLConnection openConnection(final URL p_openConnection_1_) + { + return new URLConnection(p_openConnection_1_) + { + public void connect() throws IOException + { + } + public InputStream getInputStream() throws IOException + { + return Minecraft.getMinecraft().getResourceManager().getResource(p_148612_0_).getInputStream(); + } + }; + } + }; + + try + { + return new URL((URL)null, s, urlstreamhandler); + } + catch (MalformedURLException var4) + { + throw new Error("TODO: Sanely handle url exception! :D"); + } + } + + /** + * Sets the listener of sounds + */ + public void setListener(EntityPlayer player, float p_148615_2_) + { + if (this.loaded && player != null) + { + float f = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * p_148615_2_; + float f1 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * p_148615_2_; + double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double)p_148615_2_; + double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)p_148615_2_ + (double)player.getEyeHeight(); + double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)p_148615_2_; + float f2 = MathHelper.cos((f1 + 90.0F) * 0.017453292F); + float f3 = MathHelper.sin((f1 + 90.0F) * 0.017453292F); + float f4 = MathHelper.cos(-f * 0.017453292F); + float f5 = MathHelper.sin(-f * 0.017453292F); + float f6 = MathHelper.cos((-f + 90.0F) * 0.017453292F); + float f7 = MathHelper.sin((-f + 90.0F) * 0.017453292F); + float f8 = f2 * f4; + float f9 = f3 * f4; + float f10 = f2 * f6; + float f11 = f3 * f6; + this.sndSystem.setListenerPosition((float)d0, (float)d1, (float)d2); + this.sndSystem.setListenerOrientation(f8, f5, f9, f10, f7, f11); + } + } + + class SoundSystemStarterThread extends SoundSystem + { + private SoundSystemStarterThread() + { + } + + public boolean playing(String p_playing_1_) + { + synchronized (SoundSystemConfig.THREAD_SYNC) + { + if (this.soundLibrary == null) + { + return false; + } + else + { + Source source = (Source)this.soundLibrary.getSources().get(p_playing_1_); + return source == null ? false : source.playing() || source.paused() || source.preLoad; + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/audio/SoundPoolEntry.java b/src/minecraft/net/minecraft/client/audio/SoundPoolEntry.java new file mode 100644 index 0000000..667bd0e --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/SoundPoolEntry.java @@ -0,0 +1,57 @@ +package net.minecraft.client.audio; + +import net.minecraft.util.ResourceLocation; + +public class SoundPoolEntry +{ + private final ResourceLocation location; + private final boolean streamingSound; + private double pitch; + private double volume; + + public SoundPoolEntry(ResourceLocation locationIn, double pitchIn, double volumeIn, boolean streamingSoundIn) + { + this.location = locationIn; + this.pitch = pitchIn; + this.volume = volumeIn; + this.streamingSound = streamingSoundIn; + } + + public SoundPoolEntry(SoundPoolEntry locationIn) + { + this.location = locationIn.location; + this.pitch = locationIn.pitch; + this.volume = locationIn.volume; + this.streamingSound = locationIn.streamingSound; + } + + public ResourceLocation getSoundPoolEntryLocation() + { + return this.location; + } + + public double getPitch() + { + return this.pitch; + } + + public void setPitch(double pitchIn) + { + this.pitch = pitchIn; + } + + public double getVolume() + { + return this.volume; + } + + public void setVolume(double volumeIn) + { + this.volume = volumeIn; + } + + public boolean isStreamingSound() + { + return this.streamingSound; + } +} diff --git a/src/minecraft/net/minecraft/client/audio/SoundRegistry.java b/src/minecraft/net/minecraft/client/audio/SoundRegistry.java new file mode 100644 index 0000000..ec28e61 --- /dev/null +++ b/src/minecraft/net/minecraft/client/audio/SoundRegistry.java @@ -0,0 +1,30 @@ +package net.minecraft.client.audio; + +import com.google.common.collect.Maps; +import java.util.Map; +import net.minecraft.util.RegistrySimple; +import net.minecraft.util.ResourceLocation; + +public class SoundRegistry extends RegistrySimple +{ + private Map soundRegistry; + + protected Map createUnderlyingMap() + { + this.soundRegistry = Maps.newHashMap(); + return this.soundRegistry; + } + + public void registerSound(SoundEventAccessorComposite p_148762_1_) + { + this.putObject(p_148762_1_.getSoundEventLocation(), p_148762_1_); + } + + /** + * Reset the underlying sound map (Called on resource manager reload) + */ + public void clearMap() + { + this.soundRegistry.clear(); + } +} diff --git a/src/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java b/src/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java new file mode 100644 index 0000000..597bdb5 --- /dev/null +++ b/src/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java @@ -0,0 +1,187 @@ +package net.minecraft.client.entity; + +import com.mojang.authlib.GameProfile; +import java.io.File; +import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.ImageBufferDownload; +import net.minecraft.client.renderer.ThreadDownloadImageData; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.DefaultPlayerSkin; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StringUtils; +import net.minecraft.world.World; +import net.minecraft.world.WorldSettings; +import optifine.CapeUtils; +import optifine.Config; +import optifine.PlayerConfigurations; +import optifine.Reflector; + +public abstract class AbstractClientPlayer extends EntityPlayer +{ + private NetworkPlayerInfo playerInfo; + private ResourceLocation locationOfCape = null; + private String nameClear = null; + private static final String __OBFID = "CL_00000935"; + + public AbstractClientPlayer(World worldIn, GameProfile playerProfile) + { + super(worldIn, playerProfile); + this.nameClear = playerProfile.getName(); + + if (this.nameClear != null && !this.nameClear.isEmpty()) + { + this.nameClear = StringUtils.stripControlCodes(this.nameClear); + } + + CapeUtils.downloadCape(this); + PlayerConfigurations.getPlayerConfiguration(this); + } + + /** + * Returns true if the player is in spectator mode. + */ + public boolean isSpectator() + { + NetworkPlayerInfo networkplayerinfo = Minecraft.getMinecraft().getNetHandler().getPlayerInfo(this.getGameProfile().getId()); + return networkplayerinfo != null && networkplayerinfo.getGameType() == WorldSettings.GameType.SPECTATOR; + } + + /** + * Checks if this instance of AbstractClientPlayer has any associated player data. + */ + public boolean hasPlayerInfo() + { + return this.getPlayerInfo() != null; + } + + protected NetworkPlayerInfo getPlayerInfo() + { + if (this.playerInfo == null) + { + this.playerInfo = Minecraft.getMinecraft().getNetHandler().getPlayerInfo(this.getUniqueID()); + } + + return this.playerInfo; + } + + /** + * Returns true if the player has an associated skin. + */ + public boolean hasSkin() + { + NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo(); + return networkplayerinfo != null && networkplayerinfo.hasLocationSkin(); + } + + /** + * Returns true if the player instance has an associated skin. + */ + public ResourceLocation getLocationSkin() + { + NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo(); + return networkplayerinfo == null ? DefaultPlayerSkin.getDefaultSkin(this.getUniqueID()) : networkplayerinfo.getLocationSkin(); + } + + public ResourceLocation getLocationCape() + { + if (!Config.isShowCapes()) + { + return null; + } + else if (this.locationOfCape != null) + { + return this.locationOfCape; + } + else + { + NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo(); + return networkplayerinfo == null ? null : networkplayerinfo.getLocationCape(); + } + } + + public static ThreadDownloadImageData getDownloadImageSkin(ResourceLocation resourceLocationIn, String username) + { + TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); + Object object = texturemanager.getTexture(resourceLocationIn); + + if (object == null) + { + object = new ThreadDownloadImageData((File)null, String.format("http://skins.minecraft.net/MinecraftSkins/%s.png", new Object[] {StringUtils.stripControlCodes(username)}), DefaultPlayerSkin.getDefaultSkin(getOfflineUUID(username)), new ImageBufferDownload()); + texturemanager.loadTexture(resourceLocationIn, (ITextureObject)object); + } + + return (ThreadDownloadImageData)object; + } + + /** + * Returns true if the username has an associated skin. + */ + public static ResourceLocation getLocationSkin(String username) + { + return new ResourceLocation("skins/" + StringUtils.stripControlCodes(username)); + } + + public String getSkinType() + { + NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo(); + return networkplayerinfo == null ? DefaultPlayerSkin.getSkinType(this.getUniqueID()) : networkplayerinfo.getSkinType(); + } + + public float getFovModifier() + { + float f = 1.0F; + + if (this.capabilities.isFlying) + { + f *= 1.1F; + } + + IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + f = (float)((double)f * ((iattributeinstance.getAttributeValue() / (double)this.capabilities.getWalkSpeed() + 1.0D) / 2.0D)); + + if (this.capabilities.getWalkSpeed() == 0.0F || Float.isNaN(f) || Float.isInfinite(f)) + { + f = 1.0F; + } + + if (this.isUsingItem() && this.getItemInUse().getItem() == Items.bow) + { + int i = this.getItemInUseDuration(); + float f1 = (float)i / 20.0F; + + if (f1 > 1.0F) + { + f1 = 1.0F; + } + else + { + f1 = f1 * f1; + } + + f *= 1.0F - f1 * 0.15F; + } + + return Reflector.ForgeHooksClient_getOffsetFOV.exists() ? Reflector.callFloat(Reflector.ForgeHooksClient_getOffsetFOV, new Object[] {this, Float.valueOf(f)}): f; + } + + public String getNameClear() + { + return this.nameClear; + } + + public ResourceLocation getLocationOfCape() + { + return this.locationOfCape; + } + + public void setLocationOfCape(ResourceLocation p_setLocationOfCape_1_) + { + this.locationOfCape = p_setLocationOfCape_1_; + } +} diff --git a/src/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java b/src/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java new file mode 100644 index 0000000..dd3349c --- /dev/null +++ b/src/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java @@ -0,0 +1,175 @@ +package net.minecraft.client.entity; + +import com.mojang.authlib.GameProfile; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityOtherPlayerMP extends AbstractClientPlayer +{ + private boolean isItemInUse; + private int otherPlayerMPPosRotationIncrements; + private double otherPlayerMPX; + private double otherPlayerMPY; + private double otherPlayerMPZ; + private double otherPlayerMPYaw; + private double otherPlayerMPPitch; + + public EntityOtherPlayerMP(World worldIn, GameProfile gameProfileIn) + { + super(worldIn, gameProfileIn); + this.stepHeight = 0.0F; + this.noClip = true; + this.renderOffsetY = 0.25F; + this.renderDistanceWeight = 10.0D; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + return true; + } + + public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + { + this.otherPlayerMPX = x; + this.otherPlayerMPY = y; + this.otherPlayerMPZ = z; + this.otherPlayerMPYaw = (double)yaw; + this.otherPlayerMPPitch = (double)pitch; + this.otherPlayerMPPosRotationIncrements = posRotationIncrements; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.renderOffsetY = 0.0F; + super.onUpdate(); + this.prevLimbSwingAmount = this.limbSwingAmount; + double d0 = this.posX - this.prevPosX; + double d1 = this.posZ - this.prevPosZ; + float f = MathHelper.sqrt_double(d0 * d0 + d1 * d1) * 4.0F; + + if (f > 1.0F) + { + f = 1.0F; + } + + this.limbSwingAmount += (f - this.limbSwingAmount) * 0.4F; + this.limbSwing += this.limbSwingAmount; + + if (!this.isItemInUse && this.isEating() && this.inventory.mainInventory[this.inventory.currentItem] != null) + { + ItemStack itemstack = this.inventory.mainInventory[this.inventory.currentItem]; + this.setItemInUse(this.inventory.mainInventory[this.inventory.currentItem], itemstack.getItem().getMaxItemUseDuration(itemstack)); + this.isItemInUse = true; + } + else if (this.isItemInUse && !this.isEating()) + { + this.clearItemInUse(); + this.isItemInUse = false; + } + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.otherPlayerMPPosRotationIncrements > 0) + { + double d0 = this.posX + (this.otherPlayerMPX - this.posX) / (double)this.otherPlayerMPPosRotationIncrements; + double d1 = this.posY + (this.otherPlayerMPY - this.posY) / (double)this.otherPlayerMPPosRotationIncrements; + double d2 = this.posZ + (this.otherPlayerMPZ - this.posZ) / (double)this.otherPlayerMPPosRotationIncrements; + double d3; + + for (d3 = this.otherPlayerMPYaw - (double)this.rotationYaw; d3 < -180.0D; d3 += 360.0D) + { + ; + } + + while (d3 >= 180.0D) + { + d3 -= 360.0D; + } + + this.rotationYaw = (float)((double)this.rotationYaw + d3 / (double)this.otherPlayerMPPosRotationIncrements); + this.rotationPitch = (float)((double)this.rotationPitch + (this.otherPlayerMPPitch - (double)this.rotationPitch) / (double)this.otherPlayerMPPosRotationIncrements); + --this.otherPlayerMPPosRotationIncrements; + this.setPosition(d0, d1, d2); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + + this.prevCameraYaw = this.cameraYaw; + this.updateArmSwingProgress(); + float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + float f = (float)Math.atan(-this.motionY * 0.20000000298023224D) * 15.0F; + + if (f1 > 0.1F) + { + f1 = 0.1F; + } + + if (!this.onGround || this.getHealth() <= 0.0F) + { + f1 = 0.0F; + } + + if (this.onGround || this.getHealth() <= 0.0F) + { + f = 0.0F; + } + + this.cameraYaw += (f1 - this.cameraYaw) * 0.4F; + this.cameraPitch += (f - this.cameraPitch) * 0.8F; + } + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public void setCurrentItemOrArmor(int slotIn, ItemStack stack) + { + if (slotIn == 0) + { + this.inventory.mainInventory[this.inventory.currentItem] = stack; + } + else + { + this.inventory.armorInventory[slotIn - 1] = stack; + } + } + + /** + * Send a chat message to the CommandSender + */ + public void addChatMessage(IChatComponent component) + { + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(component); + } + + /** + * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not + */ + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { + return false; + } + + /** + * Get the position in the world. {@code null} is not allowed! If you are not an entity in the world, return + * the coordinates 0, 0, 0 + */ + public BlockPos getPosition() + { + return new BlockPos(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D); + } +} diff --git a/src/minecraft/net/minecraft/client/entity/EntityPlayerSP.java b/src/minecraft/net/minecraft/client/entity/EntityPlayerSP.java new file mode 100644 index 0000000..d88b770 --- /dev/null +++ b/src/minecraft/net/minecraft/client/entity/EntityPlayerSP.java @@ -0,0 +1,922 @@ +package net.minecraft.client.entity; + +import animeware.event.impl.EventUpdate; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.MovingSoundMinecartRiding; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.gui.GuiCommandBlock; +import net.minecraft.client.gui.GuiEnchantment; +import net.minecraft.client.gui.GuiHopper; +import net.minecraft.client.gui.GuiMerchant; +import net.minecraft.client.gui.GuiRepair; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiScreenBook; +import net.minecraft.client.gui.inventory.GuiBeacon; +import net.minecraft.client.gui.inventory.GuiBrewingStand; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.gui.inventory.GuiCrafting; +import net.minecraft.client.gui.inventory.GuiDispenser; +import net.minecraft.client.gui.inventory.GuiEditSign; +import net.minecraft.client.gui.inventory.GuiFurnace; +import net.minecraft.client.gui.inventory.GuiScreenHorseInventory; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.command.server.CommandBlockLogic; +import net.minecraft.entity.Entity; +import net.minecraft.entity.IMerchant; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C01PacketChatMessage; +import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.client.C0APacketAnimation; +import net.minecraft.network.play.client.C0BPacketEntityAction; +import net.minecraft.network.play.client.C0CPacketInput; +import net.minecraft.network.play.client.C0DPacketCloseWindow; +import net.minecraft.network.play.client.C13PacketPlayerAbilities; +import net.minecraft.network.play.client.C16PacketClientStatus; +import net.minecraft.potion.Potion; +import net.minecraft.stats.StatBase; +import net.minecraft.stats.StatFileWriter; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MovementInput; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IInteractionObject; +import net.minecraft.world.World; + +public class EntityPlayerSP extends AbstractClientPlayer +{ + public final NetHandlerPlayClient sendQueue; + private final StatFileWriter statWriter; + + /** + * The last X position which was transmitted to the server, used to determine when the X position changes and needs + * to be re-trasmitted + */ + private double lastReportedPosX; + + /** + * The last Y position which was transmitted to the server, used to determine when the Y position changes and needs + * to be re-transmitted + */ + private double lastReportedPosY; + + /** + * The last Z position which was transmitted to the server, used to determine when the Z position changes and needs + * to be re-transmitted + */ + private double lastReportedPosZ; + + /** + * The last yaw value which was transmitted to the server, used to determine when the yaw changes and needs to be + * re-transmitted + */ + private float lastReportedYaw; + + /** + * The last pitch value which was transmitted to the server, used to determine when the pitch changes and needs to + * be re-transmitted + */ + private float lastReportedPitch; + + /** the last sneaking state sent to the server */ + private boolean serverSneakState; + + /** the last sprinting state sent to the server */ + private boolean serverSprintState; + + /** + * Reset to 0 every time position is sent to the server, used to send periodic updates every 20 ticks even when the + * player is not moving. + */ + private int positionUpdateTicks; + private boolean hasValidHealth; + private String clientBrand; + private String speed; + public MovementInput movementInput; + protected Minecraft mc; + + /** + * Used to tell if the player pressed forward twice. If this is at 0 and it's pressed (And they are allowed to + * sprint, aka enough food on the ground etc) it sets this to 7. If it's pressed and it's greater than 0 enable + * sprinting. + */ + protected int sprintToggleTimer; + + /** Ticks left before sprinting is disabled. */ + public int sprintingTicksLeft; + public float renderArmYaw; + public float renderArmPitch; + public float prevRenderArmYaw; + public float prevRenderArmPitch; + private int horseJumpPowerCounter; + private float horseJumpPower; + + /** The amount of time an entity has been in a Portal */ + public float timeInPortal; + + /** The amount of time an entity has been in a Portal the previous tick */ + public float prevTimeInPortal; + + public EntityPlayerSP(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandler, StatFileWriter statFile) + { + super(worldIn, netHandler.getGameProfile()); + this.sendQueue = netHandler; + this.statWriter = statFile; + this.mc = mcIn; + this.dimension = 0; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + return false; + } + + /** + * Heal living entity (param: amount of half-hearts) + */ + public void heal(float healAmount) + { + } + + /** + * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. + */ + public void mountEntity(Entity entityIn) + { + super.mountEntity(entityIn); + + if (entityIn instanceof EntityMinecart) + { + this.mc.getSoundHandler().playSound(new MovingSoundMinecartRiding(this, (EntityMinecart)entityIn)); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + + EventUpdate event = new EventUpdate(); + event.call(); + + if (this.worldObj.isBlockLoaded(new BlockPos(this.posX, 0.0D, this.posZ))) + { + super.onUpdate(); + + if (this.isRiding()) + { + this.sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(this.rotationYaw, this.rotationPitch, this.onGround)); + this.sendQueue.addToSendQueue(new C0CPacketInput(this.moveStrafing, this.moveForward, this.movementInput.jump, this.movementInput.sneak)); + } + else + { + this.onUpdateWalkingPlayer(); + } + } + } + + /** + * called every tick when the player is on foot. Performs all the things that normally happen during movement. + */ + public void onUpdateWalkingPlayer() + { + boolean flag = this.isSprinting(); + + if (flag != this.serverSprintState) + { + if (flag) + { + this.sendQueue.addToSendQueue(new C0BPacketEntityAction(this, C0BPacketEntityAction.Action.START_SPRINTING)); + } + else + { + this.sendQueue.addToSendQueue(new C0BPacketEntityAction(this, C0BPacketEntityAction.Action.STOP_SPRINTING)); + } + + this.serverSprintState = flag; + } + + boolean flag1 = this.isSneaking(); + + if (flag1 != this.serverSneakState) + { + if (flag1) + { + this.sendQueue.addToSendQueue(new C0BPacketEntityAction(this, C0BPacketEntityAction.Action.START_SNEAKING)); + } + else + { + this.sendQueue.addToSendQueue(new C0BPacketEntityAction(this, C0BPacketEntityAction.Action.STOP_SNEAKING)); + } + + this.serverSneakState = flag1; + } + + if (this.isCurrentViewEntity()) + { + double d0 = this.posX - this.lastReportedPosX; + double d1 = this.getEntityBoundingBox().minY - this.lastReportedPosY; + double d2 = this.posZ - this.lastReportedPosZ; + double d3 = (double)(this.rotationYaw - this.lastReportedYaw); + double d4 = (double)(this.rotationPitch - this.lastReportedPitch); + boolean flag2 = d0 * d0 + d1 * d1 + d2 * d2 > 9.0E-4D || this.positionUpdateTicks >= 20; + boolean flag3 = d3 != 0.0D || d4 != 0.0D; + + if (this.ridingEntity == null) + { + if (flag2 && flag3) + { + this.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(this.posX, this.getEntityBoundingBox().minY, this.posZ, this.rotationYaw, this.rotationPitch, this.onGround)); + } + else if (flag2) + { + this.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(this.posX, this.getEntityBoundingBox().minY, this.posZ, this.onGround)); + } + else if (flag3) + { + this.sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(this.rotationYaw, this.rotationPitch, this.onGround)); + } + else + { + this.sendQueue.addToSendQueue(new C03PacketPlayer(this.onGround)); + } + } + else + { + this.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(this.motionX, -999.0D, this.motionZ, this.rotationYaw, this.rotationPitch, this.onGround)); + flag2 = false; + } + + ++this.positionUpdateTicks; + + if (flag2) + { + this.lastReportedPosX = this.posX; + this.lastReportedPosY = this.getEntityBoundingBox().minY; + this.lastReportedPosZ = this.posZ; + this.positionUpdateTicks = 0; + } + + if (flag3) + { + this.lastReportedYaw = this.rotationYaw; + this.lastReportedPitch = this.rotationPitch; + } + } + } + + /** + * Called when player presses the drop item key + */ + public EntityItem dropOneItem(boolean dropAll) + { + C07PacketPlayerDigging.Action c07packetplayerdigging$action = dropAll ? C07PacketPlayerDigging.Action.DROP_ALL_ITEMS : C07PacketPlayerDigging.Action.DROP_ITEM; + this.sendQueue.addToSendQueue(new C07PacketPlayerDigging(c07packetplayerdigging$action, BlockPos.ORIGIN, EnumFacing.DOWN)); + return null; + } + + /** + * Joins the passed in entity item with the world. Args: entityItem + */ + protected void joinEntityItemWithWorld(EntityItem itemIn) + { + } + + /** + * Sends a chat message from the player. Args: chatMessage + */ + public void sendChatMessage(String message) + { + this.sendQueue.addToSendQueue(new C01PacketChatMessage(message)); + } + + /** + * Swings the item the player is holding. + */ + public void swingItem() + { + super.swingItem(); + this.sendQueue.addToSendQueue(new C0APacketAnimation()); + } + + public void respawnPlayer() + { + this.sendQueue.addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.PERFORM_RESPAWN)); + } + + /** + * Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first and then health + * second with the reduced value. Args: damageAmount + */ + protected void damageEntity(DamageSource damageSrc, float damageAmount) + { + if (!this.isEntityInvulnerable(damageSrc)) + { + this.setHealth(this.getHealth() - damageAmount); + } + } + + /** + * set current crafting inventory back to the 2x2 square + */ + public void closeScreen() + { + this.sendQueue.addToSendQueue(new C0DPacketCloseWindow(this.openContainer.windowId)); + this.closeScreenAndDropStack(); + } + + public void closeScreenAndDropStack() + { + this.inventory.setItemStack((ItemStack)null); + super.closeScreen(); + this.mc.displayGuiScreen((GuiScreen)null); + } + + /** + * Updates health locally. + */ + public void setPlayerSPHealth(float health) + { + if (this.hasValidHealth) + { + float f = this.getHealth() - health; + + if (f <= 0.0F) + { + this.setHealth(health); + + if (f < 0.0F) + { + this.hurtResistantTime = this.maxHurtResistantTime / 2; + } + } + else + { + this.lastDamage = f; + this.setHealth(this.getHealth()); + this.hurtResistantTime = this.maxHurtResistantTime; + this.damageEntity(DamageSource.generic, f); + this.hurtTime = this.maxHurtTime = 10; + } + } + else + { + this.setHealth(health); + this.hasValidHealth = true; + } + } + + /** + * Adds a value to a statistic field. + */ + public void addStat(StatBase stat, int amount) + { + if (stat != null) + { + if (stat.isIndependent) + { + super.addStat(stat, amount); + } + } + } + + /** + * Sends the player's abilities to the server (if there is one). + */ + public void sendPlayerAbilities() + { + this.sendQueue.addToSendQueue(new C13PacketPlayerAbilities(this.capabilities)); + } + + /** + * returns true if this is an EntityPlayerSP, or the logged in player. + */ + public boolean isUser() + { + return true; + } + + protected void sendHorseJump() + { + this.sendQueue.addToSendQueue(new C0BPacketEntityAction(this, C0BPacketEntityAction.Action.RIDING_JUMP, (int)(this.getHorseJumpPower() * 100.0F))); + } + + public void sendHorseInventory() + { + this.sendQueue.addToSendQueue(new C0BPacketEntityAction(this, C0BPacketEntityAction.Action.OPEN_INVENTORY)); + } + + public void setClientBrand(String brand) + { + this.clientBrand = brand; + } + + public String getClientBrand() + { + return this.clientBrand; + } + + public StatFileWriter getStatFileWriter() + { + return this.statWriter; + } + + public void addChatComponentMessage(IChatComponent chatComponent) + { + this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent); + } + + protected boolean pushOutOfBlocks(double x, double y, double z) + { + if (this.noClip) + { + return false; + } + else + { + BlockPos blockpos = new BlockPos(x, y, z); + double d0 = x - (double)blockpos.getX(); + double d1 = z - (double)blockpos.getZ(); + + if (!this.isOpenBlockSpace(blockpos)) + { + int i = -1; + double d2 = 9999.0D; + + if (this.isOpenBlockSpace(blockpos.west()) && d0 < d2) + { + d2 = d0; + i = 0; + } + + if (this.isOpenBlockSpace(blockpos.east()) && 1.0D - d0 < d2) + { + d2 = 1.0D - d0; + i = 1; + } + + if (this.isOpenBlockSpace(blockpos.north()) && d1 < d2) + { + d2 = d1; + i = 4; + } + + if (this.isOpenBlockSpace(blockpos.south()) && 1.0D - d1 < d2) + { + d2 = 1.0D - d1; + i = 5; + } + + float f = 0.1F; + + if (i == 0) + { + this.motionX = (double)(-f); + } + + if (i == 1) + { + this.motionX = (double)f; + } + + if (i == 4) + { + this.motionZ = (double)(-f); + } + + if (i == 5) + { + this.motionZ = (double)f; + } + } + + return false; + } + } + + /** + * Returns true if the block at the given BlockPos and the block above it are NOT full cubes. + */ + private boolean isOpenBlockSpace(BlockPos pos) + { + return !this.worldObj.getBlockState(pos).getBlock().isNormalCube() && !this.worldObj.getBlockState(pos.up()).getBlock().isNormalCube(); + } + + /** + * Set sprinting switch for Entity. + */ + public void setSprinting(boolean sprinting) + { + super.setSprinting(sprinting); + this.sprintingTicksLeft = sprinting ? 600 : 0; + } + + /** + * Sets the current XP, total XP, and level number. + */ + public void setXPStats(float currentXP, int maxXP, int level) + { + this.experience = currentXP; + this.experienceTotal = maxXP; + this.experienceLevel = level; + } + + /** + * Send a chat message to the CommandSender + */ + public void addChatMessage(IChatComponent component) + { + this.mc.ingameGUI.getChatGUI().printChatMessage(component); + } + + /** + * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not + */ + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { + return permLevel <= 0; + } + + /** + * Get the position in the world. {@code null} is not allowed! If you are not an entity in the world, return + * the coordinates 0, 0, 0 + */ + public BlockPos getPosition() + { + return new BlockPos(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D); + } + + public void playSound(String name, float volume, float pitch) + { + this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume, pitch, false); + } + + /** + * Returns whether the entity is in a server world + */ + public boolean isServerWorld() + { + return true; + } + + public boolean isRidingHorse() + { + return this.ridingEntity != null && this.ridingEntity instanceof EntityHorse && ((EntityHorse)this.ridingEntity).isHorseSaddled(); + } + + public float getHorseJumpPower() + { + return this.horseJumpPower; + } + + public void openEditSign(TileEntitySign signTile) + { + this.mc.displayGuiScreen(new GuiEditSign(signTile)); + } + + public void openEditCommandBlock(CommandBlockLogic cmdBlockLogic) + { + this.mc.displayGuiScreen(new GuiCommandBlock(cmdBlockLogic)); + } + + /** + * Displays the GUI for interacting with a book. + */ + public void displayGUIBook(ItemStack bookStack) + { + Item item = bookStack.getItem(); + + if (item == Items.writable_book) + { + this.mc.displayGuiScreen(new GuiScreenBook(this, bookStack, true)); + } + } + + /** + * Displays the GUI for interacting with a chest inventory. Args: chestInventory + */ + public void displayGUIChest(IInventory chestInventory) + { + String s = chestInventory instanceof IInteractionObject ? ((IInteractionObject)chestInventory).getGuiID() : "minecraft:container"; + + if ("minecraft:chest".equals(s)) + { + this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory)); + } + else if ("minecraft:hopper".equals(s)) + { + this.mc.displayGuiScreen(new GuiHopper(this.inventory, chestInventory)); + } + else if ("minecraft:furnace".equals(s)) + { + this.mc.displayGuiScreen(new GuiFurnace(this.inventory, chestInventory)); + } + else if ("minecraft:brewing_stand".equals(s)) + { + this.mc.displayGuiScreen(new GuiBrewingStand(this.inventory, chestInventory)); + } + else if ("minecraft:beacon".equals(s)) + { + this.mc.displayGuiScreen(new GuiBeacon(this.inventory, chestInventory)); + } + else if (!"minecraft:dispenser".equals(s) && !"minecraft:dropper".equals(s)) + { + this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory)); + } + else + { + this.mc.displayGuiScreen(new GuiDispenser(this.inventory, chestInventory)); + } + } + + public void displayGUIHorse(EntityHorse horse, IInventory horseInventory) + { + this.mc.displayGuiScreen(new GuiScreenHorseInventory(this.inventory, horseInventory, horse)); + } + + public void displayGui(IInteractionObject guiOwner) + { + String s = guiOwner.getGuiID(); + + if ("minecraft:crafting_table".equals(s)) + { + this.mc.displayGuiScreen(new GuiCrafting(this.inventory, this.worldObj)); + } + else if ("minecraft:enchanting_table".equals(s)) + { + this.mc.displayGuiScreen(new GuiEnchantment(this.inventory, this.worldObj, guiOwner)); + } + else if ("minecraft:anvil".equals(s)) + { + this.mc.displayGuiScreen(new GuiRepair(this.inventory, this.worldObj)); + } + } + + public void displayVillagerTradeGui(IMerchant villager) + { + this.mc.displayGuiScreen(new GuiMerchant(this.inventory, villager, this.worldObj)); + } + + /** + * Called when the player performs a critical hit on the Entity. Args: entity that was hit critically + */ + public void onCriticalHit(Entity entityHit) + { + this.mc.effectRenderer.emitParticleAtEntity(entityHit, EnumParticleTypes.CRIT); + } + + public void onEnchantmentCritical(Entity entityHit) + { + this.mc.effectRenderer.emitParticleAtEntity(entityHit, EnumParticleTypes.CRIT_MAGIC); + } + + /** + * Returns if this entity is sneaking. + */ + public boolean isSneaking() + { + boolean flag = this.movementInput != null ? this.movementInput.sneak : false; + return flag && !this.sleeping; + } + + public void updateEntityActionState() + { + super.updateEntityActionState(); + + if (this.isCurrentViewEntity()) + { + this.moveStrafing = this.movementInput.moveStrafe; + this.moveForward = this.movementInput.moveForward; + this.isJumping = this.movementInput.jump; + this.prevRenderArmYaw = this.renderArmYaw; + this.prevRenderArmPitch = this.renderArmPitch; + this.renderArmPitch = (float)((double)this.renderArmPitch + (double)(this.rotationPitch - this.renderArmPitch) * 0.5D); + this.renderArmYaw = (float)((double)this.renderArmYaw + (double)(this.rotationYaw - this.renderArmYaw) * 0.5D); + } + } + + protected boolean isCurrentViewEntity() + { + return this.mc.getRenderViewEntity() == this; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.sprintingTicksLeft > 0) + { + --this.sprintingTicksLeft; + + if (this.sprintingTicksLeft == 0) + { + this.setSprinting(false); + } + } + + if (this.sprintToggleTimer > 0) + { + --this.sprintToggleTimer; + } + + this.prevTimeInPortal = this.timeInPortal; + + if (this.inPortal) + { + if (this.mc.currentScreen != null && !this.mc.currentScreen.doesGuiPauseGame()) + { + this.mc.displayGuiScreen((GuiScreen)null); + } + + if (this.timeInPortal == 0.0F) + { + this.mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("portal.trigger"), this.rand.nextFloat() * 0.4F + 0.8F)); + } + + this.timeInPortal += 0.0125F; + + if (this.timeInPortal >= 1.0F) + { + this.timeInPortal = 1.0F; + } + + this.inPortal = false; + } + else if (this.isPotionActive(Potion.confusion) && this.getActivePotionEffect(Potion.confusion).getDuration() > 60) + { + this.timeInPortal += 0.006666667F; + + if (this.timeInPortal > 1.0F) + { + this.timeInPortal = 1.0F; + } + } + else + { + if (this.timeInPortal > 0.0F) + { + this.timeInPortal -= 0.05F; + } + + if (this.timeInPortal < 0.0F) + { + this.timeInPortal = 0.0F; + } + } + + if (this.timeUntilPortal > 0) + { + --this.timeUntilPortal; + } + + boolean flag = this.movementInput.jump; + boolean flag1 = this.movementInput.sneak; + float f = 0.8F; + boolean flag2 = this.movementInput.moveForward >= f; + this.movementInput.updatePlayerMoveState(); + + if (this.isUsingItem() && !this.isRiding()) + { + this.movementInput.moveStrafe *= 0.2F; + this.movementInput.moveForward *= 0.2F; + this.sprintToggleTimer = 0; + } + + this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.getEntityBoundingBox().minY + 0.5D, this.posZ + (double)this.width * 0.35D); + this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.getEntityBoundingBox().minY + 0.5D, this.posZ - (double)this.width * 0.35D); + this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.getEntityBoundingBox().minY + 0.5D, this.posZ - (double)this.width * 0.35D); + this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.getEntityBoundingBox().minY + 0.5D, this.posZ + (double)this.width * 0.35D); + boolean flag3 = (float)this.getFoodStats().getFoodLevel() > 6.0F || this.capabilities.allowFlying; + + if (this.onGround && !flag1 && !flag2 && this.movementInput.moveForward >= f && !this.isSprinting() && flag3 && !this.isUsingItem() && !this.isPotionActive(Potion.blindness)) + { + if (this.sprintToggleTimer <= 0 && !this.mc.gameSettings.keyBindSprint.isKeyDown()) + { + this.sprintToggleTimer = 7; + } + else + { + this.setSprinting(true); + } + } + + if (!this.isSprinting() && this.movementInput.moveForward >= f && flag3 && !this.isUsingItem() && !this.isPotionActive(Potion.blindness) && this.mc.gameSettings.keyBindSprint.isKeyDown()) + { + this.setSprinting(true); + } + + if (this.isSprinting() && (this.movementInput.moveForward < f || this.isCollidedHorizontally || !flag3)) + { + this.setSprinting(false); + } + + if (this.capabilities.allowFlying) + { + if (this.mc.playerController.isSpectatorMode()) + { + if (!this.capabilities.isFlying) + { + this.capabilities.isFlying = true; + this.sendPlayerAbilities(); + } + } + else if (!flag && this.movementInput.jump) + { + if (this.flyToggleTimer == 0) + { + this.flyToggleTimer = 7; + } + else + { + this.capabilities.isFlying = !this.capabilities.isFlying; + this.sendPlayerAbilities(); + this.flyToggleTimer = 0; + } + } + } + + if (this.capabilities.isFlying && this.isCurrentViewEntity()) + { + if (this.movementInput.sneak) + { + this.motionY -= (double)(this.capabilities.getFlySpeed() * 3.0F); + } + + if (this.movementInput.jump) + { + this.motionY += (double)(this.capabilities.getFlySpeed() * 3.0F); + } + } + + if (this.isRidingHorse()) + { + if (this.horseJumpPowerCounter < 0) + { + ++this.horseJumpPowerCounter; + + if (this.horseJumpPowerCounter == 0) + { + this.horseJumpPower = 0.0F; + } + } + + if (flag && !this.movementInput.jump) + { + this.horseJumpPowerCounter = -10; + this.sendHorseJump(); + } + else if (!flag && this.movementInput.jump) + { + this.horseJumpPowerCounter = 0; + this.horseJumpPower = 0.0F; + } + else if (flag) + { + ++this.horseJumpPowerCounter; + + if (this.horseJumpPowerCounter < 10) + { + this.horseJumpPower = (float)this.horseJumpPowerCounter * 0.1F; + } + else + { + this.horseJumpPower = 0.8F + 2.0F / (float)(this.horseJumpPowerCounter - 9) * 0.1F; + } + } + } + else + { + this.horseJumpPower = 0.0F; + } + + super.onLivingUpdate(); + + if (this.onGround && this.capabilities.isFlying && !this.mc.playerController.isSpectatorMode()) + { + this.capabilities.isFlying = false; + this.sendPlayerAbilities(); + } + } + double speed1 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + public String getSpeed() { + + return speed; + + } +} diff --git a/src/minecraft/net/minecraft/client/gui/ChatLine.java b/src/minecraft/net/minecraft/client/gui/ChatLine.java new file mode 100644 index 0000000..c971487 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/ChatLine.java @@ -0,0 +1,37 @@ +package net.minecraft.client.gui; + +import net.minecraft.util.IChatComponent; + +public class ChatLine +{ + /** GUI Update Counter value this Line was created at */ + private final int updateCounterCreated; + private final IChatComponent lineString; + + /** + * int value to refer to existing Chat Lines, can be 0 which means unreferrable + */ + private final int chatLineID; + + public ChatLine(int p_i45000_1_, IChatComponent p_i45000_2_, int p_i45000_3_) + { + this.lineString = p_i45000_2_; + this.updateCounterCreated = p_i45000_1_; + this.chatLineID = p_i45000_3_; + } + + public IChatComponent getChatComponent() + { + return this.lineString; + } + + public int getUpdatedCounter() + { + return this.updateCounterCreated; + } + + public int getChatLineID() + { + return this.chatLineID; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/FontRenderer.java b/src/minecraft/net/minecraft/client/gui/FontRenderer.java new file mode 100644 index 0000000..04021bf --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/FontRenderer.java @@ -0,0 +1,1079 @@ +package net.minecraft.client.gui; + +import com.ibm.icu.text.ArabicShaping; +import com.ibm.icu.text.ArabicShapingException; +import com.ibm.icu.text.Bidi; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import java.util.Random; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import optifine.CustomColors; +import optifine.FontUtils; + +import org.apache.commons.io.IOUtils; +import org.lwjgl.opengl.GL11; + +public class FontRenderer implements IResourceManagerReloadListener +{ + private static final ResourceLocation[] unicodePageLocations = new ResourceLocation[256]; + + /** Array of width of all the characters in default.png */ + private float[] charWidth = new float[256]; + + /** the height in pixels of default text */ + public int FONT_HEIGHT = 9; + public Random fontRandom = new Random(); + + /** + * Array of the start/end column (in upper/lower nibble) for every glyph in the /font directory. + */ + private byte[] glyphWidth = new byte[65536]; + + /** + * Array of RGB triplets defining the 16 standard chat colors followed by 16 darker version of the same colors for + * drop shadows. + */ + private int[] colorCode = new int[32]; + private ResourceLocation locationFontTexture; + + /** The RenderEngine used to load and setup glyph textures. */ + private final TextureManager renderEngine; + + /** Current X coordinate at which to draw the next character. */ + private float posX; + + /** Current Y coordinate at which to draw the next character. */ + private float posY; + + /** + * If true, strings should be rendered with Unicode fonts instead of the default.png font + */ + private boolean unicodeFlag; + + /** + * If true, the Unicode Bidirectional Algorithm should be run before rendering any string. + */ + private boolean bidiFlag; + + /** Used to specify new red value for the current color. */ + private float red; + + /** Used to specify new blue value for the current color. */ + private float blue; + + /** Used to specify new green value for the current color. */ + private float green; + + /** Used to speify new alpha value for the current color. */ + private float alpha; + + /** Text color of the currently rendering string. */ + private int textColor; + + /** Set if the "k" style (random) is active in currently rendering string */ + private boolean randomStyle; + + /** Set if the "l" style (bold) is active in currently rendering string */ + private boolean boldStyle; + + /** Set if the "o" style (italic) is active in currently rendering string */ + private boolean italicStyle; + + /** + * Set if the "n" style (underlined) is active in currently rendering string + */ + private boolean underlineStyle; + + /** + * Set if the "m" style (strikethrough) is active in currently rendering string + */ + private boolean strikethroughStyle; + private static final String __OBFID = "CL_00000660"; + public GameSettings gameSettings; + public ResourceLocation locationFontTextureBase; + public boolean enabled = true; + public float offsetBold = 1.0F; + + public FontRenderer(GameSettings gameSettingsIn, ResourceLocation location, TextureManager textureManagerIn, boolean unicode) + { + this.gameSettings = gameSettingsIn; + this.locationFontTextureBase = location; + this.locationFontTexture = location; + this.renderEngine = textureManagerIn; + this.unicodeFlag = unicode; + this.locationFontTexture = FontUtils.getHdFontLocation(this.locationFontTextureBase); + this.bindTexture(this.locationFontTexture); + + for (int i = 0; i < 32; ++i) + { + int j = (i >> 3 & 1) * 85; + int k = (i >> 2 & 1) * 170 + j; + int l = (i >> 1 & 1) * 170 + j; + int i1 = (i >> 0 & 1) * 170 + j; + + if (i == 6) + { + k += 85; + } + + if (gameSettingsIn.anaglyph) + { + int j1 = (k * 30 + l * 59 + i1 * 11) / 100; + int k1 = (k * 30 + l * 70) / 100; + int l1 = (k * 30 + i1 * 70) / 100; + k = j1; + l = k1; + i1 = l1; + } + + if (i >= 16) + { + k /= 4; + l /= 4; + i1 /= 4; + } + + this.colorCode[i] = (k & 255) << 16 | (l & 255) << 8 | i1 & 255; + } + + this.readGlyphSizes(); + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + this.locationFontTexture = FontUtils.getHdFontLocation(this.locationFontTextureBase); + + for (int i = 0; i < unicodePageLocations.length; ++i) + { + unicodePageLocations[i] = null; + } + + this.readFontTexture(); + this.readGlyphSizes(); + } + + private void readFontTexture() + { + BufferedImage bufferedimage; + + try + { + bufferedimage = TextureUtil.readBufferedImage(this.getResourceInputStream(this.locationFontTexture)); + } + catch (IOException ioexception) + { + throw new RuntimeException(ioexception); + } + + Properties properties = FontUtils.readFontProperties(this.locationFontTexture); + int i = bufferedimage.getWidth(); + int j = bufferedimage.getHeight(); + int k = i / 16; + int l = j / 16; + float f = (float)i / 128.0F; + float f1 = Config.limit(f, 1.0F, 2.0F); + this.offsetBold = 1.0F / f1; + float f2 = FontUtils.readFloat(properties, "offsetBold", -1.0F); + + if (f2 >= 0.0F) + { + this.offsetBold = f2; + } + + int[] aint = new int[i * j]; + bufferedimage.getRGB(0, 0, i, j, aint, 0, i); + + for (int i1 = 0; i1 < 256; ++i1) + { + int j1 = i1 % 16; + int k1 = i1 / 16; + int l1 = 0; + + for (l1 = k - 1; l1 >= 0; --l1) + { + int i2 = j1 * k + l1; + boolean flag = true; + + for (int j2 = 0; j2 < l && flag; ++j2) + { + int k2 = (k1 * l + j2) * i; + int l2 = aint[i2 + k2]; + int i3 = l2 >> 24 & 255; + + if (i3 > 16) + { + flag = false; + } + } + + if (!flag) + { + break; + } + } + + if (i1 == 65) + { + i1 = i1; + } + + if (i1 == 32) + { + if (k <= 8) + { + l1 = (int)(2.0F * f); + } + else + { + l1 = (int)(1.5F * f); + } + } + + this.charWidth[i1] = (float)(l1 + 1) / f + 1.0F; + } + + FontUtils.readCustomCharWidths(properties, this.charWidth); + } + + private void readGlyphSizes() + { + InputStream inputstream = null; + + try + { + inputstream = this.getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin")); + inputstream.read(this.glyphWidth); + } + catch (IOException ioexception) + { + throw new RuntimeException(ioexception); + } + finally + { + IOUtils.closeQuietly(inputstream); + } + } + + private float func_181559_a(char p_181559_1_, boolean p_181559_2_) + { + if (p_181559_1_ == 32) + { + return !this.unicodeFlag ? this.charWidth[p_181559_1_] : 4.0F; + } + else + { + int i = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".indexOf(p_181559_1_); + return i != -1 && !this.unicodeFlag ? this.renderDefaultChar(i, p_181559_2_) : this.renderUnicodeChar(p_181559_1_, p_181559_2_); + } + } + + /** + * Render a single character with the default.png font at current (posX,posY) location... + */ + private float renderDefaultChar(int p_78266_1_, boolean p_78266_2_) + { + int i = p_78266_1_ % 16 * 8; + int j = p_78266_1_ / 16 * 8; + int k = p_78266_2_ ? 1 : 0; + this.bindTexture(this.locationFontTexture); + float f = this.charWidth[p_78266_1_]; + float f1 = 7.99F; + GL11.glBegin(GL11.GL_TRIANGLE_STRIP); + GL11.glTexCoord2f((float)i / 128.0F, (float)j / 128.0F); + GL11.glVertex3f(this.posX + (float)k, this.posY, 0.0F); + GL11.glTexCoord2f((float)i / 128.0F, ((float)j + 7.99F) / 128.0F); + GL11.glVertex3f(this.posX - (float)k, this.posY + 7.99F, 0.0F); + GL11.glTexCoord2f(((float)i + f1 - 1.0F) / 128.0F, (float)j / 128.0F); + GL11.glVertex3f(this.posX + f1 - 1.0F + (float)k, this.posY, 0.0F); + GL11.glTexCoord2f(((float)i + f1 - 1.0F) / 128.0F, ((float)j + 7.99F) / 128.0F); + GL11.glVertex3f(this.posX + f1 - 1.0F - (float)k, this.posY + 7.99F, 0.0F); + GL11.glEnd(); + return f; + } + + private ResourceLocation getUnicodePageLocation(int p_111271_1_) + { + if (unicodePageLocations[p_111271_1_] == null) + { + unicodePageLocations[p_111271_1_] = new ResourceLocation(String.format("textures/font/unicode_page_%02x.png", new Object[] {Integer.valueOf(p_111271_1_)})); + unicodePageLocations[p_111271_1_] = FontUtils.getHdFontLocation(unicodePageLocations[p_111271_1_]); + } + + return unicodePageLocations[p_111271_1_]; + } + + /** + * Load one of the /font/glyph_XX.png into a new GL texture and store the texture ID in glyphTextureName array. + */ + private void loadGlyphTexture(int p_78257_1_) + { + this.bindTexture(this.getUnicodePageLocation(p_78257_1_)); + } + + /** + * Render a single Unicode character at current (posX,posY) location using one of the /font/glyph_XX.png files... + */ + private float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_) + { + if (this.glyphWidth[p_78277_1_] == 0) + { + return 0.0F; + } + else + { + int i = p_78277_1_ / 256; + this.loadGlyphTexture(i); + int j = this.glyphWidth[p_78277_1_] >>> 4; + int k = this.glyphWidth[p_78277_1_] & 15; + j = j & 15; + float f = (float)j; + float f1 = (float)(k + 1); + float f2 = (float)(p_78277_1_ % 16 * 16) + f; + float f3 = (float)((p_78277_1_ & 255) / 16 * 16); + float f4 = f1 - f - 0.02F; + float f5 = p_78277_2_ ? 1.0F : 0.0F; + GL11.glBegin(GL11.GL_TRIANGLE_STRIP); + GL11.glTexCoord2f(f2 / 256.0F, f3 / 256.0F); + GL11.glVertex3f(this.posX + f5, this.posY, 0.0F); + GL11.glTexCoord2f(f2 / 256.0F, (f3 + 15.98F) / 256.0F); + GL11.glVertex3f(this.posX - f5, this.posY + 7.99F, 0.0F); + GL11.glTexCoord2f((f2 + f4) / 256.0F, f3 / 256.0F); + GL11.glVertex3f(this.posX + f4 / 2.0F + f5, this.posY, 0.0F); + GL11.glTexCoord2f((f2 + f4) / 256.0F, (f3 + 15.98F) / 256.0F); + GL11.glVertex3f(this.posX + f4 / 2.0F - f5, this.posY + 7.99F, 0.0F); + GL11.glEnd(); + return (f1 - f) / 2.0F + 1.0F; + } + } + + /** + * Draws the specified string with a shadow. + */ + public int drawStringWithShadow(String text, float x, float y, int color) + { + return this.drawString(text, x, y, color, true); + } + + /** + * Draws the specified string. + */ + public int drawString(String text, int x, int y, int color) + { + return !this.enabled ? 0 : this.drawString(text, (float)x, (float)y, color, false); + } + + /** + * Draws the specified string. + */ + public int drawString(String text, float x, float y, int color, boolean dropShadow) + { + this.enableAlpha(); + this.resetStyles(); + int i; + + if (dropShadow) + { + i = this.renderString(text, x + 1.0F, y + 1.0F, color, true); + i = Math.max(i, this.renderString(text, x, y, color, false)); + } + else + { + i = this.renderString(text, x, y, color, false); + } + + return i; + } + + /** + * Apply Unicode Bidirectional Algorithm to string and return a new possibly reordered string for visual rendering. + */ + private String bidiReorder(String p_147647_1_) + { + try + { + Bidi bidi = new Bidi((new ArabicShaping(8)).shape(p_147647_1_), 127); + bidi.setReorderingMode(0); + return bidi.writeReordered(2); + } + catch (ArabicShapingException var3) + { + return p_147647_1_; + } + } + + /** + * Reset all style flag fields in the class to false; called at the start of string rendering + */ + private void resetStyles() + { + this.randomStyle = false; + this.boldStyle = false; + this.italicStyle = false; + this.underlineStyle = false; + this.strikethroughStyle = false; + } + + /** + * Render a single line string at the current (posX,posY) and update posX + */ + private void renderStringAtPos(String p_78255_1_, boolean p_78255_2_) + { + for (int i = 0; i < p_78255_1_.length(); ++i) + { + char c0 = p_78255_1_.charAt(i); + + if (c0 == 167 && i + 1 < p_78255_1_.length()) + { + int i1 = "0123456789abcdefklmnor".indexOf(p_78255_1_.toLowerCase().charAt(i + 1)); + + if (i1 < 16) + { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + + if (i1 < 0 || i1 > 15) + { + i1 = 15; + } + + if (p_78255_2_) + { + i1 += 16; + } + + int j1 = this.colorCode[i1]; + + if (Config.isCustomColors()) + { + j1 = CustomColors.getTextColor(i1, j1); + } + + this.textColor = j1; + this.setColor((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha); + } + else if (i1 == 16) + { + this.randomStyle = true; + } + else if (i1 == 17) + { + this.boldStyle = true; + } + else if (i1 == 18) + { + this.strikethroughStyle = true; + } + else if (i1 == 19) + { + this.underlineStyle = true; + } + else if (i1 == 20) + { + this.italicStyle = true; + } + else if (i1 == 21) + { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + this.setColor(this.red, this.blue, this.green, this.alpha); + } + + ++i; + } + else + { + int j = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".indexOf(c0); + + if (this.randomStyle && j != -1) + { + int k = this.getCharWidth(c0); + char c1; + + while (true) + { + j = this.fontRandom.nextInt("\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".length()); + c1 = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".charAt(j); + + if (k == this.getCharWidth(c1)) + { + break; + } + } + + c0 = c1; + } + + float f1 = j != -1 && !this.unicodeFlag ? this.offsetBold : 0.5F; + boolean flag = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_; + + if (flag) + { + this.posX -= f1; + this.posY -= f1; + } + + float f = this.func_181559_a(c0, this.italicStyle); + + if (flag) + { + this.posX += f1; + this.posY += f1; + } + + if (this.boldStyle) + { + this.posX += f1; + + if (flag) + { + this.posX -= f1; + this.posY -= f1; + } + + this.func_181559_a(c0, this.italicStyle); + this.posX -= f1; + + if (flag) + { + this.posX += f1; + this.posY += f1; + } + + f += f1; + } + + if (this.strikethroughStyle) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.disableTexture2D(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION); + worldrenderer.pos((double)this.posX, (double)(this.posY + (float)(this.FONT_HEIGHT / 2)), 0.0D).endVertex(); + worldrenderer.pos((double)(this.posX + f), (double)(this.posY + (float)(this.FONT_HEIGHT / 2)), 0.0D).endVertex(); + worldrenderer.pos((double)(this.posX + f), (double)(this.posY + (float)(this.FONT_HEIGHT / 2) - 1.0F), 0.0D).endVertex(); + worldrenderer.pos((double)this.posX, (double)(this.posY + (float)(this.FONT_HEIGHT / 2) - 1.0F), 0.0D).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + } + + if (this.underlineStyle) + { + Tessellator tessellator1 = Tessellator.getInstance(); + WorldRenderer worldrenderer1 = tessellator1.getWorldRenderer(); + GlStateManager.disableTexture2D(); + worldrenderer1.begin(7, DefaultVertexFormats.POSITION); + int l = this.underlineStyle ? -1 : 0; + worldrenderer1.pos((double)(this.posX + (float)l), (double)(this.posY + (float)this.FONT_HEIGHT), 0.0D).endVertex(); + worldrenderer1.pos((double)(this.posX + f), (double)(this.posY + (float)this.FONT_HEIGHT), 0.0D).endVertex(); + worldrenderer1.pos((double)(this.posX + f), (double)(this.posY + (float)this.FONT_HEIGHT - 1.0F), 0.0D).endVertex(); + worldrenderer1.pos((double)(this.posX + (float)l), (double)(this.posY + (float)this.FONT_HEIGHT - 1.0F), 0.0D).endVertex(); + tessellator1.draw(); + GlStateManager.enableTexture2D(); + } + + this.posX += f; + } + } + } + + /** + * Render string either left or right aligned depending on bidiFlag + */ + private int renderStringAligned(String text, int x, int y, int p_78274_4_, int color, boolean dropShadow) + { + if (this.bidiFlag) + { + int i = this.getStringWidth(this.bidiReorder(text)); + x = x + p_78274_4_ - i; + } + + return this.renderString(text, (float)x, (float)y, color, dropShadow); + } + + /** + * Render single line string by setting GL color, current (posX,posY), and calling renderStringAtPos() + */ + private int renderString(String text, float x, float y, int color, boolean dropShadow) + { + if (text == null) + { + return 0; + } + else + { + if (this.bidiFlag) + { + text = this.bidiReorder(text); + } + + if ((color & -67108864) == 0) + { + color |= -16777216; + } + + if (dropShadow) + { + color = (color & 16579836) >> 2 | color & -16777216; + } + + this.red = (float)(color >> 16 & 255) / 255.0F; + this.blue = (float)(color >> 8 & 255) / 255.0F; + this.green = (float)(color & 255) / 255.0F; + this.alpha = (float)(color >> 24 & 255) / 255.0F; + this.setColor(this.red, this.blue, this.green, this.alpha); + this.posX = x; + this.posY = y; + this.renderStringAtPos(text, dropShadow); + return (int)this.posX; + } + } + + /** + * Returns the width of this string. Equivalent of FontMetrics.stringWidth(String s). + */ + public int getStringWidth(String text) + { + if (text == null) + { + return 0; + } + else + { + float f = 0.0F; + boolean flag = false; + + for (int i = 0; i < text.length(); ++i) + { + char c0 = text.charAt(i); + float f1 = this.getCharWidthFloat(c0); + + if (f1 < 0.0F && i < text.length() - 1) + { + ++i; + c0 = text.charAt(i); + + if (c0 != 108 && c0 != 76) + { + if (c0 == 114 || c0 == 82) + { + flag = false; + } + } + else + { + flag = true; + } + + f1 = 0.0F; + } + + f += f1; + + if (flag && f1 > 0.0F) + { + f += this.unicodeFlag ? 1.0F : this.offsetBold; + } + } + + return (int)f; + } + } + + /** + * Returns the width of this character as rendered. + */ + public int getCharWidth(char character) + { + return Math.round(this.getCharWidthFloat(character)); + } + + private float getCharWidthFloat(char p_getCharWidthFloat_1_) + { + if (p_getCharWidthFloat_1_ == 167) + { + return -1.0F; + } + else if (p_getCharWidthFloat_1_ == 32) + { + return this.charWidth[32]; + } + else + { + int i = "\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000".indexOf(p_getCharWidthFloat_1_); + + if (p_getCharWidthFloat_1_ > 0 && i != -1 && !this.unicodeFlag) + { + return this.charWidth[i]; + } + else if (this.glyphWidth[p_getCharWidthFloat_1_] != 0) + { + int j = this.glyphWidth[p_getCharWidthFloat_1_] >>> 4; + int k = this.glyphWidth[p_getCharWidthFloat_1_] & 15; + j = j & 15; + ++k; + return (float)((k - j) / 2 + 1); + } + else + { + return 0.0F; + } + } + } + + /** + * Trims a string to fit a specified Width. + */ + public String trimStringToWidth(String text, int width) + { + return this.trimStringToWidth(text, width, false); + } + + /** + * Trims a string to a specified width, and will reverse it if par3 is set. + */ + public String trimStringToWidth(String text, int width, boolean reverse) + { + StringBuilder stringbuilder = new StringBuilder(); + float f = 0.0F; + int i = reverse ? text.length() - 1 : 0; + int j = reverse ? -1 : 1; + boolean flag = false; + boolean flag1 = false; + + for (int k = i; k >= 0 && k < text.length() && f < (float)width; k += j) + { + char c0 = text.charAt(k); + float f1 = this.getCharWidthFloat(c0); + + if (flag) + { + flag = false; + + if (c0 != 108 && c0 != 76) + { + if (c0 == 114 || c0 == 82) + { + flag1 = false; + } + } + else + { + flag1 = true; + } + } + else if (f1 < 0.0F) + { + flag = true; + } + else + { + f += f1; + + if (flag1) + { + ++f; + } + } + + if (f > (float)width) + { + break; + } + + if (reverse) + { + stringbuilder.insert(0, (char)c0); + } + else + { + stringbuilder.append(c0); + } + } + + return stringbuilder.toString(); + } + + /** + * Remove all newline characters from the end of the string + */ + private String trimStringNewline(String text) + { + while (text != null && text.endsWith("\n")) + { + text = text.substring(0, text.length() - 1); + } + + return text; + } + + /** + * Splits and draws a String with wordwrap (maximum length is parameter k) + */ + public void drawSplitString(String str, int x, int y, int wrapWidth, int textColor) + { + this.resetStyles(); + this.textColor = textColor; + str = this.trimStringNewline(str); + this.renderSplitString(str, x, y, wrapWidth, false); + } + + /** + * Perform actual work of rendering a multi-line string with wordwrap and with darker drop shadow color if flag is + * set + */ + private void renderSplitString(String str, int x, int y, int wrapWidth, boolean addShadow) + { + for (Object s : this.listFormattedStringToWidth(str, wrapWidth)) + { + this.renderStringAligned((String) s, x, y, wrapWidth, this.textColor, addShadow); + y += this.FONT_HEIGHT; + } + } + + /** + * Returns the width of the wordwrapped String (maximum length is parameter k) + */ + public int splitStringWidth(String p_78267_1_, int p_78267_2_) + { + return this.FONT_HEIGHT * this.listFormattedStringToWidth(p_78267_1_, p_78267_2_).size(); + } + + /** + * Set unicodeFlag controlling whether strings should be rendered with Unicode fonts instead of the default.png + * font. + */ + public void setUnicodeFlag(boolean unicodeFlagIn) + { + this.unicodeFlag = unicodeFlagIn; + } + + /** + * Get unicodeFlag controlling whether strings should be rendered with Unicode fonts instead of the default.png + * font. + */ + public boolean getUnicodeFlag() + { + return this.unicodeFlag; + } + + /** + * Set bidiFlag to control if the Unicode Bidirectional Algorithm should be run before rendering any string. + */ + public void setBidiFlag(boolean bidiFlagIn) + { + this.bidiFlag = bidiFlagIn; + } + + /** + * Breaks a string into a list of pieces that will fit a specified width. + */ + public List listFormattedStringToWidth(String str, int wrapWidth) + { + return Arrays.asList(this.wrapFormattedStringToWidth(str, wrapWidth).split("\n")); + } + + /** + * Inserts newline and formatting into a string to wrap it within the specified width. + */ + String wrapFormattedStringToWidth(String str, int wrapWidth) + { + int i = this.sizeStringToWidth(str, wrapWidth); + + if (str.length() <= i) + { + return str; + } + else + { + String s = str.substring(0, i); + char c0 = str.charAt(i); + boolean flag = c0 == 32 || c0 == 10; + String s1 = getFormatFromString(s) + str.substring(i + (flag ? 1 : 0)); + return s + "\n" + this.wrapFormattedStringToWidth(s1, wrapWidth); + } + } + + /** + * Determines how many characters from the string will fit into the specified width. + */ + private int sizeStringToWidth(String str, int wrapWidth) + { + int i = str.length(); + float f = 0.0F; + int j = 0; + int k = -1; + + for (boolean flag = false; j < i; ++j) + { + char c0 = str.charAt(j); + + switch (c0) + { + case '\n': + --j; + break; + + case ' ': + k = j; + + default: + f += this.getCharWidthFloat(c0); + + if (flag) + { + ++f; + } + + break; + + case '\u00a7': + if (j < i - 1) + { + ++j; + char c1 = str.charAt(j); + + if (c1 != 108 && c1 != 76) + { + if (c1 == 114 || c1 == 82 || isFormatColor(c1)) + { + flag = false; + } + } + else + { + flag = true; + } + } + } + + if (c0 == 10) + { + ++j; + k = j; + break; + } + + if (f > (float)wrapWidth) + { + break; + } + } + + return j != i && k != -1 && k < j ? k : j; + } + + /** + * Checks if the char code is a hexadecimal character, used to set colour. + */ + private static boolean isFormatColor(char colorChar) + { + return colorChar >= 48 && colorChar <= 57 || colorChar >= 97 && colorChar <= 102 || colorChar >= 65 && colorChar <= 70; + } + + /** + * Checks if the char code is O-K...lLrRk-o... used to set special formatting. + */ + private static boolean isFormatSpecial(char formatChar) + { + return formatChar >= 107 && formatChar <= 111 || formatChar >= 75 && formatChar <= 79 || formatChar == 114 || formatChar == 82; + } + + /** + * Digests a string for nonprinting formatting characters then returns a string containing only that formatting. + */ + public static String getFormatFromString(String text) + { + String s = ""; + int i = -1; + int j = text.length(); + + while ((i = text.indexOf(167, i + 1)) != -1) + { + if (i < j - 1) + { + char c0 = text.charAt(i + 1); + + if (isFormatColor(c0)) + { + s = "\u00a7" + c0; + } + else if (isFormatSpecial(c0)) + { + s = s + "\u00a7" + c0; + } + } + } + + return s; + } + + /** + * Get bidiFlag that controls if the Unicode Bidirectional Algorithm should be run before rendering any string + */ + public boolean getBidiFlag() + { + return this.bidiFlag; + } + + public int getColorCode(char character) + { + int i = "0123456789abcdef".indexOf(character); + + if (i >= 0 && i < this.colorCode.length) + { + int j = this.colorCode[i]; + + if (Config.isCustomColors()) + { + j = CustomColors.getTextColor(i, j); + } + + return j; + } + else + { + return 16777215; + } + } + + protected void setColor(float p_setColor_1_, float p_setColor_2_, float p_setColor_3_, float p_setColor_4_) + { + GlStateManager.color(p_setColor_1_, p_setColor_2_, p_setColor_3_, p_setColor_4_); + } + + protected void enableAlpha() + { + GlStateManager.enableAlpha(); + } + + protected void bindTexture(ResourceLocation p_bindTexture_1_) + { + this.renderEngine.bindTexture(p_bindTexture_1_); + } + + protected InputStream getResourceInputStream(ResourceLocation p_getResourceInputStream_1_) throws IOException + { + return Minecraft.getMinecraft().getResourceManager().getResource(p_getResourceInputStream_1_).getInputStream(); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/Gui.java b/src/minecraft/net/minecraft/client/gui/Gui.java new file mode 100644 index 0000000..dc592ab --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/Gui.java @@ -0,0 +1,257 @@ +package net.minecraft.client.gui; + +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengl.GL11; + +import animeware.util.font.MinecraftFontRenderer; +import animeware.util.render.GLUtils; +import animeware.util.render.RenderUtil; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; + +public class Gui +{ + public static final ResourceLocation optionsBackground = new ResourceLocation("textures/gui/options_background.png"); + public static final ResourceLocation statIcons = new ResourceLocation("textures/gui/container/stats_icons.png"); + public static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png"); + protected static float zLevel; + + + + /** + * Draw a 1 pixel wide horizontal line. Args: x1, x2, y, color + */ + public static void drawHorizontalLine(int startX, int endX, int y, int color) + { + if (endX < startX) + { + int i = startX; + startX = endX; + endX = i; + } + + drawRect(startX, y, endX + 1, y + 1, color); + } + + /** + * Draw a 1 pixel wide vertical line. Args : x, y1, y2, color + */ + public static void drawVerticalLine(int x, int startY, int endY, int color) + { + if (endY < startY) + { + int i = startY; + startY = endY; + endY = i; + } + + drawRect(x, startY + 1, x + 1, endY, color); + } + + /** + * Draws a solid color rectangle with the specified coordinates and color (ARGB format). Args: x1, y1, x2, y2, color + */ + public static void drawRect(double left, double top, double right, double bottom, int color) + { + if (left < right) + { + double i = left; + left = right; + right = i; + } + + if (top < bottom) + { + double j = top; + top = bottom; + bottom = j; + } + + float f3 = (float)(color >> 24 & 255) / 255.0F; + float f = (float)(color >> 16 & 255) / 255.0F; + float f1 = (float)(color >> 8 & 255) / 255.0F; + float f2 = (float)(color & 255) / 255.0F; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.enableBlend(); + GlStateManager.disableTexture2D(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.color(f, f1, f2, f3); + worldrenderer.begin(7, DefaultVertexFormats.POSITION); + worldrenderer.pos((double)left, (double)bottom, 0.0D).endVertex(); + worldrenderer.pos((double)right, (double)bottom, 0.0D).endVertex(); + worldrenderer.pos((double)right, (double)top, 0.0D).endVertex(); + worldrenderer.pos((double)left, (double)top, 0.0D).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + } + public static void drawRect2(double x, double y, double width, double height, int color) { + RenderUtil.resetColor(); + GLUtils.setup2DRendering(() -> GLUtils.render(GL11.GL_QUADS, () -> { + RenderUtil.color(color); + GL11.glVertex2d(x, y); + GL11.glVertex2d(x, y + height); + GL11.glVertex2d(x + width, y + height); + GL11.glVertex2d(x + width, y); + })); + } + + /** + * Draws a rectangle with a vertical gradient between the specified colors (ARGB format). Args : x1, y1, x2, y2, + * topColor, bottomColor + */ + protected void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) + { + float f = (float)(startColor >> 24 & 255) / 255.0F; + float f1 = (float)(startColor >> 16 & 255) / 255.0F; + float f2 = (float)(startColor >> 8 & 255) / 255.0F; + float f3 = (float)(startColor & 255) / 255.0F; + float f4 = (float)(endColor >> 24 & 255) / 255.0F; + float f5 = (float)(endColor >> 16 & 255) / 255.0F; + float f6 = (float)(endColor >> 8 & 255) / 255.0F; + float f7 = (float)(endColor & 255) / 255.0F; + GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.shadeModel(7425); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos((double)right, (double)top, (double)this.zLevel).color(f1, f2, f3, f).endVertex(); + worldrenderer.pos((double)left, (double)top, (double)this.zLevel).color(f1, f2, f3, f).endVertex(); + worldrenderer.pos((double)left, (double)bottom, (double)this.zLevel).color(f5, f6, f7, f4).endVertex(); + worldrenderer.pos((double)right, (double)bottom, (double)this.zLevel).color(f5, f6, f7, f4).endVertex(); + tessellator.draw(); + GlStateManager.shadeModel(7424); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + } + + /** + * Renders the specified text to the screen, center-aligned. Args : renderer, string, x, y, color + */ + public static void drawCenteredString(FontRenderer fontRendererIn, String text, int x, int y, int color) + { + fontRendererIn.drawStringWithShadow(text, (float)(x - fontRendererIn.getStringWidth(text) / 2), (float)y, color); + } + public static void drawCenteredStringCustom(MinecraftFontRenderer normal, String text, int x, int y, int color) + { + normal.drawStringWithShadow(text, (float)(x - normal.getStringWidth(text) / 2), (float)y, color); + } + + /** + * Renders the specified text to the screen. Args : renderer, string, x, y, color + */ + public void drawString(FontRenderer fontRendererIn, String text, int x, int y, int color) + { + fontRendererIn.drawStringWithShadow(text, (float)x, (float)y, color); + } + + /** + * Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height + */ + public void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) + { + float f = 0.00390625F; + float f1 = 0.00390625F; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((double)(x + 0), (double)(y + height), (double)zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex(); + worldrenderer.pos((double)(x + width), (double)(y + height), (double)zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex(); + worldrenderer.pos((double)(x + width), (double)(y + 0), (double)zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex(); + worldrenderer.pos((double)(x + 0), (double)(y + 0), (double)zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex(); + tessellator.draw(); + } + + /** + * Draws a textured rectangle using the texture currently bound to the TextureManager + */ + public void drawTexturedModalRect(float xCoord, float yCoord, int minU, int minV, int maxU, int maxV) + { + float f = 0.00390625F; + float f1 = 0.00390625F; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((double)(xCoord + 0.0F), (double)(yCoord + (float)maxV), (double)this.zLevel).tex((double)((float)(minU + 0) * f), (double)((float)(minV + maxV) * f1)).endVertex(); + worldrenderer.pos((double)(xCoord + (float)maxU), (double)(yCoord + (float)maxV), (double)this.zLevel).tex((double)((float)(minU + maxU) * f), (double)((float)(minV + maxV) * f1)).endVertex(); + worldrenderer.pos((double)(xCoord + (float)maxU), (double)(yCoord + 0.0F), (double)this.zLevel).tex((double)((float)(minU + maxU) * f), (double)((float)(minV + 0) * f1)).endVertex(); + worldrenderer.pos((double)(xCoord + 0.0F), (double)(yCoord + 0.0F), (double)this.zLevel).tex((double)((float)(minU + 0) * f), (double)((float)(minV + 0) * f1)).endVertex(); + tessellator.draw(); + } + + /** + * Draws a texture rectangle using the texture currently bound to the TextureManager + */ + public void drawTexturedModalRect(int xCoord, int yCoord, TextureAtlasSprite textureSprite, int widthIn, int heightIn) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((double)(xCoord + 0), (double)(yCoord + heightIn), (double)this.zLevel).tex((double)textureSprite.getMinU(), (double)textureSprite.getMaxV()).endVertex(); + worldrenderer.pos((double)(xCoord + widthIn), (double)(yCoord + heightIn), (double)this.zLevel).tex((double)textureSprite.getMaxU(), (double)textureSprite.getMaxV()).endVertex(); + worldrenderer.pos((double)(xCoord + widthIn), (double)(yCoord + 0), (double)this.zLevel).tex((double)textureSprite.getMaxU(), (double)textureSprite.getMinV()).endVertex(); + worldrenderer.pos((double)(xCoord + 0), (double)(yCoord + 0), (double)this.zLevel).tex((double)textureSprite.getMinU(), (double)textureSprite.getMinV()).endVertex(); + tessellator.draw(); + } + + /** + * Draws a textured rectangle at z = 0. Args: x, y, u, v, width, height, textureWidth, textureHeight + */ + public static void drawModalRectWithCustomSizedTexture(float x, float y, float u, float v, float width, float height, float textureWidth, float textureHeight) { + float f = 1.0F / textureWidth; + float f1 = 1.0F / textureHeight; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(x, (y + height), 0.0D).tex((u * f), ((v + height) * f1)).endVertex(); + worldrenderer.pos((x + width), (y + height), 0.0D).tex(((u + width) * f), ((v + height) * f1)).endVertex(); + worldrenderer.pos((x + width), y, 0.0D).tex(((u + width) * f), (v * f1)).endVertex(); + worldrenderer.pos(x, y, 0.0D).tex((u * f), (v * f1)).endVertex(); + tessellator.draw(); + } + public static void drawModalRectWithCustomSizedTextureDouble(double x, double y, float u, float v, float width, float height, float textureWidth, float textureHeight) { + float f = 1.0F / textureWidth; + float f1 = 1.0F / textureHeight; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(x, (y + height), 0.0D).tex((u * f), ((v + height) * f1)).endVertex(); + worldrenderer.pos((x + width), (y + height), 0.0D).tex(((u + width) * f), ((v + height) * f1)).endVertex(); + worldrenderer.pos((x + width), y, 0.0D).tex(((u + width) * f), (v * f1)).endVertex(); + worldrenderer.pos(x, y, 0.0D).tex((u * f), (v * f1)).endVertex(); + tessellator.draw(); + } + + /** + * Draws a scaled, textured, tiled modal rect at z = 0. This method isn't used anywhere in vanilla code. + */ + + public static void drawScaledCustomSizeModalRect(float x, float y, float u, float v, int uWidth, int vHeight, float w, float h, float tileWidth, float tileHeight) { + float f = 1.0F / tileWidth; + float f1 = 1.0F / tileHeight; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(x, (y + h), 0.0D).tex((u * f), ((v + vHeight) * f1)).endVertex(); + worldrenderer.pos((x + w), (y + h), 0.0D).tex(((u + uWidth) * f), ((v + vHeight) * f1)).endVertex(); + worldrenderer.pos((x + w), y, 0.0D).tex(((u + uWidth) * f), (v * f1)).endVertex(); + worldrenderer.pos(x, y, 0.0D).tex((u * f), (v * f1)).endVertex(); + tessellator.draw(); + } + + public void draw() { + // TODO Auto-generated method stub + + } + +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiButton.java b/src/minecraft/net/minecraft/client/gui/GuiButton.java new file mode 100644 index 0000000..fd1b8f1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiButton.java @@ -0,0 +1,208 @@ +package net.minecraft.client.gui; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import animeware.gui.mainmenu.ClassicButton; +import animeware.hud.mod.HudMod; +import animeware.util.font.FontUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.audio.SoundHandler; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; + +public class GuiButton extends Gui +{ + protected static final ResourceLocation buttonTextures = new ResourceLocation("textures/gui/widgets.png"); + + /** Button width in pixels */ + protected int width; + + /** Button height in pixels */ + protected int height; + + /** The x position of this control. */ + public int xPosition; + + /** The y position of this control. */ + public int yPosition; + + /** The string displayed on this control. */ + public String displayString; + public int id; + + /** True if this control is enabled, false to disable. */ + public boolean enabled; + + /** Hides the button completely if false. */ + public boolean visible; + + + + public static boolean hovered; + + public GuiButton(int buttonId, int x, int y, String buttonText) + { + this(buttonId, x, y, 200, 20, buttonText); + } + + public GuiButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) + { + this.width = 200; + this.height = 20; + this.enabled = true; + this.visible = true; + this.id = buttonId; + this.xPosition = x; + this.yPosition = y; + this.width = widthIn; + this.height = heightIn; + this.displayString = buttonText; + } + + /** + * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over + * this button. + */ + protected int getHoverState(boolean mouseOver) + { + int i = 1; + + if (!this.enabled) + { + i = 0; + } + else if (mouseOver) + { + i = 2; + } + + return i; + } + + /** + * Draws this button to the screen. + */ + public void drawButton(Minecraft mc, int mouseX, int mouseY) + { + int j = -1; + final Color a = new Color(0, 0, 5, 100); + if (this.visible) + { + FontRenderer fontrenderer = mc.fontRendererObj; + mc.getTextureManager().bindTexture(buttonTextures); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + int i = this.getHoverState(this.hovered); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.blendFunc(770, 771); + //this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + i * 20, this.width / 2, this.height); + //this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height); + this.drawRoundedRect(this.xPosition, this.yPosition, this.width, this.height, 3, a); + //Gui.drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, new Color(0,0,0, 170).getRGB()); + this.mouseDragged(mc, mouseX, mouseY); + //int j = 14737632; + + if (!this.enabled) + { + j = 10526880; + } + else if (this.hovered) + { + j = new Color(0, 220, 230, 0).getRGB(); + //GlStateManager.color(0.0f, 0.8f, 0.9f); + + } else { + //GlStateManager.color(1.0f, 1.0f, 1.0f); + } + + FontUtil.normal.drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 4) / 2, j); + } + } + private void drawRoundedRect(final int x, final int y, final int width, final int height, final int cornerRadius, final Color color) { + Gui.drawRect(x, y + cornerRadius, x + cornerRadius, y + height - cornerRadius, color.getRGB()); + Gui.drawRect(x + cornerRadius, y, x + width - cornerRadius, y + height, color.getRGB()); + Gui.drawRect(x + width - cornerRadius, y + cornerRadius, x + width, y + height - cornerRadius, color.getRGB()); + this.drawArc(x + cornerRadius, y + cornerRadius, cornerRadius, 0, 90, color); + this.drawArc(x + width - cornerRadius, y + cornerRadius, cornerRadius, 270, 360, color); + this.drawArc(x + width - cornerRadius, y + height - cornerRadius, cornerRadius, 180, 270, color); + this.drawArc(x + cornerRadius, y + height - cornerRadius, cornerRadius, 90, 180, color); + } + private void drawArc(final int x, final int y, final int radius, final int startAngle, final int endAngle, final Color color) { + GL11.glPushMatrix(); + GL11.glEnable(3042); + GL11.glDisable(3553); + GL11.glBlendFunc(770, 771); + GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); + final WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + worldRenderer.begin(6, DefaultVertexFormats.POSITION); + worldRenderer.pos(x, y, 0.0).endVertex(); + for (int i = (int)(startAngle / 360.0 * 100.0); i <= (int)(endAngle / 360.0 * 100.0); ++i) { + final double angle = 6.283185307179586 * i / 100.0 + Math.toRadians(180.0); + worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0.0).endVertex(); + } + Tessellator.getInstance().draw(); + GL11.glEnable(3553); + GL11.glDisable(3042); + GL11.glPopMatrix(); + } + + private void drawCircle(final int x, final int y, final int width, final int height, final Color color) { + this.drawArc(x + width, y + height / 2, width / 2, 0, 360, color); + } + /** + * Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e). + */ + protected void mouseDragged(Minecraft mc, int mouseX, int mouseY) + { + } + + /** + * Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e). + */ + public void mouseReleased(int mouseX, int mouseY) + { + } + + /** + * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent + * e). + */ + public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) + { + return this.enabled && this.visible && mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + } + + /** + * Whether the mouse cursor is currently over the button. + */ + public boolean isMouseOver() + { + return this.hovered; + } + + public void drawButtonForegroundLayer(int mouseX, int mouseY) + { + } + + public void playPressSound(SoundHandler soundHandlerIn) + { + soundHandlerIn.playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + } + + public int getButtonWidth() + { + return this.width; + } + + public void setWidth(int width) + { + this.width = width; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiButtonLanguage.java b/src/minecraft/net/minecraft/client/gui/GuiButtonLanguage.java new file mode 100644 index 0000000..3279df1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiButtonLanguage.java @@ -0,0 +1,33 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; + +public class GuiButtonLanguage extends GuiButton +{ + public GuiButtonLanguage(int buttonID, int xPos, int yPos) + { + super(buttonID, xPos, yPos, 20, 20, ""); + } + + /** + * Draws this button to the screen. + */ + public void drawButton(Minecraft mc, int mouseX, int mouseY) + { + if (this.visible) + { + mc.getTextureManager().bindTexture(GuiButton.buttonTextures); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + int i = 106; + + if (flag) + { + i += this.height; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, i, this.width, this.height); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiButtonRealmsProxy.java b/src/minecraft/net/minecraft/client/gui/GuiButtonRealmsProxy.java new file mode 100644 index 0000000..a4ada33 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiButtonRealmsProxy.java @@ -0,0 +1,105 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.realms.RealmsButton; + +public class GuiButtonRealmsProxy extends GuiButton +{ + private RealmsButton realmsButton; + + public GuiButtonRealmsProxy(RealmsButton realmsButtonIn, int buttonId, int x, int y, String text) + { + super(buttonId, x, y, text); + this.realmsButton = realmsButtonIn; + } + + public GuiButtonRealmsProxy(RealmsButton realmsButtonIn, int buttonId, int x, int y, String text, int widthIn, int heightIn) + { + super(buttonId, x, y, widthIn, heightIn, text); + this.realmsButton = realmsButtonIn; + } + + public int getId() + { + return super.id; + } + + public boolean getEnabled() + { + return super.enabled; + } + + public void setEnabled(boolean isEnabled) + { + super.enabled = isEnabled; + } + + public void setText(String text) + { + super.displayString = text; + } + + public int getButtonWidth() + { + return super.getButtonWidth(); + } + + public int getPositionY() + { + return super.yPosition; + } + + /** + * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent + * e). + */ + public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) + { + if (super.mousePressed(mc, mouseX, mouseY)) + { + this.realmsButton.clicked(mouseX, mouseY); + } + + return super.mousePressed(mc, mouseX, mouseY); + } + + /** + * Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e). + */ + public void mouseReleased(int mouseX, int mouseY) + { + this.realmsButton.released(mouseX, mouseY); + } + + /** + * Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e). + */ + public void mouseDragged(Minecraft mc, int mouseX, int mouseY) + { + this.realmsButton.renderBg(mouseX, mouseY); + } + + public RealmsButton getRealmsButton() + { + return this.realmsButton; + } + + /** + * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over + * this button. + */ + public int getHoverState(boolean mouseOver) + { + return this.realmsButton.getYImage(mouseOver); + } + + public int func_154312_c(boolean p_154312_1_) + { + return super.getHoverState(p_154312_1_); + } + + public int func_175232_g() + { + return this.height; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiChat.java b/src/minecraft/net/minecraft/client/gui/GuiChat.java new file mode 100644 index 0000000..50a93c3 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiChat.java @@ -0,0 +1,353 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import net.minecraft.network.play.client.C14PacketTabComplete; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + +public class GuiChat extends GuiScreen +{ + private static final Logger logger = LogManager.getLogger(); + private String historyBuffer = ""; + + /** + * keeps position of which chat message you will select when you press up, (does not increase for duplicated + * messages sent immediately after each other) + */ + private int sentHistoryCursor = -1; + private boolean playerNamesFound; + private boolean waitingOnAutocomplete; + private int autocompleteIndex; + private List foundPlayerNames = Lists.newArrayList(); + + /** Chat entry field */ + protected GuiTextField inputField; + + /** + * is the text that appears when you press the chat key and the input box appears pre-filled + */ + private String defaultInputFieldText = ""; + + public GuiChat() + { + } + + public GuiChat(String defaultText) + { + this.defaultInputFieldText = defaultText; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.sentHistoryCursor = this.mc.ingameGUI.getChatGUI().getSentMessages().size(); + this.inputField = new GuiTextField(0, this.fontRendererObj, 4, this.height - 12, this.width - 4, 12); + this.inputField.setMaxStringLength(100); + this.inputField.setEnableBackgroundDrawing(false); + this.inputField.setFocused(true); + this.inputField.setText(this.defaultInputFieldText); + this.inputField.setCanLoseFocus(false); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + this.mc.ingameGUI.getChatGUI().resetScroll(); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.inputField.updateCursorCounter(); + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + this.waitingOnAutocomplete = false; + + if (keyCode == 15) + { + this.autocompletePlayerNames(); + } + else + { + this.playerNamesFound = false; + } + + if (keyCode == 1) + { + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (keyCode != 28 && keyCode != 156) + { + if (keyCode == 200) + { + this.getSentHistory(-1); + } + else if (keyCode == 208) + { + this.getSentHistory(1); + } + else if (keyCode == 201) + { + this.mc.ingameGUI.getChatGUI().scroll(this.mc.ingameGUI.getChatGUI().getLineCount() - 1); + } + else if (keyCode == 209) + { + this.mc.ingameGUI.getChatGUI().scroll(-this.mc.ingameGUI.getChatGUI().getLineCount() + 1); + } + else + { + this.inputField.textboxKeyTyped(typedChar, keyCode); + } + } + else + { + String s = this.inputField.getText().trim(); + + if (s.length() > 0) + { + this.sendChatMessage(s); + } + + this.mc.displayGuiScreen((GuiScreen)null); + } + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + int i = Mouse.getEventDWheel(); + + if (i != 0) + { + if (i > 1) + { + i = 1; + } + + if (i < -1) + { + i = -1; + } + + if (!isShiftKeyDown()) + { + i *= 7; + } + + this.mc.ingameGUI.getChatGUI().scroll(i); + } + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + if (mouseButton == 0) + { + IChatComponent ichatcomponent = this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY()); + + if (this.handleComponentClick(ichatcomponent)) + { + return; + } + } + + this.inputField.mouseClicked(mouseX, mouseY, mouseButton); + super.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Sets the text of the chat + */ + protected void setText(String newChatText, boolean shouldOverwrite) + { + if (shouldOverwrite) + { + this.inputField.setText(newChatText); + } + else + { + this.inputField.writeText(newChatText); + } + } + + public void autocompletePlayerNames() + { + if (this.playerNamesFound) + { + this.inputField.deleteFromCursor(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false) - this.inputField.getCursorPosition()); + + if (this.autocompleteIndex >= this.foundPlayerNames.size()) + { + this.autocompleteIndex = 0; + } + } + else + { + int i = this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false); + this.foundPlayerNames.clear(); + this.autocompleteIndex = 0; + String s = this.inputField.getText().substring(i).toLowerCase(); + String s1 = this.inputField.getText().substring(0, this.inputField.getCursorPosition()); + this.sendAutocompleteRequest(s1, s); + + if (this.foundPlayerNames.isEmpty()) + { + return; + } + + this.playerNamesFound = true; + this.inputField.deleteFromCursor(i - this.inputField.getCursorPosition()); + } + + if (this.foundPlayerNames.size() > 1) + { + StringBuilder stringbuilder = new StringBuilder(); + + for (String s2 : this.foundPlayerNames) + { + if (stringbuilder.length() > 0) + { + stringbuilder.append(", "); + } + + stringbuilder.append(s2); + } + + this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1); + } + + this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++)); + } + + private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_) + { + if (p_146405_1_.length() >= 1) + { + BlockPos blockpos = null; + + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + blockpos = this.mc.objectMouseOver.getBlockPos(); + } + + this.mc.thePlayer.sendQueue.addToSendQueue(new C14PacketTabComplete(p_146405_1_, blockpos)); + this.waitingOnAutocomplete = true; + } + } + + /** + * input is relative and is applied directly to the sentHistoryCursor so -1 is the previous message, 1 is the next + * message from the current cursor position + */ + public void getSentHistory(int msgPos) + { + int i = this.sentHistoryCursor + msgPos; + int j = this.mc.ingameGUI.getChatGUI().getSentMessages().size(); + i = MathHelper.clamp_int(i, 0, j); + + if (i != this.sentHistoryCursor) + { + if (i == j) + { + this.sentHistoryCursor = j; + this.inputField.setText(this.historyBuffer); + } + else + { + if (this.sentHistoryCursor == j) + { + this.historyBuffer = this.inputField.getText(); + } + + this.inputField.setText((String)this.mc.ingameGUI.getChatGUI().getSentMessages().get(i)); + this.sentHistoryCursor = i; + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE); + this.inputField.drawTextBox(); + IChatComponent ichatcomponent = this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY()); + + if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() != null) + { + this.handleComponentHover(ichatcomponent, mouseX, mouseY); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + public void onAutocompleteResponse(String[] p_146406_1_) + { + if (this.waitingOnAutocomplete) + { + this.playerNamesFound = false; + this.foundPlayerNames.clear(); + + for (String s : p_146406_1_) + { + if (s.length() > 0) + { + this.foundPlayerNames.add(s); + } + } + + String s1 = this.inputField.getText().substring(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false)); + String s2 = StringUtils.getCommonPrefix(p_146406_1_); + + if (s2.length() > 0 && !s1.equalsIgnoreCase(s2)) + { + this.inputField.deleteFromCursor(this.inputField.func_146197_a(-1, this.inputField.getCursorPosition(), false) - this.inputField.getCursorPosition()); + this.inputField.writeText(s2); + } + else if (this.foundPlayerNames.size() > 0) + { + this.playerNamesFound = true; + this.autocompletePlayerNames(); + } + } + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiClickableScrolledSelectionListProxy.java b/src/minecraft/net/minecraft/client/gui/GuiClickableScrolledSelectionListProxy.java new file mode 100644 index 0000000..c93f436 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiClickableScrolledSelectionListProxy.java @@ -0,0 +1,117 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.realms.RealmsClickableScrolledSelectionList; +import net.minecraft.realms.Tezzelator; +import org.lwjgl.input.Mouse; + +public class GuiClickableScrolledSelectionListProxy extends GuiSlot +{ + private final RealmsClickableScrolledSelectionList field_178046_u; + + public GuiClickableScrolledSelectionListProxy(RealmsClickableScrolledSelectionList selectionList, int p_i45526_2_, int p_i45526_3_, int p_i45526_4_, int p_i45526_5_, int p_i45526_6_) + { + super(Minecraft.getMinecraft(), p_i45526_2_, p_i45526_3_, p_i45526_4_, p_i45526_5_, p_i45526_6_); + this.field_178046_u = selectionList; + } + + protected int getSize() + { + return this.field_178046_u.getItemCount(); + } + + /** + * The element in the slot that was clicked, boolean for whether it was double clicked or not + */ + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + this.field_178046_u.selectItem(slotIndex, isDoubleClick, mouseX, mouseY); + } + + /** + * Returns true if the element passed in is currently selected + */ + protected boolean isSelected(int slotIndex) + { + return this.field_178046_u.isSelectedItem(slotIndex); + } + + protected void drawBackground() + { + this.field_178046_u.renderBackground(); + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + this.field_178046_u.renderItem(entryID, p_180791_2_, p_180791_3_, p_180791_4_, mouseXIn, mouseYIn); + } + + public int func_178044_e() + { + return super.width; + } + + public int func_178042_f() + { + return super.mouseY; + } + + public int func_178045_g() + { + return super.mouseX; + } + + /** + * Return the height of the content being scrolled + */ + protected int getContentHeight() + { + return this.field_178046_u.getMaxPosition(); + } + + protected int getScrollBarX() + { + return this.field_178046_u.getScrollbarPosition(); + } + + public void handleMouseInput() + { + super.handleMouseInput(); + + if (this.scrollMultiplier > 0.0F && Mouse.getEventButtonState()) + { + this.field_178046_u.customMouseEvent(this.top, this.bottom, this.headerPadding, this.amountScrolled, this.slotHeight); + } + } + + public void func_178043_a(int p_178043_1_, int p_178043_2_, int p_178043_3_, Tezzelator p_178043_4_) + { + this.field_178046_u.renderSelected(p_178043_1_, p_178043_2_, p_178043_3_, p_178043_4_); + } + + /** + * Draws the selection box around the selected slot element. + */ + protected void drawSelectionBox(int p_148120_1_, int p_148120_2_, int mouseXIn, int mouseYIn) + { + int i = this.getSize(); + + for (int j = 0; j < i; ++j) + { + int k = p_148120_2_ + j * this.slotHeight + this.headerPadding; + int l = this.slotHeight - 4; + + if (k > this.bottom || k + l < this.top) + { + this.func_178040_a(j, p_148120_1_, k); + } + + if (this.showSelectionBox && this.isSelected(j)) + { + this.func_178043_a(this.width, k, l, Tezzelator.instance); + } + + this.drawSlot(j, p_148120_1_, k, l, mouseXIn, mouseYIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiCommandBlock.java b/src/minecraft/net/minecraft/client/gui/GuiCommandBlock.java new file mode 100644 index 0000000..c7a2843 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiCommandBlock.java @@ -0,0 +1,189 @@ +package net.minecraft.client.gui; + +import io.netty.buffer.Unpooled; +import java.io.IOException; +import net.minecraft.client.resources.I18n; +import net.minecraft.command.server.CommandBlockLogic; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraft.util.IChatComponent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Keyboard; + +public class GuiCommandBlock extends GuiScreen +{ + private static final Logger field_146488_a = LogManager.getLogger(); + + /** Text field containing the command block's command. */ + private GuiTextField commandTextField; + private GuiTextField previousOutputTextField; + + /** Command block being edited. */ + private final CommandBlockLogic localCommandBlock; + + /** "Done" button for the GUI. */ + private GuiButton doneBtn; + private GuiButton cancelBtn; + private GuiButton field_175390_s; + private boolean field_175389_t; + + public GuiCommandBlock(CommandBlockLogic p_i45032_1_) + { + this.localCommandBlock = p_i45032_1_; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.commandTextField.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(this.doneBtn = new GuiButton(0, this.width / 2 - 4 - 150, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.done", new Object[0]))); + this.buttonList.add(this.cancelBtn = new GuiButton(1, this.width / 2 + 4, this.height / 4 + 120 + 12, 150, 20, I18n.format("gui.cancel", new Object[0]))); + this.buttonList.add(this.field_175390_s = new GuiButton(4, this.width / 2 + 150 - 20, 150, 20, 20, "O")); + this.commandTextField = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 150, 50, 300, 20); + this.commandTextField.setMaxStringLength(32767); + this.commandTextField.setFocused(true); + this.commandTextField.setText(this.localCommandBlock.getCommand()); + this.previousOutputTextField = new GuiTextField(3, this.fontRendererObj, this.width / 2 - 150, 150, 276, 20); + this.previousOutputTextField.setMaxStringLength(32767); + this.previousOutputTextField.setEnabled(false); + this.previousOutputTextField.setText("-"); + this.field_175389_t = this.localCommandBlock.shouldTrackOutput(); + this.func_175388_a(); + this.doneBtn.enabled = this.commandTextField.getText().trim().length() > 0; + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 1) + { + this.localCommandBlock.setTrackOutput(this.field_175389_t); + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (button.id == 0) + { + PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer()); + packetbuffer.writeByte(this.localCommandBlock.func_145751_f()); + this.localCommandBlock.func_145757_a(packetbuffer); + packetbuffer.writeString(this.commandTextField.getText()); + packetbuffer.writeBoolean(this.localCommandBlock.shouldTrackOutput()); + this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload("MC|AdvCdm", packetbuffer)); + + if (!this.localCommandBlock.shouldTrackOutput()) + { + this.localCommandBlock.setLastOutput((IChatComponent)null); + } + + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (button.id == 4) + { + this.localCommandBlock.setTrackOutput(!this.localCommandBlock.shouldTrackOutput()); + this.func_175388_a(); + } + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + this.commandTextField.textboxKeyTyped(typedChar, keyCode); + this.previousOutputTextField.textboxKeyTyped(typedChar, keyCode); + this.doneBtn.enabled = this.commandTextField.getText().trim().length() > 0; + + if (keyCode != 28 && keyCode != 156) + { + if (keyCode == 1) + { + this.actionPerformed(this.cancelBtn); + } + } + else + { + this.actionPerformed(this.doneBtn); + } + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + super.mouseClicked(mouseX, mouseY, mouseButton); + this.commandTextField.mouseClicked(mouseX, mouseY, mouseButton); + this.previousOutputTextField.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, I18n.format("advMode.setCommand", new Object[0]), this.width / 2, 20, 16777215); + this.drawString(this.fontRendererObj, I18n.format("advMode.command", new Object[0]), this.width / 2 - 150, 37, 10526880); + this.commandTextField.drawTextBox(); + int i = 75; + int j = 0; + this.drawString(this.fontRendererObj, I18n.format("advMode.nearestPlayer", new Object[0]), this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880); + this.drawString(this.fontRendererObj, I18n.format("advMode.randomPlayer", new Object[0]), this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880); + this.drawString(this.fontRendererObj, I18n.format("advMode.allPlayers", new Object[0]), this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880); + this.drawString(this.fontRendererObj, I18n.format("advMode.allEntities", new Object[0]), this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880); + this.drawString(this.fontRendererObj, "", this.width / 2 - 150, i + j++ * this.fontRendererObj.FONT_HEIGHT, 10526880); + + if (this.previousOutputTextField.getText().length() > 0) + { + i = i + j * this.fontRendererObj.FONT_HEIGHT + 16; + this.drawString(this.fontRendererObj, I18n.format("advMode.previousOutput", new Object[0]), this.width / 2 - 150, i, 10526880); + this.previousOutputTextField.drawTextBox(); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + private void func_175388_a() + { + if (this.localCommandBlock.shouldTrackOutput()) + { + this.field_175390_s.displayString = "O"; + + if (this.localCommandBlock.getLastOutput() != null) + { + this.previousOutputTextField.setText(this.localCommandBlock.getLastOutput().getUnformattedText()); + } + } + else + { + this.field_175390_s.displayString = "X"; + this.previousOutputTextField.setText("-"); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiConfirmOpenLink.java b/src/minecraft/net/minecraft/client/gui/GuiConfirmOpenLink.java new file mode 100644 index 0000000..c9c564f --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiConfirmOpenLink.java @@ -0,0 +1,77 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.client.resources.I18n; + +public class GuiConfirmOpenLink extends GuiYesNo +{ + /** Text to warn players from opening unsafe links. */ + private final String openLinkWarning; + + /** Label for the Copy to Clipboard button. */ + private final String copyLinkButtonText; + private final String linkText; + private boolean showSecurityWarning = true; + + public GuiConfirmOpenLink(GuiYesNoCallback p_i1084_1_, String linkTextIn, int p_i1084_3_, boolean p_i1084_4_) + { + super(p_i1084_1_, I18n.format(p_i1084_4_ ? "chat.link.confirmTrusted" : "chat.link.confirm", new Object[0]), linkTextIn, p_i1084_3_); + this.confirmButtonText = I18n.format(p_i1084_4_ ? "chat.link.open" : "gui.yes", new Object[0]); + this.cancelButtonText = I18n.format(p_i1084_4_ ? "gui.cancel" : "gui.no", new Object[0]); + this.copyLinkButtonText = I18n.format("chat.copy", new Object[0]); + this.openLinkWarning = I18n.format("chat.link.warning", new Object[0]); + this.linkText = linkTextIn; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + super.initGui(); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 50 - 105, this.height / 6 + 96, 100, 20, this.confirmButtonText)); + this.buttonList.add(new GuiButton(2, this.width / 2 - 50, this.height / 6 + 96, 100, 20, this.copyLinkButtonText)); + this.buttonList.add(new GuiButton(1, this.width / 2 - 50 + 105, this.height / 6 + 96, 100, 20, this.cancelButtonText)); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.id == 2) + { + this.copyLinkToClipboard(); + } + + this.parentScreen.confirmClicked(button.id == 0, this.parentButtonClickedId); + } + + /** + * Copies the link to the system clipboard. + */ + public void copyLinkToClipboard() + { + setClipboardString(this.linkText); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + super.drawScreen(mouseX, mouseY, partialTicks); + + if (this.showSecurityWarning) + { + this.drawCenteredString(this.fontRendererObj, this.openLinkWarning, this.width / 2, 110, 16764108); + } + } + + public void disableSecurityWarning() + { + this.showSecurityWarning = false; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiControls.java b/src/minecraft/net/minecraft/client/gui/GuiControls.java new file mode 100644 index 0000000..4ef88cd --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiControls.java @@ -0,0 +1,176 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.settings.KeyBinding; + +public class GuiControls extends GuiScreen +{ + private static final GameSettings.Options[] optionsArr = new GameSettings.Options[] {GameSettings.Options.INVERT_MOUSE, GameSettings.Options.SENSITIVITY, GameSettings.Options.TOUCHSCREEN}; + + /** + * A reference to the screen object that created this. Used for navigating between screens. + */ + private GuiScreen parentScreen; + protected String screenTitle = "Controls"; + + /** Reference to the GameSettings object. */ + private GameSettings options; + + /** The ID of the button that has been pressed. */ + public KeyBinding buttonId = null; + public long time; + private GuiKeyBindingList keyBindingList; + private GuiButton buttonReset; + + public GuiControls(GuiScreen screen, GameSettings settings) + { + this.parentScreen = screen; + this.options = settings; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.keyBindingList = new GuiKeyBindingList(this, this.mc); + this.buttonList.add(new GuiButton(200, this.width / 2 - 155, this.height - 29, 150, 20, I18n.format("gui.done", new Object[0]))); + this.buttonList.add(this.buttonReset = new GuiButton(201, this.width / 2 - 155 + 160, this.height - 29, 150, 20, I18n.format("controls.resetAll", new Object[0]))); + this.screenTitle = I18n.format("controls.title", new Object[0]); + int i = 0; + + for (GameSettings.Options gamesettings$options : optionsArr) + { + if (gamesettings$options.getEnumFloat()) + { + this.buttonList.add(new GuiOptionSlider(gamesettings$options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, 18 + 24 * (i >> 1), gamesettings$options)); + } + else + { + this.buttonList.add(new GuiOptionButton(gamesettings$options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, 18 + 24 * (i >> 1), gamesettings$options, this.options.getKeyBinding(gamesettings$options))); + } + + ++i; + } + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + this.keyBindingList.handleMouseInput(); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.id == 200) + { + this.mc.displayGuiScreen(this.parentScreen); + } + else if (button.id == 201) + { + for (KeyBinding keybinding : this.mc.gameSettings.keyBindings) + { + keybinding.setKeyCode(keybinding.getKeyCodeDefault()); + } + + KeyBinding.resetKeyBindingArrayAndHash(); + } + else if (button.id < 100 && button instanceof GuiOptionButton) + { + this.options.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1); + button.displayString = this.options.getKeyBinding(GameSettings.Options.getEnumOptions(button.id)); + } + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + if (this.buttonId != null) + { + this.options.setOptionKeyBinding(this.buttonId, -100 + mouseButton); + this.buttonId = null; + KeyBinding.resetKeyBindingArrayAndHash(); + } + else if (mouseButton != 0 || !this.keyBindingList.mouseClicked(mouseX, mouseY, mouseButton)) + { + super.mouseClicked(mouseX, mouseY, mouseButton); + } + } + + /** + * Called when a mouse button is released. Args : mouseX, mouseY, releaseButton + */ + protected void mouseReleased(int mouseX, int mouseY, int state) + { + if (state != 0 || !this.keyBindingList.mouseReleased(mouseX, mouseY, state)) + { + super.mouseReleased(mouseX, mouseY, state); + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (this.buttonId != null) + { + if (keyCode == 1) + { + this.options.setOptionKeyBinding(this.buttonId, 0); + } + else if (keyCode != 0) + { + this.options.setOptionKeyBinding(this.buttonId, keyCode); + } + else if (typedChar > 0) + { + this.options.setOptionKeyBinding(this.buttonId, typedChar + 256); + } + + this.buttonId = null; + this.time = Minecraft.getSystemTime(); + KeyBinding.resetKeyBindingArrayAndHash(); + } + else + { + super.keyTyped(typedChar, keyCode); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.keyBindingList.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.fontRendererObj, this.screenTitle, this.width / 2, 8, 16777215); + boolean flag = true; + + for (KeyBinding keybinding : this.options.keyBindings) + { + if (keybinding.getKeyCode() != keybinding.getKeyCodeDefault()) + { + flag = false; + break; + } + } + + this.buttonReset.enabled = !flag; + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiCreateFlatWorld.java b/src/minecraft/net/minecraft/client/gui/GuiCreateFlatWorld.java new file mode 100644 index 0000000..2075270 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiCreateFlatWorld.java @@ -0,0 +1,260 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.I18n; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.gen.FlatGeneratorInfo; +import net.minecraft.world.gen.FlatLayerInfo; + +public class GuiCreateFlatWorld extends GuiScreen +{ + private final GuiCreateWorld createWorldGui; + private FlatGeneratorInfo theFlatGeneratorInfo = FlatGeneratorInfo.getDefaultFlatGenerator(); + + /** The title given to the flat world currently in creation */ + private String flatWorldTitle; + private String field_146394_i; + private String field_146391_r; + private GuiCreateFlatWorld.Details createFlatWorldListSlotGui; + private GuiButton field_146389_t; + private GuiButton field_146388_u; + private GuiButton field_146386_v; + + public GuiCreateFlatWorld(GuiCreateWorld createWorldGuiIn, String p_i1029_2_) + { + this.createWorldGui = createWorldGuiIn; + this.func_146383_a(p_i1029_2_); + } + + public String func_146384_e() + { + return this.theFlatGeneratorInfo.toString(); + } + + public void func_146383_a(String p_146383_1_) + { + this.theFlatGeneratorInfo = FlatGeneratorInfo.createFlatGeneratorFromString(p_146383_1_); + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.clear(); + this.flatWorldTitle = I18n.format("createWorld.customize.flat.title", new Object[0]); + this.field_146394_i = I18n.format("createWorld.customize.flat.tile", new Object[0]); + this.field_146391_r = I18n.format("createWorld.customize.flat.height", new Object[0]); + this.createFlatWorldListSlotGui = new GuiCreateFlatWorld.Details(); + this.buttonList.add(this.field_146389_t = new GuiButton(2, this.width / 2 - 154, this.height - 52, 100, 20, I18n.format("createWorld.customize.flat.addLayer", new Object[0]) + " (NYI)")); + this.buttonList.add(this.field_146388_u = new GuiButton(3, this.width / 2 - 50, this.height - 52, 100, 20, I18n.format("createWorld.customize.flat.editLayer", new Object[0]) + " (NYI)")); + this.buttonList.add(this.field_146386_v = new GuiButton(4, this.width / 2 - 155, this.height - 52, 150, 20, I18n.format("createWorld.customize.flat.removeLayer", new Object[0]))); + this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, I18n.format("gui.done", new Object[0]))); + this.buttonList.add(new GuiButton(5, this.width / 2 + 5, this.height - 52, 150, 20, I18n.format("createWorld.customize.presets", new Object[0]))); + this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, I18n.format("gui.cancel", new Object[0]))); + this.field_146389_t.visible = this.field_146388_u.visible = false; + this.theFlatGeneratorInfo.func_82645_d(); + this.func_146375_g(); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + this.createFlatWorldListSlotGui.handleMouseInput(); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + int i = this.theFlatGeneratorInfo.getFlatLayers().size() - this.createFlatWorldListSlotGui.field_148228_k - 1; + + if (button.id == 1) + { + this.mc.displayGuiScreen(this.createWorldGui); + } + else if (button.id == 0) + { + this.createWorldGui.chunkProviderSettingsJson = this.func_146384_e(); + this.mc.displayGuiScreen(this.createWorldGui); + } + else if (button.id == 5) + { + this.mc.displayGuiScreen(new GuiFlatPresets(this)); + } + else if (button.id == 4 && this.func_146382_i()) + { + this.theFlatGeneratorInfo.getFlatLayers().remove(i); + this.createFlatWorldListSlotGui.field_148228_k = Math.min(this.createFlatWorldListSlotGui.field_148228_k, this.theFlatGeneratorInfo.getFlatLayers().size() - 1); + } + + this.theFlatGeneratorInfo.func_82645_d(); + this.func_146375_g(); + } + + public void func_146375_g() + { + boolean flag = this.func_146382_i(); + this.field_146386_v.enabled = flag; + this.field_146388_u.enabled = flag; + this.field_146388_u.enabled = false; + this.field_146389_t.enabled = false; + } + + private boolean func_146382_i() + { + return this.createFlatWorldListSlotGui.field_148228_k > -1 && this.createFlatWorldListSlotGui.field_148228_k < this.theFlatGeneratorInfo.getFlatLayers().size(); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.createFlatWorldListSlotGui.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.fontRendererObj, this.flatWorldTitle, this.width / 2, 8, 16777215); + int i = this.width / 2 - 92 - 16; + this.drawString(this.fontRendererObj, this.field_146394_i, i, 32, 16777215); + this.drawString(this.fontRendererObj, this.field_146391_r, i + 2 + 213 - this.fontRendererObj.getStringWidth(this.field_146391_r), 32, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + class Details extends GuiSlot + { + public int field_148228_k = -1; + + public Details() + { + super(GuiCreateFlatWorld.this.mc, GuiCreateFlatWorld.this.width, GuiCreateFlatWorld.this.height, 43, GuiCreateFlatWorld.this.height - 60, 24); + } + + private void func_148225_a(int p_148225_1_, int p_148225_2_, ItemStack p_148225_3_) + { + this.func_148226_e(p_148225_1_ + 1, p_148225_2_ + 1); + GlStateManager.enableRescaleNormal(); + + if (p_148225_3_ != null && p_148225_3_.getItem() != null) + { + RenderHelper.enableGUIStandardItemLighting(); + GuiCreateFlatWorld.this.itemRender.renderItemIntoGUI(p_148225_3_, p_148225_1_ + 2, p_148225_2_ + 2); + RenderHelper.disableStandardItemLighting(); + } + + GlStateManager.disableRescaleNormal(); + } + + private void func_148226_e(int p_148226_1_, int p_148226_2_) + { + this.func_148224_c(p_148226_1_, p_148226_2_, 0, 0); + } + + private void func_148224_c(int p_148224_1_, int p_148224_2_, int p_148224_3_, int p_148224_4_) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(Gui.statIcons); + float f = 0.0078125F; + float f1 = 0.0078125F; + int i = 18; + int j = 18; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((double)(p_148224_1_ + 0), (double)(p_148224_2_ + 18), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(p_148224_3_ + 0) * 0.0078125F), (double)((float)(p_148224_4_ + 18) * 0.0078125F)).endVertex(); + worldrenderer.pos((double)(p_148224_1_ + 18), (double)(p_148224_2_ + 18), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(p_148224_3_ + 18) * 0.0078125F), (double)((float)(p_148224_4_ + 18) * 0.0078125F)).endVertex(); + worldrenderer.pos((double)(p_148224_1_ + 18), (double)(p_148224_2_ + 0), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(p_148224_3_ + 18) * 0.0078125F), (double)((float)(p_148224_4_ + 0) * 0.0078125F)).endVertex(); + worldrenderer.pos((double)(p_148224_1_ + 0), (double)(p_148224_2_ + 0), (double)GuiCreateFlatWorld.this.zLevel).tex((double)((float)(p_148224_3_ + 0) * 0.0078125F), (double)((float)(p_148224_4_ + 0) * 0.0078125F)).endVertex(); + tessellator.draw(); + } + + protected int getSize() + { + return GuiCreateFlatWorld.this.theFlatGeneratorInfo.getFlatLayers().size(); + } + + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + this.field_148228_k = slotIndex; + GuiCreateFlatWorld.this.func_146375_g(); + } + + protected boolean isSelected(int slotIndex) + { + return slotIndex == this.field_148228_k; + } + + protected void drawBackground() + { + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + FlatLayerInfo flatlayerinfo = (FlatLayerInfo)GuiCreateFlatWorld.this.theFlatGeneratorInfo.getFlatLayers().get(GuiCreateFlatWorld.this.theFlatGeneratorInfo.getFlatLayers().size() - entryID - 1); + IBlockState iblockstate = flatlayerinfo.func_175900_c(); + Block block = iblockstate.getBlock(); + Item item = Item.getItemFromBlock(block); + ItemStack itemstack = block != Blocks.air && item != null ? new ItemStack(item, 1, block.getMetaFromState(iblockstate)) : null; + String s = itemstack == null ? "Air" : item.getItemStackDisplayName(itemstack); + + if (item == null) + { + if (block != Blocks.water && block != Blocks.flowing_water) + { + if (block == Blocks.lava || block == Blocks.flowing_lava) + { + item = Items.lava_bucket; + } + } + else + { + item = Items.water_bucket; + } + + if (item != null) + { + itemstack = new ItemStack(item, 1, block.getMetaFromState(iblockstate)); + s = block.getLocalizedName(); + } + } + + this.func_148225_a(p_180791_2_, p_180791_3_, itemstack); + GuiCreateFlatWorld.this.fontRendererObj.drawString(s, p_180791_2_ + 18 + 5, p_180791_3_ + 3, 16777215); + String s1; + + if (entryID == 0) + { + s1 = I18n.format("createWorld.customize.flat.layer.top", new Object[] {Integer.valueOf(flatlayerinfo.getLayerCount())}); + } + else if (entryID == GuiCreateFlatWorld.this.theFlatGeneratorInfo.getFlatLayers().size() - 1) + { + s1 = I18n.format("createWorld.customize.flat.layer.bottom", new Object[] {Integer.valueOf(flatlayerinfo.getLayerCount())}); + } + else + { + s1 = I18n.format("createWorld.customize.flat.layer", new Object[] {Integer.valueOf(flatlayerinfo.getLayerCount())}); + } + + GuiCreateFlatWorld.this.fontRendererObj.drawString(s1, p_180791_2_ + 2 + 213 - GuiCreateFlatWorld.this.fontRendererObj.getStringWidth(s1), p_180791_3_ + 3, 16777215); + } + + protected int getScrollBarX() + { + return this.width - 70; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiCreateWorld.java b/src/minecraft/net/minecraft/client/gui/GuiCreateWorld.java new file mode 100644 index 0000000..a1ae996 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiCreateWorld.java @@ -0,0 +1,510 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import java.util.Random; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.ChatAllowedCharacters; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.WorldType; +import net.minecraft.world.storage.ISaveFormat; +import net.minecraft.world.storage.WorldInfo; +import org.apache.commons.lang3.StringUtils; +import org.lwjgl.input.Keyboard; + +public class GuiCreateWorld extends GuiScreen +{ + private GuiScreen parentScreen; + private GuiTextField field_146333_g; + private GuiTextField field_146335_h; + private String field_146336_i; + private String gameMode = "survival"; + private String field_175300_s; + private boolean field_146341_s = true; + + /** If cheats are allowed */ + private boolean allowCheats; + private boolean field_146339_u; + private boolean field_146338_v; + private boolean field_146337_w; + private boolean field_146345_x; + private boolean field_146344_y; + private GuiButton btnGameMode; + private GuiButton btnMoreOptions; + private GuiButton btnMapFeatures; + private GuiButton btnBonusItems; + private GuiButton btnMapType; + private GuiButton btnAllowCommands; + private GuiButton btnCustomizeType; + private String field_146323_G; + private String field_146328_H; + private String field_146329_I; + private String field_146330_J; + private int selectedIndex; + public String chunkProviderSettingsJson = ""; + + /** These filenames are known to be restricted on one or more OS's. */ + private static final String[] disallowedFilenames = new String[] {"CON", "COM", "PRN", "AUX", "CLOCK$", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}; + + public GuiCreateWorld(GuiScreen p_i46320_1_) + { + this.parentScreen = p_i46320_1_; + this.field_146329_I = ""; + this.field_146330_J = I18n.format("selectWorld.newWorld", new Object[0]); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.field_146333_g.updateCursorCounter(); + this.field_146335_h.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, I18n.format("selectWorld.create", new Object[0]))); + this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, I18n.format("gui.cancel", new Object[0]))); + this.buttonList.add(this.btnGameMode = new GuiButton(2, this.width / 2 - 75, 115, 150, 20, I18n.format("selectWorld.gameMode", new Object[0]))); + this.buttonList.add(this.btnMoreOptions = new GuiButton(3, this.width / 2 - 75, 187, 150, 20, I18n.format("selectWorld.moreWorldOptions", new Object[0]))); + this.buttonList.add(this.btnMapFeatures = new GuiButton(4, this.width / 2 - 155, 100, 150, 20, I18n.format("selectWorld.mapFeatures", new Object[0]))); + this.btnMapFeatures.visible = false; + this.buttonList.add(this.btnBonusItems = new GuiButton(7, this.width / 2 + 5, 151, 150, 20, I18n.format("selectWorld.bonusItems", new Object[0]))); + this.btnBonusItems.visible = false; + this.buttonList.add(this.btnMapType = new GuiButton(5, this.width / 2 + 5, 100, 150, 20, I18n.format("selectWorld.mapType", new Object[0]))); + this.btnMapType.visible = false; + this.buttonList.add(this.btnAllowCommands = new GuiButton(6, this.width / 2 - 155, 151, 150, 20, I18n.format("selectWorld.allowCommands", new Object[0]))); + this.btnAllowCommands.visible = false; + this.buttonList.add(this.btnCustomizeType = new GuiButton(8, this.width / 2 + 5, 120, 150, 20, I18n.format("selectWorld.customizeType", new Object[0]))); + this.btnCustomizeType.visible = false; + this.field_146333_g = new GuiTextField(9, this.fontRendererObj, this.width / 2 - 100, 60, 200, 20); + this.field_146333_g.setFocused(true); + this.field_146333_g.setText(this.field_146330_J); + this.field_146335_h = new GuiTextField(10, this.fontRendererObj, this.width / 2 - 100, 60, 200, 20); + this.field_146335_h.setText(this.field_146329_I); + this.func_146316_a(this.field_146344_y); + this.func_146314_g(); + this.func_146319_h(); + } + + private void func_146314_g() + { + this.field_146336_i = this.field_146333_g.getText().trim(); + + for (char c0 : ChatAllowedCharacters.allowedCharactersArray) + { + this.field_146336_i = this.field_146336_i.replace(c0, '_'); + } + + if (StringUtils.isEmpty(this.field_146336_i)) + { + this.field_146336_i = "World"; + } + + this.field_146336_i = func_146317_a(this.mc.getSaveLoader(), this.field_146336_i); + } + + private void func_146319_h() + { + this.btnGameMode.displayString = I18n.format("selectWorld.gameMode", new Object[0]) + ": " + I18n.format("selectWorld.gameMode." + this.gameMode, new Object[0]); + this.field_146323_G = I18n.format("selectWorld.gameMode." + this.gameMode + ".line1", new Object[0]); + this.field_146328_H = I18n.format("selectWorld.gameMode." + this.gameMode + ".line2", new Object[0]); + this.btnMapFeatures.displayString = I18n.format("selectWorld.mapFeatures", new Object[0]) + " "; + + if (this.field_146341_s) + { + this.btnMapFeatures.displayString = this.btnMapFeatures.displayString + I18n.format("options.on", new Object[0]); + } + else + { + this.btnMapFeatures.displayString = this.btnMapFeatures.displayString + I18n.format("options.off", new Object[0]); + } + + this.btnBonusItems.displayString = I18n.format("selectWorld.bonusItems", new Object[0]) + " "; + + if (this.field_146338_v && !this.field_146337_w) + { + this.btnBonusItems.displayString = this.btnBonusItems.displayString + I18n.format("options.on", new Object[0]); + } + else + { + this.btnBonusItems.displayString = this.btnBonusItems.displayString + I18n.format("options.off", new Object[0]); + } + + this.btnMapType.displayString = I18n.format("selectWorld.mapType", new Object[0]) + " " + I18n.format(WorldType.worldTypes[this.selectedIndex].getTranslateName(), new Object[0]); + this.btnAllowCommands.displayString = I18n.format("selectWorld.allowCommands", new Object[0]) + " "; + + if (this.allowCheats && !this.field_146337_w) + { + this.btnAllowCommands.displayString = this.btnAllowCommands.displayString + I18n.format("options.on", new Object[0]); + } + else + { + this.btnAllowCommands.displayString = this.btnAllowCommands.displayString + I18n.format("options.off", new Object[0]); + } + } + + public static String func_146317_a(ISaveFormat p_146317_0_, String p_146317_1_) + { + p_146317_1_ = p_146317_1_.replaceAll("[\\./\"]", "_"); + + for (String s : disallowedFilenames) + { + if (p_146317_1_.equalsIgnoreCase(s)) + { + p_146317_1_ = "_" + p_146317_1_ + "_"; + } + } + + while (p_146317_0_.getWorldInfo(p_146317_1_) != null) + { + p_146317_1_ = p_146317_1_ + "-"; + } + + return p_146317_1_; + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 1) + { + this.mc.displayGuiScreen(this.parentScreen); + } + else if (button.id == 0) + { + this.mc.displayGuiScreen((GuiScreen)null); + + if (this.field_146345_x) + { + return; + } + + this.field_146345_x = true; + long i = (new Random()).nextLong(); + String s = this.field_146335_h.getText(); + + if (!StringUtils.isEmpty(s)) + { + try + { + long j = Long.parseLong(s); + + if (j != 0L) + { + i = j; + } + } + catch (NumberFormatException var7) + { + i = (long)s.hashCode(); + } + } + + WorldSettings.GameType worldsettings$gametype = WorldSettings.GameType.getByName(this.gameMode); + WorldSettings worldsettings = new WorldSettings(i, worldsettings$gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]); + worldsettings.setWorldName(this.chunkProviderSettingsJson); + + if (this.field_146338_v && !this.field_146337_w) + { + worldsettings.enableBonusChest(); + } + + if (this.allowCheats && !this.field_146337_w) + { + worldsettings.enableCommands(); + } + + this.mc.launchIntegratedServer(this.field_146336_i, this.field_146333_g.getText().trim(), worldsettings); + } + else if (button.id == 3) + { + this.func_146315_i(); + } + else if (button.id == 2) + { + if (this.gameMode.equals("survival")) + { + if (!this.field_146339_u) + { + this.allowCheats = false; + } + + this.field_146337_w = false; + this.gameMode = "hardcore"; + this.field_146337_w = true; + this.btnAllowCommands.enabled = false; + this.btnBonusItems.enabled = false; + this.func_146319_h(); + } + else if (this.gameMode.equals("hardcore")) + { + if (!this.field_146339_u) + { + this.allowCheats = true; + } + + this.field_146337_w = false; + this.gameMode = "creative"; + this.func_146319_h(); + this.field_146337_w = false; + this.btnAllowCommands.enabled = true; + this.btnBonusItems.enabled = true; + } + else + { + if (!this.field_146339_u) + { + this.allowCheats = false; + } + + this.gameMode = "survival"; + this.func_146319_h(); + this.btnAllowCommands.enabled = true; + this.btnBonusItems.enabled = true; + this.field_146337_w = false; + } + + this.func_146319_h(); + } + else if (button.id == 4) + { + this.field_146341_s = !this.field_146341_s; + this.func_146319_h(); + } + else if (button.id == 7) + { + this.field_146338_v = !this.field_146338_v; + this.func_146319_h(); + } + else if (button.id == 5) + { + ++this.selectedIndex; + + if (this.selectedIndex >= WorldType.worldTypes.length) + { + this.selectedIndex = 0; + } + + while (!this.func_175299_g()) + { + ++this.selectedIndex; + + if (this.selectedIndex >= WorldType.worldTypes.length) + { + this.selectedIndex = 0; + } + } + + this.chunkProviderSettingsJson = ""; + this.func_146319_h(); + this.func_146316_a(this.field_146344_y); + } + else if (button.id == 6) + { + this.field_146339_u = true; + this.allowCheats = !this.allowCheats; + this.func_146319_h(); + } + else if (button.id == 8) + { + if (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT) + { + this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.chunkProviderSettingsJson)); + } + else + { + this.mc.displayGuiScreen(new GuiCustomizeWorldScreen(this, this.chunkProviderSettingsJson)); + } + } + } + } + + private boolean func_175299_g() + { + WorldType worldtype = WorldType.worldTypes[this.selectedIndex]; + return worldtype != null && worldtype.getCanBeCreated() ? (worldtype == WorldType.DEBUG_WORLD ? isShiftKeyDown() : true) : false; + } + + private void func_146315_i() + { + this.func_146316_a(!this.field_146344_y); + } + + private void func_146316_a(boolean p_146316_1_) + { + this.field_146344_y = p_146316_1_; + + if (WorldType.worldTypes[this.selectedIndex] == WorldType.DEBUG_WORLD) + { + this.btnGameMode.visible = !this.field_146344_y; + this.btnGameMode.enabled = false; + + if (this.field_175300_s == null) + { + this.field_175300_s = this.gameMode; + } + + this.gameMode = "spectator"; + this.btnMapFeatures.visible = false; + this.btnBonusItems.visible = false; + this.btnMapType.visible = this.field_146344_y; + this.btnAllowCommands.visible = false; + this.btnCustomizeType.visible = false; + } + else + { + this.btnGameMode.visible = !this.field_146344_y; + this.btnGameMode.enabled = true; + + if (this.field_175300_s != null) + { + this.gameMode = this.field_175300_s; + this.field_175300_s = null; + } + + this.btnMapFeatures.visible = this.field_146344_y && WorldType.worldTypes[this.selectedIndex] != WorldType.CUSTOMIZED; + this.btnBonusItems.visible = this.field_146344_y; + this.btnMapType.visible = this.field_146344_y; + this.btnAllowCommands.visible = this.field_146344_y; + this.btnCustomizeType.visible = this.field_146344_y && (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT || WorldType.worldTypes[this.selectedIndex] == WorldType.CUSTOMIZED); + } + + this.func_146319_h(); + + if (this.field_146344_y) + { + this.btnMoreOptions.displayString = I18n.format("gui.done", new Object[0]); + } + else + { + this.btnMoreOptions.displayString = I18n.format("selectWorld.moreWorldOptions", new Object[0]); + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (this.field_146333_g.isFocused() && !this.field_146344_y) + { + this.field_146333_g.textboxKeyTyped(typedChar, keyCode); + this.field_146330_J = this.field_146333_g.getText(); + } + else if (this.field_146335_h.isFocused() && this.field_146344_y) + { + this.field_146335_h.textboxKeyTyped(typedChar, keyCode); + this.field_146329_I = this.field_146335_h.getText(); + } + + if (keyCode == 28 || keyCode == 156) + { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + + ((GuiButton)this.buttonList.get(0)).enabled = this.field_146333_g.getText().length() > 0; + this.func_146314_g(); + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + super.mouseClicked(mouseX, mouseY, mouseButton); + + if (this.field_146344_y) + { + this.field_146335_h.mouseClicked(mouseX, mouseY, mouseButton); + } + else + { + this.field_146333_g.mouseClicked(mouseX, mouseY, mouseButton); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, I18n.format("selectWorld.create", new Object[0]), this.width / 2, 20, -1); + + if (this.field_146344_y) + { + this.drawString(this.fontRendererObj, I18n.format("selectWorld.enterSeed", new Object[0]), this.width / 2 - 100, 47, -6250336); + this.drawString(this.fontRendererObj, I18n.format("selectWorld.seedInfo", new Object[0]), this.width / 2 - 100, 85, -6250336); + + if (this.btnMapFeatures.visible) + { + this.drawString(this.fontRendererObj, I18n.format("selectWorld.mapFeatures.info", new Object[0]), this.width / 2 - 150, 122, -6250336); + } + + if (this.btnAllowCommands.visible) + { + this.drawString(this.fontRendererObj, I18n.format("selectWorld.allowCommands.info", new Object[0]), this.width / 2 - 150, 172, -6250336); + } + + this.field_146335_h.drawTextBox(); + + if (WorldType.worldTypes[this.selectedIndex].showWorldInfoNotice()) + { + this.fontRendererObj.drawSplitString(I18n.format(WorldType.worldTypes[this.selectedIndex].func_151359_c(), new Object[0]), this.btnMapType.xPosition + 2, this.btnMapType.yPosition + 22, this.btnMapType.getButtonWidth(), 10526880); + } + } + else + { + this.drawString(this.fontRendererObj, I18n.format("selectWorld.enterName", new Object[0]), this.width / 2 - 100, 47, -6250336); + this.drawString(this.fontRendererObj, I18n.format("selectWorld.resultFolder", new Object[0]) + " " + this.field_146336_i, this.width / 2 - 100, 85, -6250336); + this.field_146333_g.drawTextBox(); + this.drawString(this.fontRendererObj, this.field_146323_G, this.width / 2 - 100, 137, -6250336); + this.drawString(this.fontRendererObj, this.field_146328_H, this.width / 2 - 100, 149, -6250336); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + public void func_146318_a(WorldInfo p_146318_1_) + { + this.field_146330_J = I18n.format("selectWorld.newWorld.copyOf", new Object[] {p_146318_1_.getWorldName()}); + this.field_146329_I = p_146318_1_.getSeed() + ""; + this.selectedIndex = p_146318_1_.getTerrainType().getWorldTypeID(); + this.chunkProviderSettingsJson = p_146318_1_.getGeneratorOptions(); + this.field_146341_s = p_146318_1_.isMapFeaturesEnabled(); + this.allowCheats = p_146318_1_.areCommandsAllowed(); + + if (p_146318_1_.isHardcoreModeEnabled()) + { + this.gameMode = "hardcore"; + } + else if (p_146318_1_.getGameType().isSurvivalOrAdventure()) + { + this.gameMode = "survival"; + } + else if (p_146318_1_.getGameType().isCreative()) + { + this.gameMode = "creative"; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiCustomizeSkin.java b/src/minecraft/net/minecraft/client/gui/GuiCustomizeSkin.java new file mode 100644 index 0000000..f2e4e2a --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiCustomizeSkin.java @@ -0,0 +1,100 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EnumPlayerModelParts; + +public class GuiCustomizeSkin extends GuiScreen +{ + /** The parent GUI for this GUI */ + private final GuiScreen parentScreen; + + /** The title of the GUI. */ + private String title; + + public GuiCustomizeSkin(GuiScreen parentScreenIn) + { + this.parentScreen = parentScreenIn; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + int i = 0; + this.title = I18n.format("options.skinCustomisation.title", new Object[0]); + + for (EnumPlayerModelParts enumplayermodelparts : EnumPlayerModelParts.values()) + { + this.buttonList.add(new GuiCustomizeSkin.ButtonPart(enumplayermodelparts.getPartId(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20, enumplayermodelparts)); + ++i; + } + + if (i % 2 == 1) + { + ++i; + } + + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 24 * (i >> 1), I18n.format("gui.done", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.parentScreen); + } + else if (button instanceof GuiCustomizeSkin.ButtonPart) + { + EnumPlayerModelParts enumplayermodelparts = ((GuiCustomizeSkin.ButtonPart)button).playerModelParts; + this.mc.gameSettings.switchModelPartEnabled(enumplayermodelparts); + button.displayString = this.func_175358_a(enumplayermodelparts); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 20, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + private String func_175358_a(EnumPlayerModelParts playerModelParts) + { + String s; + + if (this.mc.gameSettings.getModelParts().contains(playerModelParts)) + { + s = I18n.format("options.on", new Object[0]); + } + else + { + s = I18n.format("options.off", new Object[0]); + } + + return playerModelParts.func_179326_d().getFormattedText() + ": " + s; + } + + class ButtonPart extends GuiButton + { + private final EnumPlayerModelParts playerModelParts; + + private ButtonPart(int p_i45514_2_, int p_i45514_3_, int p_i45514_4_, int p_i45514_5_, int p_i45514_6_, EnumPlayerModelParts playerModelParts) + { + super(p_i45514_2_, p_i45514_3_, p_i45514_4_, p_i45514_5_, p_i45514_6_, GuiCustomizeSkin.this.func_175358_a(playerModelParts)); + this.playerModelParts = playerModelParts; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiCustomizeWorldScreen.java b/src/minecraft/net/minecraft/client/gui/GuiCustomizeWorldScreen.java new file mode 100644 index 0000000..62307e5 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiCustomizeWorldScreen.java @@ -0,0 +1,1005 @@ +package net.minecraft.client.gui; + +import com.google.common.base.Predicate; +import com.google.common.primitives.Floats; +import java.io.IOException; +import java.util.Random; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.MathHelper; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.ChunkProviderSettings; + +public class GuiCustomizeWorldScreen extends GuiScreen implements GuiSlider.FormatHelper, GuiPageButtonList.GuiResponder +{ + private GuiCreateWorld field_175343_i; + protected String field_175341_a = "Customize World Settings"; + protected String field_175333_f = "Page 1 of 3"; + protected String field_175335_g = "Basic Settings"; + protected String[] field_175342_h = new String[4]; + private GuiPageButtonList field_175349_r; + private GuiButton field_175348_s; + private GuiButton field_175347_t; + private GuiButton field_175346_u; + private GuiButton field_175345_v; + private GuiButton field_175344_w; + private GuiButton field_175352_x; + private GuiButton field_175351_y; + private GuiButton field_175350_z; + private boolean field_175338_A = false; + private int field_175339_B = 0; + private boolean field_175340_C = false; + private Predicate field_175332_D = new Predicate() + { + public boolean apply(String p_apply_1_) + { + Float f = Floats.tryParse(p_apply_1_); + return p_apply_1_.length() == 0 || f != null && Floats.isFinite(f.floatValue()) && f.floatValue() >= 0.0F; + } + }; + private ChunkProviderSettings.Factory field_175334_E = new ChunkProviderSettings.Factory(); + private ChunkProviderSettings.Factory field_175336_F; + + /** A Random instance for this world customization */ + private Random random = new Random(); + + public GuiCustomizeWorldScreen(GuiScreen p_i45521_1_, String p_i45521_2_) + { + this.field_175343_i = (GuiCreateWorld)p_i45521_1_; + this.func_175324_a(p_i45521_2_); + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + int i = 0; + int j = 0; + + if (this.field_175349_r != null) + { + i = this.field_175349_r.func_178059_e(); + j = this.field_175349_r.getAmountScrolled(); + } + + this.field_175341_a = I18n.format("options.customizeTitle", new Object[0]); + this.buttonList.clear(); + this.buttonList.add(this.field_175345_v = new GuiButton(302, 20, 5, 80, 20, I18n.format("createWorld.customize.custom.prev", new Object[0]))); + this.buttonList.add(this.field_175344_w = new GuiButton(303, this.width - 100, 5, 80, 20, I18n.format("createWorld.customize.custom.next", new Object[0]))); + this.buttonList.add(this.field_175346_u = new GuiButton(304, this.width / 2 - 187, this.height - 27, 90, 20, I18n.format("createWorld.customize.custom.defaults", new Object[0]))); + this.buttonList.add(this.field_175347_t = new GuiButton(301, this.width / 2 - 92, this.height - 27, 90, 20, I18n.format("createWorld.customize.custom.randomize", new Object[0]))); + this.buttonList.add(this.field_175350_z = new GuiButton(305, this.width / 2 + 3, this.height - 27, 90, 20, I18n.format("createWorld.customize.custom.presets", new Object[0]))); + this.buttonList.add(this.field_175348_s = new GuiButton(300, this.width / 2 + 98, this.height - 27, 90, 20, I18n.format("gui.done", new Object[0]))); + this.field_175346_u.enabled = this.field_175338_A; + this.field_175352_x = new GuiButton(306, this.width / 2 - 55, 160, 50, 20, I18n.format("gui.yes", new Object[0])); + this.field_175352_x.visible = false; + this.buttonList.add(this.field_175352_x); + this.field_175351_y = new GuiButton(307, this.width / 2 + 5, 160, 50, 20, I18n.format("gui.no", new Object[0])); + this.field_175351_y.visible = false; + this.buttonList.add(this.field_175351_y); + + if (this.field_175339_B != 0) + { + this.field_175352_x.visible = true; + this.field_175351_y.visible = true; + } + + this.func_175325_f(); + + if (i != 0) + { + this.field_175349_r.func_181156_c(i); + this.field_175349_r.scrollBy(j); + this.func_175328_i(); + } + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + this.field_175349_r.handleMouseInput(); + } + + private void func_175325_f() + { + GuiPageButtonList.GuiListEntry[] aguipagebuttonlist$guilistentry = new GuiPageButtonList.GuiListEntry[] {new GuiPageButtonList.GuiSlideEntry(160, I18n.format("createWorld.customize.custom.seaLevel", new Object[0]), true, this, 1.0F, 255.0F, (float)this.field_175336_F.seaLevel), new GuiPageButtonList.GuiButtonEntry(148, I18n.format("createWorld.customize.custom.useCaves", new Object[0]), true, this.field_175336_F.useCaves), new GuiPageButtonList.GuiButtonEntry(150, I18n.format("createWorld.customize.custom.useStrongholds", new Object[0]), true, this.field_175336_F.useStrongholds), new GuiPageButtonList.GuiButtonEntry(151, I18n.format("createWorld.customize.custom.useVillages", new Object[0]), true, this.field_175336_F.useVillages), new GuiPageButtonList.GuiButtonEntry(152, I18n.format("createWorld.customize.custom.useMineShafts", new Object[0]), true, this.field_175336_F.useMineShafts), new GuiPageButtonList.GuiButtonEntry(153, I18n.format("createWorld.customize.custom.useTemples", new Object[0]), true, this.field_175336_F.useTemples), new GuiPageButtonList.GuiButtonEntry(210, I18n.format("createWorld.customize.custom.useMonuments", new Object[0]), true, this.field_175336_F.useMonuments), new GuiPageButtonList.GuiButtonEntry(154, I18n.format("createWorld.customize.custom.useRavines", new Object[0]), true, this.field_175336_F.useRavines), new GuiPageButtonList.GuiButtonEntry(149, I18n.format("createWorld.customize.custom.useDungeons", new Object[0]), true, this.field_175336_F.useDungeons), new GuiPageButtonList.GuiSlideEntry(157, I18n.format("createWorld.customize.custom.dungeonChance", new Object[0]), true, this, 1.0F, 100.0F, (float)this.field_175336_F.dungeonChance), new GuiPageButtonList.GuiButtonEntry(155, I18n.format("createWorld.customize.custom.useWaterLakes", new Object[0]), true, this.field_175336_F.useWaterLakes), new GuiPageButtonList.GuiSlideEntry(158, I18n.format("createWorld.customize.custom.waterLakeChance", new Object[0]), true, this, 1.0F, 100.0F, (float)this.field_175336_F.waterLakeChance), new GuiPageButtonList.GuiButtonEntry(156, I18n.format("createWorld.customize.custom.useLavaLakes", new Object[0]), true, this.field_175336_F.useLavaLakes), new GuiPageButtonList.GuiSlideEntry(159, I18n.format("createWorld.customize.custom.lavaLakeChance", new Object[0]), true, this, 10.0F, 100.0F, (float)this.field_175336_F.lavaLakeChance), new GuiPageButtonList.GuiButtonEntry(161, I18n.format("createWorld.customize.custom.useLavaOceans", new Object[0]), true, this.field_175336_F.useLavaOceans), new GuiPageButtonList.GuiSlideEntry(162, I18n.format("createWorld.customize.custom.fixedBiome", new Object[0]), true, this, -1.0F, 37.0F, (float)this.field_175336_F.fixedBiome), new GuiPageButtonList.GuiSlideEntry(163, I18n.format("createWorld.customize.custom.biomeSize", new Object[0]), true, this, 1.0F, 8.0F, (float)this.field_175336_F.biomeSize), new GuiPageButtonList.GuiSlideEntry(164, I18n.format("createWorld.customize.custom.riverSize", new Object[0]), true, this, 1.0F, 5.0F, (float)this.field_175336_F.riverSize)}; + GuiPageButtonList.GuiListEntry[] aguipagebuttonlist$guilistentry1 = new GuiPageButtonList.GuiListEntry[] {new GuiPageButtonList.GuiLabelEntry(416, I18n.format("tile.dirt.name", new Object[0]), false), null, new GuiPageButtonList.GuiSlideEntry(165, I18n.format("createWorld.customize.custom.size", new Object[0]), false, this, 1.0F, 50.0F, (float)this.field_175336_F.dirtSize), new GuiPageButtonList.GuiSlideEntry(166, I18n.format("createWorld.customize.custom.count", new Object[0]), false, this, 0.0F, 40.0F, (float)this.field_175336_F.dirtCount), new GuiPageButtonList.GuiSlideEntry(167, I18n.format("createWorld.customize.custom.minHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.dirtMinHeight), new GuiPageButtonList.GuiSlideEntry(168, I18n.format("createWorld.customize.custom.maxHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.dirtMaxHeight), new GuiPageButtonList.GuiLabelEntry(417, I18n.format("tile.gravel.name", new Object[0]), false), null, new GuiPageButtonList.GuiSlideEntry(169, I18n.format("createWorld.customize.custom.size", new Object[0]), false, this, 1.0F, 50.0F, (float)this.field_175336_F.gravelSize), new GuiPageButtonList.GuiSlideEntry(170, I18n.format("createWorld.customize.custom.count", new Object[0]), false, this, 0.0F, 40.0F, (float)this.field_175336_F.gravelCount), new GuiPageButtonList.GuiSlideEntry(171, I18n.format("createWorld.customize.custom.minHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.gravelMinHeight), new GuiPageButtonList.GuiSlideEntry(172, I18n.format("createWorld.customize.custom.maxHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.gravelMaxHeight), new GuiPageButtonList.GuiLabelEntry(418, I18n.format("tile.stone.granite.name", new Object[0]), false), null, new GuiPageButtonList.GuiSlideEntry(173, I18n.format("createWorld.customize.custom.size", new Object[0]), false, this, 1.0F, 50.0F, (float)this.field_175336_F.graniteSize), new GuiPageButtonList.GuiSlideEntry(174, I18n.format("createWorld.customize.custom.count", new Object[0]), false, this, 0.0F, 40.0F, (float)this.field_175336_F.graniteCount), new GuiPageButtonList.GuiSlideEntry(175, I18n.format("createWorld.customize.custom.minHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.graniteMinHeight), new GuiPageButtonList.GuiSlideEntry(176, I18n.format("createWorld.customize.custom.maxHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.graniteMaxHeight), new GuiPageButtonList.GuiLabelEntry(419, I18n.format("tile.stone.diorite.name", new Object[0]), false), null, new GuiPageButtonList.GuiSlideEntry(177, I18n.format("createWorld.customize.custom.size", new Object[0]), false, this, 1.0F, 50.0F, (float)this.field_175336_F.dioriteSize), new GuiPageButtonList.GuiSlideEntry(178, I18n.format("createWorld.customize.custom.count", new Object[0]), false, this, 0.0F, 40.0F, (float)this.field_175336_F.dioriteCount), new GuiPageButtonList.GuiSlideEntry(179, I18n.format("createWorld.customize.custom.minHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.dioriteMinHeight), new GuiPageButtonList.GuiSlideEntry(180, I18n.format("createWorld.customize.custom.maxHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.dioriteMaxHeight), new GuiPageButtonList.GuiLabelEntry(420, I18n.format("tile.stone.andesite.name", new Object[0]), false), null, new GuiPageButtonList.GuiSlideEntry(181, I18n.format("createWorld.customize.custom.size", new Object[0]), false, this, 1.0F, 50.0F, (float)this.field_175336_F.andesiteSize), new GuiPageButtonList.GuiSlideEntry(182, I18n.format("createWorld.customize.custom.count", new Object[0]), false, this, 0.0F, 40.0F, (float)this.field_175336_F.andesiteCount), new GuiPageButtonList.GuiSlideEntry(183, I18n.format("createWorld.customize.custom.minHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.andesiteMinHeight), new GuiPageButtonList.GuiSlideEntry(184, I18n.format("createWorld.customize.custom.maxHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.andesiteMaxHeight), new GuiPageButtonList.GuiLabelEntry(421, I18n.format("tile.oreCoal.name", new Object[0]), false), null, new GuiPageButtonList.GuiSlideEntry(185, I18n.format("createWorld.customize.custom.size", new Object[0]), false, this, 1.0F, 50.0F, (float)this.field_175336_F.coalSize), new GuiPageButtonList.GuiSlideEntry(186, I18n.format("createWorld.customize.custom.count", new Object[0]), false, this, 0.0F, 40.0F, (float)this.field_175336_F.coalCount), new GuiPageButtonList.GuiSlideEntry(187, I18n.format("createWorld.customize.custom.minHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.coalMinHeight), new GuiPageButtonList.GuiSlideEntry(189, I18n.format("createWorld.customize.custom.maxHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.coalMaxHeight), new GuiPageButtonList.GuiLabelEntry(422, I18n.format("tile.oreIron.name", new Object[0]), false), null, new GuiPageButtonList.GuiSlideEntry(190, I18n.format("createWorld.customize.custom.size", new Object[0]), false, this, 1.0F, 50.0F, (float)this.field_175336_F.ironSize), new GuiPageButtonList.GuiSlideEntry(191, I18n.format("createWorld.customize.custom.count", new Object[0]), false, this, 0.0F, 40.0F, (float)this.field_175336_F.ironCount), new GuiPageButtonList.GuiSlideEntry(192, I18n.format("createWorld.customize.custom.minHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.ironMinHeight), new GuiPageButtonList.GuiSlideEntry(193, I18n.format("createWorld.customize.custom.maxHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.ironMaxHeight), new GuiPageButtonList.GuiLabelEntry(423, I18n.format("tile.oreGold.name", new Object[0]), false), null, new GuiPageButtonList.GuiSlideEntry(194, I18n.format("createWorld.customize.custom.size", new Object[0]), false, this, 1.0F, 50.0F, (float)this.field_175336_F.goldSize), new GuiPageButtonList.GuiSlideEntry(195, I18n.format("createWorld.customize.custom.count", new Object[0]), false, this, 0.0F, 40.0F, (float)this.field_175336_F.goldCount), new GuiPageButtonList.GuiSlideEntry(196, I18n.format("createWorld.customize.custom.minHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.goldMinHeight), new GuiPageButtonList.GuiSlideEntry(197, I18n.format("createWorld.customize.custom.maxHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.goldMaxHeight), new GuiPageButtonList.GuiLabelEntry(424, I18n.format("tile.oreRedstone.name", new Object[0]), false), null, new GuiPageButtonList.GuiSlideEntry(198, I18n.format("createWorld.customize.custom.size", new Object[0]), false, this, 1.0F, 50.0F, (float)this.field_175336_F.redstoneSize), new GuiPageButtonList.GuiSlideEntry(199, I18n.format("createWorld.customize.custom.count", new Object[0]), false, this, 0.0F, 40.0F, (float)this.field_175336_F.redstoneCount), new GuiPageButtonList.GuiSlideEntry(200, I18n.format("createWorld.customize.custom.minHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.redstoneMinHeight), new GuiPageButtonList.GuiSlideEntry(201, I18n.format("createWorld.customize.custom.maxHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.redstoneMaxHeight), new GuiPageButtonList.GuiLabelEntry(425, I18n.format("tile.oreDiamond.name", new Object[0]), false), null, new GuiPageButtonList.GuiSlideEntry(202, I18n.format("createWorld.customize.custom.size", new Object[0]), false, this, 1.0F, 50.0F, (float)this.field_175336_F.diamondSize), new GuiPageButtonList.GuiSlideEntry(203, I18n.format("createWorld.customize.custom.count", new Object[0]), false, this, 0.0F, 40.0F, (float)this.field_175336_F.diamondCount), new GuiPageButtonList.GuiSlideEntry(204, I18n.format("createWorld.customize.custom.minHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.diamondMinHeight), new GuiPageButtonList.GuiSlideEntry(205, I18n.format("createWorld.customize.custom.maxHeight", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.diamondMaxHeight), new GuiPageButtonList.GuiLabelEntry(426, I18n.format("tile.oreLapis.name", new Object[0]), false), null, new GuiPageButtonList.GuiSlideEntry(206, I18n.format("createWorld.customize.custom.size", new Object[0]), false, this, 1.0F, 50.0F, (float)this.field_175336_F.lapisSize), new GuiPageButtonList.GuiSlideEntry(207, I18n.format("createWorld.customize.custom.count", new Object[0]), false, this, 0.0F, 40.0F, (float)this.field_175336_F.lapisCount), new GuiPageButtonList.GuiSlideEntry(208, I18n.format("createWorld.customize.custom.center", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.lapisCenterHeight), new GuiPageButtonList.GuiSlideEntry(209, I18n.format("createWorld.customize.custom.spread", new Object[0]), false, this, 0.0F, 255.0F, (float)this.field_175336_F.lapisSpread)}; + GuiPageButtonList.GuiListEntry[] aguipagebuttonlist$guilistentry2 = new GuiPageButtonList.GuiListEntry[] {new GuiPageButtonList.GuiSlideEntry(100, I18n.format("createWorld.customize.custom.mainNoiseScaleX", new Object[0]), false, this, 1.0F, 5000.0F, this.field_175336_F.mainNoiseScaleX), new GuiPageButtonList.GuiSlideEntry(101, I18n.format("createWorld.customize.custom.mainNoiseScaleY", new Object[0]), false, this, 1.0F, 5000.0F, this.field_175336_F.mainNoiseScaleY), new GuiPageButtonList.GuiSlideEntry(102, I18n.format("createWorld.customize.custom.mainNoiseScaleZ", new Object[0]), false, this, 1.0F, 5000.0F, this.field_175336_F.mainNoiseScaleZ), new GuiPageButtonList.GuiSlideEntry(103, I18n.format("createWorld.customize.custom.depthNoiseScaleX", new Object[0]), false, this, 1.0F, 2000.0F, this.field_175336_F.depthNoiseScaleX), new GuiPageButtonList.GuiSlideEntry(104, I18n.format("createWorld.customize.custom.depthNoiseScaleZ", new Object[0]), false, this, 1.0F, 2000.0F, this.field_175336_F.depthNoiseScaleZ), new GuiPageButtonList.GuiSlideEntry(105, I18n.format("createWorld.customize.custom.depthNoiseScaleExponent", new Object[0]), false, this, 0.01F, 20.0F, this.field_175336_F.depthNoiseScaleExponent), new GuiPageButtonList.GuiSlideEntry(106, I18n.format("createWorld.customize.custom.baseSize", new Object[0]), false, this, 1.0F, 25.0F, this.field_175336_F.baseSize), new GuiPageButtonList.GuiSlideEntry(107, I18n.format("createWorld.customize.custom.coordinateScale", new Object[0]), false, this, 1.0F, 6000.0F, this.field_175336_F.coordinateScale), new GuiPageButtonList.GuiSlideEntry(108, I18n.format("createWorld.customize.custom.heightScale", new Object[0]), false, this, 1.0F, 6000.0F, this.field_175336_F.heightScale), new GuiPageButtonList.GuiSlideEntry(109, I18n.format("createWorld.customize.custom.stretchY", new Object[0]), false, this, 0.01F, 50.0F, this.field_175336_F.stretchY), new GuiPageButtonList.GuiSlideEntry(110, I18n.format("createWorld.customize.custom.upperLimitScale", new Object[0]), false, this, 1.0F, 5000.0F, this.field_175336_F.upperLimitScale), new GuiPageButtonList.GuiSlideEntry(111, I18n.format("createWorld.customize.custom.lowerLimitScale", new Object[0]), false, this, 1.0F, 5000.0F, this.field_175336_F.lowerLimitScale), new GuiPageButtonList.GuiSlideEntry(112, I18n.format("createWorld.customize.custom.biomeDepthWeight", new Object[0]), false, this, 1.0F, 20.0F, this.field_175336_F.biomeDepthWeight), new GuiPageButtonList.GuiSlideEntry(113, I18n.format("createWorld.customize.custom.biomeDepthOffset", new Object[0]), false, this, 0.0F, 20.0F, this.field_175336_F.biomeDepthOffset), new GuiPageButtonList.GuiSlideEntry(114, I18n.format("createWorld.customize.custom.biomeScaleWeight", new Object[0]), false, this, 1.0F, 20.0F, this.field_175336_F.biomeScaleWeight), new GuiPageButtonList.GuiSlideEntry(115, I18n.format("createWorld.customize.custom.biomeScaleOffset", new Object[0]), false, this, 0.0F, 20.0F, this.field_175336_F.biomeScaleOffset)}; + GuiPageButtonList.GuiListEntry[] aguipagebuttonlist$guilistentry3 = new GuiPageButtonList.GuiListEntry[] {new GuiPageButtonList.GuiLabelEntry(400, I18n.format("createWorld.customize.custom.mainNoiseScaleX", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(132, String.format("%5.3f", new Object[]{Float.valueOf(this.field_175336_F.mainNoiseScaleX)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(401, I18n.format("createWorld.customize.custom.mainNoiseScaleY", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(133, String.format("%5.3f", new Object[]{Float.valueOf(this.field_175336_F.mainNoiseScaleY)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(402, I18n.format("createWorld.customize.custom.mainNoiseScaleZ", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(134, String.format("%5.3f", new Object[]{Float.valueOf(this.field_175336_F.mainNoiseScaleZ)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(403, I18n.format("createWorld.customize.custom.depthNoiseScaleX", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(135, String.format("%5.3f", new Object[]{Float.valueOf(this.field_175336_F.depthNoiseScaleX)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(404, I18n.format("createWorld.customize.custom.depthNoiseScaleZ", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(136, String.format("%5.3f", new Object[]{Float.valueOf(this.field_175336_F.depthNoiseScaleZ)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(405, I18n.format("createWorld.customize.custom.depthNoiseScaleExponent", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(137, String.format("%2.3f", new Object[]{Float.valueOf(this.field_175336_F.depthNoiseScaleExponent)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(406, I18n.format("createWorld.customize.custom.baseSize", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(138, String.format("%2.3f", new Object[]{Float.valueOf(this.field_175336_F.baseSize)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(407, I18n.format("createWorld.customize.custom.coordinateScale", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(139, String.format("%5.3f", new Object[]{Float.valueOf(this.field_175336_F.coordinateScale)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(408, I18n.format("createWorld.customize.custom.heightScale", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(140, String.format("%5.3f", new Object[]{Float.valueOf(this.field_175336_F.heightScale)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(409, I18n.format("createWorld.customize.custom.stretchY", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(141, String.format("%2.3f", new Object[]{Float.valueOf(this.field_175336_F.stretchY)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(410, I18n.format("createWorld.customize.custom.upperLimitScale", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(142, String.format("%5.3f", new Object[]{Float.valueOf(this.field_175336_F.upperLimitScale)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(411, I18n.format("createWorld.customize.custom.lowerLimitScale", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(143, String.format("%5.3f", new Object[]{Float.valueOf(this.field_175336_F.lowerLimitScale)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(412, I18n.format("createWorld.customize.custom.biomeDepthWeight", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(144, String.format("%2.3f", new Object[]{Float.valueOf(this.field_175336_F.biomeDepthWeight)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(413, I18n.format("createWorld.customize.custom.biomeDepthOffset", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(145, String.format("%2.3f", new Object[]{Float.valueOf(this.field_175336_F.biomeDepthOffset)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(414, I18n.format("createWorld.customize.custom.biomeScaleWeight", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(146, String.format("%2.3f", new Object[]{Float.valueOf(this.field_175336_F.biomeScaleWeight)}), false, this.field_175332_D), new GuiPageButtonList.GuiLabelEntry(415, I18n.format("createWorld.customize.custom.biomeScaleOffset", new Object[0]) + ":", false), new GuiPageButtonList.EditBoxEntry(147, String.format("%2.3f", new Object[]{Float.valueOf(this.field_175336_F.biomeScaleOffset)}), false, this.field_175332_D)}; + this.field_175349_r = new GuiPageButtonList(this.mc, this.width, this.height, 32, this.height - 32, 25, this, new GuiPageButtonList.GuiListEntry[][] {aguipagebuttonlist$guilistentry, aguipagebuttonlist$guilistentry1, aguipagebuttonlist$guilistentry2, aguipagebuttonlist$guilistentry3}); + + for (int i = 0; i < 4; ++i) + { + this.field_175342_h[i] = I18n.format("createWorld.customize.custom.page" + i, new Object[0]); + } + + this.func_175328_i(); + } + + public String func_175323_a() + { + return this.field_175336_F.toString().replace("\n", ""); + } + + public void func_175324_a(String p_175324_1_) + { + if (p_175324_1_ != null && p_175324_1_.length() != 0) + { + this.field_175336_F = ChunkProviderSettings.Factory.jsonToFactory(p_175324_1_); + } + else + { + this.field_175336_F = new ChunkProviderSettings.Factory(); + } + } + + public void func_175319_a(int p_175319_1_, String p_175319_2_) + { + float f = 0.0F; + + try + { + f = Float.parseFloat(p_175319_2_); + } + catch (NumberFormatException var5) + { + ; + } + + float f1 = 0.0F; + + switch (p_175319_1_) + { + case 132: + f1 = this.field_175336_F.mainNoiseScaleX = MathHelper.clamp_float(f, 1.0F, 5000.0F); + break; + + case 133: + f1 = this.field_175336_F.mainNoiseScaleY = MathHelper.clamp_float(f, 1.0F, 5000.0F); + break; + + case 134: + f1 = this.field_175336_F.mainNoiseScaleZ = MathHelper.clamp_float(f, 1.0F, 5000.0F); + break; + + case 135: + f1 = this.field_175336_F.depthNoiseScaleX = MathHelper.clamp_float(f, 1.0F, 2000.0F); + break; + + case 136: + f1 = this.field_175336_F.depthNoiseScaleZ = MathHelper.clamp_float(f, 1.0F, 2000.0F); + break; + + case 137: + f1 = this.field_175336_F.depthNoiseScaleExponent = MathHelper.clamp_float(f, 0.01F, 20.0F); + break; + + case 138: + f1 = this.field_175336_F.baseSize = MathHelper.clamp_float(f, 1.0F, 25.0F); + break; + + case 139: + f1 = this.field_175336_F.coordinateScale = MathHelper.clamp_float(f, 1.0F, 6000.0F); + break; + + case 140: + f1 = this.field_175336_F.heightScale = MathHelper.clamp_float(f, 1.0F, 6000.0F); + break; + + case 141: + f1 = this.field_175336_F.stretchY = MathHelper.clamp_float(f, 0.01F, 50.0F); + break; + + case 142: + f1 = this.field_175336_F.upperLimitScale = MathHelper.clamp_float(f, 1.0F, 5000.0F); + break; + + case 143: + f1 = this.field_175336_F.lowerLimitScale = MathHelper.clamp_float(f, 1.0F, 5000.0F); + break; + + case 144: + f1 = this.field_175336_F.biomeDepthWeight = MathHelper.clamp_float(f, 1.0F, 20.0F); + break; + + case 145: + f1 = this.field_175336_F.biomeDepthOffset = MathHelper.clamp_float(f, 0.0F, 20.0F); + break; + + case 146: + f1 = this.field_175336_F.biomeScaleWeight = MathHelper.clamp_float(f, 1.0F, 20.0F); + break; + + case 147: + f1 = this.field_175336_F.biomeScaleOffset = MathHelper.clamp_float(f, 0.0F, 20.0F); + } + + if (f1 != f && f != 0.0F) + { + ((GuiTextField)this.field_175349_r.func_178061_c(p_175319_1_)).setText(this.func_175330_b(p_175319_1_, f1)); + } + + ((GuiSlider)this.field_175349_r.func_178061_c(p_175319_1_ - 132 + 100)).func_175218_a(f1, false); + + if (!this.field_175336_F.equals(this.field_175334_E)) + { + this.func_181031_a(true); + } + } + + private void func_181031_a(boolean p_181031_1_) + { + this.field_175338_A = p_181031_1_; + this.field_175346_u.enabled = p_181031_1_; + } + + public String getText(int id, String name, float value) + { + return name + ": " + this.func_175330_b(id, value); + } + + private String func_175330_b(int p_175330_1_, float p_175330_2_) + { + switch (p_175330_1_) + { + case 100: + case 101: + case 102: + case 103: + case 104: + case 107: + case 108: + case 110: + case 111: + case 132: + case 133: + case 134: + case 135: + case 136: + case 139: + case 140: + case 142: + case 143: + return String.format("%5.3f", new Object[] {Float.valueOf(p_175330_2_)}); + + case 105: + case 106: + case 109: + case 112: + case 113: + case 114: + case 115: + case 137: + case 138: + case 141: + case 144: + case 145: + case 146: + case 147: + return String.format("%2.3f", new Object[] {Float.valueOf(p_175330_2_)}); + + case 116: + case 117: + case 118: + case 119: + case 120: + case 121: + case 122: + case 123: + case 124: + case 125: + case 126: + case 127: + case 128: + case 129: + case 130: + case 131: + case 148: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 157: + case 158: + case 159: + case 160: + case 161: + default: + return String.format("%d", new Object[] {Integer.valueOf((int)p_175330_2_)}); + + case 162: + if (p_175330_2_ < 0.0F) + { + return I18n.format("gui.all", new Object[0]); + } + else if ((int)p_175330_2_ >= BiomeGenBase.hell.biomeID) + { + BiomeGenBase biomegenbase1 = BiomeGenBase.getBiomeGenArray()[(int)p_175330_2_ + 2]; + return biomegenbase1 != null ? biomegenbase1.biomeName : "?"; + } + else + { + BiomeGenBase biomegenbase = BiomeGenBase.getBiomeGenArray()[(int)p_175330_2_]; + return biomegenbase != null ? biomegenbase.biomeName : "?"; + } + } + } + + public void func_175321_a(int p_175321_1_, boolean p_175321_2_) + { + switch (p_175321_1_) + { + case 148: + this.field_175336_F.useCaves = p_175321_2_; + break; + + case 149: + this.field_175336_F.useDungeons = p_175321_2_; + break; + + case 150: + this.field_175336_F.useStrongholds = p_175321_2_; + break; + + case 151: + this.field_175336_F.useVillages = p_175321_2_; + break; + + case 152: + this.field_175336_F.useMineShafts = p_175321_2_; + break; + + case 153: + this.field_175336_F.useTemples = p_175321_2_; + break; + + case 154: + this.field_175336_F.useRavines = p_175321_2_; + break; + + case 155: + this.field_175336_F.useWaterLakes = p_175321_2_; + break; + + case 156: + this.field_175336_F.useLavaLakes = p_175321_2_; + break; + + case 161: + this.field_175336_F.useLavaOceans = p_175321_2_; + break; + + case 210: + this.field_175336_F.useMonuments = p_175321_2_; + } + + if (!this.field_175336_F.equals(this.field_175334_E)) + { + this.func_181031_a(true); + } + } + + public void onTick(int id, float value) + { + switch (id) + { + case 100: + this.field_175336_F.mainNoiseScaleX = value; + break; + + case 101: + this.field_175336_F.mainNoiseScaleY = value; + break; + + case 102: + this.field_175336_F.mainNoiseScaleZ = value; + break; + + case 103: + this.field_175336_F.depthNoiseScaleX = value; + break; + + case 104: + this.field_175336_F.depthNoiseScaleZ = value; + break; + + case 105: + this.field_175336_F.depthNoiseScaleExponent = value; + break; + + case 106: + this.field_175336_F.baseSize = value; + break; + + case 107: + this.field_175336_F.coordinateScale = value; + break; + + case 108: + this.field_175336_F.heightScale = value; + break; + + case 109: + this.field_175336_F.stretchY = value; + break; + + case 110: + this.field_175336_F.upperLimitScale = value; + break; + + case 111: + this.field_175336_F.lowerLimitScale = value; + break; + + case 112: + this.field_175336_F.biomeDepthWeight = value; + break; + + case 113: + this.field_175336_F.biomeDepthOffset = value; + break; + + case 114: + this.field_175336_F.biomeScaleWeight = value; + break; + + case 115: + this.field_175336_F.biomeScaleOffset = value; + + case 116: + case 117: + case 118: + case 119: + case 120: + case 121: + case 122: + case 123: + case 124: + case 125: + case 126: + case 127: + case 128: + case 129: + case 130: + case 131: + case 132: + case 133: + case 134: + case 135: + case 136: + case 137: + case 138: + case 139: + case 140: + case 141: + case 142: + case 143: + case 144: + case 145: + case 146: + case 147: + case 148: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 161: + case 188: + default: + break; + + case 157: + this.field_175336_F.dungeonChance = (int)value; + break; + + case 158: + this.field_175336_F.waterLakeChance = (int)value; + break; + + case 159: + this.field_175336_F.lavaLakeChance = (int)value; + break; + + case 160: + this.field_175336_F.seaLevel = (int)value; + break; + + case 162: + this.field_175336_F.fixedBiome = (int)value; + break; + + case 163: + this.field_175336_F.biomeSize = (int)value; + break; + + case 164: + this.field_175336_F.riverSize = (int)value; + break; + + case 165: + this.field_175336_F.dirtSize = (int)value; + break; + + case 166: + this.field_175336_F.dirtCount = (int)value; + break; + + case 167: + this.field_175336_F.dirtMinHeight = (int)value; + break; + + case 168: + this.field_175336_F.dirtMaxHeight = (int)value; + break; + + case 169: + this.field_175336_F.gravelSize = (int)value; + break; + + case 170: + this.field_175336_F.gravelCount = (int)value; + break; + + case 171: + this.field_175336_F.gravelMinHeight = (int)value; + break; + + case 172: + this.field_175336_F.gravelMaxHeight = (int)value; + break; + + case 173: + this.field_175336_F.graniteSize = (int)value; + break; + + case 174: + this.field_175336_F.graniteCount = (int)value; + break; + + case 175: + this.field_175336_F.graniteMinHeight = (int)value; + break; + + case 176: + this.field_175336_F.graniteMaxHeight = (int)value; + break; + + case 177: + this.field_175336_F.dioriteSize = (int)value; + break; + + case 178: + this.field_175336_F.dioriteCount = (int)value; + break; + + case 179: + this.field_175336_F.dioriteMinHeight = (int)value; + break; + + case 180: + this.field_175336_F.dioriteMaxHeight = (int)value; + break; + + case 181: + this.field_175336_F.andesiteSize = (int)value; + break; + + case 182: + this.field_175336_F.andesiteCount = (int)value; + break; + + case 183: + this.field_175336_F.andesiteMinHeight = (int)value; + break; + + case 184: + this.field_175336_F.andesiteMaxHeight = (int)value; + break; + + case 185: + this.field_175336_F.coalSize = (int)value; + break; + + case 186: + this.field_175336_F.coalCount = (int)value; + break; + + case 187: + this.field_175336_F.coalMinHeight = (int)value; + break; + + case 189: + this.field_175336_F.coalMaxHeight = (int)value; + break; + + case 190: + this.field_175336_F.ironSize = (int)value; + break; + + case 191: + this.field_175336_F.ironCount = (int)value; + break; + + case 192: + this.field_175336_F.ironMinHeight = (int)value; + break; + + case 193: + this.field_175336_F.ironMaxHeight = (int)value; + break; + + case 194: + this.field_175336_F.goldSize = (int)value; + break; + + case 195: + this.field_175336_F.goldCount = (int)value; + break; + + case 196: + this.field_175336_F.goldMinHeight = (int)value; + break; + + case 197: + this.field_175336_F.goldMaxHeight = (int)value; + break; + + case 198: + this.field_175336_F.redstoneSize = (int)value; + break; + + case 199: + this.field_175336_F.redstoneCount = (int)value; + break; + + case 200: + this.field_175336_F.redstoneMinHeight = (int)value; + break; + + case 201: + this.field_175336_F.redstoneMaxHeight = (int)value; + break; + + case 202: + this.field_175336_F.diamondSize = (int)value; + break; + + case 203: + this.field_175336_F.diamondCount = (int)value; + break; + + case 204: + this.field_175336_F.diamondMinHeight = (int)value; + break; + + case 205: + this.field_175336_F.diamondMaxHeight = (int)value; + break; + + case 206: + this.field_175336_F.lapisSize = (int)value; + break; + + case 207: + this.field_175336_F.lapisCount = (int)value; + break; + + case 208: + this.field_175336_F.lapisCenterHeight = (int)value; + break; + + case 209: + this.field_175336_F.lapisSpread = (int)value; + } + + if (id >= 100 && id < 116) + { + Gui gui = this.field_175349_r.func_178061_c(id - 100 + 132); + + if (gui != null) + { + ((GuiTextField)gui).setText(this.func_175330_b(id, value)); + } + } + + if (!this.field_175336_F.equals(this.field_175334_E)) + { + this.func_181031_a(true); + } + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + switch (button.id) + { + case 300: + this.field_175343_i.chunkProviderSettingsJson = this.field_175336_F.toString(); + this.mc.displayGuiScreen(this.field_175343_i); + break; + + case 301: + for (int i = 0; i < this.field_175349_r.getSize(); ++i) + { + GuiPageButtonList.GuiEntry guipagebuttonlist$guientry = this.field_175349_r.getListEntry(i); + Gui gui = guipagebuttonlist$guientry.func_178022_a(); + + if (gui instanceof GuiButton) + { + GuiButton guibutton = (GuiButton)gui; + + if (guibutton instanceof GuiSlider) + { + float f = ((GuiSlider)guibutton).func_175217_d() * (0.75F + this.random.nextFloat() * 0.5F) + (this.random.nextFloat() * 0.1F - 0.05F); + ((GuiSlider)guibutton).func_175219_a(MathHelper.clamp_float(f, 0.0F, 1.0F)); + } + else if (guibutton instanceof GuiListButton) + { + ((GuiListButton)guibutton).func_175212_b(this.random.nextBoolean()); + } + } + + Gui gui1 = guipagebuttonlist$guientry.func_178021_b(); + + if (gui1 instanceof GuiButton) + { + GuiButton guibutton1 = (GuiButton)gui1; + + if (guibutton1 instanceof GuiSlider) + { + float f1 = ((GuiSlider)guibutton1).func_175217_d() * (0.75F + this.random.nextFloat() * 0.5F) + (this.random.nextFloat() * 0.1F - 0.05F); + ((GuiSlider)guibutton1).func_175219_a(MathHelper.clamp_float(f1, 0.0F, 1.0F)); + } + else if (guibutton1 instanceof GuiListButton) + { + ((GuiListButton)guibutton1).func_175212_b(this.random.nextBoolean()); + } + } + } + + return; + + case 302: + this.field_175349_r.func_178071_h(); + this.func_175328_i(); + break; + + case 303: + this.field_175349_r.func_178064_i(); + this.func_175328_i(); + break; + + case 304: + if (this.field_175338_A) + { + this.func_175322_b(304); + } + + break; + + case 305: + this.mc.displayGuiScreen(new GuiScreenCustomizePresets(this)); + break; + + case 306: + this.func_175331_h(); + break; + + case 307: + this.field_175339_B = 0; + this.func_175331_h(); + } + } + } + + private void func_175326_g() + { + this.field_175336_F.func_177863_a(); + this.func_175325_f(); + this.func_181031_a(false); + } + + private void func_175322_b(int p_175322_1_) + { + this.field_175339_B = p_175322_1_; + this.func_175329_a(true); + } + + private void func_175331_h() throws IOException + { + switch (this.field_175339_B) + { + case 300: + this.actionPerformed((GuiListButton)this.field_175349_r.func_178061_c(300)); + break; + + case 304: + this.func_175326_g(); + } + + this.field_175339_B = 0; + this.field_175340_C = true; + this.func_175329_a(false); + } + + private void func_175329_a(boolean p_175329_1_) + { + this.field_175352_x.visible = p_175329_1_; + this.field_175351_y.visible = p_175329_1_; + this.field_175347_t.enabled = !p_175329_1_; + this.field_175348_s.enabled = !p_175329_1_; + this.field_175345_v.enabled = !p_175329_1_; + this.field_175344_w.enabled = !p_175329_1_; + this.field_175346_u.enabled = this.field_175338_A && !p_175329_1_; + this.field_175350_z.enabled = !p_175329_1_; + this.field_175349_r.func_181155_a(!p_175329_1_); + } + + private void func_175328_i() + { + this.field_175345_v.enabled = this.field_175349_r.func_178059_e() != 0; + this.field_175344_w.enabled = this.field_175349_r.func_178059_e() != this.field_175349_r.func_178057_f() - 1; + this.field_175333_f = I18n.format("book.pageIndicator", new Object[] {Integer.valueOf(this.field_175349_r.func_178059_e() + 1), Integer.valueOf(this.field_175349_r.func_178057_f())}); + this.field_175335_g = this.field_175342_h[this.field_175349_r.func_178059_e()]; + this.field_175347_t.enabled = this.field_175349_r.func_178059_e() != this.field_175349_r.func_178057_f() - 1; + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + super.keyTyped(typedChar, keyCode); + + if (this.field_175339_B == 0) + { + switch (keyCode) + { + case 200: + this.func_175327_a(1.0F); + break; + + case 208: + this.func_175327_a(-1.0F); + break; + + default: + this.field_175349_r.func_178062_a(typedChar, keyCode); + } + } + } + + private void func_175327_a(float p_175327_1_) + { + Gui gui = this.field_175349_r.func_178056_g(); + + if (gui instanceof GuiTextField) + { + float f = p_175327_1_; + + if (GuiScreen.isShiftKeyDown()) + { + f = p_175327_1_ * 0.1F; + + if (GuiScreen.isCtrlKeyDown()) + { + f *= 0.1F; + } + } + else if (GuiScreen.isCtrlKeyDown()) + { + f = p_175327_1_ * 10.0F; + + if (GuiScreen.isAltKeyDown()) + { + f *= 10.0F; + } + } + + GuiTextField guitextfield = (GuiTextField)gui; + Float f1 = Floats.tryParse(guitextfield.getText()); + + if (f1 != null) + { + f1 = Float.valueOf(f1.floatValue() + f); + int i = guitextfield.getId(); + String s = this.func_175330_b(guitextfield.getId(), f1.floatValue()); + guitextfield.setText(s); + this.func_175319_a(i, s); + } + } + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + super.mouseClicked(mouseX, mouseY, mouseButton); + + if (this.field_175339_B == 0 && !this.field_175340_C) + { + this.field_175349_r.mouseClicked(mouseX, mouseY, mouseButton); + } + } + + /** + * Called when a mouse button is released. Args : mouseX, mouseY, releaseButton + */ + protected void mouseReleased(int mouseX, int mouseY, int state) + { + super.mouseReleased(mouseX, mouseY, state); + + if (this.field_175340_C) + { + this.field_175340_C = false; + } + else if (this.field_175339_B == 0) + { + this.field_175349_r.mouseReleased(mouseX, mouseY, state); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.field_175349_r.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.fontRendererObj, this.field_175341_a, this.width / 2, 2, 16777215); + this.drawCenteredString(this.fontRendererObj, this.field_175333_f, this.width / 2, 12, 16777215); + this.drawCenteredString(this.fontRendererObj, this.field_175335_g, this.width / 2, 22, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + + if (this.field_175339_B != 0) + { + drawRect(0, 0, this.width, this.height, Integer.MIN_VALUE); + this.drawHorizontalLine(this.width / 2 - 91, this.width / 2 + 90, 99, -2039584); + this.drawHorizontalLine(this.width / 2 - 91, this.width / 2 + 90, 185, -6250336); + this.drawVerticalLine(this.width / 2 - 91, 99, 185, -2039584); + this.drawVerticalLine(this.width / 2 + 90, 99, 185, -6250336); + float f = 85.0F; + float f1 = 180.0F; + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(optionsBackground); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + float f2 = 32.0F; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)(this.width / 2 - 90), 185.0D, 0.0D).tex(0.0D, 2.65625D).color(64, 64, 64, 64).endVertex(); + worldrenderer.pos((double)(this.width / 2 + 90), 185.0D, 0.0D).tex(5.625D, 2.65625D).color(64, 64, 64, 64).endVertex(); + worldrenderer.pos((double)(this.width / 2 + 90), 100.0D, 0.0D).tex(5.625D, 0.0D).color(64, 64, 64, 64).endVertex(); + worldrenderer.pos((double)(this.width / 2 - 90), 100.0D, 0.0D).tex(0.0D, 0.0D).color(64, 64, 64, 64).endVertex(); + tessellator.draw(); + this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.customize.custom.confirmTitle", new Object[0]), this.width / 2, 105, 16777215); + this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.customize.custom.confirm1", new Object[0]), this.width / 2, 125, 16777215); + this.drawCenteredString(this.fontRendererObj, I18n.format("createWorld.customize.custom.confirm2", new Object[0]), this.width / 2, 135, 16777215); + this.field_175352_x.drawButton(this.mc, mouseX, mouseY); + this.field_175351_y.drawButton(this.mc, mouseX, mouseY); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiDisconnected.java b/src/minecraft/net/minecraft/client/gui/GuiDisconnected.java new file mode 100644 index 0000000..655ef33 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiDisconnected.java @@ -0,0 +1,74 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import java.util.List; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.IChatComponent; + +public class GuiDisconnected extends GuiScreen +{ + private String reason; + private IChatComponent message; + private List multilineMessage; + private final GuiScreen parentScreen; + private int field_175353_i; + + public GuiDisconnected(GuiScreen screen, String reasonLocalizationKey, IChatComponent chatComp) + { + this.parentScreen = screen; + this.reason = I18n.format(reasonLocalizationKey, new Object[0]); + this.message = chatComp; + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.clear(); + this.multilineMessage = this.fontRendererObj.listFormattedStringToWidth(this.message.getFormattedText(), this.width - 50); + this.field_175353_i = this.multilineMessage.size() * this.fontRendererObj.FONT_HEIGHT; + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 2 + this.field_175353_i / 2 + this.fontRendererObj.FONT_HEIGHT, I18n.format("gui.toMenu", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.id == 0) + { + this.mc.displayGuiScreen(this.parentScreen); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.reason, this.width / 2, this.height / 2 - this.field_175353_i / 2 - this.fontRendererObj.FONT_HEIGHT * 2, 11184810); + int i = this.height / 2 - this.field_175353_i / 2; + + if (this.multilineMessage != null) + { + for (String s : this.multilineMessage) + { + this.drawCenteredString(this.fontRendererObj, s, this.width / 2, i, 16777215); + i += this.fontRendererObj.FONT_HEIGHT; + } + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiDownloadTerrain.java b/src/minecraft/net/minecraft/client/gui/GuiDownloadTerrain.java new file mode 100644 index 0000000..f613195 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiDownloadTerrain.java @@ -0,0 +1,65 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.resources.I18n; +import net.minecraft.network.play.client.C00PacketKeepAlive; + +public class GuiDownloadTerrain extends GuiScreen +{ + private NetHandlerPlayClient netHandlerPlayClient; + private int progress; + + public GuiDownloadTerrain(NetHandlerPlayClient netHandler) + { + this.netHandlerPlayClient = netHandler; + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.clear(); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + ++this.progress; + + if (this.progress % 20 == 0) + { + this.netHandlerPlayClient.addToSendQueue(new C00PacketKeepAlive()); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawBackground(0); + this.drawCenteredString(this.fontRendererObj, I18n.format("multiplayer.downloadingTerrain", new Object[0]), this.width / 2, this.height / 2 - 50, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiEnchantment.java b/src/minecraft/net/minecraft/client/gui/GuiEnchantment.java new file mode 100644 index 0000000..8a71845 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiEnchantment.java @@ -0,0 +1,354 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import java.util.Random; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.model.ModelBook; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.resources.I18n; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ContainerEnchantment; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnchantmentNameParts; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IWorldNameable; +import net.minecraft.world.World; +import org.lwjgl.util.glu.Project; + +public class GuiEnchantment extends GuiContainer +{ + /** The ResourceLocation containing the Enchantment GUI texture location */ + private static final ResourceLocation ENCHANTMENT_TABLE_GUI_TEXTURE = new ResourceLocation("textures/gui/container/enchanting_table.png"); + + /** + * The ResourceLocation containing the texture for the Book rendered above the enchantment table + */ + private static final ResourceLocation ENCHANTMENT_TABLE_BOOK_TEXTURE = new ResourceLocation("textures/entity/enchanting_table_book.png"); + + /** + * The ModelBook instance used for rendering the book on the Enchantment table + */ + private static final ModelBook MODEL_BOOK = new ModelBook(); + + /** The player inventory currently bound to this GuiEnchantment instance. */ + private final InventoryPlayer playerInventory; + + /** A Random instance for use with the enchantment gui */ + private Random random = new Random(); + private ContainerEnchantment container; + public int field_147073_u; + public float field_147071_v; + public float field_147069_w; + public float field_147082_x; + public float field_147081_y; + public float field_147080_z; + public float field_147076_A; + ItemStack field_147077_B; + private final IWorldNameable field_175380_I; + + public GuiEnchantment(InventoryPlayer inventory, World worldIn, IWorldNameable p_i45502_3_) + { + super(new ContainerEnchantment(inventory, worldIn)); + this.playerInventory = inventory; + this.container = (ContainerEnchantment)this.inventorySlots; + this.field_175380_I = p_i45502_3_; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + this.fontRendererObj.drawString(this.field_175380_I.getDisplayName().getUnformattedText(), 12, 5, 4210752); + this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + this.func_147068_g(); + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + super.mouseClicked(mouseX, mouseY, mouseButton); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + + for (int k = 0; k < 3; ++k) + { + int l = mouseX - (i + 60); + int i1 = mouseY - (j + 14 + 19 * k); + + if (l >= 0 && i1 >= 0 && l < 108 && i1 < 19 && this.container.enchantItem(this.mc.thePlayer, k)) + { + this.mc.playerController.sendEnchantPacket(this.container.windowId, k); + } + } + } + + /** + * Args : renderPartialTicks, mouseX, mouseY + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(ENCHANTMENT_TABLE_GUI_TEXTURE); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); + GlStateManager.pushMatrix(); + GlStateManager.matrixMode(5889); + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + GlStateManager.viewport((scaledresolution.getScaledWidth() - 320) / 2 * scaledresolution.getScaleFactor(), (scaledresolution.getScaledHeight() - 240) / 2 * scaledresolution.getScaleFactor(), 320 * scaledresolution.getScaleFactor(), 240 * scaledresolution.getScaleFactor()); + GlStateManager.translate(-0.34F, 0.23F, 0.0F); + Project.gluPerspective(90.0F, 1.3333334F, 9.0F, 80.0F); + float f = 1.0F; + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + RenderHelper.enableStandardItemLighting(); + GlStateManager.translate(0.0F, 3.3F, -16.0F); + GlStateManager.scale(f, f, f); + float f1 = 5.0F; + GlStateManager.scale(f1, f1, f1); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + this.mc.getTextureManager().bindTexture(ENCHANTMENT_TABLE_BOOK_TEXTURE); + GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F); + float f2 = this.field_147076_A + (this.field_147080_z - this.field_147076_A) * partialTicks; + GlStateManager.translate((1.0F - f2) * 0.2F, (1.0F - f2) * 0.1F, (1.0F - f2) * 0.25F); + GlStateManager.rotate(-(1.0F - f2) * 90.0F - 90.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); + float f3 = this.field_147069_w + (this.field_147071_v - this.field_147069_w) * partialTicks + 0.25F; + float f4 = this.field_147069_w + (this.field_147071_v - this.field_147069_w) * partialTicks + 0.75F; + f3 = (f3 - (float)MathHelper.truncateDoubleToInt((double)f3)) * 1.6F - 0.3F; + f4 = (f4 - (float)MathHelper.truncateDoubleToInt((double)f4)) * 1.6F - 0.3F; + + if (f3 < 0.0F) + { + f3 = 0.0F; + } + + if (f4 < 0.0F) + { + f4 = 0.0F; + } + + if (f3 > 1.0F) + { + f3 = 1.0F; + } + + if (f4 > 1.0F) + { + f4 = 1.0F; + } + + GlStateManager.enableRescaleNormal(); + MODEL_BOOK.render((Entity)null, 0.0F, f3, f4, f2, 0.0F, 0.0625F); + GlStateManager.disableRescaleNormal(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.matrixMode(5889); + GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + EnchantmentNameParts.getInstance().reseedRandomGenerator((long)this.container.xpSeed); + int k = this.container.getLapisAmount(); + + for (int l = 0; l < 3; ++l) + { + int i1 = i + 60; + int j1 = i1 + 20; + int k1 = 86; + String s = EnchantmentNameParts.getInstance().generateNewRandomName(); + this.zLevel = 0.0F; + this.mc.getTextureManager().bindTexture(ENCHANTMENT_TABLE_GUI_TEXTURE); + int l1 = this.container.enchantLevels[l]; + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + + if (l1 == 0) + { + this.drawTexturedModalRect(i1, j + 14 + 19 * l, 0, 185, 108, 19); + } + else + { + String s1 = "" + l1; + FontRenderer fontrenderer = this.mc.standardGalacticFontRenderer; + int i2 = 6839882; + + if ((k < l + 1 || this.mc.thePlayer.experienceLevel < l1) && !this.mc.thePlayer.capabilities.isCreativeMode) + { + this.drawTexturedModalRect(i1, j + 14 + 19 * l, 0, 185, 108, 19); + this.drawTexturedModalRect(i1 + 1, j + 15 + 19 * l, 16 * l, 239, 16, 16); + fontrenderer.drawSplitString(s, j1, j + 16 + 19 * l, k1, (i2 & 16711422) >> 1); + i2 = 4226832; + } + else + { + int j2 = mouseX - (i + 60); + int k2 = mouseY - (j + 14 + 19 * l); + + if (j2 >= 0 && k2 >= 0 && j2 < 108 && k2 < 19) + { + this.drawTexturedModalRect(i1, j + 14 + 19 * l, 0, 204, 108, 19); + i2 = 16777088; + } + else + { + this.drawTexturedModalRect(i1, j + 14 + 19 * l, 0, 166, 108, 19); + } + + this.drawTexturedModalRect(i1 + 1, j + 15 + 19 * l, 16 * l, 223, 16, 16); + fontrenderer.drawSplitString(s, j1, j + 16 + 19 * l, k1, i2); + i2 = 8453920; + } + + fontrenderer = this.mc.fontRendererObj; + fontrenderer.drawStringWithShadow(s1, (float)(j1 + 86 - fontrenderer.getStringWidth(s1)), (float)(j + 16 + 19 * l + 7), i2); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + super.drawScreen(mouseX, mouseY, partialTicks); + boolean flag = this.mc.thePlayer.capabilities.isCreativeMode; + int i = this.container.getLapisAmount(); + + for (int j = 0; j < 3; ++j) + { + int k = this.container.enchantLevels[j]; + int l = this.container.field_178151_h[j]; + int i1 = j + 1; + + if (this.isPointInRegion(60, 14 + 19 * j, 108, 17, mouseX, mouseY) && k > 0 && l >= 0) + { + List list = Lists.newArrayList(); + + if (l >= 0 && Enchantment.getEnchantmentById(l & 255) != null) + { + String s = Enchantment.getEnchantmentById(l & 255).getTranslatedName((l & 65280) >> 8); + list.add(EnumChatFormatting.WHITE.toString() + EnumChatFormatting.ITALIC.toString() + I18n.format("container.enchant.clue", new Object[] {s})); + } + + if (!flag) + { + if (l >= 0) + { + list.add(""); + } + + if (this.mc.thePlayer.experienceLevel < k) + { + list.add(EnumChatFormatting.RED.toString() + "Level Requirement: " + this.container.enchantLevels[j]); + } + else + { + String s1 = ""; + + if (i1 == 1) + { + s1 = I18n.format("container.enchant.lapis.one", new Object[0]); + } + else + { + s1 = I18n.format("container.enchant.lapis.many", new Object[] {Integer.valueOf(i1)}); + } + + if (i >= i1) + { + list.add(EnumChatFormatting.GRAY.toString() + "" + s1); + } + else + { + list.add(EnumChatFormatting.RED.toString() + "" + s1); + } + + if (i1 == 1) + { + s1 = I18n.format("container.enchant.level.one", new Object[0]); + } + else + { + s1 = I18n.format("container.enchant.level.many", new Object[] {Integer.valueOf(i1)}); + } + + list.add(EnumChatFormatting.GRAY.toString() + "" + s1); + } + } + + this.drawHoveringText(list, mouseX, mouseY); + break; + } + } + } + + public void func_147068_g() + { + ItemStack itemstack = this.inventorySlots.getSlot(0).getStack(); + + if (!ItemStack.areItemStacksEqual(itemstack, this.field_147077_B)) + { + this.field_147077_B = itemstack; + + while (true) + { + this.field_147082_x += (float)(this.random.nextInt(4) - this.random.nextInt(4)); + + if (this.field_147071_v > this.field_147082_x + 1.0F || this.field_147071_v < this.field_147082_x - 1.0F) + { + break; + } + } + } + + ++this.field_147073_u; + this.field_147069_w = this.field_147071_v; + this.field_147076_A = this.field_147080_z; + boolean flag = false; + + for (int i = 0; i < 3; ++i) + { + if (this.container.enchantLevels[i] != 0) + { + flag = true; + } + } + + if (flag) + { + this.field_147080_z += 0.2F; + } + else + { + this.field_147080_z -= 0.2F; + } + + this.field_147080_z = MathHelper.clamp_float(this.field_147080_z, 0.0F, 1.0F); + float f1 = (this.field_147082_x - this.field_147071_v) * 0.4F; + float f = 0.2F; + f1 = MathHelper.clamp_float(f1, -f, f); + this.field_147081_y += (f1 - this.field_147081_y) * 0.9F; + this.field_147071_v += this.field_147081_y; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiErrorScreen.java b/src/minecraft/net/minecraft/client/gui/GuiErrorScreen.java new file mode 100644 index 0000000..d88a6bb --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiErrorScreen.java @@ -0,0 +1,53 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.client.resources.I18n; + +public class GuiErrorScreen extends GuiScreen +{ + private String field_146313_a; + private String field_146312_f; + + public GuiErrorScreen(String p_i46319_1_, String p_i46319_2_) + { + this.field_146313_a = p_i46319_1_; + this.field_146312_f = p_i46319_2_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + super.initGui(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, 140, I18n.format("gui.cancel", new Object[0]))); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawGradientRect(0, 0, this.width, this.height, -12574688, -11530224); + this.drawCenteredString(this.fontRendererObj, this.field_146313_a, this.width / 2, 90, 16777215); + this.drawCenteredString(this.fontRendererObj, this.field_146312_f, this.width / 2, 110, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + this.mc.displayGuiScreen((GuiScreen)null); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiFlatPresets.java b/src/minecraft/net/minecraft/client/gui/GuiFlatPresets.java new file mode 100644 index 0000000..925000c --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiFlatPresets.java @@ -0,0 +1,281 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.I18n; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.FlatGeneratorInfo; +import net.minecraft.world.gen.FlatLayerInfo; +import org.lwjgl.input.Keyboard; + +public class GuiFlatPresets extends GuiScreen +{ + private static final List FLAT_WORLD_PRESETS = Lists.newArrayList(); + + /** The parent GUI */ + private final GuiCreateFlatWorld parentScreen; + private String presetsTitle; + private String presetsShare; + private String field_146436_r; + private GuiFlatPresets.ListSlot field_146435_s; + private GuiButton field_146434_t; + private GuiTextField field_146433_u; + + public GuiFlatPresets(GuiCreateFlatWorld p_i46318_1_) + { + this.parentScreen = p_i46318_1_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.clear(); + Keyboard.enableRepeatEvents(true); + this.presetsTitle = I18n.format("createWorld.customize.presets.title", new Object[0]); + this.presetsShare = I18n.format("createWorld.customize.presets.share", new Object[0]); + this.field_146436_r = I18n.format("createWorld.customize.presets.list", new Object[0]); + this.field_146433_u = new GuiTextField(2, this.fontRendererObj, 50, 40, this.width - 100, 20); + this.field_146435_s = new GuiFlatPresets.ListSlot(); + this.field_146433_u.setMaxStringLength(1230); + this.field_146433_u.setText(this.parentScreen.func_146384_e()); + this.buttonList.add(this.field_146434_t = new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, I18n.format("createWorld.customize.presets.select", new Object[0]))); + this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, I18n.format("gui.cancel", new Object[0]))); + this.func_146426_g(); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + this.field_146435_s.handleMouseInput(); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + this.field_146433_u.mouseClicked(mouseX, mouseY, mouseButton); + super.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (!this.field_146433_u.textboxKeyTyped(typedChar, keyCode)) + { + super.keyTyped(typedChar, keyCode); + } + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.id == 0 && this.func_146430_p()) + { + this.parentScreen.func_146383_a(this.field_146433_u.getText()); + this.mc.displayGuiScreen(this.parentScreen); + } + else if (button.id == 1) + { + this.mc.displayGuiScreen(this.parentScreen); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.field_146435_s.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.fontRendererObj, this.presetsTitle, this.width / 2, 8, 16777215); + this.drawString(this.fontRendererObj, this.presetsShare, 50, 30, 10526880); + this.drawString(this.fontRendererObj, this.field_146436_r, 50, 70, 10526880); + this.field_146433_u.drawTextBox(); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.field_146433_u.updateCursorCounter(); + super.updateScreen(); + } + + public void func_146426_g() + { + boolean flag = this.func_146430_p(); + this.field_146434_t.enabled = flag; + } + + private boolean func_146430_p() + { + return this.field_146435_s.field_148175_k > -1 && this.field_146435_s.field_148175_k < FLAT_WORLD_PRESETS.size() || this.field_146433_u.getText().length() > 1; + } + + private static void func_146425_a(String p_146425_0_, Item p_146425_1_, BiomeGenBase p_146425_2_, FlatLayerInfo... p_146425_3_) + { + func_175354_a(p_146425_0_, p_146425_1_, 0, p_146425_2_, (List)null, p_146425_3_); + } + + private static void func_146421_a(String p_146421_0_, Item p_146421_1_, BiomeGenBase p_146421_2_, List p_146421_3_, FlatLayerInfo... p_146421_4_) + { + func_175354_a(p_146421_0_, p_146421_1_, 0, p_146421_2_, p_146421_3_, p_146421_4_); + } + + private static void func_175354_a(String p_175354_0_, Item p_175354_1_, int p_175354_2_, BiomeGenBase p_175354_3_, List p_175354_4_, FlatLayerInfo... p_175354_5_) + { + FlatGeneratorInfo flatgeneratorinfo = new FlatGeneratorInfo(); + + for (int i = p_175354_5_.length - 1; i >= 0; --i) + { + flatgeneratorinfo.getFlatLayers().add(p_175354_5_[i]); + } + + flatgeneratorinfo.setBiome(p_175354_3_.biomeID); + flatgeneratorinfo.func_82645_d(); + + if (p_175354_4_ != null) + { + for (String s : p_175354_4_) + { + flatgeneratorinfo.getWorldFeatures().put(s, Maps.newHashMap()); + } + } + + FLAT_WORLD_PRESETS.add(new GuiFlatPresets.LayerItem(p_175354_1_, p_175354_2_, p_175354_0_, flatgeneratorinfo.toString())); + } + + static + { + func_146421_a("Classic Flat", Item.getItemFromBlock(Blocks.grass), BiomeGenBase.plains, Arrays.asList(new String[] {"village"}), new FlatLayerInfo[] {new FlatLayerInfo(1, Blocks.grass), new FlatLayerInfo(2, Blocks.dirt), new FlatLayerInfo(1, Blocks.bedrock)}); + func_146421_a("Tunnelers\' Dream", Item.getItemFromBlock(Blocks.stone), BiomeGenBase.extremeHills, Arrays.asList(new String[] {"biome_1", "dungeon", "decoration", "stronghold", "mineshaft"}), new FlatLayerInfo[] {new FlatLayerInfo(1, Blocks.grass), new FlatLayerInfo(5, Blocks.dirt), new FlatLayerInfo(230, Blocks.stone), new FlatLayerInfo(1, Blocks.bedrock)}); + func_146421_a("Water World", Items.water_bucket, BiomeGenBase.deepOcean, Arrays.asList(new String[] {"biome_1", "oceanmonument"}), new FlatLayerInfo[] {new FlatLayerInfo(90, Blocks.water), new FlatLayerInfo(5, Blocks.sand), new FlatLayerInfo(5, Blocks.dirt), new FlatLayerInfo(5, Blocks.stone), new FlatLayerInfo(1, Blocks.bedrock)}); + func_175354_a("Overworld", Item.getItemFromBlock(Blocks.tallgrass), BlockTallGrass.EnumType.GRASS.getMeta(), BiomeGenBase.plains, Arrays.asList(new String[] {"village", "biome_1", "decoration", "stronghold", "mineshaft", "dungeon", "lake", "lava_lake"}), new FlatLayerInfo[] {new FlatLayerInfo(1, Blocks.grass), new FlatLayerInfo(3, Blocks.dirt), new FlatLayerInfo(59, Blocks.stone), new FlatLayerInfo(1, Blocks.bedrock)}); + func_146421_a("Snowy Kingdom", Item.getItemFromBlock(Blocks.snow_layer), BiomeGenBase.icePlains, Arrays.asList(new String[] {"village", "biome_1"}), new FlatLayerInfo[] {new FlatLayerInfo(1, Blocks.snow_layer), new FlatLayerInfo(1, Blocks.grass), new FlatLayerInfo(3, Blocks.dirt), new FlatLayerInfo(59, Blocks.stone), new FlatLayerInfo(1, Blocks.bedrock)}); + func_146421_a("Bottomless Pit", Items.feather, BiomeGenBase.plains, Arrays.asList(new String[] {"village", "biome_1"}), new FlatLayerInfo[] {new FlatLayerInfo(1, Blocks.grass), new FlatLayerInfo(3, Blocks.dirt), new FlatLayerInfo(2, Blocks.cobblestone)}); + func_146421_a("Desert", Item.getItemFromBlock(Blocks.sand), BiomeGenBase.desert, Arrays.asList(new String[] {"village", "biome_1", "decoration", "stronghold", "mineshaft", "dungeon"}), new FlatLayerInfo[] {new FlatLayerInfo(8, Blocks.sand), new FlatLayerInfo(52, Blocks.sandstone), new FlatLayerInfo(3, Blocks.stone), new FlatLayerInfo(1, Blocks.bedrock)}); + func_146425_a("Redstone Ready", Items.redstone, BiomeGenBase.desert, new FlatLayerInfo[] {new FlatLayerInfo(52, Blocks.sandstone), new FlatLayerInfo(3, Blocks.stone), new FlatLayerInfo(1, Blocks.bedrock)}); + } + + static class LayerItem + { + public Item field_148234_a; + public int field_179037_b; + public String field_148232_b; + public String field_148233_c; + + public LayerItem(Item p_i45518_1_, int p_i45518_2_, String p_i45518_3_, String p_i45518_4_) + { + this.field_148234_a = p_i45518_1_; + this.field_179037_b = p_i45518_2_; + this.field_148232_b = p_i45518_3_; + this.field_148233_c = p_i45518_4_; + } + } + + class ListSlot extends GuiSlot + { + public int field_148175_k = -1; + + public ListSlot() + { + super(GuiFlatPresets.this.mc, GuiFlatPresets.this.width, GuiFlatPresets.this.height, 80, GuiFlatPresets.this.height - 37, 24); + } + + private void func_178054_a(int p_178054_1_, int p_178054_2_, Item p_178054_3_, int p_178054_4_) + { + this.func_148173_e(p_178054_1_ + 1, p_178054_2_ + 1); + GlStateManager.enableRescaleNormal(); + RenderHelper.enableGUIStandardItemLighting(); + GuiFlatPresets.this.itemRender.renderItemIntoGUI(new ItemStack(p_178054_3_, 1, p_178054_4_), p_178054_1_ + 2, p_178054_2_ + 2); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + } + + private void func_148173_e(int p_148173_1_, int p_148173_2_) + { + this.func_148171_c(p_148173_1_, p_148173_2_, 0, 0); + } + + private void func_148171_c(int p_148171_1_, int p_148171_2_, int p_148171_3_, int p_148171_4_) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(Gui.statIcons); + float f = 0.0078125F; + float f1 = 0.0078125F; + int i = 18; + int j = 18; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((double)(p_148171_1_ + 0), (double)(p_148171_2_ + 18), (double)GuiFlatPresets.this.zLevel).tex((double)((float)(p_148171_3_ + 0) * 0.0078125F), (double)((float)(p_148171_4_ + 18) * 0.0078125F)).endVertex(); + worldrenderer.pos((double)(p_148171_1_ + 18), (double)(p_148171_2_ + 18), (double)GuiFlatPresets.this.zLevel).tex((double)((float)(p_148171_3_ + 18) * 0.0078125F), (double)((float)(p_148171_4_ + 18) * 0.0078125F)).endVertex(); + worldrenderer.pos((double)(p_148171_1_ + 18), (double)(p_148171_2_ + 0), (double)GuiFlatPresets.this.zLevel).tex((double)((float)(p_148171_3_ + 18) * 0.0078125F), (double)((float)(p_148171_4_ + 0) * 0.0078125F)).endVertex(); + worldrenderer.pos((double)(p_148171_1_ + 0), (double)(p_148171_2_ + 0), (double)GuiFlatPresets.this.zLevel).tex((double)((float)(p_148171_3_ + 0) * 0.0078125F), (double)((float)(p_148171_4_ + 0) * 0.0078125F)).endVertex(); + tessellator.draw(); + } + + protected int getSize() + { + return GuiFlatPresets.FLAT_WORLD_PRESETS.size(); + } + + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + this.field_148175_k = slotIndex; + GuiFlatPresets.this.func_146426_g(); + GuiFlatPresets.this.field_146433_u.setText(((GuiFlatPresets.LayerItem)GuiFlatPresets.FLAT_WORLD_PRESETS.get(GuiFlatPresets.this.field_146435_s.field_148175_k)).field_148233_c); + } + + protected boolean isSelected(int slotIndex) + { + return slotIndex == this.field_148175_k; + } + + protected void drawBackground() + { + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + GuiFlatPresets.LayerItem guiflatpresets$layeritem = (GuiFlatPresets.LayerItem)GuiFlatPresets.FLAT_WORLD_PRESETS.get(entryID); + this.func_178054_a(p_180791_2_, p_180791_3_, guiflatpresets$layeritem.field_148234_a, guiflatpresets$layeritem.field_179037_b); + GuiFlatPresets.this.fontRendererObj.drawString(guiflatpresets$layeritem.field_148232_b, p_180791_2_ + 18 + 5, p_180791_3_ + 6, 16777215); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiGameOver.java b/src/minecraft/net/minecraft/client/gui/GuiGameOver.java new file mode 100644 index 0000000..2215930 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiGameOver.java @@ -0,0 +1,150 @@ +package net.minecraft.client.gui; + +import java.io.IOException; + +import animeware.gui.mainmenu.MainMenu; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.EnumChatFormatting; + +public class GuiGameOver extends GuiScreen implements GuiYesNoCallback +{ + /** + * The integer value containing the number of ticks that have passed since the player's death + */ + private int enableButtonsTimer; + private boolean field_146346_f = false; + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.clear(); + + if (this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) + { + if (this.mc.isIntegratedServerRunning()) + { + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 96, I18n.format("deathScreen.deleteWorld", new Object[0]))); + } + else + { + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 96, I18n.format("deathScreen.leaveServer", new Object[0]))); + } + } + else + { + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 72, I18n.format("deathScreen.respawn", new Object[0]))); + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 96, I18n.format("deathScreen.titleScreen", new Object[0]))); + + if (this.mc.getSession() == null) + { + ((GuiButton)this.buttonList.get(1)).enabled = false; + } + } + + for (GuiButton guibutton : this.buttonList) + { + guibutton.enabled = false; + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + switch (button.id) + { + case 0: + this.mc.thePlayer.respawnPlayer(); + this.mc.displayGuiScreen((GuiScreen)null); + break; + + case 1: + if (this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) + { + this.mc.displayGuiScreen(new MainMenu()); + } + else + { + GuiYesNo guiyesno = new GuiYesNo(this, I18n.format("deathScreen.quit.confirm", new Object[0]), "", I18n.format("deathScreen.titleScreen", new Object[0]), I18n.format("deathScreen.respawn", new Object[0]), 0); + this.mc.displayGuiScreen(guiyesno); + guiyesno.setButtonDelay(20); + } + } + } + + public void confirmClicked(boolean result, int id) + { + if (result) + { + this.mc.theWorld.sendQuittingDisconnectingPacket(); + this.mc.loadWorld((WorldClient)null); + this.mc.displayGuiScreen(new MainMenu()); + } + else + { + this.mc.thePlayer.respawnPlayer(); + this.mc.displayGuiScreen((GuiScreen)null); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawGradientRect(0, 0, this.width, this.height, 1615855616, -1602211792); + GlStateManager.pushMatrix(); + GlStateManager.scale(2.0F, 2.0F, 2.0F); + boolean flag = this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled(); + String s = flag ? I18n.format("deathScreen.title.hardcore", new Object[0]) : I18n.format("deathScreen.title", new Object[0]); + this.drawCenteredString(this.fontRendererObj, s, this.width / 2 / 2, 30, 16777215); + GlStateManager.popMatrix(); + + if (flag) + { + this.drawCenteredString(this.fontRendererObj, I18n.format("deathScreen.hardcoreInfo", new Object[0]), this.width / 2, 144, 16777215); + } + + this.drawCenteredString(this.fontRendererObj, I18n.format("deathScreen.score", new Object[0]) + ": " + EnumChatFormatting.YELLOW + this.mc.thePlayer.getScore(), this.width / 2, 100, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return false; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + ++this.enableButtonsTimer; + + if (this.enableButtonsTimer == 20) + { + for (GuiButton guibutton : this.buttonList) + { + guibutton.enabled = true; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiHopper.java b/src/minecraft/net/minecraft/client/gui/GuiHopper.java new file mode 100644 index 0000000..e6b6ac6 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiHopper.java @@ -0,0 +1,51 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ContainerHopper; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.ResourceLocation; + +public class GuiHopper extends GuiContainer +{ + /** The ResourceLocation containing the gui texture for the hopper */ + private static final ResourceLocation HOPPER_GUI_TEXTURE = new ResourceLocation("textures/gui/container/hopper.png"); + + /** The player inventory currently bound to this GUI instance */ + private IInventory playerInventory; + + /** The hopper inventory bound to this GUI instance */ + private IInventory hopperInventory; + + public GuiHopper(InventoryPlayer playerInv, IInventory hopperInv) + { + super(new ContainerHopper(playerInv, hopperInv, Minecraft.getMinecraft().thePlayer)); + this.playerInventory = playerInv; + this.hopperInventory = hopperInv; + this.allowUserInput = false; + this.ySize = 133; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + this.fontRendererObj.drawString(this.hopperInventory.getDisplayName().getUnformattedText(), 8, 6, 4210752); + this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Args : renderPartialTicks, mouseX, mouseY + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(HOPPER_GUI_TEXTURE); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiIngame.java b/src/minecraft/net/minecraft/client/gui/GuiIngame.java new file mode 100644 index 0000000..91684b6 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiIngame.java @@ -0,0 +1,1263 @@ +package net.minecraft.client.gui; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Random; + +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; + +import animeware.NightSky; +import animeware.cosmetic.Booleans; +import animeware.gui.clickgui.ClickGUI; +import animeware.hud.HUDConfigScreen; +import animeware.util.notification.NotificationManager; +import animeware.util.render.DrawUtil; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.boss.BossStatus; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.FoodStats; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StringUtils; +import net.minecraft.world.border.WorldBorder; +import optifine.Config; +import optifine.CustomColors; + +public class GuiIngame extends Gui +{ + private static final ResourceLocation vignetteTexPath = new ResourceLocation("textures/misc/vignette.png"); + private static final ResourceLocation widgetsTexPath = new ResourceLocation("textures/gui/widgets.png"); + private static final ResourceLocation pumpkinBlurTexPath = new ResourceLocation("textures/misc/pumpkinblur.png"); + private final Random rand = new Random(); + private final Minecraft mc; + private final RenderItem itemRenderer; + + /** ChatGUI instance that retains all previous chat data */ + private final GuiNewChat persistantChatGUI; + private final GuiStreamIndicator streamIndicator; + private int updateCounter; + + /** The string specifying which record music is playing */ + private String recordPlaying = ""; + + /** How many ticks the record playing message will be displayed */ + private int recordPlayingUpFor; + private boolean recordIsPlaying; + + /** Previous frame vignette brightness (slowly changes by 1% each frame) */ + public float prevVignetteBrightness = 1.0F; + + /** Remaining ticks the item highlight should be visible */ + private int remainingHighlightTicks; + + /** The ItemStack that is currently being highlighted */ + private ItemStack highlightingItemStack; + private final GuiOverlayDebug overlayDebug; + + /** The spectator GUI for this in-game GUI instance */ + private final GuiSpectator spectatorGui; + private final GuiPlayerTabOverlay overlayPlayerList; + private int field_175195_w; + private String field_175201_x = ""; + private String field_175200_y = ""; + private int field_175199_z; + private int field_175192_A; + private int field_175193_B; + private int playerHealth = 0; + private int lastPlayerHealth = 0; + + /** The last recorded system time */ + private long lastSystemTime = 0L; + + /** Used with updateCounter to make the heart bar flash */ + private long healthUpdateCounter = 0L; + private static final String __OBFID = "CL_00000661"; + + public GuiIngame(Minecraft mcIn) + { + + this.mc = mcIn; + this.itemRenderer = mcIn.getRenderItem(); + this.overlayDebug = new GuiOverlayDebug(mcIn); + this.spectatorGui = new GuiSpectator(mcIn); + this.persistantChatGUI = new GuiNewChat(mcIn); + this.streamIndicator = new GuiStreamIndicator(mcIn); + this.overlayPlayerList = new GuiPlayerTabOverlay(mcIn, this); + this.func_175177_a(); + } + + public void func_175177_a() + { + this.field_175199_z = 10; + this.field_175192_A = 70; + this.field_175193_B = 20; + } + + public void renderGameOverlay(float partialTicks) + { + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + int i = scaledresolution.getScaledWidth(); + int j = scaledresolution.getScaledHeight(); + this.mc.entityRenderer.setupOverlayRendering(); + GlStateManager.enableBlend(); + + if(Booleans.watermark) { + //mc.fontRendererObj.drawString(Animeware.INSTANCE.VERSION, 52, 45, -1); + mc.getTextureManager().bindTexture(new ResourceLocation("Animeware/icons/iconWhite.png")); + Gui.drawScaledCustomSizeModalRect(900, 0, 50, 50, 50, 50, 50, 50, 50, 50); + //DrawUtil.draw2DImage(new ResourceLocation("Animeware/icons/iconWhite.png"), ClickGUI.width / 2 - 58, ClickGUI.height / 2 - 130, 137, 135, Color.WHITE); + } + + + + if (Config.isVignetteEnabled()) + { + this.renderVignette(this.mc.thePlayer.getBrightness(partialTicks), scaledresolution); + } + else + { + GlStateManager.enableDepth(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + } + + ItemStack itemstack = this.mc.thePlayer.inventory.armorItemInSlot(3); + + if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null && itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin)) + { + this.renderPumpkinOverlay(scaledresolution); + } + + if (!this.mc.thePlayer.isPotionActive(Potion.confusion)) + { + float f = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * partialTicks; + + if (f > 0.0F) + { + this.func_180474_b(f, scaledresolution); + } + } + + if (this.mc.playerController.isSpectator()) + { + this.spectatorGui.renderTooltip(scaledresolution, partialTicks); + } + else + { + this.renderTooltip(scaledresolution, partialTicks); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(icons); + GlStateManager.enableBlend(); + + if (this.showCrosshair() && this.mc.gameSettings.thirdPersonView < 1) + { + GlStateManager.tryBlendFuncSeparate(775, 769, 1, 0); + GlStateManager.enableAlpha(); + this.drawTexturedModalRect(i / 2 - 7, j / 2 - 7, 0, 0, 16, 16); + } + + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + this.mc.mcProfiler.startSection("bossHealth"); + this.renderBossHealth(); + this.mc.mcProfiler.endSection(); + + if (this.mc.playerController.shouldDrawHUD()) + { + this.renderPlayerStats(scaledresolution); + } + + GlStateManager.disableBlend(); + + if (this.mc.thePlayer.getSleepTimer() > 0) + { + this.mc.mcProfiler.startSection("sleep"); + GlStateManager.disableDepth(); + GlStateManager.disableAlpha(); + int l = this.mc.thePlayer.getSleepTimer(); + float f2 = (float)l / 100.0F; + + if (f2 > 1.0F) + { + f2 = 1.0F - (float)(l - 100) / 10.0F; + } + + int k = (int)(220.0F * f2) << 24 | 1052704; + drawRect(0, 0, i, j, k); + GlStateManager.enableAlpha(); + GlStateManager.enableDepth(); + this.mc.mcProfiler.endSection(); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + int i2 = i / 2 - 91; + + if (this.mc.thePlayer.isRidingHorse()) + { + this.renderHorseJumpBar(scaledresolution, i2); + } + else if (this.mc.playerController.gameIsSurvivalOrAdventure()) + { + this.renderExpBar(scaledresolution, i2); + } + + if (this.mc.gameSettings.heldItemTooltips && !this.mc.playerController.isSpectator()) + { + this.func_181551_a(scaledresolution); + } + else if (this.mc.thePlayer.isSpectator()) + { + this.spectatorGui.func_175263_a(scaledresolution); + } + + if (this.mc.isDemo()) + { + this.renderDemo(scaledresolution); + } + + if (this.mc.gameSettings.showDebugInfo) + { + this.overlayDebug.renderDebugInfo(scaledresolution); + } + + if (this.recordPlayingUpFor > 0) + { + this.mc.mcProfiler.startSection("overlayMessage"); + float f3 = (float)this.recordPlayingUpFor - partialTicks; + int k1 = (int)(f3 * 255.0F / 20.0F); + + if (k1 > 255) + { + k1 = 255; + } + + if (k1 > 8) + { + GlStateManager.pushMatrix(); + GlStateManager.translate((float)(i / 2), (float)(j - 68), 0.0F); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + int i1 = 16777215; + + if (this.recordIsPlaying) + { + i1 = MathHelper.func_181758_c(f3 / 50.0F, 0.7F, 0.6F) & 16777215; + } + + this.getFontRenderer().drawString(this.recordPlaying, -this.getFontRenderer().getStringWidth(this.recordPlaying) / 2, -4, i1 + (k1 << 24 & -16777216)); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + } + + this.mc.mcProfiler.endSection(); + } + + if (this.field_175195_w > 0) + { + this.mc.mcProfiler.startSection("titleAndSubtitle"); + float f4 = (float)this.field_175195_w - partialTicks; + int l1 = 255; + + if (this.field_175195_w > this.field_175193_B + this.field_175192_A) + { + float f1 = (float)(this.field_175199_z + this.field_175192_A + this.field_175193_B) - f4; + l1 = (int)(f1 * 255.0F / (float)this.field_175199_z); + } + + if (this.field_175195_w <= this.field_175193_B) + { + l1 = (int)(f4 * 255.0F / (float)this.field_175193_B); + } + + l1 = MathHelper.clamp_int(l1, 0, 255); + + if (l1 > 8) + { + GlStateManager.pushMatrix(); + GlStateManager.translate((float)(i / 2), (float)(j / 2), 0.0F); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.pushMatrix(); + GlStateManager.scale(4.0F, 4.0F, 4.0F); + int j2 = l1 << 24 & -16777216; + this.getFontRenderer().drawString(this.field_175201_x, (float)(-this.getFontRenderer().getStringWidth(this.field_175201_x) / 2), -10.0F, 16777215 | j2, true); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(2.0F, 2.0F, 2.0F); + this.getFontRenderer().drawString(this.field_175200_y, (float)(-this.getFontRenderer().getStringWidth(this.field_175200_y) / 2), 5.0F, 16777215 | j2, true); + GlStateManager.popMatrix(); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + } + + this.mc.mcProfiler.endSection(); + } + + Scoreboard scoreboard = this.mc.theWorld.getScoreboard(); + ScoreObjective scoreobjective = null; + ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(this.mc.thePlayer.getName()); + + if (scoreplayerteam != null) + { + int j1 = scoreplayerteam.getChatFormat().getColorIndex(); + + if (j1 >= 0) + { + scoreobjective = scoreboard.getObjectiveInDisplaySlot(3 + j1); + } + } + + ScoreObjective scoreobjective1 = scoreobjective != null ? scoreobjective : scoreboard.getObjectiveInDisplaySlot(1); + + if (scoreobjective1 != null) + { + this.renderScoreboard(scoreobjective1, scaledresolution); + } + + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.disableAlpha(); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, (float)(j - 48), 0.0F); + this.mc.mcProfiler.startSection("chat"); + this.persistantChatGUI.drawChat(this.updateCounter); + this.mc.mcProfiler.endSection(); + GlStateManager.popMatrix(); + scoreobjective1 = scoreboard.getObjectiveInDisplaySlot(0); + + if (!this.mc.gameSettings.keyBindPlayerList.isKeyDown() || this.mc.isIntegratedServerRunning() && this.mc.thePlayer.sendQueue.getPlayerInfoMap().size() <= 1 && scoreobjective1 == null) + { + this.overlayPlayerList.updatePlayerList(false); + } + else + { + this.overlayPlayerList.updatePlayerList(true); + this.overlayPlayerList.renderPlayerlist(i, scoreboard, scoreobjective1); + } + + if(!(mc.currentScreen instanceof HUDConfigScreen)) { + NightSky.INSTANCE.hudManager.renderMods(); + } + + NotificationManager.render(); + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableLighting(); + GlStateManager.enableAlpha(); + + + } + + protected void renderTooltip(ScaledResolution sr, float partialTicks) + { + if (this.mc.getRenderViewEntity() instanceof EntityPlayer) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(widgetsTexPath); + EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity(); + int i = sr.getScaledWidth() / 2; + float f = this.zLevel; + this.zLevel = -90.0F; + this.drawTexturedModalRect(i - 91, sr.getScaledHeight() - 22, 0, 0, 182, 22); + this.drawTexturedModalRect(i - 91 - 1 + entityplayer.inventory.currentItem * 20, sr.getScaledHeight() - 22 - 1, 0, 22, 24, 22); + this.zLevel = f; + GlStateManager.enableRescaleNormal(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + RenderHelper.enableGUIStandardItemLighting(); + + for (int j = 0; j < 9; ++j) + { + int k = sr.getScaledWidth() / 2 - 90 + j * 20 + 2; + int l = sr.getScaledHeight() - 16 - 3; + this.renderHotbarItem(j, k, l, partialTicks, entityplayer); + } + + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.disableBlend(); + } + } + + public void renderHorseJumpBar(ScaledResolution p_175186_1_, int p_175186_2_) + { + this.mc.mcProfiler.startSection("jumpBar"); + this.mc.getTextureManager().bindTexture(Gui.icons); + float f = this.mc.thePlayer.getHorseJumpPower(); + short short1 = 182; + int i = (int)(f * (float)(short1 + 1)); + int j = p_175186_1_.getScaledHeight() - 32 + 3; + this.drawTexturedModalRect(p_175186_2_, j, 0, 84, short1, 5); + + if (i > 0) + { + this.drawTexturedModalRect(p_175186_2_, j, 0, 89, i, 5); + } + + this.mc.mcProfiler.endSection(); + } + + public void renderExpBar(ScaledResolution p_175176_1_, int p_175176_2_) + { + this.mc.mcProfiler.startSection("expBar"); + this.mc.getTextureManager().bindTexture(Gui.icons); + int i = this.mc.thePlayer.xpBarCap(); + + if (i > 0) + { + short short1 = 182; + int k = (int)(this.mc.thePlayer.experience * (float)(short1 + 1)); + int j = p_175176_1_.getScaledHeight() - 32 + 3; + this.drawTexturedModalRect(p_175176_2_, j, 0, 64, short1, 5); + + if (k > 0) + { + this.drawTexturedModalRect(p_175176_2_, j, 0, 69, k, 5); + } + } + + this.mc.mcProfiler.endSection(); + + if (this.mc.thePlayer.experienceLevel > 0) + { + this.mc.mcProfiler.startSection("expLevel"); + int j1 = 8453920; + + if (Config.isCustomColors()) + { + j1 = CustomColors.getExpBarTextColor(j1); + } + + String s = "" + this.mc.thePlayer.experienceLevel; + int i1 = (p_175176_1_.getScaledWidth() - this.getFontRenderer().getStringWidth(s)) / 2; + int l = p_175176_1_.getScaledHeight() - 31 - 4; + boolean flag = false; + this.getFontRenderer().drawString(s, i1 + 1, l, 0); + this.getFontRenderer().drawString(s, i1 - 1, l, 0); + this.getFontRenderer().drawString(s, i1, l + 1, 0); + this.getFontRenderer().drawString(s, i1, l - 1, 0); + this.getFontRenderer().drawString(s, i1, l, j1); + this.mc.mcProfiler.endSection(); + } + } + + public void func_181551_a(ScaledResolution p_181551_1_) + { + this.mc.mcProfiler.startSection("selectedItemName"); + + if (this.remainingHighlightTicks > 0 && this.highlightingItemStack != null) + { + String s = this.highlightingItemStack.getDisplayName(); + + if (this.highlightingItemStack.hasDisplayName()) + { + s = EnumChatFormatting.ITALIC + s; + } + + int i = (p_181551_1_.getScaledWidth() - this.getFontRenderer().getStringWidth(s)) / 2; + int j = p_181551_1_.getScaledHeight() - 59; + + if (!this.mc.playerController.shouldDrawHUD()) + { + j += 14; + } + + int k = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F); + + if (k > 255) + { + k = 255; + } + + if (k > 0) + { + GlStateManager.pushMatrix(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + this.getFontRenderer().drawStringWithShadow(s, (float)i, (float)j, 16777215 + (k << 24)); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + } + } + + this.mc.mcProfiler.endSection(); + } + + public void renderDemo(ScaledResolution p_175185_1_) + { + this.mc.mcProfiler.startSection("demo"); + String s = ""; + + if (this.mc.theWorld.getTotalWorldTime() >= 120500L) + { + s = I18n.format("demo.demoExpired", new Object[0]); + } + else + { + s = I18n.format("demo.remainingTime", new Object[] {StringUtils.ticksToElapsedTime((int)(120500L - this.mc.theWorld.getTotalWorldTime()))}); + } + + int i = this.getFontRenderer().getStringWidth(s); + this.getFontRenderer().drawStringWithShadow(s, (float)(p_175185_1_.getScaledWidth() - i - 10), 5.0F, 16777215); + this.mc.mcProfiler.endSection(); + } + + protected boolean showCrosshair() + { + if (this.mc.gameSettings.showDebugInfo && !this.mc.thePlayer.hasReducedDebug() && !this.mc.gameSettings.reducedDebugInfo) + { + return false; + } + else if (this.mc.playerController.isSpectator()) + { + if (this.mc.pointedEntity != null) + { + return true; + } + else + { + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = this.mc.objectMouseOver.getBlockPos(); + + if (this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory) + { + return true; + } + } + + return false; + } + } + else + { + return true; + } + } + + public void renderStreamIndicator(ScaledResolution p_180478_1_) + { + this.streamIndicator.render(p_180478_1_.getScaledWidth() - 10, 10); + } + + private void renderScoreboard(ScoreObjective p_180475_1_, ScaledResolution p_180475_2_) + { + Scoreboard scoreboard = p_180475_1_.getScoreboard(); + Collection collection = scoreboard.getSortedScores(p_180475_1_); + ArrayList arraylist = Lists.newArrayList(Iterables.filter(collection, new Predicate() + { + private static final String __OBFID = "CL_00001958"; + public boolean apply(Score p_apply_1_) + { + return p_apply_1_.getPlayerName() != null && !p_apply_1_.getPlayerName().startsWith("#"); + } + public boolean apply(Object p_apply_1_) + { + return this.apply((Score)p_apply_1_); + } + })); + ArrayList arraylist1; + + if (arraylist.size() > 15) + { + arraylist1 = Lists.newArrayList(Iterables.skip(arraylist, collection.size() - 15)); + } + else + { + arraylist1 = arraylist; + } + + int i = this.getFontRenderer().getStringWidth(p_180475_1_.getDisplayName()); + + for (Object score : arraylist1) + { + ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(((Score) score).getPlayerName()); + String s = ScorePlayerTeam.formatPlayerName(scoreplayerteam, ((Score) score).getPlayerName()) + ": " + EnumChatFormatting.RED + ((Score) score).getScorePoints(); + i = Math.max(i, this.getFontRenderer().getStringWidth(s)); + } + + int j1 = arraylist1.size() * this.getFontRenderer().FONT_HEIGHT; + int k1 = p_180475_2_.getScaledHeight() / 2 + j1 / 3; + byte b0 = 3; + int j = p_180475_2_.getScaledWidth() - i - b0; + int k = 0; + + for (Object score1 : arraylist1) + { + ++k; + ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(((Score) score1).getPlayerName()); + String s1 = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, ((Score) score1).getPlayerName()); + String s2 = EnumChatFormatting.RED + "" + ((Score) score1).getScorePoints(); + int l = k1 - k * this.getFontRenderer().FONT_HEIGHT; + int i1 = p_180475_2_.getScaledWidth() - b0 + 2; + drawRect(j - 2, l, i1, l + this.getFontRenderer().FONT_HEIGHT, 1342177280); + this.getFontRenderer().drawString(s1, j, l, 553648127); + this.getFontRenderer().drawString(s2, i1 - this.getFontRenderer().getStringWidth(s2), l, 553648127); + + if (k == arraylist1.size()) + { + String s3 = p_180475_1_.getDisplayName(); + drawRect(j - 2, l - this.getFontRenderer().FONT_HEIGHT - 1, i1, l - 1, 1610612736); + drawRect(j - 2, l - 1, i1, l, 1342177280); + this.getFontRenderer().drawString(s3, j + i / 2 - this.getFontRenderer().getStringWidth(s3) / 2, l - this.getFontRenderer().FONT_HEIGHT, 553648127); + } + } + } + private void attemptSwing() { + if (this.mc.thePlayer.getItemInUseCount() > 0) { + final boolean mouseDown = this.mc.gameSettings.keyBindAttack.isKeyDown() && this.mc.gameSettings.keyBindUseItem.isKeyDown(); + if (mouseDown && this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + this.swingItem(this.mc.thePlayer); + } + } + } + + private void swingItem(EntityPlayerSP entityplayersp) { + final int swingAnimationEnd = entityplayersp.isPotionActive(Potion.digSpeed) ? (6 - (1 + entityplayersp.getActivePotionEffect(Potion.digSpeed).getAmplifier()) * 1) : (entityplayersp.isPotionActive(Potion.digSlowdown) ? (6 + (1 + entityplayersp.getActivePotionEffect(Potion.digSlowdown).getAmplifier()) * 2) : 6); + if (!entityplayersp.isSwingInProgress || entityplayersp.swingProgressInt >= swingAnimationEnd / 2 || entityplayersp.swingProgressInt < 0) { + entityplayersp.swingProgressInt = -1; + entityplayersp.isSwingInProgress = true; + } + } + private void renderPlayerStats(ScaledResolution p_180477_1_) + { + boolean shouldDisplayLegacyAnimationsBooleanVariable = true; + if (this.mc.thePlayer.getHeldItem() != null && shouldDisplayLegacyAnimationsBooleanVariable) { + this.attemptSwing(); + } + if (this.mc.getRenderViewEntity() instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity(); + int i = MathHelper.ceiling_float_int(entityplayer.getHealth()); + boolean flag = this.healthUpdateCounter > (long)this.updateCounter && (this.healthUpdateCounter - (long)this.updateCounter) / 3L % 2L == 1L; + + if (i < this.playerHealth && entityplayer.hurtResistantTime > 0) + { + this.lastSystemTime = Minecraft.getSystemTime(); + this.healthUpdateCounter = (long)(this.updateCounter + 20); + } + else if (i > this.playerHealth && entityplayer.hurtResistantTime > 0) + { + this.lastSystemTime = Minecraft.getSystemTime(); + this.healthUpdateCounter = (long)(this.updateCounter + 10); + } + + if (Minecraft.getSystemTime() - this.lastSystemTime > 1000L) + { + this.playerHealth = i; + this.lastPlayerHealth = i; + this.lastSystemTime = Minecraft.getSystemTime(); + } + + this.playerHealth = i; + int j = this.lastPlayerHealth; + this.rand.setSeed((long)(this.updateCounter * 312871)); + boolean flag1 = false; + FoodStats foodstats = entityplayer.getFoodStats(); + int k = foodstats.getFoodLevel(); + int l = foodstats.getPrevFoodLevel(); + IAttributeInstance iattributeinstance = entityplayer.getEntityAttribute(SharedMonsterAttributes.maxHealth); + int i1 = p_180477_1_.getScaledWidth() / 2 - 91; + int j1 = p_180477_1_.getScaledWidth() / 2 + 91; + int k1 = p_180477_1_.getScaledHeight() - 39; + float f = (float)iattributeinstance.getAttributeValue(); + float f1 = entityplayer.getAbsorptionAmount(); + int l1 = MathHelper.ceiling_float_int((f + f1) / 2.0F / 10.0F); + int i2 = Math.max(10 - (l1 - 2), 3); + int j2 = k1 - (l1 - 1) * i2 - 10; + float f2 = f1; + int k2 = entityplayer.getTotalArmorValue(); + int l2 = -1; + + if (entityplayer.isPotionActive(Potion.regeneration)) + { + l2 = this.updateCounter % MathHelper.ceiling_float_int(f + 5.0F); + } + + this.mc.mcProfiler.startSection("armor"); + + for (int i3 = 0; i3 < 10; ++i3) + { + if (k2 > 0) + { + int j3 = i1 + i3 * 8; + + if (i3 * 2 + 1 < k2) + { + this.drawTexturedModalRect(j3, j2, 34, 9, 9, 9); + } + + if (i3 * 2 + 1 == k2) + { + this.drawTexturedModalRect(j3, j2, 25, 9, 9, 9); + } + + if (i3 * 2 + 1 > k2) + { + this.drawTexturedModalRect(j3, j2, 16, 9, 9, 9); + } + } + } + + this.mc.mcProfiler.endStartSection("health"); + + for (int j5 = MathHelper.ceiling_float_int((f + f1) / 2.0F) - 1; j5 >= 0; --j5) + { + int k5 = 16; + + if (entityplayer.isPotionActive(Potion.poison)) + { + k5 += 36; + } + else if (entityplayer.isPotionActive(Potion.wither)) + { + k5 += 72; + } + + byte b0 = 0; + + if (flag) + { + b0 = 1; + } + + int k3 = MathHelper.ceiling_float_int((float)(j5 + 1) / 10.0F) - 1; + int l3 = i1 + j5 % 10 * 8; + int i4 = k1 - k3 * i2; + + if (i <= 4) + { + i4 += this.rand.nextInt(2); + } + + if (j5 == l2) + { + i4 -= 2; + } + + byte b1 = 0; + + if (entityplayer.worldObj.getWorldInfo().isHardcoreModeEnabled()) + { + b1 = 5; + } + + this.drawTexturedModalRect(l3, i4, 16 + b0 * 9, 9 * b1, 9, 9); + + if (flag) + { + if (j5 * 2 + 1 < j) + { + this.drawTexturedModalRect(l3, i4, k5 + 54, 9 * b1, 9, 9); + } + + if (j5 * 2 + 1 == j) + { + this.drawTexturedModalRect(l3, i4, k5 + 63, 9 * b1, 9, 9); + } + } + + if (f2 <= 0.0F) + { + if (j5 * 2 + 1 < i) + { + this.drawTexturedModalRect(l3, i4, k5 + 36, 9 * b1, 9, 9); + } + + if (j5 * 2 + 1 == i) + { + this.drawTexturedModalRect(l3, i4, k5 + 45, 9 * b1, 9, 9); + } + } + else + { + if (f2 == f1 && f1 % 2.0F == 1.0F) + { + this.drawTexturedModalRect(l3, i4, k5 + 153, 9 * b1, 9, 9); + } + else + { + this.drawTexturedModalRect(l3, i4, k5 + 144, 9 * b1, 9, 9); + } + + f2 -= 2.0F; + } + } + + Entity entity = entityplayer.ridingEntity; + + if (entity == null) + { + this.mc.mcProfiler.endStartSection("food"); + + for (int l5 = 0; l5 < 10; ++l5) + { + int i8 = k1; + int j6 = 16; + byte b4 = 0; + + if (entityplayer.isPotionActive(Potion.hunger)) + { + j6 += 36; + b4 = 13; + } + + if (entityplayer.getFoodStats().getSaturationLevel() <= 0.0F && this.updateCounter % (k * 3 + 1) == 0) + { + i8 = k1 + (this.rand.nextInt(3) - 1); + } + + if (flag1) + { + b4 = 1; + } + + int k7 = j1 - l5 * 8 - 9; + this.drawTexturedModalRect(k7, i8, 16 + b4 * 9, 27, 9, 9); + + if (flag1) + { + if (l5 * 2 + 1 < l) + { + this.drawTexturedModalRect(k7, i8, j6 + 54, 27, 9, 9); + } + + if (l5 * 2 + 1 == l) + { + this.drawTexturedModalRect(k7, i8, j6 + 63, 27, 9, 9); + } + } + + if (l5 * 2 + 1 < k) + { + this.drawTexturedModalRect(k7, i8, j6 + 36, 27, 9, 9); + } + + if (l5 * 2 + 1 == k) + { + this.drawTexturedModalRect(k7, i8, j6 + 45, 27, 9, 9); + } + } + } + else if (entity instanceof EntityLivingBase) + { + this.mc.mcProfiler.endStartSection("mountHealth"); + EntityLivingBase entitylivingbase = (EntityLivingBase)entity; + int l7 = (int)Math.ceil((double)entitylivingbase.getHealth()); + float f3 = entitylivingbase.getMaxHealth(); + int l6 = (int)(f3 + 0.5F) / 2; + + if (l6 > 30) + { + l6 = 30; + } + + int j7 = k1; + + for (int j4 = 0; l6 > 0; j4 += 20) + { + int k4 = Math.min(l6, 10); + l6 -= k4; + + for (int l4 = 0; l4 < k4; ++l4) + { + byte b2 = 52; + byte b3 = 0; + + if (flag1) + { + b3 = 1; + } + + int i5 = j1 - l4 * 8 - 9; + this.drawTexturedModalRect(i5, j7, b2 + b3 * 9, 9, 9, 9); + + if (l4 * 2 + 1 + j4 < l7) + { + this.drawTexturedModalRect(i5, j7, b2 + 36, 9, 9, 9); + } + + if (l4 * 2 + 1 + j4 == l7) + { + this.drawTexturedModalRect(i5, j7, b2 + 45, 9, 9, 9); + } + } + + j7 -= 10; + } + } + + this.mc.mcProfiler.endStartSection("air"); + + if (entityplayer.isInsideOfMaterial(Material.water)) + { + int i6 = this.mc.thePlayer.getAir(); + int j8 = MathHelper.ceiling_double_int((double)(i6 - 2) * 10.0D / 300.0D); + int k6 = MathHelper.ceiling_double_int((double)i6 * 10.0D / 300.0D) - j8; + + for (int i7 = 0; i7 < j8 + k6; ++i7) + { + if (i7 < j8) + { + this.drawTexturedModalRect(j1 - i7 * 8 - 9, j2, 16, 18, 9, 9); + } + else + { + this.drawTexturedModalRect(j1 - i7 * 8 - 9, j2, 25, 18, 9, 9); + } + } + } + + this.mc.mcProfiler.endSection(); + } + } + + /** + * Renders dragon's (boss) health on the HUD + */ + private void renderBossHealth() + { + if (BossStatus.bossName != null && BossStatus.statusBarTime > 0) + { + --BossStatus.statusBarTime; + FontRenderer fontrenderer = this.mc.fontRendererObj; + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + int i = scaledresolution.getScaledWidth(); + short short1 = 182; + int j = i / 2 - short1 / 2; + int k = (int)(BossStatus.healthScale * (float)(short1 + 1)); + byte b0 = 12; + this.drawTexturedModalRect(j, b0, 0, 74, short1, 5); + this.drawTexturedModalRect(j, b0, 0, 74, short1, 5); + + if (k > 0) + { + this.drawTexturedModalRect(j, b0, 0, 79, k, 5); + } + + String s = BossStatus.bossName; + int l = 16777215; + + if (Config.isCustomColors()) + { + l = CustomColors.getBossTextColor(l); + } + + this.getFontRenderer().drawStringWithShadow(s, (float)(i / 2 - this.getFontRenderer().getStringWidth(s) / 2), (float)(b0 - 10), l); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(icons); + } + } + + private void renderPumpkinOverlay(ScaledResolution p_180476_1_) + { + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableAlpha(); + this.mc.getTextureManager().bindTexture(pumpkinBlurTexPath); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(0.0D, (double)p_180476_1_.getScaledHeight(), -90.0D).tex(0.0D, 1.0D).endVertex(); + worldrenderer.pos((double)p_180476_1_.getScaledWidth(), (double)p_180476_1_.getScaledHeight(), -90.0D).tex(1.0D, 1.0D).endVertex(); + worldrenderer.pos((double)p_180476_1_.getScaledWidth(), 0.0D, -90.0D).tex(1.0D, 0.0D).endVertex(); + worldrenderer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).endVertex(); + tessellator.draw(); + GlStateManager.depthMask(true); + GlStateManager.enableDepth(); + GlStateManager.enableAlpha(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Renders a Vignette arount the entire screen that changes with light level. + */ + private void renderVignette(float p_180480_1_, ScaledResolution p_180480_2_) + { + if (!Config.isVignetteEnabled()) + { + GlStateManager.enableDepth(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + } + else + { + p_180480_1_ = 1.0F - p_180480_1_; + p_180480_1_ = MathHelper.clamp_float(p_180480_1_, 0.0F, 1.0F); + WorldBorder worldborder = this.mc.theWorld.getWorldBorder(); + float f = (float)worldborder.getClosestDistance(this.mc.thePlayer); + double d0 = Math.min(worldborder.getResizeSpeed() * (double)worldborder.getWarningTime() * 1000.0D, Math.abs(worldborder.getTargetSize() - worldborder.getDiameter())); + double d1 = Math.max((double)worldborder.getWarningDistance(), d0); + + if ((double)f < d1) + { + f = 1.0F - (float)((double)f / d1); + } + else + { + f = 0.0F; + } + + this.prevVignetteBrightness = (float)((double)this.prevVignetteBrightness + (double)(p_180480_1_ - this.prevVignetteBrightness) * 0.01D); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); + GlStateManager.tryBlendFuncSeparate(0, 769, 1, 0); + + if (f > 0.0F) + { + GlStateManager.color(0.0F, f, f, 1.0F); + } + else + { + GlStateManager.color(this.prevVignetteBrightness, this.prevVignetteBrightness, this.prevVignetteBrightness, 1.0F); + } + + this.mc.getTextureManager().bindTexture(vignetteTexPath); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(0.0D, (double)p_180480_2_.getScaledHeight(), -90.0D).tex(0.0D, 1.0D).endVertex(); + worldrenderer.pos((double)p_180480_2_.getScaledWidth(), (double)p_180480_2_.getScaledHeight(), -90.0D).tex(1.0D, 1.0D).endVertex(); + worldrenderer.pos((double)p_180480_2_.getScaledWidth(), 0.0D, -90.0D).tex(1.0D, 0.0D).endVertex(); + worldrenderer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).endVertex(); + tessellator.draw(); + GlStateManager.depthMask(true); + GlStateManager.enableDepth(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + } + } + + private void func_180474_b(float p_180474_1_, ScaledResolution p_180474_2_) + { + if (p_180474_1_ < 1.0F) + { + p_180474_1_ = p_180474_1_ * p_180474_1_; + p_180474_1_ = p_180474_1_ * p_180474_1_; + p_180474_1_ = p_180474_1_ * 0.8F + 0.2F; + } + + GlStateManager.disableAlpha(); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.color(1.0F, 1.0F, 1.0F, p_180474_1_); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + TextureAtlasSprite textureatlassprite = this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(Blocks.portal.getDefaultState()); + float f = textureatlassprite.getMinU(); + float f1 = textureatlassprite.getMinV(); + float f2 = textureatlassprite.getMaxU(); + float f3 = textureatlassprite.getMaxV(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(0.0D, (double)p_180474_2_.getScaledHeight(), -90.0D).tex((double)f, (double)f3).endVertex(); + worldrenderer.pos((double)p_180474_2_.getScaledWidth(), (double)p_180474_2_.getScaledHeight(), -90.0D).tex((double)f2, (double)f3).endVertex(); + worldrenderer.pos((double)p_180474_2_.getScaledWidth(), 0.0D, -90.0D).tex((double)f2, (double)f1).endVertex(); + worldrenderer.pos(0.0D, 0.0D, -90.0D).tex((double)f, (double)f1).endVertex(); + tessellator.draw(); + GlStateManager.depthMask(true); + GlStateManager.enableDepth(); + GlStateManager.enableAlpha(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + } + + private void renderHotbarItem(int index, int xPos, int yPos, float partialTicks, EntityPlayer p_175184_5_) + { + ItemStack itemstack = p_175184_5_.inventory.mainInventory[index]; + + if (itemstack != null) + { + float f = (float)itemstack.animationsToGo - partialTicks; + + if (f > 0.0F) + { + GlStateManager.pushMatrix(); + float f1 = 1.0F + f / 5.0F; + GlStateManager.translate((float)(xPos + 8), (float)(yPos + 12), 0.0F); + GlStateManager.scale(1.0F / f1, (f1 + 1.0F) / 2.0F, 1.0F); + GlStateManager.translate((float)(-(xPos + 8)), (float)(-(yPos + 12)), 0.0F); + } + + this.itemRenderer.renderItemAndEffectIntoGUI(itemstack, xPos, yPos); + + if (f > 0.0F) + { + GlStateManager.popMatrix(); + } + + this.itemRenderer.renderItemOverlays(this.mc.fontRendererObj, itemstack, xPos, yPos); + } + } + + /** + * The update tick for the ingame UI + */ + public void updateTick() + { + if (this.recordPlayingUpFor > 0) + { + --this.recordPlayingUpFor; + } + + if (this.field_175195_w > 0) + { + --this.field_175195_w; + + if (this.field_175195_w <= 0) + { + this.field_175201_x = ""; + this.field_175200_y = ""; + } + } + + ++this.updateCounter; + this.streamIndicator.func_152439_a(); + + if (this.mc.thePlayer != null) + { + ItemStack itemstack = this.mc.thePlayer.inventory.getCurrentItem(); + + if (itemstack == null) + { + this.remainingHighlightTicks = 0; + } + else if (this.highlightingItemStack != null && itemstack.getItem() == this.highlightingItemStack.getItem() && ItemStack.areItemStackTagsEqual(itemstack, this.highlightingItemStack) && (itemstack.isItemStackDamageable() || itemstack.getMetadata() == this.highlightingItemStack.getMetadata())) + { + if (this.remainingHighlightTicks > 0) + { + --this.remainingHighlightTicks; + } + } + else + { + this.remainingHighlightTicks = 40; + } + + this.highlightingItemStack = itemstack; + } + } + + public void setRecordPlayingMessage(String p_73833_1_) + { + this.setRecordPlaying(I18n.format("record.nowPlaying", new Object[] {p_73833_1_}), true); + } + + public void setRecordPlaying(String p_110326_1_, boolean p_110326_2_) + { + this.recordPlaying = p_110326_1_; + this.recordPlayingUpFor = 60; + this.recordIsPlaying = p_110326_2_; + } + + public void displayTitle(String p_175178_1_, String p_175178_2_, int p_175178_3_, int p_175178_4_, int p_175178_5_) + { + if (p_175178_1_ == null && p_175178_2_ == null && p_175178_3_ < 0 && p_175178_4_ < 0 && p_175178_5_ < 0) + { + this.field_175201_x = ""; + this.field_175200_y = ""; + this.field_175195_w = 0; + } + else if (p_175178_1_ != null) + { + this.field_175201_x = p_175178_1_; + this.field_175195_w = this.field_175199_z + this.field_175192_A + this.field_175193_B; + } + else if (p_175178_2_ != null) + { + this.field_175200_y = p_175178_2_; + } + else + { + if (p_175178_3_ >= 0) + { + this.field_175199_z = p_175178_3_; + } + + if (p_175178_4_ >= 0) + { + this.field_175192_A = p_175178_4_; + } + + if (p_175178_5_ >= 0) + { + this.field_175193_B = p_175178_5_; + } + + if (this.field_175195_w > 0) + { + this.field_175195_w = this.field_175199_z + this.field_175192_A + this.field_175193_B; + } + } + } + + public void setRecordPlaying(IChatComponent p_175188_1_, boolean p_175188_2_) + { + this.setRecordPlaying(p_175188_1_.getUnformattedText(), p_175188_2_); + } + + /** + * returns a pointer to the persistant Chat GUI, containing all previous chat messages and such + */ + public GuiNewChat getChatGUI() + { + return this.persistantChatGUI; + } + + public int getUpdateCounter() + { + return this.updateCounter; + } + + public FontRenderer getFontRenderer() + { + return this.mc.fontRendererObj; + } + + public GuiSpectator getSpectatorGui() + { + return this.spectatorGui; + } + + public GuiPlayerTabOverlay getTabList() + { + return this.overlayPlayerList; + } + + public void func_181029_i() + { + this.overlayPlayerList.func_181030_a(); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiIngameMenu.java b/src/minecraft/net/minecraft/client/gui/GuiIngameMenu.java new file mode 100644 index 0000000..f03fb5f --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiIngameMenu.java @@ -0,0 +1,142 @@ +package net.minecraft.client.gui; + +import java.io.IOException; + +import animeware.NightSky; +import animeware.gui.mainmenu.ClassicButton; +import animeware.gui.mainmenu.CosmeticButtonMM; +import animeware.gui.mainmenu.CosmeticButtonNoOutl; +import animeware.gui.mainmenu.MainMenu; +import animeware.ui.CosmeticGUI; +import animeware.util.font.FontUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.achievement.GuiAchievements; +import net.minecraft.client.gui.achievement.GuiStats; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.resources.I18n; +import net.minecraft.realms.RealmsBridge; + +public class GuiIngameMenu extends GuiScreen +{ + private int field_146445_a; + private int field_146444_f; + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + this.field_146445_a = 0; + this.buttonList.clear(); + int i = -16; + int j = 98; + this.buttonList.add(new ClassicButton(1, this.width / 2 - 100, this.height / 4 + 120 + i, I18n.format("menu.returnToMenu", new Object[0]))); + + if (!this.mc.isIntegratedServerRunning()) + { + ((GuiButton)this.buttonList.get(0)).displayString = I18n.format("menu.disconnect", new Object[0]); + } + + this.buttonList.add(new ClassicButton(4, this.width / 2 - 100, this.height / 4 + 24 + i, I18n.format("menu.returnToGame", new Object[0]))); + this.buttonList.add(new ClassicButton(0, this.width / 2 - 100, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.options", new Object[0]))); + + + if(mc.isSingleplayer()) { + GuiButton guibutton; + this.buttonList.add(guibutton = new ClassicButton(7, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.shareToLan", new Object[0]))); + guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); + } else { + this.buttonList.add(new ClassicButton(9, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("Servers", new Object[0]))); + } + + + this.buttonList.add(new ClassicButton(5, this.width / 2 - 100, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.achievements", new Object[0]))); + this.buttonList.add(new CosmeticButtonNoOutl(8, this.width / 2 - 11, this.height / 4 + 55, I18n.format("", new Object[0]))); + this.buttonList.add(new ClassicButton(6, this.width / 2 + 2, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.stats", new Object[0]))); + + + + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + switch (button.id) + { + case 0: + this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings)); + break; + + case 1: + boolean flag = this.mc.isIntegratedServerRunning(); + boolean flag1 = this.mc.func_181540_al(); + button.enabled = false; + this.mc.theWorld.sendQuittingDisconnectingPacket(); + this.mc.loadWorld((WorldClient)null); + + if (flag) + { + this.mc.displayGuiScreen(new MainMenu()); + } + else if (flag1) + { + RealmsBridge realmsbridge = new RealmsBridge(); + realmsbridge.switchToRealms(new MainMenu()); + } + else + { + this.mc.displayGuiScreen(new GuiMultiplayer(new MainMenu())); + } + + case 2: + case 3: + default: + break; + + case 4: + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + break; + + case 5: + this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter())); + break; + + case 6: + this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); + break; + + case 7: + this.mc.displayGuiScreen(new GuiShareToLan(this)); + break; + case 8: + this.mc.displayGuiScreen(new CosmeticGUI()); + break; + + + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + ++this.field_146444_f; + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + FontUtil.normal.drawCenteredString(I18n.format( NightSky.INSTANCE.NAME + " " + NightSky.INSTANCE.VERSION, new Object[0]), this.width / 2, 40, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java b/src/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java new file mode 100644 index 0000000..59e1759 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiKeyBindingList.java @@ -0,0 +1,187 @@ +package net.minecraft.client.gui; + +import java.util.Arrays; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.util.EnumChatFormatting; +import org.apache.commons.lang3.ArrayUtils; + +public class GuiKeyBindingList extends GuiListExtended +{ + private final GuiControls field_148191_k; + private final Minecraft mc; + private final GuiListExtended.IGuiListEntry[] listEntries; + private int maxListLabelWidth = 0; + + public GuiKeyBindingList(GuiControls controls, Minecraft mcIn) + { + super(mcIn, controls.width, controls.height, 63, controls.height - 32, 20); + this.field_148191_k = controls; + this.mc = mcIn; + KeyBinding[] akeybinding = (KeyBinding[])ArrayUtils.clone(mcIn.gameSettings.keyBindings); + this.listEntries = new GuiListExtended.IGuiListEntry[akeybinding.length + KeyBinding.getKeybinds().size()]; + Arrays.sort((Object[])akeybinding); + int i = 0; + String s = null; + + for (KeyBinding keybinding : akeybinding) + { + String s1 = keybinding.getKeyCategory(); + + if (!s1.equals(s)) + { + s = s1; + this.listEntries[i++] = new GuiKeyBindingList.CategoryEntry(s1); + } + + int j = mcIn.fontRendererObj.getStringWidth(I18n.format(keybinding.getKeyDescription(), new Object[0])); + + if (j > this.maxListLabelWidth) + { + this.maxListLabelWidth = j; + } + + this.listEntries[i++] = new GuiKeyBindingList.KeyEntry(keybinding); + } + } + + protected int getSize() + { + return this.listEntries.length; + } + + /** + * Gets the IGuiListEntry object for the given index + */ + public GuiListExtended.IGuiListEntry getListEntry(int index) + { + return this.listEntries[index]; + } + + protected int getScrollBarX() + { + return super.getScrollBarX() + 15; + } + + /** + * Gets the width of the list + */ + public int getListWidth() + { + return super.getListWidth() + 32; + } + + public class CategoryEntry implements GuiListExtended.IGuiListEntry + { + private final String labelText; + private final int labelWidth; + + public CategoryEntry(String p_i45028_2_) + { + this.labelText = I18n.format(p_i45028_2_, new Object[0]); + this.labelWidth = GuiKeyBindingList.this.mc.fontRendererObj.getStringWidth(this.labelText); + } + + public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) + { + GuiKeyBindingList.this.mc.fontRendererObj.drawString(this.labelText, GuiKeyBindingList.this.mc.currentScreen.width / 2 - this.labelWidth / 2, y + slotHeight - GuiKeyBindingList.this.mc.fontRendererObj.FONT_HEIGHT - 1, 16777215); + } + + public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_) + { + return false; + } + + public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) + { + } + + public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) + { + } + } + + public class KeyEntry implements GuiListExtended.IGuiListEntry + { + private final KeyBinding keybinding; + private final String keyDesc; + private final GuiButton btnChangeKeyBinding; + private final GuiButton btnReset; + + private KeyEntry(KeyBinding p_i45029_2_) + { + this.keybinding = p_i45029_2_; + this.keyDesc = I18n.format(p_i45029_2_.getKeyDescription(), new Object[0]); + this.btnChangeKeyBinding = new GuiButton(0, 0, 0, 75, 20, I18n.format(p_i45029_2_.getKeyDescription(), new Object[0])); + this.btnReset = new GuiButton(0, 0, 0, 50, 20, I18n.format("controls.reset", new Object[0])); + } + + public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) + { + boolean flag = GuiKeyBindingList.this.field_148191_k.buttonId == this.keybinding; + GuiKeyBindingList.this.mc.fontRendererObj.drawString(this.keyDesc, x + 90 - GuiKeyBindingList.this.maxListLabelWidth, y + slotHeight / 2 - GuiKeyBindingList.this.mc.fontRendererObj.FONT_HEIGHT / 2, 16777215); + this.btnReset.xPosition = x + 190; + this.btnReset.yPosition = y; + this.btnReset.enabled = this.keybinding.getKeyCode() != this.keybinding.getKeyCodeDefault(); + this.btnReset.drawButton(GuiKeyBindingList.this.mc, mouseX, mouseY); + this.btnChangeKeyBinding.xPosition = x + 105; + this.btnChangeKeyBinding.yPosition = y; + this.btnChangeKeyBinding.displayString = GameSettings.getKeyDisplayString(this.keybinding.getKeyCode()); + boolean flag1 = false; + + if (this.keybinding.getKeyCode() != 0) + { + for (KeyBinding keybinding : GuiKeyBindingList.this.mc.gameSettings.keyBindings) + { + if (keybinding != this.keybinding && keybinding.getKeyCode() == this.keybinding.getKeyCode()) + { + flag1 = true; + break; + } + } + } + + if (flag) + { + this.btnChangeKeyBinding.displayString = EnumChatFormatting.WHITE + "> " + EnumChatFormatting.YELLOW + this.btnChangeKeyBinding.displayString + EnumChatFormatting.WHITE + " <"; + } + else if (flag1) + { + this.btnChangeKeyBinding.displayString = EnumChatFormatting.RED + this.btnChangeKeyBinding.displayString; + } + + this.btnChangeKeyBinding.drawButton(GuiKeyBindingList.this.mc, mouseX, mouseY); + } + + public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_) + { + if (this.btnChangeKeyBinding.mousePressed(GuiKeyBindingList.this.mc, p_148278_2_, p_148278_3_)) + { + GuiKeyBindingList.this.field_148191_k.buttonId = this.keybinding; + return true; + } + else if (this.btnReset.mousePressed(GuiKeyBindingList.this.mc, p_148278_2_, p_148278_3_)) + { + GuiKeyBindingList.this.mc.gameSettings.setOptionKeyBinding(this.keybinding, this.keybinding.getKeyCodeDefault()); + KeyBinding.resetKeyBindingArrayAndHash(); + return true; + } + else + { + return false; + } + } + + public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) + { + this.btnChangeKeyBinding.mouseReleased(x, y); + this.btnReset.mouseReleased(x, y); + } + + public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) + { + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiLabel.java b/src/minecraft/net/minecraft/client/gui/GuiLabel.java new file mode 100644 index 0000000..23ed274 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiLabel.java @@ -0,0 +1,98 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; + +public class GuiLabel extends Gui +{ + protected int field_146167_a = 200; + protected int field_146161_f = 20; + public int field_146162_g; + public int field_146174_h; + private List field_146173_k; + public int field_175204_i; + private boolean centered; + public boolean visible = true; + private boolean labelBgEnabled; + private int field_146168_n; + private int field_146169_o; + private int field_146166_p; + private int field_146165_q; + private FontRenderer fontRenderer; + private int field_146163_s; + + public GuiLabel(FontRenderer fontRendererObj, int p_i45540_2_, int p_i45540_3_, int p_i45540_4_, int p_i45540_5_, int p_i45540_6_, int p_i45540_7_) + { + this.fontRenderer = fontRendererObj; + this.field_175204_i = p_i45540_2_; + this.field_146162_g = p_i45540_3_; + this.field_146174_h = p_i45540_4_; + this.field_146167_a = p_i45540_5_; + this.field_146161_f = p_i45540_6_; + this.field_146173_k = Lists.newArrayList(); + this.centered = false; + this.labelBgEnabled = false; + this.field_146168_n = p_i45540_7_; + this.field_146169_o = -1; + this.field_146166_p = -1; + this.field_146165_q = -1; + this.field_146163_s = 0; + } + + public void func_175202_a(String p_175202_1_) + { + this.field_146173_k.add(I18n.format(p_175202_1_, new Object[0])); + } + + /** + * Sets the Label to be centered + */ + public GuiLabel setCentered() + { + this.centered = true; + return this; + } + + public void drawLabel(Minecraft mc, int mouseX, int mouseY) + { + if (this.visible) + { + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + this.drawLabelBackground(mc, mouseX, mouseY); + int i = this.field_146174_h + this.field_146161_f / 2 + this.field_146163_s / 2; + int j = i - this.field_146173_k.size() * 10 / 2; + + for (int k = 0; k < this.field_146173_k.size(); ++k) + { + if (this.centered) + { + this.drawCenteredString(this.fontRenderer, (String)this.field_146173_k.get(k), this.field_146162_g + this.field_146167_a / 2, j + k * 10, this.field_146168_n); + } + else + { + this.drawString(this.fontRenderer, (String)this.field_146173_k.get(k), this.field_146162_g, j + k * 10, this.field_146168_n); + } + } + } + } + + protected void drawLabelBackground(Minecraft mcIn, int p_146160_2_, int p_146160_3_) + { + if (this.labelBgEnabled) + { + int i = this.field_146167_a + this.field_146163_s * 2; + int j = this.field_146161_f + this.field_146163_s * 2; + int k = this.field_146162_g - this.field_146163_s; + int l = this.field_146174_h - this.field_146163_s; + drawRect(k, l, k + i, l + j, this.field_146169_o); + this.drawHorizontalLine(k, k + i, l, this.field_146166_p); + this.drawHorizontalLine(k, k + i, l + j, this.field_146165_q); + this.drawVerticalLine(k, l, l + j, this.field_146166_p); + this.drawVerticalLine(k + i, l, l + j, this.field_146165_q); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiLanguage.java b/src/minecraft/net/minecraft/client/gui/GuiLanguage.java new file mode 100644 index 0000000..7b6f3f4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiLanguage.java @@ -0,0 +1,165 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.io.IOException; +import java.util.Map; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.resources.Language; +import net.minecraft.client.resources.LanguageManager; +import net.minecraft.client.settings.GameSettings; + +public class GuiLanguage extends GuiScreen +{ + /** The parent Gui screen */ + protected GuiScreen parentScreen; + + /** The List GuiSlot object reference. */ + private GuiLanguage.List list; + + /** Reference to the GameSettings object. */ + private final GameSettings game_settings_3; + + /** Reference to the LanguageManager object. */ + private final LanguageManager languageManager; + + /** + * A button which allows the user to determine if the Unicode font should be forced. + */ + private GuiOptionButton forceUnicodeFontBtn; + + /** The button to confirm the current settings. */ + private GuiOptionButton confirmSettingsBtn; + + public GuiLanguage(GuiScreen screen, GameSettings gameSettingsObj, LanguageManager manager) + { + this.parentScreen = screen; + this.game_settings_3 = gameSettingsObj; + this.languageManager = manager; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.add(this.forceUnicodeFontBtn = new GuiOptionButton(100, this.width / 2 - 155, this.height - 38, GameSettings.Options.FORCE_UNICODE_FONT, this.game_settings_3.getKeyBinding(GameSettings.Options.FORCE_UNICODE_FONT))); + this.buttonList.add(this.confirmSettingsBtn = new GuiOptionButton(6, this.width / 2 - 155 + 160, this.height - 38, I18n.format("gui.done", new Object[0]))); + this.list = new GuiLanguage.List(this.mc); + this.list.registerScrollButtons(7, 8); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + this.list.handleMouseInput(); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + switch (button.id) + { + case 5: + break; + + case 6: + this.mc.displayGuiScreen(this.parentScreen); + break; + + case 100: + if (button instanceof GuiOptionButton) + { + this.game_settings_3.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1); + button.displayString = this.game_settings_3.getKeyBinding(GameSettings.Options.FORCE_UNICODE_FONT); + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + int i = scaledresolution.getScaledWidth(); + int j = scaledresolution.getScaledHeight(); + this.setWorldAndResolution(this.mc, i, j); + } + + break; + + default: + this.list.actionPerformed(button); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.list.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.fontRendererObj, I18n.format("options.language", new Object[0]), this.width / 2, 16, 16777215); + this.drawCenteredString(this.fontRendererObj, "(" + I18n.format("options.languageWarning", new Object[0]) + ")", this.width / 2, this.height - 56, 8421504); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + class List extends GuiSlot + { + private final java.util.List langCodeList = Lists.newArrayList(); + private final Map languageMap = Maps.newHashMap(); + + public List(Minecraft mcIn) + { + super(mcIn, GuiLanguage.this.width, GuiLanguage.this.height, 32, GuiLanguage.this.height - 65 + 4, 18); + + for (Language language : GuiLanguage.this.languageManager.getLanguages()) + { + this.languageMap.put(language.getLanguageCode(), language); + this.langCodeList.add(language.getLanguageCode()); + } + } + + protected int getSize() + { + return this.langCodeList.size(); + } + + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + Language language = (Language)this.languageMap.get(this.langCodeList.get(slotIndex)); + GuiLanguage.this.languageManager.setCurrentLanguage(language); + GuiLanguage.this.game_settings_3.language = language.getLanguageCode(); + this.mc.refreshResources(); + GuiLanguage.this.fontRendererObj.setUnicodeFlag(GuiLanguage.this.languageManager.isCurrentLocaleUnicode() || GuiLanguage.this.game_settings_3.forceUnicodeFont); + GuiLanguage.this.fontRendererObj.setBidiFlag(GuiLanguage.this.languageManager.isCurrentLanguageBidirectional()); + GuiLanguage.this.confirmSettingsBtn.displayString = I18n.format("gui.done", new Object[0]); + GuiLanguage.this.forceUnicodeFontBtn.displayString = GuiLanguage.this.game_settings_3.getKeyBinding(GameSettings.Options.FORCE_UNICODE_FONT); + GuiLanguage.this.game_settings_3.saveOptions(); + } + + protected boolean isSelected(int slotIndex) + { + return ((String)this.langCodeList.get(slotIndex)).equals(GuiLanguage.this.languageManager.getCurrentLanguage().getLanguageCode()); + } + + protected int getContentHeight() + { + return this.getSize() * 18; + } + + protected void drawBackground() + { + GuiLanguage.this.drawDefaultBackground(); + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + GuiLanguage.this.fontRendererObj.setBidiFlag(true); + GuiLanguage.this.drawCenteredString(GuiLanguage.this.fontRendererObj, ((Language)this.languageMap.get(this.langCodeList.get(entryID))).toString(), this.width / 2, p_180791_3_ + 1, 16777215); + GuiLanguage.this.fontRendererObj.setBidiFlag(GuiLanguage.this.languageManager.getCurrentLanguage().isBidirectional()); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiListButton.java b/src/minecraft/net/minecraft/client/gui/GuiListButton.java new file mode 100644 index 0000000..d9f09da --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiListButton.java @@ -0,0 +1,58 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; + +public class GuiListButton extends GuiButton +{ + private boolean field_175216_o; + + /** The localization string used by this control. */ + private String localizationStr; + + /** The GuiResponder Object reference. */ + private final GuiPageButtonList.GuiResponder guiResponder; + + public GuiListButton(GuiPageButtonList.GuiResponder responder, int p_i45539_2_, int p_i45539_3_, int p_i45539_4_, String p_i45539_5_, boolean p_i45539_6_) + { + super(p_i45539_2_, p_i45539_3_, p_i45539_4_, 150, 20, ""); + this.localizationStr = p_i45539_5_; + this.field_175216_o = p_i45539_6_; + this.displayString = this.buildDisplayString(); + this.guiResponder = responder; + } + + /** + * Builds the localized display string for this GuiListButton + */ + private String buildDisplayString() + { + return I18n.format(this.localizationStr, new Object[0]) + ": " + (this.field_175216_o ? I18n.format("gui.yes", new Object[0]) : I18n.format("gui.no", new Object[0])); + } + + public void func_175212_b(boolean p_175212_1_) + { + this.field_175216_o = p_175212_1_; + this.displayString = this.buildDisplayString(); + this.guiResponder.func_175321_a(this.id, p_175212_1_); + } + + /** + * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent + * e). + */ + public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) + { + if (super.mousePressed(mc, mouseX, mouseY)) + { + this.field_175216_o = !this.field_175216_o; + this.displayString = this.buildDisplayString(); + this.guiResponder.func_175321_a(this.id, this.field_175216_o); + return true; + } + else + { + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiListExtended.java b/src/minecraft/net/minecraft/client/gui/GuiListExtended.java new file mode 100644 index 0000000..52030c1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiListExtended.java @@ -0,0 +1,95 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; + +public abstract class GuiListExtended extends GuiSlot +{ + public GuiListExtended(Minecraft mcIn, int widthIn, int heightIn, int topIn, int bottomIn, int slotHeightIn) + { + super(mcIn, widthIn, heightIn, topIn, bottomIn, slotHeightIn); + } + + /** + * The element in the slot that was clicked, boolean for whether it was double clicked or not + */ + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + } + + /** + * Returns true if the element passed in is currently selected + */ + protected boolean isSelected(int slotIndex) + { + return false; + } + + protected void drawBackground() + { + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + this.getListEntry(entryID).drawEntry(entryID, p_180791_2_, p_180791_3_, this.getListWidth(), p_180791_4_, mouseXIn, mouseYIn, this.getSlotIndexFromScreenCoords(mouseXIn, mouseYIn) == entryID); + } + + protected void func_178040_a(int p_178040_1_, int p_178040_2_, int p_178040_3_) + { + this.getListEntry(p_178040_1_).setSelected(p_178040_1_, p_178040_2_, p_178040_3_); + } + + public boolean mouseClicked(int mouseX, int mouseY, int mouseEvent) + { + if (this.isMouseYWithinSlotBounds(mouseY)) + { + int i = this.getSlotIndexFromScreenCoords(mouseX, mouseY); + + if (i >= 0) + { + int j = this.left + this.width / 2 - this.getListWidth() / 2 + 2; + int k = this.top + 4 - this.getAmountScrolled() + i * this.slotHeight + this.headerPadding; + int l = mouseX - j; + int i1 = mouseY - k; + + if (this.getListEntry(i).mousePressed(i, mouseX, mouseY, mouseEvent, l, i1)) + { + this.setEnabled(false); + return true; + } + } + } + + return false; + } + + public boolean mouseReleased(int p_148181_1_, int p_148181_2_, int p_148181_3_) + { + for (int i = 0; i < this.getSize(); ++i) + { + int j = this.left + this.width / 2 - this.getListWidth() / 2 + 2; + int k = this.top + 4 - this.getAmountScrolled() + i * this.slotHeight + this.headerPadding; + int l = p_148181_1_ - j; + int i1 = p_148181_2_ - k; + this.getListEntry(i).mouseReleased(i, p_148181_1_, p_148181_2_, p_148181_3_, l, i1); + } + + this.setEnabled(true); + return false; + } + + /** + * Gets the IGuiListEntry object for the given index + */ + public abstract GuiListExtended.IGuiListEntry getListEntry(int index); + + public interface IGuiListEntry + { + void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_); + + void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected); + + boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_); + + void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiLockIconButton.java b/src/minecraft/net/minecraft/client/gui/GuiLockIconButton.java new file mode 100644 index 0000000..a8107ab --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiLockIconButton.java @@ -0,0 +1,97 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; + +public class GuiLockIconButton extends GuiButton +{ + private boolean field_175231_o = false; + + public GuiLockIconButton(int p_i45538_1_, int p_i45538_2_, int p_i45538_3_) + { + super(p_i45538_1_, p_i45538_2_, p_i45538_3_, 20, 20, ""); + } + + public boolean func_175230_c() + { + return this.field_175231_o; + } + + public void func_175229_b(boolean p_175229_1_) + { + this.field_175231_o = p_175229_1_; + } + + /** + * Draws this button to the screen. + */ + public void drawButton(Minecraft mc, int mouseX, int mouseY) + { + if (this.visible) + { + mc.getTextureManager().bindTexture(GuiButton.buttonTextures); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + GuiLockIconButton.Icon guilockiconbutton$icon; + + if (this.field_175231_o) + { + if (!this.enabled) + { + guilockiconbutton$icon = GuiLockIconButton.Icon.LOCKED_DISABLED; + } + else if (flag) + { + guilockiconbutton$icon = GuiLockIconButton.Icon.LOCKED_HOVER; + } + else + { + guilockiconbutton$icon = GuiLockIconButton.Icon.LOCKED; + } + } + else if (!this.enabled) + { + guilockiconbutton$icon = GuiLockIconButton.Icon.UNLOCKED_DISABLED; + } + else if (flag) + { + guilockiconbutton$icon = GuiLockIconButton.Icon.UNLOCKED_HOVER; + } + else + { + guilockiconbutton$icon = GuiLockIconButton.Icon.UNLOCKED; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, guilockiconbutton$icon.func_178910_a(), guilockiconbutton$icon.func_178912_b(), this.width, this.height); + } + } + + static enum Icon + { + LOCKED(0, 146), + LOCKED_HOVER(0, 166), + LOCKED_DISABLED(0, 186), + UNLOCKED(20, 146), + UNLOCKED_HOVER(20, 166), + UNLOCKED_DISABLED(20, 186); + + private final int field_178914_g; + private final int field_178920_h; + + private Icon(int p_i45537_3_, int p_i45537_4_) + { + this.field_178914_g = p_i45537_3_; + this.field_178920_h = p_i45537_4_; + } + + public int func_178910_a() + { + return this.field_178914_g; + } + + public int func_178912_b() + { + return this.field_178920_h; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiMainMenu.java b/src/minecraft/net/minecraft/client/gui/GuiMainMenu.java new file mode 100644 index 0000000..67d4938 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiMainMenu.java @@ -0,0 +1,585 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; + +import animeware.NightSky; +import animeware.gui.alt.GuiAltManager; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URI; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicInteger; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.I18n; +import net.minecraft.realms.RealmsBridge; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.demo.DemoWorldServer; +import net.minecraft.world.storage.ISaveFormat; +import net.minecraft.world.storage.WorldInfo; + +import org.apache.commons.io.Charsets; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.util.glu.Project; + +public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback +{ + private static final AtomicInteger field_175373_f = new AtomicInteger(0); + private static final Logger logger = LogManager.getLogger(); + private static final Random RANDOM = new Random(); + + /** Counts the number of screen updates. */ + private float updateCounter; + + /** The splash message. */ + private String splashText; + private GuiButton buttonResetDemo; + + /** Timer used to rotate the panorama, increases every tick. */ + private int panoramaTimer; + + /** + * Texture allocated for the current viewport of the main menu's panorama background. + */ + private DynamicTexture viewportTexture; + private boolean field_175375_v = true; + + /** + * The Object object utilized as a thread lock when performing non thread-safe operations + */ + private final Object threadLock = new Object(); + + /** OpenGL graphics card warning. */ + private String openGLWarning1; + + /** OpenGL graphics card warning. */ + private String openGLWarning2; + + /** Link to the Mojang Support about minimum requirements */ + private String openGLWarningLink; + private static final ResourceLocation splashTexts = new ResourceLocation("texts/splashes.txt"); + private static final ResourceLocation minecraftTitleTextures = new ResourceLocation("textures/gui/title/minecraft.png"); + + /** An array of all the paths to the panorama pictures. */ + private static final ResourceLocation[] titlePanoramaPaths = new ResourceLocation[] {new ResourceLocation("textures/gui/title/background/panorama_0.png"), new ResourceLocation("textures/gui/title/background/panorama_1.png"), new ResourceLocation("textures/gui/title/background/panorama_2.png"), new ResourceLocation("textures/gui/title/background/panorama_3.png"), new ResourceLocation("textures/gui/title/background/panorama_4.png"), new ResourceLocation("textures/gui/title/background/panorama_5.png")}; + public static final String field_96138_a = "Please click " + EnumChatFormatting.UNDERLINE + "here" + EnumChatFormatting.RESET + " for more information."; + private int field_92024_r; + private int field_92023_s; + private int field_92022_t; + private int field_92021_u; + private int field_92020_v; + private int field_92019_w; + private ResourceLocation backgroundTexture; + + /** Minecraft Realms button. */ + private GuiButton realmsButton; + + public GuiMainMenu() + { + this.openGLWarning2 = field_96138_a; + this.splashText = "missingno"; + BufferedReader bufferedreader = null; + + try + { + List list = Lists.newArrayList(); + bufferedreader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(splashTexts).getInputStream(), Charsets.UTF_8)); + String s; + + while ((s = bufferedreader.readLine()) != null) + { + s = s.trim(); + + if (!s.isEmpty()) + { + list.add(s); + } + } + + if (!list.isEmpty()) + { + while (true) + { + this.splashText = (String)list.get(RANDOM.nextInt(list.size())); + + if (this.splashText.hashCode() != 125780783) + { + break; + } + } + } + } + catch (IOException var12) + { + ; + } + finally + { + if (bufferedreader != null) + { + try + { + bufferedreader.close(); + } + catch (IOException var11) + { + ; + } + } + } + + this.updateCounter = RANDOM.nextFloat(); + this.openGLWarning1 = ""; + + if (!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.areShadersSupported()) + { + this.openGLWarning1 = I18n.format("title.oldgl1", new Object[0]); + this.openGLWarning2 = I18n.format("title.oldgl2", new Object[0]); + this.openGLWarningLink = "https://help.mojang.com/customer/portal/articles/325948?ref=game"; + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + ++this.panoramaTimer; + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return false; + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + NightSky.INSTANCE.getDiscordRP().update("Main Menu", "Version: " + NightSky.INSTANCE.VERSION); + this.viewportTexture = new DynamicTexture(256, 256); + this.backgroundTexture = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + + if (calendar.get(2) + 1 == 12 && calendar.get(5) == 24) + { + this.splashText = "Merry X-mas!"; + } + else if (calendar.get(2) + 1 == 1 && calendar.get(5) == 1) + { + this.splashText = "Happy new year!"; + } + else if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31) + { + this.splashText = "OOoooOOOoooo! Spooky!"; + } + + int i = 24; + int j = this.height / 4 + 48; + + if (this.mc.isDemo()) + { + this.addDemoButtons(j, 24); + } + else + { + this.addSingleplayerMultiplayerButtons(j, 24); + } + + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, j + 72 + 12, 98, 20, I18n.format("menu.options", new Object[0]))); + this.buttonList.add(new GuiButton(4, this.width / 2 + 2, j + 72 + 12, 98, 20, I18n.format("menu.quit", new Object[0]))); + this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, j + 72 + 12)); + + synchronized (this.threadLock) + { + this.field_92023_s = this.fontRendererObj.getStringWidth(this.openGLWarning1); + this.field_92024_r = this.fontRendererObj.getStringWidth(this.openGLWarning2); + int k = Math.max(this.field_92023_s, this.field_92024_r); + this.field_92022_t = (this.width - k) / 2; + this.field_92021_u = ((GuiButton)this.buttonList.get(0)).yPosition - 24; + this.field_92020_v = this.field_92022_t + k; + this.field_92019_w = this.field_92021_u + 24; + } + + this.mc.func_181537_a(false); + } + + /** + * Adds Singleplayer and Multiplayer buttons on Main Menu for players who have bought the game. + */ + private void addSingleplayerMultiplayerButtons(int p_73969_1_, int p_73969_2_) + { + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0]))); + this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0]))); + this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("AltManager", new Object[0]))); + } + + /** + * Adds Demo buttons on Main Menu for players who are playing Demo. + */ + private void addDemoButtons(int p_73972_1_, int p_73972_2_) + { + this.buttonList.add(new GuiButton(11, this.width / 2 - 100, p_73972_1_, I18n.format("menu.playdemo", new Object[0]))); + this.buttonList.add(this.buttonResetDemo = new GuiButton(12, this.width / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.format("menu.resetdemo", new Object[0]))); + ISaveFormat isaveformat = this.mc.getSaveLoader(); + WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World"); + + if (worldinfo == null) + { + this.buttonResetDemo.enabled = false; + } + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.id == 0) + { + this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings)); + } + + if (button.id == 5) + { + this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager())); + } + + if (button.id == 1) + { + this.mc.displayGuiScreen(new GuiSelectWorld(this)); + } + + if (button.id == 2) + { + this.mc.displayGuiScreen(new GuiMultiplayer(this)); + } + + if (button.id == 14 && this.realmsButton.visible) + { + this.mc.displayGuiScreen(new GuiAltManager()); + } + + if (button.id == 4) + { + this.mc.shutdown(); + } + + if (button.id == 11) + { + this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); + } + + if (button.id == 12) + { + ISaveFormat isaveformat = this.mc.getSaveLoader(); + WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World"); + + if (worldinfo != null) + { + GuiYesNo guiyesno = GuiSelectWorld.func_152129_a(this, worldinfo.getWorldName(), 12); + this.mc.displayGuiScreen(guiyesno); + } + } + } + + private void switchToRealms() + { + RealmsBridge realmsbridge = new RealmsBridge(); + realmsbridge.switchToRealms(this); + } + + public void confirmClicked(boolean result, int id) + { + if (result && id == 12) + { + ISaveFormat isaveformat = this.mc.getSaveLoader(); + isaveformat.flushCache(); + isaveformat.deleteWorldDirectory("Demo_World"); + this.mc.displayGuiScreen(this); + } + else if (id == 13) + { + if (result) + { + try + { + Class oclass = Class.forName("java.awt.Desktop"); + Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]); + oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {new URI(this.openGLWarningLink)}); + } + catch (Throwable throwable) + { + logger.error("Couldn\'t open link", throwable); + } + } + + this.mc.displayGuiScreen(this); + } + } + + /** + * Draws the main menu panorama + */ + private void drawPanorama(int p_73970_1_, int p_73970_2_, float p_73970_3_) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.matrixMode(5889); + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F); + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.disableCull(); + GlStateManager.depthMask(false); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + int i = 8; + + for (int j = 0; j < i * i; ++j) + { + GlStateManager.pushMatrix(); + float f = ((float)(j % i) / (float)i - 0.5F) / 64.0F; + float f1 = ((float)(j / i) / (float)i - 0.5F) / 64.0F; + float f2 = 0.0F; + GlStateManager.translate(f, f1, f2); + GlStateManager.rotate(MathHelper.sin(((float)this.panoramaTimer + p_73970_3_) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-((float)this.panoramaTimer + p_73970_3_) * 0.1F, 0.0F, 1.0F, 0.0F); + + for (int k = 0; k < 6; ++k) + { + GlStateManager.pushMatrix(); + + if (k == 1) + { + GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); + } + + if (k == 2) + { + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + } + + if (k == 3) + { + GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); + } + + if (k == 4) + { + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + } + + if (k == 5) + { + GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); + } + + this.mc.getTextureManager().bindTexture(titlePanoramaPaths[k]); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + int l = 255 / (j + 1); + float f3 = 0.0F; + worldrenderer.pos(-1.0D, -1.0D, 1.0D).tex(0.0D, 0.0D).color(255, 255, 255, l).endVertex(); + worldrenderer.pos(1.0D, -1.0D, 1.0D).tex(1.0D, 0.0D).color(255, 255, 255, l).endVertex(); + worldrenderer.pos(1.0D, 1.0D, 1.0D).tex(1.0D, 1.0D).color(255, 255, 255, l).endVertex(); + worldrenderer.pos(-1.0D, 1.0D, 1.0D).tex(0.0D, 1.0D).color(255, 255, 255, l).endVertex(); + tessellator.draw(); + GlStateManager.popMatrix(); + } + + GlStateManager.popMatrix(); + GlStateManager.colorMask(true, true, true, false); + } + + worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); + GlStateManager.colorMask(true, true, true, true); + GlStateManager.matrixMode(5889); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); + GlStateManager.enableDepth(); + } + + /** + * Rotate and blurs the skybox view in the main menu + */ + private void rotateAndBlurSkybox(float p_73968_1_) + { + this.mc.getTextureManager().bindTexture(this.backgroundTexture); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.colorMask(true, true, true, false); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + GlStateManager.disableAlpha(); + int i = 3; + + for (int j = 0; j < i; ++j) + { + float f = 1.0F / (float)(j + 1); + int k = this.width; + int l = this.height; + float f1 = (float)(j - i / 2) / 256.0F; + worldrenderer.pos((double)k, (double)l, (double)this.zLevel).tex((double)(0.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); + worldrenderer.pos((double)k, 0.0D, (double)this.zLevel).tex((double)(1.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); + worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex((double)(1.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); + worldrenderer.pos(0.0D, (double)l, (double)this.zLevel).tex((double)(0.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); + } + + tessellator.draw(); + GlStateManager.enableAlpha(); + GlStateManager.colorMask(true, true, true, true); + } + + /** + * Renders the skybox in the main menu + */ + private void renderSkybox(int p_73971_1_, int p_73971_2_, float p_73971_3_) + { + this.mc.getFramebuffer().unbindFramebuffer(); + GlStateManager.viewport(0, 0, 256, 256); + this.drawPanorama(p_73971_1_, p_73971_2_, p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.rotateAndBlurSkybox(p_73971_3_); + this.mc.getFramebuffer().bindFramebuffer(true); + GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + float f = this.width > this.height ? 120.0F / (float)this.width : 120.0F / (float)this.height; + float f1 = (float)this.height * f / 256.0F; + float f2 = (float)this.width * f / 256.0F; + int i = this.width; + int j = this.height; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos(0.0D, (double)j, (double)this.zLevel).tex((double)(0.5F - f1), (double)(0.5F + f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); + worldrenderer.pos((double)i, (double)j, (double)this.zLevel).tex((double)(0.5F - f1), (double)(0.5F - f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); + worldrenderer.pos((double)i, 0.0D, (double)this.zLevel).tex((double)(0.5F + f1), (double)(0.5F - f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); + worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex((double)(0.5F + f1), (double)(0.5F + f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); + tessellator.draw(); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + GlStateManager.disableAlpha(); + this.renderSkybox(mouseX, mouseY, partialTicks); + GlStateManager.enableAlpha(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int i = 274; + int j = this.width / 2 - i / 2; + int k = 30; + this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215); + this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE); + this.mc.getTextureManager().bindTexture(minecraftTitleTextures); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + + if ((double)this.updateCounter < 1.0E-4D) + { + this.drawTexturedModalRect(j + 0, k + 0, 0, 0, 99, 44); + this.drawTexturedModalRect(j + 99, k + 0, 129, 0, 27, 44); + this.drawTexturedModalRect(j + 99 + 26, k + 0, 126, 0, 3, 44); + this.drawTexturedModalRect(j + 99 + 26 + 3, k + 0, 99, 0, 26, 44); + this.drawTexturedModalRect(j + 155, k + 0, 0, 45, 155, 44); + } + else + { + this.drawTexturedModalRect(j + 0, k + 0, 0, 0, 155, 44); + this.drawTexturedModalRect(j + 155, k + 0, 0, 45, 155, 44); + } + + GlStateManager.pushMatrix(); + GlStateManager.translate((float)(this.width / 2 + 90), 70.0F, 0.0F); + GlStateManager.rotate(-20.0F, 0.0F, 0.0F, 1.0F); + float f = 1.8F - MathHelper.abs(MathHelper.sin((float)(Minecraft.getSystemTime() % 1000L) / 1000.0F * (float)Math.PI * 2.0F) * 0.1F); + f = f * 100.0F / (float)(this.fontRendererObj.getStringWidth(this.splashText) + 32); + GlStateManager.scale(f, f, f); + this.drawCenteredString(this.fontRendererObj, this.splashText, 0, -8, -256); + GlStateManager.popMatrix(); + String s = "Minecraft 1.8.8"; + + if (this.mc.isDemo()) + { + s = s + " Demo"; + } + + this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1); + String s1 = "Copyright Mojang AB. Do not distribute!"; + this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1); + + if (this.openGLWarning1 != null && this.openGLWarning1.length() > 0) + { + drawRect(this.field_92022_t - 2, this.field_92021_u - 2, this.field_92020_v + 2, this.field_92019_w - 1, 1428160512); + this.drawString(this.fontRendererObj, this.openGLWarning1, this.field_92022_t, this.field_92021_u, -1); + this.drawString(this.fontRendererObj, this.openGLWarning2, (this.width - this.field_92024_r) / 2, ((GuiButton)this.buttonList.get(0)).yPosition - 12, -1); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + super.mouseClicked(mouseX, mouseY, mouseButton); + + synchronized (this.threadLock) + { + if (this.openGLWarning1.length() > 0 && mouseX >= this.field_92022_t && mouseX <= this.field_92020_v && mouseY >= this.field_92021_u && mouseY <= this.field_92019_w) + { + GuiConfirmOpenLink guiconfirmopenlink = new GuiConfirmOpenLink(this, this.openGLWarningLink, 13, true); + guiconfirmopenlink.disableSecurityWarning(); + this.mc.displayGuiScreen(guiconfirmopenlink); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiMemoryErrorScreen.java b/src/minecraft/net/minecraft/client/gui/GuiMemoryErrorScreen.java new file mode 100644 index 0000000..d4f39b6 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiMemoryErrorScreen.java @@ -0,0 +1,61 @@ +package net.minecraft.client.gui; + +import java.io.IOException; + +import animeware.gui.mainmenu.MainMenu; +import net.minecraft.client.resources.I18n; + +public class GuiMemoryErrorScreen extends GuiScreen +{ + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.clear(); + this.buttonList.add(new GuiOptionButton(0, this.width / 2 - 155, this.height / 4 + 120 + 12, I18n.format("gui.toTitle", new Object[0]))); + this.buttonList.add(new GuiOptionButton(1, this.width / 2 - 155 + 160, this.height / 4 + 120 + 12, I18n.format("menu.quit", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.id == 0) + { + this.mc.displayGuiScreen(new MainMenu()); + } + else if (button.id == 1) + { + this.mc.shutdown(); + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, "Out of memory!", this.width / 2, this.height / 4 - 60 + 20, 16777215); + this.drawString(this.fontRendererObj, "Minecraft has run out of memory.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 0, 10526880); + this.drawString(this.fontRendererObj, "This could be caused by a bug in the game or by the", this.width / 2 - 140, this.height / 4 - 60 + 60 + 18, 10526880); + this.drawString(this.fontRendererObj, "Java Virtual Machine not being allocated enough", this.width / 2 - 140, this.height / 4 - 60 + 60 + 27, 10526880); + this.drawString(this.fontRendererObj, "memory.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 36, 10526880); + this.drawString(this.fontRendererObj, "To prevent level corruption, the current game has quit.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 54, 10526880); + this.drawString(this.fontRendererObj, "We\'ve tried to free up enough memory to let you go back to", this.width / 2 - 140, this.height / 4 - 60 + 60 + 63, 10526880); + this.drawString(this.fontRendererObj, "the main menu and back to playing, but this may not have worked.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 72, 10526880); + this.drawString(this.fontRendererObj, "Please restart the game if you see this message again.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 81, 10526880); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiMerchant.java b/src/minecraft/net/minecraft/client/gui/GuiMerchant.java new file mode 100644 index 0000000..cefed97 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiMerchant.java @@ -0,0 +1,274 @@ +package net.minecraft.client.gui; + +import io.netty.buffer.Unpooled; +import java.io.IOException; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.IMerchant; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ContainerMerchant; +import net.minecraft.item.ItemStack; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ResourceLocation; +import net.minecraft.village.MerchantRecipe; +import net.minecraft.village.MerchantRecipeList; +import net.minecraft.world.World; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class GuiMerchant extends GuiContainer +{ + private static final Logger logger = LogManager.getLogger(); + + /** The GUI texture for the villager merchant GUI. */ + private static final ResourceLocation MERCHANT_GUI_TEXTURE = new ResourceLocation("textures/gui/container/villager.png"); + + /** The current IMerchant instance in use for this specific merchant. */ + private IMerchant merchant; + + /** The button which proceeds to the next available merchant recipe. */ + private GuiMerchant.MerchantButton nextButton; + + /** Returns to the previous Merchant recipe if one is applicable. */ + private GuiMerchant.MerchantButton previousButton; + + /** + * The integer value corresponding to the currently selected merchant recipe. + */ + private int selectedMerchantRecipe; + + /** The chat component utilized by this GuiMerchant instance. */ + private IChatComponent chatComponent; + + public GuiMerchant(InventoryPlayer p_i45500_1_, IMerchant p_i45500_2_, World worldIn) + { + super(new ContainerMerchant(p_i45500_1_, p_i45500_2_, worldIn)); + this.merchant = p_i45500_2_; + this.chatComponent = p_i45500_2_.getDisplayName(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + super.initGui(); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.buttonList.add(this.nextButton = new GuiMerchant.MerchantButton(1, i + 120 + 27, j + 24 - 1, true)); + this.buttonList.add(this.previousButton = new GuiMerchant.MerchantButton(2, i + 36 - 19, j + 24 - 1, false)); + this.nextButton.enabled = false; + this.previousButton.enabled = false; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + String s = this.chatComponent.getUnformattedText(); + this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.thePlayer); + + if (merchantrecipelist != null) + { + this.nextButton.enabled = this.selectedMerchantRecipe < merchantrecipelist.size() - 1; + this.previousButton.enabled = this.selectedMerchantRecipe > 0; + } + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + boolean flag = false; + + if (button == this.nextButton) + { + ++this.selectedMerchantRecipe; + MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.thePlayer); + + if (merchantrecipelist != null && this.selectedMerchantRecipe >= merchantrecipelist.size()) + { + this.selectedMerchantRecipe = merchantrecipelist.size() - 1; + } + + flag = true; + } + else if (button == this.previousButton) + { + --this.selectedMerchantRecipe; + + if (this.selectedMerchantRecipe < 0) + { + this.selectedMerchantRecipe = 0; + } + + flag = true; + } + + if (flag) + { + ((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.selectedMerchantRecipe); + PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer()); + packetbuffer.writeInt(this.selectedMerchantRecipe); + this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload("MC|TrSel", packetbuffer)); + } + } + + /** + * Args : renderPartialTicks, mouseX, mouseY + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); + MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.thePlayer); + + if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) + { + int k = this.selectedMerchantRecipe; + + if (k < 0 || k >= merchantrecipelist.size()) + { + return; + } + + MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k); + + if (merchantrecipe.isRecipeDisabled()) + { + this.mc.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableLighting(); + this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 21, 212, 0, 28, 21); + this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 51, 212, 0, 28, 21); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + super.drawScreen(mouseX, mouseY, partialTicks); + MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.thePlayer); + + if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) + { + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + int k = this.selectedMerchantRecipe; + MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k); + ItemStack itemstack = merchantrecipe.getItemToBuy(); + ItemStack itemstack1 = merchantrecipe.getSecondItemToBuy(); + ItemStack itemstack2 = merchantrecipe.getItemToSell(); + GlStateManager.pushMatrix(); + RenderHelper.enableGUIStandardItemLighting(); + GlStateManager.disableLighting(); + GlStateManager.enableRescaleNormal(); + GlStateManager.enableColorMaterial(); + GlStateManager.enableLighting(); + this.itemRender.zLevel = 100.0F; + this.itemRender.renderItemAndEffectIntoGUI(itemstack, i + 36, j + 24); + this.itemRender.renderItemOverlays(this.fontRendererObj, itemstack, i + 36, j + 24); + + if (itemstack1 != null) + { + this.itemRender.renderItemAndEffectIntoGUI(itemstack1, i + 62, j + 24); + this.itemRender.renderItemOverlays(this.fontRendererObj, itemstack1, i + 62, j + 24); + } + + this.itemRender.renderItemAndEffectIntoGUI(itemstack2, i + 120, j + 24); + this.itemRender.renderItemOverlays(this.fontRendererObj, itemstack2, i + 120, j + 24); + this.itemRender.zLevel = 0.0F; + GlStateManager.disableLighting(); + + if (this.isPointInRegion(36, 24, 16, 16, mouseX, mouseY) && itemstack != null) + { + this.renderToolTip(itemstack, mouseX, mouseY); + } + else if (itemstack1 != null && this.isPointInRegion(62, 24, 16, 16, mouseX, mouseY) && itemstack1 != null) + { + this.renderToolTip(itemstack1, mouseX, mouseY); + } + else if (itemstack2 != null && this.isPointInRegion(120, 24, 16, 16, mouseX, mouseY) && itemstack2 != null) + { + this.renderToolTip(itemstack2, mouseX, mouseY); + } + else if (merchantrecipe.isRecipeDisabled() && (this.isPointInRegion(83, 21, 28, 21, mouseX, mouseY) || this.isPointInRegion(83, 51, 28, 21, mouseX, mouseY))) + { + this.drawCreativeTabHoveringText(I18n.format("merchant.deprecated", new Object[0]), mouseX, mouseY); + } + + GlStateManager.popMatrix(); + GlStateManager.enableLighting(); + GlStateManager.enableDepth(); + RenderHelper.enableStandardItemLighting(); + } + } + + public IMerchant getMerchant() + { + return this.merchant; + } + + static class MerchantButton extends GuiButton + { + private final boolean field_146157_o; + + public MerchantButton(int buttonID, int x, int y, boolean p_i1095_4_) + { + super(buttonID, x, y, 12, 19, ""); + this.field_146157_o = p_i1095_4_; + } + + public void drawButton(Minecraft mc, int mouseX, int mouseY) + { + if (this.visible) + { + mc.getTextureManager().bindTexture(GuiMerchant.MERCHANT_GUI_TEXTURE); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + int i = 0; + int j = 176; + + if (!this.enabled) + { + j += this.width * 2; + } + else if (flag) + { + j += this.width; + } + + if (!this.field_146157_o) + { + i += this.height; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, j, i, this.width, this.height); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiMultiplayer.java b/src/minecraft/net/minecraft/client/gui/GuiMultiplayer.java new file mode 100644 index 0000000..faea19e --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiMultiplayer.java @@ -0,0 +1,525 @@ +package net.minecraft.client.gui; + +import com.google.common.base.Splitter; +import com.google.common.collect.Lists; + +import animeware.DiscordRP; +import animeware.NightSky; +import animeware.ServerDataFeatured; +import animeware.cosmetic.Booleans; +import animeware.gui.clickgui.ClickGUI; +import animeware.util.backend.AntiCheat; +import animeware.util.misc.WebhookUtil; + +import java.io.IOException; +import java.util.List; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.GuiConnecting; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.multiplayer.ServerList; +import net.minecraft.client.network.LanServerDetector; +import net.minecraft.client.network.OldServerPinger; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.ResourceLocation; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Keyboard; + +public class GuiMultiplayer extends GuiScreen implements GuiYesNoCallback +{ + private static final Logger logger = LogManager.getLogger(); + private final OldServerPinger oldServerPinger = new OldServerPinger(); + protected GuiScreen parentScreen; + private ServerSelectionList serverListSelector; + private ServerList savedServerList; + private GuiButton btnEditServer; + private GuiButton btnSelectServer; + private GuiButton btnDeleteServer; + private boolean deletingServer; + private boolean addingServer; + private boolean editingServer; + private boolean directConnect; + + /** + * The text to be displayed when the player's cursor hovers over a server listing. + */ + private String hoveringText; + private ServerData selectedServer; + private LanServerDetector.LanServerList lanServerList; + private LanServerDetector.ThreadLanServerFind lanServerDetector; + private boolean initialized; + + public GuiMultiplayer(GuiScreen parentScreen) + { + this.parentScreen = parentScreen; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + NightSky.INSTANCE.getDiscordRP().update("Version: " + NightSky.INSTANCE.VERSION, "Multiplayer Menu"); + //this.mc.getTextureManager().bindTexture(new ResourceLocation("Animeware/background/old/bgblur.png")); + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + + if (!this.initialized) + { + this.initialized = true; + this.savedServerList = new ServerList(this.mc); + this.savedServerList.loadServerList(); + this.lanServerList = new LanServerDetector.LanServerList(); + + try + { + this.lanServerDetector = new LanServerDetector.ThreadLanServerFind(this.lanServerList); + this.lanServerDetector.start(); + } + catch (Exception exception) + { + logger.warn("Unable to start LAN server detection: " + exception.getMessage()); + } + + this.serverListSelector = new ServerSelectionList(this, this.mc, this.width, this.height, 32, this.height - 64, 36); + this.serverListSelector.func_148195_a(this.savedServerList); + } + else + { + this.serverListSelector.setDimensions(this.width, this.height, 32, this.height - 64); + } + + this.createButtons(); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + this.serverListSelector.handleMouseInput(); + } + + public void createButtons() + { + this.buttonList.add(this.btnEditServer = new GuiButton(7, this.width / 2 - 154, this.height - 28, 70, 20, I18n.format("selectServer.edit", new Object[0]))); + this.buttonList.add(this.btnDeleteServer = new GuiButton(2, this.width / 2 - 74, this.height - 28, 70, 20, I18n.format("selectServer.delete", new Object[0]))); + this.buttonList.add(this.btnSelectServer = new GuiButton(1, this.width / 2 - 154, this.height - 52, 100, 20, I18n.format("selectServer.select", new Object[0]))); + this.buttonList.add(new GuiButton(4, this.width / 2 - 50, this.height - 52, 100, 20, I18n.format("selectServer.direct", new Object[0]))); + this.buttonList.add(new GuiButton(3, this.width / 2 + 4 + 50, this.height - 52, 100, 20, I18n.format("selectServer.add", new Object[0]))); + this.buttonList.add(new GuiButton(8, this.width / 2 + 4, this.height - 28, 70, 20, I18n.format("selectServer.refresh", new Object[0]))); + this.buttonList.add(new GuiButton(0, this.width / 2 + 4 + 76, this.height - 28, 75, 20, I18n.format("gui.cancel", new Object[0]))); + this.selectServer(this.serverListSelector.func_148193_k()); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + + if (this.lanServerList.getWasUpdated()) + { + List list = this.lanServerList.getLanServers(); + this.lanServerList.setWasNotUpdated(); + this.serverListSelector.func_148194_a(list); + } + + this.oldServerPinger.pingPendingNetworks(); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + + if (this.lanServerDetector != null) + { + this.lanServerDetector.interrupt(); + this.lanServerDetector = null; + } + + this.oldServerPinger.clearPendingNetworks(); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + GuiListExtended.IGuiListEntry guilistextended$iguilistentry = this.serverListSelector.func_148193_k() < 0 ? null : this.serverListSelector.getListEntry(this.serverListSelector.func_148193_k()); + + if (button.id == 2 && guilistextended$iguilistentry instanceof ServerListEntryNormal) + { + String s4 = ((ServerListEntryNormal)guilistextended$iguilistentry).getServerData().serverName; + + if (s4 != null) + { + this.deletingServer = true; + String s = I18n.format("selectServer.deleteQuestion", new Object[0]); + String s1 = "\'" + s4 + "\' " + I18n.format("selectServer.deleteWarning", new Object[0]); + String s2 = I18n.format("selectServer.deleteButton", new Object[0]); + String s3 = I18n.format("gui.cancel", new Object[0]); + GuiYesNo guiyesno = new GuiYesNo(this, s, s1, s2, s3, this.serverListSelector.func_148193_k()); + this.mc.displayGuiScreen(guiyesno); + } + } + else if (button.id == 1) + { + this.connectToSelected(); + if(AntiCheat.checkVape() == true) { + Booleans.ban = true; + System.out.println("Banned!"); + mc.displayGuiScreen(new GuiMultiplayer(null)); + + } + } + else if (button.id == 4) + { + this.directConnect = true; + if(AntiCheat.checkVape() == true) { + Booleans.ban = true; + System.out.println("Banned!"); + mc.displayGuiScreen(new GuiMultiplayer(null)); + + } else { + this.mc.displayGuiScreen(new GuiScreenServerList(this, this.selectedServer = new ServerData(I18n.format("selectServer.defaultName", new Object[0]), "", false))); + } + + } + else if (button.id == 3) + { + this.addingServer = true; + this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.selectedServer = new ServerData(I18n.format("selectServer.defaultName", new Object[0]), "", false))); + } + else if (button.id == 7 && guilistextended$iguilistentry instanceof ServerListEntryNormal) + { + this.editingServer = true; + ServerData serverdata = ((ServerListEntryNormal)guilistextended$iguilistentry).getServerData(); + this.selectedServer = new ServerData(serverdata.serverName, serverdata.serverIP, false); + this.selectedServer.copyFrom(serverdata); + this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.selectedServer)); + } + else if (button.id == 0) + { + this.mc.displayGuiScreen(this.parentScreen); + } + else if (button.id == 8) + { + this.refreshServerList(); + } + } + } + + private void refreshServerList() + { + this.mc.displayGuiScreen(new GuiMultiplayer(this.parentScreen)); + } + + public void confirmClicked(boolean result, int id) + { + GuiListExtended.IGuiListEntry guilistextended$iguilistentry = this.serverListSelector.func_148193_k() < 0 ? null : this.serverListSelector.getListEntry(this.serverListSelector.func_148193_k()); + + if (this.deletingServer) + { + this.deletingServer = false; + + if (result && guilistextended$iguilistentry instanceof ServerListEntryNormal) + { + this.savedServerList.removeServerData(this.serverListSelector.func_148193_k()); + this.savedServerList.saveServerList(); + this.serverListSelector.setSelectedSlotIndex(-1); + this.serverListSelector.func_148195_a(this.savedServerList); + } + + this.mc.displayGuiScreen(this); + } + else if (this.directConnect) + { + this.directConnect = false; + + if (result) + { + this.connectToServer(this.selectedServer); + } + else + { + this.mc.displayGuiScreen(this); + } + } + else if (this.addingServer) + { + this.addingServer = false; + + if (result) + { + this.savedServerList.addServerData(this.selectedServer); + this.savedServerList.saveServerList(); + this.serverListSelector.setSelectedSlotIndex(-1); + this.serverListSelector.func_148195_a(this.savedServerList); + } + + this.mc.displayGuiScreen(this); + } + else if (this.editingServer) + { + this.editingServer = false; + + if (result && guilistextended$iguilistentry instanceof ServerListEntryNormal) + { + ServerData serverdata = ((ServerListEntryNormal)guilistextended$iguilistentry).getServerData(); + serverdata.serverName = this.selectedServer.serverName; + serverdata.serverIP = this.selectedServer.serverIP; + serverdata.copyFrom(this.selectedServer); + this.savedServerList.saveServerList(); + this.serverListSelector.func_148195_a(this.savedServerList); + } + + this.mc.displayGuiScreen(this); + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + int i = this.serverListSelector.func_148193_k(); + GuiListExtended.IGuiListEntry guilistextended$iguilistentry = i < 0 ? null : this.serverListSelector.getListEntry(i); + + if (keyCode == 63) + { + this.refreshServerList(); + } + else + { + if (i >= 0) + { + if (keyCode == 200) + { + if (isShiftKeyDown()) + { + if (i > 0 && guilistextended$iguilistentry instanceof ServerListEntryNormal) + { + this.savedServerList.swapServers(i, i - 1); + this.selectServer(this.serverListSelector.func_148193_k() - 1); + this.serverListSelector.scrollBy(-this.serverListSelector.getSlotHeight()); + this.serverListSelector.func_148195_a(this.savedServerList); + } + } + else if (i > 0) + { + this.selectServer(this.serverListSelector.func_148193_k() - 1); + this.serverListSelector.scrollBy(-this.serverListSelector.getSlotHeight()); + + if (this.serverListSelector.getListEntry(this.serverListSelector.func_148193_k()) instanceof ServerListEntryLanScan) + { + if (this.serverListSelector.func_148193_k() > 0) + { + this.selectServer(this.serverListSelector.getSize() - 1); + this.serverListSelector.scrollBy(-this.serverListSelector.getSlotHeight()); + } + else + { + this.selectServer(-1); + } + } + } + else + { + this.selectServer(-1); + } + } + else if (keyCode == 208) + { + if (isShiftKeyDown()) + { + if (i < this.savedServerList.countServers() - 1) + { + this.savedServerList.swapServers(i, i + 1); + this.selectServer(i + 1); + this.serverListSelector.scrollBy(this.serverListSelector.getSlotHeight()); + this.serverListSelector.func_148195_a(this.savedServerList); + } + } + else if (i < this.serverListSelector.getSize()) + { + this.selectServer(this.serverListSelector.func_148193_k() + 1); + this.serverListSelector.scrollBy(this.serverListSelector.getSlotHeight()); + + if (this.serverListSelector.getListEntry(this.serverListSelector.func_148193_k()) instanceof ServerListEntryLanScan) + { + if (this.serverListSelector.func_148193_k() < this.serverListSelector.getSize() - 1) + { + this.selectServer(this.serverListSelector.getSize() + 1); + this.serverListSelector.scrollBy(this.serverListSelector.getSlotHeight()); + } + else + { + this.selectServer(-1); + } + } + } + else + { + this.selectServer(-1); + } + } + else if (keyCode != 28 && keyCode != 156) + { + super.keyTyped(typedChar, keyCode); + } + else + { + this.actionPerformed((GuiButton)this.buttonList.get(2)); + } + } + else + { + super.keyTyped(typedChar, keyCode); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + //this.mc.getTextureManager().bindTexture(new ResourceLocation("Animeware/background/old/bgblur.png")); + this.hoveringText = null; + this.drawBackground(0); + this.serverListSelector.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.fontRendererObj, I18n.format("multiplayer.title", new Object[0]), this.width / 2, 20, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + + if (this.hoveringText != null) + { + this.drawHoveringText(Lists.newArrayList(Splitter.on("\n").split(this.hoveringText)), mouseX, mouseY); + } + } + + public void connectToSelected() + { + GuiListExtended.IGuiListEntry guilistextended$iguilistentry = this.serverListSelector.func_148193_k() < 0 ? null : this.serverListSelector.getListEntry(this.serverListSelector.func_148193_k()); + + if (guilistextended$iguilistentry instanceof ServerListEntryNormal) + { + this.connectToServer(((ServerListEntryNormal)guilistextended$iguilistentry).getServerData()); + } + else if (guilistextended$iguilistentry instanceof ServerListEntryLanDetected) + { + LanServerDetector.LanServer lanserverdetector$lanserver = ((ServerListEntryLanDetected)guilistextended$iguilistentry).getLanServer(); + this.connectToServer(new ServerData(lanserverdetector$lanserver.getServerMotd(), lanserverdetector$lanserver.getServerIpPort(), true)); + } + } + + private void connectToServer(ServerData server) + { + this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, server)); + } + + public void selectServer(int index) + { + this.serverListSelector.setSelectedSlotIndex(index); + GuiListExtended.IGuiListEntry guilistextended$iguilistentry = index < 0 ? null : this.serverListSelector.getListEntry(index); + this.btnSelectServer.enabled = false; + this.btnEditServer.enabled = false; + this.btnDeleteServer.enabled = false; + + if (guilistextended$iguilistentry != null && !(guilistextended$iguilistentry instanceof ServerListEntryLanScan)) + { + this.btnSelectServer.enabled = true; + + if (guilistextended$iguilistentry instanceof ServerListEntryNormal) + { + this.btnEditServer.enabled = true; + this.btnDeleteServer.enabled = true; + } + + if(savedServerList.getServerData(index) instanceof ServerDataFeatured) { + this.btnEditServer.enabled = false; + this.btnDeleteServer.enabled = false; + } + } + } + + public OldServerPinger getOldServerPinger() + { + return this.oldServerPinger; + } + + public void setHoveringText(String p_146793_1_) + { + this.hoveringText = p_146793_1_; + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + super.mouseClicked(mouseX, mouseY, mouseButton); + this.serverListSelector.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Called when a mouse button is released. Args : mouseX, mouseY, releaseButton + */ + protected void mouseReleased(int mouseX, int mouseY, int state) + { + super.mouseReleased(mouseX, mouseY, state); + this.serverListSelector.mouseReleased(mouseX, mouseY, state); + } + + public ServerList getServerList() + { + return this.savedServerList; + } + + public boolean func_175392_a(ServerListEntryNormal p_175392_1_, int p_175392_2_) + { + return p_175392_2_ > this.savedServerList.getFeaturedServerCount(); + } + + public boolean func_175394_b(ServerListEntryNormal p_175394_1_, int p_175394_2_) + { + return p_175394_2_ < this.savedServerList.countServers() - 1; + } + + public void func_175391_a(ServerListEntryNormal p_175391_1_, int p_175391_2_, boolean p_175391_3_) + { + int i = p_175391_3_ ? 0 : p_175391_2_ - 1; + this.savedServerList.swapServers(p_175391_2_, i); + + if (this.serverListSelector.func_148193_k() == p_175391_2_) + { + this.selectServer(i); + } + + this.serverListSelector.func_148195_a(this.savedServerList); + } + + public void func_175393_b(ServerListEntryNormal p_175393_1_, int p_175393_2_, boolean p_175393_3_) + { + int i = p_175393_3_ ? this.savedServerList.countServers() - 1 : p_175393_2_ + 1; + this.savedServerList.swapServers(p_175393_2_, i); + + if (this.serverListSelector.func_148193_k() == p_175393_2_) + { + this.selectServer(i); + } + + this.serverListSelector.func_148195_a(this.savedServerList); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiNewChat.java b/src/minecraft/net/minecraft/client/gui/GuiNewChat.java new file mode 100644 index 0000000..4762ffa --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiNewChat.java @@ -0,0 +1,385 @@ +package net.minecraft.client.gui; + +import java.util.Iterator; +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import com.google.common.collect.Lists; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; + +public class GuiNewChat extends Gui +{ + private static final Logger logger = LogManager.getLogger(); + private final Minecraft mc; + private final List sentMessages = Lists.newArrayList(); + private final List chatLines = Lists.newArrayList(); + private final List field_146253_i = Lists.newArrayList(); + private int scrollPos; + private boolean isScrolled; + + public GuiNewChat(Minecraft mcIn) + { + this.mc = mcIn; + } + + public void drawChat(int p_146230_1_) + { + if (this.mc.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN) + { + int i = this.getLineCount(); + boolean flag = false; + int j = 0; + int k = this.field_146253_i.size(); + float f = this.mc.gameSettings.chatOpacity * 0.9F + 0.1F; + + if (k > 0) + { + if (this.getChatOpen()) + { + flag = true; + } + + float f1 = this.getChatScale(); + int l = MathHelper.ceiling_float_int((float)this.getChatWidth() / f1); + GlStateManager.pushMatrix(); + GlStateManager.translate(2.0F, 20.0F, 0.0F); + GlStateManager.scale(f1, f1, 1.0F); + + for (int i1 = 0; i1 + this.scrollPos < this.field_146253_i.size() && i1 < i; ++i1) + { + ChatLine chatline = (ChatLine)this.field_146253_i.get(i1 + this.scrollPos); + + if (chatline != null) + { + int j1 = p_146230_1_ - chatline.getUpdatedCounter(); + + if (j1 < 200 || flag) + { + double d0 = (double)j1 / 200.0D; + d0 = 1.0D - d0; + d0 = d0 * 10.0D; + d0 = MathHelper.clamp_double(d0, 0.0D, 1.0D); + d0 = d0 * d0; + int l1 = (int)(255.0D * d0); + + if (flag) + { + l1 = 255; + } + + l1 = (int)((float)l1 * f); + ++j; + + if (l1 > 3) + { + int i2 = 0; + int j2 = -i1 * 9; + drawRect(i2, j2 - 9, i2 + l + 4, j2, l1 / 2 << 24); + String s = chatline.getChatComponent().getFormattedText(); + GlStateManager.enableBlend(); + this.mc.fontRendererObj.drawStringWithShadow(s, (float)i2, (float)(j2 - 8), 16777215 + (l1 << 24)); + GlStateManager.disableAlpha(); + GlStateManager.disableBlend(); + } + } + } + } + + if (flag) + { + int k2 = this.mc.fontRendererObj.FONT_HEIGHT; + GlStateManager.translate(-3.0F, 0.0F, 0.0F); + int l2 = k * k2 + k; + int i3 = j * k2 + j; + int j3 = this.scrollPos * i3 / k; + int k1 = i3 * i3 / l2; + + if (l2 != i3) + { + int k3 = j3 > 0 ? 170 : 96; + int l3 = this.isScrolled ? 13382451 : 3355562; + drawRect(0, -j3, 2, -j3 - k1, l3 + (k3 << 24)); + drawRect(2, -j3, 1, -j3 - k1, 13421772 + (k3 << 24)); + } + } + + GlStateManager.popMatrix(); + } + } + } + + /** + * Clears the chat. + */ + public void clearChatMessages() + { + this.field_146253_i.clear(); + this.chatLines.clear(); + this.sentMessages.clear(); + } + + public void printChatMessage(IChatComponent p_146227_1_) + { + this.printChatMessageWithOptionalDeletion(p_146227_1_, 0); + } + + /** + * prints the ChatComponent to Chat. If the ID is not 0, deletes an existing Chat Line of that ID from the GUI + */ + public void printChatMessageWithOptionalDeletion(IChatComponent p_146234_1_, int p_146234_2_) + { + this.setChatLine(p_146234_1_, p_146234_2_, this.mc.ingameGUI.getUpdateCounter(), false); + logger.info("[CHAT] " + p_146234_1_.getUnformattedText()); + } + /*public void printChatMessageWithOptionalDeletion(IChatComponent p_146234_1_, int p_146234_2_) + { + IChatComponent message = p_146234_1_; + if(Animeware.nickhider && message.getFormattedText().contains(mc.thePlayer.getNameClear())) { + String msg = message.getFormattedText().replaceAll(mc.thePlayer.getNameClear(), NickHider.getPlayerName()); + message = new ChatComponentText(msg); + } else { + this.setChatLine(message, p_146234_2_, this.mc.ingameGUI.getUpdateCounter(), false); + logger.info("[CHAT] " + message.getUnformattedText()); + } + }*/ + + + private void setChatLine(IChatComponent p_146237_1_, int p_146237_2_, int p_146237_3_, boolean p_146237_4_) + { + if (p_146237_2_ != 0) + { + this.deleteChatLine(p_146237_2_); + } + + int i = MathHelper.floor_float((float)this.getChatWidth() / this.getChatScale()); + List list = GuiUtilRenderComponents.func_178908_a(p_146237_1_, i, this.mc.fontRendererObj, false, false); + boolean flag = this.getChatOpen(); + + for (IChatComponent ichatcomponent : list) + { + if (flag && this.scrollPos > 0) + { + this.isScrolled = true; + this.scroll(1); + } + + this.field_146253_i.add(0, new ChatLine(p_146237_3_, ichatcomponent, p_146237_2_)); + } + + while (this.field_146253_i.size() > 100) + { + this.field_146253_i.remove(this.field_146253_i.size() - 1); + } + + if (!p_146237_4_) + { + this.chatLines.add(0, new ChatLine(p_146237_3_, p_146237_1_, p_146237_2_)); + + while (this.chatLines.size() > 100) + { + this.chatLines.remove(this.chatLines.size() - 1); + } + } + } + + public void refreshChat() + { + this.field_146253_i.clear(); + this.resetScroll(); + + for (int i = this.chatLines.size() - 1; i >= 0; --i) + { + ChatLine chatline = (ChatLine)this.chatLines.get(i); + this.setChatLine(chatline.getChatComponent(), chatline.getChatLineID(), chatline.getUpdatedCounter(), true); + } + } + + public List getSentMessages() + { + return this.sentMessages; + } + + /** + * Adds this string to the list of sent messages, for recall using the up/down arrow keys + */ + public void addToSentMessages(String p_146239_1_) + { + if (this.sentMessages.isEmpty() || !((String)this.sentMessages.get(this.sentMessages.size() - 1)).equals(p_146239_1_)) + { + this.sentMessages.add(p_146239_1_); + } + } + + /** + * Resets the chat scroll (executed when the GUI is closed, among others) + */ + public void resetScroll() + { + this.scrollPos = 0; + this.isScrolled = false; + } + + /** + * Scrolls the chat by the given number of lines. + */ + public void scroll(int p_146229_1_) + { + this.scrollPos += p_146229_1_; + int i = this.field_146253_i.size(); + + if (this.scrollPos > i - this.getLineCount()) + { + this.scrollPos = i - this.getLineCount(); + } + + if (this.scrollPos <= 0) + { + this.scrollPos = 0; + this.isScrolled = false; + } + } + + /** + * Gets the chat component under the mouse + */ + public IChatComponent getChatComponent(int p_146236_1_, int p_146236_2_) + { + if (!this.getChatOpen()) + { + return null; + } + else + { + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + int i = scaledresolution.getScaleFactor(); + float f = this.getChatScale(); + int j = p_146236_1_ / i - 3; + int k = p_146236_2_ / i - 27; + j = MathHelper.floor_float((float)j / f); + k = MathHelper.floor_float((float)k / f); + + if (j >= 0 && k >= 0) + { + int l = Math.min(this.getLineCount(), this.field_146253_i.size()); + + if (j <= MathHelper.floor_float((float)this.getChatWidth() / this.getChatScale()) && k < this.mc.fontRendererObj.FONT_HEIGHT * l + l) + { + int i1 = k / this.mc.fontRendererObj.FONT_HEIGHT + this.scrollPos; + + if (i1 >= 0 && i1 < this.field_146253_i.size()) + { + ChatLine chatline = (ChatLine)this.field_146253_i.get(i1); + int j1 = 0; + + for (IChatComponent ichatcomponent : chatline.getChatComponent()) + { + if (ichatcomponent instanceof ChatComponentText) + { + j1 += this.mc.fontRendererObj.getStringWidth(GuiUtilRenderComponents.func_178909_a(((ChatComponentText)ichatcomponent).getChatComponentText_TextValue(), false)); + + if (j1 > j) + { + return ichatcomponent; + } + } + } + } + + return null; + } + else + { + return null; + } + } + else + { + return null; + } + } + } + + /** + * Returns true if the chat GUI is open + */ + public boolean getChatOpen() + { + return this.mc.currentScreen instanceof GuiChat; + } + + /** + * finds and deletes a Chat line by ID + */ + public void deleteChatLine(int p_146242_1_) + { + Iterator iterator = this.field_146253_i.iterator(); + + while (iterator.hasNext()) + { + ChatLine chatline = (ChatLine)iterator.next(); + + if (chatline.getChatLineID() == p_146242_1_) + { + iterator.remove(); + } + } + + iterator = this.chatLines.iterator(); + + while (iterator.hasNext()) + { + ChatLine chatline1 = (ChatLine)iterator.next(); + + if (chatline1.getChatLineID() == p_146242_1_) + { + iterator.remove(); + break; + } + } + } + + public int getChatWidth() + { + return calculateChatboxWidth(this.mc.gameSettings.chatWidth); + } + + public int getChatHeight() + { + return calculateChatboxHeight(this.getChatOpen() ? this.mc.gameSettings.chatHeightFocused : this.mc.gameSettings.chatHeightUnfocused); + } + + /** + * Returns the chatscale from mc.gameSettings.chatScale + */ + public float getChatScale() + { + return this.mc.gameSettings.chatScale; + } + + public static int calculateChatboxWidth(float p_146233_0_) + { + int i = 320; + int j = 40; + return MathHelper.floor_float(p_146233_0_ * (float)(i - j) + (float)j); + } + + public static int calculateChatboxHeight(float p_146243_0_) + { + int i = 180; + int j = 20; + return MathHelper.floor_float(p_146243_0_ * (float)(i - j) + (float)j); + } + + public int getLineCount() + { + return this.getChatHeight() / 9; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiOptionButton.java b/src/minecraft/net/minecraft/client/gui/GuiOptionButton.java new file mode 100644 index 0000000..9f03da5 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiOptionButton.java @@ -0,0 +1,30 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.settings.GameSettings; + +public class GuiOptionButton extends GuiButton +{ + private final GameSettings.Options enumOptions; + + public GuiOptionButton(int p_i45011_1_, int p_i45011_2_, int p_i45011_3_, String p_i45011_4_) + { + this(p_i45011_1_, p_i45011_2_, p_i45011_3_, (GameSettings.Options)null, p_i45011_4_); + } + + public GuiOptionButton(int p_i45012_1_, int p_i45012_2_, int p_i45012_3_, int p_i45012_4_, int p_i45012_5_, String p_i45012_6_) + { + super(p_i45012_1_, p_i45012_2_, p_i45012_3_, p_i45012_4_, p_i45012_5_, p_i45012_6_); + this.enumOptions = null; + } + + public GuiOptionButton(int p_i45013_1_, int p_i45013_2_, int p_i45013_3_, GameSettings.Options p_i45013_4_, String p_i45013_5_) + { + super(p_i45013_1_, p_i45013_2_, p_i45013_3_, 150, 20, p_i45013_5_); + this.enumOptions = p_i45013_4_; + } + + public GameSettings.Options returnEnumOptions() + { + return this.enumOptions; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiOptionSlider.java b/src/minecraft/net/minecraft/client/gui/GuiOptionSlider.java new file mode 100644 index 0000000..772d542 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiOptionSlider.java @@ -0,0 +1,94 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.util.MathHelper; + +public class GuiOptionSlider extends GuiButton +{ + private float sliderValue; + public boolean dragging; + private GameSettings.Options options; + private final float field_146132_r; + private final float field_146131_s; + + public GuiOptionSlider(int p_i45016_1_, int p_i45016_2_, int p_i45016_3_, GameSettings.Options p_i45016_4_) + { + this(p_i45016_1_, p_i45016_2_, p_i45016_3_, p_i45016_4_, 0.0F, 1.0F); + } + + public GuiOptionSlider(int p_i45017_1_, int p_i45017_2_, int p_i45017_3_, GameSettings.Options p_i45017_4_, float p_i45017_5_, float p_i45017_6_) + { + super(p_i45017_1_, p_i45017_2_, p_i45017_3_, 150, 20, ""); + this.sliderValue = 1.0F; + this.options = p_i45017_4_; + this.field_146132_r = p_i45017_5_; + this.field_146131_s = p_i45017_6_; + Minecraft minecraft = Minecraft.getMinecraft(); + this.sliderValue = p_i45017_4_.normalizeValue(minecraft.gameSettings.getOptionFloatValue(p_i45017_4_)); + this.displayString = minecraft.gameSettings.getKeyBinding(p_i45017_4_); + } + + /** + * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over + * this button. + */ + protected int getHoverState(boolean mouseOver) + { + return 0; + } + + /** + * Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e). + */ + protected void mouseDragged(Minecraft mc, int mouseX, int mouseY) + { + if (this.visible) + { + if (this.dragging) + { + this.sliderValue = (float)(mouseX - (this.xPosition + 4)) / (float)(this.width - 8); + this.sliderValue = MathHelper.clamp_float(this.sliderValue, 0.0F, 1.0F); + float f = this.options.denormalizeValue(this.sliderValue); + mc.gameSettings.setOptionFloatValue(this.options, f); + this.sliderValue = this.options.normalizeValue(f); + this.displayString = mc.gameSettings.getKeyBinding(this.options); + } + + mc.getTextureManager().bindTexture(buttonTextures); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.xPosition + (int)(this.sliderValue * (float)(this.width - 8)), this.yPosition, 0, 66, 4, 20); + this.drawTexturedModalRect(this.xPosition + (int)(this.sliderValue * (float)(this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20); + } + } + + /** + * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent + * e). + */ + public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) + { + if (super.mousePressed(mc, mouseX, mouseY)) + { + this.sliderValue = (float)(mouseX - (this.xPosition + 4)) / (float)(this.width - 8); + this.sliderValue = MathHelper.clamp_float(this.sliderValue, 0.0F, 1.0F); + mc.gameSettings.setOptionFloatValue(this.options, this.options.denormalizeValue(this.sliderValue)); + this.displayString = mc.gameSettings.getKeyBinding(this.options); + this.dragging = true; + return true; + } + else + { + return false; + } + } + + /** + * Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e). + */ + public void mouseReleased(int mouseX, int mouseY) + { + this.dragging = false; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiOptions.java b/src/minecraft/net/minecraft/client/gui/GuiOptions.java new file mode 100644 index 0000000..cefdfbf --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiOptions.java @@ -0,0 +1,236 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.audio.SoundCategory; +import net.minecraft.client.audio.SoundEventAccessorComposite; +import net.minecraft.client.audio.SoundHandler; +import net.minecraft.client.gui.stream.GuiStreamOptions; +import net.minecraft.client.gui.stream.GuiStreamUnavailable; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.stream.IStream; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.EnumDifficulty; + +public class GuiOptions extends GuiScreen implements GuiYesNoCallback +{ + private static final GameSettings.Options[] field_146440_f = new GameSettings.Options[] {GameSettings.Options.FOV}; + private final GuiScreen field_146441_g; + + /** Reference to the GameSettings object. */ + private final GameSettings game_settings_1; + private GuiButton field_175357_i; + private GuiLockIconButton field_175356_r; + protected String field_146442_a = "Options"; + + public GuiOptions(GuiScreen p_i1046_1_, GameSettings p_i1046_2_) + { + this.field_146441_g = p_i1046_1_; + this.game_settings_1 = p_i1046_2_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + int i = 0; + this.field_146442_a = I18n.format("options.title", new Object[0]); + + for (GameSettings.Options gamesettings$options : field_146440_f) + { + if (gamesettings$options.getEnumFloat()) + { + this.buttonList.add(new GuiOptionSlider(gamesettings$options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), gamesettings$options)); + } + else + { + GuiOptionButton guioptionbutton = new GuiOptionButton(gamesettings$options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), gamesettings$options, this.game_settings_1.getKeyBinding(gamesettings$options)); + this.buttonList.add(guioptionbutton); + } + + ++i; + } + + if (this.mc.theWorld != null) + { + EnumDifficulty enumdifficulty = this.mc.theWorld.getDifficulty(); + this.field_175357_i = new GuiButton(108, this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), 150, 20, this.func_175355_a(enumdifficulty)); + this.buttonList.add(this.field_175357_i); + + if (this.mc.isSingleplayer() && !this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) + { + this.field_175357_i.setWidth(this.field_175357_i.getButtonWidth() - 20); + this.field_175356_r = new GuiLockIconButton(109, this.field_175357_i.xPosition + this.field_175357_i.getButtonWidth(), this.field_175357_i.yPosition); + this.buttonList.add(this.field_175356_r); + this.field_175356_r.func_175229_b(this.mc.theWorld.getWorldInfo().isDifficultyLocked()); + this.field_175356_r.enabled = !this.field_175356_r.func_175230_c(); + this.field_175357_i.enabled = !this.field_175356_r.func_175230_c(); + } + else + { + this.field_175357_i.enabled = false; + } + } + + this.buttonList.add(new GuiButton(110, this.width / 2 - 155, this.height / 6 + 48 - 6, 150, 20, I18n.format("options.skinCustomisation", new Object[0]))); + this.buttonList.add(new GuiButton(8675309, this.width / 2 + 5, this.height / 6 + 48 - 6, 150, 20, "Super Secret Settings...") + { + public void playPressSound(SoundHandler soundHandlerIn) + { + SoundEventAccessorComposite soundeventaccessorcomposite = soundHandlerIn.getRandomSoundFromCategories(new SoundCategory[] {SoundCategory.ANIMALS, SoundCategory.BLOCKS, SoundCategory.MOBS, SoundCategory.PLAYERS, SoundCategory.WEATHER}); + + if (soundeventaccessorcomposite != null) + { + soundHandlerIn.playSound(PositionedSoundRecord.create(soundeventaccessorcomposite.getSoundEventLocation(), 0.5F)); + } + } + }); + this.buttonList.add(new GuiButton(106, this.width / 2 - 155, this.height / 6 + 72 - 6, 150, 20, I18n.format("options.sounds", new Object[0]))); + this.buttonList.add(new GuiButton(107, this.width / 2 + 5, this.height / 6 + 72 - 6, 150, 20, I18n.format("options.stream", new Object[0]))); + this.buttonList.add(new GuiButton(101, this.width / 2 - 155, this.height / 6 + 96 - 6, 150, 20, I18n.format("options.video", new Object[0]))); + this.buttonList.add(new GuiButton(100, this.width / 2 + 5, this.height / 6 + 96 - 6, 150, 20, I18n.format("options.controls", new Object[0]))); + this.buttonList.add(new GuiButton(102, this.width / 2 - 155, this.height / 6 + 120 - 6, 150, 20, I18n.format("options.language", new Object[0]))); + this.buttonList.add(new GuiButton(103, this.width / 2 + 5, this.height / 6 + 120 - 6, 150, 20, I18n.format("options.chat.title", new Object[0]))); + this.buttonList.add(new GuiButton(105, this.width / 2 - 155, this.height / 6 + 144 - 6, 150, 20, I18n.format("options.resourcepack", new Object[0]))); + this.buttonList.add(new GuiButton(104, this.width / 2 + 5, this.height / 6 + 144 - 6, 150, 20, I18n.format("options.snooper.view", new Object[0]))); + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0]))); + } + + public String func_175355_a(EnumDifficulty p_175355_1_) + { + IChatComponent ichatcomponent = new ChatComponentText(""); + ichatcomponent.appendSibling(new ChatComponentTranslation("options.difficulty", new Object[0])); + ichatcomponent.appendText(": "); + ichatcomponent.appendSibling(new ChatComponentTranslation(p_175355_1_.getDifficultyResourceKey(), new Object[0])); + return ichatcomponent.getFormattedText(); + } + + public void confirmClicked(boolean result, int id) + { + this.mc.displayGuiScreen(this); + + if (id == 109 && result && this.mc.theWorld != null) + { + this.mc.theWorld.getWorldInfo().setDifficultyLocked(true); + this.field_175356_r.func_175229_b(true); + this.field_175356_r.enabled = false; + this.field_175357_i.enabled = false; + } + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id < 100 && button instanceof GuiOptionButton) + { + GameSettings.Options gamesettings$options = ((GuiOptionButton)button).returnEnumOptions(); + this.game_settings_1.setOptionValue(gamesettings$options, 1); + button.displayString = this.game_settings_1.getKeyBinding(GameSettings.Options.getEnumOptions(button.id)); + } + + if (button.id == 108) + { + this.mc.theWorld.getWorldInfo().setDifficulty(EnumDifficulty.getDifficultyEnum(this.mc.theWorld.getDifficulty().getDifficultyId() + 1)); + this.field_175357_i.displayString = this.func_175355_a(this.mc.theWorld.getDifficulty()); + } + + if (button.id == 109) + { + this.mc.displayGuiScreen(new GuiYesNo(this, (new ChatComponentTranslation("difficulty.lock.title", new Object[0])).getFormattedText(), (new ChatComponentTranslation("difficulty.lock.question", new Object[] {new ChatComponentTranslation(this.mc.theWorld.getWorldInfo().getDifficulty().getDifficultyResourceKey(), new Object[0])})).getFormattedText(), 109)); + } + + if (button.id == 110) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiCustomizeSkin(this)); + } + + if (button.id == 8675309) + { + this.mc.entityRenderer.activateNextShader(); + } + + if (button.id == 101) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiVideoSettings(this, this.game_settings_1)); + } + + if (button.id == 100) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiControls(this, this.game_settings_1)); + } + + if (button.id == 102) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiLanguage(this, this.game_settings_1, this.mc.getLanguageManager())); + } + + if (button.id == 103) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new ScreenChatOptions(this, this.game_settings_1)); + } + + if (button.id == 104) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiSnooper(this, this.game_settings_1)); + } + + if (button.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.field_146441_g); + } + + if (button.id == 105) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiScreenResourcePacks(this)); + } + + if (button.id == 106) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiScreenOptionsSounds(this, this.game_settings_1)); + } + + if (button.id == 107) + { + this.mc.gameSettings.saveOptions(); + IStream istream = this.mc.getTwitchStream(); + + if (istream.func_152936_l() && istream.func_152928_D()) + { + this.mc.displayGuiScreen(new GuiStreamOptions(this, this.game_settings_1)); + } + else + { + GuiStreamUnavailable.func_152321_a(this); + } + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.field_146442_a, this.width / 2, 15, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiOptionsRowList.java b/src/minecraft/net/minecraft/client/gui/GuiOptionsRowList.java new file mode 100644 index 0000000..ff46724 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiOptionsRowList.java @@ -0,0 +1,138 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.GameSettings; + +public class GuiOptionsRowList extends GuiListExtended +{ + private final List field_148184_k = Lists.newArrayList(); + + public GuiOptionsRowList(Minecraft mcIn, int p_i45015_2_, int p_i45015_3_, int p_i45015_4_, int p_i45015_5_, int p_i45015_6_, GameSettings.Options... p_i45015_7_) + { + super(mcIn, p_i45015_2_, p_i45015_3_, p_i45015_4_, p_i45015_5_, p_i45015_6_); + this.field_148163_i = false; + + for (int i = 0; i < p_i45015_7_.length; i += 2) + { + GameSettings.Options gamesettings$options = p_i45015_7_[i]; + GameSettings.Options gamesettings$options1 = i < p_i45015_7_.length - 1 ? p_i45015_7_[i + 1] : null; + GuiButton guibutton = this.func_148182_a(mcIn, p_i45015_2_ / 2 - 155, 0, gamesettings$options); + GuiButton guibutton1 = this.func_148182_a(mcIn, p_i45015_2_ / 2 - 155 + 160, 0, gamesettings$options1); + this.field_148184_k.add(new GuiOptionsRowList.Row(guibutton, guibutton1)); + } + } + + private GuiButton func_148182_a(Minecraft mcIn, int p_148182_2_, int p_148182_3_, GameSettings.Options p_148182_4_) + { + if (p_148182_4_ == null) + { + return null; + } + else + { + int i = p_148182_4_.returnEnumOrdinal(); + return (GuiButton)(p_148182_4_.getEnumFloat() ? new GuiOptionSlider(i, p_148182_2_, p_148182_3_, p_148182_4_) : new GuiOptionButton(i, p_148182_2_, p_148182_3_, p_148182_4_, mcIn.gameSettings.getKeyBinding(p_148182_4_))); + } + } + + /** + * Gets the IGuiListEntry object for the given index + */ + public GuiOptionsRowList.Row getListEntry(int index) + { + return (GuiOptionsRowList.Row)this.field_148184_k.get(index); + } + + protected int getSize() + { + return this.field_148184_k.size(); + } + + /** + * Gets the width of the list + */ + public int getListWidth() + { + return 400; + } + + protected int getScrollBarX() + { + return super.getScrollBarX() + 32; + } + + public static class Row implements GuiListExtended.IGuiListEntry + { + private final Minecraft field_148325_a = Minecraft.getMinecraft(); + private final GuiButton field_148323_b; + private final GuiButton field_148324_c; + + public Row(GuiButton p_i45014_1_, GuiButton p_i45014_2_) + { + this.field_148323_b = p_i45014_1_; + this.field_148324_c = p_i45014_2_; + } + + public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) + { + if (this.field_148323_b != null) + { + this.field_148323_b.yPosition = y; + this.field_148323_b.drawButton(this.field_148325_a, mouseX, mouseY); + } + + if (this.field_148324_c != null) + { + this.field_148324_c.yPosition = y; + this.field_148324_c.drawButton(this.field_148325_a, mouseX, mouseY); + } + } + + public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_) + { + if (this.field_148323_b.mousePressed(this.field_148325_a, p_148278_2_, p_148278_3_)) + { + if (this.field_148323_b instanceof GuiOptionButton) + { + this.field_148325_a.gameSettings.setOptionValue(((GuiOptionButton)this.field_148323_b).returnEnumOptions(), 1); + this.field_148323_b.displayString = this.field_148325_a.gameSettings.getKeyBinding(GameSettings.Options.getEnumOptions(this.field_148323_b.id)); + } + + return true; + } + else if (this.field_148324_c != null && this.field_148324_c.mousePressed(this.field_148325_a, p_148278_2_, p_148278_3_)) + { + if (this.field_148324_c instanceof GuiOptionButton) + { + this.field_148325_a.gameSettings.setOptionValue(((GuiOptionButton)this.field_148324_c).returnEnumOptions(), 1); + this.field_148324_c.displayString = this.field_148325_a.gameSettings.getKeyBinding(GameSettings.Options.getEnumOptions(this.field_148324_c.id)); + } + + return true; + } + else + { + return false; + } + } + + public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) + { + if (this.field_148323_b != null) + { + this.field_148323_b.mouseReleased(x, y); + } + + if (this.field_148324_c != null) + { + this.field_148324_c.mouseReleased(x, y); + } + } + + public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) + { + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiOverlayDeb# b/src/minecraft/net/minecraft/client/gui/GuiOverlayDeb# new file mode 100644 index 0000000..36bb161 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiOverlayDeb# @@ -0,0 +1,16 @@ +*************** +*** 89,94 **** + + } + + protected List call() { + BlockPos blockpos = new BlockPos(this.field_175242_a.func_175606_aa().field_70165_t, this.field_175242_a.func_175606_aa().func_174813_aQ().field_72338_b, this.field_175242_a.func_175606_aa().field_70161_v); + if(this.func_175236_d()) { +--- 89,95 ---- + + } + ++ @SuppressWarnings("incomplete-switch") + protected List call() { + BlockPos blockpos = new BlockPos(this.field_175242_a.func_175606_aa().field_70165_t, this.field_175242_a.func_175606_aa().func_174813_aQ().field_72338_b, this.field_175242_a.func_175606_aa().field_70161_v); + if(this.func_175236_d()) { diff --git a/src/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java b/src/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java new file mode 100644 index 0000000..45d3d4a --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java @@ -0,0 +1,339 @@ +package net.minecraft.client.gui; + +import com.google.common.base.Strings; +import com.google.common.collect.Lists; + +import animeware.NightSky; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map.Entry; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.ClientBrandRetriever; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.FrameTimer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.WorldType; +import net.minecraft.world.chunk.Chunk; +import optifine.Reflector; + +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; + +public class GuiOverlayDebug extends Gui +{ + private final Minecraft mc; + private final FontRenderer fontRenderer; + private static final String __OBFID = "CL_00001956"; + + public GuiOverlayDebug(Minecraft mc) + { + this.mc = mc; + this.fontRenderer = mc.fontRendererObj; + } + + public void renderDebugInfo(ScaledResolution scaledResolutionIn) + { + this.mc.mcProfiler.startSection("debug"); + GlStateManager.pushMatrix(); + this.renderDebugInfoLeft(); + this.renderDebugInfoRight(scaledResolutionIn); + GlStateManager.popMatrix(); + this.mc.mcProfiler.endSection(); + } + + private boolean isReducedDebug() + { + return this.mc.thePlayer.hasReducedDebug() || this.mc.gameSettings.reducedDebugInfo; + } + + protected void renderDebugInfoLeft() + { + List list = this.call(); + + for (int i = 0; i < list.size(); ++i) + { + String s = (String)list.get(i); + + if (!Strings.isNullOrEmpty(s)) + { + int j = this.fontRenderer.FONT_HEIGHT; + int k = this.fontRenderer.getStringWidth(s); + boolean flag = true; + int l = 2 + j * i; + drawRect(1, l - 1, 2 + k + 1, l + j - 1, -1873784752); + this.fontRenderer.drawString(s, 2, l, 14737632); + } + } + } + + protected void renderDebugInfoRight(ScaledResolution p_175239_1_) + { + List list = this.getDebugInfoRight(); + + for (int i = 0; i < list.size(); ++i) + { + String s = (String)list.get(i); + + if (!Strings.isNullOrEmpty(s)) + { + int j = this.fontRenderer.FONT_HEIGHT; + int k = this.fontRenderer.getStringWidth(s); + int l = p_175239_1_.getScaledWidth() - 2 - k; + int i1 = 2 + j * i; + drawRect(l - 1, i1 - 1, l + k + 1, i1 + j - 1, -1873784752); + this.fontRenderer.drawString(s, l, i1, 14737632); + } + } + } + + protected List call() + { + BlockPos blockpos = new BlockPos(this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().getEntityBoundingBox().minY, this.mc.getRenderViewEntity().posZ); + + if (this.isReducedDebug()) + { + return Lists.newArrayList(new String[] {NightSky.INSTANCE.NAME + " " + NightSky.INSTANCE.VERSION, this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("Chunk-relative: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15)})}); + } + else + { + Entity entity = this.mc.getRenderViewEntity(); + EnumFacing enumfacing = entity.getHorizontalFacing(); + String s = "Invalid"; + + switch (GuiOverlayDebug.GuiOverlayDebug$1.field_178907_a[enumfacing.ordinal()]) + { + case 1: + s = "Towards negative Z"; + break; + + case 2: + s = "Towards positive Z"; + break; + + case 3: + s = "Towards negative X"; + break; + + case 4: + s = "Towards positive X"; + } + + ArrayList arraylist = Lists.newArrayList(new String[] {NightSky.INSTANCE.NAME + " " + NightSky.INSTANCE.VERSION, this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("XYZ: %.3f / %.5f / %.3f", new Object[]{Double.valueOf(this.mc.getRenderViewEntity().posX), Double.valueOf(this.mc.getRenderViewEntity().getEntityBoundingBox().minY), Double.valueOf(this.mc.getRenderViewEntity().posZ)}), String.format("Block: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())}), String.format("Chunk: %d %d %d in %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15), Integer.valueOf(blockpos.getX() >> 4), Integer.valueOf(blockpos.getY() >> 4), Integer.valueOf(blockpos.getZ() >> 4)}), String.format("Facing: %s (%s) (%.1f / %.1f)", new Object[]{enumfacing, s, Float.valueOf(MathHelper.wrapAngleTo180_float(entity.rotationYaw)), Float.valueOf(MathHelper.wrapAngleTo180_float(entity.rotationPitch))})}); + + if (this.mc.theWorld != null && this.mc.theWorld.isBlockLoaded(blockpos)) + { + Chunk chunk = this.mc.theWorld.getChunkFromBlockCoords(blockpos); + arraylist.add("Biome: " + chunk.getBiome(blockpos, this.mc.theWorld.getWorldChunkManager()).biomeName); + arraylist.add("Light: " + chunk.getLightSubtracted(blockpos, 0) + " (" + chunk.getLightFor(EnumSkyBlock.SKY, blockpos) + " sky, " + chunk.getLightFor(EnumSkyBlock.BLOCK, blockpos) + " block)"); + DifficultyInstance difficultyinstance = this.mc.theWorld.getDifficultyForLocation(blockpos); + + if (this.mc.isIntegratedServerRunning() && this.mc.getIntegratedServer() != null) + { + EntityPlayerMP entityplayermp = this.mc.getIntegratedServer().getConfigurationManager().getPlayerByUUID(this.mc.thePlayer.getUniqueID()); + + if (entityplayermp != null) + { + difficultyinstance = entityplayermp.worldObj.getDifficultyForLocation(new BlockPos(entityplayermp)); + } + } + + arraylist.add(String.format("Local Difficulty: %.2f (Day %d)", new Object[] {Float.valueOf(difficultyinstance.getAdditionalDifficulty()), Long.valueOf(this.mc.theWorld.getWorldTime() / 24000L)})); + } + + if (this.mc.entityRenderer != null && this.mc.entityRenderer.isShaderActive()) + { + arraylist.add("Shader: " + this.mc.entityRenderer.getShaderGroup().getShaderGroupName()); + } + + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.mc.objectMouseOver.getBlockPos() != null) + { + BlockPos blockpos1 = this.mc.objectMouseOver.getBlockPos(); + arraylist.add(String.format("Looking at: %d %d %d", new Object[] {Integer.valueOf(blockpos1.getX()), Integer.valueOf(blockpos1.getY()), Integer.valueOf(blockpos1.getZ())})); + } + + return arraylist; + } + } + + protected List getDebugInfoRight() + { + long i = Runtime.getRuntime().maxMemory(); + long j = Runtime.getRuntime().totalMemory(); + long k = Runtime.getRuntime().freeMemory(); + long l = j - k; + ArrayList arraylist = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.func_183029_j()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)}); + + if (Reflector.FMLCommonHandler_getBrandings.exists()) + { + Object object = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]); + arraylist.add(""); + arraylist.addAll((Collection)Reflector.call(object, Reflector.FMLCommonHandler_getBrandings, new Object[] {Boolean.valueOf(false)})); + } + + if (this.isReducedDebug()) + { + return arraylist; + } + else + { + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.mc.objectMouseOver.getBlockPos() != null) + { + BlockPos blockpos = this.mc.objectMouseOver.getBlockPos(); + IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); + + if (this.mc.theWorld.getWorldType() != WorldType.DEBUG_WORLD) + { + iblockstate = iblockstate.getBlock().getActualState(iblockstate, this.mc.theWorld, blockpos); + } + + arraylist.add(""); + arraylist.add(String.valueOf(Block.blockRegistry.getNameForObject(iblockstate.getBlock()))); + Entry entry; + String s; + + for (Iterator iterator = iblockstate.getProperties().entrySet().iterator(); ((Iterator)iterator).hasNext(); arraylist.add(((IProperty)entry.getKey()).getName() + ": " + s)) + { + entry = (Entry)iterator.next(); + s = ((Comparable)entry.getValue()).toString(); + + if (entry.getValue() == Boolean.TRUE) + { + s = EnumChatFormatting.GREEN + s; + } + else if (entry.getValue() == Boolean.FALSE) + { + s = EnumChatFormatting.RED + s; + } + } + } + + return arraylist; + } + } + + private void func_181554_e() + { + GlStateManager.disableDepth(); + FrameTimer frametimer = this.mc.func_181539_aj(); + int i = frametimer.func_181749_a(); + int j = frametimer.func_181750_b(); + long[] along = frametimer.func_181746_c(); + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + int k = i; + int l = 0; + drawRect(0, scaledresolution.getScaledHeight() - 60, 240, scaledresolution.getScaledHeight(), -1873784752); + + while (k != j) + { + int i1 = frametimer.func_181748_a(along[k], 30); + int j1 = this.func_181552_c(MathHelper.clamp_int(i1, 0, 60), 0, 30, 60); + this.drawVerticalLine(l, scaledresolution.getScaledHeight(), scaledresolution.getScaledHeight() - i1, j1); + ++l; + k = frametimer.func_181751_b(k + 1); + } + + drawRect(1, scaledresolution.getScaledHeight() - 30 + 1, 14, scaledresolution.getScaledHeight() - 30 + 10, -1873784752); + this.fontRenderer.drawString("60", 2, scaledresolution.getScaledHeight() - 30 + 2, 14737632); + this.drawHorizontalLine(0, 239, scaledresolution.getScaledHeight() - 30, -1); + drawRect(1, scaledresolution.getScaledHeight() - 60 + 1, 14, scaledresolution.getScaledHeight() - 60 + 10, -1873784752); + this.fontRenderer.drawString("30", 2, scaledresolution.getScaledHeight() - 60 + 2, 14737632); + this.drawHorizontalLine(0, 239, scaledresolution.getScaledHeight() - 60, -1); + this.drawHorizontalLine(0, 239, scaledresolution.getScaledHeight() - 1, -1); + this.drawVerticalLine(0, scaledresolution.getScaledHeight() - 60, scaledresolution.getScaledHeight(), -1); + this.drawVerticalLine(239, scaledresolution.getScaledHeight() - 60, scaledresolution.getScaledHeight(), -1); + + if (this.mc.gameSettings.limitFramerate <= 120) + { + this.drawHorizontalLine(0, 239, scaledresolution.getScaledHeight() - 60 + this.mc.gameSettings.limitFramerate / 2, -16711681); + } + + GlStateManager.enableDepth(); + } + + private int func_181552_c(int p_181552_1_, int p_181552_2_, int p_181552_3_, int p_181552_4_) + { + return p_181552_1_ < p_181552_3_ ? this.func_181553_a(-16711936, -256, (float)p_181552_1_ / (float)p_181552_3_) : this.func_181553_a(-256, -65536, (float)(p_181552_1_ - p_181552_3_) / (float)(p_181552_4_ - p_181552_3_)); + } + + private int func_181553_a(int p_181553_1_, int p_181553_2_, float p_181553_3_) + { + int i = p_181553_1_ >> 24 & 255; + int j = p_181553_1_ >> 16 & 255; + int k = p_181553_1_ >> 8 & 255; + int l = p_181553_1_ & 255; + int i1 = p_181553_2_ >> 24 & 255; + int j1 = p_181553_2_ >> 16 & 255; + int k1 = p_181553_2_ >> 8 & 255; + int l1 = p_181553_2_ & 255; + int i2 = MathHelper.clamp_int((int)((float)i + (float)(i1 - i) * p_181553_3_), 0, 255); + int j2 = MathHelper.clamp_int((int)((float)j + (float)(j1 - j) * p_181553_3_), 0, 255); + int k2 = MathHelper.clamp_int((int)((float)k + (float)(k1 - k) * p_181553_3_), 0, 255); + int l2 = MathHelper.clamp_int((int)((float)l + (float)(l1 - l) * p_181553_3_), 0, 255); + return i2 << 24 | j2 << 16 | k2 << 8 | l2; + } + + private static long bytesToMb(long bytes) + { + return bytes / 1024L / 1024L; + } + + static final class GuiOverlayDebug$1 + { + static final int[] field_178907_a = new int[EnumFacing.values().length]; + private static final String __OBFID = "CL_00001955"; + + static + { + try + { + field_178907_a[EnumFacing.NORTH.ordinal()] = 1; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_178907_a[EnumFacing.SOUTH.ordinal()] = 2; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_178907_a[EnumFacing.WEST.ordinal()] = 3; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_178907_a[EnumFacing.EAST.ordinal()] = 4; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiOverlayDeb~ b/src/minecraft/net/minecraft/client/gui/GuiOverlayDeb~ new file mode 100644 index 0000000..0285937 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiOverlayDeb~ @@ -0,0 +1,276 @@ +package net.minecraft.client.gui; + +import com.google.common.base.Strings; +import com.google.common.collect.Lists; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map.Entry; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.ClientBrandRetriever; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.src.Reflector; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.FrameTimer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.WorldType; +import net.minecraft.world.chunk.Chunk; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; + +public class GuiOverlayDebug extends Gui { + private final Minecraft field_175242_a; + private final FontRenderer field_175241_f; + private static final String __OBFID = "CL_00001956"; + + public GuiOverlayDebug(Minecraft p_i45543_1_) { + this.field_175242_a = p_i45543_1_; + this.field_175241_f = p_i45543_1_.field_71466_p; + } + + public void func_175237_a(ScaledResolution p_175237_1_) { + this.field_175242_a.field_71424_I.func_76320_a("debug"); + GlStateManager.func_179094_E(); + this.func_180798_a(); + this.func_175239_b(p_175237_1_); + GlStateManager.func_179121_F(); + this.field_175242_a.field_71424_I.func_76319_b(); + } + + private boolean func_175236_d() { + return this.field_175242_a.field_71439_g.func_175140_cp() || this.field_175242_a.field_71474_y.field_178879_v; + } + + protected void func_180798_a() { + List list = this.call(); + + for(int i = 0; i < list.size(); ++i) { + String s = (String)list.get(i); + if(!Strings.isNullOrEmpty(s)) { + int j = this.field_175241_f.field_78288_b; + int k = this.field_175241_f.func_78256_a(s); + boolean flag = true; + int l = 2 + j * i; + func_73734_a(1, l - 1, 2 + k + 1, l + j - 1, -1873784752); + this.field_175241_f.func_78276_b(s, 2, l, 14737632); + } + } + + } + + protected void func_175239_b(ScaledResolution p_175239_1_) { + List list = this.func_175238_c(); + + for(int i = 0; i < list.size(); ++i) { + String s = (String)list.get(i); + if(!Strings.isNullOrEmpty(s)) { + int j = this.field_175241_f.field_78288_b; + int k = this.field_175241_f.func_78256_a(s); + int l = p_175239_1_.func_78326_a() - 2 - k; + int i1 = 2 + j * i; + func_73734_a(l - 1, i1 - 1, l + k + 1, i1 + j - 1, -1873784752); + this.field_175241_f.func_78276_b(s, l, i1, 14737632); + } + } + + } + + protected List call() { + BlockPos blockpos = new BlockPos(this.field_175242_a.func_175606_aa().field_70165_t, this.field_175242_a.func_175606_aa().func_174813_aQ().field_72338_b, this.field_175242_a.func_175606_aa().field_70161_v); + if(this.func_175236_d()) { + return Lists.newArrayList(new String[]{"Minecraft 1.8.8 (" + this.field_175242_a.func_175600_c() + "/" + ClientBrandRetriever.getClientModName() + ")", this.field_175242_a.field_71426_K, this.field_175242_a.field_71438_f.func_72735_c(), this.field_175242_a.field_71438_f.func_72723_d(), "P: " + this.field_175242_a.field_71452_i.func_78869_b() + ". T: " + this.field_175242_a.field_71441_e.func_72981_t(), this.field_175242_a.field_71441_e.func_72827_u(), "", String.format("Chunk-relative: %d %d %d", new Object[]{Integer.valueOf(blockpos.func_177958_n() & 15), Integer.valueOf(blockpos.func_177956_o() & 15), Integer.valueOf(blockpos.func_177952_p() & 15)})}); + } else { + Entity entity = this.field_175242_a.func_175606_aa(); + EnumFacing enumfacing = entity.func_174811_aO(); + String s = "Invalid"; + switch(GuiOverlayDebug.GuiOverlayDebug$1.field_178907_a[enumfacing.ordinal()]) { + case 1: + s = "Towards negative Z"; + break; + case 2: + s = "Towards positive Z"; + break; + case 3: + s = "Towards negative X"; + break; + case 4: + s = "Towards positive X"; + } + + ArrayList arraylist = Lists.newArrayList(new String[]{"Minecraft 1.8.8 (" + this.field_175242_a.func_175600_c() + "/" + ClientBrandRetriever.getClientModName() + ")", this.field_175242_a.field_71426_K, this.field_175242_a.field_71438_f.func_72735_c(), this.field_175242_a.field_71438_f.func_72723_d(), "P: " + this.field_175242_a.field_71452_i.func_78869_b() + ". T: " + this.field_175242_a.field_71441_e.func_72981_t(), this.field_175242_a.field_71441_e.func_72827_u(), "", String.format("XYZ: %.3f / %.5f / %.3f", new Object[]{Double.valueOf(this.field_175242_a.func_175606_aa().field_70165_t), Double.valueOf(this.field_175242_a.func_175606_aa().func_174813_aQ().field_72338_b), Double.valueOf(this.field_175242_a.func_175606_aa().field_70161_v)}), String.format("Block: %d %d %d", new Object[]{Integer.valueOf(blockpos.func_177958_n()), Integer.valueOf(blockpos.func_177956_o()), Integer.valueOf(blockpos.func_177952_p())}), String.format("Chunk: %d %d %d in %d %d %d", new Object[]{Integer.valueOf(blockpos.func_177958_n() & 15), Integer.valueOf(blockpos.func_177956_o() & 15), Integer.valueOf(blockpos.func_177952_p() & 15), Integer.valueOf(blockpos.func_177958_n() >> 4), Integer.valueOf(blockpos.func_177956_o() >> 4), Integer.valueOf(blockpos.func_177952_p() >> 4)}), String.format("Facing: %s (%s) (%.1f / %.1f)", new Object[]{enumfacing, s, Float.valueOf(MathHelper.func_76142_g(entity.field_70177_z)), Float.valueOf(MathHelper.func_76142_g(entity.field_70125_A))})}); + if(this.field_175242_a.field_71441_e != null && this.field_175242_a.field_71441_e.func_175667_e(blockpos)) { + Chunk chunk = this.field_175242_a.field_71441_e.func_175726_f(blockpos); + arraylist.add("Biome: " + chunk.func_177411_a(blockpos, this.field_175242_a.field_71441_e.func_72959_q()).field_76791_y); + arraylist.add("Light: " + chunk.func_177443_a(blockpos, 0) + " (" + chunk.func_177413_a(EnumSkyBlock.SKY, blockpos) + " sky, " + chunk.func_177413_a(EnumSkyBlock.BLOCK, blockpos) + " block)"); + DifficultyInstance difficultyinstance = this.field_175242_a.field_71441_e.func_175649_E(blockpos); + if(this.field_175242_a.func_71387_A() && this.field_175242_a.func_71401_C() != null) { + EntityPlayerMP entityplayermp = this.field_175242_a.func_71401_C().func_71203_ab().func_177451_a(this.field_175242_a.field_71439_g.func_110124_au()); + if(entityplayermp != null) { + difficultyinstance = entityplayermp.field_70170_p.func_175649_E(new BlockPos(entityplayermp)); + } + } + + arraylist.add(String.format("Local Difficulty: %.2f (Day %d)", new Object[]{Float.valueOf(difficultyinstance.func_180168_b()), Long.valueOf(this.field_175242_a.field_71441_e.func_72820_D() / 24000L)})); + } + + if(this.field_175242_a.field_71460_t != null && this.field_175242_a.field_71460_t.func_147702_a()) { + arraylist.add("Shader: " + this.field_175242_a.field_71460_t.func_147706_e().func_148022_b()); + } + + if(this.field_175242_a.field_71476_x != null && this.field_175242_a.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK && this.field_175242_a.field_71476_x.func_178782_a() != null) { + BlockPos blockpos1 = this.field_175242_a.field_71476_x.func_178782_a(); + arraylist.add(String.format("Looking at: %d %d %d", new Object[]{Integer.valueOf(blockpos1.func_177958_n()), Integer.valueOf(blockpos1.func_177956_o()), Integer.valueOf(blockpos1.func_177952_p())})); + } + + return arraylist; + } + } + + protected List func_175238_c() { + long i = Runtime.getRuntime().maxMemory(); + long j = Runtime.getRuntime().totalMemory(); + long k = Runtime.getRuntime().freeMemory(); + long l = j - k; + ArrayList arraylist = Lists.newArrayList(new String[]{String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.field_175242_a.func_147111_S()?64:32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(func_175240_a(l)), Long.valueOf(func_175240_a(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(func_175240_a(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.func_183029_j()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(7936)}), GL11.glGetString(7937), GL11.glGetString(7938)}); + if(Reflector.FMLCommonHandler_getBrandings.exists()) { + Object object = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]); + arraylist.add(""); + arraylist.addAll((Collection)Reflector.call(object, Reflector.FMLCommonHandler_getBrandings, new Object[]{Boolean.valueOf(false)})); + } + + if(this.func_175236_d()) { + return arraylist; + } else { + if(this.field_175242_a.field_71476_x != null && this.field_175242_a.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK && this.field_175242_a.field_71476_x.func_178782_a() != null) { + BlockPos blockpos = this.field_175242_a.field_71476_x.func_178782_a(); + IBlockState iblockstate = this.field_175242_a.field_71441_e.func_180495_p(blockpos); + if(this.field_175242_a.field_71441_e.func_175624_G() != WorldType.field_180272_g) { + iblockstate = iblockstate.func_177230_c().func_176221_a(iblockstate, this.field_175242_a.field_71441_e, blockpos); + } + + arraylist.add(""); + arraylist.add(String.valueOf(Block.field_149771_c.func_177774_c(iblockstate.func_177230_c()))); + + Entry entry; + String s; + for(Iterator iterator = iblockstate.func_177228_b().entrySet().iterator(); ((Iterator)iterator).hasNext(); arraylist.add(((IProperty)entry.getKey()).func_177701_a() + ": " + s)) { + entry = (Entry)iterator.next(); + s = ((Comparable)entry.getValue()).toString(); + if(entry.getValue() == Boolean.TRUE) { + s = EnumChatFormatting.GREEN + s; + } else if(entry.getValue() == Boolean.FALSE) { + s = EnumChatFormatting.RED + s; + } + } + } + + return arraylist; + } + } + + private void func_181554_e() { + GlStateManager.func_179097_i(); + FrameTimer frametimer = this.field_175242_a.func_181539_aj(); + int i = frametimer.func_181749_a(); + int j = frametimer.func_181750_b(); + long[] along = frametimer.func_181746_c(); + ScaledResolution scaledresolution = new ScaledResolution(this.field_175242_a); + int k = i; + int l = 0; + func_73734_a(0, scaledresolution.func_78328_b() - 60, 240, scaledresolution.func_78328_b(), -1873784752); + + while(k != j) { + int i1 = frametimer.func_181748_a(along[k], 30); + int j1 = this.func_181552_c(MathHelper.func_76125_a(i1, 0, 60), 0, 30, 60); + this.func_73728_b(l, scaledresolution.func_78328_b(), scaledresolution.func_78328_b() - i1, j1); + ++l; + k = frametimer.func_181751_b(k + 1); + } + + func_73734_a(1, scaledresolution.func_78328_b() - 30 + 1, 14, scaledresolution.func_78328_b() - 30 + 10, -1873784752); + this.field_175241_f.func_78276_b("60", 2, scaledresolution.func_78328_b() - 30 + 2, 14737632); + this.func_73730_a(0, 239, scaledresolution.func_78328_b() - 30, -1); + func_73734_a(1, scaledresolution.func_78328_b() - 60 + 1, 14, scaledresolution.func_78328_b() - 60 + 10, -1873784752); + this.field_175241_f.func_78276_b("30", 2, scaledresolution.func_78328_b() - 60 + 2, 14737632); + this.func_73730_a(0, 239, scaledresolution.func_78328_b() - 60, -1); + this.func_73730_a(0, 239, scaledresolution.func_78328_b() - 1, -1); + this.func_73728_b(0, scaledresolution.func_78328_b() - 60, scaledresolution.func_78328_b(), -1); + this.func_73728_b(239, scaledresolution.func_78328_b() - 60, scaledresolution.func_78328_b(), -1); + if(this.field_175242_a.field_71474_y.field_74350_i <= 120) { + this.func_73730_a(0, 239, scaledresolution.func_78328_b() - 60 + this.field_175242_a.field_71474_y.field_74350_i / 2, -16711681); + } + + GlStateManager.func_179126_j(); + } + + private int func_181552_c(int p_181552_1_, int p_181552_2_, int p_181552_3_, int p_181552_4_) { + return p_181552_1_ < p_181552_3_?this.func_181553_a(-16711936, -256, (float)p_181552_1_ / (float)p_181552_3_):this.func_181553_a(-256, -65536, (float)(p_181552_1_ - p_181552_3_) / (float)(p_181552_4_ - p_181552_3_)); + } + + private int func_181553_a(int p_181553_1_, int p_181553_2_, float p_181553_3_) { + int i = p_181553_1_ >> 24 & 255; + int j = p_181553_1_ >> 16 & 255; + int k = p_181553_1_ >> 8 & 255; + int l = p_181553_1_ & 255; + int i1 = p_181553_2_ >> 24 & 255; + int j1 = p_181553_2_ >> 16 & 255; + int k1 = p_181553_2_ >> 8 & 255; + int l1 = p_181553_2_ & 255; + int i2 = MathHelper.func_76125_a((int)((float)i + (float)(i1 - i) * p_181553_3_), 0, 255); + int j2 = MathHelper.func_76125_a((int)((float)j + (float)(j1 - j) * p_181553_3_), 0, 255); + int k2 = MathHelper.func_76125_a((int)((float)k + (float)(k1 - k) * p_181553_3_), 0, 255); + int l2 = MathHelper.func_76125_a((int)((float)l + (float)(l1 - l) * p_181553_3_), 0, 255); + return i2 << 24 | j2 << 16 | k2 << 8 | l2; + } + + private static long func_175240_a(long p_175240_0_) { + return p_175240_0_ / 1024L / 1024L; + } + + static final class GuiOverlayDebug$1 { + static final int[] field_178907_a = new int[EnumFacing.values().length]; + private static final String __OBFID = "CL_00001955"; + + static { + try { + field_178907_a[EnumFacing.NORTH.ordinal()] = 1; + } catch (NoSuchFieldError var4) { + ; + } + + try { + field_178907_a[EnumFacing.SOUTH.ordinal()] = 2; + } catch (NoSuchFieldError var3) { + ; + } + + try { + field_178907_a[EnumFacing.WEST.ordinal()] = 3; + } catch (NoSuchFieldError var2) { + ; + } + + try { + field_178907_a[EnumFacing.EAST.ordinal()] = 4; + } catch (NoSuchFieldError var1) { + ; + } + + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiPageButtonList.java b/src/minecraft/net/minecraft/client/gui/GuiPageButtonList.java new file mode 100644 index 0000000..fca718c --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiPageButtonList.java @@ -0,0 +1,628 @@ +package net.minecraft.client.gui; + +import com.google.common.base.Objects; +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.util.IntHashMap; + +public class GuiPageButtonList extends GuiListExtended +{ + private final List field_178074_u = Lists.newArrayList(); + private final IntHashMap field_178073_v = new IntHashMap(); + private final List field_178072_w = Lists.newArrayList(); + private final GuiPageButtonList.GuiListEntry[][] field_178078_x; + private int field_178077_y; + private GuiPageButtonList.GuiResponder field_178076_z; + private Gui field_178075_A; + + public GuiPageButtonList(Minecraft mcIn, int widthIn, int heightIn, int topIn, int bottomIn, int slotHeightIn, GuiPageButtonList.GuiResponder p_i45536_7_, GuiPageButtonList.GuiListEntry[]... p_i45536_8_) + { + super(mcIn, widthIn, heightIn, topIn, bottomIn, slotHeightIn); + this.field_178076_z = p_i45536_7_; + this.field_178078_x = p_i45536_8_; + this.field_148163_i = false; + this.func_178069_s(); + this.func_178055_t(); + } + + private void func_178069_s() + { + for (GuiPageButtonList.GuiListEntry[] aguipagebuttonlist$guilistentry : this.field_178078_x) + { + for (int i = 0; i < aguipagebuttonlist$guilistentry.length; i += 2) + { + GuiPageButtonList.GuiListEntry guipagebuttonlist$guilistentry = aguipagebuttonlist$guilistentry[i]; + GuiPageButtonList.GuiListEntry guipagebuttonlist$guilistentry1 = i < aguipagebuttonlist$guilistentry.length - 1 ? aguipagebuttonlist$guilistentry[i + 1] : null; + Gui gui = this.func_178058_a(guipagebuttonlist$guilistentry, 0, guipagebuttonlist$guilistentry1 == null); + Gui gui1 = this.func_178058_a(guipagebuttonlist$guilistentry1, 160, guipagebuttonlist$guilistentry == null); + GuiPageButtonList.GuiEntry guipagebuttonlist$guientry = new GuiPageButtonList.GuiEntry(gui, gui1); + this.field_178074_u.add(guipagebuttonlist$guientry); + + if (guipagebuttonlist$guilistentry != null && gui != null) + { + this.field_178073_v.addKey(guipagebuttonlist$guilistentry.func_178935_b(), gui); + + if (gui instanceof GuiTextField) + { + this.field_178072_w.add((GuiTextField)gui); + } + } + + if (guipagebuttonlist$guilistentry1 != null && gui1 != null) + { + this.field_178073_v.addKey(guipagebuttonlist$guilistentry1.func_178935_b(), gui1); + + if (gui1 instanceof GuiTextField) + { + this.field_178072_w.add((GuiTextField)gui1); + } + } + } + } + } + + private void func_178055_t() + { + this.field_178074_u.clear(); + + for (int i = 0; i < this.field_178078_x[this.field_178077_y].length; i += 2) + { + GuiPageButtonList.GuiListEntry guipagebuttonlist$guilistentry = this.field_178078_x[this.field_178077_y][i]; + GuiPageButtonList.GuiListEntry guipagebuttonlist$guilistentry1 = i < this.field_178078_x[this.field_178077_y].length - 1 ? this.field_178078_x[this.field_178077_y][i + 1] : null; + Gui gui = (Gui)this.field_178073_v.lookup(guipagebuttonlist$guilistentry.func_178935_b()); + Gui gui1 = guipagebuttonlist$guilistentry1 != null ? (Gui)this.field_178073_v.lookup(guipagebuttonlist$guilistentry1.func_178935_b()) : null; + GuiPageButtonList.GuiEntry guipagebuttonlist$guientry = new GuiPageButtonList.GuiEntry(gui, gui1); + this.field_178074_u.add(guipagebuttonlist$guientry); + } + } + + public void func_181156_c(int p_181156_1_) + { + if (p_181156_1_ != this.field_178077_y) + { + int i = this.field_178077_y; + this.field_178077_y = p_181156_1_; + this.func_178055_t(); + this.func_178060_e(i, p_181156_1_); + this.amountScrolled = 0.0F; + } + } + + public int func_178059_e() + { + return this.field_178077_y; + } + + public int func_178057_f() + { + return this.field_178078_x.length; + } + + public Gui func_178056_g() + { + return this.field_178075_A; + } + + public void func_178071_h() + { + if (this.field_178077_y > 0) + { + this.func_181156_c(this.field_178077_y - 1); + } + } + + public void func_178064_i() + { + if (this.field_178077_y < this.field_178078_x.length - 1) + { + this.func_181156_c(this.field_178077_y + 1); + } + } + + public Gui func_178061_c(int p_178061_1_) + { + return (Gui)this.field_178073_v.lookup(p_178061_1_); + } + + private void func_178060_e(int p_178060_1_, int p_178060_2_) + { + for (GuiPageButtonList.GuiListEntry guipagebuttonlist$guilistentry : this.field_178078_x[p_178060_1_]) + { + if (guipagebuttonlist$guilistentry != null) + { + this.func_178066_a((Gui)this.field_178073_v.lookup(guipagebuttonlist$guilistentry.func_178935_b()), false); + } + } + + for (GuiPageButtonList.GuiListEntry guipagebuttonlist$guilistentry1 : this.field_178078_x[p_178060_2_]) + { + if (guipagebuttonlist$guilistentry1 != null) + { + this.func_178066_a((Gui)this.field_178073_v.lookup(guipagebuttonlist$guilistentry1.func_178935_b()), true); + } + } + } + + private void func_178066_a(Gui p_178066_1_, boolean p_178066_2_) + { + if (p_178066_1_ instanceof GuiButton) + { + ((GuiButton)p_178066_1_).visible = p_178066_2_; + } + else if (p_178066_1_ instanceof GuiTextField) + { + ((GuiTextField)p_178066_1_).setVisible(p_178066_2_); + } + else if (p_178066_1_ instanceof GuiLabel) + { + ((GuiLabel)p_178066_1_).visible = p_178066_2_; + } + } + + private Gui func_178058_a(GuiPageButtonList.GuiListEntry p_178058_1_, int p_178058_2_, boolean p_178058_3_) + { + return (Gui)(p_178058_1_ instanceof GuiPageButtonList.GuiSlideEntry ? this.func_178067_a(this.width / 2 - 155 + p_178058_2_, 0, (GuiPageButtonList.GuiSlideEntry)p_178058_1_) : (p_178058_1_ instanceof GuiPageButtonList.GuiButtonEntry ? this.func_178065_a(this.width / 2 - 155 + p_178058_2_, 0, (GuiPageButtonList.GuiButtonEntry)p_178058_1_) : (p_178058_1_ instanceof GuiPageButtonList.EditBoxEntry ? this.func_178068_a(this.width / 2 - 155 + p_178058_2_, 0, (GuiPageButtonList.EditBoxEntry)p_178058_1_) : (p_178058_1_ instanceof GuiPageButtonList.GuiLabelEntry ? this.func_178063_a(this.width / 2 - 155 + p_178058_2_, 0, (GuiPageButtonList.GuiLabelEntry)p_178058_1_, p_178058_3_) : null)))); + } + + public void func_181155_a(boolean p_181155_1_) + { + for (GuiPageButtonList.GuiEntry guipagebuttonlist$guientry : this.field_178074_u) + { + if (guipagebuttonlist$guientry.field_178029_b instanceof GuiButton) + { + ((GuiButton)guipagebuttonlist$guientry.field_178029_b).enabled = p_181155_1_; + } + + if (guipagebuttonlist$guientry.field_178030_c instanceof GuiButton) + { + ((GuiButton)guipagebuttonlist$guientry.field_178030_c).enabled = p_181155_1_; + } + } + } + + public boolean mouseClicked(int mouseX, int mouseY, int mouseEvent) + { + boolean flag = super.mouseClicked(mouseX, mouseY, mouseEvent); + int i = this.getSlotIndexFromScreenCoords(mouseX, mouseY); + + if (i >= 0) + { + GuiPageButtonList.GuiEntry guipagebuttonlist$guientry = this.getListEntry(i); + + if (this.field_178075_A != guipagebuttonlist$guientry.field_178028_d && this.field_178075_A != null && this.field_178075_A instanceof GuiTextField) + { + ((GuiTextField)this.field_178075_A).setFocused(false); + } + + this.field_178075_A = guipagebuttonlist$guientry.field_178028_d; + } + + return flag; + } + + private GuiSlider func_178067_a(int p_178067_1_, int p_178067_2_, GuiPageButtonList.GuiSlideEntry p_178067_3_) + { + GuiSlider guislider = new GuiSlider(this.field_178076_z, p_178067_3_.func_178935_b(), p_178067_1_, p_178067_2_, p_178067_3_.func_178936_c(), p_178067_3_.func_178943_e(), p_178067_3_.func_178944_f(), p_178067_3_.func_178942_g(), p_178067_3_.func_178945_a()); + guislider.visible = p_178067_3_.func_178934_d(); + return guislider; + } + + private GuiListButton func_178065_a(int p_178065_1_, int p_178065_2_, GuiPageButtonList.GuiButtonEntry p_178065_3_) + { + GuiListButton guilistbutton = new GuiListButton(this.field_178076_z, p_178065_3_.func_178935_b(), p_178065_1_, p_178065_2_, p_178065_3_.func_178936_c(), p_178065_3_.func_178940_a()); + guilistbutton.visible = p_178065_3_.func_178934_d(); + return guilistbutton; + } + + private GuiTextField func_178068_a(int p_178068_1_, int p_178068_2_, GuiPageButtonList.EditBoxEntry p_178068_3_) + { + GuiTextField guitextfield = new GuiTextField(p_178068_3_.func_178935_b(), this.mc.fontRendererObj, p_178068_1_, p_178068_2_, 150, 20); + guitextfield.setText(p_178068_3_.func_178936_c()); + guitextfield.func_175207_a(this.field_178076_z); + guitextfield.setVisible(p_178068_3_.func_178934_d()); + guitextfield.func_175205_a(p_178068_3_.func_178950_a()); + return guitextfield; + } + + private GuiLabel func_178063_a(int p_178063_1_, int p_178063_2_, GuiPageButtonList.GuiLabelEntry p_178063_3_, boolean p_178063_4_) + { + GuiLabel guilabel; + + if (p_178063_4_) + { + guilabel = new GuiLabel(this.mc.fontRendererObj, p_178063_3_.func_178935_b(), p_178063_1_, p_178063_2_, this.width - p_178063_1_ * 2, 20, -1); + } + else + { + guilabel = new GuiLabel(this.mc.fontRendererObj, p_178063_3_.func_178935_b(), p_178063_1_, p_178063_2_, 150, 20, -1); + } + + guilabel.visible = p_178063_3_.func_178934_d(); + guilabel.func_175202_a(p_178063_3_.func_178936_c()); + guilabel.setCentered(); + return guilabel; + } + + public void func_178062_a(char p_178062_1_, int p_178062_2_) + { + if (this.field_178075_A instanceof GuiTextField) + { + GuiTextField guitextfield = (GuiTextField)this.field_178075_A; + + if (!GuiScreen.isKeyComboCtrlV(p_178062_2_)) + { + if (p_178062_2_ == 15) + { + guitextfield.setFocused(false); + int k = this.field_178072_w.indexOf(this.field_178075_A); + + if (GuiScreen.isShiftKeyDown()) + { + if (k == 0) + { + k = this.field_178072_w.size() - 1; + } + else + { + --k; + } + } + else if (k == this.field_178072_w.size() - 1) + { + k = 0; + } + else + { + ++k; + } + + this.field_178075_A = (Gui)this.field_178072_w.get(k); + guitextfield = (GuiTextField)this.field_178075_A; + guitextfield.setFocused(true); + int l = guitextfield.yPosition + this.slotHeight; + int i1 = guitextfield.yPosition; + + if (l > this.bottom) + { + this.amountScrolled += (float)(l - this.bottom); + } + else if (i1 < this.top) + { + this.amountScrolled = (float)i1; + } + } + else + { + guitextfield.textboxKeyTyped(p_178062_1_, p_178062_2_); + } + } + else + { + String s = GuiScreen.getClipboardString(); + String[] astring = s.split(";"); + int i = this.field_178072_w.indexOf(this.field_178075_A); + int j = i; + + for (String s1 : astring) + { + ((GuiTextField)this.field_178072_w.get(j)).setText(s1); + + if (j == this.field_178072_w.size() - 1) + { + j = 0; + } + else + { + ++j; + } + + if (j == i) + { + break; + } + } + } + } + } + + /** + * Gets the IGuiListEntry object for the given index + */ + public GuiPageButtonList.GuiEntry getListEntry(int index) + { + return (GuiPageButtonList.GuiEntry)this.field_178074_u.get(index); + } + + public int getSize() + { + return this.field_178074_u.size(); + } + + /** + * Gets the width of the list + */ + public int getListWidth() + { + return 400; + } + + protected int getScrollBarX() + { + return super.getScrollBarX() + 32; + } + + public static class EditBoxEntry extends GuiPageButtonList.GuiListEntry + { + private final Predicate field_178951_a; + + public EditBoxEntry(int p_i45534_1_, String p_i45534_2_, boolean p_i45534_3_, Predicate p_i45534_4_) + { + super(p_i45534_1_, p_i45534_2_, p_i45534_3_); + this.field_178951_a = (Predicate)Objects.firstNonNull(p_i45534_4_, Predicates.alwaysTrue()); + } + + public Predicate func_178950_a() + { + return this.field_178951_a; + } + } + + public static class GuiButtonEntry extends GuiPageButtonList.GuiListEntry + { + private final boolean field_178941_a; + + public GuiButtonEntry(int p_i45535_1_, String p_i45535_2_, boolean p_i45535_3_, boolean p_i45535_4_) + { + super(p_i45535_1_, p_i45535_2_, p_i45535_3_); + this.field_178941_a = p_i45535_4_; + } + + public boolean func_178940_a() + { + return this.field_178941_a; + } + } + + public static class GuiEntry implements GuiListExtended.IGuiListEntry + { + private final Minecraft field_178031_a = Minecraft.getMinecraft(); + private final Gui field_178029_b; + private final Gui field_178030_c; + private Gui field_178028_d; + + public GuiEntry(Gui p_i45533_1_, Gui p_i45533_2_) + { + this.field_178029_b = p_i45533_1_; + this.field_178030_c = p_i45533_2_; + } + + public Gui func_178022_a() + { + return this.field_178029_b; + } + + public Gui func_178021_b() + { + return this.field_178030_c; + } + + public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) + { + this.func_178017_a(this.field_178029_b, y, mouseX, mouseY, false); + this.func_178017_a(this.field_178030_c, y, mouseX, mouseY, false); + } + + private void func_178017_a(Gui p_178017_1_, int p_178017_2_, int p_178017_3_, int p_178017_4_, boolean p_178017_5_) + { + if (p_178017_1_ != null) + { + if (p_178017_1_ instanceof GuiButton) + { + this.func_178024_a((GuiButton)p_178017_1_, p_178017_2_, p_178017_3_, p_178017_4_, p_178017_5_); + } + else if (p_178017_1_ instanceof GuiTextField) + { + this.func_178027_a((GuiTextField)p_178017_1_, p_178017_2_, p_178017_5_); + } + else if (p_178017_1_ instanceof GuiLabel) + { + this.func_178025_a((GuiLabel)p_178017_1_, p_178017_2_, p_178017_3_, p_178017_4_, p_178017_5_); + } + } + } + + private void func_178024_a(GuiButton p_178024_1_, int p_178024_2_, int p_178024_3_, int p_178024_4_, boolean p_178024_5_) + { + p_178024_1_.yPosition = p_178024_2_; + + if (!p_178024_5_) + { + p_178024_1_.drawButton(this.field_178031_a, p_178024_3_, p_178024_4_); + } + } + + private void func_178027_a(GuiTextField p_178027_1_, int p_178027_2_, boolean p_178027_3_) + { + p_178027_1_.yPosition = p_178027_2_; + + if (!p_178027_3_) + { + p_178027_1_.drawTextBox(); + } + } + + private void func_178025_a(GuiLabel p_178025_1_, int p_178025_2_, int p_178025_3_, int p_178025_4_, boolean p_178025_5_) + { + p_178025_1_.field_146174_h = p_178025_2_; + + if (!p_178025_5_) + { + p_178025_1_.drawLabel(this.field_178031_a, p_178025_3_, p_178025_4_); + } + } + + public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) + { + this.func_178017_a(this.field_178029_b, p_178011_3_, 0, 0, true); + this.func_178017_a(this.field_178030_c, p_178011_3_, 0, 0, true); + } + + public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_) + { + boolean flag = this.func_178026_a(this.field_178029_b, p_148278_2_, p_148278_3_, p_148278_4_); + boolean flag1 = this.func_178026_a(this.field_178030_c, p_148278_2_, p_148278_3_, p_148278_4_); + return flag || flag1; + } + + private boolean func_178026_a(Gui p_178026_1_, int p_178026_2_, int p_178026_3_, int p_178026_4_) + { + if (p_178026_1_ == null) + { + return false; + } + else if (p_178026_1_ instanceof GuiButton) + { + return this.func_178023_a((GuiButton)p_178026_1_, p_178026_2_, p_178026_3_, p_178026_4_); + } + else + { + if (p_178026_1_ instanceof GuiTextField) + { + this.func_178018_a((GuiTextField)p_178026_1_, p_178026_2_, p_178026_3_, p_178026_4_); + } + + return false; + } + } + + private boolean func_178023_a(GuiButton p_178023_1_, int p_178023_2_, int p_178023_3_, int p_178023_4_) + { + boolean flag = p_178023_1_.mousePressed(this.field_178031_a, p_178023_2_, p_178023_3_); + + if (flag) + { + this.field_178028_d = p_178023_1_; + } + + return flag; + } + + private void func_178018_a(GuiTextField p_178018_1_, int p_178018_2_, int p_178018_3_, int p_178018_4_) + { + p_178018_1_.mouseClicked(p_178018_2_, p_178018_3_, p_178018_4_); + + if (p_178018_1_.isFocused()) + { + this.field_178028_d = p_178018_1_; + } + } + + public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) + { + this.func_178016_b(this.field_178029_b, x, y, mouseEvent); + this.func_178016_b(this.field_178030_c, x, y, mouseEvent); + } + + private void func_178016_b(Gui p_178016_1_, int p_178016_2_, int p_178016_3_, int p_178016_4_) + { + if (p_178016_1_ != null) + { + if (p_178016_1_ instanceof GuiButton) + { + this.func_178019_b((GuiButton)p_178016_1_, p_178016_2_, p_178016_3_, p_178016_4_); + } + } + } + + private void func_178019_b(GuiButton p_178019_1_, int p_178019_2_, int p_178019_3_, int p_178019_4_) + { + p_178019_1_.mouseReleased(p_178019_2_, p_178019_3_); + } + } + + public static class GuiLabelEntry extends GuiPageButtonList.GuiListEntry + { + public GuiLabelEntry(int p_i45532_1_, String p_i45532_2_, boolean p_i45532_3_) + { + super(p_i45532_1_, p_i45532_2_, p_i45532_3_); + } + } + + public static class GuiListEntry + { + private final int field_178939_a; + private final String field_178937_b; + private final boolean field_178938_c; + + public GuiListEntry(int p_i45531_1_, String p_i45531_2_, boolean p_i45531_3_) + { + this.field_178939_a = p_i45531_1_; + this.field_178937_b = p_i45531_2_; + this.field_178938_c = p_i45531_3_; + } + + public int func_178935_b() + { + return this.field_178939_a; + } + + public String func_178936_c() + { + return this.field_178937_b; + } + + public boolean func_178934_d() + { + return this.field_178938_c; + } + } + + public interface GuiResponder + { + void func_175321_a(int p_175321_1_, boolean p_175321_2_); + + void onTick(int id, float value); + + void func_175319_a(int p_175319_1_, String p_175319_2_); + } + + public static class GuiSlideEntry extends GuiPageButtonList.GuiListEntry + { + private final GuiSlider.FormatHelper field_178949_a; + private final float field_178947_b; + private final float field_178948_c; + private final float field_178946_d; + + public GuiSlideEntry(int p_i45530_1_, String p_i45530_2_, boolean p_i45530_3_, GuiSlider.FormatHelper p_i45530_4_, float p_i45530_5_, float p_i45530_6_, float p_i45530_7_) + { + super(p_i45530_1_, p_i45530_2_, p_i45530_3_); + this.field_178949_a = p_i45530_4_; + this.field_178947_b = p_i45530_5_; + this.field_178948_c = p_i45530_6_; + this.field_178946_d = p_i45530_7_; + } + + public GuiSlider.FormatHelper func_178945_a() + { + return this.field_178949_a; + } + + public float func_178943_e() + { + return this.field_178947_b; + } + + public float func_178944_f() + { + return this.field_178948_c; + } + + public float func_178942_g() + { + return this.field_178946_d; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiPlayerTabOverlay.java b/src/minecraft/net/minecraft/client/gui/GuiPlayerTabOverlay.java new file mode 100644 index 0000000..0e36a2d --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiPlayerTabOverlay.java @@ -0,0 +1,405 @@ +package net.minecraft.client.gui; + +import java.util.Comparator; +import java.util.List; + +import com.google.common.collect.ComparisonChain; +import com.google.common.collect.Ordering; +import com.mojang.authlib.GameProfile; + +import animeware.cosmetic.Booleans; +import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.scoreboard.IScoreObjectiveCriteria; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.world.WorldSettings; + +public class GuiPlayerTabOverlay extends Gui +{ + private static final Ordering field_175252_a = Ordering.from(new GuiPlayerTabOverlay.PlayerComparator()); + private final Minecraft mc; + private final GuiIngame guiIngame; + private IChatComponent footer; + private IChatComponent header; + + /** + * The last time the playerlist was opened (went from not being renderd, to being rendered) + */ + private long lastTimeOpened; + + /** Weither or not the playerlist is currently being rendered */ + private boolean isBeingRendered; + + public GuiPlayerTabOverlay(Minecraft mcIn, GuiIngame guiIngameIn) + { + this.mc = mcIn; + this.guiIngame = guiIngameIn; + } + + /** + * Returns the name that should be renderd for the player supplied + */ + public String getPlayerName(NetworkPlayerInfo networkPlayerInfoIn) + { + return networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); + } + + /** + * Called by GuiIngame to update the information stored in the playerlist, does not actually render the list, + * however. + */ + public void updatePlayerList(boolean willBeRendered) + { + if (willBeRendered && !this.isBeingRendered) + { + this.lastTimeOpened = Minecraft.getSystemTime(); + } + + this.isBeingRendered = willBeRendered; + } + + /** + * Renders the playerlist, its background, headers and footers. + */ + public void renderPlayerlist(int width, Scoreboard scoreboardIn, ScoreObjective scoreObjectiveIn) + { + NetHandlerPlayClient nethandlerplayclient = this.mc.thePlayer.sendQueue; + List list = field_175252_a.sortedCopy(nethandlerplayclient.getPlayerInfoMap()); + int i = 0; + int j = 0; + + for (NetworkPlayerInfo networkplayerinfo : list) + { + int k = this.mc.fontRendererObj.getStringWidth(this.getPlayerName(networkplayerinfo)); + i = Math.max(i, k); + + if (scoreObjectiveIn != null && scoreObjectiveIn.getRenderType() != IScoreObjectiveCriteria.EnumRenderType.HEARTS) + { + k = this.mc.fontRendererObj.getStringWidth(" " + scoreboardIn.getValueFromObjective(networkplayerinfo.getGameProfile().getName(), scoreObjectiveIn).getScorePoints()); + j = Math.max(j, k); + } + } + + list = list.subList(0, Math.min(list.size(), 80)); + int l3 = list.size(); + int i4 = l3; + int j4; + + for (j4 = 1; i4 > 20; i4 = (l3 + j4 - 1) / j4) + { + ++j4; + } + + boolean flag = this.mc.isIntegratedServerRunning() || this.mc.getNetHandler().getNetworkManager().getIsencrypted(); + int l; + + if (scoreObjectiveIn != null) + { + if (scoreObjectiveIn.getRenderType() == IScoreObjectiveCriteria.EnumRenderType.HEARTS) + { + l = 90; + } + else + { + l = j; + } + } + else + { + l = 0; + } + + int i1 = Math.min(j4 * ((flag ? 9 : 0) + i + l + 13), width - 50) / j4; + int j1 = width / 2 - (i1 * j4 + (j4 - 1) * 5) / 2; + int k1 = 10; + int l1 = i1 * j4 + (j4 - 1) * 5; + List list1 = null; + List list2 = null; + + if (this.header != null) + { + list1 = this.mc.fontRendererObj.listFormattedStringToWidth(this.header.getFormattedText(), width - 50); + + for (String s : list1) + { + l1 = Math.max(l1, this.mc.fontRendererObj.getStringWidth(s)); + } + } + + if (this.footer != null) + { + list2 = this.mc.fontRendererObj.listFormattedStringToWidth(this.footer.getFormattedText(), width - 50); + + for (String s2 : list2) + { + l1 = Math.max(l1, this.mc.fontRendererObj.getStringWidth(s2)); + } + } + + if (list1 != null) + { + drawRect(width / 2 - l1 / 2 - 1, k1 - 1, width / 2 + l1 / 2 + 1, k1 + list1.size() * this.mc.fontRendererObj.FONT_HEIGHT, Integer.MIN_VALUE); + + for (String s3 : list1) + { + int i2 = this.mc.fontRendererObj.getStringWidth(s3); + this.mc.fontRendererObj.drawStringWithShadow(s3, (float)(width / 2 - i2 / 2), (float)k1, -1); + k1 += this.mc.fontRendererObj.FONT_HEIGHT; + } + + ++k1; + } + + drawRect(width / 2 - l1 / 2 - 1, k1 - 1, width / 2 + l1 / 2 + 1, k1 + i4 * 9, Integer.MIN_VALUE); + + for (int k4 = 0; k4 < l3; ++k4) + { + int l4 = k4 / i4; + int i5 = k4 % i4; + int j2 = j1 + l4 * i1 + l4 * 5; + int k2 = k1 + i5 * 9; + drawRect(j2, k2, j2 + i1, k2 + 8, 553648127); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + + if (k4 < list.size()) + { + NetworkPlayerInfo networkplayerinfo1 = (NetworkPlayerInfo)list.get(k4); + String s1 = this.getPlayerName(networkplayerinfo1); + if(Booleans.nickhider && s1.contains(mc.getSession().getUsername())){ + //s1 = s1.replaceAll(mc.getSession().getUsername(), EnumChatFormatting.GOLD); + } + GameProfile gameprofile = networkplayerinfo1.getGameProfile(); + + if (flag) + { + EntityPlayer entityplayer = this.mc.theWorld.getPlayerEntityByUUID(gameprofile.getId()); + boolean flag1 = entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.CAPE) && (gameprofile.getName().equals("Dinnerbone") || gameprofile.getName().equals("Grumm")); + this.mc.getTextureManager().bindTexture(networkplayerinfo1.getLocationSkin()); + int l2 = 8 + (flag1 ? 8 : 0); + int i3 = 8 * (flag1 ? -1 : 1); + Gui.drawScaledCustomSizeModalRect(j2, k2, 8.0F, (float)l2, 8, i3, 8, 8, 64.0F, 64.0F); + + if (entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.HAT)) + { + int j3 = 8 + (flag1 ? 8 : 0); + int k3 = 8 * (flag1 ? -1 : 1); + Gui.drawScaledCustomSizeModalRect(j2, k2, 40.0F, (float)j3, 8, k3, 8, 8, 64.0F, 64.0F); + } + + j2 += 9; + } + + if (networkplayerinfo1.getGameType() == WorldSettings.GameType.SPECTATOR) + { + s1 = EnumChatFormatting.ITALIC + s1; + this.mc.fontRendererObj.drawStringWithShadow(s1, (float)j2, (float)k2, -1862270977); + } + else + { + this.mc.fontRendererObj.drawStringWithShadow(s1, (float)j2, (float)k2, -1); + } + + if (scoreObjectiveIn != null && networkplayerinfo1.getGameType() != WorldSettings.GameType.SPECTATOR) + { + int k5 = j2 + i + 1; + int l5 = k5 + l; + + if (l5 - k5 > 5) + { + this.drawScoreboardValues(scoreObjectiveIn, k2, gameprofile.getName(), k5, l5, networkplayerinfo1); + } + } + + this.drawPing(i1, j2 - (flag ? 9 : 0), k2, networkplayerinfo1); + } + } + + if (list2 != null) + { + k1 = k1 + i4 * 9 + 1; + drawRect(width / 2 - l1 / 2 - 1, k1 - 1, width / 2 + l1 / 2 + 1, k1 + list2.size() * this.mc.fontRendererObj.FONT_HEIGHT, Integer.MIN_VALUE); + + for (String s4 : list2) + { + int j5 = this.mc.fontRendererObj.getStringWidth(s4); + this.mc.fontRendererObj.drawStringWithShadow(s4, (float)(width / 2 - j5 / 2), (float)k1, -1); + k1 += this.mc.fontRendererObj.FONT_HEIGHT; + } + } + } + + protected void drawPing(int p_175245_1_, int p_175245_2_, int p_175245_3_, NetworkPlayerInfo networkPlayerInfoIn) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(icons); + int i = 0; + int j = 0; + + if (networkPlayerInfoIn.getResponseTime() < 0) + { + j = 5; + } + else if (networkPlayerInfoIn.getResponseTime() < 150) + { + j = 0; + } + else if (networkPlayerInfoIn.getResponseTime() < 300) + { + j = 1; + } + else if (networkPlayerInfoIn.getResponseTime() < 600) + { + j = 2; + } + else if (networkPlayerInfoIn.getResponseTime() < 1000) + { + j = 3; + } + else + { + j = 4; + } + + this.zLevel += 100.0F; + this.drawTexturedModalRect(p_175245_2_ + p_175245_1_ - 11, p_175245_3_, 0 + i * 10, 176 + j * 8, 10, 8); + this.zLevel -= 100.0F; + } + + private void drawScoreboardValues(ScoreObjective p_175247_1_, int p_175247_2_, String p_175247_3_, int p_175247_4_, int p_175247_5_, NetworkPlayerInfo p_175247_6_) + { + int i = p_175247_1_.getScoreboard().getValueFromObjective(p_175247_3_, p_175247_1_).getScorePoints(); + + if (p_175247_1_.getRenderType() == IScoreObjectiveCriteria.EnumRenderType.HEARTS) + { + this.mc.getTextureManager().bindTexture(icons); + + if (this.lastTimeOpened == p_175247_6_.func_178855_p()) + { + if (i < p_175247_6_.func_178835_l()) + { + p_175247_6_.func_178846_a(Minecraft.getSystemTime()); + p_175247_6_.func_178844_b((long)(this.guiIngame.getUpdateCounter() + 20)); + } + else if (i > p_175247_6_.func_178835_l()) + { + p_175247_6_.func_178846_a(Minecraft.getSystemTime()); + p_175247_6_.func_178844_b((long)(this.guiIngame.getUpdateCounter() + 10)); + } + } + + if (Minecraft.getSystemTime() - p_175247_6_.func_178847_n() > 1000L || this.lastTimeOpened != p_175247_6_.func_178855_p()) + { + p_175247_6_.func_178836_b(i); + p_175247_6_.func_178857_c(i); + p_175247_6_.func_178846_a(Minecraft.getSystemTime()); + } + + p_175247_6_.func_178843_c(this.lastTimeOpened); + p_175247_6_.func_178836_b(i); + int j = MathHelper.ceiling_float_int((float)Math.max(i, p_175247_6_.func_178860_m()) / 2.0F); + int k = Math.max(MathHelper.ceiling_float_int((float)(i / 2)), Math.max(MathHelper.ceiling_float_int((float)(p_175247_6_.func_178860_m() / 2)), 10)); + boolean flag = p_175247_6_.func_178858_o() > (long)this.guiIngame.getUpdateCounter() && (p_175247_6_.func_178858_o() - (long)this.guiIngame.getUpdateCounter()) / 3L % 2L == 1L; + + if (j > 0) + { + float f = Math.min((float)(p_175247_5_ - p_175247_4_ - 4) / (float)k, 9.0F); + + if (f > 3.0F) + { + for (int l = j; l < k; ++l) + { + this.drawTexturedModalRect((float)p_175247_4_ + (float)l * f, (float)p_175247_2_, flag ? 25 : 16, 0, 9, 9); + } + + for (int j1 = 0; j1 < j; ++j1) + { + this.drawTexturedModalRect((float)p_175247_4_ + (float)j1 * f, (float)p_175247_2_, flag ? 25 : 16, 0, 9, 9); + + if (flag) + { + if (j1 * 2 + 1 < p_175247_6_.func_178860_m()) + { + this.drawTexturedModalRect((float)p_175247_4_ + (float)j1 * f, (float)p_175247_2_, 70, 0, 9, 9); + } + + if (j1 * 2 + 1 == p_175247_6_.func_178860_m()) + { + this.drawTexturedModalRect((float)p_175247_4_ + (float)j1 * f, (float)p_175247_2_, 79, 0, 9, 9); + } + } + + if (j1 * 2 + 1 < i) + { + this.drawTexturedModalRect((float)p_175247_4_ + (float)j1 * f, (float)p_175247_2_, j1 >= 10 ? 160 : 52, 0, 9, 9); + } + + if (j1 * 2 + 1 == i) + { + this.drawTexturedModalRect((float)p_175247_4_ + (float)j1 * f, (float)p_175247_2_, j1 >= 10 ? 169 : 61, 0, 9, 9); + } + } + } + else + { + float f1 = MathHelper.clamp_float((float)i / 20.0F, 0.0F, 1.0F); + int i1 = (int)((1.0F - f1) * 255.0F) << 16 | (int)(f1 * 255.0F) << 8; + String s = "" + (float)i / 2.0F; + + if (p_175247_5_ - this.mc.fontRendererObj.getStringWidth(s + "hp") >= p_175247_4_) + { + s = s + "hp"; + } + + this.mc.fontRendererObj.drawStringWithShadow(s, (float)((p_175247_5_ + p_175247_4_) / 2 - this.mc.fontRendererObj.getStringWidth(s) / 2), (float)p_175247_2_, i1); + } + } + } + else + { + String s1 = EnumChatFormatting.YELLOW + "" + i; + this.mc.fontRendererObj.drawStringWithShadow(s1, (float)(p_175247_5_ - this.mc.fontRendererObj.getStringWidth(s1)), (float)p_175247_2_, 16777215); + } + } + + public void setFooter(IChatComponent footerIn) + { + this.footer = footerIn; + } + + public void setHeader(IChatComponent headerIn) + { + this.header = headerIn; + } + + public void func_181030_a() + { + this.header = null; + this.footer = null; + } + + static class PlayerComparator implements Comparator + { + private PlayerComparator() + { + } + + public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) + { + ScorePlayerTeam scoreplayerteam = p_compare_1_.getPlayerTeam(); + ScorePlayerTeam scoreplayerteam1 = p_compare_2_.getPlayerTeam(); + return ComparisonChain.start().compareTrueFirst(p_compare_1_.getGameType() != WorldSettings.GameType.SPECTATOR, p_compare_2_.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(p_compare_1_.getGameProfile().getName(), p_compare_2_.getGameProfile().getName()).result(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiRenameWorld.java b/src/minecraft/net/minecraft/client/gui/GuiRenameWorld.java new file mode 100644 index 0000000..4dd017c --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiRenameWorld.java @@ -0,0 +1,110 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.client.resources.I18n; +import net.minecraft.world.storage.ISaveFormat; +import net.minecraft.world.storage.WorldInfo; +import org.lwjgl.input.Keyboard; + +public class GuiRenameWorld extends GuiScreen +{ + private GuiScreen parentScreen; + private GuiTextField field_146583_f; + private final String saveName; + + public GuiRenameWorld(GuiScreen parentScreenIn, String saveNameIn) + { + this.parentScreen = parentScreenIn; + this.saveName = saveNameIn; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.field_146583_f.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.format("selectWorld.renameButton", new Object[0]))); + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel", new Object[0]))); + ISaveFormat isaveformat = this.mc.getSaveLoader(); + WorldInfo worldinfo = isaveformat.getWorldInfo(this.saveName); + String s = worldinfo.getWorldName(); + this.field_146583_f = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, 60, 200, 20); + this.field_146583_f.setFocused(true); + this.field_146583_f.setText(s); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 1) + { + this.mc.displayGuiScreen(this.parentScreen); + } + else if (button.id == 0) + { + ISaveFormat isaveformat = this.mc.getSaveLoader(); + isaveformat.renameWorld(this.saveName, this.field_146583_f.getText().trim()); + this.mc.displayGuiScreen(this.parentScreen); + } + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + this.field_146583_f.textboxKeyTyped(typedChar, keyCode); + ((GuiButton)this.buttonList.get(0)).enabled = this.field_146583_f.getText().trim().length() > 0; + + if (keyCode == 28 || keyCode == 156) + { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + super.mouseClicked(mouseX, mouseY, mouseButton); + this.field_146583_f.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, I18n.format("selectWorld.renameTitle", new Object[0]), this.width / 2, 20, 16777215); + this.drawString(this.fontRendererObj, I18n.format("selectWorld.enterName", new Object[0]), this.width / 2 - 100, 47, 10526880); + this.field_146583_f.drawTextBox(); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiRepair.java b/src/minecraft/net/minecraft/client/gui/GuiRepair.java new file mode 100644 index 0000000..5410453 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiRepair.java @@ -0,0 +1,226 @@ +package net.minecraft.client.gui; + +import io.netty.buffer.Unpooled; +import java.io.IOException; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerRepair; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import org.lwjgl.input.Keyboard; + +public class GuiRepair extends GuiContainer implements ICrafting +{ + private static final ResourceLocation anvilResource = new ResourceLocation("textures/gui/container/anvil.png"); + private ContainerRepair anvil; + private GuiTextField nameField; + private InventoryPlayer playerInventory; + + public GuiRepair(InventoryPlayer inventoryIn, World worldIn) + { + super(new ContainerRepair(inventoryIn, worldIn, Minecraft.getMinecraft().thePlayer)); + this.playerInventory = inventoryIn; + this.anvil = (ContainerRepair)this.inventorySlots; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + super.initGui(); + Keyboard.enableRepeatEvents(true); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.nameField = new GuiTextField(0, this.fontRendererObj, i + 62, j + 24, 103, 12); + this.nameField.setTextColor(-1); + this.nameField.setDisabledTextColour(-1); + this.nameField.setEnableBackgroundDrawing(false); + this.nameField.setMaxStringLength(30); + this.inventorySlots.removeCraftingFromCrafters(this); + this.inventorySlots.onCraftGuiOpened(this); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + super.onGuiClosed(); + Keyboard.enableRepeatEvents(false); + this.inventorySlots.removeCraftingFromCrafters(this); + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + GlStateManager.disableLighting(); + GlStateManager.disableBlend(); + this.fontRendererObj.drawString(I18n.format("container.repair", new Object[0]), 60, 6, 4210752); + + if (this.anvil.maximumCost > 0) + { + int i = 8453920; + boolean flag = true; + String s = I18n.format("container.repair.cost", new Object[] {Integer.valueOf(this.anvil.maximumCost)}); + + if (this.anvil.maximumCost >= 40 && !this.mc.thePlayer.capabilities.isCreativeMode) + { + s = I18n.format("container.repair.expensive", new Object[0]); + i = 16736352; + } + else if (!this.anvil.getSlot(2).getHasStack()) + { + flag = false; + } + else if (!this.anvil.getSlot(2).canTakeStack(this.playerInventory.player)) + { + i = 16736352; + } + + if (flag) + { + int j = -16777216 | (i & 16579836) >> 2 | i & -16777216; + int k = this.xSize - 8 - this.fontRendererObj.getStringWidth(s); + int l = 67; + + if (this.fontRendererObj.getUnicodeFlag()) + { + drawRect(k - 3, l - 2, this.xSize - 7, l + 10, -16777216); + drawRect(k - 2, l - 1, this.xSize - 8, l + 9, -12895429); + } + else + { + this.fontRendererObj.drawString(s, k, l + 1, j); + this.fontRendererObj.drawString(s, k + 1, l, j); + this.fontRendererObj.drawString(s, k + 1, l + 1, j); + } + + this.fontRendererObj.drawString(s, k, l, i); + } + } + + GlStateManager.enableLighting(); + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (this.nameField.textboxKeyTyped(typedChar, keyCode)) + { + this.renameItem(); + } + else + { + super.keyTyped(typedChar, keyCode); + } + } + + private void renameItem() + { + String s = this.nameField.getText(); + Slot slot = this.anvil.getSlot(0); + + if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName())) + { + s = ""; + } + + this.anvil.updateItemName(s); + this.mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(s))); + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + super.mouseClicked(mouseX, mouseY, mouseButton); + this.nameField.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + super.drawScreen(mouseX, mouseY, partialTicks); + GlStateManager.disableLighting(); + GlStateManager.disableBlend(); + this.nameField.drawTextBox(); + } + + /** + * Args : renderPartialTicks, mouseX, mouseY + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(anvilResource); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); + this.drawTexturedModalRect(i + 59, j + 20, 0, this.ySize + (this.anvil.getSlot(0).getHasStack() ? 0 : 16), 110, 16); + + if ((this.anvil.getSlot(0).getHasStack() || this.anvil.getSlot(1).getHasStack()) && !this.anvil.getSlot(2).getHasStack()) + { + this.drawTexturedModalRect(i + 99, j + 45, this.xSize, 0, 28, 21); + } + } + + /** + * update the crafting window inventory with the items in the list + */ + public void updateCraftingInventory(Container containerToSend, List itemsList) + { + this.sendSlotContents(containerToSend, 0, containerToSend.getSlot(0).getStack()); + } + + /** + * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual + * contents of that slot. Args: Container, slot number, slot contents + */ + public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack) + { + if (slotInd == 0) + { + this.nameField.setText(stack == null ? "" : stack.getDisplayName()); + this.nameField.setEnabled(stack != null); + + if (stack != null) + { + this.renameItem(); + } + } + } + + /** + * Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress, + * and enchanting level. Normally the first int identifies which variable to update, and the second contains the new + * value. Both are truncated to shorts in non-local SMP. + */ + public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue) + { + } + + public void func_175173_a(Container p_175173_1_, IInventory p_175173_2_) + { + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiResourcePackAvailable.java b/src/minecraft/net/minecraft/client/gui/GuiResourcePackAvailable.java new file mode 100644 index 0000000..f7b0826 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiResourcePackAvailable.java @@ -0,0 +1,19 @@ +package net.minecraft.client.gui; + +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.resources.ResourcePackListEntry; + +public class GuiResourcePackAvailable extends GuiResourcePackList +{ + public GuiResourcePackAvailable(Minecraft mcIn, int p_i45054_2_, int p_i45054_3_, List p_i45054_4_) + { + super(mcIn, p_i45054_2_, p_i45054_3_, p_i45054_4_); + } + + protected String getListHeader() + { + return I18n.format("resourcePack.available.title", new Object[0]); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiResourcePackList.java b/src/minecraft/net/minecraft/client/gui/GuiResourcePackList.java new file mode 100644 index 0000000..24bffb0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiResourcePackList.java @@ -0,0 +1,64 @@ +package net.minecraft.client.gui; + +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.resources.ResourcePackListEntry; +import net.minecraft.util.EnumChatFormatting; + +public abstract class GuiResourcePackList extends GuiListExtended +{ + protected final Minecraft mc; + protected final List field_148204_l; + + public GuiResourcePackList(Minecraft mcIn, int p_i45055_2_, int p_i45055_3_, List p_i45055_4_) + { + super(mcIn, p_i45055_2_, p_i45055_3_, 32, p_i45055_3_ - 55 + 4, 36); + this.mc = mcIn; + this.field_148204_l = p_i45055_4_; + this.field_148163_i = false; + this.setHasListHeader(true, (int)((float)mcIn.fontRendererObj.FONT_HEIGHT * 1.5F)); + } + + /** + * Handles drawing a list's header row. + */ + protected void drawListHeader(int p_148129_1_, int p_148129_2_, Tessellator p_148129_3_) + { + String s = EnumChatFormatting.UNDERLINE + "" + EnumChatFormatting.BOLD + this.getListHeader(); + this.mc.fontRendererObj.drawString(s, p_148129_1_ + this.width / 2 - this.mc.fontRendererObj.getStringWidth(s) / 2, Math.min(this.top + 3, p_148129_2_), 16777215); + } + + protected abstract String getListHeader(); + + public List getList() + { + return this.field_148204_l; + } + + protected int getSize() + { + return this.getList().size(); + } + + /** + * Gets the IGuiListEntry object for the given index + */ + public ResourcePackListEntry getListEntry(int index) + { + return (ResourcePackListEntry)this.getList().get(index); + } + + /** + * Gets the width of the list + */ + public int getListWidth() + { + return this.width; + } + + protected int getScrollBarX() + { + return this.right - 6; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiResourcePackSelected.java b/src/minecraft/net/minecraft/client/gui/GuiResourcePackSelected.java new file mode 100644 index 0000000..7f0b67c --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiResourcePackSelected.java @@ -0,0 +1,19 @@ +package net.minecraft.client.gui; + +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.resources.ResourcePackListEntry; + +public class GuiResourcePackSelected extends GuiResourcePackList +{ + public GuiResourcePackSelected(Minecraft mcIn, int p_i45056_2_, int p_i45056_3_, List p_i45056_4_) + { + super(mcIn, p_i45056_2_, p_i45056_3_, p_i45056_4_); + } + + protected String getListHeader() + { + return I18n.format("resourcePack.selected.title", new Object[0]); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiScreen.java b/src/minecraft/net/minecraft/client/gui/GuiScreen.java new file mode 100644 index 0000000..c990901 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiScreen.java @@ -0,0 +1,812 @@ +package net.minecraft.client.gui; + +import com.google.common.base.Splitter; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.awt.Toolkit; +import java.awt.datatransfer.ClipboardOwner; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.stream.GuiTwitchUserMode; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.EntityList; +import net.minecraft.event.ClickEvent; +import net.minecraft.event.HoverEvent; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTException; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.stats.Achievement; +import net.minecraft.stats.StatBase; +import net.minecraft.stats.StatList; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ResourceLocation; + +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.LWJGLException; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; + +import tv.twitch.chat.ChatUserInfo; + +public abstract class GuiScreen extends Gui implements GuiYesNoCallback +{ + private static final Logger LOGGER = LogManager.getLogger(); + private static final Set PROTOCOLS = Sets.newHashSet(new String[] {"http", "https"}); + private static final Splitter NEWLINE_SPLITTER = Splitter.on('\n'); + + /** Reference to the Minecraft object. */ + protected Minecraft mc; + + /** + * Holds a instance of RenderItem, used to draw the achievement icons on screen (is based on ItemStack) + */ + protected RenderItem itemRender; + + /** The width of the screen object. */ + public static int width; + + /** The height of the screen object. */ + public static int height; + protected List buttonList = Lists.newArrayList(); + protected List labelList = Lists.newArrayList(); + public boolean allowUserInput; + + /** The FontRenderer used by GuiScreen */ + protected FontRenderer fontRendererObj; + + /** The button that was just pressed. */ + private GuiButton selectedButton; + protected int eventButton; + private long lastMouseEvent; + + /** + * Incremented when the game is in touchscreen mode and the screen is tapped, decremented if the screen isn't + * tapped. Does not appear to be used. + */ + private int touchValue; + private URI clickedLinkURI; + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + //super.drawScreen(mouseX, mouseY, partialTicks); + for (int i = 0; i < this.buttonList.size(); ++i) + { + ((GuiButton)this.buttonList.get(i)).drawButton(this.mc, mouseX, mouseY); + } + + for (int j = 0; j < this.labelList.size(); ++j) + { + ((GuiLabel)this.labelList.get(j)).drawLabel(this.mc, mouseX, mouseY); + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (keyCode == 1) + { + this.mc.displayGuiScreen((GuiScreen)null); + + if (this.mc.currentScreen == null) + { + this.mc.setIngameFocus(); + } + } + } + + /** + * Returns a string stored in the system clipboard. + */ + public static String getClipboardString() + { + try + { + Transferable transferable = Toolkit.getDefaultToolkit().getSystemClipboard().getContents((Object)null); + + if (transferable != null && transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) + { + return (String)transferable.getTransferData(DataFlavor.stringFlavor); + } + } + catch (Exception var1) + { + ; + } + + return ""; + } + + /** + * Stores the given string in the system clipboard + */ + public static void setClipboardString(String copyText) + { + if (!StringUtils.isEmpty(copyText)) + { + try + { + StringSelection stringselection = new StringSelection(copyText); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringselection, (ClipboardOwner)null); + } + catch (Exception var2) + { + ; + } + } + } + + protected void renderToolTip(ItemStack stack, int x, int y) + { + List list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips); + + for (int i = 0; i < list.size(); ++i) + { + if (i == 0) + { + list.set(i, stack.getRarity().rarityColor + (String)list.get(i)); + } + else + { + list.set(i, EnumChatFormatting.GRAY + (String)list.get(i)); + } + } + + this.drawHoveringText(list, x, y); + } + + /** + * Draws the text when mouse is over creative inventory tab. Params: current creative tab to be checked, current + * mouse x position, current mouse y position. + */ + protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY) + { + this.drawHoveringText(Arrays.asList(new String[] {tabName}), mouseX, mouseY); + } + + /** + * Draws a List of strings as a tooltip. Every entry is drawn on a seperate line. + */ + protected void drawHoveringText(List textLines, int x, int y) + { + if (!textLines.isEmpty()) + { + GlStateManager.disableRescaleNormal(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + int i = 0; + + for (String s : textLines) + { + int j = this.fontRendererObj.getStringWidth(s); + + if (j > i) + { + i = j; + } + } + + int l1 = x + 12; + int i2 = y - 12; + int k = 8; + + if (textLines.size() > 1) + { + k += 2 + (textLines.size() - 1) * 10; + } + + if (l1 + i > this.width) + { + l1 -= 28 + i; + } + + if (i2 + k + 6 > this.height) + { + i2 = this.height - k - 6; + } + + this.zLevel = 300.0F; + this.itemRender.zLevel = 300.0F; + int l = -267386864; + this.drawGradientRect(l1 - 3, i2 - 4, l1 + i + 3, i2 - 3, l, l); + this.drawGradientRect(l1 - 3, i2 + k + 3, l1 + i + 3, i2 + k + 4, l, l); + this.drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 + k + 3, l, l); + this.drawGradientRect(l1 - 4, i2 - 3, l1 - 3, i2 + k + 3, l, l); + this.drawGradientRect(l1 + i + 3, i2 - 3, l1 + i + 4, i2 + k + 3, l, l); + int i1 = 1347420415; + int j1 = (i1 & 16711422) >> 1 | i1 & -16777216; + this.drawGradientRect(l1 - 3, i2 - 3 + 1, l1 - 3 + 1, i2 + k + 3 - 1, i1, j1); + this.drawGradientRect(l1 + i + 2, i2 - 3 + 1, l1 + i + 3, i2 + k + 3 - 1, i1, j1); + this.drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 - 3 + 1, i1, i1); + this.drawGradientRect(l1 - 3, i2 + k + 2, l1 + i + 3, i2 + k + 3, j1, j1); + + for (int k1 = 0; k1 < textLines.size(); ++k1) + { + String s1 = (String)textLines.get(k1); + this.fontRendererObj.drawStringWithShadow(s1, (float)l1, (float)i2, -1); + + if (k1 == 0) + { + i2 += 2; + } + + i2 += 10; + } + + this.zLevel = 0.0F; + this.itemRender.zLevel = 0.0F; + GlStateManager.enableLighting(); + GlStateManager.enableDepth(); + RenderHelper.enableStandardItemLighting(); + GlStateManager.enableRescaleNormal(); + } + } + + /** + * Draws the hover event specified by the given chat component + */ + protected void handleComponentHover(IChatComponent p_175272_1_, int p_175272_2_, int p_175272_3_) + { + if (p_175272_1_ != null && p_175272_1_.getChatStyle().getChatHoverEvent() != null) + { + HoverEvent hoverevent = p_175272_1_.getChatStyle().getChatHoverEvent(); + + if (hoverevent.getAction() == HoverEvent.Action.SHOW_ITEM) + { + ItemStack itemstack = null; + + try + { + NBTBase nbtbase = JsonToNBT.getTagFromJson(hoverevent.getValue().getUnformattedText()); + + if (nbtbase instanceof NBTTagCompound) + { + itemstack = ItemStack.loadItemStackFromNBT((NBTTagCompound)nbtbase); + } + } + catch (NBTException var11) + { + ; + } + + if (itemstack != null) + { + this.renderToolTip(itemstack, p_175272_2_, p_175272_3_); + } + else + { + this.drawCreativeTabHoveringText(EnumChatFormatting.RED + "Invalid Item!", p_175272_2_, p_175272_3_); + } + } + else if (hoverevent.getAction() == HoverEvent.Action.SHOW_ENTITY) + { + if (this.mc.gameSettings.advancedItemTooltips) + { + try + { + NBTBase nbtbase1 = JsonToNBT.getTagFromJson(hoverevent.getValue().getUnformattedText()); + + if (nbtbase1 instanceof NBTTagCompound) + { + List list1 = Lists.newArrayList(); + NBTTagCompound nbttagcompound = (NBTTagCompound)nbtbase1; + list1.add(nbttagcompound.getString("name")); + + if (nbttagcompound.hasKey("type", 8)) + { + String s = nbttagcompound.getString("type"); + list1.add("Type: " + s + " (" + EntityList.getIDFromString(s) + ")"); + } + + list1.add(nbttagcompound.getString("id")); + this.drawHoveringText(list1, p_175272_2_, p_175272_3_); + } + else + { + this.drawCreativeTabHoveringText(EnumChatFormatting.RED + "Invalid Entity!", p_175272_2_, p_175272_3_); + } + } + catch (NBTException var10) + { + this.drawCreativeTabHoveringText(EnumChatFormatting.RED + "Invalid Entity!", p_175272_2_, p_175272_3_); + } + } + } + else if (hoverevent.getAction() == HoverEvent.Action.SHOW_TEXT) + { + this.drawHoveringText(NEWLINE_SPLITTER.splitToList(hoverevent.getValue().getFormattedText()), p_175272_2_, p_175272_3_); + } + else if (hoverevent.getAction() == HoverEvent.Action.SHOW_ACHIEVEMENT) + { + StatBase statbase = StatList.getOneShotStat(hoverevent.getValue().getUnformattedText()); + + if (statbase != null) + { + IChatComponent ichatcomponent = statbase.getStatName(); + IChatComponent ichatcomponent1 = new ChatComponentTranslation("stats.tooltip.type." + (statbase.isAchievement() ? "achievement" : "statistic"), new Object[0]); + ichatcomponent1.getChatStyle().setItalic(Boolean.valueOf(true)); + String s1 = statbase instanceof Achievement ? ((Achievement)statbase).getDescription() : null; + List list = Lists.newArrayList(new String[] {ichatcomponent.getFormattedText(), ichatcomponent1.getFormattedText()}); + + if (s1 != null) + { + list.addAll(this.fontRendererObj.listFormattedStringToWidth(s1, 150)); + } + + this.drawHoveringText(list, p_175272_2_, p_175272_3_); + } + else + { + this.drawCreativeTabHoveringText(EnumChatFormatting.RED + "Invalid statistic/achievement!", p_175272_2_, p_175272_3_); + } + } + + GlStateManager.disableLighting(); + } + } + + /** + * Sets the text of the chat + */ + protected void setText(String newChatText, boolean shouldOverwrite) + { + } + + /** + * Executes the click event specified by the given chat component + */ + protected boolean handleComponentClick(IChatComponent p_175276_1_) + { + if (p_175276_1_ == null) + { + return false; + } + else + { + ClickEvent clickevent = p_175276_1_.getChatStyle().getChatClickEvent(); + + if (isShiftKeyDown()) + { + if (p_175276_1_.getChatStyle().getInsertion() != null) + { + this.setText(p_175276_1_.getChatStyle().getInsertion(), false); + } + } + else if (clickevent != null) + { + if (clickevent.getAction() == ClickEvent.Action.OPEN_URL) + { + if (!this.mc.gameSettings.chatLinks) + { + return false; + } + + try + { + URI uri = new URI(clickevent.getValue()); + String s = uri.getScheme(); + + if (s == null) + { + throw new URISyntaxException(clickevent.getValue(), "Missing protocol"); + } + + if (!PROTOCOLS.contains(s.toLowerCase())) + { + throw new URISyntaxException(clickevent.getValue(), "Unsupported protocol: " + s.toLowerCase()); + } + + if (this.mc.gameSettings.chatLinksPrompt) + { + this.clickedLinkURI = uri; + this.mc.displayGuiScreen(new GuiConfirmOpenLink(this, clickevent.getValue(), 31102009, false)); + } + else + { + this.openWebLink(uri); + } + } + catch (URISyntaxException urisyntaxexception) + { + LOGGER.error((String)("Can\'t open url for " + clickevent), (Throwable)urisyntaxexception); + } + } + else if (clickevent.getAction() == ClickEvent.Action.OPEN_FILE) + { + URI uri1 = (new File(clickevent.getValue())).toURI(); + this.openWebLink(uri1); + } + else if (clickevent.getAction() == ClickEvent.Action.SUGGEST_COMMAND) + { + this.setText(clickevent.getValue(), true); + } + else if (clickevent.getAction() == ClickEvent.Action.RUN_COMMAND) + { + this.sendChatMessage(clickevent.getValue(), false); + } + else if (clickevent.getAction() == ClickEvent.Action.TWITCH_USER_INFO) + { + ChatUserInfo chatuserinfo = this.mc.getTwitchStream().func_152926_a(clickevent.getValue()); + + if (chatuserinfo != null) + { + this.mc.displayGuiScreen(new GuiTwitchUserMode(this.mc.getTwitchStream(), chatuserinfo)); + } + else + { + LOGGER.error("Tried to handle twitch user but couldn\'t find them!"); + } + } + else + { + LOGGER.error("Don\'t know how to handle " + clickevent); + } + + return true; + } + + return false; + } + } + + public void sendChatMessage(String msg) + { + this.sendChatMessage(msg, true); + } + + public void sendChatMessage(String msg, boolean addToChat) + { + if (addToChat) + { + this.mc.ingameGUI.getChatGUI().addToSentMessages(msg); + } + + this.mc.thePlayer.sendChatMessage(msg); + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + if (mouseButton == 0) + { + for (int i = 0; i < this.buttonList.size(); ++i) + { + GuiButton guibutton = (GuiButton)this.buttonList.get(i); + + if (guibutton.mousePressed(this.mc, mouseX, mouseY)) + { + this.selectedButton = guibutton; + guibutton.playPressSound(this.mc.getSoundHandler()); + this.actionPerformed(guibutton); + } + } + } + } + + /** + * Called when a mouse button is released. Args : mouseX, mouseY, releaseButton + */ + protected void mouseReleased(int mouseX, int mouseY, int state) + { + if (this.selectedButton != null && state == 0) + { + this.selectedButton.mouseReleased(mouseX, mouseY); + this.selectedButton = null; + } + } + + /** + * Called when a mouse button is pressed and the mouse is moved around. Parameters are : mouseX, mouseY, + * lastButtonClicked & timeSinceMouseClick. + */ + protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) + { + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + } + + /** + * Causes the screen to lay out its subcomponents again. This is the equivalent of the Java call + * Container.validate() + */ + public void setWorldAndResolution(Minecraft mc, int width, int height) + { + this.mc = mc; + this.itemRender = mc.getRenderItem(); + this.fontRendererObj = mc.fontRendererObj; + this.width = width; + this.height = height; + this.buttonList.clear(); + this.initGui(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + /*if(mc.isFullScreen()) { + System.setProperty("org.lwjgl.opengl.Window.undecorated", "true"); + try { + Display.setDisplayMode(Display.getDesktopDisplayMode()); + } catch (LWJGLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Display.setLocation(0, 0); + try { + Display.setFullscreen(false); + } catch (LWJGLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Display.setResizable(false); + } else { + System.setProperty("org.lwjgl.opengl.Window.undecorated", "false"); + try { + Display.setDisplayMode(new DisplayMode(mc.displayWidth, mc.displayHeight)); + } catch (LWJGLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Display.setResizable(true); + }*/ + } + + /** + * Delegates mouse and keyboard input. + */ + public void handleInput() throws IOException + { + if (Mouse.isCreated()) + { + while (Mouse.next()) + { + this.handleMouseInput(); + } + } + + if (Keyboard.isCreated()) + { + while (Keyboard.next()) + { + this.handleKeyboardInput(); + } + } + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + int i = Mouse.getEventX() * this.width / this.mc.displayWidth; + int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; + int k = Mouse.getEventButton(); + + if (Mouse.getEventButtonState()) + { + if (this.mc.gameSettings.touchscreen && this.touchValue++ > 0) + { + return; + } + + this.eventButton = k; + this.lastMouseEvent = Minecraft.getSystemTime(); + this.mouseClicked(i, j, this.eventButton); + } + else if (k != -1) + { + if (this.mc.gameSettings.touchscreen && --this.touchValue > 0) + { + return; + } + + this.eventButton = -1; + this.mouseReleased(i, j, k); + } + else if (this.eventButton != -1 && this.lastMouseEvent > 0L) + { + long l = Minecraft.getSystemTime() - this.lastMouseEvent; + this.mouseClickMove(i, j, this.eventButton, l); + } + } + + /** + * Handles keyboard input. + */ + public void handleKeyboardInput() throws IOException + { + if (Keyboard.getEventKeyState()) + { + this.keyTyped(Keyboard.getEventCharacter(), Keyboard.getEventKey()); + } + + this.mc.dispatchKeypresses(); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + } + + /** + * Draws either a gradient over the background screen (when it exists) or a flat gradient over background.png + */ + public void drawDefaultBackground() + { + this.drawWorldBackground(0); + } + + public void drawWorldBackground(int tint) + { + if (this.mc.theWorld != null) + { + this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680); + } + else + { + this.drawBackground(tint); + } + } + + /** + * Draws the background (i is always 0 as of 1.2.2) + */ + public void drawBackground(int tint) + { + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(optionsBackground); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + float f = 32.0F; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos(0.0D, (double)this.height, 0.0D).tex(0.0D, (double)((float)this.height / 32.0F + (float)tint)).color(64, 64, 64, 255).endVertex(); + worldrenderer.pos((double)this.width, (double)this.height, 0.0D).tex((double)((float)this.width / 32.0F), (double)((float)this.height / 32.0F + (float)tint)).color(64, 64, 64, 255).endVertex(); + worldrenderer.pos((double)this.width, 0.0D, 0.0D).tex((double)((float)this.width / 32.0F), (double)tint).color(64, 64, 64, 255).endVertex(); + worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, (double)tint).color(64, 64, 64, 255).endVertex(); + tessellator.draw(); + } + + + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return true; + } + + public void confirmClicked(boolean result, int id) + { + if (id == 31102009) + { + if (result) + { + this.openWebLink(this.clickedLinkURI); + } + + this.clickedLinkURI = null; + this.mc.displayGuiScreen(this); + } + } + + private void openWebLink(URI p_175282_1_) + { + try + { + Class oclass = Class.forName("java.awt.Desktop"); + Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]); + oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {p_175282_1_}); + } + catch (Throwable throwable) + { + LOGGER.error("Couldn\'t open link", throwable); + } + } + + /** + * Returns true if either windows ctrl key is down or if either mac meta key is down + */ + public static boolean isCtrlKeyDown() + { + return Minecraft.isRunningOnMac ? Keyboard.isKeyDown(219) || Keyboard.isKeyDown(220) : Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157); + } + + /** + * Returns true if either shift key is down + */ + public static boolean isShiftKeyDown() + { + return Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54); + } + + /** + * Returns true if either alt key is down + */ + public static boolean isAltKeyDown() + { + return Keyboard.isKeyDown(56) || Keyboard.isKeyDown(184); + } + + public static boolean isKeyComboCtrlX(int p_175277_0_) + { + return p_175277_0_ == 45 && isCtrlKeyDown() && !isShiftKeyDown() && !isAltKeyDown(); + } + + public static boolean isKeyComboCtrlV(int p_175279_0_) + { + return p_175279_0_ == 47 && isCtrlKeyDown() && !isShiftKeyDown() && !isAltKeyDown(); + } + + public static boolean isKeyComboCtrlC(int p_175280_0_) + { + return p_175280_0_ == 46 && isCtrlKeyDown() && !isShiftKeyDown() && !isAltKeyDown(); + } + + public static boolean isKeyComboCtrlA(int p_175278_0_) + { + return p_175278_0_ == 30 && isCtrlKeyDown() && !isShiftKeyDown() && !isAltKeyDown(); + } + + /** + * Called when the GUI is resized in order to update the world and the resolution + */ + public void onResize(Minecraft mcIn, int p_175273_2_, int p_175273_3_) + { + this.setWorldAndResolution(mcIn, p_175273_2_, p_175273_3_); + } + + public void draw() { + // TODO Auto-generated method stub + + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiScreenAddServer.java b/src/minecraft/net/minecraft/client/gui/GuiScreenAddServer.java new file mode 100644 index 0000000..0fe0dba --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiScreenAddServer.java @@ -0,0 +1,164 @@ +package net.minecraft.client.gui; + +import com.google.common.base.Predicate; +import java.io.IOException; +import java.net.IDN; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.resources.I18n; +import org.lwjgl.input.Keyboard; + +public class GuiScreenAddServer extends GuiScreen +{ + private final GuiScreen parentScreen; + private final ServerData serverData; + private GuiTextField serverIPField; + private GuiTextField serverNameField; + private GuiButton serverResourcePacks; + private Predicate field_181032_r = new Predicate() + { + public boolean apply(String p_apply_1_) + { + if (p_apply_1_.length() == 0) + { + return true; + } + else + { + String[] astring = p_apply_1_.split(":"); + + if (astring.length == 0) + { + return true; + } + else + { + try + { + String s = IDN.toASCII(astring[0]); + return true; + } + catch (IllegalArgumentException var4) + { + return false; + } + } + } + } + }; + + public GuiScreenAddServer(GuiScreen p_i1033_1_, ServerData p_i1033_2_) + { + this.parentScreen = p_i1033_1_; + this.serverData = p_i1033_2_; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.serverNameField.updateCursorCounter(); + this.serverIPField.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 18, I18n.format("addServer.add", new Object[0]))); + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 18, I18n.format("gui.cancel", new Object[0]))); + this.buttonList.add(this.serverResourcePacks = new GuiButton(2, this.width / 2 - 100, this.height / 4 + 72, I18n.format("addServer.resourcePack", new Object[0]) + ": " + this.serverData.getResourceMode().getMotd().getFormattedText())); + this.serverNameField = new GuiTextField(0, this.fontRendererObj, this.width / 2 - 100, 66, 200, 20); + this.serverNameField.setFocused(true); + this.serverNameField.setText(this.serverData.serverName); + this.serverIPField = new GuiTextField(1, this.fontRendererObj, this.width / 2 - 100, 106, 200, 20); + this.serverIPField.setMaxStringLength(128); + this.serverIPField.setText(this.serverData.serverIP); + this.serverIPField.func_175205_a(this.field_181032_r); + ((GuiButton)this.buttonList.get(0)).enabled = this.serverIPField.getText().length() > 0 && this.serverIPField.getText().split(":").length > 0 && this.serverNameField.getText().length() > 0; + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 2) + { + this.serverData.setResourceMode(ServerData.ServerResourceMode.values()[(this.serverData.getResourceMode().ordinal() + 1) % ServerData.ServerResourceMode.values().length]); + this.serverResourcePacks.displayString = I18n.format("addServer.resourcePack", new Object[0]) + ": " + this.serverData.getResourceMode().getMotd().getFormattedText(); + } + else if (button.id == 1) + { + this.parentScreen.confirmClicked(false, 0); + } + else if (button.id == 0) + { + this.serverData.serverName = this.serverNameField.getText(); + this.serverData.serverIP = this.serverIPField.getText(); + this.parentScreen.confirmClicked(true, 0); + } + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + this.serverNameField.textboxKeyTyped(typedChar, keyCode); + this.serverIPField.textboxKeyTyped(typedChar, keyCode); + + if (keyCode == 15) + { + this.serverNameField.setFocused(!this.serverNameField.isFocused()); + this.serverIPField.setFocused(!this.serverIPField.isFocused()); + } + + if (keyCode == 28 || keyCode == 156) + { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + + ((GuiButton)this.buttonList.get(0)).enabled = this.serverIPField.getText().length() > 0 && this.serverIPField.getText().split(":").length > 0 && this.serverNameField.getText().length() > 0; + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + super.mouseClicked(mouseX, mouseY, mouseButton); + this.serverIPField.mouseClicked(mouseX, mouseY, mouseButton); + this.serverNameField.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, I18n.format("addServer.title", new Object[0]), this.width / 2, 17, 16777215); + this.drawString(this.fontRendererObj, I18n.format("addServer.enterName", new Object[0]), this.width / 2 - 100, 53, 10526880); + this.drawString(this.fontRendererObj, I18n.format("addServer.enterIp", new Object[0]), this.width / 2 - 100, 94, 10526880); + this.serverNameField.drawTextBox(); + this.serverIPField.drawTextBox(); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiScreenBook.java b/src/minecraft/net/minecraft/client/gui/GuiScreenBook.java new file mode 100644 index 0000000..5cfcf31 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiScreenBook.java @@ -0,0 +1,671 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import com.google.gson.JsonParseException; +import io.netty.buffer.Unpooled; +import java.io.IOException; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.event.ClickEvent; +import net.minecraft.init.Items; +import net.minecraft.item.ItemEditableBook; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraft.util.ChatAllowedCharacters; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ResourceLocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Keyboard; + +public class GuiScreenBook extends GuiScreen +{ + private static final Logger logger = LogManager.getLogger(); + private static final ResourceLocation bookGuiTextures = new ResourceLocation("textures/gui/book.png"); + + /** The player editing the book */ + private final EntityPlayer editingPlayer; + private final ItemStack bookObj; + + /** Whether the book is signed or can still be edited */ + private final boolean bookIsUnsigned; + + /** + * Whether the book's title or contents has been modified since being opened + */ + private boolean bookIsModified; + + /** Determines if the signing screen is open */ + private boolean bookGettingSigned; + + /** Update ticks since the gui was opened */ + private int updateCount; + private int bookImageWidth = 192; + private int bookImageHeight = 192; + private int bookTotalPages = 1; + private int currPage; + private NBTTagList bookPages; + private String bookTitle = ""; + private List field_175386_A; + private int field_175387_B = -1; + private GuiScreenBook.NextPageButton buttonNextPage; + private GuiScreenBook.NextPageButton buttonPreviousPage; + private GuiButton buttonDone; + + /** The GuiButton to sign this book. */ + private GuiButton buttonSign; + private GuiButton buttonFinalize; + private GuiButton buttonCancel; + + public GuiScreenBook(EntityPlayer player, ItemStack book, boolean isUnsigned) + { + this.editingPlayer = player; + this.bookObj = book; + this.bookIsUnsigned = isUnsigned; + + if (book.hasTagCompound()) + { + NBTTagCompound nbttagcompound = book.getTagCompound(); + this.bookPages = nbttagcompound.getTagList("pages", 8); + + if (this.bookPages != null) + { + this.bookPages = (NBTTagList)this.bookPages.copy(); + this.bookTotalPages = this.bookPages.tagCount(); + + if (this.bookTotalPages < 1) + { + this.bookTotalPages = 1; + } + } + } + + if (this.bookPages == null && isUnsigned) + { + this.bookPages = new NBTTagList(); + this.bookPages.appendTag(new NBTTagString("")); + this.bookTotalPages = 1; + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + ++this.updateCount; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.clear(); + Keyboard.enableRepeatEvents(true); + + if (this.bookIsUnsigned) + { + this.buttonList.add(this.buttonSign = new GuiButton(3, this.width / 2 - 100, 4 + this.bookImageHeight, 98, 20, I18n.format("book.signButton", new Object[0]))); + this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 + 2, 4 + this.bookImageHeight, 98, 20, I18n.format("gui.done", new Object[0]))); + this.buttonList.add(this.buttonFinalize = new GuiButton(5, this.width / 2 - 100, 4 + this.bookImageHeight, 98, 20, I18n.format("book.finalizeButton", new Object[0]))); + this.buttonList.add(this.buttonCancel = new GuiButton(4, this.width / 2 + 2, 4 + this.bookImageHeight, 98, 20, I18n.format("gui.cancel", new Object[0]))); + } + else + { + this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 - 100, 4 + this.bookImageHeight, 200, 20, I18n.format("gui.done", new Object[0]))); + } + + int i = (this.width - this.bookImageWidth) / 2; + int j = 2; + this.buttonList.add(this.buttonNextPage = new GuiScreenBook.NextPageButton(1, i + 120, j + 154, true)); + this.buttonList.add(this.buttonPreviousPage = new GuiScreenBook.NextPageButton(2, i + 38, j + 154, false)); + this.updateButtons(); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + private void updateButtons() + { + this.buttonNextPage.visible = !this.bookGettingSigned && (this.currPage < this.bookTotalPages - 1 || this.bookIsUnsigned); + this.buttonPreviousPage.visible = !this.bookGettingSigned && this.currPage > 0; + this.buttonDone.visible = !this.bookIsUnsigned || !this.bookGettingSigned; + + if (this.bookIsUnsigned) + { + this.buttonSign.visible = !this.bookGettingSigned; + this.buttonCancel.visible = this.bookGettingSigned; + this.buttonFinalize.visible = this.bookGettingSigned; + this.buttonFinalize.enabled = this.bookTitle.trim().length() > 0; + } + } + + private void sendBookToServer(boolean publish) throws IOException + { + if (this.bookIsUnsigned && this.bookIsModified) + { + if (this.bookPages != null) + { + while (this.bookPages.tagCount() > 1) + { + String s = this.bookPages.getStringTagAt(this.bookPages.tagCount() - 1); + + if (s.length() != 0) + { + break; + } + + this.bookPages.removeTag(this.bookPages.tagCount() - 1); + } + + if (this.bookObj.hasTagCompound()) + { + NBTTagCompound nbttagcompound = this.bookObj.getTagCompound(); + nbttagcompound.setTag("pages", this.bookPages); + } + else + { + this.bookObj.setTagInfo("pages", this.bookPages); + } + + String s2 = "MC|BEdit"; + + if (publish) + { + s2 = "MC|BSign"; + this.bookObj.setTagInfo("author", new NBTTagString(this.editingPlayer.getName())); + this.bookObj.setTagInfo("title", new NBTTagString(this.bookTitle.trim())); + + for (int i = 0; i < this.bookPages.tagCount(); ++i) + { + String s1 = this.bookPages.getStringTagAt(i); + IChatComponent ichatcomponent = new ChatComponentText(s1); + s1 = IChatComponent.Serializer.componentToJson(ichatcomponent); + this.bookPages.set(i, new NBTTagString(s1)); + } + + this.bookObj.setItem(Items.written_book); + } + + PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer()); + packetbuffer.writeItemStackToBuffer(this.bookObj); + this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload(s2, packetbuffer)); + } + } + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 0) + { + this.mc.displayGuiScreen((GuiScreen)null); + this.sendBookToServer(false); + } + else if (button.id == 3 && this.bookIsUnsigned) + { + this.bookGettingSigned = true; + } + else if (button.id == 1) + { + if (this.currPage < this.bookTotalPages - 1) + { + ++this.currPage; + } + else if (this.bookIsUnsigned) + { + this.addNewPage(); + + if (this.currPage < this.bookTotalPages - 1) + { + ++this.currPage; + } + } + } + else if (button.id == 2) + { + if (this.currPage > 0) + { + --this.currPage; + } + } + else if (button.id == 5 && this.bookGettingSigned) + { + this.sendBookToServer(true); + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (button.id == 4 && this.bookGettingSigned) + { + this.bookGettingSigned = false; + } + + this.updateButtons(); + } + } + + private void addNewPage() + { + if (this.bookPages != null && this.bookPages.tagCount() < 50) + { + this.bookPages.appendTag(new NBTTagString("")); + ++this.bookTotalPages; + this.bookIsModified = true; + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + super.keyTyped(typedChar, keyCode); + + if (this.bookIsUnsigned) + { + if (this.bookGettingSigned) + { + this.keyTypedInTitle(typedChar, keyCode); + } + else + { + this.keyTypedInBook(typedChar, keyCode); + } + } + } + + /** + * Processes keystrokes when editing the text of a book + */ + private void keyTypedInBook(char typedChar, int keyCode) + { + if (GuiScreen.isKeyComboCtrlV(keyCode)) + { + this.pageInsertIntoCurrent(GuiScreen.getClipboardString()); + } + else + { + switch (keyCode) + { + case 14: + String s = this.pageGetCurrent(); + + if (s.length() > 0) + { + this.pageSetCurrent(s.substring(0, s.length() - 1)); + } + + return; + + case 28: + case 156: + this.pageInsertIntoCurrent("\n"); + return; + + default: + if (ChatAllowedCharacters.isAllowedCharacter(typedChar)) + { + this.pageInsertIntoCurrent(Character.toString(typedChar)); + } + } + } + } + + /** + * Processes keystrokes when editing the title of a book + */ + private void keyTypedInTitle(char p_146460_1_, int p_146460_2_) throws IOException + { + switch (p_146460_2_) + { + case 14: + if (!this.bookTitle.isEmpty()) + { + this.bookTitle = this.bookTitle.substring(0, this.bookTitle.length() - 1); + this.updateButtons(); + } + + return; + + case 28: + case 156: + if (!this.bookTitle.isEmpty()) + { + this.sendBookToServer(true); + this.mc.displayGuiScreen((GuiScreen)null); + } + + return; + + default: + if (this.bookTitle.length() < 16 && ChatAllowedCharacters.isAllowedCharacter(p_146460_1_)) + { + this.bookTitle = this.bookTitle + Character.toString(p_146460_1_); + this.updateButtons(); + this.bookIsModified = true; + } + } + } + + /** + * Returns the entire text of the current page as determined by currPage + */ + private String pageGetCurrent() + { + return this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount() ? this.bookPages.getStringTagAt(this.currPage) : ""; + } + + /** + * Sets the text of the current page as determined by currPage + */ + private void pageSetCurrent(String p_146457_1_) + { + if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount()) + { + this.bookPages.set(this.currPage, new NBTTagString(p_146457_1_)); + this.bookIsModified = true; + } + } + + /** + * Processes any text getting inserted into the current page, enforcing the page size limit + */ + private void pageInsertIntoCurrent(String p_146459_1_) + { + String s = this.pageGetCurrent(); + String s1 = s + p_146459_1_; + int i = this.fontRendererObj.splitStringWidth(s1 + "" + EnumChatFormatting.BLACK + "_", 118); + + if (i <= 128 && s1.length() < 256) + { + this.pageSetCurrent(s1); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(bookGuiTextures); + int i = (this.width - this.bookImageWidth) / 2; + int j = 2; + this.drawTexturedModalRect(i, j, 0, 0, this.bookImageWidth, this.bookImageHeight); + + if (this.bookGettingSigned) + { + String s = this.bookTitle; + + if (this.bookIsUnsigned) + { + if (this.updateCount / 6 % 2 == 0) + { + s = s + "" + EnumChatFormatting.BLACK + "_"; + } + else + { + s = s + "" + EnumChatFormatting.GRAY + "_"; + } + } + + String s1 = I18n.format("book.editTitle", new Object[0]); + int k = this.fontRendererObj.getStringWidth(s1); + this.fontRendererObj.drawString(s1, i + 36 + (116 - k) / 2, j + 16 + 16, 0); + int l = this.fontRendererObj.getStringWidth(s); + this.fontRendererObj.drawString(s, i + 36 + (116 - l) / 2, j + 48, 0); + String s2 = I18n.format("book.byAuthor", new Object[] {this.editingPlayer.getName()}); + int i1 = this.fontRendererObj.getStringWidth(s2); + this.fontRendererObj.drawString(EnumChatFormatting.DARK_GRAY + s2, i + 36 + (116 - i1) / 2, j + 48 + 10, 0); + String s3 = I18n.format("book.finalizeWarning", new Object[0]); + this.fontRendererObj.drawSplitString(s3, i + 36, j + 80, 116, 0); + } + else + { + String s4 = I18n.format("book.pageIndicator", new Object[] {Integer.valueOf(this.currPage + 1), Integer.valueOf(this.bookTotalPages)}); + String s5 = ""; + + if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount()) + { + s5 = this.bookPages.getStringTagAt(this.currPage); + } + + if (this.bookIsUnsigned) + { + if (this.fontRendererObj.getBidiFlag()) + { + s5 = s5 + "_"; + } + else if (this.updateCount / 6 % 2 == 0) + { + s5 = s5 + "" + EnumChatFormatting.BLACK + "_"; + } + else + { + s5 = s5 + "" + EnumChatFormatting.GRAY + "_"; + } + } + else if (this.field_175387_B != this.currPage) + { + if (ItemEditableBook.validBookTagContents(this.bookObj.getTagCompound())) + { + try + { + IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s5); + this.field_175386_A = ichatcomponent != null ? GuiUtilRenderComponents.func_178908_a(ichatcomponent, 116, this.fontRendererObj, true, true) : null; + } + catch (JsonParseException var13) + { + this.field_175386_A = null; + } + } + else + { + ChatComponentText chatcomponenttext = new ChatComponentText(EnumChatFormatting.DARK_RED.toString() + "* Invalid book tag *"); + this.field_175386_A = Lists.newArrayList(chatcomponenttext); + } + + this.field_175387_B = this.currPage; + } + + int j1 = this.fontRendererObj.getStringWidth(s4); + this.fontRendererObj.drawString(s4, i - j1 + this.bookImageWidth - 44, j + 16, 0); + + if (this.field_175386_A == null) + { + this.fontRendererObj.drawSplitString(s5, i + 36, j + 16 + 16, 116, 0); + } + else + { + int k1 = Math.min(128 / this.fontRendererObj.FONT_HEIGHT, this.field_175386_A.size()); + + for (int l1 = 0; l1 < k1; ++l1) + { + IChatComponent ichatcomponent2 = (IChatComponent)this.field_175386_A.get(l1); + this.fontRendererObj.drawString(ichatcomponent2.getUnformattedText(), i + 36, j + 16 + 16 + l1 * this.fontRendererObj.FONT_HEIGHT, 0); + } + + IChatComponent ichatcomponent1 = this.func_175385_b(mouseX, mouseY); + + if (ichatcomponent1 != null) + { + this.handleComponentHover(ichatcomponent1, mouseX, mouseY); + } + } + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + if (mouseButton == 0) + { + IChatComponent ichatcomponent = this.func_175385_b(mouseX, mouseY); + + if (this.handleComponentClick(ichatcomponent)) + { + return; + } + } + + super.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Executes the click event specified by the given chat component + */ + protected boolean handleComponentClick(IChatComponent p_175276_1_) + { + ClickEvent clickevent = p_175276_1_ == null ? null : p_175276_1_.getChatStyle().getChatClickEvent(); + + if (clickevent == null) + { + return false; + } + else if (clickevent.getAction() == ClickEvent.Action.CHANGE_PAGE) + { + String s = clickevent.getValue(); + + try + { + int i = Integer.parseInt(s) - 1; + + if (i >= 0 && i < this.bookTotalPages && i != this.currPage) + { + this.currPage = i; + this.updateButtons(); + return true; + } + } + catch (Throwable var5) + { + ; + } + + return false; + } + else + { + boolean flag = super.handleComponentClick(p_175276_1_); + + if (flag && clickevent.getAction() == ClickEvent.Action.RUN_COMMAND) + { + this.mc.displayGuiScreen((GuiScreen)null); + } + + return flag; + } + } + + public IChatComponent func_175385_b(int p_175385_1_, int p_175385_2_) + { + if (this.field_175386_A == null) + { + return null; + } + else + { + int i = p_175385_1_ - (this.width - this.bookImageWidth) / 2 - 36; + int j = p_175385_2_ - 2 - 16 - 16; + + if (i >= 0 && j >= 0) + { + int k = Math.min(128 / this.fontRendererObj.FONT_HEIGHT, this.field_175386_A.size()); + + if (i <= 116 && j < this.mc.fontRendererObj.FONT_HEIGHT * k + k) + { + int l = j / this.mc.fontRendererObj.FONT_HEIGHT; + + if (l >= 0 && l < this.field_175386_A.size()) + { + IChatComponent ichatcomponent = (IChatComponent)this.field_175386_A.get(l); + int i1 = 0; + + for (IChatComponent ichatcomponent1 : ichatcomponent) + { + if (ichatcomponent1 instanceof ChatComponentText) + { + i1 += this.mc.fontRendererObj.getStringWidth(((ChatComponentText)ichatcomponent1).getChatComponentText_TextValue()); + + if (i1 > i) + { + return ichatcomponent1; + } + } + } + } + + return null; + } + else + { + return null; + } + } + else + { + return null; + } + } + } + + static class NextPageButton extends GuiButton + { + private final boolean field_146151_o; + + public NextPageButton(int p_i46316_1_, int p_i46316_2_, int p_i46316_3_, boolean p_i46316_4_) + { + super(p_i46316_1_, p_i46316_2_, p_i46316_3_, 23, 13, ""); + this.field_146151_o = p_i46316_4_; + } + + public void drawButton(Minecraft mc, int mouseX, int mouseY) + { + if (this.visible) + { + boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + mc.getTextureManager().bindTexture(GuiScreenBook.bookGuiTextures); + int i = 0; + int j = 192; + + if (flag) + { + i += 23; + } + + if (!this.field_146151_o) + { + j += 13; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, i, j, 23, 13); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiScreenCustomizePresets.java b/src/minecraft/net/minecraft/client/gui/GuiScreenCustomizePresets.java new file mode 100644 index 0000000..ff134f1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiScreenCustomizePresets.java @@ -0,0 +1,236 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.gen.ChunkProviderSettings; +import org.lwjgl.input.Keyboard; + +public class GuiScreenCustomizePresets extends GuiScreen +{ + private static final List field_175310_f = Lists.newArrayList(); + private GuiScreenCustomizePresets.ListPreset field_175311_g; + private GuiButton field_175316_h; + private GuiTextField field_175317_i; + private GuiCustomizeWorldScreen field_175314_r; + protected String field_175315_a = "Customize World Presets"; + private String field_175313_s; + private String field_175312_t; + + public GuiScreenCustomizePresets(GuiCustomizeWorldScreen p_i45524_1_) + { + this.field_175314_r = p_i45524_1_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.clear(); + Keyboard.enableRepeatEvents(true); + this.field_175315_a = I18n.format("createWorld.customize.custom.presets.title", new Object[0]); + this.field_175313_s = I18n.format("createWorld.customize.presets.share", new Object[0]); + this.field_175312_t = I18n.format("createWorld.customize.presets.list", new Object[0]); + this.field_175317_i = new GuiTextField(2, this.fontRendererObj, 50, 40, this.width - 100, 20); + this.field_175311_g = new GuiScreenCustomizePresets.ListPreset(); + this.field_175317_i.setMaxStringLength(2000); + this.field_175317_i.setText(this.field_175314_r.func_175323_a()); + this.buttonList.add(this.field_175316_h = new GuiButton(0, this.width / 2 - 102, this.height - 27, 100, 20, I18n.format("createWorld.customize.presets.select", new Object[0]))); + this.buttonList.add(new GuiButton(1, this.width / 2 + 3, this.height - 27, 100, 20, I18n.format("gui.cancel", new Object[0]))); + this.func_175304_a(); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + this.field_175311_g.handleMouseInput(); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + this.field_175317_i.mouseClicked(mouseX, mouseY, mouseButton); + super.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (!this.field_175317_i.textboxKeyTyped(typedChar, keyCode)) + { + super.keyTyped(typedChar, keyCode); + } + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + switch (button.id) + { + case 0: + this.field_175314_r.func_175324_a(this.field_175317_i.getText()); + this.mc.displayGuiScreen(this.field_175314_r); + break; + + case 1: + this.mc.displayGuiScreen(this.field_175314_r); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.field_175311_g.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.fontRendererObj, this.field_175315_a, this.width / 2, 8, 16777215); + this.drawString(this.fontRendererObj, this.field_175313_s, 50, 30, 10526880); + this.drawString(this.fontRendererObj, this.field_175312_t, 50, 70, 10526880); + this.field_175317_i.drawTextBox(); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.field_175317_i.updateCursorCounter(); + super.updateScreen(); + } + + public void func_175304_a() + { + this.field_175316_h.enabled = this.func_175305_g(); + } + + private boolean func_175305_g() + { + return this.field_175311_g.field_178053_u > -1 && this.field_175311_g.field_178053_u < field_175310_f.size() || this.field_175317_i.getText().length() > 1; + } + + static + { + ChunkProviderSettings.Factory chunkprovidersettings$factory = ChunkProviderSettings.Factory.jsonToFactory("{ \"coordinateScale\":684.412, \"heightScale\":684.412, \"upperLimitScale\":512.0, \"lowerLimitScale\":512.0, \"depthNoiseScaleX\":200.0, \"depthNoiseScaleZ\":200.0, \"depthNoiseScaleExponent\":0.5, \"mainNoiseScaleX\":5000.0, \"mainNoiseScaleY\":1000.0, \"mainNoiseScaleZ\":5000.0, \"baseSize\":8.5, \"stretchY\":8.0, \"biomeDepthWeight\":2.0, \"biomeDepthOffset\":0.5, \"biomeScaleWeight\":2.0, \"biomeScaleOffset\":0.375, \"useCaves\":true, \"useDungeons\":true, \"dungeonChance\":8, \"useStrongholds\":true, \"useVillages\":true, \"useMineShafts\":true, \"useTemples\":true, \"useRavines\":true, \"useWaterLakes\":true, \"waterLakeChance\":4, \"useLavaLakes\":true, \"lavaLakeChance\":80, \"useLavaOceans\":false, \"seaLevel\":255 }"); + ResourceLocation resourcelocation = new ResourceLocation("textures/gui/presets/water.png"); + field_175310_f.add(new GuiScreenCustomizePresets.Info(I18n.format("createWorld.customize.custom.preset.waterWorld", new Object[0]), resourcelocation, chunkprovidersettings$factory)); + chunkprovidersettings$factory = ChunkProviderSettings.Factory.jsonToFactory("{\"coordinateScale\":3000.0, \"heightScale\":6000.0, \"upperLimitScale\":250.0, \"lowerLimitScale\":512.0, \"depthNoiseScaleX\":200.0, \"depthNoiseScaleZ\":200.0, \"depthNoiseScaleExponent\":0.5, \"mainNoiseScaleX\":80.0, \"mainNoiseScaleY\":160.0, \"mainNoiseScaleZ\":80.0, \"baseSize\":8.5, \"stretchY\":10.0, \"biomeDepthWeight\":1.0, \"biomeDepthOffset\":0.0, \"biomeScaleWeight\":1.0, \"biomeScaleOffset\":0.0, \"useCaves\":true, \"useDungeons\":true, \"dungeonChance\":8, \"useStrongholds\":true, \"useVillages\":true, \"useMineShafts\":true, \"useTemples\":true, \"useRavines\":true, \"useWaterLakes\":true, \"waterLakeChance\":4, \"useLavaLakes\":true, \"lavaLakeChance\":80, \"useLavaOceans\":false, \"seaLevel\":63 }"); + resourcelocation = new ResourceLocation("textures/gui/presets/isles.png"); + field_175310_f.add(new GuiScreenCustomizePresets.Info(I18n.format("createWorld.customize.custom.preset.isleLand", new Object[0]), resourcelocation, chunkprovidersettings$factory)); + chunkprovidersettings$factory = ChunkProviderSettings.Factory.jsonToFactory("{\"coordinateScale\":684.412, \"heightScale\":684.412, \"upperLimitScale\":512.0, \"lowerLimitScale\":512.0, \"depthNoiseScaleX\":200.0, \"depthNoiseScaleZ\":200.0, \"depthNoiseScaleExponent\":0.5, \"mainNoiseScaleX\":5000.0, \"mainNoiseScaleY\":1000.0, \"mainNoiseScaleZ\":5000.0, \"baseSize\":8.5, \"stretchY\":5.0, \"biomeDepthWeight\":2.0, \"biomeDepthOffset\":1.0, \"biomeScaleWeight\":4.0, \"biomeScaleOffset\":1.0, \"useCaves\":true, \"useDungeons\":true, \"dungeonChance\":8, \"useStrongholds\":true, \"useVillages\":true, \"useMineShafts\":true, \"useTemples\":true, \"useRavines\":true, \"useWaterLakes\":true, \"waterLakeChance\":4, \"useLavaLakes\":true, \"lavaLakeChance\":80, \"useLavaOceans\":false, \"seaLevel\":63 }"); + resourcelocation = new ResourceLocation("textures/gui/presets/delight.png"); + field_175310_f.add(new GuiScreenCustomizePresets.Info(I18n.format("createWorld.customize.custom.preset.caveDelight", new Object[0]), resourcelocation, chunkprovidersettings$factory)); + chunkprovidersettings$factory = ChunkProviderSettings.Factory.jsonToFactory("{\"coordinateScale\":738.41864, \"heightScale\":157.69133, \"upperLimitScale\":801.4267, \"lowerLimitScale\":1254.1643, \"depthNoiseScaleX\":374.93652, \"depthNoiseScaleZ\":288.65228, \"depthNoiseScaleExponent\":1.2092624, \"mainNoiseScaleX\":1355.9908, \"mainNoiseScaleY\":745.5343, \"mainNoiseScaleZ\":1183.464, \"baseSize\":1.8758626, \"stretchY\":1.7137525, \"biomeDepthWeight\":1.7553768, \"biomeDepthOffset\":3.4701107, \"biomeScaleWeight\":1.0, \"biomeScaleOffset\":2.535211, \"useCaves\":true, \"useDungeons\":true, \"dungeonChance\":8, \"useStrongholds\":true, \"useVillages\":true, \"useMineShafts\":true, \"useTemples\":true, \"useRavines\":true, \"useWaterLakes\":true, \"waterLakeChance\":4, \"useLavaLakes\":true, \"lavaLakeChance\":80, \"useLavaOceans\":false, \"seaLevel\":63 }"); + resourcelocation = new ResourceLocation("textures/gui/presets/madness.png"); + field_175310_f.add(new GuiScreenCustomizePresets.Info(I18n.format("createWorld.customize.custom.preset.mountains", new Object[0]), resourcelocation, chunkprovidersettings$factory)); + chunkprovidersettings$factory = ChunkProviderSettings.Factory.jsonToFactory("{\"coordinateScale\":684.412, \"heightScale\":684.412, \"upperLimitScale\":512.0, \"lowerLimitScale\":512.0, \"depthNoiseScaleX\":200.0, \"depthNoiseScaleZ\":200.0, \"depthNoiseScaleExponent\":0.5, \"mainNoiseScaleX\":1000.0, \"mainNoiseScaleY\":3000.0, \"mainNoiseScaleZ\":1000.0, \"baseSize\":8.5, \"stretchY\":10.0, \"biomeDepthWeight\":1.0, \"biomeDepthOffset\":0.0, \"biomeScaleWeight\":1.0, \"biomeScaleOffset\":0.0, \"useCaves\":true, \"useDungeons\":true, \"dungeonChance\":8, \"useStrongholds\":true, \"useVillages\":true, \"useMineShafts\":true, \"useTemples\":true, \"useRavines\":true, \"useWaterLakes\":true, \"waterLakeChance\":4, \"useLavaLakes\":true, \"lavaLakeChance\":80, \"useLavaOceans\":false, \"seaLevel\":20 }"); + resourcelocation = new ResourceLocation("textures/gui/presets/drought.png"); + field_175310_f.add(new GuiScreenCustomizePresets.Info(I18n.format("createWorld.customize.custom.preset.drought", new Object[0]), resourcelocation, chunkprovidersettings$factory)); + chunkprovidersettings$factory = ChunkProviderSettings.Factory.jsonToFactory("{\"coordinateScale\":684.412, \"heightScale\":684.412, \"upperLimitScale\":2.0, \"lowerLimitScale\":64.0, \"depthNoiseScaleX\":200.0, \"depthNoiseScaleZ\":200.0, \"depthNoiseScaleExponent\":0.5, \"mainNoiseScaleX\":80.0, \"mainNoiseScaleY\":160.0, \"mainNoiseScaleZ\":80.0, \"baseSize\":8.5, \"stretchY\":12.0, \"biomeDepthWeight\":1.0, \"biomeDepthOffset\":0.0, \"biomeScaleWeight\":1.0, \"biomeScaleOffset\":0.0, \"useCaves\":true, \"useDungeons\":true, \"dungeonChance\":8, \"useStrongholds\":true, \"useVillages\":true, \"useMineShafts\":true, \"useTemples\":true, \"useRavines\":true, \"useWaterLakes\":true, \"waterLakeChance\":4, \"useLavaLakes\":true, \"lavaLakeChance\":80, \"useLavaOceans\":false, \"seaLevel\":6 }"); + resourcelocation = new ResourceLocation("textures/gui/presets/chaos.png"); + field_175310_f.add(new GuiScreenCustomizePresets.Info(I18n.format("createWorld.customize.custom.preset.caveChaos", new Object[0]), resourcelocation, chunkprovidersettings$factory)); + chunkprovidersettings$factory = ChunkProviderSettings.Factory.jsonToFactory("{\"coordinateScale\":684.412, \"heightScale\":684.412, \"upperLimitScale\":512.0, \"lowerLimitScale\":512.0, \"depthNoiseScaleX\":200.0, \"depthNoiseScaleZ\":200.0, \"depthNoiseScaleExponent\":0.5, \"mainNoiseScaleX\":80.0, \"mainNoiseScaleY\":160.0, \"mainNoiseScaleZ\":80.0, \"baseSize\":8.5, \"stretchY\":12.0, \"biomeDepthWeight\":1.0, \"biomeDepthOffset\":0.0, \"biomeScaleWeight\":1.0, \"biomeScaleOffset\":0.0, \"useCaves\":true, \"useDungeons\":true, \"dungeonChance\":8, \"useStrongholds\":true, \"useVillages\":true, \"useMineShafts\":true, \"useTemples\":true, \"useRavines\":true, \"useWaterLakes\":true, \"waterLakeChance\":4, \"useLavaLakes\":true, \"lavaLakeChance\":80, \"useLavaOceans\":true, \"seaLevel\":40 }"); + resourcelocation = new ResourceLocation("textures/gui/presets/luck.png"); + field_175310_f.add(new GuiScreenCustomizePresets.Info(I18n.format("createWorld.customize.custom.preset.goodLuck", new Object[0]), resourcelocation, chunkprovidersettings$factory)); + } + + static class Info + { + public String field_178955_a; + public ResourceLocation field_178953_b; + public ChunkProviderSettings.Factory field_178954_c; + + public Info(String p_i45523_1_, ResourceLocation p_i45523_2_, ChunkProviderSettings.Factory p_i45523_3_) + { + this.field_178955_a = p_i45523_1_; + this.field_178953_b = p_i45523_2_; + this.field_178954_c = p_i45523_3_; + } + } + + class ListPreset extends GuiSlot + { + public int field_178053_u = -1; + + public ListPreset() + { + super(GuiScreenCustomizePresets.this.mc, GuiScreenCustomizePresets.this.width, GuiScreenCustomizePresets.this.height, 80, GuiScreenCustomizePresets.this.height - 32, 38); + } + + protected int getSize() + { + return GuiScreenCustomizePresets.field_175310_f.size(); + } + + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + this.field_178053_u = slotIndex; + GuiScreenCustomizePresets.this.func_175304_a(); + GuiScreenCustomizePresets.this.field_175317_i.setText(((GuiScreenCustomizePresets.Info)GuiScreenCustomizePresets.field_175310_f.get(GuiScreenCustomizePresets.this.field_175311_g.field_178053_u)).field_178954_c.toString()); + } + + protected boolean isSelected(int slotIndex) + { + return slotIndex == this.field_178053_u; + } + + protected void drawBackground() + { + } + + private void func_178051_a(int p_178051_1_, int p_178051_2_, ResourceLocation p_178051_3_) + { + int i = p_178051_1_ + 5; + GuiScreenCustomizePresets.this.drawHorizontalLine(i - 1, i + 32, p_178051_2_ - 1, -2039584); + GuiScreenCustomizePresets.this.drawHorizontalLine(i - 1, i + 32, p_178051_2_ + 32, -6250336); + GuiScreenCustomizePresets.this.drawVerticalLine(i - 1, p_178051_2_ - 1, p_178051_2_ + 32, -2039584); + GuiScreenCustomizePresets.this.drawVerticalLine(i + 32, p_178051_2_ - 1, p_178051_2_ + 32, -6250336); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(p_178051_3_); + int j = 32; + int k = 32; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((double)(i + 0), (double)(p_178051_2_ + 32), 0.0D).tex(0.0D, 1.0D).endVertex(); + worldrenderer.pos((double)(i + 32), (double)(p_178051_2_ + 32), 0.0D).tex(1.0D, 1.0D).endVertex(); + worldrenderer.pos((double)(i + 32), (double)(p_178051_2_ + 0), 0.0D).tex(1.0D, 0.0D).endVertex(); + worldrenderer.pos((double)(i + 0), (double)(p_178051_2_ + 0), 0.0D).tex(0.0D, 0.0D).endVertex(); + tessellator.draw(); + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + GuiScreenCustomizePresets.Info guiscreencustomizepresets$info = (GuiScreenCustomizePresets.Info)GuiScreenCustomizePresets.field_175310_f.get(entryID); + this.func_178051_a(p_180791_2_, p_180791_3_, guiscreencustomizepresets$info.field_178953_b); + GuiScreenCustomizePresets.this.fontRendererObj.drawString(guiscreencustomizepresets$info.field_178955_a, p_180791_2_ + 32 + 10, p_180791_3_ + 14, 16777215); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiScreenDemo.java b/src/minecraft/net/minecraft/client/gui/GuiScreenDemo.java new file mode 100644 index 0000000..9ea800f --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiScreenDemo.java @@ -0,0 +1,97 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import java.net.URI; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.util.ResourceLocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class GuiScreenDemo extends GuiScreen +{ + private static final Logger logger = LogManager.getLogger(); + private static final ResourceLocation field_146348_f = new ResourceLocation("textures/gui/demo_background.png"); + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.clear(); + int i = -16; + this.buttonList.add(new GuiButton(1, this.width / 2 - 116, this.height / 2 + 62 + i, 114, 20, I18n.format("demo.help.buy", new Object[0]))); + this.buttonList.add(new GuiButton(2, this.width / 2 + 2, this.height / 2 + 62 + i, 114, 20, I18n.format("demo.help.later", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + switch (button.id) + { + case 1: + button.enabled = false; + + try + { + Class oclass = Class.forName("java.awt.Desktop"); + Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]); + oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {new URI("http://www.minecraft.net/store?source=demo")}); + } + catch (Throwable throwable) + { + logger.error("Couldn\'t open link", throwable); + } + + break; + + case 2: + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + } + + /** + * Draws either a gradient over the background screen (when it exists) or a flat gradient over background.png + */ + public void drawDefaultBackground() + { + super.drawDefaultBackground(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(field_146348_f); + int i = (this.width - 248) / 2; + int j = (this.height - 166) / 2; + this.drawTexturedModalRect(i, j, 0, 0, 248, 166); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + int i = (this.width - 248) / 2 + 10; + int j = (this.height - 166) / 2 + 8; + this.fontRendererObj.drawString(I18n.format("demo.help.title", new Object[0]), i, j, 2039583); + j = j + 12; + GameSettings gamesettings = this.mc.gameSettings; + this.fontRendererObj.drawString(I18n.format("demo.help.movementShort", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindForward.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindLeft.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindBack.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindRight.getKeyCode())}), i, j, 5197647); + this.fontRendererObj.drawString(I18n.format("demo.help.movementMouse", new Object[0]), i, j + 12, 5197647); + this.fontRendererObj.drawString(I18n.format("demo.help.jump", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindJump.getKeyCode())}), i, j + 24, 5197647); + this.fontRendererObj.drawString(I18n.format("demo.help.inventory", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindInventory.getKeyCode())}), i, j + 36, 5197647); + this.fontRendererObj.drawSplitString(I18n.format("demo.help.fullWrapped", new Object[0]), i, j + 68, 218, 2039583); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiScreenOptionsSounds.java b/src/minecraft/net/minecraft/client/gui/GuiScreenOptionsSounds.java new file mode 100644 index 0000000..d9b3877 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiScreenOptionsSounds.java @@ -0,0 +1,165 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.audio.SoundCategory; +import net.minecraft.client.audio.SoundHandler; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class GuiScreenOptionsSounds extends GuiScreen +{ + private final GuiScreen field_146505_f; + + /** Reference to the GameSettings object. */ + private final GameSettings game_settings_4; + protected String field_146507_a = "Options"; + private String field_146508_h; + + public GuiScreenOptionsSounds(GuiScreen p_i45025_1_, GameSettings p_i45025_2_) + { + this.field_146505_f = p_i45025_1_; + this.game_settings_4 = p_i45025_2_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + int i = 0; + this.field_146507_a = I18n.format("options.sounds.title", new Object[0]); + this.field_146508_h = I18n.format("options.off", new Object[0]); + this.buttonList.add(new GuiScreenOptionsSounds.Button(SoundCategory.MASTER.getCategoryId(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), SoundCategory.MASTER, true)); + i = i + 2; + + for (SoundCategory soundcategory : SoundCategory.values()) + { + if (soundcategory != SoundCategory.MASTER) + { + this.buttonList.add(new GuiScreenOptionsSounds.Button(soundcategory.getCategoryId(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), soundcategory, false)); + ++i; + } + } + + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.field_146505_f); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.field_146507_a, this.width / 2, 15, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + protected String getSoundVolume(SoundCategory p_146504_1_) + { + float f = this.game_settings_4.getSoundLevel(p_146504_1_); + return f == 0.0F ? this.field_146508_h : (int)(f * 100.0F) + "%"; + } + + class Button extends GuiButton + { + private final SoundCategory field_146153_r; + private final String field_146152_s; + public float field_146156_o = 1.0F; + public boolean field_146155_p; + + public Button(int p_i45024_2_, int p_i45024_3_, int p_i45024_4_, SoundCategory p_i45024_5_, boolean p_i45024_6_) + { + super(p_i45024_2_, p_i45024_3_, p_i45024_4_, p_i45024_6_ ? 310 : 150, 20, ""); + this.field_146153_r = p_i45024_5_; + this.field_146152_s = I18n.format("soundCategory." + p_i45024_5_.getCategoryName(), new Object[0]); + this.displayString = this.field_146152_s + ": " + GuiScreenOptionsSounds.this.getSoundVolume(p_i45024_5_); + this.field_146156_o = GuiScreenOptionsSounds.this.game_settings_4.getSoundLevel(p_i45024_5_); + } + + protected int getHoverState(boolean mouseOver) + { + return 0; + } + + protected void mouseDragged(Minecraft mc, int mouseX, int mouseY) + { + if (this.visible) + { + if (this.field_146155_p) + { + this.field_146156_o = (float)(mouseX - (this.xPosition + 4)) / (float)(this.width - 8); + this.field_146156_o = MathHelper.clamp_float(this.field_146156_o, 0.0F, 1.0F); + mc.gameSettings.setSoundLevel(this.field_146153_r, this.field_146156_o); + mc.gameSettings.saveOptions(); + this.displayString = this.field_146152_s + ": " + GuiScreenOptionsSounds.this.getSoundVolume(this.field_146153_r); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.xPosition + (int)(this.field_146156_o * (float)(this.width - 8)), this.yPosition, 0, 66, 4, 20); + this.drawTexturedModalRect(this.xPosition + (int)(this.field_146156_o * (float)(this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20); + } + } + + public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) + { + if (super.mousePressed(mc, mouseX, mouseY)) + { + this.field_146156_o = (float)(mouseX - (this.xPosition + 4)) / (float)(this.width - 8); + this.field_146156_o = MathHelper.clamp_float(this.field_146156_o, 0.0F, 1.0F); + mc.gameSettings.setSoundLevel(this.field_146153_r, this.field_146156_o); + mc.gameSettings.saveOptions(); + this.displayString = this.field_146152_s + ": " + GuiScreenOptionsSounds.this.getSoundVolume(this.field_146153_r); + this.field_146155_p = true; + return true; + } + else + { + return false; + } + } + + public void playPressSound(SoundHandler soundHandlerIn) + { + } + + public void mouseReleased(int mouseX, int mouseY) + { + if (this.field_146155_p) + { + if (this.field_146153_r == SoundCategory.MASTER) + { + float f = 1.0F; + } + else + { + GuiScreenOptionsSounds.this.game_settings_4.getSoundLevel(this.field_146153_r); + } + + GuiScreenOptionsSounds.this.mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + } + + this.field_146155_p = false; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiScreenRealmsProxy.java b/src/minecraft/net/minecraft/client/gui/GuiScreenRealmsProxy.java new file mode 100644 index 0000000..fc6c2b5 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiScreenRealmsProxy.java @@ -0,0 +1,245 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import net.minecraft.item.ItemStack; +import net.minecraft.realms.RealmsButton; +import net.minecraft.realms.RealmsScreen; + +public class GuiScreenRealmsProxy extends GuiScreen +{ + private static RealmsScreen field_154330_a; + + public GuiScreenRealmsProxy(RealmsScreen p_i1087_1_) + { + this.field_154330_a = p_i1087_1_; + super.buttonList = Collections.synchronizedList(Lists.newArrayList()); + } + + public RealmsScreen func_154321_a() + { + return this.field_154330_a; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.field_154330_a.init(); + super.initGui(); + } + + public void func_154325_a(String p_154325_1_, int p_154325_2_, int p_154325_3_, int p_154325_4_) + { + super.drawCenteredString(this.fontRendererObj, p_154325_1_, p_154325_2_, p_154325_3_, p_154325_4_); + } + + public void func_154322_b(String p_154322_1_, int p_154322_2_, int p_154322_3_, int p_154322_4_) + { + super.drawString(this.fontRendererObj, p_154322_1_, p_154322_2_, p_154322_3_, p_154322_4_); + } + + /** + * Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height + */ + public void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) + { + field_154330_a.blit(x, y, textureX, textureY, width, height); + drawTexturedModalRect(x, y, textureX, textureY, width, height); + } + + /** + * Draws a rectangle with a vertical gradient between the specified colors (ARGB format). Args : x1, y1, x2, y2, + * topColor, bottomColor + */ + public void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) + { + super.drawGradientRect(left, top, right, bottom, startColor, endColor); + } + + /** + * Draws either a gradient over the background screen (when it exists) or a flat gradient over background.png + */ + public void drawDefaultBackground() + { + super.drawDefaultBackground(); + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return super.doesGuiPauseGame(); + } + + public void drawWorldBackground(int tint) + { + super.drawWorldBackground(tint); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.field_154330_a.render(mouseX, mouseY, partialTicks); + } + + public void renderToolTip(ItemStack stack, int x, int y) + { + super.renderToolTip(stack, x, y); + } + + /** + * Draws the text when mouse is over creative inventory tab. Params: current creative tab to be checked, current + * mouse x position, current mouse y position. + */ + public void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY) + { + super.drawCreativeTabHoveringText(tabName, mouseX, mouseY); + } + + /** + * Draws a List of strings as a tooltip. Every entry is drawn on a seperate line. + */ + public void drawHoveringText(List textLines, int x, int y) + { + super.drawHoveringText(textLines, x, y); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.field_154330_a.tick(); + super.updateScreen(); + } + + public int func_154329_h() + { + return this.fontRendererObj.FONT_HEIGHT; + } + + public int func_154326_c(String p_154326_1_) + { + return this.fontRendererObj.getStringWidth(p_154326_1_); + } + + public void func_154319_c(String p_154319_1_, int p_154319_2_, int p_154319_3_, int p_154319_4_) + { + this.fontRendererObj.drawStringWithShadow(p_154319_1_, (float)p_154319_2_, (float)p_154319_3_, p_154319_4_); + } + + public List func_154323_a(String p_154323_1_, int p_154323_2_) + { + return this.fontRendererObj.listFormattedStringToWidth(p_154323_1_, p_154323_2_); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + public final void actionPerformed(GuiButton button) throws IOException + { + this.field_154330_a.buttonClicked(((GuiButtonRealmsProxy)button).getRealmsButton()); + } + + public void func_154324_i() + { + super.buttonList.clear(); + } + + public void func_154327_a(RealmsButton p_154327_1_) + { + super.buttonList.add(p_154327_1_.getProxy()); + } + + public List func_154320_j() + { + List list = Lists.newArrayListWithExpectedSize(super.buttonList.size()); + + for (GuiButton guibutton : super.buttonList) + { + list.add(((GuiButtonRealmsProxy)guibutton).getRealmsButton()); + } + + return list; + } + + public void func_154328_b(RealmsButton p_154328_1_) + { + super.buttonList.remove(p_154328_1_); + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + this.field_154330_a.mouseClicked(mouseX, mouseY, mouseButton); + super.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + this.field_154330_a.mouseEvent(); + super.handleMouseInput(); + } + + /** + * Handles keyboard input. + */ + public void handleKeyboardInput() throws IOException + { + this.field_154330_a.keyboardEvent(); + super.handleKeyboardInput(); + } + + /** + * Called when a mouse button is released. Args : mouseX, mouseY, releaseButton + */ + public void mouseReleased(int mouseX, int mouseY, int state) + { + this.field_154330_a.mouseReleased(mouseX, mouseY, state); + } + + /** + * Called when a mouse button is pressed and the mouse is moved around. Parameters are : mouseX, mouseY, + * lastButtonClicked & timeSinceMouseClick. + */ + public void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) + { + this.field_154330_a.mouseDragged(mouseX, mouseY, clickedMouseButton, timeSinceLastClick); + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + public void keyTyped(char typedChar, int keyCode) throws IOException + { + this.field_154330_a.keyPressed(typedChar, keyCode); + } + + public void confirmClicked(boolean result, int id) + { + this.field_154330_a.confirmResult(result, id); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + this.field_154330_a.removed(); + super.onGuiClosed(); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiScreenResourcePacks.java b/src/minecraft/net/minecraft/client/gui/GuiScreenResourcePacks.java new file mode 100644 index 0000000..c368cec --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiScreenResourcePacks.java @@ -0,0 +1,243 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.util.Collections; +import java.util.List; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.resources.ResourcePackListEntry; +import net.minecraft.client.resources.ResourcePackListEntryDefault; +import net.minecraft.client.resources.ResourcePackListEntryFound; +import net.minecraft.client.resources.ResourcePackRepository; +import net.minecraft.util.Util; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.Sys; + +public class GuiScreenResourcePacks extends GuiScreen +{ + private static final Logger logger = LogManager.getLogger(); + private final GuiScreen parentScreen; + private List availableResourcePacks; + private List selectedResourcePacks; + + /** List component that contains the available resource packs */ + private GuiResourcePackAvailable availableResourcePacksList; + + /** List component that contains the selected resource packs */ + private GuiResourcePackSelected selectedResourcePacksList; + private boolean changed = false; + + public GuiScreenResourcePacks(GuiScreen parentScreenIn) + { + this.parentScreen = parentScreenIn; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.add(new GuiOptionButton(2, this.width / 2 - 154, this.height - 48, I18n.format("resourcePack.openFolder", new Object[0]))); + this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 4, this.height - 48, I18n.format("gui.done", new Object[0]))); + + if (!this.changed) + { + this.availableResourcePacks = Lists.newArrayList(); + this.selectedResourcePacks = Lists.newArrayList(); + ResourcePackRepository resourcepackrepository = this.mc.getResourcePackRepository(); + resourcepackrepository.updateRepositoryEntriesAll(); + List list = Lists.newArrayList(resourcepackrepository.getRepositoryEntriesAll()); + list.removeAll(resourcepackrepository.getRepositoryEntries()); + + for (ResourcePackRepository.Entry resourcepackrepository$entry : list) + { + this.availableResourcePacks.add(new ResourcePackListEntryFound(this, resourcepackrepository$entry)); + } + + for (ResourcePackRepository.Entry resourcepackrepository$entry1 : Lists.reverse(resourcepackrepository.getRepositoryEntries())) + { + this.selectedResourcePacks.add(new ResourcePackListEntryFound(this, resourcepackrepository$entry1)); + } + + this.selectedResourcePacks.add(new ResourcePackListEntryDefault(this)); + } + + this.availableResourcePacksList = new GuiResourcePackAvailable(this.mc, 200, this.height, this.availableResourcePacks); + this.availableResourcePacksList.setSlotXBoundsFromLeft(this.width / 2 - 4 - 200); + this.availableResourcePacksList.registerScrollButtons(7, 8); + this.selectedResourcePacksList = new GuiResourcePackSelected(this.mc, 200, this.height, this.selectedResourcePacks); + this.selectedResourcePacksList.setSlotXBoundsFromLeft(this.width / 2 + 4); + this.selectedResourcePacksList.registerScrollButtons(7, 8); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + this.selectedResourcePacksList.handleMouseInput(); + this.availableResourcePacksList.handleMouseInput(); + } + + public boolean hasResourcePackEntry(ResourcePackListEntry p_146961_1_) + { + return this.selectedResourcePacks.contains(p_146961_1_); + } + + public List getListContaining(ResourcePackListEntry p_146962_1_) + { + return this.hasResourcePackEntry(p_146962_1_) ? this.selectedResourcePacks : this.availableResourcePacks; + } + + public List getAvailableResourcePacks() + { + return this.availableResourcePacks; + } + + public List getSelectedResourcePacks() + { + return this.selectedResourcePacks; + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 2) + { + File file1 = this.mc.getResourcePackRepository().getDirResourcepacks(); + String s = file1.getAbsolutePath(); + + if (Util.getOSType() == Util.EnumOS.OSX) + { + try + { + logger.info(s); + Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s}); + return; + } + catch (IOException ioexception1) + { + logger.error((String)"Couldn\'t open file", (Throwable)ioexception1); + } + } + else if (Util.getOSType() == Util.EnumOS.WINDOWS) + { + String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {s}); + + try + { + Runtime.getRuntime().exec(s1); + return; + } + catch (IOException ioexception) + { + logger.error((String)"Couldn\'t open file", (Throwable)ioexception); + } + } + + boolean flag = false; + + try + { + Class oclass = Class.forName("java.awt.Desktop"); + Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]); + oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {file1.toURI()}); + } + catch (Throwable throwable) + { + logger.error("Couldn\'t open link", throwable); + flag = true; + } + + if (flag) + { + logger.info("Opening via system class!"); + Sys.openURL("file://" + s); + } + } + else if (button.id == 1) + { + if (this.changed) + { + List list = Lists.newArrayList(); + + for (ResourcePackListEntry resourcepacklistentry : this.selectedResourcePacks) + { + if (resourcepacklistentry instanceof ResourcePackListEntryFound) + { + list.add(((ResourcePackListEntryFound)resourcepacklistentry).func_148318_i()); + } + } + + Collections.reverse(list); + this.mc.getResourcePackRepository().setRepositories(list); + this.mc.gameSettings.resourcePacks.clear(); + this.mc.gameSettings.field_183018_l.clear(); + + for (ResourcePackRepository.Entry resourcepackrepository$entry : list) + { + this.mc.gameSettings.resourcePacks.add(resourcepackrepository$entry.getResourcePackName()); + + if (resourcepackrepository$entry.func_183027_f() != 1) + { + this.mc.gameSettings.field_183018_l.add(resourcepackrepository$entry.getResourcePackName()); + } + } + + this.mc.gameSettings.saveOptions(); + this.mc.refreshResources(); + } + + this.mc.displayGuiScreen(this.parentScreen); + } + } + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + super.mouseClicked(mouseX, mouseY, mouseButton); + this.availableResourcePacksList.mouseClicked(mouseX, mouseY, mouseButton); + this.selectedResourcePacksList.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Called when a mouse button is released. Args : mouseX, mouseY, releaseButton + */ + protected void mouseReleased(int mouseX, int mouseY, int state) + { + super.mouseReleased(mouseX, mouseY, state); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawBackground(0); + this.availableResourcePacksList.drawScreen(mouseX, mouseY, partialTicks); + this.selectedResourcePacksList.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.fontRendererObj, I18n.format("resourcePack.title", new Object[0]), this.width / 2, 16, 16777215); + this.drawCenteredString(this.fontRendererObj, I18n.format("resourcePack.folderInfo", new Object[0]), this.width / 2 - 77, this.height - 26, 8421504); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /** + * Marks the selected resource packs list as changed to trigger a resource reload when the screen is closed + */ + public void markChanged() + { + this.changed = true; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiScreenServerList.java b/src/minecraft/net/minecraft/client/gui/GuiScreenServerList.java new file mode 100644 index 0000000..3941747 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiScreenServerList.java @@ -0,0 +1,110 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.resources.I18n; +import org.lwjgl.input.Keyboard; + +public class GuiScreenServerList extends GuiScreen +{ + private final GuiScreen field_146303_a; + private final ServerData field_146301_f; + private GuiTextField field_146302_g; + + public GuiScreenServerList(GuiScreen p_i1031_1_, ServerData p_i1031_2_) + { + this.field_146303_a = p_i1031_1_; + this.field_146301_f = p_i1031_2_; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.field_146302_g.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.format("selectServer.select", new Object[0]))); + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel", new Object[0]))); + this.field_146302_g = new GuiTextField(2, this.fontRendererObj, this.width / 2 - 100, 116, 200, 20); + this.field_146302_g.setMaxStringLength(128); + this.field_146302_g.setFocused(true); + this.field_146302_g.setText(this.mc.gameSettings.lastServer); + ((GuiButton)this.buttonList.get(0)).enabled = this.field_146302_g.getText().length() > 0 && this.field_146302_g.getText().split(":").length > 0; + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + this.mc.gameSettings.lastServer = this.field_146302_g.getText(); + this.mc.gameSettings.saveOptions(); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 1) + { + this.field_146303_a.confirmClicked(false, 0); + } + else if (button.id == 0) + { + this.field_146301_f.serverIP = this.field_146302_g.getText(); + this.field_146303_a.confirmClicked(true, 0); + } + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (this.field_146302_g.textboxKeyTyped(typedChar, keyCode)) + { + ((GuiButton)this.buttonList.get(0)).enabled = this.field_146302_g.getText().length() > 0 && this.field_146302_g.getText().split(":").length > 0; + } + else if (keyCode == 28 || keyCode == 156) + { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + super.mouseClicked(mouseX, mouseY, mouseButton); + this.field_146302_g.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, I18n.format("selectServer.direct", new Object[0]), this.width / 2, 20, 16777215); + this.drawString(this.fontRendererObj, I18n.format("addServer.enterIp", new Object[0]), this.width / 2 - 100, 100, 10526880); + this.field_146302_g.drawTextBox(); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiScreenWorking.java b/src/minecraft/net/minecraft/client/gui/GuiScreenWorking.java new file mode 100644 index 0000000..e71f7f0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiScreenWorking.java @@ -0,0 +1,72 @@ +package net.minecraft.client.gui; + +import net.minecraft.util.IProgressUpdate; + +public class GuiScreenWorking extends GuiScreen implements IProgressUpdate +{ + private String field_146591_a = ""; + private String field_146589_f = ""; + private int progress; + private boolean doneWorking; + + /** + * Shows the 'Saving level' string. + */ + public void displaySavingString(String message) + { + this.resetProgressAndMessage(message); + } + + /** + * this string, followed by "working..." and then the "% complete" are the 3 lines shown. This resets progress to 0, + * and the WorkingString to "working...". + */ + public void resetProgressAndMessage(String message) + { + this.field_146591_a = message; + this.displayLoadingString("Working..."); + } + + /** + * Displays a string on the loading screen supposed to indicate what is being done currently. + */ + public void displayLoadingString(String message) + { + this.field_146589_f = message; + this.setLoadingProgress(0); + } + + /** + * Updates the progress bar on the loading screen to the specified amount. Args: loadProgress + */ + public void setLoadingProgress(int progress) + { + this.progress = progress; + } + + public void setDoneWorking() + { + this.doneWorking = true; + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + if (this.doneWorking) + { + if (!this.mc.func_181540_al()) + { + this.mc.displayGuiScreen((GuiScreen)null); + } + } + else + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.field_146591_a, this.width / 2, 70, 16777215); + this.drawCenteredString(this.fontRendererObj, this.field_146589_f + " " + this.progress + "%", this.width / 2, 90, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiSelectWorld.java b/src/minecraft/net/minecraft/client/gui/GuiSelectWorld.java new file mode 100644 index 0000000..7643c89 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiSelectWorld.java @@ -0,0 +1,328 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.Date; +import net.minecraft.client.AnvilConverterException; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.storage.ISaveFormat; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.SaveFormatComparator; +import net.minecraft.world.storage.WorldInfo; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class GuiSelectWorld extends GuiScreen implements GuiYesNoCallback +{ + private static final Logger logger = LogManager.getLogger(); + private final DateFormat field_146633_h = new SimpleDateFormat(); + protected GuiScreen parentScreen; + protected String field_146628_f = "Select world"; + private boolean field_146634_i; + private int field_146640_r; + private java.util.List field_146639_s; + private GuiSelectWorld.List field_146638_t; + private String field_146637_u; + private String field_146636_v; + private String[] field_146635_w = new String[4]; + private boolean field_146643_x; + private GuiButton deleteButton; + private GuiButton selectButton; + private GuiButton renameButton; + private GuiButton recreateButton; + + public GuiSelectWorld(GuiScreen parentScreenIn) + { + this.parentScreen = parentScreenIn; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.field_146628_f = I18n.format("selectWorld.title", new Object[0]); + + try + { + this.func_146627_h(); + } + catch (AnvilConverterException anvilconverterexception) + { + logger.error((String)"Couldn\'t load level list", (Throwable)anvilconverterexception); + this.mc.displayGuiScreen(new GuiErrorScreen("Unable to load worlds", anvilconverterexception.getMessage())); + return; + } + + this.field_146637_u = I18n.format("selectWorld.world", new Object[0]); + this.field_146636_v = I18n.format("selectWorld.conversion", new Object[0]); + this.field_146635_w[WorldSettings.GameType.SURVIVAL.getID()] = I18n.format("gameMode.survival", new Object[0]); + this.field_146635_w[WorldSettings.GameType.CREATIVE.getID()] = I18n.format("gameMode.creative", new Object[0]); + this.field_146635_w[WorldSettings.GameType.ADVENTURE.getID()] = I18n.format("gameMode.adventure", new Object[0]); + this.field_146635_w[WorldSettings.GameType.SPECTATOR.getID()] = I18n.format("gameMode.spectator", new Object[0]); + this.field_146638_t = new GuiSelectWorld.List(this.mc); + this.field_146638_t.registerScrollButtons(4, 5); + this.func_146618_g(); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + this.field_146638_t.handleMouseInput(); + } + + private void func_146627_h() throws AnvilConverterException + { + ISaveFormat isaveformat = this.mc.getSaveLoader(); + this.field_146639_s = isaveformat.getSaveList(); + Collections.sort(this.field_146639_s); + this.field_146640_r = -1; + } + + protected String func_146621_a(int p_146621_1_) + { + return ((SaveFormatComparator)this.field_146639_s.get(p_146621_1_)).getFileName(); + } + + protected String func_146614_d(int p_146614_1_) + { + String s = ((SaveFormatComparator)this.field_146639_s.get(p_146614_1_)).getDisplayName(); + + if (StringUtils.isEmpty(s)) + { + s = I18n.format("selectWorld.world", new Object[0]) + " " + (p_146614_1_ + 1); + } + + return s; + } + + public void func_146618_g() + { + this.buttonList.add(this.selectButton = new GuiButton(1, this.width / 2 - 154, this.height - 52, 150, 20, I18n.format("selectWorld.select", new Object[0]))); + this.buttonList.add(new GuiButton(3, this.width / 2 + 4, this.height - 52, 150, 20, I18n.format("selectWorld.create", new Object[0]))); + this.buttonList.add(this.renameButton = new GuiButton(6, this.width / 2 - 154, this.height - 28, 72, 20, I18n.format("selectWorld.rename", new Object[0]))); + this.buttonList.add(this.deleteButton = new GuiButton(2, this.width / 2 - 76, this.height - 28, 72, 20, I18n.format("selectWorld.delete", new Object[0]))); + this.buttonList.add(this.recreateButton = new GuiButton(7, this.width / 2 + 4, this.height - 28, 72, 20, I18n.format("selectWorld.recreate", new Object[0]))); + this.buttonList.add(new GuiButton(0, this.width / 2 + 82, this.height - 28, 72, 20, I18n.format("gui.cancel", new Object[0]))); + this.selectButton.enabled = false; + this.deleteButton.enabled = false; + this.renameButton.enabled = false; + this.recreateButton.enabled = false; + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 2) + { + String s = this.func_146614_d(this.field_146640_r); + + if (s != null) + { + this.field_146643_x = true; + GuiYesNo guiyesno = func_152129_a(this, s, this.field_146640_r); + this.mc.displayGuiScreen(guiyesno); + } + } + else if (button.id == 1) + { + this.func_146615_e(this.field_146640_r); + } + else if (button.id == 3) + { + this.mc.displayGuiScreen(new GuiCreateWorld(this)); + } + else if (button.id == 6) + { + this.mc.displayGuiScreen(new GuiRenameWorld(this, this.func_146621_a(this.field_146640_r))); + } + else if (button.id == 0) + { + this.mc.displayGuiScreen(this.parentScreen); + } + else if (button.id == 7) + { + GuiCreateWorld guicreateworld = new GuiCreateWorld(this); + ISaveHandler isavehandler = this.mc.getSaveLoader().getSaveLoader(this.func_146621_a(this.field_146640_r), false); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); + isavehandler.flush(); + guicreateworld.func_146318_a(worldinfo); + this.mc.displayGuiScreen(guicreateworld); + } + else + { + this.field_146638_t.actionPerformed(button); + } + } + } + + public void func_146615_e(int p_146615_1_) + { + this.mc.displayGuiScreen((GuiScreen)null); + + if (!this.field_146634_i) + { + this.field_146634_i = true; + String s = this.func_146621_a(p_146615_1_); + + if (s == null) + { + s = "World" + p_146615_1_; + } + + String s1 = this.func_146614_d(p_146615_1_); + + if (s1 == null) + { + s1 = "World" + p_146615_1_; + } + + if (this.mc.getSaveLoader().canLoadWorld(s)) + { + this.mc.launchIntegratedServer(s, s1, (WorldSettings)null); + } + } + } + + public void confirmClicked(boolean result, int id) + { + if (this.field_146643_x) + { + this.field_146643_x = false; + + if (result) + { + ISaveFormat isaveformat = this.mc.getSaveLoader(); + isaveformat.flushCache(); + isaveformat.deleteWorldDirectory(this.func_146621_a(id)); + + try + { + this.func_146627_h(); + } + catch (AnvilConverterException anvilconverterexception) + { + logger.error((String)"Couldn\'t load level list", (Throwable)anvilconverterexception); + } + } + + this.mc.displayGuiScreen(this); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.field_146638_t.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.fontRendererObj, this.field_146628_f, this.width / 2, 20, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + public static GuiYesNo func_152129_a(GuiYesNoCallback p_152129_0_, String p_152129_1_, int p_152129_2_) + { + String s = I18n.format("selectWorld.deleteQuestion", new Object[0]); + String s1 = "\'" + p_152129_1_ + "\' " + I18n.format("selectWorld.deleteWarning", new Object[0]); + String s2 = I18n.format("selectWorld.deleteButton", new Object[0]); + String s3 = I18n.format("gui.cancel", new Object[0]); + GuiYesNo guiyesno = new GuiYesNo(p_152129_0_, s, s1, s2, s3, p_152129_2_); + return guiyesno; + } + + class List extends GuiSlot + { + public List(Minecraft mcIn) + { + super(mcIn, GuiSelectWorld.width, GuiSelectWorld.height, 32, GuiSelectWorld.height + 10, 36); + } + + protected int getSize() + { + return GuiSelectWorld.this.field_146639_s.size(); + } + + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + GuiSelectWorld.this.field_146640_r = slotIndex; + boolean flag = GuiSelectWorld.this.field_146640_r >= 0 && GuiSelectWorld.this.field_146640_r < this.getSize(); + GuiSelectWorld.this.selectButton.enabled = flag; + GuiSelectWorld.this.deleteButton.enabled = flag; + GuiSelectWorld.this.renameButton.enabled = flag; + GuiSelectWorld.this.recreateButton.enabled = flag; + + if (isDoubleClick && flag) + { + GuiSelectWorld.this.func_146615_e(slotIndex); + } + } + + protected boolean isSelected(int slotIndex) + { + return slotIndex == GuiSelectWorld.this.field_146640_r; + } + + protected int getContentHeight() + { + return GuiSelectWorld.this.field_146639_s.size() * 36; + } + + protected void drawBackground() + { + GuiSelectWorld.this.drawDefaultBackground(); + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + SaveFormatComparator saveformatcomparator = (SaveFormatComparator)GuiSelectWorld.this.field_146639_s.get(entryID); + String s = saveformatcomparator.getDisplayName(); + + if (StringUtils.isEmpty(s)) + { + s = GuiSelectWorld.this.field_146637_u + " " + (entryID + 1); + } + + String s1 = saveformatcomparator.getFileName(); + s1 = s1 + " (" + GuiSelectWorld.this.field_146633_h.format(new Date(saveformatcomparator.getLastTimePlayed())); + s1 = s1 + ")"; + String s2 = ""; + + if (saveformatcomparator.requiresConversion()) + { + s2 = GuiSelectWorld.this.field_146636_v + " " + s2; + } + else + { + s2 = GuiSelectWorld.this.field_146635_w[saveformatcomparator.getEnumGameType().getID()]; + + if (saveformatcomparator.isHardcoreModeEnabled()) + { + s2 = EnumChatFormatting.DARK_RED + I18n.format("gameMode.hardcore", new Object[0]) + EnumChatFormatting.RESET; + } + + if (saveformatcomparator.getCheatsEnabled()) + { + s2 = s2 + ", " + I18n.format("selectWorld.cheats", new Object[0]); + } + } + + GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, s, p_180791_2_ + 2, p_180791_3_ + 1, 16777215); + GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, s1, p_180791_2_ + 2, p_180791_3_ + 12, 8421504); + GuiSelectWorld.this.drawString(GuiSelectWorld.this.fontRendererObj, s2, p_180791_2_ + 2, p_180791_3_ + 12 + 10, 8421504); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiShareToLan.java b/src/minecraft/net/minecraft/client/gui/GuiShareToLan.java new file mode 100644 index 0000000..446a154 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiShareToLan.java @@ -0,0 +1,116 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.WorldSettings; + +public class GuiShareToLan extends GuiScreen +{ + private final GuiScreen field_146598_a; + private GuiButton field_146596_f; + private GuiButton field_146597_g; + private String field_146599_h = "survival"; + private boolean field_146600_i; + + public GuiShareToLan(GuiScreen p_i1055_1_) + { + this.field_146598_a = p_i1055_1_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.clear(); + this.buttonList.add(new GuiButton(101, this.width / 2 - 155, this.height - 28, 150, 20, I18n.format("lanServer.start", new Object[0]))); + this.buttonList.add(new GuiButton(102, this.width / 2 + 5, this.height - 28, 150, 20, I18n.format("gui.cancel", new Object[0]))); + this.buttonList.add(this.field_146597_g = new GuiButton(104, this.width / 2 - 155, 100, 150, 20, I18n.format("selectWorld.gameMode", new Object[0]))); + this.buttonList.add(this.field_146596_f = new GuiButton(103, this.width / 2 + 5, 100, 150, 20, I18n.format("selectWorld.allowCommands", new Object[0]))); + this.func_146595_g(); + } + + private void func_146595_g() + { + this.field_146597_g.displayString = I18n.format("selectWorld.gameMode", new Object[0]) + " " + I18n.format("selectWorld.gameMode." + this.field_146599_h, new Object[0]); + this.field_146596_f.displayString = I18n.format("selectWorld.allowCommands", new Object[0]) + " "; + + if (this.field_146600_i) + { + this.field_146596_f.displayString = this.field_146596_f.displayString + I18n.format("options.on", new Object[0]); + } + else + { + this.field_146596_f.displayString = this.field_146596_f.displayString + I18n.format("options.off", new Object[0]); + } + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.id == 102) + { + this.mc.displayGuiScreen(this.field_146598_a); + } + else if (button.id == 104) + { + if (this.field_146599_h.equals("spectator")) + { + this.field_146599_h = "creative"; + } + else if (this.field_146599_h.equals("creative")) + { + this.field_146599_h = "adventure"; + } + else if (this.field_146599_h.equals("adventure")) + { + this.field_146599_h = "survival"; + } + else + { + this.field_146599_h = "spectator"; + } + + this.func_146595_g(); + } + else if (button.id == 103) + { + this.field_146600_i = !this.field_146600_i; + this.func_146595_g(); + } + else if (button.id == 101) + { + this.mc.displayGuiScreen((GuiScreen)null); + String s = this.mc.getIntegratedServer().shareToLAN(WorldSettings.GameType.getByName(this.field_146599_h), this.field_146600_i); + IChatComponent ichatcomponent; + + if (s != null) + { + ichatcomponent = new ChatComponentTranslation("commands.publish.started", new Object[] {s}); + } + else + { + ichatcomponent = new ChatComponentText("commands.publish.failed"); + } + + this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, I18n.format("lanServer.title", new Object[0]), this.width / 2, 50, 16777215); + this.drawCenteredString(this.fontRendererObj, I18n.format("lanServer.otherPlayers", new Object[0]), this.width / 2, 82, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiSimpleScrolledSelectionListProxy.java b/src/minecraft/net/minecraft/client/gui/GuiSimpleScrolledSelectionListProxy.java new file mode 100644 index 0000000..90ade24 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiSimpleScrolledSelectionListProxy.java @@ -0,0 +1,157 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.realms.RealmsSimpleScrolledSelectionList; +import net.minecraft.util.MathHelper; + +public class GuiSimpleScrolledSelectionListProxy extends GuiSlot +{ + private final RealmsSimpleScrolledSelectionList field_178050_u; + + public GuiSimpleScrolledSelectionListProxy(RealmsSimpleScrolledSelectionList p_i45525_1_, int widthIn, int heightIn, int topIn, int bottomIn, int slotHeightIn) + { + super(Minecraft.getMinecraft(), widthIn, heightIn, topIn, bottomIn, slotHeightIn); + this.field_178050_u = p_i45525_1_; + } + + protected int getSize() + { + return this.field_178050_u.getItemCount(); + } + + /** + * The element in the slot that was clicked, boolean for whether it was double clicked or not + */ + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + this.field_178050_u.selectItem(slotIndex, isDoubleClick, mouseX, mouseY); + } + + /** + * Returns true if the element passed in is currently selected + */ + protected boolean isSelected(int slotIndex) + { + return this.field_178050_u.isSelectedItem(slotIndex); + } + + protected void drawBackground() + { + this.field_178050_u.renderBackground(); + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + this.field_178050_u.renderItem(entryID, p_180791_2_, p_180791_3_, p_180791_4_, mouseXIn, mouseYIn); + } + + public int getWidth() + { + return super.width; + } + + public int getMouseY() + { + return super.mouseY; + } + + public int getMouseX() + { + return super.mouseX; + } + + /** + * Return the height of the content being scrolled + */ + protected int getContentHeight() + { + return this.field_178050_u.getMaxPosition(); + } + + protected int getScrollBarX() + { + return this.field_178050_u.getScrollbarPosition(); + } + + public void handleMouseInput() + { + super.handleMouseInput(); + } + + public void drawScreen(int mouseXIn, int mouseYIn, float p_148128_3_) + { + if (this.field_178041_q) + { + this.mouseX = mouseXIn; + this.mouseY = mouseYIn; + this.drawBackground(); + int i = this.getScrollBarX(); + int j = i + 6; + this.bindAmountScrolled(); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; + int l = this.top + 4 - (int)this.amountScrolled; + + if (this.hasListHeader) + { + this.drawListHeader(k, l, tessellator); + } + + this.drawSelectionBox(k, l, mouseXIn, mouseYIn); + GlStateManager.disableDepth(); + int i1 = 4; + this.overlayBackground(0, this.top, 255, 255); + this.overlayBackground(this.bottom, this.height, 255, 255); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1); + GlStateManager.disableAlpha(); + GlStateManager.shadeModel(7425); + GlStateManager.disableTexture2D(); + int j1 = this.func_148135_f(); + + if (j1 > 0) + { + int k1 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight(); + k1 = MathHelper.clamp_int(k1, 32, this.bottom - this.top - 8); + int l1 = (int)this.amountScrolled * (this.bottom - this.top - k1) / j1 + this.top; + + if (l1 < this.top) + { + l1 = this.top; + } + + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)i, (double)this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)j, (double)this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)j, (double)this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)i, (double)this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex(); + tessellator.draw(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)i, (double)(l1 + k1), 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)j, (double)(l1 + k1), 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)j, (double)l1, 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)i, (double)l1, 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex(); + tessellator.draw(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)i, (double)(l1 + k1 - 1), 0.0D).tex(0.0D, 1.0D).color(192, 192, 192, 255).endVertex(); + worldrenderer.pos((double)(j - 1), (double)(l1 + k1 - 1), 0.0D).tex(1.0D, 1.0D).color(192, 192, 192, 255).endVertex(); + worldrenderer.pos((double)(j - 1), (double)l1, 0.0D).tex(1.0D, 0.0D).color(192, 192, 192, 255).endVertex(); + worldrenderer.pos((double)i, (double)l1, 0.0D).tex(0.0D, 0.0D).color(192, 192, 192, 255).endVertex(); + tessellator.draw(); + } + + this.func_148142_b(mouseXIn, mouseYIn); + GlStateManager.enableTexture2D(); + GlStateManager.shadeModel(7424); + GlStateManager.enableAlpha(); + GlStateManager.disableBlend(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiSleepMP.java b/src/minecraft/net/minecraft/client/gui/GuiSleepMP.java new file mode 100644 index 0000000..35b97a6 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiSleepMP.java @@ -0,0 +1,68 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.resources.I18n; +import net.minecraft.network.play.client.C0BPacketEntityAction; + +public class GuiSleepMP extends GuiChat +{ + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + super.initGui(); + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height - 40, I18n.format("multiplayer.stopSleeping", new Object[0]))); + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (keyCode == 1) + { + this.wakeFromSleep(); + } + else if (keyCode != 28 && keyCode != 156) + { + super.keyTyped(typedChar, keyCode); + } + else + { + String s = this.inputField.getText().trim(); + + if (!s.isEmpty()) + { + this.mc.thePlayer.sendChatMessage(s); + } + + this.inputField.setText(""); + this.mc.ingameGUI.getChatGUI().resetScroll(); + } + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.id == 1) + { + this.wakeFromSleep(); + } + else + { + super.actionPerformed(button); + } + } + + private void wakeFromSleep() + { + NetHandlerPlayClient nethandlerplayclient = this.mc.thePlayer.sendQueue; + nethandlerplayclient.addToSendQueue(new C0BPacketEntityAction(this.mc.thePlayer, C0BPacketEntityAction.Action.STOP_SLEEPING)); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiSlider.java b/src/minecraft/net/minecraft/client/gui/GuiSlider.java new file mode 100644 index 0000000..cfa08a5 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiSlider.java @@ -0,0 +1,149 @@ +package net.minecraft.client.gui; + +import java.awt.Color; + +import animeware.util.render.DrawUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; + +public class GuiSlider extends GuiButton +{ + private float sliderPosition = 1.0F; + public boolean isMouseDown; + private String name; + private final float min; + private final float max; + private final GuiPageButtonList.GuiResponder responder; + private GuiSlider.FormatHelper formatHelper; + + public GuiSlider(GuiPageButtonList.GuiResponder guiResponder, int idIn, int x, int y, String name, float min, float max, float defaultValue, GuiSlider.FormatHelper formatter) + { + super(idIn, x, y, 150, 20, ""); + this.name = name; + this.min = min; + this.max = max; + this.sliderPosition = (defaultValue - min) / (max - min); + this.formatHelper = formatter; + this.responder = guiResponder; + this.displayString = this.getDisplayString(); + } + + public float func_175220_c() + { + return this.min + (this.max - this.min) * this.sliderPosition; + } + + public void func_175218_a(float p_175218_1_, boolean p_175218_2_) + { + this.sliderPosition = (p_175218_1_ - this.min) / (this.max - this.min); + this.displayString = this.getDisplayString(); + + if (p_175218_2_) + { + this.responder.onTick(this.id, this.func_175220_c()); + } + } + + public float func_175217_d() + { + return this.sliderPosition; + } + + private String getDisplayString() + { + return this.formatHelper == null ? I18n.format(this.name, new Object[0]) + ": " + this.func_175220_c() : this.formatHelper.getText(this.id, I18n.format(this.name, new Object[0]), this.func_175220_c()); + } + + /** + * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over + * this button. + */ + protected int getHoverState(boolean mouseOver) + { + return 0; + } + + /** + * Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e). + */ + protected void mouseDragged(Minecraft mc, int mouseX, int mouseY) + { + if (this.visible) + { + if (this.isMouseDown) + { + this.sliderPosition = (float)(mouseX - (this.xPosition + 4)) / (float)(this.width - 8); + + if (this.sliderPosition < 0.0F) + { + this.sliderPosition = 0.0F; + } + + if (this.sliderPosition > 1.0F) + { + this.sliderPosition = 1.0F; + } + + this.displayString = this.getDisplayString(); + this.responder.onTick(this.id, this.func_175220_c()); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Gui.drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, new Color(10,10,10, 170).getRGB()); + //DrawUtil.drawRoundedRect(this.xPosition + (int)(this.sliderPosition * (float)(this.width - 8)), this.yPosition, 0, 66, 4, 20); + //DrawUtil.drawRoundedRect(this.xPosition + (int)(this.sliderPosition * (float)(this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20); + } + } + + public void func_175219_a(float p_175219_1_) + { + this.sliderPosition = p_175219_1_; + this.displayString = this.getDisplayString(); + this.responder.onTick(this.id, this.func_175220_c()); + } + + /** + * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent + * e). + */ + public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) + { + if (super.mousePressed(mc, mouseX, mouseY)) + { + this.sliderPosition = (float)(mouseX - (this.xPosition + 4)) / (float)(this.width - 8); + + if (this.sliderPosition < 0.0F) + { + this.sliderPosition = 0.0F; + } + + if (this.sliderPosition > 1.0F) + { + this.sliderPosition = 1.0F; + } + + this.displayString = this.getDisplayString(); + this.responder.onTick(this.id, this.func_175220_c()); + this.isMouseDown = true; + return true; + } + else + { + return false; + } + } + + /** + * Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e). + */ + public void mouseReleased(int mouseX, int mouseY) + { + this.isMouseDown = false; + } + + public interface FormatHelper + { + String getText(int id, String name, float value); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiSlot.java b/src/minecraft/net/minecraft/client/gui/GuiSlot.java new file mode 100644 index 0000000..649f52b --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiSlot.java @@ -0,0 +1,525 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.MathHelper; +import org.lwjgl.input.Mouse; + +public abstract class GuiSlot +{ + protected final Minecraft mc; + protected int width; + protected int height; + + /** The top of the slot container. Affects the overlays and scrolling. */ + protected int top; + + /** The bottom of the slot container. Affects the overlays and scrolling. */ + protected int bottom; + protected int right; + protected int left; + + /** The height of a slot. */ + protected final int slotHeight; + + /** The buttonID of the button used to scroll up */ + private int scrollUpButtonID; + + /** The buttonID of the button used to scroll down */ + private int scrollDownButtonID; + protected int mouseX; + protected int mouseY; + protected boolean field_148163_i = true; + + /** Where the mouse was in the window when you first clicked to scroll */ + protected int initialClickY = -2; + + /** + * What to multiply the amount you moved your mouse by (used for slowing down scrolling when over the items and not + * on the scroll bar) + */ + protected float scrollMultiplier; + + /** How far down this slot has been scrolled */ + protected float amountScrolled; + + /** The element in the list that was selected */ + protected int selectedElement = -1; + + /** The time when this button was last clicked. */ + protected long lastClicked; + protected boolean field_178041_q = true; + + /** + * Set to true if a selected element in this gui will show an outline box + */ + protected boolean showSelectionBox = true; + protected boolean hasListHeader; + protected int headerPadding; + private boolean enabled = true; + + public GuiSlot(Minecraft mcIn, int width, int height, int topIn, int bottomIn, int slotHeightIn) + { + this.mc = mcIn; + this.width = width; + this.height = height; + this.top = topIn; + this.bottom = bottomIn; + this.slotHeight = slotHeightIn; + this.left = 0; + this.right = width; + } + + public void setDimensions(int widthIn, int heightIn, int topIn, int bottomIn) + { + this.width = widthIn; + this.height = heightIn; + this.top = topIn; + this.bottom = bottomIn; + this.left = 0; + this.right = widthIn; + } + + public void setShowSelectionBox(boolean showSelectionBoxIn) + { + this.showSelectionBox = showSelectionBoxIn; + } + + /** + * Sets hasListHeader and headerHeight. Params: hasListHeader, headerHeight. If hasListHeader is false headerHeight + * is set to 0. + */ + protected void setHasListHeader(boolean hasListHeaderIn, int headerPaddingIn) + { + this.hasListHeader = hasListHeaderIn; + this.headerPadding = headerPaddingIn; + + if (!hasListHeaderIn) + { + this.headerPadding = 0; + } + } + + protected abstract int getSize(); + + /** + * The element in the slot that was clicked, boolean for whether it was double clicked or not + */ + protected abstract void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY); + + /** + * Returns true if the element passed in is currently selected + */ + protected abstract boolean isSelected(int slotIndex); + + /** + * Return the height of the content being scrolled + */ + protected int getContentHeight() + { + return this.getSize() * this.slotHeight + this.headerPadding; + } + + protected abstract void drawBackground(); + + protected void func_178040_a(int p_178040_1_, int p_178040_2_, int p_178040_3_) + { + } + + protected abstract void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn); + + /** + * Handles drawing a list's header row. + */ + protected void drawListHeader(int p_148129_1_, int p_148129_2_, Tessellator p_148129_3_) + { + } + + protected void func_148132_a(int p_148132_1_, int p_148132_2_) + { + } + + protected void func_148142_b(int p_148142_1_, int p_148142_2_) + { + } + + public int getSlotIndexFromScreenCoords(int p_148124_1_, int p_148124_2_) + { + int i = this.left + this.width / 2 - this.getListWidth() / 2; + int j = this.left + this.width / 2 + this.getListWidth() / 2; + int k = p_148124_2_ - this.top - this.headerPadding + (int)this.amountScrolled - 4; + int l = k / this.slotHeight; + return p_148124_1_ < this.getScrollBarX() && p_148124_1_ >= i && p_148124_1_ <= j && l >= 0 && k >= 0 && l < this.getSize() ? l : -1; + } + + /** + * Registers the IDs that can be used for the scrollbar's up/down buttons. + */ + public void registerScrollButtons(int scrollUpButtonIDIn, int scrollDownButtonIDIn) + { + this.scrollUpButtonID = scrollUpButtonIDIn; + this.scrollDownButtonID = scrollDownButtonIDIn; + } + + /** + * Stop the thing from scrolling out of bounds + */ + protected void bindAmountScrolled() + { + this.amountScrolled = MathHelper.clamp_float(this.amountScrolled, 0.0F, (float)this.func_148135_f()); + } + + public int func_148135_f() + { + return Math.max(0, this.getContentHeight() - (this.bottom - this.top - 4)); + } + + /** + * Returns the amountScrolled field as an integer. + */ + public int getAmountScrolled() + { + return (int)this.amountScrolled; + } + + public boolean isMouseYWithinSlotBounds(int p_148141_1_) + { + return p_148141_1_ >= this.top && p_148141_1_ <= this.bottom && this.mouseX >= this.left && this.mouseX <= this.right; + } + + /** + * Scrolls the slot by the given amount. A positive value scrolls down, and a negative value scrolls up. + */ + public void scrollBy(int amount) + { + this.amountScrolled += (float)amount; + this.bindAmountScrolled(); + this.initialClickY = -2; + } + + public void actionPerformed(GuiButton button) + { + if (button.enabled) + { + if (button.id == this.scrollUpButtonID) + { + this.amountScrolled -= (float)(this.slotHeight * 2 / 3); + this.initialClickY = -2; + this.bindAmountScrolled(); + } + else if (button.id == this.scrollDownButtonID) + { + this.amountScrolled += (float)(this.slotHeight * 2 / 3); + this.initialClickY = -2; + this.bindAmountScrolled(); + } + } + } + + public void drawScreen(int mouseXIn, int mouseYIn, float p_148128_3_) + { + if (this.field_178041_q) + { + this.mouseX = mouseXIn; + this.mouseY = mouseYIn; + this.drawBackground(); + int i = this.getScrollBarX(); + int j = i + 6; + this.bindAmountScrolled(); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + float f = 32.0F; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); + worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); + worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); + worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); + tessellator.draw(); + int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2; + int l = this.top + 4 - (int)this.amountScrolled; + + if (this.hasListHeader) + { + this.drawListHeader(k, l, tessellator); + } + + this.drawSelectionBox(k, l, mouseXIn, mouseYIn); + GlStateManager.disableDepth(); + int i1 = 4; + this.overlayBackground(0, this.top, 255, 255); + this.overlayBackground(this.bottom, this.height, 255, 255); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1); + GlStateManager.disableAlpha(); + GlStateManager.shadeModel(7425); + GlStateManager.disableTexture2D(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)this.left, (double)(this.top + i1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex(); + worldrenderer.pos((double)this.right, (double)(this.top + i1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex(); + worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex(); + tessellator.draw(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)this.right, (double)(this.bottom - i1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex(); + worldrenderer.pos((double)this.left, (double)(this.bottom - i1), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex(); + tessellator.draw(); + int j1 = this.func_148135_f(); + + if (j1 > 0) + { + int k1 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight(); + k1 = MathHelper.clamp_int(k1, 32, this.bottom - this.top - 8); + int l1 = (int)this.amountScrolled * (this.bottom - this.top - k1) / j1 + this.top; + + if (l1 < this.top) + { + l1 = this.top; + } + + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)i, (double)this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)j, (double)this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)j, (double)this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)i, (double)this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex(); + tessellator.draw(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)i, (double)(l1 + k1), 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)j, (double)(l1 + k1), 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)j, (double)l1, 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)i, (double)l1, 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex(); + tessellator.draw(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)i, (double)(l1 + k1 - 1), 0.0D).tex(0.0D, 1.0D).color(192, 192, 192, 255).endVertex(); + worldrenderer.pos((double)(j - 1), (double)(l1 + k1 - 1), 0.0D).tex(1.0D, 1.0D).color(192, 192, 192, 255).endVertex(); + worldrenderer.pos((double)(j - 1), (double)l1, 0.0D).tex(1.0D, 0.0D).color(192, 192, 192, 255).endVertex(); + worldrenderer.pos((double)i, (double)l1, 0.0D).tex(0.0D, 0.0D).color(192, 192, 192, 255).endVertex(); + tessellator.draw(); + } + + this.func_148142_b(mouseXIn, mouseYIn); + GlStateManager.enableTexture2D(); + GlStateManager.shadeModel(7424); + GlStateManager.enableAlpha(); + GlStateManager.disableBlend(); + } + } + + public void handleMouseInput() + { + if (this.isMouseYWithinSlotBounds(this.mouseY)) + { + if (Mouse.getEventButton() == 0 && Mouse.getEventButtonState() && this.mouseY >= this.top && this.mouseY <= this.bottom) + { + int i = (this.width - this.getListWidth()) / 2; + int j = (this.width + this.getListWidth()) / 2; + int k = this.mouseY - this.top - this.headerPadding + (int)this.amountScrolled - 4; + int l = k / this.slotHeight; + + if (l < this.getSize() && this.mouseX >= i && this.mouseX <= j && l >= 0 && k >= 0) + { + this.elementClicked(l, false, this.mouseX, this.mouseY); + this.selectedElement = l; + } + else if (this.mouseX >= i && this.mouseX <= j && k < 0) + { + this.func_148132_a(this.mouseX - i, this.mouseY - this.top + (int)this.amountScrolled - 4); + } + } + + if (Mouse.isButtonDown(0) && this.getEnabled()) + { + if (this.initialClickY == -1) + { + boolean flag1 = true; + + if (this.mouseY >= this.top && this.mouseY <= this.bottom) + { + int j2 = (this.width - this.getListWidth()) / 2; + int k2 = (this.width + this.getListWidth()) / 2; + int l2 = this.mouseY - this.top - this.headerPadding + (int)this.amountScrolled - 4; + int i1 = l2 / this.slotHeight; + + if (i1 < this.getSize() && this.mouseX >= j2 && this.mouseX <= k2 && i1 >= 0 && l2 >= 0) + { + boolean flag = i1 == this.selectedElement && Minecraft.getSystemTime() - this.lastClicked < 250L; + this.elementClicked(i1, flag, this.mouseX, this.mouseY); + this.selectedElement = i1; + this.lastClicked = Minecraft.getSystemTime(); + } + else if (this.mouseX >= j2 && this.mouseX <= k2 && l2 < 0) + { + this.func_148132_a(this.mouseX - j2, this.mouseY - this.top + (int)this.amountScrolled - 4); + flag1 = false; + } + + int i3 = this.getScrollBarX(); + int j1 = i3 + 6; + + if (this.mouseX >= i3 && this.mouseX <= j1) + { + this.scrollMultiplier = -1.0F; + int k1 = this.func_148135_f(); + + if (k1 < 1) + { + k1 = 1; + } + + int l1 = (int)((float)((this.bottom - this.top) * (this.bottom - this.top)) / (float)this.getContentHeight()); + l1 = MathHelper.clamp_int(l1, 32, this.bottom - this.top - 8); + this.scrollMultiplier /= (float)(this.bottom - this.top - l1) / (float)k1; + } + else + { + this.scrollMultiplier = 1.0F; + } + + if (flag1) + { + this.initialClickY = this.mouseY; + } + else + { + this.initialClickY = -2; + } + } + else + { + this.initialClickY = -2; + } + } + else if (this.initialClickY >= 0) + { + this.amountScrolled -= (float)(this.mouseY - this.initialClickY) * this.scrollMultiplier; + this.initialClickY = this.mouseY; + } + } + else + { + this.initialClickY = -1; + } + + int i2 = Mouse.getEventDWheel(); + + if (i2 != 0) + { + if (i2 > 0) + { + i2 = -1; + } + else if (i2 < 0) + { + i2 = 1; + } + + this.amountScrolled += (float)(i2 * this.slotHeight / 2); + } + } + } + + public void setEnabled(boolean enabledIn) + { + this.enabled = enabledIn; + } + + public boolean getEnabled() + { + return this.enabled; + } + + /** + * Gets the width of the list + */ + public int getListWidth() + { + return 220; + } + + /** + * Draws the selection box around the selected slot element. + */ + protected void drawSelectionBox(int p_148120_1_, int p_148120_2_, int mouseXIn, int mouseYIn) + { + int i = this.getSize(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + + for (int j = 0; j < i; ++j) + { + int k = p_148120_2_ + j * this.slotHeight + this.headerPadding; + int l = this.slotHeight - 4; + + if (k > this.bottom || k + l < this.top) + { + this.func_178040_a(j, p_148120_1_, k); + } + + if (this.showSelectionBox && this.isSelected(j)) + { + int i1 = this.left + (this.width / 2 - this.getListWidth() / 2); + int j1 = this.left + this.width / 2 + this.getListWidth() / 2; + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableTexture2D(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)i1, (double)(k + l + 2), 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)j1, (double)(k + l + 2), 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)j1, (double)(k - 2), 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)i1, (double)(k - 2), 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex(); + worldrenderer.pos((double)(i1 + 1), (double)(k + l + 1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)(j1 - 1), (double)(k + l + 1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)(j1 - 1), (double)(k - 1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)(i1 + 1), (double)(k - 1), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + } + + this.drawSlot(j, p_148120_1_, k, l, mouseXIn, mouseYIn); + } + } + + protected int getScrollBarX() + { + return this.width / 2 + 124; + } + + /** + * Overlays the background to hide scrolled items + */ + protected void overlayBackground(int startY, int endY, int startAlpha, int endAlpha) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + float f = 32.0F; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos((double)this.left, (double)endY, 0.0D).tex(0.0D, (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex(); + worldrenderer.pos((double)(this.left + this.width), (double)endY, 0.0D).tex((double)((float)this.width / 32.0F), (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex(); + worldrenderer.pos((double)(this.left + this.width), (double)startY, 0.0D).tex((double)((float)this.width / 32.0F), (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex(); + worldrenderer.pos((double)this.left, (double)startY, 0.0D).tex(0.0D, (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex(); + tessellator.draw(); + } + + /** + * Sets the left and right bounds of the slot. Param is the left bound, right is calculated as left + width. + */ + public void setSlotXBoundsFromLeft(int leftIn) + { + this.left = leftIn; + this.right = leftIn + this.width; + } + + public int getSlotHeight() + { + return this.slotHeight; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiSlotRealmsProxy.java b/src/minecraft/net/minecraft/client/gui/GuiSlotRealmsProxy.java new file mode 100644 index 0000000..eeda894 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiSlotRealmsProxy.java @@ -0,0 +1,79 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.realms.RealmsScrolledSelectionList; + +public class GuiSlotRealmsProxy extends GuiSlot +{ + private final RealmsScrolledSelectionList selectionList; + + public GuiSlotRealmsProxy(RealmsScrolledSelectionList selectionListIn, int widthIn, int heightIn, int topIn, int bottomIn, int slotHeightIn) + { + super(Minecraft.getMinecraft(), widthIn, heightIn, topIn, bottomIn, slotHeightIn); + this.selectionList = selectionListIn; + } + + protected int getSize() + { + return this.selectionList.getItemCount(); + } + + /** + * The element in the slot that was clicked, boolean for whether it was double clicked or not + */ + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + this.selectionList.selectItem(slotIndex, isDoubleClick, mouseX, mouseY); + } + + /** + * Returns true if the element passed in is currently selected + */ + protected boolean isSelected(int slotIndex) + { + return this.selectionList.isSelectedItem(slotIndex); + } + + protected void drawBackground() + { + this.selectionList.renderBackground(); + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + this.selectionList.renderItem(entryID, p_180791_2_, p_180791_3_, p_180791_4_, mouseXIn, mouseYIn); + } + + public int func_154338_k() + { + return super.width; + } + + public int func_154339_l() + { + return super.mouseY; + } + + public int func_154337_m() + { + return super.mouseX; + } + + /** + * Return the height of the content being scrolled + */ + protected int getContentHeight() + { + return this.selectionList.getMaxPosition(); + } + + protected int getScrollBarX() + { + return this.selectionList.getScrollbarPosition(); + } + + public void handleMouseInput() + { + super.handleMouseInput(); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiSnooper.java b/src/minecraft/net/minecraft/client/gui/GuiSnooper.java new file mode 100644 index 0000000..3f79827 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiSnooper.java @@ -0,0 +1,155 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.TreeMap; +import java.util.Map.Entry; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; + +public class GuiSnooper extends GuiScreen +{ + private final GuiScreen field_146608_a; + + /** Reference to the GameSettings object. */ + private final GameSettings game_settings_2; + private final java.util.List field_146604_g = Lists.newArrayList(); + private final java.util.List field_146609_h = Lists.newArrayList(); + private String field_146610_i; + private String[] field_146607_r; + private GuiSnooper.List field_146606_s; + private GuiButton field_146605_t; + + public GuiSnooper(GuiScreen p_i1061_1_, GameSettings p_i1061_2_) + { + this.field_146608_a = p_i1061_1_; + this.game_settings_2 = p_i1061_2_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.field_146610_i = I18n.format("options.snooper.title", new Object[0]); + String s = I18n.format("options.snooper.desc", new Object[0]); + java.util.List list = Lists.newArrayList(); + + for (Object s1 : this.fontRendererObj.listFormattedStringToWidth(s, this.width - 30)) + { + list.add((String) s1); + } + + this.field_146607_r = (String[])list.toArray(new String[list.size()]); + this.field_146604_g.clear(); + this.field_146609_h.clear(); + this.buttonList.add(this.field_146605_t = new GuiButton(1, this.width / 2 - 152, this.height - 30, 150, 20, this.game_settings_2.getKeyBinding(GameSettings.Options.SNOOPER_ENABLED))); + this.buttonList.add(new GuiButton(2, this.width / 2 + 2, this.height - 30, 150, 20, I18n.format("gui.done", new Object[0]))); + boolean flag = this.mc.getIntegratedServer() != null && this.mc.getIntegratedServer().getPlayerUsageSnooper() != null; + + for (Entry entry : (new TreeMap(this.mc.getPlayerUsageSnooper().getCurrentStats())).entrySet()) + { + this.field_146604_g.add((flag ? "C " : "") + (String)entry.getKey()); + this.field_146609_h.add(this.fontRendererObj.trimStringToWidth((String)entry.getValue(), this.width - 220)); + } + + if (flag) + { + for (Entry entry1 : (new TreeMap(this.mc.getIntegratedServer().getPlayerUsageSnooper().getCurrentStats())).entrySet()) + { + this.field_146604_g.add("S " + (String)entry1.getKey()); + this.field_146609_h.add(this.fontRendererObj.trimStringToWidth((String)entry1.getValue(), this.width - 220)); + } + } + + this.field_146606_s = new GuiSnooper.List(); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + this.field_146606_s.handleMouseInput(); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 2) + { + this.game_settings_2.saveOptions(); + this.game_settings_2.saveOptions(); + this.mc.displayGuiScreen(this.field_146608_a); + } + + if (button.id == 1) + { + this.game_settings_2.setOptionValue(GameSettings.Options.SNOOPER_ENABLED, 1); + this.field_146605_t.displayString = this.game_settings_2.getKeyBinding(GameSettings.Options.SNOOPER_ENABLED); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.field_146606_s.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.fontRendererObj, this.field_146610_i, this.width / 2, 8, 16777215); + int i = 22; + + for (String s : this.field_146607_r) + { + this.drawCenteredString(this.fontRendererObj, s, this.width / 2, i, 8421504); + i += this.fontRendererObj.FONT_HEIGHT; + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + class List extends GuiSlot + { + public List() + { + super(GuiSnooper.this.mc, GuiSnooper.this.width, GuiSnooper.this.height, 80, GuiSnooper.this.height - 40, GuiSnooper.this.fontRendererObj.FONT_HEIGHT + 1); + } + + protected int getSize() + { + return GuiSnooper.this.field_146604_g.size(); + } + + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + } + + protected boolean isSelected(int slotIndex) + { + return false; + } + + protected void drawBackground() + { + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + GuiSnooper.this.fontRendererObj.drawString((String)GuiSnooper.this.field_146604_g.get(entryID), 10, p_180791_3_, 16777215); + GuiSnooper.this.fontRendererObj.drawString((String)GuiSnooper.this.field_146609_h.get(entryID), 230, p_180791_3_, 16777215); + } + + protected int getScrollBarX() + { + return this.width - 10; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiSpectator.java b/src/minecraft/net/minecraft/client/gui/GuiSpectator.java new file mode 100644 index 0000000..d1f50bc --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiSpectator.java @@ -0,0 +1,186 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.spectator.ISpectatorMenuObject; +import net.minecraft.client.gui.spectator.ISpectatorMenuRecipient; +import net.minecraft.client.gui.spectator.SpectatorMenu; +import net.minecraft.client.gui.spectator.categories.SpectatorDetails; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class GuiSpectator extends Gui implements ISpectatorMenuRecipient +{ + private static final ResourceLocation field_175267_f = new ResourceLocation("textures/gui/widgets.png"); + public static final ResourceLocation field_175269_a = new ResourceLocation("textures/gui/spectator_widgets.png"); + private final Minecraft field_175268_g; + private long field_175270_h; + private SpectatorMenu field_175271_i; + + public GuiSpectator(Minecraft mcIn) + { + this.field_175268_g = mcIn; + } + + public void func_175260_a(int p_175260_1_) + { + this.field_175270_h = Minecraft.getSystemTime(); + + if (this.field_175271_i != null) + { + this.field_175271_i.func_178644_b(p_175260_1_); + } + else + { + this.field_175271_i = new SpectatorMenu(this); + } + } + + private float func_175265_c() + { + long i = this.field_175270_h - Minecraft.getSystemTime() + 5000L; + return MathHelper.clamp_float((float)i / 2000.0F, 0.0F, 1.0F); + } + + public void renderTooltip(ScaledResolution p_175264_1_, float p_175264_2_) + { + if (this.field_175271_i != null) + { + float f = this.func_175265_c(); + + if (f <= 0.0F) + { + this.field_175271_i.func_178641_d(); + } + else + { + int i = p_175264_1_.getScaledWidth() / 2; + float f1 = this.zLevel; + this.zLevel = -90.0F; + float f2 = (float)p_175264_1_.getScaledHeight() - 22.0F * f; + SpectatorDetails spectatordetails = this.field_175271_i.func_178646_f(); + this.func_175258_a(p_175264_1_, f, i, f2, spectatordetails); + this.zLevel = f1; + } + } + } + + protected void func_175258_a(ScaledResolution p_175258_1_, float p_175258_2_, int p_175258_3_, float p_175258_4_, SpectatorDetails p_175258_5_) + { + GlStateManager.enableRescaleNormal(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.color(1.0F, 1.0F, 1.0F, p_175258_2_); + this.field_175268_g.getTextureManager().bindTexture(field_175267_f); + this.drawTexturedModalRect((float)(p_175258_3_ - 91), p_175258_4_, 0, 0, 182, 22); + + if (p_175258_5_.func_178681_b() >= 0) + { + this.drawTexturedModalRect((float)(p_175258_3_ - 91 - 1 + p_175258_5_.func_178681_b() * 20), p_175258_4_ - 1.0F, 0, 22, 24, 22); + } + + RenderHelper.enableGUIStandardItemLighting(); + + for (int i = 0; i < 9; ++i) + { + this.func_175266_a(i, p_175258_1_.getScaledWidth() / 2 - 90 + i * 20 + 2, p_175258_4_ + 3.0F, p_175258_2_, p_175258_5_.func_178680_a(i)); + } + + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.disableBlend(); + } + + private void func_175266_a(int p_175266_1_, int p_175266_2_, float p_175266_3_, float p_175266_4_, ISpectatorMenuObject p_175266_5_) + { + this.field_175268_g.getTextureManager().bindTexture(field_175269_a); + + if (p_175266_5_ != SpectatorMenu.field_178657_a) + { + int i = (int)(p_175266_4_ * 255.0F); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)p_175266_2_, p_175266_3_, 0.0F); + float f = p_175266_5_.func_178662_A_() ? 1.0F : 0.25F; + GlStateManager.color(f, f, f, p_175266_4_); + p_175266_5_.func_178663_a(f, i); + GlStateManager.popMatrix(); + String s = String.valueOf((Object)GameSettings.getKeyDisplayString(this.field_175268_g.gameSettings.keyBindsHotbar[p_175266_1_].getKeyCode())); + + if (i > 3 && p_175266_5_.func_178662_A_()) + { + this.field_175268_g.fontRendererObj.drawStringWithShadow(s, (float)(p_175266_2_ + 19 - 2 - this.field_175268_g.fontRendererObj.getStringWidth(s)), p_175266_3_ + 6.0F + 3.0F, 16777215 + (i << 24)); + } + } + } + + public void func_175263_a(ScaledResolution p_175263_1_) + { + int i = (int)(this.func_175265_c() * 255.0F); + + if (i > 3 && this.field_175271_i != null) + { + ISpectatorMenuObject ispectatormenuobject = this.field_175271_i.func_178645_b(); + String s = ispectatormenuobject != SpectatorMenu.field_178657_a ? ispectatormenuobject.getSpectatorName().getFormattedText() : this.field_175271_i.func_178650_c().func_178670_b().getFormattedText(); + + if (s != null) + { + int j = (p_175263_1_.getScaledWidth() - this.field_175268_g.fontRendererObj.getStringWidth(s)) / 2; + int k = p_175263_1_.getScaledHeight() - 35; + GlStateManager.pushMatrix(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + this.field_175268_g.fontRendererObj.drawStringWithShadow(s, (float)j, (float)k, 16777215 + (i << 24)); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + } + } + } + + public void func_175257_a(SpectatorMenu p_175257_1_) + { + this.field_175271_i = null; + this.field_175270_h = 0L; + } + + public boolean func_175262_a() + { + return this.field_175271_i != null; + } + + public void func_175259_b(int p_175259_1_) + { + int i; + + for (i = this.field_175271_i.func_178648_e() + p_175259_1_; i >= 0 && i <= 8 && (this.field_175271_i.func_178643_a(i) == SpectatorMenu.field_178657_a || !this.field_175271_i.func_178643_a(i).func_178662_A_()); i += p_175259_1_) + { + ; + } + + if (i >= 0 && i <= 8) + { + this.field_175271_i.func_178644_b(i); + this.field_175270_h = Minecraft.getSystemTime(); + } + } + + public void func_175261_b() + { + this.field_175270_h = Minecraft.getSystemTime(); + + if (this.func_175262_a()) + { + int i = this.field_175271_i.func_178648_e(); + + if (i != -1) + { + this.field_175271_i.func_178644_b(i); + } + } + else + { + this.field_175271_i = new SpectatorMenu(this); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiStreamIndicator.java b/src/minecraft/net/minecraft/client/gui/GuiStreamIndicator.java new file mode 100644 index 0000000..78ef8c1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiStreamIndicator.java @@ -0,0 +1,109 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; + +public class GuiStreamIndicator +{ + private static final ResourceLocation locationStreamIndicator = new ResourceLocation("textures/gui/stream_indicator.png"); + private final Minecraft mc; + private float field_152443_c = 1.0F; + private int field_152444_d = 1; + + public GuiStreamIndicator(Minecraft mcIn) + { + this.mc = mcIn; + } + + public void render(int p_152437_1_, int p_152437_2_) + { + if (this.mc.getTwitchStream().isBroadcasting()) + { + GlStateManager.enableBlend(); + int i = this.mc.getTwitchStream().func_152920_A(); + + if (i > 0) + { + String s = "" + i; + int j = this.mc.fontRendererObj.getStringWidth(s); + int k = 20; + int l = p_152437_1_ - j - 1; + int i1 = p_152437_2_ + 20 - 1; + int j1 = p_152437_2_ + 20 + this.mc.fontRendererObj.FONT_HEIGHT - 1; + GlStateManager.disableTexture2D(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.color(0.0F, 0.0F, 0.0F, (0.65F + 0.35000002F * this.field_152443_c) / 2.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION); + worldrenderer.pos((double)l, (double)j1, 0.0D).endVertex(); + worldrenderer.pos((double)p_152437_1_, (double)j1, 0.0D).endVertex(); + worldrenderer.pos((double)p_152437_1_, (double)i1, 0.0D).endVertex(); + worldrenderer.pos((double)l, (double)i1, 0.0D).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + this.mc.fontRendererObj.drawString(s, p_152437_1_ - j, p_152437_2_ + 20, 16777215); + } + + this.render(p_152437_1_, p_152437_2_, this.func_152440_b(), 0); + this.render(p_152437_1_, p_152437_2_, this.func_152438_c(), 17); + } + } + + private void render(int p_152436_1_, int p_152436_2_, int p_152436_3_, int p_152436_4_) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 0.65F + 0.35000002F * this.field_152443_c); + this.mc.getTextureManager().bindTexture(locationStreamIndicator); + float f = 150.0F; + float f1 = 0.0F; + float f2 = (float)p_152436_3_ * 0.015625F; + float f3 = 1.0F; + float f4 = (float)(p_152436_3_ + 16) * 0.015625F; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((double)(p_152436_1_ - 16 - p_152436_4_), (double)(p_152436_2_ + 16), (double)f).tex((double)f1, (double)f4).endVertex(); + worldrenderer.pos((double)(p_152436_1_ - p_152436_4_), (double)(p_152436_2_ + 16), (double)f).tex((double)f3, (double)f4).endVertex(); + worldrenderer.pos((double)(p_152436_1_ - p_152436_4_), (double)(p_152436_2_ + 0), (double)f).tex((double)f3, (double)f2).endVertex(); + worldrenderer.pos((double)(p_152436_1_ - 16 - p_152436_4_), (double)(p_152436_2_ + 0), (double)f).tex((double)f1, (double)f2).endVertex(); + tessellator.draw(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + } + + private int func_152440_b() + { + return this.mc.getTwitchStream().isPaused() ? 16 : 0; + } + + private int func_152438_c() + { + return this.mc.getTwitchStream().func_152929_G() ? 48 : 32; + } + + public void func_152439_a() + { + if (this.mc.getTwitchStream().isBroadcasting()) + { + this.field_152443_c += 0.025F * (float)this.field_152444_d; + + if (this.field_152443_c < 0.0F) + { + this.field_152444_d *= -1; + this.field_152443_c = 0.0F; + } + else if (this.field_152443_c > 1.0F) + { + this.field_152444_d *= -1; + this.field_152443_c = 1.0F; + } + } + else + { + this.field_152443_c = 1.0F; + this.field_152444_d = 1; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiTextField.java b/src/minecraft/net/minecraft/client/gui/GuiTextField.java new file mode 100644 index 0000000..42f1109 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiTextField.java @@ -0,0 +1,807 @@ +package net.minecraft.client.gui; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ChatAllowedCharacters; +import net.minecraft.util.MathHelper; + +public class GuiTextField extends Gui +{ + private final int id; + private final FontRenderer fontRendererInstance; + public int xPosition; + public int yPosition; + + /** The width of this text field. */ + private final int width; + private final int height; + + /** Has the current text being edited on the textbox. */ + private String text = ""; + private int maxStringLength = 32; + private int cursorCounter; + private boolean enableBackgroundDrawing = true; + + /** + * if true the textbox can lose focus by clicking elsewhere on the screen + */ + private boolean canLoseFocus = true; + + /** + * If this value is true along with isEnabled, keyTyped will process the keys. + */ + private boolean isFocused; + + /** + * If this value is true along with isFocused, keyTyped will process the keys. + */ + private boolean isEnabled = true; + + /** + * The current character index that should be used as start of the rendered text. + */ + private int lineScrollOffset; + private int cursorPosition; + + /** other selection position, maybe the same as the cursor */ + private int selectionEnd; + private int enabledColor = 14737632; + private int disabledColor = 7368816; + + /** True if this textbox is visible */ + private boolean visible = true; + private GuiPageButtonList.GuiResponder field_175210_x; + private Predicate field_175209_y = Predicates.alwaysTrue(); + + public GuiTextField(int componentId, FontRenderer fontrendererObj, int x, int y, int par5Width, int par6Height) + { + this.id = componentId; + this.fontRendererInstance = fontrendererObj; + this.xPosition = x; + this.yPosition = y; + this.width = par5Width; + this.height = par6Height; + } + + public void func_175207_a(GuiPageButtonList.GuiResponder p_175207_1_) + { + this.field_175210_x = p_175207_1_; + } + + /** + * Increments the cursor counter + */ + public void updateCursorCounter() + { + ++this.cursorCounter; + } + + /** + * Sets the text of the textbox + */ + public void setText(String p_146180_1_) + { + if (this.field_175209_y.apply(p_146180_1_)) + { + if (p_146180_1_.length() > this.maxStringLength) + { + this.text = p_146180_1_.substring(0, this.maxStringLength); + } + else + { + this.text = p_146180_1_; + } + + this.setCursorPositionEnd(); + } + } + + /** + * Returns the contents of the textbox + */ + public String getText() + { + return this.text; + } + + /** + * returns the text between the cursor and selectionEnd + */ + public String getSelectedText() + { + int i = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd; + int j = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition; + return this.text.substring(i, j); + } + + public void func_175205_a(Predicate p_175205_1_) + { + this.field_175209_y = p_175205_1_; + } + + /** + * replaces selected text, or inserts text at the position on the cursor + */ + public void writeText(String p_146191_1_) + { + String s = ""; + String s1 = ChatAllowedCharacters.filterAllowedCharacters(p_146191_1_); + int i = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd; + int j = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition; + int k = this.maxStringLength - this.text.length() - (i - j); + int l = 0; + + if (this.text.length() > 0) + { + s = s + this.text.substring(0, i); + } + + if (k < s1.length()) + { + s = s + s1.substring(0, k); + l = k; + } + else + { + s = s + s1; + l = s1.length(); + } + + if (this.text.length() > 0 && j < this.text.length()) + { + s = s + this.text.substring(j); + } + + if (this.field_175209_y.apply(s)) + { + this.text = s; + this.moveCursorBy(i - this.selectionEnd + l); + + if (this.field_175210_x != null) + { + this.field_175210_x.func_175319_a(this.id, this.text); + } + } + } + + /** + * Deletes the specified number of words starting at the cursor position. Negative numbers will delete words left of + * the cursor. + */ + public void deleteWords(int p_146177_1_) + { + if (this.text.length() != 0) + { + if (this.selectionEnd != this.cursorPosition) + { + this.writeText(""); + } + else + { + this.deleteFromCursor(this.getNthWordFromCursor(p_146177_1_) - this.cursorPosition); + } + } + } + + /** + * delete the selected text, otherwsie deletes characters from either side of the cursor. params: delete num + */ + public void deleteFromCursor(int p_146175_1_) + { + if (this.text.length() != 0) + { + if (this.selectionEnd != this.cursorPosition) + { + this.writeText(""); + } + else + { + boolean flag = p_146175_1_ < 0; + int i = flag ? this.cursorPosition + p_146175_1_ : this.cursorPosition; + int j = flag ? this.cursorPosition : this.cursorPosition + p_146175_1_; + String s = ""; + + if (i >= 0) + { + s = this.text.substring(0, i); + } + + if (j < this.text.length()) + { + s = s + this.text.substring(j); + } + + if (this.field_175209_y.apply(s)) + { + this.text = s; + + if (flag) + { + this.moveCursorBy(p_146175_1_); + } + + if (this.field_175210_x != null) + { + this.field_175210_x.func_175319_a(this.id, this.text); + } + } + } + } + } + + public int getId() + { + return this.id; + } + + /** + * see @getNthNextWordFromPos() params: N, position + */ + public int getNthWordFromCursor(int p_146187_1_) + { + return this.getNthWordFromPos(p_146187_1_, this.getCursorPosition()); + } + + /** + * gets the position of the nth word. N may be negative, then it looks backwards. params: N, position + */ + public int getNthWordFromPos(int p_146183_1_, int p_146183_2_) + { + return this.func_146197_a(p_146183_1_, p_146183_2_, true); + } + + public int func_146197_a(int p_146197_1_, int p_146197_2_, boolean p_146197_3_) + { + int i = p_146197_2_; + boolean flag = p_146197_1_ < 0; + int j = Math.abs(p_146197_1_); + + for (int k = 0; k < j; ++k) + { + if (!flag) + { + int l = this.text.length(); + i = this.text.indexOf(32, i); + + if (i == -1) + { + i = l; + } + else + { + while (p_146197_3_ && i < l && this.text.charAt(i) == 32) + { + ++i; + } + } + } + else + { + while (p_146197_3_ && i > 0 && this.text.charAt(i - 1) == 32) + { + --i; + } + + while (i > 0 && this.text.charAt(i - 1) != 32) + { + --i; + } + } + } + + return i; + } + + /** + * Moves the text cursor by a specified number of characters and clears the selection + */ + public void moveCursorBy(int p_146182_1_) + { + this.setCursorPosition(this.selectionEnd + p_146182_1_); + } + + /** + * sets the position of the cursor to the provided index + */ + public void setCursorPosition(int p_146190_1_) + { + this.cursorPosition = p_146190_1_; + int i = this.text.length(); + this.cursorPosition = MathHelper.clamp_int(this.cursorPosition, 0, i); + this.setSelectionPos(this.cursorPosition); + } + + /** + * sets the cursors position to the beginning + */ + public void setCursorPositionZero() + { + this.setCursorPosition(0); + } + + /** + * sets the cursors position to after the text + */ + public void setCursorPositionEnd() + { + this.setCursorPosition(this.text.length()); + } + + /** + * Call this method from your GuiScreen to process the keys into the textbox + */ + public boolean textboxKeyTyped(char p_146201_1_, int p_146201_2_) + { + if (!this.isFocused) + { + return false; + } + else if (GuiScreen.isKeyComboCtrlA(p_146201_2_)) + { + this.setCursorPositionEnd(); + this.setSelectionPos(0); + return true; + } + else if (GuiScreen.isKeyComboCtrlC(p_146201_2_)) + { + GuiScreen.setClipboardString(this.getSelectedText()); + return true; + } + else if (GuiScreen.isKeyComboCtrlV(p_146201_2_)) + { + if (this.isEnabled) + { + this.writeText(GuiScreen.getClipboardString()); + } + + return true; + } + else if (GuiScreen.isKeyComboCtrlX(p_146201_2_)) + { + GuiScreen.setClipboardString(this.getSelectedText()); + + if (this.isEnabled) + { + this.writeText(""); + } + + return true; + } + else + { + switch (p_146201_2_) + { + case 14: + if (GuiScreen.isCtrlKeyDown()) + { + if (this.isEnabled) + { + this.deleteWords(-1); + } + } + else if (this.isEnabled) + { + this.deleteFromCursor(-1); + } + + return true; + + case 199: + if (GuiScreen.isShiftKeyDown()) + { + this.setSelectionPos(0); + } + else + { + this.setCursorPositionZero(); + } + + return true; + + case 203: + if (GuiScreen.isShiftKeyDown()) + { + if (GuiScreen.isCtrlKeyDown()) + { + this.setSelectionPos(this.getNthWordFromPos(-1, this.getSelectionEnd())); + } + else + { + this.setSelectionPos(this.getSelectionEnd() - 1); + } + } + else if (GuiScreen.isCtrlKeyDown()) + { + this.setCursorPosition(this.getNthWordFromCursor(-1)); + } + else + { + this.moveCursorBy(-1); + } + + return true; + + case 205: + if (GuiScreen.isShiftKeyDown()) + { + if (GuiScreen.isCtrlKeyDown()) + { + this.setSelectionPos(this.getNthWordFromPos(1, this.getSelectionEnd())); + } + else + { + this.setSelectionPos(this.getSelectionEnd() + 1); + } + } + else if (GuiScreen.isCtrlKeyDown()) + { + this.setCursorPosition(this.getNthWordFromCursor(1)); + } + else + { + this.moveCursorBy(1); + } + + return true; + + case 207: + if (GuiScreen.isShiftKeyDown()) + { + this.setSelectionPos(this.text.length()); + } + else + { + this.setCursorPositionEnd(); + } + + return true; + + case 211: + if (GuiScreen.isCtrlKeyDown()) + { + if (this.isEnabled) + { + this.deleteWords(1); + } + } + else if (this.isEnabled) + { + this.deleteFromCursor(1); + } + + return true; + + default: + if (ChatAllowedCharacters.isAllowedCharacter(p_146201_1_)) + { + if (this.isEnabled) + { + this.writeText(Character.toString(p_146201_1_)); + } + + return true; + } + else + { + return false; + } + } + } + } + + /** + * Args: x, y, buttonClicked + */ + public void mouseClicked(int p_146192_1_, int p_146192_2_, int p_146192_3_) + { + boolean flag = p_146192_1_ >= this.xPosition && p_146192_1_ < this.xPosition + this.width && p_146192_2_ >= this.yPosition && p_146192_2_ < this.yPosition + this.height; + + if (this.canLoseFocus) + { + this.setFocused(flag); + } + + if (this.isFocused && flag && p_146192_3_ == 0) + { + int i = p_146192_1_ - this.xPosition; + + if (this.enableBackgroundDrawing) + { + i -= 4; + } + + String s = this.fontRendererInstance.trimStringToWidth(this.text.substring(this.lineScrollOffset), this.getWidth()); + this.setCursorPosition(this.fontRendererInstance.trimStringToWidth(s, i).length() + this.lineScrollOffset); + } + } + + /** + * Draws the textbox + */ + public void drawTextBox() + { + if (this.getVisible()) + { + if (this.getEnableBackgroundDrawing()) + { + drawRect(this.xPosition - 1, this.yPosition - 1, this.xPosition + this.width + 1, this.yPosition + this.height + 1, -6250336); + drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, -16777216); + } + + int i = this.isEnabled ? this.enabledColor : this.disabledColor; + int j = this.cursorPosition - this.lineScrollOffset; + int k = this.selectionEnd - this.lineScrollOffset; + String s = this.fontRendererInstance.trimStringToWidth(this.text.substring(this.lineScrollOffset), this.getWidth()); + boolean flag = j >= 0 && j <= s.length(); + boolean flag1 = this.isFocused && this.cursorCounter / 6 % 2 == 0 && flag; + int l = this.enableBackgroundDrawing ? this.xPosition + 4 : this.xPosition; + int i1 = this.enableBackgroundDrawing ? this.yPosition + (this.height - 8) / 2 : this.yPosition; + int j1 = l; + + if (k > s.length()) + { + k = s.length(); + } + + if (s.length() > 0) + { + String s1 = flag ? s.substring(0, j) : s; + j1 = this.fontRendererInstance.drawStringWithShadow(s1, (float)l, (float)i1, i); + } + + boolean flag2 = this.cursorPosition < this.text.length() || this.text.length() >= this.getMaxStringLength(); + int k1 = j1; + + if (!flag) + { + k1 = j > 0 ? l + this.width : l; + } + else if (flag2) + { + k1 = j1 - 1; + --j1; + } + + if (s.length() > 0 && flag && j < s.length()) + { + j1 = this.fontRendererInstance.drawStringWithShadow(s.substring(j), (float)j1, (float)i1, i); + } + + if (flag1) + { + if (flag2) + { + Gui.drawRect(k1, i1 - 1, k1 + 1, i1 + 1 + this.fontRendererInstance.FONT_HEIGHT, -3092272); + } + else + { + this.fontRendererInstance.drawStringWithShadow("_", (float)k1, (float)i1, i); + } + } + + if (k != j) + { + int l1 = l + this.fontRendererInstance.getStringWidth(s.substring(0, k)); + this.drawCursorVertical(k1, i1 - 1, l1 - 1, i1 + 1 + this.fontRendererInstance.FONT_HEIGHT); + } + } + } + + /** + * draws the vertical line cursor in the textbox + */ + private void drawCursorVertical(int p_146188_1_, int p_146188_2_, int p_146188_3_, int p_146188_4_) + { + if (p_146188_1_ < p_146188_3_) + { + int i = p_146188_1_; + p_146188_1_ = p_146188_3_; + p_146188_3_ = i; + } + + if (p_146188_2_ < p_146188_4_) + { + int j = p_146188_2_; + p_146188_2_ = p_146188_4_; + p_146188_4_ = j; + } + + if (p_146188_3_ > this.xPosition + this.width) + { + p_146188_3_ = this.xPosition + this.width; + } + + if (p_146188_1_ > this.xPosition + this.width) + { + p_146188_1_ = this.xPosition + this.width; + } + + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.color(0.0F, 0.0F, 255.0F, 255.0F); + GlStateManager.disableTexture2D(); + GlStateManager.enableColorLogic(); + GlStateManager.colorLogicOp(5387); + worldrenderer.begin(7, DefaultVertexFormats.POSITION); + worldrenderer.pos((double)p_146188_1_, (double)p_146188_4_, 0.0D).endVertex(); + worldrenderer.pos((double)p_146188_3_, (double)p_146188_4_, 0.0D).endVertex(); + worldrenderer.pos((double)p_146188_3_, (double)p_146188_2_, 0.0D).endVertex(); + worldrenderer.pos((double)p_146188_1_, (double)p_146188_2_, 0.0D).endVertex(); + tessellator.draw(); + GlStateManager.disableColorLogic(); + GlStateManager.enableTexture2D(); + } + + public void setMaxStringLength(int p_146203_1_) + { + this.maxStringLength = p_146203_1_; + + if (this.text.length() > p_146203_1_) + { + this.text = this.text.substring(0, p_146203_1_); + } + } + + /** + * returns the maximum number of character that can be contained in this textbox + */ + public int getMaxStringLength() + { + return this.maxStringLength; + } + + /** + * returns the current position of the cursor + */ + public int getCursorPosition() + { + return this.cursorPosition; + } + + /** + * get enable drawing background and outline + */ + public boolean getEnableBackgroundDrawing() + { + return this.enableBackgroundDrawing; + } + + /** + * enable drawing background and outline + */ + public void setEnableBackgroundDrawing(boolean p_146185_1_) + { + this.enableBackgroundDrawing = p_146185_1_; + } + + /** + * Sets the text colour for this textbox (disabled text will not use this colour) + */ + public void setTextColor(int p_146193_1_) + { + this.enabledColor = p_146193_1_; + } + + public void setDisabledTextColour(int p_146204_1_) + { + this.disabledColor = p_146204_1_; + } + + /** + * Sets focus to this gui element + */ + public void setFocused(boolean p_146195_1_) + { + if (p_146195_1_ && !this.isFocused) + { + this.cursorCounter = 0; + } + + this.isFocused = p_146195_1_; + } + + /** + * Getter for the focused field + */ + public boolean isFocused() + { + return this.isFocused; + } + + public void setEnabled(boolean p_146184_1_) + { + this.isEnabled = p_146184_1_; + } + + /** + * the side of the selection that is not the cursor, may be the same as the cursor + */ + public int getSelectionEnd() + { + return this.selectionEnd; + } + + /** + * returns the width of the textbox depending on if background drawing is enabled + */ + public int getWidth() + { + return this.getEnableBackgroundDrawing() ? this.width - 8 : this.width; + } + + /** + * Sets the position of the selection anchor (i.e. position the selection was started at) + */ + public void setSelectionPos(int p_146199_1_) + { + int i = this.text.length(); + + if (p_146199_1_ > i) + { + p_146199_1_ = i; + } + + if (p_146199_1_ < 0) + { + p_146199_1_ = 0; + } + + this.selectionEnd = p_146199_1_; + + if (this.fontRendererInstance != null) + { + if (this.lineScrollOffset > i) + { + this.lineScrollOffset = i; + } + + int j = this.getWidth(); + String s = this.fontRendererInstance.trimStringToWidth(this.text.substring(this.lineScrollOffset), j); + int k = s.length() + this.lineScrollOffset; + + if (p_146199_1_ == this.lineScrollOffset) + { + this.lineScrollOffset -= this.fontRendererInstance.trimStringToWidth(this.text, j, true).length(); + } + + if (p_146199_1_ > k) + { + this.lineScrollOffset += p_146199_1_ - k; + } + else if (p_146199_1_ <= this.lineScrollOffset) + { + this.lineScrollOffset -= this.lineScrollOffset - p_146199_1_; + } + + this.lineScrollOffset = MathHelper.clamp_int(this.lineScrollOffset, 0, i); + } + } + + /** + * if true the textbox can lose focus by clicking elsewhere on the screen + */ + public void setCanLoseFocus(boolean p_146205_1_) + { + this.canLoseFocus = p_146205_1_; + } + + /** + * returns true if this textbox is visible + */ + public boolean getVisible() + { + return this.visible; + } + + /** + * Sets whether or not this textbox is visible + */ + public void setVisible(boolean p_146189_1_) + { + this.visible = p_146189_1_; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java b/src/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java new file mode 100644 index 0000000..4a38cda --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java @@ -0,0 +1,105 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; + +public class GuiUtilRenderComponents +{ + public static String func_178909_a(String p_178909_0_, boolean p_178909_1_) + { + return !p_178909_1_ && !Minecraft.getMinecraft().gameSettings.chatColours ? EnumChatFormatting.getTextWithoutFormattingCodes(p_178909_0_) : p_178909_0_; + } + + public static List func_178908_a(IChatComponent p_178908_0_, int p_178908_1_, FontRenderer p_178908_2_, boolean p_178908_3_, boolean p_178908_4_) + { + int i = 0; + IChatComponent ichatcomponent = new ChatComponentText(""); + List list = Lists.newArrayList(); + List list1 = Lists.newArrayList(p_178908_0_); + + for (int j = 0; j < ((List)list1).size(); ++j) + { + IChatComponent ichatcomponent1 = (IChatComponent)list1.get(j); + String s = ichatcomponent1.getUnformattedTextForChat(); + boolean flag = false; + + if (s.contains("\n")) + { + int k = s.indexOf(10); + String s1 = s.substring(k + 1); + s = s.substring(0, k + 1); + ChatComponentText chatcomponenttext = new ChatComponentText(s1); + chatcomponenttext.setChatStyle(ichatcomponent1.getChatStyle().createShallowCopy()); + list1.add(j + 1, chatcomponenttext); + flag = true; + } + + String s4 = func_178909_a(ichatcomponent1.getChatStyle().getFormattingCode() + s, p_178908_4_); + String s5 = s4.endsWith("\n") ? s4.substring(0, s4.length() - 1) : s4; + int i1 = p_178908_2_.getStringWidth(s5); + ChatComponentText chatcomponenttext1 = new ChatComponentText(s5); + chatcomponenttext1.setChatStyle(ichatcomponent1.getChatStyle().createShallowCopy()); + + if (i + i1 > p_178908_1_) + { + String s2 = p_178908_2_.trimStringToWidth(s4, p_178908_1_ - i, false); + String s3 = s2.length() < s4.length() ? s4.substring(s2.length()) : null; + + if (s3 != null && s3.length() > 0) + { + int l = s2.lastIndexOf(" "); + + if (l >= 0 && p_178908_2_.getStringWidth(s4.substring(0, l)) > 0) + { + s2 = s4.substring(0, l); + + if (p_178908_3_) + { + ++l; + } + + s3 = s4.substring(l); + } + else if (i > 0 && !s4.contains(" ")) + { + s2 = ""; + s3 = s4; + } + + ChatComponentText chatcomponenttext2 = new ChatComponentText(s3); + chatcomponenttext2.setChatStyle(ichatcomponent1.getChatStyle().createShallowCopy()); + list1.add(j + 1, chatcomponenttext2); + } + + i1 = p_178908_2_.getStringWidth(s2); + chatcomponenttext1 = new ChatComponentText(s2); + chatcomponenttext1.setChatStyle(ichatcomponent1.getChatStyle().createShallowCopy()); + flag = true; + } + + if (i + i1 <= p_178908_1_) + { + i += i1; + ichatcomponent.appendSibling(chatcomponenttext1); + } + else + { + flag = true; + } + + if (flag) + { + list.add(ichatcomponent); + i = 0; + ichatcomponent = new ChatComponentText(""); + } + } + + list.add(ichatcomponent); + return list; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiVideoSettings.java b/src/minecraft/net/minecraft/client/gui/GuiVideoSettings.java new file mode 100644 index 0000000..d38969d --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiVideoSettings.java @@ -0,0 +1,224 @@ +package net.minecraft.client.gui; + +import java.io.IOException; + +import animeware.NightSky; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; +import optifine.Config; +import optifine.GuiAnimationSettingsOF; +import optifine.GuiDetailSettingsOF; +import optifine.GuiOptionButtonOF; +import optifine.GuiOptionSliderOF; +import optifine.GuiOtherSettingsOF; +import optifine.GuiPerformanceSettingsOF; +import optifine.GuiQualitySettingsOF; +import optifine.Lang; +import optifine.TooltipManager; +import shadersmod.client.GuiShaders; + +public class GuiVideoSettings extends GuiScreen +{ + private GuiScreen parentGuiScreen; + protected String screenTitle = "Video Settings"; + private GameSettings guiGameSettings; + + /** An array of all of GameSettings.Options's video options. */ + private static GameSettings.Options[] videoOptions = new GameSettings.Options[] {GameSettings.Options.GRAPHICS, GameSettings.Options.RENDER_DISTANCE, GameSettings.Options.AMBIENT_OCCLUSION, GameSettings.Options.FRAMERATE_LIMIT, GameSettings.Options.AO_LEVEL, GameSettings.Options.VIEW_BOBBING, GameSettings.Options.GUI_SCALE, GameSettings.Options.USE_VBO, GameSettings.Options.GAMMA, GameSettings.Options.BLOCK_ALTERNATIVES, GameSettings.Options.FOG_FANCY, GameSettings.Options.FOG_START}; + private static final String __OBFID = "CL_00000718"; + private TooltipManager tooltipManager = new TooltipManager(this); + + public GuiVideoSettings(GuiScreen parentScreenIn, GameSettings gameSettingsIn) + { + this.parentGuiScreen = parentScreenIn; + this.guiGameSettings = gameSettingsIn; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.screenTitle = I18n.format("options.videoTitle", new Object[0]); + this.buttonList.clear(); + + for (int i = 0; i < videoOptions.length; ++i) + { + GameSettings.Options gamesettings$options = videoOptions[i]; + + if (gamesettings$options != null) + { + int j = this.width / 2 - 155 + i % 2 * 160; + int k = this.height / 6 + 21 * (i / 2) - 12; + + if (gamesettings$options.getEnumFloat()) + { + this.buttonList.add(new GuiOptionSliderOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options)); + } + else + { + this.buttonList.add(new GuiOptionButtonOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options, this.guiGameSettings.getKeyBinding(gamesettings$options))); + } + } + } + + int l = this.height / 6 + 21 * (videoOptions.length / 2) - 12; + int i1 = 0; + i1 = this.width / 2 - 155 + 0; + this.buttonList.add(new GuiOptionButton(231, i1, l, Lang.get("of.options.shaders"))); + i1 = this.width / 2 - 155 + 160; + this.buttonList.add(new GuiOptionButton(202, i1, l, Lang.get("of.options.quality"))); + l = l + 21; + i1 = this.width / 2 - 155 + 0; + this.buttonList.add(new GuiOptionButton(201, i1, l, Lang.get("of.options.details"))); + i1 = this.width / 2 - 155 + 160; + this.buttonList.add(new GuiOptionButton(212, i1, l, Lang.get("of.options.performance"))); + l = l + 21; + i1 = this.width / 2 - 155 + 0; + this.buttonList.add(new GuiOptionButton(211, i1, l, Lang.get("of.options.animations"))); + i1 = this.width / 2 - 155 + 160; + this.buttonList.add(new GuiOptionButton(222, i1, l, Lang.get("of.options.other"))); + l = l + 21; + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168 + 11, I18n.format("gui.done", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + int i = this.guiGameSettings.guiScale; + + if (button.id < 200 && button instanceof GuiOptionButton) + { + this.guiGameSettings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1); + button.displayString = this.guiGameSettings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id)); + } + + if (button.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.parentGuiScreen); + } + + if (this.guiGameSettings.guiScale != i) + { + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + int j = scaledresolution.getScaledWidth(); + int k = scaledresolution.getScaledHeight(); + this.setWorldAndResolution(this.mc, j, k); + } + + if (button.id == 201) + { + this.mc.gameSettings.saveOptions(); + GuiDetailSettingsOF guidetailsettingsof = new GuiDetailSettingsOF(this, this.guiGameSettings); + this.mc.displayGuiScreen(guidetailsettingsof); + } + + if (button.id == 202) + { + this.mc.gameSettings.saveOptions(); + GuiQualitySettingsOF guiqualitysettingsof = new GuiQualitySettingsOF(this, this.guiGameSettings); + this.mc.displayGuiScreen(guiqualitysettingsof); + } + + if (button.id == 211) + { + this.mc.gameSettings.saveOptions(); + GuiAnimationSettingsOF guianimationsettingsof = new GuiAnimationSettingsOF(this, this.guiGameSettings); + this.mc.displayGuiScreen(guianimationsettingsof); + } + + if (button.id == 212) + { + this.mc.gameSettings.saveOptions(); + GuiPerformanceSettingsOF guiperformancesettingsof = new GuiPerformanceSettingsOF(this, this.guiGameSettings); + this.mc.displayGuiScreen(guiperformancesettingsof); + } + + if (button.id == 222) + { + this.mc.gameSettings.saveOptions(); + GuiOtherSettingsOF guiothersettingsof = new GuiOtherSettingsOF(this, this.guiGameSettings); + this.mc.displayGuiScreen(guiothersettingsof); + } + + if (button.id == 231) + { + if (Config.isAntialiasing() || Config.isAntialiasingConfigured()) + { + Config.showGuiMessage(Lang.get("of.message.shaders.aa1"), Lang.get("of.message.shaders.aa2")); + return; + } + + if (Config.isAnisotropicFiltering()) + { + Config.showGuiMessage(Lang.get("of.message.shaders.af1"), Lang.get("of.message.shaders.af2")); + return; + } + + if (Config.isFastRender()) + { + Config.showGuiMessage(Lang.get("of.message.shaders.fr1"), Lang.get("of.message.shaders.fr2")); + return; + } + + this.mc.gameSettings.saveOptions(); + GuiShaders guishaders = new GuiShaders(this, this.guiGameSettings); + this.mc.displayGuiScreen(guishaders); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.screenTitle, this.width / 2, 15, 16777215); + String s = Config.getVersion(); + String s1 = "HD_U"; + + if (s1.equals("HD")) + { + s = "OptiFine HD H8"; + } + + if (s1.equals("HD_U")) + { + s = "OptiFine HD H8 Ultra"; + } + + if (s1.equals("L")) + { + s = "OptiFine H8 Light"; + } + + this.drawString(this.fontRendererObj, s, 2, this.height - 10, 8421504); + String s2 = "Animeware " + NightSky.INSTANCE.VERSION; + int i = this.fontRendererObj.getStringWidth(s2); + this.drawString(this.fontRendererObj, s2, this.width - i - 2, this.height - 10, 8421504); + super.drawScreen(mouseX, mouseY, partialTicks); + this.tooltipManager.drawTooltips(mouseX, mouseY, this.buttonList); + } + + public static int getButtonWidth(GuiButton p_getButtonWidth_0_) + { + return p_getButtonWidth_0_.width; + } + + public static int getButtonHeight(GuiButton p_getButtonHeight_0_) + { + return p_getButtonHeight_0_.height; + } + + public static void drawGradientRect(GuiScreen p_drawGradientRect_0_, int p_drawGradientRect_1_, int p_drawGradientRect_2_, int p_drawGradientRect_3_, int p_drawGradientRect_4_, int p_drawGradientRect_5_, int p_drawGradientRect_6_) + { + p_drawGradientRect_0_.drawGradientRect(p_drawGradientRect_1_, p_drawGradientRect_2_, p_drawGradientRect_3_, p_drawGradientRect_4_, p_drawGradientRect_5_, p_drawGradientRect_6_); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiWinGame.java b/src/minecraft/net/minecraft/client/gui/GuiWinGame.java new file mode 100644 index 0000000..9f1a453 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiWinGame.java @@ -0,0 +1,245 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.List; +import java.util.Random; +import net.minecraft.client.audio.MusicTicker; +import net.minecraft.client.audio.SoundHandler; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.network.play.client.C16PacketClientStatus; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.Charsets; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class GuiWinGame extends GuiScreen +{ + private static final Logger logger = LogManager.getLogger(); + private static final ResourceLocation MINECRAFT_LOGO = new ResourceLocation("textures/gui/title/minecraft.png"); + private static final ResourceLocation VIGNETTE_TEXTURE = new ResourceLocation("textures/misc/vignette.png"); + private int field_146581_h; + private List field_146582_i; + private int field_146579_r; + private float field_146578_s = 0.5F; + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + MusicTicker musicticker = this.mc.func_181535_r(); + SoundHandler soundhandler = this.mc.getSoundHandler(); + + if (this.field_146581_h == 0) + { + musicticker.func_181557_a(); + musicticker.func_181558_a(MusicTicker.MusicType.CREDITS); + soundhandler.resumeSounds(); + } + + soundhandler.update(); + ++this.field_146581_h; + float f = (float)(this.field_146579_r + this.height + this.height + 24) / this.field_146578_s; + + if ((float)this.field_146581_h > f) + { + this.sendRespawnPacket(); + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (keyCode == 1) + { + this.sendRespawnPacket(); + } + } + + private void sendRespawnPacket() + { + this.mc.thePlayer.sendQueue.addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.PERFORM_RESPAWN)); + this.mc.displayGuiScreen((GuiScreen)null); + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return true; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + if (this.field_146582_i == null) + { + this.field_146582_i = Lists.newArrayList(); + + try + { + String s = ""; + String s1 = "" + EnumChatFormatting.WHITE + EnumChatFormatting.OBFUSCATED + EnumChatFormatting.GREEN + EnumChatFormatting.AQUA; + int i = 274; + InputStream inputstream = this.mc.getResourceManager().getResource(new ResourceLocation("texts/end.txt")).getInputStream(); + BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(inputstream, Charsets.UTF_8)); + Random random = new Random(8124371L); + + while ((s = bufferedreader.readLine()) != null) + { + String s2; + String s3; + + for (s = s.replaceAll("PLAYERNAME", this.mc.getSession().getUsername()); s.contains(s1); s = s2 + EnumChatFormatting.WHITE + EnumChatFormatting.OBFUSCATED + "XXXXXXXX".substring(0, random.nextInt(4) + 3) + s3) + { + int j = s.indexOf(s1); + s2 = s.substring(0, j); + s3 = s.substring(j + s1.length()); + } + + this.field_146582_i.addAll(this.mc.fontRendererObj.listFormattedStringToWidth(s, i)); + this.field_146582_i.add(""); + } + + inputstream.close(); + + for (int k = 0; k < 8; ++k) + { + this.field_146582_i.add(""); + } + + inputstream = this.mc.getResourceManager().getResource(new ResourceLocation("texts/credits.txt")).getInputStream(); + bufferedreader = new BufferedReader(new InputStreamReader(inputstream, Charsets.UTF_8)); + + while ((s = bufferedreader.readLine()) != null) + { + s = s.replaceAll("PLAYERNAME", this.mc.getSession().getUsername()); + s = s.replaceAll("\t", " "); + this.field_146582_i.addAll(this.mc.fontRendererObj.listFormattedStringToWidth(s, i)); + this.field_146582_i.add(""); + } + + inputstream.close(); + this.field_146579_r = this.field_146582_i.size() * 12; + } + catch (Exception exception) + { + logger.error((String)"Couldn\'t load credits", (Throwable)exception); + } + } + } + + private void drawWinGameScreen(int p_146575_1_, int p_146575_2_, float p_146575_3_) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + int i = this.width; + float f = 0.0F - ((float)this.field_146581_h + p_146575_3_) * 0.5F * this.field_146578_s; + float f1 = (float)this.height - ((float)this.field_146581_h + p_146575_3_) * 0.5F * this.field_146578_s; + float f2 = 0.015625F; + float f3 = ((float)this.field_146581_h + p_146575_3_ - 0.0F) * 0.02F; + float f4 = (float)(this.field_146579_r + this.height + this.height + 24) / this.field_146578_s; + float f5 = (f4 - 20.0F - ((float)this.field_146581_h + p_146575_3_)) * 0.005F; + + if (f5 < f3) + { + f3 = f5; + } + + if (f3 > 1.0F) + { + f3 = 1.0F; + } + + f3 = f3 * f3; + f3 = f3 * 96.0F / 255.0F; + worldrenderer.pos(0.0D, (double)this.height, (double)this.zLevel).tex(0.0D, (double)(f * f2)).color(f3, f3, f3, 1.0F).endVertex(); + worldrenderer.pos((double)i, (double)this.height, (double)this.zLevel).tex((double)((float)i * f2), (double)(f * f2)).color(f3, f3, f3, 1.0F).endVertex(); + worldrenderer.pos((double)i, 0.0D, (double)this.zLevel).tex((double)((float)i * f2), (double)(f1 * f2)).color(f3, f3, f3, 1.0F).endVertex(); + worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex(0.0D, (double)(f1 * f2)).color(f3, f3, f3, 1.0F).endVertex(); + tessellator.draw(); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawWinGameScreen(mouseX, mouseY, partialTicks); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int i = 274; + int j = this.width / 2 - i / 2; + int k = this.height + 50; + float f = -((float)this.field_146581_h + partialTicks) * this.field_146578_s; + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, f, 0.0F); + this.mc.getTextureManager().bindTexture(MINECRAFT_LOGO); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(j, k, 0, 0, 155, 44); + this.drawTexturedModalRect(j + 155, k, 0, 45, 155, 44); + int l = k + 200; + + for (int i1 = 0; i1 < this.field_146582_i.size(); ++i1) + { + if (i1 == this.field_146582_i.size() - 1) + { + float f1 = (float)l + f - (float)(this.height / 2 - 6); + + if (f1 < 0.0F) + { + GlStateManager.translate(0.0F, -f1, 0.0F); + } + } + + if ((float)l + f + 12.0F + 8.0F > 0.0F && (float)l + f < (float)this.height) + { + String s = (String)this.field_146582_i.get(i1); + + if (s.startsWith("[C]")) + { + this.fontRendererObj.drawStringWithShadow(s.substring(3), (float)(j + (i - this.fontRendererObj.getStringWidth(s.substring(3))) / 2), (float)l, 16777215); + } + else + { + this.fontRendererObj.fontRandom.setSeed((long)i1 * 4238972211L + (long)(this.field_146581_h / 4)); + this.fontRendererObj.drawStringWithShadow(s, (float)j, (float)l, 16777215); + } + } + + l += 12; + } + + GlStateManager.popMatrix(); + this.mc.getTextureManager().bindTexture(VIGNETTE_TEXTURE); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(0, 769); + int j1 = this.width; + int k1 = this.height; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos(0.0D, (double)k1, (double)this.zLevel).tex(0.0D, 1.0D).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); + worldrenderer.pos((double)j1, (double)k1, (double)this.zLevel).tex(1.0D, 1.0D).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); + worldrenderer.pos((double)j1, 0.0D, (double)this.zLevel).tex(1.0D, 0.0D).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); + worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex(0.0D, 0.0D).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); + tessellator.draw(); + GlStateManager.disableBlend(); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiYesNo.java b/src/minecraft/net/minecraft/client/gui/GuiYesNo.java new file mode 100644 index 0000000..9aa13bc --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiYesNo.java @@ -0,0 +1,112 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import net.minecraft.client.resources.I18n; + +public class GuiYesNo extends GuiScreen +{ + /** + * A reference to the screen object that created this. Used for navigating between screens. + */ + protected GuiYesNoCallback parentScreen; + protected String messageLine1; + private String messageLine2; + private final List field_175298_s = Lists.newArrayList(); + + /** The text shown for the first button in GuiYesNo */ + protected String confirmButtonText; + + /** The text shown for the second button in GuiYesNo */ + protected String cancelButtonText; + protected int parentButtonClickedId; + private int ticksUntilEnable; + + public GuiYesNo(GuiYesNoCallback p_i1082_1_, String p_i1082_2_, String p_i1082_3_, int p_i1082_4_) + { + this.parentScreen = p_i1082_1_; + this.messageLine1 = p_i1082_2_; + this.messageLine2 = p_i1082_3_; + this.parentButtonClickedId = p_i1082_4_; + this.confirmButtonText = I18n.format("gui.yes", new Object[0]); + this.cancelButtonText = I18n.format("gui.no", new Object[0]); + } + + public GuiYesNo(GuiYesNoCallback p_i1083_1_, String p_i1083_2_, String p_i1083_3_, String p_i1083_4_, String p_i1083_5_, int p_i1083_6_) + { + this.parentScreen = p_i1083_1_; + this.messageLine1 = p_i1083_2_; + this.messageLine2 = p_i1083_3_; + this.confirmButtonText = p_i1083_4_; + this.cancelButtonText = p_i1083_5_; + this.parentButtonClickedId = p_i1083_6_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.add(new GuiOptionButton(0, this.width / 2 - 155, this.height / 6 + 96, this.confirmButtonText)); + this.buttonList.add(new GuiOptionButton(1, this.width / 2 - 155 + 160, this.height / 6 + 96, this.cancelButtonText)); + this.field_175298_s.clear(); + this.field_175298_s.addAll(this.fontRendererObj.listFormattedStringToWidth(this.messageLine2, this.width - 50)); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + this.parentScreen.confirmClicked(button.id == 0, this.parentButtonClickedId); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.messageLine1, this.width / 2, 70, 16777215); + int i = 90; + + for (String s : this.field_175298_s) + { + this.drawCenteredString(this.fontRendererObj, s, this.width / 2, i, 16777215); + i += this.fontRendererObj.FONT_HEIGHT; + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /** + * Sets the number of ticks to wait before enabling the buttons. + */ + public void setButtonDelay(int p_146350_1_) + { + this.ticksUntilEnable = p_146350_1_; + + for (GuiButton guibutton : this.buttonList) + { + guibutton.enabled = false; + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + + if (--this.ticksUntilEnable == 0) + { + for (GuiButton guibutton : this.buttonList) + { + guibutton.enabled = true; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/GuiYesNoCallback.java b/src/minecraft/net/minecraft/client/gui/GuiYesNoCallback.java new file mode 100644 index 0000000..edb2f3f --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/GuiYesNoCallback.java @@ -0,0 +1,6 @@ +package net.minecraft.client.gui; + +public interface GuiYesNoCallback +{ + void confirmClicked(boolean result, int id); +} diff --git a/src/minecraft/net/minecraft/client/gui/IProgressMeter.java b/src/minecraft/net/minecraft/client/gui/IProgressMeter.java new file mode 100644 index 0000000..632fceb --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/IProgressMeter.java @@ -0,0 +1,8 @@ +package net.minecraft.client.gui; + +public interface IProgressMeter +{ + String[] lanSearchStates = new String[] {"oooooo", "Oooooo", "oOoooo", "ooOooo", "oooOoo", "ooooOo", "oooooO"}; + + void doneLoading(); +} diff --git a/src/minecraft/net/minecraft/client/gui/MapItemRenderer.java b/src/minecraft/net/minecraft/client/gui/MapItemRenderer.java new file mode 100644 index 0000000..f0c4776 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/MapItemRenderer.java @@ -0,0 +1,162 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Maps; +import java.util.Map; +import net.minecraft.block.material.MapColor; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec4b; +import net.minecraft.world.storage.MapData; + +public class MapItemRenderer +{ + private static final ResourceLocation mapIcons = new ResourceLocation("textures/map/map_icons.png"); + private final TextureManager textureManager; + private final Map loadedMaps = Maps.newHashMap(); + + public MapItemRenderer(TextureManager textureManagerIn) + { + this.textureManager = textureManagerIn; + } + + /** + * Updates a map texture + */ + public void updateMapTexture(MapData mapdataIn) + { + this.getMapRendererInstance(mapdataIn).updateMapTexture(); + } + + public void renderMap(MapData mapdataIn, boolean p_148250_2_) + { + this.getMapRendererInstance(mapdataIn).render(p_148250_2_); + } + + /** + * Returns {@link net.minecraft.client.gui.MapItemRenderer.Instance MapItemRenderer.Instance} with given map data + */ + private MapItemRenderer.Instance getMapRendererInstance(MapData mapdataIn) + { + MapItemRenderer.Instance mapitemrenderer$instance = (MapItemRenderer.Instance)this.loadedMaps.get(mapdataIn.mapName); + + if (mapitemrenderer$instance == null) + { + mapitemrenderer$instance = new MapItemRenderer.Instance(mapdataIn); + this.loadedMaps.put(mapdataIn.mapName, mapitemrenderer$instance); + } + + return mapitemrenderer$instance; + } + + /** + * Clears the currently loaded maps and removes their corresponding textures + */ + public void clearLoadedMaps() + { + for (MapItemRenderer.Instance mapitemrenderer$instance : this.loadedMaps.values()) + { + this.textureManager.deleteTexture(mapitemrenderer$instance.location); + } + + this.loadedMaps.clear(); + } + + class Instance + { + private final MapData mapData; + private final DynamicTexture mapTexture; + private final ResourceLocation location; + private final int[] mapTextureData; + + private Instance(MapData mapdataIn) + { + this.mapData = mapdataIn; + this.mapTexture = new DynamicTexture(128, 128); + this.mapTextureData = this.mapTexture.getTextureData(); + this.location = MapItemRenderer.this.textureManager.getDynamicTextureLocation("map/" + mapdataIn.mapName, this.mapTexture); + + for (int i = 0; i < this.mapTextureData.length; ++i) + { + this.mapTextureData[i] = 0; + } + } + + private void updateMapTexture() + { + for (int i = 0; i < 16384; ++i) + { + int j = this.mapData.colors[i] & 255; + + if (j / 4 == 0) + { + this.mapTextureData[i] = (i + i / 128 & 1) * 8 + 16 << 24; + } + else + { + this.mapTextureData[i] = MapColor.mapColorArray[j / 4].func_151643_b(j & 3); + } + } + + this.mapTexture.updateDynamicTexture(); + } + + private void render(boolean noOverlayRendering) + { + int i = 0; + int j = 0; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + float f = 0.0F; + MapItemRenderer.this.textureManager.bindTexture(this.location); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(1, 771, 0, 1); + GlStateManager.disableAlpha(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((double)((float)(i + 0) + f), (double)((float)(j + 128) - f), -0.009999999776482582D).tex(0.0D, 1.0D).endVertex(); + worldrenderer.pos((double)((float)(i + 128) - f), (double)((float)(j + 128) - f), -0.009999999776482582D).tex(1.0D, 1.0D).endVertex(); + worldrenderer.pos((double)((float)(i + 128) - f), (double)((float)(j + 0) + f), -0.009999999776482582D).tex(1.0D, 0.0D).endVertex(); + worldrenderer.pos((double)((float)(i + 0) + f), (double)((float)(j + 0) + f), -0.009999999776482582D).tex(0.0D, 0.0D).endVertex(); + tessellator.draw(); + GlStateManager.enableAlpha(); + GlStateManager.disableBlend(); + MapItemRenderer.this.textureManager.bindTexture(MapItemRenderer.mapIcons); + int k = 0; + + for (Vec4b vec4b : this.mapData.mapDecorations.values()) + { + if (!noOverlayRendering || vec4b.func_176110_a() == 1) + { + GlStateManager.pushMatrix(); + GlStateManager.translate((float)i + (float)vec4b.func_176112_b() / 2.0F + 64.0F, (float)j + (float)vec4b.func_176113_c() / 2.0F + 64.0F, -0.02F); + GlStateManager.rotate((float)(vec4b.func_176111_d() * 360) / 16.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.scale(4.0F, 4.0F, 3.0F); + GlStateManager.translate(-0.125F, 0.125F, 0.0F); + byte b0 = vec4b.func_176110_a(); + float f1 = (float)(b0 % 4 + 0) / 4.0F; + float f2 = (float)(b0 / 4 + 0) / 4.0F; + float f3 = (float)(b0 % 4 + 1) / 4.0F; + float f4 = (float)(b0 / 4 + 1) / 4.0F; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + float f5 = -0.001F; + worldrenderer.pos(-1.0D, 1.0D, (double)((float)k * -0.001F)).tex((double)f1, (double)f2).endVertex(); + worldrenderer.pos(1.0D, 1.0D, (double)((float)k * -0.001F)).tex((double)f3, (double)f2).endVertex(); + worldrenderer.pos(1.0D, -1.0D, (double)((float)k * -0.001F)).tex((double)f3, (double)f4).endVertex(); + worldrenderer.pos(-1.0D, -1.0D, (double)((float)k * -0.001F)).tex((double)f1, (double)f4).endVertex(); + tessellator.draw(); + GlStateManager.popMatrix(); + ++k; + } + } + + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, -0.04F); + GlStateManager.scale(1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/ScaledResolution.java b/src/minecraft/net/minecraft/client/gui/ScaledResolution.java new file mode 100644 index 0000000..dfa490d --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/ScaledResolution.java @@ -0,0 +1,67 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.MathHelper; + +public class ScaledResolution +{ + private final double scaledWidthD; + private final double scaledHeightD; + private int scaledWidth; + private int scaledHeight; + private int scaleFactor; + + public ScaledResolution(Minecraft p_i46445_1_) + { + this.scaledWidth = p_i46445_1_.displayWidth; + this.scaledHeight = p_i46445_1_.displayHeight; + this.scaleFactor = 1; + boolean flag = p_i46445_1_.isUnicode(); + int i = p_i46445_1_.gameSettings.guiScale; + + if (i == 0) + { + i = 1000; + } + + while (this.scaleFactor < i && this.scaledWidth / (this.scaleFactor + 1) >= 320 && this.scaledHeight / (this.scaleFactor + 1) >= 240) + { + ++this.scaleFactor; + } + + if (flag && this.scaleFactor % 2 != 0 && this.scaleFactor != 1) + { + --this.scaleFactor; + } + + this.scaledWidthD = (double)this.scaledWidth / (double)this.scaleFactor; + this.scaledHeightD = (double)this.scaledHeight / (double)this.scaleFactor; + this.scaledWidth = MathHelper.ceiling_double_int(this.scaledWidthD); + this.scaledHeight = MathHelper.ceiling_double_int(this.scaledHeightD); + } + + public int getScaledWidth() + { + return this.scaledWidth; + } + + public int getScaledHeight() + { + return this.scaledHeight; + } + + public double getScaledWidth_double() + { + return this.scaledWidthD; + } + + public double getScaledHeight_double() + { + return this.scaledHeightD; + } + + public int getScaleFactor() + { + return this.scaleFactor; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/ScreenChatOptions.java b/src/minecraft/net/minecraft/client/gui/ScreenChatOptions.java new file mode 100644 index 0000000..e6fe781 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/ScreenChatOptions.java @@ -0,0 +1,76 @@ +package net.minecraft.client.gui; + +import java.io.IOException; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; + +public class ScreenChatOptions extends GuiScreen +{ + private static final GameSettings.Options[] field_146399_a = new GameSettings.Options[] {GameSettings.Options.CHAT_VISIBILITY, GameSettings.Options.CHAT_COLOR, GameSettings.Options.CHAT_LINKS, GameSettings.Options.CHAT_OPACITY, GameSettings.Options.CHAT_LINKS_PROMPT, GameSettings.Options.CHAT_SCALE, GameSettings.Options.CHAT_HEIGHT_FOCUSED, GameSettings.Options.CHAT_HEIGHT_UNFOCUSED, GameSettings.Options.CHAT_WIDTH, GameSettings.Options.REDUCED_DEBUG_INFO}; + private final GuiScreen parentScreen; + private final GameSettings game_settings; + private String field_146401_i; + + public ScreenChatOptions(GuiScreen parentScreenIn, GameSettings gameSettingsIn) + { + this.parentScreen = parentScreenIn; + this.game_settings = gameSettingsIn; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + int i = 0; + this.field_146401_i = I18n.format("options.chat.title", new Object[0]); + + for (GameSettings.Options gamesettings$options : field_146399_a) + { + if (gamesettings$options.getEnumFloat()) + { + this.buttonList.add(new GuiOptionSlider(gamesettings$options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), gamesettings$options)); + } + else + { + this.buttonList.add(new GuiOptionButton(gamesettings$options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), gamesettings$options, this.game_settings.getKeyBinding(gamesettings$options))); + } + + ++i; + } + + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 120, I18n.format("gui.done", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id < 100 && button instanceof GuiOptionButton) + { + this.game_settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1); + button.displayString = this.game_settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id)); + } + + if (button.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.parentScreen); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.field_146401_i, this.width / 2, 20, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/ServerListEntryLanDetected.java b/src/minecraft/net/minecraft/client/gui/ServerListEntryLanDetected.java new file mode 100644 index 0000000..1c44b67 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/ServerListEntryLanDetected.java @@ -0,0 +1,67 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.network.LanServerDetector; +import net.minecraft.client.resources.I18n; + +public class ServerListEntryLanDetected implements GuiListExtended.IGuiListEntry +{ + private final GuiMultiplayer field_148292_c; + protected final Minecraft mc; + protected final LanServerDetector.LanServer field_148291_b; + private long field_148290_d = 0L; + + protected ServerListEntryLanDetected(GuiMultiplayer p_i45046_1_, LanServerDetector.LanServer p_i45046_2_) + { + this.field_148292_c = p_i45046_1_; + this.field_148291_b = p_i45046_2_; + this.mc = Minecraft.getMinecraft(); + } + + public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) + { + this.mc.fontRendererObj.drawString(I18n.format("lanServer.title", new Object[0]), x + 32 + 3, y + 1, 16777215); + this.mc.fontRendererObj.drawString(this.field_148291_b.getServerMotd(), x + 32 + 3, y + 12, 8421504); + + if (this.mc.gameSettings.hideServerAddress) + { + this.mc.fontRendererObj.drawString(I18n.format("selectServer.hiddenAddress", new Object[0]), x + 32 + 3, y + 12 + 11, 3158064); + } + else + { + this.mc.fontRendererObj.drawString(this.field_148291_b.getServerIpPort(), x + 32 + 3, y + 12 + 11, 3158064); + } + } + + /** + * Returns true if the mouse has been pressed on this control. + */ + public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_) + { + this.field_148292_c.selectServer(slotIndex); + + if (Minecraft.getSystemTime() - this.field_148290_d < 250L) + { + this.field_148292_c.connectToSelected(); + } + + this.field_148290_d = Minecraft.getSystemTime(); + return false; + } + + public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) + { + } + + /** + * Fired when the mouse button is released. Arguments: index, x, y, mouseEvent, relativeX, relativeY + */ + public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) + { + } + + public LanServerDetector.LanServer getLanServer() + { + return this.field_148291_b; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/ServerListEntryLanScan.java b/src/minecraft/net/minecraft/client/gui/ServerListEntryLanScan.java new file mode 100644 index 0000000..d0116a7 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/ServerListEntryLanScan.java @@ -0,0 +1,53 @@ +package net.minecraft.client.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; + +public class ServerListEntryLanScan implements GuiListExtended.IGuiListEntry +{ + private final Minecraft mc = Minecraft.getMinecraft(); + + public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) + { + int i = y + slotHeight / 2 - this.mc.fontRendererObj.FONT_HEIGHT / 2; + this.mc.fontRendererObj.drawString(I18n.format("lanServer.scanning", new Object[0]), this.mc.currentScreen.width / 2 - this.mc.fontRendererObj.getStringWidth(I18n.format("lanServer.scanning", new Object[0])) / 2, i, 16777215); + String s; + + switch ((int)(Minecraft.getSystemTime() / 300L % 4L)) + { + case 0: + default: + s = "O o o"; + break; + + case 1: + case 3: + s = "o O o"; + break; + + case 2: + s = "o o O"; + } + + this.mc.fontRendererObj.drawString(s, this.mc.currentScreen.width / 2 - this.mc.fontRendererObj.getStringWidth(s) / 2, i + this.mc.fontRendererObj.FONT_HEIGHT, 8421504); + } + + public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) + { + } + + /** + * Returns true if the mouse has been pressed on this control. + */ + public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_) + { + return false; + } + + /** + * Fired when the mouse button is released. Arguments: index, x, y, mouseEvent, relativeX, relativeY + */ + public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) + { + } +} diff --git a/src/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java b/src/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java new file mode 100644 index 0000000..498072a --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java @@ -0,0 +1,363 @@ +package net.minecraft.client.gui; + +import com.google.common.base.Charsets; +import com.google.common.util.concurrent.ThreadFactoryBuilder; + +import animeware.ServerDataFeatured; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufInputStream; +import io.netty.buffer.Unpooled; +import io.netty.handler.codec.base64.Base64; +import java.awt.image.BufferedImage; +import java.net.UnknownHostException; +import java.util.List; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; + +import org.apache.commons.lang3.Validate; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ServerListEntryNormal implements GuiListExtended.IGuiListEntry +{ + private static final Logger logger = LogManager.getLogger(); + private static final ThreadPoolExecutor field_148302_b = new ScheduledThreadPoolExecutor(5, (new ThreadFactoryBuilder()).setNameFormat("Server Pinger #%d").setDaemon(true).build()); + private static final ResourceLocation UNKNOWN_SERVER = new ResourceLocation("textures/misc/unknown_server.png"); + private static final ResourceLocation SERVER_SELECTION_BUTTONS = new ResourceLocation("textures/gui/server_selection.png"); + private final GuiMultiplayer field_148303_c; + private final Minecraft mc; + private final ServerData field_148301_e; + private final ResourceLocation field_148306_i; + private String field_148299_g; + private DynamicTexture field_148305_h; + private long field_148298_f; + + protected ServerListEntryNormal(GuiMultiplayer p_i45048_1_, ServerData p_i45048_2_) + { + this.field_148303_c = p_i45048_1_; + this.field_148301_e = p_i45048_2_; + this.mc = Minecraft.getMinecraft(); + this.field_148306_i = new ResourceLocation("servers/" + p_i45048_2_.serverIP + "/icon"); + this.field_148305_h = (DynamicTexture)this.mc.getTextureManager().getTexture(this.field_148306_i); + } + + public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) + { + if (!this.field_148301_e.field_78841_f) + { + this.field_148301_e.field_78841_f = true; + this.field_148301_e.pingToServer = -2L; + this.field_148301_e.serverMOTD = ""; + this.field_148301_e.populationInfo = ""; + field_148302_b.submit(new Runnable() + { + public void run() + { + try + { + ServerListEntryNormal.this.field_148303_c.getOldServerPinger().ping(ServerListEntryNormal.this.field_148301_e); + } + catch (UnknownHostException var2) + { + ServerListEntryNormal.this.field_148301_e.pingToServer = -1L; + ServerListEntryNormal.this.field_148301_e.serverMOTD = EnumChatFormatting.DARK_RED + "Can\'t resolve hostname"; + } + catch (Exception var3) + { + ServerListEntryNormal.this.field_148301_e.pingToServer = -1L; + ServerListEntryNormal.this.field_148301_e.serverMOTD = EnumChatFormatting.DARK_RED + "Can\'t connect to server."; + } + } + }); + } + + boolean isFeaturedServer = (field_148301_e instanceof ServerDataFeatured); + if(isFeaturedServer) { + drawImg(x, y, false, ServerDataFeatured.SERVER_ICON); + } + + boolean flag = this.field_148301_e.version > 47; + boolean flag1 = this.field_148301_e.version < 47; + boolean flag2 = flag || flag1; + this.mc.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215); + List list = this.mc.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2); + + for (int i = 0; i < Math.min(list.size(), 2); ++i) + { + this.mc.fontRendererObj.drawString((String)list.get(i), x + 32 + 3, y + 12 + this.mc.fontRendererObj.FONT_HEIGHT * i, 8421504); + } + + String s2 = flag2 ? EnumChatFormatting.DARK_RED + this.field_148301_e.gameVersion : this.field_148301_e.populationInfo; + int j = this.mc.fontRendererObj.getStringWidth(s2); + this.mc.fontRendererObj.drawString(s2, x + listWidth - j - 15 - 2, y + 1, 8421504); + int k = 0; + String s = null; + int l; + String s1; + + if (flag2) + { + l = 5; + s1 = flag ? "Client out of date!" : "Server out of date!"; + s = this.field_148301_e.playerList; + } + else if (this.field_148301_e.field_78841_f && this.field_148301_e.pingToServer != -2L) + { + if (this.field_148301_e.pingToServer < 0L) + { + l = 5; + } + else if (this.field_148301_e.pingToServer < 150L) + { + l = 0; + } + else if (this.field_148301_e.pingToServer < 300L) + { + l = 1; + } + else if (this.field_148301_e.pingToServer < 600L) + { + l = 2; + } + else if (this.field_148301_e.pingToServer < 1000L) + { + l = 3; + } + else + { + l = 4; + } + + if (this.field_148301_e.pingToServer < 0L) + { + s1 = "(no connection)"; + } + else + { + s1 = this.field_148301_e.pingToServer + "ms"; + s = this.field_148301_e.playerList; + } + } + else + { + k = 1; + l = (int)(Minecraft.getSystemTime() / 100L + (long)(slotIndex * 2) & 7L); + + if (l > 4) + { + l = 8 - l; + } + + s1 = "Pinging..."; + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(Gui.icons); + Gui.drawModalRectWithCustomSizedTexture(x + listWidth - 15, y, (float)(k * 10), (float)(176 + l * 8), 10, 8, 256.0F, 256.0F); + + if (this.field_148301_e.getBase64EncodedIconData() != null && !this.field_148301_e.getBase64EncodedIconData().equals(this.field_148299_g)) + { + this.field_148299_g = this.field_148301_e.getBase64EncodedIconData(); + this.prepareServerIcon(); + this.field_148303_c.getServerList().saveServerList(); + } + + if (this.field_148305_h != null) + { + this.func_178012_a(x, y, this.field_148306_i); + } + else + { + this.func_178012_a(x, y, UNKNOWN_SERVER); + } + + int i1 = mouseX - x; + int j1 = mouseY - y; + + if (i1 >= listWidth - 15 && i1 <= listWidth - 5 && j1 >= 0 && j1 <= 8) + { + this.field_148303_c.setHoveringText(s1); + } + else if (i1 >= listWidth - j - 15 - 2 && i1 <= listWidth - 15 - 2 && j1 >= 0 && j1 <= 8) + { + this.field_148303_c.setHoveringText(s); + } + + if (this.mc.gameSettings.touchscreen || isSelected) + { + this.mc.getTextureManager().bindTexture(SERVER_SELECTION_BUTTONS); + Gui.drawRect(x, y, x + 32, y + 32, -1601138544); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + int k1 = mouseX - x; + int l1 = mouseY - y; + + if (this.func_178013_b()) + { + if (k1 < 32 && k1 > 16) + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 32.0F, 32, 32, 256.0F, 256.0F); + } + else + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 0.0F, 32, 32, 256.0F, 256.0F); + } + } + + if(!isFeaturedServer) { + + if (this.field_148303_c.func_175392_a(this, slotIndex)) + { + if (k1 < 16 && l1 < 16) + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 96.0F, 32.0F, 32, 32, 256.0F, 256.0F); + } + else + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 96.0F, 0.0F, 32, 32, 256.0F, 256.0F); + } + } + + if (this.field_148303_c.func_175394_b(this, slotIndex)) + { + if (k1 < 16 && l1 > 16) + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 64.0F, 32.0F, 32, 32, 256.0F, 256.0F); + } + else + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 64.0F, 0.0F, 32, 32, 256.0F, 256.0F); + } + } + } + } + } + + private void drawImg(int x, int y, boolean lower, ResourceLocation texture) { + this.mc.getTextureManager().bindTexture(texture); + Gui.drawModalRectWithCustomSizedTexture(x - 16, lower ? y + 16 : y , 0.0F, 0.0F, 16, 16, 16, 16); + + } + + protected void func_178012_a(int p_178012_1_, int p_178012_2_, ResourceLocation p_178012_3_) + { + this.mc.getTextureManager().bindTexture(p_178012_3_); + GlStateManager.enableBlend(); + Gui.drawModalRectWithCustomSizedTexture(p_178012_1_, p_178012_2_, 0.0F, 0.0F, 32, 32, 32.0F, 32.0F); + GlStateManager.disableBlend(); + } + + private boolean func_178013_b() + { + return true; + } + + private void prepareServerIcon() + { + if (this.field_148301_e.getBase64EncodedIconData() == null) + { + this.mc.getTextureManager().deleteTexture(this.field_148306_i); + this.field_148305_h = null; + } + else + { + ByteBuf bytebuf = Unpooled.copiedBuffer((CharSequence)this.field_148301_e.getBase64EncodedIconData(), Charsets.UTF_8); + ByteBuf bytebuf1 = Base64.decode(bytebuf); + BufferedImage bufferedimage; + label101: + { + try + { + bufferedimage = TextureUtil.readBufferedImage(new ByteBufInputStream(bytebuf1)); + Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]); + Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]); + break label101; + } + catch (Throwable throwable) + { + logger.error("Invalid icon for server " + this.field_148301_e.serverName + " (" + this.field_148301_e.serverIP + ")", throwable); + this.field_148301_e.setBase64EncodedIconData((String)null); + } + finally + { + bytebuf.release(); + bytebuf1.release(); + } + + return; + } + + if (this.field_148305_h == null) + { + this.field_148305_h = new DynamicTexture(bufferedimage.getWidth(), bufferedimage.getHeight()); + this.mc.getTextureManager().loadTexture(this.field_148306_i, this.field_148305_h); + } + + bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), this.field_148305_h.getTextureData(), 0, bufferedimage.getWidth()); + this.field_148305_h.updateDynamicTexture(); + } + } + + /** + * Returns true if the mouse has been pressed on this control. + */ + public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_) + { + if (p_148278_5_ <= 32) + { + if (p_148278_5_ < 32 && p_148278_5_ > 16 && this.func_178013_b()) + { + this.field_148303_c.selectServer(slotIndex); + this.field_148303_c.connectToSelected(); + return true; + } + + if(!(this.field_148303_c.getServerList().getServerData(slotIndex) instanceof ServerDataFeatured)) { + + if (p_148278_5_ < 16 && p_148278_6_ < 16 && this.field_148303_c.func_175392_a(this, slotIndex)) + { + this.field_148303_c.func_175391_a(this, slotIndex, GuiScreen.isShiftKeyDown()); + return true; + } + + if (p_148278_5_ < 16 && p_148278_6_ > 16 && this.field_148303_c.func_175394_b(this, slotIndex)) + { + this.field_148303_c.func_175393_b(this, slotIndex, GuiScreen.isShiftKeyDown()); + return true; + } + } + } + + this.field_148303_c.selectServer(slotIndex); + + if (Minecraft.getSystemTime() - this.field_148298_f < 250L) + { + this.field_148303_c.connectToSelected(); + } + + this.field_148298_f = Minecraft.getSystemTime(); + return false; + } + + public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) + { + } + + /** + * Fired when the mouse button is released. Arguments: index, x, y, mouseEvent, relativeX, relativeY + */ + public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) + { + } + + public ServerData getServerData() + { + return this.field_148301_e; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/ServerSelectionList.java b/src/minecraft/net/minecraft/client/gui/ServerSelectionList.java new file mode 100644 index 0000000..bbebbdf --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/ServerSelectionList.java @@ -0,0 +1,103 @@ +package net.minecraft.client.gui; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ServerList; +import net.minecraft.client.network.LanServerDetector; + +public class ServerSelectionList extends GuiListExtended +{ + private final GuiMultiplayer owner; + private final List field_148198_l = Lists.newArrayList(); + private final List field_148199_m = Lists.newArrayList(); + private final GuiListExtended.IGuiListEntry lanScanEntry = new ServerListEntryLanScan(); + private int selectedSlotIndex = -1; + + public ServerSelectionList(GuiMultiplayer ownerIn, Minecraft mcIn, int widthIn, int heightIn, int topIn, int bottomIn, int slotHeightIn) + { + super(mcIn, widthIn, heightIn, topIn, bottomIn, slotHeightIn); + this.owner = ownerIn; + } + + /** + * Gets the IGuiListEntry object for the given index + */ + public GuiListExtended.IGuiListEntry getListEntry(int index) + { + if (index < this.field_148198_l.size()) + { + return (GuiListExtended.IGuiListEntry)this.field_148198_l.get(index); + } + else + { + index = index - this.field_148198_l.size(); + + if (index == 0) + { + return this.lanScanEntry; + } + else + { + --index; + return (GuiListExtended.IGuiListEntry)this.field_148199_m.get(index); + } + } + } + + public int getSize() + { + return this.field_148198_l.size() + 1 + this.field_148199_m.size(); + } + + public void setSelectedSlotIndex(int selectedSlotIndexIn) + { + this.selectedSlotIndex = selectedSlotIndexIn; + } + + /** + * Returns true if the element passed in is currently selected + */ + protected boolean isSelected(int slotIndex) + { + return slotIndex == this.selectedSlotIndex; + } + + public int func_148193_k() + { + return this.selectedSlotIndex; + } + + public void func_148195_a(ServerList p_148195_1_) + { + this.field_148198_l.clear(); + + for (int i = 0; i < p_148195_1_.countServers(); ++i) + { + this.field_148198_l.add(new ServerListEntryNormal(this.owner, p_148195_1_.getServerData(i))); + } + } + + public void func_148194_a(List p_148194_1_) + { + this.field_148199_m.clear(); + + for (LanServerDetector.LanServer lanserverdetector$lanserver : p_148194_1_) + { + this.field_148199_m.add(new ServerListEntryLanDetected(this.owner, lanserverdetector$lanserver)); + } + } + + protected int getScrollBarX() + { + return super.getScrollBarX() + 30; + } + + /** + * Gets the width of the list + */ + public int getListWidth() + { + return super.getListWidth() + 85; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/achievement/GuiAchievement.java b/src/minecraft/net/minecraft/client/gui/achievement/GuiAchievement.java new file mode 100644 index 0000000..3fc9984 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/achievement/GuiAchievement.java @@ -0,0 +1,145 @@ +package net.minecraft.client.gui.achievement; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.resources.I18n; +import net.minecraft.stats.Achievement; +import net.minecraft.util.ResourceLocation; + +public class GuiAchievement extends Gui +{ + private static final ResourceLocation achievementBg = new ResourceLocation("textures/gui/achievement/achievement_background.png"); + private Minecraft mc; + private int width; + private int height; + private String achievementTitle; + private String achievementDescription; + private Achievement theAchievement; + private long notificationTime; + private RenderItem renderItem; + private boolean permanentNotification; + + public GuiAchievement(Minecraft mc) + { + this.mc = mc; + this.renderItem = mc.getRenderItem(); + } + + public void displayAchievement(Achievement ach) + { + this.achievementTitle = I18n.format("achievement.get", new Object[0]); + this.achievementDescription = ach.getStatName().getUnformattedText(); + this.notificationTime = Minecraft.getSystemTime(); + this.theAchievement = ach; + this.permanentNotification = false; + } + + public void displayUnformattedAchievement(Achievement achievementIn) + { + this.achievementTitle = achievementIn.getStatName().getUnformattedText(); + this.achievementDescription = achievementIn.getDescription(); + this.notificationTime = Minecraft.getSystemTime() + 2500L; + this.theAchievement = achievementIn; + this.permanentNotification = true; + } + + private void updateAchievementWindowScale() + { + GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + this.width = this.mc.displayWidth; + this.height = this.mc.displayHeight; + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + this.width = scaledresolution.getScaledWidth(); + this.height = scaledresolution.getScaledHeight(); + GlStateManager.clear(256); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, (double)this.width, (double)this.height, 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + } + + public void updateAchievementWindow() + { + if (this.theAchievement != null && this.notificationTime != 0L && Minecraft.getMinecraft().thePlayer != null) + { + double d0 = (double)(Minecraft.getSystemTime() - this.notificationTime) / 3000.0D; + + if (!this.permanentNotification) + { + if (d0 < 0.0D || d0 > 1.0D) + { + this.notificationTime = 0L; + return; + } + } + else if (d0 > 0.5D) + { + d0 = 0.5D; + } + + this.updateAchievementWindowScale(); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); + double d1 = d0 * 2.0D; + + if (d1 > 1.0D) + { + d1 = 2.0D - d1; + } + + d1 = d1 * 4.0D; + d1 = 1.0D - d1; + + if (d1 < 0.0D) + { + d1 = 0.0D; + } + + d1 = d1 * d1; + d1 = d1 * d1; + int i = this.width - 160; + int j = 0 - (int)(d1 * 36.0D); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableTexture2D(); + this.mc.getTextureManager().bindTexture(achievementBg); + GlStateManager.disableLighting(); + this.drawTexturedModalRect(i, j, 96, 202, 160, 32); + + if (this.permanentNotification) + { + this.mc.fontRendererObj.drawSplitString(this.achievementDescription, i + 30, j + 7, 120, -1); + } + else + { + this.mc.fontRendererObj.drawString(this.achievementTitle, i + 30, j + 7, -256); + this.mc.fontRendererObj.drawString(this.achievementDescription, i + 30, j + 18, -1); + } + + RenderHelper.enableGUIStandardItemLighting(); + GlStateManager.disableLighting(); + GlStateManager.enableRescaleNormal(); + GlStateManager.enableColorMaterial(); + GlStateManager.enableLighting(); + this.renderItem.renderItemAndEffectIntoGUI(this.theAchievement.theItemStack, i + 8, j + 8); + GlStateManager.disableLighting(); + GlStateManager.depthMask(true); + GlStateManager.enableDepth(); + } + } + + public void clearAchievements() + { + this.theAchievement = null; + this.notificationTime = 0L; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java b/src/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java new file mode 100644 index 0000000..800a156 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java @@ -0,0 +1,568 @@ +package net.minecraft.client.gui.achievement; + +import java.io.IOException; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiOptionButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.IProgressMeter; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.I18n; +import net.minecraft.init.Blocks; +import net.minecraft.network.play.client.C16PacketClientStatus; +import net.minecraft.stats.Achievement; +import net.minecraft.stats.AchievementList; +import net.minecraft.stats.StatFileWriter; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Mouse; + +public class GuiAchievements extends GuiScreen implements IProgressMeter +{ + private static final int field_146572_y = AchievementList.minDisplayColumn * 24 - 112; + private static final int field_146571_z = AchievementList.minDisplayRow * 24 - 112; + private static final int field_146559_A = AchievementList.maxDisplayColumn * 24 - 77; + private static final int field_146560_B = AchievementList.maxDisplayRow * 24 - 77; + private static final ResourceLocation ACHIEVEMENT_BACKGROUND = new ResourceLocation("textures/gui/achievement/achievement_background.png"); + protected GuiScreen parentScreen; + protected int field_146555_f = 256; + protected int field_146557_g = 202; + protected int field_146563_h; + protected int field_146564_i; + protected float field_146570_r = 1.0F; + protected double field_146569_s; + protected double field_146568_t; + protected double field_146567_u; + protected double field_146566_v; + protected double field_146565_w; + protected double field_146573_x; + private int field_146554_D; + private StatFileWriter statFileWriter; + private boolean loadingAchievements = true; + + public GuiAchievements(GuiScreen parentScreenIn, StatFileWriter statFileWriterIn) + { + this.parentScreen = parentScreenIn; + this.statFileWriter = statFileWriterIn; + int i = 141; + int j = 141; + this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - i / 2 - 12); + this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - j / 2); + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); + this.buttonList.clear(); + this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (!this.loadingAchievements) + { + if (button.id == 1) + { + this.mc.displayGuiScreen(this.parentScreen); + } + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode()) + { + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + } + else + { + super.keyTyped(typedChar, keyCode); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + if (this.loadingAchievements) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, I18n.format("multiplayer.downloadingStats", new Object[0]), this.width / 2, this.height / 2, 16777215); + this.drawCenteredString(this.fontRendererObj, lanSearchStates[(int)(Minecraft.getSystemTime() / 150L % (long)lanSearchStates.length)], this.width / 2, this.height / 2 + this.fontRendererObj.FONT_HEIGHT * 2, 16777215); + } + else + { + if (Mouse.isButtonDown(0)) + { + int i = (this.width - this.field_146555_f) / 2; + int j = (this.height - this.field_146557_g) / 2; + int k = i + 8; + int l = j + 17; + + if ((this.field_146554_D == 0 || this.field_146554_D == 1) && mouseX >= k && mouseX < k + 224 && mouseY >= l && mouseY < l + 155) + { + if (this.field_146554_D == 0) + { + this.field_146554_D = 1; + } + else + { + this.field_146567_u -= (double)((float)(mouseX - this.field_146563_h) * this.field_146570_r); + this.field_146566_v -= (double)((float)(mouseY - this.field_146564_i) * this.field_146570_r); + this.field_146565_w = this.field_146569_s = this.field_146567_u; + this.field_146573_x = this.field_146568_t = this.field_146566_v; + } + + this.field_146563_h = mouseX; + this.field_146564_i = mouseY; + } + } + else + { + this.field_146554_D = 0; + } + + int i1 = Mouse.getDWheel(); + float f3 = this.field_146570_r; + + if (i1 < 0) + { + this.field_146570_r += 0.25F; + } + else if (i1 > 0) + { + this.field_146570_r -= 0.25F; + } + + this.field_146570_r = MathHelper.clamp_float(this.field_146570_r, 1.0F, 2.0F); + + if (this.field_146570_r != f3) + { + float f5 = f3 - this.field_146570_r; + float f4 = f3 * (float)this.field_146555_f; + float f = f3 * (float)this.field_146557_g; + float f1 = this.field_146570_r * (float)this.field_146555_f; + float f2 = this.field_146570_r * (float)this.field_146557_g; + this.field_146567_u -= (double)((f1 - f4) * 0.5F); + this.field_146566_v -= (double)((f2 - f) * 0.5F); + this.field_146565_w = this.field_146569_s = this.field_146567_u; + this.field_146573_x = this.field_146568_t = this.field_146566_v; + } + + if (this.field_146565_w < (double)field_146572_y) + { + this.field_146565_w = (double)field_146572_y; + } + + if (this.field_146573_x < (double)field_146571_z) + { + this.field_146573_x = (double)field_146571_z; + } + + if (this.field_146565_w >= (double)field_146559_A) + { + this.field_146565_w = (double)(field_146559_A - 1); + } + + if (this.field_146573_x >= (double)field_146560_B) + { + this.field_146573_x = (double)(field_146560_B - 1); + } + + this.drawDefaultBackground(); + this.drawAchievementScreen(mouseX, mouseY, partialTicks); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + this.drawTitle(); + GlStateManager.enableLighting(); + GlStateManager.enableDepth(); + } + } + + public void doneLoading() + { + if (this.loadingAchievements) + { + this.loadingAchievements = false; + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + if (!this.loadingAchievements) + { + this.field_146569_s = this.field_146567_u; + this.field_146568_t = this.field_146566_v; + double d0 = this.field_146565_w - this.field_146567_u; + double d1 = this.field_146573_x - this.field_146566_v; + + if (d0 * d0 + d1 * d1 < 4.0D) + { + this.field_146567_u += d0; + this.field_146566_v += d1; + } + else + { + this.field_146567_u += d0 * 0.85D; + this.field_146566_v += d1 * 0.85D; + } + } + } + + protected void drawTitle() + { + int i = (this.width - this.field_146555_f) / 2; + int j = (this.height - this.field_146557_g) / 2; + this.fontRendererObj.drawString(I18n.format("gui.achievements", new Object[0]), i + 15, j + 5, 4210752); + } + + protected void drawAchievementScreen(int p_146552_1_, int p_146552_2_, float p_146552_3_) + { + int i = MathHelper.floor_double(this.field_146569_s + (this.field_146567_u - this.field_146569_s) * (double)p_146552_3_); + int j = MathHelper.floor_double(this.field_146568_t + (this.field_146566_v - this.field_146568_t) * (double)p_146552_3_); + + if (i < field_146572_y) + { + i = field_146572_y; + } + + if (j < field_146571_z) + { + j = field_146571_z; + } + + if (i >= field_146559_A) + { + i = field_146559_A - 1; + } + + if (j >= field_146560_B) + { + j = field_146560_B - 1; + } + + int k = (this.width - this.field_146555_f) / 2; + int l = (this.height - this.field_146557_g) / 2; + int i1 = k + 16; + int j1 = l + 17; + this.zLevel = 0.0F; + GlStateManager.depthFunc(518); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)i1, (float)j1, -200.0F); + GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F); + GlStateManager.enableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.enableRescaleNormal(); + GlStateManager.enableColorMaterial(); + int k1 = i + 288 >> 4; + int l1 = j + 288 >> 4; + int i2 = (i + 288) % 16; + int j2 = (j + 288) % 16; + int k2 = 4; + int l2 = 8; + int i3 = 10; + int j3 = 22; + int k3 = 37; + Random random = new Random(); + float f = 16.0F / this.field_146570_r; + float f1 = 16.0F / this.field_146570_r; + + for (int l3 = 0; (float)l3 * f - (float)j2 < 155.0F; ++l3) + { + float f2 = 0.6F - (float)(l1 + l3) / 25.0F * 0.3F; + GlStateManager.color(f2, f2, f2, 1.0F); + + for (int i4 = 0; (float)i4 * f1 - (float)i2 < 224.0F; ++i4) + { + random.setSeed((long)(this.mc.getSession().getPlayerID().hashCode() + k1 + i4 + (l1 + l3) * 16)); + int j4 = random.nextInt(1 + l1 + l3) + (l1 + l3) / 2; + TextureAtlasSprite textureatlassprite = this.func_175371_a(Blocks.sand); + + if (j4 <= 37 && l1 + l3 != 35) + { + if (j4 == 22) + { + if (random.nextInt(2) == 0) + { + textureatlassprite = this.func_175371_a(Blocks.diamond_ore); + } + else + { + textureatlassprite = this.func_175371_a(Blocks.redstone_ore); + } + } + else if (j4 == 10) + { + textureatlassprite = this.func_175371_a(Blocks.iron_ore); + } + else if (j4 == 8) + { + textureatlassprite = this.func_175371_a(Blocks.coal_ore); + } + else if (j4 > 4) + { + textureatlassprite = this.func_175371_a(Blocks.stone); + } + else if (j4 > 0) + { + textureatlassprite = this.func_175371_a(Blocks.dirt); + } + } + else + { + Block block = Blocks.bedrock; + textureatlassprite = this.func_175371_a(block); + } + + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + this.drawTexturedModalRect(i4 * 16 - i2, l3 * 16 - j2, textureatlassprite, 16, 16); + } + } + + GlStateManager.enableDepth(); + GlStateManager.depthFunc(515); + this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); + + for (int j5 = 0; j5 < AchievementList.achievementList.size(); ++j5) + { + Achievement achievement1 = (Achievement)AchievementList.achievementList.get(j5); + + if (achievement1.parentAchievement != null) + { + int k5 = achievement1.displayColumn * 24 - i + 11; + int l5 = achievement1.displayRow * 24 - j + 11; + int j6 = achievement1.parentAchievement.displayColumn * 24 - i + 11; + int k6 = achievement1.parentAchievement.displayRow * 24 - j + 11; + boolean flag = this.statFileWriter.hasAchievementUnlocked(achievement1); + boolean flag1 = this.statFileWriter.canUnlockAchievement(achievement1); + int k4 = this.statFileWriter.func_150874_c(achievement1); + + if (k4 <= 4) + { + int l4 = -16777216; + + if (flag) + { + l4 = -6250336; + } + else if (flag1) + { + l4 = -16711936; + } + + this.drawHorizontalLine(k5, j6, l5, l4); + this.drawVerticalLine(j6, l5, k6, l4); + + if (k5 > j6) + { + this.drawTexturedModalRect(k5 - 11 - 7, l5 - 5, 114, 234, 7, 11); + } + else if (k5 < j6) + { + this.drawTexturedModalRect(k5 + 11, l5 - 5, 107, 234, 7, 11); + } + else if (l5 > k6) + { + this.drawTexturedModalRect(k5 - 5, l5 - 11 - 7, 96, 234, 11, 7); + } + else if (l5 < k6) + { + this.drawTexturedModalRect(k5 - 5, l5 + 11, 96, 241, 11, 7); + } + } + } + } + + Achievement achievement = null; + float f3 = (float)(p_146552_1_ - i1) * this.field_146570_r; + float f4 = (float)(p_146552_2_ - j1) * this.field_146570_r; + RenderHelper.enableGUIStandardItemLighting(); + GlStateManager.disableLighting(); + GlStateManager.enableRescaleNormal(); + GlStateManager.enableColorMaterial(); + + for (int i6 = 0; i6 < AchievementList.achievementList.size(); ++i6) + { + Achievement achievement2 = (Achievement)AchievementList.achievementList.get(i6); + int l6 = achievement2.displayColumn * 24 - i; + int j7 = achievement2.displayRow * 24 - j; + + if (l6 >= -24 && j7 >= -24 && (float)l6 <= 224.0F * this.field_146570_r && (float)j7 <= 155.0F * this.field_146570_r) + { + int l7 = this.statFileWriter.func_150874_c(achievement2); + + if (this.statFileWriter.hasAchievementUnlocked(achievement2)) + { + float f5 = 0.75F; + GlStateManager.color(f5, f5, f5, 1.0F); + } + else if (this.statFileWriter.canUnlockAchievement(achievement2)) + { + float f6 = 1.0F; + GlStateManager.color(f6, f6, f6, 1.0F); + } + else if (l7 < 3) + { + float f7 = 0.3F; + GlStateManager.color(f7, f7, f7, 1.0F); + } + else if (l7 == 3) + { + float f8 = 0.2F; + GlStateManager.color(f8, f8, f8, 1.0F); + } + else + { + if (l7 != 4) + { + continue; + } + + float f9 = 0.1F; + GlStateManager.color(f9, f9, f9, 1.0F); + } + + this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); + + if (achievement2.getSpecial()) + { + this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26); + } + else + { + this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26); + } + + if (!this.statFileWriter.canUnlockAchievement(achievement2)) + { + float f10 = 0.1F; + GlStateManager.color(f10, f10, f10, 1.0F); + this.itemRender.func_175039_a(false); + } + + GlStateManager.enableLighting(); + GlStateManager.enableCull(); + this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l6 + 3, j7 + 3); + GlStateManager.blendFunc(770, 771); + GlStateManager.disableLighting(); + + if (!this.statFileWriter.canUnlockAchievement(achievement2)) + { + this.itemRender.func_175039_a(true); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + + if (f3 >= (float)l6 && f3 <= (float)(l6 + 22) && f4 >= (float)j7 && f4 <= (float)(j7 + 22)) + { + achievement = achievement2; + } + } + } + + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.popMatrix(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND); + this.drawTexturedModalRect(k, l, 0, 0, this.field_146555_f, this.field_146557_g); + this.zLevel = 0.0F; + GlStateManager.depthFunc(515); + GlStateManager.disableDepth(); + GlStateManager.enableTexture2D(); + super.drawScreen(p_146552_1_, p_146552_2_, p_146552_3_); + + if (achievement != null) + { + String s = achievement.getStatName().getUnformattedText(); + String s1 = achievement.getDescription(); + int i7 = p_146552_1_ + 12; + int k7 = p_146552_2_ - 4; + int i8 = this.statFileWriter.func_150874_c(achievement); + + if (this.statFileWriter.canUnlockAchievement(achievement)) + { + int j8 = Math.max(this.fontRendererObj.getStringWidth(s), 120); + int i9 = this.fontRendererObj.splitStringWidth(s1, j8); + + if (this.statFileWriter.hasAchievementUnlocked(achievement)) + { + i9 += 12; + } + + this.drawGradientRect(i7 - 3, k7 - 3, i7 + j8 + 3, k7 + i9 + 3 + 12, -1073741824, -1073741824); + this.fontRendererObj.drawSplitString(s1, i7, k7 + 12, j8, -6250336); + + if (this.statFileWriter.hasAchievementUnlocked(achievement)) + { + this.fontRendererObj.drawStringWithShadow(I18n.format("achievement.taken", new Object[0]), (float)i7, (float)(k7 + i9 + 4), -7302913); + } + } + else if (i8 == 3) + { + s = I18n.format("achievement.unknown", new Object[0]); + int k8 = Math.max(this.fontRendererObj.getStringWidth(s), 120); + String s2 = (new ChatComponentTranslation("achievement.requires", new Object[] {achievement.parentAchievement.getStatName()})).getUnformattedText(); + int i5 = this.fontRendererObj.splitStringWidth(s2, k8); + this.drawGradientRect(i7 - 3, k7 - 3, i7 + k8 + 3, k7 + i5 + 12 + 3, -1073741824, -1073741824); + this.fontRendererObj.drawSplitString(s2, i7, k7 + 12, k8, -9416624); + } + else if (i8 < 3) + { + int l8 = Math.max(this.fontRendererObj.getStringWidth(s), 120); + String s3 = (new ChatComponentTranslation("achievement.requires", new Object[] {achievement.parentAchievement.getStatName()})).getUnformattedText(); + int j9 = this.fontRendererObj.splitStringWidth(s3, l8); + this.drawGradientRect(i7 - 3, k7 - 3, i7 + l8 + 3, k7 + j9 + 12 + 3, -1073741824, -1073741824); + this.fontRendererObj.drawSplitString(s3, i7, k7 + 12, l8, -9416624); + } + else + { + s = null; + } + + if (s != null) + { + this.fontRendererObj.drawStringWithShadow(s, (float)i7, (float)k7, this.statFileWriter.canUnlockAchievement(achievement) ? (achievement.getSpecial() ? -128 : -1) : (achievement.getSpecial() ? -8355776 : -8355712)); + } + } + + GlStateManager.enableDepth(); + GlStateManager.enableLighting(); + RenderHelper.disableStandardItemLighting(); + } + + private TextureAtlasSprite func_175371_a(Block p_175371_1_) + { + return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(p_175371_1_.getDefaultState()); + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return !this.loadingAchievements; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/achievement/GuiStats.java b/src/minecraft/net/minecraft/client/gui/achievement/GuiStats.java new file mode 100644 index 0000000..13de84b --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/achievement/GuiStats.java @@ -0,0 +1,824 @@ +package net.minecraft.client.gui.achievement; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiSlot; +import net.minecraft.client.gui.IProgressMeter; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.EntityList; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C16PacketClientStatus; +import net.minecraft.stats.StatBase; +import net.minecraft.stats.StatCrafting; +import net.minecraft.stats.StatFileWriter; +import net.minecraft.stats.StatList; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Mouse; + +public class GuiStats extends GuiScreen implements IProgressMeter +{ + protected GuiScreen parentScreen; + protected String screenTitle = "Select world"; + private GuiStats.StatsGeneral generalStats; + private GuiStats.StatsItem itemStats; + private GuiStats.StatsBlock blockStats; + private GuiStats.StatsMobsList mobStats; + private StatFileWriter field_146546_t; + private GuiSlot displaySlot; + + /** When true, the game will be paused when the gui is shown */ + private boolean doesGuiPauseGame = true; + + public GuiStats(GuiScreen p_i1071_1_, StatFileWriter p_i1071_2_) + { + this.parentScreen = p_i1071_1_; + this.field_146546_t = p_i1071_2_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.screenTitle = I18n.format("gui.stats", new Object[0]); + this.doesGuiPauseGame = true; + this.mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS)); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + + if (this.displaySlot != null) + { + this.displaySlot.handleMouseInput(); + } + } + + public void func_175366_f() + { + this.generalStats = new GuiStats.StatsGeneral(this.mc); + this.generalStats.registerScrollButtons(1, 1); + this.itemStats = new GuiStats.StatsItem(this.mc); + this.itemStats.registerScrollButtons(1, 1); + this.blockStats = new GuiStats.StatsBlock(this.mc); + this.blockStats.registerScrollButtons(1, 1); + this.mobStats = new GuiStats.StatsMobsList(this.mc); + this.mobStats.registerScrollButtons(1, 1); + } + + public void createButtons() + { + this.buttonList.add(new GuiButton(0, this.width / 2 + 4, this.height - 28, 150, 20, I18n.format("gui.done", new Object[0]))); + this.buttonList.add(new GuiButton(1, this.width / 2 - 160, this.height - 52, 80, 20, I18n.format("stat.generalButton", new Object[0]))); + GuiButton guibutton; + this.buttonList.add(guibutton = new GuiButton(2, this.width / 2 - 80, this.height - 52, 80, 20, I18n.format("stat.blocksButton", new Object[0]))); + GuiButton guibutton1; + this.buttonList.add(guibutton1 = new GuiButton(3, this.width / 2, this.height - 52, 80, 20, I18n.format("stat.itemsButton", new Object[0]))); + GuiButton guibutton2; + this.buttonList.add(guibutton2 = new GuiButton(4, this.width / 2 + 80, this.height - 52, 80, 20, I18n.format("stat.mobsButton", new Object[0]))); + + if (this.blockStats.getSize() == 0) + { + guibutton.enabled = false; + } + + if (this.itemStats.getSize() == 0) + { + guibutton1.enabled = false; + } + + if (this.mobStats.getSize() == 0) + { + guibutton2.enabled = false; + } + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 0) + { + this.mc.displayGuiScreen(this.parentScreen); + } + else if (button.id == 1) + { + this.displaySlot = this.generalStats; + } + else if (button.id == 3) + { + this.displaySlot = this.itemStats; + } + else if (button.id == 2) + { + this.displaySlot = this.blockStats; + } + else if (button.id == 4) + { + this.displaySlot = this.mobStats; + } + else + { + this.displaySlot.actionPerformed(button); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + if (this.doesGuiPauseGame) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, I18n.format("multiplayer.downloadingStats", new Object[0]), this.width / 2, this.height / 2, 16777215); + this.drawCenteredString(this.fontRendererObj, lanSearchStates[(int)(Minecraft.getSystemTime() / 150L % (long)lanSearchStates.length)], this.width / 2, this.height / 2 + this.fontRendererObj.FONT_HEIGHT * 2, 16777215); + } + else + { + this.displaySlot.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.fontRendererObj, this.screenTitle, this.width / 2, 20, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } + } + + public void doneLoading() + { + if (this.doesGuiPauseGame) + { + this.func_175366_f(); + this.createButtons(); + this.displaySlot = this.generalStats; + this.doesGuiPauseGame = false; + } + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return !this.doesGuiPauseGame; + } + + private void drawStatsScreen(int p_146521_1_, int p_146521_2_, Item p_146521_3_) + { + this.drawButtonBackground(p_146521_1_ + 1, p_146521_2_ + 1); + GlStateManager.enableRescaleNormal(); + RenderHelper.enableGUIStandardItemLighting(); + this.itemRender.renderItemIntoGUI(new ItemStack(p_146521_3_, 1, 0), p_146521_1_ + 2, p_146521_2_ + 2); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + } + + /** + * Draws a gray box that serves as a button background. + */ + private void drawButtonBackground(int p_146531_1_, int p_146531_2_) + { + this.drawSprite(p_146531_1_, p_146531_2_, 0, 0); + } + + /** + * Draws a sprite from assets/textures/gui/container/stats_icons.png + */ + private void drawSprite(int p_146527_1_, int p_146527_2_, int p_146527_3_, int p_146527_4_) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(statIcons); + float f = 0.0078125F; + float f1 = 0.0078125F; + int i = 18; + int j = 18; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((double)(p_146527_1_ + 0), (double)(p_146527_2_ + 18), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 0) * 0.0078125F), (double)((float)(p_146527_4_ + 18) * 0.0078125F)).endVertex(); + worldrenderer.pos((double)(p_146527_1_ + 18), (double)(p_146527_2_ + 18), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 18) * 0.0078125F), (double)((float)(p_146527_4_ + 18) * 0.0078125F)).endVertex(); + worldrenderer.pos((double)(p_146527_1_ + 18), (double)(p_146527_2_ + 0), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 18) * 0.0078125F), (double)((float)(p_146527_4_ + 0) * 0.0078125F)).endVertex(); + worldrenderer.pos((double)(p_146527_1_ + 0), (double)(p_146527_2_ + 0), (double)this.zLevel).tex((double)((float)(p_146527_3_ + 0) * 0.0078125F), (double)((float)(p_146527_4_ + 0) * 0.0078125F)).endVertex(); + tessellator.draw(); + } + + abstract class Stats extends GuiSlot + { + protected int field_148218_l = -1; + protected List statsHolder; + protected Comparator statSorter; + protected int field_148217_o = -1; + protected int field_148215_p; + + protected Stats(Minecraft mcIn) + { + super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, 20); + this.setShowSelectionBox(false); + this.setHasListHeader(true, 20); + } + + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + } + + protected boolean isSelected(int slotIndex) + { + return false; + } + + protected void drawBackground() + { + GuiStats.this.drawDefaultBackground(); + } + + protected void drawListHeader(int p_148129_1_, int p_148129_2_, Tessellator p_148129_3_) + { + if (!Mouse.isButtonDown(0)) + { + this.field_148218_l = -1; + } + + if (this.field_148218_l == 0) + { + GuiStats.this.drawSprite(p_148129_1_ + 115 - 18, p_148129_2_ + 1, 0, 0); + } + else + { + GuiStats.this.drawSprite(p_148129_1_ + 115 - 18, p_148129_2_ + 1, 0, 18); + } + + if (this.field_148218_l == 1) + { + GuiStats.this.drawSprite(p_148129_1_ + 165 - 18, p_148129_2_ + 1, 0, 0); + } + else + { + GuiStats.this.drawSprite(p_148129_1_ + 165 - 18, p_148129_2_ + 1, 0, 18); + } + + if (this.field_148218_l == 2) + { + GuiStats.this.drawSprite(p_148129_1_ + 215 - 18, p_148129_2_ + 1, 0, 0); + } + else + { + GuiStats.this.drawSprite(p_148129_1_ + 215 - 18, p_148129_2_ + 1, 0, 18); + } + + if (this.field_148217_o != -1) + { + int i = 79; + int j = 18; + + if (this.field_148217_o == 1) + { + i = 129; + } + else if (this.field_148217_o == 2) + { + i = 179; + } + + if (this.field_148215_p == 1) + { + j = 36; + } + + GuiStats.this.drawSprite(p_148129_1_ + i, p_148129_2_ + 1, j, 0); + } + } + + protected void func_148132_a(int p_148132_1_, int p_148132_2_) + { + this.field_148218_l = -1; + + if (p_148132_1_ >= 79 && p_148132_1_ < 115) + { + this.field_148218_l = 0; + } + else if (p_148132_1_ >= 129 && p_148132_1_ < 165) + { + this.field_148218_l = 1; + } + else if (p_148132_1_ >= 179 && p_148132_1_ < 215) + { + this.field_148218_l = 2; + } + + if (this.field_148218_l >= 0) + { + this.func_148212_h(this.field_148218_l); + this.mc.getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + } + } + + protected final int getSize() + { + return this.statsHolder.size(); + } + + protected final StatCrafting func_148211_c(int p_148211_1_) + { + return (StatCrafting)this.statsHolder.get(p_148211_1_); + } + + protected abstract String func_148210_b(int p_148210_1_); + + protected void func_148209_a(StatBase p_148209_1_, int p_148209_2_, int p_148209_3_, boolean p_148209_4_) + { + if (p_148209_1_ != null) + { + String s = p_148209_1_.format(GuiStats.this.field_146546_t.readStat(p_148209_1_)); + GuiStats.this.drawString(GuiStats.this.fontRendererObj, s, p_148209_2_ - GuiStats.this.fontRendererObj.getStringWidth(s), p_148209_3_ + 5, p_148209_4_ ? 16777215 : 9474192); + } + else + { + String s1 = "-"; + GuiStats.this.drawString(GuiStats.this.fontRendererObj, s1, p_148209_2_ - GuiStats.this.fontRendererObj.getStringWidth(s1), p_148209_3_ + 5, p_148209_4_ ? 16777215 : 9474192); + } + } + + protected void func_148142_b(int p_148142_1_, int p_148142_2_) + { + if (p_148142_2_ >= this.top && p_148142_2_ <= this.bottom) + { + int i = this.getSlotIndexFromScreenCoords(p_148142_1_, p_148142_2_); + int j = this.width / 2 - 92 - 16; + + if (i >= 0) + { + if (p_148142_1_ < j + 40 || p_148142_1_ > j + 40 + 20) + { + return; + } + + StatCrafting statcrafting = this.func_148211_c(i); + this.func_148213_a(statcrafting, p_148142_1_, p_148142_2_); + } + else + { + String s = ""; + + if (p_148142_1_ >= j + 115 - 18 && p_148142_1_ <= j + 115) + { + s = this.func_148210_b(0); + } + else if (p_148142_1_ >= j + 165 - 18 && p_148142_1_ <= j + 165) + { + s = this.func_148210_b(1); + } + else + { + if (p_148142_1_ < j + 215 - 18 || p_148142_1_ > j + 215) + { + return; + } + + s = this.func_148210_b(2); + } + + s = ("" + I18n.format(s, new Object[0])).trim(); + + if (s.length() > 0) + { + int k = p_148142_1_ + 12; + int l = p_148142_2_ - 12; + int i1 = GuiStats.this.fontRendererObj.getStringWidth(s); + GuiStats.this.drawGradientRect(k - 3, l - 3, k + i1 + 3, l + 8 + 3, -1073741824, -1073741824); + GuiStats.this.fontRendererObj.drawStringWithShadow(s, (float)k, (float)l, -1); + } + } + } + } + + protected void func_148213_a(StatCrafting p_148213_1_, int p_148213_2_, int p_148213_3_) + { + if (p_148213_1_ != null) + { + Item item = p_148213_1_.func_150959_a(); + ItemStack itemstack = new ItemStack(item); + String s = itemstack.getUnlocalizedName(); + String s1 = ("" + I18n.format(s + ".name", new Object[0])).trim(); + + if (s1.length() > 0) + { + int i = p_148213_2_ + 12; + int j = p_148213_3_ - 12; + int k = GuiStats.this.fontRendererObj.getStringWidth(s1); + GuiStats.this.drawGradientRect(i - 3, j - 3, i + k + 3, j + 8 + 3, -1073741824, -1073741824); + GuiStats.this.fontRendererObj.drawStringWithShadow(s1, (float)i, (float)j, -1); + } + } + } + + protected void func_148212_h(int p_148212_1_) + { + if (p_148212_1_ != this.field_148217_o) + { + this.field_148217_o = p_148212_1_; + this.field_148215_p = -1; + } + else if (this.field_148215_p == -1) + { + this.field_148215_p = 1; + } + else + { + this.field_148217_o = -1; + this.field_148215_p = 0; + } + + Collections.sort(this.statsHolder, this.statSorter); + } + } + + class StatsBlock extends GuiStats.Stats + { + public StatsBlock(Minecraft mcIn) + { + super(mcIn); + this.statsHolder = Lists.newArrayList(); + + for (StatCrafting statcrafting : StatList.objectMineStats) + { + boolean flag = false; + int i = Item.getIdFromItem(statcrafting.func_150959_a()); + + if (GuiStats.this.field_146546_t.readStat(statcrafting) > 0) + { + flag = true; + } + else if (StatList.objectUseStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectUseStats[i]) > 0) + { + flag = true; + } + else if (StatList.objectCraftStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[i]) > 0) + { + flag = true; + } + + if (flag) + { + this.statsHolder.add(statcrafting); + } + } + + this.statSorter = new Comparator() + { + public int compare(StatCrafting p_compare_1_, StatCrafting p_compare_2_) + { + int j = Item.getIdFromItem(p_compare_1_.func_150959_a()); + int k = Item.getIdFromItem(p_compare_2_.func_150959_a()); + StatBase statbase = null; + StatBase statbase1 = null; + + if (StatsBlock.this.field_148217_o == 2) + { + statbase = StatList.mineBlockStatArray[j]; + statbase1 = StatList.mineBlockStatArray[k]; + } + else if (StatsBlock.this.field_148217_o == 0) + { + statbase = StatList.objectCraftStats[j]; + statbase1 = StatList.objectCraftStats[k]; + } + else if (StatsBlock.this.field_148217_o == 1) + { + statbase = StatList.objectUseStats[j]; + statbase1 = StatList.objectUseStats[k]; + } + + if (statbase != null || statbase1 != null) + { + if (statbase == null) + { + return 1; + } + + if (statbase1 == null) + { + return -1; + } + + int l = GuiStats.this.field_146546_t.readStat(statbase); + int i1 = GuiStats.this.field_146546_t.readStat(statbase1); + + if (l != i1) + { + return (l - i1) * StatsBlock.this.field_148215_p; + } + } + + return j - k; + } + }; + } + + protected void drawListHeader(int p_148129_1_, int p_148129_2_, Tessellator p_148129_3_) + { + super.drawListHeader(p_148129_1_, p_148129_2_, p_148129_3_); + + if (this.field_148218_l == 0) + { + GuiStats.this.drawSprite(p_148129_1_ + 115 - 18 + 1, p_148129_2_ + 1 + 1, 18, 18); + } + else + { + GuiStats.this.drawSprite(p_148129_1_ + 115 - 18, p_148129_2_ + 1, 18, 18); + } + + if (this.field_148218_l == 1) + { + GuiStats.this.drawSprite(p_148129_1_ + 165 - 18 + 1, p_148129_2_ + 1 + 1, 36, 18); + } + else + { + GuiStats.this.drawSprite(p_148129_1_ + 165 - 18, p_148129_2_ + 1, 36, 18); + } + + if (this.field_148218_l == 2) + { + GuiStats.this.drawSprite(p_148129_1_ + 215 - 18 + 1, p_148129_2_ + 1 + 1, 54, 18); + } + else + { + GuiStats.this.drawSprite(p_148129_1_ + 215 - 18, p_148129_2_ + 1, 54, 18); + } + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + StatCrafting statcrafting = this.func_148211_c(entryID); + Item item = statcrafting.func_150959_a(); + GuiStats.this.drawStatsScreen(p_180791_2_ + 40, p_180791_3_, item); + int i = Item.getIdFromItem(item); + this.func_148209_a(StatList.objectCraftStats[i], p_180791_2_ + 115, p_180791_3_, entryID % 2 == 0); + this.func_148209_a(StatList.objectUseStats[i], p_180791_2_ + 165, p_180791_3_, entryID % 2 == 0); + this.func_148209_a(statcrafting, p_180791_2_ + 215, p_180791_3_, entryID % 2 == 0); + } + + protected String func_148210_b(int p_148210_1_) + { + return p_148210_1_ == 0 ? "stat.crafted" : (p_148210_1_ == 1 ? "stat.used" : "stat.mined"); + } + } + + class StatsGeneral extends GuiSlot + { + public StatsGeneral(Minecraft mcIn) + { + super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, 10); + this.setShowSelectionBox(false); + } + + protected int getSize() + { + return StatList.generalStats.size(); + } + + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + } + + protected boolean isSelected(int slotIndex) + { + return false; + } + + protected int getContentHeight() + { + return this.getSize() * 10; + } + + protected void drawBackground() + { + GuiStats.this.drawDefaultBackground(); + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + StatBase statbase = (StatBase)StatList.generalStats.get(entryID); + GuiStats.this.drawString(GuiStats.this.fontRendererObj, statbase.getStatName().getUnformattedText(), p_180791_2_ + 2, p_180791_3_ + 1, entryID % 2 == 0 ? 16777215 : 9474192); + String s = statbase.format(GuiStats.this.field_146546_t.readStat(statbase)); + GuiStats.this.drawString(GuiStats.this.fontRendererObj, s, p_180791_2_ + 2 + 213 - GuiStats.this.fontRendererObj.getStringWidth(s), p_180791_3_ + 1, entryID % 2 == 0 ? 16777215 : 9474192); + } + } + + class StatsItem extends GuiStats.Stats + { + public StatsItem(Minecraft mcIn) + { + super(mcIn); + this.statsHolder = Lists.newArrayList(); + + for (StatCrafting statcrafting : StatList.itemStats) + { + boolean flag = false; + int i = Item.getIdFromItem(statcrafting.func_150959_a()); + + if (GuiStats.this.field_146546_t.readStat(statcrafting) > 0) + { + flag = true; + } + else if (StatList.objectBreakStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectBreakStats[i]) > 0) + { + flag = true; + } + else if (StatList.objectCraftStats[i] != null && GuiStats.this.field_146546_t.readStat(StatList.objectCraftStats[i]) > 0) + { + flag = true; + } + + if (flag) + { + this.statsHolder.add(statcrafting); + } + } + + this.statSorter = new Comparator() + { + public int compare(StatCrafting p_compare_1_, StatCrafting p_compare_2_) + { + int j = Item.getIdFromItem(p_compare_1_.func_150959_a()); + int k = Item.getIdFromItem(p_compare_2_.func_150959_a()); + StatBase statbase = null; + StatBase statbase1 = null; + + if (StatsItem.this.field_148217_o == 0) + { + statbase = StatList.objectBreakStats[j]; + statbase1 = StatList.objectBreakStats[k]; + } + else if (StatsItem.this.field_148217_o == 1) + { + statbase = StatList.objectCraftStats[j]; + statbase1 = StatList.objectCraftStats[k]; + } + else if (StatsItem.this.field_148217_o == 2) + { + statbase = StatList.objectUseStats[j]; + statbase1 = StatList.objectUseStats[k]; + } + + if (statbase != null || statbase1 != null) + { + if (statbase == null) + { + return 1; + } + + if (statbase1 == null) + { + return -1; + } + + int l = GuiStats.this.field_146546_t.readStat(statbase); + int i1 = GuiStats.this.field_146546_t.readStat(statbase1); + + if (l != i1) + { + return (l - i1) * StatsItem.this.field_148215_p; + } + } + + return j - k; + } + }; + } + + protected void drawListHeader(int p_148129_1_, int p_148129_2_, Tessellator p_148129_3_) + { + super.drawListHeader(p_148129_1_, p_148129_2_, p_148129_3_); + + if (this.field_148218_l == 0) + { + GuiStats.this.drawSprite(p_148129_1_ + 115 - 18 + 1, p_148129_2_ + 1 + 1, 72, 18); + } + else + { + GuiStats.this.drawSprite(p_148129_1_ + 115 - 18, p_148129_2_ + 1, 72, 18); + } + + if (this.field_148218_l == 1) + { + GuiStats.this.drawSprite(p_148129_1_ + 165 - 18 + 1, p_148129_2_ + 1 + 1, 18, 18); + } + else + { + GuiStats.this.drawSprite(p_148129_1_ + 165 - 18, p_148129_2_ + 1, 18, 18); + } + + if (this.field_148218_l == 2) + { + GuiStats.this.drawSprite(p_148129_1_ + 215 - 18 + 1, p_148129_2_ + 1 + 1, 36, 18); + } + else + { + GuiStats.this.drawSprite(p_148129_1_ + 215 - 18, p_148129_2_ + 1, 36, 18); + } + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + StatCrafting statcrafting = this.func_148211_c(entryID); + Item item = statcrafting.func_150959_a(); + GuiStats.this.drawStatsScreen(p_180791_2_ + 40, p_180791_3_, item); + int i = Item.getIdFromItem(item); + this.func_148209_a(StatList.objectBreakStats[i], p_180791_2_ + 115, p_180791_3_, entryID % 2 == 0); + this.func_148209_a(StatList.objectCraftStats[i], p_180791_2_ + 165, p_180791_3_, entryID % 2 == 0); + this.func_148209_a(statcrafting, p_180791_2_ + 215, p_180791_3_, entryID % 2 == 0); + } + + protected String func_148210_b(int p_148210_1_) + { + return p_148210_1_ == 1 ? "stat.crafted" : (p_148210_1_ == 2 ? "stat.used" : "stat.depleted"); + } + } + + class StatsMobsList extends GuiSlot + { + private final List field_148222_l = Lists.newArrayList(); + + public StatsMobsList(Minecraft mcIn) + { + super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4); + this.setShowSelectionBox(false); + + for (EntityList.EntityEggInfo entitylist$entityegginfo : EntityList.entityEggs.values()) + { + if (GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d) > 0 || GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e) > 0) + { + this.field_148222_l.add(entitylist$entityegginfo); + } + } + } + + protected int getSize() + { + return this.field_148222_l.size(); + } + + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + } + + protected boolean isSelected(int slotIndex) + { + return false; + } + + protected int getContentHeight() + { + return this.getSize() * GuiStats.this.fontRendererObj.FONT_HEIGHT * 4; + } + + protected void drawBackground() + { + GuiStats.this.drawDefaultBackground(); + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID); + String s = I18n.format("entity." + EntityList.getStringFromID(entitylist$entityegginfo.spawnedID) + ".name", new Object[0]); + int i = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151512_d); + int j = GuiStats.this.field_146546_t.readStat(entitylist$entityegginfo.field_151513_e); + String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(i), s}); + String s2 = I18n.format("stat.entityKilledBy", new Object[] {s, Integer.valueOf(j)}); + + if (i == 0) + { + s1 = I18n.format("stat.entityKills.none", new Object[] {s}); + } + + if (j == 0) + { + s2 = I18n.format("stat.entityKilledBy.none", new Object[] {s}); + } + + GuiStats.this.drawString(GuiStats.this.fontRendererObj, s, p_180791_2_ + 2 - 10, p_180791_3_ + 1, 16777215); + GuiStats.this.drawString(GuiStats.this.fontRendererObj, s1, p_180791_2_ + 2, p_180791_3_ + 1 + GuiStats.this.fontRendererObj.FONT_HEIGHT, i == 0 ? 6316128 : 9474192); + GuiStats.this.drawString(GuiStats.this.fontRendererObj, s2, p_180791_2_ + 2, p_180791_3_ + 1 + GuiStats.this.fontRendererObj.FONT_HEIGHT * 2, j == 0 ? 6316128 : 9474192); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/inventory/CreativeCrafting.java b/src/minecraft/net/minecraft/client/gui/inventory/CreativeCrafting.java new file mode 100644 index 0000000..511ccfd --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/inventory/CreativeCrafting.java @@ -0,0 +1,47 @@ +package net.minecraft.client.gui.inventory; + +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +public class CreativeCrafting implements ICrafting +{ + private final Minecraft mc; + + public CreativeCrafting(Minecraft mc) + { + this.mc = mc; + } + + /** + * update the crafting window inventory with the items in the list + */ + public void updateCraftingInventory(Container containerToSend, List itemsList) + { + } + + /** + * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual + * contents of that slot. Args: Container, slot number, slot contents + */ + public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack) + { + this.mc.playerController.sendSlotPacket(stack, slotInd); + } + + /** + * Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress, + * and enchanting level. Normally the first int identifies which variable to update, and the second contains the new + * value. Both are truncated to shorts in non-local SMP. + */ + public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue) + { + } + + public void func_175173_a(Container p_175173_1_, IInventory p_175173_2_) + { + } +} diff --git a/src/minecraft/net/minecraft/client/gui/inventory/GuiBeacon.java b/src/minecraft/net/minecraft/client/gui/inventory/GuiBeacon.java new file mode 100644 index 0000000..64dda9b --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/inventory/GuiBeacon.java @@ -0,0 +1,321 @@ +package net.minecraft.client.gui.inventory; + +import io.netty.buffer.Unpooled; +import java.io.IOException; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Items; +import net.minecraft.inventory.ContainerBeacon; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraft.potion.Potion; +import net.minecraft.tileentity.TileEntityBeacon; +import net.minecraft.util.ResourceLocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class GuiBeacon extends GuiContainer +{ + private static final Logger logger = LogManager.getLogger(); + private static final ResourceLocation beaconGuiTextures = new ResourceLocation("textures/gui/container/beacon.png"); + private IInventory tileBeacon; + private GuiBeacon.ConfirmButton beaconConfirmButton; + private boolean buttonsNotDrawn; + + public GuiBeacon(InventoryPlayer playerInventory, IInventory tileBeaconIn) + { + super(new ContainerBeacon(playerInventory, tileBeaconIn)); + this.tileBeacon = tileBeaconIn; + this.xSize = 230; + this.ySize = 219; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + super.initGui(); + this.buttonList.add(this.beaconConfirmButton = new GuiBeacon.ConfirmButton(-1, this.guiLeft + 164, this.guiTop + 107)); + this.buttonList.add(new GuiBeacon.CancelButton(-2, this.guiLeft + 190, this.guiTop + 107)); + this.buttonsNotDrawn = true; + this.beaconConfirmButton.enabled = false; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + int i = this.tileBeacon.getField(0); + int j = this.tileBeacon.getField(1); + int k = this.tileBeacon.getField(2); + + if (this.buttonsNotDrawn && i >= 0) + { + this.buttonsNotDrawn = false; + + for (int l = 0; l <= 2; ++l) + { + int i1 = TileEntityBeacon.effectsList[l].length; + int j1 = i1 * 22 + (i1 - 1) * 2; + + for (int k1 = 0; k1 < i1; ++k1) + { + int l1 = TileEntityBeacon.effectsList[l][k1].id; + GuiBeacon.PowerButton guibeacon$powerbutton = new GuiBeacon.PowerButton(l << 8 | l1, this.guiLeft + 76 + k1 * 24 - j1 / 2, this.guiTop + 22 + l * 25, l1, l); + this.buttonList.add(guibeacon$powerbutton); + + if (l >= i) + { + guibeacon$powerbutton.enabled = false; + } + else if (l1 == j) + { + guibeacon$powerbutton.func_146140_b(true); + } + } + } + + int i2 = 3; + int j2 = TileEntityBeacon.effectsList[i2].length + 1; + int k2 = j2 * 22 + (j2 - 1) * 2; + + for (int l2 = 0; l2 < j2 - 1; ++l2) + { + int i3 = TileEntityBeacon.effectsList[i2][l2].id; + GuiBeacon.PowerButton guibeacon$powerbutton2 = new GuiBeacon.PowerButton(i2 << 8 | i3, this.guiLeft + 167 + l2 * 24 - k2 / 2, this.guiTop + 47, i3, i2); + this.buttonList.add(guibeacon$powerbutton2); + + if (i2 >= i) + { + guibeacon$powerbutton2.enabled = false; + } + else if (i3 == k) + { + guibeacon$powerbutton2.func_146140_b(true); + } + } + + if (j > 0) + { + GuiBeacon.PowerButton guibeacon$powerbutton1 = new GuiBeacon.PowerButton(i2 << 8 | j, this.guiLeft + 167 + (j2 - 1) * 24 - k2 / 2, this.guiTop + 47, j, i2); + this.buttonList.add(guibeacon$powerbutton1); + + if (i2 >= i) + { + guibeacon$powerbutton1.enabled = false; + } + else if (j == k) + { + guibeacon$powerbutton1.func_146140_b(true); + } + } + } + + this.beaconConfirmButton.enabled = this.tileBeacon.getStackInSlot(0) != null && j > 0; + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.id == -2) + { + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (button.id == -1) + { + String s = "MC|Beacon"; + PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer()); + packetbuffer.writeInt(this.tileBeacon.getField(1)); + packetbuffer.writeInt(this.tileBeacon.getField(2)); + this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload(s, packetbuffer)); + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (button instanceof GuiBeacon.PowerButton) + { + if (((GuiBeacon.PowerButton)button).func_146141_c()) + { + return; + } + + int j = button.id; + int k = j & 255; + int i = j >> 8; + + if (i < 3) + { + this.tileBeacon.setField(1, k); + } + else + { + this.tileBeacon.setField(2, k); + } + + this.buttonList.clear(); + this.initGui(); + this.updateScreen(); + } + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + RenderHelper.disableStandardItemLighting(); + this.drawCenteredString(this.fontRendererObj, I18n.format("tile.beacon.primary", new Object[0]), 62, 10, 14737632); + this.drawCenteredString(this.fontRendererObj, I18n.format("tile.beacon.secondary", new Object[0]), 169, 10, 14737632); + + for (GuiButton guibutton : this.buttonList) + { + if (guibutton.isMouseOver()) + { + guibutton.drawButtonForegroundLayer(mouseX - this.guiLeft, mouseY - this.guiTop); + break; + } + } + + RenderHelper.enableGUIStandardItemLighting(); + } + + /** + * Args : renderPartialTicks, mouseX, mouseY + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(beaconGuiTextures); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); + this.itemRender.zLevel = 100.0F; + this.itemRender.renderItemAndEffectIntoGUI(new ItemStack(Items.emerald), i + 42, j + 109); + this.itemRender.renderItemAndEffectIntoGUI(new ItemStack(Items.diamond), i + 42 + 22, j + 109); + this.itemRender.renderItemAndEffectIntoGUI(new ItemStack(Items.gold_ingot), i + 42 + 44, j + 109); + this.itemRender.renderItemAndEffectIntoGUI(new ItemStack(Items.iron_ingot), i + 42 + 66, j + 109); + this.itemRender.zLevel = 0.0F; + } + + static class Button extends GuiButton + { + private final ResourceLocation field_146145_o; + private final int field_146144_p; + private final int field_146143_q; + private boolean field_146142_r; + + protected Button(int p_i1077_1_, int p_i1077_2_, int p_i1077_3_, ResourceLocation p_i1077_4_, int p_i1077_5_, int p_i1077_6_) + { + super(p_i1077_1_, p_i1077_2_, p_i1077_3_, 22, 22, ""); + this.field_146145_o = p_i1077_4_; + this.field_146144_p = p_i1077_5_; + this.field_146143_q = p_i1077_6_; + } + + public void drawButton(Minecraft mc, int mouseX, int mouseY) + { + if (this.visible) + { + mc.getTextureManager().bindTexture(GuiBeacon.beaconGuiTextures); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + int i = 219; + int j = 0; + + if (!this.enabled) + { + j += this.width * 2; + } + else if (this.field_146142_r) + { + j += this.width * 1; + } + else if (this.hovered) + { + j += this.width * 3; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, j, i, this.width, this.height); + + if (!GuiBeacon.beaconGuiTextures.equals(this.field_146145_o)) + { + mc.getTextureManager().bindTexture(this.field_146145_o); + } + + this.drawTexturedModalRect(this.xPosition + 2, this.yPosition + 2, this.field_146144_p, this.field_146143_q, 18, 18); + } + } + + public boolean func_146141_c() + { + return this.field_146142_r; + } + + public void func_146140_b(boolean p_146140_1_) + { + this.field_146142_r = p_146140_1_; + } + } + + class CancelButton extends GuiBeacon.Button + { + public CancelButton(int p_i1074_2_, int p_i1074_3_, int p_i1074_4_) + { + super(p_i1074_2_, p_i1074_3_, p_i1074_4_, GuiBeacon.beaconGuiTextures, 112, 220); + } + + public void drawButtonForegroundLayer(int mouseX, int mouseY) + { + GuiBeacon.this.drawCreativeTabHoveringText(I18n.format("gui.cancel", new Object[0]), mouseX, mouseY); + } + } + + class ConfirmButton extends GuiBeacon.Button + { + public ConfirmButton(int p_i1075_2_, int p_i1075_3_, int p_i1075_4_) + { + super(p_i1075_2_, p_i1075_3_, p_i1075_4_, GuiBeacon.beaconGuiTextures, 90, 220); + } + + public void drawButtonForegroundLayer(int mouseX, int mouseY) + { + GuiBeacon.this.drawCreativeTabHoveringText(I18n.format("gui.done", new Object[0]), mouseX, mouseY); + } + } + + class PowerButton extends GuiBeacon.Button + { + private final int field_146149_p; + private final int field_146148_q; + + public PowerButton(int p_i1076_2_, int p_i1076_3_, int p_i1076_4_, int p_i1076_5_, int p_i1076_6_) + { + super(p_i1076_2_, p_i1076_3_, p_i1076_4_, GuiContainer.inventoryBackground, 0 + Potion.potionTypes[p_i1076_5_].getStatusIconIndex() % 8 * 18, 198 + Potion.potionTypes[p_i1076_5_].getStatusIconIndex() / 8 * 18); + this.field_146149_p = p_i1076_5_; + this.field_146148_q = p_i1076_6_; + } + + public void drawButtonForegroundLayer(int mouseX, int mouseY) + { + String s = I18n.format(Potion.potionTypes[this.field_146149_p].getName(), new Object[0]); + + if (this.field_146148_q >= 3 && this.field_146149_p != Potion.regeneration.id) + { + s = s + " II"; + } + + GuiBeacon.this.drawCreativeTabHoveringText(s, mouseX, mouseY); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/inventory/GuiBrewingStand.java b/src/minecraft/net/minecraft/client/gui/inventory/GuiBrewingStand.java new file mode 100644 index 0000000..3cbfb6d --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/inventory/GuiBrewingStand.java @@ -0,0 +1,93 @@ +package net.minecraft.client.gui.inventory; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ContainerBrewingStand; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.ResourceLocation; + +public class GuiBrewingStand extends GuiContainer +{ + private static final ResourceLocation brewingStandGuiTextures = new ResourceLocation("textures/gui/container/brewing_stand.png"); + + /** The player inventory bound to this GUI. */ + private final InventoryPlayer playerInventory; + private IInventory tileBrewingStand; + + public GuiBrewingStand(InventoryPlayer playerInv, IInventory p_i45506_2_) + { + super(new ContainerBrewingStand(playerInv, p_i45506_2_)); + this.playerInventory = playerInv; + this.tileBrewingStand = p_i45506_2_; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + String s = this.tileBrewingStand.getDisplayName().getUnformattedText(); + this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); + this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Args : renderPartialTicks, mouseX, mouseY + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(brewingStandGuiTextures); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); + int k = this.tileBrewingStand.getField(0); + + if (k > 0) + { + int l = (int)(28.0F * (1.0F - (float)k / 400.0F)); + + if (l > 0) + { + this.drawTexturedModalRect(i + 97, j + 16, 176, 0, 9, l); + } + + int i1 = k / 2 % 7; + + switch (i1) + { + case 0: + l = 29; + break; + + case 1: + l = 24; + break; + + case 2: + l = 20; + break; + + case 3: + l = 16; + break; + + case 4: + l = 11; + break; + + case 5: + l = 6; + break; + + case 6: + l = 0; + } + + if (l > 0) + { + this.drawTexturedModalRect(i + 65, j + 14 + 29 - l, 185, 29 - l, 12, l); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/inventory/GuiChest.java b/src/minecraft/net/minecraft/client/gui/inventory/GuiChest.java new file mode 100644 index 0000000..b01af09 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/inventory/GuiChest.java @@ -0,0 +1,54 @@ +package net.minecraft.client.gui.inventory; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.ResourceLocation; + +public class GuiChest extends GuiContainer +{ + /** The ResourceLocation containing the chest GUI texture. */ + private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("textures/gui/container/generic_54.png"); + private IInventory upperChestInventory; + private IInventory lowerChestInventory; + + /** + * window height is calculated with these values; the more rows, the heigher + */ + private int inventoryRows; + + public GuiChest(IInventory upperInv, IInventory lowerInv) + { + super(new ContainerChest(upperInv, lowerInv, Minecraft.getMinecraft().thePlayer)); + this.upperChestInventory = upperInv; + this.lowerChestInventory = lowerInv; + this.allowUserInput = false; + int i = 222; + int j = i - 108; + this.inventoryRows = lowerInv.getSizeInventory() / 9; + this.ySize = j + this.inventoryRows * 18; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + this.fontRendererObj.drawString(this.lowerChestInventory.getDisplayName().getUnformattedText(), 8, 6, 4210752); + this.fontRendererObj.drawString(this.upperChestInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Args : renderPartialTicks, mouseX, mouseY + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(CHEST_GUI_TEXTURE); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.inventoryRows * 18 + 17); + this.drawTexturedModalRect(i, j + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java b/src/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java new file mode 100644 index 0000000..3ffcefc --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java @@ -0,0 +1,516 @@ +package net.minecraft.client.gui.inventory; + +import com.google.common.collect.Sets; + +import animeware.util.render.DrawUtil; + +import java.io.IOException; +import java.util.Set; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.LWJGLException; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.util.Color; +import org.lwjgl.opengl.*; + +public abstract class GuiContainer extends GuiScreen { + float anim = 10.0F; + + protected static final ResourceLocation inventoryBackground = new ResourceLocation("textures/gui/container/inventory.png"); + + protected int xSize = 176; + + protected int ySize = 166; + + public Container inventorySlots; + + protected int guiLeft; + + protected int guiTop; + + private Slot theSlot; + + private Slot clickedSlot; + + private boolean isRightMouseClick; + + private ItemStack draggedStack; + + private int touchUpX; + + private int touchUpY; + + private Slot returningStackDestSlot; + + private long returningStackTime; + + private ItemStack returningStack; + + private Slot currentDragTargetSlot; + + private long dragItemDropDelay; + + protected final Set dragSplittingSlots = Sets.newHashSet(); + + protected boolean dragSplitting; + + private int dragSplittingLimit; + + private int dragSplittingButton; + + private boolean ignoreMouseUp; + + private int dragSplittingRemnant; + + private long lastClickTime; + + private Slot lastClickSlot; + + private int lastClickButton; + + private boolean doubleClick; + + private ItemStack shiftClickedSlot; + + public GuiContainer(Container inventorySlotsIn) { + this.inventorySlots = inventorySlotsIn; + this.ignoreMouseUp = true; + } + + public void initGui() { + this.anim = 10.0F; + super.initGui(); + this.mc.thePlayer.openContainer = this.inventorySlots; + this.guiLeft = (this.width - this.xSize) / 2; + this.guiTop = (this.height - this.ySize) / 2; + + + } + + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + drawDefaultBackground(); + if (this.anim > 0.0F) + this.anim--; + GlStateManager.translate(0.0F, this.anim, 0.0F); + + int i = this.guiLeft; + int j = this.guiTop; + drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY); + GlStateManager.disableRescaleNormal(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + super.drawScreen(mouseX, mouseY, partialTicks); + RenderHelper.enableGUIStandardItemLighting(); + GlStateManager.pushMatrix(); + GlStateManager.translate(i, j, 0.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableRescaleNormal(); + this.theSlot = null; + int k = 240; + int l = 240; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, k / 1.0F, l / 1.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); i1++) { + Slot slot = this.inventorySlots.inventorySlots.get(i1); + drawSlot(slot); + if (isMouseOverSlot(slot, mouseX, mouseY) && slot.canBeHovered()) { + this.theSlot = slot; + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + int j1 = slot.xDisplayPosition; + int k1 = slot.yDisplayPosition; + GlStateManager.colorMask(true, true, true, false); + drawGradientRect(j1, k1, j1 + 16, k1 + 16, -2130706433, -2130706433); + GlStateManager.colorMask(true, true, true, true); + GlStateManager.enableLighting(); + GlStateManager.enableDepth(); + } + } + RenderHelper.disableStandardItemLighting(); + drawGuiContainerForegroundLayer(mouseX, mouseY); + RenderHelper.enableGUIStandardItemLighting(); + InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory; + ItemStack itemstack = (this.draggedStack == null) ? inventoryplayer.getItemStack() : this.draggedStack; + if (itemstack != null) { + int j2 = 8; + int k2 = (this.draggedStack == null) ? 8 : 16; + String s = null; + if (this.draggedStack != null && this.isRightMouseClick) { + itemstack = itemstack.copy(); + itemstack.stackSize = MathHelper.ceiling_float_int(itemstack.stackSize / 2.0F); + } else if (this.dragSplitting && this.dragSplittingSlots.size() > 1) { + itemstack = itemstack.copy(); + itemstack.stackSize = this.dragSplittingRemnant; + if (itemstack.stackSize == 0) + s = EnumChatFormatting.YELLOW + "0"; + } + drawItemStack(itemstack, mouseX - i - j2, mouseY - j - k2, s); + } + if (this.returningStack != null) { + float f = (float)(Minecraft.getSystemTime() - this.returningStackTime) / 100.0F; + if (f >= 1.0F) { + f = 1.0F; + this.returningStack = null; + } + int l2 = this.returningStackDestSlot.xDisplayPosition - this.touchUpX; + int i3 = this.returningStackDestSlot.yDisplayPosition - this.touchUpY; + int l1 = this.touchUpX + (int)(l2 * f); + int i2 = this.touchUpY + (int)(i3 * f); + drawItemStack(this.returningStack, l1, i2, (String)null); + } + GlStateManager.popMatrix(); + if (inventoryplayer.getItemStack() == null && this.theSlot != null && this.theSlot.getHasStack()) { + ItemStack itemstack1 = this.theSlot.getStack(); + renderToolTip(itemstack1, mouseX, mouseY); + + } + + GlStateManager.enableLighting(); + GlStateManager.enableDepth(); + RenderHelper.enableStandardItemLighting(); + } + + private void drawItemStack(ItemStack stack, int x, int y, String altText) { + GlStateManager.translate(0.0F, 0.0F, 32.0F); + this.zLevel = 200.0F; + this.itemRender.zLevel = 200.0F; + this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); + this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack, x, y - ((this.draggedStack == null) ? 0 : 8), altText); + this.zLevel = 0.0F; + this.itemRender.zLevel = 0.0F; + } + + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {} + + protected abstract void drawGuiContainerBackgroundLayer(float paramFloat, int paramInt1, int paramInt2); + + private void drawSlot(Slot slotIn) { + int i = slotIn.xDisplayPosition; + int j = slotIn.yDisplayPosition; + ItemStack itemstack = slotIn.getStack(); + boolean flag = false; + boolean flag1 = (slotIn == this.clickedSlot && this.draggedStack != null && !this.isRightMouseClick); + ItemStack itemstack1 = this.mc.thePlayer.inventory.getItemStack(); + String s = null; + if (slotIn == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && itemstack != null) { + itemstack = itemstack.copy(); + itemstack.stackSize /= 2; + } else if (this.dragSplitting && this.dragSplittingSlots.contains(slotIn) && itemstack1 != null) { + if (this.dragSplittingSlots.size() == 1) + return; + if (Container.canAddItemToSlot(slotIn, itemstack1, true) && this.inventorySlots.canDragIntoSlot(slotIn)) { + itemstack = itemstack1.copy(); + flag = true; + Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack, (slotIn.getStack() == null) ? 0 : (slotIn.getStack()).stackSize); + if (itemstack.stackSize > itemstack.getMaxStackSize()) { + s = EnumChatFormatting.YELLOW + "" + itemstack.getMaxStackSize(); + itemstack.stackSize = itemstack.getMaxStackSize(); + } + if (itemstack.stackSize > slotIn.getItemStackLimit(itemstack)) { + s = EnumChatFormatting.YELLOW + "" + slotIn.getItemStackLimit(itemstack); + itemstack.stackSize = slotIn.getItemStackLimit(itemstack); + } + } else { + this.dragSplittingSlots.remove(slotIn); + updateDragSplitting(); + } + } + this.zLevel = 100.0F; + this.itemRender.zLevel = 100.0F; + if (itemstack == null) { + String s1 = slotIn.getSlotTexture(); + if (s1 != null) { + TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(s1); + GlStateManager.disableLighting(); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + drawTexturedModalRect(i, j, textureatlassprite, 16, 16); + GlStateManager.enableLighting(); + flag1 = true; + } + } + if (!flag1) { + if (flag) + drawRect(i, j, (i + 16), (j + 16), -2130706433); + GlStateManager.enableDepth(); + this.itemRender.renderItemAndEffectIntoGUI(itemstack, i, j); + this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, itemstack, i, j, s); + } + this.itemRender.zLevel = 0.0F; + this.zLevel = 0.0F; + } + + private void updateDragSplitting() { + ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack(); + if (itemstack != null && this.dragSplitting) { + this.dragSplittingRemnant = itemstack.stackSize; + for (Slot slot : this.dragSplittingSlots) { + ItemStack itemstack1 = itemstack.copy(); + int i = (slot.getStack() == null) ? 0 : (slot.getStack()).stackSize; + Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack1, i); + if (itemstack1.stackSize > itemstack1.getMaxStackSize()) + itemstack1.stackSize = itemstack1.getMaxStackSize(); + if (itemstack1.stackSize > slot.getItemStackLimit(itemstack1)) + itemstack1.stackSize = slot.getItemStackLimit(itemstack1); + this.dragSplittingRemnant -= itemstack1.stackSize - i; + } + } + } + + private Slot getSlotAtPosition(int x, int y) { + for (int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) { + Slot slot = this.inventorySlots.inventorySlots.get(i); + if (isMouseOverSlot(slot, x, y)) + return slot; + } + return null; + } + + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + boolean flag = (mouseButton == mc.gameSettings.keyBindPickBlock.getKeyCode() + 100); + Slot slot = getSlotAtPosition(mouseX, mouseY); + long i = Minecraft.getSystemTime(); + this.doubleClick = (this.lastClickSlot == slot && i - this.lastClickTime < 250L && this.lastClickButton == mouseButton); + this.ignoreMouseUp = false; + if (mouseButton == 0 || mouseButton == 1 || flag) { + int j = this.guiLeft; + int k = this.guiTop; + boolean flag1 = !(mouseX >= j && mouseY >= k && mouseX < j + this.xSize && mouseY < k + this.ySize); + int l = -1; + if (slot != null) + l = slot.slotNumber; + if (flag1) + l = -999; + if (mc.gameSettings.touchscreen && flag1 && this.mc.thePlayer.inventory.getItemStack() == null) { + this.mc.displayGuiScreen(null); + return; + } + if (l != -1) + if (mc.gameSettings.touchscreen) { + if (slot != null && slot.getHasStack()) { + this.clickedSlot = slot; + this.draggedStack = null; + this.isRightMouseClick = (mouseButton == 1); + } else { + this.clickedSlot = null; + } + } else if (!this.dragSplitting) { + if (this.mc.thePlayer.inventory.getItemStack() == null) { + if (mouseButton == mc.gameSettings.keyBindPickBlock.getKeyCode() + 100) { + handleMouseClick(slot, l, mouseButton, 3); + } else { + boolean flag2 = (l != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54))); + int i1 = 0; + if (flag2) { + this.shiftClickedSlot = (slot != null && slot.getHasStack()) ? slot.getStack() : null; + i1 = 1; + } else if (l == -999) { + i1 = 4; + } + handleMouseClick(slot, l, mouseButton, i1); + } + this.ignoreMouseUp = true; + } else { + this.dragSplitting = true; + this.dragSplittingButton = mouseButton; + this.dragSplittingSlots.clear(); + if (mouseButton == 0) { + this.dragSplittingLimit = 0; + } else if (mouseButton == 1) { + this.dragSplittingLimit = 1; + } else if (mouseButton == mc.gameSettings.keyBindPickBlock.getKeyCode() + 100) { + this.dragSplittingLimit = 2; + } + } + } + } + this.lastClickSlot = slot; + this.lastClickTime = i; + this.lastClickButton = mouseButton; + } + + protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { + Slot slot = getSlotAtPosition(mouseX, mouseY); + ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack(); + if (this.clickedSlot != null && mc.gameSettings.touchscreen) { + if (clickedMouseButton == 0 || clickedMouseButton == 1) + if (this.draggedStack == null) { + if (slot != this.clickedSlot && this.clickedSlot.getStack() != null) + this.draggedStack = this.clickedSlot.getStack().copy(); + } else if (this.draggedStack.stackSize > 1 && slot != null && Container.canAddItemToSlot(slot, this.draggedStack, false)) { + long i = Minecraft.getSystemTime(); + if (this.currentDragTargetSlot == slot) { + if (i - this.dragItemDropDelay > 500L) { + handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0); + handleMouseClick(slot, slot.slotNumber, 1, 0); + handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0); + this.dragItemDropDelay = i + 750L; + this.draggedStack.stackSize--; + } + } else { + this.currentDragTargetSlot = slot; + this.dragItemDropDelay = i; + } + } + } else if (this.dragSplitting && slot != null && itemstack != null && itemstack.stackSize > this.dragSplittingSlots.size() && Container.canAddItemToSlot(slot, itemstack, true) && slot.isItemValid(itemstack) && this.inventorySlots.canDragIntoSlot(slot)) { + this.dragSplittingSlots.add(slot); + updateDragSplitting(); + } + } + + protected void mouseReleased(int mouseX, int mouseY, int state) { + Slot slot = getSlotAtPosition(mouseX, mouseY); + int i = this.guiLeft; + int j = this.guiTop; + boolean flag = !(mouseX >= i && mouseY >= j && mouseX < i + this.xSize && mouseY < j + this.ySize); + int k = -1; + if (slot != null) + k = slot.slotNumber; + if (flag) + k = -999; + if (this.doubleClick && slot != null && state == 0 && this.inventorySlots.canMergeSlot(null, slot)) { + if (isShiftKeyDown()) { + if (slot != null && slot.inventory != null && this.shiftClickedSlot != null) + for (Slot slot2 : this.inventorySlots.inventorySlots) { + if (slot2 != null && slot2.canTakeStack((EntityPlayer)this.mc.thePlayer) && slot2.getHasStack() && slot2.inventory == slot.inventory && Container.canAddItemToSlot(slot2, this.shiftClickedSlot, true)) + handleMouseClick(slot2, slot2.slotNumber, state, 1); + } + } else { + handleMouseClick(slot, k, state, 6); + } + this.doubleClick = false; + this.lastClickTime = 0L; + } else { + if (this.dragSplitting && this.dragSplittingButton != state) { + this.dragSplitting = false; + this.dragSplittingSlots.clear(); + this.ignoreMouseUp = true; + return; + } + if (this.ignoreMouseUp) { + this.ignoreMouseUp = false; + return; + } + if (this.clickedSlot != null && mc.gameSettings.touchscreen) { + if (state == 0 || state == 1) { + if (this.draggedStack == null && slot != this.clickedSlot) + this.draggedStack = this.clickedSlot.getStack(); + boolean flag2 = Container.canAddItemToSlot(slot, this.draggedStack, false); + if (k != -1 && this.draggedStack != null && flag2) { + handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, state, 0); + handleMouseClick(slot, k, 0, 0); + if (this.mc.thePlayer.inventory.getItemStack() != null) { + handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, state, 0); + this.touchUpX = mouseX - i; + this.touchUpY = mouseY - j; + this.returningStackDestSlot = this.clickedSlot; + this.returningStack = this.draggedStack; + this.returningStackTime = Minecraft.getSystemTime(); + } else { + this.returningStack = null; + } + } else if (this.draggedStack != null) { + this.touchUpX = mouseX - i; + this.touchUpY = mouseY - j; + this.returningStackDestSlot = this.clickedSlot; + this.returningStack = this.draggedStack; + this.returningStackTime = Minecraft.getSystemTime(); + } + this.draggedStack = null; + this.clickedSlot = null; + } + } else if (this.dragSplitting && !this.dragSplittingSlots.isEmpty()) { + handleMouseClick((Slot)null, -999, Container.func_94534_d(0, this.dragSplittingLimit), 5); + for (Slot slot1 : this.dragSplittingSlots) + handleMouseClick(slot1, slot1.slotNumber, Container.func_94534_d(1, this.dragSplittingLimit), 5); + handleMouseClick((Slot)null, -999, Container.func_94534_d(2, this.dragSplittingLimit), 5); + } else if (this.mc.thePlayer.inventory.getItemStack() != null) { + if (state == mc.gameSettings.keyBindPickBlock.getKeyCode() + 100) { + handleMouseClick(slot, k, state, 3); + } else { + boolean flag1 = (k != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54))); + if (flag1) + this.shiftClickedSlot = (slot != null && slot.getHasStack()) ? slot.getStack() : null; + handleMouseClick(slot, k, state, flag1 ? 1 : 0); + } + } + } + if (this.mc.thePlayer.inventory.getItemStack() == null) + this.lastClickTime = 0L; + this.dragSplitting = false; + } + + private boolean isMouseOverSlot(Slot slotIn, int mouseX, int mouseY) { + return isPointInRegion(slotIn.xDisplayPosition, slotIn.yDisplayPosition, 16, 16, mouseX, mouseY); + } + + protected boolean isPointInRegion(int left, int top, int right, int bottom, int pointX, int pointY) { + int i = this.guiLeft; + int j = this.guiTop; + pointX -= i; + pointY -= j; + return (pointX >= left - 1 && pointX < left + right + 1 && pointY >= top - 1 && pointY < top + bottom + 1); + } + + protected void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) { + if (slotIn != null) + slotId = slotIn.slotNumber; + this.mc.playerController.windowClick(this.inventorySlots.windowId, slotId, clickedButton, clickType, (EntityPlayer)this.mc.thePlayer); + } + + protected void keyTyped(char typedChar, int keyCode) throws IOException { + if (keyCode == 1 || keyCode == mc.gameSettings.keyBindInventory.getKeyCode()) + this.mc.thePlayer.closeScreen(); + checkHotbarKeys(keyCode); + if (this.theSlot != null && this.theSlot.getHasStack()) + if (keyCode == mc.gameSettings.keyBindPickBlock.getKeyCode()) { + handleMouseClick(this.theSlot, this.theSlot.slotNumber, 0, 3); + } else if (keyCode == mc.gameSettings.keyBindDrop.getKeyCode()) { + handleMouseClick(this.theSlot, this.theSlot.slotNumber, isCtrlKeyDown() ? 1 : 0, 4); + } + } + + protected boolean checkHotbarKeys(int keyCode) { + if (this.mc.thePlayer.inventory.getItemStack() == null && this.theSlot != null) + for (int i = 0; i < 9; i++) { + if (keyCode == mc.gameSettings.keyBindsHotbar[i].getKeyCode()) { + handleMouseClick(this.theSlot, this.theSlot.slotNumber, i, 2); + return true; + } + } + return false; + } + + public void onGuiClosed() { + if (this.mc.thePlayer != null) + this.inventorySlots.onContainerClosed((EntityPlayer)this.mc.thePlayer); + } + + public boolean doesGuiPauseGame() { + return false; + } + + public void updateScreen() { + super.updateScreen(); + if (!this.mc.thePlayer.isEntityAlive() || this.mc.thePlayer.isDead) + this.mc.thePlayer.closeScreen(); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java b/src/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java new file mode 100644 index 0000000..9ea4279 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java @@ -0,0 +1,1009 @@ +package net.minecraft.client.gui.inventory; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.client.gui.achievement.GuiAchievements; +import net.minecraft.client.gui.achievement.GuiStats; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.InventoryEffectRenderer; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryBasic; +import net.minecraft.inventory.Slot; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + +public class GuiContainerCreative extends InventoryEffectRenderer +{ + /** The location of the creative inventory tabs texture */ + private static final ResourceLocation creativeInventoryTabs = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png"); + private static InventoryBasic field_147060_v = new InventoryBasic("tmp", true, 45); + + /** Currently selected creative inventory tab index. */ + private static int selectedTabIndex = CreativeTabs.tabBlock.getTabIndex(); + + /** Amount scrolled in Creative mode inventory (0 = top, 1 = bottom) */ + private float currentScroll; + + /** True if the scrollbar is being dragged */ + private boolean isScrolling; + + /** + * True if the left mouse button was held down last time drawScreen was called. + */ + private boolean wasClicking; + private GuiTextField searchField; + private List field_147063_B; + private Slot field_147064_C; + private boolean field_147057_D; + private CreativeCrafting field_147059_E; + + public GuiContainerCreative(EntityPlayer p_i1088_1_) + { + super(new GuiContainerCreative.ContainerCreative(p_i1088_1_)); + p_i1088_1_.openContainer = this.inventorySlots; + this.allowUserInput = true; + this.ySize = 136; + this.xSize = 195; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + if (!this.mc.playerController.isInCreativeMode()) + { + this.mc.displayGuiScreen(new GuiInventory(this.mc.thePlayer)); + } + + this.updateActivePotionEffects(); + } + + /** + * Called when the mouse is clicked over a slot or outside the gui. + */ + protected void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) + { + this.field_147057_D = true; + boolean flag = clickType == 1; + clickType = slotId == -999 && clickType == 0 ? 4 : clickType; + + if (slotIn == null && selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && clickType != 5) + { + InventoryPlayer inventoryplayer1 = this.mc.thePlayer.inventory; + + if (inventoryplayer1.getItemStack() != null) + { + if (clickedButton == 0) + { + this.mc.thePlayer.dropPlayerItemWithRandomChoice(inventoryplayer1.getItemStack(), true); + this.mc.playerController.sendPacketDropItem(inventoryplayer1.getItemStack()); + inventoryplayer1.setItemStack((ItemStack)null); + } + + if (clickedButton == 1) + { + ItemStack itemstack5 = inventoryplayer1.getItemStack().splitStack(1); + this.mc.thePlayer.dropPlayerItemWithRandomChoice(itemstack5, true); + this.mc.playerController.sendPacketDropItem(itemstack5); + + if (inventoryplayer1.getItemStack().stackSize == 0) + { + inventoryplayer1.setItemStack((ItemStack)null); + } + } + } + } + else if (slotIn == this.field_147064_C && flag) + { + for (int j = 0; j < this.mc.thePlayer.inventoryContainer.getInventory().size(); ++j) + { + this.mc.playerController.sendSlotPacket((ItemStack)null, j); + } + } + else if (selectedTabIndex == CreativeTabs.tabInventory.getTabIndex()) + { + if (slotIn == this.field_147064_C) + { + this.mc.thePlayer.inventory.setItemStack((ItemStack)null); + } + else if (clickType == 4 && slotIn != null && slotIn.getHasStack()) + { + ItemStack itemstack = slotIn.decrStackSize(clickedButton == 0 ? 1 : slotIn.getStack().getMaxStackSize()); + this.mc.thePlayer.dropPlayerItemWithRandomChoice(itemstack, true); + this.mc.playerController.sendPacketDropItem(itemstack); + } + else if (clickType == 4 && this.mc.thePlayer.inventory.getItemStack() != null) + { + this.mc.thePlayer.dropPlayerItemWithRandomChoice(this.mc.thePlayer.inventory.getItemStack(), true); + this.mc.playerController.sendPacketDropItem(this.mc.thePlayer.inventory.getItemStack()); + this.mc.thePlayer.inventory.setItemStack((ItemStack)null); + } + else + { + this.mc.thePlayer.inventoryContainer.slotClick(slotIn == null ? slotId : ((GuiContainerCreative.CreativeSlot)slotIn).slot.slotNumber, clickedButton, clickType, this.mc.thePlayer); + this.mc.thePlayer.inventoryContainer.detectAndSendChanges(); + } + } + else if (clickType != 5 && slotIn.inventory == field_147060_v) + { + InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory; + ItemStack itemstack1 = inventoryplayer.getItemStack(); + ItemStack itemstack2 = slotIn.getStack(); + + if (clickType == 2) + { + if (itemstack2 != null && clickedButton >= 0 && clickedButton < 9) + { + ItemStack itemstack7 = itemstack2.copy(); + itemstack7.stackSize = itemstack7.getMaxStackSize(); + this.mc.thePlayer.inventory.setInventorySlotContents(clickedButton, itemstack7); + this.mc.thePlayer.inventoryContainer.detectAndSendChanges(); + } + + return; + } + + if (clickType == 3) + { + if (inventoryplayer.getItemStack() == null && slotIn.getHasStack()) + { + ItemStack itemstack6 = slotIn.getStack().copy(); + itemstack6.stackSize = itemstack6.getMaxStackSize(); + inventoryplayer.setItemStack(itemstack6); + } + + return; + } + + if (clickType == 4) + { + if (itemstack2 != null) + { + ItemStack itemstack3 = itemstack2.copy(); + itemstack3.stackSize = clickedButton == 0 ? 1 : itemstack3.getMaxStackSize(); + this.mc.thePlayer.dropPlayerItemWithRandomChoice(itemstack3, true); + this.mc.playerController.sendPacketDropItem(itemstack3); + } + + return; + } + + if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2)) + { + if (clickedButton == 0) + { + if (flag) + { + itemstack1.stackSize = itemstack1.getMaxStackSize(); + } + else if (itemstack1.stackSize < itemstack1.getMaxStackSize()) + { + ++itemstack1.stackSize; + } + } + else if (itemstack1.stackSize <= 1) + { + inventoryplayer.setItemStack((ItemStack)null); + } + else + { + --itemstack1.stackSize; + } + } + else if (itemstack2 != null && itemstack1 == null) + { + inventoryplayer.setItemStack(ItemStack.copyItemStack(itemstack2)); + itemstack1 = inventoryplayer.getItemStack(); + + if (flag) + { + itemstack1.stackSize = itemstack1.getMaxStackSize(); + } + } + else + { + inventoryplayer.setItemStack((ItemStack)null); + } + } + else + { + this.inventorySlots.slotClick(slotIn == null ? slotId : slotIn.slotNumber, clickedButton, clickType, this.mc.thePlayer); + + if (Container.getDragEvent(clickedButton) == 2) + { + for (int i = 0; i < 9; ++i) + { + this.mc.playerController.sendSlotPacket(this.inventorySlots.getSlot(45 + i).getStack(), 36 + i); + } + } + else if (slotIn != null) + { + ItemStack itemstack4 = this.inventorySlots.getSlot(slotIn.slotNumber).getStack(); + this.mc.playerController.sendSlotPacket(itemstack4, slotIn.slotNumber - this.inventorySlots.inventorySlots.size() + 9 + 36); + } + } + } + + protected void updateActivePotionEffects() + { + int i = this.guiLeft; + super.updateActivePotionEffects(); + + if (this.searchField != null && this.guiLeft != i) + { + this.searchField.xPosition = this.guiLeft + 82; + } + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + if (this.mc.playerController.isInCreativeMode()) + { + super.initGui(); + this.buttonList.clear(); + Keyboard.enableRepeatEvents(true); + this.searchField = new GuiTextField(0, this.fontRendererObj, this.guiLeft + 82, this.guiTop + 6, 89, this.fontRendererObj.FONT_HEIGHT); + this.searchField.setMaxStringLength(15); + this.searchField.setEnableBackgroundDrawing(false); + this.searchField.setVisible(false); + this.searchField.setTextColor(16777215); + int i = selectedTabIndex; + selectedTabIndex = -1; + this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]); + this.field_147059_E = new CreativeCrafting(this.mc); + this.mc.thePlayer.inventoryContainer.onCraftGuiOpened(this.field_147059_E); + } + else + { + this.mc.displayGuiScreen(new GuiInventory(this.mc.thePlayer)); + } + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + super.onGuiClosed(); + + if (this.mc.thePlayer != null && this.mc.thePlayer.inventory != null) + { + this.mc.thePlayer.inventoryContainer.removeCraftingFromCrafters(this.field_147059_E); + } + + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex()) + { + if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) + { + this.setCurrentCreativeTab(CreativeTabs.tabAllSearch); + } + else + { + super.keyTyped(typedChar, keyCode); + } + } + else + { + if (this.field_147057_D) + { + this.field_147057_D = false; + this.searchField.setText(""); + } + + if (!this.checkHotbarKeys(keyCode)) + { + if (this.searchField.textboxKeyTyped(typedChar, keyCode)) + { + this.updateCreativeSearch(); + } + else + { + super.keyTyped(typedChar, keyCode); + } + } + } + } + + private void updateCreativeSearch() + { + GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; + guicontainercreative$containercreative.itemList.clear(); + + for (Item item : Item.itemRegistry) + { + if (item != null && item.getCreativeTab() != null) + { + item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList); + } + } + + for (Enchantment enchantment : Enchantment.enchantmentsBookList) + { + if (enchantment != null && enchantment.type != null) + { + Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList); + } + } + + Iterator iterator = guicontainercreative$containercreative.itemList.iterator(); + String s1 = this.searchField.getText().toLowerCase(); + + while (iterator.hasNext()) + { + ItemStack itemstack = (ItemStack)iterator.next(); + boolean flag = false; + + for (String s : itemstack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips)) + { + if (EnumChatFormatting.getTextWithoutFormattingCodes(s).toLowerCase().contains(s1)) + { + flag = true; + break; + } + } + + if (!flag) + { + iterator.remove(); + } + } + + this.currentScroll = 0.0F; + guicontainercreative$containercreative.scrollTo(0.0F); + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; + + if (creativetabs.drawInForegroundOfTab()) + { + GlStateManager.disableBlend(); + this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752); + } + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + if (mouseButton == 0) + { + int i = mouseX - this.guiLeft; + int j = mouseY - this.guiTop; + + for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) + { + if (this.func_147049_a(creativetabs, i, j)) + { + return; + } + } + } + + super.mouseClicked(mouseX, mouseY, mouseButton); + } + + /** + * Called when a mouse button is released. Args : mouseX, mouseY, releaseButton + */ + protected void mouseReleased(int mouseX, int mouseY, int state) + { + if (state == 0) + { + int i = mouseX - this.guiLeft; + int j = mouseY - this.guiTop; + + for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) + { + if (this.func_147049_a(creativetabs, i, j)) + { + this.setCurrentCreativeTab(creativetabs); + return; + } + } + } + + super.mouseReleased(mouseX, mouseY, state); + } + + /** + * returns (if you are not on the inventoryTab) and (the flag isn't set) and (you have more than 1 page of items) + */ + private boolean needsScrollBars() + { + return selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[selectedTabIndex].shouldHidePlayerInventory() && ((GuiContainerCreative.ContainerCreative)this.inventorySlots).func_148328_e(); + } + + private void setCurrentCreativeTab(CreativeTabs p_147050_1_) + { + int i = selectedTabIndex; + selectedTabIndex = p_147050_1_.getTabIndex(); + GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots; + this.dragSplittingSlots.clear(); + guicontainercreative$containercreative.itemList.clear(); + p_147050_1_.displayAllReleventItems(guicontainercreative$containercreative.itemList); + + if (p_147050_1_ == CreativeTabs.tabInventory) + { + Container container = this.mc.thePlayer.inventoryContainer; + + if (this.field_147063_B == null) + { + this.field_147063_B = guicontainercreative$containercreative.inventorySlots; + } + + guicontainercreative$containercreative.inventorySlots = Lists.newArrayList(); + + for (int j = 0; j < container.inventorySlots.size(); ++j) + { + Slot slot = new GuiContainerCreative.CreativeSlot((Slot)container.inventorySlots.get(j), j); + guicontainercreative$containercreative.inventorySlots.add(slot); + + if (j >= 5 && j < 9) + { + int j1 = j - 5; + int k1 = j1 / 2; + int l1 = j1 % 2; + slot.xDisplayPosition = 9 + k1 * 54; + slot.yDisplayPosition = 6 + l1 * 27; + } + else if (j >= 0 && j < 5) + { + slot.yDisplayPosition = -2000; + slot.xDisplayPosition = -2000; + } + else if (j < container.inventorySlots.size()) + { + int k = j - 9; + int l = k % 9; + int i1 = k / 9; + slot.xDisplayPosition = 9 + l * 18; + + if (j >= 36) + { + slot.yDisplayPosition = 112; + } + else + { + slot.yDisplayPosition = 54 + i1 * 18; + } + } + } + + this.field_147064_C = new Slot(field_147060_v, 0, 173, 112); + guicontainercreative$containercreative.inventorySlots.add(this.field_147064_C); + } + else if (i == CreativeTabs.tabInventory.getTabIndex()) + { + guicontainercreative$containercreative.inventorySlots = this.field_147063_B; + this.field_147063_B = null; + } + + if (this.searchField != null) + { + if (p_147050_1_ == CreativeTabs.tabAllSearch) + { + this.searchField.setVisible(true); + this.searchField.setCanLoseFocus(false); + this.searchField.setFocused(true); + this.searchField.setText(""); + this.updateCreativeSearch(); + } + else + { + this.searchField.setVisible(false); + this.searchField.setCanLoseFocus(true); + this.searchField.setFocused(false); + } + } + + this.currentScroll = 0.0F; + guicontainercreative$containercreative.scrollTo(0.0F); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + int i = Mouse.getEventDWheel(); + + if (i != 0 && this.needsScrollBars()) + { + int j = ((GuiContainerCreative.ContainerCreative)this.inventorySlots).itemList.size() / 9 - 5; + + if (i > 0) + { + i = 1; + } + + if (i < 0) + { + i = -1; + } + + this.currentScroll = (float)((double)this.currentScroll - (double)i / (double)j); + this.currentScroll = MathHelper.clamp_float(this.currentScroll, 0.0F, 1.0F); + ((GuiContainerCreative.ContainerCreative)this.inventorySlots).scrollTo(this.currentScroll); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + boolean flag = Mouse.isButtonDown(0); + int i = this.guiLeft; + int j = this.guiTop; + int k = i + 175; + int l = j + 18; + int i1 = k + 14; + int j1 = l + 112; + + if (!this.wasClicking && flag && mouseX >= k && mouseY >= l && mouseX < i1 && mouseY < j1) + { + this.isScrolling = this.needsScrollBars(); + } + + if (!flag) + { + this.isScrolling = false; + } + + this.wasClicking = flag; + + if (this.isScrolling) + { + this.currentScroll = ((float)(mouseY - l) - 7.5F) / ((float)(j1 - l) - 15.0F); + this.currentScroll = MathHelper.clamp_float(this.currentScroll, 0.0F, 1.0F); + ((GuiContainerCreative.ContainerCreative)this.inventorySlots).scrollTo(this.currentScroll); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + + for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray) + { + if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY)) + { + break; + } + } + + if (this.field_147064_C != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, mouseX, mouseY)) + { + this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableLighting(); + } + + protected void renderToolTip(ItemStack stack, int x, int y) + { + if (selectedTabIndex == CreativeTabs.tabAllSearch.getTabIndex()) + { + List list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips); + CreativeTabs creativetabs = stack.getItem().getCreativeTab(); + + if (creativetabs == null && stack.getItem() == Items.enchanted_book) + { + Map map = EnchantmentHelper.getEnchantments(stack); + + if (map.size() == 1) + { + Enchantment enchantment = Enchantment.getEnchantmentById(((Integer)map.keySet().iterator().next()).intValue()); + + for (CreativeTabs creativetabs1 : CreativeTabs.creativeTabArray) + { + if (creativetabs1.hasRelevantEnchantmentType(enchantment.type)) + { + creativetabs = creativetabs1; + break; + } + } + } + } + + if (creativetabs != null) + { + list.add(1, "" + EnumChatFormatting.BOLD + EnumChatFormatting.BLUE + I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0])); + } + + for (int i = 0; i < list.size(); ++i) + { + if (i == 0) + { + list.set(i, stack.getRarity().rarityColor + (String)list.get(i)); + } + else + { + list.set(i, EnumChatFormatting.GRAY + (String)list.get(i)); + } + } + + this.drawHoveringText(list, x, y); + } + else + { + super.renderToolTip(stack, x, y); + } + } + + /** + * Args : renderPartialTicks, mouseX, mouseY + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + RenderHelper.enableGUIStandardItemLighting(); + CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex]; + + for (CreativeTabs creativetabs1 : CreativeTabs.creativeTabArray) + { + this.mc.getTextureManager().bindTexture(creativeInventoryTabs); + + if (creativetabs1.getTabIndex() != selectedTabIndex) + { + this.func_147051_a(creativetabs1); + } + } + + this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName())); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); + this.searchField.drawTextBox(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + int i = this.guiLeft + 175; + int j = this.guiTop + 18; + int k = j + 112; + this.mc.getTextureManager().bindTexture(creativeInventoryTabs); + + if (creativetabs.shouldHidePlayerInventory()) + { + this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); + } + + this.func_147051_a(creativetabs); + + if (creativetabs == CreativeTabs.tabInventory) + { + GuiInventory.drawEntityOnScreen(this.guiLeft + 43, this.guiTop + 45, 20, (float)(this.guiLeft + 43 - mouseX), (float)(this.guiTop + 45 - 30 - mouseY), this.mc.thePlayer); + } + } + + protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) + { + int i = p_147049_1_.getTabColumn(); + int j = 28 * i; + int k = 0; + + if (i == 5) + { + j = this.xSize - 28 + 2; + } + else if (i > 0) + { + j += i; + } + + if (p_147049_1_.isTabInFirstRow()) + { + k = k - 32; + } + else + { + k = k + this.ySize; + } + + return p_147049_2_ >= j && p_147049_2_ <= j + 28 && p_147049_3_ >= k && p_147049_3_ <= k + 32; + } + + /** + * Renders the creative inventory hovering text if mouse is over it. Returns true if did render or false otherwise. + * Params: current creative tab to be checked, current mouse x position, current mouse y position. + */ + protected boolean renderCreativeInventoryHoveringText(CreativeTabs p_147052_1_, int p_147052_2_, int p_147052_3_) + { + int i = p_147052_1_.getTabColumn(); + int j = 28 * i; + int k = 0; + + if (i == 5) + { + j = this.xSize - 28 + 2; + } + else if (i > 0) + { + j += i; + } + + if (p_147052_1_.isTabInFirstRow()) + { + k = k - 32; + } + else + { + k = k + this.ySize; + } + + if (this.isPointInRegion(j + 3, k + 3, 23, 27, p_147052_2_, p_147052_3_)) + { + this.drawCreativeTabHoveringText(I18n.format(p_147052_1_.getTranslatedTabLabel(), new Object[0]), p_147052_2_, p_147052_3_); + return true; + } + else + { + return false; + } + } + + protected void func_147051_a(CreativeTabs p_147051_1_) + { + boolean flag = p_147051_1_.getTabIndex() == selectedTabIndex; + boolean flag1 = p_147051_1_.isTabInFirstRow(); + int i = p_147051_1_.getTabColumn(); + int j = i * 28; + int k = 0; + int l = this.guiLeft + 28 * i; + int i1 = this.guiTop; + int j1 = 32; + + if (flag) + { + k += 32; + } + + if (i == 5) + { + l = this.guiLeft + this.xSize - 28; + } + else if (i > 0) + { + l += i; + } + + if (flag1) + { + i1 = i1 - 28; + } + else + { + k += 64; + i1 = i1 + (this.ySize - 4); + } + + GlStateManager.disableLighting(); + this.drawTexturedModalRect(l, i1, j, k, 28, j1); + this.zLevel = 100.0F; + this.itemRender.zLevel = 100.0F; + l = l + 6; + i1 = i1 + 8 + (flag1 ? 1 : -1); + GlStateManager.enableLighting(); + GlStateManager.enableRescaleNormal(); + ItemStack itemstack = p_147051_1_.getIconItemStack(); + this.itemRender.renderItemAndEffectIntoGUI(itemstack, l, i1); + this.itemRender.renderItemOverlays(this.fontRendererObj, itemstack, l, i1); + GlStateManager.disableLighting(); + this.itemRender.zLevel = 0.0F; + this.zLevel = 0.0F; + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.id == 0) + { + this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter())); + } + + if (button.id == 1) + { + this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); + } + } + + public int getSelectedTabIndex() + { + return selectedTabIndex; + } + + static class ContainerCreative extends Container + { + public List itemList = Lists.newArrayList(); + + public ContainerCreative(EntityPlayer p_i1086_1_) + { + InventoryPlayer inventoryplayer = p_i1086_1_.inventory; + + for (int i = 0; i < 5; ++i) + { + for (int j = 0; j < 9; ++j) + { + this.addSlotToContainer(new Slot(GuiContainerCreative.field_147060_v, i * 9 + j, 9 + j * 18, 18 + i * 18)); + } + } + + for (int k = 0; k < 9; ++k) + { + this.addSlotToContainer(new Slot(inventoryplayer, k, 9 + k * 18, 112)); + } + + this.scrollTo(0.0F); + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return true; + } + + public void scrollTo(float p_148329_1_) + { + int i = (this.itemList.size() + 9 - 1) / 9 - 5; + int j = (int)((double)(p_148329_1_ * (float)i) + 0.5D); + + if (j < 0) + { + j = 0; + } + + for (int k = 0; k < 5; ++k) + { + for (int l = 0; l < 9; ++l) + { + int i1 = l + (k + j) * 9; + + if (i1 >= 0 && i1 < this.itemList.size()) + { + GuiContainerCreative.field_147060_v.setInventorySlotContents(l + k * 9, (ItemStack)this.itemList.get(i1)); + } + else + { + GuiContainerCreative.field_147060_v.setInventorySlotContents(l + k * 9, (ItemStack)null); + } + } + } + } + + public boolean func_148328_e() + { + return this.itemList.size() > 45; + } + + protected void retrySlotClick(int slotId, int clickedButton, boolean mode, EntityPlayer playerIn) + { + } + + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + if (index >= this.inventorySlots.size() - 9 && index < this.inventorySlots.size()) + { + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + slot.putStack((ItemStack)null); + } + } + + return null; + } + + public boolean canMergeSlot(ItemStack stack, Slot p_94530_2_) + { + return p_94530_2_.yDisplayPosition > 90; + } + + public boolean canDragIntoSlot(Slot p_94531_1_) + { + return p_94531_1_.inventory instanceof InventoryPlayer || p_94531_1_.yDisplayPosition > 90 && p_94531_1_.xDisplayPosition <= 162; + } + } + + class CreativeSlot extends Slot + { + private final Slot slot; + + public CreativeSlot(Slot p_i46313_2_, int p_i46313_3_) + { + super(p_i46313_2_.inventory, p_i46313_3_, 0, 0); + this.slot = p_i46313_2_; + } + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { + this.slot.onPickupFromSlot(playerIn, stack); + } + + public boolean isItemValid(ItemStack stack) + { + return this.slot.isItemValid(stack); + } + + public ItemStack getStack() + { + return this.slot.getStack(); + } + + public boolean getHasStack() + { + return this.slot.getHasStack(); + } + + public void putStack(ItemStack stack) + { + this.slot.putStack(stack); + } + + public void onSlotChanged() + { + this.slot.onSlotChanged(); + } + + public int getSlotStackLimit() + { + return this.slot.getSlotStackLimit(); + } + + public int getItemStackLimit(ItemStack stack) + { + return this.slot.getItemStackLimit(stack); + } + + public String getSlotTexture() + { + return this.slot.getSlotTexture(); + } + + public ItemStack decrStackSize(int amount) + { + return this.slot.decrStackSize(amount); + } + + public boolean isHere(IInventory inv, int slotIn) + { + return this.slot.isHere(inv, slotIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/inventory/GuiCrafting.java b/src/minecraft/net/minecraft/client/gui/inventory/GuiCrafting.java new file mode 100644 index 0000000..4293f20 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/inventory/GuiCrafting.java @@ -0,0 +1,45 @@ +package net.minecraft.client.gui.inventory; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ContainerWorkbench; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class GuiCrafting extends GuiContainer +{ + private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation("textures/gui/container/crafting_table.png"); + + public GuiCrafting(InventoryPlayer playerInv, World worldIn) + { + this(playerInv, worldIn, BlockPos.ORIGIN); + } + + public GuiCrafting(InventoryPlayer playerInv, World worldIn, BlockPos blockPosition) + { + super(new ContainerWorkbench(playerInv, worldIn, blockPosition)); + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + this.fontRendererObj.drawString(I18n.format("container.crafting", new Object[0]), 28, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Args : renderPartialTicks, mouseX, mouseY + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(craftingTableGuiTextures); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/inventory/GuiDispenser.java b/src/minecraft/net/minecraft/client/gui/inventory/GuiDispenser.java new file mode 100644 index 0000000..325fed5 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/inventory/GuiDispenser.java @@ -0,0 +1,47 @@ +package net.minecraft.client.gui.inventory; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ContainerDispenser; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.ResourceLocation; + +public class GuiDispenser extends GuiContainer +{ + private static final ResourceLocation dispenserGuiTextures = new ResourceLocation("textures/gui/container/dispenser.png"); + + /** The player inventory bound to this GUI. */ + private final InventoryPlayer playerInventory; + + /** The inventory contained within the corresponding Dispenser. */ + public IInventory dispenserInventory; + + public GuiDispenser(InventoryPlayer playerInv, IInventory dispenserInv) + { + super(new ContainerDispenser(playerInv, dispenserInv)); + this.playerInventory = playerInv; + this.dispenserInventory = dispenserInv; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + String s = this.dispenserInventory.getDisplayName().getUnformattedText(); + this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); + this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Args : renderPartialTicks, mouseX, mouseY + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(dispenserGuiTextures); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/inventory/GuiEditSign.java b/src/minecraft/net/minecraft/client/gui/inventory/GuiEditSign.java new file mode 100644 index 0000000..6860106 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/inventory/GuiEditSign.java @@ -0,0 +1,179 @@ +package net.minecraft.client.gui.inventory; + +import java.io.IOException; +import net.minecraft.block.Block; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.client.resources.I18n; +import net.minecraft.init.Blocks; +import net.minecraft.network.play.client.C12PacketUpdateSign; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.ChatAllowedCharacters; +import net.minecraft.util.ChatComponentText; +import org.lwjgl.input.Keyboard; + +public class GuiEditSign extends GuiScreen +{ + /** Reference to the sign object. */ + private TileEntitySign tileSign; + + /** Counts the number of screen updates. */ + private int updateCounter; + + /** The index of the line that is being edited. */ + private int editLine; + + /** "Done" button for the GUI. */ + private GuiButton doneBtn; + + public GuiEditSign(TileEntitySign teSign) + { + this.tileSign = teSign; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.clear(); + Keyboard.enableRepeatEvents(true); + this.buttonList.add(this.doneBtn = new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120, I18n.format("gui.done", new Object[0]))); + this.tileSign.setEditable(false); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + NetHandlerPlayClient nethandlerplayclient = this.mc.getNetHandler(); + + if (nethandlerplayclient != null) + { + nethandlerplayclient.addToSendQueue(new C12PacketUpdateSign(this.tileSign.getPos(), this.tileSign.signText)); + } + + this.tileSign.setEditable(true); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + ++this.updateCounter; + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 0) + { + this.tileSign.markDirty(); + this.mc.displayGuiScreen((GuiScreen)null); + } + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + if (keyCode == 200) + { + this.editLine = this.editLine - 1 & 3; + } + + if (keyCode == 208 || keyCode == 28 || keyCode == 156) + { + this.editLine = this.editLine + 1 & 3; + } + + String s = this.tileSign.signText[this.editLine].getUnformattedText(); + + if (keyCode == 14 && s.length() > 0) + { + s = s.substring(0, s.length() - 1); + } + + if (ChatAllowedCharacters.isAllowedCharacter(typedChar) && this.fontRendererObj.getStringWidth(s + typedChar) <= 90) + { + s = s + typedChar; + } + + this.tileSign.signText[this.editLine] = new ChatComponentText(s); + + if (keyCode == 1) + { + this.actionPerformed(this.doneBtn); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, I18n.format("sign.edit", new Object[0]), this.width / 2, 40, 16777215); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)(this.width / 2), 0.0F, 50.0F); + float f = 93.75F; + GlStateManager.scale(-f, -f, -f); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + Block block = this.tileSign.getBlockType(); + + if (block == Blocks.standing_sign) + { + float f1 = (float)(this.tileSign.getBlockMetadata() * 360) / 16.0F; + GlStateManager.rotate(f1, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.0F, -1.0625F, 0.0F); + } + else + { + int i = this.tileSign.getBlockMetadata(); + float f2 = 0.0F; + + if (i == 2) + { + f2 = 180.0F; + } + + if (i == 4) + { + f2 = 90.0F; + } + + if (i == 5) + { + f2 = -90.0F; + } + + GlStateManager.rotate(f2, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.0F, -1.0625F, 0.0F); + } + + if (this.updateCounter / 6 % 2 == 0) + { + this.tileSign.lineBeingEdited = this.editLine; + } + + TileEntityRendererDispatcher.instance.renderTileEntityAt(this.tileSign, -0.5D, -0.75D, -0.5D, 0.0F); + this.tileSign.lineBeingEdited = -1; + GlStateManager.popMatrix(); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/inventory/GuiFurnace.java b/src/minecraft/net/minecraft/client/gui/inventory/GuiFurnace.java new file mode 100644 index 0000000..d480e54 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/inventory/GuiFurnace.java @@ -0,0 +1,74 @@ +package net.minecraft.client.gui.inventory; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ContainerFurnace; +import net.minecraft.inventory.IInventory; +import net.minecraft.tileentity.TileEntityFurnace; +import net.minecraft.util.ResourceLocation; + +public class GuiFurnace extends GuiContainer +{ + private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("textures/gui/container/furnace.png"); + + /** The player inventory bound to this GUI. */ + private final InventoryPlayer playerInventory; + private IInventory tileFurnace; + + public GuiFurnace(InventoryPlayer playerInv, IInventory furnaceInv) + { + super(new ContainerFurnace(playerInv, furnaceInv)); + this.playerInventory = playerInv; + this.tileFurnace = furnaceInv; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + String s = this.tileFurnace.getDisplayName().getUnformattedText(); + this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); + this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Args : renderPartialTicks, mouseX, mouseY + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(furnaceGuiTextures); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); + + if (TileEntityFurnace.isBurning(this.tileFurnace)) + { + int k = this.getBurnLeftScaled(13); + this.drawTexturedModalRect(i + 56, j + 36 + 12 - k, 176, 12 - k, 14, k + 1); + } + + int l = this.getCookProgressScaled(24); + this.drawTexturedModalRect(i + 79, j + 34, 176, 14, l + 1, 16); + } + + private int getCookProgressScaled(int pixels) + { + int i = this.tileFurnace.getField(2); + int j = this.tileFurnace.getField(3); + return j != 0 && i != 0 ? i * pixels / j : 0; + } + + private int getBurnLeftScaled(int pixels) + { + int i = this.tileFurnace.getField(1); + + if (i == 0) + { + i = 200; + } + + return this.tileFurnace.getField(0) * pixels / i; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/inventory/GuiInventory.java b/src/minecraft/net/minecraft/client/gui/inventory/GuiInventory.java new file mode 100644 index 0000000..b4dca67 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/inventory/GuiInventory.java @@ -0,0 +1,108 @@ +package net.minecraft.client.gui.inventory; + +import java.io.IOException; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.achievement.GuiAchievements; +import net.minecraft.client.gui.achievement.GuiStats; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.InventoryEffectRenderer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; + +public class GuiInventory extends InventoryEffectRenderer { + private float oldMouseX; + + private float oldMouseY; + + public GuiInventory(EntityPlayer p_i1094_1_) { + super(p_i1094_1_.inventoryContainer); + this.allowUserInput = true; + } + + public void updateScreen() { + if (this.mc.playerController.isInCreativeMode()) + this.mc.displayGuiScreen((GuiScreen)new GuiContainerCreative((EntityPlayer)this.mc.thePlayer)); + updateActivePotionEffects(); + } + + public void initGui() { + this.buttonList.clear(); + if (this.mc.playerController.isInCreativeMode()) { + this.mc.displayGuiScreen((GuiScreen)new GuiContainerCreative((EntityPlayer)this.mc.thePlayer)); + } else { + super.initGui(); + } + } + + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { + this.fontRendererObj.drawString(I18n.format("container.crafting", new Object[0]), 86, 16, 4210752); + } + + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + super.drawScreen(mouseX, mouseY, partialTicks); + this.oldMouseX = mouseX; + this.oldMouseY = mouseY; + } + + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(inventoryBackground); + int i = this.guiLeft; + int j = this.guiTop; + drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); + drawEntityOnScreen(i + 51, j + 75, 30, (i + 51) - this.oldMouseX, (j + 75 - 50) - this.oldMouseY, (EntityLivingBase)this.mc.thePlayer); + } + + public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent) { + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.translate(posX, posY, 50.0F); + GlStateManager.scale(-scale, scale, scale); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + float f = ent.renderYawOffset; + float f1 = ent.rotationYaw; + float f2 = ent.rotationPitch; + float f3 = ent.prevRotationYawHead; + float f4 = ent.rotationYawHead; + GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-((float)Math.atan((mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); + ent.renderYawOffset = (float)Math.atan((mouseX / 40.0F)) * 20.0F; + ent.rotationYaw = (float)Math.atan((mouseX / 40.0F)) * 40.0F; + ent.rotationPitch = -((float)Math.atan((mouseY / 40.0F))) * 20.0F; + ent.rotationYawHead = ent.rotationYaw; + ent.prevRotationYawHead = ent.rotationYaw; + GlStateManager.translate(0.0F, 0.0F, 0.0F); + RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); + rendermanager.setPlayerViewY(180.0F); + rendermanager.setRenderShadow(false); + rendermanager.renderEntityWithPosYaw((Entity)ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + rendermanager.setRenderShadow(true); + ent.renderYawOffset = f; + ent.rotationYaw = f1; + ent.rotationPitch = f2; + ent.prevRotationYawHead = f3; + ent.rotationYawHead = f4; + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } + + protected void actionPerformed(GuiButton button) throws IOException { + if (button.id == 0) + this.mc.displayGuiScreen((GuiScreen)new GuiAchievements((GuiScreen)this, this.mc.thePlayer.getStatFileWriter())); + if (button.id == 1) + this.mc.displayGuiScreen((GuiScreen)new GuiStats((GuiScreen)this, this.mc.thePlayer.getStatFileWriter())); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/inventory/GuiScreenHorseInventory.java b/src/minecraft/net/minecraft/client/gui/inventory/GuiScreenHorseInventory.java new file mode 100644 index 0000000..bb27684 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/inventory/GuiScreenHorseInventory.java @@ -0,0 +1,80 @@ +package net.minecraft.client.gui.inventory; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.inventory.ContainerHorseInventory; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.ResourceLocation; + +public class GuiScreenHorseInventory extends GuiContainer +{ + private static final ResourceLocation horseGuiTextures = new ResourceLocation("textures/gui/container/horse.png"); + + /** The player inventory bound to this GUI. */ + private IInventory playerInventory; + + /** The horse inventory bound to this GUI. */ + private IInventory horseInventory; + + /** The EntityHorse whose inventory is currently being accessed. */ + private EntityHorse horseEntity; + + /** The mouse x-position recorded during the last rendered frame. */ + private float mousePosx; + + /** The mouse y-position recorded during the last renderered frame. */ + private float mousePosY; + + public GuiScreenHorseInventory(IInventory playerInv, IInventory horseInv, EntityHorse horse) + { + super(new ContainerHorseInventory(playerInv, horseInv, horse, Minecraft.getMinecraft().thePlayer)); + this.playerInventory = playerInv; + this.horseInventory = horseInv; + this.horseEntity = horse; + this.allowUserInput = false; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY + */ + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + this.fontRendererObj.drawString(this.horseInventory.getDisplayName().getUnformattedText(), 8, 6, 4210752); + this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Args : renderPartialTicks, mouseX, mouseY + */ + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(horseGuiTextures); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); + + if (this.horseEntity.isChested()) + { + this.drawTexturedModalRect(i + 79, j + 17, 0, this.ySize, 90, 54); + } + + if (this.horseEntity.canWearArmor()) + { + this.drawTexturedModalRect(i + 7, j + 35, 0, this.ySize + 54, 18, 18); + } + + GuiInventory.drawEntityOnScreen(i + 51, j + 60, 17, (float)(i + 51) - this.mousePosx, (float)(j + 75 - 50) - this.mousePosY, this.horseEntity); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.mousePosx = (float)mouseX; + this.mousePosY = (float)mouseY; + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/spectator/BaseSpectatorGroup.java b/src/minecraft/net/minecraft/client/gui/spectator/BaseSpectatorGroup.java new file mode 100644 index 0000000..52aeada --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/spectator/BaseSpectatorGroup.java @@ -0,0 +1,29 @@ +package net.minecraft.client.gui.spectator; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.client.gui.spectator.categories.TeleportToPlayer; +import net.minecraft.client.gui.spectator.categories.TeleportToTeam; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; + +public class BaseSpectatorGroup implements ISpectatorMenuView +{ + private final List field_178671_a = Lists.newArrayList(); + + public BaseSpectatorGroup() + { + this.field_178671_a.add(new TeleportToPlayer()); + this.field_178671_a.add(new TeleportToTeam()); + } + + public List func_178669_a() + { + return this.field_178671_a; + } + + public IChatComponent func_178670_b() + { + return new ChatComponentText("Press a key to select a command, and again to use it."); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/spectator/ISpectatorMenuObject.java b/src/minecraft/net/minecraft/client/gui/spectator/ISpectatorMenuObject.java new file mode 100644 index 0000000..e115aaf --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/spectator/ISpectatorMenuObject.java @@ -0,0 +1,14 @@ +package net.minecraft.client.gui.spectator; + +import net.minecraft.util.IChatComponent; + +public interface ISpectatorMenuObject +{ + void func_178661_a(SpectatorMenu menu); + + IChatComponent getSpectatorName(); + + void func_178663_a(float p_178663_1_, int alpha); + + boolean func_178662_A_(); +} diff --git a/src/minecraft/net/minecraft/client/gui/spectator/ISpectatorMenuRecipient.java b/src/minecraft/net/minecraft/client/gui/spectator/ISpectatorMenuRecipient.java new file mode 100644 index 0000000..c38fe09 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/spectator/ISpectatorMenuRecipient.java @@ -0,0 +1,6 @@ +package net.minecraft.client.gui.spectator; + +public interface ISpectatorMenuRecipient +{ + void func_175257_a(SpectatorMenu p_175257_1_); +} diff --git a/src/minecraft/net/minecraft/client/gui/spectator/ISpectatorMenuView.java b/src/minecraft/net/minecraft/client/gui/spectator/ISpectatorMenuView.java new file mode 100644 index 0000000..ca65d0e --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/spectator/ISpectatorMenuView.java @@ -0,0 +1,11 @@ +package net.minecraft.client.gui.spectator; + +import java.util.List; +import net.minecraft.util.IChatComponent; + +public interface ISpectatorMenuView +{ + List func_178669_a(); + + IChatComponent func_178670_b(); +} diff --git a/src/minecraft/net/minecraft/client/gui/spectator/PlayerMenuObject.java b/src/minecraft/net/minecraft/client/gui/spectator/PlayerMenuObject.java new file mode 100644 index 0000000..08f75a2 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/spectator/PlayerMenuObject.java @@ -0,0 +1,47 @@ +package net.minecraft.client.gui.spectator; + +import com.mojang.authlib.GameProfile; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.network.play.client.C18PacketSpectate; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ResourceLocation; + +public class PlayerMenuObject implements ISpectatorMenuObject +{ + private final GameProfile profile; + private final ResourceLocation resourceLocation; + + public PlayerMenuObject(GameProfile profileIn) + { + this.profile = profileIn; + this.resourceLocation = AbstractClientPlayer.getLocationSkin(profileIn.getName()); + AbstractClientPlayer.getDownloadImageSkin(this.resourceLocation, profileIn.getName()); + } + + public void func_178661_a(SpectatorMenu menu) + { + Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C18PacketSpectate(this.profile.getId())); + } + + public IChatComponent getSpectatorName() + { + return new ChatComponentText(this.profile.getName()); + } + + public void func_178663_a(float p_178663_1_, int alpha) + { + Minecraft.getMinecraft().getTextureManager().bindTexture(this.resourceLocation); + GlStateManager.color(1.0F, 1.0F, 1.0F, (float)alpha / 255.0F); + Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F); + Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F); + } + + public boolean func_178662_A_() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/spectator/SpectatorMenu.java b/src/minecraft/net/minecraft/client/gui/spectator/SpectatorMenu.java new file mode 100644 index 0000000..6fa5c43 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/spectator/SpectatorMenu.java @@ -0,0 +1,183 @@ +package net.minecraft.client.gui.spectator; + +import com.google.common.base.Objects; +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiSpectator; +import net.minecraft.client.gui.spectator.categories.SpectatorDetails; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; + +public class SpectatorMenu +{ + private static final ISpectatorMenuObject field_178655_b = new SpectatorMenu.EndSpectatorObject(); + private static final ISpectatorMenuObject field_178656_c = new SpectatorMenu.MoveMenuObject(-1, true); + private static final ISpectatorMenuObject field_178653_d = new SpectatorMenu.MoveMenuObject(1, true); + private static final ISpectatorMenuObject field_178654_e = new SpectatorMenu.MoveMenuObject(1, false); + public static final ISpectatorMenuObject field_178657_a = new ISpectatorMenuObject() + { + public void func_178661_a(SpectatorMenu menu) + { + } + public IChatComponent getSpectatorName() + { + return new ChatComponentText(""); + } + public void func_178663_a(float p_178663_1_, int alpha) + { + } + public boolean func_178662_A_() + { + return false; + } + }; + private final ISpectatorMenuRecipient field_178651_f; + private final List field_178652_g = Lists.newArrayList(); + private ISpectatorMenuView field_178659_h = new BaseSpectatorGroup(); + private int field_178660_i = -1; + private int field_178658_j; + + public SpectatorMenu(ISpectatorMenuRecipient p_i45497_1_) + { + this.field_178651_f = p_i45497_1_; + } + + public ISpectatorMenuObject func_178643_a(int p_178643_1_) + { + int i = p_178643_1_ + this.field_178658_j * 6; + return this.field_178658_j > 0 && p_178643_1_ == 0 ? field_178656_c : (p_178643_1_ == 7 ? (i < this.field_178659_h.func_178669_a().size() ? field_178653_d : field_178654_e) : (p_178643_1_ == 8 ? field_178655_b : (i >= 0 && i < this.field_178659_h.func_178669_a().size() ? (ISpectatorMenuObject)Objects.firstNonNull(this.field_178659_h.func_178669_a().get(i), field_178657_a) : field_178657_a))); + } + + public List func_178642_a() + { + List list = Lists.newArrayList(); + + for (int i = 0; i <= 8; ++i) + { + list.add(this.func_178643_a(i)); + } + + return list; + } + + public ISpectatorMenuObject func_178645_b() + { + return this.func_178643_a(this.field_178660_i); + } + + public ISpectatorMenuView func_178650_c() + { + return this.field_178659_h; + } + + public void func_178644_b(int p_178644_1_) + { + ISpectatorMenuObject ispectatormenuobject = this.func_178643_a(p_178644_1_); + + if (ispectatormenuobject != field_178657_a) + { + if (this.field_178660_i == p_178644_1_ && ispectatormenuobject.func_178662_A_()) + { + ispectatormenuobject.func_178661_a(this); + } + else + { + this.field_178660_i = p_178644_1_; + } + } + } + + public void func_178641_d() + { + this.field_178651_f.func_175257_a(this); + } + + public int func_178648_e() + { + return this.field_178660_i; + } + + public void func_178647_a(ISpectatorMenuView p_178647_1_) + { + this.field_178652_g.add(this.func_178646_f()); + this.field_178659_h = p_178647_1_; + this.field_178660_i = -1; + this.field_178658_j = 0; + } + + public SpectatorDetails func_178646_f() + { + return new SpectatorDetails(this.field_178659_h, this.func_178642_a(), this.field_178660_i); + } + + static class EndSpectatorObject implements ISpectatorMenuObject + { + private EndSpectatorObject() + { + } + + public void func_178661_a(SpectatorMenu menu) + { + menu.func_178641_d(); + } + + public IChatComponent getSpectatorName() + { + return new ChatComponentText("Close menu"); + } + + public void func_178663_a(float p_178663_1_, int alpha) + { + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiSpectator.field_175269_a); + Gui.drawModalRectWithCustomSizedTexture(0, 0, 128.0F, 0.0F, 16, 16, 256.0F, 256.0F); + } + + public boolean func_178662_A_() + { + return true; + } + } + + static class MoveMenuObject implements ISpectatorMenuObject + { + private final int field_178666_a; + private final boolean field_178665_b; + + public MoveMenuObject(int p_i45495_1_, boolean p_i45495_2_) + { + this.field_178666_a = p_i45495_1_; + this.field_178665_b = p_i45495_2_; + } + + public void func_178661_a(SpectatorMenu menu) + { + menu.field_178658_j = this.field_178666_a; + } + + public IChatComponent getSpectatorName() + { + return this.field_178666_a < 0 ? new ChatComponentText("Previous Page") : new ChatComponentText("Next Page"); + } + + public void func_178663_a(float p_178663_1_, int alpha) + { + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiSpectator.field_175269_a); + + if (this.field_178666_a < 0) + { + Gui.drawModalRectWithCustomSizedTexture(0, 0, 144.0F, 0.0F, 16, 16, 256.0F, 256.0F); + } + else + { + Gui.drawModalRectWithCustomSizedTexture(0, 0, 160.0F, 0.0F, 16, 16, 256.0F, 256.0F); + } + } + + public boolean func_178662_A_() + { + return this.field_178665_b; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/spectator/categories/SpectatorDetails.java b/src/minecraft/net/minecraft/client/gui/spectator/categories/SpectatorDetails.java new file mode 100644 index 0000000..b29ce29 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/spectator/categories/SpectatorDetails.java @@ -0,0 +1,31 @@ +package net.minecraft.client.gui.spectator.categories; + +import com.google.common.base.Objects; +import java.util.List; +import net.minecraft.client.gui.spectator.ISpectatorMenuObject; +import net.minecraft.client.gui.spectator.ISpectatorMenuView; +import net.minecraft.client.gui.spectator.SpectatorMenu; + +public class SpectatorDetails +{ + private final ISpectatorMenuView field_178684_a; + private final List field_178682_b; + private final int field_178683_c; + + public SpectatorDetails(ISpectatorMenuView p_i45494_1_, List p_i45494_2_, int p_i45494_3_) + { + this.field_178684_a = p_i45494_1_; + this.field_178682_b = p_i45494_2_; + this.field_178683_c = p_i45494_3_; + } + + public ISpectatorMenuObject func_178680_a(int p_178680_1_) + { + return p_178680_1_ >= 0 && p_178680_1_ < this.field_178682_b.size() ? (ISpectatorMenuObject)Objects.firstNonNull(this.field_178682_b.get(p_178680_1_), SpectatorMenu.field_178657_a) : SpectatorMenu.field_178657_a; + } + + public int func_178681_b() + { + return this.field_178683_c; + } +} diff --git a/src/minecraft/net/minecraft/client/gui/spectator/categories/TeleportToPlayer.java b/src/minecraft/net/minecraft/client/gui/spectator/categories/TeleportToPlayer.java new file mode 100644 index 0000000..f92c7c1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/spectator/categories/TeleportToPlayer.java @@ -0,0 +1,80 @@ +package net.minecraft.client.gui.spectator.categories; + +import com.google.common.collect.ComparisonChain; +import com.google.common.collect.Lists; +import com.google.common.collect.Ordering; +import java.util.Collection; +import java.util.Comparator; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiSpectator; +import net.minecraft.client.gui.spectator.ISpectatorMenuObject; +import net.minecraft.client.gui.spectator.ISpectatorMenuView; +import net.minecraft.client.gui.spectator.PlayerMenuObject; +import net.minecraft.client.gui.spectator.SpectatorMenu; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.WorldSettings; + +public class TeleportToPlayer implements ISpectatorMenuView, ISpectatorMenuObject +{ + private static final Ordering field_178674_a = Ordering.from(new Comparator() + { + public int compare(NetworkPlayerInfo p_compare_1_, NetworkPlayerInfo p_compare_2_) + { + return ComparisonChain.start().compare(p_compare_1_.getGameProfile().getId(), p_compare_2_.getGameProfile().getId()).result(); + } + }); + private final List field_178673_b; + + public TeleportToPlayer() + { + this(field_178674_a.sortedCopy(Minecraft.getMinecraft().getNetHandler().getPlayerInfoMap())); + } + + public TeleportToPlayer(Collection p_i45493_1_) + { + this.field_178673_b = Lists.newArrayList(); + + for (NetworkPlayerInfo networkplayerinfo : field_178674_a.sortedCopy(p_i45493_1_)) + { + if (networkplayerinfo.getGameType() != WorldSettings.GameType.SPECTATOR) + { + this.field_178673_b.add(new PlayerMenuObject(networkplayerinfo.getGameProfile())); + } + } + } + + public List func_178669_a() + { + return this.field_178673_b; + } + + public IChatComponent func_178670_b() + { + return new ChatComponentText("Select a player to teleport to"); + } + + public void func_178661_a(SpectatorMenu menu) + { + menu.func_178647_a(this); + } + + public IChatComponent getSpectatorName() + { + return new ChatComponentText("Teleport to player"); + } + + public void func_178663_a(float p_178663_1_, int alpha) + { + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiSpectator.field_175269_a); + Gui.drawModalRectWithCustomSizedTexture(0, 0, 0.0F, 0.0F, 16, 16, 256.0F, 256.0F); + } + + public boolean func_178662_A_() + { + return !this.field_178673_b.isEmpty(); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/spectator/categories/TeleportToTeam.java b/src/minecraft/net/minecraft/client/gui/spectator/categories/TeleportToTeam.java new file mode 100644 index 0000000..eed312c --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/spectator/categories/TeleportToTeam.java @@ -0,0 +1,148 @@ +package net.minecraft.client.gui.spectator.categories; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Random; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiSpectator; +import net.minecraft.client.gui.spectator.ISpectatorMenuObject; +import net.minecraft.client.gui.spectator.ISpectatorMenuView; +import net.minecraft.client.gui.spectator.SpectatorMenu; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.DefaultPlayerSkin; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class TeleportToTeam implements ISpectatorMenuView, ISpectatorMenuObject +{ + private final List field_178672_a = Lists.newArrayList(); + + public TeleportToTeam() + { + Minecraft minecraft = Minecraft.getMinecraft(); + + for (ScorePlayerTeam scoreplayerteam : minecraft.theWorld.getScoreboard().getTeams()) + { + this.field_178672_a.add(new TeleportToTeam.TeamSelectionObject(scoreplayerteam)); + } + } + + public List func_178669_a() + { + return this.field_178672_a; + } + + public IChatComponent func_178670_b() + { + return new ChatComponentText("Select a team to teleport to"); + } + + public void func_178661_a(SpectatorMenu menu) + { + menu.func_178647_a(this); + } + + public IChatComponent getSpectatorName() + { + return new ChatComponentText("Teleport to team member"); + } + + public void func_178663_a(float p_178663_1_, int alpha) + { + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiSpectator.field_175269_a); + Gui.drawModalRectWithCustomSizedTexture(0, 0, 16.0F, 0.0F, 16, 16, 256.0F, 256.0F); + } + + public boolean func_178662_A_() + { + for (ISpectatorMenuObject ispectatormenuobject : this.field_178672_a) + { + if (ispectatormenuobject.func_178662_A_()) + { + return true; + } + } + + return false; + } + + class TeamSelectionObject implements ISpectatorMenuObject + { + private final ScorePlayerTeam field_178676_b; + private final ResourceLocation field_178677_c; + private final List field_178675_d; + + public TeamSelectionObject(ScorePlayerTeam p_i45492_2_) + { + this.field_178676_b = p_i45492_2_; + this.field_178675_d = Lists.newArrayList(); + + for (String s : p_i45492_2_.getMembershipCollection()) + { + NetworkPlayerInfo networkplayerinfo = Minecraft.getMinecraft().getNetHandler().getPlayerInfo(s); + + if (networkplayerinfo != null) + { + this.field_178675_d.add(networkplayerinfo); + } + } + + if (!this.field_178675_d.isEmpty()) + { + String s1 = ((NetworkPlayerInfo)this.field_178675_d.get((new Random()).nextInt(this.field_178675_d.size()))).getGameProfile().getName(); + this.field_178677_c = AbstractClientPlayer.getLocationSkin(s1); + AbstractClientPlayer.getDownloadImageSkin(this.field_178677_c, s1); + } + else + { + this.field_178677_c = DefaultPlayerSkin.getDefaultSkinLegacy(); + } + } + + public void func_178661_a(SpectatorMenu menu) + { + menu.func_178647_a(new TeleportToPlayer(this.field_178675_d)); + } + + public IChatComponent getSpectatorName() + { + return new ChatComponentText(this.field_178676_b.getTeamName()); + } + + public void func_178663_a(float p_178663_1_, int alpha) + { + int i = -1; + String s = FontRenderer.getFormatFromString(this.field_178676_b.getColorPrefix()); + + if (s.length() >= 2) + { + i = Minecraft.getMinecraft().fontRendererObj.getColorCode(s.charAt(1)); + } + + if (i >= 0) + { + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; + Gui.drawRect(1, 1, 15, 15, MathHelper.func_180183_b(f * p_178663_1_, f1 * p_178663_1_, f2 * p_178663_1_) | alpha << 24); + } + + Minecraft.getMinecraft().getTextureManager().bindTexture(this.field_178677_c); + GlStateManager.color(p_178663_1_, p_178663_1_, p_178663_1_, (float)alpha / 255.0F); + Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F); + Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F); + } + + public boolean func_178662_A_() + { + return !this.field_178675_d.isEmpty(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/stream/GuiIngestServers.java b/src/minecraft/net/minecraft/client/gui/stream/GuiIngestServers.java new file mode 100644 index 0000000..e6236d9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/stream/GuiIngestServers.java @@ -0,0 +1,178 @@ +package net.minecraft.client.gui.stream; + +import java.io.IOException; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiSlot; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.stream.IngestServerTester; +import net.minecraft.util.EnumChatFormatting; +import tv.twitch.broadcast.IngestServer; + +public class GuiIngestServers extends GuiScreen +{ + private final GuiScreen field_152309_a; + private String field_152310_f; + private GuiIngestServers.ServerList field_152311_g; + + public GuiIngestServers(GuiScreen p_i46312_1_) + { + this.field_152309_a = p_i46312_1_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.field_152310_f = I18n.format("options.stream.ingest.title", new Object[0]); + this.field_152311_g = new GuiIngestServers.ServerList(this.mc); + + if (!this.mc.getTwitchStream().func_152908_z()) + { + this.mc.getTwitchStream().func_152909_x(); + } + + this.buttonList.add(new GuiButton(1, this.width / 2 - 155, this.height - 24 - 6, 150, 20, I18n.format("gui.done", new Object[0]))); + this.buttonList.add(new GuiButton(2, this.width / 2 + 5, this.height - 24 - 6, 150, 20, I18n.format("options.stream.ingest.reset", new Object[0]))); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + this.field_152311_g.handleMouseInput(); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + if (this.mc.getTwitchStream().func_152908_z()) + { + this.mc.getTwitchStream().func_152932_y().func_153039_l(); + } + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 1) + { + this.mc.displayGuiScreen(this.field_152309_a); + } + else + { + this.mc.gameSettings.streamPreferredServer = ""; + this.mc.gameSettings.saveOptions(); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.field_152311_g.drawScreen(mouseX, mouseY, partialTicks); + this.drawCenteredString(this.fontRendererObj, this.field_152310_f, this.width / 2, 20, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + class ServerList extends GuiSlot + { + public ServerList(Minecraft mcIn) + { + super(mcIn, GuiIngestServers.this.width, GuiIngestServers.this.height, 32, GuiIngestServers.this.height - 35, (int)((double)mcIn.fontRendererObj.FONT_HEIGHT * 3.5D)); + this.setShowSelectionBox(false); + } + + protected int getSize() + { + return this.mc.getTwitchStream().func_152925_v().length; + } + + protected void elementClicked(int slotIndex, boolean isDoubleClick, int mouseX, int mouseY) + { + this.mc.gameSettings.streamPreferredServer = this.mc.getTwitchStream().func_152925_v()[slotIndex].serverUrl; + this.mc.gameSettings.saveOptions(); + } + + protected boolean isSelected(int slotIndex) + { + return this.mc.getTwitchStream().func_152925_v()[slotIndex].serverUrl.equals(this.mc.gameSettings.streamPreferredServer); + } + + protected void drawBackground() + { + } + + protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int mouseXIn, int mouseYIn) + { + IngestServer ingestserver = this.mc.getTwitchStream().func_152925_v()[entryID]; + String s = ingestserver.serverUrl.replaceAll("\\{stream_key\\}", ""); + String s1 = (int)ingestserver.bitrateKbps + " kbps"; + String s2 = null; + IngestServerTester ingestservertester = this.mc.getTwitchStream().func_152932_y(); + + if (ingestservertester != null) + { + if (ingestserver == ingestservertester.func_153040_c()) + { + s = EnumChatFormatting.GREEN + s; + s1 = (int)(ingestservertester.func_153030_h() * 100.0F) + "%"; + } + else if (entryID < ingestservertester.func_153028_p()) + { + if (ingestserver.bitrateKbps == 0.0F) + { + s1 = EnumChatFormatting.RED + "Down!"; + } + } + else + { + s1 = EnumChatFormatting.OBFUSCATED + "1234" + EnumChatFormatting.RESET + " kbps"; + } + } + else if (ingestserver.bitrateKbps == 0.0F) + { + s1 = EnumChatFormatting.RED + "Down!"; + } + + p_180791_2_ = p_180791_2_ - 15; + + if (this.isSelected(entryID)) + { + s2 = EnumChatFormatting.BLUE + "(Preferred)"; + } + else if (ingestserver.defaultServer) + { + s2 = EnumChatFormatting.GREEN + "(Default)"; + } + + GuiIngestServers.this.drawString(GuiIngestServers.this.fontRendererObj, ingestserver.serverName, p_180791_2_ + 2, p_180791_3_ + 5, 16777215); + GuiIngestServers.this.drawString(GuiIngestServers.this.fontRendererObj, s, p_180791_2_ + 2, p_180791_3_ + GuiIngestServers.this.fontRendererObj.FONT_HEIGHT + 5 + 3, 3158064); + GuiIngestServers.this.drawString(GuiIngestServers.this.fontRendererObj, s1, this.getScrollBarX() - 5 - GuiIngestServers.this.fontRendererObj.getStringWidth(s1), p_180791_3_ + 5, 8421504); + + if (s2 != null) + { + GuiIngestServers.this.drawString(GuiIngestServers.this.fontRendererObj, s2, this.getScrollBarX() - 5 - GuiIngestServers.this.fontRendererObj.getStringWidth(s2), p_180791_3_ + 5 + 3 + GuiIngestServers.this.fontRendererObj.FONT_HEIGHT, 8421504); + } + } + + protected int getScrollBarX() + { + return super.getScrollBarX() + 15; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/stream/GuiStreamOptions.java b/src/minecraft/net/minecraft/client/gui/stream/GuiStreamOptions.java new file mode 100644 index 0000000..490bba2 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/stream/GuiStreamOptions.java @@ -0,0 +1,144 @@ +package net.minecraft.client.gui.stream; + +import java.io.IOException; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiOptionButton; +import net.minecraft.client.gui.GuiOptionSlider; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.util.EnumChatFormatting; + +public class GuiStreamOptions extends GuiScreen +{ + private static final GameSettings.Options[] field_152312_a = new GameSettings.Options[] {GameSettings.Options.STREAM_BYTES_PER_PIXEL, GameSettings.Options.STREAM_FPS, GameSettings.Options.STREAM_KBPS, GameSettings.Options.STREAM_SEND_METADATA, GameSettings.Options.STREAM_VOLUME_MIC, GameSettings.Options.STREAM_VOLUME_SYSTEM, GameSettings.Options.STREAM_MIC_TOGGLE_BEHAVIOR, GameSettings.Options.STREAM_COMPRESSION}; + private static final GameSettings.Options[] field_152316_f = new GameSettings.Options[] {GameSettings.Options.STREAM_CHAT_ENABLED, GameSettings.Options.STREAM_CHAT_USER_FILTER}; + private final GuiScreen parentScreen; + private final GameSettings field_152318_h; + private String field_152319_i; + private String field_152313_r; + private int field_152314_s; + private boolean field_152315_t = false; + + public GuiStreamOptions(GuiScreen parentScreenIn, GameSettings p_i1073_2_) + { + this.parentScreen = parentScreenIn; + this.field_152318_h = p_i1073_2_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + int i = 0; + this.field_152319_i = I18n.format("options.stream.title", new Object[0]); + this.field_152313_r = I18n.format("options.stream.chat.title", new Object[0]); + + for (GameSettings.Options gamesettings$options : field_152312_a) + { + if (gamesettings$options.getEnumFloat()) + { + this.buttonList.add(new GuiOptionSlider(gamesettings$options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), gamesettings$options)); + } + else + { + this.buttonList.add(new GuiOptionButton(gamesettings$options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), gamesettings$options, this.field_152318_h.getKeyBinding(gamesettings$options))); + } + + ++i; + } + + if (i % 2 == 1) + { + ++i; + } + + this.field_152314_s = this.height / 6 + 24 * (i >> 1) + 6; + i = i + 2; + + for (GameSettings.Options gamesettings$options1 : field_152316_f) + { + if (gamesettings$options1.getEnumFloat()) + { + this.buttonList.add(new GuiOptionSlider(gamesettings$options1.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), gamesettings$options1)); + } + else + { + this.buttonList.add(new GuiOptionButton(gamesettings$options1.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), gamesettings$options1, this.field_152318_h.getKeyBinding(gamesettings$options1))); + } + + ++i; + } + + this.buttonList.add(new GuiButton(200, this.width / 2 - 155, this.height / 6 + 168, 150, 20, I18n.format("gui.done", new Object[0]))); + GuiButton guibutton = new GuiButton(201, this.width / 2 + 5, this.height / 6 + 168, 150, 20, I18n.format("options.stream.ingestSelection", new Object[0])); + guibutton.enabled = this.mc.getTwitchStream().isReadyToBroadcast() && this.mc.getTwitchStream().func_152925_v().length > 0 || this.mc.getTwitchStream().func_152908_z(); + this.buttonList.add(guibutton); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id < 100 && button instanceof GuiOptionButton) + { + GameSettings.Options gamesettings$options = ((GuiOptionButton)button).returnEnumOptions(); + this.field_152318_h.setOptionValue(gamesettings$options, 1); + button.displayString = this.field_152318_h.getKeyBinding(GameSettings.Options.getEnumOptions(button.id)); + + if (this.mc.getTwitchStream().isBroadcasting() && gamesettings$options != GameSettings.Options.STREAM_CHAT_ENABLED && gamesettings$options != GameSettings.Options.STREAM_CHAT_USER_FILTER) + { + this.field_152315_t = true; + } + } + else if (button instanceof GuiOptionSlider) + { + if (button.id == GameSettings.Options.STREAM_VOLUME_MIC.returnEnumOrdinal()) + { + this.mc.getTwitchStream().updateStreamVolume(); + } + else if (button.id == GameSettings.Options.STREAM_VOLUME_SYSTEM.returnEnumOrdinal()) + { + this.mc.getTwitchStream().updateStreamVolume(); + } + else if (this.mc.getTwitchStream().isBroadcasting()) + { + this.field_152315_t = true; + } + } + + if (button.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.parentScreen); + } + else if (button.id == 201) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiIngestServers(this)); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.field_152319_i, this.width / 2, 20, 16777215); + this.drawCenteredString(this.fontRendererObj, this.field_152313_r, this.width / 2, this.field_152314_s, 16777215); + + if (this.field_152315_t) + { + this.drawCenteredString(this.fontRendererObj, EnumChatFormatting.RED + I18n.format("options.stream.changes", new Object[0]), this.width / 2, 20 + this.fontRendererObj.FONT_HEIGHT, 16777215); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/gui/stream/GuiStreamUnavailable.java b/src/minecraft/net/minecraft/client/gui/stream/GuiStreamUnavailable.java new file mode 100644 index 0000000..e208189 --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/stream/GuiStreamUnavailable.java @@ -0,0 +1,271 @@ +package net.minecraft.client.gui.stream; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.stream.IStream; +import net.minecraft.client.stream.NullStream; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.Session; +import net.minecraft.util.Util; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GLContext; +import tv.twitch.ErrorCode; + +public class GuiStreamUnavailable extends GuiScreen +{ + private static final Logger field_152322_a = LogManager.getLogger(); + private final IChatComponent field_152324_f; + private final GuiScreen parentScreen; + private final GuiStreamUnavailable.Reason field_152326_h; + private final List field_152327_i; + private final List field_152323_r; + + public GuiStreamUnavailable(GuiScreen p_i1070_1_, GuiStreamUnavailable.Reason p_i1070_2_) + { + this(p_i1070_1_, p_i1070_2_, (List)null); + } + + public GuiStreamUnavailable(GuiScreen parentScreenIn, GuiStreamUnavailable.Reason p_i46311_2_, List p_i46311_3_) + { + this.field_152324_f = new ChatComponentTranslation("stream.unavailable.title", new Object[0]); + this.field_152323_r = Lists.newArrayList(); + this.parentScreen = parentScreenIn; + this.field_152326_h = p_i46311_2_; + this.field_152327_i = p_i46311_3_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + if (this.field_152323_r.isEmpty()) + { + this.field_152323_r.addAll(this.fontRendererObj.listFormattedStringToWidth(this.field_152326_h.func_152561_a().getFormattedText(), (int)((float)this.width * 0.75F))); + + if (this.field_152327_i != null) + { + this.field_152323_r.add(""); + + for (ChatComponentTranslation chatcomponenttranslation : this.field_152327_i) + { + this.field_152323_r.add(chatcomponenttranslation.getUnformattedTextForChat()); + } + } + } + + if (this.field_152326_h.func_152559_b() != null) + { + this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 50, 150, 20, I18n.format("gui.cancel", new Object[0]))); + this.buttonList.add(new GuiButton(1, this.width / 2 - 155 + 160, this.height - 50, 150, 20, I18n.format(this.field_152326_h.func_152559_b().getFormattedText(), new Object[0]))); + } + else + { + this.buttonList.add(new GuiButton(0, this.width / 2 - 75, this.height - 50, 150, 20, I18n.format("gui.cancel", new Object[0]))); + } + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + int i = Math.max((int)((double)this.height * 0.85D / 2.0D - (double)((float)(this.field_152323_r.size() * this.fontRendererObj.FONT_HEIGHT) / 2.0F)), 50); + this.drawCenteredString(this.fontRendererObj, this.field_152324_f.getFormattedText(), this.width / 2, i - this.fontRendererObj.FONT_HEIGHT * 2, 16777215); + + for (String s : this.field_152323_r) + { + this.drawCenteredString(this.fontRendererObj, s, this.width / 2, i, 10526880); + i += this.fontRendererObj.FONT_HEIGHT; + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @SuppressWarnings("incomplete-switch") + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 1) + { + switch (this.field_152326_h) + { + case ACCOUNT_NOT_BOUND: + case FAILED_TWITCH_AUTH: + this.func_152320_a("https://account.mojang.com/me/settings"); + break; + + case ACCOUNT_NOT_MIGRATED: + this.func_152320_a("https://account.mojang.com/migrate"); + break; + + case UNSUPPORTED_OS_MAC: + this.func_152320_a("http://www.apple.com/osx/"); + break; + + case UNKNOWN: + case LIBRARY_FAILURE: + case INITIALIZATION_FAILURE: + this.func_152320_a("http://bugs.mojang.com/browse/MC"); + } + } + + this.mc.displayGuiScreen(this.parentScreen); + } + } + + private void func_152320_a(String p_152320_1_) + { + try + { + Class oclass = Class.forName("java.awt.Desktop"); + Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]); + oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {new URI(p_152320_1_)}); + } + catch (Throwable throwable) + { + field_152322_a.error("Couldn\'t open link", throwable); + } + } + + public static void func_152321_a(GuiScreen p_152321_0_) + { + Minecraft minecraft = Minecraft.getMinecraft(); + IStream istream = minecraft.getTwitchStream(); + + if (!OpenGlHelper.framebufferSupported) + { + List list = Lists.newArrayList(); + list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.version", new Object[] {GL11.glGetString(GL11.GL_VERSION)})); + list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.blend", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_EXT_blend_func_separate)})); + list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.arb", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_ARB_framebuffer_object)})); + list.add(new ChatComponentTranslation("stream.unavailable.no_fbo.ext", new Object[] {Boolean.valueOf(GLContext.getCapabilities().GL_EXT_framebuffer_object)})); + minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.NO_FBO, list)); + } + else if (istream instanceof NullStream) + { + if (((NullStream)istream).func_152937_a().getMessage().contains("Can\'t load AMD 64-bit .dll on a IA 32-bit platform")) + { + minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.LIBRARY_ARCH_MISMATCH)); + } + else + { + minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.LIBRARY_FAILURE)); + } + } + else if (!istream.func_152928_D() && istream.func_152912_E() == ErrorCode.TTV_EC_OS_TOO_OLD) + { + switch (Util.getOSType()) + { + case WINDOWS: + minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_WINDOWS)); + break; + + case OSX: + minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_MAC)); + break; + + default: + minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNSUPPORTED_OS_OTHER)); + } + } + else if (!minecraft.getTwitchDetails().containsKey("twitch_access_token")) + { + if (minecraft.getSession().getSessionType() == Session.Type.LEGACY) + { + minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.ACCOUNT_NOT_MIGRATED)); + } + else + { + minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.ACCOUNT_NOT_BOUND)); + } + } + else if (!istream.func_152913_F()) + { + switch (istream.func_152918_H()) + { + case INVALID_TOKEN: + minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.FAILED_TWITCH_AUTH)); + break; + + case ERROR: + default: + minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.FAILED_TWITCH_AUTH_ERROR)); + } + } + else if (istream.func_152912_E() != null) + { + List list1 = Arrays.asList(new ChatComponentTranslation[] {new ChatComponentTranslation("stream.unavailable.initialization_failure.extra", new Object[]{ErrorCode.getString(istream.func_152912_E())})}); + minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.INITIALIZATION_FAILURE, list1)); + } + else + { + minecraft.displayGuiScreen(new GuiStreamUnavailable(p_152321_0_, GuiStreamUnavailable.Reason.UNKNOWN)); + } + } + + public static enum Reason + { + NO_FBO(new ChatComponentTranslation("stream.unavailable.no_fbo", new Object[0])), + LIBRARY_ARCH_MISMATCH(new ChatComponentTranslation("stream.unavailable.library_arch_mismatch", new Object[0])), + LIBRARY_FAILURE(new ChatComponentTranslation("stream.unavailable.library_failure", new Object[0]), new ChatComponentTranslation("stream.unavailable.report_to_mojang", new Object[0])), + UNSUPPORTED_OS_WINDOWS(new ChatComponentTranslation("stream.unavailable.not_supported.windows", new Object[0])), + UNSUPPORTED_OS_MAC(new ChatComponentTranslation("stream.unavailable.not_supported.mac", new Object[0]), new ChatComponentTranslation("stream.unavailable.not_supported.mac.okay", new Object[0])), + UNSUPPORTED_OS_OTHER(new ChatComponentTranslation("stream.unavailable.not_supported.other", new Object[0])), + ACCOUNT_NOT_MIGRATED(new ChatComponentTranslation("stream.unavailable.account_not_migrated", new Object[0]), new ChatComponentTranslation("stream.unavailable.account_not_migrated.okay", new Object[0])), + ACCOUNT_NOT_BOUND(new ChatComponentTranslation("stream.unavailable.account_not_bound", new Object[0]), new ChatComponentTranslation("stream.unavailable.account_not_bound.okay", new Object[0])), + FAILED_TWITCH_AUTH(new ChatComponentTranslation("stream.unavailable.failed_auth", new Object[0]), new ChatComponentTranslation("stream.unavailable.failed_auth.okay", new Object[0])), + FAILED_TWITCH_AUTH_ERROR(new ChatComponentTranslation("stream.unavailable.failed_auth_error", new Object[0])), + INITIALIZATION_FAILURE(new ChatComponentTranslation("stream.unavailable.initialization_failure", new Object[0]), new ChatComponentTranslation("stream.unavailable.report_to_mojang", new Object[0])), + UNKNOWN(new ChatComponentTranslation("stream.unavailable.unknown", new Object[0]), new ChatComponentTranslation("stream.unavailable.report_to_mojang", new Object[0])); + + private final IChatComponent field_152574_m; + private final IChatComponent field_152575_n; + + private Reason(IChatComponent p_i1066_3_) + { + this(p_i1066_3_, (IChatComponent)null); + } + + private Reason(IChatComponent p_i1067_3_, IChatComponent p_i1067_4_) + { + this.field_152574_m = p_i1067_3_; + this.field_152575_n = p_i1067_4_; + } + + public IChatComponent func_152561_a() + { + return this.field_152574_m; + } + + public IChatComponent func_152559_b() + { + return this.field_152575_n; + } + } +} diff --git a/src/minecraft/net/minecraft/client/gui/stream/GuiTwitchUserMode.java b/src/minecraft/net/minecraft/client/gui/stream/GuiTwitchUserMode.java new file mode 100644 index 0000000..9f73efa --- /dev/null +++ b/src/minecraft/net/minecraft/client/gui/stream/GuiTwitchUserMode.java @@ -0,0 +1,243 @@ +package net.minecraft.client.gui.stream; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import java.util.Set; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.stream.IStream; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import tv.twitch.chat.ChatUserInfo; +import tv.twitch.chat.ChatUserMode; +import tv.twitch.chat.ChatUserSubscription; + +public class GuiTwitchUserMode extends GuiScreen +{ + private static final EnumChatFormatting field_152331_a = EnumChatFormatting.DARK_GREEN; + private static final EnumChatFormatting field_152335_f = EnumChatFormatting.RED; + private static final EnumChatFormatting field_152336_g = EnumChatFormatting.DARK_PURPLE; + private final ChatUserInfo field_152337_h; + private final IChatComponent field_152338_i; + private final List field_152332_r = Lists.newArrayList(); + private final IStream stream; + private int field_152334_t; + + public GuiTwitchUserMode(IStream streamIn, ChatUserInfo p_i1064_2_) + { + this.stream = streamIn; + this.field_152337_h = p_i1064_2_; + this.field_152338_i = new ChatComponentText(p_i1064_2_.displayName); + this.field_152332_r.addAll(func_152328_a(p_i1064_2_.modes, p_i1064_2_.subscriptions, streamIn)); + } + + public static List func_152328_a(Set p_152328_0_, Set p_152328_1_, IStream p_152328_2_) + { + String s = p_152328_2_ == null ? null : p_152328_2_.func_152921_C(); + boolean flag = p_152328_2_ != null && p_152328_2_.func_152927_B(); + List list = Lists.newArrayList(); + + for (ChatUserMode chatusermode : p_152328_0_) + { + IChatComponent ichatcomponent = func_152329_a(chatusermode, s, flag); + + if (ichatcomponent != null) + { + IChatComponent ichatcomponent1 = new ChatComponentText("- "); + ichatcomponent1.appendSibling(ichatcomponent); + list.add(ichatcomponent1); + } + } + + for (ChatUserSubscription chatusersubscription : p_152328_1_) + { + IChatComponent ichatcomponent2 = func_152330_a(chatusersubscription, s, flag); + + if (ichatcomponent2 != null) + { + IChatComponent ichatcomponent3 = new ChatComponentText("- "); + ichatcomponent3.appendSibling(ichatcomponent2); + list.add(ichatcomponent3); + } + } + + return list; + } + + public static IChatComponent func_152330_a(ChatUserSubscription p_152330_0_, String p_152330_1_, boolean p_152330_2_) + { + IChatComponent ichatcomponent = null; + + if (p_152330_0_ == ChatUserSubscription.TTV_CHAT_USERSUB_SUBSCRIBER) + { + if (p_152330_1_ == null) + { + ichatcomponent = new ChatComponentTranslation("stream.user.subscription.subscriber", new Object[0]); + } + else if (p_152330_2_) + { + ichatcomponent = new ChatComponentTranslation("stream.user.subscription.subscriber.self", new Object[0]); + } + else + { + ichatcomponent = new ChatComponentTranslation("stream.user.subscription.subscriber.other", new Object[] {p_152330_1_}); + } + + ichatcomponent.getChatStyle().setColor(field_152331_a); + } + else if (p_152330_0_ == ChatUserSubscription.TTV_CHAT_USERSUB_TURBO) + { + ichatcomponent = new ChatComponentTranslation("stream.user.subscription.turbo", new Object[0]); + ichatcomponent.getChatStyle().setColor(field_152336_g); + } + + return ichatcomponent; + } + + public static IChatComponent func_152329_a(ChatUserMode p_152329_0_, String p_152329_1_, boolean p_152329_2_) + { + IChatComponent ichatcomponent = null; + + if (p_152329_0_ == ChatUserMode.TTV_CHAT_USERMODE_ADMINSTRATOR) + { + ichatcomponent = new ChatComponentTranslation("stream.user.mode.administrator", new Object[0]); + ichatcomponent.getChatStyle().setColor(field_152336_g); + } + else if (p_152329_0_ == ChatUserMode.TTV_CHAT_USERMODE_BANNED) + { + if (p_152329_1_ == null) + { + ichatcomponent = new ChatComponentTranslation("stream.user.mode.banned", new Object[0]); + } + else if (p_152329_2_) + { + ichatcomponent = new ChatComponentTranslation("stream.user.mode.banned.self", new Object[0]); + } + else + { + ichatcomponent = new ChatComponentTranslation("stream.user.mode.banned.other", new Object[] {p_152329_1_}); + } + + ichatcomponent.getChatStyle().setColor(field_152335_f); + } + else if (p_152329_0_ == ChatUserMode.TTV_CHAT_USERMODE_BROADCASTER) + { + if (p_152329_1_ == null) + { + ichatcomponent = new ChatComponentTranslation("stream.user.mode.broadcaster", new Object[0]); + } + else if (p_152329_2_) + { + ichatcomponent = new ChatComponentTranslation("stream.user.mode.broadcaster.self", new Object[0]); + } + else + { + ichatcomponent = new ChatComponentTranslation("stream.user.mode.broadcaster.other", new Object[0]); + } + + ichatcomponent.getChatStyle().setColor(field_152331_a); + } + else if (p_152329_0_ == ChatUserMode.TTV_CHAT_USERMODE_MODERATOR) + { + if (p_152329_1_ == null) + { + ichatcomponent = new ChatComponentTranslation("stream.user.mode.moderator", new Object[0]); + } + else if (p_152329_2_) + { + ichatcomponent = new ChatComponentTranslation("stream.user.mode.moderator.self", new Object[0]); + } + else + { + ichatcomponent = new ChatComponentTranslation("stream.user.mode.moderator.other", new Object[] {p_152329_1_}); + } + + ichatcomponent.getChatStyle().setColor(field_152331_a); + } + else if (p_152329_0_ == ChatUserMode.TTV_CHAT_USERMODE_STAFF) + { + ichatcomponent = new ChatComponentTranslation("stream.user.mode.staff", new Object[0]); + ichatcomponent.getChatStyle().setColor(field_152336_g); + } + + return ichatcomponent; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + int i = this.width / 3; + int j = i - 130; + this.buttonList.add(new GuiButton(1, i * 0 + j / 2, this.height - 70, 130, 20, I18n.format("stream.userinfo.timeout", new Object[0]))); + this.buttonList.add(new GuiButton(0, i * 1 + j / 2, this.height - 70, 130, 20, I18n.format("stream.userinfo.ban", new Object[0]))); + this.buttonList.add(new GuiButton(2, i * 2 + j / 2, this.height - 70, 130, 20, I18n.format("stream.userinfo.mod", new Object[0]))); + this.buttonList.add(new GuiButton(5, i * 0 + j / 2, this.height - 45, 130, 20, I18n.format("gui.cancel", new Object[0]))); + this.buttonList.add(new GuiButton(3, i * 1 + j / 2, this.height - 45, 130, 20, I18n.format("stream.userinfo.unban", new Object[0]))); + this.buttonList.add(new GuiButton(4, i * 2 + j / 2, this.height - 45, 130, 20, I18n.format("stream.userinfo.unmod", new Object[0]))); + int k = 0; + + for (IChatComponent ichatcomponent : this.field_152332_r) + { + k = Math.max(k, this.fontRendererObj.getStringWidth(ichatcomponent.getFormattedText())); + } + + this.field_152334_t = this.width / 2 - k / 2; + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.enabled) + { + if (button.id == 0) + { + this.stream.func_152917_b("/ban " + this.field_152337_h.displayName); + } + else if (button.id == 3) + { + this.stream.func_152917_b("/unban " + this.field_152337_h.displayName); + } + else if (button.id == 2) + { + this.stream.func_152917_b("/mod " + this.field_152337_h.displayName); + } + else if (button.id == 4) + { + this.stream.func_152917_b("/unmod " + this.field_152337_h.displayName); + } + else if (button.id == 1) + { + this.stream.func_152917_b("/timeout " + this.field_152337_h.displayName); + } + + this.mc.displayGuiScreen((GuiScreen)null); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.field_152338_i.getUnformattedText(), this.width / 2, 70, 16777215); + int i = 80; + + for (IChatComponent ichatcomponent : this.field_152332_r) + { + this.drawString(this.fontRendererObj, ichatcomponent.getFormattedText(), this.field_152334_t, i, 16777215); + i += this.fontRendererObj.FONT_HEIGHT; + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/main/GameConfiguration.java b/src/minecraft/net/minecraft/client/main/GameConfiguration.java new file mode 100644 index 0000000..222a294 --- /dev/null +++ b/src/minecraft/net/minecraft/client/main/GameConfiguration.java @@ -0,0 +1,96 @@ +package net.minecraft.client.main; + +import com.mojang.authlib.properties.PropertyMap; +import java.io.File; +import java.net.Proxy; +import net.minecraft.util.Session; + +public class GameConfiguration +{ + public final GameConfiguration.UserInformation userInfo; + public final GameConfiguration.DisplayInformation displayInfo; + public final GameConfiguration.FolderInformation folderInfo; + public final GameConfiguration.GameInformation gameInfo; + public final GameConfiguration.ServerInformation serverInfo; + + public GameConfiguration(GameConfiguration.UserInformation userInfoIn, GameConfiguration.DisplayInformation displayInfoIn, GameConfiguration.FolderInformation folderInfoIn, GameConfiguration.GameInformation gameInfoIn, GameConfiguration.ServerInformation serverInfoIn) + { + this.userInfo = userInfoIn; + this.displayInfo = displayInfoIn; + this.folderInfo = folderInfoIn; + this.gameInfo = gameInfoIn; + this.serverInfo = serverInfoIn; + } + + public static class DisplayInformation + { + public final int width; + public final int height; + public final boolean fullscreen; + public final boolean checkGlErrors; + + public DisplayInformation(int widthIn, int heightIn, boolean fullscreenIn, boolean checkGlErrorsIn) + { + this.width = widthIn; + this.height = heightIn; + this.fullscreen = fullscreenIn; + this.checkGlErrors = checkGlErrorsIn; + } + } + + public static class FolderInformation + { + public final File mcDataDir; + public final File resourcePacksDir; + public final File assetsDir; + public final String assetIndex; + + public FolderInformation(File mcDataDirIn, File resourcePacksDirIn, File assetsDirIn, String assetIndexIn) + { + this.mcDataDir = mcDataDirIn; + this.resourcePacksDir = resourcePacksDirIn; + this.assetsDir = assetsDirIn; + this.assetIndex = assetIndexIn; + } + } + + public static class GameInformation + { + public final boolean isDemo; + public final String version; + + public GameInformation(boolean isDemoIn, String versionIn) + { + this.isDemo = isDemoIn; + this.version = versionIn; + } + } + + public static class ServerInformation + { + public final String serverName; + public final int serverPort; + + public ServerInformation(String serverNameIn, int serverPortIn) + { + this.serverName = serverNameIn; + this.serverPort = serverPortIn; + } + } + + public static class UserInformation + { + public final Session session; + public final PropertyMap userProperties; + public final PropertyMap field_181172_c; + public final Proxy proxy; + + public UserInformation(Session p_i46375_1_, PropertyMap p_i46375_2_, PropertyMap p_i46375_3_, Proxy p_i46375_4_) + { + this.session = p_i46375_1_; + this.userProperties = p_i46375_2_; + this.field_181172_c = p_i46375_3_; + this.proxy = p_i46375_4_; + } + } +} diff --git a/src/minecraft/net/minecraft/client/main/Main.java b/src/minecraft/net/minecraft/client/main/Main.java new file mode 100644 index 0000000..57eb452 --- /dev/null +++ b/src/minecraft/net/minecraft/client/main/Main.java @@ -0,0 +1,120 @@ +package net.minecraft.client.main; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.mojang.authlib.properties.PropertyMap; +import com.mojang.authlib.properties.PropertyMap.Serializer; +import java.io.File; +import java.net.Authenticator; +import java.net.InetSocketAddress; +import java.net.PasswordAuthentication; +import java.net.Proxy; +import java.net.Proxy.Type; +import java.util.List; +import joptsimple.OptionParser; +import joptsimple.OptionSet; +import joptsimple.OptionSpec; +import net.minecraft.client.Minecraft; +import net.minecraft.util.Session; + +public class Main +{ + public static void main(String[] p_main_0_) + { + System.setProperty("java.net.preferIPv4Stack", "true"); + OptionParser optionparser = new OptionParser(); + optionparser.allowsUnrecognizedOptions(); + optionparser.accepts("demo"); + optionparser.accepts("fullscreen"); + optionparser.accepts("checkGlErrors"); + OptionSpec optionspec = optionparser.accepts("server").withRequiredArg(); + OptionSpec optionspec1 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(25565), new Integer[0]); + OptionSpec optionspec2 = optionparser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File("."), new File[0]); + OptionSpec optionspec3 = optionparser.accepts("assetsDir").withRequiredArg().ofType(File.class); + OptionSpec optionspec4 = optionparser.accepts("resourcePackDir").withRequiredArg().ofType(File.class); + OptionSpec optionspec5 = optionparser.accepts("proxyHost").withRequiredArg(); + OptionSpec optionspec6 = optionparser.accepts("proxyPort").withRequiredArg().defaultsTo("8080", new String[0]).ofType(Integer.class); + OptionSpec optionspec7 = optionparser.accepts("proxyUser").withRequiredArg(); + OptionSpec optionspec8 = optionparser.accepts("proxyPass").withRequiredArg(); + OptionSpec optionspec9 = optionparser.accepts("username").withRequiredArg().defaultsTo("Player" + Minecraft.getSystemTime() % 1000L, new String[0]); + OptionSpec optionspec10 = optionparser.accepts("uuid").withRequiredArg(); + OptionSpec optionspec11 = optionparser.accepts("accessToken").withRequiredArg().required(); + OptionSpec optionspec12 = optionparser.accepts("version").withRequiredArg().required(); + OptionSpec optionspec13 = optionparser.accepts("width").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(1254), new Integer[0]); + OptionSpec optionspec14 = optionparser.accepts("height").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(705), new Integer[0]); + OptionSpec optionspec15 = optionparser.accepts("userProperties").withRequiredArg().defaultsTo("{}", new String[0]); + OptionSpec optionspec16 = optionparser.accepts("profileProperties").withRequiredArg().defaultsTo("{}", new String[0]); + OptionSpec optionspec17 = optionparser.accepts("assetIndex").withRequiredArg(); + OptionSpec optionspec18 = optionparser.accepts("userType").withRequiredArg().defaultsTo("legacy", new String[0]); + OptionSpec optionspec19 = optionparser.nonOptions(); + OptionSet optionset = optionparser.parse(p_main_0_); + List list = optionset.valuesOf(optionspec19); + + if (!list.isEmpty()) + { + System.out.println("Completely ignored arguments: " + list); + } + + String s = (String)optionset.valueOf(optionspec5); + Proxy proxy = Proxy.NO_PROXY; + + if (s != null) + { + try + { + proxy = new Proxy(Type.SOCKS, new InetSocketAddress(s, ((Integer)optionset.valueOf(optionspec6)).intValue())); + } + catch (Exception var46) + { + ; + } + } + + final String s1 = (String)optionset.valueOf(optionspec7); + final String s2 = (String)optionset.valueOf(optionspec8); + + if (!proxy.equals(Proxy.NO_PROXY) && isNullOrEmpty(s1) && isNullOrEmpty(s2)) + { + Authenticator.setDefault(new Authenticator() + { + protected PasswordAuthentication getPasswordAuthentication() + { + return new PasswordAuthentication(s1, s2.toCharArray()); + } + }); + } + + int i = ((Integer)optionset.valueOf(optionspec13)).intValue(); + int j = ((Integer)optionset.valueOf(optionspec14)).intValue(); + boolean flag = optionset.has("fullscreen"); + boolean flag1 = optionset.has("checkGlErrors"); + boolean flag2 = optionset.has("demo"); + String s3 = (String)optionset.valueOf(optionspec12); + Gson gson = (new GsonBuilder()).registerTypeAdapter(PropertyMap.class, new Serializer()).create(); + PropertyMap propertymap = (PropertyMap)gson.fromJson((String)optionset.valueOf(optionspec15), PropertyMap.class); + PropertyMap propertymap1 = (PropertyMap)gson.fromJson((String)optionset.valueOf(optionspec16), PropertyMap.class); + File file1 = (File)optionset.valueOf(optionspec2); + File file2 = optionset.has(optionspec3) ? (File)optionset.valueOf(optionspec3) : new File(file1, "assets/"); + File file3 = optionset.has(optionspec4) ? (File)optionset.valueOf(optionspec4) : new File(file1, "resourcepacks/"); + String s4 = optionset.has(optionspec10) ? (String)optionspec10.value(optionset) : (String)optionspec9.value(optionset); + String s5 = optionset.has(optionspec17) ? (String)optionspec17.value(optionset) : null; + String s6 = (String)optionset.valueOf(optionspec); + Integer integer = (Integer)optionset.valueOf(optionspec1); + Session session = new Session((String)optionspec9.value(optionset), s4, (String)optionspec11.value(optionset), (String)optionspec18.value(optionset)); + GameConfiguration gameconfiguration = new GameConfiguration(new GameConfiguration.UserInformation(session, propertymap, propertymap1, proxy), new GameConfiguration.DisplayInformation(i, j, flag, flag1), new GameConfiguration.FolderInformation(file1, file3, file2, s5), new GameConfiguration.GameInformation(flag2, s3), new GameConfiguration.ServerInformation(s6, integer.intValue())); + Runtime.getRuntime().addShutdownHook(new Thread("Client Shutdown Thread") + { + public void run() + { + Minecraft.stopIntegratedServer(); + } + }); + Thread.currentThread().setName("Client thread"); + (new Minecraft(gameconfiguration)).run(); + } + + private static boolean isNullOrEmpty(String str) + { + return str != null && !str.isEmpty(); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelArmorStand.java b/src/minecraft/net/minecraft/client/model/ModelArmorStand.java new file mode 100644 index 0000000..8a5f0b1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelArmorStand.java @@ -0,0 +1,133 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; + +public class ModelArmorStand extends ModelArmorStandArmor +{ + public ModelRenderer standRightSide; + public ModelRenderer standLeftSide; + public ModelRenderer standWaist; + public ModelRenderer standBase; + + public ModelArmorStand() + { + this(0.0F); + } + + public ModelArmorStand(float p_i46306_1_) + { + super(p_i46306_1_, 64, 64); + this.bipedHead = new ModelRenderer(this, 0, 0); + this.bipedHead.addBox(-1.0F, -7.0F, -1.0F, 2, 7, 2, p_i46306_1_); + this.bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F); + this.bipedBody = new ModelRenderer(this, 0, 26); + this.bipedBody.addBox(-6.0F, 0.0F, -1.5F, 12, 3, 3, p_i46306_1_); + this.bipedBody.setRotationPoint(0.0F, 0.0F, 0.0F); + this.bipedRightArm = new ModelRenderer(this, 24, 0); + this.bipedRightArm.addBox(-2.0F, -2.0F, -1.0F, 2, 12, 2, p_i46306_1_); + this.bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F); + this.bipedLeftArm = new ModelRenderer(this, 32, 16); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(0.0F, -2.0F, -1.0F, 2, 12, 2, p_i46306_1_); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F); + this.bipedRightLeg = new ModelRenderer(this, 8, 0); + this.bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 11, 2, p_i46306_1_); + this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F, 0.0F); + this.bipedLeftLeg = new ModelRenderer(this, 40, 16); + this.bipedLeftLeg.mirror = true; + this.bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 11, 2, p_i46306_1_); + this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F); + this.standRightSide = new ModelRenderer(this, 16, 0); + this.standRightSide.addBox(-3.0F, 3.0F, -1.0F, 2, 7, 2, p_i46306_1_); + this.standRightSide.setRotationPoint(0.0F, 0.0F, 0.0F); + this.standRightSide.showModel = true; + this.standLeftSide = new ModelRenderer(this, 48, 16); + this.standLeftSide.addBox(1.0F, 3.0F, -1.0F, 2, 7, 2, p_i46306_1_); + this.standLeftSide.setRotationPoint(0.0F, 0.0F, 0.0F); + this.standWaist = new ModelRenderer(this, 0, 48); + this.standWaist.addBox(-4.0F, 10.0F, -1.0F, 8, 2, 2, p_i46306_1_); + this.standWaist.setRotationPoint(0.0F, 0.0F, 0.0F); + this.standBase = new ModelRenderer(this, 0, 32); + this.standBase.addBox(-6.0F, 11.0F, -6.0F, 12, 1, 12, p_i46306_1_); + this.standBase.setRotationPoint(0.0F, 12.0F, 0.0F); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + + if (entityIn instanceof EntityArmorStand) + { + EntityArmorStand entityarmorstand = (EntityArmorStand)entityIn; + this.bipedLeftArm.showModel = entityarmorstand.getShowArms(); + this.bipedRightArm.showModel = entityarmorstand.getShowArms(); + this.standBase.showModel = !entityarmorstand.hasNoBasePlate(); + this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F); + this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F, 0.0F); + this.standRightSide.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX(); + this.standRightSide.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY(); + this.standRightSide.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ(); + this.standLeftSide.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX(); + this.standLeftSide.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY(); + this.standLeftSide.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ(); + this.standWaist.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX(); + this.standWaist.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY(); + this.standWaist.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ(); + float f = (entityarmorstand.getLeftLegRotation().getX() + entityarmorstand.getRightLegRotation().getX()) / 2.0F; + float f1 = (entityarmorstand.getLeftLegRotation().getY() + entityarmorstand.getRightLegRotation().getY()) / 2.0F; + float f2 = (entityarmorstand.getLeftLegRotation().getZ() + entityarmorstand.getRightLegRotation().getZ()) / 2.0F; + this.standBase.rotateAngleX = 0.0F; + this.standBase.rotateAngleY = 0.017453292F * -entityIn.rotationYaw; + this.standBase.rotateAngleZ = 0.0F; + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale); + GlStateManager.pushMatrix(); + + if (this.isChild) + { + float f = 2.0F; + GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f); + GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); + this.standRightSide.render(scale); + this.standLeftSide.render(scale); + this.standWaist.render(scale); + this.standBase.render(scale); + } + else + { + if (entityIn.isSneaking()) + { + GlStateManager.translate(0.0F, 0.2F, 0.0F); + } + + this.standRightSide.render(scale); + this.standLeftSide.render(scale); + this.standWaist.render(scale); + this.standBase.render(scale); + } + + GlStateManager.popMatrix(); + } + + public void postRenderArm(float scale) + { + boolean flag = this.bipedRightArm.showModel; + this.bipedRightArm.showModel = true; + super.postRenderArm(scale); + this.bipedRightArm.showModel = flag; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelArmorStandArmor.java b/src/minecraft/net/minecraft/client/model/ModelArmorStandArmor.java new file mode 100644 index 0000000..c696af0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelArmorStandArmor.java @@ -0,0 +1,57 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; + +public class ModelArmorStandArmor extends ModelBiped +{ + public ModelArmorStandArmor() + { + this(0.0F); + } + + public ModelArmorStandArmor(float modelSize) + { + this(modelSize, 64, 32); + } + + protected ModelArmorStandArmor(float modelSize, int textureWidthIn, int textureHeightIn) + { + super(modelSize, 0.0F, textureWidthIn, textureHeightIn); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + if (entityIn instanceof EntityArmorStand) + { + EntityArmorStand entityarmorstand = (EntityArmorStand)entityIn; + this.bipedHead.rotateAngleX = 0.017453292F * entityarmorstand.getHeadRotation().getX(); + this.bipedHead.rotateAngleY = 0.017453292F * entityarmorstand.getHeadRotation().getY(); + this.bipedHead.rotateAngleZ = 0.017453292F * entityarmorstand.getHeadRotation().getZ(); + this.bipedHead.setRotationPoint(0.0F, 1.0F, 0.0F); + this.bipedBody.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX(); + this.bipedBody.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY(); + this.bipedBody.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ(); + this.bipedLeftArm.rotateAngleX = 0.017453292F * entityarmorstand.getLeftArmRotation().getX(); + this.bipedLeftArm.rotateAngleY = 0.017453292F * entityarmorstand.getLeftArmRotation().getY(); + this.bipedLeftArm.rotateAngleZ = 0.017453292F * entityarmorstand.getLeftArmRotation().getZ(); + this.bipedRightArm.rotateAngleX = 0.017453292F * entityarmorstand.getRightArmRotation().getX(); + this.bipedRightArm.rotateAngleY = 0.017453292F * entityarmorstand.getRightArmRotation().getY(); + this.bipedRightArm.rotateAngleZ = 0.017453292F * entityarmorstand.getRightArmRotation().getZ(); + this.bipedLeftLeg.rotateAngleX = 0.017453292F * entityarmorstand.getLeftLegRotation().getX(); + this.bipedLeftLeg.rotateAngleY = 0.017453292F * entityarmorstand.getLeftLegRotation().getY(); + this.bipedLeftLeg.rotateAngleZ = 0.017453292F * entityarmorstand.getLeftLegRotation().getZ(); + this.bipedLeftLeg.setRotationPoint(1.9F, 11.0F, 0.0F); + this.bipedRightLeg.rotateAngleX = 0.017453292F * entityarmorstand.getRightLegRotation().getX(); + this.bipedRightLeg.rotateAngleY = 0.017453292F * entityarmorstand.getRightLegRotation().getY(); + this.bipedRightLeg.rotateAngleZ = 0.017453292F * entityarmorstand.getRightLegRotation().getZ(); + this.bipedRightLeg.setRotationPoint(-1.9F, 11.0F, 0.0F); + copyModelAngles(this.bipedHead, this.bipedHeadwear); + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelBanner.java b/src/minecraft/net/minecraft/client/model/ModelBanner.java new file mode 100644 index 0000000..17f5860 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelBanner.java @@ -0,0 +1,31 @@ +package net.minecraft.client.model; + +public class ModelBanner extends ModelBase +{ + public ModelRenderer bannerSlate; + public ModelRenderer bannerStand; + public ModelRenderer bannerTop; + + public ModelBanner() + { + this.textureWidth = 64; + this.textureHeight = 64; + this.bannerSlate = new ModelRenderer(this, 0, 0); + this.bannerSlate.addBox(-10.0F, 0.0F, -2.0F, 20, 40, 1, 0.0F); + this.bannerStand = new ModelRenderer(this, 44, 0); + this.bannerStand.addBox(-1.0F, -30.0F, -1.0F, 2, 42, 2, 0.0F); + this.bannerTop = new ModelRenderer(this, 0, 42); + this.bannerTop.addBox(-10.0F, -32.0F, -1.0F, 20, 2, 2, 0.0F); + } + + /** + * Renders the banner model in. + */ + public void renderBanner() + { + this.bannerSlate.rotationPointY = -32.0F; + this.bannerSlate.render(0.0625F); + this.bannerStand.render(0.0625F); + this.bannerTop.render(0.0625F); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelBase.java b/src/minecraft/net/minecraft/client/model/ModelBase.java new file mode 100644 index 0000000..9609491 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelBase.java @@ -0,0 +1,80 @@ +package net.minecraft.client.model; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; +import java.util.Random; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; + +public abstract class ModelBase +{ + public float swingProgress; + public boolean isRiding; + public boolean isChild = true; + public List boxList = Lists.newArrayList(); + private Map modelTextureMap = Maps.newHashMap(); + public int textureWidth = 64; + public int textureHeight = 32; + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + } + + public ModelRenderer getRandomModelBox(Random rand) + { + return (ModelRenderer)this.boxList.get(rand.nextInt(this.boxList.size())); + } + + protected void setTextureOffset(String partName, int x, int y) + { + this.modelTextureMap.put(partName, new TextureOffset(x, y)); + } + + public TextureOffset getTextureOffset(String partName) + { + return (TextureOffset)this.modelTextureMap.get(partName); + } + + /** + * Copies the angles from one object to another. This is used when objects should stay aligned with each other, like + * the hair over a players head. + */ + public static void copyModelAngles(ModelRenderer source, ModelRenderer dest) + { + dest.rotateAngleX = source.rotateAngleX; + dest.rotateAngleY = source.rotateAngleY; + dest.rotateAngleZ = source.rotateAngleZ; + dest.rotationPointX = source.rotationPointX; + dest.rotationPointY = source.rotationPointY; + dest.rotationPointZ = source.rotationPointZ; + } + + public void setModelAttributes(ModelBase model) + { + this.swingProgress = model.swingProgress; + this.isRiding = model.isRiding; + this.isChild = model.isChild; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelBat.java b/src/minecraft/net/minecraft/client/model/ModelBat.java new file mode 100644 index 0000000..faf1360 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelBat.java @@ -0,0 +1,111 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.util.MathHelper; + +public class ModelBat extends ModelBase +{ + private ModelRenderer batHead; + + /** The body box of the bat model. */ + private ModelRenderer batBody; + + /** The inner right wing box of the bat model. */ + private ModelRenderer batRightWing; + + /** The inner left wing box of the bat model. */ + private ModelRenderer batLeftWing; + + /** The outer right wing box of the bat model. */ + private ModelRenderer batOuterRightWing; + + /** The outer left wing box of the bat model. */ + private ModelRenderer batOuterLeftWing; + + public ModelBat() + { + this.textureWidth = 64; + this.textureHeight = 64; + this.batHead = new ModelRenderer(this, 0, 0); + this.batHead.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6); + ModelRenderer modelrenderer = new ModelRenderer(this, 24, 0); + modelrenderer.addBox(-4.0F, -6.0F, -2.0F, 3, 4, 1); + this.batHead.addChild(modelrenderer); + ModelRenderer modelrenderer1 = new ModelRenderer(this, 24, 0); + modelrenderer1.mirror = true; + modelrenderer1.addBox(1.0F, -6.0F, -2.0F, 3, 4, 1); + this.batHead.addChild(modelrenderer1); + this.batBody = new ModelRenderer(this, 0, 16); + this.batBody.addBox(-3.0F, 4.0F, -3.0F, 6, 12, 6); + this.batBody.setTextureOffset(0, 34).addBox(-5.0F, 16.0F, 0.0F, 10, 6, 1); + this.batRightWing = new ModelRenderer(this, 42, 0); + this.batRightWing.addBox(-12.0F, 1.0F, 1.5F, 10, 16, 1); + this.batOuterRightWing = new ModelRenderer(this, 24, 16); + this.batOuterRightWing.setRotationPoint(-12.0F, 1.0F, 1.5F); + this.batOuterRightWing.addBox(-8.0F, 1.0F, 0.0F, 8, 12, 1); + this.batLeftWing = new ModelRenderer(this, 42, 0); + this.batLeftWing.mirror = true; + this.batLeftWing.addBox(2.0F, 1.0F, 1.5F, 10, 16, 1); + this.batOuterLeftWing = new ModelRenderer(this, 24, 16); + this.batOuterLeftWing.mirror = true; + this.batOuterLeftWing.setRotationPoint(12.0F, 1.0F, 1.5F); + this.batOuterLeftWing.addBox(0.0F, 1.0F, 0.0F, 8, 12, 1); + this.batBody.addChild(this.batRightWing); + this.batBody.addChild(this.batLeftWing); + this.batRightWing.addChild(this.batOuterRightWing); + this.batLeftWing.addChild(this.batOuterLeftWing); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.batHead.render(scale); + this.batBody.render(scale); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + if (((EntityBat)entityIn).getIsBatHanging()) + { + float f = (180F / (float)Math.PI); + this.batHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.batHead.rotateAngleY = (float)Math.PI - p_78087_4_ / (180F / (float)Math.PI); + this.batHead.rotateAngleZ = (float)Math.PI; + this.batHead.setRotationPoint(0.0F, -2.0F, 0.0F); + this.batRightWing.setRotationPoint(-3.0F, 0.0F, 3.0F); + this.batLeftWing.setRotationPoint(3.0F, 0.0F, 3.0F); + this.batBody.rotateAngleX = (float)Math.PI; + this.batRightWing.rotateAngleX = -0.15707964F; + this.batRightWing.rotateAngleY = -((float)Math.PI * 2F / 5F); + this.batOuterRightWing.rotateAngleY = -1.7278761F; + this.batLeftWing.rotateAngleX = this.batRightWing.rotateAngleX; + this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; + this.batOuterLeftWing.rotateAngleY = -this.batOuterRightWing.rotateAngleY; + } + else + { + float f1 = (180F / (float)Math.PI); + this.batHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.batHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.batHead.rotateAngleZ = 0.0F; + this.batHead.setRotationPoint(0.0F, 0.0F, 0.0F); + this.batRightWing.setRotationPoint(0.0F, 0.0F, 0.0F); + this.batLeftWing.setRotationPoint(0.0F, 0.0F, 0.0F); + this.batBody.rotateAngleX = ((float)Math.PI / 4F) + MathHelper.cos(p_78087_3_ * 0.1F) * 0.15F; + this.batBody.rotateAngleY = 0.0F; + this.batRightWing.rotateAngleY = MathHelper.cos(p_78087_3_ * 1.3F) * (float)Math.PI * 0.25F; + this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; + this.batOuterRightWing.rotateAngleY = this.batRightWing.rotateAngleY * 0.5F; + this.batOuterLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY * 0.5F; + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelBiped.java b/src/minecraft/net/minecraft/client/model/ModelBiped.java new file mode 100644 index 0000000..4c05563 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelBiped.java @@ -0,0 +1,276 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelBiped extends ModelBase +{ + public ModelRenderer bipedHead; + + /** The Biped's Headwear. Used for the outer layer of player skins. */ + public ModelRenderer bipedHeadwear; + public ModelRenderer bipedBody; + + /** The Biped's Right Arm */ + public ModelRenderer bipedRightArm; + + /** The Biped's Left Arm */ + public ModelRenderer bipedLeftArm; + + /** The Biped's Right Leg */ + public ModelRenderer bipedRightLeg; + + /** The Biped's Left Leg */ + public ModelRenderer bipedLeftLeg; + + /** + * Records whether the model should be rendered holding an item in the left hand, and if that item is a block. + */ + public int heldItemLeft; + + /** + * Records whether the model should be rendered holding an item in the right hand, and if that item is a block. + */ + public int heldItemRight; + public boolean isSneak; + + /** Records whether the model should be rendered aiming a bow. */ + public boolean aimedBow; + + public ModelBiped() + { + this(0.0F); + } + + public ModelBiped(float modelSize) + { + this(modelSize, 0.0F, 64, 32); + } + + public ModelBiped(float modelSize, float p_i1149_2_, int textureWidthIn, int textureHeightIn) + { + this.textureWidth = textureWidthIn; + this.textureHeight = textureHeightIn; + this.bipedHead = new ModelRenderer(this, 0, 0); + this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, modelSize); + this.bipedHead.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); + this.bipedHeadwear = new ModelRenderer(this, 32, 0); + this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, modelSize + 0.5F); + this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); + this.bipedBody = new ModelRenderer(this, 16, 16); + this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, modelSize); + this.bipedBody.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F); + this.bipedRightArm = new ModelRenderer(this, 40, 16); + this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, modelSize); + this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + p_i1149_2_, 0.0F); + this.bipedLeftArm = new ModelRenderer(this, 40, 16); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, modelSize); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + p_i1149_2_, 0.0F); + this.bipedRightLeg = new ModelRenderer(this, 0, 16); + this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, modelSize); + this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + p_i1149_2_, 0.0F); + this.bipedLeftLeg = new ModelRenderer(this, 0, 16); + this.bipedLeftLeg.mirror = true; + this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, modelSize); + this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + p_i1149_2_, 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + GlStateManager.pushMatrix(); + + if (this.isChild) + { + float f = 2.0F; + GlStateManager.scale(1.5F / f, 1.5F / f, 1.5F / f); + GlStateManager.translate(0.0F, 16.0F * scale, 0.0F); + this.bipedHead.render(scale); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f); + GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); + this.bipedBody.render(scale); + this.bipedRightArm.render(scale); + this.bipedLeftArm.render(scale); + this.bipedRightLeg.render(scale); + this.bipedLeftLeg.render(scale); + this.bipedHeadwear.render(scale); + } + else + { + if (entityIn.isSneaking()) + { + GlStateManager.translate(0.0F, 0.2F, 0.0F); + } + + this.bipedHead.render(scale); + this.bipedBody.render(scale); + this.bipedRightArm.render(scale); + this.bipedLeftArm.render(scale); + this.bipedRightLeg.render(scale); + this.bipedLeftLeg.render(scale); + this.bipedHeadwear.render(scale); + } + + GlStateManager.popMatrix(); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + this.bipedHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.bipedHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.bipedRightArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 2.0F * p_78087_2_ * 0.5F; + this.bipedLeftArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 2.0F * p_78087_2_ * 0.5F; + this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleZ = 0.0F; + this.bipedRightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_; + this.bipedLeftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_; + this.bipedRightLeg.rotateAngleY = 0.0F; + this.bipedLeftLeg.rotateAngleY = 0.0F; + + if (this.isRiding) + { + this.bipedRightArm.rotateAngleX += -((float)Math.PI / 5F); + this.bipedLeftArm.rotateAngleX += -((float)Math.PI / 5F); + this.bipedRightLeg.rotateAngleX = -((float)Math.PI * 2F / 5F); + this.bipedLeftLeg.rotateAngleX = -((float)Math.PI * 2F / 5F); + this.bipedRightLeg.rotateAngleY = ((float)Math.PI / 10F); + this.bipedLeftLeg.rotateAngleY = -((float)Math.PI / 10F); + } + + if (this.heldItemLeft != 0) + { + this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemLeft; + } + + this.bipedRightArm.rotateAngleY = 0.0F; + this.bipedRightArm.rotateAngleZ = 0.0F; + + switch (this.heldItemRight) + { + case 0: + case 2: + default: + break; + + case 1: + this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight; + break; + + case 3: + this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight; + this.bipedRightArm.rotateAngleY = -0.5235988F; + } + + this.bipedLeftArm.rotateAngleY = 0.0F; + + if (this.swingProgress > -9990.0F) + { + float f = this.swingProgress; + this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f) * (float)Math.PI * 2.0F) * 0.2F; + this.bipedRightArm.rotationPointZ = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedRightArm.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedLeftArm.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY; + this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY; + this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY; + f = 1.0F - this.swingProgress; + f = f * f; + f = f * f; + f = 1.0F - f; + float f1 = MathHelper.sin(f * (float)Math.PI); + float f2 = MathHelper.sin(this.swingProgress * (float)Math.PI) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F; + this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX - ((double)f1 * 1.2D + (double)f2)); + this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F; + this.bipedRightArm.rotateAngleZ += MathHelper.sin(this.swingProgress * (float)Math.PI) * -0.4F; + } + + if (this.isSneak) + { + this.bipedBody.rotateAngleX = 0.5F; + this.bipedRightArm.rotateAngleX += 0.4F; + this.bipedLeftArm.rotateAngleX += 0.4F; + this.bipedRightLeg.rotationPointZ = 4.0F; + this.bipedLeftLeg.rotationPointZ = 4.0F; + this.bipedRightLeg.rotationPointY = 9.0F; + this.bipedLeftLeg.rotationPointY = 9.0F; + this.bipedHead.rotationPointY = 1.0F; + } + else + { + this.bipedBody.rotateAngleX = 0.0F; + this.bipedRightLeg.rotationPointZ = 0.1F; + this.bipedLeftLeg.rotationPointZ = 0.1F; + this.bipedRightLeg.rotationPointY = 12.0F; + this.bipedLeftLeg.rotationPointY = 12.0F; + this.bipedHead.rotationPointY = 0.0F; + } + + this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; + + if (this.aimedBow) + { + float f3 = 0.0F; + float f4 = 0.0F; + this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleZ = 0.0F; + this.bipedRightArm.rotateAngleY = -(0.1F - f3 * 0.6F) + this.bipedHead.rotateAngleY; + this.bipedLeftArm.rotateAngleY = 0.1F - f3 * 0.6F + this.bipedHead.rotateAngleY + 0.4F; + this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX; + this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX; + this.bipedRightArm.rotateAngleX -= f3 * 1.2F - f4 * 0.4F; + this.bipedLeftArm.rotateAngleX -= f3 * 1.2F - f4 * 0.4F; + this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; + } + + copyModelAngles(this.bipedHead, this.bipedHeadwear); + } + + public void setModelAttributes(ModelBase model) + { + super.setModelAttributes(model); + + if (model instanceof ModelBiped) + { + ModelBiped modelbiped = (ModelBiped)model; + this.heldItemLeft = modelbiped.heldItemLeft; + this.heldItemRight = modelbiped.heldItemRight; + this.isSneak = modelbiped.isSneak; + this.aimedBow = modelbiped.aimedBow; + } + } + + public void setInvisible(boolean invisible) + { + this.bipedHead.showModel = invisible; + this.bipedHeadwear.showModel = invisible; + this.bipedBody.showModel = invisible; + this.bipedRightArm.showModel = invisible; + this.bipedLeftArm.showModel = invisible; + this.bipedRightLeg.showModel = invisible; + this.bipedLeftLeg.showModel = invisible; + } + + public void postRenderArm(float scale) + { + this.bipedRightArm.postRender(scale); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelBlaze.java b/src/minecraft/net/minecraft/client/model/ModelBlaze.java new file mode 100644 index 0000000..6bbfc27 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelBlaze.java @@ -0,0 +1,78 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelBlaze extends ModelBase +{ + /** The sticks that fly around the Blaze. */ + private ModelRenderer[] blazeSticks = new ModelRenderer[12]; + private ModelRenderer blazeHead; + + public ModelBlaze() + { + for (int i = 0; i < this.blazeSticks.length; ++i) + { + this.blazeSticks[i] = new ModelRenderer(this, 0, 16); + this.blazeSticks[i].addBox(0.0F, 0.0F, 0.0F, 2, 8, 2); + } + + this.blazeHead = new ModelRenderer(this, 0, 0); + this.blazeHead.addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.blazeHead.render(scale); + + for (int i = 0; i < this.blazeSticks.length; ++i) + { + this.blazeSticks[i].render(scale); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + float f = p_78087_3_ * (float)Math.PI * -0.1F; + + for (int i = 0; i < 4; ++i) + { + this.blazeSticks[i].rotationPointY = -2.0F + MathHelper.cos(((float)(i * 2) + p_78087_3_) * 0.25F); + this.blazeSticks[i].rotationPointX = MathHelper.cos(f) * 9.0F; + this.blazeSticks[i].rotationPointZ = MathHelper.sin(f) * 9.0F; + ++f; + } + + f = ((float)Math.PI / 4F) + p_78087_3_ * (float)Math.PI * 0.03F; + + for (int j = 4; j < 8; ++j) + { + this.blazeSticks[j].rotationPointY = 2.0F + MathHelper.cos(((float)(j * 2) + p_78087_3_) * 0.25F); + this.blazeSticks[j].rotationPointX = MathHelper.cos(f) * 7.0F; + this.blazeSticks[j].rotationPointZ = MathHelper.sin(f) * 7.0F; + ++f; + } + + f = 0.47123894F + p_78087_3_ * (float)Math.PI * -0.05F; + + for (int k = 8; k < 12; ++k) + { + this.blazeSticks[k].rotationPointY = 11.0F + MathHelper.cos(((float)k * 1.5F + p_78087_3_) * 0.5F); + this.blazeSticks[k].rotationPointX = MathHelper.cos(f) * 5.0F; + this.blazeSticks[k].rotationPointZ = MathHelper.sin(f) * 5.0F; + ++f; + } + + this.blazeHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.blazeHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelBoat.java b/src/minecraft/net/minecraft/client/model/ModelBoat.java new file mode 100644 index 0000000..c67c7c1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelBoat.java @@ -0,0 +1,46 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; + +public class ModelBoat extends ModelBase +{ + public ModelRenderer[] boatSides = new ModelRenderer[5]; + + public ModelBoat() + { + this.boatSides[0] = new ModelRenderer(this, 0, 8); + this.boatSides[1] = new ModelRenderer(this, 0, 0); + this.boatSides[2] = new ModelRenderer(this, 0, 0); + this.boatSides[3] = new ModelRenderer(this, 0, 0); + this.boatSides[4] = new ModelRenderer(this, 0, 0); + int i = 24; + int j = 6; + int k = 20; + int l = 4; + this.boatSides[0].addBox((float)(-i / 2), (float)(-k / 2 + 2), -3.0F, i, k - 4, 4, 0.0F); + this.boatSides[0].setRotationPoint(0.0F, (float)l, 0.0F); + this.boatSides[1].addBox((float)(-i / 2 + 2), (float)(-j - 1), -1.0F, i - 4, j, 2, 0.0F); + this.boatSides[1].setRotationPoint((float)(-i / 2 + 1), (float)l, 0.0F); + this.boatSides[2].addBox((float)(-i / 2 + 2), (float)(-j - 1), -1.0F, i - 4, j, 2, 0.0F); + this.boatSides[2].setRotationPoint((float)(i / 2 - 1), (float)l, 0.0F); + this.boatSides[3].addBox((float)(-i / 2 + 2), (float)(-j - 1), -1.0F, i - 4, j, 2, 0.0F); + this.boatSides[3].setRotationPoint(0.0F, (float)l, (float)(-k / 2 + 1)); + this.boatSides[4].addBox((float)(-i / 2 + 2), (float)(-j - 1), -1.0F, i - 4, j, 2, 0.0F); + this.boatSides[4].setRotationPoint(0.0F, (float)l, (float)(k / 2 - 1)); + this.boatSides[0].rotateAngleX = ((float)Math.PI / 2F); + this.boatSides[1].rotateAngleY = ((float)Math.PI * 3F / 2F); + this.boatSides[2].rotateAngleY = ((float)Math.PI / 2F); + this.boatSides[3].rotateAngleY = (float)Math.PI; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + for (int i = 0; i < 5; ++i) + { + this.boatSides[i].render(scale); + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelBook.java b/src/minecraft/net/minecraft/client/model/ModelBook.java new file mode 100644 index 0000000..e6bd38b --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelBook.java @@ -0,0 +1,70 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelBook extends ModelBase +{ + /** Right cover renderer (when facing the book) */ + public ModelRenderer coverRight = (new ModelRenderer(this)).setTextureOffset(0, 0).addBox(-6.0F, -5.0F, 0.0F, 6, 10, 0); + + /** Left cover renderer (when facing the book) */ + public ModelRenderer coverLeft = (new ModelRenderer(this)).setTextureOffset(16, 0).addBox(0.0F, -5.0F, 0.0F, 6, 10, 0); + + /** The right pages renderer (when facing the book) */ + public ModelRenderer pagesRight = (new ModelRenderer(this)).setTextureOffset(0, 10).addBox(0.0F, -4.0F, -0.99F, 5, 8, 1); + + /** The left pages renderer (when facing the book) */ + public ModelRenderer pagesLeft = (new ModelRenderer(this)).setTextureOffset(12, 10).addBox(0.0F, -4.0F, -0.01F, 5, 8, 1); + + /** Right cover renderer (when facing the book) */ + public ModelRenderer flippingPageRight = (new ModelRenderer(this)).setTextureOffset(24, 10).addBox(0.0F, -4.0F, 0.0F, 5, 8, 0); + + /** Right cover renderer (when facing the book) */ + public ModelRenderer flippingPageLeft = (new ModelRenderer(this)).setTextureOffset(24, 10).addBox(0.0F, -4.0F, 0.0F, 5, 8, 0); + + /** The renderer of spine of the book */ + public ModelRenderer bookSpine = (new ModelRenderer(this)).setTextureOffset(12, 0).addBox(-1.0F, -5.0F, 0.0F, 2, 10, 0); + + public ModelBook() + { + this.coverRight.setRotationPoint(0.0F, 0.0F, -1.0F); + this.coverLeft.setRotationPoint(0.0F, 0.0F, 1.0F); + this.bookSpine.rotateAngleY = ((float)Math.PI / 2F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.coverRight.render(scale); + this.coverLeft.render(scale); + this.bookSpine.render(scale); + this.pagesRight.render(scale); + this.pagesLeft.render(scale); + this.flippingPageRight.render(scale); + this.flippingPageLeft.render(scale); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + float f = (MathHelper.sin(p_78087_1_ * 0.02F) * 0.1F + 1.25F) * p_78087_4_; + this.coverRight.rotateAngleY = (float)Math.PI + f; + this.coverLeft.rotateAngleY = -f; + this.pagesRight.rotateAngleY = f; + this.pagesLeft.rotateAngleY = -f; + this.flippingPageRight.rotateAngleY = f - f * 2.0F * p_78087_2_; + this.flippingPageLeft.rotateAngleY = f - f * 2.0F * p_78087_3_; + this.pagesRight.rotationPointX = MathHelper.sin(f); + this.pagesLeft.rotationPointX = MathHelper.sin(f); + this.flippingPageRight.rotationPointX = MathHelper.sin(f); + this.flippingPageLeft.rotationPointX = MathHelper.sin(f); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelBox.java b/src/minecraft/net/minecraft/client/model/ModelBox.java new file mode 100644 index 0000000..0ed1ad4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelBox.java @@ -0,0 +1,111 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.WorldRenderer; + +public class ModelBox +{ + /** + * The (x,y,z) vertex positions and (u,v) texture coordinates for each of the 8 points on a cube + */ + private PositionTextureVertex[] vertexPositions; + + /** An array of 6 TexturedQuads, one for each face of a cube */ + private TexturedQuad[] quadList; + + /** X vertex coordinate of lower box corner */ + public final float posX1; + + /** Y vertex coordinate of lower box corner */ + public final float posY1; + + /** Z vertex coordinate of lower box corner */ + public final float posZ1; + + /** X vertex coordinate of upper box corner */ + public final float posX2; + + /** Y vertex coordinate of upper box corner */ + public final float posY2; + + /** Z vertex coordinate of upper box corner */ + public final float posZ2; + public String boxName; + + public ModelBox(ModelRenderer renderer, int p_i46359_2_, int p_i46359_3_, float p_i46359_4_, float p_i46359_5_, float p_i46359_6_, int p_i46359_7_, int p_i46359_8_, int p_i46359_9_, float p_i46359_10_) + { + this(renderer, p_i46359_2_, p_i46359_3_, p_i46359_4_, p_i46359_5_, p_i46359_6_, p_i46359_7_, p_i46359_8_, p_i46359_9_, p_i46359_10_, renderer.mirror); + } + + public ModelBox(ModelRenderer renderer, int textureX, int textureY, float p_i46301_4_, float p_i46301_5_, float p_i46301_6_, int p_i46301_7_, int p_i46301_8_, int p_i46301_9_, float p_i46301_10_, boolean p_i46301_11_) + { + this.posX1 = p_i46301_4_; + this.posY1 = p_i46301_5_; + this.posZ1 = p_i46301_6_; + this.posX2 = p_i46301_4_ + (float)p_i46301_7_; + this.posY2 = p_i46301_5_ + (float)p_i46301_8_; + this.posZ2 = p_i46301_6_ + (float)p_i46301_9_; + this.vertexPositions = new PositionTextureVertex[8]; + this.quadList = new TexturedQuad[6]; + float f = p_i46301_4_ + (float)p_i46301_7_; + float f1 = p_i46301_5_ + (float)p_i46301_8_; + float f2 = p_i46301_6_ + (float)p_i46301_9_; + p_i46301_4_ = p_i46301_4_ - p_i46301_10_; + p_i46301_5_ = p_i46301_5_ - p_i46301_10_; + p_i46301_6_ = p_i46301_6_ - p_i46301_10_; + f = f + p_i46301_10_; + f1 = f1 + p_i46301_10_; + f2 = f2 + p_i46301_10_; + + if (p_i46301_11_) + { + float f3 = f; + f = p_i46301_4_; + p_i46301_4_ = f3; + } + + PositionTextureVertex positiontexturevertex7 = new PositionTextureVertex(p_i46301_4_, p_i46301_5_, p_i46301_6_, 0.0F, 0.0F); + PositionTextureVertex positiontexturevertex = new PositionTextureVertex(f, p_i46301_5_, p_i46301_6_, 0.0F, 8.0F); + PositionTextureVertex positiontexturevertex1 = new PositionTextureVertex(f, f1, p_i46301_6_, 8.0F, 8.0F); + PositionTextureVertex positiontexturevertex2 = new PositionTextureVertex(p_i46301_4_, f1, p_i46301_6_, 8.0F, 0.0F); + PositionTextureVertex positiontexturevertex3 = new PositionTextureVertex(p_i46301_4_, p_i46301_5_, f2, 0.0F, 0.0F); + PositionTextureVertex positiontexturevertex4 = new PositionTextureVertex(f, p_i46301_5_, f2, 0.0F, 8.0F); + PositionTextureVertex positiontexturevertex5 = new PositionTextureVertex(f, f1, f2, 8.0F, 8.0F); + PositionTextureVertex positiontexturevertex6 = new PositionTextureVertex(p_i46301_4_, f1, f2, 8.0F, 0.0F); + this.vertexPositions[0] = positiontexturevertex7; + this.vertexPositions[1] = positiontexturevertex; + this.vertexPositions[2] = positiontexturevertex1; + this.vertexPositions[3] = positiontexturevertex2; + this.vertexPositions[4] = positiontexturevertex3; + this.vertexPositions[5] = positiontexturevertex4; + this.vertexPositions[6] = positiontexturevertex5; + this.vertexPositions[7] = positiontexturevertex6; + this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex4, positiontexturevertex, positiontexturevertex1, positiontexturevertex5}, textureX + p_i46301_9_ + p_i46301_7_, textureY + p_i46301_9_, textureX + p_i46301_9_ + p_i46301_7_ + p_i46301_9_, textureY + p_i46301_9_ + p_i46301_8_, renderer.textureWidth, renderer.textureHeight); + this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex7, positiontexturevertex3, positiontexturevertex6, positiontexturevertex2}, textureX, textureY + p_i46301_9_, textureX + p_i46301_9_, textureY + p_i46301_9_ + p_i46301_8_, renderer.textureWidth, renderer.textureHeight); + this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex4, positiontexturevertex3, positiontexturevertex7, positiontexturevertex}, textureX + p_i46301_9_, textureY, textureX + p_i46301_9_ + p_i46301_7_, textureY + p_i46301_9_, renderer.textureWidth, renderer.textureHeight); + this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex1, positiontexturevertex2, positiontexturevertex6, positiontexturevertex5}, textureX + p_i46301_9_ + p_i46301_7_, textureY + p_i46301_9_, textureX + p_i46301_9_ + p_i46301_7_ + p_i46301_7_, textureY, renderer.textureWidth, renderer.textureHeight); + this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex, positiontexturevertex7, positiontexturevertex2, positiontexturevertex1}, textureX + p_i46301_9_, textureY + p_i46301_9_, textureX + p_i46301_9_ + p_i46301_7_, textureY + p_i46301_9_ + p_i46301_8_, renderer.textureWidth, renderer.textureHeight); + this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex3, positiontexturevertex4, positiontexturevertex5, positiontexturevertex6}, textureX + p_i46301_9_ + p_i46301_7_ + p_i46301_9_, textureY + p_i46301_9_, textureX + p_i46301_9_ + p_i46301_7_ + p_i46301_9_ + p_i46301_7_, textureY + p_i46301_9_ + p_i46301_8_, renderer.textureWidth, renderer.textureHeight); + + if (p_i46301_11_) + { + for (int i = 0; i < this.quadList.length; ++i) + { + this.quadList[i].flipFace(); + } + } + } + + public void render(WorldRenderer renderer, float scale) + { + for (int i = 0; i < this.quadList.length; ++i) + { + this.quadList[i].draw(renderer, scale); + } + } + + public ModelBox setBoxName(String name) + { + this.boxName = name; + return this; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelChest.java b/src/minecraft/net/minecraft/client/model/ModelChest.java new file mode 100644 index 0000000..d696245 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelChest.java @@ -0,0 +1,42 @@ +package net.minecraft.client.model; + +public class ModelChest extends ModelBase +{ + /** The chest lid in the chest's model. */ + public ModelRenderer chestLid = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); + + /** The model of the bottom of the chest. */ + public ModelRenderer chestBelow; + + /** The chest's knob in the chest model. */ + public ModelRenderer chestKnob; + + public ModelChest() + { + this.chestLid.addBox(0.0F, -5.0F, -14.0F, 14, 5, 14, 0.0F); + this.chestLid.rotationPointX = 1.0F; + this.chestLid.rotationPointY = 7.0F; + this.chestLid.rotationPointZ = 15.0F; + this.chestKnob = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); + this.chestKnob.addBox(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F); + this.chestKnob.rotationPointX = 8.0F; + this.chestKnob.rotationPointY = 7.0F; + this.chestKnob.rotationPointZ = 15.0F; + this.chestBelow = (new ModelRenderer(this, 0, 19)).setTextureSize(64, 64); + this.chestBelow.addBox(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F); + this.chestBelow.rotationPointX = 1.0F; + this.chestBelow.rotationPointY = 6.0F; + this.chestBelow.rotationPointZ = 1.0F; + } + + /** + * This method renders out all parts of the chest model. + */ + public void renderAll() + { + this.chestKnob.rotateAngleX = this.chestLid.rotateAngleX; + this.chestLid.render(0.0625F); + this.chestKnob.render(0.0625F); + this.chestBelow.render(0.0625F); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelChicken.java b/src/minecraft/net/minecraft/client/model/ModelChicken.java new file mode 100644 index 0000000..fe06c94 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelChicken.java @@ -0,0 +1,105 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelChicken extends ModelBase +{ + public ModelRenderer head; + public ModelRenderer body; + public ModelRenderer rightLeg; + public ModelRenderer leftLeg; + public ModelRenderer rightWing; + public ModelRenderer leftWing; + public ModelRenderer bill; + public ModelRenderer chin; + + public ModelChicken() + { + int i = 16; + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-2.0F, -6.0F, -2.0F, 4, 6, 3, 0.0F); + this.head.setRotationPoint(0.0F, (float)(-1 + i), -4.0F); + this.bill = new ModelRenderer(this, 14, 0); + this.bill.addBox(-2.0F, -4.0F, -4.0F, 4, 2, 2, 0.0F); + this.bill.setRotationPoint(0.0F, (float)(-1 + i), -4.0F); + this.chin = new ModelRenderer(this, 14, 4); + this.chin.addBox(-1.0F, -2.0F, -3.0F, 2, 2, 2, 0.0F); + this.chin.setRotationPoint(0.0F, (float)(-1 + i), -4.0F); + this.body = new ModelRenderer(this, 0, 9); + this.body.addBox(-3.0F, -4.0F, -3.0F, 6, 8, 6, 0.0F); + this.body.setRotationPoint(0.0F, (float)i, 0.0F); + this.rightLeg = new ModelRenderer(this, 26, 0); + this.rightLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3); + this.rightLeg.setRotationPoint(-2.0F, (float)(3 + i), 1.0F); + this.leftLeg = new ModelRenderer(this, 26, 0); + this.leftLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3); + this.leftLeg.setRotationPoint(1.0F, (float)(3 + i), 1.0F); + this.rightWing = new ModelRenderer(this, 24, 13); + this.rightWing.addBox(0.0F, 0.0F, -3.0F, 1, 4, 6); + this.rightWing.setRotationPoint(-4.0F, (float)(-3 + i), 0.0F); + this.leftWing = new ModelRenderer(this, 24, 13); + this.leftWing.addBox(-1.0F, 0.0F, -3.0F, 1, 4, 6); + this.leftWing.setRotationPoint(4.0F, (float)(-3 + i), 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + + if (this.isChild) + { + float f = 2.0F; + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 5.0F * scale, 2.0F * scale); + this.head.render(scale); + this.bill.render(scale); + this.chin.render(scale); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f); + GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); + this.body.render(scale); + this.rightLeg.render(scale); + this.leftLeg.render(scale); + this.rightWing.render(scale); + this.leftWing.render(scale); + GlStateManager.popMatrix(); + } + else + { + this.head.render(scale); + this.bill.render(scale); + this.chin.render(scale); + this.body.render(scale); + this.rightLeg.render(scale); + this.leftLeg.render(scale); + this.rightWing.render(scale); + this.leftWing.render(scale); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + this.head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.bill.rotateAngleX = this.head.rotateAngleX; + this.bill.rotateAngleY = this.head.rotateAngleY; + this.chin.rotateAngleX = this.head.rotateAngleX; + this.chin.rotateAngleY = this.head.rotateAngleY; + this.body.rotateAngleX = ((float)Math.PI / 2F); + this.rightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_; + this.leftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_; + this.rightWing.rotateAngleZ = p_78087_3_; + this.leftWing.rotateAngleZ = -p_78087_3_; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelCow.java b/src/minecraft/net/minecraft/client/model/ModelCow.java new file mode 100644 index 0000000..343fec6 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelCow.java @@ -0,0 +1,27 @@ +package net.minecraft.client.model; + +public class ModelCow extends ModelQuadruped +{ + public ModelCow() + { + super(12, 0.0F); + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-4.0F, -4.0F, -6.0F, 8, 8, 6, 0.0F); + this.head.setRotationPoint(0.0F, 4.0F, -8.0F); + this.head.setTextureOffset(22, 0).addBox(-5.0F, -5.0F, -4.0F, 1, 3, 1, 0.0F); + this.head.setTextureOffset(22, 0).addBox(4.0F, -5.0F, -4.0F, 1, 3, 1, 0.0F); + this.body = new ModelRenderer(this, 18, 4); + this.body.addBox(-6.0F, -10.0F, -7.0F, 12, 18, 10, 0.0F); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + this.body.setTextureOffset(52, 0).addBox(-2.0F, 2.0F, -8.0F, 4, 6, 1); + --this.leg1.rotationPointX; + ++this.leg2.rotationPointX; + this.leg1.rotationPointZ += 0.0F; + this.leg2.rotationPointZ += 0.0F; + --this.leg3.rotationPointX; + ++this.leg4.rotationPointX; + --this.leg3.rotationPointZ; + --this.leg4.rotationPointZ; + this.childZOffset += 2.0F; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelCreeper.java b/src/minecraft/net/minecraft/client/model/ModelCreeper.java new file mode 100644 index 0000000..6aa3510 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelCreeper.java @@ -0,0 +1,75 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelCreeper extends ModelBase +{ + public ModelRenderer head; + public ModelRenderer creeperArmor; + public ModelRenderer body; + public ModelRenderer leg1; + public ModelRenderer leg2; + public ModelRenderer leg3; + public ModelRenderer leg4; + + public ModelCreeper() + { + this(0.0F); + } + + public ModelCreeper(float p_i46366_1_) + { + int i = 6; + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, p_i46366_1_); + this.head.setRotationPoint(0.0F, (float)i, 0.0F); + this.creeperArmor = new ModelRenderer(this, 32, 0); + this.creeperArmor.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, p_i46366_1_ + 0.5F); + this.creeperArmor.setRotationPoint(0.0F, (float)i, 0.0F); + this.body = new ModelRenderer(this, 16, 16); + this.body.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, p_i46366_1_); + this.body.setRotationPoint(0.0F, (float)i, 0.0F); + this.leg1 = new ModelRenderer(this, 0, 16); + this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, p_i46366_1_); + this.leg1.setRotationPoint(-2.0F, (float)(12 + i), 4.0F); + this.leg2 = new ModelRenderer(this, 0, 16); + this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, p_i46366_1_); + this.leg2.setRotationPoint(2.0F, (float)(12 + i), 4.0F); + this.leg3 = new ModelRenderer(this, 0, 16); + this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, p_i46366_1_); + this.leg3.setRotationPoint(-2.0F, (float)(12 + i), -4.0F); + this.leg4 = new ModelRenderer(this, 0, 16); + this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, p_i46366_1_); + this.leg4.setRotationPoint(2.0F, (float)(12 + i), -4.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.head.render(scale); + this.body.render(scale); + this.leg1.render(scale); + this.leg2.render(scale); + this.leg3.render(scale); + this.leg4.render(scale); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + this.head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.leg1.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_; + this.leg2.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_; + this.leg3.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_; + this.leg4.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelDragon.java b/src/minecraft/net/minecraft/client/model/ModelDragon.java new file mode 100644 index 0000000..b9bbbae --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelDragon.java @@ -0,0 +1,262 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityDragon; + +public class ModelDragon extends ModelBase +{ + /** The head Model renderer of the dragon */ + private ModelRenderer head; + + /** The spine Model renderer of the dragon */ + private ModelRenderer spine; + + /** The jaw Model renderer of the dragon */ + private ModelRenderer jaw; + + /** The body Model renderer of the dragon */ + private ModelRenderer body; + + /** The rear leg Model renderer of the dragon */ + private ModelRenderer rearLeg; + + /** The front leg Model renderer of the dragon */ + private ModelRenderer frontLeg; + + /** The rear leg tip Model renderer of the dragon */ + private ModelRenderer rearLegTip; + + /** The front leg tip Model renderer of the dragon */ + private ModelRenderer frontLegTip; + + /** The rear foot Model renderer of the dragon */ + private ModelRenderer rearFoot; + + /** The front foot Model renderer of the dragon */ + private ModelRenderer frontFoot; + + /** The wing Model renderer of the dragon */ + private ModelRenderer wing; + + /** The wing tip Model renderer of the dragon */ + private ModelRenderer wingTip; + private float partialTicks; + + public ModelDragon(float p_i46360_1_) + { + this.textureWidth = 256; + this.textureHeight = 256; + this.setTextureOffset("body.body", 0, 0); + this.setTextureOffset("wing.skin", -56, 88); + this.setTextureOffset("wingtip.skin", -56, 144); + this.setTextureOffset("rearleg.main", 0, 0); + this.setTextureOffset("rearfoot.main", 112, 0); + this.setTextureOffset("rearlegtip.main", 196, 0); + this.setTextureOffset("head.upperhead", 112, 30); + this.setTextureOffset("wing.bone", 112, 88); + this.setTextureOffset("head.upperlip", 176, 44); + this.setTextureOffset("jaw.jaw", 176, 65); + this.setTextureOffset("frontleg.main", 112, 104); + this.setTextureOffset("wingtip.bone", 112, 136); + this.setTextureOffset("frontfoot.main", 144, 104); + this.setTextureOffset("neck.box", 192, 104); + this.setTextureOffset("frontlegtip.main", 226, 138); + this.setTextureOffset("body.scale", 220, 53); + this.setTextureOffset("head.scale", 0, 0); + this.setTextureOffset("neck.scale", 48, 0); + this.setTextureOffset("head.nostril", 112, 0); + float f = -16.0F; + this.head = new ModelRenderer(this, "head"); + this.head.addBox("upperlip", -6.0F, -1.0F, -8.0F + f, 12, 5, 16); + this.head.addBox("upperhead", -8.0F, -8.0F, 6.0F + f, 16, 16, 16); + this.head.mirror = true; + this.head.addBox("scale", -5.0F, -12.0F, 12.0F + f, 2, 4, 6); + this.head.addBox("nostril", -5.0F, -3.0F, -6.0F + f, 2, 2, 4); + this.head.mirror = false; + this.head.addBox("scale", 3.0F, -12.0F, 12.0F + f, 2, 4, 6); + this.head.addBox("nostril", 3.0F, -3.0F, -6.0F + f, 2, 2, 4); + this.jaw = new ModelRenderer(this, "jaw"); + this.jaw.setRotationPoint(0.0F, 4.0F, 8.0F + f); + this.jaw.addBox("jaw", -6.0F, 0.0F, -16.0F, 12, 4, 16); + this.head.addChild(this.jaw); + this.spine = new ModelRenderer(this, "neck"); + this.spine.addBox("box", -5.0F, -5.0F, -5.0F, 10, 10, 10); + this.spine.addBox("scale", -1.0F, -9.0F, -3.0F, 2, 4, 6); + this.body = new ModelRenderer(this, "body"); + this.body.setRotationPoint(0.0F, 4.0F, 8.0F); + this.body.addBox("body", -12.0F, 0.0F, -16.0F, 24, 24, 64); + this.body.addBox("scale", -1.0F, -6.0F, -10.0F, 2, 6, 12); + this.body.addBox("scale", -1.0F, -6.0F, 10.0F, 2, 6, 12); + this.body.addBox("scale", -1.0F, -6.0F, 30.0F, 2, 6, 12); + this.wing = new ModelRenderer(this, "wing"); + this.wing.setRotationPoint(-12.0F, 5.0F, 2.0F); + this.wing.addBox("bone", -56.0F, -4.0F, -4.0F, 56, 8, 8); + this.wing.addBox("skin", -56.0F, 0.0F, 2.0F, 56, 0, 56); + this.wingTip = new ModelRenderer(this, "wingtip"); + this.wingTip.setRotationPoint(-56.0F, 0.0F, 0.0F); + this.wingTip.addBox("bone", -56.0F, -2.0F, -2.0F, 56, 4, 4); + this.wingTip.addBox("skin", -56.0F, 0.0F, 2.0F, 56, 0, 56); + this.wing.addChild(this.wingTip); + this.frontLeg = new ModelRenderer(this, "frontleg"); + this.frontLeg.setRotationPoint(-12.0F, 20.0F, 2.0F); + this.frontLeg.addBox("main", -4.0F, -4.0F, -4.0F, 8, 24, 8); + this.frontLegTip = new ModelRenderer(this, "frontlegtip"); + this.frontLegTip.setRotationPoint(0.0F, 20.0F, -1.0F); + this.frontLegTip.addBox("main", -3.0F, -1.0F, -3.0F, 6, 24, 6); + this.frontLeg.addChild(this.frontLegTip); + this.frontFoot = new ModelRenderer(this, "frontfoot"); + this.frontFoot.setRotationPoint(0.0F, 23.0F, 0.0F); + this.frontFoot.addBox("main", -4.0F, 0.0F, -12.0F, 8, 4, 16); + this.frontLegTip.addChild(this.frontFoot); + this.rearLeg = new ModelRenderer(this, "rearleg"); + this.rearLeg.setRotationPoint(-16.0F, 16.0F, 42.0F); + this.rearLeg.addBox("main", -8.0F, -4.0F, -8.0F, 16, 32, 16); + this.rearLegTip = new ModelRenderer(this, "rearlegtip"); + this.rearLegTip.setRotationPoint(0.0F, 32.0F, -4.0F); + this.rearLegTip.addBox("main", -6.0F, -2.0F, 0.0F, 12, 32, 12); + this.rearLeg.addChild(this.rearLegTip); + this.rearFoot = new ModelRenderer(this, "rearfoot"); + this.rearFoot.setRotationPoint(0.0F, 31.0F, 4.0F); + this.rearFoot.addBox("main", -9.0F, 0.0F, -20.0F, 18, 6, 24); + this.rearLegTip.addChild(this.rearFoot); + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + this.partialTicks = partialTickTime; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + GlStateManager.pushMatrix(); + EntityDragon entitydragon = (EntityDragon)entityIn; + float f = entitydragon.prevAnimTime + (entitydragon.animTime - entitydragon.prevAnimTime) * this.partialTicks; + this.jaw.rotateAngleX = (float)(Math.sin((double)(f * (float)Math.PI * 2.0F)) + 1.0D) * 0.2F; + float f1 = (float)(Math.sin((double)(f * (float)Math.PI * 2.0F - 1.0F)) + 1.0D); + f1 = (f1 * f1 * 1.0F + f1 * 2.0F) * 0.05F; + GlStateManager.translate(0.0F, f1 - 2.0F, -3.0F); + GlStateManager.rotate(f1 * 2.0F, 1.0F, 0.0F, 0.0F); + float f2 = -30.0F; + float f4 = 0.0F; + float f5 = 1.5F; + double[] adouble = entitydragon.getMovementOffsets(6, this.partialTicks); + float f6 = this.updateRotations(entitydragon.getMovementOffsets(5, this.partialTicks)[0] - entitydragon.getMovementOffsets(10, this.partialTicks)[0]); + float f7 = this.updateRotations(entitydragon.getMovementOffsets(5, this.partialTicks)[0] + (double)(f6 / 2.0F)); + f2 = f2 + 2.0F; + float f8 = f * (float)Math.PI * 2.0F; + f2 = 20.0F; + float f3 = -12.0F; + + for (int i = 0; i < 5; ++i) + { + double[] adouble1 = entitydragon.getMovementOffsets(5 - i, this.partialTicks); + float f9 = (float)Math.cos((double)((float)i * 0.45F + f8)) * 0.15F; + this.spine.rotateAngleY = this.updateRotations(adouble1[0] - adouble[0]) * (float)Math.PI / 180.0F * f5; + this.spine.rotateAngleX = f9 + (float)(adouble1[1] - adouble[1]) * (float)Math.PI / 180.0F * f5 * 5.0F; + this.spine.rotateAngleZ = -this.updateRotations(adouble1[0] - (double)f7) * (float)Math.PI / 180.0F * f5; + this.spine.rotationPointY = f2; + this.spine.rotationPointZ = f3; + this.spine.rotationPointX = f4; + f2 = (float)((double)f2 + Math.sin((double)this.spine.rotateAngleX) * 10.0D); + f3 = (float)((double)f3 - Math.cos((double)this.spine.rotateAngleY) * Math.cos((double)this.spine.rotateAngleX) * 10.0D); + f4 = (float)((double)f4 - Math.sin((double)this.spine.rotateAngleY) * Math.cos((double)this.spine.rotateAngleX) * 10.0D); + this.spine.render(scale); + } + + this.head.rotationPointY = f2; + this.head.rotationPointZ = f3; + this.head.rotationPointX = f4; + double[] adouble2 = entitydragon.getMovementOffsets(0, this.partialTicks); + this.head.rotateAngleY = this.updateRotations(adouble2[0] - adouble[0]) * (float)Math.PI / 180.0F * 1.0F; + this.head.rotateAngleZ = -this.updateRotations(adouble2[0] - (double)f7) * (float)Math.PI / 180.0F * 1.0F; + this.head.render(scale); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-f6 * f5 * 1.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.translate(0.0F, -1.0F, 0.0F); + this.body.rotateAngleZ = 0.0F; + this.body.render(scale); + + for (int j = 0; j < 2; ++j) + { + GlStateManager.enableCull(); + float f11 = f * (float)Math.PI * 2.0F; + this.wing.rotateAngleX = 0.125F - (float)Math.cos((double)f11) * 0.2F; + this.wing.rotateAngleY = 0.25F; + this.wing.rotateAngleZ = (float)(Math.sin((double)f11) + 0.125D) * 0.8F; + this.wingTip.rotateAngleZ = -((float)(Math.sin((double)(f11 + 2.0F)) + 0.5D)) * 0.75F; + this.rearLeg.rotateAngleX = 1.0F + f1 * 0.1F; + this.rearLegTip.rotateAngleX = 0.5F + f1 * 0.1F; + this.rearFoot.rotateAngleX = 0.75F + f1 * 0.1F; + this.frontLeg.rotateAngleX = 1.3F + f1 * 0.1F; + this.frontLegTip.rotateAngleX = -0.5F - f1 * 0.1F; + this.frontFoot.rotateAngleX = 0.75F + f1 * 0.1F; + this.wing.render(scale); + this.frontLeg.render(scale); + this.rearLeg.render(scale); + GlStateManager.scale(-1.0F, 1.0F, 1.0F); + + if (j == 0) + { + GlStateManager.cullFace(1028); + } + } + + GlStateManager.popMatrix(); + GlStateManager.cullFace(1029); + GlStateManager.disableCull(); + float f10 = -((float)Math.sin((double)(f * (float)Math.PI * 2.0F))) * 0.0F; + f8 = f * (float)Math.PI * 2.0F; + f2 = 10.0F; + f3 = 60.0F; + f4 = 0.0F; + adouble = entitydragon.getMovementOffsets(11, this.partialTicks); + + for (int k = 0; k < 12; ++k) + { + adouble2 = entitydragon.getMovementOffsets(12 + k, this.partialTicks); + f10 = (float)((double)f10 + Math.sin((double)((float)k * 0.45F + f8)) * 0.05000000074505806D); + this.spine.rotateAngleY = (this.updateRotations(adouble2[0] - adouble[0]) * f5 + 180.0F) * (float)Math.PI / 180.0F; + this.spine.rotateAngleX = f10 + (float)(adouble2[1] - adouble[1]) * (float)Math.PI / 180.0F * f5 * 5.0F; + this.spine.rotateAngleZ = this.updateRotations(adouble2[0] - (double)f7) * (float)Math.PI / 180.0F * f5; + this.spine.rotationPointY = f2; + this.spine.rotationPointZ = f3; + this.spine.rotationPointX = f4; + f2 = (float)((double)f2 + Math.sin((double)this.spine.rotateAngleX) * 10.0D); + f3 = (float)((double)f3 - Math.cos((double)this.spine.rotateAngleY) * Math.cos((double)this.spine.rotateAngleX) * 10.0D); + f4 = (float)((double)f4 - Math.sin((double)this.spine.rotateAngleY) * Math.cos((double)this.spine.rotateAngleX) * 10.0D); + this.spine.render(scale); + } + + GlStateManager.popMatrix(); + } + + /** + * Updates the rotations in the parameters for rotations greater than 180 degrees or less than -180 degrees. It adds + * or subtracts 360 degrees, so that the appearance is the same, although the numbers are then simplified to range + * -180 to 180 + */ + private float updateRotations(double p_78214_1_) + { + while (p_78214_1_ >= 180.0D) + { + p_78214_1_ -= 360.0D; + } + + while (p_78214_1_ < -180.0D) + { + p_78214_1_ += 360.0D; + } + + return (float)p_78214_1_; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelEnderCrystal.java b/src/minecraft/net/minecraft/client/model/ModelEnderCrystal.java new file mode 100644 index 0000000..df746de --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelEnderCrystal.java @@ -0,0 +1,59 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; + +public class ModelEnderCrystal extends ModelBase +{ + /** The cube model for the Ender Crystal. */ + private ModelRenderer cube; + + /** The glass model for the Ender Crystal. */ + private ModelRenderer glass = new ModelRenderer(this, "glass"); + + /** The base model for the Ender Crystal. */ + private ModelRenderer base; + + public ModelEnderCrystal(float p_i1170_1_, boolean p_i1170_2_) + { + this.glass.setTextureOffset(0, 0).addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8); + this.cube = new ModelRenderer(this, "cube"); + this.cube.setTextureOffset(32, 0).addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8); + + if (p_i1170_2_) + { + this.base = new ModelRenderer(this, "base"); + this.base.setTextureOffset(0, 16).addBox(-6.0F, 0.0F, -6.0F, 12, 4, 12); + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + GlStateManager.pushMatrix(); + GlStateManager.scale(2.0F, 2.0F, 2.0F); + GlStateManager.translate(0.0F, -0.5F, 0.0F); + + if (this.base != null) + { + this.base.render(scale); + } + + GlStateManager.rotate(p_78088_3_, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.0F, 0.8F + p_78088_4_, 0.0F); + GlStateManager.rotate(60.0F, 0.7071F, 0.0F, 0.7071F); + this.glass.render(scale); + float f = 0.875F; + GlStateManager.scale(f, f, f); + GlStateManager.rotate(60.0F, 0.7071F, 0.0F, 0.7071F); + GlStateManager.rotate(p_78088_3_, 0.0F, 1.0F, 0.0F); + this.glass.render(scale); + GlStateManager.scale(f, f, f); + GlStateManager.rotate(60.0F, 0.7071F, 0.0F, 0.7071F); + GlStateManager.rotate(p_78088_3_, 0.0F, 1.0F, 0.0F); + this.cube.render(scale); + GlStateManager.popMatrix(); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelEnderMite.java b/src/minecraft/net/minecraft/client/model/ModelEnderMite.java new file mode 100644 index 0000000..2944c33 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelEnderMite.java @@ -0,0 +1,57 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelEnderMite extends ModelBase +{ + private static final int[][] field_178716_a = new int[][] {{4, 3, 2}, {6, 4, 5}, {3, 3, 1}, {1, 2, 1}}; + private static final int[][] field_178714_b = new int[][] {{0, 0}, {0, 5}, {0, 14}, {0, 18}}; + private static final int field_178715_c = field_178716_a.length; + private final ModelRenderer[] field_178713_d; + + public ModelEnderMite() + { + this.field_178713_d = new ModelRenderer[field_178715_c]; + float f = -3.5F; + + for (int i = 0; i < this.field_178713_d.length; ++i) + { + this.field_178713_d[i] = new ModelRenderer(this, field_178714_b[i][0], field_178714_b[i][1]); + this.field_178713_d[i].addBox((float)field_178716_a[i][0] * -0.5F, 0.0F, (float)field_178716_a[i][2] * -0.5F, field_178716_a[i][0], field_178716_a[i][1], field_178716_a[i][2]); + this.field_178713_d[i].setRotationPoint(0.0F, (float)(24 - field_178716_a[i][1]), f); + + if (i < this.field_178713_d.length - 1) + { + f += (float)(field_178716_a[i][2] + field_178716_a[i + 1][2]) * 0.5F; + } + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + + for (int i = 0; i < this.field_178713_d.length; ++i) + { + this.field_178713_d[i].render(scale); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + for (int i = 0; i < this.field_178713_d.length; ++i) + { + this.field_178713_d[i].rotateAngleY = MathHelper.cos(p_78087_3_ * 0.9F + (float)i * 0.15F * (float)Math.PI) * (float)Math.PI * 0.01F * (float)(1 + Math.abs(i - 2)); + this.field_178713_d[i].rotationPointX = MathHelper.sin(p_78087_3_ * 0.9F + (float)i * 0.15F * (float)Math.PI) * (float)Math.PI * 0.1F * (float)Math.abs(i - 2); + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelEnderman.java b/src/minecraft/net/minecraft/client/model/ModelEnderman.java new file mode 100644 index 0000000..b046c45 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelEnderman.java @@ -0,0 +1,129 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; + +public class ModelEnderman extends ModelBiped +{ + /** Is the enderman carrying a block? */ + public boolean isCarrying; + + /** Is the enderman attacking an entity? */ + public boolean isAttacking; + + public ModelEnderman(float p_i46305_1_) + { + super(0.0F, -14.0F, 64, 32); + float f = -14.0F; + this.bipedHeadwear = new ModelRenderer(this, 0, 16); + this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, p_i46305_1_ - 0.5F); + this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + f, 0.0F); + this.bipedBody = new ModelRenderer(this, 32, 16); + this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, p_i46305_1_); + this.bipedBody.setRotationPoint(0.0F, 0.0F + f, 0.0F); + this.bipedRightArm = new ModelRenderer(this, 56, 0); + this.bipedRightArm.addBox(-1.0F, -2.0F, -1.0F, 2, 30, 2, p_i46305_1_); + this.bipedRightArm.setRotationPoint(-3.0F, 2.0F + f, 0.0F); + this.bipedLeftArm = new ModelRenderer(this, 56, 0); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1.0F, -2.0F, -1.0F, 2, 30, 2, p_i46305_1_); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + f, 0.0F); + this.bipedRightLeg = new ModelRenderer(this, 56, 0); + this.bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 30, 2, p_i46305_1_); + this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F + f, 0.0F); + this.bipedLeftLeg = new ModelRenderer(this, 56, 0); + this.bipedLeftLeg.mirror = true; + this.bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 30, 2, p_i46305_1_); + this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F + f, 0.0F); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + this.bipedHead.showModel = true; + float f = -14.0F; + this.bipedBody.rotateAngleX = 0.0F; + this.bipedBody.rotationPointY = f; + this.bipedBody.rotationPointZ = -0.0F; + this.bipedRightLeg.rotateAngleX -= 0.0F; + this.bipedLeftLeg.rotateAngleX -= 0.0F; + this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX * 0.5D); + this.bipedLeftArm.rotateAngleX = (float)((double)this.bipedLeftArm.rotateAngleX * 0.5D); + this.bipedRightLeg.rotateAngleX = (float)((double)this.bipedRightLeg.rotateAngleX * 0.5D); + this.bipedLeftLeg.rotateAngleX = (float)((double)this.bipedLeftLeg.rotateAngleX * 0.5D); + float f1 = 0.4F; + + if (this.bipedRightArm.rotateAngleX > f1) + { + this.bipedRightArm.rotateAngleX = f1; + } + + if (this.bipedLeftArm.rotateAngleX > f1) + { + this.bipedLeftArm.rotateAngleX = f1; + } + + if (this.bipedRightArm.rotateAngleX < -f1) + { + this.bipedRightArm.rotateAngleX = -f1; + } + + if (this.bipedLeftArm.rotateAngleX < -f1) + { + this.bipedLeftArm.rotateAngleX = -f1; + } + + if (this.bipedRightLeg.rotateAngleX > f1) + { + this.bipedRightLeg.rotateAngleX = f1; + } + + if (this.bipedLeftLeg.rotateAngleX > f1) + { + this.bipedLeftLeg.rotateAngleX = f1; + } + + if (this.bipedRightLeg.rotateAngleX < -f1) + { + this.bipedRightLeg.rotateAngleX = -f1; + } + + if (this.bipedLeftLeg.rotateAngleX < -f1) + { + this.bipedLeftLeg.rotateAngleX = -f1; + } + + if (this.isCarrying) + { + this.bipedRightArm.rotateAngleX = -0.5F; + this.bipedLeftArm.rotateAngleX = -0.5F; + this.bipedRightArm.rotateAngleZ = 0.05F; + this.bipedLeftArm.rotateAngleZ = -0.05F; + } + + this.bipedRightArm.rotationPointZ = 0.0F; + this.bipedLeftArm.rotationPointZ = 0.0F; + this.bipedRightLeg.rotationPointZ = 0.0F; + this.bipedLeftLeg.rotationPointZ = 0.0F; + this.bipedRightLeg.rotationPointY = 9.0F + f; + this.bipedLeftLeg.rotationPointY = 9.0F + f; + this.bipedHead.rotationPointZ = -0.0F; + this.bipedHead.rotationPointY = f + 1.0F; + this.bipedHeadwear.rotationPointX = this.bipedHead.rotationPointX; + this.bipedHeadwear.rotationPointY = this.bipedHead.rotationPointY; + this.bipedHeadwear.rotationPointZ = this.bipedHead.rotationPointZ; + this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX; + this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY; + this.bipedHeadwear.rotateAngleZ = this.bipedHead.rotateAngleZ; + + if (this.isAttacking) + { + float f2 = 1.0F; + this.bipedHead.rotationPointY -= f2 * 5.0F; + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelGhast.java b/src/minecraft/net/minecraft/client/model/ModelGhast.java new file mode 100644 index 0000000..907d766 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelGhast.java @@ -0,0 +1,64 @@ +package net.minecraft.client.model; + +import java.util.Random; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelGhast extends ModelBase +{ + ModelRenderer body; + ModelRenderer[] tentacles = new ModelRenderer[9]; + + public ModelGhast() + { + int i = -16; + this.body = new ModelRenderer(this, 0, 0); + this.body.addBox(-8.0F, -8.0F, -8.0F, 16, 16, 16); + this.body.rotationPointY += (float)(24 + i); + Random random = new Random(1660L); + + for (int j = 0; j < this.tentacles.length; ++j) + { + this.tentacles[j] = new ModelRenderer(this, 0, 0); + float f = (((float)(j % 3) - (float)(j / 3 % 2) * 0.5F + 0.25F) / 2.0F * 2.0F - 1.0F) * 5.0F; + float f1 = ((float)(j / 3) / 2.0F * 2.0F - 1.0F) * 5.0F; + int k = random.nextInt(7) + 8; + this.tentacles[j].addBox(-1.0F, 0.0F, -1.0F, 2, k, 2); + this.tentacles[j].rotationPointX = f; + this.tentacles[j].rotationPointZ = f1; + this.tentacles[j].rotationPointY = (float)(31 + i); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + for (int i = 0; i < this.tentacles.length; ++i) + { + this.tentacles[i].rotateAngleX = 0.2F * MathHelper.sin(p_78087_3_ * 0.3F + (float)i) + 0.4F; + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.6F, 0.0F); + this.body.render(scale); + + for (ModelRenderer modelrenderer : this.tentacles) + { + modelrenderer.render(scale); + } + + GlStateManager.popMatrix(); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelGuardian.java b/src/minecraft/net/minecraft/client/model/ModelGuardian.java new file mode 100644 index 0000000..6be2dfe --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelGuardian.java @@ -0,0 +1,136 @@ +package net.minecraft.client.model; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.EntityGuardian; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; + +public class ModelGuardian extends ModelBase +{ + private ModelRenderer guardianBody; + private ModelRenderer guardianEye; + private ModelRenderer[] guardianSpines; + private ModelRenderer[] guardianTail; + + public ModelGuardian() + { + this.textureWidth = 64; + this.textureHeight = 64; + this.guardianSpines = new ModelRenderer[12]; + this.guardianBody = new ModelRenderer(this); + this.guardianBody.setTextureOffset(0, 0).addBox(-6.0F, 10.0F, -8.0F, 12, 12, 16); + this.guardianBody.setTextureOffset(0, 28).addBox(-8.0F, 10.0F, -6.0F, 2, 12, 12); + this.guardianBody.setTextureOffset(0, 28).addBox(6.0F, 10.0F, -6.0F, 2, 12, 12, true); + this.guardianBody.setTextureOffset(16, 40).addBox(-6.0F, 8.0F, -6.0F, 12, 2, 12); + this.guardianBody.setTextureOffset(16, 40).addBox(-6.0F, 22.0F, -6.0F, 12, 2, 12); + + for (int i = 0; i < this.guardianSpines.length; ++i) + { + this.guardianSpines[i] = new ModelRenderer(this, 0, 0); + this.guardianSpines[i].addBox(-1.0F, -4.5F, -1.0F, 2, 9, 2); + this.guardianBody.addChild(this.guardianSpines[i]); + } + + this.guardianEye = new ModelRenderer(this, 8, 0); + this.guardianEye.addBox(-1.0F, 15.0F, 0.0F, 2, 2, 1); + this.guardianBody.addChild(this.guardianEye); + this.guardianTail = new ModelRenderer[3]; + this.guardianTail[0] = new ModelRenderer(this, 40, 0); + this.guardianTail[0].addBox(-2.0F, 14.0F, 7.0F, 4, 4, 8); + this.guardianTail[1] = new ModelRenderer(this, 0, 54); + this.guardianTail[1].addBox(0.0F, 14.0F, 0.0F, 3, 3, 7); + this.guardianTail[2] = new ModelRenderer(this); + this.guardianTail[2].setTextureOffset(41, 32).addBox(0.0F, 14.0F, 0.0F, 2, 2, 6); + this.guardianTail[2].setTextureOffset(25, 19).addBox(1.0F, 10.5F, 3.0F, 1, 9, 9); + this.guardianBody.addChild(this.guardianTail[0]); + this.guardianTail[0].addChild(this.guardianTail[1]); + this.guardianTail[1].addChild(this.guardianTail[2]); + } + + public int func_178706_a() + { + return 54; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.guardianBody.render(scale); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + EntityGuardian entityguardian = (EntityGuardian)entityIn; + float f = p_78087_3_ - (float)entityguardian.ticksExisted; + this.guardianBody.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.guardianBody.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + float[] afloat = new float[] {1.75F, 0.25F, 0.0F, 0.0F, 0.5F, 0.5F, 0.5F, 0.5F, 1.25F, 0.75F, 0.0F, 0.0F}; + float[] afloat1 = new float[] {0.0F, 0.0F, 0.0F, 0.0F, 0.25F, 1.75F, 1.25F, 0.75F, 0.0F, 0.0F, 0.0F, 0.0F}; + float[] afloat2 = new float[] {0.0F, 0.0F, 0.25F, 1.75F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.75F, 1.25F}; + float[] afloat3 = new float[] {0.0F, 0.0F, 8.0F, -8.0F, -8.0F, 8.0F, 8.0F, -8.0F, 0.0F, 0.0F, 8.0F, -8.0F}; + float[] afloat4 = new float[] { -8.0F, -8.0F, -8.0F, -8.0F, 0.0F, 0.0F, 0.0F, 0.0F, 8.0F, 8.0F, 8.0F, 8.0F}; + float[] afloat5 = new float[] {8.0F, -8.0F, 0.0F, 0.0F, -8.0F, -8.0F, 8.0F, 8.0F, 8.0F, -8.0F, 0.0F, 0.0F}; + float f1 = (1.0F - entityguardian.func_175469_o(f)) * 0.55F; + + for (int i = 0; i < 12; ++i) + { + this.guardianSpines[i].rotateAngleX = (float)Math.PI * afloat[i]; + this.guardianSpines[i].rotateAngleY = (float)Math.PI * afloat1[i]; + this.guardianSpines[i].rotateAngleZ = (float)Math.PI * afloat2[i]; + this.guardianSpines[i].rotationPointX = afloat3[i] * (1.0F + MathHelper.cos(p_78087_3_ * 1.5F + (float)i) * 0.01F - f1); + this.guardianSpines[i].rotationPointY = 16.0F + afloat4[i] * (1.0F + MathHelper.cos(p_78087_3_ * 1.5F + (float)i) * 0.01F - f1); + this.guardianSpines[i].rotationPointZ = afloat5[i] * (1.0F + MathHelper.cos(p_78087_3_ * 1.5F + (float)i) * 0.01F - f1); + } + + this.guardianEye.rotationPointZ = -8.25F; + Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); + + if (entityguardian.hasTargetedEntity()) + { + entity = entityguardian.getTargetedEntity(); + } + + if (entity != null) + { + Vec3 vec3 = entity.getPositionEyes(0.0F); + Vec3 vec31 = entityIn.getPositionEyes(0.0F); + double d0 = vec3.yCoord - vec31.yCoord; + + if (d0 > 0.0D) + { + this.guardianEye.rotationPointY = 0.0F; + } + else + { + this.guardianEye.rotationPointY = 1.0F; + } + + Vec3 vec32 = entityIn.getLook(0.0F); + vec32 = new Vec3(vec32.xCoord, 0.0D, vec32.zCoord); + Vec3 vec33 = (new Vec3(vec31.xCoord - vec3.xCoord, 0.0D, vec31.zCoord - vec3.zCoord)).normalize().rotateYaw(((float)Math.PI / 2F)); + double d1 = vec32.dotProduct(vec33); + this.guardianEye.rotationPointX = MathHelper.sqrt_float((float)Math.abs(d1)) * 2.0F * (float)Math.signum(d1); + } + + this.guardianEye.showModel = true; + float f2 = entityguardian.func_175471_a(f); + this.guardianTail[0].rotateAngleY = MathHelper.sin(f2) * (float)Math.PI * 0.05F; + this.guardianTail[1].rotateAngleY = MathHelper.sin(f2) * (float)Math.PI * 0.1F; + this.guardianTail[1].rotationPointX = -1.5F; + this.guardianTail[1].rotationPointY = 0.5F; + this.guardianTail[1].rotationPointZ = 14.0F; + this.guardianTail[2].rotateAngleY = MathHelper.sin(f2) * (float)Math.PI * 0.15F; + this.guardianTail[2].rotationPointX = 0.5F; + this.guardianTail[2].rotationPointY = 0.5F; + this.guardianTail[2].rotationPointZ = 6.0F; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelHorse.java b/src/minecraft/net/minecraft/client/model/ModelHorse.java new file mode 100644 index 0000000..daee3bb --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelHorse.java @@ -0,0 +1,573 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.util.MathHelper; + +public class ModelHorse extends ModelBase +{ + private ModelRenderer head; + private ModelRenderer field_178711_b; + private ModelRenderer field_178712_c; + private ModelRenderer horseLeftEar; + private ModelRenderer horseRightEar; + + /** The left ear box for the mule model. */ + private ModelRenderer muleLeftEar; + + /** The right ear box for the mule model. */ + private ModelRenderer muleRightEar; + private ModelRenderer neck; + + /** The box for the horse's ropes on its face. */ + private ModelRenderer horseFaceRopes; + private ModelRenderer mane; + private ModelRenderer body; + private ModelRenderer tailBase; + private ModelRenderer tailMiddle; + private ModelRenderer tailTip; + private ModelRenderer backLeftLeg; + private ModelRenderer backLeftShin; + private ModelRenderer backLeftHoof; + private ModelRenderer backRightLeg; + private ModelRenderer backRightShin; + private ModelRenderer backRightHoof; + private ModelRenderer frontLeftLeg; + private ModelRenderer frontLeftShin; + private ModelRenderer frontLeftHoof; + private ModelRenderer frontRightLeg; + private ModelRenderer frontRightShin; + private ModelRenderer frontRightHoof; + + /** The left chest box on the mule model. */ + private ModelRenderer muleLeftChest; + + /** The right chest box on the mule model. */ + private ModelRenderer muleRightChest; + private ModelRenderer horseSaddleBottom; + private ModelRenderer horseSaddleFront; + private ModelRenderer horseSaddleBack; + private ModelRenderer horseLeftSaddleRope; + private ModelRenderer horseLeftSaddleMetal; + private ModelRenderer horseRightSaddleRope; + private ModelRenderer horseRightSaddleMetal; + + /** The left metal connected to the horse's face ropes. */ + private ModelRenderer horseLeftFaceMetal; + + /** The right metal connected to the horse's face ropes. */ + private ModelRenderer horseRightFaceMetal; + private ModelRenderer horseLeftRein; + private ModelRenderer horseRightRein; + + public ModelHorse() + { + this.textureWidth = 128; + this.textureHeight = 128; + this.body = new ModelRenderer(this, 0, 34); + this.body.addBox(-5.0F, -8.0F, -19.0F, 10, 10, 24); + this.body.setRotationPoint(0.0F, 11.0F, 9.0F); + this.tailBase = new ModelRenderer(this, 44, 0); + this.tailBase.addBox(-1.0F, -1.0F, 0.0F, 2, 2, 3); + this.tailBase.setRotationPoint(0.0F, 3.0F, 14.0F); + this.setBoxRotation(this.tailBase, -1.134464F, 0.0F, 0.0F); + this.tailMiddle = new ModelRenderer(this, 38, 7); + this.tailMiddle.addBox(-1.5F, -2.0F, 3.0F, 3, 4, 7); + this.tailMiddle.setRotationPoint(0.0F, 3.0F, 14.0F); + this.setBoxRotation(this.tailMiddle, -1.134464F, 0.0F, 0.0F); + this.tailTip = new ModelRenderer(this, 24, 3); + this.tailTip.addBox(-1.5F, -4.5F, 9.0F, 3, 4, 7); + this.tailTip.setRotationPoint(0.0F, 3.0F, 14.0F); + this.setBoxRotation(this.tailTip, -1.40215F, 0.0F, 0.0F); + this.backLeftLeg = new ModelRenderer(this, 78, 29); + this.backLeftLeg.addBox(-2.5F, -2.0F, -2.5F, 4, 9, 5); + this.backLeftLeg.setRotationPoint(4.0F, 9.0F, 11.0F); + this.backLeftShin = new ModelRenderer(this, 78, 43); + this.backLeftShin.addBox(-2.0F, 0.0F, -1.5F, 3, 5, 3); + this.backLeftShin.setRotationPoint(4.0F, 16.0F, 11.0F); + this.backLeftHoof = new ModelRenderer(this, 78, 51); + this.backLeftHoof.addBox(-2.5F, 5.1F, -2.0F, 4, 3, 4); + this.backLeftHoof.setRotationPoint(4.0F, 16.0F, 11.0F); + this.backRightLeg = new ModelRenderer(this, 96, 29); + this.backRightLeg.addBox(-1.5F, -2.0F, -2.5F, 4, 9, 5); + this.backRightLeg.setRotationPoint(-4.0F, 9.0F, 11.0F); + this.backRightShin = new ModelRenderer(this, 96, 43); + this.backRightShin.addBox(-1.0F, 0.0F, -1.5F, 3, 5, 3); + this.backRightShin.setRotationPoint(-4.0F, 16.0F, 11.0F); + this.backRightHoof = new ModelRenderer(this, 96, 51); + this.backRightHoof.addBox(-1.5F, 5.1F, -2.0F, 4, 3, 4); + this.backRightHoof.setRotationPoint(-4.0F, 16.0F, 11.0F); + this.frontLeftLeg = new ModelRenderer(this, 44, 29); + this.frontLeftLeg.addBox(-1.9F, -1.0F, -2.1F, 3, 8, 4); + this.frontLeftLeg.setRotationPoint(4.0F, 9.0F, -8.0F); + this.frontLeftShin = new ModelRenderer(this, 44, 41); + this.frontLeftShin.addBox(-1.9F, 0.0F, -1.6F, 3, 5, 3); + this.frontLeftShin.setRotationPoint(4.0F, 16.0F, -8.0F); + this.frontLeftHoof = new ModelRenderer(this, 44, 51); + this.frontLeftHoof.addBox(-2.4F, 5.1F, -2.1F, 4, 3, 4); + this.frontLeftHoof.setRotationPoint(4.0F, 16.0F, -8.0F); + this.frontRightLeg = new ModelRenderer(this, 60, 29); + this.frontRightLeg.addBox(-1.1F, -1.0F, -2.1F, 3, 8, 4); + this.frontRightLeg.setRotationPoint(-4.0F, 9.0F, -8.0F); + this.frontRightShin = new ModelRenderer(this, 60, 41); + this.frontRightShin.addBox(-1.1F, 0.0F, -1.6F, 3, 5, 3); + this.frontRightShin.setRotationPoint(-4.0F, 16.0F, -8.0F); + this.frontRightHoof = new ModelRenderer(this, 60, 51); + this.frontRightHoof.addBox(-1.6F, 5.1F, -2.1F, 4, 3, 4); + this.frontRightHoof.setRotationPoint(-4.0F, 16.0F, -8.0F); + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-2.5F, -10.0F, -1.5F, 5, 5, 7); + this.head.setRotationPoint(0.0F, 4.0F, -10.0F); + this.setBoxRotation(this.head, 0.5235988F, 0.0F, 0.0F); + this.field_178711_b = new ModelRenderer(this, 24, 18); + this.field_178711_b.addBox(-2.0F, -10.0F, -7.0F, 4, 3, 6); + this.field_178711_b.setRotationPoint(0.0F, 3.95F, -10.0F); + this.setBoxRotation(this.field_178711_b, 0.5235988F, 0.0F, 0.0F); + this.field_178712_c = new ModelRenderer(this, 24, 27); + this.field_178712_c.addBox(-2.0F, -7.0F, -6.5F, 4, 2, 5); + this.field_178712_c.setRotationPoint(0.0F, 4.0F, -10.0F); + this.setBoxRotation(this.field_178712_c, 0.5235988F, 0.0F, 0.0F); + this.head.addChild(this.field_178711_b); + this.head.addChild(this.field_178712_c); + this.horseLeftEar = new ModelRenderer(this, 0, 0); + this.horseLeftEar.addBox(0.45F, -12.0F, 4.0F, 2, 3, 1); + this.horseLeftEar.setRotationPoint(0.0F, 4.0F, -10.0F); + this.setBoxRotation(this.horseLeftEar, 0.5235988F, 0.0F, 0.0F); + this.horseRightEar = new ModelRenderer(this, 0, 0); + this.horseRightEar.addBox(-2.45F, -12.0F, 4.0F, 2, 3, 1); + this.horseRightEar.setRotationPoint(0.0F, 4.0F, -10.0F); + this.setBoxRotation(this.horseRightEar, 0.5235988F, 0.0F, 0.0F); + this.muleLeftEar = new ModelRenderer(this, 0, 12); + this.muleLeftEar.addBox(-2.0F, -16.0F, 4.0F, 2, 7, 1); + this.muleLeftEar.setRotationPoint(0.0F, 4.0F, -10.0F); + this.setBoxRotation(this.muleLeftEar, 0.5235988F, 0.0F, 0.2617994F); + this.muleRightEar = new ModelRenderer(this, 0, 12); + this.muleRightEar.addBox(0.0F, -16.0F, 4.0F, 2, 7, 1); + this.muleRightEar.setRotationPoint(0.0F, 4.0F, -10.0F); + this.setBoxRotation(this.muleRightEar, 0.5235988F, 0.0F, -0.2617994F); + this.neck = new ModelRenderer(this, 0, 12); + this.neck.addBox(-2.05F, -9.8F, -2.0F, 4, 14, 8); + this.neck.setRotationPoint(0.0F, 4.0F, -10.0F); + this.setBoxRotation(this.neck, 0.5235988F, 0.0F, 0.0F); + this.muleLeftChest = new ModelRenderer(this, 0, 34); + this.muleLeftChest.addBox(-3.0F, 0.0F, 0.0F, 8, 8, 3); + this.muleLeftChest.setRotationPoint(-7.5F, 3.0F, 10.0F); + this.setBoxRotation(this.muleLeftChest, 0.0F, ((float)Math.PI / 2F), 0.0F); + this.muleRightChest = new ModelRenderer(this, 0, 47); + this.muleRightChest.addBox(-3.0F, 0.0F, 0.0F, 8, 8, 3); + this.muleRightChest.setRotationPoint(4.5F, 3.0F, 10.0F); + this.setBoxRotation(this.muleRightChest, 0.0F, ((float)Math.PI / 2F), 0.0F); + this.horseSaddleBottom = new ModelRenderer(this, 80, 0); + this.horseSaddleBottom.addBox(-5.0F, 0.0F, -3.0F, 10, 1, 8); + this.horseSaddleBottom.setRotationPoint(0.0F, 2.0F, 2.0F); + this.horseSaddleFront = new ModelRenderer(this, 106, 9); + this.horseSaddleFront.addBox(-1.5F, -1.0F, -3.0F, 3, 1, 2); + this.horseSaddleFront.setRotationPoint(0.0F, 2.0F, 2.0F); + this.horseSaddleBack = new ModelRenderer(this, 80, 9); + this.horseSaddleBack.addBox(-4.0F, -1.0F, 3.0F, 8, 1, 2); + this.horseSaddleBack.setRotationPoint(0.0F, 2.0F, 2.0F); + this.horseLeftSaddleMetal = new ModelRenderer(this, 74, 0); + this.horseLeftSaddleMetal.addBox(-0.5F, 6.0F, -1.0F, 1, 2, 2); + this.horseLeftSaddleMetal.setRotationPoint(5.0F, 3.0F, 2.0F); + this.horseLeftSaddleRope = new ModelRenderer(this, 70, 0); + this.horseLeftSaddleRope.addBox(-0.5F, 0.0F, -0.5F, 1, 6, 1); + this.horseLeftSaddleRope.setRotationPoint(5.0F, 3.0F, 2.0F); + this.horseRightSaddleMetal = new ModelRenderer(this, 74, 4); + this.horseRightSaddleMetal.addBox(-0.5F, 6.0F, -1.0F, 1, 2, 2); + this.horseRightSaddleMetal.setRotationPoint(-5.0F, 3.0F, 2.0F); + this.horseRightSaddleRope = new ModelRenderer(this, 80, 0); + this.horseRightSaddleRope.addBox(-0.5F, 0.0F, -0.5F, 1, 6, 1); + this.horseRightSaddleRope.setRotationPoint(-5.0F, 3.0F, 2.0F); + this.horseLeftFaceMetal = new ModelRenderer(this, 74, 13); + this.horseLeftFaceMetal.addBox(1.5F, -8.0F, -4.0F, 1, 2, 2); + this.horseLeftFaceMetal.setRotationPoint(0.0F, 4.0F, -10.0F); + this.setBoxRotation(this.horseLeftFaceMetal, 0.5235988F, 0.0F, 0.0F); + this.horseRightFaceMetal = new ModelRenderer(this, 74, 13); + this.horseRightFaceMetal.addBox(-2.5F, -8.0F, -4.0F, 1, 2, 2); + this.horseRightFaceMetal.setRotationPoint(0.0F, 4.0F, -10.0F); + this.setBoxRotation(this.horseRightFaceMetal, 0.5235988F, 0.0F, 0.0F); + this.horseLeftRein = new ModelRenderer(this, 44, 10); + this.horseLeftRein.addBox(2.6F, -6.0F, -6.0F, 0, 3, 16); + this.horseLeftRein.setRotationPoint(0.0F, 4.0F, -10.0F); + this.horseRightRein = new ModelRenderer(this, 44, 5); + this.horseRightRein.addBox(-2.6F, -6.0F, -6.0F, 0, 3, 16); + this.horseRightRein.setRotationPoint(0.0F, 4.0F, -10.0F); + this.mane = new ModelRenderer(this, 58, 0); + this.mane.addBox(-1.0F, -11.5F, 5.0F, 2, 16, 4); + this.mane.setRotationPoint(0.0F, 4.0F, -10.0F); + this.setBoxRotation(this.mane, 0.5235988F, 0.0F, 0.0F); + this.horseFaceRopes = new ModelRenderer(this, 80, 12); + this.horseFaceRopes.addBox(-2.5F, -10.1F, -7.0F, 5, 5, 12, 0.2F); + this.horseFaceRopes.setRotationPoint(0.0F, 4.0F, -10.0F); + this.setBoxRotation(this.horseFaceRopes, 0.5235988F, 0.0F, 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + EntityHorse entityhorse = (EntityHorse)entityIn; + int i = entityhorse.getHorseType(); + float f = entityhorse.getGrassEatingAmount(0.0F); + boolean flag = entityhorse.isAdultHorse(); + boolean flag1 = flag && entityhorse.isHorseSaddled(); + boolean flag2 = flag && entityhorse.isChested(); + boolean flag3 = i == 1 || i == 2; + float f1 = entityhorse.getHorseSize(); + boolean flag4 = entityhorse.riddenByEntity != null; + + if (flag1) + { + this.horseFaceRopes.render(scale); + this.horseSaddleBottom.render(scale); + this.horseSaddleFront.render(scale); + this.horseSaddleBack.render(scale); + this.horseLeftSaddleRope.render(scale); + this.horseLeftSaddleMetal.render(scale); + this.horseRightSaddleRope.render(scale); + this.horseRightSaddleMetal.render(scale); + this.horseLeftFaceMetal.render(scale); + this.horseRightFaceMetal.render(scale); + + if (flag4) + { + this.horseLeftRein.render(scale); + this.horseRightRein.render(scale); + } + } + + if (!flag) + { + GlStateManager.pushMatrix(); + GlStateManager.scale(f1, 0.5F + f1 * 0.5F, f1); + GlStateManager.translate(0.0F, 0.95F * (1.0F - f1), 0.0F); + } + + this.backLeftLeg.render(scale); + this.backLeftShin.render(scale); + this.backLeftHoof.render(scale); + this.backRightLeg.render(scale); + this.backRightShin.render(scale); + this.backRightHoof.render(scale); + this.frontLeftLeg.render(scale); + this.frontLeftShin.render(scale); + this.frontLeftHoof.render(scale); + this.frontRightLeg.render(scale); + this.frontRightShin.render(scale); + this.frontRightHoof.render(scale); + + if (!flag) + { + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(f1, f1, f1); + GlStateManager.translate(0.0F, 1.35F * (1.0F - f1), 0.0F); + } + + this.body.render(scale); + this.tailBase.render(scale); + this.tailMiddle.render(scale); + this.tailTip.render(scale); + this.neck.render(scale); + this.mane.render(scale); + + if (!flag) + { + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + float f2 = 0.5F + f1 * f1 * 0.5F; + GlStateManager.scale(f2, f2, f2); + + if (f <= 0.0F) + { + GlStateManager.translate(0.0F, 1.35F * (1.0F - f1), 0.0F); + } + else + { + GlStateManager.translate(0.0F, 0.9F * (1.0F - f1) * f + 1.35F * (1.0F - f1) * (1.0F - f), 0.15F * (1.0F - f1) * f); + } + } + + if (flag3) + { + this.muleLeftEar.render(scale); + this.muleRightEar.render(scale); + } + else + { + this.horseLeftEar.render(scale); + this.horseRightEar.render(scale); + } + + this.head.render(scale); + + if (!flag) + { + GlStateManager.popMatrix(); + } + + if (flag2) + { + this.muleLeftChest.render(scale); + this.muleRightChest.render(scale); + } + } + + /** + * Sets the rotations for a ModelRenderer in the ModelHorse class. + */ + private void setBoxRotation(ModelRenderer p_110682_1_, float p_110682_2_, float p_110682_3_, float p_110682_4_) + { + p_110682_1_.rotateAngleX = p_110682_2_; + p_110682_1_.rotateAngleY = p_110682_3_; + p_110682_1_.rotateAngleZ = p_110682_4_; + } + + /** + * Fixes and offsets a rotation in the ModelHorse class. + */ + private float updateHorseRotation(float p_110683_1_, float p_110683_2_, float p_110683_3_) + { + float f; + + for (f = p_110683_2_ - p_110683_1_; f < -180.0F; f += 360.0F) + { + ; + } + + while (f >= 180.0F) + { + f -= 360.0F; + } + + return p_110683_1_ + p_110683_3_ * f; + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime); + float f = this.updateHorseRotation(entitylivingbaseIn.prevRenderYawOffset, entitylivingbaseIn.renderYawOffset, partialTickTime); + float f1 = this.updateHorseRotation(entitylivingbaseIn.prevRotationYawHead, entitylivingbaseIn.rotationYawHead, partialTickTime); + float f2 = entitylivingbaseIn.prevRotationPitch + (entitylivingbaseIn.rotationPitch - entitylivingbaseIn.prevRotationPitch) * partialTickTime; + float f3 = f1 - f; + float f4 = f2 / (180F / (float)Math.PI); + + if (f3 > 20.0F) + { + f3 = 20.0F; + } + + if (f3 < -20.0F) + { + f3 = -20.0F; + } + + if (p_78086_3_ > 0.2F) + { + f4 += MathHelper.cos(p_78086_2_ * 0.4F) * 0.15F * p_78086_3_; + } + + EntityHorse entityhorse = (EntityHorse)entitylivingbaseIn; + float f5 = entityhorse.getGrassEatingAmount(partialTickTime); + float f6 = entityhorse.getRearingAmount(partialTickTime); + float f7 = 1.0F - f6; + float f8 = entityhorse.getMouthOpennessAngle(partialTickTime); + boolean flag = entityhorse.field_110278_bp != 0; + boolean flag1 = entityhorse.isHorseSaddled(); + boolean flag2 = entityhorse.riddenByEntity != null; + float f9 = (float)entitylivingbaseIn.ticksExisted + partialTickTime; + float f10 = MathHelper.cos(p_78086_2_ * 0.6662F + (float)Math.PI); + float f11 = f10 * 0.8F * p_78086_3_; + this.head.rotationPointY = 4.0F; + this.head.rotationPointZ = -10.0F; + this.tailBase.rotationPointY = 3.0F; + this.tailMiddle.rotationPointZ = 14.0F; + this.muleRightChest.rotationPointY = 3.0F; + this.muleRightChest.rotationPointZ = 10.0F; + this.body.rotateAngleX = 0.0F; + this.head.rotateAngleX = 0.5235988F + f4; + this.head.rotateAngleY = f3 / (180F / (float)Math.PI); + this.head.rotateAngleX = f6 * (0.2617994F + f4) + f5 * 2.18166F + (1.0F - Math.max(f6, f5)) * this.head.rotateAngleX; + this.head.rotateAngleY = f6 * f3 / (180F / (float)Math.PI) + (1.0F - Math.max(f6, f5)) * this.head.rotateAngleY; + this.head.rotationPointY = f6 * -6.0F + f5 * 11.0F + (1.0F - Math.max(f6, f5)) * this.head.rotationPointY; + this.head.rotationPointZ = f6 * -1.0F + f5 * -10.0F + (1.0F - Math.max(f6, f5)) * this.head.rotationPointZ; + this.tailBase.rotationPointY = f6 * 9.0F + f7 * this.tailBase.rotationPointY; + this.tailMiddle.rotationPointZ = f6 * 18.0F + f7 * this.tailMiddle.rotationPointZ; + this.muleRightChest.rotationPointY = f6 * 5.5F + f7 * this.muleRightChest.rotationPointY; + this.muleRightChest.rotationPointZ = f6 * 15.0F + f7 * this.muleRightChest.rotationPointZ; + this.body.rotateAngleX = f6 * -45.0F / (180F / (float)Math.PI) + f7 * this.body.rotateAngleX; + this.horseLeftEar.rotationPointY = this.head.rotationPointY; + this.horseRightEar.rotationPointY = this.head.rotationPointY; + this.muleLeftEar.rotationPointY = this.head.rotationPointY; + this.muleRightEar.rotationPointY = this.head.rotationPointY; + this.neck.rotationPointY = this.head.rotationPointY; + this.field_178711_b.rotationPointY = 0.02F; + this.field_178712_c.rotationPointY = 0.0F; + this.mane.rotationPointY = this.head.rotationPointY; + this.horseLeftEar.rotationPointZ = this.head.rotationPointZ; + this.horseRightEar.rotationPointZ = this.head.rotationPointZ; + this.muleLeftEar.rotationPointZ = this.head.rotationPointZ; + this.muleRightEar.rotationPointZ = this.head.rotationPointZ; + this.neck.rotationPointZ = this.head.rotationPointZ; + this.field_178711_b.rotationPointZ = 0.02F - f8 * 1.0F; + this.field_178712_c.rotationPointZ = 0.0F + f8 * 1.0F; + this.mane.rotationPointZ = this.head.rotationPointZ; + this.horseLeftEar.rotateAngleX = this.head.rotateAngleX; + this.horseRightEar.rotateAngleX = this.head.rotateAngleX; + this.muleLeftEar.rotateAngleX = this.head.rotateAngleX; + this.muleRightEar.rotateAngleX = this.head.rotateAngleX; + this.neck.rotateAngleX = this.head.rotateAngleX; + this.field_178711_b.rotateAngleX = 0.0F - 0.09424778F * f8; + this.field_178712_c.rotateAngleX = 0.0F + 0.15707964F * f8; + this.mane.rotateAngleX = this.head.rotateAngleX; + this.horseLeftEar.rotateAngleY = this.head.rotateAngleY; + this.horseRightEar.rotateAngleY = this.head.rotateAngleY; + this.muleLeftEar.rotateAngleY = this.head.rotateAngleY; + this.muleRightEar.rotateAngleY = this.head.rotateAngleY; + this.neck.rotateAngleY = this.head.rotateAngleY; + this.field_178711_b.rotateAngleY = 0.0F; + this.field_178712_c.rotateAngleY = 0.0F; + this.mane.rotateAngleY = this.head.rotateAngleY; + this.muleLeftChest.rotateAngleX = f11 / 5.0F; + this.muleRightChest.rotateAngleX = -f11 / 5.0F; + float f12 = ((float)Math.PI / 2F); + float f13 = ((float)Math.PI * 3F / 2F); + float f14 = -1.0471976F; + float f15 = 0.2617994F * f6; + float f16 = MathHelper.cos(f9 * 0.6F + (float)Math.PI); + this.frontLeftLeg.rotationPointY = -2.0F * f6 + 9.0F * f7; + this.frontLeftLeg.rotationPointZ = -2.0F * f6 + -8.0F * f7; + this.frontRightLeg.rotationPointY = this.frontLeftLeg.rotationPointY; + this.frontRightLeg.rotationPointZ = this.frontLeftLeg.rotationPointZ; + this.backLeftShin.rotationPointY = this.backLeftLeg.rotationPointY + MathHelper.sin(((float)Math.PI / 2F) + f15 + f7 * -f10 * 0.5F * p_78086_3_) * 7.0F; + this.backLeftShin.rotationPointZ = this.backLeftLeg.rotationPointZ + MathHelper.cos(((float)Math.PI * 3F / 2F) + f15 + f7 * -f10 * 0.5F * p_78086_3_) * 7.0F; + this.backRightShin.rotationPointY = this.backRightLeg.rotationPointY + MathHelper.sin(((float)Math.PI / 2F) + f15 + f7 * f10 * 0.5F * p_78086_3_) * 7.0F; + this.backRightShin.rotationPointZ = this.backRightLeg.rotationPointZ + MathHelper.cos(((float)Math.PI * 3F / 2F) + f15 + f7 * f10 * 0.5F * p_78086_3_) * 7.0F; + float f17 = (-1.0471976F + f16) * f6 + f11 * f7; + float f18 = (-1.0471976F + -f16) * f6 + -f11 * f7; + this.frontLeftShin.rotationPointY = this.frontLeftLeg.rotationPointY + MathHelper.sin(((float)Math.PI / 2F) + f17) * 7.0F; + this.frontLeftShin.rotationPointZ = this.frontLeftLeg.rotationPointZ + MathHelper.cos(((float)Math.PI * 3F / 2F) + f17) * 7.0F; + this.frontRightShin.rotationPointY = this.frontRightLeg.rotationPointY + MathHelper.sin(((float)Math.PI / 2F) + f18) * 7.0F; + this.frontRightShin.rotationPointZ = this.frontRightLeg.rotationPointZ + MathHelper.cos(((float)Math.PI * 3F / 2F) + f18) * 7.0F; + this.backLeftLeg.rotateAngleX = f15 + -f10 * 0.5F * p_78086_3_ * f7; + this.backLeftShin.rotateAngleX = -0.08726646F * f6 + (-f10 * 0.5F * p_78086_3_ - Math.max(0.0F, f10 * 0.5F * p_78086_3_)) * f7; + this.backLeftHoof.rotateAngleX = this.backLeftShin.rotateAngleX; + this.backRightLeg.rotateAngleX = f15 + f10 * 0.5F * p_78086_3_ * f7; + this.backRightShin.rotateAngleX = -0.08726646F * f6 + (f10 * 0.5F * p_78086_3_ - Math.max(0.0F, -f10 * 0.5F * p_78086_3_)) * f7; + this.backRightHoof.rotateAngleX = this.backRightShin.rotateAngleX; + this.frontLeftLeg.rotateAngleX = f17; + this.frontLeftShin.rotateAngleX = (this.frontLeftLeg.rotateAngleX + (float)Math.PI * Math.max(0.0F, 0.2F + f16 * 0.2F)) * f6 + (f11 + Math.max(0.0F, f10 * 0.5F * p_78086_3_)) * f7; + this.frontLeftHoof.rotateAngleX = this.frontLeftShin.rotateAngleX; + this.frontRightLeg.rotateAngleX = f18; + this.frontRightShin.rotateAngleX = (this.frontRightLeg.rotateAngleX + (float)Math.PI * Math.max(0.0F, 0.2F - f16 * 0.2F)) * f6 + (-f11 + Math.max(0.0F, -f10 * 0.5F * p_78086_3_)) * f7; + this.frontRightHoof.rotateAngleX = this.frontRightShin.rotateAngleX; + this.backLeftHoof.rotationPointY = this.backLeftShin.rotationPointY; + this.backLeftHoof.rotationPointZ = this.backLeftShin.rotationPointZ; + this.backRightHoof.rotationPointY = this.backRightShin.rotationPointY; + this.backRightHoof.rotationPointZ = this.backRightShin.rotationPointZ; + this.frontLeftHoof.rotationPointY = this.frontLeftShin.rotationPointY; + this.frontLeftHoof.rotationPointZ = this.frontLeftShin.rotationPointZ; + this.frontRightHoof.rotationPointY = this.frontRightShin.rotationPointY; + this.frontRightHoof.rotationPointZ = this.frontRightShin.rotationPointZ; + + if (flag1) + { + this.horseSaddleBottom.rotationPointY = f6 * 0.5F + f7 * 2.0F; + this.horseSaddleBottom.rotationPointZ = f6 * 11.0F + f7 * 2.0F; + this.horseSaddleFront.rotationPointY = this.horseSaddleBottom.rotationPointY; + this.horseSaddleBack.rotationPointY = this.horseSaddleBottom.rotationPointY; + this.horseLeftSaddleRope.rotationPointY = this.horseSaddleBottom.rotationPointY; + this.horseRightSaddleRope.rotationPointY = this.horseSaddleBottom.rotationPointY; + this.horseLeftSaddleMetal.rotationPointY = this.horseSaddleBottom.rotationPointY; + this.horseRightSaddleMetal.rotationPointY = this.horseSaddleBottom.rotationPointY; + this.muleLeftChest.rotationPointY = this.muleRightChest.rotationPointY; + this.horseSaddleFront.rotationPointZ = this.horseSaddleBottom.rotationPointZ; + this.horseSaddleBack.rotationPointZ = this.horseSaddleBottom.rotationPointZ; + this.horseLeftSaddleRope.rotationPointZ = this.horseSaddleBottom.rotationPointZ; + this.horseRightSaddleRope.rotationPointZ = this.horseSaddleBottom.rotationPointZ; + this.horseLeftSaddleMetal.rotationPointZ = this.horseSaddleBottom.rotationPointZ; + this.horseRightSaddleMetal.rotationPointZ = this.horseSaddleBottom.rotationPointZ; + this.muleLeftChest.rotationPointZ = this.muleRightChest.rotationPointZ; + this.horseSaddleBottom.rotateAngleX = this.body.rotateAngleX; + this.horseSaddleFront.rotateAngleX = this.body.rotateAngleX; + this.horseSaddleBack.rotateAngleX = this.body.rotateAngleX; + this.horseLeftRein.rotationPointY = this.head.rotationPointY; + this.horseRightRein.rotationPointY = this.head.rotationPointY; + this.horseFaceRopes.rotationPointY = this.head.rotationPointY; + this.horseLeftFaceMetal.rotationPointY = this.head.rotationPointY; + this.horseRightFaceMetal.rotationPointY = this.head.rotationPointY; + this.horseLeftRein.rotationPointZ = this.head.rotationPointZ; + this.horseRightRein.rotationPointZ = this.head.rotationPointZ; + this.horseFaceRopes.rotationPointZ = this.head.rotationPointZ; + this.horseLeftFaceMetal.rotationPointZ = this.head.rotationPointZ; + this.horseRightFaceMetal.rotationPointZ = this.head.rotationPointZ; + this.horseLeftRein.rotateAngleX = f4; + this.horseRightRein.rotateAngleX = f4; + this.horseFaceRopes.rotateAngleX = this.head.rotateAngleX; + this.horseLeftFaceMetal.rotateAngleX = this.head.rotateAngleX; + this.horseRightFaceMetal.rotateAngleX = this.head.rotateAngleX; + this.horseFaceRopes.rotateAngleY = this.head.rotateAngleY; + this.horseLeftFaceMetal.rotateAngleY = this.head.rotateAngleY; + this.horseLeftRein.rotateAngleY = this.head.rotateAngleY; + this.horseRightFaceMetal.rotateAngleY = this.head.rotateAngleY; + this.horseRightRein.rotateAngleY = this.head.rotateAngleY; + + if (flag2) + { + this.horseLeftSaddleRope.rotateAngleX = -1.0471976F; + this.horseLeftSaddleMetal.rotateAngleX = -1.0471976F; + this.horseRightSaddleRope.rotateAngleX = -1.0471976F; + this.horseRightSaddleMetal.rotateAngleX = -1.0471976F; + this.horseLeftSaddleRope.rotateAngleZ = 0.0F; + this.horseLeftSaddleMetal.rotateAngleZ = 0.0F; + this.horseRightSaddleRope.rotateAngleZ = 0.0F; + this.horseRightSaddleMetal.rotateAngleZ = 0.0F; + } + else + { + this.horseLeftSaddleRope.rotateAngleX = f11 / 3.0F; + this.horseLeftSaddleMetal.rotateAngleX = f11 / 3.0F; + this.horseRightSaddleRope.rotateAngleX = f11 / 3.0F; + this.horseRightSaddleMetal.rotateAngleX = f11 / 3.0F; + this.horseLeftSaddleRope.rotateAngleZ = f11 / 5.0F; + this.horseLeftSaddleMetal.rotateAngleZ = f11 / 5.0F; + this.horseRightSaddleRope.rotateAngleZ = -f11 / 5.0F; + this.horseRightSaddleMetal.rotateAngleZ = -f11 / 5.0F; + } + } + + f12 = -1.3089F + p_78086_3_ * 1.5F; + + if (f12 > 0.0F) + { + f12 = 0.0F; + } + + if (flag) + { + this.tailBase.rotateAngleY = MathHelper.cos(f9 * 0.7F); + f12 = 0.0F; + } + else + { + this.tailBase.rotateAngleY = 0.0F; + } + + this.tailMiddle.rotateAngleY = this.tailBase.rotateAngleY; + this.tailTip.rotateAngleY = this.tailBase.rotateAngleY; + this.tailMiddle.rotationPointY = this.tailBase.rotationPointY; + this.tailTip.rotationPointY = this.tailBase.rotationPointY; + this.tailMiddle.rotationPointZ = this.tailBase.rotationPointZ; + this.tailTip.rotationPointZ = this.tailBase.rotationPointZ; + this.tailBase.rotateAngleX = f12; + this.tailMiddle.rotateAngleX = f12; + this.tailTip.rotateAngleX = -0.2618F + f12; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelHumanoidHead.java b/src/minecraft/net/minecraft/client/model/ModelHumanoidHead.java new file mode 100644 index 0000000..62434a9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelHumanoidHead.java @@ -0,0 +1,36 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; + +public class ModelHumanoidHead extends ModelSkeletonHead +{ + private final ModelRenderer head = new ModelRenderer(this, 32, 0); + + public ModelHumanoidHead() + { + super(0, 0, 64, 64); + this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.25F); + this.head.setRotationPoint(0.0F, 0.0F, 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale); + this.head.render(scale); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + this.head.rotateAngleY = this.skeletonHead.rotateAngleY; + this.head.rotateAngleX = this.skeletonHead.rotateAngleX; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelIronGolem.java b/src/minecraft/net/minecraft/client/model/ModelIronGolem.java new file mode 100644 index 0000000..8cf7f94 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelIronGolem.java @@ -0,0 +1,128 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityIronGolem; + +public class ModelIronGolem extends ModelBase +{ + /** The head model for the iron golem. */ + public ModelRenderer ironGolemHead; + + /** The body model for the iron golem. */ + public ModelRenderer ironGolemBody; + + /** The right arm model for the iron golem. */ + public ModelRenderer ironGolemRightArm; + + /** The left arm model for the iron golem. */ + public ModelRenderer ironGolemLeftArm; + + /** The left leg model for the Iron Golem. */ + public ModelRenderer ironGolemLeftLeg; + + /** The right leg model for the Iron Golem. */ + public ModelRenderer ironGolemRightLeg; + + public ModelIronGolem() + { + this(0.0F); + } + + public ModelIronGolem(float p_i1161_1_) + { + this(p_i1161_1_, -7.0F); + } + + public ModelIronGolem(float p_i46362_1_, float p_i46362_2_) + { + int i = 128; + int j = 128; + this.ironGolemHead = (new ModelRenderer(this)).setTextureSize(i, j); + this.ironGolemHead.setRotationPoint(0.0F, 0.0F + p_i46362_2_, -2.0F); + this.ironGolemHead.setTextureOffset(0, 0).addBox(-4.0F, -12.0F, -5.5F, 8, 10, 8, p_i46362_1_); + this.ironGolemHead.setTextureOffset(24, 0).addBox(-1.0F, -5.0F, -7.5F, 2, 4, 2, p_i46362_1_); + this.ironGolemBody = (new ModelRenderer(this)).setTextureSize(i, j); + this.ironGolemBody.setRotationPoint(0.0F, 0.0F + p_i46362_2_, 0.0F); + this.ironGolemBody.setTextureOffset(0, 40).addBox(-9.0F, -2.0F, -6.0F, 18, 12, 11, p_i46362_1_); + this.ironGolemBody.setTextureOffset(0, 70).addBox(-4.5F, 10.0F, -3.0F, 9, 5, 6, p_i46362_1_ + 0.5F); + this.ironGolemRightArm = (new ModelRenderer(this)).setTextureSize(i, j); + this.ironGolemRightArm.setRotationPoint(0.0F, -7.0F, 0.0F); + this.ironGolemRightArm.setTextureOffset(60, 21).addBox(-13.0F, -2.5F, -3.0F, 4, 30, 6, p_i46362_1_); + this.ironGolemLeftArm = (new ModelRenderer(this)).setTextureSize(i, j); + this.ironGolemLeftArm.setRotationPoint(0.0F, -7.0F, 0.0F); + this.ironGolemLeftArm.setTextureOffset(60, 58).addBox(9.0F, -2.5F, -3.0F, 4, 30, 6, p_i46362_1_); + this.ironGolemLeftLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(i, j); + this.ironGolemLeftLeg.setRotationPoint(-4.0F, 18.0F + p_i46362_2_, 0.0F); + this.ironGolemLeftLeg.setTextureOffset(37, 0).addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, p_i46362_1_); + this.ironGolemRightLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(i, j); + this.ironGolemRightLeg.mirror = true; + this.ironGolemRightLeg.setTextureOffset(60, 0).setRotationPoint(5.0F, 18.0F + p_i46362_2_, 0.0F); + this.ironGolemRightLeg.addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, p_i46362_1_); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.ironGolemHead.render(scale); + this.ironGolemBody.render(scale); + this.ironGolemLeftLeg.render(scale); + this.ironGolemRightLeg.render(scale); + this.ironGolemRightArm.render(scale); + this.ironGolemLeftArm.render(scale); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + this.ironGolemHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.ironGolemHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.ironGolemLeftLeg.rotateAngleX = -1.5F * this.func_78172_a(p_78087_1_, 13.0F) * p_78087_2_; + this.ironGolemRightLeg.rotateAngleX = 1.5F * this.func_78172_a(p_78087_1_, 13.0F) * p_78087_2_; + this.ironGolemLeftLeg.rotateAngleY = 0.0F; + this.ironGolemRightLeg.rotateAngleY = 0.0F; + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + EntityIronGolem entityirongolem = (EntityIronGolem)entitylivingbaseIn; + int i = entityirongolem.getAttackTimer(); + + if (i > 0) + { + this.ironGolemRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - partialTickTime, 10.0F); + this.ironGolemLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - partialTickTime, 10.0F); + } + else + { + int j = entityirongolem.getHoldRoseTick(); + + if (j > 0) + { + this.ironGolemRightArm.rotateAngleX = -0.8F + 0.025F * this.func_78172_a((float)j, 70.0F); + this.ironGolemLeftArm.rotateAngleX = 0.0F; + } + else + { + this.ironGolemRightArm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(p_78086_2_, 13.0F)) * p_78086_3_; + this.ironGolemLeftArm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(p_78086_2_, 13.0F)) * p_78086_3_; + } + } + } + + private float func_78172_a(float p_78172_1_, float p_78172_2_) + { + return (Math.abs(p_78172_1_ % p_78172_2_ - p_78172_2_ * 0.5F) - p_78172_2_ * 0.25F) / (p_78172_2_ * 0.25F); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelLargeChest.java b/src/minecraft/net/minecraft/client/model/ModelLargeChest.java new file mode 100644 index 0000000..fc534de --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelLargeChest.java @@ -0,0 +1,23 @@ +package net.minecraft.client.model; + +public class ModelLargeChest extends ModelChest +{ + public ModelLargeChest() + { + this.chestLid = (new ModelRenderer(this, 0, 0)).setTextureSize(128, 64); + this.chestLid.addBox(0.0F, -5.0F, -14.0F, 30, 5, 14, 0.0F); + this.chestLid.rotationPointX = 1.0F; + this.chestLid.rotationPointY = 7.0F; + this.chestLid.rotationPointZ = 15.0F; + this.chestKnob = (new ModelRenderer(this, 0, 0)).setTextureSize(128, 64); + this.chestKnob.addBox(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F); + this.chestKnob.rotationPointX = 16.0F; + this.chestKnob.rotationPointY = 7.0F; + this.chestKnob.rotationPointZ = 15.0F; + this.chestBelow = (new ModelRenderer(this, 0, 19)).setTextureSize(128, 64); + this.chestBelow.addBox(0.0F, 0.0F, 0.0F, 30, 10, 14, 0.0F); + this.chestBelow.rotationPointX = 1.0F; + this.chestBelow.rotationPointY = 6.0F; + this.chestBelow.rotationPointZ = 1.0F; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelLeashKnot.java b/src/minecraft/net/minecraft/client/model/ModelLeashKnot.java new file mode 100644 index 0000000..cb68d3f --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelLeashKnot.java @@ -0,0 +1,43 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; + +public class ModelLeashKnot extends ModelBase +{ + public ModelRenderer field_110723_a; + + public ModelLeashKnot() + { + this(0, 0, 32, 32); + } + + public ModelLeashKnot(int p_i46365_1_, int p_i46365_2_, int p_i46365_3_, int p_i46365_4_) + { + this.textureWidth = p_i46365_3_; + this.textureHeight = p_i46365_4_; + this.field_110723_a = new ModelRenderer(this, p_i46365_1_, p_i46365_2_); + this.field_110723_a.addBox(-3.0F, -6.0F, -3.0F, 6, 8, 6, 0.0F); + this.field_110723_a.setRotationPoint(0.0F, 0.0F, 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.field_110723_a.render(scale); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + this.field_110723_a.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.field_110723_a.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelMagmaCube.java b/src/minecraft/net/minecraft/client/model/ModelMagmaCube.java new file mode 100644 index 0000000..972fecb --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelMagmaCube.java @@ -0,0 +1,71 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityMagmaCube; + +public class ModelMagmaCube extends ModelBase +{ + ModelRenderer[] segments = new ModelRenderer[8]; + ModelRenderer core; + + public ModelMagmaCube() + { + for (int i = 0; i < this.segments.length; ++i) + { + int j = 0; + int k = i; + + if (i == 2) + { + j = 24; + k = 10; + } + else if (i == 3) + { + j = 24; + k = 19; + } + + this.segments[i] = new ModelRenderer(this, j, k); + this.segments[i].addBox(-4.0F, (float)(16 + i), -4.0F, 8, 1, 8); + } + + this.core = new ModelRenderer(this, 0, 16); + this.core.addBox(-2.0F, 18.0F, -2.0F, 4, 4, 4); + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + EntityMagmaCube entitymagmacube = (EntityMagmaCube)entitylivingbaseIn; + float f = entitymagmacube.prevSquishFactor + (entitymagmacube.squishFactor - entitymagmacube.prevSquishFactor) * partialTickTime; + + if (f < 0.0F) + { + f = 0.0F; + } + + for (int i = 0; i < this.segments.length; ++i) + { + this.segments[i].rotationPointY = (float)(-(4 - i)) * f * 1.7F; + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.core.render(scale); + + for (int i = 0; i < this.segments.length; ++i) + { + this.segments[i].render(scale); + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelMinecart.java b/src/minecraft/net/minecraft/client/model/ModelMinecart.java new file mode 100644 index 0000000..0f1d187 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelMinecart.java @@ -0,0 +1,52 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; + +public class ModelMinecart extends ModelBase +{ + public ModelRenderer[] sideModels = new ModelRenderer[7]; + + public ModelMinecart() + { + this.sideModels[0] = new ModelRenderer(this, 0, 10); + this.sideModels[1] = new ModelRenderer(this, 0, 0); + this.sideModels[2] = new ModelRenderer(this, 0, 0); + this.sideModels[3] = new ModelRenderer(this, 0, 0); + this.sideModels[4] = new ModelRenderer(this, 0, 0); + this.sideModels[5] = new ModelRenderer(this, 44, 10); + int i = 20; + int j = 8; + int k = 16; + int l = 4; + this.sideModels[0].addBox((float)(-i / 2), (float)(-k / 2), -1.0F, i, k, 2, 0.0F); + this.sideModels[0].setRotationPoint(0.0F, (float)l, 0.0F); + this.sideModels[5].addBox((float)(-i / 2 + 1), (float)(-k / 2 + 1), -1.0F, i - 2, k - 2, 1, 0.0F); + this.sideModels[5].setRotationPoint(0.0F, (float)l, 0.0F); + this.sideModels[1].addBox((float)(-i / 2 + 2), (float)(-j - 1), -1.0F, i - 4, j, 2, 0.0F); + this.sideModels[1].setRotationPoint((float)(-i / 2 + 1), (float)l, 0.0F); + this.sideModels[2].addBox((float)(-i / 2 + 2), (float)(-j - 1), -1.0F, i - 4, j, 2, 0.0F); + this.sideModels[2].setRotationPoint((float)(i / 2 - 1), (float)l, 0.0F); + this.sideModels[3].addBox((float)(-i / 2 + 2), (float)(-j - 1), -1.0F, i - 4, j, 2, 0.0F); + this.sideModels[3].setRotationPoint(0.0F, (float)l, (float)(-k / 2 + 1)); + this.sideModels[4].addBox((float)(-i / 2 + 2), (float)(-j - 1), -1.0F, i - 4, j, 2, 0.0F); + this.sideModels[4].setRotationPoint(0.0F, (float)l, (float)(k / 2 - 1)); + this.sideModels[0].rotateAngleX = ((float)Math.PI / 2F); + this.sideModels[1].rotateAngleY = ((float)Math.PI * 3F / 2F); + this.sideModels[2].rotateAngleY = ((float)Math.PI / 2F); + this.sideModels[3].rotateAngleY = (float)Math.PI; + this.sideModels[5].rotateAngleX = -((float)Math.PI / 2F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.sideModels[5].rotationPointY = 4.0F - p_78088_4_; + + for (int i = 0; i < 6; ++i) + { + this.sideModels[i].render(scale); + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelOcelot.java b/src/minecraft/net/minecraft/client/model/ModelOcelot.java new file mode 100644 index 0000000..78feb44 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelOcelot.java @@ -0,0 +1,219 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.util.MathHelper; + +public class ModelOcelot extends ModelBase +{ + /** The back left leg model for the Ocelot. */ + ModelRenderer ocelotBackLeftLeg; + + /** The back right leg model for the Ocelot. */ + ModelRenderer ocelotBackRightLeg; + + /** The front left leg model for the Ocelot. */ + ModelRenderer ocelotFrontLeftLeg; + + /** The front right leg model for the Ocelot. */ + ModelRenderer ocelotFrontRightLeg; + + /** The tail model for the Ocelot. */ + ModelRenderer ocelotTail; + + /** The second part of tail model for the Ocelot. */ + ModelRenderer ocelotTail2; + + /** The head model for the Ocelot. */ + ModelRenderer ocelotHead; + + /** The body model for the Ocelot. */ + ModelRenderer ocelotBody; + int field_78163_i = 1; + + public ModelOcelot() + { + this.setTextureOffset("head.main", 0, 0); + this.setTextureOffset("head.nose", 0, 24); + this.setTextureOffset("head.ear1", 0, 10); + this.setTextureOffset("head.ear2", 6, 10); + this.ocelotHead = new ModelRenderer(this, "head"); + this.ocelotHead.addBox("main", -2.5F, -2.0F, -3.0F, 5, 4, 5); + this.ocelotHead.addBox("nose", -1.5F, 0.0F, -4.0F, 3, 2, 2); + this.ocelotHead.addBox("ear1", -2.0F, -3.0F, 0.0F, 1, 1, 2); + this.ocelotHead.addBox("ear2", 1.0F, -3.0F, 0.0F, 1, 1, 2); + this.ocelotHead.setRotationPoint(0.0F, 15.0F, -9.0F); + this.ocelotBody = new ModelRenderer(this, 20, 0); + this.ocelotBody.addBox(-2.0F, 3.0F, -8.0F, 4, 16, 6, 0.0F); + this.ocelotBody.setRotationPoint(0.0F, 12.0F, -10.0F); + this.ocelotTail = new ModelRenderer(this, 0, 15); + this.ocelotTail.addBox(-0.5F, 0.0F, 0.0F, 1, 8, 1); + this.ocelotTail.rotateAngleX = 0.9F; + this.ocelotTail.setRotationPoint(0.0F, 15.0F, 8.0F); + this.ocelotTail2 = new ModelRenderer(this, 4, 15); + this.ocelotTail2.addBox(-0.5F, 0.0F, 0.0F, 1, 8, 1); + this.ocelotTail2.setRotationPoint(0.0F, 20.0F, 14.0F); + this.ocelotBackLeftLeg = new ModelRenderer(this, 8, 13); + this.ocelotBackLeftLeg.addBox(-1.0F, 0.0F, 1.0F, 2, 6, 2); + this.ocelotBackLeftLeg.setRotationPoint(1.1F, 18.0F, 5.0F); + this.ocelotBackRightLeg = new ModelRenderer(this, 8, 13); + this.ocelotBackRightLeg.addBox(-1.0F, 0.0F, 1.0F, 2, 6, 2); + this.ocelotBackRightLeg.setRotationPoint(-1.1F, 18.0F, 5.0F); + this.ocelotFrontLeftLeg = new ModelRenderer(this, 40, 0); + this.ocelotFrontLeftLeg.addBox(-1.0F, 0.0F, 0.0F, 2, 10, 2); + this.ocelotFrontLeftLeg.setRotationPoint(1.2F, 13.8F, -5.0F); + this.ocelotFrontRightLeg = new ModelRenderer(this, 40, 0); + this.ocelotFrontRightLeg.addBox(-1.0F, 0.0F, 0.0F, 2, 10, 2); + this.ocelotFrontRightLeg.setRotationPoint(-1.2F, 13.8F, -5.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + + if (this.isChild) + { + float f = 2.0F; + GlStateManager.pushMatrix(); + GlStateManager.scale(1.5F / f, 1.5F / f, 1.5F / f); + GlStateManager.translate(0.0F, 10.0F * scale, 4.0F * scale); + this.ocelotHead.render(scale); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f); + GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); + this.ocelotBody.render(scale); + this.ocelotBackLeftLeg.render(scale); + this.ocelotBackRightLeg.render(scale); + this.ocelotFrontLeftLeg.render(scale); + this.ocelotFrontRightLeg.render(scale); + this.ocelotTail.render(scale); + this.ocelotTail2.render(scale); + GlStateManager.popMatrix(); + } + else + { + this.ocelotHead.render(scale); + this.ocelotBody.render(scale); + this.ocelotTail.render(scale); + this.ocelotTail2.render(scale); + this.ocelotBackLeftLeg.render(scale); + this.ocelotBackRightLeg.render(scale); + this.ocelotFrontLeftLeg.render(scale); + this.ocelotFrontRightLeg.render(scale); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + this.ocelotHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.ocelotHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + + if (this.field_78163_i != 3) + { + this.ocelotBody.rotateAngleX = ((float)Math.PI / 2F); + + if (this.field_78163_i == 2) + { + this.ocelotBackLeftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.0F * p_78087_2_; + this.ocelotBackRightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + 0.3F) * 1.0F * p_78087_2_; + this.ocelotFrontLeftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI + 0.3F) * 1.0F * p_78087_2_; + this.ocelotFrontRightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.0F * p_78087_2_; + this.ocelotTail2.rotateAngleX = 1.7278761F + ((float)Math.PI / 10F) * MathHelper.cos(p_78087_1_) * p_78087_2_; + } + else + { + this.ocelotBackLeftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.0F * p_78087_2_; + this.ocelotBackRightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.0F * p_78087_2_; + this.ocelotFrontLeftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.0F * p_78087_2_; + this.ocelotFrontRightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.0F * p_78087_2_; + + if (this.field_78163_i == 1) + { + this.ocelotTail2.rotateAngleX = 1.7278761F + ((float)Math.PI / 4F) * MathHelper.cos(p_78087_1_) * p_78087_2_; + } + else + { + this.ocelotTail2.rotateAngleX = 1.7278761F + 0.47123894F * MathHelper.cos(p_78087_1_) * p_78087_2_; + } + } + } + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + EntityOcelot entityocelot = (EntityOcelot)entitylivingbaseIn; + this.ocelotBody.rotationPointY = 12.0F; + this.ocelotBody.rotationPointZ = -10.0F; + this.ocelotHead.rotationPointY = 15.0F; + this.ocelotHead.rotationPointZ = -9.0F; + this.ocelotTail.rotationPointY = 15.0F; + this.ocelotTail.rotationPointZ = 8.0F; + this.ocelotTail2.rotationPointY = 20.0F; + this.ocelotTail2.rotationPointZ = 14.0F; + this.ocelotFrontLeftLeg.rotationPointY = this.ocelotFrontRightLeg.rotationPointY = 13.8F; + this.ocelotFrontLeftLeg.rotationPointZ = this.ocelotFrontRightLeg.rotationPointZ = -5.0F; + this.ocelotBackLeftLeg.rotationPointY = this.ocelotBackRightLeg.rotationPointY = 18.0F; + this.ocelotBackLeftLeg.rotationPointZ = this.ocelotBackRightLeg.rotationPointZ = 5.0F; + this.ocelotTail.rotateAngleX = 0.9F; + + if (entityocelot.isSneaking()) + { + ++this.ocelotBody.rotationPointY; + this.ocelotHead.rotationPointY += 2.0F; + ++this.ocelotTail.rotationPointY; + this.ocelotTail2.rotationPointY += -4.0F; + this.ocelotTail2.rotationPointZ += 2.0F; + this.ocelotTail.rotateAngleX = ((float)Math.PI / 2F); + this.ocelotTail2.rotateAngleX = ((float)Math.PI / 2F); + this.field_78163_i = 0; + } + else if (entityocelot.isSprinting()) + { + this.ocelotTail2.rotationPointY = this.ocelotTail.rotationPointY; + this.ocelotTail2.rotationPointZ += 2.0F; + this.ocelotTail.rotateAngleX = ((float)Math.PI / 2F); + this.ocelotTail2.rotateAngleX = ((float)Math.PI / 2F); + this.field_78163_i = 2; + } + else if (entityocelot.isSitting()) + { + this.ocelotBody.rotateAngleX = ((float)Math.PI / 4F); + this.ocelotBody.rotationPointY += -4.0F; + this.ocelotBody.rotationPointZ += 5.0F; + this.ocelotHead.rotationPointY += -3.3F; + ++this.ocelotHead.rotationPointZ; + this.ocelotTail.rotationPointY += 8.0F; + this.ocelotTail.rotationPointZ += -2.0F; + this.ocelotTail2.rotationPointY += 2.0F; + this.ocelotTail2.rotationPointZ += -0.8F; + this.ocelotTail.rotateAngleX = 1.7278761F; + this.ocelotTail2.rotateAngleX = 2.670354F; + this.ocelotFrontLeftLeg.rotateAngleX = this.ocelotFrontRightLeg.rotateAngleX = -0.15707964F; + this.ocelotFrontLeftLeg.rotationPointY = this.ocelotFrontRightLeg.rotationPointY = 15.8F; + this.ocelotFrontLeftLeg.rotationPointZ = this.ocelotFrontRightLeg.rotationPointZ = -7.0F; + this.ocelotBackLeftLeg.rotateAngleX = this.ocelotBackRightLeg.rotateAngleX = -((float)Math.PI / 2F); + this.ocelotBackLeftLeg.rotationPointY = this.ocelotBackRightLeg.rotationPointY = 21.0F; + this.ocelotBackLeftLeg.rotationPointZ = this.ocelotBackRightLeg.rotationPointZ = 1.0F; + this.field_78163_i = 3; + } + else + { + this.field_78163_i = 1; + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelPig.java b/src/minecraft/net/minecraft/client/model/ModelPig.java new file mode 100644 index 0000000..fc2b7f9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelPig.java @@ -0,0 +1,16 @@ +package net.minecraft.client.model; + +public class ModelPig extends ModelQuadruped +{ + public ModelPig() + { + this(0.0F); + } + + public ModelPig(float p_i1151_1_) + { + super(6, p_i1151_1_); + this.head.setTextureOffset(16, 16).addBox(-2.0F, 0.0F, -9.0F, 4, 3, 1, p_i1151_1_); + this.childYOffset = 4.0F; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelPlayer.java b/src/minecraft/net/minecraft/client/model/ModelPlayer.java new file mode 100644 index 0000000..aecc687 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelPlayer.java @@ -0,0 +1,171 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; + +public class ModelPlayer extends ModelBiped +{ + public ModelRenderer bipedLeftArmwear; + public ModelRenderer bipedRightArmwear; + public ModelRenderer bipedLeftLegwear; + public ModelRenderer bipedRightLegwear; + public ModelRenderer bipedBodyWear; + private ModelRenderer bipedCape; + private ModelRenderer bipedDeadmau5Head; + private boolean smallArms; + private static final String __OBFID = "CL_00002626"; + + public ModelPlayer(float p_i46304_1_, boolean p_i46304_2_) + { + super(p_i46304_1_, 0.0F, 64, 64); + this.smallArms = p_i46304_2_; + this.bipedDeadmau5Head = new ModelRenderer(this, 24, 0); + this.bipedDeadmau5Head.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, p_i46304_1_); + this.bipedCape = new ModelRenderer(this, 0, 0); + this.bipedCape.setTextureSize(64, 32); + this.bipedCape.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, p_i46304_1_); + + if (p_i46304_2_) + { + this.bipedLeftArm = new ModelRenderer(this, 32, 48); + this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, p_i46304_1_); + this.bipedLeftArm.setRotationPoint(5.0F, 2.5F, 0.0F); + this.bipedRightArm = new ModelRenderer(this, 40, 16); + this.bipedRightArm.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, p_i46304_1_); + this.bipedRightArm.setRotationPoint(-5.0F, 2.5F, 0.0F); + this.bipedLeftArmwear = new ModelRenderer(this, 48, 48); + this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, p_i46304_1_ + 0.25F); + this.bipedLeftArmwear.setRotationPoint(5.0F, 2.5F, 0.0F); + this.bipedRightArmwear = new ModelRenderer(this, 40, 32); + this.bipedRightArmwear.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, p_i46304_1_ + 0.25F); + this.bipedRightArmwear.setRotationPoint(-5.0F, 2.5F, 10.0F); + } + else + { + this.bipedLeftArm = new ModelRenderer(this, 32, 48); + this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, p_i46304_1_); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F); + this.bipedLeftArmwear = new ModelRenderer(this, 48, 48); + this.bipedLeftArmwear.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, p_i46304_1_ + 0.25F); + this.bipedLeftArmwear.setRotationPoint(5.0F, 2.0F, 0.0F); + this.bipedRightArmwear = new ModelRenderer(this, 40, 32); + this.bipedRightArmwear.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, p_i46304_1_ + 0.25F); + this.bipedRightArmwear.setRotationPoint(-5.0F, 2.0F, 10.0F); + } + + this.bipedLeftLeg = new ModelRenderer(this, 16, 48); + this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, p_i46304_1_); + this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F); + this.bipedLeftLegwear = new ModelRenderer(this, 0, 48); + this.bipedLeftLegwear.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, p_i46304_1_ + 0.25F); + this.bipedLeftLegwear.setRotationPoint(1.9F, 12.0F, 0.0F); + this.bipedRightLegwear = new ModelRenderer(this, 0, 32); + this.bipedRightLegwear.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, p_i46304_1_ + 0.25F); + this.bipedRightLegwear.setRotationPoint(-1.9F, 12.0F, 0.0F); + this.bipedBodyWear = new ModelRenderer(this, 16, 32); + this.bipedBodyWear.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, p_i46304_1_ + 0.25F); + this.bipedBodyWear.setRotationPoint(0.0F, 0.0F, 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale); + GlStateManager.pushMatrix(); + + if (this.isChild) + { + float f = 2.0F; + GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f); + GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); + this.bipedLeftLegwear.render(scale); + this.bipedRightLegwear.render(scale); + this.bipedLeftArmwear.render(scale); + this.bipedRightArmwear.render(scale); + this.bipedBodyWear.render(scale); + } + else + { + if (entityIn.isSneaking()) + { + GlStateManager.translate(0.0F, 0.2F, 0.0F); + } + + this.bipedLeftLegwear.render(scale); + this.bipedRightLegwear.render(scale); + this.bipedLeftArmwear.render(scale); + this.bipedRightArmwear.render(scale); + this.bipedBodyWear.render(scale); + } + + GlStateManager.popMatrix(); + } + + public void renderDeadmau5Head(float p_178727_1_) + { + copyModelAngles(this.bipedHead, this.bipedDeadmau5Head); + this.bipedDeadmau5Head.rotationPointX = 0.0F; + this.bipedDeadmau5Head.rotationPointY = 0.0F; + this.bipedDeadmau5Head.render(p_178727_1_); + } + + public void renderCape(float p_178728_1_) + { + this.bipedCape.render(p_178728_1_); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + copyModelAngles(this.bipedLeftLeg, this.bipedLeftLegwear); + copyModelAngles(this.bipedRightLeg, this.bipedRightLegwear); + copyModelAngles(this.bipedLeftArm, this.bipedLeftArmwear); + copyModelAngles(this.bipedRightArm, this.bipedRightArmwear); + copyModelAngles(this.bipedBody, this.bipedBodyWear); + } + + public void renderRightArm() + { + this.bipedRightArm.render(0.0625F); + this.bipedRightArmwear.render(0.0625F); + } + + public void renderLeftArm() + { + this.bipedLeftArm.render(0.0625F); + this.bipedLeftArmwear.render(0.0625F); + } + + public void setInvisible(boolean invisible) + { + super.setInvisible(invisible); + this.bipedLeftArmwear.showModel = invisible; + this.bipedRightArmwear.showModel = invisible; + this.bipedLeftLegwear.showModel = invisible; + this.bipedRightLegwear.showModel = invisible; + this.bipedBodyWear.showModel = invisible; + this.bipedCape.showModel = invisible; + this.bipedDeadmau5Head.showModel = invisible; + } + + public void postRenderArm(float scale) + { + if (this.smallArms) + { + ++this.bipedRightArm.rotationPointX; + this.bipedRightArm.postRender(scale); + --this.bipedRightArm.rotationPointX; + } + else + { + this.bipedRightArm.postRender(scale); + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelQuadruped.java b/src/minecraft/net/minecraft/client/model/ModelQuadruped.java new file mode 100644 index 0000000..cd1e89a --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelQuadruped.java @@ -0,0 +1,90 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelQuadruped extends ModelBase +{ + public ModelRenderer head = new ModelRenderer(this, 0, 0); + public ModelRenderer body; + public ModelRenderer leg1; + public ModelRenderer leg2; + public ModelRenderer leg3; + public ModelRenderer leg4; + protected float childYOffset = 8.0F; + protected float childZOffset = 4.0F; + + public ModelQuadruped(int p_i1154_1_, float p_i1154_2_) + { + this.head.addBox(-4.0F, -4.0F, -8.0F, 8, 8, 8, p_i1154_2_); + this.head.setRotationPoint(0.0F, (float)(18 - p_i1154_1_), -6.0F); + this.body = new ModelRenderer(this, 28, 8); + this.body.addBox(-5.0F, -10.0F, -7.0F, 10, 16, 8, p_i1154_2_); + this.body.setRotationPoint(0.0F, (float)(17 - p_i1154_1_), 2.0F); + this.leg1 = new ModelRenderer(this, 0, 16); + this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, p_i1154_1_, 4, p_i1154_2_); + this.leg1.setRotationPoint(-3.0F, (float)(24 - p_i1154_1_), 7.0F); + this.leg2 = new ModelRenderer(this, 0, 16); + this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, p_i1154_1_, 4, p_i1154_2_); + this.leg2.setRotationPoint(3.0F, (float)(24 - p_i1154_1_), 7.0F); + this.leg3 = new ModelRenderer(this, 0, 16); + this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, p_i1154_1_, 4, p_i1154_2_); + this.leg3.setRotationPoint(-3.0F, (float)(24 - p_i1154_1_), -5.0F); + this.leg4 = new ModelRenderer(this, 0, 16); + this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, p_i1154_1_, 4, p_i1154_2_); + this.leg4.setRotationPoint(3.0F, (float)(24 - p_i1154_1_), -5.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + + if (this.isChild) + { + float f = 2.0F; + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, this.childYOffset * scale, this.childZOffset * scale); + this.head.render(scale); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f); + GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); + this.body.render(scale); + this.leg1.render(scale); + this.leg2.render(scale); + this.leg3.render(scale); + this.leg4.render(scale); + GlStateManager.popMatrix(); + } + else + { + this.head.render(scale); + this.body.render(scale); + this.leg1.render(scale); + this.leg2.render(scale); + this.leg3.render(scale); + this.leg4.render(scale); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + float f = (180F / (float)Math.PI); + this.head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.body.rotateAngleX = ((float)Math.PI / 2F); + this.leg1.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_; + this.leg2.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_; + this.leg3.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_; + this.leg4.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelRabbit.java b/src/minecraft/net/minecraft/client/model/ModelRabbit.java new file mode 100644 index 0000000..d4a0b25 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelRabbit.java @@ -0,0 +1,197 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityRabbit; +import net.minecraft.util.MathHelper; + +public class ModelRabbit extends ModelBase +{ + /** The Rabbit's Left Foot */ + ModelRenderer rabbitLeftFoot; + + /** The Rabbit's Right Foot */ + ModelRenderer rabbitRightFoot; + + /** The Rabbit's Left Thigh */ + ModelRenderer rabbitLeftThigh; + + /** The Rabbit's Right Thigh */ + ModelRenderer rabbitRightThigh; + + /** The Rabbit's Body */ + ModelRenderer rabbitBody; + + /** The Rabbit's Left Arm */ + ModelRenderer rabbitLeftArm; + + /** The Rabbit's Right Arm */ + ModelRenderer rabbitRightArm; + + /** The Rabbit's Head */ + ModelRenderer rabbitHead; + + /** The Rabbit's Right Ear */ + ModelRenderer rabbitRightEar; + + /** The Rabbit's Left Ear */ + ModelRenderer rabbitLeftEar; + + /** The Rabbit's Tail */ + ModelRenderer rabbitTail; + + /** The Rabbit's Nose */ + ModelRenderer rabbitNose; + private float field_178701_m = 0.0F; + private float field_178699_n = 0.0F; + + public ModelRabbit() + { + this.setTextureOffset("head.main", 0, 0); + this.setTextureOffset("head.nose", 0, 24); + this.setTextureOffset("head.ear1", 0, 10); + this.setTextureOffset("head.ear2", 6, 10); + this.rabbitLeftFoot = new ModelRenderer(this, 26, 24); + this.rabbitLeftFoot.addBox(-1.0F, 5.5F, -3.7F, 2, 1, 7); + this.rabbitLeftFoot.setRotationPoint(3.0F, 17.5F, 3.7F); + this.rabbitLeftFoot.mirror = true; + this.setRotationOffset(this.rabbitLeftFoot, 0.0F, 0.0F, 0.0F); + this.rabbitRightFoot = new ModelRenderer(this, 8, 24); + this.rabbitRightFoot.addBox(-1.0F, 5.5F, -3.7F, 2, 1, 7); + this.rabbitRightFoot.setRotationPoint(-3.0F, 17.5F, 3.7F); + this.rabbitRightFoot.mirror = true; + this.setRotationOffset(this.rabbitRightFoot, 0.0F, 0.0F, 0.0F); + this.rabbitLeftThigh = new ModelRenderer(this, 30, 15); + this.rabbitLeftThigh.addBox(-1.0F, 0.0F, 0.0F, 2, 4, 5); + this.rabbitLeftThigh.setRotationPoint(3.0F, 17.5F, 3.7F); + this.rabbitLeftThigh.mirror = true; + this.setRotationOffset(this.rabbitLeftThigh, -0.34906584F, 0.0F, 0.0F); + this.rabbitRightThigh = new ModelRenderer(this, 16, 15); + this.rabbitRightThigh.addBox(-1.0F, 0.0F, 0.0F, 2, 4, 5); + this.rabbitRightThigh.setRotationPoint(-3.0F, 17.5F, 3.7F); + this.rabbitRightThigh.mirror = true; + this.setRotationOffset(this.rabbitRightThigh, -0.34906584F, 0.0F, 0.0F); + this.rabbitBody = new ModelRenderer(this, 0, 0); + this.rabbitBody.addBox(-3.0F, -2.0F, -10.0F, 6, 5, 10); + this.rabbitBody.setRotationPoint(0.0F, 19.0F, 8.0F); + this.rabbitBody.mirror = true; + this.setRotationOffset(this.rabbitBody, -0.34906584F, 0.0F, 0.0F); + this.rabbitLeftArm = new ModelRenderer(this, 8, 15); + this.rabbitLeftArm.addBox(-1.0F, 0.0F, -1.0F, 2, 7, 2); + this.rabbitLeftArm.setRotationPoint(3.0F, 17.0F, -1.0F); + this.rabbitLeftArm.mirror = true; + this.setRotationOffset(this.rabbitLeftArm, -0.17453292F, 0.0F, 0.0F); + this.rabbitRightArm = new ModelRenderer(this, 0, 15); + this.rabbitRightArm.addBox(-1.0F, 0.0F, -1.0F, 2, 7, 2); + this.rabbitRightArm.setRotationPoint(-3.0F, 17.0F, -1.0F); + this.rabbitRightArm.mirror = true; + this.setRotationOffset(this.rabbitRightArm, -0.17453292F, 0.0F, 0.0F); + this.rabbitHead = new ModelRenderer(this, 32, 0); + this.rabbitHead.addBox(-2.5F, -4.0F, -5.0F, 5, 4, 5); + this.rabbitHead.setRotationPoint(0.0F, 16.0F, -1.0F); + this.rabbitHead.mirror = true; + this.setRotationOffset(this.rabbitHead, 0.0F, 0.0F, 0.0F); + this.rabbitRightEar = new ModelRenderer(this, 52, 0); + this.rabbitRightEar.addBox(-2.5F, -9.0F, -1.0F, 2, 5, 1); + this.rabbitRightEar.setRotationPoint(0.0F, 16.0F, -1.0F); + this.rabbitRightEar.mirror = true; + this.setRotationOffset(this.rabbitRightEar, 0.0F, -0.2617994F, 0.0F); + this.rabbitLeftEar = new ModelRenderer(this, 58, 0); + this.rabbitLeftEar.addBox(0.5F, -9.0F, -1.0F, 2, 5, 1); + this.rabbitLeftEar.setRotationPoint(0.0F, 16.0F, -1.0F); + this.rabbitLeftEar.mirror = true; + this.setRotationOffset(this.rabbitLeftEar, 0.0F, 0.2617994F, 0.0F); + this.rabbitTail = new ModelRenderer(this, 52, 6); + this.rabbitTail.addBox(-1.5F, -1.5F, 0.0F, 3, 3, 2); + this.rabbitTail.setRotationPoint(0.0F, 20.0F, 7.0F); + this.rabbitTail.mirror = true; + this.setRotationOffset(this.rabbitTail, -0.3490659F, 0.0F, 0.0F); + this.rabbitNose = new ModelRenderer(this, 32, 9); + this.rabbitNose.addBox(-0.5F, -2.5F, -5.5F, 1, 1, 1); + this.rabbitNose.setRotationPoint(0.0F, 16.0F, -1.0F); + this.rabbitNose.mirror = true; + this.setRotationOffset(this.rabbitNose, 0.0F, 0.0F, 0.0F); + } + + private void setRotationOffset(ModelRenderer p_178691_1_, float p_178691_2_, float p_178691_3_, float p_178691_4_) + { + p_178691_1_.rotateAngleX = p_178691_2_; + p_178691_1_.rotateAngleY = p_178691_3_; + p_178691_1_.rotateAngleZ = p_178691_4_; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + + if (this.isChild) + { + float f = 2.0F; + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 5.0F * scale, 2.0F * scale); + this.rabbitHead.render(scale); + this.rabbitLeftEar.render(scale); + this.rabbitRightEar.render(scale); + this.rabbitNose.render(scale); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f); + GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); + this.rabbitLeftFoot.render(scale); + this.rabbitRightFoot.render(scale); + this.rabbitLeftThigh.render(scale); + this.rabbitRightThigh.render(scale); + this.rabbitBody.render(scale); + this.rabbitLeftArm.render(scale); + this.rabbitRightArm.render(scale); + this.rabbitTail.render(scale); + GlStateManager.popMatrix(); + } + else + { + this.rabbitLeftFoot.render(scale); + this.rabbitRightFoot.render(scale); + this.rabbitLeftThigh.render(scale); + this.rabbitRightThigh.render(scale); + this.rabbitBody.render(scale); + this.rabbitLeftArm.render(scale); + this.rabbitRightArm.render(scale); + this.rabbitHead.render(scale); + this.rabbitRightEar.render(scale); + this.rabbitLeftEar.render(scale); + this.rabbitTail.render(scale); + this.rabbitNose.render(scale); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + float f = p_78087_3_ - (float)entityIn.ticksExisted; + EntityRabbit entityrabbit = (EntityRabbit)entityIn; + this.rabbitNose.rotateAngleX = this.rabbitHead.rotateAngleX = this.rabbitRightEar.rotateAngleX = this.rabbitLeftEar.rotateAngleX = p_78087_5_ * 0.017453292F; + this.rabbitNose.rotateAngleY = this.rabbitHead.rotateAngleY = p_78087_4_ * 0.017453292F; + this.rabbitRightEar.rotateAngleY = this.rabbitNose.rotateAngleY - 0.2617994F; + this.rabbitLeftEar.rotateAngleY = this.rabbitNose.rotateAngleY + 0.2617994F; + this.field_178701_m = MathHelper.sin(entityrabbit.func_175521_o(f) * (float)Math.PI); + this.rabbitLeftThigh.rotateAngleX = this.rabbitRightThigh.rotateAngleX = (this.field_178701_m * 50.0F - 21.0F) * 0.017453292F; + this.rabbitLeftFoot.rotateAngleX = this.rabbitRightFoot.rotateAngleX = this.field_178701_m * 50.0F * 0.017453292F; + this.rabbitLeftArm.rotateAngleX = this.rabbitRightArm.rotateAngleX = (this.field_178701_m * -40.0F - 11.0F) * 0.017453292F; + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelRenderer.java b/src/minecraft/net/minecraft/client/model/ModelRenderer.java new file mode 100644 index 0000000..2dfeda4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelRenderer.java @@ -0,0 +1,348 @@ +package net.minecraft.client.model; + +import com.google.common.collect.Lists; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import optifine.ModelSprite; + +import org.lwjgl.opengl.GL11; + +public class ModelRenderer +{ + /** The size of the texture file's width in pixels. */ + public float textureWidth; + + /** The size of the texture file's height in pixels. */ + public float textureHeight; + + /** The X offset into the texture used for displaying this model */ + private int textureOffsetX; + + /** The Y offset into the texture used for displaying this model */ + private int textureOffsetY; + public float rotationPointX; + public float rotationPointY; + public float rotationPointZ; + public float rotateAngleX; + public float rotateAngleY; + public float rotateAngleZ; + private boolean compiled; + + /** The GL display list rendered by the Tessellator for this model */ + private int displayList; + public boolean mirror; + public boolean showModel; + + /** Hides the model. */ + public boolean isHidden; + public List cubeList; + public List childModels; + public final String boxName; + private ModelBase baseModel; + public float offsetX; + public float offsetY; + public float offsetZ; + private static final String __OBFID = "CL_00000874"; + public List spriteList; + public boolean mirrorV; + float savedScale; + + public ModelRenderer(ModelBase model, String boxNameIn) + { + this.spriteList = new ArrayList(); + this.mirrorV = false; + this.textureWidth = 64.0F; + this.textureHeight = 32.0F; + this.showModel = true; + this.cubeList = Lists.newArrayList(); + this.baseModel = model; + model.boxList.add(this); + this.boxName = boxNameIn; + this.setTextureSize(model.textureWidth, model.textureHeight); + } + + public ModelRenderer(ModelBase model) + { + this(model, (String)null); + } + + public ModelRenderer(ModelBase model, int texOffX, int texOffY) + { + this(model); + this.setTextureOffset(texOffX, texOffY); + } + + /** + * Sets the current box's rotation points and rotation angles to another box. + */ + public void addChild(ModelRenderer renderer) + { + if (this.childModels == null) + { + this.childModels = Lists.newArrayList(); + } + + this.childModels.add(renderer); + } + + public ModelRenderer setTextureOffset(int x, int y) + { + this.textureOffsetX = x; + this.textureOffsetY = y; + return this; + } + + public ModelRenderer addBox(String partName, float offX, float offY, float offZ, int width, int height, int depth) + { + partName = this.boxName + "." + partName; + TextureOffset textureoffset = this.baseModel.getTextureOffset(partName); + this.setTextureOffset(textureoffset.textureOffsetX, textureoffset.textureOffsetY); + this.cubeList.add((new ModelBox(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, 0.0F)).setBoxName(partName)); + return this; + } + + public ModelRenderer addBox(float offX, float offY, float offZ, int width, int height, int depth) + { + this.cubeList.add(new ModelBox(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, 0.0F)); + return this; + } + + public ModelRenderer addBox(float p_178769_1_, float p_178769_2_, float p_178769_3_, int p_178769_4_, int p_178769_5_, int p_178769_6_, boolean p_178769_7_) + { + this.cubeList.add(new ModelBox(this, this.textureOffsetX, this.textureOffsetY, p_178769_1_, p_178769_2_, p_178769_3_, p_178769_4_, p_178769_5_, p_178769_6_, 0.0F, p_178769_7_)); + return this; + } + + /** + * Creates a textured box. Args: originX, originY, originZ, width, height, depth, scaleFactor. + */ + public void addBox(float p_78790_1_, float p_78790_2_, float p_78790_3_, int width, int height, int depth, float scaleFactor) + { + this.cubeList.add(new ModelBox(this, this.textureOffsetX, this.textureOffsetY, p_78790_1_, p_78790_2_, p_78790_3_, width, height, depth, scaleFactor)); + } + + public void setRotationPoint(float rotationPointXIn, float rotationPointYIn, float rotationPointZIn) + { + this.rotationPointX = rotationPointXIn; + this.rotationPointY = rotationPointYIn; + this.rotationPointZ = rotationPointZIn; + } + + public void render(float p_78785_1_) + { + if (!this.isHidden && this.showModel) + { + if (!this.compiled) + { + this.compileDisplayList(p_78785_1_); + } + + GlStateManager.translate(this.offsetX, this.offsetY, this.offsetZ); + + if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) + { + if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) + { + GlStateManager.callList(this.displayList); + + if (this.childModels != null) + { + for (int k = 0; k < this.childModels.size(); ++k) + { + ((ModelRenderer)this.childModels.get(k)).render(p_78785_1_); + } + } + } + else + { + GlStateManager.translate(this.rotationPointX * p_78785_1_, this.rotationPointY * p_78785_1_, this.rotationPointZ * p_78785_1_); + GlStateManager.callList(this.displayList); + + if (this.childModels != null) + { + for (int j = 0; j < this.childModels.size(); ++j) + { + ((ModelRenderer)this.childModels.get(j)).render(p_78785_1_); + } + } + + GlStateManager.translate(-this.rotationPointX * p_78785_1_, -this.rotationPointY * p_78785_1_, -this.rotationPointZ * p_78785_1_); + } + } + else + { + GlStateManager.pushMatrix(); + GlStateManager.translate(this.rotationPointX * p_78785_1_, this.rotationPointY * p_78785_1_, this.rotationPointZ * p_78785_1_); + + if (this.rotateAngleZ != 0.0F) + { + GlStateManager.rotate(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + } + + if (this.rotateAngleY != 0.0F) + { + GlStateManager.rotate(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + } + + if (this.rotateAngleX != 0.0F) + { + GlStateManager.rotate(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + } + + GlStateManager.callList(this.displayList); + + if (this.childModels != null) + { + for (int i = 0; i < this.childModels.size(); ++i) + { + ((ModelRenderer)this.childModels.get(i)).render(p_78785_1_); + } + } + + GlStateManager.popMatrix(); + } + + GlStateManager.translate(-this.offsetX, -this.offsetY, -this.offsetZ); + } + } + + public void renderWithRotation(float p_78791_1_) + { + if (!this.isHidden && this.showModel) + { + if (!this.compiled) + { + this.compileDisplayList(p_78791_1_); + } + + GlStateManager.pushMatrix(); + GlStateManager.translate(this.rotationPointX * p_78791_1_, this.rotationPointY * p_78791_1_, this.rotationPointZ * p_78791_1_); + + if (this.rotateAngleY != 0.0F) + { + GlStateManager.rotate(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + } + + if (this.rotateAngleX != 0.0F) + { + GlStateManager.rotate(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + } + + if (this.rotateAngleZ != 0.0F) + { + GlStateManager.rotate(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + } + + GlStateManager.callList(this.displayList); + GlStateManager.popMatrix(); + } + } + + /** + * Allows the changing of Angles after a box has been rendered + */ + public void postRender(float scale) + { + if (!this.isHidden && this.showModel) + { + if (!this.compiled) + { + this.compileDisplayList(scale); + } + + if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) + { + if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) + { + GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + } + } + else + { + GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + + if (this.rotateAngleZ != 0.0F) + { + GlStateManager.rotate(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + } + + if (this.rotateAngleY != 0.0F) + { + GlStateManager.rotate(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + } + + if (this.rotateAngleX != 0.0F) + { + GlStateManager.rotate(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + } + } + } + } + + /** + * Compiles a GL display list for this model + */ + private void compileDisplayList(float scale) + { + if (this.displayList == 0) + { + this.savedScale = scale; + this.displayList = GLAllocation.generateDisplayLists(1); + } + + GL11.glNewList(this.displayList, GL11.GL_COMPILE); + WorldRenderer worldrenderer = Tessellator.getInstance().getWorldRenderer(); + + for (int i = 0; i < this.cubeList.size(); ++i) + { + ((ModelBox)this.cubeList.get(i)).render(worldrenderer, scale); + } + + for (int j = 0; j < this.spriteList.size(); ++j) + { + ModelSprite modelsprite = (ModelSprite)this.spriteList.get(j); + modelsprite.render(Tessellator.getInstance(), scale); + } + + GL11.glEndList(); + this.compiled = true; + } + + /** + * Returns the model renderer with the new texture parameters. + */ + public ModelRenderer setTextureSize(int textureWidthIn, int textureHeightIn) + { + this.textureWidth = (float)textureWidthIn; + this.textureHeight = (float)textureHeightIn; + return this; + } + + public void addSprite(float p_addSprite_1_, float p_addSprite_2_, float p_addSprite_3_, int p_addSprite_4_, int p_addSprite_5_, int p_addSprite_6_, float p_addSprite_7_) + { + this.spriteList.add(new ModelSprite(this, this.textureOffsetX, this.textureOffsetY, p_addSprite_1_, p_addSprite_2_, p_addSprite_3_, p_addSprite_4_, p_addSprite_5_, p_addSprite_6_, p_addSprite_7_)); + } + + public boolean getCompiled() + { + return this.compiled; + } + + public int getDisplayList() + { + return this.displayList; + } + + public void resetDisplayList() + { + if (this.compiled) + { + this.compiled = false; + this.compileDisplayList(this.savedScale); + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelSheep1.java b/src/minecraft/net/minecraft/client/model/ModelSheep1.java new file mode 100644 index 0000000..cb5d299 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelSheep1.java @@ -0,0 +1,56 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntitySheep; + +public class ModelSheep1 extends ModelQuadruped +{ + private float headRotationAngleX; + + public ModelSheep1() + { + super(12, 0.0F); + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-3.0F, -4.0F, -4.0F, 6, 6, 6, 0.6F); + this.head.setRotationPoint(0.0F, 6.0F, -8.0F); + this.body = new ModelRenderer(this, 28, 8); + this.body.addBox(-4.0F, -10.0F, -7.0F, 8, 16, 6, 1.75F); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + float f = 0.5F; + this.leg1 = new ModelRenderer(this, 0, 16); + this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, f); + this.leg1.setRotationPoint(-3.0F, 12.0F, 7.0F); + this.leg2 = new ModelRenderer(this, 0, 16); + this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, f); + this.leg2.setRotationPoint(3.0F, 12.0F, 7.0F); + this.leg3 = new ModelRenderer(this, 0, 16); + this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, f); + this.leg3.setRotationPoint(-3.0F, 12.0F, -5.0F); + this.leg4 = new ModelRenderer(this, 0, 16); + this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, f); + this.leg4.setRotationPoint(3.0F, 12.0F, -5.0F); + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime); + this.head.rotationPointY = 6.0F + ((EntitySheep)entitylivingbaseIn).getHeadRotationPointY(partialTickTime) * 9.0F; + this.headRotationAngleX = ((EntitySheep)entitylivingbaseIn).getHeadRotationAngleX(partialTickTime); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + this.head.rotateAngleX = this.headRotationAngleX; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelSheep2.java b/src/minecraft/net/minecraft/client/model/ModelSheep2.java new file mode 100644 index 0000000..15ed7c4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelSheep2.java @@ -0,0 +1,43 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntitySheep; + +public class ModelSheep2 extends ModelQuadruped +{ + private float headRotationAngleX; + + public ModelSheep2() + { + super(12, 0.0F); + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-3.0F, -4.0F, -6.0F, 6, 6, 8, 0.0F); + this.head.setRotationPoint(0.0F, 6.0F, -8.0F); + this.body = new ModelRenderer(this, 28, 8); + this.body.addBox(-4.0F, -10.0F, -7.0F, 8, 16, 6, 0.0F); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime); + this.head.rotationPointY = 6.0F + ((EntitySheep)entitylivingbaseIn).getHeadRotationPointY(partialTickTime) * 9.0F; + this.headRotationAngleX = ((EntitySheep)entitylivingbaseIn).getHeadRotationAngleX(partialTickTime); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + this.head.rotateAngleX = this.headRotationAngleX; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelSign.java b/src/minecraft/net/minecraft/client/model/ModelSign.java new file mode 100644 index 0000000..5932cf0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelSign.java @@ -0,0 +1,26 @@ +package net.minecraft.client.model; + +public class ModelSign extends ModelBase +{ + /** The board on a sign that has the writing on it. */ + public ModelRenderer signBoard = new ModelRenderer(this, 0, 0); + + /** The stick a sign stands on. */ + public ModelRenderer signStick; + + public ModelSign() + { + this.signBoard.addBox(-12.0F, -14.0F, -1.0F, 24, 12, 2, 0.0F); + this.signStick = new ModelRenderer(this, 0, 14); + this.signStick.addBox(-1.0F, -2.0F, -1.0F, 2, 14, 2, 0.0F); + } + + /** + * Renders the sign model through TileEntitySignRenderer + */ + public void renderSign() + { + this.signBoard.render(0.0625F); + this.signStick.render(0.0625F); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelSilverfish.java b/src/minecraft/net/minecraft/client/model/ModelSilverfish.java new file mode 100644 index 0000000..178cf86 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelSilverfish.java @@ -0,0 +1,87 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelSilverfish extends ModelBase +{ + /** The body parts of the silverfish's model. */ + private ModelRenderer[] silverfishBodyParts = new ModelRenderer[7]; + + /** The wings (dust-looking sprites) on the silverfish's model. */ + private ModelRenderer[] silverfishWings; + private float[] field_78170_c = new float[7]; + + /** The widths, heights, and lengths for the silverfish model boxes. */ + private static final int[][] silverfishBoxLength = new int[][] {{3, 2, 2}, {4, 3, 2}, {6, 4, 3}, {3, 3, 3}, {2, 2, 3}, {2, 1, 2}, {1, 1, 2}}; + + /** The texture positions for the silverfish's model's boxes. */ + private static final int[][] silverfishTexturePositions = new int[][] {{0, 0}, {0, 4}, {0, 9}, {0, 16}, {0, 22}, {11, 0}, {13, 4}}; + + public ModelSilverfish() + { + float f = -3.5F; + + for (int i = 0; i < this.silverfishBodyParts.length; ++i) + { + this.silverfishBodyParts[i] = new ModelRenderer(this, silverfishTexturePositions[i][0], silverfishTexturePositions[i][1]); + this.silverfishBodyParts[i].addBox((float)silverfishBoxLength[i][0] * -0.5F, 0.0F, (float)silverfishBoxLength[i][2] * -0.5F, silverfishBoxLength[i][0], silverfishBoxLength[i][1], silverfishBoxLength[i][2]); + this.silverfishBodyParts[i].setRotationPoint(0.0F, (float)(24 - silverfishBoxLength[i][1]), f); + this.field_78170_c[i] = f; + + if (i < this.silverfishBodyParts.length - 1) + { + f += (float)(silverfishBoxLength[i][2] + silverfishBoxLength[i + 1][2]) * 0.5F; + } + } + + this.silverfishWings = new ModelRenderer[3]; + this.silverfishWings[0] = new ModelRenderer(this, 20, 0); + this.silverfishWings[0].addBox(-5.0F, 0.0F, (float)silverfishBoxLength[2][2] * -0.5F, 10, 8, silverfishBoxLength[2][2]); + this.silverfishWings[0].setRotationPoint(0.0F, 16.0F, this.field_78170_c[2]); + this.silverfishWings[1] = new ModelRenderer(this, 20, 11); + this.silverfishWings[1].addBox(-3.0F, 0.0F, (float)silverfishBoxLength[4][2] * -0.5F, 6, 4, silverfishBoxLength[4][2]); + this.silverfishWings[1].setRotationPoint(0.0F, 20.0F, this.field_78170_c[4]); + this.silverfishWings[2] = new ModelRenderer(this, 20, 18); + this.silverfishWings[2].addBox(-3.0F, 0.0F, (float)silverfishBoxLength[4][2] * -0.5F, 6, 5, silverfishBoxLength[1][2]); + this.silverfishWings[2].setRotationPoint(0.0F, 19.0F, this.field_78170_c[1]); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + + for (int i = 0; i < this.silverfishBodyParts.length; ++i) + { + this.silverfishBodyParts[i].render(scale); + } + + for (int j = 0; j < this.silverfishWings.length; ++j) + { + this.silverfishWings[j].render(scale); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + for (int i = 0; i < this.silverfishBodyParts.length; ++i) + { + this.silverfishBodyParts[i].rotateAngleY = MathHelper.cos(p_78087_3_ * 0.9F + (float)i * 0.15F * (float)Math.PI) * (float)Math.PI * 0.05F * (float)(1 + Math.abs(i - 2)); + this.silverfishBodyParts[i].rotationPointX = MathHelper.sin(p_78087_3_ * 0.9F + (float)i * 0.15F * (float)Math.PI) * (float)Math.PI * 0.2F * (float)Math.abs(i - 2); + } + + this.silverfishWings[0].rotateAngleY = this.silverfishBodyParts[2].rotateAngleY; + this.silverfishWings[1].rotateAngleY = this.silverfishBodyParts[4].rotateAngleY; + this.silverfishWings[1].rotationPointX = this.silverfishBodyParts[4].rotationPointX; + this.silverfishWings[2].rotateAngleY = this.silverfishBodyParts[1].rotateAngleY; + this.silverfishWings[2].rotationPointX = this.silverfishBodyParts[1].rotationPointX; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelSkeleton.java b/src/minecraft/net/minecraft/client/model/ModelSkeleton.java new file mode 100644 index 0000000..961bede --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelSkeleton.java @@ -0,0 +1,56 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntitySkeleton; + +public class ModelSkeleton extends ModelZombie +{ + public ModelSkeleton() + { + this(0.0F, false); + } + + public ModelSkeleton(float p_i46303_1_, boolean p_i46303_2_) + { + super(p_i46303_1_, 0.0F, 64, 32); + + if (!p_i46303_2_) + { + this.bipedRightArm = new ModelRenderer(this, 40, 16); + this.bipedRightArm.addBox(-1.0F, -2.0F, -1.0F, 2, 12, 2, p_i46303_1_); + this.bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F); + this.bipedLeftArm = new ModelRenderer(this, 40, 16); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1.0F, -2.0F, -1.0F, 2, 12, 2, p_i46303_1_); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F); + this.bipedRightLeg = new ModelRenderer(this, 0, 16); + this.bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 12, 2, p_i46303_1_); + this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F, 0.0F); + this.bipedLeftLeg = new ModelRenderer(this, 0, 16); + this.bipedLeftLeg.mirror = true; + this.bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 12, 2, p_i46303_1_); + this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F, 0.0F); + } + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + this.aimedBow = ((EntitySkeleton)entitylivingbaseIn).getSkeletonType() == 1; + super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelSkeletonHead.java b/src/minecraft/net/minecraft/client/model/ModelSkeletonHead.java new file mode 100644 index 0000000..6570d24 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelSkeletonHead.java @@ -0,0 +1,43 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; + +public class ModelSkeletonHead extends ModelBase +{ + public ModelRenderer skeletonHead; + + public ModelSkeletonHead() + { + this(0, 35, 64, 64); + } + + public ModelSkeletonHead(int p_i1155_1_, int p_i1155_2_, int p_i1155_3_, int p_i1155_4_) + { + this.textureWidth = p_i1155_3_; + this.textureHeight = p_i1155_4_; + this.skeletonHead = new ModelRenderer(this, p_i1155_1_, p_i1155_2_); + this.skeletonHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F); + this.skeletonHead.setRotationPoint(0.0F, 0.0F, 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.skeletonHead.render(scale); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + this.skeletonHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.skeletonHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelSlime.java b/src/minecraft/net/minecraft/client/model/ModelSlime.java new file mode 100644 index 0000000..8c12151 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelSlime.java @@ -0,0 +1,52 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; + +public class ModelSlime extends ModelBase +{ + /** The slime's bodies, both the inside box and the outside box */ + ModelRenderer slimeBodies; + + /** The slime's right eye */ + ModelRenderer slimeRightEye; + + /** The slime's left eye */ + ModelRenderer slimeLeftEye; + + /** The slime's mouth */ + ModelRenderer slimeMouth; + + public ModelSlime(int p_i1157_1_) + { + this.slimeBodies = new ModelRenderer(this, 0, p_i1157_1_); + this.slimeBodies.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8); + + if (p_i1157_1_ > 0) + { + this.slimeBodies = new ModelRenderer(this, 0, p_i1157_1_); + this.slimeBodies.addBox(-3.0F, 17.0F, -3.0F, 6, 6, 6); + this.slimeRightEye = new ModelRenderer(this, 32, 0); + this.slimeRightEye.addBox(-3.25F, 18.0F, -3.5F, 2, 2, 2); + this.slimeLeftEye = new ModelRenderer(this, 32, 4); + this.slimeLeftEye.addBox(1.25F, 18.0F, -3.5F, 2, 2, 2); + this.slimeMouth = new ModelRenderer(this, 32, 8); + this.slimeMouth.addBox(0.0F, 21.0F, -3.5F, 1, 1, 1); + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.slimeBodies.render(scale); + + if (this.slimeRightEye != null) + { + this.slimeRightEye.render(scale); + this.slimeLeftEye.render(scale); + this.slimeMouth.render(scale); + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelSnowMan.java b/src/minecraft/net/minecraft/client/model/ModelSnowMan.java new file mode 100644 index 0000000..dc88b0f --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelSnowMan.java @@ -0,0 +1,70 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelSnowMan extends ModelBase +{ + public ModelRenderer body; + public ModelRenderer bottomBody; + public ModelRenderer head; + public ModelRenderer rightHand; + public ModelRenderer leftHand; + + public ModelSnowMan() + { + float f = 4.0F; + float f1 = 0.0F; + this.head = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); + this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, f1 - 0.5F); + this.head.setRotationPoint(0.0F, 0.0F + f, 0.0F); + this.rightHand = (new ModelRenderer(this, 32, 0)).setTextureSize(64, 64); + this.rightHand.addBox(-1.0F, 0.0F, -1.0F, 12, 2, 2, f1 - 0.5F); + this.rightHand.setRotationPoint(0.0F, 0.0F + f + 9.0F - 7.0F, 0.0F); + this.leftHand = (new ModelRenderer(this, 32, 0)).setTextureSize(64, 64); + this.leftHand.addBox(-1.0F, 0.0F, -1.0F, 12, 2, 2, f1 - 0.5F); + this.leftHand.setRotationPoint(0.0F, 0.0F + f + 9.0F - 7.0F, 0.0F); + this.body = (new ModelRenderer(this, 0, 16)).setTextureSize(64, 64); + this.body.addBox(-5.0F, -10.0F, -5.0F, 10, 10, 10, f1 - 0.5F); + this.body.setRotationPoint(0.0F, 0.0F + f + 9.0F, 0.0F); + this.bottomBody = (new ModelRenderer(this, 0, 36)).setTextureSize(64, 64); + this.bottomBody.addBox(-6.0F, -12.0F, -6.0F, 12, 12, 12, f1 - 0.5F); + this.bottomBody.setRotationPoint(0.0F, 0.0F + f + 20.0F, 0.0F); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + this.head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.body.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI) * 0.25F; + float f = MathHelper.sin(this.body.rotateAngleY); + float f1 = MathHelper.cos(this.body.rotateAngleY); + this.rightHand.rotateAngleZ = 1.0F; + this.leftHand.rotateAngleZ = -1.0F; + this.rightHand.rotateAngleY = 0.0F + this.body.rotateAngleY; + this.leftHand.rotateAngleY = (float)Math.PI + this.body.rotateAngleY; + this.rightHand.rotationPointX = f1 * 5.0F; + this.rightHand.rotationPointZ = -f * 5.0F; + this.leftHand.rotationPointX = -f1 * 5.0F; + this.leftHand.rotationPointZ = f * 5.0F; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.body.render(scale); + this.bottomBody.render(scale); + this.head.render(scale); + this.rightHand.render(scale); + this.leftHand.render(scale); + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelSpider.java b/src/minecraft/net/minecraft/client/model/ModelSpider.java new file mode 100644 index 0000000..e718401 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelSpider.java @@ -0,0 +1,152 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelSpider extends ModelBase +{ + /** The spider's head box */ + public ModelRenderer spiderHead; + + /** The spider's neck box */ + public ModelRenderer spiderNeck; + + /** The spider's body box */ + public ModelRenderer spiderBody; + + /** Spider's first leg */ + public ModelRenderer spiderLeg1; + + /** Spider's second leg */ + public ModelRenderer spiderLeg2; + + /** Spider's third leg */ + public ModelRenderer spiderLeg3; + + /** Spider's fourth leg */ + public ModelRenderer spiderLeg4; + + /** Spider's fifth leg */ + public ModelRenderer spiderLeg5; + + /** Spider's sixth leg */ + public ModelRenderer spiderLeg6; + + /** Spider's seventh leg */ + public ModelRenderer spiderLeg7; + + /** Spider's eight leg */ + public ModelRenderer spiderLeg8; + + public ModelSpider() + { + float f = 0.0F; + int i = 15; + this.spiderHead = new ModelRenderer(this, 32, 4); + this.spiderHead.addBox(-4.0F, -4.0F, -8.0F, 8, 8, 8, f); + this.spiderHead.setRotationPoint(0.0F, (float)i, -3.0F); + this.spiderNeck = new ModelRenderer(this, 0, 0); + this.spiderNeck.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6, f); + this.spiderNeck.setRotationPoint(0.0F, (float)i, 0.0F); + this.spiderBody = new ModelRenderer(this, 0, 12); + this.spiderBody.addBox(-5.0F, -4.0F, -6.0F, 10, 8, 12, f); + this.spiderBody.setRotationPoint(0.0F, (float)i, 9.0F); + this.spiderLeg1 = new ModelRenderer(this, 18, 0); + this.spiderLeg1.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, f); + this.spiderLeg1.setRotationPoint(-4.0F, (float)i, 2.0F); + this.spiderLeg2 = new ModelRenderer(this, 18, 0); + this.spiderLeg2.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, f); + this.spiderLeg2.setRotationPoint(4.0F, (float)i, 2.0F); + this.spiderLeg3 = new ModelRenderer(this, 18, 0); + this.spiderLeg3.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, f); + this.spiderLeg3.setRotationPoint(-4.0F, (float)i, 1.0F); + this.spiderLeg4 = new ModelRenderer(this, 18, 0); + this.spiderLeg4.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, f); + this.spiderLeg4.setRotationPoint(4.0F, (float)i, 1.0F); + this.spiderLeg5 = new ModelRenderer(this, 18, 0); + this.spiderLeg5.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, f); + this.spiderLeg5.setRotationPoint(-4.0F, (float)i, 0.0F); + this.spiderLeg6 = new ModelRenderer(this, 18, 0); + this.spiderLeg6.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, f); + this.spiderLeg6.setRotationPoint(4.0F, (float)i, 0.0F); + this.spiderLeg7 = new ModelRenderer(this, 18, 0); + this.spiderLeg7.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, f); + this.spiderLeg7.setRotationPoint(-4.0F, (float)i, -1.0F); + this.spiderLeg8 = new ModelRenderer(this, 18, 0); + this.spiderLeg8.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, f); + this.spiderLeg8.setRotationPoint(4.0F, (float)i, -1.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.spiderHead.render(scale); + this.spiderNeck.render(scale); + this.spiderBody.render(scale); + this.spiderLeg1.render(scale); + this.spiderLeg2.render(scale); + this.spiderLeg3.render(scale); + this.spiderLeg4.render(scale); + this.spiderLeg5.render(scale); + this.spiderLeg6.render(scale); + this.spiderLeg7.render(scale); + this.spiderLeg8.render(scale); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + this.spiderHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.spiderHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + float f = ((float)Math.PI / 4F); + this.spiderLeg1.rotateAngleZ = -f; + this.spiderLeg2.rotateAngleZ = f; + this.spiderLeg3.rotateAngleZ = -f * 0.74F; + this.spiderLeg4.rotateAngleZ = f * 0.74F; + this.spiderLeg5.rotateAngleZ = -f * 0.74F; + this.spiderLeg6.rotateAngleZ = f * 0.74F; + this.spiderLeg7.rotateAngleZ = -f; + this.spiderLeg8.rotateAngleZ = f; + float f1 = -0.0F; + float f2 = 0.3926991F; + this.spiderLeg1.rotateAngleY = f2 * 2.0F + f1; + this.spiderLeg2.rotateAngleY = -f2 * 2.0F - f1; + this.spiderLeg3.rotateAngleY = f2 * 1.0F + f1; + this.spiderLeg4.rotateAngleY = -f2 * 1.0F - f1; + this.spiderLeg5.rotateAngleY = -f2 * 1.0F + f1; + this.spiderLeg6.rotateAngleY = f2 * 1.0F - f1; + this.spiderLeg7.rotateAngleY = -f2 * 2.0F + f1; + this.spiderLeg8.rotateAngleY = f2 * 2.0F - f1; + float f3 = -(MathHelper.cos(p_78087_1_ * 0.6662F * 2.0F + 0.0F) * 0.4F) * p_78087_2_; + float f4 = -(MathHelper.cos(p_78087_1_ * 0.6662F * 2.0F + (float)Math.PI) * 0.4F) * p_78087_2_; + float f5 = -(MathHelper.cos(p_78087_1_ * 0.6662F * 2.0F + ((float)Math.PI / 2F)) * 0.4F) * p_78087_2_; + float f6 = -(MathHelper.cos(p_78087_1_ * 0.6662F * 2.0F + ((float)Math.PI * 3F / 2F)) * 0.4F) * p_78087_2_; + float f7 = Math.abs(MathHelper.sin(p_78087_1_ * 0.6662F + 0.0F) * 0.4F) * p_78087_2_; + float f8 = Math.abs(MathHelper.sin(p_78087_1_ * 0.6662F + (float)Math.PI) * 0.4F) * p_78087_2_; + float f9 = Math.abs(MathHelper.sin(p_78087_1_ * 0.6662F + ((float)Math.PI / 2F)) * 0.4F) * p_78087_2_; + float f10 = Math.abs(MathHelper.sin(p_78087_1_ * 0.6662F + ((float)Math.PI * 3F / 2F)) * 0.4F) * p_78087_2_; + this.spiderLeg1.rotateAngleY += f3; + this.spiderLeg2.rotateAngleY += -f3; + this.spiderLeg3.rotateAngleY += f4; + this.spiderLeg4.rotateAngleY += -f4; + this.spiderLeg5.rotateAngleY += f5; + this.spiderLeg6.rotateAngleY += -f5; + this.spiderLeg7.rotateAngleY += f6; + this.spiderLeg8.rotateAngleY += -f6; + this.spiderLeg1.rotateAngleZ += f7; + this.spiderLeg2.rotateAngleZ += -f7; + this.spiderLeg3.rotateAngleZ += f8; + this.spiderLeg4.rotateAngleZ += -f8; + this.spiderLeg5.rotateAngleZ += f9; + this.spiderLeg6.rotateAngleZ += -f9; + this.spiderLeg7.rotateAngleZ += f10; + this.spiderLeg8.rotateAngleZ += -f10; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelSquid.java b/src/minecraft/net/minecraft/client/model/ModelSquid.java new file mode 100644 index 0000000..5145545 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelSquid.java @@ -0,0 +1,61 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; + +public class ModelSquid extends ModelBase +{ + /** The squid's body */ + ModelRenderer squidBody; + + /** The squid's tentacles */ + ModelRenderer[] squidTentacles = new ModelRenderer[8]; + + public ModelSquid() + { + int i = -16; + this.squidBody = new ModelRenderer(this, 0, 0); + this.squidBody.addBox(-6.0F, -8.0F, -6.0F, 12, 16, 12); + this.squidBody.rotationPointY += (float)(24 + i); + + for (int j = 0; j < this.squidTentacles.length; ++j) + { + this.squidTentacles[j] = new ModelRenderer(this, 48, 0); + double d0 = (double)j * Math.PI * 2.0D / (double)this.squidTentacles.length; + float f = (float)Math.cos(d0) * 5.0F; + float f1 = (float)Math.sin(d0) * 5.0F; + this.squidTentacles[j].addBox(-1.0F, 0.0F, -1.0F, 2, 18, 2); + this.squidTentacles[j].rotationPointX = f; + this.squidTentacles[j].rotationPointZ = f1; + this.squidTentacles[j].rotationPointY = (float)(31 + i); + d0 = (double)j * Math.PI * -2.0D / (double)this.squidTentacles.length + (Math.PI / 2D); + this.squidTentacles[j].rotateAngleY = (float)d0; + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + for (ModelRenderer modelrenderer : this.squidTentacles) + { + modelrenderer.rotateAngleX = p_78087_3_; + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.squidBody.render(scale); + + for (int i = 0; i < this.squidTentacles.length; ++i) + { + this.squidTentacles[i].render(scale); + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelVillager.java b/src/minecraft/net/minecraft/client/model/ModelVillager.java new file mode 100644 index 0000000..4a7eda7 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelVillager.java @@ -0,0 +1,86 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelVillager extends ModelBase +{ + /** The head box of the VillagerModel */ + public ModelRenderer villagerHead; + + /** The body of the VillagerModel */ + public ModelRenderer villagerBody; + + /** The arms of the VillagerModel */ + public ModelRenderer villagerArms; + + /** The right leg of the VillagerModel */ + public ModelRenderer rightVillagerLeg; + + /** The left leg of the VillagerModel */ + public ModelRenderer leftVillagerLeg; + public ModelRenderer villagerNose; + + public ModelVillager(float p_i1163_1_) + { + this(p_i1163_1_, 0.0F, 64, 64); + } + + public ModelVillager(float p_i1164_1_, float p_i1164_2_, int p_i1164_3_, int p_i1164_4_) + { + this.villagerHead = (new ModelRenderer(this)).setTextureSize(p_i1164_3_, p_i1164_4_); + this.villagerHead.setRotationPoint(0.0F, 0.0F + p_i1164_2_, 0.0F); + this.villagerHead.setTextureOffset(0, 0).addBox(-4.0F, -10.0F, -4.0F, 8, 10, 8, p_i1164_1_); + this.villagerNose = (new ModelRenderer(this)).setTextureSize(p_i1164_3_, p_i1164_4_); + this.villagerNose.setRotationPoint(0.0F, p_i1164_2_ - 2.0F, 0.0F); + this.villagerNose.setTextureOffset(24, 0).addBox(-1.0F, -1.0F, -6.0F, 2, 4, 2, p_i1164_1_); + this.villagerHead.addChild(this.villagerNose); + this.villagerBody = (new ModelRenderer(this)).setTextureSize(p_i1164_3_, p_i1164_4_); + this.villagerBody.setRotationPoint(0.0F, 0.0F + p_i1164_2_, 0.0F); + this.villagerBody.setTextureOffset(16, 20).addBox(-4.0F, 0.0F, -3.0F, 8, 12, 6, p_i1164_1_); + this.villagerBody.setTextureOffset(0, 38).addBox(-4.0F, 0.0F, -3.0F, 8, 18, 6, p_i1164_1_ + 0.5F); + this.villagerArms = (new ModelRenderer(this)).setTextureSize(p_i1164_3_, p_i1164_4_); + this.villagerArms.setRotationPoint(0.0F, 0.0F + p_i1164_2_ + 2.0F, 0.0F); + this.villagerArms.setTextureOffset(44, 22).addBox(-8.0F, -2.0F, -2.0F, 4, 8, 4, p_i1164_1_); + this.villagerArms.setTextureOffset(44, 22).addBox(4.0F, -2.0F, -2.0F, 4, 8, 4, p_i1164_1_); + this.villagerArms.setTextureOffset(40, 38).addBox(-4.0F, 2.0F, -2.0F, 8, 4, 4, p_i1164_1_); + this.rightVillagerLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(p_i1164_3_, p_i1164_4_); + this.rightVillagerLeg.setRotationPoint(-2.0F, 12.0F + p_i1164_2_, 0.0F); + this.rightVillagerLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, p_i1164_1_); + this.leftVillagerLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(p_i1164_3_, p_i1164_4_); + this.leftVillagerLeg.mirror = true; + this.leftVillagerLeg.setRotationPoint(2.0F, 12.0F + p_i1164_2_, 0.0F); + this.leftVillagerLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, p_i1164_1_); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + this.villagerHead.render(scale); + this.villagerBody.render(scale); + this.rightVillagerLeg.render(scale); + this.leftVillagerLeg.render(scale); + this.villagerArms.render(scale); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + this.villagerHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.villagerHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.villagerArms.rotationPointY = 3.0F; + this.villagerArms.rotationPointZ = -1.0F; + this.villagerArms.rotateAngleX = -0.75F; + this.rightVillagerLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_ * 0.5F; + this.leftVillagerLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_ * 0.5F; + this.rightVillagerLeg.rotateAngleY = 0.0F; + this.leftVillagerLeg.rotateAngleY = 0.0F; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelWitch.java b/src/minecraft/net/minecraft/client/model/ModelWitch.java new file mode 100644 index 0000000..e62a568 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelWitch.java @@ -0,0 +1,63 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelWitch extends ModelVillager +{ + public boolean field_82900_g; + private ModelRenderer field_82901_h = (new ModelRenderer(this)).setTextureSize(64, 128); + private ModelRenderer witchHat; + + public ModelWitch(float p_i46361_1_) + { + super(p_i46361_1_, 0.0F, 64, 128); + this.field_82901_h.setRotationPoint(0.0F, -2.0F, 0.0F); + this.field_82901_h.setTextureOffset(0, 0).addBox(0.0F, 3.0F, -6.75F, 1, 1, 1, -0.25F); + this.villagerNose.addChild(this.field_82901_h); + this.witchHat = (new ModelRenderer(this)).setTextureSize(64, 128); + this.witchHat.setRotationPoint(-5.0F, -10.03125F, -5.0F); + this.witchHat.setTextureOffset(0, 64).addBox(0.0F, 0.0F, 0.0F, 10, 2, 10); + this.villagerHead.addChild(this.witchHat); + ModelRenderer modelrenderer = (new ModelRenderer(this)).setTextureSize(64, 128); + modelrenderer.setRotationPoint(1.75F, -4.0F, 2.0F); + modelrenderer.setTextureOffset(0, 76).addBox(0.0F, 0.0F, 0.0F, 7, 4, 7); + modelrenderer.rotateAngleX = -0.05235988F; + modelrenderer.rotateAngleZ = 0.02617994F; + this.witchHat.addChild(modelrenderer); + ModelRenderer modelrenderer1 = (new ModelRenderer(this)).setTextureSize(64, 128); + modelrenderer1.setRotationPoint(1.75F, -4.0F, 2.0F); + modelrenderer1.setTextureOffset(0, 87).addBox(0.0F, 0.0F, 0.0F, 4, 4, 4); + modelrenderer1.rotateAngleX = -0.10471976F; + modelrenderer1.rotateAngleZ = 0.05235988F; + modelrenderer.addChild(modelrenderer1); + ModelRenderer modelrenderer2 = (new ModelRenderer(this)).setTextureSize(64, 128); + modelrenderer2.setRotationPoint(1.75F, -2.0F, 2.0F); + modelrenderer2.setTextureOffset(0, 95).addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.25F); + modelrenderer2.rotateAngleX = -0.20943952F; + modelrenderer2.rotateAngleZ = 0.10471976F; + modelrenderer1.addChild(modelrenderer2); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + this.villagerNose.offsetX = this.villagerNose.offsetY = this.villagerNose.offsetZ = 0.0F; + float f = 0.01F * (float)(entityIn.getEntityId() % 10); + this.villagerNose.rotateAngleX = MathHelper.sin((float)entityIn.ticksExisted * f) * 4.5F * (float)Math.PI / 180.0F; + this.villagerNose.rotateAngleY = 0.0F; + this.villagerNose.rotateAngleZ = MathHelper.cos((float)entityIn.ticksExisted * f) * 2.5F * (float)Math.PI / 180.0F; + + if (this.field_82900_g) + { + this.villagerNose.rotateAngleX = -0.9F; + this.villagerNose.offsetZ = -0.09375F; + this.villagerNose.offsetY = 0.1875F; + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelWither.java b/src/minecraft/net/minecraft/client/model/ModelWither.java new file mode 100644 index 0000000..212946b --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelWither.java @@ -0,0 +1,88 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.util.MathHelper; + +public class ModelWither extends ModelBase +{ + private ModelRenderer[] field_82905_a; + private ModelRenderer[] field_82904_b; + + public ModelWither(float p_i46302_1_) + { + this.textureWidth = 64; + this.textureHeight = 64; + this.field_82905_a = new ModelRenderer[3]; + this.field_82905_a[0] = new ModelRenderer(this, 0, 16); + this.field_82905_a[0].addBox(-10.0F, 3.9F, -0.5F, 20, 3, 3, p_i46302_1_); + this.field_82905_a[1] = (new ModelRenderer(this)).setTextureSize(this.textureWidth, this.textureHeight); + this.field_82905_a[1].setRotationPoint(-2.0F, 6.9F, -0.5F); + this.field_82905_a[1].setTextureOffset(0, 22).addBox(0.0F, 0.0F, 0.0F, 3, 10, 3, p_i46302_1_); + this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 1.5F, 0.5F, 11, 2, 2, p_i46302_1_); + this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 4.0F, 0.5F, 11, 2, 2, p_i46302_1_); + this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 6.5F, 0.5F, 11, 2, 2, p_i46302_1_); + this.field_82905_a[2] = new ModelRenderer(this, 12, 22); + this.field_82905_a[2].addBox(0.0F, 0.0F, 0.0F, 3, 6, 3, p_i46302_1_); + this.field_82904_b = new ModelRenderer[3]; + this.field_82904_b[0] = new ModelRenderer(this, 0, 0); + this.field_82904_b[0].addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8, p_i46302_1_); + this.field_82904_b[1] = new ModelRenderer(this, 32, 0); + this.field_82904_b[1].addBox(-4.0F, -4.0F, -4.0F, 6, 6, 6, p_i46302_1_); + this.field_82904_b[1].rotationPointX = -8.0F; + this.field_82904_b[1].rotationPointY = 4.0F; + this.field_82904_b[2] = new ModelRenderer(this, 32, 0); + this.field_82904_b[2].addBox(-4.0F, -4.0F, -4.0F, 6, 6, 6, p_i46302_1_); + this.field_82904_b[2].rotationPointX = 10.0F; + this.field_82904_b[2].rotationPointY = 4.0F; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + + for (ModelRenderer modelrenderer : this.field_82904_b) + { + modelrenderer.render(scale); + } + + for (ModelRenderer modelrenderer1 : this.field_82905_a) + { + modelrenderer1.render(scale); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + float f = MathHelper.cos(p_78087_3_ * 0.1F); + this.field_82905_a[1].rotateAngleX = (0.065F + 0.05F * f) * (float)Math.PI; + this.field_82905_a[2].setRotationPoint(-2.0F, 6.9F + MathHelper.cos(this.field_82905_a[1].rotateAngleX) * 10.0F, -0.5F + MathHelper.sin(this.field_82905_a[1].rotateAngleX) * 10.0F); + this.field_82905_a[2].rotateAngleX = (0.265F + 0.1F * f) * (float)Math.PI; + this.field_82904_b[0].rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.field_82904_b[0].rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + EntityWither entitywither = (EntityWither)entitylivingbaseIn; + + for (int i = 1; i < 3; ++i) + { + this.field_82904_b[i].rotateAngleY = (entitywither.func_82207_a(i - 1) - entitylivingbaseIn.renderYawOffset) / (180F / (float)Math.PI); + this.field_82904_b[i].rotateAngleX = entitywither.func_82210_r(i - 1) / (180F / (float)Math.PI); + } + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelWolf.java b/src/minecraft/net/minecraft/client/model/ModelWolf.java new file mode 100644 index 0000000..445e7fe --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelWolf.java @@ -0,0 +1,177 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.util.MathHelper; + +public class ModelWolf extends ModelBase +{ + /** main box for the wolf head */ + public ModelRenderer wolfHeadMain; + + /** The wolf's body */ + public ModelRenderer wolfBody; + + /** Wolf'se first leg */ + public ModelRenderer wolfLeg1; + + /** Wolf's second leg */ + public ModelRenderer wolfLeg2; + + /** Wolf's third leg */ + public ModelRenderer wolfLeg3; + + /** Wolf's fourth leg */ + public ModelRenderer wolfLeg4; + + /** The wolf's tail */ + ModelRenderer wolfTail; + + /** The wolf's mane */ + ModelRenderer wolfMane; + + public ModelWolf() + { + float f = 0.0F; + float f1 = 13.5F; + this.wolfHeadMain = new ModelRenderer(this, 0, 0); + this.wolfHeadMain.addBox(-3.0F, -3.0F, -2.0F, 6, 6, 4, f); + this.wolfHeadMain.setRotationPoint(-1.0F, f1, -7.0F); + this.wolfBody = new ModelRenderer(this, 18, 14); + this.wolfBody.addBox(-4.0F, -2.0F, -3.0F, 6, 9, 6, f); + this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F); + this.wolfMane = new ModelRenderer(this, 21, 0); + this.wolfMane.addBox(-4.0F, -3.0F, -3.0F, 8, 6, 7, f); + this.wolfMane.setRotationPoint(-1.0F, 14.0F, 2.0F); + this.wolfLeg1 = new ModelRenderer(this, 0, 18); + this.wolfLeg1.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F); + this.wolfLeg2 = new ModelRenderer(this, 0, 18); + this.wolfLeg2.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F); + this.wolfLeg3 = new ModelRenderer(this, 0, 18); + this.wolfLeg3.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F); + this.wolfLeg4 = new ModelRenderer(this, 0, 18); + this.wolfLeg4.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F); + this.wolfTail = new ModelRenderer(this, 9, 18); + this.wolfTail.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f); + this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F); + this.wolfHeadMain.setTextureOffset(16, 14).addBox(-3.0F, -5.0F, 0.0F, 2, 2, 1, f); + this.wolfHeadMain.setTextureOffset(16, 14).addBox(1.0F, -5.0F, 0.0F, 2, 2, 1, f); + this.wolfHeadMain.setTextureOffset(0, 10).addBox(-1.5F, 0.0F, -5.0F, 3, 3, 4, f); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) + { + super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale); + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); + + if (this.isChild) + { + float f = 2.0F; + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 5.0F * scale, 2.0F * scale); + this.wolfHeadMain.renderWithRotation(scale); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f); + GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); + this.wolfBody.render(scale); + this.wolfLeg1.render(scale); + this.wolfLeg2.render(scale); + this.wolfLeg3.render(scale); + this.wolfLeg4.render(scale); + this.wolfTail.renderWithRotation(scale); + this.wolfMane.render(scale); + GlStateManager.popMatrix(); + } + else + { + this.wolfHeadMain.renderWithRotation(scale); + this.wolfBody.render(scale); + this.wolfLeg1.render(scale); + this.wolfLeg2.render(scale); + this.wolfLeg3.render(scale); + this.wolfLeg4.render(scale); + this.wolfTail.renderWithRotation(scale); + this.wolfMane.render(scale); + } + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) + { + EntityWolf entitywolf = (EntityWolf)entitylivingbaseIn; + + if (entitywolf.isAngry()) + { + this.wolfTail.rotateAngleY = 0.0F; + } + else + { + this.wolfTail.rotateAngleY = MathHelper.cos(p_78086_2_ * 0.6662F) * 1.4F * p_78086_3_; + } + + if (entitywolf.isSitting()) + { + this.wolfMane.setRotationPoint(-1.0F, 16.0F, -3.0F); + this.wolfMane.rotateAngleX = ((float)Math.PI * 2F / 5F); + this.wolfMane.rotateAngleY = 0.0F; + this.wolfBody.setRotationPoint(0.0F, 18.0F, 0.0F); + this.wolfBody.rotateAngleX = ((float)Math.PI / 4F); + this.wolfTail.setRotationPoint(-1.0F, 21.0F, 6.0F); + this.wolfLeg1.setRotationPoint(-2.5F, 22.0F, 2.0F); + this.wolfLeg1.rotateAngleX = ((float)Math.PI * 3F / 2F); + this.wolfLeg2.setRotationPoint(0.5F, 22.0F, 2.0F); + this.wolfLeg2.rotateAngleX = ((float)Math.PI * 3F / 2F); + this.wolfLeg3.rotateAngleX = 5.811947F; + this.wolfLeg3.setRotationPoint(-2.49F, 17.0F, -4.0F); + this.wolfLeg4.rotateAngleX = 5.811947F; + this.wolfLeg4.setRotationPoint(0.51F, 17.0F, -4.0F); + } + else + { + this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F); + this.wolfBody.rotateAngleX = ((float)Math.PI / 2F); + this.wolfMane.setRotationPoint(-1.0F, 14.0F, -3.0F); + this.wolfMane.rotateAngleX = this.wolfBody.rotateAngleX; + this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F); + this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F); + this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F); + this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F); + this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F); + this.wolfLeg1.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F) * 1.4F * p_78086_3_; + this.wolfLeg2.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F + (float)Math.PI) * 1.4F * p_78086_3_; + this.wolfLeg3.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F + (float)Math.PI) * 1.4F * p_78086_3_; + this.wolfLeg4.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F) * 1.4F * p_78086_3_; + } + + this.wolfHeadMain.rotateAngleZ = entitywolf.getInterestedAngle(partialTickTime) + entitywolf.getShakeAngle(partialTickTime, 0.0F); + this.wolfMane.rotateAngleZ = entitywolf.getShakeAngle(partialTickTime, -0.08F); + this.wolfBody.rotateAngleZ = entitywolf.getShakeAngle(partialTickTime, -0.16F); + this.wolfTail.rotateAngleZ = entitywolf.getShakeAngle(partialTickTime, -0.2F); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + this.wolfHeadMain.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.wolfHeadMain.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.wolfTail.rotateAngleX = p_78087_3_; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelZombie.java b/src/minecraft/net/minecraft/client/model/ModelZombie.java new file mode 100644 index 0000000..c6df733 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelZombie.java @@ -0,0 +1,46 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelZombie extends ModelBiped +{ + public ModelZombie() + { + this(0.0F, false); + } + + protected ModelZombie(float modelSize, float p_i1167_2_, int textureWidthIn, int textureHeightIn) + { + super(modelSize, p_i1167_2_, textureWidthIn, textureHeightIn); + } + + public ModelZombie(float modelSize, boolean p_i1168_2_) + { + super(modelSize, 0.0F, 64, p_i1168_2_ ? 32 : 64); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + float f = MathHelper.sin(this.swingProgress * (float)Math.PI); + float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI); + this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleZ = 0.0F; + this.bipedRightArm.rotateAngleY = -(0.1F - f * 0.6F); + this.bipedLeftArm.rotateAngleY = 0.1F - f * 0.6F; + this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F); + this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F); + this.bipedRightArm.rotateAngleX -= f * 1.2F - f1 * 0.4F; + this.bipedLeftArm.rotateAngleX -= f * 1.2F - f1 * 0.4F; + this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; + } +} diff --git a/src/minecraft/net/minecraft/client/model/ModelZombieVillager.java b/src/minecraft/net/minecraft/client/model/ModelZombieVillager.java new file mode 100644 index 0000000..9bf5462 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/ModelZombieVillager.java @@ -0,0 +1,55 @@ +package net.minecraft.client.model; + +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelZombieVillager extends ModelBiped +{ + public ModelZombieVillager() + { + this(0.0F, 0.0F, false); + } + + public ModelZombieVillager(float p_i1165_1_, float p_i1165_2_, boolean p_i1165_3_) + { + super(p_i1165_1_, 0.0F, 64, p_i1165_3_ ? 32 : 64); + + if (p_i1165_3_) + { + this.bipedHead = new ModelRenderer(this, 0, 0); + this.bipedHead.addBox(-4.0F, -10.0F, -4.0F, 8, 8, 8, p_i1165_1_); + this.bipedHead.setRotationPoint(0.0F, 0.0F + p_i1165_2_, 0.0F); + } + else + { + this.bipedHead = new ModelRenderer(this); + this.bipedHead.setRotationPoint(0.0F, 0.0F + p_i1165_2_, 0.0F); + this.bipedHead.setTextureOffset(0, 32).addBox(-4.0F, -10.0F, -4.0F, 8, 10, 8, p_i1165_1_); + this.bipedHead.setTextureOffset(24, 32).addBox(-1.0F, -3.0F, -6.0F, 2, 4, 2, p_i1165_1_); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entityIn) + { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entityIn); + float f = MathHelper.sin(this.swingProgress * (float)Math.PI); + float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI); + this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleZ = 0.0F; + this.bipedRightArm.rotateAngleY = -(0.1F - f * 0.6F); + this.bipedLeftArm.rotateAngleY = 0.1F - f * 0.6F; + this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F); + this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F); + this.bipedRightArm.rotateAngleX -= f * 1.2F - f1 * 0.4F; + this.bipedLeftArm.rotateAngleX -= f * 1.2F - f1 * 0.4F; + this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F; + } +} diff --git a/src/minecraft/net/minecraft/client/model/PositionTextureVertex.java b/src/minecraft/net/minecraft/client/model/PositionTextureVertex.java new file mode 100644 index 0000000..1747564 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/PositionTextureVertex.java @@ -0,0 +1,34 @@ +package net.minecraft.client.model; + +import net.minecraft.util.Vec3; + +public class PositionTextureVertex +{ + public Vec3 vector3D; + public float texturePositionX; + public float texturePositionY; + + public PositionTextureVertex(float p_i1158_1_, float p_i1158_2_, float p_i1158_3_, float p_i1158_4_, float p_i1158_5_) + { + this(new Vec3((double)p_i1158_1_, (double)p_i1158_2_, (double)p_i1158_3_), p_i1158_4_, p_i1158_5_); + } + + public PositionTextureVertex setTexturePosition(float p_78240_1_, float p_78240_2_) + { + return new PositionTextureVertex(this, p_78240_1_, p_78240_2_); + } + + public PositionTextureVertex(PositionTextureVertex textureVertex, float texturePositionXIn, float texturePositionYIn) + { + this.vector3D = textureVertex.vector3D; + this.texturePositionX = texturePositionXIn; + this.texturePositionY = texturePositionYIn; + } + + public PositionTextureVertex(Vec3 vector3DIn, float texturePositionXIn, float texturePositionYIn) + { + this.vector3D = vector3DIn; + this.texturePositionX = texturePositionXIn; + this.texturePositionY = texturePositionYIn; + } +} diff --git a/src/minecraft/net/minecraft/client/model/TextureOffset.java b/src/minecraft/net/minecraft/client/model/TextureOffset.java new file mode 100644 index 0000000..e411ae6 --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/TextureOffset.java @@ -0,0 +1,16 @@ +package net.minecraft.client.model; + +public class TextureOffset +{ + /** The x coordinate offset of the texture */ + public final int textureOffsetX; + + /** The y coordinate offset of the texture */ + public final int textureOffsetY; + + public TextureOffset(int textureOffsetXIn, int textureOffsetYIn) + { + this.textureOffsetX = textureOffsetXIn; + this.textureOffsetY = textureOffsetYIn; + } +} diff --git a/src/minecraft/net/minecraft/client/model/TexturedQuad.java b/src/minecraft/net/minecraft/client/model/TexturedQuad.java new file mode 100644 index 0000000..6df971f --- /dev/null +++ b/src/minecraft/net/minecraft/client/model/TexturedQuad.java @@ -0,0 +1,83 @@ +package net.minecraft.client.model; + +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.Vec3; +import optifine.Config; +import shadersmod.client.SVertexFormat; + +public class TexturedQuad +{ + public PositionTextureVertex[] vertexPositions; + public int nVertices; + private boolean invertNormal; + private static final String __OBFID = "CL_00000850"; + + public TexturedQuad(PositionTextureVertex[] vertices) + { + this.vertexPositions = vertices; + this.nVertices = vertices.length; + } + + public TexturedQuad(PositionTextureVertex[] vertices, int texcoordU1, int texcoordV1, int texcoordU2, int texcoordV2, float textureWidth, float textureHeight) + { + this(vertices); + float f = 0.0F / textureWidth; + float f1 = 0.0F / textureHeight; + vertices[0] = vertices[0].setTexturePosition((float)texcoordU2 / textureWidth - f, (float)texcoordV1 / textureHeight + f1); + vertices[1] = vertices[1].setTexturePosition((float)texcoordU1 / textureWidth + f, (float)texcoordV1 / textureHeight + f1); + vertices[2] = vertices[2].setTexturePosition((float)texcoordU1 / textureWidth + f, (float)texcoordV2 / textureHeight - f1); + vertices[3] = vertices[3].setTexturePosition((float)texcoordU2 / textureWidth - f, (float)texcoordV2 / textureHeight - f1); + } + + public void flipFace() + { + PositionTextureVertex[] apositiontexturevertex = new PositionTextureVertex[this.vertexPositions.length]; + + for (int i = 0; i < this.vertexPositions.length; ++i) + { + apositiontexturevertex[i] = this.vertexPositions[this.vertexPositions.length - i - 1]; + } + + this.vertexPositions = apositiontexturevertex; + } + + /** + * Draw this primitve. This is typically called only once as the generated drawing instructions are saved by the + * renderer and reused later. + */ + public void draw(WorldRenderer renderer, float scale) + { + Vec3 vec3 = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[0].vector3D); + Vec3 vec31 = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[2].vector3D); + Vec3 vec32 = vec31.crossProduct(vec3).normalize(); + float f = (float)vec32.xCoord; + float f1 = (float)vec32.yCoord; + float f2 = (float)vec32.zCoord; + + if (this.invertNormal) + { + f = -f; + f1 = -f1; + f2 = -f2; + } + + if (Config.isShaders()) + { + renderer.begin(7, SVertexFormat.defVertexFormatTextured); + } + else + { + renderer.begin(7, DefaultVertexFormats.OLDMODEL_POSITION_TEX_NORMAL); + } + + for (int i = 0; i < 4; ++i) + { + PositionTextureVertex positiontexturevertex = this.vertexPositions[i]; + renderer.pos(positiontexturevertex.vector3D.xCoord * (double)scale, positiontexturevertex.vector3D.yCoord * (double)scale, positiontexturevertex.vector3D.zCoord * (double)scale).tex((double)positiontexturevertex.texturePositionX, (double)positiontexturevertex.texturePositionY).normal(f, f1, f2).endVertex(); + } + + Tessellator.getInstance().draw(); + } +} diff --git a/src/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java b/src/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java new file mode 100644 index 0000000..722ca80 --- /dev/null +++ b/src/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java @@ -0,0 +1,174 @@ +package net.minecraft.client.multiplayer; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.LongHashMap; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.EmptyChunk; +import net.minecraft.world.chunk.IChunkProvider; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ChunkProviderClient implements IChunkProvider +{ + private static final Logger logger = LogManager.getLogger(); + + /** + * The completely empty chunk used by ChunkProviderClient when chunkMapping doesn't contain the requested + * coordinates. + */ + private Chunk blankChunk; + private LongHashMap chunkMapping = new LongHashMap(); + private List chunkListing = Lists.newArrayList(); + + /** Reference to the World object. */ + private World worldObj; + + public ChunkProviderClient(World worldIn) + { + this.blankChunk = new EmptyChunk(worldIn, 0, 0); + this.worldObj = worldIn; + } + + /** + * Checks to see if a chunk exists at x, z + */ + public boolean chunkExists(int x, int z) + { + return true; + } + + /** + * Unload chunk from ChunkProviderClient's hashmap. Called in response to a Packet50PreChunk with its mode field set + * to false + */ + public void unloadChunk(int p_73234_1_, int p_73234_2_) + { + Chunk chunk = this.provideChunk(p_73234_1_, p_73234_2_); + + if (!chunk.isEmpty()) + { + chunk.onChunkUnload(); + } + + this.chunkMapping.remove(ChunkCoordIntPair.chunkXZ2Int(p_73234_1_, p_73234_2_)); + this.chunkListing.remove(chunk); + } + + /** + * loads or generates the chunk at the chunk location specified + */ + public Chunk loadChunk(int p_73158_1_, int p_73158_2_) + { + Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_); + this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk); + this.chunkListing.add(chunk); + chunk.setChunkLoaded(true); + return chunk; + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int x, int z) + { + Chunk chunk = (Chunk)this.chunkMapping.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(x, z)); + return chunk == null ? this.blankChunk : chunk; + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean p_73151_1_, IProgressUpdate progressCallback) + { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() + { + } + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + long i = System.currentTimeMillis(); + + for (Chunk chunk : this.chunkListing) + { + chunk.func_150804_b(System.currentTimeMillis() - i > 5L); + } + + if (System.currentTimeMillis() - i > 100L) + { + logger.info("Warning: Clientside chunk ticking took {} ms", new Object[] {Long.valueOf(System.currentTimeMillis() - i)}); + } + + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return false; + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + } + + public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) + { + return false; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "MultiplayerChunkCache: " + this.chunkMapping.getNumHashElements() + ", " + this.chunkListing.size(); + } + + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) + { + return null; + } + + public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) + { + return null; + } + + public int getLoadedChunkCount() + { + return this.chunkListing.size(); + } + + public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) + { + } + + public Chunk provideChunk(BlockPos blockPosIn) + { + return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4); + } +} diff --git a/src/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java b/src/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java new file mode 100644 index 0000000..0944427 --- /dev/null +++ b/src/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java @@ -0,0 +1,195 @@ +package net.minecraft.client.multiplayer; + +import java.awt.Color; +import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.concurrent.atomic.AtomicInteger; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiDisconnected; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.network.NetHandlerLoginClient; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.network.EnumConnectionState; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.network.login.client.C00PacketLoginStart; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.ResourceLocation; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.opengl.GL11; + +import animeware.NightSky; +import animeware.util.render.DrawUtil; +import animeware.util.render.RenderUtil; +import animeware.util.websockets.SocketClient; + +public class GuiConnecting extends GuiScreen +{ + private static final AtomicInteger CONNECTION_ID = new AtomicInteger(0); + private static final Logger logger = LogManager.getLogger(); + private NetworkManager networkManager; + private boolean cancel; + private final GuiScreen previousGuiScreen; + + public GuiConnecting(GuiScreen p_i1181_1_, Minecraft mcIn, ServerData p_i1181_3_) + { + this.mc = mcIn; + this.previousGuiScreen = p_i1181_1_; + ServerAddress serveraddress = ServerAddress.func_78860_a(p_i1181_3_.serverIP); + mcIn.loadWorld((WorldClient)null); + mcIn.setServerData(p_i1181_3_); + this.connect(serveraddress.getIP(), serveraddress.getPort()); + } + + public GuiConnecting(GuiScreen p_i1182_1_, Minecraft mcIn, String hostName, int port) + { + this.mc = mcIn; + this.previousGuiScreen = p_i1182_1_; + mcIn.loadWorld((WorldClient)null); + this.connect(hostName, port); + } + + private void connect(final String ip, final int port) + { + logger.info("Connecting to " + ip + ", " + port); + (new Thread("Server Connector #" + CONNECTION_ID.incrementAndGet()) + { + public void run() + { + InetAddress inetaddress = null; + + try + { + if (GuiConnecting.this.cancel) + { + return; + } + + inetaddress = InetAddress.getByName(ip); + GuiConnecting.this.networkManager = NetworkManager.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f()); + GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen)); + GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN)); + GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile())); + /*if(!Animeware.hasSent) { + System.out.println(SocketClient.client.request("start_animeware", mc.thePlayer.getGameProfile().getName() + ":true")); + System.out.println(SocketClient.client.request("start_animeware_cape1", mc.thePlayer.getGameProfile().getName() + ":owns1")); + Animeware.hasSent = true; + }*/ + NightSky.INSTANCE.getDiscordRP().update("Playing " + ip + (port != 25565 ? "" + port : ""), "Version: " + NightSky.INSTANCE.VERSION); + System.out.println(ip); + } + catch (UnknownHostException unknownhostexception) + { + if (GuiConnecting.this.cancel) + { + return; + } + + GuiConnecting.logger.error((String)"Couldn\'t connect to server", (Throwable)unknownhostexception); + GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host"}))); + } + catch (Exception exception) + { + if (GuiConnecting.this.cancel) + { + return; + } + + GuiConnecting.logger.error((String)"Couldn\'t connect to server", (Throwable)exception); + String s = exception.toString(); + + if (inetaddress != null) + { + String s1 = inetaddress.toString() + ":" + port; + s = s.replaceAll(s1, ""); + } + + GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {s}))); + } + } + }).start(); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + if (this.networkManager != null) + { + if (this.networkManager.isChannelOpen()) + { + this.networkManager.processReceivedPackets(); + } + else + { + this.networkManager.checkDisconnected(); + } + } + } + + /** + * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of + * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) + */ + protected void keyTyped(char typedChar, int keyCode) throws IOException + { + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.format("gui.cancel", new Object[0]))); + + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + if (button.id == 0) + { + this.cancel = true; + + if (this.networkManager != null) + { + this.networkManager.closeChannel(new ChatComponentText("Aborted")); + } + + this.mc.displayGuiScreen(this.previousGuiScreen); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + + if (this.networkManager == null) + { + this.drawCenteredString(this.fontRendererObj, I18n.format("connect.connecting", new Object[0]), this.width / 2, this.height / 2 - 50, 16777215); + + } + else + { + this.drawCenteredString(this.fontRendererObj, I18n.format("connect.authorizing", new Object[0]), this.width / 2, this.height / 2 - 50, 16777215); + + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java b/src/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java new file mode 100644 index 0000000..495b306 --- /dev/null +++ b/src/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java @@ -0,0 +1,620 @@ +package net.minecraft.client.multiplayer; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; +import net.minecraft.network.play.client.C09PacketHeldItemChange; +import net.minecraft.network.play.client.C0EPacketClickWindow; +import net.minecraft.network.play.client.C10PacketCreativeInventoryAction; +import net.minecraft.network.play.client.C11PacketEnchantItem; +import net.minecraft.stats.StatFileWriter; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.WorldSettings; + +public class PlayerControllerMP +{ + /** The Minecraft instance. */ + private final Minecraft mc; + private final NetHandlerPlayClient netClientHandler; + private BlockPos currentBlock = new BlockPos(-1, -1, -1); + + /** The Item currently being used to destroy a block */ + private ItemStack currentItemHittingBlock; + + /** Current block damage (MP) */ + private float curBlockDamageMP; + + /** + * Tick counter, when it hits 4 it resets back to 0 and plays the step sound + */ + private float stepSoundTickCounter; + + /** + * Delays the first damage on the block after the first click on the block + */ + private int blockHitDelay; + + /** Tells if the player is hitting a block */ + private boolean isHittingBlock; + + /** Current game type for the player */ + private WorldSettings.GameType currentGameType = WorldSettings.GameType.SURVIVAL; + + /** Index of the current item held by the player in the inventory hotbar */ + private int currentPlayerItem; + + public PlayerControllerMP(Minecraft mcIn, NetHandlerPlayClient p_i45062_2_) + { + this.mc = mcIn; + this.netClientHandler = p_i45062_2_; + } + + public static void clickBlockCreative(Minecraft mcIn, PlayerControllerMP p_178891_1_, BlockPos p_178891_2_, EnumFacing p_178891_3_) + { + if (!mcIn.theWorld.extinguishFire(mcIn.thePlayer, p_178891_2_, p_178891_3_)) + { + p_178891_1_.onPlayerDestroyBlock(p_178891_2_, p_178891_3_); + } + } + + /** + * Sets player capabilities depending on current gametype. params: player + */ + public void setPlayerCapabilities(EntityPlayer p_78748_1_) + { + this.currentGameType.configurePlayerCapabilities(p_78748_1_.capabilities); + } + + /** + * None + */ + public boolean isSpectator() + { + return this.currentGameType == WorldSettings.GameType.SPECTATOR; + } + + /** + * Sets the game type for the player. + */ + public void setGameType(WorldSettings.GameType p_78746_1_) + { + this.currentGameType = p_78746_1_; + this.currentGameType.configurePlayerCapabilities(this.mc.thePlayer.capabilities); + } + + /** + * Flips the player around. + */ + public void flipPlayer(EntityPlayer playerIn) + { + playerIn.rotationYaw = -180.0F; + } + + public boolean shouldDrawHUD() + { + return this.currentGameType.isSurvivalOrAdventure(); + } + + /** + * Called when a player completes the destruction of a block + */ + public boolean onPlayerDestroyBlock(BlockPos pos, EnumFacing side) + { + if (this.currentGameType.isAdventure()) + { + if (this.currentGameType == WorldSettings.GameType.SPECTATOR) + { + return false; + } + + if (!this.mc.thePlayer.isAllowEdit()) + { + Block block = this.mc.theWorld.getBlockState(pos).getBlock(); + ItemStack itemstack = this.mc.thePlayer.getCurrentEquippedItem(); + + if (itemstack == null) + { + return false; + } + + if (!itemstack.canDestroy(block)) + { + return false; + } + } + } + + if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) + { + return false; + } + else + { + World world = this.mc.theWorld; + IBlockState iblockstate = world.getBlockState(pos); + Block block1 = iblockstate.getBlock(); + + if (block1.getMaterial() == Material.air) + { + return false; + } + else + { + world.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); + boolean flag = world.setBlockToAir(pos); + + if (flag) + { + block1.onBlockDestroyedByPlayer(world, pos, iblockstate); + } + + this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ()); + + if (!this.currentGameType.isCreative()) + { + ItemStack itemstack1 = this.mc.thePlayer.getCurrentEquippedItem(); + + if (itemstack1 != null) + { + itemstack1.onBlockDestroyed(world, block1, pos, this.mc.thePlayer); + + if (itemstack1.stackSize == 0) + { + this.mc.thePlayer.destroyCurrentEquippedItem(); + } + } + } + + return flag; + } + } + } + + /** + * Called when the player is hitting a block with an item. + */ + public boolean clickBlock(BlockPos loc, EnumFacing face) + { + if (this.currentGameType.isAdventure()) + { + if (this.currentGameType == WorldSettings.GameType.SPECTATOR) + { + return false; + } + + if (!this.mc.thePlayer.isAllowEdit()) + { + Block block = this.mc.theWorld.getBlockState(loc).getBlock(); + ItemStack itemstack = this.mc.thePlayer.getCurrentEquippedItem(); + + if (itemstack == null) + { + return false; + } + + if (!itemstack.canDestroy(block)) + { + return false; + } + } + } + + if (!this.mc.theWorld.getWorldBorder().contains(loc)) + { + return false; + } + else + { + if (this.currentGameType.isCreative()) + { + this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, loc, face)); + clickBlockCreative(this.mc, this, loc, face); + this.blockHitDelay = 5; + } + else if (!this.isHittingBlock || !this.isHittingPosition(loc)) + { + if (this.isHittingBlock) + { + this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.currentBlock, face)); + } + + this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, loc, face)); + Block block1 = this.mc.theWorld.getBlockState(loc).getBlock(); + boolean flag = block1.getMaterial() != Material.air; + + if (flag && this.curBlockDamageMP == 0.0F) + { + block1.onBlockClicked(this.mc.theWorld, loc, this.mc.thePlayer); + } + + if (flag && block1.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, loc) >= 1.0F) + { + this.onPlayerDestroyBlock(loc, face); + } + else + { + this.isHittingBlock = true; + this.currentBlock = loc; + this.currentItemHittingBlock = this.mc.thePlayer.getHeldItem(); + this.curBlockDamageMP = 0.0F; + this.stepSoundTickCounter = 0.0F; + this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1); + } + } + + return true; + } + } + + /** + * Resets current block damage and isHittingBlock + */ + public void resetBlockRemoving() + { + if (this.isHittingBlock) + { + this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.currentBlock, EnumFacing.DOWN)); + this.isHittingBlock = false; + this.curBlockDamageMP = 0.0F; + this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, -1); + } + } + + public boolean onPlayerDamageBlock(BlockPos posBlock, EnumFacing directionFacing) + { + this.syncCurrentPlayItem(); + + if (this.blockHitDelay > 0) + { + --this.blockHitDelay; + return true; + } + else if (this.currentGameType.isCreative() && this.mc.theWorld.getWorldBorder().contains(posBlock)) + { + this.blockHitDelay = 5; + this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, posBlock, directionFacing)); + clickBlockCreative(this.mc, this, posBlock, directionFacing); + return true; + } + else if (this.isHittingPosition(posBlock)) + { + Block block = this.mc.theWorld.getBlockState(posBlock).getBlock(); + + if (block.getMaterial() == Material.air) + { + this.isHittingBlock = false; + return false; + } + else + { + this.curBlockDamageMP += block.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, posBlock); + + if (this.stepSoundTickCounter % 4.0F == 0.0F) + { + this.mc.getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(block.stepSound.getStepSound()), (block.stepSound.getVolume() + 1.0F) / 8.0F, block.stepSound.getFrequency() * 0.5F, (float)posBlock.getX() + 0.5F, (float)posBlock.getY() + 0.5F, (float)posBlock.getZ() + 0.5F)); + } + + ++this.stepSoundTickCounter; + + if (this.curBlockDamageMP >= 1.0F) + { + this.isHittingBlock = false; + this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, posBlock, directionFacing)); + this.onPlayerDestroyBlock(posBlock, directionFacing); + this.curBlockDamageMP = 0.0F; + this.stepSoundTickCounter = 0.0F; + this.blockHitDelay = 5; + } + + this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1); + return true; + } + } + else + { + return this.clickBlock(posBlock, directionFacing); + } + } + + /** + * player reach distance = 4F + */ + public float getBlockReachDistance() + { + return this.currentGameType.isCreative() ? 5.0F : 4.5F; + } + + public void updateController() + { + this.syncCurrentPlayItem(); + + if (this.netClientHandler.getNetworkManager().isChannelOpen()) + { + this.netClientHandler.getNetworkManager().processReceivedPackets(); + } + else + { + this.netClientHandler.getNetworkManager().checkDisconnected(); + } + } + + private boolean isHittingPosition(BlockPos pos) + { + ItemStack itemstack = this.mc.thePlayer.getHeldItem(); + boolean flag = this.currentItemHittingBlock == null && itemstack == null; + + if (this.currentItemHittingBlock != null && itemstack != null) + { + flag = itemstack.getItem() == this.currentItemHittingBlock.getItem() && ItemStack.areItemStackTagsEqual(itemstack, this.currentItemHittingBlock) && (itemstack.isItemStackDamageable() || itemstack.getMetadata() == this.currentItemHittingBlock.getMetadata()); + } + + return pos.equals(this.currentBlock) && flag; + } + + /** + * Syncs the current player item with the server + */ + private void syncCurrentPlayItem() + { + int i = this.mc.thePlayer.inventory.currentItem; + + if (i != this.currentPlayerItem) + { + this.currentPlayerItem = i; + this.netClientHandler.addToSendQueue(new C09PacketHeldItemChange(this.currentPlayerItem)); + } + } + + public boolean onPlayerRightClick(EntityPlayerSP player, WorldClient worldIn, ItemStack heldStack, BlockPos hitPos, EnumFacing side, Vec3 hitVec) + { + this.syncCurrentPlayItem(); + float f = (float)(hitVec.xCoord - (double)hitPos.getX()); + float f1 = (float)(hitVec.yCoord - (double)hitPos.getY()); + float f2 = (float)(hitVec.zCoord - (double)hitPos.getZ()); + boolean flag = false; + + if (!this.mc.theWorld.getWorldBorder().contains(hitPos)) + { + return false; + } + else + { + if (this.currentGameType != WorldSettings.GameType.SPECTATOR) + { + IBlockState iblockstate = worldIn.getBlockState(hitPos); + + if ((!player.isSneaking() || player.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2)) + { + flag = true; + } + + if (!flag && heldStack != null && heldStack.getItem() instanceof ItemBlock) + { + ItemBlock itemblock = (ItemBlock)heldStack.getItem(); + + if (!itemblock.canPlaceBlockOnSide(worldIn, hitPos, side, player, heldStack)) + { + return false; + } + } + } + + this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(hitPos, side.getIndex(), player.inventory.getCurrentItem(), f, f1, f2)); + + if (!flag && this.currentGameType != WorldSettings.GameType.SPECTATOR) + { + if (heldStack == null) + { + return false; + } + else if (this.currentGameType.isCreative()) + { + int i = heldStack.getMetadata(); + int j = heldStack.stackSize; + boolean flag1 = heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2); + heldStack.setItemDamage(i); + heldStack.stackSize = j; + return flag1; + } + else + { + return heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2); + } + } + else + { + return true; + } + } + } + + /** + * Notifies the server of things like consuming food, etc... + */ + public boolean sendUseItem(EntityPlayer playerIn, World worldIn, ItemStack itemStackIn) + { + if (this.currentGameType == WorldSettings.GameType.SPECTATOR) + { + return false; + } + else + { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(playerIn.inventory.getCurrentItem())); + int i = itemStackIn.stackSize; + ItemStack itemstack = itemStackIn.useItemRightClick(worldIn, playerIn); + + if (itemstack != itemStackIn || itemstack != null && itemstack.stackSize != i) + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack; + + if (itemstack.stackSize == 0) + { + playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null; + } + + return true; + } + else + { + return false; + } + } + } + + public EntityPlayerSP func_178892_a(World worldIn, StatFileWriter p_178892_2_) + { + return new EntityPlayerSP(this.mc, worldIn, this.netClientHandler, p_178892_2_); + } + + /** + * Attacks an entity + */ + public void attackEntity(EntityPlayer playerIn, Entity targetEntity) + { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new C02PacketUseEntity(targetEntity, C02PacketUseEntity.Action.ATTACK)); + + if (this.currentGameType != WorldSettings.GameType.SPECTATOR) + { + playerIn.attackTargetEntityWithCurrentItem(targetEntity); + } + } + + /** + * Send packet to server - player is interacting with another entity (left click) + */ + public boolean interactWithEntitySendPacket(EntityPlayer playerIn, Entity targetEntity) + { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new C02PacketUseEntity(targetEntity, C02PacketUseEntity.Action.INTERACT)); + return this.currentGameType != WorldSettings.GameType.SPECTATOR && playerIn.interactWith(targetEntity); + } + + public boolean func_178894_a(EntityPlayer p_178894_1_, Entity p_178894_2_, MovingObjectPosition p_178894_3_) + { + this.syncCurrentPlayItem(); + Vec3 vec3 = new Vec3(p_178894_3_.hitVec.xCoord - p_178894_2_.posX, p_178894_3_.hitVec.yCoord - p_178894_2_.posY, p_178894_3_.hitVec.zCoord - p_178894_2_.posZ); + this.netClientHandler.addToSendQueue(new C02PacketUseEntity(p_178894_2_, vec3)); + return this.currentGameType != WorldSettings.GameType.SPECTATOR && p_178894_2_.interactAt(p_178894_1_, vec3); + } + + /** + * Handles slot clicks sends a packet to the server. + */ + public ItemStack windowClick(int windowId, int slotId, int mouseButtonClicked, int mode, EntityPlayer playerIn) + { + short short1 = playerIn.openContainer.getNextTransactionID(playerIn.inventory); + ItemStack itemstack = playerIn.openContainer.slotClick(slotId, mouseButtonClicked, mode, playerIn); + this.netClientHandler.addToSendQueue(new C0EPacketClickWindow(windowId, slotId, mouseButtonClicked, mode, itemstack, short1)); + return itemstack; + } + + /** + * GuiEnchantment uses this during multiplayer to tell PlayerControllerMP to send a packet indicating the + * enchantment action the player has taken. + */ + public void sendEnchantPacket(int p_78756_1_, int p_78756_2_) + { + this.netClientHandler.addToSendQueue(new C11PacketEnchantItem(p_78756_1_, p_78756_2_)); + } + + /** + * Used in PlayerControllerMP to update the server with an ItemStack in a slot. + */ + public void sendSlotPacket(ItemStack itemStackIn, int slotId) + { + if (this.currentGameType.isCreative()) + { + this.netClientHandler.addToSendQueue(new C10PacketCreativeInventoryAction(slotId, itemStackIn)); + } + } + + /** + * Sends a Packet107 to the server to drop the item on the ground + */ + public void sendPacketDropItem(ItemStack itemStackIn) + { + if (this.currentGameType.isCreative() && itemStackIn != null) + { + this.netClientHandler.addToSendQueue(new C10PacketCreativeInventoryAction(-1, itemStackIn)); + } + } + + public void onStoppedUsingItem(EntityPlayer playerIn) + { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN)); + playerIn.stopUsingItem(); + } + + public boolean gameIsSurvivalOrAdventure() + { + return this.currentGameType.isSurvivalOrAdventure(); + } + + /** + * Checks if the player is not creative, used for checking if it should break a block instantly + */ + public boolean isNotCreative() + { + return !this.currentGameType.isCreative(); + } + + /** + * returns true if player is in creative mode + */ + public boolean isInCreativeMode() + { + return this.currentGameType.isCreative(); + } + + /** + * true for hitting entities far away. + */ + public boolean extendedReach() + { + return this.currentGameType.isCreative(); + } + + /** + * Checks if the player is riding a horse, used to chose the GUI to open + */ + public boolean isRidingHorse() + { + return this.mc.thePlayer.isRiding() && this.mc.thePlayer.ridingEntity instanceof EntityHorse; + } + + public boolean isSpectatorMode() + { + return this.currentGameType == WorldSettings.GameType.SPECTATOR; + } + + public WorldSettings.GameType getCurrentGameType() + { + return this.currentGameType; + } + + public boolean func_181040_m() + { + return this.isHittingBlock; + } +} diff --git a/src/minecraft/net/minecraft/client/multiplayer/ServerAddress.java b/src/minecraft/net/minecraft/client/multiplayer/ServerAddress.java new file mode 100644 index 0000000..049e724 --- /dev/null +++ b/src/minecraft/net/minecraft/client/multiplayer/ServerAddress.java @@ -0,0 +1,115 @@ +package net.minecraft.client.multiplayer; + +import java.net.IDN; +import java.util.Hashtable; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; +import javax.naming.directory.InitialDirContext; + +public class ServerAddress +{ + private final String ipAddress; + private final int serverPort; + + private ServerAddress(String p_i1192_1_, int p_i1192_2_) + { + this.ipAddress = p_i1192_1_; + this.serverPort = p_i1192_2_; + } + + public String getIP() + { + return IDN.toASCII(this.ipAddress); + } + + public int getPort() + { + return this.serverPort; + } + + public static ServerAddress func_78860_a(String p_78860_0_) + { + if (p_78860_0_ == null) + { + return null; + } + else + { + String[] astring = p_78860_0_.split(":"); + + if (p_78860_0_.startsWith("[")) + { + int i = p_78860_0_.indexOf("]"); + + if (i > 0) + { + String s = p_78860_0_.substring(1, i); + String s1 = p_78860_0_.substring(i + 1).trim(); + + if (s1.startsWith(":") && s1.length() > 0) + { + s1 = s1.substring(1); + astring = new String[] {s, s1}; + } + else + { + astring = new String[] {s}; + } + } + } + + if (astring.length > 2) + { + astring = new String[] {p_78860_0_}; + } + + String s2 = astring[0]; + int j = astring.length > 1 ? parseIntWithDefault(astring[1], 25565) : 25565; + + if (j == 25565) + { + String[] astring1 = getServerAddress(s2); + s2 = astring1[0]; + j = parseIntWithDefault(astring1[1], 25565); + } + + return new ServerAddress(s2, j); + } + } + + /** + * Returns a server's address and port for the specified hostname, looking up the SRV record if possible + */ + private static String[] getServerAddress(String p_78863_0_) + { + try + { + String s = "com.sun.jndi.dns.DnsContextFactory"; + Class.forName("com.sun.jndi.dns.DnsContextFactory"); + Hashtable hashtable = new Hashtable(); + hashtable.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory"); + hashtable.put("java.naming.provider.url", "dns:"); + hashtable.put("com.sun.jndi.dns.timeout.retries", "1"); + DirContext dircontext = new InitialDirContext(hashtable); + Attributes attributes = dircontext.getAttributes("_minecraft._tcp." + p_78863_0_, new String[] {"SRV"}); + String[] astring = attributes.get("srv").get().toString().split(" ", 4); + return new String[] {astring[3], astring[2]}; + } + catch (Throwable var6) + { + return new String[] {p_78863_0_, Integer.toString(25565)}; + } + } + + private static int parseIntWithDefault(String p_78862_0_, int p_78862_1_) + { + try + { + return Integer.parseInt(p_78862_0_.trim()); + } + catch (Exception var3) + { + return p_78862_1_; + } + } +} diff --git a/src/minecraft/net/minecraft/client/multiplayer/ServerData.java b/src/minecraft/net/minecraft/client/multiplayer/ServerData.java new file mode 100644 index 0000000..b291ab9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/multiplayer/ServerData.java @@ -0,0 +1,155 @@ +package net.minecraft.client.multiplayer; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; + +public class ServerData +{ + public String serverName; + public String serverIP; + + /** + * the string indicating number of players on and capacity of the server that is shown on the server browser (i.e. + * "5/20" meaning 5 slots used out of 20 slots total) + */ + public String populationInfo; + + /** + * (better variable name would be 'hostname') server name as displayed in the server browser's second line (grey + * text) + */ + public String serverMOTD; + + /** last server ping that showed up in the server browser */ + public long pingToServer; + public int version = 47; + + /** Game version for this server. */ + public String gameVersion = "1.8.8"; + public boolean field_78841_f; + public String playerList; + private ServerData.ServerResourceMode resourceMode = ServerData.ServerResourceMode.PROMPT; + private String serverIcon; + private boolean field_181042_l; + + public ServerData(String p_i46420_1_, String p_i46420_2_, boolean p_i46420_3_) + { + this.serverName = p_i46420_1_; + this.serverIP = p_i46420_2_; + this.field_181042_l = p_i46420_3_; + } + + /** + * Returns an NBTTagCompound with the server's name, IP and maybe acceptTextures. + */ + public NBTTagCompound getNBTCompound() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("name", this.serverName); + nbttagcompound.setString("ip", this.serverIP); + + if (this.serverIcon != null) + { + nbttagcompound.setString("icon", this.serverIcon); + } + + if (this.resourceMode == ServerData.ServerResourceMode.ENABLED) + { + nbttagcompound.setBoolean("acceptTextures", true); + } + else if (this.resourceMode == ServerData.ServerResourceMode.DISABLED) + { + nbttagcompound.setBoolean("acceptTextures", false); + } + + return nbttagcompound; + } + + public ServerData.ServerResourceMode getResourceMode() + { + return this.resourceMode; + } + + public void setResourceMode(ServerData.ServerResourceMode mode) + { + this.resourceMode = mode; + } + + /** + * Takes an NBTTagCompound with 'name' and 'ip' keys, returns a ServerData instance. + */ + public static ServerData getServerDataFromNBTCompound(NBTTagCompound nbtCompound) + { + ServerData serverdata = new ServerData(nbtCompound.getString("name"), nbtCompound.getString("ip"), false); + + if (nbtCompound.hasKey("icon", 8)) + { + serverdata.setBase64EncodedIconData(nbtCompound.getString("icon")); + } + + if (nbtCompound.hasKey("acceptTextures", 1)) + { + if (nbtCompound.getBoolean("acceptTextures")) + { + serverdata.setResourceMode(ServerData.ServerResourceMode.ENABLED); + } + else + { + serverdata.setResourceMode(ServerData.ServerResourceMode.DISABLED); + } + } + else + { + serverdata.setResourceMode(ServerData.ServerResourceMode.PROMPT); + } + + return serverdata; + } + + /** + * Returns the base-64 encoded representation of the server's icon, or null if not available + */ + public String getBase64EncodedIconData() + { + return this.serverIcon; + } + + public void setBase64EncodedIconData(String icon) + { + this.serverIcon = icon; + } + + public boolean func_181041_d() + { + return this.field_181042_l; + } + + public void copyFrom(ServerData serverDataIn) + { + this.serverIP = serverDataIn.serverIP; + this.serverName = serverDataIn.serverName; + this.setResourceMode(serverDataIn.getResourceMode()); + this.serverIcon = serverDataIn.serverIcon; + this.field_181042_l = serverDataIn.field_181042_l; + } + + public static enum ServerResourceMode + { + ENABLED("enabled"), + DISABLED("disabled"), + PROMPT("prompt"); + + private final IChatComponent motd; + + private ServerResourceMode(String p_i1053_3_) + { + this.motd = new ChatComponentTranslation("addServer.resourcePack." + p_i1053_3_, new Object[0]); + } + + public IChatComponent getMotd() + { + return this.motd; + } + } +} diff --git a/src/minecraft/net/minecraft/client/multiplayer/ServerList.java b/src/minecraft/net/minecraft/client/multiplayer/ServerList.java new file mode 100644 index 0000000..65f62bc --- /dev/null +++ b/src/minecraft/net/minecraft/client/multiplayer/ServerList.java @@ -0,0 +1,169 @@ +package net.minecraft.client.multiplayer; + +import com.google.common.collect.Lists; + +import animeware.ServerDataFeatured; + +import java.io.File; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ServerList +{ + private static final Logger logger = LogManager.getLogger(); + + /** The Minecraft instance. */ + private final Minecraft mc; + private final List servers = Lists.newArrayList(); + + public ServerList(Minecraft mcIn) + { + this.mc = mcIn; + this.loadServerList(); + } + + /** + * Loads a list of servers from servers.dat, by running ServerData.getServerDataFromNBTCompound on each NBT compound + * found in the "servers" tag list. + */ + public void loadServerList() + { + try + { + this.servers.clear(); + loadFeaturedServers(); + NBTTagCompound nbttagcompound = CompressedStreamTools.read(new File(this.mc.mcDataDir, "servers.dat")); + + if (nbttagcompound == null) + { + return; + } + + NBTTagList nbttaglist = nbttagcompound.getTagList("servers", 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + this.servers.add(ServerData.getServerDataFromNBTCompound(nbttaglist.getCompoundTagAt(i))); + } + } + catch (Exception exception) + { + logger.error((String)"Couldn\'t load server list", (Throwable)exception); + } + } + + private void loadFeaturedServers() { + this.addServerData(new ServerDataFeatured("Hypixel Network", "mc.hypixel.net")); + + } + + public int getFeaturedServerCount() { + int count = 0; + for(ServerData sd : this.servers) { + if(sd instanceof ServerDataFeatured) { + count++; + } + } + return count; + } + + /** + * Runs getNBTCompound on each ServerData instance, puts everything into a "servers" NBT list and writes it to + * servers.dat. + */ + public void saveServerList() + { + try + { + NBTTagList nbttaglist = new NBTTagList(); + + for (ServerData serverdata : this.servers) + { + if(!(serverdata instanceof ServerDataFeatured)) { + nbttaglist.appendTag(serverdata.getNBTCompound()); + } + } + + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setTag("servers", nbttaglist); + CompressedStreamTools.safeWrite(nbttagcompound, new File(this.mc.mcDataDir, "servers.dat")); + } + catch (Exception exception) + { + logger.error((String)"Couldn\'t save server list", (Throwable)exception); + } + } + + /** + * Gets the ServerData instance stored for the given index in the list. + */ + public ServerData getServerData(int p_78850_1_) + { + return (ServerData)this.servers.get(p_78850_1_); + } + + /** + * Removes the ServerData instance stored for the given index in the list. + */ + public void removeServerData(int p_78851_1_) + { + this.servers.remove(p_78851_1_); + } + + /** + * Adds the given ServerData instance to the list. + */ + public void addServerData(ServerData p_78849_1_) + { + this.servers.add(p_78849_1_); + } + + /** + * Counts the number of ServerData instances in the list. + */ + public int countServers() + { + return this.servers.size(); + } + + /** + * Takes two list indexes, and swaps their order around. + */ + public void swapServers(int p_78857_1_, int p_78857_2_) + { + ServerData serverdata = this.getServerData(p_78857_1_); + this.servers.set(p_78857_1_, this.getServerData(p_78857_2_)); + this.servers.set(p_78857_2_, serverdata); + this.saveServerList(); + } + + public void func_147413_a(int p_147413_1_, ServerData p_147413_2_) + { + this.servers.set(p_147413_1_, p_147413_2_); + } + + public static void func_147414_b(ServerData p_147414_0_) + { + ServerList serverlist = new ServerList(Minecraft.getMinecraft()); + serverlist.loadServerList(); + + for (int i = 0; i < serverlist.countServers(); ++i) + { + ServerData serverdata = serverlist.getServerData(i); + + if (serverdata.serverName.equals(p_147414_0_.serverName) && serverdata.serverIP.equals(p_147414_0_.serverIP)) + { + serverlist.func_147413_a(i, p_147414_0_); + break; + } + } + + serverlist.saveServerList(); + } +} diff --git a/src/minecraft/net/minecraft/client/multiplayer/ThreadLanServerPing.java b/src/minecraft/net/minecraft/client/multiplayer/ThreadLanServerPing.java new file mode 100644 index 0000000..1bdeff4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/multiplayer/ThreadLanServerPing.java @@ -0,0 +1,119 @@ +package net.minecraft.client.multiplayer; + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; +import java.util.concurrent.atomic.AtomicInteger; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ThreadLanServerPing extends Thread +{ + private static final AtomicInteger field_148658_a = new AtomicInteger(0); + private static final Logger logger = LogManager.getLogger(); + private final String motd; + + /** The socket we're using to send packets on. */ + private final DatagramSocket socket; + private boolean isStopping = true; + private final String address; + + public ThreadLanServerPing(String p_i1321_1_, String p_i1321_2_) throws IOException + { + super("LanServerPinger #" + field_148658_a.incrementAndGet()); + this.motd = p_i1321_1_; + this.address = p_i1321_2_; + this.setDaemon(true); + this.socket = new DatagramSocket(); + } + + public void run() + { + String s = getPingResponse(this.motd, this.address); + byte[] abyte = s.getBytes(); + + while (!this.isInterrupted() && this.isStopping) + { + try + { + InetAddress inetaddress = InetAddress.getByName("224.0.2.60"); + DatagramPacket datagrampacket = new DatagramPacket(abyte, abyte.length, inetaddress, 4445); + this.socket.send(datagrampacket); + } + catch (IOException ioexception) + { + logger.warn("LanServerPinger: " + ioexception.getMessage()); + break; + } + + try + { + sleep(1500L); + } + catch (InterruptedException var5) + { + ; + } + } + } + + public void interrupt() + { + super.interrupt(); + this.isStopping = false; + } + + public static String getPingResponse(String p_77525_0_, String p_77525_1_) + { + return "[MOTD]" + p_77525_0_ + "[/MOTD][AD]" + p_77525_1_ + "[/AD]"; + } + + public static String getMotdFromPingResponse(String p_77524_0_) + { + int i = p_77524_0_.indexOf("[MOTD]"); + + if (i < 0) + { + return "missing no"; + } + else + { + int j = p_77524_0_.indexOf("[/MOTD]", i + "[MOTD]".length()); + return j < i ? "missing no" : p_77524_0_.substring(i + "[MOTD]".length(), j); + } + } + + public static String getAdFromPingResponse(String p_77523_0_) + { + int i = p_77523_0_.indexOf("[/MOTD]"); + + if (i < 0) + { + return null; + } + else + { + int j = p_77523_0_.indexOf("[/MOTD]", i + "[/MOTD]".length()); + + if (j >= 0) + { + return null; + } + else + { + int k = p_77523_0_.indexOf("[AD]", i + "[/MOTD]".length()); + + if (k < 0) + { + return null; + } + else + { + int l = p_77523_0_.indexOf("[/AD]", k + "[AD]".length()); + return l < k ? null : p_77523_0_.substring(k + "[AD]".length(), l); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/multiplayer/WorldClient.java b/src/minecraft/net/minecraft/client/multiplayer/WorldClient.java new file mode 100644 index 0000000..5977e0a --- /dev/null +++ b/src/minecraft/net/minecraft/client/multiplayer/WorldClient.java @@ -0,0 +1,534 @@ +package net.minecraft.client.multiplayer; + +import com.google.common.collect.Sets; +import java.util.Random; +import java.util.Set; +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.MovingSoundMinecart; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.client.particle.EntityFirework; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.profiler.Profiler; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.storage.SaveDataMemoryStorage; +import net.minecraft.world.storage.SaveHandlerMP; +import net.minecraft.world.storage.WorldInfo; +import optifine.BlockPosM; +import optifine.Config; +import optifine.DynamicLights; +import optifine.PlayerControllerOF; +import optifine.Reflector; + +public class WorldClient extends World +{ + /** The packets that need to be sent to the server. */ + private NetHandlerPlayClient sendQueue; + + /** The ChunkProviderClient instance */ + private ChunkProviderClient clientChunkProvider; + + /** Contains all entities for this client, both spawned and non-spawned. */ + private final Set entityList = Sets.newHashSet(); + + /** + * Contains all entities for this client that were not spawned due to a non-present chunk. The game will attempt to + * spawn up to 10 pending entities with each subsequent tick until the spawn queue is empty. + */ + private final Set entitySpawnQueue = Sets.newHashSet(); + private final Minecraft mc = Minecraft.getMinecraft(); + private final Set previousActiveChunkSet = Sets.newHashSet(); + private static final String __OBFID = "CL_00000882"; + private BlockPosM randomTickPosM = new BlockPosM(0, 0, 0, 3); + private boolean playerUpdate = false; + + public WorldClient(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_) + { + super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true); + this.sendQueue = p_i45063_1_; + this.getWorldInfo().setDifficulty(p_i45063_4_); + this.provider.registerWorld(this); + this.setSpawnPoint(new BlockPos(8, 64, 8)); + this.chunkProvider = this.createChunkProvider(); + this.mapStorage = new SaveDataMemoryStorage(); + this.calculateInitialSkylight(); + this.calculateInitialWeather(); + Reflector.postForgeBusEvent(Reflector.WorldEvent_Load_Constructor, new Object[] {this}); + + if (this.mc.playerController != null && this.mc.playerController.getClass() == PlayerControllerMP.class) + { + this.mc.playerController = new PlayerControllerOF(this.mc, p_i45063_1_); + } + } + + /** + * Runs a single tick for the world + */ + public void tick() + { + super.tick(); + this.setTotalWorldTime(this.getTotalWorldTime() + 1L); + + if (this.getGameRules().getBoolean("doDaylightCycle")) + { + this.setWorldTime(this.getWorldTime() + 1L); + } + + this.theProfiler.startSection("reEntryProcessing"); + + for (int i = 0; i < 10 && !this.entitySpawnQueue.isEmpty(); ++i) + { + Entity entity = (Entity)this.entitySpawnQueue.iterator().next(); + this.entitySpawnQueue.remove(entity); + + if (!this.loadedEntityList.contains(entity)) + { + this.spawnEntityInWorld(entity); + } + } + + this.theProfiler.endStartSection("chunkCache"); + this.clientChunkProvider.unloadQueuedChunks(); + this.theProfiler.endStartSection("blocks"); + this.updateBlocks(); + this.theProfiler.endSection(); + } + + /** + * Invalidates an AABB region of blocks from the receive queue, in the event that the block has been modified + * client-side in the intervening 80 receive ticks. + */ + public void invalidateBlockReceiveRegion(int p_73031_1_, int p_73031_2_, int p_73031_3_, int p_73031_4_, int p_73031_5_, int p_73031_6_) + { + } + + /** + * Creates the chunk provider for this world. Called in the constructor. Retrieves provider from worldProvider? + */ + protected IChunkProvider createChunkProvider() + { + this.clientChunkProvider = new ChunkProviderClient(this); + return this.clientChunkProvider; + } + + protected void updateBlocks() + { + super.updateBlocks(); + this.previousActiveChunkSet.retainAll(this.activeChunkSet); + + if (this.previousActiveChunkSet.size() == this.activeChunkSet.size()) + { + this.previousActiveChunkSet.clear(); + } + + int i = 0; + + for (ChunkCoordIntPair chunkcoordintpair : this.activeChunkSet) + { + if (!this.previousActiveChunkSet.contains(chunkcoordintpair)) + { + int j = chunkcoordintpair.chunkXPos * 16; + int k = chunkcoordintpair.chunkZPos * 16; + this.theProfiler.startSection("getChunk"); + Chunk chunk = this.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos); + this.playMoodSoundAndCheckLight(j, k, chunk); + this.theProfiler.endSection(); + this.previousActiveChunkSet.add(chunkcoordintpair); + ++i; + + if (i >= 10) + { + return; + } + } + } + } + + public void doPreChunk(int p_73025_1_, int p_73025_2_, boolean p_73025_3_) + { + if (p_73025_3_) + { + this.clientChunkProvider.loadChunk(p_73025_1_, p_73025_2_); + } + else + { + this.clientChunkProvider.unloadChunk(p_73025_1_, p_73025_2_); + } + + if (!p_73025_3_) + { + this.markBlockRangeForRenderUpdate(p_73025_1_ * 16, 0, p_73025_2_ * 16, p_73025_1_ * 16 + 15, 256, p_73025_2_ * 16 + 15); + } + } + + /** + * Called when an entity is spawned in the world. This includes players. + */ + public boolean spawnEntityInWorld(Entity entityIn) + { + boolean flag = super.spawnEntityInWorld(entityIn); + this.entityList.add(entityIn); + + if (!flag) + { + this.entitySpawnQueue.add(entityIn); + } + else if (entityIn instanceof EntityMinecart) + { + this.mc.getSoundHandler().playSound(new MovingSoundMinecart((EntityMinecart)entityIn)); + } + + return flag; + } + + /** + * Schedule the entity for removal during the next tick. Marks the entity dead in anticipation. + */ + public void removeEntity(Entity entityIn) + { + super.removeEntity(entityIn); + this.entityList.remove(entityIn); + } + + protected void onEntityAdded(Entity entityIn) + { + super.onEntityAdded(entityIn); + + if (this.entitySpawnQueue.contains(entityIn)) + { + this.entitySpawnQueue.remove(entityIn); + } + } + + protected void onEntityRemoved(Entity entityIn) + { + super.onEntityRemoved(entityIn); + boolean flag = false; + + if (this.entityList.contains(entityIn)) + { + if (entityIn.isEntityAlive()) + { + this.entitySpawnQueue.add(entityIn); + flag = true; + } + else + { + this.entityList.remove(entityIn); + } + } + } + + /** + * Add an ID to Entity mapping to entityHashSet + */ + public void addEntityToWorld(int p_73027_1_, Entity p_73027_2_) + { + Entity entity = this.getEntityByID(p_73027_1_); + + if (entity != null) + { + this.removeEntity(entity); + } + + this.entityList.add(p_73027_2_); + p_73027_2_.setEntityId(p_73027_1_); + + if (!this.spawnEntityInWorld(p_73027_2_)) + { + this.entitySpawnQueue.add(p_73027_2_); + } + + this.entitiesById.addKey(p_73027_1_, p_73027_2_); + } + + /** + * Returns the Entity with the given ID, or null if it doesn't exist in this World. + */ + public Entity getEntityByID(int id) + { + return (Entity)(id == this.mc.thePlayer.getEntityId() ? this.mc.thePlayer : super.getEntityByID(id)); + } + + public Entity removeEntityFromWorld(int p_73028_1_) + { + Entity entity = (Entity)this.entitiesById.removeObject(p_73028_1_); + + if (entity != null) + { + this.entityList.remove(entity); + this.removeEntity(entity); + } + + return entity; + } + + public boolean invalidateRegionAndSetBlock(BlockPos p_180503_1_, IBlockState p_180503_2_) + { + int i = p_180503_1_.getX(); + int j = p_180503_1_.getY(); + int k = p_180503_1_.getZ(); + this.invalidateBlockReceiveRegion(i, j, k, i, j, k); + return super.setBlockState(p_180503_1_, p_180503_2_, 3); + } + + /** + * If on MP, sends a quitting packet. + */ + public void sendQuittingDisconnectingPacket() + { + this.sendQueue.getNetworkManager().closeChannel(new ChatComponentText("Quitting")); + } + + /** + * Updates all weather states. + */ + protected void updateWeather() + { + } + + protected int getRenderDistanceChunks() + { + return this.mc.gameSettings.renderDistanceChunks; + } + + public void doVoidFogParticles(int p_73029_1_, int p_73029_2_, int p_73029_3_) + { + byte b0 = 16; + Random random = new Random(); + ItemStack itemstack = this.mc.thePlayer.getHeldItem(); + boolean flag = this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.CREATIVE && itemstack != null && Block.getBlockFromItem(itemstack.getItem()) == Blocks.barrier; + BlockPosM blockposm = this.randomTickPosM; + + for (int i = 0; i < 1000; ++i) + { + int j = p_73029_1_ + this.rand.nextInt(b0) - this.rand.nextInt(b0); + int k = p_73029_2_ + this.rand.nextInt(b0) - this.rand.nextInt(b0); + int l = p_73029_3_ + this.rand.nextInt(b0) - this.rand.nextInt(b0); + blockposm.setXyz(j, k, l); + IBlockState iblockstate = this.getBlockState(blockposm); + iblockstate.getBlock().randomDisplayTick(this, blockposm, iblockstate, random); + + if (flag && iblockstate.getBlock() == Blocks.barrier) + { + this.spawnParticle(EnumParticleTypes.BARRIER, (double)((float)j + 0.5F), (double)((float)k + 0.5F), (double)((float)l + 0.5F), 0.0D, 0.0D, 0.0D, new int[0]); + } + } + } + + /** + * also releases skins. + */ + public void removeAllEntities() + { + this.loadedEntityList.removeAll(this.unloadedEntityList); + + for (int i = 0; i < this.unloadedEntityList.size(); ++i) + { + Entity entity = (Entity)this.unloadedEntityList.get(i); + int j = entity.chunkCoordX; + int k = entity.chunkCoordZ; + + if (entity.addedToChunk && this.isChunkLoaded(j, k, true)) + { + this.getChunkFromChunkCoords(j, k).removeEntity(entity); + } + } + + for (int l = 0; l < this.unloadedEntityList.size(); ++l) + { + this.onEntityRemoved((Entity)this.unloadedEntityList.get(l)); + } + + this.unloadedEntityList.clear(); + + for (int i1 = 0; i1 < this.loadedEntityList.size(); ++i1) + { + Entity entity1 = (Entity)this.loadedEntityList.get(i1); + + if (entity1.ridingEntity != null) + { + if (!entity1.ridingEntity.isDead && entity1.ridingEntity.riddenByEntity == entity1) + { + continue; + } + + entity1.ridingEntity.riddenByEntity = null; + entity1.ridingEntity = null; + } + + if (entity1.isDead) + { + int j1 = entity1.chunkCoordX; + int k1 = entity1.chunkCoordZ; + + if (entity1.addedToChunk && this.isChunkLoaded(j1, k1, true)) + { + this.getChunkFromChunkCoords(j1, k1).removeEntity(entity1); + } + + this.loadedEntityList.remove(i1--); + this.onEntityRemoved(entity1); + } + } + } + + /** + * Adds some basic stats of the world to the given crash report. + */ + public CrashReportCategory addWorldInfoToCrashReport(CrashReport report) + { + CrashReportCategory crashreportcategory = super.addWorldInfoToCrashReport(report); + crashreportcategory.addCrashSectionCallable("Forced entities", new Callable() + { + private static final String __OBFID = "CL_00000883"; + public String call() + { + return WorldClient.this.entityList.size() + " total; " + WorldClient.this.entityList.toString(); + } + }); + crashreportcategory.addCrashSectionCallable("Retry entities", new Callable() + { + private static final String __OBFID = "CL_00000884"; + public String call() + { + return WorldClient.this.entitySpawnQueue.size() + " total; " + WorldClient.this.entitySpawnQueue.toString(); + } + }); + crashreportcategory.addCrashSectionCallable("Server brand", new Callable() + { + private static final String __OBFID = "CL_00000885"; + public String call() throws Exception + { + return WorldClient.this.mc.thePlayer.getClientBrand(); + } + }); + crashreportcategory.addCrashSectionCallable("Server type", new Callable() + { + private static final String __OBFID = "CL_00000886"; + public String call() throws Exception + { + return WorldClient.this.mc.getIntegratedServer() == null ? "Non-integrated multiplayer server" : "Integrated singleplayer server"; + } + }); + return crashreportcategory; + } + + /** + * Plays a sound at the specified position. + */ + public void playSoundAtPos(BlockPos p_175731_1_, String p_175731_2_, float p_175731_3_, float p_175731_4_, boolean p_175731_5_) + { + this.playSound((double)p_175731_1_.getX() + 0.5D, (double)p_175731_1_.getY() + 0.5D, (double)p_175731_1_.getZ() + 0.5D, p_175731_2_, p_175731_3_, p_175731_4_, p_175731_5_); + } + + /** + * par8 is loudness, all pars passed to minecraftInstance.sndManager.playSound + */ + public void playSound(double x, double y, double z, String soundName, float volume, float pitch, boolean distanceDelay) + { + double d0 = this.mc.getRenderViewEntity().getDistanceSq(x, y, z); + PositionedSoundRecord positionedsoundrecord = new PositionedSoundRecord(new ResourceLocation(soundName), volume, pitch, (float)x, (float)y, (float)z); + + if (distanceDelay && d0 > 100.0D) + { + double d1 = Math.sqrt(d0) / 40.0D; + this.mc.getSoundHandler().playDelayedSound(positionedsoundrecord, (int)(d1 * 20.0D)); + } + else + { + this.mc.getSoundHandler().playSound(positionedsoundrecord); + } + } + + public void makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, NBTTagCompound compund) + { + this.mc.effectRenderer.addEffect(new EntityFirework.StarterFX(this, x, y, z, motionX, motionY, motionZ, this.mc.effectRenderer, compund)); + } + + public void setWorldScoreboard(Scoreboard p_96443_1_) + { + this.worldScoreboard = p_96443_1_; + } + + /** + * Sets the world time. + */ + public void setWorldTime(long time) + { + if (time < 0L) + { + time = -time; + this.getGameRules().setOrCreateGameRule("doDaylightCycle", "false"); + } + else + { + this.getGameRules().setOrCreateGameRule("doDaylightCycle", "true"); + } + + super.setWorldTime(time); + } + + public int getCombinedLight(BlockPos pos, int lightValue) + { + int i = super.getCombinedLight(pos, lightValue); + + if (Config.isDynamicLights()) + { + i = DynamicLights.getCombinedLight(pos, i); + } + + return i; + } + + /** + * Sets the block state at a given location. Flag 1 will cause a block update. Flag 2 will send the change to + * clients (you almost always want this). Flag 4 prevents the block from being re-rendered, if this is a client + * world. Flags can be added together. + */ + public boolean setBlockState(BlockPos pos, IBlockState newState, int flags) + { + this.playerUpdate = this.isPlayerActing(); + boolean flag = super.setBlockState(pos, newState, flags); + this.playerUpdate = false; + return flag; + } + + private boolean isPlayerActing() + { + if (this.mc.playerController instanceof PlayerControllerOF) + { + PlayerControllerOF playercontrollerof = (PlayerControllerOF)this.mc.playerController; + return playercontrollerof.isActing(); + } + else + { + return false; + } + } + + public boolean isPlayerUpdate() + { + return this.playerUpdate; + } +} diff --git a/src/minecraft/net/minecraft/client/network/LanServerDetector.java b/src/minecraft/net/minecraft/client/network/LanServerDetector.java new file mode 100644 index 0000000..198edac --- /dev/null +++ b/src/minecraft/net/minecraft/client/network/LanServerDetector.java @@ -0,0 +1,156 @@ +package net.minecraft.client.network; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.InetAddress; +import java.net.MulticastSocket; +import java.net.SocketTimeoutException; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ThreadLanServerPing; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class LanServerDetector +{ + private static final AtomicInteger field_148551_a = new AtomicInteger(0); + private static final Logger logger = LogManager.getLogger(); + + public static class LanServer + { + private String lanServerMotd; + private String lanServerIpPort; + private long timeLastSeen; + + public LanServer(String motd, String address) + { + this.lanServerMotd = motd; + this.lanServerIpPort = address; + this.timeLastSeen = Minecraft.getSystemTime(); + } + + public String getServerMotd() + { + return this.lanServerMotd; + } + + public String getServerIpPort() + { + return this.lanServerIpPort; + } + + public void updateLastSeen() + { + this.timeLastSeen = Minecraft.getSystemTime(); + } + } + + public static class LanServerList + { + private List listOfLanServers = Lists.newArrayList(); + boolean wasUpdated; + + public synchronized boolean getWasUpdated() + { + return this.wasUpdated; + } + + public synchronized void setWasNotUpdated() + { + this.wasUpdated = false; + } + + public synchronized List getLanServers() + { + return Collections.unmodifiableList(this.listOfLanServers); + } + + public synchronized void func_77551_a(String p_77551_1_, InetAddress p_77551_2_) + { + String s = ThreadLanServerPing.getMotdFromPingResponse(p_77551_1_); + String s1 = ThreadLanServerPing.getAdFromPingResponse(p_77551_1_); + + if (s1 != null) + { + s1 = p_77551_2_.getHostAddress() + ":" + s1; + boolean flag = false; + + for (LanServerDetector.LanServer lanserverdetector$lanserver : this.listOfLanServers) + { + if (lanserverdetector$lanserver.getServerIpPort().equals(s1)) + { + lanserverdetector$lanserver.updateLastSeen(); + flag = true; + break; + } + } + + if (!flag) + { + this.listOfLanServers.add(new LanServerDetector.LanServer(s, s1)); + this.wasUpdated = true; + } + } + } + } + + public static class ThreadLanServerFind extends Thread + { + private final LanServerDetector.LanServerList localServerList; + private final InetAddress broadcastAddress; + private final MulticastSocket socket; + + public ThreadLanServerFind(LanServerDetector.LanServerList p_i1320_1_) throws IOException + { + super("LanServerDetector #" + LanServerDetector.field_148551_a.incrementAndGet()); + this.localServerList = p_i1320_1_; + this.setDaemon(true); + this.socket = new MulticastSocket(4445); + this.broadcastAddress = InetAddress.getByName("224.0.2.60"); + this.socket.setSoTimeout(5000); + this.socket.joinGroup(this.broadcastAddress); + } + + public void run() + { + byte[] abyte = new byte[1024]; + + while (!this.isInterrupted()) + { + DatagramPacket datagrampacket = new DatagramPacket(abyte, abyte.length); + + try + { + this.socket.receive(datagrampacket); + } + catch (SocketTimeoutException var5) + { + continue; + } + catch (IOException ioexception) + { + LanServerDetector.logger.error((String)"Couldn\'t ping server", (Throwable)ioexception); + break; + } + + String s = new String(datagrampacket.getData(), datagrampacket.getOffset(), datagrampacket.getLength()); + LanServerDetector.logger.debug(datagrampacket.getAddress() + ": " + s); + this.localServerList.func_77551_a(s, datagrampacket.getAddress()); + } + + try + { + this.socket.leaveGroup(this.broadcastAddress); + } + catch (IOException var4) + { + ; + } + + this.socket.close(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java b/src/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java new file mode 100644 index 0000000..b854d43 --- /dev/null +++ b/src/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java @@ -0,0 +1,38 @@ +package net.minecraft.client.network; + +import net.minecraft.network.NetworkManager; +import net.minecraft.network.handshake.INetHandlerHandshakeServer; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.network.NetHandlerLoginServer; +import net.minecraft.util.IChatComponent; + +public class NetHandlerHandshakeMemory implements INetHandlerHandshakeServer +{ + private final MinecraftServer mcServer; + private final NetworkManager networkManager; + + public NetHandlerHandshakeMemory(MinecraftServer p_i45287_1_, NetworkManager p_i45287_2_) + { + this.mcServer = p_i45287_1_; + this.networkManager = p_i45287_2_; + } + + /** + * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The + * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention + * must pass a versioncheck or receive a disconnect otherwise + */ + public void processHandshake(C00Handshake packetIn) + { + this.networkManager.setConnectionState(packetIn.getRequestedState()); + this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager)); + } + + /** + * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination + */ + public void onDisconnect(IChatComponent reason) + { + } +} diff --git a/src/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java b/src/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java new file mode 100644 index 0000000..fc7fb6d --- /dev/null +++ b/src/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java @@ -0,0 +1,127 @@ +package net.minecraft.client.network; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.exceptions.AuthenticationException; +import com.mojang.authlib.exceptions.AuthenticationUnavailableException; +import com.mojang.authlib.exceptions.InvalidCredentialsException; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import io.netty.util.concurrent.Future; +import io.netty.util.concurrent.GenericFutureListener; +import java.math.BigInteger; +import java.security.PublicKey; +import javax.crypto.SecretKey; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiDisconnected; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.network.EnumConnectionState; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.login.INetHandlerLoginClient; +import net.minecraft.network.login.client.C01PacketEncryptionResponse; +import net.minecraft.network.login.server.S00PacketDisconnect; +import net.minecraft.network.login.server.S01PacketEncryptionRequest; +import net.minecraft.network.login.server.S02PacketLoginSuccess; +import net.minecraft.network.login.server.S03PacketEnableCompression; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.CryptManager; +import net.minecraft.util.IChatComponent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class NetHandlerLoginClient implements INetHandlerLoginClient +{ + private static final Logger logger = LogManager.getLogger(); + private final Minecraft mc; + private final GuiScreen previousGuiScreen; + private final NetworkManager networkManager; + private GameProfile gameProfile; + + public NetHandlerLoginClient(NetworkManager p_i45059_1_, Minecraft mcIn, GuiScreen p_i45059_3_) + { + this.networkManager = p_i45059_1_; + this.mc = mcIn; + this.previousGuiScreen = p_i45059_3_; + } + + public void handleEncryptionRequest(S01PacketEncryptionRequest packetIn) + { + final SecretKey secretkey = CryptManager.createNewSharedKey(); + String s = packetIn.getServerId(); + PublicKey publickey = packetIn.getPublicKey(); + String s1 = (new BigInteger(CryptManager.getServerIdHash(s, publickey, secretkey))).toString(16); + + if (this.mc.getCurrentServerData() != null && this.mc.getCurrentServerData().func_181041_d()) + { + try + { + this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1); + } + catch (AuthenticationException var10) + { + logger.warn("Couldn\'t connect to auth servers but will continue to join LAN"); + } + } + else + { + try + { + this.getSessionService().joinServer(this.mc.getSession().getProfile(), this.mc.getSession().getToken(), s1); + } + catch (AuthenticationUnavailableException var7) + { + this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.serversUnavailable", new Object[0])})); + return; + } + catch (InvalidCredentialsException var8) + { + this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {new ChatComponentTranslation("disconnect.loginFailedInfo.invalidSession", new Object[0])})); + return; + } + catch (AuthenticationException authenticationexception) + { + this.networkManager.closeChannel(new ChatComponentTranslation("disconnect.loginFailedInfo", new Object[] {authenticationexception.getMessage()})); + return; + } + } + + this.networkManager.sendPacket(new C01PacketEncryptionResponse(secretkey, publickey, packetIn.getVerifyToken()), new GenericFutureListener < Future > () + { + public void operationComplete(Future p_operationComplete_1_) throws Exception + { + NetHandlerLoginClient.this.networkManager.enableEncryption(secretkey); + } + }, new GenericFutureListener[0]); + } + + private MinecraftSessionService getSessionService() + { + return this.mc.getSessionService(); + } + + public void handleLoginSuccess(S02PacketLoginSuccess packetIn) + { + this.gameProfile = packetIn.getProfile(); + this.networkManager.setConnectionState(EnumConnectionState.PLAY); + this.networkManager.setNetHandler(new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile)); + } + + /** + * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination + */ + public void onDisconnect(IChatComponent reason) + { + this.mc.displayGuiScreen(new GuiDisconnected(this.previousGuiScreen, "connect.failed", reason)); + } + + public void handleDisconnect(S00PacketDisconnect packetIn) + { + this.networkManager.closeChannel(packetIn.func_149603_c()); + } + + public void handleEnableCompression(S03PacketEnableCompression packetIn) + { + if (!this.networkManager.isLocalChannel()) + { + this.networkManager.setCompressionTreshold(packetIn.getCompressionTreshold()); + } + } +} diff --git a/src/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java b/src/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java new file mode 100644 index 0000000..d783332 --- /dev/null +++ b/src/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java @@ -0,0 +1,2127 @@ +package net.minecraft.client.network; + +import com.google.common.collect.Maps; +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.mojang.authlib.GameProfile; + +import animeware.gui.mainmenu.MainMenu; +import io.netty.buffer.Unpooled; +import java.io.File; +import java.io.IOException; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; +import java.util.Map.Entry; +import net.minecraft.block.Block; +import net.minecraft.client.ClientBrandRetriever; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.GuardianSound; +import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiDisconnected; +import net.minecraft.client.gui.GuiDownloadTerrain; +import net.minecraft.client.gui.GuiMainMenu; +import net.minecraft.client.gui.GuiMerchant; +import net.minecraft.client.gui.GuiMultiplayer; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiScreenBook; +import net.minecraft.client.gui.GuiScreenDemo; +import net.minecraft.client.gui.GuiScreenRealmsProxy; +import net.minecraft.client.gui.GuiWinGame; +import net.minecraft.client.gui.GuiYesNo; +import net.minecraft.client.gui.GuiYesNoCallback; +import net.minecraft.client.gui.IProgressMeter; +import net.minecraft.client.gui.inventory.GuiContainerCreative; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.multiplayer.ServerList; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.particle.EntityPickupFX; +import net.minecraft.client.player.inventory.ContainerLocalMenu; +import net.minecraft.client.player.inventory.LocalBlockIntercommunication; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.stream.MetadataAchievement; +import net.minecraft.client.stream.MetadataCombat; +import net.minecraft.client.stream.MetadataPlayerDeath; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.DataWatcher; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLeashKnot; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IMerchant; +import net.minecraft.entity.NpcMerchant; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.BaseAttributeMap; +import net.minecraft.entity.ai.attributes.IAttribute; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.ai.attributes.RangedAttribute; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.entity.item.EntityEnderEye; +import net.minecraft.entity.item.EntityEnderPearl; +import net.minecraft.entity.item.EntityExpBottle; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.entity.item.EntityFireworkRocket; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityPainting; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.monster.EntityGuardian; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityEgg; +import net.minecraft.entity.projectile.EntityFishHook; +import net.minecraft.entity.projectile.EntityLargeFireball; +import net.minecraft.entity.projectile.EntityPotion; +import net.minecraft.entity.projectile.EntitySmallFireball; +import net.minecraft.entity.projectile.EntitySnowball; +import net.minecraft.entity.projectile.EntityWitherSkull; +import net.minecraft.init.Items; +import net.minecraft.inventory.AnimalChest; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryBasic; +import net.minecraft.item.Item; +import net.minecraft.item.ItemMap; +import net.minecraft.item.ItemStack; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.PacketThreadUtil; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.network.play.client.C00PacketKeepAlive; +import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraft.network.play.client.C0FPacketConfirmTransaction; +import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraft.network.play.client.C19PacketResourcePackStatus; +import net.minecraft.network.play.server.S00PacketKeepAlive; +import net.minecraft.network.play.server.S01PacketJoinGame; +import net.minecraft.network.play.server.S02PacketChat; +import net.minecraft.network.play.server.S03PacketTimeUpdate; +import net.minecraft.network.play.server.S04PacketEntityEquipment; +import net.minecraft.network.play.server.S05PacketSpawnPosition; +import net.minecraft.network.play.server.S06PacketUpdateHealth; +import net.minecraft.network.play.server.S07PacketRespawn; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.network.play.server.S09PacketHeldItemChange; +import net.minecraft.network.play.server.S0APacketUseBed; +import net.minecraft.network.play.server.S0BPacketAnimation; +import net.minecraft.network.play.server.S0CPacketSpawnPlayer; +import net.minecraft.network.play.server.S0DPacketCollectItem; +import net.minecraft.network.play.server.S0EPacketSpawnObject; +import net.minecraft.network.play.server.S0FPacketSpawnMob; +import net.minecraft.network.play.server.S10PacketSpawnPainting; +import net.minecraft.network.play.server.S11PacketSpawnExperienceOrb; +import net.minecraft.network.play.server.S12PacketEntityVelocity; +import net.minecraft.network.play.server.S13PacketDestroyEntities; +import net.minecraft.network.play.server.S14PacketEntity; +import net.minecraft.network.play.server.S18PacketEntityTeleport; +import net.minecraft.network.play.server.S19PacketEntityHeadLook; +import net.minecraft.network.play.server.S19PacketEntityStatus; +import net.minecraft.network.play.server.S1BPacketEntityAttach; +import net.minecraft.network.play.server.S1CPacketEntityMetadata; +import net.minecraft.network.play.server.S1DPacketEntityEffect; +import net.minecraft.network.play.server.S1EPacketRemoveEntityEffect; +import net.minecraft.network.play.server.S1FPacketSetExperience; +import net.minecraft.network.play.server.S20PacketEntityProperties; +import net.minecraft.network.play.server.S21PacketChunkData; +import net.minecraft.network.play.server.S22PacketMultiBlockChange; +import net.minecraft.network.play.server.S23PacketBlockChange; +import net.minecraft.network.play.server.S24PacketBlockAction; +import net.minecraft.network.play.server.S25PacketBlockBreakAnim; +import net.minecraft.network.play.server.S26PacketMapChunkBulk; +import net.minecraft.network.play.server.S27PacketExplosion; +import net.minecraft.network.play.server.S28PacketEffect; +import net.minecraft.network.play.server.S29PacketSoundEffect; +import net.minecraft.network.play.server.S2APacketParticles; +import net.minecraft.network.play.server.S2BPacketChangeGameState; +import net.minecraft.network.play.server.S2CPacketSpawnGlobalEntity; +import net.minecraft.network.play.server.S2DPacketOpenWindow; +import net.minecraft.network.play.server.S2EPacketCloseWindow; +import net.minecraft.network.play.server.S2FPacketSetSlot; +import net.minecraft.network.play.server.S30PacketWindowItems; +import net.minecraft.network.play.server.S31PacketWindowProperty; +import net.minecraft.network.play.server.S32PacketConfirmTransaction; +import net.minecraft.network.play.server.S33PacketUpdateSign; +import net.minecraft.network.play.server.S34PacketMaps; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.network.play.server.S36PacketSignEditorOpen; +import net.minecraft.network.play.server.S37PacketStatistics; +import net.minecraft.network.play.server.S38PacketPlayerListItem; +import net.minecraft.network.play.server.S39PacketPlayerAbilities; +import net.minecraft.network.play.server.S3APacketTabComplete; +import net.minecraft.network.play.server.S3BPacketScoreboardObjective; +import net.minecraft.network.play.server.S3CPacketUpdateScore; +import net.minecraft.network.play.server.S3DPacketDisplayScoreboard; +import net.minecraft.network.play.server.S3EPacketTeams; +import net.minecraft.network.play.server.S3FPacketCustomPayload; +import net.minecraft.network.play.server.S40PacketDisconnect; +import net.minecraft.network.play.server.S41PacketServerDifficulty; +import net.minecraft.network.play.server.S42PacketCombatEvent; +import net.minecraft.network.play.server.S43PacketCamera; +import net.minecraft.network.play.server.S44PacketWorldBorder; +import net.minecraft.network.play.server.S45PacketTitle; +import net.minecraft.network.play.server.S46PacketSetCompressionLevel; +import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter; +import net.minecraft.network.play.server.S48PacketResourcePackSend; +import net.minecraft.network.play.server.S49PacketUpdateEntityNBT; +import net.minecraft.potion.PotionEffect; +import net.minecraft.realms.DisconnectedRealmsScreen; +import net.minecraft.scoreboard.IScoreObjectiveCriteria; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.scoreboard.Team; +import net.minecraft.stats.Achievement; +import net.minecraft.stats.AchievementList; +import net.minecraft.stats.StatBase; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityBanner; +import net.minecraft.tileentity.TileEntityBeacon; +import net.minecraft.tileentity.TileEntityCommandBlock; +import net.minecraft.tileentity.TileEntityFlowerPot; +import net.minecraft.tileentity.TileEntityMobSpawner; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.tileentity.TileEntitySkull; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StringUtils; +import net.minecraft.village.MerchantRecipeList; +import net.minecraft.world.Explosion; +import net.minecraft.world.WorldProviderSurface; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.storage.MapData; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class NetHandlerPlayClient implements INetHandlerPlayClient +{ + private static final Logger logger = LogManager.getLogger(); + + /** + * The NetworkManager instance used to communicate with the server (used only by handlePlayerPosLook to update + * positioning and handleJoinGame to inform the server of the client distribution/mods) + */ + private final NetworkManager netManager; + private final GameProfile profile; + + /** + * Seems to be either null (integrated server) or an instance of either GuiMultiplayer (when connecting to a server) + * or GuiScreenReamlsTOS (when connecting to MCO server) + */ + private final GuiScreen guiScreenServer; + + /** + * Reference to the Minecraft instance, which many handler methods operate on + */ + private Minecraft gameController; + + /** + * Reference to the current ClientWorld instance, which many handler methods operate on + */ + private WorldClient clientWorldController; + + /** + * True if the client has finished downloading terrain and may spawn. Set upon receipt of S08PacketPlayerPosLook, + * reset upon respawning + */ + private boolean doneLoadingTerrain; + private final Map playerInfoMap = Maps.newHashMap(); + public int currentServerMaxPlayers = 20; + private boolean field_147308_k = false; + + /** + * Just an ordinary random number generator, used to randomize audio pitch of item/orb pickup and randomize both + * particlespawn offset and velocity + */ + private final Random avRandomizer = new Random(); + + public NetHandlerPlayClient(Minecraft mcIn, GuiScreen p_i46300_2_, NetworkManager p_i46300_3_, GameProfile p_i46300_4_) + { + this.gameController = mcIn; + this.guiScreenServer = p_i46300_2_; + this.netManager = p_i46300_3_; + this.profile = p_i46300_4_; + } + + /** + * Clears the WorldClient instance associated with this NetHandlerPlayClient + */ + public void cleanup() + { + this.clientWorldController = null; + } + + /** + * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new + * WorldClient and sets the player initial dimension + */ + public void handleJoinGame(S01PacketJoinGame packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.playerController = new PlayerControllerMP(this.gameController, this); + this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler); + this.gameController.gameSettings.difficulty = packetIn.getDifficulty(); + this.gameController.loadWorld(this.clientWorldController); + this.gameController.thePlayer.dimension = packetIn.getDimension(); + this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); + this.gameController.thePlayer.setEntityId(packetIn.getEntityId()); + this.currentServerMaxPlayers = packetIn.getMaxPlayers(); + this.gameController.thePlayer.setReducedDebug(packetIn.isReducedDebugInfo()); + this.gameController.playerController.setGameType(packetIn.getGameType()); + this.gameController.gameSettings.sendSettingsToServer(); + this.netManager.sendPacket(new C17PacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(ClientBrandRetriever.getClientModName()))); + } + + /** + * Spawns an instance of the objecttype indicated by the packet and sets its position and momentum + */ + public void handleSpawnObject(S0EPacketSpawnObject packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + double d0 = (double)packetIn.getX() / 32.0D; + double d1 = (double)packetIn.getY() / 32.0D; + double d2 = (double)packetIn.getZ() / 32.0D; + Entity entity = null; + + if (packetIn.getType() == 10) + { + entity = EntityMinecart.func_180458_a(this.clientWorldController, d0, d1, d2, EntityMinecart.EnumMinecartType.byNetworkID(packetIn.func_149009_m())); + } + else if (packetIn.getType() == 90) + { + Entity entity1 = this.clientWorldController.getEntityByID(packetIn.func_149009_m()); + + if (entity1 instanceof EntityPlayer) + { + entity = new EntityFishHook(this.clientWorldController, d0, d1, d2, (EntityPlayer)entity1); + } + + packetIn.func_149002_g(0); + } + else if (packetIn.getType() == 60) + { + entity = new EntityArrow(this.clientWorldController, d0, d1, d2); + } + else if (packetIn.getType() == 61) + { + entity = new EntitySnowball(this.clientWorldController, d0, d1, d2); + } + else if (packetIn.getType() == 71) + { + entity = new EntityItemFrame(this.clientWorldController, new BlockPos(MathHelper.floor_double(d0), MathHelper.floor_double(d1), MathHelper.floor_double(d2)), EnumFacing.getHorizontal(packetIn.func_149009_m())); + packetIn.func_149002_g(0); + } + else if (packetIn.getType() == 77) + { + entity = new EntityLeashKnot(this.clientWorldController, new BlockPos(MathHelper.floor_double(d0), MathHelper.floor_double(d1), MathHelper.floor_double(d2))); + packetIn.func_149002_g(0); + } + else if (packetIn.getType() == 65) + { + entity = new EntityEnderPearl(this.clientWorldController, d0, d1, d2); + } + else if (packetIn.getType() == 72) + { + entity = new EntityEnderEye(this.clientWorldController, d0, d1, d2); + } + else if (packetIn.getType() == 76) + { + entity = new EntityFireworkRocket(this.clientWorldController, d0, d1, d2, (ItemStack)null); + } + else if (packetIn.getType() == 63) + { + entity = new EntityLargeFireball(this.clientWorldController, d0, d1, d2, (double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D); + packetIn.func_149002_g(0); + } + else if (packetIn.getType() == 64) + { + entity = new EntitySmallFireball(this.clientWorldController, d0, d1, d2, (double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D); + packetIn.func_149002_g(0); + } + else if (packetIn.getType() == 66) + { + entity = new EntityWitherSkull(this.clientWorldController, d0, d1, d2, (double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D); + packetIn.func_149002_g(0); + } + else if (packetIn.getType() == 62) + { + entity = new EntityEgg(this.clientWorldController, d0, d1, d2); + } + else if (packetIn.getType() == 73) + { + entity = new EntityPotion(this.clientWorldController, d0, d1, d2, packetIn.func_149009_m()); + packetIn.func_149002_g(0); + } + else if (packetIn.getType() == 75) + { + entity = new EntityExpBottle(this.clientWorldController, d0, d1, d2); + packetIn.func_149002_g(0); + } + else if (packetIn.getType() == 1) + { + entity = new EntityBoat(this.clientWorldController, d0, d1, d2); + } + else if (packetIn.getType() == 50) + { + entity = new EntityTNTPrimed(this.clientWorldController, d0, d1, d2, (EntityLivingBase)null); + } + else if (packetIn.getType() == 78) + { + entity = new EntityArmorStand(this.clientWorldController, d0, d1, d2); + } + else if (packetIn.getType() == 51) + { + entity = new EntityEnderCrystal(this.clientWorldController, d0, d1, d2); + } + else if (packetIn.getType() == 2) + { + entity = new EntityItem(this.clientWorldController, d0, d1, d2); + } + else if (packetIn.getType() == 70) + { + entity = new EntityFallingBlock(this.clientWorldController, d0, d1, d2, Block.getStateById(packetIn.func_149009_m() & 65535)); + packetIn.func_149002_g(0); + } + + if (entity != null) + { + entity.serverPosX = packetIn.getX(); + entity.serverPosY = packetIn.getY(); + entity.serverPosZ = packetIn.getZ(); + entity.rotationPitch = (float)(packetIn.getPitch() * 360) / 256.0F; + entity.rotationYaw = (float)(packetIn.getYaw() * 360) / 256.0F; + Entity[] aentity = entity.getParts(); + + if (aentity != null) + { + int i = packetIn.getEntityID() - entity.getEntityId(); + + for (int j = 0; j < aentity.length; ++j) + { + aentity[j].setEntityId(aentity[j].getEntityId() + i); + } + } + + entity.setEntityId(packetIn.getEntityID()); + this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity); + + if (packetIn.func_149009_m() > 0) + { + if (packetIn.getType() == 60) + { + Entity entity2 = this.clientWorldController.getEntityByID(packetIn.func_149009_m()); + + if (entity2 instanceof EntityLivingBase && entity instanceof EntityArrow) + { + ((EntityArrow)entity).shootingEntity = entity2; + } + } + + entity.setVelocity((double)packetIn.getSpeedX() / 8000.0D, (double)packetIn.getSpeedY() / 8000.0D, (double)packetIn.getSpeedZ() / 8000.0D); + } + } + } + + /** + * Spawns an experience orb and sets its value (amount of XP) + */ + public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = new EntityXPOrb(this.clientWorldController, (double)packetIn.getX() / 32.0D, (double)packetIn.getY() / 32.0D, (double)packetIn.getZ() / 32.0D, packetIn.getXPValue()); + entity.serverPosX = packetIn.getX(); + entity.serverPosY = packetIn.getY(); + entity.serverPosZ = packetIn.getZ(); + entity.rotationYaw = 0.0F; + entity.rotationPitch = 0.0F; + entity.setEntityId(packetIn.getEntityID()); + this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entity); + } + + /** + * Handles globally visible entities. Used in vanilla for lightning bolts + */ + public void handleSpawnGlobalEntity(S2CPacketSpawnGlobalEntity packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + double d0 = (double)packetIn.func_149051_d() / 32.0D; + double d1 = (double)packetIn.func_149050_e() / 32.0D; + double d2 = (double)packetIn.func_149049_f() / 32.0D; + Entity entity = null; + + if (packetIn.func_149053_g() == 1) + { + entity = new EntityLightningBolt(this.clientWorldController, d0, d1, d2); + } + + if (entity != null) + { + entity.serverPosX = packetIn.func_149051_d(); + entity.serverPosY = packetIn.func_149050_e(); + entity.serverPosZ = packetIn.func_149049_f(); + entity.rotationYaw = 0.0F; + entity.rotationPitch = 0.0F; + entity.setEntityId(packetIn.func_149052_c()); + this.clientWorldController.addWeatherEffect(entity); + } + } + + /** + * Handles the spawning of a painting object + */ + public void handleSpawnPainting(S10PacketSpawnPainting packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + EntityPainting entitypainting = new EntityPainting(this.clientWorldController, packetIn.getPosition(), packetIn.getFacing(), packetIn.getTitle()); + this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitypainting); + } + + /** + * Sets the velocity of the specified entity to the specified value + */ + public void handleEntityVelocity(S12PacketEntityVelocity packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID()); + + if (entity != null) + { + entity.setVelocity((double)packetIn.getMotionX() / 8000.0D, (double)packetIn.getMotionY() / 8000.0D, (double)packetIn.getMotionZ() / 8000.0D); + } + } + + /** + * Invoked when the server registers new proximate objects in your watchlist or when objects in your watchlist have + * changed -> Registers any changes locally + */ + public void handleEntityMetadata(S1CPacketEntityMetadata packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); + + if (entity != null && packetIn.func_149376_c() != null) + { + entity.getDataWatcher().updateWatchedObjectsFromList(packetIn.func_149376_c()); + } + } + + /** + * Handles the creation of a nearby player entity, sets the position and held item + */ + public void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + double d0 = (double)packetIn.getX() / 32.0D; + double d1 = (double)packetIn.getY() / 32.0D; + double d2 = (double)packetIn.getZ() / 32.0D; + float f = (float)(packetIn.getYaw() * 360) / 256.0F; + float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; + EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld, this.getPlayerInfo(packetIn.getPlayer()).getGameProfile()); + entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = (double)(entityotherplayermp.serverPosX = packetIn.getX()); + entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = (double)(entityotherplayermp.serverPosY = packetIn.getY()); + entityotherplayermp.prevPosZ = entityotherplayermp.lastTickPosZ = (double)(entityotherplayermp.serverPosZ = packetIn.getZ()); + int i = packetIn.getCurrentItemID(); + + if (i == 0) + { + entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = null; + } + else + { + entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = new ItemStack(Item.getItemById(i), 1, 0); + } + + entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1); + this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp); + List list = packetIn.func_148944_c(); + + if (list != null) + { + entityotherplayermp.getDataWatcher().updateWatchedObjectsFromList(list); + } + } + + /** + * Updates an entity's position and rotation as specified by the packet + */ + public void handleEntityTeleport(S18PacketEntityTeleport packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); + + if (entity != null) + { + entity.serverPosX = packetIn.getX(); + entity.serverPosY = packetIn.getY(); + entity.serverPosZ = packetIn.getZ(); + double d0 = (double)entity.serverPosX / 32.0D; + double d1 = (double)entity.serverPosY / 32.0D; + double d2 = (double)entity.serverPosZ / 32.0D; + float f = (float)(packetIn.getYaw() * 360) / 256.0F; + float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; + + if (Math.abs(entity.posX - d0) < 0.03125D && Math.abs(entity.posY - d1) < 0.015625D && Math.abs(entity.posZ - d2) < 0.03125D) + { + entity.setPositionAndRotation2(entity.posX, entity.posY, entity.posZ, f, f1, 3, true); + } + else + { + entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, true); + } + + entity.onGround = packetIn.getOnGround(); + } + } + + /** + * Updates which hotbar slot of the player is currently selected + */ + public void handleHeldItemChange(S09PacketHeldItemChange packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + + if (packetIn.getHeldItemHotbarIndex() >= 0 && packetIn.getHeldItemHotbarIndex() < InventoryPlayer.getHotbarSize()) + { + this.gameController.thePlayer.inventory.currentItem = packetIn.getHeldItemHotbarIndex(); + } + } + + /** + * Updates the specified entity's position by the specified relative moment and absolute rotation. Note that + * subclassing of the packet allows for the specification of a subset of this data (e.g. only rel. position, abs. + * rotation or both). + */ + public void handleEntityMovement(S14PacketEntity packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = packetIn.getEntity(this.clientWorldController); + + if (entity != null) + { + entity.serverPosX += packetIn.func_149062_c(); + entity.serverPosY += packetIn.func_149061_d(); + entity.serverPosZ += packetIn.func_149064_e(); + double d0 = (double)entity.serverPosX / 32.0D; + double d1 = (double)entity.serverPosY / 32.0D; + double d2 = (double)entity.serverPosZ / 32.0D; + float f = packetIn.func_149060_h() ? (float)(packetIn.func_149066_f() * 360) / 256.0F : entity.rotationYaw; + float f1 = packetIn.func_149060_h() ? (float)(packetIn.func_149063_g() * 360) / 256.0F : entity.rotationPitch; + entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, false); + entity.onGround = packetIn.getOnGround(); + } + } + + /** + * Updates the direction in which the specified entity is looking, normally this head rotation is independent of the + * rotation of the entity itself + */ + public void handleEntityHeadLook(S19PacketEntityHeadLook packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = packetIn.getEntity(this.clientWorldController); + + if (entity != null) + { + float f = (float)(packetIn.getYaw() * 360) / 256.0F; + entity.setRotationYawHead(f); + } + } + + /** + * Locally eliminates the entities. Invoked by the server when the items are in fact destroyed, or the player is no + * longer registered as required to monitor them. The latter happens when distance between the player and item + * increases beyond a certain treshold (typically the viewing distance) + */ + public void handleDestroyEntities(S13PacketDestroyEntities packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + + for (int i = 0; i < packetIn.getEntityIDs().length; ++i) + { + this.clientWorldController.removeEntityFromWorld(packetIn.getEntityIDs()[i]); + } + } + + /** + * Handles changes in player positioning and rotation such as when travelling to a new dimension, (re)spawning, + * mounting horses etc. Seems to immediately reply to the server with the clients post-processing perspective on the + * player positioning + */ + public void handlePlayerPosLook(S08PacketPlayerPosLook packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + EntityPlayer entityplayer = this.gameController.thePlayer; + double d0 = packetIn.getX(); + double d1 = packetIn.getY(); + double d2 = packetIn.getZ(); + float f = packetIn.getYaw(); + float f1 = packetIn.getPitch(); + + if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.X)) + { + d0 += entityplayer.posX; + } + else + { + entityplayer.motionX = 0.0D; + } + + if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Y)) + { + d1 += entityplayer.posY; + } + else + { + entityplayer.motionY = 0.0D; + } + + if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Z)) + { + d2 += entityplayer.posZ; + } + else + { + entityplayer.motionZ = 0.0D; + } + + if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.X_ROT)) + { + f1 += entityplayer.rotationPitch; + } + + if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Y_ROT)) + { + f += entityplayer.rotationYaw; + } + + entityplayer.setPositionAndRotation(d0, d1, d2, f, f1); + this.netManager.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(entityplayer.posX, entityplayer.getEntityBoundingBox().minY, entityplayer.posZ, entityplayer.rotationYaw, entityplayer.rotationPitch, false)); + + if (!this.doneLoadingTerrain) + { + this.gameController.thePlayer.prevPosX = this.gameController.thePlayer.posX; + this.gameController.thePlayer.prevPosY = this.gameController.thePlayer.posY; + this.gameController.thePlayer.prevPosZ = this.gameController.thePlayer.posZ; + this.doneLoadingTerrain = true; + this.gameController.displayGuiScreen((GuiScreen)null); + } + } + + /** + * Received from the servers PlayerManager if between 1 and 64 blocks in a chunk are changed. If only one block + * requires an update, the server sends S23PacketBlockChange and if 64 or more blocks are changed, the server sends + * S21PacketChunkData + */ + public void handleMultiBlockChange(S22PacketMultiBlockChange packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + + for (S22PacketMultiBlockChange.BlockUpdateData s22packetmultiblockchange$blockupdatedata : packetIn.getChangedBlocks()) + { + this.clientWorldController.invalidateRegionAndSetBlock(s22packetmultiblockchange$blockupdatedata.getPos(), s22packetmultiblockchange$blockupdatedata.getBlockState()); + } + } + + /** + * Updates the specified chunk with the supplied data, marks it for re-rendering and lighting recalculation + */ + public void handleChunkData(S21PacketChunkData packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + + if (packetIn.func_149274_i()) + { + if (packetIn.getExtractedSize() == 0) + { + this.clientWorldController.doPreChunk(packetIn.getChunkX(), packetIn.getChunkZ(), false); + return; + } + + this.clientWorldController.doPreChunk(packetIn.getChunkX(), packetIn.getChunkZ(), true); + } + + this.clientWorldController.invalidateBlockReceiveRegion(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 256, (packetIn.getChunkZ() << 4) + 15); + Chunk chunk = this.clientWorldController.getChunkFromChunkCoords(packetIn.getChunkX(), packetIn.getChunkZ()); + chunk.fillChunk(packetIn.func_149272_d(), packetIn.getExtractedSize(), packetIn.func_149274_i()); + this.clientWorldController.markBlockRangeForRenderUpdate(packetIn.getChunkX() << 4, 0, packetIn.getChunkZ() << 4, (packetIn.getChunkX() << 4) + 15, 256, (packetIn.getChunkZ() << 4) + 15); + + if (!packetIn.func_149274_i() || !(this.clientWorldController.provider instanceof WorldProviderSurface)) + { + chunk.resetRelightChecks(); + } + } + + /** + * Updates the block and metadata and generates a blockupdate (and notify the clients) + */ + public void handleBlockChange(S23PacketBlockChange packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.clientWorldController.invalidateRegionAndSetBlock(packetIn.getBlockPosition(), packetIn.getBlockState()); + } + + /** + * Closes the network channel + */ + public void handleDisconnect(S40PacketDisconnect packetIn) + { + this.netManager.closeChannel(packetIn.getReason()); + } + + /** + * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination + */ + public void onDisconnect(IChatComponent reason) + { + this.gameController.loadWorld((WorldClient)null); + + if (this.guiScreenServer != null) + { + if (this.guiScreenServer instanceof GuiScreenRealmsProxy) + { + this.gameController.displayGuiScreen((new DisconnectedRealmsScreen(((GuiScreenRealmsProxy)this.guiScreenServer).func_154321_a(), "disconnect.lost", reason)).getProxy()); + } + else + { + this.gameController.displayGuiScreen(new GuiDisconnected(this.guiScreenServer, "disconnect.lost", reason)); + } + } + else + { + this.gameController.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new MainMenu()), "disconnect.lost", reason)); + } + } + + public void addToSendQueue(Packet p_147297_1_) + { + this.netManager.sendPacket(p_147297_1_); + } + + public void handleCollectItem(S0DPacketCollectItem packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = this.clientWorldController.getEntityByID(packetIn.getCollectedItemEntityID()); + EntityLivingBase entitylivingbase = (EntityLivingBase)this.clientWorldController.getEntityByID(packetIn.getEntityID()); + + if (entitylivingbase == null) + { + entitylivingbase = this.gameController.thePlayer; + } + + if (entity != null) + { + if (entity instanceof EntityXPOrb) + { + this.clientWorldController.playSoundAtEntity(entity, "random.orb", 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F); + } + else + { + this.clientWorldController.playSoundAtEntity(entity, "random.pop", 0.2F, ((this.avRandomizer.nextFloat() - this.avRandomizer.nextFloat()) * 0.7F + 1.0F) * 2.0F); + } + + this.gameController.effectRenderer.addEffect(new EntityPickupFX(this.clientWorldController, entity, entitylivingbase, 0.5F)); + this.clientWorldController.removeEntityFromWorld(packetIn.getCollectedItemEntityID()); + } + } + + /** + * Prints a chatmessage in the chat GUI + */ + public void handleChat(S02PacketChat packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + + if (packetIn.getType() == 2) + { + this.gameController.ingameGUI.setRecordPlaying(packetIn.getChatComponent(), false); + } + else + { + this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.getChatComponent()); + } + } + + /** + * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt + * or receiving a critical hit by normal or magical means + */ + public void handleAnimation(S0BPacketAnimation packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID()); + + if (entity != null) + { + if (packetIn.getAnimationType() == 0) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)entity; + entitylivingbase.swingItem(); + } + else if (packetIn.getAnimationType() == 1) + { + entity.performHurtAnimation(); + } + else if (packetIn.getAnimationType() == 2) + { + EntityPlayer entityplayer = (EntityPlayer)entity; + entityplayer.wakeUpPlayer(false, false, false); + } + else if (packetIn.getAnimationType() == 4) + { + this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT); + } + else if (packetIn.getAnimationType() == 5) + { + this.gameController.effectRenderer.emitParticleAtEntity(entity, EnumParticleTypes.CRIT_MAGIC); + } + } + } + + /** + * Retrieves the player identified by the packet, puts him to sleep if possible (and flags whether all players are + * asleep) + */ + public void handleUseBed(S0APacketUseBed packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + packetIn.getPlayer(this.clientWorldController).trySleep(packetIn.getBedPosition()); + } + + /** + * Spawns the mob entity at the specified location, with the specified rotation, momentum and type. Updates the + * entities Datawatchers with the entity metadata specified in the packet + */ + public void handleSpawnMob(S0FPacketSpawnMob packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + double d0 = (double)packetIn.getX() / 32.0D; + double d1 = (double)packetIn.getY() / 32.0D; + double d2 = (double)packetIn.getZ() / 32.0D; + float f = (float)(packetIn.getYaw() * 360) / 256.0F; + float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; + EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.getEntityType(), this.gameController.theWorld); + entitylivingbase.serverPosX = packetIn.getX(); + entitylivingbase.serverPosY = packetIn.getY(); + entitylivingbase.serverPosZ = packetIn.getZ(); + entitylivingbase.renderYawOffset = entitylivingbase.rotationYawHead = (float)(packetIn.getHeadPitch() * 360) / 256.0F; + Entity[] aentity = entitylivingbase.getParts(); + + if (aentity != null) + { + int i = packetIn.getEntityID() - entitylivingbase.getEntityId(); + + for (int j = 0; j < aentity.length; ++j) + { + aentity[j].setEntityId(aentity[j].getEntityId() + i); + } + } + + entitylivingbase.setEntityId(packetIn.getEntityID()); + entitylivingbase.setPositionAndRotation(d0, d1, d2, f, f1); + entitylivingbase.motionX = (double)((float)packetIn.getVelocityX() / 8000.0F); + entitylivingbase.motionY = (double)((float)packetIn.getVelocityY() / 8000.0F); + entitylivingbase.motionZ = (double)((float)packetIn.getVelocityZ() / 8000.0F); + this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entitylivingbase); + List list = packetIn.func_149027_c(); + + if (list != null) + { + entitylivingbase.getDataWatcher().updateWatchedObjectsFromList(list); + } + } + + public void handleTimeUpdate(S03PacketTimeUpdate packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.theWorld.setTotalWorldTime(packetIn.getTotalWorldTime()); + this.gameController.theWorld.setWorldTime(packetIn.getWorldTime()); + } + + public void handleSpawnPosition(S05PacketSpawnPosition packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.thePlayer.setSpawnPoint(packetIn.getSpawnPos(), true); + this.gameController.theWorld.getWorldInfo().setSpawn(packetIn.getSpawnPos()); + } + + public void handleEntityAttach(S1BPacketEntityAttach packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); + Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getVehicleEntityId()); + + if (packetIn.getLeash() == 0) + { + boolean flag = false; + + if (packetIn.getEntityId() == this.gameController.thePlayer.getEntityId()) + { + entity = this.gameController.thePlayer; + + if (entity1 instanceof EntityBoat) + { + ((EntityBoat)entity1).setIsBoatEmpty(false); + } + + flag = entity.ridingEntity == null && entity1 != null; + } + else if (entity1 instanceof EntityBoat) + { + ((EntityBoat)entity1).setIsBoatEmpty(true); + } + + if (entity == null) + { + return; + } + + entity.mountEntity(entity1); + + if (flag) + { + GameSettings gamesettings = this.gameController.gameSettings; + this.gameController.ingameGUI.setRecordPlaying(I18n.format("mount.onboard", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindSneak.getKeyCode())}), false); + } + } + else if (packetIn.getLeash() == 1 && entity instanceof EntityLiving) + { + if (entity1 != null) + { + ((EntityLiving)entity).setLeashedToEntity(entity1, false); + } + else + { + ((EntityLiving)entity).clearLeashed(false, false); + } + } + } + + /** + * Invokes the entities' handleUpdateHealth method which is implemented in LivingBase (hurt/death), + * MinecartMobSpawner (spawn delay), FireworkRocket & MinecartTNT (explosion), IronGolem (throwing,...), Witch + * (spawn particles), Zombie (villager transformation), Animal (breeding mode particles), Horse (breeding/smoke + * particles), Sheep (...), Tameable (...), Villager (particles for breeding mode, angry and happy), Wolf (...) + */ + public void handleEntityStatus(S19PacketEntityStatus packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = packetIn.getEntity(this.clientWorldController); + + if (entity != null) + { + if (packetIn.getOpCode() == 21) + { + this.gameController.getSoundHandler().playSound(new GuardianSound((EntityGuardian)entity)); + } + else + { + entity.handleStatusUpdate(packetIn.getOpCode()); + } + } + } + + public void handleUpdateHealth(S06PacketUpdateHealth packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.thePlayer.setPlayerSPHealth(packetIn.getHealth()); + this.gameController.thePlayer.getFoodStats().setFoodLevel(packetIn.getFoodLevel()); + this.gameController.thePlayer.getFoodStats().setFoodSaturationLevel(packetIn.getSaturationLevel()); + } + + public void handleSetExperience(S1FPacketSetExperience packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.thePlayer.setXPStats(packetIn.func_149397_c(), packetIn.getTotalExperience(), packetIn.getLevel()); + } + + public void handleRespawn(S07PacketRespawn packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + + if (packetIn.getDimensionID() != this.gameController.thePlayer.dimension) + { + this.doneLoadingTerrain = false; + Scoreboard scoreboard = this.clientWorldController.getScoreboard(); + this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, this.gameController.theWorld.getWorldInfo().isHardcoreModeEnabled(), packetIn.getWorldType()), packetIn.getDimensionID(), packetIn.getDifficulty(), this.gameController.mcProfiler); + this.clientWorldController.setWorldScoreboard(scoreboard); + this.gameController.loadWorld(this.clientWorldController); + this.gameController.thePlayer.dimension = packetIn.getDimensionID(); + this.gameController.displayGuiScreen(new GuiDownloadTerrain(this)); + } + + this.gameController.setDimensionAndSpawnPlayer(packetIn.getDimensionID()); + this.gameController.playerController.setGameType(packetIn.getGameType()); + } + + /** + * Initiates a new explosion (sound, particles, drop spawn) for the affected blocks indicated by the packet. + */ + public void handleExplosion(S27PacketExplosion packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Explosion explosion = new Explosion(this.gameController.theWorld, (Entity)null, packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getStrength(), packetIn.getAffectedBlockPositions()); + explosion.doExplosionB(true); + this.gameController.thePlayer.motionX += (double)packetIn.func_149149_c(); + this.gameController.thePlayer.motionY += (double)packetIn.func_149144_d(); + this.gameController.thePlayer.motionZ += (double)packetIn.func_149147_e(); + } + + /** + * Displays a GUI by ID. In order starting from id 0: Chest, Workbench, Furnace, Dispenser, Enchanting table, + * Brewing stand, Villager merchant, Beacon, Anvil, Hopper, Dropper, Horse + */ + public void handleOpenWindow(S2DPacketOpenWindow packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + EntityPlayerSP entityplayersp = this.gameController.thePlayer; + + if ("minecraft:container".equals(packetIn.getGuiId())) + { + entityplayersp.displayGUIChest(new InventoryBasic(packetIn.getWindowTitle(), packetIn.getSlotCount())); + entityplayersp.openContainer.windowId = packetIn.getWindowId(); + } + else if ("minecraft:villager".equals(packetIn.getGuiId())) + { + entityplayersp.displayVillagerTradeGui(new NpcMerchant(entityplayersp, packetIn.getWindowTitle())); + entityplayersp.openContainer.windowId = packetIn.getWindowId(); + } + else if ("EntityHorse".equals(packetIn.getGuiId())) + { + Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); + + if (entity instanceof EntityHorse) + { + entityplayersp.displayGUIHorse((EntityHorse)entity, new AnimalChest(packetIn.getWindowTitle(), packetIn.getSlotCount())); + entityplayersp.openContainer.windowId = packetIn.getWindowId(); + } + } + else if (!packetIn.hasSlots()) + { + entityplayersp.displayGui(new LocalBlockIntercommunication(packetIn.getGuiId(), packetIn.getWindowTitle())); + entityplayersp.openContainer.windowId = packetIn.getWindowId(); + } + else + { + ContainerLocalMenu containerlocalmenu = new ContainerLocalMenu(packetIn.getGuiId(), packetIn.getWindowTitle(), packetIn.getSlotCount()); + entityplayersp.displayGUIChest(containerlocalmenu); + entityplayersp.openContainer.windowId = packetIn.getWindowId(); + } + } + + /** + * Handles pickin up an ItemStack or dropping one in your inventory or an open (non-creative) container + */ + public void handleSetSlot(S2FPacketSetSlot packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + EntityPlayer entityplayer = this.gameController.thePlayer; + + if (packetIn.func_149175_c() == -1) + { + entityplayer.inventory.setItemStack(packetIn.func_149174_e()); + } + else + { + boolean flag = false; + + if (this.gameController.currentScreen instanceof GuiContainerCreative) + { + GuiContainerCreative guicontainercreative = (GuiContainerCreative)this.gameController.currentScreen; + flag = guicontainercreative.getSelectedTabIndex() != CreativeTabs.tabInventory.getTabIndex(); + } + + if (packetIn.func_149175_c() == 0 && packetIn.func_149173_d() >= 36 && packetIn.func_149173_d() < 45) + { + ItemStack itemstack = entityplayer.inventoryContainer.getSlot(packetIn.func_149173_d()).getStack(); + + if (packetIn.func_149174_e() != null && (itemstack == null || itemstack.stackSize < packetIn.func_149174_e().stackSize)) + { + packetIn.func_149174_e().animationsToGo = 5; + } + + entityplayer.inventoryContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e()); + } + else if (packetIn.func_149175_c() == entityplayer.openContainer.windowId && (packetIn.func_149175_c() != 0 || !flag)) + { + entityplayer.openContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e()); + } + } + } + + /** + * Verifies that the server and client are synchronized with respect to the inventory/container opened by the player + * and confirms if it is the case. + */ + public void handleConfirmTransaction(S32PacketConfirmTransaction packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Container container = null; + EntityPlayer entityplayer = this.gameController.thePlayer; + + if (packetIn.getWindowId() == 0) + { + container = entityplayer.inventoryContainer; + } + else if (packetIn.getWindowId() == entityplayer.openContainer.windowId) + { + container = entityplayer.openContainer; + } + + if (container != null && !packetIn.func_148888_e()) + { + this.addToSendQueue(new C0FPacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true)); + } + } + + /** + * Handles the placement of a specified ItemStack in a specified container/inventory slot + */ + public void handleWindowItems(S30PacketWindowItems packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + EntityPlayer entityplayer = this.gameController.thePlayer; + + if (packetIn.func_148911_c() == 0) + { + entityplayer.inventoryContainer.putStacksInSlots(packetIn.getItemStacks()); + } + else if (packetIn.func_148911_c() == entityplayer.openContainer.windowId) + { + entityplayer.openContainer.putStacksInSlots(packetIn.getItemStacks()); + } + } + + /** + * Creates a sign in the specified location if it didn't exist and opens the GUI to edit its text + */ + public void handleSignEditorOpen(S36PacketSignEditorOpen packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + TileEntity tileentity = this.clientWorldController.getTileEntity(packetIn.getSignPosition()); + + if (!(tileentity instanceof TileEntitySign)) + { + tileentity = new TileEntitySign(); + tileentity.setWorldObj(this.clientWorldController); + tileentity.setPos(packetIn.getSignPosition()); + } + + this.gameController.thePlayer.openEditSign((TileEntitySign)tileentity); + } + + /** + * Updates a specified sign with the specified text lines + */ + public void handleUpdateSign(S33PacketUpdateSign packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + boolean flag = false; + + if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) + { + TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); + + if (tileentity instanceof TileEntitySign) + { + TileEntitySign tileentitysign = (TileEntitySign)tileentity; + + if (tileentitysign.getIsEditable()) + { + System.arraycopy(packetIn.getLines(), 0, tileentitysign.signText, 0, 4); + tileentitysign.markDirty(); + } + + flag = true; + } + } + + if (!flag && this.gameController.thePlayer != null) + { + this.gameController.thePlayer.addChatMessage(new ChatComponentText("Unable to locate sign at " + packetIn.getPos().getX() + ", " + packetIn.getPos().getY() + ", " + packetIn.getPos().getZ())); + } + } + + /** + * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, + * beacons, skulls, flowerpot + */ + public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + + if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) + { + TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); + int i = packetIn.getTileEntityType(); + + if (i == 1 && tileentity instanceof TileEntityMobSpawner || i == 2 && tileentity instanceof TileEntityCommandBlock || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner) + { + tileentity.readFromNBT(packetIn.getNbtCompound()); + } + } + } + + /** + * Sets the progressbar of the opened window to the specified value + */ + public void handleWindowProperty(S31PacketWindowProperty packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + EntityPlayer entityplayer = this.gameController.thePlayer; + + if (entityplayer.openContainer != null && entityplayer.openContainer.windowId == packetIn.getWindowId()) + { + entityplayer.openContainer.updateProgressBar(packetIn.getVarIndex(), packetIn.getVarValue()); + } + } + + public void handleEntityEquipment(S04PacketEntityEquipment packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID()); + + if (entity != null) + { + entity.setCurrentItemOrArmor(packetIn.getEquipmentSlot(), packetIn.getItemStack()); + } + } + + /** + * Resets the ItemStack held in hand and closes the window that is opened + */ + public void handleCloseWindow(S2EPacketCloseWindow packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.thePlayer.closeScreenAndDropStack(); + } + + /** + * Triggers Block.onBlockEventReceived, which is implemented in BlockPistonBase for extension/retraction, BlockNote + * for setting the instrument (including audiovisual feedback) and in BlockContainer to set the number of players + * accessing a (Ender)Chest + */ + public void handleBlockAction(S24PacketBlockAction packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.theWorld.addBlockEvent(packetIn.getBlockPosition(), packetIn.getBlockType(), packetIn.getData1(), packetIn.getData2()); + } + + /** + * Updates all registered IWorldAccess instances with destroyBlockInWorldPartially + */ + public void handleBlockBreakAnim(S25PacketBlockBreakAnim packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.theWorld.sendBlockBreakProgress(packetIn.getBreakerId(), packetIn.getPosition(), packetIn.getProgress()); + } + + public void handleMapChunkBulk(S26PacketMapChunkBulk packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + + for (int i = 0; i < packetIn.getChunkCount(); ++i) + { + int j = packetIn.getChunkX(i); + int k = packetIn.getChunkZ(i); + this.clientWorldController.doPreChunk(j, k, true); + this.clientWorldController.invalidateBlockReceiveRegion(j << 4, 0, k << 4, (j << 4) + 15, 256, (k << 4) + 15); + Chunk chunk = this.clientWorldController.getChunkFromChunkCoords(j, k); + chunk.fillChunk(packetIn.getChunkBytes(i), packetIn.getChunkSize(i), true); + this.clientWorldController.markBlockRangeForRenderUpdate(j << 4, 0, k << 4, (j << 4) + 15, 256, (k << 4) + 15); + + if (!(this.clientWorldController.provider instanceof WorldProviderSurface)) + { + chunk.resetRelightChecks(); + } + } + } + + public void handleChangeGameState(S2BPacketChangeGameState packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + EntityPlayer entityplayer = this.gameController.thePlayer; + int i = packetIn.getGameState(); + float f = packetIn.func_149137_d(); + int j = MathHelper.floor_float(f + 0.5F); + + if (i >= 0 && i < S2BPacketChangeGameState.MESSAGE_NAMES.length && S2BPacketChangeGameState.MESSAGE_NAMES[i] != null) + { + entityplayer.addChatComponentMessage(new ChatComponentTranslation(S2BPacketChangeGameState.MESSAGE_NAMES[i], new Object[0])); + } + + if (i == 1) + { + this.clientWorldController.getWorldInfo().setRaining(true); + this.clientWorldController.setRainStrength(0.0F); + } + else if (i == 2) + { + this.clientWorldController.getWorldInfo().setRaining(false); + this.clientWorldController.setRainStrength(1.0F); + } + else if (i == 3) + { + this.gameController.playerController.setGameType(WorldSettings.GameType.getByID(j)); + } + else if (i == 4) + { + this.gameController.displayGuiScreen(new GuiWinGame()); + } + else if (i == 5) + { + GameSettings gamesettings = this.gameController.gameSettings; + + if (f == 0.0F) + { + this.gameController.displayGuiScreen(new GuiScreenDemo()); + } + else if (f == 101.0F) + { + this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.movement", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindForward.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindLeft.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindBack.getKeyCode()), GameSettings.getKeyDisplayString(gamesettings.keyBindRight.getKeyCode())})); + } + else if (f == 102.0F) + { + this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.jump", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindJump.getKeyCode())})); + } + else if (f == 103.0F) + { + this.gameController.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("demo.help.inventory", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindInventory.getKeyCode())})); + } + } + else if (i == 6) + { + this.clientWorldController.playSound(entityplayer.posX, entityplayer.posY + (double)entityplayer.getEyeHeight(), entityplayer.posZ, "random.successful_hit", 0.18F, 0.45F, false); + } + else if (i == 7) + { + this.clientWorldController.setRainStrength(f); + } + else if (i == 8) + { + this.clientWorldController.setThunderStrength(f); + } + else if (i == 10) + { + this.clientWorldController.spawnParticle(EnumParticleTypes.MOB_APPEARANCE, entityplayer.posX, entityplayer.posY, entityplayer.posZ, 0.0D, 0.0D, 0.0D, new int[0]); + this.clientWorldController.playSound(entityplayer.posX, entityplayer.posY, entityplayer.posZ, "mob.guardian.curse", 1.0F, 1.0F, false); + } + } + + /** + * Updates the worlds MapStorage with the specified MapData for the specified map-identifier and invokes a + * MapItemRenderer for it + */ + public void handleMaps(S34PacketMaps packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + MapData mapdata = ItemMap.loadMapData(packetIn.getMapId(), this.gameController.theWorld); + packetIn.setMapdataTo(mapdata); + this.gameController.entityRenderer.getMapItemRenderer().updateMapTexture(mapdata); + } + + public void handleEffect(S28PacketEffect packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + + if (packetIn.isSoundServerwide()) + { + this.gameController.theWorld.playBroadcastSound(packetIn.getSoundType(), packetIn.getSoundPos(), packetIn.getSoundData()); + } + else + { + this.gameController.theWorld.playAuxSFX(packetIn.getSoundType(), packetIn.getSoundPos(), packetIn.getSoundData()); + } + } + + /** + * Updates the players statistics or achievements + */ + public void handleStatistics(S37PacketStatistics packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + boolean flag = false; + + for (Entry entry : packetIn.func_148974_c().entrySet()) + { + StatBase statbase = (StatBase)entry.getKey(); + int i = ((Integer)entry.getValue()).intValue(); + + if (statbase.isAchievement() && i > 0) + { + if (this.field_147308_k && this.gameController.thePlayer.getStatFileWriter().readStat(statbase) == 0) + { + Achievement achievement = (Achievement)statbase; + this.gameController.guiAchievement.displayAchievement(achievement); + this.gameController.getTwitchStream().func_152911_a(new MetadataAchievement(achievement), 0L); + + if (statbase == AchievementList.openInventory) + { + this.gameController.gameSettings.showInventoryAchievementHint = false; + this.gameController.gameSettings.saveOptions(); + } + } + + flag = true; + } + + this.gameController.thePlayer.getStatFileWriter().unlockAchievement(this.gameController.thePlayer, statbase, i); + } + + if (!this.field_147308_k && !flag && this.gameController.gameSettings.showInventoryAchievementHint) + { + this.gameController.guiAchievement.displayUnformattedAchievement(AchievementList.openInventory); + } + + this.field_147308_k = true; + + if (this.gameController.currentScreen instanceof IProgressMeter) + { + ((IProgressMeter)this.gameController.currentScreen).doneLoading(); + } + } + + public void handleEntityEffect(S1DPacketEntityEffect packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); + + if (entity instanceof EntityLivingBase) + { + PotionEffect potioneffect = new PotionEffect(packetIn.getEffectId(), packetIn.getDuration(), packetIn.getAmplifier(), false, packetIn.func_179707_f()); + potioneffect.setPotionDurationMax(packetIn.func_149429_c()); + ((EntityLivingBase)entity).addPotionEffect(potioneffect); + } + } + + public void handleCombatEvent(S42PacketCombatEvent packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = this.clientWorldController.getEntityByID(packetIn.field_179775_c); + EntityLivingBase entitylivingbase = entity instanceof EntityLivingBase ? (EntityLivingBase)entity : null; + + if (packetIn.eventType == S42PacketCombatEvent.Event.END_COMBAT) + { + long i = (long)(1000 * packetIn.field_179772_d / 20); + MetadataCombat metadatacombat = new MetadataCombat(this.gameController.thePlayer, entitylivingbase); + this.gameController.getTwitchStream().func_176026_a(metadatacombat, 0L - i, 0L); + } + else if (packetIn.eventType == S42PacketCombatEvent.Event.ENTITY_DIED) + { + Entity entity1 = this.clientWorldController.getEntityByID(packetIn.field_179774_b); + + if (entity1 instanceof EntityPlayer) + { + MetadataPlayerDeath metadataplayerdeath = new MetadataPlayerDeath((EntityPlayer)entity1, entitylivingbase); + metadataplayerdeath.func_152807_a(packetIn.deathMessage); + this.gameController.getTwitchStream().func_152911_a(metadataplayerdeath, 0L); + } + } + } + + public void handleServerDifficulty(S41PacketServerDifficulty packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.theWorld.getWorldInfo().setDifficulty(packetIn.getDifficulty()); + this.gameController.theWorld.getWorldInfo().setDifficultyLocked(packetIn.isDifficultyLocked()); + } + + public void handleCamera(S43PacketCamera packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = packetIn.getEntity(this.clientWorldController); + + if (entity != null) + { + this.gameController.setRenderViewEntity(entity); + } + } + + public void handleWorldBorder(S44PacketWorldBorder packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + packetIn.func_179788_a(this.clientWorldController.getWorldBorder()); + } + + @SuppressWarnings("incomplete-switch") + public void handleTitle(S45PacketTitle packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + S45PacketTitle.Type s45packettitle$type = packetIn.getType(); + String s = null; + String s1 = null; + String s2 = packetIn.getMessage() != null ? packetIn.getMessage().getFormattedText() : ""; + + switch (s45packettitle$type) + { + case TITLE: + s = s2; + break; + + case SUBTITLE: + s1 = s2; + break; + + case RESET: + this.gameController.ingameGUI.displayTitle("", "", -1, -1, -1); + this.gameController.ingameGUI.func_175177_a(); + return; + } + + this.gameController.ingameGUI.displayTitle(s, s1, packetIn.getFadeInTime(), packetIn.getDisplayTime(), packetIn.getFadeOutTime()); + } + + public void handleSetCompressionLevel(S46PacketSetCompressionLevel packetIn) + { + if (!this.netManager.isLocalChannel()) + { + this.netManager.setCompressionTreshold(packetIn.func_179760_a()); + } + } + + public void handlePlayerListHeaderFooter(S47PacketPlayerListHeaderFooter packetIn) + { + this.gameController.ingameGUI.getTabList().setHeader(packetIn.getHeader().getFormattedText().length() == 0 ? null : packetIn.getHeader()); + this.gameController.ingameGUI.getTabList().setFooter(packetIn.getFooter().getFormattedText().length() == 0 ? null : packetIn.getFooter()); + } + + public void handleRemoveEntityEffect(S1EPacketRemoveEntityEffect packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); + + if (entity instanceof EntityLivingBase) + { + ((EntityLivingBase)entity).removePotionEffectClient(packetIn.getEffectId()); + } + } + + @SuppressWarnings("incomplete-switch") + public void handlePlayerListItem(S38PacketPlayerListItem packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + + for (S38PacketPlayerListItem.AddPlayerData s38packetplayerlistitem$addplayerdata : packetIn.func_179767_a()) + { + if (packetIn.func_179768_b() == S38PacketPlayerListItem.Action.REMOVE_PLAYER) + { + this.playerInfoMap.remove(s38packetplayerlistitem$addplayerdata.getProfile().getId()); + } + else + { + NetworkPlayerInfo networkplayerinfo = (NetworkPlayerInfo)this.playerInfoMap.get(s38packetplayerlistitem$addplayerdata.getProfile().getId()); + + if (packetIn.func_179768_b() == S38PacketPlayerListItem.Action.ADD_PLAYER) + { + networkplayerinfo = new NetworkPlayerInfo(s38packetplayerlistitem$addplayerdata); + this.playerInfoMap.put(networkplayerinfo.getGameProfile().getId(), networkplayerinfo); + } + + if (networkplayerinfo != null) + { + switch (packetIn.func_179768_b()) + { + case ADD_PLAYER: + networkplayerinfo.setGameType(s38packetplayerlistitem$addplayerdata.getGameMode()); + networkplayerinfo.setResponseTime(s38packetplayerlistitem$addplayerdata.getPing()); + break; + + case UPDATE_GAME_MODE: + networkplayerinfo.setGameType(s38packetplayerlistitem$addplayerdata.getGameMode()); + break; + + case UPDATE_LATENCY: + networkplayerinfo.setResponseTime(s38packetplayerlistitem$addplayerdata.getPing()); + break; + + case UPDATE_DISPLAY_NAME: + networkplayerinfo.setDisplayName(s38packetplayerlistitem$addplayerdata.getDisplayName()); + } + } + } + } + } + + public void handleKeepAlive(S00PacketKeepAlive packetIn) + { + this.addToSendQueue(new C00PacketKeepAlive(packetIn.func_149134_c())); + } + + public void handlePlayerAbilities(S39PacketPlayerAbilities packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + EntityPlayer entityplayer = this.gameController.thePlayer; + entityplayer.capabilities.isFlying = packetIn.isFlying(); + entityplayer.capabilities.isCreativeMode = packetIn.isCreativeMode(); + entityplayer.capabilities.disableDamage = packetIn.isInvulnerable(); + entityplayer.capabilities.allowFlying = packetIn.isAllowFlying(); + entityplayer.capabilities.setFlySpeed(packetIn.getFlySpeed()); + entityplayer.capabilities.setPlayerWalkSpeed(packetIn.getWalkSpeed()); + } + + /** + * Displays the available command-completion options the server knows of + */ + public void handleTabComplete(S3APacketTabComplete packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + String[] astring = packetIn.func_149630_c(); + + if (this.gameController.currentScreen instanceof GuiChat) + { + GuiChat guichat = (GuiChat)this.gameController.currentScreen; + guichat.onAutocompleteResponse(astring); + } + } + + public void handleSoundEffect(S29PacketSoundEffect packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + this.gameController.theWorld.playSound(packetIn.getX(), packetIn.getY(), packetIn.getZ(), packetIn.getSoundName(), packetIn.getVolume(), packetIn.getPitch(), false); + } + + public void handleResourcePack(S48PacketResourcePackSend packetIn) + { + final String s = packetIn.getURL(); + final String s1 = packetIn.getHash(); + + if (s.startsWith("level://")) + { + String s2 = s.substring("level://".length()); + File file1 = new File(this.gameController.mcDataDir, "saves"); + File file2 = new File(file1, s2); + + if (file2.isFile()) + { + this.netManager.sendPacket(new C19PacketResourcePackStatus(s1, C19PacketResourcePackStatus.Action.ACCEPTED)); + Futures.addCallback(this.gameController.getResourcePackRepository().setResourcePackInstance(file2), new FutureCallback() + { + public void onSuccess(Object p_onSuccess_1_) + { + NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(s1, C19PacketResourcePackStatus.Action.SUCCESSFULLY_LOADED)); + } + public void onFailure(Throwable p_onFailure_1_) + { + NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(s1, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD)); + } + }); + } + else + { + this.netManager.sendPacket(new C19PacketResourcePackStatus(s1, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD)); + } + } + else + { + if (this.gameController.getCurrentServerData() != null && this.gameController.getCurrentServerData().getResourceMode() == ServerData.ServerResourceMode.ENABLED) + { + this.netManager.sendPacket(new C19PacketResourcePackStatus(s1, C19PacketResourcePackStatus.Action.ACCEPTED)); + Futures.addCallback(this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), new FutureCallback() + { + public void onSuccess(Object p_onSuccess_1_) + { + NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(s1, C19PacketResourcePackStatus.Action.SUCCESSFULLY_LOADED)); + } + public void onFailure(Throwable p_onFailure_1_) + { + NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(s1, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD)); + } + }); + } + else if (this.gameController.getCurrentServerData() != null && this.gameController.getCurrentServerData().getResourceMode() != ServerData.ServerResourceMode.PROMPT) + { + this.netManager.sendPacket(new C19PacketResourcePackStatus(s1, C19PacketResourcePackStatus.Action.DECLINED)); + } + else + { + this.gameController.addScheduledTask(new Runnable() + { + public void run() + { + NetHandlerPlayClient.this.gameController.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback() + { + public void confirmClicked(boolean result, int id) + { + NetHandlerPlayClient.this.gameController = Minecraft.getMinecraft(); + + if (result) + { + if (NetHandlerPlayClient.this.gameController.getCurrentServerData() != null) + { + NetHandlerPlayClient.this.gameController.getCurrentServerData().setResourceMode(ServerData.ServerResourceMode.ENABLED); + } + + NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(s1, C19PacketResourcePackStatus.Action.ACCEPTED)); + Futures.addCallback(NetHandlerPlayClient.this.gameController.getResourcePackRepository().downloadResourcePack(s, s1), new FutureCallback() + { + public void onSuccess(Object p_onSuccess_1_) + { + NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(s1, C19PacketResourcePackStatus.Action.SUCCESSFULLY_LOADED)); + } + public void onFailure(Throwable p_onFailure_1_) + { + NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(s1, C19PacketResourcePackStatus.Action.FAILED_DOWNLOAD)); + } + }); + } + else + { + if (NetHandlerPlayClient.this.gameController.getCurrentServerData() != null) + { + NetHandlerPlayClient.this.gameController.getCurrentServerData().setResourceMode(ServerData.ServerResourceMode.DISABLED); + } + + NetHandlerPlayClient.this.netManager.sendPacket(new C19PacketResourcePackStatus(s1, C19PacketResourcePackStatus.Action.DECLINED)); + } + + ServerList.func_147414_b(NetHandlerPlayClient.this.gameController.getCurrentServerData()); + NetHandlerPlayClient.this.gameController.displayGuiScreen((GuiScreen)null); + } + }, I18n.format("multiplayer.texturePrompt.line1", new Object[0]), I18n.format("multiplayer.texturePrompt.line2", new Object[0]), 0)); + } + }); + } + } + } + + public void handleEntityNBT(S49PacketUpdateEntityNBT packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = packetIn.getEntity(this.clientWorldController); + + if (entity != null) + { + entity.clientUpdateEntityNBT(packetIn.getTagCompound()); + } + } + + /** + * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to + * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the + * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server + * resourcepack for the client to load. + */ + public void handleCustomPayload(S3FPacketCustomPayload packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + + if ("MC|TrList".equals(packetIn.getChannelName())) + { + PacketBuffer packetbuffer = packetIn.getBufferData(); + + try + { + int i = packetbuffer.readInt(); + GuiScreen guiscreen = this.gameController.currentScreen; + + if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId) + { + IMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant(); + MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer); + imerchant.setRecipes(merchantrecipelist); + } + } + catch (IOException ioexception) + { + logger.error((String)"Couldn\'t load trade info", (Throwable)ioexception); + } + finally + { + packetbuffer.release(); + } + } + else if ("MC|Brand".equals(packetIn.getChannelName())) + { + this.gameController.thePlayer.setClientBrand(packetIn.getBufferData().readStringFromBuffer(32767)); + } + else if ("MC|BOpen".equals(packetIn.getChannelName())) + { + ItemStack itemstack = this.gameController.thePlayer.getCurrentEquippedItem(); + + if (itemstack != null && itemstack.getItem() == Items.written_book) + { + this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, itemstack, false)); + } + } + } + + /** + * May create a scoreboard objective, remove an objective from the scoreboard or update an objectives' displayname + */ + public void handleScoreboardObjective(S3BPacketScoreboardObjective packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Scoreboard scoreboard = this.clientWorldController.getScoreboard(); + + if (packetIn.func_149338_e() == 0) + { + ScoreObjective scoreobjective = scoreboard.addScoreObjective(packetIn.func_149339_c(), IScoreObjectiveCriteria.DUMMY); + scoreobjective.setDisplayName(packetIn.func_149337_d()); + scoreobjective.setRenderType(packetIn.func_179817_d()); + } + else + { + ScoreObjective scoreobjective1 = scoreboard.getObjective(packetIn.func_149339_c()); + + if (packetIn.func_149338_e() == 1) + { + scoreboard.removeObjective(scoreobjective1); + } + else if (packetIn.func_149338_e() == 2) + { + scoreobjective1.setDisplayName(packetIn.func_149337_d()); + scoreobjective1.setRenderType(packetIn.func_179817_d()); + } + } + } + + /** + * Either updates the score with a specified value or removes the score for an objective + */ + public void handleUpdateScore(S3CPacketUpdateScore packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Scoreboard scoreboard = this.clientWorldController.getScoreboard(); + ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.getObjectiveName()); + + if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.CHANGE) + { + Score score = scoreboard.getValueFromObjective(packetIn.getPlayerName(), scoreobjective); + score.setScorePoints(packetIn.getScoreValue()); + } + else if (packetIn.getScoreAction() == S3CPacketUpdateScore.Action.REMOVE) + { + if (StringUtils.isNullOrEmpty(packetIn.getObjectiveName())) + { + scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), (ScoreObjective)null); + } + else if (scoreobjective != null) + { + scoreboard.removeObjectiveFromEntity(packetIn.getPlayerName(), scoreobjective); + } + } + } + + /** + * Removes or sets the ScoreObjective to be displayed at a particular scoreboard position (list, sidebar, below + * name) + */ + public void handleDisplayScoreboard(S3DPacketDisplayScoreboard packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Scoreboard scoreboard = this.clientWorldController.getScoreboard(); + + if (packetIn.func_149370_d().length() == 0) + { + scoreboard.setObjectiveInDisplaySlot(packetIn.func_149371_c(), (ScoreObjective)null); + } + else + { + ScoreObjective scoreobjective = scoreboard.getObjective(packetIn.func_149370_d()); + scoreboard.setObjectiveInDisplaySlot(packetIn.func_149371_c(), scoreobjective); + } + } + + /** + * Updates a team managed by the scoreboard: Create/Remove the team registration, Register/Remove the player-team- + * memberships, Set team displayname/prefix/suffix and/or whether friendly fire is enabled + */ + public void handleTeams(S3EPacketTeams packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Scoreboard scoreboard = this.clientWorldController.getScoreboard(); + ScorePlayerTeam scoreplayerteam; + + if (packetIn.func_149307_h() == 0) + { + scoreplayerteam = scoreboard.createTeam(packetIn.func_149312_c()); + } + else + { + scoreplayerteam = scoreboard.getTeam(packetIn.func_149312_c()); + } + + if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 2) + { + scoreplayerteam.setTeamName(packetIn.func_149306_d()); + scoreplayerteam.setNamePrefix(packetIn.func_149311_e()); + scoreplayerteam.setNameSuffix(packetIn.func_149309_f()); + scoreplayerteam.setChatFormat(EnumChatFormatting.func_175744_a(packetIn.func_179813_h())); + scoreplayerteam.func_98298_a(packetIn.func_149308_i()); + Team.EnumVisible team$enumvisible = Team.EnumVisible.func_178824_a(packetIn.func_179814_i()); + + if (team$enumvisible != null) + { + scoreplayerteam.setNameTagVisibility(team$enumvisible); + } + } + + if (packetIn.func_149307_h() == 0 || packetIn.func_149307_h() == 3) + { + for (String s : packetIn.func_149310_g()) + { + scoreboard.addPlayerToTeam(s, packetIn.func_149312_c()); + } + } + + if (packetIn.func_149307_h() == 4) + { + for (String s1 : packetIn.func_149310_g()) + { + scoreboard.removePlayerFromTeam(s1, scoreplayerteam); + } + } + + if (packetIn.func_149307_h() == 1) + { + scoreboard.removeTeam(scoreplayerteam); + } + } + + /** + * Spawns a specified number of particles at the specified location with a randomized displacement according to + * specified bounds + */ + public void handleParticles(S2APacketParticles packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + + if (packetIn.getParticleCount() == 0) + { + double d0 = (double)(packetIn.getParticleSpeed() * packetIn.getXOffset()); + double d2 = (double)(packetIn.getParticleSpeed() * packetIn.getYOffset()); + double d4 = (double)(packetIn.getParticleSpeed() * packetIn.getZOffset()); + + try + { + this.clientWorldController.spawnParticle(packetIn.getParticleType(), packetIn.isLongDistance(), packetIn.getXCoordinate(), packetIn.getYCoordinate(), packetIn.getZCoordinate(), d0, d2, d4, packetIn.getParticleArgs()); + } + catch (Throwable var17) + { + logger.warn("Could not spawn particle effect " + packetIn.getParticleType()); + } + } + else + { + for (int i = 0; i < packetIn.getParticleCount(); ++i) + { + double d1 = this.avRandomizer.nextGaussian() * (double)packetIn.getXOffset(); + double d3 = this.avRandomizer.nextGaussian() * (double)packetIn.getYOffset(); + double d5 = this.avRandomizer.nextGaussian() * (double)packetIn.getZOffset(); + double d6 = this.avRandomizer.nextGaussian() * (double)packetIn.getParticleSpeed(); + double d7 = this.avRandomizer.nextGaussian() * (double)packetIn.getParticleSpeed(); + double d8 = this.avRandomizer.nextGaussian() * (double)packetIn.getParticleSpeed(); + + try + { + this.clientWorldController.spawnParticle(packetIn.getParticleType(), packetIn.isLongDistance(), packetIn.getXCoordinate() + d1, packetIn.getYCoordinate() + d3, packetIn.getZCoordinate() + d5, d6, d7, d8, packetIn.getParticleArgs()); + } + catch (Throwable var16) + { + logger.warn("Could not spawn particle effect " + packetIn.getParticleType()); + return; + } + } + } + } + + /** + * Updates en entity's attributes and their respective modifiers, which are used for speed bonusses (player + * sprinting, animals fleeing, baby speed), weapon/tool attackDamage, hostiles followRange randomization, zombie + * maxHealth and knockback resistance as well as reinforcement spawning chance. + */ + public void handleEntityProperties(S20PacketEntityProperties packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); + Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); + + if (entity != null) + { + if (!(entity instanceof EntityLivingBase)) + { + throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + entity + ")"); + } + else + { + BaseAttributeMap baseattributemap = ((EntityLivingBase)entity).getAttributeMap(); + + for (S20PacketEntityProperties.Snapshot s20packetentityproperties$snapshot : packetIn.func_149441_d()) + { + IAttributeInstance iattributeinstance = baseattributemap.getAttributeInstanceByName(s20packetentityproperties$snapshot.func_151409_a()); + + if (iattributeinstance == null) + { + iattributeinstance = baseattributemap.registerAttribute(new RangedAttribute((IAttribute)null, s20packetentityproperties$snapshot.func_151409_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE)); + } + + iattributeinstance.setBaseValue(s20packetentityproperties$snapshot.func_151410_b()); + iattributeinstance.removeAllModifiers(); + + for (AttributeModifier attributemodifier : s20packetentityproperties$snapshot.func_151408_c()) + { + iattributeinstance.applyModifier(attributemodifier); + } + } + } + } + } + + /** + * Returns this the NetworkManager instance registered with this NetworkHandlerPlayClient + */ + public NetworkManager getNetworkManager() + { + return this.netManager; + } + + public Collection getPlayerInfoMap() + { + return this.playerInfoMap.values(); + } + + public NetworkPlayerInfo getPlayerInfo(UUID p_175102_1_) + { + return (NetworkPlayerInfo)this.playerInfoMap.get(p_175102_1_); + } + + /** + * Gets the client's description information about another player on the server. + */ + public NetworkPlayerInfo getPlayerInfo(String p_175104_1_) + { + for (NetworkPlayerInfo networkplayerinfo : this.playerInfoMap.values()) + { + if (networkplayerinfo.getGameProfile().getName().equals(p_175104_1_)) + { + return networkplayerinfo; + } + } + + return null; + } + + public GameProfile getGameProfile() + { + return this.profile; + } +} diff --git a/src/minecraft/net/minecraft/client/network/NetworkPlayerInfo.java b/src/minecraft/net/minecraft/client/network/NetworkPlayerInfo.java new file mode 100644 index 0000000..047a7b8 --- /dev/null +++ b/src/minecraft/net/minecraft/client/network/NetworkPlayerInfo.java @@ -0,0 +1,209 @@ +package net.minecraft.client.network; + +import com.google.common.base.Objects; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.DefaultPlayerSkin; +import net.minecraft.client.resources.SkinManager; +import net.minecraft.network.play.server.S38PacketPlayerListItem; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.WorldSettings; + +public class NetworkPlayerInfo +{ + /** + * The GameProfile for the player represented by this NetworkPlayerInfo instance + */ + private final GameProfile gameProfile; + private WorldSettings.GameType gameType; + + /** Player response time to server in milliseconds */ + private int responseTime; + private boolean playerTexturesLoaded = false; + private ResourceLocation locationSkin; + private ResourceLocation locationCape; + private String skinType; + + /** + * When this is non-null, it is displayed instead of the player's real name + */ + private IChatComponent displayName; + private int field_178873_i = 0; + private int field_178870_j = 0; + private long field_178871_k = 0L; + private long field_178868_l = 0L; + private long field_178869_m = 0L; + + public NetworkPlayerInfo(GameProfile p_i46294_1_) + { + this.gameProfile = p_i46294_1_; + } + + public NetworkPlayerInfo(S38PacketPlayerListItem.AddPlayerData p_i46295_1_) + { + this.gameProfile = p_i46295_1_.getProfile(); + this.gameType = p_i46295_1_.getGameMode(); + this.responseTime = p_i46295_1_.getPing(); + this.displayName = p_i46295_1_.getDisplayName(); + } + + /** + * Returns the GameProfile for the player represented by this NetworkPlayerInfo instance + */ + public GameProfile getGameProfile() + { + return this.gameProfile; + } + + public WorldSettings.GameType getGameType() + { + return this.gameType; + } + + public int getResponseTime() + { + return this.responseTime; + } + + protected void setGameType(WorldSettings.GameType p_178839_1_) + { + this.gameType = p_178839_1_; + } + + protected void setResponseTime(int p_178838_1_) + { + this.responseTime = p_178838_1_; + } + + public boolean hasLocationSkin() + { + return this.locationSkin != null; + } + + public String getSkinType() + { + return this.skinType == null ? DefaultPlayerSkin.getSkinType(this.gameProfile.getId()) : this.skinType; + } + + public ResourceLocation getLocationSkin() + { + if (this.locationSkin == null) + { + this.loadPlayerTextures(); + } + + return (ResourceLocation)Objects.firstNonNull(this.locationSkin, DefaultPlayerSkin.getDefaultSkin(this.gameProfile.getId())); + } + + public ResourceLocation getLocationCape() + { + if (this.locationCape == null) + { + this.loadPlayerTextures(); + } + + return this.locationCape; + } + + public ScorePlayerTeam getPlayerTeam() + { + return Minecraft.getMinecraft().theWorld.getScoreboard().getPlayersTeam(this.getGameProfile().getName()); + } + + protected void loadPlayerTextures() + { + synchronized (this) + { + if (!this.playerTexturesLoaded) + { + this.playerTexturesLoaded = true; + Minecraft.getMinecraft().getSkinManager().loadProfileTextures(this.gameProfile, new SkinManager.SkinAvailableCallback() + { + public void skinAvailable(Type p_180521_1_, ResourceLocation location, MinecraftProfileTexture profileTexture) + { + switch (p_180521_1_) + { + case SKIN: + NetworkPlayerInfo.this.locationSkin = location; + NetworkPlayerInfo.this.skinType = profileTexture.getMetadata("model"); + + if (NetworkPlayerInfo.this.skinType == null) + { + NetworkPlayerInfo.this.skinType = "default"; + } + + break; + + case CAPE: + NetworkPlayerInfo.this.locationCape = location; + } + } + }, true); + } + } + } + + public void setDisplayName(IChatComponent displayNameIn) + { + this.displayName = displayNameIn; + } + + public IChatComponent getDisplayName() + { + return this.displayName; + } + + public int func_178835_l() + { + return this.field_178873_i; + } + + public void func_178836_b(int p_178836_1_) + { + this.field_178873_i = p_178836_1_; + } + + public int func_178860_m() + { + return this.field_178870_j; + } + + public void func_178857_c(int p_178857_1_) + { + this.field_178870_j = p_178857_1_; + } + + public long func_178847_n() + { + return this.field_178871_k; + } + + public void func_178846_a(long p_178846_1_) + { + this.field_178871_k = p_178846_1_; + } + + public long func_178858_o() + { + return this.field_178868_l; + } + + public void func_178844_b(long p_178844_1_) + { + this.field_178868_l = p_178844_1_; + } + + public long func_178855_p() + { + return this.field_178869_m; + } + + public void func_178843_c(long p_178843_1_) + { + this.field_178869_m = p_178843_1_; + } +} diff --git a/src/minecraft/net/minecraft/client/network/OldServerPinger.java b/src/minecraft/net/minecraft/client/network/OldServerPinger.java new file mode 100644 index 0000000..cedd493 --- /dev/null +++ b/src/minecraft/net/minecraft/client/network/OldServerPinger.java @@ -0,0 +1,315 @@ +package net.minecraft.client.network; + +import com.google.common.base.Charsets; +import com.google.common.base.Splitter; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.mojang.authlib.GameProfile; +import io.netty.bootstrap.Bootstrap; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.Channel; +import io.netty.channel.ChannelException; +import io.netty.channel.ChannelFutureListener; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.channel.socket.nio.NioSocketChannel; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ServerAddress; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.network.EnumConnectionState; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.ServerStatusResponse; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.network.status.INetHandlerStatusClient; +import net.minecraft.network.status.client.C00PacketServerQuery; +import net.minecraft.network.status.client.C01PacketPing; +import net.minecraft.network.status.server.S00PacketServerInfo; +import net.minecraft.network.status.server.S01PacketPong; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class OldServerPinger +{ + private static final Splitter PING_RESPONSE_SPLITTER = Splitter.on('\u0000').limit(6); + private static final Logger logger = LogManager.getLogger(); + private final List pingDestinations = Collections.synchronizedList(Lists.newArrayList()); + + public void ping(final ServerData server) throws UnknownHostException + { + ServerAddress serveraddress = ServerAddress.func_78860_a(server.serverIP); + final NetworkManager networkmanager = NetworkManager.func_181124_a(InetAddress.getByName(serveraddress.getIP()), serveraddress.getPort(), false); + this.pingDestinations.add(networkmanager); + server.serverMOTD = "Pinging..."; + server.pingToServer = -1L; + server.playerList = null; + networkmanager.setNetHandler(new INetHandlerStatusClient() + { + private boolean field_147403_d = false; + private boolean field_183009_e = false; + private long field_175092_e = 0L; + public void handleServerInfo(S00PacketServerInfo packetIn) + { + if (this.field_183009_e) + { + networkmanager.closeChannel(new ChatComponentText("Received unrequested status")); + } + else + { + this.field_183009_e = true; + ServerStatusResponse serverstatusresponse = packetIn.getResponse(); + + if (serverstatusresponse.getServerDescription() != null) + { + server.serverMOTD = serverstatusresponse.getServerDescription().getFormattedText(); + } + else + { + server.serverMOTD = ""; + } + + if (serverstatusresponse.getProtocolVersionInfo() != null) + { + server.gameVersion = serverstatusresponse.getProtocolVersionInfo().getName(); + server.version = serverstatusresponse.getProtocolVersionInfo().getProtocol(); + } + else + { + server.gameVersion = "Old"; + server.version = 0; + } + + if (serverstatusresponse.getPlayerCountData() != null) + { + server.populationInfo = EnumChatFormatting.GRAY + "" + serverstatusresponse.getPlayerCountData().getOnlinePlayerCount() + "" + EnumChatFormatting.DARK_GRAY + "/" + EnumChatFormatting.GRAY + serverstatusresponse.getPlayerCountData().getMaxPlayers(); + + if (ArrayUtils.isNotEmpty(serverstatusresponse.getPlayerCountData().getPlayers())) + { + StringBuilder stringbuilder = new StringBuilder(); + + for (GameProfile gameprofile : serverstatusresponse.getPlayerCountData().getPlayers()) + { + if (stringbuilder.length() > 0) + { + stringbuilder.append("\n"); + } + + stringbuilder.append(gameprofile.getName()); + } + + if (serverstatusresponse.getPlayerCountData().getPlayers().length < serverstatusresponse.getPlayerCountData().getOnlinePlayerCount()) + { + if (stringbuilder.length() > 0) + { + stringbuilder.append("\n"); + } + + stringbuilder.append("... and ").append(serverstatusresponse.getPlayerCountData().getOnlinePlayerCount() - serverstatusresponse.getPlayerCountData().getPlayers().length).append(" more ..."); + } + + server.playerList = stringbuilder.toString(); + } + } + else + { + server.populationInfo = EnumChatFormatting.DARK_GRAY + "???"; + } + + if (serverstatusresponse.getFavicon() != null) + { + String s = serverstatusresponse.getFavicon(); + + if (s.startsWith("data:image/png;base64,")) + { + server.setBase64EncodedIconData(s.substring("data:image/png;base64,".length())); + } + else + { + OldServerPinger.logger.error("Invalid server icon (unknown format)"); + } + } + else + { + server.setBase64EncodedIconData((String)null); + } + + this.field_175092_e = Minecraft.getSystemTime(); + networkmanager.sendPacket(new C01PacketPing(this.field_175092_e)); + this.field_147403_d = true; + } + } + public void handlePong(S01PacketPong packetIn) + { + long i = this.field_175092_e; + long j = Minecraft.getSystemTime(); + server.pingToServer = j - i; + networkmanager.closeChannel(new ChatComponentText("Finished")); + } + public void onDisconnect(IChatComponent reason) + { + if (!this.field_147403_d) + { + OldServerPinger.logger.error("Can\'t ping " + server.serverIP + ": " + reason.getUnformattedText()); + server.serverMOTD = EnumChatFormatting.DARK_RED + "Can\'t connect to server."; + server.populationInfo = ""; + OldServerPinger.this.tryCompatibilityPing(server); + } + } + }); + + try + { + networkmanager.sendPacket(new C00Handshake(47, serveraddress.getIP(), serveraddress.getPort(), EnumConnectionState.STATUS)); + networkmanager.sendPacket(new C00PacketServerQuery()); + } + catch (Throwable throwable) + { + logger.error((Object)throwable); + } + } + + private void tryCompatibilityPing(final ServerData server) + { + final ServerAddress serveraddress = ServerAddress.func_78860_a(server.serverIP); + ((Bootstrap)((Bootstrap)((Bootstrap)(new Bootstrap()).group((EventLoopGroup)NetworkManager.CLIENT_NIO_EVENTLOOP.getValue())).handler(new ChannelInitializer() + { + protected void initChannel(Channel p_initChannel_1_) throws Exception + { + try + { + p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true)); + } + catch (ChannelException var3) + { + ; + } + + p_initChannel_1_.pipeline().addLast(new ChannelHandler[] {new SimpleChannelInboundHandler() + { + public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception + { + super.channelActive(p_channelActive_1_); + ByteBuf bytebuf = Unpooled.buffer(); + + try + { + bytebuf.writeByte(254); + bytebuf.writeByte(1); + bytebuf.writeByte(250); + char[] achar = "MC|PingHost".toCharArray(); + bytebuf.writeShort(achar.length); + + for (char c0 : achar) + { + bytebuf.writeChar(c0); + } + + bytebuf.writeShort(7 + 2 * serveraddress.getIP().length()); + bytebuf.writeByte(127); + achar = serveraddress.getIP().toCharArray(); + bytebuf.writeShort(achar.length); + + for (char c1 : achar) + { + bytebuf.writeChar(c1); + } + + bytebuf.writeInt(serveraddress.getPort()); + p_channelActive_1_.channel().writeAndFlush(bytebuf).addListener(ChannelFutureListener.CLOSE_ON_FAILURE); + } + finally + { + bytebuf.release(); + } + } + protected void channelRead0(ChannelHandlerContext p_channelRead0_1_, ByteBuf p_channelRead0_2_) throws Exception + { + short short1 = p_channelRead0_2_.readUnsignedByte(); + + if (short1 == 255) + { + String s = new String(p_channelRead0_2_.readBytes(p_channelRead0_2_.readShort() * 2).array(), Charsets.UTF_16BE); + String[] astring = (String[])Iterables.toArray(OldServerPinger.PING_RESPONSE_SPLITTER.split(s), String.class); + + if ("\u00a71".equals(astring[0])) + { + int i = MathHelper.parseIntWithDefault(astring[1], 0); + String s1 = astring[2]; + String s2 = astring[3]; + int j = MathHelper.parseIntWithDefault(astring[4], -1); + int k = MathHelper.parseIntWithDefault(astring[5], -1); + server.version = -1; + server.gameVersion = s1; + server.serverMOTD = s2; + server.populationInfo = EnumChatFormatting.GRAY + "" + j + "" + EnumChatFormatting.DARK_GRAY + "/" + EnumChatFormatting.GRAY + k; + } + } + + p_channelRead0_1_.close(); + } + public void exceptionCaught(ChannelHandlerContext p_exceptionCaught_1_, Throwable p_exceptionCaught_2_) throws Exception + { + p_exceptionCaught_1_.close(); + } + } + }); + } + })).channel(NioSocketChannel.class)).connect(serveraddress.getIP(), serveraddress.getPort()); + } + + public void pingPendingNetworks() + { + synchronized (this.pingDestinations) + { + Iterator iterator = this.pingDestinations.iterator(); + + while (iterator.hasNext()) + { + NetworkManager networkmanager = (NetworkManager)iterator.next(); + + if (networkmanager.isChannelOpen()) + { + networkmanager.processReceivedPackets(); + } + else + { + iterator.remove(); + networkmanager.checkDisconnected(); + } + } + } + } + + public void clearPendingNetworks() + { + synchronized (this.pingDestinations) + { + Iterator iterator = this.pingDestinations.iterator(); + + while (iterator.hasNext()) + { + NetworkManager networkmanager = (NetworkManager)iterator.next(); + + if (networkmanager.isChannelOpen()) + { + iterator.remove(); + networkmanager.closeChannel(new ChatComponentText("Cancelled")); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/Barrier.java b/src/minecraft/net/minecraft/client/particle/Barrier.java new file mode 100644 index 0000000..008ef9c --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/Barrier.java @@ -0,0 +1,56 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.world.World; + +public class Barrier extends EntityFX +{ + protected Barrier(World worldIn, double p_i46286_2_, double p_i46286_4_, double p_i46286_6_, Item p_i46286_8_) + { + super(worldIn, p_i46286_2_, p_i46286_4_, p_i46286_6_, 0.0D, 0.0D, 0.0D); + this.setParticleIcon(Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(p_i46286_8_)); + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.motionX = this.motionY = this.motionZ = 0.0D; + this.particleGravity = 0.0F; + this.particleMaxAge = 80; + } + + public int getFXLayer() + { + return 1; + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = this.particleIcon.getMinU(); + float f1 = this.particleIcon.getMaxU(); + float f2 = this.particleIcon.getMinV(); + float f3 = this.particleIcon.getMaxV(); + float f4 = 0.5F; + float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); + float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); + float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); + int i = this.getBrightnessForRender(partialTicks); + int j = i >> 16 & 65535; + int k = i & 65535; + worldRendererIn.pos((double)(f5 - p_180434_4_ * 0.5F - p_180434_7_ * 0.5F), (double)(f6 - p_180434_5_ * 0.5F), (double)(f7 - p_180434_6_ * 0.5F - p_180434_8_ * 0.5F)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 - p_180434_4_ * 0.5F + p_180434_7_ * 0.5F), (double)(f6 + p_180434_5_ * 0.5F), (double)(f7 - p_180434_6_ * 0.5F + p_180434_8_ * 0.5F)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 + p_180434_4_ * 0.5F + p_180434_7_ * 0.5F), (double)(f6 + p_180434_5_ * 0.5F), (double)(f7 + p_180434_6_ * 0.5F + p_180434_8_ * 0.5F)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 + p_180434_4_ * 0.5F - p_180434_7_ * 0.5F), (double)(f6 - p_180434_5_ * 0.5F), (double)(f7 + p_180434_6_ * 0.5F - p_180434_8_ * 0.5F)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new Barrier(worldIn, xCoordIn, yCoordIn, zCoordIn, Item.getItemFromBlock(Blocks.barrier)); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EffectRendere# b/src/minecraft/net/minecraft/client/particle/EffectRendere# new file mode 100644 index 0000000..e85ef60 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EffectRendere# @@ -0,0 +1,37 @@ +*************** +*** 231,238 **** + GlStateManager.func_179112_b(770, 771); + GlStateManager.func_179092_a(516, 0.003921569F); + +- for(final int i = 0; i < 3; ++i) { + for(int j = 0; j < 2; ++j) { + if(!this.field_78876_b[i][j].isEmpty()) { + switch(j) { + case 0: +--- 231,239 ---- + GlStateManager.func_179112_b(770, 771); + GlStateManager.func_179092_a(516, 0.003921569F); + ++ for(int i = 0; i < 3; ++i) { + for(int j = 0; j < 2; ++j) { ++ final int i_f = i; + if(!this.field_78876_b[i][j].isEmpty()) { + switch(j) { + case 0: +*************** +*** 271,277 **** + }); + crashreportcategory.func_71500_a("Particle Type", new Callable() { + public String call() throws Exception { +- return i == 0?"MISC_TEXTURE":(i == 1?"TERRAIN_TEXTURE":(i == 3?"ENTITY_PARTICLE_TEXTURE":"Unknown - " + i)); + } + }); + throw new ReportedException(crashreport); +--- 272,278 ---- + }); + crashreportcategory.func_71500_a("Particle Type", new Callable() { + public String call() throws Exception { ++ return i_f == 0?"MISC_TEXTURE":(i_f == 1?"TERRAIN_TEXTURE":(i_f == 3?"ENTITY_PARTICLE_TEXTURE":"Unknown - " + i_f)); + } + }); + throw new ReportedException(crashreport); diff --git a/src/minecraft/net/minecraft/client/particle/EffectRenderer.java b/src/minecraft/net/minecraft/client/particle/EffectRenderer.java new file mode 100644 index 0000000..247207e --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EffectRenderer.java @@ -0,0 +1,529 @@ +package net.minecraft.client.particle; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import optifine.Config; +import optifine.Reflector; + +public class EffectRenderer +{ + private static final ResourceLocation particleTextures = new ResourceLocation("textures/particle/particles.png"); + + /** Reference to the World object. */ + protected World worldObj; + private List[][] fxLayers = new List[4][]; + private List particleEmitters = Lists.newArrayList(); + private TextureManager renderer; + + /** RNG. */ + private Random rand = new Random(); + private Map particleTypes = Maps.newHashMap(); + private static final String __OBFID = "CL_00000915"; + + public EffectRenderer(World worldIn, TextureManager rendererIn) + { + this.worldObj = worldIn; + this.renderer = rendererIn; + + for (int i = 0; i < 4; ++i) + { + this.fxLayers[i] = new List[2]; + + for (int j = 0; j < 2; ++j) + { + this.fxLayers[i][j] = Lists.newArrayList(); + } + } + + this.registerVanillaParticles(); + } + + private void registerVanillaParticles() + { + this.registerParticle(EnumParticleTypes.EXPLOSION_NORMAL.getParticleID(), new EntityExplodeFX.Factory()); + this.registerParticle(EnumParticleTypes.WATER_BUBBLE.getParticleID(), new EntityBubbleFX.Factory()); + this.registerParticle(EnumParticleTypes.WATER_SPLASH.getParticleID(), new EntitySplashFX.Factory()); + this.registerParticle(EnumParticleTypes.WATER_WAKE.getParticleID(), new EntityFishWakeFX.Factory()); + this.registerParticle(EnumParticleTypes.WATER_DROP.getParticleID(), new EntityRainFX.Factory()); + this.registerParticle(EnumParticleTypes.SUSPENDED.getParticleID(), new EntitySuspendFX.Factory()); + this.registerParticle(EnumParticleTypes.SUSPENDED_DEPTH.getParticleID(), new EntityAuraFX.Factory()); + this.registerParticle(EnumParticleTypes.CRIT.getParticleID(), new EntityCrit2FX.Factory()); + this.registerParticle(EnumParticleTypes.CRIT_MAGIC.getParticleID(), new EntityCrit2FX.MagicFactory()); + this.registerParticle(EnumParticleTypes.SMOKE_NORMAL.getParticleID(), new EntitySmokeFX.Factory()); + this.registerParticle(EnumParticleTypes.SMOKE_LARGE.getParticleID(), new EntityCritFX.Factory()); + this.registerParticle(EnumParticleTypes.SPELL.getParticleID(), new EntitySpellParticleFX.Factory()); + this.registerParticle(EnumParticleTypes.SPELL_INSTANT.getParticleID(), new EntitySpellParticleFX.InstantFactory()); + this.registerParticle(EnumParticleTypes.SPELL_MOB.getParticleID(), new EntitySpellParticleFX.MobFactory()); + this.registerParticle(EnumParticleTypes.SPELL_MOB_AMBIENT.getParticleID(), new EntitySpellParticleFX.AmbientMobFactory()); + this.registerParticle(EnumParticleTypes.SPELL_WITCH.getParticleID(), new EntitySpellParticleFX.WitchFactory()); + this.registerParticle(EnumParticleTypes.DRIP_WATER.getParticleID(), new EntityDropParticleFX.WaterFactory()); + this.registerParticle(EnumParticleTypes.DRIP_LAVA.getParticleID(), new EntityDropParticleFX.LavaFactory()); + this.registerParticle(EnumParticleTypes.VILLAGER_ANGRY.getParticleID(), new EntityHeartFX.AngryVillagerFactory()); + this.registerParticle(EnumParticleTypes.VILLAGER_HAPPY.getParticleID(), new EntityAuraFX.HappyVillagerFactory()); + this.registerParticle(EnumParticleTypes.TOWN_AURA.getParticleID(), new EntityAuraFX.Factory()); + this.registerParticle(EnumParticleTypes.NOTE.getParticleID(), new EntityNoteFX.Factory()); + this.registerParticle(EnumParticleTypes.PORTAL.getParticleID(), new EntityPortalFX.Factory()); + this.registerParticle(EnumParticleTypes.ENCHANTMENT_TABLE.getParticleID(), new EntityEnchantmentTableParticleFX.EnchantmentTable()); + this.registerParticle(EnumParticleTypes.FLAME.getParticleID(), new EntityFlameFX.Factory()); + this.registerParticle(EnumParticleTypes.LAVA.getParticleID(), new EntityLavaFX.Factory()); + this.registerParticle(EnumParticleTypes.FOOTSTEP.getParticleID(), new EntityFootStepFX.Factory()); + this.registerParticle(EnumParticleTypes.CLOUD.getParticleID(), new EntityCloudFX.Factory()); + this.registerParticle(EnumParticleTypes.REDSTONE.getParticleID(), new EntityReddustFX.Factory()); + this.registerParticle(EnumParticleTypes.SNOWBALL.getParticleID(), new EntityBreakingFX.SnowballFactory()); + this.registerParticle(EnumParticleTypes.SNOW_SHOVEL.getParticleID(), new EntitySnowShovelFX.Factory()); + this.registerParticle(EnumParticleTypes.SLIME.getParticleID(), new EntityBreakingFX.SlimeFactory()); + this.registerParticle(EnumParticleTypes.HEART.getParticleID(), new EntityHeartFX.Factory()); + this.registerParticle(EnumParticleTypes.BARRIER.getParticleID(), new Barrier.Factory()); + this.registerParticle(EnumParticleTypes.ITEM_CRACK.getParticleID(), new EntityBreakingFX.Factory()); + this.registerParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), new EntityDiggingFX.Factory()); + this.registerParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), new EntityBlockDustFX.Factory()); + this.registerParticle(EnumParticleTypes.EXPLOSION_HUGE.getParticleID(), new EntityHugeExplodeFX.Factory()); + this.registerParticle(EnumParticleTypes.EXPLOSION_LARGE.getParticleID(), new EntityLargeExplodeFX.Factory()); + this.registerParticle(EnumParticleTypes.FIREWORKS_SPARK.getParticleID(), new EntityFirework.Factory()); + this.registerParticle(EnumParticleTypes.MOB_APPEARANCE.getParticleID(), new MobAppearance.Factory()); + } + + public void registerParticle(int id, IParticleFactory particleFactory) + { + this.particleTypes.put(Integer.valueOf(id), particleFactory); + } + + public void emitParticleAtEntity(Entity entityIn, EnumParticleTypes particleTypes) + { + this.particleEmitters.add(new EntityParticleEmitter(this.worldObj, entityIn, particleTypes)); + } + + /** + * Spawns the relevant particle according to the particle id. + */ + public EntityFX spawnEffectParticle(int particleId, double p_178927_2_, double p_178927_4_, double p_178927_6_, double p_178927_8_, double p_178927_10_, double p_178927_12_, int... p_178927_14_) + { + IParticleFactory iparticlefactory = (IParticleFactory)this.particleTypes.get(Integer.valueOf(particleId)); + + if (iparticlefactory != null) + { + EntityFX entityfx = iparticlefactory.getEntityFX(particleId, this.worldObj, p_178927_2_, p_178927_4_, p_178927_6_, p_178927_8_, p_178927_10_, p_178927_12_, p_178927_14_); + + if (entityfx != null) + { + this.addEffect(entityfx); + return entityfx; + } + } + + return null; + } + + public void addEffect(EntityFX effect) + { + if (effect != null) + { + if (!(effect instanceof EntityFirework.SparkFX) || Config.isFireworkParticles()) + { + int i = effect.getFXLayer(); + int j = effect.getAlpha() != 1.0F ? 0 : 1; + + if (this.fxLayers[i][j].size() >= 4000) + { + this.fxLayers[i][j].remove(0); + } + + if (!(effect instanceof Barrier) || !this.reuseBarrierParticle(effect, this.fxLayers[i][j])) + { + this.fxLayers[i][j].add(effect); + } + } + } + } + + public void updateEffects() + { + for (int i = 0; i < 4; ++i) + { + this.updateEffectLayer(i); + } + + ArrayList arraylist = Lists.newArrayList(); + + for (Object entityparticleemitter0 : this.particleEmitters) + { + EntityParticleEmitter entityparticleemitter = (EntityParticleEmitter) entityparticleemitter0; + entityparticleemitter.onUpdate(); + + if (entityparticleemitter.isDead) + { + arraylist.add(entityparticleemitter); + } + } + + this.particleEmitters.removeAll(arraylist); + } + + private void updateEffectLayer(int p_178922_1_) + { + for (int i = 0; i < 2; ++i) + { + this.updateEffectAlphaLayer(this.fxLayers[p_178922_1_][i]); + } + } + + private void updateEffectAlphaLayer(List p_178925_1_) + { + ArrayList arraylist = Lists.newArrayList(); + + for (int i = 0; i < p_178925_1_.size(); ++i) + { + EntityFX entityfx = (EntityFX)p_178925_1_.get(i); + this.tickParticle(entityfx); + + if (entityfx.isDead) + { + arraylist.add(entityfx); + } + } + + p_178925_1_.removeAll(arraylist); + } + + private void tickParticle(final EntityFX p_178923_1_) + { + try + { + p_178923_1_.onUpdate(); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking Particle"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Particle being ticked"); + final int i = p_178923_1_.getFXLayer(); + crashreportcategory.addCrashSectionCallable("Particle", new Callable() + { + private static final String __OBFID = "CL_00000916"; + public String call() throws Exception + { + return p_178923_1_.toString(); + } + }); + crashreportcategory.addCrashSectionCallable("Particle Type", new Callable() + { + private static final String __OBFID = "CL_00000917"; + public String call() throws Exception + { + return i == 0 ? "MISC_TEXTURE" : (i == 1 ? "TERRAIN_TEXTURE" : (i == 3 ? "ENTITY_PARTICLE_TEXTURE" : "Unknown - " + i)); + } + }); + throw new ReportedException(crashreport); + } + } + + /** + * Renders all current particles. Args player, partialTickTime + */ + public void renderParticles(Entity entityIn, float partialTicks) + { + float f = ActiveRenderInfo.getRotationX(); + float f1 = ActiveRenderInfo.getRotationZ(); + float f2 = ActiveRenderInfo.getRotationYZ(); + float f3 = ActiveRenderInfo.getRotationXY(); + float f4 = ActiveRenderInfo.getRotationXZ(); + EntityFX.interpPosX = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; + EntityFX.interpPosY = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; + EntityFX.interpPosZ = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + GlStateManager.alphaFunc(516, 0.003921569F); + + for (int i = 0; i < 3; ++i) + { + final int j = i; + + for (int k = 0; k < 2; ++k) + { + if (!this.fxLayers[j][k].isEmpty()) + { + switch (k) + { + case 0: + GlStateManager.depthMask(false); + break; + + case 1: + GlStateManager.depthMask(true); + } + + switch (j) + { + case 0: + default: + this.renderer.bindTexture(particleTextures); + break; + + case 1: + this.renderer.bindTexture(TextureMap.locationBlocksTexture); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + + for (int l = 0; l < this.fxLayers[j][k].size(); ++l) + { + final EntityFX entityfx = (EntityFX)this.fxLayers[j][k].get(l); + + try + { + entityfx.renderParticle(worldrenderer, entityIn, partialTicks, f, f4, f1, f2, f3); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering Particle"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Particle being rendered"); + crashreportcategory.addCrashSectionCallable("Particle", new Callable() + { + private static final String __OBFID = "CL_00000918"; + public String call() throws Exception + { + return entityfx.toString(); + } + }); + crashreportcategory.addCrashSectionCallable("Particle Type", new Callable() + { + private static final String __OBFID = "CL_00000919"; + public String call() throws Exception + { + return j == 0 ? "MISC_TEXTURE" : (j == 1 ? "TERRAIN_TEXTURE" : (j == 3 ? "ENTITY_PARTICLE_TEXTURE" : "Unknown - " + j)); + } + }); + throw new ReportedException(crashreport); + } + } + + tessellator.draw(); + } + } + } + + GlStateManager.depthMask(true); + GlStateManager.disableBlend(); + GlStateManager.alphaFunc(516, 0.1F); + } + + public void renderLitParticles(Entity entityIn, float p_78872_2_) + { + float f = 0.017453292F; + float f1 = MathHelper.cos(entityIn.rotationYaw * 0.017453292F); + float f2 = MathHelper.sin(entityIn.rotationYaw * 0.017453292F); + float f3 = -f2 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F); + float f4 = f1 * MathHelper.sin(entityIn.rotationPitch * 0.017453292F); + float f5 = MathHelper.cos(entityIn.rotationPitch * 0.017453292F); + + for (int i = 0; i < 2; ++i) + { + List list = this.fxLayers[3][i]; + + if (!list.isEmpty()) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + + for (int j = 0; j < list.size(); ++j) + { + EntityFX entityfx = (EntityFX)list.get(j); + entityfx.renderParticle(worldrenderer, entityIn, p_78872_2_, f1, f5, f2, f3, f4); + } + } + } + } + + public void clearEffects(World worldIn) + { + this.worldObj = worldIn; + + for (int i = 0; i < 4; ++i) + { + for (int j = 0; j < 2; ++j) + { + this.fxLayers[i][j].clear(); + } + } + + this.particleEmitters.clear(); + } + + public void addBlockDestroyEffects(BlockPos pos, IBlockState state) + { + boolean flag; + + if (Reflector.ForgeBlock_addDestroyEffects.exists() && Reflector.ForgeBlock_isAir.exists()) + { + Block block = state.getBlock(); + Reflector.callBoolean(block, Reflector.ForgeBlock_isAir, new Object[] {this.worldObj, pos}); + flag = !Reflector.callBoolean(block, Reflector.ForgeBlock_isAir, new Object[] {this.worldObj, pos}) && !Reflector.callBoolean(block, Reflector.ForgeBlock_addDestroyEffects, new Object[] {this.worldObj, pos, this}); + } + else + { + flag = state.getBlock().getMaterial() != Material.air; + } + + if (flag) + { + state = state.getBlock().getActualState(state, this.worldObj, pos); + byte b0 = 4; + + for (int i = 0; i < b0; ++i) + { + for (int j = 0; j < b0; ++j) + { + for (int k = 0; k < b0; ++k) + { + double d0 = (double)pos.getX() + ((double)i + 0.5D) / (double)b0; + double d1 = (double)pos.getY() + ((double)j + 0.5D) / (double)b0; + double d2 = (double)pos.getZ() + ((double)k + 0.5D) / (double)b0; + this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, d0 - (double)pos.getX() - 0.5D, d1 - (double)pos.getY() - 0.5D, d2 - (double)pos.getZ() - 0.5D, state)).func_174846_a(pos)); + } + } + } + } + } + + /** + * Adds block hit particles for the specified block + */ + public void addBlockHitEffects(BlockPos pos, EnumFacing side) + { + IBlockState iblockstate = this.worldObj.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if (block.getRenderType() != -1) + { + int i = pos.getX(); + int j = pos.getY(); + int k = pos.getZ(); + float f = 0.1F; + double d0 = (double)i + this.rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinX(); + double d1 = (double)j + this.rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinY(); + double d2 = (double)k + this.rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinZ(); + + if (side == EnumFacing.DOWN) + { + d1 = (double)j + block.getBlockBoundsMinY() - (double)f; + } + + if (side == EnumFacing.UP) + { + d1 = (double)j + block.getBlockBoundsMaxY() + (double)f; + } + + if (side == EnumFacing.NORTH) + { + d2 = (double)k + block.getBlockBoundsMinZ() - (double)f; + } + + if (side == EnumFacing.SOUTH) + { + d2 = (double)k + block.getBlockBoundsMaxZ() + (double)f; + } + + if (side == EnumFacing.WEST) + { + d0 = (double)i + block.getBlockBoundsMinX() - (double)f; + } + + if (side == EnumFacing.EAST) + { + d0 = (double)i + block.getBlockBoundsMaxX() + (double)f; + } + + this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, 0.0D, 0.0D, 0.0D, iblockstate)).func_174846_a(pos).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); + } + } + + public void moveToAlphaLayer(EntityFX effect) + { + this.moveToLayer(effect, 1, 0); + } + + public void moveToNoAlphaLayer(EntityFX effect) + { + this.moveToLayer(effect, 0, 1); + } + + private void moveToLayer(EntityFX effect, int p_178924_2_, int p_178924_3_) + { + for (int i = 0; i < 4; ++i) + { + if (this.fxLayers[i][p_178924_2_].contains(effect)) + { + this.fxLayers[i][p_178924_2_].remove(effect); + this.fxLayers[i][p_178924_3_].add(effect); + } + } + } + + public String getStatistics() + { + int i = 0; + + for (int j = 0; j < 4; ++j) + { + for (int k = 0; k < 2; ++k) + { + i += this.fxLayers[j][k].size(); + } + } + + return "" + i; + } + + private boolean reuseBarrierParticle(EntityFX p_reuseBarrierParticle_1_, List p_reuseBarrierParticle_2_) + { + for (EntityFX entityfx : p_reuseBarrierParticle_2_) + { + if (entityfx instanceof Barrier && p_reuseBarrierParticle_1_.posX == entityfx.posX && p_reuseBarrierParticle_1_.posY == entityfx.posY && p_reuseBarrierParticle_1_.posZ == entityfx.posZ) + { + entityfx.particleAge = 0; + return true; + } + } + + return false; + } + + public void addBlockHitEffects(BlockPos p_addBlockHitEffects_1_, MovingObjectPosition p_addBlockHitEffects_2_) + { + Block block = this.worldObj.getBlockState(p_addBlockHitEffects_1_).getBlock(); + boolean flag = Reflector.callBoolean(block, Reflector.ForgeBlock_addHitEffects, new Object[] {this.worldObj, p_addBlockHitEffects_2_, this}); + + if (block != null && !flag) + { + this.addBlockHitEffects(p_addBlockHitEffects_1_, p_addBlockHitEffects_2_.sideHit); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EffectRendere~ b/src/minecraft/net/minecraft/client/particle/EffectRendere~ new file mode 100644 index 0000000..1d25f05 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EffectRendere~ @@ -0,0 +1,464 @@ +package net.minecraft.client.particle; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.particle.Barrier; +import net.minecraft.client.particle.EntityAuraFX; +import net.minecraft.client.particle.EntityBlockDustFX; +import net.minecraft.client.particle.EntityBreakingFX; +import net.minecraft.client.particle.EntityBubbleFX; +import net.minecraft.client.particle.EntityCloudFX; +import net.minecraft.client.particle.EntityCrit2FX; +import net.minecraft.client.particle.EntityCritFX; +import net.minecraft.client.particle.EntityDiggingFX; +import net.minecraft.client.particle.EntityDropParticleFX; +import net.minecraft.client.particle.EntityEnchantmentTableParticleFX; +import net.minecraft.client.particle.EntityExplodeFX; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.EntityFirework; +import net.minecraft.client.particle.EntityFishWakeFX; +import net.minecraft.client.particle.EntityFlameFX; +import net.minecraft.client.particle.EntityFootStepFX; +import net.minecraft.client.particle.EntityHeartFX; +import net.minecraft.client.particle.EntityHugeExplodeFX; +import net.minecraft.client.particle.EntityLargeExplodeFX; +import net.minecraft.client.particle.EntityLavaFX; +import net.minecraft.client.particle.EntityNoteFX; +import net.minecraft.client.particle.EntityParticleEmitter; +import net.minecraft.client.particle.EntityPortalFX; +import net.minecraft.client.particle.EntityRainFX; +import net.minecraft.client.particle.EntityReddustFX; +import net.minecraft.client.particle.EntitySmokeFX; +import net.minecraft.client.particle.EntitySnowShovelFX; +import net.minecraft.client.particle.EntitySpellParticleFX; +import net.minecraft.client.particle.EntitySplashFX; +import net.minecraft.client.particle.EntitySuspendFX; +import net.minecraft.client.particle.IParticleFactory; +import net.minecraft.client.particle.MobAppearance; +import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.src.Config; +import net.minecraft.src.Reflector; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class EffectRenderer { + private static final ResourceLocation field_110737_b = new ResourceLocation("textures/particle/particles.png"); + protected World field_78878_a; + private List[][] field_78876_b = new List[4][]; + private List field_178933_d = Lists.newArrayList(); + private TextureManager field_78877_c; + private Random field_78875_d = new Random(); + private Map field_178932_g = Maps.newHashMap(); + private static final String __OBFID = "CL_00000915"; + + public EffectRenderer(World p_i1220_1_, TextureManager p_i1220_2_) { + this.field_78878_a = p_i1220_1_; + this.field_78877_c = p_i1220_2_; + + for(int i = 0; i < 4; ++i) { + this.field_78876_b[i] = new List[2]; + + for(int j = 0; j < 2; ++j) { + this.field_78876_b[i][j] = Lists.newArrayList(); + } + } + + this.func_178930_c(); + } + + private void func_178930_c() { + this.func_178929_a(EnumParticleTypes.EXPLOSION_NORMAL.func_179348_c(), new EntityExplodeFX.Factory()); + this.func_178929_a(EnumParticleTypes.WATER_BUBBLE.func_179348_c(), new EntityBubbleFX.Factory()); + this.func_178929_a(EnumParticleTypes.WATER_SPLASH.func_179348_c(), new EntitySplashFX.Factory()); + this.func_178929_a(EnumParticleTypes.WATER_WAKE.func_179348_c(), new EntityFishWakeFX.Factory()); + this.func_178929_a(EnumParticleTypes.WATER_DROP.func_179348_c(), new EntityRainFX.Factory()); + this.func_178929_a(EnumParticleTypes.SUSPENDED.func_179348_c(), new EntitySuspendFX.Factory()); + this.func_178929_a(EnumParticleTypes.SUSPENDED_DEPTH.func_179348_c(), new EntityAuraFX.Factory()); + this.func_178929_a(EnumParticleTypes.CRIT.func_179348_c(), new EntityCrit2FX.Factory()); + this.func_178929_a(EnumParticleTypes.CRIT_MAGIC.func_179348_c(), new EntityCrit2FX.MagicFactory()); + this.func_178929_a(EnumParticleTypes.SMOKE_NORMAL.func_179348_c(), new EntitySmokeFX.Factory()); + this.func_178929_a(EnumParticleTypes.SMOKE_LARGE.func_179348_c(), new EntityCritFX.Factory()); + this.func_178929_a(EnumParticleTypes.SPELL.func_179348_c(), new EntitySpellParticleFX.Factory()); + this.func_178929_a(EnumParticleTypes.SPELL_INSTANT.func_179348_c(), new EntitySpellParticleFX.InstantFactory()); + this.func_178929_a(EnumParticleTypes.SPELL_MOB.func_179348_c(), new EntitySpellParticleFX.MobFactory()); + this.func_178929_a(EnumParticleTypes.SPELL_MOB_AMBIENT.func_179348_c(), new EntitySpellParticleFX.AmbientMobFactory()); + this.func_178929_a(EnumParticleTypes.SPELL_WITCH.func_179348_c(), new EntitySpellParticleFX.WitchFactory()); + this.func_178929_a(EnumParticleTypes.DRIP_WATER.func_179348_c(), new EntityDropParticleFX.WaterFactory()); + this.func_178929_a(EnumParticleTypes.DRIP_LAVA.func_179348_c(), new EntityDropParticleFX.LavaFactory()); + this.func_178929_a(EnumParticleTypes.VILLAGER_ANGRY.func_179348_c(), new EntityHeartFX.AngryVillagerFactory()); + this.func_178929_a(EnumParticleTypes.VILLAGER_HAPPY.func_179348_c(), new EntityAuraFX.HappyVillagerFactory()); + this.func_178929_a(EnumParticleTypes.TOWN_AURA.func_179348_c(), new EntityAuraFX.Factory()); + this.func_178929_a(EnumParticleTypes.NOTE.func_179348_c(), new EntityNoteFX.Factory()); + this.func_178929_a(EnumParticleTypes.PORTAL.func_179348_c(), new EntityPortalFX.Factory()); + this.func_178929_a(EnumParticleTypes.ENCHANTMENT_TABLE.func_179348_c(), new EntityEnchantmentTableParticleFX.EnchantmentTable()); + this.func_178929_a(EnumParticleTypes.FLAME.func_179348_c(), new EntityFlameFX.Factory()); + this.func_178929_a(EnumParticleTypes.LAVA.func_179348_c(), new EntityLavaFX.Factory()); + this.func_178929_a(EnumParticleTypes.FOOTSTEP.func_179348_c(), new EntityFootStepFX.Factory()); + this.func_178929_a(EnumParticleTypes.CLOUD.func_179348_c(), new EntityCloudFX.Factory()); + this.func_178929_a(EnumParticleTypes.REDSTONE.func_179348_c(), new EntityReddustFX.Factory()); + this.func_178929_a(EnumParticleTypes.SNOWBALL.func_179348_c(), new EntityBreakingFX.SnowballFactory()); + this.func_178929_a(EnumParticleTypes.SNOW_SHOVEL.func_179348_c(), new EntitySnowShovelFX.Factory()); + this.func_178929_a(EnumParticleTypes.SLIME.func_179348_c(), new EntityBreakingFX.SlimeFactory()); + this.func_178929_a(EnumParticleTypes.HEART.func_179348_c(), new EntityHeartFX.Factory()); + this.func_178929_a(EnumParticleTypes.BARRIER.func_179348_c(), new Barrier.Factory()); + this.func_178929_a(EnumParticleTypes.ITEM_CRACK.func_179348_c(), new EntityBreakingFX.Factory()); + this.func_178929_a(EnumParticleTypes.BLOCK_CRACK.func_179348_c(), new EntityDiggingFX.Factory()); + this.func_178929_a(EnumParticleTypes.BLOCK_DUST.func_179348_c(), new EntityBlockDustFX.Factory()); + this.func_178929_a(EnumParticleTypes.EXPLOSION_HUGE.func_179348_c(), new EntityHugeExplodeFX.Factory()); + this.func_178929_a(EnumParticleTypes.EXPLOSION_LARGE.func_179348_c(), new EntityLargeExplodeFX.Factory()); + this.func_178929_a(EnumParticleTypes.FIREWORKS_SPARK.func_179348_c(), new EntityFirework.Factory()); + this.func_178929_a(EnumParticleTypes.MOB_APPEARANCE.func_179348_c(), new MobAppearance.Factory()); + } + + public void func_178929_a(int p_178929_1_, IParticleFactory p_178929_2_) { + this.field_178932_g.put(Integer.valueOf(p_178929_1_), p_178929_2_); + } + + public void func_178926_a(Entity p_178926_1_, EnumParticleTypes p_178926_2_) { + this.field_178933_d.add(new EntityParticleEmitter(this.field_78878_a, p_178926_1_, p_178926_2_)); + } + + public EntityFX func_178927_a(int p_178927_1_, double p_178927_2_, double p_178927_4_, double p_178927_6_, double p_178927_8_, double p_178927_10_, double p_178927_12_, int... p_178927_14_) { + IParticleFactory iparticlefactory = (IParticleFactory)this.field_178932_g.get(Integer.valueOf(p_178927_1_)); + if(iparticlefactory != null) { + EntityFX entityfx = iparticlefactory.func_178902_a(p_178927_1_, this.field_78878_a, p_178927_2_, p_178927_4_, p_178927_6_, p_178927_8_, p_178927_10_, p_178927_12_, p_178927_14_); + if(entityfx != null) { + this.func_78873_a(entityfx); + return entityfx; + } + } + + return null; + } + + public void func_78873_a(EntityFX p_78873_1_) { + if(p_78873_1_ != null) { + if(!(p_78873_1_ instanceof EntityFirework.SparkFX) || Config.isFireworkParticles()) { + int i = p_78873_1_.func_70537_b(); + int j = p_78873_1_.func_174838_j() != 1.0F?0:1; + if(this.field_78876_b[i][j].size() >= 4000) { + this.field_78876_b[i][j].remove(0); + } + + if(!(p_78873_1_ instanceof Barrier) || !this.reuseBarrierParticle(p_78873_1_, this.field_78876_b[i][j])) { + this.field_78876_b[i][j].add(p_78873_1_); + } + } + } + } + + public void func_78868_a() { + for(int i = 0; i < 4; ++i) { + this.func_178922_a(i); + } + + ArrayList arraylist = Lists.newArrayList(); + + for(EntityParticleEmitter entityparticleemitter : this.field_178933_d) { + entityparticleemitter.func_70071_h_(); + if(entityparticleemitter.field_70128_L) { + arraylist.add(entityparticleemitter); + } + } + + this.field_178933_d.removeAll(arraylist); + } + + private void func_178922_a(int p_178922_1_) { + for(int i = 0; i < 2; ++i) { + this.func_178925_a(this.field_78876_b[p_178922_1_][i]); + } + + } + + private void func_178925_a(List p_178925_1_) { + ArrayList arraylist = Lists.newArrayList(); + + for(int i = 0; i < p_178925_1_.size(); ++i) { + EntityFX entityfx = (EntityFX)p_178925_1_.get(i); + this.func_178923_d(entityfx); + if(entityfx.field_70128_L) { + arraylist.add(entityfx); + } + } + + p_178925_1_.removeAll(arraylist); + } + + private void func_178923_d(final EntityFX p_178923_1_) { + try { + p_178923_1_.func_70071_h_(); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.func_85055_a(throwable, "Ticking Particle"); + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Particle being ticked"); + final int i = p_178923_1_.func_70537_b(); + crashreportcategory.func_71500_a("Particle", new Callable() { + private static final String __OBFID = "CL_00000916"; + + public String call() throws Exception { + return p_178923_1_.toString(); + } + }); + crashreportcategory.func_71500_a("Particle Type", new Callable() { + private static final String __OBFID = "CL_00000917"; + + public String call() throws Exception { + return i == 0?"MISC_TEXTURE":(i == 1?"TERRAIN_TEXTURE":(i == 3?"ENTITY_PARTICLE_TEXTURE":"Unknown - " + i)); + } + }); + throw new ReportedException(crashreport); + } + } + + public void func_78874_a(Entity p_78874_1_, float p_78874_2_) { + float f = ActiveRenderInfo.func_178808_b(); + float f1 = ActiveRenderInfo.func_178803_d(); + float f2 = ActiveRenderInfo.func_178805_e(); + float f3 = ActiveRenderInfo.func_178807_f(); + float f4 = ActiveRenderInfo.func_178809_c(); + EntityFX.field_70556_an = p_78874_1_.field_70142_S + (p_78874_1_.field_70165_t - p_78874_1_.field_70142_S) * (double)p_78874_2_; + EntityFX.field_70554_ao = p_78874_1_.field_70137_T + (p_78874_1_.field_70163_u - p_78874_1_.field_70137_T) * (double)p_78874_2_; + EntityFX.field_70555_ap = p_78874_1_.field_70136_U + (p_78874_1_.field_70161_v - p_78874_1_.field_70136_U) * (double)p_78874_2_; + GlStateManager.func_179147_l(); + GlStateManager.func_179112_b(770, 771); + GlStateManager.func_179092_a(516, 0.003921569F); + + for(int i = 0; i < 3; ++i) { + final int j = i; + + for(int k = 0; k < 2; ++k) { + if(!this.field_78876_b[j][k].isEmpty()) { + switch(k) { + case 0: + GlStateManager.func_179132_a(false); + break; + case 1: + GlStateManager.func_179132_a(true); + } + + switch(j) { + case 0: + default: + this.field_78877_c.func_110577_a(field_110737_b); + break; + case 1: + this.field_78877_c.func_110577_a(TextureMap.field_110575_b); + } + + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181704_d); + + for(int l = 0; l < this.field_78876_b[j][k].size(); ++l) { + final EntityFX entityfx = (EntityFX)this.field_78876_b[j][k].get(l); + + try { + entityfx.func_180434_a(worldrenderer, p_78874_1_, p_78874_2_, f, f4, f1, f2, f3); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.func_85055_a(throwable, "Rendering Particle"); + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Particle being rendered"); + crashreportcategory.func_71500_a("Particle", new Callable() { + private static final String __OBFID = "CL_00000918"; + + public String call() throws Exception { + return entityfx.toString(); + } + }); + crashreportcategory.func_71500_a("Particle Type", new Callable() { + private static final String __OBFID = "CL_00000919"; + + public String call() throws Exception { + return j == 0?"MISC_TEXTURE":(j == 1?"TERRAIN_TEXTURE":(j == 3?"ENTITY_PARTICLE_TEXTURE":"Unknown - " + j)); + } + }); + throw new ReportedException(crashreport); + } + } + + tessellator.func_78381_a(); + } + } + } + + GlStateManager.func_179132_a(true); + GlStateManager.func_179084_k(); + GlStateManager.func_179092_a(516, 0.1F); + } + + public void func_78872_b(Entity p_78872_1_, float p_78872_2_) { + float f = 0.017453292F; + float f1 = MathHelper.func_76134_b(p_78872_1_.field_70177_z * 0.017453292F); + float f2 = MathHelper.func_76126_a(p_78872_1_.field_70177_z * 0.017453292F); + float f3 = -f2 * MathHelper.func_76126_a(p_78872_1_.field_70125_A * 0.017453292F); + float f4 = f1 * MathHelper.func_76126_a(p_78872_1_.field_70125_A * 0.017453292F); + float f5 = MathHelper.func_76134_b(p_78872_1_.field_70125_A * 0.017453292F); + + for(int i = 0; i < 2; ++i) { + List list = this.field_78876_b[3][i]; + if(!list.isEmpty()) { + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + + for(int j = 0; j < list.size(); ++j) { + EntityFX entityfx = (EntityFX)list.get(j); + entityfx.func_180434_a(worldrenderer, p_78872_1_, p_78872_2_, f1, f5, f2, f3, f4); + } + } + } + + } + + public void func_78870_a(World p_78870_1_) { + this.field_78878_a = p_78870_1_; + + for(int i = 0; i < 4; ++i) { + for(int j = 0; j < 2; ++j) { + this.field_78876_b[i][j].clear(); + } + } + + this.field_178933_d.clear(); + } + + public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) { + boolean flag; + if(Reflector.ForgeBlock_addDestroyEffects.exists() && Reflector.ForgeBlock_isAir.exists()) { + Block block = p_180533_2_.func_177230_c(); + Reflector.callBoolean(block, Reflector.ForgeBlock_isAir, new Object[]{this.field_78878_a, p_180533_1_}); + flag = !Reflector.callBoolean(block, Reflector.ForgeBlock_isAir, new Object[]{this.field_78878_a, p_180533_1_}) && !Reflector.callBoolean(block, Reflector.ForgeBlock_addDestroyEffects, new Object[]{this.field_78878_a, p_180533_1_, this}); + } else { + flag = p_180533_2_.func_177230_c().func_149688_o() != Material.field_151579_a; + } + + if(flag) { + p_180533_2_ = p_180533_2_.func_177230_c().func_176221_a(p_180533_2_, this.field_78878_a, p_180533_1_); + byte b0 = 4; + + for(int i = 0; i < b0; ++i) { + for(int j = 0; j < b0; ++j) { + for(int k = 0; k < b0; ++k) { + double d0 = (double)p_180533_1_.func_177958_n() + ((double)i + 0.5D) / (double)b0; + double d1 = (double)p_180533_1_.func_177956_o() + ((double)j + 0.5D) / (double)b0; + double d2 = (double)p_180533_1_.func_177952_p() + ((double)k + 0.5D) / (double)b0; + this.func_78873_a((new EntityDiggingFX(this.field_78878_a, d0, d1, d2, d0 - (double)p_180533_1_.func_177958_n() - 0.5D, d1 - (double)p_180533_1_.func_177956_o() - 0.5D, d2 - (double)p_180533_1_.func_177952_p() - 0.5D, p_180533_2_)).func_174846_a(p_180533_1_)); + } + } + } + } + + } + + public void func_180532_a(BlockPos p_180532_1_, EnumFacing p_180532_2_) { + IBlockState iblockstate = this.field_78878_a.func_180495_p(p_180532_1_); + Block block = iblockstate.func_177230_c(); + if(block.func_149645_b() != -1) { + int i = p_180532_1_.func_177958_n(); + int j = p_180532_1_.func_177956_o(); + int k = p_180532_1_.func_177952_p(); + float f = 0.1F; + double d0 = (double)i + this.field_78875_d.nextDouble() * (block.func_149753_y() - block.func_149704_x() - (double)(f * 2.0F)) + (double)f + block.func_149704_x(); + double d1 = (double)j + this.field_78875_d.nextDouble() * (block.func_149669_A() - block.func_149665_z() - (double)(f * 2.0F)) + (double)f + block.func_149665_z(); + double d2 = (double)k + this.field_78875_d.nextDouble() * (block.func_149693_C() - block.func_149706_B() - (double)(f * 2.0F)) + (double)f + block.func_149706_B(); + if(p_180532_2_ == EnumFacing.DOWN) { + d1 = (double)j + block.func_149665_z() - (double)f; + } + + if(p_180532_2_ == EnumFacing.UP) { + d1 = (double)j + block.func_149669_A() + (double)f; + } + + if(p_180532_2_ == EnumFacing.NORTH) { + d2 = (double)k + block.func_149706_B() - (double)f; + } + + if(p_180532_2_ == EnumFacing.SOUTH) { + d2 = (double)k + block.func_149693_C() + (double)f; + } + + if(p_180532_2_ == EnumFacing.WEST) { + d0 = (double)i + block.func_149704_x() - (double)f; + } + + if(p_180532_2_ == EnumFacing.EAST) { + d0 = (double)i + block.func_149753_y() + (double)f; + } + + this.func_78873_a((new EntityDiggingFX(this.field_78878_a, d0, d1, d2, 0.0D, 0.0D, 0.0D, iblockstate)).func_174846_a(p_180532_1_).func_70543_e(0.2F).func_70541_f(0.6F)); + } + + } + + public void func_178928_b(EntityFX p_178928_1_) { + this.func_178924_a(p_178928_1_, 1, 0); + } + + public void func_178931_c(EntityFX p_178931_1_) { + this.func_178924_a(p_178931_1_, 0, 1); + } + + private void func_178924_a(EntityFX p_178924_1_, int p_178924_2_, int p_178924_3_) { + for(int i = 0; i < 4; ++i) { + if(this.field_78876_b[i][p_178924_2_].contains(p_178924_1_)) { + this.field_78876_b[i][p_178924_2_].remove(p_178924_1_); + this.field_78876_b[i][p_178924_3_].add(p_178924_1_); + } + } + + } + + public String func_78869_b() { + int i = 0; + + for(int j = 0; j < 4; ++j) { + for(int k = 0; k < 2; ++k) { + i += this.field_78876_b[j][k].size(); + } + } + + return "" + i; + } + + private boolean reuseBarrierParticle(EntityFX p_reuseBarrierParticle_1_, List p_reuseBarrierParticle_2_) { + for(EntityFX entityfx : p_reuseBarrierParticle_2_) { + if(entityfx instanceof Barrier && p_reuseBarrierParticle_1_.field_70165_t == entityfx.field_70165_t && p_reuseBarrierParticle_1_.field_70163_u == entityfx.field_70163_u && p_reuseBarrierParticle_1_.field_70161_v == entityfx.field_70161_v) { + entityfx.field_70546_d = 0; + return true; + } + } + + return false; + } + + public void addBlockHitEffects(BlockPos p_addBlockHitEffects_1_, MovingObjectPosition p_addBlockHitEffects_2_) { + Block block = this.field_78878_a.func_180495_p(p_addBlockHitEffects_1_).func_177230_c(); + boolean flag = Reflector.callBoolean(block, Reflector.ForgeBlock_addHitEffects, new Object[]{this.field_78878_a, p_addBlockHitEffects_2_, this}); + if(block != null && !flag) { + this.func_180532_a(p_addBlockHitEffects_1_, p_addBlockHitEffects_2_.field_178784_b); + } + + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityAuraFX.java b/src/minecraft/net/minecraft/client/particle/EntityAuraFX.java new file mode 100644 index 0000000..4400e62 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityAuraFX.java @@ -0,0 +1,61 @@ +package net.minecraft.client.particle; + +import net.minecraft.world.World; + +public class EntityAuraFX extends EntityFX +{ + protected EntityAuraFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double speedIn) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, speedIn); + float f = this.rand.nextFloat() * 0.1F + 0.2F; + this.particleRed = f; + this.particleGreen = f; + this.particleBlue = f; + this.setParticleTextureIndex(0); + this.setSize(0.02F, 0.02F); + this.particleScale *= this.rand.nextFloat() * 0.6F + 0.5F; + this.motionX *= 0.019999999552965164D; + this.motionY *= 0.019999999552965164D; + this.motionZ *= 0.019999999552965164D; + this.particleMaxAge = (int)(20.0D / (Math.random() * 0.8D + 0.2D)); + this.noClip = true; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.99D; + this.motionY *= 0.99D; + this.motionZ *= 0.99D; + + if (this.particleMaxAge-- <= 0) + { + this.setDead(); + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } + + public static class HappyVillagerFactory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + EntityFX entityfx = new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + entityfx.setParticleTextureIndex(82); + entityfx.setRBGColorF(1.0F, 1.0F, 1.0F); + return entityfx; + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityBlockDustFX.java b/src/minecraft/net/minecraft/client/particle/EntityBlockDustFX.java new file mode 100644 index 0000000..f1810b7 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityBlockDustFX.java @@ -0,0 +1,25 @@ +package net.minecraft.client.particle; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.world.World; + +public class EntityBlockDustFX extends EntityDiggingFX +{ + protected EntityBlockDustFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, IBlockState state) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state); + this.motionX = xSpeedIn; + this.motionY = ySpeedIn; + this.motionZ = zSpeedIn; + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + IBlockState iblockstate = Block.getStateById(p_178902_15_[0]); + return iblockstate.getBlock().getRenderType() == -1 ? null : (new EntityBlockDustFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, iblockstate)).func_174845_l(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityBreakingFX.java b/src/minecraft/net/minecraft/client/particle/EntityBreakingFX.java new file mode 100644 index 0000000..b45c9f9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityBreakingFX.java @@ -0,0 +1,98 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.world.World; + +public class EntityBreakingFX extends EntityFX +{ + protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1195_8_) + { + this(worldIn, posXIn, posYIn, posZIn, p_i1195_8_, 0); + } + + protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, Item p_i1197_14_, int p_i1197_15_) + { + this(worldIn, posXIn, posYIn, posZIn, p_i1197_14_, p_i1197_15_); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += xSpeedIn; + this.motionY += ySpeedIn; + this.motionZ += zSpeedIn; + } + + protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1196_8_, int p_i1196_9_) + { + super(worldIn, posXIn, posYIn, posZIn, 0.0D, 0.0D, 0.0D); + this.setParticleIcon(Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(p_i1196_8_, p_i1196_9_)); + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.particleGravity = Blocks.snow.blockParticleGravity; + this.particleScale /= 2.0F; + } + + public int getFXLayer() + { + return 1; + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F; + float f1 = f + 0.015609375F; + float f2 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F; + float f3 = f2 + 0.015609375F; + float f4 = 0.1F * this.particleScale; + + if (this.particleIcon != null) + { + f = this.particleIcon.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F)); + f1 = this.particleIcon.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F)); + f2 = this.particleIcon.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F)); + f3 = this.particleIcon.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F)); + } + + float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); + float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); + float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); + int i = this.getBrightnessForRender(partialTicks); + int j = i >> 16 & 65535; + int k = i & 65535; + worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 - p_180434_8_ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 + p_180434_8_ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 + p_180434_8_ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 - p_180434_8_ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + int i = p_178902_15_.length > 1 ? p_178902_15_[1] : 0; + return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Item.getItemById(p_178902_15_[0]), i); + } + } + + public static class SlimeFactory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Items.slime_ball); + } + } + + public static class SnowballFactory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Items.snowball); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityBubbleFX.java b/src/minecraft/net/minecraft/client/particle/EntityBubbleFX.java new file mode 100644 index 0000000..964d9d8 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityBubbleFX.java @@ -0,0 +1,56 @@ +package net.minecraft.client.particle; + +import net.minecraft.block.material.Material; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class EntityBubbleFX extends EntityFX +{ + protected EntityBubbleFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + this.particleRed = 1.0F; + this.particleGreen = 1.0F; + this.particleBlue = 1.0F; + this.setParticleTextureIndex(32); + this.setSize(0.02F, 0.02F); + this.particleScale *= this.rand.nextFloat() * 0.6F + 0.2F; + this.motionX = xSpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D; + this.motionY = ySpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D; + this.motionZ = zSpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY += 0.002D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.8500000238418579D; + this.motionY *= 0.8500000238418579D; + this.motionZ *= 0.8500000238418579D; + + if (this.worldObj.getBlockState(new BlockPos(this)).getBlock().getMaterial() != Material.water) + { + this.setDead(); + } + + if (this.particleMaxAge-- <= 0) + { + this.setDead(); + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityBubbleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityCloudFX.java b/src/minecraft/net/minecraft/client/particle/EntityCloudFX.java new file mode 100644 index 0000000..a18f4d8 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityCloudFX.java @@ -0,0 +1,85 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityCloudFX extends EntityFX +{ + float field_70569_a; + + protected EntityCloudFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1221_8_, double p_i1221_10_, double p_i1221_12_) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + float f = 2.5F; + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += p_i1221_8_; + this.motionY += p_i1221_10_; + this.motionZ += p_i1221_12_; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F - (float)(Math.random() * 0.30000001192092896D); + this.particleScale *= 0.75F; + this.particleScale *= f; + this.field_70569_a = this.particleScale; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.3D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * f); + this.noClip = false; + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + this.particleScale = this.field_70569_a * f; + super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.9599999785423279D; + this.motionZ *= 0.9599999785423279D; + EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, 2.0D); + + if (entityplayer != null && this.posY > entityplayer.getEntityBoundingBox().minY) + { + this.posY += (entityplayer.getEntityBoundingBox().minY - this.posY) * 0.2D; + this.motionY += (entityplayer.motionY - this.motionY) * 0.2D; + this.setPosition(this.posX, this.posY, this.posZ); + } + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityCloudFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityCrit2FX.java b/src/minecraft/net/minecraft/client/particle/EntityCrit2FX.java new file mode 100644 index 0000000..7ebd525 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityCrit2FX.java @@ -0,0 +1,95 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityCrit2FX extends EntityFX +{ + float field_174839_a; + + protected EntityCrit2FX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46284_8_, double p_i46284_10_, double p_i46284_12_) + { + this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46284_8_, p_i46284_10_, p_i46284_12_, 1.0F); + } + + protected EntityCrit2FX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46285_8_, double p_i46285_10_, double p_i46285_12_, float p_i46285_14_) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += p_i46285_8_ * 0.4D; + this.motionY += p_i46285_10_ * 0.4D; + this.motionZ += p_i46285_12_ * 0.4D; + this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D + 0.6000000238418579D); + this.particleScale *= 0.75F; + this.particleScale *= p_i46285_14_; + this.field_174839_a = this.particleScale; + this.particleMaxAge = (int)(6.0D / (Math.random() * 0.8D + 0.6D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46285_14_); + this.noClip = false; + this.setParticleTextureIndex(65); + this.onUpdate(); + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + this.particleScale = this.field_174839_a * f; + super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.particleGreen = (float)((double)this.particleGreen * 0.96D); + this.particleBlue = (float)((double)this.particleBlue * 0.9D); + this.motionX *= 0.699999988079071D; + this.motionY *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + this.motionY -= 0.019999999552965164D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityCrit2FX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } + + public static class MagicFactory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + EntityFX entityfx = new EntityCrit2FX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + entityfx.setRBGColorF(entityfx.getRedColorF() * 0.3F, entityfx.getGreenColorF() * 0.8F, entityfx.getBlueColorF()); + entityfx.nextTextureIndexX(); + return entityfx; + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityCritFX.java b/src/minecraft/net/minecraft/client/particle/EntityCritFX.java new file mode 100644 index 0000000..2e8d062 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityCritFX.java @@ -0,0 +1,19 @@ +package net.minecraft.client.particle; + +import net.minecraft.world.World; + +public class EntityCritFX extends EntitySmokeFX +{ + protected EntityCritFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1201_8_, double p_i1201_10_, double p_i1201_12_) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i1201_8_, p_i1201_10_, p_i1201_12_, 2.5F); + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityCritFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityDiggingFX.java b/src/minecraft/net/minecraft/client/particle/EntityDiggingFX.java new file mode 100644 index 0000000..1530822 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityDiggingFX.java @@ -0,0 +1,120 @@ +package net.minecraft.client.particle; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class EntityDiggingFX extends EntityFX +{ + private IBlockState field_174847_a; + private BlockPos field_181019_az; + + protected EntityDiggingFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, IBlockState state) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + this.field_174847_a = state; + this.setParticleIcon(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(state)); + this.particleGravity = state.getBlock().blockParticleGravity; + this.particleRed = this.particleGreen = this.particleBlue = 0.6F; + this.particleScale /= 2.0F; + } + + public EntityDiggingFX func_174846_a(BlockPos pos) + { + this.field_181019_az = pos; + + if (this.field_174847_a.getBlock() == Blocks.grass) + { + return this; + } + else + { + int i = this.field_174847_a.getBlock().colorMultiplier(this.worldObj, pos); + this.particleRed *= (float)(i >> 16 & 255) / 255.0F; + this.particleGreen *= (float)(i >> 8 & 255) / 255.0F; + this.particleBlue *= (float)(i & 255) / 255.0F; + return this; + } + } + + public EntityDiggingFX func_174845_l() + { + this.field_181019_az = new BlockPos(this.posX, this.posY, this.posZ); + Block block = this.field_174847_a.getBlock(); + + if (block == Blocks.grass) + { + return this; + } + else + { + int i = block.getRenderColor(this.field_174847_a); + this.particleRed *= (float)(i >> 16 & 255) / 255.0F; + this.particleGreen *= (float)(i >> 8 & 255) / 255.0F; + this.particleBlue *= (float)(i & 255) / 255.0F; + return this; + } + } + + public int getFXLayer() + { + return 1; + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F; + float f1 = f + 0.015609375F; + float f2 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F; + float f3 = f2 + 0.015609375F; + float f4 = 0.1F * this.particleScale; + + if (this.particleIcon != null) + { + f = this.particleIcon.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F)); + f1 = this.particleIcon.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F)); + f2 = this.particleIcon.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F)); + f3 = this.particleIcon.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F)); + } + + float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); + float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); + float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); + int i = this.getBrightnessForRender(partialTicks); + int j = i >> 16 & 65535; + int k = i & 65535; + worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 - p_180434_8_ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 + p_180434_8_ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 + p_180434_8_ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 - p_180434_8_ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + } + + public int getBrightnessForRender(float partialTicks) + { + int i = super.getBrightnessForRender(partialTicks); + int j = 0; + + if (this.worldObj.isBlockLoaded(this.field_181019_az)) + { + j = this.worldObj.getCombinedLight(this.field_181019_az, 0); + } + + return i == 0 ? j : i; + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return (new EntityDiggingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Block.getStateById(p_178902_15_[0]))).func_174845_l(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityDropParticleFX.java b/src/minecraft/net/minecraft/client/particle/EntityDropParticleFX.java new file mode 100644 index 0000000..f86623d --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityDropParticleFX.java @@ -0,0 +1,158 @@ +package net.minecraft.client.particle; + +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityDropParticleFX extends EntityFX +{ + /** the material type for dropped items/blocks */ + private Material materialType; + + /** The height of the current bob */ + private int bobTimer; + + protected EntityDropParticleFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, Material p_i1203_8_) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.motionX = this.motionY = this.motionZ = 0.0D; + + if (p_i1203_8_ == Material.water) + { + this.particleRed = 0.0F; + this.particleGreen = 0.0F; + this.particleBlue = 1.0F; + } + else + { + this.particleRed = 1.0F; + this.particleGreen = 0.0F; + this.particleBlue = 0.0F; + } + + this.setParticleTextureIndex(113); + this.setSize(0.01F, 0.01F); + this.particleGravity = 0.06F; + this.materialType = p_i1203_8_; + this.bobTimer = 40; + this.particleMaxAge = (int)(64.0D / (Math.random() * 0.8D + 0.2D)); + this.motionX = this.motionY = this.motionZ = 0.0D; + } + + public int getBrightnessForRender(float partialTicks) + { + return this.materialType == Material.water ? super.getBrightnessForRender(partialTicks) : 257; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float partialTicks) + { + return this.materialType == Material.water ? super.getBrightness(partialTicks) : 1.0F; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.materialType == Material.water) + { + this.particleRed = 0.2F; + this.particleGreen = 0.3F; + this.particleBlue = 1.0F; + } + else + { + this.particleRed = 1.0F; + this.particleGreen = 16.0F / (float)(40 - this.bobTimer + 16); + this.particleBlue = 4.0F / (float)(40 - this.bobTimer + 8); + } + + this.motionY -= (double)this.particleGravity; + + if (this.bobTimer-- > 0) + { + this.motionX *= 0.02D; + this.motionY *= 0.02D; + this.motionZ *= 0.02D; + this.setParticleTextureIndex(113); + } + else + { + this.setParticleTextureIndex(112); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + + if (this.particleMaxAge-- <= 0) + { + this.setDead(); + } + + if (this.onGround) + { + if (this.materialType == Material.water) + { + this.setDead(); + this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); + } + else + { + this.setParticleTextureIndex(114); + } + + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + + BlockPos blockpos = new BlockPos(this); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + Material material = iblockstate.getBlock().getMaterial(); + + if (material.isLiquid() || material.isSolid()) + { + double d0 = 0.0D; + + if (iblockstate.getBlock() instanceof BlockLiquid) + { + d0 = (double)BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()); + } + + double d1 = (double)(MathHelper.floor_double(this.posY) + 1) - d0; + + if (this.posY < d1) + { + this.setDead(); + } + } + } + + public static class LavaFactory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityDropParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Material.lava); + } + } + + public static class WaterFactory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityDropParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Material.water); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityEnchantmentTableParticleFX.java b/src/minecraft/net/minecraft/client/particle/EntityEnchantmentTableParticleFX.java new file mode 100644 index 0000000..e00fcb4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityEnchantmentTableParticleFX.java @@ -0,0 +1,94 @@ +package net.minecraft.client.particle; + +import net.minecraft.world.World; + +public class EntityEnchantmentTableParticleFX extends EntityFX +{ + private float field_70565_a; + private double coordX; + private double coordY; + private double coordZ; + + protected EntityEnchantmentTableParticleFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + this.motionX = xSpeedIn; + this.motionY = ySpeedIn; + this.motionZ = zSpeedIn; + this.coordX = xCoordIn; + this.coordY = yCoordIn; + this.coordZ = zCoordIn; + this.posX = this.prevPosX = xCoordIn + xSpeedIn; + this.posY = this.prevPosY = yCoordIn + ySpeedIn; + this.posZ = this.prevPosZ = zCoordIn + zSpeedIn; + float f = this.rand.nextFloat() * 0.6F + 0.4F; + this.field_70565_a = this.particleScale = this.rand.nextFloat() * 0.5F + 0.2F; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F * f; + this.particleGreen *= 0.9F; + this.particleRed *= 0.9F; + this.particleMaxAge = (int)(Math.random() * 10.0D) + 30; + this.noClip = true; + this.setParticleTextureIndex((int)(Math.random() * 26.0D + 1.0D + 224.0D)); + } + + public int getBrightnessForRender(float partialTicks) + { + int i = super.getBrightnessForRender(partialTicks); + float f = (float)this.particleAge / (float)this.particleMaxAge; + f = f * f; + f = f * f; + int j = i & 255; + int k = i >> 16 & 255; + k = k + (int)(f * 15.0F * 16.0F); + + if (k > 240) + { + k = 240; + } + + return j | k << 16; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float partialTicks) + { + float f = super.getBrightness(partialTicks); + float f1 = (float)this.particleAge / (float)this.particleMaxAge; + f1 = f1 * f1; + f1 = f1 * f1; + return f * (1.0F - f1) + f1; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + float f = (float)this.particleAge / (float)this.particleMaxAge; + f = 1.0F - f; + float f1 = 1.0F - f; + f1 = f1 * f1; + f1 = f1 * f1; + this.posX = this.coordX + this.motionX * (double)f; + this.posY = this.coordY + this.motionY * (double)f - (double)(f1 * 1.2F); + this.posZ = this.coordZ + this.motionZ * (double)f; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + } + + public static class EnchantmentTable implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityEnchantmentTableParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityExplodeFX.java b/src/minecraft/net/minecraft/client/particle/EntityExplodeFX.java new file mode 100644 index 0000000..bab4abd --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityExplodeFX.java @@ -0,0 +1,53 @@ +package net.minecraft.client.particle; + +import net.minecraft.world.World; + +public class EntityExplodeFX extends EntityFX +{ + protected EntityExplodeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + this.motionX = xSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D; + this.motionY = ySpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D; + this.motionZ = zSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.05000000074505806D; + this.particleRed = this.particleGreen = this.particleBlue = this.rand.nextFloat() * 0.3F + 0.7F; + this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F; + this.particleMaxAge = (int)(16.0D / ((double)this.rand.nextFloat() * 0.8D + 0.2D)) + 2; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); + this.motionY += 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.8999999761581421D; + this.motionY *= 0.8999999761581421D; + this.motionZ *= 0.8999999761581421D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityExplodeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityFX.java b/src/minecraft/net/minecraft/client/particle/EntityFX.java new file mode 100644 index 0000000..af8d17f --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityFX.java @@ -0,0 +1,273 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityFX extends Entity +{ + protected int particleTextureIndexX; + protected int particleTextureIndexY; + protected float particleTextureJitterX; + protected float particleTextureJitterY; + protected int particleAge; + protected int particleMaxAge; + protected float particleScale; + protected float particleGravity; + + /** The red amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0. */ + protected float particleRed; + + /** + * The green amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0. + */ + protected float particleGreen; + + /** + * The blue amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0. + */ + protected float particleBlue; + + /** Particle alpha */ + protected float particleAlpha; + + /** The icon field from which the given particle pulls its texture. */ + protected TextureAtlasSprite particleIcon; + public static double interpPosX; + public static double interpPosY; + public static double interpPosZ; + + protected EntityFX(World worldIn, double posXIn, double posYIn, double posZIn) + { + super(worldIn); + this.particleAlpha = 1.0F; + this.setSize(0.2F, 0.2F); + this.setPosition(posXIn, posYIn, posZIn); + this.lastTickPosX = this.prevPosX = posXIn; + this.lastTickPosY = this.prevPosY = posYIn; + this.lastTickPosZ = this.prevPosZ = posZIn; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.particleTextureJitterX = this.rand.nextFloat() * 3.0F; + this.particleTextureJitterY = this.rand.nextFloat() * 3.0F; + this.particleScale = (this.rand.nextFloat() * 0.5F + 0.5F) * 2.0F; + this.particleMaxAge = (int)(4.0F / (this.rand.nextFloat() * 0.9F + 0.1F)); + this.particleAge = 0; + } + + public EntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) + { + this(worldIn, xCoordIn, yCoordIn, zCoordIn); + this.motionX = xSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.4000000059604645D; + this.motionY = ySpeedIn + (Math.random() * 2.0D - 1.0D) * 0.4000000059604645D; + this.motionZ = zSpeedIn + (Math.random() * 2.0D - 1.0D) * 0.4000000059604645D; + float f = (float)(Math.random() + Math.random() + 1.0D) * 0.15F; + float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + this.motionX = this.motionX / (double)f1 * (double)f * 0.4000000059604645D; + this.motionY = this.motionY / (double)f1 * (double)f * 0.4000000059604645D + 0.10000000149011612D; + this.motionZ = this.motionZ / (double)f1 * (double)f * 0.4000000059604645D; + } + + public EntityFX multiplyVelocity(float multiplier) + { + this.motionX *= (double)multiplier; + this.motionY = (this.motionY - 0.10000000149011612D) * (double)multiplier + 0.10000000149011612D; + this.motionZ *= (double)multiplier; + return this; + } + + public EntityFX multipleParticleScaleBy(float p_70541_1_) + { + this.setSize(0.2F * p_70541_1_, 0.2F * p_70541_1_); + this.particleScale *= p_70541_1_; + return this; + } + + public void setRBGColorF(float particleRedIn, float particleGreenIn, float particleBlueIn) + { + this.particleRed = particleRedIn; + this.particleGreen = particleGreenIn; + this.particleBlue = particleBlueIn; + } + + /** + * Sets the particle alpha (float) + */ + public void setAlphaF(float alpha) + { + if (this.particleAlpha == 1.0F && alpha < 1.0F) + { + Minecraft.getMinecraft().effectRenderer.moveToAlphaLayer(this); + } + else if (this.particleAlpha < 1.0F && alpha == 1.0F) + { + Minecraft.getMinecraft().effectRenderer.moveToNoAlphaLayer(this); + } + + this.particleAlpha = alpha; + } + + public float getRedColorF() + { + return this.particleRed; + } + + public float getGreenColorF() + { + return this.particleGreen; + } + + public float getBlueColorF() + { + return this.particleBlue; + } + + public float getAlpha() + { + return this.particleAlpha; + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + protected void entityInit() + { + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.motionY -= 0.04D * (double)this.particleGravity; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = (float)this.particleTextureIndexX / 16.0F; + float f1 = f + 0.0624375F; + float f2 = (float)this.particleTextureIndexY / 16.0F; + float f3 = f2 + 0.0624375F; + float f4 = 0.1F * this.particleScale; + + if (this.particleIcon != null) + { + f = this.particleIcon.getMinU(); + f1 = this.particleIcon.getMaxU(); + f2 = this.particleIcon.getMinV(); + f3 = this.particleIcon.getMaxV(); + } + + float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); + float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); + float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); + int i = this.getBrightnessForRender(partialTicks); + int j = i >> 16 & 65535; + int k = i & 65535; + worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 - p_180434_8_ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 + p_180434_8_ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 + p_180434_8_ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 - p_180434_8_ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + } + + public int getFXLayer() + { + return 0; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + } + + /** + * Sets the particle's icon. + */ + public void setParticleIcon(TextureAtlasSprite icon) + { + int i = this.getFXLayer(); + + if (i == 1) + { + this.particleIcon = icon; + } + else + { + throw new RuntimeException("Invalid call to Particle.setTex, use coordinate methods"); + } + } + + /** + * Public method to set private field particleTextureIndex. + */ + public void setParticleTextureIndex(int particleTextureIndex) + { + if (this.getFXLayer() != 0) + { + throw new RuntimeException("Invalid call to Particle.setMiscTex"); + } + else + { + this.particleTextureIndexX = particleTextureIndex % 16; + this.particleTextureIndexY = particleTextureIndex / 16; + } + } + + public void nextTextureIndexX() + { + ++this.particleTextureIndexX; + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } + + public String toString() + { + return this.getClass().getSimpleName() + ", Pos (" + this.posX + "," + this.posY + "," + this.posZ + "), RGBA (" + this.particleRed + "," + this.particleGreen + "," + this.particleBlue + "," + this.particleAlpha + "), Age " + this.particleAge; + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityFirework.java b/src/minecraft/net/minecraft/client/particle/EntityFirework.java new file mode 100644 index 0000000..2b02ad3 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityFirework.java @@ -0,0 +1,432 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemDye; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityFirework +{ + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + EntityFirework.SparkFX entityfirework$sparkfx = new EntityFirework.SparkFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Minecraft.getMinecraft().effectRenderer); + entityfirework$sparkfx.setAlphaF(0.99F); + return entityfirework$sparkfx; + } + } + + public static class OverlayFX extends EntityFX + { + protected OverlayFX(World p_i46466_1_, double p_i46466_2_, double p_i46466_4_, double p_i46466_6_) + { + super(p_i46466_1_, p_i46466_2_, p_i46466_4_, p_i46466_6_); + this.particleMaxAge = 4; + } + + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = 0.25F; + float f1 = 0.5F; + float f2 = 0.125F; + float f3 = 0.375F; + float f4 = 7.1F * MathHelper.sin(((float)this.particleAge + partialTicks - 1.0F) * 0.25F * (float)Math.PI); + this.particleAlpha = 0.6F - ((float)this.particleAge + partialTicks - 1.0F) * 0.25F * 0.5F; + float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); + float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); + float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); + int i = this.getBrightnessForRender(partialTicks); + int j = i >> 16 & 65535; + int k = i & 65535; + worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 - p_180434_8_ * f4)).tex(0.5D, 0.375D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 + p_180434_8_ * f4)).tex(0.5D, 0.125D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 + p_180434_8_ * f4)).tex(0.25D, 0.125D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 - p_180434_8_ * f4)).tex(0.25D, 0.375D).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j, k).endVertex(); + } + } + + public static class SparkFX extends EntityFX + { + private int baseTextureIndex = 160; + private boolean trail; + private boolean twinkle; + private final EffectRenderer field_92047_az; + private float fadeColourRed; + private float fadeColourGreen; + private float fadeColourBlue; + private boolean hasFadeColour; + + public SparkFX(World p_i46465_1_, double p_i46465_2_, double p_i46465_4_, double p_i46465_6_, double p_i46465_8_, double p_i46465_10_, double p_i46465_12_, EffectRenderer p_i46465_14_) + { + super(p_i46465_1_, p_i46465_2_, p_i46465_4_, p_i46465_6_); + this.motionX = p_i46465_8_; + this.motionY = p_i46465_10_; + this.motionZ = p_i46465_12_; + this.field_92047_az = p_i46465_14_; + this.particleScale *= 0.75F; + this.particleMaxAge = 48 + this.rand.nextInt(12); + this.noClip = false; + } + + public void setTrail(boolean trailIn) + { + this.trail = trailIn; + } + + public void setTwinkle(boolean twinkleIn) + { + this.twinkle = twinkleIn; + } + + public void setColour(int colour) + { + float f = (float)((colour & 16711680) >> 16) / 255.0F; + float f1 = (float)((colour & 65280) >> 8) / 255.0F; + float f2 = (float)((colour & 255) >> 0) / 255.0F; + float f3 = 1.0F; + this.setRBGColorF(f * f3, f1 * f3, f2 * f3); + } + + public void setFadeColour(int faceColour) + { + this.fadeColourRed = (float)((faceColour & 16711680) >> 16) / 255.0F; + this.fadeColourGreen = (float)((faceColour & 65280) >> 8) / 255.0F; + this.fadeColourBlue = (float)((faceColour & 255) >> 0) / 255.0F; + this.hasFadeColour = true; + } + + public AxisAlignedBB getCollisionBoundingBox() + { + return null; + } + + public boolean canBePushed() + { + return false; + } + + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + if (!this.twinkle || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0) + { + super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + } + } + + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + if (this.particleAge > this.particleMaxAge / 2) + { + this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge); + + if (this.hasFadeColour) + { + this.particleRed += (this.fadeColourRed - this.particleRed) * 0.2F; + this.particleGreen += (this.fadeColourGreen - this.particleGreen) * 0.2F; + this.particleBlue += (this.fadeColourBlue - this.particleBlue) * 0.2F; + } + } + + this.setParticleTextureIndex(this.baseTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge)); + this.motionY -= 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9100000262260437D; + this.motionY *= 0.9100000262260437D; + this.motionZ *= 0.9100000262260437D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + + if (this.trail && this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0) + { + EntityFirework.SparkFX entityfirework$sparkfx = new EntityFirework.SparkFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, this.field_92047_az); + entityfirework$sparkfx.setAlphaF(0.99F); + entityfirework$sparkfx.setRBGColorF(this.particleRed, this.particleGreen, this.particleBlue); + entityfirework$sparkfx.particleAge = entityfirework$sparkfx.particleMaxAge / 2; + + if (this.hasFadeColour) + { + entityfirework$sparkfx.hasFadeColour = true; + entityfirework$sparkfx.fadeColourRed = this.fadeColourRed; + entityfirework$sparkfx.fadeColourGreen = this.fadeColourGreen; + entityfirework$sparkfx.fadeColourBlue = this.fadeColourBlue; + } + + entityfirework$sparkfx.twinkle = this.twinkle; + this.field_92047_az.addEffect(entityfirework$sparkfx); + } + } + + public int getBrightnessForRender(float partialTicks) + { + return 15728880; + } + + public float getBrightness(float partialTicks) + { + return 1.0F; + } + } + + public static class StarterFX extends EntityFX + { + private int fireworkAge; + private final EffectRenderer theEffectRenderer; + private NBTTagList fireworkExplosions; + boolean twinkle; + + public StarterFX(World p_i46464_1_, double p_i46464_2_, double p_i46464_4_, double p_i46464_6_, double p_i46464_8_, double p_i46464_10_, double p_i46464_12_, EffectRenderer p_i46464_14_, NBTTagCompound p_i46464_15_) + { + super(p_i46464_1_, p_i46464_2_, p_i46464_4_, p_i46464_6_, 0.0D, 0.0D, 0.0D); + this.motionX = p_i46464_8_; + this.motionY = p_i46464_10_; + this.motionZ = p_i46464_12_; + this.theEffectRenderer = p_i46464_14_; + this.particleMaxAge = 8; + + if (p_i46464_15_ != null) + { + this.fireworkExplosions = p_i46464_15_.getTagList("Explosions", 10); + + if (this.fireworkExplosions.tagCount() == 0) + { + this.fireworkExplosions = null; + } + else + { + this.particleMaxAge = this.fireworkExplosions.tagCount() * 2 - 1; + + for (int i = 0; i < this.fireworkExplosions.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = this.fireworkExplosions.getCompoundTagAt(i); + + if (nbttagcompound.getBoolean("Flicker")) + { + this.twinkle = true; + this.particleMaxAge += 15; + break; + } + } + } + } + } + + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + } + + public void onUpdate() + { + if (this.fireworkAge == 0 && this.fireworkExplosions != null) + { + boolean flag = this.func_92037_i(); + boolean flag1 = false; + + if (this.fireworkExplosions.tagCount() >= 3) + { + flag1 = true; + } + else + { + for (int i = 0; i < this.fireworkExplosions.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = this.fireworkExplosions.getCompoundTagAt(i); + + if (nbttagcompound.getByte("Type") == 1) + { + flag1 = true; + break; + } + } + } + + String s1 = "fireworks." + (flag1 ? "largeBlast" : "blast") + (flag ? "_far" : ""); + this.worldObj.playSound(this.posX, this.posY, this.posZ, s1, 20.0F, 0.95F + this.rand.nextFloat() * 0.1F, true); + } + + if (this.fireworkAge % 2 == 0 && this.fireworkExplosions != null && this.fireworkAge / 2 < this.fireworkExplosions.tagCount()) + { + int k = this.fireworkAge / 2; + NBTTagCompound nbttagcompound1 = this.fireworkExplosions.getCompoundTagAt(k); + int l = nbttagcompound1.getByte("Type"); + boolean flag4 = nbttagcompound1.getBoolean("Trail"); + boolean flag2 = nbttagcompound1.getBoolean("Flicker"); + int[] aint = nbttagcompound1.getIntArray("Colors"); + int[] aint1 = nbttagcompound1.getIntArray("FadeColors"); + + if (aint.length == 0) + { + aint = new int[] {ItemDye.dyeColors[0]}; + } + + if (l == 1) + { + this.createBall(0.5D, 4, aint, aint1, flag4, flag2); + } + else if (l == 2) + { + this.createShaped(0.5D, new double[][] {{0.0D, 1.0D}, {0.3455D, 0.309D}, {0.9511D, 0.309D}, {0.3795918367346939D, -0.12653061224489795D}, {0.6122448979591837D, -0.8040816326530612D}, {0.0D, -0.35918367346938773D}}, aint, aint1, flag4, flag2, false); + } + else if (l == 3) + { + this.createShaped(0.5D, new double[][] {{0.0D, 0.2D}, {0.2D, 0.2D}, {0.2D, 0.6D}, {0.6D, 0.6D}, {0.6D, 0.2D}, {0.2D, 0.2D}, {0.2D, 0.0D}, {0.4D, 0.0D}, {0.4D, -0.6D}, {0.2D, -0.6D}, {0.2D, -0.4D}, {0.0D, -0.4D}}, aint, aint1, flag4, flag2, true); + } + else if (l == 4) + { + this.createBurst(aint, aint1, flag4, flag2); + } + else + { + this.createBall(0.25D, 2, aint, aint1, flag4, flag2); + } + + int j = aint[0]; + float f = (float)((j & 16711680) >> 16) / 255.0F; + float f1 = (float)((j & 65280) >> 8) / 255.0F; + float f2 = (float)((j & 255) >> 0) / 255.0F; + EntityFirework.OverlayFX entityfirework$overlayfx = new EntityFirework.OverlayFX(this.worldObj, this.posX, this.posY, this.posZ); + entityfirework$overlayfx.setRBGColorF(f, f1, f2); + this.theEffectRenderer.addEffect(entityfirework$overlayfx); + } + + ++this.fireworkAge; + + if (this.fireworkAge > this.particleMaxAge) + { + if (this.twinkle) + { + boolean flag3 = this.func_92037_i(); + String s = "fireworks." + (flag3 ? "twinkle_far" : "twinkle"); + this.worldObj.playSound(this.posX, this.posY, this.posZ, s, 20.0F, 0.9F + this.rand.nextFloat() * 0.15F, true); + } + + this.setDead(); + } + } + + private boolean func_92037_i() + { + Minecraft minecraft = Minecraft.getMinecraft(); + return minecraft == null || minecraft.getRenderViewEntity() == null || minecraft.getRenderViewEntity().getDistanceSq(this.posX, this.posY, this.posZ) >= 256.0D; + } + + private void createParticle(double p_92034_1_, double p_92034_3_, double p_92034_5_, double p_92034_7_, double p_92034_9_, double p_92034_11_, int[] p_92034_13_, int[] p_92034_14_, boolean p_92034_15_, boolean p_92034_16_) + { + EntityFirework.SparkFX entityfirework$sparkfx = new EntityFirework.SparkFX(this.worldObj, p_92034_1_, p_92034_3_, p_92034_5_, p_92034_7_, p_92034_9_, p_92034_11_, this.theEffectRenderer); + entityfirework$sparkfx.setAlphaF(0.99F); + entityfirework$sparkfx.setTrail(p_92034_15_); + entityfirework$sparkfx.setTwinkle(p_92034_16_); + int i = this.rand.nextInt(p_92034_13_.length); + entityfirework$sparkfx.setColour(p_92034_13_[i]); + + if (p_92034_14_ != null && p_92034_14_.length > 0) + { + entityfirework$sparkfx.setFadeColour(p_92034_14_[this.rand.nextInt(p_92034_14_.length)]); + } + + this.theEffectRenderer.addEffect(entityfirework$sparkfx); + } + + private void createBall(double speed, int size, int[] colours, int[] fadeColours, boolean trail, boolean twinkleIn) + { + double d0 = this.posX; + double d1 = this.posY; + double d2 = this.posZ; + + for (int i = -size; i <= size; ++i) + { + for (int j = -size; j <= size; ++j) + { + for (int k = -size; k <= size; ++k) + { + double d3 = (double)j + (this.rand.nextDouble() - this.rand.nextDouble()) * 0.5D; + double d4 = (double)i + (this.rand.nextDouble() - this.rand.nextDouble()) * 0.5D; + double d5 = (double)k + (this.rand.nextDouble() - this.rand.nextDouble()) * 0.5D; + double d6 = (double)MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5) / speed + this.rand.nextGaussian() * 0.05D; + this.createParticle(d0, d1, d2, d3 / d6, d4 / d6, d5 / d6, colours, fadeColours, trail, twinkleIn); + + if (i != -size && i != size && j != -size && j != size) + { + k += size * 2 - 1; + } + } + } + } + } + + private void createShaped(double speed, double[][] shape, int[] colours, int[] fadeColours, boolean trail, boolean twinkleIn, boolean p_92038_8_) + { + double d0 = shape[0][0]; + double d1 = shape[0][1]; + this.createParticle(this.posX, this.posY, this.posZ, d0 * speed, d1 * speed, 0.0D, colours, fadeColours, trail, twinkleIn); + float f = this.rand.nextFloat() * (float)Math.PI; + double d2 = p_92038_8_ ? 0.034D : 0.34D; + + for (int i = 0; i < 3; ++i) + { + double d3 = (double)f + (double)((float)i * (float)Math.PI) * d2; + double d4 = d0; + double d5 = d1; + + for (int j = 1; j < shape.length; ++j) + { + double d6 = shape[j][0]; + double d7 = shape[j][1]; + + for (double d8 = 0.25D; d8 <= 1.0D; d8 += 0.25D) + { + double d9 = (d4 + (d6 - d4) * d8) * speed; + double d10 = (d5 + (d7 - d5) * d8) * speed; + double d11 = d9 * Math.sin(d3); + d9 = d9 * Math.cos(d3); + + for (double d12 = -1.0D; d12 <= 1.0D; d12 += 2.0D) + { + this.createParticle(this.posX, this.posY, this.posZ, d9 * d12, d10, d11 * d12, colours, fadeColours, trail, twinkleIn); + } + } + + d4 = d6; + d5 = d7; + } + } + } + + private void createBurst(int[] colours, int[] fadeColours, boolean trail, boolean twinkleIn) + { + double d0 = this.rand.nextGaussian() * 0.05D; + double d1 = this.rand.nextGaussian() * 0.05D; + + for (int i = 0; i < 70; ++i) + { + double d2 = this.motionX * 0.5D + this.rand.nextGaussian() * 0.15D + d0; + double d3 = this.motionZ * 0.5D + this.rand.nextGaussian() * 0.15D + d1; + double d4 = this.motionY * 0.5D + this.rand.nextDouble() * 0.5D; + this.createParticle(this.posX, this.posY, this.posZ, d2, d4, d3, colours, fadeColours, trail, twinkleIn); + } + } + + public int getFXLayer() + { + return 0; + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityFishWakeFX.java b/src/minecraft/net/minecraft/client/particle/EntityFishWakeFX.java new file mode 100644 index 0000000..68f7ec1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityFishWakeFX.java @@ -0,0 +1,56 @@ +package net.minecraft.client.particle; + +import net.minecraft.world.World; + +public class EntityFishWakeFX extends EntityFX +{ + protected EntityFishWakeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i45073_8_, double p_i45073_10_, double p_i45073_12_) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.30000001192092896D; + this.motionY = Math.random() * 0.20000000298023224D + 0.10000000149011612D; + this.motionZ *= 0.30000001192092896D; + this.particleRed = 1.0F; + this.particleGreen = 1.0F; + this.particleBlue = 1.0F; + this.setParticleTextureIndex(19); + this.setSize(0.01F, 0.01F); + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.particleGravity = 0.0F; + this.motionX = p_i45073_8_; + this.motionY = p_i45073_10_; + this.motionZ = p_i45073_12_; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= (double)this.particleGravity; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + int i = 60 - this.particleMaxAge; + float f = (float)i * 0.001F; + this.setSize(f, f); + this.setParticleTextureIndex(19 + i % 4); + + if (this.particleMaxAge-- <= 0) + { + this.setDead(); + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityFishWakeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityFlameFX.java b/src/minecraft/net/minecraft/client/particle/EntityFlameFX.java new file mode 100644 index 0000000..92e810b --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityFlameFX.java @@ -0,0 +1,100 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityFlameFX extends EntityFX +{ + /** the scale of the flame FX */ + private float flameScale; + + protected EntityFlameFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + this.motionX = this.motionX * 0.009999999776482582D + xSpeedIn; + this.motionY = this.motionY * 0.009999999776482582D + ySpeedIn; + this.motionZ = this.motionZ * 0.009999999776482582D + zSpeedIn; + this.posX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F); + this.posY += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F); + this.posZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F); + this.flameScale = this.particleScale; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)) + 4; + this.noClip = true; + this.setParticleTextureIndex(48); + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge; + this.particleScale = this.flameScale * (1.0F - f * f * 0.5F); + super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + } + + public int getBrightnessForRender(float partialTicks) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + int i = super.getBrightnessForRender(partialTicks); + int j = i & 255; + int k = i >> 16 & 255; + j = j + (int)(f * 15.0F * 16.0F); + + if (j > 240) + { + j = 240; + } + + return j | k << 16; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float partialTicks) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + float f1 = super.getBrightness(partialTicks); + return f1 * f + (1.0F - f); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.9599999785423279D; + this.motionZ *= 0.9599999785423279D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityFlameFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityFootStepFX.java b/src/minecraft/net/minecraft/client/particle/EntityFootStepFX.java new file mode 100644 index 0000000..eccd5e7 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityFootStepFX.java @@ -0,0 +1,88 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class EntityFootStepFX extends EntityFX +{ + private static final ResourceLocation FOOTPRINT_TEXTURE = new ResourceLocation("textures/particle/footprint.png"); + private int footstepAge; + private int footstepMaxAge; + private TextureManager currentFootSteps; + + protected EntityFootStepFX(TextureManager currentFootStepsIn, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.currentFootSteps = currentFootStepsIn; + this.motionX = this.motionY = this.motionZ = 0.0D; + this.footstepMaxAge = 200; + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.footstepAge + partialTicks) / (float)this.footstepMaxAge; + f = f * f; + float f1 = 2.0F - f * 2.0F; + + if (f1 > 1.0F) + { + f1 = 1.0F; + } + + f1 = f1 * 0.2F; + GlStateManager.disableLighting(); + float f2 = 0.125F; + float f3 = (float)(this.posX - interpPosX); + float f4 = (float)(this.posY - interpPosY); + float f5 = (float)(this.posZ - interpPosZ); + float f6 = this.worldObj.getLightBrightness(new BlockPos(this)); + this.currentFootSteps.bindTexture(FOOTPRINT_TEXTURE); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + worldRendererIn.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldRendererIn.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(0.0D, 1.0D).color(f6, f6, f6, f1).endVertex(); + worldRendererIn.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(1.0D, 1.0D).color(f6, f6, f6, f1).endVertex(); + worldRendererIn.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(1.0D, 0.0D).color(f6, f6, f6, f1).endVertex(); + worldRendererIn.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(0.0D, 0.0D).color(f6, f6, f6, f1).endVertex(); + Tessellator.getInstance().draw(); + GlStateManager.disableBlend(); + GlStateManager.enableLighting(); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + ++this.footstepAge; + + if (this.footstepAge == this.footstepMaxAge) + { + this.setDead(); + } + } + + public int getFXLayer() + { + return 3; + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityFootStepFX(Minecraft.getMinecraft().getTextureManager(), worldIn, xCoordIn, yCoordIn, zCoordIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityHeartFX.java b/src/minecraft/net/minecraft/client/particle/EntityHeartFX.java new file mode 100644 index 0000000..6973f0a --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityHeartFX.java @@ -0,0 +1,94 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityHeartFX extends EntityFX +{ + float particleScaleOverTime; + + protected EntityHeartFX(World worldIn, double p_i1211_2_, double p_i1211_4_, double p_i1211_6_, double p_i1211_8_, double p_i1211_10_, double p_i1211_12_) + { + this(worldIn, p_i1211_2_, p_i1211_4_, p_i1211_6_, p_i1211_8_, p_i1211_10_, p_i1211_12_, 2.0F); + } + + protected EntityHeartFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46354_8_, double p_i46354_10_, double p_i46354_12_, float scale) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.009999999776482582D; + this.motionY *= 0.009999999776482582D; + this.motionZ *= 0.009999999776482582D; + this.motionY += 0.1D; + this.particleScale *= 0.75F; + this.particleScale *= scale; + this.particleScaleOverTime = this.particleScale; + this.particleMaxAge = 16; + this.noClip = false; + this.setParticleTextureIndex(80); + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + this.particleScale = this.particleScaleOverTime * f; + super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.posY == this.prevPosY) + { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= 0.8600000143051147D; + this.motionY *= 0.8600000143051147D; + this.motionZ *= 0.8600000143051147D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + public static class AngryVillagerFactory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + EntityFX entityfx = new EntityHeartFX(worldIn, xCoordIn, yCoordIn + 0.5D, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + entityfx.setParticleTextureIndex(81); + entityfx.setRBGColorF(1.0F, 1.0F, 1.0F); + return entityfx; + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityHeartFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityHugeExplodeFX.java b/src/minecraft/net/minecraft/client/particle/EntityHugeExplodeFX.java new file mode 100644 index 0000000..9bb9cc3 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityHugeExplodeFX.java @@ -0,0 +1,60 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class EntityHugeExplodeFX extends EntityFX +{ + private int timeSinceStart; + + /** the maximum time for the explosion */ + private int maximumTime = 8; + + protected EntityHugeExplodeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1214_8_, double p_i1214_10_, double p_i1214_12_) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + for (int i = 0; i < 6; ++i) + { + double d0 = this.posX + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D; + double d1 = this.posY + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D; + double d2 = this.posZ + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D; + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, d0, d1, d2, (double)((float)this.timeSinceStart / (float)this.maximumTime), 0.0D, 0.0D, new int[0]); + } + + ++this.timeSinceStart; + + if (this.timeSinceStart == this.maximumTime) + { + this.setDead(); + } + } + + public int getFXLayer() + { + return 1; + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityHugeExplodeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityLargeExplodeFX.java b/src/minecraft/net/minecraft/client/particle/EntityLargeExplodeFX.java new file mode 100644 index 0000000..c998ad2 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityLargeExplodeFX.java @@ -0,0 +1,99 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class EntityLargeExplodeFX extends EntityFX +{ + private static final ResourceLocation EXPLOSION_TEXTURE = new ResourceLocation("textures/entity/explosion.png"); + private static final VertexFormat field_181549_az = (new VertexFormat()).func_181721_a(DefaultVertexFormats.POSITION_3F).func_181721_a(DefaultVertexFormats.TEX_2F).func_181721_a(DefaultVertexFormats.COLOR_4UB).func_181721_a(DefaultVertexFormats.TEX_2S).func_181721_a(DefaultVertexFormats.NORMAL_3B).func_181721_a(DefaultVertexFormats.PADDING_1B); + private int field_70581_a; + private int field_70584_aq; + + /** The Rendering Engine. */ + private TextureManager theRenderEngine; + private float field_70582_as; + + protected EntityLargeExplodeFX(TextureManager renderEngine, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1213_9_, double p_i1213_11_, double p_i1213_13_) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.theRenderEngine = renderEngine; + this.field_70584_aq = 6 + this.rand.nextInt(4); + this.particleRed = this.particleGreen = this.particleBlue = this.rand.nextFloat() * 0.6F + 0.4F; + this.field_70582_as = 1.0F - (float)p_i1213_9_ * 0.5F; + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + int i = (int)(((float)this.field_70581_a + partialTicks) * 15.0F / (float)this.field_70584_aq); + + if (i <= 15) + { + this.theRenderEngine.bindTexture(EXPLOSION_TEXTURE); + float f = (float)(i % 4) / 4.0F; + float f1 = f + 0.24975F; + float f2 = (float)(i / 4) / 4.0F; + float f3 = f2 + 0.24975F; + float f4 = 2.0F * this.field_70582_as; + float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); + float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); + float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableLighting(); + RenderHelper.disableStandardItemLighting(); + worldRendererIn.begin(7, field_181549_az); + worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 - p_180434_8_ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 + p_180434_8_ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 + p_180434_8_ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 - p_180434_8_ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex(); + Tessellator.getInstance().draw(); + GlStateManager.enableLighting(); + } + } + + public int getBrightnessForRender(float partialTicks) + { + return 61680; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + ++this.field_70581_a; + + if (this.field_70581_a == this.field_70584_aq) + { + this.setDead(); + } + } + + public int getFXLayer() + { + return 3; + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityLargeExplodeFX(Minecraft.getMinecraft().getTextureManager(), worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityLavaFX.java b/src/minecraft/net/minecraft/client/particle/EntityLavaFX.java new file mode 100644 index 0000000..21b4b02 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityLavaFX.java @@ -0,0 +1,97 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityLavaFX extends EntityFX +{ + private float lavaParticleScale; + + protected EntityLavaFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.800000011920929D; + this.motionY *= 0.800000011920929D; + this.motionZ *= 0.800000011920929D; + this.motionY = (double)(this.rand.nextFloat() * 0.4F + 0.05F); + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.particleScale *= this.rand.nextFloat() * 2.0F + 0.2F; + this.lavaParticleScale = this.particleScale; + this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D)); + this.noClip = false; + this.setParticleTextureIndex(49); + } + + public int getBrightnessForRender(float partialTicks) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + int i = super.getBrightnessForRender(partialTicks); + int j = 240; + int k = i >> 16 & 255; + return j | k << 16; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float partialTicks) + { + return 1.0F; + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge; + this.particleScale = this.lavaParticleScale * (1.0F - f * f); + super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + float f = (float)this.particleAge / (float)this.particleMaxAge; + + if (this.rand.nextFloat() > f) + { + this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, new int[0]); + } + + this.motionY -= 0.03D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9990000128746033D; + this.motionY *= 0.9990000128746033D; + this.motionZ *= 0.9990000128746033D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityLavaFX(worldIn, xCoordIn, yCoordIn, zCoordIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityNoteFX.java b/src/minecraft/net/minecraft/client/particle/EntityNoteFX.java new file mode 100644 index 0000000..1757f4c --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityNoteFX.java @@ -0,0 +1,86 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityNoteFX extends EntityFX +{ + float noteParticleScale; + + protected EntityNoteFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46353_8_, double p_i46353_10_, double p_i46353_12_) + { + this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46353_8_, p_i46353_10_, p_i46353_12_, 2.0F); + } + + protected EntityNoteFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1217_8_, double p_i1217_10_, double p_i1217_12_, float p_i1217_14_) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.009999999776482582D; + this.motionY *= 0.009999999776482582D; + this.motionZ *= 0.009999999776482582D; + this.motionY += 0.2D; + this.particleRed = MathHelper.sin(((float)p_i1217_8_ + 0.0F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F; + this.particleGreen = MathHelper.sin(((float)p_i1217_8_ + 0.33333334F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F; + this.particleBlue = MathHelper.sin(((float)p_i1217_8_ + 0.6666667F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F; + this.particleScale *= 0.75F; + this.particleScale *= p_i1217_14_; + this.noteParticleScale = this.particleScale; + this.particleMaxAge = 6; + this.noClip = false; + this.setParticleTextureIndex(64); + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + this.particleScale = this.noteParticleScale * f; + super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.posY == this.prevPosY) + { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= 0.6600000262260437D; + this.motionY *= 0.6600000262260437D; + this.motionZ *= 0.6600000262260437D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityNoteFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityParticleEmitter.java b/src/minecraft/net/minecraft/client/particle/EntityParticleEmitter.java new file mode 100644 index 0000000..54a2508 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityParticleEmitter.java @@ -0,0 +1,63 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class EntityParticleEmitter extends EntityFX +{ + private Entity attachedEntity; + private int age; + private int lifetime; + private EnumParticleTypes particleTypes; + + public EntityParticleEmitter(World worldIn, Entity p_i46279_2_, EnumParticleTypes particleTypesIn) + { + super(worldIn, p_i46279_2_.posX, p_i46279_2_.getEntityBoundingBox().minY + (double)(p_i46279_2_.height / 2.0F), p_i46279_2_.posZ, p_i46279_2_.motionX, p_i46279_2_.motionY, p_i46279_2_.motionZ); + this.attachedEntity = p_i46279_2_; + this.lifetime = 3; + this.particleTypes = particleTypesIn; + this.onUpdate(); + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + for (int i = 0; i < 16; ++i) + { + double d0 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); + double d1 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); + double d2 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); + + if (d0 * d0 + d1 * d1 + d2 * d2 <= 1.0D) + { + double d3 = this.attachedEntity.posX + d0 * (double)this.attachedEntity.width / 4.0D; + double d4 = this.attachedEntity.getEntityBoundingBox().minY + (double)(this.attachedEntity.height / 2.0F) + d1 * (double)this.attachedEntity.height / 4.0D; + double d5 = this.attachedEntity.posZ + d2 * (double)this.attachedEntity.width / 4.0D; + this.worldObj.spawnParticle(this.particleTypes, false, d3, d4, d5, d0, d1 + 0.2D, d2, new int[0]); + } + } + + ++this.age; + + if (this.age >= this.lifetime) + { + this.setDead(); + } + } + + public int getFXLayer() + { + return 3; + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityPickupFX.java b/src/minecraft/net/minecraft/client/particle/EntityPickupFX.java new file mode 100644 index 0000000..c7c27a2 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityPickupFX.java @@ -0,0 +1,73 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; + +public class EntityPickupFX extends EntityFX +{ + private Entity field_174840_a; + private Entity field_174843_ax; + private int age; + private int maxAge; + private float field_174841_aA; + private RenderManager field_174842_aB = Minecraft.getMinecraft().getRenderManager(); + + public EntityPickupFX(World worldIn, Entity p_i1233_2_, Entity p_i1233_3_, float p_i1233_4_) + { + super(worldIn, p_i1233_2_.posX, p_i1233_2_.posY, p_i1233_2_.posZ, p_i1233_2_.motionX, p_i1233_2_.motionY, p_i1233_2_.motionZ); + this.field_174840_a = p_i1233_2_; + this.field_174843_ax = p_i1233_3_; + this.maxAge = 3; + this.field_174841_aA = p_i1233_4_; + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.age + partialTicks) / (float)this.maxAge; + f = f * f; + double d0 = this.field_174840_a.posX; + double d1 = this.field_174840_a.posY; + double d2 = this.field_174840_a.posZ; + double d3 = this.field_174843_ax.lastTickPosX + (this.field_174843_ax.posX - this.field_174843_ax.lastTickPosX) * (double)partialTicks; + double d4 = this.field_174843_ax.lastTickPosY + (this.field_174843_ax.posY - this.field_174843_ax.lastTickPosY) * (double)partialTicks + (double)this.field_174841_aA; + double d5 = this.field_174843_ax.lastTickPosZ + (this.field_174843_ax.posZ - this.field_174843_ax.lastTickPosZ) * (double)partialTicks; + double d6 = d0 + (d3 - d0) * (double)f; + double d7 = d1 + (d4 - d1) * (double)f; + double d8 = d2 + (d5 - d2) * (double)f; + int i = this.getBrightnessForRender(partialTicks); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + d6 = d6 - interpPosX; + d7 = d7 - interpPosY; + d8 = d8 - interpPosZ; + this.field_174842_aB.renderEntityWithPosYaw(this.field_174840_a, (double)((float)d6), (double)((float)d7), (double)((float)d8), this.field_174840_a.rotationYaw, partialTicks); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + ++this.age; + + if (this.age == this.maxAge) + { + this.setDead(); + } + } + + public int getFXLayer() + { + return 3; + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityPortalFX.java b/src/minecraft/net/minecraft/client/particle/EntityPortalFX.java new file mode 100644 index 0000000..ae85841 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityPortalFX.java @@ -0,0 +1,103 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; + +public class EntityPortalFX extends EntityFX +{ + private float portalParticleScale; + private double portalPosX; + private double portalPosY; + private double portalPosZ; + + protected EntityPortalFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + this.motionX = xSpeedIn; + this.motionY = ySpeedIn; + this.motionZ = zSpeedIn; + this.portalPosX = this.posX = xCoordIn; + this.portalPosY = this.posY = yCoordIn; + this.portalPosZ = this.posZ = zCoordIn; + float f = this.rand.nextFloat() * 0.6F + 0.4F; + this.portalParticleScale = this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F * f; + this.particleGreen *= 0.3F; + this.particleRed *= 0.9F; + this.particleMaxAge = (int)(Math.random() * 10.0D) + 40; + this.noClip = true; + this.setParticleTextureIndex((int)(Math.random() * 8.0D)); + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge; + f = 1.0F - f; + f = f * f; + f = 1.0F - f; + this.particleScale = this.portalParticleScale * f; + super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + } + + public int getBrightnessForRender(float partialTicks) + { + int i = super.getBrightnessForRender(partialTicks); + float f = (float)this.particleAge / (float)this.particleMaxAge; + f = f * f; + f = f * f; + int j = i & 255; + int k = i >> 16 & 255; + k = k + (int)(f * 15.0F * 16.0F); + + if (k > 240) + { + k = 240; + } + + return j | k << 16; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float partialTicks) + { + float f = super.getBrightness(partialTicks); + float f1 = (float)this.particleAge / (float)this.particleMaxAge; + f1 = f1 * f1 * f1 * f1; + return f * (1.0F - f1) + f1; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + float f = (float)this.particleAge / (float)this.particleMaxAge; + f = -f + f * f * 2.0F; + f = 1.0F - f; + this.posX = this.portalPosX + this.motionX * (double)f; + this.posY = this.portalPosY + this.motionY * (double)f + (double)(1.0F - f); + this.posZ = this.portalPosZ + this.motionZ * (double)f; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityPortalFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityRainFX.java b/src/minecraft/net/minecraft/client/particle/EntityRainFX.java new file mode 100644 index 0000000..3f78dd7 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityRainFX.java @@ -0,0 +1,93 @@ +package net.minecraft.client.particle; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityRainFX extends EntityFX +{ + protected EntityRainFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.30000001192092896D; + this.motionY = Math.random() * 0.20000000298023224D + 0.10000000149011612D; + this.motionZ *= 0.30000001192092896D; + this.particleRed = 1.0F; + this.particleGreen = 1.0F; + this.particleBlue = 1.0F; + this.setParticleTextureIndex(19 + this.rand.nextInt(4)); + this.setSize(0.01F, 0.01F); + this.particleGravity = 0.06F; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= (double)this.particleGravity; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + + if (this.particleMaxAge-- <= 0) + { + this.setDead(); + } + + if (this.onGround) + { + if (Math.random() < 0.5D) + { + this.setDead(); + } + + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + + BlockPos blockpos = new BlockPos(this); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + block.setBlockBoundsBasedOnState(this.worldObj, blockpos); + Material material = iblockstate.getBlock().getMaterial(); + + if (material.isLiquid() || material.isSolid()) + { + double d0 = 0.0D; + + if (iblockstate.getBlock() instanceof BlockLiquid) + { + d0 = (double)(1.0F - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue())); + } + else + { + d0 = block.getBlockBoundsMaxY(); + } + + double d1 = (double)MathHelper.floor_double(this.posY) + d0; + + if (this.posY < d1) + { + this.setDead(); + } + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityRainFX(worldIn, xCoordIn, yCoordIn, zCoordIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntityReddustFX.java b/src/minecraft/net/minecraft/client/particle/EntityReddustFX.java new file mode 100644 index 0000000..67c085d --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntityReddustFX.java @@ -0,0 +1,93 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityReddustFX extends EntityFX +{ + float reddustParticleScale; + + protected EntityReddustFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float p_i46349_8_, float p_i46349_9_, float p_i46349_10_) + { + this(worldIn, xCoordIn, yCoordIn, zCoordIn, 1.0F, p_i46349_8_, p_i46349_9_, p_i46349_10_); + } + + protected EntityReddustFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float p_i46350_8_, float p_i46350_9_, float p_i46350_10_, float p_i46350_11_) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + + if (p_i46350_9_ == 0.0F) + { + p_i46350_9_ = 1.0F; + } + + float f = (float)Math.random() * 0.4F + 0.6F; + this.particleRed = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_9_ * f; + this.particleGreen = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_10_ * f; + this.particleBlue = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * p_i46350_11_ * f; + this.particleScale *= 0.75F; + this.particleScale *= p_i46350_8_; + this.reddustParticleScale = this.particleScale; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46350_8_); + this.noClip = false; + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + this.particleScale = this.reddustParticleScale * f; + super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.posY == this.prevPosY) + { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.9599999785423279D; + this.motionZ *= 0.9599999785423279D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntityReddustFX(worldIn, xCoordIn, yCoordIn, zCoordIn, (float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntitySmokeFX.java b/src/minecraft/net/minecraft/client/particle/EntitySmokeFX.java new file mode 100644 index 0000000..3f4a051 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntitySmokeFX.java @@ -0,0 +1,88 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntitySmokeFX extends EntityFX +{ + float smokeParticleScale; + + private EntitySmokeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46347_8_, double p_i46347_10_, double p_i46347_12_) + { + this(worldIn, xCoordIn, yCoordIn, zCoordIn, p_i46347_8_, p_i46347_10_, p_i46347_12_, 1.0F); + } + + protected EntitySmokeFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i46348_8_, double p_i46348_10_, double p_i46348_12_, float p_i46348_14_) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += p_i46348_8_; + this.motionY += p_i46348_10_; + this.motionZ += p_i46348_12_; + this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D); + this.particleScale *= 0.75F; + this.particleScale *= p_i46348_14_; + this.smokeParticleScale = this.particleScale; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46348_14_); + this.noClip = false; + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + this.particleScale = this.smokeParticleScale * f; + super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); + this.motionY += 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.posY == this.prevPosY) + { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.9599999785423279D; + this.motionZ *= 0.9599999785423279D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntitySmokeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntitySnowShovelFX.java b/src/minecraft/net/minecraft/client/particle/EntitySnowShovelFX.java new file mode 100644 index 0000000..0acea4e --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntitySnowShovelFX.java @@ -0,0 +1,81 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntitySnowShovelFX extends EntityFX +{ + float snowDigParticleScale; + + protected EntitySnowShovelFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) + { + this(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, 1.0F); + } + + protected EntitySnowShovelFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, float p_i1228_14_) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += xSpeedIn; + this.motionY += ySpeedIn; + this.motionZ += zSpeedIn; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F - (float)(Math.random() * 0.30000001192092896D); + this.particleScale *= 0.75F; + this.particleScale *= p_i1228_14_; + this.snowDigParticleScale = this.particleScale; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * p_i1228_14_); + this.noClip = false; + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + this.particleScale = this.snowDigParticleScale * f; + super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); + this.motionY -= 0.03D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9900000095367432D; + this.motionY *= 0.9900000095367432D; + this.motionZ *= 0.9900000095367432D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntitySnowShovelFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntitySpellParticleFX.java b/src/minecraft/net/minecraft/client/particle/EntitySpellParticleFX.java new file mode 100644 index 0000000..6970cf4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntitySpellParticleFX.java @@ -0,0 +1,135 @@ +package net.minecraft.client.particle; + +import java.util.Random; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntitySpellParticleFX extends EntityFX +{ + private static final Random RANDOM = new Random(); + + /** Base spell texture index */ + private int baseSpellTextureIndex = 128; + + protected EntitySpellParticleFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1229_8_, double p_i1229_10_, double p_i1229_12_) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.5D - RANDOM.nextDouble(), p_i1229_10_, 0.5D - RANDOM.nextDouble()); + this.motionY *= 0.20000000298023224D; + + if (p_i1229_8_ == 0.0D && p_i1229_12_ == 0.0D) + { + this.motionX *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + } + + this.particleScale *= 0.75F; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.noClip = false; + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.setParticleTextureIndex(this.baseSpellTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge)); + this.motionY += 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.posY == this.prevPosY) + { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.9599999785423279D; + this.motionZ *= 0.9599999785423279D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + /** + * Sets the base spell texture index + */ + public void setBaseSpellTextureIndex(int baseSpellTextureIndexIn) + { + this.baseSpellTextureIndex = baseSpellTextureIndexIn; + } + + public static class AmbientMobFactory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + entityfx.setAlphaF(0.15F); + entityfx.setRBGColorF((float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn); + return entityfx; + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } + + public static class InstantFactory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + ((EntitySpellParticleFX)entityfx).setBaseSpellTextureIndex(144); + return entityfx; + } + } + + public static class MobFactory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + entityfx.setRBGColorF((float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn); + return entityfx; + } + } + + public static class WitchFactory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + ((EntitySpellParticleFX)entityfx).setBaseSpellTextureIndex(144); + float f = worldIn.rand.nextFloat() * 0.5F + 0.35F; + entityfx.setRBGColorF(1.0F * f, 0.0F * f, 1.0F * f); + return entityfx; + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntitySplashFX.java b/src/minecraft/net/minecraft/client/particle/EntitySplashFX.java new file mode 100644 index 0000000..17c9b3b --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntitySplashFX.java @@ -0,0 +1,28 @@ +package net.minecraft.client.particle; + +import net.minecraft.world.World; + +public class EntitySplashFX extends EntityRainFX +{ + protected EntitySplashFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn); + this.particleGravity = 0.04F; + this.nextTextureIndexX(); + + if (ySpeedIn == 0.0D && (xSpeedIn != 0.0D || zSpeedIn != 0.0D)) + { + this.motionX = xSpeedIn; + this.motionY = ySpeedIn + 0.1D; + this.motionZ = zSpeedIn; + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntitySplashFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/EntitySuspendFX.java b/src/minecraft/net/minecraft/client/particle/EntitySuspendFX.java new file mode 100644 index 0000000..7e06db9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/EntitySuspendFX.java @@ -0,0 +1,52 @@ +package net.minecraft.client.particle; + +import net.minecraft.block.material.Material; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class EntitySuspendFX extends EntityFX +{ + protected EntitySuspendFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) + { + super(worldIn, xCoordIn, yCoordIn - 0.125D, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + this.particleRed = 0.4F; + this.particleGreen = 0.4F; + this.particleBlue = 0.7F; + this.setParticleTextureIndex(0); + this.setSize(0.01F, 0.01F); + this.particleScale *= this.rand.nextFloat() * 0.6F + 0.2F; + this.motionX = xSpeedIn * 0.0D; + this.motionY = ySpeedIn * 0.0D; + this.motionZ = zSpeedIn * 0.0D; + this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.worldObj.getBlockState(new BlockPos(this)).getBlock().getMaterial() != Material.water) + { + this.setDead(); + } + + if (this.particleMaxAge-- <= 0) + { + this.setDead(); + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new EntitySuspendFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/particle/IParticleFactory.java b/src/minecraft/net/minecraft/client/particle/IParticleFactory.java new file mode 100644 index 0000000..6f850b1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/IParticleFactory.java @@ -0,0 +1,8 @@ +package net.minecraft.client.particle; + +import net.minecraft.world.World; + +public interface IParticleFactory +{ + EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_); +} diff --git a/src/minecraft/net/minecraft/client/particle/MobAppearance.java b/src/minecraft/net/minecraft/client/particle/MobAppearance.java new file mode 100644 index 0000000..60ff73e --- /dev/null +++ b/src/minecraft/net/minecraft/client/particle/MobAppearance.java @@ -0,0 +1,87 @@ +package net.minecraft.client.particle; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityGuardian; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class MobAppearance extends EntityFX +{ + private EntityLivingBase entity; + + protected MobAppearance(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn) + { + super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.motionX = this.motionY = this.motionZ = 0.0D; + this.particleGravity = 0.0F; + this.particleMaxAge = 30; + } + + public int getFXLayer() + { + return 3; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.entity == null) + { + EntityGuardian entityguardian = new EntityGuardian(this.worldObj); + entityguardian.setElder(); + this.entity = entityguardian; + } + } + + /** + * Renders the particle + */ + public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + { + if (this.entity != null) + { + RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); + rendermanager.setRenderPosition(EntityFX.interpPosX, EntityFX.interpPosY, EntityFX.interpPosZ); + float f = 0.42553192F; + float f1 = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge; + GlStateManager.depthMask(true); + GlStateManager.enableBlend(); + GlStateManager.enableDepth(); + GlStateManager.blendFunc(770, 771); + float f2 = 240.0F; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f2, f2); + GlStateManager.pushMatrix(); + float f3 = 0.05F + 0.5F * MathHelper.sin(f1 * (float)Math.PI); + GlStateManager.color(1.0F, 1.0F, 1.0F, f3); + GlStateManager.translate(0.0F, 1.8F, 0.0F); + GlStateManager.rotate(180.0F - entityIn.rotationYaw, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(60.0F - 150.0F * f1 - entityIn.rotationPitch, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(0.0F, -0.4F, -1.5F); + GlStateManager.scale(f, f, f); + this.entity.rotationYaw = this.entity.prevRotationYaw = 0.0F; + this.entity.rotationYawHead = this.entity.prevRotationYawHead = 0.0F; + rendermanager.renderEntityWithPosYaw(this.entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks); + GlStateManager.popMatrix(); + GlStateManager.enableDepth(); + } + } + + public static class Factory implements IParticleFactory + { + public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + { + return new MobAppearance(worldIn, xCoordIn, yCoordIn, zCoordIn); + } + } +} diff --git a/src/minecraft/net/minecraft/client/player/inventory/ContainerLocalMenu.java b/src/minecraft/net/minecraft/client/player/inventory/ContainerLocalMenu.java new file mode 100644 index 0000000..aa3dd2b --- /dev/null +++ b/src/minecraft/net/minecraft/client/player/inventory/ContainerLocalMenu.java @@ -0,0 +1,62 @@ +package net.minecraft.client.player.inventory; + +import com.google.common.collect.Maps; +import java.util.Map; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryBasic; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.ILockableContainer; +import net.minecraft.world.LockCode; + +public class ContainerLocalMenu extends InventoryBasic implements ILockableContainer +{ + private String guiID; + private Map field_174895_b = Maps.newHashMap(); + + public ContainerLocalMenu(String id, IChatComponent title, int slotCount) + { + super(title, slotCount); + this.guiID = id; + } + + public int getField(int id) + { + return this.field_174895_b.containsKey(Integer.valueOf(id)) ? ((Integer)this.field_174895_b.get(Integer.valueOf(id))).intValue() : 0; + } + + public void setField(int id, int value) + { + this.field_174895_b.put(Integer.valueOf(id), Integer.valueOf(value)); + } + + public int getFieldCount() + { + return this.field_174895_b.size(); + } + + public boolean isLocked() + { + return false; + } + + public void setLockCode(LockCode code) + { + } + + public LockCode getLockCode() + { + return LockCode.EMPTY_CODE; + } + + public String getGuiID() + { + return this.guiID; + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + throw new UnsupportedOperationException(); + } +} diff --git a/src/minecraft/net/minecraft/client/player/inventory/LocalBlockIntercommunication.java b/src/minecraft/net/minecraft/client/player/inventory/LocalBlockIntercommunication.java new file mode 100644 index 0000000..6e4d020 --- /dev/null +++ b/src/minecraft/net/minecraft/client/player/inventory/LocalBlockIntercommunication.java @@ -0,0 +1,53 @@ +package net.minecraft.client.player.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.IInteractionObject; + +public class LocalBlockIntercommunication implements IInteractionObject +{ + private String guiID; + private IChatComponent displayName; + + public LocalBlockIntercommunication(String guiIdIn, IChatComponent displayNameIn) + { + this.guiID = guiIdIn; + this.displayName = displayNameIn; + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + throw new UnsupportedOperationException(); + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.displayName.getUnformattedText(); + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return true; + } + + public String getGuiID() + { + return this.guiID; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return this.displayName; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java b/src/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java new file mode 100644 index 0000000..8dcc7d0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java @@ -0,0 +1,140 @@ +package net.minecraft.client.renderer; + +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.glu.GLU; + +public class ActiveRenderInfo +{ + /** The current GL viewport */ + private static final IntBuffer VIEWPORT = GLAllocation.createDirectIntBuffer(16); + + /** The current GL modelview matrix */ + private static final FloatBuffer MODELVIEW = GLAllocation.createDirectFloatBuffer(16); + + /** The current GL projection matrix */ + private static final FloatBuffer PROJECTION = GLAllocation.createDirectFloatBuffer(16); + + /** The computed view object coordinates */ + private static final FloatBuffer OBJECTCOORDS = GLAllocation.createDirectFloatBuffer(3); + private static Vec3 position = new Vec3(0.0D, 0.0D, 0.0D); + + /** The X component of the entity's yaw rotation */ + private static float rotationX; + + /** The combined X and Z components of the entity's pitch rotation */ + private static float rotationXZ; + + /** The Z component of the entity's yaw rotation */ + private static float rotationZ; + + /** + * The Y component (scaled along the Z axis) of the entity's pitch rotation + */ + private static float rotationYZ; + + /** + * The Y component (scaled along the X axis) of the entity's pitch rotation + */ + private static float rotationXY; + + /** + * Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode + */ + public static void updateRenderInfo(EntityPlayer entityplayerIn, boolean p_74583_1_) + { + GlStateManager.getFloat(2982, MODELVIEW); + GlStateManager.getFloat(2983, PROJECTION); + GL11.glGetInteger(GL11.GL_VIEWPORT, VIEWPORT); + float f = (float)((VIEWPORT.get(0) + VIEWPORT.get(2)) / 2); + float f1 = (float)((VIEWPORT.get(1) + VIEWPORT.get(3)) / 2); + GLU.gluUnProject(f, f1, 0.0F, MODELVIEW, PROJECTION, VIEWPORT, OBJECTCOORDS); + position = new Vec3((double)OBJECTCOORDS.get(0), (double)OBJECTCOORDS.get(1), (double)OBJECTCOORDS.get(2)); + int i = p_74583_1_ ? 1 : 0; + float f2 = entityplayerIn.rotationPitch; + float f3 = entityplayerIn.rotationYaw; + rotationX = MathHelper.cos(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2); + rotationZ = MathHelper.sin(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2); + rotationYZ = -rotationZ * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2); + rotationXY = rotationX * MathHelper.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2); + rotationXZ = MathHelper.cos(f2 * (float)Math.PI / 180.0F); + } + + public static Vec3 projectViewFromEntity(Entity p_178806_0_, double p_178806_1_) + { + double d0 = p_178806_0_.prevPosX + (p_178806_0_.posX - p_178806_0_.prevPosX) * p_178806_1_; + double d1 = p_178806_0_.prevPosY + (p_178806_0_.posY - p_178806_0_.prevPosY) * p_178806_1_; + double d2 = p_178806_0_.prevPosZ + (p_178806_0_.posZ - p_178806_0_.prevPosZ) * p_178806_1_; + double d3 = d0 + position.xCoord; + double d4 = d1 + position.yCoord; + double d5 = d2 + position.zCoord; + return new Vec3(d3, d4, d5); + } + + public static Block getBlockAtEntityViewpoint(World worldIn, Entity p_180786_1_, float p_180786_2_) + { + Vec3 vec3 = projectViewFromEntity(p_180786_1_, (double)p_180786_2_); + BlockPos blockpos = new BlockPos(vec3); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (block.getMaterial().isLiquid()) + { + float f = 0.0F; + + if (iblockstate.getBlock() instanceof BlockLiquid) + { + f = BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()) - 0.11111111F; + } + + float f1 = (float)(blockpos.getY() + 1) - f; + + if (vec3.yCoord >= (double)f1) + { + block = worldIn.getBlockState(blockpos.up()).getBlock(); + } + } + + return block; + } + + public static Vec3 getPosition() + { + return position; + } + + public static float getRotationX() + { + return rotationX; + } + + public static float getRotationXZ() + { + return rotationXZ; + } + + public static float getRotationZ() + { + return rotationZ; + } + + public static float getRotationYZ() + { + return rotationYZ; + } + + public static float getRotationXY() + { + return rotationXY; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/BlockFluidRenderer.java b/src/minecraft/net/minecraft/client/renderer/BlockFluidRenderer.java new file mode 100644 index 0000000..9723ada --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/BlockFluidRenderer.java @@ -0,0 +1,308 @@ +package net.minecraft.client.renderer; + +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; +import optifine.CustomColors; +import optifine.RenderEnv; + +public class BlockFluidRenderer +{ + private TextureAtlasSprite[] atlasSpritesLava = new TextureAtlasSprite[2]; + private TextureAtlasSprite[] atlasSpritesWater = new TextureAtlasSprite[2]; + private static final String __OBFID = "CL_00002519"; + + public BlockFluidRenderer() + { + this.initAtlasSprites(); + } + + protected void initAtlasSprites() + { + TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks(); + this.atlasSpritesLava[0] = texturemap.getAtlasSprite("minecraft:blocks/lava_still"); + this.atlasSpritesLava[1] = texturemap.getAtlasSprite("minecraft:blocks/lava_flow"); + this.atlasSpritesWater[0] = texturemap.getAtlasSprite("minecraft:blocks/water_still"); + this.atlasSpritesWater[1] = texturemap.getAtlasSprite("minecraft:blocks/water_flow"); + } + + public boolean renderFluid(IBlockAccess blockAccess, IBlockState blockStateIn, BlockPos blockPosIn, WorldRenderer worldRendererIn) + { + BlockLiquid blockliquid = (BlockLiquid)blockStateIn.getBlock(); + blockliquid.setBlockBoundsBasedOnState(blockAccess, blockPosIn); + TextureAtlasSprite[] atextureatlassprite = blockliquid.getMaterial() == Material.lava ? this.atlasSpritesLava : this.atlasSpritesWater; + RenderEnv renderenv = RenderEnv.getInstance(blockAccess, blockStateIn, blockPosIn); + int i = CustomColors.getFluidColor(blockAccess, blockStateIn, blockPosIn, renderenv); + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; + boolean flag = blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.up(), EnumFacing.UP); + boolean flag1 = blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.down(), EnumFacing.DOWN); + boolean[] aboolean = renderenv.getBorderFlags(); + aboolean[0] = blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.north(), EnumFacing.NORTH); + aboolean[1] = blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.south(), EnumFacing.SOUTH); + aboolean[2] = blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.west(), EnumFacing.WEST); + aboolean[3] = blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.east(), EnumFacing.EAST); + + if (!flag && !flag1 && !aboolean[0] && !aboolean[1] && !aboolean[2] && !aboolean[3]) + { + return false; + } + else + { + boolean flag2 = false; + float f3 = 0.5F; + float f4 = 1.0F; + float f5 = 0.8F; + float f6 = 0.6F; + Material material = blockliquid.getMaterial(); + float f7 = this.getFluidHeight(blockAccess, blockPosIn, material); + float f8 = this.getFluidHeight(blockAccess, blockPosIn.south(), material); + float f9 = this.getFluidHeight(blockAccess, blockPosIn.east().south(), material); + float f10 = this.getFluidHeight(blockAccess, blockPosIn.east(), material); + double d0 = (double)blockPosIn.getX(); + double d1 = (double)blockPosIn.getY(); + double d2 = (double)blockPosIn.getZ(); + float f11 = 0.001F; + + if (flag) + { + flag2 = true; + TextureAtlasSprite textureatlassprite = atextureatlassprite[0]; + float f12 = (float)BlockLiquid.getFlowDirection(blockAccess, blockPosIn, material); + + if (f12 > -999.0F) + { + textureatlassprite = atextureatlassprite[1]; + } + + worldRendererIn.setSprite(textureatlassprite); + f7 -= f11; + f8 -= f11; + f9 -= f11; + f10 -= f11; + float f13; + float f14; + float f15; + float f16; + float f17; + float f19; + float f20; + float f21; + + if (f12 < -999.0F) + { + f13 = textureatlassprite.getInterpolatedU(0.0D); + f17 = textureatlassprite.getInterpolatedV(0.0D); + f14 = f13; + f19 = textureatlassprite.getInterpolatedV(16.0D); + f15 = textureatlassprite.getInterpolatedU(16.0D); + f20 = f19; + f16 = f15; + f21 = f17; + } + else + { + float f22 = MathHelper.sin(f12) * 0.25F; + float f23 = MathHelper.cos(f12) * 0.25F; + float f24 = 8.0F; + f13 = textureatlassprite.getInterpolatedU((double)(8.0F + (-f23 - f22) * 16.0F)); + f17 = textureatlassprite.getInterpolatedV((double)(8.0F + (-f23 + f22) * 16.0F)); + f14 = textureatlassprite.getInterpolatedU((double)(8.0F + (-f23 + f22) * 16.0F)); + f19 = textureatlassprite.getInterpolatedV((double)(8.0F + (f23 + f22) * 16.0F)); + f15 = textureatlassprite.getInterpolatedU((double)(8.0F + (f23 + f22) * 16.0F)); + f20 = textureatlassprite.getInterpolatedV((double)(8.0F + (f23 - f22) * 16.0F)); + f16 = textureatlassprite.getInterpolatedU((double)(8.0F + (f23 - f22) * 16.0F)); + f21 = textureatlassprite.getInterpolatedV((double)(8.0F + (-f23 - f22) * 16.0F)); + } + + int k2 = blockliquid.getMixedBrightnessForBlock(blockAccess, blockPosIn); + int l2 = k2 >> 16 & 65535; + int i3 = k2 & 65535; + float f25 = f4 * f; + float f26 = f4 * f1; + float f18 = f4 * f2; + worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(f25, f26, f18, 1.0F).tex((double)f13, (double)f17).lightmap(l2, i3).endVertex(); + worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(f25, f26, f18, 1.0F).tex((double)f14, (double)f19).lightmap(l2, i3).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(f25, f26, f18, 1.0F).tex((double)f15, (double)f20).lightmap(l2, i3).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(f25, f26, f18, 1.0F).tex((double)f16, (double)f21).lightmap(l2, i3).endVertex(); + + if (blockliquid.func_176364_g(blockAccess, blockPosIn.up())) + { + worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(f25, f26, f18, 1.0F).tex((double)f13, (double)f17).lightmap(l2, i3).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(f25, f26, f18, 1.0F).tex((double)f16, (double)f21).lightmap(l2, i3).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(f25, f26, f18, 1.0F).tex((double)f15, (double)f20).lightmap(l2, i3).endVertex(); + worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(f25, f26, f18, 1.0F).tex((double)f14, (double)f19).lightmap(l2, i3).endVertex(); + } + } + + if (flag1) + { + float f35 = atextureatlassprite[0].getMinU(); + float f36 = atextureatlassprite[0].getMaxU(); + float f37 = atextureatlassprite[0].getMinV(); + float f38 = atextureatlassprite[0].getMaxV(); + int i1 = blockliquid.getMixedBrightnessForBlock(blockAccess, blockPosIn.down()); + int k1 = i1 >> 16 & 65535; + int i2 = i1 & 65535; + worldRendererIn.pos(d0, d1, d2 + 1.0D).color(f3, f3, f3, 1.0F).tex((double)f35, (double)f38).lightmap(k1, i2).endVertex(); + worldRendererIn.pos(d0, d1, d2).color(f3, f3, f3, 1.0F).tex((double)f35, (double)f37).lightmap(k1, i2).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1, d2).color(f3, f3, f3, 1.0F).tex((double)f36, (double)f37).lightmap(k1, i2).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).color(f3, f3, f3, 1.0F).tex((double)f36, (double)f38).lightmap(k1, i2).endVertex(); + flag2 = true; + } + + for (int j1 = 0; j1 < 4; ++j1) + { + int l1 = 0; + int j2 = 0; + + if (j1 == 0) + { + --j2; + } + + if (j1 == 1) + { + ++j2; + } + + if (j1 == 2) + { + --l1; + } + + if (j1 == 3) + { + ++l1; + } + + BlockPos blockpos = blockPosIn.add(l1, 0, j2); + TextureAtlasSprite textureatlassprite1 = atextureatlassprite[1]; + worldRendererIn.setSprite(textureatlassprite1); + + if (aboolean[j1]) + { + double d3; + double d4; + float f39; + float f40; + double d5; + double d6; + + if (j1 == 0) + { + f39 = f7; + f40 = f10; + d5 = d0; + d3 = d0 + 1.0D; + d6 = d2 + (double)f11; + d4 = d2 + (double)f11; + } + else if (j1 == 1) + { + f39 = f9; + f40 = f8; + d5 = d0 + 1.0D; + d3 = d0; + d6 = d2 + 1.0D - (double)f11; + d4 = d2 + 1.0D - (double)f11; + } + else if (j1 == 2) + { + f39 = f8; + f40 = f7; + d5 = d0 + (double)f11; + d3 = d0 + (double)f11; + d6 = d2 + 1.0D; + d4 = d2; + } + else + { + f39 = f10; + f40 = f9; + d5 = d0 + 1.0D - (double)f11; + d3 = d0 + 1.0D - (double)f11; + d6 = d2; + d4 = d2 + 1.0D; + } + + flag2 = true; + float f41 = textureatlassprite1.getInterpolatedU(0.0D); + float f27 = textureatlassprite1.getInterpolatedU(8.0D); + float f28 = textureatlassprite1.getInterpolatedV((double)((1.0F - f39) * 16.0F * 0.5F)); + float f29 = textureatlassprite1.getInterpolatedV((double)((1.0F - f40) * 16.0F * 0.5F)); + float f30 = textureatlassprite1.getInterpolatedV(8.0D); + int j = blockliquid.getMixedBrightnessForBlock(blockAccess, blockpos); + int k = j >> 16 & 65535; + int l = j & 65535; + float f31 = j1 < 2 ? f5 : f6; + float f32 = f4 * f31 * f; + float f33 = f4 * f31 * f1; + float f34 = f4 * f31 * f2; + worldRendererIn.pos(d5, d1 + (double)f39, d6).color(f32, f33, f34, 1.0F).tex((double)f41, (double)f28).lightmap(k, l).endVertex(); + worldRendererIn.pos(d3, d1 + (double)f40, d4).color(f32, f33, f34, 1.0F).tex((double)f27, (double)f29).lightmap(k, l).endVertex(); + worldRendererIn.pos(d3, d1 + 0.0D, d4).color(f32, f33, f34, 1.0F).tex((double)f27, (double)f30).lightmap(k, l).endVertex(); + worldRendererIn.pos(d5, d1 + 0.0D, d6).color(f32, f33, f34, 1.0F).tex((double)f41, (double)f30).lightmap(k, l).endVertex(); + worldRendererIn.pos(d5, d1 + 0.0D, d6).color(f32, f33, f34, 1.0F).tex((double)f41, (double)f30).lightmap(k, l).endVertex(); + worldRendererIn.pos(d3, d1 + 0.0D, d4).color(f32, f33, f34, 1.0F).tex((double)f27, (double)f30).lightmap(k, l).endVertex(); + worldRendererIn.pos(d3, d1 + (double)f40, d4).color(f32, f33, f34, 1.0F).tex((double)f27, (double)f29).lightmap(k, l).endVertex(); + worldRendererIn.pos(d5, d1 + (double)f39, d6).color(f32, f33, f34, 1.0F).tex((double)f41, (double)f28).lightmap(k, l).endVertex(); + } + } + + worldRendererIn.setSprite((TextureAtlasSprite)null); + return flag2; + } + } + + private float getFluidHeight(IBlockAccess blockAccess, BlockPos blockPosIn, Material blockMaterial) + { + int i = 0; + float f = 0.0F; + + for (int j = 0; j < 4; ++j) + { + BlockPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1)); + + if (blockAccess.getBlockState(blockpos.up()).getBlock().getMaterial() == blockMaterial) + { + return 1.0F; + } + + IBlockState iblockstate = blockAccess.getBlockState(blockpos); + Material material = iblockstate.getBlock().getMaterial(); + + if (material != blockMaterial) + { + if (!material.isSolid()) + { + ++f; + ++i; + } + } + else + { + int k = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue(); + + if (k >= 8 || k == 0) + { + f += BlockLiquid.getLiquidHeightPercent(k) * 10.0F; + i += 10; + } + + f += BlockLiquid.getLiquidHeightPercent(k); + ++i; + } + } + + return 1.0F - f / (float)i; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java b/src/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java new file mode 100644 index 0000000..2556f78 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java @@ -0,0 +1,887 @@ +package net.minecraft.client.renderer; + +import java.util.BitSet; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLeavesBase; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ReportedException; +import net.minecraft.util.Vec3i; +import net.minecraft.world.IBlockAccess; +import optifine.BetterGrass; +import optifine.BetterSnow; +import optifine.Config; +import optifine.ConnectedTextures; +import optifine.CustomColors; +import optifine.NaturalTextures; +import optifine.Reflector; +import optifine.RenderEnv; +import optifine.SmartLeaves; + +public class BlockModelRenderer +{ + private static final String __OBFID = "CL_00002518"; + private static float aoLightValueOpaque = 0.2F; + + public static void updateAoLightValue() + { + aoLightValueOpaque = 1.0F - Config.getAmbientOcclusionLevel() * 0.8F; + } + + public BlockModelRenderer() + { + if (Reflector.ForgeModContainer_forgeLightPipelineEnabled.exists()) + { + Reflector.setFieldValue(Reflector.ForgeModContainer_forgeLightPipelineEnabled, Boolean.valueOf(false)); + } + } + + public boolean renderModel(IBlockAccess blockAccessIn, IBakedModel modelIn, IBlockState blockStateIn, BlockPos blockPosIn, WorldRenderer worldRendererIn) + { + Block block = blockStateIn.getBlock(); + block.setBlockBoundsBasedOnState(blockAccessIn, blockPosIn); + return this.renderModel(blockAccessIn, modelIn, blockStateIn, blockPosIn, worldRendererIn, true); + } + + public boolean renderModel(IBlockAccess blockAccessIn, IBakedModel modelIn, IBlockState blockStateIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides) + { + boolean flag = Minecraft.isAmbientOcclusionEnabled() && blockStateIn.getBlock().getLightValue() == 0 && modelIn.isAmbientOcclusion(); + + try + { + Block block = blockStateIn.getBlock(); + + if (Config.isTreesSmart() && blockStateIn.getBlock() instanceof BlockLeavesBase) + { + modelIn = SmartLeaves.getLeavesModel(modelIn); + } + + return flag ? this.renderModelAmbientOcclusion(blockAccessIn, modelIn, block, blockStateIn, blockPosIn, worldRendererIn, checkSides) : this.renderModelStandard(blockAccessIn, modelIn, block, blockStateIn, blockPosIn, worldRendererIn, checkSides); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block model"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Block model being tesselated"); + CrashReportCategory.addBlockInfo(crashreportcategory, blockPosIn, blockStateIn); + crashreportcategory.addCrashSection("Using AO", Boolean.valueOf(flag)); + throw new ReportedException(crashreport); + } + } + + public boolean renderModelAmbientOcclusion(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides) + { + return this.renderModelAmbientOcclusion(blockAccessIn, modelIn, blockIn, blockAccessIn.getBlockState(blockPosIn), blockPosIn, worldRendererIn, checkSides); + } + + public boolean renderModelAmbientOcclusion(IBlockAccess p_renderModelAmbientOcclusion_1_, IBakedModel p_renderModelAmbientOcclusion_2_, Block p_renderModelAmbientOcclusion_3_, IBlockState p_renderModelAmbientOcclusion_4_, BlockPos p_renderModelAmbientOcclusion_5_, WorldRenderer p_renderModelAmbientOcclusion_6_, boolean p_renderModelAmbientOcclusion_7_) + { + boolean flag = false; + RenderEnv renderenv = null; + + for (EnumFacing enumfacing : EnumFacing.VALUES) + { + List list = p_renderModelAmbientOcclusion_2_.getFaceQuads(enumfacing); + + if (!list.isEmpty()) + { + BlockPos blockpos = p_renderModelAmbientOcclusion_5_.offset(enumfacing); + + if (!p_renderModelAmbientOcclusion_7_ || p_renderModelAmbientOcclusion_3_.shouldSideBeRendered(p_renderModelAmbientOcclusion_1_, blockpos, enumfacing)) + { + if (renderenv == null) + { + renderenv = RenderEnv.getInstance(p_renderModelAmbientOcclusion_1_, p_renderModelAmbientOcclusion_4_, p_renderModelAmbientOcclusion_5_); + } + + if (!renderenv.isBreakingAnimation(list) && Config.isBetterGrass()) + { + list = BetterGrass.getFaceQuads(p_renderModelAmbientOcclusion_1_, p_renderModelAmbientOcclusion_3_, p_renderModelAmbientOcclusion_5_, enumfacing, list); + } + + this.renderModelAmbientOcclusionQuads(p_renderModelAmbientOcclusion_1_, p_renderModelAmbientOcclusion_3_, p_renderModelAmbientOcclusion_5_, p_renderModelAmbientOcclusion_6_, list, renderenv); + flag = true; + } + } + } + + List list1 = p_renderModelAmbientOcclusion_2_.getGeneralQuads(); + + if (list1.size() > 0) + { + if (renderenv == null) + { + renderenv = RenderEnv.getInstance(p_renderModelAmbientOcclusion_1_, p_renderModelAmbientOcclusion_4_, p_renderModelAmbientOcclusion_5_); + } + + this.renderModelAmbientOcclusionQuads(p_renderModelAmbientOcclusion_1_, p_renderModelAmbientOcclusion_3_, p_renderModelAmbientOcclusion_5_, p_renderModelAmbientOcclusion_6_, list1, renderenv); + flag = true; + } + + if (renderenv != null && Config.isBetterSnow() && !renderenv.isBreakingAnimation() && BetterSnow.shouldRender(p_renderModelAmbientOcclusion_1_, p_renderModelAmbientOcclusion_3_, p_renderModelAmbientOcclusion_4_, p_renderModelAmbientOcclusion_5_)) + { + IBakedModel ibakedmodel = BetterSnow.getModelSnowLayer(); + IBlockState iblockstate = BetterSnow.getStateSnowLayer(); + this.renderModelAmbientOcclusion(p_renderModelAmbientOcclusion_1_, ibakedmodel, iblockstate.getBlock(), iblockstate, p_renderModelAmbientOcclusion_5_, p_renderModelAmbientOcclusion_6_, true); + } + + return flag; + } + + public boolean renderModelStandard(IBlockAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides) + { + return this.renderModelStandard(blockAccessIn, modelIn, blockIn, blockAccessIn.getBlockState(blockPosIn), blockPosIn, worldRendererIn, checkSides); + } + + public boolean renderModelStandard(IBlockAccess p_renderModelStandard_1_, IBakedModel p_renderModelStandard_2_, Block p_renderModelStandard_3_, IBlockState p_renderModelStandard_4_, BlockPos p_renderModelStandard_5_, WorldRenderer p_renderModelStandard_6_, boolean p_renderModelStandard_7_) + { + boolean flag = false; + RenderEnv renderenv = null; + + for (EnumFacing enumfacing : EnumFacing.VALUES) + { + List list = p_renderModelStandard_2_.getFaceQuads(enumfacing); + + if (!list.isEmpty()) + { + BlockPos blockpos = p_renderModelStandard_5_.offset(enumfacing); + + if (!p_renderModelStandard_7_ || p_renderModelStandard_3_.shouldSideBeRendered(p_renderModelStandard_1_, blockpos, enumfacing)) + { + if (renderenv == null) + { + renderenv = RenderEnv.getInstance(p_renderModelStandard_1_, p_renderModelStandard_4_, p_renderModelStandard_5_); + } + + if (!renderenv.isBreakingAnimation(list) && Config.isBetterGrass()) + { + list = BetterGrass.getFaceQuads(p_renderModelStandard_1_, p_renderModelStandard_3_, p_renderModelStandard_5_, enumfacing, list); + } + + int i = p_renderModelStandard_3_.getMixedBrightnessForBlock(p_renderModelStandard_1_, blockpos); + this.renderModelStandardQuads(p_renderModelStandard_1_, p_renderModelStandard_3_, p_renderModelStandard_5_, enumfacing, i, false, p_renderModelStandard_6_, list, renderenv); + flag = true; + } + } + } + + List list1 = p_renderModelStandard_2_.getGeneralQuads(); + + if (list1.size() > 0) + { + if (renderenv == null) + { + renderenv = RenderEnv.getInstance(p_renderModelStandard_1_, p_renderModelStandard_4_, p_renderModelStandard_5_); + } + + this.renderModelStandardQuads(p_renderModelStandard_1_, p_renderModelStandard_3_, p_renderModelStandard_5_, (EnumFacing)null, -1, true, p_renderModelStandard_6_, list1, renderenv); + flag = true; + } + + if (renderenv != null && Config.isBetterSnow() && !renderenv.isBreakingAnimation() && BetterSnow.shouldRender(p_renderModelStandard_1_, p_renderModelStandard_3_, p_renderModelStandard_4_, p_renderModelStandard_5_) && BetterSnow.shouldRender(p_renderModelStandard_1_, p_renderModelStandard_3_, p_renderModelStandard_4_, p_renderModelStandard_5_)) + { + IBakedModel ibakedmodel = BetterSnow.getModelSnowLayer(); + IBlockState iblockstate = BetterSnow.getStateSnowLayer(); + this.renderModelStandard(p_renderModelStandard_1_, ibakedmodel, iblockstate.getBlock(), iblockstate, p_renderModelStandard_5_, p_renderModelStandard_6_, true); + } + + return flag; + } + + private void renderModelAmbientOcclusionQuads(IBlockAccess p_renderModelAmbientOcclusionQuads_1_, Block p_renderModelAmbientOcclusionQuads_2_, BlockPos p_renderModelAmbientOcclusionQuads_3_, WorldRenderer p_renderModelAmbientOcclusionQuads_4_, List p_renderModelAmbientOcclusionQuads_5_, RenderEnv p_renderModelAmbientOcclusionQuads_6_) + { + float[] afloat = p_renderModelAmbientOcclusionQuads_6_.getQuadBounds(); + BitSet bitset = p_renderModelAmbientOcclusionQuads_6_.getBoundsFlags(); + BlockModelRenderer.AmbientOcclusionFace blockmodelrenderer$ambientocclusionface = p_renderModelAmbientOcclusionQuads_6_.getAoFace(); + IBlockState iblockstate = p_renderModelAmbientOcclusionQuads_6_.getBlockState(); + double d0 = (double)p_renderModelAmbientOcclusionQuads_3_.getX(); + double d1 = (double)p_renderModelAmbientOcclusionQuads_3_.getY(); + double d2 = (double)p_renderModelAmbientOcclusionQuads_3_.getZ(); + Block.EnumOffsetType block$enumoffsettype = p_renderModelAmbientOcclusionQuads_2_.getOffsetType(); + + if (block$enumoffsettype != Block.EnumOffsetType.NONE) + { + long i = MathHelper.getPositionRandom(p_renderModelAmbientOcclusionQuads_3_); + d0 += ((double)((float)(i >> 16 & 15L) / 15.0F) - 0.5D) * 0.5D; + d2 += ((double)((float)(i >> 24 & 15L) / 15.0F) - 0.5D) * 0.5D; + + if (block$enumoffsettype == Block.EnumOffsetType.XYZ) + { + d1 += ((double)((float)(i >> 20 & 15L) / 15.0F) - 1.0D) * 0.2D; + } + } + + for (Object bakedquad0 : p_renderModelAmbientOcclusionQuads_5_) + { + BakedQuad bakedquad = (BakedQuad) bakedquad0; + + if (!p_renderModelAmbientOcclusionQuads_6_.isBreakingAnimation(bakedquad)) + { + BakedQuad bakedquad1 = bakedquad; + + if (Config.isConnectedTextures()) + { + bakedquad = ConnectedTextures.getConnectedTexture(p_renderModelAmbientOcclusionQuads_1_, iblockstate, p_renderModelAmbientOcclusionQuads_3_, bakedquad, p_renderModelAmbientOcclusionQuads_6_); + } + + if (bakedquad == bakedquad1 && Config.isNaturalTextures()) + { + bakedquad = NaturalTextures.getNaturalTexture(p_renderModelAmbientOcclusionQuads_3_, bakedquad); + } + } + + this.fillQuadBounds(p_renderModelAmbientOcclusionQuads_2_, bakedquad.getVertexData(), bakedquad.getFace(), afloat, bitset); + blockmodelrenderer$ambientocclusionface.updateVertexBrightness(p_renderModelAmbientOcclusionQuads_1_, p_renderModelAmbientOcclusionQuads_2_, p_renderModelAmbientOcclusionQuads_3_, bakedquad.getFace(), afloat, bitset); + + if (p_renderModelAmbientOcclusionQuads_4_.isMultiTexture()) + { + p_renderModelAmbientOcclusionQuads_4_.addVertexData(bakedquad.getVertexDataSingle()); + p_renderModelAmbientOcclusionQuads_4_.putSprite(bakedquad.getSprite()); + } + else + { + p_renderModelAmbientOcclusionQuads_4_.addVertexData(bakedquad.getVertexData()); + } + + p_renderModelAmbientOcclusionQuads_4_.putBrightness4(blockmodelrenderer$ambientocclusionface.vertexBrightness[0], blockmodelrenderer$ambientocclusionface.vertexBrightness[1], blockmodelrenderer$ambientocclusionface.vertexBrightness[2], blockmodelrenderer$ambientocclusionface.vertexBrightness[3]); + int k = CustomColors.getColorMultiplier(bakedquad, p_renderModelAmbientOcclusionQuads_2_, p_renderModelAmbientOcclusionQuads_1_, p_renderModelAmbientOcclusionQuads_3_, p_renderModelAmbientOcclusionQuads_6_); + + if (!bakedquad.hasTintIndex() && k == -1) + { + p_renderModelAmbientOcclusionQuads_4_.putColorMultiplier(blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[0], blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[0], blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[0], 4); + p_renderModelAmbientOcclusionQuads_4_.putColorMultiplier(blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[1], blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[1], blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[1], 3); + p_renderModelAmbientOcclusionQuads_4_.putColorMultiplier(blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[2], blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[2], blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[2], 2); + p_renderModelAmbientOcclusionQuads_4_.putColorMultiplier(blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[3], blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[3], blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[3], 1); + } + else + { + int j; + + if (k != -1) + { + j = k; + } + else + { + j = p_renderModelAmbientOcclusionQuads_2_.colorMultiplier(p_renderModelAmbientOcclusionQuads_1_, p_renderModelAmbientOcclusionQuads_3_, bakedquad.getTintIndex()); + } + + if (EntityRenderer.anaglyphEnable) + { + j = TextureUtil.anaglyphColor(j); + } + + float f = (float)(j >> 16 & 255) / 255.0F; + float f1 = (float)(j >> 8 & 255) / 255.0F; + float f2 = (float)(j & 255) / 255.0F; + p_renderModelAmbientOcclusionQuads_4_.putColorMultiplier(blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[0] * f, blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[0] * f1, blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[0] * f2, 4); + p_renderModelAmbientOcclusionQuads_4_.putColorMultiplier(blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[1] * f, blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[1] * f1, blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[1] * f2, 3); + p_renderModelAmbientOcclusionQuads_4_.putColorMultiplier(blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[2] * f, blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[2] * f1, blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[2] * f2, 2); + p_renderModelAmbientOcclusionQuads_4_.putColorMultiplier(blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[3] * f, blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[3] * f1, blockmodelrenderer$ambientocclusionface.vertexColorMultiplier[3] * f2, 1); + } + + p_renderModelAmbientOcclusionQuads_4_.putPosition(d0, d1, d2); + } + } + + private void fillQuadBounds(Block blockIn, int[] vertexData, EnumFacing facingIn, float[] quadBounds, BitSet boundsFlags) + { + float f = 32.0F; + float f1 = 32.0F; + float f2 = 32.0F; + float f3 = -32.0F; + float f4 = -32.0F; + float f5 = -32.0F; + int i = vertexData.length / 4; + + for (int j = 0; j < 4; ++j) + { + float f6 = Float.intBitsToFloat(vertexData[j * i]); + float f7 = Float.intBitsToFloat(vertexData[j * i + 1]); + float f8 = Float.intBitsToFloat(vertexData[j * i + 2]); + f = Math.min(f, f6); + f1 = Math.min(f1, f7); + f2 = Math.min(f2, f8); + f3 = Math.max(f3, f6); + f4 = Math.max(f4, f7); + f5 = Math.max(f5, f8); + } + + if (quadBounds != null) + { + quadBounds[EnumFacing.WEST.getIndex()] = f; + quadBounds[EnumFacing.EAST.getIndex()] = f3; + quadBounds[EnumFacing.DOWN.getIndex()] = f1; + quadBounds[EnumFacing.UP.getIndex()] = f4; + quadBounds[EnumFacing.NORTH.getIndex()] = f2; + quadBounds[EnumFacing.SOUTH.getIndex()] = f5; + quadBounds[EnumFacing.WEST.getIndex() + EnumFacing.VALUES.length] = 1.0F - f; + quadBounds[EnumFacing.EAST.getIndex() + EnumFacing.VALUES.length] = 1.0F - f3; + quadBounds[EnumFacing.DOWN.getIndex() + EnumFacing.VALUES.length] = 1.0F - f1; + quadBounds[EnumFacing.UP.getIndex() + EnumFacing.VALUES.length] = 1.0F - f4; + quadBounds[EnumFacing.NORTH.getIndex() + EnumFacing.VALUES.length] = 1.0F - f2; + quadBounds[EnumFacing.SOUTH.getIndex() + EnumFacing.VALUES.length] = 1.0F - f5; + } + + float f10 = 1.0E-4F; + float f9 = 0.9999F; + + switch (BlockModelRenderer.BlockModelRenderer$1.field_178290_a[facingIn.ordinal()]) + { + case 1: + boundsFlags.set(1, f >= 1.0E-4F || f2 >= 1.0E-4F || f3 <= 0.9999F || f5 <= 0.9999F); + boundsFlags.set(0, (f1 < 1.0E-4F || blockIn.isFullCube()) && f1 == f4); + break; + + case 2: + boundsFlags.set(1, f >= 1.0E-4F || f2 >= 1.0E-4F || f3 <= 0.9999F || f5 <= 0.9999F); + boundsFlags.set(0, (f4 > 0.9999F || blockIn.isFullCube()) && f1 == f4); + break; + + case 3: + boundsFlags.set(1, f >= 1.0E-4F || f1 >= 1.0E-4F || f3 <= 0.9999F || f4 <= 0.9999F); + boundsFlags.set(0, (f2 < 1.0E-4F || blockIn.isFullCube()) && f2 == f5); + break; + + case 4: + boundsFlags.set(1, f >= 1.0E-4F || f1 >= 1.0E-4F || f3 <= 0.9999F || f4 <= 0.9999F); + boundsFlags.set(0, (f5 > 0.9999F || blockIn.isFullCube()) && f2 == f5); + break; + + case 5: + boundsFlags.set(1, f1 >= 1.0E-4F || f2 >= 1.0E-4F || f4 <= 0.9999F || f5 <= 0.9999F); + boundsFlags.set(0, (f < 1.0E-4F || blockIn.isFullCube()) && f == f3); + break; + + case 6: + boundsFlags.set(1, f1 >= 1.0E-4F || f2 >= 1.0E-4F || f4 <= 0.9999F || f5 <= 0.9999F); + boundsFlags.set(0, (f3 > 0.9999F || blockIn.isFullCube()) && f == f3); + } + } + + private void renderModelStandardQuads(IBlockAccess p_renderModelStandardQuads_1_, Block p_renderModelStandardQuads_2_, BlockPos p_renderModelStandardQuads_3_, EnumFacing p_renderModelStandardQuads_4_, int p_renderModelStandardQuads_5_, boolean p_renderModelStandardQuads_6_, WorldRenderer p_renderModelStandardQuads_7_, List p_renderModelStandardQuads_8_, RenderEnv p_renderModelStandardQuads_9_) + { + BitSet bitset = p_renderModelStandardQuads_9_.getBoundsFlags(); + IBlockState iblockstate = p_renderModelStandardQuads_9_.getBlockState(); + double d0 = (double)p_renderModelStandardQuads_3_.getX(); + double d1 = (double)p_renderModelStandardQuads_3_.getY(); + double d2 = (double)p_renderModelStandardQuads_3_.getZ(); + Block.EnumOffsetType block$enumoffsettype = p_renderModelStandardQuads_2_.getOffsetType(); + + if (block$enumoffsettype != Block.EnumOffsetType.NONE) + { + int i = p_renderModelStandardQuads_3_.getX(); + int j = p_renderModelStandardQuads_3_.getZ(); + long k = (long)(i * 3129871) ^ (long)j * 116129781L; + k = k * k * 42317861L + k * 11L; + d0 += ((double)((float)(k >> 16 & 15L) / 15.0F) - 0.5D) * 0.5D; + d2 += ((double)((float)(k >> 24 & 15L) / 15.0F) - 0.5D) * 0.5D; + + if (block$enumoffsettype == Block.EnumOffsetType.XYZ) + { + d1 += ((double)((float)(k >> 20 & 15L) / 15.0F) - 1.0D) * 0.2D; + } + } + + for (Object bakedquad0 : p_renderModelStandardQuads_8_) + { + BakedQuad bakedquad = (BakedQuad) bakedquad0; + + if (!p_renderModelStandardQuads_9_.isBreakingAnimation(bakedquad)) + { + BakedQuad bakedquad1 = bakedquad; + + if (Config.isConnectedTextures()) + { + bakedquad = ConnectedTextures.getConnectedTexture(p_renderModelStandardQuads_1_, iblockstate, p_renderModelStandardQuads_3_, bakedquad, p_renderModelStandardQuads_9_); + } + + if (bakedquad == bakedquad1 && Config.isNaturalTextures()) + { + bakedquad = NaturalTextures.getNaturalTexture(p_renderModelStandardQuads_3_, bakedquad); + } + } + + if (p_renderModelStandardQuads_6_) + { + this.fillQuadBounds(p_renderModelStandardQuads_2_, bakedquad.getVertexData(), bakedquad.getFace(), (float[])null, bitset); + p_renderModelStandardQuads_5_ = bitset.get(0) ? p_renderModelStandardQuads_2_.getMixedBrightnessForBlock(p_renderModelStandardQuads_1_, p_renderModelStandardQuads_3_.offset(bakedquad.getFace())) : p_renderModelStandardQuads_2_.getMixedBrightnessForBlock(p_renderModelStandardQuads_1_, p_renderModelStandardQuads_3_); + } + + if (p_renderModelStandardQuads_7_.isMultiTexture()) + { + p_renderModelStandardQuads_7_.addVertexData(bakedquad.getVertexDataSingle()); + p_renderModelStandardQuads_7_.putSprite(bakedquad.getSprite()); + } + else + { + p_renderModelStandardQuads_7_.addVertexData(bakedquad.getVertexData()); + } + + p_renderModelStandardQuads_7_.putBrightness4(p_renderModelStandardQuads_5_, p_renderModelStandardQuads_5_, p_renderModelStandardQuads_5_, p_renderModelStandardQuads_5_); + int i1 = CustomColors.getColorMultiplier(bakedquad, p_renderModelStandardQuads_2_, p_renderModelStandardQuads_1_, p_renderModelStandardQuads_3_, p_renderModelStandardQuads_9_); + + if (bakedquad.hasTintIndex() || i1 != -1) + { + int l; + + if (i1 != -1) + { + l = i1; + } + else + { + l = p_renderModelStandardQuads_2_.colorMultiplier(p_renderModelStandardQuads_1_, p_renderModelStandardQuads_3_, bakedquad.getTintIndex()); + } + + if (EntityRenderer.anaglyphEnable) + { + l = TextureUtil.anaglyphColor(l); + } + + float f = (float)(l >> 16 & 255) / 255.0F; + float f1 = (float)(l >> 8 & 255) / 255.0F; + float f2 = (float)(l & 255) / 255.0F; + p_renderModelStandardQuads_7_.putColorMultiplier(f, f1, f2, 4); + p_renderModelStandardQuads_7_.putColorMultiplier(f, f1, f2, 3); + p_renderModelStandardQuads_7_.putColorMultiplier(f, f1, f2, 2); + p_renderModelStandardQuads_7_.putColorMultiplier(f, f1, f2, 1); + } + + p_renderModelStandardQuads_7_.putPosition(d0, d1, d2); + } + } + + public void renderModelBrightnessColor(IBakedModel bakedModel, float p_178262_2_, float p_178262_3_, float p_178262_4_, float p_178262_5_) + { + for (EnumFacing enumfacing : EnumFacing.VALUES) + { + this.renderModelBrightnessColorQuads(p_178262_2_, p_178262_3_, p_178262_4_, p_178262_5_, bakedModel.getFaceQuads(enumfacing)); + } + + this.renderModelBrightnessColorQuads(p_178262_2_, p_178262_3_, p_178262_4_, p_178262_5_, bakedModel.getGeneralQuads()); + } + + public void renderModelBrightness(IBakedModel p_178266_1_, IBlockState p_178266_2_, float p_178266_3_, boolean p_178266_4_) + { + Block block = p_178266_2_.getBlock(); + block.setBlockBoundsForItemRender(); + GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); + int i = block.getRenderColor(block.getStateForEntityRender(p_178266_2_)); + + if (EntityRenderer.anaglyphEnable) + { + i = TextureUtil.anaglyphColor(i); + } + + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; + + if (!p_178266_4_) + { + GlStateManager.color(p_178266_3_, p_178266_3_, p_178266_3_, 1.0F); + } + + this.renderModelBrightnessColor(p_178266_1_, p_178266_3_, f, f1, f2); + } + + private void renderModelBrightnessColorQuads(float p_178264_1_, float p_178264_2_, float p_178264_3_, float p_178264_4_, List p_178264_5_) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + + for (Object bakedquad0 : p_178264_5_) + { + BakedQuad bakedquad = (BakedQuad) bakedquad0; + worldrenderer.begin(7, DefaultVertexFormats.ITEM); + worldrenderer.addVertexData(bakedquad.getVertexData()); + + if (bakedquad.hasTintIndex()) + { + worldrenderer.putColorRGB_F4(p_178264_2_ * p_178264_1_, p_178264_3_ * p_178264_1_, p_178264_4_ * p_178264_1_); + } + else + { + worldrenderer.putColorRGB_F4(p_178264_1_, p_178264_1_, p_178264_1_); + } + + Vec3i vec3i = bakedquad.getFace().getDirectionVec(); + worldrenderer.putNormal((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ()); + tessellator.draw(); + } + } + + public static float fixAoLightValue(float p_fixAoLightValue_0_) + { + return p_fixAoLightValue_0_ == 0.2F ? aoLightValueOpaque : p_fixAoLightValue_0_; + } + + static final class BlockModelRenderer$1 + { + static final int[] field_178290_a = new int[EnumFacing.values().length]; + private static final String __OBFID = "CL_00002517"; + + static + { + try + { + field_178290_a[EnumFacing.DOWN.ordinal()] = 1; + } + catch (NoSuchFieldError var6) + { + ; + } + + try + { + field_178290_a[EnumFacing.UP.ordinal()] = 2; + } + catch (NoSuchFieldError var5) + { + ; + } + + try + { + field_178290_a[EnumFacing.NORTH.ordinal()] = 3; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_178290_a[EnumFacing.SOUTH.ordinal()] = 4; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_178290_a[EnumFacing.WEST.ordinal()] = 5; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_178290_a[EnumFacing.EAST.ordinal()] = 6; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } + + public static class AmbientOcclusionFace + { + private final float[] vertexColorMultiplier = new float[4]; + private final int[] vertexBrightness = new int[4]; + private static final String __OBFID = "CL_00002515"; + + public AmbientOcclusionFace(BlockModelRenderer p_i46235_1_) + { + } + + public AmbientOcclusionFace() + { + } + + public void updateVertexBrightness(IBlockAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, EnumFacing facingIn, float[] quadBounds, BitSet boundsFlags) + { + BlockPos blockpos = boundsFlags.get(0) ? blockPosIn.offset(facingIn) : blockPosIn; + BlockModelRenderer.EnumNeighborInfo blockmodelrenderer$enumneighborinfo = BlockModelRenderer.EnumNeighborInfo.getNeighbourInfo(facingIn); + BlockPos blockpos1 = blockpos.offset(blockmodelrenderer$enumneighborinfo.field_178276_g[0]); + BlockPos blockpos2 = blockpos.offset(blockmodelrenderer$enumneighborinfo.field_178276_g[1]); + BlockPos blockpos3 = blockpos.offset(blockmodelrenderer$enumneighborinfo.field_178276_g[2]); + BlockPos blockpos4 = blockpos.offset(blockmodelrenderer$enumneighborinfo.field_178276_g[3]); + int i = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos1); + int j = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos2); + int k = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos3); + int l = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos4); + float f = BlockModelRenderer.fixAoLightValue(blockAccessIn.getBlockState(blockpos1).getBlock().getAmbientOcclusionLightValue()); + float f1 = BlockModelRenderer.fixAoLightValue(blockAccessIn.getBlockState(blockpos2).getBlock().getAmbientOcclusionLightValue()); + float f2 = BlockModelRenderer.fixAoLightValue(blockAccessIn.getBlockState(blockpos3).getBlock().getAmbientOcclusionLightValue()); + float f3 = BlockModelRenderer.fixAoLightValue(blockAccessIn.getBlockState(blockpos4).getBlock().getAmbientOcclusionLightValue()); + boolean flag = blockAccessIn.getBlockState(blockpos1.offset(facingIn)).getBlock().isTranslucent(); + boolean flag1 = blockAccessIn.getBlockState(blockpos2.offset(facingIn)).getBlock().isTranslucent(); + boolean flag2 = blockAccessIn.getBlockState(blockpos3.offset(facingIn)).getBlock().isTranslucent(); + boolean flag3 = blockAccessIn.getBlockState(blockpos4.offset(facingIn)).getBlock().isTranslucent(); + float f4; + int i1; + + if (!flag2 && !flag) + { + f4 = f; + i1 = i; + } + else + { + BlockPos blockpos5 = blockpos1.offset(blockmodelrenderer$enumneighborinfo.field_178276_g[2]); + f4 = BlockModelRenderer.fixAoLightValue(blockAccessIn.getBlockState(blockpos5).getBlock().getAmbientOcclusionLightValue()); + i1 = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos5); + } + + float f5; + int j1; + + if (!flag3 && !flag) + { + f5 = f; + j1 = i; + } + else + { + BlockPos blockpos6 = blockpos1.offset(blockmodelrenderer$enumneighborinfo.field_178276_g[3]); + f5 = BlockModelRenderer.fixAoLightValue(blockAccessIn.getBlockState(blockpos6).getBlock().getAmbientOcclusionLightValue()); + j1 = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos6); + } + + float f6; + int k1; + + if (!flag2 && !flag1) + { + f6 = f1; + k1 = j; + } + else + { + BlockPos blockpos7 = blockpos2.offset(blockmodelrenderer$enumneighborinfo.field_178276_g[2]); + f6 = BlockModelRenderer.fixAoLightValue(blockAccessIn.getBlockState(blockpos7).getBlock().getAmbientOcclusionLightValue()); + k1 = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos7); + } + + float f7; + int l1; + + if (!flag3 && !flag1) + { + f7 = f1; + l1 = j; + } + else + { + BlockPos blockpos8 = blockpos2.offset(blockmodelrenderer$enumneighborinfo.field_178276_g[3]); + f7 = BlockModelRenderer.fixAoLightValue(blockAccessIn.getBlockState(blockpos8).getBlock().getAmbientOcclusionLightValue()); + l1 = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos8); + } + + int i2 = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockPosIn); + + if (boundsFlags.get(0) || !blockAccessIn.getBlockState(blockPosIn.offset(facingIn)).getBlock().isOpaqueCube()) + { + i2 = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockPosIn.offset(facingIn)); + } + + float f8 = boundsFlags.get(0) ? blockAccessIn.getBlockState(blockpos).getBlock().getAmbientOcclusionLightValue() : blockAccessIn.getBlockState(blockPosIn).getBlock().getAmbientOcclusionLightValue(); + f8 = BlockModelRenderer.fixAoLightValue(f8); + BlockModelRenderer.VertexTranslations blockmodelrenderer$vertextranslations = BlockModelRenderer.VertexTranslations.getVertexTranslations(facingIn); + + if (boundsFlags.get(1) && blockmodelrenderer$enumneighborinfo.field_178289_i) + { + float f29 = (f3 + f + f5 + f8) * 0.25F; + float f30 = (f2 + f + f4 + f8) * 0.25F; + float f31 = (f2 + f1 + f6 + f8) * 0.25F; + float f32 = (f3 + f1 + f7 + f8) * 0.25F; + float f13 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178286_j[0].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178286_j[1].field_178229_m]; + float f14 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178286_j[2].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178286_j[3].field_178229_m]; + float f15 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178286_j[4].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178286_j[5].field_178229_m]; + float f16 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178286_j[6].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178286_j[7].field_178229_m]; + float f17 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178287_k[0].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178287_k[1].field_178229_m]; + float f18 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178287_k[2].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178287_k[3].field_178229_m]; + float f19 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178287_k[4].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178287_k[5].field_178229_m]; + float f20 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178287_k[6].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178287_k[7].field_178229_m]; + float f21 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178284_l[0].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178284_l[1].field_178229_m]; + float f22 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178284_l[2].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178284_l[3].field_178229_m]; + float f23 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178284_l[4].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178284_l[5].field_178229_m]; + float f24 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178284_l[6].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178284_l[7].field_178229_m]; + float f25 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178285_m[0].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178285_m[1].field_178229_m]; + float f26 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178285_m[2].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178285_m[3].field_178229_m]; + float f27 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178285_m[4].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178285_m[5].field_178229_m]; + float f28 = quadBounds[blockmodelrenderer$enumneighborinfo.field_178285_m[6].field_178229_m] * quadBounds[blockmodelrenderer$enumneighborinfo.field_178285_m[7].field_178229_m]; + this.vertexColorMultiplier[blockmodelrenderer$vertextranslations.field_178191_g] = f29 * f13 + f30 * f14 + f31 * f15 + f32 * f16; + this.vertexColorMultiplier[blockmodelrenderer$vertextranslations.field_178200_h] = f29 * f17 + f30 * f18 + f31 * f19 + f32 * f20; + this.vertexColorMultiplier[blockmodelrenderer$vertextranslations.field_178201_i] = f29 * f21 + f30 * f22 + f31 * f23 + f32 * f24; + this.vertexColorMultiplier[blockmodelrenderer$vertextranslations.field_178198_j] = f29 * f25 + f30 * f26 + f31 * f27 + f32 * f28; + int j2 = this.getAoBrightness(l, i, j1, i2); + int k2 = this.getAoBrightness(k, i, i1, i2); + int l2 = this.getAoBrightness(k, j, k1, i2); + int i3 = this.getAoBrightness(l, j, l1, i2); + this.vertexBrightness[blockmodelrenderer$vertextranslations.field_178191_g] = this.getVertexBrightness(j2, k2, l2, i3, f13, f14, f15, f16); + this.vertexBrightness[blockmodelrenderer$vertextranslations.field_178200_h] = this.getVertexBrightness(j2, k2, l2, i3, f17, f18, f19, f20); + this.vertexBrightness[blockmodelrenderer$vertextranslations.field_178201_i] = this.getVertexBrightness(j2, k2, l2, i3, f21, f22, f23, f24); + this.vertexBrightness[blockmodelrenderer$vertextranslations.field_178198_j] = this.getVertexBrightness(j2, k2, l2, i3, f25, f26, f27, f28); + } + else + { + float f9 = (f3 + f + f5 + f8) * 0.25F; + float f10 = (f2 + f + f4 + f8) * 0.25F; + float f11 = (f2 + f1 + f6 + f8) * 0.25F; + float f12 = (f3 + f1 + f7 + f8) * 0.25F; + this.vertexBrightness[blockmodelrenderer$vertextranslations.field_178191_g] = this.getAoBrightness(l, i, j1, i2); + this.vertexBrightness[blockmodelrenderer$vertextranslations.field_178200_h] = this.getAoBrightness(k, i, i1, i2); + this.vertexBrightness[blockmodelrenderer$vertextranslations.field_178201_i] = this.getAoBrightness(k, j, k1, i2); + this.vertexBrightness[blockmodelrenderer$vertextranslations.field_178198_j] = this.getAoBrightness(l, j, l1, i2); + this.vertexColorMultiplier[blockmodelrenderer$vertextranslations.field_178191_g] = f9; + this.vertexColorMultiplier[blockmodelrenderer$vertextranslations.field_178200_h] = f10; + this.vertexColorMultiplier[blockmodelrenderer$vertextranslations.field_178201_i] = f11; + this.vertexColorMultiplier[blockmodelrenderer$vertextranslations.field_178198_j] = f12; + } + } + + private int getAoBrightness(int p_147778_1_, int p_147778_2_, int p_147778_3_, int p_147778_4_) + { + if (p_147778_1_ == 0) + { + p_147778_1_ = p_147778_4_; + } + + if (p_147778_2_ == 0) + { + p_147778_2_ = p_147778_4_; + } + + if (p_147778_3_ == 0) + { + p_147778_3_ = p_147778_4_; + } + + return p_147778_1_ + p_147778_2_ + p_147778_3_ + p_147778_4_ >> 2 & 16711935; + } + + private int getVertexBrightness(int p_178203_1_, int p_178203_2_, int p_178203_3_, int p_178203_4_, float p_178203_5_, float p_178203_6_, float p_178203_7_, float p_178203_8_) + { + int i = (int)((float)(p_178203_1_ >> 16 & 255) * p_178203_5_ + (float)(p_178203_2_ >> 16 & 255) * p_178203_6_ + (float)(p_178203_3_ >> 16 & 255) * p_178203_7_ + (float)(p_178203_4_ >> 16 & 255) * p_178203_8_) & 255; + int j = (int)((float)(p_178203_1_ & 255) * p_178203_5_ + (float)(p_178203_2_ & 255) * p_178203_6_ + (float)(p_178203_3_ & 255) * p_178203_7_ + (float)(p_178203_4_ & 255) * p_178203_8_) & 255; + return i << 16 | j; + } + } + + public static enum EnumNeighborInfo + { + DOWN("DOWN", 0, new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.5F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.SOUTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.SOUTH}), + UP("UP", 1, new EnumFacing[]{EnumFacing.EAST, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.SOUTH}, 1.0F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.SOUTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.SOUTH}), + NORTH("NORTH", 2, new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.WEST}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST}), + SOUTH("SOUTH", 3, new EnumFacing[]{EnumFacing.WEST, EnumFacing.EAST, EnumFacing.DOWN, EnumFacing.UP}, 0.8F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_WEST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.WEST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.WEST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.EAST}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_EAST, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.EAST, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.EAST}), + WEST("WEST", 4, new EnumFacing[]{EnumFacing.UP, EnumFacing.DOWN, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.6F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.SOUTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.SOUTH}), + EAST("EAST", 5, new EnumFacing[]{EnumFacing.DOWN, EnumFacing.UP, EnumFacing.NORTH, EnumFacing.SOUTH}, 0.6F, true, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.SOUTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.FLIP_DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.DOWN, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.NORTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_NORTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.NORTH}, new BlockModelRenderer.Orientation[]{BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.SOUTH, BlockModelRenderer.Orientation.FLIP_UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.FLIP_SOUTH, BlockModelRenderer.Orientation.UP, BlockModelRenderer.Orientation.SOUTH}); + + protected final EnumFacing[] field_178276_g; + protected final float field_178288_h; + protected final boolean field_178289_i; + protected final BlockModelRenderer.Orientation[] field_178286_j; + protected final BlockModelRenderer.Orientation[] field_178287_k; + protected final BlockModelRenderer.Orientation[] field_178284_l; + protected final BlockModelRenderer.Orientation[] field_178285_m; + private static final BlockModelRenderer.EnumNeighborInfo[] field_178282_n = new BlockModelRenderer.EnumNeighborInfo[6]; + private static final BlockModelRenderer.EnumNeighborInfo[] $VALUES = new BlockModelRenderer.EnumNeighborInfo[]{DOWN, UP, NORTH, SOUTH, WEST, EAST}; + private static final String __OBFID = "CL_00002516"; + + private EnumNeighborInfo(String p_i6_3_, int p_i6_4_, EnumFacing[] p_i6_5_, float p_i6_6_, boolean p_i6_7_, BlockModelRenderer.Orientation[] p_i6_8_, BlockModelRenderer.Orientation[] p_i6_9_, BlockModelRenderer.Orientation[] p_i6_10_, BlockModelRenderer.Orientation[] p_i6_11_) + { + this.field_178276_g = p_i6_5_; + this.field_178288_h = p_i6_6_; + this.field_178289_i = p_i6_7_; + this.field_178286_j = p_i6_8_; + this.field_178287_k = p_i6_9_; + this.field_178284_l = p_i6_10_; + this.field_178285_m = p_i6_11_; + } + + public static BlockModelRenderer.EnumNeighborInfo getNeighbourInfo(EnumFacing p_178273_0_) + { + return field_178282_n[p_178273_0_.getIndex()]; + } + + static { + field_178282_n[EnumFacing.DOWN.getIndex()] = DOWN; + field_178282_n[EnumFacing.UP.getIndex()] = UP; + field_178282_n[EnumFacing.NORTH.getIndex()] = NORTH; + field_178282_n[EnumFacing.SOUTH.getIndex()] = SOUTH; + field_178282_n[EnumFacing.WEST.getIndex()] = WEST; + field_178282_n[EnumFacing.EAST.getIndex()] = EAST; + } + } + + public static enum Orientation + { + DOWN("DOWN", 0, EnumFacing.DOWN, false), + UP("UP", 1, EnumFacing.UP, false), + NORTH("NORTH", 2, EnumFacing.NORTH, false), + SOUTH("SOUTH", 3, EnumFacing.SOUTH, false), + WEST("WEST", 4, EnumFacing.WEST, false), + EAST("EAST", 5, EnumFacing.EAST, false), + FLIP_DOWN("FLIP_DOWN", 6, EnumFacing.DOWN, true), + FLIP_UP("FLIP_UP", 7, EnumFacing.UP, true), + FLIP_NORTH("FLIP_NORTH", 8, EnumFacing.NORTH, true), + FLIP_SOUTH("FLIP_SOUTH", 9, EnumFacing.SOUTH, true), + FLIP_WEST("FLIP_WEST", 10, EnumFacing.WEST, true), + FLIP_EAST("FLIP_EAST", 11, EnumFacing.EAST, true); + + protected final int field_178229_m; + private static final BlockModelRenderer.Orientation[] $VALUES = new BlockModelRenderer.Orientation[]{DOWN, UP, NORTH, SOUTH, WEST, EAST, FLIP_DOWN, FLIP_UP, FLIP_NORTH, FLIP_SOUTH, FLIP_WEST, FLIP_EAST}; + private static final String __OBFID = "CL_00002513"; + + private Orientation(String p_i8_3_, int p_i8_4_, EnumFacing p_i8_5_, boolean p_i8_6_) + { + this.field_178229_m = p_i8_5_.getIndex() + (p_i8_6_ ? EnumFacing.values().length : 0); + } + } + + static enum VertexTranslations + { + DOWN("DOWN", 0, 0, 1, 2, 3), + UP("UP", 1, 2, 3, 0, 1), + NORTH("NORTH", 2, 3, 0, 1, 2), + SOUTH("SOUTH", 3, 0, 1, 2, 3), + WEST("WEST", 4, 3, 0, 1, 2), + EAST("EAST", 5, 1, 2, 3, 0); + + private final int field_178191_g; + private final int field_178200_h; + private final int field_178201_i; + private final int field_178198_j; + private static final BlockModelRenderer.VertexTranslations[] field_178199_k = new BlockModelRenderer.VertexTranslations[6]; + private static final BlockModelRenderer.VertexTranslations[] $VALUES = new BlockModelRenderer.VertexTranslations[]{DOWN, UP, NORTH, SOUTH, WEST, EAST}; + private static final String __OBFID = "CL_00002514"; + + private VertexTranslations(String p_i7_3_, int p_i7_4_, int p_i7_5_, int p_i7_6_, int p_i7_7_, int p_i7_8_) + { + this.field_178191_g = p_i7_5_; + this.field_178200_h = p_i7_6_; + this.field_178201_i = p_i7_7_; + this.field_178198_j = p_i7_8_; + } + + public static BlockModelRenderer.VertexTranslations getVertexTranslations(EnumFacing p_178184_0_) + { + return field_178199_k[p_178184_0_.getIndex()]; + } + + static { + field_178199_k[EnumFacing.DOWN.getIndex()] = DOWN; + field_178199_k[EnumFacing.UP.getIndex()] = UP; + field_178199_k[EnumFacing.NORTH.getIndex()] = NORTH; + field_178199_k[EnumFacing.SOUTH.getIndex()] = SOUTH; + field_178199_k[EnumFacing.WEST.getIndex()] = WEST; + field_178199_k[EnumFacing.EAST.getIndex()] = EAST; + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/BlockModelShapes.java b/src/minecraft/net/minecraft/client/renderer/BlockModelShapes.java new file mode 100644 index 0000000..4282594 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/BlockModelShapes.java @@ -0,0 +1,314 @@ +package net.minecraft.client.renderer; + +import com.google.common.collect.Maps; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.BlockCactus; +import net.minecraft.block.BlockColored; +import net.minecraft.block.BlockCommandBlock; +import net.minecraft.block.BlockDirt; +import net.minecraft.block.BlockDispenser; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.block.BlockDropper; +import net.minecraft.block.BlockFenceGate; +import net.minecraft.block.BlockFire; +import net.minecraft.block.BlockFlowerPot; +import net.minecraft.block.BlockHopper; +import net.minecraft.block.BlockJukebox; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockNewLeaf; +import net.minecraft.block.BlockNewLog; +import net.minecraft.block.BlockOldLeaf; +import net.minecraft.block.BlockOldLog; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.BlockPrismarine; +import net.minecraft.block.BlockQuartz; +import net.minecraft.block.BlockRedSandstone; +import net.minecraft.block.BlockRedstoneWire; +import net.minecraft.block.BlockReed; +import net.minecraft.block.BlockSand; +import net.minecraft.block.BlockSandStone; +import net.minecraft.block.BlockSapling; +import net.minecraft.block.BlockSilverfish; +import net.minecraft.block.BlockStem; +import net.minecraft.block.BlockStone; +import net.minecraft.block.BlockStoneBrick; +import net.minecraft.block.BlockStoneSlab; +import net.minecraft.block.BlockStoneSlabNew; +import net.minecraft.block.BlockTNT; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.BlockTripWire; +import net.minecraft.block.BlockWall; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.statemap.BlockStateMapper; +import net.minecraft.client.renderer.block.statemap.IStateMapper; +import net.minecraft.client.renderer.block.statemap.StateMap; +import net.minecraft.client.renderer.block.statemap.StateMapperBase; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.init.Blocks; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; + +public class BlockModelShapes +{ + private final Map bakedModelStore = Maps.newIdentityHashMap(); + private final BlockStateMapper blockStateMapper = new BlockStateMapper(); + private final ModelManager modelManager; + + public BlockModelShapes(ModelManager manager) + { + this.modelManager = manager; + this.registerAllBlocks(); + } + + public BlockStateMapper getBlockStateMapper() + { + return this.blockStateMapper; + } + + public TextureAtlasSprite getTexture(IBlockState state) + { + Block block = state.getBlock(); + IBakedModel ibakedmodel = this.getModelForState(state); + + if (ibakedmodel == null || ibakedmodel == this.modelManager.getMissingModel()) + { + if (block == Blocks.wall_sign || block == Blocks.standing_sign || block == Blocks.chest || block == Blocks.trapped_chest || block == Blocks.standing_banner || block == Blocks.wall_banner) + { + return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/planks_oak"); + } + + if (block == Blocks.ender_chest) + { + return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/obsidian"); + } + + if (block == Blocks.flowing_lava || block == Blocks.lava) + { + return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/lava_still"); + } + + if (block == Blocks.flowing_water || block == Blocks.water) + { + return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/water_still"); + } + + if (block == Blocks.skull) + { + return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/soul_sand"); + } + + if (block == Blocks.barrier) + { + return this.modelManager.getTextureMap().getAtlasSprite("minecraft:items/barrier"); + } + } + + if (ibakedmodel == null) + { + ibakedmodel = this.modelManager.getMissingModel(); + } + + return ibakedmodel.getParticleTexture(); + } + + public IBakedModel getModelForState(IBlockState state) + { + IBakedModel ibakedmodel = (IBakedModel)this.bakedModelStore.get(state); + + if (ibakedmodel == null) + { + ibakedmodel = this.modelManager.getMissingModel(); + } + + return ibakedmodel; + } + + public ModelManager getModelManager() + { + return this.modelManager; + } + + public void reloadModels() + { + this.bakedModelStore.clear(); + + for (Entry entry : this.blockStateMapper.putAllStateModelLocations().entrySet()) + { + this.bakedModelStore.put(entry.getKey(), this.modelManager.getModel((ModelResourceLocation)entry.getValue())); + } + } + + public void registerBlockWithStateMapper(Block assoc, IStateMapper stateMapper) + { + this.blockStateMapper.registerBlockStateMapper(assoc, stateMapper); + } + + public void registerBuiltInBlocks(Block... builtIns) + { + this.blockStateMapper.registerBuiltInBlocks(builtIns); + } + + private void registerAllBlocks() + { + this.registerBuiltInBlocks(new Block[] {Blocks.air, Blocks.flowing_water, Blocks.water, Blocks.flowing_lava, Blocks.lava, Blocks.piston_extension, Blocks.chest, Blocks.ender_chest, Blocks.trapped_chest, Blocks.standing_sign, Blocks.skull, Blocks.end_portal, Blocks.barrier, Blocks.wall_sign, Blocks.wall_banner, Blocks.standing_banner}); + this.registerBlockWithStateMapper(Blocks.stone, (new StateMap.Builder()).withName(BlockStone.VARIANT).build()); + this.registerBlockWithStateMapper(Blocks.prismarine, (new StateMap.Builder()).withName(BlockPrismarine.VARIANT).build()); + this.registerBlockWithStateMapper(Blocks.leaves, (new StateMap.Builder()).withName(BlockOldLeaf.VARIANT).withSuffix("_leaves").ignore(new IProperty[] {BlockLeaves.CHECK_DECAY, BlockLeaves.DECAYABLE}).build()); + this.registerBlockWithStateMapper(Blocks.leaves2, (new StateMap.Builder()).withName(BlockNewLeaf.VARIANT).withSuffix("_leaves").ignore(new IProperty[] {BlockLeaves.CHECK_DECAY, BlockLeaves.DECAYABLE}).build()); + this.registerBlockWithStateMapper(Blocks.cactus, (new StateMap.Builder()).ignore(new IProperty[] {BlockCactus.AGE}).build()); + this.registerBlockWithStateMapper(Blocks.reeds, (new StateMap.Builder()).ignore(new IProperty[] {BlockReed.AGE}).build()); + this.registerBlockWithStateMapper(Blocks.jukebox, (new StateMap.Builder()).ignore(new IProperty[] {BlockJukebox.HAS_RECORD}).build()); + this.registerBlockWithStateMapper(Blocks.command_block, (new StateMap.Builder()).ignore(new IProperty[] {BlockCommandBlock.TRIGGERED}).build()); + this.registerBlockWithStateMapper(Blocks.cobblestone_wall, (new StateMap.Builder()).withName(BlockWall.VARIANT).withSuffix("_wall").build()); + this.registerBlockWithStateMapper(Blocks.double_plant, (new StateMap.Builder()).withName(BlockDoublePlant.VARIANT).ignore(new IProperty[] {BlockDoublePlant.field_181084_N}).build()); + this.registerBlockWithStateMapper(Blocks.oak_fence_gate, (new StateMap.Builder()).ignore(new IProperty[] {BlockFenceGate.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.spruce_fence_gate, (new StateMap.Builder()).ignore(new IProperty[] {BlockFenceGate.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.birch_fence_gate, (new StateMap.Builder()).ignore(new IProperty[] {BlockFenceGate.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.jungle_fence_gate, (new StateMap.Builder()).ignore(new IProperty[] {BlockFenceGate.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.dark_oak_fence_gate, (new StateMap.Builder()).ignore(new IProperty[] {BlockFenceGate.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.acacia_fence_gate, (new StateMap.Builder()).ignore(new IProperty[] {BlockFenceGate.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.tripwire, (new StateMap.Builder()).ignore(new IProperty[] {BlockTripWire.DISARMED, BlockTripWire.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.double_wooden_slab, (new StateMap.Builder()).withName(BlockPlanks.VARIANT).withSuffix("_double_slab").build()); + this.registerBlockWithStateMapper(Blocks.wooden_slab, (new StateMap.Builder()).withName(BlockPlanks.VARIANT).withSuffix("_slab").build()); + this.registerBlockWithStateMapper(Blocks.tnt, (new StateMap.Builder()).ignore(new IProperty[] {BlockTNT.EXPLODE}).build()); + this.registerBlockWithStateMapper(Blocks.fire, (new StateMap.Builder()).ignore(new IProperty[] {BlockFire.AGE}).build()); + this.registerBlockWithStateMapper(Blocks.redstone_wire, (new StateMap.Builder()).ignore(new IProperty[] {BlockRedstoneWire.POWER}).build()); + this.registerBlockWithStateMapper(Blocks.oak_door, (new StateMap.Builder()).ignore(new IProperty[] {BlockDoor.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.spruce_door, (new StateMap.Builder()).ignore(new IProperty[] {BlockDoor.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.birch_door, (new StateMap.Builder()).ignore(new IProperty[] {BlockDoor.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.jungle_door, (new StateMap.Builder()).ignore(new IProperty[] {BlockDoor.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.acacia_door, (new StateMap.Builder()).ignore(new IProperty[] {BlockDoor.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.dark_oak_door, (new StateMap.Builder()).ignore(new IProperty[] {BlockDoor.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.iron_door, (new StateMap.Builder()).ignore(new IProperty[] {BlockDoor.POWERED}).build()); + this.registerBlockWithStateMapper(Blocks.wool, (new StateMap.Builder()).withName(BlockColored.COLOR).withSuffix("_wool").build()); + this.registerBlockWithStateMapper(Blocks.carpet, (new StateMap.Builder()).withName(BlockColored.COLOR).withSuffix("_carpet").build()); + this.registerBlockWithStateMapper(Blocks.stained_hardened_clay, (new StateMap.Builder()).withName(BlockColored.COLOR).withSuffix("_stained_hardened_clay").build()); + this.registerBlockWithStateMapper(Blocks.stained_glass_pane, (new StateMap.Builder()).withName(BlockColored.COLOR).withSuffix("_stained_glass_pane").build()); + this.registerBlockWithStateMapper(Blocks.stained_glass, (new StateMap.Builder()).withName(BlockColored.COLOR).withSuffix("_stained_glass").build()); + this.registerBlockWithStateMapper(Blocks.sandstone, (new StateMap.Builder()).withName(BlockSandStone.TYPE).build()); + this.registerBlockWithStateMapper(Blocks.red_sandstone, (new StateMap.Builder()).withName(BlockRedSandstone.TYPE).build()); + this.registerBlockWithStateMapper(Blocks.tallgrass, (new StateMap.Builder()).withName(BlockTallGrass.TYPE).build()); + this.registerBlockWithStateMapper(Blocks.bed, (new StateMap.Builder()).ignore(new IProperty[] {BlockBed.OCCUPIED}).build()); + this.registerBlockWithStateMapper(Blocks.yellow_flower, (new StateMap.Builder()).withName(Blocks.yellow_flower.getTypeProperty()).build()); + this.registerBlockWithStateMapper(Blocks.red_flower, (new StateMap.Builder()).withName(Blocks.red_flower.getTypeProperty()).build()); + this.registerBlockWithStateMapper(Blocks.stone_slab, (new StateMap.Builder()).withName(BlockStoneSlab.VARIANT).withSuffix("_slab").build()); + this.registerBlockWithStateMapper(Blocks.stone_slab2, (new StateMap.Builder()).withName(BlockStoneSlabNew.VARIANT).withSuffix("_slab").build()); + this.registerBlockWithStateMapper(Blocks.monster_egg, (new StateMap.Builder()).withName(BlockSilverfish.VARIANT).withSuffix("_monster_egg").build()); + this.registerBlockWithStateMapper(Blocks.stonebrick, (new StateMap.Builder()).withName(BlockStoneBrick.VARIANT).build()); + this.registerBlockWithStateMapper(Blocks.dispenser, (new StateMap.Builder()).ignore(new IProperty[] {BlockDispenser.TRIGGERED}).build()); + this.registerBlockWithStateMapper(Blocks.dropper, (new StateMap.Builder()).ignore(new IProperty[] {BlockDropper.TRIGGERED}).build()); + this.registerBlockWithStateMapper(Blocks.log, (new StateMap.Builder()).withName(BlockOldLog.VARIANT).withSuffix("_log").build()); + this.registerBlockWithStateMapper(Blocks.log2, (new StateMap.Builder()).withName(BlockNewLog.VARIANT).withSuffix("_log").build()); + this.registerBlockWithStateMapper(Blocks.planks, (new StateMap.Builder()).withName(BlockPlanks.VARIANT).withSuffix("_planks").build()); + this.registerBlockWithStateMapper(Blocks.sapling, (new StateMap.Builder()).withName(BlockSapling.TYPE).withSuffix("_sapling").build()); + this.registerBlockWithStateMapper(Blocks.sand, (new StateMap.Builder()).withName(BlockSand.VARIANT).build()); + this.registerBlockWithStateMapper(Blocks.hopper, (new StateMap.Builder()).ignore(new IProperty[] {BlockHopper.ENABLED}).build()); + this.registerBlockWithStateMapper(Blocks.flower_pot, (new StateMap.Builder()).ignore(new IProperty[] {BlockFlowerPot.LEGACY_DATA}).build()); + this.registerBlockWithStateMapper(Blocks.quartz_block, new StateMapperBase() + { + protected ModelResourceLocation getModelResourceLocation(IBlockState state) + { + BlockQuartz.EnumType blockquartz$enumtype = (BlockQuartz.EnumType)state.getValue(BlockQuartz.VARIANT); + + switch (blockquartz$enumtype) + { + case DEFAULT: + default: + return new ModelResourceLocation("quartz_block", "normal"); + + case CHISELED: + return new ModelResourceLocation("chiseled_quartz_block", "normal"); + + case LINES_Y: + return new ModelResourceLocation("quartz_column", "axis=y"); + + case LINES_X: + return new ModelResourceLocation("quartz_column", "axis=x"); + + case LINES_Z: + return new ModelResourceLocation("quartz_column", "axis=z"); + } + } + }); + this.registerBlockWithStateMapper(Blocks.deadbush, new StateMapperBase() + { + protected ModelResourceLocation getModelResourceLocation(IBlockState state) + { + return new ModelResourceLocation("dead_bush", "normal"); + } + }); + this.registerBlockWithStateMapper(Blocks.pumpkin_stem, new StateMapperBase() + { + protected ModelResourceLocation getModelResourceLocation(IBlockState state) + { + Map map = Maps.newLinkedHashMap(state.getProperties()); + + if (state.getValue(BlockStem.FACING) != EnumFacing.UP) + { + map.remove(BlockStem.AGE); + } + + return new ModelResourceLocation((ResourceLocation)Block.blockRegistry.getNameForObject(state.getBlock()), this.getPropertyString(map)); + } + }); + this.registerBlockWithStateMapper(Blocks.melon_stem, new StateMapperBase() + { + protected ModelResourceLocation getModelResourceLocation(IBlockState state) + { + Map map = Maps.newLinkedHashMap(state.getProperties()); + + if (state.getValue(BlockStem.FACING) != EnumFacing.UP) + { + map.remove(BlockStem.AGE); + } + + return new ModelResourceLocation((ResourceLocation)Block.blockRegistry.getNameForObject(state.getBlock()), this.getPropertyString(map)); + } + }); + this.registerBlockWithStateMapper(Blocks.dirt, new StateMapperBase() + { + protected ModelResourceLocation getModelResourceLocation(IBlockState state) + { + Map map = Maps.newLinkedHashMap(state.getProperties()); + String s = BlockDirt.VARIANT.getName((BlockDirt.DirtType)map.remove(BlockDirt.VARIANT)); + + if (BlockDirt.DirtType.PODZOL != state.getValue(BlockDirt.VARIANT)) + { + map.remove(BlockDirt.SNOWY); + } + + return new ModelResourceLocation(s, this.getPropertyString(map)); + } + }); + this.registerBlockWithStateMapper(Blocks.double_stone_slab, new StateMapperBase() + { + protected ModelResourceLocation getModelResourceLocation(IBlockState state) + { + Map map = Maps.newLinkedHashMap(state.getProperties()); + String s = BlockStoneSlab.VARIANT.getName((BlockStoneSlab.EnumType)map.remove(BlockStoneSlab.VARIANT)); + map.remove(BlockStoneSlab.SEAMLESS); + String s1 = ((Boolean)state.getValue(BlockStoneSlab.SEAMLESS)).booleanValue() ? "all" : "normal"; + return new ModelResourceLocation(s + "_double_slab", s1); + } + }); + this.registerBlockWithStateMapper(Blocks.double_stone_slab2, new StateMapperBase() + { + protected ModelResourceLocation getModelResourceLocation(IBlockState state) + { + Map map = Maps.newLinkedHashMap(state.getProperties()); + String s = BlockStoneSlabNew.VARIANT.getName((BlockStoneSlabNew.EnumType)map.remove(BlockStoneSlabNew.VARIANT)); + map.remove(BlockStoneSlab.SEAMLESS); + String s1 = ((Boolean)state.getValue(BlockStoneSlabNew.SEAMLESS)).booleanValue() ? "all" : "normal"; + return new ModelResourceLocation(s + "_double_slab", s1); + } + }); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java b/src/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java new file mode 100644 index 0000000..db9d6fc --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java @@ -0,0 +1,229 @@ +package net.minecraft.client.renderer; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.SimpleBakedModel; +import net.minecraft.client.resources.model.WeightedBakedModel; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ReportedException; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.WorldType; +import optifine.Config; +import optifine.Reflector; +import shadersmod.client.SVertexBuilder; + +public class BlockRendererDispatcher implements IResourceManagerReloadListener +{ + private BlockModelShapes blockModelShapes; + private final GameSettings gameSettings; + private final BlockModelRenderer blockModelRenderer = new BlockModelRenderer(); + private final ChestRenderer chestRenderer = new ChestRenderer(); + private final BlockFluidRenderer fluidRenderer = new BlockFluidRenderer(); + private static final String __OBFID = "CL_00002520"; + + public BlockRendererDispatcher(BlockModelShapes blockModelShapesIn, GameSettings gameSettingsIn) + { + this.blockModelShapes = blockModelShapesIn; + this.gameSettings = gameSettingsIn; + } + + public BlockModelShapes getBlockModelShapes() + { + return this.blockModelShapes; + } + + public void renderBlockDamage(IBlockState state, BlockPos pos, TextureAtlasSprite texture, IBlockAccess blockAccess) + { + Block block = state.getBlock(); + int i = block.getRenderType(); + + if (i == 3) + { + state = block.getActualState(state, blockAccess, pos); + IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state); + + if (Reflector.ISmartBlockModel.isInstance(ibakedmodel)) + { + IBlockState iblockstate = (IBlockState)Reflector.call(block, Reflector.ForgeBlock_getExtendedState, new Object[] {state, blockAccess, pos}); + + for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values()) + { + if (Reflector.callBoolean(block, Reflector.ForgeBlock_canRenderInLayer, new Object[] {enumworldblocklayer})) + { + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderLayer, new Object[] {enumworldblocklayer}); + IBakedModel ibakedmodel2 = (IBakedModel)Reflector.call(ibakedmodel, Reflector.ISmartBlockModel_handleBlockState, new Object[] {iblockstate}); + IBakedModel ibakedmodel3 = (new SimpleBakedModel.Builder(ibakedmodel2, texture)).makeBakedModel(); + this.blockModelRenderer.renderModel(blockAccess, ibakedmodel3, state, pos, Tessellator.getInstance().getWorldRenderer()); + } + } + + return; + } + + IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, texture)).makeBakedModel(); + this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getWorldRenderer()); + } + } + + public boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, WorldRenderer worldRendererIn) + { + try + { + int i = state.getBlock().getRenderType(); + + if (i == -1) + { + return false; + } + else + { + switch (i) + { + case 1: + if (Config.isShaders()) + { + SVertexBuilder.pushEntity(state, pos, blockAccess, worldRendererIn); + } + + boolean flag1 = this.fluidRenderer.renderFluid(blockAccess, state, pos, worldRendererIn); + + if (Config.isShaders()) + { + SVertexBuilder.popEntity(worldRendererIn); + } + + return flag1; + + case 2: + return false; + + case 3: + IBakedModel ibakedmodel = this.getModelFromBlockState(state, blockAccess, pos); + + if (Config.isShaders()) + { + SVertexBuilder.pushEntity(state, pos, blockAccess, worldRendererIn); + } + + boolean flag = this.blockModelRenderer.renderModel(blockAccess, ibakedmodel, state, pos, worldRendererIn); + + if (Config.isShaders()) + { + SVertexBuilder.popEntity(worldRendererIn); + } + + return flag; + + default: + return false; + } + } + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block in world"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tesselated"); + CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state)); + throw new ReportedException(crashreport); + } + } + + public BlockModelRenderer getBlockModelRenderer() + { + return this.blockModelRenderer; + } + + private IBakedModel getBakedModel(IBlockState state, BlockPos pos) + { + IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state); + + if (pos != null && this.gameSettings.allowBlockAlternatives && ibakedmodel instanceof WeightedBakedModel) + { + ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(pos)); + } + + return ibakedmodel; + } + + public IBakedModel getModelFromBlockState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + Block block = state.getBlock(); + + if (worldIn.getWorldType() != WorldType.DEBUG_WORLD) + { + try + { + state = block.getActualState(state, worldIn, pos); + } + catch (Exception var7) + { + ; + } + } + + IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state); + + if (pos != null && this.gameSettings.allowBlockAlternatives && ibakedmodel instanceof WeightedBakedModel) + { + ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(pos)); + } + + if (Reflector.ISmartBlockModel.isInstance(ibakedmodel)) + { + IBlockState iblockstate = (IBlockState)Reflector.call(block, Reflector.ForgeBlock_getExtendedState, new Object[] {state, worldIn, pos}); + ibakedmodel = (IBakedModel)Reflector.call(ibakedmodel, Reflector.ISmartBlockModel_handleBlockState, new Object[] {iblockstate}); + } + + return ibakedmodel; + } + + public void renderBlockBrightness(IBlockState state, float brightness) + { + int i = state.getBlock().getRenderType(); + + if (i != -1) + { + switch (i) + { + case 1: + default: + break; + + case 2: + this.chestRenderer.renderChestBrightness(state.getBlock(), brightness); + break; + + case 3: + IBakedModel ibakedmodel = this.getBakedModel(state, (BlockPos)null); + this.blockModelRenderer.renderModelBrightness(ibakedmodel, state, brightness, true); + } + } + } + + public boolean isRenderTypeChest(Block p_175021_1_, int p_175021_2_) + { + if (p_175021_1_ == null) + { + return false; + } + else + { + int i = p_175021_1_.getRenderType(); + return i == 3 ? false : i == 2; + } + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + this.fluidRenderer.initAtlasSprites(); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/ChestRenderer.java b/src/minecraft/net/minecraft/client/renderer/ChestRenderer.java new file mode 100644 index 0000000..79d00cb --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/ChestRenderer.java @@ -0,0 +1,15 @@ +package net.minecraft.client.renderer; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer; +import net.minecraft.item.ItemStack; + +public class ChestRenderer +{ + public void renderChestBrightness(Block p_178175_1_, float color) + { + GlStateManager.color(color, color, color, 1.0F); + GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); + TileEntityItemStackRenderer.instance.renderByItem(new ItemStack(p_178175_1_)); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/ChunkRenderContainer.java b/src/minecraft/net/minecraft/client/renderer/ChunkRenderContainer.java new file mode 100644 index 0000000..250b735 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/ChunkRenderContainer.java @@ -0,0 +1,38 @@ +package net.minecraft.client.renderer; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; + +public abstract class ChunkRenderContainer +{ + private double viewEntityX; + private double viewEntityY; + private double viewEntityZ; + protected List renderChunks = Lists.newArrayListWithCapacity(17424); + protected boolean initialized; + + public void initialize(double viewEntityXIn, double viewEntityYIn, double viewEntityZIn) + { + this.initialized = true; + this.renderChunks.clear(); + this.viewEntityX = viewEntityXIn; + this.viewEntityY = viewEntityYIn; + this.viewEntityZ = viewEntityZIn; + } + + public void preRenderChunk(RenderChunk renderChunkIn) + { + BlockPos blockpos = renderChunkIn.getPosition(); + GlStateManager.translate((float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ)); + } + + public void addRenderChunk(RenderChunk renderChunkIn, EnumWorldBlockLayer layer) + { + this.renderChunks.add(renderChunkIn); + } + + public abstract void renderChunkLayer(EnumWorldBlockLayer layer); +} diff --git a/src/minecraft/net/minecraft/client/renderer/DestroyBlockProgress.java b/src/minecraft/net/minecraft/client/renderer/DestroyBlockProgress.java new file mode 100644 index 0000000..b13a5ad --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/DestroyBlockProgress.java @@ -0,0 +1,69 @@ +package net.minecraft.client.renderer; + +import net.minecraft.util.BlockPos; + +public class DestroyBlockProgress +{ + /** + * entity ID of the player associated with this partially destroyed Block. Used to identify the Blocks in the client + * Renderer, max 1 per player on a server + */ + private final int miningPlayerEntId; + private final BlockPos position; + + /** + * damage ranges from 1 to 10. -1 causes the client to delete the partial block renderer. + */ + private int partialBlockProgress; + + /** + * keeps track of how many ticks this PartiallyDestroyedBlock already exists + */ + private int createdAtCloudUpdateTick; + + public DestroyBlockProgress(int miningPlayerEntIdIn, BlockPos positionIn) + { + this.miningPlayerEntId = miningPlayerEntIdIn; + this.position = positionIn; + } + + public BlockPos getPosition() + { + return this.position; + } + + /** + * inserts damage value into this partially destroyed Block. -1 causes client renderer to delete it, otherwise + * ranges from 1 to 10 + */ + public void setPartialBlockDamage(int damage) + { + if (damage > 10) + { + damage = 10; + } + + this.partialBlockProgress = damage; + } + + public int getPartialBlockDamage() + { + return this.partialBlockProgress; + } + + /** + * saves the current Cloud update tick into the PartiallyDestroyedBlock + */ + public void setCloudUpdateTick(int createdAtCloudUpdateTickIn) + { + this.createdAtCloudUpdateTick = createdAtCloudUpdateTickIn; + } + + /** + * retrieves the 'date' at which the PartiallyDestroyedBlock was created + */ + public int getCreationCloudUpdateTick() + { + return this.createdAtCloudUpdateTick; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/EntityRendere# b/src/minecraft/net/minecraft/client/renderer/EntityRendere# new file mode 100644 index 0000000..d45a248 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/EntityRendere# @@ -0,0 +1,17 @@ +*************** +*** 326,332 **** + flag = true; + } + +- d0 = d0; + } + + if(this.field_78531_r.field_71476_x != null) { +--- 326,332 ---- + flag = true; + } + ++ // d0 = d0; + } + + if(this.field_78531_r.field_71476_x != null) { diff --git a/src/minecraft/net/minecraft/client/renderer/EntityRenderer.java b/src/minecraft/net/minecraft/client/renderer/EntityRenderer.java new file mode 100644 index 0000000..668099a --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/EntityRenderer.java @@ -0,0 +1,2945 @@ +package net.minecraft.client.renderer; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.nio.FloatBuffer; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Random; +import java.util.concurrent.Callable; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.util.glu.GLU; +import org.lwjgl.util.glu.Project; + +import com.google.common.base.Predicates; +import com.google.gson.JsonSyntaxException; + +import animeware.cosmetic.Booleans; +import animeware.gui.mainmenu.MainMenu; +import animeware.hud.mod.HudManager; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.gui.GuiDownloadTerrain; +import net.minecraft.client.gui.MapItemRenderer; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.particle.EffectRenderer; +import net.minecraft.client.renderer.culling.ClippingHelperImpl; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.shader.ShaderGroup; +import net.minecraft.client.shader.ShaderLinkHelper; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.BossStatus; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.server.integrated.IntegratedServer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MouseFilter; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.biome.BiomeGenBase; +import optifine.Config; +import optifine.CustomColors; +import optifine.Lagometer; +import optifine.RandomMobs; +import optifine.Reflector; +import optifine.ReflectorForge; +import optifine.TextureUtils; +import shadersmod.client.Shaders; +import shadersmod.client.ShadersRender; + +public class EntityRenderer implements IResourceManagerReloadListener +{ + private static final Logger logger = LogManager.getLogger(); + private static final ResourceLocation locationRainPng = new ResourceLocation("textures/environment/rain.png"); + private static final ResourceLocation locationSnowPng = new ResourceLocation("textures/environment/snow.png"); + public static boolean anaglyphEnable; + + /** Anaglyph field (0=R, 1=GB) */ + public static int anaglyphField; + + /** A reference to the Minecraft object. */ + private Minecraft mc; + private final IResourceManager resourceManager; + private Random random = new Random(); + private float farPlaneDistance; + public ItemRenderer itemRenderer; + private final MapItemRenderer theMapItemRenderer; + + /** Entity renderer update count */ + private int rendererUpdateCount; + + /** Pointed entity */ + private Entity pointedEntity; + private MouseFilter mouseFilterXAxis = new MouseFilter(); + private MouseFilter mouseFilterYAxis = new MouseFilter(); + private float thirdPersonDistance = 4.0F; + + /** Third person distance temp */ + private float thirdPersonDistanceTemp = 4.0F; + + /** Smooth cam yaw */ + private float smoothCamYaw; + + /** Smooth cam pitch */ + private float smoothCamPitch; + + /** Smooth cam filter X */ + private float smoothCamFilterX; + + /** Smooth cam filter Y */ + private float smoothCamFilterY; + + /** Smooth cam partial ticks */ + private float smoothCamPartialTicks; + + /** FOV modifier hand */ + private float fovModifierHand; + + /** FOV modifier hand prev */ + private float fovModifierHandPrev; + private float bossColorModifier; + private float bossColorModifierPrev; + + /** Cloud fog mode */ + private boolean cloudFog; + private boolean renderHand = true; + private boolean drawBlockOutline = true; + + /** Previous frame time in milliseconds */ + private long prevFrameTime = Minecraft.getSystemTime(); + + /** End time of last render (ns) */ + private long renderEndNanoTime; + + /** + * The texture id of the blocklight/skylight texture used for lighting effects + */ + private final DynamicTexture lightmapTexture; + + /** + * Colors computed in updateLightmap() and loaded into the lightmap emptyTexture + */ + private final int[] lightmapColors; + private final ResourceLocation locationLightMap; + + /** + * Is set, updateCameraAndRender() calls updateLightmap(); set by updateTorchFlicker() + */ + private boolean lightmapUpdateNeeded; + + /** Torch flicker X */ + private float torchFlickerX; + private float torchFlickerDX; + + /** Rain sound counter */ + private int rainSoundCounter; + private float[] rainXCoords = new float[1024]; + private float[] rainYCoords = new float[1024]; + + /** Fog color buffer */ + private FloatBuffer fogColorBuffer = GLAllocation.createDirectFloatBuffer(16); + public float fogColorRed; + public float fogColorGreen; + public float fogColorBlue; + + /** Fog color 2 */ + private float fogColor2; + + /** Fog color 1 */ + private float fogColor1; + private int debugViewDirection = 0; + private boolean debugView = false; + private double cameraZoom = 1.0D; + private double cameraYaw; + private double cameraPitch; + private ShaderGroup theShaderGroup; + private static final ResourceLocation[] shaderResourceLocations = new ResourceLocation[] {new ResourceLocation("shaders/post/notch.json"), new ResourceLocation("shaders/post/fxaa.json"), new ResourceLocation("shaders/post/art.json"), new ResourceLocation("shaders/post/bumpy.json"), new ResourceLocation("shaders/post/blobs2.json"), new ResourceLocation("shaders/post/pencil.json"), new ResourceLocation("shaders/post/color_convolve.json"), new ResourceLocation("shaders/post/deconverge.json"), new ResourceLocation("shaders/post/flip.json"), new ResourceLocation("shaders/post/invert.json"), new ResourceLocation("shaders/post/ntsc.json"), new ResourceLocation("shaders/post/outline.json"), new ResourceLocation("shaders/post/phosphor.json"), new ResourceLocation("shaders/post/scan_pincushion.json"), new ResourceLocation("shaders/post/sobel.json"), new ResourceLocation("shaders/post/bits.json"), new ResourceLocation("shaders/post/desaturate.json"), new ResourceLocation("shaders/post/green.json"), new ResourceLocation("shaders/post/blur.json"), new ResourceLocation("shaders/post/wobble.json"), new ResourceLocation("shaders/post/blobs.json"), new ResourceLocation("shaders/post/antialias.json"), new ResourceLocation("shaders/post/creeper.json"), new ResourceLocation("shaders/post/spider.json")}; + public static final int shaderCount = shaderResourceLocations.length; + private int shaderIndex; + private boolean useShader; + public int frameCount; + private static final String __OBFID = "CL_00000947"; + private boolean initialized = false; + private World updatedWorld = null; + private boolean showDebugInfo = false; + public boolean fogStandard = false; + private float clipDistance = 128.0F; + private long lastServerTime = 0L; + private int lastServerTicks = 0; + private int serverWaitTime = 0; + private int serverWaitTimeCurrent = 0; + private float avgServerTimeDiff = 0.0F; + private float avgServerTickDiff = 0.0F; + private long lastErrorCheckTimeMs = 0L; + private ShaderGroup[] fxaaShaders = new ShaderGroup[10]; + + public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn) + { + this.shaderIndex = shaderCount; + this.useShader = false; + this.frameCount = 0; + this.mc = mcIn; + this.resourceManager = resourceManagerIn; + this.itemRenderer = mcIn.getItemRenderer(); + this.theMapItemRenderer = new MapItemRenderer(mcIn.getTextureManager()); + this.lightmapTexture = new DynamicTexture(16, 16); + this.locationLightMap = mcIn.getTextureManager().getDynamicTextureLocation("lightMap", this.lightmapTexture); + this.lightmapColors = this.lightmapTexture.getTextureData(); + this.theShaderGroup = null; + + for (int i = 0; i < 32; ++i) + { + for (int j = 0; j < 32; ++j) + { + float f = (float)(j - 16); + float f1 = (float)(i - 16); + float f2 = MathHelper.sqrt_float(f * f + f1 * f1); + this.rainXCoords[i << 5 | j] = -f1 / f2; + this.rainYCoords[i << 5 | j] = f / f2; + } + } + } + public void stopUseShader() + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.deleteShaderGroup(); + } + + this.theShaderGroup = null; + this.shaderIndex = shaderCount; + } + + public boolean isShaderActive() + { + return OpenGlHelper.shadersSupported && this.theShaderGroup != null; + } + + public void func_181022_b() + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.deleteShaderGroup(); + } + + this.theShaderGroup = null; + this.shaderIndex = shaderCount; + } + + public void switchUseShader() + { + this.useShader = !this.useShader; + } + + /** + * What shader to use when spectating this entity + */ + public void loadEntityShader(Entity entityIn) + { + if (OpenGlHelper.shadersSupported) + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.deleteShaderGroup(); + } + + this.theShaderGroup = null; + + if (entityIn instanceof EntityCreeper) + { + this.loadShader(new ResourceLocation("shaders/post/creeper.json")); + } + else if (entityIn instanceof EntitySpider) + { + this.loadShader(new ResourceLocation("shaders/post/spider.json")); + } + else if (entityIn instanceof EntityEnderman) + { + this.loadShader(new ResourceLocation("shaders/post/invert.json")); + } + else if (Reflector.ForgeHooksClient_loadEntityShader.exists()) + { + Reflector.call(Reflector.ForgeHooksClient_loadEntityShader, new Object[] {entityIn, this}); + } + } + } + + public void activateNextShader() + { + if (OpenGlHelper.shadersSupported && this.mc.getRenderViewEntity() instanceof EntityPlayer) + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.deleteShaderGroup(); + } + + this.shaderIndex = (this.shaderIndex + 1) % (shaderResourceLocations.length + 1); + + if (this.shaderIndex != shaderCount) + { + this.loadShader(shaderResourceLocations[this.shaderIndex]); + } + else + { + this.theShaderGroup = null; + } + } + } + + public void loadShader(ResourceLocation resourceLocationIn) + { + if (OpenGlHelper.isFramebufferEnabled()) + { + try + { + this.theShaderGroup = new ShaderGroup(this.mc.getTextureManager(), this.resourceManager, this.mc.getFramebuffer(), resourceLocationIn); + this.theShaderGroup.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); + this.useShader = true; + } + catch (IOException ioexception) + { + logger.warn((String)("Failed to load shader: " + resourceLocationIn), (Throwable)ioexception); + this.shaderIndex = shaderCount; + this.useShader = false; + } + catch (JsonSyntaxException jsonsyntaxexception) + { + logger.warn((String)("Failed to load shader: " + resourceLocationIn), (Throwable)jsonsyntaxexception); + this.shaderIndex = shaderCount; + this.useShader = false; + } + } + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.deleteShaderGroup(); + } + + this.theShaderGroup = null; + + if (this.shaderIndex != shaderCount) + { + this.loadShader(shaderResourceLocations[this.shaderIndex]); + } + else + { + this.loadEntityShader(this.mc.getRenderViewEntity()); + } + } + + /** + * Updates the entity renderer + */ + public void updateRenderer() + { + if (OpenGlHelper.shadersSupported && ShaderLinkHelper.getStaticShaderLinkHelper() == null) + { + ShaderLinkHelper.setNewStaticShaderLinkHelper(); + } + + this.updateFovModifierHand(); + this.updateTorchFlicker(); + this.fogColor2 = this.fogColor1; + this.thirdPersonDistanceTemp = this.thirdPersonDistance; + + if (this.mc.gameSettings.smoothCamera) + { + float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; + float f1 = f * f * f * 8.0F; + this.smoothCamFilterX = this.mouseFilterXAxis.smooth(this.smoothCamYaw, 0.05F * f1); + this.smoothCamFilterY = this.mouseFilterYAxis.smooth(this.smoothCamPitch, 0.05F * f1); + this.smoothCamPartialTicks = 0.0F; + this.smoothCamYaw = 0.0F; + this.smoothCamPitch = 0.0F; + } + else + { + this.smoothCamFilterX = 0.0F; + this.smoothCamFilterY = 0.0F; + this.mouseFilterXAxis.reset(); + this.mouseFilterYAxis.reset(); + } + + if (this.mc.getRenderViewEntity() == null) + { + this.mc.setRenderViewEntity(this.mc.thePlayer); + } + + Entity entity = this.mc.getRenderViewEntity(); + double d0 = entity.posX; + double d1 = entity.posY + (double)entity.getEyeHeight(); + double d2 = entity.posZ; + float f3 = this.mc.theWorld.getLightBrightness(new BlockPos(d0, d1, d2)); + float f4 = (float)this.mc.gameSettings.renderDistanceChunks / 16.0F; + f4 = MathHelper.clamp_float(f4, 0.0F, 1.0F); + float f2 = f3 * (1.0F - f4) + f4; + this.fogColor1 += (f2 - this.fogColor1) * 0.1F; + ++this.rendererUpdateCount; + this.itemRenderer.updateEquippedItem(); + this.addRainParticles(); + this.bossColorModifierPrev = this.bossColorModifier; + + if (BossStatus.hasColorModifier) + { + this.bossColorModifier += 0.05F; + + if (this.bossColorModifier > 1.0F) + { + this.bossColorModifier = 1.0F; + } + + BossStatus.hasColorModifier = false; + } + else if (this.bossColorModifier > 0.0F) + { + this.bossColorModifier -= 0.0125F; + } + } + + public ShaderGroup getShaderGroup() + { + return this.theShaderGroup; + } + + public void updateShaderGroupSize(int width, int height) + { + if (OpenGlHelper.shadersSupported) + { + if (this.theShaderGroup != null) + { + this.theShaderGroup.createBindFramebuffers(width, height); + } + + this.mc.renderGlobal.createBindEntityOutlineFbs(width, height); + } + } + + /** + * Finds what block or object the mouse is over at the specified partial tick time. Args: partialTickTime + */ + public void getMouseOver(float partialTicks) + { + Entity entity = this.mc.getRenderViewEntity(); + + if (entity != null && this.mc.theWorld != null) + { + this.mc.mcProfiler.startSection("pick"); + this.mc.pointedEntity = null; + double d0 = (double)this.mc.playerController.getBlockReachDistance(); + this.mc.objectMouseOver = entity.rayTrace(d0, partialTicks); + double d1 = d0; + Vec3 vec3 = entity.getPositionEyes(partialTicks); + boolean flag = false; + boolean flag1 = true; + + if (this.mc.playerController.extendedReach()) + { + d0 = 6.0D; + d1 = 6.0D; + } + else + { + if (d0 > 3.0D) + { + flag = true; + } + + d0 = d0; + } + + if (this.mc.objectMouseOver != null) + { + d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3); + } + + Vec3 vec31 = entity.getLook(partialTicks); + Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0); + this.pointedEntity = null; + Vec3 vec33 = null; + float f = 1.0F; + List list = this.mc.theWorld.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand((double)f, (double)f, (double)f), Predicates.and(EntitySelectors.NOT_SPECTATING, new EntityRenderer1(this))); + double d2 = d1; + + for (int i = 0; i < list.size(); ++i) + { + Entity entity1 = (Entity)list.get(i); + float f1 = entity1.getCollisionBorderSize(); + AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand((double)f1, (double)f1, (double)f1); + MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32); + + if (axisalignedbb.isVecInside(vec3)) + { + if (d2 >= 0.0D) + { + this.pointedEntity = entity1; + vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec; + d2 = 0.0D; + } + } + else if (movingobjectposition != null) + { + double d3 = vec3.distanceTo(movingobjectposition.hitVec); + + if (d3 < d2 || d2 == 0.0D) + { + boolean flag2 = false; + + if (Reflector.ForgeEntity_canRiderInteract.exists()) + { + flag2 = Reflector.callBoolean(entity1, Reflector.ForgeEntity_canRiderInteract, new Object[0]); + } + + if (entity1 == entity.ridingEntity && !flag2) + { + if (d2 == 0.0D) + { + this.pointedEntity = entity1; + vec33 = movingobjectposition.hitVec; + } + } + else + { + this.pointedEntity = entity1; + vec33 = movingobjectposition.hitVec; + d2 = d3; + } + } + } + } + + if (this.pointedEntity != null && flag && vec3.distanceTo(vec33) > 3.0D) + { + this.pointedEntity = null; + this.mc.objectMouseOver = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec33, (EnumFacing)null, new BlockPos(vec33)); + } + + if (this.pointedEntity != null && (d2 < d1 || this.mc.objectMouseOver == null)) + { + this.mc.objectMouseOver = new MovingObjectPosition(this.pointedEntity, vec33); + + if (this.pointedEntity instanceof EntityLivingBase || this.pointedEntity instanceof EntityItemFrame) + { + this.mc.pointedEntity = this.pointedEntity; + } + } + + this.mc.mcProfiler.endSection(); + } + } + + /** + * Update FOV modifier hand + */ + private void updateFovModifierHand() + { + float f = 1.0F; + + if (this.mc.getRenderViewEntity() instanceof AbstractClientPlayer) + { + AbstractClientPlayer abstractclientplayer = (AbstractClientPlayer)this.mc.getRenderViewEntity(); + f = abstractclientplayer.getFovModifier(); + } + + this.fovModifierHandPrev = this.fovModifierHand; + this.fovModifierHand += (f - this.fovModifierHand) * 0.5F; + + if (this.fovModifierHand > 1.5F) + { + this.fovModifierHand = 1.5F; + } + + if (this.fovModifierHand < 0.1F) + { + this.fovModifierHand = 0.1F; + } + } + + /** + * Changes the field of view of the player depending on if they are underwater or not + */ + private float getFOVModifier(float partialTicks, boolean p_78481_2_) + { + + if(Booleans.ScrollZoom) { + if (this.debugView) { + return 90.0F; + } else { + Entity entity = this.mc.getRenderViewEntity(); + float f = 70.0F; + + if (p_78481_2_) { + f = this.mc.gameSettings.fovSetting; + + if (Config.isDynamicFov()) { + f *= this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks; + } + } + + boolean flag = false; + + if (this.mc.currentScreen == null) { + GameSettings gamesettings = this.mc.gameSettings; + flag = GameSettings.isKeyDown(this.mc.gameSettings.ofKeyBindZoom); + } + + if (flag) { + if (!Config.zoomMode) { + Config.zoomMode = true; + this.mc.gameSettings.smoothCamera = true; + } + + if (Config.zoomMode) { + if(Booleans.ScrollZoom) { + f /= getScrollAmount(); + } + if (this.scrollTotal < 4.0F) { + this.scrollTotal += 0.099F; + } + } + } else { + if (this.scrollTotal> 1.0F) { + this.scrollTotal -= 0.099; + } + if (Config.zoomMode) { + Config.zoomMode = false; + if(Booleans.ScrollZoom) { + scrollTotal = 4; + } + scrollTotal = 4; + this.mc.gameSettings.smoothCamera = false; + this.mouseFilterXAxis = new MouseFilter(); + this.mouseFilterYAxis = new MouseFilter(); + this.mc.renderGlobal.displayListEntitiesDirty = true; + } + } + + f /= this.scrollTotal; + + if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).getHealth() <= 0.0F) { + float f1 = (float) ((EntityLivingBase) entity).deathTime + partialTicks; + f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F; + } + + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + + if (block.getMaterial() == Material.water) { + f = f * 60.0F / 70.0F; + } + + return f; + } + }else { + if (this.debugView) + { + return 90.0F; + } + else + { + Entity entity = this.mc.getRenderViewEntity(); + float f = 70.0F; + + if (p_78481_2_) + { + f = this.mc.gameSettings.fovSetting; + + if (Config.isDynamicFov()) + { + f *= this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks; + } + } + + boolean flag = false; + + if (this.mc.currentScreen == null) + { + GameSettings gamesettings = this.mc.gameSettings; + flag = GameSettings.isKeyDown(this.mc.gameSettings.ofKeyBindZoom); + } + + if (flag) + { + if (!Config.zoomMode) + { + Config.zoomMode = true; + this.mc.gameSettings.smoothCamera = true; + this.mc.renderGlobal.displayListEntitiesDirty = true; + } + + if (Config.zoomMode) + { + f /= 4.0F; + } + } + else if (Config.zoomMode) + { + Config.zoomMode = false; + this.mc.gameSettings.smoothCamera = false; + this.mouseFilterXAxis = new MouseFilter(); + this.mouseFilterYAxis = new MouseFilter(); + this.mc.renderGlobal.displayListEntitiesDirty = true; + } + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getHealth() <= 0.0F) + { + float f1 = (float)((EntityLivingBase)entity).deathTime + partialTicks; + f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F; + } + + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + + if (block.getMaterial() == Material.water) + { + f = f * 60.0F / 70.0F; + } + + return Reflector.ForgeHooksClient_getFOVModifier.exists() ? Reflector.callFloat(Reflector.ForgeHooksClient_getFOVModifier, new Object[] {this, entity, block, Float.valueOf(partialTicks), Float.valueOf(f)}): f; + } + } + + + } + int scrollTotal = 4; + private int getScrollAmount() { + if (Booleans.ScrollZoom) { + final int i = Mouse.getDWheel(); + + if (i != 0) + { + if (i > 1) + { + scrollTotal++; + } + + if (i < -1) + { + scrollTotal--; + } + if (scrollTotal > 16) { + scrollTotal = 16; + } + if (scrollTotal < 1) { + scrollTotal = 1; + } + } + } + return scrollTotal; + } + + private void hurtCameraEffect(float partialTicks) + { + if (this.mc.getRenderViewEntity() instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)this.mc.getRenderViewEntity(); + float f = (float)entitylivingbase.hurtTime - partialTicks; + + if (entitylivingbase.getHealth() <= 0.0F) + { + float f1 = (float)entitylivingbase.deathTime + partialTicks; + GlStateManager.rotate(40.0F - 8000.0F / (f1 + 200.0F), 0.0F, 0.0F, 1.0F); + } + + if (f < 0.0F) + { + return; + } + + f = f / (float)entitylivingbase.maxHurtTime; + f = MathHelper.sin(f * f * f * f * (float)Math.PI); + float f2 = entitylivingbase.attackedAtYaw; + GlStateManager.rotate(-f2, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-f * 14.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(f2, 0.0F, 1.0F, 0.0F); + } + } + + /** + * Setups all the GL settings for view bobbing. Args: partialTickTime + */ + private void setupViewBobbing(float partialTicks) + { + if (this.mc.getRenderViewEntity() instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity(); + float f = entityplayer.distanceWalkedModified - entityplayer.prevDistanceWalkedModified; + float f1 = -(entityplayer.distanceWalkedModified + f * partialTicks); + float f2 = entityplayer.prevCameraYaw + (entityplayer.cameraYaw - entityplayer.prevCameraYaw) * partialTicks; + float f3 = entityplayer.prevCameraPitch + (entityplayer.cameraPitch - entityplayer.prevCameraPitch) * partialTicks; + GlStateManager.translate(MathHelper.sin(f1 * (float)Math.PI) * f2 * 0.5F, -Math.abs(MathHelper.cos(f1 * (float)Math.PI) * f2), 0.0F); + GlStateManager.rotate(MathHelper.sin(f1 * (float)Math.PI) * f2 * 3.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(Math.abs(MathHelper.cos(f1 * (float)Math.PI - 0.2F) * f2) * 5.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3, 1.0F, 0.0F, 0.0F); + } + } + + /** + * sets up player's eye (or camera in third person mode) + */ + private void orientCamera(float partialTicks) + { + Entity entity = this.mc.getRenderViewEntity(); + float f = entity.getEyeHeight(); + double d0 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double)partialTicks; + double d1 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double)partialTicks + (double)f; + double d2 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)partialTicks; + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPlayerSleeping()) + { + f = (float)((double)f + 1.0D); + GlStateManager.translate(0.0F, 0.3F, 0.0F); + + if (!this.mc.gameSettings.debugCamEnable) + { + BlockPos blockpos = new BlockPos(entity); + IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (Reflector.ForgeHooksClient_orientBedCamera.exists()) + { + Reflector.callVoid(Reflector.ForgeHooksClient_orientBedCamera, new Object[] {this.mc.theWorld, blockpos, iblockstate, entity}); + } + else if (block == Blocks.bed) + { + int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); + GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F); + } + + GlStateManager.rotate(HudManager.getFreelook().getCameraYaw() + (HudManager.getFreelook().getCameraYaw() - HudManager.getFreelook().getCameraYaw()) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); + GlStateManager.rotate(HudManager.getFreelook().getCameraPitch() + (HudManager.getFreelook().getCameraPitch() - HudManager.getFreelook().getCameraPitch()) * partialTicks, -1.0F, 0.0F, 0.0F); + } + } + else if (this.mc.gameSettings.thirdPersonView > 0) + { + double d3 = (double)(this.thirdPersonDistanceTemp + (this.thirdPersonDistance - this.thirdPersonDistanceTemp) * partialTicks); + + if (this.mc.gameSettings.debugCamEnable) + { + GlStateManager.translate(0.0F, 0.0F, (float)(-d3)); + } + else + { + float f1 = HudManager.getFreelook().getCameraYaw(); + float f2 = HudManager.getFreelook().getCameraPitch(); + + if (this.mc.gameSettings.thirdPersonView == 2) + { + f2 += 180.0F; + } + + double d4 = (double)(-MathHelper.sin(f1 / 180.0F * (float)Math.PI) * MathHelper.cos(f2 / 180.0F * (float)Math.PI)) * d3; + double d5 = (double)(MathHelper.cos(f1 / 180.0F * (float)Math.PI) * MathHelper.cos(f2 / 180.0F * (float)Math.PI)) * d3; + double d6 = (double)(-MathHelper.sin(f2 / 180.0F * (float)Math.PI)) * d3; + + for (int i = 0; i < 8; ++i) + { + float f3 = (float)((i & 1) * 2 - 1); + float f4 = (float)((i >> 1 & 1) * 2 - 1); + float f5 = (float)((i >> 2 & 1) * 2 - 1); + f3 = f3 * 0.1F; + f4 = f4 * 0.1F; + f5 = f5 * 0.1F; + MovingObjectPosition movingobjectposition = this.mc.theWorld.rayTraceBlocks(new Vec3(d0 + (double)f3, d1 + (double)f4, d2 + (double)f5), new Vec3(d0 - d4 + (double)f3 + (double)f5, d1 - d6 + (double)f4, d2 - d5 + (double)f5)); + + if (movingobjectposition != null) + { + double d7 = movingobjectposition.hitVec.distanceTo(new Vec3(d0, d1, d2)); + + if (d7 < d3) + { + d3 = d7; + } + } + } + + if (this.mc.gameSettings.thirdPersonView == 2) + { + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + } + + GlStateManager.rotate(HudManager.getFreelook().getCameraPitch() - f2, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(HudManager.getFreelook().getCameraYaw() - f1, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.0F, 0.0F, (float)(-d3)); + GlStateManager.rotate(f1 - HudManager.getFreelook().getCameraYaw(), 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f2 - HudManager.getFreelook().getCameraPitch(), 1.0F, 0.0F, 0.0F); + } + } + else + { + GlStateManager.translate(0.0F, 0.0F, -0.1F); + } + + if (Reflector.EntityViewRenderEvent_CameraSetup_Constructor.exists()) + { + if (!this.mc.gameSettings.debugCamEnable) + { + float f6 = HudManager.getFreelook().getCameraYaw() + (HudManager.getFreelook().getCameraYaw() - HudManager.getFreelook().getCameraYaw()) * partialTicks + 180.0F; + float f7 = HudManager.getFreelook().getCameraPitch() + (HudManager.getFreelook().getCameraPitch() - HudManager.getFreelook().getCameraPitch()) * partialTicks; + float f8 = 0.0F; + + if (entity instanceof EntityAnimal) + { + EntityAnimal entityanimal = (EntityAnimal)entity; + f6 = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * partialTicks + 180.0F; + } + + Block block1 = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + Object object = Reflector.newInstance(Reflector.EntityViewRenderEvent_CameraSetup_Constructor, new Object[] {this, entity, block1, Float.valueOf(partialTicks), Float.valueOf(f6), Float.valueOf(f7), Float.valueOf(f8)}); + Reflector.postForgeBusEvent(object); + f8 = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_CameraSetup_roll, f8); + f7 = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_CameraSetup_pitch, f7); + f6 = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_CameraSetup_yaw, f6); + GlStateManager.rotate(f8, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(f7, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f6, 0.0F, 1.0F, 0.0F); + } + } + else if (!this.mc.gameSettings.debugCamEnable) + { + GlStateManager.rotate(HudManager.getFreelook().getCameraPitch() + (HudManager.getFreelook().getCameraPitch() - HudManager.getFreelook().getCameraPitch()) * partialTicks, 1.0F, 0.0F, 0.0F); + + if (entity instanceof EntityAnimal) + { + EntityAnimal entityanimal1 = (EntityAnimal)entity; + GlStateManager.rotate(entityanimal1.prevRotationYawHead + (entityanimal1.rotationYawHead - entityanimal1.prevRotationYawHead) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); + } + else + { + GlStateManager.rotate(HudManager.getFreelook().getCameraYaw() + (HudManager.getFreelook().getCameraYaw() - HudManager.getFreelook().getCameraYaw()) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); + } + } + + GlStateManager.translate(0.0F, -f, 0.0F); + d0 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double)partialTicks; + d1 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double)partialTicks + (double)f; + d2 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)partialTicks; + this.cloudFog = this.mc.renderGlobal.hasCloudFog(d0, d1, d2, partialTicks); + } + + /** + * sets up projection, view effects, camera position/rotation + */ + public void setupCameraTransform(float partialTicks, int pass) + { + this.farPlaneDistance = (float)(this.mc.gameSettings.renderDistanceChunks * 16); + + if (Config.isFogFancy()) + { + this.farPlaneDistance *= 0.95F; + } + + if (Config.isFogFast()) + { + this.farPlaneDistance *= 0.83F; + } + + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + float f = 0.07F; + + if (this.mc.gameSettings.anaglyph) + { + GlStateManager.translate((float)(-(pass * 2 - 1)) * f, 0.0F, 0.0F); + } + + this.clipDistance = this.farPlaneDistance * 2.0F; + + if (this.clipDistance < 173.0F) + { + this.clipDistance = 173.0F; + } + + if (this.mc.theWorld.provider.getDimensionId() == 1) + { + this.clipDistance = 256.0F; + } + + if (this.cameraZoom != 1.0D) + { + GlStateManager.translate((float)this.cameraYaw, (float)(-this.cameraPitch), 0.0F); + GlStateManager.scale(this.cameraZoom, this.cameraZoom, 1.0D); + } + + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + + if (this.mc.gameSettings.anaglyph) + { + GlStateManager.translate((float)(pass * 2 - 1) * 0.1F, 0.0F, 0.0F); + } + + this.hurtCameraEffect(partialTicks); + + if (this.mc.gameSettings.viewBobbing && !Booleans.minimalBobbing) + { + this.setupViewBobbing(partialTicks); + } + + float f1 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * partialTicks; + + if (f1 > 0.0F) + { + byte b0 = 20; + + if (this.mc.thePlayer.isPotionActive(Potion.confusion)) + { + b0 = 7; + } + + float f2 = 5.0F / (f1 * f1 + 5.0F) - f1 * 0.04F; + f2 = f2 * f2; + GlStateManager.rotate(((float)this.rendererUpdateCount + partialTicks) * (float)b0, 0.0F, 1.0F, 1.0F); + GlStateManager.scale(1.0F / f2, 1.0F, 1.0F); + GlStateManager.rotate(-((float)this.rendererUpdateCount + partialTicks) * (float)b0, 0.0F, 1.0F, 1.0F); + } + + this.orientCamera(partialTicks); + + if (this.debugView) + { + switch (this.debugViewDirection) + { + case 0: + GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); + break; + + case 1: + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + break; + + case 2: + GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); + break; + + case 3: + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + break; + + case 4: + GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); + } + } + } + + /** + * Render player hand + */ + private void renderHand(float partialTicks, int xOffset) + { + this.renderHand(partialTicks, xOffset, true, true, false); + } + + public void renderHand(float p_renderHand_1_, int p_renderHand_2_, boolean p_renderHand_3_, boolean p_renderHand_4_, boolean p_renderHand_5_) + { + if (!this.debugView) + { + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + float f = 0.07F; + + if (this.mc.gameSettings.anaglyph) + { + GlStateManager.translate((float)(-(p_renderHand_2_ * 2 - 1)) * f, 0.0F, 0.0F); + } + + if (Config.isShaders()) + { + Shaders.applyHandDepth(); + } + + Project.gluPerspective(this.getFOVModifier(p_renderHand_1_, false), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + + if (this.mc.gameSettings.anaglyph) + { + GlStateManager.translate((float)(p_renderHand_2_ * 2 - 1) * 0.1F, 0.0F, 0.0F); + } + + boolean flag = false; + + if (p_renderHand_3_) + { + GlStateManager.pushMatrix(); + this.hurtCameraEffect(p_renderHand_1_); + + if (this.mc.gameSettings.viewBobbing) + { + this.setupViewBobbing(p_renderHand_1_); + } + + flag = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); + boolean flag1 = !ReflectorForge.renderFirstPersonHand(this.mc.renderGlobal, p_renderHand_1_, p_renderHand_2_); + + if (flag1 && this.mc.gameSettings.thirdPersonView == 0 && !flag && !this.mc.gameSettings.hideGUI && !this.mc.playerController.isSpectator()) + { + this.enableLightmap(); + + if (Config.isShaders()) + { + ShadersRender.renderItemFP(this.itemRenderer, p_renderHand_1_, p_renderHand_5_); + } + else + { + this.itemRenderer.renderItemInFirstPerson(p_renderHand_1_); + } + + this.disableLightmap(); + } + + GlStateManager.popMatrix(); + } + + if (!p_renderHand_4_) + { + return; + } + + this.disableLightmap(); + + if (this.mc.gameSettings.thirdPersonView == 0 && !flag) + { + this.itemRenderer.renderOverlays(p_renderHand_1_); + this.hurtCameraEffect(p_renderHand_1_); + } + + if (this.mc.gameSettings.viewBobbing) + { + this.setupViewBobbing(p_renderHand_1_); + } + } + } + + public void disableLightmap() + { + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + + if (Config.isShaders()) + { + Shaders.disableLightmap(); + } + } + + public void enableLightmap() + { + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + float f = 0.00390625F; + GlStateManager.scale(f, f, f); + GlStateManager.translate(8.0F, 8.0F, 8.0F); + GlStateManager.matrixMode(5888); + this.mc.getTextureManager().bindTexture(this.locationLightMap); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + + if (Config.isShaders()) + { + Shaders.enableLightmap(); + } + } + + /** + * Recompute a random value that is applied to block color in updateLightmap() + */ + private void updateTorchFlicker() + { + this.torchFlickerDX = (float)((double)this.torchFlickerDX + (Math.random() - Math.random()) * Math.random() * Math.random()); + this.torchFlickerDX = (float)((double)this.torchFlickerDX * 0.9D); + this.torchFlickerX += (this.torchFlickerDX - this.torchFlickerX) * 1.0F; + this.lightmapUpdateNeeded = true; + } + + private void updateLightmap(float partialTicks) + { + if (this.lightmapUpdateNeeded) + { + this.mc.mcProfiler.startSection("lightTex"); + WorldClient worldclient = this.mc.theWorld; + + if (worldclient != null) + { + if (Config.isCustomColors() && CustomColors.updateLightmap(worldclient, this.torchFlickerX, this.lightmapColors, this.mc.thePlayer.isPotionActive(Potion.nightVision))) + { + this.lightmapTexture.updateDynamicTexture(); + this.lightmapUpdateNeeded = false; + this.mc.mcProfiler.endSection(); + return; + } + + float f = worldclient.getSunBrightness(1.0F); + float f1 = f * 0.95F + 0.05F; + + for (int i = 0; i < 256; ++i) + { + float f2 = worldclient.provider.getLightBrightnessTable()[i / 16] * f1; + float f3 = worldclient.provider.getLightBrightnessTable()[i % 16] * (this.torchFlickerX * 0.1F + 1.5F); + + if (worldclient.getLastLightningBolt() > 0) + { + f2 = worldclient.provider.getLightBrightnessTable()[i / 16]; + } + + float f4 = f2 * (f * 0.65F + 0.35F); + float f5 = f2 * (f * 0.65F + 0.35F); + float f6 = f3 * ((f3 * 0.6F + 0.4F) * 0.6F + 0.4F); + float f7 = f3 * (f3 * f3 * 0.6F + 0.4F); + float f8 = f4 + f3; + float f9 = f5 + f6; + float f10 = f2 + f7; + f8 = f8 * 0.96F + 0.03F; + f9 = f9 * 0.96F + 0.03F; + f10 = f10 * 0.96F + 0.03F; + + if (this.bossColorModifier > 0.0F) + { + float f11 = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * partialTicks; + f8 = f8 * (1.0F - f11) + f8 * 0.7F * f11; + f9 = f9 * (1.0F - f11) + f9 * 0.6F * f11; + f10 = f10 * (1.0F - f11) + f10 * 0.6F * f11; + } + + if (worldclient.provider.getDimensionId() == 1) + { + f8 = 0.22F + f3 * 0.75F; + f9 = 0.28F + f6 * 0.75F; + f10 = 0.25F + f7 * 0.75F; + } + + if (this.mc.thePlayer.isPotionActive(Potion.nightVision)) + { + float f15 = this.getNightVisionBrightness(this.mc.thePlayer, partialTicks); + float f12 = 1.0F / f8; + + if (f12 > 1.0F / f9) + { + f12 = 1.0F / f9; + } + + if (f12 > 1.0F / f10) + { + f12 = 1.0F / f10; + } + + f8 = f8 * (1.0F - f15) + f8 * f12 * f15; + f9 = f9 * (1.0F - f15) + f9 * f12 * f15; + f10 = f10 * (1.0F - f15) + f10 * f12 * f15; + } + + if (f8 > 1.0F) + { + f8 = 1.0F; + } + + if (f9 > 1.0F) + { + f9 = 1.0F; + } + + if (f10 > 1.0F) + { + f10 = 1.0F; + } + + float f16 = this.mc.gameSettings.gammaSetting; + float f17 = 1.0F - f8; + float f13 = 1.0F - f9; + float f14 = 1.0F - f10; + f17 = 1.0F - f17 * f17 * f17 * f17; + f13 = 1.0F - f13 * f13 * f13 * f13; + f14 = 1.0F - f14 * f14 * f14 * f14; + f8 = f8 * (1.0F - f16) + f17 * f16; + f9 = f9 * (1.0F - f16) + f13 * f16; + f10 = f10 * (1.0F - f16) + f14 * f16; + f8 = f8 * 0.96F + 0.03F; + f9 = f9 * 0.96F + 0.03F; + f10 = f10 * 0.96F + 0.03F; + + if (f8 > 1.0F) + { + f8 = 1.0F; + } + + if (f9 > 1.0F) + { + f9 = 1.0F; + } + + if (f10 > 1.0F) + { + f10 = 1.0F; + } + + if (f8 < 0.0F) + { + f8 = 0.0F; + } + + if (f9 < 0.0F) + { + f9 = 0.0F; + } + + if (f10 < 0.0F) + { + f10 = 0.0F; + } + + short short1 = 255; + int j = (int)(f8 * 255.0F); + int k = (int)(f9 * 255.0F); + int l = (int)(f10 * 255.0F); + this.lightmapColors[i] = short1 << 24 | j << 16 | k << 8 | l; + } + + this.lightmapTexture.updateDynamicTexture(); + this.lightmapUpdateNeeded = false; + this.mc.mcProfiler.endSection(); + } + } + } + + public float getNightVisionBrightness(EntityLivingBase entitylivingbaseIn, float partialTicks) + { + int i = entitylivingbaseIn.getActivePotionEffect(Potion.nightVision).getDuration(); + return i > 200 ? 1.0F : 0.7F + MathHelper.sin(((float)i - partialTicks) * (float)Math.PI * 0.2F) * 0.3F; + } + + public void func_181560_a(float p_181560_1_, long p_181560_2_) + { + this.frameInit(); + boolean flag = Display.isActive(); + + if (!flag && this.mc.gameSettings.pauseOnLostFocus && (!this.mc.gameSettings.touchscreen || !Mouse.isButtonDown(1))) + { + if (Minecraft.getSystemTime() - this.prevFrameTime > 500L) + { + this.mc.displayInGameMenu(); + } + } + else + { + this.prevFrameTime = Minecraft.getSystemTime(); + } + + this.mc.mcProfiler.startSection("mouse"); + + if (flag && Minecraft.isRunningOnMac && this.mc.inGameHasFocus && !Mouse.isInsideWindow()) + { + Mouse.setGrabbed(false); + Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2); + Mouse.setGrabbed(true); + } + + //if (this.mc.inGameHasFocus && flag) + if(this.mc.inGameHasFocus && flag && HudManager.getFreelook().overrideMouse()) + { + this.mc.mouseHelper.mouseXYChange(); + float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; + float f1 = f * f * f * 8.0F; + float f2 = (float)this.mc.mouseHelper.deltaX * f1; + float f3 = (float)this.mc.mouseHelper.deltaY * f1; + byte b0 = 1; + + if (this.mc.gameSettings.invertMouse) + { + b0 = -1; + } + + if (this.mc.gameSettings.smoothCamera) + { + this.smoothCamYaw += f2; + this.smoothCamPitch += f3; + float f4 = p_181560_1_ - this.smoothCamPartialTicks; + this.smoothCamPartialTicks = p_181560_1_; + f2 = this.smoothCamFilterX * f4; + f3 = this.smoothCamFilterY * f4; + this.mc.thePlayer.setAngles(f2, f3 * (float)b0); + } + else + { + this.smoothCamYaw = 0.0F; + this.smoothCamPitch = 0.0F; + this.mc.thePlayer.setAngles(f2, f3 * (float)b0); + } + } + + this.mc.mcProfiler.endSection(); + + if (!this.mc.skipRenderWorld) + { + anaglyphEnable = this.mc.gameSettings.anaglyph; + final ScaledResolution scaledresolution = new ScaledResolution(this.mc); + int l = scaledresolution.getScaledWidth(); + int i1 = scaledresolution.getScaledHeight(); + final int j1 = Mouse.getX() * l / this.mc.displayWidth; + final int k1 = i1 - Mouse.getY() * i1 / this.mc.displayHeight - 1; + int l1 = this.mc.gameSettings.limitFramerate; + + if (this.mc.theWorld != null) + { + this.mc.mcProfiler.startSection("level"); + int i = Math.min(Minecraft.getDebugFPS(), l1); + i = Math.max(i, 60); + long j = System.nanoTime() - p_181560_2_; + long k = Math.max((long)(1000000000 / i / 4) - j, 0L); + this.renderWorld(p_181560_1_, System.nanoTime() + k); + + if (OpenGlHelper.shadersSupported) + { + this.mc.renderGlobal.renderEntityOutlineFramebuffer(); + + if (this.theShaderGroup != null && this.useShader) + { + GlStateManager.matrixMode(5890); + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + this.theShaderGroup.loadShaderGroup(p_181560_1_); + GlStateManager.popMatrix(); + } + + this.mc.getFramebuffer().bindFramebuffer(true); + } + + this.renderEndNanoTime = System.nanoTime(); + this.mc.mcProfiler.endStartSection("gui"); + + if (!this.mc.gameSettings.hideGUI || this.mc.currentScreen != null) + { + GlStateManager.alphaFunc(516, 0.1F); + this.mc.ingameGUI.renderGameOverlay(p_181560_1_); + + if (this.mc.gameSettings.ofShowFps && !this.mc.gameSettings.showDebugInfo) + { + Config.drawFps(); + } + + if (this.mc.gameSettings.showDebugInfo) + { + Lagometer.showLagometer(scaledresolution); + } + } + + this.mc.mcProfiler.endSection(); + } + else + { + GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + this.setupOverlayRendering(); + this.renderEndNanoTime = System.nanoTime(); + TileEntityRendererDispatcher.instance.renderEngine = this.mc.getTextureManager(); + } + + if (this.mc.currentScreen != null) + { + GlStateManager.clear(256); + + try + { + if (Reflector.ForgeHooksClient_drawScreen.exists()) + { + Reflector.callVoid(Reflector.ForgeHooksClient_drawScreen, new Object[] {this.mc.currentScreen, Integer.valueOf(j1), Integer.valueOf(k1), Float.valueOf(p_181560_1_)}); + } + else + { + this.mc.currentScreen.drawScreen(j1, k1, p_181560_1_); + } + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering screen"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Screen render details"); + crashreportcategory.addCrashSectionCallable("Screen name", new EntityRenderer2(this)); + crashreportcategory.addCrashSectionCallable("Mouse location", new Callable() + { + private static final String __OBFID = "CL_00000950"; + public String call() throws Exception + { + return String.format("Scaled: (%d, %d). Absolute: (%d, %d)", new Object[] {Integer.valueOf(j1), Integer.valueOf(k1), Integer.valueOf(Mouse.getX()), Integer.valueOf(Mouse.getY())}); + } + }); + crashreportcategory.addCrashSectionCallable("Screen size", new Callable() + { + private static final String __OBFID = "CL_00000951"; + public String call() throws Exception + { + return String.format("Scaled: (%d, %d). Absolute: (%d, %d). Scale factor of %d", new Object[] {Integer.valueOf(scaledresolution.getScaledWidth()), Integer.valueOf(scaledresolution.getScaledHeight()), Integer.valueOf(EntityRenderer.this.mc.displayWidth), Integer.valueOf(EntityRenderer.this.mc.displayHeight), Integer.valueOf(scaledresolution.getScaleFactor())}); + } + }); + throw new ReportedException(crashreport); + } + } + } + + this.frameFinish(); + this.waitForServerThread(); + Lagometer.updateLagometer(); + + if (this.mc.gameSettings.ofProfiler) + { + this.mc.gameSettings.showDebugProfilerChart = true; + } + } + + public void renderStreamIndicator(float partialTicks) + { + this.setupOverlayRendering(); + this.mc.ingameGUI.renderStreamIndicator(new ScaledResolution(this.mc)); + } + + private boolean isDrawBlockOutline() + { + if (!this.drawBlockOutline) + { + return false; + } + else + { + Entity entity = this.mc.getRenderViewEntity(); + boolean flag = entity instanceof EntityPlayer && !this.mc.gameSettings.hideGUI; + + if (flag && !((EntityPlayer)entity).capabilities.allowEdit) + { + ItemStack itemstack = ((EntityPlayer)entity).getCurrentEquippedItem(); + + if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = this.mc.objectMouseOver.getBlockPos(); + IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR) + { + flag = ReflectorForge.blockHasTileEntity(iblockstate) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory; + } + else + { + flag = itemstack != null && (itemstack.canDestroy(block) || itemstack.canPlaceOn(block)); + } + } + } + + return flag; + } + } + + private void renderWorldDirections(float partialTicks) + { + if (this.mc.gameSettings.showDebugInfo && !this.mc.gameSettings.hideGUI && !this.mc.thePlayer.hasReducedDebug() && !this.mc.gameSettings.reducedDebugInfo) + { + Entity entity = this.mc.getRenderViewEntity(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GL11.glLineWidth(1.0F); + GlStateManager.disableTexture2D(); + GlStateManager.depthMask(false); + GlStateManager.pushMatrix(); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + this.orientCamera(partialTicks); + GlStateManager.translate(0.0F, entity.getEyeHeight(), 0.0F); + RenderGlobal.func_181563_a(new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.005D, 1.0E-4D, 1.0E-4D), 255, 0, 0, 255); + RenderGlobal.func_181563_a(new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0E-4D, 1.0E-4D, 0.005D), 0, 0, 255, 255); + RenderGlobal.func_181563_a(new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0E-4D, 0.0033D, 1.0E-4D), 0, 255, 0, 255); + GlStateManager.popMatrix(); + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + } + } + + public void renderWorld(float partialTicks, long finishTimeNano) + { + this.updateLightmap(partialTicks); + + if (this.mc.getRenderViewEntity() == null) + { + this.mc.setRenderViewEntity(this.mc.thePlayer); + } + + this.getMouseOver(partialTicks); + + if (Config.isShaders()) + { + Shaders.beginRender(this.mc, partialTicks, finishTimeNano); + } + + GlStateManager.enableDepth(); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + this.mc.mcProfiler.startSection("center"); + + if (this.mc.gameSettings.anaglyph) + { + anaglyphField = 0; + GlStateManager.colorMask(false, true, true, false); + this.renderWorldPass(0, partialTicks, finishTimeNano); + anaglyphField = 1; + GlStateManager.colorMask(true, false, false, false); + this.renderWorldPass(1, partialTicks, finishTimeNano); + GlStateManager.colorMask(true, true, true, false); + } + else + { + this.renderWorldPass(2, partialTicks, finishTimeNano); + } + + this.mc.mcProfiler.endSection(); + } + + private void renderWorldPass(int pass, float partialTicks, long finishTimeNano) + { + boolean flag = Config.isShaders(); + + if (flag) + { + Shaders.beginRenderPass(pass, partialTicks, finishTimeNano); + } + + RenderGlobal renderglobal = this.mc.renderGlobal; + EffectRenderer effectrenderer = this.mc.effectRenderer; + boolean flag1 = this.isDrawBlockOutline(); + GlStateManager.enableCull(); + this.mc.mcProfiler.endStartSection("clear"); + + if (flag) + { + Shaders.setViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + } + else + { + GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + } + + this.updateFogColor(partialTicks); + GlStateManager.clear(16640); + + if (flag) + { + Shaders.clearRenderBuffer(); + } + + this.mc.mcProfiler.endStartSection("camera"); + this.setupCameraTransform(partialTicks, pass); + + if (flag) + { + Shaders.setCamera(partialTicks); + } + + ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2); + this.mc.mcProfiler.endStartSection("frustum"); + ClippingHelperImpl.getInstance(); + this.mc.mcProfiler.endStartSection("culling"); + Frustum frustum = new Frustum(); + Entity entity = this.mc.getRenderViewEntity(); + double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; + + if (flag) + { + ShadersRender.setFrustrumPosition(frustum, d0, d1, d2); + } + else + { + frustum.setPosition(d0, d1, d2); + } + + if ((Config.isSkyEnabled() || Config.isSunMoonEnabled() || Config.isStarsEnabled()) && !Shaders.isShadowPass) + { + this.setupFog(-1, partialTicks); + this.mc.mcProfiler.endStartSection("sky"); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance); + GlStateManager.matrixMode(5888); + + if (flag) + { + Shaders.beginSky(); + } + + renderglobal.renderSky(partialTicks, pass); + + if (flag) + { + Shaders.endSky(); + } + + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance); + GlStateManager.matrixMode(5888); + } + else + { + GlStateManager.disableBlend(); + } + + this.setupFog(0, partialTicks); + GlStateManager.shadeModel(7425); + + if (entity.posY + (double)entity.getEyeHeight() < 128.0D + (double)(this.mc.gameSettings.ofCloudsHeight * 128.0F)) + { + this.renderCloudsCheck(renderglobal, partialTicks, pass); + } + + this.mc.mcProfiler.endStartSection("prepareterrain"); + this.setupFog(0, partialTicks); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + RenderHelper.disableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("terrain_setup"); + + if (flag) + { + ShadersRender.setupTerrain(renderglobal, entity, (double)partialTicks, frustum, this.frameCount++, this.mc.thePlayer.isSpectator()); + } + else + { + renderglobal.setupTerrain(entity, (double)partialTicks, frustum, this.frameCount++, this.mc.thePlayer.isSpectator()); + } + + if (pass == 0 || pass == 2) + { + this.mc.mcProfiler.endStartSection("updatechunks"); + Lagometer.timerChunkUpload.start(); + this.mc.renderGlobal.updateChunks(finishTimeNano); + Lagometer.timerChunkUpload.end(); + } + + this.mc.mcProfiler.endStartSection("terrain"); + Lagometer.timerTerrain.start(); + + if (this.mc.gameSettings.ofSmoothFps && pass > 0) + { + this.mc.mcProfiler.endStartSection("finish"); + GL11.glFinish(); + this.mc.mcProfiler.endStartSection("terrain"); + } + + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + GlStateManager.disableAlpha(); + + if (flag) + { + ShadersRender.beginTerrainSolid(); + } + + renderglobal.renderBlockLayer(EnumWorldBlockLayer.SOLID, (double)partialTicks, pass, entity); + GlStateManager.enableAlpha(); + + if (flag) + { + ShadersRender.beginTerrainCutoutMipped(); + } + + renderglobal.renderBlockLayer(EnumWorldBlockLayer.CUTOUT_MIPPED, (double)partialTicks, pass, entity); + this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); + + if (flag) + { + ShadersRender.beginTerrainCutout(); + } + + renderglobal.renderBlockLayer(EnumWorldBlockLayer.CUTOUT, (double)partialTicks, pass, entity); + this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); + + if (flag) + { + ShadersRender.endTerrain(); + } + + Lagometer.timerTerrain.end(); + GlStateManager.shadeModel(7424); + GlStateManager.alphaFunc(516, 0.1F); + + if (!this.debugView) + { + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); + + if (Reflector.ForgeHooksClient_setRenderPass.exists()) + { + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] {Integer.valueOf(0)}); + } + + renderglobal.renderEntities(entity, frustum, partialTicks); + + if (Reflector.ForgeHooksClient_setRenderPass.exists()) + { + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] {Integer.valueOf(-1)}); + } + + RenderHelper.disableStandardItemLighting(); + this.disableLightmap(); + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + + if (this.mc.objectMouseOver != null && entity.isInsideOfMaterial(Material.water) && flag1) + { + EntityPlayer entityplayer = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); + + if ((!Reflector.ForgeHooksClient_onDrawBlockHighlight.exists() || !Reflector.callBoolean(Reflector.ForgeHooksClient_onDrawBlockHighlight, new Object[] {renderglobal, entityplayer, this.mc.objectMouseOver, Integer.valueOf(0), entityplayer.getHeldItem(), Float.valueOf(partialTicks)})) && !this.mc.gameSettings.hideGUI) + { + renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks); + } + GlStateManager.enableAlpha(); + } + } + + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + + if (flag1 && this.mc.objectMouseOver != null && !entity.isInsideOfMaterial(Material.water)) + { + EntityPlayer entityplayer1 = (EntityPlayer)entity; + GlStateManager.disableAlpha(); + this.mc.mcProfiler.endStartSection("outline"); + + if ((!Reflector.ForgeHooksClient_onDrawBlockHighlight.exists() || !Reflector.callBoolean(Reflector.ForgeHooksClient_onDrawBlockHighlight, new Object[] {renderglobal, entityplayer1, this.mc.objectMouseOver, Integer.valueOf(0), entityplayer1.getHeldItem(), Float.valueOf(partialTicks)})) && !this.mc.gameSettings.hideGUI) + { + renderglobal.drawSelectionBox(entityplayer1, this.mc.objectMouseOver, 0, partialTicks); + } + GlStateManager.enableAlpha(); + } + + if (!renderglobal.damagedBlocks.isEmpty()) + { + this.mc.mcProfiler.endStartSection("destroyProgress"); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0); + this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); + renderglobal.drawBlockDamageTexture(Tessellator.getInstance(), Tessellator.getInstance().getWorldRenderer(), entity, partialTicks); + this.mc.getTextureManager().getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); + GlStateManager.disableBlend(); + } + + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.disableBlend(); + + if (!this.debugView) + { + this.enableLightmap(); + this.mc.mcProfiler.endStartSection("litParticles"); + + if (flag) + { + Shaders.beginLitParticles(); + } + + effectrenderer.renderLitParticles(entity, partialTicks); + RenderHelper.disableStandardItemLighting(); + this.setupFog(0, partialTicks); + this.mc.mcProfiler.endStartSection("particles"); + + if (flag) + { + Shaders.beginParticles(); + } + + effectrenderer.renderParticles(entity, partialTicks); + + if (flag) + { + Shaders.endParticles(); + } + + this.disableLightmap(); + } + + GlStateManager.depthMask(false); + GlStateManager.enableCull(); + this.mc.mcProfiler.endStartSection("weather"); + + if (flag) + { + Shaders.beginWeather(); + } + + this.renderRainSnow(partialTicks); + + if (flag) + { + Shaders.endWeather(); + } + + GlStateManager.depthMask(true); + renderglobal.renderWorldBorder(entity, partialTicks); + + if (flag) + { + ShadersRender.renderHand0(this, partialTicks, pass); + Shaders.preWater(); + } + + GlStateManager.disableBlend(); + GlStateManager.enableCull(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.alphaFunc(516, 0.1F); + this.setupFog(0, partialTicks); + GlStateManager.enableBlend(); + GlStateManager.depthMask(false); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + GlStateManager.shadeModel(7425); + this.mc.mcProfiler.endStartSection("translucent"); + + if (flag) + { + Shaders.beginWater(); + } + + renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity); + + if (flag) + { + Shaders.endWater(); + } + + if (Reflector.ForgeHooksClient_setRenderPass.exists() && !this.debugView) + { + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] {Integer.valueOf(1)}); + this.mc.renderGlobal.renderEntities(entity, frustum, partialTicks); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] {Integer.valueOf(-1)}); + RenderHelper.disableStandardItemLighting(); + } + + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); + GlStateManager.disableBlend(); + GlStateManager.disableFog(); + + if (entity.posY + (double)entity.getEyeHeight() >= 128.0D + (double)(this.mc.gameSettings.ofCloudsHeight * 128.0F)) + { + this.mc.mcProfiler.endStartSection("aboveClouds"); + this.renderCloudsCheck(renderglobal, partialTicks, pass); + } + + if (Reflector.ForgeHooksClient_dispatchRenderLast.exists()) + { + this.mc.mcProfiler.endStartSection("forge_render_last"); + Reflector.callVoid(Reflector.ForgeHooksClient_dispatchRenderLast, new Object[] {renderglobal, Float.valueOf(partialTicks)}); + } + + this.mc.mcProfiler.endStartSection("hand"); + boolean flag2 = ReflectorForge.renderFirstPersonHand(this.mc.renderGlobal, partialTicks, pass); + + if (!flag2 && this.renderHand && !Shaders.isShadowPass) + { + if (flag) + { + ShadersRender.renderHand1(this, partialTicks, pass); + Shaders.renderCompositeFinal(); + } + + GlStateManager.clear(256); + + if (flag) + { + ShadersRender.renderFPOverlay(this, partialTicks, pass); + } + else + { + this.renderHand(partialTicks, pass); + } + + this.renderWorldDirections(partialTicks); + } + + if (flag) + { + Shaders.endRender(); + } + } + + private void renderCloudsCheck(RenderGlobal renderGlobalIn, float partialTicks, int pass) + { + if (this.mc.gameSettings.renderDistanceChunks >= 4 && !Config.isCloudsOff() && Shaders.shouldRenderClouds(this.mc.gameSettings)) + { + this.mc.mcProfiler.endStartSection("clouds"); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance * 4.0F); + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + this.setupFog(0, partialTicks); + renderGlobalIn.renderClouds(partialTicks, pass); + GlStateManager.disableFog(); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.clipDistance); + GlStateManager.matrixMode(5888); + } + } + + private void addRainParticles() + { + float f = this.mc.theWorld.getRainStrength(1.0F); + + if (!Config.isRainFancy()) + { + f /= 2.0F; + } + + if (f != 0.0F && Config.isRainSplash()) + { + this.random.setSeed((long)this.rendererUpdateCount * 312987231L); + Entity entity = this.mc.getRenderViewEntity(); + WorldClient worldclient = this.mc.theWorld; + BlockPos blockpos = new BlockPos(entity); + byte b0 = 10; + double d0 = 0.0D; + double d1 = 0.0D; + double d2 = 0.0D; + int i = 0; + int j = (int)(100.0F * f * f); + + if (this.mc.gameSettings.particleSetting == 1) + { + j >>= 1; + } + else if (this.mc.gameSettings.particleSetting == 2) + { + j = 0; + } + + for (int k = 0; k < j; ++k) + { + BlockPos blockpos1 = worldclient.getPrecipitationHeight(blockpos.add(this.random.nextInt(b0) - this.random.nextInt(b0), 0, this.random.nextInt(b0) - this.random.nextInt(b0))); + BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos1); + BlockPos blockpos2 = blockpos1.down(); + Block block = worldclient.getBlockState(blockpos2).getBlock(); + + if (blockpos1.getY() <= blockpos.getY() + b0 && blockpos1.getY() >= blockpos.getY() - b0 && biomegenbase.canSpawnLightningBolt() && biomegenbase.getFloatTemperature(blockpos1) >= 0.15F) + { + double d3 = this.random.nextDouble(); + double d4 = this.random.nextDouble(); + + if (block.getMaterial() == Material.lava) + { + this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]); + } + else if (block.getMaterial() != Material.air) + { + block.setBlockBoundsBasedOnState(worldclient, blockpos2); + ++i; + + if (this.random.nextInt(i) == 0) + { + d0 = (double)blockpos2.getX() + d3; + d1 = (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D; + d2 = (double)blockpos2.getZ() + d4; + } + + this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double)blockpos2.getX() + d3, (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(), (double)blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + } + + if (i > 0 && this.random.nextInt(3) < this.rainSoundCounter++) + { + this.rainSoundCounter = 0; + + if (d1 > (double)(blockpos.getY() + 1) && worldclient.getPrecipitationHeight(blockpos).getY() > MathHelper.floor_float((float)blockpos.getY())) + { + this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false); + } + else + { + this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false); + } + } + } + } + + /** + * Render rain and snow + */ + protected void renderRainSnow(float partialTicks) + { + if (Reflector.ForgeWorldProvider_getWeatherRenderer.exists()) + { + WorldProvider worldprovider = this.mc.theWorld.provider; + Object object = Reflector.call(worldprovider, Reflector.ForgeWorldProvider_getWeatherRenderer, new Object[0]); + + if (object != null) + { + Reflector.callVoid(object, Reflector.IRenderHandler_render, new Object[] {Float.valueOf(partialTicks), this.mc.theWorld, this.mc}); + return; + } + } + + float f5 = this.mc.theWorld.getRainStrength(partialTicks); + + if (f5 > 0.0F) + { + if (Config.isRainOff()) + { + return; + } + + this.enableLightmap(); + Entity entity = this.mc.getRenderViewEntity(); + WorldClient worldclient = this.mc.theWorld; + int i = MathHelper.floor_double(entity.posX); + int j = MathHelper.floor_double(entity.posY); + int k = MathHelper.floor_double(entity.posZ); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.disableCull(); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.alphaFunc(516, 0.1F); + double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; + int l = MathHelper.floor_double(d1); + byte b0 = 5; + + if (Config.isRainFancy()) + { + b0 = 10; + } + + byte b1 = -1; + float f = (float)this.rendererUpdateCount + partialTicks; + worldrenderer.setTranslation(-d0, -d1, -d2); + + if (Config.isRainFancy()) + { + b0 = 10; + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int i1 = k - b0; i1 <= k + b0; ++i1) + { + for (int j1 = i - b0; j1 <= i + b0; ++j1) + { + int k1 = (i1 - k + 16) * 32 + j1 - i + 16; + double d3 = (double)this.rainXCoords[k1] * 0.5D; + double d4 = (double)this.rainYCoords[k1] * 0.5D; + blockpos$mutableblockpos.func_181079_c(j1, 0, i1); + BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos$mutableblockpos); + + if (biomegenbase.canSpawnLightningBolt() || biomegenbase.getEnableSnow()) + { + int l1 = worldclient.getPrecipitationHeight(blockpos$mutableblockpos).getY(); + int i2 = j - b0; + int j2 = j + b0; + + if (i2 < l1) + { + i2 = l1; + } + + if (j2 < l1) + { + j2 = l1; + } + + int k2 = l1; + + if (l1 < l) + { + k2 = l; + } + + if (i2 != j2) + { + this.random.setSeed((long)(j1 * j1 * 3121 + j1 * 45238971 ^ i1 * i1 * 418711 + i1 * 13761)); + blockpos$mutableblockpos.func_181079_c(j1, i2, i1); + float f1 = biomegenbase.getFloatTemperature(blockpos$mutableblockpos); + + if (worldclient.getWorldChunkManager().getTemperatureAtHeight(f1, l1) >= 0.15F) + { + if (b1 != 0) + { + if (b1 >= 0) + { + tessellator.draw(); + } + + b1 = 0; + this.mc.getTextureManager().bindTexture(locationRainPng); + worldrenderer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + } + + double d5 = ((double)(this.rendererUpdateCount + j1 * j1 * 3121 + j1 * 45238971 + i1 * i1 * 418711 + i1 * 13761 & 31) + (double)partialTicks) / 32.0D * (3.0D + this.random.nextDouble()); + double d6 = (double)((float)j1 + 0.5F) - entity.posX; + double d7 = (double)((float)i1 + 0.5F) - entity.posZ; + float f2 = MathHelper.sqrt_double(d6 * d6 + d7 * d7) / (float)b0; + float f3 = ((1.0F - f2 * f2) * 0.5F + 0.5F) * f5; + blockpos$mutableblockpos.func_181079_c(j1, k2, i1); + int l2 = worldclient.getCombinedLight(blockpos$mutableblockpos, 0); + int i3 = l2 >> 16 & 65535; + int j3 = l2 & 65535; + worldrenderer.pos((double)j1 - d3 + 0.5D, (double)i2, (double)i1 - d4 + 0.5D).tex(0.0D, (double)i2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f3).lightmap(i3, j3).endVertex(); + worldrenderer.pos((double)j1 + d3 + 0.5D, (double)i2, (double)i1 + d4 + 0.5D).tex(1.0D, (double)i2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f3).lightmap(i3, j3).endVertex(); + worldrenderer.pos((double)j1 + d3 + 0.5D, (double)j2, (double)i1 + d4 + 0.5D).tex(1.0D, (double)j2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f3).lightmap(i3, j3).endVertex(); + worldrenderer.pos((double)j1 - d3 + 0.5D, (double)j2, (double)i1 - d4 + 0.5D).tex(0.0D, (double)j2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f3).lightmap(i3, j3).endVertex(); + } + else + { + if (b1 != 1) + { + if (b1 >= 0) + { + tessellator.draw(); + } + + b1 = 1; + this.mc.getTextureManager().bindTexture(locationSnowPng); + worldrenderer.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + } + + double d8 = (double)(((float)(this.rendererUpdateCount & 511) + partialTicks) / 512.0F); + double d9 = this.random.nextDouble() + (double)f * 0.01D * (double)((float)this.random.nextGaussian()); + double d10 = this.random.nextDouble() + (double)(f * (float)this.random.nextGaussian()) * 0.001D; + double d11 = (double)((float)j1 + 0.5F) - entity.posX; + double d12 = (double)((float)i1 + 0.5F) - entity.posZ; + float f6 = MathHelper.sqrt_double(d11 * d11 + d12 * d12) / (float)b0; + float f4 = ((1.0F - f6 * f6) * 0.3F + 0.5F) * f5; + blockpos$mutableblockpos.func_181079_c(j1, k2, i1); + int k3 = (worldclient.getCombinedLight(blockpos$mutableblockpos, 0) * 3 + 15728880) / 4; + int l3 = k3 >> 16 & 65535; + int i4 = k3 & 65535; + worldrenderer.pos((double)j1 - d3 + 0.5D, (double)i2, (double)i1 - d4 + 0.5D).tex(0.0D + d9, (double)i2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f4).lightmap(l3, i4).endVertex(); + worldrenderer.pos((double)j1 + d3 + 0.5D, (double)i2, (double)i1 + d4 + 0.5D).tex(1.0D + d9, (double)i2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f4).lightmap(l3, i4).endVertex(); + worldrenderer.pos((double)j1 + d3 + 0.5D, (double)j2, (double)i1 + d4 + 0.5D).tex(1.0D + d9, (double)j2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f4).lightmap(l3, i4).endVertex(); + worldrenderer.pos((double)j1 - d3 + 0.5D, (double)j2, (double)i1 - d4 + 0.5D).tex(0.0D + d9, (double)j2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f4).lightmap(l3, i4).endVertex(); + } + } + } + } + } + + if (b1 >= 0) + { + tessellator.draw(); + } + + worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); + GlStateManager.enableCull(); + GlStateManager.disableBlend(); + GlStateManager.alphaFunc(516, 0.1F); + this.disableLightmap(); + } + } + + /** + * Setup orthogonal projection for rendering GUI screen overlays + */ + public void setupOverlayRendering() + { + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + GlStateManager.clear(256); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + } + + /** + * calculates fog and calls glClearColor + */ + private void updateFogColor(float partialTicks) + { + WorldClient worldclient = this.mc.theWorld; + Entity entity = this.mc.getRenderViewEntity(); + float f = 0.25F + 0.75F * (float)this.mc.gameSettings.renderDistanceChunks / 32.0F; + f = 1.0F - (float)Math.pow((double)f, 0.25D); + Vec3 vec3 = worldclient.getSkyColor(this.mc.getRenderViewEntity(), partialTicks); + vec3 = CustomColors.getWorldSkyColor(vec3, worldclient, this.mc.getRenderViewEntity(), partialTicks); + float f1 = (float)vec3.xCoord; + float f2 = (float)vec3.yCoord; + float f3 = (float)vec3.zCoord; + Vec3 vec31 = worldclient.getFogColor(partialTicks); + vec31 = CustomColors.getWorldFogColor(vec31, worldclient, this.mc.getRenderViewEntity(), partialTicks); + this.fogColorRed = (float)vec31.xCoord; + this.fogColorGreen = (float)vec31.yCoord; + this.fogColorBlue = (float)vec31.zCoord; + + if (this.mc.gameSettings.renderDistanceChunks >= 4) + { + double d0 = -1.0D; + Vec3 vec32 = MathHelper.sin(worldclient.getCelestialAngleRadians(partialTicks)) > 0.0F ? new Vec3(d0, 0.0D, 0.0D) : new Vec3(1.0D, 0.0D, 0.0D); + float f4 = (float)entity.getLook(partialTicks).dotProduct(vec32); + + if (f4 < 0.0F) + { + f4 = 0.0F; + } + + if (f4 > 0.0F) + { + float[] afloat = worldclient.provider.calcSunriseSunsetColors(worldclient.getCelestialAngle(partialTicks), partialTicks); + + if (afloat != null) + { + f4 = f4 * afloat[3]; + this.fogColorRed = this.fogColorRed * (1.0F - f4) + afloat[0] * f4; + this.fogColorGreen = this.fogColorGreen * (1.0F - f4) + afloat[1] * f4; + this.fogColorBlue = this.fogColorBlue * (1.0F - f4) + afloat[2] * f4; + } + } + } + + this.fogColorRed += (f1 - this.fogColorRed) * f; + this.fogColorGreen += (f2 - this.fogColorGreen) * f; + this.fogColorBlue += (f3 - this.fogColorBlue) * f; + float f10 = worldclient.getRainStrength(partialTicks); + + if (f10 > 0.0F) + { + float f5 = 1.0F - f10 * 0.5F; + float f12 = 1.0F - f10 * 0.4F; + this.fogColorRed *= f5; + this.fogColorGreen *= f5; + this.fogColorBlue *= f12; + } + + float f11 = worldclient.getThunderStrength(partialTicks); + + if (f11 > 0.0F) + { + float f13 = 1.0F - f11 * 0.5F; + this.fogColorRed *= f13; + this.fogColorGreen *= f13; + this.fogColorBlue *= f13; + } + + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + + if (this.cloudFog) + { + Vec3 vec33 = worldclient.getCloudColour(partialTicks); + this.fogColorRed = (float)vec33.xCoord; + this.fogColorGreen = (float)vec33.yCoord; + this.fogColorBlue = (float)vec33.zCoord; + } + else if (block.getMaterial() == Material.water) + { + float f8 = (float)EnchantmentHelper.getRespiration(entity) * 0.2F; + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.waterBreathing)) + { + f8 = f8 * 0.3F + 0.6F; + } + + this.fogColorRed = 0.02F + f8; + this.fogColorGreen = 0.02F + f8; + this.fogColorBlue = 0.2F + f8; + Vec3 vec34 = CustomColors.getUnderwaterColor(this.mc.theWorld, this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().posY + 1.0D, this.mc.getRenderViewEntity().posZ); + + if (vec34 != null) + { + this.fogColorRed = (float)vec34.xCoord; + this.fogColorGreen = (float)vec34.yCoord; + this.fogColorBlue = (float)vec34.zCoord; + } + } + else if (block.getMaterial() == Material.lava) + { + this.fogColorRed = 0.6F; + this.fogColorGreen = 0.1F; + this.fogColorBlue = 0.0F; + } + + float f9 = this.fogColor2 + (this.fogColor1 - this.fogColor2) * partialTicks; + this.fogColorRed *= f9; + this.fogColorGreen *= f9; + this.fogColorBlue *= f9; + double d2 = worldclient.provider.getVoidFogYFactor(); + double d1 = (entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks) * d2; + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) + { + int i = ((EntityLivingBase)entity).getActivePotionEffect(Potion.blindness).getDuration(); + + if (i < 20) + { + d1 *= (double)(1.0F - (float)i / 20.0F); + } + else + { + d1 = 0.0D; + } + } + + if (d1 < 1.0D) + { + if (d1 < 0.0D) + { + d1 = 0.0D; + } + + d1 = d1 * d1; + this.fogColorRed = (float)((double)this.fogColorRed * d1); + this.fogColorGreen = (float)((double)this.fogColorGreen * d1); + this.fogColorBlue = (float)((double)this.fogColorBlue * d1); + } + + if (this.bossColorModifier > 0.0F) + { + float f14 = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * partialTicks; + this.fogColorRed = this.fogColorRed * (1.0F - f14) + this.fogColorRed * 0.7F * f14; + this.fogColorGreen = this.fogColorGreen * (1.0F - f14) + this.fogColorGreen * 0.6F * f14; + this.fogColorBlue = this.fogColorBlue * (1.0F - f14) + this.fogColorBlue * 0.6F * f14; + } + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.nightVision)) + { + float f15 = this.getNightVisionBrightness((EntityLivingBase)entity, partialTicks); + float f6 = 1.0F / this.fogColorRed; + + if (f6 > 1.0F / this.fogColorGreen) + { + f6 = 1.0F / this.fogColorGreen; + } + + if (f6 > 1.0F / this.fogColorBlue) + { + f6 = 1.0F / this.fogColorBlue; + } + + this.fogColorRed = this.fogColorRed * (1.0F - f15) + this.fogColorRed * f6 * f15; + this.fogColorGreen = this.fogColorGreen * (1.0F - f15) + this.fogColorGreen * f6 * f15; + this.fogColorBlue = this.fogColorBlue * (1.0F - f15) + this.fogColorBlue * f6 * f15; + } + + if (this.mc.gameSettings.anaglyph) + { + float f16 = (this.fogColorRed * 30.0F + this.fogColorGreen * 59.0F + this.fogColorBlue * 11.0F) / 100.0F; + float f17 = (this.fogColorRed * 30.0F + this.fogColorGreen * 70.0F) / 100.0F; + float f7 = (this.fogColorRed * 30.0F + this.fogColorBlue * 70.0F) / 100.0F; + this.fogColorRed = f16; + this.fogColorGreen = f17; + this.fogColorBlue = f7; + } + + if (Reflector.EntityViewRenderEvent_FogColors_Constructor.exists()) + { + Object object = Reflector.newInstance(Reflector.EntityViewRenderEvent_FogColors_Constructor, new Object[] {this, entity, block, Float.valueOf(partialTicks), Float.valueOf(this.fogColorRed), Float.valueOf(this.fogColorGreen), Float.valueOf(this.fogColorBlue)}); + Reflector.postForgeBusEvent(object); + this.fogColorRed = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_FogColors_red, this.fogColorRed); + this.fogColorGreen = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_FogColors_green, this.fogColorGreen); + this.fogColorBlue = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_FogColors_blue, this.fogColorBlue); + } + + Shaders.setClearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); + } + + /** + * Sets up the fog to be rendered. If the arg passed in is -1 the fog starts at 0 and goes to 80% of far plane + * distance and is used for sky rendering. + */ + private void setupFog(int p_78468_1_, float partialTicks) + { + Entity entity = this.mc.getRenderViewEntity(); + boolean flag = false; + this.fogStandard = false; + + if (entity instanceof EntityPlayer) + { + flag = ((EntityPlayer)entity).capabilities.isCreativeMode; + } + + GL11.glFog(GL11.GL_FOG_COLOR, (FloatBuffer)this.setFogColorBuffer(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F)); + GL11.glNormal3f(0.0F, -1.0F, 0.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks); + float f1 = -1.0F; + + if (Reflector.ForgeHooksClient_getFogDensity.exists()) + { + f1 = Reflector.callFloat(Reflector.ForgeHooksClient_getFogDensity, new Object[] {this, entity, block, Float.valueOf(partialTicks), Float.valueOf(0.1F)}); + } + + if (f1 >= 0.0F) + { + GlStateManager.setFogDensity(f1); + } + else if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness)) + { + float f2 = 5.0F; + int i = ((EntityLivingBase)entity).getActivePotionEffect(Potion.blindness).getDuration(); + + if (i < 20) + { + f2 = 5.0F + (this.farPlaneDistance - 5.0F) * (1.0F - (float)i / 20.0F); + } + + if (Config.isShaders()) + { + Shaders.setFog(9729); + } + else + { + GlStateManager.setFog(9729); + } + + if (p_78468_1_ == -1) + { + GlStateManager.setFogStart(0.0F); + GlStateManager.setFogEnd(f2 * 0.8F); + } + else + { + GlStateManager.setFogStart(f2 * 0.25F); + GlStateManager.setFogEnd(f2); + } + + if (GLContext.getCapabilities().GL_NV_fog_distance && Config.isFogFancy()) + { + GL11.glFogi(34138, 34139); + } + } + else if (this.cloudFog) + { + if (Config.isShaders()) + { + Shaders.setFog(2048); + } + else + { + GlStateManager.setFog(2048); + } + + GlStateManager.setFogDensity(0.1F); + } + else if (block.getMaterial() == Material.water) + { + if (Config.isShaders()) + { + Shaders.setFog(2048); + } + else + { + GlStateManager.setFog(2048); + } + + if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.waterBreathing)) + { + GlStateManager.setFogDensity(0.01F); + } + else + { + GlStateManager.setFogDensity(0.1F - (float)EnchantmentHelper.getRespiration(entity) * 0.03F); + } + + if (Config.isClearWater()) + { + GlStateManager.setFogDensity(0.02F); + } + } + else if (block.getMaterial() == Material.lava) + { + if (Config.isShaders()) + { + Shaders.setFog(2048); + } + else + { + GlStateManager.setFog(2048); + } + + GlStateManager.setFogDensity(2.0F); + } + else + { + float f = this.farPlaneDistance; + this.fogStandard = true; + + if (Config.isShaders()) + { + Shaders.setFog(9729); + } + else + { + GlStateManager.setFog(9729); + } + + if (p_78468_1_ == -1) + { + GlStateManager.setFogStart(0.0F); + GlStateManager.setFogEnd(f); + } + else + { + GlStateManager.setFogStart(f * Config.getFogStart()); + GlStateManager.setFogEnd(f); + } + + if (GLContext.getCapabilities().GL_NV_fog_distance) + { + if (Config.isFogFancy()) + { + GL11.glFogi(34138, 34139); + } + + if (Config.isFogFast()) + { + GL11.glFogi(34138, 34140); + } + } + + if (this.mc.theWorld.provider.doesXZShowFog((int)entity.posX, (int)entity.posZ)) + { + GlStateManager.setFogStart(f * 0.05F); + GlStateManager.setFogEnd(f); + } + + if (Reflector.ForgeHooksClient_onFogRender.exists()) + { + Reflector.callVoid(Reflector.ForgeHooksClient_onFogRender, new Object[] {this, entity, block, Float.valueOf(partialTicks), Integer.valueOf(p_78468_1_), Float.valueOf(f)}); + } + } + + GlStateManager.enableColorMaterial(); + GlStateManager.enableFog(); + GlStateManager.colorMaterial(1028, 4608); + } + + /** + * Update and return fogColorBuffer with the RGBA values passed as arguments + */ + private FloatBuffer setFogColorBuffer(float red, float green, float blue, float alpha) + { + if (Config.isShaders()) + { + Shaders.setFogColor(red, green, blue); + } + + this.fogColorBuffer.clear(); + this.fogColorBuffer.put(red).put(green).put(blue).put(alpha); + this.fogColorBuffer.flip(); + return this.fogColorBuffer; + } + + public MapItemRenderer getMapItemRenderer() + { + return this.theMapItemRenderer; + } + + private void waitForServerThread() + { + this.serverWaitTimeCurrent = 0; + + if (Config.isSmoothWorld() && Config.isSingleProcessor()) + { + if (this.mc.isIntegratedServerRunning()) + { + IntegratedServer integratedserver = this.mc.getIntegratedServer(); + + if (integratedserver != null) + { + boolean flag = this.mc.isGamePaused(); + + if (!flag && !(this.mc.currentScreen instanceof GuiDownloadTerrain)) + { + if (this.serverWaitTime > 0) + { + Lagometer.timerServer.start(); + Config.sleep((long)this.serverWaitTime); + Lagometer.timerServer.end(); + this.serverWaitTimeCurrent = this.serverWaitTime; + } + + long i = System.nanoTime() / 1000000L; + + if (this.lastServerTime != 0L && this.lastServerTicks != 0) + { + long j = i - this.lastServerTime; + + if (j < 0L) + { + this.lastServerTime = i; + j = 0L; + } + + if (j >= 50L) + { + this.lastServerTime = i; + int k = integratedserver.getTickCounter(); + int l = k - this.lastServerTicks; + + if (l < 0) + { + this.lastServerTicks = k; + l = 0; + } + + if (l < 1 && this.serverWaitTime < 100) + { + this.serverWaitTime += 2; + } + + if (l > 1 && this.serverWaitTime > 0) + { + --this.serverWaitTime; + } + + this.lastServerTicks = k; + } + } + else + { + this.lastServerTime = i; + this.lastServerTicks = integratedserver.getTickCounter(); + this.avgServerTickDiff = 1.0F; + this.avgServerTimeDiff = 50.0F; + } + } + else + { + if (this.mc.currentScreen instanceof GuiDownloadTerrain) + { + Config.sleep(20L); + } + + this.lastServerTime = 0L; + this.lastServerTicks = 0; + } + } + } + } + else + { + this.lastServerTime = 0L; + this.lastServerTicks = 0; + } + } + + private void frameInit() + { + if (!this.initialized) + { + TextureUtils.registerResourceListener(); + + if (Config.getBitsOs() == 64 && Config.getBitsJre() == 32) + { + Config.setNotify64BitJava(true); + } + + this.initialized = true; + } + + Config.checkDisplayMode(); + World world = this.mc.theWorld; + + if (world != null) + { + if (Config.getNewRelease() != null) + { + String s = "HD_U".replace("HD_U", "HD Ultra").replace("L", "Light"); + String s1 = s + " " + Config.getNewRelease(); + ChatComponentText chatcomponenttext = new ChatComponentText(I18n.format("of.message.newVersion", new Object[] {s1})); + this.mc.ingameGUI.getChatGUI().printChatMessage(chatcomponenttext); + Config.setNewRelease((String)null); + } + + if (Config.isNotify64BitJava()) + { + Config.setNotify64BitJava(false); + ChatComponentText chatcomponenttext1 = new ChatComponentText(I18n.format("of.message.java64Bit", new Object[0])); + this.mc.ingameGUI.getChatGUI().printChatMessage(chatcomponenttext1); + } + } + + if (this.mc.currentScreen instanceof MainMenu) + { + this.updateMainMenu((MainMenu)this.mc.currentScreen); + } + + if (this.updatedWorld != world) + { + RandomMobs.worldChanged(this.updatedWorld, world); + Config.updateThreadPriorities(); + this.lastServerTime = 0L; + this.lastServerTicks = 0; + this.updatedWorld = world; + } + + if (!this.setFxaaShader(Shaders.configAntialiasingLevel)) + { + Shaders.configAntialiasingLevel = 0; + } + } + + private void frameFinish() + { + if (this.mc.theWorld != null) + { + long i = System.currentTimeMillis(); + + if (i > this.lastErrorCheckTimeMs + 10000L) + { + this.lastErrorCheckTimeMs = i; + int j = GL11.glGetError(); + + if (j != 0) + { + String s = GLU.gluErrorString(j); + ChatComponentText chatcomponenttext = new ChatComponentText(I18n.format("of.message.openglError", new Object[] {Integer.valueOf(j), s})); + this.mc.ingameGUI.getChatGUI().printChatMessage(chatcomponenttext); + } + } + } + } + + private void updateMainMenu(MainMenu p_updateMainMenu_1_) + { + try + { + String s = null; + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + int i = calendar.get(5); + int j = calendar.get(2) + 1; + + if (i == 8 && j == 4) + { + s = "Happy birthday, OptiFine!"; + } + + if (i == 14 && j == 8) + { + s = "Happy birthday, sp614x!"; + } + + if (s == null) + { + return; + } + + Field[] afield = MainMenu.class.getDeclaredFields(); + + for (int k = 0; k < afield.length; ++k) + { + if (afield[k].getType() == String.class) + { + afield[k].setAccessible(true); + afield[k].set(p_updateMainMenu_1_, s); + break; + } + } + } + catch (Throwable var8) + { + ; + } + } + + public boolean setFxaaShader(int p_setFxaaShader_1_) + { + if (!OpenGlHelper.isFramebufferEnabled()) + { + return false; + } + else if (this.theShaderGroup != null && this.theShaderGroup != this.fxaaShaders[2] && this.theShaderGroup != this.fxaaShaders[4]) + { + return true; + } + else if (p_setFxaaShader_1_ != 2 && p_setFxaaShader_1_ != 4) + { + if (this.theShaderGroup == null) + { + return true; + } + else + { + this.theShaderGroup.deleteShaderGroup(); + this.theShaderGroup = null; + return true; + } + } + else if (this.theShaderGroup != null && this.theShaderGroup == this.fxaaShaders[p_setFxaaShader_1_]) + { + return true; + } + else if (this.mc.theWorld == null) + { + return true; + } + else + { + this.loadShader(new ResourceLocation("shaders/post/fxaa_of_" + p_setFxaaShader_1_ + "x.json")); + this.fxaaShaders[p_setFxaaShader_1_] = this.theShaderGroup; + return this.useShader; + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/EntityRenderer1.java b/src/minecraft/net/minecraft/client/renderer/EntityRenderer1.java new file mode 100644 index 0000000..d31537c --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/EntityRenderer1.java @@ -0,0 +1,24 @@ +package net.minecraft.client.renderer; + +import com.google.common.base.Predicate; +import net.minecraft.entity.Entity; + +class EntityRenderer1 implements Predicate +{ + final EntityRenderer field_90032_a; + + EntityRenderer1(EntityRenderer p_i1243_1_) + { + this.field_90032_a = p_i1243_1_; + } + + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_.canBeCollidedWith(); + } + + public boolean apply(Object p_apply_1_) + { + return this.apply((Entity)p_apply_1_); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/EntityRenderer2.java b/src/minecraft/net/minecraft/client/renderer/EntityRenderer2.java new file mode 100644 index 0000000..499f468 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/EntityRenderer2.java @@ -0,0 +1,20 @@ +package net.minecraft.client.renderer; + +import java.util.concurrent.Callable; +import net.minecraft.client.Minecraft; + +class EntityRenderer2 implements Callable +{ + final EntityRenderer field_90025_c; + private static final String __OBFID = "CL_00000948"; + + EntityRenderer2(EntityRenderer p_i46419_1_) + { + this.field_90025_c = p_i46419_1_; + } + + public String call() throws Exception + { + return Minecraft.getMinecraft().currentScreen.getClass().getCanonicalName(); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/EntityRendere~ b/src/minecraft/net/minecraft/client/renderer/EntityRendere~ new file mode 100644 index 0000000..24c515a --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/EntityRendere~ @@ -0,0 +1,2180 @@ +package net.minecraft.client.renderer; + +import com.google.common.base.Predicates; +import com.google.gson.JsonSyntaxException; +import java.io.IOException; +import java.lang.reflect.Field; +import java.nio.FloatBuffer; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Random; +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.gui.GuiDownloadTerrain; +import net.minecraft.client.gui.GuiMainMenu; +import net.minecraft.client.gui.MapItemRenderer; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.particle.EffectRenderer; +import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.renderer.EntityRenderer$1; +import net.minecraft.client.renderer.EntityRenderer$2; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.culling.ClippingHelperImpl; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.shader.ShaderGroup; +import net.minecraft.client.shader.ShaderLinkHelper; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.BossStatus; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.server.integrated.IntegratedServer; +import net.minecraft.src.Config; +import net.minecraft.src.CustomColors; +import net.minecraft.src.Lagometer; +import net.minecraft.src.RandomMobs; +import net.minecraft.src.Reflector; +import net.minecraft.src.ReflectorForge; +import net.minecraft.src.TextureUtils; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MouseFilter; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.biome.BiomeGenBase; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.util.glu.GLU; +import org.lwjgl.util.glu.Project; +import shadersmod.client.Shaders; +import shadersmod.client.ShadersRender; + +public class EntityRenderer implements IResourceManagerReloadListener { + private static final Logger field_147710_q = LogManager.getLogger(); + private static final ResourceLocation field_110924_q = new ResourceLocation("textures/environment/rain.png"); + private static final ResourceLocation field_110923_r = new ResourceLocation("textures/environment/snow.png"); + public static boolean field_78517_a; + public static int field_78515_b; + private Minecraft field_78531_r; + private final IResourceManager field_147711_ac; + private Random field_78537_ab = new Random(); + private float field_78530_s; + public ItemRenderer field_78516_c; + private final MapItemRenderer field_147709_v; + private int field_78529_t; + private Entity field_78528_u; + private MouseFilter field_78527_v = new MouseFilter(); + private MouseFilter field_78526_w = new MouseFilter(); + private float field_78490_B = 4.0F; + private float field_78491_C = 4.0F; + private float field_78496_H; + private float field_78497_I; + private float field_78498_J; + private float field_78499_K; + private float field_78492_L; + private float field_78507_R; + private float field_78506_S; + private float field_82831_U; + private float field_82832_V; + private boolean field_78500_U; + private boolean field_175074_C = true; + private boolean field_175073_D = true; + private long field_78508_Y = Minecraft.func_71386_F(); + private long field_78510_Z; + private final DynamicTexture field_78513_d; + private final int[] field_78504_Q; + private final ResourceLocation field_110922_T; + private boolean field_78536_aa; + private float field_78514_e; + private float field_175075_L; + private int field_78534_ac; + private float[] field_175076_N = new float[1024]; + private float[] field_175077_O = new float[1024]; + private FloatBuffer field_78521_m = GLAllocation.func_74529_h(16); + public float field_175080_Q; + public float field_175082_R; + public float field_175081_S; + private float field_78535_ad; + private float field_78539_ae; + private int field_175079_V = 0; + private boolean field_175078_W = false; + private double field_78503_V = 1.0D; + private double field_78502_W; + private double field_78509_X; + private ShaderGroup field_147707_d; + private static final ResourceLocation[] field_147712_ad = new ResourceLocation[]{new ResourceLocation("shaders/post/notch.json"), new ResourceLocation("shaders/post/fxaa.json"), new ResourceLocation("shaders/post/art.json"), new ResourceLocation("shaders/post/bumpy.json"), new ResourceLocation("shaders/post/blobs2.json"), new ResourceLocation("shaders/post/pencil.json"), new ResourceLocation("shaders/post/color_convolve.json"), new ResourceLocation("shaders/post/deconverge.json"), new ResourceLocation("shaders/post/flip.json"), new ResourceLocation("shaders/post/invert.json"), new ResourceLocation("shaders/post/ntsc.json"), new ResourceLocation("shaders/post/outline.json"), new ResourceLocation("shaders/post/phosphor.json"), new ResourceLocation("shaders/post/scan_pincushion.json"), new ResourceLocation("shaders/post/sobel.json"), new ResourceLocation("shaders/post/bits.json"), new ResourceLocation("shaders/post/desaturate.json"), new ResourceLocation("shaders/post/green.json"), new ResourceLocation("shaders/post/blur.json"), new ResourceLocation("shaders/post/wobble.json"), new ResourceLocation("shaders/post/blobs.json"), new ResourceLocation("shaders/post/antialias.json"), new ResourceLocation("shaders/post/creeper.json"), new ResourceLocation("shaders/post/spider.json")}; + public static final int field_147708_e = field_147712_ad.length; + private int field_147713_ae; + private boolean field_175083_ad; + public int field_175084_ae; + private static final String __OBFID = "CL_00000947"; + private boolean initialized = false; + private World updatedWorld = null; + private boolean showDebugInfo = false; + public boolean fogStandard = false; + private float clipDistance = 128.0F; + private long lastServerTime = 0L; + private int lastServerTicks = 0; + private int serverWaitTime = 0; + private int serverWaitTimeCurrent = 0; + private float avgServerTimeDiff = 0.0F; + private float avgServerTickDiff = 0.0F; + private long lastErrorCheckTimeMs = 0L; + private ShaderGroup[] fxaaShaders = new ShaderGroup[10]; + + public EntityRenderer(Minecraft p_i45076_1_, IResourceManager p_i45076_2_) { + this.field_147713_ae = field_147708_e; + this.field_175083_ad = false; + this.field_175084_ae = 0; + this.field_78531_r = p_i45076_1_; + this.field_147711_ac = p_i45076_2_; + this.field_78516_c = p_i45076_1_.func_175597_ag(); + this.field_147709_v = new MapItemRenderer(p_i45076_1_.func_110434_K()); + this.field_78513_d = new DynamicTexture(16, 16); + this.field_110922_T = p_i45076_1_.func_110434_K().func_110578_a("lightMap", this.field_78513_d); + this.field_78504_Q = this.field_78513_d.func_110565_c(); + this.field_147707_d = null; + + for(int i = 0; i < 32; ++i) { + for(int j = 0; j < 32; ++j) { + float f = (float)(j - 16); + float f1 = (float)(i - 16); + float f2 = MathHelper.func_76129_c(f * f + f1 * f1); + this.field_175076_N[i << 5 | j] = -f1 / f2; + this.field_175077_O[i << 5 | j] = f / f2; + } + } + + } + + public boolean func_147702_a() { + return OpenGlHelper.field_148824_g && this.field_147707_d != null; + } + + public void func_181022_b() { + if(this.field_147707_d != null) { + this.field_147707_d.func_148021_a(); + } + + this.field_147707_d = null; + this.field_147713_ae = field_147708_e; + } + + public void func_175071_c() { + this.field_175083_ad = !this.field_175083_ad; + } + + public void func_175066_a(Entity p_175066_1_) { + if(OpenGlHelper.field_148824_g) { + if(this.field_147707_d != null) { + this.field_147707_d.func_148021_a(); + } + + this.field_147707_d = null; + if(p_175066_1_ instanceof EntityCreeper) { + this.func_175069_a(new ResourceLocation("shaders/post/creeper.json")); + } else if(p_175066_1_ instanceof EntitySpider) { + this.func_175069_a(new ResourceLocation("shaders/post/spider.json")); + } else if(p_175066_1_ instanceof EntityEnderman) { + this.func_175069_a(new ResourceLocation("shaders/post/invert.json")); + } else if(Reflector.ForgeHooksClient_loadEntityShader.exists()) { + Reflector.call(Reflector.ForgeHooksClient_loadEntityShader, new Object[]{p_175066_1_, this}); + } + } + + } + + public void func_147705_c() { + if(OpenGlHelper.field_148824_g && this.field_78531_r.func_175606_aa() instanceof EntityPlayer) { + if(this.field_147707_d != null) { + this.field_147707_d.func_148021_a(); + } + + this.field_147713_ae = (this.field_147713_ae + 1) % (field_147712_ad.length + 1); + if(this.field_147713_ae != field_147708_e) { + this.func_175069_a(field_147712_ad[this.field_147713_ae]); + } else { + this.field_147707_d = null; + } + } + + } + + private void func_175069_a(ResourceLocation p_175069_1_) { + if(OpenGlHelper.func_148822_b()) { + try { + this.field_147707_d = new ShaderGroup(this.field_78531_r.func_110434_K(), this.field_147711_ac, this.field_78531_r.func_147110_a(), p_175069_1_); + this.field_147707_d.func_148026_a(this.field_78531_r.field_71443_c, this.field_78531_r.field_71440_d); + this.field_175083_ad = true; + } catch (IOException ioexception) { + field_147710_q.warn((String)("Failed to load shader: " + p_175069_1_), (Throwable)ioexception); + this.field_147713_ae = field_147708_e; + this.field_175083_ad = false; + } catch (JsonSyntaxException jsonsyntaxexception) { + field_147710_q.warn((String)("Failed to load shader: " + p_175069_1_), (Throwable)jsonsyntaxexception); + this.field_147713_ae = field_147708_e; + this.field_175083_ad = false; + } + + } + } + + public void func_110549_a(IResourceManager p_110549_1_) { + if(this.field_147707_d != null) { + this.field_147707_d.func_148021_a(); + } + + this.field_147707_d = null; + if(this.field_147713_ae != field_147708_e) { + this.func_175069_a(field_147712_ad[this.field_147713_ae]); + } else { + this.func_175066_a(this.field_78531_r.func_175606_aa()); + } + + } + + public void func_78464_a() { + if(OpenGlHelper.field_148824_g && ShaderLinkHelper.func_148074_b() == null) { + ShaderLinkHelper.func_148076_a(); + } + + this.func_78477_e(); + this.func_78470_f(); + this.field_78535_ad = this.field_78539_ae; + this.field_78491_C = this.field_78490_B; + if(this.field_78531_r.field_71474_y.field_74326_T) { + float f = this.field_78531_r.field_71474_y.field_74341_c * 0.6F + 0.2F; + float f1 = f * f * f * 8.0F; + this.field_78498_J = this.field_78527_v.func_76333_a(this.field_78496_H, 0.05F * f1); + this.field_78499_K = this.field_78526_w.func_76333_a(this.field_78497_I, 0.05F * f1); + this.field_78492_L = 0.0F; + this.field_78496_H = 0.0F; + this.field_78497_I = 0.0F; + } else { + this.field_78498_J = 0.0F; + this.field_78499_K = 0.0F; + this.field_78527_v.func_180179_a(); + this.field_78526_w.func_180179_a(); + } + + if(this.field_78531_r.func_175606_aa() == null) { + this.field_78531_r.func_175607_a(this.field_78531_r.field_71439_g); + } + + Entity entity = this.field_78531_r.func_175606_aa(); + double d0 = entity.field_70165_t; + double d1 = entity.field_70163_u + (double)entity.func_70047_e(); + double d2 = entity.field_70161_v; + float f3 = this.field_78531_r.field_71441_e.func_175724_o(new BlockPos(d0, d1, d2)); + float f4 = (float)this.field_78531_r.field_71474_y.field_151451_c / 16.0F; + f4 = MathHelper.func_76131_a(f4, 0.0F, 1.0F); + float f2 = f3 * (1.0F - f4) + f4; + this.field_78539_ae += (f2 - this.field_78539_ae) * 0.1F; + ++this.field_78529_t; + this.field_78516_c.func_78441_a(); + this.func_78484_h(); + this.field_82832_V = this.field_82831_U; + if(BossStatus.field_82825_d) { + this.field_82831_U += 0.05F; + if(this.field_82831_U > 1.0F) { + this.field_82831_U = 1.0F; + } + + BossStatus.field_82825_d = false; + } else if(this.field_82831_U > 0.0F) { + this.field_82831_U -= 0.0125F; + } + + } + + public ShaderGroup func_147706_e() { + return this.field_147707_d; + } + + public void func_147704_a(int p_147704_1_, int p_147704_2_) { + if(OpenGlHelper.field_148824_g) { + if(this.field_147707_d != null) { + this.field_147707_d.func_148026_a(p_147704_1_, p_147704_2_); + } + + this.field_78531_r.field_71438_f.func_72720_a(p_147704_1_, p_147704_2_); + } + + } + + public void func_78473_a(float p_78473_1_) { + Entity entity = this.field_78531_r.func_175606_aa(); + if(entity != null && this.field_78531_r.field_71441_e != null) { + this.field_78531_r.field_71424_I.func_76320_a("pick"); + this.field_78531_r.field_147125_j = null; + double d0 = (double)this.field_78531_r.field_71442_b.func_78757_d(); + this.field_78531_r.field_71476_x = entity.func_174822_a(d0, p_78473_1_); + double d1 = d0; + Vec3 vec3 = entity.func_174824_e(p_78473_1_); + boolean flag = false; + boolean flag1 = true; + if(this.field_78531_r.field_71442_b.func_78749_i()) { + d0 = 6.0D; + d1 = 6.0D; + } else { + if(d0 > 3.0D) { + flag = true; + } + + d0 = d0; + } + + if(this.field_78531_r.field_71476_x != null) { + d1 = this.field_78531_r.field_71476_x.field_72307_f.func_72438_d(vec3); + } + + Vec3 vec31 = entity.func_70676_i(p_78473_1_); + Vec3 vec32 = vec3.func_72441_c(vec31.field_72450_a * d0, vec31.field_72448_b * d0, vec31.field_72449_c * d0); + this.field_78528_u = null; + Vec3 vec33 = null; + float f = 1.0F; + List list = this.field_78531_r.field_71441_e.func_175674_a(entity, entity.func_174813_aQ().func_72321_a(vec31.field_72450_a * d0, vec31.field_72448_b * d0, vec31.field_72449_c * d0).func_72314_b((double)f, (double)f, (double)f), Predicates.and(EntitySelectors.field_180132_d, new EntityRenderer$1(this))); + double d2 = d1; + + for(int i = 0; i < list.size(); ++i) { + Entity entity1 = (Entity)list.get(i); + float f1 = entity1.func_70111_Y(); + AxisAlignedBB axisalignedbb = entity1.func_174813_aQ().func_72314_b((double)f1, (double)f1, (double)f1); + MovingObjectPosition movingobjectposition = axisalignedbb.func_72327_a(vec3, vec32); + if(axisalignedbb.func_72318_a(vec3)) { + if(d2 >= 0.0D) { + this.field_78528_u = entity1; + vec33 = movingobjectposition == null?vec3:movingobjectposition.field_72307_f; + d2 = 0.0D; + } + } else if(movingobjectposition != null) { + double d3 = vec3.func_72438_d(movingobjectposition.field_72307_f); + if(d3 < d2 || d2 == 0.0D) { + boolean flag2 = false; + if(Reflector.ForgeEntity_canRiderInteract.exists()) { + flag2 = Reflector.callBoolean(entity1, Reflector.ForgeEntity_canRiderInteract, new Object[0]); + } + + if(entity1 == entity.field_70154_o && !flag2) { + if(d2 == 0.0D) { + this.field_78528_u = entity1; + vec33 = movingobjectposition.field_72307_f; + } + } else { + this.field_78528_u = entity1; + vec33 = movingobjectposition.field_72307_f; + d2 = d3; + } + } + } + } + + if(this.field_78528_u != null && flag && vec3.func_72438_d(vec33) > 3.0D) { + this.field_78528_u = null; + this.field_78531_r.field_71476_x = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec33, (EnumFacing)null, new BlockPos(vec33)); + } + + if(this.field_78528_u != null && (d2 < d1 || this.field_78531_r.field_71476_x == null)) { + this.field_78531_r.field_71476_x = new MovingObjectPosition(this.field_78528_u, vec33); + if(this.field_78528_u instanceof EntityLivingBase || this.field_78528_u instanceof EntityItemFrame) { + this.field_78531_r.field_147125_j = this.field_78528_u; + } + } + + this.field_78531_r.field_71424_I.func_76319_b(); + } + + } + + private void func_78477_e() { + float f = 1.0F; + if(this.field_78531_r.func_175606_aa() instanceof AbstractClientPlayer) { + AbstractClientPlayer abstractclientplayer = (AbstractClientPlayer)this.field_78531_r.func_175606_aa(); + f = abstractclientplayer.func_175156_o(); + } + + this.field_78506_S = this.field_78507_R; + this.field_78507_R += (f - this.field_78507_R) * 0.5F; + if(this.field_78507_R > 1.5F) { + this.field_78507_R = 1.5F; + } + + if(this.field_78507_R < 0.1F) { + this.field_78507_R = 0.1F; + } + + } + + private float func_78481_a(float p_78481_1_, boolean p_78481_2_) { + if(this.field_175078_W) { + return 90.0F; + } else { + Entity entity = this.field_78531_r.func_175606_aa(); + float f = 70.0F; + if(p_78481_2_) { + f = this.field_78531_r.field_71474_y.field_74334_X; + if(Config.isDynamicFov()) { + f *= this.field_78506_S + (this.field_78507_R - this.field_78506_S) * p_78481_1_; + } + } + + boolean flag = false; + if(this.field_78531_r.field_71462_r == null) { + GameSettings gamesettings = this.field_78531_r.field_71474_y; + flag = GameSettings.func_100015_a(this.field_78531_r.field_71474_y.ofKeyBindZoom); + } + + if(flag) { + if(!Config.zoomMode) { + Config.zoomMode = true; + this.field_78531_r.field_71474_y.field_74326_T = true; + } + + if(Config.zoomMode) { + f /= 4.0F; + } + } else if(Config.zoomMode) { + Config.zoomMode = false; + this.field_78531_r.field_71474_y.field_74326_T = false; + this.field_78527_v = new MouseFilter(); + this.field_78526_w = new MouseFilter(); + this.field_78531_r.field_71438_f.field_147595_R = true; + } + + if(entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_110143_aJ() <= 0.0F) { + float f1 = (float)((EntityLivingBase)entity).field_70725_aQ + p_78481_1_; + f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F; + } + + Block block = ActiveRenderInfo.func_180786_a(this.field_78531_r.field_71441_e, entity, p_78481_1_); + if(block.func_149688_o() == Material.field_151586_h) { + f = f * 60.0F / 70.0F; + } + + return f; + } + } + + private void func_78482_e(float p_78482_1_) { + if(this.field_78531_r.func_175606_aa() instanceof EntityLivingBase) { + EntityLivingBase entitylivingbase = (EntityLivingBase)this.field_78531_r.func_175606_aa(); + float f = (float)entitylivingbase.field_70737_aN - p_78482_1_; + if(entitylivingbase.func_110143_aJ() <= 0.0F) { + float f1 = (float)entitylivingbase.field_70725_aQ + p_78482_1_; + GlStateManager.func_179114_b(40.0F - 8000.0F / (f1 + 200.0F), 0.0F, 0.0F, 1.0F); + } + + if(f < 0.0F) { + return; + } + + f = f / (float)entitylivingbase.field_70738_aO; + f = MathHelper.func_76126_a(f * f * f * f * 3.1415927F); + float f2 = entitylivingbase.field_70739_aP; + GlStateManager.func_179114_b(-f2, 0.0F, 1.0F, 0.0F); + GlStateManager.func_179114_b(-f * 14.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.func_179114_b(f2, 0.0F, 1.0F, 0.0F); + } + + } + + private void func_78475_f(float p_78475_1_) { + if(this.field_78531_r.func_175606_aa() instanceof EntityPlayer) { + EntityPlayer entityplayer = (EntityPlayer)this.field_78531_r.func_175606_aa(); + float f = entityplayer.field_70140_Q - entityplayer.field_70141_P; + float f1 = -(entityplayer.field_70140_Q + f * p_78475_1_); + float f2 = entityplayer.field_71107_bF + (entityplayer.field_71109_bG - entityplayer.field_71107_bF) * p_78475_1_; + float f3 = entityplayer.field_70727_aS + (entityplayer.field_70726_aT - entityplayer.field_70727_aS) * p_78475_1_; + GlStateManager.func_179109_b(MathHelper.func_76126_a(f1 * 3.1415927F) * f2 * 0.5F, -Math.abs(MathHelper.func_76134_b(f1 * 3.1415927F) * f2), 0.0F); + GlStateManager.func_179114_b(MathHelper.func_76126_a(f1 * 3.1415927F) * f2 * 3.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.func_179114_b(Math.abs(MathHelper.func_76134_b(f1 * 3.1415927F - 0.2F) * f2) * 5.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.func_179114_b(f3, 1.0F, 0.0F, 0.0F); + } + + } + + private void func_78467_g(float p_78467_1_) { + Entity entity = this.field_78531_r.func_175606_aa(); + float f = entity.func_70047_e(); + double d0 = entity.field_70169_q + (entity.field_70165_t - entity.field_70169_q) * (double)p_78467_1_; + double d1 = entity.field_70167_r + (entity.field_70163_u - entity.field_70167_r) * (double)p_78467_1_ + (double)f; + double d2 = entity.field_70166_s + (entity.field_70161_v - entity.field_70166_s) * (double)p_78467_1_; + if(entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70608_bn()) { + f = (float)((double)f + 1.0D); + GlStateManager.func_179109_b(0.0F, 0.3F, 0.0F); + if(!this.field_78531_r.field_71474_y.field_74325_U) { + BlockPos blockpos = new BlockPos(entity); + IBlockState iblockstate = this.field_78531_r.field_71441_e.func_180495_p(blockpos); + Block block = iblockstate.func_177230_c(); + if(Reflector.ForgeHooksClient_orientBedCamera.exists()) { + Reflector.callVoid(Reflector.ForgeHooksClient_orientBedCamera, new Object[]{this.field_78531_r.field_71441_e, blockpos, iblockstate, entity}); + } else if(block == Blocks.field_150324_C) { + int j = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_176387_N)).func_176736_b(); + GlStateManager.func_179114_b((float)(j * 90), 0.0F, 1.0F, 0.0F); + } + + GlStateManager.func_179114_b(entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F); + GlStateManager.func_179114_b(entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_, -1.0F, 0.0F, 0.0F); + } + } else if(this.field_78531_r.field_71474_y.field_74320_O > 0) { + double d3 = (double)(this.field_78491_C + (this.field_78490_B - this.field_78491_C) * p_78467_1_); + if(this.field_78531_r.field_71474_y.field_74325_U) { + GlStateManager.func_179109_b(0.0F, 0.0F, (float)(-d3)); + } else { + float f1 = entity.field_70177_z; + float f2 = entity.field_70125_A; + if(this.field_78531_r.field_71474_y.field_74320_O == 2) { + f2 += 180.0F; + } + + double d4 = (double)(-MathHelper.func_76126_a(f1 / 180.0F * 3.1415927F) * MathHelper.func_76134_b(f2 / 180.0F * 3.1415927F)) * d3; + double d5 = (double)(MathHelper.func_76134_b(f1 / 180.0F * 3.1415927F) * MathHelper.func_76134_b(f2 / 180.0F * 3.1415927F)) * d3; + double d6 = (double)(-MathHelper.func_76126_a(f2 / 180.0F * 3.1415927F)) * d3; + + for(int i = 0; i < 8; ++i) { + float f3 = (float)((i & 1) * 2 - 1); + float f4 = (float)((i >> 1 & 1) * 2 - 1); + float f5 = (float)((i >> 2 & 1) * 2 - 1); + f3 = f3 * 0.1F; + f4 = f4 * 0.1F; + f5 = f5 * 0.1F; + MovingObjectPosition movingobjectposition = this.field_78531_r.field_71441_e.func_72933_a(new Vec3(d0 + (double)f3, d1 + (double)f4, d2 + (double)f5), new Vec3(d0 - d4 + (double)f3 + (double)f5, d1 - d6 + (double)f4, d2 - d5 + (double)f5)); + if(movingobjectposition != null) { + double d7 = movingobjectposition.field_72307_f.func_72438_d(new Vec3(d0, d1, d2)); + if(d7 < d3) { + d3 = d7; + } + } + } + + if(this.field_78531_r.field_71474_y.field_74320_O == 2) { + GlStateManager.func_179114_b(180.0F, 0.0F, 1.0F, 0.0F); + } + + GlStateManager.func_179114_b(entity.field_70125_A - f2, 1.0F, 0.0F, 0.0F); + GlStateManager.func_179114_b(entity.field_70177_z - f1, 0.0F, 1.0F, 0.0F); + GlStateManager.func_179109_b(0.0F, 0.0F, (float)(-d3)); + GlStateManager.func_179114_b(f1 - entity.field_70177_z, 0.0F, 1.0F, 0.0F); + GlStateManager.func_179114_b(f2 - entity.field_70125_A, 1.0F, 0.0F, 0.0F); + } + } else { + GlStateManager.func_179109_b(0.0F, 0.0F, -0.1F); + } + + if(Reflector.EntityViewRenderEvent_CameraSetup_Constructor.exists()) { + if(!this.field_78531_r.field_71474_y.field_74325_U) { + float f6 = entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F; + float f7 = entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_; + float f8 = 0.0F; + if(entity instanceof EntityAnimal) { + EntityAnimal entityanimal = (EntityAnimal)entity; + f6 = entityanimal.field_70758_at + (entityanimal.field_70759_as - entityanimal.field_70758_at) * p_78467_1_ + 180.0F; + } + + Block block1 = ActiveRenderInfo.func_180786_a(this.field_78531_r.field_71441_e, entity, p_78467_1_); + Object object = Reflector.newInstance(Reflector.EntityViewRenderEvent_CameraSetup_Constructor, new Object[]{this, entity, block1, Float.valueOf(p_78467_1_), Float.valueOf(f6), Float.valueOf(f7), Float.valueOf(f8)}); + Reflector.postForgeBusEvent(object); + f8 = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_CameraSetup_roll, f8); + f7 = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_CameraSetup_pitch, f7); + f6 = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_CameraSetup_yaw, f6); + GlStateManager.func_179114_b(f8, 0.0F, 0.0F, 1.0F); + GlStateManager.func_179114_b(f7, 1.0F, 0.0F, 0.0F); + GlStateManager.func_179114_b(f6, 0.0F, 1.0F, 0.0F); + } + } else if(!this.field_78531_r.field_71474_y.field_74325_U) { + GlStateManager.func_179114_b(entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_, 1.0F, 0.0F, 0.0F); + if(entity instanceof EntityAnimal) { + EntityAnimal entityanimal1 = (EntityAnimal)entity; + GlStateManager.func_179114_b(entityanimal1.field_70758_at + (entityanimal1.field_70759_as - entityanimal1.field_70758_at) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); + } else { + GlStateManager.func_179114_b(entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F); + } + } + + GlStateManager.func_179109_b(0.0F, -f, 0.0F); + d0 = entity.field_70169_q + (entity.field_70165_t - entity.field_70169_q) * (double)p_78467_1_; + d1 = entity.field_70167_r + (entity.field_70163_u - entity.field_70167_r) * (double)p_78467_1_ + (double)f; + d2 = entity.field_70166_s + (entity.field_70161_v - entity.field_70166_s) * (double)p_78467_1_; + this.field_78500_U = this.field_78531_r.field_71438_f.func_72721_a(d0, d1, d2, p_78467_1_); + } + + public void func_78479_a(float p_78479_1_, int p_78479_2_) { + this.field_78530_s = (float)(this.field_78531_r.field_71474_y.field_151451_c * 16); + if(Config.isFogFancy()) { + this.field_78530_s *= 0.95F; + } + + if(Config.isFogFast()) { + this.field_78530_s *= 0.83F; + } + + GlStateManager.func_179128_n(5889); + GlStateManager.func_179096_D(); + float f = 0.07F; + if(this.field_78531_r.field_71474_y.field_74337_g) { + GlStateManager.func_179109_b((float)(-(p_78479_2_ * 2 - 1)) * f, 0.0F, 0.0F); + } + + this.clipDistance = this.field_78530_s * 2.0F; + if(this.clipDistance < 173.0F) { + this.clipDistance = 173.0F; + } + + if(this.field_78531_r.field_71441_e.field_73011_w.func_177502_q() == 1) { + this.clipDistance = 256.0F; + } + + if(this.field_78503_V != 1.0D) { + GlStateManager.func_179109_b((float)this.field_78502_W, (float)(-this.field_78509_X), 0.0F); + GlStateManager.func_179139_a(this.field_78503_V, this.field_78503_V, 1.0D); + } + + Project.gluPerspective(this.func_78481_a(p_78479_1_, true), (float)this.field_78531_r.field_71443_c / (float)this.field_78531_r.field_71440_d, 0.05F, this.clipDistance); + GlStateManager.func_179128_n(5888); + GlStateManager.func_179096_D(); + if(this.field_78531_r.field_71474_y.field_74337_g) { + GlStateManager.func_179109_b((float)(p_78479_2_ * 2 - 1) * 0.1F, 0.0F, 0.0F); + } + + this.func_78482_e(p_78479_1_); + if(this.field_78531_r.field_71474_y.field_74336_f) { + this.func_78475_f(p_78479_1_); + } + + float f1 = this.field_78531_r.field_71439_g.field_71080_cy + (this.field_78531_r.field_71439_g.field_71086_bY - this.field_78531_r.field_71439_g.field_71080_cy) * p_78479_1_; + if(f1 > 0.0F) { + byte b0 = 20; + if(this.field_78531_r.field_71439_g.func_70644_a(Potion.field_76431_k)) { + b0 = 7; + } + + float f2 = 5.0F / (f1 * f1 + 5.0F) - f1 * 0.04F; + f2 = f2 * f2; + GlStateManager.func_179114_b(((float)this.field_78529_t + p_78479_1_) * (float)b0, 0.0F, 1.0F, 1.0F); + GlStateManager.func_179152_a(1.0F / f2, 1.0F, 1.0F); + GlStateManager.func_179114_b(-((float)this.field_78529_t + p_78479_1_) * (float)b0, 0.0F, 1.0F, 1.0F); + } + + this.func_78467_g(p_78479_1_); + if(this.field_175078_W) { + switch(this.field_175079_V) { + case 0: + GlStateManager.func_179114_b(90.0F, 0.0F, 1.0F, 0.0F); + break; + case 1: + GlStateManager.func_179114_b(180.0F, 0.0F, 1.0F, 0.0F); + break; + case 2: + GlStateManager.func_179114_b(-90.0F, 0.0F, 1.0F, 0.0F); + break; + case 3: + GlStateManager.func_179114_b(90.0F, 1.0F, 0.0F, 0.0F); + break; + case 4: + GlStateManager.func_179114_b(-90.0F, 1.0F, 0.0F, 0.0F); + } + } + + } + + private void func_78476_b(float p_78476_1_, int p_78476_2_) { + this.renderHand(p_78476_1_, p_78476_2_, true, true, false); + } + + public void renderHand(float p_renderHand_1_, int p_renderHand_2_, boolean p_renderHand_3_, boolean p_renderHand_4_, boolean p_renderHand_5_) { + if(!this.field_175078_W) { + GlStateManager.func_179128_n(5889); + GlStateManager.func_179096_D(); + float f = 0.07F; + if(this.field_78531_r.field_71474_y.field_74337_g) { + GlStateManager.func_179109_b((float)(-(p_renderHand_2_ * 2 - 1)) * f, 0.0F, 0.0F); + } + + if(Config.isShaders()) { + Shaders.applyHandDepth(); + } + + Project.gluPerspective(this.func_78481_a(p_renderHand_1_, false), (float)this.field_78531_r.field_71443_c / (float)this.field_78531_r.field_71440_d, 0.05F, this.field_78530_s * 2.0F); + GlStateManager.func_179128_n(5888); + GlStateManager.func_179096_D(); + if(this.field_78531_r.field_71474_y.field_74337_g) { + GlStateManager.func_179109_b((float)(p_renderHand_2_ * 2 - 1) * 0.1F, 0.0F, 0.0F); + } + + boolean flag = false; + if(p_renderHand_3_) { + GlStateManager.func_179094_E(); + this.func_78482_e(p_renderHand_1_); + if(this.field_78531_r.field_71474_y.field_74336_f) { + this.func_78475_f(p_renderHand_1_); + } + + flag = this.field_78531_r.func_175606_aa() instanceof EntityLivingBase && ((EntityLivingBase)this.field_78531_r.func_175606_aa()).func_70608_bn(); + boolean flag1 = !ReflectorForge.renderFirstPersonHand(this.field_78531_r.field_71438_f, p_renderHand_1_, p_renderHand_2_); + if(flag1 && this.field_78531_r.field_71474_y.field_74320_O == 0 && !flag && !this.field_78531_r.field_71474_y.field_74319_N && !this.field_78531_r.field_71442_b.func_78747_a()) { + this.func_180436_i(); + if(Config.isShaders()) { + ShadersRender.renderItemFP(this.field_78516_c, p_renderHand_1_, p_renderHand_5_); + } else { + this.field_78516_c.func_78440_a(p_renderHand_1_); + } + + this.func_175072_h(); + } + + GlStateManager.func_179121_F(); + } + + if(!p_renderHand_4_) { + return; + } + + this.func_175072_h(); + if(this.field_78531_r.field_71474_y.field_74320_O == 0 && !flag) { + this.field_78516_c.func_78447_b(p_renderHand_1_); + this.func_78482_e(p_renderHand_1_); + } + + if(this.field_78531_r.field_71474_y.field_74336_f) { + this.func_78475_f(p_renderHand_1_); + } + } + + } + + public void func_175072_h() { + GlStateManager.func_179138_g(OpenGlHelper.field_77476_b); + GlStateManager.func_179090_x(); + GlStateManager.func_179138_g(OpenGlHelper.field_77478_a); + if(Config.isShaders()) { + Shaders.disableLightmap(); + } + + } + + public void func_180436_i() { + GlStateManager.func_179138_g(OpenGlHelper.field_77476_b); + GlStateManager.func_179128_n(5890); + GlStateManager.func_179096_D(); + float f = 0.00390625F; + GlStateManager.func_179152_a(f, f, f); + GlStateManager.func_179109_b(8.0F, 8.0F, 8.0F); + GlStateManager.func_179128_n(5888); + this.field_78531_r.func_110434_K().func_110577_a(this.field_110922_T); + GL11.glTexParameteri(3553, 10241, 9729); + GL11.glTexParameteri(3553, 10240, 9729); + GL11.glTexParameteri(3553, 10242, 10496); + GL11.glTexParameteri(3553, 10243, 10496); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.func_179098_w(); + GlStateManager.func_179138_g(OpenGlHelper.field_77478_a); + if(Config.isShaders()) { + Shaders.enableLightmap(); + } + + } + + private void func_78470_f() { + this.field_175075_L = (float)((double)this.field_175075_L + (Math.random() - Math.random()) * Math.random() * Math.random()); + this.field_175075_L = (float)((double)this.field_175075_L * 0.9D); + this.field_78514_e += (this.field_175075_L - this.field_78514_e) * 1.0F; + this.field_78536_aa = true; + } + + private void func_78472_g(float p_78472_1_) { + if(this.field_78536_aa) { + this.field_78531_r.field_71424_I.func_76320_a("lightTex"); + WorldClient worldclient = this.field_78531_r.field_71441_e; + if(worldclient != null) { + if(Config.isCustomColors() && CustomColors.updateLightmap(worldclient, this.field_78514_e, this.field_78504_Q, this.field_78531_r.field_71439_g.func_70644_a(Potion.field_76439_r))) { + this.field_78513_d.func_110564_a(); + this.field_78536_aa = false; + this.field_78531_r.field_71424_I.func_76319_b(); + return; + } + + float f = worldclient.func_72971_b(1.0F); + float f1 = f * 0.95F + 0.05F; + + for(int i = 0; i < 256; ++i) { + float f2 = worldclient.field_73011_w.func_177497_p()[i / 16] * f1; + float f3 = worldclient.field_73011_w.func_177497_p()[i % 16] * (this.field_78514_e * 0.1F + 1.5F); + if(worldclient.func_175658_ac() > 0) { + f2 = worldclient.field_73011_w.func_177497_p()[i / 16]; + } + + float f4 = f2 * (f * 0.65F + 0.35F); + float f5 = f2 * (f * 0.65F + 0.35F); + float f6 = f3 * ((f3 * 0.6F + 0.4F) * 0.6F + 0.4F); + float f7 = f3 * (f3 * f3 * 0.6F + 0.4F); + float f8 = f4 + f3; + float f9 = f5 + f6; + float f10 = f2 + f7; + f8 = f8 * 0.96F + 0.03F; + f9 = f9 * 0.96F + 0.03F; + f10 = f10 * 0.96F + 0.03F; + if(this.field_82831_U > 0.0F) { + float f11 = this.field_82832_V + (this.field_82831_U - this.field_82832_V) * p_78472_1_; + f8 = f8 * (1.0F - f11) + f8 * 0.7F * f11; + f9 = f9 * (1.0F - f11) + f9 * 0.6F * f11; + f10 = f10 * (1.0F - f11) + f10 * 0.6F * f11; + } + + if(worldclient.field_73011_w.func_177502_q() == 1) { + f8 = 0.22F + f3 * 0.75F; + f9 = 0.28F + f6 * 0.75F; + f10 = 0.25F + f7 * 0.75F; + } + + if(this.field_78531_r.field_71439_g.func_70644_a(Potion.field_76439_r)) { + float f15 = this.func_180438_a(this.field_78531_r.field_71439_g, p_78472_1_); + float f12 = 1.0F / f8; + if(f12 > 1.0F / f9) { + f12 = 1.0F / f9; + } + + if(f12 > 1.0F / f10) { + f12 = 1.0F / f10; + } + + f8 = f8 * (1.0F - f15) + f8 * f12 * f15; + f9 = f9 * (1.0F - f15) + f9 * f12 * f15; + f10 = f10 * (1.0F - f15) + f10 * f12 * f15; + } + + if(f8 > 1.0F) { + f8 = 1.0F; + } + + if(f9 > 1.0F) { + f9 = 1.0F; + } + + if(f10 > 1.0F) { + f10 = 1.0F; + } + + float f16 = this.field_78531_r.field_71474_y.field_74333_Y; + float f17 = 1.0F - f8; + float f13 = 1.0F - f9; + float f14 = 1.0F - f10; + f17 = 1.0F - f17 * f17 * f17 * f17; + f13 = 1.0F - f13 * f13 * f13 * f13; + f14 = 1.0F - f14 * f14 * f14 * f14; + f8 = f8 * (1.0F - f16) + f17 * f16; + f9 = f9 * (1.0F - f16) + f13 * f16; + f10 = f10 * (1.0F - f16) + f14 * f16; + f8 = f8 * 0.96F + 0.03F; + f9 = f9 * 0.96F + 0.03F; + f10 = f10 * 0.96F + 0.03F; + if(f8 > 1.0F) { + f8 = 1.0F; + } + + if(f9 > 1.0F) { + f9 = 1.0F; + } + + if(f10 > 1.0F) { + f10 = 1.0F; + } + + if(f8 < 0.0F) { + f8 = 0.0F; + } + + if(f9 < 0.0F) { + f9 = 0.0F; + } + + if(f10 < 0.0F) { + f10 = 0.0F; + } + + short short1 = 255; + int j = (int)(f8 * 255.0F); + int k = (int)(f9 * 255.0F); + int l = (int)(f10 * 255.0F); + this.field_78504_Q[i] = short1 << 24 | j << 16 | k << 8 | l; + } + + this.field_78513_d.func_110564_a(); + this.field_78536_aa = false; + this.field_78531_r.field_71424_I.func_76319_b(); + } + } + + } + + public float func_180438_a(EntityLivingBase p_180438_1_, float p_180438_2_) { + int i = p_180438_1_.func_70660_b(Potion.field_76439_r).func_76459_b(); + return i > 200?1.0F:0.7F + MathHelper.func_76126_a(((float)i - p_180438_2_) * 3.1415927F * 0.2F) * 0.3F; + } + + public void func_181560_a(float p_181560_1_, long p_181560_2_) { + this.frameInit(); + boolean flag = Display.isActive(); + if(!flag && this.field_78531_r.field_71474_y.field_82881_y && (!this.field_78531_r.field_71474_y.field_85185_A || !Mouse.isButtonDown(1))) { + if(Minecraft.func_71386_F() - this.field_78508_Y > 500L) { + this.field_78531_r.func_71385_j(); + } + } else { + this.field_78508_Y = Minecraft.func_71386_F(); + } + + this.field_78531_r.field_71424_I.func_76320_a("mouse"); + if(flag && Minecraft.field_142025_a && this.field_78531_r.field_71415_G && !Mouse.isInsideWindow()) { + Mouse.setGrabbed(false); + Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2); + Mouse.setGrabbed(true); + } + + if(this.field_78531_r.field_71415_G && flag) { + this.field_78531_r.field_71417_B.func_74374_c(); + float f = this.field_78531_r.field_71474_y.field_74341_c * 0.6F + 0.2F; + float f1 = f * f * f * 8.0F; + float f2 = (float)this.field_78531_r.field_71417_B.field_74377_a * f1; + float f3 = (float)this.field_78531_r.field_71417_B.field_74375_b * f1; + byte b0 = 1; + if(this.field_78531_r.field_71474_y.field_74338_d) { + b0 = -1; + } + + if(this.field_78531_r.field_71474_y.field_74326_T) { + this.field_78496_H += f2; + this.field_78497_I += f3; + float f4 = p_181560_1_ - this.field_78492_L; + this.field_78492_L = p_181560_1_; + f2 = this.field_78498_J * f4; + f3 = this.field_78499_K * f4; + this.field_78531_r.field_71439_g.func_70082_c(f2, f3 * (float)b0); + } else { + this.field_78496_H = 0.0F; + this.field_78497_I = 0.0F; + this.field_78531_r.field_71439_g.func_70082_c(f2, f3 * (float)b0); + } + } + + this.field_78531_r.field_71424_I.func_76319_b(); + if(!this.field_78531_r.field_71454_w) { + field_78517_a = this.field_78531_r.field_71474_y.field_74337_g; + final ScaledResolution scaledresolution = new ScaledResolution(this.field_78531_r); + int l = scaledresolution.func_78326_a(); + int i1 = scaledresolution.func_78328_b(); + final int j1 = Mouse.getX() * l / this.field_78531_r.field_71443_c; + final int k1 = i1 - Mouse.getY() * i1 / this.field_78531_r.field_71440_d - 1; + int l1 = this.field_78531_r.field_71474_y.field_74350_i; + if(this.field_78531_r.field_71441_e != null) { + this.field_78531_r.field_71424_I.func_76320_a("level"); + int i = Math.min(Minecraft.func_175610_ah(), l1); + i = Math.max(i, 60); + long j = System.nanoTime() - p_181560_2_; + long k = Math.max((long)(1000000000 / i / 4) - j, 0L); + this.func_78471_a(p_181560_1_, System.nanoTime() + k); + if(OpenGlHelper.field_148824_g) { + this.field_78531_r.field_71438_f.func_174975_c(); + if(this.field_147707_d != null && this.field_175083_ad) { + GlStateManager.func_179128_n(5890); + GlStateManager.func_179094_E(); + GlStateManager.func_179096_D(); + this.field_147707_d.func_148018_a(p_181560_1_); + GlStateManager.func_179121_F(); + } + + this.field_78531_r.func_147110_a().func_147610_a(true); + } + + this.field_78510_Z = System.nanoTime(); + this.field_78531_r.field_71424_I.func_76318_c("gui"); + if(!this.field_78531_r.field_71474_y.field_74319_N || this.field_78531_r.field_71462_r != null) { + GlStateManager.func_179092_a(516, 0.1F); + this.field_78531_r.field_71456_v.func_175180_a(p_181560_1_); + if(this.field_78531_r.field_71474_y.ofShowFps && !this.field_78531_r.field_71474_y.field_74330_P) { + Config.drawFps(); + } + + if(this.field_78531_r.field_71474_y.field_74330_P) { + Lagometer.showLagometer(scaledresolution); + } + } + + this.field_78531_r.field_71424_I.func_76319_b(); + } else { + GlStateManager.func_179083_b(0, 0, this.field_78531_r.field_71443_c, this.field_78531_r.field_71440_d); + GlStateManager.func_179128_n(5889); + GlStateManager.func_179096_D(); + GlStateManager.func_179128_n(5888); + GlStateManager.func_179096_D(); + this.func_78478_c(); + this.field_78510_Z = System.nanoTime(); + TileEntityRendererDispatcher.field_147556_a.field_147553_e = this.field_78531_r.func_110434_K(); + } + + if(this.field_78531_r.field_71462_r != null) { + GlStateManager.func_179086_m(256); + + try { + if(Reflector.ForgeHooksClient_drawScreen.exists()) { + Reflector.callVoid(Reflector.ForgeHooksClient_drawScreen, new Object[]{this.field_78531_r.field_71462_r, Integer.valueOf(j1), Integer.valueOf(k1), Float.valueOf(p_181560_1_)}); + } else { + this.field_78531_r.field_71462_r.func_73863_a(j1, k1, p_181560_1_); + } + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.func_85055_a(throwable, "Rendering screen"); + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Screen render details"); + crashreportcategory.func_71500_a("Screen name", new EntityRenderer$2(this)); + crashreportcategory.func_71500_a("Mouse location", new Callable() { + private static final String __OBFID = "CL_00000950"; + + public String call() throws Exception { + return String.format("Scaled: (%d, %d). Absolute: (%d, %d)", new Object[]{Integer.valueOf(j1), Integer.valueOf(k1), Integer.valueOf(Mouse.getX()), Integer.valueOf(Mouse.getY())}); + } + }); + crashreportcategory.func_71500_a("Screen size", new Callable() { + private static final String __OBFID = "CL_00000951"; + + public String call() throws Exception { + return String.format("Scaled: (%d, %d). Absolute: (%d, %d). Scale factor of %d", new Object[]{Integer.valueOf(scaledresolution.func_78326_a()), Integer.valueOf(scaledresolution.func_78328_b()), Integer.valueOf(EntityRenderer.this.field_78531_r.field_71443_c), Integer.valueOf(EntityRenderer.this.field_78531_r.field_71440_d), Integer.valueOf(scaledresolution.func_78325_e())}); + } + }); + throw new ReportedException(crashreport); + } + } + } + + this.frameFinish(); + this.waitForServerThread(); + Lagometer.updateLagometer(); + if(this.field_78531_r.field_71474_y.ofProfiler) { + this.field_78531_r.field_71474_y.field_74329_Q = true; + } + + } + + public void func_152430_c(float p_152430_1_) { + this.func_78478_c(); + this.field_78531_r.field_71456_v.func_180478_c(new ScaledResolution(this.field_78531_r)); + } + + private boolean func_175070_n() { + if(!this.field_175073_D) { + return false; + } else { + Entity entity = this.field_78531_r.func_175606_aa(); + boolean flag = entity instanceof EntityPlayer && !this.field_78531_r.field_71474_y.field_74319_N; + if(flag && !((EntityPlayer)entity).field_71075_bZ.field_75099_e) { + ItemStack itemstack = ((EntityPlayer)entity).func_71045_bC(); + if(this.field_78531_r.field_71476_x != null && this.field_78531_r.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) { + BlockPos blockpos = this.field_78531_r.field_71476_x.func_178782_a(); + IBlockState iblockstate = this.field_78531_r.field_71441_e.func_180495_p(blockpos); + Block block = iblockstate.func_177230_c(); + if(this.field_78531_r.field_71442_b.func_178889_l() == WorldSettings.GameType.SPECTATOR) { + flag = ReflectorForge.blockHasTileEntity(iblockstate) && this.field_78531_r.field_71441_e.func_175625_s(blockpos) instanceof IInventory; + } else { + flag = itemstack != null && (itemstack.func_179544_c(block) || itemstack.func_179547_d(block)); + } + } + } + + return flag; + } + } + + private void func_175067_i(float p_175067_1_) { + if(this.field_78531_r.field_71474_y.field_74330_P && !this.field_78531_r.field_71474_y.field_74319_N && !this.field_78531_r.field_71439_g.func_175140_cp() && !this.field_78531_r.field_71474_y.field_178879_v) { + Entity entity = this.field_78531_r.func_175606_aa(); + GlStateManager.func_179147_l(); + GlStateManager.func_179120_a(770, 771, 1, 0); + GL11.glLineWidth(1.0F); + GlStateManager.func_179090_x(); + GlStateManager.func_179132_a(false); + GlStateManager.func_179094_E(); + GlStateManager.func_179128_n(5888); + GlStateManager.func_179096_D(); + this.func_78467_g(p_175067_1_); + GlStateManager.func_179109_b(0.0F, entity.func_70047_e(), 0.0F); + RenderGlobal.func_181563_a(new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.005D, 1.0E-4D, 1.0E-4D), 255, 0, 0, 255); + RenderGlobal.func_181563_a(new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0E-4D, 1.0E-4D, 0.005D), 0, 0, 255, 255); + RenderGlobal.func_181563_a(new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0E-4D, 0.0033D, 1.0E-4D), 0, 255, 0, 255); + GlStateManager.func_179121_F(); + GlStateManager.func_179132_a(true); + GlStateManager.func_179098_w(); + GlStateManager.func_179084_k(); + } + + } + + public void func_78471_a(float p_78471_1_, long p_78471_2_) { + this.func_78472_g(p_78471_1_); + if(this.field_78531_r.func_175606_aa() == null) { + this.field_78531_r.func_175607_a(this.field_78531_r.field_71439_g); + } + + this.func_78473_a(p_78471_1_); + if(Config.isShaders()) { + Shaders.beginRender(this.field_78531_r, p_78471_1_, p_78471_2_); + } + + GlStateManager.func_179126_j(); + GlStateManager.func_179141_d(); + GlStateManager.func_179092_a(516, 0.1F); + this.field_78531_r.field_71424_I.func_76320_a("center"); + if(this.field_78531_r.field_71474_y.field_74337_g) { + field_78515_b = 0; + GlStateManager.func_179135_a(false, true, true, false); + this.func_175068_a(0, p_78471_1_, p_78471_2_); + field_78515_b = 1; + GlStateManager.func_179135_a(true, false, false, false); + this.func_175068_a(1, p_78471_1_, p_78471_2_); + GlStateManager.func_179135_a(true, true, true, false); + } else { + this.func_175068_a(2, p_78471_1_, p_78471_2_); + } + + this.field_78531_r.field_71424_I.func_76319_b(); + } + + private void func_175068_a(int p_175068_1_, float p_175068_2_, long p_175068_3_) { + boolean flag = Config.isShaders(); + if(flag) { + Shaders.beginRenderPass(p_175068_1_, p_175068_2_, p_175068_3_); + } + + RenderGlobal renderglobal = this.field_78531_r.field_71438_f; + EffectRenderer effectrenderer = this.field_78531_r.field_71452_i; + boolean flag1 = this.func_175070_n(); + GlStateManager.func_179089_o(); + this.field_78531_r.field_71424_I.func_76318_c("clear"); + if(flag) { + Shaders.setViewport(0, 0, this.field_78531_r.field_71443_c, this.field_78531_r.field_71440_d); + } else { + GlStateManager.func_179083_b(0, 0, this.field_78531_r.field_71443_c, this.field_78531_r.field_71440_d); + } + + this.func_78466_h(p_175068_2_); + GlStateManager.func_179086_m(16640); + if(flag) { + Shaders.clearRenderBuffer(); + } + + this.field_78531_r.field_71424_I.func_76318_c("camera"); + this.func_78479_a(p_175068_2_, p_175068_1_); + if(flag) { + Shaders.setCamera(p_175068_2_); + } + + ActiveRenderInfo.func_74583_a(this.field_78531_r.field_71439_g, this.field_78531_r.field_71474_y.field_74320_O == 2); + this.field_78531_r.field_71424_I.func_76318_c("frustum"); + ClippingHelperImpl.func_78558_a(); + this.field_78531_r.field_71424_I.func_76318_c("culling"); + Frustum frustum = new Frustum(); + Entity entity = this.field_78531_r.func_175606_aa(); + double d0 = entity.field_70142_S + (entity.field_70165_t - entity.field_70142_S) * (double)p_175068_2_; + double d1 = entity.field_70137_T + (entity.field_70163_u - entity.field_70137_T) * (double)p_175068_2_; + double d2 = entity.field_70136_U + (entity.field_70161_v - entity.field_70136_U) * (double)p_175068_2_; + if(flag) { + ShadersRender.setFrustrumPosition(frustum, d0, d1, d2); + } else { + frustum.func_78547_a(d0, d1, d2); + } + + if((Config.isSkyEnabled() || Config.isSunMoonEnabled() || Config.isStarsEnabled()) && !Shaders.isShadowPass) { + this.func_78468_a(-1, p_175068_2_); + this.field_78531_r.field_71424_I.func_76318_c("sky"); + GlStateManager.func_179128_n(5889); + GlStateManager.func_179096_D(); + Project.gluPerspective(this.func_78481_a(p_175068_2_, true), (float)this.field_78531_r.field_71443_c / (float)this.field_78531_r.field_71440_d, 0.05F, this.clipDistance); + GlStateManager.func_179128_n(5888); + if(flag) { + Shaders.beginSky(); + } + + renderglobal.func_174976_a(p_175068_2_, p_175068_1_); + if(flag) { + Shaders.endSky(); + } + + GlStateManager.func_179128_n(5889); + GlStateManager.func_179096_D(); + Project.gluPerspective(this.func_78481_a(p_175068_2_, true), (float)this.field_78531_r.field_71443_c / (float)this.field_78531_r.field_71440_d, 0.05F, this.clipDistance); + GlStateManager.func_179128_n(5888); + } else { + GlStateManager.func_179084_k(); + } + + this.func_78468_a(0, p_175068_2_); + GlStateManager.func_179103_j(7425); + if(entity.field_70163_u + (double)entity.func_70047_e() < 128.0D + (double)(this.field_78531_r.field_71474_y.ofCloudsHeight * 128.0F)) { + this.func_180437_a(renderglobal, p_175068_2_, p_175068_1_); + } + + this.field_78531_r.field_71424_I.func_76318_c("prepareterrain"); + this.func_78468_a(0, p_175068_2_); + this.field_78531_r.func_110434_K().func_110577_a(TextureMap.field_110575_b); + RenderHelper.func_74518_a(); + this.field_78531_r.field_71424_I.func_76318_c("terrain_setup"); + if(flag) { + ShadersRender.setupTerrain(renderglobal, entity, (double)p_175068_2_, frustum, this.field_175084_ae++, this.field_78531_r.field_71439_g.func_175149_v()); + } else { + renderglobal.func_174970_a(entity, (double)p_175068_2_, frustum, this.field_175084_ae++, this.field_78531_r.field_71439_g.func_175149_v()); + } + + if(p_175068_1_ == 0 || p_175068_1_ == 2) { + this.field_78531_r.field_71424_I.func_76318_c("updatechunks"); + Lagometer.timerChunkUpload.start(); + this.field_78531_r.field_71438_f.func_174967_a(p_175068_3_); + Lagometer.timerChunkUpload.end(); + } + + this.field_78531_r.field_71424_I.func_76318_c("terrain"); + Lagometer.timerTerrain.start(); + if(this.field_78531_r.field_71474_y.ofSmoothFps && p_175068_1_ > 0) { + this.field_78531_r.field_71424_I.func_76318_c("finish"); + GL11.glFinish(); + this.field_78531_r.field_71424_I.func_76318_c("terrain"); + } + + GlStateManager.func_179128_n(5888); + GlStateManager.func_179094_E(); + GlStateManager.func_179118_c(); + if(flag) { + ShadersRender.beginTerrainSolid(); + } + + renderglobal.func_174977_a(EnumWorldBlockLayer.SOLID, (double)p_175068_2_, p_175068_1_, entity); + GlStateManager.func_179141_d(); + if(flag) { + ShadersRender.beginTerrainCutoutMipped(); + } + + renderglobal.func_174977_a(EnumWorldBlockLayer.CUTOUT_MIPPED, (double)p_175068_2_, p_175068_1_, entity); + this.field_78531_r.func_110434_K().func_110581_b(TextureMap.field_110575_b).func_174936_b(false, false); + if(flag) { + ShadersRender.beginTerrainCutout(); + } + + renderglobal.func_174977_a(EnumWorldBlockLayer.CUTOUT, (double)p_175068_2_, p_175068_1_, entity); + this.field_78531_r.func_110434_K().func_110581_b(TextureMap.field_110575_b).func_174935_a(); + if(flag) { + ShadersRender.endTerrain(); + } + + Lagometer.timerTerrain.end(); + GlStateManager.func_179103_j(7424); + GlStateManager.func_179092_a(516, 0.1F); + if(!this.field_175078_W) { + GlStateManager.func_179128_n(5888); + GlStateManager.func_179121_F(); + GlStateManager.func_179094_E(); + RenderHelper.func_74519_b(); + this.field_78531_r.field_71424_I.func_76318_c("entities"); + if(Reflector.ForgeHooksClient_setRenderPass.exists()) { + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[]{Integer.valueOf(0)}); + } + + renderglobal.func_180446_a(entity, frustum, p_175068_2_); + if(Reflector.ForgeHooksClient_setRenderPass.exists()) { + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[]{Integer.valueOf(-1)}); + } + + RenderHelper.func_74518_a(); + this.func_175072_h(); + GlStateManager.func_179128_n(5888); + GlStateManager.func_179121_F(); + GlStateManager.func_179094_E(); + if(this.field_78531_r.field_71476_x != null && entity.func_70055_a(Material.field_151586_h) && flag1) { + EntityPlayer entityplayer = (EntityPlayer)entity; + GlStateManager.func_179118_c(); + this.field_78531_r.field_71424_I.func_76318_c("outline"); + if((!Reflector.ForgeHooksClient_onDrawBlockHighlight.exists() || !Reflector.callBoolean(Reflector.ForgeHooksClient_onDrawBlockHighlight, new Object[]{renderglobal, entityplayer, this.field_78531_r.field_71476_x, Integer.valueOf(0), entityplayer.func_70694_bm(), Float.valueOf(p_175068_2_)})) && !this.field_78531_r.field_71474_y.field_74319_N) { + renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_175068_2_); + } + + GlStateManager.func_179141_d(); + } + } + + GlStateManager.func_179128_n(5888); + GlStateManager.func_179121_F(); + if(flag1 && this.field_78531_r.field_71476_x != null && !entity.func_70055_a(Material.field_151586_h)) { + EntityPlayer entityplayer1 = (EntityPlayer)entity; + GlStateManager.func_179118_c(); + this.field_78531_r.field_71424_I.func_76318_c("outline"); + if((!Reflector.ForgeHooksClient_onDrawBlockHighlight.exists() || !Reflector.callBoolean(Reflector.ForgeHooksClient_onDrawBlockHighlight, new Object[]{renderglobal, entityplayer1, this.field_78531_r.field_71476_x, Integer.valueOf(0), entityplayer1.func_70694_bm(), Float.valueOf(p_175068_2_)})) && !this.field_78531_r.field_71474_y.field_74319_N) { + renderglobal.func_72731_b(entityplayer1, this.field_78531_r.field_71476_x, 0, p_175068_2_); + } + + GlStateManager.func_179141_d(); + } + + if(!renderglobal.field_72738_E.isEmpty()) { + this.field_78531_r.field_71424_I.func_76318_c("destroyProgress"); + GlStateManager.func_179147_l(); + GlStateManager.func_179120_a(770, 1, 1, 0); + this.field_78531_r.func_110434_K().func_110581_b(TextureMap.field_110575_b).func_174936_b(false, false); + renderglobal.func_174981_a(Tessellator.func_178181_a(), Tessellator.func_178181_a().func_178180_c(), entity, p_175068_2_); + this.field_78531_r.func_110434_K().func_110581_b(TextureMap.field_110575_b).func_174935_a(); + GlStateManager.func_179084_k(); + } + + GlStateManager.func_179120_a(770, 771, 1, 0); + GlStateManager.func_179084_k(); + if(!this.field_175078_W) { + this.func_180436_i(); + this.field_78531_r.field_71424_I.func_76318_c("litParticles"); + if(flag) { + Shaders.beginLitParticles(); + } + + effectrenderer.func_78872_b(entity, p_175068_2_); + RenderHelper.func_74518_a(); + this.func_78468_a(0, p_175068_2_); + this.field_78531_r.field_71424_I.func_76318_c("particles"); + if(flag) { + Shaders.beginParticles(); + } + + effectrenderer.func_78874_a(entity, p_175068_2_); + if(flag) { + Shaders.endParticles(); + } + + this.func_175072_h(); + } + + GlStateManager.func_179132_a(false); + GlStateManager.func_179089_o(); + this.field_78531_r.field_71424_I.func_76318_c("weather"); + if(flag) { + Shaders.beginWeather(); + } + + this.func_78474_d(p_175068_2_); + if(flag) { + Shaders.endWeather(); + } + + GlStateManager.func_179132_a(true); + renderglobal.func_180449_a(entity, p_175068_2_); + if(flag) { + ShadersRender.renderHand0(this, p_175068_2_, p_175068_1_); + Shaders.preWater(); + } + + GlStateManager.func_179084_k(); + GlStateManager.func_179089_o(); + GlStateManager.func_179120_a(770, 771, 1, 0); + GlStateManager.func_179092_a(516, 0.1F); + this.func_78468_a(0, p_175068_2_); + GlStateManager.func_179147_l(); + GlStateManager.func_179132_a(false); + this.field_78531_r.func_110434_K().func_110577_a(TextureMap.field_110575_b); + GlStateManager.func_179103_j(7425); + this.field_78531_r.field_71424_I.func_76318_c("translucent"); + if(flag) { + Shaders.beginWater(); + } + + renderglobal.func_174977_a(EnumWorldBlockLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, entity); + if(flag) { + Shaders.endWater(); + } + + if(Reflector.ForgeHooksClient_setRenderPass.exists() && !this.field_175078_W) { + RenderHelper.func_74519_b(); + this.field_78531_r.field_71424_I.func_76318_c("entities"); + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[]{Integer.valueOf(1)}); + this.field_78531_r.field_71438_f.func_180446_a(entity, frustum, p_175068_2_); + GlStateManager.func_179120_a(770, 771, 1, 0); + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[]{Integer.valueOf(-1)}); + RenderHelper.func_74518_a(); + } + + GlStateManager.func_179103_j(7424); + GlStateManager.func_179132_a(true); + GlStateManager.func_179089_o(); + GlStateManager.func_179084_k(); + GlStateManager.func_179106_n(); + if(entity.field_70163_u + (double)entity.func_70047_e() >= 128.0D + (double)(this.field_78531_r.field_71474_y.ofCloudsHeight * 128.0F)) { + this.field_78531_r.field_71424_I.func_76318_c("aboveClouds"); + this.func_180437_a(renderglobal, p_175068_2_, p_175068_1_); + } + + if(Reflector.ForgeHooksClient_dispatchRenderLast.exists()) { + this.field_78531_r.field_71424_I.func_76318_c("forge_render_last"); + Reflector.callVoid(Reflector.ForgeHooksClient_dispatchRenderLast, new Object[]{renderglobal, Float.valueOf(p_175068_2_)}); + } + + this.field_78531_r.field_71424_I.func_76318_c("hand"); + boolean flag2 = ReflectorForge.renderFirstPersonHand(this.field_78531_r.field_71438_f, p_175068_2_, p_175068_1_); + if(!flag2 && this.field_175074_C && !Shaders.isShadowPass) { + if(flag) { + ShadersRender.renderHand1(this, p_175068_2_, p_175068_1_); + Shaders.renderCompositeFinal(); + } + + GlStateManager.func_179086_m(256); + if(flag) { + ShadersRender.renderFPOverlay(this, p_175068_2_, p_175068_1_); + } else { + this.func_78476_b(p_175068_2_, p_175068_1_); + } + + this.func_175067_i(p_175068_2_); + } + + if(flag) { + Shaders.endRender(); + } + + } + + private void func_180437_a(RenderGlobal p_180437_1_, float p_180437_2_, int p_180437_3_) { + if(this.field_78531_r.field_71474_y.field_151451_c >= 4 && !Config.isCloudsOff() && Shaders.shouldRenderClouds(this.field_78531_r.field_71474_y)) { + this.field_78531_r.field_71424_I.func_76318_c("clouds"); + GlStateManager.func_179128_n(5889); + GlStateManager.func_179096_D(); + Project.gluPerspective(this.func_78481_a(p_180437_2_, true), (float)this.field_78531_r.field_71443_c / (float)this.field_78531_r.field_71440_d, 0.05F, this.clipDistance * 4.0F); + GlStateManager.func_179128_n(5888); + GlStateManager.func_179094_E(); + this.func_78468_a(0, p_180437_2_); + p_180437_1_.func_180447_b(p_180437_2_, p_180437_3_); + GlStateManager.func_179106_n(); + GlStateManager.func_179121_F(); + GlStateManager.func_179128_n(5889); + GlStateManager.func_179096_D(); + Project.gluPerspective(this.func_78481_a(p_180437_2_, true), (float)this.field_78531_r.field_71443_c / (float)this.field_78531_r.field_71440_d, 0.05F, this.clipDistance); + GlStateManager.func_179128_n(5888); + } + + } + + private void func_78484_h() { + float f = this.field_78531_r.field_71441_e.func_72867_j(1.0F); + if(!Config.isRainFancy()) { + f /= 2.0F; + } + + if(f != 0.0F && Config.isRainSplash()) { + this.field_78537_ab.setSeed((long)this.field_78529_t * 312987231L); + Entity entity = this.field_78531_r.func_175606_aa(); + WorldClient worldclient = this.field_78531_r.field_71441_e; + BlockPos blockpos = new BlockPos(entity); + byte b0 = 10; + double d0 = 0.0D; + double d1 = 0.0D; + double d2 = 0.0D; + int i = 0; + int j = (int)(100.0F * f * f); + if(this.field_78531_r.field_71474_y.field_74362_aa == 1) { + j >>= 1; + } else if(this.field_78531_r.field_71474_y.field_74362_aa == 2) { + j = 0; + } + + for(int k = 0; k < j; ++k) { + BlockPos blockpos1 = worldclient.func_175725_q(blockpos.func_177982_a(this.field_78537_ab.nextInt(b0) - this.field_78537_ab.nextInt(b0), 0, this.field_78537_ab.nextInt(b0) - this.field_78537_ab.nextInt(b0))); + BiomeGenBase biomegenbase = worldclient.func_180494_b(blockpos1); + BlockPos blockpos2 = blockpos1.func_177977_b(); + Block block = worldclient.func_180495_p(blockpos2).func_177230_c(); + if(blockpos1.func_177956_o() <= blockpos.func_177956_o() + b0 && blockpos1.func_177956_o() >= blockpos.func_177956_o() - b0 && biomegenbase.func_76738_d() && biomegenbase.func_180626_a(blockpos1) >= 0.15F) { + double d3 = this.field_78537_ab.nextDouble(); + double d4 = this.field_78537_ab.nextDouble(); + if(block.func_149688_o() == Material.field_151587_i) { + this.field_78531_r.field_71441_e.func_175688_a(EnumParticleTypes.SMOKE_NORMAL, (double)blockpos1.func_177958_n() + d3, (double)((float)blockpos1.func_177956_o() + 0.1F) - block.func_149665_z(), (double)blockpos1.func_177952_p() + d4, 0.0D, 0.0D, 0.0D, new int[0]); + } else if(block.func_149688_o() != Material.field_151579_a) { + block.func_180654_a(worldclient, blockpos2); + ++i; + if(this.field_78537_ab.nextInt(i) == 0) { + d0 = (double)blockpos2.func_177958_n() + d3; + d1 = (double)((float)blockpos2.func_177956_o() + 0.1F) + block.func_149669_A() - 1.0D; + d2 = (double)blockpos2.func_177952_p() + d4; + } + + this.field_78531_r.field_71441_e.func_175688_a(EnumParticleTypes.WATER_DROP, (double)blockpos2.func_177958_n() + d3, (double)((float)blockpos2.func_177956_o() + 0.1F) + block.func_149669_A(), (double)blockpos2.func_177952_p() + d4, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + } + + if(i > 0 && this.field_78537_ab.nextInt(3) < this.field_78534_ac++) { + this.field_78534_ac = 0; + if(d1 > (double)(blockpos.func_177956_o() + 1) && worldclient.func_175725_q(blockpos).func_177956_o() > MathHelper.func_76141_d((float)blockpos.func_177956_o())) { + this.field_78531_r.field_71441_e.func_72980_b(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false); + } else { + this.field_78531_r.field_71441_e.func_72980_b(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false); + } + } + } + + } + + protected void func_78474_d(float p_78474_1_) { + if(Reflector.ForgeWorldProvider_getWeatherRenderer.exists()) { + WorldProvider worldprovider = this.field_78531_r.field_71441_e.field_73011_w; + Object object = Reflector.call(worldprovider, Reflector.ForgeWorldProvider_getWeatherRenderer, new Object[0]); + if(object != null) { + Reflector.callVoid(object, Reflector.IRenderHandler_render, new Object[]{Float.valueOf(p_78474_1_), this.field_78531_r.field_71441_e, this.field_78531_r}); + return; + } + } + + float f5 = this.field_78531_r.field_71441_e.func_72867_j(p_78474_1_); + if(f5 > 0.0F) { + if(Config.isRainOff()) { + return; + } + + this.func_180436_i(); + Entity entity = this.field_78531_r.func_175606_aa(); + WorldClient worldclient = this.field_78531_r.field_71441_e; + int i = MathHelper.func_76128_c(entity.field_70165_t); + int j = MathHelper.func_76128_c(entity.field_70163_u); + int k = MathHelper.func_76128_c(entity.field_70161_v); + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + GlStateManager.func_179129_p(); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.func_179147_l(); + GlStateManager.func_179120_a(770, 771, 1, 0); + GlStateManager.func_179092_a(516, 0.1F); + double d0 = entity.field_70142_S + (entity.field_70165_t - entity.field_70142_S) * (double)p_78474_1_; + double d1 = entity.field_70137_T + (entity.field_70163_u - entity.field_70137_T) * (double)p_78474_1_; + double d2 = entity.field_70136_U + (entity.field_70161_v - entity.field_70136_U) * (double)p_78474_1_; + int l = MathHelper.func_76128_c(d1); + byte b0 = 5; + if(Config.isRainFancy()) { + b0 = 10; + } + + byte b1 = -1; + float f = (float)this.field_78529_t + p_78474_1_; + worldrenderer.func_178969_c(-d0, -d1, -d2); + if(Config.isRainFancy()) { + b0 = 10; + } + + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for(int i1 = k - b0; i1 <= k + b0; ++i1) { + for(int j1 = i - b0; j1 <= i + b0; ++j1) { + int k1 = (i1 - k + 16) * 32 + j1 - i + 16; + double d3 = (double)this.field_175076_N[k1] * 0.5D; + double d4 = (double)this.field_175077_O[k1] * 0.5D; + blockpos$mutableblockpos.func_181079_c(j1, 0, i1); + BiomeGenBase biomegenbase = worldclient.func_180494_b(blockpos$mutableblockpos); + if(biomegenbase.func_76738_d() || biomegenbase.func_76746_c()) { + int l1 = worldclient.func_175725_q(blockpos$mutableblockpos).func_177956_o(); + int i2 = j - b0; + int j2 = j + b0; + if(i2 < l1) { + i2 = l1; + } + + if(j2 < l1) { + j2 = l1; + } + + int k2 = l1; + if(l1 < l) { + k2 = l; + } + + if(i2 != j2) { + this.field_78537_ab.setSeed((long)(j1 * j1 * 3121 + j1 * 45238971 ^ i1 * i1 * 418711 + i1 * 13761)); + blockpos$mutableblockpos.func_181079_c(j1, i2, i1); + float f1 = biomegenbase.func_180626_a(blockpos$mutableblockpos); + if(worldclient.func_72959_q().func_76939_a(f1, l1) >= 0.15F) { + if(b1 != 0) { + if(b1 >= 0) { + tessellator.func_78381_a(); + } + + b1 = 0; + this.field_78531_r.func_110434_K().func_110577_a(field_110924_q); + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181704_d); + } + + double d5 = ((double)(this.field_78529_t + j1 * j1 * 3121 + j1 * 45238971 + i1 * i1 * 418711 + i1 * 13761 & 31) + (double)p_78474_1_) / 32.0D * (3.0D + this.field_78537_ab.nextDouble()); + double d6 = (double)((float)j1 + 0.5F) - entity.field_70165_t; + double d7 = (double)((float)i1 + 0.5F) - entity.field_70161_v; + float f2 = MathHelper.func_76133_a(d6 * d6 + d7 * d7) / (float)b0; + float f3 = ((1.0F - f2 * f2) * 0.5F + 0.5F) * f5; + blockpos$mutableblockpos.func_181079_c(j1, k2, i1); + int l2 = worldclient.func_175626_b(blockpos$mutableblockpos, 0); + int i3 = l2 >> 16 & '\uffff'; + int j3 = l2 & '\uffff'; + worldrenderer.func_181662_b((double)j1 - d3 + 0.5D, (double)i2, (double)i1 - d4 + 0.5D).func_181673_a(0.0D, (double)i2 * 0.25D + d5).func_181666_a(1.0F, 1.0F, 1.0F, f3).func_181671_a(i3, j3).func_181675_d(); + worldrenderer.func_181662_b((double)j1 + d3 + 0.5D, (double)i2, (double)i1 + d4 + 0.5D).func_181673_a(1.0D, (double)i2 * 0.25D + d5).func_181666_a(1.0F, 1.0F, 1.0F, f3).func_181671_a(i3, j3).func_181675_d(); + worldrenderer.func_181662_b((double)j1 + d3 + 0.5D, (double)j2, (double)i1 + d4 + 0.5D).func_181673_a(1.0D, (double)j2 * 0.25D + d5).func_181666_a(1.0F, 1.0F, 1.0F, f3).func_181671_a(i3, j3).func_181675_d(); + worldrenderer.func_181662_b((double)j1 - d3 + 0.5D, (double)j2, (double)i1 - d4 + 0.5D).func_181673_a(0.0D, (double)j2 * 0.25D + d5).func_181666_a(1.0F, 1.0F, 1.0F, f3).func_181671_a(i3, j3).func_181675_d(); + } else { + if(b1 != 1) { + if(b1 >= 0) { + tessellator.func_78381_a(); + } + + b1 = 1; + this.field_78531_r.func_110434_K().func_110577_a(field_110923_r); + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181704_d); + } + + double d8 = (double)(((float)(this.field_78529_t & 511) + p_78474_1_) / 512.0F); + double d9 = this.field_78537_ab.nextDouble() + (double)f * 0.01D * (double)((float)this.field_78537_ab.nextGaussian()); + double d10 = this.field_78537_ab.nextDouble() + (double)(f * (float)this.field_78537_ab.nextGaussian()) * 0.001D; + double d11 = (double)((float)j1 + 0.5F) - entity.field_70165_t; + double d12 = (double)((float)i1 + 0.5F) - entity.field_70161_v; + float f6 = MathHelper.func_76133_a(d11 * d11 + d12 * d12) / (float)b0; + float f4 = ((1.0F - f6 * f6) * 0.3F + 0.5F) * f5; + blockpos$mutableblockpos.func_181079_c(j1, k2, i1); + int k3 = (worldclient.func_175626_b(blockpos$mutableblockpos, 0) * 3 + 15728880) / 4; + int l3 = k3 >> 16 & '\uffff'; + int i4 = k3 & '\uffff'; + worldrenderer.func_181662_b((double)j1 - d3 + 0.5D, (double)i2, (double)i1 - d4 + 0.5D).func_181673_a(0.0D + d9, (double)i2 * 0.25D + d8 + d10).func_181666_a(1.0F, 1.0F, 1.0F, f4).func_181671_a(l3, i4).func_181675_d(); + worldrenderer.func_181662_b((double)j1 + d3 + 0.5D, (double)i2, (double)i1 + d4 + 0.5D).func_181673_a(1.0D + d9, (double)i2 * 0.25D + d8 + d10).func_181666_a(1.0F, 1.0F, 1.0F, f4).func_181671_a(l3, i4).func_181675_d(); + worldrenderer.func_181662_b((double)j1 + d3 + 0.5D, (double)j2, (double)i1 + d4 + 0.5D).func_181673_a(1.0D + d9, (double)j2 * 0.25D + d8 + d10).func_181666_a(1.0F, 1.0F, 1.0F, f4).func_181671_a(l3, i4).func_181675_d(); + worldrenderer.func_181662_b((double)j1 - d3 + 0.5D, (double)j2, (double)i1 - d4 + 0.5D).func_181673_a(0.0D + d9, (double)j2 * 0.25D + d8 + d10).func_181666_a(1.0F, 1.0F, 1.0F, f4).func_181671_a(l3, i4).func_181675_d(); + } + } + } + } + } + + if(b1 >= 0) { + tessellator.func_78381_a(); + } + + worldrenderer.func_178969_c(0.0D, 0.0D, 0.0D); + GlStateManager.func_179089_o(); + GlStateManager.func_179084_k(); + GlStateManager.func_179092_a(516, 0.1F); + this.func_175072_h(); + } + + } + + public void func_78478_c() { + ScaledResolution scaledresolution = new ScaledResolution(this.field_78531_r); + GlStateManager.func_179086_m(256); + GlStateManager.func_179128_n(5889); + GlStateManager.func_179096_D(); + GlStateManager.func_179130_a(0.0D, scaledresolution.func_78327_c(), scaledresolution.func_78324_d(), 0.0D, 1000.0D, 3000.0D); + GlStateManager.func_179128_n(5888); + GlStateManager.func_179096_D(); + GlStateManager.func_179109_b(0.0F, 0.0F, -2000.0F); + } + + private void func_78466_h(float p_78466_1_) { + WorldClient worldclient = this.field_78531_r.field_71441_e; + Entity entity = this.field_78531_r.func_175606_aa(); + float f = 0.25F + 0.75F * (float)this.field_78531_r.field_71474_y.field_151451_c / 32.0F; + f = 1.0F - (float)Math.pow((double)f, 0.25D); + Vec3 vec3 = worldclient.func_72833_a(this.field_78531_r.func_175606_aa(), p_78466_1_); + vec3 = CustomColors.getWorldSkyColor(vec3, worldclient, this.field_78531_r.func_175606_aa(), p_78466_1_); + float f1 = (float)vec3.field_72450_a; + float f2 = (float)vec3.field_72448_b; + float f3 = (float)vec3.field_72449_c; + Vec3 vec31 = worldclient.func_72948_g(p_78466_1_); + vec31 = CustomColors.getWorldFogColor(vec31, worldclient, this.field_78531_r.func_175606_aa(), p_78466_1_); + this.field_175080_Q = (float)vec31.field_72450_a; + this.field_175082_R = (float)vec31.field_72448_b; + this.field_175081_S = (float)vec31.field_72449_c; + if(this.field_78531_r.field_71474_y.field_151451_c >= 4) { + double d0 = -1.0D; + Vec3 vec32 = MathHelper.func_76126_a(worldclient.func_72929_e(p_78466_1_)) > 0.0F?new Vec3(d0, 0.0D, 0.0D):new Vec3(1.0D, 0.0D, 0.0D); + float f4 = (float)entity.func_70676_i(p_78466_1_).func_72430_b(vec32); + if(f4 < 0.0F) { + f4 = 0.0F; + } + + if(f4 > 0.0F) { + float[] afloat = worldclient.field_73011_w.func_76560_a(worldclient.func_72826_c(p_78466_1_), p_78466_1_); + if(afloat != null) { + f4 = f4 * afloat[3]; + this.field_175080_Q = this.field_175080_Q * (1.0F - f4) + afloat[0] * f4; + this.field_175082_R = this.field_175082_R * (1.0F - f4) + afloat[1] * f4; + this.field_175081_S = this.field_175081_S * (1.0F - f4) + afloat[2] * f4; + } + } + } + + this.field_175080_Q += (f1 - this.field_175080_Q) * f; + this.field_175082_R += (f2 - this.field_175082_R) * f; + this.field_175081_S += (f3 - this.field_175081_S) * f; + float f10 = worldclient.func_72867_j(p_78466_1_); + if(f10 > 0.0F) { + float f5 = 1.0F - f10 * 0.5F; + float f12 = 1.0F - f10 * 0.4F; + this.field_175080_Q *= f5; + this.field_175082_R *= f5; + this.field_175081_S *= f12; + } + + float f11 = worldclient.func_72819_i(p_78466_1_); + if(f11 > 0.0F) { + float f13 = 1.0F - f11 * 0.5F; + this.field_175080_Q *= f13; + this.field_175082_R *= f13; + this.field_175081_S *= f13; + } + + Block block = ActiveRenderInfo.func_180786_a(this.field_78531_r.field_71441_e, entity, p_78466_1_); + if(this.field_78500_U) { + Vec3 vec33 = worldclient.func_72824_f(p_78466_1_); + this.field_175080_Q = (float)vec33.field_72450_a; + this.field_175082_R = (float)vec33.field_72448_b; + this.field_175081_S = (float)vec33.field_72449_c; + } else if(block.func_149688_o() == Material.field_151586_h) { + float f8 = (float)EnchantmentHelper.func_180319_a(entity) * 0.2F; + if(entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(Potion.field_76427_o)) { + f8 = f8 * 0.3F + 0.6F; + } + + this.field_175080_Q = 0.02F + f8; + this.field_175082_R = 0.02F + f8; + this.field_175081_S = 0.2F + f8; + Vec3 vec34 = CustomColors.getUnderwaterColor(this.field_78531_r.field_71441_e, this.field_78531_r.func_175606_aa().field_70165_t, this.field_78531_r.func_175606_aa().field_70163_u + 1.0D, this.field_78531_r.func_175606_aa().field_70161_v); + if(vec34 != null) { + this.field_175080_Q = (float)vec34.field_72450_a; + this.field_175082_R = (float)vec34.field_72448_b; + this.field_175081_S = (float)vec34.field_72449_c; + } + } else if(block.func_149688_o() == Material.field_151587_i) { + this.field_175080_Q = 0.6F; + this.field_175082_R = 0.1F; + this.field_175081_S = 0.0F; + } + + float f9 = this.field_78535_ad + (this.field_78539_ae - this.field_78535_ad) * p_78466_1_; + this.field_175080_Q *= f9; + this.field_175082_R *= f9; + this.field_175081_S *= f9; + double d2 = worldclient.field_73011_w.func_76565_k(); + double d1 = (entity.field_70137_T + (entity.field_70163_u - entity.field_70137_T) * (double)p_78466_1_) * d2; + if(entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(Potion.field_76440_q)) { + int i = ((EntityLivingBase)entity).func_70660_b(Potion.field_76440_q).func_76459_b(); + if(i < 20) { + d1 *= (double)(1.0F - (float)i / 20.0F); + } else { + d1 = 0.0D; + } + } + + if(d1 < 1.0D) { + if(d1 < 0.0D) { + d1 = 0.0D; + } + + d1 = d1 * d1; + this.field_175080_Q = (float)((double)this.field_175080_Q * d1); + this.field_175082_R = (float)((double)this.field_175082_R * d1); + this.field_175081_S = (float)((double)this.field_175081_S * d1); + } + + if(this.field_82831_U > 0.0F) { + float f14 = this.field_82832_V + (this.field_82831_U - this.field_82832_V) * p_78466_1_; + this.field_175080_Q = this.field_175080_Q * (1.0F - f14) + this.field_175080_Q * 0.7F * f14; + this.field_175082_R = this.field_175082_R * (1.0F - f14) + this.field_175082_R * 0.6F * f14; + this.field_175081_S = this.field_175081_S * (1.0F - f14) + this.field_175081_S * 0.6F * f14; + } + + if(entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(Potion.field_76439_r)) { + float f15 = this.func_180438_a((EntityLivingBase)entity, p_78466_1_); + float f6 = 1.0F / this.field_175080_Q; + if(f6 > 1.0F / this.field_175082_R) { + f6 = 1.0F / this.field_175082_R; + } + + if(f6 > 1.0F / this.field_175081_S) { + f6 = 1.0F / this.field_175081_S; + } + + this.field_175080_Q = this.field_175080_Q * (1.0F - f15) + this.field_175080_Q * f6 * f15; + this.field_175082_R = this.field_175082_R * (1.0F - f15) + this.field_175082_R * f6 * f15; + this.field_175081_S = this.field_175081_S * (1.0F - f15) + this.field_175081_S * f6 * f15; + } + + if(this.field_78531_r.field_71474_y.field_74337_g) { + float f16 = (this.field_175080_Q * 30.0F + this.field_175082_R * 59.0F + this.field_175081_S * 11.0F) / 100.0F; + float f17 = (this.field_175080_Q * 30.0F + this.field_175082_R * 70.0F) / 100.0F; + float f7 = (this.field_175080_Q * 30.0F + this.field_175081_S * 70.0F) / 100.0F; + this.field_175080_Q = f16; + this.field_175082_R = f17; + this.field_175081_S = f7; + } + + if(Reflector.EntityViewRenderEvent_FogColors_Constructor.exists()) { + Object object = Reflector.newInstance(Reflector.EntityViewRenderEvent_FogColors_Constructor, new Object[]{this, entity, block, Float.valueOf(p_78466_1_), Float.valueOf(this.field_175080_Q), Float.valueOf(this.field_175082_R), Float.valueOf(this.field_175081_S)}); + Reflector.postForgeBusEvent(object); + this.field_175080_Q = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_FogColors_red, this.field_175080_Q); + this.field_175082_R = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_FogColors_green, this.field_175082_R); + this.field_175081_S = Reflector.getFieldValueFloat(object, Reflector.EntityViewRenderEvent_FogColors_blue, this.field_175081_S); + } + + Shaders.setClearColor(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 0.0F); + } + + private void func_78468_a(int p_78468_1_, float p_78468_2_) { + Entity entity = this.field_78531_r.func_175606_aa(); + boolean flag = false; + this.fogStandard = false; + if(entity instanceof EntityPlayer) { + flag = ((EntityPlayer)entity).field_71075_bZ.field_75098_d; + } + + GL11.glFog(2918, (FloatBuffer)this.func_78469_a(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 1.0F)); + GL11.glNormal3f(0.0F, -1.0F, 0.0F); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + Block block = ActiveRenderInfo.func_180786_a(this.field_78531_r.field_71441_e, entity, p_78468_2_); + float f1 = -1.0F; + if(Reflector.ForgeHooksClient_getFogDensity.exists()) { + f1 = Reflector.callFloat(Reflector.ForgeHooksClient_getFogDensity, new Object[]{this, entity, block, Float.valueOf(p_78468_2_), Float.valueOf(0.1F)}); + } + + if(f1 >= 0.0F) { + GlStateManager.func_179095_a(f1); + } else if(entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(Potion.field_76440_q)) { + float f2 = 5.0F; + int i = ((EntityLivingBase)entity).func_70660_b(Potion.field_76440_q).func_76459_b(); + if(i < 20) { + f2 = 5.0F + (this.field_78530_s - 5.0F) * (1.0F - (float)i / 20.0F); + } + + if(Config.isShaders()) { + Shaders.setFog(9729); + } else { + GlStateManager.func_179093_d(9729); + } + + if(p_78468_1_ == -1) { + GlStateManager.func_179102_b(0.0F); + GlStateManager.func_179153_c(f2 * 0.8F); + } else { + GlStateManager.func_179102_b(f2 * 0.25F); + GlStateManager.func_179153_c(f2); + } + + if(GLContext.getCapabilities().GL_NV_fog_distance && Config.isFogFancy()) { + GL11.glFogi('\u855a', '\u855b'); + } + } else if(this.field_78500_U) { + if(Config.isShaders()) { + Shaders.setFog(2048); + } else { + GlStateManager.func_179093_d(2048); + } + + GlStateManager.func_179095_a(0.1F); + } else if(block.func_149688_o() == Material.field_151586_h) { + if(Config.isShaders()) { + Shaders.setFog(2048); + } else { + GlStateManager.func_179093_d(2048); + } + + if(entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(Potion.field_76427_o)) { + GlStateManager.func_179095_a(0.01F); + } else { + GlStateManager.func_179095_a(0.1F - (float)EnchantmentHelper.func_180319_a(entity) * 0.03F); + } + + if(Config.isClearWater()) { + GlStateManager.func_179095_a(0.02F); + } + } else if(block.func_149688_o() == Material.field_151587_i) { + if(Config.isShaders()) { + Shaders.setFog(2048); + } else { + GlStateManager.func_179093_d(2048); + } + + GlStateManager.func_179095_a(2.0F); + } else { + float f = this.field_78530_s; + this.fogStandard = true; + if(Config.isShaders()) { + Shaders.setFog(9729); + } else { + GlStateManager.func_179093_d(9729); + } + + if(p_78468_1_ == -1) { + GlStateManager.func_179102_b(0.0F); + GlStateManager.func_179153_c(f); + } else { + GlStateManager.func_179102_b(f * Config.getFogStart()); + GlStateManager.func_179153_c(f); + } + + if(GLContext.getCapabilities().GL_NV_fog_distance) { + if(Config.isFogFancy()) { + GL11.glFogi('\u855a', '\u855b'); + } + + if(Config.isFogFast()) { + GL11.glFogi('\u855a', '\u855c'); + } + } + + if(this.field_78531_r.field_71441_e.field_73011_w.func_76568_b((int)entity.field_70165_t, (int)entity.field_70161_v)) { + GlStateManager.func_179102_b(f * 0.05F); + GlStateManager.func_179153_c(f); + } + + if(Reflector.ForgeHooksClient_onFogRender.exists()) { + Reflector.callVoid(Reflector.ForgeHooksClient_onFogRender, new Object[]{this, entity, block, Float.valueOf(p_78468_2_), Integer.valueOf(p_78468_1_), Float.valueOf(f)}); + } + } + + GlStateManager.func_179142_g(); + GlStateManager.func_179127_m(); + GlStateManager.func_179104_a(1028, 4608); + } + + private FloatBuffer func_78469_a(float p_78469_1_, float p_78469_2_, float p_78469_3_, float p_78469_4_) { + if(Config.isShaders()) { + Shaders.setFogColor(p_78469_1_, p_78469_2_, p_78469_3_); + } + + this.field_78521_m.clear(); + this.field_78521_m.put(p_78469_1_).put(p_78469_2_).put(p_78469_3_).put(p_78469_4_); + this.field_78521_m.flip(); + return this.field_78521_m; + } + + public MapItemRenderer func_147701_i() { + return this.field_147709_v; + } + + private void waitForServerThread() { + this.serverWaitTimeCurrent = 0; + if(Config.isSmoothWorld() && Config.isSingleProcessor()) { + if(this.field_78531_r.func_71387_A()) { + IntegratedServer integratedserver = this.field_78531_r.func_71401_C(); + if(integratedserver != null) { + boolean flag = this.field_78531_r.func_147113_T(); + if(!flag && !(this.field_78531_r.field_71462_r instanceof GuiDownloadTerrain)) { + if(this.serverWaitTime > 0) { + Lagometer.timerServer.start(); + Config.sleep((long)this.serverWaitTime); + Lagometer.timerServer.end(); + this.serverWaitTimeCurrent = this.serverWaitTime; + } + + long i = System.nanoTime() / 1000000L; + if(this.lastServerTime != 0L && this.lastServerTicks != 0) { + long j = i - this.lastServerTime; + if(j < 0L) { + this.lastServerTime = i; + j = 0L; + } + + if(j >= 50L) { + this.lastServerTime = i; + int k = integratedserver.func_71259_af(); + int l = k - this.lastServerTicks; + if(l < 0) { + this.lastServerTicks = k; + l = 0; + } + + if(l < 1 && this.serverWaitTime < 100) { + this.serverWaitTime += 2; + } + + if(l > 1 && this.serverWaitTime > 0) { + --this.serverWaitTime; + } + + this.lastServerTicks = k; + } + } else { + this.lastServerTime = i; + this.lastServerTicks = integratedserver.func_71259_af(); + this.avgServerTickDiff = 1.0F; + this.avgServerTimeDiff = 50.0F; + } + } else { + if(this.field_78531_r.field_71462_r instanceof GuiDownloadTerrain) { + Config.sleep(20L); + } + + this.lastServerTime = 0L; + this.lastServerTicks = 0; + } + } + } + } else { + this.lastServerTime = 0L; + this.lastServerTicks = 0; + } + } + + private void frameInit() { + if(!this.initialized) { + TextureUtils.registerResourceListener(); + if(Config.getBitsOs() == 64 && Config.getBitsJre() == 32) { + Config.setNotify64BitJava(true); + } + + this.initialized = true; + } + + Config.checkDisplayMode(); + World world = this.field_78531_r.field_71441_e; + if(world != null) { + if(Config.getNewRelease() != null) { + String s = "HD_U".replace("HD_U", "HD Ultra").replace("L", "Light"); + String s1 = s + " " + Config.getNewRelease(); + ChatComponentText chatcomponenttext = new ChatComponentText(I18n.func_135052_a("of.message.newVersion", new Object[]{s1})); + this.field_78531_r.field_71456_v.func_146158_b().func_146227_a(chatcomponenttext); + Config.setNewRelease((String)null); + } + + if(Config.isNotify64BitJava()) { + Config.setNotify64BitJava(false); + ChatComponentText chatcomponenttext1 = new ChatComponentText(I18n.func_135052_a("of.message.java64Bit", new Object[0])); + this.field_78531_r.field_71456_v.func_146158_b().func_146227_a(chatcomponenttext1); + } + } + + if(this.field_78531_r.field_71462_r instanceof MainMenu) { + this.updateMainMenu((MainMenu)this.field_78531_r.field_71462_r); + } + + if(this.updatedWorld != world) { + RandomMobs.worldChanged(this.updatedWorld, world); + Config.updateThreadPriorities(); + this.lastServerTime = 0L; + this.lastServerTicks = 0; + this.updatedWorld = world; + } + + if(!this.setFxaaShader(Shaders.configAntialiasingLevel)) { + Shaders.configAntialiasingLevel = 0; + } + + } + + private void frameFinish() { + if(this.field_78531_r.field_71441_e != null) { + long i = System.currentTimeMillis(); + if(i > this.lastErrorCheckTimeMs + 10000L) { + this.lastErrorCheckTimeMs = i; + int j = GL11.glGetError(); + if(j != 0) { + String s = GLU.gluErrorString(j); + ChatComponentText chatcomponenttext = new ChatComponentText(I18n.func_135052_a("of.message.openglError", new Object[]{Integer.valueOf(j), s})); + this.field_78531_r.field_71456_v.func_146158_b().func_146227_a(chatcomponenttext); + } + } + } + + } + + private void updateMainMenu(MainMenu p_updateMainMenu_1_) { + try { + String s = null; + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + int i = calendar.get(5); + int j = calendar.get(2) + 1; + if(i == 8 && j == 4) { + s = "Happy birthday, OptiFine!"; + } + + if(i == 14 && j == 8) { + s = "Happy birthday, sp614x!"; + } + + if(s == null) { + return; + } + + Field[] afield = MainMenu.class.getDeclaredFields(); + + for(int k = 0; k < afield.length; ++k) { + if(afield[k].getType() == String.class) { + afield[k].setAccessible(true); + afield[k].set(p_updateMainMenu_1_, s); + break; + } + } + } catch (Throwable var8) { + ; + } + + } + + public boolean setFxaaShader(int p_setFxaaShader_1_) { + if(!OpenGlHelper.func_148822_b()) { + return false; + } else if(this.field_147707_d != null && this.field_147707_d != this.fxaaShaders[2] && this.field_147707_d != this.fxaaShaders[4]) { + return true; + } else if(p_setFxaaShader_1_ != 2 && p_setFxaaShader_1_ != 4) { + if(this.field_147707_d == null) { + return true; + } else { + this.field_147707_d.func_148021_a(); + this.field_147707_d = null; + return true; + } + } else if(this.field_147707_d != null && this.field_147707_d == this.fxaaShaders[p_setFxaaShader_1_]) { + return true; + } else if(this.field_78531_r.field_71441_e == null) { + return true; + } else { + this.func_175069_a(new ResourceLocation("shaders/post/fxaa_of_" + p_setFxaaShader_1_ + "x.json")); + this.fxaaShaders[p_setFxaaShader_1_] = this.field_147707_d; + return this.field_175083_ad; + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/EnumFaceDirection.java b/src/minecraft/net/minecraft/client/renderer/EnumFaceDirection.java new file mode 100644 index 0000000..a3e372a --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/EnumFaceDirection.java @@ -0,0 +1,62 @@ +package net.minecraft.client.renderer; + +import net.minecraft.util.EnumFacing; + +public enum EnumFaceDirection +{ + DOWN(new EnumFaceDirection.VertexInformation[]{new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.WEST_INDEX, EnumFaceDirection.Constants.DOWN_INDEX, EnumFaceDirection.Constants.SOUTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.WEST_INDEX, EnumFaceDirection.Constants.DOWN_INDEX, EnumFaceDirection.Constants.NORTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.EAST_INDEX, EnumFaceDirection.Constants.DOWN_INDEX, EnumFaceDirection.Constants.NORTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.EAST_INDEX, EnumFaceDirection.Constants.DOWN_INDEX, EnumFaceDirection.Constants.SOUTH_INDEX)}), + UP(new EnumFaceDirection.VertexInformation[]{new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.WEST_INDEX, EnumFaceDirection.Constants.UP_INDEX, EnumFaceDirection.Constants.NORTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.WEST_INDEX, EnumFaceDirection.Constants.UP_INDEX, EnumFaceDirection.Constants.SOUTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.EAST_INDEX, EnumFaceDirection.Constants.UP_INDEX, EnumFaceDirection.Constants.SOUTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.EAST_INDEX, EnumFaceDirection.Constants.UP_INDEX, EnumFaceDirection.Constants.NORTH_INDEX)}), + NORTH(new EnumFaceDirection.VertexInformation[]{new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.EAST_INDEX, EnumFaceDirection.Constants.UP_INDEX, EnumFaceDirection.Constants.NORTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.EAST_INDEX, EnumFaceDirection.Constants.DOWN_INDEX, EnumFaceDirection.Constants.NORTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.WEST_INDEX, EnumFaceDirection.Constants.DOWN_INDEX, EnumFaceDirection.Constants.NORTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.WEST_INDEX, EnumFaceDirection.Constants.UP_INDEX, EnumFaceDirection.Constants.NORTH_INDEX)}), + SOUTH(new EnumFaceDirection.VertexInformation[]{new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.WEST_INDEX, EnumFaceDirection.Constants.UP_INDEX, EnumFaceDirection.Constants.SOUTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.WEST_INDEX, EnumFaceDirection.Constants.DOWN_INDEX, EnumFaceDirection.Constants.SOUTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.EAST_INDEX, EnumFaceDirection.Constants.DOWN_INDEX, EnumFaceDirection.Constants.SOUTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.EAST_INDEX, EnumFaceDirection.Constants.UP_INDEX, EnumFaceDirection.Constants.SOUTH_INDEX)}), + WEST(new EnumFaceDirection.VertexInformation[]{new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.WEST_INDEX, EnumFaceDirection.Constants.UP_INDEX, EnumFaceDirection.Constants.NORTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.WEST_INDEX, EnumFaceDirection.Constants.DOWN_INDEX, EnumFaceDirection.Constants.NORTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.WEST_INDEX, EnumFaceDirection.Constants.DOWN_INDEX, EnumFaceDirection.Constants.SOUTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.WEST_INDEX, EnumFaceDirection.Constants.UP_INDEX, EnumFaceDirection.Constants.SOUTH_INDEX)}), + EAST(new EnumFaceDirection.VertexInformation[]{new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.EAST_INDEX, EnumFaceDirection.Constants.UP_INDEX, EnumFaceDirection.Constants.SOUTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.EAST_INDEX, EnumFaceDirection.Constants.DOWN_INDEX, EnumFaceDirection.Constants.SOUTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.EAST_INDEX, EnumFaceDirection.Constants.DOWN_INDEX, EnumFaceDirection.Constants.NORTH_INDEX), new EnumFaceDirection.VertexInformation(EnumFaceDirection.Constants.EAST_INDEX, EnumFaceDirection.Constants.UP_INDEX, EnumFaceDirection.Constants.NORTH_INDEX)}); + + private static final EnumFaceDirection[] facings = new EnumFaceDirection[6]; + private final EnumFaceDirection.VertexInformation[] vertexInfos; + + public static EnumFaceDirection getFacing(EnumFacing facing) + { + return facings[facing.getIndex()]; + } + + private EnumFaceDirection(EnumFaceDirection.VertexInformation[] vertexInfosIn) + { + this.vertexInfos = vertexInfosIn; + } + + public EnumFaceDirection.VertexInformation func_179025_a(int p_179025_1_) + { + return this.vertexInfos[p_179025_1_]; + } + + static { + facings[EnumFaceDirection.Constants.DOWN_INDEX] = DOWN; + facings[EnumFaceDirection.Constants.UP_INDEX] = UP; + facings[EnumFaceDirection.Constants.NORTH_INDEX] = NORTH; + facings[EnumFaceDirection.Constants.SOUTH_INDEX] = SOUTH; + facings[EnumFaceDirection.Constants.WEST_INDEX] = WEST; + facings[EnumFaceDirection.Constants.EAST_INDEX] = EAST; + } + + public static final class Constants { + public static final int SOUTH_INDEX = EnumFacing.SOUTH.getIndex(); + public static final int UP_INDEX = EnumFacing.UP.getIndex(); + public static final int EAST_INDEX = EnumFacing.EAST.getIndex(); + public static final int NORTH_INDEX = EnumFacing.NORTH.getIndex(); + public static final int DOWN_INDEX = EnumFacing.DOWN.getIndex(); + public static final int WEST_INDEX = EnumFacing.WEST.getIndex(); + } + + public static class VertexInformation { + public final int field_179184_a; + public final int field_179182_b; + public final int field_179183_c; + + private VertexInformation(int p_i46270_1_, int p_i46270_2_, int p_i46270_3_) + { + this.field_179184_a = p_i46270_1_; + this.field_179182_b = p_i46270_2_; + this.field_179183_c = p_i46270_3_; + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/GLAllocation.java b/src/minecraft/net/minecraft/client/renderer/GLAllocation.java new file mode 100644 index 0000000..8a71d8f --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/GLAllocation.java @@ -0,0 +1,73 @@ +package net.minecraft.client.renderer; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.glu.GLU; + +public class GLAllocation +{ + /** + * Generates the specified number of display lists and returns the first index. + */ + + public static synchronized int generateDisplayLists(int range) + { + int i = GL11.glGenLists(range); + + if (i == 0) + { + int j = GL11.glGetError(); + String s = "No error code reported"; + + if (j != 0) + { + s = GLU.gluErrorString(j); + } + + throw new IllegalStateException("glGenLists returned an ID of 0 for a count of " + range + ", GL error (" + j + "): " + s); + } + else + { + return i; + } + } + + public static synchronized void deleteDisplayLists(int list, int range) + { + GL11.glDeleteLists(list, range); + } + + public static synchronized void deleteDisplayLists(int list) + { + GL11.glDeleteLists(list, 1); + } + + /** + * Creates and returns a direct byte buffer with the specified capacity. Applies native ordering to speed up access. + */ + + public static synchronized ByteBuffer createDirectByteBuffer(int capacity) + { + return ByteBuffer.allocateDirect(capacity).order(ByteOrder.nativeOrder()); + } + + /** + * Creates and returns a direct int buffer with the specified capacity. Applies native ordering to speed up access. + */ + public static IntBuffer createDirectIntBuffer(int capacity) + { + return createDirectByteBuffer(capacity << 2).asIntBuffer(); + } + + /** + * Creates and returns a direct float buffer with the specified capacity. Applies native ordering to speed up + * access. + */ + public static FloatBuffer createDirectFloatBuffer(int capacity) + { + return createDirectByteBuffer(capacity << 2).asFloatBuffer(); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/GlStateManager.java b/src/minecraft/net/minecraft/client/renderer/GlStateManager.java new file mode 100644 index 0000000..a856e45 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/GlStateManager.java @@ -0,0 +1,1013 @@ +package net.minecraft.client.renderer; + +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL13; + +import optifine.Config; + +public class GlStateManager +{ + private static GlStateManager.AlphaState alphaState = new GlStateManager.AlphaState((GlStateManager.GlStateManager$1)null); + private static GlStateManager.BooleanState lightingState = new GlStateManager.BooleanState(2896); + private static GlStateManager.BooleanState[] lightState = new GlStateManager.BooleanState[8]; + private static GlStateManager.ColorMaterialState colorMaterialState = new GlStateManager.ColorMaterialState((GlStateManager.GlStateManager$1)null); + private static GlStateManager.BlendState blendState = new GlStateManager.BlendState((GlStateManager.GlStateManager$1)null); + private static GlStateManager.DepthState depthState = new GlStateManager.DepthState((GlStateManager.GlStateManager$1)null); + private static GlStateManager.FogState fogState = new GlStateManager.FogState((GlStateManager.GlStateManager$1)null); + private static GlStateManager.CullState cullState = new GlStateManager.CullState((GlStateManager.GlStateManager$1)null); + private static GlStateManager.PolygonOffsetState polygonOffsetState = new GlStateManager.PolygonOffsetState((GlStateManager.GlStateManager$1)null); + private static GlStateManager.ColorLogicState colorLogicState = new GlStateManager.ColorLogicState((GlStateManager.GlStateManager$1)null); + private static GlStateManager.TexGenState texGenState = new GlStateManager.TexGenState((GlStateManager.GlStateManager$1)null); + private static GlStateManager.ClearState clearState = new GlStateManager.ClearState((GlStateManager.GlStateManager$1)null); + private static GlStateManager.StencilState stencilState = new GlStateManager.StencilState((GlStateManager.GlStateManager$1)null); + private static GlStateManager.BooleanState normalizeState = new GlStateManager.BooleanState(2977); + public static int activeTextureUnit = 0; + public static GlStateManager.TextureState[] textureState = new GlStateManager.TextureState[32]; + private static int activeShadeModel = 7425; + private static GlStateManager.BooleanState rescaleNormalState = new GlStateManager.BooleanState(32826); + private static GlStateManager.ColorMask colorMaskState = new GlStateManager.ColorMask((GlStateManager.GlStateManager$1)null); + private static GlStateManager.Color colorState = new GlStateManager.Color(); + private static final String __OBFID = "CL_00002558"; + public static boolean clearEnabled = true; + + public static void pushAttrib() + { + GL11.glPushAttrib(8256); + } + + public static void popAttrib() + { + GL11.glPopAttrib(); + } + + public static void disableAlpha() + { + alphaState.field_179208_a.setDisabled(); + } + + public static void enableAlpha() + { + alphaState.field_179208_a.setEnabled(); + } + + public static void alphaFunc(int func, float ref) + { + if (func != alphaState.func || ref != alphaState.ref) + { + alphaState.func = func; + alphaState.ref = ref; + GL11.glAlphaFunc(func, ref); + } + } + + public static void enableLighting() + { + lightingState.setEnabled(); + } + + public static void disableLighting() + { + lightingState.setDisabled(); + } + + public static void enableLight(int light) + { + lightState[light].setEnabled(); + } + + public static void disableLight(int light) + { + lightState[light].setDisabled(); + } + + public static void enableColorMaterial() + { + colorMaterialState.field_179191_a.setEnabled(); + } + + public static void disableColorMaterial() + { + colorMaterialState.field_179191_a.setDisabled(); + } + + public static void colorMaterial(int face, int mode) + { + if (face != colorMaterialState.field_179189_b || mode != colorMaterialState.field_179190_c) + { + colorMaterialState.field_179189_b = face; + colorMaterialState.field_179190_c = mode; + GL11.glColorMaterial(face, mode); + } + } + + public static void disableDepth() + { + depthState.depthTest.setDisabled(); + } + + public static void enableDepth() + { + depthState.depthTest.setEnabled(); + } + + public static void depthFunc(int depthFunc) + { + if (depthFunc != depthState.depthFunc) + { + depthState.depthFunc = depthFunc; + GL11.glDepthFunc(depthFunc); + } + } + + public static void depthMask(boolean flagIn) + { + if (flagIn != depthState.maskEnabled) + { + depthState.maskEnabled = flagIn; + GL11.glDepthMask(flagIn); + } + } + + public static void disableBlend() + { + blendState.field_179213_a.setDisabled(); + } + + public static void enableBlend() + { + blendState.field_179213_a.setEnabled(); + } + + public static void blendFunc(int srcFactor, int dstFactor) + { + if (srcFactor != blendState.srcFactor || dstFactor != blendState.dstFactor) + { + blendState.srcFactor = srcFactor; + blendState.dstFactor = dstFactor; + GL11.glBlendFunc(srcFactor, dstFactor); + } + } + + public static void tryBlendFuncSeparate(int srcFactor, int dstFactor, int srcFactorAlpha, int dstFactorAlpha) + { + if (srcFactor != blendState.srcFactor || dstFactor != blendState.dstFactor || srcFactorAlpha != blendState.srcFactorAlpha || dstFactorAlpha != blendState.dstFactorAlpha) + { + blendState.srcFactor = srcFactor; + blendState.dstFactor = dstFactor; + blendState.srcFactorAlpha = srcFactorAlpha; + blendState.dstFactorAlpha = dstFactorAlpha; + OpenGlHelper.glBlendFunc(srcFactor, dstFactor, srcFactorAlpha, dstFactorAlpha); + } + } + + public static void enableFog() + { + fogState.field_179049_a.setEnabled(); + } + + public static void disableFog() + { + fogState.field_179049_a.setDisabled(); + } + + public static void setFog(int param) + { + if (param != fogState.field_179047_b) + { + fogState.field_179047_b = param; + GL11.glFogi(GL11.GL_FOG_MODE, param); + } + } + + public static void setFogDensity(float param) + { + if (param != fogState.field_179048_c) + { + fogState.field_179048_c = param; + GL11.glFogf(GL11.GL_FOG_DENSITY, param); + } + } + + public static void setFogStart(float param) + { + if (param != fogState.field_179045_d) + { + fogState.field_179045_d = param; + GL11.glFogf(GL11.GL_FOG_START, param); + } + } + + public static void setFogEnd(float param) + { + if (param != fogState.field_179046_e) + { + fogState.field_179046_e = param; + GL11.glFogf(GL11.GL_FOG_END, param); + } + } + + public static void enableCull() + { + cullState.field_179054_a.setEnabled(); + } + + public static void disableCull() + { + cullState.field_179054_a.setDisabled(); + } + + public static void cullFace(int mode) + { + if (mode != cullState.field_179053_b) + { + cullState.field_179053_b = mode; + GL11.glCullFace(mode); + } + } + + public static void enablePolygonOffset() + { + polygonOffsetState.field_179044_a.setEnabled(); + } + + public static void disablePolygonOffset() + { + polygonOffsetState.field_179044_a.setDisabled(); + } + + public static void doPolygonOffset(float factor, float units) + { + if (factor != polygonOffsetState.field_179043_c || units != polygonOffsetState.field_179041_d) + { + polygonOffsetState.field_179043_c = factor; + polygonOffsetState.field_179041_d = units; + GL11.glPolygonOffset(factor, units); + } + } + + public static void enableColorLogic() + { + colorLogicState.field_179197_a.setEnabled(); + } + + public static void disableColorLogic() + { + colorLogicState.field_179197_a.setDisabled(); + } + + public static void colorLogicOp(int opcode) + { + if (opcode != colorLogicState.field_179196_b) + { + colorLogicState.field_179196_b = opcode; + GL11.glLogicOp(opcode); + } + } + + public static void enableTexGenCoord(GlStateManager.TexGen p_179087_0_) + { + texGenCoord(p_179087_0_).field_179067_a.setEnabled(); + } + + public static void disableTexGenCoord(GlStateManager.TexGen p_179100_0_) + { + texGenCoord(p_179100_0_).field_179067_a.setDisabled(); + } + + public static void texGen(GlStateManager.TexGen p_179149_0_, int p_179149_1_) + { + GlStateManager.TexGenCoord glstatemanager$texgencoord = texGenCoord(p_179149_0_); + + if (p_179149_1_ != glstatemanager$texgencoord.field_179066_c) + { + glstatemanager$texgencoord.field_179066_c = p_179149_1_; + GL11.glTexGeni(glstatemanager$texgencoord.field_179065_b, GL11.GL_TEXTURE_GEN_MODE, p_179149_1_); + } + } + + public static void func_179105_a(GlStateManager.TexGen p_179105_0_, int pname, FloatBuffer params) + { + GL11.glTexGen(texGenCoord(p_179105_0_).field_179065_b, pname, params); + } + + private static GlStateManager.TexGenCoord texGenCoord(GlStateManager.TexGen p_179125_0_) + { + switch (GlStateManager.GlStateManager$1.field_179175_a[p_179125_0_.ordinal()]) + { + case 1: + return texGenState.field_179064_a; + + case 2: + return texGenState.field_179062_b; + + case 3: + return texGenState.field_179063_c; + + case 4: + return texGenState.field_179061_d; + + default: + return texGenState.field_179064_a; + } + } + + public static void setActiveTexture(int texture) + { + if (activeTextureUnit != texture - OpenGlHelper.defaultTexUnit) + { + activeTextureUnit = texture - OpenGlHelper.defaultTexUnit; + OpenGlHelper.setActiveTexture(texture); + } + } + + public static void enableTexture2D() + { + textureState[activeTextureUnit].texture2DState.setEnabled(); + } + + public static void disableTexture2D() + { + textureState[activeTextureUnit].texture2DState.setDisabled(); + } + + public static int generateTexture() + { + return GL11.glGenTextures(); + } + + public static void deleteTexture(int texture) + { + if (texture != 0) + { + GL11.glDeleteTextures(texture); + + for (GlStateManager.TextureState glstatemanager$texturestate : textureState) + { + if (glstatemanager$texturestate.textureName == texture) + { + glstatemanager$texturestate.textureName = 0; + } + } + } + } + + public static void bindTexture(int texture) + { + if (texture != textureState[activeTextureUnit].textureName) + { + textureState[activeTextureUnit].textureName = texture; + GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture); + } + } + + public static void bindCurrentTexture() + { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureState[activeTextureUnit].textureName); + } + + public static void enableNormalize() + { + normalizeState.setEnabled(); + } + + public static void disableNormalize() + { + normalizeState.setDisabled(); + } + + public static void shadeModel(int mode) + { + if (mode != activeShadeModel) + { + activeShadeModel = mode; + GL11.glShadeModel(mode); + } + } + + public static void enableRescaleNormal() + { + rescaleNormalState.setEnabled(); + } + + public static void disableRescaleNormal() + { + rescaleNormalState.setDisabled(); + } + + public static void viewport(int x, int y, int width, int height) + { + GL11.glViewport(x, y, width, height); + } + + public static void colorMask(boolean red, boolean green, boolean blue, boolean alpha) + { + if (red != colorMaskState.red || green != colorMaskState.green || blue != colorMaskState.blue || alpha != colorMaskState.alpha) + { + colorMaskState.red = red; + colorMaskState.green = green; + colorMaskState.blue = blue; + colorMaskState.alpha = alpha; + GL11.glColorMask(red, green, blue, alpha); + } + } + + public static void clearDepth(double depth) + { + if (depth != clearState.field_179205_a) + { + clearState.field_179205_a = depth; + GL11.glClearDepth(depth); + } + } + + public static void clearColor(float red, float green, float blue, float alpha) + { + if (red != clearState.field_179203_b.red || green != clearState.field_179203_b.green || blue != clearState.field_179203_b.blue || alpha != clearState.field_179203_b.alpha) + { + clearState.field_179203_b.red = red; + clearState.field_179203_b.green = green; + clearState.field_179203_b.blue = blue; + clearState.field_179203_b.alpha = alpha; + GL11.glClearColor(red, green, blue, alpha); + } + } + + public static void clear(int mask) + { + if (clearEnabled) + { + GL11.glClear(mask); + } + } + + public static void matrixMode(int mode) + { + GL11.glMatrixMode(mode); + } + + public static void loadIdentity() + { + GL11.glLoadIdentity(); + } + + public static void pushMatrix() + { + GL11.glPushMatrix(); + } + + public static void popMatrix() + { + GL11.glPopMatrix(); + } + + public static void getFloat(int pname, FloatBuffer params) + { + GL11.glGetFloat(pname, params); + } + + public static void ortho(double left, double right, double bottom, double top, double zNear, double zFar) + { + GL11.glOrtho(left, right, bottom, top, zNear, zFar); + } + + public static void rotate(float angle, float x, float y, float z) + { + GL11.glRotatef(angle, x, y, z); + } + + public static void scale(float x, float y, float z) + { + GL11.glScalef(x, y, z); + } + + public static void scale(double x, double y, double z) + { + GL11.glScaled(x, y, z); + } + + public static void translate(float x, float y, float z) + { + GL11.glTranslatef(x, y, z); + } + + public static void translate(double x, double y, double z) + { + GL11.glTranslated(x, y, z); + } + + public static void multMatrix(FloatBuffer matrix) + { + GL11.glMultMatrix(matrix); + } + + public static void color(float colorRed, float colorGreen, float colorBlue, float colorAlpha) + { + if (colorRed != colorState.red || colorGreen != colorState.green || colorBlue != colorState.blue || colorAlpha != colorState.alpha) + { + colorState.red = colorRed; + colorState.green = colorGreen; + colorState.blue = colorBlue; + colorState.alpha = colorAlpha; + GL11.glColor4f(colorRed, colorGreen, colorBlue, colorAlpha); + } + } + + public static void color(float colorRed, float colorGreen, float colorBlue) + { + color(colorRed, colorGreen, colorBlue, 1.0F); + } + + public static void resetColor() + { + colorState.red = colorState.green = colorState.blue = colorState.alpha = -1.0F; + } + + public static void callList(int list) + { + GL11.glCallList(list); + } + + public static int getActiveTextureUnit() + { + return OpenGlHelper.defaultTexUnit + activeTextureUnit; + } + + public static int getBoundTexture() + { + return textureState[activeTextureUnit].textureName; + } + + public static void checkBoundTexture() + { + if (Config.isMinecraftThread()) + { + int i = GL11.glGetInteger(GL13.GL_ACTIVE_TEXTURE); + int j = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D); + int k = getActiveTextureUnit(); + int l = getBoundTexture(); + + if (l > 0) + { + if (i != k || j != l) + { + Config.dbg("checkTexture: act: " + k + ", glAct: " + i + ", tex: " + l + ", glTex: " + j); + } + } + } + } + + public static void deleteTextures(IntBuffer p_deleteTextures_0_) + { + p_deleteTextures_0_.rewind(); + + while (p_deleteTextures_0_.position() < p_deleteTextures_0_.limit()) + { + int i = p_deleteTextures_0_.get(); + deleteTexture(i); + } + + p_deleteTextures_0_.rewind(); + } + + static + { + for (int i = 0; i < 8; ++i) + { + lightState[i] = new GlStateManager.BooleanState(16384 + i); + } + + for (int j = 0; j < textureState.length; ++j) + { + textureState[j] = new GlStateManager.TextureState((GlStateManager.GlStateManager$1)null); + } + } + + static final class GlStateManager$1 + { + static final int[] field_179175_a = new int[GlStateManager.TexGen.values().length]; + private static final String __OBFID = "CL_00002557"; + + static + { + try + { + field_179175_a[GlStateManager.TexGen.S.ordinal()] = 1; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_179175_a[GlStateManager.TexGen.T.ordinal()] = 2; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_179175_a[GlStateManager.TexGen.R.ordinal()] = 3; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_179175_a[GlStateManager.TexGen.Q.ordinal()] = 4; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } + + static class AlphaState + { + public GlStateManager.BooleanState field_179208_a; + public int func; + public float ref; + private static final String __OBFID = "CL_00002556"; + + private AlphaState() + { + this.field_179208_a = new GlStateManager.BooleanState(3008); + this.func = 519; + this.ref = -1.0F; + } + + AlphaState(GlStateManager.GlStateManager$1 p_i46489_1_) + { + this(); + } + } + + static class BlendState + { + public GlStateManager.BooleanState field_179213_a; + public int srcFactor; + public int dstFactor; + public int srcFactorAlpha; + public int dstFactorAlpha; + private static final String __OBFID = "CL_00002555"; + + private BlendState() + { + this.field_179213_a = new GlStateManager.BooleanState(3042); + this.srcFactor = 1; + this.dstFactor = 0; + this.srcFactorAlpha = 1; + this.dstFactorAlpha = 0; + } + + BlendState(GlStateManager.GlStateManager$1 p_i46488_1_) + { + this(); + } + } + + static class BooleanState + { + private final int capability; + private boolean currentState = false; + private static final String __OBFID = "CL_00002554"; + + public BooleanState(int capabilityIn) + { + this.capability = capabilityIn; + } + + public void setDisabled() + { + this.setState(false); + } + + public void setEnabled() + { + this.setState(true); + } + + public void setState(boolean state) + { + if (state != this.currentState) + { + this.currentState = state; + + if (state) + { + GL11.glEnable(this.capability); + } + else + { + GL11.glDisable(this.capability); + } + } + } + } + + static class ClearState + { + public double field_179205_a; + public GlStateManager.Color field_179203_b; + public int field_179204_c; + private static final String __OBFID = "CL_00002553"; + + private ClearState() + { + this.field_179205_a = 1.0D; + this.field_179203_b = new GlStateManager.Color(0.0F, 0.0F, 0.0F, 0.0F); + this.field_179204_c = 0; + } + + ClearState(GlStateManager.GlStateManager$1 p_i46487_1_) + { + this(); + } + } + + static class Color + { + public float red = 1.0F; + public float green = 1.0F; + public float blue = 1.0F; + public float alpha = 1.0F; + private static final String __OBFID = "CL_00002552"; + + public Color() + { + } + + public Color(float redIn, float greenIn, float blueIn, float alphaIn) + { + this.red = redIn; + this.green = greenIn; + this.blue = blueIn; + this.alpha = alphaIn; + } + } + + static class ColorLogicState + { + public GlStateManager.BooleanState field_179197_a; + public int field_179196_b; + private static final String __OBFID = "CL_00002551"; + + private ColorLogicState() + { + this.field_179197_a = new GlStateManager.BooleanState(3058); + this.field_179196_b = 5379; + } + + ColorLogicState(GlStateManager.GlStateManager$1 p_i46486_1_) + { + this(); + } + } + + static class ColorMask + { + public boolean red; + public boolean green; + public boolean blue; + public boolean alpha; + private static final String __OBFID = "CL_00002550"; + + private ColorMask() + { + this.red = true; + this.green = true; + this.blue = true; + this.alpha = true; + } + + ColorMask(GlStateManager.GlStateManager$1 p_i46485_1_) + { + this(); + } + } + + static class ColorMaterialState + { + public GlStateManager.BooleanState field_179191_a; + public int field_179189_b; + public int field_179190_c; + private static final String __OBFID = "CL_00002549"; + + private ColorMaterialState() + { + this.field_179191_a = new GlStateManager.BooleanState(2903); + this.field_179189_b = 1032; + this.field_179190_c = 5634; + } + + ColorMaterialState(GlStateManager.GlStateManager$1 p_i46484_1_) + { + this(); + } + } + + static class CullState + { + public GlStateManager.BooleanState field_179054_a; + public int field_179053_b; + private static final String __OBFID = "CL_00002548"; + + private CullState() + { + this.field_179054_a = new GlStateManager.BooleanState(2884); + this.field_179053_b = 1029; + } + + CullState(GlStateManager.GlStateManager$1 p_i46483_1_) + { + this(); + } + } + + static class DepthState + { + public GlStateManager.BooleanState depthTest; + public boolean maskEnabled; + public int depthFunc; + private static final String __OBFID = "CL_00002547"; + + private DepthState() + { + this.depthTest = new GlStateManager.BooleanState(2929); + this.maskEnabled = true; + this.depthFunc = 513; + } + + DepthState(GlStateManager.GlStateManager$1 p_i46482_1_) + { + this(); + } + } + + static class FogState + { + public GlStateManager.BooleanState field_179049_a; + public int field_179047_b; + public float field_179048_c; + public float field_179045_d; + public float field_179046_e; + private static final String __OBFID = "CL_00002546"; + + private FogState() + { + this.field_179049_a = new GlStateManager.BooleanState(2912); + this.field_179047_b = 2048; + this.field_179048_c = 1.0F; + this.field_179045_d = 0.0F; + this.field_179046_e = 1.0F; + } + + FogState(GlStateManager.GlStateManager$1 p_i46481_1_) + { + this(); + } + } + + static class PolygonOffsetState + { + public GlStateManager.BooleanState field_179044_a; + public GlStateManager.BooleanState field_179042_b; + public float field_179043_c; + public float field_179041_d; + private static final String __OBFID = "CL_00002545"; + + private PolygonOffsetState() + { + this.field_179044_a = new GlStateManager.BooleanState(32823); + this.field_179042_b = new GlStateManager.BooleanState(10754); + this.field_179043_c = 0.0F; + this.field_179041_d = 0.0F; + } + + PolygonOffsetState(GlStateManager.GlStateManager$1 p_i46480_1_) + { + this(); + } + } + + static class StencilFunc + { + public int field_179081_a; + public int field_179079_b; + public int field_179080_c; + private static final String __OBFID = "CL_00002544"; + + private StencilFunc() + { + this.field_179081_a = 519; + this.field_179079_b = 0; + this.field_179080_c = -1; + } + + StencilFunc(GlStateManager.GlStateManager$1 p_i46479_1_) + { + this(); + } + } + + static class StencilState + { + public GlStateManager.StencilFunc field_179078_a; + public int field_179076_b; + public int field_179077_c; + public int field_179074_d; + public int field_179075_e; + private static final String __OBFID = "CL_00002543"; + + private StencilState() + { + this.field_179078_a = new GlStateManager.StencilFunc((GlStateManager.GlStateManager$1)null); + this.field_179076_b = -1; + this.field_179077_c = 7680; + this.field_179074_d = 7680; + this.field_179075_e = 7680; + } + + StencilState(GlStateManager.GlStateManager$1 p_i46478_1_) + { + this(); + } + } + + public static enum TexGen + { + S("S", 0), + T("T", 1), + R("R", 2), + Q("Q", 3); + + private static final GlStateManager.TexGen[] $VALUES = new GlStateManager.TexGen[]{S, T, R, Q}; + private static final String __OBFID = "CL_00002542"; + + private TexGen(String p_i3_3_, int p_i3_4_) + { + } + } + + static class TexGenCoord + { + public GlStateManager.BooleanState field_179067_a; + public int field_179065_b; + public int field_179066_c = -1; + private static final String __OBFID = "CL_00002541"; + + public TexGenCoord(int p_i46254_1_, int p_i46254_2_) + { + this.field_179065_b = p_i46254_1_; + this.field_179067_a = new GlStateManager.BooleanState(p_i46254_2_); + } + } + + static class TexGenState + { + public GlStateManager.TexGenCoord field_179064_a; + public GlStateManager.TexGenCoord field_179062_b; + public GlStateManager.TexGenCoord field_179063_c; + public GlStateManager.TexGenCoord field_179061_d; + private static final String __OBFID = "CL_00002540"; + + private TexGenState() + { + this.field_179064_a = new GlStateManager.TexGenCoord(8192, 3168); + this.field_179062_b = new GlStateManager.TexGenCoord(8193, 3169); + this.field_179063_c = new GlStateManager.TexGenCoord(8194, 3170); + this.field_179061_d = new GlStateManager.TexGenCoord(8195, 3171); + } + + TexGenState(GlStateManager.GlStateManager$1 p_i46477_1_) + { + this(); + } + } + + public static class TextureState + { + public GlStateManager.BooleanState texture2DState; + public int textureName; + private static final String __OBFID = "CL_00002539"; + + private TextureState() + { + this.texture2DState = new GlStateManager.BooleanState(3553); + this.textureName = 0; + } + + TextureState(GlStateManager.GlStateManager$1 p_i46476_1_) + { + this(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/IImageBuffer.java b/src/minecraft/net/minecraft/client/renderer/IImageBuffer.java new file mode 100644 index 0000000..4f62307 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/IImageBuffer.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer; + +import java.awt.image.BufferedImage; + +public interface IImageBuffer +{ + BufferedImage parseUserSkin(BufferedImage image); + + void skinAvailable(); +} diff --git a/src/minecraft/net/minecraft/client/renderer/ImageBufferDownload.java b/src/minecraft/net/minecraft/client/renderer/ImageBufferDownload.java new file mode 100644 index 0000000..facbf09 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/ImageBufferDownload.java @@ -0,0 +1,127 @@ +package net.minecraft.client.renderer; + +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.awt.image.DataBufferInt; +import java.awt.image.ImageObserver; + +public class ImageBufferDownload implements IImageBuffer +{ + private int[] imageData; + private int imageWidth; + private int imageHeight; + private static final String __OBFID = "CL_00000956"; + + public BufferedImage parseUserSkin(BufferedImage image) + { + if (image == null) + { + return null; + } + else + { + this.imageWidth = 64; + this.imageHeight = 64; + int i = image.getWidth(); + int j = image.getHeight(); + int k; + + for (k = 1; this.imageWidth < i || this.imageHeight < j; k *= 2) + { + this.imageWidth *= 2; + this.imageHeight *= 2; + } + + BufferedImage bufferedimage = new BufferedImage(this.imageWidth, this.imageHeight, 2); + Graphics graphics = bufferedimage.getGraphics(); + graphics.drawImage(image, 0, 0, (ImageObserver)null); + + if (image.getHeight() == 32 * k) + { + graphics.drawImage(bufferedimage, 24 * k, 48 * k, 20 * k, 52 * k, 4 * k, 16 * k, 8 * k, 20 * k, (ImageObserver)null); + graphics.drawImage(bufferedimage, 28 * k, 48 * k, 24 * k, 52 * k, 8 * k, 16 * k, 12 * k, 20 * k, (ImageObserver)null); + graphics.drawImage(bufferedimage, 20 * k, 52 * k, 16 * k, 64 * k, 8 * k, 20 * k, 12 * k, 32 * k, (ImageObserver)null); + graphics.drawImage(bufferedimage, 24 * k, 52 * k, 20 * k, 64 * k, 4 * k, 20 * k, 8 * k, 32 * k, (ImageObserver)null); + graphics.drawImage(bufferedimage, 28 * k, 52 * k, 24 * k, 64 * k, 0 * k, 20 * k, 4 * k, 32 * k, (ImageObserver)null); + graphics.drawImage(bufferedimage, 32 * k, 52 * k, 28 * k, 64 * k, 12 * k, 20 * k, 16 * k, 32 * k, (ImageObserver)null); + graphics.drawImage(bufferedimage, 40 * k, 48 * k, 36 * k, 52 * k, 44 * k, 16 * k, 48 * k, 20 * k, (ImageObserver)null); + graphics.drawImage(bufferedimage, 44 * k, 48 * k, 40 * k, 52 * k, 48 * k, 16 * k, 52 * k, 20 * k, (ImageObserver)null); + graphics.drawImage(bufferedimage, 36 * k, 52 * k, 32 * k, 64 * k, 48 * k, 20 * k, 52 * k, 32 * k, (ImageObserver)null); + graphics.drawImage(bufferedimage, 40 * k, 52 * k, 36 * k, 64 * k, 44 * k, 20 * k, 48 * k, 32 * k, (ImageObserver)null); + graphics.drawImage(bufferedimage, 44 * k, 52 * k, 40 * k, 64 * k, 40 * k, 20 * k, 44 * k, 32 * k, (ImageObserver)null); + graphics.drawImage(bufferedimage, 48 * k, 52 * k, 44 * k, 64 * k, 52 * k, 20 * k, 56 * k, 32 * k, (ImageObserver)null); + } + + graphics.dispose(); + this.imageData = ((DataBufferInt)bufferedimage.getRaster().getDataBuffer()).getData(); + this.setAreaOpaque(0, 0, 32 * k, 16 * k); + this.setAreaTransparent(32 * k, 0, 64 * k, 32 * k); + this.setAreaOpaque(0, 16 * k, 64 * k, 32 * k); + this.setAreaTransparent(0, 32 * k, 16 * k, 48 * k); + this.setAreaTransparent(16 * k, 32 * k, 40 * k, 48 * k); + this.setAreaTransparent(40 * k, 32 * k, 56 * k, 48 * k); + this.setAreaTransparent(0, 48 * k, 16 * k, 64 * k); + this.setAreaOpaque(16 * k, 48 * k, 48 * k, 64 * k); + this.setAreaTransparent(48 * k, 48 * k, 64 * k, 64 * k); + return bufferedimage; + } + } + + public void skinAvailable() + { + } + + /** + * Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer + * layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin + * maker is just using an image editor without an alpha channel) + */ + private void setAreaTransparent(int p_78434_1_, int p_78434_2_, int p_78434_3_, int p_78434_4_) + { + if (!this.hasTransparency(p_78434_1_, p_78434_2_, p_78434_3_, p_78434_4_)) + { + for (int i = p_78434_1_; i < p_78434_3_; ++i) + { + for (int j = p_78434_2_; j < p_78434_4_; ++j) + { + this.imageData[i + j * this.imageWidth] &= 16777215; + } + } + } + } + + /** + * Makes the given area of the image opaque + */ + private void setAreaOpaque(int p_78433_1_, int p_78433_2_, int p_78433_3_, int p_78433_4_) + { + for (int i = p_78433_1_; i < p_78433_3_; ++i) + { + for (int j = p_78433_2_; j < p_78433_4_; ++j) + { + this.imageData[i + j * this.imageWidth] |= -16777216; + } + } + } + + /** + * Returns true if the given area of the image contains transparent pixels + */ + private boolean hasTransparency(int p_78435_1_, int p_78435_2_, int p_78435_3_, int p_78435_4_) + { + for (int i = p_78435_1_; i < p_78435_3_; ++i) + { + for (int j = p_78435_2_; j < p_78435_4_; ++j) + { + int k = this.imageData[i + j * this.imageWidth]; + + if ((k >> 24 & 255) < 128) + { + return true; + } + } + } + + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java b/src/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java new file mode 100644 index 0000000..dc44a0e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java @@ -0,0 +1,116 @@ +package net.minecraft.client.renderer; + +import java.util.Collection; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.inventory.Container; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; + +public abstract class InventoryEffectRenderer extends GuiContainer +{ + /** True if there is some potion effect to display */ + private boolean hasActivePotionEffects; + + public InventoryEffectRenderer(Container inventorySlotsIn) + { + super(inventorySlotsIn); + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + super.initGui(); + this.updateActivePotionEffects(); + } + + protected void updateActivePotionEffects() + { + if (!this.mc.thePlayer.getActivePotionEffects().isEmpty()) + { + // Uncomment the line below to allow the inventory to shift. + this.guiLeft = 160 + (this.width - this.xSize - 200) / 2; + + //this.guiLeft = (this.width - this.xSize) / 2; + this.hasActivePotionEffects = true; + } + else + { + this.guiLeft = (this.width - this.xSize) / 2; + this.hasActivePotionEffects = false; + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + super.drawScreen(mouseX, mouseY, partialTicks); + + if (this.hasActivePotionEffects) + { + this.drawActivePotionEffects(); + } + } + + /** + * Display the potion effects list + */ + private void drawActivePotionEffects() + { + int i = this.guiLeft - 124; + int j = this.guiTop; + int k = 166; + Collection collection = this.mc.thePlayer.getActivePotionEffects(); + + if (!collection.isEmpty()) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableLighting(); + int l = 33; + + if (collection.size() > 5) + { + l = 132 / (collection.size() - 1); + } + + for (PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects()) + { + Potion potion = Potion.potionTypes[potioneffect.getPotionID()]; + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(inventoryBackground); + this.drawTexturedModalRect(i, j, 0, 166, 140, 32); + + if (potion.hasStatusIcon()) + { + int i1 = potion.getStatusIconIndex(); + this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18); + } + + String s1 = I18n.format(potion.getName(), new Object[0]); + + if (potioneffect.getAmplifier() == 1) + { + s1 = s1 + " " + I18n.format("enchantment.level.2", new Object[0]); + } + else if (potioneffect.getAmplifier() == 2) + { + s1 = s1 + " " + I18n.format("enchantment.level.3", new Object[0]); + } + else if (potioneffect.getAmplifier() == 3) + { + s1 = s1 + " " + I18n.format("enchantment.level.4", new Object[0]); + } + + this.fontRendererObj.drawStringWithShadow(s1, (float)(i + 10 + 18), (float)(j + 6), 16777215); + String s = Potion.getDurationString(potioneffect); + this.fontRendererObj.drawStringWithShadow(s, (float)(i + 10 + 18), (float)(j + 6 + 10), 8355711); + j += l; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/ItemMeshDefinition.java b/src/minecraft/net/minecraft/client/renderer/ItemMeshDefinition.java new file mode 100644 index 0000000..1a31b0a --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/ItemMeshDefinition.java @@ -0,0 +1,9 @@ +package net.minecraft.client.renderer; + +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.item.ItemStack; + +public interface ItemMeshDefinition +{ + ModelResourceLocation getModelLocation(ItemStack stack); +} diff --git a/src/minecraft/net/minecraft/client/renderer/ItemModelMesher.java b/src/minecraft/net/minecraft/client/renderer/ItemModelMesher.java new file mode 100644 index 0000000..02fa57d --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/ItemModelMesher.java @@ -0,0 +1,98 @@ +package net.minecraft.client.renderer; + +import com.google.common.collect.Maps; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class ItemModelMesher +{ + private final Map simpleShapes = Maps.newHashMap(); + private final Map simpleShapesCache = Maps.newHashMap(); + private final Map shapers = Maps.newHashMap(); + private final ModelManager modelManager; + + public ItemModelMesher(ModelManager modelManager) + { + this.modelManager = modelManager; + } + + public TextureAtlasSprite getParticleIcon(Item item) + { + return this.getParticleIcon(item, 0); + } + + public TextureAtlasSprite getParticleIcon(Item item, int meta) + { + return this.getItemModel(new ItemStack(item, 1, meta)).getParticleTexture(); + } + + public IBakedModel getItemModel(ItemStack stack) + { + Item item = stack.getItem(); + IBakedModel ibakedmodel = this.getItemModel(item, this.getMetadata(stack)); + + if (ibakedmodel == null) + { + ItemMeshDefinition itemmeshdefinition = (ItemMeshDefinition)this.shapers.get(item); + + if (itemmeshdefinition != null) + { + ibakedmodel = this.modelManager.getModel(itemmeshdefinition.getModelLocation(stack)); + } + } + + if (ibakedmodel == null) + { + ibakedmodel = this.modelManager.getMissingModel(); + } + + return ibakedmodel; + } + + protected int getMetadata(ItemStack stack) + { + return stack.isItemStackDamageable() ? 0 : stack.getMetadata(); + } + + protected IBakedModel getItemModel(Item item, int meta) + { + return (IBakedModel)this.simpleShapesCache.get(Integer.valueOf(this.getIndex(item, meta))); + } + + private int getIndex(Item item, int meta) + { + return Item.getIdFromItem(item) << 16 | meta; + } + + public void register(Item item, int meta, ModelResourceLocation location) + { + this.simpleShapes.put(Integer.valueOf(this.getIndex(item, meta)), location); + this.simpleShapesCache.put(Integer.valueOf(this.getIndex(item, meta)), this.modelManager.getModel(location)); + } + + public void register(Item item, ItemMeshDefinition definition) + { + this.shapers.put(item, definition); + } + + public ModelManager getModelManager() + { + return this.modelManager; + } + + public void rebuildCache() + { + this.simpleShapesCache.clear(); + + for (Entry entry : this.simpleShapes.entrySet()) + { + this.simpleShapesCache.put(entry.getKey(), this.modelManager.getModel((ModelResourceLocation)entry.getValue())); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/ItemRenderer.java b/src/minecraft/net/minecraft/client/renderer/ItemRenderer.java new file mode 100644 index 0000000..733b7c0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/ItemRenderer.java @@ -0,0 +1,780 @@ +package net.minecraft.client.renderer; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Items; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemMap; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.storage.MapData; +import optifine.Config; +import optifine.DynamicLights; +import optifine.Reflector; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import shadersmod.client.Shaders; + +public class ItemRenderer +{ + private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png"); + private static final ResourceLocation RES_UNDERWATER_OVERLAY = new ResourceLocation("textures/misc/underwater.png"); + + /** A reference to the Minecraft object. */ + private final Minecraft mc; + private ItemStack itemToRender; + + /** + * How far the current item has been equipped (0 disequipped and 1 fully up) + */ + private float equippedProgress; + private float prevEquippedProgress; + private final RenderManager renderManager; + private final RenderItem itemRenderer; + + /** The index of the currently held item (0-8, or -1 if not yet updated) */ + private int equippedItemSlot = -1; + private static final String __OBFID = "CL_00000953"; + + public ItemRenderer(Minecraft mcIn) + { + this.mc = mcIn; + this.renderManager = mcIn.getRenderManager(); + this.itemRenderer = mcIn.getRenderItem(); + } + + public void renderItem(EntityLivingBase entityIn, ItemStack heldStack, ItemCameraTransforms.TransformType transform) + { + if (heldStack != null) + { + Item item = heldStack.getItem(); + Block block = Block.getBlockFromItem(item); + GlStateManager.pushMatrix(); + + if (this.itemRenderer.shouldRenderItemIn3D(heldStack)) + { + GlStateManager.scale(2.0F, 2.0F, 2.0F); + + if (this.isBlockTranslucent(block) && (!Config.isShaders() || !Shaders.renderItemKeepDepthMask)) + { + GlStateManager.depthMask(false); + } + } + + this.itemRenderer.renderItemModelForEntity(heldStack, entityIn, transform); + + if (this.isBlockTranslucent(block)) + { + GlStateManager.depthMask(true); + } + + GlStateManager.popMatrix(); + } + } + + /** + * Returns true if given block is translucent + */ + private boolean isBlockTranslucent(Block blockIn) + { + return blockIn != null && blockIn.getBlockLayer() == EnumWorldBlockLayer.TRANSLUCENT; + } + + private void func_178101_a(float angle, float p_178101_2_) + { + GlStateManager.pushMatrix(); + GlStateManager.rotate(angle, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(p_178101_2_, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GlStateManager.popMatrix(); + } + + private void func_178109_a(AbstractClientPlayer clientPlayer) + { + int i = this.mc.theWorld.getCombinedLight(new BlockPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ), 0); + + if (Config.isDynamicLights()) + { + i = DynamicLights.getCombinedLight(this.mc.getRenderViewEntity(), i); + } + + float f = (float)(i & 65535); + float f1 = (float)(i >> 16); + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f, f1); + } + + private void func_178110_a(EntityPlayerSP entityplayerspIn, float partialTicks) + { + float f = entityplayerspIn.prevRenderArmPitch + (entityplayerspIn.renderArmPitch - entityplayerspIn.prevRenderArmPitch) * partialTicks; + float f1 = entityplayerspIn.prevRenderArmYaw + (entityplayerspIn.renderArmYaw - entityplayerspIn.prevRenderArmYaw) * partialTicks; + GlStateManager.rotate((entityplayerspIn.rotationPitch - f) * 0.1F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate((entityplayerspIn.rotationYaw - f1) * 0.1F, 0.0F, 1.0F, 0.0F); + } + + private float func_178100_c(float p_178100_1_) + { + float f = 1.0F - p_178100_1_ / 45.0F + 0.1F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + f = -MathHelper.cos(f * (float)Math.PI) * 0.5F + 0.5F; + return f; + } + + private void renderRightArm(RenderPlayer renderPlayerIn) + { + GlStateManager.pushMatrix(); + GlStateManager.rotate(54.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(64.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-62.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.translate(0.25F, -0.85F, 0.75F); + renderPlayerIn.renderRightArm(this.mc.thePlayer); + GlStateManager.popMatrix(); + } + + private void renderLeftArm(RenderPlayer renderPlayerIn) + { + GlStateManager.pushMatrix(); + GlStateManager.rotate(92.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(41.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.translate(-0.3F, -1.1F, 0.45F); + renderPlayerIn.renderLeftArm(this.mc.thePlayer); + GlStateManager.popMatrix(); + } + + private void renderPlayerArms(AbstractClientPlayer clientPlayer) + { + this.mc.getTextureManager().bindTexture(clientPlayer.getLocationSkin()); + Render render = this.renderManager.getEntityRenderObject(this.mc.thePlayer); + RenderPlayer renderplayer = (RenderPlayer)render; + + if (!clientPlayer.isInvisible()) + { + GlStateManager.disableCull(); + this.renderRightArm(renderplayer); + this.renderLeftArm(renderplayer); + GlStateManager.enableCull(); + } + } + + private void renderItemMap(AbstractClientPlayer clientPlayer, float p_178097_2_, float p_178097_3_, float p_178097_4_) + { + float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(p_178097_4_) * (float)Math.PI); + float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(p_178097_4_) * (float)Math.PI * 2.0F); + float f2 = -0.2F * MathHelper.sin(p_178097_4_ * (float)Math.PI); + GlStateManager.translate(f, f1, f2); + float f3 = this.func_178100_c(p_178097_2_); + GlStateManager.translate(0.0F, 0.04F, -0.72F); + GlStateManager.translate(0.0F, p_178097_3_ * -1.2F, 0.0F); + GlStateManager.translate(0.0F, f3 * -0.5F, 0.0F); + GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f3 * -85.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(0.0F, 1.0F, 0.0F, 0.0F); + this.renderPlayerArms(clientPlayer); + float f4 = MathHelper.sin(p_178097_4_ * p_178097_4_ * (float)Math.PI); + float f5 = MathHelper.sin(MathHelper.sqrt_float(p_178097_4_) * (float)Math.PI); + GlStateManager.rotate(f4 * -20.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f5 * -20.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(f5 * -80.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.scale(0.38F, 0.38F, 0.38F); + GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(0.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(-1.0F, -1.0F, 0.0F); + GlStateManager.scale(0.015625F, 0.015625F, 0.015625F); + this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GL11.glNormal3f(0.0F, 0.0F, -1.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(-7.0D, 135.0D, 0.0D).tex(0.0D, 1.0D).endVertex(); + worldrenderer.pos(135.0D, 135.0D, 0.0D).tex(1.0D, 1.0D).endVertex(); + worldrenderer.pos(135.0D, -7.0D, 0.0D).tex(1.0D, 0.0D).endVertex(); + worldrenderer.pos(-7.0D, -7.0D, 0.0D).tex(0.0D, 0.0D).endVertex(); + tessellator.draw(); + MapData mapdata = Items.filled_map.getMapData(this.itemToRender, this.mc.theWorld); + + if (mapdata != null) + { + this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, false); + } + } + + private void func_178095_a(AbstractClientPlayer clientPlayer, float p_178095_2_, float p_178095_3_) + { + float f = -0.3F * MathHelper.sin(MathHelper.sqrt_float(p_178095_3_) * (float)Math.PI); + float f1 = 0.4F * MathHelper.sin(MathHelper.sqrt_float(p_178095_3_) * (float)Math.PI * 2.0F); + float f2 = -0.4F * MathHelper.sin(p_178095_3_ * (float)Math.PI); + GlStateManager.translate(f, f1, f2); + GlStateManager.translate(0.64000005F, -0.6F, -0.71999997F); + GlStateManager.translate(0.0F, p_178095_2_ * -0.6F, 0.0F); + GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); + float f3 = MathHelper.sin(p_178095_3_ * p_178095_3_ * (float)Math.PI); + float f4 = MathHelper.sin(MathHelper.sqrt_float(p_178095_3_) * (float)Math.PI); + GlStateManager.rotate(f4 * 70.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f3 * -20.0F, 0.0F, 0.0F, 1.0F); + this.mc.getTextureManager().bindTexture(clientPlayer.getLocationSkin()); + GlStateManager.translate(-1.0F, 3.6F, 3.5F); + GlStateManager.rotate(120.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(200.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.scale(1.0F, 1.0F, 1.0F); + GlStateManager.translate(5.6F, 0.0F, 0.0F); + Render render = this.renderManager.getEntityRenderObject(this.mc.thePlayer); + GlStateManager.disableCull(); + RenderPlayer renderplayer = (RenderPlayer)render; + renderplayer.renderRightArm(this.mc.thePlayer); + GlStateManager.enableCull(); + } + private void performDrinking(AbstractClientPlayer clientPlayer, float p_178104_2_) { + float f = clientPlayer.getItemInUseCount() - p_178104_2_ + 1.0F; + float f1 = f / this.itemToRender.getMaxItemUseDuration(); + float f2 = MathHelper.abs(MathHelper.cos(f / 4.0F * 3.1415927F) * 0.1F); + if (f1 >= 0.8F) + f2 = 0.0F; + GlStateManager.translate(0.0F, f2, 0.0F); + float f3 = 1.0F - (float)Math.pow(f1, 27.0D); + GlStateManager.translate(f3 * 0.6F, f3 * -0.5F, f3 * 0.0F); + GlStateManager.rotate(f3 * 90.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f3 * 10.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 * 30.0F, 0.0F, 0.0F, 1.0F); + } + + private void doBowTransformations(float p_178098_1_, AbstractClientPlayer clientPlayer) { + GlStateManager.rotate(-18.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-12.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-8.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(-0.9F, 0.2F, 0.0F); + float f = this.itemToRender.getMaxItemUseDuration() - clientPlayer.getItemInUseCount() - p_178098_1_ + 1.0F; + float f1 = f / 20.0F; + f1 = (f1 * f1 + f1 * 2.0F) / 3.0F; + if (f1 > 1.0F) + f1 = 1.0F; + if (f1 > 0.1F) { + float f2 = MathHelper.sin((f - 0.1F) * 1.3F); + float f3 = f1 - 0.1F; + float f4 = f2 * f3; + GlStateManager.translate(f4 * 0.0F, f4 * 0.01F, f4 * 0.0F); + } + GlStateManager.translate(f1 * 0.0F, f1 * 0.0F, f1 * 0.1F); + GlStateManager.scale(1.0F, 1.0F, 1.0F + f1 * 0.2F); + } + + private void doBlockTransformations() { + GlStateManager.translate(-0.5F, 0.2F, 0.0F); + GlStateManager.rotate(30.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-80.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(60.0F, 0.0F, 1.0F, 0.0F); + } + + private void func_178105_d(float p_178105_1_) + { + float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(p_178105_1_) * (float)Math.PI); + float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(p_178105_1_) * (float)Math.PI * 2.0F); + float f2 = -0.2F * MathHelper.sin(p_178105_1_ * (float)Math.PI); + GlStateManager.translate(f, f1, f2); + } + + + private void func_178104_a(AbstractClientPlayer clientPlayer, float p_178104_2_) + { + float f = (float)clientPlayer.getItemInUseCount() - p_178104_2_ + 1.0F; + float f1 = f / (float)this.itemToRender.getMaxItemUseDuration(); + float f2 = MathHelper.abs(MathHelper.cos(f / 4.0F * (float)Math.PI) * 0.1F); + + if (f1 >= 0.8F) + { + f2 = 0.0F; + } + + GlStateManager.translate(0.0F, f2, 0.0F); + float f3 = 1.0F - (float)Math.pow((double)f1, 27.0D); + GlStateManager.translate(f3 * 0.6F, f3 * -0.5F, f3 * 0.0F); + GlStateManager.rotate(f3 * 90.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f3 * 10.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 * 30.0F, 0.0F, 0.0F, 1.0F); + } + + /** + * Performs transformations prior to the rendering of a held item in first person. + */ + private void transformFirstPersonItem(float equipProgress, float swingProgress) + { + if(Booleans.SmallSword) { + GlStateManager.translate(0.6F, -0.4F, -0.65F); + GlStateManager.translate(0.0F, equipProgress * -0.6F, 0.0F); + GlStateManager.rotate(45.0F, -0.1F, 1.0F, 0.1F); + float f = MathHelper.sin(swingProgress * swingProgress * (float)Math.PI); + float f1 = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float)Math.PI); + GlStateManager.rotate(f * -20.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f1 * -20.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(f1 * -80.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(0, -135, 25, 0); + GlStateManager.scale(0.1F, 0.1F, 0.1F); + } else { + GlStateManager.translate(0.56F, -0.52F, -0.71999997F); + GlStateManager.translate(0.0F, equipProgress * -0.6F, 0.0F); + GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); + float f = MathHelper.sin(swingProgress * swingProgress * (float)Math.PI); + float f1 = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float)Math.PI); + GlStateManager.rotate(f * -20.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f1 * -20.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(f1 * -80.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.scale(0.4F, 0.4F, 0.4F); + } + } + + private void func_178098_a(float p_178098_1_, AbstractClientPlayer clientPlayer) + { + GlStateManager.rotate(-18.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-12.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-8.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(-0.9F, 0.2F, 0.0F); + float f = (float)this.itemToRender.getMaxItemUseDuration() - ((float)clientPlayer.getItemInUseCount() - p_178098_1_ + 1.0F); + float f1 = f / 20.0F; + f1 = (f1 * f1 + f1 * 2.0F) / 3.0F; + + if (f1 > 1.0F) + { + f1 = 1.0F; + } + + if (f1 > 0.1F) + { + float f2 = MathHelper.sin((f - 0.1F) * 1.3F); + float f3 = f1 - 0.1F; + float f4 = f2 * f3; + GlStateManager.translate(f4 * 0.0F, f4 * 0.01F, f4 * 0.0F); + } + + GlStateManager.translate(f1 * 0.0F, f1 * 0.0F, f1 * 0.1F); + GlStateManager.scale(1.0F, 1.0F, 1.0F + f1 * 0.2F); + } + + private void func_178103_d() + { + int random1 = 0; + int random2 = 0; + int random3 = 0; + int random4 = 0; + float random5 = 0; + int random6 = 0; + int random7 = 0; + float random8 = 0; + int random10 = 0; + float angle = (int) ((System.currentTimeMillis() / 1.5) % 360); + angle = (angle > 180 ? 360 - angle : angle) * 2; + angle /= 180f; + + float angle2 = (int) ((System.currentTimeMillis() / 3.5) % 120); + angle2 = (angle2 > 30 ? 120 - angle2 : angle2) * 2; + angle2 /= 1f; + + + float angle3 = (int) ((System.currentTimeMillis() / 3.5) % 110); + angle3 = (angle3 > 30 ? 110 - angle3 : angle3) * 2; + angle3 /= 1f; + /*GlStateManager.translate(-0.5F, 0.2F, 0.0F); + GlStateManager.rotate(30.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-80.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(60.0F, 0.0F, 1.0F, 0.0F);*/ + if(Booleans.SwordSpin) { + random4 = (int) 0.2f; + random1 = (int) (System.currentTimeMillis() / 2 % 360); + random2 = 1; + random5 = 1; + random4 = -59; + random6 = -1; + random7 = 0; + random10 = 3; + } else { + + + random8 = -0.2f; + random5 = 0.0f; + random4 = (int) 30.0f; + random6 = (int) 0.0F; + random7 = (int) 1.0F; + random10 = (int) 0.0f; + random1 = (int) 80.0f; + random2 = (int) 1.0f; + random3 = (int) 0.0f; + } + + GlStateManager.translate(random8, 0.2f, -random5); + GlStateManager.rotate(random4, random6, random7, random10); + GlStateManager.rotate(-random1, random2, random3, 0.0F); + GlStateManager.rotate(60.0F, 0.0F, 1.0F, 0.0F); + } + + /** + * Renders the active item in the player's hand when in first person mode. Args: partialTickTime + */ + public void renderItemInFirstPerson(float partialTicks) + { + float f = 1.0F - (this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTicks); + EntityPlayerSP entityplayersp = this.mc.thePlayer; + float f1 = entityplayersp.getSwingProgress(partialTicks); + float f2 = entityplayersp.prevRotationPitch + (entityplayersp.rotationPitch - entityplayersp.prevRotationPitch) * partialTicks; + float f3 = entityplayersp.prevRotationYaw + (entityplayersp.rotationYaw - entityplayersp.prevRotationYaw) * partialTicks; + this.func_178101_a(f2, f3); + this.func_178109_a(entityplayersp); + this.func_178110_a(entityplayersp, partialTicks); + GlStateManager.enableRescaleNormal(); + GlStateManager.pushMatrix(); + + if (this.itemToRender != null) + { + if (this.itemToRender.getItem() instanceof ItemMap) + { + this.renderItemMap(entityplayersp, f2, f, f1); + } + else if (entityplayersp.getItemInUseCount() > 0) + { + EnumAction enumaction = this.itemToRender.getItemUseAction(); + + switch (ItemRenderer.ItemRenderer$1.field_178094_a[enumaction.ordinal()]) + { + case 1: + this.transformFirstPersonItem(0.2f, f1); + break; + + case 2: + case 3: + this.func_178104_a(entityplayersp, partialTicks); + this.transformFirstPersonItem(0.2f, f1); + break; + + case 4: + this.transformFirstPersonItem(0.2f, f1/*f, 0.0F*/); + this.func_178103_d(); + GlStateManager.translate(-0.5f, 0.2f, 0.0f); + break; + + case 5: + this.transformFirstPersonItem(0.2f, f1); + this.func_178098_a(partialTicks, entityplayersp); + } + } + else + { + this.func_178105_d(f1); + this.transformFirstPersonItem(f, f1); + } + + this.renderItem(entityplayersp, this.itemToRender, ItemCameraTransforms.TransformType.FIRST_PERSON); + } + else if (!entityplayersp.isInvisible()) + { + this.func_178095_a(entityplayersp, f, f1); + } + + GlStateManager.popMatrix(); + GlStateManager.disableRescaleNormal(); + RenderHelper.disableStandardItemLighting(); + } + + + /** + * Renders all the overlays that are in first person mode. Args: partialTickTime + */ + public void renderOverlays(float partialTicks) + { + GlStateManager.disableAlpha(); + + if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) + { + IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer)); + BlockPos blockpos = new BlockPos(this.mc.thePlayer); + EntityPlayerSP entityplayersp = this.mc.thePlayer; + + for (int i = 0; i < 8; ++i) + { + double d0 = entityplayersp.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayersp.width * 0.8F); + double d1 = entityplayersp.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F); + double d2 = entityplayersp.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayersp.width * 0.8F); + BlockPos blockpos1 = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2); + IBlockState iblockstate1 = this.mc.theWorld.getBlockState(blockpos1); + + if (iblockstate1.getBlock().isVisuallyOpaque()) + { + iblockstate = iblockstate1; + blockpos = blockpos1; + } + } + + if (iblockstate.getBlock().getRenderType() != -1) + { + Object object = Reflector.getFieldValue(Reflector.RenderBlockOverlayEvent_OverlayType_BLOCK); + + if (!Reflector.callBoolean(Reflector.ForgeEventFactory_renderBlockOverlay, new Object[] {this.mc.thePlayer, Float.valueOf(partialTicks), object, iblockstate, blockpos})) + { + this.func_178108_a(partialTicks, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate)); + } + } + } + + if (!this.mc.thePlayer.isSpectator()) + { + if (this.mc.thePlayer.isInsideOfMaterial(Material.water) && !Reflector.callBoolean(Reflector.ForgeEventFactory_renderWaterOverlay, new Object[] {this.mc.thePlayer, Float.valueOf(partialTicks)})) + { + this.renderWaterOverlayTexture(partialTicks); + } + + if (this.mc.thePlayer.isBurning() && !Reflector.callBoolean(Reflector.ForgeEventFactory_renderFireOverlay, new Object[] {this.mc.thePlayer, Float.valueOf(partialTicks)})) + { + this.renderFireInFirstPerson(partialTicks); + } + } + + GlStateManager.enableAlpha(); + } + + private void func_178108_a(float p_178108_1_, TextureAtlasSprite p_178108_2_) + { + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + float f = 0.1F; + GlStateManager.color(0.1F, 0.1F, 0.1F, 0.5F); + GlStateManager.pushMatrix(); + float f1 = -1.0F; + float f2 = 1.0F; + float f3 = -1.0F; + float f4 = 1.0F; + float f5 = -0.5F; + float f6 = p_178108_2_.getMinU(); + float f7 = p_178108_2_.getMaxU(); + float f8 = p_178108_2_.getMinV(); + float f9 = p_178108_2_.getMaxV(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(-1.0D, -1.0D, -0.5D).tex((double)f7, (double)f9).endVertex(); + worldrenderer.pos(1.0D, -1.0D, -0.5D).tex((double)f6, (double)f9).endVertex(); + worldrenderer.pos(1.0D, 1.0D, -0.5D).tex((double)f6, (double)f8).endVertex(); + worldrenderer.pos(-1.0D, 1.0D, -0.5D).tex((double)f7, (double)f8).endVertex(); + tessellator.draw(); + GlStateManager.popMatrix(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Renders a texture that warps around based on the direction the player is looking. Texture needs to be bound + * before being called. Used for the water overlay. Args: parialTickTime + */ + private void renderWaterOverlayTexture(float p_78448_1_) + { + if (!Config.isShaders() || Shaders.isUnderwaterOverlay()) + { + this.mc.getTextureManager().bindTexture(RES_UNDERWATER_OVERLAY); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + float f = this.mc.thePlayer.getBrightness(p_78448_1_); + GlStateManager.color(f, f, f, 0.5F); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.pushMatrix(); + float f1 = 4.0F; + float f2 = -1.0F; + float f3 = 1.0F; + float f4 = -1.0F; + float f5 = 1.0F; + float f6 = -0.5F; + float f7 = -this.mc.thePlayer.rotationYaw / 64.0F; + float f8 = this.mc.thePlayer.rotationPitch / 64.0F; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(-1.0D, -1.0D, -0.5D).tex((double)(4.0F + f7), (double)(4.0F + f8)).endVertex(); + worldrenderer.pos(1.0D, -1.0D, -0.5D).tex((double)(0.0F + f7), (double)(4.0F + f8)).endVertex(); + worldrenderer.pos(1.0D, 1.0D, -0.5D).tex((double)(0.0F + f7), (double)(0.0F + f8)).endVertex(); + worldrenderer.pos(-1.0D, 1.0D, -0.5D).tex((double)(4.0F + f7), (double)(0.0F + f8)).endVertex(); + tessellator.draw(); + GlStateManager.popMatrix(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + } + } + + /** + * Renders the fire on the screen for first person mode. Arg: partialTickTime + */ + private void renderFireInFirstPerson(float p_78442_1_) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 0.9F); + GlStateManager.depthFunc(519); + GlStateManager.depthMask(false); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + float f = 1.0F; + + for (int i = 0; i < 2; ++i) + { + GlStateManager.pushMatrix(); + TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite("minecraft:blocks/fire_layer_1"); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + float f1 = textureatlassprite.getMinU(); + float f2 = textureatlassprite.getMaxU(); + float f3 = textureatlassprite.getMinV(); + float f4 = textureatlassprite.getMaxV(); + float f5 = (0.0F - f) / 2.0F; + float f6 = f5 + f; + float f7 = 0.0F - f / 2.0F; + float f8 = f7 + f; + float f9 = -0.5F; + GlStateManager.translate((float)(-(i * 2 - 1)) * 0.24F, -0.3F, 0.0F); + GlStateManager.rotate((float)(i * 2 - 1) * 10.0F, 0.0F, 1.0F, 0.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((double)f5, (double)f7, (double)f9).tex((double)f2, (double)f4).endVertex(); + worldrenderer.pos((double)f6, (double)f7, (double)f9).tex((double)f1, (double)f4).endVertex(); + worldrenderer.pos((double)f6, (double)f8, (double)f9).tex((double)f1, (double)f3).endVertex(); + worldrenderer.pos((double)f5, (double)f8, (double)f9).tex((double)f2, (double)f3).endVertex(); + tessellator.draw(); + GlStateManager.popMatrix(); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + GlStateManager.depthMask(true); + GlStateManager.depthFunc(515); + } + + public void updateEquippedItem() + { + this.prevEquippedProgress = this.equippedProgress; + EntityPlayerSP entityplayersp = this.mc.thePlayer; + ItemStack itemstack = entityplayersp.inventory.getCurrentItem(); + boolean flag = false; + + if (this.itemToRender != null && itemstack != null) + { + if (!this.itemToRender.getIsItemStackEqual(itemstack)) + { + if (Reflector.ForgeItem_shouldCauseReequipAnimation.exists()) + { + boolean flag1 = Reflector.callBoolean(this.itemToRender.getItem(), Reflector.ForgeItem_shouldCauseReequipAnimation, new Object[] {this.itemToRender, itemstack, Boolean.valueOf(this.equippedItemSlot != entityplayersp.inventory.currentItem)}); + + if (!flag1) + { + this.itemToRender = itemstack; + this.equippedItemSlot = entityplayersp.inventory.currentItem; + return; + } + } + + flag = true; + } + } + else if (this.itemToRender == null && itemstack == null) + { + flag = false; + } + else + { + flag = true; + } + + float f2 = 0.4F; + float f = flag ? 0.0F : 1.0F; + float f1 = MathHelper.clamp_float(f - this.equippedProgress, -f2, f2); + this.equippedProgress += f1; + + if (this.equippedProgress < 0.1F) + { + if (Config.isShaders()) + { + Shaders.setItemToRenderMain(itemstack); + } + + this.itemToRender = itemstack; + this.equippedItemSlot = entityplayersp.inventory.currentItem; + } + } + + /** + * Resets equippedProgress + */ + public void resetEquippedProgress() + { + this.equippedProgress = 0.0F; + } + + /** + * Resets equippedProgress + */ + public void resetEquippedProgress2() + { + this.equippedProgress = 0.0F; + } + + static final class ItemRenderer$1 + { + static final int[] field_178094_a = new int[EnumAction.values().length]; + private static final String __OBFID = "CL_00002537"; + + static + { + try + { + field_178094_a[EnumAction.NONE.ordinal()] = 1; + } + catch (NoSuchFieldError var5) + { + ; + } + + try + { + field_178094_a[EnumAction.EAT.ordinal()] = 2; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_178094_a[EnumAction.DRINK.ordinal()] = 3; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_178094_a[EnumAction.BLOCK.ordinal()] = 4; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_178094_a[EnumAction.BOW.ordinal()] = 5; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/OpenGlHelper.java b/src/minecraft/net/minecraft/client/renderer/OpenGlHelper.java new file mode 100644 index 0000000..43c92a8 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/OpenGlHelper.java @@ -0,0 +1,936 @@ +package net.minecraft.client.renderer; + +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.GameSettings; +import optifine.Config; + +import org.lwjgl.opengl.ARBFramebufferObject; +import org.lwjgl.opengl.ARBMultitexture; +import org.lwjgl.opengl.ARBShaderObjects; +import org.lwjgl.opengl.ARBVertexBufferObject; +import org.lwjgl.opengl.ARBVertexShader; +import org.lwjgl.opengl.ContextCapabilities; +import org.lwjgl.opengl.EXTBlendFuncSeparate; +import org.lwjgl.opengl.EXTFramebufferObject; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL13; +import org.lwjgl.opengl.GL14; +import org.lwjgl.opengl.GL15; +import org.lwjgl.opengl.GL20; +import org.lwjgl.opengl.GL30; +import org.lwjgl.opengl.GLContext; +import oshi.SystemInfo; +import oshi.hardware.Processor; + +public class OpenGlHelper +{ + public static boolean nvidia; + public static boolean field_181063_b; + public static int GL_FRAMEBUFFER; + public static int GL_RENDERBUFFER; + public static int GL_COLOR_ATTACHMENT0; + public static int GL_DEPTH_ATTACHMENT; + public static int GL_FRAMEBUFFER_COMPLETE; + public static int GL_FB_INCOMPLETE_ATTACHMENT; + public static int GL_FB_INCOMPLETE_MISS_ATTACH; + public static int GL_FB_INCOMPLETE_DRAW_BUFFER; + public static int GL_FB_INCOMPLETE_READ_BUFFER; + private static int framebufferType; + public static boolean framebufferSupported; + private static boolean shadersAvailable; + private static boolean arbShaders; + public static int GL_LINK_STATUS; + public static int GL_COMPILE_STATUS; + public static int GL_VERTEX_SHADER; + public static int GL_FRAGMENT_SHADER; + private static boolean arbMultitexture; + + /** + * An OpenGL constant corresponding to GL_TEXTURE0, used when setting data pertaining to auxiliary OpenGL texture + * units. + */ + public static int defaultTexUnit; + + /** + * An OpenGL constant corresponding to GL_TEXTURE1, used when setting data pertaining to auxiliary OpenGL texture + * units. + */ + public static int lightmapTexUnit; + public static int GL_TEXTURE2; + private static boolean arbTextureEnvCombine; + public static int GL_COMBINE; + public static int GL_INTERPOLATE; + public static int GL_PRIMARY_COLOR; + public static int GL_CONSTANT; + public static int GL_PREVIOUS; + public static int GL_COMBINE_RGB; + public static int GL_SOURCE0_RGB; + public static int GL_SOURCE1_RGB; + public static int GL_SOURCE2_RGB; + public static int GL_OPERAND0_RGB; + public static int GL_OPERAND1_RGB; + public static int GL_OPERAND2_RGB; + public static int GL_COMBINE_ALPHA; + public static int GL_SOURCE0_ALPHA; + public static int GL_SOURCE1_ALPHA; + public static int GL_SOURCE2_ALPHA; + public static int GL_OPERAND0_ALPHA; + public static int GL_OPERAND1_ALPHA; + public static int GL_OPERAND2_ALPHA; + private static boolean openGL14; + public static boolean extBlendFuncSeparate; + public static boolean openGL21; + public static boolean shadersSupported; + private static String logText = ""; + private static String field_183030_aa; + public static boolean vboSupported; + public static boolean field_181062_Q; + private static boolean arbVbo; + public static int GL_ARRAY_BUFFER; + public static int GL_STATIC_DRAW; + private static final String __OBFID = "CL_00001179"; + public static float lastBrightnessX = 0.0F; + public static float lastBrightnessY = 0.0F; + + /** + * Initializes the texture constants to be used when rendering lightmap values + */ + public static void initializeTextures() + { + Config.initDisplay(); + ContextCapabilities contextcapabilities = GLContext.getCapabilities(); + arbMultitexture = contextcapabilities.GL_ARB_multitexture && !contextcapabilities.OpenGL13; + arbTextureEnvCombine = contextcapabilities.GL_ARB_texture_env_combine && !contextcapabilities.OpenGL13; + + if (arbMultitexture) + { + logText = logText + "Using ARB_multitexture.\n"; + defaultTexUnit = 33984; + lightmapTexUnit = 33985; + GL_TEXTURE2 = 33986; + } + else + { + logText = logText + "Using GL 1.3 multitexturing.\n"; + defaultTexUnit = 33984; + lightmapTexUnit = 33985; + GL_TEXTURE2 = 33986; + } + + if (arbTextureEnvCombine) + { + logText = logText + "Using ARB_texture_env_combine.\n"; + GL_COMBINE = 34160; + GL_INTERPOLATE = 34165; + GL_PRIMARY_COLOR = 34167; + GL_CONSTANT = 34166; + GL_PREVIOUS = 34168; + GL_COMBINE_RGB = 34161; + GL_SOURCE0_RGB = 34176; + GL_SOURCE1_RGB = 34177; + GL_SOURCE2_RGB = 34178; + GL_OPERAND0_RGB = 34192; + GL_OPERAND1_RGB = 34193; + GL_OPERAND2_RGB = 34194; + GL_COMBINE_ALPHA = 34162; + GL_SOURCE0_ALPHA = 34184; + GL_SOURCE1_ALPHA = 34185; + GL_SOURCE2_ALPHA = 34186; + GL_OPERAND0_ALPHA = 34200; + GL_OPERAND1_ALPHA = 34201; + GL_OPERAND2_ALPHA = 34202; + } + else + { + logText = logText + "Using GL 1.3 texture combiners.\n"; + GL_COMBINE = 34160; + GL_INTERPOLATE = 34165; + GL_PRIMARY_COLOR = 34167; + GL_CONSTANT = 34166; + GL_PREVIOUS = 34168; + GL_COMBINE_RGB = 34161; + GL_SOURCE0_RGB = 34176; + GL_SOURCE1_RGB = 34177; + GL_SOURCE2_RGB = 34178; + GL_OPERAND0_RGB = 34192; + GL_OPERAND1_RGB = 34193; + GL_OPERAND2_RGB = 34194; + GL_COMBINE_ALPHA = 34162; + GL_SOURCE0_ALPHA = 34184; + GL_SOURCE1_ALPHA = 34185; + GL_SOURCE2_ALPHA = 34186; + GL_OPERAND0_ALPHA = 34200; + GL_OPERAND1_ALPHA = 34201; + GL_OPERAND2_ALPHA = 34202; + } + + extBlendFuncSeparate = contextcapabilities.GL_EXT_blend_func_separate && !contextcapabilities.OpenGL14; + openGL14 = contextcapabilities.OpenGL14 || contextcapabilities.GL_EXT_blend_func_separate; + framebufferSupported = openGL14 && (contextcapabilities.GL_ARB_framebuffer_object || contextcapabilities.GL_EXT_framebuffer_object || contextcapabilities.OpenGL30); + + if (framebufferSupported) + { + logText = logText + "Using framebuffer objects because "; + + if (contextcapabilities.OpenGL30) + { + logText = logText + "OpenGL 3.0 is supported and separate blending is supported.\n"; + framebufferType = 0; + GL_FRAMEBUFFER = 36160; + GL_RENDERBUFFER = 36161; + GL_COLOR_ATTACHMENT0 = 36064; + GL_DEPTH_ATTACHMENT = 36096; + GL_FRAMEBUFFER_COMPLETE = 36053; + GL_FB_INCOMPLETE_ATTACHMENT = 36054; + GL_FB_INCOMPLETE_MISS_ATTACH = 36055; + GL_FB_INCOMPLETE_DRAW_BUFFER = 36059; + GL_FB_INCOMPLETE_READ_BUFFER = 36060; + } + else if (contextcapabilities.GL_ARB_framebuffer_object) + { + logText = logText + "ARB_framebuffer_object is supported and separate blending is supported.\n"; + framebufferType = 1; + GL_FRAMEBUFFER = 36160; + GL_RENDERBUFFER = 36161; + GL_COLOR_ATTACHMENT0 = 36064; + GL_DEPTH_ATTACHMENT = 36096; + GL_FRAMEBUFFER_COMPLETE = 36053; + GL_FB_INCOMPLETE_MISS_ATTACH = 36055; + GL_FB_INCOMPLETE_ATTACHMENT = 36054; + GL_FB_INCOMPLETE_DRAW_BUFFER = 36059; + GL_FB_INCOMPLETE_READ_BUFFER = 36060; + } + else if (contextcapabilities.GL_EXT_framebuffer_object) + { + logText = logText + "EXT_framebuffer_object is supported.\n"; + framebufferType = 2; + GL_FRAMEBUFFER = 36160; + GL_RENDERBUFFER = 36161; + GL_COLOR_ATTACHMENT0 = 36064; + GL_DEPTH_ATTACHMENT = 36096; + GL_FRAMEBUFFER_COMPLETE = 36053; + GL_FB_INCOMPLETE_MISS_ATTACH = 36055; + GL_FB_INCOMPLETE_ATTACHMENT = 36054; + GL_FB_INCOMPLETE_DRAW_BUFFER = 36059; + GL_FB_INCOMPLETE_READ_BUFFER = 36060; + } + } + else + { + logText = logText + "Not using framebuffer objects because "; + logText = logText + "OpenGL 1.4 is " + (contextcapabilities.OpenGL14 ? "" : "not ") + "supported, "; + logText = logText + "EXT_blend_func_separate is " + (contextcapabilities.GL_EXT_blend_func_separate ? "" : "not ") + "supported, "; + logText = logText + "OpenGL 3.0 is " + (contextcapabilities.OpenGL30 ? "" : "not ") + "supported, "; + logText = logText + "ARB_framebuffer_object is " + (contextcapabilities.GL_ARB_framebuffer_object ? "" : "not ") + "supported, and "; + logText = logText + "EXT_framebuffer_object is " + (contextcapabilities.GL_EXT_framebuffer_object ? "" : "not ") + "supported.\n"; + } + + openGL21 = contextcapabilities.OpenGL21; + shadersAvailable = openGL21 || contextcapabilities.GL_ARB_vertex_shader && contextcapabilities.GL_ARB_fragment_shader && contextcapabilities.GL_ARB_shader_objects; + logText = logText + "Shaders are " + (shadersAvailable ? "" : "not ") + "available because "; + + if (shadersAvailable) + { + if (contextcapabilities.OpenGL21) + { + logText = logText + "OpenGL 2.1 is supported.\n"; + arbShaders = false; + GL_LINK_STATUS = 35714; + GL_COMPILE_STATUS = 35713; + GL_VERTEX_SHADER = 35633; + GL_FRAGMENT_SHADER = 35632; + } + else + { + logText = logText + "ARB_shader_objects, ARB_vertex_shader, and ARB_fragment_shader are supported.\n"; + arbShaders = true; + GL_LINK_STATUS = 35714; + GL_COMPILE_STATUS = 35713; + GL_VERTEX_SHADER = 35633; + GL_FRAGMENT_SHADER = 35632; + } + } + else + { + logText = logText + "OpenGL 2.1 is " + (contextcapabilities.OpenGL21 ? "" : "not ") + "supported, "; + logText = logText + "ARB_shader_objects is " + (contextcapabilities.GL_ARB_shader_objects ? "" : "not ") + "supported, "; + logText = logText + "ARB_vertex_shader is " + (contextcapabilities.GL_ARB_vertex_shader ? "" : "not ") + "supported, and "; + logText = logText + "ARB_fragment_shader is " + (contextcapabilities.GL_ARB_fragment_shader ? "" : "not ") + "supported.\n"; + } + + shadersSupported = framebufferSupported && shadersAvailable; + String s = GL11.glGetString(GL11.GL_VENDOR).toLowerCase(); + nvidia = s.contains("nvidia"); + arbVbo = !contextcapabilities.OpenGL15 && contextcapabilities.GL_ARB_vertex_buffer_object; + vboSupported = contextcapabilities.OpenGL15 || arbVbo; + logText = logText + "VBOs are " + (vboSupported ? "" : "not ") + "available because "; + + if (vboSupported) + { + if (arbVbo) + { + logText = logText + "ARB_vertex_buffer_object is supported.\n"; + GL_STATIC_DRAW = 35044; + GL_ARRAY_BUFFER = 34962; + } + else + { + logText = logText + "OpenGL 1.5 is supported.\n"; + GL_STATIC_DRAW = 35044; + GL_ARRAY_BUFFER = 34962; + } + } + + field_181063_b = s.contains("ati"); + + if (field_181063_b) + { + if (vboSupported) + { + field_181062_Q = true; + } + else + { + GameSettings.Options.RENDER_DISTANCE.setValueMax(16.0F); + } + } + + try + { + Processor[] aprocessor = (new SystemInfo()).getHardware().getProcessors(); + field_183030_aa = String.format("%dx %s", new Object[] {Integer.valueOf(aprocessor.length), aprocessor[0]}).replaceAll("\\s+", " "); + } + catch (Throwable var3) + { + ; + } + } + + public static boolean areShadersSupported() + { + return shadersSupported; + } + + public static String getLogText() + { + return logText; + } + + public static int glGetProgrami(int program, int pname) + { + return arbShaders ? ARBShaderObjects.glGetObjectParameteriARB(program, pname) : GL20.glGetProgrami(program, pname); + } + + public static void glAttachShader(int program, int shaderIn) + { + if (arbShaders) + { + ARBShaderObjects.glAttachObjectARB(program, shaderIn); + } + else + { + GL20.glAttachShader(program, shaderIn); + } + } + + public static void glDeleteShader(int p_153180_0_) + { + if (arbShaders) + { + ARBShaderObjects.glDeleteObjectARB(p_153180_0_); + } + else + { + GL20.glDeleteShader(p_153180_0_); + } + } + + /** + * creates a shader with the given mode and returns the GL id. params: mode + */ + public static int glCreateShader(int type) + { + return arbShaders ? ARBShaderObjects.glCreateShaderObjectARB(type) : GL20.glCreateShader(type); + } + + public static void glShaderSource(int shaderIn, ByteBuffer string) + { + if (arbShaders) + { + ARBShaderObjects.glShaderSourceARB(shaderIn, string); + } + else + { + GL20.glShaderSource(shaderIn, string); + } + } + + public static void glCompileShader(int shaderIn) + { + if (arbShaders) + { + ARBShaderObjects.glCompileShaderARB(shaderIn); + } + else + { + GL20.glCompileShader(shaderIn); + } + } + + public static int glGetShaderi(int shaderIn, int pname) + { + return arbShaders ? ARBShaderObjects.glGetObjectParameteriARB(shaderIn, pname) : GL20.glGetShaderi(shaderIn, pname); + } + + public static String glGetShaderInfoLog(int shaderIn, int maxLength) + { + return arbShaders ? ARBShaderObjects.glGetInfoLogARB(shaderIn, maxLength) : GL20.glGetShaderInfoLog(shaderIn, maxLength); + } + + public static String glGetProgramInfoLog(int program, int maxLength) + { + return arbShaders ? ARBShaderObjects.glGetInfoLogARB(program, maxLength) : GL20.glGetProgramInfoLog(program, maxLength); + } + + public static void glUseProgram(int program) + { + if (arbShaders) + { + ARBShaderObjects.glUseProgramObjectARB(program); + } + else + { + GL20.glUseProgram(program); + } + } + + public static int glCreateProgram() + { + return arbShaders ? ARBShaderObjects.glCreateProgramObjectARB() : GL20.glCreateProgram(); + } + + public static void glDeleteProgram(int program) + { + if (arbShaders) + { + ARBShaderObjects.glDeleteObjectARB(program); + } + else + { + GL20.glDeleteProgram(program); + } + } + + public static void glLinkProgram(int program) + { + if (arbShaders) + { + ARBShaderObjects.glLinkProgramARB(program); + } + else + { + GL20.glLinkProgram(program); + } + } + + public static int glGetUniformLocation(int programObj, CharSequence name) + { + return arbShaders ? ARBShaderObjects.glGetUniformLocationARB(programObj, name) : GL20.glGetUniformLocation(programObj, name); + } + + public static void glUniform1(int location, IntBuffer values) + { + if (arbShaders) + { + ARBShaderObjects.glUniform1ARB(location, values); + } + else + { + GL20.glUniform1(location, values); + } + } + + public static void glUniform1i(int location, int v0) + { + if (arbShaders) + { + ARBShaderObjects.glUniform1iARB(location, v0); + } + else + { + GL20.glUniform1i(location, v0); + } + } + + public static void glUniform1(int location, FloatBuffer values) + { + if (arbShaders) + { + ARBShaderObjects.glUniform1ARB(location, values); + } + else + { + GL20.glUniform1(location, values); + } + } + + public static void glUniform2(int location, IntBuffer values) + { + if (arbShaders) + { + ARBShaderObjects.glUniform2ARB(location, values); + } + else + { + GL20.glUniform2(location, values); + } + } + + public static void glUniform2(int location, FloatBuffer values) + { + if (arbShaders) + { + ARBShaderObjects.glUniform2ARB(location, values); + } + else + { + GL20.glUniform2(location, values); + } + } + + public static void glUniform3(int location, IntBuffer values) + { + if (arbShaders) + { + ARBShaderObjects.glUniform3ARB(location, values); + } + else + { + GL20.glUniform3(location, values); + } + } + + public static void glUniform3(int location, FloatBuffer values) + { + if (arbShaders) + { + ARBShaderObjects.glUniform3ARB(location, values); + } + else + { + GL20.glUniform3(location, values); + } + } + + public static void glUniform4(int location, IntBuffer values) + { + if (arbShaders) + { + ARBShaderObjects.glUniform4ARB(location, values); + } + else + { + GL20.glUniform4(location, values); + } + } + + public static void glUniform4(int location, FloatBuffer values) + { + if (arbShaders) + { + ARBShaderObjects.glUniform4ARB(location, values); + } + else + { + GL20.glUniform4(location, values); + } + } + + public static void glUniformMatrix2(int location, boolean transpose, FloatBuffer matrices) + { + if (arbShaders) + { + ARBShaderObjects.glUniformMatrix2ARB(location, transpose, matrices); + } + else + { + GL20.glUniformMatrix2(location, transpose, matrices); + } + } + + public static void glUniformMatrix3(int location, boolean transpose, FloatBuffer matrices) + { + if (arbShaders) + { + ARBShaderObjects.glUniformMatrix3ARB(location, transpose, matrices); + } + else + { + GL20.glUniformMatrix3(location, transpose, matrices); + } + } + + public static void glUniformMatrix4(int location, boolean transpose, FloatBuffer matrices) + { + if (arbShaders) + { + ARBShaderObjects.glUniformMatrix4ARB(location, transpose, matrices); + } + else + { + GL20.glUniformMatrix4(location, transpose, matrices); + } + } + + public static int glGetAttribLocation(int p_153164_0_, CharSequence p_153164_1_) + { + return arbShaders ? ARBVertexShader.glGetAttribLocationARB(p_153164_0_, p_153164_1_) : GL20.glGetAttribLocation(p_153164_0_, p_153164_1_); + } + + public static int glGenBuffers() + { + return arbVbo ? ARBVertexBufferObject.glGenBuffersARB() : GL15.glGenBuffers(); + } + + public static void glBindBuffer(int target, int buffer) + { + if (arbVbo) + { + ARBVertexBufferObject.glBindBufferARB(target, buffer); + } + else + { + GL15.glBindBuffer(target, buffer); + } + } + + public static void glBufferData(int target, ByteBuffer data, int usage) + { + if (arbVbo) + { + ARBVertexBufferObject.glBufferDataARB(target, data, usage); + } + else + { + GL15.glBufferData(target, data, usage); + } + } + + public static void glDeleteBuffers(int buffer) + { + if (arbVbo) + { + ARBVertexBufferObject.glDeleteBuffersARB(buffer); + } + else + { + GL15.glDeleteBuffers(buffer); + } + } + + public static boolean useVbo() + { + return Config.isMultiTexture() ? false : vboSupported && Minecraft.getMinecraft().gameSettings.useVbo; + } + + public static void glBindFramebuffer(int target, int framebufferIn) + { + if (framebufferSupported) + { + switch (framebufferType) + { + case 0: + GL30.glBindFramebuffer(target, framebufferIn); + break; + + case 1: + ARBFramebufferObject.glBindFramebuffer(target, framebufferIn); + break; + + case 2: + EXTFramebufferObject.glBindFramebufferEXT(target, framebufferIn); + } + } + } + + public static void glBindRenderbuffer(int target, int renderbuffer) + { + if (framebufferSupported) + { + switch (framebufferType) + { + case 0: + GL30.glBindRenderbuffer(target, renderbuffer); + break; + + case 1: + ARBFramebufferObject.glBindRenderbuffer(target, renderbuffer); + break; + + case 2: + EXTFramebufferObject.glBindRenderbufferEXT(target, renderbuffer); + } + } + } + + public static void glDeleteRenderbuffers(int renderbuffer) + { + if (framebufferSupported) + { + switch (framebufferType) + { + case 0: + GL30.glDeleteRenderbuffers(renderbuffer); + break; + + case 1: + ARBFramebufferObject.glDeleteRenderbuffers(renderbuffer); + break; + + case 2: + EXTFramebufferObject.glDeleteRenderbuffersEXT(renderbuffer); + } + } + } + + public static void glDeleteFramebuffers(int framebufferIn) + { + if (framebufferSupported) + { + switch (framebufferType) + { + case 0: + GL30.glDeleteFramebuffers(framebufferIn); + break; + + case 1: + ARBFramebufferObject.glDeleteFramebuffers(framebufferIn); + break; + + case 2: + EXTFramebufferObject.glDeleteFramebuffersEXT(framebufferIn); + } + } + } + + /** + * Calls the appropriate glGenFramebuffers method and returns the newly created fbo, or returns -1 if not supported. + */ + public static int glGenFramebuffers() + { + if (!framebufferSupported) + { + return -1; + } + else + { + switch (framebufferType) + { + case 0: + return GL30.glGenFramebuffers(); + + case 1: + return ARBFramebufferObject.glGenFramebuffers(); + + case 2: + return EXTFramebufferObject.glGenFramebuffersEXT(); + + default: + return -1; + } + } + } + + public static int glGenRenderbuffers() + { + if (!framebufferSupported) + { + return -1; + } + else + { + switch (framebufferType) + { + case 0: + return GL30.glGenRenderbuffers(); + + case 1: + return ARBFramebufferObject.glGenRenderbuffers(); + + case 2: + return EXTFramebufferObject.glGenRenderbuffersEXT(); + + default: + return -1; + } + } + } + + public static void glRenderbufferStorage(int target, int internalFormat, int width, int height) + { + if (framebufferSupported) + { + switch (framebufferType) + { + case 0: + GL30.glRenderbufferStorage(target, internalFormat, width, height); + break; + + case 1: + ARBFramebufferObject.glRenderbufferStorage(target, internalFormat, width, height); + break; + + case 2: + EXTFramebufferObject.glRenderbufferStorageEXT(target, internalFormat, width, height); + } + } + } + + public static void glFramebufferRenderbuffer(int target, int attachment, int renderBufferTarget, int renderBuffer) + { + if (framebufferSupported) + { + switch (framebufferType) + { + case 0: + GL30.glFramebufferRenderbuffer(target, attachment, renderBufferTarget, renderBuffer); + break; + + case 1: + ARBFramebufferObject.glFramebufferRenderbuffer(target, attachment, renderBufferTarget, renderBuffer); + break; + + case 2: + EXTFramebufferObject.glFramebufferRenderbufferEXT(target, attachment, renderBufferTarget, renderBuffer); + } + } + } + + public static int glCheckFramebufferStatus(int target) + { + if (!framebufferSupported) + { + return -1; + } + else + { + switch (framebufferType) + { + case 0: + return GL30.glCheckFramebufferStatus(target); + + case 1: + return ARBFramebufferObject.glCheckFramebufferStatus(target); + + case 2: + return EXTFramebufferObject.glCheckFramebufferStatusEXT(target); + + default: + return -1; + } + } + } + + public static void glFramebufferTexture2D(int target, int attachment, int textarget, int texture, int level) + { + if (framebufferSupported) + { + switch (framebufferType) + { + case 0: + GL30.glFramebufferTexture2D(target, attachment, textarget, texture, level); + break; + + case 1: + ARBFramebufferObject.glFramebufferTexture2D(target, attachment, textarget, texture, level); + break; + + case 2: + EXTFramebufferObject.glFramebufferTexture2DEXT(target, attachment, textarget, texture, level); + } + } + } + + /** + * Sets the current lightmap texture to the specified OpenGL constant + */ + public static void setActiveTexture(int texture) + { + if (arbMultitexture) + { + ARBMultitexture.glActiveTextureARB(texture); + } + else + { + GL13.glActiveTexture(texture); + } + } + + /** + * Sets the current lightmap texture to the specified OpenGL constant + */ + public static void setClientActiveTexture(int texture) + { + if (arbMultitexture) + { + ARBMultitexture.glClientActiveTextureARB(texture); + } + else + { + GL13.glClientActiveTexture(texture); + } + } + + /** + * Sets the current coordinates of the given lightmap texture + */ + public static void setLightmapTextureCoords(int target, float p_77475_1_, float p_77475_2_) + { + if (arbMultitexture) + { + ARBMultitexture.glMultiTexCoord2fARB(target, p_77475_1_, p_77475_2_); + } + else + { + GL13.glMultiTexCoord2f(target, p_77475_1_, p_77475_2_); + } + + if (target == lightmapTexUnit) + { + lastBrightnessX = p_77475_1_; + lastBrightnessY = p_77475_2_; + } + } + + public static void glBlendFunc(int sFactorRGB, int dFactorRGB, int sfactorAlpha, int dfactorAlpha) + { + if (openGL14) + { + if (extBlendFuncSeparate) + { + EXTBlendFuncSeparate.glBlendFuncSeparateEXT(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha); + } + else + { + GL14.glBlendFuncSeparate(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha); + } + } + else + { + GL11.glBlendFunc(sFactorRGB, dFactorRGB); + } + } + + public static boolean isFramebufferEnabled() + { + return Config.isFastRender() ? false : (Config.isAntialiasing() ? false : framebufferSupported && Minecraft.getMinecraft().gameSettings.fboEnable); + } + + public static String func_183029_j() + { + return field_183030_aa == null ? "" : field_183030_aa; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/RegionRenderCache.java b/src/minecraft/net/minecraft/client/renderer/RegionRenderCache.java new file mode 100644 index 0000000..a16c1ef --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/RegionRenderCache.java @@ -0,0 +1,161 @@ +package net.minecraft.client.renderer; + +import java.util.ArrayDeque; +import java.util.Arrays; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3i; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import optifine.Config; +import optifine.DynamicLights; + +public class RegionRenderCache extends ChunkCache +{ + private static final IBlockState DEFAULT_STATE = Blocks.air.getDefaultState(); + private final BlockPos position; + private int[] combinedLights; + private IBlockState[] blockStates; + private static final String __OBFID = "CL_00002565"; + private static ArrayDeque cacheLights = new ArrayDeque(); + private static ArrayDeque cacheStates = new ArrayDeque(); + private static int maxCacheSize = Config.limit(Runtime.getRuntime().availableProcessors(), 1, 32); + + public RegionRenderCache(World worldIn, BlockPos posFromIn, BlockPos posToIn, int subIn) + { + super(worldIn, posFromIn, posToIn, subIn); + this.position = posFromIn.subtract(new Vec3i(subIn, subIn, subIn)); + boolean flag = true; + this.combinedLights = allocateLights(8000); + Arrays.fill((int[])this.combinedLights, (int) - 1); + this.blockStates = allocateStates(8000); + } + + public TileEntity getTileEntity(BlockPos pos) + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; + return this.chunkArray[i][j].getTileEntity(pos, Chunk.EnumCreateEntityType.QUEUED); + } + + public int getCombinedLight(BlockPos pos, int lightValue) + { + int i = this.getPositionIndex(pos); + int j = this.combinedLights[i]; + + if (j == -1) + { + j = super.getCombinedLight(pos, lightValue); + + if (Config.isDynamicLights() && !this.getBlockState(pos).getBlock().isOpaqueCube()) + { + j = DynamicLights.getCombinedLight(pos, j); + } + + this.combinedLights[i] = j; + } + + return j; + } + + public IBlockState getBlockState(BlockPos pos) + { + int i = this.getPositionIndex(pos); + IBlockState iblockstate = this.blockStates[i]; + + if (iblockstate == null) + { + iblockstate = this.getBlockStateRaw(pos); + this.blockStates[i] = iblockstate; + } + + return iblockstate; + } + + private IBlockState getBlockStateRaw(BlockPos pos) + { + if (pos.getY() >= 0 && pos.getY() < 256) + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; + return this.chunkArray[i][j].getBlockState(pos); + } + else + { + return DEFAULT_STATE; + } + } + + private int getPositionIndex(BlockPos p_175630_1_) + { + int i = p_175630_1_.getX() - this.position.getX(); + int j = p_175630_1_.getY() - this.position.getY(); + int k = p_175630_1_.getZ() - this.position.getZ(); + return i * 400 + k * 20 + j; + } + + public void freeBuffers() + { + freeLights(this.combinedLights); + freeStates(this.blockStates); + } + + private static int[] allocateLights(int p_allocateLights_0_) + { + synchronized (cacheLights) + { + int[] aint = (int[])cacheLights.pollLast(); + + if (aint == null || aint.length < p_allocateLights_0_) + { + aint = new int[p_allocateLights_0_]; + } + + return aint; + } + } + + public static void freeLights(int[] p_freeLights_0_) + { + synchronized (cacheLights) + { + if (cacheLights.size() < maxCacheSize) + { + cacheLights.add(p_freeLights_0_); + } + } + } + + private static IBlockState[] allocateStates(int p_allocateStates_0_) + { + synchronized (cacheStates) + { + IBlockState[] aiblockstate = (IBlockState[])cacheStates.pollLast(); + + if (aiblockstate != null && aiblockstate.length >= p_allocateStates_0_) + { + Arrays.fill(aiblockstate, (Object)null); + } + else + { + aiblockstate = new IBlockState[p_allocateStates_0_]; + } + + return aiblockstate; + } + } + + public static void freeStates(IBlockState[] p_freeStates_0_) + { + synchronized (cacheStates) + { + if (cacheStates.size() < maxCacheSize) + { + cacheStates.add(p_freeStates_0_); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/RegionRenderCacheBuilder.java b/src/minecraft/net/minecraft/client/renderer/RegionRenderCacheBuilder.java new file mode 100644 index 0000000..9946440 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/RegionRenderCacheBuilder.java @@ -0,0 +1,26 @@ +package net.minecraft.client.renderer; + +import net.minecraft.util.EnumWorldBlockLayer; + +public class RegionRenderCacheBuilder +{ + private final WorldRenderer[] worldRenderers = new WorldRenderer[EnumWorldBlockLayer.values().length]; + + public RegionRenderCacheBuilder() + { + this.worldRenderers[EnumWorldBlockLayer.SOLID.ordinal()] = new WorldRenderer(2097152); + this.worldRenderers[EnumWorldBlockLayer.CUTOUT.ordinal()] = new WorldRenderer(131072); + this.worldRenderers[EnumWorldBlockLayer.CUTOUT_MIPPED.ordinal()] = new WorldRenderer(131072); + this.worldRenderers[EnumWorldBlockLayer.TRANSLUCENT.ordinal()] = new WorldRenderer(262144); + } + + public WorldRenderer getWorldRendererByLayer(EnumWorldBlockLayer layer) + { + return this.worldRenderers[layer.ordinal()]; + } + + public WorldRenderer getWorldRendererByLayerId(int id) + { + return this.worldRenderers[id]; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/RenderGlobal.java b/src/minecraft/net/minecraft/client/renderer/RenderGlobal.java new file mode 100644 index 0000000..3617ff5 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/RenderGlobal.java @@ -0,0 +1,3361 @@ +package net.minecraft.client.renderer; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.google.gson.JsonSyntaxException; + +import animeware.cosmetic.Booleans; + +import java.io.IOException; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Deque; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.concurrent.Callable; +import java.awt.Color; +import net.minecraft.block.Block; +import net.minecraft.block.BlockChest; +import net.minecraft.block.BlockEnderChest; +import net.minecraft.block.BlockSign; +import net.minecraft.block.BlockSkull; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.ISound; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher; +import net.minecraft.client.renderer.chunk.CompiledChunk; +import net.minecraft.client.renderer.chunk.IRenderChunkFactory; +import net.minecraft.client.renderer.chunk.ListChunkFactory; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.client.renderer.chunk.VboChunkFactory; +import net.minecraft.client.renderer.chunk.VisGraph; +import net.minecraft.client.renderer.culling.ClippingHelper; +import net.minecraft.client.renderer.culling.ClippingHelperImpl; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.culling.ICamera; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexBuffer; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.client.shader.ShaderGroup; +import net.minecraft.client.shader.ShaderLinkHelper; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityWitherSkull; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemDye; +import net.minecraft.item.ItemRecord; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ClassInheritanceMultiMap; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Matrix4f; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.util.Vector3d; +import net.minecraft.world.IWorldAccess; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.border.WorldBorder; +import net.minecraft.world.chunk.Chunk; +import optifine.ChunkUtils; +import optifine.CloudRenderer; +import optifine.Config; +import optifine.CustomColors; +import optifine.CustomSky; +import optifine.DynamicLights; +import optifine.Lagometer; +import optifine.RandomMobs; +import optifine.Reflector; +import optifine.RenderInfoLazy; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.vector.Vector3f; +import org.lwjgl.util.vector.Vector4f; +import shadersmod.client.Shaders; +import shadersmod.client.ShadersRender; +import shadersmod.client.ShadowUtils; + +public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListener +{ + private static final Logger logger = LogManager.getLogger(); + private static final ResourceLocation locationMoonPhasesPng = new ResourceLocation("textures/environment/moon_phases.png"); + private static final ResourceLocation locationSunPng = new ResourceLocation("textures/environment/sun.png"); + private static final ResourceLocation locationCloudsPng = new ResourceLocation("textures/environment/clouds.png"); + private static final ResourceLocation locationEndSkyPng = new ResourceLocation("textures/environment/end_sky.png"); + private static final ResourceLocation locationForcefieldPng = new ResourceLocation("textures/misc/forcefield.png"); + + /** A reference to the Minecraft object. */ + public final Minecraft mc; + + /** The RenderEngine instance used by RenderGlobal */ + private final TextureManager renderEngine; + private final RenderManager renderManager; + private WorldClient theWorld; + private Set chunksToUpdate = Sets.newLinkedHashSet(); + + /** List of OpenGL lists for the current render pass */ + private List renderInfos = Lists.newArrayListWithCapacity(69696); + private final Set field_181024_n = Sets.newHashSet(); + private ViewFrustum viewFrustum; + + /** The star GL Call list */ + private int starGLCallList = -1; + + /** OpenGL sky list */ + private int glSkyList = -1; + + /** OpenGL sky list 2 */ + private int glSkyList2 = -1; + private VertexFormat vertexBufferFormat; + private VertexBuffer starVBO; + private VertexBuffer skyVBO; + private VertexBuffer sky2VBO; + + /** + * counts the cloud render updates. Used with mod to stagger some updates + */ + private int cloudTickCounter; + + /** + * Stores blocks currently being broken. Key is entity ID of the thing doing the breaking. Value is a + * DestroyBlockProgress + */ + public final Map damagedBlocks = Maps.newHashMap(); + + /** Currently playing sounds. Type: HashMap */ + private final Map mapSoundPositions = Maps.newHashMap(); + private final TextureAtlasSprite[] destroyBlockIcons = new TextureAtlasSprite[10]; + private Framebuffer entityOutlineFramebuffer; + + /** Stores the shader group for the entity_outline shader */ + private ShaderGroup entityOutlineShader; + private double frustumUpdatePosX = Double.MIN_VALUE; + private double frustumUpdatePosY = Double.MIN_VALUE; + private double frustumUpdatePosZ = Double.MIN_VALUE; + private int frustumUpdatePosChunkX = Integer.MIN_VALUE; + private int frustumUpdatePosChunkY = Integer.MIN_VALUE; + private int frustumUpdatePosChunkZ = Integer.MIN_VALUE; + private double lastViewEntityX = Double.MIN_VALUE; + private double lastViewEntityY = Double.MIN_VALUE; + private double lastViewEntityZ = Double.MIN_VALUE; + private double lastViewEntityPitch = Double.MIN_VALUE; + private double lastViewEntityYaw = Double.MIN_VALUE; + private final ChunkRenderDispatcher renderDispatcher = new ChunkRenderDispatcher(); + private ChunkRenderContainer renderContainer; + private int renderDistanceChunks = -1; + + /** Render entities startup counter (init value=2) */ + private int renderEntitiesStartupCounter = 2; + + /** Count entities total */ + private int countEntitiesTotal; + + /** Count entities rendered */ + private int countEntitiesRendered; + + /** Count entities hidden */ + private int countEntitiesHidden; + private boolean debugFixTerrainFrustum = false; + private ClippingHelper debugFixedClippingHelper; + private final Vector4f[] debugTerrainMatrix = new Vector4f[8]; + private final Vector3d debugTerrainFrustumPosition = new Vector3d(); + private boolean vboEnabled = false; + IRenderChunkFactory renderChunkFactory; + private double prevRenderSortX; + private double prevRenderSortY; + private double prevRenderSortZ; + public boolean displayListEntitiesDirty = true; + private static final String __OBFID = "CL_00000954"; + private CloudRenderer cloudRenderer; + public Entity renderedEntity; + public Set chunksToResortTransparency = new LinkedHashSet(); + public Set chunksToUpdateForced = new LinkedHashSet(); + private Deque visibilityDeque = new ArrayDeque(); + private List renderInfosEntities = new ArrayList(1024); + private List renderInfosTileEntities = new ArrayList(1024); + private List renderInfosNormal = new ArrayList(1024); + private List renderInfosEntitiesNormal = new ArrayList(1024); + private List renderInfosTileEntitiesNormal = new ArrayList(1024); + private List renderInfosShadow = new ArrayList(1024); + private List renderInfosEntitiesShadow = new ArrayList(1024); + private List renderInfosTileEntitiesShadow = new ArrayList(1024); + private int renderDistance = 0; + private int renderDistanceSq = 0; + private static final Set SET_ALL_FACINGS = Collections.unmodifiableSet(new HashSet(Arrays.asList(EnumFacing.VALUES))); + private int countTileEntitiesRendered; + + public RenderGlobal(Minecraft mcIn) + { + this.cloudRenderer = new CloudRenderer(mcIn); + this.mc = mcIn; + this.renderManager = mcIn.getRenderManager(); + this.renderEngine = mcIn.getTextureManager(); + this.renderEngine.bindTexture(locationForcefieldPng); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + GlStateManager.bindTexture(0); + this.updateDestroyBlockIcons(); + this.vboEnabled = OpenGlHelper.useVbo(); + + if (this.vboEnabled) + { + this.renderContainer = new VboRenderList(); + this.renderChunkFactory = new VboChunkFactory(); + } + else + { + this.renderContainer = new RenderList(); + this.renderChunkFactory = new ListChunkFactory(); + } + + this.vertexBufferFormat = new VertexFormat(); + this.vertexBufferFormat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3)); + this.generateStars(); + this.generateSky(); + this.generateSky2(); + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + this.updateDestroyBlockIcons(); + } + + private void updateDestroyBlockIcons() + { + TextureMap texturemap = this.mc.getTextureMapBlocks(); + + for (int i = 0; i < this.destroyBlockIcons.length; ++i) + { + this.destroyBlockIcons[i] = texturemap.getAtlasSprite("minecraft:blocks/destroy_stage_" + i); + } + } + + /** + * Creates the entity outline shader to be stored in RenderGlobal.entityOutlineShader + */ + public void makeEntityOutlineShader() + { + if (OpenGlHelper.shadersSupported) + { + if (ShaderLinkHelper.getStaticShaderLinkHelper() == null) + { + ShaderLinkHelper.setNewStaticShaderLinkHelper(); + } + + ResourceLocation resourcelocation = new ResourceLocation("shaders/post/entity_outline.json"); + + try + { + this.entityOutlineShader = new ShaderGroup(this.mc.getTextureManager(), this.mc.getResourceManager(), this.mc.getFramebuffer(), resourcelocation); + this.entityOutlineShader.createBindFramebuffers(this.mc.displayWidth, this.mc.displayHeight); + this.entityOutlineFramebuffer = this.entityOutlineShader.getFramebufferRaw("final"); + } + catch (IOException ioexception) + { + logger.warn((String)("Failed to load shader: " + resourcelocation), (Throwable)ioexception); + this.entityOutlineShader = null; + this.entityOutlineFramebuffer = null; + } + catch (JsonSyntaxException jsonsyntaxexception) + { + logger.warn((String)("Failed to load shader: " + resourcelocation), (Throwable)jsonsyntaxexception); + this.entityOutlineShader = null; + this.entityOutlineFramebuffer = null; + } + } + else + { + this.entityOutlineShader = null; + this.entityOutlineFramebuffer = null; + } + } + + public void renderEntityOutlineFramebuffer() + { + if (this.isRenderEntityOutlines()) + { + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1); + this.entityOutlineFramebuffer.framebufferRenderExt(this.mc.displayWidth, this.mc.displayHeight, false); + GlStateManager.disableBlend(); + } + } + + protected boolean isRenderEntityOutlines() + { + return !Config.isFastRender() && !Config.isShaders() && !Config.isAntialiasing() ? this.entityOutlineFramebuffer != null && this.entityOutlineShader != null && this.mc.thePlayer != null && this.mc.thePlayer.isSpectator() && this.mc.gameSettings.keyBindSpectatorOutlines.isKeyDown() : false; + } + + private void generateSky2() + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + + if (this.sky2VBO != null) + { + this.sky2VBO.deleteGlBuffers(); + } + + if (this.glSkyList2 >= 0) + { + GLAllocation.deleteDisplayLists(this.glSkyList2); + this.glSkyList2 = -1; + } + + if (this.vboEnabled) + { + this.sky2VBO = new VertexBuffer(this.vertexBufferFormat); + this.renderSky(worldrenderer, -16.0F, true); + worldrenderer.finishDrawing(); + worldrenderer.reset(); + this.sky2VBO.func_181722_a(worldrenderer.getByteBuffer()); + } + else + { + this.glSkyList2 = GLAllocation.generateDisplayLists(1); + GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE); + this.renderSky(worldrenderer, -16.0F, true); + tessellator.draw(); + GL11.glEndList(); + } + } + + private void generateSky() + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + + if (this.skyVBO != null) + { + this.skyVBO.deleteGlBuffers(); + } + + if (this.glSkyList >= 0) + { + GLAllocation.deleteDisplayLists(this.glSkyList); + this.glSkyList = -1; + } + + if (this.vboEnabled) + { + this.skyVBO = new VertexBuffer(this.vertexBufferFormat); + this.renderSky(worldrenderer, 16.0F, false); + worldrenderer.finishDrawing(); + worldrenderer.reset(); + this.skyVBO.func_181722_a(worldrenderer.getByteBuffer()); + } + else + { + this.glSkyList = GLAllocation.generateDisplayLists(1); + GL11.glNewList(this.glSkyList, GL11.GL_COMPILE); + this.renderSky(worldrenderer, 16.0F, false); + tessellator.draw(); + GL11.glEndList(); + } + } + + private void renderSky(WorldRenderer worldRendererIn, float p_174968_2_, boolean p_174968_3_) + { + boolean flag = true; + boolean flag1 = true; + worldRendererIn.begin(7, DefaultVertexFormats.POSITION); + + for (int i = -384; i <= 384; i += 64) + { + for (int j = -384; j <= 384; j += 64) + { + float f = (float)i; + float f1 = (float)(i + 64); + + if (p_174968_3_) + { + f1 = (float)i; + f = (float)(i + 64); + } + + worldRendererIn.pos((double)f, (double)p_174968_2_, (double)j).endVertex(); + worldRendererIn.pos((double)f1, (double)p_174968_2_, (double)j).endVertex(); + worldRendererIn.pos((double)f1, (double)p_174968_2_, (double)(j + 64)).endVertex(); + worldRendererIn.pos((double)f, (double)p_174968_2_, (double)(j + 64)).endVertex(); + } + } + } + + private void generateStars() + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + + if (this.starVBO != null) + { + this.starVBO.deleteGlBuffers(); + } + + if (this.starGLCallList >= 0) + { + GLAllocation.deleteDisplayLists(this.starGLCallList); + this.starGLCallList = -1; + } + + if (this.vboEnabled) + { + this.starVBO = new VertexBuffer(this.vertexBufferFormat); + this.renderStars(worldrenderer); + worldrenderer.finishDrawing(); + worldrenderer.reset(); + this.starVBO.func_181722_a(worldrenderer.getByteBuffer()); + } + else + { + this.starGLCallList = GLAllocation.generateDisplayLists(1); + GlStateManager.pushMatrix(); + GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE); + this.renderStars(worldrenderer); + tessellator.draw(); + GL11.glEndList(); + GlStateManager.popMatrix(); + } + } + + private void renderStars(WorldRenderer worldRendererIn) + { + Random random = new Random(10842L); + worldRendererIn.begin(7, DefaultVertexFormats.POSITION); + + for (int i = 0; i < 1500; ++i) + { + double d0 = (double)(random.nextFloat() * 2.0F - 1.0F); + double d1 = (double)(random.nextFloat() * 2.0F - 1.0F); + double d2 = (double)(random.nextFloat() * 2.0F - 1.0F); + double d3 = (double)(0.15F + random.nextFloat() * 0.1F); + double d4 = d0 * d0 + d1 * d1 + d2 * d2; + + if (d4 < 1.0D && d4 > 0.01D) + { + d4 = 1.0D / Math.sqrt(d4); + d0 = d0 * d4; + d1 = d1 * d4; + d2 = d2 * d4; + double d5 = d0 * 100.0D; + double d6 = d1 * 100.0D; + double d7 = d2 * 100.0D; + double d8 = Math.atan2(d0, d2); + double d9 = Math.sin(d8); + double d10 = Math.cos(d8); + double d11 = Math.atan2(Math.sqrt(d0 * d0 + d2 * d2), d1); + double d12 = Math.sin(d11); + double d13 = Math.cos(d11); + double d14 = random.nextDouble() * Math.PI * 2.0D; + double d15 = Math.sin(d14); + double d16 = Math.cos(d14); + + for (int j = 0; j < 4; ++j) + { + double d17 = 0.0D; + double d18 = (double)((j & 2) - 1) * d3; + double d19 = (double)((j + 1 & 2) - 1) * d3; + double d20 = 0.0D; + double d21 = d18 * d16 - d19 * d15; + double d22 = d19 * d16 + d18 * d15; + double d23 = d21 * d12 + 0.0D * d13; + double d24 = 0.0D * d12 - d21 * d13; + double d25 = d24 * d9 - d22 * d10; + double d26 = d22 * d9 + d24 * d10; + worldRendererIn.pos(d5 + d25, d6 + d23, d7 + d26).endVertex(); + } + } + } + } + + /** + * set null to clear + */ + public void setWorldAndLoadRenderers(WorldClient worldClientIn) + { + if (this.theWorld != null) + { + this.theWorld.removeWorldAccess(this); + } + + this.frustumUpdatePosX = Double.MIN_VALUE; + this.frustumUpdatePosY = Double.MIN_VALUE; + this.frustumUpdatePosZ = Double.MIN_VALUE; + this.frustumUpdatePosChunkX = Integer.MIN_VALUE; + this.frustumUpdatePosChunkY = Integer.MIN_VALUE; + this.frustumUpdatePosChunkZ = Integer.MIN_VALUE; + this.renderManager.set(worldClientIn); + this.theWorld = worldClientIn; + + if (Config.isDynamicLights()) + { + DynamicLights.clear(); + } + + if (worldClientIn != null) + { + worldClientIn.addWorldAccess(this); + this.loadRenderers(); + } + } + + /** + * Loads all the renderers and sets up the basic settings usage + */ + public void loadRenderers() + { + if (this.theWorld != null) + { + this.displayListEntitiesDirty = true; + Blocks.leaves.setGraphicsLevel(Config.isTreesFancy()); + Blocks.leaves2.setGraphicsLevel(Config.isTreesFancy()); + BlockModelRenderer.updateAoLightValue(); + + if (Config.isDynamicLights()) + { + DynamicLights.clear(); + } + + this.renderDistanceChunks = this.mc.gameSettings.renderDistanceChunks; + this.renderDistance = this.renderDistanceChunks * 16; + this.renderDistanceSq = this.renderDistance * this.renderDistance; + boolean flag = this.vboEnabled; + this.vboEnabled = OpenGlHelper.useVbo(); + + if (flag && !this.vboEnabled) + { + this.renderContainer = new RenderList(); + this.renderChunkFactory = new ListChunkFactory(); + } + else if (!flag && this.vboEnabled) + { + this.renderContainer = new VboRenderList(); + this.renderChunkFactory = new VboChunkFactory(); + } + + if (flag != this.vboEnabled) + { + this.generateStars(); + this.generateSky(); + this.generateSky2(); + } + + if (this.viewFrustum != null) + { + this.viewFrustum.deleteGlResources(); + } + + this.stopChunkUpdates(); + Set var5 = this.field_181024_n; + + synchronized (this.field_181024_n) + { + this.field_181024_n.clear(); + } + + this.viewFrustum = new ViewFrustum(this.theWorld, this.mc.gameSettings.renderDistanceChunks, this, this.renderChunkFactory); + + if (this.theWorld != null) + { + Entity entity = this.mc.getRenderViewEntity(); + + if (entity != null) + { + this.viewFrustum.updateChunkPositions(entity.posX, entity.posZ); + } + } + + this.renderEntitiesStartupCounter = 2; + } + } + + protected void stopChunkUpdates() + { + this.chunksToUpdate.clear(); + this.renderDispatcher.stopChunkUpdates(); + } + + public void createBindEntityOutlineFbs(int p_72720_1_, int p_72720_2_) + { + if (OpenGlHelper.shadersSupported && this.entityOutlineShader != null) + { + this.entityOutlineShader.createBindFramebuffers(p_72720_1_, p_72720_2_); + } + } + + public void renderEntities(Entity renderViewEntity, ICamera camera, float partialTicks) + { + int i = 0; + + if (Reflector.MinecraftForgeClient_getRenderPass.exists()) + { + i = Reflector.callInt(Reflector.MinecraftForgeClient_getRenderPass, new Object[0]); + } + + if (this.renderEntitiesStartupCounter > 0) + { + if (i > 0) + { + return; + } + + --this.renderEntitiesStartupCounter; + } + else + { + double d0 = renderViewEntity.prevPosX + (renderViewEntity.posX - renderViewEntity.prevPosX) * (double)partialTicks; + double d1 = renderViewEntity.prevPosY + (renderViewEntity.posY - renderViewEntity.prevPosY) * (double)partialTicks; + double d2 = renderViewEntity.prevPosZ + (renderViewEntity.posZ - renderViewEntity.prevPosZ) * (double)partialTicks; + this.theWorld.theProfiler.startSection("prepare"); + TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), partialTicks); + this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks); + + if (i == 0) + { + this.countEntitiesTotal = 0; + this.countEntitiesRendered = 0; + this.countEntitiesHidden = 0; + this.countTileEntitiesRendered = 0; + } + + Entity entity = this.mc.getRenderViewEntity(); + double d3 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d4 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + double d5 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; + TileEntityRendererDispatcher.staticPlayerX = d3; + TileEntityRendererDispatcher.staticPlayerY = d4; + TileEntityRendererDispatcher.staticPlayerZ = d5; + this.renderManager.setRenderPosition(d3, d4, d5); + this.mc.entityRenderer.enableLightmap(); + this.theWorld.theProfiler.endStartSection("global"); + List list = this.theWorld.getLoadedEntityList(); + + if (i == 0) + { + this.countEntitiesTotal = list.size(); + } + + if (Config.isFogOff() && this.mc.entityRenderer.fogStandard) + { + GlStateManager.disableFog(); + } + + boolean flag = Reflector.ForgeEntity_shouldRenderInPass.exists(); + boolean flag1 = Reflector.ForgeTileEntity_shouldRenderInPass.exists(); + + for (int j = 0; j < this.theWorld.weatherEffects.size(); ++j) + { + Entity entity1 = (Entity)this.theWorld.weatherEffects.get(j); + + if (!flag || Reflector.callBoolean(entity1, Reflector.ForgeEntity_shouldRenderInPass, new Object[] {Integer.valueOf(i)})) + { + ++this.countEntitiesRendered; + + if (entity1.isInRangeToRender3d(d0, d1, d2)) + { + this.renderManager.renderEntitySimple(entity1, partialTicks); + } + } + } + + if (this.isRenderEntityOutlines()) + { + GlStateManager.depthFunc(519); + GlStateManager.disableFog(); + this.entityOutlineFramebuffer.framebufferClear(); + this.entityOutlineFramebuffer.bindFramebuffer(false); + this.theWorld.theProfiler.endStartSection("entityOutlines"); + RenderHelper.disableStandardItemLighting(); + this.renderManager.setRenderOutlines(true); + + for (int k = 0; k < list.size(); ++k) + { + Entity entity3 = (Entity)list.get(k); + + if (!flag || Reflector.callBoolean(entity3, Reflector.ForgeEntity_shouldRenderInPass, new Object[] {Integer.valueOf(i)})) + { + boolean flag2 = this.mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping(); + boolean flag3 = entity3.isInRangeToRender3d(d0, d1, d2) && (entity3.ignoreFrustumCheck || camera.isBoundingBoxInFrustum(entity3.getEntityBoundingBox()) || entity3.riddenByEntity == this.mc.thePlayer) && entity3 instanceof EntityPlayer; + + if ((entity3 != this.mc.getRenderViewEntity() || this.mc.gameSettings.thirdPersonView != 0 || flag2) && flag3) + { + this.renderManager.renderEntitySimple(entity3, partialTicks); + } + } + } + + this.renderManager.setRenderOutlines(false); + RenderHelper.enableStandardItemLighting(); + GlStateManager.depthMask(false); + this.entityOutlineShader.loadShaderGroup(partialTicks); + GlStateManager.enableLighting(); + GlStateManager.depthMask(true); + this.mc.getFramebuffer().bindFramebuffer(false); + GlStateManager.enableFog(); + GlStateManager.enableBlend(); + GlStateManager.enableColorMaterial(); + GlStateManager.depthFunc(515); + GlStateManager.enableDepth(); + GlStateManager.enableAlpha(); + } + + this.theWorld.theProfiler.endStartSection("entities"); + boolean flag7 = Config.isShaders(); + + if (flag7) + { + Shaders.beginEntities(); + } + + Iterator iterator1 = this.renderInfosEntities.iterator(); + boolean flag4 = this.mc.gameSettings.fancyGraphics; + this.mc.gameSettings.fancyGraphics = Config.isDroppedItemsFancy(); + label920: + + while (iterator1.hasNext()) + { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation = (RenderGlobal.ContainerLocalRenderInformation)iterator1.next(); + Chunk chunk = this.theWorld.getChunkFromBlockCoords(renderglobal$containerlocalrenderinformation.renderChunk.getPosition()); + ClassInheritanceMultiMap classinheritancemultimap = chunk.getEntityLists()[renderglobal$containerlocalrenderinformation.renderChunk.getPosition().getY() / 16]; + + if (!classinheritancemultimap.isEmpty()) + { + Iterator iterator = classinheritancemultimap.iterator(); + + while (true) + { + Entity entity2; + boolean flag5; + + while (true) + { + if (!iterator.hasNext()) + { + continue label920; + } + + entity2 = (Entity)iterator.next(); + + if (!flag || Reflector.callBoolean(entity2, Reflector.ForgeEntity_shouldRenderInPass, new Object[] {Integer.valueOf(i)})) + { + flag5 = this.renderManager.shouldRender(entity2, camera, d0, d1, d2) || entity2.riddenByEntity == this.mc.thePlayer; + + if (!flag5) + { + break; + } + + boolean flag6 = this.mc.getRenderViewEntity() instanceof EntityLivingBase ? ((EntityLivingBase)this.mc.getRenderViewEntity()).isPlayerSleeping() : false; + + if ((entity2 != this.mc.getRenderViewEntity() || this.mc.gameSettings.thirdPersonView != 0 || flag6) && (entity2.posY < 0.0D || entity2.posY >= 256.0D || this.theWorld.isBlockLoaded(new BlockPos(entity2)))) + { + ++this.countEntitiesRendered; + + if (entity2.getClass() == EntityItemFrame.class) + { + entity2.renderDistanceWeight = 0.06D; + } + + this.renderedEntity = entity2; + + if (flag7) + { + Shaders.nextEntity(entity2); + } + + this.renderManager.renderEntitySimple(entity2, partialTicks); + this.renderedEntity = null; + break; + } + } + } + + if (!flag5 && entity2 instanceof EntityWitherSkull) + { + if (flag7) + { + Shaders.nextEntity(entity2); + } + + this.mc.getRenderManager().renderWitherSkull(entity2, partialTicks); + } + } + } + } + + this.mc.gameSettings.fancyGraphics = flag4; + FontRenderer fontrenderer = TileEntityRendererDispatcher.instance.getFontRenderer(); + + if (flag7) + { + Shaders.endEntities(); + Shaders.beginBlockEntities(); + } + + this.theWorld.theProfiler.endStartSection("blockentities"); + RenderHelper.enableStandardItemLighting(); + + if (Reflector.ForgeTileEntityRendererDispatcher_preDrawBatch.exists()) + { + Reflector.call(TileEntityRendererDispatcher.instance, Reflector.ForgeTileEntityRendererDispatcher_preDrawBatch, new Object[0]); + } + + label1385: + + for (Object renderglobal$containerlocalrenderinformation10 : this.renderInfosTileEntities) + { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 = (RenderGlobal.ContainerLocalRenderInformation) renderglobal$containerlocalrenderinformation10; + List list1 = renderglobal$containerlocalrenderinformation1.renderChunk.getCompiledChunk() + .getTileEntities(); + + if (!list1.isEmpty()) + { + Iterator iterator2 = list1.iterator(); + + while (true) + { + TileEntity tileentity; + + while (true) + { + if (!iterator2.hasNext()) + { + continue label1385; + } + + tileentity = (TileEntity)iterator2.next(); + + if (!flag1) + { + break; + } + + if (Reflector.callBoolean(tileentity, Reflector.ForgeTileEntity_shouldRenderInPass, new Object[] {Integer.valueOf(i)})) + { + AxisAlignedBB axisalignedbb = (AxisAlignedBB)Reflector.call(tileentity, Reflector.ForgeTileEntity_getRenderBoundingBox, new Object[0]); + + if (axisalignedbb == null || camera.isBoundingBoxInFrustum(axisalignedbb)) + { + break; + } + } + } + + Class oclass = tileentity.getClass(); + + if (oclass == TileEntitySign.class && !Config.zoomMode) + { + EntityPlayer entityplayer = this.mc.thePlayer; + double d6 = tileentity.getDistanceSq(entityplayer.posX, entityplayer.posY, entityplayer.posZ); + + if (d6 > 256.0D) + { + fontrenderer.enabled = false; + } + } + + if (flag7) + { + Shaders.nextBlockEntity(tileentity); + } + + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); + ++this.countTileEntitiesRendered; + fontrenderer.enabled = true; + } + } + } + + Set var32 = this.field_181024_n; + + synchronized (this.field_181024_n) + { + for (Object tileentity1 : this.field_181024_n) + { + if (flag1) + { + if (!Reflector.callBoolean(tileentity1, Reflector.ForgeTileEntity_shouldRenderInPass, new Object[] {Integer.valueOf(i)})) + { + continue; + } + AxisAlignedBB axisalignedbb1 = (AxisAlignedBB)Reflector.call(tileentity1, Reflector.ForgeTileEntity_getRenderBoundingBox, new Object[0]); + + if (axisalignedbb1 != null && !camera.isBoundingBoxInFrustum(axisalignedbb1)) + { + continue; + } + } + + Class oclass1 = tileentity1.getClass(); + + if (oclass1 == TileEntitySign.class && !Config.zoomMode) + { + EntityPlayer entityplayer1 = this.mc.thePlayer; + double d7 = ((TileEntity) tileentity1).getDistanceSq(entityplayer1.posX, entityplayer1.posY, entityplayer1.posZ); + + if (d7 > 256.0D) + { + fontrenderer.enabled = false; + } + } + + if (flag7) + { + Shaders.nextBlockEntity((TileEntity) tileentity1); + } + + TileEntityRendererDispatcher.instance.renderTileEntity((TileEntity) tileentity1, partialTicks, -1); + fontrenderer.enabled = true; + } + } + + if (Reflector.ForgeTileEntityRendererDispatcher_drawBatch.exists()) + { + Reflector.call(TileEntityRendererDispatcher.instance, Reflector.ForgeTileEntityRendererDispatcher_drawBatch, new Object[] {Integer.valueOf(i)}); + } + + this.preRenderDamagedBlocks(); + + for (Object destroyblockprogress : this.damagedBlocks.values()) + { + BlockPos blockpos = ((DestroyBlockProgress) destroyblockprogress).getPosition(); + TileEntity tileentity2 = this.theWorld.getTileEntity(blockpos); + + if (tileentity2 instanceof TileEntityChest) + { + TileEntityChest tileentitychest = (TileEntityChest)tileentity2; + + if (tileentitychest.adjacentChestXNeg != null) + { + blockpos = blockpos.offset(EnumFacing.WEST); + tileentity2 = this.theWorld.getTileEntity(blockpos); + } + else if (tileentitychest.adjacentChestZNeg != null) + { + blockpos = blockpos.offset(EnumFacing.NORTH); + tileentity2 = this.theWorld.getTileEntity(blockpos); + } + } + + Block block = this.theWorld.getBlockState(blockpos).getBlock(); + boolean flag8; + + if (flag1) + { + flag8 = false; + + if (tileentity2 != null && Reflector.callBoolean(tileentity2, Reflector.ForgeTileEntity_shouldRenderInPass, new Object[] {Integer.valueOf(i)}) && Reflector.callBoolean(tileentity2, Reflector.ForgeTileEntity_canRenderBreaking, new Object[0])) + { + AxisAlignedBB axisalignedbb2 = (AxisAlignedBB)Reflector.call(tileentity2, Reflector.ForgeTileEntity_getRenderBoundingBox, new Object[0]); + + if (axisalignedbb2 != null) + { + flag8 = camera.isBoundingBoxInFrustum(axisalignedbb2); + } + } + } + else + { + flag8 = tileentity2 != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull); + } + + if (flag8) + { + if (flag7) + { + Shaders.nextBlockEntity(tileentity2); + } + + TileEntityRendererDispatcher.instance.renderTileEntity(tileentity2, partialTicks, ((DestroyBlockProgress) destroyblockprogress).getPartialBlockDamage()); + } + } + + this.postRenderDamagedBlocks(); + this.mc.entityRenderer.disableLightmap(); + this.mc.mcProfiler.endSection(); + } + } + + /** + * Gets the render info for use on the Debug screen + */ + public String getDebugInfoRenders() + { + int i = this.viewFrustum.renderChunks.length; + int j = 0; + + for (Object renderglobal$containerlocalrenderinformation0 : this.renderInfos) + { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation = (RenderGlobal.ContainerLocalRenderInformation) renderglobal$containerlocalrenderinformation0; + CompiledChunk compiledchunk = renderglobal$containerlocalrenderinformation.renderChunk.compiledChunk; + + if (compiledchunk != CompiledChunk.DUMMY && !compiledchunk.isEmpty()) + { + ++j; + } + } + + return String.format("C: %d/%d %sD: %d, %s", new Object[] {Integer.valueOf(j), Integer.valueOf(i), this.mc.renderChunksMany ? "(s) " : "", Integer.valueOf(this.renderDistanceChunks), this.renderDispatcher.getDebugInfo()}); + } + + /** + * Gets the entities info for use on the Debug screen + */ + public String getDebugInfoEntities() + { + return "E: " + this.countEntitiesRendered + "/" + this.countEntitiesTotal + ", B: " + this.countEntitiesHidden + ", I: " + (this.countEntitiesTotal - this.countEntitiesHidden - this.countEntitiesRendered) + ", " + Config.getVersionDebug(); + } + + public void setupTerrain(Entity viewEntity, double partialTicks, ICamera camera, int frameCount, boolean playerSpectator) + { + if (this.mc.gameSettings.renderDistanceChunks != this.renderDistanceChunks) + { + this.loadRenderers(); + } + + this.theWorld.theProfiler.startSection("camera"); + double d0 = viewEntity.posX - this.frustumUpdatePosX; + double d1 = viewEntity.posY - this.frustumUpdatePosY; + double d2 = viewEntity.posZ - this.frustumUpdatePosZ; + + if (this.frustumUpdatePosChunkX != viewEntity.chunkCoordX || this.frustumUpdatePosChunkY != viewEntity.chunkCoordY || this.frustumUpdatePosChunkZ != viewEntity.chunkCoordZ || d0 * d0 + d1 * d1 + d2 * d2 > 16.0D) + { + this.frustumUpdatePosX = viewEntity.posX; + this.frustumUpdatePosY = viewEntity.posY; + this.frustumUpdatePosZ = viewEntity.posZ; + this.frustumUpdatePosChunkX = viewEntity.chunkCoordX; + this.frustumUpdatePosChunkY = viewEntity.chunkCoordY; + this.frustumUpdatePosChunkZ = viewEntity.chunkCoordZ; + this.viewFrustum.updateChunkPositions(viewEntity.posX, viewEntity.posZ); + } + + if (Config.isDynamicLights()) + { + DynamicLights.update(this); + } + + this.theWorld.theProfiler.endStartSection("renderlistcamera"); + double d3 = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * partialTicks; + double d4 = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks; + double d5 = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks; + this.renderContainer.initialize(d3, d4, d5); + this.theWorld.theProfiler.endStartSection("cull"); + + if (this.debugFixedClippingHelper != null) + { + Frustum frustum = new Frustum(this.debugFixedClippingHelper); + frustum.setPosition(this.debugTerrainFrustumPosition.field_181059_a, this.debugTerrainFrustumPosition.field_181060_b, this.debugTerrainFrustumPosition.field_181061_c); + camera = frustum; + } + + this.mc.mcProfiler.endStartSection("culling"); + BlockPos blockpos2 = new BlockPos(d3, d4 + (double)viewEntity.getEyeHeight(), d5); + RenderChunk renderchunk = this.viewFrustum.getRenderChunk(blockpos2); + BlockPos blockpos = new BlockPos(MathHelper.floor_double(d3 / 16.0D) * 16, MathHelper.floor_double(d4 / 16.0D) * 16, MathHelper.floor_double(d5 / 16.0D) * 16); + this.displayListEntitiesDirty = this.displayListEntitiesDirty || !this.chunksToUpdate.isEmpty() || viewEntity.posX != this.lastViewEntityX || viewEntity.posY != this.lastViewEntityY || viewEntity.posZ != this.lastViewEntityZ || (double)viewEntity.rotationPitch != this.lastViewEntityPitch || (double)viewEntity.rotationYaw != this.lastViewEntityYaw; + this.lastViewEntityX = viewEntity.posX; + this.lastViewEntityY = viewEntity.posY; + this.lastViewEntityZ = viewEntity.posZ; + this.lastViewEntityPitch = (double)viewEntity.rotationPitch; + this.lastViewEntityYaw = (double)viewEntity.rotationYaw; + boolean flag = this.debugFixedClippingHelper != null; + Lagometer.timerVisibility.start(); + + if (Shaders.isShadowPass) + { + this.renderInfos = this.renderInfosShadow; + this.renderInfosEntities = this.renderInfosEntitiesShadow; + this.renderInfosTileEntities = this.renderInfosTileEntitiesShadow; + + if (!flag && this.displayListEntitiesDirty) + { + this.renderInfos.clear(); + this.renderInfosEntities.clear(); + this.renderInfosTileEntities.clear(); + RenderInfoLazy renderinfolazy = new RenderInfoLazy(); + Iterator iterator = ShadowUtils.makeShadowChunkIterator(this.theWorld, partialTicks, viewEntity, this.renderDistanceChunks, this.viewFrustum); + + while (iterator.hasNext()) + { + RenderChunk renderchunk1 = (RenderChunk)iterator.next(); + + if (renderchunk1 != null) + { + renderinfolazy.setRenderChunk(renderchunk1); + + if (!renderchunk1.compiledChunk.isEmpty() || renderchunk1.isNeedsUpdate()) + { + this.renderInfos.add(renderinfolazy.getRenderInfo()); + } + + BlockPos blockpos1 = renderchunk1.getPosition(); + + if (ChunkUtils.hasEntities(this.theWorld.getChunkFromBlockCoords(blockpos1))) + { + this.renderInfosEntities.add(renderinfolazy.getRenderInfo()); + } + + if (renderchunk1.getCompiledChunk().getTileEntities().size() > 0) + { + this.renderInfosTileEntities.add(renderinfolazy.getRenderInfo()); + } + } + } + } + } + else + { + this.renderInfos = this.renderInfosNormal; + this.renderInfosEntities = this.renderInfosEntitiesNormal; + this.renderInfosTileEntities = this.renderInfosTileEntitiesNormal; + } + + if (!flag && this.displayListEntitiesDirty && !Shaders.isShadowPass) + { + this.displayListEntitiesDirty = false; + this.renderInfos.clear(); + this.renderInfosEntities.clear(); + this.renderInfosTileEntities.clear(); + this.visibilityDeque.clear(); + Deque deque = this.visibilityDeque; + boolean flag1 = this.mc.renderChunksMany; + + if (renderchunk != null) + { + boolean flag2 = false; + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation3 = new RenderGlobal.ContainerLocalRenderInformation(renderchunk, (EnumFacing)null, 0, (Object)null); + Set set1 = SET_ALL_FACINGS; + + if (set1.size() == 1) + { + Vector3f vector3f = this.getViewVector(viewEntity, partialTicks); + EnumFacing enumfacing = EnumFacing.getFacingFromVector(vector3f.x, vector3f.y, vector3f.z).getOpposite(); + set1.remove(enumfacing); + } + + if (set1.isEmpty()) + { + flag2 = true; + } + + if (flag2 && !playerSpectator) + { + this.renderInfos.add(renderglobal$containerlocalrenderinformation3); + } + else + { + if (playerSpectator && this.theWorld.getBlockState(blockpos2).getBlock().isOpaqueCube()) + { + flag1 = false; + } + + renderchunk.setFrameIndex(frameCount); + deque.add(renderglobal$containerlocalrenderinformation3); + } + } + else + { + int i = blockpos2.getY() > 0 ? 248 : 8; + + for (int j = -this.renderDistanceChunks; j <= this.renderDistanceChunks; ++j) + { + for (int k = -this.renderDistanceChunks; k <= this.renderDistanceChunks; ++k) + { + RenderChunk renderchunk2 = this.viewFrustum.getRenderChunk(new BlockPos((j << 4) + 8, i, (k << 4) + 8)); + + if (renderchunk2 != null && ((ICamera)camera).isBoundingBoxInFrustum(renderchunk2.boundingBox)) + { + renderchunk2.setFrameIndex(frameCount); + deque.add(new RenderGlobal.ContainerLocalRenderInformation(renderchunk2, (EnumFacing)null, 0, (Object)null)); + } + } + } + } + + EnumFacing[] aenumfacing = EnumFacing.VALUES; + int l = aenumfacing.length; + + while (!deque.isEmpty()) + { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 = (RenderGlobal.ContainerLocalRenderInformation)deque.poll(); + RenderChunk renderchunk4 = renderglobal$containerlocalrenderinformation1.renderChunk; + EnumFacing enumfacing2 = renderglobal$containerlocalrenderinformation1.facing; + BlockPos blockpos3 = renderchunk4.getPosition(); + + if (!renderchunk4.compiledChunk.isEmpty() || renderchunk4.isNeedsUpdate()) + { + this.renderInfos.add(renderglobal$containerlocalrenderinformation1); + } + + if (ChunkUtils.hasEntities(this.theWorld.getChunkFromBlockCoords(blockpos3))) + { + this.renderInfosEntities.add(renderglobal$containerlocalrenderinformation1); + } + + if (renderchunk4.getCompiledChunk().getTileEntities().size() > 0) + { + this.renderInfosTileEntities.add(renderglobal$containerlocalrenderinformation1); + } + + for (int i1 = 0; i1 < l; ++i1) + { + EnumFacing enumfacing1 = aenumfacing[i1]; + + if ((!flag1 || !renderglobal$containerlocalrenderinformation1.setFacing.contains(enumfacing1.getOpposite())) && (!flag1 || enumfacing2 == null || renderchunk4.getCompiledChunk().isVisible(enumfacing2.getOpposite(), enumfacing1))) + { + RenderChunk renderchunk3 = this.func_181562_a(blockpos2, renderchunk4, enumfacing1); + + if (renderchunk3 != null && renderchunk3.setFrameIndex(frameCount) && ((ICamera)camera).isBoundingBoxInFrustum(renderchunk3.boundingBox)) + { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation = new RenderGlobal.ContainerLocalRenderInformation(renderchunk3, enumfacing1, renderglobal$containerlocalrenderinformation1.counter + 1, (Object)null); + renderglobal$containerlocalrenderinformation.setFacing.addAll(renderglobal$containerlocalrenderinformation1.setFacing); + renderglobal$containerlocalrenderinformation.setFacing.add(enumfacing1); + deque.add(renderglobal$containerlocalrenderinformation); + } + } + } + } + } + + if (this.debugFixTerrainFrustum) + { + this.fixTerrainFrustum(d3, d4, d5); + this.debugFixTerrainFrustum = false; + } + + Lagometer.timerVisibility.end(); + + if (Shaders.isShadowPass) + { + Shaders.mcProfilerEndSection(); + } + else + { + this.renderDispatcher.clearChunkUpdates(); + Set set = this.chunksToUpdate; + this.chunksToUpdate = Sets.newLinkedHashSet(); + Iterator iterator1 = this.renderInfos.iterator(); + Lagometer.timerChunkUpdate.start(); + + while (iterator1.hasNext()) + { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation2 = (RenderGlobal.ContainerLocalRenderInformation)iterator1.next(); + RenderChunk renderchunk5 = renderglobal$containerlocalrenderinformation2.renderChunk; + + if (renderchunk5.isNeedsUpdate() || set.contains(renderchunk5)) + { + this.displayListEntitiesDirty = true; + + if (this.isPositionInRenderChunk(blockpos, renderglobal$containerlocalrenderinformation2.renderChunk)) + { + if (!renderchunk5.isPlayerUpdate()) + { + this.chunksToUpdateForced.add(renderchunk5); + } + else + { + this.mc.mcProfiler.startSection("build near"); + this.renderDispatcher.updateChunkNow(renderchunk5); + renderchunk5.setNeedsUpdate(false); + this.mc.mcProfiler.endSection(); + } + } + else + { + this.chunksToUpdate.add(renderchunk5); + } + } + } + + Lagometer.timerChunkUpdate.end(); + this.chunksToUpdate.addAll(set); + this.mc.mcProfiler.endSection(); + } + } + + private boolean isPositionInRenderChunk(BlockPos pos, RenderChunk renderChunkIn) + { + BlockPos blockpos = renderChunkIn.getPosition(); + return MathHelper.abs_int(pos.getX() - blockpos.getX()) > 16 ? false : (MathHelper.abs_int(pos.getY() - blockpos.getY()) > 16 ? false : MathHelper.abs_int(pos.getZ() - blockpos.getZ()) <= 16); + } + + private Set getVisibleFacings(BlockPos pos) + { + VisGraph visgraph = new VisGraph(); + BlockPos blockpos = new BlockPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4); + Chunk chunk = this.theWorld.getChunkFromBlockCoords(blockpos); + + for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(blockpos, blockpos.add(15, 15, 15))) + { + if (chunk.getBlock(blockpos$mutableblockpos).isOpaqueCube()) + { + visgraph.func_178606_a(blockpos$mutableblockpos); + } + } + return visgraph.func_178609_b(pos); + } + + private RenderChunk func_181562_a(BlockPos p_181562_1_, RenderChunk p_181562_2_, EnumFacing p_181562_3_) + { + BlockPos blockpos = p_181562_2_.getPositionOffset16(p_181562_3_); + + if (blockpos.getY() >= 0 && blockpos.getY() < 256) + { + int i = MathHelper.abs_int(p_181562_1_.getX() - blockpos.getX()); + int j = MathHelper.abs_int(p_181562_1_.getZ() - blockpos.getZ()); + + if (Config.isFogOff()) + { + if (i > this.renderDistance || j > this.renderDistance) + { + return null; + } + } + else + { + int k = i * i + j * j; + + if (k > this.renderDistanceSq) + { + return null; + } + } + + return this.viewFrustum.getRenderChunk(blockpos); + } + else + { + return null; + } + } + + private void fixTerrainFrustum(double x, double y, double z) + { + this.debugFixedClippingHelper = new ClippingHelperImpl(); + ((ClippingHelperImpl)this.debugFixedClippingHelper).init(); + Matrix4f matrix4f = new Matrix4f(this.debugFixedClippingHelper.modelviewMatrix); + matrix4f.transpose(); + Matrix4f matrix4f1 = new Matrix4f(this.debugFixedClippingHelper.projectionMatrix); + matrix4f1.transpose(); + Matrix4f matrix4f2 = new Matrix4f(); + Matrix4f.mul(matrix4f1, matrix4f, matrix4f2); + matrix4f2.invert(); + this.debugTerrainFrustumPosition.field_181059_a = x; + this.debugTerrainFrustumPosition.field_181060_b = y; + this.debugTerrainFrustumPosition.field_181061_c = z; + this.debugTerrainMatrix[0] = new Vector4f(-1.0F, -1.0F, -1.0F, 1.0F); + this.debugTerrainMatrix[1] = new Vector4f(1.0F, -1.0F, -1.0F, 1.0F); + this.debugTerrainMatrix[2] = new Vector4f(1.0F, 1.0F, -1.0F, 1.0F); + this.debugTerrainMatrix[3] = new Vector4f(-1.0F, 1.0F, -1.0F, 1.0F); + this.debugTerrainMatrix[4] = new Vector4f(-1.0F, -1.0F, 1.0F, 1.0F); + this.debugTerrainMatrix[5] = new Vector4f(1.0F, -1.0F, 1.0F, 1.0F); + this.debugTerrainMatrix[6] = new Vector4f(1.0F, 1.0F, 1.0F, 1.0F); + this.debugTerrainMatrix[7] = new Vector4f(-1.0F, 1.0F, 1.0F, 1.0F); + + for (int i = 0; i < 8; ++i) + { + Matrix4f.transform(matrix4f2, this.debugTerrainMatrix[i], this.debugTerrainMatrix[i]); + this.debugTerrainMatrix[i].x /= this.debugTerrainMatrix[i].w; + this.debugTerrainMatrix[i].y /= this.debugTerrainMatrix[i].w; + this.debugTerrainMatrix[i].z /= this.debugTerrainMatrix[i].w; + this.debugTerrainMatrix[i].w = 1.0F; + } + } + + protected Vector3f getViewVector(Entity entityIn, double partialTicks) + { + float f = (float)((double)entityIn.prevRotationPitch + (double)(entityIn.rotationPitch - entityIn.prevRotationPitch) * partialTicks); + float f1 = (float)((double)entityIn.prevRotationYaw + (double)(entityIn.rotationYaw - entityIn.prevRotationYaw) * partialTicks); + + if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 2) + { + f += 180.0F; + } + + float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI); + float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI); + float f4 = -MathHelper.cos(-f * 0.017453292F); + float f5 = MathHelper.sin(-f * 0.017453292F); + return new Vector3f(f3 * f4, f5, f2 * f4); + } + + public int renderBlockLayer(EnumWorldBlockLayer blockLayerIn, double partialTicks, int pass, Entity entityIn) + { + RenderHelper.disableStandardItemLighting(); + + if (blockLayerIn == EnumWorldBlockLayer.TRANSLUCENT) + { + this.mc.mcProfiler.startSection("translucent_sort"); + double d0 = entityIn.posX - this.prevRenderSortX; + double d1 = entityIn.posY - this.prevRenderSortY; + double d2 = entityIn.posZ - this.prevRenderSortZ; + + if (d0 * d0 + d1 * d1 + d2 * d2 > 1.0D) + { + this.prevRenderSortX = entityIn.posX; + this.prevRenderSortY = entityIn.posY; + this.prevRenderSortZ = entityIn.posZ; + int k = 0; + Iterator iterator = this.renderInfos.iterator(); + this.chunksToResortTransparency.clear(); + + while (iterator.hasNext()) + { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation = (RenderGlobal.ContainerLocalRenderInformation)iterator.next(); + + if (renderglobal$containerlocalrenderinformation.renderChunk.compiledChunk.isLayerStarted(blockLayerIn) && k++ < 15) + { + this.chunksToResortTransparency.add(renderglobal$containerlocalrenderinformation.renderChunk); + } + } + } + + this.mc.mcProfiler.endSection(); + } + + this.mc.mcProfiler.startSection("filterempty"); + int l = 0; + boolean flag = blockLayerIn == EnumWorldBlockLayer.TRANSLUCENT; + int i1 = flag ? this.renderInfos.size() - 1 : 0; + int i = flag ? -1 : this.renderInfos.size(); + int j1 = flag ? -1 : 1; + + for (int j = i1; j != i; j += j1) + { + RenderChunk renderchunk = ((RenderGlobal.ContainerLocalRenderInformation)this.renderInfos.get(j)).renderChunk; + + if (!renderchunk.getCompiledChunk().isLayerEmpty(blockLayerIn)) + { + ++l; + this.renderContainer.addRenderChunk(renderchunk, blockLayerIn); + } + } + + if (l == 0) + { + this.mc.mcProfiler.endSection(); + return l; + } + else + { + if (Config.isFogOff() && this.mc.entityRenderer.fogStandard) + { + GlStateManager.disableFog(); + } + + this.mc.mcProfiler.endStartSection("render_" + blockLayerIn); + this.renderBlockLayer(blockLayerIn); + this.mc.mcProfiler.endSection(); + return l; + } + } + + @SuppressWarnings("incomplete-switch") + private void renderBlockLayer(EnumWorldBlockLayer blockLayerIn) + { + this.mc.entityRenderer.enableLightmap(); + + if (OpenGlHelper.useVbo()) + { + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); + } + + if (Config.isShaders()) + { + ShadersRender.preRenderChunkLayer(blockLayerIn); + } + + this.renderContainer.renderChunkLayer(blockLayerIn); + + if (Config.isShaders()) + { + ShadersRender.postRenderChunkLayer(blockLayerIn); + } + + if (OpenGlHelper.useVbo()) + { + for (VertexFormatElement vertexformatelement : DefaultVertexFormats.BLOCK.getElements()) + { + VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage(); + int i = vertexformatelement.getIndex(); + + switch (RenderGlobal.RenderGlobal$2.field_178037_a[vertexformatelement$enumusage.ordinal()]) + { + case 1: + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + break; + + case 2: + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + i); + GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + break; + + case 3: + GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); + GlStateManager.resetColor(); + } + } + } + + this.mc.entityRenderer.disableLightmap(); + } + + private void cleanupDamagedBlocks(Iterator iteratorIn) + { + while (iteratorIn.hasNext()) + { + DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iteratorIn.next(); + int i = destroyblockprogress.getCreationCloudUpdateTick(); + + if (this.cloudTickCounter - i > 400) + { + iteratorIn.remove(); + } + } + } + + public void updateClouds() + { + if (Config.isShaders() && Keyboard.isKeyDown(61) && Keyboard.isKeyDown(19)) + { + Shaders.uninit(); + Shaders.loadShaderPack(); + } + + ++this.cloudTickCounter; + + if (this.cloudTickCounter % 20 == 0) + { + this.cleanupDamagedBlocks(this.damagedBlocks.values().iterator()); + } + } + + private void renderSkyEnd() + { + if (Config.isSkyEnabled()) + { + GlStateManager.disableFog(); + GlStateManager.disableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + RenderHelper.disableStandardItemLighting(); + GlStateManager.depthMask(false); + this.renderEngine.bindTexture(locationEndSkyPng); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + + for (int i = 0; i < 6; ++i) + { + GlStateManager.pushMatrix(); + + if (i == 1) + { + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + } + + if (i == 2) + { + GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); + } + + if (i == 3) + { + GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); + } + + if (i == 4) + { + GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); + } + + if (i == 5) + { + GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F); + } + + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos(-100.0D, -100.0D, -100.0D).tex(0.0D, 0.0D).color(40, 40, 40, 255).endVertex(); + worldrenderer.pos(-100.0D, -100.0D, 100.0D).tex(0.0D, 16.0D).color(40, 40, 40, 255).endVertex(); + worldrenderer.pos(100.0D, -100.0D, 100.0D).tex(16.0D, 16.0D).color(40, 40, 40, 255).endVertex(); + worldrenderer.pos(100.0D, -100.0D, -100.0D).tex(16.0D, 0.0D).color(40, 40, 40, 255).endVertex(); + tessellator.draw(); + GlStateManager.popMatrix(); + } + + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.enableAlpha(); + } + } + + public void renderSky(float partialTicks, int pass) + { + if (Reflector.ForgeWorldProvider_getSkyRenderer.exists()) + { + WorldProvider worldprovider = this.mc.theWorld.provider; + Object object = Reflector.call(worldprovider, Reflector.ForgeWorldProvider_getSkyRenderer, new Object[0]); + + if (object != null) + { + Reflector.callVoid(object, Reflector.IRenderHandler_render, new Object[] {Float.valueOf(partialTicks), this.theWorld, this.mc}); + return; + } + } + + if (this.mc.theWorld.provider.getDimensionId() == 1) + { + this.renderSkyEnd(); + } + else if (this.mc.theWorld.provider.isSurfaceWorld()) + { + GlStateManager.disableTexture2D(); + boolean flag1 = Config.isShaders(); + + if (flag1) + { + Shaders.disableTexture2D(); + } + + Vec3 vec3 = this.theWorld.getSkyColor(this.mc.getRenderViewEntity(), partialTicks); + vec3 = CustomColors.getSkyColor(vec3, this.mc.theWorld, this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().posY + 1.0D, this.mc.getRenderViewEntity().posZ); + + if (flag1) + { + Shaders.setSkyColor(vec3); + } + + float f = (float)vec3.xCoord; + float f1 = (float)vec3.yCoord; + float f2 = (float)vec3.zCoord; + + if (pass != 2) + { + float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F; + float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F; + float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F; + f = f3; + f1 = f4; + f2 = f5; + } + + GlStateManager.color(f, f1, f2); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.depthMask(false); + GlStateManager.enableFog(); + + if (flag1) + { + Shaders.enableFog(); + } + + GlStateManager.color(f, f1, f2); + + if (flag1) + { + Shaders.preSkyList(); + } + + if (Config.isSkyEnabled()) + { + if (this.vboEnabled) + { + this.skyVBO.bindBuffer(); + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + GL11.glVertexPointer(3, GL11.GL_FLOAT, 12, 0L); + this.skyVBO.drawArrays(7); + this.skyVBO.unbindBuffer(); + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + } + else + { + GlStateManager.callList(this.glSkyList); + } + } + + GlStateManager.disableFog(); + + if (flag1) + { + Shaders.disableFog(); + } + + GlStateManager.disableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + RenderHelper.disableStandardItemLighting(); + float[] afloat = this.theWorld.provider.calcSunriseSunsetColors(this.theWorld.getCelestialAngle(partialTicks), partialTicks); + + if (afloat != null && Config.isSunMoonEnabled()) + { + GlStateManager.disableTexture2D(); + + if (flag1) + { + Shaders.disableTexture2D(); + } + + GlStateManager.shadeModel(7425); + GlStateManager.pushMatrix(); + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(MathHelper.sin(this.theWorld.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); + float f6 = afloat[0]; + float f7 = afloat[1]; + float f8 = afloat[2]; + + if (pass != 2) + { + float f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F; + float f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F; + float f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F; + f6 = f9; + f7 = f10; + f8 = f11; + } + + worldrenderer.begin(6, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos(0.0D, 100.0D, 0.0D).color(f6, f7, f8, afloat[3]).endVertex(); + boolean flag = true; + + for (int i = 0; i <= 16; ++i) + { + float f20 = (float)i * (float)Math.PI * 2.0F / 16.0F; + float f12 = MathHelper.sin(f20); + float f13 = MathHelper.cos(f20); + worldrenderer.pos((double)(f12 * 120.0F), (double)(f13 * 120.0F), (double)(-f13 * 40.0F * afloat[3])).color(afloat[0], afloat[1], afloat[2], 0.0F).endVertex(); + } + + tessellator.draw(); + GlStateManager.popMatrix(); + GlStateManager.shadeModel(7424); + } + + GlStateManager.enableTexture2D(); + + if (flag1) + { + Shaders.enableTexture2D(); + } + + GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0); + GlStateManager.pushMatrix(); + float f15 = 1.0F - this.theWorld.getRainStrength(partialTicks); + GlStateManager.color(1.0F, 1.0F, 1.0F, f15); + GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); + CustomSky.renderSky(this.theWorld, this.renderEngine, this.theWorld.getCelestialAngle(partialTicks), f15); + + if (flag1) + { + Shaders.preCelestialRotate(); + } + + GlStateManager.rotate(this.theWorld.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); + + if (flag1) + { + Shaders.postCelestialRotate(); + } + + float f16 = 30.0F; + + if (Config.isSunTexture()) + { + this.renderEngine.bindTexture(locationSunPng); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((double)(-f16), 100.0D, (double)(-f16)).tex(0.0D, 0.0D).endVertex(); + worldrenderer.pos((double)f16, 100.0D, (double)(-f16)).tex(1.0D, 0.0D).endVertex(); + worldrenderer.pos((double)f16, 100.0D, (double)f16).tex(1.0D, 1.0D).endVertex(); + worldrenderer.pos((double)(-f16), 100.0D, (double)f16).tex(0.0D, 1.0D).endVertex(); + tessellator.draw(); + } + + f16 = 20.0F; + + if (Config.isMoonTexture()) + { + this.renderEngine.bindTexture(locationMoonPhasesPng); + int l = this.theWorld.getMoonPhase(); + int j = l % 4; + int k = l / 4 % 2; + float f21 = (float)(j + 0) / 4.0F; + float f22 = (float)(k + 0) / 2.0F; + float f23 = (float)(j + 1) / 4.0F; + float f14 = (float)(k + 1) / 2.0F; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos((double)(-f16), -100.0D, (double)f16).tex((double)f23, (double)f14).endVertex(); + worldrenderer.pos((double)f16, -100.0D, (double)f16).tex((double)f21, (double)f14).endVertex(); + worldrenderer.pos((double)f16, -100.0D, (double)(-f16)).tex((double)f21, (double)f22).endVertex(); + worldrenderer.pos((double)(-f16), -100.0D, (double)(-f16)).tex((double)f23, (double)f22).endVertex(); + tessellator.draw(); + } + + GlStateManager.disableTexture2D(); + + if (flag1) + { + Shaders.disableTexture2D(); + } + + float f24 = this.theWorld.getStarBrightness(partialTicks) * f15; + + if (f24 > 0.0F && Config.isStarsEnabled() && !CustomSky.hasSkyLayers(this.theWorld)) + { + GlStateManager.color(f24, f24, f24, f24); + + if (this.vboEnabled) + { + this.starVBO.bindBuffer(); + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + GL11.glVertexPointer(3, GL11.GL_FLOAT, 12, 0L); + this.starVBO.drawArrays(7); + this.starVBO.unbindBuffer(); + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + } + else + { + GlStateManager.callList(this.starGLCallList); + } + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.enableFog(); + + if (flag1) + { + Shaders.enableFog(); + } + + GlStateManager.popMatrix(); + GlStateManager.disableTexture2D(); + + if (flag1) + { + Shaders.disableTexture2D(); + } + + GlStateManager.color(0.0F, 0.0F, 0.0F); + double d0 = this.mc.thePlayer.getPositionEyes(partialTicks).yCoord - this.theWorld.getHorizon(); + + if (d0 < 0.0D) + { + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 12.0F, 0.0F); + + if (this.vboEnabled) + { + this.sky2VBO.bindBuffer(); + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + GL11.glVertexPointer(3, GL11.GL_FLOAT, 12, 0L); + this.sky2VBO.drawArrays(7); + this.sky2VBO.unbindBuffer(); + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + } + else + { + GlStateManager.callList(this.glSkyList2); + } + + GlStateManager.popMatrix(); + float f17 = 1.0F; + float f18 = -((float)(d0 + 65.0D)); + float f19 = -1.0F; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos(-1.0D, (double)f18, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(1.0D, (double)f18, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(-1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(-1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(1.0D, (double)f18, -1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(-1.0D, (double)f18, -1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(1.0D, (double)f18, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(1.0D, (double)f18, -1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(-1.0D, (double)f18, -1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(-1.0D, (double)f18, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(-1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(-1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(-1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(-1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(1.0D, -1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos(1.0D, -1.0D, -1.0D).color(0, 0, 0, 255).endVertex(); + tessellator.draw(); + } + + if (this.theWorld.provider.isSkyColored()) + { + GlStateManager.color(f * 0.2F + 0.04F, f1 * 0.2F + 0.04F, f2 * 0.6F + 0.1F); + } + else + { + GlStateManager.color(f, f1, f2); + } + + if (this.mc.gameSettings.renderDistanceChunks <= 4) + { + GlStateManager.color(this.mc.entityRenderer.fogColorRed, this.mc.entityRenderer.fogColorGreen, this.mc.entityRenderer.fogColorBlue); + } + + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, -((float)(d0 - 16.0D)), 0.0F); + + if (Config.isSkyEnabled()) + { + GlStateManager.callList(this.glSkyList2); + } + + GlStateManager.popMatrix(); + GlStateManager.enableTexture2D(); + + if (flag1) + { + Shaders.enableTexture2D(); + } + + GlStateManager.depthMask(true); + } + } + + public void renderClouds(float partialTicks, int pass) + { + if (!Config.isCloudsOff()) + { + if (Reflector.ForgeWorldProvider_getCloudRenderer.exists()) + { + WorldProvider worldprovider = this.mc.theWorld.provider; + Object object = Reflector.call(worldprovider, Reflector.ForgeWorldProvider_getCloudRenderer, new Object[0]); + + if (object != null) + { + Reflector.callVoid(object, Reflector.IRenderHandler_render, new Object[] {Float.valueOf(partialTicks), this.theWorld, this.mc}); + return; + } + } + + if (this.mc.theWorld.provider.isSurfaceWorld()) + { + if (Config.isShaders()) + { + Shaders.beginClouds(); + } + + if (Config.isCloudsFancy()) + { + this.renderCloudsFancy(partialTicks, pass); + } + else + { + this.cloudRenderer.prepareToRender(false, this.cloudTickCounter, partialTicks); + partialTicks = 0.0F; + GlStateManager.disableCull(); + float f9 = (float)(this.mc.getRenderViewEntity().lastTickPosY + (this.mc.getRenderViewEntity().posY - this.mc.getRenderViewEntity().lastTickPosY) * (double)partialTicks); + boolean flag = true; + boolean flag1 = true; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.renderEngine.bindTexture(locationCloudsPng); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + + if (this.cloudRenderer.shouldUpdateGlList()) + { + this.cloudRenderer.startUpdateGlList(); + Vec3 vec3 = this.theWorld.getCloudColour(partialTicks); + float f = (float)vec3.xCoord; + float f1 = (float)vec3.yCoord; + float f2 = (float)vec3.zCoord; + + if (pass != 2) + { + float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F; + float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F; + float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F; + f = f3; + f1 = f4; + f2 = f5; + } + + float f10 = 4.8828125E-4F; + double d2 = (double)((float)this.cloudTickCounter + partialTicks); + double d0 = this.mc.getRenderViewEntity().prevPosX + (this.mc.getRenderViewEntity().posX - this.mc.getRenderViewEntity().prevPosX) * (double)partialTicks + d2 * 0.029999999329447746D; + double d1 = this.mc.getRenderViewEntity().prevPosZ + (this.mc.getRenderViewEntity().posZ - this.mc.getRenderViewEntity().prevPosZ) * (double)partialTicks; + int i = MathHelper.floor_double(d0 / 2048.0D); + int j = MathHelper.floor_double(d1 / 2048.0D); + d0 = d0 - (double)(i * 2048); + d1 = d1 - (double)(j * 2048); + float f6 = this.theWorld.provider.getCloudHeight() - f9 + 0.33F; + f6 = f6 + this.mc.gameSettings.ofCloudsHeight * 128.0F; + float f7 = (float)(d0 * 4.8828125E-4D); + float f8 = (float)(d1 * 4.8828125E-4D); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + + for (int k = -256; k < 256; k += 32) + { + for (int l = -256; l < 256; l += 32) + { + worldrenderer.pos((double)(k + 0), (double)f6, (double)(l + 32)).tex((double)((float)(k + 0) * 4.8828125E-4F + f7), (double)((float)(l + 32) * 4.8828125E-4F + f8)).color(f, f1, f2, 0.8F).endVertex(); + worldrenderer.pos((double)(k + 32), (double)f6, (double)(l + 32)).tex((double)((float)(k + 32) * 4.8828125E-4F + f7), (double)((float)(l + 32) * 4.8828125E-4F + f8)).color(f, f1, f2, 0.8F).endVertex(); + worldrenderer.pos((double)(k + 32), (double)f6, (double)(l + 0)).tex((double)((float)(k + 32) * 4.8828125E-4F + f7), (double)((float)(l + 0) * 4.8828125E-4F + f8)).color(f, f1, f2, 0.8F).endVertex(); + worldrenderer.pos((double)(k + 0), (double)f6, (double)(l + 0)).tex((double)((float)(k + 0) * 4.8828125E-4F + f7), (double)((float)(l + 0) * 4.8828125E-4F + f8)).color(f, f1, f2, 0.8F).endVertex(); + } + } + + tessellator.draw(); + this.cloudRenderer.endUpdateGlList(); + } + + this.cloudRenderer.renderGlList(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + GlStateManager.enableCull(); + } + + if (Config.isShaders()) + { + Shaders.endClouds(); + } + } + } + } + + /** + * Checks if the given position is to be rendered with cloud fog + */ + public boolean hasCloudFog(double x, double y, double z, float partialTicks) + { + return false; + } + + private void renderCloudsFancy(float partialTicks, int pass) + { + this.cloudRenderer.prepareToRender(true, this.cloudTickCounter, partialTicks); + partialTicks = 0.0F; + GlStateManager.disableCull(); + float f = (float)(this.mc.getRenderViewEntity().lastTickPosY + (this.mc.getRenderViewEntity().posY - this.mc.getRenderViewEntity().lastTickPosY) * (double)partialTicks); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + float f1 = 12.0F; + float f2 = 4.0F; + double d0 = (double)((float)this.cloudTickCounter + partialTicks); + double d1 = (this.mc.getRenderViewEntity().prevPosX + (this.mc.getRenderViewEntity().posX - this.mc.getRenderViewEntity().prevPosX) * (double)partialTicks + d0 * 0.029999999329447746D) / 12.0D; + double d2 = (this.mc.getRenderViewEntity().prevPosZ + (this.mc.getRenderViewEntity().posZ - this.mc.getRenderViewEntity().prevPosZ) * (double)partialTicks) / 12.0D + 0.33000001311302185D; + float f3 = this.theWorld.provider.getCloudHeight() - f + 0.33F; + f3 = f3 + this.mc.gameSettings.ofCloudsHeight * 128.0F; + int i = MathHelper.floor_double(d1 / 2048.0D); + int j = MathHelper.floor_double(d2 / 2048.0D); + d1 = d1 - (double)(i * 2048); + d2 = d2 - (double)(j * 2048); + this.renderEngine.bindTexture(locationCloudsPng); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + Vec3 vec3 = this.theWorld.getCloudColour(partialTicks); + float f4 = (float)vec3.xCoord; + float f5 = (float)vec3.yCoord; + float f6 = (float)vec3.zCoord; + + if (pass != 2) + { + float f7 = (f4 * 30.0F + f5 * 59.0F + f6 * 11.0F) / 100.0F; + float f8 = (f4 * 30.0F + f5 * 70.0F) / 100.0F; + float f9 = (f4 * 30.0F + f6 * 70.0F) / 100.0F; + f4 = f7; + f5 = f8; + f6 = f9; + } + + float f26 = f4 * 0.9F; + float f27 = f5 * 0.9F; + float f28 = f6 * 0.9F; + float f10 = f4 * 0.7F; + float f11 = f5 * 0.7F; + float f12 = f6 * 0.7F; + float f13 = f4 * 0.8F; + float f14 = f5 * 0.8F; + float f15 = f6 * 0.8F; + float f16 = 0.00390625F; + float f17 = (float)MathHelper.floor_double(d1) * 0.00390625F; + float f18 = (float)MathHelper.floor_double(d2) * 0.00390625F; + float f19 = (float)(d1 - (double)MathHelper.floor_double(d1)); + float f20 = (float)(d2 - (double)MathHelper.floor_double(d2)); + boolean flag = true; + boolean flag1 = true; + float f21 = 9.765625E-4F; + GlStateManager.scale(12.0F, 1.0F, 12.0F); + + for (int k = 0; k < 2; ++k) + { + if (k == 0) + { + GlStateManager.colorMask(false, false, false, false); + } + else + { + switch (pass) + { + case 0: + GlStateManager.colorMask(false, true, true, true); + break; + + case 1: + GlStateManager.colorMask(true, false, false, true); + break; + + case 2: + GlStateManager.colorMask(true, true, true, true); + } + } + + this.cloudRenderer.renderGlList(); + } + + if (this.cloudRenderer.shouldUpdateGlList()) + { + this.cloudRenderer.startUpdateGlList(); + + for (int j1 = -3; j1 <= 4; ++j1) + { + for (int l = -3; l <= 4; ++l) + { + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); + float f22 = (float)(j1 * 8); + float f23 = (float)(l * 8); + float f24 = f22 - f19; + float f25 = f23 - f20; + + if (f3 > -5.0F) + { + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f10, f11, f12, 0.8F).normal(0.0F, -1.0F, 0.0F).endVertex(); + } + + if (f3 <= 5.0F) + { + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 8.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 8.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f4, f5, f6, 0.8F).normal(0.0F, 1.0F, 0.0F).endVertex(); + } + + if (j1 > -1) + { + for (int i1 = 0; i1 < 8; ++i1) + { + worldrenderer.pos((double)(f24 + (float)i1 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)i1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + (float)i1 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)i1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + (float)i1 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)i1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + (float)i1 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)i1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(-1.0F, 0.0F, 0.0F).endVertex(); + } + } + + if (j1 <= 1) + { + for (int k1 = 0; k1 < 8; ++k1) + { + worldrenderer.pos((double)(f24 + (float)k1 + 1.0F - 9.765625E-4F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)k1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + (float)k1 + 1.0F - 9.765625E-4F), (double)(f3 + 4.0F), (double)(f25 + 8.0F)).tex((double)((f22 + (float)k1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + (float)k1 + 1.0F - 9.765625E-4F), (double)(f3 + 4.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)k1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f24 + (float)k1 + 1.0F - 9.765625E-4F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).tex((double)((f22 + (float)k1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).color(f26, f27, f28, 0.8F).normal(1.0F, 0.0F, 0.0F).endVertex(); + } + } + + if (l > -1) + { + for (int l1 = 0; l1 < 8; ++l1) + { + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + (float)l1 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)l1 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F), (double)(f25 + (float)l1 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)l1 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + (float)l1 + 0.0F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)l1 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + (float)l1 + 0.0F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)l1 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, -1.0F).endVertex(); + } + } + + if (l <= 1) + { + for (int i2 = 0; i2 < 8; ++i2) + { + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + (float)i2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)i2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 4.0F), (double)(f25 + (float)i2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)i2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + (float)i2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)i2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + (float)i2 + 1.0F - 9.765625E-4F)).tex((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)i2 + 0.5F) * 0.00390625F + f18)).color(f13, f14, f15, 0.8F).normal(0.0F, 0.0F, 1.0F).endVertex(); + } + } + + tessellator.draw(); + } + } + + this.cloudRenderer.endUpdateGlList(); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + GlStateManager.enableCull(); + } + + public void updateChunks(long finishTimeNano) + { + finishTimeNano = (long)((double)finishTimeNano + 1.0E8D); + this.displayListEntitiesDirty |= this.renderDispatcher.runChunkUploads(finishTimeNano); + + if (this.chunksToUpdateForced.size() > 0) + { + Iterator iterator = this.chunksToUpdateForced.iterator(); + + while (iterator.hasNext()) + { + RenderChunk renderchunk = (RenderChunk)iterator.next(); + + if (!this.renderDispatcher.updateChunkLater(renderchunk)) + { + break; + } + + renderchunk.setNeedsUpdate(false); + iterator.remove(); + this.chunksToUpdate.remove(renderchunk); + this.chunksToResortTransparency.remove(renderchunk); + } + } + + if (this.chunksToResortTransparency.size() > 0) + { + Iterator iterator2 = this.chunksToResortTransparency.iterator(); + + if (iterator2.hasNext()) + { + RenderChunk renderchunk2 = (RenderChunk)iterator2.next(); + + if (this.renderDispatcher.updateTransparencyLater(renderchunk2)) + { + iterator2.remove(); + } + } + } + + int j = 0; + int k = Config.getUpdatesPerFrame(); + int i = k * 2; + Iterator iterator1 = this.chunksToUpdate.iterator(); + + while (iterator1.hasNext()) + { + RenderChunk renderchunk1 = (RenderChunk)iterator1.next(); + + if (!this.renderDispatcher.updateChunkLater(renderchunk1)) + { + break; + } + + renderchunk1.setNeedsUpdate(false); + iterator1.remove(); + + if (renderchunk1.getCompiledChunk().isEmpty() && k < i) + { + ++k; + } + + ++j; + + if (j >= k) + { + break; + } + } + } + + public void renderWorldBorder(Entity p_180449_1_, float partialTicks) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + WorldBorder worldborder = this.theWorld.getWorldBorder(); + double d0 = (double)(this.mc.gameSettings.renderDistanceChunks * 16); + + if (p_180449_1_.posX >= worldborder.maxX() - d0 || p_180449_1_.posX <= worldborder.minX() + d0 || p_180449_1_.posZ >= worldborder.maxZ() - d0 || p_180449_1_.posZ <= worldborder.minZ() + d0) + { + double d1 = 1.0D - worldborder.getClosestDistance(p_180449_1_) / d0; + d1 = Math.pow(d1, 4.0D); + double d2 = p_180449_1_.lastTickPosX + (p_180449_1_.posX - p_180449_1_.lastTickPosX) * (double)partialTicks; + double d3 = p_180449_1_.lastTickPosY + (p_180449_1_.posY - p_180449_1_.lastTickPosY) * (double)partialTicks; + double d4 = p_180449_1_.lastTickPosZ + (p_180449_1_.posZ - p_180449_1_.lastTickPosZ) * (double)partialTicks; + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0); + this.renderEngine.bindTexture(locationForcefieldPng); + GlStateManager.depthMask(false); + GlStateManager.pushMatrix(); + int i = worldborder.getStatus().getID(); + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; + GlStateManager.color(f, f1, f2, (float)d1); + GlStateManager.doPolygonOffset(-3.0F, -3.0F); + GlStateManager.enablePolygonOffset(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.enableAlpha(); + GlStateManager.disableCull(); + float f3 = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F; + float f4 = 0.0F; + float f5 = 0.0F; + float f6 = 128.0F; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.setTranslation(-d2, -d3, -d4); + double d5 = Math.max((double)MathHelper.floor_double(d4 - d0), worldborder.minZ()); + double d6 = Math.min((double)MathHelper.ceiling_double_int(d4 + d0), worldborder.maxZ()); + + if (d2 > worldborder.maxX() - d0) + { + float f7 = 0.0F; + + for (double d7 = d5; d7 < d6; f7 += 0.5F) + { + double d8 = Math.min(1.0D, d6 - d7); + float f8 = (float)d8 * 0.5F; + worldrenderer.pos(worldborder.maxX(), 256.0D, d7).tex((double)(f3 + f7), (double)(f3 + 0.0F)).endVertex(); + worldrenderer.pos(worldborder.maxX(), 256.0D, d7 + d8).tex((double)(f3 + f8 + f7), (double)(f3 + 0.0F)).endVertex(); + worldrenderer.pos(worldborder.maxX(), 0.0D, d7 + d8).tex((double)(f3 + f8 + f7), (double)(f3 + 128.0F)).endVertex(); + worldrenderer.pos(worldborder.maxX(), 0.0D, d7).tex((double)(f3 + f7), (double)(f3 + 128.0F)).endVertex(); + ++d7; + } + } + + if (d2 < worldborder.minX() + d0) + { + float f9 = 0.0F; + + for (double d9 = d5; d9 < d6; f9 += 0.5F) + { + double d12 = Math.min(1.0D, d6 - d9); + float f12 = (float)d12 * 0.5F; + worldrenderer.pos(worldborder.minX(), 256.0D, d9).tex((double)(f3 + f9), (double)(f3 + 0.0F)).endVertex(); + worldrenderer.pos(worldborder.minX(), 256.0D, d9 + d12).tex((double)(f3 + f12 + f9), (double)(f3 + 0.0F)).endVertex(); + worldrenderer.pos(worldborder.minX(), 0.0D, d9 + d12).tex((double)(f3 + f12 + f9), (double)(f3 + 128.0F)).endVertex(); + worldrenderer.pos(worldborder.minX(), 0.0D, d9).tex((double)(f3 + f9), (double)(f3 + 128.0F)).endVertex(); + ++d9; + } + } + + d5 = Math.max((double)MathHelper.floor_double(d2 - d0), worldborder.minX()); + d6 = Math.min((double)MathHelper.ceiling_double_int(d2 + d0), worldborder.maxX()); + + if (d4 > worldborder.maxZ() - d0) + { + float f10 = 0.0F; + + for (double d10 = d5; d10 < d6; f10 += 0.5F) + { + double d13 = Math.min(1.0D, d6 - d10); + float f13 = (float)d13 * 0.5F; + worldrenderer.pos(d10, 256.0D, worldborder.maxZ()).tex((double)(f3 + f10), (double)(f3 + 0.0F)).endVertex(); + worldrenderer.pos(d10 + d13, 256.0D, worldborder.maxZ()).tex((double)(f3 + f13 + f10), (double)(f3 + 0.0F)).endVertex(); + worldrenderer.pos(d10 + d13, 0.0D, worldborder.maxZ()).tex((double)(f3 + f13 + f10), (double)(f3 + 128.0F)).endVertex(); + worldrenderer.pos(d10, 0.0D, worldborder.maxZ()).tex((double)(f3 + f10), (double)(f3 + 128.0F)).endVertex(); + ++d10; + } + } + + if (d4 < worldborder.minZ() + d0) + { + float f11 = 0.0F; + + for (double d11 = d5; d11 < d6; f11 += 0.5F) + { + double d14 = Math.min(1.0D, d6 - d11); + float f14 = (float)d14 * 0.5F; + worldrenderer.pos(d11, 256.0D, worldborder.minZ()).tex((double)(f3 + f11), (double)(f3 + 0.0F)).endVertex(); + worldrenderer.pos(d11 + d14, 256.0D, worldborder.minZ()).tex((double)(f3 + f14 + f11), (double)(f3 + 0.0F)).endVertex(); + worldrenderer.pos(d11 + d14, 0.0D, worldborder.minZ()).tex((double)(f3 + f14 + f11), (double)(f3 + 128.0F)).endVertex(); + worldrenderer.pos(d11, 0.0D, worldborder.minZ()).tex((double)(f3 + f11), (double)(f3 + 128.0F)).endVertex(); + ++d11; + } + } + + tessellator.draw(); + worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); + GlStateManager.enableCull(); + GlStateManager.disableAlpha(); + GlStateManager.doPolygonOffset(0.0F, 0.0F); + GlStateManager.disablePolygonOffset(); + GlStateManager.enableAlpha(); + GlStateManager.disableBlend(); + GlStateManager.popMatrix(); + GlStateManager.depthMask(true); + } + } + + private void preRenderDamagedBlocks() + { + GlStateManager.tryBlendFuncSeparate(774, 768, 1, 0); + GlStateManager.enableBlend(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F); + GlStateManager.doPolygonOffset(-3.0F, -3.0F); + GlStateManager.enablePolygonOffset(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.enableAlpha(); + GlStateManager.pushMatrix(); + + if (Config.isShaders()) + { + ShadersRender.beginBlockDamage(); + } + } + + private void postRenderDamagedBlocks() + { + GlStateManager.disableAlpha(); + GlStateManager.doPolygonOffset(0.0F, 0.0F); + GlStateManager.disablePolygonOffset(); + GlStateManager.enableAlpha(); + GlStateManager.depthMask(true); + GlStateManager.popMatrix(); + + if (Config.isShaders()) + { + ShadersRender.endBlockDamage(); + } + } + + public void drawBlockDamageTexture(Tessellator tessellatorIn, WorldRenderer worldRendererIn, Entity entityIn, float partialTicks) + { + double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; + double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; + double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; + + if (!this.damagedBlocks.isEmpty()) + { + this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); + this.preRenderDamagedBlocks(); + worldRendererIn.begin(7, DefaultVertexFormats.BLOCK); + worldRendererIn.setTranslation(-d0, -d1, -d2); + worldRendererIn.markDirty(); + Iterator iterator = this.damagedBlocks.values().iterator(); + + while (iterator.hasNext()) + { + DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iterator.next(); + BlockPos blockpos = destroyblockprogress.getPosition(); + double d3 = (double)blockpos.getX() - d0; + double d4 = (double)blockpos.getY() - d1; + double d5 = (double)blockpos.getZ() - d2; + Block block = this.theWorld.getBlockState(blockpos).getBlock(); + boolean flag; + + if (Reflector.ForgeTileEntity_canRenderBreaking.exists()) + { + boolean flag1 = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; + + if (!flag1) + { + TileEntity tileentity = this.theWorld.getTileEntity(blockpos); + + if (tileentity != null) + { + flag1 = Reflector.callBoolean(tileentity, Reflector.ForgeTileEntity_canRenderBreaking, new Object[0]); + } + } + + flag = !flag1; + } + else + { + flag = !(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull); + } + + if (flag) + { + if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) + { + iterator.remove(); + } + else + { + IBlockState iblockstate = this.theWorld.getBlockState(blockpos); + + if (iblockstate.getBlock().getMaterial() != Material.air) + { + int i = destroyblockprogress.getPartialBlockDamage(); + TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i]; + BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher(); + blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.theWorld); + } + } + } + } + + tessellatorIn.draw(); + worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D); + this.postRenderDamagedBlocks(); + } + } + + /** + * Draws the selection box for the player. Args: entityPlayer, rayTraceHit, i, itemStack, partialTickTime + */ + public void drawSelectionBox(EntityPlayer player, MovingObjectPosition movingObjectPositionIn, int p_72731_3_, float partialTicks) + { + if (p_72731_3_ == 0 && movingObjectPositionIn.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + /*if(Animeware.BlockOverlayChroma) { + Minecraft.getMinecraft().fontRendererObj.drawString("", 0, 0, Color.HSBtoRGB((float)(System.currentTimeMillis() % 1000L) / 1000.0F, 0.8F, 0.8F)); + } else { + GlStateManager.color(0.0F, 0.0F, 0.0F, 0.4F); + } + if(Animeware.BlockOverlayPurple) { + GlStateManager.color(1.0F, 0.0F, 1.0F, 0.4F); + } else { + GlStateManager.color(0.0F, 0.0F, 0.0F, 0.4F); + } + if(Animeware.BlockOverlay) { + GlStateManager.color(1.0F, 0.0F, 0.0F, 0.4F); + } else { + GlStateManager.color(0.0F, 0.0F, 0.0F, 0.4F); + } */ + if(Booleans.BlockOverlayRed) { + GlStateManager.color(1.0F, 0.0F, 0.0F, 0.4F); + } else if(Booleans.BlockOverlayPurple) { + GlStateManager.color(1.0F, 0.0F, 1.0F, 0.4F); + } else if(Booleans.BlockOverlayChroma) { + Minecraft.getMinecraft().fontRendererObj.drawString("", 0, 0, Color.HSBtoRGB((float)(System.currentTimeMillis() % 1000L) / 1000.0F, 0.8F, 0.8F)); + }else if(Booleans.BlockOverlayWhite) { + GlStateManager.color(1.0F, 1.0F, 1.0F, 0.4F); + }else if(Booleans.BlockOverlayBlue) { + GlStateManager.color(0.0F, 0.0F, 1.0F, 0.4F); + }else if(Booleans.BlockOverlayCyan) { + GlStateManager.color(0.0F, 0.7F, 1.0F, 0.4F); + } + else { + GlStateManager.color(0.0F, 0.0F, 0.0F, 0.4F); + } + //GlStateManager.color(0.0F, 0.0F, 0.0F, 0.4F); + GL11.glLineWidth(2.0F); + GlStateManager.disableTexture2D(); + + if (Config.isShaders()) + { + Shaders.disableTexture2D(); + } + + GlStateManager.depthMask(false); + float f = 0.002F; + BlockPos blockpos = movingObjectPositionIn.getBlockPos(); + Block block = this.theWorld.getBlockState(blockpos).getBlock(); + + if (block.getMaterial() != Material.air && this.theWorld.getWorldBorder().contains(blockpos)) + { + block.setBlockBoundsBasedOnState(this.theWorld, blockpos); + double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks; + double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks; + double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks; + func_181561_a(block.getSelectedBoundingBox(this.theWorld, blockpos).expand(0.0020000000949949026D, 0.0020000000949949026D, 0.0020000000949949026D).offset(-d0, -d1, -d2)); + } + + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + + if (Config.isShaders()) + { + Shaders.enableTexture2D(); + } + + GlStateManager.disableBlend(); + } + } + + public static void func_181561_a(AxisAlignedBB p_181561_0_) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(3, DefaultVertexFormats.POSITION); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); + tessellator.draw(); + worldrenderer.begin(3, DefaultVertexFormats.POSITION); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); + tessellator.draw(); + worldrenderer.begin(1, DefaultVertexFormats.POSITION); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); + worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); + tessellator.draw(); + } + + public static void func_181563_a(AxisAlignedBB p_181563_0_, int p_181563_1_, int p_181563_2_, int p_181563_3_, int p_181563_4_) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(3, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos(p_181563_0_.minX, p_181563_0_.minY, p_181563_0_.minZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.maxX, p_181563_0_.minY, p_181563_0_.minZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.maxX, p_181563_0_.minY, p_181563_0_.maxZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.minX, p_181563_0_.minY, p_181563_0_.maxZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.minX, p_181563_0_.minY, p_181563_0_.minZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + tessellator.draw(); + worldrenderer.begin(3, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos(p_181563_0_.minX, p_181563_0_.maxY, p_181563_0_.minZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.maxX, p_181563_0_.maxY, p_181563_0_.minZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.maxX, p_181563_0_.maxY, p_181563_0_.maxZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.minX, p_181563_0_.maxY, p_181563_0_.maxZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.minX, p_181563_0_.maxY, p_181563_0_.minZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + tessellator.draw(); + worldrenderer.begin(1, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos(p_181563_0_.minX, p_181563_0_.minY, p_181563_0_.minZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.minX, p_181563_0_.maxY, p_181563_0_.minZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.maxX, p_181563_0_.minY, p_181563_0_.minZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.maxX, p_181563_0_.maxY, p_181563_0_.minZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.maxX, p_181563_0_.minY, p_181563_0_.maxZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.maxX, p_181563_0_.maxY, p_181563_0_.maxZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.minX, p_181563_0_.minY, p_181563_0_.maxZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + worldrenderer.pos(p_181563_0_.minX, p_181563_0_.maxY, p_181563_0_.maxZ).color(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).endVertex(); + tessellator.draw(); + } + + /** + * Marks the blocks in the given range for update + */ + private void markBlocksForUpdate(int x1, int y1, int z1, int x2, int y2, int z2) + { + this.viewFrustum.markBlocksForUpdate(x1, y1, z1, x2, y2, z2); + } + + public void markBlockForUpdate(BlockPos pos) + { + int i = pos.getX(); + int j = pos.getY(); + int k = pos.getZ(); + this.markBlocksForUpdate(i - 1, j - 1, k - 1, i + 1, j + 1, k + 1); + } + + public void notifyLightSet(BlockPos pos) + { + int i = pos.getX(); + int j = pos.getY(); + int k = pos.getZ(); + this.markBlocksForUpdate(i - 1, j - 1, k - 1, i + 1, j + 1, k + 1); + } + + /** + * On the client, re-renders all blocks in this range, inclusive. On the server, does nothing. Args: min x, min y, + * min z, max x, max y, max z + */ + public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) + { + this.markBlocksForUpdate(x1 - 1, y1 - 1, z1 - 1, x2 + 1, y2 + 1, z2 + 1); + } + + public void playRecord(String recordName, BlockPos blockPosIn) + { + ISound isound = (ISound)this.mapSoundPositions.get(blockPosIn); + + if (isound != null) + { + this.mc.getSoundHandler().stopSound(isound); + this.mapSoundPositions.remove(blockPosIn); + } + + if (recordName != null) + { + ItemRecord itemrecord = ItemRecord.getRecord(recordName); + + if (itemrecord != null) + { + this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal()); + } + + ResourceLocation resourcelocation = null; + + if (Reflector.ForgeItemRecord_getRecordResource.exists() && itemrecord != null) + { + resourcelocation = (ResourceLocation)Reflector.call(itemrecord, Reflector.ForgeItemRecord_getRecordResource, new Object[] {recordName}); + } + + if (resourcelocation == null) + { + resourcelocation = new ResourceLocation(recordName); + } + + PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(resourcelocation, (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ()); + this.mapSoundPositions.put(blockPosIn, positionedsoundrecord); + this.mc.getSoundHandler().playSound(positionedsoundrecord); + } + } + + /** + * Plays the specified sound. Arg: soundName, x, y, z, volume, pitch + */ + public void playSound(String soundName, double x, double y, double z, float volume, float pitch) + { + } + + /** + * Plays sound to all near players except the player reference given + */ + public void playSoundToNearExcept(EntityPlayer except, String soundName, double x, double y, double z, float volume, float pitch) + { + } + + public void spawnParticle(int particleID, boolean ignoreRange, final double xCoord, final double yCoord, final double zCoord, double xOffset, double yOffset, double zOffset, int... p_180442_15_) + { + try + { + this.spawnEntityFX(particleID, ignoreRange, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, p_180442_15_); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception while adding particle"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Particle being added"); + crashreportcategory.addCrashSection("ID", Integer.valueOf(particleID)); + + if (p_180442_15_ != null) + { + crashreportcategory.addCrashSection("Parameters", p_180442_15_); + } + + crashreportcategory.addCrashSectionCallable("Position", new Callable() + { + private static final String __OBFID = "CL_00000955"; + public String call() throws Exception + { + return CrashReportCategory.getCoordinateInfo(xCoord, yCoord, zCoord); + } + }); + throw new ReportedException(crashreport); + } + } + + private void spawnParticle(EnumParticleTypes particleIn, double p_174972_2_, double p_174972_4_, double p_174972_6_, double p_174972_8_, double p_174972_10_, double p_174972_12_, int... p_174972_14_) + { + this.spawnParticle(particleIn.getParticleID(), particleIn.getShouldIgnoreRange(), p_174972_2_, p_174972_4_, p_174972_6_, p_174972_8_, p_174972_10_, p_174972_12_, p_174972_14_); + } + + private EntityFX spawnEntityFX(int p_174974_1_, boolean ignoreRange, double p_174974_3_, double p_174974_5_, double p_174974_7_, double p_174974_9_, double p_174974_11_, double p_174974_13_, int... p_174974_15_) + { + if (this.mc != null && this.mc.getRenderViewEntity() != null && this.mc.effectRenderer != null) + { + int i = this.mc.gameSettings.particleSetting; + + if (i == 1 && this.theWorld.rand.nextInt(3) == 0) + { + i = 2; + } + + double d0 = this.mc.getRenderViewEntity().posX - p_174974_3_; + double d1 = this.mc.getRenderViewEntity().posY - p_174974_5_; + double d2 = this.mc.getRenderViewEntity().posZ - p_174974_7_; + + if (p_174974_1_ == EnumParticleTypes.EXPLOSION_HUGE.getParticleID() && !Config.isAnimatedExplosion()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.EXPLOSION_LARGE.getParticleID() && !Config.isAnimatedExplosion()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.EXPLOSION_NORMAL.getParticleID() && !Config.isAnimatedExplosion()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.SUSPENDED.getParticleID() && !Config.isWaterParticles()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.SUSPENDED_DEPTH.getParticleID() && !Config.isVoidParticles()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.SMOKE_NORMAL.getParticleID() && !Config.isAnimatedSmoke()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.SMOKE_LARGE.getParticleID() && !Config.isAnimatedSmoke()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.SPELL_MOB.getParticleID() && !Config.isPotionParticles()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.SPELL_MOB_AMBIENT.getParticleID() && !Config.isPotionParticles()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.SPELL.getParticleID() && !Config.isPotionParticles()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.SPELL_INSTANT.getParticleID() && !Config.isPotionParticles()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.SPELL_WITCH.getParticleID() && !Config.isPotionParticles()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.PORTAL.getParticleID() && !Config.isAnimatedPortal()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.FLAME.getParticleID() && !Config.isAnimatedFlame()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.REDSTONE.getParticleID() && !Config.isAnimatedRedstone()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.DRIP_WATER.getParticleID() && !Config.isDrippingWaterLava()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.DRIP_LAVA.getParticleID() && !Config.isDrippingWaterLava()) + { + return null; + } + else if (p_174974_1_ == EnumParticleTypes.FIREWORKS_SPARK.getParticleID() && !Config.isFireworkParticles()) + { + return null; + } + else if (ignoreRange) + { + return this.mc.effectRenderer.spawnEffectParticle(p_174974_1_, p_174974_3_, p_174974_5_, p_174974_7_, p_174974_9_, p_174974_11_, p_174974_13_, p_174974_15_); + } + else + { + double d3 = 16.0D; + double d4 = 256.0D; + + if (p_174974_1_ == EnumParticleTypes.CRIT.getParticleID()) + { + d4 = 38416.0D; + } + + if (d0 * d0 + d1 * d1 + d2 * d2 > d4) + { + return null; + } + else if (i > 1) + { + return null; + } + else + { + EntityFX entityfx = this.mc.effectRenderer.spawnEffectParticle(p_174974_1_, p_174974_3_, p_174974_5_, p_174974_7_, p_174974_9_, p_174974_11_, p_174974_13_, p_174974_15_); + + if (p_174974_1_ == EnumParticleTypes.WATER_BUBBLE.getParticleID()) + { + CustomColors.updateWaterFX(entityfx, this.theWorld, p_174974_3_, p_174974_5_, p_174974_7_); + } + + if (p_174974_1_ == EnumParticleTypes.WATER_SPLASH.getParticleID()) + { + CustomColors.updateWaterFX(entityfx, this.theWorld, p_174974_3_, p_174974_5_, p_174974_7_); + } + + if (p_174974_1_ == EnumParticleTypes.WATER_DROP.getParticleID()) + { + CustomColors.updateWaterFX(entityfx, this.theWorld, p_174974_3_, p_174974_5_, p_174974_7_); + } + + if (p_174974_1_ == EnumParticleTypes.TOWN_AURA.getParticleID()) + { + CustomColors.updateMyceliumFX(entityfx); + } + + if (p_174974_1_ == EnumParticleTypes.PORTAL.getParticleID()) + { + CustomColors.updatePortalFX(entityfx); + } + + if (p_174974_1_ == EnumParticleTypes.REDSTONE.getParticleID()) + { + CustomColors.updateReddustFX(entityfx, this.theWorld, p_174974_3_, p_174974_5_, p_174974_7_); + } + + return entityfx; + } + } + } + else + { + return null; + } + } + + /** + * Called on all IWorldAccesses when an entity is created or loaded. On client worlds, starts downloading any + * necessary textures. On server worlds, adds the entity to the entity tracker. + */ + public void onEntityAdded(Entity entityIn) + { + RandomMobs.entityLoaded(entityIn, this.theWorld); + + if (Config.isDynamicLights()) + { + DynamicLights.entityAdded(entityIn, this); + } + } + + /** + * Called on all IWorldAccesses when an entity is unloaded or destroyed. On client worlds, releases any downloaded + * textures. On server worlds, removes the entity from the entity tracker. + */ + public void onEntityRemoved(Entity entityIn) + { + if (Config.isDynamicLights()) + { + DynamicLights.entityRemoved(entityIn, this); + } + } + + /** + * Deletes all display lists + */ + public void deleteAllDisplayLists() + { + } + + public void broadcastSound(int p_180440_1_, BlockPos p_180440_2_, int p_180440_3_) + { + switch (p_180440_1_) + { + case 1013: + case 1018: + if (this.mc.getRenderViewEntity() != null) + { + double d0 = (double)p_180440_2_.getX() - this.mc.getRenderViewEntity().posX; + double d1 = (double)p_180440_2_.getY() - this.mc.getRenderViewEntity().posY; + double d2 = (double)p_180440_2_.getZ() - this.mc.getRenderViewEntity().posZ; + double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); + double d4 = this.mc.getRenderViewEntity().posX; + double d5 = this.mc.getRenderViewEntity().posY; + double d6 = this.mc.getRenderViewEntity().posZ; + + if (d3 > 0.0D) + { + d4 += d0 / d3 * 2.0D; + d5 += d1 / d3 * 2.0D; + d6 += d2 / d3 * 2.0D; + } + + if (p_180440_1_ == 1013) + { + this.theWorld.playSound(d4, d5, d6, "mob.wither.spawn", 1.0F, 1.0F, false); + } + else + { + this.theWorld.playSound(d4, d5, d6, "mob.enderdragon.end", 5.0F, 1.0F, false); + } + } + + default: + } + } + + public void playAuxSFX(EntityPlayer player, int sfxType, BlockPos blockPosIn, int p_180439_4_) + { + Random random = this.theWorld.rand; + + switch (sfxType) + { + case 1000: + this.theWorld.playSoundAtPos(blockPosIn, "random.click", 1.0F, 1.0F, false); + break; + + case 1001: + this.theWorld.playSoundAtPos(blockPosIn, "random.click", 1.0F, 1.2F, false); + break; + + case 1002: + this.theWorld.playSoundAtPos(blockPosIn, "random.bow", 1.0F, 1.2F, false); + break; + + case 1003: + this.theWorld.playSoundAtPos(blockPosIn, "random.door_open", 1.0F, this.theWorld.rand.nextFloat() * 0.1F + 0.9F, false); + break; + + case 1004: + this.theWorld.playSoundAtPos(blockPosIn, "random.fizz", 0.5F, 2.6F + (random.nextFloat() - random.nextFloat()) * 0.8F, false); + break; + + case 1005: + if (Item.getItemById(p_180439_4_) instanceof ItemRecord) + { + this.theWorld.playRecord(blockPosIn, "records." + ((ItemRecord)Item.getItemById(p_180439_4_)).recordName); + } + else + { + this.theWorld.playRecord(blockPosIn, (String)null); + } + + break; + + case 1006: + this.theWorld.playSoundAtPos(blockPosIn, "random.door_close", 1.0F, this.theWorld.rand.nextFloat() * 0.1F + 0.9F, false); + break; + + case 1007: + this.theWorld.playSoundAtPos(blockPosIn, "mob.ghast.charge", 10.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + + case 1008: + this.theWorld.playSoundAtPos(blockPosIn, "mob.ghast.fireball", 10.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + + case 1009: + this.theWorld.playSoundAtPos(blockPosIn, "mob.ghast.fireball", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + + case 1010: + this.theWorld.playSoundAtPos(blockPosIn, "mob.zombie.wood", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + + case 1011: + this.theWorld.playSoundAtPos(blockPosIn, "mob.zombie.metal", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + + case 1012: + this.theWorld.playSoundAtPos(blockPosIn, "mob.zombie.woodbreak", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + + case 1014: + this.theWorld.playSoundAtPos(blockPosIn, "mob.wither.shoot", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + + case 1015: + this.theWorld.playSoundAtPos(blockPosIn, "mob.bat.takeoff", 0.05F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + + case 1016: + this.theWorld.playSoundAtPos(blockPosIn, "mob.zombie.infect", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + + case 1017: + this.theWorld.playSoundAtPos(blockPosIn, "mob.zombie.unfect", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + + case 1020: + this.theWorld.playSoundAtPos(blockPosIn, "random.anvil_break", 1.0F, this.theWorld.rand.nextFloat() * 0.1F + 0.9F, false); + break; + + case 1021: + this.theWorld.playSoundAtPos(blockPosIn, "random.anvil_use", 1.0F, this.theWorld.rand.nextFloat() * 0.1F + 0.9F, false); + break; + + case 1022: + this.theWorld.playSoundAtPos(blockPosIn, "random.anvil_land", 0.3F, this.theWorld.rand.nextFloat() * 0.1F + 0.9F, false); + break; + + case 2000: + int k = p_180439_4_ % 3 - 1; + int l = p_180439_4_ / 3 % 3 - 1; + double d13 = (double)blockPosIn.getX() + (double)k * 0.6D + 0.5D; + double d15 = (double)blockPosIn.getY() + 0.5D; + double d19 = (double)blockPosIn.getZ() + (double)l * 0.6D + 0.5D; + + for (int l1 = 0; l1 < 10; ++l1) + { + double d20 = random.nextDouble() * 0.2D + 0.01D; + double d21 = d13 + (double)k * 0.01D + (random.nextDouble() - 0.5D) * (double)l * 0.5D; + double d22 = d15 + (random.nextDouble() - 0.5D) * 0.5D; + double d23 = d19 + (double)l * 0.01D + (random.nextDouble() - 0.5D) * (double)k * 0.5D; + double d24 = (double)k * d20 + random.nextGaussian() * 0.01D; + double d9 = -0.03D + random.nextGaussian() * 0.01D; + double d10 = (double)l * d20 + random.nextGaussian() * 0.01D; + this.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d21, d22, d23, d24, d9, d10, new int[0]); + } + + return; + + case 2001: + Block block = Block.getBlockById(p_180439_4_ & 4095); + + if (block.getMaterial() != Material.air) + { + this.mc.getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(block.stepSound.getBreakSound()), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getFrequency() * 0.8F, (float)blockPosIn.getX() + 0.5F, (float)blockPosIn.getY() + 0.5F, (float)blockPosIn.getZ() + 0.5F)); + } + + this.mc.effectRenderer.addBlockDestroyEffects(blockPosIn, block.getStateFromMeta(p_180439_4_ >> 12 & 255)); + break; + + case 2002: + double d11 = (double)blockPosIn.getX(); + double d12 = (double)blockPosIn.getY(); + double d14 = (double)blockPosIn.getZ(); + + for (int i1 = 0; i1 < 8; ++i1) + { + this.spawnParticle(EnumParticleTypes.ITEM_CRACK, d11, d12, d14, random.nextGaussian() * 0.15D, random.nextDouble() * 0.2D, random.nextGaussian() * 0.15D, new int[] {Item.getIdFromItem(Items.potionitem), p_180439_4_}); + } + + int j1 = Items.potionitem.getColorFromDamage(p_180439_4_); + float f = (float)(j1 >> 16 & 255) / 255.0F; + float f1 = (float)(j1 >> 8 & 255) / 255.0F; + float f2 = (float)(j1 >> 0 & 255) / 255.0F; + EnumParticleTypes enumparticletypes = EnumParticleTypes.SPELL; + + if (Items.potionitem.isEffectInstant(p_180439_4_)) + { + enumparticletypes = EnumParticleTypes.SPELL_INSTANT; + } + + for (int k1 = 0; k1 < 100; ++k1) + { + double d16 = random.nextDouble() * 4.0D; + double d17 = random.nextDouble() * Math.PI * 2.0D; + double d18 = Math.cos(d17) * d16; + double d7 = 0.01D + random.nextDouble() * 0.5D; + double d8 = Math.sin(d17) * d16; + EntityFX entityfx = this.spawnEntityFX(enumparticletypes.getParticleID(), enumparticletypes.getShouldIgnoreRange(), d11 + d18 * 0.1D, d12 + 0.3D, d14 + d8 * 0.1D, d18, d7, d8, new int[0]); + + if (entityfx != null) + { + float f3 = 0.75F + random.nextFloat() * 0.25F; + entityfx.setRBGColorF(f * f3, f1 * f3, f2 * f3); + entityfx.multiplyVelocity((float)d16); + } + } + + this.theWorld.playSoundAtPos(blockPosIn, "game.potion.smash", 1.0F, this.theWorld.rand.nextFloat() * 0.1F + 0.9F, false); + break; + + case 2003: + double var7 = (double)blockPosIn.getX() + 0.5D; + double var9 = (double)blockPosIn.getY(); + double var11 = (double)blockPosIn.getZ() + 0.5D; + + for (int var13 = 0; var13 < 8; ++var13) + { + this.spawnParticle(EnumParticleTypes.ITEM_CRACK, var7, var9, var11, random.nextGaussian() * 0.15D, random.nextDouble() * 0.2D, random.nextGaussian() * 0.15D, new int[] {Item.getIdFromItem(Items.ender_eye)}); + } + + for (double var32 = 0.0D; var32 < (Math.PI * 2D); var32 += 0.15707963267948966D) + { + this.spawnParticle(EnumParticleTypes.PORTAL, var7 + Math.cos(var32) * 5.0D, var9 - 0.4D, var11 + Math.sin(var32) * 5.0D, Math.cos(var32) * -5.0D, 0.0D, Math.sin(var32) * -5.0D, new int[0]); + this.spawnParticle(EnumParticleTypes.PORTAL, var7 + Math.cos(var32) * 5.0D, var9 - 0.4D, var11 + Math.sin(var32) * 5.0D, Math.cos(var32) * -7.0D, 0.0D, Math.sin(var32) * -7.0D, new int[0]); + } + + return; + + case 2004: + for (int var18 = 0; var18 < 20; ++var18) + { + double d3 = (double)blockPosIn.getX() + 0.5D + ((double)this.theWorld.rand.nextFloat() - 0.5D) * 2.0D; + double d4 = (double)blockPosIn.getY() + 0.5D + ((double)this.theWorld.rand.nextFloat() - 0.5D) * 2.0D; + double d5 = (double)blockPosIn.getZ() + 0.5D + ((double)this.theWorld.rand.nextFloat() - 0.5D) * 2.0D; + this.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d3, d4, d5, 0.0D, 0.0D, 0.0D, new int[0]); + this.theWorld.spawnParticle(EnumParticleTypes.FLAME, d3, d4, d5, 0.0D, 0.0D, 0.0D, new int[0]); + } + + return; + + case 2005: + ItemDye.spawnBonemealParticles(this.theWorld, blockPosIn, p_180439_4_); + } + } + + public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) + { + if (progress >= 0 && progress < 10) + { + DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)this.damagedBlocks.get(Integer.valueOf(breakerId)); + + if (destroyblockprogress == null || destroyblockprogress.getPosition().getX() != pos.getX() || destroyblockprogress.getPosition().getY() != pos.getY() || destroyblockprogress.getPosition().getZ() != pos.getZ()) + { + destroyblockprogress = new DestroyBlockProgress(breakerId, pos); + this.damagedBlocks.put(Integer.valueOf(breakerId), destroyblockprogress); + } + + destroyblockprogress.setPartialBlockDamage(progress); + destroyblockprogress.setCloudUpdateTick(this.cloudTickCounter); + } + else + { + this.damagedBlocks.remove(Integer.valueOf(breakerId)); + } + } + + public void setDisplayListEntitiesDirty() + { + this.displayListEntitiesDirty = true; + } + + public void resetClouds() + { + this.cloudRenderer.reset(); + } + + public int getCountRenderers() + { + return this.viewFrustum.renderChunks.length; + } + + public int getCountActiveRenderers() + { + return this.renderInfos.size(); + } + + public int getCountEntitiesRendered() + { + return this.countEntitiesRendered; + } + + public int getCountTileEntitiesRendered() + { + return this.countTileEntitiesRendered; + } + + public RenderChunk getRenderChunk(BlockPos p_getRenderChunk_1_) + { + return this.viewFrustum.getRenderChunk(p_getRenderChunk_1_); + } + + public RenderChunk getRenderChunk(RenderChunk p_getRenderChunk_1_, EnumFacing p_getRenderChunk_2_) + { + if (p_getRenderChunk_1_ == null) + { + return null; + } + else + { + BlockPos blockpos = p_getRenderChunk_1_.func_181701_a(p_getRenderChunk_2_); + return this.viewFrustum.getRenderChunk(blockpos); + } + } + + public WorldClient getWorld() + { + return this.theWorld; + } + + public void func_181023_a(Collection p_181023_1_, Collection p_181023_2_) + { + Set set = this.field_181024_n; + + synchronized (this.field_181024_n) + { + this.field_181024_n.removeAll(p_181023_1_); + this.field_181024_n.addAll(p_181023_2_); + } + } + + static final class RenderGlobal$2 + { + static final int[] field_178037_a = new int[VertexFormatElement.EnumUsage.values().length]; + private static final String __OBFID = "CL_00002535"; + + static + { + try + { + field_178037_a[VertexFormatElement.EnumUsage.POSITION.ordinal()] = 1; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_178037_a[VertexFormatElement.EnumUsage.UV.ordinal()] = 2; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_178037_a[VertexFormatElement.EnumUsage.COLOR.ordinal()] = 3; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } + + public static class ContainerLocalRenderInformation + { + final RenderChunk renderChunk; + final EnumFacing facing; + final Set setFacing; + final int counter; + private static final String __OBFID = "CL_00002534"; + + public ContainerLocalRenderInformation(RenderChunk p_i4_1_, EnumFacing p_i4_2_, int p_i4_3_) + { + this.setFacing = EnumSet.noneOf(EnumFacing.class); + this.renderChunk = p_i4_1_; + this.facing = p_i4_2_; + this.counter = p_i4_3_; + } + + ContainerLocalRenderInformation(RenderChunk p_i5_1_, EnumFacing p_i5_2_, int p_i5_3_, Object p_i5_4_) + { + this(p_i5_1_, p_i5_2_, p_i5_3_); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/RenderGlobal.~ b/src/minecraft/net/minecraft/client/renderer/RenderGlobal.~ new file mode 100644 index 0000000..f1c84f3 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/RenderGlobal.~ @@ -0,0 +1,2632 @@ +package net.minecraft.client.renderer; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.google.gson.JsonSyntaxException; +import java.io.IOException; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Deque; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.block.BlockChest; +import net.minecraft.block.BlockEnderChest; +import net.minecraft.block.BlockSign; +import net.minecraft.block.BlockSkull; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.ISound; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.BlockModelRenderer; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.ChunkRenderContainer; +import net.minecraft.client.renderer.DestroyBlockProgress; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.RenderList; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.VboRenderList; +import net.minecraft.client.renderer.ViewFrustum; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher; +import net.minecraft.client.renderer.chunk.CompiledChunk; +import net.minecraft.client.renderer.chunk.IRenderChunkFactory; +import net.minecraft.client.renderer.chunk.ListChunkFactory; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.client.renderer.chunk.VboChunkFactory; +import net.minecraft.client.renderer.chunk.VisGraph; +import net.minecraft.client.renderer.culling.ClippingHelper; +import net.minecraft.client.renderer.culling.ClippingHelperImpl; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.culling.ICamera; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexBuffer; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.client.shader.ShaderGroup; +import net.minecraft.client.shader.ShaderLinkHelper; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityWitherSkull; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemDye; +import net.minecraft.item.ItemRecord; +import net.minecraft.src.ChunkUtils; +import net.minecraft.src.CloudRenderer; +import net.minecraft.src.Config; +import net.minecraft.src.CustomColors; +import net.minecraft.src.CustomSky; +import net.minecraft.src.DynamicLights; +import net.minecraft.src.Lagometer; +import net.minecraft.src.RandomMobs; +import net.minecraft.src.Reflector; +import net.minecraft.src.RenderInfoLazy; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ClassInheritanceMultiMap; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Matrix4f; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.util.Vector3d; +import net.minecraft.world.IWorldAccess; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.border.WorldBorder; +import net.minecraft.world.chunk.Chunk; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.vector.Vector3f; +import org.lwjgl.util.vector.Vector4f; +import shadersmod.client.Shaders; +import shadersmod.client.ShadersRender; +import shadersmod.client.ShadowUtils; + +public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListener { + private static final Logger field_147599_m = LogManager.getLogger(); + private static final ResourceLocation field_110927_h = new ResourceLocation("textures/environment/moon_phases.png"); + private static final ResourceLocation field_110928_i = new ResourceLocation("textures/environment/sun.png"); + private static final ResourceLocation field_110925_j = new ResourceLocation("textures/environment/clouds.png"); + private static final ResourceLocation field_110926_k = new ResourceLocation("textures/environment/end_sky.png"); + private static final ResourceLocation field_175006_g = new ResourceLocation("textures/misc/forcefield.png"); + public final Minecraft field_72777_q; + private final TextureManager field_72770_i; + private final RenderManager field_175010_j; + private WorldClient field_72769_h; + private Set field_175009_l = Sets.newLinkedHashSet(); + private List field_72755_R = Lists.newArrayListWithCapacity(69696); + private final Set field_181024_n = Sets.newHashSet(); + private ViewFrustum field_175008_n; + private int field_72772_v = -1; + private int field_72771_w = -1; + private int field_72781_x = -1; + private VertexFormat field_175014_r; + private VertexBuffer field_175013_s; + private VertexBuffer field_175012_t; + private VertexBuffer field_175011_u; + private int field_72773_u; + public final Map field_72738_E = Maps.newHashMap(); + private final Map field_147593_P = Maps.newHashMap(); + private final TextureAtlasSprite[] field_94141_F = new TextureAtlasSprite[10]; + private Framebuffer field_175015_z; + private ShaderGroup field_174991_A; + private double field_174992_B = Double.MIN_VALUE; + private double field_174993_C = Double.MIN_VALUE; + private double field_174987_D = Double.MIN_VALUE; + private int field_174988_E = Integer.MIN_VALUE; + private int field_174989_F = Integer.MIN_VALUE; + private int field_174990_G = Integer.MIN_VALUE; + private double field_174997_H = Double.MIN_VALUE; + private double field_174998_I = Double.MIN_VALUE; + private double field_174999_J = Double.MIN_VALUE; + private double field_175000_K = Double.MIN_VALUE; + private double field_174994_L = Double.MIN_VALUE; + private final ChunkRenderDispatcher field_174995_M = new ChunkRenderDispatcher(); + private ChunkRenderContainer field_174996_N; + private int field_72739_F = -1; + private int field_72740_G = 2; + private int field_72748_H; + private int field_72749_I; + private int field_72750_J; + private boolean field_175002_T = false; + private ClippingHelper field_175001_U; + private final Vector4f[] field_175004_V = new Vector4f[8]; + private final Vector3d field_175003_W = new Vector3d(); + private boolean field_175005_X = false; + IRenderChunkFactory field_175007_a; + private double field_147596_f; + private double field_147597_g; + private double field_147602_h; + public boolean field_147595_R = true; + private static final String __OBFID = "CL_00000954"; + private CloudRenderer cloudRenderer; + public Entity renderedEntity; + public Set chunksToResortTransparency = new LinkedHashSet(); + public Set chunksToUpdateForced = new LinkedHashSet(); + private Deque visibilityDeque = new ArrayDeque(); + private List renderInfosEntities = new ArrayList(1024); + private List renderInfosTileEntities = new ArrayList(1024); + private List renderInfosNormal = new ArrayList(1024); + private List renderInfosEntitiesNormal = new ArrayList(1024); + private List renderInfosTileEntitiesNormal = new ArrayList(1024); + private List renderInfosShadow = new ArrayList(1024); + private List renderInfosEntitiesShadow = new ArrayList(1024); + private List renderInfosTileEntitiesShadow = new ArrayList(1024); + private int renderDistance = 0; + private int renderDistanceSq = 0; + private static final Set SET_ALL_FACINGS = Collections.unmodifiableSet(new HashSet(Arrays.asList(EnumFacing.field_82609_l))); + private int countTileEntitiesRendered; + + public RenderGlobal(Minecraft p_i1249_1_) { + this.cloudRenderer = new CloudRenderer(p_i1249_1_); + this.field_72777_q = p_i1249_1_; + this.field_175010_j = p_i1249_1_.func_175598_ae(); + this.field_72770_i = p_i1249_1_.func_110434_K(); + this.field_72770_i.func_110577_a(field_175006_g); + GL11.glTexParameteri(3553, 10242, 10497); + GL11.glTexParameteri(3553, 10243, 10497); + GlStateManager.func_179144_i(0); + this.func_174971_n(); + this.field_175005_X = OpenGlHelper.func_176075_f(); + if(this.field_175005_X) { + this.field_174996_N = new VboRenderList(); + this.field_175007_a = new VboChunkFactory(); + } else { + this.field_174996_N = new RenderList(); + this.field_175007_a = new ListChunkFactory(); + } + + this.field_175014_r = new VertexFormat(); + this.field_175014_r.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3)); + this.func_174963_q(); + this.func_174980_p(); + this.func_174964_o(); + } + + public void func_110549_a(IResourceManager p_110549_1_) { + this.func_174971_n(); + } + + private void func_174971_n() { + TextureMap texturemap = this.field_72777_q.func_147117_R(); + + for(int i = 0; i < this.field_94141_F.length; ++i) { + this.field_94141_F[i] = texturemap.func_110572_b("minecraft:blocks/destroy_stage_" + i); + } + + } + + public void func_174966_b() { + if(OpenGlHelper.field_148824_g) { + if(ShaderLinkHelper.func_148074_b() == null) { + ShaderLinkHelper.func_148076_a(); + } + + ResourceLocation resourcelocation = new ResourceLocation("shaders/post/entity_outline.json"); + + try { + this.field_174991_A = new ShaderGroup(this.field_72777_q.func_110434_K(), this.field_72777_q.func_110442_L(), this.field_72777_q.func_147110_a(), resourcelocation); + this.field_174991_A.func_148026_a(this.field_72777_q.field_71443_c, this.field_72777_q.field_71440_d); + this.field_175015_z = this.field_174991_A.func_177066_a("final"); + } catch (IOException ioexception) { + field_147599_m.warn((String)("Failed to load shader: " + resourcelocation), (Throwable)ioexception); + this.field_174991_A = null; + this.field_175015_z = null; + } catch (JsonSyntaxException jsonsyntaxexception) { + field_147599_m.warn((String)("Failed to load shader: " + resourcelocation), (Throwable)jsonsyntaxexception); + this.field_174991_A = null; + this.field_175015_z = null; + } + } else { + this.field_174991_A = null; + this.field_175015_z = null; + } + + } + + public void func_174975_c() { + if(this.func_174985_d()) { + GlStateManager.func_179147_l(); + GlStateManager.func_179120_a(770, 771, 0, 1); + this.field_175015_z.func_178038_a(this.field_72777_q.field_71443_c, this.field_72777_q.field_71440_d, false); + GlStateManager.func_179084_k(); + } + + } + + protected boolean func_174985_d() { + return !Config.isFastRender() && !Config.isShaders() && !Config.isAntialiasing()?this.field_175015_z != null && this.field_174991_A != null && this.field_72777_q.field_71439_g != null && this.field_72777_q.field_71439_g.func_175149_v() && this.field_72777_q.field_71474_y.field_178883_an.func_151470_d():false; + } + + private void func_174964_o() { + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + if(this.field_175011_u != null) { + this.field_175011_u.func_177362_c(); + } + + if(this.field_72781_x >= 0) { + GLAllocation.func_74523_b(this.field_72781_x); + this.field_72781_x = -1; + } + + if(this.field_175005_X) { + this.field_175011_u = new VertexBuffer(this.field_175014_r); + this.func_174968_a(worldrenderer, -16.0F, true); + worldrenderer.func_178977_d(); + worldrenderer.func_178965_a(); + this.field_175011_u.func_181722_a(worldrenderer.func_178966_f()); + } else { + this.field_72781_x = GLAllocation.func_74526_a(1); + GL11.glNewList(this.field_72781_x, 4864); + this.func_174968_a(worldrenderer, -16.0F, true); + tessellator.func_78381_a(); + GL11.glEndList(); + } + + } + + private void func_174980_p() { + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + if(this.field_175012_t != null) { + this.field_175012_t.func_177362_c(); + } + + if(this.field_72771_w >= 0) { + GLAllocation.func_74523_b(this.field_72771_w); + this.field_72771_w = -1; + } + + if(this.field_175005_X) { + this.field_175012_t = new VertexBuffer(this.field_175014_r); + this.func_174968_a(worldrenderer, 16.0F, false); + worldrenderer.func_178977_d(); + worldrenderer.func_178965_a(); + this.field_175012_t.func_181722_a(worldrenderer.func_178966_f()); + } else { + this.field_72771_w = GLAllocation.func_74526_a(1); + GL11.glNewList(this.field_72771_w, 4864); + this.func_174968_a(worldrenderer, 16.0F, false); + tessellator.func_78381_a(); + GL11.glEndList(); + } + + } + + private void func_174968_a(WorldRenderer p_174968_1_, float p_174968_2_, boolean p_174968_3_) { + boolean flag = true; + boolean flag1 = true; + p_174968_1_.func_181668_a(7, DefaultVertexFormats.field_181705_e); + + for(int i = -384; i <= 384; i += 64) { + for(int j = -384; j <= 384; j += 64) { + float f = (float)i; + float f1 = (float)(i + 64); + if(p_174968_3_) { + f1 = (float)i; + f = (float)(i + 64); + } + + p_174968_1_.func_181662_b((double)f, (double)p_174968_2_, (double)j).func_181675_d(); + p_174968_1_.func_181662_b((double)f1, (double)p_174968_2_, (double)j).func_181675_d(); + p_174968_1_.func_181662_b((double)f1, (double)p_174968_2_, (double)(j + 64)).func_181675_d(); + p_174968_1_.func_181662_b((double)f, (double)p_174968_2_, (double)(j + 64)).func_181675_d(); + } + } + + } + + private void func_174963_q() { + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + if(this.field_175013_s != null) { + this.field_175013_s.func_177362_c(); + } + + if(this.field_72772_v >= 0) { + GLAllocation.func_74523_b(this.field_72772_v); + this.field_72772_v = -1; + } + + if(this.field_175005_X) { + this.field_175013_s = new VertexBuffer(this.field_175014_r); + this.func_180444_a(worldrenderer); + worldrenderer.func_178977_d(); + worldrenderer.func_178965_a(); + this.field_175013_s.func_181722_a(worldrenderer.func_178966_f()); + } else { + this.field_72772_v = GLAllocation.func_74526_a(1); + GlStateManager.func_179094_E(); + GL11.glNewList(this.field_72772_v, 4864); + this.func_180444_a(worldrenderer); + tessellator.func_78381_a(); + GL11.glEndList(); + GlStateManager.func_179121_F(); + } + + } + + private void func_180444_a(WorldRenderer p_180444_1_) { + Random random = new Random(10842L); + p_180444_1_.func_181668_a(7, DefaultVertexFormats.field_181705_e); + + for(int i = 0; i < 1500; ++i) { + double d0 = (double)(random.nextFloat() * 2.0F - 1.0F); + double d1 = (double)(random.nextFloat() * 2.0F - 1.0F); + double d2 = (double)(random.nextFloat() * 2.0F - 1.0F); + double d3 = (double)(0.15F + random.nextFloat() * 0.1F); + double d4 = d0 * d0 + d1 * d1 + d2 * d2; + if(d4 < 1.0D && d4 > 0.01D) { + d4 = 1.0D / Math.sqrt(d4); + d0 = d0 * d4; + d1 = d1 * d4; + d2 = d2 * d4; + double d5 = d0 * 100.0D; + double d6 = d1 * 100.0D; + double d7 = d2 * 100.0D; + double d8 = Math.atan2(d0, d2); + double d9 = Math.sin(d8); + double d10 = Math.cos(d8); + double d11 = Math.atan2(Math.sqrt(d0 * d0 + d2 * d2), d1); + double d12 = Math.sin(d11); + double d13 = Math.cos(d11); + double d14 = random.nextDouble() * 3.141592653589793D * 2.0D; + double d15 = Math.sin(d14); + double d16 = Math.cos(d14); + + for(int j = 0; j < 4; ++j) { + double d17 = 0.0D; + double d18 = (double)((j & 2) - 1) * d3; + double d19 = (double)((j + 1 & 2) - 1) * d3; + double d20 = 0.0D; + double d21 = d18 * d16 - d19 * d15; + double d22 = d19 * d16 + d18 * d15; + double d23 = d21 * d12 + 0.0D * d13; + double d24 = 0.0D * d12 - d21 * d13; + double d25 = d24 * d9 - d22 * d10; + double d26 = d22 * d9 + d24 * d10; + p_180444_1_.func_181662_b(d5 + d25, d6 + d23, d7 + d26).func_181675_d(); + } + } + } + + } + + public void func_72732_a(WorldClient p_72732_1_) { + if(this.field_72769_h != null) { + this.field_72769_h.func_72848_b(this); + } + + this.field_174992_B = Double.MIN_VALUE; + this.field_174993_C = Double.MIN_VALUE; + this.field_174987_D = Double.MIN_VALUE; + this.field_174988_E = Integer.MIN_VALUE; + this.field_174989_F = Integer.MIN_VALUE; + this.field_174990_G = Integer.MIN_VALUE; + this.field_175010_j.func_78717_a(p_72732_1_); + this.field_72769_h = p_72732_1_; + if(Config.isDynamicLights()) { + DynamicLights.clear(); + } + + if(p_72732_1_ != null) { + p_72732_1_.func_72954_a(this); + this.func_72712_a(); + } + + } + + public void func_72712_a() { + if(this.field_72769_h != null) { + this.field_147595_R = true; + Blocks.field_150362_t.func_150122_b(Config.isTreesFancy()); + Blocks.field_150361_u.func_150122_b(Config.isTreesFancy()); + BlockModelRenderer.updateAoLightValue(); + if(Config.isDynamicLights()) { + DynamicLights.clear(); + } + + this.field_72739_F = this.field_72777_q.field_71474_y.field_151451_c; + this.renderDistance = this.field_72739_F * 16; + this.renderDistanceSq = this.renderDistance * this.renderDistance; + boolean flag = this.field_175005_X; + this.field_175005_X = OpenGlHelper.func_176075_f(); + if(flag && !this.field_175005_X) { + this.field_174996_N = new RenderList(); + this.field_175007_a = new ListChunkFactory(); + } else if(!flag && this.field_175005_X) { + this.field_174996_N = new VboRenderList(); + this.field_175007_a = new VboChunkFactory(); + } + + if(flag != this.field_175005_X) { + this.func_174963_q(); + this.func_174980_p(); + this.func_174964_o(); + } + + if(this.field_175008_n != null) { + this.field_175008_n.func_178160_a(); + } + + this.func_174986_e(); + Set var5 = this.field_181024_n; + synchronized(this.field_181024_n) { + this.field_181024_n.clear(); + } + + this.field_175008_n = new ViewFrustum(this.field_72769_h, this.field_72777_q.field_71474_y.field_151451_c, this, this.field_175007_a); + if(this.field_72769_h != null) { + Entity entity = this.field_72777_q.func_175606_aa(); + if(entity != null) { + this.field_175008_n.func_178163_a(entity.field_70165_t, entity.field_70161_v); + } + } + + this.field_72740_G = 2; + } + + } + + protected void func_174986_e() { + this.field_175009_l.clear(); + this.field_174995_M.func_178514_b(); + } + + public void func_72720_a(int p_72720_1_, int p_72720_2_) { + if(OpenGlHelper.field_148824_g && this.field_174991_A != null) { + this.field_174991_A.func_148026_a(p_72720_1_, p_72720_2_); + } + + } + + public void func_180446_a(Entity p_180446_1_, ICamera p_180446_2_, float p_180446_3_) { + int i = 0; + if(Reflector.MinecraftForgeClient_getRenderPass.exists()) { + i = Reflector.callInt(Reflector.MinecraftForgeClient_getRenderPass, new Object[0]); + } + + if(this.field_72740_G > 0) { + if(i > 0) { + return; + } + + --this.field_72740_G; + } else { + double d0 = p_180446_1_.field_70169_q + (p_180446_1_.field_70165_t - p_180446_1_.field_70169_q) * (double)p_180446_3_; + double d1 = p_180446_1_.field_70167_r + (p_180446_1_.field_70163_u - p_180446_1_.field_70167_r) * (double)p_180446_3_; + double d2 = p_180446_1_.field_70166_s + (p_180446_1_.field_70161_v - p_180446_1_.field_70166_s) * (double)p_180446_3_; + this.field_72769_h.field_72984_F.func_76320_a("prepare"); + TileEntityRendererDispatcher.field_147556_a.func_178470_a(this.field_72769_h, this.field_72777_q.func_110434_K(), this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), p_180446_3_); + this.field_175010_j.func_180597_a(this.field_72769_h, this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), this.field_72777_q.field_147125_j, this.field_72777_q.field_71474_y, p_180446_3_); + if(i == 0) { + this.field_72748_H = 0; + this.field_72749_I = 0; + this.field_72750_J = 0; + this.countTileEntitiesRendered = 0; + } + + Entity entity = this.field_72777_q.func_175606_aa(); + double d3 = entity.field_70142_S + (entity.field_70165_t - entity.field_70142_S) * (double)p_180446_3_; + double d4 = entity.field_70137_T + (entity.field_70163_u - entity.field_70137_T) * (double)p_180446_3_; + double d5 = entity.field_70136_U + (entity.field_70161_v - entity.field_70136_U) * (double)p_180446_3_; + TileEntityRendererDispatcher.field_147554_b = d3; + TileEntityRendererDispatcher.field_147555_c = d4; + TileEntityRendererDispatcher.field_147552_d = d5; + this.field_175010_j.func_178628_a(d3, d4, d5); + this.field_72777_q.field_71460_t.func_180436_i(); + this.field_72769_h.field_72984_F.func_76318_c("global"); + List list = this.field_72769_h.func_72910_y(); + if(i == 0) { + this.field_72748_H = list.size(); + } + + if(Config.isFogOff() && this.field_72777_q.field_71460_t.fogStandard) { + GlStateManager.func_179106_n(); + } + + boolean flag = Reflector.ForgeEntity_shouldRenderInPass.exists(); + boolean flag1 = Reflector.ForgeTileEntity_shouldRenderInPass.exists(); + + for(int j = 0; j < this.field_72769_h.field_73007_j.size(); ++j) { + Entity entity1 = (Entity)this.field_72769_h.field_73007_j.get(j); + if(!flag || Reflector.callBoolean(entity1, Reflector.ForgeEntity_shouldRenderInPass, new Object[]{Integer.valueOf(i)})) { + ++this.field_72749_I; + if(entity1.func_145770_h(d0, d1, d2)) { + this.field_175010_j.func_147937_a(entity1, p_180446_3_); + } + } + } + + if(this.func_174985_d()) { + GlStateManager.func_179143_c(519); + GlStateManager.func_179106_n(); + this.field_175015_z.func_147614_f(); + this.field_175015_z.func_147610_a(false); + this.field_72769_h.field_72984_F.func_76318_c("entityOutlines"); + RenderHelper.func_74518_a(); + this.field_175010_j.func_178632_c(true); + + for(int k = 0; k < list.size(); ++k) { + Entity entity3 = (Entity)list.get(k); + if(!flag || Reflector.callBoolean(entity3, Reflector.ForgeEntity_shouldRenderInPass, new Object[]{Integer.valueOf(i)})) { + boolean flag2 = this.field_72777_q.func_175606_aa() instanceof EntityLivingBase && ((EntityLivingBase)this.field_72777_q.func_175606_aa()).func_70608_bn(); + boolean flag3 = entity3.func_145770_h(d0, d1, d2) && (entity3.field_70158_ak || p_180446_2_.func_78546_a(entity3.func_174813_aQ()) || entity3.field_70153_n == this.field_72777_q.field_71439_g) && entity3 instanceof EntityPlayer; + if((entity3 != this.field_72777_q.func_175606_aa() || this.field_72777_q.field_71474_y.field_74320_O != 0 || flag2) && flag3) { + this.field_175010_j.func_147937_a(entity3, p_180446_3_); + } + } + } + + this.field_175010_j.func_178632_c(false); + RenderHelper.func_74519_b(); + GlStateManager.func_179132_a(false); + this.field_174991_A.func_148018_a(p_180446_3_); + GlStateManager.func_179145_e(); + GlStateManager.func_179132_a(true); + this.field_72777_q.func_147110_a().func_147610_a(false); + GlStateManager.func_179127_m(); + GlStateManager.func_179147_l(); + GlStateManager.func_179142_g(); + GlStateManager.func_179143_c(515); + GlStateManager.func_179126_j(); + GlStateManager.func_179141_d(); + } + + this.field_72769_h.field_72984_F.func_76318_c("entities"); + boolean flag7 = Config.isShaders(); + if(flag7) { + Shaders.beginEntities(); + } + + Iterator iterator1 = this.renderInfosEntities.iterator(); + boolean flag4 = this.field_72777_q.field_71474_y.field_74347_j; + this.field_72777_q.field_71474_y.field_74347_j = Config.isDroppedItemsFancy(); + + label920: + while(iterator1.hasNext()) { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation = (RenderGlobal.ContainerLocalRenderInformation)iterator1.next(); + Chunk chunk = this.field_72769_h.func_175726_f(renderglobal$containerlocalrenderinformation.field_178036_a.func_178568_j()); + ClassInheritanceMultiMap classinheritancemultimap = chunk.func_177429_s()[renderglobal$containerlocalrenderinformation.field_178036_a.func_178568_j().func_177956_o() / 16]; + if(!classinheritancemultimap.isEmpty()) { + Iterator iterator = classinheritancemultimap.iterator(); + + while(true) { + Entity entity2; + boolean flag5; + while(true) { + if(!iterator.hasNext()) { + continue label920; + } + + entity2 = (Entity)iterator.next(); + if(!flag || Reflector.callBoolean(entity2, Reflector.ForgeEntity_shouldRenderInPass, new Object[]{Integer.valueOf(i)})) { + flag5 = this.field_175010_j.func_178635_a(entity2, p_180446_2_, d0, d1, d2) || entity2.field_70153_n == this.field_72777_q.field_71439_g; + if(!flag5) { + break; + } + + boolean flag6 = this.field_72777_q.func_175606_aa() instanceof EntityLivingBase?((EntityLivingBase)this.field_72777_q.func_175606_aa()).func_70608_bn():false; + if((entity2 != this.field_72777_q.func_175606_aa() || this.field_72777_q.field_71474_y.field_74320_O != 0 || flag6) && (entity2.field_70163_u < 0.0D || entity2.field_70163_u >= 256.0D || this.field_72769_h.func_175667_e(new BlockPos(entity2)))) { + ++this.field_72749_I; + if(entity2.getClass() == EntityItemFrame.class) { + entity2.field_70155_l = 0.06D; + } + + this.renderedEntity = entity2; + if(flag7) { + Shaders.nextEntity(entity2); + } + + this.field_175010_j.func_147937_a(entity2, p_180446_3_); + this.renderedEntity = null; + break; + } + } + } + + if(!flag5 && entity2 instanceof EntityWitherSkull) { + if(flag7) { + Shaders.nextEntity(entity2); + } + + this.field_72777_q.func_175598_ae().func_178630_b(entity2, p_180446_3_); + } + } + } + } + + this.field_72777_q.field_71474_y.field_74347_j = flag4; + FontRenderer fontrenderer = TileEntityRendererDispatcher.field_147556_a.func_147548_a(); + if(flag7) { + Shaders.endEntities(); + Shaders.beginBlockEntities(); + } + + this.field_72769_h.field_72984_F.func_76318_c("blockentities"); + RenderHelper.func_74519_b(); + if(Reflector.ForgeTileEntityRendererDispatcher_preDrawBatch.exists()) { + Reflector.call(TileEntityRendererDispatcher.field_147556_a, Reflector.ForgeTileEntityRendererDispatcher_preDrawBatch, new Object[0]); + } + + label1385: + for(RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 : this.renderInfosTileEntities) { + List list1 = renderglobal$containerlocalrenderinformation1.field_178036_a.func_178571_g().func_178485_b(); + if(!list1.isEmpty()) { + Iterator iterator2 = list1.iterator(); + + while(true) { + TileEntity tileentity; + while(true) { + if(!iterator2.hasNext()) { + continue label1385; + } + + tileentity = (TileEntity)iterator2.next(); + if(!flag1) { + break; + } + + if(Reflector.callBoolean(tileentity, Reflector.ForgeTileEntity_shouldRenderInPass, new Object[]{Integer.valueOf(i)})) { + AxisAlignedBB axisalignedbb = (AxisAlignedBB)Reflector.call(tileentity, Reflector.ForgeTileEntity_getRenderBoundingBox, new Object[0]); + if(axisalignedbb == null || p_180446_2_.func_78546_a(axisalignedbb)) { + break; + } + } + } + + Class oclass = tileentity.getClass(); + if(oclass == TileEntitySign.class && !Config.zoomMode) { + EntityPlayer entityplayer = this.field_72777_q.field_71439_g; + double d6 = tileentity.func_145835_a(entityplayer.field_70165_t, entityplayer.field_70163_u, entityplayer.field_70161_v); + if(d6 > 256.0D) { + fontrenderer.enabled = false; + } + } + + if(flag7) { + Shaders.nextBlockEntity(tileentity); + } + + TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_180446_3_, -1); + ++this.countTileEntitiesRendered; + fontrenderer.enabled = true; + } + } + } + + Set var32 = this.field_181024_n; + synchronized(this.field_181024_n) { + for(TileEntity tileentity1 : this.field_181024_n) { + if(flag1) { + if(!Reflector.callBoolean(tileentity1, Reflector.ForgeTileEntity_shouldRenderInPass, new Object[]{Integer.valueOf(i)})) { + continue; + } + + AxisAlignedBB axisalignedbb1 = (AxisAlignedBB)Reflector.call(tileentity1, Reflector.ForgeTileEntity_getRenderBoundingBox, new Object[0]); + if(axisalignedbb1 != null && !p_180446_2_.func_78546_a(axisalignedbb1)) { + continue; + } + } + + Class oclass1 = tileentity1.getClass(); + if(oclass1 == TileEntitySign.class && !Config.zoomMode) { + EntityPlayer entityplayer1 = this.field_72777_q.field_71439_g; + double d7 = tileentity1.func_145835_a(entityplayer1.field_70165_t, entityplayer1.field_70163_u, entityplayer1.field_70161_v); + if(d7 > 256.0D) { + fontrenderer.enabled = false; + } + } + + if(flag7) { + Shaders.nextBlockEntity(tileentity1); + } + + TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity1, p_180446_3_, -1); + fontrenderer.enabled = true; + } + } + + if(Reflector.ForgeTileEntityRendererDispatcher_drawBatch.exists()) { + Reflector.call(TileEntityRendererDispatcher.field_147556_a, Reflector.ForgeTileEntityRendererDispatcher_drawBatch, new Object[]{Integer.valueOf(i)}); + } + + this.func_180443_s(); + + for(DestroyBlockProgress destroyblockprogress : this.field_72738_E.values()) { + BlockPos blockpos = destroyblockprogress.func_180246_b(); + TileEntity tileentity2 = this.field_72769_h.func_175625_s(blockpos); + if(tileentity2 instanceof TileEntityChest) { + TileEntityChest tileentitychest = (TileEntityChest)tileentity2; + if(tileentitychest.field_145991_k != null) { + blockpos = blockpos.func_177972_a(EnumFacing.WEST); + tileentity2 = this.field_72769_h.func_175625_s(blockpos); + } else if(tileentitychest.field_145992_i != null) { + blockpos = blockpos.func_177972_a(EnumFacing.NORTH); + tileentity2 = this.field_72769_h.func_175625_s(blockpos); + } + } + + Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); + boolean flag8; + if(flag1) { + flag8 = false; + if(tileentity2 != null && Reflector.callBoolean(tileentity2, Reflector.ForgeTileEntity_shouldRenderInPass, new Object[]{Integer.valueOf(i)}) && Reflector.callBoolean(tileentity2, Reflector.ForgeTileEntity_canRenderBreaking, new Object[0])) { + AxisAlignedBB axisalignedbb2 = (AxisAlignedBB)Reflector.call(tileentity2, Reflector.ForgeTileEntity_getRenderBoundingBox, new Object[0]); + if(axisalignedbb2 != null) { + flag8 = p_180446_2_.func_78546_a(axisalignedbb2); + } + } + } else { + flag8 = tileentity2 != null && (block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull); + } + + if(flag8) { + if(flag7) { + Shaders.nextBlockEntity(tileentity2); + } + + TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity2, p_180446_3_, destroyblockprogress.func_73106_e()); + } + } + + this.func_174969_t(); + this.field_72777_q.field_71460_t.func_175072_h(); + this.field_72777_q.field_71424_I.func_76319_b(); + } + + } + + public String func_72735_c() { + int i = this.field_175008_n.field_178164_f.length; + int j = 0; + + for(RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation : this.field_72755_R) { + CompiledChunk compiledchunk = renderglobal$containerlocalrenderinformation.field_178036_a.field_178590_b; + if(compiledchunk != CompiledChunk.field_178502_a && !compiledchunk.func_178489_a()) { + ++j; + } + } + + return String.format("C: %d/%d %sD: %d, %s", new Object[]{Integer.valueOf(j), Integer.valueOf(i), this.field_72777_q.field_175612_E?"(s) ":"", Integer.valueOf(this.field_72739_F), this.field_174995_M.func_178504_a()}); + } + + public String func_72723_d() { + return "E: " + this.field_72749_I + "/" + this.field_72748_H + ", B: " + this.field_72750_J + ", I: " + (this.field_72748_H - this.field_72750_J - this.field_72749_I) + ", " + Config.getVersionDebug(); + } + + public void func_174970_a(Entity p_174970_1_, double p_174970_2_, ICamera p_174970_4_, int p_174970_5_, boolean p_174970_6_) { + if(this.field_72777_q.field_71474_y.field_151451_c != this.field_72739_F) { + this.func_72712_a(); + } + + this.field_72769_h.field_72984_F.func_76320_a("camera"); + double d0 = p_174970_1_.field_70165_t - this.field_174992_B; + double d1 = p_174970_1_.field_70163_u - this.field_174993_C; + double d2 = p_174970_1_.field_70161_v - this.field_174987_D; + if(this.field_174988_E != p_174970_1_.field_70176_ah || this.field_174989_F != p_174970_1_.field_70162_ai || this.field_174990_G != p_174970_1_.field_70164_aj || d0 * d0 + d1 * d1 + d2 * d2 > 16.0D) { + this.field_174992_B = p_174970_1_.field_70165_t; + this.field_174993_C = p_174970_1_.field_70163_u; + this.field_174987_D = p_174970_1_.field_70161_v; + this.field_174988_E = p_174970_1_.field_70176_ah; + this.field_174989_F = p_174970_1_.field_70162_ai; + this.field_174990_G = p_174970_1_.field_70164_aj; + this.field_175008_n.func_178163_a(p_174970_1_.field_70165_t, p_174970_1_.field_70161_v); + } + + if(Config.isDynamicLights()) { + DynamicLights.update(this); + } + + this.field_72769_h.field_72984_F.func_76318_c("renderlistcamera"); + double d3 = p_174970_1_.field_70142_S + (p_174970_1_.field_70165_t - p_174970_1_.field_70142_S) * p_174970_2_; + double d4 = p_174970_1_.field_70137_T + (p_174970_1_.field_70163_u - p_174970_1_.field_70137_T) * p_174970_2_; + double d5 = p_174970_1_.field_70136_U + (p_174970_1_.field_70161_v - p_174970_1_.field_70136_U) * p_174970_2_; + this.field_174996_N.func_178004_a(d3, d4, d5); + this.field_72769_h.field_72984_F.func_76318_c("cull"); + if(this.field_175001_U != null) { + Frustum frustum = new Frustum(this.field_175001_U); + frustum.func_78547_a(this.field_175003_W.field_181059_a, this.field_175003_W.field_181060_b, this.field_175003_W.field_181061_c); + p_174970_4_ = frustum; + } + + this.field_72777_q.field_71424_I.func_76318_c("culling"); + BlockPos blockpos2 = new BlockPos(d3, d4 + (double)p_174970_1_.func_70047_e(), d5); + RenderChunk renderchunk = this.field_175008_n.func_178161_a(blockpos2); + BlockPos blockpos = new BlockPos(MathHelper.func_76128_c(d3 / 16.0D) * 16, MathHelper.func_76128_c(d4 / 16.0D) * 16, MathHelper.func_76128_c(d5 / 16.0D) * 16); + this.field_147595_R = this.field_147595_R || !this.field_175009_l.isEmpty() || p_174970_1_.field_70165_t != this.field_174997_H || p_174970_1_.field_70163_u != this.field_174998_I || p_174970_1_.field_70161_v != this.field_174999_J || (double)p_174970_1_.field_70125_A != this.field_175000_K || (double)p_174970_1_.field_70177_z != this.field_174994_L; + this.field_174997_H = p_174970_1_.field_70165_t; + this.field_174998_I = p_174970_1_.field_70163_u; + this.field_174999_J = p_174970_1_.field_70161_v; + this.field_175000_K = (double)p_174970_1_.field_70125_A; + this.field_174994_L = (double)p_174970_1_.field_70177_z; + boolean flag = this.field_175001_U != null; + Lagometer.timerVisibility.start(); + if(Shaders.isShadowPass) { + this.field_72755_R = this.renderInfosShadow; + this.renderInfosEntities = this.renderInfosEntitiesShadow; + this.renderInfosTileEntities = this.renderInfosTileEntitiesShadow; + if(!flag && this.field_147595_R) { + this.field_72755_R.clear(); + this.renderInfosEntities.clear(); + this.renderInfosTileEntities.clear(); + RenderInfoLazy renderinfolazy = new RenderInfoLazy(); + Iterator iterator = ShadowUtils.makeShadowChunkIterator(this.field_72769_h, p_174970_2_, p_174970_1_, this.field_72739_F, this.field_175008_n); + + while(iterator.hasNext()) { + RenderChunk renderchunk1 = (RenderChunk)iterator.next(); + if(renderchunk1 != null) { + renderinfolazy.setRenderChunk(renderchunk1); + if(!renderchunk1.field_178590_b.func_178489_a() || renderchunk1.func_178569_m()) { + this.field_72755_R.add(renderinfolazy.getRenderInfo()); + } + + BlockPos blockpos1 = renderchunk1.func_178568_j(); + if(ChunkUtils.hasEntities(this.field_72769_h.func_175726_f(blockpos1))) { + this.renderInfosEntities.add(renderinfolazy.getRenderInfo()); + } + + if(renderchunk1.func_178571_g().func_178485_b().size() > 0) { + this.renderInfosTileEntities.add(renderinfolazy.getRenderInfo()); + } + } + } + } + } else { + this.field_72755_R = this.renderInfosNormal; + this.renderInfosEntities = this.renderInfosEntitiesNormal; + this.renderInfosTileEntities = this.renderInfosTileEntitiesNormal; + } + + if(!flag && this.field_147595_R && !Shaders.isShadowPass) { + this.field_147595_R = false; + this.field_72755_R.clear(); + this.renderInfosEntities.clear(); + this.renderInfosTileEntities.clear(); + this.visibilityDeque.clear(); + Deque deque = this.visibilityDeque; + boolean flag1 = this.field_72777_q.field_175612_E; + if(renderchunk != null) { + boolean flag2 = false; + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation3 = new RenderGlobal.ContainerLocalRenderInformation(renderchunk, (EnumFacing)null, 0, (Object)null); + Set set1 = SET_ALL_FACINGS; + if(set1.size() == 1) { + Vector3f vector3f = this.func_174962_a(p_174970_1_, p_174970_2_); + EnumFacing enumfacing = EnumFacing.func_176737_a(vector3f.x, vector3f.y, vector3f.z).func_176734_d(); + set1.remove(enumfacing); + } + + if(set1.isEmpty()) { + flag2 = true; + } + + if(flag2 && !p_174970_6_) { + this.field_72755_R.add(renderglobal$containerlocalrenderinformation3); + } else { + if(p_174970_6_ && this.field_72769_h.func_180495_p(blockpos2).func_177230_c().func_149662_c()) { + flag1 = false; + } + + renderchunk.func_178577_a(p_174970_5_); + deque.add(renderglobal$containerlocalrenderinformation3); + } + } else { + int i = blockpos2.func_177956_o() > 0?248:8; + + for(int j = -this.field_72739_F; j <= this.field_72739_F; ++j) { + for(int k = -this.field_72739_F; k <= this.field_72739_F; ++k) { + RenderChunk renderchunk2 = this.field_175008_n.func_178161_a(new BlockPos((j << 4) + 8, i, (k << 4) + 8)); + if(renderchunk2 != null && ((ICamera)p_174970_4_).func_78546_a(renderchunk2.field_178591_c)) { + renderchunk2.func_178577_a(p_174970_5_); + deque.add(new RenderGlobal.ContainerLocalRenderInformation(renderchunk2, (EnumFacing)null, 0, (Object)null)); + } + } + } + } + + EnumFacing[] aenumfacing = EnumFacing.field_82609_l; + int l = aenumfacing.length; + + while(!deque.isEmpty()) { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 = (RenderGlobal.ContainerLocalRenderInformation)deque.poll(); + RenderChunk renderchunk4 = renderglobal$containerlocalrenderinformation1.field_178036_a; + EnumFacing enumfacing2 = renderglobal$containerlocalrenderinformation1.field_178034_b; + BlockPos blockpos3 = renderchunk4.func_178568_j(); + if(!renderchunk4.field_178590_b.func_178489_a() || renderchunk4.func_178569_m()) { + this.field_72755_R.add(renderglobal$containerlocalrenderinformation1); + } + + if(ChunkUtils.hasEntities(this.field_72769_h.func_175726_f(blockpos3))) { + this.renderInfosEntities.add(renderglobal$containerlocalrenderinformation1); + } + + if(renderchunk4.func_178571_g().func_178485_b().size() > 0) { + this.renderInfosTileEntities.add(renderglobal$containerlocalrenderinformation1); + } + + for(int i1 = 0; i1 < l; ++i1) { + EnumFacing enumfacing1 = aenumfacing[i1]; + if((!flag1 || !renderglobal$containerlocalrenderinformation1.field_178035_c.contains(enumfacing1.func_176734_d())) && (!flag1 || enumfacing2 == null || renderchunk4.func_178571_g().func_178495_a(enumfacing2.func_176734_d(), enumfacing1))) { + RenderChunk renderchunk3 = this.func_181562_a(blockpos2, renderchunk4, enumfacing1); + if(renderchunk3 != null && renderchunk3.func_178577_a(p_174970_5_) && ((ICamera)p_174970_4_).func_78546_a(renderchunk3.field_178591_c)) { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation = new RenderGlobal.ContainerLocalRenderInformation(renderchunk3, enumfacing1, renderglobal$containerlocalrenderinformation1.field_178032_d + 1, (Object)null); + renderglobal$containerlocalrenderinformation.field_178035_c.addAll(renderglobal$containerlocalrenderinformation1.field_178035_c); + renderglobal$containerlocalrenderinformation.field_178035_c.add(enumfacing1); + deque.add(renderglobal$containerlocalrenderinformation); + } + } + } + } + } + + if(this.field_175002_T) { + this.func_174984_a(d3, d4, d5); + this.field_175002_T = false; + } + + Lagometer.timerVisibility.end(); + if(Shaders.isShadowPass) { + Shaders.mcProfilerEndSection(); + } else { + this.field_174995_M.func_178513_e(); + Set set = this.field_175009_l; + this.field_175009_l = Sets.newLinkedHashSet(); + Iterator iterator1 = this.field_72755_R.iterator(); + Lagometer.timerChunkUpdate.start(); + + while(iterator1.hasNext()) { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation2 = (RenderGlobal.ContainerLocalRenderInformation)iterator1.next(); + RenderChunk renderchunk5 = renderglobal$containerlocalrenderinformation2.field_178036_a; + if(renderchunk5.func_178569_m() || set.contains(renderchunk5)) { + this.field_147595_R = true; + if(this.func_174983_a(blockpos, renderglobal$containerlocalrenderinformation2.field_178036_a)) { + if(!renderchunk5.isPlayerUpdate()) { + this.chunksToUpdateForced.add(renderchunk5); + } else { + this.field_72777_q.field_71424_I.func_76320_a("build near"); + this.field_174995_M.func_178505_b(renderchunk5); + renderchunk5.func_178575_a(false); + this.field_72777_q.field_71424_I.func_76319_b(); + } + } else { + this.field_175009_l.add(renderchunk5); + } + } + } + + Lagometer.timerChunkUpdate.end(); + this.field_175009_l.addAll(set); + this.field_72777_q.field_71424_I.func_76319_b(); + } + } + + private boolean func_174983_a(BlockPos p_174983_1_, RenderChunk p_174983_2_) { + BlockPos blockpos = p_174983_2_.func_178568_j(); + return MathHelper.func_76130_a(p_174983_1_.func_177958_n() - blockpos.func_177958_n()) > 16?false:(MathHelper.func_76130_a(p_174983_1_.func_177956_o() - blockpos.func_177956_o()) > 16?false:MathHelper.func_76130_a(p_174983_1_.func_177952_p() - blockpos.func_177952_p()) <= 16); + } + + private Set func_174978_c(BlockPos p_174978_1_) { + VisGraph visgraph = new VisGraph(); + BlockPos blockpos = new BlockPos(p_174978_1_.func_177958_n() >> 4 << 4, p_174978_1_.func_177956_o() >> 4 << 4, p_174978_1_.func_177952_p() >> 4 << 4); + Chunk chunk = this.field_72769_h.func_175726_f(blockpos); + + for(BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.func_177975_b(blockpos, blockpos.func_177982_a(15, 15, 15))) { + if(chunk.func_177428_a(blockpos$mutableblockpos).func_149662_c()) { + visgraph.func_178606_a(blockpos$mutableblockpos); + } + } + + return visgraph.func_178609_b(p_174978_1_); + } + + private RenderChunk func_181562_a(BlockPos p_181562_1_, RenderChunk p_181562_2_, EnumFacing p_181562_3_) { + BlockPos blockpos = p_181562_2_.getPositionOffset16(p_181562_3_); + if(blockpos.func_177956_o() >= 0 && blockpos.func_177956_o() < 256) { + int i = MathHelper.func_76130_a(p_181562_1_.func_177958_n() - blockpos.func_177958_n()); + int j = MathHelper.func_76130_a(p_181562_1_.func_177952_p() - blockpos.func_177952_p()); + if(Config.isFogOff()) { + if(i > this.renderDistance || j > this.renderDistance) { + return null; + } + } else { + int k = i * i + j * j; + if(k > this.renderDistanceSq) { + return null; + } + } + + return this.field_175008_n.func_178161_a(blockpos); + } else { + return null; + } + } + + private void func_174984_a(double p_174984_1_, double p_174984_3_, double p_174984_5_) { + this.field_175001_U = new ClippingHelperImpl(); + ((ClippingHelperImpl)this.field_175001_U).func_78560_b(); + Matrix4f matrix4f = new Matrix4f(this.field_175001_U.field_178626_c); + matrix4f.transpose(); + Matrix4f matrix4f1 = new Matrix4f(this.field_175001_U.field_178625_b); + matrix4f1.transpose(); + Matrix4f matrix4f2 = new Matrix4f(); + Matrix4f.mul(matrix4f1, matrix4f, matrix4f2); + matrix4f2.invert(); + this.field_175003_W.field_181059_a = p_174984_1_; + this.field_175003_W.field_181060_b = p_174984_3_; + this.field_175003_W.field_181061_c = p_174984_5_; + this.field_175004_V[0] = new Vector4f(-1.0F, -1.0F, -1.0F, 1.0F); + this.field_175004_V[1] = new Vector4f(1.0F, -1.0F, -1.0F, 1.0F); + this.field_175004_V[2] = new Vector4f(1.0F, 1.0F, -1.0F, 1.0F); + this.field_175004_V[3] = new Vector4f(-1.0F, 1.0F, -1.0F, 1.0F); + this.field_175004_V[4] = new Vector4f(-1.0F, -1.0F, 1.0F, 1.0F); + this.field_175004_V[5] = new Vector4f(1.0F, -1.0F, 1.0F, 1.0F); + this.field_175004_V[6] = new Vector4f(1.0F, 1.0F, 1.0F, 1.0F); + this.field_175004_V[7] = new Vector4f(-1.0F, 1.0F, 1.0F, 1.0F); + + for(int i = 0; i < 8; ++i) { + Matrix4f.transform(matrix4f2, this.field_175004_V[i], this.field_175004_V[i]); + this.field_175004_V[i].x /= this.field_175004_V[i].w; + this.field_175004_V[i].y /= this.field_175004_V[i].w; + this.field_175004_V[i].z /= this.field_175004_V[i].w; + this.field_175004_V[i].w = 1.0F; + } + + } + + protected Vector3f func_174962_a(Entity p_174962_1_, double p_174962_2_) { + float f = (float)((double)p_174962_1_.field_70127_C + (double)(p_174962_1_.field_70125_A - p_174962_1_.field_70127_C) * p_174962_2_); + float f1 = (float)((double)p_174962_1_.field_70126_B + (double)(p_174962_1_.field_70177_z - p_174962_1_.field_70126_B) * p_174962_2_); + if(Minecraft.func_71410_x().field_71474_y.field_74320_O == 2) { + f += 180.0F; + } + + float f2 = MathHelper.func_76134_b(-f1 * 0.017453292F - 3.1415927F); + float f3 = MathHelper.func_76126_a(-f1 * 0.017453292F - 3.1415927F); + float f4 = -MathHelper.func_76134_b(-f * 0.017453292F); + float f5 = MathHelper.func_76126_a(-f * 0.017453292F); + return new Vector3f(f3 * f4, f5, f2 * f4); + } + + public int func_174977_a(EnumWorldBlockLayer p_174977_1_, double p_174977_2_, int p_174977_4_, Entity p_174977_5_) { + RenderHelper.func_74518_a(); + if(p_174977_1_ == EnumWorldBlockLayer.TRANSLUCENT) { + this.field_72777_q.field_71424_I.func_76320_a("translucent_sort"); + double d0 = p_174977_5_.field_70165_t - this.field_147596_f; + double d1 = p_174977_5_.field_70163_u - this.field_147597_g; + double d2 = p_174977_5_.field_70161_v - this.field_147602_h; + if(d0 * d0 + d1 * d1 + d2 * d2 > 1.0D) { + this.field_147596_f = p_174977_5_.field_70165_t; + this.field_147597_g = p_174977_5_.field_70163_u; + this.field_147602_h = p_174977_5_.field_70161_v; + int k = 0; + Iterator iterator = this.field_72755_R.iterator(); + this.chunksToResortTransparency.clear(); + + while(iterator.hasNext()) { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation = (RenderGlobal.ContainerLocalRenderInformation)iterator.next(); + if(renderglobal$containerlocalrenderinformation.field_178036_a.field_178590_b.func_178492_d(p_174977_1_) && k++ < 15) { + this.chunksToResortTransparency.add(renderglobal$containerlocalrenderinformation.field_178036_a); + } + } + } + + this.field_72777_q.field_71424_I.func_76319_b(); + } + + this.field_72777_q.field_71424_I.func_76320_a("filterempty"); + int l = 0; + boolean flag = p_174977_1_ == EnumWorldBlockLayer.TRANSLUCENT; + int i1 = flag?this.field_72755_R.size() - 1:0; + int i = flag?-1:this.field_72755_R.size(); + int j1 = flag?-1:1; + + for(int j = i1; j != i; j += j1) { + RenderChunk renderchunk = ((RenderGlobal.ContainerLocalRenderInformation)this.field_72755_R.get(j)).field_178036_a; + if(!renderchunk.func_178571_g().func_178491_b(p_174977_1_)) { + ++l; + this.field_174996_N.func_178002_a(renderchunk, p_174977_1_); + } + } + + if(l == 0) { + this.field_72777_q.field_71424_I.func_76319_b(); + return l; + } else { + if(Config.isFogOff() && this.field_72777_q.field_71460_t.fogStandard) { + GlStateManager.func_179106_n(); + } + + this.field_72777_q.field_71424_I.func_76318_c("render_" + p_174977_1_); + this.func_174982_a(p_174977_1_); + this.field_72777_q.field_71424_I.func_76319_b(); + return l; + } + } + + private void func_174982_a(EnumWorldBlockLayer p_174982_1_) { + this.field_72777_q.field_71460_t.func_180436_i(); + if(OpenGlHelper.func_176075_f()) { + GL11.glEnableClientState('\u8074'); + OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); + GL11.glEnableClientState('\u8078'); + OpenGlHelper.func_77472_b(OpenGlHelper.field_77476_b); + GL11.glEnableClientState('\u8078'); + OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); + GL11.glEnableClientState('\u8076'); + } + + if(Config.isShaders()) { + ShadersRender.preRenderChunkLayer(p_174982_1_); + } + + this.field_174996_N.func_178001_a(p_174982_1_); + if(Config.isShaders()) { + ShadersRender.postRenderChunkLayer(p_174982_1_); + } + + if(OpenGlHelper.func_176075_f()) { + for(VertexFormatElement vertexformatelement : DefaultVertexFormats.field_176600_a.func_177343_g()) { + VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.func_177375_c(); + int i = vertexformatelement.func_177369_e(); + switch(RenderGlobal.RenderGlobal$2.field_178037_a[vertexformatelement$enumusage.ordinal()]) { + case 1: + GL11.glDisableClientState('\u8074'); + break; + case 2: + OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + i); + GL11.glDisableClientState('\u8078'); + OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); + break; + case 3: + GL11.glDisableClientState('\u8076'); + GlStateManager.func_179117_G(); + } + } + } + + this.field_72777_q.field_71460_t.func_175072_h(); + } + + private void func_174965_a(Iterator p_174965_1_) { + while(p_174965_1_.hasNext()) { + DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)p_174965_1_.next(); + int i = destroyblockprogress.func_82743_f(); + if(this.field_72773_u - i > 400) { + p_174965_1_.remove(); + } + } + + } + + public void func_72734_e() { + if(Config.isShaders() && Keyboard.isKeyDown(61) && Keyboard.isKeyDown(19)) { + Shaders.uninit(); + Shaders.loadShaderPack(); + } + + ++this.field_72773_u; + if(this.field_72773_u % 20 == 0) { + this.func_174965_a(this.field_72738_E.values().iterator()); + } + + } + + private void func_180448_r() { + if(Config.isSkyEnabled()) { + GlStateManager.func_179106_n(); + GlStateManager.func_179118_c(); + GlStateManager.func_179147_l(); + GlStateManager.func_179120_a(770, 771, 1, 0); + RenderHelper.func_74518_a(); + GlStateManager.func_179132_a(false); + this.field_72770_i.func_110577_a(field_110926_k); + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + + for(int i = 0; i < 6; ++i) { + GlStateManager.func_179094_E(); + if(i == 1) { + GlStateManager.func_179114_b(90.0F, 1.0F, 0.0F, 0.0F); + } + + if(i == 2) { + GlStateManager.func_179114_b(-90.0F, 1.0F, 0.0F, 0.0F); + } + + if(i == 3) { + GlStateManager.func_179114_b(180.0F, 1.0F, 0.0F, 0.0F); + } + + if(i == 4) { + GlStateManager.func_179114_b(90.0F, 0.0F, 0.0F, 1.0F); + } + + if(i == 5) { + GlStateManager.func_179114_b(-90.0F, 0.0F, 0.0F, 1.0F); + } + + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181709_i); + worldrenderer.func_181662_b(-100.0D, -100.0D, -100.0D).func_181673_a(0.0D, 0.0D).func_181669_b(40, 40, 40, 255).func_181675_d(); + worldrenderer.func_181662_b(-100.0D, -100.0D, 100.0D).func_181673_a(0.0D, 16.0D).func_181669_b(40, 40, 40, 255).func_181675_d(); + worldrenderer.func_181662_b(100.0D, -100.0D, 100.0D).func_181673_a(16.0D, 16.0D).func_181669_b(40, 40, 40, 255).func_181675_d(); + worldrenderer.func_181662_b(100.0D, -100.0D, -100.0D).func_181673_a(16.0D, 0.0D).func_181669_b(40, 40, 40, 255).func_181675_d(); + tessellator.func_78381_a(); + GlStateManager.func_179121_F(); + } + + GlStateManager.func_179132_a(true); + GlStateManager.func_179098_w(); + GlStateManager.func_179141_d(); + } + } + + public void func_174976_a(float p_174976_1_, int p_174976_2_) { + if(Reflector.ForgeWorldProvider_getSkyRenderer.exists()) { + WorldProvider worldprovider = this.field_72777_q.field_71441_e.field_73011_w; + Object object = Reflector.call(worldprovider, Reflector.ForgeWorldProvider_getSkyRenderer, new Object[0]); + if(object != null) { + Reflector.callVoid(object, Reflector.IRenderHandler_render, new Object[]{Float.valueOf(p_174976_1_), this.field_72769_h, this.field_72777_q}); + return; + } + } + + if(this.field_72777_q.field_71441_e.field_73011_w.func_177502_q() == 1) { + this.func_180448_r(); + } else if(this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) { + GlStateManager.func_179090_x(); + boolean flag1 = Config.isShaders(); + if(flag1) { + Shaders.disableTexture2D(); + } + + Vec3 vec3 = this.field_72769_h.func_72833_a(this.field_72777_q.func_175606_aa(), p_174976_1_); + vec3 = CustomColors.getSkyColor(vec3, this.field_72777_q.field_71441_e, this.field_72777_q.func_175606_aa().field_70165_t, this.field_72777_q.func_175606_aa().field_70163_u + 1.0D, this.field_72777_q.func_175606_aa().field_70161_v); + if(flag1) { + Shaders.setSkyColor(vec3); + } + + float f = (float)vec3.field_72450_a; + float f1 = (float)vec3.field_72448_b; + float f2 = (float)vec3.field_72449_c; + if(p_174976_2_ != 2) { + float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F; + float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F; + float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F; + f = f3; + f1 = f4; + f2 = f5; + } + + GlStateManager.func_179124_c(f, f1, f2); + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + GlStateManager.func_179132_a(false); + GlStateManager.func_179127_m(); + if(flag1) { + Shaders.enableFog(); + } + + GlStateManager.func_179124_c(f, f1, f2); + if(flag1) { + Shaders.preSkyList(); + } + + if(Config.isSkyEnabled()) { + if(this.field_175005_X) { + this.field_175012_t.func_177359_a(); + GL11.glEnableClientState('\u8074'); + GL11.glVertexPointer(3, 5126, 12, 0L); + this.field_175012_t.func_177358_a(7); + this.field_175012_t.func_177361_b(); + GL11.glDisableClientState('\u8074'); + } else { + GlStateManager.func_179148_o(this.field_72771_w); + } + } + + GlStateManager.func_179106_n(); + if(flag1) { + Shaders.disableFog(); + } + + GlStateManager.func_179118_c(); + GlStateManager.func_179147_l(); + GlStateManager.func_179120_a(770, 771, 1, 0); + RenderHelper.func_74518_a(); + float[] afloat = this.field_72769_h.field_73011_w.func_76560_a(this.field_72769_h.func_72826_c(p_174976_1_), p_174976_1_); + if(afloat != null && Config.isSunMoonEnabled()) { + GlStateManager.func_179090_x(); + if(flag1) { + Shaders.disableTexture2D(); + } + + GlStateManager.func_179103_j(7425); + GlStateManager.func_179094_E(); + GlStateManager.func_179114_b(90.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.func_179114_b(MathHelper.func_76126_a(this.field_72769_h.func_72929_e(p_174976_1_)) < 0.0F?180.0F:0.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.func_179114_b(90.0F, 0.0F, 0.0F, 1.0F); + float f6 = afloat[0]; + float f7 = afloat[1]; + float f8 = afloat[2]; + if(p_174976_2_ != 2) { + float f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F; + float f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F; + float f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F; + f6 = f9; + f7 = f10; + f8 = f11; + } + + worldrenderer.func_181668_a(6, DefaultVertexFormats.field_181706_f); + worldrenderer.func_181662_b(0.0D, 100.0D, 0.0D).func_181666_a(f6, f7, f8, afloat[3]).func_181675_d(); + boolean flag = true; + + for(int i = 0; i <= 16; ++i) { + float f20 = (float)i * 3.1415927F * 2.0F / 16.0F; + float f12 = MathHelper.func_76126_a(f20); + float f13 = MathHelper.func_76134_b(f20); + worldrenderer.func_181662_b((double)(f12 * 120.0F), (double)(f13 * 120.0F), (double)(-f13 * 40.0F * afloat[3])).func_181666_a(afloat[0], afloat[1], afloat[2], 0.0F).func_181675_d(); + } + + tessellator.func_78381_a(); + GlStateManager.func_179121_F(); + GlStateManager.func_179103_j(7424); + } + + GlStateManager.func_179098_w(); + if(flag1) { + Shaders.enableTexture2D(); + } + + GlStateManager.func_179120_a(770, 1, 1, 0); + GlStateManager.func_179094_E(); + float f15 = 1.0F - this.field_72769_h.func_72867_j(p_174976_1_); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, f15); + GlStateManager.func_179114_b(-90.0F, 0.0F, 1.0F, 0.0F); + CustomSky.renderSky(this.field_72769_h, this.field_72770_i, this.field_72769_h.func_72826_c(p_174976_1_), f15); + if(flag1) { + Shaders.preCelestialRotate(); + } + + GlStateManager.func_179114_b(this.field_72769_h.func_72826_c(p_174976_1_) * 360.0F, 1.0F, 0.0F, 0.0F); + if(flag1) { + Shaders.postCelestialRotate(); + } + + float f16 = 30.0F; + if(Config.isSunTexture()) { + this.field_72770_i.func_110577_a(field_110928_i); + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181707_g); + worldrenderer.func_181662_b((double)(-f16), 100.0D, (double)(-f16)).func_181673_a(0.0D, 0.0D).func_181675_d(); + worldrenderer.func_181662_b((double)f16, 100.0D, (double)(-f16)).func_181673_a(1.0D, 0.0D).func_181675_d(); + worldrenderer.func_181662_b((double)f16, 100.0D, (double)f16).func_181673_a(1.0D, 1.0D).func_181675_d(); + worldrenderer.func_181662_b((double)(-f16), 100.0D, (double)f16).func_181673_a(0.0D, 1.0D).func_181675_d(); + tessellator.func_78381_a(); + } + + f16 = 20.0F; + if(Config.isMoonTexture()) { + this.field_72770_i.func_110577_a(field_110927_h); + int l = this.field_72769_h.func_72853_d(); + int j = l % 4; + int k = l / 4 % 2; + float f21 = (float)(j + 0) / 4.0F; + float f22 = (float)(k + 0) / 2.0F; + float f23 = (float)(j + 1) / 4.0F; + float f14 = (float)(k + 1) / 2.0F; + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181707_g); + worldrenderer.func_181662_b((double)(-f16), -100.0D, (double)f16).func_181673_a((double)f23, (double)f14).func_181675_d(); + worldrenderer.func_181662_b((double)f16, -100.0D, (double)f16).func_181673_a((double)f21, (double)f14).func_181675_d(); + worldrenderer.func_181662_b((double)f16, -100.0D, (double)(-f16)).func_181673_a((double)f21, (double)f22).func_181675_d(); + worldrenderer.func_181662_b((double)(-f16), -100.0D, (double)(-f16)).func_181673_a((double)f23, (double)f22).func_181675_d(); + tessellator.func_78381_a(); + } + + GlStateManager.func_179090_x(); + if(flag1) { + Shaders.disableTexture2D(); + } + + float f24 = this.field_72769_h.func_72880_h(p_174976_1_) * f15; + if(f24 > 0.0F && Config.isStarsEnabled() && !CustomSky.hasSkyLayers(this.field_72769_h)) { + GlStateManager.func_179131_c(f24, f24, f24, f24); + if(this.field_175005_X) { + this.field_175013_s.func_177359_a(); + GL11.glEnableClientState('\u8074'); + GL11.glVertexPointer(3, 5126, 12, 0L); + this.field_175013_s.func_177358_a(7); + this.field_175013_s.func_177361_b(); + GL11.glDisableClientState('\u8074'); + } else { + GlStateManager.func_179148_o(this.field_72772_v); + } + } + + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.func_179084_k(); + GlStateManager.func_179141_d(); + GlStateManager.func_179127_m(); + if(flag1) { + Shaders.enableFog(); + } + + GlStateManager.func_179121_F(); + GlStateManager.func_179090_x(); + if(flag1) { + Shaders.disableTexture2D(); + } + + GlStateManager.func_179124_c(0.0F, 0.0F, 0.0F); + double d0 = this.field_72777_q.field_71439_g.func_174824_e(p_174976_1_).field_72448_b - this.field_72769_h.func_72919_O(); + if(d0 < 0.0D) { + GlStateManager.func_179094_E(); + GlStateManager.func_179109_b(0.0F, 12.0F, 0.0F); + if(this.field_175005_X) { + this.field_175011_u.func_177359_a(); + GL11.glEnableClientState('\u8074'); + GL11.glVertexPointer(3, 5126, 12, 0L); + this.field_175011_u.func_177358_a(7); + this.field_175011_u.func_177361_b(); + GL11.glDisableClientState('\u8074'); + } else { + GlStateManager.func_179148_o(this.field_72781_x); + } + + GlStateManager.func_179121_F(); + float f17 = 1.0F; + float f18 = -((float)(d0 + 65.0D)); + float f19 = -1.0F; + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181706_f); + worldrenderer.func_181662_b(-1.0D, (double)f18, 1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(1.0D, (double)f18, 1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(1.0D, -1.0D, 1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(-1.0D, -1.0D, 1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(-1.0D, -1.0D, -1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(1.0D, -1.0D, -1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(1.0D, (double)f18, -1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(-1.0D, (double)f18, -1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(1.0D, -1.0D, -1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(1.0D, -1.0D, 1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(1.0D, (double)f18, 1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(1.0D, (double)f18, -1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(-1.0D, (double)f18, -1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(-1.0D, (double)f18, 1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(-1.0D, -1.0D, 1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(-1.0D, -1.0D, -1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(-1.0D, -1.0D, -1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(-1.0D, -1.0D, 1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(1.0D, -1.0D, 1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + worldrenderer.func_181662_b(1.0D, -1.0D, -1.0D).func_181669_b(0, 0, 0, 255).func_181675_d(); + tessellator.func_78381_a(); + } + + if(this.field_72769_h.field_73011_w.func_76561_g()) { + GlStateManager.func_179124_c(f * 0.2F + 0.04F, f1 * 0.2F + 0.04F, f2 * 0.6F + 0.1F); + } else { + GlStateManager.func_179124_c(f, f1, f2); + } + + if(this.field_72777_q.field_71474_y.field_151451_c <= 4) { + GlStateManager.func_179124_c(this.field_72777_q.field_71460_t.field_175080_Q, this.field_72777_q.field_71460_t.field_175082_R, this.field_72777_q.field_71460_t.field_175081_S); + } + + GlStateManager.func_179094_E(); + GlStateManager.func_179109_b(0.0F, -((float)(d0 - 16.0D)), 0.0F); + if(Config.isSkyEnabled()) { + GlStateManager.func_179148_o(this.field_72781_x); + } + + GlStateManager.func_179121_F(); + GlStateManager.func_179098_w(); + if(flag1) { + Shaders.enableTexture2D(); + } + + GlStateManager.func_179132_a(true); + } + + } + + public void func_180447_b(float p_180447_1_, int p_180447_2_) { + if(!Config.isCloudsOff()) { + if(Reflector.ForgeWorldProvider_getCloudRenderer.exists()) { + WorldProvider worldprovider = this.field_72777_q.field_71441_e.field_73011_w; + Object object = Reflector.call(worldprovider, Reflector.ForgeWorldProvider_getCloudRenderer, new Object[0]); + if(object != null) { + Reflector.callVoid(object, Reflector.IRenderHandler_render, new Object[]{Float.valueOf(p_180447_1_), this.field_72769_h, this.field_72777_q}); + return; + } + } + + if(this.field_72777_q.field_71441_e.field_73011_w.func_76569_d()) { + if(Config.isShaders()) { + Shaders.beginClouds(); + } + + if(Config.isCloudsFancy()) { + this.func_180445_c(p_180447_1_, p_180447_2_); + } else { + this.cloudRenderer.prepareToRender(false, this.field_72773_u, p_180447_1_); + p_180447_1_ = 0.0F; + GlStateManager.func_179129_p(); + float f9 = (float)(this.field_72777_q.func_175606_aa().field_70137_T + (this.field_72777_q.func_175606_aa().field_70163_u - this.field_72777_q.func_175606_aa().field_70137_T) * (double)p_180447_1_); + boolean flag = true; + boolean flag1 = true; + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + this.field_72770_i.func_110577_a(field_110925_j); + GlStateManager.func_179147_l(); + GlStateManager.func_179120_a(770, 771, 1, 0); + if(this.cloudRenderer.shouldUpdateGlList()) { + this.cloudRenderer.startUpdateGlList(); + Vec3 vec3 = this.field_72769_h.func_72824_f(p_180447_1_); + float f = (float)vec3.field_72450_a; + float f1 = (float)vec3.field_72448_b; + float f2 = (float)vec3.field_72449_c; + if(p_180447_2_ != 2) { + float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F; + float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F; + float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F; + f = f3; + f1 = f4; + f2 = f5; + } + + float f10 = 4.8828125E-4F; + double d2 = (double)((float)this.field_72773_u + p_180447_1_); + double d0 = this.field_72777_q.func_175606_aa().field_70169_q + (this.field_72777_q.func_175606_aa().field_70165_t - this.field_72777_q.func_175606_aa().field_70169_q) * (double)p_180447_1_ + d2 * 0.029999999329447746D; + double d1 = this.field_72777_q.func_175606_aa().field_70166_s + (this.field_72777_q.func_175606_aa().field_70161_v - this.field_72777_q.func_175606_aa().field_70166_s) * (double)p_180447_1_; + int i = MathHelper.func_76128_c(d0 / 2048.0D); + int j = MathHelper.func_76128_c(d1 / 2048.0D); + d0 = d0 - (double)(i * 2048); + d1 = d1 - (double)(j * 2048); + float f6 = this.field_72769_h.field_73011_w.func_76571_f() - f9 + 0.33F; + f6 = f6 + this.field_72777_q.field_71474_y.ofCloudsHeight * 128.0F; + float f7 = (float)(d0 * 4.8828125E-4D); + float f8 = (float)(d1 * 4.8828125E-4D); + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181709_i); + + for(int k = -256; k < 256; k += 32) { + for(int l = -256; l < 256; l += 32) { + worldrenderer.func_181662_b((double)(k + 0), (double)f6, (double)(l + 32)).func_181673_a((double)((float)(k + 0) * 4.8828125E-4F + f7), (double)((float)(l + 32) * 4.8828125E-4F + f8)).func_181666_a(f, f1, f2, 0.8F).func_181675_d(); + worldrenderer.func_181662_b((double)(k + 32), (double)f6, (double)(l + 32)).func_181673_a((double)((float)(k + 32) * 4.8828125E-4F + f7), (double)((float)(l + 32) * 4.8828125E-4F + f8)).func_181666_a(f, f1, f2, 0.8F).func_181675_d(); + worldrenderer.func_181662_b((double)(k + 32), (double)f6, (double)(l + 0)).func_181673_a((double)((float)(k + 32) * 4.8828125E-4F + f7), (double)((float)(l + 0) * 4.8828125E-4F + f8)).func_181666_a(f, f1, f2, 0.8F).func_181675_d(); + worldrenderer.func_181662_b((double)(k + 0), (double)f6, (double)(l + 0)).func_181673_a((double)((float)(k + 0) * 4.8828125E-4F + f7), (double)((float)(l + 0) * 4.8828125E-4F + f8)).func_181666_a(f, f1, f2, 0.8F).func_181675_d(); + } + } + + tessellator.func_78381_a(); + this.cloudRenderer.endUpdateGlList(); + } + + this.cloudRenderer.renderGlList(); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.func_179084_k(); + GlStateManager.func_179089_o(); + } + + if(Config.isShaders()) { + Shaders.endClouds(); + } + } + + } + } + + public boolean func_72721_a(double p_72721_1_, double p_72721_3_, double p_72721_5_, float p_72721_7_) { + return false; + } + + private void func_180445_c(float p_180445_1_, int p_180445_2_) { + this.cloudRenderer.prepareToRender(true, this.field_72773_u, p_180445_1_); + p_180445_1_ = 0.0F; + GlStateManager.func_179129_p(); + float f = (float)(this.field_72777_q.func_175606_aa().field_70137_T + (this.field_72777_q.func_175606_aa().field_70163_u - this.field_72777_q.func_175606_aa().field_70137_T) * (double)p_180445_1_); + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + float f1 = 12.0F; + float f2 = 4.0F; + double d0 = (double)((float)this.field_72773_u + p_180445_1_); + double d1 = (this.field_72777_q.func_175606_aa().field_70169_q + (this.field_72777_q.func_175606_aa().field_70165_t - this.field_72777_q.func_175606_aa().field_70169_q) * (double)p_180445_1_ + d0 * 0.029999999329447746D) / 12.0D; + double d2 = (this.field_72777_q.func_175606_aa().field_70166_s + (this.field_72777_q.func_175606_aa().field_70161_v - this.field_72777_q.func_175606_aa().field_70166_s) * (double)p_180445_1_) / 12.0D + 0.33000001311302185D; + float f3 = this.field_72769_h.field_73011_w.func_76571_f() - f + 0.33F; + f3 = f3 + this.field_72777_q.field_71474_y.ofCloudsHeight * 128.0F; + int i = MathHelper.func_76128_c(d1 / 2048.0D); + int j = MathHelper.func_76128_c(d2 / 2048.0D); + d1 = d1 - (double)(i * 2048); + d2 = d2 - (double)(j * 2048); + this.field_72770_i.func_110577_a(field_110925_j); + GlStateManager.func_179147_l(); + GlStateManager.func_179120_a(770, 771, 1, 0); + Vec3 vec3 = this.field_72769_h.func_72824_f(p_180445_1_); + float f4 = (float)vec3.field_72450_a; + float f5 = (float)vec3.field_72448_b; + float f6 = (float)vec3.field_72449_c; + if(p_180445_2_ != 2) { + float f7 = (f4 * 30.0F + f5 * 59.0F + f6 * 11.0F) / 100.0F; + float f8 = (f4 * 30.0F + f5 * 70.0F) / 100.0F; + float f9 = (f4 * 30.0F + f6 * 70.0F) / 100.0F; + f4 = f7; + f5 = f8; + f6 = f9; + } + + float f26 = f4 * 0.9F; + float f27 = f5 * 0.9F; + float f28 = f6 * 0.9F; + float f10 = f4 * 0.7F; + float f11 = f5 * 0.7F; + float f12 = f6 * 0.7F; + float f13 = f4 * 0.8F; + float f14 = f5 * 0.8F; + float f15 = f6 * 0.8F; + float f16 = 0.00390625F; + float f17 = (float)MathHelper.func_76128_c(d1) * 0.00390625F; + float f18 = (float)MathHelper.func_76128_c(d2) * 0.00390625F; + float f19 = (float)(d1 - (double)MathHelper.func_76128_c(d1)); + float f20 = (float)(d2 - (double)MathHelper.func_76128_c(d2)); + boolean flag = true; + boolean flag1 = true; + float f21 = 9.765625E-4F; + GlStateManager.func_179152_a(12.0F, 1.0F, 12.0F); + + for(int k = 0; k < 2; ++k) { + if(k == 0) { + GlStateManager.func_179135_a(false, false, false, false); + } else { + switch(p_180445_2_) { + case 0: + GlStateManager.func_179135_a(false, true, true, true); + break; + case 1: + GlStateManager.func_179135_a(true, false, false, true); + break; + case 2: + GlStateManager.func_179135_a(true, true, true, true); + } + } + + this.cloudRenderer.renderGlList(); + } + + if(this.cloudRenderer.shouldUpdateGlList()) { + this.cloudRenderer.startUpdateGlList(); + + for(int j1 = -3; j1 <= 4; ++j1) { + for(int l = -3; l <= 4; ++l) { + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181712_l); + float f22 = (float)(j1 * 8); + float f23 = (float)(l * 8); + float f24 = f22 - f19; + float f25 = f23 - f20; + if(f3 > -5.0F) { + worldrenderer.func_181662_b((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).func_181673_a((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).func_181666_a(f10, f11, f12, 0.8F).func_181663_c(0.0F, -1.0F, 0.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).func_181673_a((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).func_181666_a(f10, f11, f12, 0.8F).func_181663_c(0.0F, -1.0F, 0.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).func_181673_a((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).func_181666_a(f10, f11, f12, 0.8F).func_181663_c(0.0F, -1.0F, 0.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).func_181673_a((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).func_181666_a(f10, f11, f12, 0.8F).func_181663_c(0.0F, -1.0F, 0.0F).func_181675_d(); + } + + if(f3 <= 5.0F) { + worldrenderer.func_181662_b((double)(f24 + 0.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 8.0F)).func_181673_a((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).func_181666_a(f4, f5, f6, 0.8F).func_181663_c(0.0F, 1.0F, 0.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + 8.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 8.0F)).func_181673_a((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).func_181666_a(f4, f5, f6, 0.8F).func_181663_c(0.0F, 1.0F, 0.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + 8.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 0.0F)).func_181673_a((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).func_181666_a(f4, f5, f6, 0.8F).func_181663_c(0.0F, 1.0F, 0.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + 0.0F), (double)(f3 + 4.0F - 9.765625E-4F), (double)(f25 + 0.0F)).func_181673_a((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).func_181666_a(f4, f5, f6, 0.8F).func_181663_c(0.0F, 1.0F, 0.0F).func_181675_d(); + } + + if(j1 > -1) { + for(int i1 = 0; i1 < 8; ++i1) { + worldrenderer.func_181662_b((double)(f24 + (float)i1 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).func_181673_a((double)((f22 + (float)i1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).func_181666_a(f26, f27, f28, 0.8F).func_181663_c(-1.0F, 0.0F, 0.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + (float)i1 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + 8.0F)).func_181673_a((double)((f22 + (float)i1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).func_181666_a(f26, f27, f28, 0.8F).func_181663_c(-1.0F, 0.0F, 0.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + (float)i1 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + 0.0F)).func_181673_a((double)((f22 + (float)i1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).func_181666_a(f26, f27, f28, 0.8F).func_181663_c(-1.0F, 0.0F, 0.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + (float)i1 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).func_181673_a((double)((f22 + (float)i1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).func_181666_a(f26, f27, f28, 0.8F).func_181663_c(-1.0F, 0.0F, 0.0F).func_181675_d(); + } + } + + if(j1 <= 1) { + for(int k1 = 0; k1 < 8; ++k1) { + worldrenderer.func_181662_b((double)(f24 + (float)k1 + 1.0F - 9.765625E-4F), (double)(f3 + 0.0F), (double)(f25 + 8.0F)).func_181673_a((double)((f22 + (float)k1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).func_181666_a(f26, f27, f28, 0.8F).func_181663_c(1.0F, 0.0F, 0.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + (float)k1 + 1.0F - 9.765625E-4F), (double)(f3 + 4.0F), (double)(f25 + 8.0F)).func_181673_a((double)((f22 + (float)k1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 8.0F) * 0.00390625F + f18)).func_181666_a(f26, f27, f28, 0.8F).func_181663_c(1.0F, 0.0F, 0.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + (float)k1 + 1.0F - 9.765625E-4F), (double)(f3 + 4.0F), (double)(f25 + 0.0F)).func_181673_a((double)((f22 + (float)k1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).func_181666_a(f26, f27, f28, 0.8F).func_181663_c(1.0F, 0.0F, 0.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + (float)k1 + 1.0F - 9.765625E-4F), (double)(f3 + 0.0F), (double)(f25 + 0.0F)).func_181673_a((double)((f22 + (float)k1 + 0.5F) * 0.00390625F + f17), (double)((f23 + 0.0F) * 0.00390625F + f18)).func_181666_a(f26, f27, f28, 0.8F).func_181663_c(1.0F, 0.0F, 0.0F).func_181675_d(); + } + } + + if(l > -1) { + for(int l1 = 0; l1 < 8; ++l1) { + worldrenderer.func_181662_b((double)(f24 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + (float)l1 + 0.0F)).func_181673_a((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)l1 + 0.5F) * 0.00390625F + f18)).func_181666_a(f13, f14, f15, 0.8F).func_181663_c(0.0F, 0.0F, -1.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + 8.0F), (double)(f3 + 4.0F), (double)(f25 + (float)l1 + 0.0F)).func_181673_a((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)l1 + 0.5F) * 0.00390625F + f18)).func_181666_a(f13, f14, f15, 0.8F).func_181663_c(0.0F, 0.0F, -1.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + (float)l1 + 0.0F)).func_181673_a((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)l1 + 0.5F) * 0.00390625F + f18)).func_181666_a(f13, f14, f15, 0.8F).func_181663_c(0.0F, 0.0F, -1.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + (float)l1 + 0.0F)).func_181673_a((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)l1 + 0.5F) * 0.00390625F + f18)).func_181666_a(f13, f14, f15, 0.8F).func_181663_c(0.0F, 0.0F, -1.0F).func_181675_d(); + } + } + + if(l <= 1) { + for(int i2 = 0; i2 < 8; ++i2) { + worldrenderer.func_181662_b((double)(f24 + 0.0F), (double)(f3 + 4.0F), (double)(f25 + (float)i2 + 1.0F - 9.765625E-4F)).func_181673_a((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)i2 + 0.5F) * 0.00390625F + f18)).func_181666_a(f13, f14, f15, 0.8F).func_181663_c(0.0F, 0.0F, 1.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + 8.0F), (double)(f3 + 4.0F), (double)(f25 + (float)i2 + 1.0F - 9.765625E-4F)).func_181673_a((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)i2 + 0.5F) * 0.00390625F + f18)).func_181666_a(f13, f14, f15, 0.8F).func_181663_c(0.0F, 0.0F, 1.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + 8.0F), (double)(f3 + 0.0F), (double)(f25 + (float)i2 + 1.0F - 9.765625E-4F)).func_181673_a((double)((f22 + 8.0F) * 0.00390625F + f17), (double)((f23 + (float)i2 + 0.5F) * 0.00390625F + f18)).func_181666_a(f13, f14, f15, 0.8F).func_181663_c(0.0F, 0.0F, 1.0F).func_181675_d(); + worldrenderer.func_181662_b((double)(f24 + 0.0F), (double)(f3 + 0.0F), (double)(f25 + (float)i2 + 1.0F - 9.765625E-4F)).func_181673_a((double)((f22 + 0.0F) * 0.00390625F + f17), (double)((f23 + (float)i2 + 0.5F) * 0.00390625F + f18)).func_181666_a(f13, f14, f15, 0.8F).func_181663_c(0.0F, 0.0F, 1.0F).func_181675_d(); + } + } + + tessellator.func_78381_a(); + } + } + + this.cloudRenderer.endUpdateGlList(); + } + + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.func_179084_k(); + GlStateManager.func_179089_o(); + } + + public void func_174967_a(long p_174967_1_) { + p_174967_1_ = (long)((double)p_174967_1_ + 1.0E8D); + this.field_147595_R |= this.field_174995_M.func_178516_a(p_174967_1_); + if(this.chunksToUpdateForced.size() > 0) { + Iterator iterator = this.chunksToUpdateForced.iterator(); + + while(iterator.hasNext()) { + RenderChunk renderchunk = (RenderChunk)iterator.next(); + if(!this.field_174995_M.func_178507_a(renderchunk)) { + break; + } + + renderchunk.func_178575_a(false); + iterator.remove(); + this.field_175009_l.remove(renderchunk); + this.chunksToResortTransparency.remove(renderchunk); + } + } + + if(this.chunksToResortTransparency.size() > 0) { + Iterator iterator2 = this.chunksToResortTransparency.iterator(); + if(iterator2.hasNext()) { + RenderChunk renderchunk2 = (RenderChunk)iterator2.next(); + if(this.field_174995_M.func_178509_c(renderchunk2)) { + iterator2.remove(); + } + } + } + + int j = 0; + int k = Config.getUpdatesPerFrame(); + int i = k * 2; + Iterator iterator1 = this.field_175009_l.iterator(); + + while(iterator1.hasNext()) { + RenderChunk renderchunk1 = (RenderChunk)iterator1.next(); + if(!this.field_174995_M.func_178507_a(renderchunk1)) { + break; + } + + renderchunk1.func_178575_a(false); + iterator1.remove(); + if(renderchunk1.func_178571_g().func_178489_a() && k < i) { + ++k; + } + + ++j; + if(j >= k) { + break; + } + } + + } + + public void func_180449_a(Entity p_180449_1_, float p_180449_2_) { + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + WorldBorder worldborder = this.field_72769_h.func_175723_af(); + double d0 = (double)(this.field_72777_q.field_71474_y.field_151451_c * 16); + if(p_180449_1_.field_70165_t >= worldborder.func_177728_d() - d0 || p_180449_1_.field_70165_t <= worldborder.func_177726_b() + d0 || p_180449_1_.field_70161_v >= worldborder.func_177733_e() - d0 || p_180449_1_.field_70161_v <= worldborder.func_177736_c() + d0) { + double d1 = 1.0D - worldborder.func_177745_a(p_180449_1_) / d0; + d1 = Math.pow(d1, 4.0D); + double d2 = p_180449_1_.field_70142_S + (p_180449_1_.field_70165_t - p_180449_1_.field_70142_S) * (double)p_180449_2_; + double d3 = p_180449_1_.field_70137_T + (p_180449_1_.field_70163_u - p_180449_1_.field_70137_T) * (double)p_180449_2_; + double d4 = p_180449_1_.field_70136_U + (p_180449_1_.field_70161_v - p_180449_1_.field_70136_U) * (double)p_180449_2_; + GlStateManager.func_179147_l(); + GlStateManager.func_179120_a(770, 1, 1, 0); + this.field_72770_i.func_110577_a(field_175006_g); + GlStateManager.func_179132_a(false); + GlStateManager.func_179094_E(); + int i = worldborder.func_177734_a().func_177766_a(); + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; + GlStateManager.func_179131_c(f, f1, f2, (float)d1); + GlStateManager.func_179136_a(-3.0F, -3.0F); + GlStateManager.func_179088_q(); + GlStateManager.func_179092_a(516, 0.1F); + GlStateManager.func_179141_d(); + GlStateManager.func_179129_p(); + float f3 = (float)(Minecraft.func_71386_F() % 3000L) / 3000.0F; + float f4 = 0.0F; + float f5 = 0.0F; + float f6 = 128.0F; + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181707_g); + worldrenderer.func_178969_c(-d2, -d3, -d4); + double d5 = Math.max((double)MathHelper.func_76128_c(d4 - d0), worldborder.func_177736_c()); + double d6 = Math.min((double)MathHelper.func_76143_f(d4 + d0), worldborder.func_177733_e()); + if(d2 > worldborder.func_177728_d() - d0) { + float f7 = 0.0F; + + for(double d7 = d5; d7 < d6; f7 += 0.5F) { + double d8 = Math.min(1.0D, d6 - d7); + float f8 = (float)d8 * 0.5F; + worldrenderer.func_181662_b(worldborder.func_177728_d(), 256.0D, d7).func_181673_a((double)(f3 + f7), (double)(f3 + 0.0F)).func_181675_d(); + worldrenderer.func_181662_b(worldborder.func_177728_d(), 256.0D, d7 + d8).func_181673_a((double)(f3 + f8 + f7), (double)(f3 + 0.0F)).func_181675_d(); + worldrenderer.func_181662_b(worldborder.func_177728_d(), 0.0D, d7 + d8).func_181673_a((double)(f3 + f8 + f7), (double)(f3 + 128.0F)).func_181675_d(); + worldrenderer.func_181662_b(worldborder.func_177728_d(), 0.0D, d7).func_181673_a((double)(f3 + f7), (double)(f3 + 128.0F)).func_181675_d(); + ++d7; + } + } + + if(d2 < worldborder.func_177726_b() + d0) { + float f9 = 0.0F; + + for(double d9 = d5; d9 < d6; f9 += 0.5F) { + double d12 = Math.min(1.0D, d6 - d9); + float f12 = (float)d12 * 0.5F; + worldrenderer.func_181662_b(worldborder.func_177726_b(), 256.0D, d9).func_181673_a((double)(f3 + f9), (double)(f3 + 0.0F)).func_181675_d(); + worldrenderer.func_181662_b(worldborder.func_177726_b(), 256.0D, d9 + d12).func_181673_a((double)(f3 + f12 + f9), (double)(f3 + 0.0F)).func_181675_d(); + worldrenderer.func_181662_b(worldborder.func_177726_b(), 0.0D, d9 + d12).func_181673_a((double)(f3 + f12 + f9), (double)(f3 + 128.0F)).func_181675_d(); + worldrenderer.func_181662_b(worldborder.func_177726_b(), 0.0D, d9).func_181673_a((double)(f3 + f9), (double)(f3 + 128.0F)).func_181675_d(); + ++d9; + } + } + + d5 = Math.max((double)MathHelper.func_76128_c(d2 - d0), worldborder.func_177726_b()); + d6 = Math.min((double)MathHelper.func_76143_f(d2 + d0), worldborder.func_177728_d()); + if(d4 > worldborder.func_177733_e() - d0) { + float f10 = 0.0F; + + for(double d10 = d5; d10 < d6; f10 += 0.5F) { + double d13 = Math.min(1.0D, d6 - d10); + float f13 = (float)d13 * 0.5F; + worldrenderer.func_181662_b(d10, 256.0D, worldborder.func_177733_e()).func_181673_a((double)(f3 + f10), (double)(f3 + 0.0F)).func_181675_d(); + worldrenderer.func_181662_b(d10 + d13, 256.0D, worldborder.func_177733_e()).func_181673_a((double)(f3 + f13 + f10), (double)(f3 + 0.0F)).func_181675_d(); + worldrenderer.func_181662_b(d10 + d13, 0.0D, worldborder.func_177733_e()).func_181673_a((double)(f3 + f13 + f10), (double)(f3 + 128.0F)).func_181675_d(); + worldrenderer.func_181662_b(d10, 0.0D, worldborder.func_177733_e()).func_181673_a((double)(f3 + f10), (double)(f3 + 128.0F)).func_181675_d(); + ++d10; + } + } + + if(d4 < worldborder.func_177736_c() + d0) { + float f11 = 0.0F; + + for(double d11 = d5; d11 < d6; f11 += 0.5F) { + double d14 = Math.min(1.0D, d6 - d11); + float f14 = (float)d14 * 0.5F; + worldrenderer.func_181662_b(d11, 256.0D, worldborder.func_177736_c()).func_181673_a((double)(f3 + f11), (double)(f3 + 0.0F)).func_181675_d(); + worldrenderer.func_181662_b(d11 + d14, 256.0D, worldborder.func_177736_c()).func_181673_a((double)(f3 + f14 + f11), (double)(f3 + 0.0F)).func_181675_d(); + worldrenderer.func_181662_b(d11 + d14, 0.0D, worldborder.func_177736_c()).func_181673_a((double)(f3 + f14 + f11), (double)(f3 + 128.0F)).func_181675_d(); + worldrenderer.func_181662_b(d11, 0.0D, worldborder.func_177736_c()).func_181673_a((double)(f3 + f11), (double)(f3 + 128.0F)).func_181675_d(); + ++d11; + } + } + + tessellator.func_78381_a(); + worldrenderer.func_178969_c(0.0D, 0.0D, 0.0D); + GlStateManager.func_179089_o(); + GlStateManager.func_179118_c(); + GlStateManager.func_179136_a(0.0F, 0.0F); + GlStateManager.func_179113_r(); + GlStateManager.func_179141_d(); + GlStateManager.func_179084_k(); + GlStateManager.func_179121_F(); + GlStateManager.func_179132_a(true); + } + + } + + private void func_180443_s() { + GlStateManager.func_179120_a(774, 768, 1, 0); + GlStateManager.func_179147_l(); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 0.5F); + GlStateManager.func_179136_a(-3.0F, -3.0F); + GlStateManager.func_179088_q(); + GlStateManager.func_179092_a(516, 0.1F); + GlStateManager.func_179141_d(); + GlStateManager.func_179094_E(); + if(Config.isShaders()) { + ShadersRender.beginBlockDamage(); + } + + } + + private void func_174969_t() { + GlStateManager.func_179118_c(); + GlStateManager.func_179136_a(0.0F, 0.0F); + GlStateManager.func_179113_r(); + GlStateManager.func_179141_d(); + GlStateManager.func_179132_a(true); + GlStateManager.func_179121_F(); + if(Config.isShaders()) { + ShadersRender.endBlockDamage(); + } + + } + + public void func_174981_a(Tessellator p_174981_1_, WorldRenderer p_174981_2_, Entity p_174981_3_, float p_174981_4_) { + double d0 = p_174981_3_.field_70142_S + (p_174981_3_.field_70165_t - p_174981_3_.field_70142_S) * (double)p_174981_4_; + double d1 = p_174981_3_.field_70137_T + (p_174981_3_.field_70163_u - p_174981_3_.field_70137_T) * (double)p_174981_4_; + double d2 = p_174981_3_.field_70136_U + (p_174981_3_.field_70161_v - p_174981_3_.field_70136_U) * (double)p_174981_4_; + if(!this.field_72738_E.isEmpty()) { + this.field_72770_i.func_110577_a(TextureMap.field_110575_b); + this.func_180443_s(); + p_174981_2_.func_181668_a(7, DefaultVertexFormats.field_176600_a); + p_174981_2_.func_178969_c(-d0, -d1, -d2); + p_174981_2_.func_78914_f(); + Iterator iterator = this.field_72738_E.values().iterator(); + + while(iterator.hasNext()) { + DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iterator.next(); + BlockPos blockpos = destroyblockprogress.func_180246_b(); + double d3 = (double)blockpos.func_177958_n() - d0; + double d4 = (double)blockpos.func_177956_o() - d1; + double d5 = (double)blockpos.func_177952_p() - d2; + Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); + boolean flag; + if(Reflector.ForgeTileEntity_canRenderBreaking.exists()) { + boolean flag1 = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; + if(!flag1) { + TileEntity tileentity = this.field_72769_h.func_175625_s(blockpos); + if(tileentity != null) { + flag1 = Reflector.callBoolean(tileentity, Reflector.ForgeTileEntity_canRenderBreaking, new Object[0]); + } + } + + flag = !flag1; + } else { + flag = !(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull); + } + + if(flag) { + if(d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { + iterator.remove(); + } else { + IBlockState iblockstate = this.field_72769_h.func_180495_p(blockpos); + if(iblockstate.func_177230_c().func_149688_o() != Material.field_151579_a) { + int i = destroyblockprogress.func_73106_e(); + TextureAtlasSprite textureatlassprite = this.field_94141_F[i]; + BlockRendererDispatcher blockrendererdispatcher = this.field_72777_q.func_175602_ab(); + blockrendererdispatcher.func_175020_a(iblockstate, blockpos, textureatlassprite, this.field_72769_h); + } + } + } + } + + p_174981_1_.func_78381_a(); + p_174981_2_.func_178969_c(0.0D, 0.0D, 0.0D); + this.func_174969_t(); + } + + } + + public void func_72731_b(EntityPlayer p_72731_1_, MovingObjectPosition p_72731_2_, int p_72731_3_, float p_72731_4_) { + if(p_72731_3_ == 0 && p_72731_2_.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK) { + GlStateManager.func_179147_l(); + GlStateManager.func_179120_a(770, 771, 1, 0); + GlStateManager.func_179131_c(0.0F, 0.0F, 0.0F, 0.4F); + GL11.glLineWidth(2.0F); + GlStateManager.func_179090_x(); + if(Config.isShaders()) { + Shaders.disableTexture2D(); + } + + GlStateManager.func_179132_a(false); + float f = 0.002F; + BlockPos blockpos = p_72731_2_.func_178782_a(); + Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c(); + if(block.func_149688_o() != Material.field_151579_a && this.field_72769_h.func_175723_af().func_177746_a(blockpos)) { + block.func_180654_a(this.field_72769_h, blockpos); + double d0 = p_72731_1_.field_70142_S + (p_72731_1_.field_70165_t - p_72731_1_.field_70142_S) * (double)p_72731_4_; + double d1 = p_72731_1_.field_70137_T + (p_72731_1_.field_70163_u - p_72731_1_.field_70137_T) * (double)p_72731_4_; + double d2 = p_72731_1_.field_70136_U + (p_72731_1_.field_70161_v - p_72731_1_.field_70136_U) * (double)p_72731_4_; + func_181561_a(block.func_180646_a(this.field_72769_h, blockpos).func_72314_b(0.0020000000949949026D, 0.0020000000949949026D, 0.0020000000949949026D).func_72317_d(-d0, -d1, -d2)); + } + + GlStateManager.func_179132_a(true); + GlStateManager.func_179098_w(); + if(Config.isShaders()) { + Shaders.enableTexture2D(); + } + + GlStateManager.func_179084_k(); + } + + } + + public static void func_181561_a(AxisAlignedBB p_181561_0_) { + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + worldrenderer.func_181668_a(3, DefaultVertexFormats.field_181705_e); + worldrenderer.func_181662_b(p_181561_0_.field_72340_a, p_181561_0_.field_72338_b, p_181561_0_.field_72339_c).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72336_d, p_181561_0_.field_72338_b, p_181561_0_.field_72339_c).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72336_d, p_181561_0_.field_72338_b, p_181561_0_.field_72334_f).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72340_a, p_181561_0_.field_72338_b, p_181561_0_.field_72334_f).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72340_a, p_181561_0_.field_72338_b, p_181561_0_.field_72339_c).func_181675_d(); + tessellator.func_78381_a(); + worldrenderer.func_181668_a(3, DefaultVertexFormats.field_181705_e); + worldrenderer.func_181662_b(p_181561_0_.field_72340_a, p_181561_0_.field_72337_e, p_181561_0_.field_72339_c).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72336_d, p_181561_0_.field_72337_e, p_181561_0_.field_72339_c).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72336_d, p_181561_0_.field_72337_e, p_181561_0_.field_72334_f).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72340_a, p_181561_0_.field_72337_e, p_181561_0_.field_72334_f).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72340_a, p_181561_0_.field_72337_e, p_181561_0_.field_72339_c).func_181675_d(); + tessellator.func_78381_a(); + worldrenderer.func_181668_a(1, DefaultVertexFormats.field_181705_e); + worldrenderer.func_181662_b(p_181561_0_.field_72340_a, p_181561_0_.field_72338_b, p_181561_0_.field_72339_c).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72340_a, p_181561_0_.field_72337_e, p_181561_0_.field_72339_c).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72336_d, p_181561_0_.field_72338_b, p_181561_0_.field_72339_c).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72336_d, p_181561_0_.field_72337_e, p_181561_0_.field_72339_c).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72336_d, p_181561_0_.field_72338_b, p_181561_0_.field_72334_f).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72336_d, p_181561_0_.field_72337_e, p_181561_0_.field_72334_f).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72340_a, p_181561_0_.field_72338_b, p_181561_0_.field_72334_f).func_181675_d(); + worldrenderer.func_181662_b(p_181561_0_.field_72340_a, p_181561_0_.field_72337_e, p_181561_0_.field_72334_f).func_181675_d(); + tessellator.func_78381_a(); + } + + public static void func_181563_a(AxisAlignedBB p_181563_0_, int p_181563_1_, int p_181563_2_, int p_181563_3_, int p_181563_4_) { + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + worldrenderer.func_181668_a(3, DefaultVertexFormats.field_181706_f); + worldrenderer.func_181662_b(p_181563_0_.field_72340_a, p_181563_0_.field_72338_b, p_181563_0_.field_72339_c).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72336_d, p_181563_0_.field_72338_b, p_181563_0_.field_72339_c).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72336_d, p_181563_0_.field_72338_b, p_181563_0_.field_72334_f).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72340_a, p_181563_0_.field_72338_b, p_181563_0_.field_72334_f).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72340_a, p_181563_0_.field_72338_b, p_181563_0_.field_72339_c).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + tessellator.func_78381_a(); + worldrenderer.func_181668_a(3, DefaultVertexFormats.field_181706_f); + worldrenderer.func_181662_b(p_181563_0_.field_72340_a, p_181563_0_.field_72337_e, p_181563_0_.field_72339_c).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72336_d, p_181563_0_.field_72337_e, p_181563_0_.field_72339_c).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72336_d, p_181563_0_.field_72337_e, p_181563_0_.field_72334_f).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72340_a, p_181563_0_.field_72337_e, p_181563_0_.field_72334_f).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72340_a, p_181563_0_.field_72337_e, p_181563_0_.field_72339_c).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + tessellator.func_78381_a(); + worldrenderer.func_181668_a(1, DefaultVertexFormats.field_181706_f); + worldrenderer.func_181662_b(p_181563_0_.field_72340_a, p_181563_0_.field_72338_b, p_181563_0_.field_72339_c).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72340_a, p_181563_0_.field_72337_e, p_181563_0_.field_72339_c).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72336_d, p_181563_0_.field_72338_b, p_181563_0_.field_72339_c).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72336_d, p_181563_0_.field_72337_e, p_181563_0_.field_72339_c).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72336_d, p_181563_0_.field_72338_b, p_181563_0_.field_72334_f).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72336_d, p_181563_0_.field_72337_e, p_181563_0_.field_72334_f).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72340_a, p_181563_0_.field_72338_b, p_181563_0_.field_72334_f).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + worldrenderer.func_181662_b(p_181563_0_.field_72340_a, p_181563_0_.field_72337_e, p_181563_0_.field_72334_f).func_181669_b(p_181563_1_, p_181563_2_, p_181563_3_, p_181563_4_).func_181675_d(); + tessellator.func_78381_a(); + } + + private void func_72725_b(int p_72725_1_, int p_72725_2_, int p_72725_3_, int p_72725_4_, int p_72725_5_, int p_72725_6_) { + this.field_175008_n.func_178162_a(p_72725_1_, p_72725_2_, p_72725_3_, p_72725_4_, p_72725_5_, p_72725_6_); + } + + public void func_174960_a(BlockPos p_174960_1_) { + int i = p_174960_1_.func_177958_n(); + int j = p_174960_1_.func_177956_o(); + int k = p_174960_1_.func_177952_p(); + this.func_72725_b(i - 1, j - 1, k - 1, i + 1, j + 1, k + 1); + } + + public void func_174959_b(BlockPos p_174959_1_) { + int i = p_174959_1_.func_177958_n(); + int j = p_174959_1_.func_177956_o(); + int k = p_174959_1_.func_177952_p(); + this.func_72725_b(i - 1, j - 1, k - 1, i + 1, j + 1, k + 1); + } + + public void func_147585_a(int p_147585_1_, int p_147585_2_, int p_147585_3_, int p_147585_4_, int p_147585_5_, int p_147585_6_) { + this.func_72725_b(p_147585_1_ - 1, p_147585_2_ - 1, p_147585_3_ - 1, p_147585_4_ + 1, p_147585_5_ + 1, p_147585_6_ + 1); + } + + public void func_174961_a(String p_174961_1_, BlockPos p_174961_2_) { + ISound isound = (ISound)this.field_147593_P.get(p_174961_2_); + if(isound != null) { + this.field_72777_q.func_147118_V().func_147683_b(isound); + this.field_147593_P.remove(p_174961_2_); + } + + if(p_174961_1_ != null) { + ItemRecord itemrecord = ItemRecord.func_150926_b(p_174961_1_); + if(itemrecord != null) { + this.field_72777_q.field_71456_v.func_73833_a(itemrecord.func_150927_i()); + } + + ResourceLocation resourcelocation = null; + if(Reflector.ForgeItemRecord_getRecordResource.exists() && itemrecord != null) { + resourcelocation = (ResourceLocation)Reflector.call(itemrecord, Reflector.ForgeItemRecord_getRecordResource, new Object[]{p_174961_1_}); + } + + if(resourcelocation == null) { + resourcelocation = new ResourceLocation(p_174961_1_); + } + + PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.func_147675_a(resourcelocation, (float)p_174961_2_.func_177958_n(), (float)p_174961_2_.func_177956_o(), (float)p_174961_2_.func_177952_p()); + this.field_147593_P.put(p_174961_2_, positionedsoundrecord); + this.field_72777_q.func_147118_V().func_147682_a(positionedsoundrecord); + } + + } + + public void func_72704_a(String p_72704_1_, double p_72704_2_, double p_72704_4_, double p_72704_6_, float p_72704_8_, float p_72704_9_) { + } + + public void func_85102_a(EntityPlayer p_85102_1_, String p_85102_2_, double p_85102_3_, double p_85102_5_, double p_85102_7_, float p_85102_9_, float p_85102_10_) { + } + + public void func_180442_a(int p_180442_1_, boolean p_180442_2_, final double p_180442_3_, final double p_180442_5_, final double p_180442_7_, double p_180442_9_, double p_180442_11_, double p_180442_13_, int... p_180442_15_) { + try { + this.func_174974_b(p_180442_1_, p_180442_2_, p_180442_3_, p_180442_5_, p_180442_7_, p_180442_9_, p_180442_11_, p_180442_13_, p_180442_15_); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.func_85055_a(throwable, "Exception while adding particle"); + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Particle being added"); + crashreportcategory.func_71507_a("ID", Integer.valueOf(p_180442_1_)); + if(p_180442_15_ != null) { + crashreportcategory.func_71507_a("Parameters", p_180442_15_); + } + + crashreportcategory.func_71500_a("Position", new Callable() { + private static final String __OBFID = "CL_00000955"; + + public String call() throws Exception { + return CrashReportCategory.func_85074_a(p_180442_3_, p_180442_5_, p_180442_7_); + } + }); + throw new ReportedException(crashreport); + } + } + + private void func_174972_a(EnumParticleTypes p_174972_1_, double p_174972_2_, double p_174972_4_, double p_174972_6_, double p_174972_8_, double p_174972_10_, double p_174972_12_, int... p_174972_14_) { + this.func_180442_a(p_174972_1_.func_179348_c(), p_174972_1_.func_179344_e(), p_174972_2_, p_174972_4_, p_174972_6_, p_174972_8_, p_174972_10_, p_174972_12_, p_174972_14_); + } + + private EntityFX func_174974_b(int p_174974_1_, boolean p_174974_2_, double p_174974_3_, double p_174974_5_, double p_174974_7_, double p_174974_9_, double p_174974_11_, double p_174974_13_, int... p_174974_15_) { + if(this.field_72777_q != null && this.field_72777_q.func_175606_aa() != null && this.field_72777_q.field_71452_i != null) { + int i = this.field_72777_q.field_71474_y.field_74362_aa; + if(i == 1 && this.field_72769_h.field_73012_v.nextInt(3) == 0) { + i = 2; + } + + double d0 = this.field_72777_q.func_175606_aa().field_70165_t - p_174974_3_; + double d1 = this.field_72777_q.func_175606_aa().field_70163_u - p_174974_5_; + double d2 = this.field_72777_q.func_175606_aa().field_70161_v - p_174974_7_; + if(p_174974_1_ == EnumParticleTypes.EXPLOSION_HUGE.func_179348_c() && !Config.isAnimatedExplosion()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.EXPLOSION_LARGE.func_179348_c() && !Config.isAnimatedExplosion()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.EXPLOSION_NORMAL.func_179348_c() && !Config.isAnimatedExplosion()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.SUSPENDED.func_179348_c() && !Config.isWaterParticles()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.SUSPENDED_DEPTH.func_179348_c() && !Config.isVoidParticles()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.SMOKE_NORMAL.func_179348_c() && !Config.isAnimatedSmoke()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.SMOKE_LARGE.func_179348_c() && !Config.isAnimatedSmoke()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.SPELL_MOB.func_179348_c() && !Config.isPotionParticles()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.SPELL_MOB_AMBIENT.func_179348_c() && !Config.isPotionParticles()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.SPELL.func_179348_c() && !Config.isPotionParticles()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.SPELL_INSTANT.func_179348_c() && !Config.isPotionParticles()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.SPELL_WITCH.func_179348_c() && !Config.isPotionParticles()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.PORTAL.func_179348_c() && !Config.isAnimatedPortal()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.FLAME.func_179348_c() && !Config.isAnimatedFlame()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.REDSTONE.func_179348_c() && !Config.isAnimatedRedstone()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.DRIP_WATER.func_179348_c() && !Config.isDrippingWaterLava()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.DRIP_LAVA.func_179348_c() && !Config.isDrippingWaterLava()) { + return null; + } else if(p_174974_1_ == EnumParticleTypes.FIREWORKS_SPARK.func_179348_c() && !Config.isFireworkParticles()) { + return null; + } else if(p_174974_2_) { + return this.field_72777_q.field_71452_i.func_178927_a(p_174974_1_, p_174974_3_, p_174974_5_, p_174974_7_, p_174974_9_, p_174974_11_, p_174974_13_, p_174974_15_); + } else { + double d3 = 16.0D; + double d4 = 256.0D; + if(p_174974_1_ == EnumParticleTypes.CRIT.func_179348_c()) { + d4 = 38416.0D; + } + + if(d0 * d0 + d1 * d1 + d2 * d2 > d4) { + return null; + } else if(i > 1) { + return null; + } else { + EntityFX entityfx = this.field_72777_q.field_71452_i.func_178927_a(p_174974_1_, p_174974_3_, p_174974_5_, p_174974_7_, p_174974_9_, p_174974_11_, p_174974_13_, p_174974_15_); + if(p_174974_1_ == EnumParticleTypes.WATER_BUBBLE.func_179348_c()) { + CustomColors.updateWaterFX(entityfx, this.field_72769_h, p_174974_3_, p_174974_5_, p_174974_7_); + } + + if(p_174974_1_ == EnumParticleTypes.WATER_SPLASH.func_179348_c()) { + CustomColors.updateWaterFX(entityfx, this.field_72769_h, p_174974_3_, p_174974_5_, p_174974_7_); + } + + if(p_174974_1_ == EnumParticleTypes.WATER_DROP.func_179348_c()) { + CustomColors.updateWaterFX(entityfx, this.field_72769_h, p_174974_3_, p_174974_5_, p_174974_7_); + } + + if(p_174974_1_ == EnumParticleTypes.TOWN_AURA.func_179348_c()) { + CustomColors.updateMyceliumFX(entityfx); + } + + if(p_174974_1_ == EnumParticleTypes.PORTAL.func_179348_c()) { + CustomColors.updatePortalFX(entityfx); + } + + if(p_174974_1_ == EnumParticleTypes.REDSTONE.func_179348_c()) { + CustomColors.updateReddustFX(entityfx, this.field_72769_h, p_174974_3_, p_174974_5_, p_174974_7_); + } + + return entityfx; + } + } + } else { + return null; + } + } + + public void func_72703_a(Entity p_72703_1_) { + RandomMobs.entityLoaded(p_72703_1_, this.field_72769_h); + if(Config.isDynamicLights()) { + DynamicLights.entityAdded(p_72703_1_, this); + } + + } + + public void func_72709_b(Entity p_72709_1_) { + if(Config.isDynamicLights()) { + DynamicLights.entityRemoved(p_72709_1_, this); + } + + } + + public void func_72728_f() { + } + + public void func_180440_a(int p_180440_1_, BlockPos p_180440_2_, int p_180440_3_) { + switch(p_180440_1_) { + case 1013: + case 1018: + if(this.field_72777_q.func_175606_aa() != null) { + double d0 = (double)p_180440_2_.func_177958_n() - this.field_72777_q.func_175606_aa().field_70165_t; + double d1 = (double)p_180440_2_.func_177956_o() - this.field_72777_q.func_175606_aa().field_70163_u; + double d2 = (double)p_180440_2_.func_177952_p() - this.field_72777_q.func_175606_aa().field_70161_v; + double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); + double d4 = this.field_72777_q.func_175606_aa().field_70165_t; + double d5 = this.field_72777_q.func_175606_aa().field_70163_u; + double d6 = this.field_72777_q.func_175606_aa().field_70161_v; + if(d3 > 0.0D) { + d4 += d0 / d3 * 2.0D; + d5 += d1 / d3 * 2.0D; + d6 += d2 / d3 * 2.0D; + } + + if(p_180440_1_ == 1013) { + this.field_72769_h.func_72980_b(d4, d5, d6, "mob.wither.spawn", 1.0F, 1.0F, false); + } else { + this.field_72769_h.func_72980_b(d4, d5, d6, "mob.enderdragon.end", 5.0F, 1.0F, false); + } + } + default: + } + } + + public void func_180439_a(EntityPlayer p_180439_1_, int p_180439_2_, BlockPos p_180439_3_, int p_180439_4_) { + Random random = this.field_72769_h.field_73012_v; + switch(p_180439_2_) { + case 1000: + this.field_72769_h.func_175731_a(p_180439_3_, "random.click", 1.0F, 1.0F, false); + break; + case 1001: + this.field_72769_h.func_175731_a(p_180439_3_, "random.click", 1.0F, 1.2F, false); + break; + case 1002: + this.field_72769_h.func_175731_a(p_180439_3_, "random.bow", 1.0F, 1.2F, false); + break; + case 1003: + this.field_72769_h.func_175731_a(p_180439_3_, "random.door_open", 1.0F, this.field_72769_h.field_73012_v.nextFloat() * 0.1F + 0.9F, false); + break; + case 1004: + this.field_72769_h.func_175731_a(p_180439_3_, "random.fizz", 0.5F, 2.6F + (random.nextFloat() - random.nextFloat()) * 0.8F, false); + break; + case 1005: + if(Item.func_150899_d(p_180439_4_) instanceof ItemRecord) { + this.field_72769_h.func_175717_a(p_180439_3_, "records." + ((ItemRecord)Item.func_150899_d(p_180439_4_)).field_150929_a); + } else { + this.field_72769_h.func_175717_a(p_180439_3_, (String)null); + } + break; + case 1006: + this.field_72769_h.func_175731_a(p_180439_3_, "random.door_close", 1.0F, this.field_72769_h.field_73012_v.nextFloat() * 0.1F + 0.9F, false); + break; + case 1007: + this.field_72769_h.func_175731_a(p_180439_3_, "mob.ghast.charge", 10.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1008: + this.field_72769_h.func_175731_a(p_180439_3_, "mob.ghast.fireball", 10.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1009: + this.field_72769_h.func_175731_a(p_180439_3_, "mob.ghast.fireball", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1010: + this.field_72769_h.func_175731_a(p_180439_3_, "mob.zombie.wood", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1011: + this.field_72769_h.func_175731_a(p_180439_3_, "mob.zombie.metal", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1012: + this.field_72769_h.func_175731_a(p_180439_3_, "mob.zombie.woodbreak", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1014: + this.field_72769_h.func_175731_a(p_180439_3_, "mob.wither.shoot", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1015: + this.field_72769_h.func_175731_a(p_180439_3_, "mob.bat.takeoff", 0.05F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1016: + this.field_72769_h.func_175731_a(p_180439_3_, "mob.zombie.infect", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1017: + this.field_72769_h.func_175731_a(p_180439_3_, "mob.zombie.unfect", 2.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F, false); + break; + case 1020: + this.field_72769_h.func_175731_a(p_180439_3_, "random.anvil_break", 1.0F, this.field_72769_h.field_73012_v.nextFloat() * 0.1F + 0.9F, false); + break; + case 1021: + this.field_72769_h.func_175731_a(p_180439_3_, "random.anvil_use", 1.0F, this.field_72769_h.field_73012_v.nextFloat() * 0.1F + 0.9F, false); + break; + case 1022: + this.field_72769_h.func_175731_a(p_180439_3_, "random.anvil_land", 0.3F, this.field_72769_h.field_73012_v.nextFloat() * 0.1F + 0.9F, false); + break; + case 2000: + int k = p_180439_4_ % 3 - 1; + int l = p_180439_4_ / 3 % 3 - 1; + double d13 = (double)p_180439_3_.func_177958_n() + (double)k * 0.6D + 0.5D; + double d15 = (double)p_180439_3_.func_177956_o() + 0.5D; + double d19 = (double)p_180439_3_.func_177952_p() + (double)l * 0.6D + 0.5D; + + for(int l1 = 0; l1 < 10; ++l1) { + double d20 = random.nextDouble() * 0.2D + 0.01D; + double d21 = d13 + (double)k * 0.01D + (random.nextDouble() - 0.5D) * (double)l * 0.5D; + double d22 = d15 + (random.nextDouble() - 0.5D) * 0.5D; + double d23 = d19 + (double)l * 0.01D + (random.nextDouble() - 0.5D) * (double)k * 0.5D; + double d24 = (double)k * d20 + random.nextGaussian() * 0.01D; + double d9 = -0.03D + random.nextGaussian() * 0.01D; + double d10 = (double)l * d20 + random.nextGaussian() * 0.01D; + this.func_174972_a(EnumParticleTypes.SMOKE_NORMAL, d21, d22, d23, d24, d9, d10, new int[0]); + } + + return; + case 2001: + Block block = Block.func_149729_e(p_180439_4_ & 4095); + if(block.func_149688_o() != Material.field_151579_a) { + this.field_72777_q.func_147118_V().func_147682_a(new PositionedSoundRecord(new ResourceLocation(block.field_149762_H.func_150495_a()), (block.field_149762_H.func_150497_c() + 1.0F) / 2.0F, block.field_149762_H.func_150494_d() * 0.8F, (float)p_180439_3_.func_177958_n() + 0.5F, (float)p_180439_3_.func_177956_o() + 0.5F, (float)p_180439_3_.func_177952_p() + 0.5F)); + } + + this.field_72777_q.field_71452_i.func_180533_a(p_180439_3_, block.func_176203_a(p_180439_4_ >> 12 & 255)); + break; + case 2002: + double d11 = (double)p_180439_3_.func_177958_n(); + double d12 = (double)p_180439_3_.func_177956_o(); + double d14 = (double)p_180439_3_.func_177952_p(); + + for(int i1 = 0; i1 < 8; ++i1) { + this.func_174972_a(EnumParticleTypes.ITEM_CRACK, d11, d12, d14, random.nextGaussian() * 0.15D, random.nextDouble() * 0.2D, random.nextGaussian() * 0.15D, new int[]{Item.func_150891_b(Items.field_151068_bn), p_180439_4_}); + } + + int j1 = Items.field_151068_bn.func_77620_a(p_180439_4_); + float f = (float)(j1 >> 16 & 255) / 255.0F; + float f1 = (float)(j1 >> 8 & 255) / 255.0F; + float f2 = (float)(j1 >> 0 & 255) / 255.0F; + EnumParticleTypes enumparticletypes = EnumParticleTypes.SPELL; + if(Items.field_151068_bn.func_77833_h(p_180439_4_)) { + enumparticletypes = EnumParticleTypes.SPELL_INSTANT; + } + + for(int k1 = 0; k1 < 100; ++k1) { + double d16 = random.nextDouble() * 4.0D; + double d17 = random.nextDouble() * 3.141592653589793D * 2.0D; + double d18 = Math.cos(d17) * d16; + double d7 = 0.01D + random.nextDouble() * 0.5D; + double d8 = Math.sin(d17) * d16; + EntityFX entityfx = this.func_174974_b(enumparticletypes.func_179348_c(), enumparticletypes.func_179344_e(), d11 + d18 * 0.1D, d12 + 0.3D, d14 + d8 * 0.1D, d18, d7, d8, new int[0]); + if(entityfx != null) { + float f3 = 0.75F + random.nextFloat() * 0.25F; + entityfx.func_70538_b(f * f3, f1 * f3, f2 * f3); + entityfx.func_70543_e((float)d16); + } + } + + this.field_72769_h.func_175731_a(p_180439_3_, "game.potion.smash", 1.0F, this.field_72769_h.field_73012_v.nextFloat() * 0.1F + 0.9F, false); + break; + case 2003: + double var7 = (double)p_180439_3_.func_177958_n() + 0.5D; + double var9 = (double)p_180439_3_.func_177956_o(); + double var11 = (double)p_180439_3_.func_177952_p() + 0.5D; + + for(int var13 = 0; var13 < 8; ++var13) { + this.func_174972_a(EnumParticleTypes.ITEM_CRACK, var7, var9, var11, random.nextGaussian() * 0.15D, random.nextDouble() * 0.2D, random.nextGaussian() * 0.15D, new int[]{Item.func_150891_b(Items.field_151061_bv)}); + } + + for(double var32 = 0.0D; var32 < 6.283185307179586D; var32 += 0.15707963267948966D) { + this.func_174972_a(EnumParticleTypes.PORTAL, var7 + Math.cos(var32) * 5.0D, var9 - 0.4D, var11 + Math.sin(var32) * 5.0D, Math.cos(var32) * -5.0D, 0.0D, Math.sin(var32) * -5.0D, new int[0]); + this.func_174972_a(EnumParticleTypes.PORTAL, var7 + Math.cos(var32) * 5.0D, var9 - 0.4D, var11 + Math.sin(var32) * 5.0D, Math.cos(var32) * -7.0D, 0.0D, Math.sin(var32) * -7.0D, new int[0]); + } + + return; + case 2004: + for(int var18 = 0; var18 < 20; ++var18) { + double d3 = (double)p_180439_3_.func_177958_n() + 0.5D + ((double)this.field_72769_h.field_73012_v.nextFloat() - 0.5D) * 2.0D; + double d4 = (double)p_180439_3_.func_177956_o() + 0.5D + ((double)this.field_72769_h.field_73012_v.nextFloat() - 0.5D) * 2.0D; + double d5 = (double)p_180439_3_.func_177952_p() + 0.5D + ((double)this.field_72769_h.field_73012_v.nextFloat() - 0.5D) * 2.0D; + this.field_72769_h.func_175688_a(EnumParticleTypes.SMOKE_NORMAL, d3, d4, d5, 0.0D, 0.0D, 0.0D, new int[0]); + this.field_72769_h.func_175688_a(EnumParticleTypes.FLAME, d3, d4, d5, 0.0D, 0.0D, 0.0D, new int[0]); + } + + return; + case 2005: + ItemDye.func_180617_a(this.field_72769_h, p_180439_3_, p_180439_4_); + } + + } + + public void func_180441_b(int p_180441_1_, BlockPos p_180441_2_, int p_180441_3_) { + if(p_180441_3_ >= 0 && p_180441_3_ < 10) { + DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)this.field_72738_E.get(Integer.valueOf(p_180441_1_)); + if(destroyblockprogress == null || destroyblockprogress.func_180246_b().func_177958_n() != p_180441_2_.func_177958_n() || destroyblockprogress.func_180246_b().func_177956_o() != p_180441_2_.func_177956_o() || destroyblockprogress.func_180246_b().func_177952_p() != p_180441_2_.func_177952_p()) { + destroyblockprogress = new DestroyBlockProgress(p_180441_1_, p_180441_2_); + this.field_72738_E.put(Integer.valueOf(p_180441_1_), destroyblockprogress); + } + + destroyblockprogress.func_73107_a(p_180441_3_); + destroyblockprogress.func_82744_b(this.field_72773_u); + } else { + this.field_72738_E.remove(Integer.valueOf(p_180441_1_)); + } + + } + + public void func_174979_m() { + this.field_147595_R = true; + } + + public void resetClouds() { + this.cloudRenderer.reset(); + } + + public int getCountRenderers() { + return this.field_175008_n.field_178164_f.length; + } + + public int getCountActiveRenderers() { + return this.field_72755_R.size(); + } + + public int getCountEntitiesRendered() { + return this.field_72749_I; + } + + public int getCountTileEntitiesRendered() { + return this.countTileEntitiesRendered; + } + + public RenderChunk getRenderChunk(BlockPos p_getRenderChunk_1_) { + return this.field_175008_n.func_178161_a(p_getRenderChunk_1_); + } + + public RenderChunk getRenderChunk(RenderChunk p_getRenderChunk_1_, EnumFacing p_getRenderChunk_2_) { + if(p_getRenderChunk_1_ == null) { + return null; + } else { + BlockPos blockpos = p_getRenderChunk_1_.func_181701_a(p_getRenderChunk_2_); + return this.field_175008_n.func_178161_a(blockpos); + } + } + + public WorldClient getWorld() { + return this.field_72769_h; + } + + public void func_181023_a(Collection p_181023_1_, Collection p_181023_2_) { + Set set = this.field_181024_n; + synchronized(this.field_181024_n) { + this.field_181024_n.removeAll(p_181023_1_); + this.field_181024_n.addAll(p_181023_2_); + } + } + + static final class RenderGlobal$2 { + static final int[] field_178037_a = new int[VertexFormatElement.EnumUsage.values().length]; + private static final String __OBFID = "CL_00002535"; + + static { + try { + field_178037_a[VertexFormatElement.EnumUsage.POSITION.ordinal()] = 1; + } catch (NoSuchFieldError var3) { + ; + } + + try { + field_178037_a[VertexFormatElement.EnumUsage.UV.ordinal()] = 2; + } catch (NoSuchFieldError var2) { + ; + } + + try { + field_178037_a[VertexFormatElement.EnumUsage.COLOR.ordinal()] = 3; + } catch (NoSuchFieldError var1) { + ; + } + + } + } + + public static class ContainerLocalRenderInformation { + final RenderChunk field_178036_a; + final EnumFacing field_178034_b; + final Set field_178035_c; + final int field_178032_d; + private static final String __OBFID = "CL_00002534"; + + public ContainerLocalRenderInformation(RenderChunk p_i4_1_, EnumFacing p_i4_2_, int p_i4_3_) { + this.field_178035_c = EnumSet.noneOf(EnumFacing.class); + this.field_178036_a = p_i4_1_; + this.field_178034_b = p_i4_2_; + this.field_178032_d = p_i4_3_; + } + + ContainerLocalRenderInformation(RenderChunk p_i5_1_, EnumFacing p_i5_2_, int p_i5_3_, Object p_i5_4_) { + this(p_i5_1_, p_i5_2_, p_i5_3_); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/RenderHelper.java b/src/minecraft/net/minecraft/client/renderer/RenderHelper.java new file mode 100644 index 0000000..1d15792 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/RenderHelper.java @@ -0,0 +1,80 @@ +package net.minecraft.client.renderer; + +import java.nio.FloatBuffer; +import net.minecraft.util.Vec3; +import org.lwjgl.opengl.GL11; + +public class RenderHelper +{ + /** Float buffer used to set OpenGL material colors */ + private static FloatBuffer colorBuffer = GLAllocation.createDirectFloatBuffer(16); + private static final Vec3 LIGHT0_POS = (new Vec3(0.20000000298023224D, 1.0D, -0.699999988079071D)).normalize(); + private static final Vec3 LIGHT1_POS = (new Vec3(-0.20000000298023224D, 1.0D, 0.699999988079071D)).normalize(); + + /** + * Disables the OpenGL lighting properties enabled by enableStandardItemLighting + */ + public static void disableStandardItemLighting() + { + GlStateManager.disableLighting(); + GlStateManager.disableLight(0); + GlStateManager.disableLight(1); + GlStateManager.disableColorMaterial(); + } + + /** + * Sets the OpenGL lighting properties to the values used when rendering blocks as items + */ + public static void enableStandardItemLighting() + { + GlStateManager.enableLighting(); + GlStateManager.enableLight(0); + GlStateManager.enableLight(1); + GlStateManager.enableColorMaterial(); + GlStateManager.colorMaterial(1032, 5634); + float f = 0.4F; + float f1 = 0.6F; + float f2 = 0.0F; + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, (FloatBuffer)setColorBuffer(LIGHT0_POS.xCoord, LIGHT0_POS.yCoord, LIGHT0_POS.zCoord, 0.0D)); + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, (FloatBuffer)setColorBuffer(f1, f1, f1, 1.0F)); + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, (FloatBuffer)setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, (FloatBuffer)setColorBuffer(f2, f2, f2, 1.0F)); + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION, (FloatBuffer)setColorBuffer(LIGHT1_POS.xCoord, LIGHT1_POS.yCoord, LIGHT1_POS.zCoord, 0.0D)); + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, (FloatBuffer)setColorBuffer(f1, f1, f1, 1.0F)); + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_AMBIENT, (FloatBuffer)setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glLight(GL11.GL_LIGHT1, GL11.GL_SPECULAR, (FloatBuffer)setColorBuffer(f2, f2, f2, 1.0F)); + GlStateManager.shadeModel(7424); + GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, (FloatBuffer)setColorBuffer(f, f, f, 1.0F)); + } + + /** + * Update and return colorBuffer with the RGBA values passed as arguments + */ + private static FloatBuffer setColorBuffer(double p_74517_0_, double p_74517_2_, double p_74517_4_, double p_74517_6_) + { + return setColorBuffer((float)p_74517_0_, (float)p_74517_2_, (float)p_74517_4_, (float)p_74517_6_); + } + + /** + * Update and return colorBuffer with the RGBA values passed as arguments + */ + private static FloatBuffer setColorBuffer(float p_74521_0_, float p_74521_1_, float p_74521_2_, float p_74521_3_) + { + colorBuffer.clear(); + colorBuffer.put(p_74521_0_).put(p_74521_1_).put(p_74521_2_).put(p_74521_3_); + colorBuffer.flip(); + return colorBuffer; + } + + /** + * Sets OpenGL lighting for rendering blocks as items inside GUI screens (such as containers). + */ + public static void enableGUIStandardItemLighting() + { + GlStateManager.pushMatrix(); + GlStateManager.rotate(-30.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(165.0F, 1.0F, 0.0F, 0.0F); + enableStandardItemLighting(); + GlStateManager.popMatrix(); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/RenderList.java b/src/minecraft/net/minecraft/client/renderer/RenderList.java new file mode 100644 index 0000000..487c62a --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/RenderList.java @@ -0,0 +1,41 @@ +package net.minecraft.client.renderer; + +import net.minecraft.client.renderer.chunk.ListedRenderChunk; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.util.EnumWorldBlockLayer; +import optifine.Config; + +import org.lwjgl.opengl.GL11; + +public class RenderList extends ChunkRenderContainer +{ + private static final String __OBFID = "CL_00000957"; + + public void renderChunkLayer(EnumWorldBlockLayer layer) + { + if (this.initialized) + { + if (this.renderChunks.size() == 0) + { + return; + } + + for (RenderChunk renderchunk : this.renderChunks) + { + ListedRenderChunk listedrenderchunk = (ListedRenderChunk)renderchunk; + GlStateManager.pushMatrix(); + this.preRenderChunk(renderchunk); + GL11.glCallList(listedrenderchunk.getDisplayList(layer, listedrenderchunk.getCompiledChunk())); + GlStateManager.popMatrix(); + } + + if (Config.isMultiTexture()) + { + GlStateManager.bindCurrentTexture(); + } + + GlStateManager.resetColor(); + this.renderChunks.clear(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/StitcherException.java b/src/minecraft/net/minecraft/client/renderer/StitcherException.java new file mode 100644 index 0000000..e3c4caa --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/StitcherException.java @@ -0,0 +1,14 @@ +package net.minecraft.client.renderer; + +import net.minecraft.client.renderer.texture.Stitcher; + +public class StitcherException extends RuntimeException +{ + private final Stitcher.Holder holder; + + public StitcherException(Stitcher.Holder p_i2344_1_, String p_i2344_2_) + { + super(p_i2344_2_); + this.holder = p_i2344_1_; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/Tessellator.java b/src/minecraft/net/minecraft/client/renderer/Tessellator.java new file mode 100644 index 0000000..8adb21e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/Tessellator.java @@ -0,0 +1,34 @@ +package net.minecraft.client.renderer; + +public class Tessellator +{ + private WorldRenderer worldRenderer; + private WorldVertexBufferUploader vboUploader = new WorldVertexBufferUploader(); + + /** The static instance of the Tessellator. */ + private static final Tessellator instance = new Tessellator(2097152); + + public static Tessellator getInstance() + { + return instance; + } + + public Tessellator(int bufferSize) + { + this.worldRenderer = new WorldRenderer(bufferSize); + } + + /** + * Draws the data set up in this tessellator and resets the state to prepare for new drawing. + */ + public void draw() + { + this.worldRenderer.finishDrawing(); + this.vboUploader.func_181679_a(this.worldRenderer); + } + + public WorldRenderer getWorldRenderer() + { + return this.worldRenderer; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/ThreadDownloadImageData.java b/src/minecraft/net/minecraft/client/renderer/ThreadDownloadImageData.java new file mode 100644 index 0000000..ee6b1b4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/ThreadDownloadImageData.java @@ -0,0 +1,248 @@ +package net.minecraft.client.renderer; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.Proxy; +import java.net.URL; +import java.net.Proxy.Type; +import java.util.concurrent.atomic.AtomicInteger; +import javax.imageio.ImageIO; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.SimpleTexture; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import optifine.HttpPipeline; +import optifine.HttpRequest; +import optifine.HttpResponse; + +import org.apache.commons.io.FileUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ThreadDownloadImageData extends SimpleTexture +{ + private static final Logger logger = LogManager.getLogger(); + private static final AtomicInteger threadDownloadCounter = new AtomicInteger(0); + private final File cacheFile; + private final String imageUrl; + private final IImageBuffer imageBuffer; + private BufferedImage bufferedImage; + private Thread imageThread; + private boolean textureUploaded; + private static final String __OBFID = "CL_00001049"; + public Boolean imageFound = null; + public boolean pipeline = false; + + public ThreadDownloadImageData(File cacheFileIn, String imageUrlIn, ResourceLocation textureResourceLocation, IImageBuffer imageBufferIn) + { + super(textureResourceLocation); + this.cacheFile = cacheFileIn; + this.imageUrl = imageUrlIn; + this.imageBuffer = imageBufferIn; + } + + private void checkTextureUploaded() + { + if (!this.textureUploaded && this.bufferedImage != null) + { + this.textureUploaded = true; + + if (this.textureLocation != null) + { + this.deleteGlTexture(); + } + + TextureUtil.uploadTextureImage(super.getGlTextureId(), this.bufferedImage); + } + } + + public int getGlTextureId() + { + this.checkTextureUploaded(); + return super.getGlTextureId(); + } + + public void setBufferedImage(BufferedImage bufferedImageIn) + { + this.bufferedImage = bufferedImageIn; + + if (this.imageBuffer != null) + { + this.imageBuffer.skinAvailable(); + } + + this.imageFound = Boolean.valueOf(this.bufferedImage != null); + } + + public void loadTexture(IResourceManager resourceManager) throws IOException + { + if (this.bufferedImage == null && this.textureLocation != null) + { + super.loadTexture(resourceManager); + } + + if (this.imageThread == null) + { + if (this.cacheFile != null && this.cacheFile.isFile()) + { + logger.debug("Loading http texture from local cache ({})", new Object[] {this.cacheFile}); + + try + { + this.bufferedImage = ImageIO.read(this.cacheFile); + + if (this.imageBuffer != null) + { + this.setBufferedImage(this.imageBuffer.parseUserSkin(this.bufferedImage)); + } + + this.imageFound = Boolean.valueOf(this.bufferedImage != null); + } + catch (IOException ioexception) + { + logger.error((String)("Couldn\'t load skin " + this.cacheFile), (Throwable)ioexception); + this.loadTextureFromServer(); + } + } + else + { + this.loadTextureFromServer(); + } + } + } + + protected void loadTextureFromServer() + { + this.imageThread = new Thread("Texture Downloader #" + threadDownloadCounter.incrementAndGet()) + { + private static final String __OBFID = "CL_00001050"; + public void run() + { + HttpURLConnection httpurlconnection = null; + ThreadDownloadImageData.logger.debug("Downloading http texture from {} to {}", new Object[] {ThreadDownloadImageData.this.imageUrl, ThreadDownloadImageData.this.cacheFile}); + + if (ThreadDownloadImageData.this.shouldPipeline()) + { + ThreadDownloadImageData.this.loadPipelined(); + } + else + { + try + { + httpurlconnection = (HttpURLConnection)(new URL(ThreadDownloadImageData.this.imageUrl)).openConnection(Minecraft.getMinecraft().getProxy()); + httpurlconnection.setDoInput(true); + httpurlconnection.setDoOutput(false); + httpurlconnection.connect(); + + if (httpurlconnection.getResponseCode() / 100 != 2) + { + if (httpurlconnection.getErrorStream() != null) + { + Config.readAll(httpurlconnection.getErrorStream()); + } + + return; + } + + BufferedImage bufferedimage; + + if (ThreadDownloadImageData.this.cacheFile != null) + { + FileUtils.copyInputStreamToFile(httpurlconnection.getInputStream(), ThreadDownloadImageData.this.cacheFile); + bufferedimage = ImageIO.read(ThreadDownloadImageData.this.cacheFile); + } + else + { + bufferedimage = TextureUtil.readBufferedImage(httpurlconnection.getInputStream()); + } + + if (ThreadDownloadImageData.this.imageBuffer != null) + { + bufferedimage = ThreadDownloadImageData.this.imageBuffer.parseUserSkin(bufferedimage); + } + + ThreadDownloadImageData.this.setBufferedImage(bufferedimage); + } + catch (Exception exception) + { + ThreadDownloadImageData.logger.error("Couldn\'t download http texture: " + exception.getClass().getName() + ": " + exception.getMessage()); + return; + } + finally + { + if (httpurlconnection != null) + { + httpurlconnection.disconnect(); + } + + ThreadDownloadImageData.this.imageFound = Boolean.valueOf(ThreadDownloadImageData.this.bufferedImage != null); + } + } + } + }; + this.imageThread.setDaemon(true); + this.imageThread.start(); + } + + private boolean shouldPipeline() + { + if (!this.pipeline) + { + return false; + } + else + { + Proxy proxy = Minecraft.getMinecraft().getProxy(); + return proxy.type() != Type.DIRECT && proxy.type() != Type.SOCKS ? false : this.imageUrl.startsWith("http://"); + } + } + + private void loadPipelined() + { + try + { + HttpRequest httprequest = HttpPipeline.makeRequest(this.imageUrl, Minecraft.getMinecraft().getProxy()); + HttpResponse httpresponse = HttpPipeline.executeRequest(httprequest); + + if (httpresponse.getStatus() / 100 != 2) + { + return; + } + + byte[] abyte = httpresponse.getBody(); + ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(abyte); + BufferedImage bufferedimage; + + if (this.cacheFile != null) + { + FileUtils.copyInputStreamToFile(bytearrayinputstream, this.cacheFile); + bufferedimage = ImageIO.read(this.cacheFile); + } + else + { + bufferedimage = TextureUtil.readBufferedImage(bytearrayinputstream); + } + + if (this.imageBuffer != null) + { + bufferedimage = this.imageBuffer.parseUserSkin(bufferedimage); + } + + this.setBufferedImage(bufferedimage); + } + catch (Exception exception) + { + logger.error("Couldn\'t download http texture: " + exception.getClass().getName() + ": " + exception.getMessage()); + return; + } + finally + { + this.imageFound = Boolean.valueOf(this.bufferedImage != null); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/VboRenderList.java b/src/minecraft/net/minecraft/client/renderer/VboRenderList.java new file mode 100644 index 0000000..1d9c9c7 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/VboRenderList.java @@ -0,0 +1,53 @@ +package net.minecraft.client.renderer; + +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.client.renderer.vertex.VertexBuffer; +import net.minecraft.util.EnumWorldBlockLayer; +import optifine.Config; + +import org.lwjgl.opengl.GL11; +import shadersmod.client.ShadersRender; + +public class VboRenderList extends ChunkRenderContainer +{ + private static final String __OBFID = "CL_00002533"; + + public void renderChunkLayer(EnumWorldBlockLayer layer) + { + if (this.initialized) + { + for (RenderChunk renderchunk : this.renderChunks) + { + VertexBuffer vertexbuffer = renderchunk.getVertexBufferByLayer(layer.ordinal()); + GlStateManager.pushMatrix(); + this.preRenderChunk(renderchunk); + renderchunk.multModelviewMatrix(); + vertexbuffer.bindBuffer(); + this.setupArrayPointers(); + vertexbuffer.drawArrays(7); + GlStateManager.popMatrix(); + } + + OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0); + GlStateManager.resetColor(); + this.renderChunks.clear(); + } + } + + private void setupArrayPointers() + { + if (Config.isShaders()) + { + ShadersRender.setupArrayPointersVbo(); + } + else + { + GL11.glVertexPointer(3, GL11.GL_FLOAT, 28, 0L); + GL11.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 28, 12L); + GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 28, 16L); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glTexCoordPointer(2, GL11.GL_SHORT, 28, 24L); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/VertexBufferUploader.java b/src/minecraft/net/minecraft/client/renderer/VertexBufferUploader.java new file mode 100644 index 0000000..856e99c --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/VertexBufferUploader.java @@ -0,0 +1,19 @@ +package net.minecraft.client.renderer; + +import net.minecraft.client.renderer.vertex.VertexBuffer; + +public class VertexBufferUploader extends WorldVertexBufferUploader +{ + private VertexBuffer vertexBuffer = null; + + public void func_181679_a(WorldRenderer p_181679_1_) + { + p_181679_1_.reset(); + this.vertexBuffer.func_181722_a(p_181679_1_.getByteBuffer()); + } + + public void setVertexBuffer(VertexBuffer vertexBufferIn) + { + this.vertexBuffer = vertexBufferIn; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/ViewFrustum.java b/src/minecraft/net/minecraft/client/renderer/ViewFrustum.java new file mode 100644 index 0000000..3858989 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/ViewFrustum.java @@ -0,0 +1,184 @@ +package net.minecraft.client.renderer; + +import net.minecraft.client.renderer.chunk.IRenderChunkFactory; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class ViewFrustum +{ + protected final RenderGlobal renderGlobal; + protected final World world; + protected int countChunksY; + protected int countChunksX; + protected int countChunksZ; + public RenderChunk[] renderChunks; + private static final String __OBFID = "CL_00002531"; + + public ViewFrustum(World worldIn, int renderDistanceChunks, RenderGlobal p_i46246_3_, IRenderChunkFactory renderChunkFactory) + { + this.renderGlobal = p_i46246_3_; + this.world = worldIn; + this.setCountChunksXYZ(renderDistanceChunks); + this.createRenderChunks(renderChunkFactory); + } + + protected void createRenderChunks(IRenderChunkFactory renderChunkFactory) + { + int i = this.countChunksX * this.countChunksY * this.countChunksZ; + this.renderChunks = new RenderChunk[i]; + int j = 0; + + for (int k = 0; k < this.countChunksX; ++k) + { + for (int l = 0; l < this.countChunksY; ++l) + { + for (int i1 = 0; i1 < this.countChunksZ; ++i1) + { + int j1 = (i1 * this.countChunksY + l) * this.countChunksX + k; + BlockPos blockpos = new BlockPos(k * 16, l * 16, i1 * 16); + this.renderChunks[j1] = renderChunkFactory.makeRenderChunk(this.world, this.renderGlobal, blockpos, j++); + } + } + } + } + + public void deleteGlResources() + { + for (RenderChunk renderchunk : this.renderChunks) + { + renderchunk.deleteGlResources(); + } + } + + protected void setCountChunksXYZ(int renderDistanceChunks) + { + int i = renderDistanceChunks * 2 + 1; + this.countChunksX = i; + this.countChunksY = 16; + this.countChunksZ = i; + } + + public void updateChunkPositions(double viewEntityX, double viewEntityZ) + { + int i = MathHelper.floor_double(viewEntityX) - 8; + int j = MathHelper.floor_double(viewEntityZ) - 8; + int k = this.countChunksX * 16; + + for (int l = 0; l < this.countChunksX; ++l) + { + int i1 = this.func_178157_a(i, k, l); + + for (int j1 = 0; j1 < this.countChunksZ; ++j1) + { + int k1 = this.func_178157_a(j, k, j1); + + for (int l1 = 0; l1 < this.countChunksY; ++l1) + { + int i2 = l1 * 16; + RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l]; + BlockPos blockpos = renderchunk.getPosition(); + + if (blockpos.getX() != i1 || blockpos.getY() != i2 || blockpos.getZ() != k1) + { + BlockPos blockpos1 = new BlockPos(i1, i2, k1); + + if (!blockpos1.equals(renderchunk.getPosition())) + { + renderchunk.setPosition(blockpos1); + } + } + } + } + } + } + + private int func_178157_a(int p_178157_1_, int p_178157_2_, int p_178157_3_) + { + int i = p_178157_3_ * 16; + int j = i - p_178157_1_ + p_178157_2_ / 2; + + if (j < 0) + { + j -= p_178157_2_ - 1; + } + + return i - j / p_178157_2_ * p_178157_2_; + } + + public void markBlocksForUpdate(int fromX, int fromY, int fromZ, int toX, int toY, int toZ) + { + int i = MathHelper.bucketInt(fromX, 16); + int j = MathHelper.bucketInt(fromY, 16); + int k = MathHelper.bucketInt(fromZ, 16); + int l = MathHelper.bucketInt(toX, 16); + int i1 = MathHelper.bucketInt(toY, 16); + int j1 = MathHelper.bucketInt(toZ, 16); + + for (int k1 = i; k1 <= l; ++k1) + { + int l1 = k1 % this.countChunksX; + + if (l1 < 0) + { + l1 += this.countChunksX; + } + + for (int i2 = j; i2 <= i1; ++i2) + { + int j2 = i2 % this.countChunksY; + + if (j2 < 0) + { + j2 += this.countChunksY; + } + + for (int k2 = k; k2 <= j1; ++k2) + { + int l2 = k2 % this.countChunksZ; + + if (l2 < 0) + { + l2 += this.countChunksZ; + } + + int i3 = (l2 * this.countChunksY + j2) * this.countChunksX + l1; + RenderChunk renderchunk = this.renderChunks[i3]; + renderchunk.setNeedsUpdate(true); + } + } + } + } + + public RenderChunk getRenderChunk(BlockPos pos) + { + int i = pos.getX() >> 4; + int j = pos.getY() >> 4; + int k = pos.getZ() >> 4; + + if (j >= 0 && j < this.countChunksY) + { + i = i % this.countChunksX; + + if (i < 0) + { + i += this.countChunksX; + } + + k = k % this.countChunksZ; + + if (k < 0) + { + k += this.countChunksZ; + } + + int l = (k * this.countChunksY + j) * this.countChunksX + i; + return this.renderChunks[l]; + } + else + { + return null; + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/WorldRenderer$1.java b/src/minecraft/net/minecraft/client/renderer/WorldRenderer$1.java new file mode 100644 index 0000000..c77e303 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/WorldRenderer$1.java @@ -0,0 +1,26 @@ +package net.minecraft.client.renderer; + +import com.google.common.primitives.Floats; +import java.util.Comparator; + +class WorldRenderer$1 implements Comparator +{ + final float[] field_181659_a; + final WorldRenderer field_181660_b; + + WorldRenderer$1(WorldRenderer p_i46500_1_, float[] p_i46500_2_) + { + this.field_181660_b = p_i46500_1_; + this.field_181659_a = p_i46500_2_; + } + + public int compare(Integer p_compare_1_, Integer p_compare_2_) + { + return Floats.compare(this.field_181659_a[p_compare_2_.intValue()], this.field_181659_a[p_compare_1_.intValue()]); + } + + public int compare(Object p_compare_1_, Object p_compare_2_) + { + return this.compare((Integer)p_compare_1_, (Integer)p_compare_2_); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/WorldRenderer.java b/src/minecraft/net/minecraft/client/renderer/WorldRenderer.java new file mode 100644 index 0000000..776db80 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/WorldRenderer.java @@ -0,0 +1,1135 @@ +package net.minecraft.client.renderer; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.nio.ShortBuffer; +import java.util.Arrays; +import java.util.BitSet; +import net.minecraft.client.renderer.WorldRenderer$1; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.MathHelper; +import optifine.Config; +import optifine.TextureUtils; + +import org.apache.logging.log4j.LogManager; +import org.lwjgl.opengl.GL11; +import shadersmod.client.SVertexBuilder; + +public class WorldRenderer +{ + private ByteBuffer byteBuffer; + public IntBuffer rawIntBuffer; + private ShortBuffer field_181676_c; + public FloatBuffer rawFloatBuffer; + public int vertexCount; + private VertexFormatElement field_181677_f; + private int field_181678_g; + + /** Boolean for whether this renderer needs to be updated or not */ + private boolean needsUpdate; + public int drawMode; + private double xOffset; + private double yOffset; + private double zOffset; + private VertexFormat vertexFormat; + private boolean isDrawing; + private static final String __OBFID = "CL_00000942"; + private EnumWorldBlockLayer blockLayer = null; + private boolean[] drawnIcons = new boolean[256]; + private TextureAtlasSprite[] quadSprites = null; + private TextureAtlasSprite[] quadSpritesPrev = null; + private TextureAtlasSprite quadSprite = null; + public SVertexBuilder sVertexBuilder; + + public WorldRenderer(int bufferSizeIn) + { + if (Config.isShaders()) + { + bufferSizeIn *= 2; + } + + this.byteBuffer = GLAllocation.createDirectByteBuffer(bufferSizeIn * 4); + this.rawIntBuffer = this.byteBuffer.asIntBuffer(); + this.field_181676_c = this.byteBuffer.asShortBuffer(); + this.rawFloatBuffer = this.byteBuffer.asFloatBuffer(); + SVertexBuilder.initVertexBuilder(this); + } + + private void func_181670_b(int p_181670_1_) + { + if (Config.isShaders()) + { + p_181670_1_ *= 2; + } + + if (p_181670_1_ > this.rawIntBuffer.remaining()) + { + int i = this.byteBuffer.capacity(); + int j = i % 2097152; + int k = j + (((this.rawIntBuffer.position() + p_181670_1_) * 4 - j) / 2097152 + 1) * 2097152; + LogManager.getLogger().warn("Needed to grow BufferBuilder buffer: Old size " + i + " bytes, new size " + k + " bytes."); + int l = this.rawIntBuffer.position(); + ByteBuffer bytebuffer = GLAllocation.createDirectByteBuffer(k); + this.byteBuffer.position(0); + bytebuffer.put(this.byteBuffer); + bytebuffer.rewind(); + this.byteBuffer = bytebuffer; + this.rawFloatBuffer = this.byteBuffer.asFloatBuffer(); + this.rawIntBuffer = this.byteBuffer.asIntBuffer(); + this.rawIntBuffer.position(l); + this.field_181676_c = this.byteBuffer.asShortBuffer(); + this.field_181676_c.position(l << 1); + + if (this.quadSprites != null) + { + TextureAtlasSprite[] atextureatlassprite = this.quadSprites; + int i1 = this.getBufferQuadSize(); + this.quadSprites = new TextureAtlasSprite[i1]; + System.arraycopy(atextureatlassprite, 0, this.quadSprites, 0, Math.min(atextureatlassprite.length, this.quadSprites.length)); + this.quadSpritesPrev = null; + } + } + } + + public void func_181674_a(float p_181674_1_, float p_181674_2_, float p_181674_3_) + { + int i = this.vertexCount / 4; + float[] afloat = new float[i]; + + for (int j = 0; j < i; ++j) + { + afloat[j] = func_181665_a(this.rawFloatBuffer, (float)((double)p_181674_1_ + this.xOffset), (float)((double)p_181674_2_ + this.yOffset), (float)((double)p_181674_3_ + this.zOffset), this.vertexFormat.func_181719_f(), j * this.vertexFormat.getNextOffset()); + } + + Integer[] ainteger = new Integer[i]; + + for (int k = 0; k < ainteger.length; ++k) + { + ainteger[k] = Integer.valueOf(k); + } + + Arrays.sort(ainteger, new WorldRenderer$1(this, afloat)); + BitSet bitset = new BitSet(); + int l = this.vertexFormat.getNextOffset(); + int[] aint = new int[l]; + + for (int l1 = 0; (l1 = bitset.nextClearBit(l1)) < ainteger.length; ++l1) + { + int i1 = ainteger[l1].intValue(); + + if (i1 != l1) + { + this.rawIntBuffer.limit(i1 * l + l); + this.rawIntBuffer.position(i1 * l); + this.rawIntBuffer.get(aint); + int j1 = i1; + + for (int k1 = ainteger[i1].intValue(); j1 != l1; k1 = ainteger[k1].intValue()) + { + this.rawIntBuffer.limit(k1 * l + l); + this.rawIntBuffer.position(k1 * l); + IntBuffer intbuffer = this.rawIntBuffer.slice(); + this.rawIntBuffer.limit(j1 * l + l); + this.rawIntBuffer.position(j1 * l); + this.rawIntBuffer.put(intbuffer); + bitset.set(j1); + j1 = k1; + } + + this.rawIntBuffer.limit(l1 * l + l); + this.rawIntBuffer.position(l1 * l); + this.rawIntBuffer.put(aint); + } + + bitset.set(l1); + } + + this.rawIntBuffer.limit(this.rawIntBuffer.capacity()); + this.rawIntBuffer.position(this.func_181664_j()); + + if (this.quadSprites != null) + { + TextureAtlasSprite[] atextureatlassprite = new TextureAtlasSprite[this.vertexCount / 4]; + int i2 = this.vertexFormat.func_181719_f() / 4 * 4; + + for (int j2 = 0; j2 < ainteger.length; ++j2) + { + int k2 = ainteger[j2].intValue(); + atextureatlassprite[j2] = this.quadSprites[k2]; + } + + System.arraycopy(atextureatlassprite, 0, this.quadSprites, 0, atextureatlassprite.length); + } + } + + public WorldRenderer.State func_181672_a() + { + this.rawIntBuffer.rewind(); + int i = this.func_181664_j(); + this.rawIntBuffer.limit(i); + int[] aint = new int[i]; + this.rawIntBuffer.get(aint); + this.rawIntBuffer.limit(this.rawIntBuffer.capacity()); + this.rawIntBuffer.position(i); + TextureAtlasSprite[] atextureatlassprite = null; + + if (this.quadSprites != null) + { + int j = this.vertexCount / 4; + atextureatlassprite = new TextureAtlasSprite[j]; + System.arraycopy(this.quadSprites, 0, atextureatlassprite, 0, j); + } + + return new WorldRenderer.State(aint, new VertexFormat(this.vertexFormat), atextureatlassprite); + } + + public int func_181664_j() + { + return this.vertexCount * this.vertexFormat.func_181719_f(); + } + + private static float func_181665_a(FloatBuffer p_181665_0_, float p_181665_1_, float p_181665_2_, float p_181665_3_, int p_181665_4_, int p_181665_5_) + { + float f = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 0 + 0); + float f1 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 0 + 1); + float f2 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 0 + 2); + float f3 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 1 + 0); + float f4 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 1 + 1); + float f5 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 1 + 2); + float f6 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 2 + 0); + float f7 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 2 + 1); + float f8 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 2 + 2); + float f9 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 3 + 0); + float f10 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 3 + 1); + float f11 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 3 + 2); + float f12 = (f + f3 + f6 + f9) * 0.25F - p_181665_1_; + float f13 = (f1 + f4 + f7 + f10) * 0.25F - p_181665_2_; + float f14 = (f2 + f5 + f8 + f11) * 0.25F - p_181665_3_; + return f12 * f12 + f13 * f13 + f14 * f14; + } + + public void setVertexState(WorldRenderer.State state) + { + this.rawIntBuffer.clear(); + this.func_181670_b(state.getRawBuffer().length); + this.rawIntBuffer.put(state.getRawBuffer()); + this.vertexCount = state.getVertexCount(); + this.vertexFormat = new VertexFormat(state.getVertexFormat()); + + if (state.stateQuadSprites != null) + { + if (this.quadSprites == null) + { + this.quadSprites = this.quadSpritesPrev; + } + + if (this.quadSprites == null || this.quadSprites.length < this.getBufferQuadSize()) + { + this.quadSprites = new TextureAtlasSprite[this.getBufferQuadSize()]; + } + + TextureAtlasSprite[] atextureatlassprite = state.stateQuadSprites; + System.arraycopy(atextureatlassprite, 0, this.quadSprites, 0, atextureatlassprite.length); + } + else + { + if (this.quadSprites != null) + { + this.quadSpritesPrev = this.quadSprites; + } + + this.quadSprites = null; + } + } + + public void reset() + { + this.vertexCount = 0; + this.field_181677_f = null; + this.field_181678_g = 0; + this.quadSprite = null; + } + + public void begin(int p_181668_1_, VertexFormat p_181668_2_) + { + if (this.isDrawing) + { + throw new IllegalStateException("Already building!"); + } + else + { + this.isDrawing = true; + this.reset(); + this.drawMode = p_181668_1_; + this.vertexFormat = p_181668_2_; + this.field_181677_f = p_181668_2_.getElement(this.field_181678_g); + this.needsUpdate = false; + this.byteBuffer.limit(this.byteBuffer.capacity()); + + if (Config.isShaders()) + { + SVertexBuilder.endSetVertexFormat(this); + } + + if (Config.isMultiTexture()) + { + if (this.blockLayer != null) + { + if (this.quadSprites == null) + { + this.quadSprites = this.quadSpritesPrev; + } + + if (this.quadSprites == null || this.quadSprites.length < this.getBufferQuadSize()) + { + this.quadSprites = new TextureAtlasSprite[this.getBufferQuadSize()]; + } + } + } + else + { + if (this.quadSprites != null) + { + this.quadSpritesPrev = this.quadSprites; + } + + this.quadSprites = null; + } + } + } + + public WorldRenderer tex(double p_181673_1_, double p_181673_3_) + { + if (this.quadSprite != null && this.quadSprites != null) + { + p_181673_1_ = (double)this.quadSprite.toSingleU((float)p_181673_1_); + p_181673_3_ = (double)this.quadSprite.toSingleV((float)p_181673_3_); + this.quadSprites[this.vertexCount / 4] = this.quadSprite; + } + + int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.func_181720_d(this.field_181678_g); + + switch (WorldRenderer.WorldRenderer$2.field_181661_a[this.field_181677_f.getType().ordinal()]) + { + case 1: + this.byteBuffer.putFloat(i, (float)p_181673_1_); + this.byteBuffer.putFloat(i + 4, (float)p_181673_3_); + break; + + case 2: + case 3: + this.byteBuffer.putInt(i, (int)p_181673_1_); + this.byteBuffer.putInt(i + 4, (int)p_181673_3_); + break; + + case 4: + case 5: + this.byteBuffer.putShort(i, (short)((int)p_181673_3_)); + this.byteBuffer.putShort(i + 2, (short)((int)p_181673_1_)); + break; + + case 6: + case 7: + this.byteBuffer.put(i, (byte)((int)p_181673_3_)); + this.byteBuffer.put(i + 1, (byte)((int)p_181673_1_)); + } + + this.func_181667_k(); + return this; + } + + public WorldRenderer lightmap(int p_181671_1_, int p_181671_2_) + { + int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.func_181720_d(this.field_181678_g); + + switch (WorldRenderer.WorldRenderer$2.field_181661_a[this.field_181677_f.getType().ordinal()]) + { + case 1: + this.byteBuffer.putFloat(i, (float)p_181671_1_); + this.byteBuffer.putFloat(i + 4, (float)p_181671_2_); + break; + + case 2: + case 3: + this.byteBuffer.putInt(i, p_181671_1_); + this.byteBuffer.putInt(i + 4, p_181671_2_); + break; + + case 4: + case 5: + this.byteBuffer.putShort(i, (short)p_181671_2_); + this.byteBuffer.putShort(i + 2, (short)p_181671_1_); + break; + + case 6: + case 7: + this.byteBuffer.put(i, (byte)p_181671_2_); + this.byteBuffer.put(i + 1, (byte)p_181671_1_); + } + + this.func_181667_k(); + return this; + } + + public void putBrightness4(int p_178962_1_, int p_178962_2_, int p_178962_3_, int p_178962_4_) + { + int i = (this.vertexCount - 4) * this.vertexFormat.func_181719_f() + this.vertexFormat.getUvOffsetById(1) / 4; + int j = this.vertexFormat.getNextOffset() >> 2; + this.rawIntBuffer.put(i, p_178962_1_); + this.rawIntBuffer.put(i + j, p_178962_2_); + this.rawIntBuffer.put(i + j * 2, p_178962_3_); + this.rawIntBuffer.put(i + j * 3, p_178962_4_); + } + + public void putPosition(double x, double y, double z) + { + int i = this.vertexFormat.func_181719_f(); + int j = (this.vertexCount - 4) * i; + + for (int k = 0; k < 4; ++k) + { + int l = j + k * i; + int i1 = l + 1; + int j1 = i1 + 1; + this.rawIntBuffer.put(l, Float.floatToRawIntBits((float)(x + this.xOffset) + Float.intBitsToFloat(this.rawIntBuffer.get(l)))); + this.rawIntBuffer.put(i1, Float.floatToRawIntBits((float)(y + this.yOffset) + Float.intBitsToFloat(this.rawIntBuffer.get(i1)))); + this.rawIntBuffer.put(j1, Float.floatToRawIntBits((float)(z + this.zOffset) + Float.intBitsToFloat(this.rawIntBuffer.get(j1)))); + } + } + + /** + * Takes in the pass the call list is being requested for. Args: renderPass + */ + public int getColorIndex(int p_78909_1_) + { + return ((this.vertexCount - p_78909_1_) * this.vertexFormat.getNextOffset() + this.vertexFormat.getColorOffset()) / 4; + } + + public void putColorMultiplier(float red, float green, float blue, int p_178978_4_) + { + int i = this.getColorIndex(p_178978_4_); + int j = -1; + + if (!this.needsUpdate) + { + j = this.rawIntBuffer.get(i); + + if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) + { + int k = (int)((float)(j & 255) * red); + int l = (int)((float)(j >> 8 & 255) * green); + int i1 = (int)((float)(j >> 16 & 255) * blue); + j = j & -16777216; + j = j | i1 << 16 | l << 8 | k; + } + else + { + int j1 = (int)((float)(j >> 24 & 255) * red); + int k1 = (int)((float)(j >> 16 & 255) * green); + int l1 = (int)((float)(j >> 8 & 255) * blue); + j = j & 255; + j = j | j1 << 24 | k1 << 16 | l1 << 8; + } + } + + this.rawIntBuffer.put(i, j); + } + + private void putColor(int argb, int p_178988_2_) + { + int i = this.getColorIndex(p_178988_2_); + int j = argb >> 16 & 255; + int k = argb >> 8 & 255; + int l = argb & 255; + int i1 = argb >> 24 & 255; + this.putColorRGBA(i, j, k, l, i1); + } + + public void putColorRGB_F(float red, float green, float blue, int p_178994_4_) + { + int i = this.getColorIndex(p_178994_4_); + int j = MathHelper.clamp_int((int)(red * 255.0F), 0, 255); + int k = MathHelper.clamp_int((int)(green * 255.0F), 0, 255); + int l = MathHelper.clamp_int((int)(blue * 255.0F), 0, 255); + this.putColorRGBA(i, j, k, l, 255); + } + + public void putColorRGBA(int index, int red, int p_178972_3_, int p_178972_4_, int p_178972_5_) + { + if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) + { + this.rawIntBuffer.put(index, p_178972_5_ << 24 | p_178972_4_ << 16 | p_178972_3_ << 8 | red); + } + else + { + this.rawIntBuffer.put(index, red << 24 | p_178972_3_ << 16 | p_178972_4_ << 8 | p_178972_5_); + } + } + + /** + * Marks the current renderer data as dirty and needing to be updated. + */ + public void markDirty() + { + this.needsUpdate = true; + } + + public WorldRenderer color(float p_181666_1_, float p_181666_2_, float p_181666_3_, float p_181666_4_) + { + return this.color((int)(p_181666_1_ * 255.0F), (int)(p_181666_2_ * 255.0F), (int)(p_181666_3_ * 255.0F), (int)(p_181666_4_ * 255.0F)); + } + + public WorldRenderer color(int p_181669_1_, int p_181669_2_, int p_181669_3_, int p_181669_4_) + { + if (this.needsUpdate) + { + return this; + } + else + { + int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.func_181720_d(this.field_181678_g); + + switch (WorldRenderer.WorldRenderer$2.field_181661_a[this.field_181677_f.getType().ordinal()]) + { + case 1: + this.byteBuffer.putFloat(i, (float)p_181669_1_ / 255.0F); + this.byteBuffer.putFloat(i + 4, (float)p_181669_2_ / 255.0F); + this.byteBuffer.putFloat(i + 8, (float)p_181669_3_ / 255.0F); + this.byteBuffer.putFloat(i + 12, (float)p_181669_4_ / 255.0F); + break; + + case 2: + case 3: + this.byteBuffer.putFloat(i, (float)p_181669_1_); + this.byteBuffer.putFloat(i + 4, (float)p_181669_2_); + this.byteBuffer.putFloat(i + 8, (float)p_181669_3_); + this.byteBuffer.putFloat(i + 12, (float)p_181669_4_); + break; + + case 4: + case 5: + this.byteBuffer.putShort(i, (short)p_181669_1_); + this.byteBuffer.putShort(i + 2, (short)p_181669_2_); + this.byteBuffer.putShort(i + 4, (short)p_181669_3_); + this.byteBuffer.putShort(i + 6, (short)p_181669_4_); + break; + + case 6: + case 7: + if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) + { + this.byteBuffer.put(i, (byte)p_181669_1_); + this.byteBuffer.put(i + 1, (byte)p_181669_2_); + this.byteBuffer.put(i + 2, (byte)p_181669_3_); + this.byteBuffer.put(i + 3, (byte)p_181669_4_); + } + else + { + this.byteBuffer.put(i, (byte)p_181669_4_); + this.byteBuffer.put(i + 1, (byte)p_181669_3_); + this.byteBuffer.put(i + 2, (byte)p_181669_2_); + this.byteBuffer.put(i + 3, (byte)p_181669_1_); + } + } + + this.func_181667_k(); + return this; + } + } + + public void addVertexData(int[] vertexData) + { + if (Config.isShaders()) + { + SVertexBuilder.beginAddVertexData(this, vertexData); + } + + this.func_181670_b(vertexData.length); + this.rawIntBuffer.position(this.func_181664_j()); + this.rawIntBuffer.put(vertexData); + this.vertexCount += vertexData.length / this.vertexFormat.func_181719_f(); + + if (Config.isShaders()) + { + SVertexBuilder.endAddVertexData(this); + } + } + + public void endVertex() + { + ++this.vertexCount; + this.func_181670_b(this.vertexFormat.func_181719_f()); + this.field_181678_g = 0; + this.field_181677_f = this.vertexFormat.getElement(this.field_181678_g); + + if (Config.isShaders()) + { + SVertexBuilder.endAddVertex(this); + } + } + + public WorldRenderer pos(double p_181662_1_, double p_181662_3_, double p_181662_5_) + { + if (Config.isShaders()) + { + SVertexBuilder.beginAddVertex(this); + } + + int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.func_181720_d(this.field_181678_g); + + switch (WorldRenderer.WorldRenderer$2.field_181661_a[this.field_181677_f.getType().ordinal()]) + { + case 1: + this.byteBuffer.putFloat(i, (float)(p_181662_1_ + this.xOffset)); + this.byteBuffer.putFloat(i + 4, (float)(p_181662_3_ + this.yOffset)); + this.byteBuffer.putFloat(i + 8, (float)(p_181662_5_ + this.zOffset)); + break; + + case 2: + case 3: + this.byteBuffer.putInt(i, Float.floatToRawIntBits((float)(p_181662_1_ + this.xOffset))); + this.byteBuffer.putInt(i + 4, Float.floatToRawIntBits((float)(p_181662_3_ + this.yOffset))); + this.byteBuffer.putInt(i + 8, Float.floatToRawIntBits((float)(p_181662_5_ + this.zOffset))); + break; + + case 4: + case 5: + this.byteBuffer.putShort(i, (short)((int)(p_181662_1_ + this.xOffset))); + this.byteBuffer.putShort(i + 2, (short)((int)(p_181662_3_ + this.yOffset))); + this.byteBuffer.putShort(i + 4, (short)((int)(p_181662_5_ + this.zOffset))); + break; + + case 6: + case 7: + this.byteBuffer.put(i, (byte)((int)(p_181662_1_ + this.xOffset))); + this.byteBuffer.put(i + 1, (byte)((int)(p_181662_3_ + this.yOffset))); + this.byteBuffer.put(i + 2, (byte)((int)(p_181662_5_ + this.zOffset))); + } + + this.func_181667_k(); + return this; + } + + public void putNormal(float x, float y, float z) + { + int i = (byte)((int)(x * 127.0F)) & 255; + int j = (byte)((int)(y * 127.0F)) & 255; + int k = (byte)((int)(z * 127.0F)) & 255; + int l = i | j << 8 | k << 16; + int i1 = this.vertexFormat.getNextOffset() >> 2; + int j1 = (this.vertexCount - 4) * i1 + this.vertexFormat.getNormalOffset() / 4; + this.rawIntBuffer.put(j1, l); + this.rawIntBuffer.put(j1 + i1, l); + this.rawIntBuffer.put(j1 + i1 * 2, l); + this.rawIntBuffer.put(j1 + i1 * 3, l); + } + + private void func_181667_k() + { + ++this.field_181678_g; + this.field_181678_g %= this.vertexFormat.getElementCount(); + this.field_181677_f = this.vertexFormat.getElement(this.field_181678_g); + + if (this.field_181677_f.getUsage() == VertexFormatElement.EnumUsage.PADDING) + { + this.func_181667_k(); + } + } + + public WorldRenderer normal(float p_181663_1_, float p_181663_2_, float p_181663_3_) + { + int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.func_181720_d(this.field_181678_g); + + switch (WorldRenderer.WorldRenderer$2.field_181661_a[this.field_181677_f.getType().ordinal()]) + { + case 1: + this.byteBuffer.putFloat(i, p_181663_1_); + this.byteBuffer.putFloat(i + 4, p_181663_2_); + this.byteBuffer.putFloat(i + 8, p_181663_3_); + break; + + case 2: + case 3: + this.byteBuffer.putInt(i, (int)p_181663_1_); + this.byteBuffer.putInt(i + 4, (int)p_181663_2_); + this.byteBuffer.putInt(i + 8, (int)p_181663_3_); + break; + + case 4: + case 5: + this.byteBuffer.putShort(i, (short)((int)(p_181663_1_ * 32767.0F) & 65535)); + this.byteBuffer.putShort(i + 2, (short)((int)(p_181663_2_ * 32767.0F) & 65535)); + this.byteBuffer.putShort(i + 4, (short)((int)(p_181663_3_ * 32767.0F) & 65535)); + break; + + case 6: + case 7: + this.byteBuffer.put(i, (byte)((int)(p_181663_1_ * 127.0F) & 255)); + this.byteBuffer.put(i + 1, (byte)((int)(p_181663_2_ * 127.0F) & 255)); + this.byteBuffer.put(i + 2, (byte)((int)(p_181663_3_ * 127.0F) & 255)); + } + + this.func_181667_k(); + return this; + } + + public void setTranslation(double x, double y, double z) + { + this.xOffset = x; + this.yOffset = y; + this.zOffset = z; + } + + public void finishDrawing() + { + if (!this.isDrawing) + { + throw new IllegalStateException("Not building!"); + } + else + { + this.isDrawing = false; + this.byteBuffer.position(0); + this.byteBuffer.limit(this.func_181664_j() * 4); + } + } + + public ByteBuffer getByteBuffer() + { + return this.byteBuffer; + } + + public VertexFormat getVertexFormat() + { + return this.vertexFormat; + } + + public int getVertexCount() + { + return this.vertexCount; + } + + public int getDrawMode() + { + return this.drawMode; + } + + public void putColor4(int argb) + { + for (int i = 0; i < 4; ++i) + { + this.putColor(argb, i + 1); + } + } + + public void putColorRGB_F4(float red, float green, float blue) + { + for (int i = 0; i < 4; ++i) + { + this.putColorRGB_F(red, green, blue, i + 1); + } + } + + public void putSprite(TextureAtlasSprite p_putSprite_1_) + { + if (this.quadSprites != null) + { + int i = this.vertexCount / 4; + this.quadSprites[i - 1] = p_putSprite_1_; + } + } + + public void setSprite(TextureAtlasSprite p_setSprite_1_) + { + if (this.quadSprites != null) + { + this.quadSprite = p_setSprite_1_; + } + } + + public boolean isMultiTexture() + { + return this.quadSprites != null; + } + + public void drawMultiTexture() + { + if (this.quadSprites != null) + { + int i = Config.getMinecraft().getTextureMapBlocks().getCountRegisteredSprites(); + + if (this.drawnIcons.length <= i) + { + this.drawnIcons = new boolean[i + 1]; + } + + Arrays.fill(this.drawnIcons, false); + int j = 0; + int k = -1; + int l = this.vertexCount / 4; + + for (int i1 = 0; i1 < l; ++i1) + { + TextureAtlasSprite textureatlassprite = this.quadSprites[i1]; + + if (textureatlassprite != null) + { + int j1 = textureatlassprite.getIndexInMap(); + + if (!this.drawnIcons[j1]) + { + if (textureatlassprite == TextureUtils.iconGrassSideOverlay) + { + if (k < 0) + { + k = i1; + } + } + else + { + i1 = this.drawForIcon(textureatlassprite, i1) - 1; + ++j; + + if (this.blockLayer != EnumWorldBlockLayer.TRANSLUCENT) + { + this.drawnIcons[j1] = true; + } + } + } + } + } + + if (k >= 0) + { + this.drawForIcon(TextureUtils.iconGrassSideOverlay, k); + ++j; + } + + if (j > 0) + { + ; + } + } + } + + private int drawForIcon(TextureAtlasSprite p_drawForIcon_1_, int p_drawForIcon_2_) + { + GL11.glBindTexture(GL11.GL_TEXTURE_2D, p_drawForIcon_1_.glSpriteTextureId); + int i = -1; + int j = -1; + int k = this.vertexCount / 4; + + for (int l = p_drawForIcon_2_; l < k; ++l) + { + TextureAtlasSprite textureatlassprite = this.quadSprites[l]; + + if (textureatlassprite == p_drawForIcon_1_) + { + if (j < 0) + { + j = l; + } + } + else if (j >= 0) + { + this.draw(j, l); + + if (this.blockLayer == EnumWorldBlockLayer.TRANSLUCENT) + { + return l; + } + + j = -1; + + if (i < 0) + { + i = l; + } + } + } + + if (j >= 0) + { + this.draw(j, k); + } + + if (i < 0) + { + i = k; + } + + return i; + } + + private void draw(int p_draw_1_, int p_draw_2_) + { + int i = p_draw_2_ - p_draw_1_; + + if (i > 0) + { + int j = p_draw_1_ * 4; + int k = i * 4; + GL11.glDrawArrays(this.drawMode, j, k); + } + } + + public void setBlockLayer(EnumWorldBlockLayer p_setBlockLayer_1_) + { + this.blockLayer = p_setBlockLayer_1_; + + if (p_setBlockLayer_1_ == null) + { + if (this.quadSprites != null) + { + this.quadSpritesPrev = this.quadSprites; + } + + this.quadSprites = null; + this.quadSprite = null; + } + } + + private int getBufferQuadSize() + { + int i = this.rawIntBuffer.capacity() * 4 / (this.vertexFormat.func_181719_f() * 4); + return i; + } + + public void checkAndGrow() + { + this.func_181670_b(this.vertexFormat.func_181719_f()); + } + + public boolean isColorDisabled() + { + return this.needsUpdate; + } + + static final class WorldRenderer$2 + { + static final int[] field_181661_a = new int[VertexFormatElement.EnumType.values().length]; + private static final String __OBFID = "CL_00002569"; + + static + { + try + { + field_181661_a[VertexFormatElement.EnumType.FLOAT.ordinal()] = 1; + } + catch (NoSuchFieldError var7) + { + ; + } + + try + { + field_181661_a[VertexFormatElement.EnumType.UINT.ordinal()] = 2; + } + catch (NoSuchFieldError var6) + { + ; + } + + try + { + field_181661_a[VertexFormatElement.EnumType.INT.ordinal()] = 3; + } + catch (NoSuchFieldError var5) + { + ; + } + + try + { + field_181661_a[VertexFormatElement.EnumType.USHORT.ordinal()] = 4; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_181661_a[VertexFormatElement.EnumType.SHORT.ordinal()] = 5; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_181661_a[VertexFormatElement.EnumType.UBYTE.ordinal()] = 6; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_181661_a[VertexFormatElement.EnumType.BYTE.ordinal()] = 7; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } + + public class State + { + private final int[] stateRawBuffer; + private final VertexFormat stateVertexFormat; + private static final String __OBFID = "CL_00002568"; + private TextureAtlasSprite[] stateQuadSprites; + + public State(int[] p_i2_2_, VertexFormat p_i2_3_, TextureAtlasSprite[] p_i2_4_) + { + this.stateRawBuffer = p_i2_2_; + this.stateVertexFormat = p_i2_3_; + this.stateQuadSprites = p_i2_4_; + } + + public State(int[] p_i46453_2_, VertexFormat p_i46453_3_) + { + this.stateRawBuffer = p_i46453_2_; + this.stateVertexFormat = p_i46453_3_; + } + + public int[] getRawBuffer() + { + return this.stateRawBuffer; + } + + public int getVertexCount() + { + return this.stateRawBuffer.length / this.stateVertexFormat.func_181719_f(); + } + + public VertexFormat getVertexFormat() + { + return this.stateVertexFormat; + } + } + + public WorldRenderer func_181662_b(double p_181662_1_, double p_181662_3_, double p_181662_5_) { + if (Config.isShaders()) + SVertexBuilder.beginAddVertex(this); + int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.func_181720_d(this.field_181678_g); + switch (this.field_181677_f.getType()) { + case FLOAT: + this.byteBuffer.putFloat(i, (float)(p_181662_1_ + this.xOffset)); + this.byteBuffer.putFloat(i + 4, (float)(p_181662_3_ + this.yOffset)); + this.byteBuffer.putFloat(i + 8, (float)(p_181662_5_ + this.zOffset)); + break; + case UINT: + case INT: + this.byteBuffer.putInt(i, Float.floatToRawIntBits((float)(p_181662_1_ + this.xOffset))); + this.byteBuffer.putInt(i + 4, Float.floatToRawIntBits((float)(p_181662_3_ + this.yOffset))); + this.byteBuffer.putInt(i + 8, Float.floatToRawIntBits((float)(p_181662_5_ + this.zOffset))); + break; + case USHORT: + case SHORT: + this.byteBuffer.putShort(i, (short)(int)(p_181662_1_ + this.xOffset)); + this.byteBuffer.putShort(i + 2, (short)(int)(p_181662_3_ + this.yOffset)); + this.byteBuffer.putShort(i + 4, (short)(int)(p_181662_5_ + this.zOffset)); + break; + case UBYTE: + case BYTE: + this.byteBuffer.put(i, (byte)(int)(p_181662_1_ + this.xOffset)); + this.byteBuffer.put(i + 1, (byte)(int)(p_181662_3_ + this.yOffset)); + this.byteBuffer.put(i + 2, (byte)(int)(p_181662_5_ + this.zOffset)); + break; + } + func_181667_k(); + return this; + } + + public void func_181668_a(int p_181668_1_, VertexFormat p_181668_2_) { + if (this.isDrawing) + throw new IllegalStateException("Already building!"); + this.isDrawing = true; + reset(); + this.drawMode = p_181668_1_; + this.vertexFormat = p_181668_2_; + this.field_181677_f = p_181668_2_.getElement(this.field_181678_g); + this.needsUpdate = false; + this.byteBuffer.limit(this.byteBuffer.capacity()); + if (Config.isShaders()) + SVertexBuilder.endSetVertexFormat(this); + if (Config.isMultiTexture()) { + if (this.blockLayer != null) { + if (this.quadSprites == null) + this.quadSprites = this.quadSpritesPrev; + if (this.quadSprites == null || this.quadSprites.length < getBufferQuadSize()) + this.quadSprites = new TextureAtlasSprite[getBufferQuadSize()]; + } + } else { + if (this.quadSprites != null) + this.quadSpritesPrev = this.quadSprites; + this.quadSprites = null; + } + } + + public WorldRenderer func_181666_a(float p_181666_1_, float p_181666_2_, float p_181666_3_, float p_181666_4_) { + return func_181669_b((int)(p_181666_1_ * 255.0F), (int)(p_181666_2_ * 255.0F), (int)(p_181666_3_ * 255.0F), (int)(p_181666_4_ * 255.0F)); + } + public WorldRenderer func_181669_b(int p_181669_1_, int p_181669_2_, int p_181669_3_, int p_181669_4_) { + if (this.needsUpdate) + return this; + int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.func_181720_d(this.field_181678_g); + switch (this.field_181677_f.getType()) { + case FLOAT: + this.byteBuffer.putFloat(i, p_181669_1_ / 255.0F); + this.byteBuffer.putFloat(i + 4, p_181669_2_ / 255.0F); + this.byteBuffer.putFloat(i + 8, p_181669_3_ / 255.0F); + this.byteBuffer.putFloat(i + 12, p_181669_4_ / 255.0F); + break; + case UINT: + case INT: + this.byteBuffer.putFloat(i, p_181669_1_); + this.byteBuffer.putFloat(i + 4, p_181669_2_); + this.byteBuffer.putFloat(i + 8, p_181669_3_); + this.byteBuffer.putFloat(i + 12, p_181669_4_); + break; + case USHORT: + case SHORT: + this.byteBuffer.putShort(i, (short)p_181669_1_); + this.byteBuffer.putShort(i + 2, (short)p_181669_2_); + this.byteBuffer.putShort(i + 4, (short)p_181669_3_); + this.byteBuffer.putShort(i + 6, (short)p_181669_4_); + break; + case UBYTE: + case BYTE: + if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) { + this.byteBuffer.put(i, (byte)p_181669_1_); + this.byteBuffer.put(i + 1, (byte)p_181669_2_); + this.byteBuffer.put(i + 2, (byte)p_181669_3_); + this.byteBuffer.put(i + 3, (byte)p_181669_4_); + break; + } + this.byteBuffer.put(i, (byte)p_181669_4_); + this.byteBuffer.put(i + 1, (byte)p_181669_3_); + this.byteBuffer.put(i + 2, (byte)p_181669_2_); + this.byteBuffer.put(i + 3, (byte)p_181669_1_); + break; + } + func_181667_k(); + return this; + } + + public void func_181675_d() { + this.vertexCount++; + func_181670_b(this.vertexFormat.func_181719_f()); + this.field_181678_g = 0; + this.field_181677_f = this.vertexFormat.getElement(this.field_181678_g); + if (Config.isShaders()) + SVertexBuilder.endAddVertex(this); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/WorldVertexBu# b/src/minecraft/net/minecraft/client/renderer/WorldVertexBu# new file mode 100644 index 0000000..e433ecf --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/WorldVertexBu# @@ -0,0 +1,16 @@ +*************** +*** 10,15 **** + import org.lwjgl.opengl.GL11; + + public class WorldVertexBufferUploader { + public void func_181679_a(WorldRenderer p_181679_1_) { + if(p_181679_1_.func_178989_h() > 0) { + VertexFormat vertexformat = p_181679_1_.func_178973_g(); +--- 10,16 ---- + import org.lwjgl.opengl.GL11; + + public class WorldVertexBufferUploader { ++ @SuppressWarnings("incomplete-switch") + public void func_181679_a(WorldRenderer p_181679_1_) { + if(p_181679_1_.func_178989_h() > 0) { + VertexFormat vertexformat = p_181679_1_.func_178973_g(); diff --git a/src/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java b/src/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java new file mode 100644 index 0000000..ebba8e9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java @@ -0,0 +1,168 @@ +package net.minecraft.client.renderer; + +import java.nio.ByteBuffer; +import java.util.List; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import optifine.Config; +import optifine.Reflector; + +import org.lwjgl.opengl.GL11; +import shadersmod.client.SVertexBuilder; + +public class WorldVertexBufferUploader +{ + private static final String __OBFID = "CL_00002567"; + + public void func_181679_a(WorldRenderer p_181679_1_) + { + if (p_181679_1_.getVertexCount() > 0) + { + VertexFormat vertexformat = p_181679_1_.getVertexFormat(); + int i = vertexformat.getNextOffset(); + ByteBuffer bytebuffer = p_181679_1_.getByteBuffer(); + List list = vertexformat.getElements(); + boolean flag = Reflector.ForgeVertexFormatElementEnumUseage_preDraw.exists(); + boolean flag1 = Reflector.ForgeVertexFormatElementEnumUseage_postDraw.exists(); + + for (int j = 0; j < list.size(); ++j) + { + VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j); + VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage(); + + if (flag) + { + Reflector.callVoid(vertexformatelement$enumusage, Reflector.ForgeVertexFormatElementEnumUseage_preDraw, new Object[] {vertexformat, Integer.valueOf(j), Integer.valueOf(i), bytebuffer}); + } + else + { + int l = vertexformatelement.getType().getGlConstant(); + int k = vertexformatelement.getIndex(); + bytebuffer.position(vertexformat.func_181720_d(j)); + + switch (WorldVertexBufferUploader.WorldVertexBufferUploader$1.field_178958_a[vertexformatelement$enumusage.ordinal()]) + { + case 1: + GL11.glVertexPointer(vertexformatelement.getElementCount(), l, i, bytebuffer); + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + break; + + case 2: + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k); + GL11.glTexCoordPointer(vertexformatelement.getElementCount(), l, i, bytebuffer); + GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + break; + + case 3: + GL11.glColorPointer(vertexformatelement.getElementCount(), l, i, bytebuffer); + GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); + break; + + case 4: + GL11.glNormalPointer(l, i, bytebuffer); + GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); + } + } + } + + if (p_181679_1_.isMultiTexture()) + { + p_181679_1_.drawMultiTexture(); + } + else if (Config.isShaders()) + { + SVertexBuilder.drawArrays(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount(), p_181679_1_); + } + else + { + GL11.glDrawArrays(p_181679_1_.getDrawMode(), 0, p_181679_1_.getVertexCount()); + } + + int i1 = 0; + + for (int k1 = list.size(); i1 < k1; ++i1) + { + VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1); + VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage(); + + if (flag1) + { + Reflector.callVoid(vertexformatelement$enumusage1, Reflector.ForgeVertexFormatElementEnumUseage_postDraw, new Object[] {vertexformat, Integer.valueOf(i1), Integer.valueOf(i), bytebuffer}); + } + else + { + int j1 = vertexformatelement1.getIndex(); + + switch (WorldVertexBufferUploader.WorldVertexBufferUploader$1.field_178958_a[vertexformatelement$enumusage1.ordinal()]) + { + case 1: + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + break; + + case 2: + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + j1); + GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + break; + + case 3: + GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); + GlStateManager.resetColor(); + break; + + case 4: + GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); + } + } + } + } + + p_181679_1_.reset(); + } + + static final class WorldVertexBufferUploader$1 + { + static final int[] field_178958_a = new int[VertexFormatElement.EnumUsage.values().length]; + private static final String __OBFID = "CL_00002566"; + + static + { + try + { + field_178958_a[VertexFormatElement.EnumUsage.POSITION.ordinal()] = 1; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_178958_a[VertexFormatElement.EnumUsage.UV.ordinal()] = 2; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_178958_a[VertexFormatElement.EnumUsage.COLOR.ordinal()] = 3; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_178958_a[VertexFormatElement.EnumUsage.NORMAL.ordinal()] = 4; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/WorldVertexBu~ b/src/minecraft/net/minecraft/client/renderer/WorldVertexBu~ new file mode 100644 index 0000000..4d4a7c9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/WorldVertexBu~ @@ -0,0 +1,129 @@ +package net.minecraft.client.renderer; + +import java.nio.ByteBuffer; +import java.util.List; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.src.Config; +import net.minecraft.src.Reflector; +import org.lwjgl.opengl.GL11; +import shadersmod.client.SVertexBuilder; + +public class WorldVertexBufferUploader { + private static final String __OBFID = "CL_00002567"; + + public void func_181679_a(WorldRenderer p_181679_1_) { + if(p_181679_1_.func_178989_h() > 0) { + VertexFormat vertexformat = p_181679_1_.func_178973_g(); + int i = vertexformat.func_177338_f(); + ByteBuffer bytebuffer = p_181679_1_.func_178966_f(); + List list = vertexformat.func_177343_g(); + boolean flag = Reflector.ForgeVertexFormatElementEnumUseage_preDraw.exists(); + boolean flag1 = Reflector.ForgeVertexFormatElementEnumUseage_postDraw.exists(); + + for(int j = 0; j < list.size(); ++j) { + VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j); + VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.func_177375_c(); + if(flag) { + Reflector.callVoid(vertexformatelement$enumusage, Reflector.ForgeVertexFormatElementEnumUseage_preDraw, new Object[]{vertexformat, Integer.valueOf(j), Integer.valueOf(i), bytebuffer}); + } else { + int l = vertexformatelement.func_177367_b().func_177397_c(); + int k = vertexformatelement.func_177369_e(); + bytebuffer.position(vertexformat.func_181720_d(j)); + switch(WorldVertexBufferUploader.WorldVertexBufferUploader$1.field_178958_a[vertexformatelement$enumusage.ordinal()]) { + case 1: + GL11.glVertexPointer(vertexformatelement.func_177370_d(), l, i, bytebuffer); + GL11.glEnableClientState('\u8074'); + break; + case 2: + OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + k); + GL11.glTexCoordPointer(vertexformatelement.func_177370_d(), l, i, bytebuffer); + GL11.glEnableClientState('\u8078'); + OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); + break; + case 3: + GL11.glColorPointer(vertexformatelement.func_177370_d(), l, i, bytebuffer); + GL11.glEnableClientState('\u8076'); + break; + case 4: + GL11.glNormalPointer(l, i, bytebuffer); + GL11.glEnableClientState('\u8075'); + } + } + } + + if(p_181679_1_.isMultiTexture()) { + p_181679_1_.drawMultiTexture(); + } else if(Config.isShaders()) { + SVertexBuilder.drawArrays(p_181679_1_.func_178979_i(), 0, p_181679_1_.func_178989_h(), p_181679_1_); + } else { + GL11.glDrawArrays(p_181679_1_.func_178979_i(), 0, p_181679_1_.func_178989_h()); + } + + int i1 = 0; + + for(int k1 = list.size(); i1 < k1; ++i1) { + VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1); + VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.func_177375_c(); + if(flag1) { + Reflector.callVoid(vertexformatelement$enumusage1, Reflector.ForgeVertexFormatElementEnumUseage_postDraw, new Object[]{vertexformat, Integer.valueOf(i1), Integer.valueOf(i), bytebuffer}); + } else { + int j1 = vertexformatelement1.func_177369_e(); + switch(WorldVertexBufferUploader.WorldVertexBufferUploader$1.field_178958_a[vertexformatelement$enumusage1.ordinal()]) { + case 1: + GL11.glDisableClientState('\u8074'); + break; + case 2: + OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + j1); + GL11.glDisableClientState('\u8078'); + OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a); + break; + case 3: + GL11.glDisableClientState('\u8076'); + GlStateManager.func_179117_G(); + break; + case 4: + GL11.glDisableClientState('\u8075'); + } + } + } + } + + p_181679_1_.func_178965_a(); + } + + static final class WorldVertexBufferUploader$1 { + static final int[] field_178958_a = new int[VertexFormatElement.EnumUsage.values().length]; + private static final String __OBFID = "CL_00002566"; + + static { + try { + field_178958_a[VertexFormatElement.EnumUsage.POSITION.ordinal()] = 1; + } catch (NoSuchFieldError var4) { + ; + } + + try { + field_178958_a[VertexFormatElement.EnumUsage.UV.ordinal()] = 2; + } catch (NoSuchFieldError var3) { + ; + } + + try { + field_178958_a[VertexFormatElement.EnumUsage.COLOR.ordinal()] = 3; + } catch (NoSuchFieldError var2) { + ; + } + + try { + field_178958_a[VertexFormatElement.EnumUsage.NORMAL.ordinal()] = 4; + } catch (NoSuchFieldError var1) { + ; + } + + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java b/src/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java new file mode 100644 index 0000000..47a4de8 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java @@ -0,0 +1,180 @@ +package net.minecraft.client.renderer.block.model; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.model.pipeline.IVertexConsumer; +import net.minecraftforge.client.model.pipeline.IVertexProducer; +import optifine.Config; +import optifine.Reflector; + +public class BakedQuad implements IVertexProducer +{ + /** + * Joined 4 vertex records, each has 7 fields (x, y, z, shadeColor, u, v, ), see + * FaceBakery.storeVertexData() + */ + protected int[] vertexData; + protected final int tintIndex; + protected final EnumFacing face; + private static final String __OBFID = "CL_00002512"; + private TextureAtlasSprite sprite = null; + private int[] vertexDataSingle = null; + + public BakedQuad(int[] p_i9_1_, int p_i9_2_, EnumFacing p_i9_3_, TextureAtlasSprite p_i9_4_) + { + this.vertexData = p_i9_1_; + this.tintIndex = p_i9_2_; + this.face = p_i9_3_; + this.sprite = p_i9_4_; + this.fixVertexData(); + } + + public TextureAtlasSprite getSprite() + { + if (this.sprite == null) + { + this.sprite = getSpriteByUv(this.getVertexData()); + } + + return this.sprite; + } + + public String toString() + { + return "vertex: " + this.vertexData.length / 7 + ", tint: " + this.tintIndex + ", facing: " + this.face + ", sprite: " + this.sprite; + } + + public BakedQuad(int[] vertexDataIn, int tintIndexIn, EnumFacing faceIn) + { + this.vertexData = vertexDataIn; + this.tintIndex = tintIndexIn; + this.face = faceIn; + this.fixVertexData(); + } + + public int[] getVertexData() + { + this.fixVertexData(); + return this.vertexData; + } + + public boolean hasTintIndex() + { + return this.tintIndex != -1; + } + + public int getTintIndex() + { + return this.tintIndex; + } + + public EnumFacing getFace() + { + return this.face; + } + + public int[] getVertexDataSingle() + { + if (this.vertexDataSingle == null) + { + this.vertexDataSingle = makeVertexDataSingle(this.getVertexData(), this.getSprite()); + } + + return this.vertexDataSingle; + } + + private static int[] makeVertexDataSingle(int[] p_makeVertexDataSingle_0_, TextureAtlasSprite p_makeVertexDataSingle_1_) + { + int[] aint = (int[])p_makeVertexDataSingle_0_.clone(); + int i = p_makeVertexDataSingle_1_.sheetWidth / p_makeVertexDataSingle_1_.getIconWidth(); + int j = p_makeVertexDataSingle_1_.sheetHeight / p_makeVertexDataSingle_1_.getIconHeight(); + int k = aint.length / 4; + + for (int l = 0; l < 4; ++l) + { + int i1 = l * k; + float f = Float.intBitsToFloat(aint[i1 + 4]); + float f1 = Float.intBitsToFloat(aint[i1 + 4 + 1]); + float f2 = p_makeVertexDataSingle_1_.toSingleU(f); + float f3 = p_makeVertexDataSingle_1_.toSingleV(f1); + aint[i1 + 4] = Float.floatToRawIntBits(f2); + aint[i1 + 4 + 1] = Float.floatToRawIntBits(f3); + } + + return aint; + } + + public void pipe(IVertexConsumer p_pipe_1_) + { + Reflector.callVoid(Reflector.LightUtil_putBakedQuad, new Object[] {p_pipe_1_, this}); + } + + private static TextureAtlasSprite getSpriteByUv(int[] p_getSpriteByUv_0_) + { + float f = 1.0F; + float f1 = 1.0F; + float f2 = 0.0F; + float f3 = 0.0F; + int i = p_getSpriteByUv_0_.length / 4; + + for (int j = 0; j < 4; ++j) + { + int k = j * i; + float f4 = Float.intBitsToFloat(p_getSpriteByUv_0_[k + 4]); + float f5 = Float.intBitsToFloat(p_getSpriteByUv_0_[k + 4 + 1]); + f = Math.min(f, f4); + f1 = Math.min(f1, f5); + f2 = Math.max(f2, f4); + f3 = Math.max(f3, f5); + } + + float f6 = (f + f2) / 2.0F; + float f7 = (f1 + f3) / 2.0F; + TextureAtlasSprite textureatlassprite = Minecraft.getMinecraft().getTextureMapBlocks().getIconByUV((double)f6, (double)f7); + return textureatlassprite; + } + + private void fixVertexData() + { + if (Config.isShaders()) + { + if (this.vertexData.length == 28) + { + this.vertexData = expandVertexData(this.vertexData); + } + } + else if (this.vertexData.length == 56) + { + this.vertexData = compactVertexData(this.vertexData); + } + } + + private static int[] expandVertexData(int[] p_expandVertexData_0_) + { + int i = p_expandVertexData_0_.length / 4; + int j = i * 2; + int[] aint = new int[j * 4]; + + for (int k = 0; k < 4; ++k) + { + System.arraycopy(p_expandVertexData_0_, k * i, aint, k * j, i); + } + + return aint; + } + + private static int[] compactVertexData(int[] p_compactVertexData_0_) + { + int i = p_compactVertexData_0_.length / 4; + int j = i / 2; + int[] aint = new int[j * 4]; + + for (int k = 0; k < 4; ++k) + { + System.arraycopy(p_compactVertexData_0_, k * i, aint, k * j, j); + } + + return aint; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/model/BlockFaceUV.java b/src/minecraft/net/minecraft/client/renderer/block/model/BlockFaceUV.java new file mode 100644 index 0000000..be192e6 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/model/BlockFaceUV.java @@ -0,0 +1,119 @@ +package net.minecraft.client.renderer.block.model; + +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.lang.reflect.Type; +import net.minecraft.util.JsonUtils; + +public class BlockFaceUV +{ + public float[] uvs; + public final int rotation; + + public BlockFaceUV(float[] uvsIn, int rotationIn) + { + this.uvs = uvsIn; + this.rotation = rotationIn; + } + + public float func_178348_a(int p_178348_1_) + { + if (this.uvs == null) + { + throw new NullPointerException("uvs"); + } + else + { + int i = this.func_178347_d(p_178348_1_); + return i != 0 && i != 1 ? this.uvs[2] : this.uvs[0]; + } + } + + public float func_178346_b(int p_178346_1_) + { + if (this.uvs == null) + { + throw new NullPointerException("uvs"); + } + else + { + int i = this.func_178347_d(p_178346_1_); + return i != 0 && i != 3 ? this.uvs[3] : this.uvs[1]; + } + } + + private int func_178347_d(int p_178347_1_) + { + return (p_178347_1_ + this.rotation / 90) % 4; + } + + public int func_178345_c(int p_178345_1_) + { + return (p_178345_1_ + (4 - this.rotation / 90)) % 4; + } + + public void setUvs(float[] uvsIn) + { + if (this.uvs == null) + { + this.uvs = uvsIn; + } + } + + static class Deserializer implements JsonDeserializer + { + public BlockFaceUV deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + float[] afloat = this.parseUV(jsonobject); + int i = this.parseRotation(jsonobject); + return new BlockFaceUV(afloat, i); + } + + protected int parseRotation(JsonObject p_178291_1_) + { + int i = JsonUtils.getInt(p_178291_1_, "rotation", 0); + + if (i >= 0 && i % 90 == 0 && i / 90 <= 3) + { + return i; + } + else + { + throw new JsonParseException("Invalid rotation " + i + " found, only 0/90/180/270 allowed"); + } + } + + private float[] parseUV(JsonObject p_178292_1_) + { + if (!p_178292_1_.has("uv")) + { + return null; + } + else + { + JsonArray jsonarray = JsonUtils.getJsonArray(p_178292_1_, "uv"); + + if (jsonarray.size() != 4) + { + throw new JsonParseException("Expected 4 uv values, found: " + jsonarray.size()); + } + else + { + float[] afloat = new float[4]; + + for (int i = 0; i < afloat.length; ++i) + { + afloat[i] = JsonUtils.getFloat(jsonarray.get(i), "uv[" + i + "]"); + } + + return afloat; + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/model/BlockPart.java b/src/minecraft/net/minecraft/client/renderer/block/model/BlockPart.java new file mode 100644 index 0000000..23c2eb3 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/model/BlockPart.java @@ -0,0 +1,229 @@ +package net.minecraft.client.renderer.block.model; + +import com.google.common.collect.Maps; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.lang.reflect.Type; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.JsonUtils; +import net.minecraft.util.MathHelper; +import org.lwjgl.util.vector.Vector3f; + +public class BlockPart +{ + public final Vector3f positionFrom; + public final Vector3f positionTo; + public final Map mapFaces; + public final BlockPartRotation partRotation; + public final boolean shade; + + public BlockPart(Vector3f positionFromIn, Vector3f positionToIn, Map mapFacesIn, BlockPartRotation partRotationIn, boolean shadeIn) + { + this.positionFrom = positionFromIn; + this.positionTo = positionToIn; + this.mapFaces = mapFacesIn; + this.partRotation = partRotationIn; + this.shade = shadeIn; + this.setDefaultUvs(); + } + + private void setDefaultUvs() + { + for (Entry entry : this.mapFaces.entrySet()) + { + float[] afloat = this.getFaceUvs((EnumFacing)entry.getKey()); + ((BlockPartFace)entry.getValue()).blockFaceUV.setUvs(afloat); + } + } + + private float[] getFaceUvs(EnumFacing p_178236_1_) + { + float[] afloat; + + switch (p_178236_1_) + { + case DOWN: + case UP: + afloat = new float[] {this.positionFrom.x, this.positionFrom.z, this.positionTo.x, this.positionTo.z}; + break; + case NORTH: + case SOUTH: + afloat = new float[] {this.positionFrom.x, 16.0F - this.positionTo.y, this.positionTo.x, 16.0F - this.positionFrom.y}; + break; + case WEST: + case EAST: + afloat = new float[] {this.positionFrom.z, 16.0F - this.positionTo.y, this.positionTo.z, 16.0F - this.positionFrom.y}; + break; + default: + throw new NullPointerException(); + } + + return afloat; + } + + static class Deserializer implements JsonDeserializer + { + public BlockPart deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + Vector3f vector3f = this.parsePositionFrom(jsonobject); + Vector3f vector3f1 = this.parsePositionTo(jsonobject); + BlockPartRotation blockpartrotation = this.parseRotation(jsonobject); + Map map = this.parseFacesCheck(p_deserialize_3_, jsonobject); + + if (jsonobject.has("shade") && !JsonUtils.isBoolean(jsonobject, "shade")) + { + throw new JsonParseException("Expected shade to be a Boolean"); + } + else + { + boolean flag = JsonUtils.getBoolean(jsonobject, "shade", true); + return new BlockPart(vector3f, vector3f1, map, blockpartrotation, flag); + } + } + + private BlockPartRotation parseRotation(JsonObject p_178256_1_) + { + BlockPartRotation blockpartrotation = null; + + if (p_178256_1_.has("rotation")) + { + JsonObject jsonobject = JsonUtils.getJsonObject(p_178256_1_, "rotation"); + Vector3f vector3f = this.parsePosition(jsonobject, "origin"); + vector3f.scale(0.0625F); + EnumFacing.Axis enumfacing$axis = this.parseAxis(jsonobject); + float f = this.parseAngle(jsonobject); + boolean flag = JsonUtils.getBoolean(jsonobject, "rescale", false); + blockpartrotation = new BlockPartRotation(vector3f, enumfacing$axis, f, flag); + } + + return blockpartrotation; + } + + private float parseAngle(JsonObject p_178255_1_) + { + float f = JsonUtils.getFloat(p_178255_1_, "angle"); + + if (f != 0.0F && MathHelper.abs(f) != 22.5F && MathHelper.abs(f) != 45.0F) + { + throw new JsonParseException("Invalid rotation " + f + " found, only -45/-22.5/0/22.5/45 allowed"); + } + else + { + return f; + } + } + + private EnumFacing.Axis parseAxis(JsonObject p_178252_1_) + { + String s = JsonUtils.getString(p_178252_1_, "axis"); + EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.byName(s.toLowerCase()); + + if (enumfacing$axis == null) + { + throw new JsonParseException("Invalid rotation axis: " + s); + } + else + { + return enumfacing$axis; + } + } + + private Map parseFacesCheck(JsonDeserializationContext p_178250_1_, JsonObject p_178250_2_) + { + Map map = this.parseFaces(p_178250_1_, p_178250_2_); + + if (map.isEmpty()) + { + throw new JsonParseException("Expected between 1 and 6 unique faces, got 0"); + } + else + { + return map; + } + } + + private Map parseFaces(JsonDeserializationContext p_178253_1_, JsonObject p_178253_2_) + { + Map map = Maps.newEnumMap(EnumFacing.class); + JsonObject jsonobject = JsonUtils.getJsonObject(p_178253_2_, "faces"); + + for (Entry entry : jsonobject.entrySet()) + { + EnumFacing enumfacing = this.parseEnumFacing((String)entry.getKey()); + map.put(enumfacing, (BlockPartFace)p_178253_1_.deserialize((JsonElement)entry.getValue(), BlockPartFace.class)); + } + + return map; + } + + private EnumFacing parseEnumFacing(String name) + { + EnumFacing enumfacing = EnumFacing.byName(name); + + if (enumfacing == null) + { + throw new JsonParseException("Unknown facing: " + name); + } + else + { + return enumfacing; + } + } + + private Vector3f parsePositionTo(JsonObject p_178247_1_) + { + Vector3f vector3f = this.parsePosition(p_178247_1_, "to"); + + if (vector3f.x >= -16.0F && vector3f.y >= -16.0F && vector3f.z >= -16.0F && vector3f.x <= 32.0F && vector3f.y <= 32.0F && vector3f.z <= 32.0F) + { + return vector3f; + } + else + { + throw new JsonParseException("\'to\' specifier exceeds the allowed boundaries: " + vector3f); + } + } + + private Vector3f parsePositionFrom(JsonObject p_178249_1_) + { + Vector3f vector3f = this.parsePosition(p_178249_1_, "from"); + + if (vector3f.x >= -16.0F && vector3f.y >= -16.0F && vector3f.z >= -16.0F && vector3f.x <= 32.0F && vector3f.y <= 32.0F && vector3f.z <= 32.0F) + { + return vector3f; + } + else + { + throw new JsonParseException("\'from\' specifier exceeds the allowed boundaries: " + vector3f); + } + } + + private Vector3f parsePosition(JsonObject p_178251_1_, String p_178251_2_) + { + JsonArray jsonarray = JsonUtils.getJsonArray(p_178251_1_, p_178251_2_); + + if (jsonarray.size() != 3) + { + throw new JsonParseException("Expected 3 " + p_178251_2_ + " values, found: " + jsonarray.size()); + } + else + { + float[] afloat = new float[3]; + + for (int i = 0; i < afloat.length; ++i) + { + afloat[i] = JsonUtils.getFloat(jsonarray.get(i), p_178251_2_ + "[" + i + "]"); + } + + return new Vector3f(afloat[0], afloat[1], afloat[2]); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/model/BlockPartFace.java b/src/minecraft/net/minecraft/client/renderer/block/model/BlockPartFace.java new file mode 100644 index 0000000..c2ea72a --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/model/BlockPartFace.java @@ -0,0 +1,56 @@ +package net.minecraft.client.renderer.block.model; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.lang.reflect.Type; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.JsonUtils; + +public class BlockPartFace +{ + public static final EnumFacing FACING_DEFAULT = null; + public final EnumFacing cullFace; + public final int tintIndex; + public final String texture; + public final BlockFaceUV blockFaceUV; + + public BlockPartFace(EnumFacing cullFaceIn, int tintIndexIn, String textureIn, BlockFaceUV blockFaceUVIn) + { + this.cullFace = cullFaceIn; + this.tintIndex = tintIndexIn; + this.texture = textureIn; + this.blockFaceUV = blockFaceUVIn; + } + + static class Deserializer implements JsonDeserializer + { + public BlockPartFace deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + EnumFacing enumfacing = this.parseCullFace(jsonobject); + int i = this.parseTintIndex(jsonobject); + String s = this.parseTexture(jsonobject); + BlockFaceUV blockfaceuv = (BlockFaceUV)p_deserialize_3_.deserialize(jsonobject, BlockFaceUV.class); + return new BlockPartFace(enumfacing, i, s, blockfaceuv); + } + + protected int parseTintIndex(JsonObject p_178337_1_) + { + return JsonUtils.getInt(p_178337_1_, "tintindex", -1); + } + + private String parseTexture(JsonObject p_178340_1_) + { + return JsonUtils.getString(p_178340_1_, "texture"); + } + + private EnumFacing parseCullFace(JsonObject p_178339_1_) + { + String s = JsonUtils.getString(p_178339_1_, "cullface", ""); + return EnumFacing.byName(s); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/model/BlockPartRotation.java b/src/minecraft/net/minecraft/client/renderer/block/model/BlockPartRotation.java new file mode 100644 index 0000000..37281c0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/model/BlockPartRotation.java @@ -0,0 +1,20 @@ +package net.minecraft.client.renderer.block.model; + +import net.minecraft.util.EnumFacing; +import org.lwjgl.util.vector.Vector3f; + +public class BlockPartRotation +{ + public final Vector3f origin; + public final EnumFacing.Axis axis; + public final float angle; + public final boolean rescale; + + public BlockPartRotation(Vector3f originIn, EnumFacing.Axis axisIn, float angleIn, boolean rescaleIn) + { + this.origin = originIn; + this.axis = axisIn; + this.angle = angleIn; + this.rescale = rescaleIn; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/model/BreakingFour.java b/src/minecraft/net/minecraft/client/renderer/block/model/BreakingFour.java new file mode 100644 index 0000000..29cbb69 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/model/BreakingFour.java @@ -0,0 +1,135 @@ +package net.minecraft.client.renderer.block.model; + +import java.util.Arrays; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; + +public class BreakingFour extends BakedQuad +{ + private final TextureAtlasSprite texture; + private static final String __OBFID = "CL_00002492"; + + public BreakingFour(BakedQuad p_i46217_1_, TextureAtlasSprite textureIn) + { + super(Arrays.copyOf(p_i46217_1_.getVertexData(), p_i46217_1_.getVertexData().length), p_i46217_1_.tintIndex, FaceBakery.getFacingFromVertexData(p_i46217_1_.getVertexData())); + this.texture = textureIn; + this.func_178217_e(); + } + + private void func_178217_e() + { + for (int i = 0; i < 4; ++i) + { + this.func_178216_a(i); + } + } + + private void func_178216_a(int p_178216_1_) + { + int i = this.vertexData.length / 4; + int j = i * p_178216_1_; + float f = Float.intBitsToFloat(this.vertexData[j]); + float f1 = Float.intBitsToFloat(this.vertexData[j + 1]); + float f2 = Float.intBitsToFloat(this.vertexData[j + 2]); + float f3 = 0.0F; + float f4 = 0.0F; + + switch (BreakingFour.BreakingFour$1.field_178419_a[this.face.ordinal()]) + { + case 1: + f3 = f * 16.0F; + f4 = (1.0F - f2) * 16.0F; + break; + + case 2: + f3 = f * 16.0F; + f4 = f2 * 16.0F; + break; + + case 3: + f3 = (1.0F - f) * 16.0F; + f4 = (1.0F - f1) * 16.0F; + break; + + case 4: + f3 = f * 16.0F; + f4 = (1.0F - f1) * 16.0F; + break; + + case 5: + f3 = f2 * 16.0F; + f4 = (1.0F - f1) * 16.0F; + break; + + case 6: + f3 = (1.0F - f2) * 16.0F; + f4 = (1.0F - f1) * 16.0F; + } + + this.vertexData[j + 4] = Float.floatToRawIntBits(this.texture.getInterpolatedU((double)f3)); + this.vertexData[j + 4 + 1] = Float.floatToRawIntBits(this.texture.getInterpolatedV((double)f4)); + } + + static final class BreakingFour$1 + { + static final int[] field_178419_a = new int[EnumFacing.values().length]; + private static final String __OBFID = "CL_00002491"; + + static + { + try + { + field_178419_a[EnumFacing.DOWN.ordinal()] = 1; + } + catch (NoSuchFieldError var6) + { + ; + } + + try + { + field_178419_a[EnumFacing.UP.ordinal()] = 2; + } + catch (NoSuchFieldError var5) + { + ; + } + + try + { + field_178419_a[EnumFacing.NORTH.ordinal()] = 3; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_178419_a[EnumFacing.SOUTH.ordinal()] = 4; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_178419_a[EnumFacing.WEST.ordinal()] = 5; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_178419_a[EnumFacing.EAST.ordinal()] = 6; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java b/src/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java new file mode 100644 index 0000000..a7ceff9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java @@ -0,0 +1,545 @@ +package net.minecraft.client.renderer.block.model; + +import net.minecraft.client.renderer.EnumFaceDirection; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.ModelRotation; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3i; +import net.minecraftforge.client.model.ITransformation; +import optifine.Config; +import optifine.Reflector; + +import org.lwjgl.util.vector.Matrix4f; +import org.lwjgl.util.vector.Vector3f; +import org.lwjgl.util.vector.Vector4f; +import shadersmod.client.Shaders; + +public class FaceBakery +{ + private static final float field_178418_a = 1.0F / (float)Math.cos(0.39269909262657166D) - 1.0F; + private static final float field_178417_b = 1.0F / (float)Math.cos((Math.PI / 4D)) - 1.0F; + private static final String __OBFID = "CL_00002490"; + + public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) + { + int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade); + EnumFacing enumfacing = getFacingFromVertexData(aint); + + if (uvLocked) + { + this.func_178409_a(aint, enumfacing, face.blockFaceUV, sprite); + } + + if (partRotation == null) + { + this.applyFacing(aint, enumfacing); + } + + return new BakedQuad(aint, face.tintIndex, enumfacing, sprite); + } + + public BakedQuad makeBakedQuad(Vector3f p_makeBakedQuad_1_, Vector3f p_makeBakedQuad_2_, BlockPartFace p_makeBakedQuad_3_, TextureAtlasSprite p_makeBakedQuad_4_, EnumFacing p_makeBakedQuad_5_, ITransformation p_makeBakedQuad_6_, BlockPartRotation p_makeBakedQuad_7_, boolean p_makeBakedQuad_8_, boolean p_makeBakedQuad_9_) + { + int[] aint = this.makeQuadVertexData(p_makeBakedQuad_3_, p_makeBakedQuad_4_, p_makeBakedQuad_5_, this.getPositionsDiv16(p_makeBakedQuad_1_, p_makeBakedQuad_2_), p_makeBakedQuad_6_, p_makeBakedQuad_7_, p_makeBakedQuad_8_, p_makeBakedQuad_9_); + EnumFacing enumfacing = getFacingFromVertexData(aint); + + if (p_makeBakedQuad_8_) + { + this.func_178409_a(aint, enumfacing, p_makeBakedQuad_3_.blockFaceUV, p_makeBakedQuad_4_); + } + + if (p_makeBakedQuad_7_ == null) + { + this.applyFacing(aint, enumfacing); + } + + if (Reflector.ForgeHooksClient_fillNormal.exists()) + { + Reflector.callVoid(Reflector.ForgeHooksClient_fillNormal, new Object[] {aint, enumfacing}); + } + + return new BakedQuad(aint, p_makeBakedQuad_3_.tintIndex, enumfacing, p_makeBakedQuad_4_); + } + + private int[] makeQuadVertexData(BlockPartFace p_makeQuadVertexData_1_, TextureAtlasSprite p_makeQuadVertexData_2_, EnumFacing p_makeQuadVertexData_3_, float[] p_makeQuadVertexData_4_, ITransformation p_makeQuadVertexData_5_, BlockPartRotation p_makeQuadVertexData_6_, boolean p_makeQuadVertexData_7_, boolean p_makeQuadVertexData_8_) + { + int i = 28; + + if (Config.isShaders()) + { + i = 56; + } + + int[] aint = new int[i]; + + for (int j = 0; j < 4; ++j) + { + this.fillVertexData(aint, j, p_makeQuadVertexData_3_, p_makeQuadVertexData_1_, p_makeQuadVertexData_4_, p_makeQuadVertexData_2_, p_makeQuadVertexData_5_, p_makeQuadVertexData_6_, p_makeQuadVertexData_7_, p_makeQuadVertexData_8_); + } + + return aint; + } + + private int getFaceShadeColor(EnumFacing facing) + { + float f = this.getFaceBrightness(facing); + int i = MathHelper.clamp_int((int)(f * 255.0F), 0, 255); + return -16777216 | i << 16 | i << 8 | i; + } + + private float getFaceBrightness(EnumFacing facing) + { + switch (FaceBakery.FaceBakery$1.field_178400_a[facing.ordinal()]) + { + case 1: + if (Config.isShaders()) + { + return Shaders.blockLightLevel05; + } + + return 0.5F; + + case 2: + return 1.0F; + + case 3: + case 4: + if (Config.isShaders()) + { + return Shaders.blockLightLevel08; + } + + return 0.8F; + + case 5: + case 6: + if (Config.isShaders()) + { + return Shaders.blockLightLevel06; + } + + return 0.6F; + + default: + return 1.0F; + } + } + + private float[] getPositionsDiv16(Vector3f pos1, Vector3f pos2) + { + float[] afloat = new float[EnumFacing.values().length]; + afloat[EnumFaceDirection.Constants.WEST_INDEX] = pos1.x / 16.0F; + afloat[EnumFaceDirection.Constants.DOWN_INDEX] = pos1.y / 16.0F; + afloat[EnumFaceDirection.Constants.NORTH_INDEX] = pos1.z / 16.0F; + afloat[EnumFaceDirection.Constants.EAST_INDEX] = pos2.x / 16.0F; + afloat[EnumFaceDirection.Constants.UP_INDEX] = pos2.y / 16.0F; + afloat[EnumFaceDirection.Constants.SOUTH_INDEX] = pos2.z / 16.0F; + return afloat; + } + + private void fillVertexData(int[] p_fillVertexData_1_, int p_fillVertexData_2_, EnumFacing p_fillVertexData_3_, BlockPartFace p_fillVertexData_4_, float[] p_fillVertexData_5_, TextureAtlasSprite p_fillVertexData_6_, ITransformation p_fillVertexData_7_, BlockPartRotation p_fillVertexData_8_, boolean p_fillVertexData_9_, boolean p_fillVertexData_10_) + { + EnumFacing enumfacing = p_fillVertexData_7_.rotate(p_fillVertexData_3_); + int i = p_fillVertexData_10_ ? this.getFaceShadeColor(enumfacing) : -1; + EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(p_fillVertexData_3_).func_179025_a(p_fillVertexData_2_); + Vector3f vector3f = new Vector3f(p_fillVertexData_5_[enumfacedirection$vertexinformation.field_179184_a], p_fillVertexData_5_[enumfacedirection$vertexinformation.field_179182_b], p_fillVertexData_5_[enumfacedirection$vertexinformation.field_179183_c]); + this.func_178407_a(vector3f, p_fillVertexData_8_); + int j = this.rotateVertex(vector3f, p_fillVertexData_3_, p_fillVertexData_2_, p_fillVertexData_7_, p_fillVertexData_9_); + this.storeVertexData(p_fillVertexData_1_, j, p_fillVertexData_2_, vector3f, i, p_fillVertexData_6_, p_fillVertexData_4_.blockFaceUV); + } + + private void storeVertexData(int[] faceData, int storeIndex, int vertexIndex, Vector3f position, int shadeColor, TextureAtlasSprite sprite, BlockFaceUV faceUV) + { + int i = faceData.length / 4; + int j = storeIndex * i; + faceData[j] = Float.floatToRawIntBits(position.x); + faceData[j + 1] = Float.floatToRawIntBits(position.y); + faceData[j + 2] = Float.floatToRawIntBits(position.z); + faceData[j + 3] = shadeColor; + faceData[j + 4] = Float.floatToRawIntBits(sprite.getInterpolatedU((double)faceUV.func_178348_a(vertexIndex))); + faceData[j + 4 + 1] = Float.floatToRawIntBits(sprite.getInterpolatedV((double)faceUV.func_178346_b(vertexIndex))); + } + + private void func_178407_a(Vector3f p_178407_1_, BlockPartRotation partRotation) + { + if (partRotation != null) + { + Matrix4f matrix4f = this.getMatrixIdentity(); + Vector3f vector3f = new Vector3f(0.0F, 0.0F, 0.0F); + + switch (FaceBakery.FaceBakery$1.field_178399_b[partRotation.axis.ordinal()]) + { + case 1: + Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), matrix4f, matrix4f); + vector3f.set(0.0F, 1.0F, 1.0F); + break; + + case 2: + Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), matrix4f, matrix4f); + vector3f.set(1.0F, 0.0F, 1.0F); + break; + + case 3: + Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), matrix4f, matrix4f); + vector3f.set(1.0F, 1.0F, 0.0F); + } + + if (partRotation.rescale) + { + if (Math.abs(partRotation.angle) == 22.5F) + { + vector3f.scale(field_178418_a); + } + else + { + vector3f.scale(field_178417_b); + } + + Vector3f.add(vector3f, new Vector3f(1.0F, 1.0F, 1.0F), vector3f); + } + else + { + vector3f.set(1.0F, 1.0F, 1.0F); + } + + this.rotateScale(p_178407_1_, new Vector3f(partRotation.origin), matrix4f, vector3f); + } + } + + public int rotateVertex(Vector3f position, EnumFacing facing, int vertexIndex, ModelRotation modelRotationIn, boolean uvLocked) + { + return this.rotateVertex(position, facing, vertexIndex, modelRotationIn, uvLocked); + } + + public int rotateVertex(Vector3f p_rotateVertex_1_, EnumFacing p_rotateVertex_2_, int p_rotateVertex_3_, ITransformation p_rotateVertex_4_, boolean p_rotateVertex_5_) + { + if (p_rotateVertex_4_ == ModelRotation.X0_Y0) + { + return p_rotateVertex_3_; + } + else + { + if (Reflector.ForgeHooksClient_transform.exists()) + { + Reflector.call(Reflector.ForgeHooksClient_transform, new Object[] {p_rotateVertex_1_, p_rotateVertex_4_.getMatrix()}); + } + else + { + this.rotateScale(p_rotateVertex_1_, new Vector3f(0.5F, 0.5F, 0.5F), ((ModelRotation)p_rotateVertex_4_).getMatrix4d(), new Vector3f(1.0F, 1.0F, 1.0F)); + } + + return p_rotateVertex_4_.rotate(p_rotateVertex_2_, p_rotateVertex_3_); + } + } + + private void rotateScale(Vector3f position, Vector3f rotationOrigin, Matrix4f rotationMatrix, Vector3f scale) + { + Vector4f vector4f = new Vector4f(position.x - rotationOrigin.x, position.y - rotationOrigin.y, position.z - rotationOrigin.z, 1.0F); + Matrix4f.transform(rotationMatrix, vector4f, vector4f); + vector4f.x *= scale.x; + vector4f.y *= scale.y; + vector4f.z *= scale.z; + position.set(vector4f.x + rotationOrigin.x, vector4f.y + rotationOrigin.y, vector4f.z + rotationOrigin.z); + } + + private Matrix4f getMatrixIdentity() + { + Matrix4f matrix4f = new Matrix4f(); + matrix4f.setIdentity(); + return matrix4f; + } + + public static EnumFacing getFacingFromVertexData(int[] faceData) + { + int i = faceData.length / 4; + int j = i * 2; + int k = i * 3; + Vector3f vector3f = new Vector3f(Float.intBitsToFloat(faceData[0]), Float.intBitsToFloat(faceData[1]), Float.intBitsToFloat(faceData[2])); + Vector3f vector3f1 = new Vector3f(Float.intBitsToFloat(faceData[i]), Float.intBitsToFloat(faceData[i + 1]), Float.intBitsToFloat(faceData[i + 2])); + Vector3f vector3f2 = new Vector3f(Float.intBitsToFloat(faceData[j]), Float.intBitsToFloat(faceData[j + 1]), Float.intBitsToFloat(faceData[j + 2])); + Vector3f vector3f3 = new Vector3f(); + Vector3f vector3f4 = new Vector3f(); + Vector3f vector3f5 = new Vector3f(); + Vector3f.sub(vector3f, vector3f1, vector3f3); + Vector3f.sub(vector3f2, vector3f1, vector3f4); + Vector3f.cross(vector3f4, vector3f3, vector3f5); + float f = (float)Math.sqrt((double)(vector3f5.x * vector3f5.x + vector3f5.y * vector3f5.y + vector3f5.z * vector3f5.z)); + vector3f5.x /= f; + vector3f5.y /= f; + vector3f5.z /= f; + EnumFacing enumfacing = null; + float f1 = 0.0F; + + for (EnumFacing enumfacing1 : EnumFacing.values()) + { + Vec3i vec3i = enumfacing1.getDirectionVec(); + Vector3f vector3f6 = new Vector3f((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ()); + float f2 = Vector3f.dot(vector3f5, vector3f6); + + if (f2 >= 0.0F && f2 > f1) + { + f1 = f2; + enumfacing = enumfacing1; + } + } + + if (f1 < 0.719F) + { + if (enumfacing != EnumFacing.EAST && enumfacing != EnumFacing.WEST && enumfacing != EnumFacing.NORTH && enumfacing != EnumFacing.SOUTH) + { + enumfacing = EnumFacing.UP; + } + else + { + enumfacing = EnumFacing.NORTH; + } + } + + return enumfacing == null ? EnumFacing.UP : enumfacing; + } + + public void func_178409_a(int[] p_178409_1_, EnumFacing facing, BlockFaceUV p_178409_3_, TextureAtlasSprite p_178409_4_) + { + for (int i = 0; i < 4; ++i) + { + this.func_178401_a(i, p_178409_1_, facing, p_178409_3_, p_178409_4_); + } + } + + private void applyFacing(int[] p_applyFacing_1_, EnumFacing p_applyFacing_2_) + { + int[] aint = new int[p_applyFacing_1_.length]; + System.arraycopy(p_applyFacing_1_, 0, aint, 0, p_applyFacing_1_.length); + float[] afloat = new float[EnumFacing.values().length]; + afloat[EnumFaceDirection.Constants.WEST_INDEX] = 999.0F; + afloat[EnumFaceDirection.Constants.DOWN_INDEX] = 999.0F; + afloat[EnumFaceDirection.Constants.NORTH_INDEX] = 999.0F; + afloat[EnumFaceDirection.Constants.EAST_INDEX] = -999.0F; + afloat[EnumFaceDirection.Constants.UP_INDEX] = -999.0F; + afloat[EnumFaceDirection.Constants.SOUTH_INDEX] = -999.0F; + int j = p_applyFacing_1_.length / 4; + + for (int k = 0; k < 4; ++k) + { + int i = j * k; + float f1 = Float.intBitsToFloat(aint[i]); + float f2 = Float.intBitsToFloat(aint[i + 1]); + float f = Float.intBitsToFloat(aint[i + 2]); + + if (f1 < afloat[EnumFaceDirection.Constants.WEST_INDEX]) + { + afloat[EnumFaceDirection.Constants.WEST_INDEX] = f1; + } + + if (f2 < afloat[EnumFaceDirection.Constants.DOWN_INDEX]) + { + afloat[EnumFaceDirection.Constants.DOWN_INDEX] = f2; + } + + if (f < afloat[EnumFaceDirection.Constants.NORTH_INDEX]) + { + afloat[EnumFaceDirection.Constants.NORTH_INDEX] = f; + } + + if (f1 > afloat[EnumFaceDirection.Constants.EAST_INDEX]) + { + afloat[EnumFaceDirection.Constants.EAST_INDEX] = f1; + } + + if (f2 > afloat[EnumFaceDirection.Constants.UP_INDEX]) + { + afloat[EnumFaceDirection.Constants.UP_INDEX] = f2; + } + + if (f > afloat[EnumFaceDirection.Constants.SOUTH_INDEX]) + { + afloat[EnumFaceDirection.Constants.SOUTH_INDEX] = f; + } + } + + EnumFaceDirection enumfacedirection = EnumFaceDirection.getFacing(p_applyFacing_2_); + + for (int j1 = 0; j1 < 4; ++j1) + { + int k1 = j * j1; + EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = enumfacedirection.func_179025_a(j1); + float f8 = afloat[enumfacedirection$vertexinformation.field_179184_a]; + float f3 = afloat[enumfacedirection$vertexinformation.field_179182_b]; + float f4 = afloat[enumfacedirection$vertexinformation.field_179183_c]; + p_applyFacing_1_[k1] = Float.floatToRawIntBits(f8); + p_applyFacing_1_[k1 + 1] = Float.floatToRawIntBits(f3); + p_applyFacing_1_[k1 + 2] = Float.floatToRawIntBits(f4); + + for (int l = 0; l < 4; ++l) + { + int i1 = j * l; + float f5 = Float.intBitsToFloat(aint[i1]); + float f6 = Float.intBitsToFloat(aint[i1 + 1]); + float f7 = Float.intBitsToFloat(aint[i1 + 2]); + + if (MathHelper.epsilonEquals(f8, f5) && MathHelper.epsilonEquals(f3, f6) && MathHelper.epsilonEquals(f4, f7)) + { + p_applyFacing_1_[k1 + 4] = aint[i1 + 4]; + p_applyFacing_1_[k1 + 4 + 1] = aint[i1 + 4 + 1]; + } + } + } + } + + private void func_178401_a(int p_178401_1_, int[] p_178401_2_, EnumFacing facing, BlockFaceUV p_178401_4_, TextureAtlasSprite p_178401_5_) + { + int i = p_178401_2_.length / 4; + int j = i * p_178401_1_; + float f = Float.intBitsToFloat(p_178401_2_[j]); + float f1 = Float.intBitsToFloat(p_178401_2_[j + 1]); + float f2 = Float.intBitsToFloat(p_178401_2_[j + 2]); + + if (f < -0.1F || f >= 1.1F) + { + f -= (float)MathHelper.floor_float(f); + } + + if (f1 < -0.1F || f1 >= 1.1F) + { + f1 -= (float)MathHelper.floor_float(f1); + } + + if (f2 < -0.1F || f2 >= 1.1F) + { + f2 -= (float)MathHelper.floor_float(f2); + } + + float f3 = 0.0F; + float f4 = 0.0F; + + switch (FaceBakery.FaceBakery$1.field_178400_a[facing.ordinal()]) + { + case 1: + f3 = f * 16.0F; + f4 = (1.0F - f2) * 16.0F; + break; + + case 2: + f3 = f * 16.0F; + f4 = f2 * 16.0F; + break; + + case 3: + f3 = (1.0F - f) * 16.0F; + f4 = (1.0F - f1) * 16.0F; + break; + + case 4: + f3 = f * 16.0F; + f4 = (1.0F - f1) * 16.0F; + break; + + case 5: + f3 = f2 * 16.0F; + f4 = (1.0F - f1) * 16.0F; + break; + + case 6: + f3 = (1.0F - f2) * 16.0F; + f4 = (1.0F - f1) * 16.0F; + } + + int k = p_178401_4_.func_178345_c(p_178401_1_) * i; + p_178401_2_[k + 4] = Float.floatToRawIntBits(p_178401_5_.getInterpolatedU((double)f3)); + p_178401_2_[k + 4 + 1] = Float.floatToRawIntBits(p_178401_5_.getInterpolatedV((double)f4)); + } + + static final class FaceBakery$1 + { + static final int[] field_178400_a; + static final int[] field_178399_b = new int[EnumFacing.Axis.values().length]; + private static final String __OBFID = "CL_00002489"; + + static + { + try + { + field_178399_b[EnumFacing.Axis.X.ordinal()] = 1; + } + catch (NoSuchFieldError var9) + { + ; + } + + try + { + field_178399_b[EnumFacing.Axis.Y.ordinal()] = 2; + } + catch (NoSuchFieldError var8) + { + ; + } + + try + { + field_178399_b[EnumFacing.Axis.Z.ordinal()] = 3; + } + catch (NoSuchFieldError var7) + { + ; + } + + field_178400_a = new int[EnumFacing.values().length]; + + try + { + field_178400_a[EnumFacing.DOWN.ordinal()] = 1; + } + catch (NoSuchFieldError var6) + { + ; + } + + try + { + field_178400_a[EnumFacing.UP.ordinal()] = 2; + } + catch (NoSuchFieldError var5) + { + ; + } + + try + { + field_178400_a[EnumFacing.NORTH.ordinal()] = 3; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_178400_a[EnumFacing.SOUTH.ordinal()] = 4; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_178400_a[EnumFacing.WEST.ordinal()] = 5; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_178400_a[EnumFacing.EAST.ordinal()] = 6; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java b/src/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java new file mode 100644 index 0000000..df38604 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java @@ -0,0 +1,131 @@ +package net.minecraft.client.renderer.block.model; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.lang.reflect.Type; +import net.minecraft.client.renderer.GlStateManager; + +public class ItemCameraTransforms +{ + public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms(); + public static float field_181690_b = 0.0F; + public static float field_181691_c = 0.0F; + public static float field_181692_d = 0.0F; + public static float field_181693_e = 0.0F; + public static float field_181694_f = 0.0F; + public static float field_181695_g = 0.0F; + public static float field_181696_h = 0.0F; + public static float field_181697_i = 0.0F; + public static float field_181698_j = 0.0F; + public final ItemTransformVec3f thirdPerson; + public final ItemTransformVec3f firstPerson; + public final ItemTransformVec3f head; + public final ItemTransformVec3f gui; + public final ItemTransformVec3f ground; + public final ItemTransformVec3f fixed; + + private ItemCameraTransforms() + { + this(ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT); + } + + public ItemCameraTransforms(ItemCameraTransforms p_i46443_1_) + { + this.thirdPerson = p_i46443_1_.thirdPerson; + this.firstPerson = p_i46443_1_.firstPerson; + this.head = p_i46443_1_.head; + this.gui = p_i46443_1_.gui; + this.ground = p_i46443_1_.ground; + this.fixed = p_i46443_1_.fixed; + } + + public ItemCameraTransforms(ItemTransformVec3f p_i46444_1_, ItemTransformVec3f p_i46444_2_, ItemTransformVec3f p_i46444_3_, ItemTransformVec3f p_i46444_4_, ItemTransformVec3f p_i46444_5_, ItemTransformVec3f p_i46444_6_) + { + this.thirdPerson = p_i46444_1_; + this.firstPerson = p_i46444_2_; + this.head = p_i46444_3_; + this.gui = p_i46444_4_; + this.ground = p_i46444_5_; + this.fixed = p_i46444_6_; + } + + public void applyTransform(ItemCameraTransforms.TransformType p_181689_1_) + { + ItemTransformVec3f itemtransformvec3f = this.getTransform(p_181689_1_); + + if (itemtransformvec3f != ItemTransformVec3f.DEFAULT) + { + GlStateManager.translate(itemtransformvec3f.translation.x + field_181690_b, itemtransformvec3f.translation.y + field_181691_c, itemtransformvec3f.translation.z + field_181692_d); + GlStateManager.rotate(itemtransformvec3f.rotation.y + field_181694_f, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(itemtransformvec3f.rotation.x + field_181693_e, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(itemtransformvec3f.rotation.z + field_181695_g, 0.0F, 0.0F, 1.0F); + GlStateManager.scale(itemtransformvec3f.scale.x + field_181696_h, itemtransformvec3f.scale.y + field_181697_i, itemtransformvec3f.scale.z + field_181698_j); + } + } + + public ItemTransformVec3f getTransform(ItemCameraTransforms.TransformType p_181688_1_) + { + switch (p_181688_1_) + { + case THIRD_PERSON: + return this.thirdPerson; + + case FIRST_PERSON: + return this.firstPerson; + + case HEAD: + return this.head; + + case GUI: + return this.gui; + + case GROUND: + return this.ground; + + case FIXED: + return this.fixed; + + default: + return ItemTransformVec3f.DEFAULT; + } + } + + public boolean func_181687_c(ItemCameraTransforms.TransformType p_181687_1_) + { + return !this.getTransform(p_181687_1_).equals(ItemTransformVec3f.DEFAULT); + } + + static class Deserializer implements JsonDeserializer + { + public ItemCameraTransforms deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + ItemTransformVec3f itemtransformvec3f = this.func_181683_a(p_deserialize_3_, jsonobject, "thirdperson"); + ItemTransformVec3f itemtransformvec3f1 = this.func_181683_a(p_deserialize_3_, jsonobject, "firstperson"); + ItemTransformVec3f itemtransformvec3f2 = this.func_181683_a(p_deserialize_3_, jsonobject, "head"); + ItemTransformVec3f itemtransformvec3f3 = this.func_181683_a(p_deserialize_3_, jsonobject, "gui"); + ItemTransformVec3f itemtransformvec3f4 = this.func_181683_a(p_deserialize_3_, jsonobject, "ground"); + ItemTransformVec3f itemtransformvec3f5 = this.func_181683_a(p_deserialize_3_, jsonobject, "fixed"); + return new ItemCameraTransforms(itemtransformvec3f, itemtransformvec3f1, itemtransformvec3f2, itemtransformvec3f3, itemtransformvec3f4, itemtransformvec3f5); + } + + private ItemTransformVec3f func_181683_a(JsonDeserializationContext p_181683_1_, JsonObject p_181683_2_, String p_181683_3_) + { + return p_181683_2_.has(p_181683_3_) ? (ItemTransformVec3f)p_181683_1_.deserialize(p_181683_2_.get(p_181683_3_), ItemTransformVec3f.class) : ItemTransformVec3f.DEFAULT; + } + } + + public static enum TransformType + { + NONE, + THIRD_PERSON, + FIRST_PERSON, + HEAD, + GUI, + GROUND, + FIXED; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/model/ItemModelGenerator.java b/src/minecraft/net/minecraft/client/renderer/block/model/ItemModelGenerator.java new file mode 100644 index 0000000..cdf5cc4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/model/ItemModelGenerator.java @@ -0,0 +1,327 @@ +package net.minecraft.client.renderer.block.model; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.util.vector.Vector3f; + +public class ItemModelGenerator +{ + public static final List LAYERS = Lists.newArrayList(new String[] {"layer0", "layer1", "layer2", "layer3", "layer4"}); + + public ModelBlock makeItemModel(TextureMap textureMapIn, ModelBlock blockModel) + { + Map map = Maps.newHashMap(); + List list = Lists.newArrayList(); + + for (int i = 0; i < LAYERS.size(); ++i) + { + String s = (String)LAYERS.get(i); + + if (!blockModel.isTexturePresent(s)) + { + break; + } + + String s1 = blockModel.resolveTextureName(s); + map.put(s, s1); + TextureAtlasSprite textureatlassprite = textureMapIn.getAtlasSprite((new ResourceLocation(s1)).toString()); + list.addAll(this.func_178394_a(i, s, textureatlassprite)); + } + + if (list.isEmpty()) + { + return null; + } + else + { + map.put("particle", blockModel.isTexturePresent("particle") ? blockModel.resolveTextureName("particle") : (String)map.get("layer0")); + return new ModelBlock(list, map, false, false, blockModel.func_181682_g()); + } + } + + private List func_178394_a(int p_178394_1_, String p_178394_2_, TextureAtlasSprite p_178394_3_) + { + Map map = Maps.newHashMap(); + map.put(EnumFacing.SOUTH, new BlockPartFace((EnumFacing)null, p_178394_1_, p_178394_2_, new BlockFaceUV(new float[] {0.0F, 0.0F, 16.0F, 16.0F}, 0))); + map.put(EnumFacing.NORTH, new BlockPartFace((EnumFacing)null, p_178394_1_, p_178394_2_, new BlockFaceUV(new float[] {16.0F, 0.0F, 0.0F, 16.0F}, 0))); + List list = Lists.newArrayList(); + list.add(new BlockPart(new Vector3f(0.0F, 0.0F, 7.5F), new Vector3f(16.0F, 16.0F, 8.5F), map, (BlockPartRotation)null, true)); + list.addAll(this.func_178397_a(p_178394_3_, p_178394_2_, p_178394_1_)); + return list; + } + + private List func_178397_a(TextureAtlasSprite p_178397_1_, String p_178397_2_, int p_178397_3_) + { + float f = (float)p_178397_1_.getIconWidth(); + float f1 = (float)p_178397_1_.getIconHeight(); + List list = Lists.newArrayList(); + + for (ItemModelGenerator.Span itemmodelgenerator$span : this.func_178393_a(p_178397_1_)) + { + float f2 = 0.0F; + float f3 = 0.0F; + float f4 = 0.0F; + float f5 = 0.0F; + float f6 = 0.0F; + float f7 = 0.0F; + float f8 = 0.0F; + float f9 = 0.0F; + float f10 = 0.0F; + float f11 = 0.0F; + float f12 = (float)itemmodelgenerator$span.func_178385_b(); + float f13 = (float)itemmodelgenerator$span.func_178384_c(); + float f14 = (float)itemmodelgenerator$span.func_178381_d(); + ItemModelGenerator.SpanFacing itemmodelgenerator$spanfacing = itemmodelgenerator$span.func_178383_a(); + + switch (itemmodelgenerator$spanfacing) + { + case UP: + f6 = f12; + f2 = f12; + f4 = f7 = f13 + 1.0F; + f8 = f14; + f3 = f14; + f9 = f14; + f5 = f14; + f10 = 16.0F / f; + f11 = 16.0F / (f1 - 1.0F); + break; + + case DOWN: + f9 = f14; + f8 = f14; + f6 = f12; + f2 = f12; + f4 = f7 = f13 + 1.0F; + f3 = f14 + 1.0F; + f5 = f14 + 1.0F; + f10 = 16.0F / f; + f11 = 16.0F / (f1 - 1.0F); + break; + + case LEFT: + f6 = f14; + f2 = f14; + f7 = f14; + f4 = f14; + f9 = f12; + f3 = f12; + f5 = f8 = f13 + 1.0F; + f10 = 16.0F / (f - 1.0F); + f11 = 16.0F / f1; + break; + + case RIGHT: + f7 = f14; + f6 = f14; + f2 = f14 + 1.0F; + f4 = f14 + 1.0F; + f9 = f12; + f3 = f12; + f5 = f8 = f13 + 1.0F; + f10 = 16.0F / (f - 1.0F); + f11 = 16.0F / f1; + } + + float f15 = 16.0F / f; + float f16 = 16.0F / f1; + f2 = f2 * f15; + f4 = f4 * f15; + f3 = f3 * f16; + f5 = f5 * f16; + f3 = 16.0F - f3; + f5 = 16.0F - f5; + f6 = f6 * f10; + f7 = f7 * f10; + f8 = f8 * f11; + f9 = f9 * f11; + Map map = Maps.newHashMap(); + map.put(itemmodelgenerator$spanfacing.getFacing(), new BlockPartFace((EnumFacing)null, p_178397_3_, p_178397_2_, new BlockFaceUV(new float[] {f6, f8, f7, f9}, 0))); + + switch (itemmodelgenerator$spanfacing) + { + case UP: + list.add(new BlockPart(new Vector3f(f2, f3, 7.5F), new Vector3f(f4, f3, 8.5F), map, (BlockPartRotation)null, true)); + break; + + case DOWN: + list.add(new BlockPart(new Vector3f(f2, f5, 7.5F), new Vector3f(f4, f5, 8.5F), map, (BlockPartRotation)null, true)); + break; + + case LEFT: + list.add(new BlockPart(new Vector3f(f2, f3, 7.5F), new Vector3f(f2, f5, 8.5F), map, (BlockPartRotation)null, true)); + break; + + case RIGHT: + list.add(new BlockPart(new Vector3f(f4, f3, 7.5F), new Vector3f(f4, f5, 8.5F), map, (BlockPartRotation)null, true)); + } + } + + return list; + } + + private List func_178393_a(TextureAtlasSprite p_178393_1_) + { + int i = p_178393_1_.getIconWidth(); + int j = p_178393_1_.getIconHeight(); + List list = Lists.newArrayList(); + + for (int k = 0; k < p_178393_1_.getFrameCount(); ++k) + { + int[] aint = p_178393_1_.getFrameTextureData(k)[0]; + + for (int l = 0; l < j; ++l) + { + for (int i1 = 0; i1 < i; ++i1) + { + boolean flag = !this.func_178391_a(aint, i1, l, i, j); + this.func_178396_a(ItemModelGenerator.SpanFacing.UP, list, aint, i1, l, i, j, flag); + this.func_178396_a(ItemModelGenerator.SpanFacing.DOWN, list, aint, i1, l, i, j, flag); + this.func_178396_a(ItemModelGenerator.SpanFacing.LEFT, list, aint, i1, l, i, j, flag); + this.func_178396_a(ItemModelGenerator.SpanFacing.RIGHT, list, aint, i1, l, i, j, flag); + } + } + } + + return list; + } + + private void func_178396_a(ItemModelGenerator.SpanFacing p_178396_1_, List p_178396_2_, int[] p_178396_3_, int p_178396_4_, int p_178396_5_, int p_178396_6_, int p_178396_7_, boolean p_178396_8_) + { + boolean flag = this.func_178391_a(p_178396_3_, p_178396_4_ + p_178396_1_.func_178372_b(), p_178396_5_ + p_178396_1_.func_178371_c(), p_178396_6_, p_178396_7_) && p_178396_8_; + + if (flag) + { + this.func_178395_a(p_178396_2_, p_178396_1_, p_178396_4_, p_178396_5_); + } + } + + private void func_178395_a(List p_178395_1_, ItemModelGenerator.SpanFacing p_178395_2_, int p_178395_3_, int p_178395_4_) + { + ItemModelGenerator.Span itemmodelgenerator$span = null; + + for (ItemModelGenerator.Span itemmodelgenerator$span1 : p_178395_1_) + { + if (itemmodelgenerator$span1.func_178383_a() == p_178395_2_) + { + int i = p_178395_2_.func_178369_d() ? p_178395_4_ : p_178395_3_; + + if (itemmodelgenerator$span1.func_178381_d() == i) + { + itemmodelgenerator$span = itemmodelgenerator$span1; + break; + } + } + } + + int j = p_178395_2_.func_178369_d() ? p_178395_4_ : p_178395_3_; + int k = p_178395_2_.func_178369_d() ? p_178395_3_ : p_178395_4_; + + if (itemmodelgenerator$span == null) + { + p_178395_1_.add(new ItemModelGenerator.Span(p_178395_2_, k, j)); + } + else + { + itemmodelgenerator$span.func_178382_a(k); + } + } + + private boolean func_178391_a(int[] p_178391_1_, int p_178391_2_, int p_178391_3_, int p_178391_4_, int p_178391_5_) + { + return p_178391_2_ >= 0 && p_178391_3_ >= 0 && p_178391_2_ < p_178391_4_ && p_178391_3_ < p_178391_5_ ? (p_178391_1_[p_178391_3_ * p_178391_4_ + p_178391_2_] >> 24 & 255) == 0 : true; + } + + static class Span + { + private final ItemModelGenerator.SpanFacing spanFacing; + private int field_178387_b; + private int field_178388_c; + private final int field_178386_d; + + public Span(ItemModelGenerator.SpanFacing spanFacingIn, int p_i46216_2_, int p_i46216_3_) + { + this.spanFacing = spanFacingIn; + this.field_178387_b = p_i46216_2_; + this.field_178388_c = p_i46216_2_; + this.field_178386_d = p_i46216_3_; + } + + public void func_178382_a(int p_178382_1_) + { + if (p_178382_1_ < this.field_178387_b) + { + this.field_178387_b = p_178382_1_; + } + else if (p_178382_1_ > this.field_178388_c) + { + this.field_178388_c = p_178382_1_; + } + } + + public ItemModelGenerator.SpanFacing func_178383_a() + { + return this.spanFacing; + } + + public int func_178385_b() + { + return this.field_178387_b; + } + + public int func_178384_c() + { + return this.field_178388_c; + } + + public int func_178381_d() + { + return this.field_178386_d; + } + } + + static enum SpanFacing + { + UP(EnumFacing.UP, 0, -1), + DOWN(EnumFacing.DOWN, 0, 1), + LEFT(EnumFacing.EAST, -1, 0), + RIGHT(EnumFacing.WEST, 1, 0); + + private final EnumFacing facing; + private final int field_178373_f; + private final int field_178374_g; + + private SpanFacing(EnumFacing facing, int p_i46215_4_, int p_i46215_5_) + { + this.facing = facing; + this.field_178373_f = p_i46215_4_; + this.field_178374_g = p_i46215_5_; + } + + public EnumFacing getFacing() + { + return this.facing; + } + + public int func_178372_b() + { + return this.field_178373_f; + } + + public int func_178371_c() + { + return this.field_178374_g; + } + + private boolean func_178369_d() + { + return this == DOWN || this == UP; + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java b/src/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java new file mode 100644 index 0000000..007ff2d --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java @@ -0,0 +1,103 @@ +package net.minecraft.client.renderer.block.model; + +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.lang.reflect.Type; +import net.minecraft.util.JsonUtils; +import net.minecraft.util.MathHelper; +import org.lwjgl.util.vector.Vector3f; + +public class ItemTransformVec3f +{ + public static final ItemTransformVec3f DEFAULT = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F)); + public final Vector3f rotation; + public final Vector3f translation; + public final Vector3f scale; + + public ItemTransformVec3f(Vector3f rotation, Vector3f translation, Vector3f scale) + { + this.rotation = new Vector3f(rotation); + this.translation = new Vector3f(translation); + this.scale = new Vector3f(scale); + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (this.getClass() != p_equals_1_.getClass()) + { + return false; + } + else + { + ItemTransformVec3f itemtransformvec3f = (ItemTransformVec3f)p_equals_1_; + return !this.rotation.equals(itemtransformvec3f.rotation) ? false : (!this.scale.equals(itemtransformvec3f.scale) ? false : this.translation.equals(itemtransformvec3f.translation)); + } + } + + public int hashCode() + { + int i = this.rotation.hashCode(); + i = 31 * i + this.translation.hashCode(); + i = 31 * i + this.scale.hashCode(); + return i; + } + + static class Deserializer implements JsonDeserializer + { + private static final Vector3f ROTATION_DEFAULT = new Vector3f(0.0F, 0.0F, 0.0F); + private static final Vector3f TRANSLATION_DEFAULT = new Vector3f(0.0F, 0.0F, 0.0F); + private static final Vector3f SCALE_DEFAULT = new Vector3f(1.0F, 1.0F, 1.0F); + + public ItemTransformVec3f deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + Vector3f vector3f = this.parseVector3f(jsonobject, "rotation", ROTATION_DEFAULT); + Vector3f vector3f1 = this.parseVector3f(jsonobject, "translation", TRANSLATION_DEFAULT); + vector3f1.scale(0.0625F); + vector3f1.x = MathHelper.clamp_float(vector3f1.x, -1.5F, 1.5F); + vector3f1.y = MathHelper.clamp_float(vector3f1.y, -1.5F, 1.5F); + vector3f1.z = MathHelper.clamp_float(vector3f1.z, -1.5F, 1.5F); + Vector3f vector3f2 = this.parseVector3f(jsonobject, "scale", SCALE_DEFAULT); + vector3f2.x = MathHelper.clamp_float(vector3f2.x, -4.0F, 4.0F); + vector3f2.y = MathHelper.clamp_float(vector3f2.y, -4.0F, 4.0F); + vector3f2.z = MathHelper.clamp_float(vector3f2.z, -4.0F, 4.0F); + return new ItemTransformVec3f(vector3f, vector3f1, vector3f2); + } + + private Vector3f parseVector3f(JsonObject jsonObject, String key, Vector3f defaultValue) + { + if (!jsonObject.has(key)) + { + return defaultValue; + } + else + { + JsonArray jsonarray = JsonUtils.getJsonArray(jsonObject, key); + + if (jsonarray.size() != 3) + { + throw new JsonParseException("Expected 3 " + key + " values, found: " + jsonarray.size()); + } + else + { + float[] afloat = new float[3]; + + for (int i = 0; i < afloat.length; ++i) + { + afloat[i] = JsonUtils.getFloat(jsonarray.get(i), key + "[" + i + "]"); + } + + return new Vector3f(afloat[0], afloat[1], afloat[2]); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/model/ModelBlock.java b/src/minecraft/net/minecraft/client/renderer/block/model/ModelBlock.java new file mode 100644 index 0000000..47104df --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/model/ModelBlock.java @@ -0,0 +1,295 @@ +package net.minecraft.client.renderer.block.model; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.io.Reader; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.util.JsonUtils; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ModelBlock +{ + private static final Logger LOGGER = LogManager.getLogger(); + static final Gson SERIALIZER = (new GsonBuilder()).registerTypeAdapter(ModelBlock.class, new ModelBlock.Deserializer()).registerTypeAdapter(BlockPart.class, new BlockPart.Deserializer()).registerTypeAdapter(BlockPartFace.class, new BlockPartFace.Deserializer()).registerTypeAdapter(BlockFaceUV.class, new BlockFaceUV.Deserializer()).registerTypeAdapter(ItemTransformVec3f.class, new ItemTransformVec3f.Deserializer()).registerTypeAdapter(ItemCameraTransforms.class, new ItemCameraTransforms.Deserializer()).create(); + private final List elements; + private final boolean gui3d; + private final boolean ambientOcclusion; + private ItemCameraTransforms cameraTransforms; + public String name; + protected final Map textures; + protected ModelBlock parent; + protected ResourceLocation parentLocation; + + public static ModelBlock deserialize(Reader p_178307_0_) + { + return (ModelBlock)SERIALIZER.fromJson(p_178307_0_, ModelBlock.class); + } + + public static ModelBlock deserialize(String p_178294_0_) + { + return deserialize(new StringReader(p_178294_0_)); + } + + protected ModelBlock(List p_i46225_1_, Map p_i46225_2_, boolean p_i46225_3_, boolean p_i46225_4_, ItemCameraTransforms p_i46225_5_) + { + this((ResourceLocation)null, p_i46225_1_, p_i46225_2_, p_i46225_3_, p_i46225_4_, p_i46225_5_); + } + + protected ModelBlock(ResourceLocation p_i46226_1_, Map p_i46226_2_, boolean p_i46226_3_, boolean p_i46226_4_, ItemCameraTransforms p_i46226_5_) + { + this(p_i46226_1_, Collections.emptyList(), p_i46226_2_, p_i46226_3_, p_i46226_4_, p_i46226_5_); + } + + private ModelBlock(ResourceLocation parentLocationIn, List elementsIn, Map texturesIn, boolean ambientOcclusionIn, boolean gui3dIn, ItemCameraTransforms cameraTransformsIn) + { + this.name = ""; + this.elements = elementsIn; + this.ambientOcclusion = ambientOcclusionIn; + this.gui3d = gui3dIn; + this.textures = texturesIn; + this.parentLocation = parentLocationIn; + this.cameraTransforms = cameraTransformsIn; + } + + public List getElements() + { + return this.hasParent() ? this.parent.getElements() : this.elements; + } + + private boolean hasParent() + { + return this.parent != null; + } + + public boolean isAmbientOcclusion() + { + return this.hasParent() ? this.parent.isAmbientOcclusion() : this.ambientOcclusion; + } + + public boolean isGui3d() + { + return this.gui3d; + } + + public boolean isResolved() + { + return this.parentLocation == null || this.parent != null && this.parent.isResolved(); + } + + public void getParentFromMap(Map p_178299_1_) + { + if (this.parentLocation != null) + { + this.parent = (ModelBlock)p_178299_1_.get(this.parentLocation); + } + } + + public boolean isTexturePresent(String textureName) + { + return !"missingno".equals(this.resolveTextureName(textureName)); + } + + public String resolveTextureName(String textureName) + { + if (!this.startsWithHash(textureName)) + { + textureName = '#' + textureName; + } + + return this.resolveTextureName(textureName, new ModelBlock.Bookkeep(this)); + } + + private String resolveTextureName(String textureName, ModelBlock.Bookkeep p_178302_2_) + { + if (this.startsWithHash(textureName)) + { + if (this == p_178302_2_.modelExt) + { + LOGGER.warn("Unable to resolve texture due to upward reference: " + textureName + " in " + this.name); + return "missingno"; + } + else + { + String s = (String)this.textures.get(textureName.substring(1)); + + if (s == null && this.hasParent()) + { + s = this.parent.resolveTextureName(textureName, p_178302_2_); + } + + p_178302_2_.modelExt = this; + + if (s != null && this.startsWithHash(s)) + { + s = p_178302_2_.model.resolveTextureName(s, p_178302_2_); + } + + return s != null && !this.startsWithHash(s) ? s : "missingno"; + } + } + else + { + return textureName; + } + } + + private boolean startsWithHash(String hash) + { + return hash.charAt(0) == 35; + } + + public ResourceLocation getParentLocation() + { + return this.parentLocation; + } + + public ModelBlock getRootModel() + { + return this.hasParent() ? this.parent.getRootModel() : this; + } + + public ItemCameraTransforms func_181682_g() + { + ItemTransformVec3f itemtransformvec3f = this.func_181681_a(ItemCameraTransforms.TransformType.THIRD_PERSON); + ItemTransformVec3f itemtransformvec3f1 = this.func_181681_a(ItemCameraTransforms.TransformType.FIRST_PERSON); + ItemTransformVec3f itemtransformvec3f2 = this.func_181681_a(ItemCameraTransforms.TransformType.HEAD); + ItemTransformVec3f itemtransformvec3f3 = this.func_181681_a(ItemCameraTransforms.TransformType.GUI); + ItemTransformVec3f itemtransformvec3f4 = this.func_181681_a(ItemCameraTransforms.TransformType.GROUND); + ItemTransformVec3f itemtransformvec3f5 = this.func_181681_a(ItemCameraTransforms.TransformType.FIXED); + return new ItemCameraTransforms(itemtransformvec3f, itemtransformvec3f1, itemtransformvec3f2, itemtransformvec3f3, itemtransformvec3f4, itemtransformvec3f5); + } + + private ItemTransformVec3f func_181681_a(ItemCameraTransforms.TransformType p_181681_1_) + { + return this.parent != null && !this.cameraTransforms.func_181687_c(p_181681_1_) ? this.parent.func_181681_a(p_181681_1_) : this.cameraTransforms.getTransform(p_181681_1_); + } + + public static void checkModelHierarchy(Map p_178312_0_) + { + for (ModelBlock modelblock : p_178312_0_.values()) + { + try + { + ModelBlock modelblock1 = modelblock.parent; + + for (ModelBlock modelblock2 = modelblock1.parent; modelblock1 != modelblock2; modelblock2 = modelblock2.parent.parent) + { + modelblock1 = modelblock1.parent; + } + + throw new ModelBlock.LoopException(); + } + catch (NullPointerException var5) + { + ; + } + } + } + + static final class Bookkeep + { + public final ModelBlock model; + public ModelBlock modelExt; + + private Bookkeep(ModelBlock p_i46223_1_) + { + this.model = p_i46223_1_; + } + } + + public static class Deserializer implements JsonDeserializer + { + public ModelBlock deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + List list = this.getModelElements(p_deserialize_3_, jsonobject); + String s = this.getParent(jsonobject); + boolean flag = StringUtils.isEmpty(s); + boolean flag1 = list.isEmpty(); + + if (flag1 && flag) + { + throw new JsonParseException("BlockModel requires either elements or parent, found neither"); + } + else if (!flag && !flag1) + { + throw new JsonParseException("BlockModel requires either elements or parent, found both"); + } + else + { + Map map = this.getTextures(jsonobject); + boolean flag2 = this.getAmbientOcclusionEnabled(jsonobject); + ItemCameraTransforms itemcameratransforms = ItemCameraTransforms.DEFAULT; + + if (jsonobject.has("display")) + { + JsonObject jsonobject1 = JsonUtils.getJsonObject(jsonobject, "display"); + itemcameratransforms = (ItemCameraTransforms)p_deserialize_3_.deserialize(jsonobject1, ItemCameraTransforms.class); + } + + return flag1 ? new ModelBlock(new ResourceLocation(s), map, flag2, true, itemcameratransforms) : new ModelBlock(list, map, flag2, true, itemcameratransforms); + } + } + + private Map getTextures(JsonObject p_178329_1_) + { + Map map = Maps.newHashMap(); + + if (p_178329_1_.has("textures")) + { + JsonObject jsonobject = p_178329_1_.getAsJsonObject("textures"); + + for (Entry entry : jsonobject.entrySet()) + { + map.put(entry.getKey(), ((JsonElement)entry.getValue()).getAsString()); + } + } + + return map; + } + + private String getParent(JsonObject p_178326_1_) + { + return JsonUtils.getString(p_178326_1_, "parent", ""); + } + + protected boolean getAmbientOcclusionEnabled(JsonObject p_178328_1_) + { + return JsonUtils.getBoolean(p_178328_1_, "ambientocclusion", true); + } + + protected List getModelElements(JsonDeserializationContext p_178325_1_, JsonObject p_178325_2_) + { + List list = Lists.newArrayList(); + + if (p_178325_2_.has("elements")) + { + for (JsonElement jsonelement : JsonUtils.getJsonArray(p_178325_2_, "elements")) + { + list.add((BlockPart)p_178325_1_.deserialize(jsonelement, BlockPart.class)); + } + } + + return list; + } + } + + public static class LoopException extends RuntimeException + { + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java b/src/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java new file mode 100644 index 0000000..a16802a --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java @@ -0,0 +1,284 @@ +package net.minecraft.client.renderer.block.model; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.io.Reader; +import java.lang.reflect.Type; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.client.resources.model.ModelRotation; +import net.minecraft.util.JsonUtils; +import net.minecraft.util.ResourceLocation; + +public class ModelBlockDefinition +{ + static final Gson GSON = (new GsonBuilder()).registerTypeAdapter(ModelBlockDefinition.class, new ModelBlockDefinition.Deserializer()).registerTypeAdapter(ModelBlockDefinition.Variant.class, new ModelBlockDefinition.Variant.Deserializer()).create(); + private final Map mapVariants = Maps.newHashMap(); + + public static ModelBlockDefinition parseFromReader(Reader p_178331_0_) + { + return (ModelBlockDefinition)GSON.fromJson(p_178331_0_, ModelBlockDefinition.class); + } + + public ModelBlockDefinition(Collection p_i46221_1_) + { + for (ModelBlockDefinition.Variants modelblockdefinition$variants : p_i46221_1_) + { + this.mapVariants.put(modelblockdefinition$variants.name, modelblockdefinition$variants); + } + } + + public ModelBlockDefinition(List p_i46222_1_) + { + for (ModelBlockDefinition modelblockdefinition : p_i46222_1_) + { + this.mapVariants.putAll(modelblockdefinition.mapVariants); + } + } + + public ModelBlockDefinition.Variants getVariants(String p_178330_1_) + { + ModelBlockDefinition.Variants modelblockdefinition$variants = (ModelBlockDefinition.Variants)this.mapVariants.get(p_178330_1_); + + if (modelblockdefinition$variants == null) + { + throw new ModelBlockDefinition.MissingVariantException(); + } + else + { + return modelblockdefinition$variants; + } + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (p_equals_1_ instanceof ModelBlockDefinition) + { + ModelBlockDefinition modelblockdefinition = (ModelBlockDefinition)p_equals_1_; + return this.mapVariants.equals(modelblockdefinition.mapVariants); + } + else + { + return false; + } + } + + public int hashCode() + { + return this.mapVariants.hashCode(); + } + + public static class Deserializer implements JsonDeserializer + { + public ModelBlockDefinition deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + List list = this.parseVariantsList(p_deserialize_3_, jsonobject); + return new ModelBlockDefinition(list); + } + + protected List parseVariantsList(JsonDeserializationContext p_178334_1_, JsonObject p_178334_2_) + { + JsonObject jsonobject = JsonUtils.getJsonObject(p_178334_2_, "variants"); + List list = Lists.newArrayList(); + + for (Entry entry : jsonobject.entrySet()) + { + list.add(this.parseVariants(p_178334_1_, entry)); + } + + return list; + } + + protected ModelBlockDefinition.Variants parseVariants(JsonDeserializationContext p_178335_1_, Entry p_178335_2_) + { + String s = (String)p_178335_2_.getKey(); + List list = Lists.newArrayList(); + JsonElement jsonelement = (JsonElement)p_178335_2_.getValue(); + + if (jsonelement.isJsonArray()) + { + for (JsonElement jsonelement1 : jsonelement.getAsJsonArray()) + { + list.add((ModelBlockDefinition.Variant)p_178335_1_.deserialize(jsonelement1, ModelBlockDefinition.Variant.class)); + } + } + else + { + list.add((ModelBlockDefinition.Variant)p_178335_1_.deserialize(jsonelement, ModelBlockDefinition.Variant.class)); + } + + return new ModelBlockDefinition.Variants(s, list); + } + } + + public class MissingVariantException extends RuntimeException + { + } + + public static class Variant + { + private final ResourceLocation modelLocation; + private final ModelRotation modelRotation; + private final boolean uvLock; + private final int weight; + + public Variant(ResourceLocation modelLocationIn, ModelRotation modelRotationIn, boolean uvLockIn, int weightIn) + { + this.modelLocation = modelLocationIn; + this.modelRotation = modelRotationIn; + this.uvLock = uvLockIn; + this.weight = weightIn; + } + + public ResourceLocation getModelLocation() + { + return this.modelLocation; + } + + public ModelRotation getRotation() + { + return this.modelRotation; + } + + public boolean isUvLocked() + { + return this.uvLock; + } + + public int getWeight() + { + return this.weight; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof ModelBlockDefinition.Variant)) + { + return false; + } + else + { + ModelBlockDefinition.Variant modelblockdefinition$variant = (ModelBlockDefinition.Variant)p_equals_1_; + return this.modelLocation.equals(modelblockdefinition$variant.modelLocation) && this.modelRotation == modelblockdefinition$variant.modelRotation && this.uvLock == modelblockdefinition$variant.uvLock; + } + } + + public int hashCode() + { + int i = this.modelLocation.hashCode(); + i = 31 * i + (this.modelRotation != null ? this.modelRotation.hashCode() : 0); + i = 31 * i + (this.uvLock ? 1 : 0); + return i; + } + + public static class Deserializer implements JsonDeserializer + { + public ModelBlockDefinition.Variant deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + String s = this.parseModel(jsonobject); + ModelRotation modelrotation = this.parseRotation(jsonobject); + boolean flag = this.parseUvLock(jsonobject); + int i = this.parseWeight(jsonobject); + return new ModelBlockDefinition.Variant(this.makeModelLocation(s), modelrotation, flag, i); + } + + private ResourceLocation makeModelLocation(String p_178426_1_) + { + ResourceLocation resourcelocation = new ResourceLocation(p_178426_1_); + resourcelocation = new ResourceLocation(resourcelocation.getResourceDomain(), "block/" + resourcelocation.getResourcePath()); + return resourcelocation; + } + + private boolean parseUvLock(JsonObject p_178429_1_) + { + return JsonUtils.getBoolean(p_178429_1_, "uvlock", false); + } + + protected ModelRotation parseRotation(JsonObject p_178428_1_) + { + int i = JsonUtils.getInt(p_178428_1_, "x", 0); + int j = JsonUtils.getInt(p_178428_1_, "y", 0); + ModelRotation modelrotation = ModelRotation.getModelRotation(i, j); + + if (modelrotation == null) + { + throw new JsonParseException("Invalid BlockModelRotation x: " + i + ", y: " + j); + } + else + { + return modelrotation; + } + } + + protected String parseModel(JsonObject p_178424_1_) + { + return JsonUtils.getString(p_178424_1_, "model"); + } + + protected int parseWeight(JsonObject p_178427_1_) + { + return JsonUtils.getInt(p_178427_1_, "weight", 1); + } + } + } + + public static class Variants + { + private final String name; + private final List listVariants; + + public Variants(String nameIn, List listVariantsIn) + { + this.name = nameIn; + this.listVariants = listVariantsIn; + } + + public List getVariants() + { + return this.listVariants; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof ModelBlockDefinition.Variants)) + { + return false; + } + else + { + ModelBlockDefinition.Variants modelblockdefinition$variants = (ModelBlockDefinition.Variants)p_equals_1_; + return !this.name.equals(modelblockdefinition$variants.name) ? false : this.listVariants.equals(modelblockdefinition$variants.listVariants); + } + } + + public int hashCode() + { + int i = this.name.hashCode(); + i = 31 * i + this.listVariants.hashCode(); + return i; + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/statemap/BlockStateMapper.java b/src/minecraft/net/minecraft/client/renderer/block/statemap/BlockStateMapper.java new file mode 100644 index 0000000..8e33dd3 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/statemap/BlockStateMapper.java @@ -0,0 +1,42 @@ +package net.minecraft.client.renderer.block.statemap; + +import com.google.common.base.Objects; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.util.Collections; +import java.util.Map; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.model.ModelResourceLocation; + +public class BlockStateMapper +{ + private Map blockStateMap = Maps.newIdentityHashMap(); + private Set setBuiltInBlocks = Sets.newIdentityHashSet(); + + public void registerBlockStateMapper(Block p_178447_1_, IStateMapper p_178447_2_) + { + this.blockStateMap.put(p_178447_1_, p_178447_2_); + } + + public void registerBuiltInBlocks(Block... p_178448_1_) + { + Collections.addAll(this.setBuiltInBlocks, p_178448_1_); + } + + public Map putAllStateModelLocations() + { + Map map = Maps.newIdentityHashMap(); + + for (Block block : Block.blockRegistry) + { + if (!this.setBuiltInBlocks.contains(block)) + { + map.putAll(((IStateMapper)Objects.firstNonNull(this.blockStateMap.get(block), new DefaultStateMapper())).putStateModelLocations(block)); + } + } + + return map; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/statemap/DefaultStateMapper.java b/src/minecraft/net/minecraft/client/renderer/block/statemap/DefaultStateMapper.java new file mode 100644 index 0000000..e7baf50 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/statemap/DefaultStateMapper.java @@ -0,0 +1,14 @@ +package net.minecraft.client.renderer.block.statemap; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.util.ResourceLocation; + +public class DefaultStateMapper extends StateMapperBase +{ + protected ModelResourceLocation getModelResourceLocation(IBlockState state) + { + return new ModelResourceLocation((ResourceLocation)Block.blockRegistry.getNameForObject(state.getBlock()), this.getPropertyString(state.getProperties())); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/statemap/IStateMapper.java b/src/minecraft/net/minecraft/client/renderer/block/statemap/IStateMapper.java new file mode 100644 index 0000000..e0a179e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/statemap/IStateMapper.java @@ -0,0 +1,11 @@ +package net.minecraft.client.renderer.block.statemap; + +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.model.ModelResourceLocation; + +public interface IStateMapper +{ + Map putStateModelLocations(Block blockIn); +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java b/src/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java new file mode 100644 index 0000000..fdf397e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java @@ -0,0 +1,83 @@ +package net.minecraft.client.renderer.block.statemap; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.util.ResourceLocation; + +public class StateMap extends StateMapperBase +{ + private final IProperty name; + private final String suffix; + private final List < IProperty> ignored; + + private StateMap(IProperty name, String suffix, List < IProperty> ignored) + { + this.name = name; + this.suffix = suffix; + this.ignored = ignored; + } + + protected ModelResourceLocation getModelResourceLocation(IBlockState state) + { + Map map = Maps.newLinkedHashMap(state.getProperties()); + String s; + + if (this.name == null) + { + s = ((ResourceLocation)Block.blockRegistry.getNameForObject(state.getBlock())).toString(); + } + else + { + s = ((IProperty)this.name).getName((Comparable)map.remove(this.name)); + } + + if (this.suffix != null) + { + s = s + this.suffix; + } + + for (IProperty iproperty : this.ignored) + { + map.remove(iproperty); + } + + return new ModelResourceLocation(s, this.getPropertyString(map)); + } + + public static class Builder + { + private IProperty name; + private String suffix; + private final List < IProperty> ignored = Lists. < IProperty> newArrayList(); + + public StateMap.Builder withName(IProperty builderPropertyIn) + { + this.name = builderPropertyIn; + return this; + } + + public StateMap.Builder withSuffix(String builderSuffixIn) + { + this.suffix = builderSuffixIn; + return this; + } + + public StateMap.Builder ignore(IProperty... p_178442_1_) + { + Collections.addAll(this.ignored, p_178442_1_); + return this; + } + + public StateMap build() + { + return new StateMap(this.name, this.suffix, this.ignored); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/block/statemap/StateMapperBase.java b/src/minecraft/net/minecraft/client/renderer/block/statemap/StateMapperBase.java new file mode 100644 index 0000000..a42bb2c --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/block/statemap/StateMapperBase.java @@ -0,0 +1,52 @@ +package net.minecraft.client.renderer.block.statemap; + +import com.google.common.collect.Maps; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.model.ModelResourceLocation; + +public abstract class StateMapperBase implements IStateMapper +{ + protected Map mapStateModelLocations = Maps.newLinkedHashMap(); + + public String getPropertyString(Map p_178131_1_) + { + StringBuilder stringbuilder = new StringBuilder(); + + for (Entry entry : p_178131_1_.entrySet()) + { + if (stringbuilder.length() != 0) + { + stringbuilder.append(","); + } + + IProperty iproperty = (IProperty)entry.getKey(); + Comparable comparable = (Comparable)entry.getValue(); + stringbuilder.append(iproperty.getName()); + stringbuilder.append("="); + stringbuilder.append(iproperty.getName(comparable)); + } + + if (stringbuilder.length() == 0) + { + stringbuilder.append("normal"); + } + + return stringbuilder.toString(); + } + + public Map putStateModelLocations(Block blockIn) + { + for (IBlockState iblockstate : blockIn.getBlockState().getValidStates()) + { + this.mapStateModelLocations.put(iblockstate, this.getModelResourceLocation(iblockstate)); + } + + return this.mapStateModelLocations; + } + + protected abstract ModelResourceLocation getModelResourceLocation(IBlockState state); +} diff --git a/src/minecraft/net/minecraft/client/renderer/chunk/ChunkCompileTaskGenerator.java b/src/minecraft/net/minecraft/client/renderer/chunk/ChunkCompileTaskGenerator.java new file mode 100644 index 0000000..0c4c80e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/chunk/ChunkCompileTaskGenerator.java @@ -0,0 +1,141 @@ +package net.minecraft.client.renderer.chunk; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.concurrent.locks.ReentrantLock; +import net.minecraft.client.renderer.RegionRenderCacheBuilder; + +public class ChunkCompileTaskGenerator +{ + private final RenderChunk renderChunk; + private final ReentrantLock lock = new ReentrantLock(); + private final List listFinishRunnables = Lists.newArrayList(); + private final ChunkCompileTaskGenerator.Type type; + private RegionRenderCacheBuilder regionRenderCacheBuilder; + private CompiledChunk compiledChunk; + private ChunkCompileTaskGenerator.Status status = ChunkCompileTaskGenerator.Status.PENDING; + private boolean finished; + + public ChunkCompileTaskGenerator(RenderChunk renderChunkIn, ChunkCompileTaskGenerator.Type typeIn) + { + this.renderChunk = renderChunkIn; + this.type = typeIn; + } + + public ChunkCompileTaskGenerator.Status getStatus() + { + return this.status; + } + + public RenderChunk getRenderChunk() + { + return this.renderChunk; + } + + public CompiledChunk getCompiledChunk() + { + return this.compiledChunk; + } + + public void setCompiledChunk(CompiledChunk compiledChunkIn) + { + this.compiledChunk = compiledChunkIn; + } + + public RegionRenderCacheBuilder getRegionRenderCacheBuilder() + { + return this.regionRenderCacheBuilder; + } + + public void setRegionRenderCacheBuilder(RegionRenderCacheBuilder regionRenderCacheBuilderIn) + { + this.regionRenderCacheBuilder = regionRenderCacheBuilderIn; + } + + public void setStatus(ChunkCompileTaskGenerator.Status statusIn) + { + this.lock.lock(); + + try + { + this.status = statusIn; + } + finally + { + this.lock.unlock(); + } + } + + public void finish() + { + this.lock.lock(); + + try + { + if (this.type == ChunkCompileTaskGenerator.Type.REBUILD_CHUNK && this.status != ChunkCompileTaskGenerator.Status.DONE) + { + this.renderChunk.setNeedsUpdate(true); + } + + this.finished = true; + this.status = ChunkCompileTaskGenerator.Status.DONE; + + for (Runnable runnable : this.listFinishRunnables) + { + runnable.run(); + } + } + finally + { + this.lock.unlock(); + } + } + + public void addFinishRunnable(Runnable p_178539_1_) + { + this.lock.lock(); + + try + { + this.listFinishRunnables.add(p_178539_1_); + + if (this.finished) + { + p_178539_1_.run(); + } + } + finally + { + this.lock.unlock(); + } + } + + public ReentrantLock getLock() + { + return this.lock; + } + + public ChunkCompileTaskGenerator.Type getType() + { + return this.type; + } + + public boolean isFinished() + { + return this.finished; + } + + public static enum Status + { + PENDING, + COMPILING, + UPLOADING, + DONE; + } + + public static enum Type + { + REBUILD_CHUNK, + RESORT_TRANSPARENCY; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java b/src/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java new file mode 100644 index 0000000..cd84432 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java @@ -0,0 +1,290 @@ +package net.minecraft.client.renderer.chunk; + +import com.google.common.collect.Lists; +import com.google.common.collect.Queues; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListenableFutureTask; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import java.util.List; +import java.util.Queue; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ThreadFactory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RegionRenderCacheBuilder; +import net.minecraft.client.renderer.VertexBufferUploader; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.WorldVertexBufferUploader; +import net.minecraft.client.renderer.vertex.VertexBuffer; +import net.minecraft.util.EnumWorldBlockLayer; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.opengl.GL11; + +public class ChunkRenderDispatcher +{ + private static final Logger logger = LogManager.getLogger(); + private static final ThreadFactory threadFactory = (new ThreadFactoryBuilder()).setNameFormat("Chunk Batcher %d").setDaemon(true).build(); + private final List listThreadedWorkers = Lists.newArrayList(); + private final BlockingQueue queueChunkUpdates = Queues.newArrayBlockingQueue(100); + private final BlockingQueue queueFreeRenderBuilders = Queues.newArrayBlockingQueue(5); + private final WorldVertexBufferUploader worldVertexUploader = new WorldVertexBufferUploader(); + private final VertexBufferUploader vertexUploader = new VertexBufferUploader(); + private final Queue < ListenableFutureTask> queueChunkUploads = Queues. < ListenableFutureTask> newArrayDeque(); + private final ChunkRenderWorker renderWorker; + + public ChunkRenderDispatcher() + { + for (int i = 0; i < 2; ++i) + { + ChunkRenderWorker chunkrenderworker = new ChunkRenderWorker(this); + Thread thread = threadFactory.newThread(chunkrenderworker); + thread.start(); + this.listThreadedWorkers.add(chunkrenderworker); + } + + for (int j = 0; j < 5; ++j) + { + this.queueFreeRenderBuilders.add(new RegionRenderCacheBuilder()); + } + + this.renderWorker = new ChunkRenderWorker(this, new RegionRenderCacheBuilder()); + } + + public String getDebugInfo() + { + return String.format("pC: %03d, pU: %1d, aB: %1d", new Object[] {Integer.valueOf(this.queueChunkUpdates.size()), Integer.valueOf(this.queueChunkUploads.size()), Integer.valueOf(this.queueFreeRenderBuilders.size())}); + } + + public boolean runChunkUploads(long p_178516_1_) + { + boolean flag = false; + + while (true) + { + boolean flag1 = false; + + synchronized (this.queueChunkUploads) + { + if (!this.queueChunkUploads.isEmpty()) + { + ((ListenableFutureTask)this.queueChunkUploads.poll()).run(); + flag1 = true; + flag = true; + } + } + + if (p_178516_1_ == 0L || !flag1) + { + break; + } + + long i = p_178516_1_ - System.nanoTime(); + + if (i < 0L) + { + break; + } + } + + return flag; + } + + public boolean updateChunkLater(RenderChunk chunkRenderer) + { + chunkRenderer.getLockCompileTask().lock(); + boolean flag1; + + try + { + final ChunkCompileTaskGenerator chunkcompiletaskgenerator = chunkRenderer.makeCompileTaskChunk(); + chunkcompiletaskgenerator.addFinishRunnable(new Runnable() + { + public void run() + { + ChunkRenderDispatcher.this.queueChunkUpdates.remove(chunkcompiletaskgenerator); + } + }); + boolean flag = this.queueChunkUpdates.offer(chunkcompiletaskgenerator); + + if (!flag) + { + chunkcompiletaskgenerator.finish(); + } + + flag1 = flag; + } + finally + { + chunkRenderer.getLockCompileTask().unlock(); + } + + return flag1; + } + + public boolean updateChunkNow(RenderChunk chunkRenderer) + { + chunkRenderer.getLockCompileTask().lock(); + boolean flag; + + try + { + ChunkCompileTaskGenerator chunkcompiletaskgenerator = chunkRenderer.makeCompileTaskChunk(); + + try + { + this.renderWorker.processTask(chunkcompiletaskgenerator); + } + catch (InterruptedException var7) + { + ; + } + + flag = true; + } + finally + { + chunkRenderer.getLockCompileTask().unlock(); + } + + return flag; + } + + public void stopChunkUpdates() + { + this.clearChunkUpdates(); + + while (this.runChunkUploads(0L)) + { + ; + } + + List list = Lists.newArrayList(); + + while (((List)list).size() != 5) + { + try + { + list.add(this.allocateRenderBuilder()); + } + catch (InterruptedException var3) + { + ; + } + } + + this.queueFreeRenderBuilders.addAll(list); + } + + public void freeRenderBuilder(RegionRenderCacheBuilder p_178512_1_) + { + this.queueFreeRenderBuilders.add(p_178512_1_); + } + + public RegionRenderCacheBuilder allocateRenderBuilder() throws InterruptedException + { + return (RegionRenderCacheBuilder)this.queueFreeRenderBuilders.take(); + } + + public ChunkCompileTaskGenerator getNextChunkUpdate() throws InterruptedException + { + return (ChunkCompileTaskGenerator)this.queueChunkUpdates.take(); + } + + public boolean updateTransparencyLater(RenderChunk chunkRenderer) + { + chunkRenderer.getLockCompileTask().lock(); + boolean flag; + + try + { + final ChunkCompileTaskGenerator chunkcompiletaskgenerator = chunkRenderer.makeCompileTaskTransparency(); + + if (chunkcompiletaskgenerator == null) + { + flag = true; + return flag; + } + + chunkcompiletaskgenerator.addFinishRunnable(new Runnable() + { + public void run() + { + ChunkRenderDispatcher.this.queueChunkUpdates.remove(chunkcompiletaskgenerator); + } + }); + flag = this.queueChunkUpdates.offer(chunkcompiletaskgenerator); + } + finally + { + chunkRenderer.getLockCompileTask().unlock(); + } + + return flag; + } + + public ListenableFuture uploadChunk(final EnumWorldBlockLayer player, final WorldRenderer p_178503_2_, final RenderChunk chunkRenderer, final CompiledChunk compiledChunkIn) + { + if (Minecraft.getMinecraft().isCallingFromMinecraftThread()) + { + if (OpenGlHelper.useVbo()) + { + this.uploadVertexBuffer(p_178503_2_, chunkRenderer.getVertexBufferByLayer(player.ordinal())); + } + else + { + this.uploadDisplayList(p_178503_2_, ((ListedRenderChunk)chunkRenderer).getDisplayList(player, compiledChunkIn), chunkRenderer); + } + + p_178503_2_.setTranslation(0.0D, 0.0D, 0.0D); + return Futures.immediateFuture((Object)null); + } + else + { + ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(new Runnable() + { + public void run() + { + ChunkRenderDispatcher.this.uploadChunk(player, p_178503_2_, chunkRenderer, compiledChunkIn); + } + }, (Object)null); + + synchronized (this.queueChunkUploads) + { + this.queueChunkUploads.add(listenablefuturetask); + return listenablefuturetask; + } + } + } + + private void uploadDisplayList(WorldRenderer p_178510_1_, int p_178510_2_, RenderChunk chunkRenderer) + { + GL11.glNewList(p_178510_2_, GL11.GL_COMPILE); + GlStateManager.pushMatrix(); + chunkRenderer.multModelviewMatrix(); + this.worldVertexUploader.func_181679_a(p_178510_1_); + GlStateManager.popMatrix(); + GL11.glEndList(); + } + + private void uploadVertexBuffer(WorldRenderer p_178506_1_, VertexBuffer vertexBufferIn) + { + this.vertexUploader.setVertexBuffer(vertexBufferIn); + this.vertexUploader.func_181679_a(p_178506_1_); + } + + public void clearChunkUpdates() + { + while (!this.queueChunkUpdates.isEmpty()) + { + ChunkCompileTaskGenerator chunkcompiletaskgenerator = (ChunkCompileTaskGenerator)this.queueChunkUpdates.poll(); + + if (chunkcompiletaskgenerator != null) + { + chunkcompiletaskgenerator.finish(); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderWorker.java b/src/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderWorker.java new file mode 100644 index 0000000..ed0b108 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderWorker.java @@ -0,0 +1,206 @@ +package net.minecraft.client.renderer.chunk; + +import com.google.common.collect.Lists; +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CancellationException; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.RegionRenderCacheBuilder; +import net.minecraft.crash.CrashReport; +import net.minecraft.entity.Entity; +import net.minecraft.util.EnumWorldBlockLayer; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ChunkRenderWorker implements Runnable +{ + private static final Logger LOGGER = LogManager.getLogger(); + private final ChunkRenderDispatcher chunkRenderDispatcher; + private final RegionRenderCacheBuilder regionRenderCacheBuilder; + + public ChunkRenderWorker(ChunkRenderDispatcher p_i46201_1_) + { + this(p_i46201_1_, (RegionRenderCacheBuilder)null); + } + + public ChunkRenderWorker(ChunkRenderDispatcher chunkRenderDispatcherIn, RegionRenderCacheBuilder regionRenderCacheBuilderIn) + { + this.chunkRenderDispatcher = chunkRenderDispatcherIn; + this.regionRenderCacheBuilder = regionRenderCacheBuilderIn; + } + + public void run() + { + while (true) + { + try + { + this.processTask(this.chunkRenderDispatcher.getNextChunkUpdate()); + } + catch (InterruptedException var3) + { + LOGGER.debug("Stopping due to interrupt"); + return; + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Batching chunks"); + Minecraft.getMinecraft().crashed(Minecraft.getMinecraft().addGraphicsAndWorldToCrashReport(crashreport)); + return; + } + } + } + + protected void processTask(final ChunkCompileTaskGenerator generator) throws InterruptedException + { + generator.getLock().lock(); + + try + { + if (generator.getStatus() != ChunkCompileTaskGenerator.Status.PENDING) + { + if (!generator.isFinished()) + { + LOGGER.warn("Chunk render task was " + generator.getStatus() + " when I expected it to be pending; ignoring task"); + } + + return; + } + + generator.setStatus(ChunkCompileTaskGenerator.Status.COMPILING); + } + finally + { + generator.getLock().unlock(); + } + + Entity lvt_2_1_ = Minecraft.getMinecraft().getRenderViewEntity(); + + if (lvt_2_1_ == null) + { + generator.finish(); + } + else + { + generator.setRegionRenderCacheBuilder(this.getRegionRenderCacheBuilder()); + float f = (float)lvt_2_1_.posX; + float f1 = (float)lvt_2_1_.posY + lvt_2_1_.getEyeHeight(); + float f2 = (float)lvt_2_1_.posZ; + ChunkCompileTaskGenerator.Type chunkcompiletaskgenerator$type = generator.getType(); + + if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.REBUILD_CHUNK) + { + generator.getRenderChunk().rebuildChunk(f, f1, f2, generator); + } + else if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY) + { + generator.getRenderChunk().resortTransparency(f, f1, f2, generator); + } + + generator.getLock().lock(); + + try + { + if (generator.getStatus() != ChunkCompileTaskGenerator.Status.COMPILING) + { + if (!generator.isFinished()) + { + LOGGER.warn("Chunk render task was " + generator.getStatus() + " when I expected it to be compiling; aborting task"); + } + + this.freeRenderBuilder(generator); + return; + } + + generator.setStatus(ChunkCompileTaskGenerator.Status.UPLOADING); + } + finally + { + generator.getLock().unlock(); + } + + final CompiledChunk lvt_7_1_ = generator.getCompiledChunk(); + ArrayList lvt_8_1_ = Lists.newArrayList(); + + if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.REBUILD_CHUNK) + { + for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values()) + { + if (lvt_7_1_.isLayerStarted(enumworldblocklayer)) + { + lvt_8_1_.add(this.chunkRenderDispatcher.uploadChunk(enumworldblocklayer, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer), generator.getRenderChunk(), lvt_7_1_)); + } + } + } + else if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY) + { + lvt_8_1_.add(this.chunkRenderDispatcher.uploadChunk(EnumWorldBlockLayer.TRANSLUCENT, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(EnumWorldBlockLayer.TRANSLUCENT), generator.getRenderChunk(), lvt_7_1_)); + } + + final ListenableFuture> listenablefuture = Futures.allAsList(lvt_8_1_); + generator.addFinishRunnable(new Runnable() + { + public void run() + { + listenablefuture.cancel(false); + } + }); + Futures.addCallback(listenablefuture, new FutureCallback>() + { + public void onSuccess(List p_onSuccess_1_) + { + ChunkRenderWorker.this.freeRenderBuilder(generator); + generator.getLock().lock(); + label21: + { + try + { + if (generator.getStatus() == ChunkCompileTaskGenerator.Status.UPLOADING) + { + generator.setStatus(ChunkCompileTaskGenerator.Status.DONE); + break label21; + } + + if (!generator.isFinished()) + { + ChunkRenderWorker.LOGGER.warn("Chunk render task was " + generator.getStatus() + " when I expected it to be uploading; aborting task"); + } + } + finally + { + generator.getLock().unlock(); + } + + return; + } + generator.getRenderChunk().setCompiledChunk(lvt_7_1_); + } + public void onFailure(Throwable p_onFailure_1_) + { + ChunkRenderWorker.this.freeRenderBuilder(generator); + + if (!(p_onFailure_1_ instanceof CancellationException) && !(p_onFailure_1_ instanceof InterruptedException)) + { + Minecraft.getMinecraft().crashed(CrashReport.makeCrashReport(p_onFailure_1_, "Rendering chunk")); + } + } + }); + } + } + + private RegionRenderCacheBuilder getRegionRenderCacheBuilder() throws InterruptedException + { + return this.regionRenderCacheBuilder != null ? this.regionRenderCacheBuilder : this.chunkRenderDispatcher.allocateRenderBuilder(); + } + + private void freeRenderBuilder(ChunkCompileTaskGenerator taskGenerator) + { + if (this.regionRenderCacheBuilder == null) + { + this.chunkRenderDispatcher.freeRenderBuilder(taskGenerator.getRegionRenderCacheBuilder()); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/chunk/CompiledChunk.java b/src/minecraft/net/minecraft/client/renderer/chunk/CompiledChunk.java new file mode 100644 index 0000000..09be529 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/chunk/CompiledChunk.java @@ -0,0 +1,89 @@ +package net.minecraft.client.renderer.chunk; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; + +public class CompiledChunk +{ + public static final CompiledChunk DUMMY = new CompiledChunk() + { + protected void setLayerUsed(EnumWorldBlockLayer layer) + { + throw new UnsupportedOperationException(); + } + public void setLayerStarted(EnumWorldBlockLayer layer) + { + throw new UnsupportedOperationException(); + } + public boolean isVisible(EnumFacing facing, EnumFacing facing2) + { + return false; + } + }; + private final boolean[] layersUsed = new boolean[EnumWorldBlockLayer.values().length]; + private final boolean[] layersStarted = new boolean[EnumWorldBlockLayer.values().length]; + private boolean empty = true; + private final List tileEntities = Lists.newArrayList(); + private SetVisibility setVisibility = new SetVisibility(); + private WorldRenderer.State state; + + public boolean isEmpty() + { + return this.empty; + } + + protected void setLayerUsed(EnumWorldBlockLayer layer) + { + this.empty = false; + this.layersUsed[layer.ordinal()] = true; + } + + public boolean isLayerEmpty(EnumWorldBlockLayer layer) + { + return !this.layersUsed[layer.ordinal()]; + } + + public void setLayerStarted(EnumWorldBlockLayer layer) + { + this.layersStarted[layer.ordinal()] = true; + } + + public boolean isLayerStarted(EnumWorldBlockLayer layer) + { + return this.layersStarted[layer.ordinal()]; + } + + public List getTileEntities() + { + return this.tileEntities; + } + + public void addTileEntity(TileEntity tileEntityIn) + { + this.tileEntities.add(tileEntityIn); + } + + public boolean isVisible(EnumFacing facing, EnumFacing facing2) + { + return this.setVisibility.isVisible(facing, facing2); + } + + public void setVisibility(SetVisibility visibility) + { + this.setVisibility = visibility; + } + + public WorldRenderer.State getState() + { + return this.state; + } + + public void setState(WorldRenderer.State stateIn) + { + this.state = stateIn; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/chunk/IRenderChunkFactory.java b/src/minecraft/net/minecraft/client/renderer/chunk/IRenderChunkFactory.java new file mode 100644 index 0000000..787effc --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/chunk/IRenderChunkFactory.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.chunk; + +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public interface IRenderChunkFactory +{ + RenderChunk makeRenderChunk(World worldIn, RenderGlobal globalRenderer, BlockPos pos, int index); +} diff --git a/src/minecraft/net/minecraft/client/renderer/chunk/ListChunkFactory.java b/src/minecraft/net/minecraft/client/renderer/chunk/ListChunkFactory.java new file mode 100644 index 0000000..393dc0e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/chunk/ListChunkFactory.java @@ -0,0 +1,13 @@ +package net.minecraft.client.renderer.chunk; + +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class ListChunkFactory implements IRenderChunkFactory +{ + public RenderChunk makeRenderChunk(World worldIn, RenderGlobal globalRenderer, BlockPos pos, int index) + { + return new ListedRenderChunk(worldIn, globalRenderer, pos, index); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/chunk/ListedRenderChunk.java b/src/minecraft/net/minecraft/client/renderer/chunk/ListedRenderChunk.java new file mode 100644 index 0000000..32c1898 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/chunk/ListedRenderChunk.java @@ -0,0 +1,28 @@ +package net.minecraft.client.renderer.chunk; + +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; + +public class ListedRenderChunk extends RenderChunk +{ + private final int baseDisplayList = GLAllocation.generateDisplayLists(EnumWorldBlockLayer.values().length); + + public ListedRenderChunk(World worldIn, RenderGlobal renderGlobalIn, BlockPos pos, int indexIn) + { + super(worldIn, renderGlobalIn, pos, indexIn); + } + + public int getDisplayList(EnumWorldBlockLayer layer, CompiledChunk p_178600_2_) + { + return !p_178600_2_.isLayerEmpty(layer) ? this.baseDisplayList + layer.ordinal() : -1; + } + + public void deleteGlResources() + { + super.deleteGlResources(); + GLAllocation.deleteDisplayLists(this.baseDisplayList, EnumWorldBlockLayer.values().length); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java b/src/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java new file mode 100644 index 0000000..7be0404 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java @@ -0,0 +1,538 @@ +package net.minecraft.client.renderer.chunk; + +import com.google.common.collect.Sets; +import java.nio.FloatBuffer; +import java.util.EnumMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.concurrent.locks.ReentrantLock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockCactus; +import net.minecraft.block.BlockRedstoneWire; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RegionRenderCache; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexBuffer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.World; +import optifine.BlockPosM; +import optifine.Config; +import optifine.Reflector; +import optifine.ReflectorForge; +import shadersmod.client.SVertexBuilder; + +public class RenderChunk +{ + private World world; + private final RenderGlobal renderGlobal; + public static int renderChunksUpdated; + private BlockPos position; + public CompiledChunk compiledChunk = CompiledChunk.DUMMY; + private final ReentrantLock lockCompileTask = new ReentrantLock(); + private final ReentrantLock lockCompiledChunk = new ReentrantLock(); + private ChunkCompileTaskGenerator compileTask = null; + private final Set field_181056_j = Sets.newHashSet(); + private final int index; + private final FloatBuffer modelviewMatrix = GLAllocation.createDirectFloatBuffer(16); + private final VertexBuffer[] vertexBuffers = new VertexBuffer[EnumWorldBlockLayer.values().length]; + public AxisAlignedBB boundingBox; + private int frameIndex = -1; + private boolean needsUpdate = true; + private EnumMap field_181702_p; + private static final String __OBFID = "CL_00002452"; + private BlockPos[] positionOffsets16 = new BlockPos[EnumFacing.VALUES.length]; + private static EnumWorldBlockLayer[] ENUM_WORLD_BLOCK_LAYERS = EnumWorldBlockLayer.values(); + private EnumWorldBlockLayer[] blockLayersSingle = new EnumWorldBlockLayer[1]; + private boolean isMipmaps = Config.isMipmaps(); + private boolean fixBlockLayer = !Reflector.BetterFoliageClient.exists(); + private boolean playerUpdate = false; + + public RenderChunk(World worldIn, RenderGlobal renderGlobalIn, BlockPos blockPosIn, int indexIn) + { + this.world = worldIn; + this.renderGlobal = renderGlobalIn; + this.index = indexIn; + + if (!blockPosIn.equals(this.getPosition())) + { + this.setPosition(blockPosIn); + } + + if (OpenGlHelper.useVbo()) + { + for (int i = 0; i < EnumWorldBlockLayer.values().length; ++i) + { + this.vertexBuffers[i] = new VertexBuffer(DefaultVertexFormats.BLOCK); + } + } + } + + public boolean setFrameIndex(int frameIndexIn) + { + if (this.frameIndex == frameIndexIn) + { + return false; + } + else + { + this.frameIndex = frameIndexIn; + return true; + } + } + + public VertexBuffer getVertexBufferByLayer(int layer) + { + return this.vertexBuffers[layer]; + } + + public void setPosition(BlockPos pos) + { + this.stopCompileTask(); + this.position = pos; + this.boundingBox = new AxisAlignedBB(pos, pos.add(16, 16, 16)); + this.initModelviewMatrix(); + + for (int i = 0; i < this.positionOffsets16.length; ++i) + { + this.positionOffsets16[i] = null; + } + } + + public void resortTransparency(float x, float y, float z, ChunkCompileTaskGenerator generator) + { + CompiledChunk compiledchunk = generator.getCompiledChunk(); + + if (compiledchunk.getState() != null && !compiledchunk.isLayerEmpty(EnumWorldBlockLayer.TRANSLUCENT)) + { + WorldRenderer worldrenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(EnumWorldBlockLayer.TRANSLUCENT); + this.preRenderBlocks(worldrenderer, this.position); + worldrenderer.setVertexState(compiledchunk.getState()); + this.postRenderBlocks(EnumWorldBlockLayer.TRANSLUCENT, x, y, z, worldrenderer, compiledchunk); + } + } + + public void rebuildChunk(float x, float y, float z, ChunkCompileTaskGenerator generator) + { + CompiledChunk compiledchunk = new CompiledChunk(); + boolean flag = true; + BlockPos blockpos = this.position; + BlockPos blockpos1 = blockpos.add(15, 15, 15); + generator.getLock().lock(); + RegionRenderCache regionrendercache; + + try + { + if (generator.getStatus() != ChunkCompileTaskGenerator.Status.COMPILING) + { + return; + } + + if (this.world == null) + { + return; + } + + regionrendercache = this.createRegionRenderCache(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); + + if (Reflector.MinecraftForgeClient_onRebuildChunk.exists()) + { + Reflector.call(Reflector.MinecraftForgeClient_onRebuildChunk, new Object[] {this.world, this.position, regionrendercache}); + } + + generator.setCompiledChunk(compiledchunk); + } + finally + { + generator.getLock().unlock(); + } + + VisGraph var10 = new VisGraph(); + HashSet var11 = Sets.newHashSet(); + + if (!regionrendercache.extendedLevelsInChunkCache()) + { + ++renderChunksUpdated; + boolean[] aboolean = new boolean[ENUM_WORLD_BLOCK_LAYERS.length]; + BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + Iterator iterator = BlockPosM.getAllInBoxMutable(blockpos, blockpos1).iterator(); + boolean flag1 = Reflector.ForgeBlock_hasTileEntity.exists(); + boolean flag2 = Reflector.ForgeBlock_canRenderInLayer.exists(); + boolean flag3 = Reflector.ForgeHooksClient_setRenderLayer.exists(); + + while (iterator.hasNext()) + { + BlockPosM blockposm = (BlockPosM)iterator.next(); + IBlockState iblockstate = regionrendercache.getBlockState(blockposm); + Block block = iblockstate.getBlock(); + + if (block.isOpaqueCube()) + { + var10.func_178606_a(blockposm); + } + + if (ReflectorForge.blockHasTileEntity(iblockstate)) + { + TileEntity tileentity = regionrendercache.getTileEntity(new BlockPos(blockposm)); + TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileentity); + + if (tileentity != null && tileentityspecialrenderer != null) + { + compiledchunk.addTileEntity(tileentity); + + if (tileentityspecialrenderer.func_181055_a()) + { + var11.add(tileentity); + } + } + } + + EnumWorldBlockLayer[] aenumworldblocklayer; + + if (flag2) + { + aenumworldblocklayer = ENUM_WORLD_BLOCK_LAYERS; + } + else + { + aenumworldblocklayer = this.blockLayersSingle; + aenumworldblocklayer[0] = block.getBlockLayer(); + } + + for (int i = 0; i < aenumworldblocklayer.length; ++i) + { + EnumWorldBlockLayer enumworldblocklayer = aenumworldblocklayer[i]; + + if (flag2) + { + boolean flag4 = Reflector.callBoolean(block, Reflector.ForgeBlock_canRenderInLayer, new Object[] {enumworldblocklayer}); + + if (!flag4) + { + continue; + } + } + + if (flag3) + { + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderLayer, new Object[] {enumworldblocklayer}); + } + + if (this.fixBlockLayer) + { + enumworldblocklayer = this.fixBlockLayer(block, enumworldblocklayer); + } + + int j = enumworldblocklayer.ordinal(); + + if (block.getRenderType() != -1) + { + WorldRenderer worldrenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayerId(j); + worldrenderer.setBlockLayer(enumworldblocklayer); + + if (!compiledchunk.isLayerStarted(enumworldblocklayer)) + { + compiledchunk.setLayerStarted(enumworldblocklayer); + this.preRenderBlocks(worldrenderer, blockpos); + } + + aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockposm, regionrendercache, worldrenderer); + } + } + } + + for (EnumWorldBlockLayer enumworldblocklayer1 : ENUM_WORLD_BLOCK_LAYERS) + { + if (aboolean[enumworldblocklayer1.ordinal()]) + { + compiledchunk.setLayerUsed(enumworldblocklayer1); + } + + if (compiledchunk.isLayerStarted(enumworldblocklayer1)) + { + if (Config.isShaders()) + { + SVertexBuilder.calcNormalChunkLayer(generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer1)); + } + + this.postRenderBlocks(enumworldblocklayer1, x, y, z, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer1), compiledchunk); + } + } + } + + compiledchunk.setVisibility(var10.computeVisibility()); + this.lockCompileTask.lock(); + + try + { + HashSet hashset1 = Sets.newHashSet(var11); + HashSet hashset2 = Sets.newHashSet(this.field_181056_j); + hashset1.removeAll(this.field_181056_j); + hashset2.removeAll(var11); + this.field_181056_j.clear(); + this.field_181056_j.addAll(var11); + this.renderGlobal.func_181023_a(hashset2, hashset1); + } + finally + { + this.lockCompileTask.unlock(); + } + } + + protected void finishCompileTask() + { + this.lockCompileTask.lock(); + + try + { + if (this.compileTask != null && this.compileTask.getStatus() != ChunkCompileTaskGenerator.Status.DONE) + { + this.compileTask.finish(); + this.compileTask = null; + } + } + finally + { + this.lockCompileTask.unlock(); + } + } + + public ReentrantLock getLockCompileTask() + { + return this.lockCompileTask; + } + + public ChunkCompileTaskGenerator makeCompileTaskChunk() + { + this.lockCompileTask.lock(); + ChunkCompileTaskGenerator chunkcompiletaskgenerator; + + try + { + this.finishCompileTask(); + this.compileTask = new ChunkCompileTaskGenerator(this, ChunkCompileTaskGenerator.Type.REBUILD_CHUNK); + chunkcompiletaskgenerator = this.compileTask; + } + finally + { + this.lockCompileTask.unlock(); + } + + return chunkcompiletaskgenerator; + } + + public ChunkCompileTaskGenerator makeCompileTaskTransparency() + { + this.lockCompileTask.lock(); + ChunkCompileTaskGenerator chunkcompiletaskgenerator1; + + try + { + if (this.compileTask != null && this.compileTask.getStatus() == ChunkCompileTaskGenerator.Status.PENDING) + { + ChunkCompileTaskGenerator chunkcompiletaskgenerator2 = null; + return chunkcompiletaskgenerator2; + } + + if (this.compileTask != null && this.compileTask.getStatus() != ChunkCompileTaskGenerator.Status.DONE) + { + this.compileTask.finish(); + this.compileTask = null; + } + + this.compileTask = new ChunkCompileTaskGenerator(this, ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY); + this.compileTask.setCompiledChunk(this.compiledChunk); + ChunkCompileTaskGenerator chunkcompiletaskgenerator = this.compileTask; + chunkcompiletaskgenerator1 = chunkcompiletaskgenerator; + } + finally + { + this.lockCompileTask.unlock(); + } + + return chunkcompiletaskgenerator1; + } + + private void preRenderBlocks(WorldRenderer worldRendererIn, BlockPos pos) + { + worldRendererIn.begin(7, DefaultVertexFormats.BLOCK); + worldRendererIn.setTranslation((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); + } + + private void postRenderBlocks(EnumWorldBlockLayer layer, float x, float y, float z, WorldRenderer worldRendererIn, CompiledChunk compiledChunkIn) + { + if (layer == EnumWorldBlockLayer.TRANSLUCENT && !compiledChunkIn.isLayerEmpty(layer)) + { + worldRendererIn.func_181674_a(x, y, z); + compiledChunkIn.setState(worldRendererIn.func_181672_a()); + } + + worldRendererIn.finishDrawing(); + } + + private void initModelviewMatrix() + { + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + float f = 1.000001F; + GlStateManager.translate(-8.0F, -8.0F, -8.0F); + GlStateManager.scale(f, f, f); + GlStateManager.translate(8.0F, 8.0F, 8.0F); + GlStateManager.getFloat(2982, this.modelviewMatrix); + GlStateManager.popMatrix(); + } + + public void multModelviewMatrix() + { + GlStateManager.multMatrix(this.modelviewMatrix); + } + + public CompiledChunk getCompiledChunk() + { + return this.compiledChunk; + } + + public void setCompiledChunk(CompiledChunk compiledChunkIn) + { + this.lockCompiledChunk.lock(); + + try + { + this.compiledChunk = compiledChunkIn; + } + finally + { + this.lockCompiledChunk.unlock(); + } + } + + public void stopCompileTask() + { + this.finishCompileTask(); + this.compiledChunk = CompiledChunk.DUMMY; + } + + public void deleteGlResources() + { + this.stopCompileTask(); + this.world = null; + + for (int i = 0; i < EnumWorldBlockLayer.values().length; ++i) + { + if (this.vertexBuffers[i] != null) + { + this.vertexBuffers[i].deleteGlBuffers(); + } + } + } + + public BlockPos getPosition() + { + return this.position; + } + + public void setNeedsUpdate(boolean needsUpdateIn) + { + this.needsUpdate = needsUpdateIn; + + if (this.needsUpdate) + { + if (this.isWorldPlayerUpdate()) + { + this.playerUpdate = true; + } + } + else + { + this.playerUpdate = false; + } + } + + public boolean isNeedsUpdate() + { + return this.needsUpdate; + } + + public BlockPos func_181701_a(EnumFacing p_181701_1_) + { + return this.getPositionOffset16(p_181701_1_); + } + + public BlockPos getPositionOffset16(EnumFacing p_getPositionOffset16_1_) + { + int i = p_getPositionOffset16_1_.getIndex(); + BlockPos blockpos = this.positionOffsets16[i]; + + if (blockpos == null) + { + blockpos = this.getPosition().offset(p_getPositionOffset16_1_, 16); + this.positionOffsets16[i] = blockpos; + } + + return blockpos; + } + + private boolean isWorldPlayerUpdate() + { + if (this.world instanceof WorldClient) + { + WorldClient worldclient = (WorldClient)this.world; + return worldclient.isPlayerUpdate(); + } + else + { + return false; + } + } + + public boolean isPlayerUpdate() + { + return this.playerUpdate; + } + + protected RegionRenderCache createRegionRenderCache(World p_createRegionRenderCache_1_, BlockPos p_createRegionRenderCache_2_, BlockPos p_createRegionRenderCache_3_, int p_createRegionRenderCache_4_) + { + return new RegionRenderCache(p_createRegionRenderCache_1_, p_createRegionRenderCache_2_, p_createRegionRenderCache_3_, p_createRegionRenderCache_4_); + } + + private EnumWorldBlockLayer fixBlockLayer(Block p_fixBlockLayer_1_, EnumWorldBlockLayer p_fixBlockLayer_2_) + { + if (this.isMipmaps) + { + if (p_fixBlockLayer_2_ == EnumWorldBlockLayer.CUTOUT) + { + if (p_fixBlockLayer_1_ instanceof BlockRedstoneWire) + { + return p_fixBlockLayer_2_; + } + + if (p_fixBlockLayer_1_ instanceof BlockCactus) + { + return p_fixBlockLayer_2_; + } + + return EnumWorldBlockLayer.CUTOUT_MIPPED; + } + } + else if (p_fixBlockLayer_2_ == EnumWorldBlockLayer.CUTOUT_MIPPED) + { + return EnumWorldBlockLayer.CUTOUT; + } + + return p_fixBlockLayer_2_; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/chunk/SetVisibility.java b/src/minecraft/net/minecraft/client/renderer/chunk/SetVisibility.java new file mode 100644 index 0000000..c70c9d6 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/chunk/SetVisibility.java @@ -0,0 +1,78 @@ +package net.minecraft.client.renderer.chunk; + +import java.util.BitSet; +import java.util.Set; +import net.minecraft.util.EnumFacing; + +public class SetVisibility +{ + private static final int COUNT_FACES = EnumFacing.values().length; + private final BitSet bitSet; + + public SetVisibility() + { + this.bitSet = new BitSet(COUNT_FACES * COUNT_FACES); + } + + public void setManyVisible(Set p_178620_1_) + { + for (EnumFacing enumfacing : p_178620_1_) + { + for (EnumFacing enumfacing1 : p_178620_1_) + { + this.setVisible(enumfacing, enumfacing1, true); + } + } + } + + public void setVisible(EnumFacing facing, EnumFacing facing2, boolean p_178619_3_) + { + this.bitSet.set(facing.ordinal() + facing2.ordinal() * COUNT_FACES, p_178619_3_); + this.bitSet.set(facing2.ordinal() + facing.ordinal() * COUNT_FACES, p_178619_3_); + } + + public void setAllVisible(boolean visible) + { + this.bitSet.set(0, this.bitSet.size(), visible); + } + + public boolean isVisible(EnumFacing facing, EnumFacing facing2) + { + return this.bitSet.get(facing.ordinal() + facing2.ordinal() * COUNT_FACES); + } + + public String toString() + { + StringBuilder stringbuilder = new StringBuilder(); + stringbuilder.append(' '); + + for (EnumFacing enumfacing : EnumFacing.values()) + { + stringbuilder.append(' ').append(enumfacing.toString().toUpperCase().charAt(0)); + } + + stringbuilder.append('\n'); + + for (EnumFacing enumfacing2 : EnumFacing.values()) + { + stringbuilder.append(enumfacing2.toString().toUpperCase().charAt(0)); + + for (EnumFacing enumfacing1 : EnumFacing.values()) + { + if (enumfacing2 == enumfacing1) + { + stringbuilder.append(" "); + } + else + { + boolean flag = this.isVisible(enumfacing2, enumfacing1); + stringbuilder.append(' ').append((char)(flag ? 'Y' : 'n')); + } + } + + stringbuilder.append('\n'); + } + + return stringbuilder.toString(); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/chunk/VboChunkFactory.java b/src/minecraft/net/minecraft/client/renderer/chunk/VboChunkFactory.java new file mode 100644 index 0000000..748f3d9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/chunk/VboChunkFactory.java @@ -0,0 +1,13 @@ +package net.minecraft.client.renderer.chunk; + +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class VboChunkFactory implements IRenderChunkFactory +{ + public RenderChunk makeRenderChunk(World worldIn, RenderGlobal globalRenderer, BlockPos pos, int index) + { + return new RenderChunk(worldIn, globalRenderer, pos, index); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/chunk/VisGraph.java b/src/minecraft/net/minecraft/client/renderer/chunk/VisGraph.java new file mode 100644 index 0000000..39539d5 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/chunk/VisGraph.java @@ -0,0 +1,272 @@ +package net.minecraft.client.renderer.chunk; + +import java.util.ArrayDeque; +import java.util.BitSet; +import java.util.EnumSet; +import java.util.Set; + +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import optifine.IntegerCache; + +public class VisGraph +{ + private static final int field_178616_a = (int)Math.pow(16.0D, 0.0D); + private static final int field_178614_b = (int)Math.pow(16.0D, 1.0D); + private static final int field_178615_c = (int)Math.pow(16.0D, 2.0D); + private final BitSet field_178612_d = new BitSet(4096); + private static final int[] field_178613_e = new int[1352]; + private int field_178611_f = 4096; + private static final String __OBFID = "CL_00002450"; + + public void func_178606_a(BlockPos pos) + { + this.field_178612_d.set(getIndex(pos), true); + --this.field_178611_f; + } + + private static int getIndex(BlockPos pos) + { + return getIndex(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15); + } + + private static int getIndex(int x, int y, int z) + { + return x << 0 | y << 8 | z << 4; + } + + public SetVisibility computeVisibility() + { + SetVisibility setvisibility = new SetVisibility(); + + if (4096 - this.field_178611_f < 256) + { + setvisibility.setAllVisible(true); + } + else if (this.field_178611_f == 0) + { + setvisibility.setAllVisible(false); + } + else + { + for (int i : field_178613_e) + { + if (!this.field_178612_d.get(i)) + { + setvisibility.setManyVisible(this.func_178604_a(i)); + } + } + } + + return setvisibility; + } + + public Set func_178609_b(BlockPos pos) + { + return this.func_178604_a(getIndex(pos)); + } + + private Set func_178604_a(int p_178604_1_) + { + EnumSet enumset = EnumSet.noneOf(EnumFacing.class); + ArrayDeque arraydeque = new ArrayDeque(384); + arraydeque.add(IntegerCache.valueOf(p_178604_1_)); + this.field_178612_d.set(p_178604_1_, true); + + while (!arraydeque.isEmpty()) + { + int i = ((Integer)arraydeque.poll()).intValue(); + this.func_178610_a(i, enumset); + + for (EnumFacing enumfacing : EnumFacing.VALUES) + { + int j = this.func_178603_a(i, enumfacing); + + if (j >= 0 && !this.field_178612_d.get(j)) + { + this.field_178612_d.set(j, true); + arraydeque.add(IntegerCache.valueOf(j)); + } + } + } + + return enumset; + } + + private void func_178610_a(int p_178610_1_, Set p_178610_2_) + { + int i = p_178610_1_ >> 0 & 15; + + if (i == 0) + { + p_178610_2_.add(EnumFacing.WEST); + } + else if (i == 15) + { + p_178610_2_.add(EnumFacing.EAST); + } + + int j = p_178610_1_ >> 8 & 15; + + if (j == 0) + { + p_178610_2_.add(EnumFacing.DOWN); + } + else if (j == 15) + { + p_178610_2_.add(EnumFacing.UP); + } + + int k = p_178610_1_ >> 4 & 15; + + if (k == 0) + { + p_178610_2_.add(EnumFacing.NORTH); + } + else if (k == 15) + { + p_178610_2_.add(EnumFacing.SOUTH); + } + } + + private int func_178603_a(int p_178603_1_, EnumFacing p_178603_2_) + { + switch (VisGraph.VisGraph$1.field_178617_a[p_178603_2_.ordinal()]) + { + case 1: + if ((p_178603_1_ >> 8 & 15) == 0) + { + return -1; + } + + return p_178603_1_ - field_178615_c; + + case 2: + if ((p_178603_1_ >> 8 & 15) == 15) + { + return -1; + } + + return p_178603_1_ + field_178615_c; + + case 3: + if ((p_178603_1_ >> 4 & 15) == 0) + { + return -1; + } + + return p_178603_1_ - field_178614_b; + + case 4: + if ((p_178603_1_ >> 4 & 15) == 15) + { + return -1; + } + + return p_178603_1_ + field_178614_b; + + case 5: + if ((p_178603_1_ >> 0 & 15) == 0) + { + return -1; + } + + return p_178603_1_ - field_178616_a; + + case 6: + if ((p_178603_1_ >> 0 & 15) == 15) + { + return -1; + } + + return p_178603_1_ + field_178616_a; + + default: + return -1; + } + } + + static + { + boolean flag = false; + boolean flag1 = true; + int i = 0; + + for (int j = 0; j < 16; ++j) + { + for (int k = 0; k < 16; ++k) + { + for (int l = 0; l < 16; ++l) + { + if (j == 0 || j == 15 || k == 0 || k == 15 || l == 0 || l == 15) + { + field_178613_e[i++] = getIndex(j, k, l); + } + } + } + } + } + + static final class VisGraph$1 + { + static final int[] field_178617_a = new int[EnumFacing.values().length]; + private static final String __OBFID = "CL_00002449"; + + static + { + try + { + field_178617_a[EnumFacing.DOWN.ordinal()] = 1; + } + catch (NoSuchFieldError var6) + { + ; + } + + try + { + field_178617_a[EnumFacing.UP.ordinal()] = 2; + } + catch (NoSuchFieldError var5) + { + ; + } + + try + { + field_178617_a[EnumFacing.NORTH.ordinal()] = 3; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_178617_a[EnumFacing.SOUTH.ordinal()] = 4; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_178617_a[EnumFacing.WEST.ordinal()] = 5; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_178617_a[EnumFacing.EAST.ordinal()] = 6; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/culling/ClippingHelper.java b/src/minecraft/net/minecraft/client/renderer/culling/ClippingHelper.java new file mode 100644 index 0000000..718801a --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/culling/ClippingHelper.java @@ -0,0 +1,40 @@ +package net.minecraft.client.renderer.culling; + +public class ClippingHelper +{ + public float[][] frustum = new float[6][4]; + public float[] projectionMatrix = new float[16]; + public float[] modelviewMatrix = new float[16]; + public float[] clippingMatrix = new float[16]; + private static final String __OBFID = "CL_00000977"; + + private float dot(float[] p_dot_1_, float p_dot_2_, float p_dot_3_, float p_dot_4_) + { + return p_dot_1_[0] * p_dot_2_ + p_dot_1_[1] * p_dot_3_ + p_dot_1_[2] * p_dot_4_ + p_dot_1_[3]; + } + + /** + * Returns true if the box is inside all 6 clipping planes, otherwise returns false. + */ + public boolean isBoxInFrustum(double p_78553_1_, double p_78553_3_, double p_78553_5_, double p_78553_7_, double p_78553_9_, double p_78553_11_) + { + float f = (float)p_78553_1_; + float f1 = (float)p_78553_3_; + float f2 = (float)p_78553_5_; + float f3 = (float)p_78553_7_; + float f4 = (float)p_78553_9_; + float f5 = (float)p_78553_11_; + + for (int i = 0; i < 6; ++i) + { + float[] afloat = this.frustum[i]; + + if (this.dot(afloat, f, f1, f2) <= 0.0F && this.dot(afloat, f3, f1, f2) <= 0.0F && this.dot(afloat, f, f4, f2) <= 0.0F && this.dot(afloat, f3, f4, f2) <= 0.0F && this.dot(afloat, f, f1, f5) <= 0.0F && this.dot(afloat, f3, f1, f5) <= 0.0F && this.dot(afloat, f, f4, f5) <= 0.0F && this.dot(afloat, f3, f4, f5) <= 0.0F) + { + return false; + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/culling/ClippingHelperImpl.java b/src/minecraft/net/minecraft/client/renderer/culling/ClippingHelperImpl.java new file mode 100644 index 0000000..38e8b1b --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/culling/ClippingHelperImpl.java @@ -0,0 +1,99 @@ +package net.minecraft.client.renderer.culling; + +import java.nio.FloatBuffer; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.MathHelper; + +public class ClippingHelperImpl extends ClippingHelper +{ + private static ClippingHelperImpl instance = new ClippingHelperImpl(); + private FloatBuffer projectionMatrixBuffer = GLAllocation.createDirectFloatBuffer(16); + private FloatBuffer modelviewMatrixBuffer = GLAllocation.createDirectFloatBuffer(16); + private FloatBuffer field_78564_h = GLAllocation.createDirectFloatBuffer(16); + + /** + * Initialises the ClippingHelper object then returns an instance of it. + */ + public static ClippingHelper getInstance() + { + instance.init(); + return instance; + } + + private void normalize(float[] p_180547_1_) + { + float f = MathHelper.sqrt_float(p_180547_1_[0] * p_180547_1_[0] + p_180547_1_[1] * p_180547_1_[1] + p_180547_1_[2] * p_180547_1_[2]); + p_180547_1_[0] /= f; + p_180547_1_[1] /= f; + p_180547_1_[2] /= f; + p_180547_1_[3] /= f; + } + + public void init() + { + this.projectionMatrixBuffer.clear(); + this.modelviewMatrixBuffer.clear(); + this.field_78564_h.clear(); + GlStateManager.getFloat(2983, this.projectionMatrixBuffer); + GlStateManager.getFloat(2982, this.modelviewMatrixBuffer); + float[] afloat = this.projectionMatrix; + float[] afloat1 = this.modelviewMatrix; + this.projectionMatrixBuffer.flip().limit(16); + this.projectionMatrixBuffer.get(afloat); + this.modelviewMatrixBuffer.flip().limit(16); + this.modelviewMatrixBuffer.get(afloat1); + this.clippingMatrix[0] = afloat1[0] * afloat[0] + afloat1[1] * afloat[4] + afloat1[2] * afloat[8] + afloat1[3] * afloat[12]; + this.clippingMatrix[1] = afloat1[0] * afloat[1] + afloat1[1] * afloat[5] + afloat1[2] * afloat[9] + afloat1[3] * afloat[13]; + this.clippingMatrix[2] = afloat1[0] * afloat[2] + afloat1[1] * afloat[6] + afloat1[2] * afloat[10] + afloat1[3] * afloat[14]; + this.clippingMatrix[3] = afloat1[0] * afloat[3] + afloat1[1] * afloat[7] + afloat1[2] * afloat[11] + afloat1[3] * afloat[15]; + this.clippingMatrix[4] = afloat1[4] * afloat[0] + afloat1[5] * afloat[4] + afloat1[6] * afloat[8] + afloat1[7] * afloat[12]; + this.clippingMatrix[5] = afloat1[4] * afloat[1] + afloat1[5] * afloat[5] + afloat1[6] * afloat[9] + afloat1[7] * afloat[13]; + this.clippingMatrix[6] = afloat1[4] * afloat[2] + afloat1[5] * afloat[6] + afloat1[6] * afloat[10] + afloat1[7] * afloat[14]; + this.clippingMatrix[7] = afloat1[4] * afloat[3] + afloat1[5] * afloat[7] + afloat1[6] * afloat[11] + afloat1[7] * afloat[15]; + this.clippingMatrix[8] = afloat1[8] * afloat[0] + afloat1[9] * afloat[4] + afloat1[10] * afloat[8] + afloat1[11] * afloat[12]; + this.clippingMatrix[9] = afloat1[8] * afloat[1] + afloat1[9] * afloat[5] + afloat1[10] * afloat[9] + afloat1[11] * afloat[13]; + this.clippingMatrix[10] = afloat1[8] * afloat[2] + afloat1[9] * afloat[6] + afloat1[10] * afloat[10] + afloat1[11] * afloat[14]; + this.clippingMatrix[11] = afloat1[8] * afloat[3] + afloat1[9] * afloat[7] + afloat1[10] * afloat[11] + afloat1[11] * afloat[15]; + this.clippingMatrix[12] = afloat1[12] * afloat[0] + afloat1[13] * afloat[4] + afloat1[14] * afloat[8] + afloat1[15] * afloat[12]; + this.clippingMatrix[13] = afloat1[12] * afloat[1] + afloat1[13] * afloat[5] + afloat1[14] * afloat[9] + afloat1[15] * afloat[13]; + this.clippingMatrix[14] = afloat1[12] * afloat[2] + afloat1[13] * afloat[6] + afloat1[14] * afloat[10] + afloat1[15] * afloat[14]; + this.clippingMatrix[15] = afloat1[12] * afloat[3] + afloat1[13] * afloat[7] + afloat1[14] * afloat[11] + afloat1[15] * afloat[15]; + float[] afloat2 = this.frustum[0]; + afloat2[0] = this.clippingMatrix[3] - this.clippingMatrix[0]; + afloat2[1] = this.clippingMatrix[7] - this.clippingMatrix[4]; + afloat2[2] = this.clippingMatrix[11] - this.clippingMatrix[8]; + afloat2[3] = this.clippingMatrix[15] - this.clippingMatrix[12]; + this.normalize(afloat2); + float[] afloat3 = this.frustum[1]; + afloat3[0] = this.clippingMatrix[3] + this.clippingMatrix[0]; + afloat3[1] = this.clippingMatrix[7] + this.clippingMatrix[4]; + afloat3[2] = this.clippingMatrix[11] + this.clippingMatrix[8]; + afloat3[3] = this.clippingMatrix[15] + this.clippingMatrix[12]; + this.normalize(afloat3); + float[] afloat4 = this.frustum[2]; + afloat4[0] = this.clippingMatrix[3] + this.clippingMatrix[1]; + afloat4[1] = this.clippingMatrix[7] + this.clippingMatrix[5]; + afloat4[2] = this.clippingMatrix[11] + this.clippingMatrix[9]; + afloat4[3] = this.clippingMatrix[15] + this.clippingMatrix[13]; + this.normalize(afloat4); + float[] afloat5 = this.frustum[3]; + afloat5[0] = this.clippingMatrix[3] - this.clippingMatrix[1]; + afloat5[1] = this.clippingMatrix[7] - this.clippingMatrix[5]; + afloat5[2] = this.clippingMatrix[11] - this.clippingMatrix[9]; + afloat5[3] = this.clippingMatrix[15] - this.clippingMatrix[13]; + this.normalize(afloat5); + float[] afloat6 = this.frustum[4]; + afloat6[0] = this.clippingMatrix[3] - this.clippingMatrix[2]; + afloat6[1] = this.clippingMatrix[7] - this.clippingMatrix[6]; + afloat6[2] = this.clippingMatrix[11] - this.clippingMatrix[10]; + afloat6[3] = this.clippingMatrix[15] - this.clippingMatrix[14]; + this.normalize(afloat6); + float[] afloat7 = this.frustum[5]; + afloat7[0] = this.clippingMatrix[3] + this.clippingMatrix[2]; + afloat7[1] = this.clippingMatrix[7] + this.clippingMatrix[6]; + afloat7[2] = this.clippingMatrix[11] + this.clippingMatrix[10]; + afloat7[3] = this.clippingMatrix[15] + this.clippingMatrix[14]; + this.normalize(afloat7); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/culling/Frustum.java b/src/minecraft/net/minecraft/client/renderer/culling/Frustum.java new file mode 100644 index 0000000..658e8e1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/culling/Frustum.java @@ -0,0 +1,44 @@ +package net.minecraft.client.renderer.culling; + +import net.minecraft.util.AxisAlignedBB; + +public class Frustum implements ICamera +{ + private ClippingHelper clippingHelper; + private double xPosition; + private double yPosition; + private double zPosition; + + public Frustum() + { + this(ClippingHelperImpl.getInstance()); + } + + public Frustum(ClippingHelper p_i46196_1_) + { + this.clippingHelper = p_i46196_1_; + } + + public void setPosition(double p_78547_1_, double p_78547_3_, double p_78547_5_) + { + this.xPosition = p_78547_1_; + this.yPosition = p_78547_3_; + this.zPosition = p_78547_5_; + } + + /** + * Calls the clipping helper. Returns true if the box is inside all 6 clipping planes, otherwise returns false. + */ + public boolean isBoxInFrustum(double p_78548_1_, double p_78548_3_, double p_78548_5_, double p_78548_7_, double p_78548_9_, double p_78548_11_) + { + return this.clippingHelper.isBoxInFrustum(p_78548_1_ - this.xPosition, p_78548_3_ - this.yPosition, p_78548_5_ - this.zPosition, p_78548_7_ - this.xPosition, p_78548_9_ - this.yPosition, p_78548_11_ - this.zPosition); + } + + /** + * Returns true if the bounding box is inside all 6 clipping planes, otherwise returns false. + */ + public boolean isBoundingBoxInFrustum(AxisAlignedBB p_78546_1_) + { + return this.isBoxInFrustum(p_78546_1_.minX, p_78546_1_.minY, p_78546_1_.minZ, p_78546_1_.maxX, p_78546_1_.maxY, p_78546_1_.maxZ); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/culling/ICamera.java b/src/minecraft/net/minecraft/client/renderer/culling/ICamera.java new file mode 100644 index 0000000..39fc3d3 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/culling/ICamera.java @@ -0,0 +1,13 @@ +package net.minecraft.client.renderer.culling; + +import net.minecraft.util.AxisAlignedBB; + +public interface ICamera +{ + /** + * Returns true if the bounding box is inside all 6 clipping planes, otherwise returns false. + */ + boolean isBoundingBoxInFrustum(AxisAlignedBB p_78546_1_); + + void setPosition(double p_78547_1_, double p_78547_3_, double p_78547_5_); +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/ArmorStandRenderer.java b/src/minecraft/net/minecraft/client/renderer/entity/ArmorStandRenderer.java new file mode 100644 index 0000000..2c2c9cd --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/ArmorStandRenderer.java @@ -0,0 +1,57 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelArmorStand; +import net.minecraft.client.model.ModelArmorStandArmor; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; +import net.minecraft.client.renderer.entity.layers.LayerCustomHead; +import net.minecraft.client.renderer.entity.layers.LayerHeldItem; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.util.ResourceLocation; + +public class ArmorStandRenderer extends RendererLivingEntity +{ + /** + * A constant instance of the armor stand texture, wrapped inside a ResourceLocation wrapper. + */ + public static final ResourceLocation TEXTURE_ARMOR_STAND = new ResourceLocation("textures/entity/armorstand/wood.png"); + + public ArmorStandRenderer(RenderManager p_i46195_1_) + { + super(p_i46195_1_, new ModelArmorStand(), 0.0F); + LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) + { + protected void initArmor() + { + this.field_177189_c = new ModelArmorStandArmor(0.5F); + this.field_177186_d = new ModelArmorStandArmor(1.0F); + } + }; + this.addLayer(layerbipedarmor); + this.addLayer(new LayerHeldItem(this)); + this.addLayer(new LayerCustomHead(this.getMainModel().bipedHead)); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityArmorStand entity) + { + return TEXTURE_ARMOR_STAND; + } + + public ModelArmorStand getMainModel() + { + return (ModelArmorStand)super.getMainModel(); + } + + protected void rotateCorpse(EntityArmorStand bat, float p_77043_2_, float p_77043_3_, float partialTicks) + { + GlStateManager.rotate(180.0F - p_77043_3_, 0.0F, 1.0F, 0.0F); + } + + protected boolean canRenderName(EntityArmorStand entity) + { + return entity.getAlwaysRenderNameTag(); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/Render.java b/src/minecraft/net/minecraft/client/renderer/entity/Render.java new file mode 100644 index 0000000..06bbd1d --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/Render.java @@ -0,0 +1,512 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.culling.ICamera; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import optifine.Config; + +import org.lwjgl.opengl.GL11; + +import animeware.NightSky; +import animeware.cosmetic.CosmeticChecker; +import animeware.util.backend.WebSockets; +import animeware.util.cosmetic.AnimUtil; +import animeware.util.render.AnimatedResourceLocation; +import animeware.util.websockets.SocketClient; +import animeware.util.websockets.user.CheckName; +import shadersmod.client.Shaders; + +public abstract class Render +{ + private static final ResourceLocation shadowTextures = new ResourceLocation("textures/misc/shadow.png"); + protected final RenderManager renderManager; + protected float shadowSize; + + /** + * Determines the darkness of the object's shadow. Higher value makes a darker shadow. + */ + protected float shadowOpaque = 1.0F; + private static final String __OBFID = "CL_00000992"; + + protected Render(RenderManager renderManager) + { + this.renderManager = renderManager; + } + + public boolean shouldRender(T livingEntity, ICamera camera, double camX, double camY, double camZ) + { + AxisAlignedBB axisalignedbb = livingEntity.getEntityBoundingBox(); + + if (axisalignedbb.func_181656_b() || axisalignedbb.getAverageEdgeLength() == 0.0D) + { + axisalignedbb = new AxisAlignedBB(livingEntity.posX - 2.0D, livingEntity.posY - 2.0D, livingEntity.posZ - 2.0D, livingEntity.posX + 2.0D, livingEntity.posY + 2.0D, livingEntity.posZ + 2.0D); + } + + return livingEntity.isInRangeToRender3d(camX, camY, camZ) && (livingEntity.ignoreFrustumCheck || camera.isBoundingBoxInFrustum(axisalignedbb)); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) + { + this.renderName(entity, x, y, z); + if(entity instanceof EntityPlayerSP) { + this.renderLivingLabel(entity, Minecraft.getMinecraft().thePlayer.getDisplayName().getFormattedText(), x, y, z, 64); +} + } + + protected void renderName(T entity, double x, double y, double z) + { + if (this.canRenderName(entity)) + { + this.renderLivingLabel(entity, entity.getDisplayName().getFormattedText(), x, y, z, 64); + } + } + + protected boolean canRenderName(T entity) + { + return entity.getAlwaysRenderNameTagForRender() && entity.hasCustomName(); + } + + protected void renderOffsetLivingLabel(T entityIn, double x, double y, double z, String str, float p_177069_9_, double p_177069_10_) + { + this.renderLivingLabel(entityIn, str, x, y, z, 64); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected abstract ResourceLocation getEntityTexture(T entity); + + protected boolean bindEntityTexture(T entity) + { + ResourceLocation resourcelocation = this.getEntityTexture(entity); + + if (resourcelocation == null) + { + return false; + } + else + { + this.bindTexture(resourcelocation); + return true; + } + } + + public void bindTexture(ResourceLocation location) + { + this.renderManager.renderEngine.bindTexture(location); + } + + /** + * Renders fire on top of the entity. Args: entity, x, y, z, partialTickTime + */ + private void renderEntityOnFire(Entity entity, double x, double y, double z, float partialTicks) + { + GlStateManager.disableLighting(); + TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks(); + TextureAtlasSprite textureatlassprite = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_0"); + TextureAtlasSprite textureatlassprite1 = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_1"); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y, (float)z); + float f = entity.width * 1.4F; + GlStateManager.scale(f, f, f); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + float f1 = 0.5F; + float f2 = 0.0F; + float f3 = entity.height / f; + float f4 = (float)(entity.posY - entity.getEntityBoundingBox().minY); + GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.0F, 0.0F, -0.3F + (float)((int)f3) * 0.02F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + float f5 = 0.0F; + int i = 0; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + + while (f3 > 0.0F) + { + TextureAtlasSprite textureatlassprite2 = i % 2 == 0 ? textureatlassprite : textureatlassprite1; + this.bindTexture(TextureMap.locationBlocksTexture); + float f6 = textureatlassprite2.getMinU(); + float f7 = textureatlassprite2.getMinV(); + float f8 = textureatlassprite2.getMaxU(); + float f9 = textureatlassprite2.getMaxV(); + + if (i / 2 % 2 == 0) + { + float f10 = f8; + f8 = f6; + f6 = f10; + } + + worldrenderer.pos((double)(f1 - f2), (double)(0.0F - f4), (double)f5).tex((double)f8, (double)f9).endVertex(); + worldrenderer.pos((double)(-f1 - f2), (double)(0.0F - f4), (double)f5).tex((double)f6, (double)f9).endVertex(); + worldrenderer.pos((double)(-f1 - f2), (double)(1.4F - f4), (double)f5).tex((double)f6, (double)f7).endVertex(); + worldrenderer.pos((double)(f1 - f2), (double)(1.4F - f4), (double)f5).tex((double)f8, (double)f7).endVertex(); + f3 -= 0.45F; + f4 -= 0.45F; + f1 *= 0.9F; + f5 += 0.03F; + ++i; + } + + tessellator.draw(); + GlStateManager.popMatrix(); + GlStateManager.enableLighting(); + } + + /** + * Renders the entity shadows at the position, shadow alpha and partialTickTime. Args: entity, x, y, z, shadowAlpha, + * partialTickTime + */ + private void renderShadow(Entity entityIn, double x, double y, double z, float shadowAlpha, float partialTicks) + { + if (!Config.isShaders() || !Shaders.shouldSkipDefaultShadow) + { + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + this.renderManager.renderEngine.bindTexture(shadowTextures); + World world = this.getWorldFromRenderManager(); + GlStateManager.depthMask(false); + float f = this.shadowSize; + + if (entityIn instanceof EntityLiving) + { + EntityLiving entityliving = (EntityLiving)entityIn; + f *= entityliving.getRenderSizeModifier(); + + if (entityliving.isChild()) + { + f *= 0.5F; + } + } + + double d5 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; + double d0 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; + double d1 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; + int i = MathHelper.floor_double(d5 - (double)f); + int j = MathHelper.floor_double(d5 + (double)f); + int k = MathHelper.floor_double(d0 - (double)f); + int l = MathHelper.floor_double(d0); + int i1 = MathHelper.floor_double(d1 - (double)f); + int j1 = MathHelper.floor_double(d1 + (double)f); + double d2 = x - d5; + double d3 = y - d0; + double d4 = z - d1; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + + for (BlockPos blockpos : BlockPos.getAllInBoxMutable(new BlockPos(i, k, i1), new BlockPos(j, l, j1))) + { + Block block = world.getBlockState(blockpos.down()).getBlock(); + + if (block.getRenderType() != -1 && world.getLightFromNeighbors(blockpos) > 3) + { + this.func_180549_a(block, x, y, z, blockpos, shadowAlpha, f, d2, d3, d4); + } + } + + tessellator.draw(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + GlStateManager.depthMask(true); + } + } + + /** + * Returns the render manager's world object + */ + private World getWorldFromRenderManager() + { + return this.renderManager.worldObj; + } + + private void func_180549_a(Block blockIn, double p_180549_2_, double p_180549_4_, double p_180549_6_, BlockPos pos, float p_180549_9_, float p_180549_10_, double p_180549_11_, double p_180549_13_, double p_180549_15_) + { + if (blockIn.isFullCube()) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + double d0 = ((double)p_180549_9_ - (p_180549_4_ - ((double)pos.getY() + p_180549_13_)) / 2.0D) * 0.5D * (double)this.getWorldFromRenderManager().getLightBrightness(pos); + + if (d0 >= 0.0D) + { + if (d0 > 1.0D) + { + d0 = 1.0D; + } + + double d1 = (double)pos.getX() + blockIn.getBlockBoundsMinX() + p_180549_11_; + double d2 = (double)pos.getX() + blockIn.getBlockBoundsMaxX() + p_180549_11_; + double d3 = (double)pos.getY() + blockIn.getBlockBoundsMinY() + p_180549_13_ + 0.015625D; + double d4 = (double)pos.getZ() + blockIn.getBlockBoundsMinZ() + p_180549_15_; + double d5 = (double)pos.getZ() + blockIn.getBlockBoundsMaxZ() + p_180549_15_; + float f = (float)((p_180549_2_ - d1) / 2.0D / (double)p_180549_10_ + 0.5D); + float f1 = (float)((p_180549_2_ - d2) / 2.0D / (double)p_180549_10_ + 0.5D); + float f2 = (float)((p_180549_6_ - d4) / 2.0D / (double)p_180549_10_ + 0.5D); + float f3 = (float)((p_180549_6_ - d5) / 2.0D / (double)p_180549_10_ + 0.5D); + worldrenderer.pos(d1, d3, d4).tex((double)f, (double)f2).color(1.0F, 1.0F, 1.0F, (float)d0).endVertex(); + worldrenderer.pos(d1, d3, d5).tex((double)f, (double)f3).color(1.0F, 1.0F, 1.0F, (float)d0).endVertex(); + worldrenderer.pos(d2, d3, d5).tex((double)f1, (double)f3).color(1.0F, 1.0F, 1.0F, (float)d0).endVertex(); + worldrenderer.pos(d2, d3, d4).tex((double)f1, (double)f2).color(1.0F, 1.0F, 1.0F, (float)d0).endVertex(); + } + } + } + + /** + * Renders a white box with the bounds of the AABB translated by the offset. Args: aabb, x, y, z + */ + public static void renderOffsetAABB(AxisAlignedBB boundingBox, double x, double y, double z) + { + GlStateManager.disableTexture2D(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + worldrenderer.setTranslation(x, y, z); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_NORMAL); + worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex(); + tessellator.draw(); + worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); + GlStateManager.enableTexture2D(); + } + + /** + * Renders the entity's shadow and fire (if its on fire). Args: entity, x, y, z, yaw, partialTickTime + */ + public void doRenderShadowAndFire(Entity entityIn, double x, double y, double z, float yaw, float partialTicks) + { + if (this.renderManager.options != null) + { + if (this.renderManager.options.field_181151_V && this.shadowSize > 0.0F && !entityIn.isInvisible() && this.renderManager.isRenderShadow()) + { + double d0 = this.renderManager.getDistanceToCamera(entityIn.posX, entityIn.posY, entityIn.posZ); + float f = (float)((1.0D - d0 / 256.0D) * (double)this.shadowOpaque); + + if (f > 0.0F) + { + this.renderShadow(entityIn, x, y, z, f, partialTicks); + } + } + + if (entityIn.canRenderOnFire() && (!(entityIn instanceof EntityPlayer) || !((EntityPlayer)entityIn).isSpectator())) + { + this.renderEntityOnFire(entityIn, x, y, z, partialTicks); + } + } + } + + /** + * Returns the font renderer from the set render manager + */ + public FontRenderer getFontRendererFromRenderManager() + { + return this.renderManager.getFontRenderer(); + } + + /** + * Renders an entity's name above its head + */ + protected void renderLivingLabel(T entity, String str, double x, double y, double z, int maxDistance) + { + double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); + + if (d0 <= (double)(maxDistance * maxDistance)) + { + FontRenderer fontrenderer = this.getFontRendererFromRenderManager(); + float f = 1.6F; + float f1 = 0.016666668F * f; + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x + 0.0F, (float)y + entity.height + 0.5F, (float)z); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.scale(-f1, -f1, f1); + GlStateManager.disableLighting(); + GlStateManager.depthMask(false); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + byte b0 = 0; + + + if(Minecraft.getMinecraft().theWorld != null && Minecraft.getMinecraft().theWorld !=null && !NightSky.hasSent) { + //if(!this.hasSent) { + //System.out.println("pinging socket server"); + //CheckName.DoCheckName(); + //NightSky.hasSent = true; + //System.out.println(SocketClient.client.request("start_animeware", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":true")); + NightSky.hasSent = true; + + + + + //} + } + //if(NightSky.isUser == true) { + /*if(SocketClient.isUserResult().equals("true")) { + if(entityIn instanceof AbstractClientPlayer&& entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskyowner.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + } + }*/ + + if(entity instanceof AbstractClientPlayer && Minecraft.getMinecraft().thePlayer.getName().equals("hypnomacka") && entity.ticksExisted > 20 && entity == Minecraft.getMinecraft().thePlayer) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskyowner.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entity.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + } else if(entity instanceof AbstractClientPlayer && CosmeticChecker.isDev(entity) && entity == Minecraft.getMinecraft().thePlayer && entity.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskystaff.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entity.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + }else if(entity instanceof AbstractClientPlayer && Minecraft.getMinecraft().thePlayer.getName().equals("_Marto__") && entity.ticksExisted > 20 && entity == Minecraft.getMinecraft().thePlayer) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskyyt.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entity.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + }else if(entity instanceof AbstractClientPlayer && Minecraft.getMinecraft().thePlayer.getName().equals(Minecraft.getMinecraft().getSession().getUsername()) && entity == Minecraft.getMinecraft().thePlayer && entity.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskywhite.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entity.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + } else { + + } + //entity instanceof AbstractClientPlayer && Minecraft.getMinecraft().thePlayer.getName().equals("KnownAsR3named") && entity == Minecraft.getMinecraft().thePlayer && entity.ticksExisted > 20 + + //entity instanceof AbstractClientPlayer && Minecraft.getMinecraft().thePlayer.getName().equals("abcdegh8") || Minecraft.getMinecraft().thePlayer.getName().equals("KnownAsR3named") || Minecraft.getMinecraft().thePlayer.getName().equals("Slepica") && entity == Minecraft.getMinecraft().thePlayer && entity.ticksExisted > 20 + + /*if(entityIn instanceof AbstractClientPlayer && SocketClient.isOwner(((AbstractClientPlayer) entityIn).getGameProfile().getName()) == true && entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskyowner.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + } else if(entityIn instanceof AbstractClientPlayer && SocketClient.isDev(((AbstractClientPlayer) entityIn).getGameProfile().getName()) == true && entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskystaff.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + }else if(entityIn instanceof AbstractClientPlayer && SocketClient.isPurple(((AbstractClientPlayer) entityIn).getGameProfile().getName()) == true && entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskyyt.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + }else if(entityIn instanceof AbstractClientPlayer && SocketClient.isUser(((AbstractClientPlayer) entityIn).getGameProfile().getName()) == true && entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskywhite.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + } else { + + }*/ + /*if(entityIn instanceof AbstractClientPlayer && SocketClient.isOwner(((AbstractClientPlayer) entityIn).getGameProfile().getName()) == true && entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskyowner.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + } else if(entityIn instanceof AbstractClientPlayer && SocketClient.isDev(((AbstractClientPlayer) entityIn).getGameProfile().getName()) == true && entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskystaff.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + }else if(entityIn instanceof AbstractClientPlayer && SocketClient.isPurple(((AbstractClientPlayer) entityIn).getGameProfile().getName()) == true && entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskyyt.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + }else if(entityIn instanceof AbstractClientPlayer && SocketClient.isUser(((AbstractClientPlayer) entityIn).getGameProfile().getName()) == true && entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskywhite.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + } else { + + }*/ + /*if(Minecraft.getMinecraft().theWorld != null && Minecraft.getMinecraft().theWorld !=null) { + if(!NightSky.hasSent) { + //CheckName.DoCheckName(); + //if((boolean) SocketClient.client.request("start_animeware", Minecraft.getMinecraft().thePlayer.getGameProfile().getName() + ":true")) { + //System.out.println("pinging socket server"); + //} + + //System.out.println("pinging socket server"); + NightSky.hasSent = true; + + + } + } + if(entityIn instanceof AbstractClientPlayer && (boolean)SocketClient.isOwner(((AbstractClientPlayer) entityIn).getGameProfile().getName()) && entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskyowner.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + } else if(entityIn instanceof AbstractClientPlayer && (boolean)SocketClient.isDev(((AbstractClientPlayer) entityIn).getGameProfile().getName()) && entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskystaff.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + }else if(entityIn instanceof AbstractClientPlayer && (boolean)SocketClient.isPurple(((AbstractClientPlayer) entityIn).getGameProfile().getName()) && entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskyyt.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + }else if(entityIn instanceof AbstractClientPlayer && (boolean)SocketClient.isUser(((AbstractClientPlayer) entityIn).getGameProfile().getName()) && entityIn.ticksExisted > 20) { + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("Animeware/nightskywhite.png")); + Gui.drawModalRectWithCustomSizedTexture(-fontrenderer.getStringWidth(entityIn.getDisplayName().getFormattedText()) / 2 - 12, -2, 10, 10, 10, 10, 10, 10); + } else { + + }*/ + + + + + if (str.equals("deadmau5")) + { + b0 = -10; + } + + int i = fontrenderer.getStringWidth(str) / 2; + GlStateManager.disableTexture2D(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos((double)(-i - 1), (double)(-1 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(-i - 1), (double)(8 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(i + 1), (double)(8 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(i + 1), (double)(-1 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, b0, 553648127); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); + fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, b0, -1); + GlStateManager.enableLighting(); + GlStateManager.disableBlend(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + } + + public RenderManager getRenderManager() + { + return this.renderManager; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderArrow.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderArrow.java new file mode 100644 index 0000000..98b5aa9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderArrow.java @@ -0,0 +1,98 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class RenderArrow extends Render +{ + private static final ResourceLocation arrowTextures = new ResourceLocation("textures/entity/arrow.png"); + + public RenderArrow(RenderManager renderManagerIn) + { + super(renderManagerIn); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityArrow entity, double x, double y, double z, float entityYaw, float partialTicks) + { + this.bindEntityTexture(entity); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y, (float)z); + GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int i = 0; + float f = 0.0F; + float f1 = 0.5F; + float f2 = (float)(0 + i * 10) / 32.0F; + float f3 = (float)(5 + i * 10) / 32.0F; + float f4 = 0.0F; + float f5 = 0.15625F; + float f6 = (float)(5 + i * 10) / 32.0F; + float f7 = (float)(10 + i * 10) / 32.0F; + float f8 = 0.05625F; + GlStateManager.enableRescaleNormal(); + float f9 = (float)entity.arrowShake - partialTicks; + + if (f9 > 0.0F) + { + float f10 = -MathHelper.sin(f9 * 3.0F) * f9; + GlStateManager.rotate(f10, 0.0F, 0.0F, 1.0F); + } + + GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.scale(f8, f8, f8); + GlStateManager.translate(-4.0F, 0.0F, 0.0F); + GL11.glNormal3f(f8, 0.0F, 0.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double)f4, (double)f6).endVertex(); + worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f6).endVertex(); + worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f7).endVertex(); + worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f7).endVertex(); + tessellator.draw(); + GL11.glNormal3f(-f8, 0.0F, 0.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f6).endVertex(); + worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f6).endVertex(); + worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f7).endVertex(); + worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double)f4, (double)f7).endVertex(); + tessellator.draw(); + + for (int j = 0; j < 4; ++j) + { + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + GL11.glNormal3f(0.0F, 0.0F, f8); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(-8.0D, -2.0D, 0.0D).tex((double)f, (double)f2).endVertex(); + worldrenderer.pos(8.0D, -2.0D, 0.0D).tex((double)f1, (double)f2).endVertex(); + worldrenderer.pos(8.0D, 2.0D, 0.0D).tex((double)f1, (double)f3).endVertex(); + worldrenderer.pos(-8.0D, 2.0D, 0.0D).tex((double)f, (double)f3).endVertex(); + tessellator.draw(); + } + + GlStateManager.disableRescaleNormal(); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityArrow entity) + { + return arrowTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderBandana.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderBandana.java new file mode 100644 index 0000000..6331f34 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderBandana.java @@ -0,0 +1,84 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelPlayer; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class RenderBandana extends ModelPlayer { + private Minecraft mc; + + public ResourceLocation location; + + private ModelRenderer band1; + + private ModelRenderer band2; + + private ModelRenderer band3; + + private ModelRenderer band4; + + private boolean playerUsesFullHeight; + + public RenderBandana(float p_i46304_1_, boolean p_i46304_2_) { + super(p_i46304_1_, p_i46304_2_); + this.mc = Minecraft.getMinecraft(); + this.location = new ResourceLocation("Animeware/cosmetic/bandana.png"); + this.playerUsesFullHeight = true; + this.band1 = new ModelRenderer((ModelBase)this, 0, 0); + this.band1.addBox(-4.5F, -7.0F, -4.7F, 9, 2, 1); + this.band2 = new ModelRenderer((ModelBase)this, 0, 0); + this.band2.addBox(3.5F, -7.0F, -3.5F, 1, 2, 8); + this.band3 = new ModelRenderer((ModelBase)this, 0, 0); + this.band3.addBox(-4.5F, -7.0F, -3.5F, 1, 2, 8); + this.band4 = new ModelRenderer((ModelBase)this, 0, 0); + this.band4.addBox(-4.5F, -7.0F, 4.0F, 9, 2, 1); + } + + public void render(AbstractClientPlayer var1) { + GlStateManager.pushMatrix(); + if (var1.isSneaking()) + GL11.glTranslated(0.0D, 0.225D, 0.0D); + renderA((Entity)var1, 0.0625F); + GL11.glColor3f(1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } + + public void renderA(Entity var1, float var7) { + GlStateManager.pushMatrix(); + copyModelAngles(this.bipedHead, this.band1); + this.band1.rotationPointX = 0.0F; + this.band1.rotationPointY = 0.0F; + this.band1.render(var7); + copyModelAngles(this.bipedHead, this.band2); + this.band2.rotationPointX = 0.0F; + this.band2.rotationPointY = 0.0F; + this.band2.render(var7); + copyModelAngles(this.bipedHead, this.band3); + this.band3.rotationPointX = 0.0F; + this.band3.rotationPointY = 0.0F; + this.band3.render(var7); + copyModelAngles(this.bipedHead, this.band4); + this.band4.rotationPointX = 0.0F; + this.band4.rotationPointY = 0.0F; + this.band4.render(var7); + GlStateManager.popMatrix(); + } + public void onRenderPlayer(EntityPlayer player, float partialTick) { + if (player.equals(this.mc.thePlayer) && !player.isInvisible() && !player.isDead) + renderA(player, partialTick); + } + + private float interpolate(float yaw1, float yaw2, float percent) { + float f = (yaw1 + (yaw2 - yaw1) * percent) % 360.0F; + if (f < 0.0F) + f += 360.0F; + return f; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderBat.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderBat.java new file mode 100644 index 0000000..63bc756 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderBat.java @@ -0,0 +1,48 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBat; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class RenderBat extends RenderLiving +{ + private static final ResourceLocation batTextures = new ResourceLocation("textures/entity/bat.png"); + + public RenderBat(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelBat(), 0.25F); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityBat entity) + { + return batTextures; + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityBat entitylivingbaseIn, float partialTickTime) + { + GlStateManager.scale(0.35F, 0.35F, 0.35F); + } + + protected void rotateCorpse(EntityBat bat, float p_77043_2_, float p_77043_3_, float partialTicks) + { + if (!bat.getIsBatHanging()) + { + GlStateManager.translate(0.0F, MathHelper.cos(p_77043_2_ * 0.3F) * 0.1F, 0.0F); + } + else + { + GlStateManager.translate(0.0F, -0.1F, 0.0F); + } + + super.rotateCorpse(bat, p_77043_2_, p_77043_3_, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java new file mode 100644 index 0000000..0a6cc8d --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java @@ -0,0 +1,42 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.layers.LayerCustomHead; +import net.minecraft.client.renderer.entity.layers.LayerHeldItem; +import net.minecraft.entity.EntityLiving; +import net.minecraft.util.ResourceLocation; + +public class RenderBiped extends RenderLiving +{ + private static final ResourceLocation DEFAULT_RES_LOC = new ResourceLocation("textures/entity/steve.png"); + protected ModelBiped modelBipedMain; + protected float field_77070_b; + + public RenderBiped(RenderManager renderManagerIn, ModelBiped modelBipedIn, float shadowSize) + { + this(renderManagerIn, modelBipedIn, shadowSize, 1.0F); + this.addLayer(new LayerHeldItem(this)); + } + + public RenderBiped(RenderManager renderManagerIn, ModelBiped modelBipedIn, float shadowSize, float p_i46169_4_) + { + super(renderManagerIn, modelBipedIn, shadowSize); + this.modelBipedMain = modelBipedIn; + this.field_77070_b = p_i46169_4_; + this.addLayer(new LayerCustomHead(modelBipedIn.bipedHead)); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(T entity) + { + return DEFAULT_RES_LOC; + } + + public void transformHeldFull3DItemLayer() + { + GlStateManager.translate(0.0F, 0.1875F, 0.0F); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderBlaze.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderBlaze.java new file mode 100644 index 0000000..f815e11 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderBlaze.java @@ -0,0 +1,23 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBlaze; +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.util.ResourceLocation; + +public class RenderBlaze extends RenderLiving +{ + private static final ResourceLocation blazeTextures = new ResourceLocation("textures/entity/blaze.png"); + + public RenderBlaze(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelBlaze(), 0.5F); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityBlaze entity) + { + return blazeTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderBoat.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderBoat.java new file mode 100644 index 0000000..cf1dc1b --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderBoat.java @@ -0,0 +1,64 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelBoat; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class RenderBoat extends Render +{ + private static final ResourceLocation boatTextures = new ResourceLocation("textures/entity/boat.png"); + + /** instance of ModelBoat for rendering */ + protected ModelBase modelBoat = new ModelBoat(); + + public RenderBoat(RenderManager renderManagerIn) + { + super(renderManagerIn); + this.shadowSize = 0.5F; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityBoat entity, double x, double y, double z, float entityYaw, float partialTicks) + { + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y + 0.25F, (float)z); + GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F); + float f = (float)entity.getTimeSinceHit() - partialTicks; + float f1 = entity.getDamageTaken() - partialTicks; + + if (f1 < 0.0F) + { + f1 = 0.0F; + } + + if (f > 0.0F) + { + GlStateManager.rotate(MathHelper.sin(f) * f * f1 / 10.0F * (float)entity.getForwardDirection(), 1.0F, 0.0F, 0.0F); + } + + float f2 = 0.75F; + GlStateManager.scale(f2, f2, f2); + GlStateManager.scale(1.0F / f2, 1.0F / f2, 1.0F / f2); + this.bindEntityTexture(entity); + GlStateManager.scale(-1.0F, -1.0F, 1.0F); + this.modelBoat.render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityBoat entity) + { + return boatTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderCaveSpider.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderCaveSpider.java new file mode 100644 index 0000000..abc90c5 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderCaveSpider.java @@ -0,0 +1,33 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.monster.EntityCaveSpider; +import net.minecraft.util.ResourceLocation; + +public class RenderCaveSpider extends RenderSpider +{ + private static final ResourceLocation caveSpiderTextures = new ResourceLocation("textures/entity/spider/cave_spider.png"); + + public RenderCaveSpider(RenderManager renderManagerIn) + { + super(renderManagerIn); + this.shadowSize *= 0.7F; + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityCaveSpider entitylivingbaseIn, float partialTickTime) + { + GlStateManager.scale(0.7F, 0.7F, 0.7F); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityCaveSpider entity) + { + return caveSpiderTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderChicken.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderChicken.java new file mode 100644 index 0000000..bbcf95d --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderChicken.java @@ -0,0 +1,34 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class RenderChicken extends RenderLiving +{ + private static final ResourceLocation chickenTextures = new ResourceLocation("textures/entity/chicken.png"); + + public RenderChicken(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn, modelBaseIn, shadowSizeIn); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityChicken entity) + { + return chickenTextures; + } + + /** + * Defines what float the third param in setRotationAngles of ModelBase is + */ + protected float handleRotationFloat(EntityChicken livingBase, float partialTicks) + { + float f = livingBase.field_70888_h + (livingBase.wingRotation - livingBase.field_70888_h) * partialTicks; + float f1 = livingBase.field_70884_g + (livingBase.destPos - livingBase.field_70884_g) * partialTicks; + return (MathHelper.sin(f) + 1.0F) * f1; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderCow.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderCow.java new file mode 100644 index 0000000..f46e1e9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderCow.java @@ -0,0 +1,23 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.entity.passive.EntityCow; +import net.minecraft.util.ResourceLocation; + +public class RenderCow extends RenderLiving +{ + private static final ResourceLocation cowTextures = new ResourceLocation("textures/entity/cow/cow.png"); + + public RenderCow(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn, modelBaseIn, shadowSizeIn); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityCow entity) + { + return cowTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderCreeper.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderCreeper.java new file mode 100644 index 0000000..3b13245 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderCreeper.java @@ -0,0 +1,62 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelCreeper; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.layers.LayerCreeperCharge; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class RenderCreeper extends RenderLiving +{ + private static final ResourceLocation creeperTextures = new ResourceLocation("textures/entity/creeper/creeper.png"); + + public RenderCreeper(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelCreeper(), 0.5F); + this.addLayer(new LayerCreeperCharge(this)); + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityCreeper entitylivingbaseIn, float partialTickTime) + { + float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime); + float f1 = 1.0F + MathHelper.sin(f * 100.0F) * f * 0.01F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + f = f * f; + f = f * f; + float f2 = (1.0F + f * 0.4F) * f1; + float f3 = (1.0F + f * 0.1F) / f1; + GlStateManager.scale(f2, f3, f2); + } + + /** + * Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime + */ + protected int getColorMultiplier(EntityCreeper entitylivingbaseIn, float lightBrightness, float partialTickTime) + { + float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime); + + if ((int)(f * 10.0F) % 2 == 0) + { + return 0; + } + else + { + int i = (int)(f * 0.2F * 255.0F); + i = MathHelper.clamp_int(i, 0, 255); + return i << 24 | 16777215; + } + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityCreeper entity) + { + return creeperTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderDragon.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderDragon.java new file mode 100644 index 0000000..b97f003 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderDragon.java @@ -0,0 +1,163 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelDragon; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.layers.LayerEnderDragonDeath; +import net.minecraft.client.renderer.entity.layers.LayerEnderDragonEyes; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.boss.BossStatus; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class RenderDragon extends RenderLiving +{ + private static final ResourceLocation enderDragonCrystalBeamTextures = new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png"); + private static final ResourceLocation enderDragonExplodingTextures = new ResourceLocation("textures/entity/enderdragon/dragon_exploding.png"); + private static final ResourceLocation enderDragonTextures = new ResourceLocation("textures/entity/enderdragon/dragon.png"); + + /** An instance of the dragon model in RenderDragon */ + protected ModelDragon modelDragon; + + public RenderDragon(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelDragon(0.0F), 0.5F); + this.modelDragon = (ModelDragon)this.mainModel; + this.addLayer(new LayerEnderDragonEyes(this)); + //this.addLayer((LayerRenderer)LAYER_TYPE(this)); + this.addLayer(new LayerEnderDragonDeath()); + } + + + + + protected void rotateCorpse(EntityDragon bat, float p_77043_2_, float p_77043_3_, float partialTicks) + { + float f = (float)bat.getMovementOffsets(7, partialTicks)[0]; + float f1 = (float)(bat.getMovementOffsets(5, partialTicks)[1] - bat.getMovementOffsets(10, partialTicks)[1]); + GlStateManager.rotate(-f, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f1 * 10.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(0.0F, 0.0F, 1.0F); + + if (bat.deathTime > 0) + { + float f2 = ((float)bat.deathTime + partialTicks - 1.0F) / 20.0F * 1.6F; + f2 = MathHelper.sqrt_float(f2); + + if (f2 > 1.0F) + { + f2 = 1.0F; + } + + GlStateManager.rotate(f2 * this.getDeathMaxRotation(bat), 0.0F, 0.0F, 1.0F); + } + } + + /** + * Renders the model in RenderLiving + */ + protected void renderModel(EntityDragon entitylivingbaseIn, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_) + { + if (entitylivingbaseIn.deathTicks > 0) + { + float f = (float)entitylivingbaseIn.deathTicks / 200.0F; + GlStateManager.depthFunc(515); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, f); + this.bindTexture(enderDragonExplodingTextures); + this.mainModel.render(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.depthFunc(514); + } + + this.bindEntityTexture(entitylivingbaseIn); + this.mainModel.render(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + + if (entitylivingbaseIn.hurtTime > 0) + { + GlStateManager.depthFunc(514); + GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + GlStateManager.color(1.0F, 0.0F, 0.0F, 0.5F); + this.mainModel.render(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + GlStateManager.depthFunc(515); + } + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityDragon entity, double x, double y, double z, float entityYaw, float partialTicks) + { + BossStatus.setBossStatus(entity, false); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + + if (entity.healingEnderCrystal != null) + { + this.drawRechargeRay(entity, x, y, z, partialTicks); + } + } + + /** + * Draws the ray from the dragon to it's crystal + */ + protected void drawRechargeRay(EntityDragon dragon, double p_180574_2_, double p_180574_4_, double p_180574_6_, float p_180574_8_) + { + float f = (float)dragon.healingEnderCrystal.innerRotation + p_180574_8_; + float f1 = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F; + f1 = (f1 * f1 + f1) * 0.2F; + float f2 = (float)(dragon.healingEnderCrystal.posX - dragon.posX - (dragon.prevPosX - dragon.posX) * (double)(1.0F - p_180574_8_)); + float f3 = (float)((double)f1 + dragon.healingEnderCrystal.posY - 1.0D - dragon.posY - (dragon.prevPosY - dragon.posY) * (double)(1.0F - p_180574_8_)); + float f4 = (float)(dragon.healingEnderCrystal.posZ - dragon.posZ - (dragon.prevPosZ - dragon.posZ) * (double)(1.0F - p_180574_8_)); + float f5 = MathHelper.sqrt_float(f2 * f2 + f4 * f4); + float f6 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)p_180574_2_, (float)p_180574_4_ + 2.0F, (float)p_180574_6_); + GlStateManager.rotate((float)(-Math.atan2((double)f4, (double)f2)) * 180.0F / (float)Math.PI - 90.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate((float)(-Math.atan2((double)f5, (double)f3)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableCull(); + this.bindTexture(enderDragonCrystalBeamTextures); + GlStateManager.shadeModel(7425); + float f7 = 0.0F - ((float)dragon.ticksExisted + p_180574_8_) * 0.01F; + float f8 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4) / 32.0F - ((float)dragon.ticksExisted + p_180574_8_) * 0.01F; + worldrenderer.begin(5, DefaultVertexFormats.POSITION_TEX_COLOR); + int i = 8; + + for (int j = 0; j <= 8; ++j) + { + float f9 = MathHelper.sin((float)(j % 8) * (float)Math.PI * 2.0F / 8.0F) * 0.75F; + float f10 = MathHelper.cos((float)(j % 8) * (float)Math.PI * 2.0F / 8.0F) * 0.75F; + float f11 = (float)(j % 8) * 1.0F / 8.0F; + worldrenderer.pos((double)(f9 * 0.2F), (double)(f10 * 0.2F), 0.0D).tex((double)f11, (double)f8).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)f9, (double)f10, (double)f6).tex((double)f11, (double)f7).color(255, 255, 255, 255).endVertex(); + } + + tessellator.draw(); + GlStateManager.enableCull(); + GlStateManager.shadeModel(7424); + RenderHelper.enableStandardItemLighting(); + GlStateManager.popMatrix(); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityDragon entity) + { + return enderDragonTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderEnderman.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderEnderman.java new file mode 100644 index 0000000..2983e54 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderEnderman.java @@ -0,0 +1,57 @@ +package net.minecraft.client.renderer.entity; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.client.model.ModelEnderman; +import net.minecraft.client.renderer.entity.layers.LayerEndermanEyes; +import net.minecraft.client.renderer.entity.layers.LayerHeldBlock; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.util.ResourceLocation; + +public class RenderEnderman extends RenderLiving +{ + private static final ResourceLocation endermanTextures = new ResourceLocation("textures/entity/enderman/enderman.png"); + + /** The model of the enderman */ + private ModelEnderman endermanModel; + private Random rnd = new Random(); + + public RenderEnderman(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelEnderman(0.0F), 0.5F); + this.endermanModel = (ModelEnderman)super.mainModel; + this.addLayer(new LayerEndermanEyes(this)); + this.addLayer(new LayerHeldBlock(this)); + } + + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityEnderman entity, double x, double y, double z, float entityYaw, float partialTicks) + { + this.endermanModel.isCarrying = entity.getHeldBlockState().getBlock().getMaterial() != Material.air; + this.endermanModel.isAttacking = entity.isScreaming(); + + if (entity.isScreaming()) + { + double d0 = 0.02D; + x += this.rnd.nextGaussian() * d0; + z += this.rnd.nextGaussian() * d0; + } + + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityEnderman entity) + { + return endermanTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderEndermite.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderEndermite.java new file mode 100644 index 0000000..6b120f9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderEndermite.java @@ -0,0 +1,28 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelEnderMite; +import net.minecraft.entity.monster.EntityEndermite; +import net.minecraft.util.ResourceLocation; + +public class RenderEndermite extends RenderLiving +{ + private static final ResourceLocation ENDERMITE_TEXTURES = new ResourceLocation("textures/entity/endermite.png"); + + public RenderEndermite(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelEnderMite(), 0.3F); + } + + protected float getDeathMaxRotation(EntityEndermite entityLivingBaseIn) + { + return 180.0F; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityEndermite entity) + { + return ENDERMITE_TEXTURES; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderEntity.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderEntity.java new file mode 100644 index 0000000..7f4ea2c --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderEntity.java @@ -0,0 +1,35 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.util.ResourceLocation; + +public class RenderEntity extends Render +{ + public RenderEntity(RenderManager renderManagerIn) + { + super(renderManagerIn); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) + { + GlStateManager.pushMatrix(); + renderOffsetAABB(entity.getEntityBoundingBox(), x - entity.lastTickPosX, y - entity.lastTickPosY, z - entity.lastTickPosZ); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity entity) + { + return null; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java new file mode 100644 index 0000000..a1d9c72 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java @@ -0,0 +1,217 @@ +package net.minecraft.client.renderer.entity; + +import java.util.Random; + +import animeware.cosmetic.Booleans; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class RenderEntityItem extends Render +{ + private final RenderItem itemRenderer; + private Random field_177079_e = new Random(); + + public RenderEntityItem(RenderManager renderManagerIn, RenderItem p_i46167_2_) + { + super(renderManagerIn); + this.itemRenderer = p_i46167_2_; + this.shadowSize = 0.15F; + this.shadowOpaque = 0.75F; + } + + private int func_177077_a(EntityItem itemIn, double p_177077_2_, double p_177077_4_, double p_177077_6_, float p_177077_8_, IBakedModel p_177077_9_) + { + if(Booleans.itemphys) { + ItemStack itemstack = itemIn.getEntityItem(); + Item item = itemstack.getItem(); + + if (item == null) + { + return 0; + } + else + { + + boolean flag = p_177077_9_.isGui3d(); + int i = this.func_177078_a(itemstack); + float f = 0.25F; + + float f1 = -0.125f; //MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F; + if(!flag) f1 = -0.175f; + + float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y; + GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); + + if (flag || this.renderManager.options != null) + { + float f3 = (((float)itemIn.getAge() + p_177077_8_) / 20.0F + itemIn.hoverStart) * (180F / (float)Math.PI); + //GlStateManager.rotate(f3, 0.0F, 1.0F, 0.0F); + } + + if (!flag) + { + float f6 = -0.0F * (float)(i - 1) * 0.5F; + float f4 = -0.0F * (float)(i - 1) * 0.5F; + float f5 = -0.046875F * (float)(i - 1) * 0.5F; + //GlStateManager.translate(f6, f4, f5); + + if(itemIn.onGround) GlStateManager.rotate(180, 0.0f, 1.0f, 1.0f); + + } + + float speed = 10; + if(!itemIn.onGround) { + float rotAmount = ((float)itemIn.getAge() * speed) % 360; + GlStateManager.rotate(rotAmount, 1f, 0f, 1f); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + return i; + } + } else { + ItemStack itemstack = itemIn.getEntityItem(); + Item item = itemstack.getItem(); + + if (item == null) + { + return 0; + } + else + { + boolean flag = p_177077_9_.isGui3d(); + int i = this.func_177078_a(itemstack); + float f = 0.25F; + float f1 = MathHelper.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F; + float f2 = p_177077_9_.getItemCameraTransforms().getTransform(ItemCameraTransforms.TransformType.GROUND).scale.y; + GlStateManager.translate((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_); + + if (flag || this.renderManager.options != null) + { + float f3 = (((float)itemIn.getAge() + p_177077_8_) / 20.0F + itemIn.hoverStart) * (180F / (float)Math.PI); + GlStateManager.rotate(f3, 0.0F, 1.0F, 0.0F); + } + + if (!flag) + { + float f6 = -0.0F * (float)(i - 1) * 0.5F; + float f4 = -0.0F * (float)(i - 1) * 0.5F; + float f5 = -0.046875F * (float)(i - 1) * 0.5F; + GlStateManager.translate(f6, f4, f5); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + return i; + } + } + } + + private int func_177078_a(ItemStack stack) + { + int i = 1; + + if (stack.stackSize > 48) + { + i = 5; + } + else if (stack.stackSize > 32) + { + i = 4; + } + else if (stack.stackSize > 16) + { + i = 3; + } + else if (stack.stackSize > 1) + { + i = 2; + } + + return i; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityItem entity, double x, double y, double z, float entityYaw, float partialTicks) + { + ItemStack itemstack = entity.getEntityItem(); + this.field_177079_e.setSeed(187L); + boolean flag = false; + + if (this.bindEntityTexture(entity)) + { + this.renderManager.renderEngine.getTexture(this.getEntityTexture(entity)).setBlurMipmap(false, false); + flag = true; + } + + GlStateManager.enableRescaleNormal(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.pushMatrix(); + IBakedModel ibakedmodel = this.itemRenderer.getItemModelMesher().getItemModel(itemstack); + int i = this.func_177077_a(entity, x, y, z, partialTicks, ibakedmodel); + + for (int j = 0; j < i; ++j) + { + if (ibakedmodel.isGui3d()) + { + GlStateManager.pushMatrix(); + + if (j > 0) + { + float f = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f1 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + float f2 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F; + GlStateManager.translate(f, f1, f2); + } + + GlStateManager.scale(0.5F, 0.5F, 0.5F); + ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); + this.itemRenderer.renderItem(itemstack, ibakedmodel); + GlStateManager.popMatrix(); + } + else + { + GlStateManager.pushMatrix(); + ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GROUND); + this.itemRenderer.renderItem(itemstack, ibakedmodel); + GlStateManager.popMatrix(); + float f3 = ibakedmodel.getItemCameraTransforms().ground.scale.x; + float f4 = ibakedmodel.getItemCameraTransforms().ground.scale.y; + float f5 = ibakedmodel.getItemCameraTransforms().ground.scale.z; + GlStateManager.translate(0.0F * f3, 0.0F * f4, 0.046875F * f5); + } + } + + GlStateManager.popMatrix(); + GlStateManager.disableRescaleNormal(); + GlStateManager.disableBlend(); + this.bindEntityTexture(entity); + + if (flag) + { + this.renderManager.renderEngine.getTexture(this.getEntityTexture(entity)).restoreLastBlurMipmap(); + } + + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityItem entity) + { + return TextureMap.locationBlocksTexture; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderFallingBlock.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderFallingBlock.java new file mode 100644 index 0000000..8583d2a --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderFallingBlock.java @@ -0,0 +1,76 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class RenderFallingBlock extends Render +{ + public RenderFallingBlock(RenderManager renderManagerIn) + { + super(renderManagerIn); + this.shadowSize = 0.5F; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityFallingBlock entity, double x, double y, double z, float entityYaw, float partialTicks) + { + if (entity.getBlock() != null) + { + this.bindTexture(TextureMap.locationBlocksTexture); + IBlockState iblockstate = entity.getBlock(); + Block block = iblockstate.getBlock(); + BlockPos blockpos = new BlockPos(entity); + World world = entity.getWorldObj(); + + if (iblockstate != world.getBlockState(blockpos) && block.getRenderType() != -1) + { + if (block.getRenderType() == 3) + { + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y, (float)z); + GlStateManager.disableLighting(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.BLOCK); + int i = blockpos.getX(); + int j = blockpos.getY(); + int k = blockpos.getZ(); + worldrenderer.setTranslation((double)((float)(-i) - 0.5F), (double)(-j), (double)((float)(-k) - 0.5F)); + BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + IBakedModel ibakedmodel = blockrendererdispatcher.getModelFromBlockState(iblockstate, world, (BlockPos)null); + blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, iblockstate, blockpos, worldrenderer, false); + worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); + tessellator.draw(); + GlStateManager.enableLighting(); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + } + } + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityFallingBlock entity) + { + return TextureMap.locationBlocksTexture; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderFireball.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderFireball.java new file mode 100644 index 0000000..841a243 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderFireball.java @@ -0,0 +1,67 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.projectile.EntityFireball; +import net.minecraft.init.Items; +import net.minecraft.util.ResourceLocation; + +public class RenderFireball extends Render +{ + private float scale; + + public RenderFireball(RenderManager renderManagerIn, float scaleIn) + { + super(renderManagerIn); + this.scale = scaleIn; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityFireball entity, double x, double y, double z, float entityYaw, float partialTicks) + { + GlStateManager.pushMatrix(); + this.bindEntityTexture(entity); + GlStateManager.translate((float)x, (float)y, (float)z); + GlStateManager.enableRescaleNormal(); + GlStateManager.scale(this.scale, this.scale, this.scale); + TextureAtlasSprite textureatlassprite = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getParticleIcon(Items.fire_charge); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + float f = textureatlassprite.getMinU(); + float f1 = textureatlassprite.getMaxU(); + float f2 = textureatlassprite.getMinV(); + float f3 = textureatlassprite.getMaxV(); + float f4 = 1.0F; + float f5 = 0.5F; + float f6 = 0.25F; + GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL); + worldrenderer.pos(-0.5D, -0.25D, 0.0D).tex((double)f, (double)f3).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(0.5D, -0.25D, 0.0D).tex((double)f1, (double)f3).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(0.5D, 0.75D, 0.0D).tex((double)f1, (double)f2).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(-0.5D, 0.75D, 0.0D).tex((double)f, (double)f2).normal(0.0F, 1.0F, 0.0F).endVertex(); + tessellator.draw(); + GlStateManager.disableRescaleNormal(); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityFireball entity) + { + return TextureMap.locationBlocksTexture; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderFish.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderFish.java new file mode 100644 index 0000000..d62069c --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderFish.java @@ -0,0 +1,115 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.projectile.EntityFishHook; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; + +public class RenderFish extends Render +{ + private static final ResourceLocation FISH_PARTICLES = new ResourceLocation("textures/particle/particles.png"); + + public RenderFish(RenderManager renderManagerIn) + { + super(renderManagerIn); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityFishHook entity, double x, double y, double z, float entityYaw, float partialTicks) + { + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y, (float)z); + GlStateManager.enableRescaleNormal(); + GlStateManager.scale(0.5F, 0.5F, 0.5F); + this.bindEntityTexture(entity); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int i = 1; + int j = 2; + float f = 0.0625F; + float f1 = 0.125F; + float f2 = 0.125F; + float f3 = 0.1875F; + float f4 = 1.0F; + float f5 = 0.5F; + float f6 = 0.5F; + GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL); + worldrenderer.pos(-0.5D, -0.5D, 0.0D).tex(0.0625D, 0.1875D).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(0.5D, -0.5D, 0.0D).tex(0.125D, 0.1875D).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(0.5D, 0.5D, 0.0D).tex(0.125D, 0.125D).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos(-0.5D, 0.5D, 0.0D).tex(0.0625D, 0.125D).normal(0.0F, 1.0F, 0.0F).endVertex(); + tessellator.draw(); + GlStateManager.disableRescaleNormal(); + GlStateManager.popMatrix(); + + if (entity.angler != null) + { + float f7 = entity.angler.getSwingProgress(partialTicks); + float f8 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float)Math.PI); + Vec3 vec3 = new Vec3(-0.36D, 0.03D, 0.35D); + vec3 = vec3.rotatePitch(-(entity.angler.prevRotationPitch + (entity.angler.rotationPitch - entity.angler.prevRotationPitch) * partialTicks) * (float)Math.PI / 180.0F); + vec3 = vec3.rotateYaw(-(entity.angler.prevRotationYaw + (entity.angler.rotationYaw - entity.angler.prevRotationYaw) * partialTicks) * (float)Math.PI / 180.0F); + vec3 = vec3.rotateYaw(f8 * 0.5F); + vec3 = vec3.rotatePitch(-f8 * 0.7F); + double d0 = entity.angler.prevPosX + (entity.angler.posX - entity.angler.prevPosX) * (double)partialTicks + vec3.xCoord; + double d1 = entity.angler.prevPosY + (entity.angler.posY - entity.angler.prevPosY) * (double)partialTicks + vec3.yCoord; + double d2 = entity.angler.prevPosZ + (entity.angler.posZ - entity.angler.prevPosZ) * (double)partialTicks + vec3.zCoord; + double d3 = (double)entity.angler.getEyeHeight(); + + if (this.renderManager.options != null && this.renderManager.options.thirdPersonView > 0 || entity.angler != Minecraft.getMinecraft().thePlayer) + { + float f9 = (entity.angler.prevRenderYawOffset + (entity.angler.renderYawOffset - entity.angler.prevRenderYawOffset) * partialTicks) * (float)Math.PI / 180.0F; + double d4 = (double)MathHelper.sin(f9); + double d6 = (double)MathHelper.cos(f9); + double d8 = 0.35D; + double d10 = 0.8D; + d0 = entity.angler.prevPosX + (entity.angler.posX - entity.angler.prevPosX) * (double)partialTicks - d6 * 0.35D - d4 * 0.8D; + d1 = entity.angler.prevPosY + d3 + (entity.angler.posY - entity.angler.prevPosY) * (double)partialTicks - 0.45D; + d2 = entity.angler.prevPosZ + (entity.angler.posZ - entity.angler.prevPosZ) * (double)partialTicks - d4 * 0.35D + d6 * 0.8D; + d3 = entity.angler.isSneaking() ? -0.1875D : 0.0D; + } + + double d13 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double)partialTicks; + double d5 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double)partialTicks + 0.25D; + double d7 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)partialTicks; + double d9 = (double)((float)(d0 - d13)); + double d11 = (double)((float)(d1 - d5)) + d3; + double d12 = (double)((float)(d2 - d7)); + GlStateManager.disableTexture2D(); + GlStateManager.disableLighting(); + worldrenderer.begin(3, DefaultVertexFormats.POSITION_COLOR); + int k = 16; + + for (int l = 0; l <= 16; ++l) + { + float f10 = (float)l / 16.0F; + worldrenderer.pos(x + d9 * (double)f10, y + d11 * (double)(f10 * f10 + f10) * 0.5D + 0.25D, z + d12 * (double)f10).color(0, 0, 0, 255).endVertex(); + } + + tessellator.draw(); + GlStateManager.enableLighting(); + GlStateManager.enableTexture2D(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityFishHook entity) + { + return FISH_PARTICLES; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderGhast.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderGhast.java new file mode 100644 index 0000000..e230651 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderGhast.java @@ -0,0 +1,38 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelGhast; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.util.ResourceLocation; + +public class RenderGhast extends RenderLiving +{ + private static final ResourceLocation ghastTextures = new ResourceLocation("textures/entity/ghast/ghast.png"); + private static final ResourceLocation ghastShootingTextures = new ResourceLocation("textures/entity/ghast/ghast_shooting.png"); + + public RenderGhast(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelGhast(), 0.5F); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityGhast entity) + { + return entity.isAttacking() ? ghastShootingTextures : ghastTextures; + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityGhast entitylivingbaseIn, float partialTickTime) + { + float f = 1.0F; + float f1 = (8.0F + f) / 2.0F; + float f2 = (8.0F + 1.0F / f) / 2.0F; + GlStateManager.scale(f2, f1, f2); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderGiantZombie.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderGiantZombie.java new file mode 100644 index 0000000..4ea5fd2 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderGiantZombie.java @@ -0,0 +1,54 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelZombie; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; +import net.minecraft.client.renderer.entity.layers.LayerHeldItem; +import net.minecraft.entity.monster.EntityGiantZombie; +import net.minecraft.util.ResourceLocation; + +public class RenderGiantZombie extends RenderLiving +{ + private static final ResourceLocation zombieTextures = new ResourceLocation("textures/entity/zombie/zombie.png"); + + /** Scale of the model to use */ + private float scale; + + public RenderGiantZombie(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn, float scaleIn) + { + super(renderManagerIn, modelBaseIn, shadowSizeIn * scaleIn); + this.scale = scaleIn; + this.addLayer(new LayerHeldItem(this)); + this.addLayer(new LayerBipedArmor(this) + { + protected void initArmor() + { + this.field_177189_c = new ModelZombie(0.5F, true); + this.field_177186_d = new ModelZombie(1.0F, true); + } + }); + } + + public void transformHeldFull3DItemLayer() + { + GlStateManager.translate(0.0F, 0.1875F, 0.0F); + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityGiantZombie entitylivingbaseIn, float partialTickTime) + { + GlStateManager.scale(this.scale, this.scale, this.scale); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityGiantZombie entity) + { + return zombieTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderGuardian.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderGuardian.java new file mode 100644 index 0000000..e522372 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderGuardian.java @@ -0,0 +1,185 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelGuardian; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.culling.ICamera; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityGuardian; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import org.lwjgl.opengl.GL11; + +public class RenderGuardian extends RenderLiving +{ + private static final ResourceLocation GUARDIAN_TEXTURE = new ResourceLocation("textures/entity/guardian.png"); + private static final ResourceLocation GUARDIAN_ELDER_TEXTURE = new ResourceLocation("textures/entity/guardian_elder.png"); + private static final ResourceLocation GUARDIAN_BEAM_TEXTURE = new ResourceLocation("textures/entity/guardian_beam.png"); + int field_177115_a; + + public RenderGuardian(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelGuardian(), 0.5F); + this.field_177115_a = ((ModelGuardian)this.mainModel).func_178706_a(); + } + + public boolean shouldRender(EntityGuardian livingEntity, ICamera camera, double camX, double camY, double camZ) + { + if (super.shouldRender(livingEntity, camera, camX, camY, camZ)) + { + return true; + } + else + { + if (livingEntity.hasTargetedEntity()) + { + EntityLivingBase entitylivingbase = livingEntity.getTargetedEntity(); + + if (entitylivingbase != null) + { + Vec3 vec3 = this.func_177110_a(entitylivingbase, (double)entitylivingbase.height * 0.5D, 1.0F); + Vec3 vec31 = this.func_177110_a(livingEntity, (double)livingEntity.getEyeHeight(), 1.0F); + + if (camera.isBoundingBoxInFrustum(AxisAlignedBB.fromBounds(vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord, vec3.zCoord))) + { + return true; + } + } + } + + return false; + } + } + + private Vec3 func_177110_a(EntityLivingBase entityLivingBaseIn, double p_177110_2_, float p_177110_4_) + { + double d0 = entityLivingBaseIn.lastTickPosX + (entityLivingBaseIn.posX - entityLivingBaseIn.lastTickPosX) * (double)p_177110_4_; + double d1 = p_177110_2_ + entityLivingBaseIn.lastTickPosY + (entityLivingBaseIn.posY - entityLivingBaseIn.lastTickPosY) * (double)p_177110_4_; + double d2 = entityLivingBaseIn.lastTickPosZ + (entityLivingBaseIn.posZ - entityLivingBaseIn.lastTickPosZ) * (double)p_177110_4_; + return new Vec3(d0, d1, d2); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityGuardian entity, double x, double y, double z, float entityYaw, float partialTicks) + { + if (this.field_177115_a != ((ModelGuardian)this.mainModel).func_178706_a()) + { + this.mainModel = new ModelGuardian(); + this.field_177115_a = ((ModelGuardian)this.mainModel).func_178706_a(); + } + + super.doRender(entity, x, y, z, entityYaw, partialTicks); + EntityLivingBase entitylivingbase = entity.getTargetedEntity(); + + if (entitylivingbase != null) + { + float f = entity.func_175477_p(partialTicks); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.bindTexture(GUARDIAN_BEAM_TEXTURE); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); + GlStateManager.disableLighting(); + GlStateManager.disableCull(); + GlStateManager.disableBlend(); + GlStateManager.depthMask(true); + float f1 = 240.0F; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f1, f1); + GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0); + float f2 = (float)entity.worldObj.getTotalWorldTime() + partialTicks; + float f3 = f2 * 0.5F % 1.0F; + float f4 = entity.getEyeHeight(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y + f4, (float)z); + Vec3 vec3 = this.func_177110_a(entitylivingbase, (double)entitylivingbase.height * 0.5D, partialTicks); + Vec3 vec31 = this.func_177110_a(entity, (double)f4, partialTicks); + Vec3 vec32 = vec3.subtract(vec31); + double d0 = vec32.lengthVector() + 1.0D; + vec32 = vec32.normalize(); + float f5 = (float)Math.acos(vec32.yCoord); + float f6 = (float)Math.atan2(vec32.zCoord, vec32.xCoord); + GlStateManager.rotate((((float)Math.PI / 2F) + -f6) * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f5 * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + int i = 1; + double d1 = (double)f2 * 0.05D * (1.0D - (double)(i & 1) * 2.5D); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + float f7 = f * f; + int j = 64 + (int)(f7 * 240.0F); + int k = 32 + (int)(f7 * 192.0F); + int l = 128 - (int)(f7 * 64.0F); + double d2 = (double)i * 0.2D; + double d3 = d2 * 1.41D; + double d4 = 0.0D + Math.cos(d1 + 2.356194490192345D) * d3; + double d5 = 0.0D + Math.sin(d1 + 2.356194490192345D) * d3; + double d6 = 0.0D + Math.cos(d1 + (Math.PI / 4D)) * d3; + double d7 = 0.0D + Math.sin(d1 + (Math.PI / 4D)) * d3; + double d8 = 0.0D + Math.cos(d1 + 3.9269908169872414D) * d3; + double d9 = 0.0D + Math.sin(d1 + 3.9269908169872414D) * d3; + double d10 = 0.0D + Math.cos(d1 + 5.497787143782138D) * d3; + double d11 = 0.0D + Math.sin(d1 + 5.497787143782138D) * d3; + double d12 = 0.0D + Math.cos(d1 + Math.PI) * d2; + double d13 = 0.0D + Math.sin(d1 + Math.PI) * d2; + double d14 = 0.0D + Math.cos(d1 + 0.0D) * d2; + double d15 = 0.0D + Math.sin(d1 + 0.0D) * d2; + double d16 = 0.0D + Math.cos(d1 + (Math.PI / 2D)) * d2; + double d17 = 0.0D + Math.sin(d1 + (Math.PI / 2D)) * d2; + double d18 = 0.0D + Math.cos(d1 + (Math.PI * 3D / 2D)) * d2; + double d19 = 0.0D + Math.sin(d1 + (Math.PI * 3D / 2D)) * d2; + double d20 = 0.0D; + double d21 = 0.4999D; + double d22 = (double)(-1.0F + f3); + double d23 = d0 * (0.5D / d2) + d22; + worldrenderer.pos(d12, d0, d13).tex(0.4999D, d23).color(j, k, l, 255).endVertex(); + worldrenderer.pos(d12, 0.0D, d13).tex(0.4999D, d22).color(j, k, l, 255).endVertex(); + worldrenderer.pos(d14, 0.0D, d15).tex(0.0D, d22).color(j, k, l, 255).endVertex(); + worldrenderer.pos(d14, d0, d15).tex(0.0D, d23).color(j, k, l, 255).endVertex(); + worldrenderer.pos(d16, d0, d17).tex(0.4999D, d23).color(j, k, l, 255).endVertex(); + worldrenderer.pos(d16, 0.0D, d17).tex(0.4999D, d22).color(j, k, l, 255).endVertex(); + worldrenderer.pos(d18, 0.0D, d19).tex(0.0D, d22).color(j, k, l, 255).endVertex(); + worldrenderer.pos(d18, d0, d19).tex(0.0D, d23).color(j, k, l, 255).endVertex(); + double d24 = 0.0D; + + if (entity.ticksExisted % 2 == 0) + { + d24 = 0.5D; + } + + worldrenderer.pos(d4, d0, d5).tex(0.5D, d24 + 0.5D).color(j, k, l, 255).endVertex(); + worldrenderer.pos(d6, d0, d7).tex(1.0D, d24 + 0.5D).color(j, k, l, 255).endVertex(); + worldrenderer.pos(d10, d0, d11).tex(1.0D, d24).color(j, k, l, 255).endVertex(); + worldrenderer.pos(d8, d0, d9).tex(0.5D, d24).color(j, k, l, 255).endVertex(); + tessellator.draw(); + GlStateManager.popMatrix(); + } + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityGuardian entitylivingbaseIn, float partialTickTime) + { + if (entitylivingbaseIn.isElder()) + { + GlStateManager.scale(2.35F, 2.35F, 2.35F); + } + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityGuardian entity) + { + return entity.isElder() ? GUARDIAN_ELDER_TEXTURE : GUARDIAN_TEXTURE; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderHorse.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderHorse.java new file mode 100644 index 0000000..d4b1fff --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderHorse.java @@ -0,0 +1,102 @@ +package net.minecraft.client.renderer.entity; + +import com.google.common.collect.Maps; +import java.util.Map; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelHorse; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.texture.LayeredTexture; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.util.ResourceLocation; + +public class RenderHorse extends RenderLiving +{ + private static final Map field_110852_a = Maps.newHashMap(); + private static final ResourceLocation whiteHorseTextures = new ResourceLocation("textures/entity/horse/horse_white.png"); + private static final ResourceLocation muleTextures = new ResourceLocation("textures/entity/horse/mule.png"); + private static final ResourceLocation donkeyTextures = new ResourceLocation("textures/entity/horse/donkey.png"); + private static final ResourceLocation zombieHorseTextures = new ResourceLocation("textures/entity/horse/horse_zombie.png"); + private static final ResourceLocation skeletonHorseTextures = new ResourceLocation("textures/entity/horse/horse_skeleton.png"); + + public RenderHorse(RenderManager rendermanagerIn, ModelHorse model, float shadowSizeIn) + { + super(rendermanagerIn, model, shadowSizeIn); + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityHorse entitylivingbaseIn, float partialTickTime) + { + float f = 1.0F; + int i = entitylivingbaseIn.getHorseType(); + + if (i == 1) + { + f *= 0.87F; + } + else if (i == 2) + { + f *= 0.92F; + } + + GlStateManager.scale(f, f, f); + super.preRenderCallback(entitylivingbaseIn, partialTickTime); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityHorse entity) + { + if (!entity.func_110239_cn()) + { + switch (entity.getHorseType()) + { + case 0: + default: + return whiteHorseTextures; + + case 1: + return donkeyTextures; + + case 2: + return muleTextures; + + case 3: + return zombieHorseTextures; + + case 4: + return skeletonHorseTextures; + } + } + else + { + return this.func_110848_b(entity); + } + } + + private ResourceLocation func_110848_b(EntityHorse horse) + { + String s = horse.getHorseTexture(); + + if (!horse.func_175507_cI()) + { + return null; + } + else + { + ResourceLocation resourcelocation = (ResourceLocation)field_110852_a.get(s); + + if (resourcelocation == null) + { + resourcelocation = new ResourceLocation(s); + Minecraft.getMinecraft().getTextureManager().loadTexture(resourcelocation, new LayeredTexture(horse.getVariantTexturePaths())); + field_110852_a.put(s, resourcelocation); + } + + return resourcelocation; + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderIronGolem.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderIronGolem.java new file mode 100644 index 0000000..cce0f55 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderIronGolem.java @@ -0,0 +1,39 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelIronGolem; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.layers.LayerIronGolemFlower; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.util.ResourceLocation; + +public class RenderIronGolem extends RenderLiving +{ + private static final ResourceLocation ironGolemTextures = new ResourceLocation("textures/entity/iron_golem.png"); + + public RenderIronGolem(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelIronGolem(), 0.5F); + this.addLayer(new LayerIronGolemFlower(this)); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityIronGolem entity) + { + return ironGolemTextures; + } + + protected void rotateCorpse(EntityIronGolem bat, float p_77043_2_, float p_77043_3_, float partialTicks) + { + super.rotateCorpse(bat, p_77043_2_, p_77043_3_, partialTicks); + + if ((double)bat.limbSwingAmount >= 0.01D) + { + float f = 13.0F; + float f1 = bat.limbSwing - bat.limbSwingAmount * (1.0F - partialTicks) + 6.0F; + float f2 = (Math.abs(f1 % f - f * 0.5F) - f * 0.25F) / (f * 0.25F); + GlStateManager.rotate(6.5F * f2, 0.0F, 0.0F, 1.0F); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderItem.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderItem.java new file mode 100644 index 0000000..cb3cfa0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderItem.java @@ -0,0 +1,1213 @@ +package net.minecraft.client.renderer.entity; + +import java.util.List; +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDirt; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.BlockHugeMushroom; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.BlockPrismarine; +import net.minecraft.block.BlockQuartz; +import net.minecraft.block.BlockRedSandstone; +import net.minecraft.block.BlockSand; +import net.minecraft.block.BlockSandStone; +import net.minecraft.block.BlockSilverfish; +import net.minecraft.block.BlockStone; +import net.minecraft.block.BlockStoneBrick; +import net.minecraft.block.BlockStoneSlab; +import net.minecraft.block.BlockStoneSlabNew; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.BlockWall; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.ItemMeshDefinition; +import net.minecraft.client.renderer.ItemModelMesher; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemTransformVec3f; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemFishFood; +import net.minecraft.item.ItemPotion; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3i; +import optifine.Config; +import optifine.CustomColors; +import optifine.CustomItems; +import optifine.Reflector; +import shadersmod.client.Shaders; +import shadersmod.client.ShadersRender; + +public class RenderItem implements IResourceManagerReloadListener +{ + private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png"); + private boolean field_175058_l = true; + + /** Defines the zLevel of rendering of item on GUI. */ + public float zLevel; + private final ItemModelMesher itemModelMesher; + private final TextureManager textureManager; + private static final String __OBFID = "CL_00001003"; + private ModelResourceLocation modelLocation = null; + private boolean renderItemGui = false; + public ModelManager modelManager = null; + + public RenderItem(TextureManager textureManager, ModelManager modelManager) + { + this.textureManager = textureManager; + this.modelManager = modelManager; + + if (Reflector.ItemModelMesherForge_Constructor.exists()) + { + this.itemModelMesher = (ItemModelMesher)Reflector.newInstance(Reflector.ItemModelMesherForge_Constructor, new Object[] {modelManager}); + } + else + { + this.itemModelMesher = new ItemModelMesher(modelManager); + } + + this.registerItems(); + } + + public void func_175039_a(boolean p_175039_1_) + { + this.field_175058_l = p_175039_1_; + } + + public ItemModelMesher getItemModelMesher() + { + return this.itemModelMesher; + } + + protected void registerItem(Item itm, int subType, String identifier) + { + this.itemModelMesher.register(itm, subType, new ModelResourceLocation(identifier, "inventory")); + } + + protected void registerBlock(Block blk, int subType, String identifier) + { + this.registerItem(Item.getItemFromBlock(blk), subType, identifier); + } + + private void registerBlock(Block blk, String identifier) + { + this.registerBlock(blk, 0, identifier); + } + + private void registerItem(Item itm, String identifier) + { + this.registerItem(itm, 0, identifier); + } + + private void renderModel(IBakedModel model, ItemStack stack) + { + this.renderModel(model, -1, stack); + } + + public void renderModel(IBakedModel model, int color) + { + this.renderModel(model, color, (ItemStack)null); + } + + private void renderModel(IBakedModel model, int color, ItemStack stack) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + boolean flag = Minecraft.getMinecraft().getTextureMapBlocks().isTextureBound(); + boolean flag1 = Config.isMultiTexture() && flag; + + if (flag1) + { + worldrenderer.setBlockLayer(EnumWorldBlockLayer.SOLID); + } + + worldrenderer.begin(7, DefaultVertexFormats.ITEM); + + for (EnumFacing enumfacing : EnumFacing.VALUES) + { + this.renderQuads(worldrenderer, model.getFaceQuads(enumfacing), color, stack); + } + + this.renderQuads(worldrenderer, model.getGeneralQuads(), color, stack); + tessellator.draw(); + + if (flag1) + { + worldrenderer.setBlockLayer((EnumWorldBlockLayer)null); + GlStateManager.bindCurrentTexture(); + } + } + + public void renderItem(ItemStack stack, IBakedModel model) + { + if (stack != null) + { + GlStateManager.pushMatrix(); + GlStateManager.scale(0.5F, 0.5F, 0.5F); + + if (model.isBuiltInRenderer()) + { + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(-0.5F, -0.5F, -0.5F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableRescaleNormal(); + TileEntityItemStackRenderer.instance.renderByItem(stack); + } + else + { + if (Config.isCustomItems()) + { + model = CustomItems.getCustomItemModel(stack, model, this.modelLocation); + } + + GlStateManager.translate(-0.5F, -0.5F, -0.5F); + this.renderModel(model, stack); + + if (stack.hasEffect() && (!Config.isCustomItems() || !CustomItems.renderCustomEffect(this, stack, model))) + { + this.renderEffect(model); + } + } + + GlStateManager.popMatrix(); + } + } + + private void renderEffect(IBakedModel model) + { + if (!Config.isCustomItems() || CustomItems.isUseGlint()) + { + if (!Config.isShaders() || !Shaders.isShadowPass) + { + GlStateManager.depthMask(false); + GlStateManager.depthFunc(514); + GlStateManager.disableLighting(); + GlStateManager.blendFunc(768, 1); + this.textureManager.bindTexture(RES_ITEM_GLINT); + + if (Config.isShaders() && !this.renderItemGui) + { + ShadersRender.renderEnchantedGlintBegin(); + } + + GlStateManager.matrixMode(5890); + GlStateManager.pushMatrix(); + GlStateManager.scale(8.0F, 8.0F, 8.0F); + float f = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F / 8.0F; + GlStateManager.translate(f, 0.0F, 0.0F); + GlStateManager.rotate(-50.0F, 0.0F, 0.0F, 1.0F); + this.renderModel(model, -8372020); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(8.0F, 8.0F, 8.0F); + float f1 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F / 8.0F; + GlStateManager.translate(-f1, 0.0F, 0.0F); + GlStateManager.rotate(10.0F, 0.0F, 0.0F, 1.0F); + this.renderModel(model, -8372020); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5888); + GlStateManager.blendFunc(770, 771); + GlStateManager.enableLighting(); + GlStateManager.depthFunc(515); + GlStateManager.depthMask(true); + this.textureManager.bindTexture(TextureMap.locationBlocksTexture); + + if (Config.isShaders() && !this.renderItemGui) + { + ShadersRender.renderEnchantedGlintEnd(); + } + } + } + } + + private void putQuadNormal(WorldRenderer renderer, BakedQuad quad) + { + Vec3i vec3i = quad.getFace().getDirectionVec(); + renderer.putNormal((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ()); + } + + private void renderQuad(WorldRenderer renderer, BakedQuad quad, int color) + { + if (renderer.isMultiTexture()) + { + renderer.addVertexData(quad.getVertexDataSingle()); + renderer.putSprite(quad.getSprite()); + } + else + { + renderer.addVertexData(quad.getVertexData()); + } + + if (Reflector.IColoredBakedQuad.exists() && Reflector.IColoredBakedQuad.isInstance(quad)) + { + forgeHooksClient_putQuadColor(renderer, quad, color); + } + else + { + renderer.putColor4(color); + } + + this.putQuadNormal(renderer, quad); + } + + private void renderQuads(WorldRenderer renderer, List quads, int color, ItemStack stack) + { + boolean flag = color == -1 && stack != null; + int i = 0; + + for (int j = quads.size(); i < j; ++i) + { + BakedQuad bakedquad = (BakedQuad)quads.get(i); + int k = color; + + if (flag && bakedquad.hasTintIndex()) + { + k = stack.getItem().getColorFromItemStack(stack, bakedquad.getTintIndex()); + + if (Config.isCustomColors()) + { + k = CustomColors.getColorFromItemStack(stack, bakedquad.getTintIndex(), k); + } + + if (EntityRenderer.anaglyphEnable) + { + k = TextureUtil.anaglyphColor(k); + } + + k = k | -16777216; + } + + this.renderQuad(renderer, bakedquad, k); + } + } + + public boolean shouldRenderItemIn3D(ItemStack stack) + { + IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack); + return ibakedmodel == null ? false : ibakedmodel.isGui3d(); + } + + private void preTransform(ItemStack stack) + { + IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack); + Item item = stack.getItem(); + + if (item != null) + { + boolean flag = ibakedmodel.isGui3d(); + + if (!flag) + { + GlStateManager.scale(2.0F, 2.0F, 2.0F); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + } + } + + public void func_181564_a(ItemStack p_181564_1_, ItemCameraTransforms.TransformType p_181564_2_) + { + if (p_181564_1_ != null) + { + IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(p_181564_1_); + this.renderItemModelTransform(p_181564_1_, ibakedmodel, p_181564_2_); + } + } + + public void renderItemModelForEntity(ItemStack stack, EntityLivingBase entityToRenderFor, ItemCameraTransforms.TransformType cameraTransformType) + { + if (stack != null && entityToRenderFor != null) + { + IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack); + + if (entityToRenderFor instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)entityToRenderFor; + Item item = stack.getItem(); + ModelResourceLocation modelresourcelocation = null; + + if (item == Items.fishing_rod && entityplayer.fishEntity != null) + { + modelresourcelocation = new ModelResourceLocation("fishing_rod_cast", "inventory"); + } + else if (item == Items.bow && entityplayer.getItemInUse() != null) + { + int i = stack.getMaxItemUseDuration() - entityplayer.getItemInUseCount(); + + if (i >= 18) + { + modelresourcelocation = new ModelResourceLocation("bow_pulling_2", "inventory"); + } + else if (i > 13) + { + modelresourcelocation = new ModelResourceLocation("bow_pulling_1", "inventory"); + } + else if (i > 0) + { + modelresourcelocation = new ModelResourceLocation("bow_pulling_0", "inventory"); + } + } + else if (Reflector.ForgeItem_getModel.exists()) + { + modelresourcelocation = (ModelResourceLocation)Reflector.call(item, Reflector.ForgeItem_getModel, new Object[] {stack, entityplayer, Integer.valueOf(entityplayer.getItemInUseCount())}); + } + + this.modelLocation = modelresourcelocation; + + if (modelresourcelocation != null) + { + ibakedmodel = this.itemModelMesher.getModelManager().getModel(modelresourcelocation); + } + } + + this.renderItemModelTransform(stack, ibakedmodel, cameraTransformType); + this.modelLocation = null; + } + } + + protected void renderItemModelTransform(ItemStack stack, IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType) + { + this.textureManager.bindTexture(TextureMap.locationBlocksTexture); + this.textureManager.getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); + this.preTransform(stack); + GlStateManager.enableRescaleNormal(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.pushMatrix(); + + if (Reflector.ForgeHooksClient_handleCameraTransforms.exists()) + { + model = (IBakedModel)Reflector.call(Reflector.ForgeHooksClient_handleCameraTransforms, new Object[] {model, cameraTransformType}); + } + else + { + ItemCameraTransforms itemcameratransforms = model.getItemCameraTransforms(); + itemcameratransforms.applyTransform(cameraTransformType); + + if (this.func_183005_a(itemcameratransforms.getTransform(cameraTransformType))) + { + GlStateManager.cullFace(1028); + } + } + + this.renderItem(stack, model); + GlStateManager.cullFace(1029); + GlStateManager.popMatrix(); + GlStateManager.disableRescaleNormal(); + GlStateManager.disableBlend(); + this.textureManager.bindTexture(TextureMap.locationBlocksTexture); + this.textureManager.getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); + } + + private boolean func_183005_a(ItemTransformVec3f p_183005_1_) + { + return p_183005_1_.scale.x < 0.0F ^ p_183005_1_.scale.y < 0.0F ^ p_183005_1_.scale.z < 0.0F; + } + + public void renderItemIntoGUI(ItemStack stack, int x, int y) + { + this.renderItemGui = true; + IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack); + GlStateManager.pushMatrix(); + this.textureManager.bindTexture(TextureMap.locationBlocksTexture); + this.textureManager.getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); + GlStateManager.enableRescaleNormal(); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); + + if (Reflector.ForgeHooksClient_handleCameraTransforms.exists()) + { + ibakedmodel = (IBakedModel)Reflector.call(Reflector.ForgeHooksClient_handleCameraTransforms, new Object[] {ibakedmodel, ItemCameraTransforms.TransformType.GUI}); + } + else + { + ibakedmodel.getItemCameraTransforms().applyTransform(ItemCameraTransforms.TransformType.GUI); + } + + this.renderItem(stack, ibakedmodel); + GlStateManager.disableAlpha(); + GlStateManager.disableRescaleNormal(); + GlStateManager.disableLighting(); + GlStateManager.popMatrix(); + this.textureManager.bindTexture(TextureMap.locationBlocksTexture); + this.textureManager.getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); + this.renderItemGui = false; + } + + private void setupGuiTransform(int xPosition, int yPosition, boolean isGui3d) + { + GlStateManager.translate((float)xPosition, (float)yPosition, 100.0F + this.zLevel); + GlStateManager.translate(8.0F, 8.0F, 0.0F); + GlStateManager.scale(1.0F, 1.0F, -1.0F); + GlStateManager.scale(0.5F, 0.5F, 0.5F); + + if (isGui3d) + { + GlStateManager.scale(40.0F, 40.0F, 40.0F); + GlStateManager.rotate(210.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.enableLighting(); + } + else + { + GlStateManager.scale(64.0F, 64.0F, 64.0F); + GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.disableLighting(); + } + } + + public void renderItemAndEffectIntoGUI(final ItemStack stack, int xPosition, int yPosition) + { + if (stack != null && stack.getItem() != null) + { + this.zLevel += 50.0F; + + try + { + this.renderItemIntoGUI(stack, xPosition, yPosition); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering item"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Item being rendered"); + crashreportcategory.addCrashSectionCallable("Item Type", new Callable() + { + private static final String __OBFID = "CL_00001004"; + public String call() throws Exception + { + return String.valueOf((Object)stack.getItem()); + } + }); + crashreportcategory.addCrashSectionCallable("Item Aux", new Callable() + { + private static final String __OBFID = "CL_00001005"; + public String call() throws Exception + { + return String.valueOf(stack.getMetadata()); + } + }); + crashreportcategory.addCrashSectionCallable("Item NBT", new Callable() + { + private static final String __OBFID = "CL_00001006"; + public String call() throws Exception + { + return String.valueOf((Object)stack.getTagCompound()); + } + }); + crashreportcategory.addCrashSectionCallable("Item Foil", new Callable() + { + private static final String __OBFID = "CL_00001007"; + public String call() throws Exception + { + return String.valueOf(stack.hasEffect()); + } + }); + throw new ReportedException(crashreport); + } + + this.zLevel -= 50.0F; + } + } + + + public void renderItemOverlays(FontRenderer fr, ItemStack stack, int xPosition, int yPosition) + { + this.renderItemOverlayIntoGUI(fr, stack, xPosition, yPosition, (String)null); + } + + /** + * Renders the stack size and/or damage bar for the given ItemStack. + */ + public void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, String text) + { + if (stack != null) + { + if (stack.stackSize != 1 || text != null) + { + String s = text == null ? String.valueOf(stack.stackSize) : text; + + if (text == null && stack.stackSize < 1) + { + s = EnumChatFormatting.RED + String.valueOf(stack.stackSize); + } + + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + GlStateManager.disableBlend(); + fr.drawStringWithShadow(s, (float)(xPosition + 19 - 2 - fr.getStringWidth(s)), (float)(yPosition + 6 + 3), 16777215); + GlStateManager.enableLighting(); + GlStateManager.enableDepth(); + } + + boolean flag = stack.isItemDamaged(); + + if (Reflector.ForgeItem_showDurabilityBar.exists()) + { + flag = Reflector.callBoolean(stack.getItem(), Reflector.ForgeItem_showDurabilityBar, new Object[] {stack}); + } + + if (flag) + { + int i = (int)Math.round(13.0D - (double)stack.getItemDamage() * 13.0D / (double)stack.getMaxDamage()); + int j = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); + + if (Reflector.ForgeItem_getDurabilityForDisplay.exists()) + { + double d0 = Reflector.callDouble(stack.getItem(), Reflector.ForgeItem_getDurabilityForDisplay, new Object[] {stack}); + i = (int)Math.round(13.0D - d0 * 13.0D); + j = (int)Math.round(255.0D - d0 * 255.0D); + } + + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + GlStateManager.disableTexture2D(); + GlStateManager.disableAlpha(); + GlStateManager.disableBlend(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); + this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, (255 - j) / 4, 64, 0, 255); + this.func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, i, 1, 255 - j, j, 0, 255); + + if (!Reflector.ForgeHooksClient.exists()) + { + GlStateManager.enableBlend(); + } + + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + GlStateManager.enableLighting(); + GlStateManager.enableDepth(); + } + } + } + + private void func_181565_a(WorldRenderer p_181565_1_, int p_181565_2_, int p_181565_3_, int p_181565_4_, int p_181565_5_, int p_181565_6_, int p_181565_7_, int p_181565_8_, int p_181565_9_) + { + p_181565_1_.begin(7, DefaultVertexFormats.POSITION_COLOR); + p_181565_1_.pos((double)(p_181565_2_ + 0), (double)(p_181565_3_ + 0), 0.0D).color(p_181565_6_, p_181565_7_, p_181565_8_, p_181565_9_).endVertex(); + p_181565_1_.pos((double)(p_181565_2_ + 0), (double)(p_181565_3_ + p_181565_5_), 0.0D).color(p_181565_6_, p_181565_7_, p_181565_8_, p_181565_9_).endVertex(); + p_181565_1_.pos((double)(p_181565_2_ + p_181565_4_), (double)(p_181565_3_ + p_181565_5_), 0.0D).color(p_181565_6_, p_181565_7_, p_181565_8_, p_181565_9_).endVertex(); + p_181565_1_.pos((double)(p_181565_2_ + p_181565_4_), (double)(p_181565_3_ + 0), 0.0D).color(p_181565_6_, p_181565_7_, p_181565_8_, p_181565_9_).endVertex(); + Tessellator.getInstance().draw(); + } + + private void registerItems() + { + this.registerBlock(Blocks.anvil, "anvil_intact"); + this.registerBlock(Blocks.anvil, 1, "anvil_slightly_damaged"); + this.registerBlock(Blocks.anvil, 2, "anvil_very_damaged"); + this.registerBlock(Blocks.carpet, EnumDyeColor.BLACK.getMetadata(), "black_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.BLUE.getMetadata(), "blue_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.BROWN.getMetadata(), "brown_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.CYAN.getMetadata(), "cyan_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.GRAY.getMetadata(), "gray_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.GREEN.getMetadata(), "green_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.LIGHT_BLUE.getMetadata(), "light_blue_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.LIME.getMetadata(), "lime_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.MAGENTA.getMetadata(), "magenta_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.ORANGE.getMetadata(), "orange_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.PINK.getMetadata(), "pink_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.PURPLE.getMetadata(), "purple_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.RED.getMetadata(), "red_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.SILVER.getMetadata(), "silver_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.WHITE.getMetadata(), "white_carpet"); + this.registerBlock(Blocks.carpet, EnumDyeColor.YELLOW.getMetadata(), "yellow_carpet"); + this.registerBlock(Blocks.cobblestone_wall, BlockWall.EnumType.MOSSY.getMetadata(), "mossy_cobblestone_wall"); + this.registerBlock(Blocks.cobblestone_wall, BlockWall.EnumType.NORMAL.getMetadata(), "cobblestone_wall"); + this.registerBlock(Blocks.dirt, BlockDirt.DirtType.COARSE_DIRT.getMetadata(), "coarse_dirt"); + this.registerBlock(Blocks.dirt, BlockDirt.DirtType.DIRT.getMetadata(), "dirt"); + this.registerBlock(Blocks.dirt, BlockDirt.DirtType.PODZOL.getMetadata(), "podzol"); + this.registerBlock(Blocks.double_plant, BlockDoublePlant.EnumPlantType.FERN.getMeta(), "double_fern"); + this.registerBlock(Blocks.double_plant, BlockDoublePlant.EnumPlantType.GRASS.getMeta(), "double_grass"); + this.registerBlock(Blocks.double_plant, BlockDoublePlant.EnumPlantType.PAEONIA.getMeta(), "paeonia"); + this.registerBlock(Blocks.double_plant, BlockDoublePlant.EnumPlantType.ROSE.getMeta(), "double_rose"); + this.registerBlock(Blocks.double_plant, BlockDoublePlant.EnumPlantType.SUNFLOWER.getMeta(), "sunflower"); + this.registerBlock(Blocks.double_plant, BlockDoublePlant.EnumPlantType.SYRINGA.getMeta(), "syringa"); + this.registerBlock(Blocks.leaves, BlockPlanks.EnumType.BIRCH.getMetadata(), "birch_leaves"); + this.registerBlock(Blocks.leaves, BlockPlanks.EnumType.JUNGLE.getMetadata(), "jungle_leaves"); + this.registerBlock(Blocks.leaves, BlockPlanks.EnumType.OAK.getMetadata(), "oak_leaves"); + this.registerBlock(Blocks.leaves, BlockPlanks.EnumType.SPRUCE.getMetadata(), "spruce_leaves"); + this.registerBlock(Blocks.leaves2, BlockPlanks.EnumType.ACACIA.getMetadata() - 4, "acacia_leaves"); + this.registerBlock(Blocks.leaves2, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4, "dark_oak_leaves"); + this.registerBlock(Blocks.log, BlockPlanks.EnumType.BIRCH.getMetadata(), "birch_log"); + this.registerBlock(Blocks.log, BlockPlanks.EnumType.JUNGLE.getMetadata(), "jungle_log"); + this.registerBlock(Blocks.log, BlockPlanks.EnumType.OAK.getMetadata(), "oak_log"); + this.registerBlock(Blocks.log, BlockPlanks.EnumType.SPRUCE.getMetadata(), "spruce_log"); + this.registerBlock(Blocks.log2, BlockPlanks.EnumType.ACACIA.getMetadata() - 4, "acacia_log"); + this.registerBlock(Blocks.log2, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4, "dark_oak_log"); + this.registerBlock(Blocks.monster_egg, BlockSilverfish.EnumType.CHISELED_STONEBRICK.getMetadata(), "chiseled_brick_monster_egg"); + this.registerBlock(Blocks.monster_egg, BlockSilverfish.EnumType.COBBLESTONE.getMetadata(), "cobblestone_monster_egg"); + this.registerBlock(Blocks.monster_egg, BlockSilverfish.EnumType.CRACKED_STONEBRICK.getMetadata(), "cracked_brick_monster_egg"); + this.registerBlock(Blocks.monster_egg, BlockSilverfish.EnumType.MOSSY_STONEBRICK.getMetadata(), "mossy_brick_monster_egg"); + this.registerBlock(Blocks.monster_egg, BlockSilverfish.EnumType.STONE.getMetadata(), "stone_monster_egg"); + this.registerBlock(Blocks.monster_egg, BlockSilverfish.EnumType.STONEBRICK.getMetadata(), "stone_brick_monster_egg"); + this.registerBlock(Blocks.planks, BlockPlanks.EnumType.ACACIA.getMetadata(), "acacia_planks"); + this.registerBlock(Blocks.planks, BlockPlanks.EnumType.BIRCH.getMetadata(), "birch_planks"); + this.registerBlock(Blocks.planks, BlockPlanks.EnumType.DARK_OAK.getMetadata(), "dark_oak_planks"); + this.registerBlock(Blocks.planks, BlockPlanks.EnumType.JUNGLE.getMetadata(), "jungle_planks"); + this.registerBlock(Blocks.planks, BlockPlanks.EnumType.OAK.getMetadata(), "oak_planks"); + this.registerBlock(Blocks.planks, BlockPlanks.EnumType.SPRUCE.getMetadata(), "spruce_planks"); + this.registerBlock(Blocks.prismarine, BlockPrismarine.EnumType.BRICKS.getMetadata(), "prismarine_bricks"); + this.registerBlock(Blocks.prismarine, BlockPrismarine.EnumType.DARK.getMetadata(), "dark_prismarine"); + this.registerBlock(Blocks.prismarine, BlockPrismarine.EnumType.ROUGH.getMetadata(), "prismarine"); + this.registerBlock(Blocks.quartz_block, BlockQuartz.EnumType.CHISELED.getMetadata(), "chiseled_quartz_block"); + this.registerBlock(Blocks.quartz_block, BlockQuartz.EnumType.DEFAULT.getMetadata(), "quartz_block"); + this.registerBlock(Blocks.quartz_block, BlockQuartz.EnumType.LINES_Y.getMetadata(), "quartz_column"); + this.registerBlock(Blocks.red_flower, BlockFlower.EnumFlowerType.ALLIUM.getMeta(), "allium"); + this.registerBlock(Blocks.red_flower, BlockFlower.EnumFlowerType.BLUE_ORCHID.getMeta(), "blue_orchid"); + this.registerBlock(Blocks.red_flower, BlockFlower.EnumFlowerType.HOUSTONIA.getMeta(), "houstonia"); + this.registerBlock(Blocks.red_flower, BlockFlower.EnumFlowerType.ORANGE_TULIP.getMeta(), "orange_tulip"); + this.registerBlock(Blocks.red_flower, BlockFlower.EnumFlowerType.OXEYE_DAISY.getMeta(), "oxeye_daisy"); + this.registerBlock(Blocks.red_flower, BlockFlower.EnumFlowerType.PINK_TULIP.getMeta(), "pink_tulip"); + this.registerBlock(Blocks.red_flower, BlockFlower.EnumFlowerType.POPPY.getMeta(), "poppy"); + this.registerBlock(Blocks.red_flower, BlockFlower.EnumFlowerType.RED_TULIP.getMeta(), "red_tulip"); + this.registerBlock(Blocks.red_flower, BlockFlower.EnumFlowerType.WHITE_TULIP.getMeta(), "white_tulip"); + this.registerBlock(Blocks.sand, BlockSand.EnumType.RED_SAND.getMetadata(), "red_sand"); + this.registerBlock(Blocks.sand, BlockSand.EnumType.SAND.getMetadata(), "sand"); + this.registerBlock(Blocks.sandstone, BlockSandStone.EnumType.CHISELED.getMetadata(), "chiseled_sandstone"); + this.registerBlock(Blocks.sandstone, BlockSandStone.EnumType.DEFAULT.getMetadata(), "sandstone"); + this.registerBlock(Blocks.sandstone, BlockSandStone.EnumType.SMOOTH.getMetadata(), "smooth_sandstone"); + this.registerBlock(Blocks.red_sandstone, BlockRedSandstone.EnumType.CHISELED.getMetadata(), "chiseled_red_sandstone"); + this.registerBlock(Blocks.red_sandstone, BlockRedSandstone.EnumType.DEFAULT.getMetadata(), "red_sandstone"); + this.registerBlock(Blocks.red_sandstone, BlockRedSandstone.EnumType.SMOOTH.getMetadata(), "smooth_red_sandstone"); + this.registerBlock(Blocks.sapling, BlockPlanks.EnumType.ACACIA.getMetadata(), "acacia_sapling"); + this.registerBlock(Blocks.sapling, BlockPlanks.EnumType.BIRCH.getMetadata(), "birch_sapling"); + this.registerBlock(Blocks.sapling, BlockPlanks.EnumType.DARK_OAK.getMetadata(), "dark_oak_sapling"); + this.registerBlock(Blocks.sapling, BlockPlanks.EnumType.JUNGLE.getMetadata(), "jungle_sapling"); + this.registerBlock(Blocks.sapling, BlockPlanks.EnumType.OAK.getMetadata(), "oak_sapling"); + this.registerBlock(Blocks.sapling, BlockPlanks.EnumType.SPRUCE.getMetadata(), "spruce_sapling"); + this.registerBlock(Blocks.sponge, 0, "sponge"); + this.registerBlock(Blocks.sponge, 1, "sponge_wet"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.BLACK.getMetadata(), "black_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.BLUE.getMetadata(), "blue_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.BROWN.getMetadata(), "brown_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.CYAN.getMetadata(), "cyan_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.GRAY.getMetadata(), "gray_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.GREEN.getMetadata(), "green_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.LIGHT_BLUE.getMetadata(), "light_blue_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.LIME.getMetadata(), "lime_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.MAGENTA.getMetadata(), "magenta_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.ORANGE.getMetadata(), "orange_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.PINK.getMetadata(), "pink_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.PURPLE.getMetadata(), "purple_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.RED.getMetadata(), "red_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.SILVER.getMetadata(), "silver_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.WHITE.getMetadata(), "white_stained_glass"); + this.registerBlock(Blocks.stained_glass, EnumDyeColor.YELLOW.getMetadata(), "yellow_stained_glass"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.BLACK.getMetadata(), "black_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.BLUE.getMetadata(), "blue_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.BROWN.getMetadata(), "brown_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.CYAN.getMetadata(), "cyan_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.GRAY.getMetadata(), "gray_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.GREEN.getMetadata(), "green_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.LIGHT_BLUE.getMetadata(), "light_blue_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.LIME.getMetadata(), "lime_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.MAGENTA.getMetadata(), "magenta_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.ORANGE.getMetadata(), "orange_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.PINK.getMetadata(), "pink_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.PURPLE.getMetadata(), "purple_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.RED.getMetadata(), "red_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.SILVER.getMetadata(), "silver_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.WHITE.getMetadata(), "white_stained_glass_pane"); + this.registerBlock(Blocks.stained_glass_pane, EnumDyeColor.YELLOW.getMetadata(), "yellow_stained_glass_pane"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.BLACK.getMetadata(), "black_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.BLUE.getMetadata(), "blue_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.BROWN.getMetadata(), "brown_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.CYAN.getMetadata(), "cyan_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.GRAY.getMetadata(), "gray_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.GREEN.getMetadata(), "green_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.LIGHT_BLUE.getMetadata(), "light_blue_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.LIME.getMetadata(), "lime_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.MAGENTA.getMetadata(), "magenta_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.ORANGE.getMetadata(), "orange_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.PINK.getMetadata(), "pink_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.PURPLE.getMetadata(), "purple_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.RED.getMetadata(), "red_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.SILVER.getMetadata(), "silver_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.WHITE.getMetadata(), "white_stained_hardened_clay"); + this.registerBlock(Blocks.stained_hardened_clay, EnumDyeColor.YELLOW.getMetadata(), "yellow_stained_hardened_clay"); + this.registerBlock(Blocks.stone, BlockStone.EnumType.ANDESITE.getMetadata(), "andesite"); + this.registerBlock(Blocks.stone, BlockStone.EnumType.ANDESITE_SMOOTH.getMetadata(), "andesite_smooth"); + this.registerBlock(Blocks.stone, BlockStone.EnumType.DIORITE.getMetadata(), "diorite"); + this.registerBlock(Blocks.stone, BlockStone.EnumType.DIORITE_SMOOTH.getMetadata(), "diorite_smooth"); + this.registerBlock(Blocks.stone, BlockStone.EnumType.GRANITE.getMetadata(), "granite"); + this.registerBlock(Blocks.stone, BlockStone.EnumType.GRANITE_SMOOTH.getMetadata(), "granite_smooth"); + this.registerBlock(Blocks.stone, BlockStone.EnumType.STONE.getMetadata(), "stone"); + this.registerBlock(Blocks.stonebrick, BlockStoneBrick.EnumType.CRACKED.getMetadata(), "cracked_stonebrick"); + this.registerBlock(Blocks.stonebrick, BlockStoneBrick.EnumType.DEFAULT.getMetadata(), "stonebrick"); + this.registerBlock(Blocks.stonebrick, BlockStoneBrick.EnumType.CHISELED.getMetadata(), "chiseled_stonebrick"); + this.registerBlock(Blocks.stonebrick, BlockStoneBrick.EnumType.MOSSY.getMetadata(), "mossy_stonebrick"); + this.registerBlock(Blocks.stone_slab, BlockStoneSlab.EnumType.BRICK.getMetadata(), "brick_slab"); + this.registerBlock(Blocks.stone_slab, BlockStoneSlab.EnumType.COBBLESTONE.getMetadata(), "cobblestone_slab"); + this.registerBlock(Blocks.stone_slab, BlockStoneSlab.EnumType.WOOD.getMetadata(), "old_wood_slab"); + this.registerBlock(Blocks.stone_slab, BlockStoneSlab.EnumType.NETHERBRICK.getMetadata(), "nether_brick_slab"); + this.registerBlock(Blocks.stone_slab, BlockStoneSlab.EnumType.QUARTZ.getMetadata(), "quartz_slab"); + this.registerBlock(Blocks.stone_slab, BlockStoneSlab.EnumType.SAND.getMetadata(), "sandstone_slab"); + this.registerBlock(Blocks.stone_slab, BlockStoneSlab.EnumType.SMOOTHBRICK.getMetadata(), "stone_brick_slab"); + this.registerBlock(Blocks.stone_slab, BlockStoneSlab.EnumType.STONE.getMetadata(), "stone_slab"); + this.registerBlock(Blocks.stone_slab2, BlockStoneSlabNew.EnumType.RED_SANDSTONE.getMetadata(), "red_sandstone_slab"); + this.registerBlock(Blocks.tallgrass, BlockTallGrass.EnumType.DEAD_BUSH.getMeta(), "dead_bush"); + this.registerBlock(Blocks.tallgrass, BlockTallGrass.EnumType.FERN.getMeta(), "fern"); + this.registerBlock(Blocks.tallgrass, BlockTallGrass.EnumType.GRASS.getMeta(), "tall_grass"); + this.registerBlock(Blocks.wooden_slab, BlockPlanks.EnumType.ACACIA.getMetadata(), "acacia_slab"); + this.registerBlock(Blocks.wooden_slab, BlockPlanks.EnumType.BIRCH.getMetadata(), "birch_slab"); + this.registerBlock(Blocks.wooden_slab, BlockPlanks.EnumType.DARK_OAK.getMetadata(), "dark_oak_slab"); + this.registerBlock(Blocks.wooden_slab, BlockPlanks.EnumType.JUNGLE.getMetadata(), "jungle_slab"); + this.registerBlock(Blocks.wooden_slab, BlockPlanks.EnumType.OAK.getMetadata(), "oak_slab"); + this.registerBlock(Blocks.wooden_slab, BlockPlanks.EnumType.SPRUCE.getMetadata(), "spruce_slab"); + this.registerBlock(Blocks.wool, EnumDyeColor.BLACK.getMetadata(), "black_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.BLUE.getMetadata(), "blue_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.BROWN.getMetadata(), "brown_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.CYAN.getMetadata(), "cyan_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.GRAY.getMetadata(), "gray_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.GREEN.getMetadata(), "green_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.LIGHT_BLUE.getMetadata(), "light_blue_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.LIME.getMetadata(), "lime_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.MAGENTA.getMetadata(), "magenta_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.ORANGE.getMetadata(), "orange_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.PINK.getMetadata(), "pink_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.PURPLE.getMetadata(), "purple_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.RED.getMetadata(), "red_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.SILVER.getMetadata(), "silver_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.WHITE.getMetadata(), "white_wool"); + this.registerBlock(Blocks.wool, EnumDyeColor.YELLOW.getMetadata(), "yellow_wool"); + this.registerBlock(Blocks.acacia_stairs, "acacia_stairs"); + this.registerBlock(Blocks.activator_rail, "activator_rail"); + this.registerBlock(Blocks.beacon, "beacon"); + this.registerBlock(Blocks.bedrock, "bedrock"); + this.registerBlock(Blocks.birch_stairs, "birch_stairs"); + this.registerBlock(Blocks.bookshelf, "bookshelf"); + this.registerBlock(Blocks.brick_block, "brick_block"); + this.registerBlock(Blocks.brick_block, "brick_block"); + this.registerBlock(Blocks.brick_stairs, "brick_stairs"); + this.registerBlock(Blocks.brown_mushroom, "brown_mushroom"); + this.registerBlock(Blocks.cactus, "cactus"); + this.registerBlock(Blocks.clay, "clay"); + this.registerBlock(Blocks.coal_block, "coal_block"); + this.registerBlock(Blocks.coal_ore, "coal_ore"); + this.registerBlock(Blocks.cobblestone, "cobblestone"); + this.registerBlock(Blocks.crafting_table, "crafting_table"); + this.registerBlock(Blocks.dark_oak_stairs, "dark_oak_stairs"); + this.registerBlock(Blocks.daylight_detector, "daylight_detector"); + this.registerBlock(Blocks.deadbush, "dead_bush"); + this.registerBlock(Blocks.detector_rail, "detector_rail"); + this.registerBlock(Blocks.diamond_block, "diamond_block"); + this.registerBlock(Blocks.diamond_ore, "diamond_ore"); + this.registerBlock(Blocks.dispenser, "dispenser"); + this.registerBlock(Blocks.dropper, "dropper"); + this.registerBlock(Blocks.emerald_block, "emerald_block"); + this.registerBlock(Blocks.emerald_ore, "emerald_ore"); + this.registerBlock(Blocks.enchanting_table, "enchanting_table"); + this.registerBlock(Blocks.end_portal_frame, "end_portal_frame"); + this.registerBlock(Blocks.end_stone, "end_stone"); + this.registerBlock(Blocks.oak_fence, "oak_fence"); + this.registerBlock(Blocks.spruce_fence, "spruce_fence"); + this.registerBlock(Blocks.birch_fence, "birch_fence"); + this.registerBlock(Blocks.jungle_fence, "jungle_fence"); + this.registerBlock(Blocks.dark_oak_fence, "dark_oak_fence"); + this.registerBlock(Blocks.acacia_fence, "acacia_fence"); + this.registerBlock(Blocks.oak_fence_gate, "oak_fence_gate"); + this.registerBlock(Blocks.spruce_fence_gate, "spruce_fence_gate"); + this.registerBlock(Blocks.birch_fence_gate, "birch_fence_gate"); + this.registerBlock(Blocks.jungle_fence_gate, "jungle_fence_gate"); + this.registerBlock(Blocks.dark_oak_fence_gate, "dark_oak_fence_gate"); + this.registerBlock(Blocks.acacia_fence_gate, "acacia_fence_gate"); + this.registerBlock(Blocks.furnace, "furnace"); + this.registerBlock(Blocks.glass, "glass"); + this.registerBlock(Blocks.glass_pane, "glass_pane"); + this.registerBlock(Blocks.glowstone, "glowstone"); + this.registerBlock(Blocks.golden_rail, "golden_rail"); + this.registerBlock(Blocks.gold_block, "gold_block"); + this.registerBlock(Blocks.gold_ore, "gold_ore"); + this.registerBlock(Blocks.grass, "grass"); + this.registerBlock(Blocks.gravel, "gravel"); + this.registerBlock(Blocks.hardened_clay, "hardened_clay"); + this.registerBlock(Blocks.hay_block, "hay_block"); + this.registerBlock(Blocks.heavy_weighted_pressure_plate, "heavy_weighted_pressure_plate"); + this.registerBlock(Blocks.hopper, "hopper"); + this.registerBlock(Blocks.ice, "ice"); + this.registerBlock(Blocks.iron_bars, "iron_bars"); + this.registerBlock(Blocks.iron_block, "iron_block"); + this.registerBlock(Blocks.iron_ore, "iron_ore"); + this.registerBlock(Blocks.iron_trapdoor, "iron_trapdoor"); + this.registerBlock(Blocks.jukebox, "jukebox"); + this.registerBlock(Blocks.jungle_stairs, "jungle_stairs"); + this.registerBlock(Blocks.ladder, "ladder"); + this.registerBlock(Blocks.lapis_block, "lapis_block"); + this.registerBlock(Blocks.lapis_ore, "lapis_ore"); + this.registerBlock(Blocks.lever, "lever"); + this.registerBlock(Blocks.light_weighted_pressure_plate, "light_weighted_pressure_plate"); + this.registerBlock(Blocks.lit_pumpkin, "lit_pumpkin"); + this.registerBlock(Blocks.melon_block, "melon_block"); + this.registerBlock(Blocks.mossy_cobblestone, "mossy_cobblestone"); + this.registerBlock(Blocks.mycelium, "mycelium"); + this.registerBlock(Blocks.netherrack, "netherrack"); + this.registerBlock(Blocks.nether_brick, "nether_brick"); + this.registerBlock(Blocks.nether_brick_fence, "nether_brick_fence"); + this.registerBlock(Blocks.nether_brick_stairs, "nether_brick_stairs"); + this.registerBlock(Blocks.noteblock, "noteblock"); + this.registerBlock(Blocks.oak_stairs, "oak_stairs"); + this.registerBlock(Blocks.obsidian, "obsidian"); + this.registerBlock(Blocks.packed_ice, "packed_ice"); + this.registerBlock(Blocks.piston, "piston"); + this.registerBlock(Blocks.pumpkin, "pumpkin"); + this.registerBlock(Blocks.quartz_ore, "quartz_ore"); + this.registerBlock(Blocks.quartz_stairs, "quartz_stairs"); + this.registerBlock(Blocks.rail, "rail"); + this.registerBlock(Blocks.redstone_block, "redstone_block"); + this.registerBlock(Blocks.redstone_lamp, "redstone_lamp"); + this.registerBlock(Blocks.redstone_ore, "redstone_ore"); + this.registerBlock(Blocks.redstone_torch, "redstone_torch"); + this.registerBlock(Blocks.red_mushroom, "red_mushroom"); + this.registerBlock(Blocks.sandstone_stairs, "sandstone_stairs"); + this.registerBlock(Blocks.red_sandstone_stairs, "red_sandstone_stairs"); + this.registerBlock(Blocks.sea_lantern, "sea_lantern"); + this.registerBlock(Blocks.slime_block, "slime"); + this.registerBlock(Blocks.snow, "snow"); + this.registerBlock(Blocks.snow_layer, "snow_layer"); + this.registerBlock(Blocks.soul_sand, "soul_sand"); + this.registerBlock(Blocks.spruce_stairs, "spruce_stairs"); + this.registerBlock(Blocks.sticky_piston, "sticky_piston"); + this.registerBlock(Blocks.stone_brick_stairs, "stone_brick_stairs"); + this.registerBlock(Blocks.stone_button, "stone_button"); + this.registerBlock(Blocks.stone_pressure_plate, "stone_pressure_plate"); + this.registerBlock(Blocks.stone_stairs, "stone_stairs"); + this.registerBlock(Blocks.tnt, "tnt"); + this.registerBlock(Blocks.torch, "torch"); + this.registerBlock(Blocks.trapdoor, "trapdoor"); + this.registerBlock(Blocks.tripwire_hook, "tripwire_hook"); + this.registerBlock(Blocks.vine, "vine"); + this.registerBlock(Blocks.waterlily, "waterlily"); + this.registerBlock(Blocks.web, "web"); + this.registerBlock(Blocks.wooden_button, "wooden_button"); + this.registerBlock(Blocks.wooden_pressure_plate, "wooden_pressure_plate"); + this.registerBlock(Blocks.yellow_flower, BlockFlower.EnumFlowerType.DANDELION.getMeta(), "dandelion"); + this.registerBlock(Blocks.chest, "chest"); + this.registerBlock(Blocks.trapped_chest, "trapped_chest"); + this.registerBlock(Blocks.ender_chest, "ender_chest"); + this.registerItem(Items.iron_shovel, "iron_shovel"); + this.registerItem(Items.iron_pickaxe, "iron_pickaxe"); + this.registerItem(Items.iron_axe, "iron_axe"); + this.registerItem(Items.flint_and_steel, "flint_and_steel"); + this.registerItem(Items.apple, "apple"); + this.registerItem(Items.bow, 0, "bow"); + this.registerItem(Items.bow, 1, "bow_pulling_0"); + this.registerItem(Items.bow, 2, "bow_pulling_1"); + this.registerItem(Items.bow, 3, "bow_pulling_2"); + this.registerItem(Items.arrow, "arrow"); + this.registerItem(Items.coal, 0, "coal"); + this.registerItem(Items.coal, 1, "charcoal"); + this.registerItem(Items.diamond, "diamond"); + this.registerItem(Items.iron_ingot, "iron_ingot"); + this.registerItem(Items.gold_ingot, "gold_ingot"); + this.registerItem(Items.iron_sword, "iron_sword"); + this.registerItem(Items.wooden_sword, "wooden_sword"); + this.registerItem(Items.wooden_shovel, "wooden_shovel"); + this.registerItem(Items.wooden_pickaxe, "wooden_pickaxe"); + this.registerItem(Items.wooden_axe, "wooden_axe"); + this.registerItem(Items.stone_sword, "stone_sword"); + this.registerItem(Items.stone_shovel, "stone_shovel"); + this.registerItem(Items.stone_pickaxe, "stone_pickaxe"); + this.registerItem(Items.stone_axe, "stone_axe"); + this.registerItem(Items.diamond_sword, "diamond_sword"); + this.registerItem(Items.diamond_shovel, "diamond_shovel"); + this.registerItem(Items.diamond_pickaxe, "diamond_pickaxe"); + this.registerItem(Items.diamond_axe, "diamond_axe"); + this.registerItem(Items.stick, "stick"); + this.registerItem(Items.bowl, "bowl"); + this.registerItem(Items.mushroom_stew, "mushroom_stew"); + this.registerItem(Items.golden_sword, "golden_sword"); + this.registerItem(Items.golden_shovel, "golden_shovel"); + this.registerItem(Items.golden_pickaxe, "golden_pickaxe"); + this.registerItem(Items.golden_axe, "golden_axe"); + this.registerItem(Items.string, "string"); + this.registerItem(Items.feather, "feather"); + this.registerItem(Items.gunpowder, "gunpowder"); + this.registerItem(Items.wooden_hoe, "wooden_hoe"); + this.registerItem(Items.stone_hoe, "stone_hoe"); + this.registerItem(Items.iron_hoe, "iron_hoe"); + this.registerItem(Items.diamond_hoe, "diamond_hoe"); + this.registerItem(Items.golden_hoe, "golden_hoe"); + this.registerItem(Items.wheat_seeds, "wheat_seeds"); + this.registerItem(Items.wheat, "wheat"); + this.registerItem(Items.bread, "bread"); + this.registerItem(Items.leather_helmet, "leather_helmet"); + this.registerItem(Items.leather_chestplate, "leather_chestplate"); + this.registerItem(Items.leather_leggings, "leather_leggings"); + this.registerItem(Items.leather_boots, "leather_boots"); + this.registerItem(Items.chainmail_helmet, "chainmail_helmet"); + this.registerItem(Items.chainmail_chestplate, "chainmail_chestplate"); + this.registerItem(Items.chainmail_leggings, "chainmail_leggings"); + this.registerItem(Items.chainmail_boots, "chainmail_boots"); + this.registerItem(Items.iron_helmet, "iron_helmet"); + this.registerItem(Items.iron_chestplate, "iron_chestplate"); + this.registerItem(Items.iron_leggings, "iron_leggings"); + this.registerItem(Items.iron_boots, "iron_boots"); + this.registerItem(Items.diamond_helmet, "diamond_helmet"); + this.registerItem(Items.diamond_chestplate, "diamond_chestplate"); + this.registerItem(Items.diamond_leggings, "diamond_leggings"); + this.registerItem(Items.diamond_boots, "diamond_boots"); + this.registerItem(Items.golden_helmet, "golden_helmet"); + this.registerItem(Items.golden_chestplate, "golden_chestplate"); + this.registerItem(Items.golden_leggings, "golden_leggings"); + this.registerItem(Items.golden_boots, "golden_boots"); + this.registerItem(Items.flint, "flint"); + this.registerItem(Items.porkchop, "porkchop"); + this.registerItem(Items.cooked_porkchop, "cooked_porkchop"); + this.registerItem(Items.painting, "painting"); + this.registerItem(Items.golden_apple, "golden_apple"); + this.registerItem(Items.golden_apple, 1, "golden_apple"); + this.registerItem(Items.sign, "sign"); + this.registerItem(Items.oak_door, "oak_door"); + this.registerItem(Items.spruce_door, "spruce_door"); + this.registerItem(Items.birch_door, "birch_door"); + this.registerItem(Items.jungle_door, "jungle_door"); + this.registerItem(Items.acacia_door, "acacia_door"); + this.registerItem(Items.dark_oak_door, "dark_oak_door"); + this.registerItem(Items.bucket, "bucket"); + this.registerItem(Items.water_bucket, "water_bucket"); + this.registerItem(Items.lava_bucket, "lava_bucket"); + this.registerItem(Items.minecart, "minecart"); + this.registerItem(Items.saddle, "saddle"); + this.registerItem(Items.iron_door, "iron_door"); + this.registerItem(Items.redstone, "redstone"); + this.registerItem(Items.snowball, "snowball"); + this.registerItem(Items.boat, "boat"); + this.registerItem(Items.leather, "leather"); + this.registerItem(Items.milk_bucket, "milk_bucket"); + this.registerItem(Items.brick, "brick"); + this.registerItem(Items.clay_ball, "clay_ball"); + this.registerItem(Items.reeds, "reeds"); + this.registerItem(Items.paper, "paper"); + this.registerItem(Items.book, "book"); + this.registerItem(Items.slime_ball, "slime_ball"); + this.registerItem(Items.chest_minecart, "chest_minecart"); + this.registerItem(Items.furnace_minecart, "furnace_minecart"); + this.registerItem(Items.egg, "egg"); + this.registerItem(Items.compass, "compass"); + this.registerItem(Items.fishing_rod, "fishing_rod"); + this.registerItem(Items.fishing_rod, 1, "fishing_rod_cast"); + this.registerItem(Items.clock, "clock"); + this.registerItem(Items.glowstone_dust, "glowstone_dust"); + this.registerItem(Items.fish, ItemFishFood.FishType.COD.getMetadata(), "cod"); + this.registerItem(Items.fish, ItemFishFood.FishType.SALMON.getMetadata(), "salmon"); + this.registerItem(Items.fish, ItemFishFood.FishType.CLOWNFISH.getMetadata(), "clownfish"); + this.registerItem(Items.fish, ItemFishFood.FishType.PUFFERFISH.getMetadata(), "pufferfish"); + this.registerItem(Items.cooked_fish, ItemFishFood.FishType.COD.getMetadata(), "cooked_cod"); + this.registerItem(Items.cooked_fish, ItemFishFood.FishType.SALMON.getMetadata(), "cooked_salmon"); + this.registerItem(Items.dye, EnumDyeColor.BLACK.getDyeDamage(), "dye_black"); + this.registerItem(Items.dye, EnumDyeColor.RED.getDyeDamage(), "dye_red"); + this.registerItem(Items.dye, EnumDyeColor.GREEN.getDyeDamage(), "dye_green"); + this.registerItem(Items.dye, EnumDyeColor.BROWN.getDyeDamage(), "dye_brown"); + this.registerItem(Items.dye, EnumDyeColor.BLUE.getDyeDamage(), "dye_blue"); + this.registerItem(Items.dye, EnumDyeColor.PURPLE.getDyeDamage(), "dye_purple"); + this.registerItem(Items.dye, EnumDyeColor.CYAN.getDyeDamage(), "dye_cyan"); + this.registerItem(Items.dye, EnumDyeColor.SILVER.getDyeDamage(), "dye_silver"); + this.registerItem(Items.dye, EnumDyeColor.GRAY.getDyeDamage(), "dye_gray"); + this.registerItem(Items.dye, EnumDyeColor.PINK.getDyeDamage(), "dye_pink"); + this.registerItem(Items.dye, EnumDyeColor.LIME.getDyeDamage(), "dye_lime"); + this.registerItem(Items.dye, EnumDyeColor.YELLOW.getDyeDamage(), "dye_yellow"); + this.registerItem(Items.dye, EnumDyeColor.LIGHT_BLUE.getDyeDamage(), "dye_light_blue"); + this.registerItem(Items.dye, EnumDyeColor.MAGENTA.getDyeDamage(), "dye_magenta"); + this.registerItem(Items.dye, EnumDyeColor.ORANGE.getDyeDamage(), "dye_orange"); + this.registerItem(Items.dye, EnumDyeColor.WHITE.getDyeDamage(), "dye_white"); + this.registerItem(Items.bone, "bone"); + this.registerItem(Items.sugar, "sugar"); + this.registerItem(Items.cake, "cake"); + this.registerItem(Items.bed, "bed"); + this.registerItem(Items.repeater, "repeater"); + this.registerItem(Items.cookie, "cookie"); + this.registerItem(Items.shears, "shears"); + this.registerItem(Items.melon, "melon"); + this.registerItem(Items.pumpkin_seeds, "pumpkin_seeds"); + this.registerItem(Items.melon_seeds, "melon_seeds"); + this.registerItem(Items.beef, "beef"); + this.registerItem(Items.cooked_beef, "cooked_beef"); + this.registerItem(Items.chicken, "chicken"); + this.registerItem(Items.cooked_chicken, "cooked_chicken"); + this.registerItem(Items.rabbit, "rabbit"); + this.registerItem(Items.cooked_rabbit, "cooked_rabbit"); + this.registerItem(Items.mutton, "mutton"); + this.registerItem(Items.cooked_mutton, "cooked_mutton"); + this.registerItem(Items.rabbit_foot, "rabbit_foot"); + this.registerItem(Items.rabbit_hide, "rabbit_hide"); + this.registerItem(Items.rabbit_stew, "rabbit_stew"); + this.registerItem(Items.rotten_flesh, "rotten_flesh"); + this.registerItem(Items.ender_pearl, "ender_pearl"); + this.registerItem(Items.blaze_rod, "blaze_rod"); + this.registerItem(Items.ghast_tear, "ghast_tear"); + this.registerItem(Items.gold_nugget, "gold_nugget"); + this.registerItem(Items.nether_wart, "nether_wart"); + this.itemModelMesher.register(Items.potionitem, new ItemMeshDefinition() + { + private static final String __OBFID = "CL_00002440"; + public ModelResourceLocation getModelLocation(ItemStack stack) + { + return ItemPotion.isSplash(stack.getMetadata()) ? new ModelResourceLocation("bottle_splash", "inventory") : new ModelResourceLocation("bottle_drinkable", "inventory"); + } + }); + this.registerItem(Items.glass_bottle, "glass_bottle"); + this.registerItem(Items.spider_eye, "spider_eye"); + this.registerItem(Items.fermented_spider_eye, "fermented_spider_eye"); + this.registerItem(Items.blaze_powder, "blaze_powder"); + this.registerItem(Items.magma_cream, "magma_cream"); + this.registerItem(Items.brewing_stand, "brewing_stand"); + this.registerItem(Items.cauldron, "cauldron"); + this.registerItem(Items.ender_eye, "ender_eye"); + this.registerItem(Items.speckled_melon, "speckled_melon"); + this.itemModelMesher.register(Items.spawn_egg, new ItemMeshDefinition() + { + private static final String __OBFID = "CL_00002439"; + public ModelResourceLocation getModelLocation(ItemStack stack) + { + return new ModelResourceLocation("spawn_egg", "inventory"); + } + }); + this.registerItem(Items.experience_bottle, "experience_bottle"); + this.registerItem(Items.fire_charge, "fire_charge"); + this.registerItem(Items.writable_book, "writable_book"); + this.registerItem(Items.emerald, "emerald"); + this.registerItem(Items.item_frame, "item_frame"); + this.registerItem(Items.flower_pot, "flower_pot"); + this.registerItem(Items.carrot, "carrot"); + this.registerItem(Items.potato, "potato"); + this.registerItem(Items.baked_potato, "baked_potato"); + this.registerItem(Items.poisonous_potato, "poisonous_potato"); + this.registerItem(Items.map, "map"); + this.registerItem(Items.golden_carrot, "golden_carrot"); + this.registerItem(Items.skull, 0, "skull_skeleton"); + this.registerItem(Items.skull, 1, "skull_wither"); + this.registerItem(Items.skull, 2, "skull_zombie"); + this.registerItem(Items.skull, 3, "skull_char"); + this.registerItem(Items.skull, 4, "skull_creeper"); + this.registerItem(Items.carrot_on_a_stick, "carrot_on_a_stick"); + this.registerItem(Items.nether_star, "nether_star"); + this.registerItem(Items.pumpkin_pie, "pumpkin_pie"); + this.registerItem(Items.firework_charge, "firework_charge"); + this.registerItem(Items.comparator, "comparator"); + this.registerItem(Items.netherbrick, "netherbrick"); + this.registerItem(Items.quartz, "quartz"); + this.registerItem(Items.tnt_minecart, "tnt_minecart"); + this.registerItem(Items.hopper_minecart, "hopper_minecart"); + this.registerItem(Items.armor_stand, "armor_stand"); + this.registerItem(Items.iron_horse_armor, "iron_horse_armor"); + this.registerItem(Items.golden_horse_armor, "golden_horse_armor"); + this.registerItem(Items.diamond_horse_armor, "diamond_horse_armor"); + this.registerItem(Items.lead, "lead"); + this.registerItem(Items.name_tag, "name_tag"); + this.itemModelMesher.register(Items.banner, new ItemMeshDefinition() + { + private static final String __OBFID = "CL_00002438"; + public ModelResourceLocation getModelLocation(ItemStack stack) + { + return new ModelResourceLocation("banner", "inventory"); + } + }); + this.registerItem(Items.record_13, "record_13"); + this.registerItem(Items.record_cat, "record_cat"); + this.registerItem(Items.record_blocks, "record_blocks"); + this.registerItem(Items.record_chirp, "record_chirp"); + this.registerItem(Items.record_far, "record_far"); + this.registerItem(Items.record_mall, "record_mall"); + this.registerItem(Items.record_mellohi, "record_mellohi"); + this.registerItem(Items.record_stal, "record_stal"); + this.registerItem(Items.record_strad, "record_strad"); + this.registerItem(Items.record_ward, "record_ward"); + this.registerItem(Items.record_11, "record_11"); + this.registerItem(Items.record_wait, "record_wait"); + this.registerItem(Items.prismarine_shard, "prismarine_shard"); + this.registerItem(Items.prismarine_crystals, "prismarine_crystals"); + this.itemModelMesher.register(Items.enchanted_book, new ItemMeshDefinition() + { + private static final String __OBFID = "CL_00002437"; + public ModelResourceLocation getModelLocation(ItemStack stack) + { + return new ModelResourceLocation("enchanted_book", "inventory"); + } + }); + this.itemModelMesher.register(Items.filled_map, new ItemMeshDefinition() + { + private static final String __OBFID = "CL_00002436"; + public ModelResourceLocation getModelLocation(ItemStack stack) + { + return new ModelResourceLocation("filled_map", "inventory"); + } + }); + this.registerBlock(Blocks.command_block, "command_block"); + this.registerItem(Items.fireworks, "fireworks"); + this.registerItem(Items.command_block_minecart, "command_block_minecart"); + this.registerBlock(Blocks.barrier, "barrier"); + this.registerBlock(Blocks.mob_spawner, "mob_spawner"); + this.registerItem(Items.written_book, "written_book"); + this.registerBlock(Blocks.brown_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "brown_mushroom_block"); + this.registerBlock(Blocks.red_mushroom_block, BlockHugeMushroom.EnumType.ALL_INSIDE.getMetadata(), "red_mushroom_block"); + this.registerBlock(Blocks.dragon_egg, "dragon_egg"); + + if (Reflector.ModelLoader_onRegisterItems.exists()) + { + Reflector.call(Reflector.ModelLoader_onRegisterItems, new Object[] {this.itemModelMesher}); + } + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + this.itemModelMesher.rebuildCache(); + } + + public static void forgeHooksClient_putQuadColor(WorldRenderer p_forgeHooksClient_putQuadColor_0_, BakedQuad p_forgeHooksClient_putQuadColor_1_, int p_forgeHooksClient_putQuadColor_2_) + { + float f = (float)(p_forgeHooksClient_putQuadColor_2_ & 255); + float f1 = (float)(p_forgeHooksClient_putQuadColor_2_ >>> 8 & 255); + float f2 = (float)(p_forgeHooksClient_putQuadColor_2_ >>> 16 & 255); + float f3 = (float)(p_forgeHooksClient_putQuadColor_2_ >>> 24 & 255); + int[] aint = p_forgeHooksClient_putQuadColor_1_.getVertexData(); + int i = aint.length / 4; + + for (int j = 0; j < 4; ++j) + { + int k = aint[3 + i * j]; + float f4 = (float)(k & 255); + float f5 = (float)(k >>> 8 & 255); + float f6 = (float)(k >>> 16 & 255); + float f7 = (float)(k >>> 24 & 255); + int l = Math.min(255, (int)(f * f4 / 255.0F)); + int i1 = Math.min(255, (int)(f1 * f5 / 255.0F)); + int j1 = Math.min(255, (int)(f2 * f6 / 255.0F)); + int k1 = Math.min(255, (int)(f3 * f7 / 255.0F)); + p_forgeHooksClient_putQuadColor_0_.putColorRGBA(p_forgeHooksClient_putQuadColor_0_.getColorIndex(4 - j), l, i1, j1, k1); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderLeashKnot.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderLeashKnot.java new file mode 100644 index 0000000..86b8089 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderLeashKnot.java @@ -0,0 +1,46 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelLeashKnot; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.EntityLeashKnot; +import net.minecraft.util.ResourceLocation; + +public class RenderLeashKnot extends Render +{ + private static final ResourceLocation leashKnotTextures = new ResourceLocation("textures/entity/lead_knot.png"); + private ModelLeashKnot leashKnotModel = new ModelLeashKnot(); + + public RenderLeashKnot(RenderManager renderManagerIn) + { + super(renderManagerIn); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityLeashKnot entity, double x, double y, double z, float entityYaw, float partialTicks) + { + GlStateManager.pushMatrix(); + GlStateManager.disableCull(); + GlStateManager.translate((float)x, (float)y, (float)z); + float f = 0.0625F; + GlStateManager.enableRescaleNormal(); + GlStateManager.scale(-1.0F, -1.0F, 1.0F); + GlStateManager.enableAlpha(); + this.bindEntityTexture(entity); + this.leashKnotModel.render(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, f); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityLeashKnot entity) + { + return leashKnotTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderLightningBolt.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderLightningBolt.java new file mode 100644 index 0000000..babf8df --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderLightningBolt.java @@ -0,0 +1,152 @@ +package net.minecraft.client.renderer.entity; + +import java.util.Random; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.util.ResourceLocation; + +public class RenderLightningBolt extends Render +{ + public RenderLightningBolt(RenderManager renderManagerIn) + { + super(renderManagerIn); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityLightningBolt entity, double x, double y, double z, float entityYaw, float partialTicks) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.disableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 1); + double[] adouble = new double[8]; + double[] adouble1 = new double[8]; + double d0 = 0.0D; + double d1 = 0.0D; + Random random = new Random(entity.boltVertex); + + for (int i = 7; i >= 0; --i) + { + adouble[i] = d0; + adouble1[i] = d1; + d0 += (double)(random.nextInt(11) - 5); + d1 += (double)(random.nextInt(11) - 5); + } + + for (int k1 = 0; k1 < 4; ++k1) + { + Random random1 = new Random(entity.boltVertex); + + for (int j = 0; j < 3; ++j) + { + int k = 7; + int l = 0; + + if (j > 0) + { + k = 7 - j; + } + + if (j > 0) + { + l = k - 2; + } + + double d2 = adouble[k] - d0; + double d3 = adouble1[k] - d1; + + for (int i1 = k; i1 >= l; --i1) + { + double d4 = d2; + double d5 = d3; + + if (j == 0) + { + d2 += (double)(random1.nextInt(11) - 5); + d3 += (double)(random1.nextInt(11) - 5); + } + else + { + d2 += (double)(random1.nextInt(31) - 15); + d3 += (double)(random1.nextInt(31) - 15); + } + + worldrenderer.begin(5, DefaultVertexFormats.POSITION_COLOR); + float f = 0.5F; + float f1 = 0.45F; + float f2 = 0.45F; + float f3 = 0.5F; + double d6 = 0.1D + (double)k1 * 0.2D; + + if (j == 0) + { + d6 *= (double)i1 * 0.1D + 1.0D; + } + + double d7 = 0.1D + (double)k1 * 0.2D; + + if (j == 0) + { + d7 *= (double)(i1 - 1) * 0.1D + 1.0D; + } + + for (int j1 = 0; j1 < 5; ++j1) + { + double d8 = x + 0.5D - d6; + double d9 = z + 0.5D - d6; + + if (j1 == 1 || j1 == 2) + { + d8 += d6 * 2.0D; + } + + if (j1 == 2 || j1 == 3) + { + d9 += d6 * 2.0D; + } + + double d10 = x + 0.5D - d7; + double d11 = z + 0.5D - d7; + + if (j1 == 1 || j1 == 2) + { + d10 += d7 * 2.0D; + } + + if (j1 == 2 || j1 == 3) + { + d11 += d7 * 2.0D; + } + + worldrenderer.pos(d10 + d2, y + (double)(i1 * 16), d11 + d3).color(0.45F, 0.45F, 0.5F, 0.3F).endVertex(); + worldrenderer.pos(d8 + d4, y + (double)((i1 + 1) * 16), d9 + d5).color(0.45F, 0.45F, 0.5F, 0.3F).endVertex(); + } + + tessellator.draw(); + } + } + } + + GlStateManager.disableBlend(); + GlStateManager.enableLighting(); + GlStateManager.enableTexture2D(); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityLightningBolt entity) + { + return null; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderLiving.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderLiving.java new file mode 100644 index 0000000..9a51058 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderLiving.java @@ -0,0 +1,180 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.culling.ICamera; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityHanging; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import optifine.Config; +import shadersmod.client.Shaders; + +public abstract class RenderLiving extends RendererLivingEntity +{ + private static final String __OBFID = "CL_00001015"; + + public RenderLiving(RenderManager rendermanagerIn, ModelBase modelbaseIn, float shadowsizeIn) + { + super(rendermanagerIn, modelbaseIn, shadowsizeIn); + } + + protected boolean canRenderName(T entity) + { + return super.canRenderName(entity) && (entity.getAlwaysRenderNameTagForRender() || entity.hasCustomName() && entity == this.renderManager.pointedEntity); + } + + public boolean shouldRender(T livingEntity, ICamera camera, double camX, double camY, double camZ) + { + if (super.shouldRender(livingEntity, camera, camX, camY, camZ)) + { + return true; + } + else if (livingEntity.getLeashed() && livingEntity.getLeashedToEntity() != null) + { + Entity entity = livingEntity.getLeashedToEntity(); + return camera.isBoundingBoxInFrustum(entity.getEntityBoundingBox()); + } + else + { + return false; + } + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) + { + super.doRender(entity, x, y, z, entityYaw, partialTicks); + this.renderLeash(entity, x, y, z, entityYaw, partialTicks); + } + + public void func_177105_a(T entityLivingIn, float partialTicks) + { + int i = entityLivingIn.getBrightnessForRender(partialTicks); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + } + + /** + * Gets the value between start and end according to pct + */ + private double interpolateValue(double start, double end, double pct) + { + return start + (end - start) * pct; + } + + protected void renderLeash(T entityLivingIn, double x, double y, double z, float entityYaw, float partialTicks) + { + if (!Config.isShaders() || !Shaders.isShadowPass) + { + Entity entity = entityLivingIn.getLeashedToEntity(); + + if (entity != null) + { + y = y - (1.6D - (double)entityLivingIn.height) * 0.5D; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + double d0 = this.interpolateValue((double)entity.prevRotationYaw, (double)entity.rotationYaw, (double)(partialTicks * 0.5F)) * 0.01745329238474369D; + double d1 = this.interpolateValue((double)entity.prevRotationPitch, (double)entity.rotationPitch, (double)(partialTicks * 0.5F)) * 0.01745329238474369D; + double d2 = Math.cos(d0); + double d3 = Math.sin(d0); + double d4 = Math.sin(d1); + + if (entity instanceof EntityHanging) + { + d2 = 0.0D; + d3 = 0.0D; + d4 = -1.0D; + } + + double d5 = Math.cos(d1); + double d6 = this.interpolateValue(entity.prevPosX, entity.posX, (double)partialTicks) - d2 * 0.7D - d3 * 0.5D * d5; + double d7 = this.interpolateValue(entity.prevPosY + (double)entity.getEyeHeight() * 0.7D, entity.posY + (double)entity.getEyeHeight() * 0.7D, (double)partialTicks) - d4 * 0.5D - 0.25D; + double d8 = this.interpolateValue(entity.prevPosZ, entity.posZ, (double)partialTicks) - d3 * 0.7D + d2 * 0.5D * d5; + double d9 = this.interpolateValue((double)entityLivingIn.prevRenderYawOffset, (double)entityLivingIn.renderYawOffset, (double)partialTicks) * 0.01745329238474369D + (Math.PI / 2D); + d2 = Math.cos(d9) * (double)entityLivingIn.width * 0.4D; + d3 = Math.sin(d9) * (double)entityLivingIn.width * 0.4D; + double d10 = this.interpolateValue(entityLivingIn.prevPosX, entityLivingIn.posX, (double)partialTicks) + d2; + double d11 = this.interpolateValue(entityLivingIn.prevPosY, entityLivingIn.posY, (double)partialTicks); + double d12 = this.interpolateValue(entityLivingIn.prevPosZ, entityLivingIn.posZ, (double)partialTicks) + d3; + x = x + d2; + z = z + d3; + double d13 = (double)((float)(d6 - d10)); + double d14 = (double)((float)(d7 - d11)); + double d15 = (double)((float)(d8 - d12)); + GlStateManager.disableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.disableCull(); + + if (Config.isShaders()) + { + Shaders.beginLeash(); + } + + boolean flag = true; + double d16 = 0.025D; + worldrenderer.begin(5, DefaultVertexFormats.POSITION_COLOR); + + for (int i = 0; i <= 24; ++i) + { + float f = 0.5F; + float f1 = 0.4F; + float f2 = 0.3F; + + if (i % 2 == 0) + { + f *= 0.7F; + f1 *= 0.7F; + f2 *= 0.7F; + } + + float f3 = (float)i / 24.0F; + worldrenderer.pos(x + d13 * (double)f3 + 0.0D, y + d14 * (double)(f3 * f3 + f3) * 0.5D + (double)((24.0F - (float)i) / 18.0F + 0.125F), z + d15 * (double)f3).color(f, f1, f2, 1.0F).endVertex(); + worldrenderer.pos(x + d13 * (double)f3 + 0.025D, y + d14 * (double)(f3 * f3 + f3) * 0.5D + (double)((24.0F - (float)i) / 18.0F + 0.125F) + 0.025D, z + d15 * (double)f3).color(f, f1, f2, 1.0F).endVertex(); + } + + tessellator.draw(); + worldrenderer.begin(5, DefaultVertexFormats.POSITION_COLOR); + + for (int j = 0; j <= 24; ++j) + { + float f4 = 0.5F; + float f5 = 0.4F; + float f6 = 0.3F; + + if (j % 2 == 0) + { + f4 *= 0.7F; + f5 *= 0.7F; + f6 *= 0.7F; + } + + float f7 = (float)j / 24.0F; + worldrenderer.pos(x + d13 * (double)f7 + 0.0D, y + d14 * (double)(f7 * f7 + f7) * 0.5D + (double)((24.0F - (float)j) / 18.0F + 0.125F) + 0.025D, z + d15 * (double)f7).color(f4, f5, f6, 1.0F).endVertex(); + worldrenderer.pos(x + d13 * (double)f7 + 0.025D, y + d14 * (double)(f7 * f7 + f7) * 0.5D + (double)((24.0F - (float)j) / 18.0F + 0.125F), z + d15 * (double)f7 + 0.025D).color(f4, f5, f6, 1.0F).endVertex(); + } + + tessellator.draw(); + + if (Config.isShaders()) + { + Shaders.endLeash(); + } + + GlStateManager.enableLighting(); + GlStateManager.enableTexture2D(); + GlStateManager.enableCull(); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderMagmaCube.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderMagmaCube.java new file mode 100644 index 0000000..5b839a4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderMagmaCube.java @@ -0,0 +1,37 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelMagmaCube; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.monster.EntityMagmaCube; +import net.minecraft.util.ResourceLocation; + +public class RenderMagmaCube extends RenderLiving +{ + private static final ResourceLocation magmaCubeTextures = new ResourceLocation("textures/entity/slime/magmacube.png"); + + public RenderMagmaCube(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelMagmaCube(), 0.25F); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityMagmaCube entity) + { + return magmaCubeTextures; + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityMagmaCube entitylivingbaseIn, float partialTickTime) + { + int i = entitylivingbaseIn.getSlimeSize(); + float f = (entitylivingbaseIn.prevSquishFactor + (entitylivingbaseIn.squishFactor - entitylivingbaseIn.prevSquishFactor) * partialTickTime) / ((float)i * 0.5F + 1.0F); + float f1 = 1.0F / (f + 1.0F); + float f2 = (float)i; + GlStateManager.scale(f1 * f2, 1.0F / f1 * f2, f1 * f2); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderManager# b/src/minecraft/net/minecraft/client/renderer/entity/RenderManager# new file mode 100644 index 0000000..e87007c --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderManager# @@ -0,0 +1,39 @@ +*************** +*** 252,269 **** + public Render func_78715_a(Class p_78715_1_) { + Render render = (Render)this.field_78729_o.get(p_78715_1_); + if(render == null && p_78715_1_ != Entity.class) { +- render = this.func_78715_a(p_78715_1_.getSuperclass()); + this.field_78729_o.put(p_78715_1_, render); + } + +- return render; + } + + public Render func_78713_a(Entity p_78713_1_) { + if(p_78713_1_ instanceof AbstractClientPlayer) { + String s = ((AbstractClientPlayer)p_78713_1_).func_175154_l(); + RenderPlayer renderplayer = (RenderPlayer)this.field_178636_l.get(s); +- return renderplayer != null?renderplayer:this.field_178637_m; + } else { + return this.func_78715_a(p_78713_1_.getClass()); + } +--- 252,269 ---- + public Render func_78715_a(Class p_78715_1_) { + Render render = (Render)this.field_78729_o.get(p_78715_1_); + if(render == null && p_78715_1_ != Entity.class) { ++ render = this.func_78715_a((Class)p_78715_1_.getSuperclass()); + this.field_78729_o.put(p_78715_1_, render); + } + ++ return (Render)render; + } + + public Render func_78713_a(Entity p_78713_1_) { + if(p_78713_1_ instanceof AbstractClientPlayer) { + String s = ((AbstractClientPlayer)p_78713_1_).func_175154_l(); + RenderPlayer renderplayer = (RenderPlayer)this.field_178636_l.get(s); ++ return (Render)(renderplayer != null?renderplayer:this.field_178637_m); + } else { + return this.func_78715_a(p_78713_1_.getClass()); + } diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderManager.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderManager.java new file mode 100644 index 0000000..3151224 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderManager.java @@ -0,0 +1,534 @@ +package net.minecraft.client.renderer.entity; + +import com.google.common.collect.Maps; +import java.util.Collections; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.model.ModelChicken; +import net.minecraft.client.model.ModelCow; +import net.minecraft.client.model.ModelHorse; +import net.minecraft.client.model.ModelOcelot; +import net.minecraft.client.model.ModelPig; +import net.minecraft.client.model.ModelRabbit; +import net.minecraft.client.model.ModelSheep2; +import net.minecraft.client.model.ModelSlime; +import net.minecraft.client.model.ModelSquid; +import net.minecraft.client.model.ModelWolf; +import net.minecraft.client.model.ModelZombie; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.culling.ICamera; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.tileentity.RenderEnderCrystal; +import net.minecraft.client.renderer.tileentity.RenderItemFrame; +import net.minecraft.client.renderer.tileentity.RenderWitherSkull; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLeashKnot; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityMinecartMobSpawner; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.entity.item.EntityEnderEye; +import net.minecraft.entity.item.EntityEnderPearl; +import net.minecraft.entity.item.EntityExpBottle; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.entity.item.EntityFireworkRocket; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityMinecartTNT; +import net.minecraft.entity.item.EntityPainting; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.entity.monster.EntityCaveSpider; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntityEndermite; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.monster.EntityGiantZombie; +import net.minecraft.entity.monster.EntityGuardian; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.monster.EntityMagmaCube; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.monster.EntitySilverfish; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.entity.monster.EntitySnowman; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.monster.EntityWitch; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.entity.passive.EntityCow; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.passive.EntityMooshroom; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.passive.EntityRabbit; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityEgg; +import net.minecraft.entity.projectile.EntityFishHook; +import net.minecraft.entity.projectile.EntityLargeFireball; +import net.minecraft.entity.projectile.EntityPotion; +import net.minecraft.entity.projectile.EntitySmallFireball; +import net.minecraft.entity.projectile.EntitySnowball; +import net.minecraft.entity.projectile.EntityWitherSkull; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ReportedException; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import optifine.PlayerItemsLayer; +import optifine.Reflector; + +public class RenderManager +{ + + + /** A map of entity classes and the associated renderer. */ + private Map entityRenderMap = Maps.newHashMap(); + + /** + * lists the various player skin types with their associated Renderer class instances. + */ + private Map skinMap = Maps.newHashMap(); + public RenderPlayer playerRenderer; + + /** Renders fonts */ + private FontRenderer textRenderer; + public double renderPosX; + + public double renderPosY; + + public double renderPosZ; + public TextureManager renderEngine; + + /** Reference to the World object. */ + public World worldObj; + + /** Rendermanager's variable for the player */ + public Entity livingPlayer; + public Entity pointedEntity; + public float playerViewY; + public float playerViewX; + + /** Reference to the GameSettings object. */ + public GameSettings options; + public double viewerPosX; + public double viewerPosY; + public double viewerPosZ; + private boolean renderOutlines = false; + private boolean renderShadow = true; + + + /** whether bounding box should be rendered or not */ + private boolean debugBoundingBox = false; + private static final String __OBFID = "CL_00000991"; + + public RenderManager(TextureManager renderEngineIn, RenderItem itemRendererIn) + { + this.renderEngine = renderEngineIn; + this.entityRenderMap.put(EntityCaveSpider.class, new RenderCaveSpider(this)); + this.entityRenderMap.put(EntitySpider.class, new RenderSpider(this)); + this.entityRenderMap.put(EntityPig.class, new RenderPig(this, new ModelPig(), 0.7F)); + this.entityRenderMap.put(EntitySheep.class, new RenderSheep(this, new ModelSheep2(), 0.7F)); + this.entityRenderMap.put(EntityCow.class, new RenderCow(this, new ModelCow(), 0.7F)); + this.entityRenderMap.put(EntityMooshroom.class, new RenderMooshroom(this, new ModelCow(), 0.7F)); + this.entityRenderMap.put(EntityWolf.class, new RenderWolf(this, new ModelWolf(), 0.5F)); + this.entityRenderMap.put(EntityChicken.class, new RenderChicken(this, new ModelChicken(), 0.3F)); + this.entityRenderMap.put(EntityOcelot.class, new RenderOcelot(this, new ModelOcelot(), 0.4F)); + this.entityRenderMap.put(EntityRabbit.class, new RenderRabbit(this, new ModelRabbit(), 0.3F)); + this.entityRenderMap.put(EntitySilverfish.class, new RenderSilverfish(this)); + this.entityRenderMap.put(EntityEndermite.class, new RenderEndermite(this)); + this.entityRenderMap.put(EntityCreeper.class, new RenderCreeper(this)); + this.entityRenderMap.put(EntityEnderman.class, new RenderEnderman(this)); + this.entityRenderMap.put(EntitySnowman.class, new RenderSnowMan(this)); + this.entityRenderMap.put(EntitySkeleton.class, new RenderSkeleton(this)); + this.entityRenderMap.put(EntityWitch.class, new RenderWitch(this)); + this.entityRenderMap.put(EntityBlaze.class, new RenderBlaze(this)); + this.entityRenderMap.put(EntityPigZombie.class, new RenderPigZombie(this)); + this.entityRenderMap.put(EntityZombie.class, new RenderZombie(this)); + this.entityRenderMap.put(EntitySlime.class, new RenderSlime(this, new ModelSlime(16), 0.25F)); + this.entityRenderMap.put(EntityMagmaCube.class, new RenderMagmaCube(this)); + this.entityRenderMap.put(EntityGiantZombie.class, new RenderGiantZombie(this, new ModelZombie(), 0.5F, 6.0F)); + this.entityRenderMap.put(EntityGhast.class, new RenderGhast(this)); + this.entityRenderMap.put(EntitySquid.class, new RenderSquid(this, new ModelSquid(), 0.7F)); + this.entityRenderMap.put(EntityVillager.class, new RenderVillager(this)); + this.entityRenderMap.put(EntityIronGolem.class, new RenderIronGolem(this)); + this.entityRenderMap.put(EntityBat.class, new RenderBat(this)); + this.entityRenderMap.put(EntityGuardian.class, new RenderGuardian(this)); + this.entityRenderMap.put(EntityDragon.class, new RenderDragon(this)); + this.entityRenderMap.put(EntityEnderCrystal.class, new RenderEnderCrystal(this)); + this.entityRenderMap.put(EntityWither.class, new RenderWither(this)); + this.entityRenderMap.put(Entity.class, new RenderEntity(this)); + this.entityRenderMap.put(EntityPainting.class, new RenderPainting(this)); + this.entityRenderMap.put(EntityItemFrame.class, new RenderItemFrame(this, itemRendererIn)); + this.entityRenderMap.put(EntityLeashKnot.class, new RenderLeashKnot(this)); + this.entityRenderMap.put(EntityArrow.class, new RenderArrow(this)); + this.entityRenderMap.put(EntitySnowball.class, new RenderSnowball(this, Items.snowball, itemRendererIn)); + this.entityRenderMap.put(EntityEnderPearl.class, new RenderSnowball(this, Items.ender_pearl, itemRendererIn)); + this.entityRenderMap.put(EntityEnderEye.class, new RenderSnowball(this, Items.ender_eye, itemRendererIn)); + this.entityRenderMap.put(EntityEgg.class, new RenderSnowball(this, Items.egg, itemRendererIn)); + this.entityRenderMap.put(EntityPotion.class, new RenderPotion(this, itemRendererIn)); + this.entityRenderMap.put(EntityExpBottle.class, new RenderSnowball(this, Items.experience_bottle, itemRendererIn)); + this.entityRenderMap.put(EntityFireworkRocket.class, new RenderSnowball(this, Items.fireworks, itemRendererIn)); + this.entityRenderMap.put(EntityLargeFireball.class, new RenderFireball(this, 2.0F)); + this.entityRenderMap.put(EntitySmallFireball.class, new RenderFireball(this, 0.5F)); + this.entityRenderMap.put(EntityWitherSkull.class, new RenderWitherSkull(this)); + this.entityRenderMap.put(EntityItem.class, new RenderEntityItem(this, itemRendererIn)); + this.entityRenderMap.put(EntityXPOrb.class, new RenderXPOrb(this)); + this.entityRenderMap.put(EntityTNTPrimed.class, new RenderTNTPrimed(this)); + this.entityRenderMap.put(EntityFallingBlock.class, new RenderFallingBlock(this)); + this.entityRenderMap.put(EntityArmorStand.class, new ArmorStandRenderer(this)); + this.entityRenderMap.put(EntityMinecartTNT.class, new RenderTntMinecart(this)); + this.entityRenderMap.put(EntityMinecartMobSpawner.class, new RenderMinecartMobSpawner(this)); + this.entityRenderMap.put(EntityMinecart.class, new RenderMinecart(this)); + this.entityRenderMap.put(EntityBoat.class, new RenderBoat(this)); + this.entityRenderMap.put(EntityFishHook.class, new RenderFish(this)); + this.entityRenderMap.put(EntityHorse.class, new RenderHorse(this, new ModelHorse(), 0.75F)); + this.entityRenderMap.put(EntityLightningBolt.class, new RenderLightningBolt(this)); + this.playerRenderer = new RenderPlayer(this); + this.skinMap.put("default", this.playerRenderer); + this.skinMap.put("slim", new RenderPlayer(this, true)); + PlayerItemsLayer.register(this.skinMap); + + if (Reflector.RenderingRegistry_loadEntityRenderers.exists()) + { + Reflector.call(Reflector.RenderingRegistry_loadEntityRenderers, new Object[] {this.entityRenderMap}); + } + } + + public void setRenderPosition(double renderPosXIn, double renderPosYIn, double renderPosZIn) + { + this.renderPosX = renderPosXIn; + this.renderPosY = renderPosYIn; + this.renderPosZ = renderPosZIn; + } + + public Render getEntityClassRenderObject(Class p_78715_1_) + { + Render render = (Render)this.entityRenderMap.get(p_78715_1_); + + if (render == null && p_78715_1_ != Entity.class) + { + render = this.getEntityClassRenderObject(p_78715_1_.getSuperclass()); + this.entityRenderMap.put(p_78715_1_, render); + } + + return render; + } + + public Render getEntityRenderObject(Entity entityIn) + { + if (entityIn instanceof AbstractClientPlayer) + { + String s = ((AbstractClientPlayer)entityIn).getSkinType(); + RenderPlayer renderplayer = (RenderPlayer)this.skinMap.get(s); + return renderplayer != null ? renderplayer : this.playerRenderer; + } + else + { + return this.getEntityClassRenderObject(entityIn.getClass()); + } + } + + public void cacheActiveRenderInfo(World worldIn, FontRenderer textRendererIn, Entity livingPlayerIn, Entity pointedEntityIn, GameSettings optionsIn, float partialTicks) + { + this.worldObj = worldIn; + this.options = optionsIn; + this.livingPlayer = livingPlayerIn; + this.pointedEntity = pointedEntityIn; + this.textRenderer = textRendererIn; + + if (livingPlayerIn instanceof EntityLivingBase && ((EntityLivingBase)livingPlayerIn).isPlayerSleeping()) + { + IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn)); + Block block = iblockstate.getBlock(); + + if (Reflector.callBoolean(Reflector.ForgeBlock_isBed, new Object[] {worldIn, new BlockPos(livingPlayerIn), (EntityLivingBase)livingPlayerIn})) + { + EnumFacing enumfacing = (EnumFacing)Reflector.call(block, Reflector.ForgeBlock_getBedDirection, new Object[] {worldIn, new BlockPos(livingPlayerIn)}); + int i = enumfacing.getHorizontalIndex(); + this.playerViewY = (float)(i * 90 + 180); + this.playerViewX = 0.0F; + } + else if (block == Blocks.bed) + { + int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex(); + this.playerViewY = (float)(j * 90 + 180); + this.playerViewX = 0.0F; + } + } + else + { + this.playerViewY = livingPlayerIn.prevRotationYaw + (livingPlayerIn.rotationYaw - livingPlayerIn.prevRotationYaw) * partialTicks; + this.playerViewX = livingPlayerIn.prevRotationPitch + (livingPlayerIn.rotationPitch - livingPlayerIn.prevRotationPitch) * partialTicks; + } + + if (optionsIn.thirdPersonView == 2) + { + this.playerViewY += 180.0F; + } + + this.viewerPosX = livingPlayerIn.lastTickPosX + (livingPlayerIn.posX - livingPlayerIn.lastTickPosX) * (double)partialTicks; + this.viewerPosY = livingPlayerIn.lastTickPosY + (livingPlayerIn.posY - livingPlayerIn.lastTickPosY) * (double)partialTicks; + this.viewerPosZ = livingPlayerIn.lastTickPosZ + (livingPlayerIn.posZ - livingPlayerIn.lastTickPosZ) * (double)partialTicks; + } + + public void setPlayerViewY(float playerViewYIn) + { + this.playerViewY = playerViewYIn; + } + + public boolean isRenderShadow() + { + return this.renderShadow; + } + + public void setRenderShadow(boolean renderShadowIn) + { + this.renderShadow = renderShadowIn; + } + + public void setDebugBoundingBox(boolean debugBoundingBoxIn) + { + this.debugBoundingBox = debugBoundingBoxIn; + } + + public boolean isDebugBoundingBox() + { + return this.debugBoundingBox; + } + + public boolean renderEntitySimple(Entity entityIn, float partialTicks) + { + return this.renderEntityStatic(entityIn, partialTicks, false); + } + + public boolean shouldRender(Entity entityIn, ICamera camera, double camX, double camY, double camZ) + { + Render render = this.getEntityRenderObject(entityIn); + return render != null && render.shouldRender(entityIn, camera, camX, camY, camZ); + } + + public boolean renderEntityStatic(Entity entity, float partialTicks, boolean p_147936_3_) + { + if (entity.ticksExisted == 0) + { + entity.lastTickPosX = entity.posX; + entity.lastTickPosY = entity.posY; + entity.lastTickPosZ = entity.posZ; + } + + double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; + float f = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks; + int i = entity.getBrightnessForRender(partialTicks); + + if (entity.isBurning()) + { + i = 15728880; + } + + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + return this.doRenderEntity(entity, d0 - this.renderPosX, d1 - this.renderPosY, d2 - this.renderPosZ, f, partialTicks, p_147936_3_); + } + + public void renderWitherSkull(Entity entityIn, float partialTicks) + { + double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; + double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; + double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; + Render render = this.getEntityRenderObject(entityIn); + + if (render != null && this.renderEngine != null) + { + int i = entityIn.getBrightnessForRender(partialTicks); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + render.renderName(entityIn, d0 - this.renderPosX, d1 - this.renderPosY, d2 - this.renderPosZ); + } + } + + public boolean renderEntityWithPosYaw(Entity entityIn, double x, double y, double z, float entityYaw, float partialTicks) + { + return this.doRenderEntity(entityIn, x, y, z, entityYaw, partialTicks, false); + } + + public boolean doRenderEntity(Entity entity, double x, double y, double z, float entityYaw, float partialTicks, boolean p_147939_10_) + { + Render render = null; + + try + { + render = this.getEntityRenderObject(entity); + + if (render != null && this.renderEngine != null) + { + try + { + if (render instanceof RendererLivingEntity) + { + ((RendererLivingEntity)render).setRenderOutlines(this.renderOutlines); + } + + render.doRender(entity, x, y, z, entityYaw, partialTicks); + } + catch (Throwable throwable2) + { + throw new ReportedException(CrashReport.makeCrashReport(throwable2, "Rendering entity in world")); + } + + try + { + if (!this.renderOutlines) + { + render.doRenderShadowAndFire(entity, x, y, z, entityYaw, partialTicks); + } + } + catch (Throwable throwable1) + { + throw new ReportedException(CrashReport.makeCrashReport(throwable1, "Post-rendering entity in world")); + } + + if (this.debugBoundingBox && !entity.isInvisible() && !p_147939_10_) + { + try + { + this.renderDebugBoundingBox(entity, x, y, z, entityYaw, partialTicks); + } + catch (Throwable throwable) + { + throw new ReportedException(CrashReport.makeCrashReport(throwable, "Rendering entity hitbox in world")); + } + } + } + else if (this.renderEngine != null) + { + return false; + } + + return true; + } + catch (Throwable throwable3) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable3, "Rendering entity in world"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being rendered"); + entity.addEntityCrashInfo(crashreportcategory); + CrashReportCategory crashreportcategory1 = crashreport.makeCategory("Renderer details"); + crashreportcategory1.addCrashSection("Assigned renderer", render); + crashreportcategory1.addCrashSection("Location", CrashReportCategory.getCoordinateInfo(x, y, z)); + crashreportcategory1.addCrashSection("Rotation", Float.valueOf(entityYaw)); + crashreportcategory1.addCrashSection("Delta", Float.valueOf(partialTicks)); + throw new ReportedException(crashreport); + } + } + + /** + * Renders the bounding box around an entity when F3+B is pressed + */ + private void renderDebugBoundingBox(Entity entityIn, double p_85094_2_, double p_85094_4_, double p_85094_6_, float p_85094_8_, float p_85094_9_) + { + GlStateManager.depthMask(false); + GlStateManager.disableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.disableCull(); + GlStateManager.disableBlend(); + float f = entityIn.width / 2.0F; + AxisAlignedBB axisalignedbb = entityIn.getEntityBoundingBox(); + AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.minX - entityIn.posX + p_85094_2_, axisalignedbb.minY - entityIn.posY + p_85094_4_, axisalignedbb.minZ - entityIn.posZ + p_85094_6_, axisalignedbb.maxX - entityIn.posX + p_85094_2_, axisalignedbb.maxY - entityIn.posY + p_85094_4_, axisalignedbb.maxZ - entityIn.posZ + p_85094_6_); + RenderGlobal.func_181563_a(axisalignedbb1, 255, 255, 255, 255); + + if (entityIn instanceof EntityLivingBase) + { + float f1 = 0.01F; + RenderGlobal.func_181563_a(new AxisAlignedBB(p_85094_2_ - (double)f, p_85094_4_ + (double)entityIn.getEyeHeight() - 0.009999999776482582D, p_85094_6_ - (double)f, p_85094_2_ + (double)f, p_85094_4_ + (double)entityIn.getEyeHeight() + 0.009999999776482582D, p_85094_6_ + (double)f), 255, 0, 0, 255); + } + + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + Vec3 vec3 = entityIn.getLook(p_85094_9_); + worldrenderer.begin(3, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos(p_85094_2_, p_85094_4_ + (double)entityIn.getEyeHeight(), p_85094_6_).color(0, 0, 255, 255).endVertex(); + worldrenderer.pos(p_85094_2_ + vec3.xCoord * 2.0D, p_85094_4_ + (double)entityIn.getEyeHeight() + vec3.yCoord * 2.0D, p_85094_6_ + vec3.zCoord * 2.0D).color(0, 0, 255, 255).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + GlStateManager.enableLighting(); + GlStateManager.enableCull(); + GlStateManager.disableBlend(); + GlStateManager.depthMask(true); + } + + /** + * World sets this RenderManager's worldObj to the world provided + */ + public void set(World worldIn) + { + this.worldObj = worldIn; + } + + public double getDistanceToCamera(double p_78714_1_, double p_78714_3_, double p_78714_5_) + { + double d0 = p_78714_1_ - this.viewerPosX; + double d1 = p_78714_3_ - this.viewerPosY; + double d2 = p_78714_5_ - this.viewerPosZ; + return d0 * d0 + d1 * d1 + d2 * d2; + } + + /** + * Returns the font renderer + */ + public FontRenderer getFontRenderer() + { + return this.textRenderer; + } + + public void setRenderOutlines(boolean renderOutlinesIn) + { + this.renderOutlines = renderOutlinesIn; + } + + public Map getEntityRenderMap() + { + return this.entityRenderMap; + } + + public void setEntityRenderMap(Map p_setEntityRenderMap_1_) + { + this.entityRenderMap = p_setEntityRenderMap_1_; + } + + public Map getSkinMap() + { + return Collections.unmodifiableMap(this.skinMap); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderManager~ b/src/minecraft/net/minecraft/client/renderer/entity/RenderManager~ new file mode 100644 index 0000000..6d403d2 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderManager~ @@ -0,0 +1,494 @@ +package net.minecraft.client.renderer.entity; + +import com.google.common.collect.Maps; +import java.util.Collections; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.model.ModelChicken; +import net.minecraft.client.model.ModelCow; +import net.minecraft.client.model.ModelHorse; +import net.minecraft.client.model.ModelOcelot; +import net.minecraft.client.model.ModelPig; +import net.minecraft.client.model.ModelRabbit; +import net.minecraft.client.model.ModelSheep2; +import net.minecraft.client.model.ModelSlime; +import net.minecraft.client.model.ModelSquid; +import net.minecraft.client.model.ModelWolf; +import net.minecraft.client.model.ModelZombie; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.culling.ICamera; +import net.minecraft.client.renderer.entity.ArmorStandRenderer; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderArrow; +import net.minecraft.client.renderer.entity.RenderBat; +import net.minecraft.client.renderer.entity.RenderBlaze; +import net.minecraft.client.renderer.entity.RenderBoat; +import net.minecraft.client.renderer.entity.RenderCaveSpider; +import net.minecraft.client.renderer.entity.RenderChicken; +import net.minecraft.client.renderer.entity.RenderCow; +import net.minecraft.client.renderer.entity.RenderCreeper; +import net.minecraft.client.renderer.entity.RenderDragon; +import net.minecraft.client.renderer.entity.RenderEnderman; +import net.minecraft.client.renderer.entity.RenderEndermite; +import net.minecraft.client.renderer.entity.RenderEntity; +import net.minecraft.client.renderer.entity.RenderEntityItem; +import net.minecraft.client.renderer.entity.RenderFallingBlock; +import net.minecraft.client.renderer.entity.RenderFireball; +import net.minecraft.client.renderer.entity.RenderFish; +import net.minecraft.client.renderer.entity.RenderGhast; +import net.minecraft.client.renderer.entity.RenderGiantZombie; +import net.minecraft.client.renderer.entity.RenderGuardian; +import net.minecraft.client.renderer.entity.RenderHorse; +import net.minecraft.client.renderer.entity.RenderIronGolem; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.entity.RenderLeashKnot; +import net.minecraft.client.renderer.entity.RenderLightningBolt; +import net.minecraft.client.renderer.entity.RenderMagmaCube; +import net.minecraft.client.renderer.entity.RenderMinecart; +import net.minecraft.client.renderer.entity.RenderMinecartMobSpawner; +import net.minecraft.client.renderer.entity.RenderMooshroom; +import net.minecraft.client.renderer.entity.RenderOcelot; +import net.minecraft.client.renderer.entity.RenderPainting; +import net.minecraft.client.renderer.entity.RenderPig; +import net.minecraft.client.renderer.entity.RenderPigZombie; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.RenderPotion; +import net.minecraft.client.renderer.entity.RenderRabbit; +import net.minecraft.client.renderer.entity.RenderSheep; +import net.minecraft.client.renderer.entity.RenderSilverfish; +import net.minecraft.client.renderer.entity.RenderSkeleton; +import net.minecraft.client.renderer.entity.RenderSlime; +import net.minecraft.client.renderer.entity.RenderSnowMan; +import net.minecraft.client.renderer.entity.RenderSnowball; +import net.minecraft.client.renderer.entity.RenderSpider; +import net.minecraft.client.renderer.entity.RenderSquid; +import net.minecraft.client.renderer.entity.RenderTNTPrimed; +import net.minecraft.client.renderer.entity.RenderTntMinecart; +import net.minecraft.client.renderer.entity.RenderVillager; +import net.minecraft.client.renderer.entity.RenderWitch; +import net.minecraft.client.renderer.entity.RenderWither; +import net.minecraft.client.renderer.entity.RenderWolf; +import net.minecraft.client.renderer.entity.RenderXPOrb; +import net.minecraft.client.renderer.entity.RenderZombie; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.tileentity.RenderEnderCrystal; +import net.minecraft.client.renderer.tileentity.RenderItemFrame; +import net.minecraft.client.renderer.tileentity.RenderWitherSkull; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLeashKnot; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityMinecartMobSpawner; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.entity.item.EntityEnderEye; +import net.minecraft.entity.item.EntityEnderPearl; +import net.minecraft.entity.item.EntityExpBottle; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.entity.item.EntityFireworkRocket; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityMinecartTNT; +import net.minecraft.entity.item.EntityPainting; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.entity.monster.EntityCaveSpider; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntityEndermite; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.monster.EntityGiantZombie; +import net.minecraft.entity.monster.EntityGuardian; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.monster.EntityMagmaCube; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.monster.EntitySilverfish; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.entity.monster.EntitySnowman; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.monster.EntityWitch; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.entity.passive.EntityCow; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.passive.EntityMooshroom; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.passive.EntityRabbit; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityEgg; +import net.minecraft.entity.projectile.EntityFishHook; +import net.minecraft.entity.projectile.EntityLargeFireball; +import net.minecraft.entity.projectile.EntityPotion; +import net.minecraft.entity.projectile.EntitySmallFireball; +import net.minecraft.entity.projectile.EntitySnowball; +import net.minecraft.entity.projectile.EntityWitherSkull; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.src.PlayerItemsLayer; +import net.minecraft.src.Reflector; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ReportedException; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class RenderManager { + private Map field_78729_o = Maps.newHashMap(); + private Map field_178636_l = Maps.newHashMap(); + private RenderPlayer field_178637_m; + private FontRenderer field_78736_p; + private double field_78725_b; + private double field_78726_c; + private double field_78723_d; + public TextureManager field_78724_e; + public World field_78722_g; + public Entity field_78734_h; + public Entity field_147941_i; + public float field_78735_i; + public float field_78732_j; + public GameSettings field_78733_k; + public double field_78730_l; + public double field_78731_m; + public double field_78728_n; + private boolean field_178639_r = false; + private boolean field_178638_s = true; + private boolean field_85095_o = false; + private static final String __OBFID = "CL_00000991"; + + public RenderManager(TextureManager p_i46180_1_, RenderItem p_i46180_2_) { + this.field_78724_e = p_i46180_1_; + this.field_78729_o.put(EntityCaveSpider.class, new RenderCaveSpider(this)); + this.field_78729_o.put(EntitySpider.class, new RenderSpider(this)); + this.field_78729_o.put(EntityPig.class, new RenderPig(this, new ModelPig(), 0.7F)); + this.field_78729_o.put(EntitySheep.class, new RenderSheep(this, new ModelSheep2(), 0.7F)); + this.field_78729_o.put(EntityCow.class, new RenderCow(this, new ModelCow(), 0.7F)); + this.field_78729_o.put(EntityMooshroom.class, new RenderMooshroom(this, new ModelCow(), 0.7F)); + this.field_78729_o.put(EntityWolf.class, new RenderWolf(this, new ModelWolf(), 0.5F)); + this.field_78729_o.put(EntityChicken.class, new RenderChicken(this, new ModelChicken(), 0.3F)); + this.field_78729_o.put(EntityOcelot.class, new RenderOcelot(this, new ModelOcelot(), 0.4F)); + this.field_78729_o.put(EntityRabbit.class, new RenderRabbit(this, new ModelRabbit(), 0.3F)); + this.field_78729_o.put(EntitySilverfish.class, new RenderSilverfish(this)); + this.field_78729_o.put(EntityEndermite.class, new RenderEndermite(this)); + this.field_78729_o.put(EntityCreeper.class, new RenderCreeper(this)); + this.field_78729_o.put(EntityEnderman.class, new RenderEnderman(this)); + this.field_78729_o.put(EntitySnowman.class, new RenderSnowMan(this)); + this.field_78729_o.put(EntitySkeleton.class, new RenderSkeleton(this)); + this.field_78729_o.put(EntityWitch.class, new RenderWitch(this)); + this.field_78729_o.put(EntityBlaze.class, new RenderBlaze(this)); + this.field_78729_o.put(EntityPigZombie.class, new RenderPigZombie(this)); + this.field_78729_o.put(EntityZombie.class, new RenderZombie(this)); + this.field_78729_o.put(EntitySlime.class, new RenderSlime(this, new ModelSlime(16), 0.25F)); + this.field_78729_o.put(EntityMagmaCube.class, new RenderMagmaCube(this)); + this.field_78729_o.put(EntityGiantZombie.class, new RenderGiantZombie(this, new ModelZombie(), 0.5F, 6.0F)); + this.field_78729_o.put(EntityGhast.class, new RenderGhast(this)); + this.field_78729_o.put(EntitySquid.class, new RenderSquid(this, new ModelSquid(), 0.7F)); + this.field_78729_o.put(EntityVillager.class, new RenderVillager(this)); + this.field_78729_o.put(EntityIronGolem.class, new RenderIronGolem(this)); + this.field_78729_o.put(EntityBat.class, new RenderBat(this)); + this.field_78729_o.put(EntityGuardian.class, new RenderGuardian(this)); + this.field_78729_o.put(EntityDragon.class, new RenderDragon(this)); + this.field_78729_o.put(EntityEnderCrystal.class, new RenderEnderCrystal(this)); + this.field_78729_o.put(EntityWither.class, new RenderWither(this)); + this.field_78729_o.put(Entity.class, new RenderEntity(this)); + this.field_78729_o.put(EntityPainting.class, new RenderPainting(this)); + this.field_78729_o.put(EntityItemFrame.class, new RenderItemFrame(this, p_i46180_2_)); + this.field_78729_o.put(EntityLeashKnot.class, new RenderLeashKnot(this)); + this.field_78729_o.put(EntityArrow.class, new RenderArrow(this)); + this.field_78729_o.put(EntitySnowball.class, new RenderSnowball(this, Items.field_151126_ay, p_i46180_2_)); + this.field_78729_o.put(EntityEnderPearl.class, new RenderSnowball(this, Items.field_151079_bi, p_i46180_2_)); + this.field_78729_o.put(EntityEnderEye.class, new RenderSnowball(this, Items.field_151061_bv, p_i46180_2_)); + this.field_78729_o.put(EntityEgg.class, new RenderSnowball(this, Items.field_151110_aK, p_i46180_2_)); + this.field_78729_o.put(EntityPotion.class, new RenderPotion(this, p_i46180_2_)); + this.field_78729_o.put(EntityExpBottle.class, new RenderSnowball(this, Items.field_151062_by, p_i46180_2_)); + this.field_78729_o.put(EntityFireworkRocket.class, new RenderSnowball(this, Items.field_151152_bP, p_i46180_2_)); + this.field_78729_o.put(EntityLargeFireball.class, new RenderFireball(this, 2.0F)); + this.field_78729_o.put(EntitySmallFireball.class, new RenderFireball(this, 0.5F)); + this.field_78729_o.put(EntityWitherSkull.class, new RenderWitherSkull(this)); + this.field_78729_o.put(EntityItem.class, new RenderEntityItem(this, p_i46180_2_)); + this.field_78729_o.put(EntityXPOrb.class, new RenderXPOrb(this)); + this.field_78729_o.put(EntityTNTPrimed.class, new RenderTNTPrimed(this)); + this.field_78729_o.put(EntityFallingBlock.class, new RenderFallingBlock(this)); + this.field_78729_o.put(EntityArmorStand.class, new ArmorStandRenderer(this)); + this.field_78729_o.put(EntityMinecartTNT.class, new RenderTntMinecart(this)); + this.field_78729_o.put(EntityMinecartMobSpawner.class, new RenderMinecartMobSpawner(this)); + this.field_78729_o.put(EntityMinecart.class, new RenderMinecart(this)); + this.field_78729_o.put(EntityBoat.class, new RenderBoat(this)); + this.field_78729_o.put(EntityFishHook.class, new RenderFish(this)); + this.field_78729_o.put(EntityHorse.class, new RenderHorse(this, new ModelHorse(), 0.75F)); + this.field_78729_o.put(EntityLightningBolt.class, new RenderLightningBolt(this)); + this.field_178637_m = new RenderPlayer(this); + this.field_178636_l.put("default", this.field_178637_m); + this.field_178636_l.put("slim", new RenderPlayer(this, true)); + PlayerItemsLayer.register(this.field_178636_l); + if(Reflector.RenderingRegistry_loadEntityRenderers.exists()) { + Reflector.call(Reflector.RenderingRegistry_loadEntityRenderers, new Object[]{this.field_78729_o}); + } + + } + + public void func_178628_a(double p_178628_1_, double p_178628_3_, double p_178628_5_) { + this.field_78725_b = p_178628_1_; + this.field_78726_c = p_178628_3_; + this.field_78723_d = p_178628_5_; + } + + public Render func_78715_a(Class p_78715_1_) { + Render render = (Render)this.field_78729_o.get(p_78715_1_); + if(render == null && p_78715_1_ != Entity.class) { + render = this.func_78715_a(p_78715_1_.getSuperclass()); + this.field_78729_o.put(p_78715_1_, render); + } + + return render; + } + + public Render func_78713_a(Entity p_78713_1_) { + if(p_78713_1_ instanceof AbstractClientPlayer) { + String s = ((AbstractClientPlayer)p_78713_1_).func_175154_l(); + RenderPlayer renderplayer = (RenderPlayer)this.field_178636_l.get(s); + return renderplayer != null?renderplayer:this.field_178637_m; + } else { + return this.func_78715_a(p_78713_1_.getClass()); + } + } + + public void func_180597_a(World p_180597_1_, FontRenderer p_180597_2_, Entity p_180597_3_, Entity p_180597_4_, GameSettings p_180597_5_, float p_180597_6_) { + this.field_78722_g = p_180597_1_; + this.field_78733_k = p_180597_5_; + this.field_78734_h = p_180597_3_; + this.field_147941_i = p_180597_4_; + this.field_78736_p = p_180597_2_; + if(p_180597_3_ instanceof EntityLivingBase && ((EntityLivingBase)p_180597_3_).func_70608_bn()) { + IBlockState iblockstate = p_180597_1_.func_180495_p(new BlockPos(p_180597_3_)); + Block block = iblockstate.func_177230_c(); + if(Reflector.callBoolean(Reflector.ForgeBlock_isBed, new Object[]{p_180597_1_, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_})) { + EnumFacing enumfacing = (EnumFacing)Reflector.call(block, Reflector.ForgeBlock_getBedDirection, new Object[]{p_180597_1_, new BlockPos(p_180597_3_)}); + int i = enumfacing.func_176736_b(); + this.field_78735_i = (float)(i * 90 + 180); + this.field_78732_j = 0.0F; + } else if(block == Blocks.field_150324_C) { + int j = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_176387_N)).func_176736_b(); + this.field_78735_i = (float)(j * 90 + 180); + this.field_78732_j = 0.0F; + } + } else { + this.field_78735_i = p_180597_3_.field_70126_B + (p_180597_3_.field_70177_z - p_180597_3_.field_70126_B) * p_180597_6_; + this.field_78732_j = p_180597_3_.field_70127_C + (p_180597_3_.field_70125_A - p_180597_3_.field_70127_C) * p_180597_6_; + } + + if(p_180597_5_.field_74320_O == 2) { + this.field_78735_i += 180.0F; + } + + this.field_78730_l = p_180597_3_.field_70142_S + (p_180597_3_.field_70165_t - p_180597_3_.field_70142_S) * (double)p_180597_6_; + this.field_78731_m = p_180597_3_.field_70137_T + (p_180597_3_.field_70163_u - p_180597_3_.field_70137_T) * (double)p_180597_6_; + this.field_78728_n = p_180597_3_.field_70136_U + (p_180597_3_.field_70161_v - p_180597_3_.field_70136_U) * (double)p_180597_6_; + } + + public void func_178631_a(float p_178631_1_) { + this.field_78735_i = p_178631_1_; + } + + public boolean func_178627_a() { + return this.field_178638_s; + } + + public void func_178633_a(boolean p_178633_1_) { + this.field_178638_s = p_178633_1_; + } + + public void func_178629_b(boolean p_178629_1_) { + this.field_85095_o = p_178629_1_; + } + + public boolean func_178634_b() { + return this.field_85095_o; + } + + public boolean func_147937_a(Entity p_147937_1_, float p_147937_2_) { + return this.func_147936_a(p_147937_1_, p_147937_2_, false); + } + + public boolean func_178635_a(Entity p_178635_1_, ICamera p_178635_2_, double p_178635_3_, double p_178635_5_, double p_178635_7_) { + Render render = this.func_78713_a(p_178635_1_); + return render != null && render.func_177071_a(p_178635_1_, p_178635_2_, p_178635_3_, p_178635_5_, p_178635_7_); + } + + public boolean func_147936_a(Entity p_147936_1_, float p_147936_2_, boolean p_147936_3_) { + if(p_147936_1_.field_70173_aa == 0) { + p_147936_1_.field_70142_S = p_147936_1_.field_70165_t; + p_147936_1_.field_70137_T = p_147936_1_.field_70163_u; + p_147936_1_.field_70136_U = p_147936_1_.field_70161_v; + } + + double d0 = p_147936_1_.field_70142_S + (p_147936_1_.field_70165_t - p_147936_1_.field_70142_S) * (double)p_147936_2_; + double d1 = p_147936_1_.field_70137_T + (p_147936_1_.field_70163_u - p_147936_1_.field_70137_T) * (double)p_147936_2_; + double d2 = p_147936_1_.field_70136_U + (p_147936_1_.field_70161_v - p_147936_1_.field_70136_U) * (double)p_147936_2_; + float f = p_147936_1_.field_70126_B + (p_147936_1_.field_70177_z - p_147936_1_.field_70126_B) * p_147936_2_; + int i = p_147936_1_.func_70070_b(p_147936_2_); + if(p_147936_1_.func_70027_ad()) { + i = 15728880; + } + + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.func_77475_a(OpenGlHelper.field_77476_b, (float)j / 1.0F, (float)k / 1.0F); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + return this.func_147939_a(p_147936_1_, d0 - this.field_78725_b, d1 - this.field_78726_c, d2 - this.field_78723_d, f, p_147936_2_, p_147936_3_); + } + + public void func_178630_b(Entity p_178630_1_, float p_178630_2_) { + double d0 = p_178630_1_.field_70142_S + (p_178630_1_.field_70165_t - p_178630_1_.field_70142_S) * (double)p_178630_2_; + double d1 = p_178630_1_.field_70137_T + (p_178630_1_.field_70163_u - p_178630_1_.field_70137_T) * (double)p_178630_2_; + double d2 = p_178630_1_.field_70136_U + (p_178630_1_.field_70161_v - p_178630_1_.field_70136_U) * (double)p_178630_2_; + Render render = this.func_78713_a(p_178630_1_); + if(render != null && this.field_78724_e != null) { + int i = p_178630_1_.func_70070_b(p_178630_2_); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.func_77475_a(OpenGlHelper.field_77476_b, (float)j / 1.0F, (float)k / 1.0F); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + render.func_177067_a(p_178630_1_, d0 - this.field_78725_b, d1 - this.field_78726_c, d2 - this.field_78723_d); + } + + } + + public boolean func_147940_a(Entity p_147940_1_, double p_147940_2_, double p_147940_4_, double p_147940_6_, float p_147940_8_, float p_147940_9_) { + return this.func_147939_a(p_147940_1_, p_147940_2_, p_147940_4_, p_147940_6_, p_147940_8_, p_147940_9_, false); + } + + public boolean func_147939_a(Entity p_147939_1_, double p_147939_2_, double p_147939_4_, double p_147939_6_, float p_147939_8_, float p_147939_9_, boolean p_147939_10_) { + Render render = null; + + try { + render = this.func_78713_a(p_147939_1_); + if(render != null && this.field_78724_e != null) { + try { + if(render instanceof RendererLivingEntity) { + ((RendererLivingEntity)render).func_177086_a(this.field_178639_r); + } + + render.func_76986_a(p_147939_1_, p_147939_2_, p_147939_4_, p_147939_6_, p_147939_8_, p_147939_9_); + } catch (Throwable throwable2) { + throw new ReportedException(CrashReport.func_85055_a(throwable2, "Rendering entity in world")); + } + + try { + if(!this.field_178639_r) { + render.func_76979_b(p_147939_1_, p_147939_2_, p_147939_4_, p_147939_6_, p_147939_8_, p_147939_9_); + } + } catch (Throwable throwable1) { + throw new ReportedException(CrashReport.func_85055_a(throwable1, "Post-rendering entity in world")); + } + + if(this.field_85095_o && !p_147939_1_.func_82150_aj() && !p_147939_10_) { + try { + this.func_85094_b(p_147939_1_, p_147939_2_, p_147939_4_, p_147939_6_, p_147939_8_, p_147939_9_); + } catch (Throwable throwable) { + throw new ReportedException(CrashReport.func_85055_a(throwable, "Rendering entity hitbox in world")); + } + } + } else if(this.field_78724_e != null) { + return false; + } + + return true; + } catch (Throwable throwable3) { + CrashReport crashreport = CrashReport.func_85055_a(throwable3, "Rendering entity in world"); + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Entity being rendered"); + p_147939_1_.func_85029_a(crashreportcategory); + CrashReportCategory crashreportcategory1 = crashreport.func_85058_a("Renderer details"); + crashreportcategory1.func_71507_a("Assigned renderer", render); + crashreportcategory1.func_71507_a("Location", CrashReportCategory.func_85074_a(p_147939_2_, p_147939_4_, p_147939_6_)); + crashreportcategory1.func_71507_a("Rotation", Float.valueOf(p_147939_8_)); + crashreportcategory1.func_71507_a("Delta", Float.valueOf(p_147939_9_)); + throw new ReportedException(crashreport); + } + } + + private void func_85094_b(Entity p_85094_1_, double p_85094_2_, double p_85094_4_, double p_85094_6_, float p_85094_8_, float p_85094_9_) { + GlStateManager.func_179132_a(false); + GlStateManager.func_179090_x(); + GlStateManager.func_179140_f(); + GlStateManager.func_179129_p(); + GlStateManager.func_179084_k(); + float f = p_85094_1_.field_70130_N / 2.0F; + AxisAlignedBB axisalignedbb = p_85094_1_.func_174813_aQ(); + AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.field_72340_a - p_85094_1_.field_70165_t + p_85094_2_, axisalignedbb.field_72338_b - p_85094_1_.field_70163_u + p_85094_4_, axisalignedbb.field_72339_c - p_85094_1_.field_70161_v + p_85094_6_, axisalignedbb.field_72336_d - p_85094_1_.field_70165_t + p_85094_2_, axisalignedbb.field_72337_e - p_85094_1_.field_70163_u + p_85094_4_, axisalignedbb.field_72334_f - p_85094_1_.field_70161_v + p_85094_6_); + RenderGlobal.func_181563_a(axisalignedbb1, 255, 255, 255, 255); + if(p_85094_1_ instanceof EntityLivingBase) { + float f1 = 0.01F; + RenderGlobal.func_181563_a(new AxisAlignedBB(p_85094_2_ - (double)f, p_85094_4_ + (double)p_85094_1_.func_70047_e() - 0.009999999776482582D, p_85094_6_ - (double)f, p_85094_2_ + (double)f, p_85094_4_ + (double)p_85094_1_.func_70047_e() + 0.009999999776482582D, p_85094_6_ + (double)f), 255, 0, 0, 255); + } + + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + Vec3 vec3 = p_85094_1_.func_70676_i(p_85094_9_); + worldrenderer.func_181668_a(3, DefaultVertexFormats.field_181706_f); + worldrenderer.func_181662_b(p_85094_2_, p_85094_4_ + (double)p_85094_1_.func_70047_e(), p_85094_6_).func_181669_b(0, 0, 255, 255).func_181675_d(); + worldrenderer.func_181662_b(p_85094_2_ + vec3.field_72450_a * 2.0D, p_85094_4_ + (double)p_85094_1_.func_70047_e() + vec3.field_72448_b * 2.0D, p_85094_6_ + vec3.field_72449_c * 2.0D).func_181669_b(0, 0, 255, 255).func_181675_d(); + tessellator.func_78381_a(); + GlStateManager.func_179098_w(); + GlStateManager.func_179145_e(); + GlStateManager.func_179089_o(); + GlStateManager.func_179084_k(); + GlStateManager.func_179132_a(true); + } + + public void func_78717_a(World p_78717_1_) { + this.field_78722_g = p_78717_1_; + } + + public double func_78714_a(double p_78714_1_, double p_78714_3_, double p_78714_5_) { + double d0 = p_78714_1_ - this.field_78730_l; + double d1 = p_78714_3_ - this.field_78731_m; + double d2 = p_78714_5_ - this.field_78728_n; + return d0 * d0 + d1 * d1 + d2 * d2; + } + + public FontRenderer func_78716_a() { + return this.field_78736_p; + } + + public void func_178632_c(boolean p_178632_1_) { + this.field_178639_r = p_178632_1_; + } + + public Map getEntityRenderMap() { + return this.field_78729_o; + } + + public void setEntityRenderMap(Map p_setEntityRenderMap_1_) { + this.field_78729_o = p_setEntityRenderMap_1_; + } + + public Map getSkinMap() { + return Collections.unmodifiableMap(this.field_178636_l); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderMinecart.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderMinecart.java new file mode 100644 index 0000000..84f31e4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderMinecart.java @@ -0,0 +1,130 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelMinecart; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; + +public class RenderMinecart extends Render +{ + private static final ResourceLocation minecartTextures = new ResourceLocation("textures/entity/minecart.png"); + + /** instance of ModelMinecart for rendering */ + protected ModelBase modelMinecart = new ModelMinecart(); + + public RenderMinecart(RenderManager renderManagerIn) + { + super(renderManagerIn); + this.shadowSize = 0.5F; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) + { + GlStateManager.pushMatrix(); + this.bindEntityTexture(entity); + long i = (long)entity.getEntityId() * 493286711L; + i = i * i * 4392167121L + i * 98761L; + float f = (((float)(i >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + float f1 = (((float)(i >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + float f2 = (((float)(i >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; + GlStateManager.translate(f, f1, f2); + double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; + double d3 = 0.30000001192092896D; + Vec3 vec3 = entity.func_70489_a(d0, d1, d2); + float f3 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks; + + if (vec3 != null) + { + Vec3 vec31 = entity.func_70495_a(d0, d1, d2, d3); + Vec3 vec32 = entity.func_70495_a(d0, d1, d2, -d3); + + if (vec31 == null) + { + vec31 = vec3; + } + + if (vec32 == null) + { + vec32 = vec3; + } + + x += vec3.xCoord - d0; + y += (vec31.yCoord + vec32.yCoord) / 2.0D - d1; + z += vec3.zCoord - d2; + Vec3 vec33 = vec32.addVector(-vec31.xCoord, -vec31.yCoord, -vec31.zCoord); + + if (vec33.lengthVector() != 0.0D) + { + vec33 = vec33.normalize(); + entityYaw = (float)(Math.atan2(vec33.zCoord, vec33.xCoord) * 180.0D / Math.PI); + f3 = (float)(Math.atan(vec33.yCoord) * 73.0D); + } + } + + GlStateManager.translate((float)x, (float)y + 0.375F, (float)z); + GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-f3, 0.0F, 0.0F, 1.0F); + float f5 = (float)entity.getRollingAmplitude() - partialTicks; + float f6 = entity.getDamage() - partialTicks; + + if (f6 < 0.0F) + { + f6 = 0.0F; + } + + if (f5 > 0.0F) + { + GlStateManager.rotate(MathHelper.sin(f5) * f5 * f6 / 10.0F * (float)entity.getRollingDirection(), 1.0F, 0.0F, 0.0F); + } + + int j = entity.getDisplayTileOffset(); + IBlockState iblockstate = entity.getDisplayTile(); + + if (iblockstate.getBlock().getRenderType() != -1) + { + GlStateManager.pushMatrix(); + this.bindTexture(TextureMap.locationBlocksTexture); + float f4 = 0.75F; + GlStateManager.scale(f4, f4, f4); + GlStateManager.translate(-0.5F, (float)(j - 8) / 16.0F, 0.5F); + this.func_180560_a(entity, partialTicks, iblockstate); + GlStateManager.popMatrix(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.bindEntityTexture(entity); + } + + GlStateManager.scale(-1.0F, -1.0F, 1.0F); + this.modelMinecart.render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(T entity) + { + return minecartTextures; + } + + protected void func_180560_a(T minecart, float partialTicks, IBlockState state) + { + GlStateManager.pushMatrix(); + Minecraft.getMinecraft().getBlockRendererDispatcher().renderBlockBrightness(state, minecart.getBrightness(partialTicks)); + GlStateManager.popMatrix(); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderMinecartMobSpawner.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderMinecartMobSpawner.java new file mode 100644 index 0000000..7d2257e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderMinecartMobSpawner.java @@ -0,0 +1,24 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.tileentity.TileEntityMobSpawnerRenderer; +import net.minecraft.entity.ai.EntityMinecartMobSpawner; +import net.minecraft.init.Blocks; + +public class RenderMinecartMobSpawner extends RenderMinecart +{ + public RenderMinecartMobSpawner(RenderManager renderManagerIn) + { + super(renderManagerIn); + } + + protected void func_180560_a(EntityMinecartMobSpawner minecart, float partialTicks, IBlockState state) + { + super.func_180560_a(minecart, partialTicks, state); + + if (state.getBlock() == Blocks.mob_spawner) + { + TileEntityMobSpawnerRenderer.renderMob(minecart.func_98039_d(), minecart.posX, minecart.posY, minecart.posZ, partialTicks); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderMooshroom.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderMooshroom.java new file mode 100644 index 0000000..f6b1c6e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderMooshroom.java @@ -0,0 +1,25 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.layers.LayerMooshroomMushroom; +import net.minecraft.entity.passive.EntityMooshroom; +import net.minecraft.util.ResourceLocation; + +public class RenderMooshroom extends RenderLiving +{ + private static final ResourceLocation mooshroomTextures = new ResourceLocation("textures/entity/cow/mooshroom.png"); + + public RenderMooshroom(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn, modelBaseIn, shadowSizeIn); + this.addLayer(new LayerMooshroomMushroom(this)); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityMooshroom entity) + { + return mooshroomTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderOcelot.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderOcelot.java new file mode 100644 index 0000000..de19259 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderOcelot.java @@ -0,0 +1,55 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.util.ResourceLocation; + +public class RenderOcelot extends RenderLiving +{ + private static final ResourceLocation blackOcelotTextures = new ResourceLocation("textures/entity/cat/black.png"); + private static final ResourceLocation ocelotTextures = new ResourceLocation("textures/entity/cat/ocelot.png"); + private static final ResourceLocation redOcelotTextures = new ResourceLocation("textures/entity/cat/red.png"); + private static final ResourceLocation siameseOcelotTextures = new ResourceLocation("textures/entity/cat/siamese.png"); + + public RenderOcelot(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn, modelBaseIn, shadowSizeIn); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityOcelot entity) + { + switch (entity.getTameSkin()) + { + case 0: + default: + return ocelotTextures; + + case 1: + return blackOcelotTextures; + + case 2: + return redOcelotTextures; + + case 3: + return siameseOcelotTextures; + } + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityOcelot entitylivingbaseIn, float partialTickTime) + { + super.preRenderCallback(entitylivingbaseIn, partialTickTime); + + if (entitylivingbaseIn.isTamed()) + { + GlStateManager.scale(0.8F, 0.8F, 0.8F); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderPainting.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderPainting.java new file mode 100644 index 0000000..9a2e0c4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderPainting.java @@ -0,0 +1,149 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.item.EntityPainting; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class RenderPainting extends Render +{ + private static final ResourceLocation KRISTOFFER_PAINTING_TEXTURE = new ResourceLocation("textures/painting/paintings_kristoffer_zetterstrand.png"); + + public RenderPainting(RenderManager renderManagerIn) + { + super(renderManagerIn); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityPainting entity, double x, double y, double z, float entityYaw, float partialTicks) + { + GlStateManager.pushMatrix(); + GlStateManager.translate(x, y, z); + GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F); + GlStateManager.enableRescaleNormal(); + this.bindEntityTexture(entity); + EntityPainting.EnumArt entitypainting$enumart = entity.art; + float f = 0.0625F; + GlStateManager.scale(f, f, f); + this.renderPainting(entity, entitypainting$enumart.sizeX, entitypainting$enumart.sizeY, entitypainting$enumart.offsetX, entitypainting$enumart.offsetY); + GlStateManager.disableRescaleNormal(); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityPainting entity) + { + return KRISTOFFER_PAINTING_TEXTURE; + } + + private void renderPainting(EntityPainting painting, int width, int height, int textureU, int textureV) + { + float f = (float)(-width) / 2.0F; + float f1 = (float)(-height) / 2.0F; + float f2 = 0.5F; + float f3 = 0.75F; + float f4 = 0.8125F; + float f5 = 0.0F; + float f6 = 0.0625F; + float f7 = 0.75F; + float f8 = 0.8125F; + float f9 = 0.001953125F; + float f10 = 0.001953125F; + float f11 = 0.7519531F; + float f12 = 0.7519531F; + float f13 = 0.0F; + float f14 = 0.0625F; + + for (int i = 0; i < width / 16; ++i) + { + for (int j = 0; j < height / 16; ++j) + { + float f15 = f + (float)((i + 1) * 16); + float f16 = f + (float)(i * 16); + float f17 = f1 + (float)((j + 1) * 16); + float f18 = f1 + (float)(j * 16); + this.setLightmap(painting, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F); + float f19 = (float)(textureU + width - i * 16) / 256.0F; + float f20 = (float)(textureU + width - (i + 1) * 16) / 256.0F; + float f21 = (float)(textureV + height - j * 16) / 256.0F; + float f22 = (float)(textureV + height - (j + 1) * 16) / 256.0F; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL); + worldrenderer.pos((double)f15, (double)f18, (double)(-f2)).tex((double)f20, (double)f21).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos((double)f16, (double)f18, (double)(-f2)).tex((double)f19, (double)f21).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos((double)f16, (double)f17, (double)(-f2)).tex((double)f19, (double)f22).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos((double)f15, (double)f17, (double)(-f2)).tex((double)f20, (double)f22).normal(0.0F, 0.0F, -1.0F).endVertex(); + worldrenderer.pos((double)f15, (double)f17, (double)f2).tex((double)f3, (double)f5).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos((double)f16, (double)f17, (double)f2).tex((double)f4, (double)f5).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos((double)f16, (double)f18, (double)f2).tex((double)f4, (double)f6).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos((double)f15, (double)f18, (double)f2).tex((double)f3, (double)f6).normal(0.0F, 0.0F, 1.0F).endVertex(); + worldrenderer.pos((double)f15, (double)f17, (double)(-f2)).tex((double)f7, (double)f9).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f16, (double)f17, (double)(-f2)).tex((double)f8, (double)f9).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f16, (double)f17, (double)f2).tex((double)f8, (double)f10).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f15, (double)f17, (double)f2).tex((double)f7, (double)f10).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f15, (double)f18, (double)f2).tex((double)f7, (double)f9).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f16, (double)f18, (double)f2).tex((double)f8, (double)f9).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f16, (double)f18, (double)(-f2)).tex((double)f8, (double)f10).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f15, (double)f18, (double)(-f2)).tex((double)f7, (double)f10).normal(0.0F, -1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f15, (double)f17, (double)f2).tex((double)f12, (double)f13).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f15, (double)f18, (double)f2).tex((double)f12, (double)f14).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f15, (double)f18, (double)(-f2)).tex((double)f11, (double)f14).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f15, (double)f17, (double)(-f2)).tex((double)f11, (double)f13).normal(-1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f16, (double)f17, (double)(-f2)).tex((double)f12, (double)f13).normal(1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f16, (double)f18, (double)(-f2)).tex((double)f12, (double)f14).normal(1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f16, (double)f18, (double)f2).tex((double)f11, (double)f14).normal(1.0F, 0.0F, 0.0F).endVertex(); + worldrenderer.pos((double)f16, (double)f17, (double)f2).tex((double)f11, (double)f13).normal(1.0F, 0.0F, 0.0F).endVertex(); + tessellator.draw(); + } + } + } + + private void setLightmap(EntityPainting painting, float p_77008_2_, float p_77008_3_) + { + int i = MathHelper.floor_double(painting.posX); + int j = MathHelper.floor_double(painting.posY + (double)(p_77008_3_ / 16.0F)); + int k = MathHelper.floor_double(painting.posZ); + EnumFacing enumfacing = painting.facingDirection; + + if (enumfacing == EnumFacing.NORTH) + { + i = MathHelper.floor_double(painting.posX + (double)(p_77008_2_ / 16.0F)); + } + + if (enumfacing == EnumFacing.WEST) + { + k = MathHelper.floor_double(painting.posZ - (double)(p_77008_2_ / 16.0F)); + } + + if (enumfacing == EnumFacing.SOUTH) + { + i = MathHelper.floor_double(painting.posX - (double)(p_77008_2_ / 16.0F)); + } + + if (enumfacing == EnumFacing.EAST) + { + k = MathHelper.floor_double(painting.posZ + (double)(p_77008_2_ / 16.0F)); + } + + int l = this.renderManager.worldObj.getCombinedLight(new BlockPos(i, j, k), 0); + int i1 = l % 65536; + int j1 = l / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1); + GlStateManager.color(1.0F, 1.0F, 1.0F); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderPig.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderPig.java new file mode 100644 index 0000000..5e11077 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderPig.java @@ -0,0 +1,25 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.layers.LayerSaddle; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.util.ResourceLocation; + +public class RenderPig extends RenderLiving +{ + private static final ResourceLocation pigTextures = new ResourceLocation("textures/entity/pig/pig.png"); + + public RenderPig(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn, modelBaseIn, shadowSizeIn); + this.addLayer(new LayerSaddle(this)); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityPig entity) + { + return pigTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderPigZombie.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderPigZombie.java new file mode 100644 index 0000000..79b2463 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderPigZombie.java @@ -0,0 +1,34 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelZombie; +import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; +import net.minecraft.client.renderer.entity.layers.LayerHeldItem; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.util.ResourceLocation; + +public class RenderPigZombie extends RenderBiped +{ + private static final ResourceLocation ZOMBIE_PIGMAN_TEXTURE = new ResourceLocation("textures/entity/zombie_pigman.png"); + + public RenderPigZombie(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelZombie(), 0.5F, 1.0F); + this.addLayer(new LayerHeldItem(this)); + this.addLayer(new LayerBipedArmor(this) + { + protected void initArmor() + { + this.field_177189_c = new ModelZombie(0.5F, true); + this.field_177186_d = new ModelZombie(1.0F, true); + } + }); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityPigZombie entity) + { + return ZOMBIE_PIGMAN_TEXTURE; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java new file mode 100644 index 0000000..1461290 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java @@ -0,0 +1,241 @@ +package net.minecraft.client.renderer.entity; + +import animeware.cosmetic.impl.Bandana; +import animeware.cosmetic.impl.Cape; +import animeware.cosmetic.impl.CatEars; +import animeware.cosmetic.impl.ChinaHat; +import animeware.cosmetic.impl.CosmeticBlaze; +import animeware.cosmetic.impl.CosmeticCreeperLightning; +import animeware.cosmetic.impl.CosmeticCrystalWings; +import animeware.cosmetic.impl.CosmeticEasterEgg; +import animeware.cosmetic.impl.CosmeticEnchantingGlint; +import animeware.cosmetic.impl.CosmeticEnderCrystal; +import animeware.cosmetic.impl.CosmeticGlasses; +import animeware.cosmetic.impl.CosmeticSheepWool; +import animeware.cosmetic.impl.CosmeticSusanno; +import animeware.cosmetic.impl.CosmeticWings; +import animeware.cosmetic.impl.CosmeticWitchHat; +import animeware.cosmetic.impl.CosmeticWither; +import animeware.cosmetic.impl.CosmeticWitherArmor; +import animeware.cosmetic.impl.CosmeticWitherpet; +import animeware.cosmetic.impl.DogPet; +import animeware.cosmetic.impl.GalaxyWings; +import animeware.cosmetic.impl.Halo; +import animeware.cosmetic.impl.TopHat; +import animeware.cosmetic.impl.eyes.CosmeticEyes; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.model.ModelPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.layers.LayerArrow; +import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; +import net.minecraft.client.renderer.entity.layers.LayerCape; +import net.minecraft.client.renderer.entity.layers.LayerCustomHead; +import net.minecraft.client.renderer.entity.layers.LayerDeadmau5Head; +import net.minecraft.client.renderer.entity.layers.LayerHeldItem; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.item.EnumAction; +import net.minecraft.item.ItemStack; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.util.ResourceLocation; + +public class RenderPlayer extends RendererLivingEntity { + /** this field is used to indicate the 3-pixel wide arms */ + private boolean smallArms; + + public RenderPlayer(RenderManager renderManager) { + this(renderManager, false); + } + + + public RenderPlayer(RenderManager renderManager, boolean useSmallArms) { + super(renderManager, new ModelPlayer(0.0F, useSmallArms), 0.5F); + this.smallArms = useSmallArms; + this.addLayer(new LayerBipedArmor(this)); + this.addLayer(new LayerHeldItem(this)); + this.addLayer(new LayerArrow(this)); + this.addLayer(new LayerDeadmau5Head(this)); + + this.addLayer(new LayerCape(this)); + //this.addLayer(new Cape(this)); + this.addLayer(new CosmeticWings(this)); + this.addLayer(new GalaxyWings(this)); + this.addLayer(new Halo(this)); + this.addLayer(new TopHat(this)); + this.addLayer(new CosmeticEasterEgg(this)); + this.addLayer(new CosmeticGlasses(this)); + //this.addLayer(new CosmeticSusanoo(this)); + //this.addLayer(new RenderBandana(this)); + this.addLayer(new CosmeticWitchHat(this)); + //this.addLayer(new CosmeticDogPet(this)); + this.addLayer(new CosmeticCrystalWings(this)); + this.addLayer(new CosmeticEyes(this)); + this.addLayer(new CosmeticBlaze(this)); + this.addLayer(new Bandana(this)); + + //this.addLayer(new CosmeticCreeperLightning(null)); + this.addLayer(new CosmeticEnchantingGlint(this)); + //this.addLayer(new CosmeticEnderCrystal(this)); + //this.addLayer(new CosmeticSheepWool(this, null)); + //this.addLayer(new CosmeticSheepWool(this));\ + + //this.addLayer(new CosmeticSusanno(this)); + //this.addLayer(new CosmeticWither(this)); + //this.addLayer(new CosmeticWitherArmor(this)); + this.addLayer(new CosmeticWitherpet(this)); + this.addLayer(new CatEars(this)); + this.addLayer(new ChinaHat(this)); + + //this.addLayer(new DogPet(this)); + + this.addLayer(new LayerCustomHead(this.getMainModel().bipedHead)); + } + + public ModelPlayer getMainModel() { + return (ModelPlayer) super.getMainModel(); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, + * always casting down its argument and then handing it off to a worker + * function which does the actual work. In all probabilty, the class Render + * is generic (Render) and this method has signature + * public void doRender(T entity, double d, double d1, double d2, float f, + * float f1). But JAD is pre 1.5 so doe + */ + public void doRender(AbstractClientPlayer entity, double x, double y, double z, float entityYaw, + float partialTicks) { + if (!entity.isUser() || this.renderManager.livingPlayer == entity) { + double d0 = y; + + if (entity.isSneaking() && !(entity instanceof EntityPlayerSP)) { + d0 = y - 0.125D; + } + + this.setModelVisibilities(entity); + super.doRender(entity, x, d0, z, entityYaw, partialTicks); + } + } + + private void setModelVisibilities(AbstractClientPlayer clientPlayer) { + ModelPlayer modelplayer = this.getMainModel(); + + if (clientPlayer.isSpectator()) { + modelplayer.setInvisible(false); + modelplayer.bipedHead.showModel = true; + modelplayer.bipedHeadwear.showModel = true; + } else { + ItemStack itemstack = clientPlayer.inventory.getCurrentItem(); + modelplayer.setInvisible(true); + modelplayer.bipedHeadwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.HAT); + modelplayer.bipedBodyWear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.JACKET); + modelplayer.bipedLeftLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_PANTS_LEG); + modelplayer.bipedRightLegwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_PANTS_LEG); + modelplayer.bipedLeftArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.LEFT_SLEEVE); + modelplayer.bipedRightArmwear.showModel = clientPlayer.isWearing(EnumPlayerModelParts.RIGHT_SLEEVE); + modelplayer.heldItemLeft = 0; + modelplayer.aimedBow = false; + modelplayer.isSneak = clientPlayer.isSneaking(); + + if (itemstack == null) { + modelplayer.heldItemRight = 0; + } else { + modelplayer.heldItemRight = 1; + + if (clientPlayer.getItemInUseCount() > 0) { + EnumAction enumaction = itemstack.getItemUseAction(); + + if (enumaction == EnumAction.BLOCK) { + modelplayer.heldItemRight = 3; + } else if (enumaction == EnumAction.BOW) { + modelplayer.aimedBow = true; + } + } + } + } + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called + * unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(AbstractClientPlayer entity) { + return entity.getLocationSkin(); + } + + public void transformHeldFull3DItemLayer() { + GlStateManager.translate(0.0F, 0.1875F, 0.0F); + } + + /** + * Allows the render to do any OpenGL state modifications necessary before + * the model is rendered. Args: entityLiving, partialTickTime + */ + protected void preRenderCallback(AbstractClientPlayer entitylivingbaseIn, float partialTickTime) { + float f = 0.9375F; + GlStateManager.scale(f, f, f); + } + + protected void renderOffsetLivingLabel(AbstractClientPlayer entityIn, double x, double y, double z, String str, + float p_177069_9_, double p_177069_10_) { + if (p_177069_10_ < 100.0D) { + Scoreboard scoreboard = entityIn.getWorldScoreboard(); + ScoreObjective scoreobjective = scoreboard.getObjectiveInDisplaySlot(2); + + if (scoreobjective != null) { + Score score = scoreboard.getValueFromObjective(entityIn.getName(), scoreobjective); + this.renderLivingLabel(entityIn, score.getScorePoints() + " " + scoreobjective.getDisplayName(), x, y, + z, 64); + y += (double) ((float) this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * p_177069_9_); + } + } + + super.renderOffsetLivingLabel(entityIn, x, y, z, str, p_177069_9_, p_177069_10_); + } + + public void renderRightArm(AbstractClientPlayer clientPlayer) { + float f = 1.0F; + GlStateManager.color(f, f, f); + ModelPlayer modelplayer = this.getMainModel(); + this.setModelVisibilities(clientPlayer); + modelplayer.swingProgress = 0.0F; + modelplayer.isSneak = false; + modelplayer.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, clientPlayer); + modelplayer.renderRightArm(); + } + + public void renderLeftArm(AbstractClientPlayer clientPlayer) { + float f = 1.0F; + GlStateManager.color(f, f, f); + ModelPlayer modelplayer = this.getMainModel(); + this.setModelVisibilities(clientPlayer); + modelplayer.isSneak = false; + modelplayer.swingProgress = 0.0F; + modelplayer.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, clientPlayer); + modelplayer.renderLeftArm(); + } + + /** + * Sets a simple glTranslate on a LivingEntity. + */ + protected void renderLivingAt(AbstractClientPlayer entityLivingBaseIn, double x, double y, double z) { + if (entityLivingBaseIn.isEntityAlive() && entityLivingBaseIn.isPlayerSleeping()) { + super.renderLivingAt(entityLivingBaseIn, x + (double) entityLivingBaseIn.renderOffsetX, + y + (double) entityLivingBaseIn.renderOffsetY, z + (double) entityLivingBaseIn.renderOffsetZ); + } else { + super.renderLivingAt(entityLivingBaseIn, x, y, z); + } + } + + protected void rotateCorpse(AbstractClientPlayer bat, float p_77043_2_, float p_77043_3_, float partialTicks) { + if (bat.isEntityAlive() && bat.isPlayerSleeping()) { + GlStateManager.rotate(bat.getBedOrientationInDegrees(), 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(this.getDeathMaxRotation(bat), 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(270.0F, 0.0F, 1.0F, 0.0F); + } else { + super.rotateCorpse(bat, p_77043_2_, p_77043_3_, partialTicks); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderPotion.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderPotion.java new file mode 100644 index 0000000..cbf94d8 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderPotion.java @@ -0,0 +1,18 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.entity.projectile.EntityPotion; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +public class RenderPotion extends RenderSnowball +{ + public RenderPotion(RenderManager renderManagerIn, RenderItem itemRendererIn) + { + super(renderManagerIn, Items.potionitem, itemRendererIn); + } + + public ItemStack func_177082_d(EntityPotion entityIn) + { + return new ItemStack(this.field_177084_a, 1, entityIn.getPotionDamage()); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderRabbit.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderRabbit.java new file mode 100644 index 0000000..5ad6a40 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderRabbit.java @@ -0,0 +1,63 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.entity.passive.EntityRabbit; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; + +public class RenderRabbit extends RenderLiving +{ + private static final ResourceLocation BROWN = new ResourceLocation("textures/entity/rabbit/brown.png"); + private static final ResourceLocation WHITE = new ResourceLocation("textures/entity/rabbit/white.png"); + private static final ResourceLocation BLACK = new ResourceLocation("textures/entity/rabbit/black.png"); + private static final ResourceLocation GOLD = new ResourceLocation("textures/entity/rabbit/gold.png"); + private static final ResourceLocation SALT = new ResourceLocation("textures/entity/rabbit/salt.png"); + private static final ResourceLocation WHITE_SPLOTCHED = new ResourceLocation("textures/entity/rabbit/white_splotched.png"); + private static final ResourceLocation TOAST = new ResourceLocation("textures/entity/rabbit/toast.png"); + private static final ResourceLocation CAERBANNOG = new ResourceLocation("textures/entity/rabbit/caerbannog.png"); + + public RenderRabbit(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn, modelBaseIn, shadowSizeIn); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityRabbit entity) + { + String s = EnumChatFormatting.getTextWithoutFormattingCodes(entity.getName()); + + if (s != null && s.equals("Toast")) + { + return TOAST; + } + else + { + switch (entity.getRabbitType()) + { + case 0: + default: + return BROWN; + + case 1: + return WHITE; + + case 2: + return BLACK; + + case 3: + return WHITE_SPLOTCHED; + + case 4: + return GOLD; + + case 5: + return SALT; + + case 99: + return CAERBANNOG; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderSheep.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderSheep.java new file mode 100644 index 0000000..c204a8a --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderSheep.java @@ -0,0 +1,26 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.layers.LayerSheepWool; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.util.ResourceLocation; + +public class RenderSheep extends RenderLiving +{ + private static final ResourceLocation shearedSheepTextures = new ResourceLocation("textures/entity/sheep/sheep.png"); + + public RenderSheep(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn, modelBaseIn, shadowSizeIn); + this.addLayer(new LayerSheepWool(this)); + } + + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntitySheep entity) + { + return shearedSheepTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderSilverfish.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderSilverfish.java new file mode 100644 index 0000000..b9cac04 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderSilverfish.java @@ -0,0 +1,28 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelSilverfish; +import net.minecraft.entity.monster.EntitySilverfish; +import net.minecraft.util.ResourceLocation; + +public class RenderSilverfish extends RenderLiving +{ + private static final ResourceLocation silverfishTextures = new ResourceLocation("textures/entity/silverfish.png"); + + public RenderSilverfish(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelSilverfish(), 0.3F); + } + + protected float getDeathMaxRotation(EntitySilverfish entityLivingBaseIn) + { + return 180.0F; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntitySilverfish entity) + { + return silverfishTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderSkeleton.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderSkeleton.java new file mode 100644 index 0000000..72b716b --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderSkeleton.java @@ -0,0 +1,53 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelSkeleton; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; +import net.minecraft.client.renderer.entity.layers.LayerHeldItem; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.util.ResourceLocation; + +public class RenderSkeleton extends RenderBiped +{ + private static final ResourceLocation skeletonTextures = new ResourceLocation("textures/entity/skeleton/skeleton.png"); + private static final ResourceLocation witherSkeletonTextures = new ResourceLocation("textures/entity/skeleton/wither_skeleton.png"); + + public RenderSkeleton(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelSkeleton(), 0.5F); + this.addLayer(new LayerHeldItem(this)); + this.addLayer(new LayerBipedArmor(this) + { + protected void initArmor() + { + this.field_177189_c = new ModelSkeleton(0.5F, true); + this.field_177186_d = new ModelSkeleton(1.0F, true); + } + }); + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntitySkeleton entitylivingbaseIn, float partialTickTime) + { + if (entitylivingbaseIn.getSkeletonType() == 1) + { + GlStateManager.scale(1.2F, 1.2F, 1.2F); + } + } + + public void transformHeldFull3DItemLayer() + { + GlStateManager.translate(0.09375F, 0.1875F, 0.0F); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntitySkeleton entity) + { + return entity.getSkeletonType() == 1 ? witherSkeletonTextures : skeletonTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderSlime.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderSlime.java new file mode 100644 index 0000000..81c8176 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderSlime.java @@ -0,0 +1,51 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.layers.LayerSlimeGel; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.util.ResourceLocation; + +public class RenderSlime extends RenderLiving +{ + private static final ResourceLocation slimeTextures = new ResourceLocation("textures/entity/slime/slime.png"); + + public RenderSlime(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn, modelBaseIn, shadowSizeIn); + this.addLayer(new LayerSlimeGel(this)); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntitySlime entity, double x, double y, double z, float entityYaw, float partialTicks) + { + this.shadowSize = 0.25F * (float)entity.getSlimeSize(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntitySlime entitylivingbaseIn, float partialTickTime) + { + float f = (float)entitylivingbaseIn.getSlimeSize(); + float f1 = (entitylivingbaseIn.prevSquishFactor + (entitylivingbaseIn.squishFactor - entitylivingbaseIn.prevSquishFactor) * partialTickTime) / (f * 0.5F + 1.0F); + float f2 = 1.0F / (f1 + 1.0F); + GlStateManager.scale(f2 * f, 1.0F / f2 * f, f2 * f); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntitySlime entity) + { + return slimeTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java new file mode 100644 index 0000000..3b0a9eb --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java @@ -0,0 +1,30 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelSnowMan; +import net.minecraft.client.renderer.entity.layers.LayerSnowmanHead; +import net.minecraft.entity.monster.EntitySnowman; +import net.minecraft.util.ResourceLocation; + +public class RenderSnowMan extends RenderLiving +{ + private static final ResourceLocation snowManTextures = new ResourceLocation("textures/entity/snowman.png"); + + public RenderSnowMan(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelSnowMan(), 0.5F); + this.addLayer(new LayerSnowmanHead(this)); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntitySnowman entity) + { + return snowManTextures; + } + + public ModelSnowMan getMainModel() + { + return (ModelSnowMan)super.getMainModel(); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderSnowball.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderSnowball.java new file mode 100644 index 0000000..4c8f141 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderSnowball.java @@ -0,0 +1,56 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class RenderSnowball extends Render +{ + protected final Item field_177084_a; + private final RenderItem field_177083_e; + + public RenderSnowball(RenderManager renderManagerIn, Item p_i46137_2_, RenderItem p_i46137_3_) + { + super(renderManagerIn); + this.field_177084_a = p_i46137_2_; + this.field_177083_e = p_i46137_3_; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) + { + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y, (float)z); + GlStateManager.enableRescaleNormal(); + GlStateManager.scale(0.5F, 0.5F, 0.5F); + GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + this.bindTexture(TextureMap.locationBlocksTexture); + this.field_177083_e.func_181564_a(this.func_177082_d(entity), ItemCameraTransforms.TransformType.GROUND); + GlStateManager.disableRescaleNormal(); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + public ItemStack func_177082_d(T entityIn) + { + return new ItemStack(this.field_177084_a, 1, 0); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity entity) + { + return TextureMap.locationBlocksTexture; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderSpider.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderSpider.java new file mode 100644 index 0000000..1867819 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderSpider.java @@ -0,0 +1,30 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelSpider; +import net.minecraft.client.renderer.entity.layers.LayerSpiderEyes; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.util.ResourceLocation; + +public class RenderSpider extends RenderLiving +{ + private static final ResourceLocation spiderTextures = new ResourceLocation("textures/entity/spider/spider.png"); + + public RenderSpider(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelSpider(), 1.0F); + this.addLayer(new LayerSpiderEyes(this)); + } + + protected float getDeathMaxRotation(T entityLivingBaseIn) + { + return 180.0F; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(T entity) + { + return spiderTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderSquid.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderSquid.java new file mode 100644 index 0000000..88c2b7d --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderSquid.java @@ -0,0 +1,43 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.util.ResourceLocation; + +public class RenderSquid extends RenderLiving +{ + private static final ResourceLocation squidTextures = new ResourceLocation("textures/entity/squid.png"); + + public RenderSquid(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn, modelBaseIn, shadowSizeIn); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntitySquid entity) + { + return squidTextures; + } + + protected void rotateCorpse(EntitySquid bat, float p_77043_2_, float p_77043_3_, float partialTicks) + { + float f = bat.prevSquidPitch + (bat.squidPitch - bat.prevSquidPitch) * partialTicks; + float f1 = bat.prevSquidYaw + (bat.squidYaw - bat.prevSquidYaw) * partialTicks; + GlStateManager.translate(0.0F, 0.5F, 0.0F); + GlStateManager.rotate(180.0F - p_77043_3_, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f1, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.0F, -1.2F, 0.0F); + } + + /** + * Defines what float the third param in setRotationAngles of ModelBase is + */ + protected float handleRotationFloat(EntitySquid livingBase, float partialTicks) + { + return livingBase.lastTentacleAngle + (livingBase.tentacleAngle - livingBase.lastTentacleAngle) * partialTicks; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderTNTPrimed.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderTNTPrimed.java new file mode 100644 index 0000000..297d824 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderTNTPrimed.java @@ -0,0 +1,149 @@ +package net.minecraft.client.renderer.entity; + +import java.awt.Color; +import java.text.DecimalFormat; + +import org.lwjgl.opengl.GL11; + +import animeware.cosmetic.Booleans; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class RenderTNTPrimed extends Render +{ + public RenderTNTPrimed(RenderManager renderManagerIn) + { + super(renderManagerIn); + this.shadowSize = 0.5F; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + // the whole dorender method only renders the normal minecraft tnt animation + public void doRender(EntityTNTPrimed entity, double x, double y, double z, float entityYaw, float partialTicks) + { + BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + this.renderTag(this, entity, x, y, z, partialTicks); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y + 0.5F, (float)z); + + if ((float)entity.fuse - partialTicks + 1.0F < 10.0F) + { + float f = 1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 10.0F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + f = f * f; + f = f * f; + float f1 = 1.0F + f * 0.3F; + GlStateManager.scale(f1, f1, f1); + } + + float f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F; + this.bindEntityTexture(entity); + GlStateManager.translate(-0.5F, -0.5F, 0.5F); + blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), entity.getBrightness(partialTicks)); + GlStateManager.translate(0.0F, 0.0F, 1.0F); + + if (entity.fuse / 5 % 2 == 0) + { + GlStateManager.disableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 772); + GlStateManager.color(1.0F, 1.0F, 1.0F, f2); + GlStateManager.doPolygonOffset(-3.0F, -3.0F); + GlStateManager.enablePolygonOffset(); + blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), 1.0F); + GlStateManager.doPolygonOffset(0.0F, 0.0F); + GlStateManager.disablePolygonOffset(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + GlStateManager.enableLighting(); + GlStateManager.enableTexture2D(); + } + + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + public void renderTag(RenderTNTPrimed tntRenderer, EntityTNTPrimed tntPrimed, double x, double y, double z, float partialTicks) { + //renderTag method renders the time displayed above the tnt + //now this next line sees if its enabled in gui or not and works like that + if(Booleans.TNTTimer) { + if (tntPrimed.fuse >= 1) { + double d0 = tntPrimed.getDistanceSqToEntity(tntRenderer.getRenderManager().livingPlayer); + + if (d0 <= 4096.0D) { + float number = ((float) tntPrimed.fuse - partialTicks) / 20.0F; + String str = (new DecimalFormat("0.00")).format((double) number); + FontRenderer fontrenderer = tntRenderer.getFontRendererFromRenderManager(); + float f = 1.6F; + float f1 = 0.016666668F * f; + + GlStateManager.pushMatrix(); + GlStateManager.translate((float) x + 0.0F, (float) y + tntPrimed.height + 0.5F, (float) z); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-tntRenderer.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + byte xMultiplier = 1; + + if (Minecraft.getMinecraft() != null && Minecraft.getMinecraft().gameSettings != null && Minecraft.getMinecraft().gameSettings.thirdPersonView == 2) { + xMultiplier = -1; + } + + GlStateManager.rotate(tntRenderer.getRenderManager().playerViewX * (float) xMultiplier, 1.0F, 0.0F, 0.0F); + GlStateManager.scale(-f1, -f1, f1); + GlStateManager.disableLighting(); + GlStateManager.depthMask(false); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + byte i = 0; + int j = fontrenderer.getStringWidth(str) / 2; + float green = Math.min((float) tntPrimed.fuse / 80.0F, 1.0F); + Color color = new Color(1.0F - green, green, 0.0F); + + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); + GlStateManager.disableTexture2D(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos((double) (-j - 1), (double) (-1 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double) (-j - 1), (double) (8 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double) (j + 1), (double) (8 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double) (j + 1), (double) (-1 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, color.getRGB()); + GlStateManager.enableLighting(); + GlStateManager.disableBlend(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + + } + } + } + + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityTNTPrimed entity) + { + return TextureMap.locationBlocksTexture; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderTntMinecart.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderTntMinecart.java new file mode 100644 index 0000000..36ef75e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderTntMinecart.java @@ -0,0 +1,51 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.item.EntityMinecartTNT; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; + +public class RenderTntMinecart extends RenderMinecart +{ + public RenderTntMinecart(RenderManager renderManagerIn) + { + super(renderManagerIn); + } + + protected void func_180560_a(EntityMinecartTNT minecart, float partialTicks, IBlockState state) + { + int i = minecart.getFuseTicks(); + + if (i > -1 && (float)i - partialTicks + 1.0F < 10.0F) + { + float f = 1.0F - ((float)i - partialTicks + 1.0F) / 10.0F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + f = f * f; + f = f * f; + float f1 = 1.0F + f * 0.3F; + GlStateManager.scale(f1, f1, f1); + } + + super.func_180560_a(minecart, partialTicks, state); + + if (i > -1 && i / 5 % 2 == 0) + { + BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + GlStateManager.disableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 772); + GlStateManager.color(1.0F, 1.0F, 1.0F, (1.0F - ((float)i - partialTicks + 1.0F) / 100.0F) * 0.8F); + GlStateManager.pushMatrix(); + blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), 1.0F); + GlStateManager.popMatrix(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + GlStateManager.enableLighting(); + GlStateManager.enableTexture2D(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java new file mode 100644 index 0000000..a7e209c --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java @@ -0,0 +1,76 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelVillager; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.layers.LayerCustomHead; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.util.ResourceLocation; + +public class RenderVillager extends RenderLiving +{ + private static final ResourceLocation villagerTextures = new ResourceLocation("textures/entity/villager/villager.png"); + private static final ResourceLocation farmerVillagerTextures = new ResourceLocation("textures/entity/villager/farmer.png"); + private static final ResourceLocation librarianVillagerTextures = new ResourceLocation("textures/entity/villager/librarian.png"); + private static final ResourceLocation priestVillagerTextures = new ResourceLocation("textures/entity/villager/priest.png"); + private static final ResourceLocation smithVillagerTextures = new ResourceLocation("textures/entity/villager/smith.png"); + private static final ResourceLocation butcherVillagerTextures = new ResourceLocation("textures/entity/villager/butcher.png"); + + public RenderVillager(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelVillager(0.0F), 0.5F); + this.addLayer(new LayerCustomHead(this.getMainModel().villagerHead)); + } + + public ModelVillager getMainModel() + { + return (ModelVillager)super.getMainModel(); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityVillager entity) + { + switch (entity.getProfession()) + { + case 0: + return farmerVillagerTextures; + + case 1: + return librarianVillagerTextures; + + case 2: + return priestVillagerTextures; + + case 3: + return smithVillagerTextures; + + case 4: + return butcherVillagerTextures; + + default: + return villagerTextures; + } + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityVillager entitylivingbaseIn, float partialTickTime) + { + float f = 0.9375F; + + if (entitylivingbaseIn.getGrowingAge() < 0) + { + f = (float)((double)f * 0.5D); + this.shadowSize = 0.25F; + } + else + { + this.shadowSize = 0.5F; + } + + GlStateManager.scale(f, f, f); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderWitch.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderWitch.java new file mode 100644 index 0000000..9a022f9 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderWitch.java @@ -0,0 +1,54 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelWitch; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.layers.LayerHeldItemWitch; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.monster.EntityWitch; +import net.minecraft.util.ResourceLocation; + +public class RenderWitch extends RenderLiving +{ + private static final ResourceLocation witchTextures = new ResourceLocation("textures/entity/witch.png"); + + public RenderWitch(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelWitch(0.0F), 0.5F); + this.addLayer(new LayerHeldItemWitch(this)); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityWitch entity, double x, double y, double z, float entityYaw, float partialTicks) + { + ((ModelWitch)this.mainModel).field_82900_g = entity.getHeldItem() != null; + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityWitch entity) + { + return witchTextures; + } + + public void transformHeldFull3DItemLayer() + { + GlStateManager.translate(0.0F, 0.1875F, 0.0F); + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityWitch entitylivingbaseIn, float partialTickTime) + { + float f = 0.9375F; + GlStateManager.scale(f, f, f); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderWither.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderWither.java new file mode 100644 index 0000000..12ec4a4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderWither.java @@ -0,0 +1,59 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelWither; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.layers.LayerWitherAura; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.boss.BossStatus; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.util.ResourceLocation; + +public class RenderWither extends RenderLiving +{ + private static final ResourceLocation invulnerableWitherTextures = new ResourceLocation("textures/entity/wither/wither_invulnerable.png"); + private static final ResourceLocation witherTextures = new ResourceLocation("textures/entity/wither/wither.png"); + + public RenderWither(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelWither(0.0F), 1.0F); + this.addLayer(new LayerWitherAura(this)); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityWither entity, double x, double y, double z, float entityYaw, float partialTicks) + { + BossStatus.setBossStatus(entity, true); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityWither entity) + { + int i = entity.getInvulTime(); + return i > 0 && (i > 80 || i / 5 % 2 != 1) ? invulnerableWitherTextures : witherTextures; + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityWither entitylivingbaseIn, float partialTickTime) + { + float f = 2.0F; + int i = entitylivingbaseIn.getInvulTime(); + + if (i > 0) + { + f -= ((float)i - partialTickTime) / 220.0F * 0.5F; + } + + GlStateManager.scale(f, f, f); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderWolf.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderWolf.java new file mode 100644 index 0000000..8ad467e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderWolf.java @@ -0,0 +1,55 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.layers.LayerWolfCollar; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.util.ResourceLocation; + +public class RenderWolf extends RenderLiving +{ + private static final ResourceLocation wolfTextures = new ResourceLocation("textures/entity/wolf/wolf.png"); + private static final ResourceLocation tamedWolfTextures = new ResourceLocation("textures/entity/wolf/wolf_tame.png"); + private static final ResourceLocation anrgyWolfTextures = new ResourceLocation("textures/entity/wolf/wolf_angry.png"); + + public RenderWolf(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn, modelBaseIn, shadowSizeIn); + this.addLayer(new LayerWolfCollar(this)); + } + + + /** + * Defines what float the third param in setRotationAngles of ModelBase is + */ + protected float handleRotationFloat(EntityWolf livingBase, float partialTicks) + { + return livingBase.getTailRotation(); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityWolf entity, double x, double y, double z, float entityYaw, float partialTicks) + { + if (entity.isWolfWet()) + { + float f = entity.getBrightness(partialTicks) * entity.getShadingWhileWet(partialTicks); + GlStateManager.color(f, f, f); + } + + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityWolf entity) + { + return entity.isTamed() ? tamedWolfTextures : (entity.isAngry() ? anrgyWolfTextures : wolfTextures); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderXPOrb.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderXPOrb.java new file mode 100644 index 0000000..ac6f016 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderXPOrb.java @@ -0,0 +1,116 @@ +package net.minecraft.client.renderer.entity; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import optifine.CustomColors; + +public class RenderXPOrb extends Render +{ + private static final ResourceLocation experienceOrbTextures = new ResourceLocation("textures/entity/experience_orb.png"); + private static final String __OBFID = "CL_00000993"; + + public RenderXPOrb(RenderManager renderManagerIn) + { + super(renderManagerIn); + this.shadowSize = 0.15F; + this.shadowOpaque = 0.75F; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityXPOrb entity, double x, double y, double z, float entityYaw, float partialTicks) + { + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y, (float)z); + this.bindEntityTexture(entity); + int i = entity.getTextureByXP(); + float f = (float)(i % 4 * 16 + 0) / 64.0F; + float f1 = (float)(i % 4 * 16 + 16) / 64.0F; + float f2 = (float)(i / 4 * 16 + 0) / 64.0F; + float f3 = (float)(i / 4 * 16 + 16) / 64.0F; + float f4 = 1.0F; + float f5 = 0.5F; + float f6 = 0.25F; + int j = entity.getBrightnessForRender(partialTicks); + int k = j % 65536; + int l = j / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + float f7 = 255.0F; + float f8 = ((float)entity.xpColor + partialTicks) / 2.0F; + l = (int)((MathHelper.sin(f8 + 0.0F) + 1.0F) * 0.5F * 255.0F); + boolean flag = true; + int i1 = (int)((MathHelper.sin(f8 + 4.1887903F) + 1.0F) * 0.1F * 255.0F); + GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + float f9 = 0.3F; + GlStateManager.scale(0.3F, 0.3F, 0.3F); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); + int j1 = l; + int k1 = 255; + int l1 = i1; + + if (Config.isCustomColors()) + { + int i2 = CustomColors.getXpOrbColor(f8); + + if (i2 >= 0) + { + j1 = i2 >> 16 & 255; + k1 = i2 >> 8 & 255; + l1 = i2 >> 0 & 255; + } + } + + worldrenderer.pos((double)(0.0F - f5), (double)(0.0F - f6), 0.0D).tex((double)f, (double)f3).color(j1, k1, l1, 128).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f4 - f5), (double)(0.0F - f6), 0.0D).tex((double)f1, (double)f3).color(j1, k1, l1, 128).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(f4 - f5), (double)(1.0F - f6), 0.0D).tex((double)f1, (double)f2).color(j1, k1, l1, 128).normal(0.0F, 1.0F, 0.0F).endVertex(); + worldrenderer.pos((double)(0.0F - f5), (double)(1.0F - f6), 0.0D).tex((double)f, (double)f2).color(j1, k1, l1, 128).normal(0.0F, 1.0F, 0.0F).endVertex(); + tessellator.draw(); + GlStateManager.disableBlend(); + GlStateManager.disableRescaleNormal(); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityXPOrb entity) + { + return experienceOrbTextures; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity entity) + { + return this.getEntityTexture((EntityXPOrb)entity); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) + { + this.doRender((EntityXPOrb)entity, x, y, z, entityYaw, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RenderZombie.java b/src/minecraft/net/minecraft/client/renderer/entity/RenderZombie.java new file mode 100644 index 0000000..30384e0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RenderZombie.java @@ -0,0 +1,99 @@ +package net.minecraft.client.renderer.entity; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelZombie; +import net.minecraft.client.model.ModelZombieVillager; +import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; +import net.minecraft.client.renderer.entity.layers.LayerCustomHead; +import net.minecraft.client.renderer.entity.layers.LayerHeldItem; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.client.renderer.entity.layers.LayerVillagerArmor; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.util.ResourceLocation; + +public class RenderZombie extends RenderBiped +{ + private static final ResourceLocation zombieTextures = new ResourceLocation("textures/entity/zombie/zombie.png"); + private static final ResourceLocation zombieVillagerTextures = new ResourceLocation("textures/entity/zombie/zombie_villager.png"); + private final ModelBiped field_82434_o; + private final ModelZombieVillager zombieVillagerModel; + private final List> field_177121_n; + private final List> field_177122_o; + + public RenderZombie(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelZombie(), 0.5F, 1.0F); + LayerRenderer layerrenderer = (LayerRenderer)this.layerRenderers.get(0); + this.field_82434_o = this.modelBipedMain; + this.zombieVillagerModel = new ModelZombieVillager(); + this.addLayer(new LayerHeldItem(this)); + LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) + { + protected void initArmor() + { + this.field_177189_c = new ModelZombie(0.5F, true); + this.field_177186_d = new ModelZombie(1.0F, true); + } + }; + this.addLayer(layerbipedarmor); + this.field_177122_o = Lists.newArrayList(this.layerRenderers); + + if (layerrenderer instanceof LayerCustomHead) + { + this.removeLayer(layerrenderer); + this.addLayer(new LayerCustomHead(this.zombieVillagerModel.bipedHead)); + } + + this.removeLayer(layerbipedarmor); + this.addLayer(new LayerVillagerArmor(this)); + this.field_177121_n = Lists.newArrayList(this.layerRenderers); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityZombie entity, double x, double y, double z, float entityYaw, float partialTicks) + { + this.func_82427_a(entity); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityZombie entity) + { + return entity.isVillager() ? zombieVillagerTextures : zombieTextures; + } + + private void func_82427_a(EntityZombie zombie) + { + if (zombie.isVillager()) + { + this.mainModel = this.zombieVillagerModel; + this.layerRenderers = this.field_177121_n; + } + else + { + this.mainModel = this.field_82434_o; + this.layerRenderers = this.field_177122_o; + } + + this.modelBipedMain = (ModelBiped)this.mainModel; + } + + protected void rotateCorpse(EntityZombie bat, float p_77043_2_, float p_77043_3_, float partialTicks) + { + if (bat.isConverting()) + { + p_77043_3_ += (float)(Math.cos((double)bat.ticksExisted * 3.25D) * Math.PI * 0.25D); + } + + super.rotateCorpse(bat, p_77043_2_, p_77043_3_, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RendererLivin# b/src/minecraft/net/minecraft/client/renderer/entity/RendererLivin# new file mode 100644 index 0000000..a789b0f --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RendererLivin# @@ -0,0 +1,17 @@ +*************** +*** 43,49 **** + } + + protected > boolean func_177094_a(U p_177094_1_) { +- return this.field_177097_h.add(p_177094_1_); + } + + protected > boolean func_177089_b(U p_177089_1_) { +--- 43,49 ---- + } + + protected > boolean func_177094_a(U p_177094_1_) { ++ return this.field_177097_h.add((LayerRenderer)p_177094_1_); + } + + protected > boolean func_177089_b(U p_177089_1_) { diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java b/src/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java new file mode 100644 index 0000000..0484bfd --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java @@ -0,0 +1,752 @@ +package net.minecraft.client.renderer.entity; + +import com.google.common.collect.Lists; + +import animeware.cosmetic.Booleans; + +import java.awt.Color; +import java.nio.FloatBuffer; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Team; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; +import optifine.Config; +import optifine.Reflector; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.opengl.GL11; +import shadersmod.client.Shaders; + +public abstract class RendererLivingEntity extends Render +{ + private static final Logger logger = LogManager.getLogger(); + private static final DynamicTexture field_177096_e = new DynamicTexture(16, 16); + protected ModelBase mainModel; + protected FloatBuffer brightnessBuffer = GLAllocation.createDirectFloatBuffer(4); + protected List> layerRenderers = Lists.newArrayList(); + protected boolean renderOutlines = false; + private static final String __OBFID = "CL_00001012"; + public static float NAME_TAG_RANGE = 64.0F; + public static float NAME_TAG_RANGE_SNEAK = 32.0F; + + public RendererLivingEntity(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) + { + super(renderManagerIn); + this.mainModel = modelBaseIn; + this.shadowSize = shadowSizeIn; + } + + /*public > boolean addLayer(U layer) + { + return this.layerRenderers.add((LayerRenderer)layer); + }*/ + public> boolean addLayer(LayerRenderer layer) { + + return this.layerRenderers.add((LayerRenderer)layer); + } + + protected > boolean removeLayer(U layer) + { + return this.layerRenderers.remove(layer); + } + + public ModelBase getMainModel() + { + return this.mainModel; + } + + /** + * Returns a rotation angle that is inbetween two other rotation angles. par1 and par2 are the angles between which + * to interpolate, par3 is probably a float between 0.0 and 1.0 that tells us where "between" the two angles we are. + * Example: par1 = 30, par2 = 50, par3 = 0.5, then return = 40 + */ + protected float interpolateRotation(float par1, float par2, float par3) + { + float f; + + for (f = par2 - par1; f < -180.0F; f += 360.0F) + { + ; + } + + while (f >= 180.0F) + { + f -= 360.0F; + } + + return par1 + par3 * f; + } + + public void transformHeldFull3DItemLayer() + { + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) + { + if (!Reflector.RenderLivingEvent_Pre_Constructor.exists() || !Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Pre_Constructor, new Object[] {entity, this, Double.valueOf(x), Double.valueOf(y), Double.valueOf(z)})) + { + GlStateManager.pushMatrix(); + GlStateManager.disableCull(); + this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); + this.mainModel.isRiding = entity.isRiding(); + + if (Reflector.ForgeEntity_shouldRiderSit.exists()) + { + this.mainModel.isRiding = entity.isRiding() && entity.ridingEntity != null && Reflector.callBoolean(entity.ridingEntity, Reflector.ForgeEntity_shouldRiderSit, new Object[0]); + } + + this.mainModel.isChild = entity.isChild(); + + try + { + float f = this.interpolateRotation(entity.prevRenderYawOffset, entity.renderYawOffset, partialTicks); + float f1 = this.interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, partialTicks); + float f2 = f1 - f; + + if (this.mainModel.isRiding && entity.ridingEntity instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)entity.ridingEntity; + f = this.interpolateRotation(entitylivingbase.prevRenderYawOffset, entitylivingbase.renderYawOffset, partialTicks); + f2 = f1 - f; + float f3 = MathHelper.wrapAngleTo180_float(f2); + + if (f3 < -85.0F) + { + f3 = -85.0F; + } + + if (f3 >= 85.0F) + { + f3 = 85.0F; + } + + f = f1 - f3; + + if (f3 * f3 > 2500.0F) + { + f += f3 * 0.2F; + } + } + + float f8 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks; + this.renderLivingAt(entity, x, y, z); + float f7 = this.handleRotationFloat(entity, partialTicks); + this.rotateCorpse(entity, f7, f, partialTicks); + GlStateManager.enableRescaleNormal(); + GlStateManager.scale(-1.0F, -1.0F, 1.0F); + this.preRenderCallback(entity, partialTicks); + float f4 = 0.0625F; + GlStateManager.translate(0.0F, -1.5078125F, 0.0F); + float f5 = entity.prevLimbSwingAmount + (entity.limbSwingAmount - entity.prevLimbSwingAmount) * partialTicks; + float f6 = entity.limbSwing - entity.limbSwingAmount * (1.0F - partialTicks); + + if (entity.isChild()) + { + f6 *= 3.0F; + } + + if (f5 > 1.0F) + { + f5 = 1.0F; + } + + GlStateManager.enableAlpha(); + this.mainModel.setLivingAnimations(entity, f6, f5, partialTicks); + this.mainModel.setRotationAngles(f6, f5, f7, f2, f8, 0.0625F, entity); + + if (this.renderOutlines) + { + boolean flag1 = this.setScoreTeamColor(entity); + this.renderModel(entity, f6, f5, f7, f2, f8, 0.0625F); + + if (flag1) + { + this.unsetScoreTeamColor(); + } + } + else + { + boolean flag = this.setDoRenderBrightness(entity, partialTicks); + this.renderModel(entity, f6, f5, f7, f2, f8, 0.0625F); + + if (flag) + { + this.unsetBrightness(); + } + + GlStateManager.depthMask(true); + + if (!(entity instanceof EntityPlayer) || !((EntityPlayer)entity).isSpectator()) + { + this.renderLayers(entity, f6, f5, partialTicks, f7, f2, f8, 0.0625F); + } + } + + GlStateManager.disableRescaleNormal(); + } + catch (Exception exception) + { + logger.error((String)"Couldn\'t render entity", (Throwable)exception); + } + + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.enableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + GlStateManager.enableCull(); + GlStateManager.popMatrix(); + + if (!this.renderOutlines) + { + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + if (!Reflector.RenderLivingEvent_Post_Constructor.exists() || !Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Post_Constructor, new Object[] {entity, this, Double.valueOf(x), Double.valueOf(y), Double.valueOf(z)})) + { + ; + } + } + } + + protected boolean setScoreTeamColor(EntityLivingBase entityLivingBaseIn) + { + int i = 16777215; + + if (entityLivingBaseIn instanceof EntityPlayer) + { + ScorePlayerTeam scoreplayerteam = (ScorePlayerTeam)entityLivingBaseIn.getTeam(); + + if (scoreplayerteam != null) + { + String s = FontRenderer.getFormatFromString(scoreplayerteam.getColorPrefix()); + + if (s.length() >= 2) + { + i = this.getFontRendererFromRenderManager().getColorCode(s.charAt(1)); + } + } + } + + float f1 = (float)(i >> 16 & 255) / 255.0F; + float f2 = (float)(i >> 8 & 255) / 255.0F; + float f = (float)(i & 255) / 255.0F; + GlStateManager.disableLighting(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + GlStateManager.color(f1, f2, f, 1.0F); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + return true; + } + + protected void unsetScoreTeamColor() + { + GlStateManager.enableLighting(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + GlStateManager.enableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.enableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } + + /** + * Renders the model in RenderLiving + */ + protected void renderModel(T entitylivingbaseIn, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_) + { + boolean flag = !entitylivingbaseIn.isInvisible(); + boolean flag1 = !flag && !entitylivingbaseIn.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer); + + if (flag || flag1) + { + if (!this.bindEntityTexture(entitylivingbaseIn)) + { + return; + } + + if (flag1) + { + GlStateManager.pushMatrix(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 0.15F); + GlStateManager.depthMask(false); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + GlStateManager.alphaFunc(516, 0.003921569F); + } + + this.mainModel.render(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + + if (flag1) + { + GlStateManager.disableBlend(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.popMatrix(); + GlStateManager.depthMask(true); + } + } + } + + protected boolean setDoRenderBrightness(T entityLivingBaseIn, float partialTicks) + { + return this.setBrightness(entityLivingBaseIn, partialTicks, true); + } + + protected boolean setBrightness(T entitylivingbaseIn, float partialTicks, boolean combineTextures) + { + float f = entitylivingbaseIn.getBrightness(partialTicks); + int i = this.getColorMultiplier(entitylivingbaseIn, f, partialTicks); + boolean flag = (i >> 24 & 255) > 0; + boolean flag1 = entitylivingbaseIn.hurtTime > 0 || entitylivingbaseIn.deathTime > 0; + + if (!flag && !flag1) + { + return false; + } + else if (!flag && !combineTextures) + { + return false; + } + else + { + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + GlStateManager.enableTexture2D(); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, OpenGlHelper.GL_COMBINE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_COMBINE_RGB, GL11.GL_MODULATE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE0_RGB, OpenGlHelper.defaultTexUnit); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE1_RGB, OpenGlHelper.GL_PRIMARY_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND0_RGB, GL11.GL_SRC_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND1_RGB, GL11.GL_SRC_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_COMBINE_ALPHA, GL11.GL_REPLACE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE0_ALPHA, OpenGlHelper.defaultTexUnit); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND0_ALPHA, GL11.GL_SRC_ALPHA); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.enableTexture2D(); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, OpenGlHelper.GL_COMBINE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_COMBINE_RGB, OpenGlHelper.GL_INTERPOLATE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE0_RGB, OpenGlHelper.GL_CONSTANT); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE1_RGB, OpenGlHelper.GL_PREVIOUS); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE2_RGB, OpenGlHelper.GL_CONSTANT); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND0_RGB, GL11.GL_SRC_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND1_RGB, GL11.GL_SRC_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND2_RGB, GL11.GL_SRC_ALPHA); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_COMBINE_ALPHA, GL11.GL_REPLACE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE0_ALPHA, OpenGlHelper.GL_PREVIOUS); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND0_ALPHA, GL11.GL_SRC_ALPHA); + this.brightnessBuffer.position(0); + + if (flag1) + { + if(!"lgbt".equals(entitylivingbaseIn.getCustomNameTag())) { + if(Booleans.HitColor) { + this.brightnessBuffer.put(1.0F); + this.brightnessBuffer.put(1.0F); + this.brightnessBuffer.put(1.0F); + this.brightnessBuffer.put(0.3F); + } else if(Booleans.HitColorBlue) { + this.brightnessBuffer.put(0.0F); + this.brightnessBuffer.put(0.0F); + this.brightnessBuffer.put(1.0F); + this.brightnessBuffer.put(0.3F); + } else if(Booleans.HitColorCyan) { + this.brightnessBuffer.put(0.0F); + this.brightnessBuffer.put(1.0F); + this.brightnessBuffer.put(1.0F); + this.brightnessBuffer.put(0.3F); + } else if(Booleans.HitColorPurple) { + this.brightnessBuffer.put(1.0F); + this.brightnessBuffer.put(0.0F); + this.brightnessBuffer.put(1.0F); + this.brightnessBuffer.put(0.3F); + } else if(Booleans.HitColorRed) { + this.brightnessBuffer.put(1.0F); + this.brightnessBuffer.put(0.0F); + this.brightnessBuffer.put(0.0F); + this.brightnessBuffer.put(0.3F); + } else if(Booleans.HitColorChroma) { + this.brightnessBuffer.put(Minecraft.getMinecraft().fontRendererObj.drawString("", 0, 0, Color.HSBtoRGB((float)(System.currentTimeMillis() % 1000L) / 1000.0F, 0.8F, 0.8F))); + this.brightnessBuffer.put(Minecraft.getMinecraft().fontRendererObj.drawString("", 0, 0, Color.HSBtoRGB((float)(System.currentTimeMillis() % 1000L) / 1000.0F, 0.8F, 0.8F))); + this.brightnessBuffer.put(Minecraft.getMinecraft().fontRendererObj.drawString("", 0, 0, Color.HSBtoRGB((float)(System.currentTimeMillis() % 1000L) / 1000.0F, 0.8F, 0.8F))); + this.brightnessBuffer.put(0.0F); + } else { + this.brightnessBuffer.put(1.0F); + this.brightnessBuffer.put(0.0F); + this.brightnessBuffer.put(0.0F); + this.brightnessBuffer.put(0.3F); + } + } else if("lgbt".equals(entitylivingbaseIn.getCustomNameTag())) { + this.brightnessBuffer.put(Minecraft.getMinecraft().fontRendererObj.drawString("", 0, 0, Color.HSBtoRGB((float)(System.currentTimeMillis() % 1000L) / 1000.0F, 0.8F, 0.8F))); + this.brightnessBuffer.put(Minecraft.getMinecraft().fontRendererObj.drawString("", 0, 0, Color.HSBtoRGB((float)(System.currentTimeMillis() % 1000L) / 1000.0F, 0.8F, 0.8F))); + this.brightnessBuffer.put(Minecraft.getMinecraft().fontRendererObj.drawString("", 0, 0, Color.HSBtoRGB((float)(System.currentTimeMillis() % 1000L) / 1000.0F, 0.8F, 0.8F))); + this.brightnessBuffer.put(0.0F); + } + if (Config.isShaders()) + { + if(Booleans.HitColor) { + Shaders.setEntityColor(1.0F, 1.0F, 1.0F, 0.4F); + } else if(Booleans.HitColorBlue) { + Shaders.setEntityColor(0.0F, 0.0F, 1.0F, 0.3F); + } else if(Booleans.HitColorCyan) { + Shaders.setEntityColor(0.0F, 1.0F, 1.0F, 0.3F); + } else if(Booleans.HitColorPurple) { + Shaders.setEntityColor(1.0F, 0.0F, 1.0F, 0.3F); + } else if(Booleans.HitColorRed) { + Shaders.setEntityColor(1.0F, 0.0F, 0.0F, 0.3F); + } else if(Booleans.HitColorChroma) { + Shaders.setEntityColor(Color.HSBtoRGB((float)(System.currentTimeMillis() % 1000L) / 1000.0F, 0.8F, 0.8F), Color.HSBtoRGB((float)(System.currentTimeMillis() % 1000L) / 1000.0F, 0.8F, 0.8F), Color.HSBtoRGB((float)(System.currentTimeMillis() % 1000L) / 1000.0F, 0.8F, 0.8F), 0.3F); + } else { + Shaders.setEntityColor(1.0F, 0.0F, 0.0F, 0.3F); + } + } + } + else + { + float f1 = (float)(i >> 24 & 255) / 255.0F; + float f2 = (float)(i >> 16 & 255) / 255.0F; + float f3 = (float)(i >> 8 & 255) / 255.0F; + float f4 = (float)(i & 255) / 255.0F; + this.brightnessBuffer.put(f2); + this.brightnessBuffer.put(f3); + this.brightnessBuffer.put(f4); + this.brightnessBuffer.put(1.0F - f1); + + if (Config.isShaders()) + { + Shaders.setEntityColor(f2, f3, f4, 1.0F - f1); + } + } + + this.brightnessBuffer.flip(); + GL11.glTexEnv(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_COLOR, (FloatBuffer)this.brightnessBuffer); + GlStateManager.setActiveTexture(OpenGlHelper.GL_TEXTURE2); + GlStateManager.enableTexture2D(); + GlStateManager.bindTexture(field_177096_e.getGlTextureId()); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, OpenGlHelper.GL_COMBINE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_COMBINE_RGB, GL11.GL_MODULATE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE0_RGB, OpenGlHelper.GL_PREVIOUS); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE1_RGB, OpenGlHelper.lightmapTexUnit); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND0_RGB, GL11.GL_SRC_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND1_RGB, GL11.GL_SRC_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_COMBINE_ALPHA, GL11.GL_REPLACE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE0_ALPHA, OpenGlHelper.GL_PREVIOUS); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND0_ALPHA, GL11.GL_SRC_ALPHA); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + return true; + } + } + + protected void unsetBrightness() + { + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + GlStateManager.enableTexture2D(); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, OpenGlHelper.GL_COMBINE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_COMBINE_RGB, GL11.GL_MODULATE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE0_RGB, OpenGlHelper.defaultTexUnit); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE1_RGB, OpenGlHelper.GL_PRIMARY_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND0_RGB, GL11.GL_SRC_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND1_RGB, GL11.GL_SRC_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_COMBINE_ALPHA, GL11.GL_MODULATE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE0_ALPHA, OpenGlHelper.defaultTexUnit); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE1_ALPHA, OpenGlHelper.GL_PRIMARY_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND0_ALPHA, GL11.GL_SRC_ALPHA); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND1_ALPHA, GL11.GL_SRC_ALPHA); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, OpenGlHelper.GL_COMBINE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_COMBINE_RGB, GL11.GL_MODULATE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND0_RGB, GL11.GL_SRC_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND1_RGB, GL11.GL_SRC_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE0_RGB, GL11.GL_TEXTURE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE1_RGB, OpenGlHelper.GL_PREVIOUS); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_COMBINE_ALPHA, GL11.GL_MODULATE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND0_ALPHA, GL11.GL_SRC_ALPHA); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE0_ALPHA, GL11.GL_TEXTURE); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.setActiveTexture(OpenGlHelper.GL_TEXTURE2); + GlStateManager.disableTexture2D(); + GlStateManager.bindTexture(0); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, OpenGlHelper.GL_COMBINE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_COMBINE_RGB, GL11.GL_MODULATE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND0_RGB, GL11.GL_SRC_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND1_RGB, GL11.GL_SRC_COLOR); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE0_RGB, GL11.GL_TEXTURE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE1_RGB, OpenGlHelper.GL_PREVIOUS); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_COMBINE_ALPHA, GL11.GL_MODULATE); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_OPERAND0_ALPHA, GL11.GL_SRC_ALPHA); + GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, OpenGlHelper.GL_SOURCE0_ALPHA, GL11.GL_TEXTURE); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + + if (Config.isShaders()) + { + Shaders.setEntityColor(0.0F, 0.0F, 0.0F, 0.0F); + } + } + + /** + * Sets a simple glTranslate on a LivingEntity. + */ + protected void renderLivingAt(T entityLivingBaseIn, double x, double y, double z) + { + GlStateManager.translate((float)x, (float)y, (float)z); + } + + protected void rotateCorpse(T bat, float p_77043_2_, float p_77043_3_, float partialTicks) + { + GlStateManager.rotate(180.0F - p_77043_3_, 0.0F, 1.0F, 0.0F); + + if (bat.deathTime > 0) + { + float f = ((float)bat.deathTime + partialTicks - 1.0F) / 20.0F * 1.6F; + f = MathHelper.sqrt_float(f); + + if (f > 1.0F) + { + f = 1.0F; + } + + GlStateManager.rotate(f * this.getDeathMaxRotation(bat), 0.0F, 0.0F, 1.0F); + } + else + { + String s = EnumChatFormatting.getTextWithoutFormattingCodes(bat.getName()); + + if (s != null && (s.equals("Dinnerbone") || s.equals("Grumm")) && (!(bat instanceof EntityPlayer) || ((EntityPlayer)bat).isWearing(EnumPlayerModelParts.CAPE))) + { + GlStateManager.translate(0.0F, bat.height + 0.1F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + } + } + } + + /** + * Returns where in the swing animation the living entity is (from 0 to 1). Args : entity, partialTickTime + */ + protected float getSwingProgress(T livingBase, float partialTickTime) + { + return livingBase.getSwingProgress(partialTickTime); + } + + /** + * Defines what float the third param in setRotationAngles of ModelBase is + */ + protected float handleRotationFloat(T livingBase, float partialTicks) + { + return (float)livingBase.ticksExisted + partialTicks; + } + + protected void renderLayers(T entitylivingbaseIn, float p_177093_2_, float p_177093_3_, float partialTicks, float p_177093_5_, float p_177093_6_, float p_177093_7_, float p_177093_8_) + { + for (LayerRenderer layerrenderer : this.layerRenderers) + { + boolean flag = this.setBrightness(entitylivingbaseIn, partialTicks, layerrenderer.shouldCombineTextures()); + layerrenderer.doRenderLayer(entitylivingbaseIn, p_177093_2_, p_177093_3_, partialTicks, p_177093_5_, p_177093_6_, p_177093_7_, p_177093_8_); + + if (flag) + { + this.unsetBrightness(); + } + } + } + + protected float getDeathMaxRotation(T entityLivingBaseIn) + { + return 90.0F; + } + + /** + * Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime + */ + protected int getColorMultiplier(T entitylivingbaseIn, float lightBrightness, float partialTickTime) + { + return 0; + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(T entitylivingbaseIn, float partialTickTime) + { + } + + public void renderName(T entity, double x, double y, double z) + { + if (!Reflector.RenderLivingEvent_Specials_Pre_Constructor.exists() || !Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Specials_Pre_Constructor, new Object[] {entity, this, Double.valueOf(x), Double.valueOf(y), Double.valueOf(z)})) + { + if (this.canRenderName(entity)) + { + double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); + float f = entity.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE; + + if (d0 < (double)(f * f)) + { + String s = entity.getDisplayName().getFormattedText(); + float f1 = 0.02666667F; + GlStateManager.alphaFunc(516, 0.1F); + + if (entity.isSneaking()) + { + FontRenderer fontrenderer = this.getFontRendererFromRenderManager(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y + entity.height + 0.5F - (entity.isChild() ? entity.height / 2.0F : 0.0F), (float)z); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.scale(-0.02666667F, -0.02666667F, 0.02666667F); + GlStateManager.translate(0.0F, 9.374999F, 0.0F); + GlStateManager.disableLighting(); + GlStateManager.depthMask(false); + GlStateManager.enableBlend(); + GlStateManager.disableTexture2D(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + int i = fontrenderer.getStringWidth(s) / 2; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos((double)(-i - 1), -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(-i - 1), 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(i + 1), 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(i + 1), -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + GlStateManager.depthMask(true); + fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 553648127); + GlStateManager.enableLighting(); + GlStateManager.disableBlend(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + else + { + this.renderOffsetLivingLabel(entity, x, y - (entity.isChild() ? (double)(entity.height / 2.0F) : 0.0D), z, s, 0.02666667F, d0); + } + } + } + + if (!Reflector.RenderLivingEvent_Specials_Post_Constructor.exists() || !Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Specials_Post_Constructor, new Object[] {entity, this, Double.valueOf(x), Double.valueOf(y), Double.valueOf(z)})) + { + ; + } + } + } + + protected boolean canRenderName(T entity) + { + EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer; + + if (entity instanceof EntityPlayer && entity != entityplayersp) + { + Team team = entity.getTeam(); + Team team1 = entityplayersp.getTeam(); + + if (team != null) + { + Team.EnumVisible team$enumvisible = team.getNameTagVisibility(); + + switch (RendererLivingEntity.RendererLivingEntity$1.field_178679_a[team$enumvisible.ordinal()]) + { + case 1: + return true; + + case 2: + return false; + + case 3: + return team1 == null || team.isSameTeam(team1); + + case 4: + return team1 == null || !team.isSameTeam(team1); + + default: + return true; + } + } + } + + return Minecraft.isGuiEnabled() && entity != this.renderManager.livingPlayer && !entity.isInvisibleToPlayer(entityplayersp) && entity.riddenByEntity == null; + } + + public void setRenderOutlines(boolean renderOutlinesIn) + { + this.renderOutlines = renderOutlinesIn; + } + + static + { + int[] aint = field_177096_e.getTextureData(); + + for (int i = 0; i < 256; ++i) + { + aint[i] = -1; + } + + field_177096_e.updateDynamicTexture(); + } + + static final class RendererLivingEntity$1 + { + static final int[] field_178679_a = new int[Team.EnumVisible.values().length]; + private static final String __OBFID = "CL_00002435"; + + static + { + try + { + field_178679_a[Team.EnumVisible.ALWAYS.ordinal()] = 1; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_178679_a[Team.EnumVisible.NEVER.ordinal()] = 2; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_178679_a[Team.EnumVisible.HIDE_FOR_OTHER_TEAMS.ordinal()] = 3; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_178679_a[Team.EnumVisible.HIDE_FOR_OWN_TEAM.ordinal()] = 4; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/RendererLivin~ b/src/minecraft/net/minecraft/client/renderer/entity/RendererLivin~ new file mode 100644 index 0000000..2777470 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/RendererLivin~ @@ -0,0 +1,549 @@ +package net.minecraft.client.renderer.entity; + +import com.google.common.collect.Lists; +import java.nio.FloatBuffer; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Team; +import net.minecraft.src.Config; +import net.minecraft.src.Reflector; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.opengl.GL11; +import shadersmod.client.Shaders; + +public abstract class RendererLivingEntity extends Render { + private static final Logger field_147923_a = LogManager.getLogger(); + private static final DynamicTexture field_177096_e = new DynamicTexture(16, 16); + protected ModelBase field_77045_g; + protected FloatBuffer field_177095_g = GLAllocation.func_74529_h(4); + protected List field_177097_h = Lists.newArrayList(); + protected boolean field_177098_i = false; + private static final String __OBFID = "CL_00001012"; + public static float NAME_TAG_RANGE = 64.0F; + public static float NAME_TAG_RANGE_SNEAK = 32.0F; + + public RendererLivingEntity(RenderManager p_i46156_1_, ModelBase p_i46156_2_, float p_i46156_3_) { + super(p_i46156_1_); + this.field_77045_g = p_i46156_2_; + this.field_76989_e = p_i46156_3_; + } + + public boolean func_177094_a(LayerRenderer p_177094_1_) { + return this.field_177097_h.add(p_177094_1_); + } + + protected boolean func_177089_b(LayerRenderer p_177089_1_) { + return this.field_177097_h.remove(p_177089_1_); + } + + public ModelBase func_177087_b() { + return this.field_77045_g; + } + + protected float func_77034_a(float p_77034_1_, float p_77034_2_, float p_77034_3_) { + float f; + for(f = p_77034_2_ - p_77034_1_; f < -180.0F; f += 360.0F) { + ; + } + + while(f >= 180.0F) { + f -= 360.0F; + } + + return p_77034_1_ + p_77034_3_ * f; + } + + public void func_82422_c() { + } + + public void func_76986_a(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { + if(!Reflector.RenderLivingEvent_Pre_Constructor.exists() || !Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Pre_Constructor, new Object[]{p_76986_1_, this, Double.valueOf(p_76986_2_), Double.valueOf(p_76986_4_), Double.valueOf(p_76986_6_)})) { + GlStateManager.func_179094_E(); + GlStateManager.func_179129_p(); + this.field_77045_g.field_78095_p = this.func_77040_d(p_76986_1_, p_76986_9_); + this.field_77045_g.field_78093_q = p_76986_1_.func_70115_ae(); + if(Reflector.ForgeEntity_shouldRiderSit.exists()) { + this.field_77045_g.field_78093_q = p_76986_1_.func_70115_ae() && p_76986_1_.field_70154_o != null && Reflector.callBoolean(p_76986_1_.field_70154_o, Reflector.ForgeEntity_shouldRiderSit, new Object[0]); + } + + this.field_77045_g.field_78091_s = p_76986_1_.func_70631_g_(); + + try { + float f = this.func_77034_a(p_76986_1_.field_70760_ar, p_76986_1_.field_70761_aq, p_76986_9_); + float f1 = this.func_77034_a(p_76986_1_.field_70758_at, p_76986_1_.field_70759_as, p_76986_9_); + float f2 = f1 - f; + if(this.field_77045_g.field_78093_q && p_76986_1_.field_70154_o instanceof EntityLivingBase) { + EntityLivingBase entitylivingbase = (EntityLivingBase)p_76986_1_.field_70154_o; + f = this.func_77034_a(entitylivingbase.field_70760_ar, entitylivingbase.field_70761_aq, p_76986_9_); + f2 = f1 - f; + float f3 = MathHelper.func_76142_g(f2); + if(f3 < -85.0F) { + f3 = -85.0F; + } + + if(f3 >= 85.0F) { + f3 = 85.0F; + } + + f = f1 - f3; + if(f3 * f3 > 2500.0F) { + f += f3 * 0.2F; + } + } + + float f8 = p_76986_1_.field_70127_C + (p_76986_1_.field_70125_A - p_76986_1_.field_70127_C) * p_76986_9_; + this.func_77039_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_); + float f7 = this.func_77044_a(p_76986_1_, p_76986_9_); + this.func_77043_a(p_76986_1_, f7, f, p_76986_9_); + GlStateManager.func_179091_B(); + GlStateManager.func_179152_a(-1.0F, -1.0F, 1.0F); + this.func_77041_b(p_76986_1_, p_76986_9_); + float f4 = 0.0625F; + GlStateManager.func_179109_b(0.0F, -1.5078125F, 0.0F); + float f5 = p_76986_1_.field_70722_aY + (p_76986_1_.field_70721_aZ - p_76986_1_.field_70722_aY) * p_76986_9_; + float f6 = p_76986_1_.field_70754_ba - p_76986_1_.field_70721_aZ * (1.0F - p_76986_9_); + if(p_76986_1_.func_70631_g_()) { + f6 *= 3.0F; + } + + if(f5 > 1.0F) { + f5 = 1.0F; + } + + GlStateManager.func_179141_d(); + this.field_77045_g.func_78086_a(p_76986_1_, f6, f5, p_76986_9_); + this.field_77045_g.func_78087_a(f6, f5, f7, f2, f8, 0.0625F, p_76986_1_); + if(this.field_177098_i) { + boolean flag1 = this.func_177088_c(p_76986_1_); + this.func_77036_a(p_76986_1_, f6, f5, f7, f2, f8, 0.0625F); + if(flag1) { + this.func_180565_e(); + } + } else { + boolean flag = this.func_177090_c(p_76986_1_, p_76986_9_); + this.func_77036_a(p_76986_1_, f6, f5, f7, f2, f8, 0.0625F); + if(flag) { + this.func_177091_f(); + } + + GlStateManager.func_179132_a(true); + if(!(p_76986_1_ instanceof EntityPlayer) || !((EntityPlayer)p_76986_1_).func_175149_v()) { + this.func_177093_a(p_76986_1_, f6, f5, p_76986_9_, f7, f2, f8, 0.0625F); + } + } + + GlStateManager.func_179101_C(); + } catch (Exception exception) { + field_147923_a.error((String)"Couldn\'t render entity", (Throwable)exception); + } + + GlStateManager.func_179138_g(OpenGlHelper.field_77476_b); + GlStateManager.func_179098_w(); + GlStateManager.func_179138_g(OpenGlHelper.field_77478_a); + GlStateManager.func_179089_o(); + GlStateManager.func_179121_F(); + if(!this.field_177098_i) { + super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } + + if(!Reflector.RenderLivingEvent_Post_Constructor.exists() || !Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Post_Constructor, new Object[]{p_76986_1_, this, Double.valueOf(p_76986_2_), Double.valueOf(p_76986_4_), Double.valueOf(p_76986_6_)})) { + ; + } + } + } + + protected boolean func_177088_c(EntityLivingBase p_177088_1_) { + int i = 16777215; + if(p_177088_1_ instanceof EntityPlayer) { + ScorePlayerTeam scoreplayerteam = (ScorePlayerTeam)p_177088_1_.func_96124_cp(); + if(scoreplayerteam != null) { + String s = FontRenderer.func_78282_e(scoreplayerteam.func_96668_e()); + if(s.length() >= 2) { + i = this.func_76983_a().func_175064_b(s.charAt(1)); + } + } + } + + float f1 = (float)(i >> 16 & 255) / 255.0F; + float f2 = (float)(i >> 8 & 255) / 255.0F; + float f = (float)(i & 255) / 255.0F; + GlStateManager.func_179140_f(); + GlStateManager.func_179138_g(OpenGlHelper.field_77478_a); + GlStateManager.func_179131_c(f1, f2, f, 1.0F); + GlStateManager.func_179090_x(); + GlStateManager.func_179138_g(OpenGlHelper.field_77476_b); + GlStateManager.func_179090_x(); + GlStateManager.func_179138_g(OpenGlHelper.field_77478_a); + return true; + } + + protected void func_180565_e() { + GlStateManager.func_179145_e(); + GlStateManager.func_179138_g(OpenGlHelper.field_77478_a); + GlStateManager.func_179098_w(); + GlStateManager.func_179138_g(OpenGlHelper.field_77476_b); + GlStateManager.func_179098_w(); + GlStateManager.func_179138_g(OpenGlHelper.field_77478_a); + } + + protected void func_77036_a(EntityLivingBase p_77036_1_, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float p_77036_7_) { + boolean flag = !p_77036_1_.func_82150_aj(); + boolean flag1 = !flag && !p_77036_1_.func_98034_c(Minecraft.func_71410_x().field_71439_g); + if(flag || flag1) { + if(!this.func_180548_c(p_77036_1_)) { + return; + } + + if(flag1) { + GlStateManager.func_179094_E(); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 0.15F); + GlStateManager.func_179132_a(false); + GlStateManager.func_179147_l(); + GlStateManager.func_179112_b(770, 771); + GlStateManager.func_179092_a(516, 0.003921569F); + } + + this.field_77045_g.func_78088_a(p_77036_1_, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_); + if(flag1) { + GlStateManager.func_179084_k(); + GlStateManager.func_179092_a(516, 0.1F); + GlStateManager.func_179121_F(); + GlStateManager.func_179132_a(true); + } + } + + } + + protected boolean func_177090_c(EntityLivingBase p_177090_1_, float p_177090_2_) { + return this.func_177092_a(p_177090_1_, p_177090_2_, true); + } + + protected boolean func_177092_a(EntityLivingBase p_177092_1_, float p_177092_2_, boolean p_177092_3_) { + float f = p_177092_1_.func_70013_c(p_177092_2_); + int i = this.func_77030_a(p_177092_1_, f, p_177092_2_); + boolean flag = (i >> 24 & 255) > 0; + boolean flag1 = p_177092_1_.field_70737_aN > 0 || p_177092_1_.field_70725_aQ > 0; + if(!flag && !flag1) { + return false; + } else if(!flag && !p_177092_3_) { + return false; + } else { + GlStateManager.func_179138_g(OpenGlHelper.field_77478_a); + GlStateManager.func_179098_w(); + GL11.glTexEnvi(8960, 8704, OpenGlHelper.field_176095_s); + GL11.glTexEnvi(8960, OpenGlHelper.field_176099_x, 8448); + GL11.glTexEnvi(8960, OpenGlHelper.field_176098_y, OpenGlHelper.field_77478_a); + GL11.glTexEnvi(8960, OpenGlHelper.field_176097_z, OpenGlHelper.field_176093_u); + GL11.glTexEnvi(8960, OpenGlHelper.field_176081_B, 768); + GL11.glTexEnvi(8960, OpenGlHelper.field_176082_C, 768); + GL11.glTexEnvi(8960, OpenGlHelper.field_176077_E, 7681); + GL11.glTexEnvi(8960, OpenGlHelper.field_176078_F, OpenGlHelper.field_77478_a); + GL11.glTexEnvi(8960, OpenGlHelper.field_176085_I, 770); + GlStateManager.func_179138_g(OpenGlHelper.field_77476_b); + GlStateManager.func_179098_w(); + GL11.glTexEnvi(8960, 8704, OpenGlHelper.field_176095_s); + GL11.glTexEnvi(8960, OpenGlHelper.field_176099_x, OpenGlHelper.field_176094_t); + GL11.glTexEnvi(8960, OpenGlHelper.field_176098_y, OpenGlHelper.field_176092_v); + GL11.glTexEnvi(8960, OpenGlHelper.field_176097_z, OpenGlHelper.field_176091_w); + GL11.glTexEnvi(8960, OpenGlHelper.field_176080_A, OpenGlHelper.field_176092_v); + GL11.glTexEnvi(8960, OpenGlHelper.field_176081_B, 768); + GL11.glTexEnvi(8960, OpenGlHelper.field_176082_C, 768); + GL11.glTexEnvi(8960, OpenGlHelper.field_176076_D, 770); + GL11.glTexEnvi(8960, OpenGlHelper.field_176077_E, 7681); + GL11.glTexEnvi(8960, OpenGlHelper.field_176078_F, OpenGlHelper.field_176091_w); + GL11.glTexEnvi(8960, OpenGlHelper.field_176085_I, 770); + this.field_177095_g.position(0); + if(flag1) { + this.field_177095_g.put(1.0F); + this.field_177095_g.put(0.0F); + this.field_177095_g.put(0.0F); + this.field_177095_g.put(0.3F); + if(Config.isShaders()) { + Shaders.setEntityColor(1.0F, 0.0F, 0.0F, 0.3F); + } + } else { + float f1 = (float)(i >> 24 & 255) / 255.0F; + float f2 = (float)(i >> 16 & 255) / 255.0F; + float f3 = (float)(i >> 8 & 255) / 255.0F; + float f4 = (float)(i & 255) / 255.0F; + this.field_177095_g.put(f2); + this.field_177095_g.put(f3); + this.field_177095_g.put(f4); + this.field_177095_g.put(1.0F - f1); + if(Config.isShaders()) { + Shaders.setEntityColor(f2, f3, f4, 1.0F - f1); + } + } + + this.field_177095_g.flip(); + GL11.glTexEnv(8960, 8705, (FloatBuffer)this.field_177095_g); + GlStateManager.func_179138_g(OpenGlHelper.field_176096_r); + GlStateManager.func_179098_w(); + GlStateManager.func_179144_i(field_177096_e.func_110552_b()); + GL11.glTexEnvi(8960, 8704, OpenGlHelper.field_176095_s); + GL11.glTexEnvi(8960, OpenGlHelper.field_176099_x, 8448); + GL11.glTexEnvi(8960, OpenGlHelper.field_176098_y, OpenGlHelper.field_176091_w); + GL11.glTexEnvi(8960, OpenGlHelper.field_176097_z, OpenGlHelper.field_77476_b); + GL11.glTexEnvi(8960, OpenGlHelper.field_176081_B, 768); + GL11.glTexEnvi(8960, OpenGlHelper.field_176082_C, 768); + GL11.glTexEnvi(8960, OpenGlHelper.field_176077_E, 7681); + GL11.glTexEnvi(8960, OpenGlHelper.field_176078_F, OpenGlHelper.field_176091_w); + GL11.glTexEnvi(8960, OpenGlHelper.field_176085_I, 770); + GlStateManager.func_179138_g(OpenGlHelper.field_77478_a); + return true; + } + } + + protected void func_177091_f() { + GlStateManager.func_179138_g(OpenGlHelper.field_77478_a); + GlStateManager.func_179098_w(); + GL11.glTexEnvi(8960, 8704, OpenGlHelper.field_176095_s); + GL11.glTexEnvi(8960, OpenGlHelper.field_176099_x, 8448); + GL11.glTexEnvi(8960, OpenGlHelper.field_176098_y, OpenGlHelper.field_77478_a); + GL11.glTexEnvi(8960, OpenGlHelper.field_176097_z, OpenGlHelper.field_176093_u); + GL11.glTexEnvi(8960, OpenGlHelper.field_176081_B, 768); + GL11.glTexEnvi(8960, OpenGlHelper.field_176082_C, 768); + GL11.glTexEnvi(8960, OpenGlHelper.field_176077_E, 8448); + GL11.glTexEnvi(8960, OpenGlHelper.field_176078_F, OpenGlHelper.field_77478_a); + GL11.glTexEnvi(8960, OpenGlHelper.field_176079_G, OpenGlHelper.field_176093_u); + GL11.glTexEnvi(8960, OpenGlHelper.field_176085_I, 770); + GL11.glTexEnvi(8960, OpenGlHelper.field_176086_J, 770); + GlStateManager.func_179138_g(OpenGlHelper.field_77476_b); + GL11.glTexEnvi(8960, 8704, OpenGlHelper.field_176095_s); + GL11.glTexEnvi(8960, OpenGlHelper.field_176099_x, 8448); + GL11.glTexEnvi(8960, OpenGlHelper.field_176081_B, 768); + GL11.glTexEnvi(8960, OpenGlHelper.field_176082_C, 768); + GL11.glTexEnvi(8960, OpenGlHelper.field_176098_y, 5890); + GL11.glTexEnvi(8960, OpenGlHelper.field_176097_z, OpenGlHelper.field_176091_w); + GL11.glTexEnvi(8960, OpenGlHelper.field_176077_E, 8448); + GL11.glTexEnvi(8960, OpenGlHelper.field_176085_I, 770); + GL11.glTexEnvi(8960, OpenGlHelper.field_176078_F, 5890); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.func_179138_g(OpenGlHelper.field_176096_r); + GlStateManager.func_179090_x(); + GlStateManager.func_179144_i(0); + GL11.glTexEnvi(8960, 8704, OpenGlHelper.field_176095_s); + GL11.glTexEnvi(8960, OpenGlHelper.field_176099_x, 8448); + GL11.glTexEnvi(8960, OpenGlHelper.field_176081_B, 768); + GL11.glTexEnvi(8960, OpenGlHelper.field_176082_C, 768); + GL11.glTexEnvi(8960, OpenGlHelper.field_176098_y, 5890); + GL11.glTexEnvi(8960, OpenGlHelper.field_176097_z, OpenGlHelper.field_176091_w); + GL11.glTexEnvi(8960, OpenGlHelper.field_176077_E, 8448); + GL11.glTexEnvi(8960, OpenGlHelper.field_176085_I, 770); + GL11.glTexEnvi(8960, OpenGlHelper.field_176078_F, 5890); + GlStateManager.func_179138_g(OpenGlHelper.field_77478_a); + if(Config.isShaders()) { + Shaders.setEntityColor(0.0F, 0.0F, 0.0F, 0.0F); + } + + } + + protected void func_77039_a(EntityLivingBase p_77039_1_, double p_77039_2_, double p_77039_4_, double p_77039_6_) { + GlStateManager.func_179109_b((float)p_77039_2_, (float)p_77039_4_, (float)p_77039_6_); + } + + protected void func_77043_a(EntityLivingBase p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { + GlStateManager.func_179114_b(180.0F - p_77043_3_, 0.0F, 1.0F, 0.0F); + if(p_77043_1_.field_70725_aQ > 0) { + float f = ((float)p_77043_1_.field_70725_aQ + p_77043_4_ - 1.0F) / 20.0F * 1.6F; + f = MathHelper.func_76129_c(f); + if(f > 1.0F) { + f = 1.0F; + } + + GlStateManager.func_179114_b(f * this.func_77037_a(p_77043_1_), 0.0F, 0.0F, 1.0F); + } else { + String s = EnumChatFormatting.func_110646_a(p_77043_1_.func_70005_c_()); + if(s != null && (s.equals("Dinnerbone") || s.equals("Grumm")) && (!(p_77043_1_ instanceof EntityPlayer) || ((EntityPlayer)p_77043_1_).func_175148_a(EnumPlayerModelParts.CAPE))) { + GlStateManager.func_179109_b(0.0F, p_77043_1_.field_70131_O + 0.1F, 0.0F); + GlStateManager.func_179114_b(180.0F, 0.0F, 0.0F, 1.0F); + } + } + + } + + protected float func_77040_d(EntityLivingBase p_77040_1_, float p_77040_2_) { + return p_77040_1_.func_70678_g(p_77040_2_); + } + + protected float func_77044_a(EntityLivingBase p_77044_1_, float p_77044_2_) { + return (float)p_77044_1_.field_70173_aa + p_77044_2_; + } + + protected void func_177093_a(EntityLivingBase p_177093_1_, float p_177093_2_, float p_177093_3_, float p_177093_4_, float p_177093_5_, float p_177093_6_, float p_177093_7_, float p_177093_8_) { + for(LayerRenderer layerrenderer : this.field_177097_h) { + boolean flag = this.func_177092_a(p_177093_1_, p_177093_4_, layerrenderer.func_177142_b()); + layerrenderer.func_177141_a(p_177093_1_, p_177093_2_, p_177093_3_, p_177093_4_, p_177093_5_, p_177093_6_, p_177093_7_, p_177093_8_); + if(flag) { + this.func_177091_f(); + } + } + + } + + protected float func_77037_a(EntityLivingBase p_77037_1_) { + return 90.0F; + } + + protected int func_77030_a(EntityLivingBase p_77030_1_, float p_77030_2_, float p_77030_3_) { + return 0; + } + + protected void func_77041_b(EntityLivingBase p_77041_1_, float p_77041_2_) { + } + + public void func_177067_a(EntityLivingBase p_177067_1_, double p_177067_2_, double p_177067_4_, double p_177067_6_) { + if(!Reflector.RenderLivingEvent_Specials_Pre_Constructor.exists() || !Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Specials_Pre_Constructor, new Object[]{p_177067_1_, this, Double.valueOf(p_177067_2_), Double.valueOf(p_177067_4_), Double.valueOf(p_177067_6_)})) { + if(this.func_177070_b(p_177067_1_)) { + double d0 = p_177067_1_.func_70068_e(this.field_76990_c.field_78734_h); + float f = p_177067_1_.func_70093_af()?NAME_TAG_RANGE_SNEAK:NAME_TAG_RANGE; + if(d0 < (double)(f * f)) { + String s = p_177067_1_.func_145748_c_().func_150254_d(); + float f1 = 0.02666667F; + GlStateManager.func_179092_a(516, 0.1F); + if(p_177067_1_.func_70093_af()) { + FontRenderer fontrenderer = this.func_76983_a(); + GlStateManager.func_179094_E(); + GlStateManager.func_179109_b((float)p_177067_2_, (float)p_177067_4_ + p_177067_1_.field_70131_O + 0.5F - (p_177067_1_.func_70631_g_()?p_177067_1_.field_70131_O / 2.0F:0.0F), (float)p_177067_6_); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.func_179114_b(-this.field_76990_c.field_78735_i, 0.0F, 1.0F, 0.0F); + GlStateManager.func_179114_b(this.field_76990_c.field_78732_j, 1.0F, 0.0F, 0.0F); + GlStateManager.func_179152_a(-0.02666667F, -0.02666667F, 0.02666667F); + GlStateManager.func_179109_b(0.0F, 9.374999F, 0.0F); + GlStateManager.func_179140_f(); + GlStateManager.func_179132_a(false); + GlStateManager.func_179147_l(); + GlStateManager.func_179090_x(); + GlStateManager.func_179120_a(770, 771, 1, 0); + int i = fontrenderer.func_78256_a(s) / 2; + Tessellator tessellator = Tessellator.func_178181_a(); + WorldRenderer worldrenderer = tessellator.func_178180_c(); + worldrenderer.func_181668_a(7, DefaultVertexFormats.field_181706_f); + worldrenderer.func_181662_b((double)(-i - 1), -1.0D, 0.0D).func_181666_a(0.0F, 0.0F, 0.0F, 0.25F).func_181675_d(); + worldrenderer.func_181662_b((double)(-i - 1), 8.0D, 0.0D).func_181666_a(0.0F, 0.0F, 0.0F, 0.25F).func_181675_d(); + worldrenderer.func_181662_b((double)(i + 1), 8.0D, 0.0D).func_181666_a(0.0F, 0.0F, 0.0F, 0.25F).func_181675_d(); + worldrenderer.func_181662_b((double)(i + 1), -1.0D, 0.0D).func_181666_a(0.0F, 0.0F, 0.0F, 0.25F).func_181675_d(); + tessellator.func_78381_a(); + GlStateManager.func_179098_w(); + GlStateManager.func_179132_a(true); + fontrenderer.func_78276_b(s, -fontrenderer.func_78256_a(s) / 2, 0, 553648127); + GlStateManager.func_179145_e(); + GlStateManager.func_179084_k(); + GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.func_179121_F(); + } else { + this.func_177069_a(p_177067_1_, p_177067_2_, p_177067_4_ - (p_177067_1_.func_70631_g_()?(double)(p_177067_1_.field_70131_O / 2.0F):0.0D), p_177067_6_, s, 0.02666667F, d0); + } + } + } + + if(!Reflector.RenderLivingEvent_Specials_Post_Constructor.exists() || !Reflector.postForgeBusEvent(Reflector.RenderLivingEvent_Specials_Post_Constructor, new Object[]{p_177067_1_, this, Double.valueOf(p_177067_2_), Double.valueOf(p_177067_4_), Double.valueOf(p_177067_6_)})) { + ; + } + } + } + + protected boolean func_177070_b(EntityLivingBase p_177070_1_) { + EntityPlayerSP entityplayersp = Minecraft.func_71410_x().field_71439_g; + if(p_177070_1_ instanceof EntityPlayer && p_177070_1_ != entityplayersp) { + Team team = p_177070_1_.func_96124_cp(); + Team team1 = entityplayersp.func_96124_cp(); + if(team != null) { + Team.EnumVisible team$enumvisible = team.func_178770_i(); + switch(RendererLivingEntity.RendererLivingEntity$1.field_178679_a[team$enumvisible.ordinal()]) { + case 1: + return true; + case 2: + return false; + case 3: + return team1 == null || team.func_142054_a(team1); + case 4: + return team1 == null || !team.func_142054_a(team1); + default: + return true; + } + } + } + + return Minecraft.func_71382_s() && p_177070_1_ != this.field_76990_c.field_78734_h && !p_177070_1_.func_98034_c(entityplayersp) && p_177070_1_.field_70153_n == null; + } + + public void func_177086_a(boolean p_177086_1_) { + this.field_177098_i = p_177086_1_; + } + + protected boolean func_177070_b(Entity p_177070_1_) { + return this.func_177070_b((EntityLivingBase)p_177070_1_); + } + + public void func_177067_a(Entity p_177067_1_, double p_177067_2_, double p_177067_4_, double p_177067_6_) { + this.func_177067_a((EntityLivingBase)p_177067_1_, p_177067_2_, p_177067_4_, p_177067_6_); + } + + public void func_76986_a(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { + this.func_76986_a((EntityLivingBase)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } + + static { + int[] aint = field_177096_e.func_110565_c(); + + for(int i = 0; i < 256; ++i) { + aint[i] = -1; + } + + field_177096_e.func_110564_a(); + } + + static final class RendererLivingEntity$1 { + static final int[] field_178679_a = new int[Team.EnumVisible.values().length]; + private static final String __OBFID = "CL_00002435"; + + static { + try { + field_178679_a[Team.EnumVisible.ALWAYS.ordinal()] = 1; + } catch (NoSuchFieldError var4) { + ; + } + + try { + field_178679_a[Team.EnumVisible.NEVER.ordinal()] = 2; + } catch (NoSuchFieldError var3) { + ; + } + + try { + field_178679_a[Team.EnumVisible.HIDE_FOR_OTHER_TEAMS.ordinal()] = 3; + } catch (NoSuchFieldError var2) { + ; + } + + try { + field_178679_a[Team.EnumVisible.HIDE_FOR_OWN_TEAM.ordinal()] = 4; + } catch (NoSuchFieldError var1) { + ; + } + + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java new file mode 100644 index 0000000..25d9390 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java @@ -0,0 +1,316 @@ +package net.minecraft.client.renderer.entity.layers; + +import com.google.common.collect.Maps; +import java.util.Map; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import optifine.CustomItems; +import optifine.Reflector; +import shadersmod.client.Shaders; +import shadersmod.client.ShadersRender; + +public abstract class LayerArmorBase implements LayerRenderer +{ + protected static final ResourceLocation ENCHANTED_ITEM_GLINT_RES = new ResourceLocation("textures/misc/enchanted_item_glint.png"); + protected ModelBase field_177189_c; + protected ModelBase field_177186_d; + private final RendererLivingEntity renderer; + private float alpha = 1.0F; + private float colorR = 1.0F; + private float colorG = 1.0F; + private float colorB = 1.0F; + private boolean field_177193_i; + private static final Map ARMOR_TEXTURE_RES_MAP = Maps.newHashMap(); + private static final String __OBFID = "CL_00002428"; + + public LayerArmorBase(RendererLivingEntity rendererIn) + { + this.renderer = rendererIn; + this.initArmor(); + } + + public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + this.renderLayer(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale, 4); + this.renderLayer(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale, 3); + this.renderLayer(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale, 2); + this.renderLayer(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale, 1); + } + + public boolean shouldCombineTextures() + { + return false; + } + + private void renderLayer(EntityLivingBase entitylivingbaseIn, float p_177182_2_, float p_177182_3_, float p_177182_4_, float p_177182_5_, float p_177182_6_, float p_177182_7_, float p_177182_8_, int armorSlot) + { + ItemStack itemstack = this.getCurrentArmor(entitylivingbaseIn, armorSlot); + + if (itemstack != null && itemstack.getItem() instanceof ItemArmor) + { + ItemArmor itemarmor = (ItemArmor)itemstack.getItem(); + ModelBase modelbase = this.func_177175_a(armorSlot); + modelbase.setModelAttributes(this.renderer.getMainModel()); + modelbase.setLivingAnimations(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_4_); + + if (Reflector.ForgeHooksClient.exists()) + { + modelbase = this.getArmorModelHook(entitylivingbaseIn, itemstack, armorSlot, modelbase); + } + + this.func_177179_a((T) modelbase, armorSlot); + boolean flag = this.isSlotForLeggings(armorSlot); + + if (!Config.isCustomItems() || !CustomItems.bindCustomArmorTexture(itemstack, flag ? 2 : 1, (String)null)) + { + if (Reflector.ForgeHooksClient_getArmorTexture.exists()) + { + this.renderer.bindTexture(this.getArmorResource(entitylivingbaseIn, itemstack, flag ? 2 : 1, (String)null)); + } + else + { + this.renderer.bindTexture(this.getArmorResource(itemarmor, flag)); + } + } + + if (Reflector.ForgeHooksClient_getArmorTexture.exists()) + { + int j = itemarmor.getColor(itemstack); + + if (j != -1) + { + float f3 = (float)(j >> 16 & 255) / 255.0F; + float f4 = (float)(j >> 8 & 255) / 255.0F; + float f5 = (float)(j & 255) / 255.0F; + GlStateManager.color(this.colorR * f3, this.colorG * f4, this.colorB * f5, this.alpha); + modelbase.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + + if (!Config.isCustomItems() || !CustomItems.bindCustomArmorTexture(itemstack, flag ? 2 : 1, "overlay")) + { + this.renderer.bindTexture(this.getArmorResource(entitylivingbaseIn, itemstack, flag ? 2 : 1, "overlay")); + } + } + + GlStateManager.color(this.colorR, this.colorG, this.colorB, this.alpha); + modelbase.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + + if (!this.field_177193_i && itemstack.isItemEnchanted() && (!Config.isCustomItems() || !CustomItems.renderCustomArmorEffect(entitylivingbaseIn, itemstack, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_))) + { + this.func_177183_a(entitylivingbaseIn, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + } + + return; + } + + switch (LayerArmorBase.LayerArmorBase$1.field_178747_a[itemarmor.getArmorMaterial().ordinal()]) + { + case 1: + int i = itemarmor.getColor(itemstack); + float f = (float)(i >> 16 & 255) / 255.0F; + float f1 = (float)(i >> 8 & 255) / 255.0F; + float f2 = (float)(i & 255) / 255.0F; + GlStateManager.color(this.colorR * f, this.colorG * f1, this.colorB * f2, this.alpha); + modelbase.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + + if (!Config.isCustomItems() || !CustomItems.bindCustomArmorTexture(itemstack, flag ? 2 : 1, "overlay")) + { + this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay")); + } + + case 2: + case 3: + case 4: + case 5: + GlStateManager.color(this.colorR, this.colorG, this.colorB, this.alpha); + modelbase.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + } + + if (!this.field_177193_i && itemstack.isItemEnchanted() && (!Config.isCustomItems() || !CustomItems.renderCustomArmorEffect(entitylivingbaseIn, itemstack, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_))) + { + this.func_177183_a(entitylivingbaseIn, modelbase, p_177182_2_, p_177182_3_, p_177182_4_, p_177182_5_, p_177182_6_, p_177182_7_, p_177182_8_); + } + } + } + + public ItemStack getCurrentArmor(EntityLivingBase entitylivingbaseIn, int armorSlot) + { + return entitylivingbaseIn.getCurrentArmor(armorSlot - 1); + } + + public ModelBase func_177175_a(int p_177175_1_) + { + return this.isSlotForLeggings(p_177175_1_) ? this.field_177189_c : this.field_177186_d; + } + + private boolean isSlotForLeggings(int armorSlot) + { + return armorSlot == 2; + } + + private void func_177183_a(EntityLivingBase entitylivingbaseIn, ModelBase modelbaseIn, float p_177183_3_, float p_177183_4_, float p_177183_5_, float p_177183_6_, float p_177183_7_, float p_177183_8_, float p_177183_9_) + { + if (!Config.isCustomItems() || CustomItems.isUseGlint()) + { + if (!Config.isShaders() || !Shaders.isShadowPass) + { + float f = (float)entitylivingbaseIn.ticksExisted + p_177183_5_; + this.renderer.bindTexture(ENCHANTED_ITEM_GLINT_RES); + + if (Config.isShaders()) + { + ShadersRender.renderEnchantedGlintBegin(); + } + + GlStateManager.enableBlend(); + GlStateManager.depthFunc(514); + GlStateManager.depthMask(false); + float f1 = 0.5F; + GlStateManager.color(f1, f1, f1, 1.0F); + + for (int i = 0; i < 2; ++i) + { + GlStateManager.disableLighting(); + GlStateManager.blendFunc(768, 1); + float f2 = 0.76F; + GlStateManager.color(0.5F * f2, 0.25F * f2, 0.8F * f2, 1.0F); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + float f3 = 0.33333334F; + GlStateManager.scale(f3, f3, f3); + GlStateManager.rotate(30.0F - (float)i * 60.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.translate(0.0F, f * (0.001F + (float)i * 0.003F) * 20.0F, 0.0F); + GlStateManager.matrixMode(5888); + modelbaseIn.render(entitylivingbaseIn, p_177183_3_, p_177183_4_, p_177183_6_, p_177183_7_, p_177183_8_, p_177183_9_); + } + + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + GlStateManager.enableLighting(); + GlStateManager.depthMask(true); + GlStateManager.depthFunc(515); + GlStateManager.disableBlend(); + + if (Config.isShaders()) + { + ShadersRender.renderEnchantedGlintEnd(); + } + } + } + } + + private ResourceLocation getArmorResource(ItemArmor p_177181_1_, boolean p_177181_2_) + { + return this.getArmorResource(p_177181_1_, p_177181_2_, (String)null); + } + + private ResourceLocation getArmorResource(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_) + { + String s = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {p_177178_1_.getArmorMaterial().getName(), Integer.valueOf(p_177178_2_ ? 2 : 1), p_177178_3_ == null ? "" : String.format("_%s", new Object[]{p_177178_3_})}); + ResourceLocation resourcelocation = (ResourceLocation)ARMOR_TEXTURE_RES_MAP.get(s); + + if (resourcelocation == null) + { + resourcelocation = new ResourceLocation(s); + ARMOR_TEXTURE_RES_MAP.put(s, resourcelocation); + } + + return resourcelocation; + } + + protected abstract void initArmor(); + + protected abstract void func_177179_a(T p_177179_1_, int p_177179_2_); + + protected ModelBase getArmorModelHook(EntityLivingBase p_getArmorModelHook_1_, ItemStack p_getArmorModelHook_2_, int p_getArmorModelHook_3_, ModelBase p_getArmorModelHook_4_) + { + return p_getArmorModelHook_4_; + } + + public ResourceLocation getArmorResource(Entity p_getArmorResource_1_, ItemStack p_getArmorResource_2_, int p_getArmorResource_3_, String p_getArmorResource_4_) + { + ItemArmor itemarmor = (ItemArmor)p_getArmorResource_2_.getItem(); + String s = itemarmor.getArmorMaterial().getName(); + String s1 = "minecraft"; + int i = s.indexOf(58); + + if (i != -1) + { + s1 = s.substring(0, i); + s = s.substring(i + 1); + } + + String s2 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", new Object[] {s1, s, Integer.valueOf(p_getArmorResource_3_ == 2 ? 2 : 1), p_getArmorResource_4_ == null ? "" : String.format("_%s", new Object[]{p_getArmorResource_4_})}); + s2 = Reflector.callString(Reflector.ForgeHooksClient_getArmorTexture, new Object[] {p_getArmorResource_1_, p_getArmorResource_2_, s2, Integer.valueOf(p_getArmorResource_3_), p_getArmorResource_4_}); + ResourceLocation resourcelocation = (ResourceLocation)ARMOR_TEXTURE_RES_MAP.get(s2); + + if (resourcelocation == null) + { + resourcelocation = new ResourceLocation(s2); + ARMOR_TEXTURE_RES_MAP.put(s2, resourcelocation); + } + + return resourcelocation; + } + + static final class LayerArmorBase$1 + { + static final int[] field_178747_a = new int[ItemArmor.ArmorMaterial.values().length]; + private static final String __OBFID = "CL_00002427"; + + static + { + try + { + field_178747_a[ItemArmor.ArmorMaterial.LEATHER.ordinal()] = 1; + } + catch (NoSuchFieldError var5) + { + ; + } + + try + { + field_178747_a[ItemArmor.ArmorMaterial.CHAIN.ordinal()] = 2; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_178747_a[ItemArmor.ArmorMaterial.IRON.ordinal()] = 3; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_178747_a[ItemArmor.ArmorMaterial.GOLD.ordinal()] = 4; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_178747_a[ItemArmor.ArmorMaterial.DIAMOND.ordinal()] = 5; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerArrow.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerArrow.java new file mode 100644 index 0000000..b55f03c --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerArrow.java @@ -0,0 +1,70 @@ +package net.minecraft.client.renderer.entity.layers; + +import java.util.Random; +import net.minecraft.client.model.ModelBox; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.util.MathHelper; + +public class LayerArrow implements LayerRenderer +{ + private final RendererLivingEntity field_177168_a; + + public LayerArrow(RendererLivingEntity p_i46124_1_) + { + this.field_177168_a = p_i46124_1_; + } + + public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + int i = entitylivingbaseIn.getArrowCountInEntity(); + + if (i > 0) + { + Entity entity = new EntityArrow(entitylivingbaseIn.worldObj, entitylivingbaseIn.posX, entitylivingbaseIn.posY, entitylivingbaseIn.posZ); + Random random = new Random((long)entitylivingbaseIn.getEntityId()); + RenderHelper.disableStandardItemLighting(); + + for (int j = 0; j < i; ++j) + { + GlStateManager.pushMatrix(); + ModelRenderer modelrenderer = this.field_177168_a.getMainModel().getRandomModelBox(random); + ModelBox modelbox = (ModelBox)modelrenderer.cubeList.get(random.nextInt(modelrenderer.cubeList.size())); + modelrenderer.postRender(0.0625F); + float f = random.nextFloat(); + float f1 = random.nextFloat(); + float f2 = random.nextFloat(); + float f3 = (modelbox.posX1 + (modelbox.posX2 - modelbox.posX1) * f) / 16.0F; + float f4 = (modelbox.posY1 + (modelbox.posY2 - modelbox.posY1) * f1) / 16.0F; + float f5 = (modelbox.posZ1 + (modelbox.posZ2 - modelbox.posZ1) * f2) / 16.0F; + GlStateManager.translate(f3, f4, f5); + f = f * 2.0F - 1.0F; + f1 = f1 * 2.0F - 1.0F; + f2 = f2 * 2.0F - 1.0F; + f = f * -1.0F; + f1 = f1 * -1.0F; + f2 = f2 * -1.0F; + float f6 = MathHelper.sqrt_float(f * f + f2 * f2); + entity.prevRotationYaw = entity.rotationYaw = (float)(Math.atan2((double)f, (double)f2) * 180.0D / Math.PI); + entity.prevRotationPitch = entity.rotationPitch = (float)(Math.atan2((double)f1, (double)f6) * 180.0D / Math.PI); + double d0 = 0.0D; + double d1 = 0.0D; + double d2 = 0.0D; + this.field_177168_a.getRenderManager().renderEntityWithPosYaw(entity, d0, d1, d2, 0.0F, partialTicks); + GlStateManager.popMatrix(); + } + + RenderHelper.enableStandardItemLighting(); + } + } + + public boolean shouldCombineTextures() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java new file mode 100644 index 0000000..6029bd1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java @@ -0,0 +1,52 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.entity.RendererLivingEntity; + +public class LayerBipedArmor extends LayerArmorBase +{ + public LayerBipedArmor(RendererLivingEntity rendererIn) + { + super(rendererIn); + } + + protected void initArmor() + { + this.field_177189_c = new ModelBiped(0.5F); + this.field_177186_d = new ModelBiped(1.0F); + } + + protected void func_177179_a(ModelBiped p_177179_1_, int p_177179_2_) + { + this.func_177194_a(p_177179_1_); + + switch (p_177179_2_) + { + case 1: + p_177179_1_.bipedRightLeg.showModel = true; + p_177179_1_.bipedLeftLeg.showModel = true; + break; + + case 2: + p_177179_1_.bipedBody.showModel = true; + p_177179_1_.bipedRightLeg.showModel = true; + p_177179_1_.bipedLeftLeg.showModel = true; + break; + + case 3: + p_177179_1_.bipedBody.showModel = true; + p_177179_1_.bipedRightArm.showModel = true; + p_177179_1_.bipedLeftArm.showModel = true; + break; + + case 4: + p_177179_1_.bipedHead.showModel = true; + p_177179_1_.bipedHeadwear.showModel = true; + } + } + + protected void func_177194_a(ModelBiped p_177194_1_) + { + p_177194_1_.setInvisible(false); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerCape.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerCape.java new file mode 100644 index 0000000..84fdf3d --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerCape.java @@ -0,0 +1,178 @@ +package net.minecraft.client.renderer.entity.layers; + +import com.mojang.realmsclient.dto.RealmsServer.McoServerComparator; + +import animeware.cosmetic.Booleans; +import animeware.cosmetic.CosmeticChecker; +import animeware.util.cosmetic.AnimUtil; +import animeware.util.render.AnimatedResourceLocation; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class LayerCape implements LayerRenderer +{ +public AnimatedResourceLocation gif; + + public boolean nocape; + + LayerCape lCape; + + //private final RenderPlayer playerRenderer; + + + private final RenderPlayer playerRenderer; + + public LayerCape(RenderPlayer playerRendererIn) + { + this.playerRenderer = playerRendererIn; + } + + public boolean shouldCombineTextures() + { + return false; + } + + + public static void update() { + //timer = timer + mc.thePlayer.ticksExisted; + /*if(NightSky.timer == 50) { + NightSky.timer = 0; + } + int maxFrames = 2; + if (NightSky.timer == 49) + //ticks = 1; + NightSky.ticks++; + System.out.println(NightSky.ticks); + + if (NightSky.ticks > maxFrames) { + NightSky.ticks = 1; + }*/ + } + + @Override + public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, + float ageInTicks, float netHeadYaw, float headPitch, float scale) { + gif = new AnimatedResourceLocation("Animeware/cosmetic/capes/anim/lightning", 10, 5); + if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE)/* && CapeChecker.ownsZeroTwoCape(entitylivingbaseIn)*/) + { + + //gif = new AnimatedResourceLocation("Animeware/cosmetic/capes/anim/lightning", 10, 5); + //if(CosmeticController.shouldZeroTwoCape(entitylivingbaseIn) && entitylivingbaseIn == Minecraft.getMinecraft().thePlayer) { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + //if (Animeware.QuickCape && ServerShitCapes.isWearingCape1(((AbstractClientPlayer) entitylivingbaseIn).getGameProfile().getName())) { + try { + if(entitylivingbaseIn == Minecraft.getMinecraft().thePlayer && !entitylivingbaseIn.isInvisible()) { + if (Booleans.QuickCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/quick.png")); + } else if (Booleans.PlanetsCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/planetscape.png")); + } else if (Booleans.QuavCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/quav_cape.png")); + } else if (Booleans.ReptyllCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/reptyll.png")); + } else if (Booleans.SwordCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/swordcape.png")); + } else if (Booleans.EmeraldCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/emeraldcape.png")); + } else if (Booleans.LCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/lcape.png")); + } else if (Booleans.NitroCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/nitro.png")); + } else if (Booleans.DarkCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/darkcape.png")); + } else if (Booleans.Cape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/cape.png")); + } else if (Booleans.YTCape && CosmeticChecker.ownsYtCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/yt.png")); + } else if (Booleans.DevCape && CosmeticChecker.ownsDevCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/devcape.png")); + } else if (Booleans.OwnerCape && CosmeticChecker.ownsOwnerCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/ownercape.png")); + } else if (Booleans.GradientBlack && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/gradientblack.png")); + } else if (Booleans.GradientBlue && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/gradientblue.png")); + } else if (Booleans.GradientGreen && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/gradientgreen.png")); + } else if (Booleans.GradientPurple && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/gradientpurple.png")); + } else if (Booleans.GradientRed && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/gradientred.png")); + } else if (Booleans.tanjirocape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/tanjirocape.png")); + } else if (Booleans.kocho2cape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/kocho2cape.png")); + } else if (Booleans.kocho3cape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/kocho3cape.png")); + } else if (Booleans.dseyes2cape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/dseyes2cape.png")); + } else if (Booleans.dseyescape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/dseyescape.png")); + } else if (Booleans.wintercape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/wintercape.png")); + } else if (Booleans.Sparkofyt && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/discord/sparkofytcape.png")); + } else if (Booleans.Sparkofyt2 && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/discord/sparkofyt2cape.png")); + } else if (Booleans.RinneCape && CosmeticChecker.ownsZeroTwoCape(entitylivingbaseIn)) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/ani/rinnegan/" + AnimUtil.frames + ".png")); //Animeware/cosmetic/capes/blank.png + } else if(entitylivingbaseIn == Minecraft.getMinecraft().thePlayer) { + //this.nocape = true; + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/blank.png")); //Animeware/cosmetic/capes/blank.png + //this.playerRenderer.bindTexture(entitylivingbaseIn.getLocationCape()); + //this.playerRenderer.bindTexture(entitylivingbaseIn.getLocationCape()); + } + } else { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/blank.png")); //Animeware/cosmetic/capes/blank.png + } + } catch(NullPointerException e) { + this.playerRenderer.bindTexture(new ResourceLocation("Animeware/cosmetic/capes/blank.png")); + e.printStackTrace(); + } + + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.125F); + double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks); + double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks); + double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks); + float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks; + double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F); + double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F)); + float f1 = (float)d1 * 10.0F; + f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F); + float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F; + float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks; + f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4; + + if (entitylivingbaseIn.isSneaking()) + { + f1 += 25.0F; + } + if (entitylivingbaseIn.isSneaking()) + { + //f1 += 25.0F; + GlStateManager.translate(0.0F, 0.142F, -0.0178F); + //GlStateManager.translate(0.0F, 0.0F, 0.0F); + } + + GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + this.playerRenderer.getMainModel().renderCape(0.0625F); + GlStateManager.popMatrix(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerCreeperCharge.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerCreeperCharge.java new file mode 100644 index 0000000..5bc54cb --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerCreeperCharge.java @@ -0,0 +1,52 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.model.ModelCreeper; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderCreeper; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.util.ResourceLocation; + +public class LayerCreeperCharge implements LayerRenderer +{ + private static final ResourceLocation LIGHTNING_TEXTURE = new ResourceLocation("textures/entity/creeper/creeper_armor.png"); + private final RenderCreeper creeperRenderer; + private final ModelCreeper creeperModel = new ModelCreeper(2.0F); + + public LayerCreeperCharge(RenderCreeper creeperRendererIn) + { + this.creeperRenderer = creeperRendererIn; + } + + public void doRenderLayer(EntityCreeper entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (entitylivingbaseIn.getPowered()) + { + boolean flag = entitylivingbaseIn.isInvisible(); + GlStateManager.depthMask(!flag); + this.creeperRenderer.bindTexture(LIGHTNING_TEXTURE); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + float f = (float)entitylivingbaseIn.ticksExisted + partialTicks; + GlStateManager.translate(f * 0.01F, f * 0.01F, 0.0F); + GlStateManager.matrixMode(5888); + GlStateManager.enableBlend(); + float f1 = 0.5F; + GlStateManager.color(f1, f1, f1, 1.0F); + GlStateManager.disableLighting(); + GlStateManager.blendFunc(1, 1); + this.creeperModel.setModelAttributes(this.creeperRenderer.getMainModel()); + this.creeperModel.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + GlStateManager.enableLighting(); + GlStateManager.disableBlend(); + GlStateManager.depthMask(flag); + } + } + + public boolean shouldCombineTextures() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerCustomHead.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerCustomHead.java new file mode 100644 index 0000000..b79fb89 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerCustomHead.java @@ -0,0 +1,117 @@ +package net.minecraft.client.renderer.entity.layers; + +import com.mojang.authlib.GameProfile; +import java.util.UUID; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.tileentity.TileEntitySkull; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.StringUtils; + +public class LayerCustomHead implements LayerRenderer +{ + private final ModelRenderer field_177209_a; + + public LayerCustomHead(ModelRenderer p_i46120_1_) + { + this.field_177209_a = p_i46120_1_; + } + + public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + ItemStack itemstack = entitylivingbaseIn.getCurrentArmor(3); + + if (itemstack != null && itemstack.getItem() != null) + { + Item item = itemstack.getItem(); + Minecraft minecraft = Minecraft.getMinecraft(); + GlStateManager.pushMatrix(); + + if (entitylivingbaseIn.isSneaking()) + { + GlStateManager.translate(0.0F, 0.2F, 0.0F); + } + + boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombie && ((EntityZombie)entitylivingbaseIn).isVillager(); + + if (!flag && entitylivingbaseIn.isChild()) + { + float f = 2.0F; + float f1 = 1.4F; + GlStateManager.scale(f1 / f, f1 / f, f1 / f); + GlStateManager.translate(0.0F, 16.0F * scale, 0.0F); + } + + this.field_177209_a.postRender(0.0625F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + + if (item instanceof ItemBlock) + { + float f2 = 0.625F; + GlStateManager.translate(0.0F, -0.25F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.scale(f2, -f2, -f2); + + if (flag) + { + GlStateManager.translate(0.0F, 0.1875F, 0.0F); + } + + minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD); + } + else if (item == Items.skull) + { + float f3 = 1.1875F; + GlStateManager.scale(f3, -f3, -f3); + + if (flag) + { + GlStateManager.translate(0.0F, 0.0625F, 0.0F); + } + + GameProfile gameprofile = null; + + if (itemstack.hasTagCompound()) + { + NBTTagCompound nbttagcompound = itemstack.getTagCompound(); + + if (nbttagcompound.hasKey("SkullOwner", 10)) + { + gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner")); + } + else if (nbttagcompound.hasKey("SkullOwner", 8)) + { + String s = nbttagcompound.getString("SkullOwner"); + + if (!StringUtils.isNullOrEmpty(s)) + { + gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s)); + nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile)); + } + } + } + + TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1); + } + + GlStateManager.popMatrix(); + } + } + + public boolean shouldCombineTextures() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerDeadmau5Head.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerDeadmau5Head.java new file mode 100644 index 0000000..aa2ca6e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerDeadmau5Head.java @@ -0,0 +1,45 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; + +public class LayerDeadmau5Head implements LayerRenderer +{ + private final RenderPlayer playerRenderer; + + public LayerDeadmau5Head(RenderPlayer playerRendererIn) + { + this.playerRenderer = playerRendererIn; + } + + public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (entitylivingbaseIn.getName().equals("deadmau5") && entitylivingbaseIn.hasSkin() && !entitylivingbaseIn.isInvisible()) + { + this.playerRenderer.bindTexture(entitylivingbaseIn.getLocationSkin()); + + for (int i = 0; i < 2; ++i) + { + float f = entitylivingbaseIn.prevRotationYaw + (entitylivingbaseIn.rotationYaw - entitylivingbaseIn.prevRotationYaw) * partialTicks - (entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks); + float f1 = entitylivingbaseIn.prevRotationPitch + (entitylivingbaseIn.rotationPitch - entitylivingbaseIn.prevRotationPitch) * partialTicks; + GlStateManager.pushMatrix(); + GlStateManager.rotate(f, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(f1, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(0.375F * (float)(i * 2 - 1), 0.0F, 0.0F); + GlStateManager.translate(0.0F, -0.375F, 0.0F); + GlStateManager.rotate(-f1, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-f, 0.0F, 1.0F, 0.0F); + float f2 = 1.3333334F; + GlStateManager.scale(f2, f2, f2); + this.playerRenderer.getMainModel().renderDeadmau5Head(0.0625F); + GlStateManager.popMatrix(); + } + } + } + + public boolean shouldCombineTextures() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerEnderDragonDeath.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerEnderDragonDeath.java new file mode 100644 index 0000000..5586883 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerEnderDragonDeath.java @@ -0,0 +1,74 @@ +package net.minecraft.client.renderer.entity.layers; + +import java.util.Random; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.boss.EntityDragon; + +public class LayerEnderDragonDeath implements LayerRenderer +{ + public void doRenderLayer(EntityDragon entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (entitylivingbaseIn.deathTicks > 0) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + RenderHelper.disableStandardItemLighting(); + float f = ((float)entitylivingbaseIn.deathTicks + partialTicks) / 200.0F; + float f1 = 0.0F; + + if (f > 0.8F) + { + f1 = (f - 0.8F) / 0.2F; + } + + Random random = new Random(432L); + GlStateManager.disableTexture2D(); + GlStateManager.shadeModel(7425); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 1); + GlStateManager.disableAlpha(); + GlStateManager.enableCull(); + GlStateManager.depthMask(false); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, -1.0F, -2.0F); + + for (int i = 0; (float)i < (f + f * f) / 2.0F * 60.0F; ++i) + { + GlStateManager.rotate(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(random.nextFloat() * 360.0F + f * 90.0F, 0.0F, 0.0F, 1.0F); + float f2 = random.nextFloat() * 20.0F + 5.0F + f1 * 10.0F; + float f3 = random.nextFloat() * 2.0F + 1.0F + f1 * 2.0F; + worldrenderer.begin(6, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos(0.0D, 0.0D, 0.0D).color(255, 255, 255, (int)(255.0F * (1.0F - f1))).endVertex(); + worldrenderer.pos(-0.866D * (double)f3, (double)f2, (double)(-0.5F * f3)).color(255, 0, 255, 0).endVertex(); + worldrenderer.pos(0.866D * (double)f3, (double)f2, (double)(-0.5F * f3)).color(255, 0, 255, 0).endVertex(); + worldrenderer.pos(0.0D, (double)f2, (double)(1.0F * f3)).color(255, 0, 255, 0).endVertex(); + worldrenderer.pos(-0.866D * (double)f3, (double)f2, (double)(-0.5F * f3)).color(255, 0, 255, 0).endVertex(); + tessellator.draw(); + } + + GlStateManager.popMatrix(); + GlStateManager.depthMask(true); + GlStateManager.disableCull(); + GlStateManager.disableBlend(); + GlStateManager.shadeModel(7424); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableTexture2D(); + GlStateManager.enableAlpha(); + RenderHelper.enableStandardItemLighting(); + } + } + + public boolean shouldCombineTextures() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerEnderDragonEyes.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerEnderDragonEyes.java new file mode 100644 index 0000000..385d64f --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerEnderDragonEyes.java @@ -0,0 +1,59 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.entity.RenderDragon; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import shadersmod.client.Shaders; + +public class LayerEnderDragonEyes implements LayerRenderer +{ + private static final ResourceLocation TEXTURE = new ResourceLocation("textures/entity/enderdragon/dragon_eyes.png"); + private final RenderDragon dragonRenderer; + private static final String __OBFID = "CL_00002419"; + + public LayerEnderDragonEyes(RenderDragon dragonRendererIn) + { + this.dragonRenderer = dragonRendererIn; + } + + public void doRenderLayer(EntityDragon entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + this.dragonRenderer.bindTexture(TEXTURE); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.blendFunc(1, 1); + GlStateManager.disableLighting(); + GlStateManager.depthFunc(514); + char c0 = 61680; + int i = c0 % 65536; + int j = c0 / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i / 1.0F, (float)j / 1.0F); + GlStateManager.enableLighting(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + + if (Config.isShaders()) + { + Shaders.beginSpiderEyes(); + } + + this.dragonRenderer.getMainModel().render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); + this.dragonRenderer.func_177105_a(entitylivingbaseIn, partialTicks); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.depthFunc(515); + } + + public boolean shouldCombineTextures() + { + return false; + } + + public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + this.doRenderLayer((EntityDragon)entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerEndermanEyes.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerEndermanEyes.java new file mode 100644 index 0000000..79416f2 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerEndermanEyes.java @@ -0,0 +1,59 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.entity.RenderEnderman; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import shadersmod.client.Shaders; + +public class LayerEndermanEyes implements LayerRenderer +{ + private static final ResourceLocation field_177203_a = new ResourceLocation("textures/entity/enderman/enderman_eyes.png"); + private final RenderEnderman endermanRenderer; + private static final String __OBFID = "CL_00002418"; + + public LayerEndermanEyes(RenderEnderman endermanRendererIn) + { + this.endermanRenderer = endermanRendererIn; + } + + public void doRenderLayer(EntityEnderman entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + this.endermanRenderer.bindTexture(field_177203_a); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.blendFunc(1, 1); + GlStateManager.disableLighting(); + GlStateManager.depthMask(!entitylivingbaseIn.isInvisible()); + char c0 = 61680; + int i = c0 % 65536; + int j = c0 / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i / 1.0F, (float)j / 1.0F); + GlStateManager.enableLighting(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + + if (Config.isShaders()) + { + Shaders.beginSpiderEyes(); + } + + this.endermanRenderer.getMainModel().render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); + this.endermanRenderer.func_177105_a(entitylivingbaseIn, partialTicks); + GlStateManager.depthMask(true); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + } + + public boolean shouldCombineTextures() + { + return false; + } + + public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + this.doRenderLayer((EntityEnderman)entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldBlock.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldBlock.java new file mode 100644 index 0000000..c117b9d --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldBlock.java @@ -0,0 +1,53 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.entity.RenderEnderman; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.monster.EntityEnderman; + +public class LayerHeldBlock implements LayerRenderer +{ + private final RenderEnderman endermanRenderer; + + public LayerHeldBlock(RenderEnderman endermanRendererIn) + { + this.endermanRenderer = endermanRendererIn; + } + + public void doRenderLayer(EntityEnderman entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + IBlockState iblockstate = entitylivingbaseIn.getHeldBlockState(); + + if (iblockstate.getBlock().getMaterial() != Material.air) + { + BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + GlStateManager.enableRescaleNormal(); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0F, 0.6875F, -0.75F); + GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.25F, 0.1875F, 0.25F); + float f = 0.5F; + GlStateManager.scale(-f, -f, f); + int i = entitylivingbaseIn.getBrightnessForRender(partialTicks); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.endermanRenderer.bindTexture(TextureMap.locationBlocksTexture); + blockrendererdispatcher.renderBlockBrightness(iblockstate, 1.0F); + GlStateManager.popMatrix(); + GlStateManager.disableRescaleNormal(); + } + } + + public boolean shouldCombineTextures() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java new file mode 100644 index 0000000..e01fad6 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java @@ -0,0 +1,75 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class LayerHeldItem implements LayerRenderer +{ + private final RendererLivingEntity livingEntityRenderer; + + public LayerHeldItem(RendererLivingEntity livingEntityRendererIn) + { + this.livingEntityRenderer = livingEntityRendererIn; + } + + public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + ItemStack itemstack = entitylivingbaseIn.getHeldItem(); + + if (itemstack != null) + { + GlStateManager.pushMatrix(); + + if (this.livingEntityRenderer.getMainModel().isChild) + { + float f = 0.5F; + GlStateManager.translate(0.0F, 0.625F, 0.0F); + GlStateManager.rotate(-20.0F, -1.0F, 0.0F, 0.0F); + GlStateManager.scale(f, f, f); + } + + ((ModelBiped)this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F); + GlStateManager.translate(-0.0625F, 0.4375F, 0.0625F); + + if (entitylivingbaseIn instanceof EntityPlayer && ((EntityPlayer)entitylivingbaseIn).fishEntity != null) + { + itemstack = new ItemStack(Items.fishing_rod, 0); + } + + Item item = itemstack.getItem(); + Minecraft minecraft = Minecraft.getMinecraft(); + + if (item instanceof ItemBlock && Block.getBlockFromItem(item).getRenderType() == 2) + { + GlStateManager.translate(0.0F, 0.1875F, -0.3125F); + GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F); + float f1 = 0.375F; + GlStateManager.scale(-f1, -f1, f1); + } + + if (entitylivingbaseIn.isSneaking()) + { + GlStateManager.translate(0.0F, 0.203125F, 0.0F); + } + + minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON); + GlStateManager.popMatrix(); + } + } + + public boolean shouldCombineTextures() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItemWitch.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItemWitch.java new file mode 100644 index 0000000..6ec8606 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItemWitch.java @@ -0,0 +1,99 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelWitch; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.entity.RenderWitch; +import net.minecraft.entity.monster.EntityWitch; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class LayerHeldItemWitch implements LayerRenderer +{ + private final RenderWitch witchRenderer; + + public LayerHeldItemWitch(RenderWitch witchRendererIn) + { + this.witchRenderer = witchRendererIn; + } + + public void doRenderLayer(EntityWitch entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + ItemStack itemstack = entitylivingbaseIn.getHeldItem(); + + if (itemstack != null) + { + GlStateManager.color(1.0F, 1.0F, 1.0F); + GlStateManager.pushMatrix(); + + if (this.witchRenderer.getMainModel().isChild) + { + GlStateManager.translate(0.0F, 0.625F, 0.0F); + GlStateManager.rotate(-20.0F, -1.0F, 0.0F, 0.0F); + float f = 0.5F; + GlStateManager.scale(f, f, f); + } + + ((ModelWitch)this.witchRenderer.getMainModel()).villagerNose.postRender(0.0625F); + GlStateManager.translate(-0.0625F, 0.53125F, 0.21875F); + Item item = itemstack.getItem(); + Minecraft minecraft = Minecraft.getMinecraft(); + + if (item instanceof ItemBlock && minecraft.getBlockRendererDispatcher().isRenderTypeChest(Block.getBlockFromItem(item), itemstack.getMetadata())) + { + GlStateManager.translate(0.0F, 0.0625F, -0.25F); + GlStateManager.rotate(30.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-5.0F, 0.0F, 1.0F, 0.0F); + float f4 = 0.375F; + GlStateManager.scale(f4, -f4, f4); + } + else if (item == Items.bow) + { + GlStateManager.translate(0.0F, 0.125F, -0.125F); + GlStateManager.rotate(-45.0F, 0.0F, 1.0F, 0.0F); + float f1 = 0.625F; + GlStateManager.scale(f1, -f1, f1); + GlStateManager.rotate(-100.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-20.0F, 0.0F, 1.0F, 0.0F); + } + else if (item.isFull3D()) + { + if (item.shouldRotateAroundWhenRendering()) + { + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.translate(0.0F, -0.0625F, 0.0F); + } + + this.witchRenderer.transformHeldFull3DItemLayer(); + GlStateManager.translate(0.0625F, -0.125F, 0.0F); + float f2 = 0.625F; + GlStateManager.scale(f2, -f2, f2); + GlStateManager.rotate(0.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(0.0F, 0.0F, 1.0F, 0.0F); + } + else + { + GlStateManager.translate(0.1875F, 0.1875F, 0.0F); + float f3 = 0.875F; + GlStateManager.scale(f3, f3, f3); + GlStateManager.rotate(-20.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.rotate(-60.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-30.0F, 0.0F, 0.0F, 1.0F); + } + + GlStateManager.rotate(-15.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(40.0F, 0.0F, 0.0F, 1.0F); + minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.THIRD_PERSON); + GlStateManager.popMatrix(); + } + } + + public boolean shouldCombineTextures() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerIronGolemFlower.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerIronGolemFlower.java new file mode 100644 index 0000000..34034f0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerIronGolemFlower.java @@ -0,0 +1,50 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelIronGolem; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.entity.RenderIronGolem; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.init.Blocks; + +public class LayerIronGolemFlower implements LayerRenderer +{ + private final RenderIronGolem ironGolemRenderer; + + public LayerIronGolemFlower(RenderIronGolem ironGolemRendererIn) + { + this.ironGolemRenderer = ironGolemRendererIn; + } + + public void doRenderLayer(EntityIronGolem entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (entitylivingbaseIn.getHoldRoseTick() != 0) + { + BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + GlStateManager.enableRescaleNormal(); + GlStateManager.pushMatrix(); + GlStateManager.rotate(5.0F + 180.0F * ((ModelIronGolem)this.ironGolemRenderer.getMainModel()).ironGolemRightArm.rotateAngleX / (float)Math.PI, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(-0.9375F, -0.625F, -0.9375F); + float f = 0.5F; + GlStateManager.scale(f, -f, f); + int i = entitylivingbaseIn.getBrightnessForRender(partialTicks); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.ironGolemRenderer.bindTexture(TextureMap.locationBlocksTexture); + blockrendererdispatcher.renderBlockBrightness(Blocks.red_flower.getDefaultState(), 1.0F); + GlStateManager.popMatrix(); + GlStateManager.disableRescaleNormal(); + } + } + + public boolean shouldCombineTextures() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerMooshroomMushroom.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerMooshroomMushroom.java new file mode 100644 index 0000000..3009c04 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerMooshroomMushroom.java @@ -0,0 +1,61 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelQuadruped; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderMooshroom; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.passive.EntityMooshroom; +import net.minecraft.init.Blocks; + +public class LayerMooshroomMushroom implements LayerRenderer +{ + private final RenderMooshroom mooshroomRenderer; + + public LayerMooshroomMushroom(RenderMooshroom mooshroomRendererIn) + { + this.mooshroomRenderer = mooshroomRendererIn; + } + + public void doRenderLayer(EntityMooshroom entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (!entitylivingbaseIn.isChild() && !entitylivingbaseIn.isInvisible()) + { + BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + this.mooshroomRenderer.bindTexture(TextureMap.locationBlocksTexture); + GlStateManager.enableCull(); + GlStateManager.cullFace(1028); + GlStateManager.pushMatrix(); + GlStateManager.scale(1.0F, -1.0F, 1.0F); + GlStateManager.translate(0.2F, 0.35F, 0.5F); + GlStateManager.rotate(42.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.pushMatrix(); + GlStateManager.translate(-0.5F, -0.5F, 0.5F); + blockrendererdispatcher.renderBlockBrightness(Blocks.red_mushroom.getDefaultState(), 1.0F); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.1F, 0.0F, -0.6F); + GlStateManager.rotate(42.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(-0.5F, -0.5F, 0.5F); + blockrendererdispatcher.renderBlockBrightness(Blocks.red_mushroom.getDefaultState(), 1.0F); + GlStateManager.popMatrix(); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + ((ModelQuadruped)this.mooshroomRenderer.getMainModel()).head.postRender(0.0625F); + GlStateManager.scale(1.0F, -1.0F, 1.0F); + GlStateManager.translate(0.0F, 0.7F, -0.2F); + GlStateManager.rotate(12.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(-0.5F, -0.5F, 0.5F); + blockrendererdispatcher.renderBlockBrightness(Blocks.red_mushroom.getDefaultState(), 1.0F); + GlStateManager.popMatrix(); + GlStateManager.cullFace(1029); + GlStateManager.disableCull(); + } + } + + public boolean shouldCombineTextures() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerRenderer.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerRenderer.java new file mode 100644 index 0000000..bad5116 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerRenderer.java @@ -0,0 +1,10 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.entity.EntityLivingBase; + +public interface LayerRenderer +{ + void doRenderLayer(E entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale); + + boolean shouldCombineTextures(); +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSaddle.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSaddle.java new file mode 100644 index 0000000..b913eda --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSaddle.java @@ -0,0 +1,33 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.model.ModelPig; +import net.minecraft.client.renderer.entity.RenderPig; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.util.ResourceLocation; + +public class LayerSaddle implements LayerRenderer +{ + private static final ResourceLocation TEXTURE = new ResourceLocation("textures/entity/pig/pig_saddle.png"); + private final RenderPig pigRenderer; + private final ModelPig pigModel = new ModelPig(0.5F); + + public LayerSaddle(RenderPig pigRendererIn) + { + this.pigRenderer = pigRendererIn; + } + + public void doRenderLayer(EntityPig entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (entitylivingbaseIn.getSaddled()) + { + this.pigRenderer.bindTexture(TEXTURE); + this.pigModel.setModelAttributes(this.pigRenderer.getMainModel()); + this.pigModel.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); + } + } + + public boolean shouldCombineTextures() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSheepWool.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSheepWool.java new file mode 100644 index 0000000..8d717cf --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSheepWool.java @@ -0,0 +1,77 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.model.ModelSheep1; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderSheep; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import optifine.CustomColors; + +public class LayerSheepWool implements LayerRenderer +{ + private static final ResourceLocation TEXTURE = new ResourceLocation("textures/entity/sheep/sheep_fur.png"); + private final RenderSheep sheepRenderer; + private final ModelSheep1 sheepModel = new ModelSheep1(); + private static final String __OBFID = "CL_00002413"; + + public LayerSheepWool(RenderSheep sheepRendererIn) + { + this.sheepRenderer = sheepRendererIn; + } + + public void doRenderLayer(EntitySheep entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (!entitylivingbaseIn.getSheared() && !entitylivingbaseIn.isInvisible()) + { + this.sheepRenderer.bindTexture(TEXTURE); + + if (entitylivingbaseIn.hasCustomName() && "jeb_".equals(entitylivingbaseIn.getCustomNameTag())) + { + boolean flag = true; + int i = entitylivingbaseIn.ticksExisted / 25 + entitylivingbaseIn.getEntityId(); + int j = EnumDyeColor.values().length; + int k = i % j; + int l = (i + 1) % j; + float f = ((float)(entitylivingbaseIn.ticksExisted % 25) + partialTicks) / 25.0F; + float[] afloat1 = EntitySheep.func_175513_a(EnumDyeColor.byMetadata(k)); + float[] afloat2 = EntitySheep.func_175513_a(EnumDyeColor.byMetadata(l)); + + if (Config.isCustomColors()) + { + afloat1 = CustomColors.getSheepColors(EnumDyeColor.byMetadata(k), afloat1); + afloat2 = CustomColors.getSheepColors(EnumDyeColor.byMetadata(l), afloat2); + } + + GlStateManager.color(afloat1[0] * (1.0F - f) + afloat2[0] * f, afloat1[1] * (1.0F - f) + afloat2[1] * f, afloat1[2] * (1.0F - f) + afloat2[2] * f); + } + else + { + float[] afloat = EntitySheep.func_175513_a(entitylivingbaseIn.getFleeceColor()); + + if (Config.isCustomColors()) + { + afloat = CustomColors.getSheepColors(entitylivingbaseIn.getFleeceColor(), afloat); + } + + GlStateManager.color(afloat[0], afloat[1], afloat[2]); + } + + this.sheepModel.setModelAttributes(this.sheepRenderer.getMainModel()); + this.sheepModel.setLivingAnimations(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks); + this.sheepModel.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); + } + } + + public boolean shouldCombineTextures() + { + return true; + } + + public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + this.doRenderLayer((EntitySheep)entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSlimeGel.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSlimeGel.java new file mode 100644 index 0000000..c9c8ebc --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSlimeGel.java @@ -0,0 +1,38 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelSlime; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderSlime; +import net.minecraft.entity.monster.EntitySlime; + +public class LayerSlimeGel implements LayerRenderer +{ + private final RenderSlime slimeRenderer; + private final ModelBase slimeModel = new ModelSlime(0); + + public LayerSlimeGel(RenderSlime slimeRendererIn) + { + this.slimeRenderer = slimeRendererIn; + } + + public void doRenderLayer(EntitySlime entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (!entitylivingbaseIn.isInvisible()) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableNormalize(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + this.slimeModel.setModelAttributes(this.slimeRenderer.getMainModel()); + this.slimeModel.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); + GlStateManager.disableBlend(); + GlStateManager.disableNormalize(); + } + } + + public boolean shouldCombineTextures() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSnowmanHead.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSnowmanHead.java new file mode 100644 index 0000000..7a81150 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSnowmanHead.java @@ -0,0 +1,39 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.entity.RenderSnowMan; +import net.minecraft.entity.monster.EntitySnowman; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; + +public class LayerSnowmanHead implements LayerRenderer +{ + private final RenderSnowMan snowManRenderer; + + public LayerSnowmanHead(RenderSnowMan snowManRendererIn) + { + this.snowManRenderer = snowManRendererIn; + } + + public void doRenderLayer(EntitySnowman entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (!entitylivingbaseIn.isInvisible()) + { + GlStateManager.pushMatrix(); + this.snowManRenderer.getMainModel().head.postRender(0.0625F); + float f = 0.625F; + GlStateManager.translate(0.0F, -0.34375F, 0.0F); + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.scale(f, -f, -f); + Minecraft.getMinecraft().getItemRenderer().renderItem(entitylivingbaseIn, new ItemStack(Blocks.pumpkin, 1), ItemCameraTransforms.TransformType.HEAD); + GlStateManager.popMatrix(); + } + } + + public boolean shouldCombineTextures() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSpiderEyes.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSpiderEyes.java new file mode 100644 index 0000000..9ce127a --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerSpiderEyes.java @@ -0,0 +1,69 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.entity.RenderSpider; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import shadersmod.client.Shaders; + +public class LayerSpiderEyes implements LayerRenderer +{ + private static final ResourceLocation SPIDER_EYES = new ResourceLocation("textures/entity/spider_eyes.png"); + private final RenderSpider spiderRenderer; + private static final String __OBFID = "CL_00002410"; + + public LayerSpiderEyes(RenderSpider spiderRendererIn) + { + this.spiderRenderer = spiderRendererIn; + } + + public void doRenderLayer(EntitySpider entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + this.spiderRenderer.bindTexture(SPIDER_EYES); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.blendFunc(1, 1); + + if (entitylivingbaseIn.isInvisible()) + { + GlStateManager.depthMask(false); + } + else + { + GlStateManager.depthMask(true); + } + + char c0 = 61680; + int i = c0 % 65536; + int j = c0 / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i / 1.0F, (float)j / 1.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + + if (Config.isShaders()) + { + Shaders.beginSpiderEyes(); + } + + this.spiderRenderer.getMainModel().render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); + int k = entitylivingbaseIn.getBrightnessForRender(partialTicks); + i = k % 65536; + j = k / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i / 1.0F, (float)j / 1.0F); + this.spiderRenderer.func_177105_a(entitylivingbaseIn, partialTicks); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + } + + public boolean shouldCombineTextures() + { + return false; + } + + public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + this.doRenderLayer((EntitySpider)entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerVillagerArmor.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerVillagerArmor.java new file mode 100644 index 0000000..ed453aa --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerVillagerArmor.java @@ -0,0 +1,18 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.model.ModelZombieVillager; +import net.minecraft.client.renderer.entity.RendererLivingEntity; + +public class LayerVillagerArmor extends LayerBipedArmor +{ + public LayerVillagerArmor(RendererLivingEntity rendererIn) + { + super(rendererIn); + } + + protected void initArmor() + { + this.field_177189_c = new ModelZombieVillager(0.5F, 0.0F, true); + this.field_177186_d = new ModelZombieVillager(1.0F, 0.0F, true); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerWitherAura.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerWitherAura.java new file mode 100644 index 0000000..7a61f3f --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerWitherAura.java @@ -0,0 +1,54 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.model.ModelWither; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderWither; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class LayerWitherAura implements LayerRenderer +{ + private static final ResourceLocation WITHER_ARMOR = new ResourceLocation("textures/entity/wither/wither_armor.png"); + private final RenderWither witherRenderer; + private final ModelWither witherModel = new ModelWither(0.5F); + + public LayerWitherAura(RenderWither witherRendererIn) + { + this.witherRenderer = witherRendererIn; + } + + public void doRenderLayer(EntityWither entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (entitylivingbaseIn.isArmored()) + { + GlStateManager.depthMask(!entitylivingbaseIn.isInvisible()); + this.witherRenderer.bindTexture(WITHER_ARMOR); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + float f = (float)entitylivingbaseIn.ticksExisted + partialTicks; + float f1 = MathHelper.cos(f * 0.02F) * 3.0F; + float f2 = f * 0.01F; + GlStateManager.translate(f1, f2, 0.0F); + GlStateManager.matrixMode(5888); + GlStateManager.enableBlend(); + float f3 = 0.5F; + GlStateManager.color(f3, f3, f3, 1.0F); + GlStateManager.disableLighting(); + GlStateManager.blendFunc(1, 1); + this.witherModel.setLivingAnimations(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks); + this.witherModel.setModelAttributes(this.witherRenderer.getMainModel()); + this.witherModel.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + GlStateManager.enableLighting(); + GlStateManager.disableBlend(); + } + } + + public boolean shouldCombineTextures() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerWolfCollar.java b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerWolfCollar.java new file mode 100644 index 0000000..0de5e32 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/entity/layers/LayerWolfCollar.java @@ -0,0 +1,51 @@ +package net.minecraft.client.renderer.entity.layers; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderWolf; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import optifine.CustomColors; + +public class LayerWolfCollar implements LayerRenderer +{ + private static final ResourceLocation WOLF_COLLAR = new ResourceLocation("textures/entity/wolf/wolf_collar.png"); + private final RenderWolf wolfRenderer; + private static final String __OBFID = "CL_00002405"; + + public LayerWolfCollar(RenderWolf wolfRendererIn) + { + this.wolfRenderer = wolfRendererIn; + } + + public void doRenderLayer(EntityWolf entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + if (entitylivingbaseIn.isTamed() && !entitylivingbaseIn.isInvisible()) + { + this.wolfRenderer.bindTexture(WOLF_COLLAR); + EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(entitylivingbaseIn.getCollarColor().getMetadata()); + float[] afloat = EntitySheep.func_175513_a(enumdyecolor); + + if (Config.isCustomColors()) + { + afloat = CustomColors.getWolfCollarColors(enumdyecolor, afloat); + } + + GlStateManager.color(afloat[0], afloat[1], afloat[2]); + this.wolfRenderer.getMainModel().render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); + } + } + + public boolean shouldCombineTextures() + { + return true; + } + + public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + this.doRenderLayer((EntityWolf)entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/AbstractTexture.java b/src/minecraft/net/minecraft/client/renderer/texture/AbstractTexture.java new file mode 100644 index 0000000..281ad39 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/AbstractTexture.java @@ -0,0 +1,80 @@ +package net.minecraft.client.renderer.texture; + +import net.minecraft.client.renderer.GlStateManager; +import org.lwjgl.opengl.GL11; +import shadersmod.client.MultiTexID; +import shadersmod.client.ShadersTex; + +public abstract class AbstractTexture implements ITextureObject +{ + protected int glTextureId = -1; + protected boolean blur; + protected boolean mipmap; + protected boolean blurLast; + protected boolean mipmapLast; + private static final String __OBFID = "CL_00001047"; + public MultiTexID multiTex; + + public void setBlurMipmapDirect(boolean p_174937_1_, boolean p_174937_2_) + { + this.blur = p_174937_1_; + this.mipmap = p_174937_2_; + boolean flag = true; + boolean flag1 = true; + int i; + short short1; + + if (p_174937_1_) + { + i = p_174937_2_ ? 9987 : 9729; + short1 = 9729; + } + else + { + i = p_174937_2_ ? 9986 : 9728; + short1 = 9728; + } + + GlStateManager.bindTexture(this.getGlTextureId()); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, i); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, short1); + } + + public void setBlurMipmap(boolean p_174936_1_, boolean p_174936_2_) + { + this.blurLast = this.blur; + this.mipmapLast = this.mipmap; + this.setBlurMipmapDirect(p_174936_1_, p_174936_2_); + } + + public void restoreLastBlurMipmap() + { + this.setBlurMipmapDirect(this.blurLast, this.mipmapLast); + } + + public int getGlTextureId() + { + if (this.glTextureId == -1) + { + this.glTextureId = TextureUtil.glGenTextures(); + } + + return this.glTextureId; + } + + public void deleteGlTexture() + { + ShadersTex.deleteTextures(this, this.glTextureId); + + if (this.glTextureId != -1) + { + TextureUtil.deleteTexture(this.glTextureId); + this.glTextureId = -1; + } + } + + public MultiTexID getMultiTexID() + { + return ShadersTex.getMultiTexID(this); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/DynamicTexture.java b/src/minecraft/net/minecraft/client/renderer/texture/DynamicTexture.java new file mode 100644 index 0000000..d777450 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/DynamicTexture.java @@ -0,0 +1,72 @@ +package net.minecraft.client.renderer.texture; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import net.minecraft.client.resources.IResourceManager; +import optifine.Config; +import shadersmod.client.ShadersTex; + +public class DynamicTexture extends AbstractTexture +{ + private final int[] dynamicTextureData; + + /** width of this icon in pixels */ + private final int width; + + /** height of this icon in pixels */ + private final int height; + private static final String __OBFID = "CL_00001048"; + private boolean shadersInitialized; + + public DynamicTexture(BufferedImage bufferedImage) + { + this(bufferedImage.getWidth(), bufferedImage.getHeight()); + bufferedImage.getRGB(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight(), this.dynamicTextureData, 0, bufferedImage.getWidth()); + this.updateDynamicTexture(); + } + + public DynamicTexture(int textureWidth, int textureHeight) + { + this.shadersInitialized = false; + this.width = textureWidth; + this.height = textureHeight; + this.dynamicTextureData = new int[textureWidth * textureHeight * 3]; + + if (Config.isShaders()) + { + ShadersTex.initDynamicTexture(this.getGlTextureId(), textureWidth, textureHeight, this); + this.shadersInitialized = true; + } + else + { + TextureUtil.allocateTexture(this.getGlTextureId(), textureWidth, textureHeight); + } + } + + public void loadTexture(IResourceManager resourceManager) throws IOException + { + } + + public void updateDynamicTexture() + { + if (Config.isShaders()) + { + if (!this.shadersInitialized) + { + ShadersTex.initDynamicTexture(this.getGlTextureId(), this.width, this.height, this); + this.shadersInitialized = true; + } + + ShadersTex.updateDynamicTexture(this.getGlTextureId(), this.dynamicTextureData, this.width, this.height, this); + } + else + { + TextureUtil.uploadTexture(this.getGlTextureId(), this.dynamicTextureData, this.width, this.height); + } + } + + public int[] getTextureData() + { + return this.dynamicTextureData; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/IIconCreator.java b/src/minecraft/net/minecraft/client/renderer/texture/IIconCreator.java new file mode 100644 index 0000000..54da0f8 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/IIconCreator.java @@ -0,0 +1,6 @@ +package net.minecraft.client.renderer.texture; + +public interface IIconCreator +{ + void registerSprites(TextureMap iconRegistry); +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/ITextureObject.java b/src/minecraft/net/minecraft/client/renderer/texture/ITextureObject.java new file mode 100644 index 0000000..28740da --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/ITextureObject.java @@ -0,0 +1,18 @@ +package net.minecraft.client.renderer.texture; + +import java.io.IOException; +import net.minecraft.client.resources.IResourceManager; +import shadersmod.client.MultiTexID; + +public interface ITextureObject +{ + void setBlurMipmap(boolean p_174936_1_, boolean p_174936_2_); + + void restoreLastBlurMipmap(); + + void loadTexture(IResourceManager resourceManager) throws IOException; + + int getGlTextureId(); + + MultiTexID getMultiTexID(); +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/ITickable.java b/src/minecraft/net/minecraft/client/renderer/texture/ITickable.java new file mode 100644 index 0000000..cd2ddc8 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/ITickable.java @@ -0,0 +1,6 @@ +package net.minecraft.client.renderer.texture; + +public interface ITickable +{ + void tick(); +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/ITickableTextureObject.java b/src/minecraft/net/minecraft/client/renderer/texture/ITickableTextureObject.java new file mode 100644 index 0000000..6332ecb --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/ITickableTextureObject.java @@ -0,0 +1,5 @@ +package net.minecraft.client.renderer.texture; + +public interface ITickableTextureObject extends ITextureObject, ITickable +{ +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java b/src/minecraft/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java new file mode 100644 index 0000000..93b7d33 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/LayeredColorMaskTexture.java @@ -0,0 +1,94 @@ +package net.minecraft.client.renderer.texture; + +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.awt.image.ImageObserver; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import net.minecraft.block.material.MapColor; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class LayeredColorMaskTexture extends AbstractTexture +{ + /** Access to the Logger, for all your logging needs. */ + private static final Logger LOG = LogManager.getLogger(); + + /** The location of the texture. */ + private final ResourceLocation textureLocation; + private final List field_174949_h; + private final List field_174950_i; + + public LayeredColorMaskTexture(ResourceLocation textureLocationIn, List p_i46101_2_, List p_i46101_3_) + { + this.textureLocation = textureLocationIn; + this.field_174949_h = p_i46101_2_; + this.field_174950_i = p_i46101_3_; + } + + public void loadTexture(IResourceManager resourceManager) throws IOException + { + this.deleteGlTexture(); + BufferedImage bufferedimage; + + try + { + BufferedImage bufferedimage1 = TextureUtil.readBufferedImage(resourceManager.getResource(this.textureLocation).getInputStream()); + int i = bufferedimage1.getType(); + + if (i == 0) + { + i = 6; + } + + bufferedimage = new BufferedImage(bufferedimage1.getWidth(), bufferedimage1.getHeight(), i); + Graphics graphics = bufferedimage.getGraphics(); + graphics.drawImage(bufferedimage1, 0, 0, (ImageObserver)null); + + for (int j = 0; j < 17 && j < this.field_174949_h.size() && j < this.field_174950_i.size(); ++j) + { + String s = (String)this.field_174949_h.get(j); + MapColor mapcolor = ((EnumDyeColor)this.field_174950_i.get(j)).getMapColor(); + + if (s != null) + { + InputStream inputstream = resourceManager.getResource(new ResourceLocation(s)).getInputStream(); + BufferedImage bufferedimage2 = TextureUtil.readBufferedImage(inputstream); + + if (bufferedimage2.getWidth() == bufferedimage.getWidth() && bufferedimage2.getHeight() == bufferedimage.getHeight() && bufferedimage2.getType() == 6) + { + for (int k = 0; k < bufferedimage2.getHeight(); ++k) + { + for (int l = 0; l < bufferedimage2.getWidth(); ++l) + { + int i1 = bufferedimage2.getRGB(l, k); + + if ((i1 & -16777216) != 0) + { + int j1 = (i1 & 16711680) << 8 & -16777216; + int k1 = bufferedimage1.getRGB(l, k); + int l1 = MathHelper.func_180188_d(k1, mapcolor.colorValue) & 16777215; + bufferedimage2.setRGB(l, k, j1 | l1); + } + } + } + + bufferedimage.getGraphics().drawImage(bufferedimage2, 0, 0, (ImageObserver)null); + } + } + } + } + catch (IOException ioexception) + { + LOG.error((String)"Couldn\'t load layered image", (Throwable)ioexception); + return; + } + + TextureUtil.uploadTextureImage(this.getGlTextureId(), bufferedimage); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/LayeredTexture.java b/src/minecraft/net/minecraft/client/renderer/texture/LayeredTexture.java new file mode 100644 index 0000000..da9916b --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/LayeredTexture.java @@ -0,0 +1,55 @@ +package net.minecraft.client.renderer.texture; + +import com.google.common.collect.Lists; +import java.awt.image.BufferedImage; +import java.awt.image.ImageObserver; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.util.ResourceLocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class LayeredTexture extends AbstractTexture +{ + private static final Logger logger = LogManager.getLogger(); + public final List layeredTextureNames; + + public LayeredTexture(String... textureNames) + { + this.layeredTextureNames = Lists.newArrayList(textureNames); + } + + public void loadTexture(IResourceManager resourceManager) throws IOException + { + this.deleteGlTexture(); + BufferedImage bufferedimage = null; + + try + { + for (String s : this.layeredTextureNames) + { + if (s != null) + { + InputStream inputstream = resourceManager.getResource(new ResourceLocation(s)).getInputStream(); + BufferedImage bufferedimage1 = TextureUtil.readBufferedImage(inputstream); + + if (bufferedimage == null) + { + bufferedimage = new BufferedImage(bufferedimage1.getWidth(), bufferedimage1.getHeight(), 2); + } + + bufferedimage.getGraphics().drawImage(bufferedimage1, 0, 0, (ImageObserver)null); + } + } + } + catch (IOException ioexception) + { + logger.error((String)"Couldn\'t load layered image", (Throwable)ioexception); + return; + } + + TextureUtil.uploadTextureImage(this.getGlTextureId(), bufferedimage); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/SimpleTexture.java b/src/minecraft/net/minecraft/client/renderer/texture/SimpleTexture.java new file mode 100644 index 0000000..bed1ffc --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/SimpleTexture.java @@ -0,0 +1,75 @@ +package net.minecraft.client.renderer.texture; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.data.TextureMetadataSection; +import net.minecraft.util.ResourceLocation; +import optifine.Config; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import shadersmod.client.ShadersTex; + +public class SimpleTexture extends AbstractTexture +{ + private static final Logger logger = LogManager.getLogger(); + protected final ResourceLocation textureLocation; + private static final String __OBFID = "CL_00001052"; + + public SimpleTexture(ResourceLocation textureResourceLocation) + { + this.textureLocation = textureResourceLocation; + } + + public void loadTexture(IResourceManager resourceManager) throws IOException + { + this.deleteGlTexture(); + InputStream inputstream = null; + + try + { + IResource iresource = resourceManager.getResource(this.textureLocation); + inputstream = iresource.getInputStream(); + BufferedImage bufferedimage = TextureUtil.readBufferedImage(inputstream); + boolean flag = false; + boolean flag1 = false; + + if (iresource.hasMetadata()) + { + try + { + TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture"); + + if (texturemetadatasection != null) + { + flag = texturemetadatasection.getTextureBlur(); + flag1 = texturemetadatasection.getTextureClamp(); + } + } + catch (RuntimeException runtimeexception) + { + logger.warn((String)("Failed reading metadata of: " + this.textureLocation), (Throwable)runtimeexception); + } + } + + if (Config.isShaders()) + { + ShadersTex.loadSimpleTexture(this.getGlTextureId(), bufferedimage, flag, flag1, resourceManager, this.textureLocation, this.getMultiTexID()); + } + else + { + TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, flag, flag1); + } + } + finally + { + if (inputstream != null) + { + inputstream.close(); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/Stitcher.java b/src/minecraft/net/minecraft/client/renderer/texture/Stitcher.java new file mode 100644 index 0000000..66d2e91 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/Stitcher.java @@ -0,0 +1,430 @@ +package net.minecraft.client.renderer.texture; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import net.minecraft.client.renderer.StitcherException; +import net.minecraft.util.MathHelper; + +public class Stitcher +{ + private final int mipmapLevelStitcher; + private final Set setStitchHolders = Sets.newHashSetWithExpectedSize(256); + private final List stitchSlots = Lists.newArrayListWithCapacity(256); + private int currentWidth; + private int currentHeight; + private final int maxWidth; + private final int maxHeight; + private final boolean forcePowerOf2; + + /** Max size (width or height) of a single tile */ + private final int maxTileDimension; + private static final String __OBFID = "CL_00001054"; + + public Stitcher(int maxTextureWidth, int maxTextureHeight, boolean p_i45095_3_, int p_i45095_4_, int mipmapLevel) + { + this.mipmapLevelStitcher = mipmapLevel; + this.maxWidth = maxTextureWidth; + this.maxHeight = maxTextureHeight; + this.forcePowerOf2 = p_i45095_3_; + this.maxTileDimension = p_i45095_4_; + } + + public int getCurrentWidth() + { + return this.currentWidth; + } + + public int getCurrentHeight() + { + return this.currentHeight; + } + + public void addSprite(TextureAtlasSprite p_110934_1_) + { + Stitcher.Holder stitcher$holder = new Stitcher.Holder(p_110934_1_, this.mipmapLevelStitcher); + + if (this.maxTileDimension > 0) + { + stitcher$holder.setNewDimension(this.maxTileDimension); + } + + this.setStitchHolders.add(stitcher$holder); + } + + public void doStitch() + { + Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])((Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()])); + Arrays.sort((Object[])astitcher$holder); + + for (Stitcher.Holder stitcher$holder : astitcher$holder) + { + if (!this.allocateSlot(stitcher$holder)) + { + String s = String.format("Unable to fit: %s, size: %dx%d, atlas: %dx%d, atlasMax: %dx%d - Maybe try a lower resolution resourcepack?", new Object[] {stitcher$holder.getAtlasSprite().getIconName(), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconWidth()), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconHeight()), Integer.valueOf(this.currentWidth), Integer.valueOf(this.currentHeight), Integer.valueOf(this.maxWidth), Integer.valueOf(this.maxHeight)}); + throw new StitcherException(stitcher$holder, s); + } + } + + if (this.forcePowerOf2) + { + this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth); + this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight); + } + } + + public List getStichSlots() + { + ArrayList arraylist = Lists.newArrayList(); + + for (Object stitcher$slot : this.stitchSlots) + { + ((Slot) stitcher$slot).getAllStitchSlots(arraylist); + } + + ArrayList arraylist1 = Lists.newArrayList(); + + for (Object stitcher$slot10 : arraylist) + { + Slot stitcher$slot1 = (Slot) stitcher$slot10; + Stitcher.Holder stitcher$holder = stitcher$slot1.getStitchHolder(); + TextureAtlasSprite textureatlassprite = stitcher$holder.getAtlasSprite(); + textureatlassprite.initSprite(this.currentWidth, this.currentHeight, stitcher$slot1.getOriginX(), stitcher$slot1.getOriginY(), stitcher$holder.isRotated()); + arraylist1.add(textureatlassprite); + } + + return arraylist1; + } + + private static int getMipmapDimension(int p_147969_0_, int p_147969_1_) + { + return (p_147969_0_ >> p_147969_1_) + ((p_147969_0_ & (1 << p_147969_1_) - 1) == 0 ? 0 : 1) << p_147969_1_; + } + + /** + * Attempts to find space for specified tile + */ + private boolean allocateSlot(Stitcher.Holder p_94310_1_) + { + for (int i = 0; i < this.stitchSlots.size(); ++i) + { + if (((Stitcher.Slot)this.stitchSlots.get(i)).addSlot(p_94310_1_)) + { + return true; + } + + p_94310_1_.rotate(); + + if (((Stitcher.Slot)this.stitchSlots.get(i)).addSlot(p_94310_1_)) + { + return true; + } + + p_94310_1_.rotate(); + } + + return this.expandAndAllocateSlot(p_94310_1_); + } + + /** + * Expand stitched texture in order to make space for specified tile + */ + private boolean expandAndAllocateSlot(Stitcher.Holder p_94311_1_) + { + int i = Math.min(p_94311_1_.getWidth(), p_94311_1_.getHeight()); + boolean flag = this.currentWidth == 0 && this.currentHeight == 0; + boolean flag1; + + if (this.forcePowerOf2) + { + int j = MathHelper.roundUpToPowerOfTwo(this.currentWidth); + int k = MathHelper.roundUpToPowerOfTwo(this.currentHeight); + int l = MathHelper.roundUpToPowerOfTwo(this.currentWidth + i); + int i1 = MathHelper.roundUpToPowerOfTwo(this.currentHeight + i); + boolean flag2 = l <= this.maxWidth; + boolean flag3 = i1 <= this.maxHeight; + + if (!flag2 && !flag3) + { + return false; + } + + boolean flag4 = j != l; + boolean flag5 = k != i1; + + if (flag4 ^ flag5) + { + flag1 = !flag4; + } + else + { + flag1 = flag2 && j <= k; + } + } + else + { + boolean flag6 = this.currentWidth + i <= this.maxWidth; + boolean flag7 = this.currentHeight + i <= this.maxHeight; + + if (!flag6 && !flag7) + { + return false; + } + + flag1 = flag6 && (flag || this.currentWidth <= this.currentHeight); + } + + int j1 = Math.max(p_94311_1_.getWidth(), p_94311_1_.getHeight()); + + if (MathHelper.roundUpToPowerOfTwo((!flag1 ? this.currentHeight : this.currentWidth) + j1) > (!flag1 ? this.maxHeight : this.maxWidth)) + { + return false; + } + else + { + Stitcher.Slot stitcher$slot; + + if (flag1) + { + if (p_94311_1_.getWidth() > p_94311_1_.getHeight()) + { + p_94311_1_.rotate(); + } + + if (this.currentHeight == 0) + { + this.currentHeight = p_94311_1_.getHeight(); + } + + stitcher$slot = new Stitcher.Slot(this.currentWidth, 0, p_94311_1_.getWidth(), this.currentHeight); + this.currentWidth += p_94311_1_.getWidth(); + } + else + { + stitcher$slot = new Stitcher.Slot(0, this.currentHeight, this.currentWidth, p_94311_1_.getHeight()); + this.currentHeight += p_94311_1_.getHeight(); + } + + stitcher$slot.addSlot(p_94311_1_); + this.stitchSlots.add(stitcher$slot); + return true; + } + } + + public static class Holder implements Comparable + { + private final TextureAtlasSprite theTexture; + private final int width; + private final int height; + private final int mipmapLevelHolder; + private boolean rotated; + private float scaleFactor = 1.0F; + private static final String __OBFID = "CL_00001055"; + + public Holder(TextureAtlasSprite p_i45094_1_, int p_i45094_2_) + { + this.theTexture = p_i45094_1_; + this.width = p_i45094_1_.getIconWidth(); + this.height = p_i45094_1_.getIconHeight(); + this.mipmapLevelHolder = p_i45094_2_; + this.rotated = Stitcher.getMipmapDimension(this.height, p_i45094_2_) > Stitcher.getMipmapDimension(this.width, p_i45094_2_); + } + + public TextureAtlasSprite getAtlasSprite() + { + return this.theTexture; + } + + public int getWidth() + { + return this.rotated ? Stitcher.getMipmapDimension((int)((float)this.height * this.scaleFactor), this.mipmapLevelHolder) : Stitcher.getMipmapDimension((int)((float)this.width * this.scaleFactor), this.mipmapLevelHolder); + } + + public int getHeight() + { + return this.rotated ? Stitcher.getMipmapDimension((int)((float)this.width * this.scaleFactor), this.mipmapLevelHolder) : Stitcher.getMipmapDimension((int)((float)this.height * this.scaleFactor), this.mipmapLevelHolder); + } + + public void rotate() + { + this.rotated = !this.rotated; + } + + public boolean isRotated() + { + return this.rotated; + } + + public void setNewDimension(int p_94196_1_) + { + if (this.width > p_94196_1_ && this.height > p_94196_1_) + { + this.scaleFactor = (float)p_94196_1_ / (float)Math.min(this.width, this.height); + } + } + + public String toString() + { + return "Holder{width=" + this.width + ", height=" + this.height + ", name=" + this.theTexture.getIconName() + '}'; + } + + public int compareTo(Stitcher.Holder p_compareTo_1_) + { + int i; + + if (this.getHeight() == p_compareTo_1_.getHeight()) + { + if (this.getWidth() == p_compareTo_1_.getWidth()) + { + if (this.theTexture.getIconName() == null) + { + return p_compareTo_1_.theTexture.getIconName() == null ? 0 : -1; + } + + return this.theTexture.getIconName().compareTo(p_compareTo_1_.theTexture.getIconName()); + } + + i = this.getWidth() < p_compareTo_1_.getWidth() ? 1 : -1; + } + else + { + i = this.getHeight() < p_compareTo_1_.getHeight() ? 1 : -1; + } + + return i; + } + + public int compareTo(Object p_compareTo_1_) + { + return this.compareTo((Stitcher.Holder)p_compareTo_1_); + } + } + + public static class Slot + { + private final int originX; + private final int originY; + private final int width; + private final int height; + private List subSlots; + private Stitcher.Holder holder; + private static final String __OBFID = "CL_00001056"; + + public Slot(int p_i1277_1_, int p_i1277_2_, int widthIn, int heightIn) + { + this.originX = p_i1277_1_; + this.originY = p_i1277_2_; + this.width = widthIn; + this.height = heightIn; + } + + public Stitcher.Holder getStitchHolder() + { + return this.holder; + } + + public int getOriginX() + { + return this.originX; + } + + public int getOriginY() + { + return this.originY; + } + + public boolean addSlot(Stitcher.Holder holderIn) + { + if (this.holder != null) + { + return false; + } + else + { + int i = holderIn.getWidth(); + int j = holderIn.getHeight(); + + if (i <= this.width && j <= this.height) + { + if (i == this.width && j == this.height) + { + this.holder = holderIn; + return true; + } + else + { + if (this.subSlots == null) + { + this.subSlots = Lists.newArrayListWithCapacity(1); + this.subSlots.add(new Stitcher.Slot(this.originX, this.originY, i, j)); + int k = this.width - i; + int l = this.height - j; + + if (l > 0 && k > 0) + { + int i1 = Math.max(this.height, k); + int j1 = Math.max(this.width, l); + + if (i1 >= j1) + { + this.subSlots.add(new Stitcher.Slot(this.originX, this.originY + j, i, l)); + this.subSlots.add(new Stitcher.Slot(this.originX + i, this.originY, k, this.height)); + } + else + { + this.subSlots.add(new Stitcher.Slot(this.originX + i, this.originY, k, j)); + this.subSlots.add(new Stitcher.Slot(this.originX, this.originY + j, this.width, l)); + } + } + else if (k == 0) + { + this.subSlots.add(new Stitcher.Slot(this.originX, this.originY + j, i, l)); + } + else if (l == 0) + { + this.subSlots.add(new Stitcher.Slot(this.originX + i, this.originY, k, j)); + } + } + + for (Object stitcher$slot : this.subSlots) + { + if (((Slot) stitcher$slot).addSlot(holderIn)) + { + return true; + } + } + + return false; + } + } + else + { + return false; + } + } + } + + public void getAllStitchSlots(List p_94184_1_) + { + if (this.holder != null) + { + p_94184_1_.add(this); + } + else if (this.subSlots != null) + { + for (Object stitcher$slot : this.subSlots) + { + ((Slot) stitcher$slot).getAllStitchSlots(p_94184_1_); + } + } + } + + public String toString() + { + return "Slot{originX=" + this.originX + ", originY=" + this.originY + ", width=" + this.width + ", height=" + this.height + ", texture=" + this.holder + ", subSlots=" + this.subSlots + '}'; + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java b/src/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java new file mode 100644 index 0000000..b3104ad --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java @@ -0,0 +1,797 @@ +package net.minecraft.client.renderer.texture; + +import com.google.common.collect.Lists; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.Callable; +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.data.AnimationFrame; +import net.minecraft.client.resources.data.AnimationMetadataSection; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import optifine.TextureUtils; +import shadersmod.client.Shaders; + +public class TextureAtlasSprite +{ + private final String iconName; + protected List framesTextureData = Lists.newArrayList(); + protected int[][] interpolatedFrameData; + private AnimationMetadataSection animationMetadata; + protected boolean rotated; + protected int originX; + protected int originY; + protected int width; + protected int height; + private float minU; + private float maxU; + private float minV; + private float maxV; + protected int frameCounter; + protected int tickCounter; + private static String locationNameClock = "builtin/clock"; + private static String locationNameCompass = "builtin/compass"; + private static final String __OBFID = "CL_00001062"; + private int indexInMap = -1; + public float baseU; + public float baseV; + public int sheetWidth; + public int sheetHeight; + public int glSpriteTextureId = -1; + public TextureAtlasSprite spriteSingle = null; + public boolean isSpriteSingle = false; + public int mipmapLevels = 0; + public TextureAtlasSprite spriteNormal = null; + public TextureAtlasSprite spriteSpecular = null; + public boolean isShadersSprite = false; + + private TextureAtlasSprite(TextureAtlasSprite p_i12_1_) + { + this.iconName = p_i12_1_.iconName; + this.isSpriteSingle = true; + } + + protected TextureAtlasSprite(String spriteName) + { + this.iconName = spriteName; + + if (Config.isMultiTexture()) + { + this.spriteSingle = new TextureAtlasSprite(this); + } + } + + protected static TextureAtlasSprite makeAtlasSprite(ResourceLocation spriteResourceLocation) + { + String s = spriteResourceLocation.toString(); + return (TextureAtlasSprite)(locationNameClock.equals(s) ? new TextureClock(s) : (locationNameCompass.equals(s) ? new TextureCompass(s) : new TextureAtlasSprite(s))); + } + + public static void setLocationNameClock(String clockName) + { + locationNameClock = clockName; + } + + public static void setLocationNameCompass(String compassName) + { + locationNameCompass = compassName; + } + + public void initSprite(int inX, int inY, int originInX, int originInY, boolean rotatedIn) + { + this.originX = originInX; + this.originY = originInY; + this.rotated = rotatedIn; + float f = (float)(0.009999999776482582D / (double)inX); + float f1 = (float)(0.009999999776482582D / (double)inY); + this.minU = (float)originInX / (float)((double)inX) + f; + this.maxU = (float)(originInX + this.width) / (float)((double)inX) - f; + this.minV = (float)originInY / (float)inY + f1; + this.maxV = (float)(originInY + this.height) / (float)inY - f1; + this.baseU = Math.min(this.minU, this.maxU); + this.baseV = Math.min(this.minV, this.maxV); + + if (this.spriteSingle != null) + { + this.spriteSingle.initSprite(this.width, this.height, 0, 0, false); + } + + if (this.spriteNormal != null) + { + this.spriteNormal.initSprite(inX, inY, originInX, originInY, rotatedIn); + } + + if (this.spriteSpecular != null) + { + this.spriteSpecular.initSprite(inX, inY, originInX, originInY, rotatedIn); + } + } + + public void copyFrom(TextureAtlasSprite atlasSpirit) + { + this.originX = atlasSpirit.originX; + this.originY = atlasSpirit.originY; + this.width = atlasSpirit.width; + this.height = atlasSpirit.height; + this.rotated = atlasSpirit.rotated; + this.minU = atlasSpirit.minU; + this.maxU = atlasSpirit.maxU; + this.minV = atlasSpirit.minV; + this.maxV = atlasSpirit.maxV; + + if (this.spriteSingle != null) + { + this.spriteSingle.initSprite(this.width, this.height, 0, 0, false); + } + } + + /** + * Returns the X position of this icon on its texture sheet, in pixels. + */ + public int getOriginX() + { + return this.originX; + } + + /** + * Returns the Y position of this icon on its texture sheet, in pixels. + */ + public int getOriginY() + { + return this.originY; + } + + /** + * Returns the width of the icon, in pixels. + */ + public int getIconWidth() + { + return this.width; + } + + /** + * Returns the height of the icon, in pixels. + */ + public int getIconHeight() + { + return this.height; + } + + /** + * Returns the minimum U coordinate to use when rendering with this icon. + */ + public float getMinU() + { + return this.minU; + } + + /** + * Returns the maximum U coordinate to use when rendering with this icon. + */ + public float getMaxU() + { + return this.maxU; + } + + /** + * Gets a U coordinate on the icon. 0 returns uMin and 16 returns uMax. Other arguments return in-between values. + */ + public float getInterpolatedU(double u) + { + float f = this.maxU - this.minU; + return this.minU + f * (float)u / 16.0F; + } + + /** + * Returns the minimum V coordinate to use when rendering with this icon. + */ + public float getMinV() + { + return this.minV; + } + + /** + * Returns the maximum V coordinate to use when rendering with this icon. + */ + public float getMaxV() + { + return this.maxV; + } + + /** + * Gets a V coordinate on the icon. 0 returns vMin and 16 returns vMax. Other arguments return in-between values. + */ + public float getInterpolatedV(double v) + { + float f = this.maxV - this.minV; + return this.minV + f * ((float)v / 16.0F); + } + + public String getIconName() + { + return this.iconName; + } + + public void updateAnimation() + { + if (this.animationMetadata != null) + { + ++this.tickCounter; + + if (this.tickCounter >= this.animationMetadata.getFrameTimeSingle(this.frameCounter)) + { + int i = this.animationMetadata.getFrameIndex(this.frameCounter); + int j = this.animationMetadata.getFrameCount() == 0 ? this.framesTextureData.size() : this.animationMetadata.getFrameCount(); + this.frameCounter = (this.frameCounter + 1) % j; + this.tickCounter = 0; + int k = this.animationMetadata.getFrameIndex(this.frameCounter); + boolean flag = false; + boolean flag1 = this.isSpriteSingle; + + if (i != k && k >= 0 && k < this.framesTextureData.size()) + { + TextureUtil.uploadTextureMipmap((int[][])((int[][])this.framesTextureData.get(k)), this.width, this.height, this.originX, this.originY, flag, flag1); + } + } + else if (this.animationMetadata.isInterpolate()) + { + this.updateAnimationInterpolated(); + } + } + } + + private void updateAnimationInterpolated() + { + double d0 = 1.0D - (double)this.tickCounter / (double)this.animationMetadata.getFrameTimeSingle(this.frameCounter); + int i = this.animationMetadata.getFrameIndex(this.frameCounter); + int j = this.animationMetadata.getFrameCount() == 0 ? this.framesTextureData.size() : this.animationMetadata.getFrameCount(); + int k = this.animationMetadata.getFrameIndex((this.frameCounter + 1) % j); + + if (i != k && k >= 0 && k < this.framesTextureData.size()) + { + int[][] aint = (int[][])((int[][])this.framesTextureData.get(i)); + int[][] aint1 = (int[][])((int[][])this.framesTextureData.get(k)); + + if (this.interpolatedFrameData == null || this.interpolatedFrameData.length != aint.length) + { + this.interpolatedFrameData = new int[aint.length][]; + } + + for (int l = 0; l < aint.length; ++l) + { + if (this.interpolatedFrameData[l] == null) + { + this.interpolatedFrameData[l] = new int[aint[l].length]; + } + + if (l < aint1.length && aint1[l].length == aint[l].length) + { + for (int i1 = 0; i1 < aint[l].length; ++i1) + { + int j1 = aint[l][i1]; + int k1 = aint1[l][i1]; + int l1 = (int)((double)((j1 & 16711680) >> 16) * d0 + (double)((k1 & 16711680) >> 16) * (1.0D - d0)); + int i2 = (int)((double)((j1 & 65280) >> 8) * d0 + (double)((k1 & 65280) >> 8) * (1.0D - d0)); + int j2 = (int)((double)(j1 & 255) * d0 + (double)(k1 & 255) * (1.0D - d0)); + this.interpolatedFrameData[l][i1] = j1 & -16777216 | l1 << 16 | i2 << 8 | j2; + } + } + } + + TextureUtil.uploadTextureMipmap(this.interpolatedFrameData, this.width, this.height, this.originX, this.originY, false, false); + } + } + + public int[][] getFrameTextureData(int index) + { + return (int[][])((int[][])this.framesTextureData.get(index)); + } + + public int getFrameCount() + { + return this.framesTextureData.size(); + } + + public void setIconWidth(int newWidth) + { + this.width = newWidth; + + if (this.spriteSingle != null) + { + this.spriteSingle.setIconWidth(this.width); + } + } + + public void setIconHeight(int newHeight) + { + this.height = newHeight; + + if (this.spriteSingle != null) + { + this.spriteSingle.setIconHeight(this.height); + } + } + + public void loadSprite(BufferedImage[] images, AnimationMetadataSection meta) throws IOException + { + this.resetSprite(); + int i = images[0].getWidth(); + int j = images[0].getHeight(); + this.width = i; + this.height = j; + int[][] aint = new int[images.length][]; + + for (int k = 0; k < images.length; ++k) + { + BufferedImage bufferedimage = images[k]; + + if (bufferedimage != null) + { + if (k > 0 && (bufferedimage.getWidth() != i >> k || bufferedimage.getHeight() != j >> k)) + { + throw new RuntimeException(String.format("Unable to load miplevel: %d, image is size: %dx%d, expected %dx%d", new Object[] {Integer.valueOf(k), Integer.valueOf(bufferedimage.getWidth()), Integer.valueOf(bufferedimage.getHeight()), Integer.valueOf(i >> k), Integer.valueOf(j >> k)})); + } + + aint[k] = new int[bufferedimage.getWidth() * bufferedimage.getHeight()]; + bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), aint[k], 0, bufferedimage.getWidth()); + } + } + + if (meta == null) + { + if (j != i) + { + throw new RuntimeException("broken aspect ratio and not an animation"); + } + + this.framesTextureData.add(aint); + } + else + { + int j1 = j / i; + int k1 = i; + int l = i; + this.height = this.width; + + if (meta.getFrameCount() > 0) + { + Iterator iterator = meta.getFrameIndexSet().iterator(); + + while (iterator.hasNext()) + { + int i1 = ((Integer)iterator.next()).intValue(); + + if (i1 >= j1) + { + throw new RuntimeException("invalid frameindex " + i1); + } + + this.allocateFrameTextureData(i1); + this.framesTextureData.set(i1, getFrameTextureData(aint, k1, l, i1)); + } + + this.animationMetadata = meta; + } + else + { + ArrayList arraylist = Lists.newArrayList(); + + for (int i2 = 0; i2 < j1; ++i2) + { + this.framesTextureData.add(getFrameTextureData(aint, k1, l, i2)); + arraylist.add(new AnimationFrame(i2, -1)); + } + + this.animationMetadata = new AnimationMetadataSection(arraylist, this.width, this.height, meta.getFrameTime(), meta.isInterpolate()); + } + } + + if (!this.isShadersSprite) + { + if (Config.isShaders()) + { + this.loadShadersSprites(); + } + + for (int l1 = 0; l1 < this.framesTextureData.size(); ++l1) + { + int[][] aint1 = (int[][])((int[][])this.framesTextureData.get(l1)); + + if (aint1 != null && !this.iconName.startsWith("minecraft:blocks/leaves_")) + { + for (int j2 = 0; j2 < aint1.length; ++j2) + { + int[] aint2 = aint1[j2]; + this.fixTransparentColor(aint2); + } + } + } + + if (this.spriteSingle != null) + { + this.spriteSingle.loadSprite(images, meta); + } + } + } + + public void generateMipmaps(int level) + { + ArrayList arraylist = Lists.newArrayList(); + + for (int i = 0; i < this.framesTextureData.size(); ++i) + { + final int[][] aint = (int[][])((int[][])this.framesTextureData.get(i)); + + if (aint != null) + { + try + { + arraylist.add(TextureUtil.generateMipmapData(level, this.width, aint)); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Generating mipmaps for frame"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Frame being iterated"); + crashreportcategory.addCrashSection("Frame index", Integer.valueOf(i)); + crashreportcategory.addCrashSectionCallable("Frame sizes", new Callable() + { + private static final String __OBFID = "CL_00001063"; + public String call() throws Exception + { + StringBuilder stringbuilder = new StringBuilder(); + + for (int[] aint1 : aint) + { + if (stringbuilder.length() > 0) + { + stringbuilder.append(", "); + } + + stringbuilder.append(aint1 == null ? "null" : Integer.valueOf(aint1.length)); + } + + return stringbuilder.toString(); + } + }); + throw new ReportedException(crashreport); + } + } + } + + this.setFramesTextureData(arraylist); + + if (this.spriteSingle != null) + { + this.spriteSingle.generateMipmaps(level); + } + } + + private void allocateFrameTextureData(int index) + { + if (this.framesTextureData.size() <= index) + { + for (int i = this.framesTextureData.size(); i <= index; ++i) + { + this.framesTextureData.add((Object)null); + } + } + + if (this.spriteSingle != null) + { + this.spriteSingle.allocateFrameTextureData(index); + } + } + + private static int[][] getFrameTextureData(int[][] data, int rows, int columns, int p_147962_3_) + { + int[][] aint = new int[data.length][]; + + for (int i = 0; i < data.length; ++i) + { + int[] aint1 = data[i]; + + if (aint1 != null) + { + aint[i] = new int[(rows >> i) * (columns >> i)]; + System.arraycopy(aint1, p_147962_3_ * aint[i].length, aint[i], 0, aint[i].length); + } + } + + return aint; + } + + public void clearFramesTextureData() + { + this.framesTextureData.clear(); + + if (this.spriteSingle != null) + { + this.spriteSingle.clearFramesTextureData(); + } + } + + public boolean hasAnimationMetadata() + { + return this.animationMetadata != null; + } + + public void setFramesTextureData(List newFramesTextureData) + { + this.framesTextureData = newFramesTextureData; + + if (this.spriteSingle != null) + { + this.spriteSingle.setFramesTextureData(newFramesTextureData); + } + } + + private void resetSprite() + { + this.animationMetadata = null; + this.setFramesTextureData(Lists.newArrayList()); + this.frameCounter = 0; + this.tickCounter = 0; + + if (this.spriteSingle != null) + { + this.spriteSingle.resetSprite(); + } + } + + public String toString() + { + return "TextureAtlasSprite{name=\'" + this.iconName + '\'' + ", frameCount=" + this.framesTextureData.size() + ", rotated=" + this.rotated + ", x=" + this.originX + ", y=" + this.originY + ", height=" + this.height + ", width=" + this.width + ", u0=" + this.minU + ", u1=" + this.maxU + ", v0=" + this.minV + ", v1=" + this.maxV + '}'; + } + + public boolean hasCustomLoader(IResourceManager p_hasCustomLoader_1_, ResourceLocation p_hasCustomLoader_2_) + { + return false; + } + + public boolean load(IResourceManager p_load_1_, ResourceLocation p_load_2_) + { + return true; + } + + public int getIndexInMap() + { + return this.indexInMap; + } + + public void setIndexInMap(int p_setIndexInMap_1_) + { + this.indexInMap = p_setIndexInMap_1_; + } + + private void fixTransparentColor(int[] p_fixTransparentColor_1_) + { + if (p_fixTransparentColor_1_ != null) + { + long i = 0L; + long j = 0L; + long k = 0L; + long l = 0L; + + for (int i1 = 0; i1 < p_fixTransparentColor_1_.length; ++i1) + { + int j1 = p_fixTransparentColor_1_[i1]; + int k1 = j1 >> 24 & 255; + + if (k1 >= 16) + { + int l1 = j1 >> 16 & 255; + int i2 = j1 >> 8 & 255; + int j2 = j1 & 255; + i += (long)l1; + j += (long)i2; + k += (long)j2; + ++l; + } + } + + if (l > 0L) + { + int l2 = (int)(i / l); + int i3 = (int)(j / l); + int j3 = (int)(k / l); + int k3 = l2 << 16 | i3 << 8 | j3; + + for (int l3 = 0; l3 < p_fixTransparentColor_1_.length; ++l3) + { + int i4 = p_fixTransparentColor_1_[l3]; + int k2 = i4 >> 24 & 255; + + if (k2 <= 16) + { + p_fixTransparentColor_1_[l3] = k3; + } + } + } + } + } + + public double getSpriteU16(float p_getSpriteU16_1_) + { + float f = this.maxU - this.minU; + return (double)((p_getSpriteU16_1_ - this.minU) / f * 16.0F); + } + + public double getSpriteV16(float p_getSpriteV16_1_) + { + float f = this.maxV - this.minV; + return (double)((p_getSpriteV16_1_ - this.minV) / f * 16.0F); + } + + public void bindSpriteTexture() + { + if (this.glSpriteTextureId < 0) + { + this.glSpriteTextureId = TextureUtil.glGenTextures(); + TextureUtil.allocateTextureImpl(this.glSpriteTextureId, this.mipmapLevels, this.width, this.height); + TextureUtils.applyAnisotropicLevel(); + } + + TextureUtils.bindTexture(this.glSpriteTextureId); + } + + public void deleteSpriteTexture() + { + if (this.glSpriteTextureId >= 0) + { + TextureUtil.deleteTexture(this.glSpriteTextureId); + this.glSpriteTextureId = -1; + } + } + + public float toSingleU(float p_toSingleU_1_) + { + p_toSingleU_1_ = p_toSingleU_1_ - this.baseU; + float f = (float)this.sheetWidth / (float)this.width; + p_toSingleU_1_ = p_toSingleU_1_ * f; + return p_toSingleU_1_; + } + + public float toSingleV(float p_toSingleV_1_) + { + p_toSingleV_1_ = p_toSingleV_1_ - this.baseV; + float f = (float)this.sheetHeight / (float)this.height; + p_toSingleV_1_ = p_toSingleV_1_ * f; + return p_toSingleV_1_; + } + + public List getFramesTextureData() + { + List list = new ArrayList(); + list.addAll(this.framesTextureData); + return list; + } + + public AnimationMetadataSection getAnimationMetadata() + { + return this.animationMetadata; + } + + public void setAnimationMetadata(AnimationMetadataSection p_setAnimationMetadata_1_) + { + this.animationMetadata = p_setAnimationMetadata_1_; + } + + private void loadShadersSprites() + { + this.mipmapLevels = Config.getTextureMap().getMipmapLevels(); + + if (Shaders.configNormalMap) + { + String s = this.iconName + "_n"; + ResourceLocation resourcelocation = new ResourceLocation(s); + resourcelocation = Config.getTextureMap().completeResourceLocation(resourcelocation, 0); + + if (Config.hasResource(resourcelocation)) + { + try + { + TextureAtlasSprite textureatlassprite = new TextureAtlasSprite(s); + textureatlassprite.isShadersSprite = true; + textureatlassprite.copyFrom(this); + textureatlassprite.loadShaderSpriteFrames(resourcelocation, this.mipmapLevels + 1); + textureatlassprite.generateMipmaps(this.mipmapLevels); + this.spriteNormal = textureatlassprite; + } + catch (IOException ioexception1) + { + Config.warn("Error loading normal texture: " + s); + Config.warn(ioexception1.getClass().getName() + ": " + ioexception1.getMessage()); + } + } + } + + if (Shaders.configSpecularMap) + { + String s1 = this.iconName + "_s"; + ResourceLocation resourcelocation1 = new ResourceLocation(s1); + resourcelocation1 = Config.getTextureMap().completeResourceLocation(resourcelocation1, 0); + + if (Config.hasResource(resourcelocation1)) + { + try + { + TextureAtlasSprite textureatlassprite1 = new TextureAtlasSprite(s1); + textureatlassprite1.isShadersSprite = true; + textureatlassprite1.copyFrom(this); + textureatlassprite1.loadShaderSpriteFrames(resourcelocation1, this.mipmapLevels + 1); + textureatlassprite1.generateMipmaps(this.mipmapLevels); + this.spriteSpecular = textureatlassprite1; + } + catch (IOException ioexception) + { + Config.warn("Error loading specular texture: " + s1); + Config.warn(ioexception.getClass().getName() + ": " + ioexception.getMessage()); + } + } + } + } + + public void loadShaderSpriteFrames(ResourceLocation p_loadShaderSpriteFrames_1_, int p_loadShaderSpriteFrames_2_) throws IOException + { + IResource iresource = Config.getResource(p_loadShaderSpriteFrames_1_); + BufferedImage bufferedimage = TextureUtil.readBufferedImage(iresource.getInputStream()); + + if (this.width != bufferedimage.getWidth()) + { + bufferedimage = TextureUtils.scaleImage(bufferedimage, this.width); + } + + AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)iresource.getMetadata("animation"); + int[][] aint = new int[p_loadShaderSpriteFrames_2_][]; + aint[0] = new int[bufferedimage.getWidth() * bufferedimage.getHeight()]; + bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), aint[0], 0, bufferedimage.getWidth()); + + if (animationmetadatasection == null) + { + this.framesTextureData.add(aint); + } + else + { + int i = bufferedimage.getHeight() / this.width; + + if (animationmetadatasection.getFrameCount() > 0) + { + Iterator iterator = animationmetadatasection.getFrameIndexSet().iterator(); + + while (iterator.hasNext()) + { + int j = ((Integer)iterator.next()).intValue(); + + if (j >= i) + { + throw new RuntimeException("invalid frameindex " + j); + } + + this.allocateFrameTextureData(j); + this.framesTextureData.set(j, getFrameTextureData(aint, this.width, this.width, j)); + } + + this.animationMetadata = animationmetadatasection; + } + else + { + List list = Lists.newArrayList(); + + for (int k = 0; k < i; ++k) + { + this.framesTextureData.add(getFrameTextureData(aint, this.width, this.width, k)); + list.add(new AnimationFrame(k, -1)); + } + + this.animationMetadata = new AnimationMetadataSection(list, this.width, this.height, animationmetadatasection.getFrameTime(), animationmetadatasection.isInterpolate()); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/TextureClock.java b/src/minecraft/net/minecraft/client/renderer/texture/TextureClock.java new file mode 100644 index 0000000..dfd3087 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/TextureClock.java @@ -0,0 +1,74 @@ +package net.minecraft.client.renderer.texture; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.MathHelper; +import optifine.Config; +import shadersmod.client.ShadersTex; + +public class TextureClock extends TextureAtlasSprite +{ + private double field_94239_h; + private double field_94240_i; + private static final String __OBFID = "CL_00001070"; + + public TextureClock(String iconName) + { + super(iconName); + } + + public void updateAnimation() + { + if (!this.framesTextureData.isEmpty()) + { + Minecraft minecraft = Minecraft.getMinecraft(); + double d0 = 0.0D; + + if (minecraft.theWorld != null && minecraft.thePlayer != null) + { + d0 = (double)minecraft.theWorld.getCelestialAngle(1.0F); + + if (!minecraft.theWorld.provider.isSurfaceWorld()) + { + d0 = Math.random(); + } + } + + double d1; + + for (d1 = d0 - this.field_94239_h; d1 < -0.5D; ++d1) + { + ; + } + + while (d1 >= 0.5D) + { + --d1; + } + + d1 = MathHelper.clamp_double(d1, -1.0D, 1.0D); + this.field_94240_i += d1 * 0.1D; + this.field_94240_i *= 0.8D; + this.field_94239_h += this.field_94240_i; + int i; + + for (i = (int)((this.field_94239_h + 1.0D) * (double)this.framesTextureData.size()) % this.framesTextureData.size(); i < 0; i = (i + this.framesTextureData.size()) % this.framesTextureData.size()) + { + ; + } + + if (i != this.frameCounter) + { + this.frameCounter = i; + + if (Config.isShaders()) + { + ShadersTex.uploadTexSub((int[][])((int[][])this.framesTextureData.get(this.frameCounter)), this.width, this.height, this.originX, this.originY, false, false); + } + else + { + TextureUtil.uploadTextureMipmap((int[][])((int[][])this.framesTextureData.get(this.frameCounter)), this.width, this.height, this.originX, this.originY, false, false); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/TextureCompass.java b/src/minecraft/net/minecraft/client/renderer/texture/TextureCompass.java new file mode 100644 index 0000000..4dbc147 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/TextureCompass.java @@ -0,0 +1,109 @@ +package net.minecraft.client.renderer.texture; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import optifine.Config; +import shadersmod.client.ShadersTex; + +public class TextureCompass extends TextureAtlasSprite +{ + /** Current compass heading in radians */ + public double currentAngle; + + /** Speed and direction of compass rotation */ + public double angleDelta; + public static String field_176608_l; + private static final String __OBFID = "CL_00001071"; + + public TextureCompass(String iconName) + { + super(iconName); + field_176608_l = iconName; + } + + public void updateAnimation() + { + Minecraft minecraft = Minecraft.getMinecraft(); + + if (minecraft.theWorld != null && minecraft.thePlayer != null) + { + this.updateCompass(minecraft.theWorld, minecraft.thePlayer.posX, minecraft.thePlayer.posZ, (double)minecraft.thePlayer.rotationYaw, false, false); + } + else + { + this.updateCompass((World)null, 0.0D, 0.0D, 0.0D, true, false); + } + } + + /** + * Updates the compass based on the given x,z coords and camera direction + */ + public void updateCompass(World worldIn, double p_94241_2_, double p_94241_4_, double p_94241_6_, boolean p_94241_8_, boolean p_94241_9_) + { + if (!this.framesTextureData.isEmpty()) + { + double d0 = 0.0D; + + if (worldIn != null && !p_94241_8_) + { + BlockPos blockpos = worldIn.getSpawnPoint(); + double d1 = (double)blockpos.getX() - p_94241_2_; + double d2 = (double)blockpos.getZ() - p_94241_4_; + p_94241_6_ = p_94241_6_ % 360.0D; + d0 = -((p_94241_6_ - 90.0D) * Math.PI / 180.0D - Math.atan2(d2, d1)); + + if (!worldIn.provider.isSurfaceWorld()) + { + d0 = Math.random() * Math.PI * 2.0D; + } + } + + if (p_94241_9_) + { + this.currentAngle = d0; + } + else + { + double d3; + + for (d3 = d0 - this.currentAngle; d3 < -Math.PI; d3 += (Math.PI * 2D)) + { + ; + } + + while (d3 >= Math.PI) + { + d3 -= (Math.PI * 2D); + } + + d3 = MathHelper.clamp_double(d3, -1.0D, 1.0D); + this.angleDelta += d3 * 0.1D; + this.angleDelta *= 0.8D; + this.currentAngle += this.angleDelta; + } + + int i; + + for (i = (int)((this.currentAngle / (Math.PI * 2D) + 1.0D) * (double)this.framesTextureData.size()) % this.framesTextureData.size(); i < 0; i = (i + this.framesTextureData.size()) % this.framesTextureData.size()) + { + ; + } + + if (i != this.frameCounter) + { + this.frameCounter = i; + + if (Config.isShaders()) + { + ShadersTex.uploadTexSub((int[][])((int[][])this.framesTextureData.get(this.frameCounter)), this.width, this.height, this.originX, this.originY, false, false); + } + else + { + TextureUtil.uploadTextureMipmap((int[][])((int[][])this.framesTextureData.get(this.frameCounter)), this.width, this.height, this.originX, this.originY, false, false); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/TextureManage# b/src/minecraft/net/minecraft/client/renderer/texture/TextureManage# new file mode 100644 index 0000000..1d15d6e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/TextureManage# @@ -0,0 +1,28 @@ +*************** +*** 79,90 **** + this.field_110585_a.put(p_110579_1_, (ITextureObject)p_110579_2_); + flag = false; + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.func_85055_a(throwable, "Registering texture"); + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Resource location being registered"); + crashreportcategory.func_71507_a("Resource location", p_110579_1_); + crashreportcategory.func_71500_a("Texture object class", new Callable() { + public String call() throws Exception { +- return p_110579_2_.getClass().getName(); + } + }); + throw new ReportedException(crashreport); +--- 79,91 ---- + this.field_110585_a.put(p_110579_1_, (ITextureObject)p_110579_2_); + flag = false; + } catch (Throwable throwable) { ++ final ITextureObject p_110579_2_f = p_110579_2_; + CrashReport crashreport = CrashReport.func_85055_a(throwable, "Registering texture"); + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Resource location being registered"); + crashreportcategory.func_71507_a("Resource location", p_110579_1_); + crashreportcategory.func_71500_a("Texture object class", new Callable() { + public String call() throws Exception { ++ return p_110579_2_f.getClass().getName(); + } + }); + throw new ReportedException(crashreport); diff --git a/src/minecraft/net/minecraft/client/renderer/texture/TextureManager.java b/src/minecraft/net/minecraft/client/renderer/texture/TextureManager.java new file mode 100644 index 0000000..3115cd2 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/TextureManager.java @@ -0,0 +1,205 @@ +package net.minecraft.client.renderer.texture; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.io.IOException; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.Callable; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import optifine.RandomMobs; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import shadersmod.client.ShadersTex; + +public class TextureManager implements ITickable, IResourceManagerReloadListener +{ + private static final Logger logger = LogManager.getLogger(); + private final Map mapTextureObjects = Maps.newHashMap(); + private final List listTickables = Lists.newArrayList(); + private final Map mapTextureCounters = Maps.newHashMap(); + private IResourceManager theResourceManager; + private static final String __OBFID = "CL_00001064"; + + public TextureManager(IResourceManager resourceManager) + { + this.theResourceManager = resourceManager; + } + + public void bindTexture(ResourceLocation resource) + { + if (Config.isRandomMobs()) + { + resource = RandomMobs.getTextureLocation(resource); + } + + Object object = (ITextureObject)this.mapTextureObjects.get(resource); + + if (object == null) + { + object = new SimpleTexture(resource); + this.loadTexture(resource, (ITextureObject)object); + } + + if (Config.isShaders()) + { + ShadersTex.bindTexture((ITextureObject)object); + } + else + { + TextureUtil.bindTexture(((ITextureObject)object).getGlTextureId()); + } + } + + + public boolean loadTickableTexture(ResourceLocation textureLocation, ITickableTextureObject textureObj) + { + if (this.loadTexture(textureLocation, textureObj)) + { + this.listTickables.add(textureObj); + return true; + } + else + { + return false; + } + } + + public boolean loadTexture(ResourceLocation textureLocation, final ITextureObject textureObj) + { + boolean flag = true; + ITextureObject itextureobject = textureObj; + + try + { + textureObj.loadTexture(this.theResourceManager); + } + catch (IOException ioexception) + { + logger.warn((String)("Failed to load texture: " + textureLocation), (Throwable)ioexception); + itextureobject = TextureUtil.missingTexture; + this.mapTextureObjects.put(textureLocation, itextureobject); + flag = false; + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Registering texture"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Resource location being registered"); + crashreportcategory.addCrashSection("Resource location", textureLocation); + crashreportcategory.addCrashSectionCallable("Texture object class", new Callable() + { + private static final String __OBFID = "CL_00001065"; + public String call() throws Exception + { + return textureObj.getClass().getName(); + } + }); + throw new ReportedException(crashreport); + } + + this.mapTextureObjects.put(textureLocation, itextureobject); + return flag; + } + + public ITextureObject getTexture(ResourceLocation textureLocation) + { + return (ITextureObject)this.mapTextureObjects.get(textureLocation); + } + + public ResourceLocation getDynamicTextureLocation(String name, DynamicTexture texture) + { + if (name.equals("logo")) + { + texture = Config.getMojangLogoTexture(texture); + } + + Integer integer = (Integer)this.mapTextureCounters.get(name); + + if (integer == null) + { + integer = Integer.valueOf(1); + } + else + { + integer = Integer.valueOf(integer.intValue() + 1); + } + + this.mapTextureCounters.put(name, integer); + ResourceLocation resourcelocation = new ResourceLocation(String.format("dynamic/%s_%d", new Object[] {name, integer})); + this.loadTexture(resourcelocation, texture); + return resourcelocation; + } + + public void tick() + { + for (Object itickable : this.listTickables) + { + ((ITickable) itickable).tick(); + } + } + + public void deleteTexture(ResourceLocation textureLocation) + { + ITextureObject itextureobject = this.getTexture(textureLocation); + + if (itextureobject != null) + { + this.mapTextureObjects.remove(textureLocation); + TextureUtil.deleteTexture(itextureobject.getGlTextureId()); + } + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + Config.dbg("*** Reloading textures ***"); + Config.log("Resource packs: " + Config.getResourcePackNames()); + Iterator iterator = this.mapTextureObjects.keySet().iterator(); + + while (iterator.hasNext()) + { + ResourceLocation resourcelocation = (ResourceLocation)iterator.next(); + String s = resourcelocation.getResourcePath(); + + if (s.startsWith("mcpatcher/") || s.startsWith("optifine/")) + { + ITextureObject itextureobject = (ITextureObject)this.mapTextureObjects.get(resourcelocation); + + if (itextureobject instanceof AbstractTexture) + { + AbstractTexture abstracttexture = (AbstractTexture)itextureobject; + abstracttexture.deleteGlTexture(); + } + + iterator.remove(); + } + } + + for (Object entry : this.mapTextureObjects.entrySet()) + { + this.loadTexture((ResourceLocation)((Entry) entry).getKey(), (ITextureObject)((Entry) entry).getValue()); + } + } + + public void reloadBannerTextures() + { + for (Object entry : this.mapTextureObjects.entrySet()) + { + ResourceLocation resourcelocation = (ResourceLocation)((Entry) entry).getKey(); + ITextureObject itextureobject = (ITextureObject)((Entry) entry).getValue(); + + if (itextureobject instanceof LayeredColorMaskTexture) + { + this.loadTexture(resourcelocation, itextureobject); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/TextureManage~ b/src/minecraft/net/minecraft/client/renderer/texture/TextureManage~ new file mode 100644 index 0000000..9438752 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/TextureManage~ @@ -0,0 +1,173 @@ +package net.minecraft.client.renderer.texture; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.io.IOException; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.Callable; +import net.minecraft.client.renderer.texture.AbstractTexture; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.ITickable; +import net.minecraft.client.renderer.texture.ITickableTextureObject; +import net.minecraft.client.renderer.texture.LayeredColorMaskTexture; +import net.minecraft.client.renderer.texture.SimpleTexture; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.src.Config; +import net.minecraft.src.RandomMobs; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import shadersmod.client.ShadersTex; + +public class TextureManager implements ITickable, IResourceManagerReloadListener { + private static final Logger field_147646_a = LogManager.getLogger(); + private final Map field_110585_a = Maps.newHashMap(); + private final List field_110583_b = Lists.newArrayList(); + private final Map field_110584_c = Maps.newHashMap(); + private IResourceManager field_110582_d; + private static final String __OBFID = "CL_00001064"; + + public TextureManager(IResourceManager p_i1284_1_) { + this.field_110582_d = p_i1284_1_; + } + + public void func_110577_a(ResourceLocation p_110577_1_) { + if(Config.isRandomMobs()) { + p_110577_1_ = RandomMobs.getTextureLocation(p_110577_1_); + } + + Object object = (ITextureObject)this.field_110585_a.get(p_110577_1_); + if(object == null) { + object = new SimpleTexture(p_110577_1_); + this.func_110579_a(p_110577_1_, (ITextureObject)object); + } + + if(Config.isShaders()) { + ShadersTex.bindTexture((ITextureObject)object); + } else { + TextureUtil.func_94277_a(((ITextureObject)object).func_110552_b()); + } + + } + + public boolean func_110580_a(ResourceLocation p_110580_1_, ITickableTextureObject p_110580_2_) { + if(this.func_110579_a(p_110580_1_, p_110580_2_)) { + this.field_110583_b.add(p_110580_2_); + return true; + } else { + return false; + } + } + + public boolean func_110579_a(ResourceLocation p_110579_1_, final ITextureObject p_110579_2_) { + boolean flag = true; + ITextureObject itextureobject = p_110579_2_; + + try { + p_110579_2_.func_110551_a(this.field_110582_d); + } catch (IOException ioexception) { + field_147646_a.warn((String)("Failed to load texture: " + p_110579_1_), (Throwable)ioexception); + itextureobject = TextureUtil.field_111001_a; + this.field_110585_a.put(p_110579_1_, itextureobject); + flag = false; + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.func_85055_a(throwable, "Registering texture"); + CrashReportCategory crashreportcategory = crashreport.func_85058_a("Resource location being registered"); + crashreportcategory.func_71507_a("Resource location", p_110579_1_); + crashreportcategory.func_71500_a("Texture object class", new Callable() { + private static final String __OBFID = "CL_00001065"; + + public String call() throws Exception { + return p_110579_2_.getClass().getName(); + } + }); + throw new ReportedException(crashreport); + } + + this.field_110585_a.put(p_110579_1_, itextureobject); + return flag; + } + + public ITextureObject func_110581_b(ResourceLocation p_110581_1_) { + return (ITextureObject)this.field_110585_a.get(p_110581_1_); + } + + public ResourceLocation func_110578_a(String p_110578_1_, DynamicTexture p_110578_2_) { + if(p_110578_1_.equals("logo")) { + p_110578_2_ = Config.getMojangLogoTexture(p_110578_2_); + } + + Integer integer = (Integer)this.field_110584_c.get(p_110578_1_); + if(integer == null) { + integer = Integer.valueOf(1); + } else { + integer = Integer.valueOf(integer.intValue() + 1); + } + + this.field_110584_c.put(p_110578_1_, integer); + ResourceLocation resourcelocation = new ResourceLocation(String.format("dynamic/%s_%d", new Object[]{p_110578_1_, integer})); + this.func_110579_a(resourcelocation, p_110578_2_); + return resourcelocation; + } + + public void func_110550_d() { + for(ITickable itickable : this.field_110583_b) { + itickable.func_110550_d(); + } + + } + + public void func_147645_c(ResourceLocation p_147645_1_) { + ITextureObject itextureobject = this.func_110581_b(p_147645_1_); + if(itextureobject != null) { + this.field_110585_a.remove(p_147645_1_); + TextureUtil.func_147942_a(itextureobject.func_110552_b()); + } + + } + + public void func_110549_a(IResourceManager p_110549_1_) { + Config.dbg("*** Reloading textures ***"); + Config.log("Resource packs: " + Config.getResourcePackNames()); + Iterator iterator = this.field_110585_a.keySet().iterator(); + + while(iterator.hasNext()) { + ResourceLocation resourcelocation = (ResourceLocation)iterator.next(); + String s = resourcelocation.func_110623_a(); + if(s.startsWith("mcpatcher/") || s.startsWith("optifine/")) { + ITextureObject itextureobject = (ITextureObject)this.field_110585_a.get(resourcelocation); + if(itextureobject instanceof AbstractTexture) { + AbstractTexture abstracttexture = (AbstractTexture)itextureobject; + abstracttexture.func_147631_c(); + } + + iterator.remove(); + } + } + + for(Entry entry : this.field_110585_a.entrySet()) { + this.func_110579_a((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue()); + } + + } + + public void reloadBannerTextures() { + for(Entry entry : this.field_110585_a.entrySet()) { + ResourceLocation resourcelocation = (ResourceLocation)entry.getKey(); + ITextureObject itextureobject = (ITextureObject)entry.getValue(); + if(itextureobject instanceof LayeredColorMaskTexture) { + this.func_110579_a(resourcelocation, itextureobject); + } + } + + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/TextureMap.java b/src/minecraft/net/minecraft/client/renderer/texture/TextureMap.java new file mode 100644 index 0000000..a1c1d9b --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/TextureMap.java @@ -0,0 +1,841 @@ +package net.minecraft.client.renderer.texture; + +import java.awt.Dimension; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeSet; +import java.util.concurrent.Callable; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.StitcherException; +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.data.AnimationMetadataSection; +import net.minecraft.client.resources.data.TextureMetadataSection; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import optifine.ConnectedTextures; +import optifine.Reflector; +import optifine.TextureUtils; +import shadersmod.client.ShadersTex; + +public class TextureMap extends AbstractTexture implements ITickableTextureObject +{ + private static final boolean ENABLE_SKIP = Boolean.parseBoolean(System.getProperty("fml.skipFirstTextureLoad", "true")); + private static final Logger logger = LogManager.getLogger(); + public static final ResourceLocation LOCATION_MISSING_TEXTURE = new ResourceLocation("missingno"); + public static final ResourceLocation locationBlocksTexture = new ResourceLocation("textures/atlas/blocks.png"); + private final List listAnimatedSprites; + private final Map mapRegisteredSprites; + private final Map mapUploadedSprites; + private final String basePath; + private final IIconCreator iconCreator; + private int mipmapLevels; + private final TextureAtlasSprite missingImage; + private static final String __OBFID = "CL_00001058"; + private boolean skipFirst; + private TextureAtlasSprite[] iconGrid; + private int iconGridSize; + private int iconGridCountX; + private int iconGridCountY; + private double iconGridSizeU; + private double iconGridSizeV; + private int counterIndexInMap; + public int atlasWidth; + public int atlasHeight; + + public TextureMap(String p_i46099_1_) + { + this(p_i46099_1_, (IIconCreator)null); + } + + public TextureMap(String p_i10_1_, boolean p_i10_2_) + { + this(p_i10_1_, (IIconCreator)null, p_i10_2_); + } + + public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn) + { + this(p_i46100_1_, iconCreatorIn, false); + } + + public TextureMap(String p_i11_1_, IIconCreator p_i11_2_, boolean p_i11_3_) + { + this.skipFirst = false; + this.iconGrid = null; + this.iconGridSize = -1; + this.iconGridCountX = -1; + this.iconGridCountY = -1; + this.iconGridSizeU = -1.0D; + this.iconGridSizeV = -1.0D; + this.counterIndexInMap = 0; + this.atlasWidth = 0; + this.atlasHeight = 0; + this.listAnimatedSprites = Lists.newArrayList(); + this.mapRegisteredSprites = Maps.newHashMap(); + this.mapUploadedSprites = Maps.newHashMap(); + this.missingImage = new TextureAtlasSprite("missingno"); + this.basePath = p_i11_1_; + this.iconCreator = p_i11_2_; + this.skipFirst = p_i11_3_ && ENABLE_SKIP; + } + + private void initMissingImage() + { + int i = this.getMinSpriteSize(); + int[] aint = this.getMissingImageData(i); + this.missingImage.setIconWidth(i); + this.missingImage.setIconHeight(i); + int[][] aint1 = new int[this.mipmapLevels + 1][]; + aint1[0] = aint; + this.missingImage.setFramesTextureData(Lists.newArrayList(new int[][][] {aint1})); + this.missingImage.setIndexInMap(this.counterIndexInMap++); + } + + public void loadTexture(IResourceManager resourceManager) throws IOException + { + ShadersTex.resManager = resourceManager; + + if (this.iconCreator != null) + { + this.loadSprites(resourceManager, this.iconCreator); + } + } + + public void loadSprites(IResourceManager resourceManager, IIconCreator p_174943_2_) + { + this.mapRegisteredSprites.clear(); + this.counterIndexInMap = 0; + p_174943_2_.registerSprites(this); + + if (this.mipmapLevels >= 4) + { + this.mipmapLevels = this.detectMaxMipmapLevel(this.mapRegisteredSprites, resourceManager); + Config.log("Mipmap levels: " + this.mipmapLevels); + } + + this.initMissingImage(); + this.deleteGlTexture(); + this.loadTextureAtlas(resourceManager); + } + + public void loadTextureAtlas(IResourceManager resourceManager) + { + Config.dbg("Multitexture: " + Config.isMultiTexture()); + + if (Config.isMultiTexture()) + { + for (Object textureatlassprite : this.mapUploadedSprites.values()) + { + ((TextureAtlasSprite) textureatlassprite).deleteSpriteTexture(); + } + } + + ConnectedTextures.updateIcons(this); + int l1 = Minecraft.getGLMaximumTextureSize(); + Stitcher stitcher = new Stitcher(l1, l1, true, 0, this.mipmapLevels); + this.mapUploadedSprites.clear(); + this.listAnimatedSprites.clear(); + int i = Integer.MAX_VALUE; + Reflector.callVoid(Reflector.ForgeHooksClient_onTextureStitchedPre, new Object[] {this}); + int j = this.getMinSpriteSize(); + int k = 1 << this.mipmapLevels; + + for (Object entry : this.mapRegisteredSprites.entrySet()) + { + TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)((Entry) entry).getValue(); + ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite1.getIconName()); + ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); + + if (!textureatlassprite1.hasCustomLoader(resourceManager, resourcelocation)) + { + try + { + IResource iresource = resourceManager.getResource(resourcelocation1); + BufferedImage[] abufferedimage = new BufferedImage[1 + this.mipmapLevels]; + abufferedimage[0] = TextureUtil.readBufferedImage(iresource.getInputStream()); + + if (this.mipmapLevels > 0 && abufferedimage != null) + { + int l = abufferedimage[0].getWidth(); + abufferedimage[0] = TextureUtils.scaleToPowerOfTwo(abufferedimage[0], j); + int i1 = abufferedimage[0].getWidth(); + + if (!TextureUtils.isPowerOfTwo(l)) + { + Config.log("Scaled non power of 2: " + textureatlassprite1.getIconName() + ", " + l + " -> " + i1); + } + } + + TextureMetadataSection texturemetadatasection = (TextureMetadataSection)iresource.getMetadata("texture"); + + if (texturemetadatasection != null) + { + List list = texturemetadatasection.getListMipmaps(); + + if (!list.isEmpty()) + { + int k1 = abufferedimage[0].getWidth(); + int j1 = abufferedimage[0].getHeight(); + + if (MathHelper.roundUpToPowerOfTwo(k1) != k1 || MathHelper.roundUpToPowerOfTwo(j1) != j1) + { + throw new RuntimeException("Unable to load extra miplevels, source-texture is not power of two"); + } + } + + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) + { + int j3 = ((Integer)iterator.next()).intValue(); + + if (j3 > 0 && j3 < abufferedimage.length - 1 && abufferedimage[j3] == null) + { + ResourceLocation resourcelocation2 = this.completeResourceLocation(resourcelocation, j3); + + try + { + abufferedimage[j3] = TextureUtil.readBufferedImage(resourceManager.getResource(resourcelocation2).getInputStream()); + } + catch (IOException ioexception) + { + logger.error("Unable to load miplevel {} from: {}", new Object[] {Integer.valueOf(j3), resourcelocation2, ioexception}); + } + } + } + } + + AnimationMetadataSection animationmetadatasection = (AnimationMetadataSection)iresource.getMetadata("animation"); + textureatlassprite1.loadSprite(abufferedimage, animationmetadatasection); + } + catch (RuntimeException runtimeexception) + { + logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception); + continue; + } + catch (IOException ioexception1) + { + logger.error("Using missing texture, unable to load " + resourcelocation1 + ", " + ioexception1.getClass().getName()); + continue; + } + + i = Math.min(i, Math.min(textureatlassprite1.getIconWidth(), textureatlassprite1.getIconHeight())); + int k2 = Math.min(Integer.lowestOneBit(textureatlassprite1.getIconWidth()), Integer.lowestOneBit(textureatlassprite1.getIconHeight())); + + if (k2 < k) + { + logger.warn("Texture {} with size {}x{} limits mip level from {} to {}", new Object[] {resourcelocation1, Integer.valueOf(textureatlassprite1.getIconWidth()), Integer.valueOf(textureatlassprite1.getIconHeight()), Integer.valueOf(MathHelper.calculateLogBaseTwo(k)), Integer.valueOf(MathHelper.calculateLogBaseTwo(k2))}); + k = k2; + } + + stitcher.addSprite(textureatlassprite1); + } + else if (!textureatlassprite1.load(resourceManager, resourcelocation)) + { + i = Math.min(i, Math.min(textureatlassprite1.getIconWidth(), textureatlassprite1.getIconHeight())); + stitcher.addSprite(textureatlassprite1); + } + } + + int i2 = Math.min(i, k); + int j2 = MathHelper.calculateLogBaseTwo(i2); + + if (j2 < 0) + { + j2 = 0; + } + + if (j2 < this.mipmapLevels) + { + logger.info("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", new Object[] {this.basePath, Integer.valueOf(this.mipmapLevels), Integer.valueOf(j2), Integer.valueOf(i2)}); + this.mipmapLevels = j2; + } + + for (final Object textureatlassprite20 : this.mapRegisteredSprites.values()) + { + final TextureAtlasSprite textureatlassprite2 = (TextureAtlasSprite) textureatlassprite20; + + try + { + textureatlassprite2.generateMipmaps(this.mipmapLevels); + } + catch (Throwable throwable1) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Applying mipmap"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Sprite being mipmapped"); + crashreportcategory.addCrashSectionCallable("Sprite name", new Callable() + { + private static final String __OBFID = "CL_00001059"; + public String call() throws Exception + { + return textureatlassprite2.getIconName(); + } + }); + crashreportcategory.addCrashSectionCallable("Sprite size", new Callable() + { + private static final String __OBFID = "CL_00001060"; + public String call() throws Exception + { + return textureatlassprite2.getIconWidth() + " x " + textureatlassprite2.getIconHeight(); + } + }); + crashreportcategory.addCrashSectionCallable("Sprite frames", new Callable() + { + private static final String __OBFID = "CL_00001061"; + public String call() throws Exception + { + return textureatlassprite2.getFrameCount() + " frames"; + } + }); + crashreportcategory.addCrashSection("Mipmap levels", Integer.valueOf(this.mipmapLevels)); + throw new ReportedException(crashreport); + } + } + + this.missingImage.generateMipmaps(this.mipmapLevels); + stitcher.addSprite(this.missingImage); + + try + { + stitcher.doStitch(); + } + catch (StitcherException stitcherexception) + { + throw stitcherexception; + } + + logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath}); + TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); + HashMap hashmap = Maps.newHashMap(this.mapRegisteredSprites); + + for (Object textureatlassprite30 : stitcher.getStichSlots()) + { + TextureAtlasSprite textureatlassprite3 = (TextureAtlasSprite) textureatlassprite30; + String s = textureatlassprite3.getIconName(); + hashmap.remove(s); + this.mapUploadedSprites.put(s, textureatlassprite3); + + try + { + TextureUtil.uploadTextureMipmap(textureatlassprite3.getFrameTextureData(0), textureatlassprite3.getIconWidth(), textureatlassprite3.getIconHeight(), textureatlassprite3.getOriginX(), textureatlassprite3.getOriginY(), false, false); + } + catch (Throwable throwable) + { + CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Stitching texture atlas"); + CrashReportCategory crashreportcategory1 = crashreport1.makeCategory("Texture being stitched together"); + crashreportcategory1.addCrashSection("Atlas path", this.basePath); + crashreportcategory1.addCrashSection("Sprite", textureatlassprite3); + throw new ReportedException(crashreport1); + } + + if (textureatlassprite3.hasAnimationMetadata()) + { + this.listAnimatedSprites.add(textureatlassprite3); + } + } + + for (Object textureatlassprite4 : hashmap.values()) + { + ((TextureAtlasSprite) textureatlassprite4).copyFrom(this.missingImage); + } + + if (Config.isMultiTexture()) + { + int l2 = stitcher.getCurrentWidth(); + int i3 = stitcher.getCurrentHeight(); + + for (Object textureatlassprite50 : stitcher.getStichSlots()) + { + TextureAtlasSprite textureatlassprite5 = (TextureAtlasSprite) textureatlassprite50; + textureatlassprite5.sheetWidth = l2; + textureatlassprite5.sheetHeight = i3; + textureatlassprite5.mipmapLevels = this.mipmapLevels; + TextureAtlasSprite textureatlassprite6 = textureatlassprite5.spriteSingle; + + if (textureatlassprite6 != null) + { + textureatlassprite6.sheetWidth = l2; + textureatlassprite6.sheetHeight = i3; + textureatlassprite6.mipmapLevels = this.mipmapLevels; + textureatlassprite5.bindSpriteTexture(); + boolean flag = false; + boolean flag1 = true; + TextureUtil.uploadTextureMipmap(textureatlassprite6.getFrameTextureData(0), textureatlassprite6.getIconWidth(), textureatlassprite6.getIconHeight(), textureatlassprite6.getOriginX(), textureatlassprite6.getOriginY(), flag, flag1); + } + } + + Config.getMinecraft().getTextureManager().bindTexture(locationBlocksTexture); + } + + Reflector.callVoid(Reflector.ForgeHooksClient_onTextureStitchedPost, new Object[] {this}); + + if (Config.equals(System.getProperty("saveTextureMap"), "true")) + { + TextureUtil.saveGlTexture(this.basePath.replaceAll("/", "_"), this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight()); + } + } + + public ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_) + { + return this.isAbsoluteLocation(location) ? (p_147634_2_ == 0 ? new ResourceLocation(location.getResourceDomain(), location.getResourcePath() + ".png") : new ResourceLocation(location.getResourceDomain(), location.getResourcePath() + "mipmap" + p_147634_2_ + ".png")) : (p_147634_2_ == 0 ? new ResourceLocation(location.getResourceDomain(), String.format("%s/%s%s", new Object[] {this.basePath, location.getResourcePath(), ".png"})): new ResourceLocation(location.getResourceDomain(), String.format("%s/mipmaps/%s.%d%s", new Object[] {this.basePath, location.getResourcePath(), Integer.valueOf(p_147634_2_), ".png"}))); + } + + public TextureAtlasSprite getAtlasSprite(String iconName) + { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.mapUploadedSprites.get(iconName); + + if (textureatlassprite == null) + { + textureatlassprite = this.missingImage; + } + + return textureatlassprite; + } + + public void updateAnimations() + { + if (Config.isShaders()) + { + ShadersTex.updatingTex = this.getMultiTexID(); + } + + boolean flag = false; + boolean flag1 = false; + TextureUtil.bindTexture(this.getGlTextureId()); + + for (Object textureatlassprite0 : this.listAnimatedSprites) + { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite) textureatlassprite0; + + if (this.isTerrainAnimationActive(textureatlassprite)) + { + textureatlassprite.updateAnimation(); + + if (textureatlassprite.spriteNormal != null) + { + flag = true; + } + + if (textureatlassprite.spriteSpecular != null) + { + flag1 = true; + } + } + } + + if (Config.isMultiTexture()) + { + for (Object textureatlassprite10 : this.listAnimatedSprites) + { + TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite) textureatlassprite10; + + if (this.isTerrainAnimationActive(textureatlassprite1)) + { + TextureAtlasSprite textureatlassprite2 = textureatlassprite1.spriteSingle; + + if (textureatlassprite2 != null) + { + if (textureatlassprite1 == TextureUtils.iconClock || textureatlassprite1 == TextureUtils.iconCompass) + { + textureatlassprite2.frameCounter = textureatlassprite1.frameCounter; + } + + textureatlassprite1.bindSpriteTexture(); + textureatlassprite2.updateAnimation(); + } + } + } + + TextureUtil.bindTexture(this.getGlTextureId()); + } + + if (Config.isShaders()) + { + if (flag) + { + TextureUtil.bindTexture(this.getMultiTexID().norm); + + for (Object textureatlassprite30 : this.listAnimatedSprites) + { + TextureAtlasSprite textureatlassprite3 = (TextureAtlasSprite) textureatlassprite30; + + if (textureatlassprite3.spriteNormal != null && this.isTerrainAnimationActive(textureatlassprite3)) + { + if (textureatlassprite3 == TextureUtils.iconClock || textureatlassprite3 == TextureUtils.iconCompass) + { + textureatlassprite3.spriteNormal.frameCounter = textureatlassprite3.frameCounter; + } + + textureatlassprite3.spriteNormal.updateAnimation(); + } + } + } + + if (flag1) + { + TextureUtil.bindTexture(this.getMultiTexID().spec); + + for (Object textureatlassprite40 : this.listAnimatedSprites) + { + TextureAtlasSprite textureatlassprite4 = (TextureAtlasSprite) textureatlassprite40; + + if (textureatlassprite4.spriteSpecular != null && this.isTerrainAnimationActive(textureatlassprite4)) + { + if (textureatlassprite4 == TextureUtils.iconClock || textureatlassprite4 == TextureUtils.iconCompass) + { + textureatlassprite4.spriteNormal.frameCounter = textureatlassprite4.frameCounter; + } + + textureatlassprite4.spriteSpecular.updateAnimation(); + } + } + } + + if (flag || flag1) + { + TextureUtil.bindTexture(this.getGlTextureId()); + } + } + + if (Config.isShaders()) + { + ShadersTex.updatingTex = null; + } + } + + public TextureAtlasSprite registerSprite(ResourceLocation location) + { + if (location == null) + { + throw new IllegalArgumentException("Location cannot be null!"); + } + else + { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.mapRegisteredSprites.get(location.toString()); + + if (textureatlassprite == null) + { + textureatlassprite = TextureAtlasSprite.makeAtlasSprite(location); + this.mapRegisteredSprites.put(location.toString(), textureatlassprite); + + if (textureatlassprite.getIndexInMap() < 0) + { + textureatlassprite.setIndexInMap(this.counterIndexInMap++); + } + } + + return textureatlassprite; + } + } + + public void tick() + { + this.updateAnimations(); + } + + public void setMipmapLevels(int mipmapLevelsIn) + { + this.mipmapLevels = mipmapLevelsIn; + } + + public TextureAtlasSprite getMissingSprite() + { + return this.missingImage; + } + + public TextureAtlasSprite getTextureExtry(String p_getTextureExtry_1_) + { + ResourceLocation resourcelocation = new ResourceLocation(p_getTextureExtry_1_); + return (TextureAtlasSprite)this.mapRegisteredSprites.get(resourcelocation.toString()); + } + + public boolean setTextureEntry(String p_setTextureEntry_1_, TextureAtlasSprite p_setTextureEntry_2_) + { + if (!this.mapRegisteredSprites.containsKey(p_setTextureEntry_1_)) + { + this.mapRegisteredSprites.put(p_setTextureEntry_1_, p_setTextureEntry_2_); + + if (p_setTextureEntry_2_.getIndexInMap() < 0) + { + p_setTextureEntry_2_.setIndexInMap(this.counterIndexInMap++); + } + + return true; + } + else + { + return false; + } + } + + public boolean setTextureEntry(TextureAtlasSprite p_setTextureEntry_1_) + { + return this.setTextureEntry(p_setTextureEntry_1_.getIconName(), p_setTextureEntry_1_); + } + + public String getBasePath() + { + return this.basePath; + } + + public int getMipmapLevels() + { + return this.mipmapLevels; + } + + private boolean isAbsoluteLocation(ResourceLocation p_isAbsoluteLocation_1_) + { + String s = p_isAbsoluteLocation_1_.getResourcePath(); + return this.isAbsoluteLocationPath(s); + } + + private boolean isAbsoluteLocationPath(String p_isAbsoluteLocationPath_1_) + { + String s = p_isAbsoluteLocationPath_1_.toLowerCase(); + return s.startsWith("mcpatcher/") || s.startsWith("optifine/"); + } + + public TextureAtlasSprite getSpriteSafe(String p_getSpriteSafe_1_) + { + ResourceLocation resourcelocation = new ResourceLocation(p_getSpriteSafe_1_); + return (TextureAtlasSprite)this.mapRegisteredSprites.get(resourcelocation.toString()); + } + + private boolean isTerrainAnimationActive(TextureAtlasSprite p_isTerrainAnimationActive_1_) + { + return p_isTerrainAnimationActive_1_ != TextureUtils.iconWaterStill && p_isTerrainAnimationActive_1_ != TextureUtils.iconWaterFlow ? (p_isTerrainAnimationActive_1_ != TextureUtils.iconLavaStill && p_isTerrainAnimationActive_1_ != TextureUtils.iconLavaFlow ? (p_isTerrainAnimationActive_1_ != TextureUtils.iconFireLayer0 && p_isTerrainAnimationActive_1_ != TextureUtils.iconFireLayer1 ? (p_isTerrainAnimationActive_1_ == TextureUtils.iconPortal ? Config.isAnimatedPortal() : (p_isTerrainAnimationActive_1_ != TextureUtils.iconClock && p_isTerrainAnimationActive_1_ != TextureUtils.iconCompass ? Config.isAnimatedTerrain() : true)) : Config.isAnimatedFire()) : Config.isAnimatedLava()) : Config.isAnimatedWater(); + } + + public int getCountRegisteredSprites() + { + return this.counterIndexInMap; + } + + private int detectMaxMipmapLevel(Map p_detectMaxMipmapLevel_1_, IResourceManager p_detectMaxMipmapLevel_2_) + { + int i = this.detectMinimumSpriteSize(p_detectMaxMipmapLevel_1_, p_detectMaxMipmapLevel_2_, 20); + + if (i < 16) + { + i = 16; + } + + i = MathHelper.roundUpToPowerOfTwo(i); + + if (i > 16) + { + Config.log("Sprite size: " + i); + } + + int j = MathHelper.calculateLogBaseTwo(i); + + if (j < 4) + { + j = 4; + } + + return j; + } + + private int detectMinimumSpriteSize(Map p_detectMinimumSpriteSize_1_, IResourceManager p_detectMinimumSpriteSize_2_, int p_detectMinimumSpriteSize_3_) + { + Map map = new HashMap(); + + for (Object entry : p_detectMinimumSpriteSize_1_.entrySet()) + { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)((Entry) entry).getValue(); + ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName()); + ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0); + + if (!textureatlassprite.hasCustomLoader(p_detectMinimumSpriteSize_2_, resourcelocation)) + { + try + { + IResource iresource = p_detectMinimumSpriteSize_2_.getResource(resourcelocation1); + + if (iresource != null) + { + InputStream inputstream = iresource.getInputStream(); + + if (inputstream != null) + { + Dimension dimension = TextureUtils.getImageSize(inputstream, "png"); + + if (dimension != null) + { + int i = dimension.width; + int j = MathHelper.roundUpToPowerOfTwo(i); + + if (!map.containsKey(Integer.valueOf(j))) + { + map.put(Integer.valueOf(j), Integer.valueOf(1)); + } + else + { + int k = ((Integer)map.get(Integer.valueOf(j))).intValue(); + map.put(Integer.valueOf(j), Integer.valueOf(k + 1)); + } + } + } + } + } + catch (Exception var17) + { + ; + } + } + } + + int l = 0; + Set set = map.keySet(); + Set set1 = new TreeSet(set); + int l1; + + for (Iterator iterator = set1.iterator(); iterator.hasNext(); l += l1) + { + int j1 = ((Integer)iterator.next()).intValue(); + l1 = ((Integer)map.get(Integer.valueOf(j1))).intValue(); + } + + int i1 = 16; + int k1 = 0; + l1 = l * p_detectMinimumSpriteSize_3_ / 100; + Iterator iterator1 = set1.iterator(); + + while (iterator1.hasNext()) + { + int i2 = ((Integer)iterator1.next()).intValue(); + int j2 = ((Integer)map.get(Integer.valueOf(i2))).intValue(); + k1 += j2; + + if (i2 > i1) + { + i1 = i2; + } + + if (k1 > l1) + { + return i1; + } + } + + return i1; + } + + private int getMinSpriteSize() + { + int i = 1 << this.mipmapLevels; + + if (i < 8) + { + i = 8; + } + + return i; + } + + private int[] getMissingImageData(int p_getMissingImageData_1_) + { + BufferedImage bufferedimage = new BufferedImage(16, 16, 2); + bufferedimage.setRGB(0, 0, 16, 16, TextureUtil.missingTextureData, 0, 16); + BufferedImage bufferedimage1 = TextureUtils.scaleToPowerOfTwo(bufferedimage, p_getMissingImageData_1_); + int[] aint = new int[p_getMissingImageData_1_ * p_getMissingImageData_1_]; + bufferedimage1.getRGB(0, 0, p_getMissingImageData_1_, p_getMissingImageData_1_, aint, 0, p_getMissingImageData_1_); + return aint; + } + + public boolean isTextureBound() + { + int i = GlStateManager.getBoundTexture(); + int j = this.getGlTextureId(); + return i == j; + } + + private void updateIconGrid(int p_updateIconGrid_1_, int p_updateIconGrid_2_) + { + this.iconGridCountX = -1; + this.iconGridCountY = -1; + this.iconGrid = null; + + if (this.iconGridSize > 0) + { + this.iconGridCountX = p_updateIconGrid_1_ / this.iconGridSize; + this.iconGridCountY = p_updateIconGrid_2_ / this.iconGridSize; + this.iconGrid = new TextureAtlasSprite[this.iconGridCountX * this.iconGridCountY]; + this.iconGridSizeU = 1.0D / (double)this.iconGridCountX; + this.iconGridSizeV = 1.0D / (double)this.iconGridCountY; + + for (Object textureatlassprite0 : this.mapUploadedSprites.values()) + { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite) textureatlassprite0; + double d0 = 0.5D / (double)p_updateIconGrid_1_; + double d1 = 0.5D / (double)p_updateIconGrid_2_; + double d2 = (double)Math.min(textureatlassprite.getMinU(), textureatlassprite.getMaxU()) + d0; + double d3 = (double)Math.min(textureatlassprite.getMinV(), textureatlassprite.getMaxV()) + d1; + double d4 = (double)Math.max(textureatlassprite.getMinU(), textureatlassprite.getMaxU()) - d0; + double d5 = (double)Math.max(textureatlassprite.getMinV(), textureatlassprite.getMaxV()) - d1; + int i = (int)(d2 / this.iconGridSizeU); + int j = (int)(d3 / this.iconGridSizeV); + int k = (int)(d4 / this.iconGridSizeU); + int l = (int)(d5 / this.iconGridSizeV); + + for (int i1 = i; i1 <= k; ++i1) + { + if (i1 >= 0 && i1 < this.iconGridCountX) + { + for (int j1 = j; j1 <= l; ++j1) + { + if (j1 >= 0 && j1 < this.iconGridCountX) + { + int k1 = j1 * this.iconGridCountX + i1; + this.iconGrid[k1] = textureatlassprite; + } + else + { + Config.warn("Invalid grid V: " + j1 + ", icon: " + textureatlassprite.getIconName()); + } + } + } + else + { + Config.warn("Invalid grid U: " + i1 + ", icon: " + textureatlassprite.getIconName()); + } + } + } + } + } + + public TextureAtlasSprite getIconByUV(double p_getIconByUV_1_, double p_getIconByUV_3_) + { + if (this.iconGrid == null) + { + return null; + } + else + { + int i = (int)(p_getIconByUV_1_ / this.iconGridSizeU); + int j = (int)(p_getIconByUV_3_ / this.iconGridSizeV); + int k = j * this.iconGridCountX + i; + return k >= 0 && k <= this.iconGrid.length ? this.iconGrid[k] : null; + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java b/src/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java new file mode 100644 index 0000000..dd6e926 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java @@ -0,0 +1,397 @@ +package net.minecraft.client.renderer.texture; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.IntBuffer; +import javax.imageio.ImageIO; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import optifine.Mipmaps; +import optifine.Reflector; + +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; +import org.lwjgl.opengl.GL12; + +public class TextureUtil +{ + private static final Logger logger = LogManager.getLogger(); + private static final IntBuffer dataBuffer = GLAllocation.createDirectIntBuffer(4194304); + public static final DynamicTexture missingTexture = new DynamicTexture(16, 16); + public static final int[] missingTextureData = missingTexture.getTextureData(); + private static final int[] mipmapBuffer; + private static final String __OBFID = "CL_00001067"; + + public static int glGenTextures() + { + return GlStateManager.generateTexture(); + } + + public static void deleteTexture(int textureId) + { + GlStateManager.deleteTexture(textureId); + } + + public static int uploadTextureImage(int p_110987_0_, BufferedImage p_110987_1_) + { + return uploadTextureImageAllocate(p_110987_0_, p_110987_1_, false, false); + } + + public static void uploadTexture(int textureId, int[] p_110988_1_, int p_110988_2_, int p_110988_3_) + { + bindTexture(textureId); + uploadTextureSub(0, p_110988_1_, p_110988_2_, p_110988_3_, 0, 0, false, false, false); + } + + public static int[][] generateMipmapData(int p_147949_0_, int p_147949_1_, int[][] p_147949_2_) + { + int[][] aint = new int[p_147949_0_ + 1][]; + aint[0] = p_147949_2_[0]; + + if (p_147949_0_ > 0) + { + boolean flag = false; + + for (int i = 0; i < p_147949_2_.length; ++i) + { + if (p_147949_2_[0][i] >> 24 == 0) + { + flag = true; + break; + } + } + + for (int l1 = 1; l1 <= p_147949_0_; ++l1) + { + if (p_147949_2_[l1] != null) + { + aint[l1] = p_147949_2_[l1]; + } + else + { + int[] aint1 = aint[l1 - 1]; + int[] aint2 = new int[aint1.length >> 2]; + int j = p_147949_1_ >> l1; + int k = aint2.length / j; + int l = j << 1; + + for (int i1 = 0; i1 < j; ++i1) + { + for (int j1 = 0; j1 < k; ++j1) + { + int k1 = 2 * (i1 + j1 * l); + aint2[i1 + j1 * j] = blendColors(aint1[k1 + 0], aint1[k1 + 1], aint1[k1 + 0 + l], aint1[k1 + 1 + l], flag); + } + } + + aint[l1] = aint2; + } + } + } + + return aint; + } + + private static int blendColors(int p_147943_0_, int p_147943_1_, int p_147943_2_, int p_147943_3_, boolean p_147943_4_) + { + return Mipmaps.alphaBlend(p_147943_0_, p_147943_1_, p_147943_2_, p_147943_3_); + } + + private static int blendColorComponent(int p_147944_0_, int p_147944_1_, int p_147944_2_, int p_147944_3_, int p_147944_4_) + { + float f = (float)Math.pow((double)((float)(p_147944_0_ >> p_147944_4_ & 255) / 255.0F), 2.2D); + float f1 = (float)Math.pow((double)((float)(p_147944_1_ >> p_147944_4_ & 255) / 255.0F), 2.2D); + float f2 = (float)Math.pow((double)((float)(p_147944_2_ >> p_147944_4_ & 255) / 255.0F), 2.2D); + float f3 = (float)Math.pow((double)((float)(p_147944_3_ >> p_147944_4_ & 255) / 255.0F), 2.2D); + float f4 = (float)Math.pow((double)(f + f1 + f2 + f3) * 0.25D, 0.45454545454545453D); + return (int)((double)f4 * 255.0D); + } + + public static void uploadTextureMipmap(int[][] p_147955_0_, int p_147955_1_, int p_147955_2_, int p_147955_3_, int p_147955_4_, boolean p_147955_5_, boolean p_147955_6_) + { + for (int i = 0; i < p_147955_0_.length; ++i) + { + int[] aint = p_147955_0_[i]; + uploadTextureSub(i, aint, p_147955_1_ >> i, p_147955_2_ >> i, p_147955_3_ >> i, p_147955_4_ >> i, p_147955_5_, p_147955_6_, p_147955_0_.length > 1); + } + } + + private static void uploadTextureSub(int p_147947_0_, int[] p_147947_1_, int p_147947_2_, int p_147947_3_, int p_147947_4_, int p_147947_5_, boolean p_147947_6_, boolean p_147947_7_, boolean p_147947_8_) + { + int i = 4194304 / p_147947_2_; + setTextureBlurMipmap(p_147947_6_, p_147947_8_); + setTextureClamped(p_147947_7_); + int j; + + for (int k = 0; k < p_147947_2_ * p_147947_3_; k += p_147947_2_ * j) + { + int l = k / p_147947_2_; + j = Math.min(i, p_147947_3_ - l); + int i1 = p_147947_2_ * j; + copyToBufferPos(p_147947_1_, k, i1); + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, p_147947_0_, p_147947_4_, p_147947_5_ + l, p_147947_2_, j, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)dataBuffer); + } + } + + public static int uploadTextureImageAllocate(int p_110989_0_, BufferedImage p_110989_1_, boolean p_110989_2_, boolean p_110989_3_) + { + allocateTexture(p_110989_0_, p_110989_1_.getWidth(), p_110989_1_.getHeight()); + return uploadTextureImageSub(p_110989_0_, p_110989_1_, 0, 0, p_110989_2_, p_110989_3_); + } + + public static void allocateTexture(int p_110991_0_, int p_110991_1_, int p_110991_2_) + { + allocateTextureImpl(p_110991_0_, 0, p_110991_1_, p_110991_2_); + } + + public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) + { + Object object = TextureUtil.class; + + if (Reflector.SplashScreen.exists()) + { + object = Reflector.SplashScreen.getTargetClass(); + } + + synchronized (object) + { + deleteTexture(p_180600_0_); + bindTexture(p_180600_0_); + } + + if (p_180600_1_ >= 0) + { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_180600_1_); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)p_180600_1_); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F); + } + + for (int i = 0; i <= p_180600_1_; ++i) + { + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, i, GL11.GL_RGBA, p_180600_2_ >> i, p_180600_3_ >> i, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)((IntBuffer)null)); + } + } + + public static int uploadTextureImageSub(int textureId, BufferedImage p_110995_1_, int p_110995_2_, int p_110995_3_, boolean p_110995_4_, boolean p_110995_5_) + { + bindTexture(textureId); + uploadTextureImageSubImpl(p_110995_1_, p_110995_2_, p_110995_3_, p_110995_4_, p_110995_5_); + return textureId; + } + + private static void uploadTextureImageSubImpl(BufferedImage p_110993_0_, int p_110993_1_, int p_110993_2_, boolean p_110993_3_, boolean p_110993_4_) + { + int i = p_110993_0_.getWidth(); + int j = p_110993_0_.getHeight(); + int k = 4194304 / i; + int[] aint = new int[k * i]; + setTextureBlurred(p_110993_3_); + setTextureClamped(p_110993_4_); + + for (int l = 0; l < i * j; l += i * k) + { + int i1 = l / i; + int j1 = Math.min(k, j - i1); + int k1 = i * j1; + p_110993_0_.getRGB(0, i1, i, j1, aint, 0, i); + copyToBuffer(aint, k1); + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, p_110993_1_, p_110993_2_ + i1, i, j1, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)dataBuffer); + } + } + + public static void setTextureClamped(boolean p_110997_0_) + { + if (p_110997_0_) + { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE); + } + else + { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + } + } + + private static void setTextureBlurred(boolean p_147951_0_) + { + setTextureBlurMipmap(p_147951_0_, false); + } + + public static void setTextureBlurMipmap(boolean p_147954_0_, boolean p_147954_1_) + { + if (p_147954_0_) + { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, p_147954_1_ ? GL11.GL_LINEAR_MIPMAP_LINEAR : GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + } + else + { + int i = Config.getMipmapType(); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, p_147954_1_ ? i : GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + } + } + + private static void copyToBuffer(int[] p_110990_0_, int p_110990_1_) + { + copyToBufferPos(p_110990_0_, 0, p_110990_1_); + } + + private static void copyToBufferPos(int[] p_110994_0_, int p_110994_1_, int p_110994_2_) + { + int[] aint = p_110994_0_; + + if (Minecraft.getMinecraft().gameSettings.anaglyph) + { + aint = updateAnaglyph(p_110994_0_); + } + + dataBuffer.clear(); + dataBuffer.put(aint, p_110994_1_, p_110994_2_); + dataBuffer.position(0).limit(p_110994_2_); + } + + public static void bindTexture(int p_94277_0_) + { + GlStateManager.bindTexture(p_94277_0_); + } + + public static int[] readImageData(IResourceManager resourceManager, ResourceLocation imageLocation) throws IOException + { + BufferedImage bufferedimage = readBufferedImage(resourceManager.getResource(imageLocation).getInputStream()); + + if (bufferedimage == null) + { + return null; + } + else + { + int i = bufferedimage.getWidth(); + int j = bufferedimage.getHeight(); + int[] aint = new int[i * j]; + bufferedimage.getRGB(0, 0, i, j, aint, 0, i); + return aint; + } + } + + public static BufferedImage readBufferedImage(InputStream imageStream) throws IOException + { + if (imageStream == null) + { + return null; + } + else + { + BufferedImage bufferedimage; + + try + { + bufferedimage = ImageIO.read(imageStream); + } + finally + { + IOUtils.closeQuietly(imageStream); + } + + return bufferedimage; + } + } + + public static int[] updateAnaglyph(int[] p_110985_0_) + { + int[] aint = new int[p_110985_0_.length]; + + for (int i = 0; i < p_110985_0_.length; ++i) + { + aint[i] = anaglyphColor(p_110985_0_[i]); + } + + return aint; + } + + public static int anaglyphColor(int p_177054_0_) + { + int i = p_177054_0_ >> 24 & 255; + int j = p_177054_0_ >> 16 & 255; + int k = p_177054_0_ >> 8 & 255; + int l = p_177054_0_ & 255; + int i1 = (j * 30 + k * 59 + l * 11) / 100; + int j1 = (j * 30 + k * 70) / 100; + int k1 = (j * 30 + l * 70) / 100; + return i << 24 | i1 << 16 | j1 << 8 | k1; + } + + public static void saveGlTexture(String p_saveGlTexture_0_, int p_saveGlTexture_1_, int p_saveGlTexture_2_, int p_saveGlTexture_3_, int p_saveGlTexture_4_) + { + bindTexture(p_saveGlTexture_1_); + GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1); + GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); + + for (int i = 0; i <= p_saveGlTexture_2_; ++i) + { + File file1 = new File(p_saveGlTexture_0_ + "_" + i + ".png"); + int j = p_saveGlTexture_3_ >> i; + int k = p_saveGlTexture_4_ >> i; + int l = j * k; + IntBuffer intbuffer = BufferUtils.createIntBuffer(l); + int[] aint = new int[l]; + GL11.glGetTexImage(GL11.GL_TEXTURE_2D, i, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer); + intbuffer.get(aint); + BufferedImage bufferedimage = new BufferedImage(j, k, 2); + bufferedimage.setRGB(0, 0, j, k, aint, 0, j); + + try + { + ImageIO.write(bufferedimage, "png", (File)file1); + logger.debug("Exported png to: {}", new Object[] {file1.getAbsolutePath()}); + } + catch (Exception exception) + { + logger.debug((String)"Unable to write: ", (Throwable)exception); + } + } + } + + public static void processPixelValues(int[] p_147953_0_, int p_147953_1_, int p_147953_2_) + { + int[] aint = new int[p_147953_1_]; + int i = p_147953_2_ / 2; + + for (int j = 0; j < i; ++j) + { + System.arraycopy(p_147953_0_, j * p_147953_1_, aint, 0, p_147953_1_); + System.arraycopy(p_147953_0_, (p_147953_2_ - 1 - j) * p_147953_1_, p_147953_0_, j * p_147953_1_, p_147953_1_); + System.arraycopy(aint, 0, p_147953_0_, (p_147953_2_ - 1 - j) * p_147953_1_, p_147953_1_); + } + } + + static + { + int i = -16777216; + int j = -524040; + int[] aint = new int[] { -524040, -524040, -524040, -524040, -524040, -524040, -524040, -524040}; + int[] aint1 = new int[] { -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216}; + int k = aint.length; + + for (int l = 0; l < 16; ++l) + { + System.arraycopy(l < k ? aint : aint1, 0, missingTextureData, 16 * l, k); + System.arraycopy(l < k ? aint1 : aint, 0, missingTextureData, 16 * l + k, k); + } + + missingTexture.updateDynamicTexture(); + mipmapBuffer = new int[4]; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/RenderEnderCrystal.java b/src/minecraft/net/minecraft/client/renderer/tileentity/RenderEnderCrystal.java new file mode 100644 index 0000000..8cb339e --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/RenderEnderCrystal.java @@ -0,0 +1,49 @@ +package net.minecraft.client.renderer.tileentity; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelEnderCrystal; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class RenderEnderCrystal extends Render +{ + private static final ResourceLocation enderCrystalTextures = new ResourceLocation("textures/entity/endercrystal/endercrystal.png"); + private ModelBase modelEnderCrystal = new ModelEnderCrystal(0.0F, true); + + public RenderEnderCrystal(RenderManager renderManagerIn) + { + super(renderManagerIn); + this.shadowSize = 0.5F; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityEnderCrystal entity, double x, double y, double z, float entityYaw, float partialTicks) + { + float f = (float)entity.innerRotation + partialTicks; + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x, (float)y, (float)z); + this.bindTexture(enderCrystalTextures); + float f1 = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F; + f1 = f1 * f1 + f1; + this.modelEnderCrystal.render(entity, 0.0F, f * 3.0F, f1 * 0.2F, 0.0F, 0.0F, 0.0625F); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityEnderCrystal entity) + { + return enderCrystalTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java b/src/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java new file mode 100644 index 0000000..6538ceb --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/RenderItemFrame.java @@ -0,0 +1,273 @@ +package net.minecraft.client.renderer.tileentity; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureCompass; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemMap; +import net.minecraft.item.ItemSkull; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.storage.MapData; +import optifine.Config; +import optifine.Reflector; + +import org.lwjgl.opengl.GL11; +import shadersmod.client.ShadersTex; + +public class RenderItemFrame extends Render +{ + private static final ResourceLocation mapBackgroundTextures = new ResourceLocation("textures/map/map_background.png"); + private final Minecraft mc = Minecraft.getMinecraft(); + private final ModelResourceLocation itemFrameModel = new ModelResourceLocation("item_frame", "normal"); + private final ModelResourceLocation mapModel = new ModelResourceLocation("item_frame", "map"); + private RenderItem itemRenderer; + private static final String __OBFID = "CL_00001002"; + + public RenderItemFrame(RenderManager renderManagerIn, RenderItem itemRendererIn) + { + super(renderManagerIn); + this.itemRenderer = itemRendererIn; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityItemFrame entity, double x, double y, double z, float entityYaw, float partialTicks) + { + GlStateManager.pushMatrix(); + BlockPos blockpos = entity.getHangingPosition(); + double d0 = (double)blockpos.getX() - entity.posX + x; + double d1 = (double)blockpos.getY() - entity.posY + y; + double d2 = (double)blockpos.getZ() - entity.posZ + z; + GlStateManager.translate(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D); + GlStateManager.rotate(180.0F - entity.rotationYaw, 0.0F, 1.0F, 0.0F); + this.renderManager.renderEngine.bindTexture(TextureMap.locationBlocksTexture); + BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher(); + ModelManager modelmanager = blockrendererdispatcher.getBlockModelShapes().getModelManager(); + IBakedModel ibakedmodel; + + if (entity.getDisplayedItem() != null && entity.getDisplayedItem().getItem() == Items.filled_map) + { + ibakedmodel = modelmanager.getModel(this.mapModel); + } + else + { + ibakedmodel = modelmanager.getModel(this.itemFrameModel); + } + + GlStateManager.pushMatrix(); + GlStateManager.translate(-0.5F, -0.5F, -0.5F); + blockrendererdispatcher.getBlockModelRenderer().renderModelBrightnessColor(ibakedmodel, 1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + GlStateManager.translate(0.0F, 0.0F, 0.4375F); + this.renderItem(entity); + GlStateManager.popMatrix(); + this.renderName(entity, x + (double)((float)entity.facingDirection.getFrontOffsetX() * 0.3F), y - 0.25D, z + (double)((float)entity.facingDirection.getFrontOffsetZ() * 0.3F)); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityItemFrame entity) + { + return null; + } + + private void renderItem(EntityItemFrame itemFrame) + { + ItemStack itemstack = itemFrame.getDisplayedItem(); + + if (itemstack != null) + { + EntityItem entityitem = new EntityItem(itemFrame.worldObj, 0.0D, 0.0D, 0.0D, itemstack); + Item item = entityitem.getEntityItem().getItem(); + entityitem.getEntityItem().stackSize = 1; + entityitem.hoverStart = 0.0F; + GlStateManager.pushMatrix(); + GlStateManager.disableLighting(); + int i = itemFrame.getRotation(); + + if (item instanceof ItemMap) + { + i = i % 4 * 2; + } + + GlStateManager.rotate((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F); + + if (!Reflector.postForgeBusEvent(Reflector.RenderItemInFrameEvent_Constructor, new Object[] {itemFrame, this})) + { + if (item instanceof ItemMap) + { + this.renderManager.renderEngine.bindTexture(mapBackgroundTextures); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + float f = 0.0078125F; + GlStateManager.scale(f, f, f); + GlStateManager.translate(-64.0F, -64.0F, 0.0F); + MapData mapdata = Items.filled_map.getMapData(entityitem.getEntityItem(), itemFrame.worldObj); + GlStateManager.translate(0.0F, 0.0F, -1.0F); + + if (mapdata != null) + { + this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, true); + } + } + else + { + TextureAtlasSprite textureatlassprite = null; + + if (item == Items.compass) + { + textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(TextureCompass.field_176608_l); + + if (Config.isShaders()) + { + ShadersTex.bindTextureMapForUpdateAndRender(this.mc.getTextureManager(), TextureMap.locationBlocksTexture); + } + else + { + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + } + + if (textureatlassprite instanceof TextureCompass) + { + TextureCompass texturecompass = (TextureCompass)textureatlassprite; + double d0 = texturecompass.currentAngle; + double d1 = texturecompass.angleDelta; + texturecompass.currentAngle = 0.0D; + texturecompass.angleDelta = 0.0D; + texturecompass.updateCompass(itemFrame.worldObj, itemFrame.posX, itemFrame.posZ, (double)MathHelper.wrapAngleTo180_float((float)(180 + itemFrame.facingDirection.getHorizontalIndex() * 90)), false, true); + texturecompass.currentAngle = d0; + texturecompass.angleDelta = d1; + } + else + { + textureatlassprite = null; + } + } + + GlStateManager.scale(0.5F, 0.5F, 0.5F); + + if (!this.itemRenderer.shouldRenderItemIn3D(entityitem.getEntityItem()) || item instanceof ItemSkull) + { + GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); + } + + GlStateManager.pushAttrib(); + RenderHelper.enableStandardItemLighting(); + this.itemRenderer.func_181564_a(entityitem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED); + RenderHelper.disableStandardItemLighting(); + GlStateManager.popAttrib(); + + if (textureatlassprite != null && textureatlassprite.getFrameCount() > 0) + { + textureatlassprite.updateAnimation(); + } + } + } + GlStateManager.enableLighting(); + GlStateManager.popMatrix(); + } + } + + protected void renderName(EntityItemFrame entity, double x, double y, double z) + { + if (Minecraft.isGuiEnabled() && entity.getDisplayedItem() != null && entity.getDisplayedItem().hasDisplayName() && this.renderManager.pointedEntity == entity) + { + float f = 1.6F; + float f1 = 0.016666668F * f; + double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer); + float f2 = entity.isSneaking() ? 32.0F : 64.0F; + + if (d0 < (double)(f2 * f2)) + { + String s = entity.getDisplayedItem().getDisplayName(); + + if (entity.isSneaking()) + { + FontRenderer fontrenderer = this.getFontRendererFromRenderManager(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x + 0.0F, (float)y + entity.height + 0.5F, (float)z); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.scale(-f1, -f1, f1); + GlStateManager.disableLighting(); + GlStateManager.translate(0.0F, 0.25F / f1, 0.0F); + GlStateManager.depthMask(false); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int i = fontrenderer.getStringWidth(s) / 2; + GlStateManager.disableTexture2D(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos((double)(-i - 1), -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(-i - 1), 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(i + 1), 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(i + 1), -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + GlStateManager.depthMask(true); + fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 553648127); + GlStateManager.enableLighting(); + GlStateManager.disableBlend(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + else + { + this.renderLivingLabel(entity, s, x, y, z, 64); + } + } + } + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity entity) + { + return this.getEntityTexture((EntityItemFrame)entity); + } + + protected void renderName(Entity entity, double x, double y, double z) + { + this.renderName((EntityItemFrame)entity, x, y, z); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks) + { + this.doRender((EntityItemFrame)entity, x, y, z, entityYaw, partialTicks); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/RenderWitherSkull.java b/src/minecraft/net/minecraft/client/renderer/tileentity/RenderWitherSkull.java new file mode 100644 index 0000000..0e94f1b --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/RenderWitherSkull.java @@ -0,0 +1,70 @@ +package net.minecraft.client.renderer.tileentity; + +import net.minecraft.client.model.ModelSkeletonHead; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.projectile.EntityWitherSkull; +import net.minecraft.util.ResourceLocation; + +public class RenderWitherSkull extends Render +{ + private static final ResourceLocation invulnerableWitherTextures = new ResourceLocation("textures/entity/wither/wither_invulnerable.png"); + private static final ResourceLocation witherTextures = new ResourceLocation("textures/entity/wither/wither.png"); + + /** The Skeleton's head model. */ + private final ModelSkeletonHead skeletonHeadModel = new ModelSkeletonHead(); + + public RenderWitherSkull(RenderManager renderManagerIn) + { + super(renderManagerIn); + } + + private float func_82400_a(float p_82400_1_, float p_82400_2_, float p_82400_3_) + { + float f; + + for (f = p_82400_2_ - p_82400_1_; f < -180.0F; f += 360.0F) + { + ; + } + + while (f >= 180.0F) + { + f -= 360.0F; + } + + return p_82400_1_ + p_82400_3_ * f; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render) and this method has signature public void doRender(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doe + */ + public void doRender(EntityWitherSkull entity, double x, double y, double z, float entityYaw, float partialTicks) + { + GlStateManager.pushMatrix(); + GlStateManager.disableCull(); + float f = this.func_82400_a(entity.prevRotationYaw, entity.rotationYaw, partialTicks); + float f1 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks; + GlStateManager.translate((float)x, (float)y, (float)z); + float f2 = 0.0625F; + GlStateManager.enableRescaleNormal(); + GlStateManager.scale(-1.0F, -1.0F, 1.0F); + GlStateManager.enableAlpha(); + this.bindEntityTexture(entity); + this.skeletonHeadModel.render(entity, 0.0F, 0.0F, 0.0F, f, f1, f2); + GlStateManager.popMatrix(); + super.doRender(entity, x, y, z, entityYaw, partialTicks); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityWitherSkull entity) + { + return entity.isInvulnerable() ? invulnerableWitherTextures : witherTextures; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityBannerRenderer.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityBannerRenderer.java new file mode 100644 index 0000000..f5ffaa4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityBannerRenderer.java @@ -0,0 +1,151 @@ +package net.minecraft.client.renderer.tileentity; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBanner; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.texture.LayeredColorMaskTexture; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.tileentity.TileEntityBanner; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class TileEntityBannerRenderer extends TileEntitySpecialRenderer +{ + private static final Map DESIGNS = Maps.newHashMap(); + private static final ResourceLocation BANNERTEXTURES = new ResourceLocation("textures/entity/banner_base.png"); + private ModelBanner bannerModel = new ModelBanner(); + + public void renderTileEntityAt(TileEntityBanner te, double x, double y, double z, float partialTicks, int destroyStage) + { + boolean flag = te.getWorld() != null; + boolean flag1 = !flag || te.getBlockType() == Blocks.standing_banner; + int i = flag ? te.getBlockMetadata() : 0; + long j = flag ? te.getWorld().getTotalWorldTime() : 0L; + GlStateManager.pushMatrix(); + float f = 0.6666667F; + + if (flag1) + { + GlStateManager.translate((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F); + float f1 = (float)(i * 360) / 16.0F; + GlStateManager.rotate(-f1, 0.0F, 1.0F, 0.0F); + this.bannerModel.bannerStand.showModel = true; + } + else + { + float f2 = 0.0F; + + if (i == 2) + { + f2 = 180.0F; + } + + if (i == 4) + { + f2 = 90.0F; + } + + if (i == 5) + { + f2 = -90.0F; + } + + GlStateManager.translate((float)x + 0.5F, (float)y - 0.25F * f, (float)z + 0.5F); + GlStateManager.rotate(-f2, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.0F, -0.3125F, -0.4375F); + this.bannerModel.bannerStand.showModel = false; + } + + BlockPos blockpos = te.getPos(); + float f3 = (float)(blockpos.getX() * 7 + blockpos.getY() * 9 + blockpos.getZ() * 13) + (float)j + partialTicks; + this.bannerModel.bannerSlate.rotateAngleX = (-0.0125F + 0.01F * MathHelper.cos(f3 * (float)Math.PI * 0.02F)) * (float)Math.PI; + GlStateManager.enableRescaleNormal(); + ResourceLocation resourcelocation = this.func_178463_a(te); + + if (resourcelocation != null) + { + this.bindTexture(resourcelocation); + GlStateManager.pushMatrix(); + GlStateManager.scale(f, -f, -f); + this.bannerModel.renderBanner(); + GlStateManager.popMatrix(); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + + private ResourceLocation func_178463_a(TileEntityBanner bannerObj) + { + String s = bannerObj.func_175116_e(); + + if (s.isEmpty()) + { + return null; + } + else + { + TileEntityBannerRenderer.TimedBannerTexture tileentitybannerrenderer$timedbannertexture = (TileEntityBannerRenderer.TimedBannerTexture)DESIGNS.get(s); + + if (tileentitybannerrenderer$timedbannertexture == null) + { + if (DESIGNS.size() >= 256) + { + long i = System.currentTimeMillis(); + Iterator iterator = DESIGNS.keySet().iterator(); + + while (iterator.hasNext()) + { + String s1 = (String)iterator.next(); + TileEntityBannerRenderer.TimedBannerTexture tileentitybannerrenderer$timedbannertexture1 = (TileEntityBannerRenderer.TimedBannerTexture)DESIGNS.get(s1); + + if (i - tileentitybannerrenderer$timedbannertexture1.systemTime > 60000L) + { + Minecraft.getMinecraft().getTextureManager().deleteTexture(tileentitybannerrenderer$timedbannertexture1.bannerTexture); + iterator.remove(); + } + } + + if (DESIGNS.size() >= 256) + { + return null; + } + } + + List list1 = bannerObj.getPatternList(); + List list = bannerObj.getColorList(); + List list2 = Lists.newArrayList(); + + for (TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern : list1) + { + list2.add("textures/entity/banner/" + tileentitybanner$enumbannerpattern.getPatternName() + ".png"); + } + + tileentitybannerrenderer$timedbannertexture = new TileEntityBannerRenderer.TimedBannerTexture(); + tileentitybannerrenderer$timedbannertexture.bannerTexture = new ResourceLocation(s); + Minecraft.getMinecraft().getTextureManager().loadTexture(tileentitybannerrenderer$timedbannertexture.bannerTexture, new LayeredColorMaskTexture(BANNERTEXTURES, list2, list)); + DESIGNS.put(s, tileentitybannerrenderer$timedbannertexture); + } + + tileentitybannerrenderer$timedbannertexture.systemTime = System.currentTimeMillis(); + return tileentitybannerrenderer$timedbannertexture.bannerTexture; + } + } + + static class TimedBannerTexture + { + public long systemTime; + public ResourceLocation bannerTexture; + + private TimedBannerTexture() + { + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityBeaconRenderer.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityBeaconRenderer.java new file mode 100644 index 0000000..2666c1a --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityBeaconRenderer.java @@ -0,0 +1,126 @@ +package net.minecraft.client.renderer.tileentity; + +import java.util.List; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.tileentity.TileEntityBeacon; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class TileEntityBeaconRenderer extends TileEntitySpecialRenderer +{ + private static final ResourceLocation beaconBeam = new ResourceLocation("textures/entity/beacon_beam.png"); + + public void renderTileEntityAt(TileEntityBeacon te, double x, double y, double z, float partialTicks, int destroyStage) + { + float f = te.shouldBeamRender(); + GlStateManager.alphaFunc(516, 0.1F); + + if (f > 0.0F) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.disableFog(); + List list = te.getBeamSegments(); + int i = 0; + + for (int j = 0; j < list.size(); ++j) + { + TileEntityBeacon.BeamSegment tileentitybeacon$beamsegment = (TileEntityBeacon.BeamSegment)list.get(j); + int k = i + tileentitybeacon$beamsegment.getHeight(); + this.bindTexture(beaconBeam); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); + GlStateManager.disableLighting(); + GlStateManager.disableCull(); + GlStateManager.disableBlend(); + GlStateManager.depthMask(true); + GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0); + double d0 = (double)te.getWorld().getTotalWorldTime() + (double)partialTicks; + double d1 = MathHelper.func_181162_h(-d0 * 0.2D - (double)MathHelper.floor_double(-d0 * 0.1D)); + float f1 = tileentitybeacon$beamsegment.getColors()[0]; + float f2 = tileentitybeacon$beamsegment.getColors()[1]; + float f3 = tileentitybeacon$beamsegment.getColors()[2]; + double d2 = d0 * 0.025D * -1.5D; + double d3 = 0.2D; + double d4 = 0.5D + Math.cos(d2 + 2.356194490192345D) * 0.2D; + double d5 = 0.5D + Math.sin(d2 + 2.356194490192345D) * 0.2D; + double d6 = 0.5D + Math.cos(d2 + (Math.PI / 4D)) * 0.2D; + double d7 = 0.5D + Math.sin(d2 + (Math.PI / 4D)) * 0.2D; + double d8 = 0.5D + Math.cos(d2 + 3.9269908169872414D) * 0.2D; + double d9 = 0.5D + Math.sin(d2 + 3.9269908169872414D) * 0.2D; + double d10 = 0.5D + Math.cos(d2 + 5.497787143782138D) * 0.2D; + double d11 = 0.5D + Math.sin(d2 + 5.497787143782138D) * 0.2D; + double d12 = 0.0D; + double d13 = 1.0D; + double d14 = -1.0D + d1; + double d15 = (double)((float)tileentitybeacon$beamsegment.getHeight() * f) * 2.5D + d14; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos(x + d4, y + (double)k, z + d5).tex(1.0D, d15).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d4, y + (double)i, z + d5).tex(1.0D, d14).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d6, y + (double)i, z + d7).tex(0.0D, d14).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d6, y + (double)k, z + d7).tex(0.0D, d15).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d10, y + (double)k, z + d11).tex(1.0D, d15).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d10, y + (double)i, z + d11).tex(1.0D, d14).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d8, y + (double)i, z + d9).tex(0.0D, d14).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d8, y + (double)k, z + d9).tex(0.0D, d15).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d6, y + (double)k, z + d7).tex(1.0D, d15).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d6, y + (double)i, z + d7).tex(1.0D, d14).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d10, y + (double)i, z + d11).tex(0.0D, d14).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d10, y + (double)k, z + d11).tex(0.0D, d15).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d8, y + (double)k, z + d9).tex(1.0D, d15).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d8, y + (double)i, z + d9).tex(1.0D, d14).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d4, y + (double)i, z + d5).tex(0.0D, d14).color(f1, f2, f3, 1.0F).endVertex(); + worldrenderer.pos(x + d4, y + (double)k, z + d5).tex(0.0D, d15).color(f1, f2, f3, 1.0F).endVertex(); + tessellator.draw(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.depthMask(false); + d2 = 0.2D; + d3 = 0.2D; + d4 = 0.8D; + d5 = 0.2D; + d6 = 0.2D; + d7 = 0.8D; + d8 = 0.8D; + d9 = 0.8D; + d10 = 0.0D; + d11 = 1.0D; + d12 = -1.0D + d1; + d13 = (double)((float)tileentitybeacon$beamsegment.getHeight() * f) + d12; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos(x + 0.2D, y + (double)k, z + 0.2D).tex(1.0D, d13).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.2D, y + (double)i, z + 0.2D).tex(1.0D, d12).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.8D, y + (double)i, z + 0.2D).tex(0.0D, d12).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.8D, y + (double)k, z + 0.2D).tex(0.0D, d13).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.8D, y + (double)k, z + 0.8D).tex(1.0D, d13).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.8D, y + (double)i, z + 0.8D).tex(1.0D, d12).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.2D, y + (double)i, z + 0.8D).tex(0.0D, d12).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.2D, y + (double)k, z + 0.8D).tex(0.0D, d13).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.8D, y + (double)k, z + 0.2D).tex(1.0D, d13).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.8D, y + (double)i, z + 0.2D).tex(1.0D, d12).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.8D, y + (double)i, z + 0.8D).tex(0.0D, d12).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.8D, y + (double)k, z + 0.8D).tex(0.0D, d13).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.2D, y + (double)k, z + 0.8D).tex(1.0D, d13).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.2D, y + (double)i, z + 0.8D).tex(1.0D, d12).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.2D, y + (double)i, z + 0.2D).tex(0.0D, d12).color(f1, f2, f3, 0.125F).endVertex(); + worldrenderer.pos(x + 0.2D, y + (double)k, z + 0.2D).tex(0.0D, d13).color(f1, f2, f3, 0.125F).endVertex(); + tessellator.draw(); + GlStateManager.enableLighting(); + GlStateManager.enableTexture2D(); + GlStateManager.depthMask(true); + i = k; + } + + GlStateManager.enableFog(); + } + } + + public boolean func_181055_a() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java new file mode 100644 index 0000000..a6620d8 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityChestRenderer.java @@ -0,0 +1,199 @@ +package net.minecraft.client.renderer.tileentity; + +import java.util.Calendar; +import net.minecraft.block.Block; +import net.minecraft.block.BlockChest; +import net.minecraft.client.model.ModelChest; +import net.minecraft.client.model.ModelLargeChest; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.ResourceLocation; + +public class TileEntityChestRenderer extends TileEntitySpecialRenderer +{ + private static final ResourceLocation textureTrappedDouble = new ResourceLocation("textures/entity/chest/trapped_double.png"); + private static final ResourceLocation textureChristmasDouble = new ResourceLocation("textures/entity/chest/christmas_double.png"); + private static final ResourceLocation textureNormalDouble = new ResourceLocation("textures/entity/chest/normal_double.png"); + private static final ResourceLocation textureTrapped = new ResourceLocation("textures/entity/chest/trapped.png"); + private static final ResourceLocation textureChristmas = new ResourceLocation("textures/entity/chest/christmas.png"); + private static final ResourceLocation textureNormal = new ResourceLocation("textures/entity/chest/normal.png"); + private ModelChest simpleChest = new ModelChest(); + private ModelChest largeChest = new ModelLargeChest(); + private boolean isChristams; + + public TileEntityChestRenderer() + { + Calendar calendar = Calendar.getInstance(); + + if (calendar.get(2) + 1 == 12 && calendar.get(5) >= 24 && calendar.get(5) <= 26) + { + this.isChristams = true; + } + } + + public void renderTileEntityAt(TileEntityChest te, double x, double y, double z, float partialTicks, int destroyStage) + { + GlStateManager.enableDepth(); + GlStateManager.depthFunc(515); + GlStateManager.depthMask(true); + int i; + + if (!te.hasWorldObj()) + { + i = 0; + } + else + { + Block block = te.getBlockType(); + i = te.getBlockMetadata(); + + if (block instanceof BlockChest && i == 0) + { + ((BlockChest)block).checkForSurroundingChests(te.getWorld(), te.getPos(), te.getWorld().getBlockState(te.getPos())); + i = te.getBlockMetadata(); + } + + te.checkForAdjacentChests(); + } + + if (te.adjacentChestZNeg == null && te.adjacentChestXNeg == null) + { + ModelChest modelchest; + + if (te.adjacentChestXPos == null && te.adjacentChestZPos == null) + { + modelchest = this.simpleChest; + + if (destroyStage >= 0) + { + this.bindTexture(DESTROY_STAGES[destroyStage]); + GlStateManager.matrixMode(5890); + GlStateManager.pushMatrix(); + GlStateManager.scale(4.0F, 4.0F, 1.0F); + GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); + GlStateManager.matrixMode(5888); + } + else if (te.getChestType() == 1) + { + this.bindTexture(textureTrapped); + } + else if (this.isChristams) + { + this.bindTexture(textureChristmas); + } + else + { + this.bindTexture(textureNormal); + } + } + else + { + modelchest = this.largeChest; + + if (destroyStage >= 0) + { + this.bindTexture(DESTROY_STAGES[destroyStage]); + GlStateManager.matrixMode(5890); + GlStateManager.pushMatrix(); + GlStateManager.scale(8.0F, 4.0F, 1.0F); + GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); + GlStateManager.matrixMode(5888); + } + else if (te.getChestType() == 1) + { + this.bindTexture(textureTrappedDouble); + } + else if (this.isChristams) + { + this.bindTexture(textureChristmasDouble); + } + else + { + this.bindTexture(textureNormalDouble); + } + } + + GlStateManager.pushMatrix(); + GlStateManager.enableRescaleNormal(); + + if (destroyStage < 0) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + } + + GlStateManager.translate((float)x, (float)y + 1.0F, (float)z + 1.0F); + GlStateManager.scale(1.0F, -1.0F, -1.0F); + GlStateManager.translate(0.5F, 0.5F, 0.5F); + int j = 0; + + if (i == 2) + { + j = 180; + } + + if (i == 3) + { + j = 0; + } + + if (i == 4) + { + j = 90; + } + + if (i == 5) + { + j = -90; + } + + if (i == 2 && te.adjacentChestXPos != null) + { + GlStateManager.translate(1.0F, 0.0F, 0.0F); + } + + if (i == 5 && te.adjacentChestZPos != null) + { + GlStateManager.translate(0.0F, 0.0F, -1.0F); + } + + GlStateManager.rotate((float)j, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(-0.5F, -0.5F, -0.5F); + float f = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * partialTicks; + + if (te.adjacentChestZNeg != null) + { + float f1 = te.adjacentChestZNeg.prevLidAngle + (te.adjacentChestZNeg.lidAngle - te.adjacentChestZNeg.prevLidAngle) * partialTicks; + + if (f1 > f) + { + f = f1; + } + } + + if (te.adjacentChestXNeg != null) + { + float f2 = te.adjacentChestXNeg.prevLidAngle + (te.adjacentChestXNeg.lidAngle - te.adjacentChestXNeg.prevLidAngle) * partialTicks; + + if (f2 > f) + { + f = f2; + } + } + + f = 1.0F - f; + f = 1.0F - f * f * f; + modelchest.chestLid.rotateAngleX = -(f * (float)Math.PI / 2.0F); + modelchest.renderAll(); + GlStateManager.disableRescaleNormal(); + GlStateManager.popMatrix(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + + if (destroyStage >= 0) + { + GlStateManager.matrixMode(5890); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5888); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityEnchantmentTableRenderer.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityEnchantmentTableRenderer.java new file mode 100644 index 0000000..c80f68d --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityEnchantmentTableRenderer.java @@ -0,0 +1,68 @@ +package net.minecraft.client.renderer.tileentity; + +import net.minecraft.client.model.ModelBook; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.tileentity.TileEntityEnchantmentTable; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class TileEntityEnchantmentTableRenderer extends TileEntitySpecialRenderer +{ + /** The texture for the book above the enchantment table. */ + private static final ResourceLocation TEXTURE_BOOK = new ResourceLocation("textures/entity/enchanting_table_book.png"); + private ModelBook field_147541_c = new ModelBook(); + + public void renderTileEntityAt(TileEntityEnchantmentTable te, double x, double y, double z, float partialTicks, int destroyStage) + { + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x + 0.5F, (float)y + 0.75F, (float)z + 0.5F); + float f = (float)te.tickCount + partialTicks; + GlStateManager.translate(0.0F, 0.1F + MathHelper.sin(f * 0.1F) * 0.01F, 0.0F); + float f1; + + for (f1 = te.bookRotation - te.bookRotationPrev; f1 >= (float)Math.PI; f1 -= ((float)Math.PI * 2F)) + { + ; + } + + while (f1 < -(float)Math.PI) + { + f1 += ((float)Math.PI * 2F); + } + + float f2 = te.bookRotationPrev + f1 * partialTicks; + GlStateManager.rotate(-f2 * 180.0F / (float)Math.PI, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(80.0F, 0.0F, 0.0F, 1.0F); + this.bindTexture(TEXTURE_BOOK); + float f3 = te.pageFlipPrev + (te.pageFlip - te.pageFlipPrev) * partialTicks + 0.25F; + float f4 = te.pageFlipPrev + (te.pageFlip - te.pageFlipPrev) * partialTicks + 0.75F; + f3 = (f3 - (float)MathHelper.truncateDoubleToInt((double)f3)) * 1.6F - 0.3F; + f4 = (f4 - (float)MathHelper.truncateDoubleToInt((double)f4)) * 1.6F - 0.3F; + + if (f3 < 0.0F) + { + f3 = 0.0F; + } + + if (f4 < 0.0F) + { + f4 = 0.0F; + } + + if (f3 > 1.0F) + { + f3 = 1.0F; + } + + if (f4 > 1.0F) + { + f4 = 1.0F; + } + + float f5 = te.bookSpreadPrev + (te.bookSpread - te.bookSpreadPrev) * partialTicks; + GlStateManager.enableCull(); + this.field_147541_c.render((Entity)null, f, f3, f4, f5, 0.0F, 0.0625F); + GlStateManager.popMatrix(); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityEndPortalRenderer.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityEndPortalRenderer.java new file mode 100644 index 0000000..eece3b3 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityEndPortalRenderer.java @@ -0,0 +1,127 @@ +package net.minecraft.client.renderer.tileentity; + +import java.nio.FloatBuffer; +import java.util.Random; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.tileentity.TileEntityEndPortal; +import net.minecraft.util.ResourceLocation; + +public class TileEntityEndPortalRenderer extends TileEntitySpecialRenderer +{ + private static final ResourceLocation END_SKY_TEXTURE = new ResourceLocation("textures/environment/end_sky.png"); + private static final ResourceLocation END_PORTAL_TEXTURE = new ResourceLocation("textures/entity/end_portal.png"); + private static final Random field_147527_e = new Random(31100L); + FloatBuffer field_147528_b = GLAllocation.createDirectFloatBuffer(16); + + public void renderTileEntityAt(TileEntityEndPortal te, double x, double y, double z, float partialTicks, int destroyStage) + { + float f = (float)this.rendererDispatcher.entityX; + float f1 = (float)this.rendererDispatcher.entityY; + float f2 = (float)this.rendererDispatcher.entityZ; + GlStateManager.disableLighting(); + field_147527_e.setSeed(31100L); + float f3 = 0.75F; + + for (int i = 0; i < 16; ++i) + { + GlStateManager.pushMatrix(); + float f4 = (float)(16 - i); + float f5 = 0.0625F; + float f6 = 1.0F / (f4 + 1.0F); + + if (i == 0) + { + this.bindTexture(END_SKY_TEXTURE); + f6 = 0.1F; + f4 = 65.0F; + f5 = 0.125F; + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + } + + if (i >= 1) + { + this.bindTexture(END_PORTAL_TEXTURE); + } + + if (i == 1) + { + GlStateManager.enableBlend(); + GlStateManager.blendFunc(1, 1); + f5 = 0.5F; + } + + float f7 = (float)(-(y + (double)f3)); + float f8 = f7 + (float)ActiveRenderInfo.getPosition().yCoord; + float f9 = f7 + f4 + (float)ActiveRenderInfo.getPosition().yCoord; + float f10 = f8 / f9; + f10 = (float)(y + (double)f3) + f10; + GlStateManager.translate(f, f10, f2); + GlStateManager.texGen(GlStateManager.TexGen.S, 9217); + GlStateManager.texGen(GlStateManager.TexGen.T, 9217); + GlStateManager.texGen(GlStateManager.TexGen.R, 9217); + GlStateManager.texGen(GlStateManager.TexGen.Q, 9216); + GlStateManager.func_179105_a(GlStateManager.TexGen.S, 9473, this.func_147525_a(1.0F, 0.0F, 0.0F, 0.0F)); + GlStateManager.func_179105_a(GlStateManager.TexGen.T, 9473, this.func_147525_a(0.0F, 0.0F, 1.0F, 0.0F)); + GlStateManager.func_179105_a(GlStateManager.TexGen.R, 9473, this.func_147525_a(0.0F, 0.0F, 0.0F, 1.0F)); + GlStateManager.func_179105_a(GlStateManager.TexGen.Q, 9474, this.func_147525_a(0.0F, 1.0F, 0.0F, 0.0F)); + GlStateManager.enableTexGenCoord(GlStateManager.TexGen.S); + GlStateManager.enableTexGenCoord(GlStateManager.TexGen.T); + GlStateManager.enableTexGenCoord(GlStateManager.TexGen.R); + GlStateManager.enableTexGenCoord(GlStateManager.TexGen.Q); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5890); + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, (float)(Minecraft.getSystemTime() % 700000L) / 700000.0F, 0.0F); + GlStateManager.scale(f5, f5, f5); + GlStateManager.translate(0.5F, 0.5F, 0.0F); + GlStateManager.rotate((float)(i * i * 4321 + i * 9) * 2.0F, 0.0F, 0.0F, 1.0F); + GlStateManager.translate(-0.5F, -0.5F, 0.0F); + GlStateManager.translate(-f, -f2, -f1); + f8 = f7 + (float)ActiveRenderInfo.getPosition().yCoord; + GlStateManager.translate((float)ActiveRenderInfo.getPosition().xCoord * f4 / f8, (float)ActiveRenderInfo.getPosition().zCoord * f4 / f8, -f1); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + float f11 = (field_147527_e.nextFloat() * 0.5F + 0.1F) * f6; + float f12 = (field_147527_e.nextFloat() * 0.5F + 0.4F) * f6; + float f13 = (field_147527_e.nextFloat() * 0.5F + 0.5F) * f6; + + if (i == 0) + { + f11 = f12 = f13 = 1.0F * f6; + } + + worldrenderer.pos(x, y + (double)f3, z).color(f11, f12, f13, 1.0F).endVertex(); + worldrenderer.pos(x, y + (double)f3, z + 1.0D).color(f11, f12, f13, 1.0F).endVertex(); + worldrenderer.pos(x + 1.0D, y + (double)f3, z + 1.0D).color(f11, f12, f13, 1.0F).endVertex(); + worldrenderer.pos(x + 1.0D, y + (double)f3, z).color(f11, f12, f13, 1.0F).endVertex(); + tessellator.draw(); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5888); + this.bindTexture(END_SKY_TEXTURE); + } + + GlStateManager.disableBlend(); + GlStateManager.disableTexGenCoord(GlStateManager.TexGen.S); + GlStateManager.disableTexGenCoord(GlStateManager.TexGen.T); + GlStateManager.disableTexGenCoord(GlStateManager.TexGen.R); + GlStateManager.disableTexGenCoord(GlStateManager.TexGen.Q); + GlStateManager.enableLighting(); + } + + private FloatBuffer func_147525_a(float p_147525_1_, float p_147525_2_, float p_147525_3_, float p_147525_4_) + { + this.field_147528_b.clear(); + this.field_147528_b.put(p_147525_1_).put(p_147525_2_).put(p_147525_3_).put(p_147525_4_); + this.field_147528_b.flip(); + return this.field_147528_b; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityEnderChestRenderer.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityEnderChestRenderer.java new file mode 100644 index 0000000..b74f675 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityEnderChestRenderer.java @@ -0,0 +1,82 @@ +package net.minecraft.client.renderer.tileentity; + +import net.minecraft.client.model.ModelChest; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.tileentity.TileEntityEnderChest; +import net.minecraft.util.ResourceLocation; + +public class TileEntityEnderChestRenderer extends TileEntitySpecialRenderer +{ + private static final ResourceLocation ENDER_CHEST_TEXTURE = new ResourceLocation("textures/entity/chest/ender.png"); + private ModelChest field_147521_c = new ModelChest(); + + public void renderTileEntityAt(TileEntityEnderChest te, double x, double y, double z, float partialTicks, int destroyStage) + { + int i = 0; + + if (te.hasWorldObj()) + { + i = te.getBlockMetadata(); + } + + if (destroyStage >= 0) + { + this.bindTexture(DESTROY_STAGES[destroyStage]); + GlStateManager.matrixMode(5890); + GlStateManager.pushMatrix(); + GlStateManager.scale(4.0F, 4.0F, 1.0F); + GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); + GlStateManager.matrixMode(5888); + } + else + { + this.bindTexture(ENDER_CHEST_TEXTURE); + } + + GlStateManager.pushMatrix(); + GlStateManager.enableRescaleNormal(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.translate((float)x, (float)y + 1.0F, (float)z + 1.0F); + GlStateManager.scale(1.0F, -1.0F, -1.0F); + GlStateManager.translate(0.5F, 0.5F, 0.5F); + int j = 0; + + if (i == 2) + { + j = 180; + } + + if (i == 3) + { + j = 0; + } + + if (i == 4) + { + j = 90; + } + + if (i == 5) + { + j = -90; + } + + GlStateManager.rotate((float)j, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(-0.5F, -0.5F, -0.5F); + float f = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * partialTicks; + f = 1.0F - f; + f = 1.0F - f * f * f; + this.field_147521_c.chestLid.rotateAngleX = -(f * (float)Math.PI / 2.0F); + this.field_147521_c.renderAll(); + GlStateManager.disableRescaleNormal(); + GlStateManager.popMatrix(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + + if (destroyStage >= 0) + { + GlStateManager.matrixMode(5890); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5888); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java new file mode 100644 index 0000000..a771e44 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java @@ -0,0 +1,84 @@ +package net.minecraft.client.renderer.tileentity; + +import com.mojang.authlib.GameProfile; +import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.tileentity.TileEntityBanner; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.tileentity.TileEntityEnderChest; +import net.minecraft.tileentity.TileEntitySkull; +import net.minecraft.util.EnumFacing; + +public class TileEntityItemStackRenderer +{ + public static TileEntityItemStackRenderer instance = new TileEntityItemStackRenderer(); + private TileEntityChest field_147717_b = new TileEntityChest(0); + private TileEntityChest field_147718_c = new TileEntityChest(1); + private TileEntityEnderChest enderChest = new TileEntityEnderChest(); + private TileEntityBanner banner = new TileEntityBanner(); + private TileEntitySkull skull = new TileEntitySkull(); + + public void renderByItem(ItemStack itemStackIn) + { + if (itemStackIn.getItem() == Items.banner) + { + this.banner.setItemValues(itemStackIn); + TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F); + } + else if (itemStackIn.getItem() == Items.skull) + { + GameProfile gameprofile = null; + + if (itemStackIn.hasTagCompound()) + { + NBTTagCompound nbttagcompound = itemStackIn.getTagCompound(); + + if (nbttagcompound.hasKey("SkullOwner", 10)) + { + gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner")); + } + else if (nbttagcompound.hasKey("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) + { + gameprofile = new GameProfile((UUID)null, nbttagcompound.getString("SkullOwner")); + gameprofile = TileEntitySkull.updateGameprofile(gameprofile); + nbttagcompound.removeTag("SkullOwner"); + nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile)); + } + } + + if (TileEntitySkullRenderer.instance != null) + { + GlStateManager.pushMatrix(); + GlStateManager.translate(-0.5F, 0.0F, -0.5F); + GlStateManager.scale(2.0F, 2.0F, 2.0F); + GlStateManager.disableCull(); + TileEntitySkullRenderer.instance.renderSkull(0.0F, 0.0F, 0.0F, EnumFacing.UP, 0.0F, itemStackIn.getMetadata(), gameprofile, -1); + GlStateManager.enableCull(); + GlStateManager.popMatrix(); + } + } + else + { + Block block = Block.getBlockFromItem(itemStackIn.getItem()); + + if (block == Blocks.ender_chest) + { + TileEntityRendererDispatcher.instance.renderTileEntityAt(this.enderChest, 0.0D, 0.0D, 0.0D, 0.0F); + } + else if (block == Blocks.trapped_chest) + { + TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147718_c, 0.0D, 0.0D, 0.0D, 0.0F); + } + else + { + TileEntityRendererDispatcher.instance.renderTileEntityAt(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityMobSpawnerRenderer.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityMobSpawnerRenderer.java new file mode 100644 index 0000000..a65f004 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityMobSpawnerRenderer.java @@ -0,0 +1,38 @@ +package net.minecraft.client.renderer.tileentity; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.tileentity.MobSpawnerBaseLogic; +import net.minecraft.tileentity.TileEntityMobSpawner; + +public class TileEntityMobSpawnerRenderer extends TileEntitySpecialRenderer +{ + public void renderTileEntityAt(TileEntityMobSpawner te, double x, double y, double z, float partialTicks, int destroyStage) + { + GlStateManager.pushMatrix(); + GlStateManager.translate((float)x + 0.5F, (float)y, (float)z + 0.5F); + renderMob(te.getSpawnerBaseLogic(), x, y, z, partialTicks); + GlStateManager.popMatrix(); + } + + /** + * Render the mob inside the mob spawner. + */ + public static void renderMob(MobSpawnerBaseLogic mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks) + { + Entity entity = mobSpawnerLogic.func_180612_a(mobSpawnerLogic.getSpawnerWorld()); + + if (entity != null) + { + float f = 0.4375F; + GlStateManager.translate(0.0F, 0.4F, 0.0F); + GlStateManager.rotate((float)(mobSpawnerLogic.getPrevMobRotation() + (mobSpawnerLogic.getMobRotation() - mobSpawnerLogic.getPrevMobRotation()) * (double)partialTicks) * 10.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-30.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(0.0F, -0.4F, 0.0F); + GlStateManager.scale(f, f, f); + entity.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F); + Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java new file mode 100644 index 0000000..9a397af --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java @@ -0,0 +1,79 @@ +package net.minecraft.client.renderer.tileentity; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.BlockPistonExtension; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntityPiston; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class TileEntityPistonRenderer extends TileEntitySpecialRenderer +{ + private final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); + + public void renderTileEntityAt(TileEntityPiston te, double x, double y, double z, float partialTicks, int destroyStage) + { + BlockPos blockpos = te.getPos(); + IBlockState iblockstate = te.getPistonState(); + Block block = iblockstate.getBlock(); + + if (block.getMaterial() != Material.air && te.getProgress(partialTicks) < 1.0F) + { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + this.bindTexture(TextureMap.locationBlocksTexture); + RenderHelper.disableStandardItemLighting(); + GlStateManager.blendFunc(770, 771); + GlStateManager.enableBlend(); + GlStateManager.disableCull(); + + if (Minecraft.isAmbientOcclusionEnabled()) + { + GlStateManager.shadeModel(7425); + } + else + { + GlStateManager.shadeModel(7424); + } + + worldrenderer.begin(7, DefaultVertexFormats.BLOCK); + worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX() + te.getOffsetX(partialTicks)), (double)((float)y - (float)blockpos.getY() + te.getOffsetY(partialTicks)), (double)((float)z - (float)blockpos.getZ() + te.getOffsetZ(partialTicks))); + World world = this.getWorld(); + + if (block == Blocks.piston_head && te.getProgress(partialTicks) < 0.5F) + { + iblockstate = iblockstate.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(true)); + this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true); + } + else if (te.shouldPistonHeadBeRendered() && !te.isExtending()) + { + BlockPistonExtension.EnumPistonType blockpistonextension$enumpistontype = block == Blocks.sticky_piston ? BlockPistonExtension.EnumPistonType.STICKY : BlockPistonExtension.EnumPistonType.DEFAULT; + IBlockState iblockstate1 = Blocks.piston_head.getDefaultState().withProperty(BlockPistonExtension.TYPE, blockpistonextension$enumpistontype).withProperty(BlockPistonExtension.FACING, iblockstate.getValue(BlockPistonBase.FACING)); + iblockstate1 = iblockstate1.withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(te.getProgress(partialTicks) >= 0.5F)); + this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate1, world, blockpos), iblockstate1, blockpos, worldrenderer, true); + worldrenderer.setTranslation((double)((float)x - (float)blockpos.getX()), (double)((float)y - (float)blockpos.getY()), (double)((float)z - (float)blockpos.getZ())); + iblockstate.withProperty(BlockPistonBase.EXTENDED, Boolean.valueOf(true)); + this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, true); + } + else + { + this.blockRenderer.getBlockModelRenderer().renderModel(world, this.blockRenderer.getModelFromBlockState(iblockstate, world, blockpos), iblockstate, blockpos, worldrenderer, false); + } + + worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); + tessellator.draw(); + RenderHelper.enableStandardItemLighting(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java new file mode 100644 index 0000000..7d978da --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java @@ -0,0 +1,155 @@ +package net.minecraft.client.renderer.tileentity; + +import com.google.common.collect.Maps; +import java.util.Map; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityBanner; +import net.minecraft.tileentity.TileEntityBeacon; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.tileentity.TileEntityEnchantmentTable; +import net.minecraft.tileentity.TileEntityEndPortal; +import net.minecraft.tileentity.TileEntityEnderChest; +import net.minecraft.tileentity.TileEntityMobSpawner; +import net.minecraft.tileentity.TileEntityPiston; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.tileentity.TileEntitySkull; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ReportedException; +import net.minecraft.world.World; + +public class TileEntityRendererDispatcher +{ + private Map < Class , TileEntitySpecialRenderer > mapSpecialRenderers = Maps. < Class , TileEntitySpecialRenderer > newHashMap(); + public static TileEntityRendererDispatcher instance = new TileEntityRendererDispatcher(); + private FontRenderer fontRenderer; + + /** The player's current X position (same as playerX) */ + public static double staticPlayerX; + + /** The player's current Y position (same as playerY) */ + public static double staticPlayerY; + + /** The player's current Z position (same as playerZ) */ + public static double staticPlayerZ; + public TextureManager renderEngine; + public World worldObj; + public Entity entity; + public float entityYaw; + public float entityPitch; + public double entityX; + public double entityY; + public double entityZ; + + private TileEntityRendererDispatcher() + { + this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer()); + this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); + this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer()); + this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer()); + this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); + this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer()); + this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer()); + this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); + this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer()); + this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer()); + + for (TileEntitySpecialRenderer tileentityspecialrenderer : this.mapSpecialRenderers.values()) + { + tileentityspecialrenderer.setRendererDispatcher(this); + } + } + + public TileEntitySpecialRenderer getSpecialRendererByClass(Class teClass) + { + TileEntitySpecialRenderer tileentityspecialrenderer = (TileEntitySpecialRenderer)this.mapSpecialRenderers.get(teClass); + + if (tileentityspecialrenderer == null && teClass != TileEntity.class) + { + tileentityspecialrenderer = this.getSpecialRendererByClass((Class )teClass.getSuperclass()); + this.mapSpecialRenderers.put(teClass, tileentityspecialrenderer); + } + + return (TileEntitySpecialRenderer)tileentityspecialrenderer; + } + + public TileEntitySpecialRenderer getSpecialRenderer(TileEntity tileEntityIn) + { + return (TileEntitySpecialRenderer)(tileEntityIn == null ? null : this.getSpecialRendererByClass(tileEntityIn.getClass())); + } + + public void cacheActiveRenderInfo(World worldIn, TextureManager textureManagerIn, FontRenderer fontrendererIn, Entity entityIn, float partialTicks) + { + if (this.worldObj != worldIn) + { + this.setWorld(worldIn); + } + + this.renderEngine = textureManagerIn; + this.entity = entityIn; + this.fontRenderer = fontrendererIn; + this.entityYaw = entityIn.prevRotationYaw + (entityIn.rotationYaw - entityIn.prevRotationYaw) * partialTicks; + this.entityPitch = entityIn.prevRotationPitch + (entityIn.rotationPitch - entityIn.prevRotationPitch) * partialTicks; + this.entityX = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; + this.entityY = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; + this.entityZ = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; + } + + public void renderTileEntity(TileEntity tileentityIn, float partialTicks, int destroyStage) + { + if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) + { + int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + BlockPos blockpos = tileentityIn.getPos(); + this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); + } + } + + /** + * Render this TileEntity at a given set of coordinates + */ + public void renderTileEntityAt(TileEntity tileEntityIn, double x, double y, double z, float partialTicks) + { + this.renderTileEntityAt(tileEntityIn, x, y, z, partialTicks, -1); + } + + public void renderTileEntityAt(TileEntity tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) + { + TileEntitySpecialRenderer tileentityspecialrenderer = this.getSpecialRenderer(tileEntityIn); + + if (tileentityspecialrenderer != null) + { + try + { + tileentityspecialrenderer.renderTileEntityAt(tileEntityIn, x, y, z, partialTicks, destroyStage); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering Block Entity"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Block Entity Details"); + tileEntityIn.addInfoToCrashReport(crashreportcategory); + throw new ReportedException(crashreport); + } + } + } + + public void setWorld(World worldIn) + { + this.worldObj = worldIn; + } + + public FontRenderer getFontRenderer() + { + return this.fontRenderer; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySignRenderer.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySignRenderer.java new file mode 100644 index 0000000..13f0427 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySignRenderer.java @@ -0,0 +1,137 @@ +package net.minecraft.client.renderer.tileentity; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiUtilRenderComponents; +import net.minecraft.client.model.ModelSign; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ResourceLocation; +import optifine.Config; +import optifine.CustomColors; + +import org.lwjgl.opengl.GL11; + +public class TileEntitySignRenderer extends TileEntitySpecialRenderer +{ + private static final ResourceLocation SIGN_TEXTURE = new ResourceLocation("textures/entity/sign.png"); + + /** The ModelSign instance for use in this renderer */ + private final ModelSign model = new ModelSign(); + private static final String __OBFID = "CL_00000970"; + + public void renderTileEntityAt(TileEntitySign te, double x, double y, double z, float partialTicks, int destroyStage) + { + Block block = te.getBlockType(); + GlStateManager.pushMatrix(); + float f = 0.6666667F; + + if (block == Blocks.standing_sign) + { + GlStateManager.translate((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F); + float f2 = (float)(te.getBlockMetadata() * 360) / 16.0F; + GlStateManager.rotate(-f2, 0.0F, 1.0F, 0.0F); + this.model.signStick.showModel = true; + } + else + { + int k = te.getBlockMetadata(); + float f1 = 0.0F; + + if (k == 2) + { + f1 = 180.0F; + } + + if (k == 4) + { + f1 = 90.0F; + } + + if (k == 5) + { + f1 = -90.0F; + } + + GlStateManager.translate((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F); + GlStateManager.rotate(-f1, 0.0F, 1.0F, 0.0F); + GlStateManager.translate(0.0F, -0.3125F, -0.4375F); + this.model.signStick.showModel = false; + } + + if (destroyStage >= 0) + { + this.bindTexture(DESTROY_STAGES[destroyStage]); + GlStateManager.matrixMode(5890); + GlStateManager.pushMatrix(); + GlStateManager.scale(4.0F, 2.0F, 1.0F); + GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); + GlStateManager.matrixMode(5888); + } + else + { + this.bindTexture(SIGN_TEXTURE); + } + + GlStateManager.enableRescaleNormal(); + GlStateManager.pushMatrix(); + GlStateManager.scale(f, -f, -f); + this.model.renderSign(); + GlStateManager.popMatrix(); + FontRenderer fontrenderer = this.getFontRenderer(); + float f3 = 0.015625F * f; + GlStateManager.translate(0.0F, 0.5F * f, 0.07F * f); + GlStateManager.scale(f3, -f3, f3); + GL11.glNormal3f(0.0F, 0.0F, -1.0F * f3); + GlStateManager.depthMask(false); + int i = 0; + + if (Config.isCustomColors()) + { + i = CustomColors.getSignTextColor(i); + } + + if (destroyStage < 0) + { + for (int j = 0; j < te.signText.length; ++j) + { + if (te.signText[j] != null) + { + IChatComponent ichatcomponent = te.signText[j]; + List list = GuiUtilRenderComponents.func_178908_a(ichatcomponent, 90, fontrenderer, false, true); + String s = list != null && list.size() > 0 ? ((IChatComponent)list.get(0)).getFormattedText() : ""; + + if (j == te.lineBeingEdited) + { + s = "> " + s + " <"; + fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, j * 10 - te.signText.length * 5, i); + } + else + { + fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, j * 10 - te.signText.length * 5, i); + } + } + } + } + + GlStateManager.depthMask(true); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + + if (destroyStage >= 0) + { + GlStateManager.matrixMode(5890); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5888); + } + } + + public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTicks, int destroyStage) + { + this.renderTileEntityAt((TileEntitySign)te, x, y, z, partialTicks, destroyStage); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySkullRenderer.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySkullRenderer.java new file mode 100644 index 0000000..7173be4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySkullRenderer.java @@ -0,0 +1,147 @@ +package net.minecraft.client.renderer.tileentity; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; +import java.util.Map; +import java.util.UUID; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelHumanoidHead; +import net.minecraft.client.model.ModelSkeletonHead; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.DefaultPlayerSkin; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntitySkull; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; + +public class TileEntitySkullRenderer extends TileEntitySpecialRenderer +{ + private static final ResourceLocation SKELETON_TEXTURES = new ResourceLocation("textures/entity/skeleton/skeleton.png"); + private static final ResourceLocation WITHER_SKELETON_TEXTURES = new ResourceLocation("textures/entity/skeleton/wither_skeleton.png"); + private static final ResourceLocation ZOMBIE_TEXTURES = new ResourceLocation("textures/entity/zombie/zombie.png"); + private static final ResourceLocation CREEPER_TEXTURES = new ResourceLocation("textures/entity/creeper/creeper.png"); + public static TileEntitySkullRenderer instance; + private final ModelSkeletonHead skeletonHead = new ModelSkeletonHead(0, 0, 64, 32); + private final ModelSkeletonHead humanoidHead = new ModelHumanoidHead(); + + public void renderTileEntityAt(TileEntitySkull te, double x, double y, double z, float partialTicks, int destroyStage) + { + EnumFacing enumfacing = EnumFacing.getFront(te.getBlockMetadata() & 7); + this.renderSkull((float)x, (float)y, (float)z, enumfacing, (float)(te.getSkullRotation() * 360) / 16.0F, te.getSkullType(), te.getPlayerProfile(), destroyStage); + } + + public void setRendererDispatcher(TileEntityRendererDispatcher rendererDispatcherIn) + { + super.setRendererDispatcher(rendererDispatcherIn); + instance = this; + } + + public void renderSkull(float p_180543_1_, float p_180543_2_, float p_180543_3_, EnumFacing p_180543_4_, float p_180543_5_, int p_180543_6_, GameProfile p_180543_7_, int p_180543_8_) + { + ModelBase modelbase = this.skeletonHead; + + if (p_180543_8_ >= 0) + { + this.bindTexture(DESTROY_STAGES[p_180543_8_]); + GlStateManager.matrixMode(5890); + GlStateManager.pushMatrix(); + GlStateManager.scale(4.0F, 2.0F, 1.0F); + GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); + GlStateManager.matrixMode(5888); + } + else + { + switch (p_180543_6_) + { + case 0: + default: + this.bindTexture(SKELETON_TEXTURES); + break; + + case 1: + this.bindTexture(WITHER_SKELETON_TEXTURES); + break; + + case 2: + this.bindTexture(ZOMBIE_TEXTURES); + modelbase = this.humanoidHead; + break; + + case 3: + modelbase = this.humanoidHead; + ResourceLocation resourcelocation = DefaultPlayerSkin.getDefaultSkinLegacy(); + + if (p_180543_7_ != null) + { + Minecraft minecraft = Minecraft.getMinecraft(); + Map map = minecraft.getSkinManager().loadSkinFromCache(p_180543_7_); + + if (map.containsKey(Type.SKIN)) + { + resourcelocation = minecraft.getSkinManager().loadSkin((MinecraftProfileTexture)map.get(Type.SKIN), Type.SKIN); + } + else + { + UUID uuid = EntityPlayer.getUUID(p_180543_7_); + resourcelocation = DefaultPlayerSkin.getDefaultSkin(uuid); + } + } + + this.bindTexture(resourcelocation); + break; + + case 4: + this.bindTexture(CREEPER_TEXTURES); + } + } + + GlStateManager.pushMatrix(); + GlStateManager.disableCull(); + + if (p_180543_4_ != EnumFacing.UP) + { + switch (p_180543_4_) + { + case NORTH: + GlStateManager.translate(p_180543_1_ + 0.5F, p_180543_2_ + 0.25F, p_180543_3_ + 0.74F); + break; + + case SOUTH: + GlStateManager.translate(p_180543_1_ + 0.5F, p_180543_2_ + 0.25F, p_180543_3_ + 0.26F); + p_180543_5_ = 180.0F; + break; + + case WEST: + GlStateManager.translate(p_180543_1_ + 0.74F, p_180543_2_ + 0.25F, p_180543_3_ + 0.5F); + p_180543_5_ = 270.0F; + break; + + case EAST: + default: + GlStateManager.translate(p_180543_1_ + 0.26F, p_180543_2_ + 0.25F, p_180543_3_ + 0.5F); + p_180543_5_ = 90.0F; + } + } + else + { + GlStateManager.translate(p_180543_1_ + 0.5F, p_180543_2_, p_180543_3_ + 0.5F); + } + + float f = 0.0625F; + GlStateManager.enableRescaleNormal(); + GlStateManager.scale(-1.0F, -1.0F, 1.0F); + GlStateManager.enableAlpha(); + modelbase.render((Entity)null, 0.0F, 0.0F, 0.0F, p_180543_5_, 0.0F, f); + GlStateManager.popMatrix(); + + if (p_180543_8_ >= 0) + { + GlStateManager.matrixMode(5890); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5888); + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java new file mode 100644 index 0000000..bdbbed4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java @@ -0,0 +1,45 @@ +package net.minecraft.client.renderer.tileentity; + +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public abstract class TileEntitySpecialRenderer +{ + protected static final ResourceLocation[] DESTROY_STAGES = new ResourceLocation[] {new ResourceLocation("textures/blocks/destroy_stage_0.png"), new ResourceLocation("textures/blocks/destroy_stage_1.png"), new ResourceLocation("textures/blocks/destroy_stage_2.png"), new ResourceLocation("textures/blocks/destroy_stage_3.png"), new ResourceLocation("textures/blocks/destroy_stage_4.png"), new ResourceLocation("textures/blocks/destroy_stage_5.png"), new ResourceLocation("textures/blocks/destroy_stage_6.png"), new ResourceLocation("textures/blocks/destroy_stage_7.png"), new ResourceLocation("textures/blocks/destroy_stage_8.png"), new ResourceLocation("textures/blocks/destroy_stage_9.png")}; + protected TileEntityRendererDispatcher rendererDispatcher; + + public abstract void renderTileEntityAt(T te, double x, double y, double z, float partialTicks, int destroyStage); + + protected void bindTexture(ResourceLocation location) + { + TextureManager texturemanager = this.rendererDispatcher.renderEngine; + + if (texturemanager != null) + { + texturemanager.bindTexture(location); + } + } + + protected World getWorld() + { + return this.rendererDispatcher.worldObj; + } + + public void setRendererDispatcher(TileEntityRendererDispatcher rendererDispatcherIn) + { + this.rendererDispatcher = rendererDispatcherIn; + } + + public FontRenderer getFontRenderer() + { + return this.rendererDispatcher.getFontRenderer(); + } + + public boolean func_181055_a() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/vertex/DefaultVertexFormats.java b/src/minecraft/net/minecraft/client/renderer/vertex/DefaultVertexFormats.java new file mode 100644 index 0000000..e26ca66 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/vertex/DefaultVertexFormats.java @@ -0,0 +1,102 @@ +package net.minecraft.client.renderer.vertex; + +import optifine.Config; +import optifine.Reflector; +import shadersmod.client.SVertexFormat; + +public class DefaultVertexFormats +{ + public static VertexFormat BLOCK = new VertexFormat(); + public static VertexFormat ITEM = new VertexFormat(); + private static final VertexFormat BLOCK_VANILLA = BLOCK; + private static final VertexFormat ITEM_VANILLA = ITEM; + public static final VertexFormat OLDMODEL_POSITION_TEX_NORMAL = new VertexFormat(); + public static final VertexFormat PARTICLE_POSITION_TEX_COLOR_LMAP = new VertexFormat(); + public static final VertexFormat POSITION = new VertexFormat(); + public static final VertexFormat POSITION_COLOR = new VertexFormat(); + public static final VertexFormat POSITION_TEX = new VertexFormat(); + public static final VertexFormat POSITION_NORMAL = new VertexFormat(); + public static final VertexFormat POSITION_TEX_COLOR = new VertexFormat(); + public static final VertexFormat POSITION_TEX_NORMAL = new VertexFormat(); + public static final VertexFormat POSITION_TEX_LMAP_COLOR = new VertexFormat(); + public static final VertexFormat POSITION_TEX_COLOR_NORMAL = new VertexFormat(); + public static final VertexFormatElement POSITION_3F = new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3); + public static final VertexFormatElement COLOR_4UB = new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4); + public static final VertexFormatElement TEX_2F = new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2); + public static final VertexFormatElement TEX_2S = new VertexFormatElement(1, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.UV, 2); + public static final VertexFormatElement NORMAL_3B = new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3); + public static final VertexFormatElement PADDING_1B = new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1); + private static final String __OBFID = "CL_00002403"; + public static final VertexFormat field_181706_f = new VertexFormat(); + + public static void updateVertexFormats() + { + if (Config.isShaders()) + { + BLOCK = SVertexFormat.makeDefVertexFormatBlock(); + ITEM = SVertexFormat.makeDefVertexFormatItem(); + } + else + { + BLOCK = BLOCK_VANILLA; + ITEM = ITEM_VANILLA; + } + + if (Reflector.Attributes_DEFAULT_BAKED_FORMAT.exists()) + { + VertexFormat vertexformat = ITEM; + VertexFormat vertexformat1 = (VertexFormat)Reflector.getFieldValue(Reflector.Attributes_DEFAULT_BAKED_FORMAT); + vertexformat1.clear(); + + for (int i = 0; i < vertexformat.getElementCount(); ++i) + { + vertexformat1.func_181721_a(vertexformat.getElement(i)); + } + } + } + + static + { + BLOCK.func_181721_a(POSITION_3F); + BLOCK.func_181721_a(COLOR_4UB); + BLOCK.func_181721_a(TEX_2F); + BLOCK.func_181721_a(TEX_2S); + ITEM.func_181721_a(POSITION_3F); + ITEM.func_181721_a(COLOR_4UB); + ITEM.func_181721_a(TEX_2F); + ITEM.func_181721_a(NORMAL_3B); + ITEM.func_181721_a(PADDING_1B); + OLDMODEL_POSITION_TEX_NORMAL.func_181721_a(POSITION_3F); + OLDMODEL_POSITION_TEX_NORMAL.func_181721_a(TEX_2F); + OLDMODEL_POSITION_TEX_NORMAL.func_181721_a(NORMAL_3B); + OLDMODEL_POSITION_TEX_NORMAL.func_181721_a(PADDING_1B); + PARTICLE_POSITION_TEX_COLOR_LMAP.func_181721_a(POSITION_3F); + PARTICLE_POSITION_TEX_COLOR_LMAP.func_181721_a(TEX_2F); + PARTICLE_POSITION_TEX_COLOR_LMAP.func_181721_a(COLOR_4UB); + PARTICLE_POSITION_TEX_COLOR_LMAP.func_181721_a(TEX_2S); + POSITION.func_181721_a(POSITION_3F); + POSITION_COLOR.func_181721_a(POSITION_3F); + POSITION_COLOR.func_181721_a(COLOR_4UB); + POSITION_TEX.func_181721_a(POSITION_3F); + POSITION_TEX.func_181721_a(TEX_2F); + POSITION_NORMAL.func_181721_a(POSITION_3F); + POSITION_NORMAL.func_181721_a(NORMAL_3B); + POSITION_NORMAL.func_181721_a(PADDING_1B); + POSITION_TEX_COLOR.func_181721_a(POSITION_3F); + POSITION_TEX_COLOR.func_181721_a(TEX_2F); + POSITION_TEX_COLOR.func_181721_a(COLOR_4UB); + POSITION_TEX_NORMAL.func_181721_a(POSITION_3F); + POSITION_TEX_NORMAL.func_181721_a(TEX_2F); + POSITION_TEX_NORMAL.func_181721_a(NORMAL_3B); + POSITION_TEX_NORMAL.func_181721_a(PADDING_1B); + POSITION_TEX_LMAP_COLOR.func_181721_a(POSITION_3F); + POSITION_TEX_LMAP_COLOR.func_181721_a(TEX_2F); + POSITION_TEX_LMAP_COLOR.func_181721_a(TEX_2S); + POSITION_TEX_LMAP_COLOR.func_181721_a(COLOR_4UB); + POSITION_TEX_COLOR_NORMAL.func_181721_a(POSITION_3F); + POSITION_TEX_COLOR_NORMAL.func_181721_a(TEX_2F); + POSITION_TEX_COLOR_NORMAL.func_181721_a(COLOR_4UB); + POSITION_TEX_COLOR_NORMAL.func_181721_a(NORMAL_3B); + POSITION_TEX_COLOR_NORMAL.func_181721_a(PADDING_1B); + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/vertex/VertexBuffer.java b/src/minecraft/net/minecraft/client/renderer/vertex/VertexBuffer.java new file mode 100644 index 0000000..81731af --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/vertex/VertexBuffer.java @@ -0,0 +1,50 @@ +package net.minecraft.client.renderer.vertex; + +import java.nio.ByteBuffer; +import net.minecraft.client.renderer.OpenGlHelper; +import org.lwjgl.opengl.GL11; + +public class VertexBuffer +{ + private int glBufferId; + private final VertexFormat vertexFormat; + private int count; + + public VertexBuffer(VertexFormat vertexFormatIn) + { + this.vertexFormat = vertexFormatIn; + this.glBufferId = OpenGlHelper.glGenBuffers(); + } + + public void bindBuffer() + { + OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, this.glBufferId); + } + + public void func_181722_a(ByteBuffer p_181722_1_) + { + this.bindBuffer(); + OpenGlHelper.glBufferData(OpenGlHelper.GL_ARRAY_BUFFER, p_181722_1_, 35044); + this.unbindBuffer(); + this.count = p_181722_1_.limit() / this.vertexFormat.getNextOffset(); + } + + public void drawArrays(int mode) + { + GL11.glDrawArrays(mode, 0, this.count); + } + + public void unbindBuffer() + { + OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0); + } + + public void deleteGlBuffers() + { + if (this.glBufferId >= 0) + { + OpenGlHelper.glDeleteBuffers(this.glBufferId); + this.glBufferId = -1; + } + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java b/src/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java new file mode 100644 index 0000000..dcfc854 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java @@ -0,0 +1,202 @@ +package net.minecraft.client.renderer.vertex; + +import com.google.common.collect.Lists; +import java.util.List; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class VertexFormat +{ + private static final Logger LOGGER = LogManager.getLogger(); + private final List elements; + private final List offsets; + + /** The next available offset in this vertex format */ + private int nextOffset; + private int colorElementOffset; + private List uvOffsetsById; + private int normalElementOffset; + + public VertexFormat(VertexFormat vertexFormatIn) + { + this(); + + for (int i = 0; i < vertexFormatIn.getElementCount(); ++i) + { + this.func_181721_a(vertexFormatIn.getElement(i)); + } + + this.nextOffset = vertexFormatIn.getNextOffset(); + } + + public VertexFormat() + { + this.elements = Lists.newArrayList(); + this.offsets = Lists.newArrayList(); + this.nextOffset = 0; + this.colorElementOffset = -1; + this.uvOffsetsById = Lists.newArrayList(); + this.normalElementOffset = -1; + } + + public void clear() + { + this.elements.clear(); + this.offsets.clear(); + this.colorElementOffset = -1; + this.uvOffsetsById.clear(); + this.normalElementOffset = -1; + this.nextOffset = 0; + } + + @SuppressWarnings("incomplete-switch") + public VertexFormat func_181721_a(VertexFormatElement p_181721_1_) + { + if (p_181721_1_.isPositionElement() && this.hasPosition()) + { + LOGGER.warn("VertexFormat error: Trying to add a position VertexFormatElement when one already exists, ignoring."); + return this; + } + else + { + this.elements.add(p_181721_1_); + this.offsets.add(Integer.valueOf(this.nextOffset)); + + switch (p_181721_1_.getUsage()) + { + case NORMAL: + this.normalElementOffset = this.nextOffset; + break; + + case COLOR: + this.colorElementOffset = this.nextOffset; + break; + + case UV: + this.uvOffsetsById.add(p_181721_1_.getIndex(), Integer.valueOf(this.nextOffset)); + } + + this.nextOffset += p_181721_1_.getSize(); + return this; + } + } + + public boolean hasNormal() + { + return this.normalElementOffset >= 0; + } + + public int getNormalOffset() + { + return this.normalElementOffset; + } + + public boolean hasColor() + { + return this.colorElementOffset >= 0; + } + + public int getColorOffset() + { + return this.colorElementOffset; + } + + public boolean hasUvOffset(int id) + { + return this.uvOffsetsById.size() - 1 >= id; + } + + public int getUvOffsetById(int id) + { + return ((Integer)this.uvOffsetsById.get(id)).intValue(); + } + + public String toString() + { + String s = "format: " + this.elements.size() + " elements: "; + + for (int i = 0; i < this.elements.size(); ++i) + { + s = s + ((VertexFormatElement)this.elements.get(i)).toString(); + + if (i != this.elements.size() - 1) + { + s = s + " "; + } + } + + return s; + } + + private boolean hasPosition() + { + int i = 0; + + for (int j = this.elements.size(); i < j; ++i) + { + VertexFormatElement vertexformatelement = (VertexFormatElement)this.elements.get(i); + + if (vertexformatelement.isPositionElement()) + { + return true; + } + } + + return false; + } + + public int func_181719_f() + { + return this.getNextOffset() / 4; + } + + public int getNextOffset() + { + return this.nextOffset; + } + + public List getElements() + { + return this.elements; + } + + public int getElementCount() + { + return this.elements.size(); + } + + public VertexFormatElement getElement(int index) + { + return (VertexFormatElement)this.elements.get(index); + } + + public int func_181720_d(int p_181720_1_) + { + return ((Integer)this.offsets.get(p_181720_1_)).intValue(); + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) + { + VertexFormat vertexformat = (VertexFormat)p_equals_1_; + return this.nextOffset != vertexformat.nextOffset ? false : (!this.elements.equals(vertexformat.elements) ? false : this.offsets.equals(vertexformat.offsets)); + } + else + { + return false; + } + } + + public int hashCode() + { + int i = this.elements.hashCode(); + i = 31 * i + this.offsets.hashCode(); + i = 31 * i + this.nextOffset; + return i; + } +} diff --git a/src/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java b/src/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java new file mode 100644 index 0000000..4986be7 --- /dev/null +++ b/src/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java @@ -0,0 +1,156 @@ +package net.minecraft.client.renderer.vertex; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class VertexFormatElement +{ + private static final Logger LOGGER = LogManager.getLogger(); + private final VertexFormatElement.EnumType type; + private final VertexFormatElement.EnumUsage usage; + private int index; + private int elementCount; + + public VertexFormatElement(int indexIn, VertexFormatElement.EnumType typeIn, VertexFormatElement.EnumUsage usageIn, int count) + { + if (!this.func_177372_a(indexIn, usageIn)) + { + LOGGER.warn("Multiple vertex elements of the same type other than UVs are not supported. Forcing type to UV."); + this.usage = VertexFormatElement.EnumUsage.UV; + } + else + { + this.usage = usageIn; + } + + this.type = typeIn; + this.index = indexIn; + this.elementCount = count; + } + + private final boolean func_177372_a(int p_177372_1_, VertexFormatElement.EnumUsage p_177372_2_) + { + return p_177372_1_ == 0 || p_177372_2_ == VertexFormatElement.EnumUsage.UV; + } + + public final VertexFormatElement.EnumType getType() + { + return this.type; + } + + public final VertexFormatElement.EnumUsage getUsage() + { + return this.usage; + } + + public final int getElementCount() + { + return this.elementCount; + } + + public final int getIndex() + { + return this.index; + } + + public String toString() + { + return this.elementCount + "," + this.usage.getDisplayName() + "," + this.type.getDisplayName(); + } + + public final int getSize() + { + return this.type.getSize() * this.elementCount; + } + + public final boolean isPositionElement() + { + return this.usage == VertexFormatElement.EnumUsage.POSITION; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) + { + VertexFormatElement vertexformatelement = (VertexFormatElement)p_equals_1_; + return this.elementCount != vertexformatelement.elementCount ? false : (this.index != vertexformatelement.index ? false : (this.type != vertexformatelement.type ? false : this.usage == vertexformatelement.usage)); + } + else + { + return false; + } + } + + public int hashCode() + { + int i = this.type.hashCode(); + i = 31 * i + this.usage.hashCode(); + i = 31 * i + this.index; + i = 31 * i + this.elementCount; + return i; + } + + public static enum EnumType + { + FLOAT(4, "Float", 5126), + UBYTE(1, "Unsigned Byte", 5121), + BYTE(1, "Byte", 5120), + USHORT(2, "Unsigned Short", 5123), + SHORT(2, "Short", 5122), + UINT(4, "Unsigned Int", 5125), + INT(4, "Int", 5124); + + private final int size; + private final String displayName; + private final int glConstant; + + private EnumType(int sizeIn, String displayNameIn, int glConstantIn) + { + this.size = sizeIn; + this.displayName = displayNameIn; + this.glConstant = glConstantIn; + } + + public int getSize() + { + return this.size; + } + + public String getDisplayName() + { + return this.displayName; + } + + public int getGlConstant() + { + return this.glConstant; + } + } + + public static enum EnumUsage + { + POSITION("Position"), + NORMAL("Normal"), + COLOR("Vertex Color"), + UV("UV"), + MATRIX("Bone Matrix"), + BLEND_WEIGHT("Blend Weight"), + PADDING("Padding"); + + private final String displayName; + + private EnumUsage(String displayNameIn) + { + this.displayName = displayNameIn; + } + + public String getDisplayName() + { + return this.displayName; + } + } +} diff --git a/src/minecraft/net/minecraft/client/resources/AbstractResourcePack.java b/src/minecraft/net/minecraft/client/resources/AbstractResourcePack.java new file mode 100644 index 0000000..dcffe43 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/AbstractResourcePack.java @@ -0,0 +1,98 @@ +package net.minecraft.client.resources; + +import com.google.common.base.Charsets; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonParser; +import java.awt.image.BufferedImage; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.resources.data.IMetadataSection; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public abstract class AbstractResourcePack implements IResourcePack +{ + private static final Logger resourceLog = LogManager.getLogger(); + public final File resourcePackFile; + private static final String __OBFID = "CL_00001072"; + + public AbstractResourcePack(File resourcePackFileIn) + { + this.resourcePackFile = resourcePackFileIn; + } + + private static String locationToName(ResourceLocation location) + { + return String.format("%s/%s/%s", new Object[] {"assets", location.getResourceDomain(), location.getResourcePath()}); + } + + protected static String getRelativeName(File p_110595_0_, File p_110595_1_) + { + return p_110595_0_.toURI().relativize(p_110595_1_.toURI()).getPath(); + } + + public InputStream getInputStream(ResourceLocation location) throws IOException + { + return this.getInputStreamByName(locationToName(location)); + } + + public boolean resourceExists(ResourceLocation location) + { + return this.hasResourceName(locationToName(location)); + } + + protected abstract InputStream getInputStreamByName(String name) throws IOException; + + protected abstract boolean hasResourceName(String name); + + protected void logNameNotLowercase(String p_110594_1_) + { + resourceLog.warn("ResourcePack: ignored non-lowercase namespace: {} in {}", new Object[] {p_110594_1_, this.resourcePackFile}); + } + + public IMetadataSection getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException + { + return readMetadata(p_135058_1_, this.getInputStreamByName("pack.mcmeta"), p_135058_2_); + } + + public static IMetadataSection readMetadata(IMetadataSerializer p_110596_0_, InputStream p_110596_1_, String p_110596_2_) + { + JsonObject jsonobject = null; + BufferedReader bufferedreader = null; + + try + { + bufferedreader = new BufferedReader(new InputStreamReader(p_110596_1_, Charsets.UTF_8)); + jsonobject = (new JsonParser()).parse((Reader)bufferedreader).getAsJsonObject(); + } + catch (RuntimeException runtimeexception) + { + throw new JsonParseException(runtimeexception); + } + finally + { + IOUtils.closeQuietly((Reader)bufferedreader); + } + + return p_110596_0_.parseMetadataSection(p_110596_2_, jsonobject); + } + + public BufferedImage getPackImage() throws IOException + { + return TextureUtil.readBufferedImage(this.getInputStreamByName("pack.png")); + } + + public String getPackName() + { + return this.resourcePackFile.getName(); + } +} diff --git a/src/minecraft/net/minecraft/client/resources/DefaultPlayerSkin.java b/src/minecraft/net/minecraft/client/resources/DefaultPlayerSkin.java new file mode 100644 index 0000000..3c2f8a0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/DefaultPlayerSkin.java @@ -0,0 +1,45 @@ +package net.minecraft.client.resources; + +import java.util.UUID; +import net.minecraft.util.ResourceLocation; + +public class DefaultPlayerSkin +{ + /** The default skin for the Steve model. */ + private static final ResourceLocation TEXTURE_STEVE = new ResourceLocation("textures/entity/steve.png"); + + /** The default skin for the Alex model. */ + private static final ResourceLocation TEXTURE_ALEX = new ResourceLocation("textures/entity/alex.png"); + + /** + * Returns the default skind for versions prior to 1.8, which is always the Steve texture. + */ + public static ResourceLocation getDefaultSkinLegacy() + { + return TEXTURE_STEVE; + } + + /** + * Retrieves the default skin for this player. Depending on the model used this will be Alex or Steve. + */ + public static ResourceLocation getDefaultSkin(UUID playerUUID) + { + return isSlimSkin(playerUUID) ? TEXTURE_ALEX : TEXTURE_STEVE; + } + + /** + * Retrieves the type of skin that a player is using. The Alex model is slim while the Steve model is default. + */ + public static String getSkinType(UUID playerUUID) + { + return isSlimSkin(playerUUID) ? "slim" : "default"; + } + + /** + * Checks if a players skin model is slim or the default. The Alex model is slime while the Steve model is default. + */ + private static boolean isSlimSkin(UUID playerUUID) + { + return (playerUUID.hashCode() & 1) == 1; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/DefaultResourcePack.java b/src/minecraft/net/minecraft/client/resources/DefaultResourcePack.java new file mode 100644 index 0000000..0fb4a20 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/DefaultResourcePack.java @@ -0,0 +1,101 @@ +package net.minecraft.client.resources; + +import com.google.common.collect.ImmutableSet; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; +import java.util.Set; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.resources.data.IMetadataSection; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.util.ResourceLocation; +import optifine.ReflectorForge; + +public class DefaultResourcePack implements IResourcePack +{ + public static final Set defaultResourceDomains = ImmutableSet.of("minecraft", "realms"); + private final Map mapAssets; + private static final String __OBFID = "CL_00001073"; + + public DefaultResourcePack(Map mapAssetsIn) + { + this.mapAssets = mapAssetsIn; + } + + public InputStream getInputStream(ResourceLocation location) throws IOException + { + InputStream inputstream = this.getResourceStream(location); + + if (inputstream != null) + { + return inputstream; + } + else + { + InputStream inputstream1 = this.getInputStreamAssets(location); + + if (inputstream1 != null) + { + return inputstream1; + } + else + { + throw new FileNotFoundException(location.getResourcePath()); + } + } + } + + public InputStream getInputStreamAssets(ResourceLocation location) throws IOException, FileNotFoundException + { + File file1 = (File)this.mapAssets.get(location.toString()); + return file1 != null && file1.isFile() ? new FileInputStream(file1) : null; + } + + private InputStream getResourceStream(ResourceLocation location) + { + String s = "/assets/" + location.getResourceDomain() + "/" + location.getResourcePath(); + InputStream inputstream = ReflectorForge.getOptiFineResourceStream(s); + return inputstream != null ? inputstream : DefaultResourcePack.class.getResourceAsStream("/assets/" + location.getResourceDomain() + "/" + location.getResourcePath()); + } + + public boolean resourceExists(ResourceLocation location) + { + return this.getResourceStream(location) != null || this.mapAssets.containsKey(location.toString()); + } + + public Set getResourceDomains() + { + return defaultResourceDomains; + } + + public IMetadataSection getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException + { + try + { + FileInputStream fileinputstream = new FileInputStream((File)this.mapAssets.get("pack.mcmeta")); + return AbstractResourcePack.readMetadata(p_135058_1_, fileinputstream, p_135058_2_); + } + catch (RuntimeException var4) + { + return null; + } + catch (FileNotFoundException var5) + { + return null; + } + } + + public BufferedImage getPackImage() throws IOException + { + return TextureUtil.readBufferedImage(DefaultResourcePack.class.getResourceAsStream("/" + (new ResourceLocation("pack.png")).getResourcePath())); + } + + public String getPackName() + { + return "Default"; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/FallbackResourceManager.java b/src/minecraft/net/minecraft/client/resources/FallbackResourceManager.java new file mode 100644 index 0000000..725032d --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/FallbackResourceManager.java @@ -0,0 +1,137 @@ +package net.minecraft.client.resources; + +import com.google.common.collect.Lists; +import java.io.ByteArrayOutputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintStream; +import java.util.List; +import java.util.Set; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.util.ResourceLocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class FallbackResourceManager implements IResourceManager +{ + private static final Logger logger = LogManager.getLogger(); + protected final List resourcePacks = Lists.newArrayList(); + private final IMetadataSerializer frmMetadataSerializer; + + public FallbackResourceManager(IMetadataSerializer frmMetadataSerializerIn) + { + this.frmMetadataSerializer = frmMetadataSerializerIn; + } + + public void addResourcePack(IResourcePack resourcePack) + { + this.resourcePacks.add(resourcePack); + } + + public Set getResourceDomains() + { + return null; + } + + public IResource getResource(ResourceLocation location) throws IOException + { + IResourcePack iresourcepack = null; + ResourceLocation resourcelocation = getLocationMcmeta(location); + + for (int i = this.resourcePacks.size() - 1; i >= 0; --i) + { + IResourcePack iresourcepack1 = (IResourcePack)this.resourcePacks.get(i); + + if (iresourcepack == null && iresourcepack1.resourceExists(resourcelocation)) + { + iresourcepack = iresourcepack1; + } + + if (iresourcepack1.resourceExists(location)) + { + InputStream inputstream = null; + + if (iresourcepack != null) + { + inputstream = this.getInputStream(resourcelocation, iresourcepack); + } + + return new SimpleResource(iresourcepack1.getPackName(), location, this.getInputStream(location, iresourcepack1), inputstream, this.frmMetadataSerializer); + } + } + + throw new FileNotFoundException(location.toString()); + } + + protected InputStream getInputStream(ResourceLocation location, IResourcePack resourcePack) throws IOException + { + InputStream inputstream = resourcePack.getInputStream(location); + return (InputStream)(logger.isDebugEnabled() ? new FallbackResourceManager.InputStreamLeakedResourceLogger(inputstream, location, resourcePack.getPackName()) : inputstream); + } + + public List getAllResources(ResourceLocation location) throws IOException + { + List list = Lists.newArrayList(); + ResourceLocation resourcelocation = getLocationMcmeta(location); + + for (IResourcePack iresourcepack : this.resourcePacks) + { + if (iresourcepack.resourceExists(location)) + { + InputStream inputstream = iresourcepack.resourceExists(resourcelocation) ? this.getInputStream(resourcelocation, iresourcepack) : null; + list.add(new SimpleResource(iresourcepack.getPackName(), location, this.getInputStream(location, iresourcepack), inputstream, this.frmMetadataSerializer)); + } + } + + if (list.isEmpty()) + { + throw new FileNotFoundException(location.toString()); + } + else + { + return list; + } + } + + static ResourceLocation getLocationMcmeta(ResourceLocation location) + { + return new ResourceLocation(location.getResourceDomain(), location.getResourcePath() + ".mcmeta"); + } + + static class InputStreamLeakedResourceLogger extends InputStream + { + private final InputStream field_177330_a; + private final String field_177328_b; + private boolean field_177329_c = false; + + public InputStreamLeakedResourceLogger(InputStream p_i46093_1_, ResourceLocation location, String p_i46093_3_) + { + this.field_177330_a = p_i46093_1_; + ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); + (new Exception()).printStackTrace(new PrintStream(bytearrayoutputstream)); + this.field_177328_b = "Leaked resource: \'" + location + "\' loaded from pack: \'" + p_i46093_3_ + "\'\n" + bytearrayoutputstream.toString(); + } + + public void close() throws IOException + { + this.field_177330_a.close(); + this.field_177329_c = true; + } + + protected void finalize() throws Throwable + { + if (!this.field_177329_c) + { + FallbackResourceManager.logger.warn(this.field_177328_b); + } + + super.finalize(); + } + + public int read() throws IOException + { + return this.field_177330_a.read(); + } + } +} diff --git a/src/minecraft/net/minecraft/client/resources/FileResourcePack.java b/src/minecraft/net/minecraft/client/resources/FileResourcePack.java new file mode 100644 index 0000000..4c27a4f --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/FileResourcePack.java @@ -0,0 +1,122 @@ +package net.minecraft.client.resources; + +import com.google.common.base.Splitter; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.io.Closeable; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +public class FileResourcePack extends AbstractResourcePack implements Closeable +{ + public static final Splitter entryNameSplitter = Splitter.on('/').omitEmptyStrings().limit(3); + private ZipFile resourcePackZipFile; + + public FileResourcePack(File resourcePackFileIn) + { + super(resourcePackFileIn); + } + + private ZipFile getResourcePackZipFile() throws IOException + { + if (this.resourcePackZipFile == null) + { + this.resourcePackZipFile = new ZipFile(this.resourcePackFile); + } + + return this.resourcePackZipFile; + } + + protected InputStream getInputStreamByName(String name) throws IOException + { + ZipFile zipfile = this.getResourcePackZipFile(); + ZipEntry zipentry = zipfile.getEntry(name); + + if (zipentry == null) + { + throw new ResourcePackFileNotFoundException(this.resourcePackFile, name); + } + else + { + return zipfile.getInputStream(zipentry); + } + } + + public boolean hasResourceName(String name) + { + try + { + return this.getResourcePackZipFile().getEntry(name) != null; + } + catch (IOException var3) + { + return false; + } + } + + public Set getResourceDomains() + { + ZipFile zipfile; + + try + { + zipfile = this.getResourcePackZipFile(); + } + catch (IOException var8) + { + return Collections.emptySet(); + } + + Enumeration enumeration = zipfile.entries(); + Set set = Sets.newHashSet(); + + while (enumeration.hasMoreElements()) + { + ZipEntry zipentry = (ZipEntry)enumeration.nextElement(); + String s = zipentry.getName(); + + if (s.startsWith("assets/")) + { + List list = Lists.newArrayList(entryNameSplitter.split(s)); + + if (list.size() > 1) + { + String s1 = (String)list.get(1); + + if (!s1.equals(s1.toLowerCase())) + { + this.logNameNotLowercase(s1); + } + else + { + set.add(s1); + } + } + } + } + + return set; + } + + protected void finalize() throws Throwable + { + this.close(); + super.finalize(); + } + + public void close() throws IOException + { + if (this.resourcePackZipFile != null) + { + this.resourcePackZipFile.close(); + this.resourcePackZipFile = null; + } + } +} diff --git a/src/minecraft/net/minecraft/client/resources/FolderResourcePack.java b/src/minecraft/net/minecraft/client/resources/FolderResourcePack.java new file mode 100644 index 0000000..178a890 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/FolderResourcePack.java @@ -0,0 +1,54 @@ +package net.minecraft.client.resources; + +import com.google.common.collect.Sets; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileFilter; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Set; +import org.apache.commons.io.filefilter.DirectoryFileFilter; + +public class FolderResourcePack extends AbstractResourcePack +{ + public FolderResourcePack(File resourcePackFileIn) + { + super(resourcePackFileIn); + } + + protected InputStream getInputStreamByName(String name) throws IOException + { + return new BufferedInputStream(new FileInputStream(new File(this.resourcePackFile, name))); + } + + protected boolean hasResourceName(String name) + { + return (new File(this.resourcePackFile, name)).isFile(); + } + + public Set getResourceDomains() + { + Set set = Sets.newHashSet(); + File file1 = new File(this.resourcePackFile, "assets/"); + + if (file1.isDirectory()) + { + for (File file2 : file1.listFiles((FileFilter)DirectoryFileFilter.DIRECTORY)) + { + String s = getRelativeName(file1, file2); + + if (!s.equals(s.toLowerCase())) + { + this.logNameNotLowercase(s); + } + else + { + set.add(s.substring(0, s.length() - 1)); + } + } + } + + return set; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java b/src/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java new file mode 100644 index 0000000..cdcbdf2 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/FoliageColorReloadListener.java @@ -0,0 +1,23 @@ +package net.minecraft.client.resources; + +import java.io.IOException; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.ColorizerFoliage; + +public class FoliageColorReloadListener implements IResourceManagerReloadListener +{ + private static final ResourceLocation LOC_FOLIAGE_PNG = new ResourceLocation("textures/colormap/foliage.png"); + + public void onResourceManagerReload(IResourceManager resourceManager) + { + try + { + ColorizerFoliage.setFoliageBiomeColorizer(TextureUtil.readImageData(resourceManager, LOC_FOLIAGE_PNG)); + } + catch (IOException var3) + { + ; + } + } +} diff --git a/src/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java b/src/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java new file mode 100644 index 0000000..9418147 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/GrassColorReloadListener.java @@ -0,0 +1,23 @@ +package net.minecraft.client.resources; + +import java.io.IOException; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.ColorizerGrass; + +public class GrassColorReloadListener implements IResourceManagerReloadListener +{ + private static final ResourceLocation LOC_GRASS_PNG = new ResourceLocation("textures/colormap/grass.png"); + + public void onResourceManagerReload(IResourceManager resourceManager) + { + try + { + ColorizerGrass.setGrassBiomeColorizer(TextureUtil.readImageData(resourceManager, LOC_GRASS_PNG)); + } + catch (IOException var3) + { + ; + } + } +} diff --git a/src/minecraft/net/minecraft/client/resources/I18n.java b/src/minecraft/net/minecraft/client/resources/I18n.java new file mode 100644 index 0000000..00629d4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/I18n.java @@ -0,0 +1,27 @@ +package net.minecraft.client.resources; + +import java.util.Map; + +public class I18n +{ + private static Locale i18nLocale; + private static final String __OBFID = "CL_00001094"; + + static void setLocale(Locale i18nLocaleIn) + { + i18nLocale = i18nLocaleIn; + } + + /** + * format(a, b) is equivalent to String.format(translate(a), b). Args: translationKey, params... + */ + public static String format(String translateKey, Object... parameters) + { + return i18nLocale.formatMessage(translateKey, parameters); + } + + public static Map getLocaleProperties() + { + return i18nLocale.properties; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/IReloadableResourceManager.java b/src/minecraft/net/minecraft/client/resources/IReloadableResourceManager.java new file mode 100644 index 0000000..b8f78f1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/IReloadableResourceManager.java @@ -0,0 +1,10 @@ +package net.minecraft.client.resources; + +import java.util.List; + +public interface IReloadableResourceManager extends IResourceManager +{ + void reloadResources(List p_110541_1_); + + void registerReloadListener(IResourceManagerReloadListener reloadListener); +} diff --git a/src/minecraft/net/minecraft/client/resources/IResource.java b/src/minecraft/net/minecraft/client/resources/IResource.java new file mode 100644 index 0000000..e2be4d4 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/IResource.java @@ -0,0 +1,18 @@ +package net.minecraft.client.resources; + +import java.io.InputStream; +import net.minecraft.client.resources.data.IMetadataSection; +import net.minecraft.util.ResourceLocation; + +public interface IResource +{ + ResourceLocation getResourceLocation(); + + InputStream getInputStream(); + + boolean hasMetadata(); + + T getMetadata(String p_110526_1_); + + String getResourcePackName(); +} diff --git a/src/minecraft/net/minecraft/client/resources/IResourceManager.java b/src/minecraft/net/minecraft/client/resources/IResourceManager.java new file mode 100644 index 0000000..addbb8a --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/IResourceManager.java @@ -0,0 +1,15 @@ +package net.minecraft.client.resources; + +import java.io.IOException; +import java.util.List; +import java.util.Set; +import net.minecraft.util.ResourceLocation; + +public interface IResourceManager +{ + Set getResourceDomains(); + + IResource getResource(ResourceLocation location) throws IOException; + + List getAllResources(ResourceLocation location) throws IOException; +} diff --git a/src/minecraft/net/minecraft/client/resources/IResourceManagerReloadListener.java b/src/minecraft/net/minecraft/client/resources/IResourceManagerReloadListener.java new file mode 100644 index 0000000..424e67b --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/IResourceManagerReloadListener.java @@ -0,0 +1,6 @@ +package net.minecraft.client.resources; + +public interface IResourceManagerReloadListener +{ + void onResourceManagerReload(IResourceManager resourceManager); +} diff --git a/src/minecraft/net/minecraft/client/resources/IResourcePack.java b/src/minecraft/net/minecraft/client/resources/IResourcePack.java new file mode 100644 index 0000000..18cb2c7 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/IResourcePack.java @@ -0,0 +1,24 @@ +package net.minecraft.client.resources; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.util.Set; +import net.minecraft.client.resources.data.IMetadataSection; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.util.ResourceLocation; + +public interface IResourcePack +{ + InputStream getInputStream(ResourceLocation location) throws IOException; + + boolean resourceExists(ResourceLocation location); + + Set getResourceDomains(); + + T getPackMetadata(IMetadataSerializer p_135058_1_, String p_135058_2_) throws IOException; + + BufferedImage getPackImage() throws IOException; + + String getPackName(); +} diff --git a/src/minecraft/net/minecraft/client/resources/Language.java b/src/minecraft/net/minecraft/client/resources/Language.java new file mode 100644 index 0000000..8163062 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/Language.java @@ -0,0 +1,47 @@ +package net.minecraft.client.resources; + +public class Language implements Comparable +{ + private final String languageCode; + private final String region; + private final String name; + private final boolean bidirectional; + + public Language(String languageCodeIn, String regionIn, String nameIn, boolean bidirectionalIn) + { + this.languageCode = languageCodeIn; + this.region = regionIn; + this.name = nameIn; + this.bidirectional = bidirectionalIn; + } + + public String getLanguageCode() + { + return this.languageCode; + } + + public boolean isBidirectional() + { + return this.bidirectional; + } + + public String toString() + { + return String.format("%s (%s)", new Object[] {this.name, this.region}); + } + + public boolean equals(Object p_equals_1_) + { + return this == p_equals_1_ ? true : (!(p_equals_1_ instanceof Language) ? false : this.languageCode.equals(((Language)p_equals_1_).languageCode)); + } + + public int hashCode() + { + return this.languageCode.hashCode(); + } + + public int compareTo(Language p_compareTo_1_) + { + return this.languageCode.compareTo(p_compareTo_1_.languageCode); + } +} diff --git a/src/minecraft/net/minecraft/client/resources/LanguageManager.java b/src/minecraft/net/minecraft/client/resources/LanguageManager.java new file mode 100644 index 0000000..c68cb3b --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/LanguageManager.java @@ -0,0 +1,100 @@ +package net.minecraft.client.resources; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.SortedSet; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.client.resources.data.LanguageMetadataSection; +import net.minecraft.util.StringTranslate; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class LanguageManager implements IResourceManagerReloadListener +{ + private static final Logger logger = LogManager.getLogger(); + private final IMetadataSerializer theMetadataSerializer; + private String currentLanguage; + protected static final Locale currentLocale = new Locale(); + private Map languageMap = Maps.newHashMap(); + + public LanguageManager(IMetadataSerializer theMetadataSerializerIn, String currentLanguageIn) + { + this.theMetadataSerializer = theMetadataSerializerIn; + this.currentLanguage = currentLanguageIn; + I18n.setLocale(currentLocale); + } + + public void parseLanguageMetadata(List p_135043_1_) + { + this.languageMap.clear(); + + for (IResourcePack iresourcepack : p_135043_1_) + { + try + { + LanguageMetadataSection languagemetadatasection = (LanguageMetadataSection)iresourcepack.getPackMetadata(this.theMetadataSerializer, "language"); + + if (languagemetadatasection != null) + { + for (Language language : languagemetadatasection.getLanguages()) + { + if (!this.languageMap.containsKey(language.getLanguageCode())) + { + this.languageMap.put(language.getLanguageCode(), language); + } + } + } + } + catch (RuntimeException runtimeexception) + { + logger.warn((String)("Unable to parse metadata section of resourcepack: " + iresourcepack.getPackName()), (Throwable)runtimeexception); + } + catch (IOException ioexception) + { + logger.warn((String)("Unable to parse metadata section of resourcepack: " + iresourcepack.getPackName()), (Throwable)ioexception); + } + } + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + List list = Lists.newArrayList(new String[] {"en_US"}); + + if (!"en_US".equals(this.currentLanguage)) + { + list.add(this.currentLanguage); + } + + currentLocale.loadLocaleDataFiles(resourceManager, list); + StringTranslate.replaceWith(currentLocale.properties); + } + + public boolean isCurrentLocaleUnicode() + { + return currentLocale.isUnicode(); + } + + public boolean isCurrentLanguageBidirectional() + { + return this.getCurrentLanguage() != null && this.getCurrentLanguage().isBidirectional(); + } + + public void setCurrentLanguage(Language currentLanguageIn) + { + this.currentLanguage = currentLanguageIn.getLanguageCode(); + } + + public Language getCurrentLanguage() + { + return this.languageMap.containsKey(this.currentLanguage) ? (Language)this.languageMap.get(this.currentLanguage) : (Language)this.languageMap.get("en_US"); + } + + public SortedSet getLanguages() + { + return Sets.newTreeSet(this.languageMap.values()); + } +} diff --git a/src/minecraft/net/minecraft/client/resources/Locale.java b/src/minecraft/net/minecraft/client/resources/Locale.java new file mode 100644 index 0000000..d141b8e --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/Locale.java @@ -0,0 +1,144 @@ +package net.minecraft.client.resources; + +import com.google.common.base.Splitter; +import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; +import java.io.IOException; +import java.io.InputStream; +import java.util.IllegalFormatException; +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.Charsets; +import org.apache.commons.io.IOUtils; + +public class Locale +{ + /** Splits on "=" */ + private static final Splitter splitter = Splitter.on('=').limit(2); + private static final Pattern pattern = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]"); + Map properties = Maps.newHashMap(); + private boolean unicode; + + /** + * par2 is a list of languages. For each language $L and domain $D, attempts to load the resource $D:lang/$L.lang + */ + + public synchronized void loadLocaleDataFiles(IResourceManager resourceManager, List p_135022_2_) + { + this.properties.clear(); + + for (String s : p_135022_2_) + { + String s1 = String.format("lang/%s.lang", new Object[] {s}); + + for (String s2 : resourceManager.getResourceDomains()) + { + try + { + this.loadLocaleData(resourceManager.getAllResources(new ResourceLocation(s2, s1))); + } + catch (IOException var9) + { + ; + } + } + } + + this.checkUnicode(); + } + + public boolean isUnicode() + { + return this.unicode; + } + + private void checkUnicode() + { + this.unicode = false; + int i = 0; + int j = 0; + + for (String s : this.properties.values()) + { + int k = s.length(); + j += k; + + for (int l = 0; l < k; ++l) + { + if (s.charAt(l) >= 256) + { + ++i; + } + } + } + + float f = (float)i / (float)j; + this.unicode = (double)f > 0.1D; + } + + /** + * par1 is a list of Resources + */ + private void loadLocaleData(List p_135028_1_) throws IOException + { + for (IResource iresource : p_135028_1_) + { + InputStream inputstream = iresource.getInputStream(); + + try + { + this.loadLocaleData(inputstream); + } + finally + { + IOUtils.closeQuietly(inputstream); + } + } + } + + private void loadLocaleData(InputStream p_135021_1_) throws IOException + { + for (String s : IOUtils.readLines(p_135021_1_, Charsets.UTF_8)) + { + if (!s.isEmpty() && s.charAt(0) != 35) + { + String[] astring = (String[])Iterables.toArray(splitter.split(s), String.class); + + if (astring != null && astring.length == 2) + { + String s1 = astring[0]; + String s2 = pattern.matcher(astring[1]).replaceAll("%$1s"); + this.properties.put(s1, s2); + } + } + } + } + + /** + * Returns the translation, or the key itself if the key could not be translated. + */ + private String translateKeyPrivate(String p_135026_1_) + { + String s = (String)this.properties.get(p_135026_1_); + return s == null ? p_135026_1_ : s; + } + + /** + * Calls String.format(translateKey(key), params) + */ + public String formatMessage(String translateKey, Object[] parameters) + { + String s = this.translateKeyPrivate(translateKey); + + try + { + return String.format(s, parameters); + } + catch (IllegalFormatException var5) + { + return "Format error: " + s; + } + } +} diff --git a/src/minecraft/net/minecraft/client/resources/ResourceIndex.java b/src/minecraft/net/minecraft/client/resources/ResourceIndex.java new file mode 100644 index 0000000..f00eaa7 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/ResourceIndex.java @@ -0,0 +1,73 @@ +package net.minecraft.client.resources; + +import com.google.common.base.Charsets; +import com.google.common.collect.Maps; +import com.google.common.io.Files; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonParser; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.Reader; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.util.JsonUtils; +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ResourceIndex +{ + private static final Logger logger = LogManager.getLogger(); + private final Map resourceMap = Maps.newHashMap(); + + public ResourceIndex(File p_i1047_1_, String p_i1047_2_) + { + if (p_i1047_2_ != null) + { + File file1 = new File(p_i1047_1_, "objects"); + File file2 = new File(p_i1047_1_, "indexes/" + p_i1047_2_ + ".json"); + BufferedReader bufferedreader = null; + + try + { + bufferedreader = Files.newReader(file2, Charsets.UTF_8); + JsonObject jsonobject = (new JsonParser()).parse((Reader)bufferedreader).getAsJsonObject(); + JsonObject jsonobject1 = JsonUtils.getJsonObject(jsonobject, "objects", (JsonObject)null); + + if (jsonobject1 != null) + { + for (Entry entry : jsonobject1.entrySet()) + { + JsonObject jsonobject2 = (JsonObject)entry.getValue(); + String s = (String)entry.getKey(); + String[] astring = s.split("/", 2); + String s1 = astring.length == 1 ? astring[0] : astring[0] + ":" + astring[1]; + String s2 = JsonUtils.getString(jsonobject2, "hash"); + File file3 = new File(file1, s2.substring(0, 2) + "/" + s2); + this.resourceMap.put(s1, file3); + } + } + } + catch (JsonParseException var20) + { + logger.error("Unable to parse resource index file: " + file2); + } + catch (FileNotFoundException var21) + { + logger.error("Can\'t find the resource index file: " + file2); + } + finally + { + IOUtils.closeQuietly((Reader)bufferedreader); + } + } + } + + public Map getResourceMap() + { + return this.resourceMap; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/ResourcePackFileNotFoundException.java b/src/minecraft/net/minecraft/client/resources/ResourcePackFileNotFoundException.java new file mode 100644 index 0000000..7cd7530 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/ResourcePackFileNotFoundException.java @@ -0,0 +1,12 @@ +package net.minecraft.client.resources; + +import java.io.File; +import java.io.FileNotFoundException; + +public class ResourcePackFileNotFoundException extends FileNotFoundException +{ + public ResourcePackFileNotFoundException(File p_i1294_1_, String p_i1294_2_) + { + super(String.format("\'%s\' in ResourcePack \'%s\'", new Object[] {p_i1294_2_, p_i1294_1_})); + } +} diff --git a/src/minecraft/net/minecraft/client/resources/ResourcePackListEntry.java b/src/minecraft/net/minecraft/client/resources/ResourcePackListEntry.java new file mode 100644 index 0000000..04fbb2e --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/ResourcePackListEntry.java @@ -0,0 +1,251 @@ +package net.minecraft.client.resources; + +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiListExtended; +import net.minecraft.client.gui.GuiScreenResourcePacks; +import net.minecraft.client.gui.GuiYesNo; +import net.minecraft.client.gui.GuiYesNoCallback; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ResourceLocation; + +public abstract class ResourcePackListEntry implements GuiListExtended.IGuiListEntry +{ + private static final ResourceLocation RESOURCE_PACKS_TEXTURE = new ResourceLocation("textures/gui/resource_packs.png"); + private static final IChatComponent field_183020_d = new ChatComponentTranslation("resourcePack.incompatible", new Object[0]); + private static final IChatComponent field_183021_e = new ChatComponentTranslation("resourcePack.incompatible.old", new Object[0]); + private static final IChatComponent field_183022_f = new ChatComponentTranslation("resourcePack.incompatible.new", new Object[0]); + protected final Minecraft mc; + protected final GuiScreenResourcePacks resourcePacksGUI; + + public ResourcePackListEntry(GuiScreenResourcePacks resourcePacksGUIIn) + { + this.resourcePacksGUI = resourcePacksGUIIn; + this.mc = Minecraft.getMinecraft(); + } + + public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected) + { + int i = this.func_183019_a(); + + if (i != 1) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Gui.drawRect(x - 1, y - 1, x + listWidth - 9, y + slotHeight + 1, -8978432); + } + + this.func_148313_c(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 0.0F, 32, 32, 32.0F, 32.0F); + String s = this.func_148312_b(); + String s1 = this.func_148311_a(); + + if ((this.mc.gameSettings.touchscreen || isSelected) && this.func_148310_d()) + { + this.mc.getTextureManager().bindTexture(RESOURCE_PACKS_TEXTURE); + Gui.drawRect(x, y, x + 32, y + 32, -1601138544); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + int j = mouseX - x; + int k = mouseY - y; + + if (i < 1) + { + s = field_183020_d.getFormattedText(); + s1 = field_183021_e.getFormattedText(); + } + else if (i > 1) + { + s = field_183020_d.getFormattedText(); + s1 = field_183022_f.getFormattedText(); + } + + if (this.func_148309_e()) + { + if (j < 32) + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 32.0F, 32, 32, 256.0F, 256.0F); + } + else + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 0.0F, 32, 32, 256.0F, 256.0F); + } + } + else + { + if (this.func_148308_f()) + { + if (j < 16) + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 32.0F, 32.0F, 32, 32, 256.0F, 256.0F); + } + else + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 32.0F, 0.0F, 32, 32, 256.0F, 256.0F); + } + } + + if (this.func_148314_g()) + { + if (j < 32 && j > 16 && k < 16) + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 96.0F, 32.0F, 32, 32, 256.0F, 256.0F); + } + else + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 96.0F, 0.0F, 32, 32, 256.0F, 256.0F); + } + } + + if (this.func_148307_h()) + { + if (j < 32 && j > 16 && k > 16) + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 64.0F, 32.0F, 32, 32, 256.0F, 256.0F); + } + else + { + Gui.drawModalRectWithCustomSizedTexture(x, y, 64.0F, 0.0F, 32, 32, 256.0F, 256.0F); + } + } + } + } + + int i1 = this.mc.fontRendererObj.getStringWidth(s); + + if (i1 > 157) + { + s = this.mc.fontRendererObj.trimStringToWidth(s, 157 - this.mc.fontRendererObj.getStringWidth("...")) + "..."; + } + + this.mc.fontRendererObj.drawStringWithShadow(s, (float)(x + 32 + 2), (float)(y + 1), 16777215); + List list = this.mc.fontRendererObj.listFormattedStringToWidth(s1, 157); + + for (int l = 0; l < 2 && l < list.size(); ++l) + { + this.mc.fontRendererObj.drawStringWithShadow((String)list.get(l), (float)(x + 32 + 2), (float)(y + 12 + 10 * l), 8421504); + } + } + + protected abstract int func_183019_a(); + + protected abstract String func_148311_a(); + + protected abstract String func_148312_b(); + + protected abstract void func_148313_c(); + + protected boolean func_148310_d() + { + return true; + } + + protected boolean func_148309_e() + { + return !this.resourcePacksGUI.hasResourcePackEntry(this); + } + + protected boolean func_148308_f() + { + return this.resourcePacksGUI.hasResourcePackEntry(this); + } + + protected boolean func_148314_g() + { + List list = this.resourcePacksGUI.getListContaining(this); + int i = list.indexOf(this); + return i > 0 && ((ResourcePackListEntry)list.get(i - 1)).func_148310_d(); + } + + protected boolean func_148307_h() + { + List list = this.resourcePacksGUI.getListContaining(this); + int i = list.indexOf(this); + return i >= 0 && i < list.size() - 1 && ((ResourcePackListEntry)list.get(i + 1)).func_148310_d(); + } + + /** + * Returns true if the mouse has been pressed on this control. + */ + public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_) + { + if (this.func_148310_d() && p_148278_5_ <= 32) + { + if (this.func_148309_e()) + { + this.resourcePacksGUI.markChanged(); + int j = this.func_183019_a(); + + if (j != 1) + { + String s1 = I18n.format("resourcePack.incompatible.confirm.title", new Object[0]); + String s = I18n.format("resourcePack.incompatible.confirm." + (j > 1 ? "new" : "old"), new Object[0]); + this.mc.displayGuiScreen(new GuiYesNo(new GuiYesNoCallback() + { + public void confirmClicked(boolean result, int id) + { + List list2 = ResourcePackListEntry.this.resourcePacksGUI.getListContaining(ResourcePackListEntry.this); + ResourcePackListEntry.this.mc.displayGuiScreen(ResourcePackListEntry.this.resourcePacksGUI); + + if (result) + { + list2.remove(ResourcePackListEntry.this); + ResourcePackListEntry.this.resourcePacksGUI.getSelectedResourcePacks().add(0, ResourcePackListEntry.this); + } + } + }, s1, s, 0)); + } + else + { + this.resourcePacksGUI.getListContaining(this).remove(this); + this.resourcePacksGUI.getSelectedResourcePacks().add(0, this); + } + + return true; + } + + if (p_148278_5_ < 16 && this.func_148308_f()) + { + this.resourcePacksGUI.getListContaining(this).remove(this); + this.resourcePacksGUI.getAvailableResourcePacks().add(0, this); + this.resourcePacksGUI.markChanged(); + return true; + } + + if (p_148278_5_ > 16 && p_148278_6_ < 16 && this.func_148314_g()) + { + List list1 = this.resourcePacksGUI.getListContaining(this); + int k = list1.indexOf(this); + list1.remove(this); + list1.add(k - 1, this); + this.resourcePacksGUI.markChanged(); + return true; + } + + if (p_148278_5_ > 16 && p_148278_6_ > 16 && this.func_148307_h()) + { + List list = this.resourcePacksGUI.getListContaining(this); + int i = list.indexOf(this); + list.remove(this); + list.add(i + 1, this); + this.resourcePacksGUI.markChanged(); + return true; + } + } + + return false; + } + + public void setSelected(int p_178011_1_, int p_178011_2_, int p_178011_3_) + { + } + + /** + * Fired when the mouse button is released. Arguments: index, x, y, mouseEvent, relativeX, relativeY + */ + public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) + { + } +} diff --git a/src/minecraft/net/minecraft/client/resources/ResourcePackListEntryDefault.java b/src/minecraft/net/minecraft/client/resources/ResourcePackListEntryDefault.java new file mode 100644 index 0000000..7c16b55 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/ResourcePackListEntryDefault.java @@ -0,0 +1,100 @@ +package net.minecraft.client.resources; + +import com.google.gson.JsonParseException; +import java.io.IOException; +import net.minecraft.client.gui.GuiScreenResourcePacks; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.resources.data.PackMetadataSection; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ResourcePackListEntryDefault extends ResourcePackListEntry +{ + private static final Logger logger = LogManager.getLogger(); + private final IResourcePack field_148320_d; + private final ResourceLocation resourcePackIcon; + + public ResourcePackListEntryDefault(GuiScreenResourcePacks resourcePacksGUIIn) + { + super(resourcePacksGUIIn); + this.field_148320_d = this.mc.getResourcePackRepository().rprDefaultResourcePack; + DynamicTexture dynamictexture; + + try + { + dynamictexture = new DynamicTexture(this.field_148320_d.getPackImage()); + } + catch (IOException var4) + { + dynamictexture = TextureUtil.missingTexture; + } + + this.resourcePackIcon = this.mc.getTextureManager().getDynamicTextureLocation("texturepackicon", dynamictexture); + } + + protected int func_183019_a() + { + return 1; + } + + protected String func_148311_a() + { + try + { + PackMetadataSection packmetadatasection = (PackMetadataSection)this.field_148320_d.getPackMetadata(this.mc.getResourcePackRepository().rprMetadataSerializer, "pack"); + + if (packmetadatasection != null) + { + return packmetadatasection.getPackDescription().getFormattedText(); + } + } + catch (JsonParseException jsonparseexception) + { + logger.error((String)"Couldn\'t load metadata info", (Throwable)jsonparseexception); + } + catch (IOException ioexception) + { + logger.error((String)"Couldn\'t load metadata info", (Throwable)ioexception); + } + + return EnumChatFormatting.RED + "Missing " + "pack.mcmeta" + " :("; + } + + protected boolean func_148309_e() + { + return false; + } + + protected boolean func_148308_f() + { + return false; + } + + protected boolean func_148314_g() + { + return false; + } + + protected boolean func_148307_h() + { + return false; + } + + protected String func_148312_b() + { + return "Default"; + } + + protected void func_148313_c() + { + this.mc.getTextureManager().bindTexture(this.resourcePackIcon); + } + + protected boolean func_148310_d() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/ResourcePackListEntryFound.java b/src/minecraft/net/minecraft/client/resources/ResourcePackListEntryFound.java new file mode 100644 index 0000000..26bc799 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/ResourcePackListEntryFound.java @@ -0,0 +1,39 @@ +package net.minecraft.client.resources; + +import net.minecraft.client.gui.GuiScreenResourcePacks; + +public class ResourcePackListEntryFound extends ResourcePackListEntry +{ + private final ResourcePackRepository.Entry field_148319_c; + + public ResourcePackListEntryFound(GuiScreenResourcePacks resourcePacksGUIIn, ResourcePackRepository.Entry p_i45053_2_) + { + super(resourcePacksGUIIn); + this.field_148319_c = p_i45053_2_; + } + + protected void func_148313_c() + { + this.field_148319_c.bindTexturePackIcon(this.mc.getTextureManager()); + } + + protected int func_183019_a() + { + return this.field_148319_c.func_183027_f(); + } + + protected String func_148311_a() + { + return this.field_148319_c.getTexturePackDescription(); + } + + protected String func_148312_b() + { + return this.field_148319_c.getResourcePackName(); + } + + public ResourcePackRepository.Entry func_148318_i() + { + return this.field_148319_c; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/ResourcePackRepository.java b/src/minecraft/net/minecraft/client/resources/ResourcePackRepository.java new file mode 100644 index 0000000..29d9a65 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/ResourcePackRepository.java @@ -0,0 +1,394 @@ +package net.minecraft.client.resources; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import com.google.common.hash.Hashing; +import com.google.common.io.Files; +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.SettableFuture; +import java.awt.image.BufferedImage; +import java.io.Closeable; +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.locks.ReentrantLock; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreenWorking; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.client.resources.data.PackMetadataSection; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.HttpUtil; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.io.comparator.LastModifiedFileComparator; +import org.apache.commons.io.filefilter.IOFileFilter; +import org.apache.commons.io.filefilter.TrueFileFilter; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ResourcePackRepository +{ + private static final Logger logger = LogManager.getLogger(); + private static final FileFilter resourcePackFilter = new FileFilter() + { + public boolean accept(File p_accept_1_) + { + boolean flag = p_accept_1_.isFile() && p_accept_1_.getName().endsWith(".zip"); + boolean flag1 = p_accept_1_.isDirectory() && (new File(p_accept_1_, "pack.mcmeta")).isFile(); + return flag || flag1; + } + }; + private final File dirResourcepacks; + public final IResourcePack rprDefaultResourcePack; + private final File dirServerResourcepacks; + public final IMetadataSerializer rprMetadataSerializer; + private IResourcePack resourcePackInstance; + private final ReentrantLock lock = new ReentrantLock(); + private ListenableFuture field_177322_i; + private List repositoryEntriesAll = Lists.newArrayList(); + private List repositoryEntries = Lists.newArrayList(); + + public ResourcePackRepository(File dirResourcepacksIn, File dirServerResourcepacksIn, IResourcePack rprDefaultResourcePackIn, IMetadataSerializer rprMetadataSerializerIn, GameSettings settings) + { + this.dirResourcepacks = dirResourcepacksIn; + this.dirServerResourcepacks = dirServerResourcepacksIn; + this.rprDefaultResourcePack = rprDefaultResourcePackIn; + this.rprMetadataSerializer = rprMetadataSerializerIn; + this.fixDirResourcepacks(); + this.updateRepositoryEntriesAll(); + Iterator iterator = settings.resourcePacks.iterator(); + + while (iterator.hasNext()) + { + String s = (String)iterator.next(); + + for (ResourcePackRepository.Entry resourcepackrepository$entry : this.repositoryEntriesAll) + { + if (resourcepackrepository$entry.getResourcePackName().equals(s)) + { + if (resourcepackrepository$entry.func_183027_f() == 1 || settings.field_183018_l.contains(resourcepackrepository$entry.getResourcePackName())) + { + this.repositoryEntries.add(resourcepackrepository$entry); + break; + } + + iterator.remove(); + logger.warn("Removed selected resource pack {} because it\'s no longer compatible", new Object[] {resourcepackrepository$entry.getResourcePackName()}); + } + } + } + } + + private void fixDirResourcepacks() + { + if (this.dirResourcepacks.exists()) + { + if (!this.dirResourcepacks.isDirectory() && (!this.dirResourcepacks.delete() || !this.dirResourcepacks.mkdirs())) + { + logger.warn("Unable to recreate resourcepack folder, it exists but is not a directory: " + this.dirResourcepacks); + } + } + else if (!this.dirResourcepacks.mkdirs()) + { + logger.warn("Unable to create resourcepack folder: " + this.dirResourcepacks); + } + } + + private List getResourcePackFiles() + { + return this.dirResourcepacks.isDirectory() ? Arrays.asList(this.dirResourcepacks.listFiles(resourcePackFilter)) : Collections.emptyList(); + } + + public void updateRepositoryEntriesAll() + { + List list = Lists.newArrayList(); + + for (File file1 : this.getResourcePackFiles()) + { + ResourcePackRepository.Entry resourcepackrepository$entry = new ResourcePackRepository.Entry(file1); + + if (!this.repositoryEntriesAll.contains(resourcepackrepository$entry)) + { + try + { + resourcepackrepository$entry.updateResourcePack(); + list.add(resourcepackrepository$entry); + } + catch (Exception var6) + { + list.remove(resourcepackrepository$entry); + } + } + else + { + int i = this.repositoryEntriesAll.indexOf(resourcepackrepository$entry); + + if (i > -1 && i < this.repositoryEntriesAll.size()) + { + list.add(this.repositoryEntriesAll.get(i)); + } + } + } + + this.repositoryEntriesAll.removeAll(list); + + for (ResourcePackRepository.Entry resourcepackrepository$entry1 : this.repositoryEntriesAll) + { + resourcepackrepository$entry1.closeResourcePack(); + } + + this.repositoryEntriesAll = list; + } + + public List getRepositoryEntriesAll() + { + return ImmutableList.copyOf(this.repositoryEntriesAll); + } + + public List getRepositoryEntries() + { + return ImmutableList.copyOf(this.repositoryEntries); + } + + public void setRepositories(List p_148527_1_) + { + this.repositoryEntries.clear(); + this.repositoryEntries.addAll(p_148527_1_); + } + + public File getDirResourcepacks() + { + return this.dirResourcepacks; + } + + public ListenableFuture downloadResourcePack(String url, String hash) + { + String s; + + if (hash.matches("^[a-f0-9]{40}$")) + { + s = hash; + } + else + { + s = "legacy"; + } + + final File file1 = new File(this.dirServerResourcepacks, s); + this.lock.lock(); + + try + { + this.func_148529_f(); + + if (file1.exists() && hash.length() == 40) + { + try + { + String s1 = Hashing.sha1().hashBytes(Files.toByteArray(file1)).toString(); + + if (s1.equals(hash)) + { + ListenableFuture listenablefuture1 = this.setResourcePackInstance(file1); + return listenablefuture1; + } + + logger.warn("File " + file1 + " had wrong hash (expected " + hash + ", found " + s1 + "). Deleting it."); + FileUtils.deleteQuietly(file1); + } + catch (IOException ioexception) + { + logger.warn((String)("File " + file1 + " couldn\'t be hashed. Deleting it."), (Throwable)ioexception); + FileUtils.deleteQuietly(file1); + } + } + + this.func_183028_i(); + final GuiScreenWorking guiscreenworking = new GuiScreenWorking(); + Map map = Minecraft.getSessionInfo(); + final Minecraft minecraft = Minecraft.getMinecraft(); + Futures.getUnchecked(minecraft.addScheduledTask(new Runnable() + { + public void run() + { + minecraft.displayGuiScreen(guiscreenworking); + } + })); + final SettableFuture settablefuture = SettableFuture.create(); + this.field_177322_i = HttpUtil.downloadResourcePack(file1, url, map, 52428800, guiscreenworking, minecraft.getProxy()); + Futures.addCallback(this.field_177322_i, new FutureCallback() + { + public void onSuccess(Object p_onSuccess_1_) + { + ResourcePackRepository.this.setResourcePackInstance(file1); + settablefuture.set((Object)null); + } + public void onFailure(Throwable p_onFailure_1_) + { + settablefuture.setException(p_onFailure_1_); + } + }); + ListenableFuture listenablefuture = this.field_177322_i; + return listenablefuture; + } + finally + { + this.lock.unlock(); + } + } + + private void func_183028_i() + { + List list = Lists.newArrayList(FileUtils.listFiles(this.dirServerResourcepacks, TrueFileFilter.TRUE, (IOFileFilter)null)); + Collections.sort(list, LastModifiedFileComparator.LASTMODIFIED_REVERSE); + int i = 0; + + for (File file1 : list) + { + if (i++ >= 10) + { + logger.info("Deleting old server resource pack " + file1.getName()); + FileUtils.deleteQuietly(file1); + } + } + } + + public ListenableFuture setResourcePackInstance(File p_177319_1_) + { + this.resourcePackInstance = new FileResourcePack(p_177319_1_); + return Minecraft.getMinecraft().scheduleResourcesRefresh(); + } + + /** + * Getter for the IResourcePack instance associated with this ResourcePackRepository + */ + public IResourcePack getResourcePackInstance() + { + return this.resourcePackInstance; + } + + public void func_148529_f() + { + this.lock.lock(); + + try + { + if (this.field_177322_i != null) + { + this.field_177322_i.cancel(true); + } + + this.field_177322_i = null; + + if (this.resourcePackInstance != null) + { + this.resourcePackInstance = null; + Minecraft.getMinecraft().scheduleResourcesRefresh(); + } + } + finally + { + this.lock.unlock(); + } + } + + public class Entry + { + private final File resourcePackFile; + private IResourcePack reResourcePack; + private PackMetadataSection rePackMetadataSection; + private BufferedImage texturePackIcon; + private ResourceLocation locationTexturePackIcon; + + private Entry(File resourcePackFileIn) + { + this.resourcePackFile = resourcePackFileIn; + } + + public void updateResourcePack() throws IOException + { + this.reResourcePack = (IResourcePack)(this.resourcePackFile.isDirectory() ? new FolderResourcePack(this.resourcePackFile) : new FileResourcePack(this.resourcePackFile)); + this.rePackMetadataSection = (PackMetadataSection)this.reResourcePack.getPackMetadata(ResourcePackRepository.this.rprMetadataSerializer, "pack"); + + try + { + this.texturePackIcon = this.reResourcePack.getPackImage(); + } + catch (IOException var2) + { + ; + } + + if (this.texturePackIcon == null) + { + this.texturePackIcon = ResourcePackRepository.this.rprDefaultResourcePack.getPackImage(); + } + + this.closeResourcePack(); + } + + public void bindTexturePackIcon(TextureManager textureManagerIn) + { + if (this.locationTexturePackIcon == null) + { + this.locationTexturePackIcon = textureManagerIn.getDynamicTextureLocation("texturepackicon", new DynamicTexture(this.texturePackIcon)); + } + + textureManagerIn.bindTexture(this.locationTexturePackIcon); + } + + public void closeResourcePack() + { + if (this.reResourcePack instanceof Closeable) + { + IOUtils.closeQuietly((Closeable)this.reResourcePack); + } + } + + public IResourcePack getResourcePack() + { + return this.reResourcePack; + } + + public String getResourcePackName() + { + return this.reResourcePack.getPackName(); + } + + public String getTexturePackDescription() + { + return this.rePackMetadataSection == null ? EnumChatFormatting.RED + "Invalid pack.mcmeta (or missing \'pack\' section)" : this.rePackMetadataSection.getPackDescription().getFormattedText(); + } + + public int func_183027_f() + { + return this.rePackMetadataSection.getPackFormat(); + } + + public boolean equals(Object p_equals_1_) + { + return this == p_equals_1_ ? true : (p_equals_1_ instanceof ResourcePackRepository.Entry ? this.toString().equals(p_equals_1_.toString()) : false); + } + + public int hashCode() + { + return this.toString().hashCode(); + } + + public String toString() + { + return String.format("%s:%s:%d", new Object[] {this.resourcePackFile.getName(), this.resourcePackFile.isDirectory() ? "folder" : "zip", Long.valueOf(this.resourcePackFile.lastModified())}); + } + } +} diff --git a/src/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java b/src/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java new file mode 100644 index 0000000..c4f92a6 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java @@ -0,0 +1,121 @@ +package net.minecraft.client.resources; + +import com.google.common.base.Function; +import com.google.common.base.Joiner; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Set; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.util.ResourceLocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class SimpleReloadableResourceManager implements IReloadableResourceManager +{ + private static final Logger logger = LogManager.getLogger(); + private static final Joiner joinerResourcePacks = Joiner.on(", "); + private final Map domainResourceManagers = Maps.newHashMap(); + private final List reloadListeners = Lists.newArrayList(); + private final Set setResourceDomains = Sets.newLinkedHashSet(); + private final IMetadataSerializer rmMetadataSerializer; + + public SimpleReloadableResourceManager(IMetadataSerializer rmMetadataSerializerIn) + { + this.rmMetadataSerializer = rmMetadataSerializerIn; + } + + public void reloadResourcePack(IResourcePack resourcePack) + { + for (String s : resourcePack.getResourceDomains()) + { + this.setResourceDomains.add(s); + FallbackResourceManager fallbackresourcemanager = (FallbackResourceManager)this.domainResourceManagers.get(s); + + if (fallbackresourcemanager == null) + { + fallbackresourcemanager = new FallbackResourceManager(this.rmMetadataSerializer); + this.domainResourceManagers.put(s, fallbackresourcemanager); + } + + fallbackresourcemanager.addResourcePack(resourcePack); + } + } + + public Set getResourceDomains() + { + return this.setResourceDomains; + } + + public IResource getResource(ResourceLocation location) throws IOException + { + IResourceManager iresourcemanager = (IResourceManager)this.domainResourceManagers.get(location.getResourceDomain()); + + if (iresourcemanager != null) + { + return iresourcemanager.getResource(location); + } + else + { + throw new FileNotFoundException(location.toString()); + } + } + + public List getAllResources(ResourceLocation location) throws IOException + { + IResourceManager iresourcemanager = (IResourceManager)this.domainResourceManagers.get(location.getResourceDomain()); + + if (iresourcemanager != null) + { + return iresourcemanager.getAllResources(location); + } + else + { + throw new FileNotFoundException(location.toString()); + } + } + + private void clearResources() + { + this.domainResourceManagers.clear(); + this.setResourceDomains.clear(); + } + + public void reloadResources(List p_110541_1_) + { + this.clearResources(); + logger.info("Reloading ResourceManager: " + joinerResourcePacks.join(Iterables.transform(p_110541_1_, new Function() + { + public String apply(IResourcePack p_apply_1_) + { + return p_apply_1_.getPackName(); + } + }))); + + for (IResourcePack iresourcepack : p_110541_1_) + { + this.reloadResourcePack(iresourcepack); + } + + this.notifyReloadListeners(); + } + + public void registerReloadListener(IResourceManagerReloadListener reloadListener) + { + this.reloadListeners.add(reloadListener); + reloadListener.onResourceManagerReload(this); + } + + private void notifyReloadListeners() + { + for (IResourceManagerReloadListener iresourcemanagerreloadlistener : this.reloadListeners) + { + iresourcemanagerreloadlistener.onResourceManagerReload(this); + } + } +} diff --git a/src/minecraft/net/minecraft/client/resources/SimpleResource.java b/src/minecraft/net/minecraft/client/resources/SimpleResource.java new file mode 100644 index 0000000..a16b8f2 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/SimpleResource.java @@ -0,0 +1,139 @@ +package net.minecraft.client.resources; + +import com.google.common.collect.Maps; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.Map; +import net.minecraft.client.resources.data.IMetadataSection; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.IOUtils; + +public class SimpleResource implements IResource +{ + private final Map mapMetadataSections = Maps.newHashMap(); + private final String resourcePackName; + private final ResourceLocation srResourceLocation; + private final InputStream resourceInputStream; + private final InputStream mcmetaInputStream; + private final IMetadataSerializer srMetadataSerializer; + private boolean mcmetaJsonChecked; + private JsonObject mcmetaJson; + + public SimpleResource(String resourcePackNameIn, ResourceLocation srResourceLocationIn, InputStream resourceInputStreamIn, InputStream mcmetaInputStreamIn, IMetadataSerializer srMetadataSerializerIn) + { + this.resourcePackName = resourcePackNameIn; + this.srResourceLocation = srResourceLocationIn; + this.resourceInputStream = resourceInputStreamIn; + this.mcmetaInputStream = mcmetaInputStreamIn; + this.srMetadataSerializer = srMetadataSerializerIn; + } + + public ResourceLocation getResourceLocation() + { + return this.srResourceLocation; + } + + public InputStream getInputStream() + { + return this.resourceInputStream; + } + + public boolean hasMetadata() + { + return this.mcmetaInputStream != null; + } + + public T getMetadata(String p_110526_1_) + { + if (!this.hasMetadata()) + { + return (T)null; + } + else + { + if (this.mcmetaJson == null && !this.mcmetaJsonChecked) + { + this.mcmetaJsonChecked = true; + BufferedReader bufferedreader = null; + + try + { + bufferedreader = new BufferedReader(new InputStreamReader(this.mcmetaInputStream)); + this.mcmetaJson = (new JsonParser()).parse((Reader)bufferedreader).getAsJsonObject(); + } + finally + { + IOUtils.closeQuietly((Reader)bufferedreader); + } + } + + T t = (T)this.mapMetadataSections.get(p_110526_1_); + + if (t == null) + { + t = this.srMetadataSerializer.parseMetadataSection(p_110526_1_, this.mcmetaJson); + } + + return t; + } + } + + public String getResourcePackName() + { + return this.resourcePackName; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof SimpleResource)) + { + return false; + } + else + { + SimpleResource simpleresource = (SimpleResource)p_equals_1_; + + if (this.srResourceLocation != null) + { + if (!this.srResourceLocation.equals(simpleresource.srResourceLocation)) + { + return false; + } + } + else if (simpleresource.srResourceLocation != null) + { + return false; + } + + if (this.resourcePackName != null) + { + if (!this.resourcePackName.equals(simpleresource.resourcePackName)) + { + return false; + } + } + else if (simpleresource.resourcePackName != null) + { + return false; + } + + return true; + } + } + + public int hashCode() + { + int i = this.resourcePackName != null ? this.resourcePackName.hashCode() : 0; + i = 31 * i + (this.srResourceLocation != null ? this.srResourceLocation.hashCode() : 0); + return i; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/SkinManager.java b/src/minecraft/net/minecraft/client/resources/SkinManager.java new file mode 100644 index 0000000..6dfc178 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/SkinManager.java @@ -0,0 +1,159 @@ +package net.minecraft.client.resources; + +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.google.common.collect.Maps; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.InsecureTextureException; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; +import java.awt.image.BufferedImage; +import java.io.File; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.IImageBuffer; +import net.minecraft.client.renderer.ImageBufferDownload; +import net.minecraft.client.renderer.ThreadDownloadImageData; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.util.ResourceLocation; + +public class SkinManager +{ + private static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(0, 2, 1L, TimeUnit.MINUTES, new LinkedBlockingQueue()); + private final TextureManager textureManager; + private final File skinCacheDir; + private final MinecraftSessionService sessionService; + private final LoadingCache> skinCacheLoader; + + public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService) + { + this.textureManager = textureManagerInstance; + this.skinCacheDir = skinCacheDirectory; + this.sessionService = sessionService; + this.skinCacheLoader = CacheBuilder.newBuilder().expireAfterAccess(15L, TimeUnit.SECONDS).>build(new CacheLoader>() + { + public Map load(GameProfile p_load_1_) throws Exception + { + return Minecraft.getMinecraft().getSessionService().getTextures(p_load_1_, false); + } + }); + } + + /** + * Used in the Skull renderer to fetch a skin. May download the skin if it's not in the cache + */ + public ResourceLocation loadSkin(MinecraftProfileTexture profileTexture, Type p_152792_2_) + { + return this.loadSkin(profileTexture, p_152792_2_, (SkinManager.SkinAvailableCallback)null); + } + + /** + * May download the skin if its not in the cache, can be passed a SkinManager#SkinAvailableCallback for handling + */ + public ResourceLocation loadSkin(final MinecraftProfileTexture profileTexture, final Type p_152789_2_, final SkinManager.SkinAvailableCallback skinAvailableCallback) + { + final ResourceLocation resourcelocation = new ResourceLocation("skins/" + profileTexture.getHash()); + ITextureObject itextureobject = this.textureManager.getTexture(resourcelocation); + + if (itextureobject != null) + { + if (skinAvailableCallback != null) + { + skinAvailableCallback.skinAvailable(p_152789_2_, resourcelocation, profileTexture); + } + } + else + { + File file1 = new File(this.skinCacheDir, profileTexture.getHash().length() > 2 ? profileTexture.getHash().substring(0, 2) : "xx"); + File file2 = new File(file1, profileTexture.getHash()); + final IImageBuffer iimagebuffer = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null; + ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, profileTexture.getUrl(), DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer() + { + public BufferedImage parseUserSkin(BufferedImage image) + { + if (iimagebuffer != null) + { + image = iimagebuffer.parseUserSkin(image); + } + + return image; + } + public void skinAvailable() + { + if (iimagebuffer != null) + { + iimagebuffer.skinAvailable(); + } + + if (skinAvailableCallback != null) + { + skinAvailableCallback.skinAvailable(p_152789_2_, resourcelocation, profileTexture); + } + } + }); + this.textureManager.loadTexture(resourcelocation, threaddownloadimagedata); + } + + return resourcelocation; + } + + public void loadProfileTextures(final GameProfile profile, final SkinManager.SkinAvailableCallback skinAvailableCallback, final boolean requireSecure) + { + THREAD_POOL.submit(new Runnable() + { + public void run() + { + final Map map = Maps.newHashMap(); + + try + { + map.putAll(SkinManager.this.sessionService.getTextures(profile, requireSecure)); + } + catch (InsecureTextureException var3) + { + ; + } + + if (map.isEmpty() && profile.getId().equals(Minecraft.getMinecraft().getSession().getProfile().getId())) + { + profile.getProperties().clear(); + profile.getProperties().putAll(Minecraft.getMinecraft().func_181037_M()); + map.putAll(SkinManager.this.sessionService.getTextures(profile, false)); + } + + Minecraft.getMinecraft().addScheduledTask(new Runnable() + { + public void run() + { + if (map.containsKey(Type.SKIN)) + { + SkinManager.this.loadSkin((MinecraftProfileTexture)map.get(Type.SKIN), Type.SKIN, skinAvailableCallback); + } + + if (map.containsKey(Type.CAPE)) + { + SkinManager.this.loadSkin((MinecraftProfileTexture)map.get(Type.CAPE), Type.CAPE, skinAvailableCallback); + } + } + }); + } + }); + } + + public Map loadSkinFromCache(GameProfile profile) + { + return (Map)this.skinCacheLoader.getUnchecked(profile); + } + + public interface SkinAvailableCallback + { + void skinAvailable(Type p_180521_1_, ResourceLocation location, MinecraftProfileTexture profileTexture); + } +} diff --git a/src/minecraft/net/minecraft/client/resources/data/AnimationFrame.java b/src/minecraft/net/minecraft/client/resources/data/AnimationFrame.java new file mode 100644 index 0000000..1844494 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/AnimationFrame.java @@ -0,0 +1,33 @@ +package net.minecraft.client.resources.data; + +public class AnimationFrame +{ + private final int frameIndex; + private final int frameTime; + + public AnimationFrame(int p_i1307_1_) + { + this(p_i1307_1_, -1); + } + + public AnimationFrame(int p_i1308_1_, int p_i1308_2_) + { + this.frameIndex = p_i1308_1_; + this.frameTime = p_i1308_2_; + } + + public boolean hasNoTime() + { + return this.frameTime == -1; + } + + public int getFrameTime() + { + return this.frameTime; + } + + public int getFrameIndex() + { + return this.frameIndex; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/data/AnimationMetadataSection.java b/src/minecraft/net/minecraft/client/resources/data/AnimationMetadataSection.java new file mode 100644 index 0000000..99ed76f --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/AnimationMetadataSection.java @@ -0,0 +1,81 @@ +package net.minecraft.client.resources.data; + +import com.google.common.collect.Sets; +import java.util.List; +import java.util.Set; + +public class AnimationMetadataSection implements IMetadataSection +{ + private final List animationFrames; + private final int frameWidth; + private final int frameHeight; + private final int frameTime; + private final boolean interpolate; + + public AnimationMetadataSection(List p_i46088_1_, int p_i46088_2_, int p_i46088_3_, int p_i46088_4_, boolean p_i46088_5_) + { + this.animationFrames = p_i46088_1_; + this.frameWidth = p_i46088_2_; + this.frameHeight = p_i46088_3_; + this.frameTime = p_i46088_4_; + this.interpolate = p_i46088_5_; + } + + public int getFrameHeight() + { + return this.frameHeight; + } + + public int getFrameWidth() + { + return this.frameWidth; + } + + public int getFrameCount() + { + return this.animationFrames.size(); + } + + public int getFrameTime() + { + return this.frameTime; + } + + public boolean isInterpolate() + { + return this.interpolate; + } + + private AnimationFrame getAnimationFrame(int p_130072_1_) + { + return (AnimationFrame)this.animationFrames.get(p_130072_1_); + } + + public int getFrameTimeSingle(int p_110472_1_) + { + AnimationFrame animationframe = this.getAnimationFrame(p_110472_1_); + return animationframe.hasNoTime() ? this.frameTime : animationframe.getFrameTime(); + } + + public boolean frameHasTime(int p_110470_1_) + { + return !((AnimationFrame)this.animationFrames.get(p_110470_1_)).hasNoTime(); + } + + public int getFrameIndex(int p_110468_1_) + { + return ((AnimationFrame)this.animationFrames.get(p_110468_1_)).getFrameIndex(); + } + + public Set getFrameIndexSet() + { + Set set = Sets.newHashSet(); + + for (AnimationFrame animationframe : this.animationFrames) + { + set.add(Integer.valueOf(animationframe.getFrameIndex())); + } + + return set; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/data/AnimationMetadataSectionSerializer.java b/src/minecraft/net/minecraft/client/resources/data/AnimationMetadataSectionSerializer.java new file mode 100644 index 0000000..eb80721 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/AnimationMetadataSectionSerializer.java @@ -0,0 +1,143 @@ +package net.minecraft.client.resources.data; + +import com.google.common.collect.Lists; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; +import java.util.List; +import net.minecraft.util.JsonUtils; +import org.apache.commons.lang3.Validate; + +public class AnimationMetadataSectionSerializer extends BaseMetadataSectionSerializer implements JsonSerializer +{ + public AnimationMetadataSection deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + List list = Lists.newArrayList(); + JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "metadata section"); + int i = JsonUtils.getInt(jsonobject, "frametime", 1); + + if (i != 1) + { + Validate.inclusiveBetween(1L, 2147483647L, (long)i, "Invalid default frame time"); + } + + if (jsonobject.has("frames")) + { + try + { + JsonArray jsonarray = JsonUtils.getJsonArray(jsonobject, "frames"); + + for (int j = 0; j < jsonarray.size(); ++j) + { + JsonElement jsonelement = jsonarray.get(j); + AnimationFrame animationframe = this.parseAnimationFrame(j, jsonelement); + + if (animationframe != null) + { + list.add(animationframe); + } + } + } + catch (ClassCastException classcastexception) + { + throw new JsonParseException("Invalid animation->frames: expected array, was " + jsonobject.get("frames"), classcastexception); + } + } + + int k = JsonUtils.getInt(jsonobject, "width", -1); + int l = JsonUtils.getInt(jsonobject, "height", -1); + + if (k != -1) + { + Validate.inclusiveBetween(1L, 2147483647L, (long)k, "Invalid width"); + } + + if (l != -1) + { + Validate.inclusiveBetween(1L, 2147483647L, (long)l, "Invalid height"); + } + + boolean flag = JsonUtils.getBoolean(jsonobject, "interpolate", false); + return new AnimationMetadataSection(list, k, l, i, flag); + } + + private AnimationFrame parseAnimationFrame(int p_110492_1_, JsonElement p_110492_2_) + { + if (p_110492_2_.isJsonPrimitive()) + { + return new AnimationFrame(JsonUtils.getInt(p_110492_2_, "frames[" + p_110492_1_ + "]")); + } + else if (p_110492_2_.isJsonObject()) + { + JsonObject jsonobject = JsonUtils.getJsonObject(p_110492_2_, "frames[" + p_110492_1_ + "]"); + int i = JsonUtils.getInt(jsonobject, "time", -1); + + if (jsonobject.has("time")) + { + Validate.inclusiveBetween(1L, 2147483647L, (long)i, "Invalid frame time"); + } + + int j = JsonUtils.getInt(jsonobject, "index"); + Validate.inclusiveBetween(0L, 2147483647L, (long)j, "Invalid frame index"); + return new AnimationFrame(j, i); + } + else + { + return null; + } + } + + public JsonElement serialize(AnimationMetadataSection p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) + { + JsonObject jsonobject = new JsonObject(); + jsonobject.addProperty("frametime", (Number)Integer.valueOf(p_serialize_1_.getFrameTime())); + + if (p_serialize_1_.getFrameWidth() != -1) + { + jsonobject.addProperty("width", (Number)Integer.valueOf(p_serialize_1_.getFrameWidth())); + } + + if (p_serialize_1_.getFrameHeight() != -1) + { + jsonobject.addProperty("height", (Number)Integer.valueOf(p_serialize_1_.getFrameHeight())); + } + + if (p_serialize_1_.getFrameCount() > 0) + { + JsonArray jsonarray = new JsonArray(); + + for (int i = 0; i < p_serialize_1_.getFrameCount(); ++i) + { + if (p_serialize_1_.frameHasTime(i)) + { + JsonObject jsonobject1 = new JsonObject(); + jsonobject1.addProperty("index", (Number)Integer.valueOf(p_serialize_1_.getFrameIndex(i))); + jsonobject1.addProperty("time", (Number)Integer.valueOf(p_serialize_1_.getFrameTimeSingle(i))); + jsonarray.add(jsonobject1); + } + else + { + jsonarray.add(new JsonPrimitive(Integer.valueOf(p_serialize_1_.getFrameIndex(i)))); + } + } + + jsonobject.add("frames", jsonarray); + } + + return jsonobject; + } + + /** + * The name of this section type as it appears in JSON. + */ + public String getSectionName() + { + return "animation"; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/data/BaseMetadataSectionSerializer.java b/src/minecraft/net/minecraft/client/resources/data/BaseMetadataSectionSerializer.java new file mode 100644 index 0000000..142fb40 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/BaseMetadataSectionSerializer.java @@ -0,0 +1,5 @@ +package net.minecraft.client.resources.data; + +public abstract class BaseMetadataSectionSerializer implements IMetadataSectionSerializer +{ +} diff --git a/src/minecraft/net/minecraft/client/resources/data/FontMetadataSection.java b/src/minecraft/net/minecraft/client/resources/data/FontMetadataSection.java new file mode 100644 index 0000000..84f9534 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/FontMetadataSection.java @@ -0,0 +1,15 @@ +package net.minecraft.client.resources.data; + +public class FontMetadataSection implements IMetadataSection +{ + private final float[] charWidths; + private final float[] charLefts; + private final float[] charSpacings; + + public FontMetadataSection(float[] p_i1310_1_, float[] p_i1310_2_, float[] p_i1310_3_) + { + this.charWidths = p_i1310_1_; + this.charLefts = p_i1310_2_; + this.charSpacings = p_i1310_3_; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/data/FontMetadataSectionSerializer.java b/src/minecraft/net/minecraft/client/resources/data/FontMetadataSectionSerializer.java new file mode 100644 index 0000000..799456c --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/FontMetadataSectionSerializer.java @@ -0,0 +1,82 @@ +package net.minecraft.client.resources.data; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.lang.reflect.Type; +import net.minecraft.util.JsonUtils; +import org.apache.commons.lang3.Validate; + +public class FontMetadataSectionSerializer extends BaseMetadataSectionSerializer +{ + public FontMetadataSection deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + float[] afloat = new float[256]; + float[] afloat1 = new float[256]; + float[] afloat2 = new float[256]; + float f = 1.0F; + float f1 = 0.0F; + float f2 = 0.0F; + + if (jsonobject.has("characters")) + { + if (!jsonobject.get("characters").isJsonObject()) + { + throw new JsonParseException("Invalid font->characters: expected object, was " + jsonobject.get("characters")); + } + + JsonObject jsonobject1 = jsonobject.getAsJsonObject("characters"); + + if (jsonobject1.has("default")) + { + if (!jsonobject1.get("default").isJsonObject()) + { + throw new JsonParseException("Invalid font->characters->default: expected object, was " + jsonobject1.get("default")); + } + + JsonObject jsonobject2 = jsonobject1.getAsJsonObject("default"); + f = JsonUtils.getFloat(jsonobject2, "width", f); + Validate.inclusiveBetween(0.0D, 3.4028234663852886E38D, (double)f, "Invalid default width"); + f1 = JsonUtils.getFloat(jsonobject2, "spacing", f1); + Validate.inclusiveBetween(0.0D, 3.4028234663852886E38D, (double)f1, "Invalid default spacing"); + f2 = JsonUtils.getFloat(jsonobject2, "left", f1); + Validate.inclusiveBetween(0.0D, 3.4028234663852886E38D, (double)f2, "Invalid default left"); + } + + for (int i = 0; i < 256; ++i) + { + JsonElement jsonelement = jsonobject1.get(Integer.toString(i)); + float f3 = f; + float f4 = f1; + float f5 = f2; + + if (jsonelement != null) + { + JsonObject jsonobject3 = JsonUtils.getJsonObject(jsonelement, "characters[" + i + "]"); + f3 = JsonUtils.getFloat(jsonobject3, "width", f); + Validate.inclusiveBetween(0.0D, 3.4028234663852886E38D, (double)f3, "Invalid width"); + f4 = JsonUtils.getFloat(jsonobject3, "spacing", f1); + Validate.inclusiveBetween(0.0D, 3.4028234663852886E38D, (double)f4, "Invalid spacing"); + f5 = JsonUtils.getFloat(jsonobject3, "left", f2); + Validate.inclusiveBetween(0.0D, 3.4028234663852886E38D, (double)f5, "Invalid left"); + } + + afloat[i] = f3; + afloat1[i] = f4; + afloat2[i] = f5; + } + } + + return new FontMetadataSection(afloat, afloat2, afloat1); + } + + /** + * The name of this section type as it appears in JSON. + */ + public String getSectionName() + { + return "font"; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/data/IMetadataSection.java b/src/minecraft/net/minecraft/client/resources/data/IMetadataSection.java new file mode 100644 index 0000000..a2df0d1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/IMetadataSection.java @@ -0,0 +1,5 @@ +package net.minecraft.client.resources.data; + +public interface IMetadataSection +{ +} diff --git a/src/minecraft/net/minecraft/client/resources/data/IMetadataSectionSerializer.java b/src/minecraft/net/minecraft/client/resources/data/IMetadataSectionSerializer.java new file mode 100644 index 0000000..2d5a172 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/IMetadataSectionSerializer.java @@ -0,0 +1,11 @@ +package net.minecraft.client.resources.data; + +import com.google.gson.JsonDeserializer; + +public interface IMetadataSectionSerializer extends JsonDeserializer +{ + /** + * The name of this section type as it appears in JSON. + */ + String getSectionName(); +} diff --git a/src/minecraft/net/minecraft/client/resources/data/IMetadataSerializer.java b/src/minecraft/net/minecraft/client/resources/data/IMetadataSerializer.java new file mode 100644 index 0000000..6585627 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/IMetadataSerializer.java @@ -0,0 +1,90 @@ +package net.minecraft.client.resources.data; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.EnumTypeAdapterFactory; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.IRegistry; +import net.minecraft.util.RegistrySimple; + +public class IMetadataSerializer +{ + private final IRegistry < String, IMetadataSerializer.Registration > metadataSectionSerializerRegistry = new RegistrySimple(); + private final GsonBuilder gsonBuilder = new GsonBuilder(); + + /** + * Cached Gson instance. Set to null when more sections are registered, and then re-created from the builder. + */ + private Gson gson; + + public IMetadataSerializer() + { + this.gsonBuilder.registerTypeHierarchyAdapter(IChatComponent.class, new IChatComponent.Serializer()); + this.gsonBuilder.registerTypeHierarchyAdapter(ChatStyle.class, new ChatStyle.Serializer()); + this.gsonBuilder.registerTypeAdapterFactory(new EnumTypeAdapterFactory()); + } + + public void registerMetadataSectionType(IMetadataSectionSerializer p_110504_1_, Class p_110504_2_) + { + this.metadataSectionSerializerRegistry.putObject(p_110504_1_.getSectionName(), new IMetadataSerializer.Registration(p_110504_1_, p_110504_2_)); + this.gsonBuilder.registerTypeAdapter(p_110504_2_, p_110504_1_); + this.gson = null; + } + + public T parseMetadataSection(String p_110503_1_, JsonObject p_110503_2_) + { + if (p_110503_1_ == null) + { + throw new IllegalArgumentException("Metadata section name cannot be null"); + } + else if (!p_110503_2_.has(p_110503_1_)) + { + return (T)null; + } + else if (!p_110503_2_.get(p_110503_1_).isJsonObject()) + { + throw new IllegalArgumentException("Invalid metadata for \'" + p_110503_1_ + "\' - expected object, found " + p_110503_2_.get(p_110503_1_)); + } + else + { + IMetadataSerializer.Registration registration = (IMetadataSerializer.Registration)this.metadataSectionSerializerRegistry.getObject(p_110503_1_); + + if (registration == null) + { + throw new IllegalArgumentException("Don\'t know how to handle metadata section \'" + p_110503_1_ + "\'"); + } + else + { + return (T)((IMetadataSection)this.getGson().fromJson((JsonElement)p_110503_2_.getAsJsonObject(p_110503_1_), registration.field_110500_b)); + } + } + } + + /** + * Returns a Gson instance with type adapters registered for metadata sections. + */ + private Gson getGson() + { + if (this.gson == null) + { + this.gson = this.gsonBuilder.create(); + } + + return this.gson; + } + + class Registration + { + final IMetadataSectionSerializer field_110502_a; + final Class field_110500_b; + + private Registration(IMetadataSectionSerializer p_i1305_2_, Class p_i1305_3_) + { + this.field_110502_a = p_i1305_2_; + this.field_110500_b = p_i1305_3_; + } + } +} diff --git a/src/minecraft/net/minecraft/client/resources/data/LanguageMetadataSection.java b/src/minecraft/net/minecraft/client/resources/data/LanguageMetadataSection.java new file mode 100644 index 0000000..7b365b1 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/LanguageMetadataSection.java @@ -0,0 +1,19 @@ +package net.minecraft.client.resources.data; + +import java.util.Collection; +import net.minecraft.client.resources.Language; + +public class LanguageMetadataSection implements IMetadataSection +{ + private final Collection languages; + + public LanguageMetadataSection(Collection p_i1311_1_) + { + this.languages = p_i1311_1_; + } + + public Collection getLanguages() + { + return this.languages; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/data/LanguageMetadataSectionSerializer.java b/src/minecraft/net/minecraft/client/resources/data/LanguageMetadataSectionSerializer.java new file mode 100644 index 0000000..9de1b36 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/LanguageMetadataSectionSerializer.java @@ -0,0 +1,55 @@ +package net.minecraft.client.resources.data; + +import com.google.common.collect.Sets; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.lang.reflect.Type; +import java.util.Set; +import java.util.Map.Entry; +import net.minecraft.client.resources.Language; +import net.minecraft.util.JsonUtils; + +public class LanguageMetadataSectionSerializer extends BaseMetadataSectionSerializer +{ + public LanguageMetadataSection deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + Set set = Sets.newHashSet(); + + for (Entry entry : jsonobject.entrySet()) + { + String s = (String)entry.getKey(); + JsonObject jsonobject1 = JsonUtils.getJsonObject((JsonElement)entry.getValue(), "language"); + String s1 = JsonUtils.getString(jsonobject1, "region"); + String s2 = JsonUtils.getString(jsonobject1, "name"); + boolean flag = JsonUtils.getBoolean(jsonobject1, "bidirectional", false); + + if (s1.isEmpty()) + { + throw new JsonParseException("Invalid language->\'" + s + "\'->region: empty value"); + } + + if (s2.isEmpty()) + { + throw new JsonParseException("Invalid language->\'" + s + "\'->name: empty value"); + } + + if (!set.add(new Language(s, s1, s2, flag))) + { + throw new JsonParseException("Duplicate language->\'" + s + "\' defined"); + } + } + + return new LanguageMetadataSection(set); + } + + /** + * The name of this section type as it appears in JSON. + */ + public String getSectionName() + { + return "language"; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/data/PackMetadataSection.java b/src/minecraft/net/minecraft/client/resources/data/PackMetadataSection.java new file mode 100644 index 0000000..0698874 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/PackMetadataSection.java @@ -0,0 +1,25 @@ +package net.minecraft.client.resources.data; + +import net.minecraft.util.IChatComponent; + +public class PackMetadataSection implements IMetadataSection +{ + private final IChatComponent packDescription; + private final int packFormat; + + public PackMetadataSection(IChatComponent p_i1034_1_, int p_i1034_2_) + { + this.packDescription = p_i1034_1_; + this.packFormat = p_i1034_2_; + } + + public IChatComponent getPackDescription() + { + return this.packDescription; + } + + public int getPackFormat() + { + return this.packFormat; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/data/PackMetadataSectionSerializer.java b/src/minecraft/net/minecraft/client/resources/data/PackMetadataSectionSerializer.java new file mode 100644 index 0000000..096cd1c --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/PackMetadataSectionSerializer.java @@ -0,0 +1,46 @@ +package net.minecraft.client.resources.data; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.JsonUtils; + +public class PackMetadataSectionSerializer extends BaseMetadataSectionSerializer implements JsonSerializer +{ + public PackMetadataSection deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + IChatComponent ichatcomponent = (IChatComponent)p_deserialize_3_.deserialize(jsonobject.get("description"), IChatComponent.class); + + if (ichatcomponent == null) + { + throw new JsonParseException("Invalid/missing description!"); + } + else + { + int i = JsonUtils.getInt(jsonobject, "pack_format"); + return new PackMetadataSection(ichatcomponent, i); + } + } + + public JsonElement serialize(PackMetadataSection p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) + { + JsonObject jsonobject = new JsonObject(); + jsonobject.addProperty("pack_format", (Number)Integer.valueOf(p_serialize_1_.getPackFormat())); + jsonobject.add("description", p_serialize_3_.serialize(p_serialize_1_.getPackDescription())); + return jsonobject; + } + + /** + * The name of this section type as it appears in JSON. + */ + public String getSectionName() + { + return "pack"; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/data/TextureMetadataSection.java b/src/minecraft/net/minecraft/client/resources/data/TextureMetadataSection.java new file mode 100644 index 0000000..bec31d6 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/TextureMetadataSection.java @@ -0,0 +1,33 @@ +package net.minecraft.client.resources.data; + +import java.util.Collections; +import java.util.List; + +public class TextureMetadataSection implements IMetadataSection +{ + private final boolean textureBlur; + private final boolean textureClamp; + private final List listMipmaps; + + public TextureMetadataSection(boolean p_i45102_1_, boolean p_i45102_2_, List p_i45102_3_) + { + this.textureBlur = p_i45102_1_; + this.textureClamp = p_i45102_2_; + this.listMipmaps = p_i45102_3_; + } + + public boolean getTextureBlur() + { + return this.textureBlur; + } + + public boolean getTextureClamp() + { + return this.textureClamp; + } + + public List getListMipmaps() + { + return Collections.unmodifiableList(this.listMipmaps); + } +} diff --git a/src/minecraft/net/minecraft/client/resources/data/TextureMetadataSectionSerializer.java b/src/minecraft/net/minecraft/client/resources/data/TextureMetadataSectionSerializer.java new file mode 100644 index 0000000..ed8f76a --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/data/TextureMetadataSectionSerializer.java @@ -0,0 +1,65 @@ +package net.minecraft.client.resources.data; + +import com.google.common.collect.Lists; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.lang.reflect.Type; +import java.util.List; +import net.minecraft.util.JsonUtils; + +public class TextureMetadataSectionSerializer extends BaseMetadataSectionSerializer +{ + public TextureMetadataSection deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + boolean flag = JsonUtils.getBoolean(jsonobject, "blur", false); + boolean flag1 = JsonUtils.getBoolean(jsonobject, "clamp", false); + List list = Lists.newArrayList(); + + if (jsonobject.has("mipmaps")) + { + try + { + JsonArray jsonarray = jsonobject.getAsJsonArray("mipmaps"); + + for (int i = 0; i < jsonarray.size(); ++i) + { + JsonElement jsonelement = jsonarray.get(i); + + if (jsonelement.isJsonPrimitive()) + { + try + { + list.add(Integer.valueOf(jsonelement.getAsInt())); + } + catch (NumberFormatException numberformatexception) + { + throw new JsonParseException("Invalid texture->mipmap->" + i + ": expected number, was " + jsonelement, numberformatexception); + } + } + else if (jsonelement.isJsonObject()) + { + throw new JsonParseException("Invalid texture->mipmap->" + i + ": expected number, was " + jsonelement); + } + } + } + catch (ClassCastException classcastexception) + { + throw new JsonParseException("Invalid texture->mipmaps: expected array, was " + jsonobject.get("mipmaps"), classcastexception); + } + } + + return new TextureMetadataSection(flag, flag1, list); + } + + /** + * The name of this section type as it appears in JSON. + */ + public String getSectionName() + { + return "texture"; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/model/BuiltInModel.java b/src/minecraft/net/minecraft/client/resources/model/BuiltInModel.java new file mode 100644 index 0000000..6a496ae --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/model/BuiltInModel.java @@ -0,0 +1,52 @@ +package net.minecraft.client.resources.model; + +import java.util.List; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; + +public class BuiltInModel implements IBakedModel +{ + private ItemCameraTransforms cameraTransforms; + + public BuiltInModel(ItemCameraTransforms p_i46086_1_) + { + this.cameraTransforms = p_i46086_1_; + } + + public List getFaceQuads(EnumFacing p_177551_1_) + { + return null; + } + + public List getGeneralQuads() + { + return null; + } + + public boolean isAmbientOcclusion() + { + return false; + } + + public boolean isGui3d() + { + return true; + } + + public boolean isBuiltInRenderer() + { + return true; + } + + public TextureAtlasSprite getParticleTexture() + { + return null; + } + + public ItemCameraTransforms getItemCameraTransforms() + { + return this.cameraTransforms; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/model/IBakedModel.java b/src/minecraft/net/minecraft/client/resources/model/IBakedModel.java new file mode 100644 index 0000000..ea419d7 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/model/IBakedModel.java @@ -0,0 +1,24 @@ +package net.minecraft.client.resources.model; + +import java.util.List; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; + +public interface IBakedModel +{ + List getFaceQuads(EnumFacing p_177551_1_); + + List getGeneralQuads(); + + boolean isAmbientOcclusion(); + + boolean isGui3d(); + + boolean isBuiltInRenderer(); + + TextureAtlasSprite getParticleTexture(); + + ItemCameraTransforms getItemCameraTransforms(); +} diff --git a/src/minecraft/net/minecraft/client/resources/model/ModelBakery.java b/src/minecraft/net/minecraft/client/resources/model/ModelBakery.java new file mode 100644 index 0000000..109ab5a --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/model/ModelBakery.java @@ -0,0 +1,722 @@ +package net.minecraft.client.resources.model; + +import com.google.common.base.Charsets; +import com.google.common.base.Joiner; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Queues; +import com.google.common.collect.Sets; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StringReader; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Deque; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; +import net.minecraft.client.renderer.BlockModelShapes; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.BlockPart; +import net.minecraft.client.renderer.block.model.BlockPartFace; +import net.minecraft.client.renderer.block.model.FaceBakery; +import net.minecraft.client.renderer.block.model.ItemModelGenerator; +import net.minecraft.client.renderer.block.model.ModelBlock; +import net.minecraft.client.renderer.block.model.ModelBlockDefinition; +import net.minecraft.client.renderer.texture.IIconCreator; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IRegistry; +import net.minecraft.util.RegistrySimple; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ModelBakery +{ + private static final Set LOCATIONS_BUILTIN_TEXTURES = Sets.newHashSet(new ResourceLocation[] {new ResourceLocation("blocks/water_flow"), new ResourceLocation("blocks/water_still"), new ResourceLocation("blocks/lava_flow"), new ResourceLocation("blocks/lava_still"), new ResourceLocation("blocks/destroy_stage_0"), new ResourceLocation("blocks/destroy_stage_1"), new ResourceLocation("blocks/destroy_stage_2"), new ResourceLocation("blocks/destroy_stage_3"), new ResourceLocation("blocks/destroy_stage_4"), new ResourceLocation("blocks/destroy_stage_5"), new ResourceLocation("blocks/destroy_stage_6"), new ResourceLocation("blocks/destroy_stage_7"), new ResourceLocation("blocks/destroy_stage_8"), new ResourceLocation("blocks/destroy_stage_9"), new ResourceLocation("items/empty_armor_slot_helmet"), new ResourceLocation("items/empty_armor_slot_chestplate"), new ResourceLocation("items/empty_armor_slot_leggings"), new ResourceLocation("items/empty_armor_slot_boots")}); + private static final Logger LOGGER = LogManager.getLogger(); + protected static final ModelResourceLocation MODEL_MISSING = new ModelResourceLocation("builtin/missing", "missing"); + private static final Map BUILT_IN_MODELS = Maps.newHashMap(); + private static final Joiner JOINER = Joiner.on(" -> "); + private final IResourceManager resourceManager; + private final Map sprites = Maps.newHashMap(); + private final Map models = Maps.newLinkedHashMap(); + private final Map variants = Maps.newLinkedHashMap(); + private final TextureMap textureMap; + private final BlockModelShapes blockModelShapes; + private final FaceBakery faceBakery = new FaceBakery(); + private final ItemModelGenerator itemModelGenerator = new ItemModelGenerator(); + private RegistrySimple bakedRegistry = new RegistrySimple(); + private static final ModelBlock MODEL_GENERATED = ModelBlock.deserialize("{\"elements\":[{ \"from\": [0, 0, 0], \"to\": [16, 16, 16], \"faces\": { \"down\": {\"uv\": [0, 0, 16, 16], \"texture\":\"\"} }}]}"); + private static final ModelBlock MODEL_COMPASS = ModelBlock.deserialize("{\"elements\":[{ \"from\": [0, 0, 0], \"to\": [16, 16, 16], \"faces\": { \"down\": {\"uv\": [0, 0, 16, 16], \"texture\":\"\"} }}]}"); + private static final ModelBlock MODEL_CLOCK = ModelBlock.deserialize("{\"elements\":[{ \"from\": [0, 0, 0], \"to\": [16, 16, 16], \"faces\": { \"down\": {\"uv\": [0, 0, 16, 16], \"texture\":\"\"} }}]}"); + private static final ModelBlock MODEL_ENTITY = ModelBlock.deserialize("{\"elements\":[{ \"from\": [0, 0, 0], \"to\": [16, 16, 16], \"faces\": { \"down\": {\"uv\": [0, 0, 16, 16], \"texture\":\"\"} }}]}"); + private Map itemLocations = Maps.newLinkedHashMap(); + private final Map blockDefinitions = Maps.newHashMap(); + private Map> variantNames = Maps.>newIdentityHashMap(); + + public ModelBakery(IResourceManager p_i46085_1_, TextureMap p_i46085_2_, BlockModelShapes p_i46085_3_) + { + this.resourceManager = p_i46085_1_; + this.textureMap = p_i46085_2_; + this.blockModelShapes = p_i46085_3_; + } + + public IRegistry setupModelRegistry() + { + this.loadVariantItemModels(); + this.loadModelsCheck(); + this.loadSprites(); + this.bakeItemModels(); + this.bakeBlockModels(); + return this.bakedRegistry; + } + + private void loadVariantItemModels() + { + this.loadVariants(this.blockModelShapes.getBlockStateMapper().putAllStateModelLocations().values()); + this.variants.put(MODEL_MISSING, new ModelBlockDefinition.Variants(MODEL_MISSING.getVariant(), Lists.newArrayList(new ModelBlockDefinition.Variant[] {new ModelBlockDefinition.Variant(new ResourceLocation(MODEL_MISSING.getResourcePath()), ModelRotation.X0_Y0, false, 1)}))); + ResourceLocation resourcelocation = new ResourceLocation("item_frame"); + ModelBlockDefinition modelblockdefinition = this.getModelBlockDefinition(resourcelocation); + this.registerVariant(modelblockdefinition, new ModelResourceLocation(resourcelocation, "normal")); + this.registerVariant(modelblockdefinition, new ModelResourceLocation(resourcelocation, "map")); + this.loadVariantModels(); + this.loadItemModels(); + } + + private void loadVariants(Collection p_177591_1_) + { + for (ModelResourceLocation modelresourcelocation : p_177591_1_) + { + try + { + ModelBlockDefinition modelblockdefinition = this.getModelBlockDefinition(modelresourcelocation); + + try + { + this.registerVariant(modelblockdefinition, modelresourcelocation); + } + catch (Exception var6) + { + LOGGER.warn("Unable to load variant: " + modelresourcelocation.getVariant() + " from " + modelresourcelocation); + } + } + catch (Exception exception) + { + LOGGER.warn((String)("Unable to load definition " + modelresourcelocation), (Throwable)exception); + } + } + } + + private void registerVariant(ModelBlockDefinition p_177569_1_, ModelResourceLocation p_177569_2_) + { + this.variants.put(p_177569_2_, p_177569_1_.getVariants(p_177569_2_.getVariant())); + } + + private ModelBlockDefinition getModelBlockDefinition(ResourceLocation p_177586_1_) + { + ResourceLocation resourcelocation = this.getBlockStateLocation(p_177586_1_); + ModelBlockDefinition modelblockdefinition = (ModelBlockDefinition)this.blockDefinitions.get(resourcelocation); + + if (modelblockdefinition == null) + { + List list = Lists.newArrayList(); + + try + { + for (IResource iresource : this.resourceManager.getAllResources(resourcelocation)) + { + InputStream inputstream = null; + + try + { + inputstream = iresource.getInputStream(); + ModelBlockDefinition modelblockdefinition1 = ModelBlockDefinition.parseFromReader(new InputStreamReader(inputstream, Charsets.UTF_8)); + list.add(modelblockdefinition1); + } + catch (Exception exception) + { + throw new RuntimeException("Encountered an exception when loading model definition of \'" + p_177586_1_ + "\' from: \'" + iresource.getResourceLocation() + "\' in resourcepack: \'" + iresource.getResourcePackName() + "\'", exception); + } + finally + { + IOUtils.closeQuietly(inputstream); + } + } + } + catch (IOException ioexception) + { + throw new RuntimeException("Encountered an exception when loading model definition of model " + resourcelocation.toString(), ioexception); + } + + modelblockdefinition = new ModelBlockDefinition(list); + this.blockDefinitions.put(resourcelocation, modelblockdefinition); + } + + return modelblockdefinition; + } + + private ResourceLocation getBlockStateLocation(ResourceLocation p_177584_1_) + { + return new ResourceLocation(p_177584_1_.getResourceDomain(), "blockstates/" + p_177584_1_.getResourcePath() + ".json"); + } + + private void loadVariantModels() + { + for (ModelResourceLocation modelresourcelocation : this.variants.keySet()) + { + for (ModelBlockDefinition.Variant modelblockdefinition$variant : ((ModelBlockDefinition.Variants)this.variants.get(modelresourcelocation)).getVariants()) + { + ResourceLocation resourcelocation = modelblockdefinition$variant.getModelLocation(); + + if (this.models.get(resourcelocation) == null) + { + try + { + ModelBlock modelblock = this.loadModel(resourcelocation); + this.models.put(resourcelocation, modelblock); + } + catch (Exception exception) + { + LOGGER.warn((String)("Unable to load block model: \'" + resourcelocation + "\' for variant: \'" + modelresourcelocation + "\'"), (Throwable)exception); + } + } + } + } + } + + private ModelBlock loadModel(ResourceLocation p_177594_1_) throws IOException + { + String s = p_177594_1_.getResourcePath(); + + if ("builtin/generated".equals(s)) + { + return MODEL_GENERATED; + } + else if ("builtin/compass".equals(s)) + { + return MODEL_COMPASS; + } + else if ("builtin/clock".equals(s)) + { + return MODEL_CLOCK; + } + else if ("builtin/entity".equals(s)) + { + return MODEL_ENTITY; + } + else + { + Reader reader; + + if (s.startsWith("builtin/")) + { + String s1 = s.substring("builtin/".length()); + String s2 = (String)BUILT_IN_MODELS.get(s1); + + if (s2 == null) + { + throw new FileNotFoundException(p_177594_1_.toString()); + } + + reader = new StringReader(s2); + } + else + { + IResource iresource = this.resourceManager.getResource(this.getModelLocation(p_177594_1_)); + reader = new InputStreamReader(iresource.getInputStream(), Charsets.UTF_8); + } + + ModelBlock modelblock1; + + try + { + ModelBlock modelblock = ModelBlock.deserialize(reader); + modelblock.name = p_177594_1_.toString(); + modelblock1 = modelblock; + } + finally + { + reader.close(); + } + + return modelblock1; + } + } + + private ResourceLocation getModelLocation(ResourceLocation p_177580_1_) + { + return new ResourceLocation(p_177580_1_.getResourceDomain(), "models/" + p_177580_1_.getResourcePath() + ".json"); + } + + private void loadItemModels() + { + this.registerVariantNames(); + + for (Item item : Item.itemRegistry) + { + for (String s : this.getVariantNames(item)) + { + ResourceLocation resourcelocation = this.getItemLocation(s); + this.itemLocations.put(s, resourcelocation); + + if (this.models.get(resourcelocation) == null) + { + try + { + ModelBlock modelblock = this.loadModel(resourcelocation); + this.models.put(resourcelocation, modelblock); + } + catch (Exception exception) + { + LOGGER.warn((String)("Unable to load item model: \'" + resourcelocation + "\' for item: \'" + Item.itemRegistry.getNameForObject(item) + "\'"), (Throwable)exception); + } + } + } + } + } + + private void registerVariantNames() + { + this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.dirt), Lists.newArrayList(new String[] {"dirt", "coarse_dirt", "podzol"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.planks), Lists.newArrayList(new String[] {"oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.sapling), Lists.newArrayList(new String[] {"oak_sapling", "spruce_sapling", "birch_sapling", "jungle_sapling", "acacia_sapling", "dark_oak_sapling"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.sand), Lists.newArrayList(new String[] {"sand", "red_sand"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.log), Lists.newArrayList(new String[] {"oak_log", "spruce_log", "birch_log", "jungle_log"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.leaves), Lists.newArrayList(new String[] {"oak_leaves", "spruce_leaves", "birch_leaves", "jungle_leaves"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.sponge), Lists.newArrayList(new String[] {"sponge", "sponge_wet"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.sandstone), Lists.newArrayList(new String[] {"sandstone", "chiseled_sandstone", "smooth_sandstone"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.red_sandstone), Lists.newArrayList(new String[] {"red_sandstone", "chiseled_red_sandstone", "smooth_red_sandstone"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.tallgrass), Lists.newArrayList(new String[] {"dead_bush", "tall_grass", "fern"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.deadbush), Lists.newArrayList(new String[] {"dead_bush"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.wool), Lists.newArrayList(new String[] {"black_wool", "red_wool", "green_wool", "brown_wool", "blue_wool", "purple_wool", "cyan_wool", "silver_wool", "gray_wool", "pink_wool", "lime_wool", "yellow_wool", "light_blue_wool", "magenta_wool", "orange_wool", "white_wool"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.yellow_flower), Lists.newArrayList(new String[] {"dandelion"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.red_flower), Lists.newArrayList(new String[] {"poppy", "blue_orchid", "allium", "houstonia", "red_tulip", "orange_tulip", "white_tulip", "pink_tulip", "oxeye_daisy"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.stone_slab), Lists.newArrayList(new String[] {"stone_slab", "sandstone_slab", "cobblestone_slab", "brick_slab", "stone_brick_slab", "nether_brick_slab", "quartz_slab"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.stone_slab2), Lists.newArrayList(new String[] {"red_sandstone_slab"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.stained_glass), Lists.newArrayList(new String[] {"black_stained_glass", "red_stained_glass", "green_stained_glass", "brown_stained_glass", "blue_stained_glass", "purple_stained_glass", "cyan_stained_glass", "silver_stained_glass", "gray_stained_glass", "pink_stained_glass", "lime_stained_glass", "yellow_stained_glass", "light_blue_stained_glass", "magenta_stained_glass", "orange_stained_glass", "white_stained_glass"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.monster_egg), Lists.newArrayList(new String[] {"stone_monster_egg", "cobblestone_monster_egg", "stone_brick_monster_egg", "mossy_brick_monster_egg", "cracked_brick_monster_egg", "chiseled_brick_monster_egg"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.stonebrick), Lists.newArrayList(new String[] {"stonebrick", "mossy_stonebrick", "cracked_stonebrick", "chiseled_stonebrick"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.wooden_slab), Lists.newArrayList(new String[] {"oak_slab", "spruce_slab", "birch_slab", "jungle_slab", "acacia_slab", "dark_oak_slab"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.cobblestone_wall), Lists.newArrayList(new String[] {"cobblestone_wall", "mossy_cobblestone_wall"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.anvil), Lists.newArrayList(new String[] {"anvil_intact", "anvil_slightly_damaged", "anvil_very_damaged"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.quartz_block), Lists.newArrayList(new String[] {"quartz_block", "chiseled_quartz_block", "quartz_column"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.stained_hardened_clay), Lists.newArrayList(new String[] {"black_stained_hardened_clay", "red_stained_hardened_clay", "green_stained_hardened_clay", "brown_stained_hardened_clay", "blue_stained_hardened_clay", "purple_stained_hardened_clay", "cyan_stained_hardened_clay", "silver_stained_hardened_clay", "gray_stained_hardened_clay", "pink_stained_hardened_clay", "lime_stained_hardened_clay", "yellow_stained_hardened_clay", "light_blue_stained_hardened_clay", "magenta_stained_hardened_clay", "orange_stained_hardened_clay", "white_stained_hardened_clay"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.stained_glass_pane), Lists.newArrayList(new String[] {"black_stained_glass_pane", "red_stained_glass_pane", "green_stained_glass_pane", "brown_stained_glass_pane", "blue_stained_glass_pane", "purple_stained_glass_pane", "cyan_stained_glass_pane", "silver_stained_glass_pane", "gray_stained_glass_pane", "pink_stained_glass_pane", "lime_stained_glass_pane", "yellow_stained_glass_pane", "light_blue_stained_glass_pane", "magenta_stained_glass_pane", "orange_stained_glass_pane", "white_stained_glass_pane"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.leaves2), Lists.newArrayList(new String[] {"acacia_leaves", "dark_oak_leaves"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.log2), Lists.newArrayList(new String[] {"acacia_log", "dark_oak_log"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.prismarine), Lists.newArrayList(new String[] {"prismarine", "prismarine_bricks", "dark_prismarine"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.carpet), Lists.newArrayList(new String[] {"black_carpet", "red_carpet", "green_carpet", "brown_carpet", "blue_carpet", "purple_carpet", "cyan_carpet", "silver_carpet", "gray_carpet", "pink_carpet", "lime_carpet", "yellow_carpet", "light_blue_carpet", "magenta_carpet", "orange_carpet", "white_carpet"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.double_plant), Lists.newArrayList(new String[] {"sunflower", "syringa", "double_grass", "double_fern", "double_rose", "paeonia"})); + this.variantNames.put(Items.bow, Lists.newArrayList(new String[] {"bow", "bow_pulling_0", "bow_pulling_1", "bow_pulling_2"})); + this.variantNames.put(Items.coal, Lists.newArrayList(new String[] {"coal", "charcoal"})); + this.variantNames.put(Items.fishing_rod, Lists.newArrayList(new String[] {"fishing_rod", "fishing_rod_cast"})); + this.variantNames.put(Items.fish, Lists.newArrayList(new String[] {"cod", "salmon", "clownfish", "pufferfish"})); + this.variantNames.put(Items.cooked_fish, Lists.newArrayList(new String[] {"cooked_cod", "cooked_salmon"})); + this.variantNames.put(Items.dye, Lists.newArrayList(new String[] {"dye_black", "dye_red", "dye_green", "dye_brown", "dye_blue", "dye_purple", "dye_cyan", "dye_silver", "dye_gray", "dye_pink", "dye_lime", "dye_yellow", "dye_light_blue", "dye_magenta", "dye_orange", "dye_white"})); + this.variantNames.put(Items.potionitem, Lists.newArrayList(new String[] {"bottle_drinkable", "bottle_splash"})); + this.variantNames.put(Items.skull, Lists.newArrayList(new String[] {"skull_skeleton", "skull_wither", "skull_zombie", "skull_char", "skull_creeper"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence_gate), Lists.newArrayList(new String[] {"oak_fence_gate"})); + this.variantNames.put(Item.getItemFromBlock(Blocks.oak_fence), Lists.newArrayList(new String[] {"oak_fence"})); + this.variantNames.put(Items.oak_door, Lists.newArrayList(new String[] {"oak_door"})); + } + + private List getVariantNames(Item p_177596_1_) + { + List list = (List)this.variantNames.get(p_177596_1_); + + if (list == null) + { + list = Collections.singletonList(((ResourceLocation)Item.itemRegistry.getNameForObject(p_177596_1_)).toString()); + } + + return list; + } + + private ResourceLocation getItemLocation(String p_177583_1_) + { + ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_); + return new ResourceLocation(resourcelocation.getResourceDomain(), "item/" + resourcelocation.getResourcePath()); + } + + private void bakeBlockModels() + { + for (ModelResourceLocation modelresourcelocation : this.variants.keySet()) + { + WeightedBakedModel.Builder weightedbakedmodel$builder = new WeightedBakedModel.Builder(); + int i = 0; + + for (ModelBlockDefinition.Variant modelblockdefinition$variant : ((ModelBlockDefinition.Variants)this.variants.get(modelresourcelocation)).getVariants()) + { + ModelBlock modelblock = (ModelBlock)this.models.get(modelblockdefinition$variant.getModelLocation()); + + if (modelblock != null && modelblock.isResolved()) + { + ++i; + weightedbakedmodel$builder.add(this.bakeModel(modelblock, modelblockdefinition$variant.getRotation(), modelblockdefinition$variant.isUvLocked()), modelblockdefinition$variant.getWeight()); + } + else + { + LOGGER.warn("Missing model for: " + modelresourcelocation); + } + } + + if (i == 0) + { + LOGGER.warn("No weighted models for: " + modelresourcelocation); + } + else if (i == 1) + { + this.bakedRegistry.putObject(modelresourcelocation, weightedbakedmodel$builder.first()); + } + else + { + this.bakedRegistry.putObject(modelresourcelocation, weightedbakedmodel$builder.build()); + } + } + + for (Entry entry : this.itemLocations.entrySet()) + { + ResourceLocation resourcelocation = (ResourceLocation)entry.getValue(); + ModelResourceLocation modelresourcelocation1 = new ModelResourceLocation((String)entry.getKey(), "inventory"); + ModelBlock modelblock1 = (ModelBlock)this.models.get(resourcelocation); + + if (modelblock1 != null && modelblock1.isResolved()) + { + if (this.isCustomRenderer(modelblock1)) + { + this.bakedRegistry.putObject(modelresourcelocation1, new BuiltInModel(modelblock1.func_181682_g())); + } + else + { + this.bakedRegistry.putObject(modelresourcelocation1, this.bakeModel(modelblock1, ModelRotation.X0_Y0, false)); + } + } + else + { + LOGGER.warn("Missing model for: " + resourcelocation); + } + } + } + + private Set getVariantsTextureLocations() + { + Set set = Sets.newHashSet(); + List list = Lists.newArrayList(this.variants.keySet()); + Collections.sort(list, new Comparator() + { + public int compare(ModelResourceLocation p_compare_1_, ModelResourceLocation p_compare_2_) + { + return p_compare_1_.toString().compareTo(p_compare_2_.toString()); + } + }); + + for (ModelResourceLocation modelresourcelocation : list) + { + ModelBlockDefinition.Variants modelblockdefinition$variants = (ModelBlockDefinition.Variants)this.variants.get(modelresourcelocation); + + for (ModelBlockDefinition.Variant modelblockdefinition$variant : modelblockdefinition$variants.getVariants()) + { + ModelBlock modelblock = (ModelBlock)this.models.get(modelblockdefinition$variant.getModelLocation()); + + if (modelblock == null) + { + LOGGER.warn("Missing model for: " + modelresourcelocation); + } + else + { + set.addAll(this.getTextureLocations(modelblock)); + } + } + } + + set.addAll(LOCATIONS_BUILTIN_TEXTURES); + return set; + } + + private IBakedModel bakeModel(ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked) + { + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); + SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn)).setTexture(textureatlassprite); + + for (BlockPart blockpart : modelBlockIn.getElements()) + { + for (EnumFacing enumfacing : blockpart.mapFaces.keySet()) + { + BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); + TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); + + if (blockpartface.cullFace == null) + { + simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + else + { + simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotateFace(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); + } + } + } + + return simplebakedmodel$builder.makeBakedModel(); + } + + private BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_) + { + return this.faceBakery.makeBakedQuad(p_177589_1_.positionFrom, p_177589_1_.positionTo, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.partRotation, p_177589_6_, p_177589_1_.shade); + } + + private void loadModelsCheck() + { + this.loadModels(); + + for (ModelBlock modelblock : this.models.values()) + { + modelblock.getParentFromMap(this.models); + } + + ModelBlock.checkModelHierarchy(this.models); + } + + private void loadModels() + { + Deque deque = Queues.newArrayDeque(); + Set set = Sets.newHashSet(); + + for (ResourceLocation resourcelocation : this.models.keySet()) + { + set.add(resourcelocation); + ResourceLocation resourcelocation1 = ((ModelBlock)this.models.get(resourcelocation)).getParentLocation(); + + if (resourcelocation1 != null) + { + deque.add(resourcelocation1); + } + } + + while (!((Deque)deque).isEmpty()) + { + ResourceLocation resourcelocation2 = (ResourceLocation)deque.pop(); + + try + { + if (this.models.get(resourcelocation2) != null) + { + continue; + } + + ModelBlock modelblock = this.loadModel(resourcelocation2); + this.models.put(resourcelocation2, modelblock); + ResourceLocation resourcelocation3 = modelblock.getParentLocation(); + + if (resourcelocation3 != null && !set.contains(resourcelocation3)) + { + deque.add(resourcelocation3); + } + } + catch (Exception exception) + { + LOGGER.warn((String)("In parent chain: " + JOINER.join(this.getParentPath(resourcelocation2)) + "; unable to load model: \'" + resourcelocation2 + "\'"), (Throwable)exception); + } + + set.add(resourcelocation2); + } + } + + private List getParentPath(ResourceLocation p_177573_1_) + { + List list = Lists.newArrayList(new ResourceLocation[] {p_177573_1_}); + ResourceLocation resourcelocation = p_177573_1_; + + while ((resourcelocation = this.getParentLocation(resourcelocation)) != null) + { + list.add(0, resourcelocation); + } + + return list; + } + + private ResourceLocation getParentLocation(ResourceLocation p_177576_1_) + { + for (Entry entry : this.models.entrySet()) + { + ModelBlock modelblock = (ModelBlock)entry.getValue(); + + if (modelblock != null && p_177576_1_.equals(modelblock.getParentLocation())) + { + return (ResourceLocation)entry.getKey(); + } + } + + return null; + } + + private Set getTextureLocations(ModelBlock p_177585_1_) + { + Set set = Sets.newHashSet(); + + for (BlockPart blockpart : p_177585_1_.getElements()) + { + for (BlockPartFace blockpartface : blockpart.mapFaces.values()) + { + ResourceLocation resourcelocation = new ResourceLocation(p_177585_1_.resolveTextureName(blockpartface.texture)); + set.add(resourcelocation); + } + } + + set.add(new ResourceLocation(p_177585_1_.resolveTextureName("particle"))); + return set; + } + + private void loadSprites() + { + final Set set = this.getVariantsTextureLocations(); + set.addAll(this.getItemsTextureLocations()); + set.remove(TextureMap.LOCATION_MISSING_TEXTURE); + IIconCreator iiconcreator = new IIconCreator() + { + public void registerSprites(TextureMap iconRegistry) + { + for (ResourceLocation resourcelocation : set) + { + TextureAtlasSprite textureatlassprite = iconRegistry.registerSprite(resourcelocation); + ModelBakery.this.sprites.put(resourcelocation, textureatlassprite); + } + } + }; + this.textureMap.loadSprites(this.resourceManager, iiconcreator); + this.sprites.put(new ResourceLocation("missingno"), this.textureMap.getMissingSprite()); + } + + private Set getItemsTextureLocations() + { + Set set = Sets.newHashSet(); + + for (ResourceLocation resourcelocation : this.itemLocations.values()) + { + ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation); + + if (modelblock != null) + { + set.add(new ResourceLocation(modelblock.resolveTextureName("particle"))); + + if (this.hasItemModel(modelblock)) + { + for (String s : ItemModelGenerator.LAYERS) + { + ResourceLocation resourcelocation2 = new ResourceLocation(modelblock.resolveTextureName(s)); + + if (modelblock.getRootModel() == MODEL_COMPASS && !TextureMap.LOCATION_MISSING_TEXTURE.equals(resourcelocation2)) + { + TextureAtlasSprite.setLocationNameCompass(resourcelocation2.toString()); + } + else if (modelblock.getRootModel() == MODEL_CLOCK && !TextureMap.LOCATION_MISSING_TEXTURE.equals(resourcelocation2)) + { + TextureAtlasSprite.setLocationNameClock(resourcelocation2.toString()); + } + + set.add(resourcelocation2); + } + } + else if (!this.isCustomRenderer(modelblock)) + { + for (BlockPart blockpart : modelblock.getElements()) + { + for (BlockPartFace blockpartface : blockpart.mapFaces.values()) + { + ResourceLocation resourcelocation1 = new ResourceLocation(modelblock.resolveTextureName(blockpartface.texture)); + set.add(resourcelocation1); + } + } + } + } + } + + return set; + } + + private boolean hasItemModel(ModelBlock p_177581_1_) + { + if (p_177581_1_ == null) + { + return false; + } + else + { + ModelBlock modelblock = p_177581_1_.getRootModel(); + return modelblock == MODEL_GENERATED || modelblock == MODEL_COMPASS || modelblock == MODEL_CLOCK; + } + } + + private boolean isCustomRenderer(ModelBlock p_177587_1_) + { + if (p_177587_1_ == null) + { + return false; + } + else + { + ModelBlock modelblock = p_177587_1_.getRootModel(); + return modelblock == MODEL_ENTITY; + } + } + + private void bakeItemModels() + { + for (ResourceLocation resourcelocation : this.itemLocations.values()) + { + ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation); + + if (this.hasItemModel(modelblock)) + { + ModelBlock modelblock1 = this.makeItemModel(modelblock); + + if (modelblock1 != null) + { + modelblock1.name = resourcelocation.toString(); + } + + this.models.put(resourcelocation, modelblock1); + } + else if (this.isCustomRenderer(modelblock)) + { + this.models.put(resourcelocation, modelblock); + } + } + + for (TextureAtlasSprite textureatlassprite : this.sprites.values()) + { + if (!textureatlassprite.hasAnimationMetadata()) + { + textureatlassprite.clearFramesTextureData(); + } + } + } + + private ModelBlock makeItemModel(ModelBlock p_177582_1_) + { + return this.itemModelGenerator.makeItemModel(this.textureMap, p_177582_1_); + } + + static + { + BUILT_IN_MODELS.put("missing", "{ \"textures\": { \"particle\": \"missingno\", \"missingno\": \"missingno\"}, \"elements\": [ { \"from\": [ 0, 0, 0 ], \"to\": [ 16, 16, 16 ], \"faces\": { \"down\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"down\", \"texture\": \"#missingno\" }, \"up\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"up\", \"texture\": \"#missingno\" }, \"north\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"north\", \"texture\": \"#missingno\" }, \"south\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"south\", \"texture\": \"#missingno\" }, \"west\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"west\", \"texture\": \"#missingno\" }, \"east\": { \"uv\": [ 0, 0, 16, 16 ], \"cullface\": \"east\", \"texture\": \"#missingno\" } }}]}"); + MODEL_GENERATED.name = "generation marker"; + MODEL_COMPASS.name = "compass generation marker"; + MODEL_CLOCK.name = "class generation marker"; + MODEL_ENTITY.name = "block entity marker"; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/model/ModelManager.java b/src/minecraft/net/minecraft/client/resources/model/ModelManager.java new file mode 100644 index 0000000..8460bdb --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/model/ModelManager.java @@ -0,0 +1,57 @@ +package net.minecraft.client.resources.model; + +import net.minecraft.client.renderer.BlockModelShapes; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.util.IRegistry; + +public class ModelManager implements IResourceManagerReloadListener +{ + private IRegistry modelRegistry; + private final TextureMap texMap; + private final BlockModelShapes modelProvider; + private IBakedModel defaultModel; + + public ModelManager(TextureMap textures) + { + this.texMap = textures; + this.modelProvider = new BlockModelShapes(this); + } + + public void onResourceManagerReload(IResourceManager resourceManager) + { + ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); + this.modelRegistry = modelbakery.setupModelRegistry(); + this.defaultModel = (IBakedModel)this.modelRegistry.getObject(ModelBakery.MODEL_MISSING); + this.modelProvider.reloadModels(); + } + + public IBakedModel getModel(ModelResourceLocation modelLocation) + { + if (modelLocation == null) + { + return this.defaultModel; + } + else + { + IBakedModel ibakedmodel = (IBakedModel)this.modelRegistry.getObject(modelLocation); + return ibakedmodel == null ? this.defaultModel : ibakedmodel; + } + } + + public IBakedModel getMissingModel() + { + return this.defaultModel; + } + + public TextureMap getTextureMap() + { + return this.texMap; + } + + public BlockModelShapes getBlockModelShapes() + { + return this.modelProvider; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/model/ModelResourceLocation.java b/src/minecraft/net/minecraft/client/resources/model/ModelResourceLocation.java new file mode 100644 index 0000000..8596777 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/model/ModelResourceLocation.java @@ -0,0 +1,82 @@ +package net.minecraft.client.resources.model; + +import net.minecraft.util.ResourceLocation; +import org.apache.commons.lang3.StringUtils; + +public class ModelResourceLocation extends ResourceLocation +{ + private final String variant; + + protected ModelResourceLocation(int p_i46078_1_, String... p_i46078_2_) + { + super(0, new String[] {p_i46078_2_[0], p_i46078_2_[1]}); + this.variant = StringUtils.isEmpty(p_i46078_2_[2]) ? "normal" : p_i46078_2_[2].toLowerCase(); + } + + public ModelResourceLocation(String p_i46079_1_) + { + this(0, parsePathString(p_i46079_1_)); + } + + public ModelResourceLocation(ResourceLocation p_i46080_1_, String p_i46080_2_) + { + this(p_i46080_1_.toString(), p_i46080_2_); + } + + public ModelResourceLocation(String p_i46081_1_, String p_i46081_2_) + { + this(0, parsePathString(p_i46081_1_ + '#' + (p_i46081_2_ == null ? "normal" : p_i46081_2_))); + } + + protected static String[] parsePathString(String p_177517_0_) + { + String[] astring = new String[] {null, p_177517_0_, null}; + int i = p_177517_0_.indexOf(35); + String s = p_177517_0_; + + if (i >= 0) + { + astring[2] = p_177517_0_.substring(i + 1, p_177517_0_.length()); + + if (i > 1) + { + s = p_177517_0_.substring(0, i); + } + } + + System.arraycopy(ResourceLocation.splitObjectName(s), 0, astring, 0, 2); + return astring; + } + + public String getVariant() + { + return this.variant; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (p_equals_1_ instanceof ModelResourceLocation && super.equals(p_equals_1_)) + { + ModelResourceLocation modelresourcelocation = (ModelResourceLocation)p_equals_1_; + return this.variant.equals(modelresourcelocation.variant); + } + else + { + return false; + } + } + + public int hashCode() + { + return 31 * super.hashCode() + this.variant.hashCode(); + } + + public String toString() + { + return super.toString() + '#' + this.variant; + } +} diff --git a/src/minecraft/net/minecraft/client/resources/model/ModelRotation.java b/src/minecraft/net/minecraft/client/resources/model/ModelRotation.java new file mode 100644 index 0000000..e8556ac --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/model/ModelRotation.java @@ -0,0 +1,145 @@ +package net.minecraft.client.resources.model; + +import com.google.common.base.Optional; +import com.google.common.collect.Maps; +import java.util.Map; + +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraftforge.client.model.IModelPart; +import net.minecraftforge.client.model.IModelState; +import net.minecraftforge.client.model.ITransformation; +import net.minecraftforge.client.model.TRSRTransformation; +import optifine.Reflector; + +import org.lwjgl.util.vector.Matrix4f; +import org.lwjgl.util.vector.Vector3f; + +public enum ModelRotation implements IModelState, ITransformation +{ + X0_Y0("X0_Y0", 0, 0, 0), + X0_Y90("X0_Y90", 1, 0, 90), + X0_Y180("X0_Y180", 2, 0, 180), + X0_Y270("X0_Y270", 3, 0, 270), + X90_Y0("X90_Y0", 4, 90, 0), + X90_Y90("X90_Y90", 5, 90, 90), + X90_Y180("X90_Y180", 6, 90, 180), + X90_Y270("X90_Y270", 7, 90, 270), + X180_Y0("X180_Y0", 8, 180, 0), + X180_Y90("X180_Y90", 9, 180, 90), + X180_Y180("X180_Y180", 10, 180, 180), + X180_Y270("X180_Y270", 11, 180, 270), + X270_Y0("X270_Y0", 12, 270, 0), + X270_Y90("X270_Y90", 13, 270, 90), + X270_Y180("X270_Y180", 14, 270, 180), + X270_Y270("X270_Y270", 15, 270, 270); + + private static final Map mapRotations = Maps.newHashMap(); + private final int combinedXY; + private final Matrix4f matrix4d; + private final int quartersX; + private final int quartersY; + private static final ModelRotation[] $VALUES = new ModelRotation[]{X0_Y0, X0_Y90, X0_Y180, X0_Y270, X90_Y0, X90_Y90, X90_Y180, X90_Y270, X180_Y0, X180_Y90, X180_Y180, X180_Y270, X270_Y0, X270_Y90, X270_Y180, X270_Y270}; + private static final String __OBFID = "CL_00002393"; + + private static int combineXY(int p_177521_0_, int p_177521_1_) + { + return p_177521_0_ * 360 + p_177521_1_; + } + + private ModelRotation(String p_i13_3_, int p_i13_4_, int p_i13_5_, int p_i13_6_) + { + this.combinedXY = combineXY(p_i13_5_, p_i13_6_); + this.matrix4d = new Matrix4f(); + Matrix4f matrix4f = new Matrix4f(); + matrix4f.setIdentity(); + Matrix4f.rotate((float)(-p_i13_5_) * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), matrix4f, matrix4f); + this.quartersX = MathHelper.abs_int(p_i13_5_ / 90); + Matrix4f matrix4f1 = new Matrix4f(); + matrix4f1.setIdentity(); + Matrix4f.rotate((float)(-p_i13_6_) * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), matrix4f1, matrix4f1); + this.quartersY = MathHelper.abs_int(p_i13_6_ / 90); + Matrix4f.mul(matrix4f1, matrix4f, this.matrix4d); + } + + public Matrix4f getMatrix4d() + { + return this.matrix4d; + } + + public EnumFacing rotateFace(EnumFacing p_177523_1_) + { + EnumFacing enumfacing = p_177523_1_; + + for (int i = 0; i < this.quartersX; ++i) + { + enumfacing = enumfacing.rotateAround(EnumFacing.Axis.X); + } + + if (enumfacing.getAxis() != EnumFacing.Axis.Y) + { + for (int j = 0; j < this.quartersY; ++j) + { + enumfacing = enumfacing.rotateAround(EnumFacing.Axis.Y); + } + } + + return enumfacing; + } + + public int rotateVertex(EnumFacing facing, int vertexIndex) + { + int i = vertexIndex; + + if (facing.getAxis() == EnumFacing.Axis.X) + { + i = (vertexIndex + this.quartersX) % 4; + } + + EnumFacing enumfacing = facing; + + for (int j = 0; j < this.quartersX; ++j) + { + enumfacing = enumfacing.rotateAround(EnumFacing.Axis.X); + } + + if (enumfacing.getAxis() == EnumFacing.Axis.Y) + { + i = (i + this.quartersY) % 4; + } + + return i; + } + + public static ModelRotation getModelRotation(int p_177524_0_, int p_177524_1_) + { + return (ModelRotation)mapRotations.get(Integer.valueOf(combineXY(MathHelper.normalizeAngle(p_177524_0_, 360), MathHelper.normalizeAngle(p_177524_1_, 360)))); + } + + public Optional apply(Optional p_apply_1_) + { + return (Optional)Reflector.call(Reflector.ForgeHooksClient_applyTransform, new Object[] {this.getMatrix(), p_apply_1_}); + } + + public javax.vecmath.Matrix4f getMatrix() + { + return Reflector.ForgeHooksClient_getMatrix.exists() ? (javax.vecmath.Matrix4f)Reflector.call(Reflector.ForgeHooksClient_getMatrix, new Object[] {this}): new javax.vecmath.Matrix4f(); + } + + public EnumFacing rotate(EnumFacing p_rotate_1_) + { + return this.rotateFace(p_rotate_1_); + } + + public int rotate(EnumFacing p_rotate_1_, int p_rotate_2_) + { + return this.rotateVertex(p_rotate_1_, p_rotate_2_); + } + + static { + for (ModelRotation modelrotation : values()) + { + mapRotations.put(Integer.valueOf(modelrotation.combinedXY), modelrotation); + } + } +} diff --git a/src/minecraft/net/minecraft/client/resources/model/SimpleBakedModel.java b/src/minecraft/net/minecraft/client/resources/model/SimpleBakedModel.java new file mode 100644 index 0000000..7067306 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/model/SimpleBakedModel.java @@ -0,0 +1,154 @@ +package net.minecraft.client.resources.model; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.BreakingFour; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ModelBlock; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; + +public class SimpleBakedModel implements IBakedModel +{ + protected final List generalQuads; + protected final List> faceQuads; + protected final boolean ambientOcclusion; + protected final boolean gui3d; + protected final TextureAtlasSprite texture; + protected final ItemCameraTransforms cameraTransforms; + + public SimpleBakedModel(List p_i46077_1_, List> p_i46077_2_, boolean p_i46077_3_, boolean p_i46077_4_, TextureAtlasSprite p_i46077_5_, ItemCameraTransforms p_i46077_6_) + { + this.generalQuads = p_i46077_1_; + this.faceQuads = p_i46077_2_; + this.ambientOcclusion = p_i46077_3_; + this.gui3d = p_i46077_4_; + this.texture = p_i46077_5_; + this.cameraTransforms = p_i46077_6_; + } + + public List getFaceQuads(EnumFacing p_177551_1_) + { + return (List)this.faceQuads.get(p_177551_1_.ordinal()); + } + + public List getGeneralQuads() + { + return this.generalQuads; + } + + public boolean isAmbientOcclusion() + { + return this.ambientOcclusion; + } + + public boolean isGui3d() + { + return this.gui3d; + } + + public boolean isBuiltInRenderer() + { + return false; + } + + public TextureAtlasSprite getParticleTexture() + { + return this.texture; + } + + public ItemCameraTransforms getItemCameraTransforms() + { + return this.cameraTransforms; + } + + public static class Builder + { + private final List builderGeneralQuads; + private final List> builderFaceQuads; + private final boolean builderAmbientOcclusion; + private TextureAtlasSprite builderTexture; + private boolean builderGui3d; + private ItemCameraTransforms builderCameraTransforms; + + public Builder(ModelBlock p_i46074_1_) + { + this(p_i46074_1_.isAmbientOcclusion(), p_i46074_1_.isGui3d(), p_i46074_1_.func_181682_g()); + } + + public Builder(IBakedModel p_i46075_1_, TextureAtlasSprite p_i46075_2_) + { + this(p_i46075_1_.isAmbientOcclusion(), p_i46075_1_.isGui3d(), p_i46075_1_.getItemCameraTransforms()); + this.builderTexture = p_i46075_1_.getParticleTexture(); + + for (EnumFacing enumfacing : EnumFacing.values()) + { + this.addFaceBreakingFours(p_i46075_1_, p_i46075_2_, enumfacing); + } + + this.addGeneralBreakingFours(p_i46075_1_, p_i46075_2_); + } + + private void addFaceBreakingFours(IBakedModel p_177649_1_, TextureAtlasSprite p_177649_2_, EnumFacing p_177649_3_) + { + for (BakedQuad bakedquad : p_177649_1_.getFaceQuads(p_177649_3_)) + { + this.addFaceQuad(p_177649_3_, new BreakingFour(bakedquad, p_177649_2_)); + } + } + + private void addGeneralBreakingFours(IBakedModel p_177647_1_, TextureAtlasSprite p_177647_2_) + { + for (BakedQuad bakedquad : p_177647_1_.getGeneralQuads()) + { + this.addGeneralQuad(new BreakingFour(bakedquad, p_177647_2_)); + } + } + + private Builder(boolean p_i46076_1_, boolean p_i46076_2_, ItemCameraTransforms p_i46076_3_) + { + this.builderGeneralQuads = Lists.newArrayList(); + this.builderFaceQuads = Lists.>newArrayListWithCapacity(6); + + for (EnumFacing enumfacing : EnumFacing.values()) + { + this.builderFaceQuads.add(Lists.newArrayList()); + } + + this.builderAmbientOcclusion = p_i46076_1_; + this.builderGui3d = p_i46076_2_; + this.builderCameraTransforms = p_i46076_3_; + } + + public SimpleBakedModel.Builder addFaceQuad(EnumFacing p_177650_1_, BakedQuad p_177650_2_) + { + ((List)this.builderFaceQuads.get(p_177650_1_.ordinal())).add(p_177650_2_); + return this; + } + + public SimpleBakedModel.Builder addGeneralQuad(BakedQuad p_177648_1_) + { + this.builderGeneralQuads.add(p_177648_1_); + return this; + } + + public SimpleBakedModel.Builder setTexture(TextureAtlasSprite p_177646_1_) + { + this.builderTexture = p_177646_1_; + return this; + } + + public IBakedModel makeBakedModel() + { + if (this.builderTexture == null) + { + throw new RuntimeException("Missing particle!"); + } + else + { + return new SimpleBakedModel(this.builderGeneralQuads, this.builderFaceQuads, this.builderAmbientOcclusion, this.builderGui3d, this.builderTexture, this.builderCameraTransforms); + } + } + } +} diff --git a/src/minecraft/net/minecraft/client/resources/model/WeightedBakedModel.java b/src/minecraft/net/minecraft/client/resources/model/WeightedBakedModel.java new file mode 100644 index 0000000..e62ad86 --- /dev/null +++ b/src/minecraft/net/minecraft/client/resources/model/WeightedBakedModel.java @@ -0,0 +1,120 @@ +package net.minecraft.client.resources.model; + +import com.google.common.collect.ComparisonChain; +import com.google.common.collect.Lists; +import java.util.Collections; +import java.util.List; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.WeightedRandom; + +public class WeightedBakedModel implements IBakedModel +{ + private final int totalWeight; + private final List models; + private final IBakedModel baseModel; + + public WeightedBakedModel(List p_i46073_1_) + { + this.models = p_i46073_1_; + this.totalWeight = WeightedRandom.getTotalWeight(p_i46073_1_); + this.baseModel = ((WeightedBakedModel.MyWeighedRandomItem)p_i46073_1_.get(0)).model; + } + + public List getFaceQuads(EnumFacing p_177551_1_) + { + return this.baseModel.getFaceQuads(p_177551_1_); + } + + public List getGeneralQuads() + { + return this.baseModel.getGeneralQuads(); + } + + public boolean isAmbientOcclusion() + { + return this.baseModel.isAmbientOcclusion(); + } + + public boolean isGui3d() + { + return this.baseModel.isGui3d(); + } + + public boolean isBuiltInRenderer() + { + return this.baseModel.isBuiltInRenderer(); + } + + public TextureAtlasSprite getParticleTexture() + { + return this.baseModel.getParticleTexture(); + } + + public ItemCameraTransforms getItemCameraTransforms() + { + return this.baseModel.getItemCameraTransforms(); + } + + public IBakedModel getAlternativeModel(long p_177564_1_) + { + return ((WeightedBakedModel.MyWeighedRandomItem)WeightedRandom.getRandomItem(this.models, Math.abs((int)p_177564_1_ >> 16) % this.totalWeight)).model; + } + + public static class Builder + { + private List listItems = Lists.newArrayList(); + + public WeightedBakedModel.Builder add(IBakedModel p_177677_1_, int p_177677_2_) + { + this.listItems.add(new WeightedBakedModel.MyWeighedRandomItem(p_177677_1_, p_177677_2_)); + return this; + } + + public WeightedBakedModel build() + { + Collections.sort(this.listItems); + return new WeightedBakedModel(this.listItems); + } + + public IBakedModel first() + { + return ((WeightedBakedModel.MyWeighedRandomItem)this.listItems.get(0)).model; + } + } + + static class MyWeighedRandomItem extends WeightedRandom.Item implements Comparable + { + protected final IBakedModel model; + + public MyWeighedRandomItem(IBakedModel p_i46072_1_, int p_i46072_2_) + { + super(p_i46072_2_); + this.model = p_i46072_1_; + } + + public int compareTo(WeightedBakedModel.MyWeighedRandomItem p_compareTo_1_) + { + return ComparisonChain.start().compare(p_compareTo_1_.itemWeight, this.itemWeight).compare(this.getCountQuads(), p_compareTo_1_.getCountQuads()).result(); + } + + protected int getCountQuads() + { + int i = this.model.getGeneralQuads().size(); + + for (EnumFacing enumfacing : EnumFacing.values()) + { + i += this.model.getFaceQuads(enumfacing).size(); + } + + return i; + } + + public String toString() + { + return "MyWeighedRandomItem{weight=" + this.itemWeight + ", model=" + this.model + '}'; + } + } +} diff --git a/src/minecraft/net/minecraft/client/settings/GameSettings.java b/src/minecraft/net/minecraft/client/settings/GameSettings.java new file mode 100644 index 0000000..84b2ffe --- /dev/null +++ b/src/minecraft/net/minecraft/client/settings/GameSettings.java @@ -0,0 +1,3414 @@ +package net.minecraft.client.settings; + +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.google.gson.Gson; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Set; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.SoundCategory; +import net.minecraft.client.gui.GuiNewChat; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.stream.TwitchStream; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.network.play.client.C15PacketClientSettings; +import net.minecraft.util.MathHelper; +import net.minecraft.world.EnumDifficulty; +import optifine.ClearWater; +import optifine.Config; +import optifine.CustomColors; +import optifine.CustomSky; +import optifine.DynamicLights; +import optifine.Lang; +import optifine.NaturalTextures; +import optifine.RandomMobs; +import optifine.Reflector; + +import org.apache.commons.lang3.ArrayUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import shadersmod.client.Shaders; + +public class GameSettings +{ + private static final Logger logger = LogManager.getLogger(); + private static final Gson gson = new Gson(); + private static final ParameterizedType typeListString = new ParameterizedType() + { + private static final String __OBFID = "CL_00000651"; + public Type[] getActualTypeArguments() + { + return new Type[] {String.class}; + } + public Type getRawType() + { + return List.class; + } + public Type getOwnerType() + { + return null; + } + }; + + /** GUI scale values */ + private static final String[] GUISCALES = new String[] {"options.guiScale.auto", "options.guiScale.small", "options.guiScale.normal", "options.guiScale.large"}; + private static final String[] PARTICLES = new String[] {"options.particles.all", "options.particles.decreased", "options.particles.minimal"}; + private static final String[] AMBIENT_OCCLUSIONS = new String[] {"options.ao.off", "options.ao.min", "options.ao.max"}; + private static final String[] STREAM_COMPRESSIONS = new String[] {"options.stream.compression.low", "options.stream.compression.medium", "options.stream.compression.high"}; + private static final String[] STREAM_CHAT_MODES = new String[] {"options.stream.chat.enabled.streaming", "options.stream.chat.enabled.always", "options.stream.chat.enabled.never"}; + private static final String[] STREAM_CHAT_FILTER_MODES = new String[] {"options.stream.chat.userFilter.all", "options.stream.chat.userFilter.subs", "options.stream.chat.userFilter.mods"}; + private static final String[] STREAM_MIC_MODES = new String[] {"options.stream.mic_toggle.mute", "options.stream.mic_toggle.talk"}; + private static final String[] field_181149_aW = new String[] {"options.off", "options.graphics.fast", "options.graphics.fancy"}; + public float mouseSensitivity = 0.5F; + public boolean invertMouse; + public int renderDistanceChunks = -1; + public boolean viewBobbing = true; + public boolean anaglyph; + public boolean fboEnable = true; + public int limitFramerate = 120; + + /** Clouds flag */ + public int clouds = 2; + public boolean fancyGraphics = true; + + /** Smooth Lighting */ + public int ambientOcclusion = 2; + public List resourcePacks = Lists.newArrayList(); + public List field_183018_l = Lists.newArrayList(); + public EntityPlayer.EnumChatVisibility chatVisibility = EntityPlayer.EnumChatVisibility.FULL; + public boolean chatColours = true; + public boolean chatLinks = true; + public boolean chatLinksPrompt = true; + public float chatOpacity = 1.0F; + public boolean snooperEnabled = true; + public boolean fullScreen; + public boolean enableVsync = true; + public boolean useVbo = false; + public boolean allowBlockAlternatives = true; + public boolean reducedDebugInfo = false; + public boolean hideServerAddress; + + /** + * Whether to show advanced information on item tooltips, toggled by F3+H + */ + public boolean advancedItemTooltips; + + /** Whether to pause when the game loses focus, toggled by F3+P */ + public boolean pauseOnLostFocus = true; + private final Set setModelParts = Sets.newHashSet(EnumPlayerModelParts.values()); + public boolean touchscreen; + public int overrideWidth; + public int overrideHeight; + public boolean heldItemTooltips = true; + public float chatScale = 1.0F; + public float chatWidth = 1.0F; + public float chatHeightUnfocused = 0.44366196F; + public float chatHeightFocused = 1.0F; + public boolean showInventoryAchievementHint = true; + public int mipmapLevels = 4; + private Map mapSoundLevels = Maps.newEnumMap(SoundCategory.class); + public float streamBytesPerPixel = 0.5F; + public float streamMicVolume = 1.0F; + public float streamGameVolume = 1.0F; + public float streamKbps = 0.5412844F; + public float streamFps = 0.31690142F; + public int streamCompression = 1; + public boolean streamSendMetadata = true; + public String streamPreferredServer = ""; + public int streamChatEnabled = 0; + public int streamChatUserFilter = 0; + public int streamMicToggleBehavior = 0; + public boolean field_181150_U = true; + public boolean field_181151_V = true; + public KeyBinding keyBindForward = new KeyBinding("key.forward", 17, "key.categories.movement"); + public KeyBinding keyBindLeft = new KeyBinding("key.left", 30, "key.categories.movement"); + public KeyBinding keyBindBack = new KeyBinding("key.back", 31, "key.categories.movement"); + public KeyBinding keyBindRight = new KeyBinding("key.right", 32, "key.categories.movement"); + public KeyBinding keyBindJump = new KeyBinding("key.jump", 57, "key.categories.movement"); + public KeyBinding keyBindSneak = new KeyBinding("key.sneak", 42, "key.categories.movement"); + public KeyBinding keyBindSprint = new KeyBinding("key.sprint", 29, "key.categories.movement"); + public KeyBinding keyBindInventory = new KeyBinding("key.inventory", 18, "key.categories.inventory"); + public KeyBinding keyBindUseItem = new KeyBinding("key.use", -99, "key.categories.gameplay"); + public KeyBinding keyBindDrop = new KeyBinding("key.drop", 16, "key.categories.gameplay"); + public KeyBinding keyBindAttack = new KeyBinding("key.attack", -100, "key.categories.gameplay"); + public KeyBinding keyBindPickBlock = new KeyBinding("key.pickItem", -98, "key.categories.gameplay"); + public KeyBinding keyBindChat = new KeyBinding("key.chat", 20, "key.categories.multiplayer"); + public KeyBinding keyBindPlayerList = new KeyBinding("key.playerlist", 15, "key.categories.multiplayer"); + public KeyBinding keyBindCommand = new KeyBinding("key.command", 53, "key.categories.multiplayer"); + public KeyBinding keyBindScreenshot = new KeyBinding("key.screenshot", 60, "key.categories.misc"); + public KeyBinding keyBindTogglePerspective = new KeyBinding("key.togglePerspective", 63, "key.categories.misc"); + public KeyBinding keyBindSmoothCamera = new KeyBinding("key.smoothCamera", 0, "key.categories.misc"); + public KeyBinding keyBindFullscreen = new KeyBinding("key.fullscreen", 87, "key.categories.misc"); + public KeyBinding keyBindSpectatorOutlines = new KeyBinding("key.spectatorOutlines", 0, "key.categories.misc"); + public KeyBinding keyBindStreamStartStop = new KeyBinding("key.streamStartStop", 64, "key.categories.stream"); + public KeyBinding keyBindStreamPauseUnpause = new KeyBinding("key.streamPauseUnpause", 65, "key.categories.stream"); + public KeyBinding keyBindStreamCommercials = new KeyBinding("key.streamCommercial", 0, "key.categories.stream"); + public KeyBinding keyBindStreamToggleMic = new KeyBinding("key.streamToggleMic", 0, "key.categories.stream"); + public KeyBinding[] keyBindsHotbar = new KeyBinding[] {new KeyBinding("key.hotbar.1", 2, "key.categories.inventory"), new KeyBinding("key.hotbar.2", 3, "key.categories.inventory"), new KeyBinding("key.hotbar.3", 4, "key.categories.inventory"), new KeyBinding("key.hotbar.4", 5, "key.categories.inventory"), new KeyBinding("key.hotbar.5", 6, "key.categories.inventory"), new KeyBinding("key.hotbar.6", 7, "key.categories.inventory"), new KeyBinding("key.hotbar.7", 8, "key.categories.inventory"), new KeyBinding("key.hotbar.8", 9, "key.categories.inventory"), new KeyBinding("key.hotbar.9", 10, "key.categories.inventory")}; + public KeyBinding[] keyBindings; + protected Minecraft mc; + private File optionsFile; + public EnumDifficulty difficulty; + public boolean hideGUI; + public int thirdPersonView; + + /** true if debug info should be displayed instead of version */ + public boolean showDebugInfo; + public boolean showDebugProfilerChart; + public boolean field_181657_aC; + + /** The lastServer string. */ + public String lastServer; + + /** Smooth Camera Toggle */ + public boolean smoothCamera; + public boolean debugCamEnable; + public float fovSetting; + public float gammaSetting; + public float saturation; + + /** GUI scale */ + public int guiScale; + + /** Determines amount of particles. 0 = All, 1 = Decreased, 2 = Minimal */ + public int particleSetting; + + /** Game settings language */ + public String language; + public boolean forceUnicodeFont; + private static final String __OBFID = "CL_00000650"; + public int ofFogType = 1; + public float ofFogStart = 0.8F; + public int ofMipmapType = 0; + public boolean ofOcclusionFancy = false; + public boolean ofSmoothFps = false; + public boolean ofSmoothWorld = Config.isSingleProcessor(); + public boolean ofLazyChunkLoading = Config.isSingleProcessor(); + public float ofAoLevel = 1.0F; + public int ofAaLevel = 0; + public int ofAfLevel = 1; + public int ofClouds = 0; + public float ofCloudsHeight = 0.0F; + public int ofTrees = 0; + public int ofRain = 0; + public int ofDroppedItems = 0; + public int ofBetterGrass = 3; + public int ofAutoSaveTicks = 4000; + public boolean ofLagometer = false; + public boolean ofProfiler = false; + public boolean ofShowFps = false; + public boolean ofWeather = true; + public boolean ofSky = true; + public boolean ofStars = true; + public boolean ofSunMoon = true; + public int ofVignette = 0; + public int ofChunkUpdates = 1; + public boolean ofChunkUpdatesDynamic = false; + public int ofTime = 0; + public boolean ofClearWater = false; + public boolean ofBetterSnow = false; + public String ofFullscreenMode = "Default"; + public boolean ofSwampColors = true; + public boolean ofRandomMobs = true; + public boolean ofSmoothBiomes = true; + public boolean ofCustomFonts = true; + public boolean ofCustomColors = true; + public boolean ofCustomSky = true; + public boolean ofShowCapes = true; + public int ofConnectedTextures = 2; + public boolean ofCustomItems = true; + public boolean ofNaturalTextures = false; + public boolean ofFastMath = false; + public static boolean ofFastRender = true; + public int ofTranslucentBlocks = 0; + public boolean ofDynamicFov = true; + public int ofDynamicLights = 3; + public int ofAnimatedWater = 0; + public int ofAnimatedLava = 0; + public boolean ofAnimatedFire = true; + public boolean ofAnimatedPortal = true; + public boolean ofAnimatedRedstone = true; + public boolean ofAnimatedExplosion = true; + public boolean ofAnimatedFlame = true; + public boolean ofAnimatedSmoke = true; + public boolean ofVoidParticles = true; + public boolean ofWaterParticles = true; + public boolean ofRainSplash = true; + public boolean ofPortalParticles = true; + public boolean ofPotionParticles = true; + public boolean ofFireworkParticles = true; + public boolean ofDrippingWaterLava = true; + public boolean ofAnimatedTerrain = true; + public boolean ofAnimatedTextures = true; + public static final int DEFAULT = 0; + public static final int FAST = 1; + public static final int FANCY = 2; + public static final int OFF = 3; + public static final int SMART = 4; + public static final int ANIM_ON = 0; + public static final int ANIM_GENERATED = 1; + public static final int ANIM_OFF = 2; + public static final String DEFAULT_STR = "Default"; + private static final int[] OF_TREES_VALUES = new int[] {0, 1, 4, 2}; + private static final int[] OF_DYNAMIC_LIGHTS = new int[] {3, 1, 2}; + private static final String[] KEYS_DYNAMIC_LIGHTS = new String[] {"options.off", "options.graphics.fast", "options.graphics.fancy"}; + public KeyBinding ofKeyBindZoom; + private File optionsFileOF; + + //public KeyBinding FPS = new KeyBinding("FPS", Keyboard.KEY_B, "FPS"); + //public KeyBinding FREELOOK = new KeyBinding("FreeLook", Keyboard.KEY_F, "FreeLook"); + public KeyBinding CLICK_GUI = new KeyBinding("ClickGUI", Keyboard.KEY_RSHIFT, "ClickGUI"); + //public KeyBinding COSMETIC_GUI = new KeyBinding("CosmeticGUI", Keyboard.KEY_M, "CosmeticGUI"); + /*public KeyBinding TARGET_HUD = new KeyBinding("TargetHUD", Keyboard.KEY_B, "TargetHUD"); + public KeyBinding KEYSTROKES = new KeyBinding("Keystrokes", Keyboard.KEY_B, "Keystrokes");*/ + + + public GameSettings(Minecraft mcIn, File p_i46326_2_) + { + this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindSprint, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand, this.keyBindScreenshot, this.keyBindTogglePerspective, this.keyBindSmoothCamera, this.keyBindStreamStartStop, this.keyBindStreamPauseUnpause, this.keyBindStreamCommercials, this.keyBindStreamToggleMic, this.keyBindFullscreen, this.keyBindSpectatorOutlines}, this.keyBindsHotbar)); + this.difficulty = EnumDifficulty.NORMAL; + this.lastServer = ""; + this.fovSetting = 70.0F; + this.language = "en_US"; + this.forceUnicodeFont = false; + this.mc = mcIn; + this.optionsFile = new File(p_i46326_2_, "options.txt"); + this.optionsFileOF = new File(p_i46326_2_, "optionsof.txt"); + this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax(); + this.ofKeyBindZoom = new KeyBinding("of.key.zoom", 46, "key.categories.misc"); + this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.add(this.keyBindings, this.ofKeyBindZoom)); + GameSettings.Options.RENDER_DISTANCE.setValueMax(32.0F); + this.renderDistanceChunks = 8; + addClientKeybinds(); + this.loadOptions(); + Config.initGameSettings(this); + } + + public GameSettings() + { + this.keyBindings = (KeyBinding[])((KeyBinding[])ArrayUtils.addAll(new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindSprint, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand, this.keyBindScreenshot, this.keyBindTogglePerspective, this.keyBindSmoothCamera, this.keyBindStreamStartStop, this.keyBindStreamPauseUnpause, this.keyBindStreamCommercials, this.keyBindStreamToggleMic, this.keyBindFullscreen, this.keyBindSpectatorOutlines}, this.keyBindsHotbar)); + this.difficulty = EnumDifficulty.NORMAL; + this.lastServer = ""; + this.fovSetting = 70.0F; + this.language = "en_US"; + this.forceUnicodeFont = false; + addClientKeybinds(); + } + + private void addClientKeybinds() { + //this.keyBindings = ((KeyBinding[])ArrayUtils.add(this.keyBindings, this.FPS)); + //this.keyBindings = ((KeyBinding[])ArrayUtils.add(this.keyBindings, this.FREELOOK)); + this.keyBindings = ((KeyBinding[])ArrayUtils.add(this.keyBindings, this.CLICK_GUI)); + //this.keyBindings = ((KeyBinding[])ArrayUtils.add(this.keyBindings, this.COSMETIC_GUI)); + + } + + /** + * Represents a key or mouse button as a string. Args: key + */ + public static String getKeyDisplayString(int p_74298_0_) + { + return p_74298_0_ < 0 ? I18n.format("key.mouseButton", new Object[] {Integer.valueOf(p_74298_0_ + 101)}): (p_74298_0_ < 256 ? Keyboard.getKeyName(p_74298_0_) : String.format("%c", new Object[] {Character.valueOf((char)(p_74298_0_ - 256))}).toUpperCase()); + } + + /** + * Returns whether the specified key binding is currently being pressed. + */ + public static boolean isKeyDown(KeyBinding p_100015_0_) + { + int i = p_100015_0_.getKeyCode(); + return i >= -100 && i <= 255 ? (p_100015_0_.getKeyCode() == 0 ? false : (p_100015_0_.getKeyCode() < 0 ? Mouse.isButtonDown(p_100015_0_.getKeyCode() + 100) : Keyboard.isKeyDown(p_100015_0_.getKeyCode()))) : false; + } + + /** + * Sets a key binding and then saves all settings. + */ + public void setOptionKeyBinding(KeyBinding p_151440_1_, int p_151440_2_) + { + p_151440_1_.setKeyCode(p_151440_2_); + this.saveOptions(); + } + + /** + * If the specified option is controlled by a slider (float value), this will set the float value. + */ + public void setOptionFloatValue(GameSettings.Options p_74304_1_, float p_74304_2_) + { + this.setOptionFloatValueOF(p_74304_1_, p_74304_2_); + + if (p_74304_1_ == GameSettings.Options.SENSITIVITY) + { + this.mouseSensitivity = p_74304_2_; + } + + if (p_74304_1_ == GameSettings.Options.FOV) + { + this.fovSetting = p_74304_2_; + } + + if (p_74304_1_ == GameSettings.Options.GAMMA) + { + this.gammaSetting = p_74304_2_; + } + + if (p_74304_1_ == GameSettings.Options.FRAMERATE_LIMIT) + { + this.limitFramerate = (int)p_74304_2_; + this.enableVsync = false; + + if (this.limitFramerate <= 0) + { + this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax(); + this.enableVsync = true; + } + + this.updateVSync(); + } + + if (p_74304_1_ == GameSettings.Options.CHAT_OPACITY) + { + this.chatOpacity = p_74304_2_; + this.mc.ingameGUI.getChatGUI().refreshChat(); + } + + if (p_74304_1_ == GameSettings.Options.CHAT_HEIGHT_FOCUSED) + { + this.chatHeightFocused = p_74304_2_; + this.mc.ingameGUI.getChatGUI().refreshChat(); + } + + if (p_74304_1_ == GameSettings.Options.CHAT_HEIGHT_UNFOCUSED) + { + this.chatHeightUnfocused = p_74304_2_; + this.mc.ingameGUI.getChatGUI().refreshChat(); + } + + if (p_74304_1_ == GameSettings.Options.CHAT_WIDTH) + { + this.chatWidth = p_74304_2_; + this.mc.ingameGUI.getChatGUI().refreshChat(); + } + + if (p_74304_1_ == GameSettings.Options.CHAT_SCALE) + { + this.chatScale = p_74304_2_; + this.mc.ingameGUI.getChatGUI().refreshChat(); + } + + if (p_74304_1_ == GameSettings.Options.MIPMAP_LEVELS) + { + int i = this.mipmapLevels; + this.mipmapLevels = (int)p_74304_2_; + + if ((float)i != p_74304_2_) + { + this.mc.getTextureMapBlocks().setMipmapLevels(this.mipmapLevels); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + this.mc.getTextureMapBlocks().setBlurMipmapDirect(false, this.mipmapLevels > 0); + this.mc.scheduleResourcesRefresh(); + } + } + + if (p_74304_1_ == GameSettings.Options.BLOCK_ALTERNATIVES) + { + this.allowBlockAlternatives = !this.allowBlockAlternatives; + this.mc.renderGlobal.loadRenderers(); + } + + if (p_74304_1_ == GameSettings.Options.RENDER_DISTANCE) + { + this.renderDistanceChunks = (int)p_74304_2_; + this.mc.renderGlobal.setDisplayListEntitiesDirty(); + } + + if (p_74304_1_ == GameSettings.Options.STREAM_BYTES_PER_PIXEL) + { + this.streamBytesPerPixel = p_74304_2_; + } + + if (p_74304_1_ == GameSettings.Options.STREAM_VOLUME_MIC) + { + this.streamMicVolume = p_74304_2_; + this.mc.getTwitchStream().updateStreamVolume(); + } + + if (p_74304_1_ == GameSettings.Options.STREAM_VOLUME_SYSTEM) + { + this.streamGameVolume = p_74304_2_; + this.mc.getTwitchStream().updateStreamVolume(); + } + + if (p_74304_1_ == GameSettings.Options.STREAM_KBPS) + { + this.streamKbps = p_74304_2_; + } + + if (p_74304_1_ == GameSettings.Options.STREAM_FPS) + { + this.streamFps = p_74304_2_; + } + } + + /** + * For non-float options. Toggles the option on/off, or cycles through the list i.e. render distances. + */ + public void setOptionValue(GameSettings.Options p_74306_1_, int p_74306_2_) + { + this.setOptionValueOF(p_74306_1_, p_74306_2_); + + if (p_74306_1_ == GameSettings.Options.INVERT_MOUSE) + { + this.invertMouse = !this.invertMouse; + } + + if (p_74306_1_ == GameSettings.Options.GUI_SCALE) + { + this.guiScale = this.guiScale + p_74306_2_ & 3; + } + + if (p_74306_1_ == GameSettings.Options.PARTICLES) + { + this.particleSetting = (this.particleSetting + p_74306_2_) % 3; + } + + if (p_74306_1_ == GameSettings.Options.VIEW_BOBBING) + { + this.viewBobbing = !this.viewBobbing; + } + + if (p_74306_1_ == GameSettings.Options.RENDER_CLOUDS) + { + this.clouds = (this.clouds + p_74306_2_) % 3; + } + + if (p_74306_1_ == GameSettings.Options.FORCE_UNICODE_FONT) + { + this.forceUnicodeFont = !this.forceUnicodeFont; + this.mc.fontRendererObj.setUnicodeFlag(this.mc.getLanguageManager().isCurrentLocaleUnicode() || this.forceUnicodeFont); + } + + if (p_74306_1_ == GameSettings.Options.FBO_ENABLE) + { + this.fboEnable = !this.fboEnable; + } + + if (p_74306_1_ == GameSettings.Options.ANAGLYPH) + { + if (!this.anaglyph && Config.isShaders()) + { + Config.showGuiMessage(Lang.get("of.message.an.shaders1"), Lang.get("of.message.an.shaders2")); + return; + } + + this.anaglyph = !this.anaglyph; + this.mc.refreshResources(); + } + + if (p_74306_1_ == GameSettings.Options.GRAPHICS) + { + this.fancyGraphics = !this.fancyGraphics; + this.updateRenderClouds(); + this.mc.renderGlobal.loadRenderers(); + } + + if (p_74306_1_ == GameSettings.Options.AMBIENT_OCCLUSION) + { + this.ambientOcclusion = (this.ambientOcclusion + p_74306_2_) % 3; + this.mc.renderGlobal.loadRenderers(); + } + + if (p_74306_1_ == GameSettings.Options.CHAT_VISIBILITY) + { + this.chatVisibility = EntityPlayer.EnumChatVisibility.getEnumChatVisibility((this.chatVisibility.getChatVisibility() + p_74306_2_) % 3); + } + + if (p_74306_1_ == GameSettings.Options.STREAM_COMPRESSION) + { + this.streamCompression = (this.streamCompression + p_74306_2_) % 3; + } + + if (p_74306_1_ == GameSettings.Options.STREAM_SEND_METADATA) + { + this.streamSendMetadata = !this.streamSendMetadata; + } + + if (p_74306_1_ == GameSettings.Options.STREAM_CHAT_ENABLED) + { + this.streamChatEnabled = (this.streamChatEnabled + p_74306_2_) % 3; + } + + if (p_74306_1_ == GameSettings.Options.STREAM_CHAT_USER_FILTER) + { + this.streamChatUserFilter = (this.streamChatUserFilter + p_74306_2_) % 3; + } + + if (p_74306_1_ == GameSettings.Options.STREAM_MIC_TOGGLE_BEHAVIOR) + { + this.streamMicToggleBehavior = (this.streamMicToggleBehavior + p_74306_2_) % 2; + } + + if (p_74306_1_ == GameSettings.Options.CHAT_COLOR) + { + this.chatColours = !this.chatColours; + } + + if (p_74306_1_ == GameSettings.Options.CHAT_LINKS) + { + this.chatLinks = !this.chatLinks; + } + + if (p_74306_1_ == GameSettings.Options.CHAT_LINKS_PROMPT) + { + this.chatLinksPrompt = !this.chatLinksPrompt; + } + + if (p_74306_1_ == GameSettings.Options.SNOOPER_ENABLED) + { + this.snooperEnabled = !this.snooperEnabled; + } + + if (p_74306_1_ == GameSettings.Options.TOUCHSCREEN) + { + this.touchscreen = !this.touchscreen; + } + + if (p_74306_1_ == GameSettings.Options.USE_FULLSCREEN) + { + this.fullScreen = !this.fullScreen; + + if (this.mc.isFullScreen() != this.fullScreen) + { + this.mc.toggleFullscreen(); + } + } + + if (p_74306_1_ == GameSettings.Options.ENABLE_VSYNC) + { + this.enableVsync = !this.enableVsync; + Display.setVSyncEnabled(this.enableVsync); + } + + if (p_74306_1_ == GameSettings.Options.USE_VBO) + { + this.useVbo = !this.useVbo; + this.mc.renderGlobal.loadRenderers(); + } + + if (p_74306_1_ == GameSettings.Options.BLOCK_ALTERNATIVES) + { + this.allowBlockAlternatives = !this.allowBlockAlternatives; + this.mc.renderGlobal.loadRenderers(); + } + + if (p_74306_1_ == GameSettings.Options.REDUCED_DEBUG_INFO) + { + this.reducedDebugInfo = !this.reducedDebugInfo; + } + + if (p_74306_1_ == GameSettings.Options.ENTITY_SHADOWS) + { + this.field_181151_V = !this.field_181151_V; + } + + this.saveOptions(); + } + + public float getOptionFloatValue(GameSettings.Options p_74296_1_) + { + return p_74296_1_ == GameSettings.Options.CLOUD_HEIGHT ? this.ofCloudsHeight : (p_74296_1_ == GameSettings.Options.AO_LEVEL ? this.ofAoLevel : (p_74296_1_ == GameSettings.Options.AA_LEVEL ? (float)this.ofAaLevel : (p_74296_1_ == GameSettings.Options.AF_LEVEL ? (float)this.ofAfLevel : (p_74296_1_ == GameSettings.Options.MIPMAP_TYPE ? (float)this.ofMipmapType : (p_74296_1_ == GameSettings.Options.FRAMERATE_LIMIT ? ((float)this.limitFramerate == GameSettings.Options.FRAMERATE_LIMIT.getValueMax() && this.enableVsync ? 0.0F : (float)this.limitFramerate) : (p_74296_1_ == GameSettings.Options.FOV ? this.fovSetting : (p_74296_1_ == GameSettings.Options.GAMMA ? this.gammaSetting : (p_74296_1_ == GameSettings.Options.SATURATION ? this.saturation : (p_74296_1_ == GameSettings.Options.SENSITIVITY ? this.mouseSensitivity : (p_74296_1_ == GameSettings.Options.CHAT_OPACITY ? this.chatOpacity : (p_74296_1_ == GameSettings.Options.CHAT_HEIGHT_FOCUSED ? this.chatHeightFocused : (p_74296_1_ == GameSettings.Options.CHAT_HEIGHT_UNFOCUSED ? this.chatHeightUnfocused : (p_74296_1_ == GameSettings.Options.CHAT_SCALE ? this.chatScale : (p_74296_1_ == GameSettings.Options.CHAT_WIDTH ? this.chatWidth : (p_74296_1_ == GameSettings.Options.FRAMERATE_LIMIT ? (float)this.limitFramerate : (p_74296_1_ == GameSettings.Options.MIPMAP_LEVELS ? (float)this.mipmapLevels : (p_74296_1_ == GameSettings.Options.RENDER_DISTANCE ? (float)this.renderDistanceChunks : (p_74296_1_ == GameSettings.Options.STREAM_BYTES_PER_PIXEL ? this.streamBytesPerPixel : (p_74296_1_ == GameSettings.Options.STREAM_VOLUME_MIC ? this.streamMicVolume : (p_74296_1_ == GameSettings.Options.STREAM_VOLUME_SYSTEM ? this.streamGameVolume : (p_74296_1_ == GameSettings.Options.STREAM_KBPS ? this.streamKbps : (p_74296_1_ == GameSettings.Options.STREAM_FPS ? this.streamFps : 0.0F)))))))))))))))))))))); + } + + public boolean getOptionOrdinalValue(GameSettings.Options p_74308_1_) + { + switch (GameSettings.GameSettings$2.field_151477_a[p_74308_1_.ordinal()]) + { + case 1: + return this.invertMouse; + + case 2: + return this.viewBobbing; + + case 3: + return this.anaglyph; + + case 4: + return this.fboEnable; + + case 5: + return this.chatColours; + + case 6: + return this.chatLinks; + + case 7: + return this.chatLinksPrompt; + + case 8: + return this.snooperEnabled; + + case 9: + return this.fullScreen; + + case 10: + return this.enableVsync; + + case 11: + return this.useVbo; + + case 12: + return this.touchscreen; + + case 13: + return this.streamSendMetadata; + + case 14: + return this.forceUnicodeFont; + + case 15: + return this.allowBlockAlternatives; + + case 16: + return this.reducedDebugInfo; + + case 17: + return this.field_181151_V; + + default: + return false; + } + } + + /** + * Returns the translation of the given index in the given String array. If the index is smaller than 0 or greater + * than/equal to the length of the String array, it is changed to 0. + */ + private static String getTranslation(String[] p_74299_0_, int p_74299_1_) + { + if (p_74299_1_ < 0 || p_74299_1_ >= p_74299_0_.length) + { + p_74299_1_ = 0; + } + + return I18n.format(p_74299_0_[p_74299_1_], new Object[0]); + } + + /** + * Gets a key binding. + */ + public String getKeyBinding(GameSettings.Options p_74297_1_) + { + String s = this.getKeyBindingOF(p_74297_1_); + + if (s != null) + { + return s; + } + else + { + String s1 = I18n.format(p_74297_1_.getEnumString(), new Object[0]) + ": "; + + if (p_74297_1_.getEnumFloat()) + { + float f1 = this.getOptionFloatValue(p_74297_1_); + float f = p_74297_1_.normalizeValue(f1); + return p_74297_1_ == GameSettings.Options.SENSITIVITY ? (f == 0.0F ? s1 + I18n.format("options.sensitivity.min", new Object[0]) : (f == 1.0F ? s1 + I18n.format("options.sensitivity.max", new Object[0]) : s1 + (int)(f * 200.0F) + "%")) : (p_74297_1_ == GameSettings.Options.FOV ? (f1 == 70.0F ? s1 + I18n.format("options.fov.min", new Object[0]) : (f1 == 110.0F ? s1 + I18n.format("options.fov.max", new Object[0]) : s1 + (int)f1)) : (p_74297_1_ == GameSettings.Options.FRAMERATE_LIMIT ? (f1 == p_74297_1_.valueMax ? s1 + I18n.format("options.framerateLimit.max", new Object[0]) : s1 + (int)f1 + " fps") : (p_74297_1_ == GameSettings.Options.RENDER_CLOUDS ? (f1 == p_74297_1_.valueMin ? s1 + I18n.format("options.cloudHeight.min", new Object[0]) : s1 + ((int)f1 + 128)) : (p_74297_1_ == GameSettings.Options.GAMMA ? (f == 0.0F ? s1 + I18n.format("options.gamma.min", new Object[0]) : (f == 1.0F ? s1 + I18n.format("options.gamma.max", new Object[0]) : s1 + "+" + (int)(f * 100.0F) + "%")) : (p_74297_1_ == GameSettings.Options.SATURATION ? s1 + (int)(f * 400.0F) + "%" : (p_74297_1_ == GameSettings.Options.CHAT_OPACITY ? s1 + (int)(f * 90.0F + 10.0F) + "%" : (p_74297_1_ == GameSettings.Options.CHAT_HEIGHT_UNFOCUSED ? s1 + GuiNewChat.calculateChatboxHeight(f) + "px" : (p_74297_1_ == GameSettings.Options.CHAT_HEIGHT_FOCUSED ? s1 + GuiNewChat.calculateChatboxHeight(f) + "px" : (p_74297_1_ == GameSettings.Options.CHAT_WIDTH ? s1 + GuiNewChat.calculateChatboxWidth(f) + "px" : (p_74297_1_ == GameSettings.Options.RENDER_DISTANCE ? s1 + (int)f1 + " chunks" : (p_74297_1_ == GameSettings.Options.MIPMAP_LEVELS ? (f1 == 0.0F ? s1 + I18n.format("options.off", new Object[0]) : s1 + (int)f1) : (p_74297_1_ == GameSettings.Options.STREAM_FPS ? s1 + TwitchStream.formatStreamFps(f) + " fps" : (p_74297_1_ == GameSettings.Options.STREAM_KBPS ? s1 + TwitchStream.formatStreamKbps(f) + " Kbps" : (p_74297_1_ == GameSettings.Options.STREAM_BYTES_PER_PIXEL ? s1 + String.format("%.3f bpp", new Object[] {Float.valueOf(TwitchStream.formatStreamBps(f))}): (f == 0.0F ? s1 + I18n.format("options.off", new Object[0]) : s1 + (int)(f * 100.0F) + "%"))))))))))))))); + } + else if (p_74297_1_.getEnumBoolean()) + { + boolean flag = this.getOptionOrdinalValue(p_74297_1_); + return flag ? s1 + I18n.format("options.on", new Object[0]) : s1 + I18n.format("options.off", new Object[0]); + } + else if (p_74297_1_ == GameSettings.Options.GUI_SCALE) + { + return s1 + getTranslation(GUISCALES, this.guiScale); + } + else if (p_74297_1_ == GameSettings.Options.CHAT_VISIBILITY) + { + return s1 + I18n.format(this.chatVisibility.getResourceKey(), new Object[0]); + } + else if (p_74297_1_ == GameSettings.Options.PARTICLES) + { + return s1 + getTranslation(PARTICLES, this.particleSetting); + } + else if (p_74297_1_ == GameSettings.Options.AMBIENT_OCCLUSION) + { + return s1 + getTranslation(AMBIENT_OCCLUSIONS, this.ambientOcclusion); + } + else if (p_74297_1_ == GameSettings.Options.STREAM_COMPRESSION) + { + return s1 + getTranslation(STREAM_COMPRESSIONS, this.streamCompression); + } + else if (p_74297_1_ == GameSettings.Options.STREAM_CHAT_ENABLED) + { + return s1 + getTranslation(STREAM_CHAT_MODES, this.streamChatEnabled); + } + else if (p_74297_1_ == GameSettings.Options.STREAM_CHAT_USER_FILTER) + { + return s1 + getTranslation(STREAM_CHAT_FILTER_MODES, this.streamChatUserFilter); + } + else if (p_74297_1_ == GameSettings.Options.STREAM_MIC_TOGGLE_BEHAVIOR) + { + return s1 + getTranslation(STREAM_MIC_MODES, this.streamMicToggleBehavior); + } + else if (p_74297_1_ == GameSettings.Options.RENDER_CLOUDS) + { + return s1 + getTranslation(field_181149_aW, this.clouds); + } + else if (p_74297_1_ == GameSettings.Options.GRAPHICS) + { + if (this.fancyGraphics) + { + return s1 + I18n.format("options.graphics.fancy", new Object[0]); + } + else + { + String s2 = "options.graphics.fast"; + return s1 + I18n.format("options.graphics.fast", new Object[0]); + } + } + else + { + return s1; + } + } + } + + /** + * Loads the options from the options file. It appears that this has replaced the previous 'loadOptions' + */ + public void loadOptions() + { + try + { + if (!this.optionsFile.exists()) + { + return; + } + + BufferedReader bufferedreader = new BufferedReader(new FileReader(this.optionsFile)); + String s = ""; + this.mapSoundLevels.clear(); + + while ((s = bufferedreader.readLine()) != null) + { + try + { + String[] astring = s.split(":"); + + if (astring[0].equals("mouseSensitivity")) + { + this.mouseSensitivity = this.parseFloat(astring[1]); + } + + if (astring[0].equals("fov")) + { + this.fovSetting = this.parseFloat(astring[1]) * 40.0F + 70.0F; + } + + if (astring[0].equals("gamma")) + { + this.gammaSetting = this.parseFloat(astring[1]); + } + + if (astring[0].equals("saturation")) + { + this.saturation = this.parseFloat(astring[1]); + } + + if (astring[0].equals("invertYMouse")) + { + this.invertMouse = astring[1].equals("true"); + } + + if (astring[0].equals("renderDistance")) + { + this.renderDistanceChunks = Integer.parseInt(astring[1]); + } + + if (astring[0].equals("guiScale")) + { + this.guiScale = Integer.parseInt(astring[1]); + } + + if (astring[0].equals("particles")) + { + this.particleSetting = Integer.parseInt(astring[1]); + } + + if (astring[0].equals("bobView")) + { + this.viewBobbing = astring[1].equals("true"); + } + + if (astring[0].equals("anaglyph3d")) + { + this.anaglyph = astring[1].equals("true"); + } + + if (astring[0].equals("maxFps")) + { + this.limitFramerate = Integer.parseInt(astring[1]); + this.enableVsync = false; + + if (this.limitFramerate <= 0) + { + this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax(); + this.enableVsync = true; + } + + this.updateVSync(); + } + + if (astring[0].equals("fboEnable")) + { + this.fboEnable = astring[1].equals("true"); + } + + if (astring[0].equals("difficulty")) + { + this.difficulty = EnumDifficulty.getDifficultyEnum(Integer.parseInt(astring[1])); + } + + if (astring[0].equals("fancyGraphics")) + { + this.fancyGraphics = astring[1].equals("true"); + this.updateRenderClouds(); + } + + if (astring[0].equals("ao")) + { + if (astring[1].equals("true")) + { + this.ambientOcclusion = 2; + } + else if (astring[1].equals("false")) + { + this.ambientOcclusion = 0; + } + else + { + this.ambientOcclusion = Integer.parseInt(astring[1]); + } + } + + if (astring[0].equals("renderClouds")) + { + if (astring[1].equals("true")) + { + this.clouds = 2; + } + else if (astring[1].equals("false")) + { + this.clouds = 0; + } + else if (astring[1].equals("fast")) + { + this.clouds = 1; + } + } + + if (astring[0].equals("resourcePacks")) + { + this.resourcePacks = (List)gson.fromJson((String)s.substring(s.indexOf(58) + 1), typeListString); + + if (this.resourcePacks == null) + { + this.resourcePacks = Lists.newArrayList(); + } + } + + if (astring[0].equals("incompatibleResourcePacks")) + { + this.field_183018_l = (List)gson.fromJson((String)s.substring(s.indexOf(58) + 1), typeListString); + + if (this.field_183018_l == null) + { + this.field_183018_l = Lists.newArrayList(); + } + } + + if (astring[0].equals("lastServer") && astring.length >= 2) + { + this.lastServer = s.substring(s.indexOf(58) + 1); + } + + if (astring[0].equals("lang") && astring.length >= 2) + { + this.language = astring[1]; + } + + if (astring[0].equals("chatVisibility")) + { + this.chatVisibility = EntityPlayer.EnumChatVisibility.getEnumChatVisibility(Integer.parseInt(astring[1])); + } + + if (astring[0].equals("chatColors")) + { + this.chatColours = astring[1].equals("true"); + } + + if (astring[0].equals("chatLinks")) + { + this.chatLinks = astring[1].equals("true"); + } + + if (astring[0].equals("chatLinksPrompt")) + { + this.chatLinksPrompt = astring[1].equals("true"); + } + + if (astring[0].equals("chatOpacity")) + { + this.chatOpacity = this.parseFloat(astring[1]); + } + + if (astring[0].equals("snooperEnabled")) + { + this.snooperEnabled = astring[1].equals("true"); + } + + if (astring[0].equals("fullscreen")) + { + this.fullScreen = astring[1].equals("true"); + } + + if (astring[0].equals("enableVsync")) + { + this.enableVsync = astring[1].equals("true"); + this.updateVSync(); + } + + if (astring[0].equals("useVbo")) + { + this.useVbo = astring[1].equals("true"); + } + + if (astring[0].equals("hideServerAddress")) + { + this.hideServerAddress = astring[1].equals("true"); + } + + if (astring[0].equals("advancedItemTooltips")) + { + this.advancedItemTooltips = astring[1].equals("true"); + } + + if (astring[0].equals("pauseOnLostFocus")) + { + this.pauseOnLostFocus = astring[1].equals("true"); + } + + if (astring[0].equals("touchscreen")) + { + this.touchscreen = astring[1].equals("true"); + } + + if (astring[0].equals("overrideHeight")) + { + this.overrideHeight = Integer.parseInt(astring[1]); + } + + if (astring[0].equals("overrideWidth")) + { + this.overrideWidth = Integer.parseInt(astring[1]); + } + + if (astring[0].equals("heldItemTooltips")) + { + this.heldItemTooltips = astring[1].equals("true"); + } + + if (astring[0].equals("chatHeightFocused")) + { + this.chatHeightFocused = this.parseFloat(astring[1]); + } + + if (astring[0].equals("chatHeightUnfocused")) + { + this.chatHeightUnfocused = this.parseFloat(astring[1]); + } + + if (astring[0].equals("chatScale")) + { + this.chatScale = this.parseFloat(astring[1]); + } + + if (astring[0].equals("chatWidth")) + { + this.chatWidth = this.parseFloat(astring[1]); + } + + if (astring[0].equals("showInventoryAchievementHint")) + { + this.showInventoryAchievementHint = astring[1].equals("true"); + } + + if (astring[0].equals("mipmapLevels")) + { + this.mipmapLevels = Integer.parseInt(astring[1]); + } + + if (astring[0].equals("streamBytesPerPixel")) + { + this.streamBytesPerPixel = this.parseFloat(astring[1]); + } + + if (astring[0].equals("streamMicVolume")) + { + this.streamMicVolume = this.parseFloat(astring[1]); + } + + if (astring[0].equals("streamSystemVolume")) + { + this.streamGameVolume = this.parseFloat(astring[1]); + } + + if (astring[0].equals("streamKbps")) + { + this.streamKbps = this.parseFloat(astring[1]); + } + + if (astring[0].equals("streamFps")) + { + this.streamFps = this.parseFloat(astring[1]); + } + + if (astring[0].equals("streamCompression")) + { + this.streamCompression = Integer.parseInt(astring[1]); + } + + if (astring[0].equals("streamSendMetadata")) + { + this.streamSendMetadata = astring[1].equals("true"); + } + + if (astring[0].equals("streamPreferredServer") && astring.length >= 2) + { + this.streamPreferredServer = s.substring(s.indexOf(58) + 1); + } + + if (astring[0].equals("streamChatEnabled")) + { + this.streamChatEnabled = Integer.parseInt(astring[1]); + } + + if (astring[0].equals("streamChatUserFilter")) + { + this.streamChatUserFilter = Integer.parseInt(astring[1]); + } + + if (astring[0].equals("streamMicToggleBehavior")) + { + this.streamMicToggleBehavior = Integer.parseInt(astring[1]); + } + + if (astring[0].equals("forceUnicodeFont")) + { + this.forceUnicodeFont = astring[1].equals("true"); + } + + if (astring[0].equals("allowBlockAlternatives")) + { + this.allowBlockAlternatives = astring[1].equals("true"); + } + + if (astring[0].equals("reducedDebugInfo")) + { + this.reducedDebugInfo = astring[1].equals("true"); + } + + if (astring[0].equals("useNativeTransport")) + { + this.field_181150_U = astring[1].equals("true"); + } + + if (astring[0].equals("entityShadows")) + { + this.field_181151_V = astring[1].equals("true"); + } + + for (KeyBinding keybinding : this.keyBindings) + { + if (astring[0].equals("key_" + keybinding.getKeyDescription())) + { + keybinding.setKeyCode(Integer.parseInt(astring[1])); + } + } + + for (SoundCategory soundcategory : SoundCategory.values()) + { + if (astring[0].equals("soundCategory_" + soundcategory.getCategoryName())) + { + this.mapSoundLevels.put(soundcategory, Float.valueOf(this.parseFloat(astring[1]))); + } + } + + for (EnumPlayerModelParts enumplayermodelparts : EnumPlayerModelParts.values()) + { + if (astring[0].equals("modelPart_" + enumplayermodelparts.getPartName())) + { + this.setModelPartEnabled(enumplayermodelparts, astring[1].equals("true")); + } + } + } + catch (Exception exception) + { + logger.warn("Skipping bad option: " + s); + exception.printStackTrace(); + } + } + + KeyBinding.resetKeyBindingArrayAndHash(); + bufferedreader.close(); + } + catch (Exception exception1) + { + logger.error((String)"Failed to load options", (Throwable)exception1); + } + + this.loadOfOptions(); + } + + /** + * Parses a string into a float. + */ + private float parseFloat(String p_74305_1_) + { + return p_74305_1_.equals("true") ? 1.0F : (p_74305_1_.equals("false") ? 0.0F : Float.parseFloat(p_74305_1_)); + } + + /** + * Saves the options to the options file. + */ + public void saveOptions() + { + if (Reflector.FMLClientHandler.exists()) + { + Object object = Reflector.call(Reflector.FMLClientHandler_instance, new Object[0]); + + if (object != null && Reflector.callBoolean(object, Reflector.FMLClientHandler_isLoading, new Object[0])) + { + return; + } + } + + try + { + PrintWriter printwriter = new PrintWriter(new FileWriter(this.optionsFile)); + printwriter.println("invertYMouse:" + this.invertMouse); + printwriter.println("mouseSensitivity:" + this.mouseSensitivity); + printwriter.println("fov:" + (this.fovSetting - 70.0F) / 40.0F); + printwriter.println("gamma:" + this.gammaSetting); + printwriter.println("saturation:" + this.saturation); + printwriter.println("renderDistance:" + this.renderDistanceChunks); + printwriter.println("guiScale:" + this.guiScale); + printwriter.println("particles:" + this.particleSetting); + printwriter.println("bobView:" + this.viewBobbing); + printwriter.println("anaglyph3d:" + this.anaglyph); + printwriter.println("maxFps:" + this.limitFramerate); + printwriter.println("fboEnable:" + this.fboEnable); + printwriter.println("difficulty:" + this.difficulty.getDifficultyId()); + printwriter.println("fancyGraphics:" + this.fancyGraphics); + printwriter.println("ao:" + this.ambientOcclusion); + + switch (this.clouds) + { + case 0: + printwriter.println("renderClouds:false"); + break; + + case 1: + printwriter.println("renderClouds:fast"); + break; + + case 2: + printwriter.println("renderClouds:true"); + } + + printwriter.println("resourcePacks:" + gson.toJson((Object)this.resourcePacks)); + printwriter.println("incompatibleResourcePacks:" + gson.toJson((Object)this.field_183018_l)); + printwriter.println("lastServer:" + this.lastServer); + printwriter.println("lang:" + this.language); + printwriter.println("chatVisibility:" + this.chatVisibility.getChatVisibility()); + printwriter.println("chatColors:" + this.chatColours); + printwriter.println("chatLinks:" + this.chatLinks); + printwriter.println("chatLinksPrompt:" + this.chatLinksPrompt); + printwriter.println("chatOpacity:" + this.chatOpacity); + printwriter.println("snooperEnabled:" + this.snooperEnabled); + printwriter.println("fullscreen:" + this.fullScreen); + printwriter.println("enableVsync:" + this.enableVsync); + printwriter.println("useVbo:" + this.useVbo); + printwriter.println("hideServerAddress:" + this.hideServerAddress); + printwriter.println("advancedItemTooltips:" + this.advancedItemTooltips); + printwriter.println("pauseOnLostFocus:" + this.pauseOnLostFocus); + printwriter.println("touchscreen:" + this.touchscreen); + printwriter.println("overrideWidth:" + this.overrideWidth); + printwriter.println("overrideHeight:" + this.overrideHeight); + printwriter.println("heldItemTooltips:" + this.heldItemTooltips); + printwriter.println("chatHeightFocused:" + this.chatHeightFocused); + printwriter.println("chatHeightUnfocused:" + this.chatHeightUnfocused); + printwriter.println("chatScale:" + this.chatScale); + printwriter.println("chatWidth:" + this.chatWidth); + printwriter.println("showInventoryAchievementHint:" + this.showInventoryAchievementHint); + printwriter.println("mipmapLevels:" + this.mipmapLevels); + printwriter.println("streamBytesPerPixel:" + this.streamBytesPerPixel); + printwriter.println("streamMicVolume:" + this.streamMicVolume); + printwriter.println("streamSystemVolume:" + this.streamGameVolume); + printwriter.println("streamKbps:" + this.streamKbps); + printwriter.println("streamFps:" + this.streamFps); + printwriter.println("streamCompression:" + this.streamCompression); + printwriter.println("streamSendMetadata:" + this.streamSendMetadata); + printwriter.println("streamPreferredServer:" + this.streamPreferredServer); + printwriter.println("streamChatEnabled:" + this.streamChatEnabled); + printwriter.println("streamChatUserFilter:" + this.streamChatUserFilter); + printwriter.println("streamMicToggleBehavior:" + this.streamMicToggleBehavior); + printwriter.println("forceUnicodeFont:" + this.forceUnicodeFont); + printwriter.println("allowBlockAlternatives:" + this.allowBlockAlternatives); + printwriter.println("reducedDebugInfo:" + this.reducedDebugInfo); + printwriter.println("useNativeTransport:" + this.field_181150_U); + printwriter.println("entityShadows:" + this.field_181151_V); + + for (KeyBinding keybinding : this.keyBindings) + { + printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode()); + } + + for (SoundCategory soundcategory : SoundCategory.values()) + { + printwriter.println("soundCategory_" + soundcategory.getCategoryName() + ":" + this.getSoundLevel(soundcategory)); + } + + for (EnumPlayerModelParts enumplayermodelparts : EnumPlayerModelParts.values()) + { + printwriter.println("modelPart_" + enumplayermodelparts.getPartName() + ":" + this.setModelParts.contains(enumplayermodelparts)); + } + + printwriter.close(); + } + catch (Exception exception) + { + logger.error((String)"Failed to save options", (Throwable)exception); + } + + this.saveOfOptions(); + this.sendSettingsToServer(); + } + + public float getSoundLevel(SoundCategory p_151438_1_) + { + return this.mapSoundLevels.containsKey(p_151438_1_) ? ((Float)this.mapSoundLevels.get(p_151438_1_)).floatValue() : 1.0F; + } + + public void setSoundLevel(SoundCategory p_151439_1_, float p_151439_2_) + { + this.mc.getSoundHandler().setSoundLevel(p_151439_1_, p_151439_2_); + this.mapSoundLevels.put(p_151439_1_, Float.valueOf(p_151439_2_)); + } + + /** + * Send a client info packet with settings information to the server + */ + public void sendSettingsToServer() + { + if (this.mc.thePlayer != null) + { + int i = 0; + + for (Object enumplayermodelparts : this.setModelParts) + { + i |= ((EnumPlayerModelParts) enumplayermodelparts).getPartMask(); + } + + this.mc.thePlayer.sendQueue.addToSendQueue(new C15PacketClientSettings(this.language, this.renderDistanceChunks, this.chatVisibility, this.chatColours, i)); + } + } + + public Set getModelParts() + { + return ImmutableSet.copyOf(this.setModelParts); + } + + public void setModelPartEnabled(EnumPlayerModelParts p_178878_1_, boolean p_178878_2_) + { + if (p_178878_2_) + { + this.setModelParts.add(p_178878_1_); + } + else + { + this.setModelParts.remove(p_178878_1_); + } + + this.sendSettingsToServer(); + } + + public void switchModelPartEnabled(EnumPlayerModelParts p_178877_1_) + { + if (!this.getModelParts().contains(p_178877_1_)) + { + this.setModelParts.add(p_178877_1_); + } + else + { + this.setModelParts.remove(p_178877_1_); + } + + this.sendSettingsToServer(); + } + + public int func_181147_e() + { + return this.renderDistanceChunks >= 4 ? this.clouds : 0; + } + + public boolean func_181148_f() + { + return this.field_181150_U; + } + + private void setOptionFloatValueOF(GameSettings.Options p_setOptionFloatValueOF_1_, float p_setOptionFloatValueOF_2_) + { + if (p_setOptionFloatValueOF_1_ == GameSettings.Options.CLOUD_HEIGHT) + { + this.ofCloudsHeight = p_setOptionFloatValueOF_2_; + this.mc.renderGlobal.resetClouds(); + } + + if (p_setOptionFloatValueOF_1_ == GameSettings.Options.AO_LEVEL) + { + this.ofAoLevel = p_setOptionFloatValueOF_2_; + this.mc.renderGlobal.loadRenderers(); + } + + if (p_setOptionFloatValueOF_1_ == GameSettings.Options.AA_LEVEL) + { + int i = (int)p_setOptionFloatValueOF_2_; + + if (i > 0 && Config.isShaders()) + { + Config.showGuiMessage(Lang.get("of.message.aa.shaders1"), Lang.get("of.message.aa.shaders2")); + return; + } + + int[] aint = new int[] {0, 2, 4, 6, 8, 12, 16}; + this.ofAaLevel = 0; + + for (int j = 0; j < aint.length; ++j) + { + if (i >= aint[j]) + { + this.ofAaLevel = aint[j]; + } + } + + this.ofAaLevel = Config.limit(this.ofAaLevel, 0, 16); + } + + if (p_setOptionFloatValueOF_1_ == GameSettings.Options.AF_LEVEL) + { + int k = (int)p_setOptionFloatValueOF_2_; + + if (k > 1 && Config.isShaders()) + { + Config.showGuiMessage(Lang.get("of.message.af.shaders1"), Lang.get("of.message.af.shaders2")); + return; + } + + for (this.ofAfLevel = 1; this.ofAfLevel * 2 <= k; this.ofAfLevel *= 2) + { + ; + } + + this.ofAfLevel = Config.limit(this.ofAfLevel, 1, 16); + this.mc.refreshResources(); + } + + if (p_setOptionFloatValueOF_1_ == GameSettings.Options.MIPMAP_TYPE) + { + int l = (int)p_setOptionFloatValueOF_2_; + this.ofMipmapType = Config.limit(l, 0, 3); + this.mc.refreshResources(); + } + } + + private void setOptionValueOF(GameSettings.Options p_setOptionValueOF_1_, int p_setOptionValueOF_2_) + { + if (p_setOptionValueOF_1_ == GameSettings.Options.FOG_FANCY) + { + switch (this.ofFogType) + { + case 1: + this.ofFogType = 2; + + if (!Config.isFancyFogAvailable()) + { + this.ofFogType = 3; + } + + break; + + case 2: + this.ofFogType = 3; + break; + + case 3: + this.ofFogType = 1; + break; + + default: + this.ofFogType = 1; + } + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.FOG_START) + { + this.ofFogStart += 0.2F; + + if (this.ofFogStart > 0.81F) + { + this.ofFogStart = 0.2F; + } + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.SMOOTH_FPS) + { + this.ofSmoothFps = !this.ofSmoothFps; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.SMOOTH_WORLD) + { + this.ofSmoothWorld = !this.ofSmoothWorld; + Config.updateThreadPriorities(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.CLOUDS) + { + ++this.ofClouds; + + if (this.ofClouds > 3) + { + this.ofClouds = 0; + } + + this.updateRenderClouds(); + this.mc.renderGlobal.resetClouds(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.TREES) + { + this.ofTrees = nextValue(this.ofTrees, OF_TREES_VALUES); + this.mc.renderGlobal.loadRenderers(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.DROPPED_ITEMS) + { + ++this.ofDroppedItems; + + if (this.ofDroppedItems > 2) + { + this.ofDroppedItems = 0; + } + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.RAIN) + { + ++this.ofRain; + + if (this.ofRain > 3) + { + this.ofRain = 0; + } + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.ANIMATED_WATER) + { + ++this.ofAnimatedWater; + + if (this.ofAnimatedWater == 1) + { + ++this.ofAnimatedWater; + } + + if (this.ofAnimatedWater > 2) + { + this.ofAnimatedWater = 0; + } + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.ANIMATED_LAVA) + { + ++this.ofAnimatedLava; + + if (this.ofAnimatedLava == 1) + { + ++this.ofAnimatedLava; + } + + if (this.ofAnimatedLava > 2) + { + this.ofAnimatedLava = 0; + } + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.ANIMATED_FIRE) + { + this.ofAnimatedFire = !this.ofAnimatedFire; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.ANIMATED_PORTAL) + { + this.ofAnimatedPortal = !this.ofAnimatedPortal; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.ANIMATED_REDSTONE) + { + this.ofAnimatedRedstone = !this.ofAnimatedRedstone; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.ANIMATED_EXPLOSION) + { + this.ofAnimatedExplosion = !this.ofAnimatedExplosion; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.ANIMATED_FLAME) + { + this.ofAnimatedFlame = !this.ofAnimatedFlame; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.ANIMATED_SMOKE) + { + this.ofAnimatedSmoke = !this.ofAnimatedSmoke; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.VOID_PARTICLES) + { + this.ofVoidParticles = !this.ofVoidParticles; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.WATER_PARTICLES) + { + this.ofWaterParticles = !this.ofWaterParticles; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.PORTAL_PARTICLES) + { + this.ofPortalParticles = !this.ofPortalParticles; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.POTION_PARTICLES) + { + this.ofPotionParticles = !this.ofPotionParticles; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.FIREWORK_PARTICLES) + { + this.ofFireworkParticles = !this.ofFireworkParticles; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.DRIPPING_WATER_LAVA) + { + this.ofDrippingWaterLava = !this.ofDrippingWaterLava; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.ANIMATED_TERRAIN) + { + this.ofAnimatedTerrain = !this.ofAnimatedTerrain; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.ANIMATED_TEXTURES) + { + this.ofAnimatedTextures = !this.ofAnimatedTextures; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.RAIN_SPLASH) + { + this.ofRainSplash = !this.ofRainSplash; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.LAGOMETER) + { + this.ofLagometer = !this.ofLagometer; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.SHOW_FPS) + { + this.ofShowFps = !this.ofShowFps; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.AUTOSAVE_TICKS) + { + this.ofAutoSaveTicks *= 10; + + if (this.ofAutoSaveTicks > 40000) + { + this.ofAutoSaveTicks = 40; + } + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.BETTER_GRASS) + { + ++this.ofBetterGrass; + + if (this.ofBetterGrass > 3) + { + this.ofBetterGrass = 1; + } + + this.mc.renderGlobal.loadRenderers(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.CONNECTED_TEXTURES) + { + ++this.ofConnectedTextures; + + if (this.ofConnectedTextures > 3) + { + this.ofConnectedTextures = 1; + } + + if (this.ofConnectedTextures != 2) + { + this.mc.refreshResources(); + } + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.WEATHER) + { + this.ofWeather = !this.ofWeather; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.SKY) + { + this.ofSky = !this.ofSky; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.STARS) + { + this.ofStars = !this.ofStars; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.SUN_MOON) + { + this.ofSunMoon = !this.ofSunMoon; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.VIGNETTE) + { + ++this.ofVignette; + + if (this.ofVignette > 2) + { + this.ofVignette = 0; + } + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.CHUNK_UPDATES) + { + ++this.ofChunkUpdates; + + if (this.ofChunkUpdates > 5) + { + this.ofChunkUpdates = 1; + } + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.CHUNK_UPDATES_DYNAMIC) + { + this.ofChunkUpdatesDynamic = !this.ofChunkUpdatesDynamic; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.TIME) + { + ++this.ofTime; + + if (this.ofTime > 2) + { + this.ofTime = 0; + } + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.CLEAR_WATER) + { + this.ofClearWater = !this.ofClearWater; + this.updateWaterOpacity(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.PROFILER) + { + this.ofProfiler = !this.ofProfiler; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.BETTER_SNOW) + { + this.ofBetterSnow = !this.ofBetterSnow; + this.mc.renderGlobal.loadRenderers(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.SWAMP_COLORS) + { + this.ofSwampColors = !this.ofSwampColors; + CustomColors.updateUseDefaultGrassFoliageColors(); + this.mc.renderGlobal.loadRenderers(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.RANDOM_MOBS) + { + this.ofRandomMobs = !this.ofRandomMobs; + RandomMobs.resetTextures(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.SMOOTH_BIOMES) + { + this.ofSmoothBiomes = !this.ofSmoothBiomes; + CustomColors.updateUseDefaultGrassFoliageColors(); + this.mc.renderGlobal.loadRenderers(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.CUSTOM_FONTS) + { + this.ofCustomFonts = !this.ofCustomFonts; + this.mc.fontRendererObj.onResourceManagerReload(Config.getResourceManager()); + this.mc.standardGalacticFontRenderer.onResourceManagerReload(Config.getResourceManager()); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.CUSTOM_COLORS) + { + this.ofCustomColors = !this.ofCustomColors; + CustomColors.update(); + this.mc.renderGlobal.loadRenderers(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.CUSTOM_ITEMS) + { + this.ofCustomItems = !this.ofCustomItems; + this.mc.refreshResources(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.CUSTOM_SKY) + { + this.ofCustomSky = !this.ofCustomSky; + CustomSky.update(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.SHOW_CAPES) + { + this.ofShowCapes = !this.ofShowCapes; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.NATURAL_TEXTURES) + { + this.ofNaturalTextures = !this.ofNaturalTextures; + NaturalTextures.update(); + this.mc.renderGlobal.loadRenderers(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.FAST_MATH) + { + this.ofFastMath = !this.ofFastMath; + MathHelper.fastMath = this.ofFastMath; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.FAST_RENDER) + { + if (!this.ofFastRender && Config.isShaders()) + { + Config.showGuiMessage(Lang.get("of.message.fr.shaders1"), Lang.get("of.message.fr.shaders2")); + return; + } + + this.ofFastRender = !this.ofFastRender; + + if (this.ofFastRender) + { + this.mc.entityRenderer.func_181022_b(); + } + + Config.updateFramebufferSize(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.TRANSLUCENT_BLOCKS) + { + if (this.ofTranslucentBlocks == 0) + { + this.ofTranslucentBlocks = 1; + } + else if (this.ofTranslucentBlocks == 1) + { + this.ofTranslucentBlocks = 2; + } + else if (this.ofTranslucentBlocks == 2) + { + this.ofTranslucentBlocks = 0; + } + else + { + this.ofTranslucentBlocks = 0; + } + + this.mc.renderGlobal.loadRenderers(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.LAZY_CHUNK_LOADING) + { + this.ofLazyChunkLoading = !this.ofLazyChunkLoading; + Config.updateAvailableProcessors(); + + if (!Config.isSingleProcessor()) + { + this.ofLazyChunkLoading = false; + } + + this.mc.renderGlobal.loadRenderers(); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.FULLSCREEN_MODE) + { + List list = Arrays.asList(Config.getDisplayModeNames()); + + if (this.ofFullscreenMode.equals("Default")) + { + this.ofFullscreenMode = (String)list.get(0); + } + else + { + int i = list.indexOf(this.ofFullscreenMode); + + if (i < 0) + { + this.ofFullscreenMode = "Default"; + } + else + { + ++i; + + if (i >= list.size()) + { + this.ofFullscreenMode = "Default"; + } + else + { + this.ofFullscreenMode = (String)list.get(i); + } + } + } + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.DYNAMIC_FOV) + { + this.ofDynamicFov = !this.ofDynamicFov; + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.DYNAMIC_LIGHTS) + { + this.ofDynamicLights = nextValue(this.ofDynamicLights, OF_DYNAMIC_LIGHTS); + DynamicLights.removeLights(this.mc.renderGlobal); + } + + if (p_setOptionValueOF_1_ == GameSettings.Options.HELD_ITEM_TOOLTIPS) + { + this.heldItemTooltips = !this.heldItemTooltips; + } + } + + private String getKeyBindingOF(GameSettings.Options p_getKeyBindingOF_1_) + { + String s = I18n.format(p_getKeyBindingOF_1_.getEnumString(), new Object[0]) + ": "; + + if (s == null) + { + s = p_getKeyBindingOF_1_.getEnumString(); + } + + if (p_getKeyBindingOF_1_ == GameSettings.Options.RENDER_DISTANCE) + { + int l = (int)this.getOptionFloatValue(p_getKeyBindingOF_1_); + String s1 = I18n.format("options.renderDistance.tiny", new Object[0]); + int i = 2; + + if (l >= 4) + { + s1 = I18n.format("options.renderDistance.short", new Object[0]); + i = 4; + } + + if (l >= 8) + { + s1 = I18n.format("options.renderDistance.normal", new Object[0]); + i = 8; + } + + if (l >= 16) + { + s1 = I18n.format("options.renderDistance.far", new Object[0]); + i = 16; + } + + if (l >= 32) + { + s1 = Lang.get("of.options.renderDistance.extreme"); + i = 32; + } + + int j = this.renderDistanceChunks - i; + String s2 = s1; + + if (j > 0) + { + s2 = s1 + "+"; + } + + return s + l + " " + s2 + ""; + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.FOG_FANCY) + { + switch (this.ofFogType) + { + case 1: + return s + Lang.getFast(); + + case 2: + return s + Lang.getFancy(); + + case 3: + return s + Lang.getOff(); + + default: + return s + Lang.getOff(); + } + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.FOG_START) + { + return s + this.ofFogStart; + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.MIPMAP_TYPE) + { + switch (this.ofMipmapType) + { + case 0: + return s + Lang.get("of.options.mipmap.nearest"); + + case 1: + return s + Lang.get("of.options.mipmap.linear"); + + case 2: + return s + Lang.get("of.options.mipmap.bilinear"); + + case 3: + return s + Lang.get("of.options.mipmap.trilinear"); + + default: + return s + "of.options.mipmap.nearest"; + } + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.SMOOTH_FPS) + { + return this.ofSmoothFps ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.SMOOTH_WORLD) + { + return this.ofSmoothWorld ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.CLOUDS) + { + switch (this.ofClouds) + { + case 1: + return s + Lang.getFast(); + + case 2: + return s + Lang.getFancy(); + + case 3: + return s + Lang.getOff(); + + default: + return s + Lang.getDefault(); + } + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.TREES) + { + switch (this.ofTrees) + { + case 1: + return s + Lang.getFast(); + + case 2: + return s + Lang.getFancy(); + + case 3: + default: + return s + Lang.getDefault(); + + case 4: + return s + Lang.get("of.general.smart"); + } + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.DROPPED_ITEMS) + { + switch (this.ofDroppedItems) + { + case 1: + return s + Lang.getFast(); + + case 2: + return s + Lang.getFancy(); + + default: + return s + Lang.getDefault(); + } + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.RAIN) + { + switch (this.ofRain) + { + case 1: + return s + Lang.getFast(); + + case 2: + return s + Lang.getFancy(); + + case 3: + return s + Lang.getOff(); + + default: + return s + Lang.getDefault(); + } + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.ANIMATED_WATER) + { + switch (this.ofAnimatedWater) + { + case 1: + return s + Lang.get("of.options.animation.dynamic"); + + case 2: + return s + Lang.getOff(); + + default: + return s + Lang.getOn(); + } + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.ANIMATED_LAVA) + { + switch (this.ofAnimatedLava) + { + case 1: + return s + Lang.get("of.options.animation.dynamic"); + + case 2: + return s + Lang.getOff(); + + default: + return s + Lang.getOn(); + } + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.ANIMATED_FIRE) + { + return this.ofAnimatedFire ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.ANIMATED_PORTAL) + { + return this.ofAnimatedPortal ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.ANIMATED_REDSTONE) + { + return this.ofAnimatedRedstone ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.ANIMATED_EXPLOSION) + { + return this.ofAnimatedExplosion ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.ANIMATED_FLAME) + { + return this.ofAnimatedFlame ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.ANIMATED_SMOKE) + { + return this.ofAnimatedSmoke ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.VOID_PARTICLES) + { + return this.ofVoidParticles ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.WATER_PARTICLES) + { + return this.ofWaterParticles ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.PORTAL_PARTICLES) + { + return this.ofPortalParticles ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.POTION_PARTICLES) + { + return this.ofPotionParticles ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.FIREWORK_PARTICLES) + { + return this.ofFireworkParticles ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.DRIPPING_WATER_LAVA) + { + return this.ofDrippingWaterLava ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.ANIMATED_TERRAIN) + { + return this.ofAnimatedTerrain ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.ANIMATED_TEXTURES) + { + return this.ofAnimatedTextures ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.RAIN_SPLASH) + { + return this.ofRainSplash ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.LAGOMETER) + { + return this.ofLagometer ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.SHOW_FPS) + { + return this.ofShowFps ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.AUTOSAVE_TICKS) + { + return this.ofAutoSaveTicks <= 40 ? s + Lang.get("of.options.save.default") : (this.ofAutoSaveTicks <= 400 ? s + Lang.get("of.options.save.20s") : (this.ofAutoSaveTicks <= 4000 ? s + Lang.get("of.options.save.3min") : s + Lang.get("of.options.save.30min"))); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.BETTER_GRASS) + { + switch (this.ofBetterGrass) + { + case 1: + return s + Lang.getFast(); + + case 2: + return s + Lang.getFancy(); + + default: + return s + Lang.getOff(); + } + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.CONNECTED_TEXTURES) + { + switch (this.ofConnectedTextures) + { + case 1: + return s + Lang.getFast(); + + case 2: + return s + Lang.getFancy(); + + default: + return s + Lang.getOff(); + } + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.WEATHER) + { + return this.ofWeather ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.SKY) + { + return this.ofSky ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.STARS) + { + return this.ofStars ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.SUN_MOON) + { + return this.ofSunMoon ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.VIGNETTE) + { + switch (this.ofVignette) + { + case 1: + return s + Lang.getFast(); + + case 2: + return s + Lang.getFancy(); + + default: + return s + Lang.getDefault(); + } + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.CHUNK_UPDATES) + { + return s + this.ofChunkUpdates; + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.CHUNK_UPDATES_DYNAMIC) + { + return this.ofChunkUpdatesDynamic ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.TIME) + { + return this.ofTime == 1 ? s + Lang.get("of.options.time.dayOnly") : (this.ofTime == 2 ? s + Lang.get("of.options.time.nightOnly") : s + Lang.getDefault()); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.CLEAR_WATER) + { + return this.ofClearWater ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.AA_LEVEL) + { + String s3 = ""; + + if (this.ofAaLevel != Config.getAntialiasingLevel()) + { + s3 = " (" + Lang.get("of.general.restart") + ")"; + } + + return this.ofAaLevel == 0 ? s + Lang.getOff() + s3 : s + this.ofAaLevel + s3; + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.AF_LEVEL) + { + return this.ofAfLevel == 1 ? s + Lang.getOff() : s + this.ofAfLevel; + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.PROFILER) + { + return this.ofProfiler ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.BETTER_SNOW) + { + return this.ofBetterSnow ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.SWAMP_COLORS) + { + return this.ofSwampColors ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.RANDOM_MOBS) + { + return this.ofRandomMobs ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.SMOOTH_BIOMES) + { + return this.ofSmoothBiomes ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.CUSTOM_FONTS) + { + return this.ofCustomFonts ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.CUSTOM_COLORS) + { + return this.ofCustomColors ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.CUSTOM_SKY) + { + return this.ofCustomSky ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.SHOW_CAPES) + { + return this.ofShowCapes ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.CUSTOM_ITEMS) + { + return this.ofCustomItems ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.NATURAL_TEXTURES) + { + return this.ofNaturalTextures ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.FAST_MATH) + { + return this.ofFastMath ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.FAST_RENDER) + { + return this.ofFastRender ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.TRANSLUCENT_BLOCKS) + { + return this.ofTranslucentBlocks == 1 ? s + Lang.getFast() : (this.ofTranslucentBlocks == 2 ? s + Lang.getFancy() : s + Lang.getDefault()); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.LAZY_CHUNK_LOADING) + { + return this.ofLazyChunkLoading ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.DYNAMIC_FOV) + { + return this.ofDynamicFov ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.DYNAMIC_LIGHTS) + { + int k = indexOf(this.ofDynamicLights, OF_DYNAMIC_LIGHTS); + return s + getTranslation(KEYS_DYNAMIC_LIGHTS, k); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.FULLSCREEN_MODE) + { + return this.ofFullscreenMode.equals("Default") ? s + Lang.getDefault() : s + this.ofFullscreenMode; + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.HELD_ITEM_TOOLTIPS) + { + return this.heldItemTooltips ? s + Lang.getOn() : s + Lang.getOff(); + } + else if (p_getKeyBindingOF_1_ == GameSettings.Options.FRAMERATE_LIMIT) + { + float f = this.getOptionFloatValue(p_getKeyBindingOF_1_); + return f == 0.0F ? s + Lang.get("of.options.framerateLimit.vsync") : (f == p_getKeyBindingOF_1_.valueMax ? s + I18n.format("options.framerateLimit.max", new Object[0]) : s + (int)f + " fps"); + } + else + { + return null; + } + } + + public void loadOfOptions() + { + try + { + File file1 = this.optionsFileOF; + + if (!file1.exists()) + { + file1 = this.optionsFile; + } + + if (!file1.exists()) + { + return; + } + + BufferedReader bufferedreader = new BufferedReader(new FileReader(file1)); + String s = ""; + + while ((s = bufferedreader.readLine()) != null) + { + try + { + String[] astring = s.split(":"); + + if (astring[0].equals("ofRenderDistanceChunks") && astring.length >= 2) + { + this.renderDistanceChunks = Integer.valueOf(astring[1]).intValue(); + this.renderDistanceChunks = Config.limit(this.renderDistanceChunks, 2, 32); + } + + if (astring[0].equals("ofFogType") && astring.length >= 2) + { + this.ofFogType = Integer.valueOf(astring[1]).intValue(); + this.ofFogType = Config.limit(this.ofFogType, 1, 3); + } + + if (astring[0].equals("ofFogStart") && astring.length >= 2) + { + this.ofFogStart = Float.valueOf(astring[1]).floatValue(); + + if (this.ofFogStart < 0.2F) + { + this.ofFogStart = 0.2F; + } + + if (this.ofFogStart > 0.81F) + { + this.ofFogStart = 0.8F; + } + } + + if (astring[0].equals("ofMipmapType") && astring.length >= 2) + { + this.ofMipmapType = Integer.valueOf(astring[1]).intValue(); + this.ofMipmapType = Config.limit(this.ofMipmapType, 0, 3); + } + + if (astring[0].equals("ofOcclusionFancy") && astring.length >= 2) + { + this.ofOcclusionFancy = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofSmoothFps") && astring.length >= 2) + { + this.ofSmoothFps = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofSmoothWorld") && astring.length >= 2) + { + this.ofSmoothWorld = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofAoLevel") && astring.length >= 2) + { + this.ofAoLevel = Float.valueOf(astring[1]).floatValue(); + this.ofAoLevel = Config.limit(this.ofAoLevel, 0.0F, 1.0F); + } + + if (astring[0].equals("ofClouds") && astring.length >= 2) + { + this.ofClouds = Integer.valueOf(astring[1]).intValue(); + this.ofClouds = Config.limit(this.ofClouds, 0, 3); + this.updateRenderClouds(); + } + + if (astring[0].equals("ofCloudsHeight") && astring.length >= 2) + { + this.ofCloudsHeight = Float.valueOf(astring[1]).floatValue(); + this.ofCloudsHeight = Config.limit(this.ofCloudsHeight, 0.0F, 1.0F); + } + + if (astring[0].equals("ofTrees") && astring.length >= 2) + { + this.ofTrees = Integer.valueOf(astring[1]).intValue(); + this.ofTrees = limit(this.ofTrees, OF_TREES_VALUES); + } + + if (astring[0].equals("ofDroppedItems") && astring.length >= 2) + { + this.ofDroppedItems = Integer.valueOf(astring[1]).intValue(); + this.ofDroppedItems = Config.limit(this.ofDroppedItems, 0, 2); + } + + if (astring[0].equals("ofRain") && astring.length >= 2) + { + this.ofRain = Integer.valueOf(astring[1]).intValue(); + this.ofRain = Config.limit(this.ofRain, 0, 3); + } + + if (astring[0].equals("ofAnimatedWater") && astring.length >= 2) + { + this.ofAnimatedWater = Integer.valueOf(astring[1]).intValue(); + this.ofAnimatedWater = Config.limit(this.ofAnimatedWater, 0, 2); + } + + if (astring[0].equals("ofAnimatedLava") && astring.length >= 2) + { + this.ofAnimatedLava = Integer.valueOf(astring[1]).intValue(); + this.ofAnimatedLava = Config.limit(this.ofAnimatedLava, 0, 2); + } + + if (astring[0].equals("ofAnimatedFire") && astring.length >= 2) + { + this.ofAnimatedFire = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofAnimatedPortal") && astring.length >= 2) + { + this.ofAnimatedPortal = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofAnimatedRedstone") && astring.length >= 2) + { + this.ofAnimatedRedstone = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofAnimatedExplosion") && astring.length >= 2) + { + this.ofAnimatedExplosion = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofAnimatedFlame") && astring.length >= 2) + { + this.ofAnimatedFlame = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofAnimatedSmoke") && astring.length >= 2) + { + this.ofAnimatedSmoke = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofVoidParticles") && astring.length >= 2) + { + this.ofVoidParticles = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofWaterParticles") && astring.length >= 2) + { + this.ofWaterParticles = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofPortalParticles") && astring.length >= 2) + { + this.ofPortalParticles = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofPotionParticles") && astring.length >= 2) + { + this.ofPotionParticles = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofFireworkParticles") && astring.length >= 2) + { + this.ofFireworkParticles = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofDrippingWaterLava") && astring.length >= 2) + { + this.ofDrippingWaterLava = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofAnimatedTerrain") && astring.length >= 2) + { + this.ofAnimatedTerrain = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofAnimatedTextures") && astring.length >= 2) + { + this.ofAnimatedTextures = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofRainSplash") && astring.length >= 2) + { + this.ofRainSplash = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofLagometer") && astring.length >= 2) + { + this.ofLagometer = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofShowFps") && astring.length >= 2) + { + this.ofShowFps = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofAutoSaveTicks") && astring.length >= 2) + { + this.ofAutoSaveTicks = Integer.valueOf(astring[1]).intValue(); + this.ofAutoSaveTicks = Config.limit(this.ofAutoSaveTicks, 40, 40000); + } + + if (astring[0].equals("ofBetterGrass") && astring.length >= 2) + { + this.ofBetterGrass = Integer.valueOf(astring[1]).intValue(); + this.ofBetterGrass = Config.limit(this.ofBetterGrass, 1, 3); + } + + if (astring[0].equals("ofConnectedTextures") && astring.length >= 2) + { + this.ofConnectedTextures = Integer.valueOf(astring[1]).intValue(); + this.ofConnectedTextures = Config.limit(this.ofConnectedTextures, 1, 3); + } + + if (astring[0].equals("ofWeather") && astring.length >= 2) + { + this.ofWeather = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofSky") && astring.length >= 2) + { + this.ofSky = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofStars") && astring.length >= 2) + { + this.ofStars = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofSunMoon") && astring.length >= 2) + { + this.ofSunMoon = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofVignette") && astring.length >= 2) + { + this.ofVignette = Integer.valueOf(astring[1]).intValue(); + this.ofVignette = Config.limit(this.ofVignette, 0, 2); + } + + if (astring[0].equals("ofChunkUpdates") && astring.length >= 2) + { + this.ofChunkUpdates = Integer.valueOf(astring[1]).intValue(); + this.ofChunkUpdates = Config.limit(this.ofChunkUpdates, 1, 5); + } + + if (astring[0].equals("ofChunkUpdatesDynamic") && astring.length >= 2) + { + this.ofChunkUpdatesDynamic = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofTime") && astring.length >= 2) + { + this.ofTime = Integer.valueOf(astring[1]).intValue(); + this.ofTime = Config.limit(this.ofTime, 0, 2); + } + + if (astring[0].equals("ofClearWater") && astring.length >= 2) + { + this.ofClearWater = Boolean.valueOf(astring[1]).booleanValue(); + this.updateWaterOpacity(); + } + + if (astring[0].equals("ofAaLevel") && astring.length >= 2) + { + this.ofAaLevel = Integer.valueOf(astring[1]).intValue(); + this.ofAaLevel = Config.limit(this.ofAaLevel, 0, 16); + } + + if (astring[0].equals("ofAfLevel") && astring.length >= 2) + { + this.ofAfLevel = Integer.valueOf(astring[1]).intValue(); + this.ofAfLevel = Config.limit(this.ofAfLevel, 1, 16); + } + + if (astring[0].equals("ofProfiler") && astring.length >= 2) + { + this.ofProfiler = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofBetterSnow") && astring.length >= 2) + { + this.ofBetterSnow = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofSwampColors") && astring.length >= 2) + { + this.ofSwampColors = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofRandomMobs") && astring.length >= 2) + { + this.ofRandomMobs = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofSmoothBiomes") && astring.length >= 2) + { + this.ofSmoothBiomes = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofCustomFonts") && astring.length >= 2) + { + this.ofCustomFonts = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofCustomColors") && astring.length >= 2) + { + this.ofCustomColors = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofCustomItems") && astring.length >= 2) + { + this.ofCustomItems = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofCustomSky") && astring.length >= 2) + { + this.ofCustomSky = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofShowCapes") && astring.length >= 2) + { + this.ofShowCapes = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofNaturalTextures") && astring.length >= 2) + { + this.ofNaturalTextures = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofLazyChunkLoading") && astring.length >= 2) + { + this.ofLazyChunkLoading = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofDynamicFov") && astring.length >= 2) + { + this.ofDynamicFov = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofDynamicLights") && astring.length >= 2) + { + this.ofDynamicLights = Integer.valueOf(astring[1]).intValue(); + this.ofDynamicLights = limit(this.ofDynamicLights, OF_DYNAMIC_LIGHTS); + } + + if (astring[0].equals("ofFullscreenMode") && astring.length >= 2) + { + this.ofFullscreenMode = astring[1]; + } + + if (astring[0].equals("ofFastMath") && astring.length >= 2) + { + this.ofFastMath = Boolean.valueOf(astring[1]).booleanValue(); + MathHelper.fastMath = this.ofFastMath; + } + + if (astring[0].equals("ofFastRender") && astring.length >= 2) + { + this.ofFastRender = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofTranslucentBlocks") && astring.length >= 2) + { + this.ofTranslucentBlocks = Integer.valueOf(astring[1]).intValue(); + this.ofTranslucentBlocks = Config.limit(this.ofTranslucentBlocks, 0, 2); + } + + if (astring[0].equals("key_" + this.ofKeyBindZoom.getKeyDescription())) + { + this.ofKeyBindZoom.setKeyCode(Integer.parseInt(astring[1])); + } + } + catch (Exception exception) + { + Config.dbg("Skipping bad option: " + s); + exception.printStackTrace(); + } + } + + KeyBinding.resetKeyBindingArrayAndHash(); + bufferedreader.close(); + } + catch (Exception exception1) + { + Config.warn("Failed to load options"); + exception1.printStackTrace(); + } + } + + public void saveOfOptions() + { + try + { + PrintWriter printwriter = new PrintWriter(new FileWriter(this.optionsFileOF)); + printwriter.println("ofRenderDistanceChunks:" + this.renderDistanceChunks); + printwriter.println("ofFogType:" + this.ofFogType); + printwriter.println("ofFogStart:" + this.ofFogStart); + printwriter.println("ofMipmapType:" + this.ofMipmapType); + printwriter.println("ofOcclusionFancy:" + this.ofOcclusionFancy); + printwriter.println("ofSmoothFps:" + this.ofSmoothFps); + printwriter.println("ofSmoothWorld:" + this.ofSmoothWorld); + printwriter.println("ofAoLevel:" + this.ofAoLevel); + printwriter.println("ofClouds:" + this.ofClouds); + printwriter.println("ofCloudsHeight:" + this.ofCloudsHeight); + printwriter.println("ofTrees:" + this.ofTrees); + printwriter.println("ofDroppedItems:" + this.ofDroppedItems); + printwriter.println("ofRain:" + this.ofRain); + printwriter.println("ofAnimatedWater:" + this.ofAnimatedWater); + printwriter.println("ofAnimatedLava:" + this.ofAnimatedLava); + printwriter.println("ofAnimatedFire:" + this.ofAnimatedFire); + printwriter.println("ofAnimatedPortal:" + this.ofAnimatedPortal); + printwriter.println("ofAnimatedRedstone:" + this.ofAnimatedRedstone); + printwriter.println("ofAnimatedExplosion:" + this.ofAnimatedExplosion); + printwriter.println("ofAnimatedFlame:" + this.ofAnimatedFlame); + printwriter.println("ofAnimatedSmoke:" + this.ofAnimatedSmoke); + printwriter.println("ofVoidParticles:" + this.ofVoidParticles); + printwriter.println("ofWaterParticles:" + this.ofWaterParticles); + printwriter.println("ofPortalParticles:" + this.ofPortalParticles); + printwriter.println("ofPotionParticles:" + this.ofPotionParticles); + printwriter.println("ofFireworkParticles:" + this.ofFireworkParticles); + printwriter.println("ofDrippingWaterLava:" + this.ofDrippingWaterLava); + printwriter.println("ofAnimatedTerrain:" + this.ofAnimatedTerrain); + printwriter.println("ofAnimatedTextures:" + this.ofAnimatedTextures); + printwriter.println("ofRainSplash:" + this.ofRainSplash); + printwriter.println("ofLagometer:" + this.ofLagometer); + printwriter.println("ofShowFps:" + this.ofShowFps); + printwriter.println("ofAutoSaveTicks:" + this.ofAutoSaveTicks); + printwriter.println("ofBetterGrass:" + this.ofBetterGrass); + printwriter.println("ofConnectedTextures:" + this.ofConnectedTextures); + printwriter.println("ofWeather:" + this.ofWeather); + printwriter.println("ofSky:" + this.ofSky); + printwriter.println("ofStars:" + this.ofStars); + printwriter.println("ofSunMoon:" + this.ofSunMoon); + printwriter.println("ofVignette:" + this.ofVignette); + printwriter.println("ofChunkUpdates:" + this.ofChunkUpdates); + printwriter.println("ofChunkUpdatesDynamic:" + this.ofChunkUpdatesDynamic); + printwriter.println("ofTime:" + this.ofTime); + printwriter.println("ofClearWater:" + this.ofClearWater); + printwriter.println("ofAaLevel:" + this.ofAaLevel); + printwriter.println("ofAfLevel:" + this.ofAfLevel); + printwriter.println("ofProfiler:" + this.ofProfiler); + printwriter.println("ofBetterSnow:" + this.ofBetterSnow); + printwriter.println("ofSwampColors:" + this.ofSwampColors); + printwriter.println("ofRandomMobs:" + this.ofRandomMobs); + printwriter.println("ofSmoothBiomes:" + this.ofSmoothBiomes); + printwriter.println("ofCustomFonts:" + this.ofCustomFonts); + printwriter.println("ofCustomColors:" + this.ofCustomColors); + printwriter.println("ofCustomItems:" + this.ofCustomItems); + printwriter.println("ofCustomSky:" + this.ofCustomSky); + printwriter.println("ofShowCapes:" + this.ofShowCapes); + printwriter.println("ofNaturalTextures:" + this.ofNaturalTextures); + printwriter.println("ofLazyChunkLoading:" + this.ofLazyChunkLoading); + printwriter.println("ofDynamicFov:" + this.ofDynamicFov); + printwriter.println("ofDynamicLights:" + this.ofDynamicLights); + printwriter.println("ofFullscreenMode:" + this.ofFullscreenMode); + printwriter.println("ofFastMath:" + this.ofFastMath); + printwriter.println("ofFastRender:" + this.ofFastRender); + printwriter.println("ofTranslucentBlocks:" + this.ofTranslucentBlocks); + printwriter.println("key_" + this.ofKeyBindZoom.getKeyDescription() + ":" + this.ofKeyBindZoom.getKeyCode()); + printwriter.close(); + } + catch (Exception exception) + { + Config.warn("Failed to save options"); + exception.printStackTrace(); + } + } + + private void updateRenderClouds() + { + switch (this.ofClouds) + { + case 1: + this.clouds = 1; + break; + + case 2: + this.clouds = 2; + break; + + case 3: + this.clouds = 0; + break; + + default: + if (this.fancyGraphics) + { + this.clouds = 2; + } + else + { + this.clouds = 1; + } + } + } + + public void resetSettings() + { + this.renderDistanceChunks = 8; + this.viewBobbing = true; + this.anaglyph = false; + this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax(); + this.enableVsync = false; + this.updateVSync(); + this.mipmapLevels = 4; + this.fancyGraphics = true; + this.ambientOcclusion = 2; + this.clouds = 2; + this.fovSetting = 70.0F; + this.gammaSetting = 0.0F; + this.guiScale = 0; + this.particleSetting = 0; + this.heldItemTooltips = true; + this.useVbo = false; + this.allowBlockAlternatives = true; + this.forceUnicodeFont = false; + this.ofFogType = 1; + this.ofFogStart = 0.8F; + this.ofMipmapType = 0; + this.ofOcclusionFancy = false; + this.ofSmoothFps = false; + Config.updateAvailableProcessors(); + this.ofSmoothWorld = Config.isSingleProcessor(); + this.ofLazyChunkLoading = Config.isSingleProcessor(); + this.ofFastMath = false; + this.ofFastRender = false; + this.ofTranslucentBlocks = 0; + this.ofDynamicFov = true; + this.ofDynamicLights = 3; + this.ofAoLevel = 1.0F; + this.ofAaLevel = 0; + this.ofAfLevel = 1; + this.ofClouds = 0; + this.ofCloudsHeight = 0.0F; + this.ofTrees = 0; + this.ofRain = 0; + this.ofBetterGrass = 3; + this.ofAutoSaveTicks = 4000; + this.ofLagometer = false; + this.ofShowFps = false; + this.ofProfiler = false; + this.ofWeather = true; + this.ofSky = true; + this.ofStars = true; + this.ofSunMoon = true; + this.ofVignette = 0; + this.ofChunkUpdates = 1; + this.ofChunkUpdatesDynamic = false; + this.ofTime = 0; + this.ofClearWater = false; + this.ofBetterSnow = false; + this.ofFullscreenMode = "Default"; + this.ofSwampColors = true; + this.ofRandomMobs = true; + this.ofSmoothBiomes = true; + this.ofCustomFonts = true; + this.ofCustomColors = true; + this.ofCustomItems = true; + this.ofCustomSky = true; + this.ofShowCapes = true; + this.ofConnectedTextures = 2; + this.ofNaturalTextures = false; + this.ofAnimatedWater = 0; + this.ofAnimatedLava = 0; + this.ofAnimatedFire = true; + this.ofAnimatedPortal = true; + this.ofAnimatedRedstone = true; + this.ofAnimatedExplosion = true; + this.ofAnimatedFlame = true; + this.ofAnimatedSmoke = true; + this.ofVoidParticles = true; + this.ofWaterParticles = true; + this.ofRainSplash = true; + this.ofPortalParticles = true; + this.ofPotionParticles = true; + this.ofFireworkParticles = true; + this.ofDrippingWaterLava = true; + this.ofAnimatedTerrain = true; + this.ofAnimatedTextures = true; + Shaders.setShaderPack(Shaders.packNameNone); + Shaders.configAntialiasingLevel = 0; + Shaders.uninit(); + Shaders.storeConfig(); + this.updateWaterOpacity(); + this.mc.refreshResources(); + this.saveOptions(); + } + + public void updateVSync() + { + Display.setVSyncEnabled(this.enableVsync); + } + + private void updateWaterOpacity() + { + if (this.mc.isIntegratedServerRunning() && this.mc.getIntegratedServer() != null) + { + Config.waterOpacityChanged = true; + } + + ClearWater.updateWaterOpacity(this, this.mc.theWorld); + } + + public void setAllAnimations(boolean p_setAllAnimations_1_) + { + int i = p_setAllAnimations_1_ ? 0 : 2; + this.ofAnimatedWater = i; + this.ofAnimatedLava = i; + this.ofAnimatedFire = p_setAllAnimations_1_; + this.ofAnimatedPortal = p_setAllAnimations_1_; + this.ofAnimatedRedstone = p_setAllAnimations_1_; + this.ofAnimatedExplosion = p_setAllAnimations_1_; + this.ofAnimatedFlame = p_setAllAnimations_1_; + this.ofAnimatedSmoke = p_setAllAnimations_1_; + this.ofVoidParticles = p_setAllAnimations_1_; + this.ofWaterParticles = p_setAllAnimations_1_; + this.ofRainSplash = p_setAllAnimations_1_; + this.ofPortalParticles = p_setAllAnimations_1_; + this.ofPotionParticles = p_setAllAnimations_1_; + this.ofFireworkParticles = p_setAllAnimations_1_; + this.particleSetting = p_setAllAnimations_1_ ? 0 : 2; + this.ofDrippingWaterLava = p_setAllAnimations_1_; + this.ofAnimatedTerrain = p_setAllAnimations_1_; + this.ofAnimatedTextures = p_setAllAnimations_1_; + } + + private static int nextValue(int p_nextValue_0_, int[] p_nextValue_1_) + { + int i = indexOf(p_nextValue_0_, p_nextValue_1_); + + if (i < 0) + { + return p_nextValue_1_[0]; + } + else + { + ++i; + + if (i >= p_nextValue_1_.length) + { + i = 0; + } + + return p_nextValue_1_[i]; + } + } + + private static int limit(int p_limit_0_, int[] p_limit_1_) + { + int i = indexOf(p_limit_0_, p_limit_1_); + return i < 0 ? p_limit_1_[0] : p_limit_0_; + } + + private static int indexOf(int p_indexOf_0_, int[] p_indexOf_1_) + { + for (int i = 0; i < p_indexOf_1_.length; ++i) + { + if (p_indexOf_1_[i] == p_indexOf_0_) + { + return i; + } + } + + return -1; + } + + static final class GameSettings$2 + { + static final int[] field_151477_a = new int[GameSettings.Options.values().length]; + private static final String __OBFID = "CL_00000652"; + + static + { + try + { + field_151477_a[GameSettings.Options.INVERT_MOUSE.ordinal()] = 1; + } + catch (NoSuchFieldError var17) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.VIEW_BOBBING.ordinal()] = 2; + } + catch (NoSuchFieldError var16) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.ANAGLYPH.ordinal()] = 3; + } + catch (NoSuchFieldError var15) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.FBO_ENABLE.ordinal()] = 4; + } + catch (NoSuchFieldError var14) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.CHAT_COLOR.ordinal()] = 5; + } + catch (NoSuchFieldError var13) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.CHAT_LINKS.ordinal()] = 6; + } + catch (NoSuchFieldError var12) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.CHAT_LINKS_PROMPT.ordinal()] = 7; + } + catch (NoSuchFieldError var11) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.SNOOPER_ENABLED.ordinal()] = 8; + } + catch (NoSuchFieldError var10) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.USE_FULLSCREEN.ordinal()] = 9; + } + catch (NoSuchFieldError var9) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.ENABLE_VSYNC.ordinal()] = 10; + } + catch (NoSuchFieldError var8) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.USE_VBO.ordinal()] = 11; + } + catch (NoSuchFieldError var7) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.TOUCHSCREEN.ordinal()] = 12; + } + catch (NoSuchFieldError var6) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.STREAM_SEND_METADATA.ordinal()] = 13; + } + catch (NoSuchFieldError var5) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.FORCE_UNICODE_FONT.ordinal()] = 14; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.BLOCK_ALTERNATIVES.ordinal()] = 15; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.REDUCED_DEBUG_INFO.ordinal()] = 16; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_151477_a[GameSettings.Options.ENTITY_SHADOWS.ordinal()] = 17; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } + + public static enum Options + { + INVERT_MOUSE("INVERT_MOUSE", 0, "options.invertMouse", false, true), + SENSITIVITY("SENSITIVITY", 1, "options.sensitivity", true, false), + FOV("FOV", 2, "options.fov", true, false, 30.0F, 110.0F, 1.0F), + GAMMA("GAMMA", 3, "options.gamma", true, false), + SATURATION("SATURATION", 4, "options.saturation", true, false), + RENDER_DISTANCE("RENDER_DISTANCE", 5, "options.renderDistance", true, false, 2.0F, 16.0F, 1.0F), + VIEW_BOBBING("VIEW_BOBBING", 6, "options.viewBobbing", false, true), + ANAGLYPH("ANAGLYPH", 7, "options.anaglyph", false, true), + FRAMERATE_LIMIT("FRAMERATE_LIMIT", 8, "options.framerateLimit", true, false, 0.0F, 260.0F, 5.0F), + FBO_ENABLE("FBO_ENABLE", 9, "options.fboEnable", false, true), + RENDER_CLOUDS("RENDER_CLOUDS", 10, "options.renderClouds", false, false), + GRAPHICS("GRAPHICS", 11, "options.graphics", false, false), + AMBIENT_OCCLUSION("AMBIENT_OCCLUSION", 12, "options.ao", false, false), + GUI_SCALE("GUI_SCALE", 13, "options.guiScale", false, false), + PARTICLES("PARTICLES", 14, "options.particles", false, false), + CHAT_VISIBILITY("CHAT_VISIBILITY", 15, "options.chat.visibility", false, false), + CHAT_COLOR("CHAT_COLOR", 16, "options.chat.color", false, true), + CHAT_LINKS("CHAT_LINKS", 17, "options.chat.links", false, true), + CHAT_OPACITY("CHAT_OPACITY", 18, "options.chat.opacity", true, false), + CHAT_LINKS_PROMPT("CHAT_LINKS_PROMPT", 19, "options.chat.links.prompt", false, true), + SNOOPER_ENABLED("SNOOPER_ENABLED", 20, "options.snooper", false, true), + USE_FULLSCREEN("USE_FULLSCREEN", 21, "options.fullscreen", false, true), + ENABLE_VSYNC("ENABLE_VSYNC", 22, "options.vsync", false, true), + USE_VBO("USE_VBO", 23, "options.vbo", false, true), + TOUCHSCREEN("TOUCHSCREEN", 24, "options.touchscreen", false, true), + CHAT_SCALE("CHAT_SCALE", 25, "options.chat.scale", true, false), + CHAT_WIDTH("CHAT_WIDTH", 26, "options.chat.width", true, false), + CHAT_HEIGHT_FOCUSED("CHAT_HEIGHT_FOCUSED", 27, "options.chat.height.focused", true, false), + CHAT_HEIGHT_UNFOCUSED("CHAT_HEIGHT_UNFOCUSED", 28, "options.chat.height.unfocused", true, false), + MIPMAP_LEVELS("MIPMAP_LEVELS", 29, "options.mipmapLevels", true, false, 0.0F, 4.0F, 1.0F), + FORCE_UNICODE_FONT("FORCE_UNICODE_FONT", 30, "options.forceUnicodeFont", false, true), + STREAM_BYTES_PER_PIXEL("STREAM_BYTES_PER_PIXEL", 31, "options.stream.bytesPerPixel", true, false), + STREAM_VOLUME_MIC("STREAM_VOLUME_MIC", 32, "options.stream.micVolumne", true, false), + STREAM_VOLUME_SYSTEM("STREAM_VOLUME_SYSTEM", 33, "options.stream.systemVolume", true, false), + STREAM_KBPS("STREAM_KBPS", 34, "options.stream.kbps", true, false), + STREAM_FPS("STREAM_FPS", 35, "options.stream.fps", true, false), + STREAM_COMPRESSION("STREAM_COMPRESSION", 36, "options.stream.compression", false, false), + STREAM_SEND_METADATA("STREAM_SEND_METADATA", 37, "options.stream.sendMetadata", false, true), + STREAM_CHAT_ENABLED("STREAM_CHAT_ENABLED", 38, "options.stream.chat.enabled", false, false), + STREAM_CHAT_USER_FILTER("STREAM_CHAT_USER_FILTER", 39, "options.stream.chat.userFilter", false, false), + STREAM_MIC_TOGGLE_BEHAVIOR("STREAM_MIC_TOGGLE_BEHAVIOR", 40, "options.stream.micToggleBehavior", false, false), + BLOCK_ALTERNATIVES("BLOCK_ALTERNATIVES", 41, "options.blockAlternatives", false, true), + REDUCED_DEBUG_INFO("REDUCED_DEBUG_INFO", 42, "options.reducedDebugInfo", false, true), + ENTITY_SHADOWS("ENTITY_SHADOWS", 43, "options.entityShadows", false, true), + FOG_FANCY("", 999, "of.options.FOG_FANCY", false, false), + FOG_START("", 999, "of.options.FOG_START", false, false), + MIPMAP_TYPE("", 999, "of.options.MIPMAP_TYPE", true, false, 0.0F, 3.0F, 1.0F), + SMOOTH_FPS("", 999, "of.options.SMOOTH_FPS", false, false), + CLOUDS("", 999, "of.options.CLOUDS", false, false), + CLOUD_HEIGHT("", 999, "of.options.CLOUD_HEIGHT", true, false), + TREES("", 999, "of.options.TREES", false, false), + RAIN("", 999, "of.options.RAIN", false, false), + ANIMATED_WATER("", 999, "of.options.ANIMATED_WATER", false, false), + ANIMATED_LAVA("", 999, "of.options.ANIMATED_LAVA", false, false), + ANIMATED_FIRE("", 999, "of.options.ANIMATED_FIRE", false, false), + ANIMATED_PORTAL("", 999, "of.options.ANIMATED_PORTAL", false, false), + AO_LEVEL("", 999, "of.options.AO_LEVEL", true, false), + LAGOMETER("", 999, "of.options.LAGOMETER", false, false), + SHOW_FPS("", 999, "of.options.SHOW_FPS", false, false), + AUTOSAVE_TICKS("", 999, "of.options.AUTOSAVE_TICKS", false, false), + BETTER_GRASS("", 999, "of.options.BETTER_GRASS", false, false), + ANIMATED_REDSTONE("", 999, "of.options.ANIMATED_REDSTONE", false, false), + ANIMATED_EXPLOSION("", 999, "of.options.ANIMATED_EXPLOSION", false, false), + ANIMATED_FLAME("", 999, "of.options.ANIMATED_FLAME", false, false), + ANIMATED_SMOKE("", 999, "of.options.ANIMATED_SMOKE", false, false), + WEATHER("", 999, "of.options.WEATHER", false, false), + SKY("", 999, "of.options.SKY", false, false), + STARS("", 999, "of.options.STARS", false, false), + SUN_MOON("", 999, "of.options.SUN_MOON", false, false), + VIGNETTE("", 999, "of.options.VIGNETTE", false, false), + CHUNK_UPDATES("", 999, "of.options.CHUNK_UPDATES", false, false), + CHUNK_UPDATES_DYNAMIC("", 999, "of.options.CHUNK_UPDATES_DYNAMIC", false, false), + TIME("", 999, "of.options.TIME", false, false), + CLEAR_WATER("", 999, "of.options.CLEAR_WATER", false, false), + SMOOTH_WORLD("", 999, "of.options.SMOOTH_WORLD", false, false), + VOID_PARTICLES("", 999, "of.options.VOID_PARTICLES", false, false), + WATER_PARTICLES("", 999, "of.options.WATER_PARTICLES", false, false), + RAIN_SPLASH("", 999, "of.options.RAIN_SPLASH", false, false), + PORTAL_PARTICLES("", 999, "of.options.PORTAL_PARTICLES", false, false), + POTION_PARTICLES("", 999, "of.options.POTION_PARTICLES", false, false), + FIREWORK_PARTICLES("", 999, "of.options.FIREWORK_PARTICLES", false, false), + PROFILER("", 999, "of.options.PROFILER", false, false), + DRIPPING_WATER_LAVA("", 999, "of.options.DRIPPING_WATER_LAVA", false, false), + BETTER_SNOW("", 999, "of.options.BETTER_SNOW", false, false), + FULLSCREEN_MODE("", 999, "of.options.FULLSCREEN_MODE", false, false), + ANIMATED_TERRAIN("", 999, "of.options.ANIMATED_TERRAIN", false, false), + SWAMP_COLORS("", 999, "of.options.SWAMP_COLORS", false, false), + RANDOM_MOBS("", 999, "of.options.RANDOM_MOBS", false, false), + SMOOTH_BIOMES("", 999, "of.options.SMOOTH_BIOMES", false, false), + CUSTOM_FONTS("", 999, "of.options.CUSTOM_FONTS", false, false), + CUSTOM_COLORS("", 999, "of.options.CUSTOM_COLORS", false, false), + SHOW_CAPES("", 999, "of.options.SHOW_CAPES", false, false), + CONNECTED_TEXTURES("", 999, "of.options.CONNECTED_TEXTURES", false, false), + CUSTOM_ITEMS("", 999, "of.options.CUSTOM_ITEMS", false, false), + AA_LEVEL("", 999, "of.options.AA_LEVEL", true, false, 0.0F, 16.0F, 1.0F), + AF_LEVEL("", 999, "of.options.AF_LEVEL", true, false, 1.0F, 16.0F, 1.0F), + ANIMATED_TEXTURES("", 999, "of.options.ANIMATED_TEXTURES", false, false), + NATURAL_TEXTURES("", 999, "of.options.NATURAL_TEXTURES", false, false), + HELD_ITEM_TOOLTIPS("", 999, "of.options.HELD_ITEM_TOOLTIPS", false, false), + DROPPED_ITEMS("", 999, "of.options.DROPPED_ITEMS", false, false), + LAZY_CHUNK_LOADING("", 999, "of.options.LAZY_CHUNK_LOADING", false, false), + CUSTOM_SKY("", 999, "of.options.CUSTOM_SKY", false, false), + FAST_MATH("", 999, "of.options.FAST_MATH", false, false), + FAST_RENDER("", 999, "of.options.FAST_RENDER", false, false), + TRANSLUCENT_BLOCKS("", 999, "of.options.TRANSLUCENT_BLOCKS", false, false), + DYNAMIC_FOV("", 999, "of.options.DYNAMIC_FOV", false, false), + DYNAMIC_LIGHTS("", 999, "of.options.DYNAMIC_LIGHTS", false, false); + + private final boolean enumFloat; + private final boolean enumBoolean; + private final String enumString; + private final float valueStep; + private float valueMin; + private float valueMax; + private static final GameSettings.Options[] $VALUES = new GameSettings.Options[]{INVERT_MOUSE, SENSITIVITY, FOV, GAMMA, SATURATION, RENDER_DISTANCE, VIEW_BOBBING, ANAGLYPH, FRAMERATE_LIMIT, FBO_ENABLE, RENDER_CLOUDS, GRAPHICS, AMBIENT_OCCLUSION, GUI_SCALE, PARTICLES, CHAT_VISIBILITY, CHAT_COLOR, CHAT_LINKS, CHAT_OPACITY, CHAT_LINKS_PROMPT, SNOOPER_ENABLED, USE_FULLSCREEN, ENABLE_VSYNC, USE_VBO, TOUCHSCREEN, CHAT_SCALE, CHAT_WIDTH, CHAT_HEIGHT_FOCUSED, CHAT_HEIGHT_UNFOCUSED, MIPMAP_LEVELS, FORCE_UNICODE_FONT, STREAM_BYTES_PER_PIXEL, STREAM_VOLUME_MIC, STREAM_VOLUME_SYSTEM, STREAM_KBPS, STREAM_FPS, STREAM_COMPRESSION, STREAM_SEND_METADATA, STREAM_CHAT_ENABLED, STREAM_CHAT_USER_FILTER, STREAM_MIC_TOGGLE_BEHAVIOR, BLOCK_ALTERNATIVES, REDUCED_DEBUG_INFO, ENTITY_SHADOWS}; + private static final String __OBFID = "CL_00000653"; + + public static GameSettings.Options getEnumOptions(int p_74379_0_) + { + for (GameSettings.Options gamesettings$options : values()) + { + if (gamesettings$options.returnEnumOrdinal() == p_74379_0_) + { + return gamesettings$options; + } + } + + return null; + } + + private Options(String p_i0_3_, int p_i0_4_, String p_i0_5_, boolean p_i0_6_, boolean p_i0_7_) + { + this(p_i0_3_, p_i0_4_, p_i0_5_, p_i0_6_, p_i0_7_, 0.0F, 1.0F, 0.0F); + } + + private Options(String p_i1_3_, int p_i1_4_, String p_i1_5_, boolean p_i1_6_, boolean p_i1_7_, float p_i1_8_, float p_i1_9_, float p_i1_10_) + { + this.enumString = p_i1_5_; + this.enumFloat = p_i1_6_; + this.enumBoolean = p_i1_7_; + this.valueMin = p_i1_8_; + this.valueMax = p_i1_9_; + this.valueStep = p_i1_10_; + } + + public boolean getEnumFloat() + { + return this.enumFloat; + } + + public boolean getEnumBoolean() + { + return this.enumBoolean; + } + + public int returnEnumOrdinal() + { + return this.ordinal(); + } + + public String getEnumString() + { + return this.enumString; + } + + public float getValueMax() + { + return this.valueMax; + } + + public void setValueMax(float p_148263_1_) + { + this.valueMax = p_148263_1_; + } + + public float normalizeValue(float p_148266_1_) + { + return MathHelper.clamp_float((this.snapToStepClamp(p_148266_1_) - this.valueMin) / (this.valueMax - this.valueMin), 0.0F, 1.0F); + } + + public float denormalizeValue(float p_148262_1_) + { + return this.snapToStepClamp(this.valueMin + (this.valueMax - this.valueMin) * MathHelper.clamp_float(p_148262_1_, 0.0F, 1.0F)); + } + + public float snapToStepClamp(float p_148268_1_) + { + p_148268_1_ = this.snapToStep(p_148268_1_); + return MathHelper.clamp_float(p_148268_1_, this.valueMin, this.valueMax); + } + + protected float snapToStep(float p_148264_1_) + { + if (this.valueStep > 0.0F) + { + p_148264_1_ = this.valueStep * (float)Math.round(p_148264_1_ / this.valueStep); + } + + return p_148264_1_; + } + } +} diff --git a/src/minecraft/net/minecraft/client/settings/KeyBinding.java b/src/minecraft/net/minecraft/client/settings/KeyBinding.java new file mode 100644 index 0000000..84c4cc3 --- /dev/null +++ b/src/minecraft/net/minecraft/client/settings/KeyBinding.java @@ -0,0 +1,151 @@ +package net.minecraft.client.settings; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.util.List; +import java.util.Set; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.IntHashMap; + +public class KeyBinding implements Comparable +{ + private static final List keybindArray = Lists.newArrayList(); + private static final IntHashMap hash = new IntHashMap(); + private static final Set keybindSet = Sets.newHashSet(); + private final String keyDescription; + private final int keyCodeDefault; + private final String keyCategory; + private int keyCode; + + /** Is the key held down? */ + private boolean pressed; + private int pressTime; + + public static void onTick(int keyCode) + { + if (keyCode != 0) + { + KeyBinding keybinding = (KeyBinding)hash.lookup(keyCode); + + if (keybinding != null) + { + ++keybinding.pressTime; + } + } + } + + public static void setKeyBindState(int keyCode, boolean pressed) + { + if (keyCode != 0) + { + KeyBinding keybinding = (KeyBinding)hash.lookup(keyCode); + + if (keybinding != null) + { + keybinding.pressed = pressed; + } + } + } + + public static void unPressAllKeys() + { + for (KeyBinding keybinding : keybindArray) + { + keybinding.unpressKey(); + } + } + + public static void resetKeyBindingArrayAndHash() + { + hash.clearMap(); + + for (KeyBinding keybinding : keybindArray) + { + hash.addKey(keybinding.keyCode, keybinding); + } + } + + public static Set getKeybinds() + { + return keybindSet; + } + + public KeyBinding(String description, int keyCode, String category) + { + this.keyDescription = description; + this.keyCode = keyCode; + this.keyCodeDefault = keyCode; + this.keyCategory = category; + keybindArray.add(this); + hash.addKey(keyCode, this); + keybindSet.add(category); + } + + /** + * Returns true if the key is pressed (used for continuous querying). Should be used in tickers. + */ + public boolean isKeyDown() + { + return this.pressed; + } + + public String getKeyCategory() + { + return this.keyCategory; + } + + /** + * Returns true on the initial key press. For continuous querying use {@link isKeyDown()}. Should be used in key + * events. + */ + public boolean isPressed() + { + if (this.pressTime == 0) + { + return false; + } + else + { + --this.pressTime; + return true; + } + } + + private void unpressKey() + { + this.pressTime = 0; + this.pressed = false; + } + + public String getKeyDescription() + { + return this.keyDescription; + } + + public int getKeyCodeDefault() + { + return this.keyCodeDefault; + } + + public int getKeyCode() + { + return this.keyCode; + } + + public void setKeyCode(int keyCode) + { + this.keyCode = keyCode; + } + + public int compareTo(KeyBinding p_compareTo_1_) + { + int i = I18n.format(this.keyCategory, new Object[0]).compareTo(I18n.format(p_compareTo_1_.keyCategory, new Object[0])); + + if (i == 0) + { + i = I18n.format(this.keyDescription, new Object[0]).compareTo(I18n.format(p_compareTo_1_.keyDescription, new Object[0])); + } + + return i; + } +} diff --git a/src/minecraft/net/minecraft/client/shader/Framebuffer.java b/src/minecraft/net/minecraft/client/shader/Framebuffer.java new file mode 100644 index 0000000..f73d58e --- /dev/null +++ b/src/minecraft/net/minecraft/client/shader/Framebuffer.java @@ -0,0 +1,280 @@ +package net.minecraft.client.shader; + +import java.nio.ByteBuffer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import org.lwjgl.opengl.GL11; + +public class Framebuffer +{ + public int framebufferTextureWidth; + public int framebufferTextureHeight; + public int framebufferWidth; + public int framebufferHeight; + public boolean useDepth; + public int framebufferObject; + public int framebufferTexture; + public int depthBuffer; + public float[] framebufferColor; + public int framebufferFilter; + + public Framebuffer(int p_i45078_1_, int p_i45078_2_, boolean p_i45078_3_) + { + this.useDepth = p_i45078_3_; + this.framebufferObject = -1; + this.framebufferTexture = -1; + this.depthBuffer = -1; + this.framebufferColor = new float[4]; + this.framebufferColor[0] = 1.0F; + this.framebufferColor[1] = 1.0F; + this.framebufferColor[2] = 1.0F; + this.framebufferColor[3] = 0.0F; + this.createBindFramebuffer(p_i45078_1_, p_i45078_2_); + } + + public void createBindFramebuffer(int width, int height) + { + if (!OpenGlHelper.isFramebufferEnabled()) + { + this.framebufferWidth = width; + this.framebufferHeight = height; + } + else + { + GlStateManager.enableDepth(); + + if (this.framebufferObject >= 0) + { + this.deleteFramebuffer(); + } + + this.createFramebuffer(width, height); + this.checkFramebufferComplete(); + OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, 0); + } + } + + public void deleteFramebuffer() + { + if (OpenGlHelper.isFramebufferEnabled()) + { + this.unbindFramebufferTexture(); + this.unbindFramebuffer(); + + if (this.depthBuffer > -1) + { + OpenGlHelper.glDeleteRenderbuffers(this.depthBuffer); + this.depthBuffer = -1; + } + + if (this.framebufferTexture > -1) + { + TextureUtil.deleteTexture(this.framebufferTexture); + this.framebufferTexture = -1; + } + + if (this.framebufferObject > -1) + { + OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, 0); + OpenGlHelper.glDeleteFramebuffers(this.framebufferObject); + this.framebufferObject = -1; + } + } + } + + public void createFramebuffer(int width, int height) + { + this.framebufferWidth = width; + this.framebufferHeight = height; + this.framebufferTextureWidth = width; + this.framebufferTextureHeight = height; + + if (!OpenGlHelper.isFramebufferEnabled()) + { + this.framebufferClear(); + } + else + { + this.framebufferObject = OpenGlHelper.glGenFramebuffers(); + this.framebufferTexture = TextureUtil.glGenTextures(); + + if (this.useDepth) + { + this.depthBuffer = OpenGlHelper.glGenRenderbuffers(); + } + + this.setFramebufferFilter(9728); + GlStateManager.bindTexture(this.framebufferTexture); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, this.framebufferTextureWidth, this.framebufferTextureHeight, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)((ByteBuffer)null)); + OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, this.framebufferObject); + OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, 3553, this.framebufferTexture, 0); + + if (this.useDepth) + { + OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); + OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight); + OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); + } + + this.framebufferClear(); + this.unbindFramebufferTexture(); + } + } + + public void setFramebufferFilter(int p_147607_1_) + { + if (OpenGlHelper.isFramebufferEnabled()) + { + this.framebufferFilter = p_147607_1_; + GlStateManager.bindTexture(this.framebufferTexture); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, (float)p_147607_1_); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, (float)p_147607_1_); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10496.0F); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10496.0F); + GlStateManager.bindTexture(0); + } + } + + public void checkFramebufferComplete() + { + int i = OpenGlHelper.glCheckFramebufferStatus(OpenGlHelper.GL_FRAMEBUFFER); + + if (i != OpenGlHelper.GL_FRAMEBUFFER_COMPLETE) + { + if (i == OpenGlHelper.GL_FB_INCOMPLETE_ATTACHMENT) + { + throw new RuntimeException("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"); + } + else if (i == OpenGlHelper.GL_FB_INCOMPLETE_MISS_ATTACH) + { + throw new RuntimeException("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"); + } + else if (i == OpenGlHelper.GL_FB_INCOMPLETE_DRAW_BUFFER) + { + throw new RuntimeException("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER"); + } + else if (i == OpenGlHelper.GL_FB_INCOMPLETE_READ_BUFFER) + { + throw new RuntimeException("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER"); + } + else + { + throw new RuntimeException("glCheckFramebufferStatus returned unknown status:" + i); + } + } + } + + public void bindFramebufferTexture() + { + if (OpenGlHelper.isFramebufferEnabled()) + { + GlStateManager.bindTexture(this.framebufferTexture); + } + } + + public void unbindFramebufferTexture() + { + if (OpenGlHelper.isFramebufferEnabled()) + { + GlStateManager.bindTexture(0); + } + } + + public void bindFramebuffer(boolean p_147610_1_) + { + if (OpenGlHelper.isFramebufferEnabled()) + { + OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, this.framebufferObject); + + if (p_147610_1_) + { + GlStateManager.viewport(0, 0, this.framebufferWidth, this.framebufferHeight); + } + } + } + + public void unbindFramebuffer() + { + if (OpenGlHelper.isFramebufferEnabled()) + { + OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, 0); + } + } + + public void setFramebufferColor(float p_147604_1_, float p_147604_2_, float p_147604_3_, float p_147604_4_) + { + this.framebufferColor[0] = p_147604_1_; + this.framebufferColor[1] = p_147604_2_; + this.framebufferColor[2] = p_147604_3_; + this.framebufferColor[3] = p_147604_4_; + } + + public void framebufferRender(int p_147615_1_, int p_147615_2_) + { + this.framebufferRenderExt(p_147615_1_, p_147615_2_, true); + } + + public void framebufferRenderExt(int p_178038_1_, int p_178038_2_, boolean p_178038_3_) + { + if (OpenGlHelper.isFramebufferEnabled()) + { + GlStateManager.colorMask(true, true, true, false); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, (double)p_178038_1_, (double)p_178038_2_, 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + GlStateManager.viewport(0, 0, p_178038_1_, p_178038_2_); + GlStateManager.enableTexture2D(); + GlStateManager.disableLighting(); + GlStateManager.disableAlpha(); + + if (p_178038_3_) + { + GlStateManager.disableBlend(); + GlStateManager.enableColorMaterial(); + } + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.bindFramebufferTexture(); + float f = (float)p_178038_1_; + float f1 = (float)p_178038_2_; + float f2 = (float)this.framebufferWidth / (float)this.framebufferTextureWidth; + float f3 = (float)this.framebufferHeight / (float)this.framebufferTextureHeight; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.pos(0.0D, (double)f1, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex(); + worldrenderer.pos((double)f, (double)f1, 0.0D).tex((double)f2, 0.0D).color(255, 255, 255, 255).endVertex(); + worldrenderer.pos((double)f, 0.0D, 0.0D).tex((double)f2, (double)f3).color(255, 255, 255, 255).endVertex(); + worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, (double)f3).color(255, 255, 255, 255).endVertex(); + tessellator.draw(); + this.unbindFramebufferTexture(); + GlStateManager.depthMask(true); + GlStateManager.colorMask(true, true, true, true); + } + } + + public void framebufferClear() + { + this.bindFramebuffer(true); + GlStateManager.clearColor(this.framebufferColor[0], this.framebufferColor[1], this.framebufferColor[2], this.framebufferColor[3]); + int i = 16384; + + if (this.useDepth) + { + GlStateManager.clearDepth(1.0D); + i |= 256; + } + + GlStateManager.clear(i); + this.unbindFramebuffer(); + } +} diff --git a/src/minecraft/net/minecraft/client/shader/Shader.java b/src/minecraft/net/minecraft/client/shader/Shader.java new file mode 100644 index 0000000..a96fb03 --- /dev/null +++ b/src/minecraft/net/minecraft/client/shader/Shader.java @@ -0,0 +1,117 @@ +package net.minecraft.client.shader; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.util.JsonException; +import org.lwjgl.util.vector.Matrix4f; + +public class Shader +{ + private final ShaderManager manager; + public final Framebuffer framebufferIn; + public final Framebuffer framebufferOut; + private final List listAuxFramebuffers = Lists.newArrayList(); + private final List listAuxNames = Lists.newArrayList(); + private final List listAuxWidths = Lists.newArrayList(); + private final List listAuxHeights = Lists.newArrayList(); + private Matrix4f projectionMatrix; + + public Shader(IResourceManager p_i45089_1_, String p_i45089_2_, Framebuffer p_i45089_3_, Framebuffer p_i45089_4_) throws JsonException, IOException + { + this.manager = new ShaderManager(p_i45089_1_, p_i45089_2_); + this.framebufferIn = p_i45089_3_; + this.framebufferOut = p_i45089_4_; + } + + public void deleteShader() + { + this.manager.deleteShader(); + } + + public void addAuxFramebuffer(String p_148041_1_, Object p_148041_2_, int p_148041_3_, int p_148041_4_) + { + this.listAuxNames.add(this.listAuxNames.size(), p_148041_1_); + this.listAuxFramebuffers.add(this.listAuxFramebuffers.size(), p_148041_2_); + this.listAuxWidths.add(this.listAuxWidths.size(), Integer.valueOf(p_148041_3_)); + this.listAuxHeights.add(this.listAuxHeights.size(), Integer.valueOf(p_148041_4_)); + } + + private void preLoadShader() + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + GlStateManager.disableDepth(); + GlStateManager.disableAlpha(); + GlStateManager.disableFog(); + GlStateManager.disableLighting(); + GlStateManager.disableColorMaterial(); + GlStateManager.enableTexture2D(); + GlStateManager.bindTexture(0); + } + + public void setProjectionMatrix(Matrix4f p_148045_1_) + { + this.projectionMatrix = p_148045_1_; + } + + public void loadShader(float p_148042_1_) + { + this.preLoadShader(); + this.framebufferIn.unbindFramebuffer(); + float f = (float)this.framebufferOut.framebufferTextureWidth; + float f1 = (float)this.framebufferOut.framebufferTextureHeight; + GlStateManager.viewport(0, 0, (int)f, (int)f1); + this.manager.addSamplerTexture("DiffuseSampler", this.framebufferIn); + + for (int i = 0; i < this.listAuxFramebuffers.size(); ++i) + { + this.manager.addSamplerTexture((String)this.listAuxNames.get(i), this.listAuxFramebuffers.get(i)); + this.manager.getShaderUniformOrDefault("AuxSize" + i).set((float)((Integer)this.listAuxWidths.get(i)).intValue(), (float)((Integer)this.listAuxHeights.get(i)).intValue()); + } + + this.manager.getShaderUniformOrDefault("ProjMat").set(this.projectionMatrix); + this.manager.getShaderUniformOrDefault("InSize").set((float)this.framebufferIn.framebufferTextureWidth, (float)this.framebufferIn.framebufferTextureHeight); + this.manager.getShaderUniformOrDefault("OutSize").set(f, f1); + this.manager.getShaderUniformOrDefault("Time").set(p_148042_1_); + Minecraft minecraft = Minecraft.getMinecraft(); + this.manager.getShaderUniformOrDefault("ScreenSize").set((float)minecraft.displayWidth, (float)minecraft.displayHeight); + this.manager.useShader(); + this.framebufferOut.framebufferClear(); + this.framebufferOut.bindFramebuffer(false); + GlStateManager.depthMask(false); + GlStateManager.colorMask(true, true, true, true); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos(0.0D, (double)f1, 500.0D).color(255, 255, 255, 255).endVertex(); + worldrenderer.pos((double)f, (double)f1, 500.0D).color(255, 255, 255, 255).endVertex(); + worldrenderer.pos((double)f, 0.0D, 500.0D).color(255, 255, 255, 255).endVertex(); + worldrenderer.pos(0.0D, 0.0D, 500.0D).color(255, 255, 255, 255).endVertex(); + tessellator.draw(); + GlStateManager.depthMask(true); + GlStateManager.colorMask(true, true, true, true); + this.manager.endShader(); + this.framebufferOut.unbindFramebuffer(); + this.framebufferIn.unbindFramebufferTexture(); + + for (Object object : this.listAuxFramebuffers) + { + if (object instanceof Framebuffer) + { + ((Framebuffer)object).unbindFramebufferTexture(); + } + } + } + + public ShaderManager getShaderManager() + { + return this.manager; + } +} diff --git a/src/minecraft/net/minecraft/client/shader/ShaderDefault.java b/src/minecraft/net/minecraft/client/shader/ShaderDefault.java new file mode 100644 index 0000000..67c7e57 --- /dev/null +++ b/src/minecraft/net/minecraft/client/shader/ShaderDefault.java @@ -0,0 +1,47 @@ +package net.minecraft.client.shader; + +import org.lwjgl.util.vector.Matrix4f; + +public class ShaderDefault extends ShaderUniform +{ + public ShaderDefault() + { + super("dummy", 4, 1, (ShaderManager)null); + } + + public void set(float p_148090_1_) + { + } + + public void set(float p_148087_1_, float p_148087_2_) + { + } + + public void set(float p_148095_1_, float p_148095_2_, float p_148095_3_) + { + } + + public void set(float p_148081_1_, float p_148081_2_, float p_148081_3_, float p_148081_4_) + { + } + + public void func_148092_b(float p_148092_1_, float p_148092_2_, float p_148092_3_, float p_148092_4_) + { + } + + public void set(int p_148083_1_, int p_148083_2_, int p_148083_3_, int p_148083_4_) + { + } + + public void set(float[] p_148097_1_) + { + } + + public void set(float p_148094_1_, float p_148094_2_, float p_148094_3_, float p_148094_4_, float p_148094_5_, float p_148094_6_, float p_148094_7_, float p_148094_8_, float p_148094_9_, float p_148094_10_, float p_148094_11_, float p_148094_12_, float p_148094_13_, float p_148094_14_, float p_148094_15_, float p_148094_16_) + { + } + + public void set(Matrix4f p_148088_1_) + { + } +} diff --git a/src/minecraft/net/minecraft/client/shader/ShaderGroup.java b/src/minecraft/net/minecraft/client/shader/ShaderGroup.java new file mode 100644 index 0000000..68e6929 --- /dev/null +++ b/src/minecraft/net/minecraft/client/shader/ShaderGroup.java @@ -0,0 +1,407 @@ +package net.minecraft.client.shader; + +import com.google.common.base.Charsets; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Map; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.util.JsonException; +import net.minecraft.util.JsonUtils; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.IOUtils; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.vector.Matrix4f; + +public class ShaderGroup +{ + private Framebuffer mainFramebuffer; + private IResourceManager resourceManager; + private String shaderGroupName; + public final List listShaders = Lists.newArrayList(); + private final Map mapFramebuffers = Maps.newHashMap(); + private final List listFramebuffers = Lists.newArrayList(); + private Matrix4f projectionMatrix; + private int mainFramebufferWidth; + private int mainFramebufferHeight; + private float field_148036_j; + private float field_148037_k; + + public ShaderGroup(TextureManager p_i1050_1_, IResourceManager p_i1050_2_, Framebuffer p_i1050_3_, ResourceLocation p_i1050_4_) throws JsonException, IOException, JsonSyntaxException + { + this.resourceManager = p_i1050_2_; + this.mainFramebuffer = p_i1050_3_; + this.field_148036_j = 0.0F; + this.field_148037_k = 0.0F; + this.mainFramebufferWidth = p_i1050_3_.framebufferWidth; + this.mainFramebufferHeight = p_i1050_3_.framebufferHeight; + this.shaderGroupName = p_i1050_4_.toString(); + this.resetProjectionMatrix(); + this.parseGroup(p_i1050_1_, p_i1050_4_); + } + + public void parseGroup(TextureManager p_152765_1_, ResourceLocation p_152765_2_) throws JsonException, IOException, JsonSyntaxException + { + JsonParser jsonparser = new JsonParser(); + InputStream inputstream = null; + + try + { + IResource iresource = this.resourceManager.getResource(p_152765_2_); + inputstream = iresource.getInputStream(); + JsonObject jsonobject = jsonparser.parse(IOUtils.toString(inputstream, Charsets.UTF_8)).getAsJsonObject(); + + if (JsonUtils.isJsonArray(jsonobject, "targets")) + { + JsonArray jsonarray = jsonobject.getAsJsonArray("targets"); + int i = 0; + + for (JsonElement jsonelement : jsonarray) + { + try + { + this.initTarget(jsonelement); + } + catch (Exception exception1) + { + JsonException jsonexception1 = JsonException.func_151379_a(exception1); + jsonexception1.func_151380_a("targets[" + i + "]"); + throw jsonexception1; + } + + ++i; + } + } + + if (JsonUtils.isJsonArray(jsonobject, "passes")) + { + JsonArray jsonarray1 = jsonobject.getAsJsonArray("passes"); + int j = 0; + + for (JsonElement jsonelement1 : jsonarray1) + { + try + { + this.parsePass(p_152765_1_, jsonelement1); + } + catch (Exception exception) + { + JsonException jsonexception2 = JsonException.func_151379_a(exception); + jsonexception2.func_151380_a("passes[" + j + "]"); + throw jsonexception2; + } + + ++j; + } + } + } + catch (Exception exception2) + { + JsonException jsonexception = JsonException.func_151379_a(exception2); + jsonexception.func_151381_b(p_152765_2_.getResourcePath()); + throw jsonexception; + } + finally + { + IOUtils.closeQuietly(inputstream); + } + } + + private void initTarget(JsonElement p_148027_1_) throws JsonException + { + if (JsonUtils.isString(p_148027_1_)) + { + this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight); + } + else + { + JsonObject jsonobject = JsonUtils.getJsonObject(p_148027_1_, "target"); + String s = JsonUtils.getString(jsonobject, "name"); + int i = JsonUtils.getInt(jsonobject, "width", this.mainFramebufferWidth); + int j = JsonUtils.getInt(jsonobject, "height", this.mainFramebufferHeight); + + if (this.mapFramebuffers.containsKey(s)) + { + throw new JsonException(s + " is already defined"); + } + + this.addFramebuffer(s, i, j); + } + } + + private void parsePass(TextureManager p_152764_1_, JsonElement p_152764_2_) throws JsonException, IOException + { + JsonObject jsonobject = JsonUtils.getJsonObject(p_152764_2_, "pass"); + String s = JsonUtils.getString(jsonobject, "name"); + String s1 = JsonUtils.getString(jsonobject, "intarget"); + String s2 = JsonUtils.getString(jsonobject, "outtarget"); + Framebuffer framebuffer = this.getFramebuffer(s1); + Framebuffer framebuffer1 = this.getFramebuffer(s2); + + if (framebuffer == null) + { + throw new JsonException("Input target \'" + s1 + "\' does not exist"); + } + else if (framebuffer1 == null) + { + throw new JsonException("Output target \'" + s2 + "\' does not exist"); + } + else + { + Shader shader = this.addShader(s, framebuffer, framebuffer1); + JsonArray jsonarray = JsonUtils.getJsonArray(jsonobject, "auxtargets", (JsonArray)null); + + if (jsonarray != null) + { + int i = 0; + + for (JsonElement jsonelement : jsonarray) + { + try + { + JsonObject jsonobject1 = JsonUtils.getJsonObject(jsonelement, "auxtarget"); + String s4 = JsonUtils.getString(jsonobject1, "name"); + String s3 = JsonUtils.getString(jsonobject1, "id"); + Framebuffer framebuffer2 = this.getFramebuffer(s3); + + if (framebuffer2 == null) + { + ResourceLocation resourcelocation = new ResourceLocation("textures/effect/" + s3 + ".png"); + + try + { + this.resourceManager.getResource(resourcelocation); + } + catch (FileNotFoundException var24) + { + throw new JsonException("Render target or texture \'" + s3 + "\' does not exist"); + } + + p_152764_1_.bindTexture(resourcelocation); + ITextureObject itextureobject = p_152764_1_.getTexture(resourcelocation); + int j = JsonUtils.getInt(jsonobject1, "width"); + int k = JsonUtils.getInt(jsonobject1, "height"); + boolean flag = JsonUtils.getBoolean(jsonobject1, "bilinear"); + + if (flag) + { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + } + else + { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + } + + shader.addAuxFramebuffer(s4, Integer.valueOf(itextureobject.getGlTextureId()), j, k); + } + else + { + shader.addAuxFramebuffer(s4, framebuffer2, framebuffer2.framebufferTextureWidth, framebuffer2.framebufferTextureHeight); + } + } + catch (Exception exception1) + { + JsonException jsonexception = JsonException.func_151379_a(exception1); + jsonexception.func_151380_a("auxtargets[" + i + "]"); + throw jsonexception; + } + + ++i; + } + } + + JsonArray jsonarray1 = JsonUtils.getJsonArray(jsonobject, "uniforms", (JsonArray)null); + + if (jsonarray1 != null) + { + int l = 0; + + for (JsonElement jsonelement1 : jsonarray1) + { + try + { + this.initUniform(jsonelement1); + } + catch (Exception exception) + { + JsonException jsonexception1 = JsonException.func_151379_a(exception); + jsonexception1.func_151380_a("uniforms[" + l + "]"); + throw jsonexception1; + } + + ++l; + } + } + } + } + + private void initUniform(JsonElement p_148028_1_) throws JsonException + { + JsonObject jsonobject = JsonUtils.getJsonObject(p_148028_1_, "uniform"); + String s = JsonUtils.getString(jsonobject, "name"); + ShaderUniform shaderuniform = ((Shader)this.listShaders.get(this.listShaders.size() - 1)).getShaderManager().getShaderUniform(s); + + if (shaderuniform == null) + { + throw new JsonException("Uniform \'" + s + "\' does not exist"); + } + else + { + float[] afloat = new float[4]; + int i = 0; + + for (JsonElement jsonelement : JsonUtils.getJsonArray(jsonobject, "values")) + { + try + { + afloat[i] = JsonUtils.getFloat(jsonelement, "value"); + } + catch (Exception exception) + { + JsonException jsonexception = JsonException.func_151379_a(exception); + jsonexception.func_151380_a("values[" + i + "]"); + throw jsonexception; + } + + ++i; + } + + switch (i) + { + case 0: + default: + break; + + case 1: + shaderuniform.set(afloat[0]); + break; + + case 2: + shaderuniform.set(afloat[0], afloat[1]); + break; + + case 3: + shaderuniform.set(afloat[0], afloat[1], afloat[2]); + break; + + case 4: + shaderuniform.set(afloat[0], afloat[1], afloat[2], afloat[3]); + } + } + } + + public Framebuffer getFramebufferRaw(String p_177066_1_) + { + return (Framebuffer)this.mapFramebuffers.get(p_177066_1_); + } + + public void addFramebuffer(String p_148020_1_, int p_148020_2_, int p_148020_3_) + { + Framebuffer framebuffer = new Framebuffer(p_148020_2_, p_148020_3_, true); + framebuffer.setFramebufferColor(0.0F, 0.0F, 0.0F, 0.0F); + this.mapFramebuffers.put(p_148020_1_, framebuffer); + + if (p_148020_2_ == this.mainFramebufferWidth && p_148020_3_ == this.mainFramebufferHeight) + { + this.listFramebuffers.add(framebuffer); + } + } + + public void deleteShaderGroup() + { + for (Framebuffer framebuffer : this.mapFramebuffers.values()) + { + framebuffer.deleteFramebuffer(); + } + + for (Shader shader : this.listShaders) + { + shader.deleteShader(); + } + + this.listShaders.clear(); + } + + public Shader addShader(String p_148023_1_, Framebuffer p_148023_2_, Framebuffer p_148023_3_) throws JsonException, IOException + { + Shader shader = new Shader(this.resourceManager, p_148023_1_, p_148023_2_, p_148023_3_); + this.listShaders.add(this.listShaders.size(), shader); + return shader; + } + + private void resetProjectionMatrix() + { + this.projectionMatrix = new Matrix4f(); + this.projectionMatrix.setIdentity(); + this.projectionMatrix.m00 = 2.0F / (float)this.mainFramebuffer.framebufferTextureWidth; + this.projectionMatrix.m11 = 2.0F / (float)(-this.mainFramebuffer.framebufferTextureHeight); + this.projectionMatrix.m22 = -0.0020001999F; + this.projectionMatrix.m33 = 1.0F; + this.projectionMatrix.m03 = -1.0F; + this.projectionMatrix.m13 = 1.0F; + this.projectionMatrix.m23 = -1.0001999F; + } + + public void createBindFramebuffers(int width, int height) + { + this.mainFramebufferWidth = this.mainFramebuffer.framebufferTextureWidth; + this.mainFramebufferHeight = this.mainFramebuffer.framebufferTextureHeight; + this.resetProjectionMatrix(); + + for (Shader shader : this.listShaders) + { + shader.setProjectionMatrix(this.projectionMatrix); + } + + for (Framebuffer framebuffer : this.listFramebuffers) + { + framebuffer.createBindFramebuffer(width, height); + } + } + + public void loadShaderGroup(float partialTicks) + { + if (partialTicks < this.field_148037_k) + { + this.field_148036_j += 1.0F - this.field_148037_k; + this.field_148036_j += partialTicks; + } + else + { + this.field_148036_j += partialTicks - this.field_148037_k; + } + + for (this.field_148037_k = partialTicks; this.field_148036_j > 20.0F; this.field_148036_j -= 20.0F) + { + ; + } + + for (Shader shader : this.listShaders) + { + shader.loadShader(this.field_148036_j / 20.0F); + } + } + + public final String getShaderGroupName() + { + return this.shaderGroupName; + } + + private Framebuffer getFramebuffer(String p_148017_1_) + { + return p_148017_1_ == null ? null : (p_148017_1_.equals("minecraft:main") ? this.mainFramebuffer : (Framebuffer)this.mapFramebuffers.get(p_148017_1_)); + } +} diff --git a/src/minecraft/net/minecraft/client/shader/ShaderLinkHelper.java b/src/minecraft/net/minecraft/client/shader/ShaderLinkHelper.java new file mode 100644 index 0000000..a58a849 --- /dev/null +++ b/src/minecraft/net/minecraft/client/shader/ShaderLinkHelper.java @@ -0,0 +1,58 @@ +package net.minecraft.client.shader; + +import java.io.IOException; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.util.JsonException; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ShaderLinkHelper +{ + private static final Logger logger = LogManager.getLogger(); + private static ShaderLinkHelper staticShaderLinkHelper; + + public static void setNewStaticShaderLinkHelper() + { + staticShaderLinkHelper = new ShaderLinkHelper(); + } + + public static ShaderLinkHelper getStaticShaderLinkHelper() + { + return staticShaderLinkHelper; + } + + public void deleteShader(ShaderManager p_148077_1_) + { + p_148077_1_.getFragmentShaderLoader().deleteShader(p_148077_1_); + p_148077_1_.getVertexShaderLoader().deleteShader(p_148077_1_); + OpenGlHelper.glDeleteProgram(p_148077_1_.getProgram()); + } + + public int createProgram() throws JsonException + { + int i = OpenGlHelper.glCreateProgram(); + + if (i <= 0) + { + throw new JsonException("Could not create shader program (returned program ID " + i + ")"); + } + else + { + return i; + } + } + + public void linkProgram(ShaderManager manager) throws IOException + { + manager.getFragmentShaderLoader().attachShader(manager); + manager.getVertexShaderLoader().attachShader(manager); + OpenGlHelper.glLinkProgram(manager.getProgram()); + int i = OpenGlHelper.glGetProgrami(manager.getProgram(), OpenGlHelper.GL_LINK_STATUS); + + if (i == 0) + { + logger.warn("Error encountered when linking program containing VS " + manager.getVertexShaderLoader().getShaderFilename() + " and FS " + manager.getFragmentShaderLoader().getShaderFilename() + ". Log output:"); + logger.warn(OpenGlHelper.glGetProgramInfoLog(manager.getProgram(), 32768)); + } + } +} diff --git a/src/minecraft/net/minecraft/client/shader/ShaderLoader.java b/src/minecraft/net/minecraft/client/shader/ShaderLoader.java new file mode 100644 index 0000000..3aeef77 --- /dev/null +++ b/src/minecraft/net/minecraft/client/shader/ShaderLoader.java @@ -0,0 +1,137 @@ +package net.minecraft.client.shader; + +import com.google.common.collect.Maps; +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.util.Map; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.util.JsonException; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; +import org.lwjgl.BufferUtils; + +public class ShaderLoader +{ + private final ShaderLoader.ShaderType shaderType; + private final String shaderFilename; + private int shader; + private int shaderAttachCount = 0; + + private ShaderLoader(ShaderLoader.ShaderType type, int shaderId, String filename) + { + this.shaderType = type; + this.shader = shaderId; + this.shaderFilename = filename; + } + + public void attachShader(ShaderManager manager) + { + ++this.shaderAttachCount; + OpenGlHelper.glAttachShader(manager.getProgram(), this.shader); + } + + public void deleteShader(ShaderManager manager) + { + --this.shaderAttachCount; + + if (this.shaderAttachCount <= 0) + { + OpenGlHelper.glDeleteShader(this.shader); + this.shaderType.getLoadedShaders().remove(this.shaderFilename); + } + } + + public String getShaderFilename() + { + return this.shaderFilename; + } + + public static ShaderLoader loadShader(IResourceManager resourceManager, ShaderLoader.ShaderType type, String filename) throws IOException + { + ShaderLoader shaderloader = (ShaderLoader)type.getLoadedShaders().get(filename); + + if (shaderloader == null) + { + ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + filename + type.getShaderExtension()); + BufferedInputStream bufferedinputstream = new BufferedInputStream(resourceManager.getResource(resourcelocation).getInputStream()); + byte[] abyte = toByteArray(bufferedinputstream); + ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length); + bytebuffer.put(abyte); + bytebuffer.position(0); + int i = OpenGlHelper.glCreateShader(type.getShaderMode()); + OpenGlHelper.glShaderSource(i, bytebuffer); + OpenGlHelper.glCompileShader(i); + + if (OpenGlHelper.glGetShaderi(i, OpenGlHelper.GL_COMPILE_STATUS) == 0) + { + String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(i, 32768)); + JsonException jsonexception = new JsonException("Couldn\'t compile " + type.getShaderName() + " program: " + s); + jsonexception.func_151381_b(resourcelocation.getResourcePath()); + throw jsonexception; + } + + shaderloader = new ShaderLoader(type, i, filename); + type.getLoadedShaders().put(filename, shaderloader); + } + + return shaderloader; + } + + protected static byte[] toByteArray(BufferedInputStream p_177064_0_) throws IOException + { + byte[] abyte; + + try + { + abyte = IOUtils.toByteArray((InputStream)p_177064_0_); + } + finally + { + p_177064_0_.close(); + } + + return abyte; + } + + public static enum ShaderType + { + VERTEX("vertex", ".vsh", OpenGlHelper.GL_VERTEX_SHADER), + FRAGMENT("fragment", ".fsh", OpenGlHelper.GL_FRAGMENT_SHADER); + + private final String shaderName; + private final String shaderExtension; + private final int shaderMode; + private final Map loadedShaders = Maps.newHashMap(); + + private ShaderType(String p_i45090_3_, String p_i45090_4_, int p_i45090_5_) + { + this.shaderName = p_i45090_3_; + this.shaderExtension = p_i45090_4_; + this.shaderMode = p_i45090_5_; + } + + public String getShaderName() + { + return this.shaderName; + } + + protected String getShaderExtension() + { + return this.shaderExtension; + } + + protected int getShaderMode() + { + return this.shaderMode; + } + + protected Map getLoadedShaders() + { + return this.loadedShaders; + } + } +} diff --git a/src/minecraft/net/minecraft/client/shader/ShaderManager.java b/src/minecraft/net/minecraft/client/shader/ShaderManager.java new file mode 100644 index 0000000..1f99964 --- /dev/null +++ b/src/minecraft/net/minecraft/client/shader/ShaderManager.java @@ -0,0 +1,420 @@ +package net.minecraft.client.shader; + +import com.google.common.base.Charsets; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Map; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.util.JsonBlendingMode; +import net.minecraft.client.util.JsonException; +import net.minecraft.util.JsonUtils; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ShaderManager +{ + private static final Logger logger = LogManager.getLogger(); + private static final ShaderDefault defaultShaderUniform = new ShaderDefault(); + private static ShaderManager staticShaderManager = null; + private static int currentProgram = -1; + private static boolean field_148000_e = true; + private final Map shaderSamplers = Maps.newHashMap(); + private final List samplerNames = Lists.newArrayList(); + private final List shaderSamplerLocations = Lists.newArrayList(); + private final List shaderUniforms = Lists.newArrayList(); + private final List shaderUniformLocations = Lists.newArrayList(); + private final Map mappedShaderUniforms = Maps.newHashMap(); + private final int program; + private final String programFilename; + private final boolean useFaceCulling; + private boolean isDirty; + private final JsonBlendingMode field_148016_p; + private final List attribLocations; + private final List attributes; + private final ShaderLoader vertexShaderLoader; + private final ShaderLoader fragmentShaderLoader; + + public ShaderManager(IResourceManager resourceManager, String programName) throws JsonException, IOException + { + JsonParser jsonparser = new JsonParser(); + ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + programName + ".json"); + this.programFilename = programName; + InputStream inputstream = null; + + try + { + inputstream = resourceManager.getResource(resourcelocation).getInputStream(); + JsonObject jsonobject = jsonparser.parse(IOUtils.toString(inputstream, Charsets.UTF_8)).getAsJsonObject(); + String s = JsonUtils.getString(jsonobject, "vertex"); + String s1 = JsonUtils.getString(jsonobject, "fragment"); + JsonArray jsonarray = JsonUtils.getJsonArray(jsonobject, "samplers", (JsonArray)null); + + if (jsonarray != null) + { + int i = 0; + + for (JsonElement jsonelement : jsonarray) + { + try + { + this.parseSampler(jsonelement); + } + catch (Exception exception2) + { + JsonException jsonexception1 = JsonException.func_151379_a(exception2); + jsonexception1.func_151380_a("samplers[" + i + "]"); + throw jsonexception1; + } + + ++i; + } + } + + JsonArray jsonarray1 = JsonUtils.getJsonArray(jsonobject, "attributes", (JsonArray)null); + + if (jsonarray1 != null) + { + int j = 0; + this.attribLocations = Lists.newArrayListWithCapacity(jsonarray1.size()); + this.attributes = Lists.newArrayListWithCapacity(jsonarray1.size()); + + for (JsonElement jsonelement1 : jsonarray1) + { + try + { + this.attributes.add(JsonUtils.getString(jsonelement1, "attribute")); + } + catch (Exception exception1) + { + JsonException jsonexception2 = JsonException.func_151379_a(exception1); + jsonexception2.func_151380_a("attributes[" + j + "]"); + throw jsonexception2; + } + + ++j; + } + } + else + { + this.attribLocations = null; + this.attributes = null; + } + + JsonArray jsonarray2 = JsonUtils.getJsonArray(jsonobject, "uniforms", (JsonArray)null); + + if (jsonarray2 != null) + { + int k = 0; + + for (JsonElement jsonelement2 : jsonarray2) + { + try + { + this.parseUniform(jsonelement2); + } + catch (Exception exception) + { + JsonException jsonexception3 = JsonException.func_151379_a(exception); + jsonexception3.func_151380_a("uniforms[" + k + "]"); + throw jsonexception3; + } + + ++k; + } + } + + this.field_148016_p = JsonBlendingMode.func_148110_a(JsonUtils.getJsonObject(jsonobject, "blend", (JsonObject)null)); + this.useFaceCulling = JsonUtils.getBoolean(jsonobject, "cull", true); + this.vertexShaderLoader = ShaderLoader.loadShader(resourceManager, ShaderLoader.ShaderType.VERTEX, s); + this.fragmentShaderLoader = ShaderLoader.loadShader(resourceManager, ShaderLoader.ShaderType.FRAGMENT, s1); + this.program = ShaderLinkHelper.getStaticShaderLinkHelper().createProgram(); + ShaderLinkHelper.getStaticShaderLinkHelper().linkProgram(this); + this.setupUniforms(); + + if (this.attributes != null) + { + for (String s2 : this.attributes) + { + int l = OpenGlHelper.glGetAttribLocation(this.program, s2); + this.attribLocations.add(Integer.valueOf(l)); + } + } + } + catch (Exception exception3) + { + JsonException jsonexception = JsonException.func_151379_a(exception3); + jsonexception.func_151381_b(resourcelocation.getResourcePath()); + throw jsonexception; + } + finally + { + IOUtils.closeQuietly(inputstream); + } + + this.markDirty(); + } + + public void deleteShader() + { + ShaderLinkHelper.getStaticShaderLinkHelper().deleteShader(this); + } + + public void endShader() + { + OpenGlHelper.glUseProgram(0); + currentProgram = -1; + staticShaderManager = null; + field_148000_e = true; + + for (int i = 0; i < this.shaderSamplerLocations.size(); ++i) + { + if (this.shaderSamplers.get(this.samplerNames.get(i)) != null) + { + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit + i); + GlStateManager.bindTexture(0); + } + } + } + + public void useShader() + { + this.isDirty = false; + staticShaderManager = this; + this.field_148016_p.func_148109_a(); + + if (this.program != currentProgram) + { + OpenGlHelper.glUseProgram(this.program); + currentProgram = this.program; + } + + if (this.useFaceCulling) + { + GlStateManager.enableCull(); + } + else + { + GlStateManager.disableCull(); + } + + for (int i = 0; i < this.shaderSamplerLocations.size(); ++i) + { + if (this.shaderSamplers.get(this.samplerNames.get(i)) != null) + { + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit + i); + GlStateManager.enableTexture2D(); + Object object = this.shaderSamplers.get(this.samplerNames.get(i)); + int j = -1; + + if (object instanceof Framebuffer) + { + j = ((Framebuffer)object).framebufferTexture; + } + else if (object instanceof ITextureObject) + { + j = ((ITextureObject)object).getGlTextureId(); + } + else if (object instanceof Integer) + { + j = ((Integer)object).intValue(); + } + + if (j != -1) + { + GlStateManager.bindTexture(j); + OpenGlHelper.glUniform1i(OpenGlHelper.glGetUniformLocation(this.program, (CharSequence)this.samplerNames.get(i)), i); + } + } + } + + for (ShaderUniform shaderuniform : this.shaderUniforms) + { + shaderuniform.upload(); + } + } + + public void markDirty() + { + this.isDirty = true; + } + + /** + * gets a shader uniform for the name given. null if not found. + */ + public ShaderUniform getShaderUniform(String p_147991_1_) + { + return this.mappedShaderUniforms.containsKey(p_147991_1_) ? (ShaderUniform)this.mappedShaderUniforms.get(p_147991_1_) : null; + } + + /** + * gets a shader uniform for the name given. if not found, returns a default not-null value + */ + public ShaderUniform getShaderUniformOrDefault(String p_147984_1_) + { + return (ShaderUniform)(this.mappedShaderUniforms.containsKey(p_147984_1_) ? (ShaderUniform)this.mappedShaderUniforms.get(p_147984_1_) : defaultShaderUniform); + } + + /** + * goes through the parsed uniforms and samplers and connects them to their GL counterparts. + */ + private void setupUniforms() + { + int i = 0; + + for (int j = 0; i < this.samplerNames.size(); ++j) + { + String s = (String)this.samplerNames.get(i); + int k = OpenGlHelper.glGetUniformLocation(this.program, s); + + if (k == -1) + { + logger.warn("Shader " + this.programFilename + "could not find sampler named " + s + " in the specified shader program."); + this.shaderSamplers.remove(s); + this.samplerNames.remove(j); + --j; + } + else + { + this.shaderSamplerLocations.add(Integer.valueOf(k)); + } + + ++i; + } + + for (ShaderUniform shaderuniform : this.shaderUniforms) + { + String s1 = shaderuniform.getShaderName(); + int l = OpenGlHelper.glGetUniformLocation(this.program, s1); + + if (l == -1) + { + logger.warn("Could not find uniform named " + s1 + " in the specified" + " shader program."); + } + else + { + this.shaderUniformLocations.add(Integer.valueOf(l)); + shaderuniform.setUniformLocation(l); + this.mappedShaderUniforms.put(s1, shaderuniform); + } + } + } + + private void parseSampler(JsonElement p_147996_1_) throws JsonException + { + JsonObject jsonobject = JsonUtils.getJsonObject(p_147996_1_, "sampler"); + String s = JsonUtils.getString(jsonobject, "name"); + + if (!JsonUtils.isString(jsonobject, "file")) + { + this.shaderSamplers.put(s, (Object)null); + this.samplerNames.add(s); + } + else + { + this.samplerNames.add(s); + } + } + + /** + * adds a shader sampler texture. if it already exists, replaces it. + */ + public void addSamplerTexture(String p_147992_1_, Object p_147992_2_) + { + if (this.shaderSamplers.containsKey(p_147992_1_)) + { + this.shaderSamplers.remove(p_147992_1_); + } + + this.shaderSamplers.put(p_147992_1_, p_147992_2_); + this.markDirty(); + } + + private void parseUniform(JsonElement p_147987_1_) throws JsonException + { + JsonObject jsonobject = JsonUtils.getJsonObject(p_147987_1_, "uniform"); + String s = JsonUtils.getString(jsonobject, "name"); + int i = ShaderUniform.parseType(JsonUtils.getString(jsonobject, "type")); + int j = JsonUtils.getInt(jsonobject, "count"); + float[] afloat = new float[Math.max(j, 16)]; + JsonArray jsonarray = JsonUtils.getJsonArray(jsonobject, "values"); + + if (jsonarray.size() != j && jsonarray.size() > 1) + { + throw new JsonException("Invalid amount of values specified (expected " + j + ", found " + jsonarray.size() + ")"); + } + else + { + int k = 0; + + for (JsonElement jsonelement : jsonarray) + { + try + { + afloat[k] = JsonUtils.getFloat(jsonelement, "value"); + } + catch (Exception exception) + { + JsonException jsonexception = JsonException.func_151379_a(exception); + jsonexception.func_151380_a("values[" + k + "]"); + throw jsonexception; + } + + ++k; + } + + if (j > 1 && jsonarray.size() == 1) + { + while (k < j) + { + afloat[k] = afloat[0]; + ++k; + } + } + + int l = j > 1 && j <= 4 && i < 8 ? j - 1 : 0; + ShaderUniform shaderuniform = new ShaderUniform(s, i + l, j, this); + + if (i <= 3) + { + shaderuniform.set((int)afloat[0], (int)afloat[1], (int)afloat[2], (int)afloat[3]); + } + else if (i <= 7) + { + shaderuniform.func_148092_b(afloat[0], afloat[1], afloat[2], afloat[3]); + } + else + { + shaderuniform.set(afloat); + } + + this.shaderUniforms.add(shaderuniform); + } + } + + public ShaderLoader getVertexShaderLoader() + { + return this.vertexShaderLoader; + } + + public ShaderLoader getFragmentShaderLoader() + { + return this.fragmentShaderLoader; + } + + public int getProgram() + { + return this.program; + } +} diff --git a/src/minecraft/net/minecraft/client/shader/ShaderUniform.java b/src/minecraft/net/minecraft/client/shader/ShaderUniform.java new file mode 100644 index 0000000..9a09436 --- /dev/null +++ b/src/minecraft/net/minecraft/client/shader/ShaderUniform.java @@ -0,0 +1,322 @@ +package net.minecraft.client.shader; + +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import net.minecraft.client.renderer.OpenGlHelper; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.BufferUtils; +import org.lwjgl.util.vector.Matrix4f; + +public class ShaderUniform +{ + private static final Logger logger = LogManager.getLogger(); + private int uniformLocation; + private final int uniformCount; + private final int uniformType; + private final IntBuffer uniformIntBuffer; + private final FloatBuffer uniformFloatBuffer; + private final String shaderName; + private boolean dirty; + private final ShaderManager shaderManager; + + public ShaderUniform(String name, int type, int count, ShaderManager manager) + { + this.shaderName = name; + this.uniformCount = count; + this.uniformType = type; + this.shaderManager = manager; + + if (type <= 3) + { + this.uniformIntBuffer = BufferUtils.createIntBuffer(count); + this.uniformFloatBuffer = null; + } + else + { + this.uniformIntBuffer = null; + this.uniformFloatBuffer = BufferUtils.createFloatBuffer(count); + } + + this.uniformLocation = -1; + this.markDirty(); + } + + private void markDirty() + { + this.dirty = true; + + if (this.shaderManager != null) + { + this.shaderManager.markDirty(); + } + } + + public static int parseType(String p_148085_0_) + { + int i = -1; + + if (p_148085_0_.equals("int")) + { + i = 0; + } + else if (p_148085_0_.equals("float")) + { + i = 4; + } + else if (p_148085_0_.startsWith("matrix")) + { + if (p_148085_0_.endsWith("2x2")) + { + i = 8; + } + else if (p_148085_0_.endsWith("3x3")) + { + i = 9; + } + else if (p_148085_0_.endsWith("4x4")) + { + i = 10; + } + } + + return i; + } + + public void setUniformLocation(int p_148084_1_) + { + this.uniformLocation = p_148084_1_; + } + + public String getShaderName() + { + return this.shaderName; + } + + public void set(float p_148090_1_) + { + this.uniformFloatBuffer.position(0); + this.uniformFloatBuffer.put(0, p_148090_1_); + this.markDirty(); + } + + public void set(float p_148087_1_, float p_148087_2_) + { + this.uniformFloatBuffer.position(0); + this.uniformFloatBuffer.put(0, p_148087_1_); + this.uniformFloatBuffer.put(1, p_148087_2_); + this.markDirty(); + } + + public void set(float p_148095_1_, float p_148095_2_, float p_148095_3_) + { + this.uniformFloatBuffer.position(0); + this.uniformFloatBuffer.put(0, p_148095_1_); + this.uniformFloatBuffer.put(1, p_148095_2_); + this.uniformFloatBuffer.put(2, p_148095_3_); + this.markDirty(); + } + + public void set(float p_148081_1_, float p_148081_2_, float p_148081_3_, float p_148081_4_) + { + this.uniformFloatBuffer.position(0); + this.uniformFloatBuffer.put(p_148081_1_); + this.uniformFloatBuffer.put(p_148081_2_); + this.uniformFloatBuffer.put(p_148081_3_); + this.uniformFloatBuffer.put(p_148081_4_); + this.uniformFloatBuffer.flip(); + this.markDirty(); + } + + public void func_148092_b(float p_148092_1_, float p_148092_2_, float p_148092_3_, float p_148092_4_) + { + this.uniformFloatBuffer.position(0); + + if (this.uniformType >= 4) + { + this.uniformFloatBuffer.put(0, p_148092_1_); + } + + if (this.uniformType >= 5) + { + this.uniformFloatBuffer.put(1, p_148092_2_); + } + + if (this.uniformType >= 6) + { + this.uniformFloatBuffer.put(2, p_148092_3_); + } + + if (this.uniformType >= 7) + { + this.uniformFloatBuffer.put(3, p_148092_4_); + } + + this.markDirty(); + } + + public void set(int p_148083_1_, int p_148083_2_, int p_148083_3_, int p_148083_4_) + { + this.uniformIntBuffer.position(0); + + if (this.uniformType >= 0) + { + this.uniformIntBuffer.put(0, p_148083_1_); + } + + if (this.uniformType >= 1) + { + this.uniformIntBuffer.put(1, p_148083_2_); + } + + if (this.uniformType >= 2) + { + this.uniformIntBuffer.put(2, p_148083_3_); + } + + if (this.uniformType >= 3) + { + this.uniformIntBuffer.put(3, p_148083_4_); + } + + this.markDirty(); + } + + public void set(float[] p_148097_1_) + { + if (p_148097_1_.length < this.uniformCount) + { + logger.warn("Uniform.set called with a too-small value array (expected " + this.uniformCount + ", got " + p_148097_1_.length + "). Ignoring."); + } + else + { + this.uniformFloatBuffer.position(0); + this.uniformFloatBuffer.put(p_148097_1_); + this.uniformFloatBuffer.position(0); + this.markDirty(); + } + } + + public void set(float p_148094_1_, float p_148094_2_, float p_148094_3_, float p_148094_4_, float p_148094_5_, float p_148094_6_, float p_148094_7_, float p_148094_8_, float p_148094_9_, float p_148094_10_, float p_148094_11_, float p_148094_12_, float p_148094_13_, float p_148094_14_, float p_148094_15_, float p_148094_16_) + { + this.uniformFloatBuffer.position(0); + this.uniformFloatBuffer.put(0, p_148094_1_); + this.uniformFloatBuffer.put(1, p_148094_2_); + this.uniformFloatBuffer.put(2, p_148094_3_); + this.uniformFloatBuffer.put(3, p_148094_4_); + this.uniformFloatBuffer.put(4, p_148094_5_); + this.uniformFloatBuffer.put(5, p_148094_6_); + this.uniformFloatBuffer.put(6, p_148094_7_); + this.uniformFloatBuffer.put(7, p_148094_8_); + this.uniformFloatBuffer.put(8, p_148094_9_); + this.uniformFloatBuffer.put(9, p_148094_10_); + this.uniformFloatBuffer.put(10, p_148094_11_); + this.uniformFloatBuffer.put(11, p_148094_12_); + this.uniformFloatBuffer.put(12, p_148094_13_); + this.uniformFloatBuffer.put(13, p_148094_14_); + this.uniformFloatBuffer.put(14, p_148094_15_); + this.uniformFloatBuffer.put(15, p_148094_16_); + this.markDirty(); + } + + public void set(Matrix4f p_148088_1_) + { + this.set(p_148088_1_.m00, p_148088_1_.m01, p_148088_1_.m02, p_148088_1_.m03, p_148088_1_.m10, p_148088_1_.m11, p_148088_1_.m12, p_148088_1_.m13, p_148088_1_.m20, p_148088_1_.m21, p_148088_1_.m22, p_148088_1_.m23, p_148088_1_.m30, p_148088_1_.m31, p_148088_1_.m32, p_148088_1_.m33); + } + + public void upload() + { + if (!this.dirty) + { + ; + } + + this.dirty = false; + + if (this.uniformType <= 3) + { + this.uploadInt(); + } + else if (this.uniformType <= 7) + { + this.uploadFloat(); + } + else + { + if (this.uniformType > 10) + { + logger.warn("Uniform.upload called, but type value (" + this.uniformType + ") is not " + "a valid type. Ignoring."); + return; + } + + this.uploadFloatMatrix(); + } + } + + private void uploadInt() + { + switch (this.uniformType) + { + case 0: + OpenGlHelper.glUniform1(this.uniformLocation, this.uniformIntBuffer); + break; + + case 1: + OpenGlHelper.glUniform2(this.uniformLocation, this.uniformIntBuffer); + break; + + case 2: + OpenGlHelper.glUniform3(this.uniformLocation, this.uniformIntBuffer); + break; + + case 3: + OpenGlHelper.glUniform4(this.uniformLocation, this.uniformIntBuffer); + break; + + default: + logger.warn("Uniform.upload called, but count value (" + this.uniformCount + ") is " + " not in the range of 1 to 4. Ignoring."); + } + } + + private void uploadFloat() + { + switch (this.uniformType) + { + case 4: + OpenGlHelper.glUniform1(this.uniformLocation, this.uniformFloatBuffer); + break; + + case 5: + OpenGlHelper.glUniform2(this.uniformLocation, this.uniformFloatBuffer); + break; + + case 6: + OpenGlHelper.glUniform3(this.uniformLocation, this.uniformFloatBuffer); + break; + + case 7: + OpenGlHelper.glUniform4(this.uniformLocation, this.uniformFloatBuffer); + break; + + default: + logger.warn("Uniform.upload called, but count value (" + this.uniformCount + ") is " + "not in the range of 1 to 4. Ignoring."); + } + } + + private void uploadFloatMatrix() + { + switch (this.uniformType) + { + case 8: + OpenGlHelper.glUniformMatrix2(this.uniformLocation, true, this.uniformFloatBuffer); + break; + + case 9: + OpenGlHelper.glUniformMatrix3(this.uniformLocation, true, this.uniformFloatBuffer); + break; + + case 10: + OpenGlHelper.glUniformMatrix4(this.uniformLocation, true, this.uniformFloatBuffer); + } + } +} diff --git a/src/minecraft/net/minecraft/client/stream/BroadcastController.java b/src/minecraft/net/minecraft/client/stream/BroadcastController.java new file mode 100644 index 0000000..a2d7851 --- /dev/null +++ b/src/minecraft/net/minecraft/client/stream/BroadcastController.java @@ -0,0 +1,1170 @@ +package net.minecraft.client.stream; + +import com.google.common.collect.Lists; +import java.util.Arrays; +import java.util.List; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.util.ReportedException; +import net.minecraft.util.ThreadSafeBoundList; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import tv.twitch.AuthToken; +import tv.twitch.Core; +import tv.twitch.ErrorCode; +import tv.twitch.MessageLevel; +import tv.twitch.StandardCoreAPI; +import tv.twitch.broadcast.ArchivingState; +import tv.twitch.broadcast.AudioDeviceType; +import tv.twitch.broadcast.AudioParams; +import tv.twitch.broadcast.ChannelInfo; +import tv.twitch.broadcast.DesktopStreamAPI; +import tv.twitch.broadcast.EncodingCpuUsage; +import tv.twitch.broadcast.FrameBuffer; +import tv.twitch.broadcast.GameInfo; +import tv.twitch.broadcast.GameInfoList; +import tv.twitch.broadcast.IStatCallbacks; +import tv.twitch.broadcast.IStreamCallbacks; +import tv.twitch.broadcast.IngestList; +import tv.twitch.broadcast.IngestServer; +import tv.twitch.broadcast.PixelFormat; +import tv.twitch.broadcast.StartFlags; +import tv.twitch.broadcast.StatType; +import tv.twitch.broadcast.Stream; +import tv.twitch.broadcast.StreamInfo; +import tv.twitch.broadcast.StreamInfoForSetting; +import tv.twitch.broadcast.UserInfo; +import tv.twitch.broadcast.VideoParams; + +public class BroadcastController +{ + private static final Logger logger = LogManager.getLogger(); + protected final int field_152865_a = 30; + protected final int field_152866_b = 3; + private static final ThreadSafeBoundList field_152862_C = new ThreadSafeBoundList(String.class, 50); + private String field_152863_D = null; + protected BroadcastController.BroadcastListener broadcastListener = null; + protected String field_152868_d = ""; + protected String field_152869_e = ""; + protected String field_152870_f = ""; + protected boolean field_152871_g = true; + protected Core field_152872_h = null; + protected Stream field_152873_i = null; + protected List field_152874_j = Lists.newArrayList(); + protected List field_152875_k = Lists.newArrayList(); + protected boolean field_152876_l = false; + protected boolean field_152877_m = false; + protected boolean field_152878_n = false; + protected BroadcastController.BroadcastState broadcastState = BroadcastController.BroadcastState.Uninitialized; + protected String field_152880_p = null; + protected VideoParams videoParamaters = null; + protected AudioParams audioParamaters = null; + protected IngestList ingestList = new IngestList(new IngestServer[0]); + protected IngestServer field_152884_t = null; + protected AuthToken authenticationToken = new AuthToken(); + protected ChannelInfo channelInfo = new ChannelInfo(); + protected UserInfo userInfo = new UserInfo(); + protected StreamInfo streamInfo = new StreamInfo(); + protected ArchivingState field_152889_y = new ArchivingState(); + protected long field_152890_z = 0L; + protected IngestServerTester field_152860_A = null; + private ErrorCode errorCode; + protected IStreamCallbacks field_177948_B = new IStreamCallbacks() + { + public void requestAuthTokenCallback(ErrorCode p_requestAuthTokenCallback_1_, AuthToken p_requestAuthTokenCallback_2_) + { + if (ErrorCode.succeeded(p_requestAuthTokenCallback_1_)) + { + BroadcastController.this.authenticationToken = p_requestAuthTokenCallback_2_; + BroadcastController.this.func_152827_a(BroadcastController.BroadcastState.Authenticated); + } + else + { + BroadcastController.this.authenticationToken.data = ""; + BroadcastController.this.func_152827_a(BroadcastController.BroadcastState.Initialized); + String s = ErrorCode.getString(p_requestAuthTokenCallback_1_); + BroadcastController.this.func_152820_d(String.format("RequestAuthTokenDoneCallback got failure: %s", new Object[] {s})); + } + + try + { + if (BroadcastController.this.broadcastListener != null) + { + BroadcastController.this.broadcastListener.func_152900_a(p_requestAuthTokenCallback_1_, p_requestAuthTokenCallback_2_); + } + } + catch (Exception exception) + { + BroadcastController.this.func_152820_d(exception.toString()); + } + } + public void loginCallback(ErrorCode p_loginCallback_1_, ChannelInfo p_loginCallback_2_) + { + if (ErrorCode.succeeded(p_loginCallback_1_)) + { + BroadcastController.this.channelInfo = p_loginCallback_2_; + BroadcastController.this.func_152827_a(BroadcastController.BroadcastState.LoggedIn); + BroadcastController.this.field_152877_m = true; + } + else + { + BroadcastController.this.func_152827_a(BroadcastController.BroadcastState.Initialized); + BroadcastController.this.field_152877_m = false; + String s = ErrorCode.getString(p_loginCallback_1_); + BroadcastController.this.func_152820_d(String.format("LoginCallback got failure: %s", new Object[] {s})); + } + + try + { + if (BroadcastController.this.broadcastListener != null) + { + BroadcastController.this.broadcastListener.func_152897_a(p_loginCallback_1_); + } + } + catch (Exception exception) + { + BroadcastController.this.func_152820_d(exception.toString()); + } + } + public void getIngestServersCallback(ErrorCode p_getIngestServersCallback_1_, IngestList p_getIngestServersCallback_2_) + { + if (ErrorCode.succeeded(p_getIngestServersCallback_1_)) + { + BroadcastController.this.ingestList = p_getIngestServersCallback_2_; + BroadcastController.this.field_152884_t = BroadcastController.this.ingestList.getDefaultServer(); + BroadcastController.this.func_152827_a(BroadcastController.BroadcastState.ReceivedIngestServers); + + try + { + if (BroadcastController.this.broadcastListener != null) + { + BroadcastController.this.broadcastListener.func_152896_a(p_getIngestServersCallback_2_); + } + } + catch (Exception exception) + { + BroadcastController.this.func_152820_d(exception.toString()); + } + } + else + { + String s = ErrorCode.getString(p_getIngestServersCallback_1_); + BroadcastController.this.func_152820_d(String.format("IngestListCallback got failure: %s", new Object[] {s})); + BroadcastController.this.func_152827_a(BroadcastController.BroadcastState.LoggingIn); + } + } + public void getUserInfoCallback(ErrorCode p_getUserInfoCallback_1_, UserInfo p_getUserInfoCallback_2_) + { + BroadcastController.this.userInfo = p_getUserInfoCallback_2_; + + if (ErrorCode.failed(p_getUserInfoCallback_1_)) + { + String s = ErrorCode.getString(p_getUserInfoCallback_1_); + BroadcastController.this.func_152820_d(String.format("UserInfoDoneCallback got failure: %s", new Object[] {s})); + } + } + public void getStreamInfoCallback(ErrorCode p_getStreamInfoCallback_1_, StreamInfo p_getStreamInfoCallback_2_) + { + if (ErrorCode.succeeded(p_getStreamInfoCallback_1_)) + { + BroadcastController.this.streamInfo = p_getStreamInfoCallback_2_; + + try + { + if (BroadcastController.this.broadcastListener != null) + { + BroadcastController.this.broadcastListener.func_152894_a(p_getStreamInfoCallback_2_); + } + } + catch (Exception exception) + { + BroadcastController.this.func_152820_d(exception.toString()); + } + } + else + { + String s = ErrorCode.getString(p_getStreamInfoCallback_1_); + BroadcastController.this.func_152832_e(String.format("StreamInfoDoneCallback got failure: %s", new Object[] {s})); + } + } + public void getArchivingStateCallback(ErrorCode p_getArchivingStateCallback_1_, ArchivingState p_getArchivingStateCallback_2_) + { + BroadcastController.this.field_152889_y = p_getArchivingStateCallback_2_; + + if (ErrorCode.failed(p_getArchivingStateCallback_1_)) + { + ; + } + } + public void runCommercialCallback(ErrorCode p_runCommercialCallback_1_) + { + if (ErrorCode.failed(p_runCommercialCallback_1_)) + { + String s = ErrorCode.getString(p_runCommercialCallback_1_); + BroadcastController.this.func_152832_e(String.format("RunCommercialCallback got failure: %s", new Object[] {s})); + } + } + public void setStreamInfoCallback(ErrorCode p_setStreamInfoCallback_1_) + { + if (ErrorCode.failed(p_setStreamInfoCallback_1_)) + { + String s = ErrorCode.getString(p_setStreamInfoCallback_1_); + BroadcastController.this.func_152832_e(String.format("SetStreamInfoCallback got failure: %s", new Object[] {s})); + } + } + public void getGameNameListCallback(ErrorCode p_getGameNameListCallback_1_, GameInfoList p_getGameNameListCallback_2_) + { + if (ErrorCode.failed(p_getGameNameListCallback_1_)) + { + String s = ErrorCode.getString(p_getGameNameListCallback_1_); + BroadcastController.this.func_152820_d(String.format("GameNameListCallback got failure: %s", new Object[] {s})); + } + + try + { + if (BroadcastController.this.broadcastListener != null) + { + BroadcastController.this.broadcastListener.func_152898_a(p_getGameNameListCallback_1_, p_getGameNameListCallback_2_ == null ? new GameInfo[0] : p_getGameNameListCallback_2_.list); + } + } + catch (Exception exception) + { + BroadcastController.this.func_152820_d(exception.toString()); + } + } + public void bufferUnlockCallback(long p_bufferUnlockCallback_1_) + { + FrameBuffer framebuffer = FrameBuffer.lookupBuffer(p_bufferUnlockCallback_1_); + BroadcastController.this.field_152875_k.add(framebuffer); + } + public void startCallback(ErrorCode p_startCallback_1_) + { + if (ErrorCode.succeeded(p_startCallback_1_)) + { + try + { + if (BroadcastController.this.broadcastListener != null) + { + BroadcastController.this.broadcastListener.func_152899_b(); + } + } + catch (Exception exception1) + { + BroadcastController.this.func_152820_d(exception1.toString()); + } + + BroadcastController.this.func_152827_a(BroadcastController.BroadcastState.Broadcasting); + } + else + { + BroadcastController.this.videoParamaters = null; + BroadcastController.this.audioParamaters = null; + BroadcastController.this.func_152827_a(BroadcastController.BroadcastState.ReadyToBroadcast); + + try + { + if (BroadcastController.this.broadcastListener != null) + { + BroadcastController.this.broadcastListener.func_152892_c(p_startCallback_1_); + } + } + catch (Exception exception) + { + BroadcastController.this.func_152820_d(exception.toString()); + } + + String s = ErrorCode.getString(p_startCallback_1_); + BroadcastController.this.func_152820_d(String.format("startCallback got failure: %s", new Object[] {s})); + } + } + public void stopCallback(ErrorCode p_stopCallback_1_) + { + if (ErrorCode.succeeded(p_stopCallback_1_)) + { + BroadcastController.this.videoParamaters = null; + BroadcastController.this.audioParamaters = null; + BroadcastController.this.func_152831_M(); + + try + { + if (BroadcastController.this.broadcastListener != null) + { + BroadcastController.this.broadcastListener.func_152901_c(); + } + } + catch (Exception exception) + { + BroadcastController.this.func_152820_d(exception.toString()); + } + + if (BroadcastController.this.field_152877_m) + { + BroadcastController.this.func_152827_a(BroadcastController.BroadcastState.ReadyToBroadcast); + } + else + { + BroadcastController.this.func_152827_a(BroadcastController.BroadcastState.Initialized); + } + } + else + { + BroadcastController.this.func_152827_a(BroadcastController.BroadcastState.ReadyToBroadcast); + String s = ErrorCode.getString(p_stopCallback_1_); + BroadcastController.this.func_152820_d(String.format("stopCallback got failure: %s", new Object[] {s})); + } + } + public void sendActionMetaDataCallback(ErrorCode p_sendActionMetaDataCallback_1_) + { + if (ErrorCode.failed(p_sendActionMetaDataCallback_1_)) + { + String s = ErrorCode.getString(p_sendActionMetaDataCallback_1_); + BroadcastController.this.func_152820_d(String.format("sendActionMetaDataCallback got failure: %s", new Object[] {s})); + } + } + public void sendStartSpanMetaDataCallback(ErrorCode p_sendStartSpanMetaDataCallback_1_) + { + if (ErrorCode.failed(p_sendStartSpanMetaDataCallback_1_)) + { + String s = ErrorCode.getString(p_sendStartSpanMetaDataCallback_1_); + BroadcastController.this.func_152820_d(String.format("sendStartSpanMetaDataCallback got failure: %s", new Object[] {s})); + } + } + public void sendEndSpanMetaDataCallback(ErrorCode p_sendEndSpanMetaDataCallback_1_) + { + if (ErrorCode.failed(p_sendEndSpanMetaDataCallback_1_)) + { + String s = ErrorCode.getString(p_sendEndSpanMetaDataCallback_1_); + BroadcastController.this.func_152820_d(String.format("sendEndSpanMetaDataCallback got failure: %s", new Object[] {s})); + } + } + }; + protected IStatCallbacks field_177949_C = new IStatCallbacks() + { + public void statCallback(StatType p_statCallback_1_, long p_statCallback_2_) + { + } + }; + + public void func_152841_a(BroadcastController.BroadcastListener p_152841_1_) + { + this.broadcastListener = p_152841_1_; + } + + public boolean func_152858_b() + { + return this.field_152876_l; + } + + public void func_152842_a(String p_152842_1_) + { + this.field_152868_d = p_152842_1_; + } + + public StreamInfo getStreamInfo() + { + return this.streamInfo; + } + + public ChannelInfo getChannelInfo() + { + return this.channelInfo; + } + + public boolean isBroadcasting() + { + return this.broadcastState == BroadcastController.BroadcastState.Broadcasting || this.broadcastState == BroadcastController.BroadcastState.Paused; + } + + public boolean isReadyToBroadcast() + { + return this.broadcastState == BroadcastController.BroadcastState.ReadyToBroadcast; + } + + public boolean isIngestTesting() + { + return this.broadcastState == BroadcastController.BroadcastState.IngestTesting; + } + + public boolean isBroadcastPaused() + { + return this.broadcastState == BroadcastController.BroadcastState.Paused; + } + + public boolean func_152849_q() + { + return this.field_152877_m; + } + + public IngestServer func_152833_s() + { + return this.field_152884_t; + } + + public void func_152824_a(IngestServer p_152824_1_) + { + this.field_152884_t = p_152824_1_; + } + + public IngestList func_152855_t() + { + return this.ingestList; + } + + public void setRecordingDeviceVolume(float p_152829_1_) + { + this.field_152873_i.setVolume(AudioDeviceType.TTV_RECORDER_DEVICE, p_152829_1_); + } + + public void setPlaybackDeviceVolume(float p_152837_1_) + { + this.field_152873_i.setVolume(AudioDeviceType.TTV_PLAYBACK_DEVICE, p_152837_1_); + } + + public IngestServerTester isReady() + { + return this.field_152860_A; + } + + public long func_152844_x() + { + return this.field_152873_i.getStreamTime(); + } + + protected boolean func_152848_y() + { + return true; + } + + public ErrorCode getErrorCode() + { + return this.errorCode; + } + + public BroadcastController() + { + this.field_152872_h = Core.getInstance(); + + if (Core.getInstance() == null) + { + this.field_152872_h = new Core(new StandardCoreAPI()); + } + + this.field_152873_i = new Stream(new DesktopStreamAPI()); + } + + protected PixelFormat func_152826_z() + { + return PixelFormat.TTV_PF_RGBA; + } + + public boolean func_152817_A() + { + if (this.field_152876_l) + { + return false; + } + else + { + this.field_152873_i.setStreamCallbacks(this.field_177948_B); + ErrorCode errorcode = this.field_152872_h.initialize(this.field_152868_d, System.getProperty("java.library.path")); + + if (!this.func_152853_a(errorcode)) + { + this.field_152873_i.setStreamCallbacks((IStreamCallbacks)null); + this.errorCode = errorcode; + return false; + } + else + { + errorcode = this.field_152872_h.setTraceLevel(MessageLevel.TTV_ML_ERROR); + + if (!this.func_152853_a(errorcode)) + { + this.field_152873_i.setStreamCallbacks((IStreamCallbacks)null); + this.field_152872_h.shutdown(); + this.errorCode = errorcode; + return false; + } + else if (ErrorCode.succeeded(errorcode)) + { + this.field_152876_l = true; + this.func_152827_a(BroadcastController.BroadcastState.Initialized); + return true; + } + else + { + this.errorCode = errorcode; + this.field_152872_h.shutdown(); + return false; + } + } + } + } + + public boolean func_152851_B() + { + if (!this.field_152876_l) + { + return true; + } + else if (this.isIngestTesting()) + { + return false; + } + else + { + this.field_152878_n = true; + this.func_152845_C(); + this.field_152873_i.setStreamCallbacks((IStreamCallbacks)null); + this.field_152873_i.setStatCallbacks((IStatCallbacks)null); + ErrorCode errorcode = this.field_152872_h.shutdown(); + this.func_152853_a(errorcode); + this.field_152876_l = false; + this.field_152878_n = false; + this.func_152827_a(BroadcastController.BroadcastState.Uninitialized); + return true; + } + } + + public void statCallback() + { + if (this.broadcastState != BroadcastController.BroadcastState.Uninitialized) + { + if (this.field_152860_A != null) + { + this.field_152860_A.func_153039_l(); + } + + for (; this.field_152860_A != null; this.func_152821_H()) + { + try + { + Thread.sleep(200L); + } + catch (Exception exception) + { + this.func_152820_d(exception.toString()); + } + } + + this.func_152851_B(); + } + } + + public boolean func_152818_a(String p_152818_1_, AuthToken p_152818_2_) + { + if (this.isIngestTesting()) + { + return false; + } + else + { + this.func_152845_C(); + + if (p_152818_1_ != null && !p_152818_1_.isEmpty()) + { + if (p_152818_2_ != null && p_152818_2_.data != null && !p_152818_2_.data.isEmpty()) + { + this.field_152880_p = p_152818_1_; + this.authenticationToken = p_152818_2_; + + if (this.func_152858_b()) + { + this.func_152827_a(BroadcastController.BroadcastState.Authenticated); + } + + return true; + } + else + { + this.func_152820_d("Auth token must be valid"); + return false; + } + } + else + { + this.func_152820_d("Username must be valid"); + return false; + } + } + } + + public boolean func_152845_C() + { + if (this.isIngestTesting()) + { + return false; + } + else + { + if (this.isBroadcasting()) + { + this.field_152873_i.stop(false); + } + + this.field_152880_p = ""; + this.authenticationToken = new AuthToken(); + + if (!this.field_152877_m) + { + return false; + } + else + { + this.field_152877_m = false; + + if (!this.field_152878_n) + { + try + { + if (this.broadcastListener != null) + { + this.broadcastListener.func_152895_a(); + } + } + catch (Exception exception) + { + this.func_152820_d(exception.toString()); + } + } + + this.func_152827_a(BroadcastController.BroadcastState.Initialized); + return true; + } + } + } + + public boolean func_152828_a(String p_152828_1_, String p_152828_2_, String p_152828_3_) + { + if (!this.field_152877_m) + { + return false; + } + else + { + if (p_152828_1_ == null || p_152828_1_.equals("")) + { + p_152828_1_ = this.field_152880_p; + } + + if (p_152828_2_ == null) + { + p_152828_2_ = ""; + } + + if (p_152828_3_ == null) + { + p_152828_3_ = ""; + } + + StreamInfoForSetting streaminfoforsetting = new StreamInfoForSetting(); + streaminfoforsetting.streamTitle = p_152828_3_; + streaminfoforsetting.gameName = p_152828_2_; + ErrorCode errorcode = this.field_152873_i.setStreamInfo(this.authenticationToken, p_152828_1_, streaminfoforsetting); + this.func_152853_a(errorcode); + return ErrorCode.succeeded(errorcode); + } + } + + public boolean requestCommercial() + { + if (!this.isBroadcasting()) + { + return false; + } + else + { + ErrorCode errorcode = this.field_152873_i.runCommercial(this.authenticationToken); + this.func_152853_a(errorcode); + return ErrorCode.succeeded(errorcode); + } + } + + public VideoParams func_152834_a(int maxKbps, int p_152834_2_, float p_152834_3_, float p_152834_4_) + { + int[] aint = this.field_152873_i.getMaxResolution(maxKbps, p_152834_2_, p_152834_3_, p_152834_4_); + VideoParams videoparams = new VideoParams(); + videoparams.maxKbps = maxKbps; + videoparams.encodingCpuUsage = EncodingCpuUsage.TTV_ECU_HIGH; + videoparams.pixelFormat = this.func_152826_z(); + videoparams.targetFps = p_152834_2_; + videoparams.outputWidth = aint[0]; + videoparams.outputHeight = aint[1]; + videoparams.disableAdaptiveBitrate = false; + videoparams.verticalFlip = false; + return videoparams; + } + + public boolean func_152836_a(VideoParams p_152836_1_) + { + if (p_152836_1_ != null && this.isReadyToBroadcast()) + { + this.videoParamaters = p_152836_1_.clone(); + this.audioParamaters = new AudioParams(); + this.audioParamaters.audioEnabled = this.field_152871_g && this.func_152848_y(); + this.audioParamaters.enableMicCapture = this.audioParamaters.audioEnabled; + this.audioParamaters.enablePlaybackCapture = this.audioParamaters.audioEnabled; + this.audioParamaters.enablePassthroughAudio = false; + + if (!this.func_152823_L()) + { + this.videoParamaters = null; + this.audioParamaters = null; + return false; + } + else + { + ErrorCode errorcode = this.field_152873_i.start(p_152836_1_, this.audioParamaters, this.field_152884_t, StartFlags.None, true); + + if (ErrorCode.failed(errorcode)) + { + this.func_152831_M(); + String s = ErrorCode.getString(errorcode); + this.func_152820_d(String.format("Error while starting to broadcast: %s", new Object[] {s})); + this.videoParamaters = null; + this.audioParamaters = null; + return false; + } + else + { + this.func_152827_a(BroadcastController.BroadcastState.Starting); + return true; + } + } + } + else + { + return false; + } + } + + public boolean stopBroadcasting() + { + if (!this.isBroadcasting()) + { + return false; + } + else + { + ErrorCode errorcode = this.field_152873_i.stop(true); + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + this.func_152820_d(String.format("Error while stopping the broadcast: %s", new Object[] {s})); + return false; + } + else + { + this.func_152827_a(BroadcastController.BroadcastState.Stopping); + return ErrorCode.succeeded(errorcode); + } + } + } + + public boolean func_152847_F() + { + if (!this.isBroadcasting()) + { + return false; + } + else + { + ErrorCode errorcode = this.field_152873_i.pauseVideo(); + + if (ErrorCode.failed(errorcode)) + { + this.stopBroadcasting(); + String s = ErrorCode.getString(errorcode); + this.func_152820_d(String.format("Error pausing stream: %s\n", new Object[] {s})); + } + else + { + this.func_152827_a(BroadcastController.BroadcastState.Paused); + } + + return ErrorCode.succeeded(errorcode); + } + } + + public boolean func_152854_G() + { + if (!this.isBroadcastPaused()) + { + return false; + } + else + { + this.func_152827_a(BroadcastController.BroadcastState.Broadcasting); + return true; + } + } + + public boolean func_152840_a(String p_152840_1_, long p_152840_2_, String p_152840_4_, String p_152840_5_) + { + ErrorCode errorcode = this.field_152873_i.sendActionMetaData(this.authenticationToken, p_152840_1_, p_152840_2_, p_152840_4_, p_152840_5_); + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + this.func_152820_d(String.format("Error while sending meta data: %s\n", new Object[] {s})); + return false; + } + else + { + return true; + } + } + + public long func_177946_b(String p_177946_1_, long p_177946_2_, String p_177946_4_, String p_177946_5_) + { + long i = this.field_152873_i.sendStartSpanMetaData(this.authenticationToken, p_177946_1_, p_177946_2_, p_177946_4_, p_177946_5_); + + if (i == -1L) + { + this.func_152820_d(String.format("Error in SendStartSpanMetaData\n", new Object[0])); + } + + return i; + } + + public boolean func_177947_a(String p_177947_1_, long p_177947_2_, long p_177947_4_, String p_177947_6_, String p_177947_7_) + { + if (p_177947_4_ == -1L) + { + this.func_152820_d(String.format("Invalid sequence id: %d\n", new Object[] {Long.valueOf(p_177947_4_)})); + return false; + } + else + { + ErrorCode errorcode = this.field_152873_i.sendEndSpanMetaData(this.authenticationToken, p_177947_1_, p_177947_2_, p_177947_4_, p_177947_6_, p_177947_7_); + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + this.func_152820_d(String.format("Error in SendStopSpanMetaData: %s\n", new Object[] {s})); + return false; + } + else + { + return true; + } + } + } + + protected void func_152827_a(BroadcastController.BroadcastState p_152827_1_) + { + if (p_152827_1_ != this.broadcastState) + { + this.broadcastState = p_152827_1_; + + try + { + if (this.broadcastListener != null) + { + this.broadcastListener.func_152891_a(p_152827_1_); + } + } + catch (Exception exception) + { + this.func_152820_d(exception.toString()); + } + } + } + + public void func_152821_H() + { + if (this.field_152873_i != null && this.field_152876_l) + { + ErrorCode errorcode = this.field_152873_i.pollTasks(); + this.func_152853_a(errorcode); + + if (this.isIngestTesting()) + { + this.field_152860_A.func_153041_j(); + + if (this.field_152860_A.func_153032_e()) + { + this.field_152860_A = null; + this.func_152827_a(BroadcastController.BroadcastState.ReadyToBroadcast); + } + } + + switch (this.broadcastState) + { + case Authenticated: + this.func_152827_a(BroadcastController.BroadcastState.LoggingIn); + errorcode = this.field_152873_i.login(this.authenticationToken); + + if (ErrorCode.failed(errorcode)) + { + String s3 = ErrorCode.getString(errorcode); + this.func_152820_d(String.format("Error in TTV_Login: %s\n", new Object[] {s3})); + } + + break; + + case LoggedIn: + this.func_152827_a(BroadcastController.BroadcastState.FindingIngestServer); + errorcode = this.field_152873_i.getIngestServers(this.authenticationToken); + + if (ErrorCode.failed(errorcode)) + { + this.func_152827_a(BroadcastController.BroadcastState.LoggedIn); + String s2 = ErrorCode.getString(errorcode); + this.func_152820_d(String.format("Error in TTV_GetIngestServers: %s\n", new Object[] {s2})); + } + + break; + + case ReceivedIngestServers: + this.func_152827_a(BroadcastController.BroadcastState.ReadyToBroadcast); + errorcode = this.field_152873_i.getUserInfo(this.authenticationToken); + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + this.func_152820_d(String.format("Error in TTV_GetUserInfo: %s\n", new Object[] {s})); + } + + this.func_152835_I(); + errorcode = this.field_152873_i.getArchivingState(this.authenticationToken); + + if (ErrorCode.failed(errorcode)) + { + String s1 = ErrorCode.getString(errorcode); + this.func_152820_d(String.format("Error in TTV_GetArchivingState: %s\n", new Object[] {s1})); + } + + case Starting: + case Stopping: + case FindingIngestServer: + case Authenticating: + case Initialized: + case Uninitialized: + case IngestTesting: + default: + break; + + case Paused: + case Broadcasting: + this.func_152835_I(); + } + } + } + + protected void func_152835_I() + { + long i = System.nanoTime(); + long j = (i - this.field_152890_z) / 1000000000L; + + if (j >= 30L) + { + this.field_152890_z = i; + ErrorCode errorcode = this.field_152873_i.getStreamInfo(this.authenticationToken, this.field_152880_p); + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + this.func_152820_d(String.format("Error in TTV_GetStreamInfo: %s", new Object[] {s})); + } + } + } + + public IngestServerTester func_152838_J() + { + if (this.isReadyToBroadcast() && this.ingestList != null) + { + if (this.isIngestTesting()) + { + return null; + } + else + { + this.field_152860_A = new IngestServerTester(this.field_152873_i, this.ingestList); + this.field_152860_A.func_176004_j(); + this.func_152827_a(BroadcastController.BroadcastState.IngestTesting); + return this.field_152860_A; + } + } + else + { + return null; + } + } + + protected boolean func_152823_L() + { + for (int i = 0; i < 3; ++i) + { + FrameBuffer framebuffer = this.field_152873_i.allocateFrameBuffer(this.videoParamaters.outputWidth * this.videoParamaters.outputHeight * 4); + + if (!framebuffer.getIsValid()) + { + this.func_152820_d(String.format("Error while allocating frame buffer", new Object[0])); + return false; + } + + this.field_152874_j.add(framebuffer); + this.field_152875_k.add(framebuffer); + } + + return true; + } + + protected void func_152831_M() + { + for (int i = 0; i < this.field_152874_j.size(); ++i) + { + FrameBuffer framebuffer = (FrameBuffer)this.field_152874_j.get(i); + framebuffer.free(); + } + + this.field_152875_k.clear(); + this.field_152874_j.clear(); + } + + public FrameBuffer func_152822_N() + { + if (this.field_152875_k.size() == 0) + { + this.func_152820_d(String.format("Out of free buffers, this should never happen", new Object[0])); + return null; + } + else + { + FrameBuffer framebuffer = (FrameBuffer)this.field_152875_k.get(this.field_152875_k.size() - 1); + this.field_152875_k.remove(this.field_152875_k.size() - 1); + return framebuffer; + } + } + + /** + * caputres the current framebuffer + */ + public void captureFramebuffer(FrameBuffer p_152846_1_) + { + try + { + this.field_152873_i.captureFrameBuffer_ReadPixels(p_152846_1_); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Trying to submit a frame to Twitch"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Broadcast State"); + crashreportcategory.addCrashSection("Last reported errors", Arrays.toString(field_152862_C.func_152756_c())); + crashreportcategory.addCrashSection("Buffer", p_152846_1_); + crashreportcategory.addCrashSection("Free buffer count", Integer.valueOf(this.field_152875_k.size())); + crashreportcategory.addCrashSection("Capture buffer count", Integer.valueOf(this.field_152874_j.size())); + throw new ReportedException(crashreport); + } + } + + /** + * passes the framebuffer on to the video stream + */ + public ErrorCode submitStreamFrame(FrameBuffer p_152859_1_) + { + if (this.isBroadcastPaused()) + { + this.func_152854_G(); + } + else if (!this.isBroadcasting()) + { + return ErrorCode.TTV_EC_STREAM_NOT_STARTED; + } + + ErrorCode errorcode = this.field_152873_i.submitVideoFrame(p_152859_1_); + + if (errorcode != ErrorCode.TTV_EC_SUCCESS) + { + String s = ErrorCode.getString(errorcode); + + if (ErrorCode.succeeded(errorcode)) + { + this.func_152832_e(String.format("Warning in SubmitTexturePointer: %s\n", new Object[] {s})); + } + else + { + this.func_152820_d(String.format("Error in SubmitTexturePointer: %s\n", new Object[] {s})); + this.stopBroadcasting(); + } + + if (this.broadcastListener != null) + { + this.broadcastListener.func_152893_b(errorcode); + } + } + + return errorcode; + } + + protected boolean func_152853_a(ErrorCode p_152853_1_) + { + if (ErrorCode.failed(p_152853_1_)) + { + this.func_152820_d(ErrorCode.getString(p_152853_1_)); + return false; + } + else + { + return true; + } + } + + protected void func_152820_d(String p_152820_1_) + { + this.field_152863_D = p_152820_1_; + field_152862_C.func_152757_a(" " + p_152820_1_); + logger.error(TwitchStream.STREAM_MARKER, "[Broadcast controller] {}", new Object[] {p_152820_1_}); + } + + protected void func_152832_e(String p_152832_1_) + { + field_152862_C.func_152757_a(" " + p_152832_1_); + logger.warn(TwitchStream.STREAM_MARKER, "[Broadcast controller] {}", new Object[] {p_152832_1_}); + } + + public interface BroadcastListener + { + void func_152900_a(ErrorCode p_152900_1_, AuthToken p_152900_2_); + + void func_152897_a(ErrorCode p_152897_1_); + + void func_152898_a(ErrorCode p_152898_1_, GameInfo[] p_152898_2_); + + void func_152891_a(BroadcastController.BroadcastState p_152891_1_); + + void func_152895_a(); + + void func_152894_a(StreamInfo p_152894_1_); + + void func_152896_a(IngestList p_152896_1_); + + void func_152893_b(ErrorCode p_152893_1_); + + void func_152899_b(); + + void func_152901_c(); + + void func_152892_c(ErrorCode p_152892_1_); + } + + public static enum BroadcastState + { + Uninitialized, + Initialized, + Authenticating, + Authenticated, + LoggingIn, + LoggedIn, + FindingIngestServer, + ReceivedIngestServers, + ReadyToBroadcast, + Starting, + Broadcasting, + Stopping, + Paused, + IngestTesting; + } +} diff --git a/src/minecraft/net/minecraft/client/stream/ChatController.java b/src/minecraft/net/minecraft/client/stream/ChatController.java new file mode 100644 index 0000000..10b03b3 --- /dev/null +++ b/src/minecraft/net/minecraft/client/stream/ChatController.java @@ -0,0 +1,921 @@ +package net.minecraft.client.stream; + +import com.google.common.collect.Lists; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.ListIterator; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import tv.twitch.AuthToken; +import tv.twitch.Core; +import tv.twitch.ErrorCode; +import tv.twitch.StandardCoreAPI; +import tv.twitch.chat.Chat; +import tv.twitch.chat.ChatBadgeData; +import tv.twitch.chat.ChatChannelInfo; +import tv.twitch.chat.ChatEmoticonData; +import tv.twitch.chat.ChatEvent; +import tv.twitch.chat.ChatRawMessage; +import tv.twitch.chat.ChatTokenizationOption; +import tv.twitch.chat.ChatTokenizedMessage; +import tv.twitch.chat.ChatUserInfo; +import tv.twitch.chat.IChatAPIListener; +import tv.twitch.chat.IChatChannelListener; +import tv.twitch.chat.StandardChatAPI; + +public class ChatController +{ + private static final Logger LOGGER = LogManager.getLogger(); + protected ChatController.ChatListener field_153003_a = null; + protected String field_153004_b = ""; + protected String field_153006_d = ""; + protected String field_153007_e = ""; + protected Core field_175992_e = null; + protected Chat field_153008_f = null; + protected ChatController.ChatState field_153011_i = ChatController.ChatState.Uninitialized; + protected AuthToken field_153012_j = new AuthToken(); + protected HashMap field_175998_i = new HashMap(); + protected int field_153015_m = 128; + protected ChatController.EnumEmoticonMode field_175997_k = ChatController.EnumEmoticonMode.None; + protected ChatController.EnumEmoticonMode field_175995_l = ChatController.EnumEmoticonMode.None; + protected ChatEmoticonData field_175996_m = null; + protected int field_175993_n = 500; + protected int field_175994_o = 2000; + protected IChatAPIListener field_175999_p = new IChatAPIListener() + { + public void chatInitializationCallback(ErrorCode p_chatInitializationCallback_1_) + { + if (ErrorCode.succeeded(p_chatInitializationCallback_1_)) + { + ChatController.this.field_153008_f.setMessageFlushInterval(ChatController.this.field_175993_n); + ChatController.this.field_153008_f.setUserChangeEventInterval(ChatController.this.field_175994_o); + ChatController.this.func_153001_r(); + ChatController.this.func_175985_a(ChatController.ChatState.Initialized); + } + else + { + ChatController.this.func_175985_a(ChatController.ChatState.Uninitialized); + } + + try + { + if (ChatController.this.field_153003_a != null) + { + ChatController.this.field_153003_a.func_176023_d(p_chatInitializationCallback_1_); + } + } + catch (Exception exception) + { + ChatController.this.func_152995_h(exception.toString()); + } + } + public void chatShutdownCallback(ErrorCode p_chatShutdownCallback_1_) + { + if (ErrorCode.succeeded(p_chatShutdownCallback_1_)) + { + ErrorCode errorcode = ChatController.this.field_175992_e.shutdown(); + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + ChatController.this.func_152995_h(String.format("Error shutting down the Twitch sdk: %s", new Object[] {s})); + } + + ChatController.this.func_175985_a(ChatController.ChatState.Uninitialized); + } + else + { + ChatController.this.func_175985_a(ChatController.ChatState.Initialized); + ChatController.this.func_152995_h(String.format("Error shutting down Twith chat: %s", new Object[] {p_chatShutdownCallback_1_})); + } + + try + { + if (ChatController.this.field_153003_a != null) + { + ChatController.this.field_153003_a.func_176022_e(p_chatShutdownCallback_1_); + } + } + catch (Exception exception) + { + ChatController.this.func_152995_h(exception.toString()); + } + } + public void chatEmoticonDataDownloadCallback(ErrorCode p_chatEmoticonDataDownloadCallback_1_) + { + if (ErrorCode.succeeded(p_chatEmoticonDataDownloadCallback_1_)) + { + ChatController.this.func_152988_s(); + } + } + }; + + public void func_152990_a(ChatController.ChatListener p_152990_1_) + { + this.field_153003_a = p_152990_1_; + } + + public void func_152994_a(AuthToken p_152994_1_) + { + this.field_153012_j = p_152994_1_; + } + + public void func_152984_a(String p_152984_1_) + { + this.field_153006_d = p_152984_1_; + } + + public void func_152998_c(String p_152998_1_) + { + this.field_153004_b = p_152998_1_; + } + + public ChatController.ChatState func_153000_j() + { + return this.field_153011_i; + } + + public boolean func_175990_d(String p_175990_1_) + { + if (!this.field_175998_i.containsKey(p_175990_1_)) + { + return false; + } + else + { + ChatController.ChatChannelListener chatcontroller$chatchannellistener = (ChatController.ChatChannelListener)this.field_175998_i.get(p_175990_1_); + return chatcontroller$chatchannellistener.func_176040_a() == ChatController.EnumChannelState.Connected; + } + } + + public ChatController.EnumChannelState func_175989_e(String p_175989_1_) + { + if (!this.field_175998_i.containsKey(p_175989_1_)) + { + return ChatController.EnumChannelState.Disconnected; + } + else + { + ChatController.ChatChannelListener chatcontroller$chatchannellistener = (ChatController.ChatChannelListener)this.field_175998_i.get(p_175989_1_); + return chatcontroller$chatchannellistener.func_176040_a(); + } + } + + public ChatController() + { + this.field_175992_e = Core.getInstance(); + + if (this.field_175992_e == null) + { + this.field_175992_e = new Core(new StandardCoreAPI()); + } + + this.field_153008_f = new Chat(new StandardChatAPI()); + } + + public boolean func_175984_n() + { + if (this.field_153011_i != ChatController.ChatState.Uninitialized) + { + return false; + } + else + { + this.func_175985_a(ChatController.ChatState.Initializing); + ErrorCode errorcode = this.field_175992_e.initialize(this.field_153006_d, (String)null); + + if (ErrorCode.failed(errorcode)) + { + this.func_175985_a(ChatController.ChatState.Uninitialized); + String s1 = ErrorCode.getString(errorcode); + this.func_152995_h(String.format("Error initializing Twitch sdk: %s", new Object[] {s1})); + return false; + } + else + { + this.field_175995_l = this.field_175997_k; + HashSet hashset = new HashSet(); + + switch (this.field_175997_k) + { + case None: + hashset.add(ChatTokenizationOption.TTV_CHAT_TOKENIZATION_OPTION_NONE); + break; + + case Url: + hashset.add(ChatTokenizationOption.TTV_CHAT_TOKENIZATION_OPTION_EMOTICON_URLS); + break; + + case TextureAtlas: + hashset.add(ChatTokenizationOption.TTV_CHAT_TOKENIZATION_OPTION_EMOTICON_TEXTURES); + } + + errorcode = this.field_153008_f.initialize(hashset, this.field_175999_p); + + if (ErrorCode.failed(errorcode)) + { + this.field_175992_e.shutdown(); + this.func_175985_a(ChatController.ChatState.Uninitialized); + String s = ErrorCode.getString(errorcode); + this.func_152995_h(String.format("Error initializing Twitch chat: %s", new Object[] {s})); + return false; + } + else + { + this.func_175985_a(ChatController.ChatState.Initialized); + return true; + } + } + } + } + + public boolean func_152986_d(String p_152986_1_) + { + return this.func_175987_a(p_152986_1_, false); + } + + protected boolean func_175987_a(String p_175987_1_, boolean p_175987_2_) + { + if (this.field_153011_i != ChatController.ChatState.Initialized) + { + return false; + } + else if (this.field_175998_i.containsKey(p_175987_1_)) + { + this.func_152995_h("Already in channel: " + p_175987_1_); + return false; + } + else if (p_175987_1_ != null && !p_175987_1_.equals("")) + { + ChatController.ChatChannelListener chatcontroller$chatchannellistener = new ChatController.ChatChannelListener(p_175987_1_); + this.field_175998_i.put(p_175987_1_, chatcontroller$chatchannellistener); + boolean flag = chatcontroller$chatchannellistener.func_176038_a(p_175987_2_); + + if (!flag) + { + this.field_175998_i.remove(p_175987_1_); + } + + return flag; + } + else + { + return false; + } + } + + public boolean func_175991_l(String p_175991_1_) + { + if (this.field_153011_i != ChatController.ChatState.Initialized) + { + return false; + } + else if (!this.field_175998_i.containsKey(p_175991_1_)) + { + this.func_152995_h("Not in channel: " + p_175991_1_); + return false; + } + else + { + ChatController.ChatChannelListener chatcontroller$chatchannellistener = (ChatController.ChatChannelListener)this.field_175998_i.get(p_175991_1_); + return chatcontroller$chatchannellistener.func_176034_g(); + } + } + + public boolean func_152993_m() + { + if (this.field_153011_i != ChatController.ChatState.Initialized) + { + return false; + } + else + { + ErrorCode errorcode = this.field_153008_f.shutdown(); + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + this.func_152995_h(String.format("Error shutting down chat: %s", new Object[] {s})); + return false; + } + else + { + this.func_152996_t(); + this.func_175985_a(ChatController.ChatState.ShuttingDown); + return true; + } + } + } + + public void func_175988_p() + { + if (this.func_153000_j() != ChatController.ChatState.Uninitialized) + { + this.func_152993_m(); + + if (this.func_153000_j() == ChatController.ChatState.ShuttingDown) + { + while (this.func_153000_j() != ChatController.ChatState.Uninitialized) + { + try + { + Thread.sleep(200L); + this.func_152997_n(); + } + catch (InterruptedException var2) + { + ; + } + } + } + } + } + + public void func_152997_n() + { + if (this.field_153011_i != ChatController.ChatState.Uninitialized) + { + ErrorCode errorcode = this.field_153008_f.flushEvents(); + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + this.func_152995_h(String.format("Error flushing chat events: %s", new Object[] {s})); + } + } + } + + public boolean func_175986_a(String p_175986_1_, String p_175986_2_) + { + if (this.field_153011_i != ChatController.ChatState.Initialized) + { + return false; + } + else if (!this.field_175998_i.containsKey(p_175986_1_)) + { + this.func_152995_h("Not in channel: " + p_175986_1_); + return false; + } + else + { + ChatController.ChatChannelListener chatcontroller$chatchannellistener = (ChatController.ChatChannelListener)this.field_175998_i.get(p_175986_1_); + return chatcontroller$chatchannellistener.func_176037_b(p_175986_2_); + } + } + + protected void func_175985_a(ChatController.ChatState p_175985_1_) + { + if (p_175985_1_ != this.field_153011_i) + { + this.field_153011_i = p_175985_1_; + + try + { + if (this.field_153003_a != null) + { + this.field_153003_a.func_176017_a(p_175985_1_); + } + } + catch (Exception exception) + { + this.func_152995_h(exception.toString()); + } + } + } + + protected void func_153001_r() + { + if (this.field_175995_l != ChatController.EnumEmoticonMode.None) + { + if (this.field_175996_m == null) + { + ErrorCode errorcode = this.field_153008_f.downloadEmoticonData(); + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + this.func_152995_h(String.format("Error trying to download emoticon data: %s", new Object[] {s})); + } + } + } + } + + protected void func_152988_s() + { + if (this.field_175996_m == null) + { + this.field_175996_m = new ChatEmoticonData(); + ErrorCode errorcode = this.field_153008_f.getEmoticonData(this.field_175996_m); + + if (ErrorCode.succeeded(errorcode)) + { + try + { + if (this.field_153003_a != null) + { + this.field_153003_a.func_176021_d(); + } + } + catch (Exception exception) + { + this.func_152995_h(exception.toString()); + } + } + else + { + this.func_152995_h("Error preparing emoticon data: " + ErrorCode.getString(errorcode)); + } + } + } + + protected void func_152996_t() + { + if (this.field_175996_m != null) + { + ErrorCode errorcode = this.field_153008_f.clearEmoticonData(); + + if (ErrorCode.succeeded(errorcode)) + { + this.field_175996_m = null; + + try + { + if (this.field_153003_a != null) + { + this.field_153003_a.func_176024_e(); + } + } + catch (Exception exception) + { + this.func_152995_h(exception.toString()); + } + } + else + { + this.func_152995_h("Error clearing emoticon data: " + ErrorCode.getString(errorcode)); + } + } + } + + protected void func_152995_h(String p_152995_1_) + { + LOGGER.error(TwitchStream.STREAM_MARKER, "[Chat controller] {}", new Object[] {p_152995_1_}); + } + + public class ChatChannelListener implements IChatChannelListener + { + protected String field_176048_a = null; + protected boolean field_176046_b = false; + protected ChatController.EnumChannelState field_176047_c = ChatController.EnumChannelState.Created; + protected List field_176044_d = Lists.newArrayList(); + protected LinkedList field_176045_e = new LinkedList(); + protected LinkedList field_176042_f = new LinkedList(); + protected ChatBadgeData field_176043_g = null; + + public ChatChannelListener(String p_i46061_2_) + { + this.field_176048_a = p_i46061_2_; + } + + public ChatController.EnumChannelState func_176040_a() + { + return this.field_176047_c; + } + + public boolean func_176038_a(boolean p_176038_1_) + { + this.field_176046_b = p_176038_1_; + ErrorCode errorcode = ErrorCode.TTV_EC_SUCCESS; + + if (p_176038_1_) + { + errorcode = ChatController.this.field_153008_f.connectAnonymous(this.field_176048_a, this); + } + else + { + errorcode = ChatController.this.field_153008_f.connect(this.field_176048_a, ChatController.this.field_153004_b, ChatController.this.field_153012_j.data, this); + } + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + ChatController.this.func_152995_h(String.format("Error connecting: %s", new Object[] {s})); + this.func_176036_d(this.field_176048_a); + return false; + } + else + { + this.func_176035_a(ChatController.EnumChannelState.Connecting); + this.func_176041_h(); + return true; + } + } + + public boolean func_176034_g() + { + switch (this.field_176047_c) + { + case Connected: + case Connecting: + ErrorCode errorcode = ChatController.this.field_153008_f.disconnect(this.field_176048_a); + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + ChatController.this.func_152995_h(String.format("Error disconnecting: %s", new Object[] {s})); + return false; + } + + this.func_176035_a(ChatController.EnumChannelState.Disconnecting); + return true; + + case Created: + case Disconnected: + case Disconnecting: + default: + return false; + } + } + + protected void func_176035_a(ChatController.EnumChannelState p_176035_1_) + { + if (p_176035_1_ != this.field_176047_c) + { + this.field_176047_c = p_176035_1_; + } + } + + public void func_176032_a(String p_176032_1_) + { + if (ChatController.this.field_175995_l == ChatController.EnumEmoticonMode.None) + { + this.field_176045_e.clear(); + this.field_176042_f.clear(); + } + else + { + if (this.field_176045_e.size() > 0) + { + ListIterator listiterator = this.field_176045_e.listIterator(); + + while (listiterator.hasNext()) + { + ChatRawMessage chatrawmessage = (ChatRawMessage)listiterator.next(); + + if (chatrawmessage.userName.equals(p_176032_1_)) + { + listiterator.remove(); + } + } + } + + if (this.field_176042_f.size() > 0) + { + ListIterator listiterator1 = this.field_176042_f.listIterator(); + + while (listiterator1.hasNext()) + { + ChatTokenizedMessage chattokenizedmessage = (ChatTokenizedMessage)listiterator1.next(); + + if (chattokenizedmessage.displayName.equals(p_176032_1_)) + { + listiterator1.remove(); + } + } + } + } + + try + { + if (ChatController.this.field_153003_a != null) + { + ChatController.this.field_153003_a.func_176019_a(this.field_176048_a, p_176032_1_); + } + } + catch (Exception exception) + { + ChatController.this.func_152995_h(exception.toString()); + } + } + + public boolean func_176037_b(String p_176037_1_) + { + if (this.field_176047_c != ChatController.EnumChannelState.Connected) + { + return false; + } + else + { + ErrorCode errorcode = ChatController.this.field_153008_f.sendMessage(this.field_176048_a, p_176037_1_); + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + ChatController.this.func_152995_h(String.format("Error sending chat message: %s", new Object[] {s})); + return false; + } + else + { + return true; + } + } + } + + protected void func_176041_h() + { + if (ChatController.this.field_175995_l != ChatController.EnumEmoticonMode.None) + { + if (this.field_176043_g == null) + { + ErrorCode errorcode = ChatController.this.field_153008_f.downloadBadgeData(this.field_176048_a); + + if (ErrorCode.failed(errorcode)) + { + String s = ErrorCode.getString(errorcode); + ChatController.this.func_152995_h(String.format("Error trying to download badge data: %s", new Object[] {s})); + } + } + } + } + + protected void func_176039_i() + { + if (this.field_176043_g == null) + { + this.field_176043_g = new ChatBadgeData(); + ErrorCode errorcode = ChatController.this.field_153008_f.getBadgeData(this.field_176048_a, this.field_176043_g); + + if (ErrorCode.succeeded(errorcode)) + { + try + { + if (ChatController.this.field_153003_a != null) + { + ChatController.this.field_153003_a.func_176016_c(this.field_176048_a); + } + } + catch (Exception exception) + { + ChatController.this.func_152995_h(exception.toString()); + } + } + else + { + ChatController.this.func_152995_h("Error preparing badge data: " + ErrorCode.getString(errorcode)); + } + } + } + + protected void func_176033_j() + { + if (this.field_176043_g != null) + { + ErrorCode errorcode = ChatController.this.field_153008_f.clearBadgeData(this.field_176048_a); + + if (ErrorCode.succeeded(errorcode)) + { + this.field_176043_g = null; + + try + { + if (ChatController.this.field_153003_a != null) + { + ChatController.this.field_153003_a.func_176020_d(this.field_176048_a); + } + } + catch (Exception exception) + { + ChatController.this.func_152995_h(exception.toString()); + } + } + else + { + ChatController.this.func_152995_h("Error releasing badge data: " + ErrorCode.getString(errorcode)); + } + } + } + + protected void func_176031_c(String p_176031_1_) + { + try + { + if (ChatController.this.field_153003_a != null) + { + ChatController.this.field_153003_a.func_180606_a(p_176031_1_); + } + } + catch (Exception exception) + { + ChatController.this.func_152995_h(exception.toString()); + } + } + + protected void func_176036_d(String p_176036_1_) + { + try + { + if (ChatController.this.field_153003_a != null) + { + ChatController.this.field_153003_a.func_180607_b(p_176036_1_); + } + } + catch (Exception exception) + { + ChatController.this.func_152995_h(exception.toString()); + } + } + + private void func_176030_k() + { + if (this.field_176047_c != ChatController.EnumChannelState.Disconnected) + { + this.func_176035_a(ChatController.EnumChannelState.Disconnected); + this.func_176036_d(this.field_176048_a); + this.func_176033_j(); + } + } + + public void chatStatusCallback(String p_chatStatusCallback_1_, ErrorCode p_chatStatusCallback_2_) + { + if (!ErrorCode.succeeded(p_chatStatusCallback_2_)) + { + ChatController.this.field_175998_i.remove(p_chatStatusCallback_1_); + this.func_176030_k(); + } + } + + public void chatChannelMembershipCallback(String p_chatChannelMembershipCallback_1_, ChatEvent p_chatChannelMembershipCallback_2_, ChatChannelInfo p_chatChannelMembershipCallback_3_) + { + switch (p_chatChannelMembershipCallback_2_) + { + case TTV_CHAT_JOINED_CHANNEL: + this.func_176035_a(ChatController.EnumChannelState.Connected); + this.func_176031_c(p_chatChannelMembershipCallback_1_); + break; + + case TTV_CHAT_LEFT_CHANNEL: + this.func_176030_k(); + } + } + + public void chatChannelUserChangeCallback(String p_chatChannelUserChangeCallback_1_, ChatUserInfo[] p_chatChannelUserChangeCallback_2_, ChatUserInfo[] p_chatChannelUserChangeCallback_3_, ChatUserInfo[] p_chatChannelUserChangeCallback_4_) + { + for (int i = 0; i < p_chatChannelUserChangeCallback_3_.length; ++i) + { + int j = this.field_176044_d.indexOf(p_chatChannelUserChangeCallback_3_[i]); + + if (j >= 0) + { + this.field_176044_d.remove(j); + } + } + + for (int k = 0; k < p_chatChannelUserChangeCallback_4_.length; ++k) + { + int i1 = this.field_176044_d.indexOf(p_chatChannelUserChangeCallback_4_[k]); + + if (i1 >= 0) + { + this.field_176044_d.remove(i1); + } + + this.field_176044_d.add(p_chatChannelUserChangeCallback_4_[k]); + } + + for (int l = 0; l < p_chatChannelUserChangeCallback_2_.length; ++l) + { + this.field_176044_d.add(p_chatChannelUserChangeCallback_2_[l]); + } + + try + { + if (ChatController.this.field_153003_a != null) + { + ChatController.this.field_153003_a.func_176018_a(this.field_176048_a, p_chatChannelUserChangeCallback_2_, p_chatChannelUserChangeCallback_3_, p_chatChannelUserChangeCallback_4_); + } + } + catch (Exception exception) + { + ChatController.this.func_152995_h(exception.toString()); + } + } + + public void chatChannelRawMessageCallback(String p_chatChannelRawMessageCallback_1_, ChatRawMessage[] p_chatChannelRawMessageCallback_2_) + { + for (int i = 0; i < p_chatChannelRawMessageCallback_2_.length; ++i) + { + this.field_176045_e.addLast(p_chatChannelRawMessageCallback_2_[i]); + } + + try + { + if (ChatController.this.field_153003_a != null) + { + ChatController.this.field_153003_a.func_180605_a(this.field_176048_a, p_chatChannelRawMessageCallback_2_); + } + } + catch (Exception exception) + { + ChatController.this.func_152995_h(exception.toString()); + } + + while (this.field_176045_e.size() > ChatController.this.field_153015_m) + { + this.field_176045_e.removeFirst(); + } + } + + public void chatChannelTokenizedMessageCallback(String p_chatChannelTokenizedMessageCallback_1_, ChatTokenizedMessage[] p_chatChannelTokenizedMessageCallback_2_) + { + for (int i = 0; i < p_chatChannelTokenizedMessageCallback_2_.length; ++i) + { + this.field_176042_f.addLast(p_chatChannelTokenizedMessageCallback_2_[i]); + } + + try + { + if (ChatController.this.field_153003_a != null) + { + ChatController.this.field_153003_a.func_176025_a(this.field_176048_a, p_chatChannelTokenizedMessageCallback_2_); + } + } + catch (Exception exception) + { + ChatController.this.func_152995_h(exception.toString()); + } + + while (this.field_176042_f.size() > ChatController.this.field_153015_m) + { + this.field_176042_f.removeFirst(); + } + } + + public void chatClearCallback(String p_chatClearCallback_1_, String p_chatClearCallback_2_) + { + this.func_176032_a(p_chatClearCallback_2_); + } + + public void chatBadgeDataDownloadCallback(String p_chatBadgeDataDownloadCallback_1_, ErrorCode p_chatBadgeDataDownloadCallback_2_) + { + if (ErrorCode.succeeded(p_chatBadgeDataDownloadCallback_2_)) + { + this.func_176039_i(); + } + } + } + + public interface ChatListener + { + void func_176023_d(ErrorCode p_176023_1_); + + void func_176022_e(ErrorCode p_176022_1_); + + void func_176021_d(); + + void func_176024_e(); + + void func_176017_a(ChatController.ChatState p_176017_1_); + + void func_176025_a(String p_176025_1_, ChatTokenizedMessage[] p_176025_2_); + + void func_180605_a(String p_180605_1_, ChatRawMessage[] p_180605_2_); + + void func_176018_a(String p_176018_1_, ChatUserInfo[] p_176018_2_, ChatUserInfo[] p_176018_3_, ChatUserInfo[] p_176018_4_); + + void func_180606_a(String p_180606_1_); + + void func_180607_b(String p_180607_1_); + + void func_176019_a(String p_176019_1_, String p_176019_2_); + + void func_176016_c(String p_176016_1_); + + void func_176020_d(String p_176020_1_); + } + + public static enum ChatState + { + Uninitialized, + Initializing, + Initialized, + ShuttingDown; + } + + public static enum EnumChannelState + { + Created, + Connecting, + Connected, + Disconnecting, + Disconnected; + } + + public static enum EnumEmoticonMode + { + None, + Url, + TextureAtlas; + } +} diff --git a/src/minecraft/net/minecraft/client/stream/IStream.java b/src/minecraft/net/minecraft/client/stream/IStream.java new file mode 100644 index 0000000..ccf7acc --- /dev/null +++ b/src/minecraft/net/minecraft/client/stream/IStream.java @@ -0,0 +1,86 @@ +package net.minecraft.client.stream; + +import tv.twitch.ErrorCode; +import tv.twitch.broadcast.IngestServer; +import tv.twitch.chat.ChatUserInfo; + +public interface IStream +{ + /** + * Shuts down a steam + */ + void shutdownStream(); + + void func_152935_j(); + + void func_152922_k(); + + boolean func_152936_l(); + + boolean isReadyToBroadcast(); + + boolean isBroadcasting(); + + void func_152911_a(Metadata p_152911_1_, long p_152911_2_); + + void func_176026_a(Metadata p_176026_1_, long p_176026_2_, long p_176026_4_); + + boolean isPaused(); + + void requestCommercial(); + + /** + * pauses a stream + */ + void pause(); + + /** + * unpauses a stream + */ + void unpause(); + + void updateStreamVolume(); + + void func_152930_t(); + + void stopBroadcasting(); + + IngestServer[] func_152925_v(); + + void func_152909_x(); + + IngestServerTester func_152932_y(); + + boolean func_152908_z(); + + int func_152920_A(); + + boolean func_152927_B(); + + String func_152921_C(); + + ChatUserInfo func_152926_a(String p_152926_1_); + + void func_152917_b(String p_152917_1_); + + boolean func_152928_D(); + + ErrorCode func_152912_E(); + + boolean func_152913_F(); + + /** + * mutes or unmutes the microphone based on the boolean parameter passed into the method + */ + void muteMicrophone(boolean p_152910_1_); + + boolean func_152929_G(); + + IStream.AuthFailureReason func_152918_H(); + + public static enum AuthFailureReason + { + ERROR, + INVALID_TOKEN; + } +} diff --git a/src/minecraft/net/minecraft/client/stream/IngestServerTester.java b/src/minecraft/net/minecraft/client/stream/IngestServerTester.java new file mode 100644 index 0000000..4120c4a --- /dev/null +++ b/src/minecraft/net/minecraft/client/stream/IngestServerTester.java @@ -0,0 +1,502 @@ +package net.minecraft.client.stream; + +import com.google.common.collect.Lists; +import java.util.List; +import tv.twitch.AuthToken; +import tv.twitch.ErrorCode; +import tv.twitch.broadcast.ArchivingState; +import tv.twitch.broadcast.AudioParams; +import tv.twitch.broadcast.ChannelInfo; +import tv.twitch.broadcast.EncodingCpuUsage; +import tv.twitch.broadcast.FrameBuffer; +import tv.twitch.broadcast.GameInfoList; +import tv.twitch.broadcast.IStatCallbacks; +import tv.twitch.broadcast.IStreamCallbacks; +import tv.twitch.broadcast.IngestList; +import tv.twitch.broadcast.IngestServer; +import tv.twitch.broadcast.PixelFormat; +import tv.twitch.broadcast.RTMPState; +import tv.twitch.broadcast.StartFlags; +import tv.twitch.broadcast.StatType; +import tv.twitch.broadcast.Stream; +import tv.twitch.broadcast.StreamInfo; +import tv.twitch.broadcast.UserInfo; +import tv.twitch.broadcast.VideoParams; + +public class IngestServerTester +{ + protected IngestServerTester.IngestTestListener field_153044_b = null; + protected Stream field_153045_c = null; + protected IngestList field_153046_d = null; + protected IngestServerTester.IngestTestState field_153047_e = IngestServerTester.IngestTestState.Uninitalized; + protected long field_153048_f = 8000L; + protected long field_153049_g = 2000L; + protected long field_153050_h = 0L; + protected RTMPState field_153051_i = RTMPState.Invalid; + protected VideoParams field_153052_j = null; + protected AudioParams audioParameters = null; + protected long field_153054_l = 0L; + protected List field_153055_m = null; + protected boolean field_153056_n = false; + protected IStreamCallbacks field_153057_o = null; + protected IStatCallbacks field_153058_p = null; + protected IngestServer field_153059_q = null; + protected boolean field_153060_r = false; + protected boolean field_153061_s = false; + protected int field_153062_t = -1; + protected int field_153063_u = 0; + protected long field_153064_v = 0L; + protected float field_153065_w = 0.0F; + protected float field_153066_x = 0.0F; + protected boolean field_176009_x = false; + protected boolean field_176008_y = false; + protected boolean field_176007_z = false; + protected IStreamCallbacks field_176005_A = new IStreamCallbacks() + { + public void requestAuthTokenCallback(ErrorCode p_requestAuthTokenCallback_1_, AuthToken p_requestAuthTokenCallback_2_) + { + } + public void loginCallback(ErrorCode p_loginCallback_1_, ChannelInfo p_loginCallback_2_) + { + } + public void getIngestServersCallback(ErrorCode p_getIngestServersCallback_1_, IngestList p_getIngestServersCallback_2_) + { + } + public void getUserInfoCallback(ErrorCode p_getUserInfoCallback_1_, UserInfo p_getUserInfoCallback_2_) + { + } + public void getStreamInfoCallback(ErrorCode p_getStreamInfoCallback_1_, StreamInfo p_getStreamInfoCallback_2_) + { + } + public void getArchivingStateCallback(ErrorCode p_getArchivingStateCallback_1_, ArchivingState p_getArchivingStateCallback_2_) + { + } + public void runCommercialCallback(ErrorCode p_runCommercialCallback_1_) + { + } + public void setStreamInfoCallback(ErrorCode p_setStreamInfoCallback_1_) + { + } + public void getGameNameListCallback(ErrorCode p_getGameNameListCallback_1_, GameInfoList p_getGameNameListCallback_2_) + { + } + public void bufferUnlockCallback(long p_bufferUnlockCallback_1_) + { + } + public void startCallback(ErrorCode p_startCallback_1_) + { + IngestServerTester.this.field_176008_y = false; + + if (ErrorCode.succeeded(p_startCallback_1_)) + { + IngestServerTester.this.field_176009_x = true; + IngestServerTester.this.field_153054_l = System.currentTimeMillis(); + IngestServerTester.this.func_153034_a(IngestServerTester.IngestTestState.ConnectingToServer); + } + else + { + IngestServerTester.this.field_153056_n = false; + IngestServerTester.this.func_153034_a(IngestServerTester.IngestTestState.DoneTestingServer); + } + } + public void stopCallback(ErrorCode p_stopCallback_1_) + { + if (ErrorCode.failed(p_stopCallback_1_)) + { + System.out.println("IngestTester.stopCallback failed to stop - " + IngestServerTester.this.field_153059_q.serverName + ": " + p_stopCallback_1_.toString()); + } + + IngestServerTester.this.field_176007_z = false; + IngestServerTester.this.field_176009_x = false; + IngestServerTester.this.func_153034_a(IngestServerTester.IngestTestState.DoneTestingServer); + IngestServerTester.this.field_153059_q = null; + + if (IngestServerTester.this.field_153060_r) + { + IngestServerTester.this.func_153034_a(IngestServerTester.IngestTestState.Cancelling); + } + } + public void sendActionMetaDataCallback(ErrorCode p_sendActionMetaDataCallback_1_) + { + } + public void sendStartSpanMetaDataCallback(ErrorCode p_sendStartSpanMetaDataCallback_1_) + { + } + public void sendEndSpanMetaDataCallback(ErrorCode p_sendEndSpanMetaDataCallback_1_) + { + } + }; + protected IStatCallbacks field_176006_B = new IStatCallbacks() + { + public void statCallback(StatType p_statCallback_1_, long p_statCallback_2_) + { + switch (p_statCallback_1_) + { + case TTV_ST_RTMPSTATE: + IngestServerTester.this.field_153051_i = RTMPState.lookupValue((int)p_statCallback_2_); + break; + + case TTV_ST_RTMPDATASENT: + IngestServerTester.this.field_153050_h = p_statCallback_2_; + } + } + }; + + public void func_153042_a(IngestServerTester.IngestTestListener p_153042_1_) + { + this.field_153044_b = p_153042_1_; + } + + public IngestServer func_153040_c() + { + return this.field_153059_q; + } + + public int func_153028_p() + { + return this.field_153062_t; + } + + public boolean func_153032_e() + { + return this.field_153047_e == IngestServerTester.IngestTestState.Finished || this.field_153047_e == IngestServerTester.IngestTestState.Cancelled || this.field_153047_e == IngestServerTester.IngestTestState.Failed; + } + + public float func_153030_h() + { + return this.field_153066_x; + } + + public IngestServerTester(Stream p_i1019_1_, IngestList p_i1019_2_) + { + this.field_153045_c = p_i1019_1_; + this.field_153046_d = p_i1019_2_; + } + + public void func_176004_j() + { + if (this.field_153047_e == IngestServerTester.IngestTestState.Uninitalized) + { + this.field_153062_t = 0; + this.field_153060_r = false; + this.field_153061_s = false; + this.field_176009_x = false; + this.field_176008_y = false; + this.field_176007_z = false; + this.field_153058_p = this.field_153045_c.getStatCallbacks(); + this.field_153045_c.setStatCallbacks(this.field_176006_B); + this.field_153057_o = this.field_153045_c.getStreamCallbacks(); + this.field_153045_c.setStreamCallbacks(this.field_176005_A); + this.field_153052_j = new VideoParams(); + this.field_153052_j.targetFps = 60; + this.field_153052_j.maxKbps = 3500; + this.field_153052_j.outputWidth = 1280; + this.field_153052_j.outputHeight = 720; + this.field_153052_j.pixelFormat = PixelFormat.TTV_PF_BGRA; + this.field_153052_j.encodingCpuUsage = EncodingCpuUsage.TTV_ECU_HIGH; + this.field_153052_j.disableAdaptiveBitrate = true; + this.field_153052_j.verticalFlip = false; + this.field_153045_c.getDefaultParams(this.field_153052_j); + this.audioParameters = new AudioParams(); + this.audioParameters.audioEnabled = false; + this.audioParameters.enableMicCapture = false; + this.audioParameters.enablePlaybackCapture = false; + this.audioParameters.enablePassthroughAudio = false; + this.field_153055_m = Lists.newArrayList(); + int i = 3; + + for (int j = 0; j < i; ++j) + { + FrameBuffer framebuffer = this.field_153045_c.allocateFrameBuffer(this.field_153052_j.outputWidth * this.field_153052_j.outputHeight * 4); + + if (!framebuffer.getIsValid()) + { + this.func_153031_o(); + this.func_153034_a(IngestServerTester.IngestTestState.Failed); + return; + } + + this.field_153055_m.add(framebuffer); + this.field_153045_c.randomizeFrameBuffer(framebuffer); + } + + this.func_153034_a(IngestServerTester.IngestTestState.Starting); + this.field_153054_l = System.currentTimeMillis(); + } + } + + @SuppressWarnings("incomplete-switch") + public void func_153041_j() + { + if (!this.func_153032_e() && this.field_153047_e != IngestServerTester.IngestTestState.Uninitalized) + { + if (!this.field_176008_y && !this.field_176007_z) + { + switch (this.field_153047_e) + { + case Starting: + case DoneTestingServer: + if (this.field_153059_q != null) + { + if (this.field_153061_s || !this.field_153056_n) + { + this.field_153059_q.bitrateKbps = 0.0F; + } + + this.func_153035_b(this.field_153059_q); + } + else + { + this.field_153054_l = 0L; + this.field_153061_s = false; + this.field_153056_n = true; + + if (this.field_153047_e != IngestServerTester.IngestTestState.Starting) + { + ++this.field_153062_t; + } + + if (this.field_153062_t < this.field_153046_d.getServers().length) + { + this.field_153059_q = this.field_153046_d.getServers()[this.field_153062_t]; + this.func_153036_a(this.field_153059_q); + } + else + { + this.func_153034_a(IngestServerTester.IngestTestState.Finished); + } + } + + break; + + case ConnectingToServer: + case TestingServer: + this.func_153029_c(this.field_153059_q); + break; + + case Cancelling: + this.func_153034_a(IngestServerTester.IngestTestState.Cancelled); + } + + this.func_153038_n(); + + if (this.field_153047_e == IngestServerTester.IngestTestState.Cancelled || this.field_153047_e == IngestServerTester.IngestTestState.Finished) + { + this.func_153031_o(); + } + } + } + } + + public void func_153039_l() + { + if (!this.func_153032_e() && !this.field_153060_r) + { + this.field_153060_r = true; + + if (this.field_153059_q != null) + { + this.field_153059_q.bitrateKbps = 0.0F; + } + } + } + + protected boolean func_153036_a(IngestServer p_153036_1_) + { + this.field_153056_n = true; + this.field_153050_h = 0L; + this.field_153051_i = RTMPState.Idle; + this.field_153059_q = p_153036_1_; + this.field_176008_y = true; + this.func_153034_a(IngestServerTester.IngestTestState.ConnectingToServer); + ErrorCode errorcode = this.field_153045_c.start(this.field_153052_j, this.audioParameters, p_153036_1_, StartFlags.TTV_Start_BandwidthTest, true); + + if (ErrorCode.failed(errorcode)) + { + this.field_176008_y = false; + this.field_153056_n = false; + this.func_153034_a(IngestServerTester.IngestTestState.DoneTestingServer); + return false; + } + else + { + this.field_153064_v = this.field_153050_h; + p_153036_1_.bitrateKbps = 0.0F; + this.field_153063_u = 0; + return true; + } + } + + protected void func_153035_b(IngestServer p_153035_1_) + { + if (this.field_176008_y) + { + this.field_153061_s = true; + } + else if (this.field_176009_x) + { + this.field_176007_z = true; + ErrorCode errorcode = this.field_153045_c.stop(true); + + if (ErrorCode.failed(errorcode)) + { + this.field_176005_A.stopCallback(ErrorCode.TTV_EC_SUCCESS); + System.out.println("Stop failed: " + errorcode.toString()); + } + + this.field_153045_c.pollStats(); + } + else + { + this.field_176005_A.stopCallback(ErrorCode.TTV_EC_SUCCESS); + } + } + + protected long func_153037_m() + { + return System.currentTimeMillis() - this.field_153054_l; + } + + protected void func_153038_n() + { + float f = (float)this.func_153037_m(); + + switch (this.field_153047_e) + { + case Starting: + case ConnectingToServer: + case Uninitalized: + case Finished: + case Cancelled: + case Failed: + this.field_153066_x = 0.0F; + break; + + case DoneTestingServer: + this.field_153066_x = 1.0F; + break; + + case TestingServer: + case Cancelling: + default: + this.field_153066_x = f / (float)this.field_153048_f; + } + + switch (this.field_153047_e) + { + case Finished: + case Cancelled: + case Failed: + this.field_153065_w = 1.0F; + break; + + default: + this.field_153065_w = (float)this.field_153062_t / (float)this.field_153046_d.getServers().length; + this.field_153065_w += this.field_153066_x / (float)this.field_153046_d.getServers().length; + } + } + + protected boolean func_153029_c(IngestServer p_153029_1_) + { + if (!this.field_153061_s && !this.field_153060_r && this.func_153037_m() < this.field_153048_f) + { + if (!this.field_176008_y && !this.field_176007_z) + { + ErrorCode errorcode = this.field_153045_c.submitVideoFrame((FrameBuffer)this.field_153055_m.get(this.field_153063_u)); + + if (ErrorCode.failed(errorcode)) + { + this.field_153056_n = false; + this.func_153034_a(IngestServerTester.IngestTestState.DoneTestingServer); + return false; + } + else + { + this.field_153063_u = (this.field_153063_u + 1) % this.field_153055_m.size(); + this.field_153045_c.pollStats(); + + if (this.field_153051_i == RTMPState.SendVideo) + { + this.func_153034_a(IngestServerTester.IngestTestState.TestingServer); + long i = this.func_153037_m(); + + if (i > 0L && this.field_153050_h > this.field_153064_v) + { + p_153029_1_.bitrateKbps = (float)(this.field_153050_h * 8L) / (float)this.func_153037_m(); + this.field_153064_v = this.field_153050_h; + } + } + + return true; + } + } + else + { + return true; + } + } + else + { + this.func_153034_a(IngestServerTester.IngestTestState.DoneTestingServer); + return true; + } + } + + protected void func_153031_o() + { + this.field_153059_q = null; + + if (this.field_153055_m != null) + { + for (int i = 0; i < this.field_153055_m.size(); ++i) + { + ((FrameBuffer)this.field_153055_m.get(i)).free(); + } + + this.field_153055_m = null; + } + + if (this.field_153045_c.getStatCallbacks() == this.field_176006_B) + { + this.field_153045_c.setStatCallbacks(this.field_153058_p); + this.field_153058_p = null; + } + + if (this.field_153045_c.getStreamCallbacks() == this.field_176005_A) + { + this.field_153045_c.setStreamCallbacks(this.field_153057_o); + this.field_153057_o = null; + } + } + + protected void func_153034_a(IngestServerTester.IngestTestState p_153034_1_) + { + if (p_153034_1_ != this.field_153047_e) + { + this.field_153047_e = p_153034_1_; + + if (this.field_153044_b != null) + { + this.field_153044_b.func_152907_a(this, p_153034_1_); + } + } + } + + public interface IngestTestListener + { + void func_152907_a(IngestServerTester p_152907_1_, IngestServerTester.IngestTestState p_152907_2_); + } + + public static enum IngestTestState + { + Uninitalized, + Starting, + ConnectingToServer, + TestingServer, + DoneTestingServer, + Finished, + Cancelling, + Cancelled, + Failed; + } +} diff --git a/src/minecraft/net/minecraft/client/stream/Metadata.java b/src/minecraft/net/minecraft/client/stream/Metadata.java new file mode 100644 index 0000000..a0b9052 --- /dev/null +++ b/src/minecraft/net/minecraft/client/stream/Metadata.java @@ -0,0 +1,83 @@ +package net.minecraft.client.stream; + +import com.google.common.base.Objects; +import com.google.common.collect.Maps; +import com.google.gson.Gson; +import java.util.Map; + +public class Metadata +{ + private static final Gson field_152811_a = new Gson(); + private final String name; + private String description; + private Map payload; + + public Metadata(String p_i46345_1_, String p_i46345_2_) + { + this.name = p_i46345_1_; + this.description = p_i46345_2_; + } + + public Metadata(String p_i1030_1_) + { + this(p_i1030_1_, (String)null); + } + + public void func_152807_a(String p_152807_1_) + { + this.description = p_152807_1_; + } + + public String func_152809_a() + { + return this.description == null ? this.name : this.description; + } + + public void func_152808_a(String p_152808_1_, String p_152808_2_) + { + if (this.payload == null) + { + this.payload = Maps.newHashMap(); + } + + if (this.payload.size() > 50) + { + throw new IllegalArgumentException("Metadata payload is full, cannot add more to it!"); + } + else if (p_152808_1_ == null) + { + throw new IllegalArgumentException("Metadata payload key cannot be null!"); + } + else if (p_152808_1_.length() > 255) + { + throw new IllegalArgumentException("Metadata payload key is too long!"); + } + else if (p_152808_2_ == null) + { + throw new IllegalArgumentException("Metadata payload value cannot be null!"); + } + else if (p_152808_2_.length() > 255) + { + throw new IllegalArgumentException("Metadata payload value is too long!"); + } + else + { + this.payload.put(p_152808_1_, p_152808_2_); + } + } + + public String func_152806_b() + { + return this.payload != null && !this.payload.isEmpty() ? field_152811_a.toJson((Object)this.payload) : null; + } + + public String func_152810_c() + { + return this.name; + } + + public String toString() + { + return Objects.toStringHelper(this).add("name", this.name).add("description", this.description).add("data", this.func_152806_b()).toString(); + } +} diff --git a/src/minecraft/net/minecraft/client/stream/MetadataAchievement.java b/src/minecraft/net/minecraft/client/stream/MetadataAchievement.java new file mode 100644 index 0000000..dafc39d --- /dev/null +++ b/src/minecraft/net/minecraft/client/stream/MetadataAchievement.java @@ -0,0 +1,15 @@ +package net.minecraft.client.stream; + +import net.minecraft.stats.Achievement; + +public class MetadataAchievement extends Metadata +{ + public MetadataAchievement(Achievement p_i1032_1_) + { + super("achievement"); + this.func_152808_a("achievement_id", p_i1032_1_.statId); + this.func_152808_a("achievement_name", p_i1032_1_.getStatName().getUnformattedText()); + this.func_152808_a("achievement_description", p_i1032_1_.getDescription()); + this.func_152807_a("Achievement \'" + p_i1032_1_.getStatName().getUnformattedText() + "\' obtained!"); + } +} diff --git a/src/minecraft/net/minecraft/client/stream/MetadataCombat.java b/src/minecraft/net/minecraft/client/stream/MetadataCombat.java new file mode 100644 index 0000000..c423e99 --- /dev/null +++ b/src/minecraft/net/minecraft/client/stream/MetadataCombat.java @@ -0,0 +1,26 @@ +package net.minecraft.client.stream; + +import net.minecraft.entity.EntityLivingBase; + +public class MetadataCombat extends Metadata +{ + public MetadataCombat(EntityLivingBase p_i46067_1_, EntityLivingBase p_i46067_2_) + { + super("player_combat"); + this.func_152808_a("player", p_i46067_1_.getName()); + + if (p_i46067_2_ != null) + { + this.func_152808_a("primary_opponent", p_i46067_2_.getName()); + } + + if (p_i46067_2_ != null) + { + this.func_152807_a("Combat between " + p_i46067_1_.getName() + " and " + p_i46067_2_.getName()); + } + else + { + this.func_152807_a("Combat between " + p_i46067_1_.getName() + " and others"); + } + } +} diff --git a/src/minecraft/net/minecraft/client/stream/MetadataPlayerDeath.java b/src/minecraft/net/minecraft/client/stream/MetadataPlayerDeath.java new file mode 100644 index 0000000..ba9daf0 --- /dev/null +++ b/src/minecraft/net/minecraft/client/stream/MetadataPlayerDeath.java @@ -0,0 +1,21 @@ +package net.minecraft.client.stream; + +import net.minecraft.entity.EntityLivingBase; + +public class MetadataPlayerDeath extends Metadata +{ + public MetadataPlayerDeath(EntityLivingBase p_i46066_1_, EntityLivingBase p_i46066_2_) + { + super("player_death"); + + if (p_i46066_1_ != null) + { + this.func_152808_a("player", p_i46066_1_.getName()); + } + + if (p_i46066_2_ != null) + { + this.func_152808_a("killer", p_i46066_2_.getName()); + } + } +} diff --git a/src/minecraft/net/minecraft/client/stream/NullStream.java b/src/minecraft/net/minecraft/client/stream/NullStream.java new file mode 100644 index 0000000..24c66fe --- /dev/null +++ b/src/minecraft/net/minecraft/client/stream/NullStream.java @@ -0,0 +1,168 @@ +package net.minecraft.client.stream; + +import tv.twitch.ErrorCode; +import tv.twitch.broadcast.IngestServer; +import tv.twitch.chat.ChatUserInfo; + +public class NullStream implements IStream +{ + private final Throwable field_152938_a; + + public NullStream(Throwable p_i1006_1_) + { + this.field_152938_a = p_i1006_1_; + } + + /** + * Shuts down a steam + */ + public void shutdownStream() + { + } + + public void func_152935_j() + { + } + + public void func_152922_k() + { + } + + public boolean func_152936_l() + { + return false; + } + + public boolean isReadyToBroadcast() + { + return false; + } + + public boolean isBroadcasting() + { + return false; + } + + public void func_152911_a(Metadata p_152911_1_, long p_152911_2_) + { + } + + public void func_176026_a(Metadata p_176026_1_, long p_176026_2_, long p_176026_4_) + { + } + + public boolean isPaused() + { + return false; + } + + public void requestCommercial() + { + } + + /** + * pauses a stream + */ + public void pause() + { + } + + /** + * unpauses a stream + */ + public void unpause() + { + } + + public void updateStreamVolume() + { + } + + public void func_152930_t() + { + } + + public void stopBroadcasting() + { + } + + public IngestServer[] func_152925_v() + { + return new IngestServer[0]; + } + + public void func_152909_x() + { + } + + public IngestServerTester func_152932_y() + { + return null; + } + + public boolean func_152908_z() + { + return false; + } + + public int func_152920_A() + { + return 0; + } + + public boolean func_152927_B() + { + return false; + } + + public String func_152921_C() + { + return null; + } + + public ChatUserInfo func_152926_a(String p_152926_1_) + { + return null; + } + + public void func_152917_b(String p_152917_1_) + { + } + + public boolean func_152928_D() + { + return false; + } + + public ErrorCode func_152912_E() + { + return null; + } + + public boolean func_152913_F() + { + return false; + } + + /** + * mutes or unmutes the microphone based on the boolean parameter passed into the method + */ + public void muteMicrophone(boolean p_152910_1_) + { + } + + public boolean func_152929_G() + { + return false; + } + + public IStream.AuthFailureReason func_152918_H() + { + return IStream.AuthFailureReason.ERROR; + } + + public Throwable func_152937_a() + { + return this.field_152938_a; + } +} diff --git a/src/minecraft/net/minecraft/client/stream/TwitchStream.java b/src/minecraft/net/minecraft/client/stream/TwitchStream.java new file mode 100644 index 0000000..d7c862c --- /dev/null +++ b/src/minecraft/net/minecraft/client/stream/TwitchStream.java @@ -0,0 +1,771 @@ +package net.minecraft.client.stream; + +import com.google.common.base.Strings; +import com.google.common.collect.Maps; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.mojang.authlib.properties.Property; +import java.io.IOException; +import java.net.URL; +import java.net.URLEncoder; +import java.util.Map; +import java.util.Set; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.stream.GuiTwitchUserMode; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.event.ClickEvent; +import net.minecraft.event.HoverEvent; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.HttpUtil; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.JsonUtils; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Util; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.MarkerManager; +import org.lwjgl.opengl.GL11; +import tv.twitch.AuthToken; +import tv.twitch.ErrorCode; +import tv.twitch.broadcast.EncodingCpuUsage; +import tv.twitch.broadcast.FrameBuffer; +import tv.twitch.broadcast.GameInfo; +import tv.twitch.broadcast.IngestList; +import tv.twitch.broadcast.IngestServer; +import tv.twitch.broadcast.StreamInfo; +import tv.twitch.broadcast.VideoParams; +import tv.twitch.chat.ChatRawMessage; +import tv.twitch.chat.ChatTokenizedMessage; +import tv.twitch.chat.ChatUserInfo; +import tv.twitch.chat.ChatUserMode; +import tv.twitch.chat.ChatUserSubscription; + +public class TwitchStream implements BroadcastController.BroadcastListener, ChatController.ChatListener, IngestServerTester.IngestTestListener, IStream +{ + private static final Logger LOGGER = LogManager.getLogger(); + public static final Marker STREAM_MARKER = MarkerManager.getMarker("STREAM"); + private final BroadcastController broadcastController; + private final ChatController chatController; + private String field_176029_e; + + /** the minecraft instance */ + private final Minecraft mc; + private final IChatComponent twitchComponent = new ChatComponentText("Twitch"); + private final Map field_152955_g = Maps.newHashMap(); + private Framebuffer framebuffer; + private boolean field_152957_i; + + /** stream's target fps */ + private int targetFPS = 30; + private long field_152959_k = 0L; + private boolean field_152960_l = false; + private boolean loggedIn; + private boolean field_152962_n; + private boolean field_152963_o; + private IStream.AuthFailureReason authFailureReason = IStream.AuthFailureReason.ERROR; + private static boolean field_152965_q; + + public TwitchStream(Minecraft mcIn, final Property streamProperty) + { + this.mc = mcIn; + this.broadcastController = new BroadcastController(); + this.chatController = new ChatController(); + this.broadcastController.func_152841_a(this); + this.chatController.func_152990_a(this); + this.broadcastController.func_152842_a("nmt37qblda36pvonovdkbopzfzw3wlq"); + this.chatController.func_152984_a("nmt37qblda36pvonovdkbopzfzw3wlq"); + this.twitchComponent.getChatStyle().setColor(EnumChatFormatting.DARK_PURPLE); + + if (streamProperty != null && !Strings.isNullOrEmpty(streamProperty.getValue()) && OpenGlHelper.framebufferSupported) + { + Thread thread = new Thread("Twitch authenticator") + { + public void run() + { + try + { + URL url = new URL("https://api.twitch.tv/kraken?oauth_token=" + URLEncoder.encode(streamProperty.getValue(), "UTF-8")); + String s = HttpUtil.get(url); + JsonObject jsonobject = JsonUtils.getJsonObject((new JsonParser()).parse(s), "Response"); + JsonObject jsonobject1 = JsonUtils.getJsonObject(jsonobject, "token"); + + if (JsonUtils.getBoolean(jsonobject1, "valid")) + { + String s1 = JsonUtils.getString(jsonobject1, "user_name"); + TwitchStream.LOGGER.debug(TwitchStream.STREAM_MARKER, "Authenticated with twitch; username is {}", new Object[] {s1}); + AuthToken authtoken = new AuthToken(); + authtoken.data = streamProperty.getValue(); + TwitchStream.this.broadcastController.func_152818_a(s1, authtoken); + TwitchStream.this.chatController.func_152998_c(s1); + TwitchStream.this.chatController.func_152994_a(authtoken); + Runtime.getRuntime().addShutdownHook(new Thread("Twitch shutdown hook") + { + public void run() + { + TwitchStream.this.shutdownStream(); + } + }); + TwitchStream.this.broadcastController.func_152817_A(); + TwitchStream.this.chatController.func_175984_n(); + } + else + { + TwitchStream.this.authFailureReason = IStream.AuthFailureReason.INVALID_TOKEN; + TwitchStream.LOGGER.error(TwitchStream.STREAM_MARKER, "Given twitch access token is invalid"); + } + } + catch (IOException ioexception) + { + TwitchStream.this.authFailureReason = IStream.AuthFailureReason.ERROR; + TwitchStream.LOGGER.error(TwitchStream.STREAM_MARKER, (String)"Could not authenticate with twitch", (Throwable)ioexception); + } + } + }; + thread.setDaemon(true); + thread.start(); + } + } + + /** + * Shuts down a steam + */ + public void shutdownStream() + { + LOGGER.debug(STREAM_MARKER, "Shutdown streaming"); + this.broadcastController.statCallback(); + this.chatController.func_175988_p(); + } + + public void func_152935_j() + { + int i = this.mc.gameSettings.streamChatEnabled; + boolean flag = this.field_176029_e != null && this.chatController.func_175990_d(this.field_176029_e); + boolean flag1 = this.chatController.func_153000_j() == ChatController.ChatState.Initialized && (this.field_176029_e == null || this.chatController.func_175989_e(this.field_176029_e) == ChatController.EnumChannelState.Disconnected); + + if (i == 2) + { + if (flag) + { + LOGGER.debug(STREAM_MARKER, "Disconnecting from twitch chat per user options"); + this.chatController.func_175991_l(this.field_176029_e); + } + } + else if (i == 1) + { + if (flag1 && this.broadcastController.func_152849_q()) + { + LOGGER.debug(STREAM_MARKER, "Connecting to twitch chat per user options"); + this.func_152942_I(); + } + } + else if (i == 0) + { + if (flag && !this.isBroadcasting()) + { + LOGGER.debug(STREAM_MARKER, "Disconnecting from twitch chat as user is no longer streaming"); + this.chatController.func_175991_l(this.field_176029_e); + } + else if (flag1 && this.isBroadcasting()) + { + LOGGER.debug(STREAM_MARKER, "Connecting to twitch chat as user is streaming"); + this.func_152942_I(); + } + } + + this.broadcastController.func_152821_H(); + this.chatController.func_152997_n(); + } + + protected void func_152942_I() + { + ChatController.ChatState chatcontroller$chatstate = this.chatController.func_153000_j(); + String s = this.broadcastController.getChannelInfo().name; + this.field_176029_e = s; + + if (chatcontroller$chatstate != ChatController.ChatState.Initialized) + { + LOGGER.warn("Invalid twitch chat state {}", new Object[] {chatcontroller$chatstate}); + } + else if (this.chatController.func_175989_e(this.field_176029_e) == ChatController.EnumChannelState.Disconnected) + { + this.chatController.func_152986_d(s); + } + else + { + LOGGER.warn("Invalid twitch chat state {}", new Object[] {chatcontroller$chatstate}); + } + } + + public void func_152922_k() + { + if (this.broadcastController.isBroadcasting() && !this.broadcastController.isBroadcastPaused()) + { + long i = System.nanoTime(); + long j = (long)(1000000000 / this.targetFPS); + long k = i - this.field_152959_k; + boolean flag = k >= j; + + if (flag) + { + FrameBuffer framebuffer = this.broadcastController.func_152822_N(); + Framebuffer framebuffer1 = this.mc.getFramebuffer(); + this.framebuffer.bindFramebuffer(true); + GlStateManager.matrixMode(5889); + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, (double)this.framebuffer.framebufferWidth, (double)this.framebuffer.framebufferHeight, 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.viewport(0, 0, this.framebuffer.framebufferWidth, this.framebuffer.framebufferHeight); + GlStateManager.enableTexture2D(); + GlStateManager.disableAlpha(); + GlStateManager.disableBlend(); + float f = (float)this.framebuffer.framebufferWidth; + float f1 = (float)this.framebuffer.framebufferHeight; + float f2 = (float)framebuffer1.framebufferWidth / (float)framebuffer1.framebufferTextureWidth; + float f3 = (float)framebuffer1.framebufferHeight / (float)framebuffer1.framebufferTextureHeight; + framebuffer1.bindFramebufferTexture(); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, 9729.0F); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, 9729.0F); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(0.0D, (double)f1, 0.0D).tex(0.0D, (double)f3).endVertex(); + worldrenderer.pos((double)f, (double)f1, 0.0D).tex((double)f2, (double)f3).endVertex(); + worldrenderer.pos((double)f, 0.0D, 0.0D).tex((double)f2, 0.0D).endVertex(); + worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, 0.0D).endVertex(); + tessellator.draw(); + framebuffer1.unbindFramebufferTexture(); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5889); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5888); + this.broadcastController.captureFramebuffer(framebuffer); + this.framebuffer.unbindFramebuffer(); + this.broadcastController.submitStreamFrame(framebuffer); + this.field_152959_k = i; + } + } + } + + public boolean func_152936_l() + { + return this.broadcastController.func_152849_q(); + } + + public boolean isReadyToBroadcast() + { + return this.broadcastController.isReadyToBroadcast(); + } + + public boolean isBroadcasting() + { + return this.broadcastController.isBroadcasting(); + } + + public void func_152911_a(Metadata p_152911_1_, long p_152911_2_) + { + if (this.isBroadcasting() && this.field_152957_i) + { + long i = this.broadcastController.func_152844_x(); + + if (!this.broadcastController.func_152840_a(p_152911_1_.func_152810_c(), i + p_152911_2_, p_152911_1_.func_152809_a(), p_152911_1_.func_152806_b())) + { + LOGGER.warn(STREAM_MARKER, "Couldn\'t send stream metadata action at {}: {}", new Object[] {Long.valueOf(i + p_152911_2_), p_152911_1_}); + } + else + { + LOGGER.debug(STREAM_MARKER, "Sent stream metadata action at {}: {}", new Object[] {Long.valueOf(i + p_152911_2_), p_152911_1_}); + } + } + } + + public void func_176026_a(Metadata p_176026_1_, long p_176026_2_, long p_176026_4_) + { + if (this.isBroadcasting() && this.field_152957_i) + { + long i = this.broadcastController.func_152844_x(); + String s = p_176026_1_.func_152809_a(); + String s1 = p_176026_1_.func_152806_b(); + long j = this.broadcastController.func_177946_b(p_176026_1_.func_152810_c(), i + p_176026_2_, s, s1); + + if (j < 0L) + { + LOGGER.warn(STREAM_MARKER, "Could not send stream metadata sequence from {} to {}: {}", new Object[] {Long.valueOf(i + p_176026_2_), Long.valueOf(i + p_176026_4_), p_176026_1_}); + } + else if (this.broadcastController.func_177947_a(p_176026_1_.func_152810_c(), i + p_176026_4_, j, s, s1)) + { + LOGGER.debug(STREAM_MARKER, "Sent stream metadata sequence from {} to {}: {}", new Object[] {Long.valueOf(i + p_176026_2_), Long.valueOf(i + p_176026_4_), p_176026_1_}); + } + else + { + LOGGER.warn(STREAM_MARKER, "Half-sent stream metadata sequence from {} to {}: {}", new Object[] {Long.valueOf(i + p_176026_2_), Long.valueOf(i + p_176026_4_), p_176026_1_}); + } + } + } + + public boolean isPaused() + { + return this.broadcastController.isBroadcastPaused(); + } + + public void requestCommercial() + { + if (this.broadcastController.requestCommercial()) + { + LOGGER.debug(STREAM_MARKER, "Requested commercial from Twitch"); + } + else + { + LOGGER.warn(STREAM_MARKER, "Could not request commercial from Twitch"); + } + } + + /** + * pauses a stream + */ + public void pause() + { + this.broadcastController.func_152847_F(); + this.field_152962_n = true; + this.updateStreamVolume(); + } + + /** + * unpauses a stream + */ + public void unpause() + { + this.broadcastController.func_152854_G(); + this.field_152962_n = false; + this.updateStreamVolume(); + } + + public void updateStreamVolume() + { + if (this.isBroadcasting()) + { + float f = this.mc.gameSettings.streamGameVolume; + boolean flag = this.field_152962_n || f <= 0.0F; + this.broadcastController.setPlaybackDeviceVolume(flag ? 0.0F : f); + this.broadcastController.setRecordingDeviceVolume(this.func_152929_G() ? 0.0F : this.mc.gameSettings.streamMicVolume); + } + } + + public void func_152930_t() + { + GameSettings gamesettings = this.mc.gameSettings; + VideoParams videoparams = this.broadcastController.func_152834_a(formatStreamKbps(gamesettings.streamKbps), formatStreamFps(gamesettings.streamFps), formatStreamBps(gamesettings.streamBytesPerPixel), (float)this.mc.displayWidth / (float)this.mc.displayHeight); + + switch (gamesettings.streamCompression) + { + case 0: + videoparams.encodingCpuUsage = EncodingCpuUsage.TTV_ECU_LOW; + break; + + case 1: + videoparams.encodingCpuUsage = EncodingCpuUsage.TTV_ECU_MEDIUM; + break; + + case 2: + videoparams.encodingCpuUsage = EncodingCpuUsage.TTV_ECU_HIGH; + } + + if (this.framebuffer == null) + { + this.framebuffer = new Framebuffer(videoparams.outputWidth, videoparams.outputHeight, false); + } + else + { + this.framebuffer.createBindFramebuffer(videoparams.outputWidth, videoparams.outputHeight); + } + + if (gamesettings.streamPreferredServer != null && gamesettings.streamPreferredServer.length() > 0) + { + for (IngestServer ingestserver : this.func_152925_v()) + { + if (ingestserver.serverUrl.equals(gamesettings.streamPreferredServer)) + { + this.broadcastController.func_152824_a(ingestserver); + break; + } + } + } + + this.targetFPS = videoparams.targetFps; + this.field_152957_i = gamesettings.streamSendMetadata; + this.broadcastController.func_152836_a(videoparams); + LOGGER.info(STREAM_MARKER, "Streaming at {}/{} at {} kbps to {}", new Object[] {Integer.valueOf(videoparams.outputWidth), Integer.valueOf(videoparams.outputHeight), Integer.valueOf(videoparams.maxKbps), this.broadcastController.func_152833_s().serverUrl}); + this.broadcastController.func_152828_a((String)null, "Minecraft", (String)null); + } + + public void stopBroadcasting() + { + if (this.broadcastController.stopBroadcasting()) + { + LOGGER.info(STREAM_MARKER, "Stopped streaming to Twitch"); + } + else + { + LOGGER.warn(STREAM_MARKER, "Could not stop streaming to Twitch"); + } + } + + public void func_152900_a(ErrorCode p_152900_1_, AuthToken p_152900_2_) + { + } + + public void func_152897_a(ErrorCode p_152897_1_) + { + if (ErrorCode.succeeded(p_152897_1_)) + { + LOGGER.debug(STREAM_MARKER, "Login attempt successful"); + this.loggedIn = true; + } + else + { + LOGGER.warn(STREAM_MARKER, "Login attempt unsuccessful: {} (error code {})", new Object[] {ErrorCode.getString(p_152897_1_), Integer.valueOf(p_152897_1_.getValue())}); + this.loggedIn = false; + } + } + + public void func_152898_a(ErrorCode p_152898_1_, GameInfo[] p_152898_2_) + { + } + + public void func_152891_a(BroadcastController.BroadcastState p_152891_1_) + { + LOGGER.debug(STREAM_MARKER, "Broadcast state changed to {}", new Object[] {p_152891_1_}); + + if (p_152891_1_ == BroadcastController.BroadcastState.Initialized) + { + this.broadcastController.func_152827_a(BroadcastController.BroadcastState.Authenticated); + } + } + + public void func_152895_a() + { + LOGGER.info(STREAM_MARKER, "Logged out of twitch"); + } + + public void func_152894_a(StreamInfo p_152894_1_) + { + LOGGER.debug(STREAM_MARKER, "Stream info updated; {} viewers on stream ID {}", new Object[] {Integer.valueOf(p_152894_1_.viewers), Long.valueOf(p_152894_1_.streamId)}); + } + + public void func_152896_a(IngestList p_152896_1_) + { + } + + public void func_152893_b(ErrorCode p_152893_1_) + { + LOGGER.warn(STREAM_MARKER, "Issue submitting frame: {} (Error code {})", new Object[] {ErrorCode.getString(p_152893_1_), Integer.valueOf(p_152893_1_.getValue())}); + this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText("Issue streaming frame: " + p_152893_1_ + " (" + ErrorCode.getString(p_152893_1_) + ")"), 2); + } + + public void func_152899_b() + { + this.updateStreamVolume(); + LOGGER.info(STREAM_MARKER, "Broadcast to Twitch has started"); + } + + public void func_152901_c() + { + LOGGER.info(STREAM_MARKER, "Broadcast to Twitch has stopped"); + } + + public void func_152892_c(ErrorCode p_152892_1_) + { + if (p_152892_1_ == ErrorCode.TTV_EC_SOUNDFLOWER_NOT_INSTALLED) + { + IChatComponent ichatcomponent = new ChatComponentTranslation("stream.unavailable.soundflower.chat.link", new Object[0]); + ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://help.mojang.com/customer/portal/articles/1374877-configuring-soundflower-for-streaming-on-apple-computers")); + ichatcomponent.getChatStyle().setUnderlined(Boolean.valueOf(true)); + IChatComponent ichatcomponent1 = new ChatComponentTranslation("stream.unavailable.soundflower.chat", new Object[] {ichatcomponent}); + ichatcomponent1.getChatStyle().setColor(EnumChatFormatting.DARK_RED); + this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent1); + } + else + { + IChatComponent ichatcomponent2 = new ChatComponentTranslation("stream.unavailable.unknown.chat", new Object[] {ErrorCode.getString(p_152892_1_)}); + ichatcomponent2.getChatStyle().setColor(EnumChatFormatting.DARK_RED); + this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent2); + } + } + + public void func_152907_a(IngestServerTester p_152907_1_, IngestServerTester.IngestTestState p_152907_2_) + { + LOGGER.debug(STREAM_MARKER, "Ingest test state changed to {}", new Object[] {p_152907_2_}); + + if (p_152907_2_ == IngestServerTester.IngestTestState.Finished) + { + this.field_152960_l = true; + } + } + + public static int formatStreamFps(float p_152948_0_) + { + return MathHelper.floor_float(10.0F + p_152948_0_ * 50.0F); + } + + public static int formatStreamKbps(float p_152946_0_) + { + return MathHelper.floor_float(230.0F + p_152946_0_ * 3270.0F); + } + + public static float formatStreamBps(float p_152947_0_) + { + return 0.1F + p_152947_0_ * 0.1F; + } + + public IngestServer[] func_152925_v() + { + return this.broadcastController.func_152855_t().getServers(); + } + + public void func_152909_x() + { + IngestServerTester ingestservertester = this.broadcastController.func_152838_J(); + + if (ingestservertester != null) + { + ingestservertester.func_153042_a(this); + } + } + + public IngestServerTester func_152932_y() + { + return this.broadcastController.isReady(); + } + + public boolean func_152908_z() + { + return this.broadcastController.isIngestTesting(); + } + + public int func_152920_A() + { + return this.isBroadcasting() ? this.broadcastController.getStreamInfo().viewers : 0; + } + + public void func_176023_d(ErrorCode p_176023_1_) + { + if (ErrorCode.failed(p_176023_1_)) + { + LOGGER.error(STREAM_MARKER, "Chat failed to initialize"); + } + } + + public void func_176022_e(ErrorCode p_176022_1_) + { + if (ErrorCode.failed(p_176022_1_)) + { + LOGGER.error(STREAM_MARKER, "Chat failed to shutdown"); + } + } + + public void func_176017_a(ChatController.ChatState p_176017_1_) + { + } + + public void func_180605_a(String p_180605_1_, ChatRawMessage[] p_180605_2_) + { + for (ChatRawMessage chatrawmessage : p_180605_2_) + { + this.func_176027_a(chatrawmessage.userName, chatrawmessage); + + if (this.func_176028_a(chatrawmessage.modes, chatrawmessage.subscriptions, this.mc.gameSettings.streamChatUserFilter)) + { + IChatComponent ichatcomponent = new ChatComponentText(chatrawmessage.userName); + IChatComponent ichatcomponent1 = new ChatComponentTranslation("chat.stream." + (chatrawmessage.action ? "emote" : "text"), new Object[] {this.twitchComponent, ichatcomponent, EnumChatFormatting.getTextWithoutFormattingCodes(chatrawmessage.message)}); + + if (chatrawmessage.action) + { + ichatcomponent1.getChatStyle().setItalic(Boolean.valueOf(true)); + } + + IChatComponent ichatcomponent2 = new ChatComponentText(""); + ichatcomponent2.appendSibling(new ChatComponentTranslation("stream.userinfo.chatTooltip", new Object[0])); + + for (IChatComponent ichatcomponent3 : GuiTwitchUserMode.func_152328_a(chatrawmessage.modes, chatrawmessage.subscriptions, (IStream)null)) + { + ichatcomponent2.appendText("\n"); + ichatcomponent2.appendSibling(ichatcomponent3); + } + + ichatcomponent.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, ichatcomponent2)); + ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.TWITCH_USER_INFO, chatrawmessage.userName)); + this.mc.ingameGUI.getChatGUI().printChatMessage(ichatcomponent1); + } + } + } + + public void func_176025_a(String p_176025_1_, ChatTokenizedMessage[] p_176025_2_) + { + } + + private void func_176027_a(String p_176027_1_, ChatRawMessage p_176027_2_) + { + ChatUserInfo chatuserinfo = (ChatUserInfo)this.field_152955_g.get(p_176027_1_); + + if (chatuserinfo == null) + { + chatuserinfo = new ChatUserInfo(); + chatuserinfo.displayName = p_176027_1_; + this.field_152955_g.put(p_176027_1_, chatuserinfo); + } + + chatuserinfo.subscriptions = p_176027_2_.subscriptions; + chatuserinfo.modes = p_176027_2_.modes; + chatuserinfo.nameColorARGB = p_176027_2_.nameColorARGB; + } + + private boolean func_176028_a(Set p_176028_1_, Set p_176028_2_, int p_176028_3_) + { + return p_176028_1_.contains(ChatUserMode.TTV_CHAT_USERMODE_BANNED) ? false : (p_176028_1_.contains(ChatUserMode.TTV_CHAT_USERMODE_ADMINSTRATOR) ? true : (p_176028_1_.contains(ChatUserMode.TTV_CHAT_USERMODE_MODERATOR) ? true : (p_176028_1_.contains(ChatUserMode.TTV_CHAT_USERMODE_STAFF) ? true : (p_176028_3_ == 0 ? true : (p_176028_3_ == 1 ? p_176028_2_.contains(ChatUserSubscription.TTV_CHAT_USERSUB_SUBSCRIBER) : false))))); + } + + public void func_176018_a(String p_176018_1_, ChatUserInfo[] p_176018_2_, ChatUserInfo[] p_176018_3_, ChatUserInfo[] p_176018_4_) + { + for (ChatUserInfo chatuserinfo : p_176018_3_) + { + this.field_152955_g.remove(chatuserinfo.displayName); + } + + for (ChatUserInfo chatuserinfo1 : p_176018_4_) + { + this.field_152955_g.put(chatuserinfo1.displayName, chatuserinfo1); + } + + for (ChatUserInfo chatuserinfo2 : p_176018_2_) + { + this.field_152955_g.put(chatuserinfo2.displayName, chatuserinfo2); + } + } + + public void func_180606_a(String p_180606_1_) + { + LOGGER.debug(STREAM_MARKER, "Chat connected"); + } + + public void func_180607_b(String p_180607_1_) + { + LOGGER.debug(STREAM_MARKER, "Chat disconnected"); + this.field_152955_g.clear(); + } + + public void func_176019_a(String p_176019_1_, String p_176019_2_) + { + } + + public void func_176021_d() + { + } + + public void func_176024_e() + { + } + + public void func_176016_c(String p_176016_1_) + { + } + + public void func_176020_d(String p_176020_1_) + { + } + + public boolean func_152927_B() + { + return this.field_176029_e != null && this.field_176029_e.equals(this.broadcastController.getChannelInfo().name); + } + + public String func_152921_C() + { + return this.field_176029_e; + } + + public ChatUserInfo func_152926_a(String p_152926_1_) + { + return (ChatUserInfo)this.field_152955_g.get(p_152926_1_); + } + + public void func_152917_b(String p_152917_1_) + { + this.chatController.func_175986_a(this.field_176029_e, p_152917_1_); + } + + public boolean func_152928_D() + { + return field_152965_q && this.broadcastController.func_152858_b(); + } + + public ErrorCode func_152912_E() + { + return !field_152965_q ? ErrorCode.TTV_EC_OS_TOO_OLD : this.broadcastController.getErrorCode(); + } + + public boolean func_152913_F() + { + return this.loggedIn; + } + + /** + * mutes or unmutes the microphone based on the boolean parameter passed into the method + */ + public void muteMicrophone(boolean p_152910_1_) + { + this.field_152963_o = p_152910_1_; + this.updateStreamVolume(); + } + + public boolean func_152929_G() + { + boolean flag = this.mc.gameSettings.streamMicToggleBehavior == 1; + return this.field_152962_n || this.mc.gameSettings.streamMicVolume <= 0.0F || flag != this.field_152963_o; + } + + public IStream.AuthFailureReason func_152918_H() + { + return this.authFailureReason; + } + + static + { + try + { + if (Util.getOSType() == Util.EnumOS.WINDOWS) + { + System.loadLibrary("avutil-ttv-51"); + System.loadLibrary("swresample-ttv-0"); + System.loadLibrary("libmp3lame-ttv"); + + if (System.getProperty("os.arch").contains("64")) + { + System.loadLibrary("libmfxsw64"); + } + else + { + System.loadLibrary("libmfxsw32"); + } + } + + field_152965_q = true; + } + catch (Throwable var1) + { + field_152965_q = false; + } + } +} diff --git a/src/minecraft/net/minecraft/client/util/JsonBlendingMode.java b/src/minecraft/net/minecraft/client/util/JsonBlendingMode.java new file mode 100644 index 0000000..9f154e2 --- /dev/null +++ b/src/minecraft/net/minecraft/client/util/JsonBlendingMode.java @@ -0,0 +1,198 @@ +package net.minecraft.client.util; + +import com.google.gson.JsonObject; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.JsonUtils; +import org.lwjgl.opengl.GL14; + +public class JsonBlendingMode +{ + private static JsonBlendingMode field_148118_a = null; + private final int field_148116_b; + private final int field_148117_c; + private final int field_148114_d; + private final int field_148115_e; + private final int field_148112_f; + private final boolean field_148113_g; + private final boolean field_148119_h; + + private JsonBlendingMode(boolean p_i45084_1_, boolean p_i45084_2_, int p_i45084_3_, int p_i45084_4_, int p_i45084_5_, int p_i45084_6_, int p_i45084_7_) + { + this.field_148113_g = p_i45084_1_; + this.field_148116_b = p_i45084_3_; + this.field_148114_d = p_i45084_4_; + this.field_148117_c = p_i45084_5_; + this.field_148115_e = p_i45084_6_; + this.field_148119_h = p_i45084_2_; + this.field_148112_f = p_i45084_7_; + } + + public JsonBlendingMode() + { + this(false, true, 1, 0, 1, 0, 32774); + } + + public JsonBlendingMode(int p_i45085_1_, int p_i45085_2_, int p_i45085_3_) + { + this(false, false, p_i45085_1_, p_i45085_2_, p_i45085_1_, p_i45085_2_, p_i45085_3_); + } + + public JsonBlendingMode(int p_i45086_1_, int p_i45086_2_, int p_i45086_3_, int p_i45086_4_, int p_i45086_5_) + { + this(true, false, p_i45086_1_, p_i45086_2_, p_i45086_3_, p_i45086_4_, p_i45086_5_); + } + + public void func_148109_a() + { + if (!this.equals(field_148118_a)) + { + if (field_148118_a == null || this.field_148119_h != field_148118_a.func_148111_b()) + { + field_148118_a = this; + + if (this.field_148119_h) + { + GlStateManager.disableBlend(); + return; + } + + GlStateManager.enableBlend(); + } + + GL14.glBlendEquation(this.field_148112_f); + + if (this.field_148113_g) + { + GlStateManager.tryBlendFuncSeparate(this.field_148116_b, this.field_148114_d, this.field_148117_c, this.field_148115_e); + } + else + { + GlStateManager.blendFunc(this.field_148116_b, this.field_148114_d); + } + } + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof JsonBlendingMode)) + { + return false; + } + else + { + JsonBlendingMode jsonblendingmode = (JsonBlendingMode)p_equals_1_; + return this.field_148112_f != jsonblendingmode.field_148112_f ? false : (this.field_148115_e != jsonblendingmode.field_148115_e ? false : (this.field_148114_d != jsonblendingmode.field_148114_d ? false : (this.field_148119_h != jsonblendingmode.field_148119_h ? false : (this.field_148113_g != jsonblendingmode.field_148113_g ? false : (this.field_148117_c != jsonblendingmode.field_148117_c ? false : this.field_148116_b == jsonblendingmode.field_148116_b))))); + } + } + + public int hashCode() + { + int i = this.field_148116_b; + i = 31 * i + this.field_148117_c; + i = 31 * i + this.field_148114_d; + i = 31 * i + this.field_148115_e; + i = 31 * i + this.field_148112_f; + i = 31 * i + (this.field_148113_g ? 1 : 0); + i = 31 * i + (this.field_148119_h ? 1 : 0); + return i; + } + + public boolean func_148111_b() + { + return this.field_148119_h; + } + + public static JsonBlendingMode func_148110_a(JsonObject p_148110_0_) + { + if (p_148110_0_ == null) + { + return new JsonBlendingMode(); + } + else + { + int i = 32774; + int j = 1; + int k = 0; + int l = 1; + int i1 = 0; + boolean flag = true; + boolean flag1 = false; + + if (JsonUtils.isString(p_148110_0_, "func")) + { + i = func_148108_a(p_148110_0_.get("func").getAsString()); + + if (i != 32774) + { + flag = false; + } + } + + if (JsonUtils.isString(p_148110_0_, "srcrgb")) + { + j = func_148107_b(p_148110_0_.get("srcrgb").getAsString()); + + if (j != 1) + { + flag = false; + } + } + + if (JsonUtils.isString(p_148110_0_, "dstrgb")) + { + k = func_148107_b(p_148110_0_.get("dstrgb").getAsString()); + + if (k != 0) + { + flag = false; + } + } + + if (JsonUtils.isString(p_148110_0_, "srcalpha")) + { + l = func_148107_b(p_148110_0_.get("srcalpha").getAsString()); + + if (l != 1) + { + flag = false; + } + + flag1 = true; + } + + if (JsonUtils.isString(p_148110_0_, "dstalpha")) + { + i1 = func_148107_b(p_148110_0_.get("dstalpha").getAsString()); + + if (i1 != 0) + { + flag = false; + } + + flag1 = true; + } + + return flag ? new JsonBlendingMode() : (flag1 ? new JsonBlendingMode(j, k, l, i1, i) : new JsonBlendingMode(j, k, i)); + } + } + + private static int func_148108_a(String p_148108_0_) + { + String s = p_148108_0_.trim().toLowerCase(); + return s.equals("add") ? 32774 : (s.equals("subtract") ? 32778 : (s.equals("reversesubtract") ? 32779 : (s.equals("reverse_subtract") ? 32779 : (s.equals("min") ? 32775 : (s.equals("max") ? 32776 : 32774))))); + } + + private static int func_148107_b(String p_148107_0_) + { + String s = p_148107_0_.trim().toLowerCase(); + s = s.replaceAll("_", ""); + s = s.replaceAll("one", "1"); + s = s.replaceAll("zero", "0"); + s = s.replaceAll("minus", "-"); + return s.equals("0") ? 0 : (s.equals("1") ? 1 : (s.equals("srccolor") ? 768 : (s.equals("1-srccolor") ? 769 : (s.equals("dstcolor") ? 774 : (s.equals("1-dstcolor") ? 775 : (s.equals("srcalpha") ? 770 : (s.equals("1-srcalpha") ? 771 : (s.equals("dstalpha") ? 772 : (s.equals("1-dstalpha") ? 773 : -1))))))))); + } +} diff --git a/src/minecraft/net/minecraft/client/util/JsonException.java b/src/minecraft/net/minecraft/client/util/JsonException.java new file mode 100644 index 0000000..272152d --- /dev/null +++ b/src/minecraft/net/minecraft/client/util/JsonException.java @@ -0,0 +1,88 @@ +package net.minecraft.client.util; + +import com.google.common.collect.Lists; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.List; +import org.apache.commons.lang3.StringUtils; + +public class JsonException extends IOException +{ + private final List field_151383_a = Lists.newArrayList(); + private final String field_151382_b; + + public JsonException(String p_i45279_1_) + { + this.field_151383_a.add(new JsonException.Entry()); + this.field_151382_b = p_i45279_1_; + } + + public JsonException(String p_i45280_1_, Throwable p_i45280_2_) + { + super(p_i45280_2_); + this.field_151383_a.add(new JsonException.Entry()); + this.field_151382_b = p_i45280_1_; + } + + public void func_151380_a(String p_151380_1_) + { + ((JsonException.Entry)this.field_151383_a.get(0)).func_151373_a(p_151380_1_); + } + + public void func_151381_b(String p_151381_1_) + { + ((JsonException.Entry)this.field_151383_a.get(0)).field_151376_a = p_151381_1_; + this.field_151383_a.add(0, new JsonException.Entry()); + } + + public String getMessage() + { + return "Invalid " + ((JsonException.Entry)this.field_151383_a.get(this.field_151383_a.size() - 1)).toString() + ": " + this.field_151382_b; + } + + public static JsonException func_151379_a(Exception p_151379_0_) + { + if (p_151379_0_ instanceof JsonException) + { + return (JsonException)p_151379_0_; + } + else + { + String s = p_151379_0_.getMessage(); + + if (p_151379_0_ instanceof FileNotFoundException) + { + s = "File not found"; + } + + return new JsonException(s, p_151379_0_); + } + } + + public static class Entry + { + private String field_151376_a; + private final List field_151375_b; + + private Entry() + { + this.field_151376_a = null; + this.field_151375_b = Lists.newArrayList(); + } + + private void func_151373_a(String p_151373_1_) + { + this.field_151375_b.add(0, p_151373_1_); + } + + public String func_151372_b() + { + return StringUtils.join((Iterable)this.field_151375_b, "->"); + } + + public String toString() + { + return this.field_151376_a != null ? (!this.field_151375_b.isEmpty() ? this.field_151376_a + " " + this.func_151372_b() : this.field_151376_a) : (!this.field_151375_b.isEmpty() ? "(Unknown file) " + this.func_151372_b() : "(Unknown file)"); + } + } +} diff --git a/src/minecraft/net/minecraft/command/CommandBase.java b/src/minecraft/net/minecraft/command/CommandBase.java new file mode 100644 index 0000000..95205b2 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandBase.java @@ -0,0 +1,772 @@ +package net.minecraft.command; + +import com.google.common.base.Functions; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.primitives.Doubles; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ResourceLocation; + +public abstract class CommandBase implements ICommand +{ + private static IAdminCommand theAdmin; + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 4; + } + + public List getCommandAliases() + { + return Collections.emptyList(); + } + + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender sender) + { + return sender.canCommandSenderUseCommand(this.getRequiredPermissionLevel(), this.getCommandName()); + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return null; + } + + public static int parseInt(String input) throws NumberInvalidException + { + try + { + return Integer.parseInt(input); + } + catch (NumberFormatException var2) + { + throw new NumberInvalidException("commands.generic.num.invalid", new Object[] {input}); + } + } + + public static int parseInt(String input, int min) throws NumberInvalidException + { + return parseInt(input, min, Integer.MAX_VALUE); + } + + public static int parseInt(String input, int min, int max) throws NumberInvalidException + { + int i = parseInt(input); + + if (i < min) + { + throw new NumberInvalidException("commands.generic.num.tooSmall", new Object[] {Integer.valueOf(i), Integer.valueOf(min)}); + } + else if (i > max) + { + throw new NumberInvalidException("commands.generic.num.tooBig", new Object[] {Integer.valueOf(i), Integer.valueOf(max)}); + } + else + { + return i; + } + } + + public static long parseLong(String input) throws NumberInvalidException + { + try + { + return Long.parseLong(input); + } + catch (NumberFormatException var2) + { + throw new NumberInvalidException("commands.generic.num.invalid", new Object[] {input}); + } + } + + public static long parseLong(String input, long min, long max) throws NumberInvalidException + { + long i = parseLong(input); + + if (i < min) + { + throw new NumberInvalidException("commands.generic.num.tooSmall", new Object[] {Long.valueOf(i), Long.valueOf(min)}); + } + else if (i > max) + { + throw new NumberInvalidException("commands.generic.num.tooBig", new Object[] {Long.valueOf(i), Long.valueOf(max)}); + } + else + { + return i; + } + } + + public static BlockPos parseBlockPos(ICommandSender sender, String[] args, int startIndex, boolean centerBlock) throws NumberInvalidException + { + BlockPos blockpos = sender.getPosition(); + return new BlockPos(parseDouble((double)blockpos.getX(), args[startIndex], -30000000, 30000000, centerBlock), parseDouble((double)blockpos.getY(), args[startIndex + 1], 0, 256, false), parseDouble((double)blockpos.getZ(), args[startIndex + 2], -30000000, 30000000, centerBlock)); + } + + public static double parseDouble(String input) throws NumberInvalidException + { + try + { + double d0 = Double.parseDouble(input); + + if (!Doubles.isFinite(d0)) + { + throw new NumberInvalidException("commands.generic.num.invalid", new Object[] {input}); + } + else + { + return d0; + } + } + catch (NumberFormatException var3) + { + throw new NumberInvalidException("commands.generic.num.invalid", new Object[] {input}); + } + } + + public static double parseDouble(String input, double min) throws NumberInvalidException + { + return parseDouble(input, min, Double.MAX_VALUE); + } + + public static double parseDouble(String input, double min, double max) throws NumberInvalidException + { + double d0 = parseDouble(input); + + if (d0 < min) + { + throw new NumberInvalidException("commands.generic.double.tooSmall", new Object[] {Double.valueOf(d0), Double.valueOf(min)}); + } + else if (d0 > max) + { + throw new NumberInvalidException("commands.generic.double.tooBig", new Object[] {Double.valueOf(d0), Double.valueOf(max)}); + } + else + { + return d0; + } + } + + public static boolean parseBoolean(String input) throws CommandException + { + if (!input.equals("true") && !input.equals("1")) + { + if (!input.equals("false") && !input.equals("0")) + { + throw new CommandException("commands.generic.boolean.invalid", new Object[] {input}); + } + else + { + return false; + } + } + else + { + return true; + } + } + + /** + * Returns the given ICommandSender as a EntityPlayer or throw an exception. + */ + public static EntityPlayerMP getCommandSenderAsPlayer(ICommandSender sender) throws PlayerNotFoundException + { + if (sender instanceof EntityPlayerMP) + { + return (EntityPlayerMP)sender; + } + else + { + throw new PlayerNotFoundException("You must specify which player you wish to perform this action on.", new Object[0]); + } + } + + public static EntityPlayerMP getPlayer(ICommandSender sender, String username) throws PlayerNotFoundException + { + EntityPlayerMP entityplayermp = PlayerSelector.matchOnePlayer(sender, username); + + if (entityplayermp == null) + { + try + { + entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerByUUID(UUID.fromString(username)); + } + catch (IllegalArgumentException var4) + { + ; + } + } + + if (entityplayermp == null) + { + entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(username); + } + + if (entityplayermp == null) + { + throw new PlayerNotFoundException(); + } + else + { + return entityplayermp; + } + } + + public static Entity func_175768_b(ICommandSender p_175768_0_, String p_175768_1_) throws EntityNotFoundException + { + return getEntity(p_175768_0_, p_175768_1_, Entity.class); + } + + public static T getEntity(ICommandSender commandSender, String p_175759_1_, Class p_175759_2_) throws EntityNotFoundException + { + Entity entity = PlayerSelector.matchOneEntity(commandSender, p_175759_1_, p_175759_2_); + MinecraftServer minecraftserver = MinecraftServer.getServer(); + + if (entity == null) + { + entity = minecraftserver.getConfigurationManager().getPlayerByUsername(p_175759_1_); + } + + if (entity == null) + { + try + { + UUID uuid = UUID.fromString(p_175759_1_); + entity = minecraftserver.getEntityFromUuid(uuid); + + if (entity == null) + { + entity = minecraftserver.getConfigurationManager().getPlayerByUUID(uuid); + } + } + catch (IllegalArgumentException var6) + { + throw new EntityNotFoundException("commands.generic.entity.invalidUuid", new Object[0]); + } + } + + if (entity != null && p_175759_2_.isAssignableFrom(entity.getClass())) + { + return (T)entity; + } + else + { + throw new EntityNotFoundException(); + } + } + + public static List func_175763_c(ICommandSender p_175763_0_, String p_175763_1_) throws EntityNotFoundException + { + return (List)(PlayerSelector.hasArguments(p_175763_1_) ? PlayerSelector.matchEntities(p_175763_0_, p_175763_1_, Entity.class) : Lists.newArrayList(new Entity[] {func_175768_b(p_175763_0_, p_175763_1_)})); + } + + public static String getPlayerName(ICommandSender sender, String query) throws PlayerNotFoundException + { + try + { + return getPlayer(sender, query).getName(); + } + catch (PlayerNotFoundException playernotfoundexception) + { + if (PlayerSelector.hasArguments(query)) + { + throw playernotfoundexception; + } + else + { + return query; + } + } + } + + /** + * Attempts to retrieve an entity's name, first assuming that the entity is a player, and then exhausting all other + * possibilities. + */ + public static String getEntityName(ICommandSender p_175758_0_, String p_175758_1_) throws EntityNotFoundException + { + try + { + return getPlayer(p_175758_0_, p_175758_1_).getName(); + } + catch (PlayerNotFoundException var5) + { + try + { + return func_175768_b(p_175758_0_, p_175758_1_).getUniqueID().toString(); + } + catch (EntityNotFoundException entitynotfoundexception) + { + if (PlayerSelector.hasArguments(p_175758_1_)) + { + throw entitynotfoundexception; + } + else + { + return p_175758_1_; + } + } + } + } + + public static IChatComponent getChatComponentFromNthArg(ICommandSender sender, String[] args, int p_147178_2_) throws CommandException, PlayerNotFoundException + { + return getChatComponentFromNthArg(sender, args, p_147178_2_, false); + } + + public static IChatComponent getChatComponentFromNthArg(ICommandSender sender, String[] args, int index, boolean p_147176_3_) throws PlayerNotFoundException + { + IChatComponent ichatcomponent = new ChatComponentText(""); + + for (int i = index; i < args.length; ++i) + { + if (i > index) + { + ichatcomponent.appendText(" "); + } + + IChatComponent ichatcomponent1 = new ChatComponentText(args[i]); + + if (p_147176_3_) + { + IChatComponent ichatcomponent2 = PlayerSelector.matchEntitiesToChatComponent(sender, args[i]); + + if (ichatcomponent2 == null) + { + if (PlayerSelector.hasArguments(args[i])) + { + throw new PlayerNotFoundException(); + } + } + else + { + ichatcomponent1 = ichatcomponent2; + } + } + + ichatcomponent.appendSibling(ichatcomponent1); + } + + return ichatcomponent; + } + + /** + * Builds a string starting at startPos + */ + public static String buildString(String[] args, int startPos) + { + StringBuilder stringbuilder = new StringBuilder(); + + for (int i = startPos; i < args.length; ++i) + { + if (i > startPos) + { + stringbuilder.append(" "); + } + + String s = args[i]; + stringbuilder.append(s); + } + + return stringbuilder.toString(); + } + + public static CommandBase.CoordinateArg parseCoordinate(double base, String p_175770_2_, boolean centerBlock) throws NumberInvalidException + { + return parseCoordinate(base, p_175770_2_, -30000000, 30000000, centerBlock); + } + + public static CommandBase.CoordinateArg parseCoordinate(double p_175767_0_, String p_175767_2_, int min, int max, boolean centerBlock) throws NumberInvalidException + { + boolean flag = p_175767_2_.startsWith("~"); + + if (flag && Double.isNaN(p_175767_0_)) + { + throw new NumberInvalidException("commands.generic.num.invalid", new Object[] {Double.valueOf(p_175767_0_)}); + } + else + { + double d0 = 0.0D; + + if (!flag || p_175767_2_.length() > 1) + { + boolean flag1 = p_175767_2_.contains("."); + + if (flag) + { + p_175767_2_ = p_175767_2_.substring(1); + } + + d0 += parseDouble(p_175767_2_); + + if (!flag1 && !flag && centerBlock) + { + d0 += 0.5D; + } + } + + if (min != 0 || max != 0) + { + if (d0 < (double)min) + { + throw new NumberInvalidException("commands.generic.double.tooSmall", new Object[] {Double.valueOf(d0), Integer.valueOf(min)}); + } + + if (d0 > (double)max) + { + throw new NumberInvalidException("commands.generic.double.tooBig", new Object[] {Double.valueOf(d0), Integer.valueOf(max)}); + } + } + + return new CommandBase.CoordinateArg(d0 + (flag ? p_175767_0_ : 0.0D), d0, flag); + } + } + + public static double parseDouble(double base, String input, boolean centerBlock) throws NumberInvalidException + { + return parseDouble(base, input, -30000000, 30000000, centerBlock); + } + + public static double parseDouble(double base, String input, int min, int max, boolean centerBlock) throws NumberInvalidException + { + boolean flag = input.startsWith("~"); + + if (flag && Double.isNaN(base)) + { + throw new NumberInvalidException("commands.generic.num.invalid", new Object[] {Double.valueOf(base)}); + } + else + { + double d0 = flag ? base : 0.0D; + + if (!flag || input.length() > 1) + { + boolean flag1 = input.contains("."); + + if (flag) + { + input = input.substring(1); + } + + d0 += parseDouble(input); + + if (!flag1 && !flag && centerBlock) + { + d0 += 0.5D; + } + } + + if (min != 0 || max != 0) + { + if (d0 < (double)min) + { + throw new NumberInvalidException("commands.generic.double.tooSmall", new Object[] {Double.valueOf(d0), Integer.valueOf(min)}); + } + + if (d0 > (double)max) + { + throw new NumberInvalidException("commands.generic.double.tooBig", new Object[] {Double.valueOf(d0), Integer.valueOf(max)}); + } + } + + return d0; + } + } + + /** + * Gets the Item specified by the given text string. First checks the item registry, then tries by parsing the + * string as an integer ID (deprecated). Warns the sender if we matched by parsing the ID. Throws if the item + * wasn't found. Returns the item if it was found. + */ + public static Item getItemByText(ICommandSender sender, String id) throws NumberInvalidException + { + ResourceLocation resourcelocation = new ResourceLocation(id); + Item item = (Item)Item.itemRegistry.getObject(resourcelocation); + + if (item == null) + { + throw new NumberInvalidException("commands.give.item.notFound", new Object[] {resourcelocation}); + } + else + { + return item; + } + } + + /** + * Gets the Block specified by the given text string. First checks the block registry, then tries by parsing the + * string as an integer ID (deprecated). Warns the sender if we matched by parsing the ID. Throws if the block + * wasn't found. Returns the block if it was found. + */ + public static Block getBlockByText(ICommandSender sender, String id) throws NumberInvalidException + { + ResourceLocation resourcelocation = new ResourceLocation(id); + + if (!Block.blockRegistry.containsKey(resourcelocation)) + { + throw new NumberInvalidException("commands.give.block.notFound", new Object[] {resourcelocation}); + } + else + { + Block block = (Block)Block.blockRegistry.getObject(resourcelocation); + + if (block == null) + { + throw new NumberInvalidException("commands.give.block.notFound", new Object[] {resourcelocation}); + } + else + { + return block; + } + } + } + + /** + * Creates a linguistic series joining the input objects together. Examples: 1) {} --> "", 2) {"Steve"} --> + * "Steve", 3) {"Steve", "Phil"} --> "Steve and Phil", 4) {"Steve", "Phil", "Mark"} --> "Steve, Phil and Mark" + */ + public static String joinNiceString(Object[] elements) + { + StringBuilder stringbuilder = new StringBuilder(); + + for (int i = 0; i < elements.length; ++i) + { + String s = elements[i].toString(); + + if (i > 0) + { + if (i == elements.length - 1) + { + stringbuilder.append(" and "); + } + else + { + stringbuilder.append(", "); + } + } + + stringbuilder.append(s); + } + + return stringbuilder.toString(); + } + + public static IChatComponent join(List components) + { + IChatComponent ichatcomponent = new ChatComponentText(""); + + for (int i = 0; i < components.size(); ++i) + { + if (i > 0) + { + if (i == components.size() - 1) + { + ichatcomponent.appendText(" and "); + } + else if (i > 0) + { + ichatcomponent.appendText(", "); + } + } + + ichatcomponent.appendSibling((IChatComponent)components.get(i)); + } + + return ichatcomponent; + } + + /** + * Creates a linguistic series joining together the elements of the given collection. Examples: 1) {} --> "", 2) + * {"Steve"} --> "Steve", 3) {"Steve", "Phil"} --> "Steve and Phil", 4) {"Steve", "Phil", "Mark"} --> "Steve, Phil + * and Mark" + */ + public static String joinNiceStringFromCollection(Collection strings) + { + return joinNiceString(strings.toArray(new String[strings.size()])); + } + + public static List func_175771_a(String[] p_175771_0_, int p_175771_1_, BlockPos p_175771_2_) + { + if (p_175771_2_ == null) + { + return null; + } + else + { + int i = p_175771_0_.length - 1; + String s; + + if (i == p_175771_1_) + { + s = Integer.toString(p_175771_2_.getX()); + } + else if (i == p_175771_1_ + 1) + { + s = Integer.toString(p_175771_2_.getY()); + } + else + { + if (i != p_175771_1_ + 2) + { + return null; + } + + s = Integer.toString(p_175771_2_.getZ()); + } + + return Lists.newArrayList(new String[] {s}); + } + } + + public static List func_181043_b(String[] p_181043_0_, int p_181043_1_, BlockPos p_181043_2_) + { + if (p_181043_2_ == null) + { + return null; + } + else + { + int i = p_181043_0_.length - 1; + String s; + + if (i == p_181043_1_) + { + s = Integer.toString(p_181043_2_.getX()); + } + else + { + if (i != p_181043_1_ + 1) + { + return null; + } + + s = Integer.toString(p_181043_2_.getZ()); + } + + return Lists.newArrayList(new String[] {s}); + } + } + + /** + * Returns true if the given substring is exactly equal to the start of the given string (case insensitive). + */ + public static boolean doesStringStartWith(String original, String region) + { + return region.regionMatches(true, 0, original, 0, original.length()); + } + + public static List getListOfStringsMatchingLastWord(String[] args, String... possibilities) + { + return getListOfStringsMatchingLastWord(args, Arrays.asList(possibilities)); + } + + public static List getListOfStringsMatchingLastWord(String[] p_175762_0_, Collection p_175762_1_) + { + String s = p_175762_0_[p_175762_0_.length - 1]; + List list = Lists.newArrayList(); + + if (!p_175762_1_.isEmpty()) + { + for (String s1 : Iterables.transform(p_175762_1_, Functions.toStringFunction())) + { + if (doesStringStartWith(s, s1)) + { + list.add(s1); + } + } + + if (list.isEmpty()) + { + for (Object object : p_175762_1_) + { + if (object instanceof ResourceLocation && doesStringStartWith(s, ((ResourceLocation)object).getResourcePath())) + { + list.add(String.valueOf(object)); + } + } + } + } + + return list; + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return false; + } + + public static void notifyOperators(ICommandSender sender, ICommand command, String msgFormat, Object... msgParams) + { + notifyOperators(sender, command, 0, msgFormat, msgParams); + } + + public static void notifyOperators(ICommandSender sender, ICommand command, int p_152374_2_, String msgFormat, Object... msgParams) + { + if (theAdmin != null) + { + theAdmin.notifyOperators(sender, command, p_152374_2_, msgFormat, msgParams); + } + } + + /** + * Sets the static IAdminCommander. + */ + public static void setAdminCommander(IAdminCommand command) + { + theAdmin = command; + } + + public int compareTo(ICommand p_compareTo_1_) + { + return this.getCommandName().compareTo(p_compareTo_1_.getCommandName()); + } + + public static class CoordinateArg + { + private final double field_179633_a; + private final double field_179631_b; + private final boolean field_179632_c; + + protected CoordinateArg(double p_i46051_1_, double p_i46051_3_, boolean p_i46051_5_) + { + this.field_179633_a = p_i46051_1_; + this.field_179631_b = p_i46051_3_; + this.field_179632_c = p_i46051_5_; + } + + public double func_179628_a() + { + return this.field_179633_a; + } + + public double func_179629_b() + { + return this.field_179631_b; + } + + public boolean func_179630_c() + { + return this.field_179632_c; + } + } +} diff --git a/src/minecraft/net/minecraft/command/CommandBlockData.java b/src/minecraft/net/minecraft/command/CommandBlockData.java new file mode 100644 index 0000000..a98b1ae --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandBlockData.java @@ -0,0 +1,106 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class CommandBlockData extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "blockdata"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.blockdata.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 4) + { + throw new WrongUsageException("commands.blockdata.usage", new Object[0]); + } + else + { + sender.setCommandStat(CommandResultStats.Type.AFFECTED_BLOCKS, 0); + BlockPos blockpos = parseBlockPos(sender, args, 0, false); + World world = sender.getEntityWorld(); + + if (!world.isBlockLoaded(blockpos)) + { + throw new CommandException("commands.blockdata.outOfWorld", new Object[0]); + } + else + { + TileEntity tileentity = world.getTileEntity(blockpos); + + if (tileentity == null) + { + throw new CommandException("commands.blockdata.notValid", new Object[0]); + } + else + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + tileentity.writeToNBT(nbttagcompound); + NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy(); + NBTTagCompound nbttagcompound2; + + try + { + nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 3).getUnformattedText()); + } + catch (NBTException nbtexception) + { + throw new CommandException("commands.blockdata.tagError", new Object[] {nbtexception.getMessage()}); + } + + nbttagcompound.merge(nbttagcompound2); + nbttagcompound.setInteger("x", blockpos.getX()); + nbttagcompound.setInteger("y", blockpos.getY()); + nbttagcompound.setInteger("z", blockpos.getZ()); + + if (nbttagcompound.equals(nbttagcompound1)) + { + throw new CommandException("commands.blockdata.failed", new Object[] {nbttagcompound.toString()}); + } + else + { + tileentity.readFromNBT(nbttagcompound); + tileentity.markDirty(); + world.markBlockForUpdate(blockpos); + sender.setCommandStat(CommandResultStats.Type.AFFECTED_BLOCKS, 1); + notifyOperators(sender, this, "commands.blockdata.success", new Object[] {nbttagcompound.toString()}); + } + } + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length > 0 && args.length <= 3 ? func_175771_a(args, 0, pos) : null; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandClearInventory.java b/src/minecraft/net/minecraft/command/CommandClearInventory.java new file mode 100644 index 0000000..72dfb16 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandClearInventory.java @@ -0,0 +1,113 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; + +public class CommandClearInventory extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "clear"; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.clear.usage"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + EntityPlayerMP entityplayermp = args.length == 0 ? getCommandSenderAsPlayer(sender) : getPlayer(sender, args[0]); + Item item = args.length >= 2 ? getItemByText(sender, args[1]) : null; + int i = args.length >= 3 ? parseInt(args[2], -1) : -1; + int j = args.length >= 4 ? parseInt(args[3], -1) : -1; + NBTTagCompound nbttagcompound = null; + + if (args.length >= 5) + { + try + { + nbttagcompound = JsonToNBT.getTagFromJson(buildString(args, 4)); + } + catch (NBTException nbtexception) + { + throw new CommandException("commands.clear.tagError", new Object[] {nbtexception.getMessage()}); + } + } + + if (args.length >= 2 && item == null) + { + throw new CommandException("commands.clear.failure", new Object[] {entityplayermp.getName()}); + } + else + { + int k = entityplayermp.inventory.clearMatchingItems(item, i, j, nbttagcompound); + entityplayermp.inventoryContainer.detectAndSendChanges(); + + if (!entityplayermp.capabilities.isCreativeMode) + { + entityplayermp.updateHeldItem(); + } + + sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, k); + + if (k == 0) + { + throw new CommandException("commands.clear.failure", new Object[] {entityplayermp.getName()}); + } + else + { + if (j == 0) + { + sender.addChatMessage(new ChatComponentTranslation("commands.clear.testing", new Object[] {entityplayermp.getName(), Integer.valueOf(k)})); + } + else + { + notifyOperators(sender, this, "commands.clear.success", new Object[] {entityplayermp.getName(), Integer.valueOf(k)}); + } + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, this.func_147209_d()) : (args.length == 2 ? getListOfStringsMatchingLastWord(args, Item.itemRegistry.getKeys()) : null); + } + + protected String[] func_147209_d() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandClone.java b/src/minecraft/net/minecraft/command/CommandClone.java new file mode 100644 index 0000000..43fca6e --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandClone.java @@ -0,0 +1,280 @@ +package net.minecraft.command; + +import com.google.common.collect.Lists; +import java.util.LinkedList; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.NextTickListEntry; +import net.minecraft.world.World; +import net.minecraft.world.gen.structure.StructureBoundingBox; + +public class CommandClone extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "clone"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.clone.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 9) + { + throw new WrongUsageException("commands.clone.usage", new Object[0]); + } + else + { + sender.setCommandStat(CommandResultStats.Type.AFFECTED_BLOCKS, 0); + BlockPos blockpos = parseBlockPos(sender, args, 0, false); + BlockPos blockpos1 = parseBlockPos(sender, args, 3, false); + BlockPos blockpos2 = parseBlockPos(sender, args, 6, false); + StructureBoundingBox structureboundingbox = new StructureBoundingBox(blockpos, blockpos1); + StructureBoundingBox structureboundingbox1 = new StructureBoundingBox(blockpos2, blockpos2.add(structureboundingbox.func_175896_b())); + int i = structureboundingbox.getXSize() * structureboundingbox.getYSize() * structureboundingbox.getZSize(); + + if (i > 32768) + { + throw new CommandException("commands.clone.tooManyBlocks", new Object[] {Integer.valueOf(i), Integer.valueOf(32768)}); + } + else + { + boolean flag = false; + Block block = null; + int j = -1; + + if ((args.length < 11 || !args[10].equals("force") && !args[10].equals("move")) && structureboundingbox.intersectsWith(structureboundingbox1)) + { + throw new CommandException("commands.clone.noOverlap", new Object[0]); + } + else + { + if (args.length >= 11 && args[10].equals("move")) + { + flag = true; + } + + if (structureboundingbox.minY >= 0 && structureboundingbox.maxY < 256 && structureboundingbox1.minY >= 0 && structureboundingbox1.maxY < 256) + { + World world = sender.getEntityWorld(); + + if (world.isAreaLoaded(structureboundingbox) && world.isAreaLoaded(structureboundingbox1)) + { + boolean flag1 = false; + + if (args.length >= 10) + { + if (args[9].equals("masked")) + { + flag1 = true; + } + else if (args[9].equals("filtered")) + { + if (args.length < 12) + { + throw new WrongUsageException("commands.clone.usage", new Object[0]); + } + + block = getBlockByText(sender, args[11]); + + if (args.length >= 13) + { + j = parseInt(args[12], 0, 15); + } + } + } + + List list = Lists.newArrayList(); + List list1 = Lists.newArrayList(); + List list2 = Lists.newArrayList(); + LinkedList linkedlist = Lists.newLinkedList(); + BlockPos blockpos3 = new BlockPos(structureboundingbox1.minX - structureboundingbox.minX, structureboundingbox1.minY - structureboundingbox.minY, structureboundingbox1.minZ - structureboundingbox.minZ); + + for (int k = structureboundingbox.minZ; k <= structureboundingbox.maxZ; ++k) + { + for (int l = structureboundingbox.minY; l <= structureboundingbox.maxY; ++l) + { + for (int i1 = structureboundingbox.minX; i1 <= structureboundingbox.maxX; ++i1) + { + BlockPos blockpos4 = new BlockPos(i1, l, k); + BlockPos blockpos5 = blockpos4.add(blockpos3); + IBlockState iblockstate = world.getBlockState(blockpos4); + + if ((!flag1 || iblockstate.getBlock() != Blocks.air) && (block == null || iblockstate.getBlock() == block && (j < 0 || iblockstate.getBlock().getMetaFromState(iblockstate) == j))) + { + TileEntity tileentity = world.getTileEntity(blockpos4); + + if (tileentity != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + tileentity.writeToNBT(nbttagcompound); + list1.add(new CommandClone.StaticCloneData(blockpos5, iblockstate, nbttagcompound)); + linkedlist.addLast(blockpos4); + } + else if (!iblockstate.getBlock().isFullBlock() && !iblockstate.getBlock().isFullCube()) + { + list2.add(new CommandClone.StaticCloneData(blockpos5, iblockstate, (NBTTagCompound)null)); + linkedlist.addFirst(blockpos4); + } + else + { + list.add(new CommandClone.StaticCloneData(blockpos5, iblockstate, (NBTTagCompound)null)); + linkedlist.addLast(blockpos4); + } + } + } + } + } + + if (flag) + { + for (BlockPos blockpos6 : linkedlist) + { + TileEntity tileentity1 = world.getTileEntity(blockpos6); + + if (tileentity1 instanceof IInventory) + { + ((IInventory)tileentity1).clear(); + } + + world.setBlockState(blockpos6, Blocks.barrier.getDefaultState(), 2); + } + + for (BlockPos blockpos7 : linkedlist) + { + world.setBlockState(blockpos7, Blocks.air.getDefaultState(), 3); + } + } + + List list3 = Lists.newArrayList(); + list3.addAll(list); + list3.addAll(list1); + list3.addAll(list2); + List list4 = Lists.reverse(list3); + + for (CommandClone.StaticCloneData commandclone$staticclonedata : list4) + { + TileEntity tileentity2 = world.getTileEntity(commandclone$staticclonedata.field_179537_a); + + if (tileentity2 instanceof IInventory) + { + ((IInventory)tileentity2).clear(); + } + + world.setBlockState(commandclone$staticclonedata.field_179537_a, Blocks.barrier.getDefaultState(), 2); + } + + i = 0; + + for (CommandClone.StaticCloneData commandclone$staticclonedata1 : list3) + { + if (world.setBlockState(commandclone$staticclonedata1.field_179537_a, commandclone$staticclonedata1.blockState, 2)) + { + ++i; + } + } + + for (CommandClone.StaticCloneData commandclone$staticclonedata2 : list1) + { + TileEntity tileentity3 = world.getTileEntity(commandclone$staticclonedata2.field_179537_a); + + if (commandclone$staticclonedata2.field_179536_c != null && tileentity3 != null) + { + commandclone$staticclonedata2.field_179536_c.setInteger("x", commandclone$staticclonedata2.field_179537_a.getX()); + commandclone$staticclonedata2.field_179536_c.setInteger("y", commandclone$staticclonedata2.field_179537_a.getY()); + commandclone$staticclonedata2.field_179536_c.setInteger("z", commandclone$staticclonedata2.field_179537_a.getZ()); + tileentity3.readFromNBT(commandclone$staticclonedata2.field_179536_c); + tileentity3.markDirty(); + } + + world.setBlockState(commandclone$staticclonedata2.field_179537_a, commandclone$staticclonedata2.blockState, 2); + } + + for (CommandClone.StaticCloneData commandclone$staticclonedata3 : list4) + { + world.notifyNeighborsRespectDebug(commandclone$staticclonedata3.field_179537_a, commandclone$staticclonedata3.blockState.getBlock()); + } + + List list5 = world.func_175712_a(structureboundingbox, false); + + if (list5 != null) + { + for (NextTickListEntry nextticklistentry : list5) + { + if (structureboundingbox.isVecInside(nextticklistentry.position)) + { + BlockPos blockpos8 = nextticklistentry.position.add(blockpos3); + world.scheduleBlockUpdate(blockpos8, nextticklistentry.getBlock(), (int)(nextticklistentry.scheduledTime - world.getWorldInfo().getWorldTotalTime()), nextticklistentry.priority); + } + } + } + + if (i <= 0) + { + throw new CommandException("commands.clone.failed", new Object[0]); + } + else + { + sender.setCommandStat(CommandResultStats.Type.AFFECTED_BLOCKS, i); + notifyOperators(sender, this, "commands.clone.success", new Object[] {Integer.valueOf(i)}); + } + } + else + { + throw new CommandException("commands.clone.outOfWorld", new Object[0]); + } + } + else + { + throw new CommandException("commands.clone.outOfWorld", new Object[0]); + } + } + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length > 0 && args.length <= 3 ? func_175771_a(args, 0, pos) : (args.length > 3 && args.length <= 6 ? func_175771_a(args, 3, pos) : (args.length > 6 && args.length <= 9 ? func_175771_a(args, 6, pos) : (args.length == 10 ? getListOfStringsMatchingLastWord(args, new String[] {"replace", "masked", "filtered"}): (args.length == 11 ? getListOfStringsMatchingLastWord(args, new String[] {"normal", "force", "move"}): (args.length == 12 && "filtered".equals(args[9]) ? getListOfStringsMatchingLastWord(args, Block.blockRegistry.getKeys()) : null))))); + } + + static class StaticCloneData + { + public final BlockPos field_179537_a; + public final IBlockState blockState; + public final NBTTagCompound field_179536_c; + + public StaticCloneData(BlockPos p_i46037_1_, IBlockState p_i46037_2_, NBTTagCompound p_i46037_3_) + { + this.field_179537_a = p_i46037_1_; + this.blockState = p_i46037_2_; + this.field_179536_c = p_i46037_3_; + } + } +} diff --git a/src/minecraft/net/minecraft/command/CommandCompare.java b/src/minecraft/net/minecraft/command/CommandCompare.java new file mode 100644 index 0000000..46ee9f4 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandCompare.java @@ -0,0 +1,155 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.gen.structure.StructureBoundingBox; + +public class CommandCompare extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "testforblocks"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.compare.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 9) + { + throw new WrongUsageException("commands.compare.usage", new Object[0]); + } + else + { + sender.setCommandStat(CommandResultStats.Type.AFFECTED_BLOCKS, 0); + BlockPos blockpos = parseBlockPos(sender, args, 0, false); + BlockPos blockpos1 = parseBlockPos(sender, args, 3, false); + BlockPos blockpos2 = parseBlockPos(sender, args, 6, false); + StructureBoundingBox structureboundingbox = new StructureBoundingBox(blockpos, blockpos1); + StructureBoundingBox structureboundingbox1 = new StructureBoundingBox(blockpos2, blockpos2.add(structureboundingbox.func_175896_b())); + int i = structureboundingbox.getXSize() * structureboundingbox.getYSize() * structureboundingbox.getZSize(); + + if (i > 524288) + { + throw new CommandException("commands.compare.tooManyBlocks", new Object[] {Integer.valueOf(i), Integer.valueOf(524288)}); + } + else if (structureboundingbox.minY >= 0 && structureboundingbox.maxY < 256 && structureboundingbox1.minY >= 0 && structureboundingbox1.maxY < 256) + { + World world = sender.getEntityWorld(); + + if (world.isAreaLoaded(structureboundingbox) && world.isAreaLoaded(structureboundingbox1)) + { + boolean flag = false; + + if (args.length > 9 && args[9].equals("masked")) + { + flag = true; + } + + i = 0; + BlockPos blockpos3 = new BlockPos(structureboundingbox1.minX - structureboundingbox.minX, structureboundingbox1.minY - structureboundingbox.minY, structureboundingbox1.minZ - structureboundingbox.minZ); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + BlockPos.MutableBlockPos blockpos$mutableblockpos1 = new BlockPos.MutableBlockPos(); + + for (int j = structureboundingbox.minZ; j <= structureboundingbox.maxZ; ++j) + { + for (int k = structureboundingbox.minY; k <= structureboundingbox.maxY; ++k) + { + for (int l = structureboundingbox.minX; l <= structureboundingbox.maxX; ++l) + { + blockpos$mutableblockpos.func_181079_c(l, k, j); + blockpos$mutableblockpos1.func_181079_c(l + blockpos3.getX(), k + blockpos3.getY(), j + blockpos3.getZ()); + boolean flag1 = false; + IBlockState iblockstate = world.getBlockState(blockpos$mutableblockpos); + + if (!flag || iblockstate.getBlock() != Blocks.air) + { + if (iblockstate == world.getBlockState(blockpos$mutableblockpos1)) + { + TileEntity tileentity = world.getTileEntity(blockpos$mutableblockpos); + TileEntity tileentity1 = world.getTileEntity(blockpos$mutableblockpos1); + + if (tileentity != null && tileentity1 != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + tileentity.writeToNBT(nbttagcompound); + nbttagcompound.removeTag("x"); + nbttagcompound.removeTag("y"); + nbttagcompound.removeTag("z"); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + tileentity1.writeToNBT(nbttagcompound1); + nbttagcompound1.removeTag("x"); + nbttagcompound1.removeTag("y"); + nbttagcompound1.removeTag("z"); + + if (!nbttagcompound.equals(nbttagcompound1)) + { + flag1 = true; + } + } + else if (tileentity != null) + { + flag1 = true; + } + } + else + { + flag1 = true; + } + + ++i; + + if (flag1) + { + throw new CommandException("commands.compare.failed", new Object[0]); + } + } + } + } + } + + sender.setCommandStat(CommandResultStats.Type.AFFECTED_BLOCKS, i); + notifyOperators(sender, this, "commands.compare.success", new Object[] {Integer.valueOf(i)}); + } + else + { + throw new CommandException("commands.compare.outOfWorld", new Object[0]); + } + } + else + { + throw new CommandException("commands.compare.outOfWorld", new Object[0]); + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length > 0 && args.length <= 3 ? func_175771_a(args, 0, pos) : (args.length > 3 && args.length <= 6 ? func_175771_a(args, 3, pos) : (args.length > 6 && args.length <= 9 ? func_175771_a(args, 6, pos) : (args.length == 10 ? getListOfStringsMatchingLastWord(args, new String[] {"masked", "all"}): null))); + } +} diff --git a/src/minecraft/net/minecraft/command/CommandDebug.java b/src/minecraft/net/minecraft/command/CommandDebug.java new file mode 100644 index 0000000..0cd6299 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandDebug.java @@ -0,0 +1,179 @@ +package net.minecraft.command; + +import java.io.File; +import java.io.FileWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import net.minecraft.profiler.Profiler; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class CommandDebug extends CommandBase +{ + private static final Logger logger = LogManager.getLogger(); + private long field_147206_b; + private int field_147207_c; + + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "debug"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.debug.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 1) + { + throw new WrongUsageException("commands.debug.usage", new Object[0]); + } + else + { + if (args[0].equals("start")) + { + if (args.length != 1) + { + throw new WrongUsageException("commands.debug.usage", new Object[0]); + } + + notifyOperators(sender, this, "commands.debug.start", new Object[0]); + MinecraftServer.getServer().enableProfiling(); + this.field_147206_b = MinecraftServer.getCurrentTimeMillis(); + this.field_147207_c = MinecraftServer.getServer().getTickCounter(); + } + else + { + if (!args[0].equals("stop")) + { + throw new WrongUsageException("commands.debug.usage", new Object[0]); + } + + if (args.length != 1) + { + throw new WrongUsageException("commands.debug.usage", new Object[0]); + } + + if (!MinecraftServer.getServer().theProfiler.profilingEnabled) + { + throw new CommandException("commands.debug.notStarted", new Object[0]); + } + + long i = MinecraftServer.getCurrentTimeMillis(); + int j = MinecraftServer.getServer().getTickCounter(); + long k = i - this.field_147206_b; + int l = j - this.field_147207_c; + this.func_147205_a(k, l); + MinecraftServer.getServer().theProfiler.profilingEnabled = false; + notifyOperators(sender, this, "commands.debug.stop", new Object[] {Float.valueOf((float)k / 1000.0F), Integer.valueOf(l)}); + } + } + } + + private void func_147205_a(long p_147205_1_, int p_147205_3_) + { + File file1 = new File(MinecraftServer.getServer().getFile("debug"), "profile-results-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + ".txt"); + file1.getParentFile().mkdirs(); + + try + { + FileWriter filewriter = new FileWriter(file1); + filewriter.write(this.func_147204_b(p_147205_1_, p_147205_3_)); + filewriter.close(); + } + catch (Throwable throwable) + { + logger.error("Could not save profiler results to " + file1, throwable); + } + } + + private String func_147204_b(long p_147204_1_, int p_147204_3_) + { + StringBuilder stringbuilder = new StringBuilder(); + stringbuilder.append("---- Minecraft Profiler Results ----\n"); + stringbuilder.append("// "); + stringbuilder.append(func_147203_d()); + stringbuilder.append("\n\n"); + stringbuilder.append("Time span: ").append(p_147204_1_).append(" ms\n"); + stringbuilder.append("Tick span: ").append(p_147204_3_).append(" ticks\n"); + stringbuilder.append("// This is approximately ").append(String.format("%.2f", new Object[] {Float.valueOf((float)p_147204_3_ / ((float)p_147204_1_ / 1000.0F))})).append(" ticks per second. It should be ").append((int)20).append(" ticks per second\n\n"); + stringbuilder.append("--- BEGIN PROFILE DUMP ---\n\n"); + this.func_147202_a(0, "root", stringbuilder); + stringbuilder.append("--- END PROFILE DUMP ---\n\n"); + return stringbuilder.toString(); + } + + private void func_147202_a(int p_147202_1_, String p_147202_2_, StringBuilder p_147202_3_) + { + List list = MinecraftServer.getServer().theProfiler.getProfilingData(p_147202_2_); + + if (list != null && list.size() >= 3) + { + for (int i = 1; i < list.size(); ++i) + { + Profiler.Result profiler$result = (Profiler.Result)list.get(i); + p_147202_3_.append(String.format("[%02d] ", new Object[] {Integer.valueOf(p_147202_1_)})); + + for (int j = 0; j < p_147202_1_; ++j) + { + p_147202_3_.append(" "); + } + + p_147202_3_.append(profiler$result.field_76331_c).append(" - ").append(String.format("%.2f", new Object[] {Double.valueOf(profiler$result.field_76332_a)})).append("%/").append(String.format("%.2f", new Object[] {Double.valueOf(profiler$result.field_76330_b)})).append("%\n"); + + if (!profiler$result.field_76331_c.equals("unspecified")) + { + try + { + this.func_147202_a(p_147202_1_ + 1, p_147202_2_ + "." + profiler$result.field_76331_c, p_147202_3_); + } + catch (Exception exception) + { + p_147202_3_.append("[[ EXCEPTION ").append((Object)exception).append(" ]]"); + } + } + } + } + } + + private static String func_147203_d() + { + String[] astring = new String[] {"Shiny numbers!", "Am I not running fast enough? :(", "I\'m working as hard as I can!", "Will I ever be good enough for you? :(", "Speedy. Zoooooom!", "Hello world", "40% better than a crash report.", "Now with extra numbers", "Now with less numbers", "Now with the same numbers", "You should add flames to things, it makes them go faster!", "Do you feel the need for... optimization?", "*cracks redstone whip*", "Maybe if you treated it better then it\'ll have more motivation to work faster! Poor server."}; + + try + { + return astring[(int)(System.nanoTime() % (long)astring.length)]; + } + catch (Throwable var2) + { + return "Witty comment unavailable :("; + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, new String[] {"start", "stop"}): null; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandDefaultGameMode.java b/src/minecraft/net/minecraft/command/CommandDefaultGameMode.java new file mode 100644 index 0000000..078a7fb --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandDefaultGameMode.java @@ -0,0 +1,57 @@ +package net.minecraft.command; + +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.world.WorldSettings; + +public class CommandDefaultGameMode extends CommandGameMode +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "defaultgamemode"; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.defaultgamemode.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length <= 0) + { + throw new WrongUsageException("commands.defaultgamemode.usage", new Object[0]); + } + else + { + WorldSettings.GameType worldsettings$gametype = this.getGameModeFromCommand(sender, args[0]); + this.setGameType(worldsettings$gametype); + notifyOperators(sender, this, "commands.defaultgamemode.success", new Object[] {new ChatComponentTranslation("gameMode." + worldsettings$gametype.getName(), new Object[0])}); + } + } + + protected void setGameType(WorldSettings.GameType p_71541_1_) + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + minecraftserver.setGameType(p_71541_1_); + + if (minecraftserver.getForceGamemode()) + { + for (EntityPlayerMP entityplayermp : MinecraftServer.getServer().getConfigurationManager().func_181057_v()) + { + entityplayermp.setGameType(p_71541_1_); + entityplayermp.fallDistance = 0.0F; + } + } + } +} diff --git a/src/minecraft/net/minecraft/command/CommandDifficulty.java b/src/minecraft/net/minecraft/command/CommandDifficulty.java new file mode 100644 index 0000000..5315ed3 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandDifficulty.java @@ -0,0 +1,61 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.world.EnumDifficulty; + +public class CommandDifficulty extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "difficulty"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.difficulty.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length <= 0) + { + throw new WrongUsageException("commands.difficulty.usage", new Object[0]); + } + else + { + EnumDifficulty enumdifficulty = this.getDifficultyFromCommand(args[0]); + MinecraftServer.getServer().setDifficultyForAllWorlds(enumdifficulty); + notifyOperators(sender, this, "commands.difficulty.success", new Object[] {new ChatComponentTranslation(enumdifficulty.getDifficultyResourceKey(), new Object[0])}); + } + } + + protected EnumDifficulty getDifficultyFromCommand(String p_180531_1_) throws CommandException, NumberInvalidException + { + return !p_180531_1_.equalsIgnoreCase("peaceful") && !p_180531_1_.equalsIgnoreCase("p") ? (!p_180531_1_.equalsIgnoreCase("easy") && !p_180531_1_.equalsIgnoreCase("e") ? (!p_180531_1_.equalsIgnoreCase("normal") && !p_180531_1_.equalsIgnoreCase("n") ? (!p_180531_1_.equalsIgnoreCase("hard") && !p_180531_1_.equalsIgnoreCase("h") ? EnumDifficulty.getDifficultyEnum(parseInt(p_180531_1_, 0, 3)) : EnumDifficulty.HARD) : EnumDifficulty.NORMAL) : EnumDifficulty.EASY) : EnumDifficulty.PEACEFUL; + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, new String[] {"peaceful", "easy", "normal", "hard"}): null; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandEffect.java b/src/minecraft/net/minecraft/command/CommandEffect.java new file mode 100644 index 0000000..db67b11 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandEffect.java @@ -0,0 +1,161 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; + +public class CommandEffect extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "effect"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.effect.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 2) + { + throw new WrongUsageException("commands.effect.usage", new Object[0]); + } + else + { + EntityLivingBase entitylivingbase = (EntityLivingBase)getEntity(sender, args[0], EntityLivingBase.class); + + if (args[1].equals("clear")) + { + if (entitylivingbase.getActivePotionEffects().isEmpty()) + { + throw new CommandException("commands.effect.failure.notActive.all", new Object[] {entitylivingbase.getName()}); + } + else + { + entitylivingbase.clearActivePotions(); + notifyOperators(sender, this, "commands.effect.success.removed.all", new Object[] {entitylivingbase.getName()}); + } + } + else + { + int i; + + try + { + i = parseInt(args[1], 1); + } + catch (NumberInvalidException numberinvalidexception) + { + Potion potion = Potion.getPotionFromResourceLocation(args[1]); + + if (potion == null) + { + throw numberinvalidexception; + } + + i = potion.id; + } + + int j = 600; + int l = 30; + int k = 0; + + if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null) + { + Potion potion1 = Potion.potionTypes[i]; + + if (args.length >= 3) + { + l = parseInt(args[2], 0, 1000000); + + if (potion1.isInstant()) + { + j = l; + } + else + { + j = l * 20; + } + } + else if (potion1.isInstant()) + { + j = 1; + } + + if (args.length >= 4) + { + k = parseInt(args[3], 0, 255); + } + + boolean flag = true; + + if (args.length >= 5 && "true".equalsIgnoreCase(args[4])) + { + flag = false; + } + + if (l > 0) + { + PotionEffect potioneffect = new PotionEffect(i, j, k, false, flag); + entitylivingbase.addPotionEffect(potioneffect); + notifyOperators(sender, this, "commands.effect.success", new Object[] {new ChatComponentTranslation(potioneffect.getEffectName(), new Object[0]), Integer.valueOf(i), Integer.valueOf(k), entitylivingbase.getName(), Integer.valueOf(l)}); + } + else if (entitylivingbase.isPotionActive(i)) + { + entitylivingbase.removePotionEffect(i); + notifyOperators(sender, this, "commands.effect.success.removed", new Object[] {new ChatComponentTranslation(potion1.getName(), new Object[0]), entitylivingbase.getName()}); + } + else + { + throw new CommandException("commands.effect.failure.notActive", new Object[] {new ChatComponentTranslation(potion1.getName(), new Object[0]), entitylivingbase.getName()}); + } + } + else + { + throw new NumberInvalidException("commands.effect.notFound", new Object[] {Integer.valueOf(i)}); + } + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, this.getAllUsernames()) : (args.length == 2 ? getListOfStringsMatchingLastWord(args, Potion.func_181168_c()) : (args.length == 5 ? getListOfStringsMatchingLastWord(args, new String[] {"true", "false"}): null)); + } + + protected String[] getAllUsernames() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandEnchant.java b/src/minecraft/net/minecraft/command/CommandEnchant.java new file mode 100644 index 0000000..3c8b427 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandEnchant.java @@ -0,0 +1,142 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandEnchant extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "enchant"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.enchant.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 2) + { + throw new WrongUsageException("commands.enchant.usage", new Object[0]); + } + else + { + EntityPlayer entityplayer = getPlayer(sender, args[0]); + sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, 0); + int i; + + try + { + i = parseInt(args[1], 0); + } + catch (NumberInvalidException numberinvalidexception) + { + Enchantment enchantment = Enchantment.getEnchantmentByLocation(args[1]); + + if (enchantment == null) + { + throw numberinvalidexception; + } + + i = enchantment.effectId; + } + + int j = 1; + ItemStack itemstack = entityplayer.getCurrentEquippedItem(); + + if (itemstack == null) + { + throw new CommandException("commands.enchant.noItem", new Object[0]); + } + else + { + Enchantment enchantment1 = Enchantment.getEnchantmentById(i); + + if (enchantment1 == null) + { + throw new NumberInvalidException("commands.enchant.notFound", new Object[] {Integer.valueOf(i)}); + } + else if (!enchantment1.canApply(itemstack)) + { + throw new CommandException("commands.enchant.cantEnchant", new Object[0]); + } + else + { + if (args.length >= 3) + { + j = parseInt(args[2], enchantment1.getMinLevel(), enchantment1.getMaxLevel()); + } + + if (itemstack.hasTagCompound()) + { + NBTTagList nbttaglist = itemstack.getEnchantmentTagList(); + + if (nbttaglist != null) + { + for (int k = 0; k < nbttaglist.tagCount(); ++k) + { + int l = nbttaglist.getCompoundTagAt(k).getShort("id"); + + if (Enchantment.getEnchantmentById(l) != null) + { + Enchantment enchantment2 = Enchantment.getEnchantmentById(l); + + if (!enchantment2.canApplyTogether(enchantment1)) + { + throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment1.getTranslatedName(j), enchantment2.getTranslatedName(nbttaglist.getCompoundTagAt(k).getShort("lvl"))}); + } + } + } + } + } + + itemstack.addEnchantment(enchantment1, j); + notifyOperators(sender, this, "commands.enchant.success", new Object[0]); + sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, 1); + } + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, this.getListOfPlayers()) : (args.length == 2 ? getListOfStringsMatchingLastWord(args, Enchantment.func_181077_c()) : null); + } + + protected String[] getListOfPlayers() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandEntityData.java b/src/minecraft/net/minecraft/command/CommandEntityData.java new file mode 100644 index 0000000..47376d6 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandEntityData.java @@ -0,0 +1,92 @@ +package net.minecraft.command; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraft.nbt.NBTTagCompound; + +public class CommandEntityData extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "entitydata"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.entitydata.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 2) + { + throw new WrongUsageException("commands.entitydata.usage", new Object[0]); + } + else + { + Entity entity = func_175768_b(sender, args[0]); + + if (entity instanceof EntityPlayer) + { + throw new CommandException("commands.entitydata.noPlayers", new Object[] {entity.getDisplayName()}); + } + else + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + entity.writeToNBT(nbttagcompound); + NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy(); + NBTTagCompound nbttagcompound2; + + try + { + nbttagcompound2 = JsonToNBT.getTagFromJson(getChatComponentFromNthArg(sender, args, 1).getUnformattedText()); + } + catch (NBTException nbtexception) + { + throw new CommandException("commands.entitydata.tagError", new Object[] {nbtexception.getMessage()}); + } + + nbttagcompound2.removeTag("UUIDMost"); + nbttagcompound2.removeTag("UUIDLeast"); + nbttagcompound.merge(nbttagcompound2); + + if (nbttagcompound.equals(nbttagcompound1)) + { + throw new CommandException("commands.entitydata.failed", new Object[] {nbttagcompound.toString()}); + } + else + { + entity.readFromNBT(nbttagcompound); + notifyOperators(sender, this, "commands.entitydata.success", new Object[] {nbttagcompound.toString()}); + } + } + } + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandException.java b/src/minecraft/net/minecraft/command/CommandException.java new file mode 100644 index 0000000..90a482f --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandException.java @@ -0,0 +1,17 @@ +package net.minecraft.command; + +public class CommandException extends Exception +{ + private final Object[] errorObjects; + + public CommandException(String message, Object... objects) + { + super(message); + this.errorObjects = objects; + } + + public Object[] getErrorObjects() + { + return this.errorObjects; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandExecuteAt.java b/src/minecraft/net/minecraft/command/CommandExecuteAt.java new file mode 100644 index 0000000..514a140 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandExecuteAt.java @@ -0,0 +1,151 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class CommandExecuteAt extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "execute"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.execute.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(final ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 5) + { + throw new WrongUsageException("commands.execute.usage", new Object[0]); + } + else + { + final Entity entity = getEntity(sender, args[0], Entity.class); + final double d0 = parseDouble(entity.posX, args[1], false); + final double d1 = parseDouble(entity.posY, args[2], false); + final double d2 = parseDouble(entity.posZ, args[3], false); + final BlockPos blockpos = new BlockPos(d0, d1, d2); + int i = 4; + + if ("detect".equals(args[4]) && args.length > 10) + { + World world = entity.getEntityWorld(); + double d3 = parseDouble(d0, args[5], false); + double d4 = parseDouble(d1, args[6], false); + double d5 = parseDouble(d2, args[7], false); + Block block = getBlockByText(sender, args[8]); + int k = parseInt(args[9], -1, 15); + BlockPos blockpos1 = new BlockPos(d3, d4, d5); + IBlockState iblockstate = world.getBlockState(blockpos1); + + if (iblockstate.getBlock() != block || k >= 0 && iblockstate.getBlock().getMetaFromState(iblockstate) != k) + { + throw new CommandException("commands.execute.failed", new Object[] {"detect", entity.getName()}); + } + + i = 10; + } + + String s = buildString(args, i); + ICommandSender icommandsender = new ICommandSender() + { + public String getName() + { + return entity.getName(); + } + public IChatComponent getDisplayName() + { + return entity.getDisplayName(); + } + public void addChatMessage(IChatComponent component) + { + sender.addChatMessage(component); + } + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { + return sender.canCommandSenderUseCommand(permLevel, commandName); + } + public BlockPos getPosition() + { + return blockpos; + } + public Vec3 getPositionVector() + { + return new Vec3(d0, d1, d2); + } + public World getEntityWorld() + { + return entity.worldObj; + } + public Entity getCommandSenderEntity() + { + return entity; + } + public boolean sendCommandFeedback() + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + return minecraftserver == null || minecraftserver.worldServers[0].getGameRules().getBoolean("commandBlockOutput"); + } + public void setCommandStat(CommandResultStats.Type type, int amount) + { + entity.setCommandStat(type, amount); + } + }; + ICommandManager icommandmanager = MinecraftServer.getServer().getCommandManager(); + + try + { + int j = icommandmanager.executeCommand(icommandsender, s); + + if (j < 1) + { + throw new CommandException("commands.execute.allInvocationsFailed", new Object[] {s}); + } + } + catch (Throwable var23) + { + throw new CommandException("commands.execute.failed", new Object[] {s, entity.getName()}); + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : (args.length > 1 && args.length <= 4 ? func_175771_a(args, 1, pos) : (args.length > 5 && args.length <= 8 && "detect".equals(args[4]) ? func_175771_a(args, 5, pos) : (args.length == 9 && "detect".equals(args[4]) ? getListOfStringsMatchingLastWord(args, Block.blockRegistry.getKeys()) : null))); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandFill.java b/src/minecraft/net/minecraft/command/CommandFill.java new file mode 100644 index 0000000..b4fb79a --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandFill.java @@ -0,0 +1,230 @@ +package net.minecraft.command; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class CommandFill extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "fill"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.fill.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 7) + { + throw new WrongUsageException("commands.fill.usage", new Object[0]); + } + else + { + sender.setCommandStat(CommandResultStats.Type.AFFECTED_BLOCKS, 0); + BlockPos blockpos = parseBlockPos(sender, args, 0, false); + BlockPos blockpos1 = parseBlockPos(sender, args, 3, false); + Block block = CommandBase.getBlockByText(sender, args[6]); + int i = 0; + + if (args.length >= 8) + { + i = parseInt(args[7], 0, 15); + } + + BlockPos blockpos2 = new BlockPos(Math.min(blockpos.getX(), blockpos1.getX()), Math.min(blockpos.getY(), blockpos1.getY()), Math.min(blockpos.getZ(), blockpos1.getZ())); + BlockPos blockpos3 = new BlockPos(Math.max(blockpos.getX(), blockpos1.getX()), Math.max(blockpos.getY(), blockpos1.getY()), Math.max(blockpos.getZ(), blockpos1.getZ())); + int j = (blockpos3.getX() - blockpos2.getX() + 1) * (blockpos3.getY() - blockpos2.getY() + 1) * (blockpos3.getZ() - blockpos2.getZ() + 1); + + if (j > 32768) + { + throw new CommandException("commands.fill.tooManyBlocks", new Object[] {Integer.valueOf(j), Integer.valueOf(32768)}); + } + else if (blockpos2.getY() >= 0 && blockpos3.getY() < 256) + { + World world = sender.getEntityWorld(); + + for (int k = blockpos2.getZ(); k < blockpos3.getZ() + 16; k += 16) + { + for (int l = blockpos2.getX(); l < blockpos3.getX() + 16; l += 16) + { + if (!world.isBlockLoaded(new BlockPos(l, blockpos3.getY() - blockpos2.getY(), k))) + { + throw new CommandException("commands.fill.outOfWorld", new Object[0]); + } + } + } + + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + + if (args.length >= 10 && block.hasTileEntity()) + { + String s = getChatComponentFromNthArg(sender, args, 9).getUnformattedText(); + + try + { + nbttagcompound = JsonToNBT.getTagFromJson(s); + flag = true; + } + catch (NBTException nbtexception) + { + throw new CommandException("commands.fill.tagError", new Object[] {nbtexception.getMessage()}); + } + } + + List list = Lists.newArrayList(); + j = 0; + + for (int i1 = blockpos2.getZ(); i1 <= blockpos3.getZ(); ++i1) + { + for (int j1 = blockpos2.getY(); j1 <= blockpos3.getY(); ++j1) + { + for (int k1 = blockpos2.getX(); k1 <= blockpos3.getX(); ++k1) + { + BlockPos blockpos4 = new BlockPos(k1, j1, i1); + + if (args.length >= 9) + { + if (!args[8].equals("outline") && !args[8].equals("hollow")) + { + if (args[8].equals("destroy")) + { + world.destroyBlock(blockpos4, true); + } + else if (args[8].equals("keep")) + { + if (!world.isAirBlock(blockpos4)) + { + continue; + } + } + else if (args[8].equals("replace") && !block.hasTileEntity()) + { + if (args.length > 9) + { + Block block1 = CommandBase.getBlockByText(sender, args[9]); + + if (world.getBlockState(blockpos4).getBlock() != block1) + { + continue; + } + } + + if (args.length > 10) + { + int l1 = CommandBase.parseInt(args[10]); + IBlockState iblockstate = world.getBlockState(blockpos4); + + if (iblockstate.getBlock().getMetaFromState(iblockstate) != l1) + { + continue; + } + } + } + } + else if (k1 != blockpos2.getX() && k1 != blockpos3.getX() && j1 != blockpos2.getY() && j1 != blockpos3.getY() && i1 != blockpos2.getZ() && i1 != blockpos3.getZ()) + { + if (args[8].equals("hollow")) + { + world.setBlockState(blockpos4, Blocks.air.getDefaultState(), 2); + list.add(blockpos4); + } + + continue; + } + } + + TileEntity tileentity1 = world.getTileEntity(blockpos4); + + if (tileentity1 != null) + { + if (tileentity1 instanceof IInventory) + { + ((IInventory)tileentity1).clear(); + } + + world.setBlockState(blockpos4, Blocks.barrier.getDefaultState(), block == Blocks.barrier ? 2 : 4); + } + + IBlockState iblockstate1 = block.getStateFromMeta(i); + + if (world.setBlockState(blockpos4, iblockstate1, 2)) + { + list.add(blockpos4); + ++j; + + if (flag) + { + TileEntity tileentity = world.getTileEntity(blockpos4); + + if (tileentity != null) + { + nbttagcompound.setInteger("x", blockpos4.getX()); + nbttagcompound.setInteger("y", blockpos4.getY()); + nbttagcompound.setInteger("z", blockpos4.getZ()); + tileentity.readFromNBT(nbttagcompound); + } + } + } + } + } + } + + for (BlockPos blockpos5 : list) + { + Block block2 = world.getBlockState(blockpos5).getBlock(); + world.notifyNeighborsRespectDebug(blockpos5, block2); + } + + if (j <= 0) + { + throw new CommandException("commands.fill.failed", new Object[0]); + } + else + { + sender.setCommandStat(CommandResultStats.Type.AFFECTED_BLOCKS, j); + notifyOperators(sender, this, "commands.fill.success", new Object[] {Integer.valueOf(j)}); + } + } + else + { + throw new CommandException("commands.fill.outOfWorld", new Object[0]); + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length > 0 && args.length <= 3 ? func_175771_a(args, 0, pos) : (args.length > 3 && args.length <= 6 ? func_175771_a(args, 3, pos) : (args.length == 7 ? getListOfStringsMatchingLastWord(args, Block.blockRegistry.getKeys()) : (args.length == 9 ? getListOfStringsMatchingLastWord(args, new String[] {"replace", "destroy", "keep", "hollow", "outline"}): (args.length == 10 && "replace".equals(args[8]) ? getListOfStringsMatchingLastWord(args, Block.blockRegistry.getKeys()) : null)))); + } +} diff --git a/src/minecraft/net/minecraft/command/CommandGameMode.java b/src/minecraft/net/minecraft/command/CommandGameMode.java new file mode 100644 index 0000000..8dffd8c --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandGameMode.java @@ -0,0 +1,99 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.WorldSettings; + +public class CommandGameMode extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "gamemode"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.gamemode.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length <= 0) + { + throw new WrongUsageException("commands.gamemode.usage", new Object[0]); + } + else + { + WorldSettings.GameType worldsettings$gametype = this.getGameModeFromCommand(sender, args[0]); + EntityPlayer entityplayer = args.length >= 2 ? getPlayer(sender, args[1]) : getCommandSenderAsPlayer(sender); + entityplayer.setGameType(worldsettings$gametype); + entityplayer.fallDistance = 0.0F; + + if (sender.getEntityWorld().getGameRules().getBoolean("sendCommandFeedback")) + { + entityplayer.addChatMessage(new ChatComponentTranslation("gameMode.changed", new Object[0])); + } + + IChatComponent ichatcomponent = new ChatComponentTranslation("gameMode." + worldsettings$gametype.getName(), new Object[0]); + + if (entityplayer != sender) + { + notifyOperators(sender, this, 1, "commands.gamemode.success.other", new Object[] {entityplayer.getName(), ichatcomponent}); + } + else + { + notifyOperators(sender, this, 1, "commands.gamemode.success.self", new Object[] {ichatcomponent}); + } + } + } + + /** + * Gets the Game Mode specified in the command. + */ + protected WorldSettings.GameType getGameModeFromCommand(ICommandSender p_71539_1_, String p_71539_2_) throws CommandException, NumberInvalidException + { + return !p_71539_2_.equalsIgnoreCase(WorldSettings.GameType.SURVIVAL.getName()) && !p_71539_2_.equalsIgnoreCase("s") ? (!p_71539_2_.equalsIgnoreCase(WorldSettings.GameType.CREATIVE.getName()) && !p_71539_2_.equalsIgnoreCase("c") ? (!p_71539_2_.equalsIgnoreCase(WorldSettings.GameType.ADVENTURE.getName()) && !p_71539_2_.equalsIgnoreCase("a") ? (!p_71539_2_.equalsIgnoreCase(WorldSettings.GameType.SPECTATOR.getName()) && !p_71539_2_.equalsIgnoreCase("sp") ? WorldSettings.getGameTypeById(parseInt(p_71539_2_, 0, WorldSettings.GameType.values().length - 2)) : WorldSettings.GameType.SPECTATOR) : WorldSettings.GameType.ADVENTURE) : WorldSettings.GameType.CREATIVE) : WorldSettings.GameType.SURVIVAL; + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, new String[] {"survival", "creative", "adventure", "spectator"}): (args.length == 2 ? getListOfStringsMatchingLastWord(args, this.getListOfPlayerUsernames()) : null); + } + + /** + * Returns String array containing all player usernames in the server. + */ + protected String[] getListOfPlayerUsernames() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 1; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandGameRule.java b/src/minecraft/net/minecraft/command/CommandGameRule.java new file mode 100644 index 0000000..5915dc4 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandGameRule.java @@ -0,0 +1,117 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.play.server.S19PacketEntityStatus; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.GameRules; + +public class CommandGameRule extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "gamerule"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.gamerule.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + GameRules gamerules = this.getGameRules(); + String s = args.length > 0 ? args[0] : ""; + String s1 = args.length > 1 ? buildString(args, 1) : ""; + + switch (args.length) + { + case 0: + sender.addChatMessage(new ChatComponentText(joinNiceString(gamerules.getRules()))); + break; + + case 1: + if (!gamerules.hasRule(s)) + { + throw new CommandException("commands.gamerule.norule", new Object[] {s}); + } + + String s2 = gamerules.getString(s); + sender.addChatMessage((new ChatComponentText(s)).appendText(" = ").appendText(s2)); + sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, gamerules.getInt(s)); + break; + + default: + if (gamerules.areSameType(s, GameRules.ValueType.BOOLEAN_VALUE) && !"true".equals(s1) && !"false".equals(s1)) + { + throw new CommandException("commands.generic.boolean.invalid", new Object[] {s1}); + } + + gamerules.setOrCreateGameRule(s, s1); + func_175773_a(gamerules, s); + notifyOperators(sender, this, "commands.gamerule.success", new Object[0]); + } + } + + public static void func_175773_a(GameRules p_175773_0_, String p_175773_1_) + { + if ("reducedDebugInfo".equals(p_175773_1_)) + { + byte b0 = (byte)(p_175773_0_.getBoolean(p_175773_1_) ? 22 : 23); + + for (EntityPlayerMP entityplayermp : MinecraftServer.getServer().getConfigurationManager().func_181057_v()) + { + entityplayermp.playerNetServerHandler.sendPacket(new S19PacketEntityStatus(entityplayermp, b0)); + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + if (args.length == 1) + { + return getListOfStringsMatchingLastWord(args, this.getGameRules().getRules()); + } + else + { + if (args.length == 2) + { + GameRules gamerules = this.getGameRules(); + + if (gamerules.areSameType(args[0], GameRules.ValueType.BOOLEAN_VALUE)) + { + return getListOfStringsMatchingLastWord(args, new String[] {"true", "false"}); + } + } + + return null; + } + } + + /** + * Return the game rule set this command should be able to manipulate. + */ + private GameRules getGameRules() + { + return MinecraftServer.getServer().worldServerForDimension(0).getGameRules(); + } +} diff --git a/src/minecraft/net/minecraft/command/CommandGive.java b/src/minecraft/net/minecraft/command/CommandGive.java new file mode 100644 index 0000000..60b6fe7 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandGive.java @@ -0,0 +1,122 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandGive extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "give"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.give.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 2) + { + throw new WrongUsageException("commands.give.usage", new Object[0]); + } + else + { + EntityPlayer entityplayer = getPlayer(sender, args[0]); + Item item = getItemByText(sender, args[1]); + int i = args.length >= 3 ? parseInt(args[2], 1, 64) : 1; + int j = args.length >= 4 ? parseInt(args[3]) : 0; + ItemStack itemstack = new ItemStack(item, i, j); + + if (args.length >= 5) + { + String s = getChatComponentFromNthArg(sender, args, 4).getUnformattedText(); + + try + { + itemstack.setTagCompound(JsonToNBT.getTagFromJson(s)); + } + catch (NBTException nbtexception) + { + throw new CommandException("commands.give.tagError", new Object[] {nbtexception.getMessage()}); + } + } + + boolean flag = entityplayer.inventory.addItemStackToInventory(itemstack); + + if (flag) + { + entityplayer.worldObj.playSoundAtEntity(entityplayer, "random.pop", 0.2F, ((entityplayer.getRNG().nextFloat() - entityplayer.getRNG().nextFloat()) * 0.7F + 1.0F) * 2.0F); + entityplayer.inventoryContainer.detectAndSendChanges(); + } + + if (flag && itemstack.stackSize <= 0) + { + itemstack.stackSize = 1; + sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, i); + EntityItem entityitem1 = entityplayer.dropPlayerItemWithRandomChoice(itemstack, false); + + if (entityitem1 != null) + { + entityitem1.func_174870_v(); + } + } + else + { + sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, i - itemstack.stackSize); + EntityItem entityitem = entityplayer.dropPlayerItemWithRandomChoice(itemstack, false); + + if (entityitem != null) + { + entityitem.setNoPickupDelay(); + entityitem.setOwner(entityplayer.getName()); + } + } + + notifyOperators(sender, this, "commands.give.success", new Object[] {itemstack.getChatComponent(), Integer.valueOf(i), entityplayer.getName()}); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, this.getPlayers()) : (args.length == 2 ? getListOfStringsMatchingLastWord(args, Item.itemRegistry.getKeys()) : null); + } + + protected String[] getPlayers() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandHandler.java b/src/minecraft/net/minecraft/command/CommandHandler.java new file mode 100644 index 0000000..c7f2731 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandHandler.java @@ -0,0 +1,224 @@ +package net.minecraft.command; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class CommandHandler implements ICommandManager +{ + private static final Logger logger = LogManager.getLogger(); + private final Map commandMap = Maps.newHashMap(); + private final Set commandSet = Sets.newHashSet(); + + public int executeCommand(ICommandSender sender, String rawCommand) + { + rawCommand = rawCommand.trim(); + + if (rawCommand.startsWith("/")) + { + rawCommand = rawCommand.substring(1); + } + + String[] astring = rawCommand.split(" "); + String s = astring[0]; + astring = dropFirstString(astring); + ICommand icommand = (ICommand)this.commandMap.get(s); + int i = this.getUsernameIndex(icommand, astring); + int j = 0; + + if (icommand == null) + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.notFound", new Object[0]); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); + sender.addChatMessage(chatcomponenttranslation); + } + else if (icommand.canCommandSenderUseCommand(sender)) + { + if (i > -1) + { + List list = PlayerSelector.matchEntities(sender, astring[i], Entity.class); + String s1 = astring[i]; + sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size()); + + for (Entity entity : list) + { + astring[i] = entity.getUniqueID().toString(); + + if (this.tryExecute(sender, astring, icommand, rawCommand)) + { + ++j; + } + } + + astring[i] = s1; + } + else + { + sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, 1); + + if (this.tryExecute(sender, astring, icommand, rawCommand)) + { + ++j; + } + } + } + else + { + ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.generic.permission", new Object[0]); + chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.RED); + sender.addChatMessage(chatcomponenttranslation1); + } + + sender.setCommandStat(CommandResultStats.Type.SUCCESS_COUNT, j); + return j; + } + + protected boolean tryExecute(ICommandSender sender, String[] args, ICommand command, String input) + { + try + { + command.processCommand(sender, args); + return true; + } + catch (WrongUsageException wrongusageexception) + { + ChatComponentTranslation chatcomponenttranslation2 = new ChatComponentTranslation("commands.generic.usage", new Object[] {new ChatComponentTranslation(wrongusageexception.getMessage(), wrongusageexception.getErrorObjects())}); + chatcomponenttranslation2.getChatStyle().setColor(EnumChatFormatting.RED); + sender.addChatMessage(chatcomponenttranslation2); + } + catch (CommandException commandexception) + { + ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects()); + chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.RED); + sender.addChatMessage(chatcomponenttranslation1); + } + catch (Throwable var9) + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.exception", new Object[0]); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); + sender.addChatMessage(chatcomponenttranslation); + logger.warn("Couldn\'t process command: \'" + input + "\'"); + } + + return false; + } + + /** + * adds the command and any aliases it has to the internal map of available commands + */ + public ICommand registerCommand(ICommand command) + { + this.commandMap.put(command.getCommandName(), command); + this.commandSet.add(command); + + for (String s : command.getCommandAliases()) + { + ICommand icommand = (ICommand)this.commandMap.get(s); + + if (icommand == null || !icommand.getCommandName().equals(s)) + { + this.commandMap.put(s, command); + } + } + + return command; + } + + /** + * creates a new array and sets elements 0..n-2 to be 0..n-1 of the input (n elements) + */ + private static String[] dropFirstString(String[] input) + { + String[] astring = new String[input.length - 1]; + System.arraycopy(input, 1, astring, 0, input.length - 1); + return astring; + } + + public List getTabCompletionOptions(ICommandSender sender, String input, BlockPos pos) + { + String[] astring = input.split(" ", -1); + String s = astring[0]; + + if (astring.length == 1) + { + List list = Lists.newArrayList(); + + for (Entry entry : this.commandMap.entrySet()) + { + if (CommandBase.doesStringStartWith(s, (String)entry.getKey()) && ((ICommand)entry.getValue()).canCommandSenderUseCommand(sender)) + { + list.add(entry.getKey()); + } + } + + return list; + } + else + { + if (astring.length > 1) + { + ICommand icommand = (ICommand)this.commandMap.get(s); + + if (icommand != null && icommand.canCommandSenderUseCommand(sender)) + { + return icommand.addTabCompletionOptions(sender, dropFirstString(astring), pos); + } + } + + return null; + } + } + + public List getPossibleCommands(ICommandSender sender) + { + List list = Lists.newArrayList(); + + for (ICommand icommand : this.commandSet) + { + if (icommand.canCommandSenderUseCommand(sender)) + { + list.add(icommand); + } + } + + return list; + } + + public Map getCommands() + { + return this.commandMap; + } + + /** + * Return a command's first parameter index containing a valid username. + */ + private int getUsernameIndex(ICommand command, String[] args) + { + if (command == null) + { + return -1; + } + else + { + for (int i = 0; i < args.length; ++i) + { + if (command.isUsernameIndex(args, i) && PlayerSelector.matchesMultiplePlayers(args[i])) + { + return i; + } + } + + return -1; + } + } +} diff --git a/src/minecraft/net/minecraft/command/CommandHelp.java b/src/minecraft/net/minecraft/command/CommandHelp.java new file mode 100644 index 0000000..79ed95c --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandHelp.java @@ -0,0 +1,124 @@ +package net.minecraft.command; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.event.ClickEvent; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; + +public class CommandHelp extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "help"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 0; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.help.usage"; + } + + public List getCommandAliases() + { + return Arrays.asList(new String[] {"?"}); + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + List list = this.getSortedPossibleCommands(sender); + int i = 7; + int j = (list.size() - 1) / 7; + int k = 0; + + try + { + k = args.length == 0 ? 0 : parseInt(args[0], 1, j + 1) - 1; + } + catch (NumberInvalidException numberinvalidexception) + { + Map map = this.getCommands(); + ICommand icommand = (ICommand)map.get(args[0]); + + if (icommand != null) + { + throw new WrongUsageException(icommand.getCommandUsage(sender), new Object[0]); + } + + if (MathHelper.parseIntWithDefault(args[0], -1) != -1) + { + throw numberinvalidexception; + } + + throw new CommandNotFoundException(); + } + + int l = Math.min((k + 1) * 7, list.size()); + ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.help.header", new Object[] {Integer.valueOf(k + 1), Integer.valueOf(j + 1)}); + chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); + sender.addChatMessage(chatcomponenttranslation1); + + for (int i1 = k * 7; i1 < l; ++i1) + { + ICommand icommand1 = (ICommand)list.get(i1); + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(icommand1.getCommandUsage(sender), new Object[0]); + chatcomponenttranslation.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/" + icommand1.getCommandName() + " ")); + sender.addChatMessage(chatcomponenttranslation); + } + + if (k == 0 && sender instanceof EntityPlayer) + { + ChatComponentTranslation chatcomponenttranslation2 = new ChatComponentTranslation("commands.help.footer", new Object[0]); + chatcomponenttranslation2.getChatStyle().setColor(EnumChatFormatting.GREEN); + sender.addChatMessage(chatcomponenttranslation2); + } + } + + protected List getSortedPossibleCommands(ICommandSender p_71534_1_) + { + List list = MinecraftServer.getServer().getCommandManager().getPossibleCommands(p_71534_1_); + Collections.sort(list); + return list; + } + + protected Map getCommands() + { + return MinecraftServer.getServer().getCommandManager().getCommands(); + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + if (args.length == 1) + { + Set set = this.getCommands().keySet(); + return getListOfStringsMatchingLastWord(args, (String[])set.toArray(new String[set.size()])); + } + else + { + return null; + } + } +} diff --git a/src/minecraft/net/minecraft/command/CommandKill.java b/src/minecraft/net/minecraft/command/CommandKill.java new file mode 100644 index 0000000..3f154cb --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandKill.java @@ -0,0 +1,66 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandKill extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "kill"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.kill.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length == 0) + { + EntityPlayer entityplayer = getCommandSenderAsPlayer(sender); + entityplayer.onKillCommand(); + notifyOperators(sender, this, "commands.kill.successful", new Object[] {entityplayer.getDisplayName()}); + } + else + { + Entity entity = func_175768_b(sender, args[0]); + entity.onKillCommand(); + notifyOperators(sender, this, "commands.kill.successful", new Object[] {entity.getDisplayName()}); + } + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : null; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandNotFoundException.java b/src/minecraft/net/minecraft/command/CommandNotFoundException.java new file mode 100644 index 0000000..5108bf3 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandNotFoundException.java @@ -0,0 +1,14 @@ +package net.minecraft.command; + +public class CommandNotFoundException extends CommandException +{ + public CommandNotFoundException() + { + this("commands.generic.notFound", new Object[0]); + } + + public CommandNotFoundException(String p_i1363_1_, Object... p_i1363_2_) + { + super(p_i1363_1_, p_i1363_2_); + } +} diff --git a/src/minecraft/net/minecraft/command/CommandParticle.java b/src/minecraft/net/minecraft/command/CommandParticle.java new file mode 100644 index 0000000..f6b4117 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandParticle.java @@ -0,0 +1,133 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public class CommandParticle extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "particle"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.particle.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 8) + { + throw new WrongUsageException("commands.particle.usage", new Object[0]); + } + else + { + boolean flag = false; + EnumParticleTypes enumparticletypes = null; + + for (EnumParticleTypes enumparticletypes1 : EnumParticleTypes.values()) + { + if (enumparticletypes1.hasArguments()) + { + if (args[0].startsWith(enumparticletypes1.getParticleName())) + { + flag = true; + enumparticletypes = enumparticletypes1; + break; + } + } + else if (args[0].equals(enumparticletypes1.getParticleName())) + { + flag = true; + enumparticletypes = enumparticletypes1; + break; + } + } + + if (!flag) + { + throw new CommandException("commands.particle.notFound", new Object[] {args[0]}); + } + else + { + String s = args[0]; + Vec3 vec3 = sender.getPositionVector(); + double d6 = (double)((float)parseDouble(vec3.xCoord, args[1], true)); + double d0 = (double)((float)parseDouble(vec3.yCoord, args[2], true)); + double d1 = (double)((float)parseDouble(vec3.zCoord, args[3], true)); + double d2 = (double)((float)parseDouble(args[4])); + double d3 = (double)((float)parseDouble(args[5])); + double d4 = (double)((float)parseDouble(args[6])); + double d5 = (double)((float)parseDouble(args[7])); + int i = 0; + + if (args.length > 8) + { + i = parseInt(args[8], 0); + } + + boolean flag1 = false; + + if (args.length > 9 && "force".equals(args[9])) + { + flag1 = true; + } + + World world = sender.getEntityWorld(); + + if (world instanceof WorldServer) + { + WorldServer worldserver = (WorldServer)world; + int[] aint = new int[enumparticletypes.getArgumentCount()]; + + if (enumparticletypes.hasArguments()) + { + String[] astring = args[0].split("_", 3); + + for (int j = 1; j < astring.length; ++j) + { + try + { + aint[j - 1] = Integer.parseInt(astring[j]); + } + catch (NumberFormatException var29) + { + throw new CommandException("commands.particle.notFound", new Object[] {args[0]}); + } + } + } + + worldserver.spawnParticle(enumparticletypes, flag1, d6, d0, d1, i, d2, d3, d4, d5, aint); + notifyOperators(sender, this, "commands.particle.success", new Object[] {s, Integer.valueOf(Math.max(i, 1))}); + } + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, EnumParticleTypes.getParticleNames()) : (args.length > 1 && args.length <= 4 ? func_175771_a(args, 1, pos) : (args.length == 10 ? getListOfStringsMatchingLastWord(args, new String[] {"normal", "force"}): null)); + } +} diff --git a/src/minecraft/net/minecraft/command/CommandPlaySound.java b/src/minecraft/net/minecraft/command/CommandPlaySound.java new file mode 100644 index 0000000..2c692bb --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandPlaySound.java @@ -0,0 +1,135 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.play.server.S29PacketSoundEffect; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; + +public class CommandPlaySound extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "playsound"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.playsound.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 2) + { + throw new WrongUsageException(this.getCommandUsage(sender), new Object[0]); + } + else + { + int i = 0; + String s = args[i++]; + EntityPlayerMP entityplayermp = getPlayer(sender, args[i++]); + Vec3 vec3 = sender.getPositionVector(); + double d0 = vec3.xCoord; + + if (args.length > i) + { + d0 = parseDouble(d0, args[i++], true); + } + + double d1 = vec3.yCoord; + + if (args.length > i) + { + d1 = parseDouble(d1, args[i++], 0, 0, false); + } + + double d2 = vec3.zCoord; + + if (args.length > i) + { + d2 = parseDouble(d2, args[i++], true); + } + + double d3 = 1.0D; + + if (args.length > i) + { + d3 = parseDouble(args[i++], 0.0D, 3.4028234663852886E38D); + } + + double d4 = 1.0D; + + if (args.length > i) + { + d4 = parseDouble(args[i++], 0.0D, 2.0D); + } + + double d5 = 0.0D; + + if (args.length > i) + { + d5 = parseDouble(args[i], 0.0D, 1.0D); + } + + double d6 = d3 > 1.0D ? d3 * 16.0D : 16.0D; + double d7 = entityplayermp.getDistance(d0, d1, d2); + + if (d7 > d6) + { + if (d5 <= 0.0D) + { + throw new CommandException("commands.playsound.playerTooFar", new Object[] {entityplayermp.getName()}); + } + + double d8 = d0 - entityplayermp.posX; + double d9 = d1 - entityplayermp.posY; + double d10 = d2 - entityplayermp.posZ; + double d11 = Math.sqrt(d8 * d8 + d9 * d9 + d10 * d10); + + if (d11 > 0.0D) + { + d0 = entityplayermp.posX + d8 / d11 * 2.0D; + d1 = entityplayermp.posY + d9 / d11 * 2.0D; + d2 = entityplayermp.posZ + d10 / d11 * 2.0D; + } + + d3 = d5; + } + + entityplayermp.playerNetServerHandler.sendPacket(new S29PacketSoundEffect(s, d0, d1, d2, (float)d3, (float)d4)); + notifyOperators(sender, this, "commands.playsound.success", new Object[] {s, entityplayermp.getName()}); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 2 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : (args.length > 2 && args.length <= 5 ? func_175771_a(args, 2, pos) : null); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 1; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandReplaceItem.java b/src/minecraft/net/minecraft/command/CommandReplaceItem.java new file mode 100644 index 0000000..e7b7b98 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandReplaceItem.java @@ -0,0 +1,253 @@ +package net.minecraft.command; + +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class CommandReplaceItem extends CommandBase +{ + private static final Map SHORTCUTS = Maps.newHashMap(); + + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "replaceitem"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.replaceitem.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 1) + { + throw new WrongUsageException("commands.replaceitem.usage", new Object[0]); + } + else + { + boolean flag; + + if (args[0].equals("entity")) + { + flag = false; + } + else + { + if (!args[0].equals("block")) + { + throw new WrongUsageException("commands.replaceitem.usage", new Object[0]); + } + + flag = true; + } + + int i; + + if (flag) + { + if (args.length < 6) + { + throw new WrongUsageException("commands.replaceitem.block.usage", new Object[0]); + } + + i = 4; + } + else + { + if (args.length < 4) + { + throw new WrongUsageException("commands.replaceitem.entity.usage", new Object[0]); + } + + i = 2; + } + + int j = this.getSlotForShortcut(args[i++]); + Item item; + + try + { + item = getItemByText(sender, args[i]); + } + catch (NumberInvalidException numberinvalidexception) + { + if (Block.getBlockFromName(args[i]) != Blocks.air) + { + throw numberinvalidexception; + } + + item = null; + } + + ++i; + int k = args.length > i ? parseInt(args[i++], 1, 64) : 1; + int l = args.length > i ? parseInt(args[i++]) : 0; + ItemStack itemstack = new ItemStack(item, k, l); + + if (args.length > i) + { + String s = getChatComponentFromNthArg(sender, args, i).getUnformattedText(); + + try + { + itemstack.setTagCompound(JsonToNBT.getTagFromJson(s)); + } + catch (NBTException nbtexception) + { + throw new CommandException("commands.replaceitem.tagError", new Object[] {nbtexception.getMessage()}); + } + } + + if (itemstack.getItem() == null) + { + itemstack = null; + } + + if (flag) + { + sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, 0); + BlockPos blockpos = parseBlockPos(sender, args, 1, false); + World world = sender.getEntityWorld(); + TileEntity tileentity = world.getTileEntity(blockpos); + + if (tileentity == null || !(tileentity instanceof IInventory)) + { + throw new CommandException("commands.replaceitem.noContainer", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())}); + } + + IInventory iinventory = (IInventory)tileentity; + + if (j >= 0 && j < iinventory.getSizeInventory()) + { + iinventory.setInventorySlotContents(j, itemstack); + } + } + else + { + Entity entity = func_175768_b(sender, args[1]); + sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, 0); + + if (entity instanceof EntityPlayer) + { + ((EntityPlayer)entity).inventoryContainer.detectAndSendChanges(); + } + + if (!entity.replaceItemInInventory(j, itemstack)) + { + throw new CommandException("commands.replaceitem.failed", new Object[] {Integer.valueOf(j), Integer.valueOf(k), itemstack == null ? "Air" : itemstack.getChatComponent()}); + } + + if (entity instanceof EntityPlayer) + { + ((EntityPlayer)entity).inventoryContainer.detectAndSendChanges(); + } + } + + sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, k); + notifyOperators(sender, this, "commands.replaceitem.success", new Object[] {Integer.valueOf(j), Integer.valueOf(k), itemstack == null ? "Air" : itemstack.getChatComponent()}); + } + } + + private int getSlotForShortcut(String shortcut) throws CommandException + { + if (!SHORTCUTS.containsKey(shortcut)) + { + throw new CommandException("commands.generic.parameter.invalid", new Object[] {shortcut}); + } + else + { + return ((Integer)SHORTCUTS.get(shortcut)).intValue(); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, new String[] {"entity", "block"}): (args.length == 2 && args[0].equals("entity") ? getListOfStringsMatchingLastWord(args, this.getUsernames()) : (args.length >= 2 && args.length <= 4 && args[0].equals("block") ? func_175771_a(args, 1, pos) : ((args.length != 3 || !args[0].equals("entity")) && (args.length != 5 || !args[0].equals("block")) ? ((args.length != 4 || !args[0].equals("entity")) && (args.length != 6 || !args[0].equals("block")) ? null : getListOfStringsMatchingLastWord(args, Item.itemRegistry.getKeys())) : getListOfStringsMatchingLastWord(args, SHORTCUTS.keySet())))); + } + + protected String[] getUsernames() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return args.length > 0 && args[0].equals("entity") && index == 1; + } + + static + { + for (int i = 0; i < 54; ++i) + { + SHORTCUTS.put("slot.container." + i, Integer.valueOf(i)); + } + + for (int j = 0; j < 9; ++j) + { + SHORTCUTS.put("slot.hotbar." + j, Integer.valueOf(j)); + } + + for (int k = 0; k < 27; ++k) + { + SHORTCUTS.put("slot.inventory." + k, Integer.valueOf(9 + k)); + } + + for (int l = 0; l < 27; ++l) + { + SHORTCUTS.put("slot.enderchest." + l, Integer.valueOf(200 + l)); + } + + for (int i1 = 0; i1 < 8; ++i1) + { + SHORTCUTS.put("slot.villager." + i1, Integer.valueOf(300 + i1)); + } + + for (int j1 = 0; j1 < 15; ++j1) + { + SHORTCUTS.put("slot.horse." + j1, Integer.valueOf(500 + j1)); + } + + SHORTCUTS.put("slot.weapon", Integer.valueOf(99)); + SHORTCUTS.put("slot.armor.head", Integer.valueOf(103)); + SHORTCUTS.put("slot.armor.chest", Integer.valueOf(102)); + SHORTCUTS.put("slot.armor.legs", Integer.valueOf(101)); + SHORTCUTS.put("slot.armor.feet", Integer.valueOf(100)); + SHORTCUTS.put("slot.horse.saddle", Integer.valueOf(400)); + SHORTCUTS.put("slot.horse.armor", Integer.valueOf(401)); + SHORTCUTS.put("slot.horse.chest", Integer.valueOf(499)); + } +} diff --git a/src/minecraft/net/minecraft/command/CommandResultStats.java b/src/minecraft/net/minecraft/command/CommandResultStats.java new file mode 100644 index 0000000..44801e4 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandResultStats.java @@ -0,0 +1,254 @@ +package net.minecraft.command; + +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class CommandResultStats +{ + /** The number of result command result types that are possible. */ + private static final int NUM_RESULT_TYPES = CommandResultStats.Type.values().length; + private static final String[] STRING_RESULT_TYPES = new String[NUM_RESULT_TYPES]; + private String[] field_179675_c; + private String[] field_179673_d; + + public CommandResultStats() + { + this.field_179675_c = STRING_RESULT_TYPES; + this.field_179673_d = STRING_RESULT_TYPES; + } + + public void func_179672_a(final ICommandSender sender, CommandResultStats.Type resultTypeIn, int p_179672_3_) + { + String s = this.field_179675_c[resultTypeIn.getTypeID()]; + + if (s != null) + { + ICommandSender icommandsender = new ICommandSender() + { + public String getName() + { + return sender.getName(); + } + public IChatComponent getDisplayName() + { + return sender.getDisplayName(); + } + public void addChatMessage(IChatComponent component) + { + sender.addChatMessage(component); + } + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { + return true; + } + public BlockPos getPosition() + { + return sender.getPosition(); + } + public Vec3 getPositionVector() + { + return sender.getPositionVector(); + } + public World getEntityWorld() + { + return sender.getEntityWorld(); + } + public Entity getCommandSenderEntity() + { + return sender.getCommandSenderEntity(); + } + public boolean sendCommandFeedback() + { + return sender.sendCommandFeedback(); + } + public void setCommandStat(CommandResultStats.Type type, int amount) + { + sender.setCommandStat(type, amount); + } + }; + String s1; + + try + { + s1 = CommandBase.getEntityName(icommandsender, s); + } + catch (EntityNotFoundException var11) + { + return; + } + + String s2 = this.field_179673_d[resultTypeIn.getTypeID()]; + + if (s2 != null) + { + Scoreboard scoreboard = sender.getEntityWorld().getScoreboard(); + ScoreObjective scoreobjective = scoreboard.getObjective(s2); + + if (scoreobjective != null) + { + if (scoreboard.entityHasObjective(s1, scoreobjective)) + { + Score score = scoreboard.getValueFromObjective(s1, scoreobjective); + score.setScorePoints(p_179672_3_); + } + } + } + } + } + + public void readStatsFromNBT(NBTTagCompound tagcompound) + { + if (tagcompound.hasKey("CommandStats", 10)) + { + NBTTagCompound nbttagcompound = tagcompound.getCompoundTag("CommandStats"); + + for (CommandResultStats.Type commandresultstats$type : CommandResultStats.Type.values()) + { + String s = commandresultstats$type.getTypeName() + "Name"; + String s1 = commandresultstats$type.getTypeName() + "Objective"; + + if (nbttagcompound.hasKey(s, 8) && nbttagcompound.hasKey(s1, 8)) + { + String s2 = nbttagcompound.getString(s); + String s3 = nbttagcompound.getString(s1); + func_179667_a(this, commandresultstats$type, s2, s3); + } + } + } + } + + public void writeStatsToNBT(NBTTagCompound tagcompound) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + for (CommandResultStats.Type commandresultstats$type : CommandResultStats.Type.values()) + { + String s = this.field_179675_c[commandresultstats$type.getTypeID()]; + String s1 = this.field_179673_d[commandresultstats$type.getTypeID()]; + + if (s != null && s1 != null) + { + nbttagcompound.setString(commandresultstats$type.getTypeName() + "Name", s); + nbttagcompound.setString(commandresultstats$type.getTypeName() + "Objective", s1); + } + } + + if (!nbttagcompound.hasNoTags()) + { + tagcompound.setTag("CommandStats", nbttagcompound); + } + } + + public static void func_179667_a(CommandResultStats stats, CommandResultStats.Type resultType, String p_179667_2_, String p_179667_3_) + { + if (p_179667_2_ != null && p_179667_2_.length() != 0 && p_179667_3_ != null && p_179667_3_.length() != 0) + { + if (stats.field_179675_c == STRING_RESULT_TYPES || stats.field_179673_d == STRING_RESULT_TYPES) + { + stats.field_179675_c = new String[NUM_RESULT_TYPES]; + stats.field_179673_d = new String[NUM_RESULT_TYPES]; + } + + stats.field_179675_c[resultType.getTypeID()] = p_179667_2_; + stats.field_179673_d[resultType.getTypeID()] = p_179667_3_; + } + else + { + func_179669_a(stats, resultType); + } + } + + private static void func_179669_a(CommandResultStats resultStatsIn, CommandResultStats.Type resultTypeIn) + { + if (resultStatsIn.field_179675_c != STRING_RESULT_TYPES && resultStatsIn.field_179673_d != STRING_RESULT_TYPES) + { + resultStatsIn.field_179675_c[resultTypeIn.getTypeID()] = null; + resultStatsIn.field_179673_d[resultTypeIn.getTypeID()] = null; + boolean flag = true; + + for (CommandResultStats.Type commandresultstats$type : CommandResultStats.Type.values()) + { + if (resultStatsIn.field_179675_c[commandresultstats$type.getTypeID()] != null && resultStatsIn.field_179673_d[commandresultstats$type.getTypeID()] != null) + { + flag = false; + break; + } + } + + if (flag) + { + resultStatsIn.field_179675_c = STRING_RESULT_TYPES; + resultStatsIn.field_179673_d = STRING_RESULT_TYPES; + } + } + } + + public void func_179671_a(CommandResultStats resultStatsIn) + { + for (CommandResultStats.Type commandresultstats$type : CommandResultStats.Type.values()) + { + func_179667_a(this, commandresultstats$type, resultStatsIn.field_179675_c[commandresultstats$type.getTypeID()], resultStatsIn.field_179673_d[commandresultstats$type.getTypeID()]); + } + } + + public static enum Type + { + SUCCESS_COUNT(0, "SuccessCount"), + AFFECTED_BLOCKS(1, "AffectedBlocks"), + AFFECTED_ENTITIES(2, "AffectedEntities"), + AFFECTED_ITEMS(3, "AffectedItems"), + QUERY_RESULT(4, "QueryResult"); + + final int typeID; + final String typeName; + + private Type(int id, String name) + { + this.typeID = id; + this.typeName = name; + } + + public int getTypeID() + { + return this.typeID; + } + + public String getTypeName() + { + return this.typeName; + } + + public static String[] getTypeNames() + { + String[] astring = new String[values().length]; + int i = 0; + + for (CommandResultStats.Type commandresultstats$type : values()) + { + astring[i++] = commandresultstats$type.getTypeName(); + } + + return astring; + } + + public static CommandResultStats.Type getTypeByName(String name) + { + for (CommandResultStats.Type commandresultstats$type : values()) + { + if (commandresultstats$type.getTypeName().equals(name)) + { + return commandresultstats$type; + } + } + + return null; + } + } +} diff --git a/src/minecraft/net/minecraft/command/CommandServerKick.java b/src/minecraft/net/minecraft/command/CommandServerKick.java new file mode 100644 index 0000000..7e49fea --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandServerKick.java @@ -0,0 +1,79 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandServerKick extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "kick"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.kick.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length > 0 && args[0].length() > 1) + { + EntityPlayerMP entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(args[0]); + String s = "Kicked by an operator."; + boolean flag = false; + + if (entityplayermp == null) + { + throw new PlayerNotFoundException(); + } + else + { + if (args.length >= 2) + { + s = getChatComponentFromNthArg(sender, args, 1).getUnformattedText(); + flag = true; + } + + entityplayermp.playerNetServerHandler.kickPlayerFromServer(s); + + if (flag) + { + notifyOperators(sender, this, "commands.kick.success.reason", new Object[] {entityplayermp.getName(), s}); + } + else + { + notifyOperators(sender, this, "commands.kick.success", new Object[] {entityplayermp.getName()}); + } + } + } + else + { + throw new WrongUsageException("commands.kick.usage", new Object[0]); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length >= 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : null; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandSetPlayerTimeout.java b/src/minecraft/net/minecraft/command/CommandSetPlayerTimeout.java new file mode 100644 index 0000000..40031c1 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandSetPlayerTimeout.java @@ -0,0 +1,47 @@ +package net.minecraft.command; + +import net.minecraft.server.MinecraftServer; + +public class CommandSetPlayerTimeout extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "setidletimeout"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.setidletimeout.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length != 1) + { + throw new WrongUsageException("commands.setidletimeout.usage", new Object[0]); + } + else + { + int i = parseInt(args[0], 0); + MinecraftServer.getServer().setPlayerIdleTimeout(i); + notifyOperators(sender, this, "commands.setidletimeout.success", new Object[] {Integer.valueOf(i)}); + } + } +} diff --git a/src/minecraft/net/minecraft/command/CommandSetSpawnpoint.java b/src/minecraft/net/minecraft/command/CommandSetSpawnpoint.java new file mode 100644 index 0000000..c531ef6 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandSetSpawnpoint.java @@ -0,0 +1,68 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandSetSpawnpoint extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "spawnpoint"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.spawnpoint.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length > 1 && args.length < 4) + { + throw new WrongUsageException("commands.spawnpoint.usage", new Object[0]); + } + else + { + EntityPlayerMP entityplayermp = args.length > 0 ? getPlayer(sender, args[0]) : getCommandSenderAsPlayer(sender); + BlockPos blockpos = args.length > 3 ? parseBlockPos(sender, args, 1, true) : entityplayermp.getPosition(); + + if (entityplayermp.worldObj != null) + { + entityplayermp.setSpawnPoint(blockpos, true); + notifyOperators(sender, this, "commands.spawnpoint.success", new Object[] {entityplayermp.getName(), Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())}); + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : (args.length > 1 && args.length <= 4 ? func_175771_a(args, 1, pos) : null); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandShowSeed.java b/src/minecraft/net/minecraft/command/CommandShowSeed.java new file mode 100644 index 0000000..23d071e --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandShowSeed.java @@ -0,0 +1,50 @@ +package net.minecraft.command; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.world.World; + +public class CommandShowSeed extends CommandBase +{ + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender sender) + { + return MinecraftServer.getServer().isSinglePlayer() || super.canCommandSenderUseCommand(sender); + } + + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "seed"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.seed.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + World world = (World)(sender instanceof EntityPlayer ? ((EntityPlayer)sender).worldObj : MinecraftServer.getServer().worldServerForDimension(0)); + sender.addChatMessage(new ChatComponentTranslation("commands.seed.success", new Object[] {Long.valueOf(world.getSeed())})); + } +} diff --git a/src/minecraft/net/minecraft/command/CommandSpreadPlayers.java b/src/minecraft/net/minecraft/command/CommandSpreadPlayers.java new file mode 100644 index 0000000..45b27d8 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandSpreadPlayers.java @@ -0,0 +1,402 @@ +package net.minecraft.command; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.scoreboard.Team; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class CommandSpreadPlayers extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "spreadplayers"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.spreadplayers.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 6) + { + throw new WrongUsageException("commands.spreadplayers.usage", new Object[0]); + } + else + { + int i = 0; + BlockPos blockpos = sender.getPosition(); + double d0 = parseDouble((double)blockpos.getX(), args[i++], true); + double d1 = parseDouble((double)blockpos.getZ(), args[i++], true); + double d2 = parseDouble(args[i++], 0.0D); + double d3 = parseDouble(args[i++], d2 + 1.0D); + boolean flag = parseBoolean(args[i++]); + List list = Lists.newArrayList(); + + while (i < args.length) + { + String s = args[i++]; + + if (PlayerSelector.hasArguments(s)) + { + List list1 = PlayerSelector.matchEntities(sender, s, Entity.class); + + if (list1.size() == 0) + { + throw new EntityNotFoundException(); + } + + list.addAll(list1); + } + else + { + EntityPlayer entityplayer = MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(s); + + if (entityplayer == null) + { + throw new PlayerNotFoundException(); + } + + list.add(entityplayer); + } + } + + sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size()); + + if (list.isEmpty()) + { + throw new EntityNotFoundException(); + } + else + { + sender.addChatMessage(new ChatComponentTranslation("commands.spreadplayers.spreading." + (flag ? "teams" : "players"), new Object[] {Integer.valueOf(list.size()), Double.valueOf(d3), Double.valueOf(d0), Double.valueOf(d1), Double.valueOf(d2)})); + this.func_110669_a(sender, list, new CommandSpreadPlayers.Position(d0, d1), d2, d3, ((Entity)list.get(0)).worldObj, flag); + } + } + } + + private void func_110669_a(ICommandSender p_110669_1_, List p_110669_2_, CommandSpreadPlayers.Position p_110669_3_, double p_110669_4_, double p_110669_6_, World worldIn, boolean p_110669_9_) throws CommandException + { + Random random = new Random(); + double d0 = p_110669_3_.field_111101_a - p_110669_6_; + double d1 = p_110669_3_.field_111100_b - p_110669_6_; + double d2 = p_110669_3_.field_111101_a + p_110669_6_; + double d3 = p_110669_3_.field_111100_b + p_110669_6_; + CommandSpreadPlayers.Position[] acommandspreadplayers$position = this.func_110670_a(random, p_110669_9_ ? this.func_110667_a(p_110669_2_) : p_110669_2_.size(), d0, d1, d2, d3); + int i = this.func_110668_a(p_110669_3_, p_110669_4_, worldIn, random, d0, d1, d2, d3, acommandspreadplayers$position, p_110669_9_); + double d4 = this.func_110671_a(p_110669_2_, worldIn, acommandspreadplayers$position, p_110669_9_); + notifyOperators(p_110669_1_, this, "commands.spreadplayers.success." + (p_110669_9_ ? "teams" : "players"), new Object[] {Integer.valueOf(acommandspreadplayers$position.length), Double.valueOf(p_110669_3_.field_111101_a), Double.valueOf(p_110669_3_.field_111100_b)}); + + if (acommandspreadplayers$position.length > 1) + { + p_110669_1_.addChatMessage(new ChatComponentTranslation("commands.spreadplayers.info." + (p_110669_9_ ? "teams" : "players"), new Object[] {String.format("%.2f", new Object[]{Double.valueOf(d4)}), Integer.valueOf(i)})); + } + } + + private int func_110667_a(List p_110667_1_) + { + Set set = Sets.newHashSet(); + + for (Entity entity : p_110667_1_) + { + if (entity instanceof EntityPlayer) + { + set.add(((EntityPlayer)entity).getTeam()); + } + else + { + set.add((Team)null); + } + } + + return set.size(); + } + + private int func_110668_a(CommandSpreadPlayers.Position p_110668_1_, double p_110668_2_, World worldIn, Random p_110668_5_, double p_110668_6_, double p_110668_8_, double p_110668_10_, double p_110668_12_, CommandSpreadPlayers.Position[] p_110668_14_, boolean p_110668_15_) throws CommandException + { + boolean flag = true; + double d0 = 3.4028234663852886E38D; + int i; + + for (i = 0; i < 10000 && flag; ++i) + { + flag = false; + d0 = 3.4028234663852886E38D; + + for (int j = 0; j < p_110668_14_.length; ++j) + { + CommandSpreadPlayers.Position commandspreadplayers$position = p_110668_14_[j]; + int k = 0; + CommandSpreadPlayers.Position commandspreadplayers$position1 = new CommandSpreadPlayers.Position(); + + for (int l = 0; l < p_110668_14_.length; ++l) + { + if (j != l) + { + CommandSpreadPlayers.Position commandspreadplayers$position2 = p_110668_14_[l]; + double d1 = commandspreadplayers$position.func_111099_a(commandspreadplayers$position2); + d0 = Math.min(d1, d0); + + if (d1 < p_110668_2_) + { + ++k; + commandspreadplayers$position1.field_111101_a += commandspreadplayers$position2.field_111101_a - commandspreadplayers$position.field_111101_a; + commandspreadplayers$position1.field_111100_b += commandspreadplayers$position2.field_111100_b - commandspreadplayers$position.field_111100_b; + } + } + } + + if (k > 0) + { + commandspreadplayers$position1.field_111101_a /= (double)k; + commandspreadplayers$position1.field_111100_b /= (double)k; + double d2 = (double)commandspreadplayers$position1.func_111096_b(); + + if (d2 > 0.0D) + { + commandspreadplayers$position1.func_111095_a(); + commandspreadplayers$position.func_111094_b(commandspreadplayers$position1); + } + else + { + commandspreadplayers$position.func_111097_a(p_110668_5_, p_110668_6_, p_110668_8_, p_110668_10_, p_110668_12_); + } + + flag = true; + } + + if (commandspreadplayers$position.func_111093_a(p_110668_6_, p_110668_8_, p_110668_10_, p_110668_12_)) + { + flag = true; + } + } + + if (!flag) + { + for (CommandSpreadPlayers.Position commandspreadplayers$position3 : p_110668_14_) + { + if (!commandspreadplayers$position3.func_111098_b(worldIn)) + { + commandspreadplayers$position3.func_111097_a(p_110668_5_, p_110668_6_, p_110668_8_, p_110668_10_, p_110668_12_); + flag = true; + } + } + } + } + + if (i >= 10000) + { + throw new CommandException("commands.spreadplayers.failure." + (p_110668_15_ ? "teams" : "players"), new Object[] {Integer.valueOf(p_110668_14_.length), Double.valueOf(p_110668_1_.field_111101_a), Double.valueOf(p_110668_1_.field_111100_b), String.format("%.2f", new Object[]{Double.valueOf(d0)})}); + } + else + { + return i; + } + } + + private double func_110671_a(List p_110671_1_, World worldIn, CommandSpreadPlayers.Position[] p_110671_3_, boolean p_110671_4_) + { + double d0 = 0.0D; + int i = 0; + Map map = Maps.newHashMap(); + + for (int j = 0; j < p_110671_1_.size(); ++j) + { + Entity entity = (Entity)p_110671_1_.get(j); + CommandSpreadPlayers.Position commandspreadplayers$position; + + if (p_110671_4_) + { + Team team = entity instanceof EntityPlayer ? ((EntityPlayer)entity).getTeam() : null; + + if (!map.containsKey(team)) + { + map.put(team, p_110671_3_[i++]); + } + + commandspreadplayers$position = (CommandSpreadPlayers.Position)map.get(team); + } + else + { + commandspreadplayers$position = p_110671_3_[i++]; + } + + entity.setPositionAndUpdate((double)((float)MathHelper.floor_double(commandspreadplayers$position.field_111101_a) + 0.5F), (double)commandspreadplayers$position.func_111092_a(worldIn), (double)MathHelper.floor_double(commandspreadplayers$position.field_111100_b) + 0.5D); + double d2 = Double.MAX_VALUE; + + for (int k = 0; k < p_110671_3_.length; ++k) + { + if (commandspreadplayers$position != p_110671_3_[k]) + { + double d1 = commandspreadplayers$position.func_111099_a(p_110671_3_[k]); + d2 = Math.min(d1, d2); + } + } + + d0 += d2; + } + + d0 = d0 / (double)p_110671_1_.size(); + return d0; + } + + private CommandSpreadPlayers.Position[] func_110670_a(Random p_110670_1_, int p_110670_2_, double p_110670_3_, double p_110670_5_, double p_110670_7_, double p_110670_9_) + { + CommandSpreadPlayers.Position[] acommandspreadplayers$position = new CommandSpreadPlayers.Position[p_110670_2_]; + + for (int i = 0; i < acommandspreadplayers$position.length; ++i) + { + CommandSpreadPlayers.Position commandspreadplayers$position = new CommandSpreadPlayers.Position(); + commandspreadplayers$position.func_111097_a(p_110670_1_, p_110670_3_, p_110670_5_, p_110670_7_, p_110670_9_); + acommandspreadplayers$position[i] = commandspreadplayers$position; + } + + return acommandspreadplayers$position; + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length >= 1 && args.length <= 2 ? func_181043_b(args, 0, pos) : null; + } + + static class Position + { + double field_111101_a; + double field_111100_b; + + Position() + { + } + + Position(double p_i1358_1_, double p_i1358_3_) + { + this.field_111101_a = p_i1358_1_; + this.field_111100_b = p_i1358_3_; + } + + double func_111099_a(CommandSpreadPlayers.Position p_111099_1_) + { + double d0 = this.field_111101_a - p_111099_1_.field_111101_a; + double d1 = this.field_111100_b - p_111099_1_.field_111100_b; + return Math.sqrt(d0 * d0 + d1 * d1); + } + + void func_111095_a() + { + double d0 = (double)this.func_111096_b(); + this.field_111101_a /= d0; + this.field_111100_b /= d0; + } + + float func_111096_b() + { + return MathHelper.sqrt_double(this.field_111101_a * this.field_111101_a + this.field_111100_b * this.field_111100_b); + } + + public void func_111094_b(CommandSpreadPlayers.Position p_111094_1_) + { + this.field_111101_a -= p_111094_1_.field_111101_a; + this.field_111100_b -= p_111094_1_.field_111100_b; + } + + public boolean func_111093_a(double p_111093_1_, double p_111093_3_, double p_111093_5_, double p_111093_7_) + { + boolean flag = false; + + if (this.field_111101_a < p_111093_1_) + { + this.field_111101_a = p_111093_1_; + flag = true; + } + else if (this.field_111101_a > p_111093_5_) + { + this.field_111101_a = p_111093_5_; + flag = true; + } + + if (this.field_111100_b < p_111093_3_) + { + this.field_111100_b = p_111093_3_; + flag = true; + } + else if (this.field_111100_b > p_111093_7_) + { + this.field_111100_b = p_111093_7_; + flag = true; + } + + return flag; + } + + public int func_111092_a(World worldIn) + { + BlockPos blockpos = new BlockPos(this.field_111101_a, 256.0D, this.field_111100_b); + + while (blockpos.getY() > 0) + { + blockpos = blockpos.down(); + + if (worldIn.getBlockState(blockpos).getBlock().getMaterial() != Material.air) + { + return blockpos.getY() + 1; + } + } + + return 257; + } + + public boolean func_111098_b(World worldIn) + { + BlockPos blockpos = new BlockPos(this.field_111101_a, 256.0D, this.field_111100_b); + + while (blockpos.getY() > 0) + { + blockpos = blockpos.down(); + Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); + + if (material != Material.air) + { + return !material.isLiquid() && material != Material.fire; + } + } + + return false; + } + + public void func_111097_a(Random p_111097_1_, double p_111097_2_, double p_111097_4_, double p_111097_6_, double p_111097_8_) + { + this.field_111101_a = MathHelper.getRandomDoubleInRange(p_111097_1_, p_111097_2_, p_111097_6_); + this.field_111100_b = MathHelper.getRandomDoubleInRange(p_111097_1_, p_111097_4_, p_111097_8_); + } + } +} diff --git a/src/minecraft/net/minecraft/command/CommandStats.java b/src/minecraft/net/minecraft/command/CommandStats.java new file mode 100644 index 0000000..d3dad28 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandStats.java @@ -0,0 +1,224 @@ +package net.minecraft.command; + +import com.google.common.collect.Lists; +import java.util.Collection; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityCommandBlock; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class CommandStats extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "stats"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.stats.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 1) + { + throw new WrongUsageException("commands.stats.usage", new Object[0]); + } + else + { + boolean flag; + + if (args[0].equals("entity")) + { + flag = false; + } + else + { + if (!args[0].equals("block")) + { + throw new WrongUsageException("commands.stats.usage", new Object[0]); + } + + flag = true; + } + + int i; + + if (flag) + { + if (args.length < 5) + { + throw new WrongUsageException("commands.stats.block.usage", new Object[0]); + } + + i = 4; + } + else + { + if (args.length < 3) + { + throw new WrongUsageException("commands.stats.entity.usage", new Object[0]); + } + + i = 2; + } + + String s = args[i++]; + + if ("set".equals(s)) + { + if (args.length < i + 3) + { + if (i == 5) + { + throw new WrongUsageException("commands.stats.block.set.usage", new Object[0]); + } + + throw new WrongUsageException("commands.stats.entity.set.usage", new Object[0]); + } + } + else + { + if (!"clear".equals(s)) + { + throw new WrongUsageException("commands.stats.usage", new Object[0]); + } + + if (args.length < i + 1) + { + if (i == 5) + { + throw new WrongUsageException("commands.stats.block.clear.usage", new Object[0]); + } + + throw new WrongUsageException("commands.stats.entity.clear.usage", new Object[0]); + } + } + + CommandResultStats.Type commandresultstats$type = CommandResultStats.Type.getTypeByName(args[i++]); + + if (commandresultstats$type == null) + { + throw new CommandException("commands.stats.failed", new Object[0]); + } + else + { + World world = sender.getEntityWorld(); + CommandResultStats commandresultstats; + + if (flag) + { + BlockPos blockpos = parseBlockPos(sender, args, 1, false); + TileEntity tileentity = world.getTileEntity(blockpos); + + if (tileentity == null) + { + throw new CommandException("commands.stats.noCompatibleBlock", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())}); + } + + if (tileentity instanceof TileEntityCommandBlock) + { + commandresultstats = ((TileEntityCommandBlock)tileentity).getCommandResultStats(); + } + else + { + if (!(tileentity instanceof TileEntitySign)) + { + throw new CommandException("commands.stats.noCompatibleBlock", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())}); + } + + commandresultstats = ((TileEntitySign)tileentity).getStats(); + } + } + else + { + Entity entity = func_175768_b(sender, args[1]); + commandresultstats = entity.getCommandStats(); + } + + if ("set".equals(s)) + { + String s1 = args[i++]; + String s2 = args[i]; + + if (s1.length() == 0 || s2.length() == 0) + { + throw new CommandException("commands.stats.failed", new Object[0]); + } + + CommandResultStats.func_179667_a(commandresultstats, commandresultstats$type, s1, s2); + notifyOperators(sender, this, "commands.stats.success", new Object[] {commandresultstats$type.getTypeName(), s2, s1}); + } + else if ("clear".equals(s)) + { + CommandResultStats.func_179667_a(commandresultstats, commandresultstats$type, (String)null, (String)null); + notifyOperators(sender, this, "commands.stats.cleared", new Object[] {commandresultstats$type.getTypeName()}); + } + + if (flag) + { + BlockPos blockpos1 = parseBlockPos(sender, args, 1, false); + TileEntity tileentity1 = world.getTileEntity(blockpos1); + tileentity1.markDirty(); + } + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, new String[] {"entity", "block"}): (args.length == 2 && args[0].equals("entity") ? getListOfStringsMatchingLastWord(args, this.func_175776_d()) : (args.length >= 2 && args.length <= 4 && args[0].equals("block") ? func_175771_a(args, 1, pos) : ((args.length != 3 || !args[0].equals("entity")) && (args.length != 5 || !args[0].equals("block")) ? ((args.length != 4 || !args[0].equals("entity")) && (args.length != 6 || !args[0].equals("block")) ? ((args.length != 6 || !args[0].equals("entity")) && (args.length != 8 || !args[0].equals("block")) ? null : getListOfStringsMatchingLastWord(args, this.func_175777_e())) : getListOfStringsMatchingLastWord(args, CommandResultStats.Type.getTypeNames())) : getListOfStringsMatchingLastWord(args, new String[] {"set", "clear"})))); + } + + protected String[] func_175776_d() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + protected List func_175777_e() + { + Collection collection = MinecraftServer.getServer().worldServerForDimension(0).getScoreboard().getScoreObjectives(); + List list = Lists.newArrayList(); + + for (ScoreObjective scoreobjective : collection) + { + if (!scoreobjective.getCriteria().isReadOnly()) + { + list.add(scoreobjective.getName()); + } + } + + return list; + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return args.length > 0 && args[0].equals("entity") && index == 1; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandTime.java b/src/minecraft/net/minecraft/command/CommandTime.java new file mode 100644 index 0000000..a474957 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandTime.java @@ -0,0 +1,121 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.world.WorldServer; + +public class CommandTime extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "time"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.time.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length > 1) + { + if (args[0].equals("set")) + { + int l; + + if (args[1].equals("day")) + { + l = 1000; + } + else if (args[1].equals("night")) + { + l = 13000; + } + else + { + l = parseInt(args[1], 0); + } + + this.setTime(sender, l); + notifyOperators(sender, this, "commands.time.set", new Object[] {Integer.valueOf(l)}); + return; + } + + if (args[0].equals("add")) + { + int k = parseInt(args[1], 0); + this.addTime(sender, k); + notifyOperators(sender, this, "commands.time.added", new Object[] {Integer.valueOf(k)}); + return; + } + + if (args[0].equals("query")) + { + if (args[1].equals("daytime")) + { + int j = (int)(sender.getEntityWorld().getWorldTime() % 2147483647L); + sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, j); + notifyOperators(sender, this, "commands.time.query", new Object[] {Integer.valueOf(j)}); + return; + } + + if (args[1].equals("gametime")) + { + int i = (int)(sender.getEntityWorld().getTotalWorldTime() % 2147483647L); + sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, i); + notifyOperators(sender, this, "commands.time.query", new Object[] {Integer.valueOf(i)}); + return; + } + } + } + + throw new WrongUsageException("commands.time.usage", new Object[0]); + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, new String[] {"set", "add", "query"}): (args.length == 2 && args[0].equals("set") ? getListOfStringsMatchingLastWord(args, new String[] {"day", "night"}): (args.length == 2 && args[0].equals("query") ? getListOfStringsMatchingLastWord(args, new String[] {"daytime", "gametime"}): null)); + } + + /** + * Set the time in the server object. + */ + protected void setTime(ICommandSender p_71552_1_, int p_71552_2_) + { + for (int i = 0; i < MinecraftServer.getServer().worldServers.length; ++i) + { + MinecraftServer.getServer().worldServers[i].setWorldTime((long)p_71552_2_); + } + } + + /** + * Adds (or removes) time in the server object. + */ + protected void addTime(ICommandSender p_71553_1_, int p_71553_2_) + { + for (int i = 0; i < MinecraftServer.getServer().worldServers.length; ++i) + { + WorldServer worldserver = MinecraftServer.getServer().worldServers[i]; + worldserver.setWorldTime(worldserver.getWorldTime() + (long)p_71553_2_); + } + } +} diff --git a/src/minecraft/net/minecraft/command/CommandTitle.java b/src/minecraft/net/minecraft/command/CommandTitle.java new file mode 100644 index 0000000..5836b5a --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandTitle.java @@ -0,0 +1,137 @@ +package net.minecraft.command; + +import com.google.gson.JsonParseException; +import java.util.List; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.play.server.S45PacketTitle; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentProcessor; +import net.minecraft.util.IChatComponent; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class CommandTitle extends CommandBase +{ + private static final Logger LOGGER = LogManager.getLogger(); + + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "title"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.title.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 2) + { + throw new WrongUsageException("commands.title.usage", new Object[0]); + } + else + { + if (args.length < 3) + { + if ("title".equals(args[1]) || "subtitle".equals(args[1])) + { + throw new WrongUsageException("commands.title.usage.title", new Object[0]); + } + + if ("times".equals(args[1])) + { + throw new WrongUsageException("commands.title.usage.times", new Object[0]); + } + } + + EntityPlayerMP entityplayermp = getPlayer(sender, args[0]); + S45PacketTitle.Type s45packettitle$type = S45PacketTitle.Type.byName(args[1]); + + if (s45packettitle$type != S45PacketTitle.Type.CLEAR && s45packettitle$type != S45PacketTitle.Type.RESET) + { + if (s45packettitle$type == S45PacketTitle.Type.TIMES) + { + if (args.length != 5) + { + throw new WrongUsageException("commands.title.usage", new Object[0]); + } + else + { + int i = parseInt(args[2]); + int j = parseInt(args[3]); + int k = parseInt(args[4]); + S45PacketTitle s45packettitle2 = new S45PacketTitle(i, j, k); + entityplayermp.playerNetServerHandler.sendPacket(s45packettitle2); + notifyOperators(sender, this, "commands.title.success", new Object[0]); + } + } + else if (args.length < 3) + { + throw new WrongUsageException("commands.title.usage", new Object[0]); + } + else + { + String s = buildString(args, 2); + IChatComponent ichatcomponent; + + try + { + ichatcomponent = IChatComponent.Serializer.jsonToComponent(s); + } + catch (JsonParseException jsonparseexception) + { + Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception); + throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()}); + } + + S45PacketTitle s45packettitle1 = new S45PacketTitle(s45packettitle$type, ChatComponentProcessor.processComponent(sender, ichatcomponent, entityplayermp)); + entityplayermp.playerNetServerHandler.sendPacket(s45packettitle1); + notifyOperators(sender, this, "commands.title.success", new Object[0]); + } + } + else if (args.length != 2) + { + throw new WrongUsageException("commands.title.usage", new Object[0]); + } + else + { + S45PacketTitle s45packettitle = new S45PacketTitle(s45packettitle$type, (IChatComponent)null); + entityplayermp.playerNetServerHandler.sendPacket(s45packettitle); + notifyOperators(sender, this, "commands.title.success", new Object[0]); + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : (args.length == 2 ? getListOfStringsMatchingLastWord(args, S45PacketTitle.Type.getNames()) : null); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandToggleDownfall.java b/src/minecraft/net/minecraft/command/CommandToggleDownfall.java new file mode 100644 index 0000000..88498dd --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandToggleDownfall.java @@ -0,0 +1,49 @@ +package net.minecraft.command; + +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.storage.WorldInfo; + +public class CommandToggleDownfall extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "toggledownfall"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.downfall.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + this.toggleDownfall(); + notifyOperators(sender, this, "commands.downfall.success", new Object[0]); + } + + /** + * Toggle rain and enable thundering. + */ + protected void toggleDownfall() + { + WorldInfo worldinfo = MinecraftServer.getServer().worldServers[0].getWorldInfo(); + worldinfo.setRaining(!worldinfo.isRaining()); + } +} diff --git a/src/minecraft/net/minecraft/command/CommandTrigger.java b/src/minecraft/net/minecraft/command/CommandTrigger.java new file mode 100644 index 0000000..725065c --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandTrigger.java @@ -0,0 +1,142 @@ +package net.minecraft.command; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.scoreboard.IScoreObjectiveCriteria; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandTrigger extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "trigger"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 0; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.trigger.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 3) + { + throw new WrongUsageException("commands.trigger.usage", new Object[0]); + } + else + { + EntityPlayerMP entityplayermp; + + if (sender instanceof EntityPlayerMP) + { + entityplayermp = (EntityPlayerMP)sender; + } + else + { + Entity entity = sender.getCommandSenderEntity(); + + if (!(entity instanceof EntityPlayerMP)) + { + throw new CommandException("commands.trigger.invalidPlayer", new Object[0]); + } + + entityplayermp = (EntityPlayerMP)entity; + } + + Scoreboard scoreboard = MinecraftServer.getServer().worldServerForDimension(0).getScoreboard(); + ScoreObjective scoreobjective = scoreboard.getObjective(args[0]); + + if (scoreobjective != null && scoreobjective.getCriteria() == IScoreObjectiveCriteria.TRIGGER) + { + int i = parseInt(args[2]); + + if (!scoreboard.entityHasObjective(entityplayermp.getName(), scoreobjective)) + { + throw new CommandException("commands.trigger.invalidObjective", new Object[] {args[0]}); + } + else + { + Score score = scoreboard.getValueFromObjective(entityplayermp.getName(), scoreobjective); + + if (score.isLocked()) + { + throw new CommandException("commands.trigger.disabled", new Object[] {args[0]}); + } + else + { + if ("set".equals(args[1])) + { + score.setScorePoints(i); + } + else + { + if (!"add".equals(args[1])) + { + throw new CommandException("commands.trigger.invalidMode", new Object[] {args[1]}); + } + + score.increseScore(i); + } + + score.setLocked(true); + + if (entityplayermp.theItemInWorldManager.isCreative()) + { + notifyOperators(sender, this, "commands.trigger.success", new Object[] {args[0], args[1], args[2]}); + } + } + } + } + else + { + throw new CommandException("commands.trigger.invalidObjective", new Object[] {args[0]}); + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + if (args.length == 1) + { + Scoreboard scoreboard = MinecraftServer.getServer().worldServerForDimension(0).getScoreboard(); + List list = Lists.newArrayList(); + + for (ScoreObjective scoreobjective : scoreboard.getScoreObjectives()) + { + if (scoreobjective.getCriteria() == IScoreObjectiveCriteria.TRIGGER) + { + list.add(scoreobjective.getName()); + } + } + + return getListOfStringsMatchingLastWord(args, (String[])list.toArray(new String[list.size()])); + } + else + { + return args.length == 2 ? getListOfStringsMatchingLastWord(args, new String[] {"add", "set"}): null; + } + } +} diff --git a/src/minecraft/net/minecraft/command/CommandWeather.java b/src/minecraft/net/minecraft/command/CommandWeather.java new file mode 100644 index 0000000..efdaa67 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandWeather.java @@ -0,0 +1,96 @@ +package net.minecraft.command; + +import java.util.List; +import java.util.Random; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.storage.WorldInfo; + +public class CommandWeather extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "weather"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.weather.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length >= 1 && args.length <= 2) + { + int i = (300 + (new Random()).nextInt(600)) * 20; + + if (args.length >= 2) + { + i = parseInt(args[1], 1, 1000000) * 20; + } + + World world = MinecraftServer.getServer().worldServers[0]; + WorldInfo worldinfo = world.getWorldInfo(); + + if ("clear".equalsIgnoreCase(args[0])) + { + worldinfo.setCleanWeatherTime(i); + worldinfo.setRainTime(0); + worldinfo.setThunderTime(0); + worldinfo.setRaining(false); + worldinfo.setThundering(false); + notifyOperators(sender, this, "commands.weather.clear", new Object[0]); + } + else if ("rain".equalsIgnoreCase(args[0])) + { + worldinfo.setCleanWeatherTime(0); + worldinfo.setRainTime(i); + worldinfo.setThunderTime(i); + worldinfo.setRaining(true); + worldinfo.setThundering(false); + notifyOperators(sender, this, "commands.weather.rain", new Object[0]); + } + else + { + if (!"thunder".equalsIgnoreCase(args[0])) + { + throw new WrongUsageException("commands.weather.usage", new Object[0]); + } + + worldinfo.setCleanWeatherTime(0); + worldinfo.setRainTime(i); + worldinfo.setThunderTime(i); + worldinfo.setRaining(true); + worldinfo.setThundering(true); + notifyOperators(sender, this, "commands.weather.thunder", new Object[0]); + } + } + else + { + throw new WrongUsageException("commands.weather.usage", new Object[0]); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, new String[] {"clear", "rain", "thunder"}): null; + } +} diff --git a/src/minecraft/net/minecraft/command/CommandWorldBorder.java b/src/minecraft/net/minecraft/command/CommandWorldBorder.java new file mode 100644 index 0000000..3c22746 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandWorldBorder.java @@ -0,0 +1,209 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.MathHelper; +import net.minecraft.world.border.WorldBorder; + +public class CommandWorldBorder extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "worldborder"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.worldborder.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 1) + { + throw new WrongUsageException("commands.worldborder.usage", new Object[0]); + } + else + { + WorldBorder worldborder = this.getWorldBorder(); + + if (args[0].equals("set")) + { + if (args.length != 2 && args.length != 3) + { + throw new WrongUsageException("commands.worldborder.set.usage", new Object[0]); + } + + double d0 = worldborder.getTargetSize(); + double d2 = parseDouble(args[1], 1.0D, 6.0E7D); + long i = args.length > 2 ? parseLong(args[2], 0L, 9223372036854775L) * 1000L : 0L; + + if (i > 0L) + { + worldborder.setTransition(d0, d2, i); + + if (d0 > d2) + { + notifyOperators(sender, this, "commands.worldborder.setSlowly.shrink.success", new Object[] {String.format("%.1f", new Object[]{Double.valueOf(d2)}), String.format("%.1f", new Object[]{Double.valueOf(d0)}), Long.toString(i / 1000L)}); + } + else + { + notifyOperators(sender, this, "commands.worldborder.setSlowly.grow.success", new Object[] {String.format("%.1f", new Object[]{Double.valueOf(d2)}), String.format("%.1f", new Object[]{Double.valueOf(d0)}), Long.toString(i / 1000L)}); + } + } + else + { + worldborder.setTransition(d2); + notifyOperators(sender, this, "commands.worldborder.set.success", new Object[] {String.format("%.1f", new Object[]{Double.valueOf(d2)}), String.format("%.1f", new Object[]{Double.valueOf(d0)})}); + } + } + else if (args[0].equals("add")) + { + if (args.length != 2 && args.length != 3) + { + throw new WrongUsageException("commands.worldborder.add.usage", new Object[0]); + } + + double d4 = worldborder.getDiameter(); + double d8 = d4 + parseDouble(args[1], -d4, 6.0E7D - d4); + long i1 = worldborder.getTimeUntilTarget() + (args.length > 2 ? parseLong(args[2], 0L, 9223372036854775L) * 1000L : 0L); + + if (i1 > 0L) + { + worldborder.setTransition(d4, d8, i1); + + if (d4 > d8) + { + notifyOperators(sender, this, "commands.worldborder.setSlowly.shrink.success", new Object[] {String.format("%.1f", new Object[]{Double.valueOf(d8)}), String.format("%.1f", new Object[]{Double.valueOf(d4)}), Long.toString(i1 / 1000L)}); + } + else + { + notifyOperators(sender, this, "commands.worldborder.setSlowly.grow.success", new Object[] {String.format("%.1f", new Object[]{Double.valueOf(d8)}), String.format("%.1f", new Object[]{Double.valueOf(d4)}), Long.toString(i1 / 1000L)}); + } + } + else + { + worldborder.setTransition(d8); + notifyOperators(sender, this, "commands.worldborder.set.success", new Object[] {String.format("%.1f", new Object[]{Double.valueOf(d8)}), String.format("%.1f", new Object[]{Double.valueOf(d4)})}); + } + } + else if (args[0].equals("center")) + { + if (args.length != 3) + { + throw new WrongUsageException("commands.worldborder.center.usage", new Object[0]); + } + + BlockPos blockpos = sender.getPosition(); + double d1 = parseDouble((double)blockpos.getX() + 0.5D, args[1], true); + double d3 = parseDouble((double)blockpos.getZ() + 0.5D, args[2], true); + worldborder.setCenter(d1, d3); + notifyOperators(sender, this, "commands.worldborder.center.success", new Object[] {Double.valueOf(d1), Double.valueOf(d3)}); + } + else if (args[0].equals("damage")) + { + if (args.length < 2) + { + throw new WrongUsageException("commands.worldborder.damage.usage", new Object[0]); + } + + if (args[1].equals("buffer")) + { + if (args.length != 3) + { + throw new WrongUsageException("commands.worldborder.damage.buffer.usage", new Object[0]); + } + + double d5 = parseDouble(args[2], 0.0D); + double d9 = worldborder.getDamageBuffer(); + worldborder.setDamageBuffer(d5); + notifyOperators(sender, this, "commands.worldborder.damage.buffer.success", new Object[] {String.format("%.1f", new Object[]{Double.valueOf(d5)}), String.format("%.1f", new Object[]{Double.valueOf(d9)})}); + } + else if (args[1].equals("amount")) + { + if (args.length != 3) + { + throw new WrongUsageException("commands.worldborder.damage.amount.usage", new Object[0]); + } + + double d6 = parseDouble(args[2], 0.0D); + double d10 = worldborder.getDamageAmount(); + worldborder.setDamageAmount(d6); + notifyOperators(sender, this, "commands.worldborder.damage.amount.success", new Object[] {String.format("%.2f", new Object[]{Double.valueOf(d6)}), String.format("%.2f", new Object[]{Double.valueOf(d10)})}); + } + } + else if (args[0].equals("warning")) + { + if (args.length < 2) + { + throw new WrongUsageException("commands.worldborder.warning.usage", new Object[0]); + } + + int j = parseInt(args[2], 0); + + if (args[1].equals("time")) + { + if (args.length != 3) + { + throw new WrongUsageException("commands.worldborder.warning.time.usage", new Object[0]); + } + + int k = worldborder.getWarningTime(); + worldborder.setWarningTime(j); + notifyOperators(sender, this, "commands.worldborder.warning.time.success", new Object[] {Integer.valueOf(j), Integer.valueOf(k)}); + } + else if (args[1].equals("distance")) + { + if (args.length != 3) + { + throw new WrongUsageException("commands.worldborder.warning.distance.usage", new Object[0]); + } + + int l = worldborder.getWarningDistance(); + worldborder.setWarningDistance(j); + notifyOperators(sender, this, "commands.worldborder.warning.distance.success", new Object[] {Integer.valueOf(j), Integer.valueOf(l)}); + } + } + else + { + if (!args[0].equals("get")) + { + throw new WrongUsageException("commands.worldborder.usage", new Object[0]); + } + + double d7 = worldborder.getDiameter(); + sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, MathHelper.floor_double(d7 + 0.5D)); + sender.addChatMessage(new ChatComponentTranslation("commands.worldborder.get.success", new Object[] {String.format("%.0f", new Object[]{Double.valueOf(d7)})})); + } + } + } + + protected WorldBorder getWorldBorder() + { + return MinecraftServer.getServer().worldServers[0].getWorldBorder(); + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, new String[] {"set", "center", "damage", "warning", "add", "get"}): (args.length == 2 && args[0].equals("damage") ? getListOfStringsMatchingLastWord(args, new String[] {"buffer", "amount"}): (args.length >= 2 && args.length <= 3 && args[0].equals("center") ? func_181043_b(args, 1, pos) : (args.length == 2 && args[0].equals("warning") ? getListOfStringsMatchingLastWord(args, new String[] {"time", "distance"}): null))); + } +} diff --git a/src/minecraft/net/minecraft/command/CommandXP.java b/src/minecraft/net/minecraft/command/CommandXP.java new file mode 100644 index 0000000..84158a8 --- /dev/null +++ b/src/minecraft/net/minecraft/command/CommandXP.java @@ -0,0 +1,110 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandXP extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "xp"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.xp.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length <= 0) + { + throw new WrongUsageException("commands.xp.usage", new Object[0]); + } + else + { + String s = args[0]; + boolean flag = s.endsWith("l") || s.endsWith("L"); + + if (flag && s.length() > 1) + { + s = s.substring(0, s.length() - 1); + } + + int i = parseInt(s); + boolean flag1 = i < 0; + + if (flag1) + { + i *= -1; + } + + EntityPlayer entityplayer = args.length > 1 ? getPlayer(sender, args[1]) : getCommandSenderAsPlayer(sender); + + if (flag) + { + sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, entityplayer.experienceLevel); + + if (flag1) + { + entityplayer.addExperienceLevel(-i); + notifyOperators(sender, this, "commands.xp.success.negative.levels", new Object[] {Integer.valueOf(i), entityplayer.getName()}); + } + else + { + entityplayer.addExperienceLevel(i); + notifyOperators(sender, this, "commands.xp.success.levels", new Object[] {Integer.valueOf(i), entityplayer.getName()}); + } + } + else + { + sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, entityplayer.experienceTotal); + + if (flag1) + { + throw new CommandException("commands.xp.failure.widthdrawXp", new Object[0]); + } + + entityplayer.addExperience(i); + notifyOperators(sender, this, "commands.xp.success", new Object[] {Integer.valueOf(i), entityplayer.getName()}); + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 2 ? getListOfStringsMatchingLastWord(args, this.getAllUsernames()) : null; + } + + protected String[] getAllUsernames() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 1; + } +} diff --git a/src/minecraft/net/minecraft/command/EntityNotFoundException.java b/src/minecraft/net/minecraft/command/EntityNotFoundException.java new file mode 100644 index 0000000..ed735b7 --- /dev/null +++ b/src/minecraft/net/minecraft/command/EntityNotFoundException.java @@ -0,0 +1,14 @@ +package net.minecraft.command; + +public class EntityNotFoundException extends CommandException +{ + public EntityNotFoundException() + { + this("commands.generic.entity.notFound", new Object[0]); + } + + public EntityNotFoundException(String p_i46035_1_, Object... p_i46035_2_) + { + super(p_i46035_1_, p_i46035_2_); + } +} diff --git a/src/minecraft/net/minecraft/command/IAdminCommand.java b/src/minecraft/net/minecraft/command/IAdminCommand.java new file mode 100644 index 0000000..d306e08 --- /dev/null +++ b/src/minecraft/net/minecraft/command/IAdminCommand.java @@ -0,0 +1,9 @@ +package net.minecraft.command; + +public interface IAdminCommand +{ + /** + * Send an informative message to the server operators + */ + void notifyOperators(ICommandSender sender, ICommand command, int flags, String msgFormat, Object... msgParams); +} diff --git a/src/minecraft/net/minecraft/command/ICommand.java b/src/minecraft/net/minecraft/command/ICommand.java new file mode 100644 index 0000000..96f5048 --- /dev/null +++ b/src/minecraft/net/minecraft/command/ICommand.java @@ -0,0 +1,36 @@ +package net.minecraft.command; + +import java.util.List; +import net.minecraft.util.BlockPos; + +public interface ICommand extends Comparable +{ + /** + * Gets the name of the command + */ + String getCommandName(); + + /** + * Gets the usage string for the command. + */ + String getCommandUsage(ICommandSender sender); + + List getCommandAliases(); + + /** + * Callback when the command is invoked + */ + void processCommand(ICommandSender sender, String[] args) throws CommandException; + + /** + * Returns true if the given command sender is allowed to use this command. + */ + boolean canCommandSenderUseCommand(ICommandSender sender); + + List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos); + + /** + * Return whether the specified command parameter index is a username parameter. + */ + boolean isUsernameIndex(String[] args, int index); +} diff --git a/src/minecraft/net/minecraft/command/ICommandManager.java b/src/minecraft/net/minecraft/command/ICommandManager.java new file mode 100644 index 0000000..5991fd9 --- /dev/null +++ b/src/minecraft/net/minecraft/command/ICommandManager.java @@ -0,0 +1,16 @@ +package net.minecraft.command; + +import java.util.List; +import java.util.Map; +import net.minecraft.util.BlockPos; + +public interface ICommandManager +{ + int executeCommand(ICommandSender sender, String rawCommand); + + List getTabCompletionOptions(ICommandSender sender, String input, BlockPos pos); + + List getPossibleCommands(ICommandSender sender); + + Map getCommands(); +} diff --git a/src/minecraft/net/minecraft/command/ICommandSender.java b/src/minecraft/net/minecraft/command/ICommandSender.java new file mode 100644 index 0000000..445846a --- /dev/null +++ b/src/minecraft/net/minecraft/command/ICommandSender.java @@ -0,0 +1,60 @@ +package net.minecraft.command; + +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public interface ICommandSender +{ + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + String getName(); + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + IChatComponent getDisplayName(); + + /** + * Send a chat message to the CommandSender + */ + void addChatMessage(IChatComponent component); + + /** + * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not + */ + boolean canCommandSenderUseCommand(int permLevel, String commandName); + + /** + * Get the position in the world. {@code null} is not allowed! If you are not an entity in the world, return + * the coordinates 0, 0, 0 + */ + BlockPos getPosition(); + + /** + * Get the position vector. {@code null} is not allowed! If you are not an entity in the world, return 0.0D, + * 0.0D, 0.0D + */ + Vec3 getPositionVector(); + + /** + * Get the world, if available. {@code null} is not allowed! If you are not an entity in the world, return + * the overworld + */ + World getEntityWorld(); + + /** + * Returns the entity associated with the command sender. MAY BE NULL! + */ + Entity getCommandSenderEntity(); + + /** + * Returns true if the command sender should be sent feedback about executed commands + */ + boolean sendCommandFeedback(); + + void setCommandStat(CommandResultStats.Type type, int amount); +} diff --git a/src/minecraft/net/minecraft/command/NumberInvalidException.java b/src/minecraft/net/minecraft/command/NumberInvalidException.java new file mode 100644 index 0000000..5565979 --- /dev/null +++ b/src/minecraft/net/minecraft/command/NumberInvalidException.java @@ -0,0 +1,14 @@ +package net.minecraft.command; + +public class NumberInvalidException extends CommandException +{ + public NumberInvalidException() + { + this("commands.generic.num.invalid", new Object[0]); + } + + public NumberInvalidException(String message, Object... replacements) + { + super(message, replacements); + } +} diff --git a/src/minecraft/net/minecraft/command/PlayerNotFoundException.java b/src/minecraft/net/minecraft/command/PlayerNotFoundException.java new file mode 100644 index 0000000..0935e87 --- /dev/null +++ b/src/minecraft/net/minecraft/command/PlayerNotFoundException.java @@ -0,0 +1,14 @@ +package net.minecraft.command; + +public class PlayerNotFoundException extends CommandException +{ + public PlayerNotFoundException() + { + this("commands.generic.player.notFound", new Object[0]); + } + + public PlayerNotFoundException(String message, Object... replacements) + { + super(message, replacements); + } +} diff --git a/src/minecraft/net/minecraft/command/PlayerSelector.java b/src/minecraft/net/minecraft/command/PlayerSelector.java new file mode 100644 index 0000000..a70479b --- /dev/null +++ b/src/minecraft/net/minecraft/command/PlayerSelector.java @@ -0,0 +1,729 @@ +package net.minecraft.command; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.common.collect.ComparisonChain; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.scoreboard.Team; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.WorldSettings; + +public class PlayerSelector +{ + /** + * This matches the at-tokens introduced for command blocks, including their arguments, if any. + */ + private static final Pattern tokenPattern = Pattern.compile("^@([pare])(?:\\[([\\w=,!-]*)\\])?$"); + + /** + * This matches things like "-1,,4", and is used for getting x,y,z,range from the token's argument list. + */ + private static final Pattern intListPattern = Pattern.compile("\\G([-!]?[\\w-]*)(?:$|,)"); + + /** + * This matches things like "rm=4,c=2" and is used for handling named token arguments. + */ + private static final Pattern keyValueListPattern = Pattern.compile("\\G(\\w+)=([-!]?[\\w-]*)(?:$|,)"); + private static final Set WORLD_BINDING_ARGS = Sets.newHashSet(new String[] {"x", "y", "z", "dx", "dy", "dz", "rm", "r"}); + + /** + * Returns the one player that matches the given at-token. Returns null if more than one player matches. + */ + public static EntityPlayerMP matchOnePlayer(ICommandSender sender, String token) + { + return (EntityPlayerMP)matchOneEntity(sender, token, EntityPlayerMP.class); + } + + public static T matchOneEntity(ICommandSender sender, String token, Class targetClass) + { + List list = matchEntities(sender, token, targetClass); + return (T)(list.size() == 1 ? (Entity)list.get(0) : null); + } + + public static IChatComponent matchEntitiesToChatComponent(ICommandSender sender, String token) + { + List list = matchEntities(sender, token, Entity.class); + + if (list.isEmpty()) + { + return null; + } + else + { + List list1 = Lists.newArrayList(); + + for (Entity entity : list) + { + list1.add(entity.getDisplayName()); + } + + return CommandBase.join(list1); + } + } + + public static List matchEntities(ICommandSender sender, String token, Class targetClass) + { + Matcher matcher = tokenPattern.matcher(token); + + if (matcher.matches() && sender.canCommandSenderUseCommand(1, "@")) + { + Map map = getArgumentMap(matcher.group(2)); + + if (!isEntityTypeValid(sender, map)) + { + return Collections.emptyList(); + } + else + { + String s = matcher.group(1); + BlockPos blockpos = func_179664_b(map, sender.getPosition()); + List list = getWorlds(sender, map); + List list1 = Lists.newArrayList(); + + for (World world : list) + { + if (world != null) + { + List> list2 = Lists.>newArrayList(); + list2.addAll(func_179663_a(map, s)); + list2.addAll(func_179648_b(map)); + list2.addAll(func_179649_c(map)); + list2.addAll(func_179659_d(map)); + list2.addAll(func_179657_e(map)); + list2.addAll(func_179647_f(map)); + list2.addAll(func_180698_a(map, blockpos)); + list2.addAll(func_179662_g(map)); + list1.addAll(filterResults(map, targetClass, list2, s, world, blockpos)); + } + } + + return func_179658_a(list1, map, sender, targetClass, s, blockpos); + } + } + else + { + return Collections.emptyList(); + } + } + + private static List getWorlds(ICommandSender sender, Map argumentMap) + { + List list = Lists.newArrayList(); + + if (func_179665_h(argumentMap)) + { + list.add(sender.getEntityWorld()); + } + else + { + Collections.addAll(list, MinecraftServer.getServer().worldServers); + } + + return list; + } + + private static boolean isEntityTypeValid(ICommandSender commandSender, Map params) + { + String s = func_179651_b(params, "type"); + s = s != null && s.startsWith("!") ? s.substring(1) : s; + + if (s != null && !EntityList.isStringValidEntityName(s)) + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.generic.entity.invalidType", new Object[] {s}); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); + commandSender.addChatMessage(chatcomponenttranslation); + return false; + } + else + { + return true; + } + } + + private static List> func_179663_a(Map p_179663_0_, String p_179663_1_) + { + List> list = Lists.>newArrayList(); + String s = func_179651_b(p_179663_0_, "type"); + final boolean flag = s != null && s.startsWith("!"); + + if (flag) + { + s = s.substring(1); + } + + boolean flag1 = !p_179663_1_.equals("e"); + boolean flag2 = p_179663_1_.equals("r") && s != null; + + if ((s == null || !p_179663_1_.equals("e")) && !flag2) + { + if (flag1) + { + list.add(new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_ instanceof EntityPlayer; + } + }); + } + } + else + { + final String s_f = s; + list.add(new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return EntityList.isStringEntityName(p_apply_1_, s_f) != flag; + } + }); + } + + return list; + } + + private static List> func_179648_b(Map p_179648_0_) + { + List> list = Lists.>newArrayList(); + final int i = parseIntWithDefault(p_179648_0_, "lm", -1); + final int j = parseIntWithDefault(p_179648_0_, "l", -1); + + if (i > -1 || j > -1) + { + list.add(new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + if (!(p_apply_1_ instanceof EntityPlayerMP)) + { + return false; + } + else + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)p_apply_1_; + return (i <= -1 || entityplayermp.experienceLevel >= i) && (j <= -1 || entityplayermp.experienceLevel <= j); + } + } + }); + } + + return list; + } + + private static List> func_179649_c(Map p_179649_0_) + { + List> list = Lists.>newArrayList(); + final int i = parseIntWithDefault(p_179649_0_, "m", WorldSettings.GameType.NOT_SET.getID()); + + if (i != WorldSettings.GameType.NOT_SET.getID()) + { + list.add(new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + if (!(p_apply_1_ instanceof EntityPlayerMP)) + { + return false; + } + else + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)p_apply_1_; + return entityplayermp.theItemInWorldManager.getGameType().getID() == i; + } + } + }); + } + + return list; + } + + private static List> func_179659_d(Map p_179659_0_) + { + List> list = Lists.>newArrayList(); + String s = func_179651_b(p_179659_0_, "team"); + final boolean flag = s != null && s.startsWith("!"); + + if (flag) + { + s = s.substring(1); + } + + if (s != null) + { + final String s_f = s; + list.add(new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + if (!(p_apply_1_ instanceof EntityLivingBase)) + { + return false; + } + else + { + EntityLivingBase entitylivingbase = (EntityLivingBase)p_apply_1_; + Team team = entitylivingbase.getTeam(); + String s1 = team == null ? "" : team.getRegisteredName(); + return s1.equals(s_f) != flag; + } + } + }); + } + + return list; + } + + private static List> func_179657_e(Map p_179657_0_) + { + List> list = Lists.>newArrayList(); + final Map map = func_96560_a(p_179657_0_); + + if (map != null && map.size() > 0) + { + list.add(new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + Scoreboard scoreboard = MinecraftServer.getServer().worldServerForDimension(0).getScoreboard(); + + for (Entry entry : map.entrySet()) + { + String s = (String)entry.getKey(); + boolean flag = false; + + if (s.endsWith("_min") && s.length() > 4) + { + flag = true; + s = s.substring(0, s.length() - 4); + } + + ScoreObjective scoreobjective = scoreboard.getObjective(s); + + if (scoreobjective == null) + { + return false; + } + + String s1 = p_apply_1_ instanceof EntityPlayerMP ? p_apply_1_.getName() : p_apply_1_.getUniqueID().toString(); + + if (!scoreboard.entityHasObjective(s1, scoreobjective)) + { + return false; + } + + Score score = scoreboard.getValueFromObjective(s1, scoreobjective); + int i = score.getScorePoints(); + + if (i < ((Integer)entry.getValue()).intValue() && flag) + { + return false; + } + + if (i > ((Integer)entry.getValue()).intValue() && !flag) + { + return false; + } + } + + return true; + } + }); + } + + return list; + } + + private static List> func_179647_f(Map p_179647_0_) + { + List> list = Lists.>newArrayList(); + String s = func_179651_b(p_179647_0_, "name"); + final boolean flag = s != null && s.startsWith("!"); + + if (flag) + { + s = s.substring(1); + } + + if (s != null) + { + final String s_f = s; + list.add(new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_.getName().equals(s_f) != flag; + } + }); + } + + return list; + } + + private static List> func_180698_a(Map p_180698_0_, final BlockPos p_180698_1_) + { + List> list = Lists.>newArrayList(); + final int i = parseIntWithDefault(p_180698_0_, "rm", -1); + final int j = parseIntWithDefault(p_180698_0_, "r", -1); + + if (p_180698_1_ != null && (i >= 0 || j >= 0)) + { + final int k = i * i; + final int l = j * j; + list.add(new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + int i1 = (int)p_apply_1_.getDistanceSqToCenter(p_180698_1_); + return (i < 0 || i1 >= k) && (j < 0 || i1 <= l); + } + }); + } + + return list; + } + + private static List> func_179662_g(Map p_179662_0_) + { + List> list = Lists.>newArrayList(); + + if (p_179662_0_.containsKey("rym") || p_179662_0_.containsKey("ry")) + { + final int i = func_179650_a(parseIntWithDefault(p_179662_0_, "rym", 0)); + final int j = func_179650_a(parseIntWithDefault(p_179662_0_, "ry", 359)); + list.add(new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + int i1 = PlayerSelector.func_179650_a((int)Math.floor((double)p_apply_1_.rotationYaw)); + return i > j ? i1 >= i || i1 <= j : i1 >= i && i1 <= j; + } + }); + } + + if (p_179662_0_.containsKey("rxm") || p_179662_0_.containsKey("rx")) + { + final int k = func_179650_a(parseIntWithDefault(p_179662_0_, "rxm", 0)); + final int l = func_179650_a(parseIntWithDefault(p_179662_0_, "rx", 359)); + list.add(new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + int i1 = PlayerSelector.func_179650_a((int)Math.floor((double)p_apply_1_.rotationPitch)); + return k > l ? i1 >= k || i1 <= l : i1 >= k && i1 <= l; + } + }); + } + + return list; + } + + private static List filterResults(Map params, Class entityClass, List> inputList, String type, World worldIn, BlockPos position) + { + List list = Lists.newArrayList(); + String s = func_179651_b(params, "type"); + s = s != null && s.startsWith("!") ? s.substring(1) : s; + boolean flag = !type.equals("e"); + boolean flag1 = type.equals("r") && s != null; + int i = parseIntWithDefault(params, "dx", 0); + int j = parseIntWithDefault(params, "dy", 0); + int k = parseIntWithDefault(params, "dz", 0); + int l = parseIntWithDefault(params, "r", -1); + Predicate predicate = Predicates.and(inputList); + Predicate predicate1 = Predicates. and (EntitySelectors.selectAnything, predicate); + + if (position != null) + { + int i1 = worldIn.playerEntities.size(); + int j1 = worldIn.loadedEntityList.size(); + boolean flag2 = i1 < j1 / 16; + + if (!params.containsKey("dx") && !params.containsKey("dy") && !params.containsKey("dz")) + { + if (l >= 0) + { + AxisAlignedBB axisalignedbb1 = new AxisAlignedBB((double)(position.getX() - l), (double)(position.getY() - l), (double)(position.getZ() - l), (double)(position.getX() + l + 1), (double)(position.getY() + l + 1), (double)(position.getZ() + l + 1)); + + if (flag && flag2 && !flag1) + { + list.addAll(worldIn.getPlayers(entityClass, predicate1)); + } + else + { + list.addAll(worldIn.getEntitiesWithinAABB(entityClass, axisalignedbb1, predicate1)); + } + } + else if (type.equals("a")) + { + list.addAll(worldIn.getPlayers(entityClass, predicate)); + } + else if (!type.equals("p") && (!type.equals("r") || flag1)) + { + list.addAll(worldIn.getEntities(entityClass, predicate1)); + } + else + { + list.addAll(worldIn.getPlayers(entityClass, predicate1)); + } + } + else + { + final AxisAlignedBB axisalignedbb = func_179661_a(position, i, j, k); + + if (flag && flag2 && !flag1) + { + Predicate predicate2 = new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_.posX >= axisalignedbb.minX && p_apply_1_.posY >= axisalignedbb.minY && p_apply_1_.posZ >= axisalignedbb.minZ ? p_apply_1_.posX < axisalignedbb.maxX && p_apply_1_.posY < axisalignedbb.maxY && p_apply_1_.posZ < axisalignedbb.maxZ : false; + } + }; + list.addAll(worldIn.getPlayers(entityClass, Predicates. and (predicate1, predicate2))); + } + else + { + list.addAll(worldIn.getEntitiesWithinAABB(entityClass, axisalignedbb, predicate1)); + } + } + } + else if (type.equals("a")) + { + list.addAll(worldIn.getPlayers(entityClass, predicate)); + } + else if (!type.equals("p") && (!type.equals("r") || flag1)) + { + list.addAll(worldIn.getEntities(entityClass, predicate1)); + } + else + { + list.addAll(worldIn.getPlayers(entityClass, predicate1)); + } + + return list; + } + + private static List func_179658_a(List p_179658_0_, Map p_179658_1_, ICommandSender p_179658_2_, Class p_179658_3_, String p_179658_4_, final BlockPos p_179658_5_) + { + int i = parseIntWithDefault(p_179658_1_, "c", !p_179658_4_.equals("a") && !p_179658_4_.equals("e") ? 1 : 0); + + if (!p_179658_4_.equals("p") && !p_179658_4_.equals("a") && !p_179658_4_.equals("e")) + { + if (p_179658_4_.equals("r")) + { + Collections.shuffle((List)p_179658_0_); + } + } + else if (p_179658_5_ != null) + { + Collections.sort((List)p_179658_0_, new Comparator() + { + public int compare(Entity p_compare_1_, Entity p_compare_2_) + { + return ComparisonChain.start().compare(p_compare_1_.getDistanceSq(p_179658_5_), p_compare_2_.getDistanceSq(p_179658_5_)).result(); + } + }); + } + + Entity entity = p_179658_2_.getCommandSenderEntity(); + + if (entity != null && p_179658_3_.isAssignableFrom(entity.getClass()) && i == 1 && ((List)p_179658_0_).contains(entity) && !"r".equals(p_179658_4_)) + { + p_179658_0_ = Lists.newArrayList((T)entity); + } + + if (i != 0) + { + if (i < 0) + { + Collections.reverse((List)p_179658_0_); + } + + p_179658_0_ = ((List)p_179658_0_).subList(0, Math.min(Math.abs(i), ((List)p_179658_0_).size())); + } + + return (List)p_179658_0_; + } + + private static AxisAlignedBB func_179661_a(BlockPos p_179661_0_, int p_179661_1_, int p_179661_2_, int p_179661_3_) + { + boolean flag = p_179661_1_ < 0; + boolean flag1 = p_179661_2_ < 0; + boolean flag2 = p_179661_3_ < 0; + int i = p_179661_0_.getX() + (flag ? p_179661_1_ : 0); + int j = p_179661_0_.getY() + (flag1 ? p_179661_2_ : 0); + int k = p_179661_0_.getZ() + (flag2 ? p_179661_3_ : 0); + int l = p_179661_0_.getX() + (flag ? 0 : p_179661_1_) + 1; + int i1 = p_179661_0_.getY() + (flag1 ? 0 : p_179661_2_) + 1; + int j1 = p_179661_0_.getZ() + (flag2 ? 0 : p_179661_3_) + 1; + return new AxisAlignedBB((double)i, (double)j, (double)k, (double)l, (double)i1, (double)j1); + } + + public static int func_179650_a(int p_179650_0_) + { + p_179650_0_ = p_179650_0_ % 360; + + if (p_179650_0_ >= 160) + { + p_179650_0_ -= 360; + } + + if (p_179650_0_ < 0) + { + p_179650_0_ += 360; + } + + return p_179650_0_; + } + + private static BlockPos func_179664_b(Map p_179664_0_, BlockPos p_179664_1_) + { + return new BlockPos(parseIntWithDefault(p_179664_0_, "x", p_179664_1_.getX()), parseIntWithDefault(p_179664_0_, "y", p_179664_1_.getY()), parseIntWithDefault(p_179664_0_, "z", p_179664_1_.getZ())); + } + + private static boolean func_179665_h(Map p_179665_0_) + { + for (String s : WORLD_BINDING_ARGS) + { + if (p_179665_0_.containsKey(s)) + { + return true; + } + } + + return false; + } + + private static int parseIntWithDefault(Map p_179653_0_, String p_179653_1_, int p_179653_2_) + { + return p_179653_0_.containsKey(p_179653_1_) ? MathHelper.parseIntWithDefault((String)p_179653_0_.get(p_179653_1_), p_179653_2_) : p_179653_2_; + } + + private static String func_179651_b(Map p_179651_0_, String p_179651_1_) + { + return (String)p_179651_0_.get(p_179651_1_); + } + + public static Map func_96560_a(Map p_96560_0_) + { + Map map = Maps.newHashMap(); + + for (String s : p_96560_0_.keySet()) + { + if (s.startsWith("score_") && s.length() > "score_".length()) + { + map.put(s.substring("score_".length()), Integer.valueOf(MathHelper.parseIntWithDefault((String)p_96560_0_.get(s), 1))); + } + } + + return map; + } + + /** + * Returns whether the given pattern can match more than one player. + */ + public static boolean matchesMultiplePlayers(String p_82377_0_) + { + Matcher matcher = tokenPattern.matcher(p_82377_0_); + + if (!matcher.matches()) + { + return false; + } + else + { + Map map = getArgumentMap(matcher.group(2)); + String s = matcher.group(1); + int i = !"a".equals(s) && !"e".equals(s) ? 1 : 0; + return parseIntWithDefault(map, "c", i) != 1; + } + } + + /** + * Returns whether the given token has any arguments set. + */ + public static boolean hasArguments(String p_82378_0_) + { + return tokenPattern.matcher(p_82378_0_).matches(); + } + + private static Map getArgumentMap(String argumentString) + { + Map map = Maps.newHashMap(); + + if (argumentString == null) + { + return map; + } + else + { + int i = 0; + int j = -1; + + for (Matcher matcher = intListPattern.matcher(argumentString); matcher.find(); j = matcher.end()) + { + String s = null; + + switch (i++) + { + case 0: + s = "x"; + break; + + case 1: + s = "y"; + break; + + case 2: + s = "z"; + break; + + case 3: + s = "r"; + } + + if (s != null && matcher.group(1).length() > 0) + { + map.put(s, matcher.group(1)); + } + } + + if (j < argumentString.length()) + { + Matcher matcher1 = keyValueListPattern.matcher(j == -1 ? argumentString : argumentString.substring(j)); + + while (matcher1.find()) + { + map.put(matcher1.group(1), matcher1.group(2)); + } + } + + return map; + } + } +} diff --git a/src/minecraft/net/minecraft/command/ServerCommandManager.java b/src/minecraft/net/minecraft/command/ServerCommandManager.java new file mode 100644 index 0000000..448ec3a --- /dev/null +++ b/src/minecraft/net/minecraft/command/ServerCommandManager.java @@ -0,0 +1,162 @@ +package net.minecraft.command; + +import net.minecraft.command.server.CommandAchievement; +import net.minecraft.command.server.CommandBanIp; +import net.minecraft.command.server.CommandBanPlayer; +import net.minecraft.command.server.CommandBlockLogic; +import net.minecraft.command.server.CommandBroadcast; +import net.minecraft.command.server.CommandDeOp; +import net.minecraft.command.server.CommandEmote; +import net.minecraft.command.server.CommandListBans; +import net.minecraft.command.server.CommandListPlayers; +import net.minecraft.command.server.CommandMessage; +import net.minecraft.command.server.CommandMessageRaw; +import net.minecraft.command.server.CommandOp; +import net.minecraft.command.server.CommandPardonIp; +import net.minecraft.command.server.CommandPardonPlayer; +import net.minecraft.command.server.CommandPublishLocalServer; +import net.minecraft.command.server.CommandSaveAll; +import net.minecraft.command.server.CommandSaveOff; +import net.minecraft.command.server.CommandSaveOn; +import net.minecraft.command.server.CommandScoreboard; +import net.minecraft.command.server.CommandSetBlock; +import net.minecraft.command.server.CommandSetDefaultSpawnpoint; +import net.minecraft.command.server.CommandStop; +import net.minecraft.command.server.CommandSummon; +import net.minecraft.command.server.CommandTeleport; +import net.minecraft.command.server.CommandTestFor; +import net.minecraft.command.server.CommandTestForBlock; +import net.minecraft.command.server.CommandWhitelist; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.rcon.RConConsoleSource; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; + +public class ServerCommandManager extends CommandHandler implements IAdminCommand +{ + public ServerCommandManager() + { + this.registerCommand(new CommandTime()); + this.registerCommand(new CommandGameMode()); + this.registerCommand(new CommandDifficulty()); + this.registerCommand(new CommandDefaultGameMode()); + this.registerCommand(new CommandKill()); + this.registerCommand(new CommandToggleDownfall()); + this.registerCommand(new CommandWeather()); + this.registerCommand(new CommandXP()); + this.registerCommand(new CommandTeleport()); + this.registerCommand(new CommandGive()); + this.registerCommand(new CommandReplaceItem()); + this.registerCommand(new CommandStats()); + this.registerCommand(new CommandEffect()); + this.registerCommand(new CommandEnchant()); + this.registerCommand(new CommandParticle()); + this.registerCommand(new CommandEmote()); + this.registerCommand(new CommandShowSeed()); + this.registerCommand(new CommandHelp()); + this.registerCommand(new CommandDebug()); + this.registerCommand(new CommandMessage()); + this.registerCommand(new CommandBroadcast()); + this.registerCommand(new CommandSetSpawnpoint()); + this.registerCommand(new CommandSetDefaultSpawnpoint()); + this.registerCommand(new CommandGameRule()); + this.registerCommand(new CommandClearInventory()); + this.registerCommand(new CommandTestFor()); + this.registerCommand(new CommandSpreadPlayers()); + this.registerCommand(new CommandPlaySound()); + this.registerCommand(new CommandScoreboard()); + this.registerCommand(new CommandExecuteAt()); + this.registerCommand(new CommandTrigger()); + this.registerCommand(new CommandAchievement()); + this.registerCommand(new CommandSummon()); + this.registerCommand(new CommandSetBlock()); + this.registerCommand(new CommandFill()); + this.registerCommand(new CommandClone()); + this.registerCommand(new CommandCompare()); + this.registerCommand(new CommandBlockData()); + this.registerCommand(new CommandTestForBlock()); + this.registerCommand(new CommandMessageRaw()); + this.registerCommand(new CommandWorldBorder()); + this.registerCommand(new CommandTitle()); + this.registerCommand(new CommandEntityData()); + + if (MinecraftServer.getServer().isDedicatedServer()) + { + this.registerCommand(new CommandOp()); + this.registerCommand(new CommandDeOp()); + this.registerCommand(new CommandStop()); + this.registerCommand(new CommandSaveAll()); + this.registerCommand(new CommandSaveOff()); + this.registerCommand(new CommandSaveOn()); + this.registerCommand(new CommandBanIp()); + this.registerCommand(new CommandPardonIp()); + this.registerCommand(new CommandBanPlayer()); + this.registerCommand(new CommandListBans()); + this.registerCommand(new CommandPardonPlayer()); + this.registerCommand(new CommandServerKick()); + this.registerCommand(new CommandListPlayers()); + this.registerCommand(new CommandWhitelist()); + this.registerCommand(new CommandSetPlayerTimeout()); + } + else + { + this.registerCommand(new CommandPublishLocalServer()); + } + + CommandBase.setAdminCommander(this); + } + + /** + * Send an informative message to the server operators + */ + public void notifyOperators(ICommandSender sender, ICommand command, int flags, String msgFormat, Object... msgParams) + { + boolean flag = true; + MinecraftServer minecraftserver = MinecraftServer.getServer(); + + if (!sender.sendCommandFeedback()) + { + flag = false; + } + + IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.admin", new Object[] {sender.getName(), new ChatComponentTranslation(msgFormat, msgParams)}); + ichatcomponent.getChatStyle().setColor(EnumChatFormatting.GRAY); + ichatcomponent.getChatStyle().setItalic(Boolean.valueOf(true)); + + if (flag) + { + for (EntityPlayer entityplayer : minecraftserver.getConfigurationManager().func_181057_v()) + { + if (entityplayer != sender && minecraftserver.getConfigurationManager().canSendCommands(entityplayer.getGameProfile()) && command.canCommandSenderUseCommand(sender)) + { + boolean flag1 = sender instanceof MinecraftServer && MinecraftServer.getServer().func_183002_r(); + boolean flag2 = sender instanceof RConConsoleSource && MinecraftServer.getServer().func_181034_q(); + + if (flag1 || flag2 || !(sender instanceof RConConsoleSource) && !(sender instanceof MinecraftServer)) + { + entityplayer.addChatMessage(ichatcomponent); + } + } + } + } + + if (sender != minecraftserver && minecraftserver.worldServers[0].getGameRules().getBoolean("logAdminCommands")) + { + minecraftserver.addChatMessage(ichatcomponent); + } + + boolean flag3 = minecraftserver.worldServers[0].getGameRules().getBoolean("sendCommandFeedback"); + + if (sender instanceof CommandBlockLogic) + { + flag3 = ((CommandBlockLogic)sender).shouldTrackOutput(); + } + + if ((flags & 1) != 1 && flag3 || sender instanceof MinecraftServer) + { + sender.addChatMessage(new ChatComponentTranslation(msgFormat, msgParams)); + } + } +} diff --git a/src/minecraft/net/minecraft/command/SyntaxErrorException.java b/src/minecraft/net/minecraft/command/SyntaxErrorException.java new file mode 100644 index 0000000..ba62714 --- /dev/null +++ b/src/minecraft/net/minecraft/command/SyntaxErrorException.java @@ -0,0 +1,14 @@ +package net.minecraft.command; + +public class SyntaxErrorException extends CommandException +{ + public SyntaxErrorException() + { + this("commands.generic.snytax", new Object[0]); + } + + public SyntaxErrorException(String message, Object... replacements) + { + super(message, replacements); + } +} diff --git a/src/minecraft/net/minecraft/command/WrongUsageException.java b/src/minecraft/net/minecraft/command/WrongUsageException.java new file mode 100644 index 0000000..726c3ee --- /dev/null +++ b/src/minecraft/net/minecraft/command/WrongUsageException.java @@ -0,0 +1,9 @@ +package net.minecraft.command; + +public class WrongUsageException extends SyntaxErrorException +{ + public WrongUsageException(String message, Object... replacements) + { + super(message, replacements); + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandAchievement.java b/src/minecraft/net/minecraft/command/server/CommandAchievement.java new file mode 100644 index 0000000..75111e3 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandAchievement.java @@ -0,0 +1,207 @@ +package net.minecraft.command.server; + +import com.google.common.base.Predicate; +import com.google.common.collect.Iterators; +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraft.stats.Achievement; +import net.minecraft.stats.AchievementList; +import net.minecraft.stats.StatBase; +import net.minecraft.stats.StatList; +import net.minecraft.util.BlockPos; + +public class CommandAchievement extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "achievement"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.achievement.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 2) + { + throw new WrongUsageException("commands.achievement.usage", new Object[0]); + } + else + { + final StatBase statbase = StatList.getOneShotStat(args[1]); + + if (statbase == null && !args[1].equals("*")) + { + throw new CommandException("commands.achievement.unknownAchievement", new Object[] {args[1]}); + } + else + { + final EntityPlayerMP entityplayermp = args.length >= 3 ? getPlayer(sender, args[2]) : getCommandSenderAsPlayer(sender); + boolean flag = args[0].equalsIgnoreCase("give"); + boolean flag1 = args[0].equalsIgnoreCase("take"); + + if (flag || flag1) + { + if (statbase == null) + { + if (flag) + { + for (Achievement achievement4 : AchievementList.achievementList) + { + entityplayermp.triggerAchievement(achievement4); + } + + notifyOperators(sender, this, "commands.achievement.give.success.all", new Object[] {entityplayermp.getName()}); + } + else if (flag1) + { + for (Achievement achievement5 : Lists.reverse(AchievementList.achievementList)) + { + entityplayermp.func_175145_a(achievement5); + } + + notifyOperators(sender, this, "commands.achievement.take.success.all", new Object[] {entityplayermp.getName()}); + } + } + else + { + if (statbase instanceof Achievement) + { + Achievement achievement = (Achievement)statbase; + + if (flag) + { + if (entityplayermp.getStatFile().hasAchievementUnlocked(achievement)) + { + throw new CommandException("commands.achievement.alreadyHave", new Object[] {entityplayermp.getName(), statbase.func_150955_j()}); + } + + List list; + + for (list = Lists.newArrayList(); achievement.parentAchievement != null && !entityplayermp.getStatFile().hasAchievementUnlocked(achievement.parentAchievement); achievement = achievement.parentAchievement) + { + list.add(achievement.parentAchievement); + } + + for (Achievement achievement1 : Lists.reverse(list)) + { + entityplayermp.triggerAchievement(achievement1); + } + } + else if (flag1) + { + if (!entityplayermp.getStatFile().hasAchievementUnlocked(achievement)) + { + throw new CommandException("commands.achievement.dontHave", new Object[] {entityplayermp.getName(), statbase.func_150955_j()}); + } + + List list1 = Lists.newArrayList(Iterators.filter(AchievementList.achievementList.iterator(), new Predicate() + { + public boolean apply(Achievement p_apply_1_) + { + return entityplayermp.getStatFile().hasAchievementUnlocked(p_apply_1_) && p_apply_1_ != statbase; + } + })); + List list2 = Lists.newArrayList(list1); + + for (Achievement achievement2 : list1) + { + Achievement achievement3 = achievement2; + boolean flag2; + + for (flag2 = false; achievement3 != null; achievement3 = achievement3.parentAchievement) + { + if (achievement3 == statbase) + { + flag2 = true; + } + } + + if (!flag2) + { + for (achievement3 = achievement2; achievement3 != null; achievement3 = achievement3.parentAchievement) + { + list2.remove(achievement2); + } + } + } + + for (Achievement achievement6 : list2) + { + entityplayermp.func_175145_a(achievement6); + } + } + } + + if (flag) + { + entityplayermp.triggerAchievement(statbase); + notifyOperators(sender, this, "commands.achievement.give.success.one", new Object[] {entityplayermp.getName(), statbase.func_150955_j()}); + } + else if (flag1) + { + entityplayermp.func_175145_a(statbase); + notifyOperators(sender, this, "commands.achievement.take.success.one", new Object[] {statbase.func_150955_j(), entityplayermp.getName()}); + } + } + } + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + if (args.length == 1) + { + return getListOfStringsMatchingLastWord(args, new String[] {"give", "take"}); + } + else if (args.length != 2) + { + return args.length == 3 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : null; + } + else + { + List list = Lists.newArrayList(); + + for (StatBase statbase : StatList.allStats) + { + list.add(statbase.statId); + } + + return getListOfStringsMatchingLastWord(args, list); + } + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 2; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandBanIp.java b/src/minecraft/net/minecraft/command/server/CommandBanIp.java new file mode 100644 index 0000000..bb04125 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandBanIp.java @@ -0,0 +1,114 @@ +package net.minecraft.command.server; + +import java.util.Date; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.PlayerNotFoundException; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.management.IPBanEntry; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IChatComponent; + +public class CommandBanIp extends CommandBase +{ + public static final Pattern field_147211_a = Pattern.compile("^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"); + + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "ban-ip"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender sender) + { + return MinecraftServer.getServer().getConfigurationManager().getBannedIPs().isLanServer() && super.canCommandSenderUseCommand(sender); + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.banip.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length >= 1 && args[0].length() > 1) + { + IChatComponent ichatcomponent = args.length >= 2 ? getChatComponentFromNthArg(sender, args, 1) : null; + Matcher matcher = field_147211_a.matcher(args[0]); + + if (matcher.matches()) + { + this.func_147210_a(sender, args[0], ichatcomponent == null ? null : ichatcomponent.getUnformattedText()); + } + else + { + EntityPlayerMP entityplayermp = MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(args[0]); + + if (entityplayermp == null) + { + throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]); + } + + this.func_147210_a(sender, entityplayermp.getPlayerIP(), ichatcomponent == null ? null : ichatcomponent.getUnformattedText()); + } + } + else + { + throw new WrongUsageException("commands.banip.usage", new Object[0]); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : null; + } + + protected void func_147210_a(ICommandSender p_147210_1_, String p_147210_2_, String p_147210_3_) + { + IPBanEntry ipbanentry = new IPBanEntry(p_147210_2_, (Date)null, p_147210_1_.getName(), (Date)null, p_147210_3_); + MinecraftServer.getServer().getConfigurationManager().getBannedIPs().addEntry(ipbanentry); + List list = MinecraftServer.getServer().getConfigurationManager().getPlayersMatchingAddress(p_147210_2_); + String[] astring = new String[list.size()]; + int i = 0; + + for (EntityPlayerMP entityplayermp : list) + { + entityplayermp.playerNetServerHandler.kickPlayerFromServer("You have been IP banned."); + astring[i++] = entityplayermp.getName(); + } + + if (list.isEmpty()) + { + notifyOperators(p_147210_1_, this, "commands.banip.success", new Object[] {p_147210_2_}); + } + else + { + notifyOperators(p_147210_1_, this, "commands.banip.success.players", new Object[] {p_147210_2_, joinNiceString(astring)}); + } + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandBanPlayer.java b/src/minecraft/net/minecraft/command/server/CommandBanPlayer.java new file mode 100644 index 0000000..dabd470 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandBanPlayer.java @@ -0,0 +1,94 @@ +package net.minecraft.command.server; + +import com.mojang.authlib.GameProfile; +import java.util.Date; +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.management.UserListBansEntry; +import net.minecraft.util.BlockPos; + +public class CommandBanPlayer extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "ban"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.ban.usage"; + } + + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender sender) + { + return MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().isLanServer() && super.canCommandSenderUseCommand(sender); + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length >= 1 && args[0].length() > 0) + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + GameProfile gameprofile = minecraftserver.getPlayerProfileCache().getGameProfileForUsername(args[0]); + + if (gameprofile == null) + { + throw new CommandException("commands.ban.failed", new Object[] {args[0]}); + } + else + { + String s = null; + + if (args.length >= 2) + { + s = getChatComponentFromNthArg(sender, args, 1).getUnformattedText(); + } + + UserListBansEntry userlistbansentry = new UserListBansEntry(gameprofile, (Date)null, sender.getName(), (Date)null, s); + minecraftserver.getConfigurationManager().getBannedPlayers().addEntry(userlistbansentry); + EntityPlayerMP entityplayermp = minecraftserver.getConfigurationManager().getPlayerByUsername(args[0]); + + if (entityplayermp != null) + { + entityplayermp.playerNetServerHandler.kickPlayerFromServer("You are banned from this server."); + } + + notifyOperators(sender, this, "commands.ban.success", new Object[] {args[0]}); + } + } + else + { + throw new WrongUsageException("commands.ban.usage", new Object[0]); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length >= 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : null; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandBlockLogic.java b/src/minecraft/net/minecraft/command/server/CommandBlockLogic.java new file mode 100644 index 0000000..42336fd --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandBlockLogic.java @@ -0,0 +1,258 @@ +package net.minecraft.command.server; + +import io.netty.buffer.ByteBuf; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.concurrent.Callable; +import net.minecraft.command.CommandResultStats; +import net.minecraft.command.ICommandManager; +import net.minecraft.command.ICommandSender; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ReportedException; +import net.minecraft.world.World; + +public abstract class CommandBlockLogic implements ICommandSender +{ + /** The formatting for the timestamp on commands run. */ + private static final SimpleDateFormat timestampFormat = new SimpleDateFormat("HH:mm:ss"); + + /** The number of successful commands run. (used for redstone output) */ + private int successCount; + private boolean trackOutput = true; + + /** The previously run command. */ + private IChatComponent lastOutput = null; + + /** The command stored in the command block. */ + private String commandStored = ""; + + /** The custom name of the command block. (defaults to "@") */ + private String customName = "@"; + private final CommandResultStats resultStats = new CommandResultStats(); + + /** + * returns the successCount int. + */ + public int getSuccessCount() + { + return this.successCount; + } + + /** + * Returns the lastOutput. + */ + public IChatComponent getLastOutput() + { + return this.lastOutput; + } + + /** + * Stores data to NBT format. + */ + public void writeDataToNBT(NBTTagCompound tagCompound) + { + tagCompound.setString("Command", this.commandStored); + tagCompound.setInteger("SuccessCount", this.successCount); + tagCompound.setString("CustomName", this.customName); + tagCompound.setBoolean("TrackOutput", this.trackOutput); + + if (this.lastOutput != null && this.trackOutput) + { + tagCompound.setString("LastOutput", IChatComponent.Serializer.componentToJson(this.lastOutput)); + } + + this.resultStats.writeStatsToNBT(tagCompound); + } + + /** + * Reads NBT formatting and stored data into variables. + */ + public void readDataFromNBT(NBTTagCompound nbt) + { + this.commandStored = nbt.getString("Command"); + this.successCount = nbt.getInteger("SuccessCount"); + + if (nbt.hasKey("CustomName", 8)) + { + this.customName = nbt.getString("CustomName"); + } + + if (nbt.hasKey("TrackOutput", 1)) + { + this.trackOutput = nbt.getBoolean("TrackOutput"); + } + + if (nbt.hasKey("LastOutput", 8) && this.trackOutput) + { + this.lastOutput = IChatComponent.Serializer.jsonToComponent(nbt.getString("LastOutput")); + } + + this.resultStats.readStatsFromNBT(nbt); + } + + /** + * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not + */ + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { + return permLevel <= 2; + } + + /** + * Sets the command. + */ + public void setCommand(String command) + { + this.commandStored = command; + this.successCount = 0; + } + + /** + * Returns the command of the command block. + */ + public String getCommand() + { + return this.commandStored; + } + + public void trigger(World worldIn) + { + if (worldIn.isRemote) + { + this.successCount = 0; + } + + MinecraftServer minecraftserver = MinecraftServer.getServer(); + + if (minecraftserver != null && minecraftserver.isAnvilFileSet() && minecraftserver.isCommandBlockEnabled()) + { + ICommandManager icommandmanager = minecraftserver.getCommandManager(); + + try + { + this.lastOutput = null; + this.successCount = icommandmanager.executeCommand(this, this.commandStored); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Executing command block"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Command to be executed"); + crashreportcategory.addCrashSectionCallable("Command", new Callable() + { + public String call() throws Exception + { + return CommandBlockLogic.this.getCommand(); + } + }); + crashreportcategory.addCrashSectionCallable("Name", new Callable() + { + public String call() throws Exception + { + return CommandBlockLogic.this.getName(); + } + }); + throw new ReportedException(crashreport); + } + } + else + { + this.successCount = 0; + } + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.customName; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return new ChatComponentText(this.getName()); + } + + public void setName(String p_145754_1_) + { + this.customName = p_145754_1_; + } + + /** + * Send a chat message to the CommandSender + */ + public void addChatMessage(IChatComponent component) + { + if (this.trackOutput && this.getEntityWorld() != null && !this.getEntityWorld().isRemote) + { + this.lastOutput = (new ChatComponentText("[" + timestampFormat.format(new Date()) + "] ")).appendSibling(component); + this.updateCommand(); + } + } + + /** + * Returns true if the command sender should be sent feedback about executed commands + */ + public boolean sendCommandFeedback() + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + return minecraftserver == null || !minecraftserver.isAnvilFileSet() || minecraftserver.worldServers[0].getGameRules().getBoolean("commandBlockOutput"); + } + + public void setCommandStat(CommandResultStats.Type type, int amount) + { + this.resultStats.func_179672_a(this, type, amount); + } + + public abstract void updateCommand(); + + public abstract int func_145751_f(); + + public abstract void func_145757_a(ByteBuf p_145757_1_); + + public void setLastOutput(IChatComponent lastOutputMessage) + { + this.lastOutput = lastOutputMessage; + } + + public void setTrackOutput(boolean shouldTrackOutput) + { + this.trackOutput = shouldTrackOutput; + } + + public boolean shouldTrackOutput() + { + return this.trackOutput; + } + + public boolean tryOpenEditCommandBlock(EntityPlayer playerIn) + { + if (!playerIn.capabilities.isCreativeMode) + { + return false; + } + else + { + if (playerIn.getEntityWorld().isRemote) + { + playerIn.openEditCommandBlock(this); + } + + return true; + } + } + + public CommandResultStats getCommandResultStats() + { + return this.resultStats; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandBroadcast.java b/src/minecraft/net/minecraft/command/server/CommandBroadcast.java new file mode 100644 index 0000000..177d497 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandBroadcast.java @@ -0,0 +1,59 @@ +package net.minecraft.command.server; + +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; + +public class CommandBroadcast extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "say"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 1; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.say.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length > 0 && args[0].length() > 0) + { + IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 0, true); + MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.announcement", new Object[] {sender.getDisplayName(), ichatcomponent})); + } + else + { + throw new WrongUsageException("commands.say.usage", new Object[0]); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length >= 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : null; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandDeOp.java b/src/minecraft/net/minecraft/command/server/CommandDeOp.java new file mode 100644 index 0000000..2a6fd61 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandDeOp.java @@ -0,0 +1,68 @@ +package net.minecraft.command.server; + +import com.mojang.authlib.GameProfile; +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandDeOp extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "deop"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.deop.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length == 1 && args[0].length() > 0) + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + GameProfile gameprofile = minecraftserver.getConfigurationManager().getOppedPlayers().getGameProfileFromName(args[0]); + + if (gameprofile == null) + { + throw new CommandException("commands.deop.failed", new Object[] {args[0]}); + } + else + { + minecraftserver.getConfigurationManager().removeOp(gameprofile); + notifyOperators(sender, this, "commands.deop.success", new Object[] {args[0]}); + } + } + else + { + throw new WrongUsageException("commands.deop.usage", new Object[0]); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getConfigurationManager().getOppedPlayerNames()) : null; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandEmote.java b/src/minecraft/net/minecraft/command/server/CommandEmote.java new file mode 100644 index 0000000..ced72eb --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandEmote.java @@ -0,0 +1,60 @@ +package net.minecraft.command.server; + +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; + +public class CommandEmote extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "me"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 0; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.me.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length <= 0) + { + throw new WrongUsageException("commands.me.usage", new Object[0]); + } + else + { + IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 0, !(sender instanceof EntityPlayer)); + MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.emote", new Object[] {sender.getDisplayName(), ichatcomponent})); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()); + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandListBans.java b/src/minecraft/net/minecraft/command/server/CommandListBans.java new file mode 100644 index 0000000..97106cb --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandListBans.java @@ -0,0 +1,67 @@ +package net.minecraft.command.server; + +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; + +public class CommandListBans extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "banlist"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender sender) + { + return (MinecraftServer.getServer().getConfigurationManager().getBannedIPs().isLanServer() || MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().isLanServer()) && super.canCommandSenderUseCommand(sender); + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.banlist.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length >= 1 && args[0].equalsIgnoreCase("ips")) + { + sender.addChatMessage(new ChatComponentTranslation("commands.banlist.ips", new Object[] {Integer.valueOf(MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getKeys().length)})); + sender.addChatMessage(new ChatComponentText(joinNiceString(MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getKeys()))); + } + else + { + sender.addChatMessage(new ChatComponentTranslation("commands.banlist.players", new Object[] {Integer.valueOf(MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().getKeys().length)})); + sender.addChatMessage(new ChatComponentText(joinNiceString(MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().getKeys()))); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, new String[] {"players", "ips"}): null; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandListPlayers.java b/src/minecraft/net/minecraft/command/server/CommandListPlayers.java new file mode 100644 index 0000000..0368d12 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandListPlayers.java @@ -0,0 +1,47 @@ +package net.minecraft.command.server; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.CommandResultStats; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; + +public class CommandListPlayers extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "list"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 0; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.players.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + int i = MinecraftServer.getServer().getCurrentPlayerCount(); + sender.addChatMessage(new ChatComponentTranslation("commands.players.list", new Object[] {Integer.valueOf(i), Integer.valueOf(MinecraftServer.getServer().getMaxPlayers())})); + sender.addChatMessage(new ChatComponentText(MinecraftServer.getServer().getConfigurationManager().func_181058_b(args.length > 0 && "uuids".equalsIgnoreCase(args[0])))); + sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, i); + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandMessage.java b/src/minecraft/net/minecraft/command/server/CommandMessage.java new file mode 100644 index 0000000..63b6d33 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandMessage.java @@ -0,0 +1,90 @@ +package net.minecraft.command.server; + +import java.util.Arrays; +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.PlayerNotFoundException; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; + +public class CommandMessage extends CommandBase +{ + public List getCommandAliases() + { + return Arrays.asList(new String[] {"w", "msg"}); + } + + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "tell"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 0; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.message.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 2) + { + throw new WrongUsageException("commands.message.usage", new Object[0]); + } + else + { + EntityPlayer entityplayer = getPlayer(sender, args[0]); + + if (entityplayer == sender) + { + throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]); + } + else + { + IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 1, !(sender instanceof EntityPlayer)); + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.message.display.incoming", new Object[] {sender.getDisplayName(), ichatcomponent.createCopy()}); + ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.message.display.outgoing", new Object[] {entityplayer.getDisplayName(), ichatcomponent.createCopy()}); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true)); + chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true)); + entityplayer.addChatMessage(chatcomponenttranslation); + sender.addChatMessage(chatcomponenttranslation1); + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandMessageRaw.java b/src/minecraft/net/minecraft/command/server/CommandMessageRaw.java new file mode 100644 index 0000000..ae9e8ca --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandMessageRaw.java @@ -0,0 +1,82 @@ +package net.minecraft.command.server; + +import com.google.gson.JsonParseException; +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.SyntaxErrorException; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentProcessor; +import net.minecraft.util.IChatComponent; +import org.apache.commons.lang3.exception.ExceptionUtils; + +public class CommandMessageRaw extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "tellraw"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.tellraw.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 2) + { + throw new WrongUsageException("commands.tellraw.usage", new Object[0]); + } + else + { + EntityPlayer entityplayer = getPlayer(sender, args[0]); + String s = buildString(args, 1); + + try + { + IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s); + entityplayer.addChatMessage(ChatComponentProcessor.processComponent(sender, ichatcomponent, entityplayer)); + } + catch (JsonParseException jsonparseexception) + { + Throwable throwable = ExceptionUtils.getRootCause(jsonparseexception); + throw new SyntaxErrorException("commands.tellraw.jsonException", new Object[] {throwable == null ? "" : throwable.getMessage()}); + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : null; + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandOp.java b/src/minecraft/net/minecraft/command/server/CommandOp.java new file mode 100644 index 0000000..4ee764d --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandOp.java @@ -0,0 +1,87 @@ +package net.minecraft.command.server; + +import com.google.common.collect.Lists; +import com.mojang.authlib.GameProfile; +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandOp extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "op"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.op.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length == 1 && args[0].length() > 0) + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + GameProfile gameprofile = minecraftserver.getPlayerProfileCache().getGameProfileForUsername(args[0]); + + if (gameprofile == null) + { + throw new CommandException("commands.op.failed", new Object[] {args[0]}); + } + else + { + minecraftserver.getConfigurationManager().addOp(gameprofile); + notifyOperators(sender, this, "commands.op.success", new Object[] {args[0]}); + } + } + else + { + throw new WrongUsageException("commands.op.usage", new Object[0]); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + if (args.length == 1) + { + String s = args[args.length - 1]; + List list = Lists.newArrayList(); + + for (GameProfile gameprofile : MinecraftServer.getServer().getGameProfiles()) + { + if (!MinecraftServer.getServer().getConfigurationManager().canSendCommands(gameprofile) && doesStringStartWith(s, gameprofile.getName())) + { + list.add(gameprofile.getName()); + } + } + + return list; + } + else + { + return null; + } + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandPardonIp.java b/src/minecraft/net/minecraft/command/server/CommandPardonIp.java new file mode 100644 index 0000000..6c696c0 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandPardonIp.java @@ -0,0 +1,76 @@ +package net.minecraft.command.server; + +import java.util.List; +import java.util.regex.Matcher; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.SyntaxErrorException; +import net.minecraft.command.WrongUsageException; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandPardonIp extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "pardon-ip"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender sender) + { + return MinecraftServer.getServer().getConfigurationManager().getBannedIPs().isLanServer() && super.canCommandSenderUseCommand(sender); + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.unbanip.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length == 1 && args[0].length() > 1) + { + Matcher matcher = CommandBanIp.field_147211_a.matcher(args[0]); + + if (matcher.matches()) + { + MinecraftServer.getServer().getConfigurationManager().getBannedIPs().removeEntry(args[0]); + notifyOperators(sender, this, "commands.unbanip.success", new Object[] {args[0]}); + } + else + { + throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]); + } + } + else + { + throw new WrongUsageException("commands.unbanip.usage", new Object[0]); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getKeys()) : null; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandPardonPlayer.java b/src/minecraft/net/minecraft/command/server/CommandPardonPlayer.java new file mode 100644 index 0000000..2ba9b49 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandPardonPlayer.java @@ -0,0 +1,76 @@ +package net.minecraft.command.server; + +import com.mojang.authlib.GameProfile; +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandPardonPlayer extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "pardon"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.unban.usage"; + } + + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender sender) + { + return MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().isLanServer() && super.canCommandSenderUseCommand(sender); + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length == 1 && args[0].length() > 0) + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + GameProfile gameprofile = minecraftserver.getConfigurationManager().getBannedPlayers().isUsernameBanned(args[0]); + + if (gameprofile == null) + { + throw new CommandException("commands.unban.failed", new Object[] {args[0]}); + } + else + { + minecraftserver.getConfigurationManager().getBannedPlayers().removeEntry(gameprofile); + notifyOperators(sender, this, "commands.unban.success", new Object[] {args[0]}); + } + } + else + { + throw new WrongUsageException("commands.unban.usage", new Object[0]); + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().getKeys()) : null; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandPublishLocalServer.java b/src/minecraft/net/minecraft/command/server/CommandPublishLocalServer.java new file mode 100644 index 0000000..7b9c6a1 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandPublishLocalServer.java @@ -0,0 +1,43 @@ +package net.minecraft.command.server; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.WorldSettings; + +public class CommandPublishLocalServer extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "publish"; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.publish.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + String s = MinecraftServer.getServer().shareToLAN(WorldSettings.GameType.SURVIVAL, false); + + if (s != null) + { + notifyOperators(sender, this, "commands.publish.started", new Object[] {s}); + } + else + { + notifyOperators(sender, this, "commands.publish.failed", new Object[0]); + } + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandSaveAll.java b/src/minecraft/net/minecraft/command/server/CommandSaveAll.java new file mode 100644 index 0000000..fd66cbf --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandSaveAll.java @@ -0,0 +1,84 @@ +package net.minecraft.command.server; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.WorldServer; + +public class CommandSaveAll extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "save-all"; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.save.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + sender.addChatMessage(new ChatComponentTranslation("commands.save.start", new Object[0])); + + if (minecraftserver.getConfigurationManager() != null) + { + minecraftserver.getConfigurationManager().saveAllPlayerData(); + } + + try + { + for (int i = 0; i < minecraftserver.worldServers.length; ++i) + { + if (minecraftserver.worldServers[i] != null) + { + WorldServer worldserver = minecraftserver.worldServers[i]; + boolean flag = worldserver.disableLevelSaving; + worldserver.disableLevelSaving = false; + worldserver.saveAllChunks(true, (IProgressUpdate)null); + worldserver.disableLevelSaving = flag; + } + } + + if (args.length > 0 && "flush".equals(args[0])) + { + sender.addChatMessage(new ChatComponentTranslation("commands.save.flushStart", new Object[0])); + + for (int j = 0; j < minecraftserver.worldServers.length; ++j) + { + if (minecraftserver.worldServers[j] != null) + { + WorldServer worldserver1 = minecraftserver.worldServers[j]; + boolean flag1 = worldserver1.disableLevelSaving; + worldserver1.disableLevelSaving = false; + worldserver1.saveChunkData(); + worldserver1.disableLevelSaving = flag1; + } + } + + sender.addChatMessage(new ChatComponentTranslation("commands.save.flushEnd", new Object[0])); + } + } + catch (MinecraftException minecraftexception) + { + notifyOperators(sender, this, "commands.save.failed", new Object[] {minecraftexception.getMessage()}); + return; + } + + notifyOperators(sender, this, "commands.save.success", new Object[0]); + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandSaveOff.java b/src/minecraft/net/minecraft/command/server/CommandSaveOff.java new file mode 100644 index 0000000..74acfc8 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandSaveOff.java @@ -0,0 +1,58 @@ +package net.minecraft.command.server; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.WorldServer; + +public class CommandSaveOff extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "save-off"; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.save-off.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + boolean flag = false; + + for (int i = 0; i < minecraftserver.worldServers.length; ++i) + { + if (minecraftserver.worldServers[i] != null) + { + WorldServer worldserver = minecraftserver.worldServers[i]; + + if (!worldserver.disableLevelSaving) + { + worldserver.disableLevelSaving = true; + flag = true; + } + } + } + + if (flag) + { + notifyOperators(sender, this, "commands.save.disabled", new Object[0]); + } + else + { + throw new CommandException("commands.save-off.alreadyOff", new Object[0]); + } + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandSaveOn.java b/src/minecraft/net/minecraft/command/server/CommandSaveOn.java new file mode 100644 index 0000000..4ead4db --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandSaveOn.java @@ -0,0 +1,58 @@ +package net.minecraft.command.server; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.WorldServer; + +public class CommandSaveOn extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "save-on"; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.save-on.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + boolean flag = false; + + for (int i = 0; i < minecraftserver.worldServers.length; ++i) + { + if (minecraftserver.worldServers[i] != null) + { + WorldServer worldserver = minecraftserver.worldServers[i]; + + if (worldserver.disableLevelSaving) + { + worldserver.disableLevelSaving = false; + flag = true; + } + } + } + + if (flag) + { + notifyOperators(sender, this, "commands.save.enabled", new Object[0]); + } + else + { + throw new CommandException("commands.save-on.alreadyOn", new Object[0]); + } + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandScoreboard.java b/src/minecraft/net/minecraft/command/server/CommandScoreboard.java new file mode 100644 index 0000000..dafc0d4 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandScoreboard.java @@ -0,0 +1,1354 @@ +package net.minecraft.command.server; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.CommandResultStats; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.SyntaxErrorException; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.scoreboard.IScoreObjectiveCriteria; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.scoreboard.Team; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; + +public class CommandScoreboard extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "scoreboard"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.scoreboard.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (!this.func_175780_b(sender, args)) + { + if (args.length < 1) + { + throw new WrongUsageException("commands.scoreboard.usage", new Object[0]); + } + else + { + if (args[0].equalsIgnoreCase("objectives")) + { + if (args.length == 1) + { + throw new WrongUsageException("commands.scoreboard.objectives.usage", new Object[0]); + } + + if (args[1].equalsIgnoreCase("list")) + { + this.listObjectives(sender); + } + else if (args[1].equalsIgnoreCase("add")) + { + if (args.length < 4) + { + throw new WrongUsageException("commands.scoreboard.objectives.add.usage", new Object[0]); + } + + this.addObjective(sender, args, 2); + } + else if (args[1].equalsIgnoreCase("remove")) + { + if (args.length != 3) + { + throw new WrongUsageException("commands.scoreboard.objectives.remove.usage", new Object[0]); + } + + this.removeObjective(sender, args[2]); + } + else + { + if (!args[1].equalsIgnoreCase("setdisplay")) + { + throw new WrongUsageException("commands.scoreboard.objectives.usage", new Object[0]); + } + + if (args.length != 3 && args.length != 4) + { + throw new WrongUsageException("commands.scoreboard.objectives.setdisplay.usage", new Object[0]); + } + + this.setObjectiveDisplay(sender, args, 2); + } + } + else if (args[0].equalsIgnoreCase("players")) + { + if (args.length == 1) + { + throw new WrongUsageException("commands.scoreboard.players.usage", new Object[0]); + } + + if (args[1].equalsIgnoreCase("list")) + { + if (args.length > 3) + { + throw new WrongUsageException("commands.scoreboard.players.list.usage", new Object[0]); + } + + this.listPlayers(sender, args, 2); + } + else if (args[1].equalsIgnoreCase("add")) + { + if (args.length < 5) + { + throw new WrongUsageException("commands.scoreboard.players.add.usage", new Object[0]); + } + + this.setPlayer(sender, args, 2); + } + else if (args[1].equalsIgnoreCase("remove")) + { + if (args.length < 5) + { + throw new WrongUsageException("commands.scoreboard.players.remove.usage", new Object[0]); + } + + this.setPlayer(sender, args, 2); + } + else if (args[1].equalsIgnoreCase("set")) + { + if (args.length < 5) + { + throw new WrongUsageException("commands.scoreboard.players.set.usage", new Object[0]); + } + + this.setPlayer(sender, args, 2); + } + else if (args[1].equalsIgnoreCase("reset")) + { + if (args.length != 3 && args.length != 4) + { + throw new WrongUsageException("commands.scoreboard.players.reset.usage", new Object[0]); + } + + this.resetPlayers(sender, args, 2); + } + else if (args[1].equalsIgnoreCase("enable")) + { + if (args.length != 4) + { + throw new WrongUsageException("commands.scoreboard.players.enable.usage", new Object[0]); + } + + this.func_175779_n(sender, args, 2); + } + else if (args[1].equalsIgnoreCase("test")) + { + if (args.length != 5 && args.length != 6) + { + throw new WrongUsageException("commands.scoreboard.players.test.usage", new Object[0]); + } + + this.func_175781_o(sender, args, 2); + } + else + { + if (!args[1].equalsIgnoreCase("operation")) + { + throw new WrongUsageException("commands.scoreboard.players.usage", new Object[0]); + } + + if (args.length != 7) + { + throw new WrongUsageException("commands.scoreboard.players.operation.usage", new Object[0]); + } + + this.func_175778_p(sender, args, 2); + } + } + else + { + if (!args[0].equalsIgnoreCase("teams")) + { + throw new WrongUsageException("commands.scoreboard.usage", new Object[0]); + } + + if (args.length == 1) + { + throw new WrongUsageException("commands.scoreboard.teams.usage", new Object[0]); + } + + if (args[1].equalsIgnoreCase("list")) + { + if (args.length > 3) + { + throw new WrongUsageException("commands.scoreboard.teams.list.usage", new Object[0]); + } + + this.listTeams(sender, args, 2); + } + else if (args[1].equalsIgnoreCase("add")) + { + if (args.length < 3) + { + throw new WrongUsageException("commands.scoreboard.teams.add.usage", new Object[0]); + } + + this.addTeam(sender, args, 2); + } + else if (args[1].equalsIgnoreCase("remove")) + { + if (args.length != 3) + { + throw new WrongUsageException("commands.scoreboard.teams.remove.usage", new Object[0]); + } + + this.removeTeam(sender, args, 2); + } + else if (args[1].equalsIgnoreCase("empty")) + { + if (args.length != 3) + { + throw new WrongUsageException("commands.scoreboard.teams.empty.usage", new Object[0]); + } + + this.emptyTeam(sender, args, 2); + } + else if (args[1].equalsIgnoreCase("join")) + { + if (args.length < 4 && (args.length != 3 || !(sender instanceof EntityPlayer))) + { + throw new WrongUsageException("commands.scoreboard.teams.join.usage", new Object[0]); + } + + this.joinTeam(sender, args, 2); + } + else if (args[1].equalsIgnoreCase("leave")) + { + if (args.length < 3 && !(sender instanceof EntityPlayer)) + { + throw new WrongUsageException("commands.scoreboard.teams.leave.usage", new Object[0]); + } + + this.leaveTeam(sender, args, 2); + } + else + { + if (!args[1].equalsIgnoreCase("option")) + { + throw new WrongUsageException("commands.scoreboard.teams.usage", new Object[0]); + } + + if (args.length != 4 && args.length != 5) + { + throw new WrongUsageException("commands.scoreboard.teams.option.usage", new Object[0]); + } + + this.setTeamOption(sender, args, 2); + } + } + } + } + } + + private boolean func_175780_b(ICommandSender p_175780_1_, String[] p_175780_2_) throws CommandException + { + int i = -1; + + for (int j = 0; j < p_175780_2_.length; ++j) + { + if (this.isUsernameIndex(p_175780_2_, j) && "*".equals(p_175780_2_[j])) + { + if (i >= 0) + { + throw new CommandException("commands.scoreboard.noMultiWildcard", new Object[0]); + } + + i = j; + } + } + + if (i < 0) + { + return false; + } + else + { + List list1 = Lists.newArrayList(this.getScoreboard().getObjectiveNames()); + String s = p_175780_2_[i]; + List list = Lists.newArrayList(); + + for (String s1 : list1) + { + p_175780_2_[i] = s1; + + try + { + this.processCommand(p_175780_1_, p_175780_2_); + list.add(s1); + } + catch (CommandException commandexception) + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects()); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); + p_175780_1_.addChatMessage(chatcomponenttranslation); + } + } + + p_175780_2_[i] = s; + p_175780_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size()); + + if (list.size() == 0) + { + throw new WrongUsageException("commands.scoreboard.allMatchesFailed", new Object[0]); + } + else + { + return true; + } + } + } + + protected Scoreboard getScoreboard() + { + return MinecraftServer.getServer().worldServerForDimension(0).getScoreboard(); + } + + protected ScoreObjective getObjective(String name, boolean edit) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + ScoreObjective scoreobjective = scoreboard.getObjective(name); + + if (scoreobjective == null) + { + throw new CommandException("commands.scoreboard.objectiveNotFound", new Object[] {name}); + } + else if (edit && scoreobjective.getCriteria().isReadOnly()) + { + throw new CommandException("commands.scoreboard.objectiveReadOnly", new Object[] {name}); + } + else + { + return scoreobjective; + } + } + + protected ScorePlayerTeam getTeam(String name) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + ScorePlayerTeam scoreplayerteam = scoreboard.getTeam(name); + + if (scoreplayerteam == null) + { + throw new CommandException("commands.scoreboard.teamNotFound", new Object[] {name}); + } + else + { + return scoreplayerteam; + } + } + + protected void addObjective(ICommandSender sender, String[] args, int index) throws CommandException + { + String s = args[index++]; + String s1 = args[index++]; + Scoreboard scoreboard = this.getScoreboard(); + IScoreObjectiveCriteria iscoreobjectivecriteria = (IScoreObjectiveCriteria)IScoreObjectiveCriteria.INSTANCES.get(s1); + + if (iscoreobjectivecriteria == null) + { + throw new WrongUsageException("commands.scoreboard.objectives.add.wrongType", new Object[] {s1}); + } + else if (scoreboard.getObjective(s) != null) + { + throw new CommandException("commands.scoreboard.objectives.add.alreadyExists", new Object[] {s}); + } + else if (s.length() > 16) + { + throw new SyntaxErrorException("commands.scoreboard.objectives.add.tooLong", new Object[] {s, Integer.valueOf(16)}); + } + else if (s.length() == 0) + { + throw new WrongUsageException("commands.scoreboard.objectives.add.usage", new Object[0]); + } + else + { + if (args.length > index) + { + String s2 = getChatComponentFromNthArg(sender, args, index).getUnformattedText(); + + if (s2.length() > 32) + { + throw new SyntaxErrorException("commands.scoreboard.objectives.add.displayTooLong", new Object[] {s2, Integer.valueOf(32)}); + } + + if (s2.length() > 0) + { + scoreboard.addScoreObjective(s, iscoreobjectivecriteria).setDisplayName(s2); + } + else + { + scoreboard.addScoreObjective(s, iscoreobjectivecriteria); + } + } + else + { + scoreboard.addScoreObjective(s, iscoreobjectivecriteria); + } + + notifyOperators(sender, this, "commands.scoreboard.objectives.add.success", new Object[] {s}); + } + } + + protected void addTeam(ICommandSender sender, String[] args, int index) throws CommandException + { + String s = args[index++]; + Scoreboard scoreboard = this.getScoreboard(); + + if (scoreboard.getTeam(s) != null) + { + throw new CommandException("commands.scoreboard.teams.add.alreadyExists", new Object[] {s}); + } + else if (s.length() > 16) + { + throw new SyntaxErrorException("commands.scoreboard.teams.add.tooLong", new Object[] {s, Integer.valueOf(16)}); + } + else if (s.length() == 0) + { + throw new WrongUsageException("commands.scoreboard.teams.add.usage", new Object[0]); + } + else + { + if (args.length > index) + { + String s1 = getChatComponentFromNthArg(sender, args, index).getUnformattedText(); + + if (s1.length() > 32) + { + throw new SyntaxErrorException("commands.scoreboard.teams.add.displayTooLong", new Object[] {s1, Integer.valueOf(32)}); + } + + if (s1.length() > 0) + { + scoreboard.createTeam(s).setTeamName(s1); + } + else + { + scoreboard.createTeam(s); + } + } + else + { + scoreboard.createTeam(s); + } + + notifyOperators(sender, this, "commands.scoreboard.teams.add.success", new Object[] {s}); + } + } + + protected void setTeamOption(ICommandSender sender, String[] args, int index) throws CommandException + { + ScorePlayerTeam scoreplayerteam = this.getTeam(args[index++]); + + if (scoreplayerteam != null) + { + String s = args[index++].toLowerCase(); + + if (!s.equalsIgnoreCase("color") && !s.equalsIgnoreCase("friendlyfire") && !s.equalsIgnoreCase("seeFriendlyInvisibles") && !s.equalsIgnoreCase("nametagVisibility") && !s.equalsIgnoreCase("deathMessageVisibility")) + { + throw new WrongUsageException("commands.scoreboard.teams.option.usage", new Object[0]); + } + else if (args.length == 4) + { + if (s.equalsIgnoreCase("color")) + { + throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {s, joinNiceStringFromCollection(EnumChatFormatting.getValidValues(true, false))}); + } + else if (!s.equalsIgnoreCase("friendlyfire") && !s.equalsIgnoreCase("seeFriendlyInvisibles")) + { + if (!s.equalsIgnoreCase("nametagVisibility") && !s.equalsIgnoreCase("deathMessageVisibility")) + { + throw new WrongUsageException("commands.scoreboard.teams.option.usage", new Object[0]); + } + else + { + throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {s, joinNiceString(Team.EnumVisible.func_178825_a())}); + } + } + else + { + throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {s, joinNiceStringFromCollection(Arrays.asList(new String[]{"true", "false"}))}); + } + } + else + { + String s1 = args[index]; + + if (s.equalsIgnoreCase("color")) + { + EnumChatFormatting enumchatformatting = EnumChatFormatting.getValueByName(s1); + + if (enumchatformatting == null || enumchatformatting.isFancyStyling()) + { + throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {s, joinNiceStringFromCollection(EnumChatFormatting.getValidValues(true, false))}); + } + + scoreplayerteam.setChatFormat(enumchatformatting); + scoreplayerteam.setNamePrefix(enumchatformatting.toString()); + scoreplayerteam.setNameSuffix(EnumChatFormatting.RESET.toString()); + } + else if (s.equalsIgnoreCase("friendlyfire")) + { + if (!s1.equalsIgnoreCase("true") && !s1.equalsIgnoreCase("false")) + { + throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {s, joinNiceStringFromCollection(Arrays.asList(new String[]{"true", "false"}))}); + } + + scoreplayerteam.setAllowFriendlyFire(s1.equalsIgnoreCase("true")); + } + else if (s.equalsIgnoreCase("seeFriendlyInvisibles")) + { + if (!s1.equalsIgnoreCase("true") && !s1.equalsIgnoreCase("false")) + { + throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {s, joinNiceStringFromCollection(Arrays.asList(new String[]{"true", "false"}))}); + } + + scoreplayerteam.setSeeFriendlyInvisiblesEnabled(s1.equalsIgnoreCase("true")); + } + else if (s.equalsIgnoreCase("nametagVisibility")) + { + Team.EnumVisible team$enumvisible = Team.EnumVisible.func_178824_a(s1); + + if (team$enumvisible == null) + { + throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {s, joinNiceString(Team.EnumVisible.func_178825_a())}); + } + + scoreplayerteam.setNameTagVisibility(team$enumvisible); + } + else if (s.equalsIgnoreCase("deathMessageVisibility")) + { + Team.EnumVisible team$enumvisible1 = Team.EnumVisible.func_178824_a(s1); + + if (team$enumvisible1 == null) + { + throw new WrongUsageException("commands.scoreboard.teams.option.noValue", new Object[] {s, joinNiceString(Team.EnumVisible.func_178825_a())}); + } + + scoreplayerteam.setDeathMessageVisibility(team$enumvisible1); + } + + notifyOperators(sender, this, "commands.scoreboard.teams.option.success", new Object[] {s, scoreplayerteam.getRegisteredName(), s1}); + } + } + } + + protected void removeTeam(ICommandSender p_147194_1_, String[] p_147194_2_, int p_147194_3_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + ScorePlayerTeam scoreplayerteam = this.getTeam(p_147194_2_[p_147194_3_]); + + if (scoreplayerteam != null) + { + scoreboard.removeTeam(scoreplayerteam); + notifyOperators(p_147194_1_, this, "commands.scoreboard.teams.remove.success", new Object[] {scoreplayerteam.getRegisteredName()}); + } + } + + protected void listTeams(ICommandSender p_147186_1_, String[] p_147186_2_, int p_147186_3_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + + if (p_147186_2_.length > p_147186_3_) + { + ScorePlayerTeam scoreplayerteam = this.getTeam(p_147186_2_[p_147186_3_]); + + if (scoreplayerteam == null) + { + return; + } + + Collection collection = scoreplayerteam.getMembershipCollection(); + p_147186_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection.size()); + + if (collection.size() <= 0) + { + throw new CommandException("commands.scoreboard.teams.list.player.empty", new Object[] {scoreplayerteam.getRegisteredName()}); + } + + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.scoreboard.teams.list.player.count", new Object[] {Integer.valueOf(collection.size()), scoreplayerteam.getRegisteredName()}); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); + p_147186_1_.addChatMessage(chatcomponenttranslation); + p_147186_1_.addChatMessage(new ChatComponentText(joinNiceString(collection.toArray()))); + } + else + { + Collection collection1 = scoreboard.getTeams(); + p_147186_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection1.size()); + + if (collection1.size() <= 0) + { + throw new CommandException("commands.scoreboard.teams.list.empty", new Object[0]); + } + + ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.scoreboard.teams.list.count", new Object[] {Integer.valueOf(collection1.size())}); + chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); + p_147186_1_.addChatMessage(chatcomponenttranslation1); + + for (ScorePlayerTeam scoreplayerteam1 : collection1) + { + p_147186_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.teams.list.entry", new Object[] {scoreplayerteam1.getRegisteredName(), scoreplayerteam1.getTeamName(), Integer.valueOf(scoreplayerteam1.getMembershipCollection().size())})); + } + } + } + + protected void joinTeam(ICommandSender p_147190_1_, String[] p_147190_2_, int p_147190_3_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + String s = p_147190_2_[p_147190_3_++]; + Set set = Sets.newHashSet(); + Set set1 = Sets.newHashSet(); + + if (p_147190_1_ instanceof EntityPlayer && p_147190_3_ == p_147190_2_.length) + { + String s4 = getCommandSenderAsPlayer(p_147190_1_).getName(); + + if (scoreboard.addPlayerToTeam(s4, s)) + { + set.add(s4); + } + else + { + set1.add(s4); + } + } + else + { + while (p_147190_3_ < p_147190_2_.length) + { + String s1 = p_147190_2_[p_147190_3_++]; + + if (s1.startsWith("@")) + { + for (Entity entity : func_175763_c(p_147190_1_, s1)) + { + String s3 = getEntityName(p_147190_1_, entity.getUniqueID().toString()); + + if (scoreboard.addPlayerToTeam(s3, s)) + { + set.add(s3); + } + else + { + set1.add(s3); + } + } + } + else + { + String s2 = getEntityName(p_147190_1_, s1); + + if (scoreboard.addPlayerToTeam(s2, s)) + { + set.add(s2); + } + else + { + set1.add(s2); + } + } + } + } + + if (!set.isEmpty()) + { + p_147190_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size()); + notifyOperators(p_147190_1_, this, "commands.scoreboard.teams.join.success", new Object[] {Integer.valueOf(set.size()), s, joinNiceString(set.toArray(new String[set.size()]))}); + } + + if (!set1.isEmpty()) + { + throw new CommandException("commands.scoreboard.teams.join.failure", new Object[] {Integer.valueOf(set1.size()), s, joinNiceString(set1.toArray(new String[set1.size()]))}); + } + } + + protected void leaveTeam(ICommandSender p_147199_1_, String[] p_147199_2_, int p_147199_3_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + Set set = Sets.newHashSet(); + Set set1 = Sets.newHashSet(); + + if (p_147199_1_ instanceof EntityPlayer && p_147199_3_ == p_147199_2_.length) + { + String s3 = getCommandSenderAsPlayer(p_147199_1_).getName(); + + if (scoreboard.removePlayerFromTeams(s3)) + { + set.add(s3); + } + else + { + set1.add(s3); + } + } + else + { + while (p_147199_3_ < p_147199_2_.length) + { + String s = p_147199_2_[p_147199_3_++]; + + if (s.startsWith("@")) + { + for (Entity entity : func_175763_c(p_147199_1_, s)) + { + String s2 = getEntityName(p_147199_1_, entity.getUniqueID().toString()); + + if (scoreboard.removePlayerFromTeams(s2)) + { + set.add(s2); + } + else + { + set1.add(s2); + } + } + } + else + { + String s1 = getEntityName(p_147199_1_, s); + + if (scoreboard.removePlayerFromTeams(s1)) + { + set.add(s1); + } + else + { + set1.add(s1); + } + } + } + } + + if (!set.isEmpty()) + { + p_147199_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, set.size()); + notifyOperators(p_147199_1_, this, "commands.scoreboard.teams.leave.success", new Object[] {Integer.valueOf(set.size()), joinNiceString(set.toArray(new String[set.size()]))}); + } + + if (!set1.isEmpty()) + { + throw new CommandException("commands.scoreboard.teams.leave.failure", new Object[] {Integer.valueOf(set1.size()), joinNiceString(set1.toArray(new String[set1.size()]))}); + } + } + + protected void emptyTeam(ICommandSender p_147188_1_, String[] p_147188_2_, int p_147188_3_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + ScorePlayerTeam scoreplayerteam = this.getTeam(p_147188_2_[p_147188_3_]); + + if (scoreplayerteam != null) + { + Collection collection = Lists.newArrayList(scoreplayerteam.getMembershipCollection()); + p_147188_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, collection.size()); + + if (collection.isEmpty()) + { + throw new CommandException("commands.scoreboard.teams.empty.alreadyEmpty", new Object[] {scoreplayerteam.getRegisteredName()}); + } + else + { + for (String s : collection) + { + scoreboard.removePlayerFromTeam(s, scoreplayerteam); + } + + notifyOperators(p_147188_1_, this, "commands.scoreboard.teams.empty.success", new Object[] {Integer.valueOf(collection.size()), scoreplayerteam.getRegisteredName()}); + } + } + } + + protected void removeObjective(ICommandSender p_147191_1_, String p_147191_2_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + ScoreObjective scoreobjective = this.getObjective(p_147191_2_, false); + scoreboard.removeObjective(scoreobjective); + notifyOperators(p_147191_1_, this, "commands.scoreboard.objectives.remove.success", new Object[] {p_147191_2_}); + } + + protected void listObjectives(ICommandSender p_147196_1_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + Collection collection = scoreboard.getScoreObjectives(); + + if (collection.size() <= 0) + { + throw new CommandException("commands.scoreboard.objectives.list.empty", new Object[0]); + } + else + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.scoreboard.objectives.list.count", new Object[] {Integer.valueOf(collection.size())}); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); + p_147196_1_.addChatMessage(chatcomponenttranslation); + + for (ScoreObjective scoreobjective : collection) + { + p_147196_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.objectives.list.entry", new Object[] {scoreobjective.getName(), scoreobjective.getDisplayName(), scoreobjective.getCriteria().getName()})); + } + } + } + + protected void setObjectiveDisplay(ICommandSender p_147198_1_, String[] p_147198_2_, int p_147198_3_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + String s = p_147198_2_[p_147198_3_++]; + int i = Scoreboard.getObjectiveDisplaySlotNumber(s); + ScoreObjective scoreobjective = null; + + if (p_147198_2_.length == 4) + { + scoreobjective = this.getObjective(p_147198_2_[p_147198_3_], false); + } + + if (i < 0) + { + throw new CommandException("commands.scoreboard.objectives.setdisplay.invalidSlot", new Object[] {s}); + } + else + { + scoreboard.setObjectiveInDisplaySlot(i, scoreobjective); + + if (scoreobjective != null) + { + notifyOperators(p_147198_1_, this, "commands.scoreboard.objectives.setdisplay.successSet", new Object[] {Scoreboard.getObjectiveDisplaySlot(i), scoreobjective.getName()}); + } + else + { + notifyOperators(p_147198_1_, this, "commands.scoreboard.objectives.setdisplay.successCleared", new Object[] {Scoreboard.getObjectiveDisplaySlot(i)}); + } + } + } + + protected void listPlayers(ICommandSender p_147195_1_, String[] p_147195_2_, int p_147195_3_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + + if (p_147195_2_.length > p_147195_3_) + { + String s = getEntityName(p_147195_1_, p_147195_2_[p_147195_3_]); + Map map = scoreboard.getObjectivesForEntity(s); + p_147195_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, map.size()); + + if (map.size() <= 0) + { + throw new CommandException("commands.scoreboard.players.list.player.empty", new Object[] {s}); + } + + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("commands.scoreboard.players.list.player.count", new Object[] {Integer.valueOf(map.size()), s}); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); + p_147195_1_.addChatMessage(chatcomponenttranslation); + + for (Score score : map.values()) + { + p_147195_1_.addChatMessage(new ChatComponentTranslation("commands.scoreboard.players.list.player.entry", new Object[] {Integer.valueOf(score.getScorePoints()), score.getObjective().getDisplayName(), score.getObjective().getName()})); + } + } + else + { + Collection collection = scoreboard.getObjectiveNames(); + p_147195_1_.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection.size()); + + if (collection.size() <= 0) + { + throw new CommandException("commands.scoreboard.players.list.empty", new Object[0]); + } + + ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("commands.scoreboard.players.list.count", new Object[] {Integer.valueOf(collection.size())}); + chatcomponenttranslation1.getChatStyle().setColor(EnumChatFormatting.DARK_GREEN); + p_147195_1_.addChatMessage(chatcomponenttranslation1); + p_147195_1_.addChatMessage(new ChatComponentText(joinNiceString(collection.toArray()))); + } + } + + protected void setPlayer(ICommandSender p_147197_1_, String[] p_147197_2_, int p_147197_3_) throws CommandException + { + String s = p_147197_2_[p_147197_3_ - 1]; + int i = p_147197_3_; + String s1 = getEntityName(p_147197_1_, p_147197_2_[p_147197_3_++]); + + if (s1.length() > 40) + { + throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s1, Integer.valueOf(40)}); + } + else + { + ScoreObjective scoreobjective = this.getObjective(p_147197_2_[p_147197_3_++], true); + int j = s.equalsIgnoreCase("set") ? parseInt(p_147197_2_[p_147197_3_++]) : parseInt(p_147197_2_[p_147197_3_++], 0); + + if (p_147197_2_.length > p_147197_3_) + { + Entity entity = func_175768_b(p_147197_1_, p_147197_2_[i]); + + try + { + NBTTagCompound nbttagcompound = JsonToNBT.getTagFromJson(buildString(p_147197_2_, p_147197_3_)); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + entity.writeToNBT(nbttagcompound1); + + if (!NBTUtil.func_181123_a(nbttagcompound, nbttagcompound1, true)) + { + throw new CommandException("commands.scoreboard.players.set.tagMismatch", new Object[] {s1}); + } + } + catch (NBTException nbtexception) + { + throw new CommandException("commands.scoreboard.players.set.tagError", new Object[] {nbtexception.getMessage()}); + } + } + + Scoreboard scoreboard = this.getScoreboard(); + Score score = scoreboard.getValueFromObjective(s1, scoreobjective); + + if (s.equalsIgnoreCase("set")) + { + score.setScorePoints(j); + } + else if (s.equalsIgnoreCase("add")) + { + score.increseScore(j); + } + else + { + score.decreaseScore(j); + } + + notifyOperators(p_147197_1_, this, "commands.scoreboard.players.set.success", new Object[] {scoreobjective.getName(), s1, Integer.valueOf(score.getScorePoints())}); + } + } + + protected void resetPlayers(ICommandSender p_147187_1_, String[] p_147187_2_, int p_147187_3_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + String s = getEntityName(p_147187_1_, p_147187_2_[p_147187_3_++]); + + if (p_147187_2_.length > p_147187_3_) + { + ScoreObjective scoreobjective = this.getObjective(p_147187_2_[p_147187_3_++], false); + scoreboard.removeObjectiveFromEntity(s, scoreobjective); + notifyOperators(p_147187_1_, this, "commands.scoreboard.players.resetscore.success", new Object[] {scoreobjective.getName(), s}); + } + else + { + scoreboard.removeObjectiveFromEntity(s, (ScoreObjective)null); + notifyOperators(p_147187_1_, this, "commands.scoreboard.players.reset.success", new Object[] {s}); + } + } + + protected void func_175779_n(ICommandSender p_175779_1_, String[] p_175779_2_, int p_175779_3_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + String s = getPlayerName(p_175779_1_, p_175779_2_[p_175779_3_++]); + + if (s.length() > 40) + { + throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)}); + } + else + { + ScoreObjective scoreobjective = this.getObjective(p_175779_2_[p_175779_3_], false); + + if (scoreobjective.getCriteria() != IScoreObjectiveCriteria.TRIGGER) + { + throw new CommandException("commands.scoreboard.players.enable.noTrigger", new Object[] {scoreobjective.getName()}); + } + else + { + Score score = scoreboard.getValueFromObjective(s, scoreobjective); + score.setLocked(false); + notifyOperators(p_175779_1_, this, "commands.scoreboard.players.enable.success", new Object[] {scoreobjective.getName(), s}); + } + } + } + + protected void func_175781_o(ICommandSender p_175781_1_, String[] p_175781_2_, int p_175781_3_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + String s = getEntityName(p_175781_1_, p_175781_2_[p_175781_3_++]); + + if (s.length() > 40) + { + throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)}); + } + else + { + ScoreObjective scoreobjective = this.getObjective(p_175781_2_[p_175781_3_++], false); + + if (!scoreboard.entityHasObjective(s, scoreobjective)) + { + throw new CommandException("commands.scoreboard.players.test.notFound", new Object[] {scoreobjective.getName(), s}); + } + else + { + int i = p_175781_2_[p_175781_3_].equals("*") ? Integer.MIN_VALUE : parseInt(p_175781_2_[p_175781_3_]); + ++p_175781_3_; + int j = p_175781_3_ < p_175781_2_.length && !p_175781_2_[p_175781_3_].equals("*") ? parseInt(p_175781_2_[p_175781_3_], i) : Integer.MAX_VALUE; + Score score = scoreboard.getValueFromObjective(s, scoreobjective); + + if (score.getScorePoints() >= i && score.getScorePoints() <= j) + { + notifyOperators(p_175781_1_, this, "commands.scoreboard.players.test.success", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)}); + } + else + { + throw new CommandException("commands.scoreboard.players.test.failed", new Object[] {Integer.valueOf(score.getScorePoints()), Integer.valueOf(i), Integer.valueOf(j)}); + } + } + } + } + + protected void func_175778_p(ICommandSender p_175778_1_, String[] p_175778_2_, int p_175778_3_) throws CommandException + { + Scoreboard scoreboard = this.getScoreboard(); + String s = getEntityName(p_175778_1_, p_175778_2_[p_175778_3_++]); + ScoreObjective scoreobjective = this.getObjective(p_175778_2_[p_175778_3_++], true); + String s1 = p_175778_2_[p_175778_3_++]; + String s2 = getEntityName(p_175778_1_, p_175778_2_[p_175778_3_++]); + ScoreObjective scoreobjective1 = this.getObjective(p_175778_2_[p_175778_3_], false); + + if (s.length() > 40) + { + throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s, Integer.valueOf(40)}); + } + else if (s2.length() > 40) + { + throw new SyntaxErrorException("commands.scoreboard.players.name.tooLong", new Object[] {s2, Integer.valueOf(40)}); + } + else + { + Score score = scoreboard.getValueFromObjective(s, scoreobjective); + + if (!scoreboard.entityHasObjective(s2, scoreobjective1)) + { + throw new CommandException("commands.scoreboard.players.operation.notFound", new Object[] {scoreobjective1.getName(), s2}); + } + else + { + Score score1 = scoreboard.getValueFromObjective(s2, scoreobjective1); + + if (s1.equals("+=")) + { + score.setScorePoints(score.getScorePoints() + score1.getScorePoints()); + } + else if (s1.equals("-=")) + { + score.setScorePoints(score.getScorePoints() - score1.getScorePoints()); + } + else if (s1.equals("*=")) + { + score.setScorePoints(score.getScorePoints() * score1.getScorePoints()); + } + else if (s1.equals("/=")) + { + if (score1.getScorePoints() != 0) + { + score.setScorePoints(score.getScorePoints() / score1.getScorePoints()); + } + } + else if (s1.equals("%=")) + { + if (score1.getScorePoints() != 0) + { + score.setScorePoints(score.getScorePoints() % score1.getScorePoints()); + } + } + else if (s1.equals("=")) + { + score.setScorePoints(score1.getScorePoints()); + } + else if (s1.equals("<")) + { + score.setScorePoints(Math.min(score.getScorePoints(), score1.getScorePoints())); + } + else if (s1.equals(">")) + { + score.setScorePoints(Math.max(score.getScorePoints(), score1.getScorePoints())); + } + else + { + if (!s1.equals("><")) + { + throw new CommandException("commands.scoreboard.players.operation.invalidOperation", new Object[] {s1}); + } + + int i = score.getScorePoints(); + score.setScorePoints(score1.getScorePoints()); + score1.setScorePoints(i); + } + + notifyOperators(p_175778_1_, this, "commands.scoreboard.players.operation.success", new Object[0]); + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + if (args.length == 1) + { + return getListOfStringsMatchingLastWord(args, new String[] {"objectives", "players", "teams"}); + } + else + { + if (args[0].equalsIgnoreCase("objectives")) + { + if (args.length == 2) + { + return getListOfStringsMatchingLastWord(args, new String[] {"list", "add", "remove", "setdisplay"}); + } + + if (args[1].equalsIgnoreCase("add")) + { + if (args.length == 4) + { + Set set = IScoreObjectiveCriteria.INSTANCES.keySet(); + return getListOfStringsMatchingLastWord(args, set); + } + } + else if (args[1].equalsIgnoreCase("remove")) + { + if (args.length == 3) + { + return getListOfStringsMatchingLastWord(args, this.func_147184_a(false)); + } + } + else if (args[1].equalsIgnoreCase("setdisplay")) + { + if (args.length == 3) + { + return getListOfStringsMatchingLastWord(args, Scoreboard.getDisplaySlotStrings()); + } + + if (args.length == 4) + { + return getListOfStringsMatchingLastWord(args, this.func_147184_a(false)); + } + } + } + else if (args[0].equalsIgnoreCase("players")) + { + if (args.length == 2) + { + return getListOfStringsMatchingLastWord(args, new String[] {"set", "add", "remove", "reset", "list", "enable", "test", "operation"}); + } + + if (!args[1].equalsIgnoreCase("set") && !args[1].equalsIgnoreCase("add") && !args[1].equalsIgnoreCase("remove") && !args[1].equalsIgnoreCase("reset")) + { + if (args[1].equalsIgnoreCase("enable")) + { + if (args.length == 3) + { + return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()); + } + + if (args.length == 4) + { + return getListOfStringsMatchingLastWord(args, this.func_175782_e()); + } + } + else if (!args[1].equalsIgnoreCase("list") && !args[1].equalsIgnoreCase("test")) + { + if (args[1].equalsIgnoreCase("operation")) + { + if (args.length == 3) + { + return getListOfStringsMatchingLastWord(args, this.getScoreboard().getObjectiveNames()); + } + + if (args.length == 4) + { + return getListOfStringsMatchingLastWord(args, this.func_147184_a(true)); + } + + if (args.length == 5) + { + return getListOfStringsMatchingLastWord(args, new String[] {"+=", "-=", "*=", "/=", "%=", "=", "<", ">", "><"}); + } + + if (args.length == 6) + { + return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()); + } + + if (args.length == 7) + { + return getListOfStringsMatchingLastWord(args, this.func_147184_a(false)); + } + } + } + else + { + if (args.length == 3) + { + return getListOfStringsMatchingLastWord(args, this.getScoreboard().getObjectiveNames()); + } + + if (args.length == 4 && args[1].equalsIgnoreCase("test")) + { + return getListOfStringsMatchingLastWord(args, this.func_147184_a(false)); + } + } + } + else + { + if (args.length == 3) + { + return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()); + } + + if (args.length == 4) + { + return getListOfStringsMatchingLastWord(args, this.func_147184_a(true)); + } + } + } + else if (args[0].equalsIgnoreCase("teams")) + { + if (args.length == 2) + { + return getListOfStringsMatchingLastWord(args, new String[] {"add", "remove", "join", "leave", "empty", "list", "option"}); + } + + if (args[1].equalsIgnoreCase("join")) + { + if (args.length == 3) + { + return getListOfStringsMatchingLastWord(args, this.getScoreboard().getTeamNames()); + } + + if (args.length >= 4) + { + return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()); + } + } + else + { + if (args[1].equalsIgnoreCase("leave")) + { + return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()); + } + + if (!args[1].equalsIgnoreCase("empty") && !args[1].equalsIgnoreCase("list") && !args[1].equalsIgnoreCase("remove")) + { + if (args[1].equalsIgnoreCase("option")) + { + if (args.length == 3) + { + return getListOfStringsMatchingLastWord(args, this.getScoreboard().getTeamNames()); + } + + if (args.length == 4) + { + return getListOfStringsMatchingLastWord(args, new String[] {"color", "friendlyfire", "seeFriendlyInvisibles", "nametagVisibility", "deathMessageVisibility"}); + } + + if (args.length == 5) + { + if (args[3].equalsIgnoreCase("color")) + { + return getListOfStringsMatchingLastWord(args, EnumChatFormatting.getValidValues(true, false)); + } + + if (args[3].equalsIgnoreCase("nametagVisibility") || args[3].equalsIgnoreCase("deathMessageVisibility")) + { + return getListOfStringsMatchingLastWord(args, Team.EnumVisible.func_178825_a()); + } + + if (args[3].equalsIgnoreCase("friendlyfire") || args[3].equalsIgnoreCase("seeFriendlyInvisibles")) + { + return getListOfStringsMatchingLastWord(args, new String[] {"true", "false"}); + } + } + } + } + else if (args.length == 3) + { + return getListOfStringsMatchingLastWord(args, this.getScoreboard().getTeamNames()); + } + } + } + + return null; + } + } + + protected List func_147184_a(boolean p_147184_1_) + { + Collection collection = this.getScoreboard().getScoreObjectives(); + List list = Lists.newArrayList(); + + for (ScoreObjective scoreobjective : collection) + { + if (!p_147184_1_ || !scoreobjective.getCriteria().isReadOnly()) + { + list.add(scoreobjective.getName()); + } + } + + return list; + } + + protected List func_175782_e() + { + Collection collection = this.getScoreboard().getScoreObjectives(); + List list = Lists.newArrayList(); + + for (ScoreObjective scoreobjective : collection) + { + if (scoreobjective.getCriteria() == IScoreObjectiveCriteria.TRIGGER) + { + list.add(scoreobjective.getName()); + } + } + + return list; + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return !args[0].equalsIgnoreCase("players") ? (args[0].equalsIgnoreCase("teams") ? index == 2 : false) : (args.length > 1 && args[1].equalsIgnoreCase("operation") ? index == 2 || index == 5 : index == 2); + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandSetBlock.java b/src/minecraft/net/minecraft/command/server/CommandSetBlock.java new file mode 100644 index 0000000..4a091dc --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandSetBlock.java @@ -0,0 +1,156 @@ +package net.minecraft.command.server; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.CommandResultStats; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class CommandSetBlock extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "setblock"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.setblock.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 4) + { + throw new WrongUsageException("commands.setblock.usage", new Object[0]); + } + else + { + sender.setCommandStat(CommandResultStats.Type.AFFECTED_BLOCKS, 0); + BlockPos blockpos = parseBlockPos(sender, args, 0, false); + Block block = CommandBase.getBlockByText(sender, args[3]); + int i = 0; + + if (args.length >= 5) + { + i = parseInt(args[4], 0, 15); + } + + World world = sender.getEntityWorld(); + + if (!world.isBlockLoaded(blockpos)) + { + throw new CommandException("commands.setblock.outOfWorld", new Object[0]); + } + else + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + + if (args.length >= 7 && block.hasTileEntity()) + { + String s = getChatComponentFromNthArg(sender, args, 6).getUnformattedText(); + + try + { + nbttagcompound = JsonToNBT.getTagFromJson(s); + flag = true; + } + catch (NBTException nbtexception) + { + throw new CommandException("commands.setblock.tagError", new Object[] {nbtexception.getMessage()}); + } + } + + if (args.length >= 6) + { + if (args[5].equals("destroy")) + { + world.destroyBlock(blockpos, true); + + if (block == Blocks.air) + { + notifyOperators(sender, this, "commands.setblock.success", new Object[0]); + return; + } + } + else if (args[5].equals("keep") && !world.isAirBlock(blockpos)) + { + throw new CommandException("commands.setblock.noChange", new Object[0]); + } + } + + TileEntity tileentity1 = world.getTileEntity(blockpos); + + if (tileentity1 != null) + { + if (tileentity1 instanceof IInventory) + { + ((IInventory)tileentity1).clear(); + } + + world.setBlockState(blockpos, Blocks.air.getDefaultState(), block == Blocks.air ? 2 : 4); + } + + IBlockState iblockstate = block.getStateFromMeta(i); + + if (!world.setBlockState(blockpos, iblockstate, 2)) + { + throw new CommandException("commands.setblock.noChange", new Object[0]); + } + else + { + if (flag) + { + TileEntity tileentity = world.getTileEntity(blockpos); + + if (tileentity != null) + { + nbttagcompound.setInteger("x", blockpos.getX()); + nbttagcompound.setInteger("y", blockpos.getY()); + nbttagcompound.setInteger("z", blockpos.getZ()); + tileentity.readFromNBT(nbttagcompound); + } + } + + world.notifyNeighborsRespectDebug(blockpos, iblockstate.getBlock()); + sender.setCommandStat(CommandResultStats.Type.AFFECTED_BLOCKS, 1); + notifyOperators(sender, this, "commands.setblock.success", new Object[0]); + } + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length > 0 && args.length <= 3 ? func_175771_a(args, 0, pos) : (args.length == 4 ? getListOfStringsMatchingLastWord(args, Block.blockRegistry.getKeys()) : (args.length == 6 ? getListOfStringsMatchingLastWord(args, new String[] {"replace", "destroy", "keep"}): null)); + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandSetDefaultSpawnpoint.java b/src/minecraft/net/minecraft/command/server/CommandSetDefaultSpawnpoint.java new file mode 100644 index 0000000..614feb1 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandSetDefaultSpawnpoint.java @@ -0,0 +1,68 @@ +package net.minecraft.command.server; + +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.network.play.server.S05PacketSpawnPosition; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandSetDefaultSpawnpoint extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "setworldspawn"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.setworldspawn.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + BlockPos blockpos; + + if (args.length == 0) + { + blockpos = getCommandSenderAsPlayer(sender).getPosition(); + } + else + { + if (args.length != 3 || sender.getEntityWorld() == null) + { + throw new WrongUsageException("commands.setworldspawn.usage", new Object[0]); + } + + blockpos = parseBlockPos(sender, args, 0, true); + } + + sender.getEntityWorld().setSpawnPoint(blockpos); + MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new S05PacketSpawnPosition(blockpos)); + notifyOperators(sender, this, "commands.setworldspawn.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())}); + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length > 0 && args.length <= 3 ? func_175771_a(args, 0, pos) : null; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandStop.java b/src/minecraft/net/minecraft/command/server/CommandStop.java new file mode 100644 index 0000000..506107f --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandStop.java @@ -0,0 +1,38 @@ +package net.minecraft.command.server; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; + +public class CommandStop extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "stop"; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.stop.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (MinecraftServer.getServer().worldServers != null) + { + notifyOperators(sender, this, "commands.stop.start", new Object[0]); + } + + MinecraftServer.getServer().initiateShutdown(); + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandSummon.java b/src/minecraft/net/minecraft/command/server/CommandSummon.java new file mode 100644 index 0000000..c564430 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandSummon.java @@ -0,0 +1,156 @@ +package net.minecraft.command.server; + +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class CommandSummon extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "summon"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.summon.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 1) + { + throw new WrongUsageException("commands.summon.usage", new Object[0]); + } + else + { + String s = args[0]; + BlockPos blockpos = sender.getPosition(); + Vec3 vec3 = sender.getPositionVector(); + double d0 = vec3.xCoord; + double d1 = vec3.yCoord; + double d2 = vec3.zCoord; + + if (args.length >= 4) + { + d0 = parseDouble(d0, args[1], true); + d1 = parseDouble(d1, args[2], false); + d2 = parseDouble(d2, args[3], true); + blockpos = new BlockPos(d0, d1, d2); + } + + World world = sender.getEntityWorld(); + + if (!world.isBlockLoaded(blockpos)) + { + throw new CommandException("commands.summon.outOfWorld", new Object[0]); + } + else if ("LightningBolt".equals(s)) + { + world.addWeatherEffect(new EntityLightningBolt(world, d0, d1, d2)); + notifyOperators(sender, this, "commands.summon.success", new Object[0]); + } + else + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + + if (args.length >= 5) + { + IChatComponent ichatcomponent = getChatComponentFromNthArg(sender, args, 4); + + try + { + nbttagcompound = JsonToNBT.getTagFromJson(ichatcomponent.getUnformattedText()); + flag = true; + } + catch (NBTException nbtexception) + { + throw new CommandException("commands.summon.tagError", new Object[] {nbtexception.getMessage()}); + } + } + + nbttagcompound.setString("id", s); + Entity entity2; + + try + { + entity2 = EntityList.createEntityFromNBT(nbttagcompound, world); + } + catch (RuntimeException var19) + { + throw new CommandException("commands.summon.failed", new Object[0]); + } + + if (entity2 == null) + { + throw new CommandException("commands.summon.failed", new Object[0]); + } + else + { + entity2.setLocationAndAngles(d0, d1, d2, entity2.rotationYaw, entity2.rotationPitch); + + if (!flag && entity2 instanceof EntityLiving) + { + ((EntityLiving)entity2).onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entity2)), (IEntityLivingData)null); + } + + world.spawnEntityInWorld(entity2); + Entity entity = entity2; + + for (NBTTagCompound nbttagcompound1 = nbttagcompound; entity != null && nbttagcompound1.hasKey("Riding", 10); nbttagcompound1 = nbttagcompound1.getCompoundTag("Riding")) + { + Entity entity1 = EntityList.createEntityFromNBT(nbttagcompound1.getCompoundTag("Riding"), world); + + if (entity1 != null) + { + entity1.setLocationAndAngles(d0, d1, d2, entity1.rotationYaw, entity1.rotationPitch); + world.spawnEntityInWorld(entity1); + entity.mountEntity(entity1); + } + + entity = entity1; + } + + notifyOperators(sender, this, "commands.summon.success", new Object[0]); + } + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, EntityList.getEntityNameList()) : (args.length > 1 && args.length <= 4 ? func_175771_a(args, 1, pos) : null); + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandTeleport.java b/src/minecraft/net/minecraft/command/server/CommandTeleport.java new file mode 100644 index 0000000..a376bf1 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandTeleport.java @@ -0,0 +1,192 @@ +package net.minecraft.command.server; + +import java.util.EnumSet; +import java.util.List; +import java.util.Set; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; + +public class CommandTeleport extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "tp"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.tp.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 1) + { + throw new WrongUsageException("commands.tp.usage", new Object[0]); + } + else + { + int i = 0; + Entity entity; + + if (args.length != 2 && args.length != 4 && args.length != 6) + { + entity = getCommandSenderAsPlayer(sender); + } + else + { + entity = func_175768_b(sender, args[0]); + i = 1; + } + + if (args.length != 1 && args.length != 2) + { + if (args.length < i + 3) + { + throw new WrongUsageException("commands.tp.usage", new Object[0]); + } + else if (entity.worldObj != null) + { + int lvt_5_2_ = i + 1; + CommandBase.CoordinateArg commandbase$coordinatearg = parseCoordinate(entity.posX, args[i], true); + CommandBase.CoordinateArg commandbase$coordinatearg1 = parseCoordinate(entity.posY, args[lvt_5_2_++], 0, 0, false); + CommandBase.CoordinateArg commandbase$coordinatearg2 = parseCoordinate(entity.posZ, args[lvt_5_2_++], true); + CommandBase.CoordinateArg commandbase$coordinatearg3 = parseCoordinate((double)entity.rotationYaw, args.length > lvt_5_2_ ? args[lvt_5_2_++] : "~", false); + CommandBase.CoordinateArg commandbase$coordinatearg4 = parseCoordinate((double)entity.rotationPitch, args.length > lvt_5_2_ ? args[lvt_5_2_] : "~", false); + + if (entity instanceof EntityPlayerMP) + { + Set set = EnumSet.noneOf(S08PacketPlayerPosLook.EnumFlags.class); + + if (commandbase$coordinatearg.func_179630_c()) + { + set.add(S08PacketPlayerPosLook.EnumFlags.X); + } + + if (commandbase$coordinatearg1.func_179630_c()) + { + set.add(S08PacketPlayerPosLook.EnumFlags.Y); + } + + if (commandbase$coordinatearg2.func_179630_c()) + { + set.add(S08PacketPlayerPosLook.EnumFlags.Z); + } + + if (commandbase$coordinatearg4.func_179630_c()) + { + set.add(S08PacketPlayerPosLook.EnumFlags.X_ROT); + } + + if (commandbase$coordinatearg3.func_179630_c()) + { + set.add(S08PacketPlayerPosLook.EnumFlags.Y_ROT); + } + + float f = (float)commandbase$coordinatearg3.func_179629_b(); + + if (!commandbase$coordinatearg3.func_179630_c()) + { + f = MathHelper.wrapAngleTo180_float(f); + } + + float f1 = (float)commandbase$coordinatearg4.func_179629_b(); + + if (!commandbase$coordinatearg4.func_179630_c()) + { + f1 = MathHelper.wrapAngleTo180_float(f1); + } + + if (f1 > 90.0F || f1 < -90.0F) + { + f1 = MathHelper.wrapAngleTo180_float(180.0F - f1); + f = MathHelper.wrapAngleTo180_float(f + 180.0F); + } + + entity.mountEntity((Entity)null); + ((EntityPlayerMP)entity).playerNetServerHandler.setPlayerLocation(commandbase$coordinatearg.func_179629_b(), commandbase$coordinatearg1.func_179629_b(), commandbase$coordinatearg2.func_179629_b(), f, f1, set); + entity.setRotationYawHead(f); + } + else + { + float f2 = (float)MathHelper.wrapAngleTo180_double(commandbase$coordinatearg3.func_179628_a()); + float f3 = (float)MathHelper.wrapAngleTo180_double(commandbase$coordinatearg4.func_179628_a()); + + if (f3 > 90.0F || f3 < -90.0F) + { + f3 = MathHelper.wrapAngleTo180_float(180.0F - f3); + f2 = MathHelper.wrapAngleTo180_float(f2 + 180.0F); + } + + entity.setLocationAndAngles(commandbase$coordinatearg.func_179628_a(), commandbase$coordinatearg1.func_179628_a(), commandbase$coordinatearg2.func_179628_a(), f2, f3); + entity.setRotationYawHead(f2); + } + + notifyOperators(sender, this, "commands.tp.success.coordinates", new Object[] {entity.getName(), Double.valueOf(commandbase$coordinatearg.func_179628_a()), Double.valueOf(commandbase$coordinatearg1.func_179628_a()), Double.valueOf(commandbase$coordinatearg2.func_179628_a())}); + } + } + else + { + Entity entity1 = func_175768_b(sender, args[args.length - 1]); + + if (entity1.worldObj != entity.worldObj) + { + throw new CommandException("commands.tp.notSameDimension", new Object[0]); + } + else + { + entity.mountEntity((Entity)null); + + if (entity instanceof EntityPlayerMP) + { + ((EntityPlayerMP)entity).playerNetServerHandler.setPlayerLocation(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch); + } + else + { + entity.setLocationAndAngles(entity1.posX, entity1.posY, entity1.posZ, entity1.rotationYaw, entity1.rotationPitch); + } + + notifyOperators(sender, this, "commands.tp.success", new Object[] {entity.getName(), entity1.getName()}); + } + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length != 1 && args.length != 2 ? null : getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandTestFor.java b/src/minecraft/net/minecraft/command/server/CommandTestFor.java new file mode 100644 index 0000000..036aea7 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandTestFor.java @@ -0,0 +1,95 @@ +package net.minecraft.command.server; + +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class CommandTestFor extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "testfor"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.testfor.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 1) + { + throw new WrongUsageException("commands.testfor.usage", new Object[0]); + } + else + { + Entity entity = func_175768_b(sender, args[0]); + NBTTagCompound nbttagcompound = null; + + if (args.length >= 2) + { + try + { + nbttagcompound = JsonToNBT.getTagFromJson(buildString(args, 1)); + } + catch (NBTException nbtexception) + { + throw new CommandException("commands.testfor.tagError", new Object[] {nbtexception.getMessage()}); + } + } + + if (nbttagcompound != null) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + entity.writeToNBT(nbttagcompound1); + + if (!NBTUtil.func_181123_a(nbttagcompound, nbttagcompound1, true)) + { + throw new CommandException("commands.testfor.failure", new Object[] {entity.getName()}); + } + } + + notifyOperators(sender, this, "commands.testfor.success", new Object[] {entity.getName()}); + } + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] args, int index) + { + return index == 0; + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length == 1 ? getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getAllUsernames()) : null; + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandTestForBlock.java b/src/minecraft/net/minecraft/command/server/CommandTestForBlock.java new file mode 100644 index 0000000..035ebcf --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandTestForBlock.java @@ -0,0 +1,149 @@ +package net.minecraft.command.server; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.CommandResultStats; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.NumberInvalidException; +import net.minecraft.command.WrongUsageException; +import net.minecraft.nbt.JsonToNBT; +import net.minecraft.nbt.NBTException; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class CommandTestForBlock extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "testforblock"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.testforblock.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 4) + { + throw new WrongUsageException("commands.testforblock.usage", new Object[0]); + } + else + { + sender.setCommandStat(CommandResultStats.Type.AFFECTED_BLOCKS, 0); + BlockPos blockpos = parseBlockPos(sender, args, 0, false); + Block block = Block.getBlockFromName(args[3]); + + if (block == null) + { + throw new NumberInvalidException("commands.setblock.notFound", new Object[] {args[3]}); + } + else + { + int i = -1; + + if (args.length >= 5) + { + i = parseInt(args[4], -1, 15); + } + + World world = sender.getEntityWorld(); + + if (!world.isBlockLoaded(blockpos)) + { + throw new CommandException("commands.testforblock.outOfWorld", new Object[0]); + } + else + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + + if (args.length >= 6 && block.hasTileEntity()) + { + String s = getChatComponentFromNthArg(sender, args, 5).getUnformattedText(); + + try + { + nbttagcompound = JsonToNBT.getTagFromJson(s); + flag = true; + } + catch (NBTException nbtexception) + { + throw new CommandException("commands.setblock.tagError", new Object[] {nbtexception.getMessage()}); + } + } + + IBlockState iblockstate = world.getBlockState(blockpos); + Block block1 = iblockstate.getBlock(); + + if (block1 != block) + { + throw new CommandException("commands.testforblock.failed.tile", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ()), block1.getLocalizedName(), block.getLocalizedName()}); + } + else + { + if (i > -1) + { + int j = iblockstate.getBlock().getMetaFromState(iblockstate); + + if (j != i) + { + throw new CommandException("commands.testforblock.failed.data", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ()), Integer.valueOf(j), Integer.valueOf(i)}); + } + } + + if (flag) + { + TileEntity tileentity = world.getTileEntity(blockpos); + + if (tileentity == null) + { + throw new CommandException("commands.testforblock.failed.tileEntity", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())}); + } + + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + tileentity.writeToNBT(nbttagcompound1); + + if (!NBTUtil.func_181123_a(nbttagcompound, nbttagcompound1, true)) + { + throw new CommandException("commands.testforblock.failed.nbt", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())}); + } + } + + sender.setCommandStat(CommandResultStats.Type.AFFECTED_BLOCKS, 1); + notifyOperators(sender, this, "commands.testforblock.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())}); + } + } + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + return args.length > 0 && args.length <= 3 ? func_175771_a(args, 0, pos) : (args.length == 4 ? getListOfStringsMatchingLastWord(args, Block.blockRegistry.getKeys()) : null); + } +} diff --git a/src/minecraft/net/minecraft/command/server/CommandWhitelist.java b/src/minecraft/net/minecraft/command/server/CommandWhitelist.java new file mode 100644 index 0000000..6938039 --- /dev/null +++ b/src/minecraft/net/minecraft/command/server/CommandWhitelist.java @@ -0,0 +1,135 @@ +package net.minecraft.command.server; + +import com.mojang.authlib.GameProfile; +import java.util.List; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.WrongUsageException; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; + +public class CommandWhitelist extends CommandBase +{ + /** + * Gets the name of the command + */ + public String getCommandName() + { + return "whitelist"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Gets the usage string for the command. + */ + public String getCommandUsage(ICommandSender sender) + { + return "commands.whitelist.usage"; + } + + /** + * Callback when the command is invoked + */ + public void processCommand(ICommandSender sender, String[] args) throws CommandException + { + if (args.length < 1) + { + throw new WrongUsageException("commands.whitelist.usage", new Object[0]); + } + else + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + + if (args[0].equals("on")) + { + minecraftserver.getConfigurationManager().setWhiteListEnabled(true); + notifyOperators(sender, this, "commands.whitelist.enabled", new Object[0]); + } + else if (args[0].equals("off")) + { + minecraftserver.getConfigurationManager().setWhiteListEnabled(false); + notifyOperators(sender, this, "commands.whitelist.disabled", new Object[0]); + } + else if (args[0].equals("list")) + { + sender.addChatMessage(new ChatComponentTranslation("commands.whitelist.list", new Object[] {Integer.valueOf(minecraftserver.getConfigurationManager().getWhitelistedPlayerNames().length), Integer.valueOf(minecraftserver.getConfigurationManager().getAvailablePlayerDat().length)})); + String[] astring = minecraftserver.getConfigurationManager().getWhitelistedPlayerNames(); + sender.addChatMessage(new ChatComponentText(joinNiceString(astring))); + } + else if (args[0].equals("add")) + { + if (args.length < 2) + { + throw new WrongUsageException("commands.whitelist.add.usage", new Object[0]); + } + + GameProfile gameprofile = minecraftserver.getPlayerProfileCache().getGameProfileForUsername(args[1]); + + if (gameprofile == null) + { + throw new CommandException("commands.whitelist.add.failed", new Object[] {args[1]}); + } + + minecraftserver.getConfigurationManager().addWhitelistedPlayer(gameprofile); + notifyOperators(sender, this, "commands.whitelist.add.success", new Object[] {args[1]}); + } + else if (args[0].equals("remove")) + { + if (args.length < 2) + { + throw new WrongUsageException("commands.whitelist.remove.usage", new Object[0]); + } + + GameProfile gameprofile1 = minecraftserver.getConfigurationManager().getWhitelistedPlayers().func_152706_a(args[1]); + + if (gameprofile1 == null) + { + throw new CommandException("commands.whitelist.remove.failed", new Object[] {args[1]}); + } + + minecraftserver.getConfigurationManager().removePlayerFromWhitelist(gameprofile1); + notifyOperators(sender, this, "commands.whitelist.remove.success", new Object[] {args[1]}); + } + else if (args[0].equals("reload")) + { + minecraftserver.getConfigurationManager().loadWhiteList(); + notifyOperators(sender, this, "commands.whitelist.reloaded", new Object[0]); + } + } + } + + public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) + { + if (args.length == 1) + { + return getListOfStringsMatchingLastWord(args, new String[] {"on", "off", "list", "add", "remove", "reload"}); + } + else + { + if (args.length == 2) + { + if (args[0].equals("remove")) + { + return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getConfigurationManager().getWhitelistedPlayerNames()); + } + + if (args[0].equals("add")) + { + return getListOfStringsMatchingLastWord(args, MinecraftServer.getServer().getPlayerProfileCache().getUsernames()); + } + } + + return null; + } + } +} diff --git a/src/minecraft/net/minecraft/crash/CrashReport.java b/src/minecraft/net/minecraft/crash/CrashReport.java new file mode 100644 index 0000000..01ba2fa --- /dev/null +++ b/src/minecraft/net/minecraft/crash/CrashReport.java @@ -0,0 +1,423 @@ +package net.minecraft.crash; + +import com.google.common.collect.Lists; +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.Writer; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.concurrent.Callable; + +import net.minecraft.util.ReportedException; +import net.minecraft.world.gen.layer.IntCache; +import optifine.CrashReportCpu; +import optifine.CrashReporter; +import optifine.Reflector; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class CrashReport +{ + private static final Logger logger = LogManager.getLogger(); + + /** Description of the crash report. */ + private final String description; + + /** The Throwable that is the "cause" for this crash and Crash Report. */ + private final Throwable cause; + + /** Category of crash */ + private final CrashReportCategory theReportCategory = new CrashReportCategory(this, "System Details"); + + /** Holds the keys and values of all crash report sections. */ + private final List crashReportSections = Lists.newArrayList(); + + /** File of crash report. */ + private File crashReportFile; + private boolean field_85059_f = true; + private StackTraceElement[] stacktrace = new StackTraceElement[0]; + private static final String __OBFID = "CL_00000990"; + private boolean reported = false; + + public CrashReport(String descriptionIn, Throwable causeThrowable) + { + this.description = descriptionIn; + this.cause = causeThrowable; + this.populateEnvironment(); + } + + /** + * Populates this crash report with initial information about the running server and operating system / java + * environment + */ + private void populateEnvironment() + { + this.theReportCategory.addCrashSectionCallable("Minecraft Version", new Callable() + { + private static final String __OBFID = "CL_00001197"; + public String call() + { + return "1.8.8"; + } + }); + this.theReportCategory.addCrashSectionCallable("Operating System", new Callable() + { + private static final String __OBFID = "CL_00001222"; + public String call() + { + return System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version"); + } + }); + this.theReportCategory.addCrashSectionCallable("CPU", new CrashReportCpu()); + this.theReportCategory.addCrashSectionCallable("Java Version", new Callable() + { + public String call() + { + return System.getProperty("java.version") + ", " + System.getProperty("java.vendor"); + } + }); + this.theReportCategory.addCrashSectionCallable("Java VM Version", new Callable() + { + private static final String __OBFID = "CL_00001275"; + public String call() + { + return System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor"); + } + }); + this.theReportCategory.addCrashSectionCallable("Memory", new Callable() + { + private static final String __OBFID = "CL_00001302"; + public String call() + { + Runtime runtime = Runtime.getRuntime(); + long i = runtime.maxMemory(); + long j = runtime.totalMemory(); + long k = runtime.freeMemory(); + long l = i / 1024L / 1024L; + long i1 = j / 1024L / 1024L; + long j1 = k / 1024L / 1024L; + return k + " bytes (" + j1 + " MB) / " + j + " bytes (" + i1 + " MB) up to " + i + " bytes (" + l + " MB)"; + } + }); + this.theReportCategory.addCrashSectionCallable("JVM Flags", new Callable() + { + private static final String __OBFID = "CL_00001329"; + public String call() + { + RuntimeMXBean runtimemxbean = ManagementFactory.getRuntimeMXBean(); + List list = runtimemxbean.getInputArguments(); + int i = 0; + StringBuilder stringbuilder = new StringBuilder(); + + for (Object s : list) + { + if (((String) s).startsWith("-X")) + { + if (i++ > 0) + { + stringbuilder.append(" "); + } + + stringbuilder.append(s); + } + } + + return String.format("%d total; %s", new Object[] {Integer.valueOf(i), stringbuilder.toString()}); + } + }); + this.theReportCategory.addCrashSectionCallable("IntCache", new Callable() + { + private static final String __OBFID = "CL_00001355"; + public String call() throws Exception + { + return IntCache.getCacheSizes(); + } + }); + + if (Reflector.FMLCommonHandler_enhanceCrashReport.exists()) + { + Object object = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]); + Reflector.callString(object, Reflector.FMLCommonHandler_enhanceCrashReport, new Object[] {this, this.theReportCategory}); + } + } + + /** + * Returns the description of the Crash Report. + */ + public String getDescription() + { + return this.description; + } + + /** + * Returns the Throwable object that is the cause for the crash and Crash Report. + */ + public Throwable getCrashCause() + { + return this.cause; + } + + /** + * Gets the various sections of the crash report into the given StringBuilder + */ + public void getSectionsInStringBuilder(StringBuilder builder) + { + if ((this.stacktrace == null || this.stacktrace.length <= 0) && this.crashReportSections.size() > 0) + { + this.stacktrace = (StackTraceElement[])((StackTraceElement[])ArrayUtils.subarray(((CrashReportCategory)this.crashReportSections.get(0)).getStackTrace(), 0, 1)); + } + + if (this.stacktrace != null && this.stacktrace.length > 0) + { + builder.append("-- Head --\n"); + builder.append("Stacktrace:\n"); + + for (StackTraceElement stacktraceelement : this.stacktrace) + { + builder.append("\t").append("at ").append(stacktraceelement.toString()); + builder.append("\n"); + } + + builder.append("\n"); + } + + for (Object crashreportcategory : this.crashReportSections) + { + ((CrashReportCategory) crashreportcategory).appendToStringBuilder(builder); + builder.append("\n\n"); + } + + this.theReportCategory.appendToStringBuilder(builder); + } + + /** + * Gets the stack trace of the Throwable that caused this crash report, or if that fails, the cause .toString(). + */ + public String getCauseStackTraceOrString() + { + StringWriter stringwriter = null; + PrintWriter printwriter = null; + Object object = this.cause; + + if (((Throwable)object).getMessage() == null) + { + if (object instanceof NullPointerException) + { + object = new NullPointerException(this.description); + } + else if (object instanceof StackOverflowError) + { + object = new StackOverflowError(this.description); + } + else if (object instanceof OutOfMemoryError) + { + object = new OutOfMemoryError(this.description); + } + + ((Throwable)object).setStackTrace(this.cause.getStackTrace()); + } + + String s = ((Throwable)object).toString(); + + try + { + stringwriter = new StringWriter(); + printwriter = new PrintWriter(stringwriter); + ((Throwable)object).printStackTrace(printwriter); + s = stringwriter.toString(); + } + finally + { + IOUtils.closeQuietly((Writer)stringwriter); + IOUtils.closeQuietly((Writer)printwriter); + } + + return s; + } + + /** + * Gets the complete report with headers, stack trace, and different sections as a string. + */ + public String getCompleteReport() + { + if (!this.reported) + { + this.reported = true; + CrashReporter.onCrashReport(this, this.theReportCategory); + } + + StringBuilder stringbuilder = new StringBuilder(); + stringbuilder.append("---- Minecraft Crash Report ----\n"); + Reflector.call(Reflector.BlamingTransformer_onCrash, new Object[] {stringbuilder}); + Reflector.call(Reflector.CoreModManager_onCrash, new Object[] {stringbuilder}); + stringbuilder.append("// "); + stringbuilder.append(getWittyComment()); + stringbuilder.append("\n\n"); + stringbuilder.append("Time: "); + stringbuilder.append((new SimpleDateFormat()).format(new Date())); + stringbuilder.append("\n"); + stringbuilder.append("Description: "); + stringbuilder.append(this.description); + stringbuilder.append("\n\n"); + stringbuilder.append(this.getCauseStackTraceOrString()); + stringbuilder.append("\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n"); + + for (int i = 0; i < 87; ++i) + { + stringbuilder.append("-"); + } + + stringbuilder.append("\n\n"); + this.getSectionsInStringBuilder(stringbuilder); + return stringbuilder.toString(); + } + + /** + * Gets the file this crash report is saved into. + */ + public File getFile() + { + return this.crashReportFile; + } + + /** + * Saves this CrashReport to the given file and returns a value indicating whether we were successful at doing so. + */ + public boolean saveToFile(File toFile) + { + if (this.crashReportFile != null) + { + return false; + } + else + { + if (toFile.getParentFile() != null) + { + toFile.getParentFile().mkdirs(); + } + + try + { + FileWriter filewriter = new FileWriter(toFile); + filewriter.write(this.getCompleteReport()); + filewriter.close(); + this.crashReportFile = toFile; + return true; + } + catch (Throwable throwable) + { + logger.error("Could not save crash report to " + toFile, throwable); + return false; + } + } + } + + public CrashReportCategory getCategory() + { + return this.theReportCategory; + } + + /** + * Creates a CrashReportCategory + */ + public CrashReportCategory makeCategory(String name) + { + return this.makeCategoryDepth(name, 1); + } + + /** + * Creates a CrashReportCategory for the given stack trace depth + */ + public CrashReportCategory makeCategoryDepth(String categoryName, int stacktraceLength) + { + CrashReportCategory crashreportcategory = new CrashReportCategory(this, categoryName); + + if (this.field_85059_f) + { + int i = crashreportcategory.getPrunedStackTrace(stacktraceLength); + StackTraceElement[] astacktraceelement = this.cause.getStackTrace(); + StackTraceElement stacktraceelement = null; + StackTraceElement stacktraceelement1 = null; + int j = astacktraceelement.length - i; + + if (j < 0) + { + System.out.println("Negative index in crash report handler (" + astacktraceelement.length + "/" + i + ")"); + } + + if (astacktraceelement != null && 0 <= j && j < astacktraceelement.length) + { + stacktraceelement = astacktraceelement[j]; + + if (astacktraceelement.length + 1 - i < astacktraceelement.length) + { + stacktraceelement1 = astacktraceelement[astacktraceelement.length + 1 - i]; + } + } + + this.field_85059_f = crashreportcategory.firstTwoElementsOfStackTraceMatch(stacktraceelement, stacktraceelement1); + + if (i > 0 && !this.crashReportSections.isEmpty()) + { + CrashReportCategory crashreportcategory1 = (CrashReportCategory)this.crashReportSections.get(this.crashReportSections.size() - 1); + crashreportcategory1.trimStackTraceEntriesFromBottom(i); + } + else if (astacktraceelement != null && astacktraceelement.length >= i && 0 <= j && j < astacktraceelement.length) + { + this.stacktrace = new StackTraceElement[j]; + System.arraycopy(astacktraceelement, 0, this.stacktrace, 0, this.stacktrace.length); + } + else + { + this.field_85059_f = false; + } + } + + this.crashReportSections.add(crashreportcategory); + return crashreportcategory; + } + + /** + * Gets a random witty comment for inclusion in this CrashReport + */ + private static String getWittyComment() + { + String[] astring = new String[] {"Who set us up the TNT?", "Everything\'s going to plan. No, really, that was supposed to happen.", "Uh... Did I do that?", "Oops.", "Why did you do that?", "I feel sad now :(", "My bad.", "I\'m sorry, Dave.", "I let you down. Sorry :(", "On the bright side, I bought you a teddy bear!", "Daisy, daisy...", "Oh - I know what I did wrong!", "Hey, that tickles! Hehehe!", "I blame Dinnerbone.", "You should try our sister game, Minceraft!", "Don\'t be sad. I\'ll do better next time, I promise!", "Don\'t be sad, have a hug! <3", "I just don\'t know what went wrong :(", "Shall we play a game?", "Quite honestly, I wouldn\'t worry myself about that.", "I bet Cylons wouldn\'t have this problem.", "Sorry :(", "Surprise! Haha. Well, this is awkward.", "Would you like a cupcake?", "Hi. I\'m Minecraft, and I\'m a crashaholic.", "Ooh. Shiny.", "This doesn\'t make any sense!", "Why is it breaking :(", "Don\'t do that.", "Ouch. That hurt :(", "You\'re mean.", "This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]", "There are four lights!", "But it works on my machine."}; + + try + { + return astring[(int)(System.nanoTime() % (long)astring.length)]; + } + catch (Throwable var2) + { + return "Witty comment unavailable :("; + } + } + + /** + * Creates a crash report for the exception + */ + public static CrashReport makeCrashReport(Throwable causeIn, String descriptionIn) + { + CrashReport crashreport; + + if (causeIn instanceof ReportedException) + { + crashreport = ((ReportedException)causeIn).getCrashReport(); + } + else + { + crashreport = new CrashReport(descriptionIn, causeIn); + } + + return crashreport; + } +} diff --git a/src/minecraft/net/minecraft/crash/CrashReportCategory.java b/src/minecraft/net/minecraft/crash/CrashReportCategory.java new file mode 100644 index 0000000..38bb981 --- /dev/null +++ b/src/minecraft/net/minecraft/crash/CrashReportCategory.java @@ -0,0 +1,308 @@ +package net.minecraft.crash; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; + +public class CrashReportCategory +{ + private final CrashReport crashReport; + private final String name; + private final List children = Lists.newArrayList(); + private StackTraceElement[] stackTrace = new StackTraceElement[0]; + + public CrashReportCategory(CrashReport report, String name) + { + this.crashReport = report; + this.name = name; + } + + public static String getCoordinateInfo(double x, double y, double z) + { + return String.format("%.2f,%.2f,%.2f - %s", new Object[] {Double.valueOf(x), Double.valueOf(y), Double.valueOf(z), getCoordinateInfo(new BlockPos(x, y, z))}); + } + + public static String getCoordinateInfo(BlockPos pos) + { + int i = pos.getX(); + int j = pos.getY(); + int k = pos.getZ(); + StringBuilder stringbuilder = new StringBuilder(); + + try + { + stringbuilder.append(String.format("World: (%d,%d,%d)", new Object[] {Integer.valueOf(i), Integer.valueOf(j), Integer.valueOf(k)})); + } + catch (Throwable var17) + { + stringbuilder.append("(Error finding world loc)"); + } + + stringbuilder.append(", "); + + try + { + int l = i >> 4; + int i1 = k >> 4; + int j1 = i & 15; + int k1 = j >> 4; + int l1 = k & 15; + int i2 = l << 4; + int j2 = i1 << 4; + int k2 = (l + 1 << 4) - 1; + int l2 = (i1 + 1 << 4) - 1; + stringbuilder.append(String.format("Chunk: (at %d,%d,%d in %d,%d; contains blocks %d,0,%d to %d,255,%d)", new Object[] {Integer.valueOf(j1), Integer.valueOf(k1), Integer.valueOf(l1), Integer.valueOf(l), Integer.valueOf(i1), Integer.valueOf(i2), Integer.valueOf(j2), Integer.valueOf(k2), Integer.valueOf(l2)})); + } + catch (Throwable var16) + { + stringbuilder.append("(Error finding chunk loc)"); + } + + stringbuilder.append(", "); + + try + { + int j3 = i >> 9; + int k3 = k >> 9; + int l3 = j3 << 5; + int i4 = k3 << 5; + int j4 = (j3 + 1 << 5) - 1; + int k4 = (k3 + 1 << 5) - 1; + int l4 = j3 << 9; + int i5 = k3 << 9; + int j5 = (j3 + 1 << 9) - 1; + int i3 = (k3 + 1 << 9) - 1; + stringbuilder.append(String.format("Region: (%d,%d; contains chunks %d,%d to %d,%d, blocks %d,0,%d to %d,255,%d)", new Object[] {Integer.valueOf(j3), Integer.valueOf(k3), Integer.valueOf(l3), Integer.valueOf(i4), Integer.valueOf(j4), Integer.valueOf(k4), Integer.valueOf(l4), Integer.valueOf(i5), Integer.valueOf(j5), Integer.valueOf(i3)})); + } + catch (Throwable var15) + { + stringbuilder.append("(Error finding world loc)"); + } + + return stringbuilder.toString(); + } + + /** + * Adds a Crashreport section with the given name with the value set to the result of the given Callable; + */ + public void addCrashSectionCallable(String sectionName, Callable callable) + { + try + { + this.addCrashSection(sectionName, callable.call()); + } + catch (Throwable throwable) + { + this.addCrashSectionThrowable(sectionName, throwable); + } + } + + /** + * Adds a Crashreport section with the given name with the given value (convered .toString()) + */ + public void addCrashSection(String sectionName, Object value) + { + this.children.add(new CrashReportCategory.Entry(sectionName, value)); + } + + /** + * Adds a Crashreport section with the given name with the given Throwable + */ + public void addCrashSectionThrowable(String sectionName, Throwable throwable) + { + this.addCrashSection(sectionName, throwable); + } + + /** + * Resets our stack trace according to the current trace, pruning the deepest 3 entries. The parameter indicates + * how many additional deepest entries to prune. Returns the number of entries in the resulting pruned stack trace. + */ + public int getPrunedStackTrace(int size) + { + StackTraceElement[] astacktraceelement = Thread.currentThread().getStackTrace(); + + if (astacktraceelement.length <= 0) + { + return 0; + } + else + { + this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - size]; + System.arraycopy(astacktraceelement, 3 + size, this.stackTrace, 0, this.stackTrace.length); + return this.stackTrace.length; + } + } + + /** + * Do the deepest two elements of our saved stack trace match the given elements, in order from the deepest? + */ + public boolean firstTwoElementsOfStackTraceMatch(StackTraceElement s1, StackTraceElement s2) + { + if (this.stackTrace.length != 0 && s1 != null) + { + StackTraceElement stacktraceelement = this.stackTrace[0]; + + if (stacktraceelement.isNativeMethod() == s1.isNativeMethod() && stacktraceelement.getClassName().equals(s1.getClassName()) && stacktraceelement.getFileName().equals(s1.getFileName()) && stacktraceelement.getMethodName().equals(s1.getMethodName())) + { + if (s2 != null != this.stackTrace.length > 1) + { + return false; + } + else if (s2 != null && !this.stackTrace[1].equals(s2)) + { + return false; + } + else + { + this.stackTrace[0] = s1; + return true; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + + /** + * Removes the given number entries from the bottom of the stack trace. + */ + public void trimStackTraceEntriesFromBottom(int amount) + { + StackTraceElement[] astacktraceelement = new StackTraceElement[this.stackTrace.length - amount]; + System.arraycopy(this.stackTrace, 0, astacktraceelement, 0, astacktraceelement.length); + this.stackTrace = astacktraceelement; + } + + public void appendToStringBuilder(StringBuilder builder) + { + builder.append("-- ").append(this.name).append(" --\n"); + builder.append("Details:"); + + for (CrashReportCategory.Entry crashreportcategory$entry : this.children) + { + builder.append("\n\t"); + builder.append(crashreportcategory$entry.getKey()); + builder.append(": "); + builder.append(crashreportcategory$entry.getValue()); + } + + if (this.stackTrace != null && this.stackTrace.length > 0) + { + builder.append("\nStacktrace:"); + + for (StackTraceElement stacktraceelement : this.stackTrace) + { + builder.append("\n\tat "); + builder.append(stacktraceelement.toString()); + } + } + } + + public StackTraceElement[] getStackTrace() + { + return this.stackTrace; + } + + public static void addBlockInfo(CrashReportCategory category, final BlockPos pos, final Block blockIn, final int blockData) + { + final int i = Block.getIdFromBlock(blockIn); + category.addCrashSectionCallable("Block type", new Callable() + { + public String call() throws Exception + { + try + { + return String.format("ID #%d (%s // %s)", new Object[] {Integer.valueOf(i), blockIn.getUnlocalizedName(), blockIn.getClass().getCanonicalName()}); + } + catch (Throwable var2) + { + return "ID #" + i; + } + } + }); + category.addCrashSectionCallable("Block data value", new Callable() + { + public String call() throws Exception + { + if (blockData < 0) + { + return "Unknown? (Got " + blockData + ")"; + } + else + { + String s = String.format("%4s", new Object[] {Integer.toBinaryString(blockData)}).replace(" ", "0"); + return String.format("%1$d / 0x%1$X / 0b%2$s", new Object[] {Integer.valueOf(blockData), s}); + } + } + }); + category.addCrashSectionCallable("Block location", new Callable() + { + public String call() throws Exception + { + return CrashReportCategory.getCoordinateInfo(pos); + } + }); + } + + public static void addBlockInfo(CrashReportCategory category, final BlockPos pos, final IBlockState state) + { + category.addCrashSectionCallable("Block", new Callable() + { + public String call() throws Exception + { + return state.toString(); + } + }); + category.addCrashSectionCallable("Block location", new Callable() + { + public String call() throws Exception + { + return CrashReportCategory.getCoordinateInfo(pos); + } + }); + } + + static class Entry + { + private final String key; + private final String value; + + public Entry(String key, Object value) + { + this.key = key; + + if (value == null) + { + this.value = "~~NULL~~"; + } + else if (value instanceof Throwable) + { + Throwable throwable = (Throwable)value; + this.value = "~~ERROR~~ " + throwable.getClass().getSimpleName() + ": " + throwable.getMessage(); + } + else + { + this.value = value.toString(); + } + } + + public String getKey() + { + return this.key; + } + + public String getValue() + { + return this.value; + } + } +} diff --git a/src/minecraft/net/minecraft/creativetab/CreativeTabs.java b/src/minecraft/net/minecraft/creativetab/CreativeTabs.java new file mode 100644 index 0000000..0176d24 --- /dev/null +++ b/src/minecraft/net/minecraft/creativetab/CreativeTabs.java @@ -0,0 +1,289 @@ +package net.minecraft.creativetab; + +import java.util.List; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentData; +import net.minecraft.enchantment.EnumEnchantmentType; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public abstract class CreativeTabs +{ + public static final CreativeTabs[] creativeTabArray = new CreativeTabs[12]; + public static final CreativeTabs tabBlock = new CreativeTabs(0, "buildingBlocks") + { + public Item getTabIconItem() + { + return Item.getItemFromBlock(Blocks.brick_block); + } + }; + public static final CreativeTabs tabDecorations = new CreativeTabs(1, "decorations") + { + public Item getTabIconItem() + { + return Item.getItemFromBlock(Blocks.double_plant); + } + public int getIconItemDamage() + { + return BlockDoublePlant.EnumPlantType.PAEONIA.getMeta(); + } + }; + public static final CreativeTabs tabRedstone = new CreativeTabs(2, "redstone") + { + public Item getTabIconItem() + { + return Items.redstone; + } + }; + public static final CreativeTabs tabTransport = new CreativeTabs(3, "transportation") + { + public Item getTabIconItem() + { + return Item.getItemFromBlock(Blocks.golden_rail); + } + }; + public static final CreativeTabs tabMisc = (new CreativeTabs(4, "misc") + { + public Item getTabIconItem() + { + return Items.lava_bucket; + } + }).setRelevantEnchantmentTypes(new EnumEnchantmentType[] {EnumEnchantmentType.ALL}); + public static final CreativeTabs tabAllSearch = (new CreativeTabs(5, "search") + { + public Item getTabIconItem() + { + return Items.compass; + } + }).setBackgroundImageName("item_search.png"); + public static final CreativeTabs tabFood = new CreativeTabs(6, "food") + { + public Item getTabIconItem() + { + return Items.apple; + } + }; + public static final CreativeTabs tabTools = (new CreativeTabs(7, "tools") + { + public Item getTabIconItem() + { + return Items.iron_axe; + } + }).setRelevantEnchantmentTypes(new EnumEnchantmentType[] {EnumEnchantmentType.DIGGER, EnumEnchantmentType.FISHING_ROD, EnumEnchantmentType.BREAKABLE}); + public static final CreativeTabs tabCombat = (new CreativeTabs(8, "combat") + { + public Item getTabIconItem() + { + return Items.golden_sword; + } + }).setRelevantEnchantmentTypes(new EnumEnchantmentType[] {EnumEnchantmentType.ARMOR, EnumEnchantmentType.ARMOR_FEET, EnumEnchantmentType.ARMOR_HEAD, EnumEnchantmentType.ARMOR_LEGS, EnumEnchantmentType.ARMOR_TORSO, EnumEnchantmentType.BOW, EnumEnchantmentType.WEAPON}); + public static final CreativeTabs tabBrewing = new CreativeTabs(9, "brewing") + { + public Item getTabIconItem() + { + return Items.potionitem; + } + }; + public static final CreativeTabs tabMaterials = new CreativeTabs(10, "materials") + { + public Item getTabIconItem() + { + return Items.stick; + } + }; + public static final CreativeTabs tabInventory = (new CreativeTabs(11, "inventory") + { + public Item getTabIconItem() + { + return Item.getItemFromBlock(Blocks.chest); + } + }).setBackgroundImageName("inventory.png").setNoScrollbar().setNoTitle(); + private final int tabIndex; + private final String tabLabel; + + /** Texture to use. */ + private String theTexture = "items.png"; + private boolean hasScrollbar = true; + + /** Whether to draw the title in the foreground of the creative GUI */ + private boolean drawTitle = true; + private EnumEnchantmentType[] enchantmentTypes; + private ItemStack iconItemStack; + + public CreativeTabs(int index, String label) + { + this.tabIndex = index; + this.tabLabel = label; + creativeTabArray[index] = this; + } + + public int getTabIndex() + { + return this.tabIndex; + } + + public String getTabLabel() + { + return this.tabLabel; + } + + /** + * Gets the translated Label. + */ + public String getTranslatedTabLabel() + { + return "itemGroup." + this.getTabLabel(); + } + + public ItemStack getIconItemStack() + { + if (this.iconItemStack == null) + { + this.iconItemStack = new ItemStack(this.getTabIconItem(), 1, this.getIconItemDamage()); + } + + return this.iconItemStack; + } + + public abstract Item getTabIconItem(); + + public int getIconItemDamage() + { + return 0; + } + + public String getBackgroundImageName() + { + return this.theTexture; + } + + public CreativeTabs setBackgroundImageName(String texture) + { + this.theTexture = texture; + return this; + } + + public boolean drawInForegroundOfTab() + { + return this.drawTitle; + } + + public CreativeTabs setNoTitle() + { + this.drawTitle = false; + return this; + } + + public boolean shouldHidePlayerInventory() + { + return this.hasScrollbar; + } + + public CreativeTabs setNoScrollbar() + { + this.hasScrollbar = false; + return this; + } + + /** + * returns index % 6 + */ + public int getTabColumn() + { + return this.tabIndex % 6; + } + + /** + * returns tabIndex < 6 + */ + public boolean isTabInFirstRow() + { + return this.tabIndex < 6; + } + + /** + * Returns the enchantment types relevant to this tab + */ + public EnumEnchantmentType[] getRelevantEnchantmentTypes() + { + return this.enchantmentTypes; + } + + /** + * Sets the enchantment types for populating this tab with enchanting books + */ + public CreativeTabs setRelevantEnchantmentTypes(EnumEnchantmentType... types) + { + this.enchantmentTypes = types; + return this; + } + + public boolean hasRelevantEnchantmentType(EnumEnchantmentType enchantmentType) + { + if (this.enchantmentTypes == null) + { + return false; + } + else + { + for (EnumEnchantmentType enumenchantmenttype : this.enchantmentTypes) + { + if (enumenchantmenttype == enchantmentType) + { + return true; + } + } + + return false; + } + } + + /** + * only shows items which have tabToDisplayOn == this + */ + public void displayAllReleventItems(List p_78018_1_) + { + for (Item item : Item.itemRegistry) + { + if (item != null && item.getCreativeTab() == this) + { + item.getSubItems(item, this, p_78018_1_); + } + } + + if (this.getRelevantEnchantmentTypes() != null) + { + this.addEnchantmentBooksToList(p_78018_1_, this.getRelevantEnchantmentTypes()); + } + } + + /** + * Adds the enchantment books from the supplied EnumEnchantmentType to the given list. + */ + public void addEnchantmentBooksToList(List itemList, EnumEnchantmentType... enchantmentType) + { + for (Enchantment enchantment : Enchantment.enchantmentsBookList) + { + if (enchantment != null && enchantment.type != null) + { + boolean flag = false; + + for (int i = 0; i < enchantmentType.length && !flag; ++i) + { + if (enchantment.type == enchantmentType[i]) + { + flag = true; + } + } + + if (flag) + { + itemList.add(Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(enchantment, enchantment.getMaxLevel()))); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/dispenser/BehaviorDefaultDispenseItem.java b/src/minecraft/net/minecraft/dispenser/BehaviorDefaultDispenseItem.java new file mode 100644 index 0000000..aa8e7d7 --- /dev/null +++ b/src/minecraft/net/minecraft/dispenser/BehaviorDefaultDispenseItem.java @@ -0,0 +1,80 @@ +package net.minecraft.dispenser; + +import net.minecraft.block.BlockDispenser; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class BehaviorDefaultDispenseItem implements IBehaviorDispenseItem +{ + /** + * Dispenses the specified ItemStack from a dispenser. + */ + public final ItemStack dispense(IBlockSource source, ItemStack stack) + { + ItemStack itemstack = this.dispenseStack(source, stack); + this.playDispenseSound(source); + this.spawnDispenseParticles(source, BlockDispenser.getFacing(source.getBlockMetadata())); + return itemstack; + } + + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata()); + IPosition iposition = BlockDispenser.getDispensePosition(source); + ItemStack itemstack = stack.splitStack(1); + doDispense(source.getWorld(), itemstack, 6, enumfacing, iposition); + return stack; + } + + public static void doDispense(World worldIn, ItemStack stack, int speed, EnumFacing facing, IPosition position) + { + double d0 = position.getX(); + double d1 = position.getY(); + double d2 = position.getZ(); + + if (facing.getAxis() == EnumFacing.Axis.Y) + { + d1 = d1 - 0.125D; + } + else + { + d1 = d1 - 0.15625D; + } + + EntityItem entityitem = new EntityItem(worldIn, d0, d1, d2, stack); + double d3 = worldIn.rand.nextDouble() * 0.1D + 0.2D; + entityitem.motionX = (double)facing.getFrontOffsetX() * d3; + entityitem.motionY = 0.20000000298023224D; + entityitem.motionZ = (double)facing.getFrontOffsetZ() * d3; + entityitem.motionX += worldIn.rand.nextGaussian() * 0.007499999832361937D * (double)speed; + entityitem.motionY += worldIn.rand.nextGaussian() * 0.007499999832361937D * (double)speed; + entityitem.motionZ += worldIn.rand.nextGaussian() * 0.007499999832361937D * (double)speed; + worldIn.spawnEntityInWorld(entityitem); + } + + /** + * Play the dispense sound from the specified block. + */ + protected void playDispenseSound(IBlockSource source) + { + source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0); + } + + /** + * Order clients to display dispense particles from the specified block and facing. + */ + protected void spawnDispenseParticles(IBlockSource source, EnumFacing facingIn) + { + source.getWorld().playAuxSFX(2000, source.getBlockPos(), this.func_82488_a(facingIn)); + } + + private int func_82488_a(EnumFacing facingIn) + { + return facingIn.getFrontOffsetX() + 1 + (facingIn.getFrontOffsetZ() + 1) * 3; + } +} diff --git a/src/minecraft/net/minecraft/dispenser/BehaviorProjectileDispense.java b/src/minecraft/net/minecraft/dispenser/BehaviorProjectileDispense.java new file mode 100644 index 0000000..5beb55d --- /dev/null +++ b/src/minecraft/net/minecraft/dispenser/BehaviorProjectileDispense.java @@ -0,0 +1,49 @@ +package net.minecraft.dispenser; + +import net.minecraft.block.BlockDispenser; +import net.minecraft.entity.Entity; +import net.minecraft.entity.IProjectile; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public abstract class BehaviorProjectileDispense extends BehaviorDefaultDispenseItem +{ + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + public ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + World world = source.getWorld(); + IPosition iposition = BlockDispenser.getDispensePosition(source); + EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata()); + IProjectile iprojectile = this.getProjectileEntity(world, iposition); + iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a()); + world.spawnEntityInWorld((Entity)iprojectile); + stack.splitStack(1); + return stack; + } + + /** + * Play the dispense sound from the specified block. + */ + protected void playDispenseSound(IBlockSource source) + { + source.getWorld().playAuxSFX(1002, source.getBlockPos(), 0); + } + + /** + * Return the projectile entity spawned by this dispense behavior. + */ + protected abstract IProjectile getProjectileEntity(World worldIn, IPosition position); + + protected float func_82498_a() + { + return 6.0F; + } + + protected float func_82500_b() + { + return 1.1F; + } +} diff --git a/src/minecraft/net/minecraft/dispenser/IBehaviorDispenseItem.java b/src/minecraft/net/minecraft/dispenser/IBehaviorDispenseItem.java new file mode 100644 index 0000000..a0af99e --- /dev/null +++ b/src/minecraft/net/minecraft/dispenser/IBehaviorDispenseItem.java @@ -0,0 +1,19 @@ +package net.minecraft.dispenser; + +import net.minecraft.item.ItemStack; + +public interface IBehaviorDispenseItem +{ + IBehaviorDispenseItem itemDispenseBehaviorProvider = new IBehaviorDispenseItem() + { + public ItemStack dispense(IBlockSource source, ItemStack stack) + { + return stack; + } + }; + + /** + * Dispenses the specified ItemStack from a dispenser. + */ + ItemStack dispense(IBlockSource source, ItemStack stack); +} diff --git a/src/minecraft/net/minecraft/dispenser/IBlockSource.java b/src/minecraft/net/minecraft/dispenser/IBlockSource.java new file mode 100644 index 0000000..2f52975 --- /dev/null +++ b/src/minecraft/net/minecraft/dispenser/IBlockSource.java @@ -0,0 +1,19 @@ +package net.minecraft.dispenser; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; + +public interface IBlockSource extends ILocatableSource +{ + double getX(); + + double getY(); + + double getZ(); + + BlockPos getBlockPos(); + + int getBlockMetadata(); + + T getBlockTileEntity(); +} diff --git a/src/minecraft/net/minecraft/dispenser/ILocatableSource.java b/src/minecraft/net/minecraft/dispenser/ILocatableSource.java new file mode 100644 index 0000000..7fad44b --- /dev/null +++ b/src/minecraft/net/minecraft/dispenser/ILocatableSource.java @@ -0,0 +1,5 @@ +package net.minecraft.dispenser; + +public interface ILocatableSource extends ILocation +{ +} diff --git a/src/minecraft/net/minecraft/dispenser/ILocation.java b/src/minecraft/net/minecraft/dispenser/ILocation.java new file mode 100644 index 0000000..33175ca --- /dev/null +++ b/src/minecraft/net/minecraft/dispenser/ILocation.java @@ -0,0 +1,8 @@ +package net.minecraft.dispenser; + +import net.minecraft.world.World; + +public interface ILocation extends IPosition +{ + World getWorld(); +} diff --git a/src/minecraft/net/minecraft/dispenser/IPosition.java b/src/minecraft/net/minecraft/dispenser/IPosition.java new file mode 100644 index 0000000..af86d59 --- /dev/null +++ b/src/minecraft/net/minecraft/dispenser/IPosition.java @@ -0,0 +1,10 @@ +package net.minecraft.dispenser; + +public interface IPosition +{ + double getX(); + + double getY(); + + double getZ(); +} diff --git a/src/minecraft/net/minecraft/dispenser/PositionImpl.java b/src/minecraft/net/minecraft/dispenser/PositionImpl.java new file mode 100644 index 0000000..b7fe22f --- /dev/null +++ b/src/minecraft/net/minecraft/dispenser/PositionImpl.java @@ -0,0 +1,30 @@ +package net.minecraft.dispenser; + +public class PositionImpl implements IPosition +{ + protected final double x; + protected final double y; + protected final double z; + + public PositionImpl(double xCoord, double yCoord, double zCoord) + { + this.x = xCoord; + this.y = yCoord; + this.z = zCoord; + } + + public double getX() + { + return this.x; + } + + public double getY() + { + return this.y; + } + + public double getZ() + { + return this.z; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/Enchantment.java b/src/minecraft/net/minecraft/enchantment/Enchantment.java new file mode 100644 index 0000000..fc2b801 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/Enchantment.java @@ -0,0 +1,260 @@ +package net.minecraft.enchantment; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; +import java.util.Set; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + +public abstract class Enchantment +{ + private static final Enchantment[] enchantmentsList = new Enchantment[256]; + public static final Enchantment[] enchantmentsBookList; + private static final Map locationEnchantments = Maps.newHashMap(); + public static final Enchantment protection = new EnchantmentProtection(0, new ResourceLocation("protection"), 10, 0); + + /** Protection against fire */ + public static final Enchantment fireProtection = new EnchantmentProtection(1, new ResourceLocation("fire_protection"), 5, 1); + public static final Enchantment featherFalling = new EnchantmentProtection(2, new ResourceLocation("feather_falling"), 5, 2); + + /** Protection against explosions */ + public static final Enchantment blastProtection = new EnchantmentProtection(3, new ResourceLocation("blast_protection"), 2, 3); + public static final Enchantment projectileProtection = new EnchantmentProtection(4, new ResourceLocation("projectile_protection"), 5, 4); + public static final Enchantment respiration = new EnchantmentOxygen(5, new ResourceLocation("respiration"), 2); + + /** Increases underwater mining rate */ + public static final Enchantment aquaAffinity = new EnchantmentWaterWorker(6, new ResourceLocation("aqua_affinity"), 2); + public static final Enchantment thorns = new EnchantmentThorns(7, new ResourceLocation("thorns"), 1); + public static final Enchantment depthStrider = new EnchantmentWaterWalker(8, new ResourceLocation("depth_strider"), 2); + public static final Enchantment sharpness = new EnchantmentDamage(16, new ResourceLocation("sharpness"), 10, 0); + public static final Enchantment smite = new EnchantmentDamage(17, new ResourceLocation("smite"), 5, 1); + public static final Enchantment baneOfArthropods = new EnchantmentDamage(18, new ResourceLocation("bane_of_arthropods"), 5, 2); + public static final Enchantment knockback = new EnchantmentKnockback(19, new ResourceLocation("knockback"), 5); + + /** Lights mobs on fire */ + public static final Enchantment fireAspect = new EnchantmentFireAspect(20, new ResourceLocation("fire_aspect"), 2); + + /** Mobs have a chance to drop more loot */ + public static final Enchantment looting = new EnchantmentLootBonus(21, new ResourceLocation("looting"), 2, EnumEnchantmentType.WEAPON); + + /** Faster resource gathering while in use */ + public static final Enchantment efficiency = new EnchantmentDigging(32, new ResourceLocation("efficiency"), 10); + + /** + * Blocks mined will drop themselves, even if it should drop something else (e.g. stone will drop stone, not + * cobblestone) + */ + public static final Enchantment silkTouch = new EnchantmentUntouching(33, new ResourceLocation("silk_touch"), 1); + + /** + * Sometimes, the tool's durability will not be spent when the tool is used + */ + public static final Enchantment unbreaking = new EnchantmentDurability(34, new ResourceLocation("unbreaking"), 5); + + /** Can multiply the drop rate of items from blocks */ + public static final Enchantment fortune = new EnchantmentLootBonus(35, new ResourceLocation("fortune"), 2, EnumEnchantmentType.DIGGER); + + /** Power enchantment for bows, add's extra damage to arrows. */ + public static final Enchantment power = new EnchantmentArrowDamage(48, new ResourceLocation("power"), 10); + + /** + * Knockback enchantments for bows, the arrows will knockback the target when hit. + */ + public static final Enchantment punch = new EnchantmentArrowKnockback(49, new ResourceLocation("punch"), 2); + + /** + * Flame enchantment for bows. Arrows fired by the bow will be on fire. Any target hit will also set on fire. + */ + public static final Enchantment flame = new EnchantmentArrowFire(50, new ResourceLocation("flame"), 2); + + /** + * Infinity enchantment for bows. The bow will not consume arrows anymore, but will still required at least one + * arrow on inventory use the bow. + */ + public static final Enchantment infinity = new EnchantmentArrowInfinite(51, new ResourceLocation("infinity"), 1); + public static final Enchantment luckOfTheSea = new EnchantmentLootBonus(61, new ResourceLocation("luck_of_the_sea"), 2, EnumEnchantmentType.FISHING_ROD); + public static final Enchantment lure = new EnchantmentFishingSpeed(62, new ResourceLocation("lure"), 2, EnumEnchantmentType.FISHING_ROD); + public final int effectId; + private final int weight; + + /** The EnumEnchantmentType given to this Enchantment. */ + public EnumEnchantmentType type; + + /** Used in localisation and stats. */ + protected String name; + + /** + * Retrieves an Enchantment from the enchantmentsList + */ + public static Enchantment getEnchantmentById(int enchID) + { + return enchID >= 0 && enchID < enchantmentsList.length ? enchantmentsList[enchID] : null; + } + + protected Enchantment(int enchID, ResourceLocation enchName, int enchWeight, EnumEnchantmentType enchType) + { + this.effectId = enchID; + this.weight = enchWeight; + this.type = enchType; + + if (enchantmentsList[enchID] != null) + { + throw new IllegalArgumentException("Duplicate enchantment id!"); + } + else + { + enchantmentsList[enchID] = this; + locationEnchantments.put(enchName, this); + } + } + + /** + * Retrieves an enchantment by using its location name. + */ + public static Enchantment getEnchantmentByLocation(String location) + { + return (Enchantment)locationEnchantments.get(new ResourceLocation(location)); + } + + public static Set func_181077_c() + { + return locationEnchantments.keySet(); + } + + /** + * Retrieves the weight value of an Enchantment. This weight value is used within vanilla to determine how rare an + * enchantment is. + */ + public int getWeight() + { + return this.weight; + } + + /** + * Returns the minimum level that the enchantment can have. + */ + public int getMinLevel() + { + return 1; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 1; + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 1 + enchantmentLevel * 10; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return this.getMinEnchantability(enchantmentLevel) + 5; + } + + /** + * Calculates the damage protection of the enchantment based on level and damage source passed. + */ + public int calcModifierDamage(int level, DamageSource source) + { + return 0; + } + + /** + * Calculates the additional damage that will be dealt by an item with this enchantment. This alternative to + * calcModifierDamage is sensitive to the targets EnumCreatureAttribute. + */ + public float calcDamageByCreature(int level, EnumCreatureAttribute creatureType) + { + return 0.0F; + } + + /** + * Determines if the enchantment passed can be applyied together with this enchantment. + */ + public boolean canApplyTogether(Enchantment ench) + { + return this != ench; + } + + /** + * Sets the enchantment name + */ + public Enchantment setName(String enchName) + { + this.name = enchName; + return this; + } + + /** + * Return the name of key in translation table of this enchantment. + */ + public String getName() + { + return "enchantment." + this.name; + } + + /** + * Returns the correct traslated name of the enchantment and the level in roman numbers. + */ + public String getTranslatedName(int level) + { + String s = StatCollector.translateToLocal(this.getName()); + return s + " " + StatCollector.translateToLocal("enchantment.level." + level); + } + + /** + * Determines if this enchantment can be applied to a specific ItemStack. + */ + public boolean canApply(ItemStack stack) + { + return this.type.canEnchantItem(stack.getItem()); + } + + /** + * Called whenever a mob is damaged with an item that has this enchantment on it. + */ + public void onEntityDamaged(EntityLivingBase user, Entity target, int level) + { + } + + /** + * Whenever an entity that has this enchantment on one of its associated items is damaged this method will be + * called. + */ + public void onUserHurt(EntityLivingBase user, Entity attacker, int level) + { + } + + static + { + List list = Lists.newArrayList(); + + for (Enchantment enchantment : enchantmentsList) + { + if (enchantment != null) + { + list.add(enchantment); + } + } + + enchantmentsBookList = (Enchantment[])list.toArray(new Enchantment[list.size()]); + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentArrowDamage.java b/src/minecraft/net/minecraft/enchantment/EnchantmentArrowDamage.java new file mode 100644 index 0000000..c52e033 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentArrowDamage.java @@ -0,0 +1,36 @@ +package net.minecraft.enchantment; + +import net.minecraft.util.ResourceLocation; + +public class EnchantmentArrowDamage extends Enchantment +{ + public EnchantmentArrowDamage(int enchID, ResourceLocation enchName, int enchWeight) + { + super(enchID, enchName, enchWeight, EnumEnchantmentType.BOW); + this.setName("arrowDamage"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 1 + (enchantmentLevel - 1) * 10; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return this.getMinEnchantability(enchantmentLevel) + 15; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 5; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentArrowFire.java b/src/minecraft/net/minecraft/enchantment/EnchantmentArrowFire.java new file mode 100644 index 0000000..810bd1c --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentArrowFire.java @@ -0,0 +1,36 @@ +package net.minecraft.enchantment; + +import net.minecraft.util.ResourceLocation; + +public class EnchantmentArrowFire extends Enchantment +{ + public EnchantmentArrowFire(int enchID, ResourceLocation enchName, int enchWeight) + { + super(enchID, enchName, enchWeight, EnumEnchantmentType.BOW); + this.setName("arrowFire"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 20; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 1; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentArrowInfinite.java b/src/minecraft/net/minecraft/enchantment/EnchantmentArrowInfinite.java new file mode 100644 index 0000000..015c54f --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentArrowInfinite.java @@ -0,0 +1,36 @@ +package net.minecraft.enchantment; + +import net.minecraft.util.ResourceLocation; + +public class EnchantmentArrowInfinite extends Enchantment +{ + public EnchantmentArrowInfinite(int enchID, ResourceLocation enchName, int enchWeight) + { + super(enchID, enchName, enchWeight, EnumEnchantmentType.BOW); + this.setName("arrowInfinite"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 20; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 1; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentArrowKnockback.java b/src/minecraft/net/minecraft/enchantment/EnchantmentArrowKnockback.java new file mode 100644 index 0000000..cf5bb36 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentArrowKnockback.java @@ -0,0 +1,36 @@ +package net.minecraft.enchantment; + +import net.minecraft.util.ResourceLocation; + +public class EnchantmentArrowKnockback extends Enchantment +{ + public EnchantmentArrowKnockback(int enchID, ResourceLocation enchName, int enchWeight) + { + super(enchID, enchName, enchWeight, EnumEnchantmentType.BOW); + this.setName("arrowKnockback"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 12 + (enchantmentLevel - 1) * 20; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return this.getMinEnchantability(enchantmentLevel) + 25; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 2; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentDamage.java b/src/minecraft/net/minecraft/enchantment/EnchantmentDamage.java new file mode 100644 index 0000000..99ad703 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentDamage.java @@ -0,0 +1,117 @@ +package net.minecraft.enchantment; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.item.ItemAxe; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.ResourceLocation; + +public class EnchantmentDamage extends Enchantment +{ + /** Holds the name to be translated of each protection type. */ + private static final String[] protectionName = new String[] {"all", "undead", "arthropods"}; + + /** + * Holds the base factor of enchantability needed to be able to use the enchant. + */ + private static final int[] baseEnchantability = new int[] {1, 5, 5}; + + /** + * Holds how much each level increased the enchantability factor to be able to use this enchant. + */ + private static final int[] levelEnchantability = new int[] {11, 8, 8}; + + /** + * Used on the formula of base enchantability, this is the 'window' factor of values to be able to use thing + * enchant. + */ + private static final int[] thresholdEnchantability = new int[] {20, 20, 20}; + + /** + * Defines the type of damage of the enchantment, 0 = all, 1 = undead, 3 = arthropods + */ + public final int damageType; + + public EnchantmentDamage(int enchID, ResourceLocation enchName, int enchWeight, int classification) + { + super(enchID, enchName, enchWeight, EnumEnchantmentType.WEAPON); + this.damageType = classification; + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return baseEnchantability[this.damageType] + (enchantmentLevel - 1) * levelEnchantability[this.damageType]; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return this.getMinEnchantability(enchantmentLevel) + thresholdEnchantability[this.damageType]; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 5; + } + + /** + * Calculates the additional damage that will be dealt by an item with this enchantment. This alternative to + * calcModifierDamage is sensitive to the targets EnumCreatureAttribute. + */ + public float calcDamageByCreature(int level, EnumCreatureAttribute creatureType) + { + return this.damageType == 0 ? (float)level * 1.25F : (this.damageType == 1 && creatureType == EnumCreatureAttribute.UNDEAD ? (float)level * 2.5F : (this.damageType == 2 && creatureType == EnumCreatureAttribute.ARTHROPOD ? (float)level * 2.5F : 0.0F)); + } + + /** + * Return the name of key in translation table of this enchantment. + */ + public String getName() + { + return "enchantment.damage." + protectionName[this.damageType]; + } + + /** + * Determines if the enchantment passed can be applyied together with this enchantment. + */ + public boolean canApplyTogether(Enchantment ench) + { + return !(ench instanceof EnchantmentDamage); + } + + /** + * Determines if this enchantment can be applied to a specific ItemStack. + */ + public boolean canApply(ItemStack stack) + { + return stack.getItem() instanceof ItemAxe ? true : super.canApply(stack); + } + + /** + * Called whenever a mob is damaged with an item that has this enchantment on it. + */ + public void onEntityDamaged(EntityLivingBase user, Entity target, int level) + { + if (target instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)target; + + if (this.damageType == 2 && entitylivingbase.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD) + { + int i = 20 + user.getRNG().nextInt(10 * level); + entitylivingbase.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, i, 3)); + } + } + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentData.java b/src/minecraft/net/minecraft/enchantment/EnchantmentData.java new file mode 100644 index 0000000..a50bf0b --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentData.java @@ -0,0 +1,19 @@ +package net.minecraft.enchantment; + +import net.minecraft.util.WeightedRandom; + +public class EnchantmentData extends WeightedRandom.Item +{ + /** Enchantment object associated with this EnchantmentData */ + public final Enchantment enchantmentobj; + + /** Enchantment level associated with this EnchantmentData */ + public final int enchantmentLevel; + + public EnchantmentData(Enchantment enchantmentObj, int enchLevel) + { + super(enchantmentObj.getWeight()); + this.enchantmentobj = enchantmentObj; + this.enchantmentLevel = enchLevel; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentDigging.java b/src/minecraft/net/minecraft/enchantment/EnchantmentDigging.java new file mode 100644 index 0000000..de181db --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentDigging.java @@ -0,0 +1,46 @@ +package net.minecraft.enchantment; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class EnchantmentDigging extends Enchantment +{ + protected EnchantmentDigging(int enchID, ResourceLocation enchName, int enchWeight) + { + super(enchID, enchName, enchWeight, EnumEnchantmentType.DIGGER); + this.setName("digging"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 1 + 10 * (enchantmentLevel - 1); + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return super.getMinEnchantability(enchantmentLevel) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 5; + } + + /** + * Determines if this enchantment can be applied to a specific ItemStack. + */ + public boolean canApply(ItemStack stack) + { + return stack.getItem() == Items.shears ? true : super.canApply(stack); + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentDurability.java b/src/minecraft/net/minecraft/enchantment/EnchantmentDurability.java new file mode 100644 index 0000000..d542b87 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentDurability.java @@ -0,0 +1,57 @@ +package net.minecraft.enchantment; + +import java.util.Random; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class EnchantmentDurability extends Enchantment +{ + protected EnchantmentDurability(int enchID, ResourceLocation enchName, int enchWeight) + { + super(enchID, enchName, enchWeight, EnumEnchantmentType.BREAKABLE); + this.setName("durability"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 5 + (enchantmentLevel - 1) * 8; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return super.getMinEnchantability(enchantmentLevel) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 3; + } + + /** + * Determines if this enchantment can be applied to a specific ItemStack. + */ + public boolean canApply(ItemStack stack) + { + return stack.isItemStackDamageable() ? true : super.canApply(stack); + } + + /** + * Used by ItemStack.attemptDamageItem. Randomly determines if a point of damage should be negated using the + * enchantment level (par1). If the ItemStack is Armor then there is a flat 60% chance for damage to be negated no + * matter the enchantment level, otherwise there is a 1-(par/1) chance for damage to be negated. + */ + public static boolean negateDamage(ItemStack p_92097_0_, int p_92097_1_, Random p_92097_2_) + { + return p_92097_0_.getItem() instanceof ItemArmor && p_92097_2_.nextFloat() < 0.6F ? false : p_92097_2_.nextInt(p_92097_1_ + 1) > 0; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentFireAspect.java b/src/minecraft/net/minecraft/enchantment/EnchantmentFireAspect.java new file mode 100644 index 0000000..cf0d201 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentFireAspect.java @@ -0,0 +1,36 @@ +package net.minecraft.enchantment; + +import net.minecraft.util.ResourceLocation; + +public class EnchantmentFireAspect extends Enchantment +{ + protected EnchantmentFireAspect(int enchID, ResourceLocation enchName, int enchWeight) + { + super(enchID, enchName, enchWeight, EnumEnchantmentType.WEAPON); + this.setName("fire"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 10 + 20 * (enchantmentLevel - 1); + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return super.getMinEnchantability(enchantmentLevel) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 2; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentFishingSpeed.java b/src/minecraft/net/minecraft/enchantment/EnchantmentFishingSpeed.java new file mode 100644 index 0000000..61f0026 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentFishingSpeed.java @@ -0,0 +1,36 @@ +package net.minecraft.enchantment; + +import net.minecraft.util.ResourceLocation; + +public class EnchantmentFishingSpeed extends Enchantment +{ + protected EnchantmentFishingSpeed(int enchID, ResourceLocation enchName, int enchWeight, EnumEnchantmentType enchType) + { + super(enchID, enchName, enchWeight, enchType); + this.setName("fishingSpeed"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 15 + (enchantmentLevel - 1) * 9; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return super.getMinEnchantability(enchantmentLevel) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 3; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentHelper.java b/src/minecraft/net/minecraft/enchantment/EnchantmentHelper.java new file mode 100644 index 0000000..c59558e --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentHelper.java @@ -0,0 +1,575 @@ +package net.minecraft.enchantment; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.DamageSource; +import net.minecraft.util.WeightedRandom; + +public class EnchantmentHelper +{ + /** Is the random seed of enchantment effects. */ + private static final Random enchantmentRand = new Random(); + + /** + * Used to calculate the extra armor of enchantments on armors equipped on player. + */ + private static final EnchantmentHelper.ModifierDamage enchantmentModifierDamage = new EnchantmentHelper.ModifierDamage(); + + /** + * Used to calculate the (magic) extra damage done by enchantments on current equipped item of player. + */ + private static final EnchantmentHelper.ModifierLiving enchantmentModifierLiving = new EnchantmentHelper.ModifierLiving(); + private static final EnchantmentHelper.HurtIterator ENCHANTMENT_ITERATOR_HURT = new EnchantmentHelper.HurtIterator(); + private static final EnchantmentHelper.DamageIterator ENCHANTMENT_ITERATOR_DAMAGE = new EnchantmentHelper.DamageIterator(); + + /** + * Returns the level of enchantment on the ItemStack passed. + */ + public static int getEnchantmentLevel(int enchID, ItemStack stack) + { + if (stack == null) + { + return 0; + } + else + { + NBTTagList nbttaglist = stack.getEnchantmentTagList(); + + if (nbttaglist == null) + { + return 0; + } + else + { + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + int j = nbttaglist.getCompoundTagAt(i).getShort("id"); + int k = nbttaglist.getCompoundTagAt(i).getShort("lvl"); + + if (j == enchID) + { + return k; + } + } + + return 0; + } + } + } + + public static Map getEnchantments(ItemStack stack) + { + Map map = Maps.newLinkedHashMap(); + NBTTagList nbttaglist = stack.getItem() == Items.enchanted_book ? Items.enchanted_book.getEnchantments(stack) : stack.getEnchantmentTagList(); + + if (nbttaglist != null) + { + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + int j = nbttaglist.getCompoundTagAt(i).getShort("id"); + int k = nbttaglist.getCompoundTagAt(i).getShort("lvl"); + map.put(Integer.valueOf(j), Integer.valueOf(k)); + } + } + + return map; + } + + /** + * Set the enchantments for the specified stack. + */ + public static void setEnchantments(Map enchMap, ItemStack stack) + { + NBTTagList nbttaglist = new NBTTagList(); + Iterator iterator = enchMap.keySet().iterator(); + + while (iterator.hasNext()) + { + int i = ((Integer)iterator.next()).intValue(); + Enchantment enchantment = Enchantment.getEnchantmentById(i); + + if (enchantment != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setShort("id", (short)i); + nbttagcompound.setShort("lvl", (short)((Integer)enchMap.get(Integer.valueOf(i))).intValue()); + nbttaglist.appendTag(nbttagcompound); + + if (stack.getItem() == Items.enchanted_book) + { + Items.enchanted_book.addEnchantment(stack, new EnchantmentData(enchantment, ((Integer)enchMap.get(Integer.valueOf(i))).intValue())); + } + } + } + + if (nbttaglist.tagCount() > 0) + { + if (stack.getItem() != Items.enchanted_book) + { + stack.setTagInfo("ench", nbttaglist); + } + } + else if (stack.hasTagCompound()) + { + stack.getTagCompound().removeTag("ench"); + } + } + + /** + * Returns the biggest level of the enchantment on the array of ItemStack passed. + */ + public static int getMaxEnchantmentLevel(int enchID, ItemStack[] stacks) + { + if (stacks == null) + { + return 0; + } + else + { + int i = 0; + + for (ItemStack itemstack : stacks) + { + int j = getEnchantmentLevel(enchID, itemstack); + + if (j > i) + { + i = j; + } + } + + return i; + } + } + + /** + * Executes the enchantment modifier on the ItemStack passed. + */ + private static void applyEnchantmentModifier(EnchantmentHelper.IModifier modifier, ItemStack stack) + { + if (stack != null) + { + NBTTagList nbttaglist = stack.getEnchantmentTagList(); + + if (nbttaglist != null) + { + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + int j = nbttaglist.getCompoundTagAt(i).getShort("id"); + int k = nbttaglist.getCompoundTagAt(i).getShort("lvl"); + + if (Enchantment.getEnchantmentById(j) != null) + { + modifier.calculateModifier(Enchantment.getEnchantmentById(j), k); + } + } + } + } + } + + /** + * Executes the enchantment modifier on the array of ItemStack passed. + */ + private static void applyEnchantmentModifierArray(EnchantmentHelper.IModifier modifier, ItemStack[] stacks) + { + for (ItemStack itemstack : stacks) + { + applyEnchantmentModifier(modifier, itemstack); + } + } + + /** + * Returns the modifier of protection enchantments on armors equipped on player. + */ + public static int getEnchantmentModifierDamage(ItemStack[] stacks, DamageSource source) + { + enchantmentModifierDamage.damageModifier = 0; + enchantmentModifierDamage.source = source; + applyEnchantmentModifierArray(enchantmentModifierDamage, stacks); + + if (enchantmentModifierDamage.damageModifier > 25) + { + enchantmentModifierDamage.damageModifier = 25; + } + else if (enchantmentModifierDamage.damageModifier < 0) + { + enchantmentModifierDamage.damageModifier = 0; + } + + return (enchantmentModifierDamage.damageModifier + 1 >> 1) + enchantmentRand.nextInt((enchantmentModifierDamage.damageModifier >> 1) + 1); + } + + public static float func_152377_a(ItemStack p_152377_0_, EnumCreatureAttribute p_152377_1_) + { + enchantmentModifierLiving.livingModifier = 0.0F; + enchantmentModifierLiving.entityLiving = p_152377_1_; + applyEnchantmentModifier(enchantmentModifierLiving, p_152377_0_); + return enchantmentModifierLiving.livingModifier; + } + + public static void applyThornEnchantments(EntityLivingBase p_151384_0_, Entity p_151384_1_) + { + ENCHANTMENT_ITERATOR_HURT.attacker = p_151384_1_; + ENCHANTMENT_ITERATOR_HURT.user = p_151384_0_; + + if (p_151384_0_ != null) + { + applyEnchantmentModifierArray(ENCHANTMENT_ITERATOR_HURT, p_151384_0_.getInventory()); + } + + if (p_151384_1_ instanceof EntityPlayer) + { + applyEnchantmentModifier(ENCHANTMENT_ITERATOR_HURT, p_151384_0_.getHeldItem()); + } + } + + public static void applyArthropodEnchantments(EntityLivingBase p_151385_0_, Entity p_151385_1_) + { + ENCHANTMENT_ITERATOR_DAMAGE.user = p_151385_0_; + ENCHANTMENT_ITERATOR_DAMAGE.target = p_151385_1_; + + if (p_151385_0_ != null) + { + applyEnchantmentModifierArray(ENCHANTMENT_ITERATOR_DAMAGE, p_151385_0_.getInventory()); + } + + if (p_151385_0_ instanceof EntityPlayer) + { + applyEnchantmentModifier(ENCHANTMENT_ITERATOR_DAMAGE, p_151385_0_.getHeldItem()); + } + } + + /** + * Returns the Knockback modifier of the enchantment on the players held item. + */ + public static int getKnockbackModifier(EntityLivingBase player) + { + return getEnchantmentLevel(Enchantment.knockback.effectId, player.getHeldItem()); + } + + /** + * Returns the fire aspect modifier of the players held item. + */ + public static int getFireAspectModifier(EntityLivingBase player) + { + return getEnchantmentLevel(Enchantment.fireAspect.effectId, player.getHeldItem()); + } + + /** + * Returns the 'Water Breathing' modifier of enchantments on player equipped armors. + */ + public static int getRespiration(Entity player) + { + return getMaxEnchantmentLevel(Enchantment.respiration.effectId, player.getInventory()); + } + + /** + * Returns the level of the Depth Strider enchantment. + */ + public static int getDepthStriderModifier(Entity player) + { + return getMaxEnchantmentLevel(Enchantment.depthStrider.effectId, player.getInventory()); + } + + /** + * Return the extra efficiency of tools based on enchantments on equipped player item. + */ + public static int getEfficiencyModifier(EntityLivingBase player) + { + return getEnchantmentLevel(Enchantment.efficiency.effectId, player.getHeldItem()); + } + + /** + * Returns the silk touch status of enchantments on current equipped item of player. + */ + public static boolean getSilkTouchModifier(EntityLivingBase player) + { + return getEnchantmentLevel(Enchantment.silkTouch.effectId, player.getHeldItem()) > 0; + } + + /** + * Returns the fortune enchantment modifier of the current equipped item of player. + */ + public static int getFortuneModifier(EntityLivingBase player) + { + return getEnchantmentLevel(Enchantment.fortune.effectId, player.getHeldItem()); + } + + /** + * Returns the level of the 'Luck Of The Sea' enchantment. + */ + public static int getLuckOfSeaModifier(EntityLivingBase player) + { + return getEnchantmentLevel(Enchantment.luckOfTheSea.effectId, player.getHeldItem()); + } + + /** + * Returns the level of the 'Lure' enchantment on the players held item. + */ + public static int getLureModifier(EntityLivingBase player) + { + return getEnchantmentLevel(Enchantment.lure.effectId, player.getHeldItem()); + } + + /** + * Returns the looting enchantment modifier of the current equipped item of player. + */ + public static int getLootingModifier(EntityLivingBase player) + { + return getEnchantmentLevel(Enchantment.looting.effectId, player.getHeldItem()); + } + + /** + * Returns the aqua affinity status of enchantments on current equipped item of player. + */ + public static boolean getAquaAffinityModifier(EntityLivingBase player) + { + return getMaxEnchantmentLevel(Enchantment.aquaAffinity.effectId, player.getInventory()) > 0; + } + + public static ItemStack getEnchantedItem(Enchantment p_92099_0_, EntityLivingBase p_92099_1_) + { + for (ItemStack itemstack : p_92099_1_.getInventory()) + { + if (itemstack != null && getEnchantmentLevel(p_92099_0_.effectId, itemstack) > 0) + { + return itemstack; + } + } + + return null; + } + + /** + * Returns the enchantability of itemstack, it's uses a singular formula for each index (2nd parameter: 0, 1 and 2), + * cutting to the max enchantability power of the table (3rd parameter) + */ + public static int calcItemStackEnchantability(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_) + { + Item item = p_77514_3_.getItem(); + int i = item.getItemEnchantability(); + + if (i <= 0) + { + return 0; + } + else + { + if (p_77514_2_ > 15) + { + p_77514_2_ = 15; + } + + int j = p_77514_0_.nextInt(8) + 1 + (p_77514_2_ >> 1) + p_77514_0_.nextInt(p_77514_2_ + 1); + return p_77514_1_ == 0 ? Math.max(j / 3, 1) : (p_77514_1_ == 1 ? j * 2 / 3 + 1 : Math.max(j, p_77514_2_ * 2)); + } + } + + /** + * Adds a random enchantment to the specified item. Args: random, itemStack, enchantabilityLevel + */ + public static ItemStack addRandomEnchantment(Random p_77504_0_, ItemStack p_77504_1_, int p_77504_2_) + { + List list = buildEnchantmentList(p_77504_0_, p_77504_1_, p_77504_2_); + boolean flag = p_77504_1_.getItem() == Items.book; + + if (flag) + { + p_77504_1_.setItem(Items.enchanted_book); + } + + if (list != null) + { + for (EnchantmentData enchantmentdata : list) + { + if (flag) + { + Items.enchanted_book.addEnchantment(p_77504_1_, enchantmentdata); + } + else + { + p_77504_1_.addEnchantment(enchantmentdata.enchantmentobj, enchantmentdata.enchantmentLevel); + } + } + } + + return p_77504_1_; + } + + public static List buildEnchantmentList(Random randomIn, ItemStack itemStackIn, int p_77513_2_) + { + Item item = itemStackIn.getItem(); + int i = item.getItemEnchantability(); + + if (i <= 0) + { + return null; + } + else + { + i = i / 2; + i = 1 + randomIn.nextInt((i >> 1) + 1) + randomIn.nextInt((i >> 1) + 1); + int j = i + p_77513_2_; + float f = (randomIn.nextFloat() + randomIn.nextFloat() - 1.0F) * 0.15F; + int k = (int)((float)j * (1.0F + f) + 0.5F); + + if (k < 1) + { + k = 1; + } + + List list = null; + Map map = mapEnchantmentData(k, itemStackIn); + + if (map != null && !map.isEmpty()) + { + EnchantmentData enchantmentdata = (EnchantmentData)WeightedRandom.getRandomItem(randomIn, map.values()); + + if (enchantmentdata != null) + { + list = Lists.newArrayList(); + list.add(enchantmentdata); + + for (int l = k; randomIn.nextInt(50) <= l; l >>= 1) + { + Iterator iterator = map.keySet().iterator(); + + while (iterator.hasNext()) + { + Integer integer = (Integer)iterator.next(); + boolean flag = true; + + for (EnchantmentData enchantmentdata1 : list) + { + if (!enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.getEnchantmentById(integer.intValue()))) + { + flag = false; + break; + } + } + + if (!flag) + { + iterator.remove(); + } + } + + if (!map.isEmpty()) + { + EnchantmentData enchantmentdata2 = (EnchantmentData)WeightedRandom.getRandomItem(randomIn, map.values()); + list.add(enchantmentdata2); + } + } + } + } + + return list; + } + } + + public static Map mapEnchantmentData(int p_77505_0_, ItemStack p_77505_1_) + { + Item item = p_77505_1_.getItem(); + Map map = null; + boolean flag = p_77505_1_.getItem() == Items.book; + + for (Enchantment enchantment : Enchantment.enchantmentsBookList) + { + if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) + { + for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i) + { + if (p_77505_0_ >= enchantment.getMinEnchantability(i) && p_77505_0_ <= enchantment.getMaxEnchantability(i)) + { + if (map == null) + { + map = Maps.newHashMap(); + } + + map.put(Integer.valueOf(enchantment.effectId), new EnchantmentData(enchantment, i)); + } + } + } + } + + return map; + } + + static final class DamageIterator implements EnchantmentHelper.IModifier + { + public EntityLivingBase user; + public Entity target; + + private DamageIterator() + { + } + + public void calculateModifier(Enchantment enchantmentIn, int enchantmentLevel) + { + enchantmentIn.onEntityDamaged(this.user, this.target, enchantmentLevel); + } + } + + static final class HurtIterator implements EnchantmentHelper.IModifier + { + public EntityLivingBase user; + public Entity attacker; + + private HurtIterator() + { + } + + public void calculateModifier(Enchantment enchantmentIn, int enchantmentLevel) + { + enchantmentIn.onUserHurt(this.user, this.attacker, enchantmentLevel); + } + } + + interface IModifier + { + void calculateModifier(Enchantment enchantmentIn, int enchantmentLevel); + } + + static final class ModifierDamage implements EnchantmentHelper.IModifier + { + public int damageModifier; + public DamageSource source; + + private ModifierDamage() + { + } + + public void calculateModifier(Enchantment enchantmentIn, int enchantmentLevel) + { + this.damageModifier += enchantmentIn.calcModifierDamage(enchantmentLevel, this.source); + } + } + + static final class ModifierLiving implements EnchantmentHelper.IModifier + { + public float livingModifier; + public EnumCreatureAttribute entityLiving; + + private ModifierLiving() + { + } + + public void calculateModifier(Enchantment enchantmentIn, int enchantmentLevel) + { + this.livingModifier += enchantmentIn.calcDamageByCreature(enchantmentLevel, this.entityLiving); + } + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentKnockback.java b/src/minecraft/net/minecraft/enchantment/EnchantmentKnockback.java new file mode 100644 index 0000000..ed42aef --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentKnockback.java @@ -0,0 +1,36 @@ +package net.minecraft.enchantment; + +import net.minecraft.util.ResourceLocation; + +public class EnchantmentKnockback extends Enchantment +{ + protected EnchantmentKnockback(int p_i45768_1_, ResourceLocation p_i45768_2_, int p_i45768_3_) + { + super(p_i45768_1_, p_i45768_2_, p_i45768_3_, EnumEnchantmentType.WEAPON); + this.setName("knockback"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 5 + 20 * (enchantmentLevel - 1); + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return super.getMinEnchantability(enchantmentLevel) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 2; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentLootBonus.java b/src/minecraft/net/minecraft/enchantment/EnchantmentLootBonus.java new file mode 100644 index 0000000..3562e71 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentLootBonus.java @@ -0,0 +1,56 @@ +package net.minecraft.enchantment; + +import net.minecraft.util.ResourceLocation; + +public class EnchantmentLootBonus extends Enchantment +{ + protected EnchantmentLootBonus(int p_i45767_1_, ResourceLocation p_i45767_2_, int p_i45767_3_, EnumEnchantmentType p_i45767_4_) + { + super(p_i45767_1_, p_i45767_2_, p_i45767_3_, p_i45767_4_); + + if (p_i45767_4_ == EnumEnchantmentType.DIGGER) + { + this.setName("lootBonusDigger"); + } + else if (p_i45767_4_ == EnumEnchantmentType.FISHING_ROD) + { + this.setName("lootBonusFishing"); + } + else + { + this.setName("lootBonus"); + } + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 15 + (enchantmentLevel - 1) * 9; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return super.getMinEnchantability(enchantmentLevel) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 3; + } + + /** + * Determines if the enchantment passed can be applyied together with this enchantment. + */ + public boolean canApplyTogether(Enchantment ench) + { + return super.canApplyTogether(ench) && ench.effectId != silkTouch.effectId; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentOxygen.java b/src/minecraft/net/minecraft/enchantment/EnchantmentOxygen.java new file mode 100644 index 0000000..bfa7a17 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentOxygen.java @@ -0,0 +1,36 @@ +package net.minecraft.enchantment; + +import net.minecraft.util.ResourceLocation; + +public class EnchantmentOxygen extends Enchantment +{ + public EnchantmentOxygen(int enchID, ResourceLocation p_i45766_2_, int p_i45766_3_) + { + super(enchID, p_i45766_2_, p_i45766_3_, EnumEnchantmentType.ARMOR_HEAD); + this.setName("oxygen"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 10 * enchantmentLevel; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return this.getMinEnchantability(enchantmentLevel) + 30; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 3; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentProtection.java b/src/minecraft/net/minecraft/enchantment/EnchantmentProtection.java new file mode 100644 index 0000000..a4e7702 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentProtection.java @@ -0,0 +1,136 @@ +package net.minecraft.enchantment; + +import net.minecraft.entity.Entity; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +public class EnchantmentProtection extends Enchantment +{ + /** Holds the name to be translated of each protection type. */ + private static final String[] protectionName = new String[] {"all", "fire", "fall", "explosion", "projectile"}; + + /** + * Holds the base factor of enchantability needed to be able to use the enchant. + */ + private static final int[] baseEnchantability = new int[] {1, 10, 5, 5, 3}; + + /** + * Holds how much each level increased the enchantability factor to be able to use this enchant. + */ + private static final int[] levelEnchantability = new int[] {11, 8, 6, 8, 6}; + + /** + * Used on the formula of base enchantability, this is the 'window' factor of values to be able to use thing + * enchant. + */ + private static final int[] thresholdEnchantability = new int[] {20, 12, 10, 12, 15}; + + /** + * Defines the type of protection of the enchantment, 0 = all, 1 = fire, 2 = fall (feather fall), 3 = explosion and + * 4 = projectile. + */ + public final int protectionType; + + public EnchantmentProtection(int p_i45765_1_, ResourceLocation p_i45765_2_, int p_i45765_3_, int p_i45765_4_) + { + super(p_i45765_1_, p_i45765_2_, p_i45765_3_, EnumEnchantmentType.ARMOR); + this.protectionType = p_i45765_4_; + + if (p_i45765_4_ == 2) + { + this.type = EnumEnchantmentType.ARMOR_FEET; + } + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return baseEnchantability[this.protectionType] + (enchantmentLevel - 1) * levelEnchantability[this.protectionType]; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return this.getMinEnchantability(enchantmentLevel) + thresholdEnchantability[this.protectionType]; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 4; + } + + /** + * Calculates the damage protection of the enchantment based on level and damage source passed. + */ + public int calcModifierDamage(int level, DamageSource source) + { + if (source.canHarmInCreative()) + { + return 0; + } + else + { + float f = (float)(6 + level * level) / 3.0F; + return this.protectionType == 0 ? MathHelper.floor_float(f * 0.75F) : (this.protectionType == 1 && source.isFireDamage() ? MathHelper.floor_float(f * 1.25F) : (this.protectionType == 2 && source == DamageSource.fall ? MathHelper.floor_float(f * 2.5F) : (this.protectionType == 3 && source.isExplosion() ? MathHelper.floor_float(f * 1.5F) : (this.protectionType == 4 && source.isProjectile() ? MathHelper.floor_float(f * 1.5F) : 0)))); + } + } + + /** + * Return the name of key in translation table of this enchantment. + */ + public String getName() + { + return "enchantment.protect." + protectionName[this.protectionType]; + } + + /** + * Determines if the enchantment passed can be applyied together with this enchantment. + */ + public boolean canApplyTogether(Enchantment ench) + { + if (ench instanceof EnchantmentProtection) + { + EnchantmentProtection enchantmentprotection = (EnchantmentProtection)ench; + return enchantmentprotection.protectionType == this.protectionType ? false : this.protectionType == 2 || enchantmentprotection.protectionType == 2; + } + else + { + return super.canApplyTogether(ench); + } + } + + /** + * Gets the amount of ticks an entity should be set fire, adjusted for fire protection. + */ + public static int getFireTimeForEntity(Entity p_92093_0_, int p_92093_1_) + { + int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantment.fireProtection.effectId, p_92093_0_.getInventory()); + + if (i > 0) + { + p_92093_1_ -= MathHelper.floor_float((float)p_92093_1_ * (float)i * 0.15F); + } + + return p_92093_1_; + } + + public static double func_92092_a(Entity p_92092_0_, double p_92092_1_) + { + int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantment.blastProtection.effectId, p_92092_0_.getInventory()); + + if (i > 0) + { + p_92092_1_ -= (double)MathHelper.floor_double(p_92092_1_ * (double)((float)i * 0.15F)); + } + + return p_92092_1_; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentThorns.java b/src/minecraft/net/minecraft/enchantment/EnchantmentThorns.java new file mode 100644 index 0000000..3ce1b78 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentThorns.java @@ -0,0 +1,88 @@ +package net.minecraft.enchantment; + +import java.util.Random; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.util.ResourceLocation; + +public class EnchantmentThorns extends Enchantment +{ + public EnchantmentThorns(int p_i45764_1_, ResourceLocation p_i45764_2_, int p_i45764_3_) + { + super(p_i45764_1_, p_i45764_2_, p_i45764_3_, EnumEnchantmentType.ARMOR_TORSO); + this.setName("thorns"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 10 + 20 * (enchantmentLevel - 1); + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return super.getMinEnchantability(enchantmentLevel) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 3; + } + + /** + * Determines if this enchantment can be applied to a specific ItemStack. + */ + public boolean canApply(ItemStack stack) + { + return stack.getItem() instanceof ItemArmor ? true : super.canApply(stack); + } + + /** + * Whenever an entity that has this enchantment on one of its associated items is damaged this method will be + * called. + */ + public void onUserHurt(EntityLivingBase user, Entity attacker, int level) + { + Random random = user.getRNG(); + ItemStack itemstack = EnchantmentHelper.getEnchantedItem(Enchantment.thorns, user); + + if (func_92094_a(level, random)) + { + if (attacker != null) + { + attacker.attackEntityFrom(DamageSource.causeThornsDamage(user), (float)func_92095_b(level, random)); + attacker.playSound("damage.thorns", 0.5F, 1.0F); + } + + if (itemstack != null) + { + itemstack.damageItem(3, user); + } + } + else if (itemstack != null) + { + itemstack.damageItem(1, user); + } + } + + public static boolean func_92094_a(int p_92094_0_, Random p_92094_1_) + { + return p_92094_0_ <= 0 ? false : p_92094_1_.nextFloat() < 0.15F * (float)p_92094_0_; + } + + public static int func_92095_b(int p_92095_0_, Random p_92095_1_) + { + return p_92095_0_ > 10 ? p_92095_0_ - 10 : 1 + p_92095_1_.nextInt(4); + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentUntouching.java b/src/minecraft/net/minecraft/enchantment/EnchantmentUntouching.java new file mode 100644 index 0000000..03418f0 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentUntouching.java @@ -0,0 +1,54 @@ +package net.minecraft.enchantment; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class EnchantmentUntouching extends Enchantment +{ + protected EnchantmentUntouching(int p_i45763_1_, ResourceLocation p_i45763_2_, int p_i45763_3_) + { + super(p_i45763_1_, p_i45763_2_, p_i45763_3_, EnumEnchantmentType.DIGGER); + this.setName("untouching"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 15; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return super.getMinEnchantability(enchantmentLevel) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 1; + } + + /** + * Determines if the enchantment passed can be applyied together with this enchantment. + */ + public boolean canApplyTogether(Enchantment ench) + { + return super.canApplyTogether(ench) && ench.effectId != fortune.effectId; + } + + /** + * Determines if this enchantment can be applied to a specific ItemStack. + */ + public boolean canApply(ItemStack stack) + { + return stack.getItem() == Items.shears ? true : super.canApply(stack); + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentWaterWalker.java b/src/minecraft/net/minecraft/enchantment/EnchantmentWaterWalker.java new file mode 100644 index 0000000..d91ecb6 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentWaterWalker.java @@ -0,0 +1,36 @@ +package net.minecraft.enchantment; + +import net.minecraft.util.ResourceLocation; + +public class EnchantmentWaterWalker extends Enchantment +{ + public EnchantmentWaterWalker(int p_i45762_1_, ResourceLocation p_i45762_2_, int p_i45762_3_) + { + super(p_i45762_1_, p_i45762_2_, p_i45762_3_, EnumEnchantmentType.ARMOR_FEET); + this.setName("waterWalker"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return enchantmentLevel * 10; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return this.getMinEnchantability(enchantmentLevel) + 15; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 3; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnchantmentWaterWorker.java b/src/minecraft/net/minecraft/enchantment/EnchantmentWaterWorker.java new file mode 100644 index 0000000..601bb0c --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnchantmentWaterWorker.java @@ -0,0 +1,36 @@ +package net.minecraft.enchantment; + +import net.minecraft.util.ResourceLocation; + +public class EnchantmentWaterWorker extends Enchantment +{ + public EnchantmentWaterWorker(int p_i45761_1_, ResourceLocation p_i45761_2_, int p_i45761_3_) + { + super(p_i45761_1_, p_i45761_2_, p_i45761_3_, EnumEnchantmentType.ARMOR_HEAD); + this.setName("waterWorker"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int enchantmentLevel) + { + return 1; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int enchantmentLevel) + { + return this.getMinEnchantability(enchantmentLevel) + 40; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 1; + } +} diff --git a/src/minecraft/net/minecraft/enchantment/EnumEnchantmentType.java b/src/minecraft/net/minecraft/enchantment/EnumEnchantmentType.java new file mode 100644 index 0000000..047b1c6 --- /dev/null +++ b/src/minecraft/net/minecraft/enchantment/EnumEnchantmentType.java @@ -0,0 +1,54 @@ +package net.minecraft.enchantment; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemBow; +import net.minecraft.item.ItemFishingRod; +import net.minecraft.item.ItemSword; +import net.minecraft.item.ItemTool; + +public enum EnumEnchantmentType +{ + ALL, + ARMOR, + ARMOR_FEET, + ARMOR_LEGS, + ARMOR_TORSO, + ARMOR_HEAD, + WEAPON, + DIGGER, + FISHING_ROD, + BREAKABLE, + BOW; + + /** + * Return true if the item passed can be enchanted by a enchantment of this type. + */ + public boolean canEnchantItem(Item p_77557_1_) + { + if (this == ALL) + { + return true; + } + else if (this == BREAKABLE && p_77557_1_.isDamageable()) + { + return true; + } + else if (p_77557_1_ instanceof ItemArmor) + { + if (this == ARMOR) + { + return true; + } + else + { + ItemArmor itemarmor = (ItemArmor)p_77557_1_; + return itemarmor.armorType == 0 ? this == ARMOR_HEAD : (itemarmor.armorType == 2 ? this == ARMOR_LEGS : (itemarmor.armorType == 1 ? this == ARMOR_TORSO : (itemarmor.armorType == 3 ? this == ARMOR_FEET : false))); + } + } + else + { + return p_77557_1_ instanceof ItemSword ? this == WEAPON : (p_77557_1_ instanceof ItemTool ? this == DIGGER : (p_77557_1_ instanceof ItemBow ? this == BOW : (p_77557_1_ instanceof ItemFishingRod ? this == FISHING_ROD : false))); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/DataWatcher.java b/src/minecraft/net/minecraft/entity/DataWatcher.java new file mode 100644 index 0000000..a8b0ab1 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/DataWatcher.java @@ -0,0 +1,450 @@ +package net.minecraft.entity; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.item.ItemStack; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ReportedException; +import net.minecraft.util.Rotations; +import org.apache.commons.lang3.ObjectUtils; + +public class DataWatcher +{ + private final Entity owner; + + /** When isBlank is true the DataWatcher is not watching any objects */ + private boolean isBlank = true; + private static final Map < Class, Integer > dataTypes = Maps. < Class, Integer > newHashMap(); + private final Map watchedObjects = Maps.newHashMap(); + + /** true if one or more object was changed */ + private boolean objectChanged; + private ReadWriteLock lock = new ReentrantReadWriteLock(); + + public DataWatcher(Entity owner) + { + this.owner = owner; + } + + public void addObject(int id, T object) + { + Integer integer = (Integer)dataTypes.get(object.getClass()); + + if (integer == null) + { + throw new IllegalArgumentException("Unknown data type: " + object.getClass()); + } + else if (id > 31) + { + throw new IllegalArgumentException("Data value id is too big with " + id + "! (Max is " + 31 + ")"); + } + else if (this.watchedObjects.containsKey(Integer.valueOf(id))) + { + throw new IllegalArgumentException("Duplicate id value for " + id + "!"); + } + else + { + DataWatcher.WatchableObject datawatcher$watchableobject = new DataWatcher.WatchableObject(integer.intValue(), id, object); + this.lock.writeLock().lock(); + this.watchedObjects.put(Integer.valueOf(id), datawatcher$watchableobject); + this.lock.writeLock().unlock(); + this.isBlank = false; + } + } + + /** + * Add a new object for the DataWatcher to watch, using the specified data type. + */ + public void addObjectByDataType(int id, int type) + { + DataWatcher.WatchableObject datawatcher$watchableobject = new DataWatcher.WatchableObject(type, id, (Object)null); + this.lock.writeLock().lock(); + this.watchedObjects.put(Integer.valueOf(id), datawatcher$watchableobject); + this.lock.writeLock().unlock(); + this.isBlank = false; + } + + /** + * gets the bytevalue of a watchable object + */ + public byte getWatchableObjectByte(int id) + { + return ((Byte)this.getWatchedObject(id).getObject()).byteValue(); + } + + public short getWatchableObjectShort(int id) + { + return ((Short)this.getWatchedObject(id).getObject()).shortValue(); + } + + /** + * gets a watchable object and returns it as a Integer + */ + public int getWatchableObjectInt(int id) + { + return ((Integer)this.getWatchedObject(id).getObject()).intValue(); + } + + public float getWatchableObjectFloat(int id) + { + return ((Float)this.getWatchedObject(id).getObject()).floatValue(); + } + + /** + * gets a watchable object and returns it as a String + */ + public String getWatchableObjectString(int id) + { + return (String)this.getWatchedObject(id).getObject(); + } + + /** + * Get a watchable object as an ItemStack. + */ + public ItemStack getWatchableObjectItemStack(int id) + { + return (ItemStack)this.getWatchedObject(id).getObject(); + } + + /** + * is threadsafe, unless it throws an exception, then + */ + private DataWatcher.WatchableObject getWatchedObject(int id) + { + this.lock.readLock().lock(); + DataWatcher.WatchableObject datawatcher$watchableobject; + + try + { + datawatcher$watchableobject = (DataWatcher.WatchableObject)this.watchedObjects.get(Integer.valueOf(id)); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting synched entity data"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Synched entity data"); + crashreportcategory.addCrashSection("Data ID", Integer.valueOf(id)); + throw new ReportedException(crashreport); + } + + this.lock.readLock().unlock(); + return datawatcher$watchableobject; + } + + public Rotations getWatchableObjectRotations(int id) + { + return (Rotations)this.getWatchedObject(id).getObject(); + } + + public void updateObject(int id, T newData) + { + DataWatcher.WatchableObject datawatcher$watchableobject = this.getWatchedObject(id); + + if (ObjectUtils.notEqual(newData, datawatcher$watchableobject.getObject())) + { + datawatcher$watchableobject.setObject(newData); + this.owner.onDataWatcherUpdate(id); + datawatcher$watchableobject.setWatched(true); + this.objectChanged = true; + } + } + + public void setObjectWatched(int id) + { + this.getWatchedObject(id).watched = true; + this.objectChanged = true; + } + + /** + * true if one or more object was changed + */ + public boolean hasObjectChanged() + { + return this.objectChanged; + } + + /** + * Writes the list of watched objects (entity attribute of type {byte, short, int, float, string, ItemStack, + * ChunkCoordinates}) to the specified PacketBuffer + */ + public static void writeWatchedListToPacketBuffer(List objectsList, PacketBuffer buffer) throws IOException + { + if (objectsList != null) + { + for (DataWatcher.WatchableObject datawatcher$watchableobject : objectsList) + { + writeWatchableObjectToPacketBuffer(buffer, datawatcher$watchableobject); + } + } + + buffer.writeByte(127); + } + + public List getChanged() + { + List list = null; + + if (this.objectChanged) + { + this.lock.readLock().lock(); + + for (DataWatcher.WatchableObject datawatcher$watchableobject : this.watchedObjects.values()) + { + if (datawatcher$watchableobject.isWatched()) + { + datawatcher$watchableobject.setWatched(false); + + if (list == null) + { + list = Lists.newArrayList(); + } + + list.add(datawatcher$watchableobject); + } + } + + this.lock.readLock().unlock(); + } + + this.objectChanged = false; + return list; + } + + public void writeTo(PacketBuffer buffer) throws IOException + { + this.lock.readLock().lock(); + + for (DataWatcher.WatchableObject datawatcher$watchableobject : this.watchedObjects.values()) + { + writeWatchableObjectToPacketBuffer(buffer, datawatcher$watchableobject); + } + + this.lock.readLock().unlock(); + buffer.writeByte(127); + } + + public List getAllWatched() + { + List list = null; + this.lock.readLock().lock(); + + for (DataWatcher.WatchableObject datawatcher$watchableobject : this.watchedObjects.values()) + { + if (list == null) + { + list = Lists.newArrayList(); + } + + list.add(datawatcher$watchableobject); + } + + this.lock.readLock().unlock(); + return list; + } + + /** + * Writes a watchable object (entity attribute of type {byte, short, int, float, string, ItemStack, + * ChunkCoordinates}) to the specified PacketBuffer + */ + private static void writeWatchableObjectToPacketBuffer(PacketBuffer buffer, DataWatcher.WatchableObject object) throws IOException + { + int i = (object.getObjectType() << 5 | object.getDataValueId() & 31) & 255; + buffer.writeByte(i); + + switch (object.getObjectType()) + { + case 0: + buffer.writeByte(((Byte)object.getObject()).byteValue()); + break; + + case 1: + buffer.writeShort(((Short)object.getObject()).shortValue()); + break; + + case 2: + buffer.writeInt(((Integer)object.getObject()).intValue()); + break; + + case 3: + buffer.writeFloat(((Float)object.getObject()).floatValue()); + break; + + case 4: + buffer.writeString((String)object.getObject()); + break; + + case 5: + ItemStack itemstack = (ItemStack)object.getObject(); + buffer.writeItemStackToBuffer(itemstack); + break; + + case 6: + BlockPos blockpos = (BlockPos)object.getObject(); + buffer.writeInt(blockpos.getX()); + buffer.writeInt(blockpos.getY()); + buffer.writeInt(blockpos.getZ()); + break; + + case 7: + Rotations rotations = (Rotations)object.getObject(); + buffer.writeFloat(rotations.getX()); + buffer.writeFloat(rotations.getY()); + buffer.writeFloat(rotations.getZ()); + } + } + + public static List readWatchedListFromPacketBuffer(PacketBuffer buffer) throws IOException + { + List list = null; + + for (int i = buffer.readByte(); i != 127; i = buffer.readByte()) + { + if (list == null) + { + list = Lists.newArrayList(); + } + + int j = (i & 224) >> 5; + int k = i & 31; + DataWatcher.WatchableObject datawatcher$watchableobject = null; + + switch (j) + { + case 0: + datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, Byte.valueOf(buffer.readByte())); + break; + + case 1: + datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, Short.valueOf(buffer.readShort())); + break; + + case 2: + datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, Integer.valueOf(buffer.readInt())); + break; + + case 3: + datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, Float.valueOf(buffer.readFloat())); + break; + + case 4: + datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, buffer.readStringFromBuffer(32767)); + break; + + case 5: + datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, buffer.readItemStackFromBuffer()); + break; + + case 6: + int l = buffer.readInt(); + int i1 = buffer.readInt(); + int j1 = buffer.readInt(); + datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, new BlockPos(l, i1, j1)); + break; + + case 7: + float f = buffer.readFloat(); + float f1 = buffer.readFloat(); + float f2 = buffer.readFloat(); + datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, new Rotations(f, f1, f2)); + } + + list.add(datawatcher$watchableobject); + } + + return list; + } + + public void updateWatchedObjectsFromList(List p_75687_1_) + { + this.lock.writeLock().lock(); + + for (DataWatcher.WatchableObject datawatcher$watchableobject : p_75687_1_) + { + DataWatcher.WatchableObject datawatcher$watchableobject1 = (DataWatcher.WatchableObject)this.watchedObjects.get(Integer.valueOf(datawatcher$watchableobject.getDataValueId())); + + if (datawatcher$watchableobject1 != null) + { + datawatcher$watchableobject1.setObject(datawatcher$watchableobject.getObject()); + this.owner.onDataWatcherUpdate(datawatcher$watchableobject.getDataValueId()); + } + } + + this.lock.writeLock().unlock(); + this.objectChanged = true; + } + + public boolean getIsBlank() + { + return this.isBlank; + } + + public void func_111144_e() + { + this.objectChanged = false; + } + + static + { + dataTypes.put(Byte.class, Integer.valueOf(0)); + dataTypes.put(Short.class, Integer.valueOf(1)); + dataTypes.put(Integer.class, Integer.valueOf(2)); + dataTypes.put(Float.class, Integer.valueOf(3)); + dataTypes.put(String.class, Integer.valueOf(4)); + dataTypes.put(ItemStack.class, Integer.valueOf(5)); + dataTypes.put(BlockPos.class, Integer.valueOf(6)); + dataTypes.put(Rotations.class, Integer.valueOf(7)); + } + + public static class WatchableObject + { + private final int objectType; + private final int dataValueId; + private Object watchedObject; + private boolean watched; + + public WatchableObject(int type, int id, Object object) + { + this.dataValueId = id; + this.watchedObject = object; + this.objectType = type; + this.watched = true; + } + + public int getDataValueId() + { + return this.dataValueId; + } + + public void setObject(Object object) + { + this.watchedObject = object; + } + + public Object getObject() + { + return this.watchedObject; + } + + public int getObjectType() + { + return this.objectType; + } + + public boolean isWatched() + { + return this.watched; + } + + public void setWatched(boolean watched) + { + this.watched = watched; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/Entity.java b/src/minecraft/net/minecraft/entity/Entity.java new file mode 100644 index 0000000..5626546 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/Entity.java @@ -0,0 +1,2795 @@ +package net.minecraft.entity; + +import java.util.List; +import java.util.Random; +import java.util.UUID; +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFence; +import net.minecraft.block.BlockFenceGate; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.BlockWall; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.pattern.BlockPattern; +import net.minecraft.command.CommandResultStats; +import net.minecraft.command.ICommandSender; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.enchantment.EnchantmentProtection; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.event.HoverEvent; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagDouble; +import net.minecraft.nbt.NBTTagFloat; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ReportedException; +import net.minecraft.util.StatCollector; +import net.minecraft.util.Vec3; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public abstract class Entity implements ICommandSender +{ + private static final AxisAlignedBB ZERO_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + private static int nextEntityID; + private int entityId; + public double renderDistanceWeight; + + /** + * Blocks entities from spawning when they do their AABB check to make sure the spot is clear of entities that can + * prevent spawning. + */ + public boolean preventEntitySpawning; + + /** The entity that is riding this entity */ + public Entity riddenByEntity; + + /** The entity we are currently riding */ + public Entity ridingEntity; + public boolean forceSpawn; + + /** Reference to the World object. */ + public World worldObj; + public double prevPosX; + public double prevPosY; + public double prevPosZ; + + /** Entity position X */ + public double posX; + + /** Entity position Y */ + public double posY; + + /** Entity position Z */ + public double posZ; + + /** Entity motion X */ + public double motionX; + + /** Entity motion Y */ + public double motionY; + + /** Entity motion Z */ + public double motionZ; + + /** Entity rotation Yaw */ + public float rotationYaw; + + /** Entity rotation Pitch */ + public float rotationPitch; + public float prevRotationYaw; + public float prevRotationPitch; + + /** Axis aligned bounding box. */ + private AxisAlignedBB boundingBox; + public boolean onGround; + + /** + * True if after a move this entity has collided with something on X- or Z-axis + */ + public boolean isCollidedHorizontally; + + /** + * True if after a move this entity has collided with something on Y-axis + */ + public boolean isCollidedVertically; + + /** + * True if after a move this entity has collided with something either vertically or horizontally + */ + public boolean isCollided; + public boolean velocityChanged; + protected boolean isInWeb; + private boolean isOutsideBorder; + + /** + * gets set by setEntityDead, so this must be the flag whether an Entity is dead (inactive may be better term) + */ + public boolean isDead; + + /** How wide this entity is considered to be */ + public float width; + + /** How high this entity is considered to be */ + public float height; + + /** The previous ticks distance walked multiplied by 0.6 */ + public float prevDistanceWalkedModified; + + /** The distance walked multiplied by 0.6 */ + public float distanceWalkedModified; + public float distanceWalkedOnStepModified; + public float fallDistance; + + /** + * The distance that has to be exceeded in order to triger a new step sound and an onEntityWalking event on a block + */ + private int nextStepDistance; + + /** + * The entity's X coordinate at the previous tick, used to calculate position during rendering routines + */ + public double lastTickPosX; + + /** + * The entity's Y coordinate at the previous tick, used to calculate position during rendering routines + */ + public double lastTickPosY; + + /** + * The entity's Z coordinate at the previous tick, used to calculate position during rendering routines + */ + public double lastTickPosZ; + + /** + * How high this entity can step up when running into a block to try to get over it (currently make note the entity + * will always step up this amount and not just the amount needed) + */ + public float stepHeight; + + /** + * Whether this entity won't clip with collision or not (make note it won't disable gravity) + */ + public boolean noClip; + + /** + * Reduces the velocity applied by entity collisions by the specified percent. + */ + public float entityCollisionReduction; + protected Random rand; + + /** How many ticks has this entity had ran since being alive */ + public int ticksExisted; + + /** + * The amount of ticks you have to stand inside of fire before be set on fire + */ + public int fireResistance; + private int fire; + + /** + * Whether this entity is currently inside of water (if it handles water movement that is) + */ + protected boolean inWater; + + /** + * Remaining time an entity will be "immune" to further damage after being hurt. + */ + public int hurtResistantTime; + protected boolean firstUpdate; + protected boolean isImmuneToFire; + protected DataWatcher dataWatcher; + private double entityRiderPitchDelta; + private double entityRiderYawDelta; + + /** Has this entity been added to the chunk its within */ + public boolean addedToChunk; + public int chunkCoordX; + public int chunkCoordY; + public int chunkCoordZ; + public int serverPosX; + public int serverPosY; + public int serverPosZ; + + /** + * Render entity even if it is outside the camera frustum. Only true in EntityFish for now. Used in RenderGlobal: + * render if ignoreFrustumCheck or in frustum. + */ + public boolean ignoreFrustumCheck; + public boolean isAirBorne; + public int timeUntilPortal; + + /** Whether the entity is inside a Portal */ + protected boolean inPortal; + protected int portalCounter; + + /** Which dimension the player is in (-1 = the Nether, 0 = normal world) */ + public int dimension; + protected BlockPos field_181016_an; + protected Vec3 field_181017_ao; + protected EnumFacing field_181018_ap; + private boolean invulnerable; + protected UUID entityUniqueID; + + /** The command result statistics for this Entity. */ + private final CommandResultStats cmdResultStats; + + public int getEntityId() + { + return this.entityId; + } + + public void setEntityId(int id) + { + this.entityId = id; + } + + /** + * Called by the /kill command. + */ + public void onKillCommand() + { + this.setDead(); + } + + public Entity(World worldIn) + { + this.entityId = nextEntityID++; + this.renderDistanceWeight = 1.0D; + this.boundingBox = ZERO_AABB; + this.width = 0.6F; + this.height = 1.8F; + this.nextStepDistance = 1; + this.rand = new Random(); + this.fireResistance = 1; + this.firstUpdate = true; + this.entityUniqueID = MathHelper.getRandomUuid(this.rand); + this.cmdResultStats = new CommandResultStats(); + this.worldObj = worldIn; + this.setPosition(0.0D, 0.0D, 0.0D); + + if (worldIn != null) + { + this.dimension = worldIn.provider.getDimensionId(); + } + + this.dataWatcher = new DataWatcher(this); + this.dataWatcher.addObject(0, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(1, Short.valueOf((short)300)); + this.dataWatcher.addObject(3, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(2, ""); + this.dataWatcher.addObject(4, Byte.valueOf((byte)0)); + this.entityInit(); + } + + protected abstract void entityInit(); + + public DataWatcher getDataWatcher() + { + return this.dataWatcher; + } + + public boolean equals(Object p_equals_1_) + { + return p_equals_1_ instanceof Entity ? ((Entity)p_equals_1_).entityId == this.entityId : false; + } + + public int hashCode() + { + return this.entityId; + } + + /** + * Keeps moving the entity up so it isn't colliding with blocks and other requirements for this entity to be spawned + * (only actually used on players though its also on Entity) + */ + protected void preparePlayerToSpawn() + { + if (this.worldObj != null) + { + while (this.posY > 0.0D && this.posY < 256.0D) + { + this.setPosition(this.posX, this.posY, this.posZ); + + if (this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty()) + { + break; + } + + ++this.posY; + } + + this.motionX = this.motionY = this.motionZ = 0.0D; + this.rotationPitch = 0.0F; + } + } + + /** + * Will get destroyed next tick. + */ + public void setDead() + { + this.isDead = true; + } + + /** + * Sets the width and height of the entity. Args: width, height + */ + protected void setSize(float width, float height) + { + if (width != this.width || height != this.height) + { + float f = this.width; + this.width = width; + this.height = height; + this.setEntityBoundingBox(new AxisAlignedBB(this.getEntityBoundingBox().minX, this.getEntityBoundingBox().minY, this.getEntityBoundingBox().minZ, this.getEntityBoundingBox().minX + (double)this.width, this.getEntityBoundingBox().minY + (double)this.height, this.getEntityBoundingBox().minZ + (double)this.width)); + + if (this.width > f && !this.firstUpdate && !this.worldObj.isRemote) + { + this.moveEntity((double)(f - this.width), 0.0D, (double)(f - this.width)); + } + } + } + + /** + * Sets the rotation of the entity. Args: yaw, pitch (both in degrees) + */ + protected void setRotation(float yaw, float pitch) + { + this.rotationYaw = yaw % 360.0F; + this.rotationPitch = pitch % 360.0F; + } + + /** + * Sets the x,y,z of the entity from the given parameters. Also seems to set up a bounding box. + */ + public void setPosition(double x, double y, double z) + { + this.posX = x; + this.posY = y; + this.posZ = z; + float f = this.width / 2.0F; + float f1 = this.height; + this.setEntityBoundingBox(new AxisAlignedBB(x - (double)f, y, z - (double)f, x + (double)f, y + (double)f1, z + (double)f)); + } + + /** + * Adds 15% to the entity's yaw and subtracts 15% from the pitch. Clamps pitch from -90 to 90. Both arguments in + * degrees. + */ + public void setAngles(float yaw, float pitch) + { + float f = this.rotationPitch; + float f1 = this.rotationYaw; + this.rotationYaw = (float)((double)this.rotationYaw + (double)yaw * 0.15D); + this.rotationPitch = (float)((double)this.rotationPitch - (double)pitch * 0.15D); + this.rotationPitch = MathHelper.clamp_float(this.rotationPitch, -90.0F, 90.0F); + this.prevRotationPitch += this.rotationPitch - f; + this.prevRotationYaw += this.rotationYaw - f1; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.onEntityUpdate(); + } + + /** + * Gets called every tick from main Entity class + */ + public void onEntityUpdate() + { + this.worldObj.theProfiler.startSection("entityBaseTick"); + + if (this.ridingEntity != null && this.ridingEntity.isDead) + { + this.ridingEntity = null; + } + + this.prevDistanceWalkedModified = this.distanceWalkedModified; + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.prevRotationPitch = this.rotationPitch; + this.prevRotationYaw = this.rotationYaw; + + if (!this.worldObj.isRemote && this.worldObj instanceof WorldServer) + { + this.worldObj.theProfiler.startSection("portal"); + MinecraftServer minecraftserver = ((WorldServer)this.worldObj).getMinecraftServer(); + int i = this.getMaxInPortalTime(); + + if (this.inPortal) + { + if (minecraftserver.getAllowNether()) + { + if (this.ridingEntity == null && this.portalCounter++ >= i) + { + this.portalCounter = i; + this.timeUntilPortal = this.getPortalCooldown(); + int j; + + if (this.worldObj.provider.getDimensionId() == -1) + { + j = 0; + } + else + { + j = -1; + } + + this.travelToDimension(j); + } + + this.inPortal = false; + } + } + else + { + if (this.portalCounter > 0) + { + this.portalCounter -= 4; + } + + if (this.portalCounter < 0) + { + this.portalCounter = 0; + } + } + + if (this.timeUntilPortal > 0) + { + --this.timeUntilPortal; + } + + this.worldObj.theProfiler.endSection(); + } + + this.spawnRunningParticles(); + this.handleWaterMovement(); + + if (this.worldObj.isRemote) + { + this.fire = 0; + } + else if (this.fire > 0) + { + if (this.isImmuneToFire) + { + this.fire -= 4; + + if (this.fire < 0) + { + this.fire = 0; + } + } + else + { + if (this.fire % 20 == 0) + { + this.attackEntityFrom(DamageSource.onFire, 1.0F); + } + + --this.fire; + } + } + + if (this.isInLava()) + { + this.setOnFireFromLava(); + this.fallDistance *= 0.5F; + } + + if (this.posY < -64.0D) + { + this.kill(); + } + + if (!this.worldObj.isRemote) + { + this.setFlag(0, this.fire > 0); + } + + this.firstUpdate = false; + this.worldObj.theProfiler.endSection(); + } + + /** + * Return the amount of time this entity should stay in a portal before being transported. + */ + public int getMaxInPortalTime() + { + return 0; + } + + /** + * Called whenever the entity is walking inside of lava. + */ + protected void setOnFireFromLava() + { + if (!this.isImmuneToFire) + { + this.attackEntityFrom(DamageSource.lava, 4.0F); + this.setFire(15); + } + } + + /** + * Sets entity to burn for x amount of seconds, cannot lower amount of existing fire. + */ + public void setFire(int seconds) + { + int i = seconds * 20; + i = EnchantmentProtection.getFireTimeForEntity(this, i); + + if (this.fire < i) + { + this.fire = i; + } + } + + /** + * Removes fire from entity. + */ + public void extinguish() + { + this.fire = 0; + } + + /** + * sets the dead flag. Used when you fall off the bottom of the world. + */ + protected void kill() + { + this.setDead(); + } + + /** + * Checks if the offset position from the entity's current position is inside of liquid. Args: x, y, z + */ + public boolean isOffsetPositionInLiquid(double x, double y, double z) + { + AxisAlignedBB axisalignedbb = this.getEntityBoundingBox().offset(x, y, z); + return this.isLiquidPresentInAABB(axisalignedbb); + } + + /** + * Determines if a liquid is present within the specified AxisAlignedBB. + */ + private boolean isLiquidPresentInAABB(AxisAlignedBB bb) + { + return this.worldObj.getCollidingBoundingBoxes(this, bb).isEmpty() && !this.worldObj.isAnyLiquid(bb); + } + + /** + * Tries to moves the entity by the passed in displacement. Args: x, y, z + */ + public void moveEntity(double x, double y, double z) + { + if (this.noClip) + { + this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, y, z)); + this.resetPositionToBB(); + } + else + { + this.worldObj.theProfiler.startSection("move"); + double d0 = this.posX; + double d1 = this.posY; + double d2 = this.posZ; + + if (this.isInWeb) + { + this.isInWeb = false; + x *= 0.25D; + y *= 0.05000000074505806D; + z *= 0.25D; + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + } + + double d3 = x; + double d4 = y; + double d5 = z; + boolean flag = this.onGround && this.isSneaking() && this instanceof EntityPlayer; + + if (flag) + { + double d6; + + for (d6 = 0.05D; x != 0.0D && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox().offset(x, -1.0D, 0.0D)).isEmpty(); d3 = x) + { + if (x < d6 && x >= -d6) + { + x = 0.0D; + } + else if (x > 0.0D) + { + x -= d6; + } + else + { + x += d6; + } + } + + for (; z != 0.0D && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox().offset(0.0D, -1.0D, z)).isEmpty(); d5 = z) + { + if (z < d6 && z >= -d6) + { + z = 0.0D; + } + else if (z > 0.0D) + { + z -= d6; + } + else + { + z += d6; + } + } + + for (; x != 0.0D && z != 0.0D && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox().offset(x, -1.0D, z)).isEmpty(); d5 = z) + { + if (x < d6 && x >= -d6) + { + x = 0.0D; + } + else if (x > 0.0D) + { + x -= d6; + } + else + { + x += d6; + } + + d3 = x; + + if (z < d6 && z >= -d6) + { + z = 0.0D; + } + else if (z > 0.0D) + { + z -= d6; + } + else + { + z += d6; + } + } + } + + List list1 = this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox().addCoord(x, y, z)); + AxisAlignedBB axisalignedbb = this.getEntityBoundingBox(); + + for (AxisAlignedBB axisalignedbb1 : list1) + { + y = axisalignedbb1.calculateYOffset(this.getEntityBoundingBox(), y); + } + + this.setEntityBoundingBox(this.getEntityBoundingBox().offset(0.0D, y, 0.0D)); + boolean flag1 = this.onGround || d4 != y && d4 < 0.0D; + + for (AxisAlignedBB axisalignedbb2 : list1) + { + x = axisalignedbb2.calculateXOffset(this.getEntityBoundingBox(), x); + } + + this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, 0.0D, 0.0D)); + + for (AxisAlignedBB axisalignedbb13 : list1) + { + z = axisalignedbb13.calculateZOffset(this.getEntityBoundingBox(), z); + } + + this.setEntityBoundingBox(this.getEntityBoundingBox().offset(0.0D, 0.0D, z)); + + if (this.stepHeight > 0.0F && flag1 && (d3 != x || d5 != z)) + { + double d11 = x; + double d7 = y; + double d8 = z; + AxisAlignedBB axisalignedbb3 = this.getEntityBoundingBox(); + this.setEntityBoundingBox(axisalignedbb); + y = (double)this.stepHeight; + List list = this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox().addCoord(d3, y, d5)); + AxisAlignedBB axisalignedbb4 = this.getEntityBoundingBox(); + AxisAlignedBB axisalignedbb5 = axisalignedbb4.addCoord(d3, 0.0D, d5); + double d9 = y; + + for (AxisAlignedBB axisalignedbb6 : list) + { + d9 = axisalignedbb6.calculateYOffset(axisalignedbb5, d9); + } + + axisalignedbb4 = axisalignedbb4.offset(0.0D, d9, 0.0D); + double d15 = d3; + + for (AxisAlignedBB axisalignedbb7 : list) + { + d15 = axisalignedbb7.calculateXOffset(axisalignedbb4, d15); + } + + axisalignedbb4 = axisalignedbb4.offset(d15, 0.0D, 0.0D); + double d16 = d5; + + for (AxisAlignedBB axisalignedbb8 : list) + { + d16 = axisalignedbb8.calculateZOffset(axisalignedbb4, d16); + } + + axisalignedbb4 = axisalignedbb4.offset(0.0D, 0.0D, d16); + AxisAlignedBB axisalignedbb14 = this.getEntityBoundingBox(); + double d17 = y; + + for (AxisAlignedBB axisalignedbb9 : list) + { + d17 = axisalignedbb9.calculateYOffset(axisalignedbb14, d17); + } + + axisalignedbb14 = axisalignedbb14.offset(0.0D, d17, 0.0D); + double d18 = d3; + + for (AxisAlignedBB axisalignedbb10 : list) + { + d18 = axisalignedbb10.calculateXOffset(axisalignedbb14, d18); + } + + axisalignedbb14 = axisalignedbb14.offset(d18, 0.0D, 0.0D); + double d19 = d5; + + for (AxisAlignedBB axisalignedbb11 : list) + { + d19 = axisalignedbb11.calculateZOffset(axisalignedbb14, d19); + } + + axisalignedbb14 = axisalignedbb14.offset(0.0D, 0.0D, d19); + double d20 = d15 * d15 + d16 * d16; + double d10 = d18 * d18 + d19 * d19; + + if (d20 > d10) + { + x = d15; + z = d16; + y = -d9; + this.setEntityBoundingBox(axisalignedbb4); + } + else + { + x = d18; + z = d19; + y = -d17; + this.setEntityBoundingBox(axisalignedbb14); + } + + for (AxisAlignedBB axisalignedbb12 : list) + { + y = axisalignedbb12.calculateYOffset(this.getEntityBoundingBox(), y); + } + + this.setEntityBoundingBox(this.getEntityBoundingBox().offset(0.0D, y, 0.0D)); + + if (d11 * d11 + d8 * d8 >= x * x + z * z) + { + x = d11; + y = d7; + z = d8; + this.setEntityBoundingBox(axisalignedbb3); + } + } + + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("rest"); + this.resetPositionToBB(); + this.isCollidedHorizontally = d3 != x || d5 != z; + this.isCollidedVertically = d4 != y; + this.onGround = this.isCollidedVertically && d4 < 0.0D; + this.isCollided = this.isCollidedHorizontally || this.isCollidedVertically; + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.posY - 0.20000000298023224D); + int k = MathHelper.floor_double(this.posZ); + BlockPos blockpos = new BlockPos(i, j, k); + Block block1 = this.worldObj.getBlockState(blockpos).getBlock(); + + if (block1.getMaterial() == Material.air) + { + Block block = this.worldObj.getBlockState(blockpos.down()).getBlock(); + + if (block instanceof BlockFence || block instanceof BlockWall || block instanceof BlockFenceGate) + { + block1 = block; + blockpos = blockpos.down(); + } + } + + this.updateFallState(y, this.onGround, block1, blockpos); + + if (d3 != x) + { + this.motionX = 0.0D; + } + + if (d5 != z) + { + this.motionZ = 0.0D; + } + + if (d4 != y) + { + block1.onLanded(this.worldObj, this); + } + + if (this.canTriggerWalking() && !flag && this.ridingEntity == null) + { + double d12 = this.posX - d0; + double d13 = this.posY - d1; + double d14 = this.posZ - d2; + + if (block1 != Blocks.ladder) + { + d13 = 0.0D; + } + + if (block1 != null && this.onGround) + { + block1.onEntityCollidedWithBlock(this.worldObj, blockpos, this); + } + + this.distanceWalkedModified = (float)((double)this.distanceWalkedModified + (double)MathHelper.sqrt_double(d12 * d12 + d14 * d14) * 0.6D); + this.distanceWalkedOnStepModified = (float)((double)this.distanceWalkedOnStepModified + (double)MathHelper.sqrt_double(d12 * d12 + d13 * d13 + d14 * d14) * 0.6D); + + if (this.distanceWalkedOnStepModified > (float)this.nextStepDistance && block1.getMaterial() != Material.air) + { + this.nextStepDistance = (int)this.distanceWalkedOnStepModified + 1; + + if (this.isInWater()) + { + float f = MathHelper.sqrt_double(this.motionX * this.motionX * 0.20000000298023224D + this.motionY * this.motionY + this.motionZ * this.motionZ * 0.20000000298023224D) * 0.35F; + + if (f > 1.0F) + { + f = 1.0F; + } + + this.playSound(this.getSwimSound(), f, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + } + + this.playStepSound(blockpos, block1); + } + } + + try + { + this.doBlockCollisions(); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Checking entity block collision"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being checked for collision"); + this.addEntityCrashInfo(crashreportcategory); + throw new ReportedException(crashreport); + } + + boolean flag2 = this.isWet(); + + if (this.worldObj.isFlammableWithin(this.getEntityBoundingBox().contract(0.001D, 0.001D, 0.001D))) + { + this.dealFireDamage(1); + + if (!flag2) + { + ++this.fire; + + if (this.fire == 0) + { + this.setFire(8); + } + } + } + else if (this.fire <= 0) + { + this.fire = -this.fireResistance; + } + + if (flag2 && this.fire > 0) + { + this.playSound("random.fizz", 0.7F, 1.6F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + this.fire = -this.fireResistance; + } + + this.worldObj.theProfiler.endSection(); + } + } + + /** + * Resets the entity's position to the center (planar) and bottom (vertical) points of its bounding box. + */ + private void resetPositionToBB() + { + this.posX = (this.getEntityBoundingBox().minX + this.getEntityBoundingBox().maxX) / 2.0D; + this.posY = this.getEntityBoundingBox().minY; + this.posZ = (this.getEntityBoundingBox().minZ + this.getEntityBoundingBox().maxZ) / 2.0D; + } + + protected String getSwimSound() + { + return "game.neutral.swim"; + } + + protected void doBlockCollisions() + { + BlockPos blockpos = new BlockPos(this.getEntityBoundingBox().minX + 0.001D, this.getEntityBoundingBox().minY + 0.001D, this.getEntityBoundingBox().minZ + 0.001D); + BlockPos blockpos1 = new BlockPos(this.getEntityBoundingBox().maxX - 0.001D, this.getEntityBoundingBox().maxY - 0.001D, this.getEntityBoundingBox().maxZ - 0.001D); + + if (this.worldObj.isAreaLoaded(blockpos, blockpos1)) + { + for (int i = blockpos.getX(); i <= blockpos1.getX(); ++i) + { + for (int j = blockpos.getY(); j <= blockpos1.getY(); ++j) + { + for (int k = blockpos.getZ(); k <= blockpos1.getZ(); ++k) + { + BlockPos blockpos2 = new BlockPos(i, j, k); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos2); + + try + { + iblockstate.getBlock().onEntityCollidedWithBlock(this.worldObj, blockpos2, iblockstate, this); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Colliding entity with block"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being collided with"); + CrashReportCategory.addBlockInfo(crashreportcategory, blockpos2, iblockstate); + throw new ReportedException(crashreport); + } + } + } + } + } + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + Block.SoundType block$soundtype = blockIn.stepSound; + + if (this.worldObj.getBlockState(pos.up()).getBlock() == Blocks.snow_layer) + { + block$soundtype = Blocks.snow_layer.stepSound; + this.playSound(block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.15F, block$soundtype.getFrequency()); + } + else if (!blockIn.getMaterial().isLiquid()) + { + this.playSound(block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.15F, block$soundtype.getFrequency()); + } + } + + public void playSound(String name, float volume, float pitch) + { + if (!this.isSilent()) + { + this.worldObj.playSoundAtEntity(this, name, volume, pitch); + } + } + + /** + * @return True if this entity will not play sounds + */ + public boolean isSilent() + { + return this.dataWatcher.getWatchableObjectByte(4) == 1; + } + + /** + * When set to true the entity will not play sounds. + */ + public void setSilent(boolean isSilent) + { + this.dataWatcher.updateObject(4, Byte.valueOf((byte)(isSilent ? 1 : 0))); + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return true; + } + + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) + { + if (onGroundIn) + { + if (this.fallDistance > 0.0F) + { + if (blockIn != null) + { + blockIn.onFallenUpon(this.worldObj, pos, this, this.fallDistance); + } + else + { + this.fall(this.fallDistance, 1.0F); + } + + this.fallDistance = 0.0F; + } + } + else if (y < 0.0D) + { + this.fallDistance = (float)((double)this.fallDistance - y); + } + } + + /** + * Returns the collision bounding box for this entity + */ + public AxisAlignedBB getCollisionBoundingBox() + { + return null; + } + + /** + * Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args: + * amountDamage + */ + protected void dealFireDamage(int amount) + { + if (!this.isImmuneToFire) + { + this.attackEntityFrom(DamageSource.inFire, (float)amount); + } + } + + public final boolean isImmuneToFire() + { + return this.isImmuneToFire; + } + + public void fall(float distance, float damageMultiplier) + { + if (this.riddenByEntity != null) + { + this.riddenByEntity.fall(distance, damageMultiplier); + } + } + + /** + * Checks if this entity is either in water or on an open air block in rain (used in wolves). + */ + public boolean isWet() + { + return this.inWater || this.worldObj.canLightningStrike(new BlockPos(this.posX, this.posY, this.posZ)) || this.worldObj.canLightningStrike(new BlockPos(this.posX, this.posY + (double)this.height, this.posZ)); + } + + /** + * Checks if this entity is inside water (if inWater field is true as a result of handleWaterMovement() returning + * true) + */ + public boolean isInWater() + { + return this.inWater; + } + + /** + * Returns if this entity is in water and will end up adding the waters velocity to the entity + */ + public boolean handleWaterMovement() + { + if (this.worldObj.handleMaterialAcceleration(this.getEntityBoundingBox().expand(0.0D, -0.4000000059604645D, 0.0D).contract(0.001D, 0.001D, 0.001D), Material.water, this)) + { + if (!this.inWater && !this.firstUpdate) + { + this.resetHeight(); + } + + this.fallDistance = 0.0F; + this.inWater = true; + this.fire = 0; + } + else + { + this.inWater = false; + } + + return this.inWater; + } + + /** + * sets the players height back to normal after doing things like sleeping and dieing + */ + protected void resetHeight() + { + float f = MathHelper.sqrt_double(this.motionX * this.motionX * 0.20000000298023224D + this.motionY * this.motionY + this.motionZ * this.motionZ * 0.20000000298023224D) * 0.2F; + + if (f > 1.0F) + { + f = 1.0F; + } + + this.playSound(this.getSplashSound(), f, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + float f1 = (float)MathHelper.floor_double(this.getEntityBoundingBox().minY); + + for (int i = 0; (float)i < 1.0F + this.width * 20.0F; ++i) + { + float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + float f3 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX + (double)f2, (double)(f1 + 1.0F), this.posZ + (double)f3, this.motionX, this.motionY - (double)(this.rand.nextFloat() * 0.2F), this.motionZ, new int[0]); + } + + for (int j = 0; (float)j < 1.0F + this.width * 20.0F; ++j) + { + float f4 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + float f5 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, this.posX + (double)f4, (double)(f1 + 1.0F), this.posZ + (double)f5, this.motionX, this.motionY, this.motionZ, new int[0]); + } + } + + /** + * Attempts to create sprinting particles if the entity is sprinting and not in water. + */ + public void spawnRunningParticles() + { + if (this.isSprinting() && !this.isInWater()) + { + this.createRunningParticles(); + } + } + + protected void createRunningParticles() + { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.posY - 0.20000000298023224D); + int k = MathHelper.floor_double(this.posZ); + BlockPos blockpos = new BlockPos(i, j, k); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (block.getRenderType() != -1) + { + this.worldObj.spawnParticle(EnumParticleTypes.BLOCK_CRACK, this.posX + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, this.getEntityBoundingBox().minY + 0.1D, this.posZ + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, -this.motionX * 4.0D, 1.5D, -this.motionZ * 4.0D, new int[] {Block.getStateId(iblockstate)}); + } + } + + protected String getSplashSound() + { + return "game.neutral.swim.splash"; + } + + /** + * Checks if the current block the entity is within of the specified material type + */ + public boolean isInsideOfMaterial(Material materialIn) + { + double d0 = this.posY + (double)this.getEyeHeight(); + BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (block.getMaterial() == materialIn) + { + float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F; + float f1 = (float)(blockpos.getY() + 1) - f; + boolean flag = d0 < (double)f1; + return !flag && this instanceof EntityPlayer ? false : flag; + } + else + { + return false; + } + } + + public boolean isInLava() + { + return this.worldObj.isMaterialInBB(this.getEntityBoundingBox().expand(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.lava); + } + + /** + * Used in both water and by flying objects + */ + public void moveFlying(float strafe, float forward, float friction) + { + float f = strafe * strafe + forward * forward; + + if (f >= 1.0E-4F) + { + f = MathHelper.sqrt_float(f); + + if (f < 1.0F) + { + f = 1.0F; + } + + f = friction / f; + strafe = strafe * f; + forward = forward * f; + float f1 = MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F); + float f2 = MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F); + this.motionX += (double)(strafe * f2 - forward * f1); + this.motionZ += (double)(forward * f2 + strafe * f1); + } + } + + public int getBrightnessForRender(float partialTicks) + { + BlockPos blockpos = new BlockPos(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); + return this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getCombinedLight(blockpos, 0) : 0; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float partialTicks) + { + BlockPos blockpos = new BlockPos(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); + return this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getLightBrightness(blockpos) : 0.0F; + } + + /** + * Sets the reference to the World object. + */ + public void setWorld(World worldIn) + { + this.worldObj = worldIn; + } + + /** + * Sets the entity's position and rotation. + */ + public void setPositionAndRotation(double x, double y, double z, float yaw, float pitch) + { + this.prevPosX = this.posX = x; + this.prevPosY = this.posY = y; + this.prevPosZ = this.posZ = z; + this.prevRotationYaw = this.rotationYaw = yaw; + this.prevRotationPitch = this.rotationPitch = pitch; + double d0 = (double)(this.prevRotationYaw - yaw); + + if (d0 < -180.0D) + { + this.prevRotationYaw += 360.0F; + } + + if (d0 >= 180.0D) + { + this.prevRotationYaw -= 360.0F; + } + + this.setPosition(this.posX, this.posY, this.posZ); + this.setRotation(yaw, pitch); + } + + public void moveToBlockPosAndAngles(BlockPos pos, float rotationYawIn, float rotationPitchIn) + { + this.setLocationAndAngles((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, rotationYawIn, rotationPitchIn); + } + + /** + * Sets the location and Yaw/Pitch of an entity in the world + */ + public void setLocationAndAngles(double x, double y, double z, float yaw, float pitch) + { + this.lastTickPosX = this.prevPosX = this.posX = x; + this.lastTickPosY = this.prevPosY = this.posY = y; + this.lastTickPosZ = this.prevPosZ = this.posZ = z; + this.rotationYaw = yaw; + this.rotationPitch = pitch; + this.setPosition(this.posX, this.posY, this.posZ); + } + + /** + * Returns the distance to the entity. Args: entity + */ + public float getDistanceToEntity(Entity entityIn) + { + float f = (float)(this.posX - entityIn.posX); + float f1 = (float)(this.posY - entityIn.posY); + float f2 = (float)(this.posZ - entityIn.posZ); + return MathHelper.sqrt_float(f * f + f1 * f1 + f2 * f2); + } + + /** + * Gets the squared distance to the position. Args: x, y, z + */ + public double getDistanceSq(double x, double y, double z) + { + double d0 = this.posX - x; + double d1 = this.posY - y; + double d2 = this.posZ - z; + return d0 * d0 + d1 * d1 + d2 * d2; + } + + public double getDistanceSq(BlockPos pos) + { + return pos.distanceSq(this.posX, this.posY, this.posZ); + } + + public double getDistanceSqToCenter(BlockPos pos) + { + return pos.distanceSqToCenter(this.posX, this.posY, this.posZ); + } + + /** + * Gets the distance to the position. Args: x, y, z + */ + public double getDistance(double x, double y, double z) + { + double d0 = this.posX - x; + double d1 = this.posY - y; + double d2 = this.posZ - z; + return (double)MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2); + } + + /** + * Returns the squared distance to the entity. Args: entity + */ + public double getDistanceSqToEntity(Entity entityIn) + { + double d0 = this.posX - entityIn.posX; + double d1 = this.posY - entityIn.posY; + double d2 = this.posZ - entityIn.posZ; + return d0 * d0 + d1 * d1 + d2 * d2; + } + + /** + * Called by a player entity when they collide with an entity + */ + public void onCollideWithPlayer(EntityPlayer entityIn) + { + } + + /** + * Applies a velocity to each of the entities pushing them away from each other. Args: entity + */ + public void applyEntityCollision(Entity entityIn) + { + if (entityIn.riddenByEntity != this && entityIn.ridingEntity != this) + { + if (!entityIn.noClip && !this.noClip) + { + double d0 = entityIn.posX - this.posX; + double d1 = entityIn.posZ - this.posZ; + double d2 = MathHelper.abs_max(d0, d1); + + if (d2 >= 0.009999999776482582D) + { + d2 = (double)MathHelper.sqrt_double(d2); + d0 = d0 / d2; + d1 = d1 / d2; + double d3 = 1.0D / d2; + + if (d3 > 1.0D) + { + d3 = 1.0D; + } + + d0 = d0 * d3; + d1 = d1 * d3; + d0 = d0 * 0.05000000074505806D; + d1 = d1 * 0.05000000074505806D; + d0 = d0 * (double)(1.0F - this.entityCollisionReduction); + d1 = d1 * (double)(1.0F - this.entityCollisionReduction); + + if (this.riddenByEntity == null) + { + this.addVelocity(-d0, 0.0D, -d1); + } + + if (entityIn.riddenByEntity == null) + { + entityIn.addVelocity(d0, 0.0D, d1); + } + } + } + } + } + + /** + * Adds to the current velocity of the entity. Args: x, y, z + */ + public void addVelocity(double x, double y, double z) + { + this.motionX += x; + this.motionY += y; + this.motionZ += z; + this.isAirBorne = true; + } + + /** + * Sets that this entity has been attacked. + */ + protected void setBeenAttacked() + { + this.velocityChanged = true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + this.setBeenAttacked(); + return false; + } + } + + /** + * interpolated look vector + */ + public Vec3 getLook(float partialTicks) + { + if (partialTicks == 1.0F) + { + return this.getVectorForRotation(this.rotationPitch, this.rotationYaw); + } + else + { + float f = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * partialTicks; + float f1 = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * partialTicks; + return this.getVectorForRotation(f, f1); + } + } + + /** + * Creates a Vec3 using the pitch and yaw of the entities rotation. + */ + protected final Vec3 getVectorForRotation(float pitch, float yaw) + { + float f = MathHelper.cos(-yaw * 0.017453292F - (float)Math.PI); + float f1 = MathHelper.sin(-yaw * 0.017453292F - (float)Math.PI); + float f2 = -MathHelper.cos(-pitch * 0.017453292F); + float f3 = MathHelper.sin(-pitch * 0.017453292F); + return new Vec3((double)(f1 * f2), (double)f3, (double)(f * f2)); + } + + public Vec3 getPositionEyes(float partialTicks) + { + if (partialTicks == 1.0F) + { + return new Vec3(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); + } + else + { + double d0 = this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks; + double d1 = this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks + (double)this.getEyeHeight(); + double d2 = this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks; + return new Vec3(d0, d1, d2); + } + } + + public MovingObjectPosition rayTrace(double blockReachDistance, float partialTicks) + { + Vec3 vec3 = this.getPositionEyes(partialTicks); + Vec3 vec31 = this.getLook(partialTicks); + Vec3 vec32 = vec3.addVector(vec31.xCoord * blockReachDistance, vec31.yCoord * blockReachDistance, vec31.zCoord * blockReachDistance); + return this.worldObj.rayTraceBlocks(vec3, vec32, false, false, true); + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return false; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return false; + } + + /** + * Adds a value to the player score. Currently not actually used and the entity passed in does nothing. Args: + * entity, scoreToAdd + */ + public void addToPlayerScore(Entity entityIn, int amount) + { + } + + public boolean isInRangeToRender3d(double x, double y, double z) + { + double d0 = this.posX - x; + double d1 = this.posY - y; + double d2 = this.posZ - z; + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + return this.isInRangeToRenderDist(d3); + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double distance) + { + double d0 = this.getEntityBoundingBox().getAverageEdgeLength(); + + if (Double.isNaN(d0)) + { + d0 = 1.0D; + } + + d0 = d0 * 64.0D * this.renderDistanceWeight; + return distance < d0 * d0; + } + + /** + * Like writeToNBTOptional but does not check if the entity is ridden. Used for saving ridden entities with their + * riders. + */ + public boolean writeMountToNBT(NBTTagCompound tagCompund) + { + String s = this.getEntityString(); + + if (!this.isDead && s != null) + { + tagCompund.setString("id", s); + this.writeToNBT(tagCompund); + return true; + } + else + { + return false; + } + } + + /** + * Either write this entity to the NBT tag given and return true, or return false without doing anything. If this + * returns false the entity is not saved on disk. Ridden entities return false here as they are saved with their + * rider. + */ + public boolean writeToNBTOptional(NBTTagCompound tagCompund) + { + String s = this.getEntityString(); + + if (!this.isDead && s != null && this.riddenByEntity == null) + { + tagCompund.setString("id", s); + this.writeToNBT(tagCompund); + return true; + } + else + { + return false; + } + } + + /** + * Save the entity to NBT (calls an abstract helper method to write extra data) + */ + public void writeToNBT(NBTTagCompound tagCompund) + { + try + { + tagCompund.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY, this.posZ})); + tagCompund.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ})); + tagCompund.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch})); + tagCompund.setFloat("FallDistance", this.fallDistance); + tagCompund.setShort("Fire", (short)this.fire); + tagCompund.setShort("Air", (short)this.getAir()); + tagCompund.setBoolean("OnGround", this.onGround); + tagCompund.setInteger("Dimension", this.dimension); + tagCompund.setBoolean("Invulnerable", this.invulnerable); + tagCompund.setInteger("PortalCooldown", this.timeUntilPortal); + tagCompund.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits()); + tagCompund.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits()); + + if (this.getCustomNameTag() != null && this.getCustomNameTag().length() > 0) + { + tagCompund.setString("CustomName", this.getCustomNameTag()); + tagCompund.setBoolean("CustomNameVisible", this.getAlwaysRenderNameTag()); + } + + this.cmdResultStats.writeStatsToNBT(tagCompund); + + if (this.isSilent()) + { + tagCompund.setBoolean("Silent", this.isSilent()); + } + + this.writeEntityToNBT(tagCompund); + + if (this.ridingEntity != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + if (this.ridingEntity.writeMountToNBT(nbttagcompound)) + { + tagCompund.setTag("Riding", nbttagcompound); + } + } + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Saving entity NBT"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being saved"); + this.addEntityCrashInfo(crashreportcategory); + throw new ReportedException(crashreport); + } + } + + /** + * Reads the entity from NBT (calls an abstract helper method to read specialized data) + */ + public void readFromNBT(NBTTagCompound tagCompund) + { + try + { + NBTTagList nbttaglist = tagCompund.getTagList("Pos", 6); + NBTTagList nbttaglist1 = tagCompund.getTagList("Motion", 6); + NBTTagList nbttaglist2 = tagCompund.getTagList("Rotation", 5); + this.motionX = nbttaglist1.getDoubleAt(0); + this.motionY = nbttaglist1.getDoubleAt(1); + this.motionZ = nbttaglist1.getDoubleAt(2); + + if (Math.abs(this.motionX) > 10.0D) + { + this.motionX = 0.0D; + } + + if (Math.abs(this.motionY) > 10.0D) + { + this.motionY = 0.0D; + } + + if (Math.abs(this.motionZ) > 10.0D) + { + this.motionZ = 0.0D; + } + + this.prevPosX = this.lastTickPosX = this.posX = nbttaglist.getDoubleAt(0); + this.prevPosY = this.lastTickPosY = this.posY = nbttaglist.getDoubleAt(1); + this.prevPosZ = this.lastTickPosZ = this.posZ = nbttaglist.getDoubleAt(2); + this.prevRotationYaw = this.rotationYaw = nbttaglist2.getFloatAt(0); + this.prevRotationPitch = this.rotationPitch = nbttaglist2.getFloatAt(1); + this.setRotationYawHead(this.rotationYaw); + this.func_181013_g(this.rotationYaw); + this.fallDistance = tagCompund.getFloat("FallDistance"); + this.fire = tagCompund.getShort("Fire"); + this.setAir(tagCompund.getShort("Air")); + this.onGround = tagCompund.getBoolean("OnGround"); + this.dimension = tagCompund.getInteger("Dimension"); + this.invulnerable = tagCompund.getBoolean("Invulnerable"); + this.timeUntilPortal = tagCompund.getInteger("PortalCooldown"); + + if (tagCompund.hasKey("UUIDMost", 4) && tagCompund.hasKey("UUIDLeast", 4)) + { + this.entityUniqueID = new UUID(tagCompund.getLong("UUIDMost"), tagCompund.getLong("UUIDLeast")); + } + else if (tagCompund.hasKey("UUID", 8)) + { + this.entityUniqueID = UUID.fromString(tagCompund.getString("UUID")); + } + + this.setPosition(this.posX, this.posY, this.posZ); + this.setRotation(this.rotationYaw, this.rotationPitch); + + if (tagCompund.hasKey("CustomName", 8) && tagCompund.getString("CustomName").length() > 0) + { + this.setCustomNameTag(tagCompund.getString("CustomName")); + } + + this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible")); + this.cmdResultStats.readStatsFromNBT(tagCompund); + this.setSilent(tagCompund.getBoolean("Silent")); + this.readEntityFromNBT(tagCompund); + + if (this.shouldSetPosAfterLoading()) + { + this.setPosition(this.posX, this.posY, this.posZ); + } + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Loading entity NBT"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being loaded"); + this.addEntityCrashInfo(crashreportcategory); + throw new ReportedException(crashreport); + } + } + + protected boolean shouldSetPosAfterLoading() + { + return true; + } + + /** + * Returns the string that identifies this Entity's class + */ + protected final String getEntityString() + { + return EntityList.getEntityString(this); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected abstract void readEntityFromNBT(NBTTagCompound tagCompund); + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected abstract void writeEntityToNBT(NBTTagCompound tagCompound); + + public void onChunkLoad() + { + } + + /** + * creates a NBT list from the array of doubles passed to this function + */ + protected NBTTagList newDoubleNBTList(double... numbers) + { + NBTTagList nbttaglist = new NBTTagList(); + + for (double d0 : numbers) + { + nbttaglist.appendTag(new NBTTagDouble(d0)); + } + + return nbttaglist; + } + + /** + * Returns a new NBTTagList filled with the specified floats + */ + protected NBTTagList newFloatNBTList(float... numbers) + { + NBTTagList nbttaglist = new NBTTagList(); + + for (float f : numbers) + { + nbttaglist.appendTag(new NBTTagFloat(f)); + } + + return nbttaglist; + } + + public EntityItem dropItem(Item itemIn, int size) + { + return this.dropItemWithOffset(itemIn, size, 0.0F); + } + + public EntityItem dropItemWithOffset(Item itemIn, int size, float offsetY) + { + return this.entityDropItem(new ItemStack(itemIn, size, 0), offsetY); + } + + /** + * Drops an item at the position of the entity. + */ + public EntityItem entityDropItem(ItemStack itemStackIn, float offsetY) + { + if (itemStackIn.stackSize != 0 && itemStackIn.getItem() != null) + { + EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)offsetY, this.posZ, itemStackIn); + entityitem.setDefaultPickupDelay(); + this.worldObj.spawnEntityInWorld(entityitem); + return entityitem; + } + else + { + return null; + } + } + + /** + * Checks whether target entity is alive. + */ + public boolean isEntityAlive() + { + return !this.isDead; + } + + /** + * Checks if this entity is inside of an opaque block + */ + public boolean isEntityInsideOpaqueBlock() + { + if (this.noClip) + { + return false; + } + else + { + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE); + + for (int i = 0; i < 8; ++i) + { + int j = MathHelper.floor_double(this.posY + (double)(((float)((i >> 0) % 2) - 0.5F) * 0.1F) + (double)this.getEyeHeight()); + int k = MathHelper.floor_double(this.posX + (double)(((float)((i >> 1) % 2) - 0.5F) * this.width * 0.8F)); + int l = MathHelper.floor_double(this.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * this.width * 0.8F)); + + if (blockpos$mutableblockpos.getX() != k || blockpos$mutableblockpos.getY() != j || blockpos$mutableblockpos.getZ() != l) + { + blockpos$mutableblockpos.func_181079_c(k, j, l); + + if (this.worldObj.getBlockState(blockpos$mutableblockpos).getBlock().isVisuallyOpaque()) + { + return true; + } + } + } + + return false; + } + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer playerIn) + { + return false; + } + + /** + * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be + * pushable on contact, like boats or minecarts. + */ + public AxisAlignedBB getCollisionBox(Entity entityIn) + { + return null; + } + + /** + * Handles updating while being ridden by an entity + */ + public void updateRidden() + { + if (this.ridingEntity.isDead) + { + this.ridingEntity = null; + } + else + { + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.onUpdate(); + + if (this.ridingEntity != null) + { + this.ridingEntity.updateRiderPosition(); + this.entityRiderYawDelta += (double)(this.ridingEntity.rotationYaw - this.ridingEntity.prevRotationYaw); + + for (this.entityRiderPitchDelta += (double)(this.ridingEntity.rotationPitch - this.ridingEntity.prevRotationPitch); this.entityRiderYawDelta >= 180.0D; this.entityRiderYawDelta -= 360.0D) + { + ; + } + + while (this.entityRiderYawDelta < -180.0D) + { + this.entityRiderYawDelta += 360.0D; + } + + while (this.entityRiderPitchDelta >= 180.0D) + { + this.entityRiderPitchDelta -= 360.0D; + } + + while (this.entityRiderPitchDelta < -180.0D) + { + this.entityRiderPitchDelta += 360.0D; + } + + double d0 = this.entityRiderYawDelta * 0.5D; + double d1 = this.entityRiderPitchDelta * 0.5D; + float f = 10.0F; + + if (d0 > (double)f) + { + d0 = (double)f; + } + + if (d0 < (double)(-f)) + { + d0 = (double)(-f); + } + + if (d1 > (double)f) + { + d1 = (double)f; + } + + if (d1 < (double)(-f)) + { + d1 = (double)(-f); + } + + this.entityRiderYawDelta -= d0; + this.entityRiderPitchDelta -= d1; + } + } + } + + public void updateRiderPosition() + { + if (this.riddenByEntity != null) + { + this.riddenByEntity.setPosition(this.posX, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ); + } + } + + /** + * Returns the Y Offset of this entity. + */ + public double getYOffset() + { + return 0.0D; + } + + /** + * Returns the Y offset from the entity's position for any entity riding this one. + */ + public double getMountedYOffset() + { + return (double)this.height * 0.75D; + } + + /** + * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. + */ + public void mountEntity(Entity entityIn) + { + this.entityRiderPitchDelta = 0.0D; + this.entityRiderYawDelta = 0.0D; + + if (entityIn == null) + { + if (this.ridingEntity != null) + { + this.setLocationAndAngles(this.ridingEntity.posX, this.ridingEntity.getEntityBoundingBox().minY + (double)this.ridingEntity.height, this.ridingEntity.posZ, this.rotationYaw, this.rotationPitch); + this.ridingEntity.riddenByEntity = null; + } + + this.ridingEntity = null; + } + else + { + if (this.ridingEntity != null) + { + this.ridingEntity.riddenByEntity = null; + } + + if (entityIn != null) + { + for (Entity entity = entityIn.ridingEntity; entity != null; entity = entity.ridingEntity) + { + if (entity == this) + { + return; + } + } + } + + this.ridingEntity = entityIn; + entityIn.riddenByEntity = this; + } + } + + public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + { + this.setPosition(x, y, z); + this.setRotation(yaw, pitch); + List list = this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox().contract(0.03125D, 0.0D, 0.03125D)); + + if (!list.isEmpty()) + { + double d0 = 0.0D; + + for (AxisAlignedBB axisalignedbb : list) + { + if (axisalignedbb.maxY > d0) + { + d0 = axisalignedbb.maxY; + } + } + + y = y + (d0 - this.getEntityBoundingBox().minY); + this.setPosition(x, y, z); + } + } + + public float getCollisionBorderSize() + { + return 0.1F; + } + + /** + * returns a (normalized) vector of where this entity is looking + */ + public Vec3 getLookVec() + { + return null; + } + + public void func_181015_d(BlockPos p_181015_1_) + { + if (this.timeUntilPortal > 0) + { + this.timeUntilPortal = this.getPortalCooldown(); + } + else + { + if (!this.worldObj.isRemote && !p_181015_1_.equals(this.field_181016_an)) + { + this.field_181016_an = p_181015_1_; + BlockPattern.PatternHelper blockpattern$patternhelper = Blocks.portal.func_181089_f(this.worldObj, p_181015_1_); + double d0 = blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? (double)blockpattern$patternhelper.func_181117_a().getZ() : (double)blockpattern$patternhelper.func_181117_a().getX(); + double d1 = blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? this.posZ : this.posX; + d1 = Math.abs(MathHelper.func_181160_c(d1 - (double)(blockpattern$patternhelper.getFinger().rotateY().getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE ? 1 : 0), d0, d0 - (double)blockpattern$patternhelper.func_181118_d())); + double d2 = MathHelper.func_181160_c(this.posY - 1.0D, (double)blockpattern$patternhelper.func_181117_a().getY(), (double)(blockpattern$patternhelper.func_181117_a().getY() - blockpattern$patternhelper.func_181119_e())); + this.field_181017_ao = new Vec3(d1, d2, 0.0D); + this.field_181018_ap = blockpattern$patternhelper.getFinger(); + } + + this.inPortal = true; + } + } + + /** + * Return the amount of cooldown before this entity can use a portal again. + */ + public int getPortalCooldown() + { + return 300; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double x, double y, double z) + { + this.motionX = x; + this.motionY = y; + this.motionZ = z; + } + + public void handleStatusUpdate(byte id) + { + } + + /** + * Setups the entity to do the hurt animation. Only used by packets in multiplayer. + */ + public void performHurtAnimation() + { + } + + /** + * returns the inventory of this entity (only used in EntityPlayerMP it seems) + */ + public ItemStack[] getInventory() + { + return null; + } + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public void setCurrentItemOrArmor(int slotIn, ItemStack stack) + { + } + + /** + * Returns true if the entity is on fire. Used by render to add the fire effect on rendering. + */ + public boolean isBurning() + { + boolean flag = this.worldObj != null && this.worldObj.isRemote; + return !this.isImmuneToFire && (this.fire > 0 || flag && this.getFlag(0)); + } + + /** + * Returns true if the entity is riding another entity, used by render to rotate the legs to be in 'sit' position + * for players. + */ + public boolean isRiding() + { + return this.ridingEntity != null; + } + + /** + * Returns if this entity is sneaking. + */ + public boolean isSneaking() + { + return this.getFlag(1); + } + + /** + * Sets the sneaking flag. + */ + public void setSneaking(boolean sneaking) + { + this.setFlag(1, sneaking); + } + + /** + * Get if the Entity is sprinting. + */ + public boolean isSprinting() + { + return this.getFlag(3); + } + + /** + * Set sprinting switch for Entity. + */ + public void setSprinting(boolean sprinting) + { + this.setFlag(3, sprinting); + } + + public boolean isInvisible() + { + return this.getFlag(5); + } + + /** + * Only used by renderer in EntityLivingBase subclasses. + * Determines if an entity is visible or not to a specfic player, if the entity is normally invisible. + * For EntityLivingBase subclasses, returning false when invisible will render the entity semitransparent. + */ + public boolean isInvisibleToPlayer(EntityPlayer player) + { + return player.isSpectator() ? false : this.isInvisible(); + } + + public void setInvisible(boolean invisible) + { + this.setFlag(5, invisible); + } + + public boolean isEating() + { + return this.getFlag(4); + } + + public void setEating(boolean eating) + { + this.setFlag(4, eating); + } + + /** + * Returns true if the flag is active for the entity. Known flags: 0) is burning; 1) is sneaking; 2) is riding + * something; 3) is sprinting; 4) is eating + */ + protected boolean getFlag(int flag) + { + return (this.dataWatcher.getWatchableObjectByte(0) & 1 << flag) != 0; + } + + /** + * Enable or disable a entity flag, see getEntityFlag to read the know flags. + */ + protected void setFlag(int flag, boolean set) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(0); + + if (set) + { + this.dataWatcher.updateObject(0, Byte.valueOf((byte)(b0 | 1 << flag))); + } + else + { + this.dataWatcher.updateObject(0, Byte.valueOf((byte)(b0 & ~(1 << flag)))); + } + } + + public int getAir() + { + return this.dataWatcher.getWatchableObjectShort(1); + } + + public void setAir(int air) + { + this.dataWatcher.updateObject(1, Short.valueOf((short)air)); + } + + /** + * Called when a lightning bolt hits the entity. + */ + public void onStruckByLightning(EntityLightningBolt lightningBolt) + { + this.attackEntityFrom(DamageSource.lightningBolt, 5.0F); + ++this.fire; + + if (this.fire == 0) + { + this.setFire(8); + } + } + + /** + * This method gets called when the entity kills another one. + */ + public void onKillEntity(EntityLivingBase entityLivingIn) + { + } + + protected boolean pushOutOfBlocks(double x, double y, double z) + { + BlockPos blockpos = new BlockPos(x, y, z); + double d0 = x - (double)blockpos.getX(); + double d1 = y - (double)blockpos.getY(); + double d2 = z - (double)blockpos.getZ(); + List list = this.worldObj.func_147461_a(this.getEntityBoundingBox()); + + if (list.isEmpty() && !this.worldObj.isBlockFullCube(blockpos)) + { + return false; + } + else + { + int i = 3; + double d3 = 9999.0D; + + if (!this.worldObj.isBlockFullCube(blockpos.west()) && d0 < d3) + { + d3 = d0; + i = 0; + } + + if (!this.worldObj.isBlockFullCube(blockpos.east()) && 1.0D - d0 < d3) + { + d3 = 1.0D - d0; + i = 1; + } + + if (!this.worldObj.isBlockFullCube(blockpos.up()) && 1.0D - d1 < d3) + { + d3 = 1.0D - d1; + i = 3; + } + + if (!this.worldObj.isBlockFullCube(blockpos.north()) && d2 < d3) + { + d3 = d2; + i = 4; + } + + if (!this.worldObj.isBlockFullCube(blockpos.south()) && 1.0D - d2 < d3) + { + d3 = 1.0D - d2; + i = 5; + } + + float f = this.rand.nextFloat() * 0.2F + 0.1F; + + if (i == 0) + { + this.motionX = (double)(-f); + } + + if (i == 1) + { + this.motionX = (double)f; + } + + if (i == 3) + { + this.motionY = (double)f; + } + + if (i == 4) + { + this.motionZ = (double)(-f); + } + + if (i == 5) + { + this.motionZ = (double)f; + } + + return true; + } + } + + /** + * Sets the Entity inside a web block. + */ + public void setInWeb() + { + this.isInWeb = true; + this.fallDistance = 0.0F; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + if (this.hasCustomName()) + { + return this.getCustomNameTag(); + } + else + { + String s = EntityList.getEntityString(this); + + if (s == null) + { + s = "generic"; + } + + return StatCollector.translateToLocal("entity." + s + ".name"); + } + } + + /** + * Return the Entity parts making up this Entity (currently only for dragons) + */ + public Entity[] getParts() + { + return null; + } + + /** + * Returns true if Entity argument is equal to this Entity + */ + public boolean isEntityEqual(Entity entityIn) + { + return this == entityIn; + } + + public float getRotationYawHead() + { + return 0.0F; + } + + /** + * Sets the head's yaw rotation of the entity. + */ + public void setRotationYawHead(float rotation) + { + } + + public void func_181013_g(float p_181013_1_) + { + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return true; + } + + /** + * Called when a player attacks an entity. If this returns true the attack will not happen. + */ + public boolean hitByEntity(Entity entityIn) + { + return false; + } + + public String toString() + { + return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] {this.getClass().getSimpleName(), this.getName(), Integer.valueOf(this.entityId), this.worldObj == null ? "~NULL~" : this.worldObj.getWorldInfo().getWorldName(), Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ)}); + } + + public boolean isEntityInvulnerable(DamageSource source) + { + return this.invulnerable && source != DamageSource.outOfWorld && !source.isCreativePlayer(); + } + + /** + * Sets this entity's location and angles to the location and angles of the passed in entity. + */ + public void copyLocationAndAnglesFrom(Entity entityIn) + { + this.setLocationAndAngles(entityIn.posX, entityIn.posY, entityIn.posZ, entityIn.rotationYaw, entityIn.rotationPitch); + } + + /** + * Prepares this entity in new dimension by copying NBT data from entity in old dimension + */ + public void copyDataFromOld(Entity entityIn) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + entityIn.writeToNBT(nbttagcompound); + this.readFromNBT(nbttagcompound); + this.timeUntilPortal = entityIn.timeUntilPortal; + this.field_181016_an = entityIn.field_181016_an; + this.field_181017_ao = entityIn.field_181017_ao; + this.field_181018_ap = entityIn.field_181018_ap; + } + + /** + * Teleports the entity to another dimension. Params: Dimension number to teleport to + */ + public void travelToDimension(int dimensionId) + { + if (!this.worldObj.isRemote && !this.isDead) + { + this.worldObj.theProfiler.startSection("changeDimension"); + MinecraftServer minecraftserver = MinecraftServer.getServer(); + int i = this.dimension; + WorldServer worldserver = minecraftserver.worldServerForDimension(i); + WorldServer worldserver1 = minecraftserver.worldServerForDimension(dimensionId); + this.dimension = dimensionId; + + if (i == 1 && dimensionId == 1) + { + worldserver1 = minecraftserver.worldServerForDimension(0); + this.dimension = 0; + } + + this.worldObj.removeEntity(this); + this.isDead = false; + this.worldObj.theProfiler.startSection("reposition"); + minecraftserver.getConfigurationManager().transferEntityToWorld(this, i, worldserver, worldserver1); + this.worldObj.theProfiler.endStartSection("reloading"); + Entity entity = EntityList.createEntityByName(EntityList.getEntityString(this), worldserver1); + + if (entity != null) + { + entity.copyDataFromOld(this); + + if (i == 1 && dimensionId == 1) + { + BlockPos blockpos = this.worldObj.getTopSolidOrLiquidBlock(worldserver1.getSpawnPoint()); + entity.moveToBlockPosAndAngles(blockpos, entity.rotationYaw, entity.rotationPitch); + } + + worldserver1.spawnEntityInWorld(entity); + } + + this.isDead = true; + this.worldObj.theProfiler.endSection(); + worldserver.resetUpdateEntityTick(); + worldserver1.resetUpdateEntityTick(); + this.worldObj.theProfiler.endSection(); + } + } + + /** + * Explosion resistance of a block relative to this entity + */ + public float getExplosionResistance(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn) + { + return blockStateIn.getBlock().getExplosionResistance(this); + } + + public boolean verifyExplosion(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn, float p_174816_5_) + { + return true; + } + + /** + * The maximum height from where the entity is alowed to jump (used in pathfinder) + */ + public int getMaxFallHeight() + { + return 3; + } + + public Vec3 func_181014_aG() + { + return this.field_181017_ao; + } + + public EnumFacing func_181012_aH() + { + return this.field_181018_ap; + } + + /** + * Return whether this entity should NOT trigger a pressure plate or a tripwire. + */ + public boolean doesEntityNotTriggerPressurePlate() + { + return false; + } + + public void addEntityCrashInfo(CrashReportCategory category) + { + category.addCrashSectionCallable("Entity Type", new Callable() + { + public String call() throws Exception + { + return EntityList.getEntityString(Entity.this) + " (" + Entity.this.getClass().getCanonicalName() + ")"; + } + }); + category.addCrashSection("Entity ID", Integer.valueOf(this.entityId)); + category.addCrashSectionCallable("Entity Name", new Callable() + { + public String call() throws Exception + { + return Entity.this.getName(); + } + }); + category.addCrashSection("Entity\'s Exact location", String.format("%.2f, %.2f, %.2f", new Object[] {Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ)})); + category.addCrashSection("Entity\'s Block location", CrashReportCategory.getCoordinateInfo((double)MathHelper.floor_double(this.posX), (double)MathHelper.floor_double(this.posY), (double)MathHelper.floor_double(this.posZ))); + category.addCrashSection("Entity\'s Momentum", String.format("%.2f, %.2f, %.2f", new Object[] {Double.valueOf(this.motionX), Double.valueOf(this.motionY), Double.valueOf(this.motionZ)})); + category.addCrashSectionCallable("Entity\'s Rider", new Callable() + { + public String call() throws Exception + { + return Entity.this.riddenByEntity.toString(); + } + }); + category.addCrashSectionCallable("Entity\'s Vehicle", new Callable() + { + public String call() throws Exception + { + return Entity.this.ridingEntity.toString(); + } + }); + } + + /** + * Return whether this entity should be rendered as on fire. + */ + public boolean canRenderOnFire() + { + return this.isBurning(); + } + + public UUID getUniqueID() + { + return this.entityUniqueID; + } + + public boolean isPushedByWater() + { + return true; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + ChatComponentText chatcomponenttext = new ChatComponentText(this.getName()); + chatcomponenttext.getChatStyle().setChatHoverEvent(this.getHoverEvent()); + chatcomponenttext.getChatStyle().setInsertion(this.getUniqueID().toString()); + return chatcomponenttext; + } + + /** + * Sets the custom name tag for this entity + */ + public void setCustomNameTag(String name) + { + this.dataWatcher.updateObject(2, name); + } + + public String getCustomNameTag() + { + return this.dataWatcher.getWatchableObjectString(2); + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return this.dataWatcher.getWatchableObjectString(2).length() > 0; + } + + public void setAlwaysRenderNameTag(boolean alwaysRenderNameTag) + { + this.dataWatcher.updateObject(3, Byte.valueOf((byte)(alwaysRenderNameTag ? 1 : 0))); + } + + public boolean getAlwaysRenderNameTag() + { + return this.dataWatcher.getWatchableObjectByte(3) == 1; + } + + /** + * Sets the position of the entity and updates the 'last' variables + */ + public void setPositionAndUpdate(double x, double y, double z) + { + this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch); + } + + public boolean getAlwaysRenderNameTagForRender() + { + return this.getAlwaysRenderNameTag(); + } + + public void onDataWatcherUpdate(int dataID) + { + } + + public EnumFacing getHorizontalFacing() + { + return EnumFacing.getHorizontal(MathHelper.floor_double((double)(this.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3); + } + + protected HoverEvent getHoverEvent() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + String s = EntityList.getEntityString(this); + nbttagcompound.setString("id", this.getUniqueID().toString()); + + if (s != null) + { + nbttagcompound.setString("type", s); + } + + nbttagcompound.setString("name", this.getName()); + return new HoverEvent(HoverEvent.Action.SHOW_ENTITY, new ChatComponentText(nbttagcompound.toString())); + } + + public boolean isSpectatedByPlayer(EntityPlayerMP player) + { + return true; + } + + public AxisAlignedBB getEntityBoundingBox() + { + return this.boundingBox; + } + + public void setEntityBoundingBox(AxisAlignedBB bb) + { + this.boundingBox = bb; + } + + public float getEyeHeight() + { + return this.height * 0.85F; + } + + public boolean isOutsideBorder() + { + return this.isOutsideBorder; + } + + public void setOutsideBorder(boolean outsideBorder) + { + this.isOutsideBorder = outsideBorder; + } + + public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn) + { + return false; + } + + /** + * Send a chat message to the CommandSender + */ + public void addChatMessage(IChatComponent component) + { + } + + /** + * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not + */ + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { + return true; + } + + /** + * Get the position in the world. {@code null} is not allowed! If you are not an entity in the world, return + * the coordinates 0, 0, 0 + */ + public BlockPos getPosition() + { + return new BlockPos(this.posX, this.posY + 0.5D, this.posZ); + } + + /** + * Get the position vector. {@code null} is not allowed! If you are not an entity in the world, return 0.0D, + * 0.0D, 0.0D + */ + public Vec3 getPositionVector() + { + return new Vec3(this.posX, this.posY, this.posZ); + } + + /** + * Get the world, if available. {@code null} is not allowed! If you are not an entity in the world, return + * the overworld + */ + public World getEntityWorld() + { + return this.worldObj; + } + + /** + * Returns the entity associated with the command sender. MAY BE NULL! + */ + public Entity getCommandSenderEntity() + { + return this; + } + + /** + * Returns true if the command sender should be sent feedback about executed commands + */ + public boolean sendCommandFeedback() + { + return false; + } + + public void setCommandStat(CommandResultStats.Type type, int amount) + { + this.cmdResultStats.func_179672_a(this, type, amount); + } + + public CommandResultStats getCommandStats() + { + return this.cmdResultStats; + } + + public void func_174817_o(Entity entityIn) + { + this.cmdResultStats.func_179671_a(entityIn.getCommandStats()); + } + + public NBTTagCompound getNBTTagCompound() + { + return null; + } + + /** + * Called when client receives entity's NBTTagCompound from server. + */ + public void clientUpdateEntityNBT(NBTTagCompound compound) + { + } + + /** + * New version of interactWith that includes vector information on where precisely the player targeted. + */ + public boolean interactAt(EntityPlayer player, Vec3 targetVec3) + { + return false; + } + + public boolean isImmuneToExplosions() + { + return false; + } + + protected void applyEnchantments(EntityLivingBase entityLivingBaseIn, Entity entityIn) + { + if (entityIn instanceof EntityLivingBase) + { + EnchantmentHelper.applyThornEnchantments((EntityLivingBase)entityIn, entityLivingBaseIn); + } + + EnchantmentHelper.applyArthropodEnchantments(entityLivingBaseIn, entityIn); + } +} diff --git a/src/minecraft/net/minecraft/entity/EntityAgeable.java b/src/minecraft/net/minecraft/entity/EntityAgeable.java new file mode 100644 index 0000000..98fc47b --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntityAgeable.java @@ -0,0 +1,253 @@ +package net.minecraft.entity; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public abstract class EntityAgeable extends EntityCreature +{ + protected int growingAge; + protected int field_175502_b; + protected int field_175503_c; + private float ageWidth = -1.0F; + private float ageHeight; + + public EntityAgeable(World worldIn) + { + super(worldIn); + } + + public abstract EntityAgeable createChild(EntityAgeable ageable); + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.spawn_egg) + { + if (!this.worldObj.isRemote) + { + Class oclass = EntityList.getClassFromID(itemstack.getMetadata()); + + if (oclass != null && this.getClass() == oclass) + { + EntityAgeable entityageable = this.createChild(this); + + if (entityageable != null) + { + entityageable.setGrowingAge(-24000); + entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, 0.0F, 0.0F); + this.worldObj.spawnEntityInWorld(entityageable); + + if (itemstack.hasDisplayName()) + { + entityageable.setCustomNameTag(itemstack.getDisplayName()); + } + + if (!player.capabilities.isCreativeMode) + { + --itemstack.stackSize; + + if (itemstack.stackSize <= 0) + { + player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null); + } + } + } + } + } + + return true; + } + else + { + return false; + } + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(12, Byte.valueOf((byte)0)); + } + + /** + * The age value may be negative or positive or zero. If it's negative, it get's incremented on each tick, if it's + * positive, it get's decremented each tick. Don't confuse this with EntityLiving.getAge. With a negative value the + * Entity is considered a child. + */ + public int getGrowingAge() + { + return this.worldObj.isRemote ? this.dataWatcher.getWatchableObjectByte(12) : this.growingAge; + } + + public void func_175501_a(int p_175501_1_, boolean p_175501_2_) + { + int i = this.getGrowingAge(); + int j = i; + i = i + p_175501_1_ * 20; + + if (i > 0) + { + i = 0; + + if (j < 0) + { + this.onGrowingAdult(); + } + } + + int k = i - j; + this.setGrowingAge(i); + + if (p_175501_2_) + { + this.field_175502_b += k; + + if (this.field_175503_c == 0) + { + this.field_175503_c = 40; + } + } + + if (this.getGrowingAge() == 0) + { + this.setGrowingAge(this.field_175502_b); + } + } + + /** + * "Adds the value of the parameter times 20 to the age of this entity. If the entity is an adult (if the entity's + * age is greater than 0), it will have no effect." + */ + public void addGrowth(int growth) + { + this.func_175501_a(growth, false); + } + + /** + * The age value may be negative or positive or zero. If it's negative, it get's incremented on each tick, if it's + * positive, it get's decremented each tick. With a negative value the Entity is considered a child. + */ + public void setGrowingAge(int age) + { + this.dataWatcher.updateObject(12, Byte.valueOf((byte)MathHelper.clamp_int(age, -1, 1))); + this.growingAge = age; + this.setScaleForAge(this.isChild()); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("Age", this.getGrowingAge()); + tagCompound.setInteger("ForcedAge", this.field_175502_b); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.setGrowingAge(tagCompund.getInteger("Age")); + this.field_175502_b = tagCompund.getInteger("ForcedAge"); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (this.worldObj.isRemote) + { + if (this.field_175503_c > 0) + { + if (this.field_175503_c % 4 == 0) + { + this.worldObj.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, 0.0D, 0.0D, 0.0D, new int[0]); + } + + --this.field_175503_c; + } + + this.setScaleForAge(this.isChild()); + } + else + { + int i = this.getGrowingAge(); + + if (i < 0) + { + ++i; + this.setGrowingAge(i); + + if (i == 0) + { + this.onGrowingAdult(); + } + } + else if (i > 0) + { + --i; + this.setGrowingAge(i); + } + } + } + + /** + * This is called when Entity's growing age timer reaches 0 (negative values are considered as a child, positive as + * an adult) + */ + protected void onGrowingAdult() + { + } + + /** + * If Animal, checks if the age timer is negative + */ + public boolean isChild() + { + return this.getGrowingAge() < 0; + } + + /** + * "Sets the scale for an ageable entity according to the boolean parameter, which says if it's a child." + */ + public void setScaleForAge(boolean p_98054_1_) + { + this.setScale(p_98054_1_ ? 0.5F : 1.0F); + } + + /** + * Sets the width and height of the entity. Args: width, height + */ + protected final void setSize(float width, float height) + { + boolean flag = this.ageWidth > 0.0F; + this.ageWidth = width; + this.ageHeight = height; + + if (!flag) + { + this.setScale(1.0F); + } + } + + protected final void setScale(float scale) + { + super.setSize(this.ageWidth * scale, this.ageHeight * scale); + } +} diff --git a/src/minecraft/net/minecraft/entity/EntityBodyHelper.java b/src/minecraft/net/minecraft/entity/EntityBodyHelper.java new file mode 100644 index 0000000..d1c4ef6 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntityBodyHelper.java @@ -0,0 +1,80 @@ +package net.minecraft.entity; + +import net.minecraft.util.MathHelper; + +public class EntityBodyHelper +{ + /** Instance of EntityLiving. */ + private EntityLivingBase theLiving; + + /** + * Used to progressively ajust the rotation of the body to the rotation of the head + */ + private int rotationTickCounter; + private float prevRenderYawHead; + + public EntityBodyHelper(EntityLivingBase p_i1611_1_) + { + this.theLiving = p_i1611_1_; + } + + /** + * Update the Head and Body rendenring angles + */ + public void updateRenderAngles() + { + double d0 = this.theLiving.posX - this.theLiving.prevPosX; + double d1 = this.theLiving.posZ - this.theLiving.prevPosZ; + + if (d0 * d0 + d1 * d1 > 2.500000277905201E-7D) + { + this.theLiving.renderYawOffset = this.theLiving.rotationYaw; + this.theLiving.rotationYawHead = this.computeAngleWithBound(this.theLiving.renderYawOffset, this.theLiving.rotationYawHead, 75.0F); + this.prevRenderYawHead = this.theLiving.rotationYawHead; + this.rotationTickCounter = 0; + } + else + { + float f = 75.0F; + + if (Math.abs(this.theLiving.rotationYawHead - this.prevRenderYawHead) > 15.0F) + { + this.rotationTickCounter = 0; + this.prevRenderYawHead = this.theLiving.rotationYawHead; + } + else + { + ++this.rotationTickCounter; + int i = 10; + + if (this.rotationTickCounter > 10) + { + f = Math.max(1.0F - (float)(this.rotationTickCounter - 10) / 10.0F, 0.0F) * 75.0F; + } + } + + this.theLiving.renderYawOffset = this.computeAngleWithBound(this.theLiving.rotationYawHead, this.theLiving.renderYawOffset, f); + } + } + + /** + * Return the new angle2 such that the difference between angle1 and angle2 is lower than angleMax. Args : angle1, + * angle2, angleMax + */ + private float computeAngleWithBound(float p_75665_1_, float p_75665_2_, float p_75665_3_) + { + float f = MathHelper.wrapAngleTo180_float(p_75665_1_ - p_75665_2_); + + if (f < -p_75665_3_) + { + f = -p_75665_3_; + } + + if (f >= p_75665_3_) + { + f = p_75665_3_; + } + + return p_75665_1_ - f; + } +} diff --git a/src/minecraft/net/minecraft/entity/EntityCreature.java b/src/minecraft/net/minecraft/entity/EntityCreature.java new file mode 100644 index 0000000..ae8668c --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntityCreature.java @@ -0,0 +1,165 @@ +package net.minecraft.entity; + +import java.util.UUID; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.passive.EntityTameable; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public abstract class EntityCreature extends EntityLiving +{ + public static final UUID FLEEING_SPEED_MODIFIER_UUID = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A"); + public static final AttributeModifier FLEEING_SPEED_MODIFIER = (new AttributeModifier(FLEEING_SPEED_MODIFIER_UUID, "Fleeing speed bonus", 2.0D, 2)).setSaved(false); + private BlockPos homePosition = BlockPos.ORIGIN; + + /** If -1 there is no maximum distance */ + private float maximumHomeDistance = -1.0F; + private EntityAIBase aiBase = new EntityAIMoveTowardsRestriction(this, 1.0D); + private boolean isMovementAITaskSet; + + public EntityCreature(World worldIn) + { + super(worldIn); + } + + public float getBlockPathWeight(BlockPos pos) + { + return 0.0F; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return super.getCanSpawnHere() && this.getBlockPathWeight(new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ)) >= 0.0F; + } + + /** + * if the entity got a PathEntity it returns true, else false + */ + public boolean hasPath() + { + return !this.navigator.noPath(); + } + + public boolean isWithinHomeDistanceCurrentPosition() + { + return this.isWithinHomeDistanceFromPosition(new BlockPos(this)); + } + + public boolean isWithinHomeDistanceFromPosition(BlockPos pos) + { + return this.maximumHomeDistance == -1.0F ? true : this.homePosition.distanceSq(pos) < (double)(this.maximumHomeDistance * this.maximumHomeDistance); + } + + /** + * Sets home position and max distance for it + */ + public void setHomePosAndDistance(BlockPos pos, int distance) + { + this.homePosition = pos; + this.maximumHomeDistance = (float)distance; + } + + public BlockPos getHomePosition() + { + return this.homePosition; + } + + public float getMaximumHomeDistance() + { + return this.maximumHomeDistance; + } + + public void detachHome() + { + this.maximumHomeDistance = -1.0F; + } + + /** + * Returns whether a home area is defined for this entity. + */ + public boolean hasHome() + { + return this.maximumHomeDistance != -1.0F; + } + + /** + * Applies logic related to leashes, for example dragging the entity or breaking the leash. + */ + protected void updateLeashedState() + { + super.updateLeashedState(); + + if (this.getLeashed() && this.getLeashedToEntity() != null && this.getLeashedToEntity().worldObj == this.worldObj) + { + Entity entity = this.getLeashedToEntity(); + this.setHomePosAndDistance(new BlockPos((int)entity.posX, (int)entity.posY, (int)entity.posZ), 5); + float f = this.getDistanceToEntity(entity); + + if (this instanceof EntityTameable && ((EntityTameable)this).isSitting()) + { + if (f > 10.0F) + { + this.clearLeashed(true, true); + } + + return; + } + + if (!this.isMovementAITaskSet) + { + this.tasks.addTask(2, this.aiBase); + + if (this.getNavigator() instanceof PathNavigateGround) + { + ((PathNavigateGround)this.getNavigator()).setAvoidsWater(false); + } + + this.isMovementAITaskSet = true; + } + + this.func_142017_o(f); + + if (f > 4.0F) + { + this.getNavigator().tryMoveToEntityLiving(entity, 1.0D); + } + + if (f > 6.0F) + { + double d0 = (entity.posX - this.posX) / (double)f; + double d1 = (entity.posY - this.posY) / (double)f; + double d2 = (entity.posZ - this.posZ) / (double)f; + this.motionX += d0 * Math.abs(d0) * 0.4D; + this.motionY += d1 * Math.abs(d1) * 0.4D; + this.motionZ += d2 * Math.abs(d2) * 0.4D; + } + + if (f > 10.0F) + { + this.clearLeashed(true, true); + } + } + else if (!this.getLeashed() && this.isMovementAITaskSet) + { + this.isMovementAITaskSet = false; + this.tasks.removeTask(this.aiBase); + + if (this.getNavigator() instanceof PathNavigateGround) + { + ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); + } + + this.detachHome(); + } + } + + protected void func_142017_o(float p_142017_1_) + { + } +} diff --git a/src/minecraft/net/minecraft/entity/EntityFlying.java b/src/minecraft/net/minecraft/entity/EntityFlying.java new file mode 100644 index 0000000..eafe6a8 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntityFlying.java @@ -0,0 +1,89 @@ +package net.minecraft.entity; + +import net.minecraft.block.Block; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public abstract class EntityFlying extends EntityLiving +{ + public EntityFlying(World worldIn) + { + super(worldIn); + } + + public void fall(float distance, float damageMultiplier) + { + } + + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) + { + } + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float strafe, float forward) + { + if (this.isInWater()) + { + this.moveFlying(strafe, forward, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.800000011920929D; + this.motionY *= 0.800000011920929D; + this.motionZ *= 0.800000011920929D; + } + else if (this.isInLava()) + { + this.moveFlying(strafe, forward, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + else + { + float f = 0.91F; + + if (this.onGround) + { + f = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.91F; + } + + float f1 = 0.16277136F / (f * f * f); + this.moveFlying(strafe, forward, this.onGround ? 0.1F * f1 : 0.02F); + f = 0.91F; + + if (this.onGround) + { + f = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.91F; + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)f; + this.motionY *= (double)f; + this.motionZ *= (double)f; + } + + this.prevLimbSwingAmount = this.limbSwingAmount; + double d1 = this.posX - this.prevPosX; + double d0 = this.posZ - this.prevPosZ; + float f2 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F; + + if (f2 > 1.0F) + { + f2 = 1.0F; + } + + this.limbSwingAmount += (f2 - this.limbSwingAmount) * 0.4F; + this.limbSwing += this.limbSwingAmount; + } + + /** + * returns true if this entity is by a ladder, false otherwise + */ + public boolean isOnLadder() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/entity/EntityHanging.java b/src/minecraft/net/minecraft/entity/EntityHanging.java new file mode 100644 index 0000000..608b5db --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntityHanging.java @@ -0,0 +1,299 @@ +package net.minecraft.entity; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockRedstoneDiode; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; +import org.apache.commons.lang3.Validate; + +public abstract class EntityHanging extends Entity +{ + private int tickCounter1; + protected BlockPos hangingPosition; + + /** The direction the entity is facing */ + public EnumFacing facingDirection; + + public EntityHanging(World worldIn) + { + super(worldIn); + this.setSize(0.5F, 0.5F); + } + + public EntityHanging(World worldIn, BlockPos hangingPositionIn) + { + this(worldIn); + this.hangingPosition = hangingPositionIn; + } + + protected void entityInit() + { + } + + /** + * Updates facing and bounding box based on it + */ + protected void updateFacingWithBoundingBox(EnumFacing facingDirectionIn) + { + Validate.notNull(facingDirectionIn); + Validate.isTrue(facingDirectionIn.getAxis().isHorizontal()); + this.facingDirection = facingDirectionIn; + this.prevRotationYaw = this.rotationYaw = (float)(this.facingDirection.getHorizontalIndex() * 90); + this.updateBoundingBox(); + } + + /** + * Updates the entity bounding box based on current facing + */ + private void updateBoundingBox() + { + if (this.facingDirection != null) + { + double d0 = (double)this.hangingPosition.getX() + 0.5D; + double d1 = (double)this.hangingPosition.getY() + 0.5D; + double d2 = (double)this.hangingPosition.getZ() + 0.5D; + double d3 = 0.46875D; + double d4 = this.func_174858_a(this.getWidthPixels()); + double d5 = this.func_174858_a(this.getHeightPixels()); + d0 = d0 - (double)this.facingDirection.getFrontOffsetX() * 0.46875D; + d2 = d2 - (double)this.facingDirection.getFrontOffsetZ() * 0.46875D; + d1 = d1 + d5; + EnumFacing enumfacing = this.facingDirection.rotateYCCW(); + d0 = d0 + d4 * (double)enumfacing.getFrontOffsetX(); + d2 = d2 + d4 * (double)enumfacing.getFrontOffsetZ(); + this.posX = d0; + this.posY = d1; + this.posZ = d2; + double d6 = (double)this.getWidthPixels(); + double d7 = (double)this.getHeightPixels(); + double d8 = (double)this.getWidthPixels(); + + if (this.facingDirection.getAxis() == EnumFacing.Axis.Z) + { + d8 = 1.0D; + } + else + { + d6 = 1.0D; + } + + d6 = d6 / 32.0D; + d7 = d7 / 32.0D; + d8 = d8 / 32.0D; + this.setEntityBoundingBox(new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8)); + } + } + + private double func_174858_a(int p_174858_1_) + { + return p_174858_1_ % 32 == 0 ? 0.5D : 0.0D; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.tickCounter1++ == 100 && !this.worldObj.isRemote) + { + this.tickCounter1 = 0; + + if (!this.isDead && !this.onValidSurface()) + { + this.setDead(); + this.onBroken((Entity)null); + } + } + } + + /** + * checks to make sure painting can be placed there + */ + public boolean onValidSurface() + { + if (!this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty()) + { + return false; + } + else + { + int i = Math.max(1, this.getWidthPixels() / 16); + int j = Math.max(1, this.getHeightPixels() / 16); + BlockPos blockpos = this.hangingPosition.offset(this.facingDirection.getOpposite()); + EnumFacing enumfacing = this.facingDirection.rotateYCCW(); + + for (int k = 0; k < i; ++k) + { + for (int l = 0; l < j; ++l) + { + BlockPos blockpos1 = blockpos.offset(enumfacing, k).up(l); + Block block = this.worldObj.getBlockState(blockpos1).getBlock(); + + if (!block.getMaterial().isSolid() && !BlockRedstoneDiode.isRedstoneRepeaterBlockID(block)) + { + return false; + } + } + } + + for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox())) + { + if (entity instanceof EntityHanging) + { + return false; + } + } + + return true; + } + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return true; + } + + /** + * Called when a player attacks an entity. If this returns true the attack will not happen. + */ + public boolean hitByEntity(Entity entityIn) + { + return entityIn instanceof EntityPlayer ? this.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)entityIn), 0.0F) : false; + } + + public EnumFacing getHorizontalFacing() + { + return this.facingDirection; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + if (!this.isDead && !this.worldObj.isRemote) + { + this.setDead(); + this.setBeenAttacked(); + this.onBroken(source.getEntity()); + } + + return true; + } + } + + /** + * Tries to moves the entity by the passed in displacement. Args: x, y, z + */ + public void moveEntity(double x, double y, double z) + { + if (!this.worldObj.isRemote && !this.isDead && x * x + y * y + z * z > 0.0D) + { + this.setDead(); + this.onBroken((Entity)null); + } + } + + /** + * Adds to the current velocity of the entity. Args: x, y, z + */ + public void addVelocity(double x, double y, double z) + { + if (!this.worldObj.isRemote && !this.isDead && x * x + y * y + z * z > 0.0D) + { + this.setDead(); + this.onBroken((Entity)null); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + tagCompound.setByte("Facing", (byte)this.facingDirection.getHorizontalIndex()); + tagCompound.setInteger("TileX", this.getHangingPosition().getX()); + tagCompound.setInteger("TileY", this.getHangingPosition().getY()); + tagCompound.setInteger("TileZ", this.getHangingPosition().getZ()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + this.hangingPosition = new BlockPos(tagCompund.getInteger("TileX"), tagCompund.getInteger("TileY"), tagCompund.getInteger("TileZ")); + EnumFacing enumfacing; + + if (tagCompund.hasKey("Direction", 99)) + { + enumfacing = EnumFacing.getHorizontal(tagCompund.getByte("Direction")); + this.hangingPosition = this.hangingPosition.offset(enumfacing); + } + else if (tagCompund.hasKey("Facing", 99)) + { + enumfacing = EnumFacing.getHorizontal(tagCompund.getByte("Facing")); + } + else + { + enumfacing = EnumFacing.getHorizontal(tagCompund.getByte("Dir")); + } + + this.updateFacingWithBoundingBox(enumfacing); + } + + public abstract int getWidthPixels(); + + public abstract int getHeightPixels(); + + /** + * Called when this entity is broken. Entity parameter may be null. + */ + public abstract void onBroken(Entity brokenEntity); + + protected boolean shouldSetPosAfterLoading() + { + return false; + } + + /** + * Sets the x,y,z of the entity from the given parameters. Also seems to set up a bounding box. + */ + public void setPosition(double x, double y, double z) + { + this.posX = x; + this.posY = y; + this.posZ = z; + BlockPos blockpos = this.hangingPosition; + this.hangingPosition = new BlockPos(x, y, z); + + if (!this.hangingPosition.equals(blockpos)) + { + this.updateBoundingBox(); + this.isAirBorne = true; + } + } + + public BlockPos getHangingPosition() + { + return this.hangingPosition; + } +} diff --git a/src/minecraft/net/minecraft/entity/EntityLeashKnot.java b/src/minecraft/net/minecraft/entity/EntityLeashKnot.java new file mode 100644 index 0000000..2a4225d --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntityLeashKnot.java @@ -0,0 +1,172 @@ +package net.minecraft.entity; + +import net.minecraft.block.BlockFence; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class EntityLeashKnot extends EntityHanging +{ + public EntityLeashKnot(World worldIn) + { + super(worldIn); + } + + public EntityLeashKnot(World worldIn, BlockPos hangingPositionIn) + { + super(worldIn, hangingPositionIn); + this.setPosition((double)hangingPositionIn.getX() + 0.5D, (double)hangingPositionIn.getY() + 0.5D, (double)hangingPositionIn.getZ() + 0.5D); + float f = 0.125F; + float f1 = 0.1875F; + float f2 = 0.25F; + this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.1875D, this.posY - 0.25D + 0.125D, this.posZ - 0.1875D, this.posX + 0.1875D, this.posY + 0.25D + 0.125D, this.posZ + 0.1875D)); + } + + protected void entityInit() + { + super.entityInit(); + } + + /** + * Updates facing and bounding box based on it + */ + public void updateFacingWithBoundingBox(EnumFacing facingDirectionIn) + { + } + + public int getWidthPixels() + { + return 9; + } + + public int getHeightPixels() + { + return 9; + } + + public float getEyeHeight() + { + return -0.0625F; + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double distance) + { + return distance < 1024.0D; + } + + /** + * Called when this entity is broken. Entity parameter may be null. + */ + public void onBroken(Entity brokenEntity) + { + } + + /** + * Either write this entity to the NBT tag given and return true, or return false without doing anything. If this + * returns false the entity is not saved on disk. Ridden entities return false here as they are saved with their + * rider. + */ + public boolean writeToNBTOptional(NBTTagCompound tagCompund) + { + return false; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer playerIn) + { + ItemStack itemstack = playerIn.getHeldItem(); + boolean flag = false; + + if (itemstack != null && itemstack.getItem() == Items.lead && !this.worldObj.isRemote) + { + double d0 = 7.0D; + + for (EntityLiving entityliving : this.worldObj.getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + d0, this.posZ + d0))) + { + if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == playerIn) + { + entityliving.setLeashedToEntity(this, true); + flag = true; + } + } + } + + if (!this.worldObj.isRemote && !flag) + { + this.setDead(); + + if (playerIn.capabilities.isCreativeMode) + { + double d1 = 7.0D; + + for (EntityLiving entityliving1 : this.worldObj.getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB(this.posX - d1, this.posY - d1, this.posZ - d1, this.posX + d1, this.posY + d1, this.posZ + d1))) + { + if (entityliving1.getLeashed() && entityliving1.getLeashedToEntity() == this) + { + entityliving1.clearLeashed(true, false); + } + } + } + } + + return true; + } + + /** + * checks to make sure painting can be placed there + */ + public boolean onValidSurface() + { + return this.worldObj.getBlockState(this.hangingPosition).getBlock() instanceof BlockFence; + } + + public static EntityLeashKnot createKnot(World worldIn, BlockPos fence) + { + EntityLeashKnot entityleashknot = new EntityLeashKnot(worldIn, fence); + entityleashknot.forceSpawn = true; + worldIn.spawnEntityInWorld(entityleashknot); + return entityleashknot; + } + + public static EntityLeashKnot getKnotForPosition(World worldIn, BlockPos pos) + { + int i = pos.getX(); + int j = pos.getY(); + int k = pos.getZ(); + + for (EntityLeashKnot entityleashknot : worldIn.getEntitiesWithinAABB(EntityLeashKnot.class, new AxisAlignedBB((double)i - 1.0D, (double)j - 1.0D, (double)k - 1.0D, (double)i + 1.0D, (double)j + 1.0D, (double)k + 1.0D))) + { + if (entityleashknot.getHangingPosition().equals(pos)) + { + return entityleashknot; + } + } + + return null; + } +} diff --git a/src/minecraft/net/minecraft/entity/EntityList.java b/src/minecraft/net/minecraft/entity/EntityList.java new file mode 100644 index 0000000..d7d4b8c --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntityList.java @@ -0,0 +1,385 @@ +package net.minecraft.entity; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; +import java.util.Set; +import net.minecraft.entity.ai.EntityMinecartMobSpawner; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.entity.item.EntityEnderEye; +import net.minecraft.entity.item.EntityEnderPearl; +import net.minecraft.entity.item.EntityExpBottle; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.entity.item.EntityFireworkRocket; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityMinecartChest; +import net.minecraft.entity.item.EntityMinecartEmpty; +import net.minecraft.entity.item.EntityMinecartFurnace; +import net.minecraft.entity.item.EntityMinecartHopper; +import net.minecraft.entity.item.EntityMinecartTNT; +import net.minecraft.entity.item.EntityPainting; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.entity.monster.EntityCaveSpider; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntityEndermite; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.monster.EntityGiantZombie; +import net.minecraft.entity.monster.EntityGuardian; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.monster.EntityMagmaCube; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.monster.EntitySilverfish; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.entity.monster.EntitySnowman; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.monster.EntityWitch; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.entity.passive.EntityCow; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.passive.EntityMooshroom; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.passive.EntityRabbit; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityEgg; +import net.minecraft.entity.projectile.EntityLargeFireball; +import net.minecraft.entity.projectile.EntityPotion; +import net.minecraft.entity.projectile.EntitySmallFireball; +import net.minecraft.entity.projectile.EntitySnowball; +import net.minecraft.entity.projectile.EntityWitherSkull; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.stats.StatBase; +import net.minecraft.stats.StatList; +import net.minecraft.world.World; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class EntityList +{ + private static final Logger logger = LogManager.getLogger(); + private static final Map < String, Class > stringToClassMapping = Maps. < String, Class > newHashMap(); + private static final Map < Class , String > classToStringMapping = Maps. < Class , String > newHashMap(); + private static final Map < Integer, Class > idToClassMapping = Maps. < Integer, Class > newHashMap(); + private static final Map < Class , Integer > classToIDMapping = Maps. < Class , Integer > newHashMap(); + private static final Map stringToIDMapping = Maps.newHashMap(); + public static final Map entityEggs = Maps.newLinkedHashMap(); + + /** + * adds a mapping between Entity classes and both a string representation and an ID + */ + private static void addMapping(Class entityClass, String entityName, int id) + { + if (stringToClassMapping.containsKey(entityName)) + { + throw new IllegalArgumentException("ID is already registered: " + entityName); + } + else if (idToClassMapping.containsKey(Integer.valueOf(id))) + { + throw new IllegalArgumentException("ID is already registered: " + id); + } + else if (id == 0) + { + throw new IllegalArgumentException("Cannot register to reserved id: " + id); + } + else if (entityClass == null) + { + throw new IllegalArgumentException("Cannot register null clazz for id: " + id); + } + else + { + stringToClassMapping.put(entityName, entityClass); + classToStringMapping.put(entityClass, entityName); + idToClassMapping.put(Integer.valueOf(id), entityClass); + classToIDMapping.put(entityClass, Integer.valueOf(id)); + stringToIDMapping.put(entityName, Integer.valueOf(id)); + } + } + + /** + * Adds a entity mapping with egg info. + */ + private static void addMapping(Class entityClass, String entityName, int entityID, int baseColor, int spotColor) + { + addMapping(entityClass, entityName, entityID); + entityEggs.put(Integer.valueOf(entityID), new EntityList.EntityEggInfo(entityID, baseColor, spotColor)); + } + + /** + * Create a new instance of an entity in the world by using the entity name. + */ + public static Entity createEntityByName(String entityName, World worldIn) + { + Entity entity = null; + + try + { + Class oclass = (Class)stringToClassMapping.get(entityName); + + if (oclass != null) + { + entity = (Entity)oclass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {worldIn}); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + + return entity; + } + + /** + * create a new instance of an entity from NBT store + */ + public static Entity createEntityFromNBT(NBTTagCompound nbt, World worldIn) + { + Entity entity = null; + + if ("Minecart".equals(nbt.getString("id"))) + { + nbt.setString("id", EntityMinecart.EnumMinecartType.byNetworkID(nbt.getInteger("Type")).getName()); + nbt.removeTag("Type"); + } + + try + { + Class oclass = (Class)stringToClassMapping.get(nbt.getString("id")); + + if (oclass != null) + { + entity = (Entity)oclass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {worldIn}); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + + if (entity != null) + { + entity.readFromNBT(nbt); + } + else + { + logger.warn("Skipping Entity with id " + nbt.getString("id")); + } + + return entity; + } + + /** + * Create a new instance of an entity in the world by using an entity ID. + */ + public static Entity createEntityByID(int entityID, World worldIn) + { + Entity entity = null; + + try + { + Class oclass = getClassFromID(entityID); + + if (oclass != null) + { + entity = (Entity)oclass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {worldIn}); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + + if (entity == null) + { + logger.warn("Skipping Entity with id " + entityID); + } + + return entity; + } + + /** + * gets the entityID of a specific entity + */ + public static int getEntityID(Entity entityIn) + { + Integer integer = (Integer)classToIDMapping.get(entityIn.getClass()); + return integer == null ? 0 : integer.intValue(); + } + + public static Class getClassFromID(int entityID) + { + return (Class)idToClassMapping.get(Integer.valueOf(entityID)); + } + + /** + * Gets the string representation of a specific entity. + */ + public static String getEntityString(Entity entityIn) + { + return (String)classToStringMapping.get(entityIn.getClass()); + } + + /** + * Returns the ID assigned to it's string representation + */ + public static int getIDFromString(String entityName) + { + Integer integer = (Integer)stringToIDMapping.get(entityName); + return integer == null ? 90 : integer.intValue(); + } + + /** + * Finds the class using IDtoClassMapping and classToStringMapping + */ + public static String getStringFromID(int entityID) + { + return (String)classToStringMapping.get(getClassFromID(entityID)); + } + + public static void func_151514_a() + { + } + + public static List getEntityNameList() + { + Set set = stringToClassMapping.keySet(); + List list = Lists.newArrayList(); + + for (String s : set) + { + Class oclass = (Class)stringToClassMapping.get(s); + + if ((oclass.getModifiers() & 1024) != 1024) + { + list.add(s); + } + } + + list.add("LightningBolt"); + return list; + } + + public static boolean isStringEntityName(Entity entityIn, String entityName) + { + String s = getEntityString(entityIn); + + if (s == null && entityIn instanceof EntityPlayer) + { + s = "Player"; + } + else if (s == null && entityIn instanceof EntityLightningBolt) + { + s = "LightningBolt"; + } + + return entityName.equals(s); + } + + public static boolean isStringValidEntityName(String entityName) + { + return "Player".equals(entityName) || getEntityNameList().contains(entityName); + } + + static + { + addMapping(EntityItem.class, "Item", 1); + addMapping(EntityXPOrb.class, "XPOrb", 2); + addMapping(EntityEgg.class, "ThrownEgg", 7); + addMapping(EntityLeashKnot.class, "LeashKnot", 8); + addMapping(EntityPainting.class, "Painting", 9); + addMapping(EntityArrow.class, "Arrow", 10); + addMapping(EntitySnowball.class, "Snowball", 11); + addMapping(EntityLargeFireball.class, "Fireball", 12); + addMapping(EntitySmallFireball.class, "SmallFireball", 13); + addMapping(EntityEnderPearl.class, "ThrownEnderpearl", 14); + addMapping(EntityEnderEye.class, "EyeOfEnderSignal", 15); + addMapping(EntityPotion.class, "ThrownPotion", 16); + addMapping(EntityExpBottle.class, "ThrownExpBottle", 17); + addMapping(EntityItemFrame.class, "ItemFrame", 18); + addMapping(EntityWitherSkull.class, "WitherSkull", 19); + addMapping(EntityTNTPrimed.class, "PrimedTnt", 20); + addMapping(EntityFallingBlock.class, "FallingSand", 21); + addMapping(EntityFireworkRocket.class, "FireworksRocketEntity", 22); + addMapping(EntityArmorStand.class, "ArmorStand", 30); + addMapping(EntityBoat.class, "Boat", 41); + addMapping(EntityMinecartEmpty.class, EntityMinecart.EnumMinecartType.RIDEABLE.getName(), 42); + addMapping(EntityMinecartChest.class, EntityMinecart.EnumMinecartType.CHEST.getName(), 43); + addMapping(EntityMinecartFurnace.class, EntityMinecart.EnumMinecartType.FURNACE.getName(), 44); + addMapping(EntityMinecartTNT.class, EntityMinecart.EnumMinecartType.TNT.getName(), 45); + addMapping(EntityMinecartHopper.class, EntityMinecart.EnumMinecartType.HOPPER.getName(), 46); + addMapping(EntityMinecartMobSpawner.class, EntityMinecart.EnumMinecartType.SPAWNER.getName(), 47); + addMapping(EntityMinecartCommandBlock.class, EntityMinecart.EnumMinecartType.COMMAND_BLOCK.getName(), 40); + addMapping(EntityLiving.class, "Mob", 48); + addMapping(EntityMob.class, "Monster", 49); + addMapping(EntityCreeper.class, "Creeper", 50, 894731, 0); + addMapping(EntitySkeleton.class, "Skeleton", 51, 12698049, 4802889); + addMapping(EntitySpider.class, "Spider", 52, 3419431, 11013646); + addMapping(EntityGiantZombie.class, "Giant", 53); + addMapping(EntityZombie.class, "Zombie", 54, 44975, 7969893); + addMapping(EntitySlime.class, "Slime", 55, 5349438, 8306542); + addMapping(EntityGhast.class, "Ghast", 56, 16382457, 12369084); + addMapping(EntityPigZombie.class, "PigZombie", 57, 15373203, 5009705); + addMapping(EntityEnderman.class, "Enderman", 58, 1447446, 0); + addMapping(EntityCaveSpider.class, "CaveSpider", 59, 803406, 11013646); + addMapping(EntitySilverfish.class, "Silverfish", 60, 7237230, 3158064); + addMapping(EntityBlaze.class, "Blaze", 61, 16167425, 16775294); + addMapping(EntityMagmaCube.class, "LavaSlime", 62, 3407872, 16579584); + addMapping(EntityDragon.class, "EnderDragon", 63); + addMapping(EntityWither.class, "WitherBoss", 64); + addMapping(EntityBat.class, "Bat", 65, 4996656, 986895); + addMapping(EntityWitch.class, "Witch", 66, 3407872, 5349438); + addMapping(EntityEndermite.class, "Endermite", 67, 1447446, 7237230); + addMapping(EntityGuardian.class, "Guardian", 68, 5931634, 15826224); + addMapping(EntityPig.class, "Pig", 90, 15771042, 14377823); + addMapping(EntitySheep.class, "Sheep", 91, 15198183, 16758197); + addMapping(EntityCow.class, "Cow", 92, 4470310, 10592673); + addMapping(EntityChicken.class, "Chicken", 93, 10592673, 16711680); + addMapping(EntitySquid.class, "Squid", 94, 2243405, 7375001); + addMapping(EntityWolf.class, "Wolf", 95, 14144467, 13545366); + addMapping(EntityMooshroom.class, "MushroomCow", 96, 10489616, 12040119); + addMapping(EntitySnowman.class, "SnowMan", 97); + addMapping(EntityOcelot.class, "Ozelot", 98, 15720061, 5653556); + addMapping(EntityIronGolem.class, "VillagerGolem", 99); + addMapping(EntityHorse.class, "EntityHorse", 100, 12623485, 15656192); + addMapping(EntityRabbit.class, "Rabbit", 101, 10051392, 7555121); + addMapping(EntityVillager.class, "Villager", 120, 5651507, 12422002); + addMapping(EntityEnderCrystal.class, "EnderCrystal", 200); + } + + public static class EntityEggInfo + { + public final int spawnedID; + public final int primaryColor; + public final int secondaryColor; + public final StatBase field_151512_d; + public final StatBase field_151513_e; + + public EntityEggInfo(int id, int baseColor, int spotColor) + { + this.spawnedID = id; + this.primaryColor = baseColor; + this.secondaryColor = spotColor; + this.field_151512_d = StatList.getStatKillEntity(this); + this.field_151513_e = StatList.getStatEntityKilledBy(this); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/EntityLiving.java b/src/minecraft/net/minecraft/entity/EntityLiving.java new file mode 100644 index 0000000..9fd0fd4 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntityLiving.java @@ -0,0 +1,1422 @@ +package net.minecraft.entity; + +import java.util.UUID; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.ai.EntityAITasks; +import net.minecraft.entity.ai.EntityJumpHelper; +import net.minecraft.entity.ai.EntityLookHelper; +import net.minecraft.entity.ai.EntityMoveHelper; +import net.minecraft.entity.ai.EntitySenses; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.passive.EntityTameable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemBow; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagFloat; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.play.server.S1BPacketEntityAttach; +import net.minecraft.pathfinding.PathNavigate; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.biome.BiomeGenBase; +import optifine.BlockPosM; +import optifine.Config; +import optifine.Reflector; + +public abstract class EntityLiving extends EntityLivingBase +{ + /** Number of ticks since this EntityLiving last produced its sound */ + public int livingSoundTime; + + /** The experience points the Entity gives. */ + protected int experienceValue; + private EntityLookHelper lookHelper; + protected EntityMoveHelper moveHelper; + + /** Entity jumping helper */ + protected EntityJumpHelper jumpHelper; + private EntityBodyHelper bodyHelper; + protected PathNavigate navigator; + + /** Passive tasks (wandering, look, idle, ...) */ + protected final EntityAITasks tasks; + + /** Fighting tasks (used by monsters, wolves, ocelots) */ + protected final EntityAITasks targetTasks; + + /** The active target the Task system uses for tracking */ + private EntityLivingBase attackTarget; + private EntitySenses senses; + + /** Equipment (armor and held item) for this entity. */ + private ItemStack[] equipment = new ItemStack[5]; + + /** Chances for each equipment piece from dropping when this entity dies. */ + protected float[] equipmentDropChances = new float[5]; + + /** Whether this entity can pick up items from the ground. */ + private boolean canPickUpLoot; + + /** Whether this entity should NOT despawn. */ + private boolean persistenceRequired; + private boolean isLeashed; + private Entity leashedToEntity; + private NBTTagCompound leashNBTTag; + private static final String __OBFID = "CL_00001550"; + public int randomMobsId = 0; + public BiomeGenBase spawnBiome = null; + public BlockPos spawnPosition = null; + + public EntityLiving(World worldIn) + { + super(worldIn); + this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null); + this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null); + this.lookHelper = new EntityLookHelper(this); + this.moveHelper = new EntityMoveHelper(this); + this.jumpHelper = new EntityJumpHelper(this); + this.bodyHelper = new EntityBodyHelper(this); + this.navigator = this.getNewNavigator(worldIn); + this.senses = new EntitySenses(this); + + for (int i = 0; i < this.equipmentDropChances.length; ++i) + { + this.equipmentDropChances[i] = 0.085F; + } + + UUID uuid = this.getUniqueID(); + long j = uuid.getLeastSignificantBits(); + this.randomMobsId = (int)(j & 2147483647L); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.followRange).setBaseValue(16.0D); + } + + /** + * Returns new PathNavigateGround instance + */ + protected PathNavigate getNewNavigator(World worldIn) + { + return new PathNavigateGround(this, worldIn); + } + + public EntityLookHelper getLookHelper() + { + return this.lookHelper; + } + + public EntityMoveHelper getMoveHelper() + { + return this.moveHelper; + } + + public EntityJumpHelper getJumpHelper() + { + return this.jumpHelper; + } + + public PathNavigate getNavigator() + { + return this.navigator; + } + + /** + * returns the EntitySenses Object for the EntityLiving + */ + public EntitySenses getEntitySenses() + { + return this.senses; + } + + /** + * Gets the active target the Task system uses for tracking + */ + public EntityLivingBase getAttackTarget() + { + return this.attackTarget; + } + + /** + * Sets the active target the Task system uses for tracking + */ + public void setAttackTarget(EntityLivingBase entitylivingbaseIn) + { + this.attackTarget = entitylivingbaseIn; + Reflector.callVoid(Reflector.ForgeHooks_onLivingSetAttackTarget, new Object[] {this, entitylivingbaseIn}); + } + + /** + * Returns true if this entity can attack entities of the specified class. + */ + public boolean canAttackClass(Class cls) + { + return cls != EntityGhast.class; + } + + /** + * This function applies the benefits of growing back wool and faster growing up to the acting entity. (This + * function is used in the AIEatGrass) + */ + public void eatGrassBonus() + { + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(15, Byte.valueOf((byte)0)); + } + + /** + * Get number of ticks, at least during which the living entity will be silent. + */ + public int getTalkInterval() + { + return 80; + } + + /** + * Plays living's sound at its position + */ + public void playLivingSound() + { + String s = this.getLivingSound(); + + if (s != null) + { + this.playSound(s, this.getSoundVolume(), this.getSoundPitch()); + } + } + + /** + * Gets called every tick from main Entity class + */ + public void onEntityUpdate() + { + super.onEntityUpdate(); + this.worldObj.theProfiler.startSection("mobBaseTick"); + + if (this.isEntityAlive() && this.rand.nextInt(1000) < this.livingSoundTime++) + { + this.livingSoundTime = -this.getTalkInterval(); + this.playLivingSound(); + } + + this.worldObj.theProfiler.endSection(); + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer player) + { + if (this.experienceValue > 0) + { + int i = this.experienceValue; + ItemStack[] aitemstack = this.getInventory(); + + for (int j = 0; j < aitemstack.length; ++j) + { + if (aitemstack[j] != null && this.equipmentDropChances[j] <= 1.0F) + { + i += 1 + this.rand.nextInt(3); + } + } + + return i; + } + else + { + return this.experienceValue; + } + } + + /** + * Spawns an explosion particle around the Entity's location + */ + public void spawnExplosionParticle() + { + if (this.worldObj.isRemote) + { + for (int i = 0; i < 20; ++i) + { + double d0 = this.rand.nextGaussian() * 0.02D; + double d1 = this.rand.nextGaussian() * 0.02D; + double d2 = this.rand.nextGaussian() * 0.02D; + double d3 = 10.0D; + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - d0 * d3, this.posY + (double)(this.rand.nextFloat() * this.height) - d1 * d3, this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - d2 * d3, d0, d1, d2, new int[0]); + } + } + else + { + this.worldObj.setEntityState(this, (byte)20); + } + } + + public void handleStatusUpdate(byte id) + { + if (id == 20) + { + this.spawnExplosionParticle(); + } + else + { + super.handleStatusUpdate(id); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (Config.isSmoothWorld() && this.canSkipUpdate()) + { + this.onUpdateMinimal(); + } + else + { + super.onUpdate(); + + if (!this.worldObj.isRemote) + { + this.updateLeashedState(); + } + } + } + + protected float func_110146_f(float p_110146_1_, float p_110146_2_) + { + this.bodyHelper.updateRenderAngles(); + return p_110146_2_; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return null; + } + + protected Item getDropItem() + { + return null; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + Item item = this.getDropItem(); + + if (item != null) + { + int i = this.rand.nextInt(3); + + if (p_70628_2_ > 0) + { + i += this.rand.nextInt(p_70628_2_ + 1); + } + + for (int j = 0; j < i; ++j) + { + this.dropItem(item, 1); + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setBoolean("CanPickUpLoot", this.canPickUpLoot()); + tagCompound.setBoolean("PersistenceRequired", this.persistenceRequired); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.equipment.length; ++i) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + if (this.equipment[i] != null) + { + this.equipment[i].writeToNBT(nbttagcompound); + } + + nbttaglist.appendTag(nbttagcompound); + } + + tagCompound.setTag("Equipment", nbttaglist); + NBTTagList nbttaglist1 = new NBTTagList(); + + for (int j = 0; j < this.equipmentDropChances.length; ++j) + { + nbttaglist1.appendTag(new NBTTagFloat(this.equipmentDropChances[j])); + } + + tagCompound.setTag("DropChances", nbttaglist1); + tagCompound.setBoolean("Leashed", this.isLeashed); + + if (this.leashedToEntity != null) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + + if (this.leashedToEntity instanceof EntityLivingBase) + { + nbttagcompound1.setLong("UUIDMost", this.leashedToEntity.getUniqueID().getMostSignificantBits()); + nbttagcompound1.setLong("UUIDLeast", this.leashedToEntity.getUniqueID().getLeastSignificantBits()); + } + else if (this.leashedToEntity instanceof EntityHanging) + { + BlockPos blockpos = ((EntityHanging)this.leashedToEntity).getHangingPosition(); + nbttagcompound1.setInteger("X", blockpos.getX()); + nbttagcompound1.setInteger("Y", blockpos.getY()); + nbttagcompound1.setInteger("Z", blockpos.getZ()); + } + + tagCompound.setTag("Leash", nbttagcompound1); + } + + if (this.isAIDisabled()) + { + tagCompound.setBoolean("NoAI", this.isAIDisabled()); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + + if (tagCompund.hasKey("CanPickUpLoot", 1)) + { + this.setCanPickUpLoot(tagCompund.getBoolean("CanPickUpLoot")); + } + + this.persistenceRequired = tagCompund.getBoolean("PersistenceRequired"); + + if (tagCompund.hasKey("Equipment", 9)) + { + NBTTagList nbttaglist = tagCompund.getTagList("Equipment", 10); + + for (int i = 0; i < this.equipment.length; ++i) + { + this.equipment[i] = ItemStack.loadItemStackFromNBT(nbttaglist.getCompoundTagAt(i)); + } + } + + if (tagCompund.hasKey("DropChances", 9)) + { + NBTTagList nbttaglist1 = tagCompund.getTagList("DropChances", 5); + + for (int j = 0; j < nbttaglist1.tagCount(); ++j) + { + this.equipmentDropChances[j] = nbttaglist1.getFloatAt(j); + } + } + + this.isLeashed = tagCompund.getBoolean("Leashed"); + + if (this.isLeashed && tagCompund.hasKey("Leash", 10)) + { + this.leashNBTTag = tagCompund.getCompoundTag("Leash"); + } + + this.setNoAI(tagCompund.getBoolean("NoAI")); + } + + public void setMoveForward(float p_70657_1_) + { + this.moveForward = p_70657_1_; + } + + /** + * set the movespeed used for the new AI system + */ + public void setAIMoveSpeed(float speedIn) + { + super.setAIMoveSpeed(speedIn); + this.setMoveForward(speedIn); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + this.worldObj.theProfiler.startSection("looting"); + + if (!this.worldObj.isRemote && this.canPickUpLoot() && !this.dead && this.worldObj.getGameRules().getBoolean("mobGriefing")) + { + for (EntityItem entityitem : this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.getEntityBoundingBox().expand(1.0D, 0.0D, 1.0D))) + { + if (!entityitem.isDead && entityitem.getEntityItem() != null && !entityitem.cannotPickup()) + { + this.updateEquipmentIfNeeded(entityitem); + } + } + } + + this.worldObj.theProfiler.endSection(); + } + + /** + * Tests if this entity should pickup a weapon or an armor. Entity drops current weapon or armor if the new one is + * better. + */ + protected void updateEquipmentIfNeeded(EntityItem itemEntity) + { + ItemStack itemstack = itemEntity.getEntityItem(); + int i = getArmorPosition(itemstack); + + if (i > -1) + { + boolean flag = true; + ItemStack itemstack1 = this.getEquipmentInSlot(i); + + if (itemstack1 != null) + { + if (i == 0) + { + if (itemstack.getItem() instanceof ItemSword && !(itemstack1.getItem() instanceof ItemSword)) + { + flag = true; + } + else if (itemstack.getItem() instanceof ItemSword && itemstack1.getItem() instanceof ItemSword) + { + ItemSword itemsword = (ItemSword)itemstack.getItem(); + ItemSword itemsword1 = (ItemSword)itemstack1.getItem(); + + if (itemsword.getDamageVsEntity() != itemsword1.getDamageVsEntity()) + { + flag = itemsword.getDamageVsEntity() > itemsword1.getDamageVsEntity(); + } + else + { + flag = itemstack.getMetadata() > itemstack1.getMetadata() || itemstack.hasTagCompound() && !itemstack1.hasTagCompound(); + } + } + else if (itemstack.getItem() instanceof ItemBow && itemstack1.getItem() instanceof ItemBow) + { + flag = itemstack.hasTagCompound() && !itemstack1.hasTagCompound(); + } + else + { + flag = false; + } + } + else if (itemstack.getItem() instanceof ItemArmor && !(itemstack1.getItem() instanceof ItemArmor)) + { + flag = true; + } + else if (itemstack.getItem() instanceof ItemArmor && itemstack1.getItem() instanceof ItemArmor) + { + ItemArmor itemarmor = (ItemArmor)itemstack.getItem(); + ItemArmor itemarmor1 = (ItemArmor)itemstack1.getItem(); + + if (itemarmor.damageReduceAmount != itemarmor1.damageReduceAmount) + { + flag = itemarmor.damageReduceAmount > itemarmor1.damageReduceAmount; + } + else + { + flag = itemstack.getMetadata() > itemstack1.getMetadata() || itemstack.hasTagCompound() && !itemstack1.hasTagCompound(); + } + } + else + { + flag = false; + } + } + + if (flag && this.func_175448_a(itemstack)) + { + if (itemstack1 != null && this.rand.nextFloat() - 0.1F < this.equipmentDropChances[i]) + { + this.entityDropItem(itemstack1, 0.0F); + } + + if (itemstack.getItem() == Items.diamond && itemEntity.getThrower() != null) + { + EntityPlayer entityplayer = this.worldObj.getPlayerEntityByName(itemEntity.getThrower()); + + if (entityplayer != null) + { + entityplayer.triggerAchievement(AchievementList.diamondsToYou); + } + } + + this.setCurrentItemOrArmor(i, itemstack); + this.equipmentDropChances[i] = 2.0F; + this.persistenceRequired = true; + this.onItemPickup(itemEntity, 1); + itemEntity.setDead(); + } + } + } + + protected boolean func_175448_a(ItemStack stack) + { + return true; + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return true; + } + + /** + * Makes the entity despawn if requirements are reached + */ + protected void despawnEntity() + { + Object object = null; + Object object1 = Reflector.getFieldValue(Reflector.Event_Result_DEFAULT); + Object object2 = Reflector.getFieldValue(Reflector.Event_Result_DENY); + + if (this.persistenceRequired) + { + this.entityAge = 0; + } + else if ((this.entityAge & 31) == 31 && (object = Reflector.call(Reflector.ForgeEventFactory_canEntityDespawn, new Object[] {this})) != object1) + { + if (object == object2) + { + this.entityAge = 0; + } + else + { + this.setDead(); + } + } + else + { + EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, -1.0D); + + if (entityplayer != null) + { + double d0 = entityplayer.posX - this.posX; + double d1 = entityplayer.posY - this.posY; + double d2 = entityplayer.posZ - this.posZ; + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + + if (this.canDespawn() && d3 > 16384.0D) + { + this.setDead(); + } + + if (this.entityAge > 600 && this.rand.nextInt(800) == 0 && d3 > 1024.0D && this.canDespawn()) + { + this.setDead(); + } + else if (d3 < 1024.0D) + { + this.entityAge = 0; + } + } + } + } + + protected final void updateEntityActionState() + { + ++this.entityAge; + this.worldObj.theProfiler.startSection("checkDespawn"); + this.despawnEntity(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("sensing"); + this.senses.clearSensingCache(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("targetSelector"); + this.targetTasks.onUpdateTasks(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("goalSelector"); + this.tasks.onUpdateTasks(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("navigation"); + this.navigator.onUpdateNavigation(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("mob tick"); + this.updateAITasks(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("controls"); + this.worldObj.theProfiler.startSection("move"); + this.moveHelper.onUpdateMoveHelper(); + this.worldObj.theProfiler.endStartSection("look"); + this.lookHelper.onUpdateLook(); + this.worldObj.theProfiler.endStartSection("jump"); + this.jumpHelper.doJump(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.endSection(); + } + + protected void updateAITasks() + { + } + + /** + * The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently + * use in wolves. + */ + public int getVerticalFaceSpeed() + { + return 40; + } + + /** + * Changes pitch and yaw so that the entity calling the function is facing the entity provided as an argument. + */ + public void faceEntity(Entity entityIn, float p_70625_2_, float p_70625_3_) + { + double d0 = entityIn.posX - this.posX; + double d1 = entityIn.posZ - this.posZ; + double d2; + + if (entityIn instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)entityIn; + d2 = entitylivingbase.posY + (double)entitylivingbase.getEyeHeight() - (this.posY + (double)this.getEyeHeight()); + } + else + { + d2 = (entityIn.getEntityBoundingBox().minY + entityIn.getEntityBoundingBox().maxY) / 2.0D - (this.posY + (double)this.getEyeHeight()); + } + + double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d1 * d1); + float f = (float)(MathHelper.func_181159_b(d1, d0) * 180.0D / Math.PI) - 90.0F; + float f1 = (float)(-(MathHelper.func_181159_b(d2, d3) * 180.0D / Math.PI)); + this.rotationPitch = this.updateRotation(this.rotationPitch, f1, p_70625_3_); + this.rotationYaw = this.updateRotation(this.rotationYaw, f, p_70625_2_); + } + + /** + * Arguments: current rotation, intended rotation, max increment. + */ + private float updateRotation(float p_70663_1_, float p_70663_2_, float p_70663_3_) + { + float f = MathHelper.wrapAngleTo180_float(p_70663_2_ - p_70663_1_); + + if (f > p_70663_3_) + { + f = p_70663_3_; + } + + if (f < -p_70663_3_) + { + f = -p_70663_3_; + } + + return p_70663_1_ + f; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return true; + } + + /** + * Checks that the entity is not colliding with any blocks / liquids + */ + public boolean isNotColliding() + { + return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()); + } + + /** + * Returns render size modifier + */ + public float getRenderSizeModifier() + { + return 1.0F; + } + + /** + * Will return how many at most can spawn in a chunk at once. + */ + public int getMaxSpawnedInChunk() + { + return 4; + } + + /** + * The maximum height from where the entity is alowed to jump (used in pathfinder) + */ + public int getMaxFallHeight() + { + if (this.getAttackTarget() == null) + { + return 3; + } + else + { + int i = (int)(this.getHealth() - this.getMaxHealth() * 0.33F); + i = i - (3 - this.worldObj.getDifficulty().getDifficultyId()) * 4; + + if (i < 0) + { + i = 0; + } + + return i + 3; + } + } + + /** + * Returns the item that this EntityLiving is holding, if any. + */ + public ItemStack getHeldItem() + { + return this.equipment[0]; + } + + /** + * 0: Tool in Hand; 1-4: Armor + */ + public ItemStack getEquipmentInSlot(int slotIn) + { + return this.equipment[slotIn]; + } + + public ItemStack getCurrentArmor(int slotIn) + { + return this.equipment[slotIn + 1]; + } + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public void setCurrentItemOrArmor(int slotIn, ItemStack stack) + { + this.equipment[slotIn] = stack; + } + + /** + * returns the inventory of this entity (only used in EntityPlayerMP it seems) + */ + public ItemStack[] getInventory() + { + return this.equipment; + } + + /** + * Drop the equipment for this entity. + */ + protected void dropEquipment(boolean p_82160_1_, int p_82160_2_) + { + for (int i = 0; i < this.getInventory().length; ++i) + { + ItemStack itemstack = this.getEquipmentInSlot(i); + boolean flag = this.equipmentDropChances[i] > 1.0F; + + if (itemstack != null && (p_82160_1_ || flag) && this.rand.nextFloat() - (float)p_82160_2_ * 0.01F < this.equipmentDropChances[i]) + { + if (!flag && itemstack.isItemStackDamageable()) + { + int j = Math.max(itemstack.getMaxDamage() - 25, 1); + int k = itemstack.getMaxDamage() - this.rand.nextInt(this.rand.nextInt(j) + 1); + + if (k > j) + { + k = j; + } + + if (k < 1) + { + k = 1; + } + + itemstack.setItemDamage(k); + } + + this.entityDropItem(itemstack, 0.0F); + } + } + } + + /** + * Gives armor or weapon for entity based on given DifficultyInstance + */ + protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) + { + if (this.rand.nextFloat() < 0.15F * difficulty.getClampedAdditionalDifficulty()) + { + int i = this.rand.nextInt(2); + float f = this.worldObj.getDifficulty() == EnumDifficulty.HARD ? 0.1F : 0.25F; + + if (this.rand.nextFloat() < 0.095F) + { + ++i; + } + + if (this.rand.nextFloat() < 0.095F) + { + ++i; + } + + if (this.rand.nextFloat() < 0.095F) + { + ++i; + } + + for (int j = 3; j >= 0; --j) + { + ItemStack itemstack = this.getCurrentArmor(j); + + if (j < 3 && this.rand.nextFloat() < f) + { + break; + } + + if (itemstack == null) + { + Item item = getArmorItemForSlot(j + 1, i); + + if (item != null) + { + this.setCurrentItemOrArmor(j + 1, new ItemStack(item)); + } + } + } + } + } + + public static int getArmorPosition(ItemStack stack) + { + if (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull) + { + if (stack.getItem() instanceof ItemArmor) + { + switch (((ItemArmor)stack.getItem()).armorType) + { + case 0: + return 4; + + case 1: + return 3; + + case 2: + return 2; + + case 3: + return 1; + } + } + + return 0; + } + else + { + return 4; + } + } + + /** + * Gets the vanilla armor Item that can go in the slot specified for the given tier. + */ + public static Item getArmorItemForSlot(int armorSlot, int itemTier) + { + switch (armorSlot) + { + case 4: + if (itemTier == 0) + { + return Items.leather_helmet; + } + else if (itemTier == 1) + { + return Items.golden_helmet; + } + else if (itemTier == 2) + { + return Items.chainmail_helmet; + } + else if (itemTier == 3) + { + return Items.iron_helmet; + } + else if (itemTier == 4) + { + return Items.diamond_helmet; + } + + case 3: + if (itemTier == 0) + { + return Items.leather_chestplate; + } + else if (itemTier == 1) + { + return Items.golden_chestplate; + } + else if (itemTier == 2) + { + return Items.chainmail_chestplate; + } + else if (itemTier == 3) + { + return Items.iron_chestplate; + } + else if (itemTier == 4) + { + return Items.diamond_chestplate; + } + + case 2: + if (itemTier == 0) + { + return Items.leather_leggings; + } + else if (itemTier == 1) + { + return Items.golden_leggings; + } + else if (itemTier == 2) + { + return Items.chainmail_leggings; + } + else if (itemTier == 3) + { + return Items.iron_leggings; + } + else if (itemTier == 4) + { + return Items.diamond_leggings; + } + + case 1: + if (itemTier == 0) + { + return Items.leather_boots; + } + else if (itemTier == 1) + { + return Items.golden_boots; + } + else if (itemTier == 2) + { + return Items.chainmail_boots; + } + else if (itemTier == 3) + { + return Items.iron_boots; + } + else if (itemTier == 4) + { + return Items.diamond_boots; + } + + default: + return null; + } + } + + /** + * Enchants Entity's current equipments based on given DifficultyInstance + */ + protected void setEnchantmentBasedOnDifficulty(DifficultyInstance difficulty) + { + float f = difficulty.getClampedAdditionalDifficulty(); + + if (this.getHeldItem() != null && this.rand.nextFloat() < 0.25F * f) + { + EnchantmentHelper.addRandomEnchantment(this.rand, this.getHeldItem(), (int)(5.0F + f * (float)this.rand.nextInt(18))); + } + + for (int i = 0; i < 4; ++i) + { + ItemStack itemstack = this.getCurrentArmor(i); + + if (itemstack != null && this.rand.nextFloat() < 0.5F * f) + { + EnchantmentHelper.addRandomEnchantment(this.rand, itemstack, (int)(5.0F + f * (float)this.rand.nextInt(18))); + } + } + } + + /** + * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called + * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory + */ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + this.getEntityAttribute(SharedMonsterAttributes.followRange).applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, 1)); + return livingdata; + } + + /** + * returns true if all the conditions for steering the entity are met. For pigs, this is true if it is being ridden + * by a player and the player is holding a carrot-on-a-stick + */ + public boolean canBeSteered() + { + return false; + } + + /** + * Enable the Entity persistence + */ + public void enablePersistence() + { + this.persistenceRequired = true; + } + + public void setEquipmentDropChance(int slotIn, float chance) + { + this.equipmentDropChances[slotIn] = chance; + } + + public boolean canPickUpLoot() + { + return this.canPickUpLoot; + } + + public void setCanPickUpLoot(boolean canPickup) + { + this.canPickUpLoot = canPickup; + } + + public boolean isNoDespawnRequired() + { + return this.persistenceRequired; + } + + /** + * First layer of player interaction + */ + public final boolean interactFirst(EntityPlayer playerIn) + { + if (this.getLeashed() && this.getLeashedToEntity() == playerIn) + { + this.clearLeashed(true, !playerIn.capabilities.isCreativeMode); + return true; + } + else + { + ItemStack itemstack = playerIn.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.lead && this.allowLeashing()) + { + if (!(this instanceof EntityTameable) || !((EntityTameable)this).isTamed()) + { + this.setLeashedToEntity(playerIn, true); + --itemstack.stackSize; + return true; + } + + if (((EntityTameable)this).isOwner(playerIn)) + { + this.setLeashedToEntity(playerIn, true); + --itemstack.stackSize; + return true; + } + } + + return this.interact(playerIn) ? true : super.interactFirst(playerIn); + } + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + protected boolean interact(EntityPlayer player) + { + return false; + } + + /** + * Applies logic related to leashes, for example dragging the entity or breaking the leash. + */ + protected void updateLeashedState() + { + if (this.leashNBTTag != null) + { + this.recreateLeash(); + } + + if (this.isLeashed) + { + if (!this.isEntityAlive()) + { + this.clearLeashed(true, true); + } + + if (this.leashedToEntity == null || this.leashedToEntity.isDead) + { + this.clearLeashed(true, true); + } + } + } + + /** + * Removes the leash from this entity + */ + public void clearLeashed(boolean sendPacket, boolean dropLead) + { + if (this.isLeashed) + { + this.isLeashed = false; + this.leashedToEntity = null; + + if (!this.worldObj.isRemote && dropLead) + { + this.dropItem(Items.lead, 1); + } + + if (!this.worldObj.isRemote && sendPacket && this.worldObj instanceof WorldServer) + { + ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new S1BPacketEntityAttach(1, this, (Entity)null)); + } + } + } + + public boolean allowLeashing() + { + return !this.getLeashed() && !(this instanceof IMob); + } + + public boolean getLeashed() + { + return this.isLeashed; + } + + public Entity getLeashedToEntity() + { + return this.leashedToEntity; + } + + /** + * Sets the entity to be leashed to. + */ + public void setLeashedToEntity(Entity entityIn, boolean sendAttachNotification) + { + this.isLeashed = true; + this.leashedToEntity = entityIn; + + if (!this.worldObj.isRemote && sendAttachNotification && this.worldObj instanceof WorldServer) + { + ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new S1BPacketEntityAttach(1, this, this.leashedToEntity)); + } + } + + private void recreateLeash() + { + if (this.isLeashed && this.leashNBTTag != null) + { + if (this.leashNBTTag.hasKey("UUIDMost", 4) && this.leashNBTTag.hasKey("UUIDLeast", 4)) + { + UUID uuid = new UUID(this.leashNBTTag.getLong("UUIDMost"), this.leashNBTTag.getLong("UUIDLeast")); + + for (EntityLivingBase entitylivingbase : this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.getEntityBoundingBox().expand(10.0D, 10.0D, 10.0D))) + { + if (entitylivingbase.getUniqueID().equals(uuid)) + { + this.leashedToEntity = entitylivingbase; + break; + } + } + } + else if (this.leashNBTTag.hasKey("X", 99) && this.leashNBTTag.hasKey("Y", 99) && this.leashNBTTag.hasKey("Z", 99)) + { + BlockPos blockpos = new BlockPos(this.leashNBTTag.getInteger("X"), this.leashNBTTag.getInteger("Y"), this.leashNBTTag.getInteger("Z")); + EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForPosition(this.worldObj, blockpos); + + if (entityleashknot == null) + { + entityleashknot = EntityLeashKnot.createKnot(this.worldObj, blockpos); + } + + this.leashedToEntity = entityleashknot; + } + else + { + this.clearLeashed(false, true); + } + } + + this.leashNBTTag = null; + } + + public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn) + { + int i; + + if (inventorySlot == 99) + { + i = 0; + } + else + { + i = inventorySlot - 100 + 1; + + if (i < 0 || i >= this.equipment.length) + { + return false; + } + } + + if (itemStackIn == null || getArmorPosition(itemStackIn) == i || i == 4 && itemStackIn.getItem() instanceof ItemBlock) + { + this.setCurrentItemOrArmor(i, itemStackIn); + return true; + } + else + { + return false; + } + } + + /** + * Returns whether the entity is in a server world + */ + public boolean isServerWorld() + { + return super.isServerWorld() && !this.isAIDisabled(); + } + + /** + * Set whether this Entity's AI is disabled + */ + public void setNoAI(boolean disable) + { + this.dataWatcher.updateObject(15, Byte.valueOf((byte)(disable ? 1 : 0))); + } + + /** + * Get whether this Entity's AI is disabled + */ + public boolean isAIDisabled() + { + return this.dataWatcher.getWatchableObjectByte(15) != 0; + } + + /** + * Checks if this entity is inside of an opaque block + */ + public boolean isEntityInsideOpaqueBlock() + { + if (this.noClip) + { + return false; + } + else + { + BlockPosM blockposm = new BlockPosM(0, 0, 0); + + for (int i = 0; i < 8; ++i) + { + double d0 = this.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * this.width * 0.8F); + double d1 = this.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F); + double d2 = this.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * this.width * 0.8F); + blockposm.setXyz(d0, d1 + (double)this.getEyeHeight(), d2); + + if (this.worldObj.getBlockState(blockposm).getBlock().isVisuallyOpaque()) + { + return true; + } + } + + return false; + } + } + + private boolean canSkipUpdate() + { + if (this.isChild()) + { + return false; + } + else if (this.hurtTime > 0) + { + return false; + } + else if (this.ticksExisted < 20) + { + return false; + } + else + { + World world = this.getEntityWorld(); + + if (world == null) + { + return false; + } + else if (world.playerEntities.size() != 1) + { + return false; + } + else + { + Entity entity = (Entity)world.playerEntities.get(0); + double d0 = Math.max(Math.abs(this.posX - entity.posX) - 16.0D, 0.0D); + double d1 = Math.max(Math.abs(this.posZ - entity.posZ) - 16.0D, 0.0D); + double d2 = d0 * d0 + d1 * d1; + return !this.isInRangeToRenderDist(d2); + } + } + } + + private void onUpdateMinimal() + { + ++this.entityAge; + + if (this instanceof EntityMob) + { + float f = this.getBrightness(1.0F); + + if (f > 0.5F) + { + this.entityAge += 2; + } + } + + this.despawnEntity(); + } + + public static enum SpawnPlacementType + { + ON_GROUND("ON_GROUND", 0), + IN_AIR("IN_AIR", 1), + IN_WATER("IN_WATER", 2); + + private static final EntityLiving.SpawnPlacementType[] $VALUES = new EntityLiving.SpawnPlacementType[]{ON_GROUND, IN_AIR, IN_WATER}; + private static final String __OBFID = "CL_00002255"; + + private SpawnPlacementType(String p_i18_3_, int p_i18_4_) + { + } + } +} diff --git a/src/minecraft/net/minecraft/entity/EntityLivingBase.java b/src/minecraft/net/minecraft/entity/EntityLivingBase.java new file mode 100644 index 0000000..f4a1155 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntityLivingBase.java @@ -0,0 +1,2290 @@ +package net.minecraft.entity; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.common.collect.Maps; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.BaseAttributeMap; +import net.minecraft.entity.ai.attributes.IAttribute; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.ai.attributes.ServersideAttributeMap; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagFloat; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagShort; +import net.minecraft.network.play.server.S04PacketEntityEquipment; +import net.minecraft.network.play.server.S0BPacketAnimation; +import net.minecraft.network.play.server.S0DPacketCollectItem; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.potion.PotionHelper; +import net.minecraft.scoreboard.Team; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.CombatTracker; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public abstract class EntityLivingBase extends Entity +{ + private static final UUID sprintingSpeedBoostModifierUUID = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); + private static final AttributeModifier sprintingSpeedBoostModifier = (new AttributeModifier(sprintingSpeedBoostModifierUUID, "Sprinting speed boost", 0.30000001192092896D, 2)).setSaved(false); + private BaseAttributeMap attributeMap; + private final CombatTracker _combatTracker = new CombatTracker(this); + private final Map activePotionsMap = Maps.newHashMap(); + + /** The equipment this mob was previously wearing, used for syncing. */ + private final ItemStack[] previousEquipment = new ItemStack[5]; + + /** Whether an arm swing is currently in progress. */ + public boolean isSwingInProgress; + public int swingProgressInt; + public int arrowHitTimer; + + /** + * The amount of time remaining this entity should act 'hurt'. (Visual appearance of red tint) + */ + public int hurtTime; + + /** What the hurt time was max set to last. */ + public int maxHurtTime; + + /** The yaw at which this entity was last attacked from. */ + public float attackedAtYaw; + + /** + * The amount of time remaining this entity should act 'dead', i.e. have a corpse in the world. + */ + public int deathTime; + public float prevSwingProgress; + public float swingProgress; + public float prevLimbSwingAmount; + public float limbSwingAmount; + + /** + * Only relevant when limbYaw is not 0(the entity is moving). Influences where in its swing legs and arms currently + * are. + */ + public float limbSwing; + public int maxHurtResistantTime = 20; + public float prevCameraPitch; + public float cameraPitch; + public float field_70769_ao; + public float field_70770_ap; + public float renderYawOffset; + public float prevRenderYawOffset; + + /** Entity head rotation yaw */ + public float rotationYawHead; + + /** Entity head rotation yaw at previous tick */ + public float prevRotationYawHead; + + /** + * A factor used to determine how far this entity will move each tick if it is jumping or falling. + */ + public float jumpMovementFactor = 0.02F; + + /** The most recent player that has attacked this entity */ + protected EntityPlayer attackingPlayer; + + /** + * Set to 60 when hit by the player or the player's wolf, then decrements. Used to determine whether the entity + * should drop items on death. + */ + protected int recentlyHit; + + /** + * This gets set on entity death, but never used. Looks like a duplicate of isDead + */ + protected boolean dead; + + /** The age of this EntityLiving (used to determine when it dies) */ + protected int entityAge; + protected float prevOnGroundSpeedFactor; + protected float onGroundSpeedFactor; + protected float movedDistance; + protected float prevMovedDistance; + protected float field_70741_aB; + + /** The score value of the Mob, the amount of points the mob is worth. */ + protected int scoreValue; + + /** + * Damage taken in the last hit. Mobs are resistant to damage less than this for a short time after taking damage. + */ + protected float lastDamage; + + /** used to check whether entity is jumping. */ + protected boolean isJumping; + public float moveStrafing; + public float moveForward; + protected float randomYawVelocity; + + /** + * The number of updates over which the new position and rotation are to be applied to the entity. + */ + protected int newPosRotationIncrements; + + /** The new X position to be applied to the entity. */ + protected double newPosX; + + /** The new Y position to be applied to the entity. */ + protected double newPosY; + protected double newPosZ; + + /** The new yaw rotation to be applied to the entity. */ + protected double newRotationYaw; + + /** The new yaw rotation to be applied to the entity. */ + protected double newRotationPitch; + + /** Whether the DataWatcher needs to be updated with the active potions */ + private boolean potionsNeedUpdate = true; + + /** is only being set, has no uses as of MC 1.1 */ + private EntityLivingBase entityLivingToAttack; + private int revengeTimer; + private EntityLivingBase lastAttacker; + + /** Holds the value of ticksExisted when setLastAttacker was last called. */ + private int lastAttackerTime; + + /** + * A factor used to determine how far this entity will move each tick if it is walking on land. Adjusted by speed, + * and slipperiness of the current block. + */ + private float landMovementFactor; + + /** Number of ticks since last jump */ + private int jumpTicks; + private float absorptionAmount; + + /** + * Called by the /kill command. + */ + public void onKillCommand() + { + this.attackEntityFrom(DamageSource.outOfWorld, Float.MAX_VALUE); + } + + public EntityLivingBase(World worldIn) + { + super(worldIn); + this.applyEntityAttributes(); + this.setHealth(this.getMaxHealth()); + this.preventEntitySpawning = true; + this.field_70770_ap = (float)((Math.random() + 1.0D) * 0.009999999776482582D); + this.setPosition(this.posX, this.posY, this.posZ); + this.field_70769_ao = (float)Math.random() * 12398.0F; + this.rotationYaw = (float)(Math.random() * Math.PI * 2.0D); + this.rotationYawHead = this.rotationYaw; + this.stepHeight = 0.6F; + } + + protected void entityInit() + { + this.dataWatcher.addObject(7, Integer.valueOf(0)); + this.dataWatcher.addObject(8, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(9, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(6, Float.valueOf(1.0F)); + } + + protected void applyEntityAttributes() + { + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.maxHealth); + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.knockbackResistance); + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.movementSpeed); + } + + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) + { + if (!this.isInWater()) + { + this.handleWaterMovement(); + } + + if (!this.worldObj.isRemote && this.fallDistance > 3.0F && onGroundIn) + { + IBlockState iblockstate = this.worldObj.getBlockState(pos); + Block block = iblockstate.getBlock(); + float f = (float)MathHelper.ceiling_float_int(this.fallDistance - 3.0F); + + if (block.getMaterial() != Material.air) + { + double d0 = (double)Math.min(0.2F + f / 15.0F, 10.0F); + + if (d0 > 2.5D) + { + d0 = 2.5D; + } + + int i = (int)(150.0D * d0); + ((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX, this.posY, this.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.getStateId(iblockstate)}); + } + } + + super.updateFallState(y, onGroundIn, blockIn, pos); + } + + public boolean canBreatheUnderwater() + { + return false; + } + + /** + * Gets called every tick from main Entity class + */ + public void onEntityUpdate() + { + this.prevSwingProgress = this.swingProgress; + super.onEntityUpdate(); + this.worldObj.theProfiler.startSection("livingEntityBaseTick"); + boolean flag = this instanceof EntityPlayer; + + if (this.isEntityAlive()) + { + if (this.isEntityInsideOpaqueBlock()) + { + this.attackEntityFrom(DamageSource.inWall, 1.0F); + } + else if (flag && !this.worldObj.getWorldBorder().contains(this.getEntityBoundingBox())) + { + double d0 = this.worldObj.getWorldBorder().getClosestDistance(this) + this.worldObj.getWorldBorder().getDamageBuffer(); + + if (d0 < 0.0D) + { + this.attackEntityFrom(DamageSource.inWall, (float)Math.max(1, MathHelper.floor_double(-d0 * this.worldObj.getWorldBorder().getDamageAmount()))); + } + } + } + + if (this.isImmuneToFire() || this.worldObj.isRemote) + { + this.extinguish(); + } + + boolean flag1 = flag && ((EntityPlayer)this).capabilities.disableDamage; + + if (this.isEntityAlive()) + { + if (this.isInsideOfMaterial(Material.water)) + { + if (!this.canBreatheUnderwater() && !this.isPotionActive(Potion.waterBreathing.id) && !flag1) + { + this.setAir(this.decreaseAirSupply(this.getAir())); + + if (this.getAir() == -20) + { + this.setAir(0); + + for (int i = 0; i < 8; ++i) + { + float f = this.rand.nextFloat() - this.rand.nextFloat(); + float f1 = this.rand.nextFloat() - this.rand.nextFloat(); + float f2 = this.rand.nextFloat() - this.rand.nextFloat(); + this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX + (double)f, this.posY + (double)f1, this.posZ + (double)f2, this.motionX, this.motionY, this.motionZ, new int[0]); + } + + this.attackEntityFrom(DamageSource.drown, 2.0F); + } + } + + if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) + { + this.mountEntity((Entity)null); + } + } + else + { + this.setAir(300); + } + } + + if (this.isEntityAlive() && this.isWet()) + { + this.extinguish(); + } + + this.prevCameraPitch = this.cameraPitch; + + if (this.hurtTime > 0) + { + --this.hurtTime; + } + + if (this.hurtResistantTime > 0 && !(this instanceof EntityPlayerMP)) + { + --this.hurtResistantTime; + } + + if (this.getHealth() <= 0.0F) + { + this.onDeathUpdate(); + } + + if (this.recentlyHit > 0) + { + --this.recentlyHit; + } + else + { + this.attackingPlayer = null; + } + + if (this.lastAttacker != null && !this.lastAttacker.isEntityAlive()) + { + this.lastAttacker = null; + } + + if (this.entityLivingToAttack != null) + { + if (!this.entityLivingToAttack.isEntityAlive()) + { + this.setRevengeTarget((EntityLivingBase)null); + } + else if (this.ticksExisted - this.revengeTimer > 100) + { + this.setRevengeTarget((EntityLivingBase)null); + } + } + + this.updatePotionEffects(); + this.prevMovedDistance = this.movedDistance; + this.prevRenderYawOffset = this.renderYawOffset; + this.prevRotationYawHead = this.rotationYawHead; + this.prevRotationYaw = this.rotationYaw; + this.prevRotationPitch = this.rotationPitch; + this.worldObj.theProfiler.endSection(); + } + + /** + * If Animal, checks if the age timer is negative + */ + public boolean isChild() + { + return false; + } + + /** + * handles entity death timer, experience orb and particle creation + */ + protected void onDeathUpdate() + { + ++this.deathTime; + + if (this.deathTime == 20) + { + if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot")) + { + int i = this.getExperiencePoints(this.attackingPlayer); + + while (i > 0) + { + int j = EntityXPOrb.getXPSplit(i); + i -= j; + this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); + } + } + + this.setDead(); + + for (int k = 0; k < 20; ++k) + { + double d2 = this.rand.nextGaussian() * 0.02D; + double d0 = this.rand.nextGaussian() * 0.02D; + double d1 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d2, d0, d1, new int[0]); + } + } + } + + /** + * Entity won't drop items or experience points if this returns false + */ + protected boolean canDropLoot() + { + return !this.isChild(); + } + + /** + * Decrements the entity's air supply when underwater + */ + protected int decreaseAirSupply(int p_70682_1_) + { + int i = EnchantmentHelper.getRespiration(this); + return i > 0 && this.rand.nextInt(i + 1) > 0 ? p_70682_1_ : p_70682_1_ - 1; + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer player) + { + return 0; + } + + /** + * Only use is to identify if class is an instance of player for experience dropping + */ + protected boolean isPlayer() + { + return false; + } + + public Random getRNG() + { + return this.rand; + } + + public EntityLivingBase getAITarget() + { + return this.entityLivingToAttack; + } + + public int getRevengeTimer() + { + return this.revengeTimer; + } + + public void setRevengeTarget(EntityLivingBase livingBase) + { + this.entityLivingToAttack = livingBase; + this.revengeTimer = this.ticksExisted; + } + + public EntityLivingBase getLastAttacker() + { + return this.lastAttacker; + } + + public int getLastAttackerTime() + { + return this.lastAttackerTime; + } + + public void setLastAttacker(Entity entityIn) + { + if (entityIn instanceof EntityLivingBase) + { + this.lastAttacker = (EntityLivingBase)entityIn; + } + else + { + this.lastAttacker = null; + } + + this.lastAttackerTime = this.ticksExisted; + } + + public int getAge() + { + return this.entityAge; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + tagCompound.setFloat("HealF", this.getHealth()); + tagCompound.setShort("Health", (short)((int)Math.ceil((double)this.getHealth()))); + tagCompound.setShort("HurtTime", (short)this.hurtTime); + tagCompound.setInteger("HurtByTimestamp", this.revengeTimer); + tagCompound.setShort("DeathTime", (short)this.deathTime); + tagCompound.setFloat("AbsorptionAmount", this.getAbsorptionAmount()); + + for (ItemStack itemstack : this.getInventory()) + { + if (itemstack != null) + { + this.attributeMap.removeAttributeModifiers(itemstack.getAttributeModifiers()); + } + } + + tagCompound.setTag("Attributes", SharedMonsterAttributes.writeBaseAttributeMapToNBT(this.getAttributeMap())); + + for (ItemStack itemstack1 : this.getInventory()) + { + if (itemstack1 != null) + { + this.attributeMap.applyAttributeModifiers(itemstack1.getAttributeModifiers()); + } + } + + if (!this.activePotionsMap.isEmpty()) + { + NBTTagList nbttaglist = new NBTTagList(); + + for (PotionEffect potioneffect : this.activePotionsMap.values()) + { + nbttaglist.appendTag(potioneffect.writeCustomPotionEffectToNBT(new NBTTagCompound())); + } + + tagCompound.setTag("ActiveEffects", nbttaglist); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + this.setAbsorptionAmount(tagCompund.getFloat("AbsorptionAmount")); + + if (tagCompund.hasKey("Attributes", 9) && this.worldObj != null && !this.worldObj.isRemote) + { + SharedMonsterAttributes.func_151475_a(this.getAttributeMap(), tagCompund.getTagList("Attributes", 10)); + } + + if (tagCompund.hasKey("ActiveEffects", 9)) + { + NBTTagList nbttaglist = tagCompund.getTagList("ActiveEffects", 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound); + + if (potioneffect != null) + { + this.activePotionsMap.put(Integer.valueOf(potioneffect.getPotionID()), potioneffect); + } + } + } + + if (tagCompund.hasKey("HealF", 99)) + { + this.setHealth(tagCompund.getFloat("HealF")); + } + else + { + NBTBase nbtbase = tagCompund.getTag("Health"); + + if (nbtbase == null) + { + this.setHealth(this.getMaxHealth()); + } + else if (nbtbase.getId() == 5) + { + this.setHealth(((NBTTagFloat)nbtbase).getFloat()); + } + else if (nbtbase.getId() == 2) + { + this.setHealth((float)((NBTTagShort)nbtbase).getShort()); + } + } + + this.hurtTime = tagCompund.getShort("HurtTime"); + this.deathTime = tagCompund.getShort("DeathTime"); + this.revengeTimer = tagCompund.getInteger("HurtByTimestamp"); + } + + protected void updatePotionEffects() + { + Iterator iterator = this.activePotionsMap.keySet().iterator(); + + while (iterator.hasNext()) + { + Integer integer = (Integer)iterator.next(); + PotionEffect potioneffect = (PotionEffect)this.activePotionsMap.get(integer); + + if (!potioneffect.onUpdate(this)) + { + if (!this.worldObj.isRemote) + { + iterator.remove(); + this.onFinishedPotionEffect(potioneffect); + } + } + else if (potioneffect.getDuration() % 600 == 0) + { + this.onChangedPotionEffect(potioneffect, false); + } + } + + if (this.potionsNeedUpdate) + { + if (!this.worldObj.isRemote) + { + this.updatePotionMetadata(); + } + + this.potionsNeedUpdate = false; + } + + int i = this.dataWatcher.getWatchableObjectInt(7); + boolean flag1 = this.dataWatcher.getWatchableObjectByte(8) > 0; + + if (i > 0) + { + boolean flag = false; + + if (!this.isInvisible()) + { + flag = this.rand.nextBoolean(); + } + else + { + flag = this.rand.nextInt(15) == 0; + } + + if (flag1) + { + flag &= this.rand.nextInt(5) == 0; + } + + if (flag && i > 0) + { + double d0 = (double)(i >> 16 & 255) / 255.0D; + double d1 = (double)(i >> 8 & 255) / 255.0D; + double d2 = (double)(i >> 0 & 255) / 255.0D; + this.worldObj.spawnParticle(flag1 ? EnumParticleTypes.SPELL_MOB_AMBIENT : EnumParticleTypes.SPELL_MOB, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, d0, d1, d2, new int[0]); + } + } + } + + /** + * Clears potion metadata values if the entity has no potion effects. Otherwise, updates potion effect color, + * ambience, and invisibility metadata values + */ + protected void updatePotionMetadata() + { + if (this.activePotionsMap.isEmpty()) + { + this.resetPotionEffectMetadata(); + this.setInvisible(false); + } + else + { + int i = PotionHelper.calcPotionLiquidColor(this.activePotionsMap.values()); + this.dataWatcher.updateObject(8, Byte.valueOf((byte)(PotionHelper.getAreAmbient(this.activePotionsMap.values()) ? 1 : 0))); + this.dataWatcher.updateObject(7, Integer.valueOf(i)); + this.setInvisible(this.isPotionActive(Potion.invisibility.id)); + } + } + + /** + * Resets the potion effect color and ambience metadata values + */ + protected void resetPotionEffectMetadata() + { + this.dataWatcher.updateObject(8, Byte.valueOf((byte)0)); + this.dataWatcher.updateObject(7, Integer.valueOf(0)); + } + + public void clearActivePotions() + { + Iterator iterator = this.activePotionsMap.keySet().iterator(); + + while (iterator.hasNext()) + { + Integer integer = (Integer)iterator.next(); + PotionEffect potioneffect = (PotionEffect)this.activePotionsMap.get(integer); + + if (!this.worldObj.isRemote) + { + iterator.remove(); + this.onFinishedPotionEffect(potioneffect); + } + } + } + + public Collection getActivePotionEffects() + { + return this.activePotionsMap.values(); + } + + public boolean isPotionActive(int potionId) + { + return this.activePotionsMap.containsKey(Integer.valueOf(potionId)); + } + + public boolean isPotionActive(Potion potionIn) + { + return this.activePotionsMap.containsKey(Integer.valueOf(potionIn.id)); + } + + /** + * returns the PotionEffect for the supplied Potion if it is active, null otherwise. + */ + public PotionEffect getActivePotionEffect(Potion potionIn) + { + return (PotionEffect)this.activePotionsMap.get(Integer.valueOf(potionIn.id)); + } + + /** + * adds a PotionEffect to the entity + */ + public void addPotionEffect(PotionEffect potioneffectIn) + { + if (this.isPotionApplicable(potioneffectIn)) + { + if (this.activePotionsMap.containsKey(Integer.valueOf(potioneffectIn.getPotionID()))) + { + ((PotionEffect)this.activePotionsMap.get(Integer.valueOf(potioneffectIn.getPotionID()))).combine(potioneffectIn); + this.onChangedPotionEffect((PotionEffect)this.activePotionsMap.get(Integer.valueOf(potioneffectIn.getPotionID())), true); + } + else + { + this.activePotionsMap.put(Integer.valueOf(potioneffectIn.getPotionID()), potioneffectIn); + this.onNewPotionEffect(potioneffectIn); + } + } + } + + public boolean isPotionApplicable(PotionEffect potioneffectIn) + { + if (this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) + { + int i = potioneffectIn.getPotionID(); + + if (i == Potion.regeneration.id || i == Potion.poison.id) + { + return false; + } + } + + return true; + } + + /** + * Returns true if this entity is undead. + */ + public boolean isEntityUndead() + { + return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; + } + + /** + * Remove the speified potion effect from this entity. + */ + public void removePotionEffectClient(int potionId) + { + this.activePotionsMap.remove(Integer.valueOf(potionId)); + } + + /** + * Remove the specified potion effect from this entity. + */ + public void removePotionEffect(int potionId) + { + PotionEffect potioneffect = (PotionEffect)this.activePotionsMap.remove(Integer.valueOf(potionId)); + + if (potioneffect != null) + { + this.onFinishedPotionEffect(potioneffect); + } + } + + protected void onNewPotionEffect(PotionEffect id) + { + this.potionsNeedUpdate = true; + + if (!this.worldObj.isRemote) + { + Potion.potionTypes[id.getPotionID()].applyAttributesModifiersToEntity(this, this.getAttributeMap(), id.getAmplifier()); + } + } + + protected void onChangedPotionEffect(PotionEffect id, boolean p_70695_2_) + { + this.potionsNeedUpdate = true; + + if (p_70695_2_ && !this.worldObj.isRemote) + { + Potion.potionTypes[id.getPotionID()].removeAttributesModifiersFromEntity(this, this.getAttributeMap(), id.getAmplifier()); + Potion.potionTypes[id.getPotionID()].applyAttributesModifiersToEntity(this, this.getAttributeMap(), id.getAmplifier()); + } + } + + protected void onFinishedPotionEffect(PotionEffect p_70688_1_) + { + this.potionsNeedUpdate = true; + + if (!this.worldObj.isRemote) + { + Potion.potionTypes[p_70688_1_.getPotionID()].removeAttributesModifiersFromEntity(this, this.getAttributeMap(), p_70688_1_.getAmplifier()); + } + } + + /** + * Heal living entity (param: amount of half-hearts) + */ + public void heal(float healAmount) + { + float f = this.getHealth(); + + if (f > 0.0F) + { + this.setHealth(f + healAmount); + } + } + + public final float getHealth() + { + return this.dataWatcher.getWatchableObjectFloat(6); + } + + public void setHealth(float health) + { + this.dataWatcher.updateObject(6, Float.valueOf(MathHelper.clamp_float(health, 0.0F, this.getMaxHealth()))); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else if (this.worldObj.isRemote) + { + return false; + } + else + { + this.entityAge = 0; + + if (this.getHealth() <= 0.0F) + { + return false; + } + else if (source.isFireDamage() && this.isPotionActive(Potion.fireResistance)) + { + return false; + } + else + { + if ((source == DamageSource.anvil || source == DamageSource.fallingBlock) && this.getEquipmentInSlot(4) != null) + { + this.getEquipmentInSlot(4).damageItem((int)(amount * 4.0F + this.rand.nextFloat() * amount * 2.0F), this); + amount *= 0.75F; + } + + this.limbSwingAmount = 1.5F; + boolean flag = true; + + if ((float)this.hurtResistantTime > (float)this.maxHurtResistantTime / 2.0F) + { + if (amount <= this.lastDamage) + { + return false; + } + + this.damageEntity(source, amount - this.lastDamage); + this.lastDamage = amount; + flag = false; + } + else + { + this.lastDamage = amount; + this.hurtResistantTime = this.maxHurtResistantTime; + this.damageEntity(source, amount); + this.hurtTime = this.maxHurtTime = 10; + } + + this.attackedAtYaw = 0.0F; + Entity entity = source.getEntity(); + + if (entity != null) + { + if (entity instanceof EntityLivingBase) + { + this.setRevengeTarget((EntityLivingBase)entity); + } + + if (entity instanceof EntityPlayer) + { + this.recentlyHit = 100; + this.attackingPlayer = (EntityPlayer)entity; + } + else if (entity instanceof EntityWolf) + { + EntityWolf entitywolf = (EntityWolf)entity; + + if (entitywolf.isTamed()) + { + this.recentlyHit = 100; + this.attackingPlayer = null; + } + } + } + + if (flag) + { + this.worldObj.setEntityState(this, (byte)2); + + if (source != DamageSource.drown) + { + this.setBeenAttacked(); + } + + if (entity != null) + { + double d1 = entity.posX - this.posX; + double d0; + + for (d0 = entity.posZ - this.posZ; d1 * d1 + d0 * d0 < 1.0E-4D; d0 = (Math.random() - Math.random()) * 0.01D) + { + d1 = (Math.random() - Math.random()) * 0.01D; + } + + this.attackedAtYaw = (float)(MathHelper.func_181159_b(d0, d1) * 180.0D / Math.PI - (double)this.rotationYaw); + this.knockBack(entity, amount, d1, d0); + } + else + { + this.attackedAtYaw = (float)((int)(Math.random() * 2.0D) * 180); + } + } + + if (this.getHealth() <= 0.0F) + { + String s = this.getDeathSound(); + + if (flag && s != null) + { + this.playSound(s, this.getSoundVolume(), this.getSoundPitch()); + } + + this.onDeath(source); + } + else + { + String s1 = this.getHurtSound(); + + if (flag && s1 != null) + { + this.playSound(s1, this.getSoundVolume(), this.getSoundPitch()); + } + } + + return true; + } + } + } + + /** + * Renders broken item particles using the given ItemStack + */ + public void renderBrokenItemStack(ItemStack stack) + { + this.playSound("random.break", 0.8F, 0.8F + this.worldObj.rand.nextFloat() * 0.4F); + + for (int i = 0; i < 5; ++i) + { + Vec3 vec3 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); + vec3 = vec3.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F); + vec3 = vec3.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F); + double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D; + Vec3 vec31 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D); + vec31 = vec31.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F); + vec31 = vec31.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F); + vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); + this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord, new int[] {Item.getIdFromItem(stack.getItem())}); + } + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource cause) + { + Entity entity = cause.getEntity(); + EntityLivingBase entitylivingbase = this.func_94060_bK(); + + if (this.scoreValue >= 0 && entitylivingbase != null) + { + entitylivingbase.addToPlayerScore(this, this.scoreValue); + } + + if (entity != null) + { + entity.onKillEntity(this); + } + + this.dead = true; + this.getCombatTracker().reset(); + + if (!this.worldObj.isRemote) + { + int i = 0; + + if (entity instanceof EntityPlayer) + { + i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity); + } + + if (this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot")) + { + this.dropFewItems(this.recentlyHit > 0, i); + this.dropEquipment(this.recentlyHit > 0, i); + + if (this.recentlyHit > 0 && this.rand.nextFloat() < 0.025F + (float)i * 0.01F) + { + this.addRandomDrop(); + } + } + } + + this.worldObj.setEntityState(this, (byte)3); + } + + /** + * Drop the equipment for this entity. + */ + protected void dropEquipment(boolean p_82160_1_, int p_82160_2_) + { + } + + /** + * knocks back this entity + */ + public void knockBack(Entity entityIn, float p_70653_2_, double p_70653_3_, double p_70653_5_) + { + if (this.rand.nextDouble() >= this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue()) + { + this.isAirBorne = true; + float f = MathHelper.sqrt_double(p_70653_3_ * p_70653_3_ + p_70653_5_ * p_70653_5_); + float f1 = 0.4F; + this.motionX /= 2.0D; + this.motionY /= 2.0D; + this.motionZ /= 2.0D; + this.motionX -= p_70653_3_ / (double)f * (double)f1; + this.motionY += (double)f1; + this.motionZ -= p_70653_5_ / (double)f * (double)f1; + + if (this.motionY > 0.4000000059604645D) + { + this.motionY = 0.4000000059604645D; + } + } + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "game.neutral.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "game.neutral.die"; + } + + /** + * Causes this Entity to drop a random item. + */ + protected void addRandomDrop() + { + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + } + + /** + * returns true if this entity is by a ladder, false otherwise + */ + public boolean isOnLadder() + { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); + int k = MathHelper.floor_double(this.posZ); + Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); + return (block == Blocks.ladder || block == Blocks.vine) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).isSpectator()); + } + + /** + * Checks whether target entity is alive. + */ + public boolean isEntityAlive() + { + return !this.isDead && this.getHealth() > 0.0F; + } + + public void fall(float distance, float damageMultiplier) + { + super.fall(distance, damageMultiplier); + PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump); + float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F; + int i = MathHelper.ceiling_float_int((distance - 3.0F - f) * damageMultiplier); + + if (i > 0) + { + this.playSound(this.getFallSoundString(i), 1.0F, 1.0F); + this.attackEntityFrom(DamageSource.fall, (float)i); + int j = MathHelper.floor_double(this.posX); + int k = MathHelper.floor_double(this.posY - 0.20000000298023224D); + int l = MathHelper.floor_double(this.posZ); + Block block = this.worldObj.getBlockState(new BlockPos(j, k, l)).getBlock(); + + if (block.getMaterial() != Material.air) + { + Block.SoundType block$soundtype = block.stepSound; + this.playSound(block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.5F, block$soundtype.getFrequency() * 0.75F); + } + } + } + + protected String getFallSoundString(int damageValue) + { + return damageValue > 4 ? "game.neutral.hurt.fall.big" : "game.neutral.hurt.fall.small"; + } + + /** + * Setups the entity to do the hurt animation. Only used by packets in multiplayer. + */ + public void performHurtAnimation() + { + this.hurtTime = this.maxHurtTime = 10; + this.attackedAtYaw = 0.0F; + } + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + int i = 0; + + for (ItemStack itemstack : this.getInventory()) + { + if (itemstack != null && itemstack.getItem() instanceof ItemArmor) + { + int j = ((ItemArmor)itemstack.getItem()).damageReduceAmount; + i += j; + } + } + + return i; + } + + protected void damageArmor(float p_70675_1_) + { + } + + /** + * Reduces damage, depending on armor + */ + protected float applyArmorCalculations(DamageSource source, float damage) + { + if (!source.isUnblockable()) + { + int i = 25 - this.getTotalArmorValue(); + float f = damage * (float)i; + this.damageArmor(damage); + damage = f / 25.0F; + } + + return damage; + } + + /** + * Reduces damage, depending on potions + */ + protected float applyPotionDamageCalculations(DamageSource source, float damage) + { + if (source.isDamageAbsolute()) + { + return damage; + } + else + { + if (this.isPotionActive(Potion.resistance) && source != DamageSource.outOfWorld) + { + int i = (this.getActivePotionEffect(Potion.resistance).getAmplifier() + 1) * 5; + int j = 25 - i; + float f = damage * (float)j; + damage = f / 25.0F; + } + + if (damage <= 0.0F) + { + return 0.0F; + } + else + { + int k = EnchantmentHelper.getEnchantmentModifierDamage(this.getInventory(), source); + + if (k > 20) + { + k = 20; + } + + if (k > 0 && k <= 20) + { + int l = 25 - k; + float f1 = damage * (float)l; + damage = f1 / 25.0F; + } + + return damage; + } + } + } + + /** + * Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first and then health + * second with the reduced value. Args: damageAmount + */ + protected void damageEntity(DamageSource damageSrc, float damageAmount) + { + if (!this.isEntityInvulnerable(damageSrc)) + { + damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); + damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); + float f = damageAmount; + damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); + this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount)); + + if (damageAmount != 0.0F) + { + float f1 = this.getHealth(); + this.setHealth(f1 - damageAmount); + this.getCombatTracker().trackDamage(damageSrc, f1, damageAmount); + this.setAbsorptionAmount(this.getAbsorptionAmount() - damageAmount); + } + } + } + + public CombatTracker getCombatTracker() + { + return this._combatTracker; + } + + public EntityLivingBase func_94060_bK() + { + return (EntityLivingBase)(this._combatTracker.func_94550_c() != null ? this._combatTracker.func_94550_c() : (this.attackingPlayer != null ? this.attackingPlayer : (this.entityLivingToAttack != null ? this.entityLivingToAttack : null))); + } + + public final float getMaxHealth() + { + return (float)this.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue(); + } + + /** + * counts the amount of arrows stuck in the entity. getting hit by arrows increases this, used in rendering + */ + public final int getArrowCountInEntity() + { + return this.dataWatcher.getWatchableObjectByte(9); + } + + /** + * sets the amount of arrows stuck in the entity. used for rendering those + */ + public final void setArrowCountInEntity(int count) + { + this.dataWatcher.updateObject(9, Byte.valueOf((byte)count)); + } + + /** + * Returns an integer indicating the end point of the swing animation, used by {@link #swingProgress} to provide a + * progress indicator. Takes dig speed enchantments into account. + */ + private int getArmSwingAnimationEnd() + { + return this.isPotionActive(Potion.digSpeed) ? 6 - (1 + this.getActivePotionEffect(Potion.digSpeed).getAmplifier()) * 1 : (this.isPotionActive(Potion.digSlowdown) ? 6 + (1 + this.getActivePotionEffect(Potion.digSlowdown).getAmplifier()) * 2 : 6); + } + + /** + * Swings the item the player is holding. + */ + public void swingItem() + { + if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) + { + this.swingProgressInt = -1; + this.isSwingInProgress = true; + + if (this.worldObj instanceof WorldServer) + { + ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new S0BPacketAnimation(this, 0)); + } + } + } + + public void handleStatusUpdate(byte id) + { + if (id == 2) + { + this.limbSwingAmount = 1.5F; + this.hurtResistantTime = this.maxHurtResistantTime; + this.hurtTime = this.maxHurtTime = 10; + this.attackedAtYaw = 0.0F; + String s = this.getHurtSound(); + + if (s != null) + { + this.playSound(this.getHurtSound(), this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + + this.attackEntityFrom(DamageSource.generic, 0.0F); + } + else if (id == 3) + { + String s1 = this.getDeathSound(); + + if (s1 != null) + { + this.playSound(this.getDeathSound(), this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + + this.setHealth(0.0F); + this.onDeath(DamageSource.generic); + } + else + { + super.handleStatusUpdate(id); + } + } + + /** + * sets the dead flag. Used when you fall off the bottom of the world. + */ + protected void kill() + { + this.attackEntityFrom(DamageSource.outOfWorld, 4.0F); + } + + /** + * Updates the arm swing progress counters and animation progress + */ + protected void updateArmSwingProgress() + { + int i = this.getArmSwingAnimationEnd(); + + if (this.isSwingInProgress) + { + ++this.swingProgressInt; + + if (this.swingProgressInt >= i) + { + this.swingProgressInt = 0; + this.isSwingInProgress = false; + } + } + else + { + this.swingProgressInt = 0; + } + + this.swingProgress = (float)this.swingProgressInt / (float)i; + } + + public IAttributeInstance getEntityAttribute(IAttribute attribute) + { + return this.getAttributeMap().getAttributeInstance(attribute); + } + + public BaseAttributeMap getAttributeMap() + { + if (this.attributeMap == null) + { + this.attributeMap = new ServersideAttributeMap(); + } + + return this.attributeMap; + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.UNDEFINED; + } + + /** + * Returns the item that this EntityLiving is holding, if any. + */ + public abstract ItemStack getHeldItem(); + + /** + * 0: Tool in Hand; 1-4: Armor + */ + public abstract ItemStack getEquipmentInSlot(int slotIn); + + public abstract ItemStack getCurrentArmor(int slotIn); + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public abstract void setCurrentItemOrArmor(int slotIn, ItemStack stack); + + /** + * Set sprinting switch for Entity. + */ + public void setSprinting(boolean sprinting) + { + super.setSprinting(sprinting); + IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + + if (iattributeinstance.getModifier(sprintingSpeedBoostModifierUUID) != null) + { + iattributeinstance.removeModifier(sprintingSpeedBoostModifier); + } + + if (sprinting) + { + iattributeinstance.applyModifier(sprintingSpeedBoostModifier); + } + } + + /** + * returns the inventory of this entity (only used in EntityPlayerMP it seems) + */ + public abstract ItemStack[] getInventory(); + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 1.0F; + } + + /** + * Gets the pitch of living sounds in living entities. + */ + protected float getSoundPitch() + { + return this.isChild() ? (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.5F : (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F; + } + + /** + * Dead and sleeping entities cannot move + */ + protected boolean isMovementBlocked() + { + return this.getHealth() <= 0.0F; + } + + /** + * Moves the entity to a position out of the way of its mount. + */ + public void dismountEntity(Entity p_110145_1_) + { + double d0 = p_110145_1_.posX; + double d1 = p_110145_1_.getEntityBoundingBox().minY + (double)p_110145_1_.height; + double d2 = p_110145_1_.posZ; + int i = 1; + + for (int j = -i; j <= i; ++j) + { + for (int k = -i; k < i; ++k) + { + if (j != 0 || k != 0) + { + int l = (int)(this.posX + (double)j); + int i1 = (int)(this.posZ + (double)k); + AxisAlignedBB axisalignedbb = this.getEntityBoundingBox().offset((double)j, 1.0D, (double)k); + + if (this.worldObj.func_147461_a(axisalignedbb).isEmpty()) + { + if (World.doesBlockHaveSolidTopSurface(this.worldObj, new BlockPos(l, (int)this.posY, i1))) + { + this.setPositionAndUpdate(this.posX + (double)j, this.posY + 1.0D, this.posZ + (double)k); + return; + } + + if (World.doesBlockHaveSolidTopSurface(this.worldObj, new BlockPos(l, (int)this.posY - 1, i1)) || this.worldObj.getBlockState(new BlockPos(l, (int)this.posY - 1, i1)).getBlock().getMaterial() == Material.water) + { + d0 = this.posX + (double)j; + d1 = this.posY + 1.0D; + d2 = this.posZ + (double)k; + } + } + } + } + } + + this.setPositionAndUpdate(d0, d1, d2); + } + + public boolean getAlwaysRenderNameTagForRender() + { + return false; + } + + protected float getJumpUpwardsMotion() + { + return 0.42F; + } + + /** + * Causes this entity to do an upwards motion (jumping). + */ + protected void jump() + { + this.motionY = (double)this.getJumpUpwardsMotion(); + + if (this.isPotionActive(Potion.jump)) + { + this.motionY += (double)((float)(this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F); + } + + if (this.isSprinting()) + { + float f = this.rotationYaw * 0.017453292F; + this.motionX -= (double)(MathHelper.sin(f) * 0.2F); + this.motionZ += (double)(MathHelper.cos(f) * 0.2F); + } + + this.isAirBorne = true; + } + + /** + * main AI tick function, replaces updateEntityActionState + */ + protected void updateAITick() + { + this.motionY += 0.03999999910593033D; + } + + protected void handleJumpLava() + { + this.motionY += 0.03999999910593033D; + } + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float strafe, float forward) + { + if (this.isServerWorld()) + { + if (!this.isInWater() || this instanceof EntityPlayer && ((EntityPlayer)this).capabilities.isFlying) + { + if (!this.isInLava() || this instanceof EntityPlayer && ((EntityPlayer)this).capabilities.isFlying) + { + float f4 = 0.91F; + + if (this.onGround) + { + f4 = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.91F; + } + + float f = 0.16277136F / (f4 * f4 * f4); + float f5; + + if (this.onGround) + { + f5 = this.getAIMoveSpeed() * f; + } + else + { + f5 = this.jumpMovementFactor; + } + + this.moveFlying(strafe, forward, f5); + f4 = 0.91F; + + if (this.onGround) + { + f4 = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.91F; + } + + if (this.isOnLadder()) + { + float f6 = 0.15F; + this.motionX = MathHelper.clamp_double(this.motionX, (double)(-f6), (double)f6); + this.motionZ = MathHelper.clamp_double(this.motionZ, (double)(-f6), (double)f6); + this.fallDistance = 0.0F; + + if (this.motionY < -0.15D) + { + this.motionY = -0.15D; + } + + boolean flag = this.isSneaking() && this instanceof EntityPlayer; + + if (flag && this.motionY < 0.0D) + { + this.motionY = 0.0D; + } + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.isCollidedHorizontally && this.isOnLadder()) + { + this.motionY = 0.2D; + } + + if (this.worldObj.isRemote && (!this.worldObj.isBlockLoaded(new BlockPos((int)this.posX, 0, (int)this.posZ)) || !this.worldObj.getChunkFromBlockCoords(new BlockPos((int)this.posX, 0, (int)this.posZ)).isLoaded())) + { + if (this.posY > 0.0D) + { + this.motionY = -0.1D; + } + else + { + this.motionY = 0.0D; + } + } + else + { + this.motionY -= 0.08D; + } + + this.motionY *= 0.9800000190734863D; + this.motionX *= (double)f4; + this.motionZ *= (double)f4; + } + else + { + double d1 = this.posY; + this.moveFlying(strafe, forward, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + this.motionY -= 0.02D; + + if (this.isCollidedHorizontally && this.isOffsetPositionInLiquid(this.motionX, this.motionY + 0.6000000238418579D - this.posY + d1, this.motionZ)) + { + this.motionY = 0.30000001192092896D; + } + } + } + else + { + double d0 = this.posY; + float f1 = 0.8F; + float f2 = 0.02F; + float f3 = (float)EnchantmentHelper.getDepthStriderModifier(this); + + if (f3 > 3.0F) + { + f3 = 3.0F; + } + + if (!this.onGround) + { + f3 *= 0.5F; + } + + if (f3 > 0.0F) + { + f1 += (0.54600006F - f1) * f3 / 3.0F; + f2 += (this.getAIMoveSpeed() * 1.0F - f2) * f3 / 3.0F; + } + + this.moveFlying(strafe, forward, f2); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)f1; + this.motionY *= 0.800000011920929D; + this.motionZ *= (double)f1; + this.motionY -= 0.02D; + + if (this.isCollidedHorizontally && this.isOffsetPositionInLiquid(this.motionX, this.motionY + 0.6000000238418579D - this.posY + d0, this.motionZ)) + { + this.motionY = 0.30000001192092896D; + } + } + } + + this.prevLimbSwingAmount = this.limbSwingAmount; + double d2 = this.posX - this.prevPosX; + double d3 = this.posZ - this.prevPosZ; + float f7 = MathHelper.sqrt_double(d2 * d2 + d3 * d3) * 4.0F; + + if (f7 > 1.0F) + { + f7 = 1.0F; + } + + this.limbSwingAmount += (f7 - this.limbSwingAmount) * 0.4F; + this.limbSwing += this.limbSwingAmount; + } + + /** + * the movespeed used for the new AI system + */ + public float getAIMoveSpeed() + { + return this.landMovementFactor; + } + + /** + * set the movespeed used for the new AI system + */ + public void setAIMoveSpeed(float speedIn) + { + this.landMovementFactor = speedIn; + } + + public boolean attackEntityAsMob(Entity entityIn) + { + this.setLastAttacker(entityIn); + return false; + } + + /** + * Returns whether player is sleeping or not + */ + public boolean isPlayerSleeping() + { + return false; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (!this.worldObj.isRemote) + { + int i = this.getArrowCountInEntity(); + + if (i > 0) + { + if (this.arrowHitTimer <= 0) + { + this.arrowHitTimer = 20 * (30 - i); + } + + --this.arrowHitTimer; + + if (this.arrowHitTimer <= 0) + { + this.setArrowCountInEntity(i - 1); + } + } + + for (int j = 0; j < 5; ++j) + { + ItemStack itemstack = this.previousEquipment[j]; + ItemStack itemstack1 = this.getEquipmentInSlot(j); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) + { + ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new S04PacketEntityEquipment(this.getEntityId(), j, itemstack1)); + + if (itemstack != null) + { + this.attributeMap.removeAttributeModifiers(itemstack.getAttributeModifiers()); + } + + if (itemstack1 != null) + { + this.attributeMap.applyAttributeModifiers(itemstack1.getAttributeModifiers()); + } + + this.previousEquipment[j] = itemstack1 == null ? null : itemstack1.copy(); + } + } + + if (this.ticksExisted % 20 == 0) + { + this.getCombatTracker().reset(); + } + } + + this.onLivingUpdate(); + double d0 = this.posX - this.prevPosX; + double d1 = this.posZ - this.prevPosZ; + float f = (float)(d0 * d0 + d1 * d1); + float f1 = this.renderYawOffset; + float f2 = 0.0F; + this.prevOnGroundSpeedFactor = this.onGroundSpeedFactor; + float f3 = 0.0F; + + if (f > 0.0025000002F) + { + f3 = 1.0F; + f2 = (float)Math.sqrt((double)f) * 3.0F; + f1 = (float)MathHelper.func_181159_b(d1, d0) * 180.0F / (float)Math.PI - 90.0F; + } + + if (this.swingProgress > 0.0F) + { + f1 = this.rotationYaw; + } + + if (!this.onGround) + { + f3 = 0.0F; + } + + this.onGroundSpeedFactor += (f3 - this.onGroundSpeedFactor) * 0.3F; + this.worldObj.theProfiler.startSection("headTurn"); + f2 = this.func_110146_f(f1, f2); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("rangeChecks"); + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + while (this.renderYawOffset - this.prevRenderYawOffset < -180.0F) + { + this.prevRenderYawOffset -= 360.0F; + } + + while (this.renderYawOffset - this.prevRenderYawOffset >= 180.0F) + { + this.prevRenderYawOffset += 360.0F; + } + + while (this.rotationPitch - this.prevRotationPitch < -180.0F) + { + this.prevRotationPitch -= 360.0F; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYawHead - this.prevRotationYawHead < -180.0F) + { + this.prevRotationYawHead -= 360.0F; + } + + while (this.rotationYawHead - this.prevRotationYawHead >= 180.0F) + { + this.prevRotationYawHead += 360.0F; + } + + this.worldObj.theProfiler.endSection(); + this.movedDistance += f2; + } + + protected float func_110146_f(float p_110146_1_, float p_110146_2_) + { + float f = MathHelper.wrapAngleTo180_float(p_110146_1_ - this.renderYawOffset); + this.renderYawOffset += f * 0.3F; + float f1 = MathHelper.wrapAngleTo180_float(this.rotationYaw - this.renderYawOffset); + boolean flag = f1 < -90.0F || f1 >= 90.0F; + + if (f1 < -75.0F) + { + f1 = -75.0F; + } + + if (f1 >= 75.0F) + { + f1 = 75.0F; + } + + this.renderYawOffset = this.rotationYaw - f1; + + if (f1 * f1 > 2500.0F) + { + this.renderYawOffset += f1 * 0.2F; + } + + if (flag) + { + p_110146_2_ *= -1.0F; + } + + return p_110146_2_; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.jumpTicks > 0) + { + --this.jumpTicks; + } + + if (this.newPosRotationIncrements > 0) + { + double d0 = this.posX + (this.newPosX - this.posX) / (double)this.newPosRotationIncrements; + double d1 = this.posY + (this.newPosY - this.posY) / (double)this.newPosRotationIncrements; + double d2 = this.posZ + (this.newPosZ - this.posZ) / (double)this.newPosRotationIncrements; + double d3 = MathHelper.wrapAngleTo180_double(this.newRotationYaw - (double)this.rotationYaw); + this.rotationYaw = (float)((double)this.rotationYaw + d3 / (double)this.newPosRotationIncrements); + this.rotationPitch = (float)((double)this.rotationPitch + (this.newRotationPitch - (double)this.rotationPitch) / (double)this.newPosRotationIncrements); + --this.newPosRotationIncrements; + this.setPosition(d0, d1, d2); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + else if (!this.isServerWorld()) + { + this.motionX *= 0.98D; + this.motionY *= 0.98D; + this.motionZ *= 0.98D; + } + + if (Math.abs(this.motionX) < 0.005D) + { + this.motionX = 0.0D; + } + + if (Math.abs(this.motionY) < 0.005D) + { + this.motionY = 0.0D; + } + + if (Math.abs(this.motionZ) < 0.005D) + { + this.motionZ = 0.0D; + } + + this.worldObj.theProfiler.startSection("ai"); + + if (this.isMovementBlocked()) + { + this.isJumping = false; + this.moveStrafing = 0.0F; + this.moveForward = 0.0F; + this.randomYawVelocity = 0.0F; + } + else if (this.isServerWorld()) + { + this.worldObj.theProfiler.startSection("newAi"); + this.updateEntityActionState(); + this.worldObj.theProfiler.endSection(); + } + + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("jump"); + + if (this.isJumping) + { + if (this.isInWater()) + { + this.updateAITick(); + } + else if (this.isInLava()) + { + this.handleJumpLava(); + } + else if (this.onGround && this.jumpTicks == 0) + { + this.jump(); + this.jumpTicks = 10; + } + } + else + { + this.jumpTicks = 0; + } + + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("travel"); + this.moveStrafing *= 0.98F; + this.moveForward *= 0.98F; + this.randomYawVelocity *= 0.9F; + this.moveEntityWithHeading(this.moveStrafing, this.moveForward); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("push"); + + if (!this.worldObj.isRemote) + { + this.collideWithNearbyEntities(); + } + + this.worldObj.theProfiler.endSection(); + } + + protected void updateEntityActionState() + { + } + + protected void collideWithNearbyEntities() + { + List list = this.worldObj.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D), Predicates. and (EntitySelectors.NOT_SPECTATING, new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_.canBePushed(); + } + })); + + if (!list.isEmpty()) + { + for (int i = 0; i < list.size(); ++i) + { + Entity entity = (Entity)list.get(i); + this.collideWithEntity(entity); + } + } + } + + protected void collideWithEntity(Entity p_82167_1_) + { + p_82167_1_.applyEntityCollision(this); + } + + /** + * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. + */ + public void mountEntity(Entity entityIn) + { + if (this.ridingEntity != null && entityIn == null) + { + if (!this.worldObj.isRemote) + { + this.dismountEntity(this.ridingEntity); + } + + if (this.ridingEntity != null) + { + this.ridingEntity.riddenByEntity = null; + } + + this.ridingEntity = null; + } + else + { + super.mountEntity(entityIn); + } + } + + /** + * Handles updating while being ridden by an entity + */ + public void updateRidden() + { + super.updateRidden(); + this.prevOnGroundSpeedFactor = this.onGroundSpeedFactor; + this.onGroundSpeedFactor = 0.0F; + this.fallDistance = 0.0F; + } + + public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + { + this.newPosX = x; + this.newPosY = y; + this.newPosZ = z; + this.newRotationYaw = (double)yaw; + this.newRotationPitch = (double)pitch; + this.newPosRotationIncrements = posRotationIncrements; + } + + public void setJumping(boolean p_70637_1_) + { + this.isJumping = p_70637_1_; + } + + /** + * Called whenever an item is picked up from walking over it. Args: pickedUpEntity, stackSize + */ + public void onItemPickup(Entity p_71001_1_, int p_71001_2_) + { + if (!p_71001_1_.isDead && !this.worldObj.isRemote) + { + EntityTracker entitytracker = ((WorldServer)this.worldObj).getEntityTracker(); + + if (p_71001_1_ instanceof EntityItem) + { + entitytracker.sendToAllTrackingEntity(p_71001_1_, new S0DPacketCollectItem(p_71001_1_.getEntityId(), this.getEntityId())); + } + + if (p_71001_1_ instanceof EntityArrow) + { + entitytracker.sendToAllTrackingEntity(p_71001_1_, new S0DPacketCollectItem(p_71001_1_.getEntityId(), this.getEntityId())); + } + + if (p_71001_1_ instanceof EntityXPOrb) + { + entitytracker.sendToAllTrackingEntity(p_71001_1_, new S0DPacketCollectItem(p_71001_1_.getEntityId(), this.getEntityId())); + } + } + } + + /** + * returns true if the entity provided in the argument can be seen. (Raytrace) + */ + public boolean canEntityBeSeen(Entity entityIn) + { + return this.worldObj.rayTraceBlocks(new Vec3(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ), new Vec3(entityIn.posX, entityIn.posY + (double)entityIn.getEyeHeight(), entityIn.posZ)) == null; + } + + /** + * returns a (normalized) vector of where this entity is looking + */ + public Vec3 getLookVec() + { + return this.getLook(1.0F); + } + + /** + * interpolated look vector + */ + public Vec3 getLook(float partialTicks) + { + if (partialTicks == 1.0F) + { + return this.getVectorForRotation(this.rotationPitch, this.rotationYawHead); + } + else + { + float f = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * partialTicks; + float f1 = this.prevRotationYawHead + (this.rotationYawHead - this.prevRotationYawHead) * partialTicks; + return this.getVectorForRotation(f, f1); + } + } + + /** + * Returns where in the swing animation the living entity is (from 0 to 1). Args: partialTickTime + */ + public float getSwingProgress(float partialTickTime) + { + float f = this.swingProgress - this.prevSwingProgress; + + if (f < 0.0F) + { + ++f; + } + + return this.prevSwingProgress + f * partialTickTime; + } + + /** + * Returns whether the entity is in a server world + */ + public boolean isServerWorld() + { + return !this.worldObj.isRemote; + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return !this.isDead; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return !this.isDead; + } + + /** + * Sets that this entity has been attacked. + */ + protected void setBeenAttacked() + { + this.velocityChanged = this.rand.nextDouble() >= this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue(); + } + + public float getRotationYawHead() + { + return this.rotationYawHead; + } + + /** + * Sets the head's yaw rotation of the entity. + */ + public void setRotationYawHead(float rotation) + { + this.rotationYawHead = rotation; + } + + public void func_181013_g(float p_181013_1_) + { + this.renderYawOffset = p_181013_1_; + } + + public float getAbsorptionAmount() + { + return this.absorptionAmount; + } + + public void setAbsorptionAmount(float amount) + { + if (amount < 0.0F) + { + amount = 0.0F; + } + + this.absorptionAmount = amount; + } + + public Team getTeam() + { + return this.worldObj.getScoreboard().getPlayersTeam(this.getUniqueID().toString()); + } + + public boolean isOnSameTeam(EntityLivingBase otherEntity) + { + return this.isOnTeam(otherEntity.getTeam()); + } + + /** + * Returns true if the entity is on a specific team. + */ + public boolean isOnTeam(Team p_142012_1_) + { + return this.getTeam() != null ? this.getTeam().isSameTeam(p_142012_1_) : false; + } + + /** + * Sends an ENTER_COMBAT packet to the client + */ + public void sendEnterCombat() + { + } + + /** + * Sends an END_COMBAT packet to the client + */ + public void sendEndCombat() + { + } + + protected void markPotionsDirty() + { + this.potionsNeedUpdate = true; + } +} diff --git a/src/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java b/src/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java new file mode 100644 index 0000000..9e3eef0 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntityMinecartCommandBlock.java @@ -0,0 +1,146 @@ +package net.minecraft.entity; + +import io.netty.buffer.ByteBuf; +import net.minecraft.block.state.IBlockState; +import net.minecraft.command.server.CommandBlockLogic; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class EntityMinecartCommandBlock extends EntityMinecart +{ + private final CommandBlockLogic commandBlockLogic = new CommandBlockLogic() + { + public void updateCommand() + { + EntityMinecartCommandBlock.this.getDataWatcher().updateObject(23, this.getCommand()); + EntityMinecartCommandBlock.this.getDataWatcher().updateObject(24, IChatComponent.Serializer.componentToJson(this.getLastOutput())); + } + public int func_145751_f() + { + return 1; + } + public void func_145757_a(ByteBuf p_145757_1_) + { + p_145757_1_.writeInt(EntityMinecartCommandBlock.this.getEntityId()); + } + public BlockPos getPosition() + { + return new BlockPos(EntityMinecartCommandBlock.this.posX, EntityMinecartCommandBlock.this.posY + 0.5D, EntityMinecartCommandBlock.this.posZ); + } + public Vec3 getPositionVector() + { + return new Vec3(EntityMinecartCommandBlock.this.posX, EntityMinecartCommandBlock.this.posY, EntityMinecartCommandBlock.this.posZ); + } + public World getEntityWorld() + { + return EntityMinecartCommandBlock.this.worldObj; + } + public Entity getCommandSenderEntity() + { + return EntityMinecartCommandBlock.this; + } + }; + + /** Cooldown before command block logic runs again in ticks */ + private int activatorRailCooldown = 0; + + public EntityMinecartCommandBlock(World worldIn) + { + super(worldIn); + } + + public EntityMinecartCommandBlock(World worldIn, double x, double y, double z) + { + super(worldIn, x, y, z); + } + + protected void entityInit() + { + super.entityInit(); + this.getDataWatcher().addObject(23, ""); + this.getDataWatcher().addObject(24, ""); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.commandBlockLogic.readDataFromNBT(tagCompund); + this.getDataWatcher().updateObject(23, this.getCommandBlockLogic().getCommand()); + this.getDataWatcher().updateObject(24, IChatComponent.Serializer.componentToJson(this.getCommandBlockLogic().getLastOutput())); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + this.commandBlockLogic.writeDataToNBT(tagCompound); + } + + public EntityMinecart.EnumMinecartType getMinecartType() + { + return EntityMinecart.EnumMinecartType.COMMAND_BLOCK; + } + + public IBlockState getDefaultDisplayTile() + { + return Blocks.command_block.getDefaultState(); + } + + public CommandBlockLogic getCommandBlockLogic() + { + return this.commandBlockLogic; + } + + /** + * Called every tick the minecart is on an activator rail. Args: x, y, z, is the rail receiving power + */ + public void onActivatorRailPass(int x, int y, int z, boolean receivingPower) + { + if (receivingPower && this.ticksExisted - this.activatorRailCooldown >= 4) + { + this.getCommandBlockLogic().trigger(this.worldObj); + this.activatorRailCooldown = this.ticksExisted; + } + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer playerIn) + { + this.commandBlockLogic.tryOpenEditCommandBlock(playerIn); + return false; + } + + public void onDataWatcherUpdate(int dataID) + { + super.onDataWatcherUpdate(dataID); + + if (dataID == 24) + { + try + { + this.commandBlockLogic.setLastOutput(IChatComponent.Serializer.jsonToComponent(this.getDataWatcher().getWatchableObjectString(24))); + } + catch (Throwable var3) + { + ; + } + } + else if (dataID == 23) + { + this.commandBlockLogic.setCommand(this.getDataWatcher().getWatchableObjectString(23)); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java b/src/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java new file mode 100644 index 0000000..d00521f --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntitySpawnPlacementRegistry.java @@ -0,0 +1,82 @@ +package net.minecraft.entity; + +import com.google.common.collect.Maps; +import java.util.HashMap; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.entity.monster.EntityCaveSpider; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntityEndermite; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.monster.EntityGiantZombie; +import net.minecraft.entity.monster.EntityGuardian; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.monster.EntityMagmaCube; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.monster.EntitySilverfish; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.entity.monster.EntitySnowman; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.monster.EntityWitch; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.entity.passive.EntityCow; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.passive.EntityMooshroom; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.passive.EntityRabbit; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.passive.EntityWolf; + +public class EntitySpawnPlacementRegistry +{ + private static final HashMap ENTITY_PLACEMENTS = Maps.newHashMap(); + + public static EntityLiving.SpawnPlacementType getPlacementForEntity(Class entityClass) + { + return (EntityLiving.SpawnPlacementType)ENTITY_PLACEMENTS.get(entityClass); + } + + static + { + ENTITY_PLACEMENTS.put(EntityBat.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityChicken.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityCow.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityHorse.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityMooshroom.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityOcelot.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityPig.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityRabbit.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntitySheep.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntitySnowman.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntitySquid.class, EntityLiving.SpawnPlacementType.IN_WATER); + ENTITY_PLACEMENTS.put(EntityIronGolem.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityWolf.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityVillager.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityDragon.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityWither.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityBlaze.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityCaveSpider.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityCreeper.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityEnderman.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityEndermite.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityGhast.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityGiantZombie.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityGuardian.class, EntityLiving.SpawnPlacementType.IN_WATER); + ENTITY_PLACEMENTS.put(EntityMagmaCube.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityPigZombie.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntitySilverfish.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntitySkeleton.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntitySlime.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntitySpider.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityWitch.class, EntityLiving.SpawnPlacementType.ON_GROUND); + ENTITY_PLACEMENTS.put(EntityZombie.class, EntityLiving.SpawnPlacementType.ON_GROUND); + } +} diff --git a/src/minecraft/net/minecraft/entity/EntityTracker.java b/src/minecraft/net/minecraft/entity/EntityTracker.java new file mode 100644 index 0000000..dd6c145 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntityTracker.java @@ -0,0 +1,337 @@ +package net.minecraft.entity; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.util.List; +import java.util.Set; +import java.util.concurrent.Callable; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.entity.item.EntityEnderEye; +import net.minecraft.entity.item.EntityEnderPearl; +import net.minecraft.entity.item.EntityExpBottle; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.entity.item.EntityFireworkRocket; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.entity.passive.IAnimals; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityEgg; +import net.minecraft.entity.projectile.EntityFireball; +import net.minecraft.entity.projectile.EntityFishHook; +import net.minecraft.entity.projectile.EntityPotion; +import net.minecraft.entity.projectile.EntitySmallFireball; +import net.minecraft.entity.projectile.EntitySnowball; +import net.minecraft.network.Packet; +import net.minecraft.util.IntHashMap; +import net.minecraft.util.ReportedException; +import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class EntityTracker +{ + private static final Logger logger = LogManager.getLogger(); + private final WorldServer theWorld; + private Set trackedEntities = Sets.newHashSet(); + private IntHashMap trackedEntityHashTable = new IntHashMap(); + private int maxTrackingDistanceThreshold; + + public EntityTracker(WorldServer theWorldIn) + { + this.theWorld = theWorldIn; + this.maxTrackingDistanceThreshold = theWorldIn.getMinecraftServer().getConfigurationManager().getEntityViewDistance(); + } + + public void trackEntity(Entity p_72786_1_) + { + if (p_72786_1_ instanceof EntityPlayerMP) + { + this.trackEntity(p_72786_1_, 512, 2); + EntityPlayerMP entityplayermp = (EntityPlayerMP)p_72786_1_; + + for (EntityTrackerEntry entitytrackerentry : this.trackedEntities) + { + if (entitytrackerentry.trackedEntity != entityplayermp) + { + entitytrackerentry.updatePlayerEntity(entityplayermp); + } + } + } + else if (p_72786_1_ instanceof EntityFishHook) + { + this.addEntityToTracker(p_72786_1_, 64, 5, true); + } + else if (p_72786_1_ instanceof EntityArrow) + { + this.addEntityToTracker(p_72786_1_, 64, 20, false); + } + else if (p_72786_1_ instanceof EntitySmallFireball) + { + this.addEntityToTracker(p_72786_1_, 64, 10, false); + } + else if (p_72786_1_ instanceof EntityFireball) + { + this.addEntityToTracker(p_72786_1_, 64, 10, false); + } + else if (p_72786_1_ instanceof EntitySnowball) + { + this.addEntityToTracker(p_72786_1_, 64, 10, true); + } + else if (p_72786_1_ instanceof EntityEnderPearl) + { + this.addEntityToTracker(p_72786_1_, 64, 10, true); + } + else if (p_72786_1_ instanceof EntityEnderEye) + { + this.addEntityToTracker(p_72786_1_, 64, 4, true); + } + else if (p_72786_1_ instanceof EntityEgg) + { + this.addEntityToTracker(p_72786_1_, 64, 10, true); + } + else if (p_72786_1_ instanceof EntityPotion) + { + this.addEntityToTracker(p_72786_1_, 64, 10, true); + } + else if (p_72786_1_ instanceof EntityExpBottle) + { + this.addEntityToTracker(p_72786_1_, 64, 10, true); + } + else if (p_72786_1_ instanceof EntityFireworkRocket) + { + this.addEntityToTracker(p_72786_1_, 64, 10, true); + } + else if (p_72786_1_ instanceof EntityItem) + { + this.addEntityToTracker(p_72786_1_, 64, 20, true); + } + else if (p_72786_1_ instanceof EntityMinecart) + { + this.addEntityToTracker(p_72786_1_, 80, 3, true); + } + else if (p_72786_1_ instanceof EntityBoat) + { + this.addEntityToTracker(p_72786_1_, 80, 3, true); + } + else if (p_72786_1_ instanceof EntitySquid) + { + this.addEntityToTracker(p_72786_1_, 64, 3, true); + } + else if (p_72786_1_ instanceof EntityWither) + { + this.addEntityToTracker(p_72786_1_, 80, 3, false); + } + else if (p_72786_1_ instanceof EntityBat) + { + this.addEntityToTracker(p_72786_1_, 80, 3, false); + } + else if (p_72786_1_ instanceof EntityDragon) + { + this.addEntityToTracker(p_72786_1_, 160, 3, true); + } + else if (p_72786_1_ instanceof IAnimals) + { + this.addEntityToTracker(p_72786_1_, 80, 3, true); + } + else if (p_72786_1_ instanceof EntityTNTPrimed) + { + this.addEntityToTracker(p_72786_1_, 160, 10, true); + } + else if (p_72786_1_ instanceof EntityFallingBlock) + { + this.addEntityToTracker(p_72786_1_, 160, 20, true); + } + else if (p_72786_1_ instanceof EntityHanging) + { + this.addEntityToTracker(p_72786_1_, 160, Integer.MAX_VALUE, false); + } + else if (p_72786_1_ instanceof EntityArmorStand) + { + this.addEntityToTracker(p_72786_1_, 160, 3, true); + } + else if (p_72786_1_ instanceof EntityXPOrb) + { + this.addEntityToTracker(p_72786_1_, 160, 20, true); + } + else if (p_72786_1_ instanceof EntityEnderCrystal) + { + this.addEntityToTracker(p_72786_1_, 256, Integer.MAX_VALUE, false); + } + } + + public void trackEntity(Entity entityIn, int trackingRange, int updateFrequency) + { + this.addEntityToTracker(entityIn, trackingRange, updateFrequency, false); + } + + /** + * Args : Entity, trackingRange, updateFrequency, sendVelocityUpdates + */ + public void addEntityToTracker(Entity entityIn, int trackingRange, final int updateFrequency, boolean sendVelocityUpdates) + { + if (trackingRange > this.maxTrackingDistanceThreshold) + { + trackingRange = this.maxTrackingDistanceThreshold; + } + + try + { + if (this.trackedEntityHashTable.containsItem(entityIn.getEntityId())) + { + throw new IllegalStateException("Entity is already tracked!"); + } + + EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entityIn, trackingRange, updateFrequency, sendVelocityUpdates); + this.trackedEntities.add(entitytrackerentry); + this.trackedEntityHashTable.addKey(entityIn.getEntityId(), entitytrackerentry); + entitytrackerentry.updatePlayerEntities(this.theWorld.playerEntities); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Adding entity to track"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity To Track"); + crashreportcategory.addCrashSection("Tracking range", trackingRange + " blocks"); + crashreportcategory.addCrashSectionCallable("Update interval", new Callable() + { + public String call() throws Exception + { + String s = "Once per " + updateFrequency + " ticks"; + + if (updateFrequency == Integer.MAX_VALUE) + { + s = "Maximum (" + s + ")"; + } + + return s; + } + }); + entityIn.addEntityCrashInfo(crashreportcategory); + CrashReportCategory crashreportcategory1 = crashreport.makeCategory("Entity That Is Already Tracked"); + ((EntityTrackerEntry)this.trackedEntityHashTable.lookup(entityIn.getEntityId())).trackedEntity.addEntityCrashInfo(crashreportcategory1); + + try + { + throw new ReportedException(crashreport); + } + catch (ReportedException reportedexception) + { + logger.error((String)"\"Silently\" catching entity tracking error.", (Throwable)reportedexception); + } + } + } + + public void untrackEntity(Entity entityIn) + { + if (entityIn instanceof EntityPlayerMP) + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)entityIn; + + for (EntityTrackerEntry entitytrackerentry : this.trackedEntities) + { + entitytrackerentry.removeFromTrackedPlayers(entityplayermp); + } + } + + EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry)this.trackedEntityHashTable.removeObject(entityIn.getEntityId()); + + if (entitytrackerentry1 != null) + { + this.trackedEntities.remove(entitytrackerentry1); + entitytrackerentry1.sendDestroyEntityPacketToTrackedPlayers(); + } + } + + public void updateTrackedEntities() + { + List list = Lists.newArrayList(); + + for (EntityTrackerEntry entitytrackerentry : this.trackedEntities) + { + entitytrackerentry.updatePlayerList(this.theWorld.playerEntities); + + if (entitytrackerentry.playerEntitiesUpdated && entitytrackerentry.trackedEntity instanceof EntityPlayerMP) + { + list.add((EntityPlayerMP)entitytrackerentry.trackedEntity); + } + } + + for (int i = 0; i < ((List)list).size(); ++i) + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)list.get(i); + + for (EntityTrackerEntry entitytrackerentry1 : this.trackedEntities) + { + if (entitytrackerentry1.trackedEntity != entityplayermp) + { + entitytrackerentry1.updatePlayerEntity(entityplayermp); + } + } + } + } + + public void func_180245_a(EntityPlayerMP p_180245_1_) + { + for (EntityTrackerEntry entitytrackerentry : this.trackedEntities) + { + if (entitytrackerentry.trackedEntity == p_180245_1_) + { + entitytrackerentry.updatePlayerEntities(this.theWorld.playerEntities); + } + else + { + entitytrackerentry.updatePlayerEntity(p_180245_1_); + } + } + } + + public void sendToAllTrackingEntity(Entity entityIn, Packet p_151247_2_) + { + EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry)this.trackedEntityHashTable.lookup(entityIn.getEntityId()); + + if (entitytrackerentry != null) + { + entitytrackerentry.sendPacketToTrackedPlayers(p_151247_2_); + } + } + + public void func_151248_b(Entity entityIn, Packet p_151248_2_) + { + EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry)this.trackedEntityHashTable.lookup(entityIn.getEntityId()); + + if (entitytrackerentry != null) + { + entitytrackerentry.func_151261_b(p_151248_2_); + } + } + + public void removePlayerFromTrackers(EntityPlayerMP p_72787_1_) + { + for (EntityTrackerEntry entitytrackerentry : this.trackedEntities) + { + entitytrackerentry.removeTrackedPlayerSymmetric(p_72787_1_); + } + } + + public void func_85172_a(EntityPlayerMP p_85172_1_, Chunk p_85172_2_) + { + for (EntityTrackerEntry entitytrackerentry : this.trackedEntities) + { + if (entitytrackerentry.trackedEntity != p_85172_1_ && entitytrackerentry.trackedEntity.chunkCoordX == p_85172_2_.xPosition && entitytrackerentry.trackedEntity.chunkCoordZ == p_85172_2_.zPosition) + { + entitytrackerentry.updatePlayerEntity(p_85172_1_); + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/EntityTrackerEntry.java b/src/minecraft/net/minecraft/entity/EntityTrackerEntry.java new file mode 100644 index 0000000..484f6cf --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EntityTrackerEntry.java @@ -0,0 +1,643 @@ +package net.minecraft.entity; + +import com.google.common.collect.Sets; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.ai.attributes.ServersideAttributeMap; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.entity.item.EntityEnderEye; +import net.minecraft.entity.item.EntityEnderPearl; +import net.minecraft.entity.item.EntityExpBottle; +import net.minecraft.entity.item.EntityFallingBlock; +import net.minecraft.entity.item.EntityFireworkRocket; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityPainting; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.passive.IAnimals; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityEgg; +import net.minecraft.entity.projectile.EntityFireball; +import net.minecraft.entity.projectile.EntityFishHook; +import net.minecraft.entity.projectile.EntityPotion; +import net.minecraft.entity.projectile.EntitySmallFireball; +import net.minecraft.entity.projectile.EntitySnowball; +import net.minecraft.entity.projectile.EntityWitherSkull; +import net.minecraft.init.Items; +import net.minecraft.item.ItemMap; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S04PacketEntityEquipment; +import net.minecraft.network.play.server.S0APacketUseBed; +import net.minecraft.network.play.server.S0CPacketSpawnPlayer; +import net.minecraft.network.play.server.S0EPacketSpawnObject; +import net.minecraft.network.play.server.S0FPacketSpawnMob; +import net.minecraft.network.play.server.S10PacketSpawnPainting; +import net.minecraft.network.play.server.S11PacketSpawnExperienceOrb; +import net.minecraft.network.play.server.S12PacketEntityVelocity; +import net.minecraft.network.play.server.S14PacketEntity; +import net.minecraft.network.play.server.S18PacketEntityTeleport; +import net.minecraft.network.play.server.S19PacketEntityHeadLook; +import net.minecraft.network.play.server.S1BPacketEntityAttach; +import net.minecraft.network.play.server.S1CPacketEntityMetadata; +import net.minecraft.network.play.server.S1DPacketEntityEffect; +import net.minecraft.network.play.server.S20PacketEntityProperties; +import net.minecraft.network.play.server.S49PacketUpdateEntityNBT; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.storage.MapData; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class EntityTrackerEntry +{ + private static final Logger logger = LogManager.getLogger(); + + /** The entity that this EntityTrackerEntry tracks. */ + public Entity trackedEntity; + public int trackingDistanceThreshold; + + /** check for sync when ticks % updateFrequency==0 */ + public int updateFrequency; + + /** The encoded entity X position. */ + public int encodedPosX; + + /** The encoded entity Y position. */ + public int encodedPosY; + + /** The encoded entity Z position. */ + public int encodedPosZ; + + /** The encoded entity yaw rotation. */ + public int encodedRotationYaw; + + /** The encoded entity pitch rotation. */ + public int encodedRotationPitch; + public int lastHeadMotion; + public double lastTrackedEntityMotionX; + public double lastTrackedEntityMotionY; + public double motionZ; + public int updateCounter; + private double lastTrackedEntityPosX; + private double lastTrackedEntityPosY; + private double lastTrackedEntityPosZ; + private boolean firstUpdateDone; + private boolean sendVelocityUpdates; + + /** + * every 400 ticks a full teleport packet is sent, rather than just a "move me +x" command, so that position + * remains fully synced. + */ + private int ticksSinceLastForcedTeleport; + private Entity field_85178_v; + private boolean ridingEntity; + private boolean onGround; + public boolean playerEntitiesUpdated; + public Set trackingPlayers = Sets.newHashSet(); + + public EntityTrackerEntry(Entity trackedEntityIn, int trackingDistanceThresholdIn, int updateFrequencyIn, boolean sendVelocityUpdatesIn) + { + this.trackedEntity = trackedEntityIn; + this.trackingDistanceThreshold = trackingDistanceThresholdIn; + this.updateFrequency = updateFrequencyIn; + this.sendVelocityUpdates = sendVelocityUpdatesIn; + this.encodedPosX = MathHelper.floor_double(trackedEntityIn.posX * 32.0D); + this.encodedPosY = MathHelper.floor_double(trackedEntityIn.posY * 32.0D); + this.encodedPosZ = MathHelper.floor_double(trackedEntityIn.posZ * 32.0D); + this.encodedRotationYaw = MathHelper.floor_float(trackedEntityIn.rotationYaw * 256.0F / 360.0F); + this.encodedRotationPitch = MathHelper.floor_float(trackedEntityIn.rotationPitch * 256.0F / 360.0F); + this.lastHeadMotion = MathHelper.floor_float(trackedEntityIn.getRotationYawHead() * 256.0F / 360.0F); + this.onGround = trackedEntityIn.onGround; + } + + public boolean equals(Object p_equals_1_) + { + return p_equals_1_ instanceof EntityTrackerEntry ? ((EntityTrackerEntry)p_equals_1_).trackedEntity.getEntityId() == this.trackedEntity.getEntityId() : false; + } + + public int hashCode() + { + return this.trackedEntity.getEntityId(); + } + + public void updatePlayerList(List p_73122_1_) + { + this.playerEntitiesUpdated = false; + + if (!this.firstUpdateDone || this.trackedEntity.getDistanceSq(this.lastTrackedEntityPosX, this.lastTrackedEntityPosY, this.lastTrackedEntityPosZ) > 16.0D) + { + this.lastTrackedEntityPosX = this.trackedEntity.posX; + this.lastTrackedEntityPosY = this.trackedEntity.posY; + this.lastTrackedEntityPosZ = this.trackedEntity.posZ; + this.firstUpdateDone = true; + this.playerEntitiesUpdated = true; + this.updatePlayerEntities(p_73122_1_); + } + + if (this.field_85178_v != this.trackedEntity.ridingEntity || this.trackedEntity.ridingEntity != null && this.updateCounter % 60 == 0) + { + this.field_85178_v = this.trackedEntity.ridingEntity; + this.sendPacketToTrackedPlayers(new S1BPacketEntityAttach(0, this.trackedEntity, this.trackedEntity.ridingEntity)); + } + + if (this.trackedEntity instanceof EntityItemFrame && this.updateCounter % 10 == 0) + { + EntityItemFrame entityitemframe = (EntityItemFrame)this.trackedEntity; + ItemStack itemstack = entityitemframe.getDisplayedItem(); + + if (itemstack != null && itemstack.getItem() instanceof ItemMap) + { + MapData mapdata = Items.filled_map.getMapData(itemstack, this.trackedEntity.worldObj); + + for (EntityPlayer entityplayer : p_73122_1_) + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)entityplayer; + mapdata.updateVisiblePlayers(entityplayermp, itemstack); + Packet packet = Items.filled_map.createMapDataPacket(itemstack, this.trackedEntity.worldObj, entityplayermp); + + if (packet != null) + { + entityplayermp.playerNetServerHandler.sendPacket(packet); + } + } + } + + this.sendMetadataToAllAssociatedPlayers(); + } + + if (this.updateCounter % this.updateFrequency == 0 || this.trackedEntity.isAirBorne || this.trackedEntity.getDataWatcher().hasObjectChanged()) + { + if (this.trackedEntity.ridingEntity == null) + { + ++this.ticksSinceLastForcedTeleport; + int k = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); + int j1 = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); + int k1 = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); + int l1 = MathHelper.floor_float(this.trackedEntity.rotationYaw * 256.0F / 360.0F); + int i2 = MathHelper.floor_float(this.trackedEntity.rotationPitch * 256.0F / 360.0F); + int j2 = k - this.encodedPosX; + int k2 = j1 - this.encodedPosY; + int i = k1 - this.encodedPosZ; + Packet packet1 = null; + boolean flag = Math.abs(j2) >= 4 || Math.abs(k2) >= 4 || Math.abs(i) >= 4 || this.updateCounter % 60 == 0; + boolean flag1 = Math.abs(l1 - this.encodedRotationYaw) >= 4 || Math.abs(i2 - this.encodedRotationPitch) >= 4; + + if (this.updateCounter > 0 || this.trackedEntity instanceof EntityArrow) + { + if (j2 >= -128 && j2 < 128 && k2 >= -128 && k2 < 128 && i >= -128 && i < 128 && this.ticksSinceLastForcedTeleport <= 400 && !this.ridingEntity && this.onGround == this.trackedEntity.onGround) + { + if ((!flag || !flag1) && !(this.trackedEntity instanceof EntityArrow)) + { + if (flag) + { + packet1 = new S14PacketEntity.S15PacketEntityRelMove(this.trackedEntity.getEntityId(), (byte)j2, (byte)k2, (byte)i, this.trackedEntity.onGround); + } + else if (flag1) + { + packet1 = new S14PacketEntity.S16PacketEntityLook(this.trackedEntity.getEntityId(), (byte)l1, (byte)i2, this.trackedEntity.onGround); + } + } + else + { + packet1 = new S14PacketEntity.S17PacketEntityLookMove(this.trackedEntity.getEntityId(), (byte)j2, (byte)k2, (byte)i, (byte)l1, (byte)i2, this.trackedEntity.onGround); + } + } + else + { + this.onGround = this.trackedEntity.onGround; + this.ticksSinceLastForcedTeleport = 0; + packet1 = new S18PacketEntityTeleport(this.trackedEntity.getEntityId(), k, j1, k1, (byte)l1, (byte)i2, this.trackedEntity.onGround); + } + } + + if (this.sendVelocityUpdates) + { + double d0 = this.trackedEntity.motionX - this.lastTrackedEntityMotionX; + double d1 = this.trackedEntity.motionY - this.lastTrackedEntityMotionY; + double d2 = this.trackedEntity.motionZ - this.motionZ; + double d3 = 0.02D; + double d4 = d0 * d0 + d1 * d1 + d2 * d2; + + if (d4 > d3 * d3 || d4 > 0.0D && this.trackedEntity.motionX == 0.0D && this.trackedEntity.motionY == 0.0D && this.trackedEntity.motionZ == 0.0D) + { + this.lastTrackedEntityMotionX = this.trackedEntity.motionX; + this.lastTrackedEntityMotionY = this.trackedEntity.motionY; + this.motionZ = this.trackedEntity.motionZ; + this.sendPacketToTrackedPlayers(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.lastTrackedEntityMotionX, this.lastTrackedEntityMotionY, this.motionZ)); + } + } + + if (packet1 != null) + { + this.sendPacketToTrackedPlayers(packet1); + } + + this.sendMetadataToAllAssociatedPlayers(); + + if (flag) + { + this.encodedPosX = k; + this.encodedPosY = j1; + this.encodedPosZ = k1; + } + + if (flag1) + { + this.encodedRotationYaw = l1; + this.encodedRotationPitch = i2; + } + + this.ridingEntity = false; + } + else + { + int j = MathHelper.floor_float(this.trackedEntity.rotationYaw * 256.0F / 360.0F); + int i1 = MathHelper.floor_float(this.trackedEntity.rotationPitch * 256.0F / 360.0F); + boolean flag2 = Math.abs(j - this.encodedRotationYaw) >= 4 || Math.abs(i1 - this.encodedRotationPitch) >= 4; + + if (flag2) + { + this.sendPacketToTrackedPlayers(new S14PacketEntity.S16PacketEntityLook(this.trackedEntity.getEntityId(), (byte)j, (byte)i1, this.trackedEntity.onGround)); + this.encodedRotationYaw = j; + this.encodedRotationPitch = i1; + } + + this.encodedPosX = MathHelper.floor_double(this.trackedEntity.posX * 32.0D); + this.encodedPosY = MathHelper.floor_double(this.trackedEntity.posY * 32.0D); + this.encodedPosZ = MathHelper.floor_double(this.trackedEntity.posZ * 32.0D); + this.sendMetadataToAllAssociatedPlayers(); + this.ridingEntity = true; + } + + int l = MathHelper.floor_float(this.trackedEntity.getRotationYawHead() * 256.0F / 360.0F); + + if (Math.abs(l - this.lastHeadMotion) >= 4) + { + this.sendPacketToTrackedPlayers(new S19PacketEntityHeadLook(this.trackedEntity, (byte)l)); + this.lastHeadMotion = l; + } + + this.trackedEntity.isAirBorne = false; + } + + ++this.updateCounter; + + if (this.trackedEntity.velocityChanged) + { + this.func_151261_b(new S12PacketEntityVelocity(this.trackedEntity)); + this.trackedEntity.velocityChanged = false; + } + } + + /** + * Sends the entity metadata (DataWatcher) and attributes to all players tracking this entity, including the entity + * itself if a player. + */ + private void sendMetadataToAllAssociatedPlayers() + { + DataWatcher datawatcher = this.trackedEntity.getDataWatcher(); + + if (datawatcher.hasObjectChanged()) + { + this.func_151261_b(new S1CPacketEntityMetadata(this.trackedEntity.getEntityId(), datawatcher, false)); + } + + if (this.trackedEntity instanceof EntityLivingBase) + { + ServersideAttributeMap serversideattributemap = (ServersideAttributeMap)((EntityLivingBase)this.trackedEntity).getAttributeMap(); + Set set = serversideattributemap.getAttributeInstanceSet(); + + if (!set.isEmpty()) + { + this.func_151261_b(new S20PacketEntityProperties(this.trackedEntity.getEntityId(), set)); + } + + set.clear(); + } + } + + /** + * Send the given packet to all players tracking this entity. + */ + public void sendPacketToTrackedPlayers(Packet packetIn) + { + for (EntityPlayerMP entityplayermp : this.trackingPlayers) + { + entityplayermp.playerNetServerHandler.sendPacket(packetIn); + } + } + + public void func_151261_b(Packet packetIn) + { + this.sendPacketToTrackedPlayers(packetIn); + + if (this.trackedEntity instanceof EntityPlayerMP) + { + ((EntityPlayerMP)this.trackedEntity).playerNetServerHandler.sendPacket(packetIn); + } + } + + public void sendDestroyEntityPacketToTrackedPlayers() + { + for (EntityPlayerMP entityplayermp : this.trackingPlayers) + { + entityplayermp.removeEntity(this.trackedEntity); + } + } + + public void removeFromTrackedPlayers(EntityPlayerMP playerMP) + { + if (this.trackingPlayers.contains(playerMP)) + { + playerMP.removeEntity(this.trackedEntity); + this.trackingPlayers.remove(playerMP); + } + } + + public void updatePlayerEntity(EntityPlayerMP playerMP) + { + if (playerMP != this.trackedEntity) + { + if (this.func_180233_c(playerMP)) + { + if (!this.trackingPlayers.contains(playerMP) && (this.isPlayerWatchingThisChunk(playerMP) || this.trackedEntity.forceSpawn)) + { + this.trackingPlayers.add(playerMP); + Packet packet = this.func_151260_c(); + playerMP.playerNetServerHandler.sendPacket(packet); + + if (!this.trackedEntity.getDataWatcher().getIsBlank()) + { + playerMP.playerNetServerHandler.sendPacket(new S1CPacketEntityMetadata(this.trackedEntity.getEntityId(), this.trackedEntity.getDataWatcher(), true)); + } + + NBTTagCompound nbttagcompound = this.trackedEntity.getNBTTagCompound(); + + if (nbttagcompound != null) + { + playerMP.playerNetServerHandler.sendPacket(new S49PacketUpdateEntityNBT(this.trackedEntity.getEntityId(), nbttagcompound)); + } + + if (this.trackedEntity instanceof EntityLivingBase) + { + ServersideAttributeMap serversideattributemap = (ServersideAttributeMap)((EntityLivingBase)this.trackedEntity).getAttributeMap(); + Collection collection = serversideattributemap.getWatchedAttributes(); + + if (!collection.isEmpty()) + { + playerMP.playerNetServerHandler.sendPacket(new S20PacketEntityProperties(this.trackedEntity.getEntityId(), collection)); + } + } + + this.lastTrackedEntityMotionX = this.trackedEntity.motionX; + this.lastTrackedEntityMotionY = this.trackedEntity.motionY; + this.motionZ = this.trackedEntity.motionZ; + + if (this.sendVelocityUpdates && !(packet instanceof S0FPacketSpawnMob)) + { + playerMP.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(this.trackedEntity.getEntityId(), this.trackedEntity.motionX, this.trackedEntity.motionY, this.trackedEntity.motionZ)); + } + + if (this.trackedEntity.ridingEntity != null) + { + playerMP.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(0, this.trackedEntity, this.trackedEntity.ridingEntity)); + } + + if (this.trackedEntity instanceof EntityLiving && ((EntityLiving)this.trackedEntity).getLeashedToEntity() != null) + { + playerMP.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(1, this.trackedEntity, ((EntityLiving)this.trackedEntity).getLeashedToEntity())); + } + + if (this.trackedEntity instanceof EntityLivingBase) + { + for (int i = 0; i < 5; ++i) + { + ItemStack itemstack = ((EntityLivingBase)this.trackedEntity).getEquipmentInSlot(i); + + if (itemstack != null) + { + playerMP.playerNetServerHandler.sendPacket(new S04PacketEntityEquipment(this.trackedEntity.getEntityId(), i, itemstack)); + } + } + } + + if (this.trackedEntity instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)this.trackedEntity; + + if (entityplayer.isPlayerSleeping()) + { + playerMP.playerNetServerHandler.sendPacket(new S0APacketUseBed(entityplayer, new BlockPos(this.trackedEntity))); + } + } + + if (this.trackedEntity instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)this.trackedEntity; + + for (PotionEffect potioneffect : entitylivingbase.getActivePotionEffects()) + { + playerMP.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.trackedEntity.getEntityId(), potioneffect)); + } + } + } + } + else if (this.trackingPlayers.contains(playerMP)) + { + this.trackingPlayers.remove(playerMP); + playerMP.removeEntity(this.trackedEntity); + } + } + } + + public boolean func_180233_c(EntityPlayerMP playerMP) + { + double d0 = playerMP.posX - (double)(this.encodedPosX / 32); + double d1 = playerMP.posZ - (double)(this.encodedPosZ / 32); + return d0 >= (double)(-this.trackingDistanceThreshold) && d0 <= (double)this.trackingDistanceThreshold && d1 >= (double)(-this.trackingDistanceThreshold) && d1 <= (double)this.trackingDistanceThreshold && this.trackedEntity.isSpectatedByPlayer(playerMP); + } + + private boolean isPlayerWatchingThisChunk(EntityPlayerMP playerMP) + { + return playerMP.getServerForPlayer().getPlayerManager().isPlayerWatchingChunk(playerMP, this.trackedEntity.chunkCoordX, this.trackedEntity.chunkCoordZ); + } + + public void updatePlayerEntities(List p_73125_1_) + { + for (int i = 0; i < p_73125_1_.size(); ++i) + { + this.updatePlayerEntity((EntityPlayerMP)p_73125_1_.get(i)); + } + } + + private Packet func_151260_c() + { + if (this.trackedEntity.isDead) + { + logger.warn("Fetching addPacket for removed entity"); + } + + if (this.trackedEntity instanceof EntityItem) + { + return new S0EPacketSpawnObject(this.trackedEntity, 2, 1); + } + else if (this.trackedEntity instanceof EntityPlayerMP) + { + return new S0CPacketSpawnPlayer((EntityPlayer)this.trackedEntity); + } + else if (this.trackedEntity instanceof EntityMinecart) + { + EntityMinecart entityminecart = (EntityMinecart)this.trackedEntity; + return new S0EPacketSpawnObject(this.trackedEntity, 10, entityminecart.getMinecartType().getNetworkID()); + } + else if (this.trackedEntity instanceof EntityBoat) + { + return new S0EPacketSpawnObject(this.trackedEntity, 1); + } + else if (this.trackedEntity instanceof IAnimals) + { + this.lastHeadMotion = MathHelper.floor_float(this.trackedEntity.getRotationYawHead() * 256.0F / 360.0F); + return new S0FPacketSpawnMob((EntityLivingBase)this.trackedEntity); + } + else if (this.trackedEntity instanceof EntityFishHook) + { + Entity entity1 = ((EntityFishHook)this.trackedEntity).angler; + return new S0EPacketSpawnObject(this.trackedEntity, 90, entity1 != null ? entity1.getEntityId() : this.trackedEntity.getEntityId()); + } + else if (this.trackedEntity instanceof EntityArrow) + { + Entity entity = ((EntityArrow)this.trackedEntity).shootingEntity; + return new S0EPacketSpawnObject(this.trackedEntity, 60, entity != null ? entity.getEntityId() : this.trackedEntity.getEntityId()); + } + else if (this.trackedEntity instanceof EntitySnowball) + { + return new S0EPacketSpawnObject(this.trackedEntity, 61); + } + else if (this.trackedEntity instanceof EntityPotion) + { + return new S0EPacketSpawnObject(this.trackedEntity, 73, ((EntityPotion)this.trackedEntity).getPotionDamage()); + } + else if (this.trackedEntity instanceof EntityExpBottle) + { + return new S0EPacketSpawnObject(this.trackedEntity, 75); + } + else if (this.trackedEntity instanceof EntityEnderPearl) + { + return new S0EPacketSpawnObject(this.trackedEntity, 65); + } + else if (this.trackedEntity instanceof EntityEnderEye) + { + return new S0EPacketSpawnObject(this.trackedEntity, 72); + } + else if (this.trackedEntity instanceof EntityFireworkRocket) + { + return new S0EPacketSpawnObject(this.trackedEntity, 76); + } + else if (this.trackedEntity instanceof EntityFireball) + { + EntityFireball entityfireball = (EntityFireball)this.trackedEntity; + S0EPacketSpawnObject s0epacketspawnobject2 = null; + int i = 63; + + if (this.trackedEntity instanceof EntitySmallFireball) + { + i = 64; + } + else if (this.trackedEntity instanceof EntityWitherSkull) + { + i = 66; + } + + if (entityfireball.shootingEntity != null) + { + s0epacketspawnobject2 = new S0EPacketSpawnObject(this.trackedEntity, i, ((EntityFireball)this.trackedEntity).shootingEntity.getEntityId()); + } + else + { + s0epacketspawnobject2 = new S0EPacketSpawnObject(this.trackedEntity, i, 0); + } + + s0epacketspawnobject2.setSpeedX((int)(entityfireball.accelerationX * 8000.0D)); + s0epacketspawnobject2.setSpeedY((int)(entityfireball.accelerationY * 8000.0D)); + s0epacketspawnobject2.setSpeedZ((int)(entityfireball.accelerationZ * 8000.0D)); + return s0epacketspawnobject2; + } + else if (this.trackedEntity instanceof EntityEgg) + { + return new S0EPacketSpawnObject(this.trackedEntity, 62); + } + else if (this.trackedEntity instanceof EntityTNTPrimed) + { + return new S0EPacketSpawnObject(this.trackedEntity, 50); + } + else if (this.trackedEntity instanceof EntityEnderCrystal) + { + return new S0EPacketSpawnObject(this.trackedEntity, 51); + } + else if (this.trackedEntity instanceof EntityFallingBlock) + { + EntityFallingBlock entityfallingblock = (EntityFallingBlock)this.trackedEntity; + return new S0EPacketSpawnObject(this.trackedEntity, 70, Block.getStateId(entityfallingblock.getBlock())); + } + else if (this.trackedEntity instanceof EntityArmorStand) + { + return new S0EPacketSpawnObject(this.trackedEntity, 78); + } + else if (this.trackedEntity instanceof EntityPainting) + { + return new S10PacketSpawnPainting((EntityPainting)this.trackedEntity); + } + else if (this.trackedEntity instanceof EntityItemFrame) + { + EntityItemFrame entityitemframe = (EntityItemFrame)this.trackedEntity; + S0EPacketSpawnObject s0epacketspawnobject1 = new S0EPacketSpawnObject(this.trackedEntity, 71, entityitemframe.facingDirection.getHorizontalIndex()); + BlockPos blockpos1 = entityitemframe.getHangingPosition(); + s0epacketspawnobject1.setX(MathHelper.floor_float((float)(blockpos1.getX() * 32))); + s0epacketspawnobject1.setY(MathHelper.floor_float((float)(blockpos1.getY() * 32))); + s0epacketspawnobject1.setZ(MathHelper.floor_float((float)(blockpos1.getZ() * 32))); + return s0epacketspawnobject1; + } + else if (this.trackedEntity instanceof EntityLeashKnot) + { + EntityLeashKnot entityleashknot = (EntityLeashKnot)this.trackedEntity; + S0EPacketSpawnObject s0epacketspawnobject = new S0EPacketSpawnObject(this.trackedEntity, 77); + BlockPos blockpos = entityleashknot.getHangingPosition(); + s0epacketspawnobject.setX(MathHelper.floor_float((float)(blockpos.getX() * 32))); + s0epacketspawnobject.setY(MathHelper.floor_float((float)(blockpos.getY() * 32))); + s0epacketspawnobject.setZ(MathHelper.floor_float((float)(blockpos.getZ() * 32))); + return s0epacketspawnobject; + } + else if (this.trackedEntity instanceof EntityXPOrb) + { + return new S11PacketSpawnExperienceOrb((EntityXPOrb)this.trackedEntity); + } + else + { + throw new IllegalArgumentException("Don\'t know how to add " + this.trackedEntity.getClass() + "!"); + } + } + + /** + * Remove a tracked player from our list and tell the tracked player to destroy us from their world. + */ + public void removeTrackedPlayerSymmetric(EntityPlayerMP playerMP) + { + if (this.trackingPlayers.contains(playerMP)) + { + this.trackingPlayers.remove(playerMP); + playerMP.removeEntity(this.trackedEntity); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/EnumCreatureAttribute.java b/src/minecraft/net/minecraft/entity/EnumCreatureAttribute.java new file mode 100644 index 0000000..98b58e4 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EnumCreatureAttribute.java @@ -0,0 +1,8 @@ +package net.minecraft.entity; + +public enum EnumCreatureAttribute +{ + UNDEFINED, + UNDEAD, + ARTHROPOD; +} diff --git a/src/minecraft/net/minecraft/entity/EnumCreatureType.java b/src/minecraft/net/minecraft/entity/EnumCreatureType.java new file mode 100644 index 0000000..4823057 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/EnumCreatureType.java @@ -0,0 +1,61 @@ +package net.minecraft.entity; + +import net.minecraft.block.material.Material; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.passive.EntityAmbientCreature; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityWaterMob; +import net.minecraft.entity.passive.IAnimals; + +public enum EnumCreatureType +{ + MONSTER(IMob.class, 70, Material.air, false, false), + CREATURE(EntityAnimal.class, 10, Material.air, true, true), + AMBIENT(EntityAmbientCreature.class, 15, Material.air, true, false), + WATER_CREATURE(EntityWaterMob.class, 5, Material.water, true, false); + + private final Class creatureClass; + private final int maxNumberOfCreature; + private final Material creatureMaterial; + + /** A flag indicating whether this creature type is peaceful. */ + private final boolean isPeacefulCreature; + + /** Whether this creature type is an animal. */ + private final boolean isAnimal; + + private EnumCreatureType(Class creatureClassIn, int maxNumberOfCreatureIn, Material creatureMaterialIn, boolean isPeacefulCreatureIn, boolean isAnimalIn) + { + this.creatureClass = creatureClassIn; + this.maxNumberOfCreature = maxNumberOfCreatureIn; + this.creatureMaterial = creatureMaterialIn; + this.isPeacefulCreature = isPeacefulCreatureIn; + this.isAnimal = isAnimalIn; + } + + public Class getCreatureClass() + { + return this.creatureClass; + } + + public int getMaxNumberOfCreature() + { + return this.maxNumberOfCreature; + } + + /** + * Gets whether or not this creature type is peaceful. + */ + public boolean getPeacefulCreature() + { + return this.isPeacefulCreature; + } + + /** + * Return whether this creature type is an animal. + */ + public boolean getAnimal() + { + return this.isAnimal; + } +} diff --git a/src/minecraft/net/minecraft/entity/IEntityLivingData.java b/src/minecraft/net/minecraft/entity/IEntityLivingData.java new file mode 100644 index 0000000..88d7978 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/IEntityLivingData.java @@ -0,0 +1,5 @@ +package net.minecraft.entity; + +public interface IEntityLivingData +{ +} diff --git a/src/minecraft/net/minecraft/entity/IEntityMultiPart.java b/src/minecraft/net/minecraft/entity/IEntityMultiPart.java new file mode 100644 index 0000000..ff81a47 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/IEntityMultiPart.java @@ -0,0 +1,12 @@ +package net.minecraft.entity; + +import net.minecraft.entity.boss.EntityDragonPart; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; + +public interface IEntityMultiPart +{ + World getWorld(); + + boolean attackEntityFromPart(EntityDragonPart dragonPart, DamageSource source, float p_70965_3_); +} diff --git a/src/minecraft/net/minecraft/entity/IEntityOwnable.java b/src/minecraft/net/minecraft/entity/IEntityOwnable.java new file mode 100644 index 0000000..7049d78 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/IEntityOwnable.java @@ -0,0 +1,8 @@ +package net.minecraft.entity; + +public interface IEntityOwnable +{ + String getOwnerId(); + + Entity getOwner(); +} diff --git a/src/minecraft/net/minecraft/entity/IMerchant.java b/src/minecraft/net/minecraft/entity/IMerchant.java new file mode 100644 index 0000000..4be0a41 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/IMerchant.java @@ -0,0 +1,31 @@ +package net.minecraft.entity; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IChatComponent; +import net.minecraft.village.MerchantRecipe; +import net.minecraft.village.MerchantRecipeList; + +public interface IMerchant +{ + void setCustomer(EntityPlayer p_70932_1_); + + EntityPlayer getCustomer(); + + MerchantRecipeList getRecipes(EntityPlayer p_70934_1_); + + void setRecipes(MerchantRecipeList recipeList); + + void useRecipe(MerchantRecipe recipe); + + /** + * Notifies the merchant of a possible merchantrecipe being fulfilled or not. Usually, this is just a sound byte + * being played depending if the suggested itemstack is not null. + */ + void verifySellingItem(ItemStack stack); + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + IChatComponent getDisplayName(); +} diff --git a/src/minecraft/net/minecraft/entity/INpc.java b/src/minecraft/net/minecraft/entity/INpc.java new file mode 100644 index 0000000..6975add --- /dev/null +++ b/src/minecraft/net/minecraft/entity/INpc.java @@ -0,0 +1,7 @@ +package net.minecraft.entity; + +import net.minecraft.entity.passive.IAnimals; + +public interface INpc extends IAnimals +{ +} diff --git a/src/minecraft/net/minecraft/entity/IProjectile.java b/src/minecraft/net/minecraft/entity/IProjectile.java new file mode 100644 index 0000000..a0767c1 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/IProjectile.java @@ -0,0 +1,9 @@ +package net.minecraft.entity; + +public interface IProjectile +{ + /** + * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction. + */ + void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy); +} diff --git a/src/minecraft/net/minecraft/entity/IRangedAttackMob.java b/src/minecraft/net/minecraft/entity/IRangedAttackMob.java new file mode 100644 index 0000000..cf27fa2 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/IRangedAttackMob.java @@ -0,0 +1,9 @@ +package net.minecraft.entity; + +public interface IRangedAttackMob +{ + /** + * Attack the specified entity using a ranged attack. + */ + void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_); +} diff --git a/src/minecraft/net/minecraft/entity/NpcMerchant.java b/src/minecraft/net/minecraft/entity/NpcMerchant.java new file mode 100644 index 0000000..9a6256b --- /dev/null +++ b/src/minecraft/net/minecraft/entity/NpcMerchant.java @@ -0,0 +1,69 @@ +package net.minecraft.entity; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.InventoryMerchant; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; +import net.minecraft.village.MerchantRecipe; +import net.minecraft.village.MerchantRecipeList; + +public class NpcMerchant implements IMerchant +{ + /** Instance of Merchants Inventory. */ + private InventoryMerchant theMerchantInventory; + + /** This merchant's current player customer. */ + private EntityPlayer customer; + + /** The MerchantRecipeList instance. */ + private MerchantRecipeList recipeList; + private IChatComponent field_175548_d; + + public NpcMerchant(EntityPlayer p_i45817_1_, IChatComponent p_i45817_2_) + { + this.customer = p_i45817_1_; + this.field_175548_d = p_i45817_2_; + this.theMerchantInventory = new InventoryMerchant(p_i45817_1_, this); + } + + public EntityPlayer getCustomer() + { + return this.customer; + } + + public void setCustomer(EntityPlayer p_70932_1_) + { + } + + public MerchantRecipeList getRecipes(EntityPlayer p_70934_1_) + { + return this.recipeList; + } + + public void setRecipes(MerchantRecipeList recipeList) + { + this.recipeList = recipeList; + } + + public void useRecipe(MerchantRecipe recipe) + { + recipe.incrementToolUses(); + } + + /** + * Notifies the merchant of a possible merchantrecipe being fulfilled or not. Usually, this is just a sound byte + * being played depending if the suggested itemstack is not null. + */ + public void verifySellingItem(ItemStack stack) + { + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return (IChatComponent)(this.field_175548_d != null ? this.field_175548_d : new ChatComponentTranslation("entity.Villager.name", new Object[0])); + } +} diff --git a/src/minecraft/net/minecraft/entity/SharedMonsterAttributes.java b/src/minecraft/net/minecraft/entity/SharedMonsterAttributes.java new file mode 100644 index 0000000..83c9716 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/SharedMonsterAttributes.java @@ -0,0 +1,144 @@ +package net.minecraft.entity; + +import java.util.Collection; +import java.util.UUID; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.BaseAttributeMap; +import net.minecraft.entity.ai.attributes.IAttribute; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.ai.attributes.RangedAttribute; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class SharedMonsterAttributes +{ + private static final Logger logger = LogManager.getLogger(); + public static final IAttribute maxHealth = (new RangedAttribute((IAttribute)null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)).setDescription("Max Health").setShouldWatch(true); + public static final IAttribute followRange = (new RangedAttribute((IAttribute)null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).setDescription("Follow Range"); + public static final IAttribute knockbackResistance = (new RangedAttribute((IAttribute)null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).setDescription("Knockback Resistance"); + public static final IAttribute movementSpeed = (new RangedAttribute((IAttribute)null, "generic.movementSpeed", 0.699999988079071D, 0.0D, 1024.0D)).setDescription("Movement Speed").setShouldWatch(true); + public static final IAttribute attackDamage = new RangedAttribute((IAttribute)null, "generic.attackDamage", 2.0D, 0.0D, 2048.0D); + + /** + * Creates an NBTTagList from a BaseAttributeMap, including all its AttributeInstances + */ + public static NBTTagList writeBaseAttributeMapToNBT(BaseAttributeMap p_111257_0_) + { + NBTTagList nbttaglist = new NBTTagList(); + + for (IAttributeInstance iattributeinstance : p_111257_0_.getAllAttributes()) + { + nbttaglist.appendTag(writeAttributeInstanceToNBT(iattributeinstance)); + } + + return nbttaglist; + } + + /** + * Creates an NBTTagCompound from an AttributeInstance, including its AttributeModifiers + */ + private static NBTTagCompound writeAttributeInstanceToNBT(IAttributeInstance p_111261_0_) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + IAttribute iattribute = p_111261_0_.getAttribute(); + nbttagcompound.setString("Name", iattribute.getAttributeUnlocalizedName()); + nbttagcompound.setDouble("Base", p_111261_0_.getBaseValue()); + Collection collection = p_111261_0_.func_111122_c(); + + if (collection != null && !collection.isEmpty()) + { + NBTTagList nbttaglist = new NBTTagList(); + + for (AttributeModifier attributemodifier : collection) + { + if (attributemodifier.isSaved()) + { + nbttaglist.appendTag(writeAttributeModifierToNBT(attributemodifier)); + } + } + + nbttagcompound.setTag("Modifiers", nbttaglist); + } + + return nbttagcompound; + } + + /** + * Creates an NBTTagCompound from an AttributeModifier + */ + private static NBTTagCompound writeAttributeModifierToNBT(AttributeModifier p_111262_0_) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("Name", p_111262_0_.getName()); + nbttagcompound.setDouble("Amount", p_111262_0_.getAmount()); + nbttagcompound.setInteger("Operation", p_111262_0_.getOperation()); + nbttagcompound.setLong("UUIDMost", p_111262_0_.getID().getMostSignificantBits()); + nbttagcompound.setLong("UUIDLeast", p_111262_0_.getID().getLeastSignificantBits()); + return nbttagcompound; + } + + public static void func_151475_a(BaseAttributeMap p_151475_0_, NBTTagList p_151475_1_) + { + for (int i = 0; i < p_151475_1_.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = p_151475_1_.getCompoundTagAt(i); + IAttributeInstance iattributeinstance = p_151475_0_.getAttributeInstanceByName(nbttagcompound.getString("Name")); + + if (iattributeinstance != null) + { + applyModifiersToAttributeInstance(iattributeinstance, nbttagcompound); + } + else + { + logger.warn("Ignoring unknown attribute \'" + nbttagcompound.getString("Name") + "\'"); + } + } + } + + private static void applyModifiersToAttributeInstance(IAttributeInstance p_111258_0_, NBTTagCompound p_111258_1_) + { + p_111258_0_.setBaseValue(p_111258_1_.getDouble("Base")); + + if (p_111258_1_.hasKey("Modifiers", 9)) + { + NBTTagList nbttaglist = p_111258_1_.getTagList("Modifiers", 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + AttributeModifier attributemodifier = readAttributeModifierFromNBT(nbttaglist.getCompoundTagAt(i)); + + if (attributemodifier != null) + { + AttributeModifier attributemodifier1 = p_111258_0_.getModifier(attributemodifier.getID()); + + if (attributemodifier1 != null) + { + p_111258_0_.removeModifier(attributemodifier1); + } + + p_111258_0_.applyModifier(attributemodifier); + } + } + } + } + + /** + * Creates an AttributeModifier from an NBTTagCompound + */ + public static AttributeModifier readAttributeModifierFromNBT(NBTTagCompound p_111259_0_) + { + UUID uuid = new UUID(p_111259_0_.getLong("UUIDMost"), p_111259_0_.getLong("UUIDLeast")); + + try + { + return new AttributeModifier(uuid, p_111259_0_.getString("Name"), p_111259_0_.getDouble("Amount"), p_111259_0_.getInteger("Operation")); + } + catch (Exception exception) + { + logger.warn("Unable to create attribute: " + exception.getMessage()); + return null; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIArrowAttack.java b/src/minecraft/net/minecraft/entity/ai/EntityAIArrowAttack.java new file mode 100644 index 0000000..5fd503f --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIArrowAttack.java @@ -0,0 +1,143 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IRangedAttackMob; +import net.minecraft.util.MathHelper; + +public class EntityAIArrowAttack extends EntityAIBase +{ + /** The entity the AI instance has been applied to */ + private final EntityLiving entityHost; + + /** + * The entity (as a RangedAttackMob) the AI instance has been applied to. + */ + private final IRangedAttackMob rangedAttackEntityHost; + private EntityLivingBase attackTarget; + + /** + * A decrementing tick that spawns a ranged attack once this value reaches 0. It is then set back to the + * maxRangedAttackTime. + */ + private int rangedAttackTime; + private double entityMoveSpeed; + private int field_75318_f; + private int field_96561_g; + + /** + * The maximum time the AI has to wait before peforming another ranged attack. + */ + private int maxRangedAttackTime; + private float field_96562_i; + private float maxAttackDistance; + + public EntityAIArrowAttack(IRangedAttackMob attacker, double movespeed, int p_i1649_4_, float p_i1649_5_) + { + this(attacker, movespeed, p_i1649_4_, p_i1649_4_, p_i1649_5_); + } + + public EntityAIArrowAttack(IRangedAttackMob attacker, double movespeed, int p_i1650_4_, int maxAttackTime, float maxAttackDistanceIn) + { + this.rangedAttackTime = -1; + + if (!(attacker instanceof EntityLivingBase)) + { + throw new IllegalArgumentException("ArrowAttackGoal requires Mob implements RangedAttackMob"); + } + else + { + this.rangedAttackEntityHost = attacker; + this.entityHost = (EntityLiving)attacker; + this.entityMoveSpeed = movespeed; + this.field_96561_g = p_i1650_4_; + this.maxRangedAttackTime = maxAttackTime; + this.field_96562_i = maxAttackDistanceIn; + this.maxAttackDistance = maxAttackDistanceIn * maxAttackDistanceIn; + this.setMutexBits(3); + } + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase entitylivingbase = this.entityHost.getAttackTarget(); + + if (entitylivingbase == null) + { + return false; + } + else + { + this.attackTarget = entitylivingbase; + return true; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.shouldExecute() || !this.entityHost.getNavigator().noPath(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.attackTarget = null; + this.field_75318_f = 0; + this.rangedAttackTime = -1; + } + + /** + * Updates the task + */ + public void updateTask() + { + double d0 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.getEntityBoundingBox().minY, this.attackTarget.posZ); + boolean flag = this.entityHost.getEntitySenses().canSee(this.attackTarget); + + if (flag) + { + ++this.field_75318_f; + } + else + { + this.field_75318_f = 0; + } + + if (d0 <= (double)this.maxAttackDistance && this.field_75318_f >= 20) + { + this.entityHost.getNavigator().clearPathEntity(); + } + else + { + this.entityHost.getNavigator().tryMoveToEntityLiving(this.attackTarget, this.entityMoveSpeed); + } + + this.entityHost.getLookHelper().setLookPositionWithEntity(this.attackTarget, 30.0F, 30.0F); + + if (--this.rangedAttackTime == 0) + { + if (d0 > (double)this.maxAttackDistance || !flag) + { + return; + } + + float f = MathHelper.sqrt_double(d0) / this.field_96562_i; + float lvt_5_1_ = MathHelper.clamp_float(f, 0.1F, 1.0F); + this.rangedAttackEntityHost.attackEntityWithRangedAttack(this.attackTarget, lvt_5_1_); + this.rangedAttackTime = MathHelper.floor_float(f * (float)(this.maxRangedAttackTime - this.field_96561_g) + (float)this.field_96561_g); + } + else if (this.rangedAttackTime < 0) + { + float f2 = MathHelper.sqrt_double(d0) / this.field_96562_i; + this.rangedAttackTime = MathHelper.floor_float(f2 * (float)(this.maxRangedAttackTime - this.field_96561_g) + (float)this.field_96561_g); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java b/src/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java new file mode 100644 index 0000000..fda0a76 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIAttackOnCollide.java @@ -0,0 +1,155 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class EntityAIAttackOnCollide extends EntityAIBase +{ + World worldObj; + protected EntityCreature attacker; + + /** + * An amount of decrementing ticks that allows the entity to attack once the tick reaches 0. + */ + int attackTick; + + /** The speed with which the mob will approach the target */ + double speedTowardsTarget; + + /** + * When true, the mob will continue chasing its target, even if it can't find a path to them right now. + */ + boolean longMemory; + + /** The PathEntity of our entity. */ + PathEntity entityPathEntity; + Class classTarget; + private int delayCounter; + private double targetX; + private double targetY; + private double targetZ; + + public EntityAIAttackOnCollide(EntityCreature creature, Class targetClass, double speedIn, boolean useLongMemory) + { + this(creature, speedIn, useLongMemory); + this.classTarget = targetClass; + } + + public EntityAIAttackOnCollide(EntityCreature creature, double speedIn, boolean useLongMemory) + { + this.attacker = creature; + this.worldObj = creature.worldObj; + this.speedTowardsTarget = speedIn; + this.longMemory = useLongMemory; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase entitylivingbase = this.attacker.getAttackTarget(); + + if (entitylivingbase == null) + { + return false; + } + else if (!entitylivingbase.isEntityAlive()) + { + return false; + } + else if (this.classTarget != null && !this.classTarget.isAssignableFrom(entitylivingbase.getClass())) + { + return false; + } + else + { + this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(entitylivingbase); + return this.entityPathEntity != null; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + EntityLivingBase entitylivingbase = this.attacker.getAttackTarget(); + return entitylivingbase == null ? false : (!entitylivingbase.isEntityAlive() ? false : (!this.longMemory ? !this.attacker.getNavigator().noPath() : this.attacker.isWithinHomeDistanceFromPosition(new BlockPos(entitylivingbase)))); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.attacker.getNavigator().setPath(this.entityPathEntity, this.speedTowardsTarget); + this.delayCounter = 0; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.attacker.getNavigator().clearPathEntity(); + } + + /** + * Updates the task + */ + public void updateTask() + { + EntityLivingBase entitylivingbase = this.attacker.getAttackTarget(); + this.attacker.getLookHelper().setLookPositionWithEntity(entitylivingbase, 30.0F, 30.0F); + double d0 = this.attacker.getDistanceSq(entitylivingbase.posX, entitylivingbase.getEntityBoundingBox().minY, entitylivingbase.posZ); + double d1 = this.func_179512_a(entitylivingbase); + --this.delayCounter; + + if ((this.longMemory || this.attacker.getEntitySenses().canSee(entitylivingbase)) && this.delayCounter <= 0 && (this.targetX == 0.0D && this.targetY == 0.0D && this.targetZ == 0.0D || entitylivingbase.getDistanceSq(this.targetX, this.targetY, this.targetZ) >= 1.0D || this.attacker.getRNG().nextFloat() < 0.05F)) + { + this.targetX = entitylivingbase.posX; + this.targetY = entitylivingbase.getEntityBoundingBox().minY; + this.targetZ = entitylivingbase.posZ; + this.delayCounter = 4 + this.attacker.getRNG().nextInt(7); + + if (d0 > 1024.0D) + { + this.delayCounter += 10; + } + else if (d0 > 256.0D) + { + this.delayCounter += 5; + } + + if (!this.attacker.getNavigator().tryMoveToEntityLiving(entitylivingbase, this.speedTowardsTarget)) + { + this.delayCounter += 15; + } + } + + this.attackTick = Math.max(this.attackTick - 1, 0); + + if (d0 <= d1 && this.attackTick <= 0) + { + this.attackTick = 20; + + if (this.attacker.getHeldItem() != null) + { + this.attacker.swingItem(); + } + + this.attacker.attackEntityAsMob(entitylivingbase); + } + } + + protected double func_179512_a(EntityLivingBase attackTarget) + { + return (double)(this.attacker.width * 2.0F * this.attacker.width * 2.0F + attackTarget.width); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIAvoidEntity.java b/src/minecraft/net/minecraft/entity/ai/EntityAIAvoidEntity.java new file mode 100644 index 0000000..230e3e9 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIAvoidEntity.java @@ -0,0 +1,126 @@ +package net.minecraft.entity.ai; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCreature; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.pathfinding.PathNavigate; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.Vec3; + +public class EntityAIAvoidEntity extends EntityAIBase +{ + private final Predicate canBeSeenSelector; + + /** The entity we are attached to */ + protected EntityCreature theEntity; + private double farSpeed; + private double nearSpeed; + protected T closestLivingEntity; + private float avoidDistance; + + /** The PathEntity of our entity */ + private PathEntity entityPathEntity; + + /** The PathNavigate of our entity */ + private PathNavigate entityPathNavigate; + private Class field_181064_i; + private Predicate avoidTargetSelector; + + public EntityAIAvoidEntity(EntityCreature p_i46404_1_, Class p_i46404_2_, float p_i46404_3_, double p_i46404_4_, double p_i46404_6_) + { + this(p_i46404_1_, p_i46404_2_, Predicates.alwaysTrue(), p_i46404_3_, p_i46404_4_, p_i46404_6_); + } + + public EntityAIAvoidEntity(EntityCreature p_i46405_1_, Class p_i46405_2_, Predicate p_i46405_3_, float p_i46405_4_, double p_i46405_5_, double p_i46405_7_) + { + this.canBeSeenSelector = new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_.isEntityAlive() && EntityAIAvoidEntity.this.theEntity.getEntitySenses().canSee(p_apply_1_); + } + }; + this.theEntity = p_i46405_1_; + this.field_181064_i = p_i46405_2_; + this.avoidTargetSelector = p_i46405_3_; + this.avoidDistance = p_i46405_4_; + this.farSpeed = p_i46405_5_; + this.nearSpeed = p_i46405_7_; + this.entityPathNavigate = p_i46405_1_.getNavigator(); + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + List list = this.theEntity.worldObj.getEntitiesWithinAABB(this.field_181064_i, this.theEntity.getEntityBoundingBox().expand((double)this.avoidDistance, 3.0D, (double)this.avoidDistance), Predicates.and(new Predicate[] {EntitySelectors.NOT_SPECTATING, this.canBeSeenSelector, this.avoidTargetSelector})); + + if (list.isEmpty()) + { + return false; + } + else + { + this.closestLivingEntity = list.get(0); + Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockAwayFrom(this.theEntity, 16, 7, new Vec3(this.closestLivingEntity.posX, this.closestLivingEntity.posY, this.closestLivingEntity.posZ)); + + if (vec3 == null) + { + return false; + } + else if (this.closestLivingEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity)) + { + return false; + } + else + { + this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(vec3.xCoord, vec3.yCoord, vec3.zCoord); + return this.entityPathEntity == null ? false : this.entityPathEntity.isDestinationSame(vec3); + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.entityPathNavigate.noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.entityPathNavigate.setPath(this.entityPathEntity, this.farSpeed); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.closestLivingEntity = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + if (this.theEntity.getDistanceSqToEntity(this.closestLivingEntity) < 49.0D) + { + this.theEntity.getNavigator().setSpeed(this.nearSpeed); + } + else + { + this.theEntity.getNavigator().setSpeed(this.farSpeed); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIBase.java b/src/minecraft/net/minecraft/entity/ai/EntityAIBase.java new file mode 100644 index 0000000..47476e4 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIBase.java @@ -0,0 +1,71 @@ +package net.minecraft.entity.ai; + +public abstract class EntityAIBase +{ + /** + * A bitmask telling which other tasks may not run concurrently. The test is a simple bitwise AND - if it yields + * zero, the two tasks may run concurrently, if not - they must run exclusively from each other. + */ + private int mutexBits; + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public abstract boolean shouldExecute(); + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.shouldExecute(); + } + + /** + * Determine if this AI Task is interruptible by a higher (= lower value) priority task. All vanilla AITask have + * this value set to true. + */ + public boolean isInterruptible() + { + return true; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + } + + /** + * Resets the task + */ + public void resetTask() + { + } + + /** + * Updates the task + */ + public void updateTask() + { + } + + /** + * Sets a bitmask telling which other tasks may not run concurrently. The test is a simple bitwise AND - if it + * yields zero, the two tasks may run concurrently, if not - they must run exclusively from each other. + */ + public void setMutexBits(int mutexBitsIn) + { + this.mutexBits = mutexBitsIn; + } + + /** + * Get a bitmask telling which other tasks may not run concurrently. The test is a simple bitwise AND - if it yields + * zero, the two tasks may run concurrently, if not - they must run exclusively from each other. + */ + public int getMutexBits() + { + return this.mutexBits; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIBeg.java b/src/minecraft/net/minecraft/entity/ai/EntityAIBeg.java new file mode 100644 index 0000000..496e7ae --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIBeg.java @@ -0,0 +1,77 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class EntityAIBeg extends EntityAIBase +{ + private EntityWolf theWolf; + private EntityPlayer thePlayer; + private World worldObject; + private float minPlayerDistance; + private int timeoutCounter; + + public EntityAIBeg(EntityWolf wolf, float minDistance) + { + this.theWolf = wolf; + this.worldObject = wolf.worldObj; + this.minPlayerDistance = minDistance; + this.setMutexBits(2); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + this.thePlayer = this.worldObject.getClosestPlayerToEntity(this.theWolf, (double)this.minPlayerDistance); + return this.thePlayer == null ? false : this.hasPlayerGotBoneInHand(this.thePlayer); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.thePlayer.isEntityAlive() ? false : (this.theWolf.getDistanceSqToEntity(this.thePlayer) > (double)(this.minPlayerDistance * this.minPlayerDistance) ? false : this.timeoutCounter > 0 && this.hasPlayerGotBoneInHand(this.thePlayer)); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theWolf.setBegging(true); + this.timeoutCounter = 40 + this.theWolf.getRNG().nextInt(40); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theWolf.setBegging(false); + this.thePlayer = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theWolf.getLookHelper().setLookPosition(this.thePlayer.posX, this.thePlayer.posY + (double)this.thePlayer.getEyeHeight(), this.thePlayer.posZ, 10.0F, (float)this.theWolf.getVerticalFaceSpeed()); + --this.timeoutCounter; + } + + /** + * Gets if the Player has the Bone in the hand. + */ + private boolean hasPlayerGotBoneInHand(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + return itemstack == null ? false : (!this.theWolf.isTamed() && itemstack.getItem() == Items.bone ? true : this.theWolf.isBreedingItem(itemstack)); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIBreakDoor.java b/src/minecraft/net/minecraft/entity/ai/EntityAIBreakDoor.java new file mode 100644 index 0000000..b6ca928 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIBreakDoor.java @@ -0,0 +1,107 @@ +package net.minecraft.entity.ai; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockDoor; +import net.minecraft.entity.EntityLiving; +import net.minecraft.world.EnumDifficulty; + +public class EntityAIBreakDoor extends EntityAIDoorInteract +{ + private int breakingTime; + private int previousBreakProgress = -1; + + public EntityAIBreakDoor(EntityLiving entityIn) + { + super(entityIn); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!super.shouldExecute()) + { + return false; + } + else if (!this.theEntity.worldObj.getGameRules().getBoolean("mobGriefing")) + { + return false; + } + else + { + BlockDoor blockdoor = this.doorBlock; + return !BlockDoor.isOpen(this.theEntity.worldObj, this.doorPosition); + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + super.startExecuting(); + this.breakingTime = 0; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + double d0 = this.theEntity.getDistanceSq(this.doorPosition); + boolean flag; + + if (this.breakingTime <= 240) + { + BlockDoor blockdoor = this.doorBlock; + + if (!BlockDoor.isOpen(this.theEntity.worldObj, this.doorPosition) && d0 < 4.0D) + { + flag = true; + return flag; + } + } + + flag = false; + return flag; + } + + /** + * Resets the task + */ + public void resetTask() + { + super.resetTask(); + this.theEntity.worldObj.sendBlockBreakProgress(this.theEntity.getEntityId(), this.doorPosition, -1); + } + + /** + * Updates the task + */ + public void updateTask() + { + super.updateTask(); + + if (this.theEntity.getRNG().nextInt(20) == 0) + { + this.theEntity.worldObj.playAuxSFX(1010, this.doorPosition, 0); + } + + ++this.breakingTime; + int i = (int)((float)this.breakingTime / 240.0F * 10.0F); + + if (i != this.previousBreakProgress) + { + this.theEntity.worldObj.sendBlockBreakProgress(this.theEntity.getEntityId(), this.doorPosition, i); + this.previousBreakProgress = i; + } + + if (this.breakingTime == 240 && this.theEntity.worldObj.getDifficulty() == EnumDifficulty.HARD) + { + this.theEntity.worldObj.setBlockToAir(this.doorPosition); + this.theEntity.worldObj.playAuxSFX(1012, this.doorPosition, 0); + this.theEntity.worldObj.playAuxSFX(2001, this.doorPosition, Block.getIdFromBlock(this.doorBlock)); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIControlledByPlayer.java b/src/minecraft/net/minecraft/entity/ai/EntityAIControlledByPlayer.java new file mode 100644 index 0000000..da9df1b --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIControlledByPlayer.java @@ -0,0 +1,227 @@ +package net.minecraft.entity.ai; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockSlab; +import net.minecraft.block.BlockStairs; +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.pathfinder.WalkNodeProcessor; + +public class EntityAIControlledByPlayer extends EntityAIBase +{ + private final EntityLiving thisEntity; + private final float maxSpeed; + private float currentSpeed; + + /** Whether the entity's speed is boosted. */ + private boolean speedBoosted; + + /** + * Counter for speed boosting, upon reaching maxSpeedBoostTime the speed boost will be disabled + */ + private int speedBoostTime; + + /** Maximum time the entity's speed should be boosted for. */ + private int maxSpeedBoostTime; + + public EntityAIControlledByPlayer(EntityLiving entitylivingIn, float maxspeed) + { + this.thisEntity = entitylivingIn; + this.maxSpeed = maxspeed; + this.setMutexBits(7); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.currentSpeed = 0.0F; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.speedBoosted = false; + this.currentSpeed = 0.0F; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return this.thisEntity.isEntityAlive() && this.thisEntity.riddenByEntity != null && this.thisEntity.riddenByEntity instanceof EntityPlayer && (this.speedBoosted || this.thisEntity.canBeSteered()); + } + + /** + * Updates the task + */ + public void updateTask() + { + EntityPlayer entityplayer = (EntityPlayer)this.thisEntity.riddenByEntity; + EntityCreature entitycreature = (EntityCreature)this.thisEntity; + float f = MathHelper.wrapAngleTo180_float(entityplayer.rotationYaw - this.thisEntity.rotationYaw) * 0.5F; + + if (f > 5.0F) + { + f = 5.0F; + } + + if (f < -5.0F) + { + f = -5.0F; + } + + this.thisEntity.rotationYaw = MathHelper.wrapAngleTo180_float(this.thisEntity.rotationYaw + f); + + if (this.currentSpeed < this.maxSpeed) + { + this.currentSpeed += (this.maxSpeed - this.currentSpeed) * 0.01F; + } + + if (this.currentSpeed > this.maxSpeed) + { + this.currentSpeed = this.maxSpeed; + } + + int i = MathHelper.floor_double(this.thisEntity.posX); + int j = MathHelper.floor_double(this.thisEntity.posY); + int k = MathHelper.floor_double(this.thisEntity.posZ); + float f1 = this.currentSpeed; + + if (this.speedBoosted) + { + if (this.speedBoostTime++ > this.maxSpeedBoostTime) + { + this.speedBoosted = false; + } + + f1 += f1 * 1.15F * MathHelper.sin((float)this.speedBoostTime / (float)this.maxSpeedBoostTime * (float)Math.PI); + } + + float f2 = 0.91F; + + if (this.thisEntity.onGround) + { + f2 = this.thisEntity.worldObj.getBlockState(new BlockPos(MathHelper.floor_float((float)i), MathHelper.floor_float((float)j) - 1, MathHelper.floor_float((float)k))).getBlock().slipperiness * 0.91F; + } + + float f3 = 0.16277136F / (f2 * f2 * f2); + float f4 = MathHelper.sin(entitycreature.rotationYaw * (float)Math.PI / 180.0F); + float f5 = MathHelper.cos(entitycreature.rotationYaw * (float)Math.PI / 180.0F); + float f6 = entitycreature.getAIMoveSpeed() * f3; + float f7 = Math.max(f1, 1.0F); + f7 = f6 / f7; + float f8 = f1 * f7; + float f9 = -(f8 * f4); + float f10 = f8 * f5; + + if (MathHelper.abs(f9) > MathHelper.abs(f10)) + { + if (f9 < 0.0F) + { + f9 -= this.thisEntity.width / 2.0F; + } + + if (f9 > 0.0F) + { + f9 += this.thisEntity.width / 2.0F; + } + + f10 = 0.0F; + } + else + { + f9 = 0.0F; + + if (f10 < 0.0F) + { + f10 -= this.thisEntity.width / 2.0F; + } + + if (f10 > 0.0F) + { + f10 += this.thisEntity.width / 2.0F; + } + } + + int l = MathHelper.floor_double(this.thisEntity.posX + (double)f9); + int i1 = MathHelper.floor_double(this.thisEntity.posZ + (double)f10); + int j1 = MathHelper.floor_float(this.thisEntity.width + 1.0F); + int k1 = MathHelper.floor_float(this.thisEntity.height + entityplayer.height + 1.0F); + int l1 = MathHelper.floor_float(this.thisEntity.width + 1.0F); + + if (i != l || k != i1) + { + Block block = this.thisEntity.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock(); + boolean flag = !this.isStairOrSlab(block) && (block.getMaterial() != Material.air || !this.isStairOrSlab(this.thisEntity.worldObj.getBlockState(new BlockPos(i, j - 1, k)).getBlock())); + + if (flag && 0 == WalkNodeProcessor.func_176170_a(this.thisEntity.worldObj, this.thisEntity, l, j, i1, j1, k1, l1, false, false, true) && 1 == WalkNodeProcessor.func_176170_a(this.thisEntity.worldObj, this.thisEntity, i, j + 1, k, j1, k1, l1, false, false, true) && 1 == WalkNodeProcessor.func_176170_a(this.thisEntity.worldObj, this.thisEntity, l, j + 1, i1, j1, k1, l1, false, false, true)) + { + entitycreature.getJumpHelper().setJumping(); + } + } + + if (!entityplayer.capabilities.isCreativeMode && this.currentSpeed >= this.maxSpeed * 0.5F && this.thisEntity.getRNG().nextFloat() < 0.006F && !this.speedBoosted) + { + ItemStack itemstack = entityplayer.getHeldItem(); + + if (itemstack != null && itemstack.getItem() == Items.carrot_on_a_stick) + { + itemstack.damageItem(1, entityplayer); + + if (itemstack.stackSize == 0) + { + ItemStack itemstack1 = new ItemStack(Items.fishing_rod); + itemstack1.setTagCompound(itemstack.getTagCompound()); + entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = itemstack1; + } + } + } + + this.thisEntity.moveEntityWithHeading(0.0F, f1); + } + + /** + * True if the block is a stair block or a slab block + */ + private boolean isStairOrSlab(Block blockIn) + { + return blockIn instanceof BlockStairs || blockIn instanceof BlockSlab; + } + + /** + * Return whether the entity's speed is boosted. + */ + public boolean isSpeedBoosted() + { + return this.speedBoosted; + } + + /** + * Boost the entity's movement speed. + */ + public void boostSpeed() + { + this.speedBoosted = true; + this.speedBoostTime = 0; + this.maxSpeedBoostTime = this.thisEntity.getRNG().nextInt(841) + 140; + } + + /** + * Return whether the entity is being controlled by a player. + */ + public boolean isControlledByPlayer() + { + return !this.isSpeedBoosted() && this.currentSpeed > this.maxSpeed * 0.3F; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAICreeperSwell.java b/src/minecraft/net/minecraft/entity/ai/EntityAICreeperSwell.java new file mode 100644 index 0000000..355b446 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAICreeperSwell.java @@ -0,0 +1,70 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityCreeper; + +public class EntityAICreeperSwell extends EntityAIBase +{ + /** The creeper that is swelling. */ + EntityCreeper swellingCreeper; + + /** + * The creeper's attack target. This is used for the changing of the creeper's state. + */ + EntityLivingBase creeperAttackTarget; + + public EntityAICreeperSwell(EntityCreeper entitycreeperIn) + { + this.swellingCreeper = entitycreeperIn; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase entitylivingbase = this.swellingCreeper.getAttackTarget(); + return this.swellingCreeper.getCreeperState() > 0 || entitylivingbase != null && this.swellingCreeper.getDistanceSqToEntity(entitylivingbase) < 9.0D; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.swellingCreeper.getNavigator().clearPathEntity(); + this.creeperAttackTarget = this.swellingCreeper.getAttackTarget(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.creeperAttackTarget = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + if (this.creeperAttackTarget == null) + { + this.swellingCreeper.setCreeperState(-1); + } + else if (this.swellingCreeper.getDistanceSqToEntity(this.creeperAttackTarget) > 49.0D) + { + this.swellingCreeper.setCreeperState(-1); + } + else if (!this.swellingCreeper.getEntitySenses().canSee(this.creeperAttackTarget)) + { + this.swellingCreeper.setCreeperState(-1); + } + else + { + this.swellingCreeper.setCreeperState(1); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIDefendVillage.java b/src/minecraft/net/minecraft/entity/ai/EntityAIDefendVillage.java new file mode 100644 index 0000000..f287e62 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIDefendVillage.java @@ -0,0 +1,70 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.village.Village; + +public class EntityAIDefendVillage extends EntityAITarget +{ + EntityIronGolem irongolem; + + /** + * The aggressor of the iron golem's village which is now the golem's attack target. + */ + EntityLivingBase villageAgressorTarget; + + public EntityAIDefendVillage(EntityIronGolem ironGolemIn) + { + super(ironGolemIn, false, true); + this.irongolem = ironGolemIn; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + Village village = this.irongolem.getVillage(); + + if (village == null) + { + return false; + } + else + { + this.villageAgressorTarget = village.findNearestVillageAggressor(this.irongolem); + + if (this.villageAgressorTarget instanceof EntityCreeper) + { + return false; + } + else if (!this.isSuitableTarget(this.villageAgressorTarget, false)) + { + if (this.taskOwner.getRNG().nextInt(20) == 0) + { + this.villageAgressorTarget = village.getNearestTargetPlayer(this.irongolem); + return this.isSuitableTarget(this.villageAgressorTarget, false); + } + else + { + return false; + } + } + else + { + return true; + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.irongolem.setAttackTarget(this.villageAgressorTarget); + super.startExecuting(); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIDoorInteract.java b/src/minecraft/net/minecraft/entity/ai/EntityAIDoorInteract.java new file mode 100644 index 0000000..5871dcc --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIDoorInteract.java @@ -0,0 +1,118 @@ +package net.minecraft.entity.ai; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityLiving; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.pathfinding.PathPoint; +import net.minecraft.util.BlockPos; + +public abstract class EntityAIDoorInteract extends EntityAIBase +{ + protected EntityLiving theEntity; + protected BlockPos doorPosition = BlockPos.ORIGIN; + + /** The wooden door block */ + protected BlockDoor doorBlock; + + /** + * If is true then the Entity has stopped Door Interaction and compoleted the task. + */ + boolean hasStoppedDoorInteraction; + float entityPositionX; + float entityPositionZ; + + public EntityAIDoorInteract(EntityLiving entityIn) + { + this.theEntity = entityIn; + + if (!(entityIn.getNavigator() instanceof PathNavigateGround)) + { + throw new IllegalArgumentException("Unsupported mob type for DoorInteractGoal"); + } + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theEntity.isCollidedHorizontally) + { + return false; + } + else + { + PathNavigateGround pathnavigateground = (PathNavigateGround)this.theEntity.getNavigator(); + PathEntity pathentity = pathnavigateground.getPath(); + + if (pathentity != null && !pathentity.isFinished() && pathnavigateground.getEnterDoors()) + { + for (int i = 0; i < Math.min(pathentity.getCurrentPathIndex() + 2, pathentity.getCurrentPathLength()); ++i) + { + PathPoint pathpoint = pathentity.getPathPointFromIndex(i); + this.doorPosition = new BlockPos(pathpoint.xCoord, pathpoint.yCoord + 1, pathpoint.zCoord); + + if (this.theEntity.getDistanceSq((double)this.doorPosition.getX(), this.theEntity.posY, (double)this.doorPosition.getZ()) <= 2.25D) + { + this.doorBlock = this.getBlockDoor(this.doorPosition); + + if (this.doorBlock != null) + { + return true; + } + } + } + + this.doorPosition = (new BlockPos(this.theEntity)).up(); + this.doorBlock = this.getBlockDoor(this.doorPosition); + return this.doorBlock != null; + } + else + { + return false; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.hasStoppedDoorInteraction; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.hasStoppedDoorInteraction = false; + this.entityPositionX = (float)((double)((float)this.doorPosition.getX() + 0.5F) - this.theEntity.posX); + this.entityPositionZ = (float)((double)((float)this.doorPosition.getZ() + 0.5F) - this.theEntity.posZ); + } + + /** + * Updates the task + */ + public void updateTask() + { + float f = (float)((double)((float)this.doorPosition.getX() + 0.5F) - this.theEntity.posX); + float f1 = (float)((double)((float)this.doorPosition.getZ() + 0.5F) - this.theEntity.posZ); + float f2 = this.entityPositionX * f + this.entityPositionZ * f1; + + if (f2 < 0.0F) + { + this.hasStoppedDoorInteraction = true; + } + } + + private BlockDoor getBlockDoor(BlockPos pos) + { + Block block = this.theEntity.worldObj.getBlockState(pos).getBlock(); + return block instanceof BlockDoor && block.getMaterial() == Material.wood ? (BlockDoor)block : null; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIEatGrass.java b/src/minecraft/net/minecraft/entity/ai/EntityAIEatGrass.java new file mode 100644 index 0000000..34c78da --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIEatGrass.java @@ -0,0 +1,121 @@ +package net.minecraft.entity.ai; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import net.minecraft.block.Block; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.pattern.BlockStateHelper; +import net.minecraft.entity.EntityLiving; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class EntityAIEatGrass extends EntityAIBase +{ + private static final Predicate field_179505_b = BlockStateHelper.forBlock(Blocks.tallgrass).where(BlockTallGrass.TYPE, Predicates.equalTo(BlockTallGrass.EnumType.GRASS)); + + /** The entity owner of this AITask */ + private EntityLiving grassEaterEntity; + + /** The world the grass eater entity is eating from */ + private World entityWorld; + + /** Number of ticks since the entity started to eat grass */ + int eatingGrassTimer; + + public EntityAIEatGrass(EntityLiving grassEaterEntityIn) + { + this.grassEaterEntity = grassEaterEntityIn; + this.entityWorld = grassEaterEntityIn.worldObj; + this.setMutexBits(7); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.grassEaterEntity.getRNG().nextInt(this.grassEaterEntity.isChild() ? 50 : 1000) != 0) + { + return false; + } + else + { + BlockPos blockpos = new BlockPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ); + return field_179505_b.apply(this.entityWorld.getBlockState(blockpos)) ? true : this.entityWorld.getBlockState(blockpos.down()).getBlock() == Blocks.grass; + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.eatingGrassTimer = 40; + this.entityWorld.setEntityState(this.grassEaterEntity, (byte)10); + this.grassEaterEntity.getNavigator().clearPathEntity(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.eatingGrassTimer = 0; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.eatingGrassTimer > 0; + } + + /** + * Number of ticks since the entity started to eat grass + */ + public int getEatingGrassTimer() + { + return this.eatingGrassTimer; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.eatingGrassTimer = Math.max(0, this.eatingGrassTimer - 1); + + if (this.eatingGrassTimer == 4) + { + BlockPos blockpos = new BlockPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ); + + if (field_179505_b.apply(this.entityWorld.getBlockState(blockpos))) + { + if (this.entityWorld.getGameRules().getBoolean("mobGriefing")) + { + this.entityWorld.destroyBlock(blockpos, false); + } + + this.grassEaterEntity.eatGrassBonus(); + } + else + { + BlockPos blockpos1 = blockpos.down(); + + if (this.entityWorld.getBlockState(blockpos1).getBlock() == Blocks.grass) + { + if (this.entityWorld.getGameRules().getBoolean("mobGriefing")) + { + this.entityWorld.playAuxSFX(2001, blockpos1, Block.getIdFromBlock(Blocks.grass)); + this.entityWorld.setBlockState(blockpos1, Blocks.dirt.getDefaultState(), 2); + } + + this.grassEaterEntity.eatGrassBonus(); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIFindEntityNearest.java b/src/minecraft/net/minecraft/entity/ai/EntityAIFindEntityNearest.java new file mode 100644 index 0000000..21afb2a --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIFindEntityNearest.java @@ -0,0 +1,116 @@ +package net.minecraft.entity.ai; + +import com.google.common.base.Predicate; +import java.util.Collections; +import java.util.List; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.player.EntityPlayerMP; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class EntityAIFindEntityNearest extends EntityAIBase +{ + private static final Logger field_179444_a = LogManager.getLogger(); + private EntityLiving field_179442_b; + private final Predicate field_179443_c; + private final EntityAINearestAttackableTarget.Sorter field_179440_d; + private EntityLivingBase field_179441_e; + private Class field_179439_f; + + public EntityAIFindEntityNearest(EntityLiving p_i45884_1_, Class p_i45884_2_) + { + this.field_179442_b = p_i45884_1_; + this.field_179439_f = p_i45884_2_; + + if (p_i45884_1_ instanceof EntityCreature) + { + field_179444_a.warn("Use NearestAttackableTargetGoal.class for PathfinerMob mobs!"); + } + + this.field_179443_c = new Predicate() + { + public boolean apply(EntityLivingBase p_apply_1_) + { + double d0 = EntityAIFindEntityNearest.this.func_179438_f(); + + if (p_apply_1_.isSneaking()) + { + d0 *= 0.800000011920929D; + } + + return p_apply_1_.isInvisible() ? false : ((double)p_apply_1_.getDistanceToEntity(EntityAIFindEntityNearest.this.field_179442_b) > d0 ? false : EntityAITarget.isSuitableTarget(EntityAIFindEntityNearest.this.field_179442_b, p_apply_1_, false, true)); + } + }; + this.field_179440_d = new EntityAINearestAttackableTarget.Sorter(p_i45884_1_); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + double d0 = this.func_179438_f(); + List list = this.field_179442_b.worldObj.getEntitiesWithinAABB(this.field_179439_f, this.field_179442_b.getEntityBoundingBox().expand(d0, 4.0D, d0), this.field_179443_c); + Collections.sort(list, this.field_179440_d); + + if (list.isEmpty()) + { + return false; + } + else + { + this.field_179441_e = (EntityLivingBase)list.get(0); + return true; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + EntityLivingBase entitylivingbase = this.field_179442_b.getAttackTarget(); + + if (entitylivingbase == null) + { + return false; + } + else if (!entitylivingbase.isEntityAlive()) + { + return false; + } + else + { + double d0 = this.func_179438_f(); + return this.field_179442_b.getDistanceSqToEntity(entitylivingbase) > d0 * d0 ? false : !(entitylivingbase instanceof EntityPlayerMP) || !((EntityPlayerMP)entitylivingbase).theItemInWorldManager.isCreative(); + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.field_179442_b.setAttackTarget(this.field_179441_e); + super.startExecuting(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.field_179442_b.setAttackTarget((EntityLivingBase)null); + super.startExecuting(); + } + + protected double func_179438_f() + { + IAttributeInstance iattributeinstance = this.field_179442_b.getEntityAttribute(SharedMonsterAttributes.followRange); + return iattributeinstance == null ? 16.0D : iattributeinstance.getAttributeValue(); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIFindEntityNearestPlayer.java b/src/minecraft/net/minecraft/entity/ai/EntityAIFindEntityNearestPlayer.java new file mode 100644 index 0000000..b6da775 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIFindEntityNearestPlayer.java @@ -0,0 +1,154 @@ +package net.minecraft.entity.ai; + +import com.google.common.base.Predicate; +import java.util.Collections; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.scoreboard.Team; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class EntityAIFindEntityNearestPlayer extends EntityAIBase +{ + private static final Logger field_179436_a = LogManager.getLogger(); + private EntityLiving field_179434_b; + private final Predicate field_179435_c; + private final EntityAINearestAttackableTarget.Sorter field_179432_d; + private EntityLivingBase field_179433_e; + + public EntityAIFindEntityNearestPlayer(EntityLiving p_i45882_1_) + { + this.field_179434_b = p_i45882_1_; + + if (p_i45882_1_ instanceof EntityCreature) + { + field_179436_a.warn("Use NearestAttackableTargetGoal.class for PathfinerMob mobs!"); + } + + this.field_179435_c = new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + if (!(p_apply_1_ instanceof EntityPlayer)) + { + return false; + } + else if (((EntityPlayer)p_apply_1_).capabilities.disableDamage) + { + return false; + } + else + { + double d0 = EntityAIFindEntityNearestPlayer.this.func_179431_f(); + + if (p_apply_1_.isSneaking()) + { + d0 *= 0.800000011920929D; + } + + if (p_apply_1_.isInvisible()) + { + float f = ((EntityPlayer)p_apply_1_).getArmorVisibility(); + + if (f < 0.1F) + { + f = 0.1F; + } + + d0 *= (double)(0.7F * f); + } + + return (double)p_apply_1_.getDistanceToEntity(EntityAIFindEntityNearestPlayer.this.field_179434_b) > d0 ? false : EntityAITarget.isSuitableTarget(EntityAIFindEntityNearestPlayer.this.field_179434_b, (EntityLivingBase)p_apply_1_, false, true); + } + } + }; + this.field_179432_d = new EntityAINearestAttackableTarget.Sorter(p_i45882_1_); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + double d0 = this.func_179431_f(); + List list = this.field_179434_b.worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.field_179434_b.getEntityBoundingBox().expand(d0, 4.0D, d0), this.field_179435_c); + Collections.sort(list, this.field_179432_d); + + if (list.isEmpty()) + { + return false; + } + else + { + this.field_179433_e = (EntityLivingBase)list.get(0); + return true; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + EntityLivingBase entitylivingbase = this.field_179434_b.getAttackTarget(); + + if (entitylivingbase == null) + { + return false; + } + else if (!entitylivingbase.isEntityAlive()) + { + return false; + } + else if (entitylivingbase instanceof EntityPlayer && ((EntityPlayer)entitylivingbase).capabilities.disableDamage) + { + return false; + } + else + { + Team team = this.field_179434_b.getTeam(); + Team team1 = entitylivingbase.getTeam(); + + if (team != null && team1 == team) + { + return false; + } + else + { + double d0 = this.func_179431_f(); + return this.field_179434_b.getDistanceSqToEntity(entitylivingbase) > d0 * d0 ? false : !(entitylivingbase instanceof EntityPlayerMP) || !((EntityPlayerMP)entitylivingbase).theItemInWorldManager.isCreative(); + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.field_179434_b.setAttackTarget(this.field_179433_e); + super.startExecuting(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.field_179434_b.setAttackTarget((EntityLivingBase)null); + super.startExecuting(); + } + + protected double func_179431_f() + { + IAttributeInstance iattributeinstance = this.field_179434_b.getEntityAttribute(SharedMonsterAttributes.followRange); + return iattributeinstance == null ? 16.0D : iattributeinstance.getAttributeValue(); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIFleeSun.java b/src/minecraft/net/minecraft/entity/ai/EntityAIFleeSun.java new file mode 100644 index 0000000..f162570 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIFleeSun.java @@ -0,0 +1,94 @@ +package net.minecraft.entity.ai; + +import java.util.Random; +import net.minecraft.entity.EntityCreature; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class EntityAIFleeSun extends EntityAIBase +{ + private EntityCreature theCreature; + private double shelterX; + private double shelterY; + private double shelterZ; + private double movementSpeed; + private World theWorld; + + public EntityAIFleeSun(EntityCreature theCreatureIn, double movementSpeedIn) + { + this.theCreature = theCreatureIn; + this.movementSpeed = movementSpeedIn; + this.theWorld = theCreatureIn.worldObj; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theWorld.isDaytime()) + { + return false; + } + else if (!this.theCreature.isBurning()) + { + return false; + } + else if (!this.theWorld.canSeeSky(new BlockPos(this.theCreature.posX, this.theCreature.getEntityBoundingBox().minY, this.theCreature.posZ))) + { + return false; + } + else + { + Vec3 vec3 = this.findPossibleShelter(); + + if (vec3 == null) + { + return false; + } + else + { + this.shelterX = vec3.xCoord; + this.shelterY = vec3.yCoord; + this.shelterZ = vec3.zCoord; + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theCreature.getNavigator().noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theCreature.getNavigator().tryMoveToXYZ(this.shelterX, this.shelterY, this.shelterZ, this.movementSpeed); + } + + private Vec3 findPossibleShelter() + { + Random random = this.theCreature.getRNG(); + BlockPos blockpos = new BlockPos(this.theCreature.posX, this.theCreature.getEntityBoundingBox().minY, this.theCreature.posZ); + + for (int i = 0; i < 10; ++i) + { + BlockPos blockpos1 = blockpos.add(random.nextInt(20) - 10, random.nextInt(6) - 3, random.nextInt(20) - 10); + + if (!this.theWorld.canSeeSky(blockpos1) && this.theCreature.getBlockPathWeight(blockpos1) < 0.0F) + { + return new Vec3((double)blockpos1.getX(), (double)blockpos1.getY(), (double)blockpos1.getZ()); + } + } + + return null; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIFollowGolem.java b/src/minecraft/net/minecraft/entity/ai/EntityAIFollowGolem.java new file mode 100644 index 0000000..7ca7525 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIFollowGolem.java @@ -0,0 +1,103 @@ +package net.minecraft.entity.ai; + +import java.util.List; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.passive.EntityVillager; + +public class EntityAIFollowGolem extends EntityAIBase +{ + private EntityVillager theVillager; + private EntityIronGolem theGolem; + private int takeGolemRoseTick; + private boolean tookGolemRose; + + public EntityAIFollowGolem(EntityVillager theVillagerIn) + { + this.theVillager = theVillagerIn; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.theVillager.getGrowingAge() >= 0) + { + return false; + } + else if (!this.theVillager.worldObj.isDaytime()) + { + return false; + } + else + { + List list = this.theVillager.worldObj.getEntitiesWithinAABB(EntityIronGolem.class, this.theVillager.getEntityBoundingBox().expand(6.0D, 2.0D, 6.0D)); + + if (list.isEmpty()) + { + return false; + } + else + { + for (EntityIronGolem entityirongolem : list) + { + if (entityirongolem.getHoldRoseTick() > 0) + { + this.theGolem = entityirongolem; + break; + } + } + + return this.theGolem != null; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.theGolem.getHoldRoseTick() > 0; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.takeGolemRoseTick = this.theVillager.getRNG().nextInt(320); + this.tookGolemRose = false; + this.theGolem.getNavigator().clearPathEntity(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theGolem = null; + this.theVillager.getNavigator().clearPathEntity(); + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theVillager.getLookHelper().setLookPositionWithEntity(this.theGolem, 30.0F, 30.0F); + + if (this.theGolem.getHoldRoseTick() == this.takeGolemRoseTick) + { + this.theVillager.getNavigator().tryMoveToEntityLiving(this.theGolem, 0.5D); + this.tookGolemRose = true; + } + + if (this.tookGolemRose && this.theVillager.getDistanceSqToEntity(this.theGolem) < 4.0D) + { + this.theGolem.setHoldingRose(false); + this.theVillager.getNavigator().clearPathEntity(); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIFollowOwner.java b/src/minecraft/net/minecraft/entity/ai/EntityAIFollowOwner.java new file mode 100644 index 0000000..7197d3c --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIFollowOwner.java @@ -0,0 +1,149 @@ +package net.minecraft.entity.ai; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityTameable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.pathfinding.PathNavigate; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityAIFollowOwner extends EntityAIBase +{ + private EntityTameable thePet; + private EntityLivingBase theOwner; + World theWorld; + private double followSpeed; + private PathNavigate petPathfinder; + private int field_75343_h; + float maxDist; + float minDist; + private boolean field_75344_i; + + public EntityAIFollowOwner(EntityTameable thePetIn, double followSpeedIn, float minDistIn, float maxDistIn) + { + this.thePet = thePetIn; + this.theWorld = thePetIn.worldObj; + this.followSpeed = followSpeedIn; + this.petPathfinder = thePetIn.getNavigator(); + this.minDist = minDistIn; + this.maxDist = maxDistIn; + this.setMutexBits(3); + + if (!(thePetIn.getNavigator() instanceof PathNavigateGround)) + { + throw new IllegalArgumentException("Unsupported mob type for FollowOwnerGoal"); + } + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase entitylivingbase = this.thePet.getOwner(); + + if (entitylivingbase == null) + { + return false; + } + else if (entitylivingbase instanceof EntityPlayer && ((EntityPlayer)entitylivingbase).isSpectator()) + { + return false; + } + else if (this.thePet.isSitting()) + { + return false; + } + else if (this.thePet.getDistanceSqToEntity(entitylivingbase) < (double)(this.minDist * this.minDist)) + { + return false; + } + else + { + this.theOwner = entitylivingbase; + return true; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.petPathfinder.noPath() && this.thePet.getDistanceSqToEntity(this.theOwner) > (double)(this.maxDist * this.maxDist) && !this.thePet.isSitting(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.field_75343_h = 0; + this.field_75344_i = ((PathNavigateGround)this.thePet.getNavigator()).getAvoidsWater(); + ((PathNavigateGround)this.thePet.getNavigator()).setAvoidsWater(false); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theOwner = null; + this.petPathfinder.clearPathEntity(); + ((PathNavigateGround)this.thePet.getNavigator()).setAvoidsWater(true); + } + + private boolean func_181065_a(BlockPos p_181065_1_) + { + IBlockState iblockstate = this.theWorld.getBlockState(p_181065_1_); + Block block = iblockstate.getBlock(); + return block == Blocks.air ? true : !block.isFullCube(); + } + + /** + * Updates the task + */ + public void updateTask() + { + this.thePet.getLookHelper().setLookPositionWithEntity(this.theOwner, 10.0F, (float)this.thePet.getVerticalFaceSpeed()); + + if (!this.thePet.isSitting()) + { + if (--this.field_75343_h <= 0) + { + this.field_75343_h = 10; + + if (!this.petPathfinder.tryMoveToEntityLiving(this.theOwner, this.followSpeed)) + { + if (!this.thePet.getLeashed()) + { + if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D) + { + int i = MathHelper.floor_double(this.theOwner.posX) - 2; + int j = MathHelper.floor_double(this.theOwner.posZ) - 2; + int k = MathHelper.floor_double(this.theOwner.getEntityBoundingBox().minY); + + for (int l = 0; l <= 4; ++l) + { + for (int i1 = 0; i1 <= 4; ++i1) + { + if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && World.doesBlockHaveSolidTopSurface(this.theWorld, new BlockPos(i + l, k - 1, j + i1)) && this.func_181065_a(new BlockPos(i + l, k, j + i1)) && this.func_181065_a(new BlockPos(i + l, k + 1, j + i1))) + { + this.thePet.setLocationAndAngles((double)((float)(i + l) + 0.5F), (double)k, (double)((float)(j + i1) + 0.5F), this.thePet.rotationYaw, this.thePet.rotationPitch); + this.petPathfinder.clearPathEntity(); + return; + } + } + } + } + } + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIFollowParent.java b/src/minecraft/net/minecraft/entity/ai/EntityAIFollowParent.java new file mode 100644 index 0000000..83eba89 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIFollowParent.java @@ -0,0 +1,112 @@ +package net.minecraft.entity.ai; + +import java.util.List; +import net.minecraft.entity.passive.EntityAnimal; + +public class EntityAIFollowParent extends EntityAIBase +{ + /** The child that is following its parent. */ + EntityAnimal childAnimal; + EntityAnimal parentAnimal; + double moveSpeed; + private int delayCounter; + + public EntityAIFollowParent(EntityAnimal animal, double speed) + { + this.childAnimal = animal; + this.moveSpeed = speed; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.childAnimal.getGrowingAge() >= 0) + { + return false; + } + else + { + List list = this.childAnimal.worldObj.getEntitiesWithinAABB(this.childAnimal.getClass(), this.childAnimal.getEntityBoundingBox().expand(8.0D, 4.0D, 8.0D)); + EntityAnimal entityanimal = null; + double d0 = Double.MAX_VALUE; + + for (EntityAnimal entityanimal1 : list) + { + if (entityanimal1.getGrowingAge() >= 0) + { + double d1 = this.childAnimal.getDistanceSqToEntity(entityanimal1); + + if (d1 <= d0) + { + d0 = d1; + entityanimal = entityanimal1; + } + } + } + + if (entityanimal == null) + { + return false; + } + else if (d0 < 9.0D) + { + return false; + } + else + { + this.parentAnimal = entityanimal; + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + if (this.childAnimal.getGrowingAge() >= 0) + { + return false; + } + else if (!this.parentAnimal.isEntityAlive()) + { + return false; + } + else + { + double d0 = this.childAnimal.getDistanceSqToEntity(this.parentAnimal); + return d0 >= 9.0D && d0 <= 256.0D; + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.delayCounter = 0; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.parentAnimal = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + if (--this.delayCounter <= 0) + { + this.delayCounter = 10; + this.childAnimal.getNavigator().tryMoveToEntityLiving(this.parentAnimal, this.moveSpeed); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java b/src/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java new file mode 100644 index 0000000..d534e8d --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIHarvestFarmland.java @@ -0,0 +1,166 @@ +package net.minecraft.entity.ai; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockCrops; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.InventoryBasic; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class EntityAIHarvestFarmland extends EntityAIMoveToBlock +{ + /** Villager that is harvesting */ + private final EntityVillager theVillager; + private boolean hasFarmItem; + private boolean field_179503_e; + private int field_179501_f; + + public EntityAIHarvestFarmland(EntityVillager theVillagerIn, double speedIn) + { + super(theVillagerIn, speedIn, 16); + this.theVillager = theVillagerIn; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.runDelay <= 0) + { + if (!this.theVillager.worldObj.getGameRules().getBoolean("mobGriefing")) + { + return false; + } + + this.field_179501_f = -1; + this.hasFarmItem = this.theVillager.isFarmItemInInventory(); + this.field_179503_e = this.theVillager.func_175557_cr(); + } + + return super.shouldExecute(); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.field_179501_f >= 0 && super.continueExecuting(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + super.startExecuting(); + } + + /** + * Resets the task + */ + public void resetTask() + { + super.resetTask(); + } + + /** + * Updates the task + */ + public void updateTask() + { + super.updateTask(); + this.theVillager.getLookHelper().setLookPosition((double)this.destinationBlock.getX() + 0.5D, (double)(this.destinationBlock.getY() + 1), (double)this.destinationBlock.getZ() + 0.5D, 10.0F, (float)this.theVillager.getVerticalFaceSpeed()); + + if (this.getIsAboveDestination()) + { + World world = this.theVillager.worldObj; + BlockPos blockpos = this.destinationBlock.up(); + IBlockState iblockstate = world.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (this.field_179501_f == 0 && block instanceof BlockCrops && ((Integer)iblockstate.getValue(BlockCrops.AGE)).intValue() == 7) + { + world.destroyBlock(blockpos, true); + } + else if (this.field_179501_f == 1 && block == Blocks.air) + { + InventoryBasic inventorybasic = this.theVillager.getVillagerInventory(); + + for (int i = 0; i < inventorybasic.getSizeInventory(); ++i) + { + ItemStack itemstack = inventorybasic.getStackInSlot(i); + boolean flag = false; + + if (itemstack != null) + { + if (itemstack.getItem() == Items.wheat_seeds) + { + world.setBlockState(blockpos, Blocks.wheat.getDefaultState(), 3); + flag = true; + } + else if (itemstack.getItem() == Items.potato) + { + world.setBlockState(blockpos, Blocks.potatoes.getDefaultState(), 3); + flag = true; + } + else if (itemstack.getItem() == Items.carrot) + { + world.setBlockState(blockpos, Blocks.carrots.getDefaultState(), 3); + flag = true; + } + } + + if (flag) + { + --itemstack.stackSize; + + if (itemstack.stackSize <= 0) + { + inventorybasic.setInventorySlotContents(i, (ItemStack)null); + } + + break; + } + } + } + + this.field_179501_f = -1; + this.runDelay = 10; + } + } + + /** + * Return true to set given position as destination + */ + protected boolean shouldMoveTo(World worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos).getBlock(); + + if (block == Blocks.farmland) + { + pos = pos.up(); + IBlockState iblockstate = worldIn.getBlockState(pos); + block = iblockstate.getBlock(); + + if (block instanceof BlockCrops && ((Integer)iblockstate.getValue(BlockCrops.AGE)).intValue() == 7 && this.field_179503_e && (this.field_179501_f == 0 || this.field_179501_f < 0)) + { + this.field_179501_f = 0; + return true; + } + + if (block == Blocks.air && this.hasFarmItem && (this.field_179501_f == 1 || this.field_179501_f < 0)) + { + this.field_179501_f = 1; + return true; + } + } + + return false; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIHurtByTarget.java b/src/minecraft/net/minecraft/entity/ai/EntityAIHurtByTarget.java new file mode 100644 index 0000000..532b71e --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIHurtByTarget.java @@ -0,0 +1,74 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.AxisAlignedBB; + +public class EntityAIHurtByTarget extends EntityAITarget +{ + private boolean entityCallsForHelp; + + /** Store the previous revengeTimer value */ + private int revengeTimerOld; + private final Class[] targetClasses; + + public EntityAIHurtByTarget(EntityCreature creatureIn, boolean entityCallsForHelpIn, Class... targetClassesIn) + { + super(creatureIn, false); + this.entityCallsForHelp = entityCallsForHelpIn; + this.targetClasses = targetClassesIn; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + int i = this.taskOwner.getRevengeTimer(); + return i != this.revengeTimerOld && this.isSuitableTarget(this.taskOwner.getAITarget(), false); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.taskOwner.setAttackTarget(this.taskOwner.getAITarget()); + this.revengeTimerOld = this.taskOwner.getRevengeTimer(); + + if (this.entityCallsForHelp) + { + double d0 = this.getTargetDistance(); + + for (EntityCreature entitycreature : this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), (new AxisAlignedBB(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D)).expand(d0, 10.0D, d0))) + { + if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget())) + { + boolean flag = false; + + for (Class oclass : this.targetClasses) + { + if (entitycreature.getClass() == oclass) + { + flag = true; + break; + } + } + + if (!flag) + { + this.setEntityAttackTarget(entitycreature, this.taskOwner.getAITarget()); + } + } + } + } + + super.startExecuting(); + } + + protected void setEntityAttackTarget(EntityCreature creatureIn, EntityLivingBase entityLivingBaseIn) + { + creatureIn.setAttackTarget(entityLivingBaseIn); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAILeapAtTarget.java b/src/minecraft/net/minecraft/entity/ai/EntityAILeapAtTarget.java new file mode 100644 index 0000000..cd27977 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAILeapAtTarget.java @@ -0,0 +1,63 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; + +public class EntityAILeapAtTarget extends EntityAIBase +{ + /** The entity that is leaping. */ + EntityLiving leaper; + + /** The entity that the leaper is leaping towards. */ + EntityLivingBase leapTarget; + + /** The entity's motionY after leaping. */ + float leapMotionY; + + public EntityAILeapAtTarget(EntityLiving leapingEntity, float leapMotionYIn) + { + this.leaper = leapingEntity; + this.leapMotionY = leapMotionYIn; + this.setMutexBits(5); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + this.leapTarget = this.leaper.getAttackTarget(); + + if (this.leapTarget == null) + { + return false; + } + else + { + double d0 = this.leaper.getDistanceSqToEntity(this.leapTarget); + return d0 >= 4.0D && d0 <= 16.0D ? (!this.leaper.onGround ? false : this.leaper.getRNG().nextInt(5) == 0) : false; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.leaper.onGround; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + double d0 = this.leapTarget.posX - this.leaper.posX; + double d1 = this.leapTarget.posZ - this.leaper.posZ; + float f = MathHelper.sqrt_double(d0 * d0 + d1 * d1); + this.leaper.motionX += d0 / (double)f * 0.5D * 0.800000011920929D + this.leaper.motionX * 0.20000000298023224D; + this.leaper.motionZ += d1 / (double)f * 0.5D * 0.800000011920929D + this.leaper.motionZ * 0.20000000298023224D; + this.leaper.motionY = (double)this.leapMotionY; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAILookAtTradePlayer.java b/src/minecraft/net/minecraft/entity/ai/EntityAILookAtTradePlayer.java new file mode 100644 index 0000000..d62a17c --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAILookAtTradePlayer.java @@ -0,0 +1,31 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; + +public class EntityAILookAtTradePlayer extends EntityAIWatchClosest +{ + private final EntityVillager theMerchant; + + public EntityAILookAtTradePlayer(EntityVillager theMerchantIn) + { + super(theMerchantIn, EntityPlayer.class, 8.0F); + this.theMerchant = theMerchantIn; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.theMerchant.isTrading()) + { + this.closestEntity = this.theMerchant.getCustomer(); + return true; + } + else + { + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAILookAtVillager.java b/src/minecraft/net/minecraft/entity/ai/EntityAILookAtVillager.java new file mode 100644 index 0000000..725ffb0 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAILookAtVillager.java @@ -0,0 +1,72 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.passive.EntityVillager; + +public class EntityAILookAtVillager extends EntityAIBase +{ + private EntityIronGolem theGolem; + private EntityVillager theVillager; + private int lookTime; + + public EntityAILookAtVillager(EntityIronGolem theGolemIn) + { + this.theGolem = theGolemIn; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theGolem.worldObj.isDaytime()) + { + return false; + } + else if (this.theGolem.getRNG().nextInt(8000) != 0) + { + return false; + } + else + { + this.theVillager = (EntityVillager)this.theGolem.worldObj.findNearestEntityWithinAABB(EntityVillager.class, this.theGolem.getEntityBoundingBox().expand(6.0D, 2.0D, 6.0D), this.theGolem); + return this.theVillager != null; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.lookTime > 0; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.lookTime = 400; + this.theGolem.setHoldingRose(true); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theGolem.setHoldingRose(false); + this.theVillager = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theGolem.getLookHelper().setLookPositionWithEntity(this.theVillager, 30.0F, 30.0F); + --this.lookTime; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAILookIdle.java b/src/minecraft/net/minecraft/entity/ai/EntityAILookIdle.java new file mode 100644 index 0000000..ec9a718 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAILookIdle.java @@ -0,0 +1,62 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLiving; + +public class EntityAILookIdle extends EntityAIBase +{ + /** The entity that is looking idle. */ + private EntityLiving idleEntity; + + /** X offset to look at */ + private double lookX; + + /** Z offset to look at */ + private double lookZ; + + /** + * A decrementing tick that stops the entity from being idle once it reaches 0. + */ + private int idleTime; + + public EntityAILookIdle(EntityLiving entitylivingIn) + { + this.idleEntity = entitylivingIn; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return this.idleEntity.getRNG().nextFloat() < 0.02F; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.idleTime >= 0; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + double d0 = (Math.PI * 2D) * this.idleEntity.getRNG().nextDouble(); + this.lookX = Math.cos(d0); + this.lookZ = Math.sin(d0); + this.idleTime = 20 + this.idleEntity.getRNG().nextInt(20); + } + + /** + * Updates the task + */ + public void updateTask() + { + --this.idleTime; + this.idleEntity.getLookHelper().setLookPosition(this.idleEntity.posX + this.lookX, this.idleEntity.posY + (double)this.idleEntity.getEyeHeight(), this.idleEntity.posZ + this.lookZ, 10.0F, (float)this.idleEntity.getVerticalFaceSpeed()); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIMate.java b/src/minecraft/net/minecraft/entity/ai/EntityAIMate.java new file mode 100644 index 0000000..9cd7c22 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIMate.java @@ -0,0 +1,160 @@ +package net.minecraft.entity.ai; + +import java.util.List; +import java.util.Random; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityCow; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.stats.AchievementList; +import net.minecraft.stats.StatList; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class EntityAIMate extends EntityAIBase +{ + private EntityAnimal theAnimal; + World theWorld; + private EntityAnimal targetMate; + + /** + * Delay preventing a baby from spawning immediately when two mate-able animals find each other. + */ + int spawnBabyDelay; + + /** The speed the creature moves at during mating behavior. */ + double moveSpeed; + + public EntityAIMate(EntityAnimal animal, double speedIn) + { + this.theAnimal = animal; + this.theWorld = animal.worldObj; + this.moveSpeed = speedIn; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theAnimal.isInLove()) + { + return false; + } + else + { + this.targetMate = this.getNearbyMate(); + return this.targetMate != null; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.targetMate.isEntityAlive() && this.targetMate.isInLove() && this.spawnBabyDelay < 60; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.targetMate = null; + this.spawnBabyDelay = 0; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theAnimal.getLookHelper().setLookPositionWithEntity(this.targetMate, 10.0F, (float)this.theAnimal.getVerticalFaceSpeed()); + this.theAnimal.getNavigator().tryMoveToEntityLiving(this.targetMate, this.moveSpeed); + ++this.spawnBabyDelay; + + if (this.spawnBabyDelay >= 60 && this.theAnimal.getDistanceSqToEntity(this.targetMate) < 9.0D) + { + this.spawnBaby(); + } + } + + /** + * Loops through nearby animals and finds another animal of the same type that can be mated with. Returns the first + * valid mate found. + */ + private EntityAnimal getNearbyMate() + { + float f = 8.0F; + List list = this.theWorld.getEntitiesWithinAABB(this.theAnimal.getClass(), this.theAnimal.getEntityBoundingBox().expand((double)f, (double)f, (double)f)); + double d0 = Double.MAX_VALUE; + EntityAnimal entityanimal = null; + + for (EntityAnimal entityanimal1 : list) + { + if (this.theAnimal.canMateWith(entityanimal1) && this.theAnimal.getDistanceSqToEntity(entityanimal1) < d0) + { + entityanimal = entityanimal1; + d0 = this.theAnimal.getDistanceSqToEntity(entityanimal1); + } + } + + return entityanimal; + } + + /** + * Spawns a baby animal of the same type. + */ + private void spawnBaby() + { + EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate); + + if (entityageable != null) + { + EntityPlayer entityplayer = this.theAnimal.getPlayerInLove(); + + if (entityplayer == null && this.targetMate.getPlayerInLove() != null) + { + entityplayer = this.targetMate.getPlayerInLove(); + } + + if (entityplayer != null) + { + entityplayer.triggerAchievement(StatList.animalsBredStat); + + if (this.theAnimal instanceof EntityCow) + { + entityplayer.triggerAchievement(AchievementList.breedCow); + } + } + + this.theAnimal.setGrowingAge(6000); + this.targetMate.setGrowingAge(6000); + this.theAnimal.resetInLove(); + this.targetMate.resetInLove(); + entityageable.setGrowingAge(-24000); + entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F); + this.theWorld.spawnEntityInWorld(entityageable); + Random random = this.theAnimal.getRNG(); + + for (int i = 0; i < 7; ++i) + { + double d0 = random.nextGaussian() * 0.02D; + double d1 = random.nextGaussian() * 0.02D; + double d2 = random.nextGaussian() * 0.02D; + double d3 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width; + double d4 = 0.5D + random.nextDouble() * (double)this.theAnimal.height; + double d5 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width; + this.theWorld.spawnParticle(EnumParticleTypes.HEART, this.theAnimal.posX + d3, this.theAnimal.posY + d4, this.theAnimal.posZ + d5, d0, d1, d2, new int[0]); + } + + if (this.theWorld.getGameRules().getBoolean("doMobLoot")) + { + this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1)); + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIMoveIndoors.java b/src/minecraft/net/minecraft/entity/ai/EntityAIMoveIndoors.java new file mode 100644 index 0000000..3eff826 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIMoveIndoors.java @@ -0,0 +1,103 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; +import net.minecraft.village.Village; +import net.minecraft.village.VillageDoorInfo; + +public class EntityAIMoveIndoors extends EntityAIBase +{ + private EntityCreature entityObj; + private VillageDoorInfo doorInfo; + private int insidePosX = -1; + private int insidePosZ = -1; + + public EntityAIMoveIndoors(EntityCreature entityObjIn) + { + this.entityObj = entityObjIn; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + BlockPos blockpos = new BlockPos(this.entityObj); + + if ((!this.entityObj.worldObj.isDaytime() || this.entityObj.worldObj.isRaining() && !this.entityObj.worldObj.getBiomeGenForCoords(blockpos).canSpawnLightningBolt()) && !this.entityObj.worldObj.provider.getHasNoSky()) + { + if (this.entityObj.getRNG().nextInt(50) != 0) + { + return false; + } + else if (this.insidePosX != -1 && this.entityObj.getDistanceSq((double)this.insidePosX, this.entityObj.posY, (double)this.insidePosZ) < 4.0D) + { + return false; + } + else + { + Village village = this.entityObj.worldObj.getVillageCollection().getNearestVillage(blockpos, 14); + + if (village == null) + { + return false; + } + else + { + this.doorInfo = village.getDoorInfo(blockpos); + return this.doorInfo != null; + } + } + } + else + { + return false; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.entityObj.getNavigator().noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.insidePosX = -1; + BlockPos blockpos = this.doorInfo.getInsideBlockPos(); + int i = blockpos.getX(); + int j = blockpos.getY(); + int k = blockpos.getZ(); + + if (this.entityObj.getDistanceSq(blockpos) > 256.0D) + { + Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.entityObj, 14, 3, new Vec3((double)i + 0.5D, (double)j, (double)k + 0.5D)); + + if (vec3 != null) + { + this.entityObj.getNavigator().tryMoveToXYZ(vec3.xCoord, vec3.yCoord, vec3.zCoord, 1.0D); + } + } + else + { + this.entityObj.getNavigator().tryMoveToXYZ((double)i + 0.5D, (double)j, (double)k + 0.5D, 1.0D); + } + } + + /** + * Resets the task + */ + public void resetTask() + { + this.insidePosX = this.doorInfo.getInsideBlockPos().getX(); + this.insidePosZ = this.doorInfo.getInsideBlockPos().getZ(); + this.doorInfo = null; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIMoveThroughVillage.java b/src/minecraft/net/minecraft/entity/ai/EntityAIMoveThroughVillage.java new file mode 100644 index 0000000..176b10f --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIMoveThroughVillage.java @@ -0,0 +1,172 @@ +package net.minecraft.entity.ai; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.entity.EntityCreature; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.village.Village; +import net.minecraft.village.VillageDoorInfo; + +public class EntityAIMoveThroughVillage extends EntityAIBase +{ + private EntityCreature theEntity; + private double movementSpeed; + + /** The PathNavigate of our entity. */ + private PathEntity entityPathNavigate; + private VillageDoorInfo doorInfo; + private boolean isNocturnal; + private List doorList = Lists.newArrayList(); + + public EntityAIMoveThroughVillage(EntityCreature theEntityIn, double movementSpeedIn, boolean isNocturnalIn) + { + this.theEntity = theEntityIn; + this.movementSpeed = movementSpeedIn; + this.isNocturnal = isNocturnalIn; + this.setMutexBits(1); + + if (!(theEntityIn.getNavigator() instanceof PathNavigateGround)) + { + throw new IllegalArgumentException("Unsupported mob for MoveThroughVillageGoal"); + } + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + this.resizeDoorList(); + + if (this.isNocturnal && this.theEntity.worldObj.isDaytime()) + { + return false; + } + else + { + Village village = this.theEntity.worldObj.getVillageCollection().getNearestVillage(new BlockPos(this.theEntity), 0); + + if (village == null) + { + return false; + } + else + { + this.doorInfo = this.findNearestDoor(village); + + if (this.doorInfo == null) + { + return false; + } + else + { + PathNavigateGround pathnavigateground = (PathNavigateGround)this.theEntity.getNavigator(); + boolean flag = pathnavigateground.getEnterDoors(); + pathnavigateground.setBreakDoors(false); + this.entityPathNavigate = pathnavigateground.getPathToPos(this.doorInfo.getDoorBlockPos()); + pathnavigateground.setBreakDoors(flag); + + if (this.entityPathNavigate != null) + { + return true; + } + else + { + Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 10, 7, new Vec3((double)this.doorInfo.getDoorBlockPos().getX(), (double)this.doorInfo.getDoorBlockPos().getY(), (double)this.doorInfo.getDoorBlockPos().getZ())); + + if (vec3 == null) + { + return false; + } + else + { + pathnavigateground.setBreakDoors(false); + this.entityPathNavigate = this.theEntity.getNavigator().getPathToXYZ(vec3.xCoord, vec3.yCoord, vec3.zCoord); + pathnavigateground.setBreakDoors(flag); + return this.entityPathNavigate != null; + } + } + } + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + if (this.theEntity.getNavigator().noPath()) + { + return false; + } + else + { + float f = this.theEntity.width + 4.0F; + return this.theEntity.getDistanceSq(this.doorInfo.getDoorBlockPos()) > (double)(f * f); + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntity.getNavigator().setPath(this.entityPathNavigate, this.movementSpeed); + } + + /** + * Resets the task + */ + public void resetTask() + { + if (this.theEntity.getNavigator().noPath() || this.theEntity.getDistanceSq(this.doorInfo.getDoorBlockPos()) < 16.0D) + { + this.doorList.add(this.doorInfo); + } + } + + private VillageDoorInfo findNearestDoor(Village villageIn) + { + VillageDoorInfo villagedoorinfo = null; + int i = Integer.MAX_VALUE; + + for (VillageDoorInfo villagedoorinfo1 : villageIn.getVillageDoorInfoList()) + { + int j = villagedoorinfo1.getDistanceSquared(MathHelper.floor_double(this.theEntity.posX), MathHelper.floor_double(this.theEntity.posY), MathHelper.floor_double(this.theEntity.posZ)); + + if (j < i && !this.doesDoorListContain(villagedoorinfo1)) + { + villagedoorinfo = villagedoorinfo1; + i = j; + } + } + + return villagedoorinfo; + } + + private boolean doesDoorListContain(VillageDoorInfo doorInfoIn) + { + for (VillageDoorInfo villagedoorinfo : this.doorList) + { + if (doorInfoIn.getDoorBlockPos().equals(villagedoorinfo.getDoorBlockPos())) + { + return true; + } + } + + return false; + } + + private void resizeDoorList() + { + if (this.doorList.size() > 15) + { + this.doorList.remove(0); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIMoveToBlock.java b/src/minecraft/net/minecraft/entity/ai/EntityAIMoveToBlock.java new file mode 100644 index 0000000..1ca2435 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIMoveToBlock.java @@ -0,0 +1,137 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public abstract class EntityAIMoveToBlock extends EntityAIBase +{ + private final EntityCreature theEntity; + private final double movementSpeed; + + /** Controls task execution delay */ + protected int runDelay; + private int timeoutCounter; + private int field_179490_f; + + /** Block to move to */ + protected BlockPos destinationBlock = BlockPos.ORIGIN; + private boolean isAboveDestination; + private int searchLength; + + public EntityAIMoveToBlock(EntityCreature creature, double speedIn, int length) + { + this.theEntity = creature; + this.movementSpeed = speedIn; + this.searchLength = length; + this.setMutexBits(5); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.runDelay > 0) + { + --this.runDelay; + return false; + } + else + { + this.runDelay = 200 + this.theEntity.getRNG().nextInt(200); + return this.searchForDestination(); + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.timeoutCounter >= -this.field_179490_f && this.timeoutCounter <= 1200 && this.shouldMoveTo(this.theEntity.worldObj, this.destinationBlock); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntity.getNavigator().tryMoveToXYZ((double)((float)this.destinationBlock.getX()) + 0.5D, (double)(this.destinationBlock.getY() + 1), (double)((float)this.destinationBlock.getZ()) + 0.5D, this.movementSpeed); + this.timeoutCounter = 0; + this.field_179490_f = this.theEntity.getRNG().nextInt(this.theEntity.getRNG().nextInt(1200) + 1200) + 1200; + } + + /** + * Resets the task + */ + public void resetTask() + { + } + + /** + * Updates the task + */ + public void updateTask() + { + if (this.theEntity.getDistanceSqToCenter(this.destinationBlock.up()) > 1.0D) + { + this.isAboveDestination = false; + ++this.timeoutCounter; + + if (this.timeoutCounter % 40 == 0) + { + this.theEntity.getNavigator().tryMoveToXYZ((double)((float)this.destinationBlock.getX()) + 0.5D, (double)(this.destinationBlock.getY() + 1), (double)((float)this.destinationBlock.getZ()) + 0.5D, this.movementSpeed); + } + } + else + { + this.isAboveDestination = true; + --this.timeoutCounter; + } + } + + protected boolean getIsAboveDestination() + { + return this.isAboveDestination; + } + + /** + * Searches and sets new destination block and returns true if a suitable block (specified in {@link + * net.minecraft.entity.ai.EntityAIMoveToBlock#shouldMoveTo(World, BlockPos) EntityAIMoveToBlock#shouldMoveTo(World, + * BlockPos)}) can be found. + */ + private boolean searchForDestination() + { + int i = this.searchLength; + int j = 1; + BlockPos blockpos = new BlockPos(this.theEntity); + + for (int k = 0; k <= 1; k = k > 0 ? -k : 1 - k) + { + for (int l = 0; l < i; ++l) + { + for (int i1 = 0; i1 <= l; i1 = i1 > 0 ? -i1 : 1 - i1) + { + for (int j1 = i1 < l && i1 > -l ? l : 0; j1 <= l; j1 = j1 > 0 ? -j1 : 1 - j1) + { + BlockPos blockpos1 = blockpos.add(i1, k - 1, j1); + + if (this.theEntity.isWithinHomeDistanceFromPosition(blockpos1) && this.shouldMoveTo(this.theEntity.worldObj, blockpos1)) + { + this.destinationBlock = blockpos1; + return true; + } + } + } + } + } + + return false; + } + + /** + * Return true to set given position as destination + */ + protected abstract boolean shouldMoveTo(World worldIn, BlockPos pos); +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIMoveTowardsRestriction.java b/src/minecraft/net/minecraft/entity/ai/EntityAIMoveTowardsRestriction.java new file mode 100644 index 0000000..b30901e --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIMoveTowardsRestriction.java @@ -0,0 +1,65 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; + +public class EntityAIMoveTowardsRestriction extends EntityAIBase +{ + private EntityCreature theEntity; + private double movePosX; + private double movePosY; + private double movePosZ; + private double movementSpeed; + + public EntityAIMoveTowardsRestriction(EntityCreature creatureIn, double speedIn) + { + this.theEntity = creatureIn; + this.movementSpeed = speedIn; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.theEntity.isWithinHomeDistanceCurrentPosition()) + { + return false; + } + else + { + BlockPos blockpos = this.theEntity.getHomePosition(); + Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 16, 7, new Vec3((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ())); + + if (vec3 == null) + { + return false; + } + else + { + this.movePosX = vec3.xCoord; + this.movePosY = vec3.yCoord; + this.movePosZ = vec3.zCoord; + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theEntity.getNavigator().noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntity.getNavigator().tryMoveToXYZ(this.movePosX, this.movePosY, this.movePosZ, this.movementSpeed); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIMoveTowardsTarget.java b/src/minecraft/net/minecraft/entity/ai/EntityAIMoveTowardsTarget.java new file mode 100644 index 0000000..5d1e65b --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIMoveTowardsTarget.java @@ -0,0 +1,85 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.Vec3; + +public class EntityAIMoveTowardsTarget extends EntityAIBase +{ + private EntityCreature theEntity; + private EntityLivingBase targetEntity; + private double movePosX; + private double movePosY; + private double movePosZ; + private double speed; + + /** + * If the distance to the target entity is further than this, this AI task will not run. + */ + private float maxTargetDistance; + + public EntityAIMoveTowardsTarget(EntityCreature creature, double speedIn, float targetMaxDistance) + { + this.theEntity = creature; + this.speed = speedIn; + this.maxTargetDistance = targetMaxDistance; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + this.targetEntity = this.theEntity.getAttackTarget(); + + if (this.targetEntity == null) + { + return false; + } + else if (this.targetEntity.getDistanceSqToEntity(this.theEntity) > (double)(this.maxTargetDistance * this.maxTargetDistance)) + { + return false; + } + else + { + Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 16, 7, new Vec3(this.targetEntity.posX, this.targetEntity.posY, this.targetEntity.posZ)); + + if (vec3 == null) + { + return false; + } + else + { + this.movePosX = vec3.xCoord; + this.movePosY = vec3.yCoord; + this.movePosZ = vec3.zCoord; + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theEntity.getNavigator().noPath() && this.targetEntity.isEntityAlive() && this.targetEntity.getDistanceSqToEntity(this.theEntity) < (double)(this.maxTargetDistance * this.maxTargetDistance); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.targetEntity = null; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntity.getNavigator().tryMoveToXYZ(this.movePosX, this.movePosY, this.movePosZ, this.speed); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAINearestAttackableTarget.java b/src/minecraft/net/minecraft/entity/ai/EntityAINearestAttackableTarget.java new file mode 100644 index 0000000..486402f --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAINearestAttackableTarget.java @@ -0,0 +1,136 @@ +package net.minecraft.entity.ai; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.EntitySelectors; + +public class EntityAINearestAttackableTarget extends EntityAITarget +{ + protected final Class targetClass; + private final int targetChance; + + /** Instance of EntityAINearestAttackableTargetSorter. */ + protected final EntityAINearestAttackableTarget.Sorter theNearestAttackableTargetSorter; + protected Predicate targetEntitySelector; + protected EntityLivingBase targetEntity; + + public EntityAINearestAttackableTarget(EntityCreature creature, Class classTarget, boolean checkSight) + { + this(creature, classTarget, checkSight, false); + } + + public EntityAINearestAttackableTarget(EntityCreature creature, Class classTarget, boolean checkSight, boolean onlyNearby) + { + this(creature, classTarget, 10, checkSight, onlyNearby, (Predicate )null); + } + + public EntityAINearestAttackableTarget(EntityCreature creature, Class classTarget, int chance, boolean checkSight, boolean onlyNearby, final Predicate targetSelector) + { + super(creature, checkSight, onlyNearby); + this.targetClass = classTarget; + this.targetChance = chance; + this.theNearestAttackableTargetSorter = new EntityAINearestAttackableTarget.Sorter(creature); + this.setMutexBits(1); + this.targetEntitySelector = new Predicate() + { + public boolean apply(T p_apply_1_) + { + if (targetSelector != null && !targetSelector.apply(p_apply_1_)) + { + return false; + } + else + { + if (p_apply_1_ instanceof EntityPlayer) + { + double d0 = EntityAINearestAttackableTarget.this.getTargetDistance(); + + if (p_apply_1_.isSneaking()) + { + d0 *= 0.800000011920929D; + } + + if (p_apply_1_.isInvisible()) + { + float f = ((EntityPlayer)p_apply_1_).getArmorVisibility(); + + if (f < 0.1F) + { + f = 0.1F; + } + + d0 *= (double)(0.7F * f); + } + + if ((double)p_apply_1_.getDistanceToEntity(EntityAINearestAttackableTarget.this.taskOwner) > d0) + { + return false; + } + } + + return EntityAINearestAttackableTarget.this.isSuitableTarget(p_apply_1_, false); + } + } + }; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0) + { + return false; + } + else + { + double d0 = this.getTargetDistance(); + List list = this.taskOwner.worldObj.getEntitiesWithinAABB(this.targetClass, this.taskOwner.getEntityBoundingBox().expand(d0, 4.0D, d0), Predicates. and (this.targetEntitySelector, EntitySelectors.NOT_SPECTATING)); + Collections.sort(list, this.theNearestAttackableTargetSorter); + + if (list.isEmpty()) + { + return false; + } + else + { + this.targetEntity = (EntityLivingBase)list.get(0); + return true; + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.taskOwner.setAttackTarget(this.targetEntity); + super.startExecuting(); + } + + public static class Sorter implements Comparator + { + private final Entity theEntity; + + public Sorter(Entity theEntityIn) + { + this.theEntity = theEntityIn; + } + + public int compare(Entity p_compare_1_, Entity p_compare_2_) + { + double d0 = this.theEntity.getDistanceSqToEntity(p_compare_1_); + double d1 = this.theEntity.getDistanceSqToEntity(p_compare_2_); + return d0 < d1 ? -1 : (d0 > d1 ? 1 : 0); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIOcelotAttack.java b/src/minecraft/net/minecraft/entity/ai/EntityAIOcelotAttack.java new file mode 100644 index 0000000..09ac1c7 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIOcelotAttack.java @@ -0,0 +1,87 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.world.World; + +public class EntityAIOcelotAttack extends EntityAIBase +{ + World theWorld; + EntityLiving theEntity; + EntityLivingBase theVictim; + int attackCountdown; + + public EntityAIOcelotAttack(EntityLiving theEntityIn) + { + this.theEntity = theEntityIn; + this.theWorld = theEntityIn.worldObj; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase entitylivingbase = this.theEntity.getAttackTarget(); + + if (entitylivingbase == null) + { + return false; + } + else + { + this.theVictim = entitylivingbase; + return true; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theVictim.isEntityAlive() ? false : (this.theEntity.getDistanceSqToEntity(this.theVictim) > 225.0D ? false : !this.theEntity.getNavigator().noPath() || this.shouldExecute()); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theVictim = null; + this.theEntity.getNavigator().clearPathEntity(); + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theEntity.getLookHelper().setLookPositionWithEntity(this.theVictim, 30.0F, 30.0F); + double d0 = (double)(this.theEntity.width * 2.0F * this.theEntity.width * 2.0F); + double d1 = this.theEntity.getDistanceSq(this.theVictim.posX, this.theVictim.getEntityBoundingBox().minY, this.theVictim.posZ); + double d2 = 0.8D; + + if (d1 > d0 && d1 < 16.0D) + { + d2 = 1.33D; + } + else if (d1 < 225.0D) + { + d2 = 0.6D; + } + + this.theEntity.getNavigator().tryMoveToEntityLiving(this.theVictim, d2); + this.attackCountdown = Math.max(this.attackCountdown - 1, 0); + + if (d1 <= d0) + { + if (this.attackCountdown <= 0) + { + this.attackCountdown = 20; + this.theEntity.attackEntityAsMob(this.theVictim); + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIOcelotSit.java b/src/minecraft/net/minecraft/entity/ai/EntityAIOcelotSit.java new file mode 100644 index 0000000..043f0a7 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIOcelotSit.java @@ -0,0 +1,114 @@ +package net.minecraft.entity.ai; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class EntityAIOcelotSit extends EntityAIMoveToBlock +{ + private final EntityOcelot field_151493_a; + + public EntityAIOcelotSit(EntityOcelot p_i45315_1_, double p_i45315_2_) + { + super(p_i45315_1_, p_i45315_2_, 8); + this.field_151493_a = p_i45315_1_; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return this.field_151493_a.isTamed() && !this.field_151493_a.isSitting() && super.shouldExecute(); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return super.continueExecuting(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + super.startExecuting(); + this.field_151493_a.getAISit().setSitting(false); + } + + /** + * Resets the task + */ + public void resetTask() + { + super.resetTask(); + this.field_151493_a.setSitting(false); + } + + /** + * Updates the task + */ + public void updateTask() + { + super.updateTask(); + this.field_151493_a.getAISit().setSitting(false); + + if (!this.getIsAboveDestination()) + { + this.field_151493_a.setSitting(false); + } + else if (!this.field_151493_a.isSitting()) + { + this.field_151493_a.setSitting(true); + } + } + + /** + * Return true to set given position as destination + */ + protected boolean shouldMoveTo(World worldIn, BlockPos pos) + { + if (!worldIn.isAirBlock(pos.up())) + { + return false; + } + else + { + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if (block == Blocks.chest) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityChest && ((TileEntityChest)tileentity).numPlayersUsing < 1) + { + return true; + } + } + else + { + if (block == Blocks.lit_furnace) + { + return true; + } + + if (block == Blocks.bed && iblockstate.getValue(BlockBed.PART) != BlockBed.EnumPartType.HEAD) + { + return true; + } + } + + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIOpenDoor.java b/src/minecraft/net/minecraft/entity/ai/EntityAIOpenDoor.java new file mode 100644 index 0000000..648a804 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIOpenDoor.java @@ -0,0 +1,58 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLiving; + +public class EntityAIOpenDoor extends EntityAIDoorInteract +{ + /** If the entity close the door */ + boolean closeDoor; + + /** + * The temporisation before the entity close the door (in ticks, always 20 = 1 second) + */ + int closeDoorTemporisation; + + public EntityAIOpenDoor(EntityLiving entitylivingIn, boolean shouldClose) + { + super(entitylivingIn); + this.theEntity = entitylivingIn; + this.closeDoor = shouldClose; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.closeDoor && this.closeDoorTemporisation > 0 && super.continueExecuting(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.closeDoorTemporisation = 20; + this.doorBlock.toggleDoor(this.theEntity.worldObj, this.doorPosition, true); + } + + /** + * Resets the task + */ + public void resetTask() + { + if (this.closeDoor) + { + this.doorBlock.toggleDoor(this.theEntity.worldObj, this.doorPosition, false); + } + } + + /** + * Updates the task + */ + public void updateTask() + { + --this.closeDoorTemporisation; + super.updateTask(); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIOwnerHurtByTarget.java b/src/minecraft/net/minecraft/entity/ai/EntityAIOwnerHurtByTarget.java new file mode 100644 index 0000000..2c0128e --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIOwnerHurtByTarget.java @@ -0,0 +1,60 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityTameable; + +public class EntityAIOwnerHurtByTarget extends EntityAITarget +{ + EntityTameable theDefendingTameable; + EntityLivingBase theOwnerAttacker; + private int field_142051_e; + + public EntityAIOwnerHurtByTarget(EntityTameable theDefendingTameableIn) + { + super(theDefendingTameableIn, false); + this.theDefendingTameable = theDefendingTameableIn; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theDefendingTameable.isTamed()) + { + return false; + } + else + { + EntityLivingBase entitylivingbase = this.theDefendingTameable.getOwner(); + + if (entitylivingbase == null) + { + return false; + } + else + { + this.theOwnerAttacker = entitylivingbase.getAITarget(); + int i = entitylivingbase.getRevengeTimer(); + return i != this.field_142051_e && this.isSuitableTarget(this.theOwnerAttacker, false) && this.theDefendingTameable.shouldAttackEntity(this.theOwnerAttacker, entitylivingbase); + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.taskOwner.setAttackTarget(this.theOwnerAttacker); + EntityLivingBase entitylivingbase = this.theDefendingTameable.getOwner(); + + if (entitylivingbase != null) + { + this.field_142051_e = entitylivingbase.getRevengeTimer(); + } + + super.startExecuting(); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIOwnerHurtTarget.java b/src/minecraft/net/minecraft/entity/ai/EntityAIOwnerHurtTarget.java new file mode 100644 index 0000000..621c4a0 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIOwnerHurtTarget.java @@ -0,0 +1,60 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityTameable; + +public class EntityAIOwnerHurtTarget extends EntityAITarget +{ + EntityTameable theEntityTameable; + EntityLivingBase theTarget; + private int field_142050_e; + + public EntityAIOwnerHurtTarget(EntityTameable theEntityTameableIn) + { + super(theEntityTameableIn, false); + this.theEntityTameable = theEntityTameableIn; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theEntityTameable.isTamed()) + { + return false; + } + else + { + EntityLivingBase entitylivingbase = this.theEntityTameable.getOwner(); + + if (entitylivingbase == null) + { + return false; + } + else + { + this.theTarget = entitylivingbase.getLastAttacker(); + int i = entitylivingbase.getLastAttackerTime(); + return i != this.field_142050_e && this.isSuitableTarget(this.theTarget, false) && this.theEntityTameable.shouldAttackEntity(this.theTarget, entitylivingbase); + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.taskOwner.setAttackTarget(this.theTarget); + EntityLivingBase entitylivingbase = this.theEntityTameable.getOwner(); + + if (entitylivingbase != null) + { + this.field_142050_e = entitylivingbase.getLastAttackerTime(); + } + + super.startExecuting(); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIPanic.java b/src/minecraft/net/minecraft/entity/ai/EntityAIPanic.java new file mode 100644 index 0000000..171d699 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIPanic.java @@ -0,0 +1,63 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.util.Vec3; + +public class EntityAIPanic extends EntityAIBase +{ + private EntityCreature theEntityCreature; + protected double speed; + private double randPosX; + private double randPosY; + private double randPosZ; + + public EntityAIPanic(EntityCreature creature, double speedIn) + { + this.theEntityCreature = creature; + this.speed = speedIn; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.theEntityCreature.getAITarget() == null && !this.theEntityCreature.isBurning()) + { + return false; + } + else + { + Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.theEntityCreature, 5, 4); + + if (vec3 == null) + { + return false; + } + else + { + this.randPosX = vec3.xCoord; + this.randPosY = vec3.yCoord; + this.randPosZ = vec3.zCoord; + return true; + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntityCreature.getNavigator().tryMoveToXYZ(this.randPosX, this.randPosY, this.randPosZ, this.speed); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theEntityCreature.getNavigator().noPath(); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIPlay.java b/src/minecraft/net/minecraft/entity/ai/EntityAIPlay.java new file mode 100644 index 0000000..a4a17b5 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIPlay.java @@ -0,0 +1,124 @@ +package net.minecraft.entity.ai; + +import java.util.List; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.util.Vec3; + +public class EntityAIPlay extends EntityAIBase +{ + private EntityVillager villagerObj; + private EntityLivingBase targetVillager; + private double speed; + private int playTime; + + public EntityAIPlay(EntityVillager villagerObjIn, double speedIn) + { + this.villagerObj = villagerObjIn; + this.speed = speedIn; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.villagerObj.getGrowingAge() >= 0) + { + return false; + } + else if (this.villagerObj.getRNG().nextInt(400) != 0) + { + return false; + } + else + { + List list = this.villagerObj.worldObj.getEntitiesWithinAABB(EntityVillager.class, this.villagerObj.getEntityBoundingBox().expand(6.0D, 3.0D, 6.0D)); + double d0 = Double.MAX_VALUE; + + for (EntityVillager entityvillager : list) + { + if (entityvillager != this.villagerObj && !entityvillager.isPlaying() && entityvillager.getGrowingAge() < 0) + { + double d1 = entityvillager.getDistanceSqToEntity(this.villagerObj); + + if (d1 <= d0) + { + d0 = d1; + this.targetVillager = entityvillager; + } + } + } + + if (this.targetVillager == null) + { + Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.villagerObj, 16, 3); + + if (vec3 == null) + { + return false; + } + } + + return true; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.playTime > 0; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + if (this.targetVillager != null) + { + this.villagerObj.setPlaying(true); + } + + this.playTime = 1000; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.villagerObj.setPlaying(false); + this.targetVillager = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + --this.playTime; + + if (this.targetVillager != null) + { + if (this.villagerObj.getDistanceSqToEntity(this.targetVillager) > 4.0D) + { + this.villagerObj.getNavigator().tryMoveToEntityLiving(this.targetVillager, this.speed); + } + } + else if (this.villagerObj.getNavigator().noPath()) + { + Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.villagerObj, 16, 3); + + if (vec3 == null) + { + return; + } + + this.villagerObj.getNavigator().tryMoveToXYZ(vec3.xCoord, vec3.yCoord, vec3.zCoord, this.speed); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIRestrictOpenDoor.java b/src/minecraft/net/minecraft/entity/ai/EntityAIRestrictOpenDoor.java new file mode 100644 index 0000000..f81dd85 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIRestrictOpenDoor.java @@ -0,0 +1,84 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.util.BlockPos; +import net.minecraft.village.Village; +import net.minecraft.village.VillageDoorInfo; + +public class EntityAIRestrictOpenDoor extends EntityAIBase +{ + private EntityCreature entityObj; + private VillageDoorInfo frontDoor; + + public EntityAIRestrictOpenDoor(EntityCreature creatureIn) + { + this.entityObj = creatureIn; + + if (!(creatureIn.getNavigator() instanceof PathNavigateGround)) + { + throw new IllegalArgumentException("Unsupported mob type for RestrictOpenDoorGoal"); + } + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.entityObj.worldObj.isDaytime()) + { + return false; + } + else + { + BlockPos blockpos = new BlockPos(this.entityObj); + Village village = this.entityObj.worldObj.getVillageCollection().getNearestVillage(blockpos, 16); + + if (village == null) + { + return false; + } + else + { + this.frontDoor = village.getNearestDoor(blockpos); + return this.frontDoor == null ? false : (double)this.frontDoor.getDistanceToInsideBlockSq(blockpos) < 2.25D; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.entityObj.worldObj.isDaytime() ? false : !this.frontDoor.getIsDetachedFromVillageFlag() && this.frontDoor.func_179850_c(new BlockPos(this.entityObj)); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + ((PathNavigateGround)this.entityObj.getNavigator()).setBreakDoors(false); + ((PathNavigateGround)this.entityObj.getNavigator()).setEnterDoors(false); + } + + /** + * Resets the task + */ + public void resetTask() + { + ((PathNavigateGround)this.entityObj.getNavigator()).setBreakDoors(true); + ((PathNavigateGround)this.entityObj.getNavigator()).setEnterDoors(true); + this.frontDoor = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.frontDoor.incrementDoorOpeningRestrictionCounter(); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIRestrictSun.java b/src/minecraft/net/minecraft/entity/ai/EntityAIRestrictSun.java new file mode 100644 index 0000000..21d6661 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIRestrictSun.java @@ -0,0 +1,38 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.pathfinding.PathNavigateGround; + +public class EntityAIRestrictSun extends EntityAIBase +{ + private EntityCreature theEntity; + + public EntityAIRestrictSun(EntityCreature p_i1652_1_) + { + this.theEntity = p_i1652_1_; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return this.theEntity.worldObj.isDaytime(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + ((PathNavigateGround)this.theEntity.getNavigator()).setAvoidSun(true); + } + + /** + * Resets the task + */ + public void resetTask() + { + ((PathNavigateGround)this.theEntity.getNavigator()).setAvoidSun(false); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java b/src/minecraft/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java new file mode 100644 index 0000000..dd667c1 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIRunAroundLikeCrazy.java @@ -0,0 +1,94 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.Vec3; + +public class EntityAIRunAroundLikeCrazy extends EntityAIBase +{ + private EntityHorse horseHost; + private double speed; + private double targetX; + private double targetY; + private double targetZ; + + public EntityAIRunAroundLikeCrazy(EntityHorse horse, double speedIn) + { + this.horseHost = horse; + this.speed = speedIn; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.horseHost.isTame() && this.horseHost.riddenByEntity != null) + { + Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.horseHost, 5, 4); + + if (vec3 == null) + { + return false; + } + else + { + this.targetX = vec3.xCoord; + this.targetY = vec3.yCoord; + this.targetZ = vec3.zCoord; + return true; + } + } + else + { + return false; + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.horseHost.getNavigator().tryMoveToXYZ(this.targetX, this.targetY, this.targetZ, this.speed); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.horseHost.getNavigator().noPath() && this.horseHost.riddenByEntity != null; + } + + /** + * Updates the task + */ + public void updateTask() + { + if (this.horseHost.getRNG().nextInt(50) == 0) + { + if (this.horseHost.riddenByEntity instanceof EntityPlayer) + { + int i = this.horseHost.getTemper(); + int j = this.horseHost.getMaxTemper(); + + if (j > 0 && this.horseHost.getRNG().nextInt(j) < i) + { + this.horseHost.setTamedBy((EntityPlayer)this.horseHost.riddenByEntity); + this.horseHost.worldObj.setEntityState(this.horseHost, (byte)7); + return; + } + + this.horseHost.increaseTemper(5); + } + + this.horseHost.riddenByEntity.mountEntity((Entity)null); + this.horseHost.riddenByEntity = null; + this.horseHost.makeHorseRearWithSound(); + this.horseHost.worldObj.setEntityState(this.horseHost, (byte)6); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAISit.java b/src/minecraft/net/minecraft/entity/ai/EntityAISit.java new file mode 100644 index 0000000..103066e --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAISit.java @@ -0,0 +1,67 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityTameable; + +public class EntityAISit extends EntityAIBase +{ + private EntityTameable theEntity; + + /** If the EntityTameable is sitting. */ + private boolean isSitting; + + public EntityAISit(EntityTameable entityIn) + { + this.theEntity = entityIn; + this.setMutexBits(5); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theEntity.isTamed()) + { + return false; + } + else if (this.theEntity.isInWater()) + { + return false; + } + else if (!this.theEntity.onGround) + { + return false; + } + else + { + EntityLivingBase entitylivingbase = this.theEntity.getOwner(); + return entitylivingbase == null ? true : (this.theEntity.getDistanceSqToEntity(entitylivingbase) < 144.0D && entitylivingbase.getAITarget() != null ? false : this.isSitting); + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntity.getNavigator().clearPathEntity(); + this.theEntity.setSitting(true); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theEntity.setSitting(false); + } + + /** + * Sets the sitting flag. + */ + public void setSitting(boolean sitting) + { + this.isSitting = sitting; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAISwimming.java b/src/minecraft/net/minecraft/entity/ai/EntityAISwimming.java new file mode 100644 index 0000000..b9706c6 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAISwimming.java @@ -0,0 +1,35 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.pathfinding.PathNavigateGround; + +public class EntityAISwimming extends EntityAIBase +{ + private EntityLiving theEntity; + + public EntityAISwimming(EntityLiving entitylivingIn) + { + this.theEntity = entitylivingIn; + this.setMutexBits(4); + ((PathNavigateGround)entitylivingIn.getNavigator()).setCanSwim(true); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return this.theEntity.isInWater() || this.theEntity.isInLava(); + } + + /** + * Updates the task + */ + public void updateTask() + { + if (this.theEntity.getRNG().nextFloat() < 0.8F) + { + this.theEntity.getJumpHelper().setJumping(); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAITarget.java b/src/minecraft/net/minecraft/entity/ai/EntityAITarget.java new file mode 100644 index 0000000..a24d201 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAITarget.java @@ -0,0 +1,256 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityOwnable; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.pathfinding.PathPoint; +import net.minecraft.scoreboard.Team; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import org.apache.commons.lang3.StringUtils; + +public abstract class EntityAITarget extends EntityAIBase +{ + /** The entity that this task belongs to */ + protected final EntityCreature taskOwner; + + /** + * If true, EntityAI targets must be able to be seen (cannot be blocked by walls) to be suitable targets. + */ + protected boolean shouldCheckSight; + + /** + * When true, only entities that can be reached with minimal effort will be targetted. + */ + private boolean nearbyOnly; + + /** + * When nearbyOnly is true: 0 -> No target, but OK to search; 1 -> Nearby target found; 2 -> Target too far. + */ + private int targetSearchStatus; + + /** + * When nearbyOnly is true, this throttles target searching to avoid excessive pathfinding. + */ + private int targetSearchDelay; + + /** + * If @shouldCheckSight is true, the number of ticks before the interuption of this AITastk when the entity does't + * see the target + */ + private int targetUnseenTicks; + + public EntityAITarget(EntityCreature creature, boolean checkSight) + { + this(creature, checkSight, false); + } + + public EntityAITarget(EntityCreature creature, boolean checkSight, boolean onlyNearby) + { + this.taskOwner = creature; + this.shouldCheckSight = checkSight; + this.nearbyOnly = onlyNearby; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + EntityLivingBase entitylivingbase = this.taskOwner.getAttackTarget(); + + if (entitylivingbase == null) + { + return false; + } + else if (!entitylivingbase.isEntityAlive()) + { + return false; + } + else + { + Team team = this.taskOwner.getTeam(); + Team team1 = entitylivingbase.getTeam(); + + if (team != null && team1 == team) + { + return false; + } + else + { + double d0 = this.getTargetDistance(); + + if (this.taskOwner.getDistanceSqToEntity(entitylivingbase) > d0 * d0) + { + return false; + } + else + { + if (this.shouldCheckSight) + { + if (this.taskOwner.getEntitySenses().canSee(entitylivingbase)) + { + this.targetUnseenTicks = 0; + } + else if (++this.targetUnseenTicks > 60) + { + return false; + } + } + + return !(entitylivingbase instanceof EntityPlayer) || !((EntityPlayer)entitylivingbase).capabilities.disableDamage; + } + } + } + } + + protected double getTargetDistance() + { + IAttributeInstance iattributeinstance = this.taskOwner.getEntityAttribute(SharedMonsterAttributes.followRange); + return iattributeinstance == null ? 16.0D : iattributeinstance.getAttributeValue(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.targetSearchStatus = 0; + this.targetSearchDelay = 0; + this.targetUnseenTicks = 0; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.taskOwner.setAttackTarget((EntityLivingBase)null); + } + + /** + * A static method used to see if an entity is a suitable target through a number of checks. + */ + public static boolean isSuitableTarget(EntityLiving attacker, EntityLivingBase target, boolean includeInvincibles, boolean checkSight) + { + if (target == null) + { + return false; + } + else if (target == attacker) + { + return false; + } + else if (!target.isEntityAlive()) + { + return false; + } + else if (!attacker.canAttackClass(target.getClass())) + { + return false; + } + else + { + Team team = attacker.getTeam(); + Team team1 = target.getTeam(); + + if (team != null && team1 == team) + { + return false; + } + else + { + if (attacker instanceof IEntityOwnable && StringUtils.isNotEmpty(((IEntityOwnable)attacker).getOwnerId())) + { + if (target instanceof IEntityOwnable && ((IEntityOwnable)attacker).getOwnerId().equals(((IEntityOwnable)target).getOwnerId())) + { + return false; + } + + if (target == ((IEntityOwnable)attacker).getOwner()) + { + return false; + } + } + else if (target instanceof EntityPlayer && !includeInvincibles && ((EntityPlayer)target).capabilities.disableDamage) + { + return false; + } + + return !checkSight || attacker.getEntitySenses().canSee(target); + } + } + } + + /** + * A method used to see if an entity is a suitable target through a number of checks. Args : entity, + * canTargetInvinciblePlayer + */ + protected boolean isSuitableTarget(EntityLivingBase target, boolean includeInvincibles) + { + if (!isSuitableTarget(this.taskOwner, target, includeInvincibles, this.shouldCheckSight)) + { + return false; + } + else if (!this.taskOwner.isWithinHomeDistanceFromPosition(new BlockPos(target))) + { + return false; + } + else + { + if (this.nearbyOnly) + { + if (--this.targetSearchDelay <= 0) + { + this.targetSearchStatus = 0; + } + + if (this.targetSearchStatus == 0) + { + this.targetSearchStatus = this.canEasilyReach(target) ? 1 : 2; + } + + if (this.targetSearchStatus == 2) + { + return false; + } + } + + return true; + } + } + + /** + * Checks to see if this entity can find a short path to the given target. + */ + private boolean canEasilyReach(EntityLivingBase p_75295_1_) + { + this.targetSearchDelay = 10 + this.taskOwner.getRNG().nextInt(5); + PathEntity pathentity = this.taskOwner.getNavigator().getPathToEntityLiving(p_75295_1_); + + if (pathentity == null) + { + return false; + } + else + { + PathPoint pathpoint = pathentity.getFinalPathPoint(); + + if (pathpoint == null) + { + return false; + } + else + { + int i = pathpoint.xCoord - MathHelper.floor_double(p_75295_1_.posX); + int j = pathpoint.zCoord - MathHelper.floor_double(p_75295_1_.posZ); + return (double)(i * i + j * j) <= 2.25D; + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAITargetNonTamed.java b/src/minecraft/net/minecraft/entity/ai/EntityAITargetNonTamed.java new file mode 100644 index 0000000..dd98e2e --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAITargetNonTamed.java @@ -0,0 +1,24 @@ +package net.minecraft.entity.ai; + +import com.google.common.base.Predicate; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityTameable; + +public class EntityAITargetNonTamed extends EntityAINearestAttackableTarget +{ + private EntityTameable theTameable; + + public EntityAITargetNonTamed(EntityTameable entityIn, Class classTarget, boolean checkSight, Predicate targetSelector) + { + super(entityIn, classTarget, 10, checkSight, false, targetSelector); + this.theTameable = entityIn; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return !this.theTameable.isTamed() && super.shouldExecute(); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAITasks.java b/src/minecraft/net/minecraft/entity/ai/EntityAITasks.java new file mode 100644 index 0000000..3733db5 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAITasks.java @@ -0,0 +1,184 @@ +package net.minecraft.entity.ai; + +import com.google.common.collect.Lists; +import java.util.Iterator; +import java.util.List; +import net.minecraft.profiler.Profiler; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class EntityAITasks +{ + private static final Logger logger = LogManager.getLogger(); + private List taskEntries = Lists.newArrayList(); + private List executingTaskEntries = Lists.newArrayList(); + + /** Instance of Profiler. */ + private final Profiler theProfiler; + private int tickCount; + private int tickRate = 3; + + public EntityAITasks(Profiler profilerIn) + { + this.theProfiler = profilerIn; + } + + /** + * Add a now AITask. Args : priority, task + */ + public void addTask(int priority, EntityAIBase task) + { + this.taskEntries.add(new EntityAITasks.EntityAITaskEntry(priority, task)); + } + + /** + * removes the indicated task from the entity's AI tasks. + */ + public void removeTask(EntityAIBase task) + { + Iterator iterator = this.taskEntries.iterator(); + + while (iterator.hasNext()) + { + EntityAITasks.EntityAITaskEntry entityaitasks$entityaitaskentry = (EntityAITasks.EntityAITaskEntry)iterator.next(); + EntityAIBase entityaibase = entityaitasks$entityaitaskentry.action; + + if (entityaibase == task) + { + if (this.executingTaskEntries.contains(entityaitasks$entityaitaskentry)) + { + entityaibase.resetTask(); + this.executingTaskEntries.remove(entityaitasks$entityaitaskentry); + } + + iterator.remove(); + } + } + } + + public void onUpdateTasks() + { + this.theProfiler.startSection("goalSetup"); + + if (this.tickCount++ % this.tickRate == 0) + { + Iterator iterator = this.taskEntries.iterator(); + label38: + + while (true) + { + EntityAITasks.EntityAITaskEntry entityaitasks$entityaitaskentry; + + while (true) + { + if (!iterator.hasNext()) + { + break label38; + } + + entityaitasks$entityaitaskentry = (EntityAITasks.EntityAITaskEntry)iterator.next(); + boolean flag = this.executingTaskEntries.contains(entityaitasks$entityaitaskentry); + + if (!flag) + { + break; + } + + if (!this.canUse(entityaitasks$entityaitaskentry) || !this.canContinue(entityaitasks$entityaitaskentry)) + { + entityaitasks$entityaitaskentry.action.resetTask(); + this.executingTaskEntries.remove(entityaitasks$entityaitaskentry); + break; + } + } + + if (this.canUse(entityaitasks$entityaitaskentry) && entityaitasks$entityaitaskentry.action.shouldExecute()) + { + entityaitasks$entityaitaskentry.action.startExecuting(); + this.executingTaskEntries.add(entityaitasks$entityaitaskentry); + } + } + } + else + { + Iterator iterator1 = this.executingTaskEntries.iterator(); + + while (iterator1.hasNext()) + { + EntityAITasks.EntityAITaskEntry entityaitasks$entityaitaskentry1 = (EntityAITasks.EntityAITaskEntry)iterator1.next(); + + if (!this.canContinue(entityaitasks$entityaitaskentry1)) + { + entityaitasks$entityaitaskentry1.action.resetTask(); + iterator1.remove(); + } + } + } + + this.theProfiler.endSection(); + this.theProfiler.startSection("goalTick"); + + for (EntityAITasks.EntityAITaskEntry entityaitasks$entityaitaskentry2 : this.executingTaskEntries) + { + entityaitasks$entityaitaskentry2.action.updateTask(); + } + + this.theProfiler.endSection(); + } + + /** + * Determine if a specific AI Task should continue being executed. + */ + private boolean canContinue(EntityAITasks.EntityAITaskEntry taskEntry) + { + boolean flag = taskEntry.action.continueExecuting(); + return flag; + } + + /** + * Determine if a specific AI Task can be executed, which means that all running higher (= lower int value) priority + * tasks are compatible with it or all lower priority tasks can be interrupted. + */ + private boolean canUse(EntityAITasks.EntityAITaskEntry taskEntry) + { + for (EntityAITasks.EntityAITaskEntry entityaitasks$entityaitaskentry : this.taskEntries) + { + if (entityaitasks$entityaitaskentry != taskEntry) + { + if (taskEntry.priority >= entityaitasks$entityaitaskentry.priority) + { + if (!this.areTasksCompatible(taskEntry, entityaitasks$entityaitaskentry) && this.executingTaskEntries.contains(entityaitasks$entityaitaskentry)) + { + return false; + } + } + else if (!entityaitasks$entityaitaskentry.action.isInterruptible() && this.executingTaskEntries.contains(entityaitasks$entityaitaskentry)) + { + return false; + } + } + } + + return true; + } + + /** + * Returns whether two EntityAITaskEntries can be executed concurrently + */ + private boolean areTasksCompatible(EntityAITasks.EntityAITaskEntry taskEntry1, EntityAITasks.EntityAITaskEntry taskEntry2) + { + return (taskEntry1.action.getMutexBits() & taskEntry2.action.getMutexBits()) == 0; + } + + class EntityAITaskEntry + { + public EntityAIBase action; + public int priority; + + public EntityAITaskEntry(int priorityIn, EntityAIBase task) + { + this.priority = priorityIn; + this.action = task; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAITempt.java b/src/minecraft/net/minecraft/entity/ai/EntityAITempt.java new file mode 100644 index 0000000..28f2400 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAITempt.java @@ -0,0 +1,171 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.pathfinding.PathNavigateGround; + +public class EntityAITempt extends EntityAIBase +{ + /** The entity using this AI that is tempted by the player. */ + private EntityCreature temptedEntity; + private double speed; + + /** X position of player tempting this mob */ + private double targetX; + + /** Y position of player tempting this mob */ + private double targetY; + + /** Z position of player tempting this mob */ + private double targetZ; + + /** Tempting player's pitch */ + private double pitch; + + /** Tempting player's yaw */ + private double yaw; + + /** The player that is tempting the entity that is using this AI. */ + private EntityPlayer temptingPlayer; + + /** + * A counter that is decremented each time the shouldExecute method is called. The shouldExecute method will always + * return false if delayTemptCounter is greater than 0. + */ + private int delayTemptCounter; + + /** True if this EntityAITempt task is running */ + private boolean isRunning; + private Item temptItem; + + /** + * Whether the entity using this AI will be scared by the tempter's sudden movement. + */ + private boolean scaredByPlayerMovement; + private boolean avoidWater; + + public EntityAITempt(EntityCreature temptedEntityIn, double speedIn, Item temptItemIn, boolean scaredByPlayerMovementIn) + { + this.temptedEntity = temptedEntityIn; + this.speed = speedIn; + this.temptItem = temptItemIn; + this.scaredByPlayerMovement = scaredByPlayerMovementIn; + this.setMutexBits(3); + + if (!(temptedEntityIn.getNavigator() instanceof PathNavigateGround)) + { + throw new IllegalArgumentException("Unsupported mob type for TemptGoal"); + } + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.delayTemptCounter > 0) + { + --this.delayTemptCounter; + return false; + } + else + { + this.temptingPlayer = this.temptedEntity.worldObj.getClosestPlayerToEntity(this.temptedEntity, 10.0D); + + if (this.temptingPlayer == null) + { + return false; + } + else + { + ItemStack itemstack = this.temptingPlayer.getCurrentEquippedItem(); + return itemstack == null ? false : itemstack.getItem() == this.temptItem; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + if (this.scaredByPlayerMovement) + { + if (this.temptedEntity.getDistanceSqToEntity(this.temptingPlayer) < 36.0D) + { + if (this.temptingPlayer.getDistanceSq(this.targetX, this.targetY, this.targetZ) > 0.010000000000000002D) + { + return false; + } + + if (Math.abs((double)this.temptingPlayer.rotationPitch - this.pitch) > 5.0D || Math.abs((double)this.temptingPlayer.rotationYaw - this.yaw) > 5.0D) + { + return false; + } + } + else + { + this.targetX = this.temptingPlayer.posX; + this.targetY = this.temptingPlayer.posY; + this.targetZ = this.temptingPlayer.posZ; + } + + this.pitch = (double)this.temptingPlayer.rotationPitch; + this.yaw = (double)this.temptingPlayer.rotationYaw; + } + + return this.shouldExecute(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.targetX = this.temptingPlayer.posX; + this.targetY = this.temptingPlayer.posY; + this.targetZ = this.temptingPlayer.posZ; + this.isRunning = true; + this.avoidWater = ((PathNavigateGround)this.temptedEntity.getNavigator()).getAvoidsWater(); + ((PathNavigateGround)this.temptedEntity.getNavigator()).setAvoidsWater(false); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.temptingPlayer = null; + this.temptedEntity.getNavigator().clearPathEntity(); + this.delayTemptCounter = 100; + this.isRunning = false; + ((PathNavigateGround)this.temptedEntity.getNavigator()).setAvoidsWater(this.avoidWater); + } + + /** + * Updates the task + */ + public void updateTask() + { + this.temptedEntity.getLookHelper().setLookPositionWithEntity(this.temptingPlayer, 30.0F, (float)this.temptedEntity.getVerticalFaceSpeed()); + + if (this.temptedEntity.getDistanceSqToEntity(this.temptingPlayer) < 6.25D) + { + this.temptedEntity.getNavigator().clearPathEntity(); + } + else + { + this.temptedEntity.getNavigator().tryMoveToEntityLiving(this.temptingPlayer, this.speed); + } + } + + /** + * @see #isRunning + */ + public boolean isRunning() + { + return this.isRunning; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAITradePlayer.java b/src/minecraft/net/minecraft/entity/ai/EntityAITradePlayer.java new file mode 100644 index 0000000..100be46 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAITradePlayer.java @@ -0,0 +1,60 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; + +public class EntityAITradePlayer extends EntityAIBase +{ + private EntityVillager villager; + + public EntityAITradePlayer(EntityVillager villagerIn) + { + this.villager = villagerIn; + this.setMutexBits(5); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.villager.isEntityAlive()) + { + return false; + } + else if (this.villager.isInWater()) + { + return false; + } + else if (!this.villager.onGround) + { + return false; + } + else if (this.villager.velocityChanged) + { + return false; + } + else + { + EntityPlayer entityplayer = this.villager.getCustomer(); + return entityplayer == null ? false : (this.villager.getDistanceSqToEntity(entityplayer) > 16.0D ? false : entityplayer.openContainer instanceof Container); + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.villager.getNavigator().clearPathEntity(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.villager.setCustomer((EntityPlayer)null); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIVillagerInteract.java b/src/minecraft/net/minecraft/entity/ai/EntityAIVillagerInteract.java new file mode 100644 index 0000000..b2dc3e9 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIVillagerInteract.java @@ -0,0 +1,102 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.init.Items; +import net.minecraft.inventory.InventoryBasic; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; + +public class EntityAIVillagerInteract extends EntityAIWatchClosest2 +{ + /** The delay before the villager throws an itemstack (in ticks) */ + private int interactionDelay; + private EntityVillager villager; + + public EntityAIVillagerInteract(EntityVillager villagerIn) + { + super(villagerIn, EntityVillager.class, 3.0F, 0.02F); + this.villager = villagerIn; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + super.startExecuting(); + + if (this.villager.canAbondonItems() && this.closestEntity instanceof EntityVillager && ((EntityVillager)this.closestEntity).func_175557_cr()) + { + this.interactionDelay = 10; + } + else + { + this.interactionDelay = 0; + } + } + + /** + * Updates the task + */ + public void updateTask() + { + super.updateTask(); + + if (this.interactionDelay > 0) + { + --this.interactionDelay; + + if (this.interactionDelay == 0) + { + InventoryBasic inventorybasic = this.villager.getVillagerInventory(); + + for (int i = 0; i < inventorybasic.getSizeInventory(); ++i) + { + ItemStack itemstack = inventorybasic.getStackInSlot(i); + ItemStack itemstack1 = null; + + if (itemstack != null) + { + Item item = itemstack.getItem(); + + if ((item == Items.bread || item == Items.potato || item == Items.carrot) && itemstack.stackSize > 3) + { + int l = itemstack.stackSize / 2; + itemstack.stackSize -= l; + itemstack1 = new ItemStack(item, l, itemstack.getMetadata()); + } + else if (item == Items.wheat && itemstack.stackSize > 5) + { + int j = itemstack.stackSize / 2 / 3 * 3; + int k = j / 3; + itemstack.stackSize -= j; + itemstack1 = new ItemStack(Items.bread, k, 0); + } + + if (itemstack.stackSize <= 0) + { + inventorybasic.setInventorySlotContents(i, (ItemStack)null); + } + } + + if (itemstack1 != null) + { + double d0 = this.villager.posY - 0.30000001192092896D + (double)this.villager.getEyeHeight(); + EntityItem entityitem = new EntityItem(this.villager.worldObj, this.villager.posX, d0, this.villager.posZ, itemstack1); + float f = 0.3F; + float f1 = this.villager.rotationYawHead; + float f2 = this.villager.rotationPitch; + entityitem.motionX = (double)(-MathHelper.sin(f1 / 180.0F * (float)Math.PI) * MathHelper.cos(f2 / 180.0F * (float)Math.PI) * f); + entityitem.motionZ = (double)(MathHelper.cos(f1 / 180.0F * (float)Math.PI) * MathHelper.cos(f2 / 180.0F * (float)Math.PI) * f); + entityitem.motionY = (double)(-MathHelper.sin(f2 / 180.0F * (float)Math.PI) * f + 0.1F); + entityitem.setDefaultPickupDelay(); + this.villager.worldObj.spawnEntityInWorld(entityitem); + break; + } + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIVillagerMate.java b/src/minecraft/net/minecraft/entity/ai/EntityAIVillagerMate.java new file mode 100644 index 0000000..4385753 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIVillagerMate.java @@ -0,0 +1,141 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.util.BlockPos; +import net.minecraft.village.Village; +import net.minecraft.world.World; + +public class EntityAIVillagerMate extends EntityAIBase +{ + private EntityVillager villagerObj; + private EntityVillager mate; + private World worldObj; + private int matingTimeout; + Village villageObj; + + public EntityAIVillagerMate(EntityVillager villagerIn) + { + this.villagerObj = villagerIn; + this.worldObj = villagerIn.worldObj; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.villagerObj.getGrowingAge() != 0) + { + return false; + } + else if (this.villagerObj.getRNG().nextInt(500) != 0) + { + return false; + } + else + { + this.villageObj = this.worldObj.getVillageCollection().getNearestVillage(new BlockPos(this.villagerObj), 0); + + if (this.villageObj == null) + { + return false; + } + else if (this.checkSufficientDoorsPresentForNewVillager() && this.villagerObj.getIsWillingToMate(true)) + { + Entity entity = this.worldObj.findNearestEntityWithinAABB(EntityVillager.class, this.villagerObj.getEntityBoundingBox().expand(8.0D, 3.0D, 8.0D), this.villagerObj); + + if (entity == null) + { + return false; + } + else + { + this.mate = (EntityVillager)entity; + return this.mate.getGrowingAge() == 0 && this.mate.getIsWillingToMate(true); + } + } + else + { + return false; + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.matingTimeout = 300; + this.villagerObj.setMating(true); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.villageObj = null; + this.mate = null; + this.villagerObj.setMating(false); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.matingTimeout >= 0 && this.checkSufficientDoorsPresentForNewVillager() && this.villagerObj.getGrowingAge() == 0 && this.villagerObj.getIsWillingToMate(false); + } + + /** + * Updates the task + */ + public void updateTask() + { + --this.matingTimeout; + this.villagerObj.getLookHelper().setLookPositionWithEntity(this.mate, 10.0F, 30.0F); + + if (this.villagerObj.getDistanceSqToEntity(this.mate) > 2.25D) + { + this.villagerObj.getNavigator().tryMoveToEntityLiving(this.mate, 0.25D); + } + else if (this.matingTimeout == 0 && this.mate.isMating()) + { + this.giveBirth(); + } + + if (this.villagerObj.getRNG().nextInt(35) == 0) + { + this.worldObj.setEntityState(this.villagerObj, (byte)12); + } + } + + private boolean checkSufficientDoorsPresentForNewVillager() + { + if (!this.villageObj.isMatingSeason()) + { + return false; + } + else + { + int i = (int)((double)((float)this.villageObj.getNumVillageDoors()) * 0.35D); + return this.villageObj.getNumVillagers() < i; + } + } + + private void giveBirth() + { + EntityVillager entityvillager = this.villagerObj.createChild(this.mate); + this.mate.setGrowingAge(6000); + this.villagerObj.setGrowingAge(6000); + this.mate.setIsWillingToMate(false); + this.villagerObj.setIsWillingToMate(false); + entityvillager.setGrowingAge(-24000); + entityvillager.setLocationAndAngles(this.villagerObj.posX, this.villagerObj.posY, this.villagerObj.posZ, 0.0F, 0.0F); + this.worldObj.spawnEntityInWorld(entityvillager); + this.worldObj.setEntityState(entityvillager, (byte)12); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIWander.java b/src/minecraft/net/minecraft/entity/ai/EntityAIWander.java new file mode 100644 index 0000000..bfb003c --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIWander.java @@ -0,0 +1,94 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.util.Vec3; + +public class EntityAIWander extends EntityAIBase +{ + private EntityCreature entity; + private double xPosition; + private double yPosition; + private double zPosition; + private double speed; + private int executionChance; + private boolean mustUpdate; + + public EntityAIWander(EntityCreature creatureIn, double speedIn) + { + this(creatureIn, speedIn, 120); + } + + public EntityAIWander(EntityCreature creatureIn, double speedIn, int chance) + { + this.entity = creatureIn; + this.speed = speedIn; + this.executionChance = chance; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.mustUpdate) + { + if (this.entity.getAge() >= 100) + { + return false; + } + + if (this.entity.getRNG().nextInt(this.executionChance) != 0) + { + return false; + } + } + + Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.entity, 10, 7); + + if (vec3 == null) + { + return false; + } + else + { + this.xPosition = vec3.xCoord; + this.yPosition = vec3.yCoord; + this.zPosition = vec3.zCoord; + this.mustUpdate = false; + return true; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.entity.getNavigator().noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.entity.getNavigator().tryMoveToXYZ(this.xPosition, this.yPosition, this.zPosition, this.speed); + } + + /** + * Makes task to bypass chance + */ + public void makeUpdate() + { + this.mustUpdate = true; + } + + /** + * Changes task random possibility for execution + */ + public void setExecutionChance(int newchance) + { + this.executionChance = newchance; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIWatchClosest.java b/src/minecraft/net/minecraft/entity/ai/EntityAIWatchClosest.java new file mode 100644 index 0000000..ce33506 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIWatchClosest.java @@ -0,0 +1,99 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; + +public class EntityAIWatchClosest extends EntityAIBase +{ + protected EntityLiving theWatcher; + + /** The closest entity which is being watched by this one. */ + protected Entity closestEntity; + + /** This is the Maximum distance that the AI will look for the Entity */ + protected float maxDistanceForPlayer; + private int lookTime; + private float chance; + protected Class watchedClass; + + public EntityAIWatchClosest(EntityLiving entitylivingIn, Class watchTargetClass, float maxDistance) + { + this.theWatcher = entitylivingIn; + this.watchedClass = watchTargetClass; + this.maxDistanceForPlayer = maxDistance; + this.chance = 0.02F; + this.setMutexBits(2); + } + + public EntityAIWatchClosest(EntityLiving entitylivingIn, Class watchTargetClass, float maxDistance, float chanceIn) + { + this.theWatcher = entitylivingIn; + this.watchedClass = watchTargetClass; + this.maxDistanceForPlayer = maxDistance; + this.chance = chanceIn; + this.setMutexBits(2); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.theWatcher.getRNG().nextFloat() >= this.chance) + { + return false; + } + else + { + if (this.theWatcher.getAttackTarget() != null) + { + this.closestEntity = this.theWatcher.getAttackTarget(); + } + + if (this.watchedClass == EntityPlayer.class) + { + this.closestEntity = this.theWatcher.worldObj.getClosestPlayerToEntity(this.theWatcher, (double)this.maxDistanceForPlayer); + } + else + { + this.closestEntity = this.theWatcher.worldObj.findNearestEntityWithinAABB(this.watchedClass, this.theWatcher.getEntityBoundingBox().expand((double)this.maxDistanceForPlayer, 3.0D, (double)this.maxDistanceForPlayer), this.theWatcher); + } + + return this.closestEntity != null; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.closestEntity.isEntityAlive() ? false : (this.theWatcher.getDistanceSqToEntity(this.closestEntity) > (double)(this.maxDistanceForPlayer * this.maxDistanceForPlayer) ? false : this.lookTime > 0); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.lookTime = 40 + this.theWatcher.getRNG().nextInt(40); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.closestEntity = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theWatcher.getLookHelper().setLookPosition(this.closestEntity.posX, this.closestEntity.posY + (double)this.closestEntity.getEyeHeight(), this.closestEntity.posZ, 10.0F, (float)this.theWatcher.getVerticalFaceSpeed()); + --this.lookTime; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityAIWatchClosest2.java b/src/minecraft/net/minecraft/entity/ai/EntityAIWatchClosest2.java new file mode 100644 index 0000000..56e249b --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityAIWatchClosest2.java @@ -0,0 +1,13 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; + +public class EntityAIWatchClosest2 extends EntityAIWatchClosest +{ + public EntityAIWatchClosest2(EntityLiving entitylivingIn, Class watchTargetClass, float maxDistance, float chanceIn) + { + super(entitylivingIn, watchTargetClass, maxDistance, chanceIn); + this.setMutexBits(3); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityJumpHelper.java b/src/minecraft/net/minecraft/entity/ai/EntityJumpHelper.java new file mode 100644 index 0000000..de4ff4e --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityJumpHelper.java @@ -0,0 +1,28 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLiving; + +public class EntityJumpHelper +{ + private EntityLiving entity; + protected boolean isJumping; + + public EntityJumpHelper(EntityLiving entityIn) + { + this.entity = entityIn; + } + + public void setJumping() + { + this.isJumping = true; + } + + /** + * Called to actually make the entity jump if isJumping is true. + */ + public void doJump() + { + this.entity.setJumping(this.isJumping); + this.isJumping = false; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityLookHelper.java b/src/minecraft/net/minecraft/entity/ai/EntityLookHelper.java new file mode 100644 index 0000000..3468cd1 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityLookHelper.java @@ -0,0 +1,144 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; + +public class EntityLookHelper +{ + private EntityLiving entity; + + /** + * The amount of change that is made each update for an entity facing a direction. + */ + private float deltaLookYaw; + + /** + * The amount of change that is made each update for an entity facing a direction. + */ + private float deltaLookPitch; + + /** Whether or not the entity is trying to look at something. */ + private boolean isLooking; + private double posX; + private double posY; + private double posZ; + + public EntityLookHelper(EntityLiving entitylivingIn) + { + this.entity = entitylivingIn; + } + + /** + * Sets position to look at using entity + */ + public void setLookPositionWithEntity(Entity entityIn, float deltaYaw, float deltaPitch) + { + this.posX = entityIn.posX; + + if (entityIn instanceof EntityLivingBase) + { + this.posY = entityIn.posY + (double)entityIn.getEyeHeight(); + } + else + { + this.posY = (entityIn.getEntityBoundingBox().minY + entityIn.getEntityBoundingBox().maxY) / 2.0D; + } + + this.posZ = entityIn.posZ; + this.deltaLookYaw = deltaYaw; + this.deltaLookPitch = deltaPitch; + this.isLooking = true; + } + + /** + * Sets position to look at + */ + public void setLookPosition(double x, double y, double z, float deltaYaw, float deltaPitch) + { + this.posX = x; + this.posY = y; + this.posZ = z; + this.deltaLookYaw = deltaYaw; + this.deltaLookPitch = deltaPitch; + this.isLooking = true; + } + + /** + * Updates look + */ + public void onUpdateLook() + { + this.entity.rotationPitch = 0.0F; + + if (this.isLooking) + { + this.isLooking = false; + double d0 = this.posX - this.entity.posX; + double d1 = this.posY - (this.entity.posY + (double)this.entity.getEyeHeight()); + double d2 = this.posZ - this.entity.posZ; + double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2); + float f = (float)(MathHelper.func_181159_b(d2, d0) * 180.0D / Math.PI) - 90.0F; + float f1 = (float)(-(MathHelper.func_181159_b(d1, d3) * 180.0D / Math.PI)); + this.entity.rotationPitch = this.updateRotation(this.entity.rotationPitch, f1, this.deltaLookPitch); + this.entity.rotationYawHead = this.updateRotation(this.entity.rotationYawHead, f, this.deltaLookYaw); + } + else + { + this.entity.rotationYawHead = this.updateRotation(this.entity.rotationYawHead, this.entity.renderYawOffset, 10.0F); + } + + float f2 = MathHelper.wrapAngleTo180_float(this.entity.rotationYawHead - this.entity.renderYawOffset); + + if (!this.entity.getNavigator().noPath()) + { + if (f2 < -75.0F) + { + this.entity.rotationYawHead = this.entity.renderYawOffset - 75.0F; + } + + if (f2 > 75.0F) + { + this.entity.rotationYawHead = this.entity.renderYawOffset + 75.0F; + } + } + } + + private float updateRotation(float p_75652_1_, float p_75652_2_, float p_75652_3_) + { + float f = MathHelper.wrapAngleTo180_float(p_75652_2_ - p_75652_1_); + + if (f > p_75652_3_) + { + f = p_75652_3_; + } + + if (f < -p_75652_3_) + { + f = -p_75652_3_; + } + + return p_75652_1_ + f; + } + + public boolean getIsLooking() + { + return this.isLooking; + } + + public double getLookPosX() + { + return this.posX; + } + + public double getLookPosY() + { + return this.posY; + } + + public double getLookPosZ() + { + return this.posZ; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityMinecartMobSpawner.java b/src/minecraft/net/minecraft/entity/ai/EntityMinecartMobSpawner.java new file mode 100644 index 0000000..ed28651 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityMinecartMobSpawner.java @@ -0,0 +1,86 @@ +package net.minecraft.entity.ai; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.MobSpawnerBaseLogic; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class EntityMinecartMobSpawner extends EntityMinecart +{ + /** Mob spawner logic for this spawner minecart. */ + private final MobSpawnerBaseLogic mobSpawnerLogic = new MobSpawnerBaseLogic() + { + public void func_98267_a(int id) + { + EntityMinecartMobSpawner.this.worldObj.setEntityState(EntityMinecartMobSpawner.this, (byte)id); + } + public World getSpawnerWorld() + { + return EntityMinecartMobSpawner.this.worldObj; + } + public BlockPos getSpawnerPosition() + { + return new BlockPos(EntityMinecartMobSpawner.this); + } + }; + + public EntityMinecartMobSpawner(World worldIn) + { + super(worldIn); + } + + public EntityMinecartMobSpawner(World worldIn, double p_i1726_2_, double p_i1726_4_, double p_i1726_6_) + { + super(worldIn, p_i1726_2_, p_i1726_4_, p_i1726_6_); + } + + public EntityMinecart.EnumMinecartType getMinecartType() + { + return EntityMinecart.EnumMinecartType.SPAWNER; + } + + public IBlockState getDefaultDisplayTile() + { + return Blocks.mob_spawner.getDefaultState(); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.mobSpawnerLogic.readFromNBT(tagCompund); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + this.mobSpawnerLogic.writeToNBT(tagCompound); + } + + public void handleStatusUpdate(byte id) + { + this.mobSpawnerLogic.setDelayToMin(id); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + this.mobSpawnerLogic.updateSpawner(); + } + + public MobSpawnerBaseLogic func_98039_d() + { + return this.mobSpawnerLogic; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntityMoveHelper.java b/src/minecraft/net/minecraft/entity/ai/EntityMoveHelper.java new file mode 100644 index 0000000..b5d1fd5 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntityMoveHelper.java @@ -0,0 +1,121 @@ +package net.minecraft.entity.ai; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.util.MathHelper; + +public class EntityMoveHelper +{ + /** The EntityLiving that is being moved */ + protected EntityLiving entity; + protected double posX; + protected double posY; + protected double posZ; + + /** The speed at which the entity should move */ + protected double speed; + protected boolean update; + + public EntityMoveHelper(EntityLiving entitylivingIn) + { + this.entity = entitylivingIn; + this.posX = entitylivingIn.posX; + this.posY = entitylivingIn.posY; + this.posZ = entitylivingIn.posZ; + } + + public boolean isUpdating() + { + return this.update; + } + + public double getSpeed() + { + return this.speed; + } + + /** + * Sets the speed and location to move to + */ + public void setMoveTo(double x, double y, double z, double speedIn) + { + this.posX = x; + this.posY = y; + this.posZ = z; + this.speed = speedIn; + this.update = true; + } + + public void onUpdateMoveHelper() + { + this.entity.setMoveForward(0.0F); + + if (this.update) + { + this.update = false; + int i = MathHelper.floor_double(this.entity.getEntityBoundingBox().minY + 0.5D); + double d0 = this.posX - this.entity.posX; + double d1 = this.posZ - this.entity.posZ; + double d2 = this.posY - (double)i; + double d3 = d0 * d0 + d2 * d2 + d1 * d1; + + if (d3 >= 2.500000277905201E-7D) + { + float f = (float)(MathHelper.func_181159_b(d1, d0) * 180.0D / Math.PI) - 90.0F; + this.entity.rotationYaw = this.limitAngle(this.entity.rotationYaw, f, 30.0F); + this.entity.setAIMoveSpeed((float)(this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue())); + + if (d2 > 0.0D && d0 * d0 + d1 * d1 < 1.0D) + { + this.entity.getJumpHelper().setJumping(); + } + } + } + } + + /** + * Limits the given angle to a upper and lower limit. + */ + protected float limitAngle(float p_75639_1_, float p_75639_2_, float p_75639_3_) + { + float f = MathHelper.wrapAngleTo180_float(p_75639_2_ - p_75639_1_); + + if (f > p_75639_3_) + { + f = p_75639_3_; + } + + if (f < -p_75639_3_) + { + f = -p_75639_3_; + } + + float f1 = p_75639_1_ + f; + + if (f1 < 0.0F) + { + f1 += 360.0F; + } + else if (f1 > 360.0F) + { + f1 -= 360.0F; + } + + return f1; + } + + public double getX() + { + return this.posX; + } + + public double getY() + { + return this.posY; + } + + public double getZ() + { + return this.posZ; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/EntitySenses.java b/src/minecraft/net/minecraft/entity/ai/EntitySenses.java new file mode 100644 index 0000000..6a22337 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/EntitySenses.java @@ -0,0 +1,59 @@ +package net.minecraft.entity.ai; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; + +public class EntitySenses +{ + EntityLiving entityObj; + List seenEntities = Lists.newArrayList(); + List unseenEntities = Lists.newArrayList(); + + public EntitySenses(EntityLiving entityObjIn) + { + this.entityObj = entityObjIn; + } + + /** + * Clears canSeeCachePositive and canSeeCacheNegative. + */ + public void clearSensingCache() + { + this.seenEntities.clear(); + this.unseenEntities.clear(); + } + + /** + * Checks, whether 'our' entity can see the entity given as argument (true) or not (false), caching the result. + */ + public boolean canSee(Entity entityIn) + { + if (this.seenEntities.contains(entityIn)) + { + return true; + } + else if (this.unseenEntities.contains(entityIn)) + { + return false; + } + else + { + this.entityObj.worldObj.theProfiler.startSection("canSee"); + boolean flag = this.entityObj.canEntityBeSeen(entityIn); + this.entityObj.worldObj.theProfiler.endSection(); + + if (flag) + { + this.seenEntities.add(entityIn); + } + else + { + this.unseenEntities.add(entityIn); + } + + return flag; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/RandomPositionGenerator.java b/src/minecraft/net/minecraft/entity/ai/RandomPositionGenerator.java new file mode 100644 index 0000000..4efa565 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/RandomPositionGenerator.java @@ -0,0 +1,129 @@ +package net.minecraft.entity.ai; + +import java.util.Random; +import net.minecraft.entity.EntityCreature; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; + +public class RandomPositionGenerator +{ + /** + * used to store a driection when the user passes a point to move towards or away from. WARNING: NEVER THREAD SAFE. + * MULTIPLE findTowards and findAway calls, will share this var + */ + private static Vec3 staticVector = new Vec3(0.0D, 0.0D, 0.0D); + + /** + * finds a random target within par1(x,z) and par2 (y) blocks + */ + public static Vec3 findRandomTarget(EntityCreature entitycreatureIn, int xz, int y) + { + return findRandomTargetBlock(entitycreatureIn, xz, y, (Vec3)null); + } + + /** + * finds a random target within par1(x,z) and par2 (y) blocks in the direction of the point par3 + */ + public static Vec3 findRandomTargetBlockTowards(EntityCreature entitycreatureIn, int xz, int y, Vec3 targetVec3) + { + staticVector = targetVec3.subtract(entitycreatureIn.posX, entitycreatureIn.posY, entitycreatureIn.posZ); + return findRandomTargetBlock(entitycreatureIn, xz, y, staticVector); + } + + /** + * finds a random target within par1(x,z) and par2 (y) blocks in the reverse direction of the point par3 + */ + public static Vec3 findRandomTargetBlockAwayFrom(EntityCreature entitycreatureIn, int xz, int y, Vec3 targetVec3) + { + staticVector = (new Vec3(entitycreatureIn.posX, entitycreatureIn.posY, entitycreatureIn.posZ)).subtract(targetVec3); + return findRandomTargetBlock(entitycreatureIn, xz, y, staticVector); + } + + /** + * searches 10 blocks at random in a within par1(x,z) and par2 (y) distance, ignores those not in the direction of + * par3Vec3, then points to the tile for which creature.getBlockPathWeight returns the highest number + */ + private static Vec3 findRandomTargetBlock(EntityCreature entitycreatureIn, int xz, int y, Vec3 targetVec3) + { + Random random = entitycreatureIn.getRNG(); + boolean flag = false; + int i = 0; + int j = 0; + int k = 0; + float f = -99999.0F; + boolean flag1; + + if (entitycreatureIn.hasHome()) + { + double d0 = entitycreatureIn.getHomePosition().distanceSq((double)MathHelper.floor_double(entitycreatureIn.posX), (double)MathHelper.floor_double(entitycreatureIn.posY), (double)MathHelper.floor_double(entitycreatureIn.posZ)) + 4.0D; + double d1 = (double)(entitycreatureIn.getMaximumHomeDistance() + (float)xz); + flag1 = d0 < d1 * d1; + } + else + { + flag1 = false; + } + + for (int j1 = 0; j1 < 10; ++j1) + { + int l = random.nextInt(2 * xz + 1) - xz; + int k1 = random.nextInt(2 * y + 1) - y; + int i1 = random.nextInt(2 * xz + 1) - xz; + + if (targetVec3 == null || (double)l * targetVec3.xCoord + (double)i1 * targetVec3.zCoord >= 0.0D) + { + if (entitycreatureIn.hasHome() && xz > 1) + { + BlockPos blockpos = entitycreatureIn.getHomePosition(); + + if (entitycreatureIn.posX > (double)blockpos.getX()) + { + l -= random.nextInt(xz / 2); + } + else + { + l += random.nextInt(xz / 2); + } + + if (entitycreatureIn.posZ > (double)blockpos.getZ()) + { + i1 -= random.nextInt(xz / 2); + } + else + { + i1 += random.nextInt(xz / 2); + } + } + + l = l + MathHelper.floor_double(entitycreatureIn.posX); + k1 = k1 + MathHelper.floor_double(entitycreatureIn.posY); + i1 = i1 + MathHelper.floor_double(entitycreatureIn.posZ); + BlockPos blockpos1 = new BlockPos(l, k1, i1); + + if (!flag1 || entitycreatureIn.isWithinHomeDistanceFromPosition(blockpos1)) + { + float f1 = entitycreatureIn.getBlockPathWeight(blockpos1); + + if (f1 > f) + { + f = f1; + i = l; + j = k1; + k = i1; + flag = true; + } + } + } + } + + if (flag) + { + return new Vec3((double)i, (double)j, (double)k); + } + else + { + return null; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/attributes/AttributeModifier.java b/src/minecraft/net/minecraft/entity/ai/attributes/AttributeModifier.java new file mode 100644 index 0000000..6a604ce --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/attributes/AttributeModifier.java @@ -0,0 +1,112 @@ +package net.minecraft.entity.ai.attributes; + +import io.netty.util.internal.ThreadLocalRandom; +import java.util.UUID; +import net.minecraft.util.MathHelper; +import org.apache.commons.lang3.Validate; + +public class AttributeModifier +{ + private final double amount; + private final int operation; + private final String name; + private final UUID id; + + /** + * If false, this modifier is not saved in NBT. Used for "natural" modifiers like speed boost from sprinting + */ + private boolean isSaved; + + public AttributeModifier(String nameIn, double amountIn, int operationIn) + { + this(MathHelper.getRandomUuid(ThreadLocalRandom.current()), nameIn, amountIn, operationIn); + } + + public AttributeModifier(UUID idIn, String nameIn, double amountIn, int operationIn) + { + this.isSaved = true; + this.id = idIn; + this.name = nameIn; + this.amount = amountIn; + this.operation = operationIn; + Validate.notEmpty(nameIn, "Modifier name cannot be empty", new Object[0]); + Validate.inclusiveBetween(0L, 2L, (long)operationIn, "Invalid operation"); + } + + public UUID getID() + { + return this.id; + } + + public String getName() + { + return this.name; + } + + public int getOperation() + { + return this.operation; + } + + public double getAmount() + { + return this.amount; + } + + /** + * @see #isSaved + */ + public boolean isSaved() + { + return this.isSaved; + } + + /** + * @see #isSaved + */ + public AttributeModifier setSaved(boolean saved) + { + this.isSaved = saved; + return this; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) + { + AttributeModifier attributemodifier = (AttributeModifier)p_equals_1_; + + if (this.id != null) + { + if (!this.id.equals(attributemodifier.id)) + { + return false; + } + } + else if (attributemodifier.id != null) + { + return false; + } + + return true; + } + else + { + return false; + } + } + + public int hashCode() + { + return this.id != null ? this.id.hashCode() : 0; + } + + public String toString() + { + return "AttributeModifier{amount=" + this.amount + ", operation=" + this.operation + ", name=\'" + this.name + '\'' + ", id=" + this.id + ", serialize=" + this.isSaved + '}'; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/attributes/BaseAttribute.java b/src/minecraft/net/minecraft/entity/ai/attributes/BaseAttribute.java new file mode 100644 index 0000000..0c87cd7 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/attributes/BaseAttribute.java @@ -0,0 +1,57 @@ +package net.minecraft.entity.ai.attributes; + +public abstract class BaseAttribute implements IAttribute +{ + private final IAttribute field_180373_a; + private final String unlocalizedName; + private final double defaultValue; + private boolean shouldWatch; + + protected BaseAttribute(IAttribute p_i45892_1_, String unlocalizedNameIn, double defaultValueIn) + { + this.field_180373_a = p_i45892_1_; + this.unlocalizedName = unlocalizedNameIn; + this.defaultValue = defaultValueIn; + + if (unlocalizedNameIn == null) + { + throw new IllegalArgumentException("Name cannot be null!"); + } + } + + public String getAttributeUnlocalizedName() + { + return this.unlocalizedName; + } + + public double getDefaultValue() + { + return this.defaultValue; + } + + public boolean getShouldWatch() + { + return this.shouldWatch; + } + + public BaseAttribute setShouldWatch(boolean shouldWatchIn) + { + this.shouldWatch = shouldWatchIn; + return this; + } + + public IAttribute func_180372_d() + { + return this.field_180373_a; + } + + public int hashCode() + { + return this.unlocalizedName.hashCode(); + } + + public boolean equals(Object p_equals_1_) + { + return p_equals_1_ instanceof IAttribute && this.unlocalizedName.equals(((IAttribute)p_equals_1_).getAttributeUnlocalizedName()); + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/attributes/BaseAttributeMap.java b/src/minecraft/net/minecraft/entity/ai/attributes/BaseAttributeMap.java new file mode 100644 index 0000000..c131c05 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/attributes/BaseAttributeMap.java @@ -0,0 +1,88 @@ +package net.minecraft.entity.ai.attributes; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Maps; +import com.google.common.collect.Multimap; +import java.util.Collection; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.server.management.LowerStringMap; + +public abstract class BaseAttributeMap +{ + protected final Map attributes = Maps.newHashMap(); + protected final Map attributesByName = new LowerStringMap(); + protected final Multimap field_180377_c = HashMultimap.create(); + + public IAttributeInstance getAttributeInstance(IAttribute attribute) + { + return (IAttributeInstance)this.attributes.get(attribute); + } + + public IAttributeInstance getAttributeInstanceByName(String attributeName) + { + return (IAttributeInstance)this.attributesByName.get(attributeName); + } + + /** + * Registers an attribute with this AttributeMap, returns a modifiable AttributeInstance associated with this map + */ + public IAttributeInstance registerAttribute(IAttribute attribute) + { + if (this.attributesByName.containsKey(attribute.getAttributeUnlocalizedName())) + { + throw new IllegalArgumentException("Attribute is already registered!"); + } + else + { + IAttributeInstance iattributeinstance = this.func_180376_c(attribute); + this.attributesByName.put(attribute.getAttributeUnlocalizedName(), iattributeinstance); + this.attributes.put(attribute, iattributeinstance); + + for (IAttribute iattribute = attribute.func_180372_d(); iattribute != null; iattribute = iattribute.func_180372_d()) + { + this.field_180377_c.put(iattribute, attribute); + } + + return iattributeinstance; + } + } + + protected abstract IAttributeInstance func_180376_c(IAttribute p_180376_1_); + + public Collection getAllAttributes() + { + return this.attributesByName.values(); + } + + public void func_180794_a(IAttributeInstance p_180794_1_) + { + } + + public void removeAttributeModifiers(Multimap p_111148_1_) + { + for (Entry entry : p_111148_1_.entries()) + { + IAttributeInstance iattributeinstance = this.getAttributeInstanceByName((String)entry.getKey()); + + if (iattributeinstance != null) + { + iattributeinstance.removeModifier((AttributeModifier)entry.getValue()); + } + } + } + + public void applyAttributeModifiers(Multimap p_111147_1_) + { + for (Entry entry : p_111147_1_.entries()) + { + IAttributeInstance iattributeinstance = this.getAttributeInstanceByName((String)entry.getKey()); + + if (iattributeinstance != null) + { + iattributeinstance.removeModifier((AttributeModifier)entry.getValue()); + iattributeinstance.applyModifier((AttributeModifier)entry.getValue()); + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/attributes/IAttribute.java b/src/minecraft/net/minecraft/entity/ai/attributes/IAttribute.java new file mode 100644 index 0000000..07f1a11 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/attributes/IAttribute.java @@ -0,0 +1,14 @@ +package net.minecraft.entity.ai.attributes; + +public interface IAttribute +{ + String getAttributeUnlocalizedName(); + + double clampValue(double p_111109_1_); + + double getDefaultValue(); + + boolean getShouldWatch(); + + IAttribute func_180372_d(); +} diff --git a/src/minecraft/net/minecraft/entity/ai/attributes/IAttributeInstance.java b/src/minecraft/net/minecraft/entity/ai/attributes/IAttributeInstance.java new file mode 100644 index 0000000..5e5ac89 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/attributes/IAttributeInstance.java @@ -0,0 +1,35 @@ +package net.minecraft.entity.ai.attributes; + +import java.util.Collection; +import java.util.UUID; + +public interface IAttributeInstance +{ + /** + * Get the Attribute this is an instance of + */ + IAttribute getAttribute(); + + double getBaseValue(); + + void setBaseValue(double baseValue); + + Collection getModifiersByOperation(int operation); + + Collection func_111122_c(); + + boolean hasModifier(AttributeModifier modifier); + + /** + * Returns attribute modifier, if any, by the given UUID + */ + AttributeModifier getModifier(UUID uuid); + + void applyModifier(AttributeModifier modifier); + + void removeModifier(AttributeModifier modifier); + + void removeAllModifiers(); + + double getAttributeValue(); +} diff --git a/src/minecraft/net/minecraft/entity/ai/attributes/ModifiableAttributeInstance.java b/src/minecraft/net/minecraft/entity/ai/attributes/ModifiableAttributeInstance.java new file mode 100644 index 0000000..790bb2b --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/attributes/ModifiableAttributeInstance.java @@ -0,0 +1,206 @@ +package net.minecraft.entity.ai.attributes; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.util.Collection; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +public class ModifiableAttributeInstance implements IAttributeInstance +{ + /** The BaseAttributeMap this attributeInstance can be found in */ + private final BaseAttributeMap attributeMap; + + /** The Attribute this is an instance of */ + private final IAttribute genericAttribute; + private final Map> mapByOperation = Maps.>newHashMap(); + private final Map> mapByName = Maps.>newHashMap(); + private final Map mapByUUID = Maps.newHashMap(); + private double baseValue; + private boolean needsUpdate = true; + private double cachedValue; + + public ModifiableAttributeInstance(BaseAttributeMap attributeMapIn, IAttribute genericAttributeIn) + { + this.attributeMap = attributeMapIn; + this.genericAttribute = genericAttributeIn; + this.baseValue = genericAttributeIn.getDefaultValue(); + + for (int i = 0; i < 3; ++i) + { + this.mapByOperation.put(Integer.valueOf(i), Sets.newHashSet()); + } + } + + /** + * Get the Attribute this is an instance of + */ + public IAttribute getAttribute() + { + return this.genericAttribute; + } + + public double getBaseValue() + { + return this.baseValue; + } + + public void setBaseValue(double baseValue) + { + if (baseValue != this.getBaseValue()) + { + this.baseValue = baseValue; + this.flagForUpdate(); + } + } + + public Collection getModifiersByOperation(int operation) + { + return (Collection)this.mapByOperation.get(Integer.valueOf(operation)); + } + + public Collection func_111122_c() + { + Set set = Sets.newHashSet(); + + for (int i = 0; i < 3; ++i) + { + set.addAll(this.getModifiersByOperation(i)); + } + + return set; + } + + /** + * Returns attribute modifier, if any, by the given UUID + */ + public AttributeModifier getModifier(UUID uuid) + { + return (AttributeModifier)this.mapByUUID.get(uuid); + } + + public boolean hasModifier(AttributeModifier modifier) + { + return this.mapByUUID.get(modifier.getID()) != null; + } + + public void applyModifier(AttributeModifier modifier) + { + if (this.getModifier(modifier.getID()) != null) + { + throw new IllegalArgumentException("Modifier is already applied on this attribute!"); + } + else + { + Set set = (Set)this.mapByName.get(modifier.getName()); + + if (set == null) + { + set = Sets.newHashSet(); + this.mapByName.put(modifier.getName(), set); + } + + ((Set)this.mapByOperation.get(Integer.valueOf(modifier.getOperation()))).add(modifier); + set.add(modifier); + this.mapByUUID.put(modifier.getID(), modifier); + this.flagForUpdate(); + } + } + + protected void flagForUpdate() + { + this.needsUpdate = true; + this.attributeMap.func_180794_a(this); + } + + public void removeModifier(AttributeModifier modifier) + { + for (int i = 0; i < 3; ++i) + { + Set set = (Set)this.mapByOperation.get(Integer.valueOf(i)); + set.remove(modifier); + } + + Set set1 = (Set)this.mapByName.get(modifier.getName()); + + if (set1 != null) + { + set1.remove(modifier); + + if (set1.isEmpty()) + { + this.mapByName.remove(modifier.getName()); + } + } + + this.mapByUUID.remove(modifier.getID()); + this.flagForUpdate(); + } + + public void removeAllModifiers() + { + Collection collection = this.func_111122_c(); + + if (collection != null) + { + for (AttributeModifier attributemodifier : Lists.newArrayList(collection)) + { + this.removeModifier(attributemodifier); + } + } + } + + public double getAttributeValue() + { + if (this.needsUpdate) + { + this.cachedValue = this.computeValue(); + this.needsUpdate = false; + } + + return this.cachedValue; + } + + private double computeValue() + { + double d0 = this.getBaseValue(); + + for (AttributeModifier attributemodifier : this.func_180375_b(0)) + { + d0 += attributemodifier.getAmount(); + } + + double d1 = d0; + + for (AttributeModifier attributemodifier1 : this.func_180375_b(1)) + { + d1 += d0 * attributemodifier1.getAmount(); + } + + for (AttributeModifier attributemodifier2 : this.func_180375_b(2)) + { + d1 *= 1.0D + attributemodifier2.getAmount(); + } + + return this.genericAttribute.clampValue(d1); + } + + private Collection func_180375_b(int p_180375_1_) + { + Set set = Sets.newHashSet(this.getModifiersByOperation(p_180375_1_)); + + for (IAttribute iattribute = this.genericAttribute.func_180372_d(); iattribute != null; iattribute = iattribute.func_180372_d()) + { + IAttributeInstance iattributeinstance = this.attributeMap.getAttributeInstance(iattribute); + + if (iattributeinstance != null) + { + set.addAll(iattributeinstance.getModifiersByOperation(p_180375_1_)); + } + } + + return set; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/attributes/RangedAttribute.java b/src/minecraft/net/minecraft/entity/ai/attributes/RangedAttribute.java new file mode 100644 index 0000000..e324afa --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/attributes/RangedAttribute.java @@ -0,0 +1,47 @@ +package net.minecraft.entity.ai.attributes; + +import net.minecraft.util.MathHelper; + +public class RangedAttribute extends BaseAttribute +{ + private final double minimumValue; + private final double maximumValue; + private String description; + + public RangedAttribute(IAttribute p_i45891_1_, String unlocalizedNameIn, double defaultValue, double minimumValueIn, double maximumValueIn) + { + super(p_i45891_1_, unlocalizedNameIn, defaultValue); + this.minimumValue = minimumValueIn; + this.maximumValue = maximumValueIn; + + if (minimumValueIn > maximumValueIn) + { + throw new IllegalArgumentException("Minimum value cannot be bigger than maximum value!"); + } + else if (defaultValue < minimumValueIn) + { + throw new IllegalArgumentException("Default value cannot be lower than minimum value!"); + } + else if (defaultValue > maximumValueIn) + { + throw new IllegalArgumentException("Default value cannot be bigger than maximum value!"); + } + } + + public RangedAttribute setDescription(String descriptionIn) + { + this.description = descriptionIn; + return this; + } + + public String getDescription() + { + return this.description; + } + + public double clampValue(double p_111109_1_) + { + p_111109_1_ = MathHelper.clamp_double(p_111109_1_, this.minimumValue, this.maximumValue); + return p_111109_1_; + } +} diff --git a/src/minecraft/net/minecraft/entity/ai/attributes/ServersideAttributeMap.java b/src/minecraft/net/minecraft/entity/ai/attributes/ServersideAttributeMap.java new file mode 100644 index 0000000..9a7ae47 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/ai/attributes/ServersideAttributeMap.java @@ -0,0 +1,88 @@ +package net.minecraft.entity.ai.attributes; + +import com.google.common.collect.Sets; +import java.util.Collection; +import java.util.Map; +import java.util.Set; +import net.minecraft.server.management.LowerStringMap; + +public class ServersideAttributeMap extends BaseAttributeMap +{ + private final Set attributeInstanceSet = Sets.newHashSet(); + protected final Map descriptionToAttributeInstanceMap = new LowerStringMap(); + + public ModifiableAttributeInstance getAttributeInstance(IAttribute attribute) + { + return (ModifiableAttributeInstance)super.getAttributeInstance(attribute); + } + + public ModifiableAttributeInstance getAttributeInstanceByName(String attributeName) + { + IAttributeInstance iattributeinstance = super.getAttributeInstanceByName(attributeName); + + if (iattributeinstance == null) + { + iattributeinstance = (IAttributeInstance)this.descriptionToAttributeInstanceMap.get(attributeName); + } + + return (ModifiableAttributeInstance)iattributeinstance; + } + + /** + * Registers an attribute with this AttributeMap, returns a modifiable AttributeInstance associated with this map + */ + public IAttributeInstance registerAttribute(IAttribute attribute) + { + IAttributeInstance iattributeinstance = super.registerAttribute(attribute); + + if (attribute instanceof RangedAttribute && ((RangedAttribute)attribute).getDescription() != null) + { + this.descriptionToAttributeInstanceMap.put(((RangedAttribute)attribute).getDescription(), iattributeinstance); + } + + return iattributeinstance; + } + + protected IAttributeInstance func_180376_c(IAttribute p_180376_1_) + { + return new ModifiableAttributeInstance(this, p_180376_1_); + } + + public void func_180794_a(IAttributeInstance p_180794_1_) + { + if (p_180794_1_.getAttribute().getShouldWatch()) + { + this.attributeInstanceSet.add(p_180794_1_); + } + + for (IAttribute iattribute : this.field_180377_c.get(p_180794_1_.getAttribute())) + { + ModifiableAttributeInstance modifiableattributeinstance = this.getAttributeInstance(iattribute); + + if (modifiableattributeinstance != null) + { + modifiableattributeinstance.flagForUpdate(); + } + } + } + + public Set getAttributeInstanceSet() + { + return this.attributeInstanceSet; + } + + public Collection getWatchedAttributes() + { + Set set = Sets.newHashSet(); + + for (IAttributeInstance iattributeinstance : this.getAllAttributes()) + { + if (iattributeinstance.getAttribute().getShouldWatch()) + { + set.add(iattributeinstance); + } + } + + return set; + } +} diff --git a/src/minecraft/net/minecraft/entity/boss/BossStatus.java b/src/minecraft/net/minecraft/entity/boss/BossStatus.java new file mode 100644 index 0000000..bf9963b --- /dev/null +++ b/src/minecraft/net/minecraft/entity/boss/BossStatus.java @@ -0,0 +1,17 @@ +package net.minecraft.entity.boss; + +public final class BossStatus +{ + public static float healthScale; + public static int statusBarTime; + public static String bossName; + public static boolean hasColorModifier; + + public static void setBossStatus(IBossDisplayData displayData, boolean hasColorModifierIn) + { + healthScale = displayData.getHealth() / displayData.getMaxHealth(); + statusBarTime = 100; + bossName = displayData.getDisplayName().getFormattedText(); + hasColorModifier = hasColorModifierIn; + } +} diff --git a/src/minecraft/net/minecraft/entity/boss/EntityDragon.java b/src/minecraft/net/minecraft/entity/boss/EntityDragon.java new file mode 100644 index 0000000..1ee50f3 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/boss/EntityDragon.java @@ -0,0 +1,781 @@ +package net.minecraft.entity.boss; + +import com.google.common.collect.Lists; +import java.util.Iterator; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockTorch; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityMultiPart; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; + +public class EntityDragon extends EntityLiving implements IBossDisplayData, IEntityMultiPart, IMob +{ + public double targetX; + public double targetY; + public double targetZ; + + /** + * Ring buffer array for the last 64 Y-positions and yaw rotations. Used to calculate offsets for the animations. + */ + public double[][] ringBuffer = new double[64][3]; + + /** + * Index into the ring buffer. Incremented once per tick and restarts at 0 once it reaches the end of the buffer. + */ + public int ringBufferIndex = -1; + + /** An array containing all body parts of this dragon */ + public EntityDragonPart[] dragonPartArray; + + /** The head bounding box of a dragon */ + public EntityDragonPart dragonPartHead; + + /** The body bounding box of a dragon */ + public EntityDragonPart dragonPartBody; + public EntityDragonPart dragonPartTail1; + public EntityDragonPart dragonPartTail2; + public EntityDragonPart dragonPartTail3; + public EntityDragonPart dragonPartWing1; + public EntityDragonPart dragonPartWing2; + + /** Animation time at previous tick. */ + public float prevAnimTime; + + /** + * Animation time, used to control the speed of the animation cycles (wings flapping, jaw opening, etc.) + */ + public float animTime; + + /** Force selecting a new flight target at next tick if set to true. */ + public boolean forceNewTarget; + + /** + * Activated if the dragon is flying though obsidian, white stone or bedrock. Slows movement and animation speed. + */ + public boolean slowed; + private Entity target; + public int deathTicks; + + /** The current endercrystal that is healing this dragon */ + public EntityEnderCrystal healingEnderCrystal; + + public EntityDragon(World worldIn) + { + super(worldIn); + this.dragonPartArray = new EntityDragonPart[] {this.dragonPartHead = new EntityDragonPart(this, "head", 6.0F, 6.0F), this.dragonPartBody = new EntityDragonPart(this, "body", 8.0F, 8.0F), this.dragonPartTail1 = new EntityDragonPart(this, "tail", 4.0F, 4.0F), this.dragonPartTail2 = new EntityDragonPart(this, "tail", 4.0F, 4.0F), this.dragonPartTail3 = new EntityDragonPart(this, "tail", 4.0F, 4.0F), this.dragonPartWing1 = new EntityDragonPart(this, "wing", 4.0F, 4.0F), this.dragonPartWing2 = new EntityDragonPart(this, "wing", 4.0F, 4.0F)}; + this.setHealth(this.getMaxHealth()); + this.setSize(16.0F, 8.0F); + this.noClip = true; + this.isImmuneToFire = true; + this.targetY = 100.0D; + this.ignoreFrustumCheck = true; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D); + } + + protected void entityInit() + { + super.entityInit(); + } + + /** + * Returns a double[3] array with movement offsets, used to calculate trailing tail/neck positions. [0] = yaw + * offset, [1] = y offset, [2] = unused, always 0. Parameters: buffer index offset, partial ticks. + */ + public double[] getMovementOffsets(int p_70974_1_, float p_70974_2_) + { + if (this.getHealth() <= 0.0F) + { + p_70974_2_ = 0.0F; + } + + p_70974_2_ = 1.0F - p_70974_2_; + int i = this.ringBufferIndex - p_70974_1_ * 1 & 63; + int j = this.ringBufferIndex - p_70974_1_ * 1 - 1 & 63; + double[] adouble = new double[3]; + double d0 = this.ringBuffer[i][0]; + double d1 = MathHelper.wrapAngleTo180_double(this.ringBuffer[j][0] - d0); + adouble[0] = d0 + d1 * (double)p_70974_2_; + d0 = this.ringBuffer[i][1]; + d1 = this.ringBuffer[j][1] - d0; + adouble[1] = d0 + d1 * (double)p_70974_2_; + adouble[2] = this.ringBuffer[i][2] + (this.ringBuffer[j][2] - this.ringBuffer[i][2]) * (double)p_70974_2_; + return adouble; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.worldObj.isRemote) + { + float f = MathHelper.cos(this.animTime * (float)Math.PI * 2.0F); + float f1 = MathHelper.cos(this.prevAnimTime * (float)Math.PI * 2.0F); + + if (f1 <= -0.3F && f >= -0.3F && !this.isSilent()) + { + this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.rand.nextFloat() * 0.3F, false); + } + } + + this.prevAnimTime = this.animTime; + + if (this.getHealth() <= 0.0F) + { + float f11 = (this.rand.nextFloat() - 0.5F) * 8.0F; + float f13 = (this.rand.nextFloat() - 0.5F) * 4.0F; + float f14 = (this.rand.nextFloat() - 0.5F) * 8.0F; + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX + (double)f11, this.posY + 2.0D + (double)f13, this.posZ + (double)f14, 0.0D, 0.0D, 0.0D, new int[0]); + } + else + { + this.updateDragonEnderCrystal(); + float f10 = 0.2F / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + 1.0F); + f10 = f10 * (float)Math.pow(2.0D, this.motionY); + + if (this.slowed) + { + this.animTime += f10 * 0.5F; + } + else + { + this.animTime += f10; + } + + this.rotationYaw = MathHelper.wrapAngleTo180_float(this.rotationYaw); + + if (this.isAIDisabled()) + { + this.animTime = 0.5F; + } + else + { + if (this.ringBufferIndex < 0) + { + for (int i = 0; i < this.ringBuffer.length; ++i) + { + this.ringBuffer[i][0] = (double)this.rotationYaw; + this.ringBuffer[i][1] = this.posY; + } + } + + if (++this.ringBufferIndex == this.ringBuffer.length) + { + this.ringBufferIndex = 0; + } + + this.ringBuffer[this.ringBufferIndex][0] = (double)this.rotationYaw; + this.ringBuffer[this.ringBufferIndex][1] = this.posY; + + if (this.worldObj.isRemote) + { + if (this.newPosRotationIncrements > 0) + { + double d10 = this.posX + (this.newPosX - this.posX) / (double)this.newPosRotationIncrements; + double d0 = this.posY + (this.newPosY - this.posY) / (double)this.newPosRotationIncrements; + double d1 = this.posZ + (this.newPosZ - this.posZ) / (double)this.newPosRotationIncrements; + double d2 = MathHelper.wrapAngleTo180_double(this.newRotationYaw - (double)this.rotationYaw); + this.rotationYaw = (float)((double)this.rotationYaw + d2 / (double)this.newPosRotationIncrements); + this.rotationPitch = (float)((double)this.rotationPitch + (this.newRotationPitch - (double)this.rotationPitch) / (double)this.newPosRotationIncrements); + --this.newPosRotationIncrements; + this.setPosition(d10, d0, d1); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + } + else + { + double d11 = this.targetX - this.posX; + double d12 = this.targetY - this.posY; + double d13 = this.targetZ - this.posZ; + double d14 = d11 * d11 + d12 * d12 + d13 * d13; + + if (this.target != null) + { + this.targetX = this.target.posX; + this.targetZ = this.target.posZ; + double d3 = this.targetX - this.posX; + double d5 = this.targetZ - this.posZ; + double d7 = Math.sqrt(d3 * d3 + d5 * d5); + double d8 = 0.4000000059604645D + d7 / 80.0D - 1.0D; + + if (d8 > 10.0D) + { + d8 = 10.0D; + } + + this.targetY = this.target.getEntityBoundingBox().minY + d8; + } + else + { + this.targetX += this.rand.nextGaussian() * 2.0D; + this.targetZ += this.rand.nextGaussian() * 2.0D; + } + + if (this.forceNewTarget || d14 < 100.0D || d14 > 22500.0D || this.isCollidedHorizontally || this.isCollidedVertically) + { + this.setNewTarget(); + } + + d12 = d12 / (double)MathHelper.sqrt_double(d11 * d11 + d13 * d13); + float f17 = 0.6F; + d12 = MathHelper.clamp_double(d12, (double)(-f17), (double)f17); + this.motionY += d12 * 0.10000000149011612D; + this.rotationYaw = MathHelper.wrapAngleTo180_float(this.rotationYaw); + double d4 = 180.0D - MathHelper.func_181159_b(d11, d13) * 180.0D / Math.PI; + double d6 = MathHelper.wrapAngleTo180_double(d4 - (double)this.rotationYaw); + + if (d6 > 50.0D) + { + d6 = 50.0D; + } + + if (d6 < -50.0D) + { + d6 = -50.0D; + } + + Vec3 vec3 = (new Vec3(this.targetX - this.posX, this.targetY - this.posY, this.targetZ - this.posZ)).normalize(); + double d15 = (double)(-MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F)); + Vec3 vec31 = (new Vec3((double)MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F), this.motionY, d15)).normalize(); + float f5 = ((float)vec31.dotProduct(vec3) + 0.5F) / 1.5F; + + if (f5 < 0.0F) + { + f5 = 0.0F; + } + + this.randomYawVelocity *= 0.8F; + float f6 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0F + 1.0F; + double d9 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0D + 1.0D; + + if (d9 > 40.0D) + { + d9 = 40.0D; + } + + this.randomYawVelocity = (float)((double)this.randomYawVelocity + d6 * (0.699999988079071D / d9 / (double)f6)); + this.rotationYaw += this.randomYawVelocity * 0.1F; + float f7 = (float)(2.0D / (d9 + 1.0D)); + float f8 = 0.06F; + this.moveFlying(0.0F, -1.0F, f8 * (f5 * f7 + (1.0F - f7))); + + if (this.slowed) + { + this.moveEntity(this.motionX * 0.800000011920929D, this.motionY * 0.800000011920929D, this.motionZ * 0.800000011920929D); + } + else + { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + } + + Vec3 vec32 = (new Vec3(this.motionX, this.motionY, this.motionZ)).normalize(); + float f9 = ((float)vec32.dotProduct(vec31) + 1.0F) / 2.0F; + f9 = 0.8F + 0.15F * f9; + this.motionX *= (double)f9; + this.motionZ *= (double)f9; + this.motionY *= 0.9100000262260437D; + } + + this.renderYawOffset = this.rotationYaw; + this.dragonPartHead.width = this.dragonPartHead.height = 3.0F; + this.dragonPartTail1.width = this.dragonPartTail1.height = 2.0F; + this.dragonPartTail2.width = this.dragonPartTail2.height = 2.0F; + this.dragonPartTail3.width = this.dragonPartTail3.height = 2.0F; + this.dragonPartBody.height = 3.0F; + this.dragonPartBody.width = 5.0F; + this.dragonPartWing1.height = 2.0F; + this.dragonPartWing1.width = 4.0F; + this.dragonPartWing2.height = 3.0F; + this.dragonPartWing2.width = 4.0F; + float f12 = (float)(this.getMovementOffsets(5, 1.0F)[1] - this.getMovementOffsets(10, 1.0F)[1]) * 10.0F / 180.0F * (float)Math.PI; + float f2 = MathHelper.cos(f12); + float f15 = -MathHelper.sin(f12); + float f3 = this.rotationYaw * (float)Math.PI / 180.0F; + float f16 = MathHelper.sin(f3); + float f4 = MathHelper.cos(f3); + this.dragonPartBody.onUpdate(); + this.dragonPartBody.setLocationAndAngles(this.posX + (double)(f16 * 0.5F), this.posY, this.posZ - (double)(f4 * 0.5F), 0.0F, 0.0F); + this.dragonPartWing1.onUpdate(); + this.dragonPartWing1.setLocationAndAngles(this.posX + (double)(f4 * 4.5F), this.posY + 2.0D, this.posZ + (double)(f16 * 4.5F), 0.0F, 0.0F); + this.dragonPartWing2.onUpdate(); + this.dragonPartWing2.setLocationAndAngles(this.posX - (double)(f4 * 4.5F), this.posY + 2.0D, this.posZ - (double)(f16 * 4.5F), 0.0F, 0.0F); + + if (!this.worldObj.isRemote && this.hurtTime == 0) + { + this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.dragonPartWing1.getEntityBoundingBox().expand(4.0D, 2.0D, 4.0D).offset(0.0D, -2.0D, 0.0D))); + this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.dragonPartWing2.getEntityBoundingBox().expand(4.0D, 2.0D, 4.0D).offset(0.0D, -2.0D, 0.0D))); + this.attackEntitiesInList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.dragonPartHead.getEntityBoundingBox().expand(1.0D, 1.0D, 1.0D))); + } + + double[] adouble1 = this.getMovementOffsets(5, 1.0F); + double[] adouble = this.getMovementOffsets(0, 1.0F); + float f18 = MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F - this.randomYawVelocity * 0.01F); + float f19 = MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F - this.randomYawVelocity * 0.01F); + this.dragonPartHead.onUpdate(); + this.dragonPartHead.setLocationAndAngles(this.posX + (double)(f18 * 5.5F * f2), this.posY + (adouble[1] - adouble1[1]) * 1.0D + (double)(f15 * 5.5F), this.posZ - (double)(f19 * 5.5F * f2), 0.0F, 0.0F); + + for (int j = 0; j < 3; ++j) + { + EntityDragonPart entitydragonpart = null; + + if (j == 0) + { + entitydragonpart = this.dragonPartTail1; + } + + if (j == 1) + { + entitydragonpart = this.dragonPartTail2; + } + + if (j == 2) + { + entitydragonpart = this.dragonPartTail3; + } + + double[] adouble2 = this.getMovementOffsets(12 + j * 2, 1.0F); + float f20 = this.rotationYaw * (float)Math.PI / 180.0F + this.simplifyAngle(adouble2[0] - adouble1[0]) * (float)Math.PI / 180.0F * 1.0F; + float f21 = MathHelper.sin(f20); + float f22 = MathHelper.cos(f20); + float f23 = 1.5F; + float f24 = (float)(j + 1) * 2.0F; + entitydragonpart.onUpdate(); + entitydragonpart.setLocationAndAngles(this.posX - (double)((f16 * f23 + f21 * f24) * f2), this.posY + (adouble2[1] - adouble1[1]) * 1.0D - (double)((f24 + f23) * f15) + 1.5D, this.posZ + (double)((f4 * f23 + f22 * f24) * f2), 0.0F, 0.0F); + } + + if (!this.worldObj.isRemote) + { + this.slowed = this.destroyBlocksInAABB(this.dragonPartHead.getEntityBoundingBox()) | this.destroyBlocksInAABB(this.dragonPartBody.getEntityBoundingBox()); + } + } + } + } + + /** + * Updates the state of the enderdragon's current endercrystal. + */ + private void updateDragonEnderCrystal() + { + if (this.healingEnderCrystal != null) + { + if (this.healingEnderCrystal.isDead) + { + if (!this.worldObj.isRemote) + { + this.attackEntityFromPart(this.dragonPartHead, DamageSource.setExplosionSource((Explosion)null), 10.0F); + } + + this.healingEnderCrystal = null; + } + else if (this.ticksExisted % 10 == 0 && this.getHealth() < this.getMaxHealth()) + { + this.setHealth(this.getHealth() + 1.0F); + } + } + + if (this.rand.nextInt(10) == 0) + { + float f = 32.0F; + List list = this.worldObj.getEntitiesWithinAABB(EntityEnderCrystal.class, this.getEntityBoundingBox().expand((double)f, (double)f, (double)f)); + EntityEnderCrystal entityendercrystal = null; + double d0 = Double.MAX_VALUE; + + for (EntityEnderCrystal entityendercrystal1 : list) + { + double d1 = entityendercrystal1.getDistanceSqToEntity(this); + + if (d1 < d0) + { + d0 = d1; + entityendercrystal = entityendercrystal1; + } + } + + this.healingEnderCrystal = entityendercrystal; + } + } + + /** + * Pushes all entities inside the list away from the enderdragon. + */ + private void collideWithEntities(List p_70970_1_) + { + double d0 = (this.dragonPartBody.getEntityBoundingBox().minX + this.dragonPartBody.getEntityBoundingBox().maxX) / 2.0D; + double d1 = (this.dragonPartBody.getEntityBoundingBox().minZ + this.dragonPartBody.getEntityBoundingBox().maxZ) / 2.0D; + + for (Entity entity : p_70970_1_) + { + if (entity instanceof EntityLivingBase) + { + double d2 = entity.posX - d0; + double d3 = entity.posZ - d1; + double d4 = d2 * d2 + d3 * d3; + entity.addVelocity(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D); + } + } + } + + /** + * Attacks all entities inside this list, dealing 5 hearts of damage. + */ + private void attackEntitiesInList(List p_70971_1_) + { + for (int i = 0; i < p_70971_1_.size(); ++i) + { + Entity entity = (Entity)p_70971_1_.get(i); + + if (entity instanceof EntityLivingBase) + { + entity.attackEntityFrom(DamageSource.causeMobDamage(this), 10.0F); + this.applyEnchantments(this, entity); + } + } + } + + /** + * Sets a new target for the flight AI. It can be a random coordinate or a nearby player. + */ + private void setNewTarget() + { + this.forceNewTarget = false; + List list = Lists.newArrayList(this.worldObj.playerEntities); + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) + { + if (((EntityPlayer)iterator.next()).isSpectator()) + { + iterator.remove(); + } + } + + if (this.rand.nextInt(2) == 0 && !list.isEmpty()) + { + this.target = (Entity)list.get(this.rand.nextInt(list.size())); + } + else + { + while (true) + { + this.targetX = 0.0D; + this.targetY = (double)(70.0F + this.rand.nextFloat() * 50.0F); + this.targetZ = 0.0D; + this.targetX += (double)(this.rand.nextFloat() * 120.0F - 60.0F); + this.targetZ += (double)(this.rand.nextFloat() * 120.0F - 60.0F); + double d0 = this.posX - this.targetX; + double d1 = this.posY - this.targetY; + double d2 = this.posZ - this.targetZ; + boolean flag = d0 * d0 + d1 * d1 + d2 * d2 > 100.0D; + + if (flag) + { + break; + } + } + + this.target = null; + } + } + + /** + * Simplifies the value of a number by adding/subtracting 180 to the point that the number is between -180 and 180. + */ + private float simplifyAngle(double p_70973_1_) + { + return (float)MathHelper.wrapAngleTo180_double(p_70973_1_); + } + + /** + * Destroys all blocks that aren't associated with 'The End' inside the given bounding box. + */ + private boolean destroyBlocksInAABB(AxisAlignedBB p_70972_1_) + { + int i = MathHelper.floor_double(p_70972_1_.minX); + int j = MathHelper.floor_double(p_70972_1_.minY); + int k = MathHelper.floor_double(p_70972_1_.minZ); + int l = MathHelper.floor_double(p_70972_1_.maxX); + int i1 = MathHelper.floor_double(p_70972_1_.maxY); + int j1 = MathHelper.floor_double(p_70972_1_.maxZ); + boolean flag = false; + boolean flag1 = false; + + for (int k1 = i; k1 <= l; ++k1) + { + for (int l1 = j; l1 <= i1; ++l1) + { + for (int i2 = k; i2 <= j1; ++i2) + { + BlockPos blockpos = new BlockPos(k1, l1, i2); + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + + if (block.getMaterial() != Material.air) + { + if (block != Blocks.barrier && block != Blocks.obsidian && block != Blocks.end_stone && block != Blocks.bedrock && block != Blocks.command_block && this.worldObj.getGameRules().getBoolean("mobGriefing")) + { + flag1 = this.worldObj.setBlockToAir(blockpos) || flag1; + } + else + { + flag = true; + } + } + } + } + } + + if (flag1) + { + double d0 = p_70972_1_.minX + (p_70972_1_.maxX - p_70972_1_.minX) * (double)this.rand.nextFloat(); + double d1 = p_70972_1_.minY + (p_70972_1_.maxY - p_70972_1_.minY) * (double)this.rand.nextFloat(); + double d2 = p_70972_1_.minZ + (p_70972_1_.maxZ - p_70972_1_.minZ) * (double)this.rand.nextFloat(); + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); + } + + return flag; + } + + public boolean attackEntityFromPart(EntityDragonPart dragonPart, DamageSource source, float p_70965_3_) + { + if (dragonPart != this.dragonPartHead) + { + p_70965_3_ = p_70965_3_ / 4.0F + 1.0F; + } + + float f = this.rotationYaw * (float)Math.PI / 180.0F; + float f1 = MathHelper.sin(f); + float f2 = MathHelper.cos(f); + this.targetX = this.posX + (double)(f1 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F); + this.targetY = this.posY + (double)(this.rand.nextFloat() * 3.0F) + 1.0D; + this.targetZ = this.posZ - (double)(f2 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F); + this.target = null; + + if (source.getEntity() instanceof EntityPlayer || source.isExplosion()) + { + this.attackDragonFrom(source, p_70965_3_); + } + + return true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (source instanceof EntityDamageSource && ((EntityDamageSource)source).getIsThornsDamage()) + { + this.attackDragonFrom(source, amount); + } + + return false; + } + + /** + * Provides a way to cause damage to an ender dragon. + */ + protected boolean attackDragonFrom(DamageSource source, float amount) + { + return super.attackEntityFrom(source, amount); + } + + /** + * Called by the /kill command. + */ + public void onKillCommand() + { + this.setDead(); + } + + /** + * handles entity death timer, experience orb and particle creation + */ + protected void onDeathUpdate() + { + ++this.deathTicks; + + if (this.deathTicks >= 180 && this.deathTicks <= 200) + { + float f = (this.rand.nextFloat() - 0.5F) * 8.0F; + float f1 = (this.rand.nextFloat() - 0.5F) * 4.0F; + float f2 = (this.rand.nextFloat() - 0.5F) * 8.0F; + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, this.posX + (double)f, this.posY + 2.0D + (double)f1, this.posZ + (double)f2, 0.0D, 0.0D, 0.0D, new int[0]); + } + + boolean flag = this.worldObj.getGameRules().getBoolean("doMobLoot"); + + if (!this.worldObj.isRemote) + { + if (this.deathTicks > 150 && this.deathTicks % 5 == 0 && flag) + { + int i = 1000; + + while (i > 0) + { + int k = EntityXPOrb.getXPSplit(i); + i -= k; + this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, k)); + } + } + + if (this.deathTicks == 1) + { + this.worldObj.playBroadcastSound(1018, new BlockPos(this), 0); + } + } + + this.moveEntity(0.0D, 0.10000000149011612D, 0.0D); + this.renderYawOffset = this.rotationYaw += 20.0F; + + if (this.deathTicks == 200 && !this.worldObj.isRemote) + { + if (flag) + { + int j = 2000; + + while (j > 0) + { + int l = EntityXPOrb.getXPSplit(j); + j -= l; + this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, l)); + } + } + + this.generatePortal(new BlockPos(this.posX, 64.0D, this.posZ)); + this.setDead(); + } + } + + /** + * Generate the portal when the dragon dies + */ + private void generatePortal(BlockPos pos) + { + int i = 4; + double d0 = 12.25D; + double d1 = 6.25D; + + for (int j = -1; j <= 32; ++j) + { + for (int k = -4; k <= 4; ++k) + { + for (int l = -4; l <= 4; ++l) + { + double d2 = (double)(k * k + l * l); + + if (d2 <= 12.25D) + { + BlockPos blockpos = pos.add(k, j, l); + + if (j < 0) + { + if (d2 <= 6.25D) + { + this.worldObj.setBlockState(blockpos, Blocks.bedrock.getDefaultState()); + } + } + else if (j > 0) + { + this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState()); + } + else if (d2 > 6.25D) + { + this.worldObj.setBlockState(blockpos, Blocks.bedrock.getDefaultState()); + } + else + { + this.worldObj.setBlockState(blockpos, Blocks.end_portal.getDefaultState()); + } + } + } + } + } + + this.worldObj.setBlockState(pos, Blocks.bedrock.getDefaultState()); + this.worldObj.setBlockState(pos.up(), Blocks.bedrock.getDefaultState()); + BlockPos blockpos1 = pos.up(2); + this.worldObj.setBlockState(blockpos1, Blocks.bedrock.getDefaultState()); + this.worldObj.setBlockState(blockpos1.west(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST)); + this.worldObj.setBlockState(blockpos1.east(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST)); + this.worldObj.setBlockState(blockpos1.north(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH)); + this.worldObj.setBlockState(blockpos1.south(), Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH)); + this.worldObj.setBlockState(pos.up(3), Blocks.bedrock.getDefaultState()); + this.worldObj.setBlockState(pos.up(4), Blocks.dragon_egg.getDefaultState()); + } + + /** + * Makes the entity despawn if requirements are reached + */ + protected void despawnEntity() + { + } + + /** + * Return the Entity parts making up this Entity (currently only for dragons) + */ + public Entity[] getParts() + { + return this.dragonPartArray; + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return false; + } + + public World getWorld() + { + return this.worldObj; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.enderdragon.growl"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.enderdragon.hit"; + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 5.0F; + } +} diff --git a/src/minecraft/net/minecraft/entity/boss/EntityDragonPart.java b/src/minecraft/net/minecraft/entity/boss/EntityDragonPart.java new file mode 100644 index 0000000..48e26ac --- /dev/null +++ b/src/minecraft/net/minecraft/entity/boss/EntityDragonPart.java @@ -0,0 +1,63 @@ +package net.minecraft.entity.boss; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.IEntityMultiPart; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; + +public class EntityDragonPart extends Entity +{ + /** The dragon entity this dragon part belongs to */ + public final IEntityMultiPart entityDragonObj; + public final String partName; + + public EntityDragonPart(IEntityMultiPart parent, String partName, float base, float sizeHeight) + { + super(parent.getWorld()); + this.setSize(base, sizeHeight); + this.entityDragonObj = parent; + this.partName = partName; + } + + protected void entityInit() + { + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + return this.isEntityInvulnerable(source) ? false : this.entityDragonObj.attackEntityFromPart(this, source, amount); + } + + /** + * Returns true if Entity argument is equal to this Entity + */ + public boolean isEntityEqual(Entity entityIn) + { + return this == entityIn || this.entityDragonObj == entityIn; + } +} diff --git a/src/minecraft/net/minecraft/entity/boss/EntityWither.java b/src/minecraft/net/minecraft/entity/boss/EntityWither.java new file mode 100644 index 0000000..215cbdb --- /dev/null +++ b/src/minecraft/net/minecraft/entity/boss/EntityWither.java @@ -0,0 +1,669 @@ +package net.minecraft.entity.boss; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.IRangedAttackMob; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIArrowAttack; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityWitherSkull; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.potion.PotionEffect; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class EntityWither extends EntityMob implements IBossDisplayData, IRangedAttackMob +{ + private float[] field_82220_d = new float[2]; + private float[] field_82221_e = new float[2]; + private float[] field_82217_f = new float[2]; + private float[] field_82218_g = new float[2]; + private int[] field_82223_h = new int[2]; + private int[] field_82224_i = new int[2]; + + /** Time before the Wither tries to break blocks */ + private int blockBreakCounter; + private static final Predicate attackEntitySelector = new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_ instanceof EntityLivingBase && ((EntityLivingBase)p_apply_1_).getCreatureAttribute() != EnumCreatureAttribute.UNDEAD; + } + }; + + public EntityWither(World worldIn) + { + super(worldIn); + this.setHealth(this.getMaxHealth()); + this.setSize(0.9F, 3.5F); + this.isImmuneToFire = true; + ((PathNavigateGround)this.getNavigator()).setCanSwim(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIArrowAttack(this, 1.0D, 40, 20.0F)); + this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(7, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, false, attackEntitySelector)); + this.experienceValue = 50; + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(17, new Integer(0)); + this.dataWatcher.addObject(18, new Integer(0)); + this.dataWatcher.addObject(19, new Integer(0)); + this.dataWatcher.addObject(20, new Integer(0)); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("Invul", this.getInvulTime()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.setInvulTime(tagCompund.getInteger("Invul")); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.wither.idle"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.wither.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.wither.death"; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + this.motionY *= 0.6000000238418579D; + + if (!this.worldObj.isRemote && this.getWatchedTargetId(0) > 0) + { + Entity entity = this.worldObj.getEntityByID(this.getWatchedTargetId(0)); + + if (entity != null) + { + if (this.posY < entity.posY || !this.isArmored() && this.posY < entity.posY + 5.0D) + { + if (this.motionY < 0.0D) + { + this.motionY = 0.0D; + } + + this.motionY += (0.5D - this.motionY) * 0.6000000238418579D; + } + + double d0 = entity.posX - this.posX; + double d1 = entity.posZ - this.posZ; + double d3 = d0 * d0 + d1 * d1; + + if (d3 > 9.0D) + { + double d5 = (double)MathHelper.sqrt_double(d3); + this.motionX += (d0 / d5 * 0.5D - this.motionX) * 0.6000000238418579D; + this.motionZ += (d1 / d5 * 0.5D - this.motionZ) * 0.6000000238418579D; + } + } + } + + if (this.motionX * this.motionX + this.motionZ * this.motionZ > 0.05000000074505806D) + { + this.rotationYaw = (float)MathHelper.func_181159_b(this.motionZ, this.motionX) * (180F / (float)Math.PI) - 90.0F; + } + + super.onLivingUpdate(); + + for (int i = 0; i < 2; ++i) + { + this.field_82218_g[i] = this.field_82221_e[i]; + this.field_82217_f[i] = this.field_82220_d[i]; + } + + for (int j = 0; j < 2; ++j) + { + int k = this.getWatchedTargetId(j + 1); + Entity entity1 = null; + + if (k > 0) + { + entity1 = this.worldObj.getEntityByID(k); + } + + if (entity1 != null) + { + double d11 = this.func_82214_u(j + 1); + double d12 = this.func_82208_v(j + 1); + double d13 = this.func_82213_w(j + 1); + double d6 = entity1.posX - d11; + double d7 = entity1.posY + (double)entity1.getEyeHeight() - d12; + double d8 = entity1.posZ - d13; + double d9 = (double)MathHelper.sqrt_double(d6 * d6 + d8 * d8); + float f = (float)(MathHelper.func_181159_b(d8, d6) * 180.0D / Math.PI) - 90.0F; + float f1 = (float)(-(MathHelper.func_181159_b(d7, d9) * 180.0D / Math.PI)); + this.field_82220_d[j] = this.func_82204_b(this.field_82220_d[j], f1, 40.0F); + this.field_82221_e[j] = this.func_82204_b(this.field_82221_e[j], f, 10.0F); + } + else + { + this.field_82221_e[j] = this.func_82204_b(this.field_82221_e[j], this.renderYawOffset, 10.0F); + } + } + + boolean flag = this.isArmored(); + + for (int l = 0; l < 3; ++l) + { + double d10 = this.func_82214_u(l); + double d2 = this.func_82208_v(l); + double d4 = this.func_82213_w(l); + this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d10 + this.rand.nextGaussian() * 0.30000001192092896D, d2 + this.rand.nextGaussian() * 0.30000001192092896D, d4 + this.rand.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D, new int[0]); + + if (flag && this.worldObj.rand.nextInt(4) == 0) + { + this.worldObj.spawnParticle(EnumParticleTypes.SPELL_MOB, d10 + this.rand.nextGaussian() * 0.30000001192092896D, d2 + this.rand.nextGaussian() * 0.30000001192092896D, d4 + this.rand.nextGaussian() * 0.30000001192092896D, 0.699999988079071D, 0.699999988079071D, 0.5D, new int[0]); + } + } + + if (this.getInvulTime() > 0) + { + for (int i1 = 0; i1 < 3; ++i1) + { + this.worldObj.spawnParticle(EnumParticleTypes.SPELL_MOB, this.posX + this.rand.nextGaussian() * 1.0D, this.posY + (double)(this.rand.nextFloat() * 3.3F), this.posZ + this.rand.nextGaussian() * 1.0D, 0.699999988079071D, 0.699999988079071D, 0.8999999761581421D, new int[0]); + } + } + } + + protected void updateAITasks() + { + if (this.getInvulTime() > 0) + { + int j1 = this.getInvulTime() - 1; + + if (j1 <= 0) + { + this.worldObj.newExplosion(this, this.posX, this.posY + (double)this.getEyeHeight(), this.posZ, 7.0F, false, this.worldObj.getGameRules().getBoolean("mobGriefing")); + this.worldObj.playBroadcastSound(1013, new BlockPos(this), 0); + } + + this.setInvulTime(j1); + + if (this.ticksExisted % 10 == 0) + { + this.heal(10.0F); + } + } + else + { + super.updateAITasks(); + + for (int i = 1; i < 3; ++i) + { + if (this.ticksExisted >= this.field_82223_h[i - 1]) + { + this.field_82223_h[i - 1] = this.ticksExisted + 10 + this.rand.nextInt(10); + + if (this.worldObj.getDifficulty() == EnumDifficulty.NORMAL || this.worldObj.getDifficulty() == EnumDifficulty.HARD) + { + int j3 = i - 1; + int k3 = this.field_82224_i[i - 1]; + this.field_82224_i[j3] = this.field_82224_i[i - 1] + 1; + + if (k3 > 15) + { + float f = 10.0F; + float f1 = 5.0F; + double d0 = MathHelper.getRandomDoubleInRange(this.rand, this.posX - (double)f, this.posX + (double)f); + double d1 = MathHelper.getRandomDoubleInRange(this.rand, this.posY - (double)f1, this.posY + (double)f1); + double d2 = MathHelper.getRandomDoubleInRange(this.rand, this.posZ - (double)f, this.posZ + (double)f); + this.launchWitherSkullToCoords(i + 1, d0, d1, d2, true); + this.field_82224_i[i - 1] = 0; + } + } + + int k1 = this.getWatchedTargetId(i); + + if (k1 > 0) + { + Entity entity = this.worldObj.getEntityByID(k1); + + if (entity != null && entity.isEntityAlive() && this.getDistanceSqToEntity(entity) <= 900.0D && this.canEntityBeSeen(entity)) + { + if (entity instanceof EntityPlayer && ((EntityPlayer)entity).capabilities.disableDamage) + { + this.updateWatchedTargetId(i, 0); + } + else + { + this.launchWitherSkullToEntity(i + 1, (EntityLivingBase)entity); + this.field_82223_h[i - 1] = this.ticksExisted + 40 + this.rand.nextInt(20); + this.field_82224_i[i - 1] = 0; + } + } + else + { + this.updateWatchedTargetId(i, 0); + } + } + else + { + List list = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.getEntityBoundingBox().expand(20.0D, 8.0D, 20.0D), Predicates. and (attackEntitySelector, EntitySelectors.NOT_SPECTATING)); + + for (int j2 = 0; j2 < 10 && !list.isEmpty(); ++j2) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(this.rand.nextInt(list.size())); + + if (entitylivingbase != this && entitylivingbase.isEntityAlive() && this.canEntityBeSeen(entitylivingbase)) + { + if (entitylivingbase instanceof EntityPlayer) + { + if (!((EntityPlayer)entitylivingbase).capabilities.disableDamage) + { + this.updateWatchedTargetId(i, entitylivingbase.getEntityId()); + } + } + else + { + this.updateWatchedTargetId(i, entitylivingbase.getEntityId()); + } + + break; + } + + list.remove(entitylivingbase); + } + } + } + } + + if (this.getAttackTarget() != null) + { + this.updateWatchedTargetId(0, this.getAttackTarget().getEntityId()); + } + else + { + this.updateWatchedTargetId(0, 0); + } + + if (this.blockBreakCounter > 0) + { + --this.blockBreakCounter; + + if (this.blockBreakCounter == 0 && this.worldObj.getGameRules().getBoolean("mobGriefing")) + { + int i1 = MathHelper.floor_double(this.posY); + int l1 = MathHelper.floor_double(this.posX); + int i2 = MathHelper.floor_double(this.posZ); + boolean flag = false; + + for (int k2 = -1; k2 <= 1; ++k2) + { + for (int l2 = -1; l2 <= 1; ++l2) + { + for (int j = 0; j <= 3; ++j) + { + int i3 = l1 + k2; + int k = i1 + j; + int l = i2 + l2; + BlockPos blockpos = new BlockPos(i3, k, l); + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + + if (block.getMaterial() != Material.air && func_181033_a(block)) + { + flag = this.worldObj.destroyBlock(blockpos, true) || flag; + } + } + } + } + + if (flag) + { + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1012, new BlockPos(this), 0); + } + } + } + + if (this.ticksExisted % 20 == 0) + { + this.heal(1.0F); + } + } + } + + public static boolean func_181033_a(Block p_181033_0_) + { + return p_181033_0_ != Blocks.bedrock && p_181033_0_ != Blocks.end_portal && p_181033_0_ != Blocks.end_portal_frame && p_181033_0_ != Blocks.command_block && p_181033_0_ != Blocks.barrier; + } + + public void func_82206_m() + { + this.setInvulTime(220); + this.setHealth(this.getMaxHealth() / 3.0F); + } + + /** + * Sets the Entity inside a web block. + */ + public void setInWeb() + { + } + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + return 4; + } + + private double func_82214_u(int p_82214_1_) + { + if (p_82214_1_ <= 0) + { + return this.posX; + } + else + { + float f = (this.renderYawOffset + (float)(180 * (p_82214_1_ - 1))) / 180.0F * (float)Math.PI; + float f1 = MathHelper.cos(f); + return this.posX + (double)f1 * 1.3D; + } + } + + private double func_82208_v(int p_82208_1_) + { + return p_82208_1_ <= 0 ? this.posY + 3.0D : this.posY + 2.2D; + } + + private double func_82213_w(int p_82213_1_) + { + if (p_82213_1_ <= 0) + { + return this.posZ; + } + else + { + float f = (this.renderYawOffset + (float)(180 * (p_82213_1_ - 1))) / 180.0F * (float)Math.PI; + float f1 = MathHelper.sin(f); + return this.posZ + (double)f1 * 1.3D; + } + } + + private float func_82204_b(float p_82204_1_, float p_82204_2_, float p_82204_3_) + { + float f = MathHelper.wrapAngleTo180_float(p_82204_2_ - p_82204_1_); + + if (f > p_82204_3_) + { + f = p_82204_3_; + } + + if (f < -p_82204_3_) + { + f = -p_82204_3_; + } + + return p_82204_1_ + f; + } + + private void launchWitherSkullToEntity(int p_82216_1_, EntityLivingBase p_82216_2_) + { + this.launchWitherSkullToCoords(p_82216_1_, p_82216_2_.posX, p_82216_2_.posY + (double)p_82216_2_.getEyeHeight() * 0.5D, p_82216_2_.posZ, p_82216_1_ == 0 && this.rand.nextFloat() < 0.001F); + } + + /** + * Launches a Wither skull toward (par2, par4, par6) + */ + private void launchWitherSkullToCoords(int p_82209_1_, double x, double y, double z, boolean invulnerable) + { + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1014, new BlockPos(this), 0); + double d0 = this.func_82214_u(p_82209_1_); + double d1 = this.func_82208_v(p_82209_1_); + double d2 = this.func_82213_w(p_82209_1_); + double d3 = x - d0; + double d4 = y - d1; + double d5 = z - d2; + EntityWitherSkull entitywitherskull = new EntityWitherSkull(this.worldObj, this, d3, d4, d5); + + if (invulnerable) + { + entitywitherskull.setInvulnerable(true); + } + + entitywitherskull.posY = d1; + entitywitherskull.posX = d0; + entitywitherskull.posZ = d2; + this.worldObj.spawnEntityInWorld(entitywitherskull); + } + + /** + * Attack the specified entity using a ranged attack. + */ + public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_) + { + this.launchWitherSkullToEntity(0, p_82196_1_); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else if (source != DamageSource.drown && !(source.getEntity() instanceof EntityWither)) + { + if (this.getInvulTime() > 0 && source != DamageSource.outOfWorld) + { + return false; + } + else + { + if (this.isArmored()) + { + Entity entity = source.getSourceOfDamage(); + + if (entity instanceof EntityArrow) + { + return false; + } + } + + Entity entity1 = source.getEntity(); + + if (entity1 != null && !(entity1 instanceof EntityPlayer) && entity1 instanceof EntityLivingBase && ((EntityLivingBase)entity1).getCreatureAttribute() == this.getCreatureAttribute()) + { + return false; + } + else + { + if (this.blockBreakCounter <= 0) + { + this.blockBreakCounter = 20; + } + + for (int i = 0; i < this.field_82224_i.length; ++i) + { + this.field_82224_i[i] += 3; + } + + return super.attackEntityFrom(source, amount); + } + } + } + else + { + return false; + } + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + EntityItem entityitem = this.dropItem(Items.nether_star, 1); + + if (entityitem != null) + { + entityitem.setNoDespawn(); + } + + if (!this.worldObj.isRemote) + { + for (EntityPlayer entityplayer : this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.getEntityBoundingBox().expand(50.0D, 100.0D, 50.0D))) + { + entityplayer.triggerAchievement(AchievementList.killWither); + } + } + } + + /** + * Makes the entity despawn if requirements are reached + */ + protected void despawnEntity() + { + this.entityAge = 0; + } + + public int getBrightnessForRender(float partialTicks) + { + return 15728880; + } + + public void fall(float distance, float damageMultiplier) + { + } + + /** + * adds a PotionEffect to the entity + */ + public void addPotionEffect(PotionEffect potioneffectIn) + { + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(300.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.6000000238418579D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D); + } + + public float func_82207_a(int p_82207_1_) + { + return this.field_82221_e[p_82207_1_]; + } + + public float func_82210_r(int p_82210_1_) + { + return this.field_82220_d[p_82210_1_]; + } + + public int getInvulTime() + { + return this.dataWatcher.getWatchableObjectInt(20); + } + + public void setInvulTime(int p_82215_1_) + { + this.dataWatcher.updateObject(20, Integer.valueOf(p_82215_1_)); + } + + /** + * Returns the target entity ID if present, or -1 if not @param par1 The target offset, should be from 0-2 + */ + public int getWatchedTargetId(int p_82203_1_) + { + return this.dataWatcher.getWatchableObjectInt(17 + p_82203_1_); + } + + /** + * Updates the target entity ID + */ + public void updateWatchedTargetId(int targetOffset, int newId) + { + this.dataWatcher.updateObject(17 + targetOffset, Integer.valueOf(newId)); + } + + /** + * Returns whether the wither is armored with its boss armor or not by checking whether its health is below half of + * its maximum. + */ + public boolean isArmored() + { + return this.getHealth() <= this.getMaxHealth() / 2.0F; + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.UNDEAD; + } + + /** + * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. + */ + public void mountEntity(Entity entityIn) + { + this.ridingEntity = null; + } +} diff --git a/src/minecraft/net/minecraft/entity/boss/IBossDisplayData.java b/src/minecraft/net/minecraft/entity/boss/IBossDisplayData.java new file mode 100644 index 0000000..f7caccf --- /dev/null +++ b/src/minecraft/net/minecraft/entity/boss/IBossDisplayData.java @@ -0,0 +1,15 @@ +package net.minecraft.entity.boss; + +import net.minecraft.util.IChatComponent; + +public interface IBossDisplayData +{ + float getMaxHealth(); + + float getHealth(); + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + IChatComponent getDisplayName(); +} diff --git a/src/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java b/src/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java new file mode 100644 index 0000000..75f4e38 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/effect/EntityLightningBolt.java @@ -0,0 +1,130 @@ +package net.minecraft.entity.effect; + +import java.util.List; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class EntityLightningBolt extends EntityWeatherEffect +{ + /** + * Declares which state the lightning bolt is in. Whether it's in the air, hit the ground, etc. + */ + private int lightningState; + + /** + * A random long that is used to change the vertex of the lightning rendered in RenderLightningBolt + */ + public long boltVertex; + + /** + * Determines the time before the EntityLightningBolt is destroyed. It is a random integer decremented over time. + */ + private int boltLivingTime; + + public EntityLightningBolt(World worldIn, double posX, double posY, double posZ) + { + super(worldIn); + this.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F); + this.lightningState = 2; + this.boltVertex = this.rand.nextLong(); + this.boltLivingTime = this.rand.nextInt(3) + 1; + BlockPos blockpos = new BlockPos(this); + + if (!worldIn.isRemote && worldIn.getGameRules().getBoolean("doFireTick") && (worldIn.getDifficulty() == EnumDifficulty.NORMAL || worldIn.getDifficulty() == EnumDifficulty.HARD) && worldIn.isAreaLoaded(blockpos, 10)) + { + if (worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air && Blocks.fire.canPlaceBlockAt(worldIn, blockpos)) + { + worldIn.setBlockState(blockpos, Blocks.fire.getDefaultState()); + } + + for (int i = 0; i < 4; ++i) + { + BlockPos blockpos1 = blockpos.add(this.rand.nextInt(3) - 1, this.rand.nextInt(3) - 1, this.rand.nextInt(3) - 1); + + if (worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air && Blocks.fire.canPlaceBlockAt(worldIn, blockpos1)) + { + worldIn.setBlockState(blockpos1, Blocks.fire.getDefaultState()); + } + } + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.lightningState == 2) + { + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F); + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 2.0F, 0.5F + this.rand.nextFloat() * 0.2F); + } + + --this.lightningState; + + if (this.lightningState < 0) + { + if (this.boltLivingTime == 0) + { + this.setDead(); + } + else if (this.lightningState < -this.rand.nextInt(10)) + { + --this.boltLivingTime; + this.lightningState = 1; + this.boltVertex = this.rand.nextLong(); + BlockPos blockpos = new BlockPos(this); + + if (!this.worldObj.isRemote && this.worldObj.getGameRules().getBoolean("doFireTick") && this.worldObj.isAreaLoaded(blockpos, 10) && this.worldObj.getBlockState(blockpos).getBlock().getMaterial() == Material.air && Blocks.fire.canPlaceBlockAt(this.worldObj, blockpos)) + { + this.worldObj.setBlockState(blockpos, Blocks.fire.getDefaultState()); + } + } + } + + if (this.lightningState >= 0) + { + if (this.worldObj.isRemote) + { + this.worldObj.setLastLightningBolt(2); + } + else + { + double d0 = 3.0D; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, new AxisAlignedBB(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + 6.0D + d0, this.posZ + d0)); + + for (int i = 0; i < list.size(); ++i) + { + Entity entity = (Entity)list.get(i); + entity.onStruckByLightning(this); + } + } + } + } + + protected void entityInit() + { + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + } +} diff --git a/src/minecraft/net/minecraft/entity/effect/EntityWeatherEffect.java b/src/minecraft/net/minecraft/entity/effect/EntityWeatherEffect.java new file mode 100644 index 0000000..80a9b0b --- /dev/null +++ b/src/minecraft/net/minecraft/entity/effect/EntityWeatherEffect.java @@ -0,0 +1,12 @@ +package net.minecraft.entity.effect; + +import net.minecraft.entity.Entity; +import net.minecraft.world.World; + +public abstract class EntityWeatherEffect extends Entity +{ + public EntityWeatherEffect(World worldIn) + { + super(worldIn); + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityArmorStand.java b/src/minecraft/net/minecraft/entity/item/EntityArmorStand.java new file mode 100644 index 0000000..35b19b7 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityArmorStand.java @@ -0,0 +1,989 @@ +package net.minecraft.entity.item; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.Rotations; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public class EntityArmorStand extends EntityLivingBase +{ + private static final Rotations DEFAULT_HEAD_ROTATION = new Rotations(0.0F, 0.0F, 0.0F); + private static final Rotations DEFAULT_BODY_ROTATION = new Rotations(0.0F, 0.0F, 0.0F); + private static final Rotations DEFAULT_LEFTARM_ROTATION = new Rotations(-10.0F, 0.0F, -10.0F); + private static final Rotations DEFAULT_RIGHTARM_ROTATION = new Rotations(-15.0F, 0.0F, 10.0F); + private static final Rotations DEFAULT_LEFTLEG_ROTATION = new Rotations(-1.0F, 0.0F, -1.0F); + private static final Rotations DEFAULT_RIGHTLEG_ROTATION = new Rotations(1.0F, 0.0F, 1.0F); + private final ItemStack[] contents; + private boolean canInteract; + + /** + * After punching the stand, the cooldown before you can punch it again without breaking it. + */ + private long punchCooldown; + private int disabledSlots; + private boolean field_181028_bj; + private Rotations headRotation; + private Rotations bodyRotation; + private Rotations leftArmRotation; + private Rotations rightArmRotation; + private Rotations leftLegRotation; + private Rotations rightLegRotation; + + public EntityArmorStand(World worldIn) + { + super(worldIn); + this.contents = new ItemStack[5]; + this.headRotation = DEFAULT_HEAD_ROTATION; + this.bodyRotation = DEFAULT_BODY_ROTATION; + this.leftArmRotation = DEFAULT_LEFTARM_ROTATION; + this.rightArmRotation = DEFAULT_RIGHTARM_ROTATION; + this.leftLegRotation = DEFAULT_LEFTLEG_ROTATION; + this.rightLegRotation = DEFAULT_RIGHTLEG_ROTATION; + this.setSilent(true); + this.noClip = this.hasNoGravity(); + this.setSize(0.5F, 1.975F); + } + + public EntityArmorStand(World worldIn, double posX, double posY, double posZ) + { + this(worldIn); + this.setPosition(posX, posY, posZ); + } + + /** + * Returns whether the entity is in a server world + */ + public boolean isServerWorld() + { + return super.isServerWorld() && !this.hasNoGravity(); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(10, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(11, DEFAULT_HEAD_ROTATION); + this.dataWatcher.addObject(12, DEFAULT_BODY_ROTATION); + this.dataWatcher.addObject(13, DEFAULT_LEFTARM_ROTATION); + this.dataWatcher.addObject(14, DEFAULT_RIGHTARM_ROTATION); + this.dataWatcher.addObject(15, DEFAULT_LEFTLEG_ROTATION); + this.dataWatcher.addObject(16, DEFAULT_RIGHTLEG_ROTATION); + } + + /** + * Returns the item that this EntityLiving is holding, if any. + */ + public ItemStack getHeldItem() + { + return this.contents[0]; + } + + /** + * 0: Tool in Hand; 1-4: Armor + */ + public ItemStack getEquipmentInSlot(int slotIn) + { + return this.contents[slotIn]; + } + + public ItemStack getCurrentArmor(int slotIn) + { + return this.contents[slotIn + 1]; + } + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public void setCurrentItemOrArmor(int slotIn, ItemStack stack) + { + this.contents[slotIn] = stack; + } + + /** + * returns the inventory of this entity (only used in EntityPlayerMP it seems) + */ + public ItemStack[] getInventory() + { + return this.contents; + } + + public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn) + { + int i; + + if (inventorySlot == 99) + { + i = 0; + } + else + { + i = inventorySlot - 100 + 1; + + if (i < 0 || i >= this.contents.length) + { + return false; + } + } + + if (itemStackIn != null && EntityLiving.getArmorPosition(itemStackIn) != i && (i != 4 || !(itemStackIn.getItem() instanceof ItemBlock))) + { + return false; + } + else + { + this.setCurrentItemOrArmor(i, itemStackIn); + return true; + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.contents.length; ++i) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + if (this.contents[i] != null) + { + this.contents[i].writeToNBT(nbttagcompound); + } + + nbttaglist.appendTag(nbttagcompound); + } + + tagCompound.setTag("Equipment", nbttaglist); + + if (this.getAlwaysRenderNameTag() && (this.getCustomNameTag() == null || this.getCustomNameTag().length() == 0)) + { + tagCompound.setBoolean("CustomNameVisible", this.getAlwaysRenderNameTag()); + } + + tagCompound.setBoolean("Invisible", this.isInvisible()); + tagCompound.setBoolean("Small", this.isSmall()); + tagCompound.setBoolean("ShowArms", this.getShowArms()); + tagCompound.setInteger("DisabledSlots", this.disabledSlots); + tagCompound.setBoolean("NoGravity", this.hasNoGravity()); + tagCompound.setBoolean("NoBasePlate", this.hasNoBasePlate()); + + if (this.func_181026_s()) + { + tagCompound.setBoolean("Marker", this.func_181026_s()); + } + + tagCompound.setTag("Pose", this.readPoseFromNBT()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + + if (tagCompund.hasKey("Equipment", 9)) + { + NBTTagList nbttaglist = tagCompund.getTagList("Equipment", 10); + + for (int i = 0; i < this.contents.length; ++i) + { + this.contents[i] = ItemStack.loadItemStackFromNBT(nbttaglist.getCompoundTagAt(i)); + } + } + + this.setInvisible(tagCompund.getBoolean("Invisible")); + this.setSmall(tagCompund.getBoolean("Small")); + this.setShowArms(tagCompund.getBoolean("ShowArms")); + this.disabledSlots = tagCompund.getInteger("DisabledSlots"); + this.setNoGravity(tagCompund.getBoolean("NoGravity")); + this.setNoBasePlate(tagCompund.getBoolean("NoBasePlate")); + this.func_181027_m(tagCompund.getBoolean("Marker")); + this.field_181028_bj = !this.func_181026_s(); + this.noClip = this.hasNoGravity(); + NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Pose"); + this.writePoseToNBT(nbttagcompound); + } + + /** + * Saves the pose to an NBTTagCompound. + */ + private void writePoseToNBT(NBTTagCompound tagCompound) + { + NBTTagList nbttaglist = tagCompound.getTagList("Head", 5); + + if (nbttaglist.tagCount() > 0) + { + this.setHeadRotation(new Rotations(nbttaglist)); + } + else + { + this.setHeadRotation(DEFAULT_HEAD_ROTATION); + } + + NBTTagList nbttaglist1 = tagCompound.getTagList("Body", 5); + + if (nbttaglist1.tagCount() > 0) + { + this.setBodyRotation(new Rotations(nbttaglist1)); + } + else + { + this.setBodyRotation(DEFAULT_BODY_ROTATION); + } + + NBTTagList nbttaglist2 = tagCompound.getTagList("LeftArm", 5); + + if (nbttaglist2.tagCount() > 0) + { + this.setLeftArmRotation(new Rotations(nbttaglist2)); + } + else + { + this.setLeftArmRotation(DEFAULT_LEFTARM_ROTATION); + } + + NBTTagList nbttaglist3 = tagCompound.getTagList("RightArm", 5); + + if (nbttaglist3.tagCount() > 0) + { + this.setRightArmRotation(new Rotations(nbttaglist3)); + } + else + { + this.setRightArmRotation(DEFAULT_RIGHTARM_ROTATION); + } + + NBTTagList nbttaglist4 = tagCompound.getTagList("LeftLeg", 5); + + if (nbttaglist4.tagCount() > 0) + { + this.setLeftLegRotation(new Rotations(nbttaglist4)); + } + else + { + this.setLeftLegRotation(DEFAULT_LEFTLEG_ROTATION); + } + + NBTTagList nbttaglist5 = tagCompound.getTagList("RightLeg", 5); + + if (nbttaglist5.tagCount() > 0) + { + this.setRightLegRotation(new Rotations(nbttaglist5)); + } + else + { + this.setRightLegRotation(DEFAULT_RIGHTLEG_ROTATION); + } + } + + private NBTTagCompound readPoseFromNBT() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + if (!DEFAULT_HEAD_ROTATION.equals(this.headRotation)) + { + nbttagcompound.setTag("Head", this.headRotation.writeToNBT()); + } + + if (!DEFAULT_BODY_ROTATION.equals(this.bodyRotation)) + { + nbttagcompound.setTag("Body", this.bodyRotation.writeToNBT()); + } + + if (!DEFAULT_LEFTARM_ROTATION.equals(this.leftArmRotation)) + { + nbttagcompound.setTag("LeftArm", this.leftArmRotation.writeToNBT()); + } + + if (!DEFAULT_RIGHTARM_ROTATION.equals(this.rightArmRotation)) + { + nbttagcompound.setTag("RightArm", this.rightArmRotation.writeToNBT()); + } + + if (!DEFAULT_LEFTLEG_ROTATION.equals(this.leftLegRotation)) + { + nbttagcompound.setTag("LeftLeg", this.leftLegRotation.writeToNBT()); + } + + if (!DEFAULT_RIGHTLEG_ROTATION.equals(this.rightLegRotation)) + { + nbttagcompound.setTag("RightLeg", this.rightLegRotation.writeToNBT()); + } + + return nbttagcompound; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return false; + } + + protected void collideWithEntity(Entity p_82167_1_) + { + } + + protected void collideWithNearbyEntities() + { + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox()); + + if (list != null && !list.isEmpty()) + { + for (int i = 0; i < list.size(); ++i) + { + Entity entity = (Entity)list.get(i); + + if (entity instanceof EntityMinecart && ((EntityMinecart)entity).getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE && this.getDistanceSqToEntity(entity) <= 0.2D) + { + entity.applyEntityCollision(this); + } + } + } + } + + /** + * New version of interactWith that includes vector information on where precisely the player targeted. + */ + public boolean interactAt(EntityPlayer player, Vec3 targetVec3) + { + if (this.func_181026_s()) + { + return false; + } + else if (!this.worldObj.isRemote && !player.isSpectator()) + { + int i = 0; + ItemStack itemstack = player.getCurrentEquippedItem(); + boolean flag = itemstack != null; + + if (flag && itemstack.getItem() instanceof ItemArmor) + { + ItemArmor itemarmor = (ItemArmor)itemstack.getItem(); + + if (itemarmor.armorType == 3) + { + i = 1; + } + else if (itemarmor.armorType == 2) + { + i = 2; + } + else if (itemarmor.armorType == 1) + { + i = 3; + } + else if (itemarmor.armorType == 0) + { + i = 4; + } + } + + if (flag && (itemstack.getItem() == Items.skull || itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin))) + { + i = 4; + } + + double d4 = 0.1D; + double d0 = 0.9D; + double d1 = 0.4D; + double d2 = 1.6D; + int j = 0; + boolean flag1 = this.isSmall(); + double d3 = flag1 ? targetVec3.yCoord * 2.0D : targetVec3.yCoord; + + if (d3 >= 0.1D && d3 < 0.1D + (flag1 ? 0.8D : 0.45D) && this.contents[1] != null) + { + j = 1; + } + else if (d3 >= 0.9D + (flag1 ? 0.3D : 0.0D) && d3 < 0.9D + (flag1 ? 1.0D : 0.7D) && this.contents[3] != null) + { + j = 3; + } + else if (d3 >= 0.4D && d3 < 0.4D + (flag1 ? 1.0D : 0.8D) && this.contents[2] != null) + { + j = 2; + } + else if (d3 >= 1.6D && this.contents[4] != null) + { + j = 4; + } + + boolean flag2 = this.contents[j] != null; + + if ((this.disabledSlots & 1 << j) != 0 || (this.disabledSlots & 1 << i) != 0) + { + j = i; + + if ((this.disabledSlots & 1 << i) != 0) + { + if ((this.disabledSlots & 1) != 0) + { + return true; + } + + j = 0; + } + } + + if (flag && i == 0 && !this.getShowArms()) + { + return true; + } + else + { + if (flag) + { + this.func_175422_a(player, i); + } + else if (flag2) + { + this.func_175422_a(player, j); + } + + return true; + } + } + else + { + return true; + } + } + + private void func_175422_a(EntityPlayer p_175422_1_, int p_175422_2_) + { + ItemStack itemstack = this.contents[p_175422_2_]; + + if (itemstack == null || (this.disabledSlots & 1 << p_175422_2_ + 8) == 0) + { + if (itemstack != null || (this.disabledSlots & 1 << p_175422_2_ + 16) == 0) + { + int i = p_175422_1_.inventory.currentItem; + ItemStack itemstack1 = p_175422_1_.inventory.getStackInSlot(i); + + if (p_175422_1_.capabilities.isCreativeMode && (itemstack == null || itemstack.getItem() == Item.getItemFromBlock(Blocks.air)) && itemstack1 != null) + { + ItemStack itemstack3 = itemstack1.copy(); + itemstack3.stackSize = 1; + this.setCurrentItemOrArmor(p_175422_2_, itemstack3); + } + else if (itemstack1 != null && itemstack1.stackSize > 1) + { + if (itemstack == null) + { + ItemStack itemstack2 = itemstack1.copy(); + itemstack2.stackSize = 1; + this.setCurrentItemOrArmor(p_175422_2_, itemstack2); + --itemstack1.stackSize; + } + } + else + { + this.setCurrentItemOrArmor(p_175422_2_, itemstack1); + p_175422_1_.inventory.setInventorySlotContents(i, itemstack); + } + } + } + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.worldObj.isRemote) + { + return false; + } + else if (DamageSource.outOfWorld.equals(source)) + { + this.setDead(); + return false; + } + else if (!this.isEntityInvulnerable(source) && !this.canInteract && !this.func_181026_s()) + { + if (source.isExplosion()) + { + this.dropContents(); + this.setDead(); + return false; + } + else if (DamageSource.inFire.equals(source)) + { + if (!this.isBurning()) + { + this.setFire(5); + } + else + { + this.damageArmorStand(0.15F); + } + + return false; + } + else if (DamageSource.onFire.equals(source) && this.getHealth() > 0.5F) + { + this.damageArmorStand(4.0F); + return false; + } + else + { + boolean flag = "arrow".equals(source.getDamageType()); + boolean flag1 = "player".equals(source.getDamageType()); + + if (!flag1 && !flag) + { + return false; + } + else + { + if (source.getSourceOfDamage() instanceof EntityArrow) + { + source.getSourceOfDamage().setDead(); + } + + if (source.getEntity() instanceof EntityPlayer && !((EntityPlayer)source.getEntity()).capabilities.allowEdit) + { + return false; + } + else if (source.isCreativePlayer()) + { + this.playParticles(); + this.setDead(); + return false; + } + else + { + long i = this.worldObj.getTotalWorldTime(); + + if (i - this.punchCooldown > 5L && !flag) + { + this.punchCooldown = i; + } + else + { + this.dropBlock(); + this.playParticles(); + this.setDead(); + } + + return false; + } + } + } + } + else + { + return false; + } + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double distance) + { + double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D; + + if (Double.isNaN(d0) || d0 == 0.0D) + { + d0 = 4.0D; + } + + d0 = d0 * 64.0D; + return distance < d0 * d0; + } + + private void playParticles() + { + if (this.worldObj instanceof WorldServer) + { + ((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX, this.posY + (double)this.height / 1.5D, this.posZ, 10, (double)(this.width / 4.0F), (double)(this.height / 4.0F), (double)(this.width / 4.0F), 0.05D, new int[] {Block.getStateId(Blocks.planks.getDefaultState())}); + } + } + + private void damageArmorStand(float p_175406_1_) + { + float f = this.getHealth(); + f = f - p_175406_1_; + + if (f <= 0.5F) + { + this.dropContents(); + this.setDead(); + } + else + { + this.setHealth(f); + } + } + + private void dropBlock() + { + Block.spawnAsEntity(this.worldObj, new BlockPos(this), new ItemStack(Items.armor_stand)); + this.dropContents(); + } + + private void dropContents() + { + for (int i = 0; i < this.contents.length; ++i) + { + if (this.contents[i] != null && this.contents[i].stackSize > 0) + { + if (this.contents[i] != null) + { + Block.spawnAsEntity(this.worldObj, (new BlockPos(this)).up(), this.contents[i]); + } + + this.contents[i] = null; + } + } + } + + protected float func_110146_f(float p_110146_1_, float p_110146_2_) + { + this.prevRenderYawOffset = this.prevRotationYaw; + this.renderYawOffset = this.rotationYaw; + return 0.0F; + } + + public float getEyeHeight() + { + return this.isChild() ? this.height * 0.5F : this.height * 0.9F; + } + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float strafe, float forward) + { + if (!this.hasNoGravity()) + { + super.moveEntityWithHeading(strafe, forward); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + Rotations rotations = this.dataWatcher.getWatchableObjectRotations(11); + + if (!this.headRotation.equals(rotations)) + { + this.setHeadRotation(rotations); + } + + Rotations rotations1 = this.dataWatcher.getWatchableObjectRotations(12); + + if (!this.bodyRotation.equals(rotations1)) + { + this.setBodyRotation(rotations1); + } + + Rotations rotations2 = this.dataWatcher.getWatchableObjectRotations(13); + + if (!this.leftArmRotation.equals(rotations2)) + { + this.setLeftArmRotation(rotations2); + } + + Rotations rotations3 = this.dataWatcher.getWatchableObjectRotations(14); + + if (!this.rightArmRotation.equals(rotations3)) + { + this.setRightArmRotation(rotations3); + } + + Rotations rotations4 = this.dataWatcher.getWatchableObjectRotations(15); + + if (!this.leftLegRotation.equals(rotations4)) + { + this.setLeftLegRotation(rotations4); + } + + Rotations rotations5 = this.dataWatcher.getWatchableObjectRotations(16); + + if (!this.rightLegRotation.equals(rotations5)) + { + this.setRightLegRotation(rotations5); + } + + boolean flag = this.func_181026_s(); + + if (!this.field_181028_bj && flag) + { + this.func_181550_a(false); + } + else + { + if (!this.field_181028_bj || flag) + { + return; + } + + this.func_181550_a(true); + } + + this.field_181028_bj = flag; + } + + private void func_181550_a(boolean p_181550_1_) + { + double d0 = this.posX; + double d1 = this.posY; + double d2 = this.posZ; + + if (p_181550_1_) + { + this.setSize(0.5F, 1.975F); + } + else + { + this.setSize(0.0F, 0.0F); + } + + this.setPosition(d0, d1, d2); + } + + /** + * Clears potion metadata values if the entity has no potion effects. Otherwise, updates potion effect color, + * ambience, and invisibility metadata values + */ + protected void updatePotionMetadata() + { + this.setInvisible(this.canInteract); + } + + public void setInvisible(boolean invisible) + { + this.canInteract = invisible; + super.setInvisible(invisible); + } + + /** + * If Animal, checks if the age timer is negative + */ + public boolean isChild() + { + return this.isSmall(); + } + + /** + * Called by the /kill command. + */ + public void onKillCommand() + { + this.setDead(); + } + + public boolean isImmuneToExplosions() + { + return this.isInvisible(); + } + + private void setSmall(boolean p_175420_1_) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(10); + + if (p_175420_1_) + { + b0 = (byte)(b0 | 1); + } + else + { + b0 = (byte)(b0 & -2); + } + + this.dataWatcher.updateObject(10, Byte.valueOf(b0)); + } + + public boolean isSmall() + { + return (this.dataWatcher.getWatchableObjectByte(10) & 1) != 0; + } + + private void setNoGravity(boolean p_175425_1_) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(10); + + if (p_175425_1_) + { + b0 = (byte)(b0 | 2); + } + else + { + b0 = (byte)(b0 & -3); + } + + this.dataWatcher.updateObject(10, Byte.valueOf(b0)); + } + + public boolean hasNoGravity() + { + return (this.dataWatcher.getWatchableObjectByte(10) & 2) != 0; + } + + private void setShowArms(boolean p_175413_1_) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(10); + + if (p_175413_1_) + { + b0 = (byte)(b0 | 4); + } + else + { + b0 = (byte)(b0 & -5); + } + + this.dataWatcher.updateObject(10, Byte.valueOf(b0)); + } + + public boolean getShowArms() + { + return (this.dataWatcher.getWatchableObjectByte(10) & 4) != 0; + } + + private void setNoBasePlate(boolean p_175426_1_) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(10); + + if (p_175426_1_) + { + b0 = (byte)(b0 | 8); + } + else + { + b0 = (byte)(b0 & -9); + } + + this.dataWatcher.updateObject(10, Byte.valueOf(b0)); + } + + public boolean hasNoBasePlate() + { + return (this.dataWatcher.getWatchableObjectByte(10) & 8) != 0; + } + + private void func_181027_m(boolean p_181027_1_) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(10); + + if (p_181027_1_) + { + b0 = (byte)(b0 | 16); + } + else + { + b0 = (byte)(b0 & -17); + } + + this.dataWatcher.updateObject(10, Byte.valueOf(b0)); + } + + public boolean func_181026_s() + { + return (this.dataWatcher.getWatchableObjectByte(10) & 16) != 0; + } + + public void setHeadRotation(Rotations p_175415_1_) + { + this.headRotation = p_175415_1_; + this.dataWatcher.updateObject(11, p_175415_1_); + } + + public void setBodyRotation(Rotations p_175424_1_) + { + this.bodyRotation = p_175424_1_; + this.dataWatcher.updateObject(12, p_175424_1_); + } + + public void setLeftArmRotation(Rotations p_175405_1_) + { + this.leftArmRotation = p_175405_1_; + this.dataWatcher.updateObject(13, p_175405_1_); + } + + public void setRightArmRotation(Rotations p_175428_1_) + { + this.rightArmRotation = p_175428_1_; + this.dataWatcher.updateObject(14, p_175428_1_); + } + + public void setLeftLegRotation(Rotations p_175417_1_) + { + this.leftLegRotation = p_175417_1_; + this.dataWatcher.updateObject(15, p_175417_1_); + } + + public void setRightLegRotation(Rotations p_175427_1_) + { + this.rightLegRotation = p_175427_1_; + this.dataWatcher.updateObject(16, p_175427_1_); + } + + public Rotations getHeadRotation() + { + return this.headRotation; + } + + public Rotations getBodyRotation() + { + return this.bodyRotation; + } + + public Rotations getLeftArmRotation() + { + return this.leftArmRotation; + } + + public Rotations getRightArmRotation() + { + return this.rightArmRotation; + } + + public Rotations getLeftLegRotation() + { + return this.leftLegRotation; + } + + public Rotations getRightLegRotation() + { + return this.rightLegRotation; + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return super.canBeCollidedWith() && !this.func_181026_s(); + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityBoat.java b/src/minecraft/net/minecraft/entity/item/EntityBoat.java new file mode 100644 index 0000000..ffbefb8 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityBoat.java @@ -0,0 +1,621 @@ +package net.minecraft.entity.item; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSourceIndirect; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityBoat extends Entity +{ + /** true if no player in boat */ + private boolean isBoatEmpty; + private double speedMultiplier; + private int boatPosRotationIncrements; + private double boatX; + private double boatY; + private double boatZ; + private double boatYaw; + private double boatPitch; + private double velocityX; + private double velocityY; + private double velocityZ; + + public EntityBoat(World worldIn) + { + super(worldIn); + this.isBoatEmpty = true; + this.speedMultiplier = 0.07D; + this.preventEntitySpawning = true; + this.setSize(1.5F, 0.6F); + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + protected void entityInit() + { + this.dataWatcher.addObject(17, new Integer(0)); + this.dataWatcher.addObject(18, new Integer(1)); + this.dataWatcher.addObject(19, new Float(0.0F)); + } + + /** + * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be + * pushable on contact, like boats or minecarts. + */ + public AxisAlignedBB getCollisionBox(Entity entityIn) + { + return entityIn.getEntityBoundingBox(); + } + + /** + * Returns the collision bounding box for this entity + */ + public AxisAlignedBB getCollisionBoundingBox() + { + return this.getEntityBoundingBox(); + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return true; + } + + public EntityBoat(World worldIn, double p_i1705_2_, double p_i1705_4_, double p_i1705_6_) + { + this(worldIn); + this.setPosition(p_i1705_2_, p_i1705_4_, p_i1705_6_); + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.prevPosX = p_i1705_2_; + this.prevPosY = p_i1705_4_; + this.prevPosZ = p_i1705_6_; + } + + /** + * Returns the Y offset from the entity's position for any entity riding this one. + */ + public double getMountedYOffset() + { + return -0.3D; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else if (!this.worldObj.isRemote && !this.isDead) + { + if (this.riddenByEntity != null && this.riddenByEntity == source.getEntity() && source instanceof EntityDamageSourceIndirect) + { + return false; + } + else + { + this.setForwardDirection(-this.getForwardDirection()); + this.setTimeSinceHit(10); + this.setDamageTaken(this.getDamageTaken() + amount * 10.0F); + this.setBeenAttacked(); + boolean flag = source.getEntity() instanceof EntityPlayer && ((EntityPlayer)source.getEntity()).capabilities.isCreativeMode; + + if (flag || this.getDamageTaken() > 40.0F) + { + if (this.riddenByEntity != null) + { + this.riddenByEntity.mountEntity(this); + } + + if (!flag && this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + this.dropItemWithOffset(Items.boat, 1, 0.0F); + } + + this.setDead(); + } + + return true; + } + } + else + { + return true; + } + } + + /** + * Setups the entity to do the hurt animation. Only used by packets in multiplayer. + */ + public void performHurtAnimation() + { + this.setForwardDirection(-this.getForwardDirection()); + this.setTimeSinceHit(10); + this.setDamageTaken(this.getDamageTaken() * 11.0F); + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return !this.isDead; + } + + public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + { + if (p_180426_10_ && this.riddenByEntity != null) + { + this.prevPosX = this.posX = x; + this.prevPosY = this.posY = y; + this.prevPosZ = this.posZ = z; + this.rotationYaw = yaw; + this.rotationPitch = pitch; + this.boatPosRotationIncrements = 0; + this.setPosition(x, y, z); + this.motionX = this.velocityX = 0.0D; + this.motionY = this.velocityY = 0.0D; + this.motionZ = this.velocityZ = 0.0D; + } + else + { + if (this.isBoatEmpty) + { + this.boatPosRotationIncrements = posRotationIncrements + 5; + } + else + { + double d0 = x - this.posX; + double d1 = y - this.posY; + double d2 = z - this.posZ; + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + + if (d3 <= 1.0D) + { + return; + } + + this.boatPosRotationIncrements = 3; + } + + this.boatX = x; + this.boatY = y; + this.boatZ = z; + this.boatYaw = (double)yaw; + this.boatPitch = (double)pitch; + this.motionX = this.velocityX; + this.motionY = this.velocityY; + this.motionZ = this.velocityZ; + } + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double x, double y, double z) + { + this.velocityX = this.motionX = x; + this.velocityY = this.motionY = y; + this.velocityZ = this.motionZ = z; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.getTimeSinceHit() > 0) + { + this.setTimeSinceHit(this.getTimeSinceHit() - 1); + } + + if (this.getDamageTaken() > 0.0F) + { + this.setDamageTaken(this.getDamageTaken() - 1.0F); + } + + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + int i = 5; + double d0 = 0.0D; + + for (int j = 0; j < i; ++j) + { + double d1 = this.getEntityBoundingBox().minY + (this.getEntityBoundingBox().maxY - this.getEntityBoundingBox().minY) * (double)(j + 0) / (double)i - 0.125D; + double d3 = this.getEntityBoundingBox().minY + (this.getEntityBoundingBox().maxY - this.getEntityBoundingBox().minY) * (double)(j + 1) / (double)i - 0.125D; + AxisAlignedBB axisalignedbb = new AxisAlignedBB(this.getEntityBoundingBox().minX, d1, this.getEntityBoundingBox().minZ, this.getEntityBoundingBox().maxX, d3, this.getEntityBoundingBox().maxZ); + + if (this.worldObj.isAABBInMaterial(axisalignedbb, Material.water)) + { + d0 += 1.0D / (double)i; + } + } + + double d9 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (d9 > 0.2975D) + { + double d2 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D); + double d4 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D); + + for (int k = 0; (double)k < 1.0D + d9 * 60.0D; ++k) + { + double d5 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); + double d6 = (double)(this.rand.nextInt(2) * 2 - 1) * 0.7D; + + if (this.rand.nextBoolean()) + { + double d7 = this.posX - d2 * d5 * 0.8D + d4 * d6; + double d8 = this.posZ - d4 * d5 * 0.8D - d2 * d6; + this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, d7, this.posY - 0.125D, d8, this.motionX, this.motionY, this.motionZ, new int[0]); + } + else + { + double d24 = this.posX + d2 + d4 * d5 * 0.7D; + double d25 = this.posZ + d4 - d2 * d5 * 0.7D; + this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, d24, this.posY - 0.125D, d25, this.motionX, this.motionY, this.motionZ, new int[0]); + } + } + } + + if (this.worldObj.isRemote && this.isBoatEmpty) + { + if (this.boatPosRotationIncrements > 0) + { + double d12 = this.posX + (this.boatX - this.posX) / (double)this.boatPosRotationIncrements; + double d16 = this.posY + (this.boatY - this.posY) / (double)this.boatPosRotationIncrements; + double d19 = this.posZ + (this.boatZ - this.posZ) / (double)this.boatPosRotationIncrements; + double d22 = MathHelper.wrapAngleTo180_double(this.boatYaw - (double)this.rotationYaw); + this.rotationYaw = (float)((double)this.rotationYaw + d22 / (double)this.boatPosRotationIncrements); + this.rotationPitch = (float)((double)this.rotationPitch + (this.boatPitch - (double)this.rotationPitch) / (double)this.boatPosRotationIncrements); + --this.boatPosRotationIncrements; + this.setPosition(d12, d16, d19); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + else + { + double d13 = this.posX + this.motionX; + double d17 = this.posY + this.motionY; + double d20 = this.posZ + this.motionZ; + this.setPosition(d13, d17, d20); + + if (this.onGround) + { + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + + this.motionX *= 0.9900000095367432D; + this.motionY *= 0.949999988079071D; + this.motionZ *= 0.9900000095367432D; + } + } + else + { + if (d0 < 1.0D) + { + double d10 = d0 * 2.0D - 1.0D; + this.motionY += 0.03999999910593033D * d10; + } + else + { + if (this.motionY < 0.0D) + { + this.motionY /= 2.0D; + } + + this.motionY += 0.007000000216066837D; + } + + if (this.riddenByEntity instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)this.riddenByEntity; + float f = this.riddenByEntity.rotationYaw + -entitylivingbase.moveStrafing * 90.0F; + this.motionX += -Math.sin((double)(f * (float)Math.PI / 180.0F)) * this.speedMultiplier * (double)entitylivingbase.moveForward * 0.05000000074505806D; + this.motionZ += Math.cos((double)(f * (float)Math.PI / 180.0F)) * this.speedMultiplier * (double)entitylivingbase.moveForward * 0.05000000074505806D; + } + + double d11 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (d11 > 0.35D) + { + double d14 = 0.35D / d11; + this.motionX *= d14; + this.motionZ *= d14; + d11 = 0.35D; + } + + if (d11 > d9 && this.speedMultiplier < 0.35D) + { + this.speedMultiplier += (0.35D - this.speedMultiplier) / 35.0D; + + if (this.speedMultiplier > 0.35D) + { + this.speedMultiplier = 0.35D; + } + } + else + { + this.speedMultiplier -= (this.speedMultiplier - 0.07D) / 35.0D; + + if (this.speedMultiplier < 0.07D) + { + this.speedMultiplier = 0.07D; + } + } + + for (int i1 = 0; i1 < 4; ++i1) + { + int l1 = MathHelper.floor_double(this.posX + ((double)(i1 % 2) - 0.5D) * 0.8D); + int i2 = MathHelper.floor_double(this.posZ + ((double)(i1 / 2) - 0.5D) * 0.8D); + + for (int j2 = 0; j2 < 2; ++j2) + { + int l = MathHelper.floor_double(this.posY) + j2; + BlockPos blockpos = new BlockPos(l1, l, i2); + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + + if (block == Blocks.snow_layer) + { + this.worldObj.setBlockToAir(blockpos); + this.isCollidedHorizontally = false; + } + else if (block == Blocks.waterlily) + { + this.worldObj.destroyBlock(blockpos, true); + this.isCollidedHorizontally = false; + } + } + } + + if (this.onGround) + { + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.isCollidedHorizontally && d9 > 0.2975D) + { + if (!this.worldObj.isRemote && !this.isDead) + { + this.setDead(); + + if (this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + for (int j1 = 0; j1 < 3; ++j1) + { + this.dropItemWithOffset(Item.getItemFromBlock(Blocks.planks), 1, 0.0F); + } + + for (int k1 = 0; k1 < 2; ++k1) + { + this.dropItemWithOffset(Items.stick, 1, 0.0F); + } + } + } + } + else + { + this.motionX *= 0.9900000095367432D; + this.motionY *= 0.949999988079071D; + this.motionZ *= 0.9900000095367432D; + } + + this.rotationPitch = 0.0F; + double d15 = (double)this.rotationYaw; + double d18 = this.prevPosX - this.posX; + double d21 = this.prevPosZ - this.posZ; + + if (d18 * d18 + d21 * d21 > 0.001D) + { + d15 = (double)((float)(MathHelper.func_181159_b(d21, d18) * 180.0D / Math.PI)); + } + + double d23 = MathHelper.wrapAngleTo180_double(d15 - (double)this.rotationYaw); + + if (d23 > 20.0D) + { + d23 = 20.0D; + } + + if (d23 < -20.0D) + { + d23 = -20.0D; + } + + this.rotationYaw = (float)((double)this.rotationYaw + d23); + this.setRotation(this.rotationYaw, this.rotationPitch); + + if (!this.worldObj.isRemote) + { + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + + if (list != null && !list.isEmpty()) + { + for (int k2 = 0; k2 < list.size(); ++k2) + { + Entity entity = (Entity)list.get(k2); + + if (entity != this.riddenByEntity && entity.canBePushed() && entity instanceof EntityBoat) + { + entity.applyEntityCollision(this); + } + } + } + + if (this.riddenByEntity != null && this.riddenByEntity.isDead) + { + this.riddenByEntity = null; + } + } + } + } + + public void updateRiderPosition() + { + if (this.riddenByEntity != null) + { + double d0 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D; + double d1 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D; + this.riddenByEntity.setPosition(this.posX + d0, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + d1); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer playerIn) + { + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn) + { + return true; + } + else + { + if (!this.worldObj.isRemote) + { + playerIn.mountEntity(this); + } + + return true; + } + } + + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) + { + if (onGroundIn) + { + if (this.fallDistance > 3.0F) + { + this.fall(this.fallDistance, 1.0F); + + if (!this.worldObj.isRemote && !this.isDead) + { + this.setDead(); + + if (this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + for (int i = 0; i < 3; ++i) + { + this.dropItemWithOffset(Item.getItemFromBlock(Blocks.planks), 1, 0.0F); + } + + for (int j = 0; j < 2; ++j) + { + this.dropItemWithOffset(Items.stick, 1, 0.0F); + } + } + } + + this.fallDistance = 0.0F; + } + } + else if (this.worldObj.getBlockState((new BlockPos(this)).down()).getBlock().getMaterial() != Material.water && y < 0.0D) + { + this.fallDistance = (float)((double)this.fallDistance - y); + } + } + + /** + * Sets the damage taken from the last hit. + */ + public void setDamageTaken(float p_70266_1_) + { + this.dataWatcher.updateObject(19, Float.valueOf(p_70266_1_)); + } + + /** + * Gets the damage taken from the last hit. + */ + public float getDamageTaken() + { + return this.dataWatcher.getWatchableObjectFloat(19); + } + + /** + * Sets the time to count down from since the last time entity was hit. + */ + public void setTimeSinceHit(int p_70265_1_) + { + this.dataWatcher.updateObject(17, Integer.valueOf(p_70265_1_)); + } + + /** + * Gets the time since the last hit. + */ + public int getTimeSinceHit() + { + return this.dataWatcher.getWatchableObjectInt(17); + } + + /** + * Sets the forward direction of the entity. + */ + public void setForwardDirection(int p_70269_1_) + { + this.dataWatcher.updateObject(18, Integer.valueOf(p_70269_1_)); + } + + /** + * Gets the forward direction of the entity. + */ + public int getForwardDirection() + { + return this.dataWatcher.getWatchableObjectInt(18); + } + + /** + * true if no player in boat + */ + public void setIsBoatEmpty(boolean p_70270_1_) + { + this.isBoatEmpty = p_70270_1_; + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityEnderCrystal.java b/src/minecraft/net/minecraft/entity/item/EntityEnderCrystal.java new file mode 100644 index 0000000..78228df --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityEnderCrystal.java @@ -0,0 +1,118 @@ +package net.minecraft.entity.item; + +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.WorldProviderEnd; + +public class EntityEnderCrystal extends Entity +{ + /** Used to create the rotation animation when rendering the crystal. */ + public int innerRotation; + public int health; + + public EntityEnderCrystal(World worldIn) + { + super(worldIn); + this.preventEntitySpawning = true; + this.setSize(2.0F, 2.0F); + this.health = 5; + this.innerRotation = this.rand.nextInt(100000); + } + + public EntityEnderCrystal(World worldIn, double p_i1699_2_, double p_i1699_4_, double p_i1699_6_) + { + this(worldIn); + this.setPosition(p_i1699_2_, p_i1699_4_, p_i1699_6_); + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + protected void entityInit() + { + this.dataWatcher.addObject(8, Integer.valueOf(this.health)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + ++this.innerRotation; + this.dataWatcher.updateObject(8, Integer.valueOf(this.health)); + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.posY); + int k = MathHelper.floor_double(this.posZ); + + if (this.worldObj.provider instanceof WorldProviderEnd && this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock() != Blocks.fire) + { + this.worldObj.setBlockState(new BlockPos(i, j, k), Blocks.fire.getDefaultState()); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + if (!this.isDead && !this.worldObj.isRemote) + { + this.health = 0; + + if (this.health <= 0) + { + this.setDead(); + + if (!this.worldObj.isRemote) + { + this.worldObj.createExplosion((Entity)null, this.posX, this.posY, this.posZ, 6.0F, true); + } + } + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityEnderEye.java b/src/minecraft/net/minecraft/entity/item/EntityEnderEye.java new file mode 100644 index 0000000..a259935 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityEnderEye.java @@ -0,0 +1,237 @@ +package net.minecraft.entity.item; + +import net.minecraft.entity.Entity; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityEnderEye extends Entity +{ + /** 'x' location the eye should float towards. */ + private double targetX; + + /** 'y' location the eye should float towards. */ + private double targetY; + + /** 'z' location the eye should float towards. */ + private double targetZ; + private int despawnTimer; + private boolean shatterOrDrop; + + public EntityEnderEye(World worldIn) + { + super(worldIn); + this.setSize(0.25F, 0.25F); + } + + protected void entityInit() + { + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double distance) + { + double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D; + + if (Double.isNaN(d0)) + { + d0 = 4.0D; + } + + d0 = d0 * 64.0D; + return distance < d0 * d0; + } + + public EntityEnderEye(World worldIn, double x, double y, double z) + { + super(worldIn); + this.despawnTimer = 0; + this.setSize(0.25F, 0.25F); + this.setPosition(x, y, z); + } + + public void moveTowards(BlockPos p_180465_1_) + { + double d0 = (double)p_180465_1_.getX(); + int i = p_180465_1_.getY(); + double d1 = (double)p_180465_1_.getZ(); + double d2 = d0 - this.posX; + double d3 = d1 - this.posZ; + float f = MathHelper.sqrt_double(d2 * d2 + d3 * d3); + + if (f > 12.0F) + { + this.targetX = this.posX + d2 / (double)f * 12.0D; + this.targetZ = this.posZ + d3 / (double)f * 12.0D; + this.targetY = this.posY + 8.0D; + } + else + { + this.targetX = d0; + this.targetY = (double)i; + this.targetZ = d1; + } + + this.despawnTimer = 0; + this.shatterOrDrop = this.rand.nextInt(5) > 0; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double x, double y, double z) + { + this.motionX = x; + this.motionY = y; + this.motionZ = z; + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float f = MathHelper.sqrt_double(x * x + z * z); + this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.func_181159_b(x, z) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.func_181159_b(y, (double)f) * 180.0D / Math.PI); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + super.onUpdate(); + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(MathHelper.func_181159_b(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float)(MathHelper.func_181159_b(this.motionY, (double)f) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + + if (!this.worldObj.isRemote) + { + double d0 = this.targetX - this.posX; + double d1 = this.targetZ - this.posZ; + float f1 = (float)Math.sqrt(d0 * d0 + d1 * d1); + float f2 = (float)MathHelper.func_181159_b(d1, d0); + double d2 = (double)f + (double)(f1 - f) * 0.0025D; + + if (f1 < 1.0F) + { + d2 *= 0.8D; + this.motionY *= 0.8D; + } + + this.motionX = Math.cos((double)f2) * d2; + this.motionZ = Math.sin((double)f2) * d2; + + if (this.posY < this.targetY) + { + this.motionY += (1.0D - this.motionY) * 0.014999999664723873D; + } + else + { + this.motionY += (-1.0D - this.motionY) * 0.014999999664723873D; + } + } + + float f3 = 0.25F; + + if (this.isInWater()) + { + for (int i = 0; i < 4; ++i) + { + this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ, new int[0]); + } + } + else + { + this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, this.posX - this.motionX * (double)f3 + this.rand.nextDouble() * 0.6D - 0.3D, this.posY - this.motionY * (double)f3 - 0.5D, this.posZ - this.motionZ * (double)f3 + this.rand.nextDouble() * 0.6D - 0.3D, this.motionX, this.motionY, this.motionZ, new int[0]); + } + + if (!this.worldObj.isRemote) + { + this.setPosition(this.posX, this.posY, this.posZ); + ++this.despawnTimer; + + if (this.despawnTimer > 80 && !this.worldObj.isRemote) + { + this.setDead(); + + if (this.shatterOrDrop) + { + this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Items.ender_eye))); + } + else + { + this.worldObj.playAuxSFX(2003, new BlockPos(this), 0); + } + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float partialTicks) + { + return 1.0F; + } + + public int getBrightnessForRender(float partialTicks) + { + return 15728880; + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityEnderPearl.java b/src/minecraft/net/minecraft/entity/item/EntityEnderPearl.java new file mode 100644 index 0000000..6cb5402 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityEnderPearl.java @@ -0,0 +1,108 @@ +package net.minecraft.entity.item; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityEndermite; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.projectile.EntityThrowable; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class EntityEnderPearl extends EntityThrowable +{ + private EntityLivingBase field_181555_c; + + public EntityEnderPearl(World p_i46455_1_) + { + super(p_i46455_1_); + } + + public EntityEnderPearl(World worldIn, EntityLivingBase p_i1783_2_) + { + super(worldIn, p_i1783_2_); + this.field_181555_c = p_i1783_2_; + } + + public EntityEnderPearl(World worldIn, double p_i1784_2_, double p_i1784_4_, double p_i1784_6_) + { + super(worldIn, p_i1784_2_, p_i1784_4_, p_i1784_6_); + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected void onImpact(MovingObjectPosition p_70184_1_) + { + EntityLivingBase entitylivingbase = this.getThrower(); + + if (p_70184_1_.entityHit != null) + { + if (p_70184_1_.entityHit == this.field_181555_c) + { + return; + } + + p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, entitylivingbase), 0.0F); + } + + for (int i = 0; i < 32; ++i) + { + this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian(), new int[0]); + } + + if (!this.worldObj.isRemote) + { + if (entitylivingbase instanceof EntityPlayerMP) + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)entitylivingbase; + + if (entityplayermp.playerNetServerHandler.getNetworkManager().isChannelOpen() && entityplayermp.worldObj == this.worldObj && !entityplayermp.isPlayerSleeping()) + { + if (this.rand.nextFloat() < 0.05F && this.worldObj.getGameRules().getBoolean("doMobSpawning")) + { + EntityEndermite entityendermite = new EntityEndermite(this.worldObj); + entityendermite.setSpawnedByPlayer(true); + entityendermite.setLocationAndAngles(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ, entitylivingbase.rotationYaw, entitylivingbase.rotationPitch); + this.worldObj.spawnEntityInWorld(entityendermite); + } + + if (entitylivingbase.isRiding()) + { + entitylivingbase.mountEntity((Entity)null); + } + + entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ); + entitylivingbase.fallDistance = 0.0F; + entitylivingbase.attackEntityFrom(DamageSource.fall, 5.0F); + } + } + else if (entitylivingbase != null) + { + entitylivingbase.setPositionAndUpdate(this.posX, this.posY, this.posZ); + entitylivingbase.fallDistance = 0.0F; + } + + this.setDead(); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + EntityLivingBase entitylivingbase = this.getThrower(); + + if (entitylivingbase != null && entitylivingbase instanceof EntityPlayer && !entitylivingbase.isEntityAlive()) + { + this.setDead(); + } + else + { + super.onUpdate(); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityExpBottle.java b/src/minecraft/net/minecraft/entity/item/EntityExpBottle.java new file mode 100644 index 0000000..73fbcd6 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityExpBottle.java @@ -0,0 +1,64 @@ +package net.minecraft.entity.item; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.projectile.EntityThrowable; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class EntityExpBottle extends EntityThrowable +{ + public EntityExpBottle(World worldIn) + { + super(worldIn); + } + + public EntityExpBottle(World worldIn, EntityLivingBase p_i1786_2_) + { + super(worldIn, p_i1786_2_); + } + + public EntityExpBottle(World worldIn, double p_i1787_2_, double p_i1787_4_, double p_i1787_6_) + { + super(worldIn, p_i1787_2_, p_i1787_4_, p_i1787_6_); + } + + /** + * Gets the amount of gravity to apply to the thrown entity with each tick. + */ + protected float getGravityVelocity() + { + return 0.07F; + } + + protected float getVelocity() + { + return 0.7F; + } + + protected float getInaccuracy() + { + return -20.0F; + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected void onImpact(MovingObjectPosition p_70184_1_) + { + if (!this.worldObj.isRemote) + { + this.worldObj.playAuxSFX(2002, new BlockPos(this), 0); + int i = 3 + this.worldObj.rand.nextInt(5) + this.worldObj.rand.nextInt(5); + + while (i > 0) + { + int j = EntityXPOrb.getXPSplit(i); + i -= j; + this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); + } + + this.setDead(); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityFallingBlock.java b/src/minecraft/net/minecraft/entity/item/EntityFallingBlock.java new file mode 100644 index 0000000..bc5113d --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityFallingBlock.java @@ -0,0 +1,324 @@ +package net.minecraft.entity.item; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockAnvil; +import net.minecraft.block.BlockFalling; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class EntityFallingBlock extends Entity +{ + private IBlockState fallTile; + public int fallTime; + public boolean shouldDropItem = true; + private boolean canSetAsBlock; + private boolean hurtEntities; + private int fallHurtMax = 40; + private float fallHurtAmount = 2.0F; + public NBTTagCompound tileEntityData; + + public EntityFallingBlock(World worldIn) + { + super(worldIn); + } + + public EntityFallingBlock(World worldIn, double x, double y, double z, IBlockState fallingBlockState) + { + super(worldIn); + this.fallTile = fallingBlockState; + this.preventEntitySpawning = true; + this.setSize(0.98F, 0.98F); + this.setPosition(x, y, z); + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.prevPosX = x; + this.prevPosY = y; + this.prevPosZ = z; + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + protected void entityInit() + { + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return !this.isDead; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + Block block = this.fallTile.getBlock(); + + if (block.getMaterial() == Material.air) + { + this.setDead(); + } + else + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.fallTime++ == 0) + { + BlockPos blockpos = new BlockPos(this); + + if (this.worldObj.getBlockState(blockpos).getBlock() == block) + { + this.worldObj.setBlockToAir(blockpos); + } + else if (!this.worldObj.isRemote) + { + this.setDead(); + return; + } + } + + this.motionY -= 0.03999999910593033D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + + if (!this.worldObj.isRemote) + { + BlockPos blockpos1 = new BlockPos(this); + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + this.motionY *= -0.5D; + + if (this.worldObj.getBlockState(blockpos1).getBlock() != Blocks.piston_extension) + { + this.setDead(); + + if (!this.canSetAsBlock) + { + if (this.worldObj.canBlockBePlaced(block, blockpos1, true, EnumFacing.UP, (Entity)null, (ItemStack)null) && !BlockFalling.canFallInto(this.worldObj, blockpos1.down()) && this.worldObj.setBlockState(blockpos1, this.fallTile, 3)) + { + if (block instanceof BlockFalling) + { + ((BlockFalling)block).onEndFalling(this.worldObj, blockpos1); + } + + if (this.tileEntityData != null && block instanceof ITileEntityProvider) + { + TileEntity tileentity = this.worldObj.getTileEntity(blockpos1); + + if (tileentity != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + tileentity.writeToNBT(nbttagcompound); + + for (String s : this.tileEntityData.getKeySet()) + { + NBTBase nbtbase = this.tileEntityData.getTag(s); + + if (!s.equals("x") && !s.equals("y") && !s.equals("z")) + { + nbttagcompound.setTag(s, nbtbase.copy()); + } + } + + tileentity.readFromNBT(nbttagcompound); + tileentity.markDirty(); + } + } + } + else if (this.shouldDropItem && this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + this.entityDropItem(new ItemStack(block, 1, block.damageDropped(this.fallTile)), 0.0F); + } + } + } + } + else if (this.fallTime > 100 && !this.worldObj.isRemote && (blockpos1.getY() < 1 || blockpos1.getY() > 256) || this.fallTime > 600) + { + if (this.shouldDropItem && this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + this.entityDropItem(new ItemStack(block, 1, block.damageDropped(this.fallTile)), 0.0F); + } + + this.setDead(); + } + } + } + } + + public void fall(float distance, float damageMultiplier) + { + Block block = this.fallTile.getBlock(); + + if (this.hurtEntities) + { + int i = MathHelper.ceiling_float_int(distance - 1.0F); + + if (i > 0) + { + List list = Lists.newArrayList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox())); + boolean flag = block == Blocks.anvil; + DamageSource damagesource = flag ? DamageSource.anvil : DamageSource.fallingBlock; + + for (Entity entity : list) + { + entity.attackEntityFrom(damagesource, (float)Math.min(MathHelper.floor_float((float)i * this.fallHurtAmount), this.fallHurtMax)); + } + + if (flag && (double)this.rand.nextFloat() < 0.05000000074505806D + (double)i * 0.05D) + { + int j = ((Integer)this.fallTile.getValue(BlockAnvil.DAMAGE)).intValue(); + ++j; + + if (j > 2) + { + this.canSetAsBlock = true; + } + else + { + this.fallTile = this.fallTile.withProperty(BlockAnvil.DAMAGE, Integer.valueOf(j)); + } + } + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + Block block = this.fallTile != null ? this.fallTile.getBlock() : Blocks.air; + ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(block); + tagCompound.setString("Block", resourcelocation == null ? "" : resourcelocation.toString()); + tagCompound.setByte("Data", (byte)block.getMetaFromState(this.fallTile)); + tagCompound.setByte("Time", (byte)this.fallTime); + tagCompound.setBoolean("DropItem", this.shouldDropItem); + tagCompound.setBoolean("HurtEntities", this.hurtEntities); + tagCompound.setFloat("FallHurtAmount", this.fallHurtAmount); + tagCompound.setInteger("FallHurtMax", this.fallHurtMax); + + if (this.tileEntityData != null) + { + tagCompound.setTag("TileEntityData", this.tileEntityData); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + int i = tagCompund.getByte("Data") & 255; + + if (tagCompund.hasKey("Block", 8)) + { + this.fallTile = Block.getBlockFromName(tagCompund.getString("Block")).getStateFromMeta(i); + } + else if (tagCompund.hasKey("TileID", 99)) + { + this.fallTile = Block.getBlockById(tagCompund.getInteger("TileID")).getStateFromMeta(i); + } + else + { + this.fallTile = Block.getBlockById(tagCompund.getByte("Tile") & 255).getStateFromMeta(i); + } + + this.fallTime = tagCompund.getByte("Time") & 255; + Block block = this.fallTile.getBlock(); + + if (tagCompund.hasKey("HurtEntities", 99)) + { + this.hurtEntities = tagCompund.getBoolean("HurtEntities"); + this.fallHurtAmount = tagCompund.getFloat("FallHurtAmount"); + this.fallHurtMax = tagCompund.getInteger("FallHurtMax"); + } + else if (block == Blocks.anvil) + { + this.hurtEntities = true; + } + + if (tagCompund.hasKey("DropItem", 99)) + { + this.shouldDropItem = tagCompund.getBoolean("DropItem"); + } + + if (tagCompund.hasKey("TileEntityData", 10)) + { + this.tileEntityData = tagCompund.getCompoundTag("TileEntityData"); + } + + if (block == null || block.getMaterial() == Material.air) + { + this.fallTile = Blocks.sand.getDefaultState(); + } + } + + public World getWorldObj() + { + return this.worldObj; + } + + public void setHurtEntities(boolean p_145806_1_) + { + this.hurtEntities = p_145806_1_; + } + + /** + * Return whether this entity should be rendered as on fire. + */ + public boolean canRenderOnFire() + { + return false; + } + + public void addEntityCrashInfo(CrashReportCategory category) + { + super.addEntityCrashInfo(category); + + if (this.fallTile != null) + { + Block block = this.fallTile.getBlock(); + category.addCrashSection("Immitating block ID", Integer.valueOf(Block.getIdFromBlock(block))); + category.addCrashSection("Immitating block data", Integer.valueOf(block.getMetaFromState(this.fallTile))); + } + } + + public IBlockState getBlock() + { + return this.fallTile; + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityFireworkRocket.java b/src/minecraft/net/minecraft/entity/item/EntityFireworkRocket.java new file mode 100644 index 0000000..962ac82 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityFireworkRocket.java @@ -0,0 +1,216 @@ +package net.minecraft.entity.item; + +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityFireworkRocket extends Entity +{ + /** The age of the firework in ticks. */ + private int fireworkAge; + + /** + * The lifetime of the firework in ticks. When the age reaches the lifetime the firework explodes. + */ + private int lifetime; + + public EntityFireworkRocket(World worldIn) + { + super(worldIn); + this.setSize(0.25F, 0.25F); + } + + protected void entityInit() + { + this.dataWatcher.addObjectByDataType(8, 5); + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double distance) + { + return distance < 4096.0D; + } + + public EntityFireworkRocket(World worldIn, double x, double y, double z, ItemStack givenItem) + { + super(worldIn); + this.fireworkAge = 0; + this.setSize(0.25F, 0.25F); + this.setPosition(x, y, z); + int i = 1; + + if (givenItem != null && givenItem.hasTagCompound()) + { + this.dataWatcher.updateObject(8, givenItem); + NBTTagCompound nbttagcompound = givenItem.getTagCompound(); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Fireworks"); + + if (nbttagcompound1 != null) + { + i += nbttagcompound1.getByte("Flight"); + } + } + + this.motionX = this.rand.nextGaussian() * 0.001D; + this.motionZ = this.rand.nextGaussian() * 0.001D; + this.motionY = 0.05D; + this.lifetime = 10 * i + this.rand.nextInt(6) + this.rand.nextInt(7); + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double x, double y, double z) + { + this.motionX = x; + this.motionY = y; + this.motionZ = z; + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float f = MathHelper.sqrt_double(x * x + z * z); + this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.func_181159_b(x, z) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.func_181159_b(y, (double)f) * 180.0D / Math.PI); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + super.onUpdate(); + this.motionX *= 1.15D; + this.motionZ *= 1.15D; + this.motionY += 0.04D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(MathHelper.func_181159_b(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float)(MathHelper.func_181159_b(this.motionY, (double)f) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + + if (this.fireworkAge == 0 && !this.isSilent()) + { + this.worldObj.playSoundAtEntity(this, "fireworks.launch", 3.0F, 1.0F); + } + + ++this.fireworkAge; + + if (this.worldObj.isRemote && this.fireworkAge % 2 < 2) + { + this.worldObj.spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, this.posX, this.posY - 0.3D, this.posZ, this.rand.nextGaussian() * 0.05D, -this.motionY * 0.5D, this.rand.nextGaussian() * 0.05D, new int[0]); + } + + if (!this.worldObj.isRemote && this.fireworkAge > this.lifetime) + { + this.worldObj.setEntityState(this, (byte)17); + this.setDead(); + } + } + + public void handleStatusUpdate(byte id) + { + if (id == 17 && this.worldObj.isRemote) + { + ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8); + NBTTagCompound nbttagcompound = null; + + if (itemstack != null && itemstack.hasTagCompound()) + { + nbttagcompound = itemstack.getTagCompound().getCompoundTag("Fireworks"); + } + + this.worldObj.makeFireworks(this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, nbttagcompound); + } + + super.handleStatusUpdate(id); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + tagCompound.setInteger("Life", this.fireworkAge); + tagCompound.setInteger("LifeTime", this.lifetime); + ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8); + + if (itemstack != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + itemstack.writeToNBT(nbttagcompound); + tagCompound.setTag("FireworksItem", nbttagcompound); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + this.fireworkAge = tagCompund.getInteger("Life"); + this.lifetime = tagCompund.getInteger("LifeTime"); + NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("FireworksItem"); + + if (nbttagcompound != null) + { + ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound); + + if (itemstack != null) + { + this.dataWatcher.updateObject(8, itemstack); + } + } + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float partialTicks) + { + return super.getBrightness(partialTicks); + } + + public int getBrightnessForRender(float partialTicks) + { + return super.getBrightnessForRender(partialTicks); + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityItem.java b/src/minecraft/net/minecraft/entity/item/EntityItem.java new file mode 100644 index 0000000..abac5fa --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityItem.java @@ -0,0 +1,543 @@ +package net.minecraft.entity.item; + +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class EntityItem extends Entity +{ + private static final Logger logger = LogManager.getLogger(); + + /** + * The age of this EntityItem (used to animate it up and down as well as expire it) + */ + private int age; + private int delayBeforeCanPickup; + + /** The health of this EntityItem. (For example, damage for tools) */ + private int health; + private String thrower; + private String owner; + + /** The EntityItem's random initial float height. */ + public float hoverStart; + + public EntityItem(World worldIn, double x, double y, double z) + { + super(worldIn); + this.health = 5; + this.hoverStart = (float)(Math.random() * Math.PI * 2.0D); + this.setSize(0.25F, 0.25F); + this.setPosition(x, y, z); + this.rotationYaw = (float)(Math.random() * 360.0D); + this.motionX = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D)); + this.motionY = 0.20000000298023224D; + this.motionZ = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D)); + } + + public EntityItem(World worldIn, double x, double y, double z, ItemStack stack) + { + this(worldIn, x, y, z); + this.setEntityItemStack(stack); + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + public EntityItem(World worldIn) + { + super(worldIn); + this.health = 5; + this.hoverStart = (float)(Math.random() * Math.PI * 2.0D); + this.setSize(0.25F, 0.25F); + this.setEntityItemStack(new ItemStack(Blocks.air, 0)); + } + + protected void entityInit() + { + this.getDataWatcher().addObjectByDataType(10, 5); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (this.getEntityItem() == null) + { + this.setDead(); + } + else + { + super.onUpdate(); + + if (this.delayBeforeCanPickup > 0 && this.delayBeforeCanPickup != 32767) + { + --this.delayBeforeCanPickup; + } + + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= 0.03999999910593033D; + this.noClip = this.pushOutOfBlocks(this.posX, (this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY) / 2.0D, this.posZ); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + boolean flag = (int)this.prevPosX != (int)this.posX || (int)this.prevPosY != (int)this.posY || (int)this.prevPosZ != (int)this.posZ; + + if (flag || this.ticksExisted % 25 == 0) + { + if (this.worldObj.getBlockState(new BlockPos(this)).getBlock().getMaterial() == Material.lava) + { + this.motionY = 0.20000000298023224D; + this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F); + } + + if (!this.worldObj.isRemote) + { + this.searchForOtherItemsNearby(); + } + } + + float f = 0.98F; + + if (this.onGround) + { + f = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.98F; + } + + this.motionX *= (double)f; + this.motionY *= 0.9800000190734863D; + this.motionZ *= (double)f; + + if (this.onGround) + { + this.motionY *= -0.5D; + } + + if (this.age != -32768) + { + ++this.age; + } + + this.handleWaterMovement(); + + if (!this.worldObj.isRemote && this.age >= 6000) + { + this.setDead(); + } + } + } + + /** + * Looks for other itemstacks nearby and tries to stack them together + */ + private void searchForOtherItemsNearby() + { + for (EntityItem entityitem : this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.getEntityBoundingBox().expand(0.5D, 0.0D, 0.5D))) + { + this.combineItems(entityitem); + } + } + + /** + * Tries to merge this item with the item passed as the parameter. Returns true if successful. Either this item or + * the other item will be removed from the world. + */ + private boolean combineItems(EntityItem other) + { + if (other == this) + { + return false; + } + else if (other.isEntityAlive() && this.isEntityAlive()) + { + ItemStack itemstack = this.getEntityItem(); + ItemStack itemstack1 = other.getEntityItem(); + + if (this.delayBeforeCanPickup != 32767 && other.delayBeforeCanPickup != 32767) + { + if (this.age != -32768 && other.age != -32768) + { + if (itemstack1.getItem() != itemstack.getItem()) + { + return false; + } + else if (itemstack1.hasTagCompound() ^ itemstack.hasTagCompound()) + { + return false; + } + else if (itemstack1.hasTagCompound() && !itemstack1.getTagCompound().equals(itemstack.getTagCompound())) + { + return false; + } + else if (itemstack1.getItem() == null) + { + return false; + } + else if (itemstack1.getItem().getHasSubtypes() && itemstack1.getMetadata() != itemstack.getMetadata()) + { + return false; + } + else if (itemstack1.stackSize < itemstack.stackSize) + { + return other.combineItems(this); + } + else if (itemstack1.stackSize + itemstack.stackSize > itemstack1.getMaxStackSize()) + { + return false; + } + else + { + itemstack1.stackSize += itemstack.stackSize; + other.delayBeforeCanPickup = Math.max(other.delayBeforeCanPickup, this.delayBeforeCanPickup); + other.age = Math.min(other.age, this.age); + other.setEntityItemStack(itemstack1); + this.setDead(); + return true; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + + /** + * sets the age of the item so that it'll despawn one minute after it has been dropped (instead of five). Used when + * items are dropped from players in creative mode + */ + public void setAgeToCreativeDespawnTime() + { + this.age = 4800; + } + + /** + * Returns if this entity is in water and will end up adding the waters velocity to the entity + */ + public boolean handleWaterMovement() + { + if (this.worldObj.handleMaterialAcceleration(this.getEntityBoundingBox(), Material.water, this)) + { + if (!this.inWater && !this.firstUpdate) + { + this.resetHeight(); + } + + this.inWater = true; + } + else + { + this.inWater = false; + } + + return this.inWater; + } + + /** + * Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args: + * amountDamage + */ + protected void dealFireDamage(int amount) + { + this.attackEntityFrom(DamageSource.inFire, (float)amount); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else if (this.getEntityItem() != null && this.getEntityItem().getItem() == Items.nether_star && source.isExplosion()) + { + return false; + } + else + { + this.setBeenAttacked(); + this.health = (int)((float)this.health - amount); + + if (this.health <= 0) + { + this.setDead(); + } + + return false; + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + tagCompound.setShort("Health", (short)((byte)this.health)); + tagCompound.setShort("Age", (short)this.age); + tagCompound.setShort("PickupDelay", (short)this.delayBeforeCanPickup); + + if (this.getThrower() != null) + { + tagCompound.setString("Thrower", this.thrower); + } + + if (this.getOwner() != null) + { + tagCompound.setString("Owner", this.owner); + } + + if (this.getEntityItem() != null) + { + tagCompound.setTag("Item", this.getEntityItem().writeToNBT(new NBTTagCompound())); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + this.health = tagCompund.getShort("Health") & 255; + this.age = tagCompund.getShort("Age"); + + if (tagCompund.hasKey("PickupDelay")) + { + this.delayBeforeCanPickup = tagCompund.getShort("PickupDelay"); + } + + if (tagCompund.hasKey("Owner")) + { + this.owner = tagCompund.getString("Owner"); + } + + if (tagCompund.hasKey("Thrower")) + { + this.thrower = tagCompund.getString("Thrower"); + } + + NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item"); + this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound)); + + if (this.getEntityItem() == null) + { + this.setDead(); + } + } + + /** + * Called by a player entity when they collide with an entity + */ + public void onCollideWithPlayer(EntityPlayer entityIn) + { + if (!this.worldObj.isRemote) + { + ItemStack itemstack = this.getEntityItem(); + int i = itemstack.stackSize; + + if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack)) + { + if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log)) + { + entityIn.triggerAchievement(AchievementList.mineWood); + } + + if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log2)) + { + entityIn.triggerAchievement(AchievementList.mineWood); + } + + if (itemstack.getItem() == Items.leather) + { + entityIn.triggerAchievement(AchievementList.killCow); + } + + if (itemstack.getItem() == Items.diamond) + { + entityIn.triggerAchievement(AchievementList.diamonds); + } + + if (itemstack.getItem() == Items.blaze_rod) + { + entityIn.triggerAchievement(AchievementList.blazeRod); + } + + if (itemstack.getItem() == Items.diamond && this.getThrower() != null) + { + EntityPlayer entityplayer = this.worldObj.getPlayerEntityByName(this.getThrower()); + + if (entityplayer != null && entityplayer != entityIn) + { + entityplayer.triggerAchievement(AchievementList.diamondsToYou); + } + } + + if (!this.isSilent()) + { + this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + } + + entityIn.onItemPickup(this, i); + + if (itemstack.stackSize <= 0) + { + this.setDead(); + } + } + } + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.hasCustomName() ? this.getCustomNameTag() : StatCollector.translateToLocal("item." + this.getEntityItem().getUnlocalizedName()); + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } + + /** + * Teleports the entity to another dimension. Params: Dimension number to teleport to + */ + public void travelToDimension(int dimensionId) + { + super.travelToDimension(dimensionId); + + if (!this.worldObj.isRemote) + { + this.searchForOtherItemsNearby(); + } + } + + /** + * Returns the ItemStack corresponding to the Entity (Note: if no item exists, will log an error but still return an + * ItemStack containing Block.stone) + */ + public ItemStack getEntityItem() + { + ItemStack itemstack = this.getDataWatcher().getWatchableObjectItemStack(10); + + if (itemstack == null) + { + if (this.worldObj != null) + { + logger.error("Item entity " + this.getEntityId() + " has no item?!"); + } + + return new ItemStack(Blocks.stone); + } + else + { + return itemstack; + } + } + + /** + * Sets the ItemStack for this entity + */ + public void setEntityItemStack(ItemStack stack) + { + this.getDataWatcher().updateObject(10, stack); + this.getDataWatcher().setObjectWatched(10); + } + + public String getOwner() + { + return this.owner; + } + + public void setOwner(String owner) + { + this.owner = owner; + } + + public String getThrower() + { + return this.thrower; + } + + public void setThrower(String thrower) + { + this.thrower = thrower; + } + + public int getAge() + { + return this.age; + } + + public void setDefaultPickupDelay() + { + this.delayBeforeCanPickup = 10; + } + + public void setNoPickupDelay() + { + this.delayBeforeCanPickup = 0; + } + + public void setInfinitePickupDelay() + { + this.delayBeforeCanPickup = 32767; + } + + public void setPickupDelay(int ticks) + { + this.delayBeforeCanPickup = ticks; + } + + public boolean cannotPickup() + { + return this.delayBeforeCanPickup > 0; + } + + public void setNoDespawn() + { + this.age = -6000; + } + + public void func_174870_v() + { + this.setInfinitePickupDelay(); + this.age = 5999; + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityItemFrame.java b/src/minecraft/net/minecraft/entity/item/EntityItemFrame.java new file mode 100644 index 0000000..4e414e8 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityItemFrame.java @@ -0,0 +1,269 @@ +package net.minecraft.entity.item; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityHanging; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemMap; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; +import net.minecraft.world.storage.MapData; + +public class EntityItemFrame extends EntityHanging +{ + /** Chance for this item frame's item to drop from the frame. */ + private float itemDropChance = 1.0F; + + public EntityItemFrame(World worldIn) + { + super(worldIn); + } + + public EntityItemFrame(World worldIn, BlockPos p_i45852_2_, EnumFacing p_i45852_3_) + { + super(worldIn, p_i45852_2_); + this.updateFacingWithBoundingBox(p_i45852_3_); + } + + protected void entityInit() + { + this.getDataWatcher().addObjectByDataType(8, 5); + this.getDataWatcher().addObject(9, Byte.valueOf((byte)0)); + } + + public float getCollisionBorderSize() + { + return 0.0F; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else if (!source.isExplosion() && this.getDisplayedItem() != null) + { + if (!this.worldObj.isRemote) + { + this.dropItemOrSelf(source.getEntity(), false); + this.setDisplayedItem((ItemStack)null); + } + + return true; + } + else + { + return super.attackEntityFrom(source, amount); + } + } + + public int getWidthPixels() + { + return 12; + } + + public int getHeightPixels() + { + return 12; + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double distance) + { + double d0 = 16.0D; + d0 = d0 * 64.0D * this.renderDistanceWeight; + return distance < d0 * d0; + } + + /** + * Called when this entity is broken. Entity parameter may be null. + */ + public void onBroken(Entity brokenEntity) + { + this.dropItemOrSelf(brokenEntity, true); + } + + public void dropItemOrSelf(Entity p_146065_1_, boolean p_146065_2_) + { + if (this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + ItemStack itemstack = this.getDisplayedItem(); + + if (p_146065_1_ instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)p_146065_1_; + + if (entityplayer.capabilities.isCreativeMode) + { + this.removeFrameFromMap(itemstack); + return; + } + } + + if (p_146065_2_) + { + this.entityDropItem(new ItemStack(Items.item_frame), 0.0F); + } + + if (itemstack != null && this.rand.nextFloat() < this.itemDropChance) + { + itemstack = itemstack.copy(); + this.removeFrameFromMap(itemstack); + this.entityDropItem(itemstack, 0.0F); + } + } + } + + /** + * Removes the dot representing this frame's position from the map when the item frame is broken. + */ + private void removeFrameFromMap(ItemStack p_110131_1_) + { + if (p_110131_1_ != null) + { + if (p_110131_1_.getItem() == Items.filled_map) + { + MapData mapdata = ((ItemMap)p_110131_1_.getItem()).getMapData(p_110131_1_, this.worldObj); + mapdata.mapDecorations.remove("frame-" + this.getEntityId()); + } + + p_110131_1_.setItemFrame((EntityItemFrame)null); + } + } + + public ItemStack getDisplayedItem() + { + return this.getDataWatcher().getWatchableObjectItemStack(8); + } + + public void setDisplayedItem(ItemStack p_82334_1_) + { + this.setDisplayedItemWithUpdate(p_82334_1_, true); + } + + private void setDisplayedItemWithUpdate(ItemStack p_174864_1_, boolean p_174864_2_) + { + if (p_174864_1_ != null) + { + p_174864_1_ = p_174864_1_.copy(); + p_174864_1_.stackSize = 1; + p_174864_1_.setItemFrame(this); + } + + this.getDataWatcher().updateObject(8, p_174864_1_); + this.getDataWatcher().setObjectWatched(8); + + if (p_174864_2_ && this.hangingPosition != null) + { + this.worldObj.updateComparatorOutputLevel(this.hangingPosition, Blocks.air); + } + } + + /** + * Return the rotation of the item currently on this frame. + */ + public int getRotation() + { + return this.getDataWatcher().getWatchableObjectByte(9); + } + + public void setItemRotation(int p_82336_1_) + { + this.func_174865_a(p_82336_1_, true); + } + + private void func_174865_a(int p_174865_1_, boolean p_174865_2_) + { + this.getDataWatcher().updateObject(9, Byte.valueOf((byte)(p_174865_1_ % 8))); + + if (p_174865_2_ && this.hangingPosition != null) + { + this.worldObj.updateComparatorOutputLevel(this.hangingPosition, Blocks.air); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + if (this.getDisplayedItem() != null) + { + tagCompound.setTag("Item", this.getDisplayedItem().writeToNBT(new NBTTagCompound())); + tagCompound.setByte("ItemRotation", (byte)this.getRotation()); + tagCompound.setFloat("ItemDropChance", this.itemDropChance); + } + + super.writeEntityToNBT(tagCompound); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item"); + + if (nbttagcompound != null && !nbttagcompound.hasNoTags()) + { + this.setDisplayedItemWithUpdate(ItemStack.loadItemStackFromNBT(nbttagcompound), false); + this.func_174865_a(tagCompund.getByte("ItemRotation"), false); + + if (tagCompund.hasKey("ItemDropChance", 99)) + { + this.itemDropChance = tagCompund.getFloat("ItemDropChance"); + } + + if (tagCompund.hasKey("Direction")) + { + this.func_174865_a(this.getRotation() * 2, false); + } + } + + super.readEntityFromNBT(tagCompund); + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer playerIn) + { + if (this.getDisplayedItem() == null) + { + ItemStack itemstack = playerIn.getHeldItem(); + + if (itemstack != null && !this.worldObj.isRemote) + { + this.setDisplayedItem(itemstack); + + if (!playerIn.capabilities.isCreativeMode && --itemstack.stackSize <= 0) + { + playerIn.inventory.setInventorySlotContents(playerIn.inventory.currentItem, (ItemStack)null); + } + } + } + else if (!this.worldObj.isRemote) + { + this.setItemRotation(this.getRotation() + 1); + } + + return true; + } + + public int func_174866_q() + { + return this.getDisplayedItem() == null ? 0 : this.getRotation() % 8 + 1; + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityMinecart.java b/src/minecraft/net/minecraft/entity/item/EntityMinecart.java new file mode 100644 index 0000000..8e3c998 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityMinecart.java @@ -0,0 +1,1180 @@ +package net.minecraft.entity.item; + +import com.google.common.collect.Maps; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.block.BlockRailBase; +import net.minecraft.block.BlockRailPowered; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EntityMinecartCommandBlock; +import net.minecraft.entity.ai.EntityMinecartMobSpawner; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.world.IWorldNameable; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public abstract class EntityMinecart extends Entity implements IWorldNameable +{ + private boolean isInReverse; + private String entityName; + + /** Minecart rotational logic matrix */ + private static final int[][][] matrix = new int[][][] {{{0, 0, -1}, {0, 0, 1}}, {{ -1, 0, 0}, {1, 0, 0}}, {{ -1, -1, 0}, {1, 0, 0}}, {{ -1, 0, 0}, {1, -1, 0}}, {{0, 0, -1}, {0, -1, 1}}, {{0, -1, -1}, {0, 0, 1}}, {{0, 0, 1}, {1, 0, 0}}, {{0, 0, 1}, { -1, 0, 0}}, {{0, 0, -1}, { -1, 0, 0}}, {{0, 0, -1}, {1, 0, 0}}}; + + /** appears to be the progress of the turn */ + private int turnProgress; + private double minecartX; + private double minecartY; + private double minecartZ; + private double minecartYaw; + private double minecartPitch; + private double velocityX; + private double velocityY; + private double velocityZ; + + public EntityMinecart(World worldIn) + { + super(worldIn); + this.preventEntitySpawning = true; + this.setSize(0.98F, 0.7F); + } + + public static EntityMinecart func_180458_a(World worldIn, double p_180458_1_, double p_180458_3_, double p_180458_5_, EntityMinecart.EnumMinecartType p_180458_7_) + { + switch (p_180458_7_) + { + case CHEST: + return new EntityMinecartChest(worldIn, p_180458_1_, p_180458_3_, p_180458_5_); + + case FURNACE: + return new EntityMinecartFurnace(worldIn, p_180458_1_, p_180458_3_, p_180458_5_); + + case TNT: + return new EntityMinecartTNT(worldIn, p_180458_1_, p_180458_3_, p_180458_5_); + + case SPAWNER: + return new EntityMinecartMobSpawner(worldIn, p_180458_1_, p_180458_3_, p_180458_5_); + + case HOPPER: + return new EntityMinecartHopper(worldIn, p_180458_1_, p_180458_3_, p_180458_5_); + + case COMMAND_BLOCK: + return new EntityMinecartCommandBlock(worldIn, p_180458_1_, p_180458_3_, p_180458_5_); + + default: + return new EntityMinecartEmpty(worldIn, p_180458_1_, p_180458_3_, p_180458_5_); + } + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + protected void entityInit() + { + this.dataWatcher.addObject(17, new Integer(0)); + this.dataWatcher.addObject(18, new Integer(1)); + this.dataWatcher.addObject(19, new Float(0.0F)); + this.dataWatcher.addObject(20, new Integer(0)); + this.dataWatcher.addObject(21, new Integer(6)); + this.dataWatcher.addObject(22, Byte.valueOf((byte)0)); + } + + /** + * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be + * pushable on contact, like boats or minecarts. + */ + public AxisAlignedBB getCollisionBox(Entity entityIn) + { + return entityIn.canBePushed() ? entityIn.getEntityBoundingBox() : null; + } + + /** + * Returns the collision bounding box for this entity + */ + public AxisAlignedBB getCollisionBoundingBox() + { + return null; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return true; + } + + public EntityMinecart(World worldIn, double x, double y, double z) + { + this(worldIn); + this.setPosition(x, y, z); + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.prevPosX = x; + this.prevPosY = y; + this.prevPosZ = z; + } + + /** + * Returns the Y offset from the entity's position for any entity riding this one. + */ + public double getMountedYOffset() + { + return 0.0D; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (!this.worldObj.isRemote && !this.isDead) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + this.setRollingDirection(-this.getRollingDirection()); + this.setRollingAmplitude(10); + this.setBeenAttacked(); + this.setDamage(this.getDamage() + amount * 10.0F); + boolean flag = source.getEntity() instanceof EntityPlayer && ((EntityPlayer)source.getEntity()).capabilities.isCreativeMode; + + if (flag || this.getDamage() > 40.0F) + { + if (this.riddenByEntity != null) + { + this.riddenByEntity.mountEntity((Entity)null); + } + + if (flag && !this.hasCustomName()) + { + this.setDead(); + } + else + { + this.killMinecart(source); + } + } + + return true; + } + } + else + { + return true; + } + } + + public void killMinecart(DamageSource p_94095_1_) + { + this.setDead(); + + if (this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + ItemStack itemstack = new ItemStack(Items.minecart, 1); + + if (this.entityName != null) + { + itemstack.setStackDisplayName(this.entityName); + } + + this.entityDropItem(itemstack, 0.0F); + } + } + + /** + * Setups the entity to do the hurt animation. Only used by packets in multiplayer. + */ + public void performHurtAnimation() + { + this.setRollingDirection(-this.getRollingDirection()); + this.setRollingAmplitude(10); + this.setDamage(this.getDamage() + this.getDamage() * 10.0F); + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return !this.isDead; + } + + /** + * Will get destroyed next tick. + */ + public void setDead() + { + super.setDead(); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (this.getRollingAmplitude() > 0) + { + this.setRollingAmplitude(this.getRollingAmplitude() - 1); + } + + if (this.getDamage() > 0.0F) + { + this.setDamage(this.getDamage() - 1.0F); + } + + if (this.posY < -64.0D) + { + this.kill(); + } + + if (!this.worldObj.isRemote && this.worldObj instanceof WorldServer) + { + this.worldObj.theProfiler.startSection("portal"); + MinecraftServer minecraftserver = ((WorldServer)this.worldObj).getMinecraftServer(); + int i = this.getMaxInPortalTime(); + + if (this.inPortal) + { + if (minecraftserver.getAllowNether()) + { + if (this.ridingEntity == null && this.portalCounter++ >= i) + { + this.portalCounter = i; + this.timeUntilPortal = this.getPortalCooldown(); + int j; + + if (this.worldObj.provider.getDimensionId() == -1) + { + j = 0; + } + else + { + j = -1; + } + + this.travelToDimension(j); + } + + this.inPortal = false; + } + } + else + { + if (this.portalCounter > 0) + { + this.portalCounter -= 4; + } + + if (this.portalCounter < 0) + { + this.portalCounter = 0; + } + } + + if (this.timeUntilPortal > 0) + { + --this.timeUntilPortal; + } + + this.worldObj.theProfiler.endSection(); + } + + if (this.worldObj.isRemote) + { + if (this.turnProgress > 0) + { + double d4 = this.posX + (this.minecartX - this.posX) / (double)this.turnProgress; + double d5 = this.posY + (this.minecartY - this.posY) / (double)this.turnProgress; + double d6 = this.posZ + (this.minecartZ - this.posZ) / (double)this.turnProgress; + double d1 = MathHelper.wrapAngleTo180_double(this.minecartYaw - (double)this.rotationYaw); + this.rotationYaw = (float)((double)this.rotationYaw + d1 / (double)this.turnProgress); + this.rotationPitch = (float)((double)this.rotationPitch + (this.minecartPitch - (double)this.rotationPitch) / (double)this.turnProgress); + --this.turnProgress; + this.setPosition(d4, d5, d6); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + else + { + this.setPosition(this.posX, this.posY, this.posZ); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + } + else + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= 0.03999999910593033D; + int k = MathHelper.floor_double(this.posX); + int l = MathHelper.floor_double(this.posY); + int i1 = MathHelper.floor_double(this.posZ); + + if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(k, l - 1, i1))) + { + --l; + } + + BlockPos blockpos = new BlockPos(k, l, i1); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + + if (BlockRailBase.isRailBlock(iblockstate)) + { + this.func_180460_a(blockpos, iblockstate); + + if (iblockstate.getBlock() == Blocks.activator_rail) + { + this.onActivatorRailPass(k, l, i1, ((Boolean)iblockstate.getValue(BlockRailPowered.POWERED)).booleanValue()); + } + } + else + { + this.moveDerailedMinecart(); + } + + this.doBlockCollisions(); + this.rotationPitch = 0.0F; + double d0 = this.prevPosX - this.posX; + double d2 = this.prevPosZ - this.posZ; + + if (d0 * d0 + d2 * d2 > 0.001D) + { + this.rotationYaw = (float)(MathHelper.func_181159_b(d2, d0) * 180.0D / Math.PI); + + if (this.isInReverse) + { + this.rotationYaw += 180.0F; + } + } + + double d3 = (double)MathHelper.wrapAngleTo180_float(this.rotationYaw - this.prevRotationYaw); + + if (d3 < -170.0D || d3 >= 170.0D) + { + this.rotationYaw += 180.0F; + this.isInReverse = !this.isInReverse; + } + + this.setRotation(this.rotationYaw, this.rotationPitch); + + for (Entity entity : this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D))) + { + if (entity != this.riddenByEntity && entity.canBePushed() && entity instanceof EntityMinecart) + { + entity.applyEntityCollision(this); + } + } + + if (this.riddenByEntity != null && this.riddenByEntity.isDead) + { + if (this.riddenByEntity.ridingEntity == this) + { + this.riddenByEntity.ridingEntity = null; + } + + this.riddenByEntity = null; + } + + this.handleWaterMovement(); + } + } + + /** + * Get's the maximum speed for a minecart + */ + protected double getMaximumSpeed() + { + return 0.4D; + } + + /** + * Called every tick the minecart is on an activator rail. Args: x, y, z, is the rail receiving power + */ + public void onActivatorRailPass(int x, int y, int z, boolean receivingPower) + { + } + + /** + * Moves a minecart that is not attached to a rail + */ + protected void moveDerailedMinecart() + { + double d0 = this.getMaximumSpeed(); + this.motionX = MathHelper.clamp_double(this.motionX, -d0, d0); + this.motionZ = MathHelper.clamp_double(this.motionZ, -d0, d0); + + if (this.onGround) + { + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (!this.onGround) + { + this.motionX *= 0.949999988079071D; + this.motionY *= 0.949999988079071D; + this.motionZ *= 0.949999988079071D; + } + } + + @SuppressWarnings("incomplete-switch") + protected void func_180460_a(BlockPos p_180460_1_, IBlockState p_180460_2_) + { + this.fallDistance = 0.0F; + Vec3 vec3 = this.func_70489_a(this.posX, this.posY, this.posZ); + this.posY = (double)p_180460_1_.getY(); + boolean flag = false; + boolean flag1 = false; + BlockRailBase blockrailbase = (BlockRailBase)p_180460_2_.getBlock(); + + if (blockrailbase == Blocks.golden_rail) + { + flag = ((Boolean)p_180460_2_.getValue(BlockRailPowered.POWERED)).booleanValue(); + flag1 = !flag; + } + + double d0 = 0.0078125D; + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)p_180460_2_.getValue(blockrailbase.getShapeProperty()); + + switch (blockrailbase$enumraildirection) + { + case ASCENDING_EAST: + this.motionX -= 0.0078125D; + ++this.posY; + break; + + case ASCENDING_WEST: + this.motionX += 0.0078125D; + ++this.posY; + break; + + case ASCENDING_NORTH: + this.motionZ += 0.0078125D; + ++this.posY; + break; + + case ASCENDING_SOUTH: + this.motionZ -= 0.0078125D; + ++this.posY; + } + + int[][] aint = matrix[blockrailbase$enumraildirection.getMetadata()]; + double d1 = (double)(aint[1][0] - aint[0][0]); + double d2 = (double)(aint[1][2] - aint[0][2]); + double d3 = Math.sqrt(d1 * d1 + d2 * d2); + double d4 = this.motionX * d1 + this.motionZ * d2; + + if (d4 < 0.0D) + { + d1 = -d1; + d2 = -d2; + } + + double d5 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (d5 > 2.0D) + { + d5 = 2.0D; + } + + this.motionX = d5 * d1 / d3; + this.motionZ = d5 * d2 / d3; + + if (this.riddenByEntity instanceof EntityLivingBase) + { + double d6 = (double)((EntityLivingBase)this.riddenByEntity).moveForward; + + if (d6 > 0.0D) + { + double d7 = -Math.sin((double)(this.riddenByEntity.rotationYaw * (float)Math.PI / 180.0F)); + double d8 = Math.cos((double)(this.riddenByEntity.rotationYaw * (float)Math.PI / 180.0F)); + double d9 = this.motionX * this.motionX + this.motionZ * this.motionZ; + + if (d9 < 0.01D) + { + this.motionX += d7 * 0.1D; + this.motionZ += d8 * 0.1D; + flag1 = false; + } + } + } + + if (flag1) + { + double d17 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (d17 < 0.03D) + { + this.motionX *= 0.0D; + this.motionY *= 0.0D; + this.motionZ *= 0.0D; + } + else + { + this.motionX *= 0.5D; + this.motionY *= 0.0D; + this.motionZ *= 0.5D; + } + } + + double d18 = 0.0D; + double d19 = (double)p_180460_1_.getX() + 0.5D + (double)aint[0][0] * 0.5D; + double d20 = (double)p_180460_1_.getZ() + 0.5D + (double)aint[0][2] * 0.5D; + double d21 = (double)p_180460_1_.getX() + 0.5D + (double)aint[1][0] * 0.5D; + double d10 = (double)p_180460_1_.getZ() + 0.5D + (double)aint[1][2] * 0.5D; + d1 = d21 - d19; + d2 = d10 - d20; + + if (d1 == 0.0D) + { + this.posX = (double)p_180460_1_.getX() + 0.5D; + d18 = this.posZ - (double)p_180460_1_.getZ(); + } + else if (d2 == 0.0D) + { + this.posZ = (double)p_180460_1_.getZ() + 0.5D; + d18 = this.posX - (double)p_180460_1_.getX(); + } + else + { + double d11 = this.posX - d19; + double d12 = this.posZ - d20; + d18 = (d11 * d1 + d12 * d2) * 2.0D; + } + + this.posX = d19 + d1 * d18; + this.posZ = d20 + d2 * d18; + this.setPosition(this.posX, this.posY, this.posZ); + double d22 = this.motionX; + double d23 = this.motionZ; + + if (this.riddenByEntity != null) + { + d22 *= 0.75D; + d23 *= 0.75D; + } + + double d13 = this.getMaximumSpeed(); + d22 = MathHelper.clamp_double(d22, -d13, d13); + d23 = MathHelper.clamp_double(d23, -d13, d13); + this.moveEntity(d22, 0.0D, d23); + + if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[0][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[0][2]) + { + this.setPosition(this.posX, this.posY + (double)aint[0][1], this.posZ); + } + else if (aint[1][1] != 0 && MathHelper.floor_double(this.posX) - p_180460_1_.getX() == aint[1][0] && MathHelper.floor_double(this.posZ) - p_180460_1_.getZ() == aint[1][2]) + { + this.setPosition(this.posX, this.posY + (double)aint[1][1], this.posZ); + } + + this.applyDrag(); + Vec3 vec31 = this.func_70489_a(this.posX, this.posY, this.posZ); + + if (vec31 != null && vec3 != null) + { + double d14 = (vec3.yCoord - vec31.yCoord) * 0.05D; + d5 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (d5 > 0.0D) + { + this.motionX = this.motionX / d5 * (d5 + d14); + this.motionZ = this.motionZ / d5 * (d5 + d14); + } + + this.setPosition(this.posX, vec31.yCoord, this.posZ); + } + + int j = MathHelper.floor_double(this.posX); + int i = MathHelper.floor_double(this.posZ); + + if (j != p_180460_1_.getX() || i != p_180460_1_.getZ()) + { + d5 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.motionX = d5 * (double)(j - p_180460_1_.getX()); + this.motionZ = d5 * (double)(i - p_180460_1_.getZ()); + } + + if (flag) + { + double d15 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (d15 > 0.01D) + { + double d16 = 0.06D; + this.motionX += this.motionX / d15 * d16; + this.motionZ += this.motionZ / d15 * d16; + } + else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST) + { + if (this.worldObj.getBlockState(p_180460_1_.west()).getBlock().isNormalCube()) + { + this.motionX = 0.02D; + } + else if (this.worldObj.getBlockState(p_180460_1_.east()).getBlock().isNormalCube()) + { + this.motionX = -0.02D; + } + } + else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH) + { + if (this.worldObj.getBlockState(p_180460_1_.north()).getBlock().isNormalCube()) + { + this.motionZ = 0.02D; + } + else if (this.worldObj.getBlockState(p_180460_1_.south()).getBlock().isNormalCube()) + { + this.motionZ = -0.02D; + } + } + } + } + + protected void applyDrag() + { + if (this.riddenByEntity != null) + { + this.motionX *= 0.996999979019165D; + this.motionY *= 0.0D; + this.motionZ *= 0.996999979019165D; + } + else + { + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.0D; + this.motionZ *= 0.9599999785423279D; + } + } + + /** + * Sets the x,y,z of the entity from the given parameters. Also seems to set up a bounding box. + */ + public void setPosition(double x, double y, double z) + { + this.posX = x; + this.posY = y; + this.posZ = z; + float f = this.width / 2.0F; + float f1 = this.height; + this.setEntityBoundingBox(new AxisAlignedBB(x - (double)f, y, z - (double)f, x + (double)f, y + (double)f1, z + (double)f)); + } + + public Vec3 func_70495_a(double p_70495_1_, double p_70495_3_, double p_70495_5_, double p_70495_7_) + { + int i = MathHelper.floor_double(p_70495_1_); + int j = MathHelper.floor_double(p_70495_3_); + int k = MathHelper.floor_double(p_70495_5_); + + if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(i, j - 1, k))) + { + --j; + } + + IBlockState iblockstate = this.worldObj.getBlockState(new BlockPos(i, j, k)); + + if (BlockRailBase.isRailBlock(iblockstate)) + { + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()); + p_70495_3_ = (double)j; + + if (blockrailbase$enumraildirection.isAscending()) + { + p_70495_3_ = (double)(j + 1); + } + + int[][] aint = matrix[blockrailbase$enumraildirection.getMetadata()]; + double d0 = (double)(aint[1][0] - aint[0][0]); + double d1 = (double)(aint[1][2] - aint[0][2]); + double d2 = Math.sqrt(d0 * d0 + d1 * d1); + d0 = d0 / d2; + d1 = d1 / d2; + p_70495_1_ = p_70495_1_ + d0 * p_70495_7_; + p_70495_5_ = p_70495_5_ + d1 * p_70495_7_; + + if (aint[0][1] != 0 && MathHelper.floor_double(p_70495_1_) - i == aint[0][0] && MathHelper.floor_double(p_70495_5_) - k == aint[0][2]) + { + p_70495_3_ += (double)aint[0][1]; + } + else if (aint[1][1] != 0 && MathHelper.floor_double(p_70495_1_) - i == aint[1][0] && MathHelper.floor_double(p_70495_5_) - k == aint[1][2]) + { + p_70495_3_ += (double)aint[1][1]; + } + + return this.func_70489_a(p_70495_1_, p_70495_3_, p_70495_5_); + } + else + { + return null; + } + } + + public Vec3 func_70489_a(double p_70489_1_, double p_70489_3_, double p_70489_5_) + { + int i = MathHelper.floor_double(p_70489_1_); + int j = MathHelper.floor_double(p_70489_3_); + int k = MathHelper.floor_double(p_70489_5_); + + if (BlockRailBase.isRailBlock(this.worldObj, new BlockPos(i, j - 1, k))) + { + --j; + } + + IBlockState iblockstate = this.worldObj.getBlockState(new BlockPos(i, j, k)); + + if (BlockRailBase.isRailBlock(iblockstate)) + { + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()); + int[][] aint = matrix[blockrailbase$enumraildirection.getMetadata()]; + double d0 = 0.0D; + double d1 = (double)i + 0.5D + (double)aint[0][0] * 0.5D; + double d2 = (double)j + 0.0625D + (double)aint[0][1] * 0.5D; + double d3 = (double)k + 0.5D + (double)aint[0][2] * 0.5D; + double d4 = (double)i + 0.5D + (double)aint[1][0] * 0.5D; + double d5 = (double)j + 0.0625D + (double)aint[1][1] * 0.5D; + double d6 = (double)k + 0.5D + (double)aint[1][2] * 0.5D; + double d7 = d4 - d1; + double d8 = (d5 - d2) * 2.0D; + double d9 = d6 - d3; + + if (d7 == 0.0D) + { + p_70489_1_ = (double)i + 0.5D; + d0 = p_70489_5_ - (double)k; + } + else if (d9 == 0.0D) + { + p_70489_5_ = (double)k + 0.5D; + d0 = p_70489_1_ - (double)i; + } + else + { + double d10 = p_70489_1_ - d1; + double d11 = p_70489_5_ - d3; + d0 = (d10 * d7 + d11 * d9) * 2.0D; + } + + p_70489_1_ = d1 + d7 * d0; + p_70489_3_ = d2 + d8 * d0; + p_70489_5_ = d3 + d9 * d0; + + if (d8 < 0.0D) + { + ++p_70489_3_; + } + + if (d8 > 0.0D) + { + p_70489_3_ += 0.5D; + } + + return new Vec3(p_70489_1_, p_70489_3_, p_70489_5_); + } + else + { + return null; + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + if (tagCompund.getBoolean("CustomDisplayTile")) + { + int i = tagCompund.getInteger("DisplayData"); + + if (tagCompund.hasKey("DisplayTile", 8)) + { + Block block = Block.getBlockFromName(tagCompund.getString("DisplayTile")); + + if (block == null) + { + this.func_174899_a(Blocks.air.getDefaultState()); + } + else + { + this.func_174899_a(block.getStateFromMeta(i)); + } + } + else + { + Block block1 = Block.getBlockById(tagCompund.getInteger("DisplayTile")); + + if (block1 == null) + { + this.func_174899_a(Blocks.air.getDefaultState()); + } + else + { + this.func_174899_a(block1.getStateFromMeta(i)); + } + } + + this.setDisplayTileOffset(tagCompund.getInteger("DisplayOffset")); + } + + if (tagCompund.hasKey("CustomName", 8) && tagCompund.getString("CustomName").length() > 0) + { + this.entityName = tagCompund.getString("CustomName"); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + if (this.hasDisplayTile()) + { + tagCompound.setBoolean("CustomDisplayTile", true); + IBlockState iblockstate = this.getDisplayTile(); + ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(iblockstate.getBlock()); + tagCompound.setString("DisplayTile", resourcelocation == null ? "" : resourcelocation.toString()); + tagCompound.setInteger("DisplayData", iblockstate.getBlock().getMetaFromState(iblockstate)); + tagCompound.setInteger("DisplayOffset", this.getDisplayTileOffset()); + } + + if (this.entityName != null && this.entityName.length() > 0) + { + tagCompound.setString("CustomName", this.entityName); + } + } + + /** + * Applies a velocity to each of the entities pushing them away from each other. Args: entity + */ + public void applyEntityCollision(Entity entityIn) + { + if (!this.worldObj.isRemote) + { + if (!entityIn.noClip && !this.noClip) + { + if (entityIn != this.riddenByEntity) + { + if (entityIn instanceof EntityLivingBase && !(entityIn instanceof EntityPlayer) && !(entityIn instanceof EntityIronGolem) && this.getMinecartType() == EntityMinecart.EnumMinecartType.RIDEABLE && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && entityIn.ridingEntity == null) + { + entityIn.mountEntity(this); + } + + double d0 = entityIn.posX - this.posX; + double d1 = entityIn.posZ - this.posZ; + double d2 = d0 * d0 + d1 * d1; + + if (d2 >= 9.999999747378752E-5D) + { + d2 = (double)MathHelper.sqrt_double(d2); + d0 = d0 / d2; + d1 = d1 / d2; + double d3 = 1.0D / d2; + + if (d3 > 1.0D) + { + d3 = 1.0D; + } + + d0 = d0 * d3; + d1 = d1 * d3; + d0 = d0 * 0.10000000149011612D; + d1 = d1 * 0.10000000149011612D; + d0 = d0 * (double)(1.0F - this.entityCollisionReduction); + d1 = d1 * (double)(1.0F - this.entityCollisionReduction); + d0 = d0 * 0.5D; + d1 = d1 * 0.5D; + + if (entityIn instanceof EntityMinecart) + { + double d4 = entityIn.posX - this.posX; + double d5 = entityIn.posZ - this.posZ; + Vec3 vec3 = (new Vec3(d4, 0.0D, d5)).normalize(); + Vec3 vec31 = (new Vec3((double)MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F), 0.0D, (double)MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F))).normalize(); + double d6 = Math.abs(vec3.dotProduct(vec31)); + + if (d6 < 0.800000011920929D) + { + return; + } + + double d7 = entityIn.motionX + this.motionX; + double d8 = entityIn.motionZ + this.motionZ; + + if (((EntityMinecart)entityIn).getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE) + { + this.motionX *= 0.20000000298023224D; + this.motionZ *= 0.20000000298023224D; + this.addVelocity(entityIn.motionX - d0, 0.0D, entityIn.motionZ - d1); + entityIn.motionX *= 0.949999988079071D; + entityIn.motionZ *= 0.949999988079071D; + } + else if (((EntityMinecart)entityIn).getMinecartType() != EntityMinecart.EnumMinecartType.FURNACE && this.getMinecartType() == EntityMinecart.EnumMinecartType.FURNACE) + { + entityIn.motionX *= 0.20000000298023224D; + entityIn.motionZ *= 0.20000000298023224D; + entityIn.addVelocity(this.motionX + d0, 0.0D, this.motionZ + d1); + this.motionX *= 0.949999988079071D; + this.motionZ *= 0.949999988079071D; + } + else + { + d7 = d7 / 2.0D; + d8 = d8 / 2.0D; + this.motionX *= 0.20000000298023224D; + this.motionZ *= 0.20000000298023224D; + this.addVelocity(d7 - d0, 0.0D, d8 - d1); + entityIn.motionX *= 0.20000000298023224D; + entityIn.motionZ *= 0.20000000298023224D; + entityIn.addVelocity(d7 + d0, 0.0D, d8 + d1); + } + } + else + { + this.addVelocity(-d0, 0.0D, -d1); + entityIn.addVelocity(d0 / 4.0D, 0.0D, d1 / 4.0D); + } + } + } + } + } + } + + public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + { + this.minecartX = x; + this.minecartY = y; + this.minecartZ = z; + this.minecartYaw = (double)yaw; + this.minecartPitch = (double)pitch; + this.turnProgress = posRotationIncrements + 2; + this.motionX = this.velocityX; + this.motionY = this.velocityY; + this.motionZ = this.velocityZ; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double x, double y, double z) + { + this.velocityX = this.motionX = x; + this.velocityY = this.motionY = y; + this.velocityZ = this.motionZ = z; + } + + /** + * Sets the current amount of damage the minecart has taken. Decreases over time. The cart breaks when this is over + * 40. + */ + public void setDamage(float p_70492_1_) + { + this.dataWatcher.updateObject(19, Float.valueOf(p_70492_1_)); + } + + /** + * Gets the current amount of damage the minecart has taken. Decreases over time. The cart breaks when this is over + * 40. + */ + public float getDamage() + { + return this.dataWatcher.getWatchableObjectFloat(19); + } + + /** + * Sets the rolling amplitude the cart rolls while being attacked. + */ + public void setRollingAmplitude(int p_70497_1_) + { + this.dataWatcher.updateObject(17, Integer.valueOf(p_70497_1_)); + } + + /** + * Gets the rolling amplitude the cart rolls while being attacked. + */ + public int getRollingAmplitude() + { + return this.dataWatcher.getWatchableObjectInt(17); + } + + /** + * Sets the rolling direction the cart rolls while being attacked. Can be 1 or -1. + */ + public void setRollingDirection(int p_70494_1_) + { + this.dataWatcher.updateObject(18, Integer.valueOf(p_70494_1_)); + } + + /** + * Gets the rolling direction the cart rolls while being attacked. Can be 1 or -1. + */ + public int getRollingDirection() + { + return this.dataWatcher.getWatchableObjectInt(18); + } + + public abstract EntityMinecart.EnumMinecartType getMinecartType(); + + public IBlockState getDisplayTile() + { + return !this.hasDisplayTile() ? this.getDefaultDisplayTile() : Block.getStateById(this.getDataWatcher().getWatchableObjectInt(20)); + } + + public IBlockState getDefaultDisplayTile() + { + return Blocks.air.getDefaultState(); + } + + public int getDisplayTileOffset() + { + return !this.hasDisplayTile() ? this.getDefaultDisplayTileOffset() : this.getDataWatcher().getWatchableObjectInt(21); + } + + public int getDefaultDisplayTileOffset() + { + return 6; + } + + public void func_174899_a(IBlockState p_174899_1_) + { + this.getDataWatcher().updateObject(20, Integer.valueOf(Block.getStateId(p_174899_1_))); + this.setHasDisplayTile(true); + } + + public void setDisplayTileOffset(int p_94086_1_) + { + this.getDataWatcher().updateObject(21, Integer.valueOf(p_94086_1_)); + this.setHasDisplayTile(true); + } + + public boolean hasDisplayTile() + { + return this.getDataWatcher().getWatchableObjectByte(22) == 1; + } + + public void setHasDisplayTile(boolean p_94096_1_) + { + this.getDataWatcher().updateObject(22, Byte.valueOf((byte)(p_94096_1_ ? 1 : 0))); + } + + /** + * Sets the custom name tag for this entity + */ + public void setCustomNameTag(String name) + { + this.entityName = name; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.entityName != null ? this.entityName : super.getName(); + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return this.entityName != null; + } + + public String getCustomNameTag() + { + return this.entityName; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + if (this.hasCustomName()) + { + ChatComponentText chatcomponenttext = new ChatComponentText(this.entityName); + chatcomponenttext.getChatStyle().setChatHoverEvent(this.getHoverEvent()); + chatcomponenttext.getChatStyle().setInsertion(this.getUniqueID().toString()); + return chatcomponenttext; + } + else + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(this.getName(), new Object[0]); + chatcomponenttranslation.getChatStyle().setChatHoverEvent(this.getHoverEvent()); + chatcomponenttranslation.getChatStyle().setInsertion(this.getUniqueID().toString()); + return chatcomponenttranslation; + } + } + + public static enum EnumMinecartType + { + RIDEABLE(0, "MinecartRideable"), + CHEST(1, "MinecartChest"), + FURNACE(2, "MinecartFurnace"), + TNT(3, "MinecartTNT"), + SPAWNER(4, "MinecartSpawner"), + HOPPER(5, "MinecartHopper"), + COMMAND_BLOCK(6, "MinecartCommandBlock"); + + private static final Map ID_LOOKUP = Maps.newHashMap(); + private final int networkID; + private final String name; + + private EnumMinecartType(int networkID, String name) + { + this.networkID = networkID; + this.name = name; + } + + public int getNetworkID() + { + return this.networkID; + } + + public String getName() + { + return this.name; + } + + public static EntityMinecart.EnumMinecartType byNetworkID(int id) + { + EntityMinecart.EnumMinecartType entityminecart$enumminecarttype = (EntityMinecart.EnumMinecartType)ID_LOOKUP.get(Integer.valueOf(id)); + return entityminecart$enumminecarttype == null ? RIDEABLE : entityminecart$enumminecarttype; + } + + static { + for (EntityMinecart.EnumMinecartType entityminecart$enumminecarttype : values()) + { + ID_LOOKUP.put(Integer.valueOf(entityminecart$enumminecarttype.getNetworkID()), entityminecart$enumminecarttype); + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityMinecartChest.java b/src/minecraft/net/minecraft/entity/item/EntityMinecartChest.java new file mode 100644 index 0000000..84ecb3d --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityMinecartChest.java @@ -0,0 +1,69 @@ +package net.minecraft.entity.item; + +import net.minecraft.block.BlockChest; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.item.Item; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class EntityMinecartChest extends EntityMinecartContainer +{ + public EntityMinecartChest(World worldIn) + { + super(worldIn); + } + + public EntityMinecartChest(World worldIn, double p_i1715_2_, double p_i1715_4_, double p_i1715_6_) + { + super(worldIn, p_i1715_2_, p_i1715_4_, p_i1715_6_); + } + + public void killMinecart(DamageSource p_94095_1_) + { + super.killMinecart(p_94095_1_); + + if (this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + this.dropItemWithOffset(Item.getItemFromBlock(Blocks.chest), 1, 0.0F); + } + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return 27; + } + + public EntityMinecart.EnumMinecartType getMinecartType() + { + return EntityMinecart.EnumMinecartType.CHEST; + } + + public IBlockState getDefaultDisplayTile() + { + return Blocks.chest.getDefaultState().withProperty(BlockChest.FACING, EnumFacing.NORTH); + } + + public int getDefaultDisplayTileOffset() + { + return 8; + } + + public String getGuiID() + { + return "minecraft:chest"; + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + return new ContainerChest(playerInventory, this, playerIn); + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java b/src/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java new file mode 100644 index 0000000..2fa1136 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityMinecartContainer.java @@ -0,0 +1,283 @@ +package net.minecraft.entity.item; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryHelper; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.DamageSource; +import net.minecraft.world.ILockableContainer; +import net.minecraft.world.LockCode; +import net.minecraft.world.World; + +public abstract class EntityMinecartContainer extends EntityMinecart implements ILockableContainer +{ + private ItemStack[] minecartContainerItems = new ItemStack[36]; + + /** + * When set to true, the minecart will drop all items when setDead() is called. When false (such as when travelling + * dimensions) it preserves its contents. + */ + private boolean dropContentsWhenDead = true; + + public EntityMinecartContainer(World worldIn) + { + super(worldIn); + } + + public EntityMinecartContainer(World worldIn, double p_i1717_2_, double p_i1717_4_, double p_i1717_6_) + { + super(worldIn, p_i1717_2_, p_i1717_4_, p_i1717_6_); + } + + public void killMinecart(DamageSource p_94095_1_) + { + super.killMinecart(p_94095_1_); + + if (this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + InventoryHelper.func_180176_a(this.worldObj, this, this); + } + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + return this.minecartContainerItems[index]; + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + if (this.minecartContainerItems[index] != null) + { + if (this.minecartContainerItems[index].stackSize <= count) + { + ItemStack itemstack1 = this.minecartContainerItems[index]; + this.minecartContainerItems[index] = null; + return itemstack1; + } + else + { + ItemStack itemstack = this.minecartContainerItems[index].splitStack(count); + + if (this.minecartContainerItems[index].stackSize == 0) + { + this.minecartContainerItems[index] = null; + } + + return itemstack; + } + } + else + { + return null; + } + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + if (this.minecartContainerItems[index] != null) + { + ItemStack itemstack = this.minecartContainerItems[index]; + this.minecartContainerItems[index] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + this.minecartContainerItems[index] = stack; + + if (stack != null && stack.stackSize > this.getInventoryStackLimit()) + { + stack.stackSize = this.getInventoryStackLimit(); + } + } + + /** + * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it + * hasn't changed and skip it. + */ + public void markDirty() + { + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.isDead ? false : player.getDistanceSqToEntity(this) <= 64.0D; + } + + public void openInventory(EntityPlayer player) + { + } + + public void closeInventory(EntityPlayer player) + { + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return true; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.hasCustomName() ? this.getCustomNameTag() : "container.minecart"; + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Teleports the entity to another dimension. Params: Dimension number to teleport to + */ + public void travelToDimension(int dimensionId) + { + this.dropContentsWhenDead = false; + super.travelToDimension(dimensionId); + } + + /** + * Will get destroyed next tick. + */ + public void setDead() + { + if (this.dropContentsWhenDead) + { + InventoryHelper.func_180176_a(this.worldObj, this, this); + } + + super.setDead(); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.minecartContainerItems.length; ++i) + { + if (this.minecartContainerItems[i] != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Slot", (byte)i); + this.minecartContainerItems[i].writeToNBT(nbttagcompound); + nbttaglist.appendTag(nbttagcompound); + } + } + + tagCompound.setTag("Items", nbttaglist); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + NBTTagList nbttaglist = tagCompund.getTagList("Items", 10); + this.minecartContainerItems = new ItemStack[this.getSizeInventory()]; + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound.getByte("Slot") & 255; + + if (j >= 0 && j < this.minecartContainerItems.length) + { + this.minecartContainerItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound); + } + } + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer playerIn) + { + if (!this.worldObj.isRemote) + { + playerIn.displayGUIChest(this); + } + + return true; + } + + protected void applyDrag() + { + int i = 15 - Container.calcRedstoneFromInventory(this); + float f = 0.98F + (float)i * 0.001F; + this.motionX *= (double)f; + this.motionY *= 0.0D; + this.motionZ *= (double)f; + } + + public int getField(int id) + { + return 0; + } + + public void setField(int id, int value) + { + } + + public int getFieldCount() + { + return 0; + } + + public boolean isLocked() + { + return false; + } + + public void setLockCode(LockCode code) + { + } + + public LockCode getLockCode() + { + return LockCode.EMPTY_CODE; + } + + public void clear() + { + for (int i = 0; i < this.minecartContainerItems.length; ++i) + { + this.minecartContainerItems[i] = null; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java b/src/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java new file mode 100644 index 0000000..7da4e28 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityMinecartEmpty.java @@ -0,0 +1,69 @@ +package net.minecraft.entity.item; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +public class EntityMinecartEmpty extends EntityMinecart +{ + public EntityMinecartEmpty(World worldIn) + { + super(worldIn); + } + + public EntityMinecartEmpty(World worldIn, double p_i1723_2_, double p_i1723_4_, double p_i1723_6_) + { + super(worldIn, p_i1723_2_, p_i1723_4_, p_i1723_6_); + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer playerIn) + { + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn) + { + return true; + } + else if (this.riddenByEntity != null && this.riddenByEntity != playerIn) + { + return false; + } + else + { + if (!this.worldObj.isRemote) + { + playerIn.mountEntity(this); + } + + return true; + } + } + + /** + * Called every tick the minecart is on an activator rail. Args: x, y, z, is the rail receiving power + */ + public void onActivatorRailPass(int x, int y, int z, boolean receivingPower) + { + if (receivingPower) + { + if (this.riddenByEntity != null) + { + this.riddenByEntity.mountEntity((Entity)null); + } + + if (this.getRollingAmplitude() == 0) + { + this.setRollingDirection(-this.getRollingDirection()); + this.setRollingAmplitude(10); + this.setDamage(50.0F); + this.setBeenAttacked(); + } + } + } + + public EntityMinecart.EnumMinecartType getMinecartType() + { + return EntityMinecart.EnumMinecartType.RIDEABLE; + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java b/src/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java new file mode 100644 index 0000000..2d0063d --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityMinecartFurnace.java @@ -0,0 +1,203 @@ +package net.minecraft.entity.item; + +import net.minecraft.block.BlockFurnace; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityMinecartFurnace extends EntityMinecart +{ + private int fuel; + public double pushX; + public double pushZ; + + public EntityMinecartFurnace(World worldIn) + { + super(worldIn); + } + + public EntityMinecartFurnace(World worldIn, double p_i1719_2_, double p_i1719_4_, double p_i1719_6_) + { + super(worldIn, p_i1719_2_, p_i1719_4_, p_i1719_6_); + } + + public EntityMinecart.EnumMinecartType getMinecartType() + { + return EntityMinecart.EnumMinecartType.FURNACE; + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)0)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.fuel > 0) + { + --this.fuel; + } + + if (this.fuel <= 0) + { + this.pushX = this.pushZ = 0.0D; + } + + this.setMinecartPowered(this.fuel > 0); + + if (this.isMinecartPowered() && this.rand.nextInt(4) == 0) + { + this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + /** + * Get's the maximum speed for a minecart + */ + protected double getMaximumSpeed() + { + return 0.2D; + } + + public void killMinecart(DamageSource p_94095_1_) + { + super.killMinecart(p_94095_1_); + + if (!p_94095_1_.isExplosion() && this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + this.entityDropItem(new ItemStack(Blocks.furnace, 1), 0.0F); + } + } + + protected void func_180460_a(BlockPos p_180460_1_, IBlockState p_180460_2_) + { + super.func_180460_a(p_180460_1_, p_180460_2_); + double d0 = this.pushX * this.pushX + this.pushZ * this.pushZ; + + if (d0 > 1.0E-4D && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.001D) + { + d0 = (double)MathHelper.sqrt_double(d0); + this.pushX /= d0; + this.pushZ /= d0; + + if (this.pushX * this.motionX + this.pushZ * this.motionZ < 0.0D) + { + this.pushX = 0.0D; + this.pushZ = 0.0D; + } + else + { + double d1 = d0 / this.getMaximumSpeed(); + this.pushX *= d1; + this.pushZ *= d1; + } + } + } + + protected void applyDrag() + { + double d0 = this.pushX * this.pushX + this.pushZ * this.pushZ; + + if (d0 > 1.0E-4D) + { + d0 = (double)MathHelper.sqrt_double(d0); + this.pushX /= d0; + this.pushZ /= d0; + double d1 = 1.0D; + this.motionX *= 0.800000011920929D; + this.motionY *= 0.0D; + this.motionZ *= 0.800000011920929D; + this.motionX += this.pushX * d1; + this.motionZ += this.pushZ * d1; + } + else + { + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.0D; + this.motionZ *= 0.9800000190734863D; + } + + super.applyDrag(); + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer playerIn) + { + ItemStack itemstack = playerIn.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.coal) + { + if (!playerIn.capabilities.isCreativeMode && --itemstack.stackSize == 0) + { + playerIn.inventory.setInventorySlotContents(playerIn.inventory.currentItem, (ItemStack)null); + } + + this.fuel += 3600; + } + + this.pushX = this.posX - playerIn.posX; + this.pushZ = this.posZ - playerIn.posZ; + return true; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setDouble("PushX", this.pushX); + tagCompound.setDouble("PushZ", this.pushZ); + tagCompound.setShort("Fuel", (short)this.fuel); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.pushX = tagCompund.getDouble("PushX"); + this.pushZ = tagCompund.getDouble("PushZ"); + this.fuel = tagCompund.getShort("Fuel"); + } + + protected boolean isMinecartPowered() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + protected void setMinecartPowered(boolean p_94107_1_) + { + if (p_94107_1_) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(this.dataWatcher.getWatchableObjectByte(16) | 1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(this.dataWatcher.getWatchableObjectByte(16) & -2))); + } + } + + public IBlockState getDefaultDisplayTile() + { + return (this.isMinecartPowered() ? Blocks.lit_furnace : Blocks.furnace).getDefaultState().withProperty(BlockFurnace.FACING, EnumFacing.NORTH); + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java b/src/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java new file mode 100644 index 0000000..dec3752 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityMinecartHopper.java @@ -0,0 +1,238 @@ +package net.minecraft.entity.item; + +import java.util.List; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerHopper; +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.IHopper; +import net.minecraft.tileentity.TileEntityHopper; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntitySelectors; +import net.minecraft.world.World; + +public class EntityMinecartHopper extends EntityMinecartContainer implements IHopper +{ + /** Whether this hopper minecart is being blocked by an activator rail. */ + private boolean isBlocked = true; + private int transferTicker = -1; + private BlockPos field_174900_c = BlockPos.ORIGIN; + + public EntityMinecartHopper(World worldIn) + { + super(worldIn); + } + + public EntityMinecartHopper(World worldIn, double p_i1721_2_, double p_i1721_4_, double p_i1721_6_) + { + super(worldIn, p_i1721_2_, p_i1721_4_, p_i1721_6_); + } + + public EntityMinecart.EnumMinecartType getMinecartType() + { + return EntityMinecart.EnumMinecartType.HOPPER; + } + + public IBlockState getDefaultDisplayTile() + { + return Blocks.hopper.getDefaultState(); + } + + public int getDefaultDisplayTileOffset() + { + return 1; + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return 5; + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer playerIn) + { + if (!this.worldObj.isRemote) + { + playerIn.displayGUIChest(this); + } + + return true; + } + + /** + * Called every tick the minecart is on an activator rail. Args: x, y, z, is the rail receiving power + */ + public void onActivatorRailPass(int x, int y, int z, boolean receivingPower) + { + boolean flag = !receivingPower; + + if (flag != this.getBlocked()) + { + this.setBlocked(flag); + } + } + + /** + * Get whether this hopper minecart is being blocked by an activator rail. + */ + public boolean getBlocked() + { + return this.isBlocked; + } + + /** + * Set whether this hopper minecart is being blocked by an activator rail. + */ + public void setBlocked(boolean p_96110_1_) + { + this.isBlocked = p_96110_1_; + } + + /** + * Returns the worldObj for this tileEntity. + */ + public World getWorld() + { + return this.worldObj; + } + + /** + * Gets the world X position for this hopper entity. + */ + public double getXPos() + { + return this.posX; + } + + /** + * Gets the world Y position for this hopper entity. + */ + public double getYPos() + { + return this.posY + 0.5D; + } + + /** + * Gets the world Z position for this hopper entity. + */ + public double getZPos() + { + return this.posZ; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (!this.worldObj.isRemote && this.isEntityAlive() && this.getBlocked()) + { + BlockPos blockpos = new BlockPos(this); + + if (blockpos.equals(this.field_174900_c)) + { + --this.transferTicker; + } + else + { + this.setTransferTicker(0); + } + + if (!this.canTransfer()) + { + this.setTransferTicker(0); + + if (this.func_96112_aD()) + { + this.setTransferTicker(4); + this.markDirty(); + } + } + } + } + + public boolean func_96112_aD() + { + if (TileEntityHopper.captureDroppedItems(this)) + { + return true; + } + else + { + List list = this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.getEntityBoundingBox().expand(0.25D, 0.0D, 0.25D), EntitySelectors.selectAnything); + + if (list.size() > 0) + { + TileEntityHopper.putDropInInventoryAllSlots(this, (EntityItem)list.get(0)); + } + + return false; + } + } + + public void killMinecart(DamageSource p_94095_1_) + { + super.killMinecart(p_94095_1_); + + if (this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + this.dropItemWithOffset(Item.getItemFromBlock(Blocks.hopper), 1, 0.0F); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("TransferCooldown", this.transferTicker); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.transferTicker = tagCompund.getInteger("TransferCooldown"); + } + + /** + * Sets the transfer ticker, used to determine the delay between transfers. + */ + public void setTransferTicker(int p_98042_1_) + { + this.transferTicker = p_98042_1_; + } + + /** + * Returns whether the hopper cart can currently transfer an item. + */ + public boolean canTransfer() + { + return this.transferTicker > 0; + } + + public String getGuiID() + { + return "minecraft:hopper"; + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + return new ContainerHopper(playerInventory, this, playerIn); + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityMinecartTNT.java b/src/minecraft/net/minecraft/entity/item/EntityMinecartTNT.java new file mode 100644 index 0000000..2ab822e --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityMinecartTNT.java @@ -0,0 +1,225 @@ +package net.minecraft.entity.item; + +import net.minecraft.block.BlockRailBase; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; + +public class EntityMinecartTNT extends EntityMinecart +{ + private int minecartTNTFuse = -1; + + public EntityMinecartTNT(World worldIn) + { + super(worldIn); + } + + public EntityMinecartTNT(World worldIn, double p_i1728_2_, double p_i1728_4_, double p_i1728_6_) + { + super(worldIn, p_i1728_2_, p_i1728_4_, p_i1728_6_); + } + + public EntityMinecart.EnumMinecartType getMinecartType() + { + return EntityMinecart.EnumMinecartType.TNT; + } + + public IBlockState getDefaultDisplayTile() + { + return Blocks.tnt.getDefaultState(); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.minecartTNTFuse > 0) + { + --this.minecartTNTFuse; + this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); + } + else if (this.minecartTNTFuse == 0) + { + this.explodeCart(this.motionX * this.motionX + this.motionZ * this.motionZ); + } + + if (this.isCollidedHorizontally) + { + double d0 = this.motionX * this.motionX + this.motionZ * this.motionZ; + + if (d0 >= 0.009999999776482582D) + { + this.explodeCart(d0); + } + } + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + Entity entity = source.getSourceOfDamage(); + + if (entity instanceof EntityArrow) + { + EntityArrow entityarrow = (EntityArrow)entity; + + if (entityarrow.isBurning()) + { + this.explodeCart(entityarrow.motionX * entityarrow.motionX + entityarrow.motionY * entityarrow.motionY + entityarrow.motionZ * entityarrow.motionZ); + } + } + + return super.attackEntityFrom(source, amount); + } + + public void killMinecart(DamageSource p_94095_1_) + { + super.killMinecart(p_94095_1_); + double d0 = this.motionX * this.motionX + this.motionZ * this.motionZ; + + if (!p_94095_1_.isExplosion() && this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + this.entityDropItem(new ItemStack(Blocks.tnt, 1), 0.0F); + } + + if (p_94095_1_.isFireDamage() || p_94095_1_.isExplosion() || d0 >= 0.009999999776482582D) + { + this.explodeCart(d0); + } + } + + /** + * Makes the minecart explode. + */ + protected void explodeCart(double p_94103_1_) + { + if (!this.worldObj.isRemote) + { + double d0 = Math.sqrt(p_94103_1_); + + if (d0 > 5.0D) + { + d0 = 5.0D; + } + + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(4.0D + this.rand.nextDouble() * 1.5D * d0), true); + this.setDead(); + } + } + + public void fall(float distance, float damageMultiplier) + { + if (distance >= 3.0F) + { + float f = distance / 10.0F; + this.explodeCart((double)(f * f)); + } + + super.fall(distance, damageMultiplier); + } + + /** + * Called every tick the minecart is on an activator rail. Args: x, y, z, is the rail receiving power + */ + public void onActivatorRailPass(int x, int y, int z, boolean receivingPower) + { + if (receivingPower && this.minecartTNTFuse < 0) + { + this.ignite(); + } + } + + public void handleStatusUpdate(byte id) + { + if (id == 10) + { + this.ignite(); + } + else + { + super.handleStatusUpdate(id); + } + } + + /** + * Ignites this TNT cart. + */ + public void ignite() + { + this.minecartTNTFuse = 80; + + if (!this.worldObj.isRemote) + { + this.worldObj.setEntityState(this, (byte)10); + + if (!this.isSilent()) + { + this.worldObj.playSoundAtEntity(this, "game.tnt.primed", 1.0F, 1.0F); + } + } + } + + /** + * Gets the remaining fuse time in ticks. + */ + public int getFuseTicks() + { + return this.minecartTNTFuse; + } + + /** + * Returns true if the TNT minecart is ignited. + */ + public boolean isIgnited() + { + return this.minecartTNTFuse > -1; + } + + /** + * Explosion resistance of a block relative to this entity + */ + public float getExplosionResistance(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn) + { + return !this.isIgnited() || !BlockRailBase.isRailBlock(blockStateIn) && !BlockRailBase.isRailBlock(worldIn, pos.up()) ? super.getExplosionResistance(explosionIn, worldIn, pos, blockStateIn) : 0.0F; + } + + public boolean verifyExplosion(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn, float p_174816_5_) + { + return !this.isIgnited() || !BlockRailBase.isRailBlock(blockStateIn) && !BlockRailBase.isRailBlock(worldIn, pos.up()) ? super.verifyExplosion(explosionIn, worldIn, pos, blockStateIn, p_174816_5_) : false; + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + + if (tagCompund.hasKey("TNTFuse", 99)) + { + this.minecartTNTFuse = tagCompund.getInteger("TNTFuse"); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("TNTFuse", this.minecartTNTFuse); + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityPainting.java b/src/minecraft/net/minecraft/entity/item/EntityPainting.java new file mode 100644 index 0000000..7ec1942 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityPainting.java @@ -0,0 +1,187 @@ +package net.minecraft.entity.item; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityHanging; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class EntityPainting extends EntityHanging +{ + public EntityPainting.EnumArt art; + + public EntityPainting(World worldIn) + { + super(worldIn); + } + + public EntityPainting(World worldIn, BlockPos pos, EnumFacing facing) + { + super(worldIn, pos); + List list = Lists.newArrayList(); + + for (EntityPainting.EnumArt entitypainting$enumart : EntityPainting.EnumArt.values()) + { + this.art = entitypainting$enumart; + this.updateFacingWithBoundingBox(facing); + + if (this.onValidSurface()) + { + list.add(entitypainting$enumart); + } + } + + if (!list.isEmpty()) + { + this.art = (EntityPainting.EnumArt)list.get(this.rand.nextInt(list.size())); + } + + this.updateFacingWithBoundingBox(facing); + } + + public EntityPainting(World worldIn, BlockPos pos, EnumFacing facing, String title) + { + this(worldIn, pos, facing); + + for (EntityPainting.EnumArt entitypainting$enumart : EntityPainting.EnumArt.values()) + { + if (entitypainting$enumart.title.equals(title)) + { + this.art = entitypainting$enumart; + break; + } + } + + this.updateFacingWithBoundingBox(facing); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + tagCompound.setString("Motive", this.art.title); + super.writeEntityToNBT(tagCompound); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + String s = tagCompund.getString("Motive"); + + for (EntityPainting.EnumArt entitypainting$enumart : EntityPainting.EnumArt.values()) + { + if (entitypainting$enumart.title.equals(s)) + { + this.art = entitypainting$enumart; + } + } + + if (this.art == null) + { + this.art = EntityPainting.EnumArt.KEBAB; + } + + super.readEntityFromNBT(tagCompund); + } + + public int getWidthPixels() + { + return this.art.sizeX; + } + + public int getHeightPixels() + { + return this.art.sizeY; + } + + /** + * Called when this entity is broken. Entity parameter may be null. + */ + public void onBroken(Entity brokenEntity) + { + if (this.worldObj.getGameRules().getBoolean("doEntityDrops")) + { + if (brokenEntity instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)brokenEntity; + + if (entityplayer.capabilities.isCreativeMode) + { + return; + } + } + + this.entityDropItem(new ItemStack(Items.painting), 0.0F); + } + } + + /** + * Sets the location and Yaw/Pitch of an entity in the world + */ + public void setLocationAndAngles(double x, double y, double z, float yaw, float pitch) + { + BlockPos blockpos = this.hangingPosition.add(x - this.posX, y - this.posY, z - this.posZ); + this.setPosition((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ()); + } + + public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + { + BlockPos blockpos = this.hangingPosition.add(x - this.posX, y - this.posY, z - this.posZ); + this.setPosition((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ()); + } + + public static enum EnumArt + { + KEBAB("Kebab", 16, 16, 0, 0), + AZTEC("Aztec", 16, 16, 16, 0), + ALBAN("Alban", 16, 16, 32, 0), + AZTEC_2("Aztec2", 16, 16, 48, 0), + BOMB("Bomb", 16, 16, 64, 0), + PLANT("Plant", 16, 16, 80, 0), + WASTELAND("Wasteland", 16, 16, 96, 0), + POOL("Pool", 32, 16, 0, 32), + COURBET("Courbet", 32, 16, 32, 32), + SEA("Sea", 32, 16, 64, 32), + SUNSET("Sunset", 32, 16, 96, 32), + CREEBET("Creebet", 32, 16, 128, 32), + WANDERER("Wanderer", 16, 32, 0, 64), + GRAHAM("Graham", 16, 32, 16, 64), + MATCH("Match", 32, 32, 0, 128), + BUST("Bust", 32, 32, 32, 128), + STAGE("Stage", 32, 32, 64, 128), + VOID("Void", 32, 32, 96, 128), + SKULL_AND_ROSES("SkullAndRoses", 32, 32, 128, 128), + WITHER("Wither", 32, 32, 160, 128), + FIGHTERS("Fighters", 64, 32, 0, 96), + POINTER("Pointer", 64, 64, 0, 192), + PIGSCENE("Pigscene", 64, 64, 64, 192), + BURNING_SKULL("BurningSkull", 64, 64, 128, 192), + SKELETON("Skeleton", 64, 48, 192, 64), + DONKEY_KONG("DonkeyKong", 64, 48, 192, 112); + + public static final int field_180001_A = "SkullAndRoses".length(); + public final String title; + public final int sizeX; + public final int sizeY; + public final int offsetX; + public final int offsetY; + + private EnumArt(String titleIn, int width, int height, int textureU, int textureV) + { + this.title = titleIn; + this.sizeX = width; + this.sizeY = height; + this.offsetX = textureU; + this.offsetY = textureV; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityTNTPrimed.java b/src/minecraft/net/minecraft/entity/item/EntityTNTPrimed.java new file mode 100644 index 0000000..30e5075 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityTNTPrimed.java @@ -0,0 +1,129 @@ +package net.minecraft.entity.item; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class EntityTNTPrimed extends Entity +{ + /** How long the fuse is */ + public int fuse; + private EntityLivingBase tntPlacedBy; + + public EntityTNTPrimed(World worldIn) + { + super(worldIn); + this.preventEntitySpawning = true; + this.setSize(0.98F, 0.98F); + } + + public EntityTNTPrimed(World worldIn, double p_i1730_2_, double p_i1730_4_, double p_i1730_6_, EntityLivingBase p_i1730_8_) + { + this(worldIn); + this.setPosition(p_i1730_2_, p_i1730_4_, p_i1730_6_); + float f = (float)(Math.random() * Math.PI * 2.0D); + this.motionX = (double)(-((float)Math.sin((double)f)) * 0.02F); + this.motionY = 0.20000000298023224D; + this.motionZ = (double)(-((float)Math.cos((double)f)) * 0.02F); + this.fuse = 80; + this.prevPosX = p_i1730_2_; + this.prevPosY = p_i1730_4_; + this.prevPosZ = p_i1730_6_; + this.tntPlacedBy = p_i1730_8_; + } + + protected void entityInit() + { + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return !this.isDead; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= 0.03999999910593033D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + this.motionY *= -0.5D; + } + + if (this.fuse-- <= 0) + { + this.setDead(); + + if (!this.worldObj.isRemote) + { + this.explode(); + } + } + else + { + this.handleWaterMovement(); + this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + private void explode() + { + float f = 4.0F; + this.worldObj.createExplosion(this, this.posX, this.posY + (double)(this.height / 16.0F), this.posZ, f, true); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound tagCompound) + { + tagCompound.setByte("Fuse", (byte)this.fuse); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound tagCompund) + { + this.fuse = tagCompund.getByte("Fuse"); + } + + /** + * returns null or the entityliving it was placed or ignited by + */ + public EntityLivingBase getTntPlacedBy() + { + return this.tntPlacedBy; + } + + public float getEyeHeight() + { + return 0.0F; + } +} diff --git a/src/minecraft/net/minecraft/entity/item/EntityXPOrb.java b/src/minecraft/net/minecraft/entity/item/EntityXPOrb.java new file mode 100644 index 0000000..850c1cf --- /dev/null +++ b/src/minecraft/net/minecraft/entity/item/EntityXPOrb.java @@ -0,0 +1,279 @@ +package net.minecraft.entity.item; + +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityXPOrb extends Entity +{ + /** + * A constantly increasing value that RenderXPOrb uses to control the colour shifting (Green / yellow) + */ + public int xpColor; + + /** The age of the XP orb in ticks. */ + public int xpOrbAge; + public int delayBeforeCanPickup; + + /** The health of this XP orb. */ + private int xpOrbHealth = 5; + + /** This is how much XP this orb has. */ + private int xpValue; + + /** The closest EntityPlayer to this orb. */ + private EntityPlayer closestPlayer; + + /** Threshold color for tracking players */ + private int xpTargetColor; + + public EntityXPOrb(World worldIn, double x, double y, double z, int expValue) + { + super(worldIn); + this.setSize(0.5F, 0.5F); + this.setPosition(x, y, z); + this.rotationYaw = (float)(Math.random() * 360.0D); + this.motionX = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F); + this.motionY = (double)((float)(Math.random() * 0.2D) * 2.0F); + this.motionZ = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F); + this.xpValue = expValue; + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + public EntityXPOrb(World worldIn) + { + super(worldIn); + this.setSize(0.25F, 0.25F); + } + + protected void entityInit() + { + } + + public int getBrightnessForRender(float partialTicks) + { + float f = 0.5F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + int i = super.getBrightnessForRender(partialTicks); + int j = i & 255; + int k = i >> 16 & 255; + j = j + (int)(f * 15.0F * 16.0F); + + if (j > 240) + { + j = 240; + } + + return j | k << 16; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.delayBeforeCanPickup > 0) + { + --this.delayBeforeCanPickup; + } + + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= 0.029999999329447746D; + + if (this.worldObj.getBlockState(new BlockPos(this)).getBlock().getMaterial() == Material.lava) + { + this.motionY = 0.20000000298023224D; + this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F); + } + + this.pushOutOfBlocks(this.posX, (this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY) / 2.0D, this.posZ); + double d0 = 8.0D; + + if (this.xpTargetColor < this.xpColor - 20 + this.getEntityId() % 100) + { + if (this.closestPlayer == null || this.closestPlayer.getDistanceSqToEntity(this) > d0 * d0) + { + this.closestPlayer = this.worldObj.getClosestPlayerToEntity(this, d0); + } + + this.xpTargetColor = this.xpColor; + } + + if (this.closestPlayer != null && this.closestPlayer.isSpectator()) + { + this.closestPlayer = null; + } + + if (this.closestPlayer != null) + { + double d1 = (this.closestPlayer.posX - this.posX) / d0; + double d2 = (this.closestPlayer.posY + (double)this.closestPlayer.getEyeHeight() - this.posY) / d0; + double d3 = (this.closestPlayer.posZ - this.posZ) / d0; + double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3); + double d5 = 1.0D - d4; + + if (d5 > 0.0D) + { + d5 = d5 * d5; + this.motionX += d1 / d4 * d5 * 0.1D; + this.motionY += d2 / d4 * d5 * 0.1D; + this.motionZ += d3 / d4 * d5 * 0.1D; + } + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + float f = 0.98F; + + if (this.onGround) + { + f = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.98F; + } + + this.motionX *= (double)f; + this.motionY *= 0.9800000190734863D; + this.motionZ *= (double)f; + + if (this.onGround) + { + this.motionY *= -0.8999999761581421D; + } + + ++this.xpColor; + ++this.xpOrbAge; + + if (this.xpOrbAge >= 6000) + { + this.setDead(); + } + } + + /** + * Returns if this entity is in water and will end up adding the waters velocity to the entity + */ + public boolean handleWaterMovement() + { + return this.worldObj.handleMaterialAcceleration(this.getEntityBoundingBox(), Material.water, this); + } + + /** + * Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args: + * amountDamage + */ + protected void dealFireDamage(int amount) + { + this.attackEntityFrom(DamageSource.inFire, (float)amount); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + this.setBeenAttacked(); + this.xpOrbHealth = (int)((float)this.xpOrbHealth - amount); + + if (this.xpOrbHealth <= 0) + { + this.setDead(); + } + + return false; + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + tagCompound.setShort("Health", (short)((byte)this.xpOrbHealth)); + tagCompound.setShort("Age", (short)this.xpOrbAge); + tagCompound.setShort("Value", (short)this.xpValue); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + this.xpOrbHealth = tagCompund.getShort("Health") & 255; + this.xpOrbAge = tagCompund.getShort("Age"); + this.xpValue = tagCompund.getShort("Value"); + } + + /** + * Called by a player entity when they collide with an entity + */ + public void onCollideWithPlayer(EntityPlayer entityIn) + { + if (!this.worldObj.isRemote) + { + if (this.delayBeforeCanPickup == 0 && entityIn.xpCooldown == 0) + { + entityIn.xpCooldown = 2; + this.worldObj.playSoundAtEntity(entityIn, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); + entityIn.onItemPickup(this, 1); + entityIn.addExperience(this.xpValue); + this.setDead(); + } + } + } + + /** + * Returns the XP value of this XP orb. + */ + public int getXpValue() + { + return this.xpValue; + } + + /** + * Returns a number from 1 to 10 based on how much XP this orb is worth. This is used by RenderXPOrb to determine + * what texture to use. + */ + public int getTextureByXP() + { + return this.xpValue >= 2477 ? 10 : (this.xpValue >= 1237 ? 9 : (this.xpValue >= 617 ? 8 : (this.xpValue >= 307 ? 7 : (this.xpValue >= 149 ? 6 : (this.xpValue >= 73 ? 5 : (this.xpValue >= 37 ? 4 : (this.xpValue >= 17 ? 3 : (this.xpValue >= 7 ? 2 : (this.xpValue >= 3 ? 1 : 0))))))))); + } + + /** + * Get a fragment of the maximum experience points value for the supplied value of experience points value. + */ + public static int getXPSplit(int expValue) + { + return expValue >= 2477 ? 2477 : (expValue >= 1237 ? 1237 : (expValue >= 617 ? 617 : (expValue >= 307 ? 307 : (expValue >= 149 ? 149 : (expValue >= 73 ? 73 : (expValue >= 37 ? 37 : (expValue >= 17 ? 17 : (expValue >= 7 ? 7 : (expValue >= 3 ? 3 : 1))))))))); + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityBlaze.java b/src/minecraft/net/minecraft/entity/monster/EntityBlaze.java new file mode 100644 index 0000000..cc3ef16 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityBlaze.java @@ -0,0 +1,305 @@ +package net.minecraft.entity.monster; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntitySmallFireball; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityBlaze extends EntityMob +{ + /** Random offset used in floating behaviour */ + private float heightOffset = 0.5F; + + /** ticks until heightOffset is randomized */ + private int heightOffsetUpdateTime; + + public EntityBlaze(World worldIn) + { + super(worldIn); + this.isImmuneToFire = true; + this.experienceValue = 10; + this.tasks.addTask(4, new EntityBlaze.AIFireballAttack(this)); + this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); + this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[0])); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(48.0D); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)0)); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.blaze.breathe"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.blaze.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.blaze.death"; + } + + public int getBrightnessForRender(float partialTicks) + { + return 15728880; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float partialTicks) + { + return 1.0F; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (!this.onGround && this.motionY < 0.0D) + { + this.motionY *= 0.6D; + } + + if (this.worldObj.isRemote) + { + if (this.rand.nextInt(24) == 0 && !this.isSilent()) + { + this.worldObj.playSound(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, "fire.fire", 1.0F + this.rand.nextFloat(), this.rand.nextFloat() * 0.7F + 0.3F, false); + } + + for (int i = 0; i < 2; ++i) + { + this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + super.onLivingUpdate(); + } + + protected void updateAITasks() + { + if (this.isWet()) + { + this.attackEntityFrom(DamageSource.drown, 1.0F); + } + + --this.heightOffsetUpdateTime; + + if (this.heightOffsetUpdateTime <= 0) + { + this.heightOffsetUpdateTime = 100; + this.heightOffset = 0.5F + (float)this.rand.nextGaussian() * 3.0F; + } + + EntityLivingBase entitylivingbase = this.getAttackTarget(); + + if (entitylivingbase != null && entitylivingbase.posY + (double)entitylivingbase.getEyeHeight() > this.posY + (double)this.getEyeHeight() + (double)this.heightOffset) + { + this.motionY += (0.30000001192092896D - this.motionY) * 0.30000001192092896D; + this.isAirBorne = true; + } + + super.updateAITasks(); + } + + public void fall(float distance, float damageMultiplier) + { + } + + protected Item getDropItem() + { + return Items.blaze_rod; + } + + /** + * Returns true if the entity is on fire. Used by render to add the fire effect on rendering. + */ + public boolean isBurning() + { + return this.func_70845_n(); + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + if (p_70628_1_) + { + int i = this.rand.nextInt(2 + p_70628_2_); + + for (int j = 0; j < i; ++j) + { + this.dropItem(Items.blaze_rod, 1); + } + } + } + + public boolean func_70845_n() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + public void setOnFire(boolean onFire) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + if (onFire) + { + b0 = (byte)(b0 | 1); + } + else + { + b0 = (byte)(b0 & -2); + } + + this.dataWatcher.updateObject(16, Byte.valueOf(b0)); + } + + /** + * Checks to make sure the light is not too bright where the mob is spawning + */ + protected boolean isValidLightLevel() + { + return true; + } + + static class AIFireballAttack extends EntityAIBase + { + private EntityBlaze blaze; + private int field_179467_b; + private int field_179468_c; + + public AIFireballAttack(EntityBlaze p_i45846_1_) + { + this.blaze = p_i45846_1_; + this.setMutexBits(3); + } + + public boolean shouldExecute() + { + EntityLivingBase entitylivingbase = this.blaze.getAttackTarget(); + return entitylivingbase != null && entitylivingbase.isEntityAlive(); + } + + public void startExecuting() + { + this.field_179467_b = 0; + } + + public void resetTask() + { + this.blaze.setOnFire(false); + } + + public void updateTask() + { + --this.field_179468_c; + EntityLivingBase entitylivingbase = this.blaze.getAttackTarget(); + double d0 = this.blaze.getDistanceSqToEntity(entitylivingbase); + + if (d0 < 4.0D) + { + if (this.field_179468_c <= 0) + { + this.field_179468_c = 20; + this.blaze.attackEntityAsMob(entitylivingbase); + } + + this.blaze.getMoveHelper().setMoveTo(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ, 1.0D); + } + else if (d0 < 256.0D) + { + double d1 = entitylivingbase.posX - this.blaze.posX; + double d2 = entitylivingbase.getEntityBoundingBox().minY + (double)(entitylivingbase.height / 2.0F) - (this.blaze.posY + (double)(this.blaze.height / 2.0F)); + double d3 = entitylivingbase.posZ - this.blaze.posZ; + + if (this.field_179468_c <= 0) + { + ++this.field_179467_b; + + if (this.field_179467_b == 1) + { + this.field_179468_c = 60; + this.blaze.setOnFire(true); + } + else if (this.field_179467_b <= 4) + { + this.field_179468_c = 6; + } + else + { + this.field_179468_c = 100; + this.field_179467_b = 0; + this.blaze.setOnFire(false); + } + + if (this.field_179467_b > 1) + { + float f = MathHelper.sqrt_float(MathHelper.sqrt_double(d0)) * 0.5F; + this.blaze.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1009, new BlockPos((int)this.blaze.posX, (int)this.blaze.posY, (int)this.blaze.posZ), 0); + + for (int i = 0; i < 1; ++i) + { + EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.blaze.worldObj, this.blaze, d1 + this.blaze.getRNG().nextGaussian() * (double)f, d2, d3 + this.blaze.getRNG().nextGaussian() * (double)f); + entitysmallfireball.posY = this.blaze.posY + (double)(this.blaze.height / 2.0F) + 0.5D; + this.blaze.worldObj.spawnEntityInWorld(entitysmallfireball); + } + } + } + + this.blaze.getLookHelper().setLookPositionWithEntity(entitylivingbase, 10.0F, 10.0F); + } + else + { + this.blaze.getNavigator().clearPathEntity(); + this.blaze.getMoveHelper().setMoveTo(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ, 1.0D); + } + + super.updateTask(); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityCaveSpider.java b/src/minecraft/net/minecraft/entity/monster/EntityCaveSpider.java new file mode 100644 index 0000000..505e0a2 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityCaveSpider.java @@ -0,0 +1,71 @@ +package net.minecraft.entity.monster; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class EntityCaveSpider extends EntitySpider +{ + public EntityCaveSpider(World worldIn) + { + super(worldIn); + this.setSize(0.7F, 0.5F); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(12.0D); + } + + public boolean attackEntityAsMob(Entity entityIn) + { + if (super.attackEntityAsMob(entityIn)) + { + if (entityIn instanceof EntityLivingBase) + { + int i = 0; + + if (this.worldObj.getDifficulty() == EnumDifficulty.NORMAL) + { + i = 7; + } + else if (this.worldObj.getDifficulty() == EnumDifficulty.HARD) + { + i = 15; + } + + if (i > 0) + { + ((EntityLivingBase)entityIn).addPotionEffect(new PotionEffect(Potion.poison.id, i * 20, 0)); + } + } + + return true; + } + else + { + return false; + } + } + + /** + * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called + * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory + */ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + return livingdata; + } + + public float getEyeHeight() + { + return 0.45F; + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityCreeper.java b/src/minecraft/net/minecraft/entity/monster/EntityCreeper.java new file mode 100644 index 0000000..216d6a4 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityCreeper.java @@ -0,0 +1,315 @@ +package net.minecraft.entity.monster; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIAvoidEntity; +import net.minecraft.entity.ai.EntityAICreeperSwell; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; + +public class EntityCreeper extends EntityMob +{ + /** + * Time when this creeper was last in an active state (Messed up code here, probably causes creeper animation to go + * weird) + */ + private int lastActiveTime; + + /** + * The amount of time since the creeper was close enough to the player to ignite + */ + private int timeSinceIgnited; + private int fuseTime = 30; + + /** Explosion radius for this creeper. */ + private int explosionRadius = 3; + private int field_175494_bm = 0; + + public EntityCreeper(World worldIn) + { + super(worldIn); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAICreeperSwell(this)); + this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityOcelot.class, 6.0F, 1.0D, 1.2D)); + this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, false)); + this.tasks.addTask(5, new EntityAIWander(this, 0.8D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(6, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); + this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0])); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); + } + + /** + * The maximum height from where the entity is alowed to jump (used in pathfinder) + */ + public int getMaxFallHeight() + { + return this.getAttackTarget() == null ? 3 : 3 + (int)(this.getHealth() - 1.0F); + } + + public void fall(float distance, float damageMultiplier) + { + super.fall(distance, damageMultiplier); + this.timeSinceIgnited = (int)((float)this.timeSinceIgnited + distance * 1.5F); + + if (this.timeSinceIgnited > this.fuseTime - 5) + { + this.timeSinceIgnited = this.fuseTime - 5; + } + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte) - 1)); + this.dataWatcher.addObject(17, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(18, Byte.valueOf((byte)0)); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + + if (this.dataWatcher.getWatchableObjectByte(17) == 1) + { + tagCompound.setBoolean("powered", true); + } + + tagCompound.setShort("Fuse", (short)this.fuseTime); + tagCompound.setByte("ExplosionRadius", (byte)this.explosionRadius); + tagCompound.setBoolean("ignited", this.hasIgnited()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.dataWatcher.updateObject(17, Byte.valueOf((byte)(tagCompund.getBoolean("powered") ? 1 : 0))); + + if (tagCompund.hasKey("Fuse", 99)) + { + this.fuseTime = tagCompund.getShort("Fuse"); + } + + if (tagCompund.hasKey("ExplosionRadius", 99)) + { + this.explosionRadius = tagCompund.getByte("ExplosionRadius"); + } + + if (tagCompund.getBoolean("ignited")) + { + this.ignite(); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (this.isEntityAlive()) + { + this.lastActiveTime = this.timeSinceIgnited; + + if (this.hasIgnited()) + { + this.setCreeperState(1); + } + + int i = this.getCreeperState(); + + if (i > 0 && this.timeSinceIgnited == 0) + { + this.playSound("creeper.primed", 1.0F, 0.5F); + } + + this.timeSinceIgnited += i; + + if (this.timeSinceIgnited < 0) + { + this.timeSinceIgnited = 0; + } + + if (this.timeSinceIgnited >= this.fuseTime) + { + this.timeSinceIgnited = this.fuseTime; + this.explode(); + } + } + + super.onUpdate(); + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.creeper.say"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.creeper.death"; + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource cause) + { + super.onDeath(cause); + + if (cause.getEntity() instanceof EntitySkeleton) + { + int i = Item.getIdFromItem(Items.record_13); + int j = Item.getIdFromItem(Items.record_wait); + int k = i + this.rand.nextInt(j - i + 1); + this.dropItem(Item.getItemById(k), 1); + } + else if (cause.getEntity() instanceof EntityCreeper && cause.getEntity() != this && ((EntityCreeper)cause.getEntity()).getPowered() && ((EntityCreeper)cause.getEntity()).isAIEnabled()) + { + ((EntityCreeper)cause.getEntity()).func_175493_co(); + this.entityDropItem(new ItemStack(Items.skull, 1, 4), 0.0F); + } + } + + public boolean attackEntityAsMob(Entity entityIn) + { + return true; + } + + /** + * Returns true if the creeper is powered by a lightning bolt. + */ + public boolean getPowered() + { + return this.dataWatcher.getWatchableObjectByte(17) == 1; + } + + /** + * Params: (Float)Render tick. Returns the intensity of the creeper's flash when it is ignited. + */ + public float getCreeperFlashIntensity(float p_70831_1_) + { + return ((float)this.lastActiveTime + (float)(this.timeSinceIgnited - this.lastActiveTime) * p_70831_1_) / (float)(this.fuseTime - 2); + } + + protected Item getDropItem() + { + return Items.gunpowder; + } + + /** + * Returns the current state of creeper, -1 is idle, 1 is 'in fuse' + */ + public int getCreeperState() + { + return this.dataWatcher.getWatchableObjectByte(16); + } + + /** + * Sets the state of creeper, -1 to idle and 1 to be 'in fuse' + */ + public void setCreeperState(int state) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)state)); + } + + /** + * Called when a lightning bolt hits the entity. + */ + public void onStruckByLightning(EntityLightningBolt lightningBolt) + { + super.onStruckByLightning(lightningBolt); + this.dataWatcher.updateObject(17, Byte.valueOf((byte)1)); + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + protected boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.flint_and_steel) + { + this.worldObj.playSoundEffect(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, "fire.ignite", 1.0F, this.rand.nextFloat() * 0.4F + 0.8F); + player.swingItem(); + + if (!this.worldObj.isRemote) + { + this.ignite(); + itemstack.damageItem(1, player); + return true; + } + } + + return super.interact(player); + } + + /** + * Creates an explosion as determined by this creeper's power and explosion radius. + */ + private void explode() + { + if (!this.worldObj.isRemote) + { + boolean flag = this.worldObj.getGameRules().getBoolean("mobGriefing"); + float f = this.getPowered() ? 2.0F : 1.0F; + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius * f, flag); + this.setDead(); + } + } + + public boolean hasIgnited() + { + return this.dataWatcher.getWatchableObjectByte(18) != 0; + } + + public void ignite() + { + this.dataWatcher.updateObject(18, Byte.valueOf((byte)1)); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + public boolean isAIEnabled() + { + return this.field_175494_bm < 1 && this.worldObj.getGameRules().getBoolean("doMobLoot"); + } + + public void func_175493_co() + { + ++this.field_175494_bm; + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityEnderman.java b/src/minecraft/net/minecraft/entity/monster/EntityEnderman.java new file mode 100644 index 0000000..0926e6c --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityEnderman.java @@ -0,0 +1,613 @@ +package net.minecraft.entity.monster; + +import com.google.common.base.Predicate; +import com.google.common.collect.Sets; +import java.util.Collections; +import java.util.List; +import java.util.Random; +import java.util.Set; +import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSource; +import net.minecraft.util.EntityDamageSourceIndirect; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class EntityEnderman extends EntityMob +{ + private static final UUID attackingSpeedBoostModifierUUID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0"); + private static final AttributeModifier attackingSpeedBoostModifier = (new AttributeModifier(attackingSpeedBoostModifierUUID, "Attacking speed boost", 0.15000000596046448D, 0)).setSaved(false); + private static final Set carriableBlocks = Sets.newIdentityHashSet(); + private boolean isAggressive; + + public EntityEnderman(World worldIn) + { + super(worldIn); + this.setSize(0.6F, 2.9F); + this.stepHeight = 1.0F; + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIAttackOnCollide(this, 1.0D, false)); + this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.tasks.addTask(10, new EntityEnderman.AIPlaceBlock(this)); + this.tasks.addTask(11, new EntityEnderman.AITakeBlock(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); + this.targetTasks.addTask(2, new EntityEnderman.AIFindPlayer(this)); + this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityEndermite.class, 10, true, false, new Predicate() + { + public boolean apply(EntityEndermite p_apply_1_) + { + return p_apply_1_.isSpawnedByPlayer(); + } + })); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(7.0D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(64.0D); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Short((short)0)); + this.dataWatcher.addObject(17, new Byte((byte)0)); + this.dataWatcher.addObject(18, new Byte((byte)0)); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + IBlockState iblockstate = this.getHeldBlockState(); + tagCompound.setShort("carried", (short)Block.getIdFromBlock(iblockstate.getBlock())); + tagCompound.setShort("carriedData", (short)iblockstate.getBlock().getMetaFromState(iblockstate)); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + IBlockState iblockstate; + + if (tagCompund.hasKey("carried", 8)) + { + iblockstate = Block.getBlockFromName(tagCompund.getString("carried")).getStateFromMeta(tagCompund.getShort("carriedData") & 65535); + } + else + { + iblockstate = Block.getBlockById(tagCompund.getShort("carried")).getStateFromMeta(tagCompund.getShort("carriedData") & 65535); + } + + this.setHeldBlockState(iblockstate); + } + + /** + * Checks to see if this enderman should be attacking this player + */ + private boolean shouldAttackPlayer(EntityPlayer player) + { + ItemStack itemstack = player.inventory.armorInventory[3]; + + if (itemstack != null && itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin)) + { + return false; + } + else + { + Vec3 vec3 = player.getLook(1.0F).normalize(); + Vec3 vec31 = new Vec3(this.posX - player.posX, this.getEntityBoundingBox().minY + (double)(this.height / 2.0F) - (player.posY + (double)player.getEyeHeight()), this.posZ - player.posZ); + double d0 = vec31.lengthVector(); + vec31 = vec31.normalize(); + double d1 = vec3.dotProduct(vec31); + return d1 > 1.0D - 0.025D / d0 ? player.canEntityBeSeen(this) : false; + } + } + + public float getEyeHeight() + { + return 2.55F; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.worldObj.isRemote) + { + for (int i = 0; i < 2; ++i) + { + this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - 0.25D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D, new int[0]); + } + } + + this.isJumping = false; + super.onLivingUpdate(); + } + + protected void updateAITasks() + { + if (this.isWet()) + { + this.attackEntityFrom(DamageSource.drown, 1.0F); + } + + if (this.isScreaming() && !this.isAggressive && this.rand.nextInt(100) == 0) + { + this.setScreaming(false); + } + + if (this.worldObj.isDaytime()) + { + float f = this.getBrightness(1.0F); + + if (f > 0.5F && this.worldObj.canSeeSky(new BlockPos(this)) && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) + { + this.setAttackTarget((EntityLivingBase)null); + this.setScreaming(false); + this.isAggressive = false; + this.teleportRandomly(); + } + } + + super.updateAITasks(); + } + + /** + * Teleport the enderman to a random nearby position + */ + protected boolean teleportRandomly() + { + double d0 = this.posX + (this.rand.nextDouble() - 0.5D) * 64.0D; + double d1 = this.posY + (double)(this.rand.nextInt(64) - 32); + double d2 = this.posZ + (this.rand.nextDouble() - 0.5D) * 64.0D; + return this.teleportTo(d0, d1, d2); + } + + /** + * Teleport the enderman to another entity + */ + protected boolean teleportToEntity(Entity p_70816_1_) + { + Vec3 vec3 = new Vec3(this.posX - p_70816_1_.posX, this.getEntityBoundingBox().minY + (double)(this.height / 2.0F) - p_70816_1_.posY + (double)p_70816_1_.getEyeHeight(), this.posZ - p_70816_1_.posZ); + vec3 = vec3.normalize(); + double d0 = 16.0D; + double d1 = this.posX + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3.xCoord * d0; + double d2 = this.posY + (double)(this.rand.nextInt(16) - 8) - vec3.yCoord * d0; + double d3 = this.posZ + (this.rand.nextDouble() - 0.5D) * 8.0D - vec3.zCoord * d0; + return this.teleportTo(d1, d2, d3); + } + + /** + * Teleport the enderman + */ + protected boolean teleportTo(double x, double y, double z) + { + double d0 = this.posX; + double d1 = this.posY; + double d2 = this.posZ; + this.posX = x; + this.posY = y; + this.posZ = z; + boolean flag = false; + BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); + + if (this.worldObj.isBlockLoaded(blockpos)) + { + boolean flag1 = false; + + while (!flag1 && blockpos.getY() > 0) + { + BlockPos blockpos1 = blockpos.down(); + Block block = this.worldObj.getBlockState(blockpos1).getBlock(); + + if (block.getMaterial().blocksMovement()) + { + flag1 = true; + } + else + { + --this.posY; + blockpos = blockpos1; + } + } + + if (flag1) + { + super.setPositionAndUpdate(this.posX, this.posY, this.posZ); + + if (this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox())) + { + flag = true; + } + } + } + + if (!flag) + { + this.setPosition(d0, d1, d2); + return false; + } + else + { + int i = 128; + + for (int j = 0; j < i; ++j) + { + double d6 = (double)j / ((double)i - 1.0D); + float f = (this.rand.nextFloat() - 0.5F) * 0.2F; + float f1 = (this.rand.nextFloat() - 0.5F) * 0.2F; + float f2 = (this.rand.nextFloat() - 0.5F) * 0.2F; + double d3 = d0 + (this.posX - d0) * d6 + (this.rand.nextDouble() - 0.5D) * (double)this.width * 2.0D; + double d4 = d1 + (this.posY - d1) * d6 + this.rand.nextDouble() * (double)this.height; + double d5 = d2 + (this.posZ - d2) * d6 + (this.rand.nextDouble() - 0.5D) * (double)this.width * 2.0D; + this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, d3, d4, d5, (double)f, (double)f1, (double)f2, new int[0]); + } + + this.worldObj.playSoundEffect(d0, d1, d2, "mob.endermen.portal", 1.0F, 1.0F); + this.playSound("mob.endermen.portal", 1.0F, 1.0F); + return true; + } + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return this.isScreaming() ? "mob.endermen.scream" : "mob.endermen.idle"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.endermen.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.endermen.death"; + } + + protected Item getDropItem() + { + return Items.ender_pearl; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + Item item = this.getDropItem(); + + if (item != null) + { + int i = this.rand.nextInt(2 + p_70628_2_); + + for (int j = 0; j < i; ++j) + { + this.dropItem(item, 1); + } + } + } + + /** + * Sets this enderman's held block state + */ + public void setHeldBlockState(IBlockState state) + { + this.dataWatcher.updateObject(16, Short.valueOf((short)(Block.getStateId(state) & 65535))); + } + + /** + * Gets this enderman's held block state + */ + public IBlockState getHeldBlockState() + { + return Block.getStateById(this.dataWatcher.getWatchableObjectShort(16) & 65535); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + if (source.getEntity() == null || !(source.getEntity() instanceof EntityEndermite)) + { + if (!this.worldObj.isRemote) + { + this.setScreaming(true); + } + + if (source instanceof EntityDamageSource && source.getEntity() instanceof EntityPlayer) + { + if (source.getEntity() instanceof EntityPlayerMP && ((EntityPlayerMP)source.getEntity()).theItemInWorldManager.isCreative()) + { + this.setScreaming(false); + } + else + { + this.isAggressive = true; + } + } + + if (source instanceof EntityDamageSourceIndirect) + { + this.isAggressive = false; + + for (int i = 0; i < 64; ++i) + { + if (this.teleportRandomly()) + { + return true; + } + } + + return false; + } + } + + boolean flag = super.attackEntityFrom(source, amount); + + if (source.isUnblockable() && this.rand.nextInt(10) != 0) + { + this.teleportRandomly(); + } + + return flag; + } + } + + public boolean isScreaming() + { + return this.dataWatcher.getWatchableObjectByte(18) > 0; + } + + public void setScreaming(boolean screaming) + { + this.dataWatcher.updateObject(18, Byte.valueOf((byte)(screaming ? 1 : 0))); + } + + static + { + carriableBlocks.add(Blocks.grass); + carriableBlocks.add(Blocks.dirt); + carriableBlocks.add(Blocks.sand); + carriableBlocks.add(Blocks.gravel); + carriableBlocks.add(Blocks.yellow_flower); + carriableBlocks.add(Blocks.red_flower); + carriableBlocks.add(Blocks.brown_mushroom); + carriableBlocks.add(Blocks.red_mushroom); + carriableBlocks.add(Blocks.tnt); + carriableBlocks.add(Blocks.cactus); + carriableBlocks.add(Blocks.clay); + carriableBlocks.add(Blocks.pumpkin); + carriableBlocks.add(Blocks.melon_block); + carriableBlocks.add(Blocks.mycelium); + } + + static class AIFindPlayer extends EntityAINearestAttackableTarget + { + private EntityPlayer player; + private int field_179450_h; + private int field_179451_i; + private EntityEnderman enderman; + + public AIFindPlayer(EntityEnderman p_i45842_1_) + { + super(p_i45842_1_, EntityPlayer.class, true); + this.enderman = p_i45842_1_; + } + + public boolean shouldExecute() + { + double d0 = this.getTargetDistance(); + List list = this.taskOwner.worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.taskOwner.getEntityBoundingBox().expand(d0, 4.0D, d0), this.targetEntitySelector); + Collections.sort(list, this.theNearestAttackableTargetSorter); + + if (list.isEmpty()) + { + return false; + } + else + { + this.player = (EntityPlayer)list.get(0); + return true; + } + } + + public void startExecuting() + { + this.field_179450_h = 5; + this.field_179451_i = 0; + } + + public void resetTask() + { + this.player = null; + this.enderman.setScreaming(false); + IAttributeInstance iattributeinstance = this.enderman.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + iattributeinstance.removeModifier(EntityEnderman.attackingSpeedBoostModifier); + super.resetTask(); + } + + public boolean continueExecuting() + { + if (this.player != null) + { + if (!this.enderman.shouldAttackPlayer(this.player)) + { + return false; + } + else + { + this.enderman.isAggressive = true; + this.enderman.faceEntity(this.player, 10.0F, 10.0F); + return true; + } + } + else + { + return super.continueExecuting(); + } + } + + public void updateTask() + { + if (this.player != null) + { + if (--this.field_179450_h <= 0) + { + this.targetEntity = this.player; + this.player = null; + super.startExecuting(); + this.enderman.playSound("mob.endermen.stare", 1.0F, 1.0F); + this.enderman.setScreaming(true); + IAttributeInstance iattributeinstance = this.enderman.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + iattributeinstance.applyModifier(EntityEnderman.attackingSpeedBoostModifier); + } + } + else + { + if (this.targetEntity != null) + { + if (this.targetEntity instanceof EntityPlayer && this.enderman.shouldAttackPlayer((EntityPlayer)this.targetEntity)) + { + if (this.targetEntity.getDistanceSqToEntity(this.enderman) < 16.0D) + { + this.enderman.teleportRandomly(); + } + + this.field_179451_i = 0; + } + else if (this.targetEntity.getDistanceSqToEntity(this.enderman) > 256.0D && this.field_179451_i++ >= 30 && this.enderman.teleportToEntity(this.targetEntity)) + { + this.field_179451_i = 0; + } + } + + super.updateTask(); + } + } + } + + static class AIPlaceBlock extends EntityAIBase + { + private EntityEnderman enderman; + + public AIPlaceBlock(EntityEnderman p_i45843_1_) + { + this.enderman = p_i45843_1_; + } + + public boolean shouldExecute() + { + return !this.enderman.worldObj.getGameRules().getBoolean("mobGriefing") ? false : (this.enderman.getHeldBlockState().getBlock().getMaterial() == Material.air ? false : this.enderman.getRNG().nextInt(2000) == 0); + } + + public void updateTask() + { + Random random = this.enderman.getRNG(); + World world = this.enderman.worldObj; + int i = MathHelper.floor_double(this.enderman.posX - 1.0D + random.nextDouble() * 2.0D); + int j = MathHelper.floor_double(this.enderman.posY + random.nextDouble() * 2.0D); + int k = MathHelper.floor_double(this.enderman.posZ - 1.0D + random.nextDouble() * 2.0D); + BlockPos blockpos = new BlockPos(i, j, k); + Block block = world.getBlockState(blockpos).getBlock(); + Block block1 = world.getBlockState(blockpos.down()).getBlock(); + + if (this.func_179474_a(world, blockpos, this.enderman.getHeldBlockState().getBlock(), block, block1)) + { + world.setBlockState(blockpos, this.enderman.getHeldBlockState(), 3); + this.enderman.setHeldBlockState(Blocks.air.getDefaultState()); + } + } + + private boolean func_179474_a(World worldIn, BlockPos p_179474_2_, Block p_179474_3_, Block p_179474_4_, Block p_179474_5_) + { + return !p_179474_3_.canPlaceBlockAt(worldIn, p_179474_2_) ? false : (p_179474_4_.getMaterial() != Material.air ? false : (p_179474_5_.getMaterial() == Material.air ? false : p_179474_5_.isFullCube())); + } + } + + static class AITakeBlock extends EntityAIBase + { + private EntityEnderman enderman; + + public AITakeBlock(EntityEnderman p_i45841_1_) + { + this.enderman = p_i45841_1_; + } + + public boolean shouldExecute() + { + return !this.enderman.worldObj.getGameRules().getBoolean("mobGriefing") ? false : (this.enderman.getHeldBlockState().getBlock().getMaterial() != Material.air ? false : this.enderman.getRNG().nextInt(20) == 0); + } + + public void updateTask() + { + Random random = this.enderman.getRNG(); + World world = this.enderman.worldObj; + int i = MathHelper.floor_double(this.enderman.posX - 2.0D + random.nextDouble() * 4.0D); + int j = MathHelper.floor_double(this.enderman.posY + random.nextDouble() * 3.0D); + int k = MathHelper.floor_double(this.enderman.posZ - 2.0D + random.nextDouble() * 4.0D); + BlockPos blockpos = new BlockPos(i, j, k); + IBlockState iblockstate = world.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (EntityEnderman.carriableBlocks.contains(block)) + { + this.enderman.setHeldBlockState(iblockstate); + world.setBlockState(blockpos, Blocks.air.getDefaultState()); + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityEndermite.java b/src/minecraft/net/minecraft/entity/monster/EntityEndermite.java new file mode 100644 index 0000000..1744ccf --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityEndermite.java @@ -0,0 +1,197 @@ +package net.minecraft.entity.monster; + +import net.minecraft.block.Block; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class EntityEndermite extends EntityMob +{ + private int lifetime = 0; + private boolean playerSpawned = false; + + public EntityEndermite(World worldIn) + { + super(worldIn); + this.experienceValue = 3; + this.setSize(0.4F, 0.3F); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); + this.tasks.addTask(3, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[0])); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); + } + + public float getEyeHeight() + { + return 0.1F; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D); + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.silverfish.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.silverfish.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.silverfish.kill"; + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound("mob.silverfish.step", 0.15F, 1.0F); + } + + protected Item getDropItem() + { + return null; + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.lifetime = tagCompund.getInteger("Lifetime"); + this.playerSpawned = tagCompund.getBoolean("PlayerSpawned"); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("Lifetime", this.lifetime); + tagCompound.setBoolean("PlayerSpawned", this.playerSpawned); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.renderYawOffset = this.rotationYaw; + super.onUpdate(); + } + + public boolean isSpawnedByPlayer() + { + return this.playerSpawned; + } + + /** + * Sets if this mob was spawned by a player or not. + */ + public void setSpawnedByPlayer(boolean spawnedByPlayer) + { + this.playerSpawned = spawnedByPlayer; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (this.worldObj.isRemote) + { + for (int i = 0; i < 2; ++i) + { + this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D, new int[0]); + } + } + else + { + if (!this.isNoDespawnRequired()) + { + ++this.lifetime; + } + + if (this.lifetime >= 2400) + { + this.setDead(); + } + } + } + + /** + * Checks to make sure the light is not too bright where the mob is spawning + */ + protected boolean isValidLightLevel() + { + return true; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + if (super.getCanSpawnHere()) + { + EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, 5.0D); + return entityplayer == null; + } + else + { + return false; + } + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.ARTHROPOD; + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityGhast.java b/src/minecraft/net/minecraft/entity/monster/EntityGhast.java new file mode 100644 index 0000000..4ba3b5b --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityGhast.java @@ -0,0 +1,408 @@ +package net.minecraft.entity.monster; + +import java.util.Random; +import net.minecraft.entity.EntityFlying; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.EntityAIFindEntityNearestPlayer; +import net.minecraft.entity.ai.EntityMoveHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityLargeFireball; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class EntityGhast extends EntityFlying implements IMob +{ + /** The explosion radius of spawned fireballs. */ + private int explosionStrength = 1; + + public EntityGhast(World worldIn) + { + super(worldIn); + this.setSize(4.0F, 4.0F); + this.isImmuneToFire = true; + this.experienceValue = 5; + this.moveHelper = new EntityGhast.GhastMoveHelper(this); + this.tasks.addTask(5, new EntityGhast.AIRandomFly(this)); + this.tasks.addTask(7, new EntityGhast.AILookAround(this)); + this.tasks.addTask(7, new EntityGhast.AIFireballAttack(this)); + this.targetTasks.addTask(1, new EntityAIFindEntityNearestPlayer(this)); + } + + public boolean isAttacking() + { + return this.dataWatcher.getWatchableObjectByte(16) != 0; + } + + public void setAttacking(boolean p_175454_1_) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(p_175454_1_ ? 1 : 0))); + } + + public int getFireballStrength() + { + return this.explosionStrength; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL) + { + this.setDead(); + } + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else if ("fireball".equals(source.getDamageType()) && source.getEntity() instanceof EntityPlayer) + { + super.attackEntityFrom(source, 1000.0F); + ((EntityPlayer)source.getEntity()).triggerAchievement(AchievementList.ghast); + return true; + } + else + { + return super.attackEntityFrom(source, amount); + } + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(100.0D); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.ghast.moan"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.ghast.scream"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.ghast.death"; + } + + protected Item getDropItem() + { + return Items.gunpowder; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + int i = this.rand.nextInt(2) + this.rand.nextInt(1 + p_70628_2_); + + for (int j = 0; j < i; ++j) + { + this.dropItem(Items.ghast_tear, 1); + } + + i = this.rand.nextInt(3) + this.rand.nextInt(1 + p_70628_2_); + + for (int k = 0; k < i; ++k) + { + this.dropItem(Items.gunpowder, 1); + } + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 10.0F; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.rand.nextInt(20) == 0 && super.getCanSpawnHere() && this.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL; + } + + /** + * Will return how many at most can spawn in a chunk at once. + */ + public int getMaxSpawnedInChunk() + { + return 1; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("ExplosionPower", this.explosionStrength); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + + if (tagCompund.hasKey("ExplosionPower", 99)) + { + this.explosionStrength = tagCompund.getInteger("ExplosionPower"); + } + } + + public float getEyeHeight() + { + return 2.6F; + } + + static class AIFireballAttack extends EntityAIBase + { + private EntityGhast parentEntity; + public int attackTimer; + + public AIFireballAttack(EntityGhast p_i45837_1_) + { + this.parentEntity = p_i45837_1_; + } + + public boolean shouldExecute() + { + return this.parentEntity.getAttackTarget() != null; + } + + public void startExecuting() + { + this.attackTimer = 0; + } + + public void resetTask() + { + this.parentEntity.setAttacking(false); + } + + public void updateTask() + { + EntityLivingBase entitylivingbase = this.parentEntity.getAttackTarget(); + double d0 = 64.0D; + + if (entitylivingbase.getDistanceSqToEntity(this.parentEntity) < d0 * d0 && this.parentEntity.canEntityBeSeen(entitylivingbase)) + { + World world = this.parentEntity.worldObj; + ++this.attackTimer; + + if (this.attackTimer == 10) + { + world.playAuxSFXAtEntity((EntityPlayer)null, 1007, new BlockPos(this.parentEntity), 0); + } + + if (this.attackTimer == 20) + { + double d1 = 4.0D; + Vec3 vec3 = this.parentEntity.getLook(1.0F); + double d2 = entitylivingbase.posX - (this.parentEntity.posX + vec3.xCoord * d1); + double d3 = entitylivingbase.getEntityBoundingBox().minY + (double)(entitylivingbase.height / 2.0F) - (0.5D + this.parentEntity.posY + (double)(this.parentEntity.height / 2.0F)); + double d4 = entitylivingbase.posZ - (this.parentEntity.posZ + vec3.zCoord * d1); + world.playAuxSFXAtEntity((EntityPlayer)null, 1008, new BlockPos(this.parentEntity), 0); + EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.parentEntity, d2, d3, d4); + entitylargefireball.explosionPower = this.parentEntity.getFireballStrength(); + entitylargefireball.posX = this.parentEntity.posX + vec3.xCoord * d1; + entitylargefireball.posY = this.parentEntity.posY + (double)(this.parentEntity.height / 2.0F) + 0.5D; + entitylargefireball.posZ = this.parentEntity.posZ + vec3.zCoord * d1; + world.spawnEntityInWorld(entitylargefireball); + this.attackTimer = -40; + } + } + else if (this.attackTimer > 0) + { + --this.attackTimer; + } + + this.parentEntity.setAttacking(this.attackTimer > 10); + } + } + + static class AILookAround extends EntityAIBase + { + private EntityGhast parentEntity; + + public AILookAround(EntityGhast p_i45839_1_) + { + this.parentEntity = p_i45839_1_; + this.setMutexBits(2); + } + + public boolean shouldExecute() + { + return true; + } + + public void updateTask() + { + if (this.parentEntity.getAttackTarget() == null) + { + this.parentEntity.renderYawOffset = this.parentEntity.rotationYaw = -((float)MathHelper.func_181159_b(this.parentEntity.motionX, this.parentEntity.motionZ)) * 180.0F / (float)Math.PI; + } + else + { + EntityLivingBase entitylivingbase = this.parentEntity.getAttackTarget(); + double d0 = 64.0D; + + if (entitylivingbase.getDistanceSqToEntity(this.parentEntity) < d0 * d0) + { + double d1 = entitylivingbase.posX - this.parentEntity.posX; + double d2 = entitylivingbase.posZ - this.parentEntity.posZ; + this.parentEntity.renderYawOffset = this.parentEntity.rotationYaw = -((float)MathHelper.func_181159_b(d1, d2)) * 180.0F / (float)Math.PI; + } + } + } + } + + static class AIRandomFly extends EntityAIBase + { + private EntityGhast parentEntity; + + public AIRandomFly(EntityGhast p_i45836_1_) + { + this.parentEntity = p_i45836_1_; + this.setMutexBits(1); + } + + public boolean shouldExecute() + { + EntityMoveHelper entitymovehelper = this.parentEntity.getMoveHelper(); + + if (!entitymovehelper.isUpdating()) + { + return true; + } + else + { + double d0 = entitymovehelper.getX() - this.parentEntity.posX; + double d1 = entitymovehelper.getY() - this.parentEntity.posY; + double d2 = entitymovehelper.getZ() - this.parentEntity.posZ; + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + return d3 < 1.0D || d3 > 3600.0D; + } + } + + public boolean continueExecuting() + { + return false; + } + + public void startExecuting() + { + Random random = this.parentEntity.getRNG(); + double d0 = this.parentEntity.posX + (double)((random.nextFloat() * 2.0F - 1.0F) * 16.0F); + double d1 = this.parentEntity.posY + (double)((random.nextFloat() * 2.0F - 1.0F) * 16.0F); + double d2 = this.parentEntity.posZ + (double)((random.nextFloat() * 2.0F - 1.0F) * 16.0F); + this.parentEntity.getMoveHelper().setMoveTo(d0, d1, d2, 1.0D); + } + } + + static class GhastMoveHelper extends EntityMoveHelper + { + private EntityGhast parentEntity; + private int courseChangeCooldown; + + public GhastMoveHelper(EntityGhast p_i45838_1_) + { + super(p_i45838_1_); + this.parentEntity = p_i45838_1_; + } + + public void onUpdateMoveHelper() + { + if (this.update) + { + double d0 = this.posX - this.parentEntity.posX; + double d1 = this.posY - this.parentEntity.posY; + double d2 = this.posZ - this.parentEntity.posZ; + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + + if (this.courseChangeCooldown-- <= 0) + { + this.courseChangeCooldown += this.parentEntity.getRNG().nextInt(5) + 2; + d3 = (double)MathHelper.sqrt_double(d3); + + if (this.isNotColliding(this.posX, this.posY, this.posZ, d3)) + { + this.parentEntity.motionX += d0 / d3 * 0.1D; + this.parentEntity.motionY += d1 / d3 * 0.1D; + this.parentEntity.motionZ += d2 / d3 * 0.1D; + } + else + { + this.update = false; + } + } + } + } + + private boolean isNotColliding(double p_179926_1_, double p_179926_3_, double p_179926_5_, double p_179926_7_) + { + double d0 = (p_179926_1_ - this.parentEntity.posX) / p_179926_7_; + double d1 = (p_179926_3_ - this.parentEntity.posY) / p_179926_7_; + double d2 = (p_179926_5_ - this.parentEntity.posZ) / p_179926_7_; + AxisAlignedBB axisalignedbb = this.parentEntity.getEntityBoundingBox(); + + for (int i = 1; (double)i < p_179926_7_; ++i) + { + axisalignedbb = axisalignedbb.offset(d0, d1, d2); + + if (!this.parentEntity.worldObj.getCollidingBoundingBoxes(this.parentEntity, axisalignedbb).isEmpty()) + { + return false; + } + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityGiantZombie.java b/src/minecraft/net/minecraft/entity/monster/EntityGiantZombie.java new file mode 100644 index 0000000..c6b45dc --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityGiantZombie.java @@ -0,0 +1,32 @@ +package net.minecraft.entity.monster; + +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class EntityGiantZombie extends EntityMob +{ + public EntityGiantZombie(World worldIn) + { + super(worldIn); + this.setSize(this.width * 6.0F, this.height * 6.0F); + } + + public float getEyeHeight() + { + return 10.440001F; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(50.0D); + } + + public float getBlockPathWeight(BlockPos pos) + { + return this.worldObj.getLightBrightness(pos) - 0.5F; + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityGolem.java b/src/minecraft/net/minecraft/entity/monster/EntityGolem.java new file mode 100644 index 0000000..a9a76a3 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityGolem.java @@ -0,0 +1,57 @@ +package net.minecraft.entity.monster; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.passive.IAnimals; +import net.minecraft.world.World; + +public abstract class EntityGolem extends EntityCreature implements IAnimals +{ + public EntityGolem(World worldIn) + { + super(worldIn); + } + + public void fall(float distance, float damageMultiplier) + { + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "none"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "none"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "none"; + } + + /** + * Get number of ticks, at least during which the living entity will be silent. + */ + public int getTalkInterval() + { + return 120; + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityGuardian.java b/src/minecraft/net/minecraft/entity/monster/EntityGuardian.java new file mode 100644 index 0000000..72bfa9f --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityGuardian.java @@ -0,0 +1,741 @@ +package net.minecraft.entity.monster; + +import com.google.common.base.Predicate; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.ai.EntityLookHelper; +import net.minecraft.entity.ai.EntityMoveHelper; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.projectile.EntityFishHook; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemFishFood; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.play.server.S2BPacketChangeGameState; +import net.minecraft.pathfinding.PathNavigate; +import net.minecraft.pathfinding.PathNavigateSwimmer; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.util.WeightedRandom; +import net.minecraft.util.WeightedRandomFishable; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class EntityGuardian extends EntityMob +{ + private float field_175482_b; + private float field_175484_c; + private float field_175483_bk; + private float field_175485_bl; + private float field_175486_bm; + private EntityLivingBase targetedEntity; + private int field_175479_bo; + private boolean field_175480_bp; + private EntityAIWander wander; + + public EntityGuardian(World worldIn) + { + super(worldIn); + this.experienceValue = 10; + this.setSize(0.85F, 0.85F); + this.tasks.addTask(4, new EntityGuardian.AIGuardianAttack(this)); + EntityAIMoveTowardsRestriction entityaimovetowardsrestriction; + this.tasks.addTask(5, entityaimovetowardsrestriction = new EntityAIMoveTowardsRestriction(this, 1.0D)); + this.tasks.addTask(7, this.wander = new EntityAIWander(this, 1.0D, 80)); + this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityGuardian.class, 12.0F, 0.01F)); + this.tasks.addTask(9, new EntityAILookIdle(this)); + this.wander.setMutexBits(3); + entityaimovetowardsrestriction.setMutexBits(3); + this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityLivingBase.class, 10, true, false, new EntityGuardian.GuardianTargetSelector(this))); + this.moveHelper = new EntityGuardian.GuardianMoveHelper(this); + this.field_175484_c = this.field_175482_b = this.rand.nextFloat(); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(16.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.setElder(tagCompund.getBoolean("Elder")); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setBoolean("Elder", this.isElder()); + } + + /** + * Returns new PathNavigateGround instance + */ + protected PathNavigate getNewNavigator(World worldIn) + { + return new PathNavigateSwimmer(this, worldIn); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Integer.valueOf(0)); + this.dataWatcher.addObject(17, Integer.valueOf(0)); + } + + /** + * Returns true if given flag is set + */ + private boolean isSyncedFlagSet(int flagId) + { + return (this.dataWatcher.getWatchableObjectInt(16) & flagId) != 0; + } + + /** + * Sets a flag state "on/off" on both sides (client/server) by using DataWatcher + */ + private void setSyncedFlag(int flagId, boolean state) + { + int i = this.dataWatcher.getWatchableObjectInt(16); + + if (state) + { + this.dataWatcher.updateObject(16, Integer.valueOf(i | flagId)); + } + else + { + this.dataWatcher.updateObject(16, Integer.valueOf(i & ~flagId)); + } + } + + public boolean func_175472_n() + { + return this.isSyncedFlagSet(2); + } + + private void func_175476_l(boolean p_175476_1_) + { + this.setSyncedFlag(2, p_175476_1_); + } + + public int func_175464_ck() + { + return this.isElder() ? 60 : 80; + } + + public boolean isElder() + { + return this.isSyncedFlagSet(4); + } + + /** + * Sets this Guardian to be an elder or not. + */ + public void setElder(boolean elder) + { + this.setSyncedFlag(4, elder); + + if (elder) + { + this.setSize(1.9975F, 1.9975F); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(8.0D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(80.0D); + this.enablePersistence(); + this.wander.setExecutionChance(400); + } + } + + public void setElder() + { + this.setElder(true); + this.field_175486_bm = this.field_175485_bl = 1.0F; + } + + private void setTargetedEntity(int entityId) + { + this.dataWatcher.updateObject(17, Integer.valueOf(entityId)); + } + + public boolean hasTargetedEntity() + { + return this.dataWatcher.getWatchableObjectInt(17) != 0; + } + + public EntityLivingBase getTargetedEntity() + { + if (!this.hasTargetedEntity()) + { + return null; + } + else if (this.worldObj.isRemote) + { + if (this.targetedEntity != null) + { + return this.targetedEntity; + } + else + { + Entity entity = this.worldObj.getEntityByID(this.dataWatcher.getWatchableObjectInt(17)); + + if (entity instanceof EntityLivingBase) + { + this.targetedEntity = (EntityLivingBase)entity; + return this.targetedEntity; + } + else + { + return null; + } + } + } + else + { + return this.getAttackTarget(); + } + } + + public void onDataWatcherUpdate(int dataID) + { + super.onDataWatcherUpdate(dataID); + + if (dataID == 16) + { + if (this.isElder() && this.width < 1.0F) + { + this.setSize(1.9975F, 1.9975F); + } + } + else if (dataID == 17) + { + this.field_175479_bo = 0; + this.targetedEntity = null; + } + } + + /** + * Get number of ticks, at least during which the living entity will be silent. + */ + public int getTalkInterval() + { + return 160; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return !this.isInWater() ? "mob.guardian.land.idle" : (this.isElder() ? "mob.guardian.elder.idle" : "mob.guardian.idle"); + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return !this.isInWater() ? "mob.guardian.land.hit" : (this.isElder() ? "mob.guardian.elder.hit" : "mob.guardian.hit"); + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return !this.isInWater() ? "mob.guardian.land.death" : (this.isElder() ? "mob.guardian.elder.death" : "mob.guardian.death"); + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + public float getEyeHeight() + { + return this.height * 0.5F; + } + + public float getBlockPathWeight(BlockPos pos) + { + return this.worldObj.getBlockState(pos).getBlock().getMaterial() == Material.water ? 10.0F + this.worldObj.getLightBrightness(pos) - 0.5F : super.getBlockPathWeight(pos); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.worldObj.isRemote) + { + this.field_175484_c = this.field_175482_b; + + if (!this.isInWater()) + { + this.field_175483_bk = 2.0F; + + if (this.motionY > 0.0D && this.field_175480_bp && !this.isSilent()) + { + this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.guardian.flop", 1.0F, 1.0F, false); + } + + this.field_175480_bp = this.motionY < 0.0D && this.worldObj.isBlockNormalCube((new BlockPos(this)).down(), false); + } + else if (this.func_175472_n()) + { + if (this.field_175483_bk < 0.5F) + { + this.field_175483_bk = 4.0F; + } + else + { + this.field_175483_bk += (0.5F - this.field_175483_bk) * 0.1F; + } + } + else + { + this.field_175483_bk += (0.125F - this.field_175483_bk) * 0.2F; + } + + this.field_175482_b += this.field_175483_bk; + this.field_175486_bm = this.field_175485_bl; + + if (!this.isInWater()) + { + this.field_175485_bl = this.rand.nextFloat(); + } + else if (this.func_175472_n()) + { + this.field_175485_bl += (0.0F - this.field_175485_bl) * 0.25F; + } + else + { + this.field_175485_bl += (1.0F - this.field_175485_bl) * 0.06F; + } + + if (this.func_175472_n() && this.isInWater()) + { + Vec3 vec3 = this.getLook(0.0F); + + for (int i = 0; i < 2; ++i) + { + this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width - vec3.xCoord * 1.5D, this.posY + this.rand.nextDouble() * (double)this.height - vec3.yCoord * 1.5D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width - vec3.zCoord * 1.5D, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + if (this.hasTargetedEntity()) + { + if (this.field_175479_bo < this.func_175464_ck()) + { + ++this.field_175479_bo; + } + + EntityLivingBase entitylivingbase = this.getTargetedEntity(); + + if (entitylivingbase != null) + { + this.getLookHelper().setLookPositionWithEntity(entitylivingbase, 90.0F, 90.0F); + this.getLookHelper().onUpdateLook(); + double d5 = (double)this.func_175477_p(0.0F); + double d0 = entitylivingbase.posX - this.posX; + double d1 = entitylivingbase.posY + (double)(entitylivingbase.height * 0.5F) - (this.posY + (double)this.getEyeHeight()); + double d2 = entitylivingbase.posZ - this.posZ; + double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); + d0 = d0 / d3; + d1 = d1 / d3; + d2 = d2 / d3; + double d4 = this.rand.nextDouble(); + + while (d4 < d3) + { + d4 += 1.8D - d5 + this.rand.nextDouble() * (1.7D - d5); + this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX + d0 * d4, this.posY + d1 * d4 + (double)this.getEyeHeight(), this.posZ + d2 * d4, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + } + } + + if (this.inWater) + { + this.setAir(300); + } + else if (this.onGround) + { + this.motionY += 0.5D; + this.motionX += (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 0.4F); + this.motionZ += (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 0.4F); + this.rotationYaw = this.rand.nextFloat() * 360.0F; + this.onGround = false; + this.isAirBorne = true; + } + + if (this.hasTargetedEntity()) + { + this.rotationYaw = this.rotationYawHead; + } + + super.onLivingUpdate(); + } + + public float func_175471_a(float p_175471_1_) + { + return this.field_175484_c + (this.field_175482_b - this.field_175484_c) * p_175471_1_; + } + + public float func_175469_o(float p_175469_1_) + { + return this.field_175486_bm + (this.field_175485_bl - this.field_175486_bm) * p_175469_1_; + } + + public float func_175477_p(float p_175477_1_) + { + return ((float)this.field_175479_bo + p_175477_1_) / (float)this.func_175464_ck(); + } + + protected void updateAITasks() + { + super.updateAITasks(); + + if (this.isElder()) + { + int i = 1200; + int j = 1200; + int k = 6000; + int l = 2; + + if ((this.ticksExisted + this.getEntityId()) % 1200 == 0) + { + Potion potion = Potion.digSlowdown; + + for (EntityPlayerMP entityplayermp : this.worldObj.getPlayers(EntityPlayerMP.class, new Predicate() + { + public boolean apply(EntityPlayerMP p_apply_1_) + { + return EntityGuardian.this.getDistanceSqToEntity(p_apply_1_) < 2500.0D && p_apply_1_.theItemInWorldManager.survivalOrAdventure(); + } + })) + { + if (!entityplayermp.isPotionActive(potion) || entityplayermp.getActivePotionEffect(potion).getAmplifier() < 2 || entityplayermp.getActivePotionEffect(potion).getDuration() < 1200) + { + entityplayermp.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(10, 0.0F)); + entityplayermp.addPotionEffect(new PotionEffect(potion.id, 6000, 2)); + } + } + } + + if (!this.hasHome()) + { + this.setHomePosAndDistance(new BlockPos(this), 16); + } + } + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + int i = this.rand.nextInt(3) + this.rand.nextInt(p_70628_2_ + 1); + + if (i > 0) + { + this.entityDropItem(new ItemStack(Items.prismarine_shard, i, 0), 1.0F); + } + + if (this.rand.nextInt(3 + p_70628_2_) > 1) + { + this.entityDropItem(new ItemStack(Items.fish, 1, ItemFishFood.FishType.COD.getMetadata()), 1.0F); + } + else if (this.rand.nextInt(3 + p_70628_2_) > 1) + { + this.entityDropItem(new ItemStack(Items.prismarine_crystals, 1, 0), 1.0F); + } + + if (p_70628_1_ && this.isElder()) + { + this.entityDropItem(new ItemStack(Blocks.sponge, 1, 1), 1.0F); + } + } + + /** + * Causes this Entity to drop a random item. + */ + protected void addRandomDrop() + { + ItemStack itemstack = ((WeightedRandomFishable)WeightedRandom.getRandomItem(this.rand, EntityFishHook.func_174855_j())).getItemStack(this.rand); + this.entityDropItem(itemstack, 1.0F); + } + + /** + * Checks to make sure the light is not too bright where the mob is spawning + */ + protected boolean isValidLightLevel() + { + return true; + } + + /** + * Checks that the entity is not colliding with any blocks / liquids + */ + public boolean isNotColliding() + { + return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty(); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return (this.rand.nextInt(20) == 0 || !this.worldObj.canBlockSeeSky(new BlockPos(this))) && super.getCanSpawnHere(); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (!this.func_175472_n() && !source.isMagicDamage() && source.getSourceOfDamage() instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)source.getSourceOfDamage(); + + if (!source.isExplosion()) + { + entitylivingbase.attackEntityFrom(DamageSource.causeThornsDamage(this), 2.0F); + entitylivingbase.playSound("damage.thorns", 0.5F, 1.0F); + } + } + + this.wander.makeUpdate(); + return super.attackEntityFrom(source, amount); + } + + /** + * The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently + * use in wolves. + */ + public int getVerticalFaceSpeed() + { + return 180; + } + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float strafe, float forward) + { + if (this.isServerWorld()) + { + if (this.isInWater()) + { + this.moveFlying(strafe, forward, 0.1F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.8999999761581421D; + this.motionY *= 0.8999999761581421D; + this.motionZ *= 0.8999999761581421D; + + if (!this.func_175472_n() && this.getAttackTarget() == null) + { + this.motionY -= 0.005D; + } + } + else + { + super.moveEntityWithHeading(strafe, forward); + } + } + else + { + super.moveEntityWithHeading(strafe, forward); + } + } + + static class AIGuardianAttack extends EntityAIBase + { + private EntityGuardian theEntity; + private int tickCounter; + + public AIGuardianAttack(EntityGuardian p_i45833_1_) + { + this.theEntity = p_i45833_1_; + this.setMutexBits(3); + } + + public boolean shouldExecute() + { + EntityLivingBase entitylivingbase = this.theEntity.getAttackTarget(); + return entitylivingbase != null && entitylivingbase.isEntityAlive(); + } + + public boolean continueExecuting() + { + return super.continueExecuting() && (this.theEntity.isElder() || this.theEntity.getDistanceSqToEntity(this.theEntity.getAttackTarget()) > 9.0D); + } + + public void startExecuting() + { + this.tickCounter = -10; + this.theEntity.getNavigator().clearPathEntity(); + this.theEntity.getLookHelper().setLookPositionWithEntity(this.theEntity.getAttackTarget(), 90.0F, 90.0F); + this.theEntity.isAirBorne = true; + } + + public void resetTask() + { + this.theEntity.setTargetedEntity(0); + this.theEntity.setAttackTarget((EntityLivingBase)null); + this.theEntity.wander.makeUpdate(); + } + + public void updateTask() + { + EntityLivingBase entitylivingbase = this.theEntity.getAttackTarget(); + this.theEntity.getNavigator().clearPathEntity(); + this.theEntity.getLookHelper().setLookPositionWithEntity(entitylivingbase, 90.0F, 90.0F); + + if (!this.theEntity.canEntityBeSeen(entitylivingbase)) + { + this.theEntity.setAttackTarget((EntityLivingBase)null); + } + else + { + ++this.tickCounter; + + if (this.tickCounter == 0) + { + this.theEntity.setTargetedEntity(this.theEntity.getAttackTarget().getEntityId()); + this.theEntity.worldObj.setEntityState(this.theEntity, (byte)21); + } + else if (this.tickCounter >= this.theEntity.func_175464_ck()) + { + float f = 1.0F; + + if (this.theEntity.worldObj.getDifficulty() == EnumDifficulty.HARD) + { + f += 2.0F; + } + + if (this.theEntity.isElder()) + { + f += 2.0F; + } + + entitylivingbase.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this.theEntity, this.theEntity), f); + entitylivingbase.attackEntityFrom(DamageSource.causeMobDamage(this.theEntity), (float)this.theEntity.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue()); + this.theEntity.setAttackTarget((EntityLivingBase)null); + } + else if (this.tickCounter >= 60 && this.tickCounter % 20 == 0) + { + ; + } + + super.updateTask(); + } + } + } + + static class GuardianMoveHelper extends EntityMoveHelper + { + private EntityGuardian entityGuardian; + + public GuardianMoveHelper(EntityGuardian p_i45831_1_) + { + super(p_i45831_1_); + this.entityGuardian = p_i45831_1_; + } + + public void onUpdateMoveHelper() + { + if (this.update && !this.entityGuardian.getNavigator().noPath()) + { + double d0 = this.posX - this.entityGuardian.posX; + double d1 = this.posY - this.entityGuardian.posY; + double d2 = this.posZ - this.entityGuardian.posZ; + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + d3 = (double)MathHelper.sqrt_double(d3); + d1 = d1 / d3; + float f = (float)(MathHelper.func_181159_b(d2, d0) * 180.0D / Math.PI) - 90.0F; + this.entityGuardian.rotationYaw = this.limitAngle(this.entityGuardian.rotationYaw, f, 30.0F); + this.entityGuardian.renderYawOffset = this.entityGuardian.rotationYaw; + float f1 = (float)(this.speed * this.entityGuardian.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue()); + this.entityGuardian.setAIMoveSpeed(this.entityGuardian.getAIMoveSpeed() + (f1 - this.entityGuardian.getAIMoveSpeed()) * 0.125F); + double d4 = Math.sin((double)(this.entityGuardian.ticksExisted + this.entityGuardian.getEntityId()) * 0.5D) * 0.05D; + double d5 = Math.cos((double)(this.entityGuardian.rotationYaw * (float)Math.PI / 180.0F)); + double d6 = Math.sin((double)(this.entityGuardian.rotationYaw * (float)Math.PI / 180.0F)); + this.entityGuardian.motionX += d4 * d5; + this.entityGuardian.motionZ += d4 * d6; + d4 = Math.sin((double)(this.entityGuardian.ticksExisted + this.entityGuardian.getEntityId()) * 0.75D) * 0.05D; + this.entityGuardian.motionY += d4 * (d6 + d5) * 0.25D; + this.entityGuardian.motionY += (double)this.entityGuardian.getAIMoveSpeed() * d1 * 0.1D; + EntityLookHelper entitylookhelper = this.entityGuardian.getLookHelper(); + double d7 = this.entityGuardian.posX + d0 / d3 * 2.0D; + double d8 = (double)this.entityGuardian.getEyeHeight() + this.entityGuardian.posY + d1 / d3 * 1.0D; + double d9 = this.entityGuardian.posZ + d2 / d3 * 2.0D; + double d10 = entitylookhelper.getLookPosX(); + double d11 = entitylookhelper.getLookPosY(); + double d12 = entitylookhelper.getLookPosZ(); + + if (!entitylookhelper.getIsLooking()) + { + d10 = d7; + d11 = d8; + d12 = d9; + } + + this.entityGuardian.getLookHelper().setLookPosition(d10 + (d7 - d10) * 0.125D, d11 + (d8 - d11) * 0.125D, d12 + (d9 - d12) * 0.125D, 10.0F, 40.0F); + this.entityGuardian.func_175476_l(true); + } + else + { + this.entityGuardian.setAIMoveSpeed(0.0F); + this.entityGuardian.func_175476_l(false); + } + } + } + + static class GuardianTargetSelector implements Predicate + { + private EntityGuardian parentEntity; + + public GuardianTargetSelector(EntityGuardian p_i45832_1_) + { + this.parentEntity = p_i45832_1_; + } + + public boolean apply(EntityLivingBase p_apply_1_) + { + return (p_apply_1_ instanceof EntityPlayer || p_apply_1_ instanceof EntitySquid) && p_apply_1_.getDistanceSqToEntity(this.parentEntity) > 9.0D; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityIronGolem.java b/src/minecraft/net/minecraft/entity/monster/EntityIronGolem.java new file mode 100644 index 0000000..604bc3e --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityIronGolem.java @@ -0,0 +1,353 @@ +package net.minecraft.entity.monster; + +import com.google.common.base.Predicate; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIDefendVillage; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookAtVillager; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIMoveThroughVillage; +import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; +import net.minecraft.entity.ai.EntityAIMoveTowardsTarget; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.village.Village; +import net.minecraft.world.World; + +public class EntityIronGolem extends EntityGolem +{ + /** deincrements, and a distance-to-home check is done at 0 */ + private int homeCheckTimer; + Village villageObj; + private int attackTimer; + private int holdRoseTick; + + public EntityIronGolem(World worldIn) + { + super(worldIn); + this.setSize(1.4F, 2.9F); + ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); + this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); + this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); + this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); + this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); + this.tasks.addTask(5, new EntityAILookAtVillager(this)); + this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); + this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIDefendVillage(this)); + this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false, new Class[0])); + this.targetTasks.addTask(3, new EntityIronGolem.AINearestAttackableTargetNonCreeper(this, EntityLiving.class, 10, false, true, IMob.VISIBLE_MOB_SELECTOR)); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + protected void updateAITasks() + { + if (--this.homeCheckTimer <= 0) + { + this.homeCheckTimer = 70 + this.rand.nextInt(50); + this.villageObj = this.worldObj.getVillageCollection().getNearestVillage(new BlockPos(this), 32); + + if (this.villageObj == null) + { + this.detachHome(); + } + else + { + BlockPos blockpos = this.villageObj.getCenter(); + this.setHomePosAndDistance(blockpos, (int)((float)this.villageObj.getVillageRadius() * 0.6F)); + } + } + + super.updateAITasks(); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); + } + + /** + * Decrements the entity's air supply when underwater + */ + protected int decreaseAirSupply(int p_70682_1_) + { + return p_70682_1_; + } + + protected void collideWithEntity(Entity p_82167_1_) + { + if (p_82167_1_ instanceof IMob && !(p_82167_1_ instanceof EntityCreeper) && this.getRNG().nextInt(20) == 0) + { + this.setAttackTarget((EntityLivingBase)p_82167_1_); + } + + super.collideWithEntity(p_82167_1_); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (this.attackTimer > 0) + { + --this.attackTimer; + } + + if (this.holdRoseTick > 0) + { + --this.holdRoseTick; + } + + if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D && this.rand.nextInt(5) == 0) + { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.posY - 0.20000000298023224D); + int k = MathHelper.floor_double(this.posZ); + IBlockState iblockstate = this.worldObj.getBlockState(new BlockPos(i, j, k)); + Block block = iblockstate.getBlock(); + + if (block.getMaterial() != Material.air) + { + this.worldObj.spawnParticle(EnumParticleTypes.BLOCK_CRACK, this.posX + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, this.getEntityBoundingBox().minY + 0.1D, this.posZ + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, 4.0D * ((double)this.rand.nextFloat() - 0.5D), 0.5D, ((double)this.rand.nextFloat() - 0.5D) * 4.0D, new int[] {Block.getStateId(iblockstate)}); + } + } + } + + /** + * Returns true if this entity can attack entities of the specified class. + */ +// public boolean canAttackClass(Class cls) +// { +// return this.isPlayerCreated() && EntityPlayer.class.isAssignableFrom(cls) ? false : (cls == EntityCreeper.class ? false : super.canAttackClass(cls)); +// } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setBoolean("PlayerCreated", this.isPlayerCreated()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.setPlayerCreated(tagCompund.getBoolean("PlayerCreated")); + } + + public boolean attackEntityAsMob(Entity entityIn) + { + this.attackTimer = 10; + this.worldObj.setEntityState(this, (byte)4); + boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(7 + this.rand.nextInt(15))); + + if (flag) + { + entityIn.motionY += 0.4000000059604645D; + this.applyEnchantments(this, entityIn); + } + + this.playSound("mob.irongolem.throw", 1.0F, 1.0F); + return flag; + } + + public void handleStatusUpdate(byte id) + { + if (id == 4) + { + this.attackTimer = 10; + this.playSound("mob.irongolem.throw", 1.0F, 1.0F); + } + else if (id == 11) + { + this.holdRoseTick = 400; + } + else + { + super.handleStatusUpdate(id); + } + } + + public Village getVillage() + { + return this.villageObj; + } + + public int getAttackTimer() + { + return this.attackTimer; + } + + public void setHoldingRose(boolean p_70851_1_) + { + this.holdRoseTick = p_70851_1_ ? 400 : 0; + this.worldObj.setEntityState(this, (byte)11); + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.irongolem.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.irongolem.death"; + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound("mob.irongolem.walk", 1.0F, 1.0F); + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + int i = this.rand.nextInt(3); + + for (int j = 0; j < i; ++j) + { + this.dropItemWithOffset(Item.getItemFromBlock(Blocks.red_flower), 1, (float)BlockFlower.EnumFlowerType.POPPY.getMeta()); + } + + int l = 3 + this.rand.nextInt(3); + + for (int k = 0; k < l; ++k) + { + this.dropItem(Items.iron_ingot, 1); + } + } + + public int getHoldRoseTick() + { + return this.holdRoseTick; + } + + public boolean isPlayerCreated() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + public void setPlayerCreated(boolean p_70849_1_) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + if (p_70849_1_) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2))); + } + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource cause) + { + if (!this.isPlayerCreated() && this.attackingPlayer != null && this.villageObj != null) + { + this.villageObj.setReputationForPlayer(this.attackingPlayer.getName(), -5); + } + + super.onDeath(cause); + } + + static class AINearestAttackableTargetNonCreeper extends EntityAINearestAttackableTarget + { + public AINearestAttackableTargetNonCreeper(final EntityCreature creature, Class classTarget, int chance, boolean p_i45858_4_, boolean p_i45858_5_, final Predicate p_i45858_6_) + { + super(creature, classTarget, chance, p_i45858_4_, p_i45858_5_, p_i45858_6_); + this.targetEntitySelector = new Predicate() + { + public boolean apply(T p_apply_1_) + { + if (p_i45858_6_ != null && !p_i45858_6_.apply(p_apply_1_)) + { + return false; + } + else if (p_apply_1_ instanceof EntityCreeper) + { + return false; + } + else + { + if (p_apply_1_ instanceof EntityPlayer) + { + double d0 = AINearestAttackableTargetNonCreeper.this.getTargetDistance(); + + if (p_apply_1_.isSneaking()) + { + d0 *= 0.800000011920929D; + } + + if (p_apply_1_.isInvisible()) + { + float f = ((EntityPlayer)p_apply_1_).getArmorVisibility(); + + if (f < 0.1F) + { + f = 0.1F; + } + + d0 *= (double)(0.7F * f); + } + + if ((double)p_apply_1_.getDistanceToEntity(creature) > d0) + { + return false; + } + } + + return AINearestAttackableTargetNonCreeper.this.isSuitableTarget(p_apply_1_, false); + } + } + }; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java b/src/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java new file mode 100644 index 0000000..c696d9a --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityMagmaCube.java @@ -0,0 +1,170 @@ +package net.minecraft.entity.monster; + +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class EntityMagmaCube extends EntitySlime +{ + public EntityMagmaCube(World worldIn) + { + super(worldIn); + this.isImmuneToFire = true; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.20000000298023224D); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL; + } + + /** + * Checks that the entity is not colliding with any blocks / liquids + */ + public boolean isNotColliding() + { + return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()); + } + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + return this.getSlimeSize() * 3; + } + + public int getBrightnessForRender(float partialTicks) + { + return 15728880; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float partialTicks) + { + return 1.0F; + } + + protected EnumParticleTypes getParticleType() + { + return EnumParticleTypes.FLAME; + } + + protected EntitySlime createInstance() + { + return new EntityMagmaCube(this.worldObj); + } + + protected Item getDropItem() + { + return Items.magma_cream; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + Item item = this.getDropItem(); + + if (item != null && this.getSlimeSize() > 1) + { + int i = this.rand.nextInt(4) - 2; + + if (p_70628_2_ > 0) + { + i += this.rand.nextInt(p_70628_2_ + 1); + } + + for (int j = 0; j < i; ++j) + { + this.dropItem(item, 1); + } + } + } + + /** + * Returns true if the entity is on fire. Used by render to add the fire effect on rendering. + */ + public boolean isBurning() + { + return false; + } + + /** + * Gets the amount of time the slime needs to wait between jumps. + */ + protected int getJumpDelay() + { + return super.getJumpDelay() * 4; + } + + protected void alterSquishAmount() + { + this.squishAmount *= 0.9F; + } + + /** + * Causes this entity to do an upwards motion (jumping). + */ + protected void jump() + { + this.motionY = (double)(0.42F + (float)this.getSlimeSize() * 0.1F); + this.isAirBorne = true; + } + + protected void handleJumpLava() + { + this.motionY = (double)(0.22F + (float)this.getSlimeSize() * 0.05F); + this.isAirBorne = true; + } + + public void fall(float distance, float damageMultiplier) + { + } + + /** + * Indicates weather the slime is able to damage the player (based upon the slime's size) + */ + protected boolean canDamagePlayer() + { + return true; + } + + /** + * Gets the amount of damage dealt to the player when "attacked" by the slime. + */ + protected int getAttackStrength() + { + return super.getAttackStrength() + 2; + } + + /** + * Returns the name of the sound played when the slime jumps. + */ + protected String getJumpSound() + { + return this.getSlimeSize() > 1 ? "mob.magmacube.big" : "mob.magmacube.small"; + } + + /** + * Returns true if the slime makes a sound when it lands after a jump (based upon the slime's size) + */ + protected boolean makesSoundOnLand() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityMob.java b/src/minecraft/net/minecraft/entity/monster/EntityMob.java new file mode 100644 index 0000000..911000d --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityMob.java @@ -0,0 +1,192 @@ +package net.minecraft.entity.monster; + +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.World; + +public abstract class EntityMob extends EntityCreature implements IMob +{ + public EntityMob(World worldIn) + { + super(worldIn); + this.experienceValue = 5; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + this.updateArmSwingProgress(); + float f = this.getBrightness(1.0F); + + if (f > 0.5F) + { + this.entityAge += 2; + } + + super.onLivingUpdate(); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL) + { + this.setDead(); + } + } + + protected String getSwimSound() + { + return "game.hostile.swim"; + } + + protected String getSplashSound() + { + return "game.hostile.swim.splash"; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else if (super.attackEntityFrom(source, amount)) + { + Entity entity = source.getEntity(); + return this.riddenByEntity != entity && this.ridingEntity != entity ? true : true; + } + else + { + return false; + } + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "game.hostile.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "game.hostile.die"; + } + + protected String getFallSoundString(int damageValue) + { + return damageValue > 4 ? "game.hostile.hurt.fall.big" : "game.hostile.hurt.fall.small"; + } + + public boolean attackEntityAsMob(Entity entityIn) + { + float f = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); + int i = 0; + + if (entityIn instanceof EntityLivingBase) + { + f += EnchantmentHelper.func_152377_a(this.getHeldItem(), ((EntityLivingBase)entityIn).getCreatureAttribute()); + i += EnchantmentHelper.getKnockbackModifier(this); + } + + boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), f); + + if (flag) + { + if (i > 0) + { + entityIn.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F)); + this.motionX *= 0.6D; + this.motionZ *= 0.6D; + } + + int j = EnchantmentHelper.getFireAspectModifier(this); + + if (j > 0) + { + entityIn.setFire(j * 4); + } + + this.applyEnchantments(this, entityIn); + } + + return flag; + } + + public float getBlockPathWeight(BlockPos pos) + { + return 0.5F - this.worldObj.getLightBrightness(pos); + } + + /** + * Checks to make sure the light is not too bright where the mob is spawning + */ + protected boolean isValidLightLevel() + { + BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ); + + if (this.worldObj.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32)) + { + return false; + } + else + { + int i = this.worldObj.getLightFromNeighbors(blockpos); + + if (this.worldObj.isThundering()) + { + int j = this.worldObj.getSkylightSubtracted(); + this.worldObj.setSkylightSubtracted(10); + i = this.worldObj.getLightFromNeighbors(blockpos); + this.worldObj.setSkylightSubtracted(j); + } + + return i <= this.rand.nextInt(8); + } + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL && this.isValidLightLevel() && super.getCanSpawnHere(); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); + } + + /** + * Entity won't drop items or experience points if this returns false + */ + protected boolean canDropLoot() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityPigZombie.java b/src/minecraft/net/minecraft/entity/monster/EntityPigZombie.java new file mode 100644 index 0000000..260d504 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityPigZombie.java @@ -0,0 +1,313 @@ +package net.minecraft.entity.monster; + +import java.util.UUID; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class EntityPigZombie extends EntityZombie +{ + private static final UUID ATTACK_SPEED_BOOST_MODIFIER_UUID = UUID.fromString("49455A49-7EC5-45BA-B886-3B90B23A1718"); + private static final AttributeModifier ATTACK_SPEED_BOOST_MODIFIER = (new AttributeModifier(ATTACK_SPEED_BOOST_MODIFIER_UUID, "Attacking speed boost", 0.05D, 0)).setSaved(false); + + /** Above zero if this PigZombie is Angry. */ + private int angerLevel; + + /** A random delay until this PigZombie next makes a sound. */ + private int randomSoundDelay; + private UUID angerTargetUUID; + + public EntityPigZombie(World worldIn) + { + super(worldIn); + this.isImmuneToFire = true; + } + + public void setRevengeTarget(EntityLivingBase livingBase) + { + super.setRevengeTarget(livingBase); + + if (livingBase != null) + { + this.angerTargetUUID = livingBase.getUniqueID(); + } + } + + protected void applyEntityAI() + { + this.targetTasks.addTask(1, new EntityPigZombie.AIHurtByAggressor(this)); + this.targetTasks.addTask(2, new EntityPigZombie.AITargetAggressor(this)); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(reinforcementChance).setBaseValue(0.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + } + + protected void updateAITasks() + { + IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + + if (this.isAngry()) + { + if (!this.isChild() && !iattributeinstance.hasModifier(ATTACK_SPEED_BOOST_MODIFIER)) + { + iattributeinstance.applyModifier(ATTACK_SPEED_BOOST_MODIFIER); + } + + --this.angerLevel; + } + else if (iattributeinstance.hasModifier(ATTACK_SPEED_BOOST_MODIFIER)) + { + iattributeinstance.removeModifier(ATTACK_SPEED_BOOST_MODIFIER); + } + + if (this.randomSoundDelay > 0 && --this.randomSoundDelay == 0) + { + this.playSound("mob.zombiepig.zpigangry", this.getSoundVolume() * 2.0F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 1.8F); + } + + if (this.angerLevel > 0 && this.angerTargetUUID != null && this.getAITarget() == null) + { + EntityPlayer entityplayer = this.worldObj.getPlayerEntityByUUID(this.angerTargetUUID); + this.setRevengeTarget(entityplayer); + this.attackingPlayer = entityplayer; + this.recentlyHit = this.getRevengeTimer(); + } + + super.updateAITasks(); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL; + } + + /** + * Checks that the entity is not colliding with any blocks / liquids + */ + public boolean isNotColliding() + { + return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setShort("Anger", (short)this.angerLevel); + + if (this.angerTargetUUID != null) + { + tagCompound.setString("HurtBy", this.angerTargetUUID.toString()); + } + else + { + tagCompound.setString("HurtBy", ""); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.angerLevel = tagCompund.getShort("Anger"); + String s = tagCompund.getString("HurtBy"); + + if (s.length() > 0) + { + this.angerTargetUUID = UUID.fromString(s); + EntityPlayer entityplayer = this.worldObj.getPlayerEntityByUUID(this.angerTargetUUID); + this.setRevengeTarget(entityplayer); + + if (entityplayer != null) + { + this.attackingPlayer = entityplayer; + this.recentlyHit = this.getRevengeTimer(); + } + } + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + Entity entity = source.getEntity(); + + if (entity instanceof EntityPlayer) + { + this.becomeAngryAt(entity); + } + + return super.attackEntityFrom(source, amount); + } + } + + /** + * Causes this PigZombie to become angry at the supplied Entity (which will be a player). + */ + private void becomeAngryAt(Entity p_70835_1_) + { + this.angerLevel = 400 + this.rand.nextInt(400); + this.randomSoundDelay = this.rand.nextInt(40); + + if (p_70835_1_ instanceof EntityLivingBase) + { + this.setRevengeTarget((EntityLivingBase)p_70835_1_); + } + } + + public boolean isAngry() + { + return this.angerLevel > 0; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.zombiepig.zpig"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.zombiepig.zpighurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.zombiepig.zpigdeath"; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + int i = this.rand.nextInt(2 + p_70628_2_); + + for (int j = 0; j < i; ++j) + { + this.dropItem(Items.rotten_flesh, 1); + } + + i = this.rand.nextInt(2 + p_70628_2_); + + for (int k = 0; k < i; ++k) + { + this.dropItem(Items.gold_nugget, 1); + } + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer player) + { + return false; + } + + /** + * Causes this Entity to drop a random item. + */ + protected void addRandomDrop() + { + this.dropItem(Items.gold_ingot, 1); + } + + /** + * Gives armor or weapon for entity based on given DifficultyInstance + */ + protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) + { + this.setCurrentItemOrArmor(0, new ItemStack(Items.golden_sword)); + } + + /** + * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called + * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory + */ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + super.onInitialSpawn(difficulty, livingdata); + this.setVillager(false); + return livingdata; + } + + static class AIHurtByAggressor extends EntityAIHurtByTarget + { + public AIHurtByAggressor(EntityPigZombie p_i45828_1_) + { + super(p_i45828_1_, true, new Class[0]); + } + + protected void setEntityAttackTarget(EntityCreature creatureIn, EntityLivingBase entityLivingBaseIn) + { + super.setEntityAttackTarget(creatureIn, entityLivingBaseIn); + + if (creatureIn instanceof EntityPigZombie) + { + ((EntityPigZombie)creatureIn).becomeAngryAt(entityLivingBaseIn); + } + } + } + + static class AITargetAggressor extends EntityAINearestAttackableTarget + { + public AITargetAggressor(EntityPigZombie p_i45829_1_) + { + super(p_i45829_1_, EntityPlayer.class, true); + } + + public boolean shouldExecute() + { + return ((EntityPigZombie)this.taskOwner).isAngry() && super.shouldExecute(); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntitySilverfish.java b/src/minecraft/net/minecraft/entity/monster/EntitySilverfish.java new file mode 100644 index 0000000..9b4e9af --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntitySilverfish.java @@ -0,0 +1,306 @@ +package net.minecraft.entity.monster; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockSilverfish; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class EntitySilverfish extends EntityMob +{ + private EntitySilverfish.AISummonSilverfish summonSilverfish; + + public EntitySilverfish(World worldIn) + { + super(worldIn); + this.setSize(0.4F, 0.3F); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(3, this.summonSilverfish = new EntitySilverfish.AISummonSilverfish(this)); + this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); + this.tasks.addTask(5, new EntitySilverfish.AIHideInStone(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[0])); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); + } + + /** + * Returns the Y Offset of this entity. + */ + public double getYOffset() + { + return 0.2D; + } + + public float getEyeHeight() + { + return 0.1F; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D); + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.silverfish.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.silverfish.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.silverfish.kill"; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + if (source instanceof EntityDamageSource || source == DamageSource.magic) + { + this.summonSilverfish.func_179462_f(); + } + + return super.attackEntityFrom(source, amount); + } + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound("mob.silverfish.step", 0.15F, 1.0F); + } + + protected Item getDropItem() + { + return null; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.renderYawOffset = this.rotationYaw; + super.onUpdate(); + } + + public float getBlockPathWeight(BlockPos pos) + { + return this.worldObj.getBlockState(pos.down()).getBlock() == Blocks.stone ? 10.0F : super.getBlockPathWeight(pos); + } + + /** + * Checks to make sure the light is not too bright where the mob is spawning + */ + protected boolean isValidLightLevel() + { + return true; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + if (super.getCanSpawnHere()) + { + EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, 5.0D); + return entityplayer == null; + } + else + { + return false; + } + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.ARTHROPOD; + } + + static class AIHideInStone extends EntityAIWander + { + private final EntitySilverfish field_179485_a; + private EnumFacing facing; + private boolean field_179484_c; + + public AIHideInStone(EntitySilverfish p_i45827_1_) + { + super(p_i45827_1_, 1.0D, 10); + this.field_179485_a = p_i45827_1_; + this.setMutexBits(1); + } + + public boolean shouldExecute() + { + if (this.field_179485_a.getAttackTarget() != null) + { + return false; + } + else if (!this.field_179485_a.getNavigator().noPath()) + { + return false; + } + else + { + Random random = this.field_179485_a.getRNG(); + + if (random.nextInt(10) == 0) + { + this.facing = EnumFacing.random(random); + BlockPos blockpos = (new BlockPos(this.field_179485_a.posX, this.field_179485_a.posY + 0.5D, this.field_179485_a.posZ)).offset(this.facing); + IBlockState iblockstate = this.field_179485_a.worldObj.getBlockState(blockpos); + + if (BlockSilverfish.canContainSilverfish(iblockstate)) + { + this.field_179484_c = true; + return true; + } + } + + this.field_179484_c = false; + return super.shouldExecute(); + } + } + + public boolean continueExecuting() + { + return this.field_179484_c ? false : super.continueExecuting(); + } + + public void startExecuting() + { + if (!this.field_179484_c) + { + super.startExecuting(); + } + else + { + World world = this.field_179485_a.worldObj; + BlockPos blockpos = (new BlockPos(this.field_179485_a.posX, this.field_179485_a.posY + 0.5D, this.field_179485_a.posZ)).offset(this.facing); + IBlockState iblockstate = world.getBlockState(blockpos); + + if (BlockSilverfish.canContainSilverfish(iblockstate)) + { + world.setBlockState(blockpos, Blocks.monster_egg.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.forModelBlock(iblockstate)), 3); + this.field_179485_a.spawnExplosionParticle(); + this.field_179485_a.setDead(); + } + } + } + } + + static class AISummonSilverfish extends EntityAIBase + { + private EntitySilverfish silverfish; + private int field_179463_b; + + public AISummonSilverfish(EntitySilverfish p_i45826_1_) + { + this.silverfish = p_i45826_1_; + } + + public void func_179462_f() + { + if (this.field_179463_b == 0) + { + this.field_179463_b = 20; + } + } + + public boolean shouldExecute() + { + return this.field_179463_b > 0; + } + + public void updateTask() + { + --this.field_179463_b; + + if (this.field_179463_b <= 0) + { + World world = this.silverfish.worldObj; + Random random = this.silverfish.getRNG(); + BlockPos blockpos = new BlockPos(this.silverfish); + + for (int i = 0; i <= 5 && i >= -5; i = i <= 0 ? 1 - i : 0 - i) + { + for (int j = 0; j <= 10 && j >= -10; j = j <= 0 ? 1 - j : 0 - j) + { + for (int k = 0; k <= 10 && k >= -10; k = k <= 0 ? 1 - k : 0 - k) + { + BlockPos blockpos1 = blockpos.add(j, i, k); + IBlockState iblockstate = world.getBlockState(blockpos1); + + if (iblockstate.getBlock() == Blocks.monster_egg) + { + if (world.getGameRules().getBoolean("mobGriefing")) + { + world.destroyBlock(blockpos1, true); + } + else + { + world.setBlockState(blockpos1, ((BlockSilverfish.EnumType)iblockstate.getValue(BlockSilverfish.VARIANT)).getModelBlock(), 3); + } + + if (random.nextBoolean()) + { + return; + } + } + } + } + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntitySkeleton.java b/src/minecraft/net/minecraft/entity/monster/EntitySkeleton.java new file mode 100644 index 0000000..2689f52 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntitySkeleton.java @@ -0,0 +1,438 @@ +package net.minecraft.entity.monster; + +import java.util.Calendar; +import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.IRangedAttackMob; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIArrowAttack; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIAvoidEntity; +import net.minecraft.entity.ai.EntityAIFleeSun; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAIRestrictSun; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.World; +import net.minecraft.world.WorldProviderHell; + +public class EntitySkeleton extends EntityMob implements IRangedAttackMob +{ + private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F); + private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); + + public EntitySkeleton(World worldIn) + { + super(worldIn); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIRestrictSun(this)); + this.tasks.addTask(3, new EntityAIFleeSun(this, 1.0D)); + this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityWolf.class, 6.0F, 1.0D, 1.2D)); + this.tasks.addTask(4, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(6, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); + this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityIronGolem.class, true)); + + if (worldIn != null && !worldIn.isRemote) + { + this.setCombatTask(); + } + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(13, new Byte((byte)0)); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.skeleton.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.skeleton.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.skeleton.death"; + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound("mob.skeleton.step", 0.15F, 1.0F); + } + + public boolean attackEntityAsMob(Entity entityIn) + { + if (super.attackEntityAsMob(entityIn)) + { + if (this.getSkeletonType() == 1 && entityIn instanceof EntityLivingBase) + { + ((EntityLivingBase)entityIn).addPotionEffect(new PotionEffect(Potion.wither.id, 200)); + } + + return true; + } + else + { + return false; + } + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.UNDEAD; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.worldObj.isDaytime() && !this.worldObj.isRemote) + { + float f = this.getBrightness(1.0F); + BlockPos blockpos = new BlockPos(this.posX, (double)Math.round(this.posY), this.posZ); + + if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.worldObj.canSeeSky(blockpos)) + { + boolean flag = true; + ItemStack itemstack = this.getEquipmentInSlot(4); + + if (itemstack != null) + { + if (itemstack.isItemStackDamageable()) + { + itemstack.setItemDamage(itemstack.getItemDamage() + this.rand.nextInt(2)); + + if (itemstack.getItemDamage() >= itemstack.getMaxDamage()) + { + this.renderBrokenItemStack(itemstack); + this.setCurrentItemOrArmor(4, (ItemStack)null); + } + } + + flag = false; + } + + if (flag) + { + this.setFire(8); + } + } + } + + if (this.worldObj.isRemote && this.getSkeletonType() == 1) + { + this.setSize(0.72F, 2.535F); + } + + super.onLivingUpdate(); + } + + /** + * Handles updating while being ridden by an entity + */ + public void updateRidden() + { + super.updateRidden(); + + if (this.ridingEntity instanceof EntityCreature) + { + EntityCreature entitycreature = (EntityCreature)this.ridingEntity; + this.renderYawOffset = entitycreature.renderYawOffset; + } + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource cause) + { + super.onDeath(cause); + + if (cause.getSourceOfDamage() instanceof EntityArrow && cause.getEntity() instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)cause.getEntity(); + double d0 = entityplayer.posX - this.posX; + double d1 = entityplayer.posZ - this.posZ; + + if (d0 * d0 + d1 * d1 >= 2500.0D) + { + entityplayer.triggerAchievement(AchievementList.snipeSkeleton); + } + } + else if (cause.getEntity() instanceof EntityCreeper && ((EntityCreeper)cause.getEntity()).getPowered() && ((EntityCreeper)cause.getEntity()).isAIEnabled()) + { + ((EntityCreeper)cause.getEntity()).func_175493_co(); + this.entityDropItem(new ItemStack(Items.skull, 1, this.getSkeletonType() == 1 ? 1 : 0), 0.0F); + } + } + + protected Item getDropItem() + { + return Items.arrow; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + if (this.getSkeletonType() == 1) + { + int i = this.rand.nextInt(3 + p_70628_2_) - 1; + + for (int j = 0; j < i; ++j) + { + this.dropItem(Items.coal, 1); + } + } + else + { + int k = this.rand.nextInt(3 + p_70628_2_); + + for (int i1 = 0; i1 < k; ++i1) + { + this.dropItem(Items.arrow, 1); + } + } + + int l = this.rand.nextInt(3 + p_70628_2_); + + for (int j1 = 0; j1 < l; ++j1) + { + this.dropItem(Items.bone, 1); + } + } + + /** + * Causes this Entity to drop a random item. + */ + protected void addRandomDrop() + { + if (this.getSkeletonType() == 1) + { + this.entityDropItem(new ItemStack(Items.skull, 1, 1), 0.0F); + } + } + + /** + * Gives armor or weapon for entity based on given DifficultyInstance + */ + protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) + { + super.setEquipmentBasedOnDifficulty(difficulty); + this.setCurrentItemOrArmor(0, new ItemStack(Items.bow)); + } + + /** + * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called + * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory + */ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + livingdata = super.onInitialSpawn(difficulty, livingdata); + + if (this.worldObj.provider instanceof WorldProviderHell && this.getRNG().nextInt(5) > 0) + { + this.tasks.addTask(4, this.aiAttackOnCollide); + this.setSkeletonType(1); + this.setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword)); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D); + } + else + { + this.tasks.addTask(4, this.aiArrowAttack); + this.setEquipmentBasedOnDifficulty(difficulty); + this.setEnchantmentBasedOnDifficulty(difficulty); + } + + this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * difficulty.getClampedAdditionalDifficulty()); + + if (this.getEquipmentInSlot(4) == null) + { + Calendar calendar = this.worldObj.getCurrentDate(); + + if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.rand.nextFloat() < 0.25F) + { + this.setCurrentItemOrArmor(4, new ItemStack(this.rand.nextFloat() < 0.1F ? Blocks.lit_pumpkin : Blocks.pumpkin)); + this.equipmentDropChances[4] = 0.0F; + } + } + + return livingdata; + } + + /** + * sets this entity's combat AI. + */ + public void setCombatTask() + { + this.tasks.removeTask(this.aiAttackOnCollide); + this.tasks.removeTask(this.aiArrowAttack); + ItemStack itemstack = this.getHeldItem(); + + if (itemstack != null && itemstack.getItem() == Items.bow) + { + this.tasks.addTask(4, this.aiArrowAttack); + } + else + { + this.tasks.addTask(4, this.aiAttackOnCollide); + } + } + + /** + * Attack the specified entity using a ranged attack. + */ + public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_) + { + EntityArrow entityarrow = new EntityArrow(this.worldObj, this, p_82196_1_, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4)); + int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem()); + int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem()); + entityarrow.setDamage((double)(p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.getDifficulty().getDifficultyId() * 0.11F)); + + if (i > 0) + { + entityarrow.setDamage(entityarrow.getDamage() + (double)i * 0.5D + 0.5D); + } + + if (j > 0) + { + entityarrow.setKnockbackStrength(j); + } + + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0 || this.getSkeletonType() == 1) + { + entityarrow.setFire(100); + } + + this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); + this.worldObj.spawnEntityInWorld(entityarrow); + } + + /** + * Return this skeleton's type. + */ + public int getSkeletonType() + { + return this.dataWatcher.getWatchableObjectByte(13); + } + + /** + * Set this skeleton's type. + */ + public void setSkeletonType(int p_82201_1_) + { + this.dataWatcher.updateObject(13, Byte.valueOf((byte)p_82201_1_)); + this.isImmuneToFire = p_82201_1_ == 1; + + if (p_82201_1_ == 1) + { + this.setSize(0.72F, 2.535F); + } + else + { + this.setSize(0.6F, 1.95F); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + + if (tagCompund.hasKey("SkeletonType", 99)) + { + int i = tagCompund.getByte("SkeletonType"); + this.setSkeletonType(i); + } + + this.setCombatTask(); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setByte("SkeletonType", (byte)this.getSkeletonType()); + } + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public void setCurrentItemOrArmor(int slotIn, ItemStack stack) + { + super.setCurrentItemOrArmor(slotIn, stack); + + if (!this.worldObj.isRemote && slotIn == 0) + { + this.setCombatTask(); + } + } + + public float getEyeHeight() + { + return this.getSkeletonType() == 1 ? super.getEyeHeight() : 1.74F; + } + + /** + * Returns the Y Offset of this entity. + */ + public double getYOffset() + { + return this.isChild() ? 0.0D : -0.35D; + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntitySlime.java b/src/minecraft/net/minecraft/entity/monster/EntitySlime.java new file mode 100644 index 0000000..0936a71 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntitySlime.java @@ -0,0 +1,586 @@ +package net.minecraft.entity.monster; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.EntityAIFindEntityNearest; +import net.minecraft.entity.ai.EntityAIFindEntityNearestPlayer; +import net.minecraft.entity.ai.EntityMoveHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; +import net.minecraft.world.WorldType; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; + +public class EntitySlime extends EntityLiving implements IMob +{ + public float squishAmount; + public float squishFactor; + public float prevSquishFactor; + private boolean wasOnGround; + + public EntitySlime(World worldIn) + { + super(worldIn); + this.moveHelper = new EntitySlime.SlimeMoveHelper(this); + this.tasks.addTask(1, new EntitySlime.AISlimeFloat(this)); + this.tasks.addTask(2, new EntitySlime.AISlimeAttack(this)); + this.tasks.addTask(3, new EntitySlime.AISlimeFaceRandom(this)); + this.tasks.addTask(5, new EntitySlime.AISlimeHop(this)); + this.targetTasks.addTask(1, new EntityAIFindEntityNearestPlayer(this)); + this.targetTasks.addTask(3, new EntityAIFindEntityNearest(this, EntityIronGolem.class)); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)1)); + } + + protected void setSlimeSize(int size) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)size)); + this.setSize(0.51000005F * (float)size, 0.51000005F * (float)size); + this.setPosition(this.posX, this.posY, this.posZ); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue((double)(size * size)); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue((double)(0.2F + 0.1F * (float)size)); + this.setHealth(this.getMaxHealth()); + this.experienceValue = size; + } + + /** + * Returns the size of the slime. + */ + public int getSlimeSize() + { + return this.dataWatcher.getWatchableObjectByte(16); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("Size", this.getSlimeSize() - 1); + tagCompound.setBoolean("wasOnGround", this.wasOnGround); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + int i = tagCompund.getInteger("Size"); + + if (i < 0) + { + i = 0; + } + + this.setSlimeSize(i + 1); + this.wasOnGround = tagCompund.getBoolean("wasOnGround"); + } + + protected EnumParticleTypes getParticleType() + { + return EnumParticleTypes.SLIME; + } + + /** + * Returns the name of the sound played when the slime jumps. + */ + protected String getJumpSound() + { + return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small"); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (!this.worldObj.isRemote && this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL && this.getSlimeSize() > 0) + { + this.isDead = true; + } + + this.squishFactor += (this.squishAmount - this.squishFactor) * 0.5F; + this.prevSquishFactor = this.squishFactor; + super.onUpdate(); + + if (this.onGround && !this.wasOnGround) + { + int i = this.getSlimeSize(); + + for (int j = 0; j < i * 8; ++j) + { + float f = this.rand.nextFloat() * (float)Math.PI * 2.0F; + float f1 = this.rand.nextFloat() * 0.5F + 0.5F; + float f2 = MathHelper.sin(f) * (float)i * 0.5F * f1; + float f3 = MathHelper.cos(f) * (float)i * 0.5F * f1; + World world = this.worldObj; + EnumParticleTypes enumparticletypes = this.getParticleType(); + double d0 = this.posX + (double)f2; + double d1 = this.posZ + (double)f3; + world.spawnParticle(enumparticletypes, d0, this.getEntityBoundingBox().minY, d1, 0.0D, 0.0D, 0.0D, new int[0]); + } + + if (this.makesSoundOnLand()) + { + this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) / 0.8F); + } + + this.squishAmount = -0.5F; + } + else if (!this.onGround && this.wasOnGround) + { + this.squishAmount = 1.0F; + } + + this.wasOnGround = this.onGround; + this.alterSquishAmount(); + } + + protected void alterSquishAmount() + { + this.squishAmount *= 0.6F; + } + + /** + * Gets the amount of time the slime needs to wait between jumps. + */ + protected int getJumpDelay() + { + return this.rand.nextInt(20) + 10; + } + + protected EntitySlime createInstance() + { + return new EntitySlime(this.worldObj); + } + + public void onDataWatcherUpdate(int dataID) + { + if (dataID == 16) + { + int i = this.getSlimeSize(); + this.setSize(0.51000005F * (float)i, 0.51000005F * (float)i); + this.rotationYaw = this.rotationYawHead; + this.renderYawOffset = this.rotationYawHead; + + if (this.isInWater() && this.rand.nextInt(20) == 0) + { + this.resetHeight(); + } + } + + super.onDataWatcherUpdate(dataID); + } + + /** + * Will get destroyed next tick. + */ + public void setDead() + { + int i = this.getSlimeSize(); + + if (!this.worldObj.isRemote && i > 1 && this.getHealth() <= 0.0F) + { + int j = 2 + this.rand.nextInt(3); + + for (int k = 0; k < j; ++k) + { + float f = ((float)(k % 2) - 0.5F) * (float)i / 4.0F; + float f1 = ((float)(k / 2) - 0.5F) * (float)i / 4.0F; + EntitySlime entityslime = this.createInstance(); + + if (this.hasCustomName()) + { + entityslime.setCustomNameTag(this.getCustomNameTag()); + } + + if (this.isNoDespawnRequired()) + { + entityslime.enablePersistence(); + } + + entityslime.setSlimeSize(i / 2); + entityslime.setLocationAndAngles(this.posX + (double)f, this.posY + 0.5D, this.posZ + (double)f1, this.rand.nextFloat() * 360.0F, 0.0F); + this.worldObj.spawnEntityInWorld(entityslime); + } + } + + super.setDead(); + } + + /** + * Applies a velocity to each of the entities pushing them away from each other. Args: entity + */ + public void applyEntityCollision(Entity entityIn) + { + super.applyEntityCollision(entityIn); + + if (entityIn instanceof EntityIronGolem && this.canDamagePlayer()) + { + this.func_175451_e((EntityLivingBase)entityIn); + } + } + + /** + * Called by a player entity when they collide with an entity + */ + public void onCollideWithPlayer(EntityPlayer entityIn) + { + if (this.canDamagePlayer()) + { + this.func_175451_e(entityIn); + } + } + + protected void func_175451_e(EntityLivingBase p_175451_1_) + { + int i = this.getSlimeSize(); + + if (this.canEntityBeSeen(p_175451_1_) && this.getDistanceSqToEntity(p_175451_1_) < 0.6D * (double)i * 0.6D * (double)i && p_175451_1_.attackEntityFrom(DamageSource.causeMobDamage(this), (float)this.getAttackStrength())) + { + this.playSound("mob.attack", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.applyEnchantments(this, p_175451_1_); + } + } + + public float getEyeHeight() + { + return 0.625F * this.height; + } + + /** + * Indicates weather the slime is able to damage the player (based upon the slime's size) + */ + protected boolean canDamagePlayer() + { + return this.getSlimeSize() > 1; + } + + /** + * Gets the amount of damage dealt to the player when "attacked" by the slime. + */ + protected int getAttackStrength() + { + return this.getSlimeSize(); + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small"); + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small"); + } + + protected Item getDropItem() + { + return this.getSlimeSize() == 1 ? Items.slime_ball : null; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + BlockPos blockpos = new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ)); + Chunk chunk = this.worldObj.getChunkFromBlockCoords(blockpos); + + if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT && this.rand.nextInt(4) != 1) + { + return false; + } + else + { + if (this.worldObj.getDifficulty() != EnumDifficulty.PEACEFUL) + { + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos); + + if (biomegenbase == BiomeGenBase.swampland && this.posY > 50.0D && this.posY < 70.0D && this.rand.nextFloat() < 0.5F && this.rand.nextFloat() < this.worldObj.getCurrentMoonPhaseFactor() && this.worldObj.getLightFromNeighbors(new BlockPos(this)) <= this.rand.nextInt(8)) + { + return super.getCanSpawnHere(); + } + + if (this.rand.nextInt(10) == 0 && chunk.getRandomWithSeed(987234911L).nextInt(10) == 0 && this.posY < 40.0D) + { + return super.getCanSpawnHere(); + } + } + + return false; + } + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.4F * (float)this.getSlimeSize(); + } + + /** + * The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently + * use in wolves. + */ + public int getVerticalFaceSpeed() + { + return 0; + } + + /** + * Returns true if the slime makes a sound when it jumps (based upon the slime's size) + */ + protected boolean makesSoundOnJump() + { + return this.getSlimeSize() > 0; + } + + /** + * Returns true if the slime makes a sound when it lands after a jump (based upon the slime's size) + */ + protected boolean makesSoundOnLand() + { + return this.getSlimeSize() > 2; + } + + /** + * Causes this entity to do an upwards motion (jumping). + */ + protected void jump() + { + this.motionY = 0.41999998688697815D; + this.isAirBorne = true; + } + + /** + * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called + * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory + */ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + int i = this.rand.nextInt(3); + + if (i < 2 && this.rand.nextFloat() < 0.5F * difficulty.getClampedAdditionalDifficulty()) + { + ++i; + } + + int j = 1 << i; + this.setSlimeSize(j); + return super.onInitialSpawn(difficulty, livingdata); + } + + static class AISlimeAttack extends EntityAIBase + { + private EntitySlime slime; + private int field_179465_b; + + public AISlimeAttack(EntitySlime p_i45824_1_) + { + this.slime = p_i45824_1_; + this.setMutexBits(2); + } + + public boolean shouldExecute() + { + EntityLivingBase entitylivingbase = this.slime.getAttackTarget(); + return entitylivingbase == null ? false : (!entitylivingbase.isEntityAlive() ? false : !(entitylivingbase instanceof EntityPlayer) || !((EntityPlayer)entitylivingbase).capabilities.disableDamage); + } + + public void startExecuting() + { + this.field_179465_b = 300; + super.startExecuting(); + } + + public boolean continueExecuting() + { + EntityLivingBase entitylivingbase = this.slime.getAttackTarget(); + return entitylivingbase == null ? false : (!entitylivingbase.isEntityAlive() ? false : (entitylivingbase instanceof EntityPlayer && ((EntityPlayer)entitylivingbase).capabilities.disableDamage ? false : --this.field_179465_b > 0)); + } + + public void updateTask() + { + this.slime.faceEntity(this.slime.getAttackTarget(), 10.0F, 10.0F); + ((EntitySlime.SlimeMoveHelper)this.slime.getMoveHelper()).func_179920_a(this.slime.rotationYaw, this.slime.canDamagePlayer()); + } + } + + static class AISlimeFaceRandom extends EntityAIBase + { + private EntitySlime slime; + private float field_179459_b; + private int field_179460_c; + + public AISlimeFaceRandom(EntitySlime p_i45820_1_) + { + this.slime = p_i45820_1_; + this.setMutexBits(2); + } + + public boolean shouldExecute() + { + return this.slime.getAttackTarget() == null && (this.slime.onGround || this.slime.isInWater() || this.slime.isInLava()); + } + + public void updateTask() + { + if (--this.field_179460_c <= 0) + { + this.field_179460_c = 40 + this.slime.getRNG().nextInt(60); + this.field_179459_b = (float)this.slime.getRNG().nextInt(360); + } + + ((EntitySlime.SlimeMoveHelper)this.slime.getMoveHelper()).func_179920_a(this.field_179459_b, false); + } + } + + static class AISlimeFloat extends EntityAIBase + { + private EntitySlime slime; + + public AISlimeFloat(EntitySlime p_i45823_1_) + { + this.slime = p_i45823_1_; + this.setMutexBits(5); + ((PathNavigateGround)p_i45823_1_.getNavigator()).setCanSwim(true); + } + + public boolean shouldExecute() + { + return this.slime.isInWater() || this.slime.isInLava(); + } + + public void updateTask() + { + if (this.slime.getRNG().nextFloat() < 0.8F) + { + this.slime.getJumpHelper().setJumping(); + } + + ((EntitySlime.SlimeMoveHelper)this.slime.getMoveHelper()).setSpeed(1.2D); + } + } + + static class AISlimeHop extends EntityAIBase + { + private EntitySlime slime; + + public AISlimeHop(EntitySlime p_i45822_1_) + { + this.slime = p_i45822_1_; + this.setMutexBits(5); + } + + public boolean shouldExecute() + { + return true; + } + + public void updateTask() + { + ((EntitySlime.SlimeMoveHelper)this.slime.getMoveHelper()).setSpeed(1.0D); + } + } + + static class SlimeMoveHelper extends EntityMoveHelper + { + private float field_179922_g; + private int field_179924_h; + private EntitySlime slime; + private boolean field_179923_j; + + public SlimeMoveHelper(EntitySlime p_i45821_1_) + { + super(p_i45821_1_); + this.slime = p_i45821_1_; + } + + public void func_179920_a(float p_179920_1_, boolean p_179920_2_) + { + this.field_179922_g = p_179920_1_; + this.field_179923_j = p_179920_2_; + } + + public void setSpeed(double speedIn) + { + this.speed = speedIn; + this.update = true; + } + + public void onUpdateMoveHelper() + { + this.entity.rotationYaw = this.limitAngle(this.entity.rotationYaw, this.field_179922_g, 30.0F); + this.entity.rotationYawHead = this.entity.rotationYaw; + this.entity.renderYawOffset = this.entity.rotationYaw; + + if (!this.update) + { + this.entity.setMoveForward(0.0F); + } + else + { + this.update = false; + + if (this.entity.onGround) + { + this.entity.setAIMoveSpeed((float)(this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue())); + + if (this.field_179924_h-- <= 0) + { + this.field_179924_h = this.slime.getJumpDelay(); + + if (this.field_179923_j) + { + this.field_179924_h /= 3; + } + + this.slime.getJumpHelper().setJumping(); + + if (this.slime.makesSoundOnJump()) + { + this.slime.playSound(this.slime.getJumpSound(), this.slime.getSoundVolume(), ((this.slime.getRNG().nextFloat() - this.slime.getRNG().nextFloat()) * 0.2F + 1.0F) * 0.8F); + } + } + else + { + this.slime.moveStrafing = this.slime.moveForward = 0.0F; + this.entity.setAIMoveSpeed(0.0F); + } + } + else + { + this.entity.setAIMoveSpeed((float)(this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue())); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntitySnowman.java b/src/minecraft/net/minecraft/entity/monster/EntitySnowman.java new file mode 100644 index 0000000..f004a6f --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntitySnowman.java @@ -0,0 +1,122 @@ +package net.minecraft.entity.monster; + +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IRangedAttackMob; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIArrowAttack; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntitySnowball; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntitySnowman extends EntityGolem implements IRangedAttackMob +{ + public EntitySnowman(World worldIn) + { + super(worldIn); + this.setSize(0.7F, 1.9F); + ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); + this.tasks.addTask(1, new EntityAIArrowAttack(this, 1.25D, 20, 10.0F)); + this.tasks.addTask(2, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(4, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityLiving.class, 10, true, false, IMob.mobSelector)); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(4.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.20000000298023224D); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (!this.worldObj.isRemote) + { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.posY); + int k = MathHelper.floor_double(this.posZ); + + if (this.isWet()) + { + this.attackEntityFrom(DamageSource.drown, 1.0F); + } + + if (this.worldObj.getBiomeGenForCoords(new BlockPos(i, 0, k)).getFloatTemperature(new BlockPos(i, j, k)) > 1.0F) + { + this.attackEntityFrom(DamageSource.onFire, 1.0F); + } + + for (int l = 0; l < 4; ++l) + { + i = MathHelper.floor_double(this.posX + (double)((float)(l % 2 * 2 - 1) * 0.25F)); + j = MathHelper.floor_double(this.posY); + k = MathHelper.floor_double(this.posZ + (double)((float)(l / 2 % 2 * 2 - 1) * 0.25F)); + BlockPos blockpos = new BlockPos(i, j, k); + + if (this.worldObj.getBlockState(blockpos).getBlock().getMaterial() == Material.air && this.worldObj.getBiomeGenForCoords(new BlockPos(i, 0, k)).getFloatTemperature(blockpos) < 0.8F && Blocks.snow_layer.canPlaceBlockAt(this.worldObj, blockpos)) + { + this.worldObj.setBlockState(blockpos, Blocks.snow_layer.getDefaultState()); + } + } + } + } + + protected Item getDropItem() + { + return Items.snowball; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + int i = this.rand.nextInt(16); + + for (int j = 0; j < i; ++j) + { + this.dropItem(Items.snowball, 1); + } + } + + /** + * Attack the specified entity using a ranged attack. + */ + public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_) + { + EntitySnowball entitysnowball = new EntitySnowball(this.worldObj, this); + double d0 = p_82196_1_.posY + (double)p_82196_1_.getEyeHeight() - 1.100000023841858D; + double d1 = p_82196_1_.posX - this.posX; + double d2 = d0 - entitysnowball.posY; + double d3 = p_82196_1_.posZ - this.posZ; + float f = MathHelper.sqrt_double(d1 * d1 + d3 * d3) * 0.2F; + entitysnowball.setThrowableHeading(d1, d2 + (double)f, d3, 1.6F, 12.0F); + this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); + this.worldObj.spawnEntityInWorld(entitysnowball); + } + + public float getEyeHeight() + { + return 1.7F; + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntitySpider.java b/src/minecraft/net/minecraft/entity/monster/EntitySpider.java new file mode 100644 index 0000000..676866b --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntitySpider.java @@ -0,0 +1,307 @@ +package net.minecraft.entity.monster; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILeapAtTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.pathfinding.PathNavigate; +import net.minecraft.pathfinding.PathNavigateClimber; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.BlockPos; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class EntitySpider extends EntityMob +{ + public EntitySpider(World worldIn) + { + super(worldIn); + this.setSize(1.4F, 0.9F); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F)); + this.tasks.addTask(4, new EntitySpider.AISpiderAttack(this, EntityPlayer.class)); + this.tasks.addTask(4, new EntitySpider.AISpiderAttack(this, EntityIronGolem.class)); + this.tasks.addTask(5, new EntityAIWander(this, 0.8D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(6, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); + this.targetTasks.addTask(2, new EntitySpider.AISpiderTarget(this, EntityPlayer.class)); + this.targetTasks.addTask(3, new EntitySpider.AISpiderTarget(this, EntityIronGolem.class)); + } + + /** + * Returns the Y offset from the entity's position for any entity riding this one. + */ + public double getMountedYOffset() + { + return (double)(this.height * 0.5F); + } + + /** + * Returns new PathNavigateGround instance + */ + protected PathNavigate getNewNavigator(World worldIn) + { + return new PathNavigateClimber(this, worldIn); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)0)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (!this.worldObj.isRemote) + { + this.setBesideClimbableBlock(this.isCollidedHorizontally); + } + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(16.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.spider.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.spider.say"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.spider.death"; + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound("mob.spider.step", 0.15F, 1.0F); + } + + protected Item getDropItem() + { + return Items.string; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + super.dropFewItems(p_70628_1_, p_70628_2_); + + if (p_70628_1_ && (this.rand.nextInt(3) == 0 || this.rand.nextInt(1 + p_70628_2_) > 0)) + { + this.dropItem(Items.spider_eye, 1); + } + } + + /** + * returns true if this entity is by a ladder, false otherwise + */ + public boolean isOnLadder() + { + return this.isBesideClimbableBlock(); + } + + /** + * Sets the Entity inside a web block. + */ + public void setInWeb() + { + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.ARTHROPOD; + } + + public boolean isPotionApplicable(PotionEffect potioneffectIn) + { + return potioneffectIn.getPotionID() == Potion.poison.id ? false : super.isPotionApplicable(potioneffectIn); + } + + /** + * Returns true if the WatchableObject (Byte) is 0x01 otherwise returns false. The WatchableObject is updated using + * setBesideClimableBlock. + */ + public boolean isBesideClimbableBlock() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + /** + * Updates the WatchableObject (Byte) created in entityInit(), setting it to 0x01 if par1 is true or 0x00 if it is + * false. + */ + public void setBesideClimbableBlock(boolean p_70839_1_) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + if (p_70839_1_) + { + b0 = (byte)(b0 | 1); + } + else + { + b0 = (byte)(b0 & -2); + } + + this.dataWatcher.updateObject(16, Byte.valueOf(b0)); + } + + /** + * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called + * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory + */ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + livingdata = super.onInitialSpawn(difficulty, livingdata); + + if (this.worldObj.rand.nextInt(100) == 0) + { + EntitySkeleton entityskeleton = new EntitySkeleton(this.worldObj); + entityskeleton.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); + entityskeleton.onInitialSpawn(difficulty, (IEntityLivingData)null); + this.worldObj.spawnEntityInWorld(entityskeleton); + entityskeleton.mountEntity(this); + } + + if (livingdata == null) + { + livingdata = new EntitySpider.GroupData(); + + if (this.worldObj.getDifficulty() == EnumDifficulty.HARD && this.worldObj.rand.nextFloat() < 0.1F * difficulty.getClampedAdditionalDifficulty()) + { + ((EntitySpider.GroupData)livingdata).func_111104_a(this.worldObj.rand); + } + } + + if (livingdata instanceof EntitySpider.GroupData) + { + int i = ((EntitySpider.GroupData)livingdata).potionEffectId; + + if (i > 0 && Potion.potionTypes[i] != null) + { + this.addPotionEffect(new PotionEffect(i, Integer.MAX_VALUE)); + } + } + + return livingdata; + } + + public float getEyeHeight() + { + return 0.65F; + } + + static class AISpiderAttack extends EntityAIAttackOnCollide + { + public AISpiderAttack(EntitySpider p_i45819_1_, Class targetClass) + { + super(p_i45819_1_, targetClass, 1.0D, true); + } + + public boolean continueExecuting() + { + float f = this.attacker.getBrightness(1.0F); + + if (f >= 0.5F && this.attacker.getRNG().nextInt(100) == 0) + { + this.attacker.setAttackTarget((EntityLivingBase)null); + return false; + } + else + { + return super.continueExecuting(); + } + } + + protected double func_179512_a(EntityLivingBase attackTarget) + { + return (double)(4.0F + attackTarget.width); + } + } + + static class AISpiderTarget extends EntityAINearestAttackableTarget + { + public AISpiderTarget(EntitySpider p_i45818_1_, Class classTarget) + { + super(p_i45818_1_, classTarget, true); + } + + public boolean shouldExecute() + { + float f = this.taskOwner.getBrightness(1.0F); + return f >= 0.5F ? false : super.shouldExecute(); + } + } + + public static class GroupData implements IEntityLivingData + { + public int potionEffectId; + + public void func_111104_a(Random rand) + { + int i = rand.nextInt(5); + + if (i <= 1) + { + this.potionEffectId = Potion.moveSpeed.id; + } + else if (i <= 2) + { + this.potionEffectId = Potion.damageBoost.id; + } + else if (i <= 3) + { + this.potionEffectId = Potion.regeneration.id; + } + else if (i <= 4) + { + this.potionEffectId = Potion.invisibility.id; + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityWitch.java b/src/minecraft/net/minecraft/entity/monster/EntityWitch.java new file mode 100644 index 0000000..a4d3daa --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityWitch.java @@ -0,0 +1,283 @@ +package net.minecraft.entity.monster; + +import java.util.List; +import java.util.UUID; +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IRangedAttackMob; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIArrowAttack; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityPotion; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityWitch extends EntityMob implements IRangedAttackMob +{ + private static final UUID MODIFIER_UUID = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E"); + private static final AttributeModifier MODIFIER = (new AttributeModifier(MODIFIER_UUID, "Drinking speed penalty", -0.25D, 0)).setSaved(false); + + /** List of items a witch should drop on death. */ + private static final Item[] witchDrops = new Item[] {Items.glowstone_dust, Items.sugar, Items.redstone, Items.spider_eye, Items.glass_bottle, Items.gunpowder, Items.stick, Items.stick}; + + /** + * Timer used as interval for a witch's attack, decremented every tick if aggressive and when reaches zero the witch + * will throw a potion at the target entity. + */ + private int witchAttackTimer; + + public EntityWitch(World worldIn) + { + super(worldIn); + this.setSize(0.6F, 1.95F); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIArrowAttack(this, 1.0D, 60, 10.0F)); + this.tasks.addTask(2, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(3, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); + } + + protected void entityInit() + { + super.entityInit(); + this.getDataWatcher().addObject(21, Byte.valueOf((byte)0)); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return null; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return null; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return null; + } + + /** + * Set whether this witch is aggressive at an entity. + */ + public void setAggressive(boolean aggressive) + { + this.getDataWatcher().updateObject(21, Byte.valueOf((byte)(aggressive ? 1 : 0))); + } + + /** + * Return whether this witch is aggressive at an entity. + */ + public boolean getAggressive() + { + return this.getDataWatcher().getWatchableObjectByte(21) == 1; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(26.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (!this.worldObj.isRemote) + { + if (this.getAggressive()) + { + if (this.witchAttackTimer-- <= 0) + { + this.setAggressive(false); + ItemStack itemstack = this.getHeldItem(); + this.setCurrentItemOrArmor(0, (ItemStack)null); + + if (itemstack != null && itemstack.getItem() == Items.potionitem) + { + List list = Items.potionitem.getEffects(itemstack); + + if (list != null) + { + for (PotionEffect potioneffect : list) + { + this.addPotionEffect(new PotionEffect(potioneffect)); + } + } + } + + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).removeModifier(MODIFIER); + } + } + else + { + int i = -1; + + if (this.rand.nextFloat() < 0.15F && this.isInsideOfMaterial(Material.water) && !this.isPotionActive(Potion.waterBreathing)) + { + i = 8237; + } + else if (this.rand.nextFloat() < 0.15F && this.isBurning() && !this.isPotionActive(Potion.fireResistance)) + { + i = 16307; + } + else if (this.rand.nextFloat() < 0.05F && this.getHealth() < this.getMaxHealth()) + { + i = 16341; + } + else if (this.rand.nextFloat() < 0.25F && this.getAttackTarget() != null && !this.isPotionActive(Potion.moveSpeed) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D) + { + i = 16274; + } + else if (this.rand.nextFloat() < 0.25F && this.getAttackTarget() != null && !this.isPotionActive(Potion.moveSpeed) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D) + { + i = 16274; + } + + if (i > -1) + { + this.setCurrentItemOrArmor(0, new ItemStack(Items.potionitem, 1, i)); + this.witchAttackTimer = this.getHeldItem().getMaxItemUseDuration(); + this.setAggressive(true); + IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + iattributeinstance.removeModifier(MODIFIER); + iattributeinstance.applyModifier(MODIFIER); + } + } + + if (this.rand.nextFloat() < 7.5E-4F) + { + this.worldObj.setEntityState(this, (byte)15); + } + } + + super.onLivingUpdate(); + } + + public void handleStatusUpdate(byte id) + { + if (id == 15) + { + for (int i = 0; i < this.rand.nextInt(35) + 10; ++i) + { + this.worldObj.spawnParticle(EnumParticleTypes.SPELL_WITCH, this.posX + this.rand.nextGaussian() * 0.12999999523162842D, this.getEntityBoundingBox().maxY + 0.5D + this.rand.nextGaussian() * 0.12999999523162842D, this.posZ + this.rand.nextGaussian() * 0.12999999523162842D, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + else + { + super.handleStatusUpdate(id); + } + } + + /** + * Reduces damage, depending on potions + */ + protected float applyPotionDamageCalculations(DamageSource source, float damage) + { + damage = super.applyPotionDamageCalculations(source, damage); + + if (source.getEntity() == this) + { + damage = 0.0F; + } + + if (source.isMagicDamage()) + { + damage = (float)((double)damage * 0.15D); + } + + return damage; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + int i = this.rand.nextInt(3) + 1; + + for (int j = 0; j < i; ++j) + { + int k = this.rand.nextInt(3); + Item item = witchDrops[this.rand.nextInt(witchDrops.length)]; + + if (p_70628_2_ > 0) + { + k += this.rand.nextInt(p_70628_2_ + 1); + } + + for (int l = 0; l < k; ++l) + { + this.dropItem(item, 1); + } + } + } + + /** + * Attack the specified entity using a ranged attack. + */ + public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_) + { + if (!this.getAggressive()) + { + EntityPotion entitypotion = new EntityPotion(this.worldObj, this, 32732); + double d0 = p_82196_1_.posY + (double)p_82196_1_.getEyeHeight() - 1.100000023841858D; + entitypotion.rotationPitch -= -20.0F; + double d1 = p_82196_1_.posX + p_82196_1_.motionX - this.posX; + double d2 = d0 - this.posY; + double d3 = p_82196_1_.posZ + p_82196_1_.motionZ - this.posZ; + float f = MathHelper.sqrt_double(d1 * d1 + d3 * d3); + + if (f >= 8.0F && !p_82196_1_.isPotionActive(Potion.moveSlowdown)) + { + entitypotion.setPotionDamage(32698); + } + else if (p_82196_1_.getHealth() >= 8.0F && !p_82196_1_.isPotionActive(Potion.poison)) + { + entitypotion.setPotionDamage(32660); + } + else if (f <= 3.0F && !p_82196_1_.isPotionActive(Potion.weakness) && this.rand.nextFloat() < 0.25F) + { + entitypotion.setPotionDamage(32696); + } + + entitypotion.setThrowableHeading(d1, d2 + (double)(f * 0.2F), d3, 0.75F, 8.0F); + this.worldObj.spawnEntityInWorld(entitypotion); + } + } + + public float getEyeHeight() + { + return 1.62F; + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/EntityZombie.java b/src/minecraft/net/minecraft/entity/monster/EntityZombie.java new file mode 100644 index 0000000..73bc83f --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/EntityZombie.java @@ -0,0 +1,821 @@ +package net.minecraft.entity.monster; + +import java.util.Calendar; +import java.util.List; +import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIBreakDoor; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIMoveThroughVillage; +import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.IAttribute; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.ai.attributes.RangedAttribute; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.MathHelper; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class EntityZombie extends EntityMob +{ + /** + * The attribute which determines the chance that this mob will spawn reinforcements + */ + protected static final IAttribute reinforcementChance = (new RangedAttribute((IAttribute)null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).setDescription("Spawn Reinforcements Chance"); + private static final UUID babySpeedBoostUUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); + private static final AttributeModifier babySpeedBoostModifier = new AttributeModifier(babySpeedBoostUUID, "Baby speed boost", 0.5D, 1); + private final EntityAIBreakDoor breakDoor = new EntityAIBreakDoor(this); + + /** + * Ticker used to determine the time remaining for this zombie to convert into a villager when cured. + */ + private int conversionTime; + private boolean isBreakDoorsTaskSet = false; + + /** The width of the entity */ + private float zombieWidth = -1.0F; + + /** The height of the the entity. */ + private float zombieHeight; + + public EntityZombie(World worldIn) + { + super(worldIn); + ((PathNavigateGround)this.getNavigator()).setBreakDoors(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); + this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); + this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.applyEntityAI(); + this.setSize(0.6F, 1.95F); + } + + protected void applyEntityAI() + { + this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true)); + this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityIronGolem.class, 1.0D, true)); + this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[] {EntityPigZombie.class})); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, false)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityIronGolem.class, true)); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(35.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); + this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * 0.10000000149011612D); + } + + protected void entityInit() + { + super.entityInit(); + this.getDataWatcher().addObject(12, Byte.valueOf((byte)0)); + this.getDataWatcher().addObject(13, Byte.valueOf((byte)0)); + this.getDataWatcher().addObject(14, Byte.valueOf((byte)0)); + } + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + int i = super.getTotalArmorValue() + 2; + + if (i > 20) + { + i = 20; + } + + return i; + } + + public boolean isBreakDoorsTaskSet() + { + return this.isBreakDoorsTaskSet; + } + + /** + * Sets or removes EntityAIBreakDoor task + */ + public void setBreakDoorsAItask(boolean par1) + { + if (this.isBreakDoorsTaskSet != par1) + { + this.isBreakDoorsTaskSet = par1; + + if (par1) + { + this.tasks.addTask(1, this.breakDoor); + } + else + { + this.tasks.removeTask(this.breakDoor); + } + } + } + + /** + * If Animal, checks if the age timer is negative + */ + public boolean isChild() + { + return this.getDataWatcher().getWatchableObjectByte(12) == 1; + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer player) + { + if (this.isChild()) + { + this.experienceValue = (int)((float)this.experienceValue * 2.5F); + } + + return super.getExperiencePoints(player); + } + + /** + * Set whether this zombie is a child. + */ + public void setChild(boolean childZombie) + { + this.getDataWatcher().updateObject(12, Byte.valueOf((byte)(childZombie ? 1 : 0))); + + if (this.worldObj != null && !this.worldObj.isRemote) + { + IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + iattributeinstance.removeModifier(babySpeedBoostModifier); + + if (childZombie) + { + iattributeinstance.applyModifier(babySpeedBoostModifier); + } + } + + this.setChildSize(childZombie); + } + + /** + * Return whether this zombie is a villager. + */ + public boolean isVillager() + { + return this.getDataWatcher().getWatchableObjectByte(13) == 1; + } + + /** + * Set whether this zombie is a villager. + */ + public void setVillager(boolean villager) + { + this.getDataWatcher().updateObject(13, Byte.valueOf((byte)(villager ? 1 : 0))); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.worldObj.isDaytime() && !this.worldObj.isRemote && !this.isChild()) + { + float f = this.getBrightness(1.0F); + BlockPos blockpos = new BlockPos(this.posX, (double)Math.round(this.posY), this.posZ); + + if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.worldObj.canSeeSky(blockpos)) + { + boolean flag = true; + ItemStack itemstack = this.getEquipmentInSlot(4); + + if (itemstack != null) + { + if (itemstack.isItemStackDamageable()) + { + itemstack.setItemDamage(itemstack.getItemDamage() + this.rand.nextInt(2)); + + if (itemstack.getItemDamage() >= itemstack.getMaxDamage()) + { + this.renderBrokenItemStack(itemstack); + this.setCurrentItemOrArmor(4, (ItemStack)null); + } + } + + flag = false; + } + + if (flag) + { + this.setFire(8); + } + } + } + + if (this.isRiding() && this.getAttackTarget() != null && this.ridingEntity instanceof EntityChicken) + { + ((EntityLiving)this.ridingEntity).getNavigator().setPath(this.getNavigator().getPath(), 1.5D); + } + + super.onLivingUpdate(); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (super.attackEntityFrom(source, amount)) + { + EntityLivingBase entitylivingbase = this.getAttackTarget(); + + if (entitylivingbase == null && source.getEntity() instanceof EntityLivingBase) + { + entitylivingbase = (EntityLivingBase)source.getEntity(); + } + + if (entitylivingbase != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(reinforcementChance).getAttributeValue()) + { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.posY); + int k = MathHelper.floor_double(this.posZ); + EntityZombie entityzombie = new EntityZombie(this.worldObj); + + for (int l = 0; l < 50; ++l) + { + int i1 = i + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); + int j1 = j + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); + int k1 = k + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); + + if (World.doesBlockHaveSolidTopSurface(this.worldObj, new BlockPos(i1, j1 - 1, k1)) && this.worldObj.getLightFromNeighbors(new BlockPos(i1, j1, k1)) < 10) + { + entityzombie.setPosition((double)i1, (double)j1, (double)k1); + + if (!this.worldObj.isAnyPlayerWithinRangeAt((double)i1, (double)j1, (double)k1, 7.0D) && this.worldObj.checkNoEntityCollision(entityzombie.getEntityBoundingBox(), entityzombie) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.getEntityBoundingBox())) + { + this.worldObj.spawnEntityInWorld(entityzombie); + entityzombie.setAttackTarget(entitylivingbase); + entityzombie.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); + this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); + entityzombie.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); + break; + } + } + } + } + + return true; + } + else + { + return false; + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (!this.worldObj.isRemote && this.isConverting()) + { + int i = this.getConversionTimeBoost(); + this.conversionTime -= i; + + if (this.conversionTime <= 0) + { + this.convertToVillager(); + } + } + + super.onUpdate(); + } + + public boolean attackEntityAsMob(Entity entityIn) + { + boolean flag = super.attackEntityAsMob(entityIn); + + if (flag) + { + int i = this.worldObj.getDifficulty().getDifficultyId(); + + if (this.getHeldItem() == null && this.isBurning() && this.rand.nextFloat() < (float)i * 0.3F) + { + entityIn.setFire(2 * i); + } + } + + return flag; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.zombie.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.zombie.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.zombie.death"; + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound("mob.zombie.step", 0.15F, 1.0F); + } + + protected Item getDropItem() + { + return Items.rotten_flesh; + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.UNDEAD; + } + + /** + * Causes this Entity to drop a random item. + */ + protected void addRandomDrop() + { + switch (this.rand.nextInt(3)) + { + case 0: + this.dropItem(Items.iron_ingot, 1); + break; + + case 1: + this.dropItem(Items.carrot, 1); + break; + + case 2: + this.dropItem(Items.potato, 1); + } + } + + /** + * Gives armor or weapon for entity based on given DifficultyInstance + */ + protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) + { + super.setEquipmentBasedOnDifficulty(difficulty); + + if (this.rand.nextFloat() < (this.worldObj.getDifficulty() == EnumDifficulty.HARD ? 0.05F : 0.01F)) + { + int i = this.rand.nextInt(3); + + if (i == 0) + { + this.setCurrentItemOrArmor(0, new ItemStack(Items.iron_sword)); + } + else + { + this.setCurrentItemOrArmor(0, new ItemStack(Items.iron_shovel)); + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + + if (this.isChild()) + { + tagCompound.setBoolean("IsBaby", true); + } + + if (this.isVillager()) + { + tagCompound.setBoolean("IsVillager", true); + } + + tagCompound.setInteger("ConversionTime", this.isConverting() ? this.conversionTime : -1); + tagCompound.setBoolean("CanBreakDoors", this.isBreakDoorsTaskSet()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + + if (tagCompund.getBoolean("IsBaby")) + { + this.setChild(true); + } + + if (tagCompund.getBoolean("IsVillager")) + { + this.setVillager(true); + } + + if (tagCompund.hasKey("ConversionTime", 99) && tagCompund.getInteger("ConversionTime") > -1) + { + this.startConversion(tagCompund.getInteger("ConversionTime")); + } + + this.setBreakDoorsAItask(tagCompund.getBoolean("CanBreakDoors")); + } + + /** + * This method gets called when the entity kills another one. + */ + public void onKillEntity(EntityLivingBase entityLivingIn) + { + super.onKillEntity(entityLivingIn); + + if ((this.worldObj.getDifficulty() == EnumDifficulty.NORMAL || this.worldObj.getDifficulty() == EnumDifficulty.HARD) && entityLivingIn instanceof EntityVillager) + { + if (this.worldObj.getDifficulty() != EnumDifficulty.HARD && this.rand.nextBoolean()) + { + return; + } + + EntityLiving entityliving = (EntityLiving)entityLivingIn; + EntityZombie entityzombie = new EntityZombie(this.worldObj); + entityzombie.copyLocationAndAnglesFrom(entityLivingIn); + this.worldObj.removeEntity(entityLivingIn); + entityzombie.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); + entityzombie.setVillager(true); + + if (entityLivingIn.isChild()) + { + entityzombie.setChild(true); + } + + entityzombie.setNoAI(entityliving.isAIDisabled()); + + if (entityliving.hasCustomName()) + { + entityzombie.setCustomNameTag(entityliving.getCustomNameTag()); + entityzombie.setAlwaysRenderNameTag(entityliving.getAlwaysRenderNameTag()); + } + + this.worldObj.spawnEntityInWorld(entityzombie); + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0); + } + } + + public float getEyeHeight() + { + float f = 1.74F; + + if (this.isChild()) + { + f = (float)((double)f - 0.81D); + } + + return f; + } + + protected boolean func_175448_a(ItemStack stack) + { + return stack.getItem() == Items.egg && this.isChild() && this.isRiding() ? false : super.func_175448_a(stack); + } + + /** + * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called + * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory + */ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + livingdata = super.onInitialSpawn(difficulty, livingdata); + float f = difficulty.getClampedAdditionalDifficulty(); + this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * f); + + if (livingdata == null) + { + livingdata = new EntityZombie.GroupData(this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F); + } + + if (livingdata instanceof EntityZombie.GroupData) + { + EntityZombie.GroupData entityzombie$groupdata = (EntityZombie.GroupData)livingdata; + + if (entityzombie$groupdata.isVillager) + { + this.setVillager(true); + } + + if (entityzombie$groupdata.isChild) + { + this.setChild(true); + + if ((double)this.worldObj.rand.nextFloat() < 0.05D) + { + List list = this.worldObj.getEntitiesWithinAABB(EntityChicken.class, this.getEntityBoundingBox().expand(5.0D, 3.0D, 5.0D), EntitySelectors.IS_STANDALONE); + + if (!list.isEmpty()) + { + EntityChicken entitychicken = (EntityChicken)list.get(0); + entitychicken.setChickenJockey(true); + this.mountEntity(entitychicken); + } + } + else if ((double)this.worldObj.rand.nextFloat() < 0.05D) + { + EntityChicken entitychicken1 = new EntityChicken(this.worldObj); + entitychicken1.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); + entitychicken1.onInitialSpawn(difficulty, (IEntityLivingData)null); + entitychicken1.setChickenJockey(true); + this.worldObj.spawnEntityInWorld(entitychicken1); + this.mountEntity(entitychicken1); + } + } + } + + this.setBreakDoorsAItask(this.rand.nextFloat() < f * 0.1F); + this.setEquipmentBasedOnDifficulty(difficulty); + this.setEnchantmentBasedOnDifficulty(difficulty); + + if (this.getEquipmentInSlot(4) == null) + { + Calendar calendar = this.worldObj.getCurrentDate(); + + if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.rand.nextFloat() < 0.25F) + { + this.setCurrentItemOrArmor(4, new ItemStack(this.rand.nextFloat() < 0.1F ? Blocks.lit_pumpkin : Blocks.pumpkin)); + this.equipmentDropChances[4] = 0.0F; + } + } + + this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextDouble() * 0.05000000074505806D, 0)); + double d0 = this.rand.nextDouble() * 1.5D * (double)f; + + if (d0 > 1.0D) + { + this.getEntityAttribute(SharedMonsterAttributes.followRange).applyModifier(new AttributeModifier("Random zombie-spawn bonus", d0, 2)); + } + + if (this.rand.nextFloat() < f * 0.05F) + { + this.getEntityAttribute(reinforcementChance).applyModifier(new AttributeModifier("Leader zombie bonus", this.rand.nextDouble() * 0.25D + 0.5D, 0)); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier("Leader zombie bonus", this.rand.nextDouble() * 3.0D + 1.0D, 2)); + this.setBreakDoorsAItask(true); + } + + return livingdata; + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.getCurrentEquippedItem(); + + if (itemstack != null && itemstack.getItem() == Items.golden_apple && itemstack.getMetadata() == 0 && this.isVillager() && this.isPotionActive(Potion.weakness)) + { + if (!player.capabilities.isCreativeMode) + { + --itemstack.stackSize; + } + + if (itemstack.stackSize <= 0) + { + player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null); + } + + if (!this.worldObj.isRemote) + { + this.startConversion(this.rand.nextInt(2401) + 3600); + } + + return true; + } + else + { + return false; + } + } + + /** + * Starts converting this zombie into a villager. The zombie converts into a villager after the specified time in + * ticks. + */ + protected void startConversion(int ticks) + { + this.conversionTime = ticks; + this.getDataWatcher().updateObject(14, Byte.valueOf((byte)1)); + this.removePotionEffect(Potion.weakness.id); + this.addPotionEffect(new PotionEffect(Potion.damageBoost.id, ticks, Math.min(this.worldObj.getDifficulty().getDifficultyId() - 1, 0))); + this.worldObj.setEntityState(this, (byte)16); + } + + public void handleStatusUpdate(byte id) + { + if (id == 16) + { + if (!this.isSilent()) + { + this.worldObj.playSound(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, "mob.zombie.remedy", 1.0F + this.rand.nextFloat(), this.rand.nextFloat() * 0.7F + 0.3F, false); + } + } + else + { + super.handleStatusUpdate(id); + } + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return !this.isConverting(); + } + + /** + * Returns whether this zombie is in the process of converting to a villager + */ + public boolean isConverting() + { + return this.getDataWatcher().getWatchableObjectByte(14) == 1; + } + + /** + * Convert this zombie into a villager. + */ + protected void convertToVillager() + { + EntityVillager entityvillager = new EntityVillager(this.worldObj); + entityvillager.copyLocationAndAnglesFrom(this); + entityvillager.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null); + entityvillager.setLookingForHome(); + + if (this.isChild()) + { + entityvillager.setGrowingAge(-24000); + } + + this.worldObj.removeEntity(this); + entityvillager.setNoAI(this.isAIDisabled()); + + if (this.hasCustomName()) + { + entityvillager.setCustomNameTag(this.getCustomNameTag()); + entityvillager.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag()); + } + + this.worldObj.spawnEntityInWorld(entityvillager); + entityvillager.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0)); + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1017, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0); + } + + /** + * Return the amount of time decremented from conversionTime every tick. + */ + protected int getConversionTimeBoost() + { + int i = 1; + + if (this.rand.nextFloat() < 0.01F) + { + int j = 0; + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k = (int)this.posX - 4; k < (int)this.posX + 4 && j < 14; ++k) + { + for (int l = (int)this.posY - 4; l < (int)this.posY + 4 && j < 14; ++l) + { + for (int i1 = (int)this.posZ - 4; i1 < (int)this.posZ + 4 && j < 14; ++i1) + { + Block block = this.worldObj.getBlockState(blockpos$mutableblockpos.func_181079_c(k, l, i1)).getBlock(); + + if (block == Blocks.iron_bars || block == Blocks.bed) + { + if (this.rand.nextFloat() < 0.3F) + { + ++i; + } + + ++j; + } + } + } + } + } + + return i; + } + + /** + * sets the size of the entity to be half of its current size if true. + */ + public void setChildSize(boolean isChild) + { + this.multiplySize(isChild ? 0.5F : 1.0F); + } + + /** + * Sets the width and height of the entity. Args: width, height + */ + protected final void setSize(float width, float height) + { + boolean flag = this.zombieWidth > 0.0F && this.zombieHeight > 0.0F; + this.zombieWidth = width; + this.zombieHeight = height; + + if (!flag) + { + this.multiplySize(1.0F); + } + } + + /** + * Multiplies the height and width by the provided float. + */ + protected final void multiplySize(float size) + { + super.setSize(this.zombieWidth * size, this.zombieHeight * size); + } + + /** + * Returns the Y Offset of this entity. + */ + public double getYOffset() + { + return this.isChild() ? 0.0D : -0.35D; + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource cause) + { + super.onDeath(cause); + + if (cause.getEntity() instanceof EntityCreeper && !(this instanceof EntityPigZombie) && ((EntityCreeper)cause.getEntity()).getPowered() && ((EntityCreeper)cause.getEntity()).isAIEnabled()) + { + ((EntityCreeper)cause.getEntity()).func_175493_co(); + this.entityDropItem(new ItemStack(Items.skull, 1, 2), 0.0F); + } + } + + class GroupData implements IEntityLivingData + { + public boolean isChild; + public boolean isVillager; + + private GroupData(boolean isBaby, boolean isVillagerZombie) + { + this.isChild = false; + this.isVillager = false; + this.isChild = isBaby; + this.isVillager = isVillagerZombie; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/monster/IMob.java b/src/minecraft/net/minecraft/entity/monster/IMob.java new file mode 100644 index 0000000..9b17cd2 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/monster/IMob.java @@ -0,0 +1,23 @@ +package net.minecraft.entity.monster; + +import com.google.common.base.Predicate; +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.IAnimals; + +public interface IMob extends IAnimals +{ + Predicate mobSelector = new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_ instanceof IMob; + } + }; + Predicate VISIBLE_MOB_SELECTOR = new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_ instanceof IMob && !p_apply_1_.isInvisible(); + } + }; +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityAmbientCreature.java b/src/minecraft/net/minecraft/entity/passive/EntityAmbientCreature.java new file mode 100644 index 0000000..28b544b --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityAmbientCreature.java @@ -0,0 +1,26 @@ +package net.minecraft.entity.passive; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +public abstract class EntityAmbientCreature extends EntityLiving implements IAnimals +{ + public EntityAmbientCreature(World worldIn) + { + super(worldIn); + } + + public boolean allowLeashing() + { + return false; + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + protected boolean interact(EntityPlayer player) + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityAnimal.java b/src/minecraft/net/minecraft/entity/passive/EntityAnimal.java new file mode 100644 index 0000000..eeba409 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityAnimal.java @@ -0,0 +1,241 @@ +package net.minecraft.entity.passive; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public abstract class EntityAnimal extends EntityAgeable implements IAnimals +{ + protected Block spawnableBlock = Blocks.grass; + private int inLove; + private EntityPlayer playerInLove; + + public EntityAnimal(World worldIn) + { + super(worldIn); + } + + protected void updateAITasks() + { + if (this.getGrowingAge() != 0) + { + this.inLove = 0; + } + + super.updateAITasks(); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (this.getGrowingAge() != 0) + { + this.inLove = 0; + } + + if (this.inLove > 0) + { + --this.inLove; + + if (this.inLove % 10 == 0) + { + double d0 = this.rand.nextGaussian() * 0.02D; + double d1 = this.rand.nextGaussian() * 0.02D; + double d2 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle(EnumParticleTypes.HEART, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2, new int[0]); + } + } + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + this.inLove = 0; + return super.attackEntityFrom(source, amount); + } + } + + public float getBlockPathWeight(BlockPos pos) + { + return this.worldObj.getBlockState(pos.down()).getBlock() == Blocks.grass ? 10.0F : this.worldObj.getLightBrightness(pos) - 0.5F; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("InLove", this.inLove); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.inLove = tagCompund.getInteger("InLove"); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); + int k = MathHelper.floor_double(this.posZ); + BlockPos blockpos = new BlockPos(i, j, k); + return this.worldObj.getBlockState(blockpos.down()).getBlock() == this.spawnableBlock && this.worldObj.getLight(blockpos) > 8 && super.getCanSpawnHere(); + } + + /** + * Get number of ticks, at least during which the living entity will be silent. + */ + public int getTalkInterval() + { + return 120; + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return false; + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer player) + { + return 1 + this.worldObj.rand.nextInt(3); + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack stack) + { + return stack == null ? false : stack.getItem() == Items.wheat; + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + + if (itemstack != null) + { + if (this.isBreedingItem(itemstack) && this.getGrowingAge() == 0 && this.inLove <= 0) + { + this.consumeItemFromStack(player, itemstack); + this.setInLove(player); + return true; + } + + if (this.isChild() && this.isBreedingItem(itemstack)) + { + this.consumeItemFromStack(player, itemstack); + this.func_175501_a((int)((float)(-this.getGrowingAge() / 20) * 0.1F), true); + return true; + } + } + + return super.interact(player); + } + + /** + * Decreases ItemStack size by one + */ + protected void consumeItemFromStack(EntityPlayer player, ItemStack stack) + { + if (!player.capabilities.isCreativeMode) + { + --stack.stackSize; + + if (stack.stackSize <= 0) + { + player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null); + } + } + } + + public void setInLove(EntityPlayer player) + { + this.inLove = 600; + this.playerInLove = player; + this.worldObj.setEntityState(this, (byte)18); + } + + public EntityPlayer getPlayerInLove() + { + return this.playerInLove; + } + + /** + * Returns if the entity is currently in 'love mode'. + */ + public boolean isInLove() + { + return this.inLove > 0; + } + + public void resetInLove() + { + this.inLove = 0; + } + + /** + * Returns true if the mob is currently able to mate with the specified mob. + */ + public boolean canMateWith(EntityAnimal otherAnimal) + { + return otherAnimal == this ? false : (otherAnimal.getClass() != this.getClass() ? false : this.isInLove() && otherAnimal.isInLove()); + } + + public void handleStatusUpdate(byte id) + { + if (id == 18) + { + for (int i = 0; i < 7; ++i) + { + double d0 = this.rand.nextGaussian() * 0.02D; + double d1 = this.rand.nextGaussian() * 0.02D; + double d2 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle(EnumParticleTypes.HEART, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2, new int[0]); + } + } + else + { + super.handleStatusUpdate(id); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityBat.java b/src/minecraft/net/minecraft/entity/passive/EntityBat.java new file mode 100644 index 0000000..e1f2b9a --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityBat.java @@ -0,0 +1,289 @@ +package net.minecraft.entity.passive; + +import java.util.Calendar; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityBat extends EntityAmbientCreature +{ + /** Coordinates of where the bat spawned. */ + private BlockPos spawnPosition; + + public EntityBat(World worldIn) + { + super(worldIn); + this.setSize(0.5F, 0.9F); + this.setIsBatHanging(true); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)0)); + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.1F; + } + + /** + * Gets the pitch of living sounds in living entities. + */ + protected float getSoundPitch() + { + return super.getSoundPitch() * 0.95F; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return this.getIsBatHanging() && this.rand.nextInt(4) != 0 ? null : "mob.bat.idle"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.bat.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.bat.death"; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return false; + } + + protected void collideWithEntity(Entity p_82167_1_) + { + } + + protected void collideWithNearbyEntities() + { + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(6.0D); + } + + public boolean getIsBatHanging() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + public void setIsBatHanging(boolean isHanging) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + if (isHanging) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2))); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.getIsBatHanging()) + { + this.motionX = this.motionY = this.motionZ = 0.0D; + this.posY = (double)MathHelper.floor_double(this.posY) + 1.0D - (double)this.height; + } + else + { + this.motionY *= 0.6000000238418579D; + } + } + + protected void updateAITasks() + { + super.updateAITasks(); + BlockPos blockpos = new BlockPos(this); + BlockPos blockpos1 = blockpos.up(); + + if (this.getIsBatHanging()) + { + if (!this.worldObj.getBlockState(blockpos1).getBlock().isNormalCube()) + { + this.setIsBatHanging(false); + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1015, blockpos, 0); + } + else + { + if (this.rand.nextInt(200) == 0) + { + this.rotationYawHead = (float)this.rand.nextInt(360); + } + + if (this.worldObj.getClosestPlayerToEntity(this, 4.0D) != null) + { + this.setIsBatHanging(false); + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1015, blockpos, 0); + } + } + } + else + { + if (this.spawnPosition != null && (!this.worldObj.isAirBlock(this.spawnPosition) || this.spawnPosition.getY() < 1)) + { + this.spawnPosition = null; + } + + if (this.spawnPosition == null || this.rand.nextInt(30) == 0 || this.spawnPosition.distanceSq((double)((int)this.posX), (double)((int)this.posY), (double)((int)this.posZ)) < 4.0D) + { + this.spawnPosition = new BlockPos((int)this.posX + this.rand.nextInt(7) - this.rand.nextInt(7), (int)this.posY + this.rand.nextInt(6) - 2, (int)this.posZ + this.rand.nextInt(7) - this.rand.nextInt(7)); + } + + double d0 = (double)this.spawnPosition.getX() + 0.5D - this.posX; + double d1 = (double)this.spawnPosition.getY() + 0.1D - this.posY; + double d2 = (double)this.spawnPosition.getZ() + 0.5D - this.posZ; + this.motionX += (Math.signum(d0) * 0.5D - this.motionX) * 0.10000000149011612D; + this.motionY += (Math.signum(d1) * 0.699999988079071D - this.motionY) * 0.10000000149011612D; + this.motionZ += (Math.signum(d2) * 0.5D - this.motionZ) * 0.10000000149011612D; + float f = (float)(MathHelper.func_181159_b(this.motionZ, this.motionX) * 180.0D / Math.PI) - 90.0F; + float f1 = MathHelper.wrapAngleTo180_float(f - this.rotationYaw); + this.moveForward = 0.5F; + this.rotationYaw += f1; + + if (this.rand.nextInt(100) == 0 && this.worldObj.getBlockState(blockpos1).getBlock().isNormalCube()) + { + this.setIsBatHanging(true); + } + } + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + public void fall(float distance, float damageMultiplier) + { + } + + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) + { + } + + /** + * Return whether this entity should NOT trigger a pressure plate or a tripwire. + */ + public boolean doesEntityNotTriggerPressurePlate() + { + return true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + if (!this.worldObj.isRemote && this.getIsBatHanging()) + { + this.setIsBatHanging(false); + } + + return super.attackEntityFrom(source, amount); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.dataWatcher.updateObject(16, Byte.valueOf(tagCompund.getByte("BatFlags"))); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setByte("BatFlags", this.dataWatcher.getWatchableObjectByte(16)); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ); + + if (blockpos.getY() >= this.worldObj.func_181545_F()) + { + return false; + } + else + { + int i = this.worldObj.getLightFromNeighbors(blockpos); + int j = 4; + + if (this.isDateAroundHalloween(this.worldObj.getCurrentDate())) + { + j = 7; + } + else if (this.rand.nextBoolean()) + { + return false; + } + + return i > this.rand.nextInt(j) ? false : super.getCanSpawnHere(); + } + } + + private boolean isDateAroundHalloween(Calendar p_175569_1_) + { + return p_175569_1_.get(2) + 1 == 10 && p_175569_1_.get(5) >= 20 || p_175569_1_.get(2) + 1 == 11 && p_175569_1_.get(5) <= 3; + } + + public float getEyeHeight() + { + return this.height / 2.0F; + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityChicken.java b/src/minecraft/net/minecraft/entity/passive/EntityChicken.java new file mode 100644 index 0000000..13f3f16 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityChicken.java @@ -0,0 +1,241 @@ +package net.minecraft.entity.passive; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIFollowParent; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIMate; +import net.minecraft.entity.ai.EntityAIPanic; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAITempt; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityChicken extends EntityAnimal +{ + public float wingRotation; + public float destPos; + public float field_70884_g; + public float field_70888_h; + public float wingRotDelta = 1.0F; + + /** The time until the next egg is spawned. */ + public int timeUntilNextEgg; + public boolean chickenJockey; + + public EntityChicken(World worldIn) + { + super(worldIn); + this.setSize(0.4F, 0.7F); + this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.4D)); + this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.wheat_seeds, false)); + this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); + this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(7, new EntityAILookIdle(this)); + } + + public float getEyeHeight() + { + return this.height; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(4.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + this.field_70888_h = this.wingRotation; + this.field_70884_g = this.destPos; + this.destPos = (float)((double)this.destPos + (double)(this.onGround ? -1 : 4) * 0.3D); + this.destPos = MathHelper.clamp_float(this.destPos, 0.0F, 1.0F); + + if (!this.onGround && this.wingRotDelta < 1.0F) + { + this.wingRotDelta = 1.0F; + } + + this.wingRotDelta = (float)((double)this.wingRotDelta * 0.9D); + + if (!this.onGround && this.motionY < 0.0D) + { + this.motionY *= 0.6D; + } + + this.wingRotation += this.wingRotDelta * 2.0F; + + if (!this.worldObj.isRemote && !this.isChild() && !this.isChickenJockey() && --this.timeUntilNextEgg <= 0) + { + this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.dropItem(Items.egg, 1); + this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; + } + } + + public void fall(float distance, float damageMultiplier) + { + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.chicken.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.chicken.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.chicken.hurt"; + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound("mob.chicken.step", 0.15F, 1.0F); + } + + protected Item getDropItem() + { + return Items.feather; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + int i = this.rand.nextInt(3) + this.rand.nextInt(1 + p_70628_2_); + + for (int j = 0; j < i; ++j) + { + this.dropItem(Items.feather, 1); + } + + if (this.isBurning()) + { + this.dropItem(Items.cooked_chicken, 1); + } + else + { + this.dropItem(Items.chicken, 1); + } + } + + public EntityChicken createChild(EntityAgeable ageable) + { + return new EntityChicken(this.worldObj); + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack stack) + { + return stack != null && stack.getItem() == Items.wheat_seeds; + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.chickenJockey = tagCompund.getBoolean("IsChickenJockey"); + + if (tagCompund.hasKey("EggLayTime")) + { + this.timeUntilNextEgg = tagCompund.getInteger("EggLayTime"); + } + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer player) + { + return this.isChickenJockey() ? 10 : super.getExperiencePoints(player); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setBoolean("IsChickenJockey", this.chickenJockey); + tagCompound.setInteger("EggLayTime", this.timeUntilNextEgg); + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return this.isChickenJockey() && this.riddenByEntity == null; + } + + public void updateRiderPosition() + { + super.updateRiderPosition(); + float f = MathHelper.sin(this.renderYawOffset * (float)Math.PI / 180.0F); + float f1 = MathHelper.cos(this.renderYawOffset * (float)Math.PI / 180.0F); + float f2 = 0.1F; + float f3 = 0.0F; + this.riddenByEntity.setPosition(this.posX + (double)(f2 * f), this.posY + (double)(this.height * 0.5F) + this.riddenByEntity.getYOffset() + (double)f3, this.posZ - (double)(f2 * f1)); + + if (this.riddenByEntity instanceof EntityLivingBase) + { + ((EntityLivingBase)this.riddenByEntity).renderYawOffset = this.renderYawOffset; + } + } + + /** + * Determines if this chicken is a jokey with a zombie riding it. + */ + public boolean isChickenJockey() + { + return this.chickenJockey; + } + + /** + * Sets whether this chicken is a jockey or not. + */ + public void setChickenJockey(boolean jockey) + { + this.chickenJockey = jockey; + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityCow.java b/src/minecraft/net/minecraft/entity/passive/EntityCow.java new file mode 100644 index 0000000..223ddf4 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityCow.java @@ -0,0 +1,150 @@ +package net.minecraft.entity.passive; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIFollowParent; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIMate; +import net.minecraft.entity.ai.EntityAIPanic; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAITempt; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class EntityCow extends EntityAnimal +{ + public EntityCow(World worldIn) + { + super(worldIn); + this.setSize(0.9F, 1.3F); + ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 2.0D)); + this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Items.wheat, false)); + this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D)); + this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(7, new EntityAILookIdle(this)); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.20000000298023224D); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.cow.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.cow.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.cow.hurt"; + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound("mob.cow.step", 0.15F, 1.0F); + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.4F; + } + + protected Item getDropItem() + { + return Items.leather; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + int i = this.rand.nextInt(3) + this.rand.nextInt(1 + p_70628_2_); + + for (int j = 0; j < i; ++j) + { + this.dropItem(Items.leather, 1); + } + + i = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + p_70628_2_); + + for (int k = 0; k < i; ++k) + { + if (this.isBurning()) + { + this.dropItem(Items.cooked_beef, 1); + } + else + { + this.dropItem(Items.beef, 1); + } + } + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.bucket && !player.capabilities.isCreativeMode && !this.isChild()) + { + if (itemstack.stackSize-- == 1) + { + player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(Items.milk_bucket)); + } + else if (!player.inventory.addItemStackToInventory(new ItemStack(Items.milk_bucket))) + { + player.dropPlayerItemWithRandomChoice(new ItemStack(Items.milk_bucket, 1, 0), false); + } + + return true; + } + else + { + return super.interact(player); + } + } + + public EntityCow createChild(EntityAgeable ageable) + { + return new EntityCow(this.worldObj); + } + + public float getEyeHeight() + { + return this.height; + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityHorse.java b/src/minecraft/net/minecraft/entity/passive/EntityHorse.java new file mode 100644 index 0000000..f21025c --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityHorse.java @@ -0,0 +1,1884 @@ +package net.minecraft.entity.passive; + +import com.google.common.base.Predicate; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIFollowParent; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIMate; +import net.minecraft.entity.ai.EntityAIPanic; +import net.minecraft.entity.ai.EntityAIRunAroundLikeCrazy; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.ai.attributes.IAttribute; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.ai.attributes.RangedAttribute; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.AnimalChest; +import net.minecraft.inventory.IInvBasic; +import net.minecraft.inventory.InventoryBasic; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.potion.Potion; +import net.minecraft.server.management.PreYggdrasilConverter; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.World; + +public class EntityHorse extends EntityAnimal implements IInvBasic +{ + private static final Predicate horseBreedingSelector = new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_ instanceof EntityHorse && ((EntityHorse)p_apply_1_).isBreeding(); + } + }; + private static final IAttribute horseJumpStrength = (new RangedAttribute((IAttribute)null, "horse.jumpStrength", 0.7D, 0.0D, 2.0D)).setDescription("Jump Strength").setShouldWatch(true); + private static final String[] horseArmorTextures = new String[] {null, "textures/entity/horse/armor/horse_armor_iron.png", "textures/entity/horse/armor/horse_armor_gold.png", "textures/entity/horse/armor/horse_armor_diamond.png"}; + private static final String[] HORSE_ARMOR_TEXTURES_ABBR = new String[] {"", "meo", "goo", "dio"}; + private static final int[] armorValues = new int[] {0, 5, 7, 11}; + private static final String[] horseTextures = new String[] {"textures/entity/horse/horse_white.png", "textures/entity/horse/horse_creamy.png", "textures/entity/horse/horse_chestnut.png", "textures/entity/horse/horse_brown.png", "textures/entity/horse/horse_black.png", "textures/entity/horse/horse_gray.png", "textures/entity/horse/horse_darkbrown.png"}; + private static final String[] HORSE_TEXTURES_ABBR = new String[] {"hwh", "hcr", "hch", "hbr", "hbl", "hgr", "hdb"}; + private static final String[] horseMarkingTextures = new String[] {null, "textures/entity/horse/horse_markings_white.png", "textures/entity/horse/horse_markings_whitefield.png", "textures/entity/horse/horse_markings_whitedots.png", "textures/entity/horse/horse_markings_blackdots.png"}; + private static final String[] HORSE_MARKING_TEXTURES_ABBR = new String[] {"", "wo_", "wmo", "wdo", "bdo"}; + private int eatingHaystackCounter; + private int openMouthCounter; + private int jumpRearingCounter; + public int field_110278_bp; + public int field_110279_bq; + protected boolean horseJumping; + private AnimalChest horseChest; + private boolean hasReproduced; + + /** + * "The higher this value, the more likely the horse is to be tamed next time a player rides it." + */ + protected int temper; + protected float jumpPower; + private boolean field_110294_bI; + private float headLean; + private float prevHeadLean; + private float rearingAmount; + private float prevRearingAmount; + private float mouthOpenness; + private float prevMouthOpenness; + + /** Used to determine the sound that the horse should make when it steps */ + private int gallopTime; + private String texturePrefix; + private String[] horseTexturesArray = new String[3]; + private boolean field_175508_bO = false; + + public EntityHorse(World worldIn) + { + super(worldIn); + this.setSize(1.4F, 1.6F); + this.isImmuneToFire = false; + this.setChested(false); + ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.2D)); + this.tasks.addTask(1, new EntityAIRunAroundLikeCrazy(this, 1.2D)); + this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(4, new EntityAIFollowParent(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWander(this, 0.7D)); + this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.initHorseChest(); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Integer.valueOf(0)); + this.dataWatcher.addObject(19, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(20, Integer.valueOf(0)); + this.dataWatcher.addObject(21, String.valueOf((Object)"")); + this.dataWatcher.addObject(22, Integer.valueOf(0)); + } + + public void setHorseType(int type) + { + this.dataWatcher.updateObject(19, Byte.valueOf((byte)type)); + this.resetTexturePrefix(); + } + + /** + * Returns the horse type. 0 = Normal, 1 = Donkey, 2 = Mule, 3 = Undead Horse, 4 = Skeleton Horse + */ + public int getHorseType() + { + return this.dataWatcher.getWatchableObjectByte(19); + } + + public void setHorseVariant(int variant) + { + this.dataWatcher.updateObject(20, Integer.valueOf(variant)); + this.resetTexturePrefix(); + } + + public int getHorseVariant() + { + return this.dataWatcher.getWatchableObjectInt(20); + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + if (this.hasCustomName()) + { + return this.getCustomNameTag(); + } + else + { + int i = this.getHorseType(); + + switch (i) + { + case 0: + default: + return StatCollector.translateToLocal("entity.horse.name"); + + case 1: + return StatCollector.translateToLocal("entity.donkey.name"); + + case 2: + return StatCollector.translateToLocal("entity.mule.name"); + + case 3: + return StatCollector.translateToLocal("entity.zombiehorse.name"); + + case 4: + return StatCollector.translateToLocal("entity.skeletonhorse.name"); + } + } + } + + private boolean getHorseWatchableBoolean(int p_110233_1_) + { + return (this.dataWatcher.getWatchableObjectInt(16) & p_110233_1_) != 0; + } + + private void setHorseWatchableBoolean(int p_110208_1_, boolean p_110208_2_) + { + int i = this.dataWatcher.getWatchableObjectInt(16); + + if (p_110208_2_) + { + this.dataWatcher.updateObject(16, Integer.valueOf(i | p_110208_1_)); + } + else + { + this.dataWatcher.updateObject(16, Integer.valueOf(i & ~p_110208_1_)); + } + } + + public boolean isAdultHorse() + { + return !this.isChild(); + } + + public boolean isTame() + { + return this.getHorseWatchableBoolean(2); + } + + public boolean func_110253_bW() + { + return this.isAdultHorse(); + } + + /** + * Gets the horse's owner + */ + public String getOwnerId() + { + return this.dataWatcher.getWatchableObjectString(21); + } + + public void setOwnerId(String id) + { + this.dataWatcher.updateObject(21, id); + } + + public float getHorseSize() + { + return 0.5F; + } + + /** + * "Sets the scale for an ageable entity according to the boolean parameter, which says if it's a child." + */ + public void setScaleForAge(boolean p_98054_1_) + { + if (p_98054_1_) + { + this.setScale(this.getHorseSize()); + } + else + { + this.setScale(1.0F); + } + } + + public boolean isHorseJumping() + { + return this.horseJumping; + } + + public void setHorseTamed(boolean tamed) + { + this.setHorseWatchableBoolean(2, tamed); + } + + public void setHorseJumping(boolean jumping) + { + this.horseJumping = jumping; + } + + public boolean allowLeashing() + { + return !this.isUndead() && super.allowLeashing(); + } + + protected void func_142017_o(float p_142017_1_) + { + if (p_142017_1_ > 6.0F && this.isEatingHaystack()) + { + this.setEatingHaystack(false); + } + } + + public boolean isChested() + { + return this.getHorseWatchableBoolean(8); + } + + /** + * Returns type of armor from DataWatcher (0 = iron, 1 = gold, 2 = diamond) + */ + public int getHorseArmorIndexSynced() + { + return this.dataWatcher.getWatchableObjectInt(22); + } + + /** + * 0 = iron, 1 = gold, 2 = diamond + */ + private int getHorseArmorIndex(ItemStack itemStackIn) + { + if (itemStackIn == null) + { + return 0; + } + else + { + Item item = itemStackIn.getItem(); + return item == Items.iron_horse_armor ? 1 : (item == Items.golden_horse_armor ? 2 : (item == Items.diamond_horse_armor ? 3 : 0)); + } + } + + public boolean isEatingHaystack() + { + return this.getHorseWatchableBoolean(32); + } + + public boolean isRearing() + { + return this.getHorseWatchableBoolean(64); + } + + public boolean isBreeding() + { + return this.getHorseWatchableBoolean(16); + } + + public boolean getHasReproduced() + { + return this.hasReproduced; + } + + /** + * Set horse armor stack (for example: new ItemStack(Items.iron_horse_armor)) + */ + public void setHorseArmorStack(ItemStack itemStackIn) + { + this.dataWatcher.updateObject(22, Integer.valueOf(this.getHorseArmorIndex(itemStackIn))); + this.resetTexturePrefix(); + } + + public void setBreeding(boolean breeding) + { + this.setHorseWatchableBoolean(16, breeding); + } + + public void setChested(boolean chested) + { + this.setHorseWatchableBoolean(8, chested); + } + + public void setHasReproduced(boolean hasReproducedIn) + { + this.hasReproduced = hasReproducedIn; + } + + public void setHorseSaddled(boolean saddled) + { + this.setHorseWatchableBoolean(4, saddled); + } + + public int getTemper() + { + return this.temper; + } + + public void setTemper(int temperIn) + { + this.temper = temperIn; + } + + public int increaseTemper(int p_110198_1_) + { + int i = MathHelper.clamp_int(this.getTemper() + p_110198_1_, 0, this.getMaxTemper()); + this.setTemper(i); + return i; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + Entity entity = source.getEntity(); + return this.riddenByEntity != null && this.riddenByEntity.equals(entity) ? false : super.attackEntityFrom(source, amount); + } + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + return armorValues[this.getHorseArmorIndexSynced()]; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return this.riddenByEntity == null; + } + + public boolean prepareChunkForSpawn() + { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.posZ); + this.worldObj.getBiomeGenForCoords(new BlockPos(i, 0, j)); + return true; + } + + public void dropChests() + { + if (!this.worldObj.isRemote && this.isChested()) + { + this.dropItem(Item.getItemFromBlock(Blocks.chest), 1); + this.setChested(false); + } + } + + private void func_110266_cB() + { + this.openHorseMouth(); + + if (!this.isSilent()) + { + this.worldObj.playSoundAtEntity(this, "eating", 1.0F, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + } + } + + public void fall(float distance, float damageMultiplier) + { + if (distance > 1.0F) + { + this.playSound("mob.horse.land", 0.4F, 1.0F); + } + + int i = MathHelper.ceiling_float_int((distance * 0.5F - 3.0F) * damageMultiplier); + + if (i > 0) + { + this.attackEntityFrom(DamageSource.fall, (float)i); + + if (this.riddenByEntity != null) + { + this.riddenByEntity.attackEntityFrom(DamageSource.fall, (float)i); + } + + Block block = this.worldObj.getBlockState(new BlockPos(this.posX, this.posY - 0.2D - (double)this.prevRotationYaw, this.posZ)).getBlock(); + + if (block.getMaterial() != Material.air && !this.isSilent()) + { + Block.SoundType block$soundtype = block.stepSound; + this.worldObj.playSoundAtEntity(this, block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.5F, block$soundtype.getFrequency() * 0.75F); + } + } + } + + /** + * Returns number of slots depending horse type + */ + private int getChestSize() + { + int i = this.getHorseType(); + return !this.isChested() || i != 1 && i != 2 ? 2 : 17; + } + + private void initHorseChest() + { + AnimalChest animalchest = this.horseChest; + this.horseChest = new AnimalChest("HorseChest", this.getChestSize()); + this.horseChest.setCustomName(this.getName()); + + if (animalchest != null) + { + animalchest.func_110132_b(this); + int i = Math.min(animalchest.getSizeInventory(), this.horseChest.getSizeInventory()); + + for (int j = 0; j < i; ++j) + { + ItemStack itemstack = animalchest.getStackInSlot(j); + + if (itemstack != null) + { + this.horseChest.setInventorySlotContents(j, itemstack.copy()); + } + } + } + + this.horseChest.func_110134_a(this); + this.updateHorseSlots(); + } + + /** + * Updates the items in the saddle and armor slots of the horse's inventory. + */ + private void updateHorseSlots() + { + if (!this.worldObj.isRemote) + { + this.setHorseSaddled(this.horseChest.getStackInSlot(0) != null); + + if (this.canWearArmor()) + { + this.setHorseArmorStack(this.horseChest.getStackInSlot(1)); + } + } + } + + /** + * Called by InventoryBasic.onInventoryChanged() on a array that is never filled. + */ + public void onInventoryChanged(InventoryBasic p_76316_1_) + { + int i = this.getHorseArmorIndexSynced(); + boolean flag = this.isHorseSaddled(); + this.updateHorseSlots(); + + if (this.ticksExisted > 20) + { + if (i == 0 && i != this.getHorseArmorIndexSynced()) + { + this.playSound("mob.horse.armor", 0.5F, 1.0F); + } + else if (i != this.getHorseArmorIndexSynced()) + { + this.playSound("mob.horse.armor", 0.5F, 1.0F); + } + + if (!flag && this.isHorseSaddled()) + { + this.playSound("mob.horse.leather", 0.5F, 1.0F); + } + } + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + this.prepareChunkForSpawn(); + return super.getCanSpawnHere(); + } + + protected EntityHorse getClosestHorse(Entity entityIn, double distance) + { + double d0 = Double.MAX_VALUE; + Entity entity = null; + + for (Entity entity1 : this.worldObj.getEntitiesInAABBexcluding(entityIn, entityIn.getEntityBoundingBox().addCoord(distance, distance, distance), horseBreedingSelector)) + { + double d1 = entity1.getDistanceSq(entityIn.posX, entityIn.posY, entityIn.posZ); + + if (d1 < d0) + { + entity = entity1; + d0 = d1; + } + } + + return (EntityHorse)entity; + } + + public double getHorseJumpStrength() + { + return this.getEntityAttribute(horseJumpStrength).getAttributeValue(); + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + this.openHorseMouth(); + int i = this.getHorseType(); + return i == 3 ? "mob.horse.zombie.death" : (i == 4 ? "mob.horse.skeleton.death" : (i != 1 && i != 2 ? "mob.horse.death" : "mob.horse.donkey.death")); + } + + protected Item getDropItem() + { + boolean flag = this.rand.nextInt(4) == 0; + int i = this.getHorseType(); + return i == 4 ? Items.bone : (i == 3 ? (flag ? null : Items.rotten_flesh) : Items.leather); + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + this.openHorseMouth(); + + if (this.rand.nextInt(3) == 0) + { + this.makeHorseRear(); + } + + int i = this.getHorseType(); + return i == 3 ? "mob.horse.zombie.hit" : (i == 4 ? "mob.horse.skeleton.hit" : (i != 1 && i != 2 ? "mob.horse.hit" : "mob.horse.donkey.hit")); + } + + public boolean isHorseSaddled() + { + return this.getHorseWatchableBoolean(4); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + this.openHorseMouth(); + + if (this.rand.nextInt(10) == 0 && !this.isMovementBlocked()) + { + this.makeHorseRear(); + } + + int i = this.getHorseType(); + return i == 3 ? "mob.horse.zombie.idle" : (i == 4 ? "mob.horse.skeleton.idle" : (i != 1 && i != 2 ? "mob.horse.idle" : "mob.horse.donkey.idle")); + } + + protected String getAngrySoundName() + { + this.openHorseMouth(); + this.makeHorseRear(); + int i = this.getHorseType(); + return i != 3 && i != 4 ? (i != 1 && i != 2 ? "mob.horse.angry" : "mob.horse.donkey.angry") : null; + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + Block.SoundType block$soundtype = blockIn.stepSound; + + if (this.worldObj.getBlockState(pos.up()).getBlock() == Blocks.snow_layer) + { + block$soundtype = Blocks.snow_layer.stepSound; + } + + if (!blockIn.getMaterial().isLiquid()) + { + int i = this.getHorseType(); + + if (this.riddenByEntity != null && i != 1 && i != 2) + { + ++this.gallopTime; + + if (this.gallopTime > 5 && this.gallopTime % 3 == 0) + { + this.playSound("mob.horse.gallop", block$soundtype.getVolume() * 0.15F, block$soundtype.getFrequency()); + + if (i == 0 && this.rand.nextInt(10) == 0) + { + this.playSound("mob.horse.breathe", block$soundtype.getVolume() * 0.6F, block$soundtype.getFrequency()); + } + } + else if (this.gallopTime <= 5) + { + this.playSound("mob.horse.wood", block$soundtype.getVolume() * 0.15F, block$soundtype.getFrequency()); + } + } + else if (block$soundtype == Block.soundTypeWood) + { + this.playSound("mob.horse.wood", block$soundtype.getVolume() * 0.15F, block$soundtype.getFrequency()); + } + else + { + this.playSound("mob.horse.soft", block$soundtype.getVolume() * 0.15F, block$soundtype.getFrequency()); + } + } + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getAttributeMap().registerAttribute(horseJumpStrength); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(53.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.22499999403953552D); + } + + /** + * Will return how many at most can spawn in a chunk at once. + */ + public int getMaxSpawnedInChunk() + { + return 6; + } + + public int getMaxTemper() + { + return 100; + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.8F; + } + + /** + * Get number of ticks, at least during which the living entity will be silent. + */ + public int getTalkInterval() + { + return 400; + } + + public boolean func_110239_cn() + { + return this.getHorseType() == 0 || this.getHorseArmorIndexSynced() > 0; + } + + private void resetTexturePrefix() + { + this.texturePrefix = null; + } + + public boolean func_175507_cI() + { + return this.field_175508_bO; + } + + private void setHorseTexturePaths() + { + this.texturePrefix = "horse/"; + this.horseTexturesArray[0] = null; + this.horseTexturesArray[1] = null; + this.horseTexturesArray[2] = null; + int i = this.getHorseType(); + int j = this.getHorseVariant(); + + if (i == 0) + { + int k = j & 255; + int l = (j & 65280) >> 8; + + if (k >= horseTextures.length) + { + this.field_175508_bO = false; + return; + } + + this.horseTexturesArray[0] = horseTextures[k]; + this.texturePrefix = this.texturePrefix + HORSE_TEXTURES_ABBR[k]; + + if (l >= horseMarkingTextures.length) + { + this.field_175508_bO = false; + return; + } + + this.horseTexturesArray[1] = horseMarkingTextures[l]; + this.texturePrefix = this.texturePrefix + HORSE_MARKING_TEXTURES_ABBR[l]; + } + else + { + this.horseTexturesArray[0] = ""; + this.texturePrefix = this.texturePrefix + "_" + i + "_"; + } + + int i1 = this.getHorseArmorIndexSynced(); + + if (i1 >= horseArmorTextures.length) + { + this.field_175508_bO = false; + } + else + { + this.horseTexturesArray[2] = horseArmorTextures[i1]; + this.texturePrefix = this.texturePrefix + HORSE_ARMOR_TEXTURES_ABBR[i1]; + this.field_175508_bO = true; + } + } + + public String getHorseTexture() + { + if (this.texturePrefix == null) + { + this.setHorseTexturePaths(); + } + + return this.texturePrefix; + } + + public String[] getVariantTexturePaths() + { + if (this.texturePrefix == null) + { + this.setHorseTexturePaths(); + } + + return this.horseTexturesArray; + } + + public void openGUI(EntityPlayer playerEntity) + { + if (!this.worldObj.isRemote && (this.riddenByEntity == null || this.riddenByEntity == playerEntity) && this.isTame()) + { + this.horseChest.setCustomName(this.getName()); + playerEntity.displayGUIHorse(this, this.horseChest); + } + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.spawn_egg) + { + return super.interact(player); + } + else if (!this.isTame() && this.isUndead()) + { + return false; + } + else if (this.isTame() && this.isAdultHorse() && player.isSneaking()) + { + this.openGUI(player); + return true; + } + else if (this.func_110253_bW() && this.riddenByEntity != null) + { + return super.interact(player); + } + else + { + if (itemstack != null) + { + boolean flag = false; + + if (this.canWearArmor()) + { + int i = -1; + + if (itemstack.getItem() == Items.iron_horse_armor) + { + i = 1; + } + else if (itemstack.getItem() == Items.golden_horse_armor) + { + i = 2; + } + else if (itemstack.getItem() == Items.diamond_horse_armor) + { + i = 3; + } + + if (i >= 0) + { + if (!this.isTame()) + { + this.makeHorseRearWithSound(); + return true; + } + + this.openGUI(player); + return true; + } + } + + if (!flag && !this.isUndead()) + { + float f = 0.0F; + int j = 0; + int k = 0; + + if (itemstack.getItem() == Items.wheat) + { + f = 2.0F; + j = 20; + k = 3; + } + else if (itemstack.getItem() == Items.sugar) + { + f = 1.0F; + j = 30; + k = 3; + } + else if (Block.getBlockFromItem(itemstack.getItem()) == Blocks.hay_block) + { + f = 20.0F; + j = 180; + } + else if (itemstack.getItem() == Items.apple) + { + f = 3.0F; + j = 60; + k = 3; + } + else if (itemstack.getItem() == Items.golden_carrot) + { + f = 4.0F; + j = 60; + k = 5; + + if (this.isTame() && this.getGrowingAge() == 0) + { + flag = true; + this.setInLove(player); + } + } + else if (itemstack.getItem() == Items.golden_apple) + { + f = 10.0F; + j = 240; + k = 10; + + if (this.isTame() && this.getGrowingAge() == 0) + { + flag = true; + this.setInLove(player); + } + } + + if (this.getHealth() < this.getMaxHealth() && f > 0.0F) + { + this.heal(f); + flag = true; + } + + if (!this.isAdultHorse() && j > 0) + { + this.addGrowth(j); + flag = true; + } + + if (k > 0 && (flag || !this.isTame()) && k < this.getMaxTemper()) + { + flag = true; + this.increaseTemper(k); + } + + if (flag) + { + this.func_110266_cB(); + } + } + + if (!this.isTame() && !flag) + { + if (itemstack != null && itemstack.interactWithEntity(player, this)) + { + return true; + } + + this.makeHorseRearWithSound(); + return true; + } + + if (!flag && this.canCarryChest() && !this.isChested() && itemstack.getItem() == Item.getItemFromBlock(Blocks.chest)) + { + this.setChested(true); + this.playSound("mob.chickenplop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + flag = true; + this.initHorseChest(); + } + + if (!flag && this.func_110253_bW() && !this.isHorseSaddled() && itemstack.getItem() == Items.saddle) + { + this.openGUI(player); + return true; + } + + if (flag) + { + if (!player.capabilities.isCreativeMode && --itemstack.stackSize == 0) + { + player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null); + } + + return true; + } + } + + if (this.func_110253_bW() && this.riddenByEntity == null) + { + if (itemstack != null && itemstack.interactWithEntity(player, this)) + { + return true; + } + else + { + this.mountTo(player); + return true; + } + } + else + { + return super.interact(player); + } + } + } + + private void mountTo(EntityPlayer player) + { + player.rotationYaw = this.rotationYaw; + player.rotationPitch = this.rotationPitch; + this.setEatingHaystack(false); + this.setRearing(false); + + if (!this.worldObj.isRemote) + { + player.mountEntity(this); + } + } + + /** + * Return true if the horse entity can wear an armor + */ + public boolean canWearArmor() + { + return this.getHorseType() == 0; + } + + /** + * Return true if the horse entity can carry a chest. + */ + public boolean canCarryChest() + { + int i = this.getHorseType(); + return i == 2 || i == 1; + } + + /** + * Dead and sleeping entities cannot move + */ + protected boolean isMovementBlocked() + { + return this.riddenByEntity != null && this.isHorseSaddled() ? true : this.isEatingHaystack() || this.isRearing(); + } + + /** + * Used to know if the horse can be leashed, if he can mate, or if we can interact with him + */ + public boolean isUndead() + { + int i = this.getHorseType(); + return i == 3 || i == 4; + } + + /** + * Return true if the horse entity is sterile (Undead || Mule) + */ + public boolean isSterile() + { + return this.isUndead() || this.getHorseType() == 2; + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack stack) + { + return false; + } + + private void func_110210_cH() + { + this.field_110278_bp = 1; + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource cause) + { + super.onDeath(cause); + + if (!this.worldObj.isRemote) + { + this.dropChestItems(); + } + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.rand.nextInt(200) == 0) + { + this.func_110210_cH(); + } + + super.onLivingUpdate(); + + if (!this.worldObj.isRemote) + { + if (this.rand.nextInt(900) == 0 && this.deathTime == 0) + { + this.heal(1.0F); + } + + if (!this.isEatingHaystack() && this.riddenByEntity == null && this.rand.nextInt(300) == 0 && this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY) - 1, MathHelper.floor_double(this.posZ))).getBlock() == Blocks.grass) + { + this.setEatingHaystack(true); + } + + if (this.isEatingHaystack() && ++this.eatingHaystackCounter > 50) + { + this.eatingHaystackCounter = 0; + this.setEatingHaystack(false); + } + + if (this.isBreeding() && !this.isAdultHorse() && !this.isEatingHaystack()) + { + EntityHorse entityhorse = this.getClosestHorse(this, 16.0D); + + if (entityhorse != null && this.getDistanceSqToEntity(entityhorse) > 4.0D) + { + this.navigator.getPathToEntityLiving(entityhorse); + } + } + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.worldObj.isRemote && this.dataWatcher.hasObjectChanged()) + { + this.dataWatcher.func_111144_e(); + this.resetTexturePrefix(); + } + + if (this.openMouthCounter > 0 && ++this.openMouthCounter > 30) + { + this.openMouthCounter = 0; + this.setHorseWatchableBoolean(128, false); + } + + if (!this.worldObj.isRemote && this.jumpRearingCounter > 0 && ++this.jumpRearingCounter > 20) + { + this.jumpRearingCounter = 0; + this.setRearing(false); + } + + if (this.field_110278_bp > 0 && ++this.field_110278_bp > 8) + { + this.field_110278_bp = 0; + } + + if (this.field_110279_bq > 0) + { + ++this.field_110279_bq; + + if (this.field_110279_bq > 300) + { + this.field_110279_bq = 0; + } + } + + this.prevHeadLean = this.headLean; + + if (this.isEatingHaystack()) + { + this.headLean += (1.0F - this.headLean) * 0.4F + 0.05F; + + if (this.headLean > 1.0F) + { + this.headLean = 1.0F; + } + } + else + { + this.headLean += (0.0F - this.headLean) * 0.4F - 0.05F; + + if (this.headLean < 0.0F) + { + this.headLean = 0.0F; + } + } + + this.prevRearingAmount = this.rearingAmount; + + if (this.isRearing()) + { + this.prevHeadLean = this.headLean = 0.0F; + this.rearingAmount += (1.0F - this.rearingAmount) * 0.4F + 0.05F; + + if (this.rearingAmount > 1.0F) + { + this.rearingAmount = 1.0F; + } + } + else + { + this.field_110294_bI = false; + this.rearingAmount += (0.8F * this.rearingAmount * this.rearingAmount * this.rearingAmount - this.rearingAmount) * 0.6F - 0.05F; + + if (this.rearingAmount < 0.0F) + { + this.rearingAmount = 0.0F; + } + } + + this.prevMouthOpenness = this.mouthOpenness; + + if (this.getHorseWatchableBoolean(128)) + { + this.mouthOpenness += (1.0F - this.mouthOpenness) * 0.7F + 0.05F; + + if (this.mouthOpenness > 1.0F) + { + this.mouthOpenness = 1.0F; + } + } + else + { + this.mouthOpenness += (0.0F - this.mouthOpenness) * 0.7F - 0.05F; + + if (this.mouthOpenness < 0.0F) + { + this.mouthOpenness = 0.0F; + } + } + } + + private void openHorseMouth() + { + if (!this.worldObj.isRemote) + { + this.openMouthCounter = 1; + this.setHorseWatchableBoolean(128, true); + } + } + + /** + * Return true if the horse entity ready to mate. (no rider, not riding, tame, adult, not steril...) + */ + private boolean canMate() + { + return this.riddenByEntity == null && this.ridingEntity == null && this.isTame() && this.isAdultHorse() && !this.isSterile() && this.getHealth() >= this.getMaxHealth() && this.isInLove(); + } + + public void setEating(boolean eating) + { + this.setHorseWatchableBoolean(32, eating); + } + + public void setEatingHaystack(boolean p_110227_1_) + { + this.setEating(p_110227_1_); + } + + public void setRearing(boolean rearing) + { + if (rearing) + { + this.setEatingHaystack(false); + } + + this.setHorseWatchableBoolean(64, rearing); + } + + private void makeHorseRear() + { + if (!this.worldObj.isRemote) + { + this.jumpRearingCounter = 1; + this.setRearing(true); + } + } + + public void makeHorseRearWithSound() + { + this.makeHorseRear(); + String s = this.getAngrySoundName(); + + if (s != null) + { + this.playSound(s, this.getSoundVolume(), this.getSoundPitch()); + } + } + + public void dropChestItems() + { + this.dropItemsInChest(this, this.horseChest); + this.dropChests(); + } + + private void dropItemsInChest(Entity entityIn, AnimalChest animalChestIn) + { + if (animalChestIn != null && !this.worldObj.isRemote) + { + for (int i = 0; i < animalChestIn.getSizeInventory(); ++i) + { + ItemStack itemstack = animalChestIn.getStackInSlot(i); + + if (itemstack != null) + { + this.entityDropItem(itemstack, 0.0F); + } + } + } + } + + public boolean setTamedBy(EntityPlayer player) + { + this.setOwnerId(player.getUniqueID().toString()); + this.setHorseTamed(true); + return true; + } + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float strafe, float forward) + { + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase && this.isHorseSaddled()) + { + this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw; + this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F; + this.setRotation(this.rotationYaw, this.rotationPitch); + this.rotationYawHead = this.renderYawOffset = this.rotationYaw; + strafe = ((EntityLivingBase)this.riddenByEntity).moveStrafing * 0.5F; + forward = ((EntityLivingBase)this.riddenByEntity).moveForward; + + if (forward <= 0.0F) + { + forward *= 0.25F; + this.gallopTime = 0; + } + + if (this.onGround && this.jumpPower == 0.0F && this.isRearing() && !this.field_110294_bI) + { + strafe = 0.0F; + forward = 0.0F; + } + + if (this.jumpPower > 0.0F && !this.isHorseJumping() && this.onGround) + { + this.motionY = this.getHorseJumpStrength() * (double)this.jumpPower; + + if (this.isPotionActive(Potion.jump)) + { + this.motionY += (double)((float)(this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F); + } + + this.setHorseJumping(true); + this.isAirBorne = true; + + if (forward > 0.0F) + { + float f = MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F); + float f1 = MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F); + this.motionX += (double)(-0.4F * f * this.jumpPower); + this.motionZ += (double)(0.4F * f1 * this.jumpPower); + this.playSound("mob.horse.jump", 0.4F, 1.0F); + } + + this.jumpPower = 0.0F; + } + + this.stepHeight = 1.0F; + this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F; + + if (!this.worldObj.isRemote) + { + this.setAIMoveSpeed((float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue()); + super.moveEntityWithHeading(strafe, forward); + } + + if (this.onGround) + { + this.jumpPower = 0.0F; + this.setHorseJumping(false); + } + + this.prevLimbSwingAmount = this.limbSwingAmount; + double d1 = this.posX - this.prevPosX; + double d0 = this.posZ - this.prevPosZ; + float f2 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F; + + if (f2 > 1.0F) + { + f2 = 1.0F; + } + + this.limbSwingAmount += (f2 - this.limbSwingAmount) * 0.4F; + this.limbSwing += this.limbSwingAmount; + } + else + { + this.stepHeight = 0.5F; + this.jumpMovementFactor = 0.02F; + super.moveEntityWithHeading(strafe, forward); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setBoolean("EatingHaystack", this.isEatingHaystack()); + tagCompound.setBoolean("ChestedHorse", this.isChested()); + tagCompound.setBoolean("HasReproduced", this.getHasReproduced()); + tagCompound.setBoolean("Bred", this.isBreeding()); + tagCompound.setInteger("Type", this.getHorseType()); + tagCompound.setInteger("Variant", this.getHorseVariant()); + tagCompound.setInteger("Temper", this.getTemper()); + tagCompound.setBoolean("Tame", this.isTame()); + tagCompound.setString("OwnerUUID", this.getOwnerId()); + + if (this.isChested()) + { + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 2; i < this.horseChest.getSizeInventory(); ++i) + { + ItemStack itemstack = this.horseChest.getStackInSlot(i); + + if (itemstack != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Slot", (byte)i); + itemstack.writeToNBT(nbttagcompound); + nbttaglist.appendTag(nbttagcompound); + } + } + + tagCompound.setTag("Items", nbttaglist); + } + + if (this.horseChest.getStackInSlot(1) != null) + { + tagCompound.setTag("ArmorItem", this.horseChest.getStackInSlot(1).writeToNBT(new NBTTagCompound())); + } + + if (this.horseChest.getStackInSlot(0) != null) + { + tagCompound.setTag("SaddleItem", this.horseChest.getStackInSlot(0).writeToNBT(new NBTTagCompound())); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.setEatingHaystack(tagCompund.getBoolean("EatingHaystack")); + this.setBreeding(tagCompund.getBoolean("Bred")); + this.setChested(tagCompund.getBoolean("ChestedHorse")); + this.setHasReproduced(tagCompund.getBoolean("HasReproduced")); + this.setHorseType(tagCompund.getInteger("Type")); + this.setHorseVariant(tagCompund.getInteger("Variant")); + this.setTemper(tagCompund.getInteger("Temper")); + this.setHorseTamed(tagCompund.getBoolean("Tame")); + String s = ""; + + if (tagCompund.hasKey("OwnerUUID", 8)) + { + s = tagCompund.getString("OwnerUUID"); + } + else + { + String s1 = tagCompund.getString("Owner"); + s = PreYggdrasilConverter.getStringUUIDFromName(s1); + } + + if (s.length() > 0) + { + this.setOwnerId(s); + } + + IAttributeInstance iattributeinstance = this.getAttributeMap().getAttributeInstanceByName("Speed"); + + if (iattributeinstance != null) + { + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(iattributeinstance.getBaseValue() * 0.25D); + } + + if (this.isChested()) + { + NBTTagList nbttaglist = tagCompund.getTagList("Items", 10); + this.initHorseChest(); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound.getByte("Slot") & 255; + + if (j >= 2 && j < this.horseChest.getSizeInventory()) + { + this.horseChest.setInventorySlotContents(j, ItemStack.loadItemStackFromNBT(nbttagcompound)); + } + } + } + + if (tagCompund.hasKey("ArmorItem", 10)) + { + ItemStack itemstack = ItemStack.loadItemStackFromNBT(tagCompund.getCompoundTag("ArmorItem")); + + if (itemstack != null && isArmorItem(itemstack.getItem())) + { + this.horseChest.setInventorySlotContents(1, itemstack); + } + } + + if (tagCompund.hasKey("SaddleItem", 10)) + { + ItemStack itemstack1 = ItemStack.loadItemStackFromNBT(tagCompund.getCompoundTag("SaddleItem")); + + if (itemstack1 != null && itemstack1.getItem() == Items.saddle) + { + this.horseChest.setInventorySlotContents(0, itemstack1); + } + } + else if (tagCompund.getBoolean("Saddle")) + { + this.horseChest.setInventorySlotContents(0, new ItemStack(Items.saddle)); + } + + this.updateHorseSlots(); + } + + /** + * Returns true if the mob is currently able to mate with the specified mob. + */ + public boolean canMateWith(EntityAnimal otherAnimal) + { + if (otherAnimal == this) + { + return false; + } + else if (otherAnimal.getClass() != this.getClass()) + { + return false; + } + else + { + EntityHorse entityhorse = (EntityHorse)otherAnimal; + + if (this.canMate() && entityhorse.canMate()) + { + int i = this.getHorseType(); + int j = entityhorse.getHorseType(); + return i == j || i == 0 && j == 1 || i == 1 && j == 0; + } + else + { + return false; + } + } + } + + public EntityAgeable createChild(EntityAgeable ageable) + { + EntityHorse entityhorse = (EntityHorse)ageable; + EntityHorse entityhorse1 = new EntityHorse(this.worldObj); + int i = this.getHorseType(); + int j = entityhorse.getHorseType(); + int k = 0; + + if (i == j) + { + k = i; + } + else if (i == 0 && j == 1 || i == 1 && j == 0) + { + k = 2; + } + + if (k == 0) + { + int i1 = this.rand.nextInt(9); + int l; + + if (i1 < 4) + { + l = this.getHorseVariant() & 255; + } + else if (i1 < 8) + { + l = entityhorse.getHorseVariant() & 255; + } + else + { + l = this.rand.nextInt(7); + } + + int j1 = this.rand.nextInt(5); + + if (j1 < 2) + { + l = l | this.getHorseVariant() & 65280; + } + else if (j1 < 4) + { + l = l | entityhorse.getHorseVariant() & 65280; + } + else + { + l = l | this.rand.nextInt(5) << 8 & 65280; + } + + entityhorse1.setHorseVariant(l); + } + + entityhorse1.setHorseType(k); + double d1 = this.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue() + ageable.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue() + (double)this.getModifiedMaxHealth(); + entityhorse1.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(d1 / 3.0D); + double d2 = this.getEntityAttribute(horseJumpStrength).getBaseValue() + ageable.getEntityAttribute(horseJumpStrength).getBaseValue() + this.getModifiedJumpStrength(); + entityhorse1.getEntityAttribute(horseJumpStrength).setBaseValue(d2 / 3.0D); + double d0 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getBaseValue() + ageable.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getBaseValue() + this.getModifiedMovementSpeed(); + entityhorse1.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(d0 / 3.0D); + return entityhorse1; + } + + /** + * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called + * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory + */ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + livingdata = super.onInitialSpawn(difficulty, livingdata); + int i = 0; + int j = 0; + + if (livingdata instanceof EntityHorse.GroupData) + { + i = ((EntityHorse.GroupData)livingdata).horseType; + j = ((EntityHorse.GroupData)livingdata).horseVariant & 255 | this.rand.nextInt(5) << 8; + } + else + { + if (this.rand.nextInt(10) == 0) + { + i = 1; + } + else + { + int k = this.rand.nextInt(7); + int l = this.rand.nextInt(5); + i = 0; + j = k | l << 8; + } + + livingdata = new EntityHorse.GroupData(i, j); + } + + this.setHorseType(i); + this.setHorseVariant(j); + + if (this.rand.nextInt(5) == 0) + { + this.setGrowingAge(-24000); + } + + if (i != 4 && i != 3) + { + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue((double)this.getModifiedMaxHealth()); + + if (i == 0) + { + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(this.getModifiedMovementSpeed()); + } + else + { + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.17499999701976776D); + } + } + else + { + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(15.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.20000000298023224D); + } + + if (i != 2 && i != 1) + { + this.getEntityAttribute(horseJumpStrength).setBaseValue(this.getModifiedJumpStrength()); + } + else + { + this.getEntityAttribute(horseJumpStrength).setBaseValue(0.5D); + } + + this.setHealth(this.getMaxHealth()); + return livingdata; + } + + public float getGrassEatingAmount(float p_110258_1_) + { + return this.prevHeadLean + (this.headLean - this.prevHeadLean) * p_110258_1_; + } + + public float getRearingAmount(float p_110223_1_) + { + return this.prevRearingAmount + (this.rearingAmount - this.prevRearingAmount) * p_110223_1_; + } + + public float getMouthOpennessAngle(float p_110201_1_) + { + return this.prevMouthOpenness + (this.mouthOpenness - this.prevMouthOpenness) * p_110201_1_; + } + + public void setJumpPower(int jumpPowerIn) + { + if (this.isHorseSaddled()) + { + if (jumpPowerIn < 0) + { + jumpPowerIn = 0; + } + else + { + this.field_110294_bI = true; + this.makeHorseRear(); + } + + if (jumpPowerIn >= 90) + { + this.jumpPower = 1.0F; + } + else + { + this.jumpPower = 0.4F + 0.4F * (float)jumpPowerIn / 90.0F; + } + } + } + + /** + * "Spawns particles for the horse entity. par1 tells whether to spawn hearts. If it is false, it spawns smoke." + */ + protected void spawnHorseParticles(boolean p_110216_1_) + { + EnumParticleTypes enumparticletypes = p_110216_1_ ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL; + + for (int i = 0; i < 7; ++i) + { + double d0 = this.rand.nextGaussian() * 0.02D; + double d1 = this.rand.nextGaussian() * 0.02D; + double d2 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle(enumparticletypes, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2, new int[0]); + } + } + + public void handleStatusUpdate(byte id) + { + if (id == 7) + { + this.spawnHorseParticles(true); + } + else if (id == 6) + { + this.spawnHorseParticles(false); + } + else + { + super.handleStatusUpdate(id); + } + } + + public void updateRiderPosition() + { + super.updateRiderPosition(); + + if (this.prevRearingAmount > 0.0F) + { + float f = MathHelper.sin(this.renderYawOffset * (float)Math.PI / 180.0F); + float f1 = MathHelper.cos(this.renderYawOffset * (float)Math.PI / 180.0F); + float f2 = 0.7F * this.prevRearingAmount; + float f3 = 0.15F * this.prevRearingAmount; + this.riddenByEntity.setPosition(this.posX + (double)(f2 * f), this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset() + (double)f3, this.posZ - (double)(f2 * f1)); + + if (this.riddenByEntity instanceof EntityLivingBase) + { + ((EntityLivingBase)this.riddenByEntity).renderYawOffset = this.renderYawOffset; + } + } + } + + /** + * Returns randomized max health + */ + private float getModifiedMaxHealth() + { + return 15.0F + (float)this.rand.nextInt(8) + (float)this.rand.nextInt(9); + } + + /** + * Returns randomized jump strength + */ + private double getModifiedJumpStrength() + { + return 0.4000000059604645D + this.rand.nextDouble() * 0.2D + this.rand.nextDouble() * 0.2D + this.rand.nextDouble() * 0.2D; + } + + /** + * Returns randomized movement speed + */ + private double getModifiedMovementSpeed() + { + return (0.44999998807907104D + this.rand.nextDouble() * 0.3D + this.rand.nextDouble() * 0.3D + this.rand.nextDouble() * 0.3D) * 0.25D; + } + + /** + * Returns true if given item is horse armor + */ + public static boolean isArmorItem(Item p_146085_0_) + { + return p_146085_0_ == Items.iron_horse_armor || p_146085_0_ == Items.golden_horse_armor || p_146085_0_ == Items.diamond_horse_armor; + } + + /** + * returns true if this entity is by a ladder, false otherwise + */ + public boolean isOnLadder() + { + return false; + } + + public float getEyeHeight() + { + return this.height; + } + + public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn) + { + if (inventorySlot == 499 && this.canCarryChest()) + { + if (itemStackIn == null && this.isChested()) + { + this.setChested(false); + this.initHorseChest(); + return true; + } + + if (itemStackIn != null && itemStackIn.getItem() == Item.getItemFromBlock(Blocks.chest) && !this.isChested()) + { + this.setChested(true); + this.initHorseChest(); + return true; + } + } + + int i = inventorySlot - 400; + + if (i >= 0 && i < 2 && i < this.horseChest.getSizeInventory()) + { + if (i == 0 && itemStackIn != null && itemStackIn.getItem() != Items.saddle) + { + return false; + } + else if (i != 1 || (itemStackIn == null || isArmorItem(itemStackIn.getItem())) && this.canWearArmor()) + { + this.horseChest.setInventorySlotContents(i, itemStackIn); + this.updateHorseSlots(); + return true; + } + else + { + return false; + } + } + else + { + int j = inventorySlot - 500 + 2; + + if (j >= 2 && j < this.horseChest.getSizeInventory()) + { + this.horseChest.setInventorySlotContents(j, itemStackIn); + return true; + } + else + { + return false; + } + } + } + + public static class GroupData implements IEntityLivingData + { + public int horseType; + public int horseVariant; + + public GroupData(int type, int variant) + { + this.horseType = type; + this.horseVariant = variant; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityMooshroom.java b/src/minecraft/net/minecraft/entity/passive/EntityMooshroom.java new file mode 100644 index 0000000..5684bad --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityMooshroom.java @@ -0,0 +1,83 @@ +package net.minecraft.entity.passive; + +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class EntityMooshroom extends EntityCow +{ + public EntityMooshroom(World worldIn) + { + super(worldIn); + this.setSize(0.9F, 1.3F); + this.spawnableBlock = Blocks.mycelium; + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.bowl && this.getGrowingAge() >= 0) + { + if (itemstack.stackSize == 1) + { + player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(Items.mushroom_stew)); + return true; + } + + if (player.inventory.addItemStackToInventory(new ItemStack(Items.mushroom_stew)) && !player.capabilities.isCreativeMode) + { + player.inventory.decrStackSize(player.inventory.currentItem, 1); + return true; + } + } + + if (itemstack != null && itemstack.getItem() == Items.shears && this.getGrowingAge() >= 0) + { + this.setDead(); + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); + + if (!this.worldObj.isRemote) + { + EntityCow entitycow = new EntityCow(this.worldObj); + entitycow.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + entitycow.setHealth(this.getHealth()); + entitycow.renderYawOffset = this.renderYawOffset; + + if (this.hasCustomName()) + { + entitycow.setCustomNameTag(this.getCustomNameTag()); + } + + this.worldObj.spawnEntityInWorld(entitycow); + + for (int i = 0; i < 5; ++i) + { + this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY + (double)this.height, this.posZ, new ItemStack(Blocks.red_mushroom))); + } + + itemstack.damageItem(1, player); + this.playSound("mob.sheep.shear", 1.0F, 1.0F); + } + + return true; + } + else + { + return super.interact(player); + } + } + + public EntityMooshroom createChild(EntityAgeable ageable) + { + return new EntityMooshroom(this.worldObj); + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityOcelot.java b/src/minecraft/net/minecraft/entity/passive/EntityOcelot.java new file mode 100644 index 0000000..7554d16 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityOcelot.java @@ -0,0 +1,387 @@ +package net.minecraft.entity.passive; + +import com.google.common.base.Predicate; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAvoidEntity; +import net.minecraft.entity.ai.EntityAIFollowOwner; +import net.minecraft.entity.ai.EntityAILeapAtTarget; +import net.minecraft.entity.ai.EntityAIMate; +import net.minecraft.entity.ai.EntityAIOcelotAttack; +import net.minecraft.entity.ai.EntityAIOcelotSit; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAITargetNonTamed; +import net.minecraft.entity.ai.EntityAITempt; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.StatCollector; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.World; + +public class EntityOcelot extends EntityTameable +{ + private EntityAIAvoidEntity avoidEntity; + + /** + * The tempt AI task for this mob, used to prevent taming while it is fleeing. + */ + private EntityAITempt aiTempt; + + public EntityOcelot(World worldIn) + { + super(worldIn); + this.setSize(0.6F, 0.7F); + ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, this.aiSit); + this.tasks.addTask(3, this.aiTempt = new EntityAITempt(this, 0.6D, Items.fish, true)); + this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 5.0F)); + this.tasks.addTask(6, new EntityAIOcelotSit(this, 0.8D)); + this.tasks.addTask(7, new EntityAILeapAtTarget(this, 0.3F)); + this.tasks.addTask(8, new EntityAIOcelotAttack(this)); + this.tasks.addTask(9, new EntityAIMate(this, 0.8D)); + this.tasks.addTask(10, new EntityAIWander(this, 0.8D)); + this.tasks.addTask(11, new EntityAIWatchClosest(this, EntityPlayer.class, 10.0F)); + this.targetTasks.addTask(1, new EntityAITargetNonTamed(this, EntityChicken.class, false, (Predicate)null)); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(18, Byte.valueOf((byte)0)); + } + + public void updateAITasks() + { + if (this.getMoveHelper().isUpdating()) + { + double d0 = this.getMoveHelper().getSpeed(); + + if (d0 == 0.6D) + { + this.setSneaking(true); + this.setSprinting(false); + } + else if (d0 == 1.33D) + { + this.setSneaking(false); + this.setSprinting(true); + } + else + { + this.setSneaking(false); + this.setSprinting(false); + } + } + else + { + this.setSneaking(false); + this.setSprinting(false); + } + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return !this.isTamed() && this.ticksExisted > 2400; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); + } + + public void fall(float distance, float damageMultiplier) + { + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("CatType", this.getTameSkin()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.setTameSkin(tagCompund.getInteger("CatType")); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return this.isTamed() ? (this.isInLove() ? "mob.cat.purr" : (this.rand.nextInt(4) == 0 ? "mob.cat.purreow" : "mob.cat.meow")) : ""; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.cat.hitt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.cat.hitt"; + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.4F; + } + + protected Item getDropItem() + { + return Items.leather; + } + + public boolean attackEntityAsMob(Entity entityIn) + { + return entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), 3.0F); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + this.aiSit.setSitting(false); + return super.attackEntityFrom(source, amount); + } + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + + if (this.isTamed()) + { + if (this.isOwner(player) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack)) + { + this.aiSit.setSitting(!this.isSitting()); + } + } + else if (this.aiTempt.isRunning() && itemstack != null && itemstack.getItem() == Items.fish && player.getDistanceSqToEntity(this) < 9.0D) + { + if (!player.capabilities.isCreativeMode) + { + --itemstack.stackSize; + } + + if (itemstack.stackSize <= 0) + { + player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null); + } + + if (!this.worldObj.isRemote) + { + if (this.rand.nextInt(3) == 0) + { + this.setTamed(true); + this.setTameSkin(1 + this.worldObj.rand.nextInt(3)); + this.setOwnerId(player.getUniqueID().toString()); + this.playTameEffect(true); + this.aiSit.setSitting(true); + this.worldObj.setEntityState(this, (byte)7); + } + else + { + this.playTameEffect(false); + this.worldObj.setEntityState(this, (byte)6); + } + } + + return true; + } + + return super.interact(player); + } + + public EntityOcelot createChild(EntityAgeable ageable) + { + EntityOcelot entityocelot = new EntityOcelot(this.worldObj); + + if (this.isTamed()) + { + entityocelot.setOwnerId(this.getOwnerId()); + entityocelot.setTamed(true); + entityocelot.setTameSkin(this.getTameSkin()); + } + + return entityocelot; + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack stack) + { + return stack != null && stack.getItem() == Items.fish; + } + + /** + * Returns true if the mob is currently able to mate with the specified mob. + */ + public boolean canMateWith(EntityAnimal otherAnimal) + { + if (otherAnimal == this) + { + return false; + } + else if (!this.isTamed()) + { + return false; + } + else if (!(otherAnimal instanceof EntityOcelot)) + { + return false; + } + else + { + EntityOcelot entityocelot = (EntityOcelot)otherAnimal; + return !entityocelot.isTamed() ? false : this.isInLove() && entityocelot.isInLove(); + } + } + + public int getTameSkin() + { + return this.dataWatcher.getWatchableObjectByte(18); + } + + public void setTameSkin(int skinId) + { + this.dataWatcher.updateObject(18, Byte.valueOf((byte)skinId)); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.worldObj.rand.nextInt(3) != 0; + } + + /** + * Checks that the entity is not colliding with any blocks / liquids + */ + public boolean isNotColliding() + { + if (this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox())) + { + BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ); + + if (blockpos.getY() < this.worldObj.func_181545_F()) + { + return false; + } + + Block block = this.worldObj.getBlockState(blockpos.down()).getBlock(); + + if (block == Blocks.grass || block.getMaterial() == Material.leaves) + { + return true; + } + } + + return false; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.hasCustomName() ? this.getCustomNameTag() : (this.isTamed() ? StatCollector.translateToLocal("entity.Cat.name") : super.getName()); + } + + public void setTamed(boolean tamed) + { + super.setTamed(tamed); + } + + protected void setupTamedAI() + { + if (this.avoidEntity == null) + { + this.avoidEntity = new EntityAIAvoidEntity(this, EntityPlayer.class, 16.0F, 0.8D, 1.33D); + } + + this.tasks.removeTask(this.avoidEntity); + + if (!this.isTamed()) + { + this.tasks.addTask(4, this.avoidEntity); + } + } + + /** + * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called + * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory + */ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + livingdata = super.onInitialSpawn(difficulty, livingdata); + + if (this.worldObj.rand.nextInt(7) == 0) + { + for (int i = 0; i < 2; ++i) + { + EntityOcelot entityocelot = new EntityOcelot(this.worldObj); + entityocelot.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); + entityocelot.setGrowingAge(-24000); + this.worldObj.spawnEntityInWorld(entityocelot); + } + } + + return livingdata; + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityPig.java b/src/minecraft/net/minecraft/entity/passive/EntityPig.java new file mode 100644 index 0000000..d6ba197 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityPig.java @@ -0,0 +1,246 @@ +package net.minecraft.entity.passive; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIControlledByPlayer; +import net.minecraft.entity.ai.EntityAIFollowParent; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIMate; +import net.minecraft.entity.ai.EntityAIPanic; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAITempt; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class EntityPig extends EntityAnimal +{ + /** AI task for player control. */ + private final EntityAIControlledByPlayer aiControlledByPlayer; + + public EntityPig(World worldIn) + { + super(worldIn); + this.setSize(0.9F, 0.9F); + ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.25D)); + this.tasks.addTask(2, this.aiControlledByPlayer = new EntityAIControlledByPlayer(this, 0.3F)); + this.tasks.addTask(3, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(4, new EntityAITempt(this, 1.2D, Items.carrot_on_a_stick, false)); + this.tasks.addTask(4, new EntityAITempt(this, 1.2D, Items.carrot, false)); + this.tasks.addTask(5, new EntityAIFollowParent(this, 1.1D)); + this.tasks.addTask(6, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); + } + + /** + * returns true if all the conditions for steering the entity are met. For pigs, this is true if it is being ridden + * by a player and the player is holding a carrot-on-a-stick + */ + public boolean canBeSteered() + { + ItemStack itemstack = ((EntityPlayer)this.riddenByEntity).getHeldItem(); + return itemstack != null && itemstack.getItem() == Items.carrot_on_a_stick; + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setBoolean("Saddle", this.getSaddled()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.setSaddled(tagCompund.getBoolean("Saddle")); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.pig.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.pig.say"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.pig.death"; + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound("mob.pig.step", 0.15F, 1.0F); + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer player) + { + if (super.interact(player)) + { + return true; + } + else if (!this.getSaddled() || this.worldObj.isRemote || this.riddenByEntity != null && this.riddenByEntity != player) + { + return false; + } + else + { + player.mountEntity(this); + return true; + } + } + + protected Item getDropItem() + { + return this.isBurning() ? Items.cooked_porkchop : Items.porkchop; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + int i = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + p_70628_2_); + + for (int j = 0; j < i; ++j) + { + if (this.isBurning()) + { + this.dropItem(Items.cooked_porkchop, 1); + } + else + { + this.dropItem(Items.porkchop, 1); + } + } + + if (this.getSaddled()) + { + this.dropItem(Items.saddle, 1); + } + } + + /** + * Returns true if the pig is saddled. + */ + public boolean getSaddled() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + /** + * Set or remove the saddle of the pig. + */ + public void setSaddled(boolean saddled) + { + if (saddled) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)1)); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)0)); + } + } + + /** + * Called when a lightning bolt hits the entity. + */ + public void onStruckByLightning(EntityLightningBolt lightningBolt) + { + if (!this.worldObj.isRemote && !this.isDead) + { + EntityPigZombie entitypigzombie = new EntityPigZombie(this.worldObj); + entitypigzombie.setCurrentItemOrArmor(0, new ItemStack(Items.golden_sword)); + entitypigzombie.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + entitypigzombie.setNoAI(this.isAIDisabled()); + + if (this.hasCustomName()) + { + entitypigzombie.setCustomNameTag(this.getCustomNameTag()); + entitypigzombie.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag()); + } + + this.worldObj.spawnEntityInWorld(entitypigzombie); + this.setDead(); + } + } + + public void fall(float distance, float damageMultiplier) + { + super.fall(distance, damageMultiplier); + + if (distance > 5.0F && this.riddenByEntity instanceof EntityPlayer) + { + ((EntityPlayer)this.riddenByEntity).triggerAchievement(AchievementList.flyPig); + } + } + + public EntityPig createChild(EntityAgeable ageable) + { + return new EntityPig(this.worldObj); + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack stack) + { + return stack != null && stack.getItem() == Items.carrot; + } + + /** + * Return the AI task for player control. + */ + public EntityAIControlledByPlayer getAIControlledByPlayer() + { + return this.aiControlledByPlayer; + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityRabbit.java b/src/minecraft/net/minecraft/entity/passive/EntityRabbit.java new file mode 100644 index 0000000..f1c2379 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityRabbit.java @@ -0,0 +1,743 @@ +package net.minecraft.entity.passive; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockCarrot; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIAvoidEntity; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAIMate; +import net.minecraft.entity.ai.EntityAIMoveToBlock; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAIPanic; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAITempt; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.ai.EntityJumpHelper; +import net.minecraft.entity.ai.EntityMoveHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; +import net.minecraft.util.Vec3; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.World; + +public class EntityRabbit extends EntityAnimal +{ + private EntityRabbit.AIAvoidEntity aiAvoidWolves; + private int field_175540_bm = 0; + private int field_175535_bn = 0; + private boolean field_175536_bo = false; + private boolean field_175537_bp = false; + private int currentMoveTypeDuration = 0; + private EntityRabbit.EnumMoveType moveType = EntityRabbit.EnumMoveType.HOP; + private int carrotTicks = 0; + private EntityPlayer field_175543_bt = null; + + public EntityRabbit(World worldIn) + { + super(worldIn); + this.setSize(0.6F, 0.7F); + this.jumpHelper = new EntityRabbit.RabbitJumpHelper(this); + this.moveHelper = new EntityRabbit.RabbitMoveHelper(this); + ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); + this.navigator.setHeightRequirement(2.5F); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityRabbit.AIPanic(this, 1.33D)); + this.tasks.addTask(2, new EntityAITempt(this, 1.0D, Items.carrot, false)); + this.tasks.addTask(2, new EntityAITempt(this, 1.0D, Items.golden_carrot, false)); + this.tasks.addTask(2, new EntityAITempt(this, 1.0D, Item.getItemFromBlock(Blocks.yellow_flower), false)); + this.tasks.addTask(3, new EntityAIMate(this, 0.8D)); + this.tasks.addTask(5, new EntityRabbit.AIRaidFarm(this)); + this.tasks.addTask(5, new EntityAIWander(this, 0.6D)); + this.tasks.addTask(11, new EntityAIWatchClosest(this, EntityPlayer.class, 10.0F)); + this.aiAvoidWolves = new EntityRabbit.AIAvoidEntity(this, EntityWolf.class, 16.0F, 1.33D, 1.33D); + this.tasks.addTask(4, this.aiAvoidWolves); + this.setMovementSpeed(0.0D); + } + + protected float getJumpUpwardsMotion() + { + return this.moveHelper.isUpdating() && this.moveHelper.getY() > this.posY + 0.5D ? 0.5F : this.moveType.func_180074_b(); + } + + public void setMoveType(EntityRabbit.EnumMoveType type) + { + this.moveType = type; + } + + public float func_175521_o(float p_175521_1_) + { + return this.field_175535_bn == 0 ? 0.0F : ((float)this.field_175540_bm + p_175521_1_) / (float)this.field_175535_bn; + } + + public void setMovementSpeed(double newSpeed) + { + this.getNavigator().setSpeed(newSpeed); + this.moveHelper.setMoveTo(this.moveHelper.getX(), this.moveHelper.getY(), this.moveHelper.getZ(), newSpeed); + } + + public void setJumping(boolean jump, EntityRabbit.EnumMoveType moveTypeIn) + { + super.setJumping(jump); + + if (!jump) + { + if (this.moveType == EntityRabbit.EnumMoveType.ATTACK) + { + this.moveType = EntityRabbit.EnumMoveType.HOP; + } + } + else + { + this.setMovementSpeed(1.5D * (double)moveTypeIn.getSpeed()); + this.playSound(this.getJumpingSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F); + } + + this.field_175536_bo = jump; + } + + public void doMovementAction(EntityRabbit.EnumMoveType movetype) + { + this.setJumping(true, movetype); + this.field_175535_bn = movetype.func_180073_d(); + this.field_175540_bm = 0; + } + + public boolean func_175523_cj() + { + return this.field_175536_bo; + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(18, Byte.valueOf((byte)0)); + } + + public void updateAITasks() + { + if (this.moveHelper.getSpeed() > 0.8D) + { + this.setMoveType(EntityRabbit.EnumMoveType.SPRINT); + } + else if (this.moveType != EntityRabbit.EnumMoveType.ATTACK) + { + this.setMoveType(EntityRabbit.EnumMoveType.HOP); + } + + if (this.currentMoveTypeDuration > 0) + { + --this.currentMoveTypeDuration; + } + + if (this.carrotTicks > 0) + { + this.carrotTicks -= this.rand.nextInt(3); + + if (this.carrotTicks < 0) + { + this.carrotTicks = 0; + } + } + + if (this.onGround) + { + if (!this.field_175537_bp) + { + this.setJumping(false, EntityRabbit.EnumMoveType.NONE); + this.func_175517_cu(); + } + + if (this.getRabbitType() == 99 && this.currentMoveTypeDuration == 0) + { + EntityLivingBase entitylivingbase = this.getAttackTarget(); + + if (entitylivingbase != null && this.getDistanceSqToEntity(entitylivingbase) < 16.0D) + { + this.calculateRotationYaw(entitylivingbase.posX, entitylivingbase.posZ); + this.moveHelper.setMoveTo(entitylivingbase.posX, entitylivingbase.posY, entitylivingbase.posZ, this.moveHelper.getSpeed()); + this.doMovementAction(EntityRabbit.EnumMoveType.ATTACK); + this.field_175537_bp = true; + } + } + + EntityRabbit.RabbitJumpHelper entityrabbit$rabbitjumphelper = (EntityRabbit.RabbitJumpHelper)this.jumpHelper; + + if (!entityrabbit$rabbitjumphelper.getIsJumping()) + { + if (this.moveHelper.isUpdating() && this.currentMoveTypeDuration == 0) + { + PathEntity pathentity = this.navigator.getPath(); + Vec3 vec3 = new Vec3(this.moveHelper.getX(), this.moveHelper.getY(), this.moveHelper.getZ()); + + if (pathentity != null && pathentity.getCurrentPathIndex() < pathentity.getCurrentPathLength()) + { + vec3 = pathentity.getPosition(this); + } + + this.calculateRotationYaw(vec3.xCoord, vec3.zCoord); + this.doMovementAction(this.moveType); + } + } + else if (!entityrabbit$rabbitjumphelper.func_180065_d()) + { + this.func_175518_cr(); + } + } + + this.field_175537_bp = this.onGround; + } + + /** + * Attempts to create sprinting particles if the entity is sprinting and not in water. + */ + public void spawnRunningParticles() + { + } + + private void calculateRotationYaw(double x, double z) + { + this.rotationYaw = (float)(MathHelper.func_181159_b(z - this.posZ, x - this.posX) * 180.0D / Math.PI) - 90.0F; + } + + private void func_175518_cr() + { + ((EntityRabbit.RabbitJumpHelper)this.jumpHelper).func_180066_a(true); + } + + private void func_175520_cs() + { + ((EntityRabbit.RabbitJumpHelper)this.jumpHelper).func_180066_a(false); + } + + private void updateMoveTypeDuration() + { + this.currentMoveTypeDuration = this.getMoveTypeDuration(); + } + + private void func_175517_cu() + { + this.updateMoveTypeDuration(); + this.func_175520_cs(); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (this.field_175540_bm != this.field_175535_bn) + { + if (this.field_175540_bm == 0 && !this.worldObj.isRemote) + { + this.worldObj.setEntityState(this, (byte)1); + } + + ++this.field_175540_bm; + } + else if (this.field_175535_bn != 0) + { + this.field_175540_bm = 0; + this.field_175535_bn = 0; + } + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("RabbitType", this.getRabbitType()); + tagCompound.setInteger("MoreCarrotTicks", this.carrotTicks); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.setRabbitType(tagCompund.getInteger("RabbitType")); + this.carrotTicks = tagCompund.getInteger("MoreCarrotTicks"); + } + + protected String getJumpingSound() + { + return "mob.rabbit.hop"; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.rabbit.idle"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.rabbit.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.rabbit.death"; + } + + public boolean attackEntityAsMob(Entity entityIn) + { + if (this.getRabbitType() == 99) + { + this.playSound("mob.attack", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + return entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), 8.0F); + } + else + { + return entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), 3.0F); + } + } + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + return this.getRabbitType() == 99 ? 8 : super.getTotalArmorValue(); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + return this.isEntityInvulnerable(source) ? false : super.attackEntityFrom(source, amount); + } + + /** + * Causes this Entity to drop a random item. + */ + protected void addRandomDrop() + { + this.entityDropItem(new ItemStack(Items.rabbit_foot, 1), 0.0F); + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + int i = this.rand.nextInt(2) + this.rand.nextInt(1 + p_70628_2_); + + for (int j = 0; j < i; ++j) + { + this.dropItem(Items.rabbit_hide, 1); + } + + i = this.rand.nextInt(2); + + for (int k = 0; k < i; ++k) + { + if (this.isBurning()) + { + this.dropItem(Items.cooked_rabbit, 1); + } + else + { + this.dropItem(Items.rabbit, 1); + } + } + } + + private boolean isRabbitBreedingItem(Item itemIn) + { + return itemIn == Items.carrot || itemIn == Items.golden_carrot || itemIn == Item.getItemFromBlock(Blocks.yellow_flower); + } + + public EntityRabbit createChild(EntityAgeable ageable) + { + EntityRabbit entityrabbit = new EntityRabbit(this.worldObj); + + if (ageable instanceof EntityRabbit) + { + entityrabbit.setRabbitType(this.rand.nextBoolean() ? this.getRabbitType() : ((EntityRabbit)ageable).getRabbitType()); + } + + return entityrabbit; + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack stack) + { + return stack != null && this.isRabbitBreedingItem(stack.getItem()); + } + + public int getRabbitType() + { + return this.dataWatcher.getWatchableObjectByte(18); + } + + public void setRabbitType(int rabbitTypeId) + { + if (rabbitTypeId == 99) + { + this.tasks.removeTask(this.aiAvoidWolves); + this.tasks.addTask(4, new EntityRabbit.AIEvilAttack(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWolf.class, true)); + + if (!this.hasCustomName()) + { + this.setCustomNameTag(StatCollector.translateToLocal("entity.KillerBunny.name")); + } + } + + this.dataWatcher.updateObject(18, Byte.valueOf((byte)rabbitTypeId)); + } + + /** + * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called + * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory + */ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + livingdata = super.onInitialSpawn(difficulty, livingdata); + int i = this.rand.nextInt(6); + boolean flag = false; + + if (livingdata instanceof EntityRabbit.RabbitTypeData) + { + i = ((EntityRabbit.RabbitTypeData)livingdata).typeData; + flag = true; + } + else + { + livingdata = new EntityRabbit.RabbitTypeData(i); + } + + this.setRabbitType(i); + + if (flag) + { + this.setGrowingAge(-24000); + } + + return livingdata; + } + + /** + * Returns true if {@link net.minecraft.entity.passive.EntityRabbit#carrotTicks carrotTicks} has reached zero + */ + private boolean isCarrotEaten() + { + return this.carrotTicks == 0; + } + + /** + * Returns duration of the current {@link net.minecraft.entity.passive.EntityRabbit.EnumMoveType move type} + */ + protected int getMoveTypeDuration() + { + return this.moveType.getDuration(); + } + + protected void createEatingParticles() + { + this.worldObj.spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, 0.0D, 0.0D, 0.0D, new int[] {Block.getStateId(Blocks.carrots.getStateFromMeta(7))}); + this.carrotTicks = 100; + } + + public void handleStatusUpdate(byte id) + { + if (id == 1) + { + this.createRunningParticles(); + this.field_175535_bn = 10; + this.field_175540_bm = 0; + } + else + { + super.handleStatusUpdate(id); + } + } + + static class AIAvoidEntity extends EntityAIAvoidEntity + { + private EntityRabbit entityInstance; + + public AIAvoidEntity(EntityRabbit p_i46403_1_, Class p_i46403_2_, float p_i46403_3_, double p_i46403_4_, double p_i46403_6_) + { + super(p_i46403_1_, p_i46403_2_, p_i46403_3_, p_i46403_4_, p_i46403_6_); + this.entityInstance = p_i46403_1_; + } + + public void updateTask() + { + super.updateTask(); + } + } + + static class AIEvilAttack extends EntityAIAttackOnCollide + { + public AIEvilAttack(EntityRabbit p_i45867_1_) + { + super(p_i45867_1_, EntityLivingBase.class, 1.4D, true); + } + + protected double func_179512_a(EntityLivingBase attackTarget) + { + return (double)(4.0F + attackTarget.width); + } + } + + static class AIPanic extends EntityAIPanic + { + private EntityRabbit theEntity; + + public AIPanic(EntityRabbit p_i45861_1_, double speedIn) + { + super(p_i45861_1_, speedIn); + this.theEntity = p_i45861_1_; + } + + public void updateTask() + { + super.updateTask(); + this.theEntity.setMovementSpeed(this.speed); + } + } + + static class AIRaidFarm extends EntityAIMoveToBlock + { + private final EntityRabbit field_179500_c; + private boolean field_179498_d; + private boolean field_179499_e = false; + + public AIRaidFarm(EntityRabbit p_i45860_1_) + { + super(p_i45860_1_, 0.699999988079071D, 16); + this.field_179500_c = p_i45860_1_; + } + + public boolean shouldExecute() + { + if (this.runDelay <= 0) + { + if (!this.field_179500_c.worldObj.getGameRules().getBoolean("mobGriefing")) + { + return false; + } + + this.field_179499_e = false; + this.field_179498_d = this.field_179500_c.isCarrotEaten(); + } + + return super.shouldExecute(); + } + + public boolean continueExecuting() + { + return this.field_179499_e && super.continueExecuting(); + } + + public void startExecuting() + { + super.startExecuting(); + } + + public void resetTask() + { + super.resetTask(); + } + + public void updateTask() + { + super.updateTask(); + this.field_179500_c.getLookHelper().setLookPosition((double)this.destinationBlock.getX() + 0.5D, (double)(this.destinationBlock.getY() + 1), (double)this.destinationBlock.getZ() + 0.5D, 10.0F, (float)this.field_179500_c.getVerticalFaceSpeed()); + + if (this.getIsAboveDestination()) + { + World world = this.field_179500_c.worldObj; + BlockPos blockpos = this.destinationBlock.up(); + IBlockState iblockstate = world.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (this.field_179499_e && block instanceof BlockCarrot && ((Integer)iblockstate.getValue(BlockCarrot.AGE)).intValue() == 7) + { + world.setBlockState(blockpos, Blocks.air.getDefaultState(), 2); + world.destroyBlock(blockpos, true); + this.field_179500_c.createEatingParticles(); + } + + this.field_179499_e = false; + this.runDelay = 10; + } + } + + protected boolean shouldMoveTo(World worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos).getBlock(); + + if (block == Blocks.farmland) + { + pos = pos.up(); + IBlockState iblockstate = worldIn.getBlockState(pos); + block = iblockstate.getBlock(); + + if (block instanceof BlockCarrot && ((Integer)iblockstate.getValue(BlockCarrot.AGE)).intValue() == 7 && this.field_179498_d && !this.field_179499_e) + { + this.field_179499_e = true; + return true; + } + } + + return false; + } + } + + static enum EnumMoveType + { + NONE(0.0F, 0.0F, 30, 1), + HOP(0.8F, 0.2F, 20, 10), + STEP(1.0F, 0.45F, 14, 14), + SPRINT(1.75F, 0.4F, 1, 8), + ATTACK(2.0F, 0.7F, 7, 8); + + private final float speed; + private final float field_180077_g; + private final int duration; + private final int field_180085_i; + + private EnumMoveType(float typeSpeed, float p_i45866_4_, int typeDuration, int p_i45866_6_) + { + this.speed = typeSpeed; + this.field_180077_g = p_i45866_4_; + this.duration = typeDuration; + this.field_180085_i = p_i45866_6_; + } + + public float getSpeed() + { + return this.speed; + } + + public float func_180074_b() + { + return this.field_180077_g; + } + + public int getDuration() + { + return this.duration; + } + + public int func_180073_d() + { + return this.field_180085_i; + } + } + + public class RabbitJumpHelper extends EntityJumpHelper + { + private EntityRabbit theEntity; + private boolean field_180068_d = false; + + public RabbitJumpHelper(EntityRabbit rabbit) + { + super(rabbit); + this.theEntity = rabbit; + } + + public boolean getIsJumping() + { + return this.isJumping; + } + + public boolean func_180065_d() + { + return this.field_180068_d; + } + + public void func_180066_a(boolean p_180066_1_) + { + this.field_180068_d = p_180066_1_; + } + + public void doJump() + { + if (this.isJumping) + { + this.theEntity.doMovementAction(EntityRabbit.EnumMoveType.STEP); + this.isJumping = false; + } + } + } + + static class RabbitMoveHelper extends EntityMoveHelper + { + private EntityRabbit theEntity; + + public RabbitMoveHelper(EntityRabbit p_i45862_1_) + { + super(p_i45862_1_); + this.theEntity = p_i45862_1_; + } + + public void onUpdateMoveHelper() + { + if (this.theEntity.onGround && !this.theEntity.func_175523_cj()) + { + this.theEntity.setMovementSpeed(0.0D); + } + + super.onUpdateMoveHelper(); + } + } + + public static class RabbitTypeData implements IEntityLivingData + { + public int typeData; + + public RabbitTypeData(int type) + { + this.typeData = type; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntitySheep.java b/src/minecraft/net/minecraft/entity/passive/EntitySheep.java new file mode 100644 index 0000000..50e2e8c --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntitySheep.java @@ -0,0 +1,385 @@ +package net.minecraft.entity.passive; + +import com.google.common.collect.Maps; +import java.util.Map; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIEatGrass; +import net.minecraft.entity.ai.EntityAIFollowParent; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIMate; +import net.minecraft.entity.ai.EntityAIPanic; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAITempt; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.World; + +public class EntitySheep extends EntityAnimal +{ + /** + * Internal crafting inventory used to check the result of mixing dyes corresponding to the fleece color when + * breeding sheep. + */ + private final InventoryCrafting inventoryCrafting = new InventoryCrafting(new Container() + { + public boolean canInteractWith(EntityPlayer playerIn) + { + return false; + } + }, 2, 1); + private static final Map DYE_TO_RGB = Maps.newEnumMap(EnumDyeColor.class); + + /** + * Used to control movement as well as wool regrowth. Set to 40 on handleHealthUpdate and counts down with each + * tick. + */ + private int sheepTimer; + private EntityAIEatGrass entityAIEatGrass = new EntityAIEatGrass(this); + + public static float[] func_175513_a(EnumDyeColor dyeColor) + { + return (float[])DYE_TO_RGB.get(dyeColor); + } + + public EntitySheep(World worldIn) + { + super(worldIn); + this.setSize(0.9F, 1.3F); + ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.25D)); + this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(3, new EntityAITempt(this, 1.1D, Items.wheat, false)); + this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); + this.tasks.addTask(5, this.entityAIEatGrass); + this.tasks.addTask(6, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.inventoryCrafting.setInventorySlotContents(0, new ItemStack(Items.dye, 1, 0)); + this.inventoryCrafting.setInventorySlotContents(1, new ItemStack(Items.dye, 1, 0)); + } + + protected void updateAITasks() + { + this.sheepTimer = this.entityAIEatGrass.getEatingGrassTimer(); + super.updateAITasks(); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.worldObj.isRemote) + { + this.sheepTimer = Math.max(0, this.sheepTimer - 1); + } + + super.onLivingUpdate(); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)0)); + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + if (!this.getSheared()) + { + this.entityDropItem(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata()), 0.0F); + } + + int i = this.rand.nextInt(2) + 1 + this.rand.nextInt(1 + p_70628_2_); + + for (int j = 0; j < i; ++j) + { + if (this.isBurning()) + { + this.dropItem(Items.cooked_mutton, 1); + } + else + { + this.dropItem(Items.mutton, 1); + } + } + } + + protected Item getDropItem() + { + return Item.getItemFromBlock(Blocks.wool); + } + + public void handleStatusUpdate(byte id) + { + if (id == 10) + { + this.sheepTimer = 40; + } + else + { + super.handleStatusUpdate(id); + } + } + + public float getHeadRotationPointY(float p_70894_1_) + { + return this.sheepTimer <= 0 ? 0.0F : (this.sheepTimer >= 4 && this.sheepTimer <= 36 ? 1.0F : (this.sheepTimer < 4 ? ((float)this.sheepTimer - p_70894_1_) / 4.0F : -((float)(this.sheepTimer - 40) - p_70894_1_) / 4.0F)); + } + + public float getHeadRotationAngleX(float p_70890_1_) + { + if (this.sheepTimer > 4 && this.sheepTimer <= 36) + { + float f = ((float)(this.sheepTimer - 4) - p_70890_1_) / 32.0F; + return ((float)Math.PI / 5F) + ((float)Math.PI * 7F / 100F) * MathHelper.sin(f * 28.7F); + } + else + { + return this.sheepTimer > 0 ? ((float)Math.PI / 5F) : this.rotationPitch / (180F / (float)Math.PI); + } + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild()) + { + if (!this.worldObj.isRemote) + { + this.setSheared(true); + int i = 1 + this.rand.nextInt(3); + + for (int j = 0; j < i; ++j) + { + EntityItem entityitem = this.entityDropItem(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata()), 1.0F); + entityitem.motionY += (double)(this.rand.nextFloat() * 0.05F); + entityitem.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); + entityitem.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); + } + } + + itemstack.damageItem(1, player); + this.playSound("mob.sheep.shear", 1.0F, 1.0F); + } + + return super.interact(player); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setBoolean("Sheared", this.getSheared()); + tagCompound.setByte("Color", (byte)this.getFleeceColor().getMetadata()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.setSheared(tagCompund.getBoolean("Sheared")); + this.setFleeceColor(EnumDyeColor.byMetadata(tagCompund.getByte("Color"))); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.sheep.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.sheep.say"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.sheep.say"; + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound("mob.sheep.step", 0.15F, 1.0F); + } + + /** + * Gets the wool color of this sheep. + */ + public EnumDyeColor getFleeceColor() + { + return EnumDyeColor.byMetadata(this.dataWatcher.getWatchableObjectByte(16) & 15); + } + + /** + * Sets the wool color of this sheep + */ + public void setFleeceColor(EnumDyeColor color) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & 240 | color.getMetadata() & 15))); + } + + /** + * returns true if a sheeps wool has been sheared + */ + public boolean getSheared() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 16) != 0; + } + + /** + * make a sheep sheared if set to true + */ + public void setSheared(boolean sheared) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + if (sheared) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 16))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -17))); + } + } + + /** + * Chooses a "vanilla" sheep color based on the provided random. + */ + public static EnumDyeColor getRandomSheepColor(Random random) + { + int i = random.nextInt(100); + return i < 5 ? EnumDyeColor.BLACK : (i < 10 ? EnumDyeColor.GRAY : (i < 15 ? EnumDyeColor.SILVER : (i < 18 ? EnumDyeColor.BROWN : (random.nextInt(500) == 0 ? EnumDyeColor.PINK : EnumDyeColor.WHITE)))); + } + + public EntitySheep createChild(EntityAgeable ageable) + { + EntitySheep entitysheep = (EntitySheep)ageable; + EntitySheep entitysheep1 = new EntitySheep(this.worldObj); + entitysheep1.setFleeceColor(this.getDyeColorMixFromParents(this, entitysheep)); + return entitysheep1; + } + + /** + * This function applies the benefits of growing back wool and faster growing up to the acting entity. (This + * function is used in the AIEatGrass) + */ + public void eatGrassBonus() + { + this.setSheared(false); + + if (this.isChild()) + { + this.addGrowth(60); + } + } + + /** + * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called + * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory + */ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + livingdata = super.onInitialSpawn(difficulty, livingdata); + this.setFleeceColor(getRandomSheepColor(this.worldObj.rand)); + return livingdata; + } + + /** + * Attempts to mix both parent sheep to come up with a mixed dye color. + */ + private EnumDyeColor getDyeColorMixFromParents(EntityAnimal father, EntityAnimal mother) + { + int i = ((EntitySheep)father).getFleeceColor().getDyeDamage(); + int j = ((EntitySheep)mother).getFleeceColor().getDyeDamage(); + this.inventoryCrafting.getStackInSlot(0).setItemDamage(i); + this.inventoryCrafting.getStackInSlot(1).setItemDamage(j); + ItemStack itemstack = CraftingManager.getInstance().findMatchingRecipe(this.inventoryCrafting, ((EntitySheep)father).worldObj); + int k; + + if (itemstack != null && itemstack.getItem() == Items.dye) + { + k = itemstack.getMetadata(); + } + else + { + k = this.worldObj.rand.nextBoolean() ? i : j; + } + + return EnumDyeColor.byDyeDamage(k); + } + + public float getEyeHeight() + { + return 0.95F * this.height; + } + + static + { + DYE_TO_RGB.put(EnumDyeColor.WHITE, new float[] {1.0F, 1.0F, 1.0F}); + DYE_TO_RGB.put(EnumDyeColor.ORANGE, new float[] {0.85F, 0.5F, 0.2F}); + DYE_TO_RGB.put(EnumDyeColor.MAGENTA, new float[] {0.7F, 0.3F, 0.85F}); + DYE_TO_RGB.put(EnumDyeColor.LIGHT_BLUE, new float[] {0.4F, 0.6F, 0.85F}); + DYE_TO_RGB.put(EnumDyeColor.YELLOW, new float[] {0.9F, 0.9F, 0.2F}); + DYE_TO_RGB.put(EnumDyeColor.LIME, new float[] {0.5F, 0.8F, 0.1F}); + DYE_TO_RGB.put(EnumDyeColor.PINK, new float[] {0.95F, 0.5F, 0.65F}); + DYE_TO_RGB.put(EnumDyeColor.GRAY, new float[] {0.3F, 0.3F, 0.3F}); + DYE_TO_RGB.put(EnumDyeColor.SILVER, new float[] {0.6F, 0.6F, 0.6F}); + DYE_TO_RGB.put(EnumDyeColor.CYAN, new float[] {0.3F, 0.5F, 0.6F}); + DYE_TO_RGB.put(EnumDyeColor.PURPLE, new float[] {0.5F, 0.25F, 0.7F}); + DYE_TO_RGB.put(EnumDyeColor.BLUE, new float[] {0.2F, 0.3F, 0.7F}); + DYE_TO_RGB.put(EnumDyeColor.BROWN, new float[] {0.4F, 0.3F, 0.2F}); + DYE_TO_RGB.put(EnumDyeColor.GREEN, new float[] {0.4F, 0.5F, 0.2F}); + DYE_TO_RGB.put(EnumDyeColor.RED, new float[] {0.6F, 0.2F, 0.2F}); + DYE_TO_RGB.put(EnumDyeColor.BLACK, new float[] {0.1F, 0.1F, 0.1F}); + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntitySquid.java b/src/minecraft/net/minecraft/entity/passive/EntitySquid.java new file mode 100644 index 0000000..7db23e8 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntitySquid.java @@ -0,0 +1,287 @@ +package net.minecraft.entity.passive; + +import net.minecraft.block.material.Material; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntitySquid extends EntityWaterMob +{ + public float squidPitch; + public float prevSquidPitch; + public float squidYaw; + public float prevSquidYaw; + + /** + * appears to be rotation in radians; we already have pitch & yaw, so this completes the triumvirate. + */ + public float squidRotation; + + /** previous squidRotation in radians */ + public float prevSquidRotation; + + /** angle of the tentacles in radians */ + public float tentacleAngle; + + /** the last calculated angle of the tentacles in radians */ + public float lastTentacleAngle; + private float randomMotionSpeed; + + /** change in squidRotation in radians. */ + private float rotationVelocity; + private float field_70871_bB; + private float randomMotionVecX; + private float randomMotionVecY; + private float randomMotionVecZ; + + public EntitySquid(World worldIn) + { + super(worldIn); + this.setSize(0.95F, 0.95F); + this.rand.setSeed((long)(1 + this.getEntityId())); + this.rotationVelocity = 1.0F / (this.rand.nextFloat() + 1.0F) * 0.2F; + this.tasks.addTask(0, new EntitySquid.AIMoveRandom(this)); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D); + } + + public float getEyeHeight() + { + return this.height * 0.5F; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return null; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return null; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return null; + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.4F; + } + + protected Item getDropItem() + { + return null; + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + /** + * Drop 0-2 items of this living's type + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + { + int i = this.rand.nextInt(3 + p_70628_2_) + 1; + + for (int j = 0; j < i; ++j) + { + this.entityDropItem(new ItemStack(Items.dye, 1, EnumDyeColor.BLACK.getDyeDamage()), 0.0F); + } + } + + /** + * Checks if this entity is inside water (if inWater field is true as a result of handleWaterMovement() returning + * true) + */ + public boolean isInWater() + { + return this.worldObj.handleMaterialAcceleration(this.getEntityBoundingBox().expand(0.0D, -0.6000000238418579D, 0.0D), Material.water, this); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + this.prevSquidPitch = this.squidPitch; + this.prevSquidYaw = this.squidYaw; + this.prevSquidRotation = this.squidRotation; + this.lastTentacleAngle = this.tentacleAngle; + this.squidRotation += this.rotationVelocity; + + if ((double)this.squidRotation > (Math.PI * 2D)) + { + if (this.worldObj.isRemote) + { + this.squidRotation = ((float)Math.PI * 2F); + } + else + { + this.squidRotation = (float)((double)this.squidRotation - (Math.PI * 2D)); + + if (this.rand.nextInt(10) == 0) + { + this.rotationVelocity = 1.0F / (this.rand.nextFloat() + 1.0F) * 0.2F; + } + + this.worldObj.setEntityState(this, (byte)19); + } + } + + if (this.inWater) + { + if (this.squidRotation < (float)Math.PI) + { + float f = this.squidRotation / (float)Math.PI; + this.tentacleAngle = MathHelper.sin(f * f * (float)Math.PI) * (float)Math.PI * 0.25F; + + if ((double)f > 0.75D) + { + this.randomMotionSpeed = 1.0F; + this.field_70871_bB = 1.0F; + } + else + { + this.field_70871_bB *= 0.8F; + } + } + else + { + this.tentacleAngle = 0.0F; + this.randomMotionSpeed *= 0.9F; + this.field_70871_bB *= 0.99F; + } + + if (!this.worldObj.isRemote) + { + this.motionX = (double)(this.randomMotionVecX * this.randomMotionSpeed); + this.motionY = (double)(this.randomMotionVecY * this.randomMotionSpeed); + this.motionZ = (double)(this.randomMotionVecZ * this.randomMotionSpeed); + } + + float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.renderYawOffset += (-((float)MathHelper.func_181159_b(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI - this.renderYawOffset) * 0.1F; + this.rotationYaw = this.renderYawOffset; + this.squidYaw = (float)((double)this.squidYaw + Math.PI * (double)this.field_70871_bB * 1.5D); + this.squidPitch += (-((float)MathHelper.func_181159_b((double)f1, this.motionY)) * 180.0F / (float)Math.PI - this.squidPitch) * 0.1F; + } + else + { + this.tentacleAngle = MathHelper.abs(MathHelper.sin(this.squidRotation)) * (float)Math.PI * 0.25F; + + if (!this.worldObj.isRemote) + { + this.motionX = 0.0D; + this.motionY -= 0.08D; + this.motionY *= 0.9800000190734863D; + this.motionZ = 0.0D; + } + + this.squidPitch = (float)((double)this.squidPitch + (double)(-90.0F - this.squidPitch) * 0.02D); + } + } + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float strafe, float forward) + { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.posY > 45.0D && this.posY < (double)this.worldObj.func_181545_F() && super.getCanSpawnHere(); + } + + public void handleStatusUpdate(byte id) + { + if (id == 19) + { + this.squidRotation = 0.0F; + } + else + { + super.handleStatusUpdate(id); + } + } + + public void func_175568_b(float randomMotionVecXIn, float randomMotionVecYIn, float randomMotionVecZIn) + { + this.randomMotionVecX = randomMotionVecXIn; + this.randomMotionVecY = randomMotionVecYIn; + this.randomMotionVecZ = randomMotionVecZIn; + } + + public boolean func_175567_n() + { + return this.randomMotionVecX != 0.0F || this.randomMotionVecY != 0.0F || this.randomMotionVecZ != 0.0F; + } + + static class AIMoveRandom extends EntityAIBase + { + private EntitySquid squid; + + public AIMoveRandom(EntitySquid p_i45859_1_) + { + this.squid = p_i45859_1_; + } + + public boolean shouldExecute() + { + return true; + } + + public void updateTask() + { + int i = this.squid.getAge(); + + if (i > 100) + { + this.squid.func_175568_b(0.0F, 0.0F, 0.0F); + } + else if (this.squid.getRNG().nextInt(50) == 0 || !this.squid.inWater || !this.squid.func_175567_n()) + { + float f = this.squid.getRNG().nextFloat() * (float)Math.PI * 2.0F; + float f1 = MathHelper.cos(f) * 0.2F; + float f2 = -0.1F + this.squid.getRNG().nextFloat() * 0.2F; + float f3 = MathHelper.sin(f) * 0.2F; + this.squid.func_175568_b(f1, f2, f3); + } + } + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityTameable.java b/src/minecraft/net/minecraft/entity/passive/EntityTameable.java new file mode 100644 index 0000000..5be6e97 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityTameable.java @@ -0,0 +1,248 @@ +package net.minecraft.entity.passive; + +import java.util.UUID; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityOwnable; +import net.minecraft.entity.ai.EntityAISit; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.scoreboard.Team; +import net.minecraft.server.management.PreYggdrasilConverter; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public abstract class EntityTameable extends EntityAnimal implements IEntityOwnable +{ + protected EntityAISit aiSit = new EntityAISit(this); + + public EntityTameable(World worldIn) + { + super(worldIn); + this.setupTamedAI(); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(17, ""); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + + if (this.getOwnerId() == null) + { + tagCompound.setString("OwnerUUID", ""); + } + else + { + tagCompound.setString("OwnerUUID", this.getOwnerId()); + } + + tagCompound.setBoolean("Sitting", this.isSitting()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + String s = ""; + + if (tagCompund.hasKey("OwnerUUID", 8)) + { + s = tagCompund.getString("OwnerUUID"); + } + else + { + String s1 = tagCompund.getString("Owner"); + s = PreYggdrasilConverter.getStringUUIDFromName(s1); + } + + if (s.length() > 0) + { + this.setOwnerId(s); + this.setTamed(true); + } + + this.aiSit.setSitting(tagCompund.getBoolean("Sitting")); + this.setSitting(tagCompund.getBoolean("Sitting")); + } + + /** + * Play the taming effect, will either be hearts or smoke depending on status + */ + protected void playTameEffect(boolean play) + { + EnumParticleTypes enumparticletypes = EnumParticleTypes.HEART; + + if (!play) + { + enumparticletypes = EnumParticleTypes.SMOKE_NORMAL; + } + + for (int i = 0; i < 7; ++i) + { + double d0 = this.rand.nextGaussian() * 0.02D; + double d1 = this.rand.nextGaussian() * 0.02D; + double d2 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle(enumparticletypes, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2, new int[0]); + } + } + + public void handleStatusUpdate(byte id) + { + if (id == 7) + { + this.playTameEffect(true); + } + else if (id == 6) + { + this.playTameEffect(false); + } + else + { + super.handleStatusUpdate(id); + } + } + + public boolean isTamed() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 4) != 0; + } + + public void setTamed(boolean tamed) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + if (tamed) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 4))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -5))); + } + + this.setupTamedAI(); + } + + protected void setupTamedAI() + { + } + + public boolean isSitting() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + public void setSitting(boolean sitting) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + if (sitting) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2))); + } + } + + public String getOwnerId() + { + return this.dataWatcher.getWatchableObjectString(17); + } + + public void setOwnerId(String ownerUuid) + { + this.dataWatcher.updateObject(17, ownerUuid); + } + + public EntityLivingBase getOwner() + { + try + { + UUID uuid = UUID.fromString(this.getOwnerId()); + return uuid == null ? null : this.worldObj.getPlayerEntityByUUID(uuid); + } + catch (IllegalArgumentException var2) + { + return null; + } + } + + public boolean isOwner(EntityLivingBase entityIn) + { + return entityIn == this.getOwner(); + } + + /** + * Returns the AITask responsible of the sit logic + */ + public EntityAISit getAISit() + { + return this.aiSit; + } + + public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) + { + return true; + } + + public Team getTeam() + { + if (this.isTamed()) + { + EntityLivingBase entitylivingbase = this.getOwner(); + + if (entitylivingbase != null) + { + return entitylivingbase.getTeam(); + } + } + + return super.getTeam(); + } + + public boolean isOnSameTeam(EntityLivingBase otherEntity) + { + if (this.isTamed()) + { + EntityLivingBase entitylivingbase = this.getOwner(); + + if (otherEntity == entitylivingbase) + { + return true; + } + + if (entitylivingbase != null) + { + return entitylivingbase.isOnSameTeam(otherEntity); + } + } + + return super.isOnSameTeam(otherEntity); + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource cause) + { + if (!this.worldObj.isRemote && this.worldObj.getGameRules().getBoolean("showDeathMessages") && this.hasCustomName() && this.getOwner() instanceof EntityPlayerMP) + { + ((EntityPlayerMP)this.getOwner()).addChatMessage(this.getCombatTracker().getDeathMessage()); + } + + super.onDeath(cause); + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityVillager.java b/src/minecraft/net/minecraft/entity/passive/EntityVillager.java new file mode 100644 index 0000000..00e9451 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityVillager.java @@ -0,0 +1,1084 @@ +package net.minecraft.entity.passive; + +import java.util.Random; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentData; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.IMerchant; +import net.minecraft.entity.INpc; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAvoidEntity; +import net.minecraft.entity.ai.EntityAIFollowGolem; +import net.minecraft.entity.ai.EntityAIHarvestFarmland; +import net.minecraft.entity.ai.EntityAILookAtTradePlayer; +import net.minecraft.entity.ai.EntityAIMoveIndoors; +import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; +import net.minecraft.entity.ai.EntityAIOpenDoor; +import net.minecraft.entity.ai.EntityAIPlay; +import net.minecraft.entity.ai.EntityAIRestrictOpenDoor; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAITradePlayer; +import net.minecraft.entity.ai.EntityAIVillagerInteract; +import net.minecraft.entity.ai.EntityAIVillagerMate; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.ai.EntityAIWatchClosest2; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.monster.EntityWitch; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.InventoryBasic; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.stats.StatList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Tuple; +import net.minecraft.village.MerchantRecipe; +import net.minecraft.village.MerchantRecipeList; +import net.minecraft.village.Village; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.World; + +public class EntityVillager extends EntityAgeable implements IMerchant, INpc +{ + private int randomTickDivider; + private boolean isMating; + private boolean isPlaying; + Village villageObj; + + /** This villager's current customer. */ + private EntityPlayer buyingPlayer; + + /** Initialises the MerchantRecipeList.java */ + private MerchantRecipeList buyingList; + private int timeUntilReset; + + /** addDefaultEquipmentAndRecipies is called if this is true */ + private boolean needsInitilization; + private boolean isWillingToMate; + private int wealth; + + /** Last player to trade with this villager, used for aggressivity. */ + private String lastBuyingPlayer; + private int careerId; + + /** This is the EntityVillager's career level value */ + private int careerLevel; + private boolean isLookingForHome; + private boolean areAdditionalTasksSet; + private InventoryBasic villagerInventory; + + /** + * A multi-dimensional array mapping the various professions, careers and career levels that a Villager may offer + */ + private static final EntityVillager.ITradeList[][][][] DEFAULT_TRADE_LIST_MAP = new EntityVillager.ITradeList[][][][] {{{{new EntityVillager.EmeraldForItems(Items.wheat, new EntityVillager.PriceInfo(18, 22)), new EntityVillager.EmeraldForItems(Items.potato, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.EmeraldForItems(Items.carrot, new EntityVillager.PriceInfo(15, 19)), new EntityVillager.ListItemForEmeralds(Items.bread, new EntityVillager.PriceInfo(-4, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new EntityVillager.PriceInfo(8, 13)), new EntityVillager.ListItemForEmeralds(Items.pumpkin_pie, new EntityVillager.PriceInfo(-3, -2))}, {new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new EntityVillager.PriceInfo(7, 12)), new EntityVillager.ListItemForEmeralds(Items.apple, new EntityVillager.PriceInfo(-5, -7))}, {new EntityVillager.ListItemForEmeralds(Items.cookie, new EntityVillager.PriceInfo(-6, -10)), new EntityVillager.ListItemForEmeralds(Items.cake, new EntityVillager.PriceInfo(1, 1))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ItemAndEmeraldToItem(Items.fish, new EntityVillager.PriceInfo(6, 6), Items.cooked_fish, new EntityVillager.PriceInfo(6, 6))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.fishing_rod, new EntityVillager.PriceInfo(7, 8))}}, {{new EntityVillager.EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new EntityVillager.PriceInfo(16, 22)), new EntityVillager.ListItemForEmeralds(Items.shears, new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 0), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 1), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 2), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 3), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 4), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 5), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 6), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 7), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 8), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 9), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 10), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 11), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 12), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 13), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 14), new EntityVillager.PriceInfo(1, 2)), new EntityVillager.ListItemForEmeralds(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 15), new EntityVillager.PriceInfo(1, 2))}}, {{new EntityVillager.EmeraldForItems(Items.string, new EntityVillager.PriceInfo(15, 20)), new EntityVillager.ListItemForEmeralds(Items.arrow, new EntityVillager.PriceInfo(-12, -8))}, {new EntityVillager.ListItemForEmeralds(Items.bow, new EntityVillager.PriceInfo(2, 3)), new EntityVillager.ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new EntityVillager.PriceInfo(10, 10), Items.flint, new EntityVillager.PriceInfo(6, 10))}}}, {{{new EntityVillager.EmeraldForItems(Items.paper, new EntityVillager.PriceInfo(24, 36)), new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.EmeraldForItems(Items.book, new EntityVillager.PriceInfo(8, 10)), new EntityVillager.ListItemForEmeralds(Items.compass, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new EntityVillager.PriceInfo(3, 4))}, {new EntityVillager.EmeraldForItems(Items.written_book, new EntityVillager.PriceInfo(2, 2)), new EntityVillager.ListItemForEmeralds(Items.clock, new EntityVillager.PriceInfo(10, 12)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new EntityVillager.PriceInfo(-5, -3))}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListEnchantedBookForEmeralds()}, {new EntityVillager.ListItemForEmeralds(Items.name_tag, new EntityVillager.PriceInfo(20, 22))}}}, {{{new EntityVillager.EmeraldForItems(Items.rotten_flesh, new EntityVillager.PriceInfo(36, 40)), new EntityVillager.EmeraldForItems(Items.gold_ingot, new EntityVillager.PriceInfo(8, 10))}, {new EntityVillager.ListItemForEmeralds(Items.redstone, new EntityVillager.PriceInfo(-4, -1)), new EntityVillager.ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new EntityVillager.PriceInfo(-2, -1))}, {new EntityVillager.ListItemForEmeralds(Items.ender_eye, new EntityVillager.PriceInfo(7, 11)), new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new EntityVillager.PriceInfo(-3, -1))}, {new EntityVillager.ListItemForEmeralds(Items.experience_bottle, new EntityVillager.PriceInfo(3, 11))}}}, {{{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_helmet, new EntityVillager.PriceInfo(4, 6))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListItemForEmeralds(Items.iron_chestplate, new EntityVillager.PriceInfo(10, 14))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_chestplate, new EntityVillager.PriceInfo(16, 19))}, {new EntityVillager.ListItemForEmeralds(Items.chainmail_boots, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_leggings, new EntityVillager.PriceInfo(9, 11)), new EntityVillager.ListItemForEmeralds(Items.chainmail_helmet, new EntityVillager.PriceInfo(5, 7)), new EntityVillager.ListItemForEmeralds(Items.chainmail_chestplate, new EntityVillager.PriceInfo(11, 15))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.iron_axe, new EntityVillager.PriceInfo(6, 8))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_sword, new EntityVillager.PriceInfo(9, 10))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_sword, new EntityVillager.PriceInfo(12, 15)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_axe, new EntityVillager.PriceInfo(9, 12))}}, {{new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_shovel, new EntityVillager.PriceInfo(5, 7))}, {new EntityVillager.EmeraldForItems(Items.iron_ingot, new EntityVillager.PriceInfo(7, 9)), new EntityVillager.ListEnchantedItemForEmeralds(Items.iron_pickaxe, new EntityVillager.PriceInfo(9, 11))}, {new EntityVillager.EmeraldForItems(Items.diamond, new EntityVillager.PriceInfo(3, 4)), new EntityVillager.ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new EntityVillager.PriceInfo(12, 15))}}}, {{{new EntityVillager.EmeraldForItems(Items.porkchop, new EntityVillager.PriceInfo(14, 18)), new EntityVillager.EmeraldForItems(Items.chicken, new EntityVillager.PriceInfo(14, 18))}, {new EntityVillager.EmeraldForItems(Items.coal, new EntityVillager.PriceInfo(16, 24)), new EntityVillager.ListItemForEmeralds(Items.cooked_porkchop, new EntityVillager.PriceInfo(-7, -5)), new EntityVillager.ListItemForEmeralds(Items.cooked_chicken, new EntityVillager.PriceInfo(-8, -6))}}, {{new EntityVillager.EmeraldForItems(Items.leather, new EntityVillager.PriceInfo(9, 12)), new EntityVillager.ListItemForEmeralds(Items.leather_leggings, new EntityVillager.PriceInfo(2, 4))}, {new EntityVillager.ListEnchantedItemForEmeralds(Items.leather_chestplate, new EntityVillager.PriceInfo(7, 12))}, {new EntityVillager.ListItemForEmeralds(Items.saddle, new EntityVillager.PriceInfo(8, 10))}}}}; + + public EntityVillager(World worldIn) + { + this(worldIn, 0); + } + + public EntityVillager(World worldIn, int professionId) + { + super(worldIn); + this.villagerInventory = new InventoryBasic("Items", false, 8); + this.setProfession(professionId); + this.setSize(0.6F, 1.8F); + ((PathNavigateGround)this.getNavigator()).setBreakDoors(true); + ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); + this.tasks.addTask(1, new EntityAITradePlayer(this)); + this.tasks.addTask(1, new EntityAILookAtTradePlayer(this)); + this.tasks.addTask(2, new EntityAIMoveIndoors(this)); + this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this)); + this.tasks.addTask(4, new EntityAIOpenDoor(this, true)); + this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D)); + this.tasks.addTask(6, new EntityAIVillagerMate(this)); + this.tasks.addTask(7, new EntityAIFollowGolem(this)); + this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F)); + this.tasks.addTask(9, new EntityAIVillagerInteract(this)); + this.tasks.addTask(9, new EntityAIWander(this, 0.6D)); + this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); + this.setCanPickUpLoot(true); + } + + private void setAdditionalAItasks() + { + if (!this.areAdditionalTasksSet) + { + this.areAdditionalTasksSet = true; + + if (this.isChild()) + { + this.tasks.addTask(8, new EntityAIPlay(this, 0.32D)); + } + else if (this.getProfession() == 0) + { + this.tasks.addTask(6, new EntityAIHarvestFarmland(this, 0.6D)); + } + } + } + + /** + * This is called when Entity's growing age timer reaches 0 (negative values are considered as a child, positive as + * an adult) + */ + protected void onGrowingAdult() + { + if (this.getProfession() == 0) + { + this.tasks.addTask(8, new EntityAIHarvestFarmland(this, 0.6D)); + } + + super.onGrowingAdult(); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D); + } + + protected void updateAITasks() + { + if (--this.randomTickDivider <= 0) + { + BlockPos blockpos = new BlockPos(this); + this.worldObj.getVillageCollection().addToVillagerPositionList(blockpos); + this.randomTickDivider = 70 + this.rand.nextInt(50); + this.villageObj = this.worldObj.getVillageCollection().getNearestVillage(blockpos, 32); + + if (this.villageObj == null) + { + this.detachHome(); + } + else + { + BlockPos blockpos1 = this.villageObj.getCenter(); + this.setHomePosAndDistance(blockpos1, (int)((float)this.villageObj.getVillageRadius() * 1.0F)); + + if (this.isLookingForHome) + { + this.isLookingForHome = false; + this.villageObj.setDefaultPlayerReputation(5); + } + } + } + + if (!this.isTrading() && this.timeUntilReset > 0) + { + --this.timeUntilReset; + + if (this.timeUntilReset <= 0) + { + if (this.needsInitilization) + { + for (MerchantRecipe merchantrecipe : this.buyingList) + { + if (merchantrecipe.isRecipeDisabled()) + { + merchantrecipe.increaseMaxTradeUses(this.rand.nextInt(6) + this.rand.nextInt(6) + 2); + } + } + + this.populateBuyingList(); + this.needsInitilization = false; + + if (this.villageObj != null && this.lastBuyingPlayer != null) + { + this.worldObj.setEntityState(this, (byte)14); + this.villageObj.setReputationForPlayer(this.lastBuyingPlayer, 1); + } + } + + this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0)); + } + } + + super.updateAITasks(); + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg; + + if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild()) + { + if (!this.worldObj.isRemote && (this.buyingList == null || this.buyingList.size() > 0)) + { + this.setCustomer(player); + player.displayVillagerTradeGui(this); + } + + player.triggerAchievement(StatList.timesTalkedToVillagerStat); + return true; + } + else + { + return super.interact(player); + } + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Integer.valueOf(0)); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("Profession", this.getProfession()); + tagCompound.setInteger("Riches", this.wealth); + tagCompound.setInteger("Career", this.careerId); + tagCompound.setInteger("CareerLevel", this.careerLevel); + tagCompound.setBoolean("Willing", this.isWillingToMate); + + if (this.buyingList != null) + { + tagCompound.setTag("Offers", this.buyingList.getRecipiesAsTags()); + } + + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i) + { + ItemStack itemstack = this.villagerInventory.getStackInSlot(i); + + if (itemstack != null) + { + nbttaglist.appendTag(itemstack.writeToNBT(new NBTTagCompound())); + } + } + + tagCompound.setTag("Inventory", nbttaglist); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.setProfession(tagCompund.getInteger("Profession")); + this.wealth = tagCompund.getInteger("Riches"); + this.careerId = tagCompund.getInteger("Career"); + this.careerLevel = tagCompund.getInteger("CareerLevel"); + this.isWillingToMate = tagCompund.getBoolean("Willing"); + + if (tagCompund.hasKey("Offers", 10)) + { + NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Offers"); + this.buyingList = new MerchantRecipeList(nbttagcompound); + } + + NBTTagList nbttaglist = tagCompund.getTagList("Inventory", 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttaglist.getCompoundTagAt(i)); + + if (itemstack != null) + { + this.villagerInventory.func_174894_a(itemstack); + } + } + + this.setCanPickUpLoot(true); + this.setAdditionalAItasks(); + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return false; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return this.isTrading() ? "mob.villager.haggle" : "mob.villager.idle"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.villager.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.villager.death"; + } + + public void setProfession(int professionId) + { + this.dataWatcher.updateObject(16, Integer.valueOf(professionId)); + } + + public int getProfession() + { + return Math.max(this.dataWatcher.getWatchableObjectInt(16) % 5, 0); + } + + public boolean isMating() + { + return this.isMating; + } + + public void setMating(boolean mating) + { + this.isMating = mating; + } + + public void setPlaying(boolean playing) + { + this.isPlaying = playing; + } + + public boolean isPlaying() + { + return this.isPlaying; + } + + public void setRevengeTarget(EntityLivingBase livingBase) + { + super.setRevengeTarget(livingBase); + + if (this.villageObj != null && livingBase != null) + { + this.villageObj.addOrRenewAgressor(livingBase); + + if (livingBase instanceof EntityPlayer) + { + int i = -1; + + if (this.isChild()) + { + i = -3; + } + + this.villageObj.setReputationForPlayer(livingBase.getName(), i); + + if (this.isEntityAlive()) + { + this.worldObj.setEntityState(this, (byte)13); + } + } + } + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource cause) + { + if (this.villageObj != null) + { + Entity entity = cause.getEntity(); + + if (entity != null) + { + if (entity instanceof EntityPlayer) + { + this.villageObj.setReputationForPlayer(entity.getName(), -2); + } + else if (entity instanceof IMob) + { + this.villageObj.endMatingSeason(); + } + } + else + { + EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, 16.0D); + + if (entityplayer != null) + { + this.villageObj.endMatingSeason(); + } + } + } + + super.onDeath(cause); + } + + public void setCustomer(EntityPlayer p_70932_1_) + { + this.buyingPlayer = p_70932_1_; + } + + public EntityPlayer getCustomer() + { + return this.buyingPlayer; + } + + public boolean isTrading() + { + return this.buyingPlayer != null; + } + + /** + * Returns current or updated value of {@link #isWillingToMate} + */ + public boolean getIsWillingToMate(boolean updateFirst) + { + if (!this.isWillingToMate && updateFirst && this.func_175553_cp()) + { + boolean flag = false; + + for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i) + { + ItemStack itemstack = this.villagerInventory.getStackInSlot(i); + + if (itemstack != null) + { + if (itemstack.getItem() == Items.bread && itemstack.stackSize >= 3) + { + flag = true; + this.villagerInventory.decrStackSize(i, 3); + } + else if ((itemstack.getItem() == Items.potato || itemstack.getItem() == Items.carrot) && itemstack.stackSize >= 12) + { + flag = true; + this.villagerInventory.decrStackSize(i, 12); + } + } + + if (flag) + { + this.worldObj.setEntityState(this, (byte)18); + this.isWillingToMate = true; + break; + } + } + } + + return this.isWillingToMate; + } + + public void setIsWillingToMate(boolean willingToTrade) + { + this.isWillingToMate = willingToTrade; + } + + public void useRecipe(MerchantRecipe recipe) + { + recipe.incrementToolUses(); + this.livingSoundTime = -this.getTalkInterval(); + this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch()); + int i = 3 + this.rand.nextInt(4); + + if (recipe.getToolUses() == 1 || this.rand.nextInt(5) == 0) + { + this.timeUntilReset = 40; + this.needsInitilization = true; + this.isWillingToMate = true; + + if (this.buyingPlayer != null) + { + this.lastBuyingPlayer = this.buyingPlayer.getName(); + } + else + { + this.lastBuyingPlayer = null; + } + + i += 5; + } + + if (recipe.getItemToBuy().getItem() == Items.emerald) + { + this.wealth += recipe.getItemToBuy().stackSize; + } + + if (recipe.getRewardsExp()) + { + this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, i)); + } + } + + /** + * Notifies the merchant of a possible merchantrecipe being fulfilled or not. Usually, this is just a sound byte + * being played depending if the suggested itemstack is not null. + */ + public void verifySellingItem(ItemStack stack) + { + if (!this.worldObj.isRemote && this.livingSoundTime > -this.getTalkInterval() + 20) + { + this.livingSoundTime = -this.getTalkInterval(); + + if (stack != null) + { + this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch()); + } + else + { + this.playSound("mob.villager.no", this.getSoundVolume(), this.getSoundPitch()); + } + } + } + + public MerchantRecipeList getRecipes(EntityPlayer p_70934_1_) + { + if (this.buyingList == null) + { + this.populateBuyingList(); + } + + return this.buyingList; + } + + private void populateBuyingList() + { + EntityVillager.ITradeList[][][] aentityvillager$itradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()]; + + if (this.careerId != 0 && this.careerLevel != 0) + { + ++this.careerLevel; + } + else + { + this.careerId = this.rand.nextInt(aentityvillager$itradelist.length) + 1; + this.careerLevel = 1; + } + + if (this.buyingList == null) + { + this.buyingList = new MerchantRecipeList(); + } + + int i = this.careerId - 1; + int j = this.careerLevel - 1; + EntityVillager.ITradeList[][] aentityvillager$itradelist1 = aentityvillager$itradelist[i]; + + if (j >= 0 && j < aentityvillager$itradelist1.length) + { + EntityVillager.ITradeList[] aentityvillager$itradelist2 = aentityvillager$itradelist1[j]; + + for (EntityVillager.ITradeList entityvillager$itradelist : aentityvillager$itradelist2) + { + entityvillager$itradelist.modifyMerchantRecipeList(this.buyingList, this.rand); + } + } + } + + public void setRecipes(MerchantRecipeList recipeList) + { + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + String s = this.getCustomNameTag(); + + if (s != null && s.length() > 0) + { + ChatComponentText chatcomponenttext = new ChatComponentText(s); + chatcomponenttext.getChatStyle().setChatHoverEvent(this.getHoverEvent()); + chatcomponenttext.getChatStyle().setInsertion(this.getUniqueID().toString()); + return chatcomponenttext; + } + else + { + if (this.buyingList == null) + { + this.populateBuyingList(); + } + + String s1 = null; + + switch (this.getProfession()) + { + case 0: + if (this.careerId == 1) + { + s1 = "farmer"; + } + else if (this.careerId == 2) + { + s1 = "fisherman"; + } + else if (this.careerId == 3) + { + s1 = "shepherd"; + } + else if (this.careerId == 4) + { + s1 = "fletcher"; + } + + break; + + case 1: + s1 = "librarian"; + break; + + case 2: + s1 = "cleric"; + break; + + case 3: + if (this.careerId == 1) + { + s1 = "armor"; + } + else if (this.careerId == 2) + { + s1 = "weapon"; + } + else if (this.careerId == 3) + { + s1 = "tool"; + } + + break; + + case 4: + if (this.careerId == 1) + { + s1 = "butcher"; + } + else if (this.careerId == 2) + { + s1 = "leather"; + } + } + + if (s1 != null) + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("entity.Villager." + s1, new Object[0]); + chatcomponenttranslation.getChatStyle().setChatHoverEvent(this.getHoverEvent()); + chatcomponenttranslation.getChatStyle().setInsertion(this.getUniqueID().toString()); + return chatcomponenttranslation; + } + else + { + return super.getDisplayName(); + } + } + } + + public float getEyeHeight() + { + float f = 1.62F; + + if (this.isChild()) + { + f = (float)((double)f - 0.81D); + } + + return f; + } + + public void handleStatusUpdate(byte id) + { + if (id == 12) + { + this.spawnParticles(EnumParticleTypes.HEART); + } + else if (id == 13) + { + this.spawnParticles(EnumParticleTypes.VILLAGER_ANGRY); + } + else if (id == 14) + { + this.spawnParticles(EnumParticleTypes.VILLAGER_HAPPY); + } + else + { + super.handleStatusUpdate(id); + } + } + + private void spawnParticles(EnumParticleTypes particleType) + { + for (int i = 0; i < 5; ++i) + { + double d0 = this.rand.nextGaussian() * 0.02D; + double d1 = this.rand.nextGaussian() * 0.02D; + double d2 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle(particleType, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 1.0D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2, new int[0]); + } + } + + /** + * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called + * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory + */ + public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) + { + livingdata = super.onInitialSpawn(difficulty, livingdata); + this.setProfession(this.worldObj.rand.nextInt(5)); + this.setAdditionalAItasks(); + return livingdata; + } + + public void setLookingForHome() + { + this.isLookingForHome = true; + } + + public EntityVillager createChild(EntityAgeable ageable) + { + EntityVillager entityvillager = new EntityVillager(this.worldObj); + entityvillager.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null); + return entityvillager; + } + + public boolean allowLeashing() + { + return false; + } + + /** + * Called when a lightning bolt hits the entity. + */ + public void onStruckByLightning(EntityLightningBolt lightningBolt) + { + if (!this.worldObj.isRemote && !this.isDead) + { + EntityWitch entitywitch = new EntityWitch(this.worldObj); + entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + entitywitch.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null); + entitywitch.setNoAI(this.isAIDisabled()); + + if (this.hasCustomName()) + { + entitywitch.setCustomNameTag(this.getCustomNameTag()); + entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag()); + } + + this.worldObj.spawnEntityInWorld(entitywitch); + this.setDead(); + } + } + + public InventoryBasic getVillagerInventory() + { + return this.villagerInventory; + } + + /** + * Tests if this entity should pickup a weapon or an armor. Entity drops current weapon or armor if the new one is + * better. + */ + protected void updateEquipmentIfNeeded(EntityItem itemEntity) + { + ItemStack itemstack = itemEntity.getEntityItem(); + Item item = itemstack.getItem(); + + if (this.canVillagerPickupItem(item)) + { + ItemStack itemstack1 = this.villagerInventory.func_174894_a(itemstack); + + if (itemstack1 == null) + { + itemEntity.setDead(); + } + else + { + itemstack.stackSize = itemstack1.stackSize; + } + } + } + + private boolean canVillagerPickupItem(Item itemIn) + { + return itemIn == Items.bread || itemIn == Items.potato || itemIn == Items.carrot || itemIn == Items.wheat || itemIn == Items.wheat_seeds; + } + + public boolean func_175553_cp() + { + return this.hasEnoughItems(1); + } + + /** + * Used by {@link net.minecraft.entity.ai.EntityAIVillagerInteract EntityAIVillagerInteract} to check if the + * villager can give some items from an inventory to another villager. + */ + public boolean canAbondonItems() + { + return this.hasEnoughItems(2); + } + + public boolean func_175557_cr() + { + boolean flag = this.getProfession() == 0; + return flag ? !this.hasEnoughItems(5) : !this.hasEnoughItems(1); + } + + /** + * Returns true if villager has enough items in inventory + */ + private boolean hasEnoughItems(int multiplier) + { + boolean flag = this.getProfession() == 0; + + for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i) + { + ItemStack itemstack = this.villagerInventory.getStackInSlot(i); + + if (itemstack != null) + { + if (itemstack.getItem() == Items.bread && itemstack.stackSize >= 3 * multiplier || itemstack.getItem() == Items.potato && itemstack.stackSize >= 12 * multiplier || itemstack.getItem() == Items.carrot && itemstack.stackSize >= 12 * multiplier) + { + return true; + } + + if (flag && itemstack.getItem() == Items.wheat && itemstack.stackSize >= 9 * multiplier) + { + return true; + } + } + } + + return false; + } + + /** + * Returns true if villager has seeds, potatoes or carrots in inventory + */ + public boolean isFarmItemInInventory() + { + for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i) + { + ItemStack itemstack = this.villagerInventory.getStackInSlot(i); + + if (itemstack != null && (itemstack.getItem() == Items.wheat_seeds || itemstack.getItem() == Items.potato || itemstack.getItem() == Items.carrot)) + { + return true; + } + } + + return false; + } + + public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn) + { + if (super.replaceItemInInventory(inventorySlot, itemStackIn)) + { + return true; + } + else + { + int i = inventorySlot - 300; + + if (i >= 0 && i < this.villagerInventory.getSizeInventory()) + { + this.villagerInventory.setInventorySlotContents(i, itemStackIn); + return true; + } + else + { + return false; + } + } + } + + static class EmeraldForItems implements EntityVillager.ITradeList + { + public Item sellItem; + public EntityVillager.PriceInfo price; + + public EmeraldForItems(Item itemIn, EntityVillager.PriceInfo priceIn) + { + this.sellItem = itemIn; + this.price = priceIn; + } + + public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) + { + int i = 1; + + if (this.price != null) + { + i = this.price.getPrice(random); + } + + recipeList.add(new MerchantRecipe(new ItemStack(this.sellItem, i, 0), Items.emerald)); + } + } + + interface ITradeList + { + void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random); + } + + static class ItemAndEmeraldToItem implements EntityVillager.ITradeList + { + public ItemStack field_179411_a; + public EntityVillager.PriceInfo field_179409_b; + public ItemStack field_179410_c; + public EntityVillager.PriceInfo field_179408_d; + + public ItemAndEmeraldToItem(Item p_i45813_1_, EntityVillager.PriceInfo p_i45813_2_, Item p_i45813_3_, EntityVillager.PriceInfo p_i45813_4_) + { + this.field_179411_a = new ItemStack(p_i45813_1_); + this.field_179409_b = p_i45813_2_; + this.field_179410_c = new ItemStack(p_i45813_3_); + this.field_179408_d = p_i45813_4_; + } + + public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) + { + int i = 1; + + if (this.field_179409_b != null) + { + i = this.field_179409_b.getPrice(random); + } + + int j = 1; + + if (this.field_179408_d != null) + { + j = this.field_179408_d.getPrice(random); + } + + recipeList.add(new MerchantRecipe(new ItemStack(this.field_179411_a.getItem(), i, this.field_179411_a.getMetadata()), new ItemStack(Items.emerald), new ItemStack(this.field_179410_c.getItem(), j, this.field_179410_c.getMetadata()))); + } + } + + static class ListEnchantedBookForEmeralds implements EntityVillager.ITradeList + { + public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) + { + Enchantment enchantment = Enchantment.enchantmentsBookList[random.nextInt(Enchantment.enchantmentsBookList.length)]; + int i = MathHelper.getRandomIntegerInRange(random, enchantment.getMinLevel(), enchantment.getMaxLevel()); + ItemStack itemstack = Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(enchantment, i)); + int j = 2 + random.nextInt(5 + i * 10) + 3 * i; + + if (j > 64) + { + j = 64; + } + + recipeList.add(new MerchantRecipe(new ItemStack(Items.book), new ItemStack(Items.emerald, j), itemstack)); + } + } + + static class ListEnchantedItemForEmeralds implements EntityVillager.ITradeList + { + public ItemStack field_179407_a; + public EntityVillager.PriceInfo field_179406_b; + + public ListEnchantedItemForEmeralds(Item p_i45814_1_, EntityVillager.PriceInfo p_i45814_2_) + { + this.field_179407_a = new ItemStack(p_i45814_1_); + this.field_179406_b = p_i45814_2_; + } + + public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) + { + int i = 1; + + if (this.field_179406_b != null) + { + i = this.field_179406_b.getPrice(random); + } + + ItemStack itemstack = new ItemStack(Items.emerald, i, 0); + ItemStack itemstack1 = new ItemStack(this.field_179407_a.getItem(), 1, this.field_179407_a.getMetadata()); + itemstack1 = EnchantmentHelper.addRandomEnchantment(random, itemstack1, 5 + random.nextInt(15)); + recipeList.add(new MerchantRecipe(itemstack, itemstack1)); + } + } + + static class ListItemForEmeralds implements EntityVillager.ITradeList + { + public ItemStack field_179403_a; + public EntityVillager.PriceInfo field_179402_b; + + public ListItemForEmeralds(Item par1Item, EntityVillager.PriceInfo priceInfo) + { + this.field_179403_a = new ItemStack(par1Item); + this.field_179402_b = priceInfo; + } + + public ListItemForEmeralds(ItemStack stack, EntityVillager.PriceInfo priceInfo) + { + this.field_179403_a = stack; + this.field_179402_b = priceInfo; + } + + public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) + { + int i = 1; + + if (this.field_179402_b != null) + { + i = this.field_179402_b.getPrice(random); + } + + ItemStack itemstack; + ItemStack itemstack1; + + if (i < 0) + { + itemstack = new ItemStack(Items.emerald, 1, 0); + itemstack1 = new ItemStack(this.field_179403_a.getItem(), -i, this.field_179403_a.getMetadata()); + } + else + { + itemstack = new ItemStack(Items.emerald, i, 0); + itemstack1 = new ItemStack(this.field_179403_a.getItem(), 1, this.field_179403_a.getMetadata()); + } + + recipeList.add(new MerchantRecipe(itemstack, itemstack1)); + } + } + + static class PriceInfo extends Tuple + { + public PriceInfo(int p_i45810_1_, int p_i45810_2_) + { + super(Integer.valueOf(p_i45810_1_), Integer.valueOf(p_i45810_2_)); + } + + public int getPrice(Random rand) + { + return ((Integer)this.getFirst()).intValue() >= ((Integer)this.getSecond()).intValue() ? ((Integer)this.getFirst()).intValue() : ((Integer)this.getFirst()).intValue() + rand.nextInt(((Integer)this.getSecond()).intValue() - ((Integer)this.getFirst()).intValue() + 1); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityWaterMob.java b/src/minecraft/net/minecraft/entity/passive/EntityWaterMob.java new file mode 100644 index 0000000..4d485ab --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityWaterMob.java @@ -0,0 +1,89 @@ +package net.minecraft.entity.passive; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; + +public abstract class EntityWaterMob extends EntityLiving implements IAnimals +{ + public EntityWaterMob(World worldIn) + { + super(worldIn); + } + + public boolean canBreatheUnderwater() + { + return true; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return true; + } + + /** + * Checks that the entity is not colliding with any blocks / liquids + */ + public boolean isNotColliding() + { + return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this); + } + + /** + * Get number of ticks, at least during which the living entity will be silent. + */ + public int getTalkInterval() + { + return 120; + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return true; + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer player) + { + return 1 + this.worldObj.rand.nextInt(3); + } + + /** + * Gets called every tick from main Entity class + */ + public void onEntityUpdate() + { + int i = this.getAir(); + super.onEntityUpdate(); + + if (this.isEntityAlive() && !this.isInWater()) + { + --i; + this.setAir(i); + + if (this.getAir() == -20) + { + this.setAir(0); + this.attackEntityFrom(DamageSource.drown, 2.0F); + } + } + else + { + this.setAir(300); + } + } + + public boolean isPushedByWater() + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/EntityWolf.java b/src/minecraft/net/minecraft/entity/passive/EntityWolf.java new file mode 100644 index 0000000..d70b0c2 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/EntityWolf.java @@ -0,0 +1,639 @@ +package net.minecraft.entity.passive; + +import com.google.common.base.Predicate; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIBeg; +import net.minecraft.entity.ai.EntityAIFollowOwner; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILeapAtTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIMate; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget; +import net.minecraft.entity.ai.EntityAIOwnerHurtTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAITargetNonTamed; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.pathfinding.PathNavigateGround; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityWolf extends EntityTameable +{ + /** Float used to smooth the rotation of the wolf head */ + private float headRotationCourse; + private float headRotationCourseOld; + + /** true is the wolf is wet else false */ + private boolean isWet; + + /** True if the wolf is shaking else False */ + private boolean isShaking; + + /** + * This time increases while wolf is shaking and emitting water particles. + */ + private float timeWolfIsShaking; + private float prevTimeWolfIsShaking; + + public EntityWolf(World worldIn) + { + super(worldIn); + this.setSize(0.6F, 0.8F); + ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, this.aiSit); + this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F)); + this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true)); + this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F)); + this.tasks.addTask(6, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(8, new EntityAIBeg(this, 8.0F)); + this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(9, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this)); + this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this)); + this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true, new Class[0])); + this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityAnimal.class, false, new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_ instanceof EntitySheep || p_apply_1_ instanceof EntityRabbit; + } + })); + this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, EntitySkeleton.class, false)); + this.setTamed(false); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); + + if (this.isTamed()) + { + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); + } + else + { + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); + } + + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D); + } + + /** + * Sets the active target the Task system uses for tracking + */ + public void setAttackTarget(EntityLivingBase entitylivingbaseIn) + { + super.setAttackTarget(entitylivingbaseIn); + + if (entitylivingbaseIn == null) + { + this.setAngry(false); + } + else if (!this.isTamed()) + { + this.setAngry(true); + } + } + + protected void updateAITasks() + { + this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth())); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(18, new Float(this.getHealth())); + this.dataWatcher.addObject(19, new Byte((byte)0)); + this.dataWatcher.addObject(20, new Byte((byte)EnumDyeColor.RED.getMetadata())); + } + + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound("mob.wolf.step", 0.15F, 1.0F); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setBoolean("Angry", this.isAngry()); + tagCompound.setByte("CollarColor", (byte)this.getCollarColor().getDyeDamage()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.setAngry(tagCompund.getBoolean("Angry")); + + if (tagCompund.hasKey("CollarColor", 99)) + { + this.setCollarColor(EnumDyeColor.byDyeDamage(tagCompund.getByte("CollarColor"))); + } + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return this.isAngry() ? "mob.wolf.growl" : (this.rand.nextInt(3) == 0 ? (this.isTamed() && this.dataWatcher.getWatchableObjectFloat(18) < 10.0F ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark"); + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.wolf.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.wolf.death"; + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.4F; + } + + protected Item getDropItem() + { + return Item.getItemById(-1); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (!this.worldObj.isRemote && this.isWet && !this.isShaking && !this.hasPath() && this.onGround) + { + this.isShaking = true; + this.timeWolfIsShaking = 0.0F; + this.prevTimeWolfIsShaking = 0.0F; + this.worldObj.setEntityState(this, (byte)8); + } + + if (!this.worldObj.isRemote && this.getAttackTarget() == null && this.isAngry()) + { + this.setAngry(false); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + this.headRotationCourseOld = this.headRotationCourse; + + if (this.isBegging()) + { + this.headRotationCourse += (1.0F - this.headRotationCourse) * 0.4F; + } + else + { + this.headRotationCourse += (0.0F - this.headRotationCourse) * 0.4F; + } + + if (this.isWet()) + { + this.isWet = true; + this.isShaking = false; + this.timeWolfIsShaking = 0.0F; + this.prevTimeWolfIsShaking = 0.0F; + } + else if ((this.isWet || this.isShaking) && this.isShaking) + { + if (this.timeWolfIsShaking == 0.0F) + { + this.playSound("mob.wolf.shake", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + + this.prevTimeWolfIsShaking = this.timeWolfIsShaking; + this.timeWolfIsShaking += 0.05F; + + if (this.prevTimeWolfIsShaking >= 2.0F) + { + this.isWet = false; + this.isShaking = false; + this.prevTimeWolfIsShaking = 0.0F; + this.timeWolfIsShaking = 0.0F; + } + + if (this.timeWolfIsShaking > 0.4F) + { + float f = (float)this.getEntityBoundingBox().minY; + int i = (int)(MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float)Math.PI) * 7.0F); + + for (int j = 0; j < i; ++j) + { + float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; + float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; + this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, this.posX + (double)f1, (double)(f + 0.8F), this.posZ + (double)f2, this.motionX, this.motionY, this.motionZ, new int[0]); + } + } + } + } + + /** + * True if the wolf is wet + */ + public boolean isWolfWet() + { + return this.isWet; + } + + /** + * Used when calculating the amount of shading to apply while the wolf is wet. + */ + public float getShadingWhileWet(float p_70915_1_) + { + return 0.75F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70915_1_) / 2.0F * 0.25F; + } + + public float getShakeAngle(float p_70923_1_, float p_70923_2_) + { + float f = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_ + p_70923_2_) / 1.8F; + + if (f < 0.0F) + { + f = 0.0F; + } + else if (f > 1.0F) + { + f = 1.0F; + } + + return MathHelper.sin(f * (float)Math.PI) * MathHelper.sin(f * (float)Math.PI * 11.0F) * 0.15F * (float)Math.PI; + } + + public float getInterestedAngle(float p_70917_1_) + { + return (this.headRotationCourseOld + (this.headRotationCourse - this.headRotationCourseOld) * p_70917_1_) * 0.15F * (float)Math.PI; + } + + public float getEyeHeight() + { + return this.height * 0.8F; + } + + /** + * The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently + * use in wolves. + */ + public int getVerticalFaceSpeed() + { + return this.isSitting() ? 20 : super.getVerticalFaceSpeed(); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + Entity entity = source.getEntity(); + this.aiSit.setSitting(false); + + if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) + { + amount = (amount + 1.0F) / 2.0F; + } + + return super.attackEntityFrom(source, amount); + } + } + + public boolean attackEntityAsMob(Entity entityIn) + { + boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), (float)((int)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue())); + + if (flag) + { + this.applyEnchantments(this, entityIn); + } + + return flag; + } + + public void setTamed(boolean tamed) + { + super.setTamed(tamed); + + if (tamed) + { + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0D); + } + else + { + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); + } + + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D); + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer player) + { + ItemStack itemstack = player.inventory.getCurrentItem(); + + if (this.isTamed()) + { + if (itemstack != null) + { + if (itemstack.getItem() instanceof ItemFood) + { + ItemFood itemfood = (ItemFood)itemstack.getItem(); + + if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F) + { + if (!player.capabilities.isCreativeMode) + { + --itemstack.stackSize; + } + + this.heal((float)itemfood.getHealAmount(itemstack)); + + if (itemstack.stackSize <= 0) + { + player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null); + } + + return true; + } + } + else if (itemstack.getItem() == Items.dye) + { + EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(itemstack.getMetadata()); + + if (enumdyecolor != this.getCollarColor()) + { + this.setCollarColor(enumdyecolor); + + if (!player.capabilities.isCreativeMode && --itemstack.stackSize <= 0) + { + player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null); + } + + return true; + } + } + } + + if (this.isOwner(player) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack)) + { + this.aiSit.setSitting(!this.isSitting()); + this.isJumping = false; + this.navigator.clearPathEntity(); + this.setAttackTarget((EntityLivingBase)null); + } + } + else if (itemstack != null && itemstack.getItem() == Items.bone && !this.isAngry()) + { + if (!player.capabilities.isCreativeMode) + { + --itemstack.stackSize; + } + + if (itemstack.stackSize <= 0) + { + player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null); + } + + if (!this.worldObj.isRemote) + { + if (this.rand.nextInt(3) == 0) + { + this.setTamed(true); + this.navigator.clearPathEntity(); + this.setAttackTarget((EntityLivingBase)null); + this.aiSit.setSitting(true); + this.setHealth(20.0F); + this.setOwnerId(player.getUniqueID().toString()); + this.playTameEffect(true); + this.worldObj.setEntityState(this, (byte)7); + } + else + { + this.playTameEffect(false); + this.worldObj.setEntityState(this, (byte)6); + } + } + + return true; + } + + return super.interact(player); + } + + public void handleStatusUpdate(byte id) + { + if (id == 8) + { + this.isShaking = true; + this.timeWolfIsShaking = 0.0F; + this.prevTimeWolfIsShaking = 0.0F; + } + else + { + super.handleStatusUpdate(id); + } + } + + public float getTailRotation() + { + return this.isAngry() ? 1.5393804F : (this.isTamed() ? (0.55F - (20.0F - this.dataWatcher.getWatchableObjectFloat(18)) * 0.02F) * (float)Math.PI : ((float)Math.PI / 5F)); + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack stack) + { + return stack == null ? false : (!(stack.getItem() instanceof ItemFood) ? false : ((ItemFood)stack.getItem()).isWolfsFavoriteMeat()); + } + + /** + * Will return how many at most can spawn in a chunk at once. + */ + public int getMaxSpawnedInChunk() + { + return 8; + } + + /** + * Determines whether this wolf is angry or not. + */ + public boolean isAngry() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0; + } + + /** + * Sets whether this wolf is angry or not. + */ + public void setAngry(boolean angry) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + if (angry) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 2))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -3))); + } + } + + public EnumDyeColor getCollarColor() + { + return EnumDyeColor.byDyeDamage(this.dataWatcher.getWatchableObjectByte(20) & 15); + } + + public void setCollarColor(EnumDyeColor collarcolor) + { + this.dataWatcher.updateObject(20, Byte.valueOf((byte)(collarcolor.getDyeDamage() & 15))); + } + + public EntityWolf createChild(EntityAgeable ageable) + { + EntityWolf entitywolf = new EntityWolf(this.worldObj); + String s = this.getOwnerId(); + + if (s != null && s.trim().length() > 0) + { + entitywolf.setOwnerId(s); + entitywolf.setTamed(true); + } + + return entitywolf; + } + + public void setBegging(boolean beg) + { + if (beg) + { + this.dataWatcher.updateObject(19, Byte.valueOf((byte)1)); + } + else + { + this.dataWatcher.updateObject(19, Byte.valueOf((byte)0)); + } + } + + /** + * Returns true if the mob is currently able to mate with the specified mob. + */ + public boolean canMateWith(EntityAnimal otherAnimal) + { + if (otherAnimal == this) + { + return false; + } + else if (!this.isTamed()) + { + return false; + } + else if (!(otherAnimal instanceof EntityWolf)) + { + return false; + } + else + { + EntityWolf entitywolf = (EntityWolf)otherAnimal; + return !entitywolf.isTamed() ? false : (entitywolf.isSitting() ? false : this.isInLove() && entitywolf.isInLove()); + } + } + + public boolean isBegging() + { + return this.dataWatcher.getWatchableObjectByte(19) == 1; + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return !this.isTamed() && this.ticksExisted > 2400; + } + + public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) + { + if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) + { + if (p_142018_1_ instanceof EntityWolf) + { + EntityWolf entitywolf = (EntityWolf)p_142018_1_; + + if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_) + { + return false; + } + } + + return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame(); + } + else + { + return false; + } + } + + public boolean allowLeashing() + { + return !this.isAngry() && super.allowLeashing(); + } +} diff --git a/src/minecraft/net/minecraft/entity/passive/IAnimals.java b/src/minecraft/net/minecraft/entity/passive/IAnimals.java new file mode 100644 index 0000000..0a0cdd2 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/passive/IAnimals.java @@ -0,0 +1,5 @@ +package net.minecraft.entity.passive; + +public interface IAnimals +{ +} diff --git a/src/minecraft/net/minecraft/entity/player/EntityPlayer.java b/src/minecraft/net/minecraft/entity/player/EntityPlayer.java new file mode 100644 index 0000000..c2984bf --- /dev/null +++ b/src/minecraft/net/minecraft/entity/player/EntityPlayer.java @@ -0,0 +1,2661 @@ +package net.minecraft.entity.player; + +import com.google.common.base.Charsets; +import com.google.common.collect.Lists; +import com.mojang.authlib.GameProfile; + +import animeware.cosmetic.Booleans; + +import java.util.Collection; +import java.util.List; +import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.BlockDirectional; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.command.server.CommandBlockLogic; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.IEntityMultiPart; +import net.minecraft.entity.IMerchant; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.boss.EntityDragonPart; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityFishHook; +import net.minecraft.event.ClickEvent; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryEnderChest; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.play.server.S12PacketEntityVelocity; +import net.minecraft.potion.Potion; +import net.minecraft.scoreboard.IScoreObjectiveCriteria; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.scoreboard.Team; +import net.minecraft.server.MinecraftServer; +import net.minecraft.stats.AchievementList; +import net.minecraft.stats.StatBase; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.FoodStats; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.IInteractionObject; +import net.minecraft.world.LockCode; +import net.minecraft.world.World; +import net.minecraft.world.WorldSettings; + +@SuppressWarnings("incomplete-switch") +public abstract class EntityPlayer extends EntityLivingBase +{ + /** Inventory of the player */ + public InventoryPlayer inventory = new InventoryPlayer(this); + private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); + + /** + * The Container for the player's inventory (which opens when they press E) + */ + public Container inventoryContainer; + + /** The Container the player has open. */ + public Container openContainer; + + /** The food object of the player, the general hunger logic. */ + protected FoodStats foodStats = new FoodStats(); + + /** + * Used to tell if the player pressed jump twice. If this is at 0 and it's pressed (And they are allowed to fly, as + * defined in the player's movementInput) it sets this to 7. If it's pressed and it's greater than 0 enable fly. + */ + protected int flyToggleTimer; + public float prevCameraYaw; + public float cameraYaw; + + /** + * Used by EntityPlayer to prevent too many xp orbs from getting absorbed at once. + */ + public int xpCooldown; + public double prevChasingPosX; + public double prevChasingPosY; + public double prevChasingPosZ; + public double chasingPosX; + public double chasingPosY; + public double chasingPosZ; + + /** Boolean value indicating weather a player is sleeping or not */ + protected boolean sleeping; + + /** the current location of the player */ + public BlockPos playerLocation; + private int sleepTimer; + public float renderOffsetX; + public float renderOffsetY; + public float renderOffsetZ; + + /** holds the spawn chunk of the player */ + private BlockPos spawnChunk; + + /** + * Whether this player's spawn point is forced, preventing execution of bed checks. + */ + private boolean spawnForced; + + /** Holds the coordinate of the player when enter a minecraft to ride. */ + private BlockPos startMinecartRidingCoordinate; + + /** The player's capabilities. (See class PlayerCapabilities) */ + public PlayerCapabilities capabilities = new PlayerCapabilities(); + + /** The current experience level the player is on. */ + public int experienceLevel; + + /** + * The total amount of experience the player has. This also includes the amount of experience within their + * Experience Bar. + */ + public int experienceTotal; + + /** + * The current amount of experience the player has within their Experience Bar. + */ + public float experience; + private int xpSeed; + + /** + * This is the item that is in use when the player is holding down the useItemButton (e.g., bow, food, sword) + */ + private ItemStack itemInUse; + + /** + * This field starts off equal to getMaxItemUseDuration and is decremented on each tick + */ + private int itemInUseCount; + protected float speedOnGround = 0.1F; + protected float speedInAir = 0.02F; + private int lastXPSound; + + /** The player's unique game profile */ + private final GameProfile gameProfile; + private boolean hasReducedDebug = false; + + /** + * An instance of a fishing rod's hook. If this isn't null, the icon image of the fishing rod is slightly different + */ + public EntityFishHook fishEntity; + + public EntityPlayer(World worldIn, GameProfile gameProfileIn) + { + super(worldIn); + this.entityUniqueID = getUUID(gameProfileIn); + this.gameProfile = gameProfileIn; + this.inventoryContainer = new ContainerPlayer(this.inventory, !worldIn.isRemote, this); + this.openContainer = this.inventoryContainer; + BlockPos blockpos = worldIn.getSpawnPoint(); + this.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)(blockpos.getY() + 1), (double)blockpos.getZ() + 0.5D, 0.0F, 0.0F); + this.field_70741_aB = 180.0F; + this.fireResistance = 20; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.10000000149011612D); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(17, Float.valueOf(0.0F)); + this.dataWatcher.addObject(18, Integer.valueOf(0)); + this.dataWatcher.addObject(10, Byte.valueOf((byte)0)); + } + + /** + * returns the ItemStack containing the itemInUse + */ + public ItemStack getItemInUse() + { + return this.itemInUse; + } + + /** + * Returns the item in use count + */ + public int getItemInUseCount() + { + return this.itemInUseCount; + } + + /** + * Checks if the entity is currently using an item (e.g., bow, food, sword) by holding down the useItemButton + */ + public boolean isUsingItem() + { + return this.itemInUse != null; + } + + /** + * gets the duration for how long the current itemInUse has been in use + */ + public int getItemInUseDuration() + { + return this.isUsingItem() ? this.itemInUse.getMaxItemUseDuration() - this.itemInUseCount : 0; + } + + public void stopUsingItem() + { + if (this.itemInUse != null) + { + this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); + } + + this.clearItemInUse(); + } + + public void clearItemInUse() + { + this.itemInUse = null; + this.itemInUseCount = 0; + + if (!this.worldObj.isRemote) + { + this.setEating(false); + } + } + + public boolean isBlocking() + { + return this.isUsingItem() && this.itemInUse.getItem().getItemUseAction(this.itemInUse) == EnumAction.BLOCK; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.noClip = this.isSpectator(); + + if (this.isSpectator()) + { + this.onGround = false; + } + + if (this.itemInUse != null) + { + ItemStack itemstack = this.inventory.getCurrentItem(); + + if (itemstack == this.itemInUse) + { + if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) + { + this.updateItemUse(itemstack, 5); + } + + if (--this.itemInUseCount == 0 && !this.worldObj.isRemote) + { + this.onItemUseFinish(); + } + } + else + { + this.clearItemInUse(); + } + } + + if (this.xpCooldown > 0) + { + --this.xpCooldown; + } + + if (this.isPlayerSleeping()) + { + ++this.sleepTimer; + + if (this.sleepTimer > 100) + { + this.sleepTimer = 100; + } + + if (!this.worldObj.isRemote) + { + if (!this.isInBed()) + { + this.wakeUpPlayer(true, true, false); + } + else if (this.worldObj.isDaytime()) + { + this.wakeUpPlayer(false, true, true); + } + } + } + else if (this.sleepTimer > 0) + { + ++this.sleepTimer; + + if (this.sleepTimer >= 110) + { + this.sleepTimer = 0; + } + } + + super.onUpdate(); + + if (!this.worldObj.isRemote && this.openContainer != null && !this.openContainer.canInteractWith(this)) + { + this.closeScreen(); + this.openContainer = this.inventoryContainer; + } + + if (this.isBurning() && this.capabilities.disableDamage) + { + this.extinguish(); + } + + this.prevChasingPosX = this.chasingPosX; + this.prevChasingPosY = this.chasingPosY; + this.prevChasingPosZ = this.chasingPosZ; + double d5 = this.posX - this.chasingPosX; + double d0 = this.posY - this.chasingPosY; + double d1 = this.posZ - this.chasingPosZ; + double d2 = 10.0D; + + if (d5 > d2) + { + this.prevChasingPosX = this.chasingPosX = this.posX; + } + + if (d1 > d2) + { + this.prevChasingPosZ = this.chasingPosZ = this.posZ; + } + + if (d0 > d2) + { + this.prevChasingPosY = this.chasingPosY = this.posY; + } + + if (d5 < -d2) + { + this.prevChasingPosX = this.chasingPosX = this.posX; + } + + if (d1 < -d2) + { + this.prevChasingPosZ = this.chasingPosZ = this.posZ; + } + + if (d0 < -d2) + { + this.prevChasingPosY = this.chasingPosY = this.posY; + } + + this.chasingPosX += d5 * 0.25D; + this.chasingPosZ += d1 * 0.25D; + this.chasingPosY += d0 * 0.25D; + + if (this.ridingEntity == null) + { + this.startMinecartRidingCoordinate = null; + } + + if (!this.worldObj.isRemote) + { + this.foodStats.onUpdate(this); + this.triggerAchievement(StatList.minutesPlayedStat); + + if (this.isEntityAlive()) + { + this.triggerAchievement(StatList.timeSinceDeathStat); + } + } + + int i = 29999999; + double d3 = MathHelper.clamp_double(this.posX, -2.9999999E7D, 2.9999999E7D); + double d4 = MathHelper.clamp_double(this.posZ, -2.9999999E7D, 2.9999999E7D); + + if (d3 != this.posX || d4 != this.posZ) + { + this.setPosition(d3, this.posY, d4); + } + } + + /** + * Return the amount of time this entity should stay in a portal before being transported. + */ + public int getMaxInPortalTime() + { + return this.capabilities.disableDamage ? 0 : 80; + } + + protected String getSwimSound() + { + return "game.player.swim"; + } + + protected String getSplashSound() + { + return "game.player.swim.splash"; + } + + /** + * Return the amount of cooldown before this entity can use a portal again. + */ + public int getPortalCooldown() + { + return 10; + } + + public void playSound(String name, float volume, float pitch) + { + this.worldObj.playSoundToNearExcept(this, name, volume, pitch); + } + + /** + * Plays sounds and makes particles for item in use state + */ + protected void updateItemUse(ItemStack itemStackIn, int p_71010_2_) + { + if (itemStackIn.getItemUseAction() == EnumAction.DRINK) + { + this.playSound("random.drink", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + + if (itemStackIn.getItemUseAction() == EnumAction.EAT) + { + for (int i = 0; i < p_71010_2_; ++i) + { + Vec3 vec3 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); + vec3 = vec3.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F); + vec3 = vec3.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F); + double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D; + Vec3 vec31 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D); + vec31 = vec31.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F); + vec31 = vec31.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F); + vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); + + if (itemStackIn.getHasSubtypes()) + { + this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord, new int[] {Item.getIdFromItem(itemStackIn.getItem()), itemStackIn.getMetadata()}); + } + else + { + this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord, new int[] {Item.getIdFromItem(itemStackIn.getItem())}); + } + } + + this.playSound("random.eat", 0.5F + 0.5F * (float)this.rand.nextInt(2), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + } + + /** + * Used for when item use count runs out, ie: eating completed + */ + protected void onItemUseFinish() + { + if (this.itemInUse != null) + { + this.updateItemUse(this.itemInUse, 16); + int i = this.itemInUse.stackSize; + ItemStack itemstack = this.itemInUse.onItemUseFinish(this.worldObj, this); + + if (itemstack != this.itemInUse || itemstack != null && itemstack.stackSize != i) + { + this.inventory.mainInventory[this.inventory.currentItem] = itemstack; + + if (itemstack.stackSize == 0) + { + this.inventory.mainInventory[this.inventory.currentItem] = null; + } + } + + this.clearItemInUse(); + } + } + + public void handleStatusUpdate(byte id) + { + if (id == 9) + { + this.onItemUseFinish(); + } + else if (id == 23) + { + this.hasReducedDebug = false; + } + else if (id == 22) + { + this.hasReducedDebug = true; + } + else + { + super.handleStatusUpdate(id); + } + } + + /** + * Dead and sleeping entities cannot move + */ + protected boolean isMovementBlocked() + { + return this.getHealth() <= 0.0F || this.isPlayerSleeping(); + } + + /** + * set current crafting inventory back to the 2x2 square + */ + protected void closeScreen() + { + this.openContainer = this.inventoryContainer; + } + + /** + * Handles updating while being ridden by an entity + */ + public void updateRidden() + { + if (!this.worldObj.isRemote && this.isSneaking()) + { + this.mountEntity((Entity)null); + this.setSneaking(false); + } + else + { + double d0 = this.posX; + double d1 = this.posY; + double d2 = this.posZ; + float f = this.rotationYaw; + float f1 = this.rotationPitch; + super.updateRidden(); + this.prevCameraYaw = this.cameraYaw; + this.cameraYaw = 0.0F; + this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); + + if (this.ridingEntity instanceof EntityPig) + { + this.rotationPitch = f1; + this.rotationYaw = f; + this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; + } + } + } + + /** + * Keeps moving the entity up so it isn't colliding with blocks and other requirements for this entity to be spawned + * (only actually used on players though its also on Entity) + */ + public void preparePlayerToSpawn() + { + this.setSize(0.6F, 1.8F); + super.preparePlayerToSpawn(); + this.setHealth(this.getMaxHealth()); + this.deathTime = 0; + } + + protected void updateEntityActionState() + { + super.updateEntityActionState(); + this.updateArmSwingProgress(); + this.rotationYawHead = this.rotationYaw; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.flyToggleTimer > 0) + { + --this.flyToggleTimer; + } + + if (this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL && this.worldObj.getGameRules().getBoolean("naturalRegeneration")) + { + if (this.getHealth() < this.getMaxHealth() && this.ticksExisted % 20 == 0) + { + this.heal(1.0F); + } + + if (this.foodStats.needFood() && this.ticksExisted % 10 == 0) + { + this.foodStats.setFoodLevel(this.foodStats.getFoodLevel() + 1); + } + } + + this.inventory.decrementAnimations(); + this.prevCameraYaw = this.cameraYaw; + super.onLivingUpdate(); + IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + + if (!this.worldObj.isRemote) + { + iattributeinstance.setBaseValue((double)this.capabilities.getWalkSpeed()); + } + + this.jumpMovementFactor = this.speedInAir; + + if (this.isSprinting()) + { + this.jumpMovementFactor = (float)((double)this.jumpMovementFactor + (double)this.speedInAir * 0.3D); + } + + this.setAIMoveSpeed((float)iattributeinstance.getAttributeValue()); + float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + float f1 = (float)(Math.atan(-this.motionY * 0.20000000298023224D) * 15.0D); + + if (f > 0.1F) + { + f = 0.1F; + } + + if (!this.onGround || this.getHealth() <= 0.0F) + { + f = 0.0F; + } + + if (this.onGround || this.getHealth() <= 0.0F) + { + f1 = 0.0F; + } + + this.cameraYaw += (f - this.cameraYaw) * 0.4F; + this.cameraPitch += (f1 - this.cameraPitch) * 0.8F; + + if (this.getHealth() > 0.0F && !this.isSpectator()) + { + AxisAlignedBB axisalignedbb = null; + + if (this.ridingEntity != null && !this.ridingEntity.isDead) + { + axisalignedbb = this.getEntityBoundingBox().union(this.ridingEntity.getEntityBoundingBox()).expand(1.0D, 0.0D, 1.0D); + } + else + { + axisalignedbb = this.getEntityBoundingBox().expand(1.0D, 0.5D, 1.0D); + } + + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, axisalignedbb); + + for (int i = 0; i < list.size(); ++i) + { + Entity entity = (Entity)list.get(i); + + if (!entity.isDead) + { + this.collideWithPlayer(entity); + } + } + } + } + + private void collideWithPlayer(Entity p_71044_1_) + { + p_71044_1_.onCollideWithPlayer(this); + } + + public int getScore() + { + return this.dataWatcher.getWatchableObjectInt(18); + } + + /** + * Set player's score + */ + public void setScore(int p_85040_1_) + { + this.dataWatcher.updateObject(18, Integer.valueOf(p_85040_1_)); + } + + /** + * Add to player's score + */ + public void addScore(int p_85039_1_) + { + int i = this.getScore(); + this.dataWatcher.updateObject(18, Integer.valueOf(i + p_85039_1_)); + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource cause) + { + super.onDeath(cause); + this.setSize(0.2F, 0.2F); + this.setPosition(this.posX, this.posY, this.posZ); + this.motionY = 0.10000000149011612D; + + if (this.getName().equals("Notch")) + { + this.dropItem(new ItemStack(Items.apple, 1), true, false); + } + + if (!this.worldObj.getGameRules().getBoolean("keepInventory")) + { + this.inventory.dropAllItems(); + } + + if (cause != null) + { + this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); + this.motionZ = (double)(-MathHelper.sin((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); + } + else + { + this.motionX = this.motionZ = 0.0D; + } + + this.triggerAchievement(StatList.deathsStat); + this.func_175145_a(StatList.timeSinceDeathStat); + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "game.player.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "game.player.die"; + } + + /** + * Adds a value to the player score. Currently not actually used and the entity passed in does nothing. Args: + * entity, scoreToAdd + */ + public void addToPlayerScore(Entity entityIn, int amount) + { + this.addScore(amount); + Collection collection = this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.totalKillCount); + + if (entityIn instanceof EntityPlayer) + { + this.triggerAchievement(StatList.playerKillsStat); + collection.addAll(this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.playerKillCount)); + collection.addAll(this.func_175137_e(entityIn)); + } + else + { + this.triggerAchievement(StatList.mobKillsStat); + } + + for (ScoreObjective scoreobjective : collection) + { + Score score = this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective); + score.func_96648_a(); + } + } + + private Collection func_175137_e(Entity p_175137_1_) + { + ScorePlayerTeam scoreplayerteam = this.getWorldScoreboard().getPlayersTeam(this.getName()); + + if (scoreplayerteam != null) + { + int i = scoreplayerteam.getChatFormat().getColorIndex(); + + if (i >= 0 && i < IScoreObjectiveCriteria.field_178793_i.length) + { + for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.field_178793_i[i])) + { + Score score = this.getWorldScoreboard().getValueFromObjective(p_175137_1_.getName(), scoreobjective); + score.func_96648_a(); + } + } + } + + ScorePlayerTeam scoreplayerteam1 = this.getWorldScoreboard().getPlayersTeam(p_175137_1_.getName()); + + if (scoreplayerteam1 != null) + { + int j = scoreplayerteam1.getChatFormat().getColorIndex(); + + if (j >= 0 && j < IScoreObjectiveCriteria.field_178792_h.length) + { + return this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.field_178792_h[j]); + } + } + + return Lists.newArrayList(); + } + + /** + * Called when player presses the drop item key + */ + public EntityItem dropOneItem(boolean dropAll) + { + return this.dropItem(this.inventory.decrStackSize(this.inventory.currentItem, dropAll && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1), false, true); + } + + /** + * Args: itemstack, flag + */ + public EntityItem dropPlayerItemWithRandomChoice(ItemStack itemStackIn, boolean unused) + { + return this.dropItem(itemStackIn, false, false); + } + + public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem) + { + if (droppedItem == null) + { + return null; + } + else if (droppedItem.stackSize == 0) + { + return null; + } + else + { + double d0 = this.posY - 0.30000001192092896D + (double)this.getEyeHeight(); + EntityItem entityitem = new EntityItem(this.worldObj, this.posX, d0, this.posZ, droppedItem); + entityitem.setPickupDelay(40); + + if (traceItem) + { + entityitem.setThrower(this.getName()); + } + + if (dropAround) + { + float f = this.rand.nextFloat() * 0.5F; + float f1 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + entityitem.motionX = (double)(-MathHelper.sin(f1) * f); + entityitem.motionZ = (double)(MathHelper.cos(f1) * f); + entityitem.motionY = 0.20000000298023224D; + } + else + { + float f2 = 0.3F; + entityitem.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f2); + entityitem.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f2); + entityitem.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * f2 + 0.1F); + float f3 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + f2 = 0.02F * this.rand.nextFloat(); + entityitem.motionX += Math.cos((double)f3) * (double)f2; + entityitem.motionY += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); + entityitem.motionZ += Math.sin((double)f3) * (double)f2; + } + + this.joinEntityItemWithWorld(entityitem); + + if (traceItem) + { + this.triggerAchievement(StatList.dropStat); + } + + return entityitem; + } + } + + /** + * Joins the passed in entity item with the world. Args: entityItem + */ + protected void joinEntityItemWithWorld(EntityItem itemIn) + { + this.worldObj.spawnEntityInWorld(itemIn); + } + + /** + * Block hardness will be further counted in net/minecraft/block/Block.getPlayerRelativeBlockHardness + */ + public float getToolDigEfficiency(Block p_180471_1_) + { + float f = this.inventory.getStrVsBlock(p_180471_1_); + + if (f > 1.0F) + { + int i = EnchantmentHelper.getEfficiencyModifier(this); + ItemStack itemstack = this.inventory.getCurrentItem(); + + if (i > 0 && itemstack != null) + { + f += (float)(i * i + 1); + } + } + + if (this.isPotionActive(Potion.digSpeed)) + { + f *= 1.0F + (float)(this.getActivePotionEffect(Potion.digSpeed).getAmplifier() + 1) * 0.2F; + } + + if (this.isPotionActive(Potion.digSlowdown)) + { + float f1 = 1.0F; + + switch (this.getActivePotionEffect(Potion.digSlowdown).getAmplifier()) + { + case 0: + f1 = 0.3F; + break; + + case 1: + f1 = 0.09F; + break; + + case 2: + f1 = 0.0027F; + break; + + case 3: + default: + f1 = 8.1E-4F; + } + + f *= f1; + } + + if (this.isInsideOfMaterial(Material.water) && !EnchantmentHelper.getAquaAffinityModifier(this)) + { + f /= 5.0F; + } + + if (!this.onGround) + { + f /= 5.0F; + } + + return f; + } + + /** + * Checks if the player has the ability to harvest a block (checks current inventory item for a tool if necessary) + */ + public boolean canHarvestBlock(Block blockToHarvest) + { + return this.inventory.canHeldItemHarvest(blockToHarvest); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + this.entityUniqueID = getUUID(this.gameProfile); + NBTTagList nbttaglist = tagCompund.getTagList("Inventory", 10); + this.inventory.readFromNBT(nbttaglist); + this.inventory.currentItem = tagCompund.getInteger("SelectedItemSlot"); + this.sleeping = tagCompund.getBoolean("Sleeping"); + this.sleepTimer = tagCompund.getShort("SleepTimer"); + this.experience = tagCompund.getFloat("XpP"); + this.experienceLevel = tagCompund.getInteger("XpLevel"); + this.experienceTotal = tagCompund.getInteger("XpTotal"); + this.xpSeed = tagCompund.getInteger("XpSeed"); + + if (this.xpSeed == 0) + { + this.xpSeed = this.rand.nextInt(); + } + + this.setScore(tagCompund.getInteger("Score")); + + if (this.sleeping) + { + this.playerLocation = new BlockPos(this); + this.wakeUpPlayer(true, true, false); + } + + if (tagCompund.hasKey("SpawnX", 99) && tagCompund.hasKey("SpawnY", 99) && tagCompund.hasKey("SpawnZ", 99)) + { + this.spawnChunk = new BlockPos(tagCompund.getInteger("SpawnX"), tagCompund.getInteger("SpawnY"), tagCompund.getInteger("SpawnZ")); + this.spawnForced = tagCompund.getBoolean("SpawnForced"); + } + + this.foodStats.readNBT(tagCompund); + this.capabilities.readCapabilitiesFromNBT(tagCompund); + + if (tagCompund.hasKey("EnderItems", 9)) + { + NBTTagList nbttaglist1 = tagCompund.getTagList("EnderItems", 10); + this.theInventoryEnderChest.loadInventoryFromNBT(nbttaglist1); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setTag("Inventory", this.inventory.writeToNBT(new NBTTagList())); + tagCompound.setInteger("SelectedItemSlot", this.inventory.currentItem); + tagCompound.setBoolean("Sleeping", this.sleeping); + tagCompound.setShort("SleepTimer", (short)this.sleepTimer); + tagCompound.setFloat("XpP", this.experience); + tagCompound.setInteger("XpLevel", this.experienceLevel); + tagCompound.setInteger("XpTotal", this.experienceTotal); + tagCompound.setInteger("XpSeed", this.xpSeed); + tagCompound.setInteger("Score", this.getScore()); + + if (this.spawnChunk != null) + { + tagCompound.setInteger("SpawnX", this.spawnChunk.getX()); + tagCompound.setInteger("SpawnY", this.spawnChunk.getY()); + tagCompound.setInteger("SpawnZ", this.spawnChunk.getZ()); + tagCompound.setBoolean("SpawnForced", this.spawnForced); + } + + this.foodStats.writeNBT(tagCompound); + this.capabilities.writeCapabilitiesToNBT(tagCompound); + tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); + ItemStack itemstack = this.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.getItem() != null) + { + tagCompound.setTag("SelectedItem", itemstack.writeToNBT(new NBTTagCompound())); + } + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else if (this.capabilities.disableDamage && !source.canHarmInCreative()) + { + return false; + } + else + { + this.entityAge = 0; + + if (this.getHealth() <= 0.0F) + { + return false; + } + else + { + if (this.isPlayerSleeping() && !this.worldObj.isRemote) + { + this.wakeUpPlayer(true, true, false); + } + + if (source.isDifficultyScaled()) + { + if (this.worldObj.getDifficulty() == EnumDifficulty.PEACEFUL) + { + amount = 0.0F; + } + + if (this.worldObj.getDifficulty() == EnumDifficulty.EASY) + { + amount = amount / 2.0F + 1.0F; + } + + if (this.worldObj.getDifficulty() == EnumDifficulty.HARD) + { + amount = amount * 3.0F / 2.0F; + } + } + + if (amount == 0.0F) + { + return false; + } + else + { + Entity entity = source.getEntity(); + + if (entity instanceof EntityArrow && ((EntityArrow)entity).shootingEntity != null) + { + entity = ((EntityArrow)entity).shootingEntity; + } + + return super.attackEntityFrom(source, amount); + } + } + } + } + + public boolean canAttackPlayer(EntityPlayer other) + { + Team team = this.getTeam(); + Team team1 = other.getTeam(); + return team == null ? true : (!team.isSameTeam(team1) ? true : team.getAllowFriendlyFire()); + } + + protected void damageArmor(float p_70675_1_) + { + this.inventory.damageArmor(p_70675_1_); + } + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + return this.inventory.getTotalArmorValue(); + } + + /** + * When searching for vulnerable players, if a player is invisible, the return value of this is the chance of seeing + * them anyway. + */ + public float getArmorVisibility() + { + int i = 0; + + for (ItemStack itemstack : this.inventory.armorInventory) + { + if (itemstack != null) + { + ++i; + } + } + + return (float)i / (float)this.inventory.armorInventory.length; + } + + /** + * Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first and then health + * second with the reduced value. Args: damageAmount + */ + protected void damageEntity(DamageSource damageSrc, float damageAmount) + { + if (!this.isEntityInvulnerable(damageSrc)) + { + if (!damageSrc.isUnblockable() && this.isBlocking() && damageAmount > 0.0F) + { + damageAmount = (1.0F + damageAmount) * 0.5F; + } + + damageAmount = this.applyArmorCalculations(damageSrc, damageAmount); + damageAmount = this.applyPotionDamageCalculations(damageSrc, damageAmount); + float f = damageAmount; + damageAmount = Math.max(damageAmount - this.getAbsorptionAmount(), 0.0F); + this.setAbsorptionAmount(this.getAbsorptionAmount() - (f - damageAmount)); + + if (damageAmount != 0.0F) + { + this.addExhaustion(damageSrc.getHungerDamage()); + float f1 = this.getHealth(); + this.setHealth(this.getHealth() - damageAmount); + this.getCombatTracker().trackDamage(damageSrc, f1, damageAmount); + + if (damageAmount < 3.4028235E37F) + { + this.addStat(StatList.damageTakenStat, Math.round(damageAmount * 10.0F)); + } + } + } + } + + public void openEditSign(TileEntitySign signTile) + { + } + + public void openEditCommandBlock(CommandBlockLogic cmdBlockLogic) + { + } + + public void displayVillagerTradeGui(IMerchant villager) + { + } + + /** + * Displays the GUI for interacting with a chest inventory. Args: chestInventory + */ + public void displayGUIChest(IInventory chestInventory) + { + } + + public void displayGUIHorse(EntityHorse horse, IInventory horseInventory) + { + } + + public void displayGui(IInteractionObject guiOwner) + { + } + + /** + * Displays the GUI for interacting with a book. + */ + public void displayGUIBook(ItemStack bookStack) + { + } + + public boolean interactWith(Entity p_70998_1_) + { + if (this.isSpectator()) + { + if (p_70998_1_ instanceof IInventory) + { + this.displayGUIChest((IInventory)p_70998_1_); + } + + return false; + } + else + { + ItemStack itemstack = this.getCurrentEquippedItem(); + ItemStack itemstack1 = itemstack != null ? itemstack.copy() : null; + + if (!p_70998_1_.interactFirst(this)) + { + if (itemstack != null && p_70998_1_ instanceof EntityLivingBase) + { + if (this.capabilities.isCreativeMode) + { + itemstack = itemstack1; + } + + if (itemstack.interactWithEntity(this, (EntityLivingBase)p_70998_1_)) + { + if (itemstack.stackSize <= 0 && !this.capabilities.isCreativeMode) + { + this.destroyCurrentEquippedItem(); + } + + return true; + } + } + + return false; + } + else + { + if (itemstack != null && itemstack == this.getCurrentEquippedItem()) + { + if (itemstack.stackSize <= 0 && !this.capabilities.isCreativeMode) + { + this.destroyCurrentEquippedItem(); + } + else if (itemstack.stackSize < itemstack1.stackSize && this.capabilities.isCreativeMode) + { + itemstack.stackSize = itemstack1.stackSize; + } + } + + return true; + } + } + } + + /** + * Returns the currently being used item by the player. + */ + public ItemStack getCurrentEquippedItem() + { + return this.inventory.getCurrentItem(); + } + + /** + * Destroys the currently equipped item from the player's inventory. + */ + public void destroyCurrentEquippedItem() + { + this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null); + } + + /** + * Returns the Y Offset of this entity. + */ + public double getYOffset() + { + return -0.35D; + } + + /** + * Attacks for the player the targeted entity with the currently equipped item. The equipped item has hitEntity + * called on it. Args: targetEntity + */ + public void attackTargetEntityWithCurrentItem(Entity targetEntity) + { + + if(Booleans.MoreParticles) { + if (targetEntity.canAttackWithItem()) + { + if (!targetEntity.hitByEntity(this)) + { + float f = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); + int i = 0; + float f1 = 0.0F; + + this.onCriticalHit(targetEntity); + this.onEnchantmentCritical(targetEntity); + + if (targetEntity instanceof EntityLivingBase) + { + f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(), ((EntityLivingBase)targetEntity).getCreatureAttribute()); + } + else + { + f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(), EnumCreatureAttribute.UNDEFINED); + } + + i = i + EnchantmentHelper.getKnockbackModifier(this); + + if (this.isSprinting()) + { + ++i; + } + + if (f > 0.0F || f1 > 0.0F) + { + boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInWater() && !this.isPotionActive(Potion.blindness) && this.ridingEntity == null && targetEntity instanceof EntityLivingBase; + + if (flag && f > 0.0F) + { + f *= 1.5F; + } + + f = f + f1; + boolean flag1 = false; + int j = EnchantmentHelper.getFireAspectModifier(this); + + if (targetEntity instanceof EntityLivingBase && j > 0 && !targetEntity.isBurning()) + { + flag1 = true; + targetEntity.setFire(1); + } + + double d0 = targetEntity.motionX; + double d1 = targetEntity.motionY; + double d2 = targetEntity.motionZ; + boolean flag2 = targetEntity.attackEntityFrom(DamageSource.causePlayerDamage(this), f); + + if (flag2) + { + if (i > 0) + { + targetEntity.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F)); + this.motionX *= 0.6D; + this.motionZ *= 0.6D; + this.setSprinting(false); + } + + if (targetEntity instanceof EntityPlayerMP && targetEntity.velocityChanged) + { + ((EntityPlayerMP)targetEntity).playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(targetEntity)); + targetEntity.velocityChanged = false; + targetEntity.motionX = d0; + targetEntity.motionY = d1; + targetEntity.motionZ = d2; + } + + if (flag) + { + this.onCriticalHit(targetEntity); + } + + if (f1 > 0.0F) + { + this.onEnchantmentCritical(targetEntity); + } + + if (f >= 18.0F) + { + this.triggerAchievement(AchievementList.overkill); + } + + this.setLastAttacker(targetEntity); + + if (targetEntity instanceof EntityLivingBase) + { + EnchantmentHelper.applyThornEnchantments((EntityLivingBase)targetEntity, this); + } + + EnchantmentHelper.applyArthropodEnchantments(this, targetEntity); + ItemStack itemstack = this.getCurrentEquippedItem(); + Entity entity = targetEntity; + + if (targetEntity instanceof EntityDragonPart) + { + IEntityMultiPart ientitymultipart = ((EntityDragonPart)targetEntity).entityDragonObj; + + if (ientitymultipart instanceof EntityLivingBase) + { + entity = (EntityLivingBase)ientitymultipart; + } + } + + if (itemstack != null && entity instanceof EntityLivingBase) + { + itemstack.hitEntity((EntityLivingBase)entity, this); + + if (itemstack.stackSize <= 0) + { + this.destroyCurrentEquippedItem(); + } + } + + if (targetEntity instanceof EntityLivingBase) + { + this.addStat(StatList.damageDealtStat, Math.round(f * 10.0F)); + + if (j > 0) + { + targetEntity.setFire(j * 4); + } + } + + this.addExhaustion(0.3F); + } + else if (flag1) + { + targetEntity.extinguish(); + } + } + } + } + } else { + + if (targetEntity.canAttackWithItem()) + { + if (!targetEntity.hitByEntity(this)) + { + float f = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); + int i = 0; + float f1 = 0.0F; + + if (targetEntity instanceof EntityLivingBase) + { + f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(), ((EntityLivingBase)targetEntity).getCreatureAttribute()); + } + else + { + f1 = EnchantmentHelper.func_152377_a(this.getHeldItem(), EnumCreatureAttribute.UNDEFINED); + } + + i = i + EnchantmentHelper.getKnockbackModifier(this); + + if (this.isSprinting()) + { + ++i; + } + + if (f > 0.0F || f1 > 0.0F) + { + boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInWater() && !this.isPotionActive(Potion.blindness) && this.ridingEntity == null && targetEntity instanceof EntityLivingBase; + + if (flag && f > 0.0F) + { + f *= 1.5F; + } + + f = f + f1; + boolean flag1 = false; + int j = EnchantmentHelper.getFireAspectModifier(this); + + if (targetEntity instanceof EntityLivingBase && j > 0 && !targetEntity.isBurning()) + { + flag1 = true; + targetEntity.setFire(1); + } + + double d0 = targetEntity.motionX; + double d1 = targetEntity.motionY; + double d2 = targetEntity.motionZ; + boolean flag2 = targetEntity.attackEntityFrom(DamageSource.causePlayerDamage(this), f); + + if (flag2) + { + if (i > 0) + { + targetEntity.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F)); + this.motionX *= 0.6D; + this.motionZ *= 0.6D; + this.setSprinting(false); + } + + if (targetEntity instanceof EntityPlayerMP && targetEntity.velocityChanged) + { + ((EntityPlayerMP)targetEntity).playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(targetEntity)); + targetEntity.velocityChanged = false; + targetEntity.motionX = d0; + targetEntity.motionY = d1; + targetEntity.motionZ = d2; + } + + if (flag) + { + this.onCriticalHit(targetEntity); + } + + if (f1 > 0.0F) + { + this.onEnchantmentCritical(targetEntity); + } + + if (f >= 18.0F) + { + this.triggerAchievement(AchievementList.overkill); + } + + this.setLastAttacker(targetEntity); + + if (targetEntity instanceof EntityLivingBase) + { + EnchantmentHelper.applyThornEnchantments((EntityLivingBase)targetEntity, this); + } + + EnchantmentHelper.applyArthropodEnchantments(this, targetEntity); + ItemStack itemstack = this.getCurrentEquippedItem(); + Entity entity = targetEntity; + + if (targetEntity instanceof EntityDragonPart) + { + IEntityMultiPart ientitymultipart = ((EntityDragonPart)targetEntity).entityDragonObj; + + if (ientitymultipart instanceof EntityLivingBase) + { + entity = (EntityLivingBase)ientitymultipart; + } + } + + if (itemstack != null && entity instanceof EntityLivingBase) + { + itemstack.hitEntity((EntityLivingBase)entity, this); + + if (itemstack.stackSize <= 0) + { + this.destroyCurrentEquippedItem(); + } + } + + if (targetEntity instanceof EntityLivingBase) + { + this.addStat(StatList.damageDealtStat, Math.round(f * 10.0F)); + + if (j > 0) + { + targetEntity.setFire(j * 4); + } + } + + this.addExhaustion(0.3F); + } + else if (flag1) + { + targetEntity.extinguish(); + } + } + } + } + } + } + + /** + * Called when the player performs a critical hit on the Entity. Args: entity that was hit critically + */ + public void onCriticalHit(Entity entityHit) + { + } + + public void onEnchantmentCritical(Entity entityHit) + { + } + + public void respawnPlayer() + { + } + + /** + * Will get destroyed next tick. + */ + public void setDead() + { + super.setDead(); + this.inventoryContainer.onContainerClosed(this); + + if (this.openContainer != null) + { + this.openContainer.onContainerClosed(this); + } + } + + /** + * Checks if this entity is inside of an opaque block + */ + public boolean isEntityInsideOpaqueBlock() + { + return !this.sleeping && super.isEntityInsideOpaqueBlock(); + } + + /** + * returns true if this is an EntityPlayerSP, or the logged in player. + */ + public boolean isUser() + { + return false; + } + + /** + * Returns the GameProfile for this player + */ + public GameProfile getGameProfile() + { + return this.gameProfile; + } + + public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) + { + if (!this.worldObj.isRemote) + { + if (this.isPlayerSleeping() || !this.isEntityAlive()) + { + return EntityPlayer.EnumStatus.OTHER_PROBLEM; + } + + if (!this.worldObj.provider.isSurfaceWorld()) + { + return EntityPlayer.EnumStatus.NOT_POSSIBLE_HERE; + } + + if (this.worldObj.isDaytime()) + { + return EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW; + } + + if (Math.abs(this.posX - (double)bedLocation.getX()) > 3.0D || Math.abs(this.posY - (double)bedLocation.getY()) > 2.0D || Math.abs(this.posZ - (double)bedLocation.getZ()) > 3.0D) + { + return EntityPlayer.EnumStatus.TOO_FAR_AWAY; + } + + double d0 = 8.0D; + double d1 = 5.0D; + List list = this.worldObj.getEntitiesWithinAABB(EntityMob.class, new AxisAlignedBB((double)bedLocation.getX() - d0, (double)bedLocation.getY() - d1, (double)bedLocation.getZ() - d0, (double)bedLocation.getX() + d0, (double)bedLocation.getY() + d1, (double)bedLocation.getZ() + d0)); + + if (!list.isEmpty()) + { + return EntityPlayer.EnumStatus.NOT_SAFE; + } + } + + if (this.isRiding()) + { + this.mountEntity((Entity)null); + } + + this.setSize(0.2F, 0.2F); + + if (this.worldObj.isBlockLoaded(bedLocation)) + { + EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(bedLocation).getValue(BlockDirectional.FACING); + float f = 0.5F; + float f1 = 0.5F; + + switch (enumfacing) + { + case SOUTH: + f1 = 0.9F; + break; + + case NORTH: + f1 = 0.1F; + break; + + case WEST: + f = 0.1F; + break; + + case EAST: + f = 0.9F; + } + + this.func_175139_a(enumfacing); + this.setPosition((double)((float)bedLocation.getX() + f), (double)((float)bedLocation.getY() + 0.6875F), (double)((float)bedLocation.getZ() + f1)); + } + else + { + this.setPosition((double)((float)bedLocation.getX() + 0.5F), (double)((float)bedLocation.getY() + 0.6875F), (double)((float)bedLocation.getZ() + 0.5F)); + } + + this.sleeping = true; + this.sleepTimer = 0; + this.playerLocation = bedLocation; + this.motionX = this.motionZ = this.motionY = 0.0D; + + if (!this.worldObj.isRemote) + { + this.worldObj.updateAllPlayersSleepingFlag(); + } + + return EntityPlayer.EnumStatus.OK; + } + + private void func_175139_a(EnumFacing p_175139_1_) + { + this.renderOffsetX = 0.0F; + this.renderOffsetZ = 0.0F; + + switch (p_175139_1_) + { + case SOUTH: + this.renderOffsetZ = -1.8F; + break; + + case NORTH: + this.renderOffsetZ = 1.8F; + break; + + case WEST: + this.renderOffsetX = 1.8F; + break; + + case EAST: + this.renderOffsetX = -1.8F; + } + } + + /** + * Wake up the player if they're sleeping. + */ + public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) + { + this.setSize(0.6F, 1.8F); + IBlockState iblockstate = this.worldObj.getBlockState(this.playerLocation); + + if (this.playerLocation != null && iblockstate.getBlock() == Blocks.bed) + { + this.worldObj.setBlockState(this.playerLocation, iblockstate.withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)), 4); + BlockPos blockpos = BlockBed.getSafeExitLocation(this.worldObj, this.playerLocation, 0); + + if (blockpos == null) + { + blockpos = this.playerLocation.up(); + } + + this.setPosition((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.1F), (double)((float)blockpos.getZ() + 0.5F)); + } + + this.sleeping = false; + + if (!this.worldObj.isRemote && updateWorldFlag) + { + this.worldObj.updateAllPlayersSleepingFlag(); + } + + this.sleepTimer = p_70999_1_ ? 0 : 100; + + if (setSpawn) + { + this.setSpawnPoint(this.playerLocation, false); + } + } + + private boolean isInBed() + { + return this.worldObj.getBlockState(this.playerLocation).getBlock() == Blocks.bed; + } + + /** + * Return null if bed is invalid + */ + public static BlockPos getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn) + { + Block block = worldIn.getBlockState(bedLocation).getBlock(); + + if (block != Blocks.bed) + { + if (!forceSpawn) + { + return null; + } + else + { + boolean flag = block.func_181623_g(); + boolean flag1 = worldIn.getBlockState(bedLocation.up()).getBlock().func_181623_g(); + return flag && flag1 ? bedLocation : null; + } + } + else + { + return BlockBed.getSafeExitLocation(worldIn, bedLocation, 0); + } + } + + /** + * Returns the orientation of the bed in degrees. + */ + public float getBedOrientationInDegrees() + { + if (this.playerLocation != null) + { + EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING); + + switch (enumfacing) + { + case SOUTH: + return 90.0F; + + case NORTH: + return 270.0F; + + case WEST: + return 0.0F; + + case EAST: + return 180.0F; + } + } + + return 0.0F; + } + + /** + * Returns whether player is sleeping or not + */ + public boolean isPlayerSleeping() + { + return this.sleeping; + } + + /** + * Returns whether or not the player is asleep and the screen has fully faded. + */ + public boolean isPlayerFullyAsleep() + { + return this.sleeping && this.sleepTimer >= 100; + } + + public int getSleepTimer() + { + return this.sleepTimer; + } + + public void addChatComponentMessage(IChatComponent chatComponent) + { + } + + public BlockPos getBedLocation() + { + return this.spawnChunk; + } + + public boolean isSpawnForced() + { + return this.spawnForced; + } + + public void setSpawnPoint(BlockPos pos, boolean forced) + { + if (pos != null) + { + this.spawnChunk = pos; + this.spawnForced = forced; + } + else + { + this.spawnChunk = null; + this.spawnForced = false; + } + } + + /** + * Will trigger the specified trigger. + */ + public void triggerAchievement(StatBase achievementIn) + { + this.addStat(achievementIn, 1); + } + + /** + * Adds a value to a statistic field. + */ + public void addStat(StatBase stat, int amount) + { + } + + public void func_175145_a(StatBase p_175145_1_) + { + } + + /** + * Causes this entity to do an upwards motion (jumping). + */ + public void jump() + { + super.jump(); + this.triggerAchievement(StatList.jumpStat); + + if (this.isSprinting()) + { + this.addExhaustion(0.8F); + } + else + { + this.addExhaustion(0.2F); + } + } + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float strafe, float forward) + { + double d0 = this.posX; + double d1 = this.posY; + double d2 = this.posZ; + + if (this.capabilities.isFlying && this.ridingEntity == null) + { + double d3 = this.motionY; + float f = this.jumpMovementFactor; + this.jumpMovementFactor = this.capabilities.getFlySpeed() * (float)(this.isSprinting() ? 2 : 1); + super.moveEntityWithHeading(strafe, forward); + this.motionY = d3 * 0.6D; + this.jumpMovementFactor = f; + } + else + { + super.moveEntityWithHeading(strafe, forward); + } + + this.addMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2); + } + + /** + * the movespeed used for the new AI system + */ + public float getAIMoveSpeed() + { + return (float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(); + } + + /** + * Adds a value to a movement statistic field - like run, walk, swin or climb. + */ + public void addMovementStat(double p_71000_1_, double p_71000_3_, double p_71000_5_) + { + if (this.ridingEntity == null) + { + if (this.isInsideOfMaterial(Material.water)) + { + int i = Math.round(MathHelper.sqrt_double(p_71000_1_ * p_71000_1_ + p_71000_3_ * p_71000_3_ + p_71000_5_ * p_71000_5_) * 100.0F); + + if (i > 0) + { + this.addStat(StatList.distanceDoveStat, i); + this.addExhaustion(0.015F * (float)i * 0.01F); + } + } + else if (this.isInWater()) + { + int j = Math.round(MathHelper.sqrt_double(p_71000_1_ * p_71000_1_ + p_71000_5_ * p_71000_5_) * 100.0F); + + if (j > 0) + { + this.addStat(StatList.distanceSwumStat, j); + this.addExhaustion(0.015F * (float)j * 0.01F); + } + } + else if (this.isOnLadder()) + { + if (p_71000_3_ > 0.0D) + { + this.addStat(StatList.distanceClimbedStat, (int)Math.round(p_71000_3_ * 100.0D)); + } + } + else if (this.onGround) + { + int k = Math.round(MathHelper.sqrt_double(p_71000_1_ * p_71000_1_ + p_71000_5_ * p_71000_5_) * 100.0F); + + if (k > 0) + { + this.addStat(StatList.distanceWalkedStat, k); + + if (this.isSprinting()) + { + this.addStat(StatList.distanceSprintedStat, k); + this.addExhaustion(0.099999994F * (float)k * 0.01F); + } + else + { + if (this.isSneaking()) + { + this.addStat(StatList.distanceCrouchedStat, k); + } + + this.addExhaustion(0.01F * (float)k * 0.01F); + } + } + } + else + { + int l = Math.round(MathHelper.sqrt_double(p_71000_1_ * p_71000_1_ + p_71000_5_ * p_71000_5_) * 100.0F); + + if (l > 25) + { + this.addStat(StatList.distanceFlownStat, l); + } + } + } + } + + /** + * Adds a value to a mounted movement statistic field - by minecart, boat, or pig. + */ + private void addMountedMovementStat(double p_71015_1_, double p_71015_3_, double p_71015_5_) + { + if (this.ridingEntity != null) + { + int i = Math.round(MathHelper.sqrt_double(p_71015_1_ * p_71015_1_ + p_71015_3_ * p_71015_3_ + p_71015_5_ * p_71015_5_) * 100.0F); + + if (i > 0) + { + if (this.ridingEntity instanceof EntityMinecart) + { + this.addStat(StatList.distanceByMinecartStat, i); + + if (this.startMinecartRidingCoordinate == null) + { + this.startMinecartRidingCoordinate = new BlockPos(this); + } + else if (this.startMinecartRidingCoordinate.distanceSq((double)MathHelper.floor_double(this.posX), (double)MathHelper.floor_double(this.posY), (double)MathHelper.floor_double(this.posZ)) >= 1000000.0D) + { + this.triggerAchievement(AchievementList.onARail); + } + } + else if (this.ridingEntity instanceof EntityBoat) + { + this.addStat(StatList.distanceByBoatStat, i); + } + else if (this.ridingEntity instanceof EntityPig) + { + this.addStat(StatList.distanceByPigStat, i); + } + else if (this.ridingEntity instanceof EntityHorse) + { + this.addStat(StatList.distanceByHorseStat, i); + } + } + } + } + + public void fall(float distance, float damageMultiplier) + { + if (!this.capabilities.allowFlying) + { + if (distance >= 2.0F) + { + this.addStat(StatList.distanceFallenStat, (int)Math.round((double)distance * 100.0D)); + } + + super.fall(distance, damageMultiplier); + } + } + + /** + * sets the players height back to normal after doing things like sleeping and dieing + */ + protected void resetHeight() + { + if (!this.isSpectator()) + { + super.resetHeight(); + } + } + + protected String getFallSoundString(int damageValue) + { + return damageValue > 4 ? "game.player.hurt.fall.big" : "game.player.hurt.fall.small"; + } + + /** + * This method gets called when the entity kills another one. + */ + public void onKillEntity(EntityLivingBase entityLivingIn) + { + if (entityLivingIn instanceof IMob) + { + this.triggerAchievement(AchievementList.killEnemy); + } + + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entityLivingIn))); + + if (entitylist$entityegginfo != null) + { + this.triggerAchievement(entitylist$entityegginfo.field_151512_d); + } + } + + /** + * Sets the Entity inside a web block. + */ + public void setInWeb() + { + if (!this.capabilities.isFlying) + { + super.setInWeb(); + } + } + + public ItemStack getCurrentArmor(int slotIn) + { + return this.inventory.armorItemInSlot(slotIn); + } + + /** + * Add experience points to player. + */ + public void addExperience(int amount) + { + this.addScore(amount); + int i = Integer.MAX_VALUE - this.experienceTotal; + + if (amount > i) + { + amount = i; + } + + this.experience += (float)amount / (float)this.xpBarCap(); + + for (this.experienceTotal += amount; this.experience >= 1.0F; this.experience /= (float)this.xpBarCap()) + { + this.experience = (this.experience - 1.0F) * (float)this.xpBarCap(); + this.addExperienceLevel(1); + } + } + + public int getXPSeed() + { + return this.xpSeed; + } + + public void removeExperienceLevel(int levels) + { + this.experienceLevel -= levels; + + if (this.experienceLevel < 0) + { + this.experienceLevel = 0; + this.experience = 0.0F; + this.experienceTotal = 0; + } + + this.xpSeed = this.rand.nextInt(); + } + + /** + * Add experience levels to this player. + */ + public void addExperienceLevel(int levels) + { + this.experienceLevel += levels; + + if (this.experienceLevel < 0) + { + this.experienceLevel = 0; + this.experience = 0.0F; + this.experienceTotal = 0; + } + + if (levels > 0 && this.experienceLevel % 5 == 0 && (float)this.lastXPSound < (float)this.ticksExisted - 100.0F) + { + float f = this.experienceLevel > 30 ? 1.0F : (float)this.experienceLevel / 30.0F; + this.worldObj.playSoundAtEntity(this, "random.levelup", f * 0.75F, 1.0F); + this.lastXPSound = this.ticksExisted; + } + } + + /** + * This method returns the cap amount of experience that the experience bar can hold. With each level, the + * experience cap on the player's experience bar is raised by 10. + */ + public int xpBarCap() + { + return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); + } + + /** + * increases exhaustion level by supplied amount + */ + public void addExhaustion(float p_71020_1_) + { + if (!this.capabilities.disableDamage) + { + if (!this.worldObj.isRemote) + { + this.foodStats.addExhaustion(p_71020_1_); + } + } + } + + /** + * Returns the player's FoodStats object. + */ + public FoodStats getFoodStats() + { + return this.foodStats; + } + + public boolean canEat(boolean ignoreHunger) + { + return (ignoreHunger || this.foodStats.needFood()) && !this.capabilities.disableDamage; + } + + /** + * Checks if the player's health is not full and not zero. + */ + public boolean shouldHeal() + { + return this.getHealth() > 0.0F && this.getHealth() < this.getMaxHealth(); + } + + /** + * sets the itemInUse when the use item button is clicked. Args: itemstack, int maxItemUseDuration + */ + public void setItemInUse(ItemStack stack, int duration) + { + if (stack != this.itemInUse) + { + this.itemInUse = stack; + this.itemInUseCount = duration; + + if (!this.worldObj.isRemote) + { + this.setEating(true); + } + } + } + + public boolean isAllowEdit() + { + return this.capabilities.allowEdit; + } + + public boolean canPlayerEdit(BlockPos p_175151_1_, EnumFacing p_175151_2_, ItemStack p_175151_3_) + { + if (this.capabilities.allowEdit) + { + return true; + } + else if (p_175151_3_ == null) + { + return false; + } + else + { + BlockPos blockpos = p_175151_1_.offset(p_175151_2_.getOpposite()); + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + return p_175151_3_.canPlaceOn(block) || p_175151_3_.canEditBlocks(); + } + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer player) + { + if (this.worldObj.getGameRules().getBoolean("keepInventory")) + { + return 0; + } + else + { + int i = this.experienceLevel * 7; + return i > 100 ? 100 : i; + } + } + + /** + * Only use is to identify if class is an instance of player for experience dropping + */ + protected boolean isPlayer() + { + return true; + } + + public boolean getAlwaysRenderNameTagForRender() + { + return true; + } + + /** + * Copies the values from the given player into this player if boolean par2 is true. Always clones Ender Chest + * Inventory. + */ + public void clonePlayer(EntityPlayer oldPlayer, boolean respawnFromEnd) + { + if (respawnFromEnd) + { + this.inventory.copyInventory(oldPlayer.inventory); + this.setHealth(oldPlayer.getHealth()); + this.foodStats = oldPlayer.foodStats; + this.experienceLevel = oldPlayer.experienceLevel; + this.experienceTotal = oldPlayer.experienceTotal; + this.experience = oldPlayer.experience; + this.setScore(oldPlayer.getScore()); + this.field_181016_an = oldPlayer.field_181016_an; + this.field_181017_ao = oldPlayer.field_181017_ao; + this.field_181018_ap = oldPlayer.field_181018_ap; + } + else if (this.worldObj.getGameRules().getBoolean("keepInventory")) + { + this.inventory.copyInventory(oldPlayer.inventory); + this.experienceLevel = oldPlayer.experienceLevel; + this.experienceTotal = oldPlayer.experienceTotal; + this.experience = oldPlayer.experience; + this.setScore(oldPlayer.getScore()); + } + + this.xpSeed = oldPlayer.xpSeed; + this.theInventoryEnderChest = oldPlayer.theInventoryEnderChest; + this.getDataWatcher().updateObject(10, Byte.valueOf(oldPlayer.getDataWatcher().getWatchableObjectByte(10))); + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return !this.capabilities.isFlying; + } + + /** + * Sends the player's abilities to the server (if there is one). + */ + public void sendPlayerAbilities() + { + } + + /** + * Sets the player's game mode and sends it to them. + */ + public void setGameType(WorldSettings.GameType gameType) + { + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.gameProfile.getName(); + } + + /** + * Returns the InventoryEnderChest of this player. + */ + public InventoryEnderChest getInventoryEnderChest() + { + return this.theInventoryEnderChest; + } + + /** + * 0: Tool in Hand; 1-4: Armor + */ + public ItemStack getEquipmentInSlot(int slotIn) + { + return slotIn == 0 ? this.inventory.getCurrentItem() : this.inventory.armorInventory[slotIn - 1]; + } + + /** + * Returns the item that this EntityLiving is holding, if any. + */ + public ItemStack getHeldItem() + { + return this.inventory.getCurrentItem(); + } + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public void setCurrentItemOrArmor(int slotIn, ItemStack stack) + { + this.inventory.armorInventory[slotIn] = stack; + } + + /** + * Only used by renderer in EntityLivingBase subclasses. + * Determines if an entity is visible or not to a specfic player, if the entity is normally invisible. + * For EntityLivingBase subclasses, returning false when invisible will render the entity semitransparent. + */ + public boolean isInvisibleToPlayer(EntityPlayer player) + { + if (!this.isInvisible()) + { + return false; + } + else if (player.isSpectator()) + { + return false; + } + else + { + Team team = this.getTeam(); + return team == null || player == null || player.getTeam() != team || !team.getSeeFriendlyInvisiblesEnabled(); + } + } + + /** + * Returns true if the player is in spectator mode. + */ + public abstract boolean isSpectator(); + + /** + * returns the inventory of this entity (only used in EntityPlayerMP it seems) + */ + public ItemStack[] getInventory() + { + return this.inventory.armorInventory; + } + + public boolean isPushedByWater() + { + return !this.capabilities.isFlying; + } + + public Scoreboard getWorldScoreboard() + { + return this.worldObj.getScoreboard(); + } + + public Team getTeam() + { + return this.getWorldScoreboard().getPlayersTeam(this.getName()); + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + IChatComponent ichatcomponent = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getName())); + ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); + ichatcomponent.getChatStyle().setChatHoverEvent(this.getHoverEvent()); + ichatcomponent.getChatStyle().setInsertion(this.getName()); + return ichatcomponent; + } + + public float getEyeHeight() + { + float f = 1.62F; + + if (this.isPlayerSleeping()) + { + f = 0.2F; + } + + if (this.isSneaking()) + { + f -= 0.08F; + } + + return f; + } + + public void setAbsorptionAmount(float amount) + { + if (amount < 0.0F) + { + amount = 0.0F; + } + + this.getDataWatcher().updateObject(17, Float.valueOf(amount)); + } + + public float getAbsorptionAmount() + { + return this.getDataWatcher().getWatchableObjectFloat(17); + } + + /** + * Gets a players UUID given their GameProfie + */ + public static UUID getUUID(GameProfile profile) + { + UUID uuid = profile.getId(); + + if (uuid == null) + { + uuid = getOfflineUUID(profile.getName()); + } + + return uuid; + } + + public static UUID getOfflineUUID(String username) + { + return UUID.nameUUIDFromBytes(("OfflinePlayer:" + username).getBytes(Charsets.UTF_8)); + } + + /** + * Check whether this player can open an inventory locked with the given LockCode. + */ + public boolean canOpen(LockCode code) + { + if (code.isEmpty()) + { + return true; + } + else + { + ItemStack itemstack = this.getCurrentEquippedItem(); + return itemstack != null && itemstack.hasDisplayName() ? itemstack.getDisplayName().equals(code.getLock()) : false; + } + } + + public boolean isWearing(EnumPlayerModelParts p_175148_1_) + { + return (this.getDataWatcher().getWatchableObjectByte(10) & p_175148_1_.getPartMask()) == p_175148_1_.getPartMask(); + } + + /** + * Returns true if the command sender should be sent feedback about executed commands + */ + public boolean sendCommandFeedback() + { + return MinecraftServer.getServer().worldServers[0].getGameRules().getBoolean("sendCommandFeedback"); + } + + public boolean replaceItemInInventory(int inventorySlot, ItemStack itemStackIn) + { + if (inventorySlot >= 0 && inventorySlot < this.inventory.mainInventory.length) + { + this.inventory.setInventorySlotContents(inventorySlot, itemStackIn); + return true; + } + else + { + int i = inventorySlot - 100; + + if (i >= 0 && i < this.inventory.armorInventory.length) + { + int k = i + 1; + + if (itemStackIn != null && itemStackIn.getItem() != null) + { + if (itemStackIn.getItem() instanceof ItemArmor) + { + if (EntityLiving.getArmorPosition(itemStackIn) != k) + { + return false; + } + } + else if (k != 4 || itemStackIn.getItem() != Items.skull && !(itemStackIn.getItem() instanceof ItemBlock)) + { + return false; + } + } + + this.inventory.setInventorySlotContents(i + this.inventory.mainInventory.length, itemStackIn); + return true; + } + else + { + int j = inventorySlot - 200; + + if (j >= 0 && j < this.theInventoryEnderChest.getSizeInventory()) + { + this.theInventoryEnderChest.setInventorySlotContents(j, itemStackIn); + return true; + } + else + { + return false; + } + } + } + } + + /** + * Whether the "reducedDebugInfo" option is active for this player. + */ + public boolean hasReducedDebug() + { + return this.hasReducedDebug; + } + + public void setReducedDebug(boolean reducedDebug) + { + this.hasReducedDebug = reducedDebug; + } + + public static enum EnumChatVisibility + { + FULL(0, "options.chat.visibility.full"), + SYSTEM(1, "options.chat.visibility.system"), + HIDDEN(2, "options.chat.visibility.hidden"); + + private static final EntityPlayer.EnumChatVisibility[] ID_LOOKUP = new EntityPlayer.EnumChatVisibility[values().length]; + private final int chatVisibility; + private final String resourceKey; + + private EnumChatVisibility(int id, String resourceKey) + { + this.chatVisibility = id; + this.resourceKey = resourceKey; + } + + public int getChatVisibility() + { + return this.chatVisibility; + } + + public static EntityPlayer.EnumChatVisibility getEnumChatVisibility(int id) + { + return ID_LOOKUP[id % ID_LOOKUP.length]; + } + + public String getResourceKey() + { + return this.resourceKey; + } + + static { + for (EntityPlayer.EnumChatVisibility entityplayer$enumchatvisibility : values()) + { + ID_LOOKUP[entityplayer$enumchatvisibility.chatVisibility] = entityplayer$enumchatvisibility; + } + } + } + + public static enum EnumStatus + { + OK, + NOT_POSSIBLE_HERE, + NOT_POSSIBLE_NOW, + TOO_FAR_AWAY, + OTHER_PROBLEM, + NOT_SAFE; + } +} diff --git a/src/minecraft/net/minecraft/entity/player/EntityPlayerMP.java b/src/minecraft/net/minecraft/entity/player/EntityPlayerMP.java new file mode 100644 index 0000000..bca38bc --- /dev/null +++ b/src/minecraft/net/minecraft/entity/player/EntityPlayerMP.java @@ -0,0 +1,1297 @@ +package net.minecraft.entity.player; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import com.mojang.authlib.GameProfile; +import io.netty.buffer.Unpooled; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFence; +import net.minecraft.block.BlockFenceGate; +import net.minecraft.block.BlockWall; +import net.minecraft.block.material.Material; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IMerchant; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.ContainerHorseInventory; +import net.minecraft.inventory.ContainerMerchant; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.SlotCrafting; +import net.minecraft.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemMapBase; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetHandlerPlayServer; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.client.C15PacketClientSettings; +import net.minecraft.network.play.server.S02PacketChat; +import net.minecraft.network.play.server.S06PacketUpdateHealth; +import net.minecraft.network.play.server.S0APacketUseBed; +import net.minecraft.network.play.server.S0BPacketAnimation; +import net.minecraft.network.play.server.S13PacketDestroyEntities; +import net.minecraft.network.play.server.S19PacketEntityStatus; +import net.minecraft.network.play.server.S1BPacketEntityAttach; +import net.minecraft.network.play.server.S1DPacketEntityEffect; +import net.minecraft.network.play.server.S1EPacketRemoveEntityEffect; +import net.minecraft.network.play.server.S1FPacketSetExperience; +import net.minecraft.network.play.server.S21PacketChunkData; +import net.minecraft.network.play.server.S26PacketMapChunkBulk; +import net.minecraft.network.play.server.S29PacketSoundEffect; +import net.minecraft.network.play.server.S2BPacketChangeGameState; +import net.minecraft.network.play.server.S2DPacketOpenWindow; +import net.minecraft.network.play.server.S2EPacketCloseWindow; +import net.minecraft.network.play.server.S2FPacketSetSlot; +import net.minecraft.network.play.server.S30PacketWindowItems; +import net.minecraft.network.play.server.S31PacketWindowProperty; +import net.minecraft.network.play.server.S36PacketSignEditorOpen; +import net.minecraft.network.play.server.S39PacketPlayerAbilities; +import net.minecraft.network.play.server.S3FPacketCustomPayload; +import net.minecraft.network.play.server.S42PacketCombatEvent; +import net.minecraft.network.play.server.S43PacketCamera; +import net.minecraft.network.play.server.S48PacketResourcePackSend; +import net.minecraft.potion.PotionEffect; +import net.minecraft.scoreboard.IScoreObjectiveCriteria; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.Team; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.management.ItemInWorldManager; +import net.minecraft.server.management.UserListOpsEntry; +import net.minecraft.stats.AchievementList; +import net.minecraft.stats.StatBase; +import net.minecraft.stats.StatList; +import net.minecraft.stats.StatisticsFile; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSource; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.JsonSerializableSet; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ReportedException; +import net.minecraft.village.MerchantRecipeList; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.IInteractionObject; +import net.minecraft.world.ILockableContainer; +import net.minecraft.world.WorldServer; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class EntityPlayerMP extends EntityPlayer implements ICrafting +{ + private static final Logger logger = LogManager.getLogger(); + private String translator = "en_US"; + + /** + * The NetServerHandler assigned to this player by the ServerConfigurationManager. + */ + public NetHandlerPlayServer playerNetServerHandler; + + /** Reference to the MinecraftServer object. */ + public final MinecraftServer mcServer; + + /** The ItemInWorldManager belonging to this player */ + public final ItemInWorldManager theItemInWorldManager; + + /** player X position as seen by PlayerManager */ + public double managedPosX; + + /** player Z position as seen by PlayerManager */ + public double managedPosZ; + public final List loadedChunks = Lists.newLinkedList(); + private final List destroyedItemsNetCache = Lists.newLinkedList(); + private final StatisticsFile statsFile; + + /** + * the total health of the player, includes actual health and absorption health. Updated every tick. + */ + private float combinedHealth = Float.MIN_VALUE; + + /** amount of health the client was last set to */ + private float lastHealth = -1.0E8F; + + /** set to foodStats.GetFoodLevel */ + private int lastFoodLevel = -99999999; + + /** set to foodStats.getSaturationLevel() == 0.0F each tick */ + private boolean wasHungry = true; + + /** Amount of experience the client was last set to */ + private int lastExperience = -99999999; + private int respawnInvulnerabilityTicks = 60; + private EntityPlayer.EnumChatVisibility chatVisibility; + private boolean chatColours = true; + private long playerLastActiveTime = System.currentTimeMillis(); + + /** The entity the player is currently spectating through. */ + private Entity spectatingEntity = null; + + /** + * The currently in use window ID. Incremented every time a window is opened. + */ + private int currentWindowId; + + /** + * set to true when player is moving quantity of items from one inventory to another(crafting) but item in either + * slot is not changed + */ + public boolean isChangingQuantityOnly; + public int ping; + + /** + * Set when a player beats the ender dragon, used to respawn the player at the spawn point while retaining inventory + * and XP + */ + public boolean playerConqueredTheEnd; + + public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager) + { + super(worldIn, profile); + interactionManager.thisPlayerMP = this; + this.theItemInWorldManager = interactionManager; + BlockPos blockpos = worldIn.getSpawnPoint(); + + if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE) + { + int i = Math.max(5, server.getSpawnProtectionSize() - 6); + int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ())); + + if (j < i) + { + i = j; + } + + if (j <= 1) + { + i = 1; + } + + blockpos = worldIn.getTopSolidOrLiquidBlock(blockpos.add(this.rand.nextInt(i * 2) - i, 0, this.rand.nextInt(i * 2) - i)); + } + + this.mcServer = server; + this.statsFile = server.getConfigurationManager().getPlayerStatsFile(this); + this.stepHeight = 0.0F; + this.moveToBlockPosAndAngles(blockpos, 0.0F, 0.0F); + + while (!worldIn.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && this.posY < 255.0D) + { + this.setPosition(this.posX, this.posY + 1.0D, this.posZ); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + + if (tagCompund.hasKey("playerGameType", 99)) + { + if (MinecraftServer.getServer().getForceGamemode()) + { + this.theItemInWorldManager.setGameType(MinecraftServer.getServer().getGameType()); + } + else + { + this.theItemInWorldManager.setGameType(WorldSettings.GameType.getByID(tagCompund.getInteger("playerGameType"))); + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("playerGameType", this.theItemInWorldManager.getGameType().getID()); + } + + /** + * Add experience levels to this player. + */ + public void addExperienceLevel(int levels) + { + super.addExperienceLevel(levels); + this.lastExperience = -1; + } + + public void removeExperienceLevel(int levels) + { + super.removeExperienceLevel(levels); + this.lastExperience = -1; + } + + public void addSelfToInternalCraftingInventory() + { + this.openContainer.onCraftGuiOpened(this); + } + + /** + * Sends an ENTER_COMBAT packet to the client + */ + public void sendEnterCombat() + { + super.sendEnterCombat(); + this.playerNetServerHandler.sendPacket(new S42PacketCombatEvent(this.getCombatTracker(), S42PacketCombatEvent.Event.ENTER_COMBAT)); + } + + /** + * Sends an END_COMBAT packet to the client + */ + public void sendEndCombat() + { + super.sendEndCombat(); + this.playerNetServerHandler.sendPacket(new S42PacketCombatEvent(this.getCombatTracker(), S42PacketCombatEvent.Event.END_COMBAT)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.theItemInWorldManager.updateBlockRemoving(); + --this.respawnInvulnerabilityTicks; + + if (this.hurtResistantTime > 0) + { + --this.hurtResistantTime; + } + + this.openContainer.detectAndSendChanges(); + + if (!this.worldObj.isRemote && !this.openContainer.canInteractWith(this)) + { + this.closeScreen(); + this.openContainer = this.inventoryContainer; + } + + while (!this.destroyedItemsNetCache.isEmpty()) + { + int i = Math.min(this.destroyedItemsNetCache.size(), Integer.MAX_VALUE); + int[] aint = new int[i]; + Iterator iterator = this.destroyedItemsNetCache.iterator(); + int j = 0; + + while (iterator.hasNext() && j < i) + { + aint[j++] = ((Integer)iterator.next()).intValue(); + iterator.remove(); + } + + this.playerNetServerHandler.sendPacket(new S13PacketDestroyEntities(aint)); + } + + if (!this.loadedChunks.isEmpty()) + { + List list = Lists.newArrayList(); + Iterator iterator1 = this.loadedChunks.iterator(); + List list1 = Lists.newArrayList(); + + while (iterator1.hasNext() && ((List)list).size() < 10) + { + ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair)iterator1.next(); + + if (chunkcoordintpair != null) + { + if (this.worldObj.isBlockLoaded(new BlockPos(chunkcoordintpair.chunkXPos << 4, 0, chunkcoordintpair.chunkZPos << 4))) + { + Chunk chunk = this.worldObj.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos); + + if (chunk.isPopulated()) + { + list.add(chunk); + list1.addAll(((WorldServer)this.worldObj).getTileEntitiesIn(chunkcoordintpair.chunkXPos * 16, 0, chunkcoordintpair.chunkZPos * 16, chunkcoordintpair.chunkXPos * 16 + 16, 256, chunkcoordintpair.chunkZPos * 16 + 16)); + iterator1.remove(); + } + } + } + else + { + iterator1.remove(); + } + } + + if (!list.isEmpty()) + { + if (list.size() == 1) + { + this.playerNetServerHandler.sendPacket(new S21PacketChunkData((Chunk)list.get(0), true, 65535)); + } + else + { + this.playerNetServerHandler.sendPacket(new S26PacketMapChunkBulk(list)); + } + + for (TileEntity tileentity : list1) + { + this.sendTileEntityUpdate(tileentity); + } + + for (Chunk chunk1 : list) + { + this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk1); + } + } + } + + Entity entity = this.getSpectatingEntity(); + + if (entity != this) + { + if (!entity.isEntityAlive()) + { + this.setSpectatingEntity(this); + } + else + { + this.setPositionAndRotation(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); + this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this); + + if (this.isSneaking()) + { + this.setSpectatingEntity(this); + } + } + } + } + + public void onUpdateEntity() + { + try + { + super.onUpdate(); + + for (int i = 0; i < this.inventory.getSizeInventory(); ++i) + { + ItemStack itemstack = this.inventory.getStackInSlot(i); + + if (itemstack != null && itemstack.getItem().isMap()) + { + Packet packet = ((ItemMapBase)itemstack.getItem()).createMapDataPacket(itemstack, this.worldObj, this); + + if (packet != null) + { + this.playerNetServerHandler.sendPacket(packet); + } + } + } + + if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry) + { + this.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel())); + this.lastHealth = this.getHealth(); + this.lastFoodLevel = this.foodStats.getFoodLevel(); + this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F; + } + + if (this.getHealth() + this.getAbsorptionAmount() != this.combinedHealth) + { + this.combinedHealth = this.getHealth() + this.getAbsorptionAmount(); + + for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.health)) + { + this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective).func_96651_a(Arrays.asList(new EntityPlayer[] {this})); + } + } + + if (this.experienceTotal != this.lastExperience) + { + this.lastExperience = this.experienceTotal; + this.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(this.experience, this.experienceTotal, this.experienceLevel)); + } + + if (this.ticksExisted % 20 * 5 == 0 && !this.getStatFile().hasAchievementUnlocked(AchievementList.exploreAllBiomes)) + { + this.updateBiomesExplored(); + } + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked"); + this.addEntityCrashInfo(crashreportcategory); + throw new ReportedException(crashreport); + } + } + + /** + * Updates all biomes that have been explored by this player and triggers Adventuring Time if player qualifies. + */ + protected void updateBiomesExplored() + { + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(new BlockPos(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ))); + String s = biomegenbase.biomeName; + JsonSerializableSet jsonserializableset = (JsonSerializableSet)this.getStatFile().func_150870_b(AchievementList.exploreAllBiomes); + + if (jsonserializableset == null) + { + jsonserializableset = (JsonSerializableSet)this.getStatFile().func_150872_a(AchievementList.exploreAllBiomes, new JsonSerializableSet()); + } + + jsonserializableset.add(s); + + if (this.getStatFile().canUnlockAchievement(AchievementList.exploreAllBiomes) && jsonserializableset.size() >= BiomeGenBase.explorationBiomesList.size()) + { + Set set = Sets.newHashSet(BiomeGenBase.explorationBiomesList); + + for (String s1 : jsonserializableset) + { + Iterator iterator = set.iterator(); + + while (iterator.hasNext()) + { + BiomeGenBase biomegenbase1 = (BiomeGenBase)iterator.next(); + + if (biomegenbase1.biomeName.equals(s1)) + { + iterator.remove(); + } + } + + if (set.isEmpty()) + { + break; + } + } + + if (set.isEmpty()) + { + this.triggerAchievement(AchievementList.exploreAllBiomes); + } + } + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource cause) + { + if (this.worldObj.getGameRules().getBoolean("showDeathMessages")) + { + Team team = this.getTeam(); + + if (team != null && team.getDeathMessageVisibility() != Team.EnumVisible.ALWAYS) + { + if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OTHER_TEAMS) + { + this.mcServer.getConfigurationManager().sendMessageToAllTeamMembers(this, this.getCombatTracker().getDeathMessage()); + } + else if (team.getDeathMessageVisibility() == Team.EnumVisible.HIDE_FOR_OWN_TEAM) + { + this.mcServer.getConfigurationManager().sendMessageToTeamOrEvryPlayer(this, this.getCombatTracker().getDeathMessage()); + } + } + else + { + this.mcServer.getConfigurationManager().sendChatMsg(this.getCombatTracker().getDeathMessage()); + } + } + + if (!this.worldObj.getGameRules().getBoolean("keepInventory")) + { + this.inventory.dropAllItems(); + } + + for (ScoreObjective scoreobjective : this.worldObj.getScoreboard().getObjectivesFromCriteria(IScoreObjectiveCriteria.deathCount)) + { + Score score = this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective); + score.func_96648_a(); + } + + EntityLivingBase entitylivingbase = this.func_94060_bK(); + + if (entitylivingbase != null) + { + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(EntityList.getEntityID(entitylivingbase))); + + if (entitylist$entityegginfo != null) + { + this.triggerAchievement(entitylist$entityegginfo.field_151513_e); + } + + entitylivingbase.addToPlayerScore(this, this.scoreValue); + } + + this.triggerAchievement(StatList.deathsStat); + this.func_175145_a(StatList.timeSinceDeathStat); + this.getCombatTracker().reset(); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + boolean flag = this.mcServer.isDedicatedServer() && this.canPlayersAttack() && "fall".equals(source.damageType); + + if (!flag && this.respawnInvulnerabilityTicks > 0 && source != DamageSource.outOfWorld) + { + return false; + } + else + { + if (source instanceof EntityDamageSource) + { + Entity entity = source.getEntity(); + + if (entity instanceof EntityPlayer && !this.canAttackPlayer((EntityPlayer)entity)) + { + return false; + } + + if (entity instanceof EntityArrow) + { + EntityArrow entityarrow = (EntityArrow)entity; + + if (entityarrow.shootingEntity instanceof EntityPlayer && !this.canAttackPlayer((EntityPlayer)entityarrow.shootingEntity)) + { + return false; + } + } + } + + return super.attackEntityFrom(source, amount); + } + } + } + + public boolean canAttackPlayer(EntityPlayer other) + { + return !this.canPlayersAttack() ? false : super.canAttackPlayer(other); + } + + /** + * Returns if other players can attack this player + */ + private boolean canPlayersAttack() + { + return this.mcServer.isPVPEnabled(); + } + + /** + * Teleports the entity to another dimension. Params: Dimension number to teleport to + */ + public void travelToDimension(int dimensionId) + { + if (this.dimension == 1 && dimensionId == 1) + { + this.triggerAchievement(AchievementList.theEnd2); + this.worldObj.removeEntity(this); + this.playerConqueredTheEnd = true; + this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(4, 0.0F)); + } + else + { + if (this.dimension == 0 && dimensionId == 1) + { + this.triggerAchievement(AchievementList.theEnd); + BlockPos blockpos = this.mcServer.worldServerForDimension(dimensionId).getSpawnCoordinate(); + + if (blockpos != null) + { + this.playerNetServerHandler.setPlayerLocation((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), 0.0F, 0.0F); + } + + dimensionId = 1; + } + else + { + this.triggerAchievement(AchievementList.portal); + } + + this.mcServer.getConfigurationManager().transferPlayerToDimension(this, dimensionId); + this.lastExperience = -1; + this.lastHealth = -1.0F; + this.lastFoodLevel = -1; + } + } + + public boolean isSpectatedByPlayer(EntityPlayerMP player) + { + return player.isSpectator() ? this.getSpectatingEntity() == this : (this.isSpectator() ? false : super.isSpectatedByPlayer(player)); + } + + private void sendTileEntityUpdate(TileEntity p_147097_1_) + { + if (p_147097_1_ != null) + { + Packet packet = p_147097_1_.getDescriptionPacket(); + + if (packet != null) + { + this.playerNetServerHandler.sendPacket(packet); + } + } + } + + /** + * Called whenever an item is picked up from walking over it. Args: pickedUpEntity, stackSize + */ + public void onItemPickup(Entity p_71001_1_, int p_71001_2_) + { + super.onItemPickup(p_71001_1_, p_71001_2_); + this.openContainer.detectAndSendChanges(); + } + + public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation) + { + EntityPlayer.EnumStatus entityplayer$enumstatus = super.trySleep(bedLocation); + + if (entityplayer$enumstatus == EntityPlayer.EnumStatus.OK) + { + Packet packet = new S0APacketUseBed(this, bedLocation); + this.getServerForPlayer().getEntityTracker().sendToAllTrackingEntity(this, packet); + this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + this.playerNetServerHandler.sendPacket(packet); + } + + return entityplayer$enumstatus; + } + + /** + * Wake up the player if they're sleeping. + */ + public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn) + { + if (this.isPlayerSleeping()) + { + this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(this, 2)); + } + + super.wakeUpPlayer(p_70999_1_, updateWorldFlag, setSpawn); + + if (this.playerNetServerHandler != null) + { + this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + } + } + + /** + * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. + */ + public void mountEntity(Entity entityIn) + { + Entity entity = this.ridingEntity; + super.mountEntity(entityIn); + + if (entityIn != entity) + { + this.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(0, this, this.ridingEntity)); + this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + } + } + + protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos) + { + } + + /** + * process player falling based on movement packet + */ + public void handleFalling(double p_71122_1_, boolean p_71122_3_) + { + int i = MathHelper.floor_double(this.posX); + int j = MathHelper.floor_double(this.posY - 0.20000000298023224D); + int k = MathHelper.floor_double(this.posZ); + BlockPos blockpos = new BlockPos(i, j, k); + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + + if (block.getMaterial() == Material.air) + { + Block block1 = this.worldObj.getBlockState(blockpos.down()).getBlock(); + + if (block1 instanceof BlockFence || block1 instanceof BlockWall || block1 instanceof BlockFenceGate) + { + blockpos = blockpos.down(); + block = this.worldObj.getBlockState(blockpos).getBlock(); + } + } + + super.updateFallState(p_71122_1_, p_71122_3_, block, blockpos); + } + + public void openEditSign(TileEntitySign signTile) + { + signTile.setPlayer(this); + this.playerNetServerHandler.sendPacket(new S36PacketSignEditorOpen(signTile.getPos())); + } + + /** + * get the next window id to use + */ + private void getNextWindowId() + { + this.currentWindowId = this.currentWindowId % 100 + 1; + } + + public void displayGui(IInteractionObject guiOwner) + { + this.getNextWindowId(); + this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, guiOwner.getGuiID(), guiOwner.getDisplayName())); + this.openContainer = guiOwner.createContainer(this.inventory, this); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.onCraftGuiOpened(this); + } + + /** + * Displays the GUI for interacting with a chest inventory. Args: chestInventory + */ + public void displayGUIChest(IInventory chestInventory) + { + if (this.openContainer != this.inventoryContainer) + { + this.closeScreen(); + } + + if (chestInventory instanceof ILockableContainer) + { + ILockableContainer ilockablecontainer = (ILockableContainer)chestInventory; + + if (ilockablecontainer.isLocked() && !this.canOpen(ilockablecontainer.getLockCode()) && !this.isSpectator()) + { + this.playerNetServerHandler.sendPacket(new S02PacketChat(new ChatComponentTranslation("container.isLocked", new Object[] {chestInventory.getDisplayName()}), (byte)2)); + this.playerNetServerHandler.sendPacket(new S29PacketSoundEffect("random.door_close", this.posX, this.posY, this.posZ, 1.0F, 1.0F)); + return; + } + } + + this.getNextWindowId(); + + if (chestInventory instanceof IInteractionObject) + { + this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, ((IInteractionObject)chestInventory).getGuiID(), chestInventory.getDisplayName(), chestInventory.getSizeInventory())); + this.openContainer = ((IInteractionObject)chestInventory).createContainer(this.inventory, this); + } + else + { + this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:container", chestInventory.getDisplayName(), chestInventory.getSizeInventory())); + this.openContainer = new ContainerChest(this.inventory, chestInventory, this); + } + + this.openContainer.windowId = this.currentWindowId; + this.openContainer.onCraftGuiOpened(this); + } + + public void displayVillagerTradeGui(IMerchant villager) + { + this.getNextWindowId(); + this.openContainer = new ContainerMerchant(this.inventory, villager, this.worldObj); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.onCraftGuiOpened(this); + IInventory iinventory = ((ContainerMerchant)this.openContainer).getMerchantInventory(); + IChatComponent ichatcomponent = villager.getDisplayName(); + this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "minecraft:villager", ichatcomponent, iinventory.getSizeInventory())); + MerchantRecipeList merchantrecipelist = villager.getRecipes(this); + + if (merchantrecipelist != null) + { + PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer()); + packetbuffer.writeInt(this.currentWindowId); + merchantrecipelist.writeToBuf(packetbuffer); + this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|TrList", packetbuffer)); + } + } + + public void displayGUIHorse(EntityHorse horse, IInventory horseInventory) + { + if (this.openContainer != this.inventoryContainer) + { + this.closeScreen(); + } + + this.getNextWindowId(); + this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, "EntityHorse", horseInventory.getDisplayName(), horseInventory.getSizeInventory(), horse.getEntityId())); + this.openContainer = new ContainerHorseInventory(this.inventory, horseInventory, horse, this); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.onCraftGuiOpened(this); + } + + /** + * Displays the GUI for interacting with a book. + */ + public void displayGUIBook(ItemStack bookStack) + { + Item item = bookStack.getItem(); + + if (item == Items.written_book) + { + this.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload("MC|BOpen", new PacketBuffer(Unpooled.buffer()))); + } + } + + /** + * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual + * contents of that slot. Args: Container, slot number, slot contents + */ + public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack) + { + if (!(containerToSend.getSlot(slotInd) instanceof SlotCrafting)) + { + if (!this.isChangingQuantityOnly) + { + this.playerNetServerHandler.sendPacket(new S2FPacketSetSlot(containerToSend.windowId, slotInd, stack)); + } + } + } + + public void sendContainerToPlayer(Container p_71120_1_) + { + this.updateCraftingInventory(p_71120_1_, p_71120_1_.getInventory()); + } + + /** + * update the crafting window inventory with the items in the list + */ + public void updateCraftingInventory(Container containerToSend, List itemsList) + { + this.playerNetServerHandler.sendPacket(new S30PacketWindowItems(containerToSend.windowId, itemsList)); + this.playerNetServerHandler.sendPacket(new S2FPacketSetSlot(-1, -1, this.inventory.getItemStack())); + } + + /** + * Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress, + * and enchanting level. Normally the first int identifies which variable to update, and the second contains the new + * value. Both are truncated to shorts in non-local SMP. + */ + public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue) + { + this.playerNetServerHandler.sendPacket(new S31PacketWindowProperty(containerIn.windowId, varToUpdate, newValue)); + } + + public void func_175173_a(Container p_175173_1_, IInventory p_175173_2_) + { + for (int i = 0; i < p_175173_2_.getFieldCount(); ++i) + { + this.playerNetServerHandler.sendPacket(new S31PacketWindowProperty(p_175173_1_.windowId, i, p_175173_2_.getField(i))); + } + } + + /** + * set current crafting inventory back to the 2x2 square + */ + public void closeScreen() + { + this.playerNetServerHandler.sendPacket(new S2EPacketCloseWindow(this.openContainer.windowId)); + this.closeContainer(); + } + + /** + * updates item held by mouse + */ + public void updateHeldItem() + { + if (!this.isChangingQuantityOnly) + { + this.playerNetServerHandler.sendPacket(new S2FPacketSetSlot(-1, -1, this.inventory.getItemStack())); + } + } + + /** + * Closes the container the player currently has open. + */ + public void closeContainer() + { + this.openContainer.onContainerClosed(this); + this.openContainer = this.inventoryContainer; + } + + public void setEntityActionState(float p_110430_1_, float p_110430_2_, boolean p_110430_3_, boolean sneaking) + { + if (this.ridingEntity != null) + { + if (p_110430_1_ >= -1.0F && p_110430_1_ <= 1.0F) + { + this.moveStrafing = p_110430_1_; + } + + if (p_110430_2_ >= -1.0F && p_110430_2_ <= 1.0F) + { + this.moveForward = p_110430_2_; + } + + this.isJumping = p_110430_3_; + this.setSneaking(sneaking); + } + } + + /** + * Adds a value to a statistic field. + */ + public void addStat(StatBase stat, int amount) + { + if (stat != null) + { + this.statsFile.increaseStat(this, stat, amount); + + for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.func_150952_k())) + { + this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective).increseScore(amount); + } + + if (this.statsFile.func_150879_e()) + { + this.statsFile.func_150876_a(this); + } + } + } + + public void func_175145_a(StatBase p_175145_1_) + { + if (p_175145_1_ != null) + { + this.statsFile.unlockAchievement(this, p_175145_1_, 0); + + for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(p_175145_1_.func_150952_k())) + { + this.getWorldScoreboard().getValueFromObjective(this.getName(), scoreobjective).setScorePoints(0); + } + + if (this.statsFile.func_150879_e()) + { + this.statsFile.func_150876_a(this); + } + } + } + + public void mountEntityAndWakeUp() + { + if (this.riddenByEntity != null) + { + this.riddenByEntity.mountEntity(this); + } + + if (this.sleeping) + { + this.wakeUpPlayer(true, false, false); + } + } + + /** + * this function is called when a players inventory is sent to him, lastHealth is updated on any dimension + * transitions, then reset. + */ + public void setPlayerHealthUpdated() + { + this.lastHealth = -1.0E8F; + } + + public void addChatComponentMessage(IChatComponent chatComponent) + { + this.playerNetServerHandler.sendPacket(new S02PacketChat(chatComponent)); + } + + /** + * Used for when item use count runs out, ie: eating completed + */ + protected void onItemUseFinish() + { + this.playerNetServerHandler.sendPacket(new S19PacketEntityStatus(this, (byte)9)); + super.onItemUseFinish(); + } + + /** + * sets the itemInUse when the use item button is clicked. Args: itemstack, int maxItemUseDuration + */ + public void setItemInUse(ItemStack stack, int duration) + { + super.setItemInUse(stack, duration); + + if (stack != null && stack.getItem() != null && stack.getItem().getItemUseAction(stack) == EnumAction.EAT) + { + this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(this, 3)); + } + } + + /** + * Copies the values from the given player into this player if boolean par2 is true. Always clones Ender Chest + * Inventory. + */ + public void clonePlayer(EntityPlayer oldPlayer, boolean respawnFromEnd) + { + super.clonePlayer(oldPlayer, respawnFromEnd); + this.lastExperience = -1; + this.lastHealth = -1.0F; + this.lastFoodLevel = -1; + this.destroyedItemsNetCache.addAll(((EntityPlayerMP)oldPlayer).destroyedItemsNetCache); + } + + protected void onNewPotionEffect(PotionEffect id) + { + super.onNewPotionEffect(id); + this.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.getEntityId(), id)); + } + + protected void onChangedPotionEffect(PotionEffect id, boolean p_70695_2_) + { + super.onChangedPotionEffect(id, p_70695_2_); + this.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(this.getEntityId(), id)); + } + + protected void onFinishedPotionEffect(PotionEffect p_70688_1_) + { + super.onFinishedPotionEffect(p_70688_1_); + this.playerNetServerHandler.sendPacket(new S1EPacketRemoveEntityEffect(this.getEntityId(), p_70688_1_)); + } + + /** + * Sets the position of the entity and updates the 'last' variables + */ + public void setPositionAndUpdate(double x, double y, double z) + { + this.playerNetServerHandler.setPlayerLocation(x, y, z, this.rotationYaw, this.rotationPitch); + } + + /** + * Called when the player performs a critical hit on the Entity. Args: entity that was hit critically + */ + public void onCriticalHit(Entity entityHit) + { + this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(entityHit, 4)); + } + + public void onEnchantmentCritical(Entity entityHit) + { + this.getServerForPlayer().getEntityTracker().func_151248_b(this, new S0BPacketAnimation(entityHit, 5)); + } + + /** + * Sends the player's abilities to the server (if there is one). + */ + public void sendPlayerAbilities() + { + if (this.playerNetServerHandler != null) + { + this.playerNetServerHandler.sendPacket(new S39PacketPlayerAbilities(this.capabilities)); + this.updatePotionMetadata(); + } + } + + public WorldServer getServerForPlayer() + { + return (WorldServer)this.worldObj; + } + + /** + * Sets the player's game mode and sends it to them. + */ + public void setGameType(WorldSettings.GameType gameType) + { + this.theItemInWorldManager.setGameType(gameType); + this.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(3, (float)gameType.getID())); + + if (gameType == WorldSettings.GameType.SPECTATOR) + { + this.mountEntity((Entity)null); + } + else + { + this.setSpectatingEntity(this); + } + + this.sendPlayerAbilities(); + this.markPotionsDirty(); + } + + /** + * Returns true if the player is in spectator mode. + */ + public boolean isSpectator() + { + return this.theItemInWorldManager.getGameType() == WorldSettings.GameType.SPECTATOR; + } + + /** + * Send a chat message to the CommandSender + */ + public void addChatMessage(IChatComponent component) + { + this.playerNetServerHandler.sendPacket(new S02PacketChat(component)); + } + + /** + * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not + */ + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { + if ("seed".equals(commandName) && !this.mcServer.isDedicatedServer()) + { + return true; + } + else if (!"tell".equals(commandName) && !"help".equals(commandName) && !"me".equals(commandName) && !"trigger".equals(commandName)) + { + if (this.mcServer.getConfigurationManager().canSendCommands(this.getGameProfile())) + { + UserListOpsEntry userlistopsentry = (UserListOpsEntry)this.mcServer.getConfigurationManager().getOppedPlayers().getEntry(this.getGameProfile()); + return userlistopsentry != null ? userlistopsentry.getPermissionLevel() >= permLevel : this.mcServer.getOpPermissionLevel() >= permLevel; + } + else + { + return false; + } + } + else + { + return true; + } + } + + /** + * Gets the player's IP address. Used in /banip. + */ + public String getPlayerIP() + { + String s = this.playerNetServerHandler.netManager.getRemoteAddress().toString(); + s = s.substring(s.indexOf("/") + 1); + s = s.substring(0, s.indexOf(":")); + return s; + } + + public void handleClientSettings(C15PacketClientSettings packetIn) + { + this.translator = packetIn.getLang(); + this.chatVisibility = packetIn.getChatVisibility(); + this.chatColours = packetIn.isColorsEnabled(); + this.getDataWatcher().updateObject(10, Byte.valueOf((byte)packetIn.getModelPartFlags())); + } + + public EntityPlayer.EnumChatVisibility getChatVisibility() + { + return this.chatVisibility; + } + + public void loadResourcePack(String url, String hash) + { + this.playerNetServerHandler.sendPacket(new S48PacketResourcePackSend(url, hash)); + } + + /** + * Get the position in the world. {@code null} is not allowed! If you are not an entity in the world, return + * the coordinates 0, 0, 0 + */ + public BlockPos getPosition() + { + return new BlockPos(this.posX, this.posY + 0.5D, this.posZ); + } + + public void markPlayerActive() + { + this.playerLastActiveTime = MinecraftServer.getCurrentTimeMillis(); + } + + /** + * Gets the stats file for reading achievements + */ + public StatisticsFile getStatFile() + { + return this.statsFile; + } + + /** + * Sends a packet to the player to remove an entity. + */ + public void removeEntity(Entity p_152339_1_) + { + if (p_152339_1_ instanceof EntityPlayer) + { + this.playerNetServerHandler.sendPacket(new S13PacketDestroyEntities(new int[] {p_152339_1_.getEntityId()})); + } + else + { + this.destroyedItemsNetCache.add(Integer.valueOf(p_152339_1_.getEntityId())); + } + } + + /** + * Clears potion metadata values if the entity has no potion effects. Otherwise, updates potion effect color, + * ambience, and invisibility metadata values + */ + protected void updatePotionMetadata() + { + if (this.isSpectator()) + { + this.resetPotionEffectMetadata(); + this.setInvisible(true); + } + else + { + super.updatePotionMetadata(); + } + + this.getServerForPlayer().getEntityTracker().func_180245_a(this); + } + + public Entity getSpectatingEntity() + { + return (Entity)(this.spectatingEntity == null ? this : this.spectatingEntity); + } + + public void setSpectatingEntity(Entity entityToSpectate) + { + Entity entity = this.getSpectatingEntity(); + this.spectatingEntity = (Entity)(entityToSpectate == null ? this : entityToSpectate); + + if (entity != this.spectatingEntity) + { + this.playerNetServerHandler.sendPacket(new S43PacketCamera(this.spectatingEntity)); + this.setPositionAndUpdate(this.spectatingEntity.posX, this.spectatingEntity.posY, this.spectatingEntity.posZ); + } + } + + /** + * Attacks for the player the targeted entity with the currently equipped item. The equipped item has hitEntity + * called on it. Args: targetEntity + */ + public void attackTargetEntityWithCurrentItem(Entity targetEntity) + { + if (this.theItemInWorldManager.getGameType() == WorldSettings.GameType.SPECTATOR) + { + this.setSpectatingEntity(targetEntity); + } + else + { + super.attackTargetEntityWithCurrentItem(targetEntity); + } + } + + public long getLastActiveTime() + { + return this.playerLastActiveTime; + } + + /** + * Returns null which indicates the tab list should just display the player's name, return a different value to + * display the specified text instead of the player's name + */ + public IChatComponent getTabListDisplayName() + { + return null; + } +} diff --git a/src/minecraft/net/minecraft/entity/player/EnumPlayerModelParts.java b/src/minecraft/net/minecraft/entity/player/EnumPlayerModelParts.java new file mode 100644 index 0000000..f099c4d --- /dev/null +++ b/src/minecraft/net/minecraft/entity/player/EnumPlayerModelParts.java @@ -0,0 +1,48 @@ +package net.minecraft.entity.player; + +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; + +public enum EnumPlayerModelParts +{ + CAPE(0, "cape"), + JACKET(1, "jacket"), + LEFT_SLEEVE(2, "left_sleeve"), + RIGHT_SLEEVE(3, "right_sleeve"), + LEFT_PANTS_LEG(4, "left_pants_leg"), + RIGHT_PANTS_LEG(5, "right_pants_leg"), + HAT(6, "hat"); + + private final int partId; + private final int partMask; + private final String partName; + private final IChatComponent field_179339_k; + + private EnumPlayerModelParts(int partIdIn, String partNameIn) + { + this.partId = partIdIn; + this.partMask = 1 << partIdIn; + this.partName = partNameIn; + this.field_179339_k = new ChatComponentTranslation("options.modelPart." + partNameIn, new Object[0]); + } + + public int getPartMask() + { + return this.partMask; + } + + public int getPartId() + { + return this.partId; + } + + public String getPartName() + { + return this.partName; + } + + public IChatComponent func_179326_d() + { + return this.field_179339_k; + } +} diff --git a/src/minecraft/net/minecraft/entity/player/InventoryPlayer.java b/src/minecraft/net/minecraft/entity/player/InventoryPlayer.java new file mode 100644 index 0000000..8f54dcc --- /dev/null +++ b/src/minecraft/net/minecraft/entity/player/InventoryPlayer.java @@ -0,0 +1,884 @@ +package net.minecraft.entity.player; + +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ReportedException; + +public class InventoryPlayer implements IInventory +{ + /** + * An array of 36 item stacks indicating the main player inventory (including the visible bar). + */ + public ItemStack[] mainInventory = new ItemStack[36]; + + /** An array of 4 item stacks containing the currently worn armor pieces. */ + public ItemStack[] armorInventory = new ItemStack[4]; + + /** The index of the currently held item (0-8). */ + public int currentItem; + + /** The player whose inventory this is. */ + public EntityPlayer player; + private ItemStack itemStack; + + /** + * Set true whenever the inventory changes. Nothing sets it false so you will have to write your own code to check + * it and reset the value. + */ + public boolean inventoryChanged; + + public InventoryPlayer(EntityPlayer playerIn) + { + this.player = playerIn; + } + + /** + * Returns the item stack currently held by the player. + */ + public ItemStack getCurrentItem() + { + return this.currentItem < 9 && this.currentItem >= 0 ? this.mainInventory[this.currentItem] : null; + } + + /** + * Get the size of the player hotbar inventory + */ + public static int getHotbarSize() + { + return 9; + } + + private int getInventorySlotContainItem(Item itemIn) + { + for (int i = 0; i < this.mainInventory.length; ++i) + { + if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemIn) + { + return i; + } + } + + return -1; + } + + private int getInventorySlotContainItemAndDamage(Item itemIn, int p_146024_2_) + { + for (int i = 0; i < this.mainInventory.length; ++i) + { + if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemIn && this.mainInventory[i].getMetadata() == p_146024_2_) + { + return i; + } + } + + return -1; + } + + /** + * stores an itemstack in the users inventory + */ + private int storeItemStack(ItemStack itemStackIn) + { + for (int i = 0; i < this.mainInventory.length; ++i) + { + if (this.mainInventory[i] != null && this.mainInventory[i].getItem() == itemStackIn.getItem() && this.mainInventory[i].isStackable() && this.mainInventory[i].stackSize < this.mainInventory[i].getMaxStackSize() && this.mainInventory[i].stackSize < this.getInventoryStackLimit() && (!this.mainInventory[i].getHasSubtypes() || this.mainInventory[i].getMetadata() == itemStackIn.getMetadata()) && ItemStack.areItemStackTagsEqual(this.mainInventory[i], itemStackIn)) + { + return i; + } + } + + return -1; + } + + /** + * Returns the first item stack that is empty. + */ + public int getFirstEmptyStack() + { + for (int i = 0; i < this.mainInventory.length; ++i) + { + if (this.mainInventory[i] == null) + { + return i; + } + } + + return -1; + } + + public void setCurrentItem(Item itemIn, int p_146030_2_, boolean p_146030_3_, boolean p_146030_4_) + { + ItemStack itemstack = this.getCurrentItem(); + int i = p_146030_3_ ? this.getInventorySlotContainItemAndDamage(itemIn, p_146030_2_) : this.getInventorySlotContainItem(itemIn); + + if (i >= 0 && i < 9) + { + this.currentItem = i; + } + else if (p_146030_4_ && itemIn != null) + { + int j = this.getFirstEmptyStack(); + + if (j >= 0 && j < 9) + { + this.currentItem = j; + } + + if (itemstack == null || !itemstack.isItemEnchantable() || this.getInventorySlotContainItemAndDamage(itemstack.getItem(), itemstack.getItemDamage()) != this.currentItem) + { + int k = this.getInventorySlotContainItemAndDamage(itemIn, p_146030_2_); + int l; + + if (k >= 0) + { + l = this.mainInventory[k].stackSize; + this.mainInventory[k] = this.mainInventory[this.currentItem]; + } + else + { + l = 1; + } + + this.mainInventory[this.currentItem] = new ItemStack(itemIn, l, p_146030_2_); + } + } + } + + /** + * Switch the current item to the next one or the previous one + */ + public void changeCurrentItem(int p_70453_1_) + { + if (p_70453_1_ > 0) + { + p_70453_1_ = 1; + } + + if (p_70453_1_ < 0) + { + p_70453_1_ = -1; + } + + for (this.currentItem -= p_70453_1_; this.currentItem < 0; this.currentItem += 9) + { + ; + } + + while (this.currentItem >= 9) + { + this.currentItem -= 9; + } + } + + /** + * Removes matching items from the inventory. + * @param itemIn The item to match, null ignores. + * @param metadataIn The metadata to match, -1 ignores. + * @param removeCount The number of items to remove. If less than 1, removes all matching items. + * @param itemNBT The NBT data to match, null ignores. + * @return The number of items removed from the inventory. + */ + public int clearMatchingItems(Item itemIn, int metadataIn, int removeCount, NBTTagCompound itemNBT) + { + int i = 0; + + for (int j = 0; j < this.mainInventory.length; ++j) + { + ItemStack itemstack = this.mainInventory[j]; + + if (itemstack != null && (itemIn == null || itemstack.getItem() == itemIn) && (metadataIn <= -1 || itemstack.getMetadata() == metadataIn) && (itemNBT == null || NBTUtil.func_181123_a(itemNBT, itemstack.getTagCompound(), true))) + { + int k = removeCount <= 0 ? itemstack.stackSize : Math.min(removeCount - i, itemstack.stackSize); + i += k; + + if (removeCount != 0) + { + this.mainInventory[j].stackSize -= k; + + if (this.mainInventory[j].stackSize == 0) + { + this.mainInventory[j] = null; + } + + if (removeCount > 0 && i >= removeCount) + { + return i; + } + } + } + } + + for (int l = 0; l < this.armorInventory.length; ++l) + { + ItemStack itemstack1 = this.armorInventory[l]; + + if (itemstack1 != null && (itemIn == null || itemstack1.getItem() == itemIn) && (metadataIn <= -1 || itemstack1.getMetadata() == metadataIn) && (itemNBT == null || NBTUtil.func_181123_a(itemNBT, itemstack1.getTagCompound(), false))) + { + int j1 = removeCount <= 0 ? itemstack1.stackSize : Math.min(removeCount - i, itemstack1.stackSize); + i += j1; + + if (removeCount != 0) + { + this.armorInventory[l].stackSize -= j1; + + if (this.armorInventory[l].stackSize == 0) + { + this.armorInventory[l] = null; + } + + if (removeCount > 0 && i >= removeCount) + { + return i; + } + } + } + } + + if (this.itemStack != null) + { + if (itemIn != null && this.itemStack.getItem() != itemIn) + { + return i; + } + + if (metadataIn > -1 && this.itemStack.getMetadata() != metadataIn) + { + return i; + } + + if (itemNBT != null && !NBTUtil.func_181123_a(itemNBT, this.itemStack.getTagCompound(), false)) + { + return i; + } + + int i1 = removeCount <= 0 ? this.itemStack.stackSize : Math.min(removeCount - i, this.itemStack.stackSize); + i += i1; + + if (removeCount != 0) + { + this.itemStack.stackSize -= i1; + + if (this.itemStack.stackSize == 0) + { + this.itemStack = null; + } + + if (removeCount > 0 && i >= removeCount) + { + return i; + } + } + } + + return i; + } + + /** + * This function stores as many items of an ItemStack as possible in a matching slot and returns the quantity of + * left over items. + */ + private int storePartialItemStack(ItemStack itemStackIn) + { + Item item = itemStackIn.getItem(); + int i = itemStackIn.stackSize; + int j = this.storeItemStack(itemStackIn); + + if (j < 0) + { + j = this.getFirstEmptyStack(); + } + + if (j < 0) + { + return i; + } + else + { + if (this.mainInventory[j] == null) + { + this.mainInventory[j] = new ItemStack(item, 0, itemStackIn.getMetadata()); + + if (itemStackIn.hasTagCompound()) + { + this.mainInventory[j].setTagCompound((NBTTagCompound)itemStackIn.getTagCompound().copy()); + } + } + + int k = i; + + if (i > this.mainInventory[j].getMaxStackSize() - this.mainInventory[j].stackSize) + { + k = this.mainInventory[j].getMaxStackSize() - this.mainInventory[j].stackSize; + } + + if (k > this.getInventoryStackLimit() - this.mainInventory[j].stackSize) + { + k = this.getInventoryStackLimit() - this.mainInventory[j].stackSize; + } + + if (k == 0) + { + return i; + } + else + { + i = i - k; + this.mainInventory[j].stackSize += k; + this.mainInventory[j].animationsToGo = 5; + return i; + } + } + } + + /** + * Decrement the number of animations remaining. Only called on client side. This is used to handle the animation of + * receiving a block. + */ + public void decrementAnimations() + { + for (int i = 0; i < this.mainInventory.length; ++i) + { + if (this.mainInventory[i] != null) + { + this.mainInventory[i].updateAnimation(this.player.worldObj, this.player, i, this.currentItem == i); + } + } + } + + /** + * removed one item of specified Item from inventory (if it is in a stack, the stack size will reduce with 1) + */ + public boolean consumeInventoryItem(Item itemIn) + { + int i = this.getInventorySlotContainItem(itemIn); + + if (i < 0) + { + return false; + } + else + { + if (--this.mainInventory[i].stackSize <= 0) + { + this.mainInventory[i] = null; + } + + return true; + } + } + + /** + * Checks if a specified Item is inside the inventory + */ + public boolean hasItem(Item itemIn) + { + int i = this.getInventorySlotContainItem(itemIn); + return i >= 0; + } + + /** + * Adds the item stack to the inventory, returns false if it is impossible. + */ + public boolean addItemStackToInventory(final ItemStack itemStackIn) + { + if (itemStackIn != null && itemStackIn.stackSize != 0 && itemStackIn.getItem() != null) + { + try + { + if (itemStackIn.isItemDamaged()) + { + int j = this.getFirstEmptyStack(); + + if (j >= 0) + { + this.mainInventory[j] = ItemStack.copyItemStack(itemStackIn); + this.mainInventory[j].animationsToGo = 5; + itemStackIn.stackSize = 0; + return true; + } + else if (this.player.capabilities.isCreativeMode) + { + itemStackIn.stackSize = 0; + return true; + } + else + { + return false; + } + } + else + { + int i; + + while (true) + { + i = itemStackIn.stackSize; + itemStackIn.stackSize = this.storePartialItemStack(itemStackIn); + + if (itemStackIn.stackSize <= 0 || itemStackIn.stackSize >= i) + { + break; + } + } + + if (itemStackIn.stackSize == i && this.player.capabilities.isCreativeMode) + { + itemStackIn.stackSize = 0; + return true; + } + else + { + return itemStackIn.stackSize < i; + } + } + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Adding item to inventory"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Item being added"); + crashreportcategory.addCrashSection("Item ID", Integer.valueOf(Item.getIdFromItem(itemStackIn.getItem()))); + crashreportcategory.addCrashSection("Item data", Integer.valueOf(itemStackIn.getMetadata())); + crashreportcategory.addCrashSectionCallable("Item name", new Callable() + { + public String call() throws Exception + { + return itemStackIn.getDisplayName(); + } + }); + throw new ReportedException(crashreport); + } + } + else + { + return false; + } + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + ItemStack[] aitemstack = this.mainInventory; + + if (index >= this.mainInventory.length) + { + aitemstack = this.armorInventory; + index -= this.mainInventory.length; + } + + if (aitemstack[index] != null) + { + if (aitemstack[index].stackSize <= count) + { + ItemStack itemstack1 = aitemstack[index]; + aitemstack[index] = null; + return itemstack1; + } + else + { + ItemStack itemstack = aitemstack[index].splitStack(count); + + if (aitemstack[index].stackSize == 0) + { + aitemstack[index] = null; + } + + return itemstack; + } + } + else + { + return null; + } + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + ItemStack[] aitemstack = this.mainInventory; + + if (index >= this.mainInventory.length) + { + aitemstack = this.armorInventory; + index -= this.mainInventory.length; + } + + if (aitemstack[index] != null) + { + ItemStack itemstack = aitemstack[index]; + aitemstack[index] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + ItemStack[] aitemstack = this.mainInventory; + + if (index >= aitemstack.length) + { + index -= aitemstack.length; + aitemstack = this.armorInventory; + } + + aitemstack[index] = stack; + } + + public float getStrVsBlock(Block blockIn) + { + float f = 1.0F; + + if (this.mainInventory[this.currentItem] != null) + { + f *= this.mainInventory[this.currentItem].getStrVsBlock(blockIn); + } + + return f; + } + + /** + * Writes the inventory out as a list of compound tags. This is where the slot indices are used (+100 for armor, +80 + * for crafting). + */ + public NBTTagList writeToNBT(NBTTagList p_70442_1_) + { + for (int i = 0; i < this.mainInventory.length; ++i) + { + if (this.mainInventory[i] != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Slot", (byte)i); + this.mainInventory[i].writeToNBT(nbttagcompound); + p_70442_1_.appendTag(nbttagcompound); + } + } + + for (int j = 0; j < this.armorInventory.length; ++j) + { + if (this.armorInventory[j] != null) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte)(j + 100)); + this.armorInventory[j].writeToNBT(nbttagcompound1); + p_70442_1_.appendTag(nbttagcompound1); + } + } + + return p_70442_1_; + } + + /** + * Reads from the given tag list and fills the slots in the inventory with the correct items. + */ + public void readFromNBT(NBTTagList p_70443_1_) + { + this.mainInventory = new ItemStack[36]; + this.armorInventory = new ItemStack[4]; + + for (int i = 0; i < p_70443_1_.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = p_70443_1_.getCompoundTagAt(i); + int j = nbttagcompound.getByte("Slot") & 255; + ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound); + + if (itemstack != null) + { + if (j >= 0 && j < this.mainInventory.length) + { + this.mainInventory[j] = itemstack; + } + + if (j >= 100 && j < this.armorInventory.length + 100) + { + this.armorInventory[j - 100] = itemstack; + } + } + } + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.mainInventory.length + 4; + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + ItemStack[] aitemstack = this.mainInventory; + + if (index >= aitemstack.length) + { + index -= aitemstack.length; + aitemstack = this.armorInventory; + } + + return aitemstack[index]; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return "container.inventory"; + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return false; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return (IChatComponent)(this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return 64; + } + + public boolean canHeldItemHarvest(Block blockIn) + { + if (blockIn.getMaterial().isToolNotRequired()) + { + return true; + } + else + { + ItemStack itemstack = this.getStackInSlot(this.currentItem); + return itemstack != null ? itemstack.canHarvestBlock(blockIn) : false; + } + } + + /** + * returns a player armor item (as itemstack) contained in specified armor slot. + */ + public ItemStack armorItemInSlot(int p_70440_1_) + { + return this.armorInventory[p_70440_1_]; + } + + /** + * Based on the damage values and maximum damage values of each armor item, returns the current armor value. + */ + public int getTotalArmorValue() + { + int i = 0; + + for (int j = 0; j < this.armorInventory.length; ++j) + { + if (this.armorInventory[j] != null && this.armorInventory[j].getItem() instanceof ItemArmor) + { + int k = ((ItemArmor)this.armorInventory[j].getItem()).damageReduceAmount; + i += k; + } + } + + return i; + } + + /** + * Damages armor in each slot by the specified amount. + */ + public void damageArmor(float damage) + { + damage = damage / 4.0F; + + if (damage < 1.0F) + { + damage = 1.0F; + } + + for (int i = 0; i < this.armorInventory.length; ++i) + { + if (this.armorInventory[i] != null && this.armorInventory[i].getItem() instanceof ItemArmor) + { + this.armorInventory[i].damageItem((int)damage, this.player); + + if (this.armorInventory[i].stackSize == 0) + { + this.armorInventory[i] = null; + } + } + } + } + + /** + * Drop all armor and main inventory items. + */ + public void dropAllItems() + { + for (int i = 0; i < this.mainInventory.length; ++i) + { + if (this.mainInventory[i] != null) + { + this.player.dropItem(this.mainInventory[i], true, false); + this.mainInventory[i] = null; + } + } + + for (int j = 0; j < this.armorInventory.length; ++j) + { + if (this.armorInventory[j] != null) + { + this.player.dropItem(this.armorInventory[j], true, false); + this.armorInventory[j] = null; + } + } + } + + /** + * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it + * hasn't changed and skip it. + */ + public void markDirty() + { + this.inventoryChanged = true; + } + + /** + * Set the stack helds by mouse, used in GUI/Container + */ + public void setItemStack(ItemStack itemStackIn) + { + this.itemStack = itemStackIn; + } + + /** + * Stack helds by mouse, used in GUI and Containers + */ + public ItemStack getItemStack() + { + return this.itemStack; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.player.isDead ? false : player.getDistanceSqToEntity(this.player) <= 64.0D; + } + + /** + * Returns true if the specified ItemStack exists in the inventory. + */ + public boolean hasItemStack(ItemStack itemStackIn) + { + for (int i = 0; i < this.armorInventory.length; ++i) + { + if (this.armorInventory[i] != null && this.armorInventory[i].isItemEqual(itemStackIn)) + { + return true; + } + } + + for (int j = 0; j < this.mainInventory.length; ++j) + { + if (this.mainInventory[j] != null && this.mainInventory[j].isItemEqual(itemStackIn)) + { + return true; + } + } + + return false; + } + + public void openInventory(EntityPlayer player) + { + } + + public void closeInventory(EntityPlayer player) + { + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return true; + } + + /** + * Copy the ItemStack contents from another InventoryPlayer instance + */ + public void copyInventory(InventoryPlayer playerInventory) + { + for (int i = 0; i < this.mainInventory.length; ++i) + { + this.mainInventory[i] = ItemStack.copyItemStack(playerInventory.mainInventory[i]); + } + + for (int j = 0; j < this.armorInventory.length; ++j) + { + this.armorInventory[j] = ItemStack.copyItemStack(playerInventory.armorInventory[j]); + } + + this.currentItem = playerInventory.currentItem; + } + + public int getField(int id) + { + return 0; + } + + public void setField(int id, int value) + { + } + + public int getFieldCount() + { + return 0; + } + + public void clear() + { + for (int i = 0; i < this.mainInventory.length; ++i) + { + this.mainInventory[i] = null; + } + + for (int j = 0; j < this.armorInventory.length; ++j) + { + this.armorInventory[j] = null; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/player/PlayerCapabilities.java b/src/minecraft/net/minecraft/entity/player/PlayerCapabilities.java new file mode 100644 index 0000000..485c425 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/player/PlayerCapabilities.java @@ -0,0 +1,81 @@ +package net.minecraft.entity.player; + +import net.minecraft.nbt.NBTTagCompound; + +public class PlayerCapabilities +{ + /** Disables player damage. */ + public boolean disableDamage; + + /** Sets/indicates whether the player is flying. */ + public boolean isFlying; + + /** whether or not to allow the player to fly when they double jump. */ + public boolean allowFlying; + + /** + * Used to determine if creative mode is enabled, and therefore if items should be depleted on usage + */ + public boolean isCreativeMode; + + /** Indicates whether the player is allowed to modify the surroundings */ + public boolean allowEdit = true; + private float flySpeed = 0.05F; + private float walkSpeed = 0.1F; + + public void writeCapabilitiesToNBT(NBTTagCompound tagCompound) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setBoolean("invulnerable", this.disableDamage); + nbttagcompound.setBoolean("flying", this.isFlying); + nbttagcompound.setBoolean("mayfly", this.allowFlying); + nbttagcompound.setBoolean("instabuild", this.isCreativeMode); + nbttagcompound.setBoolean("mayBuild", this.allowEdit); + nbttagcompound.setFloat("flySpeed", this.flySpeed); + nbttagcompound.setFloat("walkSpeed", this.walkSpeed); + tagCompound.setTag("abilities", nbttagcompound); + } + + public void readCapabilitiesFromNBT(NBTTagCompound tagCompound) + { + if (tagCompound.hasKey("abilities", 10)) + { + NBTTagCompound nbttagcompound = tagCompound.getCompoundTag("abilities"); + this.disableDamage = nbttagcompound.getBoolean("invulnerable"); + this.isFlying = nbttagcompound.getBoolean("flying"); + this.allowFlying = nbttagcompound.getBoolean("mayfly"); + this.isCreativeMode = nbttagcompound.getBoolean("instabuild"); + + if (nbttagcompound.hasKey("flySpeed", 99)) + { + this.flySpeed = nbttagcompound.getFloat("flySpeed"); + this.walkSpeed = nbttagcompound.getFloat("walkSpeed"); + } + + if (nbttagcompound.hasKey("mayBuild", 1)) + { + this.allowEdit = nbttagcompound.getBoolean("mayBuild"); + } + } + } + + public float getFlySpeed() + { + return this.flySpeed; + } + + public void setFlySpeed(float speed) + { + this.flySpeed = speed; + } + + public float getWalkSpeed() + { + return this.walkSpeed; + } + + public void setPlayerWalkSpeed(float speed) + { + this.walkSpeed = speed; + } +} diff --git a/src/minecraft/net/minecraft/entity/projectile/EntityArrow.java b/src/minecraft/net/minecraft/entity/projectile/EntityArrow.java new file mode 100644 index 0000000..8acb831 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/projectile/EntityArrow.java @@ -0,0 +1,602 @@ +package net.minecraft.entity.projectile; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IProjectile; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.play.server.S2BPacketChangeGameState; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class EntityArrow extends Entity implements IProjectile +{ + private int xTile = -1; + private int yTile = -1; + private int zTile = -1; + private Block inTile; + private int inData; + private boolean inGround; + + /** 1 if the player can pick up the arrow */ + public int canBePickedUp; + + /** Seems to be some sort of timer for animating an arrow. */ + public int arrowShake; + + /** The owner of this arrow. */ + public Entity shootingEntity; + private int ticksInGround; + private int ticksInAir; + private double damage = 2.0D; + + /** The amount of knockback an arrow applies when it hits a mob. */ + private int knockbackStrength; + + public EntityArrow(World worldIn) + { + super(worldIn); + this.renderDistanceWeight = 10.0D; + this.setSize(0.5F, 0.5F); + } + + public EntityArrow(World worldIn, double x, double y, double z) + { + super(worldIn); + this.renderDistanceWeight = 10.0D; + this.setSize(0.5F, 0.5F); + this.setPosition(x, y, z); + } + + public EntityArrow(World worldIn, EntityLivingBase shooter, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_) + { + super(worldIn); + this.renderDistanceWeight = 10.0D; + this.shootingEntity = shooter; + + if (shooter instanceof EntityPlayer) + { + this.canBePickedUp = 1; + } + + this.posY = shooter.posY + (double)shooter.getEyeHeight() - 0.10000000149011612D; + double d0 = p_i1755_3_.posX - shooter.posX; + double d1 = p_i1755_3_.getEntityBoundingBox().minY + (double)(p_i1755_3_.height / 3.0F) - this.posY; + double d2 = p_i1755_3_.posZ - shooter.posZ; + double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2); + + if (d3 >= 1.0E-7D) + { + float f = (float)(MathHelper.func_181159_b(d2, d0) * 180.0D / Math.PI) - 90.0F; + float f1 = (float)(-(MathHelper.func_181159_b(d1, d3) * 180.0D / Math.PI)); + double d4 = d0 / d3; + double d5 = d2 / d3; + this.setLocationAndAngles(shooter.posX + d4, this.posY, shooter.posZ + d5, f, f1); + float f2 = (float)(d3 * 0.20000000298023224D); + this.setThrowableHeading(d0, d1 + (double)f2, d2, p_i1755_4_, p_i1755_5_); + } + } + + public EntityArrow(World worldIn, EntityLivingBase shooter, float velocity) + { + super(worldIn); + this.renderDistanceWeight = 10.0D; + this.shootingEntity = shooter; + + if (shooter instanceof EntityPlayer) + { + this.canBePickedUp = 1; + } + + this.setSize(0.5F, 0.5F); + this.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight(), shooter.posZ, shooter.rotationYaw, shooter.rotationPitch); + this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.posY -= 0.10000000149011612D; + this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.setPosition(this.posX, this.posY, this.posZ); + this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); + this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); + this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI)); + this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, velocity * 1.5F, 1.0F); + } + + protected void entityInit() + { + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + /** + * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction. + */ + public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) + { + float f = MathHelper.sqrt_double(x * x + y * y + z * z); + x = x / (double)f; + y = y / (double)f; + z = z / (double)f; + x = x + this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; + y = y + this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; + z = z + this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; + x = x * (double)velocity; + y = y * (double)velocity; + z = z * (double)velocity; + this.motionX = x; + this.motionY = y; + this.motionZ = z; + float f1 = MathHelper.sqrt_double(x * x + z * z); + this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.func_181159_b(x, z) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.func_181159_b(y, (double)f1) * 180.0D / Math.PI); + this.ticksInGround = 0; + } + + public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + { + this.setPosition(x, y, z); + this.setRotation(yaw, pitch); + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double x, double y, double z) + { + this.motionX = x; + this.motionY = y; + this.motionZ = z; + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float f = MathHelper.sqrt_double(x * x + z * z); + this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.func_181159_b(x, z) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.func_181159_b(y, (double)f) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch; + this.prevRotationYaw = this.rotationYaw; + this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + this.ticksInGround = 0; + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.func_181159_b(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.func_181159_b(this.motionY, (double)f) * 180.0D / Math.PI); + } + + BlockPos blockpos = new BlockPos(this.xTile, this.yTile, this.zTile); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if (block.getMaterial() != Material.air) + { + block.setBlockBoundsBasedOnState(this.worldObj, blockpos); + AxisAlignedBB axisalignedbb = block.getCollisionBoundingBox(this.worldObj, blockpos, iblockstate); + + if (axisalignedbb != null && axisalignedbb.isVecInside(new Vec3(this.posX, this.posY, this.posZ))) + { + this.inGround = true; + } + } + + if (this.arrowShake > 0) + { + --this.arrowShake; + } + + if (this.inGround) + { + int j = block.getMetaFromState(iblockstate); + + if (block == this.inTile && j == this.inData) + { + ++this.ticksInGround; + + if (this.ticksInGround >= 1200) + { + this.setDead(); + } + } + else + { + this.inGround = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; + } + } + else + { + ++this.ticksInAir; + Vec3 vec31 = new Vec3(this.posX, this.posY, this.posZ); + Vec3 vec3 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec31, vec3, false, true, false); + vec31 = new Vec3(this.posX, this.posY, this.posZ); + vec3 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (movingobjectposition != null) + { + vec3 = new Vec3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + } + + Entity entity = null; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double d0 = 0.0D; + + for (int i = 0; i < list.size(); ++i) + { + Entity entity1 = (Entity)list.get(i); + + if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) + { + float f1 = 0.3F; + AxisAlignedBB axisalignedbb1 = entity1.getEntityBoundingBox().expand((double)f1, (double)f1, (double)f1); + MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3); + + if (movingobjectposition1 != null) + { + double d1 = vec31.squareDistanceTo(movingobjectposition1.hitVec); + + if (d1 < d0 || d0 == 0.0D) + { + entity = entity1; + d0 = d1; + } + } + } + } + + if (entity != null) + { + movingobjectposition = new MovingObjectPosition(entity); + } + + if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit; + + if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer)) + { + movingobjectposition = null; + } + } + + if (movingobjectposition != null) + { + if (movingobjectposition.entityHit != null) + { + float f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + int l = MathHelper.ceiling_double_int((double)f2 * this.damage); + + if (this.getIsCritical()) + { + l += this.rand.nextInt(l / 2 + 2); + } + + DamageSource damagesource; + + if (this.shootingEntity == null) + { + damagesource = DamageSource.causeArrowDamage(this, this); + } + else + { + damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity); + } + + if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) + { + movingobjectposition.entityHit.setFire(5); + } + + if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float)l)) + { + if (movingobjectposition.entityHit instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit; + + if (!this.worldObj.isRemote) + { + entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1); + } + + if (this.knockbackStrength > 0) + { + float f7 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (f7 > 0.0F) + { + movingobjectposition.entityHit.addVelocity(this.motionX * (double)this.knockbackStrength * 0.6000000238418579D / (double)f7, 0.1D, this.motionZ * (double)this.knockbackStrength * 0.6000000238418579D / (double)f7); + } + } + + if (this.shootingEntity instanceof EntityLivingBase) + { + EnchantmentHelper.applyThornEnchantments(entitylivingbase, this.shootingEntity); + EnchantmentHelper.applyArthropodEnchantments((EntityLivingBase)this.shootingEntity, entitylivingbase); + } + + if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) + { + ((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F)); + } + } + + this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + + if (!(movingobjectposition.entityHit instanceof EntityEnderman)) + { + this.setDead(); + } + } + else + { + this.motionX *= -0.10000000149011612D; + this.motionY *= -0.10000000149011612D; + this.motionZ *= -0.10000000149011612D; + this.rotationYaw += 180.0F; + this.prevRotationYaw += 180.0F; + this.ticksInAir = 0; + } + } + else + { + BlockPos blockpos1 = movingobjectposition.getBlockPos(); + this.xTile = blockpos1.getX(); + this.yTile = blockpos1.getY(); + this.zTile = blockpos1.getZ(); + IBlockState iblockstate1 = this.worldObj.getBlockState(blockpos1); + this.inTile = iblockstate1.getBlock(); + this.inData = this.inTile.getMetaFromState(iblockstate1); + this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX)); + this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY)); + this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ)); + float f5 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + this.posX -= this.motionX / (double)f5 * 0.05000000074505806D; + this.posY -= this.motionY / (double)f5 * 0.05000000074505806D; + this.posZ -= this.motionZ / (double)f5 * 0.05000000074505806D; + this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + this.inGround = true; + this.arrowShake = 7; + this.setIsCritical(false); + + if (this.inTile.getMaterial() != Material.air) + { + this.inTile.onEntityCollidedWithBlock(this.worldObj, blockpos1, iblockstate1, this); + } + } + } + + if (this.getIsCritical()) + { + for (int k = 0; k < 4; ++k) + { + this.worldObj.spawnParticle(EnumParticleTypes.CRIT, this.posX + this.motionX * (double)k / 4.0D, this.posY + this.motionY * (double)k / 4.0D, this.posZ + this.motionZ * (double)k / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ, new int[0]); + } + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(MathHelper.func_181159_b(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float)(MathHelper.func_181159_b(this.motionY, (double)f3) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float f4 = 0.99F; + float f6 = 0.05F; + + if (this.isInWater()) + { + for (int i1 = 0; i1 < 4; ++i1) + { + float f8 = 0.25F; + this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * (double)f8, this.posY - this.motionY * (double)f8, this.posZ - this.motionZ * (double)f8, this.motionX, this.motionY, this.motionZ, new int[0]); + } + + f4 = 0.6F; + } + + if (this.isWet()) + { + this.extinguish(); + } + + this.motionX *= (double)f4; + this.motionY *= (double)f4; + this.motionZ *= (double)f4; + this.motionY -= (double)f6; + this.setPosition(this.posX, this.posY, this.posZ); + this.doBlockCollisions(); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + tagCompound.setShort("xTile", (short)this.xTile); + tagCompound.setShort("yTile", (short)this.yTile); + tagCompound.setShort("zTile", (short)this.zTile); + tagCompound.setShort("life", (short)this.ticksInGround); + ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile); + tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString()); + tagCompound.setByte("inData", (byte)this.inData); + tagCompound.setByte("shake", (byte)this.arrowShake); + tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + tagCompound.setByte("pickup", (byte)this.canBePickedUp); + tagCompound.setDouble("damage", this.damage); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + this.xTile = tagCompund.getShort("xTile"); + this.yTile = tagCompund.getShort("yTile"); + this.zTile = tagCompund.getShort("zTile"); + this.ticksInGround = tagCompund.getShort("life"); + + if (tagCompund.hasKey("inTile", 8)) + { + this.inTile = Block.getBlockFromName(tagCompund.getString("inTile")); + } + else + { + this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255); + } + + this.inData = tagCompund.getByte("inData") & 255; + this.arrowShake = tagCompund.getByte("shake") & 255; + this.inGround = tagCompund.getByte("inGround") == 1; + + if (tagCompund.hasKey("damage", 99)) + { + this.damage = tagCompund.getDouble("damage"); + } + + if (tagCompund.hasKey("pickup", 99)) + { + this.canBePickedUp = tagCompund.getByte("pickup"); + } + else if (tagCompund.hasKey("player", 99)) + { + this.canBePickedUp = tagCompund.getBoolean("player") ? 1 : 0; + } + } + + /** + * Called by a player entity when they collide with an entity + */ + public void onCollideWithPlayer(EntityPlayer entityIn) + { + if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) + { + boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && entityIn.capabilities.isCreativeMode; + + if (this.canBePickedUp == 1 && !entityIn.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1))) + { + flag = false; + } + + if (flag) + { + this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + entityIn.onItemPickup(this, 1); + this.setDead(); + } + } + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + public void setDamage(double damageIn) + { + this.damage = damageIn; + } + + public double getDamage() + { + return this.damage; + } + + /** + * Sets the amount of knockback the arrow applies when it hits a mob. + */ + public void setKnockbackStrength(int knockbackStrengthIn) + { + this.knockbackStrength = knockbackStrengthIn; + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } + + public float getEyeHeight() + { + return 0.0F; + } + + /** + * Whether the arrow has a stream of critical hit particles flying behind it. + */ + public void setIsCritical(boolean critical) + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + + if (critical) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2))); + } + } + + /** + * Whether the arrow has a stream of critical hit particles flying behind it. + */ + public boolean getIsCritical() + { + byte b0 = this.dataWatcher.getWatchableObjectByte(16); + return (b0 & 1) != 0; + } +} diff --git a/src/minecraft/net/minecraft/entity/projectile/EntityEgg.java b/src/minecraft/net/minecraft/entity/projectile/EntityEgg.java new file mode 100644 index 0000000..15e8a62 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/projectile/EntityEgg.java @@ -0,0 +1,69 @@ +package net.minecraft.entity.projectile; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class EntityEgg extends EntityThrowable +{ + public EntityEgg(World worldIn) + { + super(worldIn); + } + + public EntityEgg(World worldIn, EntityLivingBase throwerIn) + { + super(worldIn, throwerIn); + } + + public EntityEgg(World worldIn, double x, double y, double z) + { + super(worldIn, x, y, z); + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected void onImpact(MovingObjectPosition p_70184_1_) + { + if (p_70184_1_.entityHit != null) + { + p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F); + } + + if (!this.worldObj.isRemote && this.rand.nextInt(8) == 0) + { + int i = 1; + + if (this.rand.nextInt(32) == 0) + { + i = 4; + } + + for (int j = 0; j < i; ++j) + { + EntityChicken entitychicken = new EntityChicken(this.worldObj); + entitychicken.setGrowingAge(-24000); + entitychicken.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); + this.worldObj.spawnEntityInWorld(entitychicken); + } + } + + double d0 = 0.08D; + + for (int k = 0; k < 8; ++k) + { + this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, new int[] {Item.getIdFromItem(Items.egg)}); + } + + if (!this.worldObj.isRemote) + { + this.setDead(); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/projectile/EntityFireball.java b/src/minecraft/net/minecraft/entity/projectile/EntityFireball.java new file mode 100644 index 0000000..f86d465 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/projectile/EntityFireball.java @@ -0,0 +1,355 @@ +package net.minecraft.entity.projectile; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public abstract class EntityFireball extends Entity +{ + private int xTile = -1; + private int yTile = -1; + private int zTile = -1; + private Block inTile; + private boolean inGround; + public EntityLivingBase shootingEntity; + private int ticksAlive; + private int ticksInAir; + public double accelerationX; + public double accelerationY; + public double accelerationZ; + + public EntityFireball(World worldIn) + { + super(worldIn); + this.setSize(1.0F, 1.0F); + } + + protected void entityInit() + { + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double distance) + { + double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D; + + if (Double.isNaN(d0)) + { + d0 = 4.0D; + } + + d0 = d0 * 64.0D; + return distance < d0 * d0; + } + + public EntityFireball(World worldIn, double x, double y, double z, double accelX, double accelY, double accelZ) + { + super(worldIn); + this.setSize(1.0F, 1.0F); + this.setLocationAndAngles(x, y, z, this.rotationYaw, this.rotationPitch); + this.setPosition(x, y, z); + double d0 = (double)MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ); + this.accelerationX = accelX / d0 * 0.1D; + this.accelerationY = accelY / d0 * 0.1D; + this.accelerationZ = accelZ / d0 * 0.1D; + } + + public EntityFireball(World worldIn, EntityLivingBase shooter, double accelX, double accelY, double accelZ) + { + super(worldIn); + this.shootingEntity = shooter; + this.setSize(1.0F, 1.0F); + this.setLocationAndAngles(shooter.posX, shooter.posY, shooter.posZ, shooter.rotationYaw, shooter.rotationPitch); + this.setPosition(this.posX, this.posY, this.posZ); + this.motionX = this.motionY = this.motionZ = 0.0D; + accelX = accelX + this.rand.nextGaussian() * 0.4D; + accelY = accelY + this.rand.nextGaussian() * 0.4D; + accelZ = accelZ + this.rand.nextGaussian() * 0.4D; + double d0 = (double)MathHelper.sqrt_double(accelX * accelX + accelY * accelY + accelZ * accelZ); + this.accelerationX = accelX / d0 * 0.1D; + this.accelerationY = accelY / d0 * 0.1D; + this.accelerationZ = accelZ / d0 * 0.1D; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (this.worldObj.isRemote || (this.shootingEntity == null || !this.shootingEntity.isDead) && this.worldObj.isBlockLoaded(new BlockPos(this))) + { + super.onUpdate(); + this.setFire(1); + + if (this.inGround) + { + if (this.worldObj.getBlockState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile) + { + ++this.ticksAlive; + + if (this.ticksAlive == 600) + { + this.setDead(); + } + + return; + } + + this.inGround = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.ticksAlive = 0; + this.ticksInAir = 0; + } + else + { + ++this.ticksInAir; + } + + Vec3 vec3 = new Vec3(this.posX, this.posY, this.posZ); + Vec3 vec31 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31); + vec3 = new Vec3(this.posX, this.posY, this.posZ); + vec31 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (movingobjectposition != null) + { + vec31 = new Vec3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + } + + Entity entity = null; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double d0 = 0.0D; + + for (int i = 0; i < list.size(); ++i) + { + Entity entity1 = (Entity)list.get(i); + + if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) + { + float f = 0.3F; + AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand((double)f, (double)f, (double)f); + MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); + + if (movingobjectposition1 != null) + { + double d1 = vec3.squareDistanceTo(movingobjectposition1.hitVec); + + if (d1 < d0 || d0 == 0.0D) + { + entity = entity1; + d0 = d1; + } + } + } + } + + if (entity != null) + { + movingobjectposition = new MovingObjectPosition(entity); + } + + if (movingobjectposition != null) + { + this.onImpact(movingobjectposition); + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(MathHelper.func_181159_b(this.motionZ, this.motionX) * 180.0D / Math.PI) + 90.0F; + + for (this.rotationPitch = (float)(MathHelper.func_181159_b((double)f1, this.motionY) * 180.0D / Math.PI) - 90.0F; this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float f2 = this.getMotionFactor(); + + if (this.isInWater()) + { + for (int j = 0; j < 4; ++j) + { + float f3 = 0.25F; + this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ, new int[0]); + } + + f2 = 0.8F; + } + + this.motionX += this.accelerationX; + this.motionY += this.accelerationY; + this.motionZ += this.accelerationZ; + this.motionX *= (double)f2; + this.motionY *= (double)f2; + this.motionZ *= (double)f2; + this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); + this.setPosition(this.posX, this.posY, this.posZ); + } + else + { + this.setDead(); + } + } + + /** + * Return the motion factor for this projectile. The factor is multiplied by the original motion. + */ + protected float getMotionFactor() + { + return 0.95F; + } + + /** + * Called when this EntityFireball hits a block or entity. + */ + protected abstract void onImpact(MovingObjectPosition movingObject); + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + tagCompound.setShort("xTile", (short)this.xTile); + tagCompound.setShort("yTile", (short)this.yTile); + tagCompound.setShort("zTile", (short)this.zTile); + ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile); + tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString()); + tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + tagCompound.setTag("direction", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ})); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + this.xTile = tagCompund.getShort("xTile"); + this.yTile = tagCompund.getShort("yTile"); + this.zTile = tagCompund.getShort("zTile"); + + if (tagCompund.hasKey("inTile", 8)) + { + this.inTile = Block.getBlockFromName(tagCompund.getString("inTile")); + } + else + { + this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255); + } + + this.inGround = tagCompund.getByte("inGround") == 1; + + if (tagCompund.hasKey("direction", 9)) + { + NBTTagList nbttaglist = tagCompund.getTagList("direction", 6); + this.motionX = nbttaglist.getDoubleAt(0); + this.motionY = nbttaglist.getDoubleAt(1); + this.motionZ = nbttaglist.getDoubleAt(2); + } + else + { + this.setDead(); + } + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return true; + } + + public float getCollisionBorderSize() + { + return 1.0F; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + if (this.isEntityInvulnerable(source)) + { + return false; + } + else + { + this.setBeenAttacked(); + + if (source.getEntity() != null) + { + Vec3 vec3 = source.getEntity().getLookVec(); + + if (vec3 != null) + { + this.motionX = vec3.xCoord; + this.motionY = vec3.yCoord; + this.motionZ = vec3.zCoord; + this.accelerationX = this.motionX * 0.1D; + this.accelerationY = this.motionY * 0.1D; + this.accelerationZ = this.motionZ * 0.1D; + } + + if (source.getEntity() instanceof EntityLivingBase) + { + this.shootingEntity = (EntityLivingBase)source.getEntity(); + } + + return true; + } + else + { + return false; + } + } + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float partialTicks) + { + return 1.0F; + } + + public int getBrightnessForRender(float partialTicks) + { + return 15728880; + } +} diff --git a/src/minecraft/net/minecraft/entity/projectile/EntityFishHook.java b/src/minecraft/net/minecraft/entity/projectile/EntityFishHook.java new file mode 100644 index 0000000..b452e0b --- /dev/null +++ b/src/minecraft/net/minecraft/entity/projectile/EntityFishHook.java @@ -0,0 +1,622 @@ +package net.minecraft.entity.projectile; + +import java.util.Arrays; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.ItemFishFood; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.stats.StatList; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.util.WeightedRandom; +import net.minecraft.util.WeightedRandomFishable; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public class EntityFishHook extends Entity +{ + private static final List JUNK = Arrays.asList(new WeightedRandomFishable[] {(new WeightedRandomFishable(new ItemStack(Items.leather_boots), 10)).setMaxDamagePercent(0.9F), new WeightedRandomFishable(new ItemStack(Items.leather), 10), new WeightedRandomFishable(new ItemStack(Items.bone), 10), new WeightedRandomFishable(new ItemStack(Items.potionitem), 10), new WeightedRandomFishable(new ItemStack(Items.string), 5), (new WeightedRandomFishable(new ItemStack(Items.fishing_rod), 2)).setMaxDamagePercent(0.9F), new WeightedRandomFishable(new ItemStack(Items.bowl), 10), new WeightedRandomFishable(new ItemStack(Items.stick), 5), new WeightedRandomFishable(new ItemStack(Items.dye, 10, EnumDyeColor.BLACK.getDyeDamage()), 1), new WeightedRandomFishable(new ItemStack(Blocks.tripwire_hook), 10), new WeightedRandomFishable(new ItemStack(Items.rotten_flesh), 10)}); + private static final List TREASURE = Arrays.asList(new WeightedRandomFishable[] {new WeightedRandomFishable(new ItemStack(Blocks.waterlily), 1), new WeightedRandomFishable(new ItemStack(Items.name_tag), 1), new WeightedRandomFishable(new ItemStack(Items.saddle), 1), (new WeightedRandomFishable(new ItemStack(Items.bow), 1)).setMaxDamagePercent(0.25F).setEnchantable(), (new WeightedRandomFishable(new ItemStack(Items.fishing_rod), 1)).setMaxDamagePercent(0.25F).setEnchantable(), (new WeightedRandomFishable(new ItemStack(Items.book), 1)).setEnchantable()}); + private static final List FISH = Arrays.asList(new WeightedRandomFishable[] {new WeightedRandomFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.COD.getMetadata()), 60), new WeightedRandomFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.SALMON.getMetadata()), 25), new WeightedRandomFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.CLOWNFISH.getMetadata()), 2), new WeightedRandomFishable(new ItemStack(Items.fish, 1, ItemFishFood.FishType.PUFFERFISH.getMetadata()), 13)}); + private int xTile; + private int yTile; + private int zTile; + private Block inTile; + private boolean inGround; + public int shake; + public EntityPlayer angler; + private int ticksInGround; + private int ticksInAir; + private int ticksCatchable; + private int ticksCaughtDelay; + private int ticksCatchableDelay; + private float fishApproachAngle; + public Entity caughtEntity; + private int fishPosRotationIncrements; + private double fishX; + private double fishY; + private double fishZ; + private double fishYaw; + private double fishPitch; + private double clientMotionX; + private double clientMotionY; + private double clientMotionZ; + + public static List func_174855_j() + { + return FISH; + } + + public EntityFishHook(World worldIn) + { + super(worldIn); + this.xTile = -1; + this.yTile = -1; + this.zTile = -1; + this.setSize(0.25F, 0.25F); + this.ignoreFrustumCheck = true; + } + + public EntityFishHook(World worldIn, double x, double y, double z, EntityPlayer anglerIn) + { + this(worldIn); + this.setPosition(x, y, z); + this.ignoreFrustumCheck = true; + this.angler = anglerIn; + anglerIn.fishEntity = this; + } + + public EntityFishHook(World worldIn, EntityPlayer fishingPlayer) + { + super(worldIn); + this.xTile = -1; + this.yTile = -1; + this.zTile = -1; + this.ignoreFrustumCheck = true; + this.angler = fishingPlayer; + this.angler.fishEntity = this; + this.setSize(0.25F, 0.25F); + this.setLocationAndAngles(fishingPlayer.posX, fishingPlayer.posY + (double)fishingPlayer.getEyeHeight(), fishingPlayer.posZ, fishingPlayer.rotationYaw, fishingPlayer.rotationPitch); + this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.posY -= 0.10000000149011612D; + this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.setPosition(this.posX, this.posY, this.posZ); + float f = 0.4F; + this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f); + this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f); + this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * f); + this.handleHookCasting(this.motionX, this.motionY, this.motionZ, 1.5F, 1.0F); + } + + protected void entityInit() + { + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double distance) + { + double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D; + + if (Double.isNaN(d0)) + { + d0 = 4.0D; + } + + d0 = d0 * 64.0D; + return distance < d0 * d0; + } + + public void handleHookCasting(double p_146035_1_, double p_146035_3_, double p_146035_5_, float p_146035_7_, float p_146035_8_) + { + float f = MathHelper.sqrt_double(p_146035_1_ * p_146035_1_ + p_146035_3_ * p_146035_3_ + p_146035_5_ * p_146035_5_); + p_146035_1_ = p_146035_1_ / (double)f; + p_146035_3_ = p_146035_3_ / (double)f; + p_146035_5_ = p_146035_5_ / (double)f; + p_146035_1_ = p_146035_1_ + this.rand.nextGaussian() * 0.007499999832361937D * (double)p_146035_8_; + p_146035_3_ = p_146035_3_ + this.rand.nextGaussian() * 0.007499999832361937D * (double)p_146035_8_; + p_146035_5_ = p_146035_5_ + this.rand.nextGaussian() * 0.007499999832361937D * (double)p_146035_8_; + p_146035_1_ = p_146035_1_ * (double)p_146035_7_; + p_146035_3_ = p_146035_3_ * (double)p_146035_7_; + p_146035_5_ = p_146035_5_ * (double)p_146035_7_; + this.motionX = p_146035_1_; + this.motionY = p_146035_3_; + this.motionZ = p_146035_5_; + float f1 = MathHelper.sqrt_double(p_146035_1_ * p_146035_1_ + p_146035_5_ * p_146035_5_); + this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.func_181159_b(p_146035_1_, p_146035_5_) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.func_181159_b(p_146035_3_, (double)f1) * 180.0D / Math.PI); + this.ticksInGround = 0; + } + + public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + { + this.fishX = x; + this.fishY = y; + this.fishZ = z; + this.fishYaw = (double)yaw; + this.fishPitch = (double)pitch; + this.fishPosRotationIncrements = posRotationIncrements; + this.motionX = this.clientMotionX; + this.motionY = this.clientMotionY; + this.motionZ = this.clientMotionZ; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double x, double y, double z) + { + this.clientMotionX = this.motionX = x; + this.clientMotionY = this.motionY = y; + this.clientMotionZ = this.motionZ = z; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.fishPosRotationIncrements > 0) + { + double d7 = this.posX + (this.fishX - this.posX) / (double)this.fishPosRotationIncrements; + double d8 = this.posY + (this.fishY - this.posY) / (double)this.fishPosRotationIncrements; + double d9 = this.posZ + (this.fishZ - this.posZ) / (double)this.fishPosRotationIncrements; + double d1 = MathHelper.wrapAngleTo180_double(this.fishYaw - (double)this.rotationYaw); + this.rotationYaw = (float)((double)this.rotationYaw + d1 / (double)this.fishPosRotationIncrements); + this.rotationPitch = (float)((double)this.rotationPitch + (this.fishPitch - (double)this.rotationPitch) / (double)this.fishPosRotationIncrements); + --this.fishPosRotationIncrements; + this.setPosition(d7, d8, d9); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + else + { + if (!this.worldObj.isRemote) + { + ItemStack itemstack = this.angler.getCurrentEquippedItem(); + + if (this.angler.isDead || !this.angler.isEntityAlive() || itemstack == null || itemstack.getItem() != Items.fishing_rod || this.getDistanceSqToEntity(this.angler) > 1024.0D) + { + this.setDead(); + this.angler.fishEntity = null; + return; + } + + if (this.caughtEntity != null) + { + if (!this.caughtEntity.isDead) + { + this.posX = this.caughtEntity.posX; + double d17 = (double)this.caughtEntity.height; + this.posY = this.caughtEntity.getEntityBoundingBox().minY + d17 * 0.8D; + this.posZ = this.caughtEntity.posZ; + return; + } + + this.caughtEntity = null; + } + } + + if (this.shake > 0) + { + --this.shake; + } + + if (this.inGround) + { + if (this.worldObj.getBlockState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile) + { + ++this.ticksInGround; + + if (this.ticksInGround == 1200) + { + this.setDead(); + } + + return; + } + + this.inGround = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; + } + else + { + ++this.ticksInAir; + } + + Vec3 vec31 = new Vec3(this.posX, this.posY, this.posZ); + Vec3 vec3 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec31, vec3); + vec31 = new Vec3(this.posX, this.posY, this.posZ); + vec3 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (movingobjectposition != null) + { + vec3 = new Vec3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + } + + Entity entity = null; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double d0 = 0.0D; + + for (int i = 0; i < list.size(); ++i) + { + Entity entity1 = (Entity)list.get(i); + + if (entity1.canBeCollidedWith() && (entity1 != this.angler || this.ticksInAir >= 5)) + { + float f = 0.3F; + AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand((double)f, (double)f, (double)f); + MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec31, vec3); + + if (movingobjectposition1 != null) + { + double d2 = vec31.squareDistanceTo(movingobjectposition1.hitVec); + + if (d2 < d0 || d0 == 0.0D) + { + entity = entity1; + d0 = d2; + } + } + } + } + + if (entity != null) + { + movingobjectposition = new MovingObjectPosition(entity); + } + + if (movingobjectposition != null) + { + if (movingobjectposition.entityHit != null) + { + if (movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.angler), 0.0F)) + { + this.caughtEntity = movingobjectposition.entityHit; + } + } + else + { + this.inGround = true; + } + } + + if (!this.inGround) + { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + float f5 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(MathHelper.func_181159_b(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float)(MathHelper.func_181159_b(this.motionY, (double)f5) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float f6 = 0.92F; + + if (this.onGround || this.isCollidedHorizontally) + { + f6 = 0.5F; + } + + int j = 5; + double d10 = 0.0D; + + for (int k = 0; k < j; ++k) + { + AxisAlignedBB axisalignedbb1 = this.getEntityBoundingBox(); + double d3 = axisalignedbb1.maxY - axisalignedbb1.minY; + double d4 = axisalignedbb1.minY + d3 * (double)k / (double)j; + double d5 = axisalignedbb1.minY + d3 * (double)(k + 1) / (double)j; + AxisAlignedBB axisalignedbb2 = new AxisAlignedBB(axisalignedbb1.minX, d4, axisalignedbb1.minZ, axisalignedbb1.maxX, d5, axisalignedbb1.maxZ); + + if (this.worldObj.isAABBInMaterial(axisalignedbb2, Material.water)) + { + d10 += 1.0D / (double)j; + } + } + + if (!this.worldObj.isRemote && d10 > 0.0D) + { + WorldServer worldserver = (WorldServer)this.worldObj; + int l = 1; + BlockPos blockpos = (new BlockPos(this)).up(); + + if (this.rand.nextFloat() < 0.25F && this.worldObj.canLightningStrike(blockpos)) + { + l = 2; + } + + if (this.rand.nextFloat() < 0.5F && !this.worldObj.canSeeSky(blockpos)) + { + --l; + } + + if (this.ticksCatchable > 0) + { + --this.ticksCatchable; + + if (this.ticksCatchable <= 0) + { + this.ticksCaughtDelay = 0; + this.ticksCatchableDelay = 0; + } + } + else if (this.ticksCatchableDelay > 0) + { + this.ticksCatchableDelay -= l; + + if (this.ticksCatchableDelay <= 0) + { + this.motionY -= 0.20000000298023224D; + this.playSound("random.splash", 0.25F, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + float f8 = (float)MathHelper.floor_double(this.getEntityBoundingBox().minY); + worldserver.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D, new int[0]); + worldserver.spawnParticle(EnumParticleTypes.WATER_WAKE, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D, new int[0]); + this.ticksCatchable = MathHelper.getRandomIntegerInRange(this.rand, 10, 30); + } + else + { + this.fishApproachAngle = (float)((double)this.fishApproachAngle + this.rand.nextGaussian() * 4.0D); + float f7 = this.fishApproachAngle * 0.017453292F; + float f10 = MathHelper.sin(f7); + float f11 = MathHelper.cos(f7); + double d13 = this.posX + (double)(f10 * (float)this.ticksCatchableDelay * 0.1F); + double d15 = (double)((float)MathHelper.floor_double(this.getEntityBoundingBox().minY) + 1.0F); + double d16 = this.posZ + (double)(f11 * (float)this.ticksCatchableDelay * 0.1F); + Block block1 = worldserver.getBlockState(new BlockPos((int)d13, (int)d15 - 1, (int)d16)).getBlock(); + + if (block1 == Blocks.water || block1 == Blocks.flowing_water) + { + if (this.rand.nextFloat() < 0.15F) + { + worldserver.spawnParticle(EnumParticleTypes.WATER_BUBBLE, d13, d15 - 0.10000000149011612D, d16, 1, (double)f10, 0.1D, (double)f11, 0.0D, new int[0]); + } + + float f3 = f10 * 0.04F; + float f4 = f11 * 0.04F; + worldserver.spawnParticle(EnumParticleTypes.WATER_WAKE, d13, d15, d16, 0, (double)f4, 0.01D, (double)(-f3), 1.0D, new int[0]); + worldserver.spawnParticle(EnumParticleTypes.WATER_WAKE, d13, d15, d16, 0, (double)(-f4), 0.01D, (double)f3, 1.0D, new int[0]); + } + } + } + else if (this.ticksCaughtDelay > 0) + { + this.ticksCaughtDelay -= l; + float f1 = 0.15F; + + if (this.ticksCaughtDelay < 20) + { + f1 = (float)((double)f1 + (double)(20 - this.ticksCaughtDelay) * 0.05D); + } + else if (this.ticksCaughtDelay < 40) + { + f1 = (float)((double)f1 + (double)(40 - this.ticksCaughtDelay) * 0.02D); + } + else if (this.ticksCaughtDelay < 60) + { + f1 = (float)((double)f1 + (double)(60 - this.ticksCaughtDelay) * 0.01D); + } + + if (this.rand.nextFloat() < f1) + { + float f9 = MathHelper.randomFloatClamp(this.rand, 0.0F, 360.0F) * 0.017453292F; + float f2 = MathHelper.randomFloatClamp(this.rand, 25.0F, 60.0F); + double d12 = this.posX + (double)(MathHelper.sin(f9) * f2 * 0.1F); + double d14 = (double)((float)MathHelper.floor_double(this.getEntityBoundingBox().minY) + 1.0F); + double d6 = this.posZ + (double)(MathHelper.cos(f9) * f2 * 0.1F); + Block block = worldserver.getBlockState(new BlockPos((int)d12, (int)d14 - 1, (int)d6)).getBlock(); + + if (block == Blocks.water || block == Blocks.flowing_water) + { + worldserver.spawnParticle(EnumParticleTypes.WATER_SPLASH, d12, d14, d6, 2 + this.rand.nextInt(2), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D, new int[0]); + } + } + + if (this.ticksCaughtDelay <= 0) + { + this.fishApproachAngle = MathHelper.randomFloatClamp(this.rand, 0.0F, 360.0F); + this.ticksCatchableDelay = MathHelper.getRandomIntegerInRange(this.rand, 20, 80); + } + } + else + { + this.ticksCaughtDelay = MathHelper.getRandomIntegerInRange(this.rand, 100, 900); + this.ticksCaughtDelay -= EnchantmentHelper.getLureModifier(this.angler) * 20 * 5; + } + + if (this.ticksCatchable > 0) + { + this.motionY -= (double)(this.rand.nextFloat() * this.rand.nextFloat() * this.rand.nextFloat()) * 0.2D; + } + } + + double d11 = d10 * 2.0D - 1.0D; + this.motionY += 0.03999999910593033D * d11; + + if (d10 > 0.0D) + { + f6 = (float)((double)f6 * 0.9D); + this.motionY *= 0.8D; + } + + this.motionX *= (double)f6; + this.motionY *= (double)f6; + this.motionZ *= (double)f6; + this.setPosition(this.posX, this.posY, this.posZ); + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + tagCompound.setShort("xTile", (short)this.xTile); + tagCompound.setShort("yTile", (short)this.yTile); + tagCompound.setShort("zTile", (short)this.zTile); + ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile); + tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString()); + tagCompound.setByte("shake", (byte)this.shake); + tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + this.xTile = tagCompund.getShort("xTile"); + this.yTile = tagCompund.getShort("yTile"); + this.zTile = tagCompund.getShort("zTile"); + + if (tagCompund.hasKey("inTile", 8)) + { + this.inTile = Block.getBlockFromName(tagCompund.getString("inTile")); + } + else + { + this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255); + } + + this.shake = tagCompund.getByte("shake") & 255; + this.inGround = tagCompund.getByte("inGround") == 1; + } + + public int handleHookRetraction() + { + if (this.worldObj.isRemote) + { + return 0; + } + else + { + int i = 0; + + if (this.caughtEntity != null) + { + double d0 = this.angler.posX - this.posX; + double d2 = this.angler.posY - this.posY; + double d4 = this.angler.posZ - this.posZ; + double d6 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2 + d4 * d4); + double d8 = 0.1D; + this.caughtEntity.motionX += d0 * d8; + this.caughtEntity.motionY += d2 * d8 + (double)MathHelper.sqrt_double(d6) * 0.08D; + this.caughtEntity.motionZ += d4 * d8; + i = 3; + } + else if (this.ticksCatchable > 0) + { + EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, this.getFishingResult()); + double d1 = this.angler.posX - this.posX; + double d3 = this.angler.posY - this.posY; + double d5 = this.angler.posZ - this.posZ; + double d7 = (double)MathHelper.sqrt_double(d1 * d1 + d3 * d3 + d5 * d5); + double d9 = 0.1D; + entityitem.motionX = d1 * d9; + entityitem.motionY = d3 * d9 + (double)MathHelper.sqrt_double(d7) * 0.08D; + entityitem.motionZ = d5 * d9; + this.worldObj.spawnEntityInWorld(entityitem); + this.angler.worldObj.spawnEntityInWorld(new EntityXPOrb(this.angler.worldObj, this.angler.posX, this.angler.posY + 0.5D, this.angler.posZ + 0.5D, this.rand.nextInt(6) + 1)); + i = 1; + } + + if (this.inGround) + { + i = 2; + } + + this.setDead(); + this.angler.fishEntity = null; + return i; + } + } + + private ItemStack getFishingResult() + { + float f = this.worldObj.rand.nextFloat(); + int i = EnchantmentHelper.getLuckOfSeaModifier(this.angler); + int j = EnchantmentHelper.getLureModifier(this.angler); + float f1 = 0.1F - (float)i * 0.025F - (float)j * 0.01F; + float f2 = 0.05F + (float)i * 0.01F - (float)j * 0.01F; + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F); + + if (f < f1) + { + this.angler.triggerAchievement(StatList.junkFishedStat); + return ((WeightedRandomFishable)WeightedRandom.getRandomItem(this.rand, JUNK)).getItemStack(this.rand); + } + else + { + f = f - f1; + + if (f < f2) + { + this.angler.triggerAchievement(StatList.treasureFishedStat); + return ((WeightedRandomFishable)WeightedRandom.getRandomItem(this.rand, TREASURE)).getItemStack(this.rand); + } + else + { + float f3 = f - f2; + this.angler.triggerAchievement(StatList.fishCaughtStat); + return ((WeightedRandomFishable)WeightedRandom.getRandomItem(this.rand, FISH)).getItemStack(this.rand); + } + } + } + + /** + * Will get destroyed next tick. + */ + public void setDead() + { + super.setDead(); + + if (this.angler != null) + { + this.angler.fishEntity = null; + } + } +} diff --git a/src/minecraft/net/minecraft/entity/projectile/EntityLargeFireball.java b/src/minecraft/net/minecraft/entity/projectile/EntityLargeFireball.java new file mode 100644 index 0000000..c201e92 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/projectile/EntityLargeFireball.java @@ -0,0 +1,69 @@ +package net.minecraft.entity.projectile; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class EntityLargeFireball extends EntityFireball +{ + public int explosionPower = 1; + + public EntityLargeFireball(World worldIn) + { + super(worldIn); + } + + public EntityLargeFireball(World worldIn, double x, double y, double z, double accelX, double accelY, double accelZ) + { + super(worldIn, x, y, z, accelX, accelY, accelZ); + } + + public EntityLargeFireball(World worldIn, EntityLivingBase shooter, double accelX, double accelY, double accelZ) + { + super(worldIn, shooter, accelX, accelY, accelZ); + } + + /** + * Called when this EntityFireball hits a block or entity. + */ + protected void onImpact(MovingObjectPosition movingObject) + { + if (!this.worldObj.isRemote) + { + if (movingObject.entityHit != null) + { + movingObject.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 6.0F); + this.applyEnchantments(this.shootingEntity, movingObject.entityHit); + } + + boolean flag = this.worldObj.getGameRules().getBoolean("mobGriefing"); + this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, (float)this.explosionPower, flag, flag); + this.setDead(); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + tagCompound.setInteger("ExplosionPower", this.explosionPower); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + + if (tagCompund.hasKey("ExplosionPower", 99)) + { + this.explosionPower = tagCompund.getInteger("ExplosionPower"); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/projectile/EntityPotion.java b/src/minecraft/net/minecraft/entity/projectile/EntityPotion.java new file mode 100644 index 0000000..8699579 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/projectile/EntityPotion.java @@ -0,0 +1,184 @@ +package net.minecraft.entity.projectile; + +import java.util.List; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class EntityPotion extends EntityThrowable +{ + /** + * The damage value of the thrown potion that this EntityPotion represents. + */ + private ItemStack potionDamage; + + public EntityPotion(World worldIn) + { + super(worldIn); + } + + public EntityPotion(World worldIn, EntityLivingBase throwerIn, int meta) + { + this(worldIn, throwerIn, new ItemStack(Items.potionitem, 1, meta)); + } + + public EntityPotion(World worldIn, EntityLivingBase throwerIn, ItemStack potionDamageIn) + { + super(worldIn, throwerIn); + this.potionDamage = potionDamageIn; + } + + public EntityPotion(World worldIn, double x, double y, double z, int p_i1791_8_) + { + this(worldIn, x, y, z, new ItemStack(Items.potionitem, 1, p_i1791_8_)); + } + + public EntityPotion(World worldIn, double x, double y, double z, ItemStack potionDamageIn) + { + super(worldIn, x, y, z); + this.potionDamage = potionDamageIn; + } + + /** + * Gets the amount of gravity to apply to the thrown entity with each tick. + */ + protected float getGravityVelocity() + { + return 0.05F; + } + + protected float getVelocity() + { + return 0.5F; + } + + protected float getInaccuracy() + { + return -20.0F; + } + + /** + * Sets the PotionEffect by the given id of the potion effect. + */ + public void setPotionDamage(int potionId) + { + if (this.potionDamage == null) + { + this.potionDamage = new ItemStack(Items.potionitem, 1, 0); + } + + this.potionDamage.setItemDamage(potionId); + } + + /** + * Returns the damage value of the thrown potion that this EntityPotion represents. + */ + public int getPotionDamage() + { + if (this.potionDamage == null) + { + this.potionDamage = new ItemStack(Items.potionitem, 1, 0); + } + + return this.potionDamage.getMetadata(); + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected void onImpact(MovingObjectPosition p_70184_1_) + { + if (!this.worldObj.isRemote) + { + List list = Items.potionitem.getEffects(this.potionDamage); + + if (list != null && !list.isEmpty()) + { + AxisAlignedBB axisalignedbb = this.getEntityBoundingBox().expand(4.0D, 2.0D, 4.0D); + List list1 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); + + if (!list1.isEmpty()) + { + for (EntityLivingBase entitylivingbase : list1) + { + double d0 = this.getDistanceSqToEntity(entitylivingbase); + + if (d0 < 16.0D) + { + double d1 = 1.0D - Math.sqrt(d0) / 4.0D; + + if (entitylivingbase == p_70184_1_.entityHit) + { + d1 = 1.0D; + } + + for (PotionEffect potioneffect : list) + { + int i = potioneffect.getPotionID(); + + if (Potion.potionTypes[i].isInstant()) + { + Potion.potionTypes[i].affectEntity(this, this.getThrower(), entitylivingbase, potioneffect.getAmplifier(), d1); + } + else + { + int j = (int)(d1 * (double)potioneffect.getDuration() + 0.5D); + + if (j > 20) + { + entitylivingbase.addPotionEffect(new PotionEffect(i, j, potioneffect.getAmplifier())); + } + } + } + } + } + } + } + + this.worldObj.playAuxSFX(2002, new BlockPos(this), this.getPotionDamage()); + this.setDead(); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + super.readEntityFromNBT(tagCompund); + + if (tagCompund.hasKey("Potion", 10)) + { + this.potionDamage = ItemStack.loadItemStackFromNBT(tagCompund.getCompoundTag("Potion")); + } + else + { + this.setPotionDamage(tagCompund.getInteger("potionValue")); + } + + if (this.potionDamage == null) + { + this.setDead(); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + super.writeEntityToNBT(tagCompound); + + if (this.potionDamage != null) + { + tagCompound.setTag("Potion", this.potionDamage.writeToNBT(new NBTTagCompound())); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/projectile/EntitySmallFireball.java b/src/minecraft/net/minecraft/entity/projectile/EntitySmallFireball.java new file mode 100644 index 0000000..8e369a0 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/projectile/EntitySmallFireball.java @@ -0,0 +1,91 @@ +package net.minecraft.entity.projectile; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class EntitySmallFireball extends EntityFireball +{ + public EntitySmallFireball(World worldIn) + { + super(worldIn); + this.setSize(0.3125F, 0.3125F); + } + + public EntitySmallFireball(World worldIn, EntityLivingBase shooter, double accelX, double accelY, double accelZ) + { + super(worldIn, shooter, accelX, accelY, accelZ); + this.setSize(0.3125F, 0.3125F); + } + + public EntitySmallFireball(World worldIn, double x, double y, double z, double accelX, double accelY, double accelZ) + { + super(worldIn, x, y, z, accelX, accelY, accelZ); + this.setSize(0.3125F, 0.3125F); + } + + /** + * Called when this EntityFireball hits a block or entity. + */ + protected void onImpact(MovingObjectPosition movingObject) + { + if (!this.worldObj.isRemote) + { + if (movingObject.entityHit != null) + { + boolean flag = movingObject.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 5.0F); + + if (flag) + { + this.applyEnchantments(this.shootingEntity, movingObject.entityHit); + + if (!movingObject.entityHit.isImmuneToFire()) + { + movingObject.entityHit.setFire(5); + } + } + } + else + { + boolean flag1 = true; + + if (this.shootingEntity != null && this.shootingEntity instanceof EntityLiving) + { + flag1 = this.worldObj.getGameRules().getBoolean("mobGriefing"); + } + + if (flag1) + { + BlockPos blockpos = movingObject.getBlockPos().offset(movingObject.sideHit); + + if (this.worldObj.isAirBlock(blockpos)) + { + this.worldObj.setBlockState(blockpos, Blocks.fire.getDefaultState()); + } + } + } + + this.setDead(); + } + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return false; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/entity/projectile/EntitySnowball.java b/src/minecraft/net/minecraft/entity/projectile/EntitySnowball.java new file mode 100644 index 0000000..2025334 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/projectile/EntitySnowball.java @@ -0,0 +1,54 @@ +package net.minecraft.entity.projectile; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class EntitySnowball extends EntityThrowable +{ + public EntitySnowball(World worldIn) + { + super(worldIn); + } + + public EntitySnowball(World worldIn, EntityLivingBase throwerIn) + { + super(worldIn, throwerIn); + } + + public EntitySnowball(World worldIn, double x, double y, double z) + { + super(worldIn, x, y, z); + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected void onImpact(MovingObjectPosition p_70184_1_) + { + if (p_70184_1_.entityHit != null) + { + int i = 0; + + if (p_70184_1_.entityHit instanceof EntityBlaze) + { + i = 3; + } + + p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)i); + } + + for (int j = 0; j < 8; ++j) + { + this.worldObj.spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]); + } + + if (!this.worldObj.isRemote) + { + this.setDead(); + } + } +} diff --git a/src/minecraft/net/minecraft/entity/projectile/EntityThrowable.java b/src/minecraft/net/minecraft/entity/projectile/EntityThrowable.java new file mode 100644 index 0000000..da997c2 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/projectile/EntityThrowable.java @@ -0,0 +1,380 @@ +package net.minecraft.entity.projectile; + +import java.util.List; +import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IProjectile; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public abstract class EntityThrowable extends Entity implements IProjectile +{ + private int xTile = -1; + private int yTile = -1; + private int zTile = -1; + private Block inTile; + protected boolean inGround; + public int throwableShake; + + /** The entity that threw this throwable item. */ + private EntityLivingBase thrower; + private String throwerName; + private int ticksInGround; + private int ticksInAir; + + public EntityThrowable(World worldIn) + { + super(worldIn); + this.setSize(0.25F, 0.25F); + } + + protected void entityInit() + { + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double distance) + { + double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D; + + if (Double.isNaN(d0)) + { + d0 = 4.0D; + } + + d0 = d0 * 64.0D; + return distance < d0 * d0; + } + + public EntityThrowable(World worldIn, EntityLivingBase throwerIn) + { + super(worldIn); + this.thrower = throwerIn; + this.setSize(0.25F, 0.25F); + this.setLocationAndAngles(throwerIn.posX, throwerIn.posY + (double)throwerIn.getEyeHeight(), throwerIn.posZ, throwerIn.rotationYaw, throwerIn.rotationPitch); + this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.posY -= 0.10000000149011612D; + this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.setPosition(this.posX, this.posY, this.posZ); + float f = 0.4F; + this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f); + this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * f); + this.motionY = (double)(-MathHelper.sin((this.rotationPitch + this.getInaccuracy()) / 180.0F * (float)Math.PI) * f); + this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.getVelocity(), 1.0F); + } + + public EntityThrowable(World worldIn, double x, double y, double z) + { + super(worldIn); + this.ticksInGround = 0; + this.setSize(0.25F, 0.25F); + this.setPosition(x, y, z); + } + + protected float getVelocity() + { + return 1.5F; + } + + protected float getInaccuracy() + { + return 0.0F; + } + + /** + * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction. + */ + public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) + { + float f = MathHelper.sqrt_double(x * x + y * y + z * z); + x = x / (double)f; + y = y / (double)f; + z = z / (double)f; + x = x + this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy; + y = y + this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy; + z = z + this.rand.nextGaussian() * 0.007499999832361937D * (double)inaccuracy; + x = x * (double)velocity; + y = y * (double)velocity; + z = z * (double)velocity; + this.motionX = x; + this.motionY = y; + this.motionZ = z; + float f1 = MathHelper.sqrt_double(x * x + z * z); + this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.func_181159_b(x, z) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.func_181159_b(y, (double)f1) * 180.0D / Math.PI); + this.ticksInGround = 0; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double x, double y, double z) + { + this.motionX = x; + this.motionY = y; + this.motionZ = z; + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float f = MathHelper.sqrt_double(x * x + z * z); + this.prevRotationYaw = this.rotationYaw = (float)(MathHelper.func_181159_b(x, z) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(MathHelper.func_181159_b(y, (double)f) * 180.0D / Math.PI); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + super.onUpdate(); + + if (this.throwableShake > 0) + { + --this.throwableShake; + } + + if (this.inGround) + { + if (this.worldObj.getBlockState(new BlockPos(this.xTile, this.yTile, this.zTile)).getBlock() == this.inTile) + { + ++this.ticksInGround; + + if (this.ticksInGround == 1200) + { + this.setDead(); + } + + return; + } + + this.inGround = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; + } + else + { + ++this.ticksInAir; + } + + Vec3 vec3 = new Vec3(this.posX, this.posY, this.posZ); + Vec3 vec31 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31); + vec3 = new Vec3(this.posX, this.posY, this.posZ); + vec31 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (movingobjectposition != null) + { + vec31 = new Vec3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + } + + if (!this.worldObj.isRemote) + { + Entity entity = null; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double d0 = 0.0D; + EntityLivingBase entitylivingbase = this.getThrower(); + + for (int j = 0; j < list.size(); ++j) + { + Entity entity1 = (Entity)list.get(j); + + if (entity1.canBeCollidedWith() && (entity1 != entitylivingbase || this.ticksInAir >= 5)) + { + float f = 0.3F; + AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand((double)f, (double)f, (double)f); + MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31); + + if (movingobjectposition1 != null) + { + double d1 = vec3.squareDistanceTo(movingobjectposition1.hitVec); + + if (d1 < d0 || d0 == 0.0D) + { + entity = entity1; + d0 = d1; + } + } + } + } + + if (entity != null) + { + movingobjectposition = new MovingObjectPosition(entity); + } + } + + if (movingobjectposition != null) + { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && this.worldObj.getBlockState(movingobjectposition.getBlockPos()).getBlock() == Blocks.portal) + { + this.func_181015_d(movingobjectposition.getBlockPos()); + } + else + { + this.onImpact(movingobjectposition); + } + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float f1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(MathHelper.func_181159_b(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float)(MathHelper.func_181159_b(this.motionY, (double)f1) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float f2 = 0.99F; + float f3 = this.getGravityVelocity(); + + if (this.isInWater()) + { + for (int i = 0; i < 4; ++i) + { + float f4 = 0.25F; + this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ, new int[0]); + } + + f2 = 0.8F; + } + + this.motionX *= (double)f2; + this.motionY *= (double)f2; + this.motionZ *= (double)f2; + this.motionY -= (double)f3; + this.setPosition(this.posX, this.posY, this.posZ); + } + + /** + * Gets the amount of gravity to apply to the thrown entity with each tick. + */ + protected float getGravityVelocity() + { + return 0.03F; + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected abstract void onImpact(MovingObjectPosition p_70184_1_); + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound tagCompound) + { + tagCompound.setShort("xTile", (short)this.xTile); + tagCompound.setShort("yTile", (short)this.yTile); + tagCompound.setShort("zTile", (short)this.zTile); + ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile); + tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString()); + tagCompound.setByte("shake", (byte)this.throwableShake); + tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + + if ((this.throwerName == null || this.throwerName.length() == 0) && this.thrower instanceof EntityPlayer) + { + this.throwerName = this.thrower.getName(); + } + + tagCompound.setString("ownerName", this.throwerName == null ? "" : this.throwerName); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound tagCompund) + { + this.xTile = tagCompund.getShort("xTile"); + this.yTile = tagCompund.getShort("yTile"); + this.zTile = tagCompund.getShort("zTile"); + + if (tagCompund.hasKey("inTile", 8)) + { + this.inTile = Block.getBlockFromName(tagCompund.getString("inTile")); + } + else + { + this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255); + } + + this.throwableShake = tagCompund.getByte("shake") & 255; + this.inGround = tagCompund.getByte("inGround") == 1; + this.thrower = null; + this.throwerName = tagCompund.getString("ownerName"); + + if (this.throwerName != null && this.throwerName.length() == 0) + { + this.throwerName = null; + } + + this.thrower = this.getThrower(); + } + + public EntityLivingBase getThrower() + { + if (this.thrower == null && this.throwerName != null && this.throwerName.length() > 0) + { + this.thrower = this.worldObj.getPlayerEntityByName(this.throwerName); + + if (this.thrower == null && this.worldObj instanceof WorldServer) + { + try + { + Entity entity = ((WorldServer)this.worldObj).getEntityFromUuid(UUID.fromString(this.throwerName)); + + if (entity instanceof EntityLivingBase) + { + this.thrower = (EntityLivingBase)entity; + } + } + catch (Throwable var2) + { + this.thrower = null; + } + } + } + + return this.thrower; + } +} diff --git a/src/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java b/src/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java new file mode 100644 index 0000000..24ab5c8 --- /dev/null +++ b/src/minecraft/net/minecraft/entity/projectile/EntityWitherSkull.java @@ -0,0 +1,157 @@ +package net.minecraft.entity.projectile; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; + +public class EntityWitherSkull extends EntityFireball +{ + public EntityWitherSkull(World worldIn) + { + super(worldIn); + this.setSize(0.3125F, 0.3125F); + } + + public EntityWitherSkull(World worldIn, EntityLivingBase shooter, double accelX, double accelY, double accelZ) + { + super(worldIn, shooter, accelX, accelY, accelZ); + this.setSize(0.3125F, 0.3125F); + } + + /** + * Return the motion factor for this projectile. The factor is multiplied by the original motion. + */ + protected float getMotionFactor() + { + return this.isInvulnerable() ? 0.73F : super.getMotionFactor(); + } + + public EntityWitherSkull(World worldIn, double x, double y, double z, double accelX, double accelY, double accelZ) + { + super(worldIn, x, y, z, accelX, accelY, accelZ); + this.setSize(0.3125F, 0.3125F); + } + + /** + * Returns true if the entity is on fire. Used by render to add the fire effect on rendering. + */ + public boolean isBurning() + { + return false; + } + + /** + * Explosion resistance of a block relative to this entity + */ + public float getExplosionResistance(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn) + { + float f = super.getExplosionResistance(explosionIn, worldIn, pos, blockStateIn); + Block block = blockStateIn.getBlock(); + + if (this.isInvulnerable() && EntityWither.func_181033_a(block)) + { + f = Math.min(0.8F, f); + } + + return f; + } + + /** + * Called when this EntityFireball hits a block or entity. + */ + protected void onImpact(MovingObjectPosition movingObject) + { + if (!this.worldObj.isRemote) + { + if (movingObject.entityHit != null) + { + if (this.shootingEntity != null) + { + if (movingObject.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.shootingEntity), 8.0F)) + { + if (!movingObject.entityHit.isEntityAlive()) + { + this.shootingEntity.heal(5.0F); + } + else + { + this.applyEnchantments(this.shootingEntity, movingObject.entityHit); + } + } + } + else + { + movingObject.entityHit.attackEntityFrom(DamageSource.magic, 5.0F); + } + + if (movingObject.entityHit instanceof EntityLivingBase) + { + int i = 0; + + if (this.worldObj.getDifficulty() == EnumDifficulty.NORMAL) + { + i = 10; + } + else if (this.worldObj.getDifficulty() == EnumDifficulty.HARD) + { + i = 40; + } + + if (i > 0) + { + ((EntityLivingBase)movingObject.entityHit).addPotionEffect(new PotionEffect(Potion.wither.id, 20 * i, 1)); + } + } + } + + this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 1.0F, false, this.worldObj.getGameRules().getBoolean("mobGriefing")); + this.setDead(); + } + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return false; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource source, float amount) + { + return false; + } + + protected void entityInit() + { + this.dataWatcher.addObject(10, Byte.valueOf((byte)0)); + } + + /** + * Return whether this skull comes from an invulnerable (aura) wither boss. + */ + public boolean isInvulnerable() + { + return this.dataWatcher.getWatchableObjectByte(10) == 1; + } + + /** + * Set whether this skull comes from an invulnerable (aura) wither boss. + */ + public void setInvulnerable(boolean invulnerable) + { + this.dataWatcher.updateObject(10, Byte.valueOf((byte)(invulnerable ? 1 : 0))); + } +} diff --git a/src/minecraft/net/minecraft/event/ClickEvent.java b/src/minecraft/net/minecraft/event/ClickEvent.java new file mode 100644 index 0000000..fce2b00 --- /dev/null +++ b/src/minecraft/net/minecraft/event/ClickEvent.java @@ -0,0 +1,124 @@ +package net.minecraft.event; + +import com.google.common.collect.Maps; +import java.util.Map; + +public class ClickEvent +{ + private final ClickEvent.Action action; + private final String value; + + public ClickEvent(ClickEvent.Action theAction, String theValue) + { + this.action = theAction; + this.value = theValue; + } + + /** + * Gets the action to perform when this event is raised. + */ + public ClickEvent.Action getAction() + { + return this.action; + } + + /** + * Gets the value to perform the action on when this event is raised. For example, if the action is "open URL", + * this would be the URL to open. + */ + public String getValue() + { + return this.value; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) + { + ClickEvent clickevent = (ClickEvent)p_equals_1_; + + if (this.action != clickevent.action) + { + return false; + } + else + { + if (this.value != null) + { + if (!this.value.equals(clickevent.value)) + { + return false; + } + } + else if (clickevent.value != null) + { + return false; + } + + return true; + } + } + else + { + return false; + } + } + + public String toString() + { + return "ClickEvent{action=" + this.action + ", value=\'" + this.value + '\'' + '}'; + } + + public int hashCode() + { + int i = this.action.hashCode(); + i = 31 * i + (this.value != null ? this.value.hashCode() : 0); + return i; + } + + public static enum Action + { + OPEN_URL("open_url", true), + OPEN_FILE("open_file", false), + RUN_COMMAND("run_command", true), + TWITCH_USER_INFO("twitch_user_info", false), + SUGGEST_COMMAND("suggest_command", true), + CHANGE_PAGE("change_page", true); + + private static final Map nameMapping = Maps.newHashMap(); + private final boolean allowedInChat; + private final String canonicalName; + + private Action(String canonicalNameIn, boolean allowedInChatIn) + { + this.canonicalName = canonicalNameIn; + this.allowedInChat = allowedInChatIn; + } + + public boolean shouldAllowInChat() + { + return this.allowedInChat; + } + + public String getCanonicalName() + { + return this.canonicalName; + } + + public static ClickEvent.Action getValueByCanonicalName(String canonicalNameIn) + { + return (ClickEvent.Action)nameMapping.get(canonicalNameIn); + } + + static { + for (ClickEvent.Action clickevent$action : values()) + { + nameMapping.put(clickevent$action.getCanonicalName(), clickevent$action); + } + } + } +} diff --git a/src/minecraft/net/minecraft/event/HoverEvent.java b/src/minecraft/net/minecraft/event/HoverEvent.java new file mode 100644 index 0000000..4fed01b --- /dev/null +++ b/src/minecraft/net/minecraft/event/HoverEvent.java @@ -0,0 +1,123 @@ +package net.minecraft.event; + +import com.google.common.collect.Maps; +import java.util.Map; +import net.minecraft.util.IChatComponent; + +public class HoverEvent +{ + private final HoverEvent.Action action; + private final IChatComponent value; + + public HoverEvent(HoverEvent.Action actionIn, IChatComponent valueIn) + { + this.action = actionIn; + this.value = valueIn; + } + + /** + * Gets the action to perform when this event is raised. + */ + public HoverEvent.Action getAction() + { + return this.action; + } + + /** + * Gets the value to perform the action on when this event is raised. For example, if the action is "show item", + * this would be the item to show. + */ + public IChatComponent getValue() + { + return this.value; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) + { + HoverEvent hoverevent = (HoverEvent)p_equals_1_; + + if (this.action != hoverevent.action) + { + return false; + } + else + { + if (this.value != null) + { + if (!this.value.equals(hoverevent.value)) + { + return false; + } + } + else if (hoverevent.value != null) + { + return false; + } + + return true; + } + } + else + { + return false; + } + } + + public String toString() + { + return "HoverEvent{action=" + this.action + ", value=\'" + this.value + '\'' + '}'; + } + + public int hashCode() + { + int i = this.action.hashCode(); + i = 31 * i + (this.value != null ? this.value.hashCode() : 0); + return i; + } + + public static enum Action + { + SHOW_TEXT("show_text", true), + SHOW_ACHIEVEMENT("show_achievement", true), + SHOW_ITEM("show_item", true), + SHOW_ENTITY("show_entity", true); + + private static final Map nameMapping = Maps.newHashMap(); + private final boolean allowedInChat; + private final String canonicalName; + + private Action(String canonicalNameIn, boolean allowedInChatIn) + { + this.canonicalName = canonicalNameIn; + this.allowedInChat = allowedInChatIn; + } + + public boolean shouldAllowInChat() + { + return this.allowedInChat; + } + + public String getCanonicalName() + { + return this.canonicalName; + } + + public static HoverEvent.Action getValueByCanonicalName(String canonicalNameIn) + { + return (HoverEvent.Action)nameMapping.get(canonicalNameIn); + } + + static { + for (HoverEvent.Action hoverevent$action : values()) + { + nameMapping.put(hoverevent$action.getCanonicalName(), hoverevent$action); + } + } + } +} diff --git a/src/minecraft/net/minecraft/init/Blocks.java b/src/minecraft/net/minecraft/init/Blocks.java new file mode 100644 index 0000000..3f6fba2 --- /dev/null +++ b/src/minecraft/net/minecraft/init/Blocks.java @@ -0,0 +1,454 @@ +package net.minecraft.init; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockBeacon; +import net.minecraft.block.BlockBush; +import net.minecraft.block.BlockCactus; +import net.minecraft.block.BlockCauldron; +import net.minecraft.block.BlockChest; +import net.minecraft.block.BlockDaylightDetector; +import net.minecraft.block.BlockDeadBush; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.block.BlockDynamicLiquid; +import net.minecraft.block.BlockFire; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.BlockGrass; +import net.minecraft.block.BlockHopper; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockMycelium; +import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.BlockPistonExtension; +import net.minecraft.block.BlockPistonMoving; +import net.minecraft.block.BlockPortal; +import net.minecraft.block.BlockRedstoneComparator; +import net.minecraft.block.BlockRedstoneRepeater; +import net.minecraft.block.BlockRedstoneWire; +import net.minecraft.block.BlockReed; +import net.minecraft.block.BlockSand; +import net.minecraft.block.BlockSkull; +import net.minecraft.block.BlockSlab; +import net.minecraft.block.BlockStainedGlass; +import net.minecraft.block.BlockStainedGlassPane; +import net.minecraft.block.BlockStaticLiquid; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.BlockTripWireHook; +import net.minecraft.util.ResourceLocation; + +public class Blocks +{ + public static final Block air; + public static final Block stone; + public static final BlockGrass grass; + public static final Block dirt; + public static final Block cobblestone; + public static final Block planks; + public static final Block sapling; + public static final Block bedrock; + public static final BlockDynamicLiquid flowing_water; + public static final BlockStaticLiquid water; + public static final BlockDynamicLiquid flowing_lava; + public static final BlockStaticLiquid lava; + public static final BlockSand sand; + public static final Block gravel; + public static final Block gold_ore; + public static final Block iron_ore; + public static final Block coal_ore; + public static final Block log; + public static final Block log2; + public static final BlockLeaves leaves; + public static final BlockLeaves leaves2; + public static final Block sponge; + public static final Block glass; + public static final Block lapis_ore; + public static final Block lapis_block; + public static final Block dispenser; + public static final Block sandstone; + public static final Block noteblock; + public static final Block bed; + public static final Block golden_rail; + public static final Block detector_rail; + public static final BlockPistonBase sticky_piston; + public static final Block web; + public static final BlockTallGrass tallgrass; + public static final BlockDeadBush deadbush; + public static final BlockPistonBase piston; + public static final BlockPistonExtension piston_head; + public static final Block wool; + public static final BlockPistonMoving piston_extension; + public static final BlockFlower yellow_flower; + public static final BlockFlower red_flower; + public static final BlockBush brown_mushroom; + public static final BlockBush red_mushroom; + public static final Block gold_block; + public static final Block iron_block; + public static final BlockSlab double_stone_slab; + public static final BlockSlab stone_slab; + public static final Block brick_block; + public static final Block tnt; + public static final Block bookshelf; + public static final Block mossy_cobblestone; + public static final Block obsidian; + public static final Block torch; + public static final BlockFire fire; + public static final Block mob_spawner; + public static final Block oak_stairs; + public static final BlockChest chest; + public static final BlockRedstoneWire redstone_wire; + public static final Block diamond_ore; + public static final Block diamond_block; + public static final Block crafting_table; + public static final Block wheat; + public static final Block farmland; + public static final Block furnace; + public static final Block lit_furnace; + public static final Block standing_sign; + public static final Block oak_door; + public static final Block spruce_door; + public static final Block birch_door; + public static final Block jungle_door; + public static final Block acacia_door; + public static final Block dark_oak_door; + public static final Block ladder; + public static final Block rail; + public static final Block stone_stairs; + public static final Block wall_sign; + public static final Block lever; + public static final Block stone_pressure_plate; + public static final Block iron_door; + public static final Block wooden_pressure_plate; + public static final Block redstone_ore; + public static final Block lit_redstone_ore; + public static final Block unlit_redstone_torch; + public static final Block redstone_torch; + public static final Block stone_button; + public static final Block snow_layer; + public static final Block ice; + public static final Block snow; + public static final BlockCactus cactus; + public static final Block clay; + public static final BlockReed reeds; + public static final Block jukebox; + public static final Block oak_fence; + public static final Block spruce_fence; + public static final Block birch_fence; + public static final Block jungle_fence; + public static final Block dark_oak_fence; + public static final Block acacia_fence; + public static final Block pumpkin; + public static final Block netherrack; + public static final Block soul_sand; + public static final Block glowstone; + public static final BlockPortal portal; + public static final Block lit_pumpkin; + public static final Block cake; + public static final BlockRedstoneRepeater unpowered_repeater; + public static final BlockRedstoneRepeater powered_repeater; + public static final Block trapdoor; + public static final Block monster_egg; + public static final Block stonebrick; + public static final Block brown_mushroom_block; + public static final Block red_mushroom_block; + public static final Block iron_bars; + public static final Block glass_pane; + public static final Block melon_block; + public static final Block pumpkin_stem; + public static final Block melon_stem; + public static final Block vine; + public static final Block oak_fence_gate; + public static final Block spruce_fence_gate; + public static final Block birch_fence_gate; + public static final Block jungle_fence_gate; + public static final Block dark_oak_fence_gate; + public static final Block acacia_fence_gate; + public static final Block brick_stairs; + public static final Block stone_brick_stairs; + public static final BlockMycelium mycelium; + public static final Block waterlily; + public static final Block nether_brick; + public static final Block nether_brick_fence; + public static final Block nether_brick_stairs; + public static final Block nether_wart; + public static final Block enchanting_table; + public static final Block brewing_stand; + public static final BlockCauldron cauldron; + public static final Block end_portal; + public static final Block end_portal_frame; + public static final Block end_stone; + public static final Block dragon_egg; + public static final Block redstone_lamp; + public static final Block lit_redstone_lamp; + public static final BlockSlab double_wooden_slab; + public static final BlockSlab wooden_slab; + public static final Block cocoa; + public static final Block sandstone_stairs; + public static final Block emerald_ore; + public static final Block ender_chest; + public static final BlockTripWireHook tripwire_hook; + public static final Block tripwire; + public static final Block emerald_block; + public static final Block spruce_stairs; + public static final Block birch_stairs; + public static final Block jungle_stairs; + public static final Block command_block; + public static final BlockBeacon beacon; + public static final Block cobblestone_wall; + public static final Block flower_pot; + public static final Block carrots; + public static final Block potatoes; + public static final Block wooden_button; + public static final BlockSkull skull; + public static final Block anvil; + public static final Block trapped_chest; + public static final Block light_weighted_pressure_plate; + public static final Block heavy_weighted_pressure_plate; + public static final BlockRedstoneComparator unpowered_comparator; + public static final BlockRedstoneComparator powered_comparator; + public static final BlockDaylightDetector daylight_detector; + public static final BlockDaylightDetector daylight_detector_inverted; + public static final Block redstone_block; + public static final Block quartz_ore; + public static final BlockHopper hopper; + public static final Block quartz_block; + public static final Block quartz_stairs; + public static final Block activator_rail; + public static final Block dropper; + public static final Block stained_hardened_clay; + public static final Block barrier; + public static final Block iron_trapdoor; + public static final Block hay_block; + public static final Block carpet; + public static final Block hardened_clay; + public static final Block coal_block; + public static final Block packed_ice; + public static final Block acacia_stairs; + public static final Block dark_oak_stairs; + public static final Block slime_block; + public static final BlockDoublePlant double_plant; + public static final BlockStainedGlass stained_glass; + public static final BlockStainedGlassPane stained_glass_pane; + public static final Block prismarine; + public static final Block sea_lantern; + public static final Block standing_banner; + public static final Block wall_banner; + public static final Block red_sandstone; + public static final Block red_sandstone_stairs; + public static final BlockSlab double_stone_slab2; + public static final BlockSlab stone_slab2; + + /** + * Returns the Block in the blockRegistry with the specified name. + */ + private static Block getRegisteredBlock(String p_180383_0_) + { + return (Block)Block.blockRegistry.getObject(new ResourceLocation(p_180383_0_)); + } + + static + { + if (!Bootstrap.isRegistered()) + { + throw new RuntimeException("Accessed Blocks before Bootstrap!"); + } + else + { + air = getRegisteredBlock("air"); + stone = getRegisteredBlock("stone"); + grass = (BlockGrass)getRegisteredBlock("grass"); + dirt = getRegisteredBlock("dirt"); + cobblestone = getRegisteredBlock("cobblestone"); + planks = getRegisteredBlock("planks"); + sapling = getRegisteredBlock("sapling"); + bedrock = getRegisteredBlock("bedrock"); + flowing_water = (BlockDynamicLiquid)getRegisteredBlock("flowing_water"); + water = (BlockStaticLiquid)getRegisteredBlock("water"); + flowing_lava = (BlockDynamicLiquid)getRegisteredBlock("flowing_lava"); + lava = (BlockStaticLiquid)getRegisteredBlock("lava"); + sand = (BlockSand)getRegisteredBlock("sand"); + gravel = getRegisteredBlock("gravel"); + gold_ore = getRegisteredBlock("gold_ore"); + iron_ore = getRegisteredBlock("iron_ore"); + coal_ore = getRegisteredBlock("coal_ore"); + log = getRegisteredBlock("log"); + log2 = getRegisteredBlock("log2"); + leaves = (BlockLeaves)getRegisteredBlock("leaves"); + leaves2 = (BlockLeaves)getRegisteredBlock("leaves2"); + sponge = getRegisteredBlock("sponge"); + glass = getRegisteredBlock("glass"); + lapis_ore = getRegisteredBlock("lapis_ore"); + lapis_block = getRegisteredBlock("lapis_block"); + dispenser = getRegisteredBlock("dispenser"); + sandstone = getRegisteredBlock("sandstone"); + noteblock = getRegisteredBlock("noteblock"); + bed = getRegisteredBlock("bed"); + golden_rail = getRegisteredBlock("golden_rail"); + detector_rail = getRegisteredBlock("detector_rail"); + sticky_piston = (BlockPistonBase)getRegisteredBlock("sticky_piston"); + web = getRegisteredBlock("web"); + tallgrass = (BlockTallGrass)getRegisteredBlock("tallgrass"); + deadbush = (BlockDeadBush)getRegisteredBlock("deadbush"); + piston = (BlockPistonBase)getRegisteredBlock("piston"); + piston_head = (BlockPistonExtension)getRegisteredBlock("piston_head"); + wool = getRegisteredBlock("wool"); + piston_extension = (BlockPistonMoving)getRegisteredBlock("piston_extension"); + yellow_flower = (BlockFlower)getRegisteredBlock("yellow_flower"); + red_flower = (BlockFlower)getRegisteredBlock("red_flower"); + brown_mushroom = (BlockBush)getRegisteredBlock("brown_mushroom"); + red_mushroom = (BlockBush)getRegisteredBlock("red_mushroom"); + gold_block = getRegisteredBlock("gold_block"); + iron_block = getRegisteredBlock("iron_block"); + double_stone_slab = (BlockSlab)getRegisteredBlock("double_stone_slab"); + stone_slab = (BlockSlab)getRegisteredBlock("stone_slab"); + brick_block = getRegisteredBlock("brick_block"); + tnt = getRegisteredBlock("tnt"); + bookshelf = getRegisteredBlock("bookshelf"); + mossy_cobblestone = getRegisteredBlock("mossy_cobblestone"); + obsidian = getRegisteredBlock("obsidian"); + torch = getRegisteredBlock("torch"); + fire = (BlockFire)getRegisteredBlock("fire"); + mob_spawner = getRegisteredBlock("mob_spawner"); + oak_stairs = getRegisteredBlock("oak_stairs"); + chest = (BlockChest)getRegisteredBlock("chest"); + redstone_wire = (BlockRedstoneWire)getRegisteredBlock("redstone_wire"); + diamond_ore = getRegisteredBlock("diamond_ore"); + diamond_block = getRegisteredBlock("diamond_block"); + crafting_table = getRegisteredBlock("crafting_table"); + wheat = getRegisteredBlock("wheat"); + farmland = getRegisteredBlock("farmland"); + furnace = getRegisteredBlock("furnace"); + lit_furnace = getRegisteredBlock("lit_furnace"); + standing_sign = getRegisteredBlock("standing_sign"); + oak_door = getRegisteredBlock("wooden_door"); + spruce_door = getRegisteredBlock("spruce_door"); + birch_door = getRegisteredBlock("birch_door"); + jungle_door = getRegisteredBlock("jungle_door"); + acacia_door = getRegisteredBlock("acacia_door"); + dark_oak_door = getRegisteredBlock("dark_oak_door"); + ladder = getRegisteredBlock("ladder"); + rail = getRegisteredBlock("rail"); + stone_stairs = getRegisteredBlock("stone_stairs"); + wall_sign = getRegisteredBlock("wall_sign"); + lever = getRegisteredBlock("lever"); + stone_pressure_plate = getRegisteredBlock("stone_pressure_plate"); + iron_door = getRegisteredBlock("iron_door"); + wooden_pressure_plate = getRegisteredBlock("wooden_pressure_plate"); + redstone_ore = getRegisteredBlock("redstone_ore"); + lit_redstone_ore = getRegisteredBlock("lit_redstone_ore"); + unlit_redstone_torch = getRegisteredBlock("unlit_redstone_torch"); + redstone_torch = getRegisteredBlock("redstone_torch"); + stone_button = getRegisteredBlock("stone_button"); + snow_layer = getRegisteredBlock("snow_layer"); + ice = getRegisteredBlock("ice"); + snow = getRegisteredBlock("snow"); + cactus = (BlockCactus)getRegisteredBlock("cactus"); + clay = getRegisteredBlock("clay"); + reeds = (BlockReed)getRegisteredBlock("reeds"); + jukebox = getRegisteredBlock("jukebox"); + oak_fence = getRegisteredBlock("fence"); + spruce_fence = getRegisteredBlock("spruce_fence"); + birch_fence = getRegisteredBlock("birch_fence"); + jungle_fence = getRegisteredBlock("jungle_fence"); + dark_oak_fence = getRegisteredBlock("dark_oak_fence"); + acacia_fence = getRegisteredBlock("acacia_fence"); + pumpkin = getRegisteredBlock("pumpkin"); + netherrack = getRegisteredBlock("netherrack"); + soul_sand = getRegisteredBlock("soul_sand"); + glowstone = getRegisteredBlock("glowstone"); + portal = (BlockPortal)getRegisteredBlock("portal"); + lit_pumpkin = getRegisteredBlock("lit_pumpkin"); + cake = getRegisteredBlock("cake"); + unpowered_repeater = (BlockRedstoneRepeater)getRegisteredBlock("unpowered_repeater"); + powered_repeater = (BlockRedstoneRepeater)getRegisteredBlock("powered_repeater"); + trapdoor = getRegisteredBlock("trapdoor"); + monster_egg = getRegisteredBlock("monster_egg"); + stonebrick = getRegisteredBlock("stonebrick"); + brown_mushroom_block = getRegisteredBlock("brown_mushroom_block"); + red_mushroom_block = getRegisteredBlock("red_mushroom_block"); + iron_bars = getRegisteredBlock("iron_bars"); + glass_pane = getRegisteredBlock("glass_pane"); + melon_block = getRegisteredBlock("melon_block"); + pumpkin_stem = getRegisteredBlock("pumpkin_stem"); + melon_stem = getRegisteredBlock("melon_stem"); + vine = getRegisteredBlock("vine"); + oak_fence_gate = getRegisteredBlock("fence_gate"); + spruce_fence_gate = getRegisteredBlock("spruce_fence_gate"); + birch_fence_gate = getRegisteredBlock("birch_fence_gate"); + jungle_fence_gate = getRegisteredBlock("jungle_fence_gate"); + dark_oak_fence_gate = getRegisteredBlock("dark_oak_fence_gate"); + acacia_fence_gate = getRegisteredBlock("acacia_fence_gate"); + brick_stairs = getRegisteredBlock("brick_stairs"); + stone_brick_stairs = getRegisteredBlock("stone_brick_stairs"); + mycelium = (BlockMycelium)getRegisteredBlock("mycelium"); + waterlily = getRegisteredBlock("waterlily"); + nether_brick = getRegisteredBlock("nether_brick"); + nether_brick_fence = getRegisteredBlock("nether_brick_fence"); + nether_brick_stairs = getRegisteredBlock("nether_brick_stairs"); + nether_wart = getRegisteredBlock("nether_wart"); + enchanting_table = getRegisteredBlock("enchanting_table"); + brewing_stand = getRegisteredBlock("brewing_stand"); + cauldron = (BlockCauldron)getRegisteredBlock("cauldron"); + end_portal = getRegisteredBlock("end_portal"); + end_portal_frame = getRegisteredBlock("end_portal_frame"); + end_stone = getRegisteredBlock("end_stone"); + dragon_egg = getRegisteredBlock("dragon_egg"); + redstone_lamp = getRegisteredBlock("redstone_lamp"); + lit_redstone_lamp = getRegisteredBlock("lit_redstone_lamp"); + double_wooden_slab = (BlockSlab)getRegisteredBlock("double_wooden_slab"); + wooden_slab = (BlockSlab)getRegisteredBlock("wooden_slab"); + cocoa = getRegisteredBlock("cocoa"); + sandstone_stairs = getRegisteredBlock("sandstone_stairs"); + emerald_ore = getRegisteredBlock("emerald_ore"); + ender_chest = getRegisteredBlock("ender_chest"); + tripwire_hook = (BlockTripWireHook)getRegisteredBlock("tripwire_hook"); + tripwire = getRegisteredBlock("tripwire"); + emerald_block = getRegisteredBlock("emerald_block"); + spruce_stairs = getRegisteredBlock("spruce_stairs"); + birch_stairs = getRegisteredBlock("birch_stairs"); + jungle_stairs = getRegisteredBlock("jungle_stairs"); + command_block = getRegisteredBlock("command_block"); + beacon = (BlockBeacon)getRegisteredBlock("beacon"); + cobblestone_wall = getRegisteredBlock("cobblestone_wall"); + flower_pot = getRegisteredBlock("flower_pot"); + carrots = getRegisteredBlock("carrots"); + potatoes = getRegisteredBlock("potatoes"); + wooden_button = getRegisteredBlock("wooden_button"); + skull = (BlockSkull)getRegisteredBlock("skull"); + anvil = getRegisteredBlock("anvil"); + trapped_chest = getRegisteredBlock("trapped_chest"); + light_weighted_pressure_plate = getRegisteredBlock("light_weighted_pressure_plate"); + heavy_weighted_pressure_plate = getRegisteredBlock("heavy_weighted_pressure_plate"); + unpowered_comparator = (BlockRedstoneComparator)getRegisteredBlock("unpowered_comparator"); + powered_comparator = (BlockRedstoneComparator)getRegisteredBlock("powered_comparator"); + daylight_detector = (BlockDaylightDetector)getRegisteredBlock("daylight_detector"); + daylight_detector_inverted = (BlockDaylightDetector)getRegisteredBlock("daylight_detector_inverted"); + redstone_block = getRegisteredBlock("redstone_block"); + quartz_ore = getRegisteredBlock("quartz_ore"); + hopper = (BlockHopper)getRegisteredBlock("hopper"); + quartz_block = getRegisteredBlock("quartz_block"); + quartz_stairs = getRegisteredBlock("quartz_stairs"); + activator_rail = getRegisteredBlock("activator_rail"); + dropper = getRegisteredBlock("dropper"); + stained_hardened_clay = getRegisteredBlock("stained_hardened_clay"); + barrier = getRegisteredBlock("barrier"); + iron_trapdoor = getRegisteredBlock("iron_trapdoor"); + hay_block = getRegisteredBlock("hay_block"); + carpet = getRegisteredBlock("carpet"); + hardened_clay = getRegisteredBlock("hardened_clay"); + coal_block = getRegisteredBlock("coal_block"); + packed_ice = getRegisteredBlock("packed_ice"); + acacia_stairs = getRegisteredBlock("acacia_stairs"); + dark_oak_stairs = getRegisteredBlock("dark_oak_stairs"); + slime_block = getRegisteredBlock("slime"); + double_plant = (BlockDoublePlant)getRegisteredBlock("double_plant"); + stained_glass = (BlockStainedGlass)getRegisteredBlock("stained_glass"); + stained_glass_pane = (BlockStainedGlassPane)getRegisteredBlock("stained_glass_pane"); + prismarine = getRegisteredBlock("prismarine"); + sea_lantern = getRegisteredBlock("sea_lantern"); + standing_banner = getRegisteredBlock("standing_banner"); + wall_banner = getRegisteredBlock("wall_banner"); + red_sandstone = getRegisteredBlock("red_sandstone"); + red_sandstone_stairs = getRegisteredBlock("red_sandstone_stairs"); + double_stone_slab2 = (BlockSlab)getRegisteredBlock("double_stone_slab2"); + stone_slab2 = (BlockSlab)getRegisteredBlock("stone_slab2"); + } + } +} diff --git a/src/minecraft/net/minecraft/init/Bootstrap.java b/src/minecraft/net/minecraft/init/Bootstrap.java new file mode 100644 index 0000000..63cca8b --- /dev/null +++ b/src/minecraft/net/minecraft/init/Bootstrap.java @@ -0,0 +1,538 @@ +package net.minecraft.init; + +import com.mojang.authlib.GameProfile; +import java.io.PrintStream; +import java.util.Random; +import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDispenser; +import net.minecraft.block.BlockFire; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.BlockPumpkin; +import net.minecraft.block.BlockSkull; +import net.minecraft.block.BlockTNT; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.dispenser.BehaviorProjectileDispense; +import net.minecraft.dispenser.IBehaviorDispenseItem; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.dispenser.IPosition; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IProjectile; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityExpBottle; +import net.minecraft.entity.item.EntityFireworkRocket; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityEgg; +import net.minecraft.entity.projectile.EntityPotion; +import net.minecraft.entity.projectile.EntitySmallFireball; +import net.minecraft.entity.projectile.EntitySnowball; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBucket; +import net.minecraft.item.ItemDye; +import net.minecraft.item.ItemMonsterPlacer; +import net.minecraft.item.ItemPotion; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityDispenser; +import net.minecraft.tileentity.TileEntitySkull; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.LoggingPrintStream; +import net.minecraft.util.StringUtils; +import net.minecraft.world.World; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class Bootstrap +{ + private static final PrintStream SYSOUT = System.out; + + /** Whether the blocks, items, etc have already been registered */ + private static boolean alreadyRegistered = false; + private static final Logger LOGGER = LogManager.getLogger(); + + /** + * Is Bootstrap registration already done? + */ + public static boolean isRegistered() + { + return alreadyRegistered; + } + + static void registerDispenserBehaviors() + { + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.arrow, new BehaviorProjectileDispense() + { + protected IProjectile getProjectileEntity(World worldIn, IPosition position) + { + EntityArrow entityarrow = new EntityArrow(worldIn, position.getX(), position.getY(), position.getZ()); + entityarrow.canBePickedUp = 1; + return entityarrow; + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.egg, new BehaviorProjectileDispense() + { + protected IProjectile getProjectileEntity(World worldIn, IPosition position) + { + return new EntityEgg(worldIn, position.getX(), position.getY(), position.getZ()); + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.snowball, new BehaviorProjectileDispense() + { + protected IProjectile getProjectileEntity(World worldIn, IPosition position) + { + return new EntitySnowball(worldIn, position.getX(), position.getY(), position.getZ()); + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.experience_bottle, new BehaviorProjectileDispense() + { + protected IProjectile getProjectileEntity(World worldIn, IPosition position) + { + return new EntityExpBottle(worldIn, position.getX(), position.getY(), position.getZ()); + } + protected float func_82498_a() + { + return super.func_82498_a() * 0.5F; + } + protected float func_82500_b() + { + return super.func_82500_b() * 1.25F; + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.potionitem, new IBehaviorDispenseItem() + { + private final BehaviorDefaultDispenseItem field_150843_b = new BehaviorDefaultDispenseItem(); + public ItemStack dispense(IBlockSource source, final ItemStack stack) + { + return ItemPotion.isSplash(stack.getMetadata()) ? (new BehaviorProjectileDispense() + { + protected IProjectile getProjectileEntity(World worldIn, IPosition position) + { + return new EntityPotion(worldIn, position.getX(), position.getY(), position.getZ(), stack.copy()); + } + protected float func_82498_a() + { + return super.func_82498_a() * 0.5F; + } + protected float func_82500_b() + { + return super.func_82500_b() * 1.25F; + } + }).dispense(source, stack): this.field_150843_b.dispense(source, stack); + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.spawn_egg, new BehaviorDefaultDispenseItem() + { + public ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata()); + double d0 = source.getX() + (double)enumfacing.getFrontOffsetX(); + double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); + double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); + Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), stack.getMetadata(), d0, d1, d2); + + if (entity instanceof EntityLivingBase && stack.hasDisplayName()) + { + ((EntityLiving)entity).setCustomNameTag(stack.getDisplayName()); + } + + stack.splitStack(1); + return stack; + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.fireworks, new BehaviorDefaultDispenseItem() + { + public ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata()); + double d0 = source.getX() + (double)enumfacing.getFrontOffsetX(); + double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); + double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); + EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(source.getWorld(), d0, d1, d2, stack); + source.getWorld().spawnEntityInWorld(entityfireworkrocket); + stack.splitStack(1); + return stack; + } + protected void playDispenseSound(IBlockSource source) + { + source.getWorld().playAuxSFX(1002, source.getBlockPos(), 0); + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.fire_charge, new BehaviorDefaultDispenseItem() + { + public ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata()); + IPosition iposition = BlockDispenser.getDispensePosition(source); + double d0 = iposition.getX() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F); + double d1 = iposition.getY() + (double)((float)enumfacing.getFrontOffsetY() * 0.3F); + double d2 = iposition.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 0.3F); + World world = source.getWorld(); + Random random = world.rand; + double d3 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetX(); + double d4 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetY(); + double d5 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetZ(); + world.spawnEntityInWorld(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5)); + stack.splitStack(1); + return stack; + } + protected void playDispenseSound(IBlockSource source) + { + source.getWorld().playAuxSFX(1009, source.getBlockPos(), 0); + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.boat, new BehaviorDefaultDispenseItem() + { + private final BehaviorDefaultDispenseItem field_150842_b = new BehaviorDefaultDispenseItem(); + public ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata()); + World world = source.getWorld(); + double d0 = source.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F); + double d1 = source.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F); + double d2 = source.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F); + BlockPos blockpos = source.getBlockPos().offset(enumfacing); + Material material = world.getBlockState(blockpos).getBlock().getMaterial(); + double d3; + + if (Material.water.equals(material)) + { + d3 = 1.0D; + } + else + { + if (!Material.air.equals(material) || !Material.water.equals(world.getBlockState(blockpos.down()).getBlock().getMaterial())) + { + return this.field_150842_b.dispense(source, stack); + } + + d3 = 0.0D; + } + + EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2); + world.spawnEntityInWorld(entityboat); + stack.splitStack(1); + return stack; + } + protected void playDispenseSound(IBlockSource source) + { + source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0); + } + }); + IBehaviorDispenseItem ibehaviordispenseitem = new BehaviorDefaultDispenseItem() + { + private final BehaviorDefaultDispenseItem field_150841_b = new BehaviorDefaultDispenseItem(); + public ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + ItemBucket itembucket = (ItemBucket)stack.getItem(); + BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata())); + + if (itembucket.tryPlaceContainedLiquid(source.getWorld(), blockpos)) + { + stack.setItem(Items.bucket); + stack.stackSize = 1; + return stack; + } + else + { + return this.field_150841_b.dispense(source, stack); + } + } + }; + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.lava_bucket, ibehaviordispenseitem); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.water_bucket, ibehaviordispenseitem); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.bucket, new BehaviorDefaultDispenseItem() + { + private final BehaviorDefaultDispenseItem field_150840_b = new BehaviorDefaultDispenseItem(); + public ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + World world = source.getWorld(); + BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata())); + IBlockState iblockstate = world.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + Material material = block.getMaterial(); + Item item; + + if (Material.water.equals(material) && block instanceof BlockLiquid && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0) + { + item = Items.water_bucket; + } + else + { + if (!Material.lava.equals(material) || !(block instanceof BlockLiquid) || ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() != 0) + { + return super.dispenseStack(source, stack); + } + + item = Items.lava_bucket; + } + + world.setBlockToAir(blockpos); + + if (--stack.stackSize == 0) + { + stack.setItem(item); + stack.stackSize = 1; + } + else if (((TileEntityDispenser)source.getBlockTileEntity()).addItemStack(new ItemStack(item)) < 0) + { + this.field_150840_b.dispense(source, new ItemStack(item)); + } + + return stack; + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.flint_and_steel, new BehaviorDefaultDispenseItem() + { + private boolean field_150839_b = true; + protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + World world = source.getWorld(); + BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata())); + + if (world.isAirBlock(blockpos)) + { + world.setBlockState(blockpos, Blocks.fire.getDefaultState()); + + if (stack.attemptDamageItem(1, world.rand)) + { + stack.stackSize = 0; + } + } + else if (world.getBlockState(blockpos).getBlock() == Blocks.tnt) + { + Blocks.tnt.onBlockDestroyedByPlayer(world, blockpos, Blocks.tnt.getDefaultState().withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true))); + world.setBlockToAir(blockpos); + } + else + { + this.field_150839_b = false; + } + + return stack; + } + protected void playDispenseSound(IBlockSource source) + { + if (this.field_150839_b) + { + source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0); + } + else + { + source.getWorld().playAuxSFX(1001, source.getBlockPos(), 0); + } + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.dye, new BehaviorDefaultDispenseItem() + { + private boolean field_150838_b = true; + protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + if (EnumDyeColor.WHITE == EnumDyeColor.byDyeDamage(stack.getMetadata())) + { + World world = source.getWorld(); + BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata())); + + if (ItemDye.applyBonemeal(stack, world, blockpos)) + { + if (!world.isRemote) + { + world.playAuxSFX(2005, blockpos, 0); + } + } + else + { + this.field_150838_b = false; + } + + return stack; + } + else + { + return super.dispenseStack(source, stack); + } + } + protected void playDispenseSound(IBlockSource source) + { + if (this.field_150838_b) + { + source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0); + } + else + { + source.getWorld().playAuxSFX(1001, source.getBlockPos(), 0); + } + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.getItemFromBlock(Blocks.tnt), new BehaviorDefaultDispenseItem() + { + protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + World world = source.getWorld(); + BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata())); + EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D, (EntityLivingBase)null); + world.spawnEntityInWorld(entitytntprimed); + world.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); + --stack.stackSize; + return stack; + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.skull, new BehaviorDefaultDispenseItem() + { + private boolean field_179240_b = true; + protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + World world = source.getWorld(); + EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata()); + BlockPos blockpos = source.getBlockPos().offset(enumfacing); + BlockSkull blockskull = Blocks.skull; + + if (world.isAirBlock(blockpos) && blockskull.canDispenserPlace(world, blockpos, stack)) + { + if (!world.isRemote) + { + world.setBlockState(blockpos, blockskull.getDefaultState().withProperty(BlockSkull.FACING, EnumFacing.UP), 3); + TileEntity tileentity = world.getTileEntity(blockpos); + + if (tileentity instanceof TileEntitySkull) + { + if (stack.getMetadata() == 3) + { + GameProfile gameprofile = null; + + if (stack.hasTagCompound()) + { + NBTTagCompound nbttagcompound = stack.getTagCompound(); + + if (nbttagcompound.hasKey("SkullOwner", 10)) + { + gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner")); + } + else if (nbttagcompound.hasKey("SkullOwner", 8)) + { + String s = nbttagcompound.getString("SkullOwner"); + + if (!StringUtils.isNullOrEmpty(s)) + { + gameprofile = new GameProfile((UUID)null, s); + } + } + } + + ((TileEntitySkull)tileentity).setPlayerProfile(gameprofile); + } + else + { + ((TileEntitySkull)tileentity).setType(stack.getMetadata()); + } + + ((TileEntitySkull)tileentity).setSkullRotation(enumfacing.getOpposite().getHorizontalIndex() * 4); + Blocks.skull.checkWitherSpawn(world, blockpos, (TileEntitySkull)tileentity); + } + + --stack.stackSize; + } + } + else + { + this.field_179240_b = false; + } + + return stack; + } + protected void playDispenseSound(IBlockSource source) + { + if (this.field_179240_b) + { + source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0); + } + else + { + source.getWorld().playAuxSFX(1001, source.getBlockPos(), 0); + } + } + }); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.getItemFromBlock(Blocks.pumpkin), new BehaviorDefaultDispenseItem() + { + private boolean field_179241_b = true; + protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + World world = source.getWorld(); + BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata())); + BlockPumpkin blockpumpkin = (BlockPumpkin)Blocks.pumpkin; + + if (world.isAirBlock(blockpos) && blockpumpkin.canDispenserPlace(world, blockpos)) + { + if (!world.isRemote) + { + world.setBlockState(blockpos, blockpumpkin.getDefaultState(), 3); + } + + --stack.stackSize; + } + else + { + this.field_179241_b = false; + } + + return stack; + } + protected void playDispenseSound(IBlockSource source) + { + if (this.field_179241_b) + { + source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0); + } + else + { + source.getWorld().playAuxSFX(1001, source.getBlockPos(), 0); + } + } + }); + } + + /** + * Registers blocks, items, stats, etc. + */ + public static void register() + { + if (!alreadyRegistered) + { + alreadyRegistered = true; + + if (LOGGER.isDebugEnabled()) + { + redirectOutputToLog(); + } + + Block.registerBlocks(); + BlockFire.init(); + Item.registerItems(); + StatList.init(); + registerDispenserBehaviors(); + } + } + + /** + * redirect standard streams to logger + */ + private static void redirectOutputToLog() + { + System.setErr(new LoggingPrintStream("STDERR", System.err)); + System.setOut(new LoggingPrintStream("STDOUT", SYSOUT)); + } + + public static void printToSYSOUT(String p_179870_0_) + { + SYSOUT.println(p_179870_0_); + } +} diff --git a/src/minecraft/net/minecraft/init/Items.java b/src/minecraft/net/minecraft/init/Items.java new file mode 100644 index 0000000..8e4d9e7 --- /dev/null +++ b/src/minecraft/net/minecraft/init/Items.java @@ -0,0 +1,407 @@ +package net.minecraft.init; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemArmorStand; +import net.minecraft.item.ItemBow; +import net.minecraft.item.ItemEmptyMap; +import net.minecraft.item.ItemEnchantedBook; +import net.minecraft.item.ItemFishingRod; +import net.minecraft.item.ItemMap; +import net.minecraft.item.ItemPotion; +import net.minecraft.item.ItemShears; +import net.minecraft.util.ResourceLocation; + +public class Items +{ + public static final Item iron_shovel; + public static final Item iron_pickaxe; + public static final Item iron_axe; + public static final Item flint_and_steel; + public static final Item apple; + public static final ItemBow bow; + public static final Item arrow; + public static final Item coal; + public static final Item diamond; + public static final Item iron_ingot; + public static final Item gold_ingot; + public static final Item iron_sword; + public static final Item wooden_sword; + public static final Item wooden_shovel; + public static final Item wooden_pickaxe; + public static final Item wooden_axe; + public static final Item stone_sword; + public static final Item stone_shovel; + public static final Item stone_pickaxe; + public static final Item stone_axe; + public static final Item diamond_sword; + public static final Item diamond_shovel; + public static final Item diamond_pickaxe; + public static final Item diamond_axe; + public static final Item stick; + public static final Item bowl; + public static final Item mushroom_stew; + public static final Item golden_sword; + public static final Item golden_shovel; + public static final Item golden_pickaxe; + public static final Item golden_axe; + public static final Item string; + public static final Item feather; + public static final Item gunpowder; + public static final Item wooden_hoe; + public static final Item stone_hoe; + public static final Item iron_hoe; + public static final Item diamond_hoe; + public static final Item golden_hoe; + public static final Item wheat_seeds; + public static final Item wheat; + public static final Item bread; + public static final ItemArmor leather_helmet; + public static final ItemArmor leather_chestplate; + public static final ItemArmor leather_leggings; + public static final ItemArmor leather_boots; + public static final ItemArmor chainmail_helmet; + public static final ItemArmor chainmail_chestplate; + public static final ItemArmor chainmail_leggings; + public static final ItemArmor chainmail_boots; + public static final ItemArmor iron_helmet; + public static final ItemArmor iron_chestplate; + public static final ItemArmor iron_leggings; + public static final ItemArmor iron_boots; + public static final ItemArmor diamond_helmet; + public static final ItemArmor diamond_chestplate; + public static final ItemArmor diamond_leggings; + public static final ItemArmor diamond_boots; + public static final ItemArmor golden_helmet; + public static final ItemArmor golden_chestplate; + public static final ItemArmor golden_leggings; + public static final ItemArmor golden_boots; + public static final Item flint; + public static final Item porkchop; + public static final Item cooked_porkchop; + public static final Item painting; + public static final Item golden_apple; + public static final Item sign; + public static final Item oak_door; + public static final Item spruce_door; + public static final Item birch_door; + public static final Item jungle_door; + public static final Item acacia_door; + public static final Item dark_oak_door; + public static final Item bucket; + public static final Item water_bucket; + public static final Item lava_bucket; + public static final Item minecart; + public static final Item saddle; + public static final Item iron_door; + public static final Item redstone; + public static final Item snowball; + public static final Item boat; + public static final Item leather; + public static final Item milk_bucket; + public static final Item brick; + public static final Item clay_ball; + public static final Item reeds; + public static final Item paper; + public static final Item book; + public static final Item slime_ball; + public static final Item chest_minecart; + public static final Item furnace_minecart; + public static final Item egg; + public static final Item compass; + public static final ItemFishingRod fishing_rod; + public static final Item clock; + public static final Item glowstone_dust; + public static final Item fish; + public static final Item cooked_fish; + public static final Item dye; + public static final Item bone; + public static final Item sugar; + public static final Item cake; + public static final Item bed; + public static final Item repeater; + public static final Item cookie; + public static final ItemMap filled_map; + public static final ItemShears shears; + public static final Item melon; + public static final Item pumpkin_seeds; + public static final Item melon_seeds; + public static final Item beef; + public static final Item cooked_beef; + public static final Item chicken; + public static final Item cooked_chicken; + public static final Item mutton; + public static final Item cooked_mutton; + public static final Item rabbit; + public static final Item cooked_rabbit; + public static final Item rabbit_stew; + public static final Item rabbit_foot; + public static final Item rabbit_hide; + public static final Item rotten_flesh; + public static final Item ender_pearl; + public static final Item blaze_rod; + public static final Item ghast_tear; + public static final Item gold_nugget; + public static final Item nether_wart; + public static final ItemPotion potionitem; + public static final Item glass_bottle; + public static final Item spider_eye; + public static final Item fermented_spider_eye; + public static final Item blaze_powder; + public static final Item magma_cream; + public static final Item brewing_stand; + public static final Item cauldron; + public static final Item ender_eye; + public static final Item speckled_melon; + public static final Item spawn_egg; + public static final Item experience_bottle; + public static final Item fire_charge; + public static final Item writable_book; + public static final Item written_book; + public static final Item emerald; + public static final Item item_frame; + public static final Item flower_pot; + public static final Item carrot; + public static final Item potato; + public static final Item baked_potato; + public static final Item poisonous_potato; + public static final ItemEmptyMap map; + public static final Item golden_carrot; + public static final Item skull; + public static final Item carrot_on_a_stick; + public static final Item nether_star; + public static final Item pumpkin_pie; + public static final Item fireworks; + public static final Item firework_charge; + public static final ItemEnchantedBook enchanted_book; + public static final Item comparator; + public static final Item netherbrick; + public static final Item quartz; + public static final Item tnt_minecart; + public static final Item hopper_minecart; + public static final ItemArmorStand armor_stand; + public static final Item iron_horse_armor; + public static final Item golden_horse_armor; + public static final Item diamond_horse_armor; + public static final Item lead; + public static final Item name_tag; + public static final Item command_block_minecart; + public static final Item record_13; + public static final Item record_cat; + public static final Item record_blocks; + public static final Item record_chirp; + public static final Item record_far; + public static final Item record_mall; + public static final Item record_mellohi; + public static final Item record_stal; + public static final Item record_strad; + public static final Item record_ward; + public static final Item record_11; + public static final Item record_wait; + public static final Item prismarine_shard; + public static final Item prismarine_crystals; + public static final Item banner; + + private static Item getRegisteredItem(String name) + { + return (Item)Item.itemRegistry.getObject(new ResourceLocation(name)); + } + + static + { + if (!Bootstrap.isRegistered()) + { + throw new RuntimeException("Accessed Items before Bootstrap!"); + } + else + { + iron_shovel = getRegisteredItem("iron_shovel"); + iron_pickaxe = getRegisteredItem("iron_pickaxe"); + iron_axe = getRegisteredItem("iron_axe"); + flint_and_steel = getRegisteredItem("flint_and_steel"); + apple = getRegisteredItem("apple"); + bow = (ItemBow)getRegisteredItem("bow"); + arrow = getRegisteredItem("arrow"); + coal = getRegisteredItem("coal"); + diamond = getRegisteredItem("diamond"); + iron_ingot = getRegisteredItem("iron_ingot"); + gold_ingot = getRegisteredItem("gold_ingot"); + iron_sword = getRegisteredItem("iron_sword"); + wooden_sword = getRegisteredItem("wooden_sword"); + wooden_shovel = getRegisteredItem("wooden_shovel"); + wooden_pickaxe = getRegisteredItem("wooden_pickaxe"); + wooden_axe = getRegisteredItem("wooden_axe"); + stone_sword = getRegisteredItem("stone_sword"); + stone_shovel = getRegisteredItem("stone_shovel"); + stone_pickaxe = getRegisteredItem("stone_pickaxe"); + stone_axe = getRegisteredItem("stone_axe"); + diamond_sword = getRegisteredItem("diamond_sword"); + diamond_shovel = getRegisteredItem("diamond_shovel"); + diamond_pickaxe = getRegisteredItem("diamond_pickaxe"); + diamond_axe = getRegisteredItem("diamond_axe"); + stick = getRegisteredItem("stick"); + bowl = getRegisteredItem("bowl"); + mushroom_stew = getRegisteredItem("mushroom_stew"); + golden_sword = getRegisteredItem("golden_sword"); + golden_shovel = getRegisteredItem("golden_shovel"); + golden_pickaxe = getRegisteredItem("golden_pickaxe"); + golden_axe = getRegisteredItem("golden_axe"); + string = getRegisteredItem("string"); + feather = getRegisteredItem("feather"); + gunpowder = getRegisteredItem("gunpowder"); + wooden_hoe = getRegisteredItem("wooden_hoe"); + stone_hoe = getRegisteredItem("stone_hoe"); + iron_hoe = getRegisteredItem("iron_hoe"); + diamond_hoe = getRegisteredItem("diamond_hoe"); + golden_hoe = getRegisteredItem("golden_hoe"); + wheat_seeds = getRegisteredItem("wheat_seeds"); + wheat = getRegisteredItem("wheat"); + bread = getRegisteredItem("bread"); + leather_helmet = (ItemArmor)getRegisteredItem("leather_helmet"); + leather_chestplate = (ItemArmor)getRegisteredItem("leather_chestplate"); + leather_leggings = (ItemArmor)getRegisteredItem("leather_leggings"); + leather_boots = (ItemArmor)getRegisteredItem("leather_boots"); + chainmail_helmet = (ItemArmor)getRegisteredItem("chainmail_helmet"); + chainmail_chestplate = (ItemArmor)getRegisteredItem("chainmail_chestplate"); + chainmail_leggings = (ItemArmor)getRegisteredItem("chainmail_leggings"); + chainmail_boots = (ItemArmor)getRegisteredItem("chainmail_boots"); + iron_helmet = (ItemArmor)getRegisteredItem("iron_helmet"); + iron_chestplate = (ItemArmor)getRegisteredItem("iron_chestplate"); + iron_leggings = (ItemArmor)getRegisteredItem("iron_leggings"); + iron_boots = (ItemArmor)getRegisteredItem("iron_boots"); + diamond_helmet = (ItemArmor)getRegisteredItem("diamond_helmet"); + diamond_chestplate = (ItemArmor)getRegisteredItem("diamond_chestplate"); + diamond_leggings = (ItemArmor)getRegisteredItem("diamond_leggings"); + diamond_boots = (ItemArmor)getRegisteredItem("diamond_boots"); + golden_helmet = (ItemArmor)getRegisteredItem("golden_helmet"); + golden_chestplate = (ItemArmor)getRegisteredItem("golden_chestplate"); + golden_leggings = (ItemArmor)getRegisteredItem("golden_leggings"); + golden_boots = (ItemArmor)getRegisteredItem("golden_boots"); + flint = getRegisteredItem("flint"); + porkchop = getRegisteredItem("porkchop"); + cooked_porkchop = getRegisteredItem("cooked_porkchop"); + painting = getRegisteredItem("painting"); + golden_apple = getRegisteredItem("golden_apple"); + sign = getRegisteredItem("sign"); + oak_door = getRegisteredItem("wooden_door"); + spruce_door = getRegisteredItem("spruce_door"); + birch_door = getRegisteredItem("birch_door"); + jungle_door = getRegisteredItem("jungle_door"); + acacia_door = getRegisteredItem("acacia_door"); + dark_oak_door = getRegisteredItem("dark_oak_door"); + bucket = getRegisteredItem("bucket"); + water_bucket = getRegisteredItem("water_bucket"); + lava_bucket = getRegisteredItem("lava_bucket"); + minecart = getRegisteredItem("minecart"); + saddle = getRegisteredItem("saddle"); + iron_door = getRegisteredItem("iron_door"); + redstone = getRegisteredItem("redstone"); + snowball = getRegisteredItem("snowball"); + boat = getRegisteredItem("boat"); + leather = getRegisteredItem("leather"); + milk_bucket = getRegisteredItem("milk_bucket"); + brick = getRegisteredItem("brick"); + clay_ball = getRegisteredItem("clay_ball"); + reeds = getRegisteredItem("reeds"); + paper = getRegisteredItem("paper"); + book = getRegisteredItem("book"); + slime_ball = getRegisteredItem("slime_ball"); + chest_minecart = getRegisteredItem("chest_minecart"); + furnace_minecart = getRegisteredItem("furnace_minecart"); + egg = getRegisteredItem("egg"); + compass = getRegisteredItem("compass"); + fishing_rod = (ItemFishingRod)getRegisteredItem("fishing_rod"); + clock = getRegisteredItem("clock"); + glowstone_dust = getRegisteredItem("glowstone_dust"); + fish = getRegisteredItem("fish"); + cooked_fish = getRegisteredItem("cooked_fish"); + dye = getRegisteredItem("dye"); + bone = getRegisteredItem("bone"); + sugar = getRegisteredItem("sugar"); + cake = getRegisteredItem("cake"); + bed = getRegisteredItem("bed"); + repeater = getRegisteredItem("repeater"); + cookie = getRegisteredItem("cookie"); + filled_map = (ItemMap)getRegisteredItem("filled_map"); + shears = (ItemShears)getRegisteredItem("shears"); + melon = getRegisteredItem("melon"); + pumpkin_seeds = getRegisteredItem("pumpkin_seeds"); + melon_seeds = getRegisteredItem("melon_seeds"); + beef = getRegisteredItem("beef"); + cooked_beef = getRegisteredItem("cooked_beef"); + chicken = getRegisteredItem("chicken"); + cooked_chicken = getRegisteredItem("cooked_chicken"); + mutton = getRegisteredItem("mutton"); + cooked_mutton = getRegisteredItem("cooked_mutton"); + rabbit = getRegisteredItem("rabbit"); + cooked_rabbit = getRegisteredItem("cooked_rabbit"); + rabbit_stew = getRegisteredItem("rabbit_stew"); + rabbit_foot = getRegisteredItem("rabbit_foot"); + rabbit_hide = getRegisteredItem("rabbit_hide"); + rotten_flesh = getRegisteredItem("rotten_flesh"); + ender_pearl = getRegisteredItem("ender_pearl"); + blaze_rod = getRegisteredItem("blaze_rod"); + ghast_tear = getRegisteredItem("ghast_tear"); + gold_nugget = getRegisteredItem("gold_nugget"); + nether_wart = getRegisteredItem("nether_wart"); + potionitem = (ItemPotion)getRegisteredItem("potion"); + glass_bottle = getRegisteredItem("glass_bottle"); + spider_eye = getRegisteredItem("spider_eye"); + fermented_spider_eye = getRegisteredItem("fermented_spider_eye"); + blaze_powder = getRegisteredItem("blaze_powder"); + magma_cream = getRegisteredItem("magma_cream"); + brewing_stand = getRegisteredItem("brewing_stand"); + cauldron = getRegisteredItem("cauldron"); + ender_eye = getRegisteredItem("ender_eye"); + speckled_melon = getRegisteredItem("speckled_melon"); + spawn_egg = getRegisteredItem("spawn_egg"); + experience_bottle = getRegisteredItem("experience_bottle"); + fire_charge = getRegisteredItem("fire_charge"); + writable_book = getRegisteredItem("writable_book"); + written_book = getRegisteredItem("written_book"); + emerald = getRegisteredItem("emerald"); + item_frame = getRegisteredItem("item_frame"); + flower_pot = getRegisteredItem("flower_pot"); + carrot = getRegisteredItem("carrot"); + potato = getRegisteredItem("potato"); + baked_potato = getRegisteredItem("baked_potato"); + poisonous_potato = getRegisteredItem("poisonous_potato"); + map = (ItemEmptyMap)getRegisteredItem("map"); + golden_carrot = getRegisteredItem("golden_carrot"); + skull = getRegisteredItem("skull"); + carrot_on_a_stick = getRegisteredItem("carrot_on_a_stick"); + nether_star = getRegisteredItem("nether_star"); + pumpkin_pie = getRegisteredItem("pumpkin_pie"); + fireworks = getRegisteredItem("fireworks"); + firework_charge = getRegisteredItem("firework_charge"); + enchanted_book = (ItemEnchantedBook)getRegisteredItem("enchanted_book"); + comparator = getRegisteredItem("comparator"); + netherbrick = getRegisteredItem("netherbrick"); + quartz = getRegisteredItem("quartz"); + tnt_minecart = getRegisteredItem("tnt_minecart"); + hopper_minecart = getRegisteredItem("hopper_minecart"); + armor_stand = (ItemArmorStand)getRegisteredItem("armor_stand"); + iron_horse_armor = getRegisteredItem("iron_horse_armor"); + golden_horse_armor = getRegisteredItem("golden_horse_armor"); + diamond_horse_armor = getRegisteredItem("diamond_horse_armor"); + lead = getRegisteredItem("lead"); + name_tag = getRegisteredItem("name_tag"); + command_block_minecart = getRegisteredItem("command_block_minecart"); + record_13 = getRegisteredItem("record_13"); + record_cat = getRegisteredItem("record_cat"); + record_blocks = getRegisteredItem("record_blocks"); + record_chirp = getRegisteredItem("record_chirp"); + record_far = getRegisteredItem("record_far"); + record_mall = getRegisteredItem("record_mall"); + record_mellohi = getRegisteredItem("record_mellohi"); + record_stal = getRegisteredItem("record_stal"); + record_strad = getRegisteredItem("record_strad"); + record_ward = getRegisteredItem("record_ward"); + record_11 = getRegisteredItem("record_11"); + record_wait = getRegisteredItem("record_wait"); + prismarine_shard = getRegisteredItem("prismarine_shard"); + prismarine_crystals = getRegisteredItem("prismarine_crystals"); + banner = getRegisteredItem("banner"); + } + } +} diff --git a/src/minecraft/net/minecraft/inventory/AnimalChest.java b/src/minecraft/net/minecraft/inventory/AnimalChest.java new file mode 100644 index 0000000..0fde8df --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/AnimalChest.java @@ -0,0 +1,16 @@ +package net.minecraft.inventory; + +import net.minecraft.util.IChatComponent; + +public class AnimalChest extends InventoryBasic +{ + public AnimalChest(String inventoryName, int slotCount) + { + super(inventoryName, false, slotCount); + } + + public AnimalChest(IChatComponent invTitle, int slotCount) + { + super(invTitle, slotCount); + } +} diff --git a/src/minecraft/net/minecraft/inventory/Container.java b/src/minecraft/net/minecraft/inventory/Container.java new file mode 100644 index 0000000..18b0ac8 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/Container.java @@ -0,0 +1,800 @@ +package net.minecraft.inventory; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.util.List; +import java.util.Set; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; + +public abstract class Container +{ + public List inventoryItemStacks = Lists.newArrayList(); + public List inventorySlots = Lists.newArrayList(); + public int windowId; + private short transactionID; + + /** + * The current drag mode (0 : evenly split, 1 : one item by slot, 2 : not used ?) + */ + private int dragMode = -1; + + /** The current drag event (0 : start, 1 : add slot : 2 : end) */ + private int dragEvent; + private final Set dragSlots = Sets.newHashSet(); + protected List crafters = Lists.newArrayList(); + private Set playerList = Sets.newHashSet(); + + /** + * Adds an item slot to this container + */ + protected Slot addSlotToContainer(Slot slotIn) + { + slotIn.slotNumber = this.inventorySlots.size(); + this.inventorySlots.add(slotIn); + this.inventoryItemStacks.add((ItemStack)null); + return slotIn; + } + + public void onCraftGuiOpened(ICrafting listener) + { + if (this.crafters.contains(listener)) + { + throw new IllegalArgumentException("Listener already listening"); + } + else + { + this.crafters.add(listener); + listener.updateCraftingInventory(this, this.getInventory()); + this.detectAndSendChanges(); + } + } + + /** + * Remove the given Listener. Method name is for legacy. + */ + public void removeCraftingFromCrafters(ICrafting listeners) + { + this.crafters.remove(listeners); + } + + public List getInventory() + { + List list = Lists.newArrayList(); + + for (int i = 0; i < this.inventorySlots.size(); ++i) + { + list.add(((Slot)this.inventorySlots.get(i)).getStack()); + } + + return list; + } + + /** + * Looks for changes made in the container, sends them to every listener. + */ + public void detectAndSendChanges() + { + for (int i = 0; i < this.inventorySlots.size(); ++i) + { + ItemStack itemstack = ((Slot)this.inventorySlots.get(i)).getStack(); + ItemStack itemstack1 = (ItemStack)this.inventoryItemStacks.get(i); + + if (!ItemStack.areItemStacksEqual(itemstack1, itemstack)) + { + itemstack1 = itemstack == null ? null : itemstack.copy(); + this.inventoryItemStacks.set(i, itemstack1); + + for (int j = 0; j < this.crafters.size(); ++j) + { + ((ICrafting)this.crafters.get(j)).sendSlotContents(this, i, itemstack1); + } + } + } + } + + /** + * Handles the given Button-click on the server, currently only used by enchanting. Name is for legacy. + */ + public boolean enchantItem(EntityPlayer playerIn, int id) + { + return false; + } + + public Slot getSlotFromInventory(IInventory inv, int slotIn) + { + for (int i = 0; i < this.inventorySlots.size(); ++i) + { + Slot slot = (Slot)this.inventorySlots.get(i); + + if (slot.isHere(inv, slotIn)) + { + return slot; + } + } + + return null; + } + + public Slot getSlot(int slotId) + { + return (Slot)this.inventorySlots.get(slotId); + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + Slot slot = (Slot)this.inventorySlots.get(index); + return slot != null ? slot.getStack() : null; + } + + /** + * Handles slot click. + */ + public ItemStack slotClick(int slotId, int clickedButton, int mode, EntityPlayer playerIn) + { + ItemStack itemstack = null; + InventoryPlayer inventoryplayer = playerIn.inventory; + + if (mode == 5) + { + int i = this.dragEvent; + this.dragEvent = getDragEvent(clickedButton); + + if ((i != 1 || this.dragEvent != 2) && i != this.dragEvent) + { + this.resetDrag(); + } + else if (inventoryplayer.getItemStack() == null) + { + this.resetDrag(); + } + else if (this.dragEvent == 0) + { + this.dragMode = extractDragMode(clickedButton); + + if (isValidDragMode(this.dragMode, playerIn)) + { + this.dragEvent = 1; + this.dragSlots.clear(); + } + else + { + this.resetDrag(); + } + } + else if (this.dragEvent == 1) + { + Slot slot = (Slot)this.inventorySlots.get(slotId); + + if (slot != null && canAddItemToSlot(slot, inventoryplayer.getItemStack(), true) && slot.isItemValid(inventoryplayer.getItemStack()) && inventoryplayer.getItemStack().stackSize > this.dragSlots.size() && this.canDragIntoSlot(slot)) + { + this.dragSlots.add(slot); + } + } + else if (this.dragEvent == 2) + { + if (!this.dragSlots.isEmpty()) + { + ItemStack itemstack3 = inventoryplayer.getItemStack().copy(); + int j = inventoryplayer.getItemStack().stackSize; + + for (Slot slot1 : this.dragSlots) + { + if (slot1 != null && canAddItemToSlot(slot1, inventoryplayer.getItemStack(), true) && slot1.isItemValid(inventoryplayer.getItemStack()) && inventoryplayer.getItemStack().stackSize >= this.dragSlots.size() && this.canDragIntoSlot(slot1)) + { + ItemStack itemstack1 = itemstack3.copy(); + int k = slot1.getHasStack() ? slot1.getStack().stackSize : 0; + computeStackSize(this.dragSlots, this.dragMode, itemstack1, k); + + if (itemstack1.stackSize > itemstack1.getMaxStackSize()) + { + itemstack1.stackSize = itemstack1.getMaxStackSize(); + } + + if (itemstack1.stackSize > slot1.getItemStackLimit(itemstack1)) + { + itemstack1.stackSize = slot1.getItemStackLimit(itemstack1); + } + + j -= itemstack1.stackSize - k; + slot1.putStack(itemstack1); + } + } + + itemstack3.stackSize = j; + + if (itemstack3.stackSize <= 0) + { + itemstack3 = null; + } + + inventoryplayer.setItemStack(itemstack3); + } + + this.resetDrag(); + } + else + { + this.resetDrag(); + } + } + else if (this.dragEvent != 0) + { + this.resetDrag(); + } + else if ((mode == 0 || mode == 1) && (clickedButton == 0 || clickedButton == 1)) + { + if (slotId == -999) + { + if (inventoryplayer.getItemStack() != null) + { + if (clickedButton == 0) + { + playerIn.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack(), true); + inventoryplayer.setItemStack((ItemStack)null); + } + + if (clickedButton == 1) + { + playerIn.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack().splitStack(1), true); + + if (inventoryplayer.getItemStack().stackSize == 0) + { + inventoryplayer.setItemStack((ItemStack)null); + } + } + } + } + else if (mode == 1) + { + if (slotId < 0) + { + return null; + } + + Slot slot6 = (Slot)this.inventorySlots.get(slotId); + + if (slot6 != null && slot6.canTakeStack(playerIn)) + { + ItemStack itemstack8 = this.transferStackInSlot(playerIn, slotId); + + if (itemstack8 != null) + { + Item item = itemstack8.getItem(); + itemstack = itemstack8.copy(); + + if (slot6.getStack() != null && slot6.getStack().getItem() == item) + { + this.retrySlotClick(slotId, clickedButton, true, playerIn); + } + } + } + } + else + { + if (slotId < 0) + { + return null; + } + + Slot slot7 = (Slot)this.inventorySlots.get(slotId); + + if (slot7 != null) + { + ItemStack itemstack9 = slot7.getStack(); + ItemStack itemstack10 = inventoryplayer.getItemStack(); + + if (itemstack9 != null) + { + itemstack = itemstack9.copy(); + } + + if (itemstack9 == null) + { + if (itemstack10 != null && slot7.isItemValid(itemstack10)) + { + int k2 = clickedButton == 0 ? itemstack10.stackSize : 1; + + if (k2 > slot7.getItemStackLimit(itemstack10)) + { + k2 = slot7.getItemStackLimit(itemstack10); + } + + if (itemstack10.stackSize >= k2) + { + slot7.putStack(itemstack10.splitStack(k2)); + } + + if (itemstack10.stackSize == 0) + { + inventoryplayer.setItemStack((ItemStack)null); + } + } + } + else if (slot7.canTakeStack(playerIn)) + { + if (itemstack10 == null) + { + int j2 = clickedButton == 0 ? itemstack9.stackSize : (itemstack9.stackSize + 1) / 2; + ItemStack itemstack12 = slot7.decrStackSize(j2); + inventoryplayer.setItemStack(itemstack12); + + if (itemstack9.stackSize == 0) + { + slot7.putStack((ItemStack)null); + } + + slot7.onPickupFromSlot(playerIn, inventoryplayer.getItemStack()); + } + else if (slot7.isItemValid(itemstack10)) + { + if (itemstack9.getItem() == itemstack10.getItem() && itemstack9.getMetadata() == itemstack10.getMetadata() && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10)) + { + int i2 = clickedButton == 0 ? itemstack10.stackSize : 1; + + if (i2 > slot7.getItemStackLimit(itemstack10) - itemstack9.stackSize) + { + i2 = slot7.getItemStackLimit(itemstack10) - itemstack9.stackSize; + } + + if (i2 > itemstack10.getMaxStackSize() - itemstack9.stackSize) + { + i2 = itemstack10.getMaxStackSize() - itemstack9.stackSize; + } + + itemstack10.splitStack(i2); + + if (itemstack10.stackSize == 0) + { + inventoryplayer.setItemStack((ItemStack)null); + } + + itemstack9.stackSize += i2; + } + else if (itemstack10.stackSize <= slot7.getItemStackLimit(itemstack10)) + { + slot7.putStack(itemstack10); + inventoryplayer.setItemStack(itemstack9); + } + } + else if (itemstack9.getItem() == itemstack10.getItem() && itemstack10.getMaxStackSize() > 1 && (!itemstack9.getHasSubtypes() || itemstack9.getMetadata() == itemstack10.getMetadata()) && ItemStack.areItemStackTagsEqual(itemstack9, itemstack10)) + { + int l1 = itemstack9.stackSize; + + if (l1 > 0 && l1 + itemstack10.stackSize <= itemstack10.getMaxStackSize()) + { + itemstack10.stackSize += l1; + itemstack9 = slot7.decrStackSize(l1); + + if (itemstack9.stackSize == 0) + { + slot7.putStack((ItemStack)null); + } + + slot7.onPickupFromSlot(playerIn, inventoryplayer.getItemStack()); + } + } + } + + slot7.onSlotChanged(); + } + } + } + else if (mode == 2 && clickedButton >= 0 && clickedButton < 9) + { + Slot slot5 = (Slot)this.inventorySlots.get(slotId); + + if (slot5.canTakeStack(playerIn)) + { + ItemStack itemstack7 = inventoryplayer.getStackInSlot(clickedButton); + boolean flag = itemstack7 == null || slot5.inventory == inventoryplayer && slot5.isItemValid(itemstack7); + int k1 = -1; + + if (!flag) + { + k1 = inventoryplayer.getFirstEmptyStack(); + flag |= k1 > -1; + } + + if (slot5.getHasStack() && flag) + { + ItemStack itemstack11 = slot5.getStack(); + inventoryplayer.setInventorySlotContents(clickedButton, itemstack11.copy()); + + if ((slot5.inventory != inventoryplayer || !slot5.isItemValid(itemstack7)) && itemstack7 != null) + { + if (k1 > -1) + { + inventoryplayer.addItemStackToInventory(itemstack7); + slot5.decrStackSize(itemstack11.stackSize); + slot5.putStack((ItemStack)null); + slot5.onPickupFromSlot(playerIn, itemstack11); + } + } + else + { + slot5.decrStackSize(itemstack11.stackSize); + slot5.putStack(itemstack7); + slot5.onPickupFromSlot(playerIn, itemstack11); + } + } + else if (!slot5.getHasStack() && itemstack7 != null && slot5.isItemValid(itemstack7)) + { + inventoryplayer.setInventorySlotContents(clickedButton, (ItemStack)null); + slot5.putStack(itemstack7); + } + } + } + else if (mode == 3 && playerIn.capabilities.isCreativeMode && inventoryplayer.getItemStack() == null && slotId >= 0) + { + Slot slot4 = (Slot)this.inventorySlots.get(slotId); + + if (slot4 != null && slot4.getHasStack()) + { + ItemStack itemstack6 = slot4.getStack().copy(); + itemstack6.stackSize = itemstack6.getMaxStackSize(); + inventoryplayer.setItemStack(itemstack6); + } + } + else if (mode == 4 && inventoryplayer.getItemStack() == null && slotId >= 0) + { + Slot slot3 = (Slot)this.inventorySlots.get(slotId); + + if (slot3 != null && slot3.getHasStack() && slot3.canTakeStack(playerIn)) + { + ItemStack itemstack5 = slot3.decrStackSize(clickedButton == 0 ? 1 : slot3.getStack().stackSize); + slot3.onPickupFromSlot(playerIn, itemstack5); + playerIn.dropPlayerItemWithRandomChoice(itemstack5, true); + } + } + else if (mode == 6 && slotId >= 0) + { + Slot slot2 = (Slot)this.inventorySlots.get(slotId); + ItemStack itemstack4 = inventoryplayer.getItemStack(); + + if (itemstack4 != null && (slot2 == null || !slot2.getHasStack() || !slot2.canTakeStack(playerIn))) + { + int i1 = clickedButton == 0 ? 0 : this.inventorySlots.size() - 1; + int j1 = clickedButton == 0 ? 1 : -1; + + for (int l2 = 0; l2 < 2; ++l2) + { + for (int i3 = i1; i3 >= 0 && i3 < this.inventorySlots.size() && itemstack4.stackSize < itemstack4.getMaxStackSize(); i3 += j1) + { + Slot slot8 = (Slot)this.inventorySlots.get(i3); + + if (slot8.getHasStack() && canAddItemToSlot(slot8, itemstack4, true) && slot8.canTakeStack(playerIn) && this.canMergeSlot(itemstack4, slot8) && (l2 != 0 || slot8.getStack().stackSize != slot8.getStack().getMaxStackSize())) + { + int l = Math.min(itemstack4.getMaxStackSize() - itemstack4.stackSize, slot8.getStack().stackSize); + ItemStack itemstack2 = slot8.decrStackSize(l); + itemstack4.stackSize += l; + + if (itemstack2.stackSize <= 0) + { + slot8.putStack((ItemStack)null); + } + + slot8.onPickupFromSlot(playerIn, itemstack2); + } + } + } + } + + this.detectAndSendChanges(); + } + + return itemstack; + } + + /** + * Called to determine if the current slot is valid for the stack merging (double-click) code. The stack passed in + * is null for the initial slot that was double-clicked. + */ + public boolean canMergeSlot(ItemStack stack, Slot p_94530_2_) + { + return true; + } + + /** + * Retries slotClick() in case of failure + */ + protected void retrySlotClick(int slotId, int clickedButton, boolean mode, EntityPlayer playerIn) + { + this.slotClick(slotId, clickedButton, 1, playerIn); + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer playerIn) + { + InventoryPlayer inventoryplayer = playerIn.inventory; + + if (inventoryplayer.getItemStack() != null) + { + playerIn.dropPlayerItemWithRandomChoice(inventoryplayer.getItemStack(), false); + inventoryplayer.setItemStack((ItemStack)null); + } + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory inventoryIn) + { + this.detectAndSendChanges(); + } + + /** + * args: slotID, itemStack to put in slot + */ + public void putStackInSlot(int slotID, ItemStack stack) + { + this.getSlot(slotID).putStack(stack); + } + + /** + * places itemstacks in first x slots, x being aitemstack.lenght + */ + public void putStacksInSlots(ItemStack[] p_75131_1_) + { + for (int i = 0; i < p_75131_1_.length; ++i) + { + this.getSlot(i).putStack(p_75131_1_[i]); + } + } + + public void updateProgressBar(int id, int data) + { + } + + /** + * Gets a unique transaction ID. Parameter is unused. + */ + public short getNextTransactionID(InventoryPlayer p_75136_1_) + { + ++this.transactionID; + return this.transactionID; + } + + /** + * gets whether or not the player can craft in this inventory or not + */ + public boolean getCanCraft(EntityPlayer p_75129_1_) + { + return !this.playerList.contains(p_75129_1_); + } + + /** + * sets whether the player can craft in this inventory or not + */ + public void setCanCraft(EntityPlayer p_75128_1_, boolean p_75128_2_) + { + if (p_75128_2_) + { + this.playerList.remove(p_75128_1_); + } + else + { + this.playerList.add(p_75128_1_); + } + } + + public abstract boolean canInteractWith(EntityPlayer playerIn); + + /** + * Merges provided ItemStack with the first avaliable one in the container/player inventor between minIndex + * (included) and maxIndex (excluded). Args : stack, minIndex, maxIndex, negativDirection. /!\ the Container + * implementation do not check if the item is valid for the slot + */ + protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection) + { + boolean flag = false; + int i = startIndex; + + if (reverseDirection) + { + i = endIndex - 1; + } + + if (stack.isStackable()) + { + while (stack.stackSize > 0 && (!reverseDirection && i < endIndex || reverseDirection && i >= startIndex)) + { + Slot slot = (Slot)this.inventorySlots.get(i); + ItemStack itemstack = slot.getStack(); + + if (itemstack != null && itemstack.getItem() == stack.getItem() && (!stack.getHasSubtypes() || stack.getMetadata() == itemstack.getMetadata()) && ItemStack.areItemStackTagsEqual(stack, itemstack)) + { + int j = itemstack.stackSize + stack.stackSize; + + if (j <= stack.getMaxStackSize()) + { + stack.stackSize = 0; + itemstack.stackSize = j; + slot.onSlotChanged(); + flag = true; + } + else if (itemstack.stackSize < stack.getMaxStackSize()) + { + stack.stackSize -= stack.getMaxStackSize() - itemstack.stackSize; + itemstack.stackSize = stack.getMaxStackSize(); + slot.onSlotChanged(); + flag = true; + } + } + + if (reverseDirection) + { + --i; + } + else + { + ++i; + } + } + } + + if (stack.stackSize > 0) + { + if (reverseDirection) + { + i = endIndex - 1; + } + else + { + i = startIndex; + } + + while (!reverseDirection && i < endIndex || reverseDirection && i >= startIndex) + { + Slot slot1 = (Slot)this.inventorySlots.get(i); + ItemStack itemstack1 = slot1.getStack(); + + if (itemstack1 == null) + { + slot1.putStack(stack.copy()); + slot1.onSlotChanged(); + stack.stackSize = 0; + flag = true; + break; + } + + if (reverseDirection) + { + --i; + } + else + { + ++i; + } + } + } + + return flag; + } + + /** + * Extracts the drag mode. Args : eventButton. Return (0 : evenly split, 1 : one item by slot, 2 : not used ?) + */ + public static int extractDragMode(int p_94529_0_) + { + return p_94529_0_ >> 2 & 3; + } + + /** + * Args : clickedButton, Returns (0 : start drag, 1 : add slot, 2 : end drag) + */ + public static int getDragEvent(int p_94532_0_) + { + return p_94532_0_ & 3; + } + + public static int func_94534_d(int p_94534_0_, int p_94534_1_) + { + return p_94534_0_ & 3 | (p_94534_1_ & 3) << 2; + } + + public static boolean isValidDragMode(int dragModeIn, EntityPlayer player) + { + return dragModeIn == 0 ? true : (dragModeIn == 1 ? true : dragModeIn == 2 && player.capabilities.isCreativeMode); + } + + /** + * Reset the drag fields + */ + protected void resetDrag() + { + this.dragEvent = 0; + this.dragSlots.clear(); + } + + /** + * Checks if it's possible to add the given itemstack to the given slot. + */ + public static boolean canAddItemToSlot(Slot slotIn, ItemStack stack, boolean stackSizeMatters) + { + boolean flag = slotIn == null || !slotIn.getHasStack(); + + if (slotIn != null && slotIn.getHasStack() && stack != null && stack.isItemEqual(slotIn.getStack()) && ItemStack.areItemStackTagsEqual(slotIn.getStack(), stack)) + { + flag |= slotIn.getStack().stackSize + (stackSizeMatters ? 0 : stack.stackSize) <= stack.getMaxStackSize(); + } + + return flag; + } + + /** + * Compute the new stack size, Returns the stack with the new size. Args : dragSlots, dragMode, dragStack, + * slotStackSize + */ + public static void computeStackSize(Set p_94525_0_, int p_94525_1_, ItemStack p_94525_2_, int p_94525_3_) + { + switch (p_94525_1_) + { + case 0: + p_94525_2_.stackSize = MathHelper.floor_float((float)p_94525_2_.stackSize / (float)p_94525_0_.size()); + break; + + case 1: + p_94525_2_.stackSize = 1; + break; + + case 2: + p_94525_2_.stackSize = p_94525_2_.getItem().getItemStackLimit(); + } + + p_94525_2_.stackSize += p_94525_3_; + } + + /** + * Returns true if the player can "drag-spilt" items into this slot,. returns true by default. Called to check if + * the slot can be added to a list of Slots to split the held ItemStack across. + */ + public boolean canDragIntoSlot(Slot p_94531_1_) + { + return true; + } + + /** + * Like the version that takes an inventory. If the given TileEntity is not an Inventory, 0 is returned instead. + */ + public static int calcRedstone(TileEntity te) + { + return te instanceof IInventory ? calcRedstoneFromInventory((IInventory)te) : 0; + } + + public static int calcRedstoneFromInventory(IInventory inv) + { + if (inv == null) + { + return 0; + } + else + { + int i = 0; + float f = 0.0F; + + for (int j = 0; j < inv.getSizeInventory(); ++j) + { + ItemStack itemstack = inv.getStackInSlot(j); + + if (itemstack != null) + { + f += (float)itemstack.stackSize / (float)Math.min(inv.getInventoryStackLimit(), itemstack.getMaxStackSize()); + ++i; + } + } + + f = f / (float)inv.getSizeInventory(); + return MathHelper.floor_float(f * 14.0F) + (i > 0 ? 1 : 0); + } + } +} diff --git a/src/minecraft/net/minecraft/inventory/ContainerBeacon.java b/src/minecraft/net/minecraft/inventory/ContainerBeacon.java new file mode 100644 index 0000000..f4bfe61 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ContainerBeacon.java @@ -0,0 +1,161 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +public class ContainerBeacon extends Container +{ + private IInventory tileBeacon; + + /** + * This beacon's slot where you put in Emerald, Diamond, Gold or Iron Ingot. + */ + private final ContainerBeacon.BeaconSlot beaconSlot; + + public ContainerBeacon(IInventory playerInventory, IInventory tileBeaconIn) + { + this.tileBeacon = tileBeaconIn; + this.addSlotToContainer(this.beaconSlot = new ContainerBeacon.BeaconSlot(tileBeaconIn, 0, 136, 110)); + int i = 36; + int j = 137; + + for (int k = 0; k < 3; ++k) + { + for (int l = 0; l < 9; ++l) + { + this.addSlotToContainer(new Slot(playerInventory, l + k * 9 + 9, i + l * 18, j + k * 18)); + } + } + + for (int i1 = 0; i1 < 9; ++i1) + { + this.addSlotToContainer(new Slot(playerInventory, i1, i + i1 * 18, 58 + j)); + } + } + + public void onCraftGuiOpened(ICrafting listener) + { + super.onCraftGuiOpened(listener); + listener.func_175173_a(this, this.tileBeacon); + } + + public void updateProgressBar(int id, int data) + { + this.tileBeacon.setField(id, data); + } + + public IInventory func_180611_e() + { + return this.tileBeacon; + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer playerIn) + { + super.onContainerClosed(playerIn); + + if (playerIn != null && !playerIn.worldObj.isRemote) + { + ItemStack itemstack = this.beaconSlot.decrStackSize(this.beaconSlot.getSlotStackLimit()); + + if (itemstack != null) + { + playerIn.dropPlayerItemWithRandomChoice(itemstack, false); + } + } + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return this.tileBeacon.isUseableByPlayer(playerIn); + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (index == 0) + { + if (!this.mergeItemStack(itemstack1, 1, 37, true)) + { + return null; + } + + slot.onSlotChange(itemstack1, itemstack); + } + else if (!this.beaconSlot.getHasStack() && this.beaconSlot.isItemValid(itemstack1) && itemstack1.stackSize == 1) + { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) + { + return null; + } + } + else if (index >= 1 && index < 28) + { + if (!this.mergeItemStack(itemstack1, 28, 37, false)) + { + return null; + } + } + else if (index >= 28 && index < 37) + { + if (!this.mergeItemStack(itemstack1, 1, 28, false)) + { + return null; + } + } + else if (!this.mergeItemStack(itemstack1, 1, 37, false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + + if (itemstack1.stackSize == itemstack.stackSize) + { + return null; + } + + slot.onPickupFromSlot(playerIn, itemstack1); + } + + return itemstack; + } + + class BeaconSlot extends Slot + { + public BeaconSlot(IInventory p_i1801_2_, int p_i1801_3_, int p_i1801_4_, int p_i1801_5_) + { + super(p_i1801_2_, p_i1801_3_, p_i1801_4_, p_i1801_5_); + } + + public boolean isItemValid(ItemStack stack) + { + return stack == null ? false : stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; + } + + public int getSlotStackLimit() + { + return 1; + } + } +} diff --git a/src/minecraft/net/minecraft/inventory/ContainerBrewingStand.java b/src/minecraft/net/minecraft/inventory/ContainerBrewingStand.java new file mode 100644 index 0000000..1254ff9 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ContainerBrewingStand.java @@ -0,0 +1,206 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.AchievementList; + +public class ContainerBrewingStand extends Container +{ + private IInventory tileBrewingStand; + + /** Instance of Slot. */ + private final Slot theSlot; + private int brewTime; + + public ContainerBrewingStand(InventoryPlayer playerInventory, IInventory tileBrewingStandIn) + { + this.tileBrewingStand = tileBrewingStandIn; + this.addSlotToContainer(new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 0, 56, 46)); + this.addSlotToContainer(new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 1, 79, 53)); + this.addSlotToContainer(new ContainerBrewingStand.Potion(playerInventory.player, tileBrewingStandIn, 2, 102, 46)); + this.theSlot = this.addSlotToContainer(new ContainerBrewingStand.Ingredient(tileBrewingStandIn, 3, 79, 17)); + + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 9; ++j) + { + this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + + for (int k = 0; k < 9; ++k) + { + this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142)); + } + } + + public void onCraftGuiOpened(ICrafting listener) + { + super.onCraftGuiOpened(listener); + listener.func_175173_a(this, this.tileBrewingStand); + } + + /** + * Looks for changes made in the container, sends them to every listener. + */ + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + + for (int i = 0; i < this.crafters.size(); ++i) + { + ICrafting icrafting = (ICrafting)this.crafters.get(i); + + if (this.brewTime != this.tileBrewingStand.getField(0)) + { + icrafting.sendProgressBarUpdate(this, 0, this.tileBrewingStand.getField(0)); + } + } + + this.brewTime = this.tileBrewingStand.getField(0); + } + + public void updateProgressBar(int id, int data) + { + this.tileBrewingStand.setField(id, data); + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return this.tileBrewingStand.isUseableByPlayer(playerIn); + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if ((index < 0 || index > 2) && index != 3) + { + if (!this.theSlot.getHasStack() && this.theSlot.isItemValid(itemstack1)) + { + if (!this.mergeItemStack(itemstack1, 3, 4, false)) + { + return null; + } + } + else if (ContainerBrewingStand.Potion.canHoldPotion(itemstack)) + { + if (!this.mergeItemStack(itemstack1, 0, 3, false)) + { + return null; + } + } + else if (index >= 4 && index < 31) + { + if (!this.mergeItemStack(itemstack1, 31, 40, false)) + { + return null; + } + } + else if (index >= 31 && index < 40) + { + if (!this.mergeItemStack(itemstack1, 4, 31, false)) + { + return null; + } + } + else if (!this.mergeItemStack(itemstack1, 4, 40, false)) + { + return null; + } + } + else + { + if (!this.mergeItemStack(itemstack1, 4, 40, true)) + { + return null; + } + + slot.onSlotChange(itemstack1, itemstack); + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + + if (itemstack1.stackSize == itemstack.stackSize) + { + return null; + } + + slot.onPickupFromSlot(playerIn, itemstack1); + } + + return itemstack; + } + + class Ingredient extends Slot + { + public Ingredient(IInventory inventoryIn, int index, int xPosition, int yPosition) + { + super(inventoryIn, index, xPosition, yPosition); + } + + public boolean isItemValid(ItemStack stack) + { + return stack != null ? stack.getItem().isPotionIngredient(stack) : false; + } + + public int getSlotStackLimit() + { + return 64; + } + } + + static class Potion extends Slot + { + private EntityPlayer player; + + public Potion(EntityPlayer playerIn, IInventory inventoryIn, int index, int xPosition, int yPosition) + { + super(inventoryIn, index, xPosition, yPosition); + this.player = playerIn; + } + + public boolean isItemValid(ItemStack stack) + { + return canHoldPotion(stack); + } + + public int getSlotStackLimit() + { + return 1; + } + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { + if (stack.getItem() == Items.potionitem && stack.getMetadata() > 0) + { + this.player.triggerAchievement(AchievementList.potion); + } + + super.onPickupFromSlot(playerIn, stack); + } + + public static boolean canHoldPotion(ItemStack stack) + { + return stack != null && (stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle); + } + } +} diff --git a/src/minecraft/net/minecraft/inventory/ContainerChest.java b/src/minecraft/net/minecraft/inventory/ContainerChest.java new file mode 100644 index 0000000..641777e --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ContainerChest.java @@ -0,0 +1,99 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +public class ContainerChest extends Container +{ + private IInventory lowerChestInventory; + private int numRows; + + public ContainerChest(IInventory playerInventory, IInventory chestInventory, EntityPlayer player) + { + this.lowerChestInventory = chestInventory; + this.numRows = chestInventory.getSizeInventory() / 9; + chestInventory.openInventory(player); + int i = (this.numRows - 4) * 18; + + for (int j = 0; j < this.numRows; ++j) + { + for (int k = 0; k < 9; ++k) + { + this.addSlotToContainer(new Slot(chestInventory, k + j * 9, 8 + k * 18, 18 + j * 18)); + } + } + + for (int l = 0; l < 3; ++l) + { + for (int j1 = 0; j1 < 9; ++j1) + { + this.addSlotToContainer(new Slot(playerInventory, j1 + l * 9 + 9, 8 + j1 * 18, 103 + l * 18 + i)); + } + } + + for (int i1 = 0; i1 < 9; ++i1) + { + this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 161 + i)); + } + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return this.lowerChestInventory.isUseableByPlayer(playerIn); + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (index < this.numRows * 9) + { + if (!this.mergeItemStack(itemstack1, this.numRows * 9, this.inventorySlots.size(), true)) + { + return null; + } + } + else if (!this.mergeItemStack(itemstack1, 0, this.numRows * 9, false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + } + + return itemstack; + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer playerIn) + { + super.onContainerClosed(playerIn); + this.lowerChestInventory.closeInventory(playerIn); + } + + /** + * Return this chest container's lower chest inventory. + */ + public IInventory getLowerChestInventory() + { + return this.lowerChestInventory; + } +} diff --git a/src/minecraft/net/minecraft/inventory/ContainerDispenser.java b/src/minecraft/net/minecraft/inventory/ContainerDispenser.java new file mode 100644 index 0000000..ba9fd33 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ContainerDispenser.java @@ -0,0 +1,85 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +public class ContainerDispenser extends Container +{ + private IInventory dispenserInventory; + + public ContainerDispenser(IInventory playerInventory, IInventory dispenserInventoryIn) + { + this.dispenserInventory = dispenserInventoryIn; + + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 3; ++j) + { + this.addSlotToContainer(new Slot(dispenserInventoryIn, j + i * 3, 62 + j * 18, 17 + i * 18)); + } + } + + for (int k = 0; k < 3; ++k) + { + for (int i1 = 0; i1 < 9; ++i1) + { + this.addSlotToContainer(new Slot(playerInventory, i1 + k * 9 + 9, 8 + i1 * 18, 84 + k * 18)); + } + } + + for (int l = 0; l < 9; ++l) + { + this.addSlotToContainer(new Slot(playerInventory, l, 8 + l * 18, 142)); + } + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return this.dispenserInventory.isUseableByPlayer(playerIn); + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (index < 9) + { + if (!this.mergeItemStack(itemstack1, 9, 45, true)) + { + return null; + } + } + else if (!this.mergeItemStack(itemstack1, 0, 9, false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + + if (itemstack1.stackSize == itemstack.stackSize) + { + return null; + } + + slot.onPickupFromSlot(playerIn, itemstack1); + } + + return itemstack; + } +} diff --git a/src/minecraft/net/minecraft/inventory/ContainerEnchantment.java b/src/minecraft/net/minecraft/inventory/ContainerEnchantment.java new file mode 100644 index 0000000..00a9688 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ContainerEnchantment.java @@ -0,0 +1,425 @@ +package net.minecraft.inventory; + +import java.util.List; +import java.util.Random; +import net.minecraft.enchantment.EnchantmentData; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class ContainerEnchantment extends Container +{ + /** SlotEnchantmentTable object with ItemStack to be enchanted */ + public IInventory tableInventory; + + /** current world (for bookshelf counting) */ + private World worldPointer; + private BlockPos position; + private Random rand; + public int xpSeed; + + /** 3-member array storing the enchantment levels of each slot */ + public int[] enchantLevels; + public int[] field_178151_h; + + public ContainerEnchantment(InventoryPlayer playerInv, World worldIn) + { + this(playerInv, worldIn, BlockPos.ORIGIN); + } + + public ContainerEnchantment(InventoryPlayer playerInv, World worldIn, BlockPos pos) + { + this.tableInventory = new InventoryBasic("Enchant", true, 2) + { + public int getInventoryStackLimit() + { + return 64; + } + public void markDirty() + { + super.markDirty(); + ContainerEnchantment.this.onCraftMatrixChanged(this); + } + }; + this.rand = new Random(); + this.enchantLevels = new int[3]; + this.field_178151_h = new int[] { -1, -1, -1}; + this.worldPointer = worldIn; + this.position = pos; + this.xpSeed = playerInv.player.getXPSeed(); + this.addSlotToContainer(new Slot(this.tableInventory, 0, 15, 47) + { + public boolean isItemValid(ItemStack stack) + { + return true; + } + public int getSlotStackLimit() + { + return 1; + } + }); + this.addSlotToContainer(new Slot(this.tableInventory, 1, 35, 47) + { + public boolean isItemValid(ItemStack stack) + { + return stack.getItem() == Items.dye && EnumDyeColor.byDyeDamage(stack.getMetadata()) == EnumDyeColor.BLUE; + } + }); + + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 9; ++j) + { + this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + + for (int k = 0; k < 9; ++k) + { + this.addSlotToContainer(new Slot(playerInv, k, 8 + k * 18, 142)); + } + } + + public void onCraftGuiOpened(ICrafting listener) + { + super.onCraftGuiOpened(listener); + listener.sendProgressBarUpdate(this, 0, this.enchantLevels[0]); + listener.sendProgressBarUpdate(this, 1, this.enchantLevels[1]); + listener.sendProgressBarUpdate(this, 2, this.enchantLevels[2]); + listener.sendProgressBarUpdate(this, 3, this.xpSeed & -16); + listener.sendProgressBarUpdate(this, 4, this.field_178151_h[0]); + listener.sendProgressBarUpdate(this, 5, this.field_178151_h[1]); + listener.sendProgressBarUpdate(this, 6, this.field_178151_h[2]); + } + + /** + * Looks for changes made in the container, sends them to every listener. + */ + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + + for (int i = 0; i < this.crafters.size(); ++i) + { + ICrafting icrafting = (ICrafting)this.crafters.get(i); + icrafting.sendProgressBarUpdate(this, 0, this.enchantLevels[0]); + icrafting.sendProgressBarUpdate(this, 1, this.enchantLevels[1]); + icrafting.sendProgressBarUpdate(this, 2, this.enchantLevels[2]); + icrafting.sendProgressBarUpdate(this, 3, this.xpSeed & -16); + icrafting.sendProgressBarUpdate(this, 4, this.field_178151_h[0]); + icrafting.sendProgressBarUpdate(this, 5, this.field_178151_h[1]); + icrafting.sendProgressBarUpdate(this, 6, this.field_178151_h[2]); + } + } + + public void updateProgressBar(int id, int data) + { + if (id >= 0 && id <= 2) + { + this.enchantLevels[id] = data; + } + else if (id == 3) + { + this.xpSeed = data; + } + else if (id >= 4 && id <= 6) + { + this.field_178151_h[id - 4] = data; + } + else + { + super.updateProgressBar(id, data); + } + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory inventoryIn) + { + if (inventoryIn == this.tableInventory) + { + ItemStack itemstack = inventoryIn.getStackInSlot(0); + + if (itemstack != null && itemstack.isItemEnchantable()) + { + if (!this.worldPointer.isRemote) + { + int l = 0; + + for (int j = -1; j <= 1; ++j) + { + for (int k = -1; k <= 1; ++k) + { + if ((j != 0 || k != 0) && this.worldPointer.isAirBlock(this.position.add(k, 0, j)) && this.worldPointer.isAirBlock(this.position.add(k, 1, j))) + { + if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j * 2)).getBlock() == Blocks.bookshelf) + { + ++l; + } + + if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j * 2)).getBlock() == Blocks.bookshelf) + { + ++l; + } + + if (k != 0 && j != 0) + { + if (this.worldPointer.getBlockState(this.position.add(k * 2, 0, j)).getBlock() == Blocks.bookshelf) + { + ++l; + } + + if (this.worldPointer.getBlockState(this.position.add(k * 2, 1, j)).getBlock() == Blocks.bookshelf) + { + ++l; + } + + if (this.worldPointer.getBlockState(this.position.add(k, 0, j * 2)).getBlock() == Blocks.bookshelf) + { + ++l; + } + + if (this.worldPointer.getBlockState(this.position.add(k, 1, j * 2)).getBlock() == Blocks.bookshelf) + { + ++l; + } + } + } + } + } + + this.rand.setSeed((long)this.xpSeed); + + for (int i1 = 0; i1 < 3; ++i1) + { + this.enchantLevels[i1] = EnchantmentHelper.calcItemStackEnchantability(this.rand, i1, l, itemstack); + this.field_178151_h[i1] = -1; + + if (this.enchantLevels[i1] < i1 + 1) + { + this.enchantLevels[i1] = 0; + } + } + + for (int j1 = 0; j1 < 3; ++j1) + { + if (this.enchantLevels[j1] > 0) + { + List list = this.func_178148_a(itemstack, j1, this.enchantLevels[j1]); + + if (list != null && !list.isEmpty()) + { + EnchantmentData enchantmentdata = (EnchantmentData)list.get(this.rand.nextInt(list.size())); + this.field_178151_h[j1] = enchantmentdata.enchantmentobj.effectId | enchantmentdata.enchantmentLevel << 8; + } + } + } + + this.detectAndSendChanges(); + } + } + else + { + for (int i = 0; i < 3; ++i) + { + this.enchantLevels[i] = 0; + this.field_178151_h[i] = -1; + } + } + } + } + + /** + * Handles the given Button-click on the server, currently only used by enchanting. Name is for legacy. + */ + public boolean enchantItem(EntityPlayer playerIn, int id) + { + ItemStack itemstack = this.tableInventory.getStackInSlot(0); + ItemStack itemstack1 = this.tableInventory.getStackInSlot(1); + int i = id + 1; + + if ((itemstack1 == null || itemstack1.stackSize < i) && !playerIn.capabilities.isCreativeMode) + { + return false; + } + else if (this.enchantLevels[id] > 0 && itemstack != null && (playerIn.experienceLevel >= i && playerIn.experienceLevel >= this.enchantLevels[id] || playerIn.capabilities.isCreativeMode)) + { + if (!this.worldPointer.isRemote) + { + List list = this.func_178148_a(itemstack, id, this.enchantLevels[id]); + boolean flag = itemstack.getItem() == Items.book; + + if (list != null) + { + playerIn.removeExperienceLevel(i); + + if (flag) + { + itemstack.setItem(Items.enchanted_book); + } + + for (int j = 0; j < list.size(); ++j) + { + EnchantmentData enchantmentdata = (EnchantmentData)list.get(j); + + if (flag) + { + Items.enchanted_book.addEnchantment(itemstack, enchantmentdata); + } + else + { + itemstack.addEnchantment(enchantmentdata.enchantmentobj, enchantmentdata.enchantmentLevel); + } + } + + if (!playerIn.capabilities.isCreativeMode) + { + itemstack1.stackSize -= i; + + if (itemstack1.stackSize <= 0) + { + this.tableInventory.setInventorySlotContents(1, (ItemStack)null); + } + } + + playerIn.triggerAchievement(StatList.field_181739_W); + this.tableInventory.markDirty(); + this.xpSeed = playerIn.getXPSeed(); + this.onCraftMatrixChanged(this.tableInventory); + } + } + + return true; + } + else + { + return false; + } + } + + private List func_178148_a(ItemStack stack, int p_178148_2_, int p_178148_3_) + { + this.rand.setSeed((long)(this.xpSeed + p_178148_2_)); + List list = EnchantmentHelper.buildEnchantmentList(this.rand, stack, p_178148_3_); + + if (stack.getItem() == Items.book && list != null && list.size() > 1) + { + list.remove(this.rand.nextInt(list.size())); + } + + return list; + } + + public int getLapisAmount() + { + ItemStack itemstack = this.tableInventory.getStackInSlot(1); + return itemstack == null ? 0 : itemstack.stackSize; + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer playerIn) + { + super.onContainerClosed(playerIn); + + if (!this.worldPointer.isRemote) + { + for (int i = 0; i < this.tableInventory.getSizeInventory(); ++i) + { + ItemStack itemstack = this.tableInventory.removeStackFromSlot(i); + + if (itemstack != null) + { + playerIn.dropPlayerItemWithRandomChoice(itemstack, false); + } + } + } + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return this.worldPointer.getBlockState(this.position).getBlock() != Blocks.enchanting_table ? false : playerIn.getDistanceSq((double)this.position.getX() + 0.5D, (double)this.position.getY() + 0.5D, (double)this.position.getZ() + 0.5D) <= 64.0D; + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (index == 0) + { + if (!this.mergeItemStack(itemstack1, 2, 38, true)) + { + return null; + } + } + else if (index == 1) + { + if (!this.mergeItemStack(itemstack1, 2, 38, true)) + { + return null; + } + } + else if (itemstack1.getItem() == Items.dye && EnumDyeColor.byDyeDamage(itemstack1.getMetadata()) == EnumDyeColor.BLUE) + { + if (!this.mergeItemStack(itemstack1, 1, 2, true)) + { + return null; + } + } + else + { + if (((Slot)this.inventorySlots.get(0)).getHasStack() || !((Slot)this.inventorySlots.get(0)).isItemValid(itemstack1)) + { + return null; + } + + if (itemstack1.hasTagCompound() && itemstack1.stackSize == 1) + { + ((Slot)this.inventorySlots.get(0)).putStack(itemstack1.copy()); + itemstack1.stackSize = 0; + } + else if (itemstack1.stackSize >= 1) + { + ((Slot)this.inventorySlots.get(0)).putStack(new ItemStack(itemstack1.getItem(), 1, itemstack1.getMetadata())); + --itemstack1.stackSize; + } + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + + if (itemstack1.stackSize == itemstack.stackSize) + { + return null; + } + + slot.onPickupFromSlot(playerIn, itemstack1); + } + + return itemstack; + } +} diff --git a/src/minecraft/net/minecraft/inventory/ContainerFurnace.java b/src/minecraft/net/minecraft/inventory/ContainerFurnace.java new file mode 100644 index 0000000..9c91288 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ContainerFurnace.java @@ -0,0 +1,166 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.tileentity.TileEntityFurnace; + +public class ContainerFurnace extends Container +{ + private final IInventory tileFurnace; + private int field_178152_f; + private int field_178153_g; + private int field_178154_h; + private int field_178155_i; + + public ContainerFurnace(InventoryPlayer playerInventory, IInventory furnaceInventory) + { + this.tileFurnace = furnaceInventory; + this.addSlotToContainer(new Slot(furnaceInventory, 0, 56, 17)); + this.addSlotToContainer(new SlotFurnaceFuel(furnaceInventory, 1, 56, 53)); + this.addSlotToContainer(new SlotFurnaceOutput(playerInventory.player, furnaceInventory, 2, 116, 35)); + + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 9; ++j) + { + this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + + for (int k = 0; k < 9; ++k) + { + this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142)); + } + } + + public void onCraftGuiOpened(ICrafting listener) + { + super.onCraftGuiOpened(listener); + listener.func_175173_a(this, this.tileFurnace); + } + + /** + * Looks for changes made in the container, sends them to every listener. + */ + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + + for (int i = 0; i < this.crafters.size(); ++i) + { + ICrafting icrafting = (ICrafting)this.crafters.get(i); + + if (this.field_178152_f != this.tileFurnace.getField(2)) + { + icrafting.sendProgressBarUpdate(this, 2, this.tileFurnace.getField(2)); + } + + if (this.field_178154_h != this.tileFurnace.getField(0)) + { + icrafting.sendProgressBarUpdate(this, 0, this.tileFurnace.getField(0)); + } + + if (this.field_178155_i != this.tileFurnace.getField(1)) + { + icrafting.sendProgressBarUpdate(this, 1, this.tileFurnace.getField(1)); + } + + if (this.field_178153_g != this.tileFurnace.getField(3)) + { + icrafting.sendProgressBarUpdate(this, 3, this.tileFurnace.getField(3)); + } + } + + this.field_178152_f = this.tileFurnace.getField(2); + this.field_178154_h = this.tileFurnace.getField(0); + this.field_178155_i = this.tileFurnace.getField(1); + this.field_178153_g = this.tileFurnace.getField(3); + } + + public void updateProgressBar(int id, int data) + { + this.tileFurnace.setField(id, data); + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return this.tileFurnace.isUseableByPlayer(playerIn); + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (index == 2) + { + if (!this.mergeItemStack(itemstack1, 3, 39, true)) + { + return null; + } + + slot.onSlotChange(itemstack1, itemstack); + } + else if (index != 1 && index != 0) + { + if (FurnaceRecipes.instance().getSmeltingResult(itemstack1) != null) + { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) + { + return null; + } + } + else if (TileEntityFurnace.isItemFuel(itemstack1)) + { + if (!this.mergeItemStack(itemstack1, 1, 2, false)) + { + return null; + } + } + else if (index >= 3 && index < 30) + { + if (!this.mergeItemStack(itemstack1, 30, 39, false)) + { + return null; + } + } + else if (index >= 30 && index < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) + { + return null; + } + } + else if (!this.mergeItemStack(itemstack1, 3, 39, false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + + if (itemstack1.stackSize == itemstack.stackSize) + { + return null; + } + + slot.onPickupFromSlot(playerIn, itemstack1); + } + + return itemstack; + } +} diff --git a/src/minecraft/net/minecraft/inventory/ContainerHopper.java b/src/minecraft/net/minecraft/inventory/ContainerHopper.java new file mode 100644 index 0000000..6aeea0d --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ContainerHopper.java @@ -0,0 +1,87 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; + +public class ContainerHopper extends Container +{ + private final IInventory hopperInventory; + + public ContainerHopper(InventoryPlayer playerInventory, IInventory hopperInventoryIn, EntityPlayer player) + { + this.hopperInventory = hopperInventoryIn; + hopperInventoryIn.openInventory(player); + int i = 51; + + for (int j = 0; j < hopperInventoryIn.getSizeInventory(); ++j) + { + this.addSlotToContainer(new Slot(hopperInventoryIn, j, 44 + j * 18, 20)); + } + + for (int l = 0; l < 3; ++l) + { + for (int k = 0; k < 9; ++k) + { + this.addSlotToContainer(new Slot(playerInventory, k + l * 9 + 9, 8 + k * 18, l * 18 + i)); + } + } + + for (int i1 = 0; i1 < 9; ++i1) + { + this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 58 + i)); + } + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return this.hopperInventory.isUseableByPlayer(playerIn); + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (index < this.hopperInventory.getSizeInventory()) + { + if (!this.mergeItemStack(itemstack1, this.hopperInventory.getSizeInventory(), this.inventorySlots.size(), true)) + { + return null; + } + } + else if (!this.mergeItemStack(itemstack1, 0, this.hopperInventory.getSizeInventory(), false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + } + + return itemstack; + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer playerIn) + { + super.onContainerClosed(playerIn); + this.hopperInventory.closeInventory(playerIn); + } +} diff --git a/src/minecraft/net/minecraft/inventory/ContainerHorseInventory.java b/src/minecraft/net/minecraft/inventory/ContainerHorseInventory.java new file mode 100644 index 0000000..73211a2 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ContainerHorseInventory.java @@ -0,0 +1,129 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +public class ContainerHorseInventory extends Container +{ + private IInventory horseInventory; + private EntityHorse theHorse; + + public ContainerHorseInventory(IInventory playerInventory, final IInventory horseInventoryIn, final EntityHorse horse, EntityPlayer player) + { + this.horseInventory = horseInventoryIn; + this.theHorse = horse; + int i = 3; + horseInventoryIn.openInventory(player); + int j = (i - 4) * 18; + this.addSlotToContainer(new Slot(horseInventoryIn, 0, 8, 18) + { + public boolean isItemValid(ItemStack stack) + { + return super.isItemValid(stack) && stack.getItem() == Items.saddle && !this.getHasStack(); + } + }); + this.addSlotToContainer(new Slot(horseInventoryIn, 1, 8, 36) + { + public boolean isItemValid(ItemStack stack) + { + return super.isItemValid(stack) && horse.canWearArmor() && EntityHorse.isArmorItem(stack.getItem()); + } + public boolean canBeHovered() + { + return horse.canWearArmor(); + } + }); + + if (horse.isChested()) + { + for (int k = 0; k < i; ++k) + { + for (int l = 0; l < 5; ++l) + { + this.addSlotToContainer(new Slot(horseInventoryIn, 2 + l + k * 5, 80 + l * 18, 18 + k * 18)); + } + } + } + + for (int i1 = 0; i1 < 3; ++i1) + { + for (int k1 = 0; k1 < 9; ++k1) + { + this.addSlotToContainer(new Slot(playerInventory, k1 + i1 * 9 + 9, 8 + k1 * 18, 102 + i1 * 18 + j)); + } + } + + for (int j1 = 0; j1 < 9; ++j1) + { + this.addSlotToContainer(new Slot(playerInventory, j1, 8 + j1 * 18, 160 + j)); + } + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return this.horseInventory.isUseableByPlayer(playerIn) && this.theHorse.isEntityAlive() && this.theHorse.getDistanceToEntity(playerIn) < 8.0F; + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (index < this.horseInventory.getSizeInventory()) + { + if (!this.mergeItemStack(itemstack1, this.horseInventory.getSizeInventory(), this.inventorySlots.size(), true)) + { + return null; + } + } + else if (this.getSlot(1).isItemValid(itemstack1) && !this.getSlot(1).getHasStack()) + { + if (!this.mergeItemStack(itemstack1, 1, 2, false)) + { + return null; + } + } + else if (this.getSlot(0).isItemValid(itemstack1)) + { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) + { + return null; + } + } + else if (this.horseInventory.getSizeInventory() <= 2 || !this.mergeItemStack(itemstack1, 2, this.horseInventory.getSizeInventory(), false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + } + + return itemstack; + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer playerIn) + { + super.onContainerClosed(playerIn); + this.horseInventory.closeInventory(playerIn); + } +} diff --git a/src/minecraft/net/minecraft/inventory/ContainerMerchant.java b/src/minecraft/net/minecraft/inventory/ContainerMerchant.java new file mode 100644 index 0000000..81fd002 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ContainerMerchant.java @@ -0,0 +1,169 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.IMerchant; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class ContainerMerchant extends Container +{ + /** Instance of Merchant. */ + private IMerchant theMerchant; + private InventoryMerchant merchantInventory; + + /** Instance of World. */ + private final World theWorld; + + public ContainerMerchant(InventoryPlayer playerInventory, IMerchant merchant, World worldIn) + { + this.theMerchant = merchant; + this.theWorld = worldIn; + this.merchantInventory = new InventoryMerchant(playerInventory.player, merchant); + this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53)); + this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53)); + this.addSlotToContainer(new SlotMerchantResult(playerInventory.player, merchant, this.merchantInventory, 2, 120, 53)); + + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 9; ++j) + { + this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + + for (int k = 0; k < 9; ++k) + { + this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142)); + } + } + + public InventoryMerchant getMerchantInventory() + { + return this.merchantInventory; + } + + public void onCraftGuiOpened(ICrafting listener) + { + super.onCraftGuiOpened(listener); + } + + /** + * Looks for changes made in the container, sends them to every listener. + */ + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory inventoryIn) + { + this.merchantInventory.resetRecipeAndSlots(); + super.onCraftMatrixChanged(inventoryIn); + } + + public void setCurrentRecipeIndex(int currentRecipeIndex) + { + this.merchantInventory.setCurrentRecipeIndex(currentRecipeIndex); + } + + public void updateProgressBar(int id, int data) + { + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return this.theMerchant.getCustomer() == playerIn; + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (index == 2) + { + if (!this.mergeItemStack(itemstack1, 3, 39, true)) + { + return null; + } + + slot.onSlotChange(itemstack1, itemstack); + } + else if (index != 0 && index != 1) + { + if (index >= 3 && index < 30) + { + if (!this.mergeItemStack(itemstack1, 30, 39, false)) + { + return null; + } + } + else if (index >= 30 && index < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) + { + return null; + } + } + else if (!this.mergeItemStack(itemstack1, 3, 39, false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + + if (itemstack1.stackSize == itemstack.stackSize) + { + return null; + } + + slot.onPickupFromSlot(playerIn, itemstack1); + } + + return itemstack; + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer playerIn) + { + super.onContainerClosed(playerIn); + this.theMerchant.setCustomer((EntityPlayer)null); + super.onContainerClosed(playerIn); + + if (!this.theWorld.isRemote) + { + ItemStack itemstack = this.merchantInventory.removeStackFromSlot(0); + + if (itemstack != null) + { + playerIn.dropPlayerItemWithRandomChoice(itemstack, false); + } + + itemstack = this.merchantInventory.removeStackFromSlot(1); + + if (itemstack != null) + { + playerIn.dropPlayerItemWithRandomChoice(itemstack, false); + } + } + } +} diff --git a/src/minecraft/net/minecraft/inventory/ContainerPlayer.java b/src/minecraft/net/minecraft/inventory/ContainerPlayer.java new file mode 100644 index 0000000..33d9693 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ContainerPlayer.java @@ -0,0 +1,197 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; + +public class ContainerPlayer extends Container +{ + /** The crafting matrix inventory. */ + public InventoryCrafting craftMatrix = new InventoryCrafting(this, 2, 2); + public IInventory craftResult = new InventoryCraftResult(); + + /** Determines if inventory manipulation should be handled. */ + public boolean isLocalWorld; + private final EntityPlayer thePlayer; + + public ContainerPlayer(final InventoryPlayer playerInventory, boolean localWorld, EntityPlayer player) + { + this.isLocalWorld = localWorld; + this.thePlayer = player; + this.addSlotToContainer(new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 144, 36)); + + for (int i = 0; i < 2; ++i) + { + for (int j = 0; j < 2; ++j) + { + this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 2, 88 + j * 18, 26 + i * 18)); + } + } + + for (int k = 0; k < 4; ++k) + { + final int k_f = k; + this.addSlotToContainer(new Slot(playerInventory, playerInventory.getSizeInventory() - 1 - k, 8, 8 + k * 18) + { + public int getSlotStackLimit() + { + return 1; + } + public boolean isItemValid(ItemStack stack) + { + return stack == null ? false : (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType == k_f : (stack.getItem() != Item.getItemFromBlock(Blocks.pumpkin) && stack.getItem() != Items.skull ? false : k_f == 0)); + } + public String getSlotTexture() + { + return ItemArmor.EMPTY_SLOT_NAMES[k_f]; + } + }); + } + + for (int l = 0; l < 3; ++l) + { + for (int j1 = 0; j1 < 9; ++j1) + { + this.addSlotToContainer(new Slot(playerInventory, j1 + (l + 1) * 9, 8 + j1 * 18, 84 + l * 18)); + } + } + + for (int i1 = 0; i1 < 9; ++i1) + { + this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 142)); + } + + this.onCraftMatrixChanged(this.craftMatrix); + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory inventoryIn) + { + this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.thePlayer.worldObj)); + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer playerIn) + { + super.onContainerClosed(playerIn); + + for (int i = 0; i < 4; ++i) + { + ItemStack itemstack = this.craftMatrix.removeStackFromSlot(i); + + if (itemstack != null) + { + playerIn.dropPlayerItemWithRandomChoice(itemstack, false); + } + } + + this.craftResult.setInventorySlotContents(0, (ItemStack)null); + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return true; + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (index == 0) + { + if (!this.mergeItemStack(itemstack1, 9, 45, true)) + { + return null; + } + + slot.onSlotChange(itemstack1, itemstack); + } + else if (index >= 1 && index < 5) + { + if (!this.mergeItemStack(itemstack1, 9, 45, false)) + { + return null; + } + } + else if (index >= 5 && index < 9) + { + if (!this.mergeItemStack(itemstack1, 9, 45, false)) + { + return null; + } + } + else if (itemstack.getItem() instanceof ItemArmor && !((Slot)this.inventorySlots.get(5 + ((ItemArmor)itemstack.getItem()).armorType)).getHasStack()) + { + int i = 5 + ((ItemArmor)itemstack.getItem()).armorType; + + if (!this.mergeItemStack(itemstack1, i, i + 1, false)) + { + return null; + } + } + else if (index >= 9 && index < 36) + { + if (!this.mergeItemStack(itemstack1, 36, 45, false)) + { + return null; + } + } + else if (index >= 36 && index < 45) + { + if (!this.mergeItemStack(itemstack1, 9, 36, false)) + { + return null; + } + } + else if (!this.mergeItemStack(itemstack1, 9, 45, false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + + if (itemstack1.stackSize == itemstack.stackSize) + { + return null; + } + + slot.onPickupFromSlot(playerIn, itemstack1); + } + + return itemstack; + } + + /** + * Called to determine if the current slot is valid for the stack merging (double-click) code. The stack passed in + * is null for the initial slot that was double-clicked. + */ + public boolean canMergeSlot(ItemStack stack, Slot p_94530_2_) + { + return p_94530_2_.inventory != this.craftResult && super.canMergeSlot(stack, p_94530_2_); + } +} diff --git a/src/minecraft/net/minecraft/inventory/ContainerRepair.java b/src/minecraft/net/minecraft/inventory/ContainerRepair.java new file mode 100644 index 0000000..37ad02b --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ContainerRepair.java @@ -0,0 +1,506 @@ +package net.minecraft.inventory; + +import java.util.Iterator; +import java.util.Map; +import net.minecraft.block.BlockAnvil; +import net.minecraft.block.state.IBlockState; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ContainerRepair extends Container +{ + private static final Logger logger = LogManager.getLogger(); + + /** Here comes out item you merged and/or renamed. */ + private IInventory outputSlot; + + /** + * The 2slots where you put your items in that you want to merge and/or rename. + */ + private IInventory inputSlots; + private World theWorld; + private BlockPos selfPosition; + + /** The maximum cost of repairing/renaming in the anvil. */ + public int maximumCost; + + /** determined by damage of input item and stackSize of repair materials */ + private int materialCost; + private String repairedItemName; + + /** The player that has this container open. */ + private final EntityPlayer thePlayer; + + public ContainerRepair(InventoryPlayer playerInventory, World worldIn, EntityPlayer player) + { + this(playerInventory, worldIn, BlockPos.ORIGIN, player); + } + + public ContainerRepair(InventoryPlayer playerInventory, final World worldIn, final BlockPos blockPosIn, EntityPlayer player) + { + this.outputSlot = new InventoryCraftResult(); + this.inputSlots = new InventoryBasic("Repair", true, 2) + { + public void markDirty() + { + super.markDirty(); + ContainerRepair.this.onCraftMatrixChanged(this); + } + }; + this.selfPosition = blockPosIn; + this.theWorld = worldIn; + this.thePlayer = player; + this.addSlotToContainer(new Slot(this.inputSlots, 0, 27, 47)); + this.addSlotToContainer(new Slot(this.inputSlots, 1, 76, 47)); + this.addSlotToContainer(new Slot(this.outputSlot, 2, 134, 47) + { + public boolean isItemValid(ItemStack stack) + { + return false; + } + public boolean canTakeStack(EntityPlayer playerIn) + { + return (playerIn.capabilities.isCreativeMode || playerIn.experienceLevel >= ContainerRepair.this.maximumCost) && ContainerRepair.this.maximumCost > 0 && this.getHasStack(); + } + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { + if (!playerIn.capabilities.isCreativeMode) + { + playerIn.addExperienceLevel(-ContainerRepair.this.maximumCost); + } + + ContainerRepair.this.inputSlots.setInventorySlotContents(0, (ItemStack)null); + + if (ContainerRepair.this.materialCost > 0) + { + ItemStack itemstack = ContainerRepair.this.inputSlots.getStackInSlot(1); + + if (itemstack != null && itemstack.stackSize > ContainerRepair.this.materialCost) + { + itemstack.stackSize -= ContainerRepair.this.materialCost; + ContainerRepair.this.inputSlots.setInventorySlotContents(1, itemstack); + } + else + { + ContainerRepair.this.inputSlots.setInventorySlotContents(1, (ItemStack)null); + } + } + else + { + ContainerRepair.this.inputSlots.setInventorySlotContents(1, (ItemStack)null); + } + + ContainerRepair.this.maximumCost = 0; + IBlockState iblockstate = worldIn.getBlockState(blockPosIn); + + if (!playerIn.capabilities.isCreativeMode && !worldIn.isRemote && iblockstate.getBlock() == Blocks.anvil && playerIn.getRNG().nextFloat() < 0.12F) + { + int l = ((Integer)iblockstate.getValue(BlockAnvil.DAMAGE)).intValue(); + ++l; + + if (l > 2) + { + worldIn.setBlockToAir(blockPosIn); + worldIn.playAuxSFX(1020, blockPosIn, 0); + } + else + { + worldIn.setBlockState(blockPosIn, iblockstate.withProperty(BlockAnvil.DAMAGE, Integer.valueOf(l)), 2); + worldIn.playAuxSFX(1021, blockPosIn, 0); + } + } + else if (!worldIn.isRemote) + { + worldIn.playAuxSFX(1021, blockPosIn, 0); + } + } + }); + + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 9; ++j) + { + this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + } + } + + for (int k = 0; k < 9; ++k) + { + this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142)); + } + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory inventoryIn) + { + super.onCraftMatrixChanged(inventoryIn); + + if (inventoryIn == this.inputSlots) + { + this.updateRepairOutput(); + } + } + + /** + * called when the Anvil Input Slot changes, calculates the new result and puts it in the output slot + */ + public void updateRepairOutput() + { + int i = 0; + int j = 1; + int k = 1; + int l = 1; + int i1 = 2; + int j1 = 1; + int k1 = 1; + ItemStack itemstack = this.inputSlots.getStackInSlot(0); + this.maximumCost = 1; + int l1 = 0; + int i2 = 0; + int j2 = 0; + + if (itemstack == null) + { + this.outputSlot.setInventorySlotContents(0, (ItemStack)null); + this.maximumCost = 0; + } + else + { + ItemStack itemstack1 = itemstack.copy(); + ItemStack itemstack2 = this.inputSlots.getStackInSlot(1); + Map map = EnchantmentHelper.getEnchantments(itemstack1); + boolean flag = false; + i2 = i2 + itemstack.getRepairCost() + (itemstack2 == null ? 0 : itemstack2.getRepairCost()); + this.materialCost = 0; + + if (itemstack2 != null) + { + flag = itemstack2.getItem() == Items.enchanted_book && Items.enchanted_book.getEnchantments(itemstack2).tagCount() > 0; + + if (itemstack1.isItemStackDamageable() && itemstack1.getItem().getIsRepairable(itemstack, itemstack2)) + { + int j4 = Math.min(itemstack1.getItemDamage(), itemstack1.getMaxDamage() / 4); + + if (j4 <= 0) + { + this.outputSlot.setInventorySlotContents(0, (ItemStack)null); + this.maximumCost = 0; + return; + } + + int l4; + + for (l4 = 0; j4 > 0 && l4 < itemstack2.stackSize; ++l4) + { + int j5 = itemstack1.getItemDamage() - j4; + itemstack1.setItemDamage(j5); + ++l1; + j4 = Math.min(itemstack1.getItemDamage(), itemstack1.getMaxDamage() / 4); + } + + this.materialCost = l4; + } + else + { + if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.isItemStackDamageable())) + { + this.outputSlot.setInventorySlotContents(0, (ItemStack)null); + this.maximumCost = 0; + return; + } + + if (itemstack1.isItemStackDamageable() && !flag) + { + int k2 = itemstack.getMaxDamage() - itemstack.getItemDamage(); + int l2 = itemstack2.getMaxDamage() - itemstack2.getItemDamage(); + int i3 = l2 + itemstack1.getMaxDamage() * 12 / 100; + int j3 = k2 + i3; + int k3 = itemstack1.getMaxDamage() - j3; + + if (k3 < 0) + { + k3 = 0; + } + + if (k3 < itemstack1.getMetadata()) + { + itemstack1.setItemDamage(k3); + l1 += 2; + } + } + + Map map1 = EnchantmentHelper.getEnchantments(itemstack2); + Iterator iterator1 = map1.keySet().iterator(); + + while (iterator1.hasNext()) + { + int i5 = ((Integer)iterator1.next()).intValue(); + Enchantment enchantment = Enchantment.getEnchantmentById(i5); + + if (enchantment != null) + { + int k5 = map.containsKey(Integer.valueOf(i5)) ? ((Integer)map.get(Integer.valueOf(i5))).intValue() : 0; + int l3 = ((Integer)map1.get(Integer.valueOf(i5))).intValue(); + int i6; + + if (k5 == l3) + { + ++l3; + i6 = l3; + } + else + { + i6 = Math.max(l3, k5); + } + + l3 = i6; + boolean flag1 = enchantment.canApply(itemstack); + + if (this.thePlayer.capabilities.isCreativeMode || itemstack.getItem() == Items.enchanted_book) + { + flag1 = true; + } + + Iterator iterator = map.keySet().iterator(); + + while (iterator.hasNext()) + { + int i4 = ((Integer)iterator.next()).intValue(); + + if (i4 != i5 && !enchantment.canApplyTogether(Enchantment.getEnchantmentById(i4))) + { + flag1 = false; + ++l1; + } + } + + if (flag1) + { + if (l3 > enchantment.getMaxLevel()) + { + l3 = enchantment.getMaxLevel(); + } + + map.put(Integer.valueOf(i5), Integer.valueOf(l3)); + int l5 = 0; + + switch (enchantment.getWeight()) + { + case 1: + l5 = 8; + break; + + case 2: + l5 = 4; + + case 3: + case 4: + case 6: + case 7: + case 8: + case 9: + default: + break; + + case 5: + l5 = 2; + break; + + case 10: + l5 = 1; + } + + if (flag) + { + l5 = Math.max(1, l5 / 2); + } + + l1 += l5 * l3; + } + } + } + } + } + + if (StringUtils.isBlank(this.repairedItemName)) + { + if (itemstack.hasDisplayName()) + { + j2 = 1; + l1 += j2; + itemstack1.clearCustomName(); + } + } + else if (!this.repairedItemName.equals(itemstack.getDisplayName())) + { + j2 = 1; + l1 += j2; + itemstack1.setStackDisplayName(this.repairedItemName); + } + + this.maximumCost = i2 + l1; + + if (l1 <= 0) + { + itemstack1 = null; + } + + if (j2 == l1 && j2 > 0 && this.maximumCost >= 40) + { + this.maximumCost = 39; + } + + if (this.maximumCost >= 40 && !this.thePlayer.capabilities.isCreativeMode) + { + itemstack1 = null; + } + + if (itemstack1 != null) + { + int k4 = itemstack1.getRepairCost(); + + if (itemstack2 != null && k4 < itemstack2.getRepairCost()) + { + k4 = itemstack2.getRepairCost(); + } + + k4 = k4 * 2 + 1; + itemstack1.setRepairCost(k4); + EnchantmentHelper.setEnchantments(map, itemstack1); + } + + this.outputSlot.setInventorySlotContents(0, itemstack1); + this.detectAndSendChanges(); + } + } + + public void onCraftGuiOpened(ICrafting listener) + { + super.onCraftGuiOpened(listener); + listener.sendProgressBarUpdate(this, 0, this.maximumCost); + } + + public void updateProgressBar(int id, int data) + { + if (id == 0) + { + this.maximumCost = data; + } + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer playerIn) + { + super.onContainerClosed(playerIn); + + if (!this.theWorld.isRemote) + { + for (int i = 0; i < this.inputSlots.getSizeInventory(); ++i) + { + ItemStack itemstack = this.inputSlots.removeStackFromSlot(i); + + if (itemstack != null) + { + playerIn.dropPlayerItemWithRandomChoice(itemstack, false); + } + } + } + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return this.theWorld.getBlockState(this.selfPosition).getBlock() != Blocks.anvil ? false : playerIn.getDistanceSq((double)this.selfPosition.getX() + 0.5D, (double)this.selfPosition.getY() + 0.5D, (double)this.selfPosition.getZ() + 0.5D) <= 64.0D; + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (index == 2) + { + if (!this.mergeItemStack(itemstack1, 3, 39, true)) + { + return null; + } + + slot.onSlotChange(itemstack1, itemstack); + } + else if (index != 0 && index != 1) + { + if (index >= 3 && index < 39 && !this.mergeItemStack(itemstack1, 0, 2, false)) + { + return null; + } + } + else if (!this.mergeItemStack(itemstack1, 3, 39, false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + + if (itemstack1.stackSize == itemstack.stackSize) + { + return null; + } + + slot.onPickupFromSlot(playerIn, itemstack1); + } + + return itemstack; + } + + /** + * used by the Anvil GUI to update the Item Name being typed by the player + */ + public void updateItemName(String newName) + { + this.repairedItemName = newName; + + if (this.getSlot(2).getHasStack()) + { + ItemStack itemstack = this.getSlot(2).getStack(); + + if (StringUtils.isBlank(newName)) + { + itemstack.clearCustomName(); + } + else + { + itemstack.setStackDisplayName(this.repairedItemName); + } + } + + this.updateRepairOutput(); + } +} diff --git a/src/minecraft/net/minecraft/inventory/ContainerWorkbench.java b/src/minecraft/net/minecraft/inventory/ContainerWorkbench.java new file mode 100644 index 0000000..007abf6 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ContainerWorkbench.java @@ -0,0 +1,154 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class ContainerWorkbench extends Container +{ + /** The crafting matrix inventory (3x3). */ + public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); + public IInventory craftResult = new InventoryCraftResult(); + private World worldObj; + + /** Position of the workbench */ + private BlockPos pos; + + public ContainerWorkbench(InventoryPlayer playerInventory, World worldIn, BlockPos posIn) + { + this.worldObj = worldIn; + this.pos = posIn; + this.addSlotToContainer(new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 124, 35)); + + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 3; ++j) + { + this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 3, 30 + j * 18, 17 + i * 18)); + } + } + + for (int k = 0; k < 3; ++k) + { + for (int i1 = 0; i1 < 9; ++i1) + { + this.addSlotToContainer(new Slot(playerInventory, i1 + k * 9 + 9, 8 + i1 * 18, 84 + k * 18)); + } + } + + for (int l = 0; l < 9; ++l) + { + this.addSlotToContainer(new Slot(playerInventory, l, 8 + l * 18, 142)); + } + + this.onCraftMatrixChanged(this.craftMatrix); + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory inventoryIn) + { + this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer playerIn) + { + super.onContainerClosed(playerIn); + + if (!this.worldObj.isRemote) + { + for (int i = 0; i < 9; ++i) + { + ItemStack itemstack = this.craftMatrix.removeStackFromSlot(i); + + if (itemstack != null) + { + playerIn.dropPlayerItemWithRandomChoice(itemstack, false); + } + } + } + } + + public boolean canInteractWith(EntityPlayer playerIn) + { + return this.worldObj.getBlockState(this.pos).getBlock() != Blocks.crafting_table ? false : playerIn.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; + } + + /** + * Take a stack from the specified inventory slot. + */ + public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) + { + ItemStack itemstack = null; + Slot slot = (Slot)this.inventorySlots.get(index); + + if (slot != null && slot.getHasStack()) + { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + + if (index == 0) + { + if (!this.mergeItemStack(itemstack1, 10, 46, true)) + { + return null; + } + + slot.onSlotChange(itemstack1, itemstack); + } + else if (index >= 10 && index < 37) + { + if (!this.mergeItemStack(itemstack1, 37, 46, false)) + { + return null; + } + } + else if (index >= 37 && index < 46) + { + if (!this.mergeItemStack(itemstack1, 10, 37, false)) + { + return null; + } + } + else if (!this.mergeItemStack(itemstack1, 10, 46, false)) + { + return null; + } + + if (itemstack1.stackSize == 0) + { + slot.putStack((ItemStack)null); + } + else + { + slot.onSlotChanged(); + } + + if (itemstack1.stackSize == itemstack.stackSize) + { + return null; + } + + slot.onPickupFromSlot(playerIn, itemstack1); + } + + return itemstack; + } + + /** + * Called to determine if the current slot is valid for the stack merging (double-click) code. The stack passed in + * is null for the initial slot that was double-clicked. + */ + public boolean canMergeSlot(ItemStack stack, Slot p_94530_2_) + { + return p_94530_2_.inventory != this.craftResult && super.canMergeSlot(stack, p_94530_2_); + } +} diff --git a/src/minecraft/net/minecraft/inventory/ICrafting.java b/src/minecraft/net/minecraft/inventory/ICrafting.java new file mode 100644 index 0000000..265df7c --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ICrafting.java @@ -0,0 +1,27 @@ +package net.minecraft.inventory; + +import java.util.List; +import net.minecraft.item.ItemStack; + +public interface ICrafting +{ + /** + * update the crafting window inventory with the items in the list + */ + void updateCraftingInventory(Container containerToSend, List itemsList); + + /** + * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual + * contents of that slot. Args: Container, slot number, slot contents + */ + void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack); + + /** + * Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress, + * and enchanting level. Normally the first int identifies which variable to update, and the second contains the new + * value. Both are truncated to shorts in non-local SMP. + */ + void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue); + + void func_175173_a(Container p_175173_1_, IInventory p_175173_2_); +} diff --git a/src/minecraft/net/minecraft/inventory/IInvBasic.java b/src/minecraft/net/minecraft/inventory/IInvBasic.java new file mode 100644 index 0000000..ff13604 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/IInvBasic.java @@ -0,0 +1,9 @@ +package net.minecraft.inventory; + +public interface IInvBasic +{ + /** + * Called by InventoryBasic.onInventoryChanged() on a array that is never filled. + */ + void onInventoryChanged(InventoryBasic p_76316_1_); +} diff --git a/src/minecraft/net/minecraft/inventory/IInventory.java b/src/minecraft/net/minecraft/inventory/IInventory.java new file mode 100644 index 0000000..01e37ec --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/IInventory.java @@ -0,0 +1,66 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.IWorldNameable; + +public interface IInventory extends IWorldNameable +{ + /** + * Returns the number of slots in the inventory. + */ + int getSizeInventory(); + + /** + * Returns the stack in the given slot. + */ + ItemStack getStackInSlot(int index); + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + ItemStack decrStackSize(int index, int count); + + /** + * Removes a stack from the given slot and returns it. + */ + ItemStack removeStackFromSlot(int index); + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + void setInventorySlotContents(int index, ItemStack stack); + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + int getInventoryStackLimit(); + + /** + * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it + * hasn't changed and skip it. + */ + void markDirty(); + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + boolean isUseableByPlayer(EntityPlayer player); + + void openInventory(EntityPlayer player); + + void closeInventory(EntityPlayer player); + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + boolean isItemValidForSlot(int index, ItemStack stack); + + int getField(int id); + + void setField(int id, int value); + + int getFieldCount(); + + void clear(); +} diff --git a/src/minecraft/net/minecraft/inventory/ISidedInventory.java b/src/minecraft/net/minecraft/inventory/ISidedInventory.java new file mode 100644 index 0000000..d11992b --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/ISidedInventory.java @@ -0,0 +1,21 @@ +package net.minecraft.inventory; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; + +public interface ISidedInventory extends IInventory +{ + int[] getSlotsForFace(EnumFacing side); + + /** + * Returns true if automation can insert the given item in the given slot from the given side. Args: slot, item, + * side + */ + boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction); + + /** + * Returns true if automation can extract the given item in the given slot from the given side. Args: slot, item, + * side + */ + boolean canExtractItem(int index, ItemStack stack, EnumFacing direction); +} diff --git a/src/minecraft/net/minecraft/inventory/InventoryBasic.java b/src/minecraft/net/minecraft/inventory/InventoryBasic.java new file mode 100644 index 0000000..6e60487 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/InventoryBasic.java @@ -0,0 +1,271 @@ +package net.minecraft.inventory; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; + +public class InventoryBasic implements IInventory +{ + private String inventoryTitle; + private int slotsCount; + private ItemStack[] inventoryContents; + private List field_70480_d; + private boolean hasCustomName; + + public InventoryBasic(String title, boolean customName, int slotCount) + { + this.inventoryTitle = title; + this.hasCustomName = customName; + this.slotsCount = slotCount; + this.inventoryContents = new ItemStack[slotCount]; + } + + public InventoryBasic(IChatComponent title, int slotCount) + { + this(title.getUnformattedText(), true, slotCount); + } + + public void func_110134_a(IInvBasic p_110134_1_) + { + if (this.field_70480_d == null) + { + this.field_70480_d = Lists.newArrayList(); + } + + this.field_70480_d.add(p_110134_1_); + } + + public void func_110132_b(IInvBasic p_110132_1_) + { + this.field_70480_d.remove(p_110132_1_); + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + return index >= 0 && index < this.inventoryContents.length ? this.inventoryContents[index] : null; + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + if (this.inventoryContents[index] != null) + { + if (this.inventoryContents[index].stackSize <= count) + { + ItemStack itemstack1 = this.inventoryContents[index]; + this.inventoryContents[index] = null; + this.markDirty(); + return itemstack1; + } + else + { + ItemStack itemstack = this.inventoryContents[index].splitStack(count); + + if (this.inventoryContents[index].stackSize == 0) + { + this.inventoryContents[index] = null; + } + + this.markDirty(); + return itemstack; + } + } + else + { + return null; + } + } + + public ItemStack func_174894_a(ItemStack stack) + { + ItemStack itemstack = stack.copy(); + + for (int i = 0; i < this.slotsCount; ++i) + { + ItemStack itemstack1 = this.getStackInSlot(i); + + if (itemstack1 == null) + { + this.setInventorySlotContents(i, itemstack); + this.markDirty(); + return null; + } + + if (ItemStack.areItemsEqual(itemstack1, itemstack)) + { + int j = Math.min(this.getInventoryStackLimit(), itemstack1.getMaxStackSize()); + int k = Math.min(itemstack.stackSize, j - itemstack1.stackSize); + + if (k > 0) + { + itemstack1.stackSize += k; + itemstack.stackSize -= k; + + if (itemstack.stackSize <= 0) + { + this.markDirty(); + return null; + } + } + } + } + + if (itemstack.stackSize != stack.stackSize) + { + this.markDirty(); + } + + return itemstack; + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + if (this.inventoryContents[index] != null) + { + ItemStack itemstack = this.inventoryContents[index]; + this.inventoryContents[index] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + this.inventoryContents[index] = stack; + + if (stack != null && stack.stackSize > this.getInventoryStackLimit()) + { + stack.stackSize = this.getInventoryStackLimit(); + } + + this.markDirty(); + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.slotsCount; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.inventoryTitle; + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return this.hasCustomName; + } + + /** + * Sets the name of this inventory. This is displayed to the client on opening. + */ + public void setCustomName(String inventoryTitleIn) + { + this.hasCustomName = true; + this.inventoryTitle = inventoryTitleIn; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return (IChatComponent)(this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it + * hasn't changed and skip it. + */ + public void markDirty() + { + if (this.field_70480_d != null) + { + for (int i = 0; i < this.field_70480_d.size(); ++i) + { + ((IInvBasic)this.field_70480_d.get(i)).onInventoryChanged(this); + } + } + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return true; + } + + public void openInventory(EntityPlayer player) + { + } + + public void closeInventory(EntityPlayer player) + { + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return true; + } + + public int getField(int id) + { + return 0; + } + + public void setField(int id, int value) + { + } + + public int getFieldCount() + { + return 0; + } + + public void clear() + { + for (int i = 0; i < this.inventoryContents.length; ++i) + { + this.inventoryContents[i] = null; + } + } +} diff --git a/src/minecraft/net/minecraft/inventory/InventoryCraftResult.java b/src/minecraft/net/minecraft/inventory/InventoryCraftResult.java new file mode 100644 index 0000000..59b7450 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/InventoryCraftResult.java @@ -0,0 +1,157 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; + +public class InventoryCraftResult implements IInventory +{ + /** A list of one item containing the result of the crafting formula */ + private ItemStack[] stackResult = new ItemStack[1]; + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return 1; + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + return this.stackResult[0]; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return "Result"; + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return false; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return (IChatComponent)(this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + if (this.stackResult[0] != null) + { + ItemStack itemstack = this.stackResult[0]; + this.stackResult[0] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + if (this.stackResult[0] != null) + { + ItemStack itemstack = this.stackResult[0]; + this.stackResult[0] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + this.stackResult[0] = stack; + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it + * hasn't changed and skip it. + */ + public void markDirty() + { + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return true; + } + + public void openInventory(EntityPlayer player) + { + } + + public void closeInventory(EntityPlayer player) + { + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return true; + } + + public int getField(int id) + { + return 0; + } + + public void setField(int id, int value) + { + } + + public int getFieldCount() + { + return 0; + } + + public void clear() + { + for (int i = 0; i < this.stackResult.length; ++i) + { + this.stackResult[i] = null; + } + } +} diff --git a/src/minecraft/net/minecraft/inventory/InventoryCrafting.java b/src/minecraft/net/minecraft/inventory/InventoryCrafting.java new file mode 100644 index 0000000..5909fff --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/InventoryCrafting.java @@ -0,0 +1,210 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; + +public class InventoryCrafting implements IInventory +{ + /** List of the stacks in the crafting matrix. */ + private final ItemStack[] stackList; + + /** the width of the crafting inventory */ + private final int inventoryWidth; + private final int inventoryHeight; + + /** + * Class containing the callbacks for the events on_GUIClosed and on_CraftMaxtrixChanged. + */ + private final Container eventHandler; + + public InventoryCrafting(Container eventHandlerIn, int width, int height) + { + int i = width * height; + this.stackList = new ItemStack[i]; + this.eventHandler = eventHandlerIn; + this.inventoryWidth = width; + this.inventoryHeight = height; + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.stackList.length; + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + return index >= this.getSizeInventory() ? null : this.stackList[index]; + } + + /** + * Returns the itemstack in the slot specified (Top left is 0, 0). Args: row, column + */ + public ItemStack getStackInRowAndColumn(int row, int column) + { + return row >= 0 && row < this.inventoryWidth && column >= 0 && column <= this.inventoryHeight ? this.getStackInSlot(row + column * this.inventoryWidth) : null; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return "container.crafting"; + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return false; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return (IChatComponent)(this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + if (this.stackList[index] != null) + { + ItemStack itemstack = this.stackList[index]; + this.stackList[index] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + if (this.stackList[index] != null) + { + if (this.stackList[index].stackSize <= count) + { + ItemStack itemstack1 = this.stackList[index]; + this.stackList[index] = null; + this.eventHandler.onCraftMatrixChanged(this); + return itemstack1; + } + else + { + ItemStack itemstack = this.stackList[index].splitStack(count); + + if (this.stackList[index].stackSize == 0) + { + this.stackList[index] = null; + } + + this.eventHandler.onCraftMatrixChanged(this); + return itemstack; + } + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + this.stackList[index] = stack; + this.eventHandler.onCraftMatrixChanged(this); + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it + * hasn't changed and skip it. + */ + public void markDirty() + { + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return true; + } + + public void openInventory(EntityPlayer player) + { + } + + public void closeInventory(EntityPlayer player) + { + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return true; + } + + public int getField(int id) + { + return 0; + } + + public void setField(int id, int value) + { + } + + public int getFieldCount() + { + return 0; + } + + public void clear() + { + for (int i = 0; i < this.stackList.length; ++i) + { + this.stackList[i] = null; + } + } + + public int getHeight() + { + return this.inventoryHeight; + } + + public int getWidth() + { + return this.inventoryWidth; + } +} diff --git a/src/minecraft/net/minecraft/inventory/InventoryEnderChest.java b/src/minecraft/net/minecraft/inventory/InventoryEnderChest.java new file mode 100644 index 0000000..d6c295f --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/InventoryEnderChest.java @@ -0,0 +1,90 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntityEnderChest; + +public class InventoryEnderChest extends InventoryBasic +{ + private TileEntityEnderChest associatedChest; + + public InventoryEnderChest() + { + super("container.enderchest", false, 27); + } + + public void setChestTileEntity(TileEntityEnderChest chestTileEntity) + { + this.associatedChest = chestTileEntity; + } + + public void loadInventoryFromNBT(NBTTagList p_70486_1_) + { + for (int i = 0; i < this.getSizeInventory(); ++i) + { + this.setInventorySlotContents(i, (ItemStack)null); + } + + for (int k = 0; k < p_70486_1_.tagCount(); ++k) + { + NBTTagCompound nbttagcompound = p_70486_1_.getCompoundTagAt(k); + int j = nbttagcompound.getByte("Slot") & 255; + + if (j >= 0 && j < this.getSizeInventory()) + { + this.setInventorySlotContents(j, ItemStack.loadItemStackFromNBT(nbttagcompound)); + } + } + } + + public NBTTagList saveInventoryToNBT() + { + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.getSizeInventory(); ++i) + { + ItemStack itemstack = this.getStackInSlot(i); + + if (itemstack != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Slot", (byte)i); + itemstack.writeToNBT(nbttagcompound); + nbttaglist.appendTag(nbttagcompound); + } + } + + return nbttaglist; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.associatedChest != null && !this.associatedChest.canBeUsed(player) ? false : super.isUseableByPlayer(player); + } + + public void openInventory(EntityPlayer player) + { + if (this.associatedChest != null) + { + this.associatedChest.openChest(); + } + + super.openInventory(player); + } + + public void closeInventory(EntityPlayer player) + { + if (this.associatedChest != null) + { + this.associatedChest.closeChest(); + } + + super.closeInventory(player); + this.associatedChest = null; + } +} diff --git a/src/minecraft/net/minecraft/inventory/InventoryHelper.java b/src/minecraft/net/minecraft/inventory/InventoryHelper.java new file mode 100644 index 0000000..01442c7 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/InventoryHelper.java @@ -0,0 +1,68 @@ +package net.minecraft.inventory; + +import java.util.Random; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class InventoryHelper +{ + private static final Random RANDOM = new Random(); + + public static void dropInventoryItems(World worldIn, BlockPos pos, IInventory p_180175_2_) + { + func_180174_a(worldIn, (double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), p_180175_2_); + } + + public static void func_180176_a(World worldIn, Entity p_180176_1_, IInventory p_180176_2_) + { + func_180174_a(worldIn, p_180176_1_.posX, p_180176_1_.posY, p_180176_1_.posZ, p_180176_2_); + } + + private static void func_180174_a(World worldIn, double x, double y, double z, IInventory p_180174_7_) + { + for (int i = 0; i < p_180174_7_.getSizeInventory(); ++i) + { + ItemStack itemstack = p_180174_7_.getStackInSlot(i); + + if (itemstack != null) + { + spawnItemStack(worldIn, x, y, z, itemstack); + } + } + } + + private static void spawnItemStack(World worldIn, double x, double y, double z, ItemStack stack) + { + float f = RANDOM.nextFloat() * 0.8F + 0.1F; + float f1 = RANDOM.nextFloat() * 0.8F + 0.1F; + float f2 = RANDOM.nextFloat() * 0.8F + 0.1F; + + while (stack.stackSize > 0) + { + int i = RANDOM.nextInt(21) + 10; + + if (i > stack.stackSize) + { + i = stack.stackSize; + } + + stack.stackSize -= i; + EntityItem entityitem = new EntityItem(worldIn, x + (double)f, y + (double)f1, z + (double)f2, new ItemStack(stack.getItem(), i, stack.getMetadata())); + + if (stack.hasTagCompound()) + { + entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy()); + } + + float f3 = 0.05F; + entityitem.motionX = RANDOM.nextGaussian() * (double)f3; + entityitem.motionY = RANDOM.nextGaussian() * (double)f3 + 0.20000000298023224D; + entityitem.motionZ = RANDOM.nextGaussian() * (double)f3; + worldIn.spawnEntityInWorld(entityitem); + } + } +} diff --git a/src/minecraft/net/minecraft/inventory/InventoryLargeChest.java b/src/minecraft/net/minecraft/inventory/InventoryLargeChest.java new file mode 100644 index 0000000..3801c97 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/InventoryLargeChest.java @@ -0,0 +1,220 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.ILockableContainer; +import net.minecraft.world.LockCode; + +public class InventoryLargeChest implements ILockableContainer +{ + /** Name of the chest. */ + private String name; + + /** Inventory object corresponding to double chest upper part */ + private ILockableContainer upperChest; + + /** Inventory object corresponding to double chest lower part */ + private ILockableContainer lowerChest; + + public InventoryLargeChest(String nameIn, ILockableContainer upperChestIn, ILockableContainer lowerChestIn) + { + this.name = nameIn; + + if (upperChestIn == null) + { + upperChestIn = lowerChestIn; + } + + if (lowerChestIn == null) + { + lowerChestIn = upperChestIn; + } + + this.upperChest = upperChestIn; + this.lowerChest = lowerChestIn; + + if (upperChestIn.isLocked()) + { + lowerChestIn.setLockCode(upperChestIn.getLockCode()); + } + else if (lowerChestIn.isLocked()) + { + upperChestIn.setLockCode(lowerChestIn.getLockCode()); + } + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.upperChest.getSizeInventory() + this.lowerChest.getSizeInventory(); + } + + /** + * Return whether the given inventory is part of this large chest. + */ + public boolean isPartOfLargeChest(IInventory inventoryIn) + { + return this.upperChest == inventoryIn || this.lowerChest == inventoryIn; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.upperChest.hasCustomName() ? this.upperChest.getName() : (this.lowerChest.hasCustomName() ? this.lowerChest.getName() : this.name); + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return this.upperChest.hasCustomName() || this.lowerChest.hasCustomName(); + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return (IChatComponent)(this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + return index >= this.upperChest.getSizeInventory() ? this.lowerChest.getStackInSlot(index - this.upperChest.getSizeInventory()) : this.upperChest.getStackInSlot(index); + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + return index >= this.upperChest.getSizeInventory() ? this.lowerChest.decrStackSize(index - this.upperChest.getSizeInventory(), count) : this.upperChest.decrStackSize(index, count); + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + return index >= this.upperChest.getSizeInventory() ? this.lowerChest.removeStackFromSlot(index - this.upperChest.getSizeInventory()) : this.upperChest.removeStackFromSlot(index); + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + if (index >= this.upperChest.getSizeInventory()) + { + this.lowerChest.setInventorySlotContents(index - this.upperChest.getSizeInventory(), stack); + } + else + { + this.upperChest.setInventorySlotContents(index, stack); + } + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return this.upperChest.getInventoryStackLimit(); + } + + /** + * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it + * hasn't changed and skip it. + */ + public void markDirty() + { + this.upperChest.markDirty(); + this.lowerChest.markDirty(); + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.upperChest.isUseableByPlayer(player) && this.lowerChest.isUseableByPlayer(player); + } + + public void openInventory(EntityPlayer player) + { + this.upperChest.openInventory(player); + this.lowerChest.openInventory(player); + } + + public void closeInventory(EntityPlayer player) + { + this.upperChest.closeInventory(player); + this.lowerChest.closeInventory(player); + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return true; + } + + public int getField(int id) + { + return 0; + } + + public void setField(int id, int value) + { + } + + public int getFieldCount() + { + return 0; + } + + public boolean isLocked() + { + return this.upperChest.isLocked() || this.lowerChest.isLocked(); + } + + public void setLockCode(LockCode code) + { + this.upperChest.setLockCode(code); + this.lowerChest.setLockCode(code); + } + + public LockCode getLockCode() + { + return this.upperChest.getLockCode(); + } + + public String getGuiID() + { + return this.upperChest.getGuiID(); + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + return new ContainerChest(playerInventory, this, playerIn); + } + + public void clear() + { + this.upperChest.clear(); + this.lowerChest.clear(); + } +} diff --git a/src/minecraft/net/minecraft/inventory/InventoryMerchant.java b/src/minecraft/net/minecraft/inventory/InventoryMerchant.java new file mode 100644 index 0000000..aa4551a --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/InventoryMerchant.java @@ -0,0 +1,283 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.IMerchant; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; +import net.minecraft.village.MerchantRecipe; +import net.minecraft.village.MerchantRecipeList; + +public class InventoryMerchant implements IInventory +{ + private final IMerchant theMerchant; + private ItemStack[] theInventory = new ItemStack[3]; + private final EntityPlayer thePlayer; + private MerchantRecipe currentRecipe; + private int currentRecipeIndex; + + public InventoryMerchant(EntityPlayer thePlayerIn, IMerchant theMerchantIn) + { + this.thePlayer = thePlayerIn; + this.theMerchant = theMerchantIn; + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.theInventory.length; + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + return this.theInventory[index]; + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + if (this.theInventory[index] != null) + { + if (index == 2) + { + ItemStack itemstack2 = this.theInventory[index]; + this.theInventory[index] = null; + return itemstack2; + } + else if (this.theInventory[index].stackSize <= count) + { + ItemStack itemstack1 = this.theInventory[index]; + this.theInventory[index] = null; + + if (this.inventoryResetNeededOnSlotChange(index)) + { + this.resetRecipeAndSlots(); + } + + return itemstack1; + } + else + { + ItemStack itemstack = this.theInventory[index].splitStack(count); + + if (this.theInventory[index].stackSize == 0) + { + this.theInventory[index] = null; + } + + if (this.inventoryResetNeededOnSlotChange(index)) + { + this.resetRecipeAndSlots(); + } + + return itemstack; + } + } + else + { + return null; + } + } + + /** + * if par1 slot has changed, does resetRecipeAndSlots need to be called? + */ + private boolean inventoryResetNeededOnSlotChange(int p_70469_1_) + { + return p_70469_1_ == 0 || p_70469_1_ == 1; + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + if (this.theInventory[index] != null) + { + ItemStack itemstack = this.theInventory[index]; + this.theInventory[index] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + this.theInventory[index] = stack; + + if (stack != null && stack.stackSize > this.getInventoryStackLimit()) + { + stack.stackSize = this.getInventoryStackLimit(); + } + + if (this.inventoryResetNeededOnSlotChange(index)) + { + this.resetRecipeAndSlots(); + } + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return "mob.villager"; + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return false; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return (IChatComponent)(this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.theMerchant.getCustomer() == player; + } + + public void openInventory(EntityPlayer player) + { + } + + public void closeInventory(EntityPlayer player) + { + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return true; + } + + /** + * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it + * hasn't changed and skip it. + */ + public void markDirty() + { + this.resetRecipeAndSlots(); + } + + public void resetRecipeAndSlots() + { + this.currentRecipe = null; + ItemStack itemstack = this.theInventory[0]; + ItemStack itemstack1 = this.theInventory[1]; + + if (itemstack == null) + { + itemstack = itemstack1; + itemstack1 = null; + } + + if (itemstack == null) + { + this.setInventorySlotContents(2, (ItemStack)null); + } + else + { + MerchantRecipeList merchantrecipelist = this.theMerchant.getRecipes(this.thePlayer); + + if (merchantrecipelist != null) + { + MerchantRecipe merchantrecipe = merchantrecipelist.canRecipeBeUsed(itemstack, itemstack1, this.currentRecipeIndex); + + if (merchantrecipe != null && !merchantrecipe.isRecipeDisabled()) + { + this.currentRecipe = merchantrecipe; + this.setInventorySlotContents(2, merchantrecipe.getItemToSell().copy()); + } + else if (itemstack1 != null) + { + merchantrecipe = merchantrecipelist.canRecipeBeUsed(itemstack1, itemstack, this.currentRecipeIndex); + + if (merchantrecipe != null && !merchantrecipe.isRecipeDisabled()) + { + this.currentRecipe = merchantrecipe; + this.setInventorySlotContents(2, merchantrecipe.getItemToSell().copy()); + } + else + { + this.setInventorySlotContents(2, (ItemStack)null); + } + } + else + { + this.setInventorySlotContents(2, (ItemStack)null); + } + } + } + + this.theMerchant.verifySellingItem(this.getStackInSlot(2)); + } + + public MerchantRecipe getCurrentRecipe() + { + return this.currentRecipe; + } + + public void setCurrentRecipeIndex(int currentRecipeIndexIn) + { + this.currentRecipeIndex = currentRecipeIndexIn; + this.resetRecipeAndSlots(); + } + + public int getField(int id) + { + return 0; + } + + public void setField(int id, int value) + { + } + + public int getFieldCount() + { + return 0; + } + + public void clear() + { + for (int i = 0; i < this.theInventory.length; ++i) + { + this.theInventory[i] = null; + } + } +} diff --git a/src/minecraft/net/minecraft/inventory/Slot.java b/src/minecraft/net/minecraft/inventory/Slot.java new file mode 100644 index 0000000..59bc4b3 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/Slot.java @@ -0,0 +1,162 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +public class Slot +{ + /** The index of the slot in the inventory. */ + private final int slotIndex; + + /** The inventory we want to extract a slot from. */ + public final IInventory inventory; + + /** the id of the slot(also the index in the inventory arraylist) */ + public int slotNumber; + + /** display position of the inventory slot on the screen x axis */ + public int xDisplayPosition; + + /** display position of the inventory slot on the screen y axis */ + public int yDisplayPosition; + + public Slot(IInventory inventoryIn, int index, int xPosition, int yPosition) + { + this.inventory = inventoryIn; + this.slotIndex = index; + this.xDisplayPosition = xPosition; + this.yDisplayPosition = yPosition; + } + + /** + * if par2 has more items than par1, onCrafting(item,countIncrease) is called + */ + public void onSlotChange(ItemStack p_75220_1_, ItemStack p_75220_2_) + { + if (p_75220_1_ != null && p_75220_2_ != null) + { + if (p_75220_1_.getItem() == p_75220_2_.getItem()) + { + int i = p_75220_2_.stackSize - p_75220_1_.stackSize; + + if (i > 0) + { + this.onCrafting(p_75220_1_, i); + } + } + } + } + + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an + * internal count then calls onCrafting(item). + */ + protected void onCrafting(ItemStack stack, int amount) + { + } + + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. + */ + protected void onCrafting(ItemStack stack) + { + } + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { + this.onSlotChanged(); + } + + /** + * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + */ + public boolean isItemValid(ItemStack stack) + { + return true; + } + + /** + * Helper fnct to get the stack in the slot. + */ + public ItemStack getStack() + { + return this.inventory.getStackInSlot(this.slotIndex); + } + + /** + * Returns if this slot contains a stack. + */ + public boolean getHasStack() + { + return this.getStack() != null; + } + + /** + * Helper method to put a stack in the slot. + */ + public void putStack(ItemStack stack) + { + this.inventory.setInventorySlotContents(this.slotIndex, stack); + this.onSlotChanged(); + } + + /** + * Called when the stack in a Slot changes + */ + public void onSlotChanged() + { + this.inventory.markDirty(); + } + + /** + * Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 in the case + * of armor slots) + */ + public int getSlotStackLimit() + { + return this.inventory.getInventoryStackLimit(); + } + + public int getItemStackLimit(ItemStack stack) { + return getSlotStackLimit(); + } + + public String getSlotTexture() + { + return null; + } + + /** + * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new + * stack. + */ + public ItemStack decrStackSize(int amount) + { + return this.inventory.decrStackSize(this.slotIndex, amount); + } + + /** + * returns true if the slot exists in the given inventory and location + */ + public boolean isHere(IInventory inv, int slotIn) + { + return inv == this.inventory && slotIn == this.slotIndex; + } + + /** + * Return whether this slot's stack can be taken from this slot. + */ + public boolean canTakeStack(EntityPlayer playerIn) + { + return true; + } + + /** + * Actualy only call when we want to render the white square effect over the slots. Return always True, except for + * the armor slot of the Donkey/Mule (we can't interact with the Undead and Skeleton horses) + */ + public boolean canBeHovered() + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/inventory/SlotCrafting.java b/src/minecraft/net/minecraft/inventory/SlotCrafting.java new file mode 100644 index 0000000..358ee8b --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/SlotCrafting.java @@ -0,0 +1,162 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemHoe; +import net.minecraft.item.ItemPickaxe; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.stats.AchievementList; + +public class SlotCrafting extends Slot +{ + /** The craft matrix inventory linked to this result slot. */ + private final InventoryCrafting craftMatrix; + + /** The player that is using the GUI where this slot resides. */ + private final EntityPlayer thePlayer; + + /** + * The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset. + */ + private int amountCrafted; + + public SlotCrafting(EntityPlayer player, InventoryCrafting craftingInventory, IInventory p_i45790_3_, int slotIndex, int xPosition, int yPosition) + { + super(p_i45790_3_, slotIndex, xPosition, yPosition); + this.thePlayer = player; + this.craftMatrix = craftingInventory; + } + + /** + * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + */ + public boolean isItemValid(ItemStack stack) + { + return false; + } + + /** + * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new + * stack. + */ + public ItemStack decrStackSize(int amount) + { + if (this.getHasStack()) + { + this.amountCrafted += Math.min(amount, this.getStack().stackSize); + } + + return super.decrStackSize(amount); + } + + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an + * internal count then calls onCrafting(item). + */ + protected void onCrafting(ItemStack stack, int amount) + { + this.amountCrafted += amount; + this.onCrafting(stack); + } + + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. + */ + protected void onCrafting(ItemStack stack) + { + if (this.amountCrafted > 0) + { + stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); + } + + this.amountCrafted = 0; + + if (stack.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) + { + this.thePlayer.triggerAchievement(AchievementList.buildWorkBench); + } + + if (stack.getItem() instanceof ItemPickaxe) + { + this.thePlayer.triggerAchievement(AchievementList.buildPickaxe); + } + + if (stack.getItem() == Item.getItemFromBlock(Blocks.furnace)) + { + this.thePlayer.triggerAchievement(AchievementList.buildFurnace); + } + + if (stack.getItem() instanceof ItemHoe) + { + this.thePlayer.triggerAchievement(AchievementList.buildHoe); + } + + if (stack.getItem() == Items.bread) + { + this.thePlayer.triggerAchievement(AchievementList.makeBread); + } + + if (stack.getItem() == Items.cake) + { + this.thePlayer.triggerAchievement(AchievementList.bakeCake); + } + + if (stack.getItem() instanceof ItemPickaxe && ((ItemPickaxe)stack.getItem()).getToolMaterial() != Item.ToolMaterial.WOOD) + { + this.thePlayer.triggerAchievement(AchievementList.buildBetterPickaxe); + } + + if (stack.getItem() instanceof ItemSword) + { + this.thePlayer.triggerAchievement(AchievementList.buildSword); + } + + if (stack.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) + { + this.thePlayer.triggerAchievement(AchievementList.enchantments); + } + + if (stack.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) + { + this.thePlayer.triggerAchievement(AchievementList.bookcase); + } + + if (stack.getItem() == Items.golden_apple && stack.getMetadata() == 1) + { + this.thePlayer.triggerAchievement(AchievementList.overpowered); + } + } + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { + this.onCrafting(stack); + ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj); + + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = this.craftMatrix.getStackInSlot(i); + ItemStack itemstack1 = aitemstack[i]; + + if (itemstack != null) + { + this.craftMatrix.decrStackSize(i, 1); + } + + if (itemstack1 != null) + { + if (this.craftMatrix.getStackInSlot(i) == null) + { + this.craftMatrix.setInventorySlotContents(i, itemstack1); + } + else if (!this.thePlayer.inventory.addItemStackToInventory(itemstack1)) + { + this.thePlayer.dropPlayerItemWithRandomChoice(itemstack1, false); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/inventory/SlotFurnaceFuel.java b/src/minecraft/net/minecraft/inventory/SlotFurnaceFuel.java new file mode 100644 index 0000000..20a601f --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/SlotFurnaceFuel.java @@ -0,0 +1,31 @@ +package net.minecraft.inventory; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityFurnace; + +public class SlotFurnaceFuel extends Slot +{ + public SlotFurnaceFuel(IInventory inventoryIn, int slotIndex, int xPosition, int yPosition) + { + super(inventoryIn, slotIndex, xPosition, yPosition); + } + + /** + * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + */ + public boolean isItemValid(ItemStack stack) + { + return TileEntityFurnace.isItemFuel(stack) || isBucket(stack); + } + + public int getItemStackLimit(ItemStack stack) + { + return isBucket(stack) ? 1 : super.getItemStackLimit(stack); + } + + public static boolean isBucket(ItemStack stack) + { + return stack != null && stack.getItem() != null && stack.getItem() == Items.bucket; + } +} diff --git a/src/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java b/src/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java new file mode 100644 index 0000000..c9a48b2 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java @@ -0,0 +1,109 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.MathHelper; + +public class SlotFurnaceOutput extends Slot +{ + /** The player that is using the GUI where this slot resides. */ + private EntityPlayer thePlayer; + private int field_75228_b; + + public SlotFurnaceOutput(EntityPlayer player, IInventory inventoryIn, int slotIndex, int xPosition, int yPosition) + { + super(inventoryIn, slotIndex, xPosition, yPosition); + this.thePlayer = player; + } + + /** + * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + */ + public boolean isItemValid(ItemStack stack) + { + return false; + } + + /** + * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new + * stack. + */ + public ItemStack decrStackSize(int amount) + { + if (this.getHasStack()) + { + this.field_75228_b += Math.min(amount, this.getStack().stackSize); + } + + return super.decrStackSize(amount); + } + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { + this.onCrafting(stack); + super.onPickupFromSlot(playerIn, stack); + } + + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an + * internal count then calls onCrafting(item). + */ + protected void onCrafting(ItemStack stack, int amount) + { + this.field_75228_b += amount; + this.onCrafting(stack); + } + + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. + */ + protected void onCrafting(ItemStack stack) + { + stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.field_75228_b); + + if (!this.thePlayer.worldObj.isRemote) + { + int i = this.field_75228_b; + float f = FurnaceRecipes.instance().getSmeltingExperience(stack); + + if (f == 0.0F) + { + i = 0; + } + else if (f < 1.0F) + { + int j = MathHelper.floor_float((float)i * f); + + if (j < MathHelper.ceiling_float_int((float)i * f) && Math.random() < (double)((float)i * f - (float)j)) + { + ++j; + } + + i = j; + } + + while (i > 0) + { + int k = EntityXPOrb.getXPSplit(i); + i -= k; + this.thePlayer.worldObj.spawnEntityInWorld(new EntityXPOrb(this.thePlayer.worldObj, this.thePlayer.posX, this.thePlayer.posY + 0.5D, this.thePlayer.posZ + 0.5D, k)); + } + } + + this.field_75228_b = 0; + + if (stack.getItem() == Items.iron_ingot) + { + this.thePlayer.triggerAchievement(AchievementList.acquireIron); + } + + if (stack.getItem() == Items.cooked_fish) + { + this.thePlayer.triggerAchievement(AchievementList.cookFish); + } + } +} diff --git a/src/minecraft/net/minecraft/inventory/SlotMerchantResult.java b/src/minecraft/net/minecraft/inventory/SlotMerchantResult.java new file mode 100644 index 0000000..6052a52 --- /dev/null +++ b/src/minecraft/net/minecraft/inventory/SlotMerchantResult.java @@ -0,0 +1,124 @@ +package net.minecraft.inventory; + +import net.minecraft.entity.IMerchant; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.village.MerchantRecipe; + +public class SlotMerchantResult extends Slot +{ + /** Merchant's inventory. */ + private final InventoryMerchant theMerchantInventory; + + /** The Player whos trying to buy/sell stuff. */ + private EntityPlayer thePlayer; + private int field_75231_g; + + /** "Instance" of the Merchant. */ + private final IMerchant theMerchant; + + public SlotMerchantResult(EntityPlayer player, IMerchant merchant, InventoryMerchant merchantInventory, int slotIndex, int xPosition, int yPosition) + { + super(merchantInventory, slotIndex, xPosition, yPosition); + this.thePlayer = player; + this.theMerchant = merchant; + this.theMerchantInventory = merchantInventory; + } + + /** + * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + */ + public boolean isItemValid(ItemStack stack) + { + return false; + } + + /** + * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new + * stack. + */ + public ItemStack decrStackSize(int amount) + { + if (this.getHasStack()) + { + this.field_75231_g += Math.min(amount, this.getStack().stackSize); + } + + return super.decrStackSize(amount); + } + + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an + * internal count then calls onCrafting(item). + */ + protected void onCrafting(ItemStack stack, int amount) + { + this.field_75231_g += amount; + this.onCrafting(stack); + } + + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. + */ + protected void onCrafting(ItemStack stack) + { + stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.field_75231_g); + this.field_75231_g = 0; + } + + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { + this.onCrafting(stack); + MerchantRecipe merchantrecipe = this.theMerchantInventory.getCurrentRecipe(); + + if (merchantrecipe != null) + { + ItemStack itemstack = this.theMerchantInventory.getStackInSlot(0); + ItemStack itemstack1 = this.theMerchantInventory.getStackInSlot(1); + + if (this.doTrade(merchantrecipe, itemstack, itemstack1) || this.doTrade(merchantrecipe, itemstack1, itemstack)) + { + this.theMerchant.useRecipe(merchantrecipe); + playerIn.triggerAchievement(StatList.timesTradedWithVillagerStat); + + if (itemstack != null && itemstack.stackSize <= 0) + { + itemstack = null; + } + + if (itemstack1 != null && itemstack1.stackSize <= 0) + { + itemstack1 = null; + } + + this.theMerchantInventory.setInventorySlotContents(0, itemstack); + this.theMerchantInventory.setInventorySlotContents(1, itemstack1); + } + } + } + + private boolean doTrade(MerchantRecipe trade, ItemStack firstItem, ItemStack secondItem) + { + ItemStack itemstack = trade.getItemToBuy(); + ItemStack itemstack1 = trade.getSecondItemToBuy(); + + if (firstItem != null && firstItem.getItem() == itemstack.getItem()) + { + if (itemstack1 != null && secondItem != null && itemstack1.getItem() == secondItem.getItem()) + { + firstItem.stackSize -= itemstack.stackSize; + secondItem.stackSize -= itemstack1.stackSize; + return true; + } + + if (itemstack1 == null && secondItem == null) + { + firstItem.stackSize -= itemstack.stackSize; + return true; + } + } + + return false; + } +} diff --git a/src/minecraft/net/minecraft/item/EnumAction.java b/src/minecraft/net/minecraft/item/EnumAction.java new file mode 100644 index 0000000..f51ed7d --- /dev/null +++ b/src/minecraft/net/minecraft/item/EnumAction.java @@ -0,0 +1,5 @@ +package net.minecraft.item; + +public enum EnumAction { + NONE, EAT, DRINK, BLOCK, BOW; +} diff --git a/src/minecraft/net/minecraft/item/EnumDyeColor.java b/src/minecraft/net/minecraft/item/EnumDyeColor.java new file mode 100644 index 0000000..fdd05b8 --- /dev/null +++ b/src/minecraft/net/minecraft/item/EnumDyeColor.java @@ -0,0 +1,102 @@ +package net.minecraft.item; + +import net.minecraft.block.material.MapColor; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IStringSerializable; + +public enum EnumDyeColor implements IStringSerializable +{ + WHITE(0, 15, "white", "white", MapColor.snowColor, EnumChatFormatting.WHITE), + ORANGE(1, 14, "orange", "orange", MapColor.adobeColor, EnumChatFormatting.GOLD), + MAGENTA(2, 13, "magenta", "magenta", MapColor.magentaColor, EnumChatFormatting.AQUA), + LIGHT_BLUE(3, 12, "light_blue", "lightBlue", MapColor.lightBlueColor, EnumChatFormatting.BLUE), + YELLOW(4, 11, "yellow", "yellow", MapColor.yellowColor, EnumChatFormatting.YELLOW), + LIME(5, 10, "lime", "lime", MapColor.limeColor, EnumChatFormatting.GREEN), + PINK(6, 9, "pink", "pink", MapColor.pinkColor, EnumChatFormatting.LIGHT_PURPLE), + GRAY(7, 8, "gray", "gray", MapColor.grayColor, EnumChatFormatting.DARK_GRAY), + SILVER(8, 7, "silver", "silver", MapColor.silverColor, EnumChatFormatting.GRAY), + CYAN(9, 6, "cyan", "cyan", MapColor.cyanColor, EnumChatFormatting.DARK_AQUA), + PURPLE(10, 5, "purple", "purple", MapColor.purpleColor, EnumChatFormatting.DARK_PURPLE), + BLUE(11, 4, "blue", "blue", MapColor.blueColor, EnumChatFormatting.DARK_BLUE), + BROWN(12, 3, "brown", "brown", MapColor.brownColor, EnumChatFormatting.GOLD), + GREEN(13, 2, "green", "green", MapColor.greenColor, EnumChatFormatting.DARK_GREEN), + RED(14, 1, "red", "red", MapColor.redColor, EnumChatFormatting.DARK_RED), + BLACK(15, 0, "black", "black", MapColor.blackColor, EnumChatFormatting.BLACK); + + private static final EnumDyeColor[] META_LOOKUP = new EnumDyeColor[values().length]; + private static final EnumDyeColor[] DYE_DMG_LOOKUP = new EnumDyeColor[values().length]; + private final int meta; + private final int dyeDamage; + private final String name; + private final String unlocalizedName; + private final MapColor mapColor; + private final EnumChatFormatting chatColor; + + private EnumDyeColor(int meta, int dyeDamage, String name, String unlocalizedName, MapColor mapColorIn, EnumChatFormatting chatColor) + { + this.meta = meta; + this.dyeDamage = dyeDamage; + this.name = name; + this.unlocalizedName = unlocalizedName; + this.mapColor = mapColorIn; + this.chatColor = chatColor; + } + + public int getMetadata() + { + return this.meta; + } + + public int getDyeDamage() + { + return this.dyeDamage; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + public MapColor getMapColor() + { + return this.mapColor; + } + + public static EnumDyeColor byDyeDamage(int damage) + { + if (damage < 0 || damage >= DYE_DMG_LOOKUP.length) + { + damage = 0; + } + + return DYE_DMG_LOOKUP[damage]; + } + + public static EnumDyeColor byMetadata(int meta) + { + if (meta < 0 || meta >= META_LOOKUP.length) + { + meta = 0; + } + + return META_LOOKUP[meta]; + } + + public String toString() + { + return this.unlocalizedName; + } + + public String getName() + { + return this.name; + } + + static { + for (EnumDyeColor enumdyecolor : values()) + { + META_LOOKUP[enumdyecolor.getMetadata()] = enumdyecolor; + DYE_DMG_LOOKUP[enumdyecolor.getDyeDamage()] = enumdyecolor; + } + } +} diff --git a/src/minecraft/net/minecraft/item/EnumRarity.java b/src/minecraft/net/minecraft/item/EnumRarity.java new file mode 100644 index 0000000..b9737aa --- /dev/null +++ b/src/minecraft/net/minecraft/item/EnumRarity.java @@ -0,0 +1,26 @@ +package net.minecraft.item; + +import net.minecraft.util.EnumChatFormatting; + +public enum EnumRarity +{ + COMMON(EnumChatFormatting.WHITE, "Common"), + UNCOMMON(EnumChatFormatting.YELLOW, "Uncommon"), + RARE(EnumChatFormatting.AQUA, "Rare"), + EPIC(EnumChatFormatting.LIGHT_PURPLE, "Epic"); + + /** + * A decimal representation of the hex color codes of a the color assigned to this rarity type. (13 becomes d as in + * \247d which is light purple) + */ + public final EnumChatFormatting rarityColor; + + /** Rarity name. */ + public final String rarityName; + + private EnumRarity(EnumChatFormatting color, String name) + { + this.rarityColor = color; + this.rarityName = name; + } +} diff --git a/src/minecraft/net/minecraft/item/Item.java b/src/minecraft/net/minecraft/item/Item.java new file mode 100644 index 0000000..cb4c31d --- /dev/null +++ b/src/minecraft/net/minecraft/item/Item.java @@ -0,0 +1,1035 @@ +package net.minecraft.item; + +import com.google.common.base.Function; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Maps; +import com.google.common.collect.Multimap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDirt; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.BlockPrismarine; +import net.minecraft.block.BlockRedSandstone; +import net.minecraft.block.BlockSand; +import net.minecraft.block.BlockSandStone; +import net.minecraft.block.BlockSilverfish; +import net.minecraft.block.BlockStone; +import net.minecraft.block.BlockStoneBrick; +import net.minecraft.block.BlockWall; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityPainting; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionHelper; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.RegistryNamespaced; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class Item +{ + public static final RegistryNamespaced itemRegistry = new RegistryNamespaced(); + private static final Map BLOCK_TO_ITEM = Maps.newHashMap(); + protected static final UUID itemModifierUUID = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + private CreativeTabs tabToDisplayOn; + + /** The RNG used by the Item subclasses. */ + protected static Random itemRand = new Random(); + + /** Maximum size of the stack. */ + protected int maxStackSize = 64; + + /** Maximum damage an item can handle. */ + private int maxDamage; + + /** If true, render the object in full 3D, like weapons and tools. */ + protected boolean bFull3D; + + /** + * Some items (like dyes) have multiple subtypes on same item, this is field define this behavior + */ + protected boolean hasSubtypes; + private Item containerItem; + + /** + * The string representing this item's effect on a potion when used as an ingredient. + */ + private String potionEffect; + + /** The unlocalized name of this item. */ + private String unlocalizedName; + + public static int getIdFromItem(Item itemIn) + { + return itemIn == null ? 0 : itemRegistry.getIDForObject(itemIn); + } + + public static Item getItemById(int id) + { + return (Item)itemRegistry.getObjectById(id); + } + + public static Item getItemFromBlock(Block blockIn) + { + return (Item)BLOCK_TO_ITEM.get(blockIn); + } + + /** + * Tries to get an Item by it's name (e.g. minecraft:apple) or a String representation of a numerical ID. If both + * fail, null is returned. + */ + public static Item getByNameOrId(String id) + { + Item item = (Item)itemRegistry.getObject(new ResourceLocation(id)); + + if (item == null) + { + try + { + return getItemById(Integer.parseInt(id)); + } + catch (NumberFormatException var3) + { + ; + } + } + + return item; + } + + /** + * Called when an ItemStack with NBT data is read to potentially that ItemStack's NBT data + */ + public boolean updateItemStackNBT(NBTTagCompound nbt) + { + return false; + } + + public Item setMaxStackSize(int maxStackSize) + { + this.maxStackSize = maxStackSize; + return this; + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + return false; + } + + public float getStrVsBlock(ItemStack stack, Block block) + { + return 1.0F; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + return itemStackIn; + } + + /** + * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using + * the Item before the action is complete. + */ + public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn) + { + return stack; + } + + /** + * Returns the maximum size of the stack for a specific item. *Isn't this more a Set than a Get?* + */ + public int getItemStackLimit() + { + return this.maxStackSize; + } + + /** + * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is + * placed as a Block (mostly used with ItemBlocks). + */ + public int getMetadata(int damage) + { + return 0; + } + + public boolean getHasSubtypes() + { + return this.hasSubtypes; + } + + protected Item setHasSubtypes(boolean hasSubtypes) + { + this.hasSubtypes = hasSubtypes; + return this; + } + + /** + * Returns the maximum damage an item can take. + */ + public int getMaxDamage() + { + return this.maxDamage; + } + + /** + * set max damage of an Item + */ + protected Item setMaxDamage(int maxDamageIn) + { + this.maxDamage = maxDamageIn; + return this; + } + + public boolean isDamageable() + { + return this.maxDamage > 0 && !this.hasSubtypes; + } + + /** + * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise + * the damage on the stack. + */ + public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) + { + return false; + } + + /** + * Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic. + */ + public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) + { + return false; + } + + /** + * Check whether this Item can harvest the given Block + */ + public boolean canHarvestBlock(Block blockIn) + { + return false; + } + + /** + * Returns true if the item can be used on the given entity, e.g. shears on sheep. + */ + public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) + { + return false; + } + + /** + * Sets bFull3D to True and return the object. + */ + public Item setFull3D() + { + this.bFull3D = true; + return this; + } + + /** + * Returns True is the item is renderer in full 3D when hold. + */ + public boolean isFull3D() + { + return this.bFull3D; + } + + /** + * Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities + * hands. + */ + public boolean shouldRotateAroundWhenRendering() + { + return false; + } + + /** + * Sets the unlocalized name of this item to the string passed as the parameter, prefixed by "item." + */ + public Item setUnlocalizedName(String unlocalizedName) + { + this.unlocalizedName = unlocalizedName; + return this; + } + + /** + * Translates the unlocalized name of this item, but without the .name suffix, so the translation fails and the + * unlocalized name itself is returned. + */ + public String getUnlocalizedNameInefficiently(ItemStack stack) + { + String s = this.getUnlocalizedName(stack); + return s == null ? "" : StatCollector.translateToLocal(s); + } + + /** + * Returns the unlocalized name of this item. + */ + public String getUnlocalizedName() + { + return "item." + this.unlocalizedName; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack stack) + { + return "item." + this.unlocalizedName; + } + + public Item setContainerItem(Item containerItem) + { + this.containerItem = containerItem; + return this; + } + + /** + * If this function returns true (or the item is damageable), the ItemStack's NBT tag will be sent to the client. + */ + public boolean getShareTag() + { + return true; + } + + public Item getContainerItem() + { + return this.containerItem; + } + + /** + * True if this Item has a container item (a.k.a. crafting result) + */ + public boolean hasContainerItem() + { + return this.containerItem != null; + } + + public int getColorFromItemStack(ItemStack stack, int renderPass) + { + return 16777215; + } + + /** + * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and + * update it's contents. + */ + public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) + { + } + + /** + * Called when item is crafted/smelted. Used only by maps so far. + */ + public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn) + { + } + + /** + * false for all Items except sub-classes of ItemMapBase + */ + public boolean isMap() + { + return false; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack stack) + { + return EnumAction.NONE; + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack stack) + { + return 0; + } + + /** + * Called when the player stops using an Item (stops holding the right mouse button). + */ + public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft) + { + } + + /** + * Sets the string representing this item's effect on a potion when used as an ingredient. + */ + protected Item setPotionEffect(String potionEffect) + { + this.potionEffect = potionEffect; + return this; + } + + public String getPotionEffect(ItemStack stack) + { + return this.potionEffect; + } + + public boolean isPotionIngredient(ItemStack stack) + { + return this.getPotionEffect(stack) != null; + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) + { + } + + public String getItemStackDisplayName(ItemStack stack) + { + return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim(); + } + + public boolean hasEffect(ItemStack stack) + { + return stack.isItemEnchanted(); + } + + /** + * Return an item rarity from EnumRarity + */ + public EnumRarity getRarity(ItemStack stack) + { + return stack.isItemEnchanted() ? EnumRarity.RARE : EnumRarity.COMMON; + } + + /** + * Checks isDamagable and if it cannot be stacked + */ + public boolean isItemTool(ItemStack stack) + { + return this.getItemStackLimit() == 1 && this.isDamageable(); + } + + protected MovingObjectPosition getMovingObjectPositionFromPlayer(World worldIn, EntityPlayer playerIn, boolean useLiquids) + { + float f = playerIn.rotationPitch; + float f1 = playerIn.rotationYaw; + double d0 = playerIn.posX; + double d1 = playerIn.posY + (double)playerIn.getEyeHeight(); + double d2 = playerIn.posZ; + Vec3 vec3 = new Vec3(d0, d1, d2); + float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI); + float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI); + float f4 = -MathHelper.cos(-f * 0.017453292F); + float f5 = MathHelper.sin(-f * 0.017453292F); + float f6 = f3 * f4; + float f7 = f2 * f4; + double d3 = 5.0D; + Vec3 vec31 = vec3.addVector((double)f6 * d3, (double)f5 * d3, (double)f7 * d3); + return worldIn.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false); + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return 0; + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) + { + subItems.add(new ItemStack(itemIn, 1, 0)); + } + + /** + * gets the CreativeTab this item is displayed on + */ + public CreativeTabs getCreativeTab() + { + return this.tabToDisplayOn; + } + + /** + * returns this; + */ + public Item setCreativeTab(CreativeTabs tab) + { + this.tabToDisplayOn = tab; + return this; + } + + /** + * Returns true if players can use this item to affect the world (e.g. placing blocks, placing ender eyes in portal) + * when not in creative + */ + public boolean canItemEditBlocks() + { + return false; + } + + /** + * Return whether this item is repairable in an anvil. + */ + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) + { + return false; + } + + public Multimap getItemAttributeModifiers() + { + return HashMultimap.create(); + } + + public static void registerItems() + { + registerItemBlock(Blocks.stone, (new ItemMultiTexture(Blocks.stone, Blocks.stone, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockStone.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("stone")); + registerItemBlock(Blocks.grass, new ItemColored(Blocks.grass, false)); + registerItemBlock(Blocks.dirt, (new ItemMultiTexture(Blocks.dirt, Blocks.dirt, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockDirt.DirtType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("dirt")); + registerItemBlock(Blocks.cobblestone); + registerItemBlock(Blocks.planks, (new ItemMultiTexture(Blocks.planks, Blocks.planks, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("wood")); + registerItemBlock(Blocks.sapling, (new ItemMultiTexture(Blocks.sapling, Blocks.sapling, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("sapling")); + registerItemBlock(Blocks.bedrock); + registerItemBlock(Blocks.sand, (new ItemMultiTexture(Blocks.sand, Blocks.sand, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockSand.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("sand")); + registerItemBlock(Blocks.gravel); + registerItemBlock(Blocks.gold_ore); + registerItemBlock(Blocks.iron_ore); + registerItemBlock(Blocks.coal_ore); + registerItemBlock(Blocks.log, (new ItemMultiTexture(Blocks.log, Blocks.log, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("log")); + registerItemBlock(Blocks.log2, (new ItemMultiTexture(Blocks.log2, Blocks.log2, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockPlanks.EnumType.byMetadata(p_apply_1_.getMetadata() + 4).getUnlocalizedName(); + } + })).setUnlocalizedName("log")); + registerItemBlock(Blocks.leaves, (new ItemLeaves(Blocks.leaves)).setUnlocalizedName("leaves")); + registerItemBlock(Blocks.leaves2, (new ItemLeaves(Blocks.leaves2)).setUnlocalizedName("leaves")); + registerItemBlock(Blocks.sponge, (new ItemMultiTexture(Blocks.sponge, Blocks.sponge, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return (p_apply_1_.getMetadata() & 1) == 1 ? "wet" : "dry"; + } + })).setUnlocalizedName("sponge")); + registerItemBlock(Blocks.glass); + registerItemBlock(Blocks.lapis_ore); + registerItemBlock(Blocks.lapis_block); + registerItemBlock(Blocks.dispenser); + registerItemBlock(Blocks.sandstone, (new ItemMultiTexture(Blocks.sandstone, Blocks.sandstone, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockSandStone.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("sandStone")); + registerItemBlock(Blocks.noteblock); + registerItemBlock(Blocks.golden_rail); + registerItemBlock(Blocks.detector_rail); + registerItemBlock(Blocks.sticky_piston, new ItemPiston(Blocks.sticky_piston)); + registerItemBlock(Blocks.web); + registerItemBlock(Blocks.tallgrass, (new ItemColored(Blocks.tallgrass, true)).setSubtypeNames(new String[] {"shrub", "grass", "fern"})); + registerItemBlock(Blocks.deadbush); + registerItemBlock(Blocks.piston, new ItemPiston(Blocks.piston)); + registerItemBlock(Blocks.wool, (new ItemCloth(Blocks.wool)).setUnlocalizedName("cloth")); + registerItemBlock(Blocks.yellow_flower, (new ItemMultiTexture(Blocks.yellow_flower, Blocks.yellow_flower, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockFlower.EnumFlowerType.getType(BlockFlower.EnumFlowerColor.YELLOW, p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("flower")); + registerItemBlock(Blocks.red_flower, (new ItemMultiTexture(Blocks.red_flower, Blocks.red_flower, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockFlower.EnumFlowerType.getType(BlockFlower.EnumFlowerColor.RED, p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("rose")); + registerItemBlock(Blocks.brown_mushroom); + registerItemBlock(Blocks.red_mushroom); + registerItemBlock(Blocks.gold_block); + registerItemBlock(Blocks.iron_block); + registerItemBlock(Blocks.stone_slab, (new ItemSlab(Blocks.stone_slab, Blocks.stone_slab, Blocks.double_stone_slab)).setUnlocalizedName("stoneSlab")); + registerItemBlock(Blocks.brick_block); + registerItemBlock(Blocks.tnt); + registerItemBlock(Blocks.bookshelf); + registerItemBlock(Blocks.mossy_cobblestone); + registerItemBlock(Blocks.obsidian); + registerItemBlock(Blocks.torch); + registerItemBlock(Blocks.mob_spawner); + registerItemBlock(Blocks.oak_stairs); + registerItemBlock(Blocks.chest); + registerItemBlock(Blocks.diamond_ore); + registerItemBlock(Blocks.diamond_block); + registerItemBlock(Blocks.crafting_table); + registerItemBlock(Blocks.farmland); + registerItemBlock(Blocks.furnace); + registerItemBlock(Blocks.lit_furnace); + registerItemBlock(Blocks.ladder); + registerItemBlock(Blocks.rail); + registerItemBlock(Blocks.stone_stairs); + registerItemBlock(Blocks.lever); + registerItemBlock(Blocks.stone_pressure_plate); + registerItemBlock(Blocks.wooden_pressure_plate); + registerItemBlock(Blocks.redstone_ore); + registerItemBlock(Blocks.redstone_torch); + registerItemBlock(Blocks.stone_button); + registerItemBlock(Blocks.snow_layer, new ItemSnow(Blocks.snow_layer)); + registerItemBlock(Blocks.ice); + registerItemBlock(Blocks.snow); + registerItemBlock(Blocks.cactus); + registerItemBlock(Blocks.clay); + registerItemBlock(Blocks.jukebox); + registerItemBlock(Blocks.oak_fence); + registerItemBlock(Blocks.spruce_fence); + registerItemBlock(Blocks.birch_fence); + registerItemBlock(Blocks.jungle_fence); + registerItemBlock(Blocks.dark_oak_fence); + registerItemBlock(Blocks.acacia_fence); + registerItemBlock(Blocks.pumpkin); + registerItemBlock(Blocks.netherrack); + registerItemBlock(Blocks.soul_sand); + registerItemBlock(Blocks.glowstone); + registerItemBlock(Blocks.lit_pumpkin); + registerItemBlock(Blocks.trapdoor); + registerItemBlock(Blocks.monster_egg, (new ItemMultiTexture(Blocks.monster_egg, Blocks.monster_egg, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockSilverfish.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("monsterStoneEgg")); + registerItemBlock(Blocks.stonebrick, (new ItemMultiTexture(Blocks.stonebrick, Blocks.stonebrick, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockStoneBrick.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("stonebricksmooth")); + registerItemBlock(Blocks.brown_mushroom_block); + registerItemBlock(Blocks.red_mushroom_block); + registerItemBlock(Blocks.iron_bars); + registerItemBlock(Blocks.glass_pane); + registerItemBlock(Blocks.melon_block); + registerItemBlock(Blocks.vine, new ItemColored(Blocks.vine, false)); + registerItemBlock(Blocks.oak_fence_gate); + registerItemBlock(Blocks.spruce_fence_gate); + registerItemBlock(Blocks.birch_fence_gate); + registerItemBlock(Blocks.jungle_fence_gate); + registerItemBlock(Blocks.dark_oak_fence_gate); + registerItemBlock(Blocks.acacia_fence_gate); + registerItemBlock(Blocks.brick_stairs); + registerItemBlock(Blocks.stone_brick_stairs); + registerItemBlock(Blocks.mycelium); + registerItemBlock(Blocks.waterlily, new ItemLilyPad(Blocks.waterlily)); + registerItemBlock(Blocks.nether_brick); + registerItemBlock(Blocks.nether_brick_fence); + registerItemBlock(Blocks.nether_brick_stairs); + registerItemBlock(Blocks.enchanting_table); + registerItemBlock(Blocks.end_portal_frame); + registerItemBlock(Blocks.end_stone); + registerItemBlock(Blocks.dragon_egg); + registerItemBlock(Blocks.redstone_lamp); + registerItemBlock(Blocks.wooden_slab, (new ItemSlab(Blocks.wooden_slab, Blocks.wooden_slab, Blocks.double_wooden_slab)).setUnlocalizedName("woodSlab")); + registerItemBlock(Blocks.sandstone_stairs); + registerItemBlock(Blocks.emerald_ore); + registerItemBlock(Blocks.ender_chest); + registerItemBlock(Blocks.tripwire_hook); + registerItemBlock(Blocks.emerald_block); + registerItemBlock(Blocks.spruce_stairs); + registerItemBlock(Blocks.birch_stairs); + registerItemBlock(Blocks.jungle_stairs); + registerItemBlock(Blocks.command_block); + registerItemBlock(Blocks.beacon); + registerItemBlock(Blocks.cobblestone_wall, (new ItemMultiTexture(Blocks.cobblestone_wall, Blocks.cobblestone_wall, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockWall.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("cobbleWall")); + registerItemBlock(Blocks.wooden_button); + registerItemBlock(Blocks.anvil, (new ItemAnvilBlock(Blocks.anvil)).setUnlocalizedName("anvil")); + registerItemBlock(Blocks.trapped_chest); + registerItemBlock(Blocks.light_weighted_pressure_plate); + registerItemBlock(Blocks.heavy_weighted_pressure_plate); + registerItemBlock(Blocks.daylight_detector); + registerItemBlock(Blocks.redstone_block); + registerItemBlock(Blocks.quartz_ore); + registerItemBlock(Blocks.hopper); + registerItemBlock(Blocks.quartz_block, (new ItemMultiTexture(Blocks.quartz_block, Blocks.quartz_block, new String[] {"default", "chiseled", "lines"})).setUnlocalizedName("quartzBlock")); + registerItemBlock(Blocks.quartz_stairs); + registerItemBlock(Blocks.activator_rail); + registerItemBlock(Blocks.dropper); + registerItemBlock(Blocks.stained_hardened_clay, (new ItemCloth(Blocks.stained_hardened_clay)).setUnlocalizedName("clayHardenedStained")); + registerItemBlock(Blocks.barrier); + registerItemBlock(Blocks.iron_trapdoor); + registerItemBlock(Blocks.hay_block); + registerItemBlock(Blocks.carpet, (new ItemCloth(Blocks.carpet)).setUnlocalizedName("woolCarpet")); + registerItemBlock(Blocks.hardened_clay); + registerItemBlock(Blocks.coal_block); + registerItemBlock(Blocks.packed_ice); + registerItemBlock(Blocks.acacia_stairs); + registerItemBlock(Blocks.dark_oak_stairs); + registerItemBlock(Blocks.slime_block); + registerItemBlock(Blocks.double_plant, (new ItemDoublePlant(Blocks.double_plant, Blocks.double_plant, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockDoublePlant.EnumPlantType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("doublePlant")); + registerItemBlock(Blocks.stained_glass, (new ItemCloth(Blocks.stained_glass)).setUnlocalizedName("stainedGlass")); + registerItemBlock(Blocks.stained_glass_pane, (new ItemCloth(Blocks.stained_glass_pane)).setUnlocalizedName("stainedGlassPane")); + registerItemBlock(Blocks.prismarine, (new ItemMultiTexture(Blocks.prismarine, Blocks.prismarine, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockPrismarine.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("prismarine")); + registerItemBlock(Blocks.sea_lantern); + registerItemBlock(Blocks.red_sandstone, (new ItemMultiTexture(Blocks.red_sandstone, Blocks.red_sandstone, new Function() + { + public String apply(ItemStack p_apply_1_) + { + return BlockRedSandstone.EnumType.byMetadata(p_apply_1_.getMetadata()).getUnlocalizedName(); + } + })).setUnlocalizedName("redSandStone")); + registerItemBlock(Blocks.red_sandstone_stairs); + registerItemBlock(Blocks.stone_slab2, (new ItemSlab(Blocks.stone_slab2, Blocks.stone_slab2, Blocks.double_stone_slab2)).setUnlocalizedName("stoneSlab2")); + registerItem(256, "iron_shovel", (new ItemSpade(Item.ToolMaterial.IRON)).setUnlocalizedName("shovelIron")); + registerItem(257, "iron_pickaxe", (new ItemPickaxe(Item.ToolMaterial.IRON)).setUnlocalizedName("pickaxeIron")); + registerItem(258, "iron_axe", (new ItemAxe(Item.ToolMaterial.IRON)).setUnlocalizedName("hatchetIron")); + registerItem(259, "flint_and_steel", (new ItemFlintAndSteel()).setUnlocalizedName("flintAndSteel")); + registerItem(260, "apple", (new ItemFood(4, 0.3F, false)).setUnlocalizedName("apple")); + registerItem(261, "bow", (new ItemBow()).setUnlocalizedName("bow")); + registerItem(262, "arrow", (new Item()).setUnlocalizedName("arrow").setCreativeTab(CreativeTabs.tabCombat)); + registerItem(263, "coal", (new ItemCoal()).setUnlocalizedName("coal")); + registerItem(264, "diamond", (new Item()).setUnlocalizedName("diamond").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(265, "iron_ingot", (new Item()).setUnlocalizedName("ingotIron").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(266, "gold_ingot", (new Item()).setUnlocalizedName("ingotGold").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(267, "iron_sword", (new ItemSword(Item.ToolMaterial.IRON)).setUnlocalizedName("swordIron")); + registerItem(268, "wooden_sword", (new ItemSword(Item.ToolMaterial.WOOD)).setUnlocalizedName("swordWood")); + registerItem(269, "wooden_shovel", (new ItemSpade(Item.ToolMaterial.WOOD)).setUnlocalizedName("shovelWood")); + registerItem(270, "wooden_pickaxe", (new ItemPickaxe(Item.ToolMaterial.WOOD)).setUnlocalizedName("pickaxeWood")); + registerItem(271, "wooden_axe", (new ItemAxe(Item.ToolMaterial.WOOD)).setUnlocalizedName("hatchetWood")); + registerItem(272, "stone_sword", (new ItemSword(Item.ToolMaterial.STONE)).setUnlocalizedName("swordStone")); + registerItem(273, "stone_shovel", (new ItemSpade(Item.ToolMaterial.STONE)).setUnlocalizedName("shovelStone")); + registerItem(274, "stone_pickaxe", (new ItemPickaxe(Item.ToolMaterial.STONE)).setUnlocalizedName("pickaxeStone")); + registerItem(275, "stone_axe", (new ItemAxe(Item.ToolMaterial.STONE)).setUnlocalizedName("hatchetStone")); + registerItem(276, "diamond_sword", (new ItemSword(Item.ToolMaterial.EMERALD)).setUnlocalizedName("swordDiamond")); + registerItem(277, "diamond_shovel", (new ItemSpade(Item.ToolMaterial.EMERALD)).setUnlocalizedName("shovelDiamond")); + registerItem(278, "diamond_pickaxe", (new ItemPickaxe(Item.ToolMaterial.EMERALD)).setUnlocalizedName("pickaxeDiamond")); + registerItem(279, "diamond_axe", (new ItemAxe(Item.ToolMaterial.EMERALD)).setUnlocalizedName("hatchetDiamond")); + registerItem(280, "stick", (new Item()).setFull3D().setUnlocalizedName("stick").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(281, "bowl", (new Item()).setUnlocalizedName("bowl").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(282, "mushroom_stew", (new ItemSoup(6)).setUnlocalizedName("mushroomStew")); + registerItem(283, "golden_sword", (new ItemSword(Item.ToolMaterial.GOLD)).setUnlocalizedName("swordGold")); + registerItem(284, "golden_shovel", (new ItemSpade(Item.ToolMaterial.GOLD)).setUnlocalizedName("shovelGold")); + registerItem(285, "golden_pickaxe", (new ItemPickaxe(Item.ToolMaterial.GOLD)).setUnlocalizedName("pickaxeGold")); + registerItem(286, "golden_axe", (new ItemAxe(Item.ToolMaterial.GOLD)).setUnlocalizedName("hatchetGold")); + registerItem(287, "string", (new ItemReed(Blocks.tripwire)).setUnlocalizedName("string").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(288, "feather", (new Item()).setUnlocalizedName("feather").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(289, "gunpowder", (new Item()).setUnlocalizedName("sulphur").setPotionEffect(PotionHelper.gunpowderEffect).setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(290, "wooden_hoe", (new ItemHoe(Item.ToolMaterial.WOOD)).setUnlocalizedName("hoeWood")); + registerItem(291, "stone_hoe", (new ItemHoe(Item.ToolMaterial.STONE)).setUnlocalizedName("hoeStone")); + registerItem(292, "iron_hoe", (new ItemHoe(Item.ToolMaterial.IRON)).setUnlocalizedName("hoeIron")); + registerItem(293, "diamond_hoe", (new ItemHoe(Item.ToolMaterial.EMERALD)).setUnlocalizedName("hoeDiamond")); + registerItem(294, "golden_hoe", (new ItemHoe(Item.ToolMaterial.GOLD)).setUnlocalizedName("hoeGold")); + registerItem(295, "wheat_seeds", (new ItemSeeds(Blocks.wheat, Blocks.farmland)).setUnlocalizedName("seeds")); + registerItem(296, "wheat", (new Item()).setUnlocalizedName("wheat").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(297, "bread", (new ItemFood(5, 0.6F, false)).setUnlocalizedName("bread")); + registerItem(298, "leather_helmet", (new ItemArmor(ItemArmor.ArmorMaterial.LEATHER, 0, 0)).setUnlocalizedName("helmetCloth")); + registerItem(299, "leather_chestplate", (new ItemArmor(ItemArmor.ArmorMaterial.LEATHER, 0, 1)).setUnlocalizedName("chestplateCloth")); + registerItem(300, "leather_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.LEATHER, 0, 2)).setUnlocalizedName("leggingsCloth")); + registerItem(301, "leather_boots", (new ItemArmor(ItemArmor.ArmorMaterial.LEATHER, 0, 3)).setUnlocalizedName("bootsCloth")); + registerItem(302, "chainmail_helmet", (new ItemArmor(ItemArmor.ArmorMaterial.CHAIN, 1, 0)).setUnlocalizedName("helmetChain")); + registerItem(303, "chainmail_chestplate", (new ItemArmor(ItemArmor.ArmorMaterial.CHAIN, 1, 1)).setUnlocalizedName("chestplateChain")); + registerItem(304, "chainmail_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.CHAIN, 1, 2)).setUnlocalizedName("leggingsChain")); + registerItem(305, "chainmail_boots", (new ItemArmor(ItemArmor.ArmorMaterial.CHAIN, 1, 3)).setUnlocalizedName("bootsChain")); + registerItem(306, "iron_helmet", (new ItemArmor(ItemArmor.ArmorMaterial.IRON, 2, 0)).setUnlocalizedName("helmetIron")); + registerItem(307, "iron_chestplate", (new ItemArmor(ItemArmor.ArmorMaterial.IRON, 2, 1)).setUnlocalizedName("chestplateIron")); + registerItem(308, "iron_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.IRON, 2, 2)).setUnlocalizedName("leggingsIron")); + registerItem(309, "iron_boots", (new ItemArmor(ItemArmor.ArmorMaterial.IRON, 2, 3)).setUnlocalizedName("bootsIron")); + registerItem(310, "diamond_helmet", (new ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 3, 0)).setUnlocalizedName("helmetDiamond")); + registerItem(311, "diamond_chestplate", (new ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 3, 1)).setUnlocalizedName("chestplateDiamond")); + registerItem(312, "diamond_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 3, 2)).setUnlocalizedName("leggingsDiamond")); + registerItem(313, "diamond_boots", (new ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 3, 3)).setUnlocalizedName("bootsDiamond")); + registerItem(314, "golden_helmet", (new ItemArmor(ItemArmor.ArmorMaterial.GOLD, 4, 0)).setUnlocalizedName("helmetGold")); + registerItem(315, "golden_chestplate", (new ItemArmor(ItemArmor.ArmorMaterial.GOLD, 4, 1)).setUnlocalizedName("chestplateGold")); + registerItem(316, "golden_leggings", (new ItemArmor(ItemArmor.ArmorMaterial.GOLD, 4, 2)).setUnlocalizedName("leggingsGold")); + registerItem(317, "golden_boots", (new ItemArmor(ItemArmor.ArmorMaterial.GOLD, 4, 3)).setUnlocalizedName("bootsGold")); + registerItem(318, "flint", (new Item()).setUnlocalizedName("flint").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(319, "porkchop", (new ItemFood(3, 0.3F, true)).setUnlocalizedName("porkchopRaw")); + registerItem(320, "cooked_porkchop", (new ItemFood(8, 0.8F, true)).setUnlocalizedName("porkchopCooked")); + registerItem(321, "painting", (new ItemHangingEntity(EntityPainting.class)).setUnlocalizedName("painting")); + registerItem(322, "golden_apple", (new ItemAppleGold(4, 1.2F, false)).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 5, 1, 1.0F).setUnlocalizedName("appleGold")); + registerItem(323, "sign", (new ItemSign()).setUnlocalizedName("sign")); + registerItem(324, "wooden_door", (new ItemDoor(Blocks.oak_door)).setUnlocalizedName("doorOak")); + Item item = (new ItemBucket(Blocks.air)).setUnlocalizedName("bucket").setMaxStackSize(16); + registerItem(325, "bucket", item); + registerItem(326, "water_bucket", (new ItemBucket(Blocks.flowing_water)).setUnlocalizedName("bucketWater").setContainerItem(item)); + registerItem(327, "lava_bucket", (new ItemBucket(Blocks.flowing_lava)).setUnlocalizedName("bucketLava").setContainerItem(item)); + registerItem(328, "minecart", (new ItemMinecart(EntityMinecart.EnumMinecartType.RIDEABLE)).setUnlocalizedName("minecart")); + registerItem(329, "saddle", (new ItemSaddle()).setUnlocalizedName("saddle")); + registerItem(330, "iron_door", (new ItemDoor(Blocks.iron_door)).setUnlocalizedName("doorIron")); + registerItem(331, "redstone", (new ItemRedstone()).setUnlocalizedName("redstone").setPotionEffect(PotionHelper.redstoneEffect)); + registerItem(332, "snowball", (new ItemSnowball()).setUnlocalizedName("snowball")); + registerItem(333, "boat", (new ItemBoat()).setUnlocalizedName("boat")); + registerItem(334, "leather", (new Item()).setUnlocalizedName("leather").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(335, "milk_bucket", (new ItemBucketMilk()).setUnlocalizedName("milk").setContainerItem(item)); + registerItem(336, "brick", (new Item()).setUnlocalizedName("brick").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(337, "clay_ball", (new Item()).setUnlocalizedName("clay").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(338, "reeds", (new ItemReed(Blocks.reeds)).setUnlocalizedName("reeds").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(339, "paper", (new Item()).setUnlocalizedName("paper").setCreativeTab(CreativeTabs.tabMisc)); + registerItem(340, "book", (new ItemBook()).setUnlocalizedName("book").setCreativeTab(CreativeTabs.tabMisc)); + registerItem(341, "slime_ball", (new Item()).setUnlocalizedName("slimeball").setCreativeTab(CreativeTabs.tabMisc)); + registerItem(342, "chest_minecart", (new ItemMinecart(EntityMinecart.EnumMinecartType.CHEST)).setUnlocalizedName("minecartChest")); + registerItem(343, "furnace_minecart", (new ItemMinecart(EntityMinecart.EnumMinecartType.FURNACE)).setUnlocalizedName("minecartFurnace")); + registerItem(344, "egg", (new ItemEgg()).setUnlocalizedName("egg")); + registerItem(345, "compass", (new Item()).setUnlocalizedName("compass").setCreativeTab(CreativeTabs.tabTools)); + registerItem(346, "fishing_rod", (new ItemFishingRod()).setUnlocalizedName("fishingRod")); + registerItem(347, "clock", (new Item()).setUnlocalizedName("clock").setCreativeTab(CreativeTabs.tabTools)); + registerItem(348, "glowstone_dust", (new Item()).setUnlocalizedName("yellowDust").setPotionEffect(PotionHelper.glowstoneEffect).setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(349, "fish", (new ItemFishFood(false)).setUnlocalizedName("fish").setHasSubtypes(true)); + registerItem(350, "cooked_fish", (new ItemFishFood(true)).setUnlocalizedName("fish").setHasSubtypes(true)); + registerItem(351, "dye", (new ItemDye()).setUnlocalizedName("dyePowder")); + registerItem(352, "bone", (new Item()).setUnlocalizedName("bone").setFull3D().setCreativeTab(CreativeTabs.tabMisc)); + registerItem(353, "sugar", (new Item()).setUnlocalizedName("sugar").setPotionEffect(PotionHelper.sugarEffect).setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(354, "cake", (new ItemReed(Blocks.cake)).setMaxStackSize(1).setUnlocalizedName("cake").setCreativeTab(CreativeTabs.tabFood)); + registerItem(355, "bed", (new ItemBed()).setMaxStackSize(1).setUnlocalizedName("bed")); + registerItem(356, "repeater", (new ItemReed(Blocks.unpowered_repeater)).setUnlocalizedName("diode").setCreativeTab(CreativeTabs.tabRedstone)); + registerItem(357, "cookie", (new ItemFood(2, 0.1F, false)).setUnlocalizedName("cookie")); + registerItem(358, "filled_map", (new ItemMap()).setUnlocalizedName("map")); + registerItem(359, "shears", (new ItemShears()).setUnlocalizedName("shears")); + registerItem(360, "melon", (new ItemFood(2, 0.3F, false)).setUnlocalizedName("melon")); + registerItem(361, "pumpkin_seeds", (new ItemSeeds(Blocks.pumpkin_stem, Blocks.farmland)).setUnlocalizedName("seeds_pumpkin")); + registerItem(362, "melon_seeds", (new ItemSeeds(Blocks.melon_stem, Blocks.farmland)).setUnlocalizedName("seeds_melon")); + registerItem(363, "beef", (new ItemFood(3, 0.3F, true)).setUnlocalizedName("beefRaw")); + registerItem(364, "cooked_beef", (new ItemFood(8, 0.8F, true)).setUnlocalizedName("beefCooked")); + registerItem(365, "chicken", (new ItemFood(2, 0.3F, true)).setPotionEffect(Potion.hunger.id, 30, 0, 0.3F).setUnlocalizedName("chickenRaw")); + registerItem(366, "cooked_chicken", (new ItemFood(6, 0.6F, true)).setUnlocalizedName("chickenCooked")); + registerItem(367, "rotten_flesh", (new ItemFood(4, 0.1F, true)).setPotionEffect(Potion.hunger.id, 30, 0, 0.8F).setUnlocalizedName("rottenFlesh")); + registerItem(368, "ender_pearl", (new ItemEnderPearl()).setUnlocalizedName("enderPearl")); + registerItem(369, "blaze_rod", (new Item()).setUnlocalizedName("blazeRod").setCreativeTab(CreativeTabs.tabMaterials).setFull3D()); + registerItem(370, "ghast_tear", (new Item()).setUnlocalizedName("ghastTear").setPotionEffect(PotionHelper.ghastTearEffect).setCreativeTab(CreativeTabs.tabBrewing)); + registerItem(371, "gold_nugget", (new Item()).setUnlocalizedName("goldNugget").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(372, "nether_wart", (new ItemSeeds(Blocks.nether_wart, Blocks.soul_sand)).setUnlocalizedName("netherStalkSeeds").setPotionEffect("+4")); + registerItem(373, "potion", (new ItemPotion()).setUnlocalizedName("potion")); + registerItem(374, "glass_bottle", (new ItemGlassBottle()).setUnlocalizedName("glassBottle")); + registerItem(375, "spider_eye", (new ItemFood(2, 0.8F, false)).setPotionEffect(Potion.poison.id, 5, 0, 1.0F).setUnlocalizedName("spiderEye").setPotionEffect(PotionHelper.spiderEyeEffect)); + registerItem(376, "fermented_spider_eye", (new Item()).setUnlocalizedName("fermentedSpiderEye").setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setCreativeTab(CreativeTabs.tabBrewing)); + registerItem(377, "blaze_powder", (new Item()).setUnlocalizedName("blazePowder").setPotionEffect(PotionHelper.blazePowderEffect).setCreativeTab(CreativeTabs.tabBrewing)); + registerItem(378, "magma_cream", (new Item()).setUnlocalizedName("magmaCream").setPotionEffect(PotionHelper.magmaCreamEffect).setCreativeTab(CreativeTabs.tabBrewing)); + registerItem(379, "brewing_stand", (new ItemReed(Blocks.brewing_stand)).setUnlocalizedName("brewingStand").setCreativeTab(CreativeTabs.tabBrewing)); + registerItem(380, "cauldron", (new ItemReed(Blocks.cauldron)).setUnlocalizedName("cauldron").setCreativeTab(CreativeTabs.tabBrewing)); + registerItem(381, "ender_eye", (new ItemEnderEye()).setUnlocalizedName("eyeOfEnder")); + registerItem(382, "speckled_melon", (new Item()).setUnlocalizedName("speckledMelon").setPotionEffect(PotionHelper.speckledMelonEffect).setCreativeTab(CreativeTabs.tabBrewing)); + registerItem(383, "spawn_egg", (new ItemMonsterPlacer()).setUnlocalizedName("monsterPlacer")); + registerItem(384, "experience_bottle", (new ItemExpBottle()).setUnlocalizedName("expBottle")); + registerItem(385, "fire_charge", (new ItemFireball()).setUnlocalizedName("fireball")); + registerItem(386, "writable_book", (new ItemWritableBook()).setUnlocalizedName("writingBook").setCreativeTab(CreativeTabs.tabMisc)); + registerItem(387, "written_book", (new ItemEditableBook()).setUnlocalizedName("writtenBook").setMaxStackSize(16)); + registerItem(388, "emerald", (new Item()).setUnlocalizedName("emerald").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(389, "item_frame", (new ItemHangingEntity(EntityItemFrame.class)).setUnlocalizedName("frame")); + registerItem(390, "flower_pot", (new ItemReed(Blocks.flower_pot)).setUnlocalizedName("flowerPot").setCreativeTab(CreativeTabs.tabDecorations)); + registerItem(391, "carrot", (new ItemSeedFood(3, 0.6F, Blocks.carrots, Blocks.farmland)).setUnlocalizedName("carrots")); + registerItem(392, "potato", (new ItemSeedFood(1, 0.3F, Blocks.potatoes, Blocks.farmland)).setUnlocalizedName("potato")); + registerItem(393, "baked_potato", (new ItemFood(5, 0.6F, false)).setUnlocalizedName("potatoBaked")); + registerItem(394, "poisonous_potato", (new ItemFood(2, 0.3F, false)).setPotionEffect(Potion.poison.id, 5, 0, 0.6F).setUnlocalizedName("potatoPoisonous")); + registerItem(395, "map", (new ItemEmptyMap()).setUnlocalizedName("emptyMap")); + registerItem(396, "golden_carrot", (new ItemFood(6, 1.2F, false)).setUnlocalizedName("carrotGolden").setPotionEffect(PotionHelper.goldenCarrotEffect).setCreativeTab(CreativeTabs.tabBrewing)); + registerItem(397, "skull", (new ItemSkull()).setUnlocalizedName("skull")); + registerItem(398, "carrot_on_a_stick", (new ItemCarrotOnAStick()).setUnlocalizedName("carrotOnAStick")); + registerItem(399, "nether_star", (new ItemSimpleFoiled()).setUnlocalizedName("netherStar").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(400, "pumpkin_pie", (new ItemFood(8, 0.3F, false)).setUnlocalizedName("pumpkinPie").setCreativeTab(CreativeTabs.tabFood)); + registerItem(401, "fireworks", (new ItemFirework()).setUnlocalizedName("fireworks")); + registerItem(402, "firework_charge", (new ItemFireworkCharge()).setUnlocalizedName("fireworksCharge").setCreativeTab(CreativeTabs.tabMisc)); + registerItem(403, "enchanted_book", (new ItemEnchantedBook()).setMaxStackSize(1).setUnlocalizedName("enchantedBook")); + registerItem(404, "comparator", (new ItemReed(Blocks.unpowered_comparator)).setUnlocalizedName("comparator").setCreativeTab(CreativeTabs.tabRedstone)); + registerItem(405, "netherbrick", (new Item()).setUnlocalizedName("netherbrick").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(406, "quartz", (new Item()).setUnlocalizedName("netherquartz").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(407, "tnt_minecart", (new ItemMinecart(EntityMinecart.EnumMinecartType.TNT)).setUnlocalizedName("minecartTnt")); + registerItem(408, "hopper_minecart", (new ItemMinecart(EntityMinecart.EnumMinecartType.HOPPER)).setUnlocalizedName("minecartHopper")); + registerItem(409, "prismarine_shard", (new Item()).setUnlocalizedName("prismarineShard").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(410, "prismarine_crystals", (new Item()).setUnlocalizedName("prismarineCrystals").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(411, "rabbit", (new ItemFood(3, 0.3F, true)).setUnlocalizedName("rabbitRaw")); + registerItem(412, "cooked_rabbit", (new ItemFood(5, 0.6F, true)).setUnlocalizedName("rabbitCooked")); + registerItem(413, "rabbit_stew", (new ItemSoup(10)).setUnlocalizedName("rabbitStew")); + registerItem(414, "rabbit_foot", (new Item()).setUnlocalizedName("rabbitFoot").setPotionEffect(PotionHelper.rabbitFootEffect).setCreativeTab(CreativeTabs.tabBrewing)); + registerItem(415, "rabbit_hide", (new Item()).setUnlocalizedName("rabbitHide").setCreativeTab(CreativeTabs.tabMaterials)); + registerItem(416, "armor_stand", (new ItemArmorStand()).setUnlocalizedName("armorStand").setMaxStackSize(16)); + registerItem(417, "iron_horse_armor", (new Item()).setUnlocalizedName("horsearmormetal").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabMisc)); + registerItem(418, "golden_horse_armor", (new Item()).setUnlocalizedName("horsearmorgold").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabMisc)); + registerItem(419, "diamond_horse_armor", (new Item()).setUnlocalizedName("horsearmordiamond").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabMisc)); + registerItem(420, "lead", (new ItemLead()).setUnlocalizedName("leash")); + registerItem(421, "name_tag", (new ItemNameTag()).setUnlocalizedName("nameTag")); + registerItem(422, "command_block_minecart", (new ItemMinecart(EntityMinecart.EnumMinecartType.COMMAND_BLOCK)).setUnlocalizedName("minecartCommandBlock").setCreativeTab((CreativeTabs)null)); + registerItem(423, "mutton", (new ItemFood(2, 0.3F, true)).setUnlocalizedName("muttonRaw")); + registerItem(424, "cooked_mutton", (new ItemFood(6, 0.8F, true)).setUnlocalizedName("muttonCooked")); + registerItem(425, "banner", (new ItemBanner()).setUnlocalizedName("banner")); + registerItem(427, "spruce_door", (new ItemDoor(Blocks.spruce_door)).setUnlocalizedName("doorSpruce")); + registerItem(428, "birch_door", (new ItemDoor(Blocks.birch_door)).setUnlocalizedName("doorBirch")); + registerItem(429, "jungle_door", (new ItemDoor(Blocks.jungle_door)).setUnlocalizedName("doorJungle")); + registerItem(430, "acacia_door", (new ItemDoor(Blocks.acacia_door)).setUnlocalizedName("doorAcacia")); + registerItem(431, "dark_oak_door", (new ItemDoor(Blocks.dark_oak_door)).setUnlocalizedName("doorDarkOak")); + registerItem(2256, "record_13", (new ItemRecord("13")).setUnlocalizedName("record")); + registerItem(2257, "record_cat", (new ItemRecord("cat")).setUnlocalizedName("record")); + registerItem(2258, "record_blocks", (new ItemRecord("blocks")).setUnlocalizedName("record")); + registerItem(2259, "record_chirp", (new ItemRecord("chirp")).setUnlocalizedName("record")); + registerItem(2260, "record_far", (new ItemRecord("far")).setUnlocalizedName("record")); + registerItem(2261, "record_mall", (new ItemRecord("mall")).setUnlocalizedName("record")); + registerItem(2262, "record_mellohi", (new ItemRecord("mellohi")).setUnlocalizedName("record")); + registerItem(2263, "record_stal", (new ItemRecord("stal")).setUnlocalizedName("record")); + registerItem(2264, "record_strad", (new ItemRecord("strad")).setUnlocalizedName("record")); + registerItem(2265, "record_ward", (new ItemRecord("ward")).setUnlocalizedName("record")); + registerItem(2266, "record_11", (new ItemRecord("11")).setUnlocalizedName("record")); + registerItem(2267, "record_wait", (new ItemRecord("wait")).setUnlocalizedName("record")); + } + + /** + * Register a default ItemBlock for the given Block. + */ + private static void registerItemBlock(Block blockIn) + { + registerItemBlock(blockIn, new ItemBlock(blockIn)); + } + + /** + * Register the given Item as the ItemBlock for the given Block. + */ + protected static void registerItemBlock(Block blockIn, Item itemIn) + { + registerItem(Block.getIdFromBlock(blockIn), (ResourceLocation)Block.blockRegistry.getNameForObject(blockIn), itemIn); + BLOCK_TO_ITEM.put(blockIn, itemIn); + } + + private static void registerItem(int id, String textualID, Item itemIn) + { + registerItem(id, new ResourceLocation(textualID), itemIn); + } + + private static void registerItem(int id, ResourceLocation textualID, Item itemIn) + { + itemRegistry.register(id, textualID, itemIn); + } + + public static enum ToolMaterial + { + WOOD(0, 59, 2.0F, 0.0F, 15), + STONE(1, 131, 4.0F, 1.0F, 5), + IRON(2, 250, 6.0F, 2.0F, 14), + EMERALD(3, 1561, 8.0F, 3.0F, 10), + GOLD(0, 32, 12.0F, 0.0F, 22); + + private final int harvestLevel; + private final int maxUses; + private final float efficiencyOnProperMaterial; + private final float damageVsEntity; + private final int enchantability; + + private ToolMaterial(int harvestLevel, int maxUses, float efficiency, float damageVsEntity, int enchantability) + { + this.harvestLevel = harvestLevel; + this.maxUses = maxUses; + this.efficiencyOnProperMaterial = efficiency; + this.damageVsEntity = damageVsEntity; + this.enchantability = enchantability; + } + + public int getMaxUses() + { + return this.maxUses; + } + + public float getEfficiencyOnProperMaterial() + { + return this.efficiencyOnProperMaterial; + } + + public float getDamageVsEntity() + { + return this.damageVsEntity; + } + + public int getHarvestLevel() + { + return this.harvestLevel; + } + + public int getEnchantability() + { + return this.enchantability; + } + + public Item getRepairItem() + { + return this == WOOD ? Item.getItemFromBlock(Blocks.planks) : (this == STONE ? Item.getItemFromBlock(Blocks.cobblestone) : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null)))); + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemAnvilBlock.java b/src/minecraft/net/minecraft/item/ItemAnvilBlock.java new file mode 100644 index 0000000..6f295a5 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemAnvilBlock.java @@ -0,0 +1,20 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; + +public class ItemAnvilBlock extends ItemMultiTexture +{ + public ItemAnvilBlock(Block block) + { + super(block, block, new String[] {"intact", "slightlyDamaged", "veryDamaged"}); + } + + /** + * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is + * placed as a Block (mostly used with ItemBlocks). + */ + public int getMetadata(int damage) + { + return damage << 2; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemAppleGold.java b/src/minecraft/net/minecraft/item/ItemAppleGold.java new file mode 100644 index 0000000..6cfbdf6 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemAppleGold.java @@ -0,0 +1,61 @@ +package net.minecraft.item; + +import java.util.List; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.world.World; + +public class ItemAppleGold extends ItemFood +{ + public ItemAppleGold(int amount, float saturation, boolean isWolfFood) + { + super(amount, saturation, isWolfFood); + this.setHasSubtypes(true); + } + + public boolean hasEffect(ItemStack stack) + { + return stack.getMetadata() > 0; + } + + /** + * Return an item rarity from EnumRarity + */ + public EnumRarity getRarity(ItemStack stack) + { + return stack.getMetadata() == 0 ? EnumRarity.RARE : EnumRarity.EPIC; + } + + protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) + { + if (!worldIn.isRemote) + { + player.addPotionEffect(new PotionEffect(Potion.absorption.id, 2400, 0)); + } + + if (stack.getMetadata() > 0) + { + if (!worldIn.isRemote) + { + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 600, 4)); + player.addPotionEffect(new PotionEffect(Potion.resistance.id, 6000, 0)); + player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 6000, 0)); + } + } + else + { + super.onFoodEaten(stack, worldIn, player); + } + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) + { + subItems.add(new ItemStack(itemIn, 1, 0)); + subItems.add(new ItemStack(itemIn, 1, 1)); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemArmor.java b/src/minecraft/net/minecraft/item/ItemArmor.java new file mode 100644 index 0000000..5ba3489 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemArmor.java @@ -0,0 +1,281 @@ +package net.minecraft.item; + +import com.google.common.base.Predicates; +import java.util.List; +import net.minecraft.block.BlockDispenser; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.dispenser.IBehaviorDispenseItem; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EntitySelectors; +import net.minecraft.world.World; + +public class ItemArmor extends Item +{ + /** Holds the 'base' maxDamage that each armorType have. */ + private static final int[] maxDamageArray = new int[] {11, 16, 15, 13}; + public static final String[] EMPTY_SLOT_NAMES = new String[] {"minecraft:items/empty_armor_slot_helmet", "minecraft:items/empty_armor_slot_chestplate", "minecraft:items/empty_armor_slot_leggings", "minecraft:items/empty_armor_slot_boots"}; + private static final IBehaviorDispenseItem dispenserBehavior = new BehaviorDefaultDispenseItem() + { + protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata())); + int i = blockpos.getX(); + int j = blockpos.getY(); + int k = blockpos.getZ(); + AxisAlignedBB axisalignedbb = new AxisAlignedBB((double)i, (double)j, (double)k, (double)(i + 1), (double)(j + 1), (double)(k + 1)); + List list = source.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb, Predicates. and (EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack))); + + if (list.size() > 0) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); + int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; + int i1 = EntityLiving.getArmorPosition(stack); + ItemStack itemstack = stack.copy(); + itemstack.stackSize = 1; + entitylivingbase.setCurrentItemOrArmor(i1 - l, itemstack); + + if (entitylivingbase instanceof EntityLiving) + { + ((EntityLiving)entitylivingbase).setEquipmentDropChance(i1, 2.0F); + } + + --stack.stackSize; + return stack; + } + else + { + return super.dispenseStack(source, stack); + } + } + }; + + /** + * Stores the armor type: 0 is helmet, 1 is plate, 2 is legs and 3 is boots + */ + public final int armorType; + + /** Holds the amount of damage that the armor reduces at full durability. */ + public final int damageReduceAmount; + + /** + * Used on RenderPlayer to select the correspondent armor to be rendered on the player: 0 is cloth, 1 is chain, 2 is + * iron, 3 is diamond and 4 is gold. + */ + public final int renderIndex; + + /** The EnumArmorMaterial used for this ItemArmor */ + private final ItemArmor.ArmorMaterial material; + + public ItemArmor(ItemArmor.ArmorMaterial material, int renderIndex, int armorType) + { + this.material = material; + this.armorType = armorType; + this.renderIndex = renderIndex; + this.damageReduceAmount = material.getDamageReductionAmount(armorType); + this.setMaxDamage(material.getDurability(armorType)); + this.maxStackSize = 1; + this.setCreativeTab(CreativeTabs.tabCombat); + BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserBehavior); + } + + public int getColorFromItemStack(ItemStack stack, int renderPass) + { + if (renderPass > 0) + { + return 16777215; + } + else + { + int i = this.getColor(stack); + + if (i < 0) + { + i = 16777215; + } + + return i; + } + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return this.material.getEnchantability(); + } + + /** + * Return the armor material for this armor item. + */ + public ItemArmor.ArmorMaterial getArmorMaterial() + { + return this.material; + } + + /** + * Return whether the specified armor ItemStack has a color. + */ + public boolean hasColor(ItemStack stack) + { + return this.material != ItemArmor.ArmorMaterial.LEATHER ? false : (!stack.hasTagCompound() ? false : (!stack.getTagCompound().hasKey("display", 10) ? false : stack.getTagCompound().getCompoundTag("display").hasKey("color", 3))); + } + + /** + * Return the color for the specified armor ItemStack. + */ + public int getColor(ItemStack stack) + { + if (this.material != ItemArmor.ArmorMaterial.LEATHER) + { + return -1; + } + else + { + NBTTagCompound nbttagcompound = stack.getTagCompound(); + + if (nbttagcompound != null) + { + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); + + if (nbttagcompound1 != null && nbttagcompound1.hasKey("color", 3)) + { + return nbttagcompound1.getInteger("color"); + } + } + + return 10511680; + } + } + + /** + * Remove the color from the specified armor ItemStack. + */ + public void removeColor(ItemStack stack) + { + if (this.material == ItemArmor.ArmorMaterial.LEATHER) + { + NBTTagCompound nbttagcompound = stack.getTagCompound(); + + if (nbttagcompound != null) + { + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); + + if (nbttagcompound1.hasKey("color")) + { + nbttagcompound1.removeTag("color"); + } + } + } + } + + /** + * Sets the color of the specified armor ItemStack + */ + public void setColor(ItemStack stack, int color) + { + if (this.material != ItemArmor.ArmorMaterial.LEATHER) + { + throw new UnsupportedOperationException("Can\'t dye non-leather!"); + } + else + { + NBTTagCompound nbttagcompound = stack.getTagCompound(); + + if (nbttagcompound == null) + { + nbttagcompound = new NBTTagCompound(); + stack.setTagCompound(nbttagcompound); + } + + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display"); + + if (!nbttagcompound.hasKey("display", 10)) + { + nbttagcompound.setTag("display", nbttagcompound1); + } + + nbttagcompound1.setInteger("color", color); + } + } + + /** + * Return whether this item is repairable in an anvil. + */ + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) + { + return this.material.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + int i = EntityLiving.getArmorPosition(itemStackIn) - 1; + ItemStack itemstack = playerIn.getCurrentArmor(i); + + if (itemstack == null) + { + playerIn.setCurrentItemOrArmor(i, itemStackIn.copy()); + itemStackIn.stackSize = 0; + } + + return itemStackIn; + } + + public static enum ArmorMaterial + { + LEATHER("leather", 5, new int[]{1, 3, 2, 1}, 15), + CHAIN("chainmail", 15, new int[]{2, 5, 4, 1}, 12), + IRON("iron", 15, new int[]{2, 6, 5, 2}, 9), + GOLD("gold", 7, new int[]{2, 5, 3, 1}, 25), + DIAMOND("diamond", 33, new int[]{3, 8, 6, 3}, 10); + + private final String name; + private final int maxDamageFactor; + private final int[] damageReductionAmountArray; + private final int enchantability; + + private ArmorMaterial(String name, int maxDamage, int[] reductionAmounts, int enchantability) + { + this.name = name; + this.maxDamageFactor = maxDamage; + this.damageReductionAmountArray = reductionAmounts; + this.enchantability = enchantability; + } + + public int getDurability(int armorType) + { + return ItemArmor.maxDamageArray[armorType] * this.maxDamageFactor; + } + + public int getDamageReductionAmount(int armorType) + { + return this.damageReductionAmountArray[armorType]; + } + + public int getEnchantability() + { + return this.enchantability; + } + + public Item getRepairItem() + { + return this == LEATHER ? Items.leather : (this == CHAIN ? Items.iron_ingot : (this == GOLD ? Items.gold_ingot : (this == IRON ? Items.iron_ingot : (this == DIAMOND ? Items.diamond : null)))); + } + + public String getName() + { + return this.name; + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemArmorStand.java b/src/minecraft/net/minecraft/item/ItemArmorStand.java new file mode 100644 index 0000000..f0f6413 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemArmorStand.java @@ -0,0 +1,106 @@ +package net.minecraft.item; + +import java.util.List; +import java.util.Random; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Rotations; +import net.minecraft.world.World; + +public class ItemArmorStand extends Item +{ + public ItemArmorStand() + { + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (side == EnumFacing.DOWN) + { + return false; + } + else + { + boolean flag = worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos); + BlockPos blockpos = flag ? pos : pos.offset(side); + + if (!playerIn.canPlayerEdit(blockpos, side, stack)) + { + return false; + } + else + { + BlockPos blockpos1 = blockpos.up(); + boolean flag1 = !worldIn.isAirBlock(blockpos) && !worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos); + flag1 = flag1 | (!worldIn.isAirBlock(blockpos1) && !worldIn.getBlockState(blockpos1).getBlock().isReplaceable(worldIn, blockpos1)); + + if (flag1) + { + return false; + } + else + { + double d0 = (double)blockpos.getX(); + double d1 = (double)blockpos.getY(); + double d2 = (double)blockpos.getZ(); + List list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.fromBounds(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D)); + + if (list.size() > 0) + { + return false; + } + else + { + if (!worldIn.isRemote) + { + worldIn.setBlockToAir(blockpos); + worldIn.setBlockToAir(blockpos1); + EntityArmorStand entityarmorstand = new EntityArmorStand(worldIn, d0 + 0.5D, d1, d2 + 0.5D); + float f = (float)MathHelper.floor_float((MathHelper.wrapAngleTo180_float(playerIn.rotationYaw - 180.0F) + 22.5F) / 45.0F) * 45.0F; + entityarmorstand.setLocationAndAngles(d0 + 0.5D, d1, d2 + 0.5D, f, 0.0F); + this.applyRandomRotations(entityarmorstand, worldIn.rand); + NBTTagCompound nbttagcompound = stack.getTagCompound(); + + if (nbttagcompound != null && nbttagcompound.hasKey("EntityTag", 10)) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + entityarmorstand.writeToNBTOptional(nbttagcompound1); + nbttagcompound1.merge(nbttagcompound.getCompoundTag("EntityTag")); + entityarmorstand.readFromNBT(nbttagcompound1); + } + + worldIn.spawnEntityInWorld(entityarmorstand); + } + + --stack.stackSize; + return true; + } + } + } + } + } + + private void applyRandomRotations(EntityArmorStand armorStand, Random rand) + { + Rotations rotations = armorStand.getHeadRotation(); + float f = rand.nextFloat() * 5.0F; + float f1 = rand.nextFloat() * 20.0F - 10.0F; + Rotations rotations1 = new Rotations(rotations.getX() + f, rotations.getY() + f1, rotations.getZ()); + armorStand.setHeadRotation(rotations1); + rotations = armorStand.getBodyRotation(); + f = rand.nextFloat() * 10.0F - 5.0F; + rotations1 = new Rotations(rotations.getX(), rotations.getY() + f, rotations.getZ()); + armorStand.setBodyRotation(rotations1); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemAxe.java b/src/minecraft/net/minecraft/item/ItemAxe.java new file mode 100644 index 0000000..ece0ad9 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemAxe.java @@ -0,0 +1,22 @@ +package net.minecraft.item; + +import com.google.common.collect.Sets; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; + +public class ItemAxe extends ItemTool +{ + private static final Set EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2, Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin, Blocks.melon_block, Blocks.ladder}); + + protected ItemAxe(Item.ToolMaterial material) + { + super(3.0F, material, EFFECTIVE_ON); + } + + public float getStrVsBlock(ItemStack stack, Block block) + { + return block.getMaterial() != Material.wood && block.getMaterial() != Material.plants && block.getMaterial() != Material.vine ? super.getStrVsBlock(stack, block) : this.efficiencyOnProperMaterial; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemBanner.java b/src/minecraft/net/minecraft/item/ItemBanner.java new file mode 100644 index 0000000..dc3e26a --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemBanner.java @@ -0,0 +1,171 @@ +package net.minecraft.item; + +import java.util.List; +import net.minecraft.block.BlockStandingSign; +import net.minecraft.block.BlockWallSign; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityBanner; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class ItemBanner extends ItemBlock +{ + public ItemBanner() + { + super(Blocks.standing_banner); + this.maxStackSize = 16; + this.setCreativeTab(CreativeTabs.tabDecorations); + this.setHasSubtypes(true); + this.setMaxDamage(0); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (side == EnumFacing.DOWN) + { + return false; + } + else if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid()) + { + return false; + } + else + { + pos = pos.offset(side); + + if (!playerIn.canPlayerEdit(pos, side, stack)) + { + return false; + } + else if (!Blocks.standing_banner.canPlaceBlockAt(worldIn, pos)) + { + return false; + } + else if (worldIn.isRemote) + { + return true; + } + else + { + if (side == EnumFacing.UP) + { + int i = MathHelper.floor_double((double)((playerIn.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15; + worldIn.setBlockState(pos, Blocks.standing_banner.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3); + } + else + { + worldIn.setBlockState(pos, Blocks.wall_banner.getDefaultState().withProperty(BlockWallSign.FACING, side), 3); + } + + --stack.stackSize; + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityBanner) + { + ((TileEntityBanner)tileentity).setItemValues(stack); + } + + return true; + } + } + } + + public String getItemStackDisplayName(ItemStack stack) + { + String s = "item.banner."; + EnumDyeColor enumdyecolor = this.getBaseColor(stack); + s = s + enumdyecolor.getUnlocalizedName() + ".name"; + return StatCollector.translateToLocal(s); + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) + { + NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false); + + if (nbttagcompound != null && nbttagcompound.hasKey("Patterns")) + { + NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10); + + for (int i = 0; i < nbttaglist.tagCount() && i < 6; ++i) + { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(nbttagcompound1.getInteger("Color")); + TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound1.getString("Pattern")); + + if (tileentitybanner$enumbannerpattern != null) + { + tooltip.add(StatCollector.translateToLocal("item.banner." + tileentitybanner$enumbannerpattern.getPatternName() + "." + enumdyecolor.getUnlocalizedName())); + } + } + } + } + + public int getColorFromItemStack(ItemStack stack, int renderPass) + { + if (renderPass == 0) + { + return 16777215; + } + else + { + EnumDyeColor enumdyecolor = this.getBaseColor(stack); + return enumdyecolor.getMapColor().colorValue; + } + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) + { + for (EnumDyeColor enumdyecolor : EnumDyeColor.values()) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + TileEntityBanner.func_181020_a(nbttagcompound, enumdyecolor.getDyeDamage(), (NBTTagList)null); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setTag("BlockEntityTag", nbttagcompound); + ItemStack itemstack = new ItemStack(itemIn, 1, enumdyecolor.getDyeDamage()); + itemstack.setTagCompound(nbttagcompound1); + subItems.add(itemstack); + } + } + + /** + * gets the CreativeTab this item is displayed on + */ + public CreativeTabs getCreativeTab() + { + return CreativeTabs.tabDecorations; + } + + private EnumDyeColor getBaseColor(ItemStack stack) + { + NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false); + EnumDyeColor enumdyecolor = null; + + if (nbttagcompound != null && nbttagcompound.hasKey("Base")) + { + enumdyecolor = EnumDyeColor.byDyeDamage(nbttagcompound.getInteger("Base")); + } + else + { + enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata()); + } + + return enumdyecolor; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemBed.java b/src/minecraft/net/minecraft/item/ItemBed.java new file mode 100644 index 0000000..7331467 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemBed.java @@ -0,0 +1,79 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class ItemBed extends Item +{ + public ItemBed() + { + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else if (side != EnumFacing.UP) + { + return false; + } + else + { + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + boolean flag = block.isReplaceable(worldIn, pos); + + if (!flag) + { + pos = pos.up(); + } + + int i = MathHelper.floor_double((double)(playerIn.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + EnumFacing enumfacing = EnumFacing.getHorizontal(i); + BlockPos blockpos = pos.offset(enumfacing); + + if (playerIn.canPlayerEdit(pos, side, stack) && playerIn.canPlayerEdit(blockpos, side, stack)) + { + boolean flag1 = worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos); + boolean flag2 = flag || worldIn.isAirBlock(pos); + boolean flag3 = flag1 || worldIn.isAirBlock(blockpos); + + if (flag2 && flag3 && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && World.doesBlockHaveSolidTopSurface(worldIn, blockpos.down())) + { + IBlockState iblockstate1 = Blocks.bed.getDefaultState().withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)).withProperty(BlockBed.FACING, enumfacing).withProperty(BlockBed.PART, BlockBed.EnumPartType.FOOT); + + if (worldIn.setBlockState(pos, iblockstate1, 3)) + { + IBlockState iblockstate2 = iblockstate1.withProperty(BlockBed.PART, BlockBed.EnumPartType.HEAD); + worldIn.setBlockState(blockpos, iblockstate2, 3); + } + + --stack.stackSize; + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemBlock.java b/src/minecraft/net/minecraft/item/ItemBlock.java new file mode 100644 index 0000000..fc01772 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemBlock.java @@ -0,0 +1,179 @@ +package net.minecraft.item; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemBlock extends Item +{ + protected final Block block; + + public ItemBlock(Block block) + { + this.block = block; + } + + /** + * Sets the unlocalized name of this item to the string passed as the parameter, prefixed by "item." + */ + public ItemBlock setUnlocalizedName(String unlocalizedName) + { + super.setUnlocalizedName(unlocalizedName); + return this; + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if (!block.isReplaceable(worldIn, pos)) + { + pos = pos.offset(side); + } + + if (stack.stackSize == 0) + { + return false; + } + else if (!playerIn.canPlayerEdit(pos, side, stack)) + { + return false; + } + else if (worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack)) + { + int i = this.getMetadata(stack.getMetadata()); + IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, i, playerIn); + + if (worldIn.setBlockState(pos, iblockstate1, 3)) + { + iblockstate1 = worldIn.getBlockState(pos); + + if (iblockstate1.getBlock() == this.block) + { + setTileEntityNBT(worldIn, playerIn, pos, stack); + this.block.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); + } + + worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); + --stack.stackSize; + } + + return true; + } + else + { + return false; + } + } + + public static boolean setTileEntityNBT(World worldIn, EntityPlayer pos, BlockPos stack, ItemStack p_179224_3_) + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + + if (minecraftserver == null) + { + return false; + } + else + { + if (p_179224_3_.hasTagCompound() && p_179224_3_.getTagCompound().hasKey("BlockEntityTag", 10)) + { + TileEntity tileentity = worldIn.getTileEntity(stack); + + if (tileentity != null) + { + if (!worldIn.isRemote && tileentity.func_183000_F() && !minecraftserver.getConfigurationManager().canSendCommands(pos.getGameProfile())) + { + return false; + } + + NBTTagCompound nbttagcompound = new NBTTagCompound(); + NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttagcompound.copy(); + tileentity.writeToNBT(nbttagcompound); + NBTTagCompound nbttagcompound2 = (NBTTagCompound)p_179224_3_.getTagCompound().getTag("BlockEntityTag"); + nbttagcompound.merge(nbttagcompound2); + nbttagcompound.setInteger("x", stack.getX()); + nbttagcompound.setInteger("y", stack.getY()); + nbttagcompound.setInteger("z", stack.getZ()); + + if (!nbttagcompound.equals(nbttagcompound1)) + { + tileentity.readFromNBT(nbttagcompound); + tileentity.markDirty(); + return true; + } + } + } + + return false; + } + } + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) + { + Block block = worldIn.getBlockState(pos).getBlock(); + + if (block == Blocks.snow_layer) + { + side = EnumFacing.UP; + } + else if (!block.isReplaceable(worldIn, pos)) + { + pos = pos.offset(side); + } + + return worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack); + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack stack) + { + return this.block.getUnlocalizedName(); + } + + /** + * Returns the unlocalized name of this item. + */ + public String getUnlocalizedName() + { + return this.block.getUnlocalizedName(); + } + + /** + * gets the CreativeTab this item is displayed on + */ + public CreativeTabs getCreativeTab() + { + return this.block.getCreativeTabToDisplayOn(); + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) + { + this.block.getSubBlocks(itemIn, tab, subItems); + } + + public Block getBlock() + { + return this.block; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemBoat.java b/src/minecraft/net/minecraft/item/ItemBoat.java new file mode 100644 index 0000000..6af2dab --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemBoat.java @@ -0,0 +1,114 @@ +package net.minecraft.item; + +import java.util.List; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.stats.StatList; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class ItemBoat extends Item +{ + public ItemBoat() + { + this.maxStackSize = 1; + this.setCreativeTab(CreativeTabs.tabTransport); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + float f = 1.0F; + float f1 = playerIn.prevRotationPitch + (playerIn.rotationPitch - playerIn.prevRotationPitch) * f; + float f2 = playerIn.prevRotationYaw + (playerIn.rotationYaw - playerIn.prevRotationYaw) * f; + double d0 = playerIn.prevPosX + (playerIn.posX - playerIn.prevPosX) * (double)f; + double d1 = playerIn.prevPosY + (playerIn.posY - playerIn.prevPosY) * (double)f + (double)playerIn.getEyeHeight(); + double d2 = playerIn.prevPosZ + (playerIn.posZ - playerIn.prevPosZ) * (double)f; + Vec3 vec3 = new Vec3(d0, d1, d2); + float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI); + float f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.017453292F); + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; + double d3 = 5.0D; + Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); + MovingObjectPosition movingobjectposition = worldIn.rayTraceBlocks(vec3, vec31, true); + + if (movingobjectposition == null) + { + return itemStackIn; + } + else + { + Vec3 vec32 = playerIn.getLook(f); + boolean flag = false; + float f9 = 1.0F; + List list = worldIn.getEntitiesWithinAABBExcludingEntity(playerIn, playerIn.getEntityBoundingBox().addCoord(vec32.xCoord * d3, vec32.yCoord * d3, vec32.zCoord * d3).expand((double)f9, (double)f9, (double)f9)); + + for (int i = 0; i < list.size(); ++i) + { + Entity entity = (Entity)list.get(i); + + if (entity.canBeCollidedWith()) + { + float f10 = entity.getCollisionBorderSize(); + AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().expand((double)f10, (double)f10, (double)f10); + + if (axisalignedbb.isVecInside(vec3)) + { + flag = true; + } + } + } + + if (flag) + { + return itemStackIn; + } + else + { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = movingobjectposition.getBlockPos(); + + if (worldIn.getBlockState(blockpos).getBlock() == Blocks.snow_layer) + { + blockpos = blockpos.down(); + } + + EntityBoat entityboat = new EntityBoat(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 1.0F), (double)((float)blockpos.getZ() + 0.5F)); + entityboat.rotationYaw = (float)(((MathHelper.floor_double((double)(playerIn.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) - 1) * 90); + + if (!worldIn.getCollidingBoundingBoxes(entityboat, entityboat.getEntityBoundingBox().expand(-0.1D, -0.1D, -0.1D)).isEmpty()) + { + return itemStackIn; + } + + if (!worldIn.isRemote) + { + worldIn.spawnEntityInWorld(entityboat); + } + + if (!playerIn.capabilities.isCreativeMode) + { + --itemStackIn.stackSize; + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + } + + return itemStackIn; + } + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemBook.java b/src/minecraft/net/minecraft/item/ItemBook.java new file mode 100644 index 0000000..63e527f --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemBook.java @@ -0,0 +1,20 @@ +package net.minecraft.item; + +public class ItemBook extends Item +{ + /** + * Checks isDamagable and if it cannot be stacked + */ + public boolean isItemTool(ItemStack stack) + { + return stack.stackSize == 1; + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return 1; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemBow.java b/src/minecraft/net/minecraft/item/ItemBow.java new file mode 100644 index 0000000..c7bdd94 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemBow.java @@ -0,0 +1,138 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.init.Items; +import net.minecraft.stats.StatList; +import net.minecraft.world.World; + +public class ItemBow extends Item +{ + public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"}; + + public ItemBow() + { + this.maxStackSize = 1; + this.setMaxDamage(384); + this.setCreativeTab(CreativeTabs.tabCombat); + } + + /** + * Called when the player stops using an Item (stops holding the right mouse button). + */ + public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft) + { + boolean flag = playerIn.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; + + if (flag || playerIn.inventory.hasItem(Items.arrow)) + { + int i = this.getMaxItemUseDuration(stack) - timeLeft; + float f = (float)i / 20.0F; + f = (f * f + f * 2.0F) / 3.0F; + + if ((double)f < 0.1D) + { + return; + } + + if (f > 1.0F) + { + f = 1.0F; + } + + EntityArrow entityarrow = new EntityArrow(worldIn, playerIn, f * 2.0F); + + if (f == 1.0F) + { + entityarrow.setIsCritical(true); + } + + int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack); + + if (j > 0) + { + entityarrow.setDamage(entityarrow.getDamage() + (double)j * 0.5D + 0.5D); + } + + int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack); + + if (k > 0) + { + entityarrow.setKnockbackStrength(k); + } + + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0) + { + entityarrow.setFire(100); + } + + stack.damageItem(1, playerIn); + worldIn.playSoundAtEntity(playerIn, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); + + if (flag) + { + entityarrow.canBePickedUp = 2; + } + else + { + playerIn.inventory.consumeInventoryItem(Items.arrow); + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + + if (!worldIn.isRemote) + { + worldIn.spawnEntityInWorld(entityarrow); + } + } + } + + /** + * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using + * the Item before the action is complete. + */ + public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn) + { + return stack; + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack stack) + { + return 72000; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack stack) + { + return EnumAction.BOW; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + if (playerIn.capabilities.isCreativeMode || playerIn.inventory.hasItem(Items.arrow)) + { + playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); + } + + return itemStackIn; + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return 1; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemBucket.java b/src/minecraft/net/minecraft/item/ItemBucket.java new file mode 100644 index 0000000..372e03b --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemBucket.java @@ -0,0 +1,166 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.stats.StatList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class ItemBucket extends Item +{ + /** field for checking if the bucket has been filled. */ + private Block isFull; + + public ItemBucket(Block containedBlock) + { + this.maxStackSize = 1; + this.isFull = containedBlock; + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + boolean flag = this.isFull == Blocks.air; + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, flag); + + if (movingobjectposition == null) + { + return itemStackIn; + } + else + { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = movingobjectposition.getBlockPos(); + + if (!worldIn.isBlockModifiable(playerIn, blockpos)) + { + return itemStackIn; + } + + if (flag) + { + if (!playerIn.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, itemStackIn)) + { + return itemStackIn; + } + + IBlockState iblockstate = worldIn.getBlockState(blockpos); + Material material = iblockstate.getBlock().getMaterial(); + + if (material == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0) + { + worldIn.setBlockToAir(blockpos); + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return this.fillBucket(itemStackIn, playerIn, Items.water_bucket); + } + + if (material == Material.lava && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0) + { + worldIn.setBlockToAir(blockpos); + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return this.fillBucket(itemStackIn, playerIn, Items.lava_bucket); + } + } + else + { + if (this.isFull == Blocks.air) + { + return new ItemStack(Items.bucket); + } + + BlockPos blockpos1 = blockpos.offset(movingobjectposition.sideHit); + + if (!playerIn.canPlayerEdit(blockpos1, movingobjectposition.sideHit, itemStackIn)) + { + return itemStackIn; + } + + if (this.tryPlaceContainedLiquid(worldIn, blockpos1) && !playerIn.capabilities.isCreativeMode) + { + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return new ItemStack(Items.bucket); + } + } + } + + return itemStackIn; + } + } + + private ItemStack fillBucket(ItemStack emptyBuckets, EntityPlayer player, Item fullBucket) + { + if (player.capabilities.isCreativeMode) + { + return emptyBuckets; + } + else if (--emptyBuckets.stackSize <= 0) + { + return new ItemStack(fullBucket); + } + else + { + if (!player.inventory.addItemStackToInventory(new ItemStack(fullBucket))) + { + player.dropPlayerItemWithRandomChoice(new ItemStack(fullBucket, 1, 0), false); + } + + return emptyBuckets; + } + } + + public boolean tryPlaceContainedLiquid(World worldIn, BlockPos pos) + { + if (this.isFull == Blocks.air) + { + return false; + } + else + { + Material material = worldIn.getBlockState(pos).getBlock().getMaterial(); + boolean flag = !material.isSolid(); + + if (!worldIn.isAirBlock(pos) && !flag) + { + return false; + } + else + { + if (worldIn.provider.doesWaterVaporize() && this.isFull == Blocks.flowing_water) + { + int i = pos.getX(); + int j = pos.getY(); + int k = pos.getZ(); + worldIn.playSoundEffect((double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F), "random.fizz", 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F); + + for (int l = 0; l < 8; ++l) + { + worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)i + Math.random(), (double)j + Math.random(), (double)k + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]); + } + } + else + { + if (!worldIn.isRemote && flag && !material.isLiquid()) + { + worldIn.destroyBlock(pos, true); + } + + worldIn.setBlockState(pos, this.isFull.getDefaultState(), 3); + } + + return true; + } + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemBucketMilk.java b/src/minecraft/net/minecraft/item/ItemBucketMilk.java new file mode 100644 index 0000000..2fa347f --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemBucketMilk.java @@ -0,0 +1,61 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.stats.StatList; +import net.minecraft.world.World; + +public class ItemBucketMilk extends Item +{ + public ItemBucketMilk() + { + this.setMaxStackSize(1); + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using + * the Item before the action is complete. + */ + public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn) + { + if (!playerIn.capabilities.isCreativeMode) + { + --stack.stackSize; + } + + if (!worldIn.isRemote) + { + playerIn.clearActivePotions(); + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return stack.stackSize <= 0 ? new ItemStack(Items.bucket) : stack; + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack stack) + { + return 32; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack stack) + { + return EnumAction.DRINK; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); + return itemStackIn; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemCarrotOnAStick.java b/src/minecraft/net/minecraft/item/ItemCarrotOnAStick.java new file mode 100644 index 0000000..069a7c9 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemCarrotOnAStick.java @@ -0,0 +1,62 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.stats.StatList; +import net.minecraft.world.World; + +public class ItemCarrotOnAStick extends Item +{ + public ItemCarrotOnAStick() + { + this.setCreativeTab(CreativeTabs.tabTransport); + this.setMaxStackSize(1); + this.setMaxDamage(25); + } + + /** + * Returns True is the item is renderer in full 3D when hold. + */ + public boolean isFull3D() + { + return true; + } + + /** + * Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities + * hands. + */ + public boolean shouldRotateAroundWhenRendering() + { + return true; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + if (playerIn.isRiding() && playerIn.ridingEntity instanceof EntityPig) + { + EntityPig entitypig = (EntityPig)playerIn.ridingEntity; + + if (entitypig.getAIControlledByPlayer().isControlledByPlayer() && itemStackIn.getMaxDamage() - itemStackIn.getMetadata() >= 7) + { + entitypig.getAIControlledByPlayer().boostSpeed(); + itemStackIn.damageItem(7, playerIn); + + if (itemStackIn.stackSize == 0) + { + ItemStack itemstack = new ItemStack(Items.fishing_rod); + itemstack.setTagCompound(itemStackIn.getTagCompound()); + return itemstack; + } + } + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return itemStackIn; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemCloth.java b/src/minecraft/net/minecraft/item/ItemCloth.java new file mode 100644 index 0000000..fbe4b8e --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemCloth.java @@ -0,0 +1,31 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; + +public class ItemCloth extends ItemBlock +{ + public ItemCloth(Block block) + { + super(block); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + /** + * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is + * placed as a Block (mostly used with ItemBlocks). + */ + public int getMetadata(int damage) + { + return damage; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack stack) + { + return super.getUnlocalizedName() + "." + EnumDyeColor.byMetadata(stack.getMetadata()).getUnlocalizedName(); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemCoal.java b/src/minecraft/net/minecraft/item/ItemCoal.java new file mode 100644 index 0000000..4c5f4f7 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemCoal.java @@ -0,0 +1,32 @@ +package net.minecraft.item; + +import java.util.List; +import net.minecraft.creativetab.CreativeTabs; + +public class ItemCoal extends Item +{ + public ItemCoal() + { + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setCreativeTab(CreativeTabs.tabMaterials); + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack stack) + { + return stack.getMetadata() == 1 ? "item.charcoal" : "item.coal"; + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) + { + subItems.add(new ItemStack(itemIn, 1, 0)); + subItems.add(new ItemStack(itemIn, 1, 1)); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemColored.java b/src/minecraft/net/minecraft/item/ItemColored.java new file mode 100644 index 0000000..c5f05f4 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemColored.java @@ -0,0 +1,58 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; + +public class ItemColored extends ItemBlock +{ + private final Block coloredBlock; + private String[] subtypeNames; + + public ItemColored(Block block, boolean hasSubtypes) + { + super(block); + this.coloredBlock = block; + + if (hasSubtypes) + { + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + } + + public int getColorFromItemStack(ItemStack stack, int renderPass) + { + return this.coloredBlock.getRenderColor(this.coloredBlock.getStateFromMeta(stack.getMetadata())); + } + + /** + * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is + * placed as a Block (mostly used with ItemBlocks). + */ + public int getMetadata(int damage) + { + return damage; + } + + public ItemColored setSubtypeNames(String[] names) + { + this.subtypeNames = names; + return this; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack stack) + { + if (this.subtypeNames == null) + { + return super.getUnlocalizedName(stack); + } + else + { + int i = stack.getMetadata(); + return i >= 0 && i < this.subtypeNames.length ? super.getUnlocalizedName(stack) + "." + this.subtypeNames[i] : super.getUnlocalizedName(stack); + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemDoor.java b/src/minecraft/net/minecraft/item/ItemDoor.java new file mode 100644 index 0000000..9519078 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemDoor.java @@ -0,0 +1,80 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemDoor extends Item +{ + private Block block; + + public ItemDoor(Block block) + { + this.block = block; + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (side != EnumFacing.UP) + { + return false; + } + else + { + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if (!block.isReplaceable(worldIn, pos)) + { + pos = pos.offset(side); + } + + if (!playerIn.canPlayerEdit(pos, side, stack)) + { + return false; + } + else if (!this.block.canPlaceBlockAt(worldIn, pos)) + { + return false; + } + else + { + placeDoor(worldIn, pos, EnumFacing.fromAngle((double)playerIn.rotationYaw), this.block); + --stack.stackSize; + return true; + } + } + } + + public static void placeDoor(World worldIn, BlockPos pos, EnumFacing facing, Block door) + { + BlockPos blockpos = pos.offset(facing.rotateY()); + BlockPos blockpos1 = pos.offset(facing.rotateYCCW()); + int i = (worldIn.getBlockState(blockpos1).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getBlockState(blockpos1.up()).getBlock().isNormalCube() ? 1 : 0); + int j = (worldIn.getBlockState(blockpos).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getBlockState(blockpos.up()).getBlock().isNormalCube() ? 1 : 0); + boolean flag = worldIn.getBlockState(blockpos1).getBlock() == door || worldIn.getBlockState(blockpos1.up()).getBlock() == door; + boolean flag1 = worldIn.getBlockState(blockpos).getBlock() == door || worldIn.getBlockState(blockpos.up()).getBlock() == door; + boolean flag2 = false; + + if (flag && !flag1 || j > i) + { + flag2 = true; + } + + BlockPos blockpos2 = pos.up(); + IBlockState iblockstate = door.getDefaultState().withProperty(BlockDoor.FACING, facing).withProperty(BlockDoor.HINGE, flag2 ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT); + worldIn.setBlockState(pos, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2); + worldIn.setBlockState(blockpos2, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2); + worldIn.notifyNeighborsOfStateChange(pos, door); + worldIn.notifyNeighborsOfStateChange(blockpos2, door); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemDoublePlant.java b/src/minecraft/net/minecraft/item/ItemDoublePlant.java new file mode 100644 index 0000000..502bf77 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemDoublePlant.java @@ -0,0 +1,20 @@ +package net.minecraft.item; + +import com.google.common.base.Function; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.world.ColorizerGrass; + +public class ItemDoublePlant extends ItemMultiTexture +{ + public ItemDoublePlant(Block block, Block block2, Function nameFunction) + { + super(block, block2, nameFunction); + } + + public int getColorFromItemStack(ItemStack stack, int renderPass) + { + BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = BlockDoublePlant.EnumPlantType.byMetadata(stack.getMetadata()); + return blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN ? super.getColorFromItemStack(stack, renderPass) : ColorizerGrass.getGrassColor(0.5D, 1.0D); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemDye.java b/src/minecraft/net/minecraft/item/ItemDye.java new file mode 100644 index 0000000..370dd16 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemDye.java @@ -0,0 +1,187 @@ +package net.minecraft.item; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.IGrowable; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.world.World; + +public class ItemDye extends Item +{ + public static final int[] dyeColors = new int[] {1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320}; + + public ItemDye() + { + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setCreativeTab(CreativeTabs.tabMaterials); + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack stack) + { + int i = stack.getMetadata(); + return super.getUnlocalizedName() + "." + EnumDyeColor.byDyeDamage(i).getUnlocalizedName(); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) + { + return false; + } + else + { + EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata()); + + if (enumdyecolor == EnumDyeColor.WHITE) + { + if (applyBonemeal(stack, worldIn, pos)) + { + if (!worldIn.isRemote) + { + worldIn.playAuxSFX(2005, pos, 0); + } + + return true; + } + } + else if (enumdyecolor == EnumDyeColor.BROWN) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if (block == Blocks.log && iblockstate.getValue(BlockPlanks.VARIANT) == BlockPlanks.EnumType.JUNGLE) + { + if (side == EnumFacing.DOWN) + { + return false; + } + + if (side == EnumFacing.UP) + { + return false; + } + + pos = pos.offset(side); + + if (worldIn.isAirBlock(pos)) + { + IBlockState iblockstate1 = Blocks.cocoa.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, 0, playerIn); + worldIn.setBlockState(pos, iblockstate1, 2); + + if (!playerIn.capabilities.isCreativeMode) + { + --stack.stackSize; + } + } + + return true; + } + } + + return false; + } + } + + public static boolean applyBonemeal(ItemStack stack, World worldIn, BlockPos target) + { + IBlockState iblockstate = worldIn.getBlockState(target); + + if (iblockstate.getBlock() instanceof IGrowable) + { + IGrowable igrowable = (IGrowable)iblockstate.getBlock(); + + if (igrowable.canGrow(worldIn, target, iblockstate, worldIn.isRemote)) + { + if (!worldIn.isRemote) + { + if (igrowable.canUseBonemeal(worldIn, worldIn.rand, target, iblockstate)) + { + igrowable.grow(worldIn, worldIn.rand, target, iblockstate); + } + + --stack.stackSize; + } + + return true; + } + } + + return false; + } + + public static void spawnBonemealParticles(World worldIn, BlockPos pos, int amount) + { + if (amount == 0) + { + amount = 15; + } + + Block block = worldIn.getBlockState(pos).getBlock(); + + if (block.getMaterial() != Material.air) + { + block.setBlockBoundsBasedOnState(worldIn, pos); + + for (int i = 0; i < amount; ++i) + { + double d0 = itemRand.nextGaussian() * 0.02D; + double d1 = itemRand.nextGaussian() * 0.02D; + double d2 = itemRand.nextGaussian() * 0.02D; + worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]); + } + } + } + + /** + * Returns true if the item can be used on the given entity, e.g. shears on sheep. + */ + public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) + { + if (target instanceof EntitySheep) + { + EntitySheep entitysheep = (EntitySheep)target; + EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata()); + + if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor) + { + entitysheep.setFleeceColor(enumdyecolor); + --stack.stackSize; + } + + return true; + } + else + { + return false; + } + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) + { + for (int i = 0; i < 16; ++i) + { + subItems.add(new ItemStack(itemIn, 1, i)); + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemEditableBook.java b/src/minecraft/net/minecraft/item/ItemEditableBook.java new file mode 100644 index 0000000..4e92f48 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemEditableBook.java @@ -0,0 +1,150 @@ +package net.minecraft.item; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.inventory.Slot; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.network.play.server.S2FPacketSetSlot; +import net.minecraft.stats.StatList; +import net.minecraft.util.ChatComponentProcessor; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.StatCollector; +import net.minecraft.util.StringUtils; +import net.minecraft.world.World; + +public class ItemEditableBook extends Item +{ + public ItemEditableBook() + { + this.setMaxStackSize(1); + } + + public static boolean validBookTagContents(NBTTagCompound nbt) + { + if (!ItemWritableBook.isNBTValid(nbt)) + { + return false; + } + else if (!nbt.hasKey("title", 8)) + { + return false; + } + else + { + String s = nbt.getString("title"); + return s != null && s.length() <= 32 ? nbt.hasKey("author", 8) : false; + } + } + + /** + * Gets the generation of the book (how many times it has been cloned) + */ + public static int getGeneration(ItemStack book) + { + return book.getTagCompound().getInteger("generation"); + } + + public String getItemStackDisplayName(ItemStack stack) + { + if (stack.hasTagCompound()) + { + NBTTagCompound nbttagcompound = stack.getTagCompound(); + String s = nbttagcompound.getString("title"); + + if (!StringUtils.isNullOrEmpty(s)) + { + return s; + } + } + + return super.getItemStackDisplayName(stack); + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) + { + if (stack.hasTagCompound()) + { + NBTTagCompound nbttagcompound = stack.getTagCompound(); + String s = nbttagcompound.getString("author"); + + if (!StringUtils.isNullOrEmpty(s)) + { + tooltip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocalFormatted("book.byAuthor", new Object[] {s})); + } + + tooltip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("book.generation." + nbttagcompound.getInteger("generation"))); + } + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + if (!worldIn.isRemote) + { + this.resolveContents(itemStackIn, playerIn); + } + + playerIn.displayGUIBook(itemStackIn); + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return itemStackIn; + } + + private void resolveContents(ItemStack stack, EntityPlayer player) + { + if (stack != null && stack.getTagCompound() != null) + { + NBTTagCompound nbttagcompound = stack.getTagCompound(); + + if (!nbttagcompound.getBoolean("resolved")) + { + nbttagcompound.setBoolean("resolved", true); + + if (validBookTagContents(nbttagcompound)) + { + NBTTagList nbttaglist = nbttagcompound.getTagList("pages", 8); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + String s = nbttaglist.getStringTagAt(i); + IChatComponent lvt_7_1_; + + try + { + lvt_7_1_ = IChatComponent.Serializer.jsonToComponent(s); + lvt_7_1_ = ChatComponentProcessor.processComponent(player, lvt_7_1_, player); + } + catch (Exception var9) + { + lvt_7_1_ = new ChatComponentText(s); + } + + nbttaglist.set(i, new NBTTagString(IChatComponent.Serializer.componentToJson(lvt_7_1_))); + } + + nbttagcompound.setTag("pages", nbttaglist); + + if (player instanceof EntityPlayerMP && player.getCurrentEquippedItem() == stack) + { + Slot slot = player.openContainer.getSlotFromInventory(player.inventory, player.inventory.currentItem); + ((EntityPlayerMP)player).playerNetServerHandler.sendPacket(new S2FPacketSetSlot(0, slot.slotNumber, stack)); + } + } + } + } + } + + public boolean hasEffect(ItemStack stack) + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemEgg.java b/src/minecraft/net/minecraft/item/ItemEgg.java new file mode 100644 index 0000000..32995db --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemEgg.java @@ -0,0 +1,37 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityEgg; +import net.minecraft.stats.StatList; +import net.minecraft.world.World; + +public class ItemEgg extends Item +{ + public ItemEgg() + { + this.maxStackSize = 16; + this.setCreativeTab(CreativeTabs.tabMaterials); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + if (!playerIn.capabilities.isCreativeMode) + { + --itemStackIn.stackSize; + } + + worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!worldIn.isRemote) + { + worldIn.spawnEntityInWorld(new EntityEgg(worldIn, playerIn)); + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return itemStackIn; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemEmptyMap.java b/src/minecraft/net/minecraft/item/ItemEmptyMap.java new file mode 100644 index 0000000..efe424b --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemEmptyMap.java @@ -0,0 +1,47 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.stats.StatList; +import net.minecraft.world.World; +import net.minecraft.world.storage.MapData; + +public class ItemEmptyMap extends ItemMapBase +{ + protected ItemEmptyMap() + { + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + ItemStack itemstack = new ItemStack(Items.filled_map, 1, worldIn.getUniqueDataId("map")); + String s = "map_" + itemstack.getMetadata(); + MapData mapdata = new MapData(s); + worldIn.setItemData(s, mapdata); + mapdata.scale = 0; + mapdata.calculateMapCenter(playerIn.posX, playerIn.posZ, mapdata.scale); + mapdata.dimension = (byte)worldIn.provider.getDimensionId(); + mapdata.markDirty(); + --itemStackIn.stackSize; + + if (itemStackIn.stackSize <= 0) + { + return itemstack; + } + else + { + if (!playerIn.inventory.addItemStackToInventory(itemstack.copy())) + { + playerIn.dropPlayerItemWithRandomChoice(itemstack, false); + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return itemStackIn; + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemEnchantedBook.java b/src/minecraft/net/minecraft/item/ItemEnchantedBook.java new file mode 100644 index 0000000..e918fd1 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemEnchantedBook.java @@ -0,0 +1,135 @@ +package net.minecraft.item; + +import java.util.List; +import java.util.Random; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentData; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.WeightedRandomChestContent; + +public class ItemEnchantedBook extends Item +{ + public boolean hasEffect(ItemStack stack) + { + return true; + } + + /** + * Checks isDamagable and if it cannot be stacked + */ + public boolean isItemTool(ItemStack stack) + { + return false; + } + + /** + * Return an item rarity from EnumRarity + */ + public EnumRarity getRarity(ItemStack stack) + { + return this.getEnchantments(stack).tagCount() > 0 ? EnumRarity.UNCOMMON : super.getRarity(stack); + } + + public NBTTagList getEnchantments(ItemStack stack) + { + NBTTagCompound nbttagcompound = stack.getTagCompound(); + return nbttagcompound != null && nbttagcompound.hasKey("StoredEnchantments", 9) ? (NBTTagList)nbttagcompound.getTag("StoredEnchantments") : new NBTTagList(); + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) + { + super.addInformation(stack, playerIn, tooltip, advanced); + NBTTagList nbttaglist = this.getEnchantments(stack); + + if (nbttaglist != null) + { + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + int j = nbttaglist.getCompoundTagAt(i).getShort("id"); + int k = nbttaglist.getCompoundTagAt(i).getShort("lvl"); + + if (Enchantment.getEnchantmentById(j) != null) + { + tooltip.add(Enchantment.getEnchantmentById(j).getTranslatedName(k)); + } + } + } + } + + /** + * Adds an stored enchantment to an enchanted book ItemStack + */ + public void addEnchantment(ItemStack stack, EnchantmentData enchantment) + { + NBTTagList nbttaglist = this.getEnchantments(stack); + boolean flag = true; + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + + if (nbttagcompound.getShort("id") == enchantment.enchantmentobj.effectId) + { + if (nbttagcompound.getShort("lvl") < enchantment.enchantmentLevel) + { + nbttagcompound.setShort("lvl", (short)enchantment.enchantmentLevel); + } + + flag = false; + break; + } + } + + if (flag) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setShort("id", (short)enchantment.enchantmentobj.effectId); + nbttagcompound1.setShort("lvl", (short)enchantment.enchantmentLevel); + nbttaglist.appendTag(nbttagcompound1); + } + + if (!stack.hasTagCompound()) + { + stack.setTagCompound(new NBTTagCompound()); + } + + stack.getTagCompound().setTag("StoredEnchantments", nbttaglist); + } + + /** + * Returns the ItemStack of an enchanted version of this item. + */ + public ItemStack getEnchantedItemStack(EnchantmentData data) + { + ItemStack itemstack = new ItemStack(this); + this.addEnchantment(itemstack, data); + return itemstack; + } + + public void getAll(Enchantment enchantment, List list) + { + for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i) + { + list.add(this.getEnchantedItemStack(new EnchantmentData(enchantment, i))); + } + } + + public WeightedRandomChestContent getRandom(Random rand) + { + return this.getRandom(rand, 1, 1, 1); + } + + public WeightedRandomChestContent getRandom(Random rand, int minChance, int maxChance, int weight) + { + ItemStack itemstack = new ItemStack(Items.book, 1, 0); + EnchantmentHelper.addRandomEnchantment(rand, itemstack, 30); + return new WeightedRandomChestContent(itemstack, minChance, maxChance, weight); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemEnderEye.java b/src/minecraft/net/minecraft/item/ItemEnderEye.java new file mode 100644 index 0000000..217f628 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemEnderEye.java @@ -0,0 +1,177 @@ +package net.minecraft.item; + +import net.minecraft.block.BlockEndPortalFrame; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.item.EntityEnderEye; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.stats.StatList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class ItemEnderEye extends Item +{ + public ItemEnderEye() + { + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (playerIn.canPlayerEdit(pos.offset(side), side, stack) && iblockstate.getBlock() == Blocks.end_portal_frame && !((Boolean)iblockstate.getValue(BlockEndPortalFrame.EYE)).booleanValue()) + { + if (worldIn.isRemote) + { + return true; + } + else + { + worldIn.setBlockState(pos, iblockstate.withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(true)), 2); + worldIn.updateComparatorOutputLevel(pos, Blocks.end_portal_frame); + --stack.stackSize; + + for (int i = 0; i < 16; ++i) + { + double d0 = (double)((float)pos.getX() + (5.0F + itemRand.nextFloat() * 6.0F) / 16.0F); + double d1 = (double)((float)pos.getY() + 0.8125F); + double d2 = (double)((float)pos.getZ() + (5.0F + itemRand.nextFloat() * 6.0F) / 16.0F); + double d3 = 0.0D; + double d4 = 0.0D; + double d5 = 0.0D; + worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, d3, d4, d5, new int[0]); + } + + EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(BlockEndPortalFrame.FACING); + int l = 0; + int j = 0; + boolean flag1 = false; + boolean flag = true; + EnumFacing enumfacing1 = enumfacing.rotateY(); + + for (int k = -2; k <= 2; ++k) + { + BlockPos blockpos1 = pos.offset(enumfacing1, k); + IBlockState iblockstate1 = worldIn.getBlockState(blockpos1); + + if (iblockstate1.getBlock() == Blocks.end_portal_frame) + { + if (!((Boolean)iblockstate1.getValue(BlockEndPortalFrame.EYE)).booleanValue()) + { + flag = false; + break; + } + + j = k; + + if (!flag1) + { + l = k; + flag1 = true; + } + } + } + + if (flag && j == l + 2) + { + BlockPos blockpos = pos.offset(enumfacing, 4); + + for (int i1 = l; i1 <= j; ++i1) + { + BlockPos blockpos2 = blockpos.offset(enumfacing1, i1); + IBlockState iblockstate3 = worldIn.getBlockState(blockpos2); + + if (iblockstate3.getBlock() != Blocks.end_portal_frame || !((Boolean)iblockstate3.getValue(BlockEndPortalFrame.EYE)).booleanValue()) + { + flag = false; + break; + } + } + + for (int j1 = l - 1; j1 <= j + 1; j1 += 4) + { + blockpos = pos.offset(enumfacing1, j1); + + for (int l1 = 1; l1 <= 3; ++l1) + { + BlockPos blockpos3 = blockpos.offset(enumfacing, l1); + IBlockState iblockstate2 = worldIn.getBlockState(blockpos3); + + if (iblockstate2.getBlock() != Blocks.end_portal_frame || !((Boolean)iblockstate2.getValue(BlockEndPortalFrame.EYE)).booleanValue()) + { + flag = false; + break; + } + } + } + + if (flag) + { + for (int k1 = l; k1 <= j; ++k1) + { + blockpos = pos.offset(enumfacing1, k1); + + for (int i2 = 1; i2 <= 3; ++i2) + { + BlockPos blockpos4 = blockpos.offset(enumfacing, i2); + worldIn.setBlockState(blockpos4, Blocks.end_portal.getDefaultState(), 2); + } + } + } + } + + return true; + } + } + else + { + return false; + } + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, false); + + if (movingobjectposition != null && movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && worldIn.getBlockState(movingobjectposition.getBlockPos()).getBlock() == Blocks.end_portal_frame) + { + return itemStackIn; + } + else + { + if (!worldIn.isRemote) + { + BlockPos blockpos = worldIn.getStrongholdPos("Stronghold", new BlockPos(playerIn)); + + if (blockpos != null) + { + EntityEnderEye entityendereye = new EntityEnderEye(worldIn, playerIn.posX, playerIn.posY, playerIn.posZ); + entityendereye.moveTowards(blockpos); + worldIn.spawnEntityInWorld(entityendereye); + worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1002, new BlockPos(playerIn), 0); + + if (!playerIn.capabilities.isCreativeMode) + { + --itemStackIn.stackSize; + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + } + } + + return itemStackIn; + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemEnderPearl.java b/src/minecraft/net/minecraft/item/ItemEnderPearl.java new file mode 100644 index 0000000..3b6d330 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemEnderPearl.java @@ -0,0 +1,40 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.item.EntityEnderPearl; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.stats.StatList; +import net.minecraft.world.World; + +public class ItemEnderPearl extends Item +{ + public ItemEnderPearl() + { + this.maxStackSize = 16; + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + if (playerIn.capabilities.isCreativeMode) + { + return itemStackIn; + } + else + { + --itemStackIn.stackSize; + worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!worldIn.isRemote) + { + worldIn.spawnEntityInWorld(new EntityEnderPearl(worldIn, playerIn)); + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return itemStackIn; + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemExpBottle.java b/src/minecraft/net/minecraft/item/ItemExpBottle.java new file mode 100644 index 0000000..318f1af --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemExpBottle.java @@ -0,0 +1,41 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.item.EntityExpBottle; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.stats.StatList; +import net.minecraft.world.World; + +public class ItemExpBottle extends Item +{ + public ItemExpBottle() + { + this.setCreativeTab(CreativeTabs.tabMisc); + } + + public boolean hasEffect(ItemStack stack) + { + return true; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + if (!playerIn.capabilities.isCreativeMode) + { + --itemStackIn.stackSize; + } + + worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!worldIn.isRemote) + { + worldIn.spawnEntityInWorld(new EntityExpBottle(worldIn, playerIn)); + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return itemStackIn; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemFireball.java b/src/minecraft/net/minecraft/item/ItemFireball.java new file mode 100644 index 0000000..b958234 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemFireball.java @@ -0,0 +1,52 @@ +package net.minecraft.item; + +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemFireball extends Item +{ + public ItemFireball() + { + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else + { + pos = pos.offset(side); + + if (!playerIn.canPlayerEdit(pos, side, stack)) + { + return false; + } + else + { + if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "item.fireCharge.use", 1.0F, (itemRand.nextFloat() - itemRand.nextFloat()) * 0.2F + 1.0F); + worldIn.setBlockState(pos, Blocks.fire.getDefaultState()); + } + + if (!playerIn.capabilities.isCreativeMode) + { + --stack.stackSize; + } + + return true; + } + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemFirework.java b/src/minecraft/net/minecraft/item/ItemFirework.java new file mode 100644 index 0000000..54f2b09 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemFirework.java @@ -0,0 +1,79 @@ +package net.minecraft.item; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.entity.item.EntityFireworkRocket; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class ItemFirework extends Item +{ + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (!worldIn.isRemote) + { + EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(worldIn, (double)((float)pos.getX() + hitX), (double)((float)pos.getY() + hitY), (double)((float)pos.getZ() + hitZ), stack); + worldIn.spawnEntityInWorld(entityfireworkrocket); + + if (!playerIn.capabilities.isCreativeMode) + { + --stack.stackSize; + } + + return true; + } + else + { + return false; + } + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) + { + if (stack.hasTagCompound()) + { + NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("Fireworks"); + + if (nbttagcompound != null) + { + if (nbttagcompound.hasKey("Flight", 99)) + { + tooltip.add(StatCollector.translateToLocal("item.fireworks.flight") + " " + nbttagcompound.getByte("Flight")); + } + + NBTTagList nbttaglist = nbttagcompound.getTagList("Explosions", 10); + + if (nbttaglist != null && nbttaglist.tagCount() > 0) + { + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + List list = Lists.newArrayList(); + ItemFireworkCharge.addExplosionInfo(nbttagcompound1, list); + + if (list.size() > 0) + { + for (int j = 1; j < ((List)list).size(); ++j) + { + list.set(j, " " + (String)list.get(j)); + } + + tooltip.addAll(list); + } + } + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemFireworkCharge.java b/src/minecraft/net/minecraft/item/ItemFireworkCharge.java new file mode 100644 index 0000000..5b28f7e --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemFireworkCharge.java @@ -0,0 +1,187 @@ +package net.minecraft.item; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagIntArray; +import net.minecraft.util.StatCollector; + +public class ItemFireworkCharge extends Item +{ + public int getColorFromItemStack(ItemStack stack, int renderPass) + { + if (renderPass != 1) + { + return super.getColorFromItemStack(stack, renderPass); + } + else + { + NBTBase nbtbase = getExplosionTag(stack, "Colors"); + + if (!(nbtbase instanceof NBTTagIntArray)) + { + return 9079434; + } + else + { + NBTTagIntArray nbttagintarray = (NBTTagIntArray)nbtbase; + int[] aint = nbttagintarray.getIntArray(); + + if (aint.length == 1) + { + return aint[0]; + } + else + { + int i = 0; + int j = 0; + int k = 0; + + for (int l : aint) + { + i += (l & 16711680) >> 16; + j += (l & 65280) >> 8; + k += (l & 255) >> 0; + } + + i = i / aint.length; + j = j / aint.length; + k = k / aint.length; + return i << 16 | j << 8 | k; + } + } + } + } + + public static NBTBase getExplosionTag(ItemStack stack, String key) + { + if (stack.hasTagCompound()) + { + NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("Explosion"); + + if (nbttagcompound != null) + { + return nbttagcompound.getTag(key); + } + } + + return null; + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) + { + if (stack.hasTagCompound()) + { + NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("Explosion"); + + if (nbttagcompound != null) + { + addExplosionInfo(nbttagcompound, tooltip); + } + } + } + + public static void addExplosionInfo(NBTTagCompound nbt, List tooltip) + { + byte b0 = nbt.getByte("Type"); + + if (b0 >= 0 && b0 <= 4) + { + tooltip.add(StatCollector.translateToLocal("item.fireworksCharge.type." + b0).trim()); + } + else + { + tooltip.add(StatCollector.translateToLocal("item.fireworksCharge.type").trim()); + } + + int[] aint = nbt.getIntArray("Colors"); + + if (aint.length > 0) + { + boolean flag = true; + String s = ""; + + for (int i : aint) + { + if (!flag) + { + s = s + ", "; + } + + flag = false; + boolean flag1 = false; + + for (int j = 0; j < ItemDye.dyeColors.length; ++j) + { + if (i == ItemDye.dyeColors[j]) + { + flag1 = true; + s = s + StatCollector.translateToLocal("item.fireworksCharge." + EnumDyeColor.byDyeDamage(j).getUnlocalizedName()); + break; + } + } + + if (!flag1) + { + s = s + StatCollector.translateToLocal("item.fireworksCharge.customColor"); + } + } + + tooltip.add(s); + } + + int[] aint1 = nbt.getIntArray("FadeColors"); + + if (aint1.length > 0) + { + boolean flag2 = true; + String s1 = StatCollector.translateToLocal("item.fireworksCharge.fadeTo") + " "; + + for (int l : aint1) + { + if (!flag2) + { + s1 = s1 + ", "; + } + + flag2 = false; + boolean flag5 = false; + + for (int k = 0; k < 16; ++k) + { + if (l == ItemDye.dyeColors[k]) + { + flag5 = true; + s1 = s1 + StatCollector.translateToLocal("item.fireworksCharge." + EnumDyeColor.byDyeDamage(k).getUnlocalizedName()); + break; + } + } + + if (!flag5) + { + s1 = s1 + StatCollector.translateToLocal("item.fireworksCharge.customColor"); + } + } + + tooltip.add(s1); + } + + boolean flag3 = nbt.getBoolean("Trail"); + + if (flag3) + { + tooltip.add(StatCollector.translateToLocal("item.fireworksCharge.trail")); + } + + boolean flag4 = nbt.getBoolean("Flicker"); + + if (flag4) + { + tooltip.add(StatCollector.translateToLocal("item.fireworksCharge.flicker")); + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemFishFood.java b/src/minecraft/net/minecraft/item/ItemFishFood.java new file mode 100644 index 0000000..acd7fe3 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemFishFood.java @@ -0,0 +1,170 @@ +package net.minecraft.item; + +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.potion.PotionHelper; +import net.minecraft.world.World; + +public class ItemFishFood extends ItemFood +{ + /** Indicates whether this fish is "cooked" or not. */ + private final boolean cooked; + + public ItemFishFood(boolean cooked) + { + super(0, 0.0F, false); + this.cooked = cooked; + } + + public int getHealAmount(ItemStack stack) + { + ItemFishFood.FishType itemfishfood$fishtype = ItemFishFood.FishType.byItemStack(stack); + return this.cooked && itemfishfood$fishtype.canCook() ? itemfishfood$fishtype.getCookedHealAmount() : itemfishfood$fishtype.getUncookedHealAmount(); + } + + public float getSaturationModifier(ItemStack stack) + { + ItemFishFood.FishType itemfishfood$fishtype = ItemFishFood.FishType.byItemStack(stack); + return this.cooked && itemfishfood$fishtype.canCook() ? itemfishfood$fishtype.getCookedSaturationModifier() : itemfishfood$fishtype.getUncookedSaturationModifier(); + } + + public String getPotionEffect(ItemStack stack) + { + return ItemFishFood.FishType.byItemStack(stack) == ItemFishFood.FishType.PUFFERFISH ? PotionHelper.pufferfishEffect : null; + } + + protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) + { + ItemFishFood.FishType itemfishfood$fishtype = ItemFishFood.FishType.byItemStack(stack); + + if (itemfishfood$fishtype == ItemFishFood.FishType.PUFFERFISH) + { + player.addPotionEffect(new PotionEffect(Potion.poison.id, 1200, 3)); + player.addPotionEffect(new PotionEffect(Potion.hunger.id, 300, 2)); + player.addPotionEffect(new PotionEffect(Potion.confusion.id, 300, 1)); + } + + super.onFoodEaten(stack, worldIn, player); + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) + { + for (ItemFishFood.FishType itemfishfood$fishtype : ItemFishFood.FishType.values()) + { + if (!this.cooked || itemfishfood$fishtype.canCook()) + { + subItems.add(new ItemStack(this, 1, itemfishfood$fishtype.getMetadata())); + } + } + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack stack) + { + ItemFishFood.FishType itemfishfood$fishtype = ItemFishFood.FishType.byItemStack(stack); + return this.getUnlocalizedName() + "." + itemfishfood$fishtype.getUnlocalizedName() + "." + (this.cooked && itemfishfood$fishtype.canCook() ? "cooked" : "raw"); + } + + public static enum FishType + { + COD(0, "cod", 2, 0.1F, 5, 0.6F), + SALMON(1, "salmon", 2, 0.1F, 6, 0.8F), + CLOWNFISH(2, "clownfish", 1, 0.1F), + PUFFERFISH(3, "pufferfish", 1, 0.1F); + + private static final Map META_LOOKUP = Maps.newHashMap(); + private final int meta; + private final String unlocalizedName; + private final int uncookedHealAmount; + private final float uncookedSaturationModifier; + private final int cookedHealAmount; + private final float cookedSaturationModifier; + private boolean cookable = false; + + private FishType(int meta, String unlocalizedName, int uncookedHeal, float uncookedSaturation, int cookedHeal, float cookedSaturation) + { + this.meta = meta; + this.unlocalizedName = unlocalizedName; + this.uncookedHealAmount = uncookedHeal; + this.uncookedSaturationModifier = uncookedSaturation; + this.cookedHealAmount = cookedHeal; + this.cookedSaturationModifier = cookedSaturation; + this.cookable = true; + } + + private FishType(int meta, String unlocalizedName, int uncookedHeal, float uncookedSaturation) + { + this.meta = meta; + this.unlocalizedName = unlocalizedName; + this.uncookedHealAmount = uncookedHeal; + this.uncookedSaturationModifier = uncookedSaturation; + this.cookedHealAmount = 0; + this.cookedSaturationModifier = 0.0F; + this.cookable = false; + } + + public int getMetadata() + { + return this.meta; + } + + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + public int getUncookedHealAmount() + { + return this.uncookedHealAmount; + } + + public float getUncookedSaturationModifier() + { + return this.uncookedSaturationModifier; + } + + public int getCookedHealAmount() + { + return this.cookedHealAmount; + } + + public float getCookedSaturationModifier() + { + return this.cookedSaturationModifier; + } + + public boolean canCook() + { + return this.cookable; + } + + public static ItemFishFood.FishType byMetadata(int meta) + { + ItemFishFood.FishType itemfishfood$fishtype = (ItemFishFood.FishType)META_LOOKUP.get(Integer.valueOf(meta)); + return itemfishfood$fishtype == null ? COD : itemfishfood$fishtype; + } + + public static ItemFishFood.FishType byItemStack(ItemStack stack) + { + return stack.getItem() instanceof ItemFishFood ? byMetadata(stack.getMetadata()) : COD; + } + + static { + for (ItemFishFood.FishType itemfishfood$fishtype : values()) + { + META_LOOKUP.put(Integer.valueOf(itemfishfood$fishtype.getMetadata()), itemfishfood$fishtype); + } + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemFishingRod.java b/src/minecraft/net/minecraft/item/ItemFishingRod.java new file mode 100644 index 0000000..8715e8b --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemFishingRod.java @@ -0,0 +1,77 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityFishHook; +import net.minecraft.stats.StatList; +import net.minecraft.world.World; + +public class ItemFishingRod extends Item +{ + public ItemFishingRod() + { + this.setMaxDamage(64); + this.setMaxStackSize(1); + this.setCreativeTab(CreativeTabs.tabTools); + } + + /** + * Returns True is the item is renderer in full 3D when hold. + */ + public boolean isFull3D() + { + return true; + } + + /** + * Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities + * hands. + */ + public boolean shouldRotateAroundWhenRendering() + { + return true; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + if (playerIn.fishEntity != null) + { + int i = playerIn.fishEntity.handleHookRetraction(); + itemStackIn.damageItem(i, playerIn); + playerIn.swingItem(); + } + else + { + worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!worldIn.isRemote) + { + worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn)); + } + + playerIn.swingItem(); + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + } + + return itemStackIn; + } + + /** + * Checks isDamagable and if it cannot be stacked + */ + public boolean isItemTool(ItemStack stack) + { + return super.isItemTool(stack); + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return 1; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemFlintAndSteel.java b/src/minecraft/net/minecraft/item/ItemFlintAndSteel.java new file mode 100644 index 0000000..9180ea0 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemFlintAndSteel.java @@ -0,0 +1,43 @@ +package net.minecraft.item; + +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemFlintAndSteel extends Item +{ + public ItemFlintAndSteel() + { + this.maxStackSize = 1; + this.setMaxDamage(64); + this.setCreativeTab(CreativeTabs.tabTools); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + pos = pos.offset(side); + + if (!playerIn.canPlayerEdit(pos, side, stack)) + { + return false; + } + else + { + if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air) + { + worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + worldIn.setBlockState(pos, Blocks.fire.getDefaultState()); + } + + stack.damageItem(1, playerIn); + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemFood.java b/src/minecraft/net/minecraft/item/ItemFood.java new file mode 100644 index 0000000..752e5f0 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemFood.java @@ -0,0 +1,144 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.PotionEffect; +import net.minecraft.stats.StatList; +import net.minecraft.world.World; + +public class ItemFood extends Item +{ + /** Number of ticks to run while 'EnumAction'ing until result. */ + public final int itemUseDuration; + + /** The amount this food item heals the player. */ + private final int healAmount; + private final float saturationModifier; + + /** Whether wolves like this food (true for raw and cooked porkchop). */ + private final boolean isWolfsFavoriteMeat; + + /** + * If this field is true, the food can be consumed even if the player don't need to eat. + */ + private boolean alwaysEdible; + + /** + * represents the potion effect that will occurr upon eating this food. Set by setPotionEffect + */ + private int potionId; + + /** set by setPotionEffect */ + private int potionDuration; + + /** set by setPotionEffect */ + private int potionAmplifier; + + /** probably of the set potion effect occurring */ + private float potionEffectProbability; + + public ItemFood(int amount, float saturation, boolean isWolfFood) + { + this.itemUseDuration = 32; + this.healAmount = amount; + this.isWolfsFavoriteMeat = isWolfFood; + this.saturationModifier = saturation; + this.setCreativeTab(CreativeTabs.tabFood); + } + + public ItemFood(int amount, boolean isWolfFood) + { + this(amount, 0.6F, isWolfFood); + } + + /** + * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using + * the Item before the action is complete. + */ + public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn) + { + --stack.stackSize; + playerIn.getFoodStats().addStats(this, stack); + worldIn.playSoundAtEntity(playerIn, "random.burp", 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F); + this.onFoodEaten(stack, worldIn, playerIn); + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return stack; + } + + protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) + { + if (!worldIn.isRemote && this.potionId > 0 && worldIn.rand.nextFloat() < this.potionEffectProbability) + { + player.addPotionEffect(new PotionEffect(this.potionId, this.potionDuration * 20, this.potionAmplifier)); + } + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack stack) + { + return 32; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack stack) + { + return EnumAction.EAT; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + if (playerIn.canEat(this.alwaysEdible)) + { + playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); + } + + return itemStackIn; + } + + public int getHealAmount(ItemStack stack) + { + return this.healAmount; + } + + public float getSaturationModifier(ItemStack stack) + { + return this.saturationModifier; + } + + /** + * Whether wolves like this food (true for raw and cooked porkchop). + */ + public boolean isWolfsFavoriteMeat() + { + return this.isWolfsFavoriteMeat; + } + + /** + * sets a potion effect on the item. Args: int potionId, int duration (will be multiplied by 20), int amplifier, + * float probability of effect happening + */ + public ItemFood setPotionEffect(int id, int duration, int amplifier, float probability) + { + this.potionId = id; + this.potionDuration = duration; + this.potionAmplifier = amplifier; + this.potionEffectProbability = probability; + return this; + } + + /** + * Set the field 'alwaysEdible' to true, and make the food edible even if the player don't need to eat. + */ + public ItemFood setAlwaysEdible() + { + this.alwaysEdible = true; + return this; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemGlassBottle.java b/src/minecraft/net/minecraft/item/ItemGlassBottle.java new file mode 100644 index 0000000..7a8ae3d --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemGlassBottle.java @@ -0,0 +1,66 @@ +package net.minecraft.item; + +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.stats.StatList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class ItemGlassBottle extends Item +{ + public ItemGlassBottle() + { + this.setCreativeTab(CreativeTabs.tabBrewing); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, true); + + if (movingobjectposition == null) + { + return itemStackIn; + } + else + { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = movingobjectposition.getBlockPos(); + + if (!worldIn.isBlockModifiable(playerIn, blockpos)) + { + return itemStackIn; + } + + if (!playerIn.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, itemStackIn)) + { + return itemStackIn; + } + + if (worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.water) + { + --itemStackIn.stackSize; + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + + if (itemStackIn.stackSize <= 0) + { + return new ItemStack(Items.potionitem); + } + + if (!playerIn.inventory.addItemStackToInventory(new ItemStack(Items.potionitem))) + { + playerIn.dropPlayerItemWithRandomChoice(new ItemStack(Items.potionitem, 1, 0), false); + } + } + } + + return itemStackIn; + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemHangingEntity.java b/src/minecraft/net/minecraft/item/ItemHangingEntity.java new file mode 100644 index 0000000..9a76944 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemHangingEntity.java @@ -0,0 +1,66 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityHanging; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.item.EntityPainting; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemHangingEntity extends Item +{ + private final Class hangingEntityClass; + + public ItemHangingEntity(Class entityClass) + { + this.hangingEntityClass = entityClass; + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (side == EnumFacing.DOWN) + { + return false; + } + else if (side == EnumFacing.UP) + { + return false; + } + else + { + BlockPos blockpos = pos.offset(side); + + if (!playerIn.canPlayerEdit(blockpos, side, stack)) + { + return false; + } + else + { + EntityHanging entityhanging = this.createEntity(worldIn, blockpos, side); + + if (entityhanging != null && entityhanging.onValidSurface()) + { + if (!worldIn.isRemote) + { + worldIn.spawnEntityInWorld(entityhanging); + } + + --stack.stackSize; + } + + return true; + } + } + } + + private EntityHanging createEntity(World worldIn, BlockPos pos, EnumFacing clickedSide) + { + return (EntityHanging)(this.hangingEntityClass == EntityPainting.class ? new EntityPainting(worldIn, pos, clickedSide) : (this.hangingEntityClass == EntityItemFrame.class ? new EntityItemFrame(worldIn, pos, clickedSide) : null)); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemHoe.java b/src/minecraft/net/minecraft/item/ItemHoe.java new file mode 100644 index 0000000..677eac7 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemHoe.java @@ -0,0 +1,98 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockDirt; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemHoe extends Item +{ + protected Item.ToolMaterial theToolMaterial; + + public ItemHoe(Item.ToolMaterial material) + { + this.theToolMaterial = material; + this.maxStackSize = 1; + this.setMaxDamage(material.getMaxUses()); + this.setCreativeTab(CreativeTabs.tabTools); + } + + @SuppressWarnings("incomplete-switch") + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) + { + return false; + } + else + { + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if (side != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air) + { + if (block == Blocks.grass) + { + return this.useHoe(stack, playerIn, worldIn, pos, Blocks.farmland.getDefaultState()); + } + + if (block == Blocks.dirt) + { + switch ((BlockDirt.DirtType)iblockstate.getValue(BlockDirt.VARIANT)) + { + case DIRT: + return this.useHoe(stack, playerIn, worldIn, pos, Blocks.farmland.getDefaultState()); + + case COARSE_DIRT: + return this.useHoe(stack, playerIn, worldIn, pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)); + } + } + } + + return false; + } + } + + protected boolean useHoe(ItemStack stack, EntityPlayer player, World worldIn, BlockPos target, IBlockState newState) + { + worldIn.playSoundEffect((double)((float)target.getX() + 0.5F), (double)((float)target.getY() + 0.5F), (double)((float)target.getZ() + 0.5F), newState.getBlock().stepSound.getStepSound(), (newState.getBlock().stepSound.getVolume() + 1.0F) / 2.0F, newState.getBlock().stepSound.getFrequency() * 0.8F); + + if (worldIn.isRemote) + { + return true; + } + else + { + worldIn.setBlockState(target, newState); + stack.damageItem(1, player); + return true; + } + } + + /** + * Returns True is the item is renderer in full 3D when hold. + */ + public boolean isFull3D() + { + return true; + } + + /** + * Returns the name of the material this tool is made from as it is declared in EnumToolMaterial (meaning diamond + * would return "EMERALD") + */ + public String getMaterialName() + { + return this.theToolMaterial.toString(); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemLead.java b/src/minecraft/net/minecraft/item/ItemLead.java new file mode 100644 index 0000000..1f9ee7c --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemLead.java @@ -0,0 +1,71 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockFence; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLeashKnot; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemLead extends Item +{ + public ItemLead() + { + this.setCreativeTab(CreativeTabs.tabTools); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + Block block = worldIn.getBlockState(pos).getBlock(); + + if (block instanceof BlockFence) + { + if (worldIn.isRemote) + { + return true; + } + else + { + attachToFence(playerIn, worldIn, pos); + return true; + } + } + else + { + return false; + } + } + + public static boolean attachToFence(EntityPlayer player, World worldIn, BlockPos fence) + { + EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForPosition(worldIn, fence); + boolean flag = false; + double d0 = 7.0D; + int i = fence.getX(); + int j = fence.getY(); + int k = fence.getZ(); + + for (EntityLiving entityliving : worldIn.getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB((double)i - d0, (double)j - d0, (double)k - d0, (double)i + d0, (double)j + d0, (double)k + d0))) + { + if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == player) + { + if (entityleashknot == null) + { + entityleashknot = EntityLeashKnot.createKnot(worldIn, fence); + } + + entityliving.setLeashedToEntity(entityleashknot, true); + flag = true; + } + } + + return flag; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemLeaves.java b/src/minecraft/net/minecraft/item/ItemLeaves.java new file mode 100644 index 0000000..0bfc01e --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemLeaves.java @@ -0,0 +1,39 @@ +package net.minecraft.item; + +import net.minecraft.block.BlockLeaves; + +public class ItemLeaves extends ItemBlock +{ + private final BlockLeaves leaves; + + public ItemLeaves(BlockLeaves block) + { + super(block); + this.leaves = block; + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + /** + * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is + * placed as a Block (mostly used with ItemBlocks). + */ + public int getMetadata(int damage) + { + return damage | 4; + } + + public int getColorFromItemStack(ItemStack stack, int renderPass) + { + return this.leaves.getRenderColor(this.leaves.getStateFromMeta(stack.getMetadata())); + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack stack) + { + return super.getUnlocalizedName() + "." + this.leaves.getWoodType(stack.getMetadata()).getUnlocalizedName(); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemLilyPad.java b/src/minecraft/net/minecraft/item/ItemLilyPad.java new file mode 100644 index 0000000..e5093d9 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemLilyPad.java @@ -0,0 +1,72 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.stats.StatList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class ItemLilyPad extends ItemColored +{ + public ItemLilyPad(Block block) + { + super(block, false); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, true); + + if (movingobjectposition == null) + { + return itemStackIn; + } + else + { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = movingobjectposition.getBlockPos(); + + if (!worldIn.isBlockModifiable(playerIn, blockpos)) + { + return itemStackIn; + } + + if (!playerIn.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, itemStackIn)) + { + return itemStackIn; + } + + BlockPos blockpos1 = blockpos.up(); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) + { + worldIn.setBlockState(blockpos1, Blocks.waterlily.getDefaultState()); + + if (!playerIn.capabilities.isCreativeMode) + { + --itemStackIn.stackSize; + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + } + } + + return itemStackIn; + } + } + + public int getColorFromItemStack(ItemStack stack, int renderPass) + { + return Blocks.waterlily.getRenderColor(Blocks.waterlily.getStateFromMeta(stack.getMetadata())); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemMap.java b/src/minecraft/net/minecraft/item/ItemMap.java new file mode 100644 index 0000000..9274f9b --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemMap.java @@ -0,0 +1,303 @@ +package net.minecraft.item; + +import com.google.common.collect.HashMultiset; +import com.google.common.collect.Iterables; +import com.google.common.collect.Multiset; +import com.google.common.collect.Multisets; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDirt; +import net.minecraft.block.BlockStone; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.network.Packet; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.storage.MapData; + +public class ItemMap extends ItemMapBase +{ + protected ItemMap() + { + this.setHasSubtypes(true); + } + + public static MapData loadMapData(int mapId, World worldIn) + { + String s = "map_" + mapId; + MapData mapdata = (MapData)worldIn.loadItemData(MapData.class, s); + + if (mapdata == null) + { + mapdata = new MapData(s); + worldIn.setItemData(s, mapdata); + } + + return mapdata; + } + + public MapData getMapData(ItemStack stack, World worldIn) + { + String s = "map_" + stack.getMetadata(); + MapData mapdata = (MapData)worldIn.loadItemData(MapData.class, s); + + if (mapdata == null && !worldIn.isRemote) + { + stack.setItemDamage(worldIn.getUniqueDataId("map")); + s = "map_" + stack.getMetadata(); + mapdata = new MapData(s); + mapdata.scale = 3; + mapdata.calculateMapCenter((double)worldIn.getWorldInfo().getSpawnX(), (double)worldIn.getWorldInfo().getSpawnZ(), mapdata.scale); + mapdata.dimension = (byte)worldIn.provider.getDimensionId(); + mapdata.markDirty(); + worldIn.setItemData(s, mapdata); + } + + return mapdata; + } + + public void updateMapData(World worldIn, Entity viewer, MapData data) + { + if (worldIn.provider.getDimensionId() == data.dimension && viewer instanceof EntityPlayer) + { + int i = 1 << data.scale; + int j = data.xCenter; + int k = data.zCenter; + int l = MathHelper.floor_double(viewer.posX - (double)j) / i + 64; + int i1 = MathHelper.floor_double(viewer.posZ - (double)k) / i + 64; + int j1 = 128 / i; + + if (worldIn.provider.getHasNoSky()) + { + j1 /= 2; + } + + MapData.MapInfo mapdata$mapinfo = data.getMapInfo((EntityPlayer)viewer); + ++mapdata$mapinfo.field_82569_d; + boolean flag = false; + + for (int k1 = l - j1 + 1; k1 < l + j1; ++k1) + { + if ((k1 & 15) == (mapdata$mapinfo.field_82569_d & 15) || flag) + { + flag = false; + double d0 = 0.0D; + + for (int l1 = i1 - j1 - 1; l1 < i1 + j1; ++l1) + { + if (k1 >= 0 && l1 >= -1 && k1 < 128 && l1 < 128) + { + int i2 = k1 - l; + int j2 = l1 - i1; + boolean flag1 = i2 * i2 + j2 * j2 > (j1 - 2) * (j1 - 2); + int k2 = (j / i + k1 - 64) * i; + int l2 = (k / i + l1 - 64) * i; + Multiset multiset = HashMultiset.create(); + Chunk chunk = worldIn.getChunkFromBlockCoords(new BlockPos(k2, 0, l2)); + + if (!chunk.isEmpty()) + { + int i3 = k2 & 15; + int j3 = l2 & 15; + int k3 = 0; + double d1 = 0.0D; + + if (worldIn.provider.getHasNoSky()) + { + int l3 = k2 + l2 * 231871; + l3 = l3 * l3 * 31287121 + l3 * 11; + + if ((l3 >> 20 & 1) == 0) + { + multiset.add(Blocks.dirt.getMapColor(Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT)), 10); + } + else + { + multiset.add(Blocks.stone.getMapColor(Blocks.stone.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.STONE)), 100); + } + + d1 = 100.0D; + } + else + { + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int i4 = 0; i4 < i; ++i4) + { + for (int j4 = 0; j4 < i; ++j4) + { + int k4 = chunk.getHeightValue(i4 + i3, j4 + j3) + 1; + IBlockState iblockstate = Blocks.air.getDefaultState(); + + if (k4 > 1) + { + label541: + { + while (true) + { + --k4; + iblockstate = chunk.getBlockState(blockpos$mutableblockpos.func_181079_c(i4 + i3, k4, j4 + j3)); + + if (iblockstate.getBlock().getMapColor(iblockstate) != MapColor.airColor || k4 <= 0) + { + break; + } + } + + if (k4 > 0 && iblockstate.getBlock().getMaterial().isLiquid()) + { + int l4 = k4 - 1; + + while (true) + { + Block block = chunk.getBlock(i4 + i3, l4--, j4 + j3); + ++k3; + + if (l4 <= 0 || !block.getMaterial().isLiquid()) + { + break label541; + } + } + } + } + } + + d1 += (double)k4 / (double)(i * i); + multiset.add(iblockstate.getBlock().getMapColor(iblockstate)); + } + } + } + + k3 = k3 / (i * i); + double d2 = (d1 - d0) * 4.0D / (double)(i + 4) + ((double)(k1 + l1 & 1) - 0.5D) * 0.4D; + int i5 = 1; + + if (d2 > 0.6D) + { + i5 = 2; + } + + if (d2 < -0.6D) + { + i5 = 0; + } + + MapColor mapcolor = (MapColor)Iterables.getFirst(Multisets.copyHighestCountFirst(multiset), MapColor.airColor); + + if (mapcolor == MapColor.waterColor) + { + d2 = (double)k3 * 0.1D + (double)(k1 + l1 & 1) * 0.2D; + i5 = 1; + + if (d2 < 0.5D) + { + i5 = 2; + } + + if (d2 > 0.9D) + { + i5 = 0; + } + } + + d0 = d1; + + if (l1 >= 0 && i2 * i2 + j2 * j2 < j1 * j1 && (!flag1 || (k1 + l1 & 1) != 0)) + { + byte b0 = data.colors[k1 + l1 * 128]; + byte b1 = (byte)(mapcolor.colorIndex * 4 + i5); + + if (b0 != b1) + { + data.colors[k1 + l1 * 128] = b1; + data.updateMapData(k1, l1); + flag = true; + } + } + } + } + } + } + } + } + } + + /** + * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and + * update it's contents. + */ + public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) + { + if (!worldIn.isRemote) + { + MapData mapdata = this.getMapData(stack, worldIn); + + if (entityIn instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)entityIn; + mapdata.updateVisiblePlayers(entityplayer, stack); + } + + if (isSelected) + { + this.updateMapData(worldIn, entityIn, mapdata); + } + } + } + + public Packet createMapDataPacket(ItemStack stack, World worldIn, EntityPlayer player) + { + return this.getMapData(stack, worldIn).getMapPacket(stack, worldIn, player); + } + + /** + * Called when item is crafted/smelted. Used only by maps so far. + */ + public void onCreated(ItemStack stack, World worldIn, EntityPlayer playerIn) + { + if (stack.hasTagCompound() && stack.getTagCompound().getBoolean("map_is_scaling")) + { + MapData mapdata = Items.filled_map.getMapData(stack, worldIn); + stack.setItemDamage(worldIn.getUniqueDataId("map")); + MapData mapdata1 = new MapData("map_" + stack.getMetadata()); + mapdata1.scale = (byte)(mapdata.scale + 1); + + if (mapdata1.scale > 4) + { + mapdata1.scale = 4; + } + + mapdata1.calculateMapCenter((double)mapdata.xCenter, (double)mapdata.zCenter, mapdata1.scale); + mapdata1.dimension = mapdata.dimension; + mapdata1.markDirty(); + worldIn.setItemData("map_" + stack.getMetadata(), mapdata1); + } + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) + { + MapData mapdata = this.getMapData(stack, playerIn.worldObj); + + if (advanced) + { + if (mapdata == null) + { + tooltip.add("Unknown map"); + } + else + { + tooltip.add("Scaling at 1:" + (1 << mapdata.scale)); + tooltip.add("(Level " + mapdata.scale + "/" + 4 + ")"); + } + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemMapBase.java b/src/minecraft/net/minecraft/item/ItemMapBase.java new file mode 100644 index 0000000..0f610f6 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemMapBase.java @@ -0,0 +1,21 @@ +package net.minecraft.item; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.Packet; +import net.minecraft.world.World; + +public class ItemMapBase extends Item +{ + /** + * false for all Items except sub-classes of ItemMapBase + */ + public boolean isMap() + { + return true; + } + + public Packet createMapDataPacket(ItemStack stack, World worldIn, EntityPlayer player) + { + return null; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemMinecart.java b/src/minecraft/net/minecraft/item/ItemMinecart.java new file mode 100644 index 0000000..9fd084e --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemMinecart.java @@ -0,0 +1,128 @@ +package net.minecraft.item; + +import net.minecraft.block.BlockDispenser; +import net.minecraft.block.BlockRailBase; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.dispenser.IBehaviorDispenseItem; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemMinecart extends Item +{ + private static final IBehaviorDispenseItem dispenserMinecartBehavior = new BehaviorDefaultDispenseItem() + { + private final BehaviorDefaultDispenseItem behaviourDefaultDispenseItem = new BehaviorDefaultDispenseItem(); + public ItemStack dispenseStack(IBlockSource source, ItemStack stack) + { + EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata()); + World world = source.getWorld(); + double d0 = source.getX() + (double)enumfacing.getFrontOffsetX() * 1.125D; + double d1 = Math.floor(source.getY()) + (double)enumfacing.getFrontOffsetY(); + double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ() * 1.125D; + BlockPos blockpos = source.getBlockPos().offset(enumfacing); + IBlockState iblockstate = world.getBlockState(blockpos); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH; + double d3; + + if (BlockRailBase.isRailBlock(iblockstate)) + { + if (blockrailbase$enumraildirection.isAscending()) + { + d3 = 0.6D; + } + else + { + d3 = 0.1D; + } + } + else + { + if (iblockstate.getBlock().getMaterial() != Material.air || !BlockRailBase.isRailBlock(world.getBlockState(blockpos.down()))) + { + return this.behaviourDefaultDispenseItem.dispense(source, stack); + } + + IBlockState iblockstate1 = world.getBlockState(blockpos.down()); + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection1 = iblockstate1.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate1.getValue(((BlockRailBase)iblockstate1.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH; + + if (enumfacing != EnumFacing.DOWN && blockrailbase$enumraildirection1.isAscending()) + { + d3 = -0.4D; + } + else + { + d3 = -0.9D; + } + } + + EntityMinecart entityminecart = EntityMinecart.func_180458_a(world, d0, d1 + d3, d2, ((ItemMinecart)stack.getItem()).minecartType); + + if (stack.hasDisplayName()) + { + entityminecart.setCustomNameTag(stack.getDisplayName()); + } + + world.spawnEntityInWorld(entityminecart); + stack.splitStack(1); + return stack; + } + protected void playDispenseSound(IBlockSource source) + { + source.getWorld().playAuxSFX(1000, source.getBlockPos(), 0); + } + }; + private final EntityMinecart.EnumMinecartType minecartType; + + public ItemMinecart(EntityMinecart.EnumMinecartType type) + { + this.maxStackSize = 1; + this.minecartType = type; + this.setCreativeTab(CreativeTabs.tabTransport); + BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserMinecartBehavior); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (BlockRailBase.isRailBlock(iblockstate)) + { + if (!worldIn.isRemote) + { + BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH; + double d0 = 0.0D; + + if (blockrailbase$enumraildirection.isAscending()) + { + d0 = 0.5D; + } + + EntityMinecart entityminecart = EntityMinecart.func_180458_a(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.0625D + d0, (double)pos.getZ() + 0.5D, this.minecartType); + + if (stack.hasDisplayName()) + { + entityminecart.setCustomNameTag(stack.getDisplayName()); + } + + worldIn.spawnEntityInWorld(entityminecart); + } + + --stack.stackSize; + return true; + } + else + { + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemMonsterPlacer.java b/src/minecraft/net/minecraft/item/ItemMonsterPlacer.java new file mode 100644 index 0000000..19368ab --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemMonsterPlacer.java @@ -0,0 +1,220 @@ +package net.minecraft.item; + +import java.util.List; +import net.minecraft.block.BlockFence; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.stats.StatList; +import net.minecraft.tileentity.MobSpawnerBaseLogic; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityMobSpawner; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class ItemMonsterPlacer extends Item +{ + public ItemMonsterPlacer() + { + this.setHasSubtypes(true); + this.setCreativeTab(CreativeTabs.tabMisc); + } + + public String getItemStackDisplayName(ItemStack stack) + { + String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); + String s1 = EntityList.getStringFromID(stack.getMetadata()); + + if (s1 != null) + { + s = s + " " + StatCollector.translateToLocal("entity." + s1 + ".name"); + } + + return s; + } + + public int getColorFromItemStack(ItemStack stack, int renderPass) + { + EntityList.EntityEggInfo entitylist$entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(stack.getMetadata())); + return entitylist$entityegginfo != null ? (renderPass == 0 ? entitylist$entityegginfo.primaryColor : entitylist$entityegginfo.secondaryColor) : 16777215; + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (worldIn.isRemote) + { + return true; + } + else if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) + { + return false; + } + else + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == Blocks.mob_spawner) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityMobSpawner) + { + MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic(); + mobspawnerbaselogic.setEntityName(EntityList.getStringFromID(stack.getMetadata())); + tileentity.markDirty(); + worldIn.markBlockForUpdate(pos); + + if (!playerIn.capabilities.isCreativeMode) + { + --stack.stackSize; + } + + return true; + } + } + + pos = pos.offset(side); + double d0 = 0.0D; + + if (side == EnumFacing.UP && iblockstate instanceof BlockFence) + { + d0 = 0.5D; + } + + Entity entity = spawnCreature(worldIn, stack.getMetadata(), (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); + + if (entity != null) + { + if (entity instanceof EntityLivingBase && stack.hasDisplayName()) + { + entity.setCustomNameTag(stack.getDisplayName()); + } + + if (!playerIn.capabilities.isCreativeMode) + { + --stack.stackSize; + } + } + + return true; + } + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + if (worldIn.isRemote) + { + return itemStackIn; + } + else + { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, true); + + if (movingobjectposition == null) + { + return itemStackIn; + } + else + { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = movingobjectposition.getBlockPos(); + + if (!worldIn.isBlockModifiable(playerIn, blockpos)) + { + return itemStackIn; + } + + if (!playerIn.canPlayerEdit(blockpos, movingobjectposition.sideHit, itemStackIn)) + { + return itemStackIn; + } + + if (worldIn.getBlockState(blockpos).getBlock() instanceof BlockLiquid) + { + Entity entity = spawnCreature(worldIn, itemStackIn.getMetadata(), (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); + + if (entity != null) + { + if (entity instanceof EntityLivingBase && itemStackIn.hasDisplayName()) + { + ((EntityLiving)entity).setCustomNameTag(itemStackIn.getDisplayName()); + } + + if (!playerIn.capabilities.isCreativeMode) + { + --itemStackIn.stackSize; + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + } + } + } + + return itemStackIn; + } + } + } + + /** + * Spawns the creature specified by the egg's type in the location specified by the last three parameters. + * Parameters: world, entityID, x, y, z. + */ + public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z) + { + if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID))) + { + return null; + } + else + { + Entity entity = null; + + for (int i = 0; i < 1; ++i) + { + entity = EntityList.createEntityByID(entityID, worldIn); + + if (entity instanceof EntityLivingBase) + { + EntityLiving entityliving = (EntityLiving)entity; + entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F); + entityliving.rotationYawHead = entityliving.rotationYaw; + entityliving.renderYawOffset = entityliving.rotationYaw; + entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null); + worldIn.spawnEntityInWorld(entity); + entityliving.playLivingSound(); + } + } + + return entity; + } + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) + { + for (EntityList.EntityEggInfo entitylist$entityegginfo : EntityList.entityEggs.values()) + { + subItems.add(new ItemStack(itemIn, 1, entitylist$entityegginfo.spawnedID)); + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemMultiTexture.java b/src/minecraft/net/minecraft/item/ItemMultiTexture.java new file mode 100644 index 0000000..cd42585 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemMultiTexture.java @@ -0,0 +1,55 @@ +package net.minecraft.item; + +import com.google.common.base.Function; +import net.minecraft.block.Block; + +public class ItemMultiTexture extends ItemBlock +{ + protected final Block theBlock; + protected final Function nameFunction; + + public ItemMultiTexture(Block block, Block block2, Function nameFunction) + { + super(block); + this.theBlock = block2; + this.nameFunction = nameFunction; + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + public ItemMultiTexture(Block block, Block block2, final String[] namesByMeta) + { + this(block, block2, new Function() + { + public String apply(ItemStack p_apply_1_) + { + int i = p_apply_1_.getMetadata(); + + if (i < 0 || i >= namesByMeta.length) + { + i = 0; + } + + return namesByMeta[i]; + } + }); + } + + /** + * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is + * placed as a Block (mostly used with ItemBlocks). + */ + public int getMetadata(int damage) + { + return damage; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack stack) + { + return super.getUnlocalizedName() + "." + (String)this.nameFunction.apply(stack); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemNameTag.java b/src/minecraft/net/minecraft/item/ItemNameTag.java new file mode 100644 index 0000000..d800bc6 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemNameTag.java @@ -0,0 +1,37 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; + +public class ItemNameTag extends Item +{ + public ItemNameTag() + { + this.setCreativeTab(CreativeTabs.tabTools); + } + + /** + * Returns true if the item can be used on the given entity, e.g. shears on sheep. + */ + public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) + { + if (!stack.hasDisplayName()) + { + return false; + } + else if (target instanceof EntityLiving) + { + EntityLiving entityliving = (EntityLiving)target; + entityliving.setCustomNameTag(stack.getDisplayName()); + entityliving.enablePersistence(); + --stack.stackSize; + return true; + } + else + { + return super.itemInteractionForEntity(stack, playerIn, target); + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemPickaxe.java b/src/minecraft/net/minecraft/item/ItemPickaxe.java new file mode 100644 index 0000000..90d1539 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemPickaxe.java @@ -0,0 +1,30 @@ +package net.minecraft.item; + +import com.google.common.collect.Sets; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; + +public class ItemPickaxe extends ItemTool +{ + private static final Set EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.activator_rail, Blocks.coal_ore, Blocks.cobblestone, Blocks.detector_rail, Blocks.diamond_block, Blocks.diamond_ore, Blocks.double_stone_slab, Blocks.golden_rail, Blocks.gold_block, Blocks.gold_ore, Blocks.ice, Blocks.iron_block, Blocks.iron_ore, Blocks.lapis_block, Blocks.lapis_ore, Blocks.lit_redstone_ore, Blocks.mossy_cobblestone, Blocks.netherrack, Blocks.packed_ice, Blocks.rail, Blocks.redstone_ore, Blocks.sandstone, Blocks.red_sandstone, Blocks.stone, Blocks.stone_slab}); + + protected ItemPickaxe(Item.ToolMaterial material) + { + super(2.0F, material, EFFECTIVE_ON); + } + + /** + * Check whether this Item can harvest the given Block + */ + public boolean canHarvestBlock(Block blockIn) + { + return blockIn == Blocks.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (blockIn != Blocks.diamond_block && blockIn != Blocks.diamond_ore ? (blockIn != Blocks.emerald_ore && blockIn != Blocks.emerald_block ? (blockIn != Blocks.gold_block && blockIn != Blocks.gold_ore ? (blockIn != Blocks.iron_block && blockIn != Blocks.iron_ore ? (blockIn != Blocks.lapis_block && blockIn != Blocks.lapis_ore ? (blockIn != Blocks.redstone_ore && blockIn != Blocks.lit_redstone_ore ? (blockIn.getMaterial() == Material.rock ? true : (blockIn.getMaterial() == Material.iron ? true : blockIn.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2); + } + + public float getStrVsBlock(ItemStack stack, Block block) + { + return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil && block.getMaterial() != Material.rock ? super.getStrVsBlock(stack, block) : this.efficiencyOnProperMaterial; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemPiston.java b/src/minecraft/net/minecraft/item/ItemPiston.java new file mode 100644 index 0000000..511a09e --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemPiston.java @@ -0,0 +1,20 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; + +public class ItemPiston extends ItemBlock +{ + public ItemPiston(Block block) + { + super(block); + } + + /** + * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is + * placed as a Block (mostly used with ItemBlocks). + */ + public int getMetadata(int damage) + { + return 7; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemPotion.java b/src/minecraft/net/minecraft/item/ItemPotion.java new file mode 100644 index 0000000..c996162 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemPotion.java @@ -0,0 +1,395 @@ +package net.minecraft.item; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Multimap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.IAttribute; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityPotion; +import net.minecraft.init.Items; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.potion.PotionHelper; +import net.minecraft.stats.StatList; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class ItemPotion extends Item +{ + private Map> effectCache = Maps.>newHashMap(); + private static final Map, Integer> SUB_ITEMS_CACHE = Maps., Integer>newLinkedHashMap(); + + public ItemPotion() + { + this.setMaxStackSize(1); + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setCreativeTab(CreativeTabs.tabBrewing); + } + + public List getEffects(ItemStack stack) + { + if (stack.hasTagCompound() && stack.getTagCompound().hasKey("CustomPotionEffects", 9)) + { + List list1 = Lists.newArrayList(); + NBTTagList nbttaglist = stack.getTagCompound().getTagList("CustomPotionEffects", 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound); + + if (potioneffect != null) + { + list1.add(potioneffect); + } + } + + return list1; + } + else + { + List list = (List)this.effectCache.get(Integer.valueOf(stack.getMetadata())); + + if (list == null) + { + list = PotionHelper.getPotionEffects(stack.getMetadata(), false); + this.effectCache.put(Integer.valueOf(stack.getMetadata()), list); + } + + return list; + } + } + + public List getEffects(int meta) + { + List list = (List)this.effectCache.get(Integer.valueOf(meta)); + + if (list == null) + { + list = PotionHelper.getPotionEffects(meta, false); + this.effectCache.put(Integer.valueOf(meta), list); + } + + return list; + } + + /** + * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using + * the Item before the action is complete. + */ + public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn) + { + if (!playerIn.capabilities.isCreativeMode) + { + --stack.stackSize; + } + + if (!worldIn.isRemote) + { + List list = this.getEffects(stack); + + if (list != null) + { + for (PotionEffect potioneffect : list) + { + playerIn.addPotionEffect(new PotionEffect(potioneffect)); + } + } + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + + if (!playerIn.capabilities.isCreativeMode) + { + if (stack.stackSize <= 0) + { + return new ItemStack(Items.glass_bottle); + } + + playerIn.inventory.addItemStackToInventory(new ItemStack(Items.glass_bottle)); + } + + return stack; + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack stack) + { + return 32; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack stack) + { + return EnumAction.DRINK; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + if (isSplash(itemStackIn.getMetadata())) + { + if (!playerIn.capabilities.isCreativeMode) + { + --itemStackIn.stackSize; + } + + worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!worldIn.isRemote) + { + worldIn.spawnEntityInWorld(new EntityPotion(worldIn, playerIn, itemStackIn)); + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return itemStackIn; + } + else + { + playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); + return itemStackIn; + } + } + + /** + * returns wether or not a potion is a throwable splash potion based on damage value + */ + public static boolean isSplash(int meta) + { + return (meta & 16384) != 0; + } + + public int getColorFromDamage(int meta) + { + return PotionHelper.getLiquidColor(meta, false); + } + + public int getColorFromItemStack(ItemStack stack, int renderPass) + { + return renderPass > 0 ? 16777215 : this.getColorFromDamage(stack.getMetadata()); + } + + public boolean isEffectInstant(int meta) + { + List list = this.getEffects(meta); + + if (list != null && !list.isEmpty()) + { + for (PotionEffect potioneffect : list) + { + if (Potion.potionTypes[potioneffect.getPotionID()].isInstant()) + { + return true; + } + } + + return false; + } + else + { + return false; + } + } + + public String getItemStackDisplayName(ItemStack stack) + { + if (stack.getMetadata() == 0) + { + return StatCollector.translateToLocal("item.emptyPotion.name").trim(); + } + else + { + String s = ""; + + if (isSplash(stack.getMetadata())) + { + s = StatCollector.translateToLocal("potion.prefix.grenade").trim() + " "; + } + + List list = Items.potionitem.getEffects(stack); + + if (list != null && !list.isEmpty()) + { + String s2 = ((PotionEffect)list.get(0)).getEffectName(); + s2 = s2 + ".postfix"; + return s + StatCollector.translateToLocal(s2).trim(); + } + else + { + String s1 = PotionHelper.getPotionPrefix(stack.getMetadata()); + return StatCollector.translateToLocal(s1).trim() + " " + super.getItemStackDisplayName(stack); + } + } + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) + { + if (stack.getMetadata() != 0) + { + List list = Items.potionitem.getEffects(stack); + Multimap multimap = HashMultimap.create(); + + if (list != null && !list.isEmpty()) + { + for (PotionEffect potioneffect : list) + { + String s1 = StatCollector.translateToLocal(potioneffect.getEffectName()).trim(); + Potion potion = Potion.potionTypes[potioneffect.getPotionID()]; + Map map = potion.getAttributeModifierMap(); + + if (map != null && map.size() > 0) + { + for (Entry entry : map.entrySet()) + { + AttributeModifier attributemodifier = (AttributeModifier)entry.getValue(); + AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.getAttributeModifierAmount(potioneffect.getAmplifier(), attributemodifier), attributemodifier.getOperation()); + multimap.put(((IAttribute)entry.getKey()).getAttributeUnlocalizedName(), attributemodifier1); + } + } + + if (potioneffect.getAmplifier() > 0) + { + s1 = s1 + " " + StatCollector.translateToLocal("potion.potency." + potioneffect.getAmplifier()).trim(); + } + + if (potioneffect.getDuration() > 20) + { + s1 = s1 + " (" + Potion.getDurationString(potioneffect) + ")"; + } + + if (potion.isBadEffect()) + { + tooltip.add(EnumChatFormatting.RED + s1); + } + else + { + tooltip.add(EnumChatFormatting.GRAY + s1); + } + } + } + else + { + String s = StatCollector.translateToLocal("potion.empty").trim(); + tooltip.add(EnumChatFormatting.GRAY + s); + } + + if (!multimap.isEmpty()) + { + tooltip.add(""); + tooltip.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("potion.effects.whenDrank")); + + for (Entry entry1 : multimap.entries()) + { + AttributeModifier attributemodifier2 = (AttributeModifier)entry1.getValue(); + double d0 = attributemodifier2.getAmount(); + double d1; + + if (attributemodifier2.getOperation() != 1 && attributemodifier2.getOperation() != 2) + { + d1 = attributemodifier2.getAmount(); + } + else + { + d1 = attributemodifier2.getAmount() * 100.0D; + } + + if (d0 > 0.0D) + { + tooltip.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier2.getOperation(), new Object[] {ItemStack.DECIMALFORMAT.format(d1), StatCollector.translateToLocal("attribute.name." + (String)entry1.getKey())})); + } + else if (d0 < 0.0D) + { + d1 = d1 * -1.0D; + tooltip.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted("attribute.modifier.take." + attributemodifier2.getOperation(), new Object[] {ItemStack.DECIMALFORMAT.format(d1), StatCollector.translateToLocal("attribute.name." + (String)entry1.getKey())})); + } + } + } + } + } + + public boolean hasEffect(ItemStack stack) + { + List list = this.getEffects(stack); + return list != null && !list.isEmpty(); + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) + { + super.getSubItems(itemIn, tab, subItems); + + if (SUB_ITEMS_CACHE.isEmpty()) + { + for (int i = 0; i <= 15; ++i) + { + for (int j = 0; j <= 1; ++j) + { + int lvt_6_1_; + + if (j == 0) + { + lvt_6_1_ = i | 8192; + } + else + { + lvt_6_1_ = i | 16384; + } + + for (int l = 0; l <= 2; ++l) + { + int i1 = lvt_6_1_; + + if (l != 0) + { + if (l == 1) + { + i1 = lvt_6_1_ | 32; + } + else if (l == 2) + { + i1 = lvt_6_1_ | 64; + } + } + + List list = PotionHelper.getPotionEffects(i1, false); + + if (list != null && !list.isEmpty()) + { + SUB_ITEMS_CACHE.put(list, Integer.valueOf(i1)); + } + } + } + } + } + + Iterator iterator = SUB_ITEMS_CACHE.values().iterator(); + + while (iterator.hasNext()) + { + int j1 = ((Integer)iterator.next()).intValue(); + subItems.add(new ItemStack(itemIn, 1, j1)); + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemRecord.java b/src/minecraft/net/minecraft/item/ItemRecord.java new file mode 100644 index 0000000..9901b18 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemRecord.java @@ -0,0 +1,88 @@ +package net.minecraft.item; + +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; +import net.minecraft.block.BlockJukebox; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.stats.StatList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class ItemRecord extends Item +{ + private static final Map RECORDS = Maps.newHashMap(); + + /** The name of the record. */ + public final String recordName; + + protected ItemRecord(String name) + { + this.recordName = name; + this.maxStackSize = 1; + this.setCreativeTab(CreativeTabs.tabMisc); + RECORDS.put("records." + name, this); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == Blocks.jukebox && !((Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)).booleanValue()) + { + if (worldIn.isRemote) + { + return true; + } + else + { + ((BlockJukebox)Blocks.jukebox).insertRecord(worldIn, pos, iblockstate, stack); + worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1005, pos, Item.getIdFromItem(this)); + --stack.stackSize; + playerIn.triggerAchievement(StatList.field_181740_X); + return true; + } + } + else + { + return false; + } + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) + { + tooltip.add(this.getRecordNameLocal()); + } + + public String getRecordNameLocal() + { + return StatCollector.translateToLocal("item.record." + this.recordName + ".desc"); + } + + /** + * Return an item rarity from EnumRarity + */ + public EnumRarity getRarity(ItemStack stack) + { + return EnumRarity.RARE; + } + + /** + * Return the record item corresponding to the given name. + */ + public static ItemRecord getRecord(String name) + { + return (ItemRecord)RECORDS.get(name); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemRedstone.java b/src/minecraft/net/minecraft/item/ItemRedstone.java new file mode 100644 index 0000000..ea4243e --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemRedstone.java @@ -0,0 +1,51 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemRedstone extends Item +{ + public ItemRedstone() + { + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + boolean flag = worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos); + BlockPos blockpos = flag ? pos : pos.offset(side); + + if (!playerIn.canPlayerEdit(blockpos, side, stack)) + { + return false; + } + else + { + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (!worldIn.canBlockBePlaced(block, blockpos, false, side, (Entity)null, stack)) + { + return false; + } + else if (Blocks.redstone_wire.canPlaceBlockAt(worldIn, blockpos)) + { + --stack.stackSize; + worldIn.setBlockState(blockpos, Blocks.redstone_wire.getDefaultState()); + return true; + } + else + { + return false; + } + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemReed.java b/src/minecraft/net/minecraft/item/ItemReed.java new file mode 100644 index 0000000..a0db6cc --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemReed.java @@ -0,0 +1,72 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockSnow; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemReed extends Item +{ + private Block block; + + public ItemReed(Block block) + { + this.block = block; + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if (block == Blocks.snow_layer && ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() < 1) + { + side = EnumFacing.UP; + } + else if (!block.isReplaceable(worldIn, pos)) + { + pos = pos.offset(side); + } + + if (!playerIn.canPlayerEdit(pos, side, stack)) + { + return false; + } + else if (stack.stackSize == 0) + { + return false; + } + else + { + if (worldIn.canBlockBePlaced(this.block, pos, false, side, (Entity)null, stack)) + { + IBlockState iblockstate1 = this.block.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, 0, playerIn); + + if (worldIn.setBlockState(pos, iblockstate1, 3)) + { + iblockstate1 = worldIn.getBlockState(pos); + + if (iblockstate1.getBlock() == this.block) + { + ItemBlock.setTileEntityNBT(worldIn, playerIn, pos, stack); + iblockstate1.getBlock().onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn, stack); + } + + worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); + --stack.stackSize; + return true; + } + } + + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemSaddle.java b/src/minecraft/net/minecraft/item/ItemSaddle.java new file mode 100644 index 0000000..5a9132e --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemSaddle.java @@ -0,0 +1,49 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.player.EntityPlayer; + +public class ItemSaddle extends Item +{ + public ItemSaddle() + { + this.maxStackSize = 1; + this.setCreativeTab(CreativeTabs.tabTransport); + } + + /** + * Returns true if the item can be used on the given entity, e.g. shears on sheep. + */ + public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target) + { + if (target instanceof EntityPig) + { + EntityPig entitypig = (EntityPig)target; + + if (!entitypig.getSaddled() && !entitypig.isChild()) + { + entitypig.setSaddled(true); + entitypig.worldObj.playSoundAtEntity(entitypig, "mob.horse.leather", 0.5F, 1.0F); + --stack.stackSize; + } + + return true; + } + else + { + return false; + } + } + + /** + * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise + * the damage on the stack. + */ + public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) + { + this.itemInteractionForEntity(stack, (EntityPlayer)null, target); + return true; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemSeedFood.java b/src/minecraft/net/minecraft/item/ItemSeedFood.java new file mode 100644 index 0000000..32633d3 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemSeedFood.java @@ -0,0 +1,47 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemSeedFood extends ItemFood +{ + private Block crops; + + /** Block ID of the soil this seed food should be planted on. */ + private Block soilId; + + public ItemSeedFood(int healAmount, float saturation, Block crops, Block soil) + { + super(healAmount, saturation, false); + this.crops = crops; + this.soilId = soil; + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (side != EnumFacing.UP) + { + return false; + } + else if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) + { + return false; + } + else if (worldIn.getBlockState(pos).getBlock() == this.soilId && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; + return true; + } + else + { + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemSeeds.java b/src/minecraft/net/minecraft/item/ItemSeeds.java new file mode 100644 index 0000000..355618e --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemSeeds.java @@ -0,0 +1,48 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemSeeds extends Item +{ + private Block crops; + + /** BlockID of the block the seeds can be planted on. */ + private Block soilBlockID; + + public ItemSeeds(Block crops, Block soil) + { + this.crops = crops; + this.soilBlockID = soil; + this.setCreativeTab(CreativeTabs.tabMaterials); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (side != EnumFacing.UP) + { + return false; + } + else if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) + { + return false; + } + else if (worldIn.getBlockState(pos).getBlock() == this.soilBlockID && worldIn.isAirBlock(pos.up())) + { + worldIn.setBlockState(pos.up(), this.crops.getDefaultState()); + --stack.stackSize; + return true; + } + else + { + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemShears.java b/src/minecraft/net/minecraft/item/ItemShears.java new file mode 100644 index 0000000..22124af --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemShears.java @@ -0,0 +1,48 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class ItemShears extends Item +{ + public ItemShears() + { + this.setMaxStackSize(1); + this.setMaxDamage(238); + this.setCreativeTab(CreativeTabs.tabTools); + } + + /** + * Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic. + */ + public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) + { + if (blockIn.getMaterial() != Material.leaves && blockIn != Blocks.web && blockIn != Blocks.tallgrass && blockIn != Blocks.vine && blockIn != Blocks.tripwire && blockIn != Blocks.wool) + { + return super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn); + } + else + { + stack.damageItem(1, playerIn); + return true; + } + } + + /** + * Check whether this Item can harvest the given Block + */ + public boolean canHarvestBlock(Block blockIn) + { + return blockIn == Blocks.web || blockIn == Blocks.redstone_wire || blockIn == Blocks.tripwire; + } + + public float getStrVsBlock(ItemStack stack, Block block) + { + return block != Blocks.web && block.getMaterial() != Material.leaves ? (block == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, block)) : 15.0F; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemSign.java b/src/minecraft/net/minecraft/item/ItemSign.java new file mode 100644 index 0000000..146aa58 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemSign.java @@ -0,0 +1,76 @@ +package net.minecraft.item; + +import net.minecraft.block.BlockStandingSign; +import net.minecraft.block.BlockWallSign; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class ItemSign extends Item +{ + public ItemSign() + { + this.maxStackSize = 16; + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (side == EnumFacing.DOWN) + { + return false; + } + else if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid()) + { + return false; + } + else + { + pos = pos.offset(side); + + if (!playerIn.canPlayerEdit(pos, side, stack)) + { + return false; + } + else if (!Blocks.standing_sign.canPlaceBlockAt(worldIn, pos)) + { + return false; + } + else if (worldIn.isRemote) + { + return true; + } + else + { + if (side == EnumFacing.UP) + { + int i = MathHelper.floor_double((double)((playerIn.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15; + worldIn.setBlockState(pos, Blocks.standing_sign.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3); + } + else + { + worldIn.setBlockState(pos, Blocks.wall_sign.getDefaultState().withProperty(BlockWallSign.FACING, side), 3); + } + + --stack.stackSize; + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, playerIn, pos, stack)) + { + playerIn.openEditSign((TileEntitySign)tileentity); + } + + return true; + } + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemSimpleFoiled.java b/src/minecraft/net/minecraft/item/ItemSimpleFoiled.java new file mode 100644 index 0000000..4f5e2ae --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemSimpleFoiled.java @@ -0,0 +1,9 @@ +package net.minecraft.item; + +public class ItemSimpleFoiled extends Item +{ + public boolean hasEffect(ItemStack stack) + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemSkull.java b/src/minecraft/net/minecraft/item/ItemSkull.java new file mode 100644 index 0000000..c1bab5c --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemSkull.java @@ -0,0 +1,199 @@ +package net.minecraft.item; + +import com.mojang.authlib.GameProfile; +import java.util.List; +import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.block.BlockSkull; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntitySkull; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class ItemSkull extends Item +{ + private static final String[] skullTypes = new String[] {"skeleton", "wither", "zombie", "char", "creeper"}; + + public ItemSkull() + { + this.setCreativeTab(CreativeTabs.tabDecorations); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (side == EnumFacing.DOWN) + { + return false; + } + else + { + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + boolean flag = block.isReplaceable(worldIn, pos); + + if (!flag) + { + if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid()) + { + return false; + } + + pos = pos.offset(side); + } + + if (!playerIn.canPlayerEdit(pos, side, stack)) + { + return false; + } + else if (!Blocks.skull.canPlaceBlockAt(worldIn, pos)) + { + return false; + } + else + { + if (!worldIn.isRemote) + { + worldIn.setBlockState(pos, Blocks.skull.getDefaultState().withProperty(BlockSkull.FACING, side), 3); + int i = 0; + + if (side == EnumFacing.UP) + { + i = MathHelper.floor_double((double)(playerIn.rotationYaw * 16.0F / 360.0F) + 0.5D) & 15; + } + + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntitySkull) + { + TileEntitySkull tileentityskull = (TileEntitySkull)tileentity; + + if (stack.getMetadata() == 3) + { + GameProfile gameprofile = null; + + if (stack.hasTagCompound()) + { + NBTTagCompound nbttagcompound = stack.getTagCompound(); + + if (nbttagcompound.hasKey("SkullOwner", 10)) + { + gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner")); + } + else if (nbttagcompound.hasKey("SkullOwner", 8) && nbttagcompound.getString("SkullOwner").length() > 0) + { + gameprofile = new GameProfile((UUID)null, nbttagcompound.getString("SkullOwner")); + } + } + + tileentityskull.setPlayerProfile(gameprofile); + } + else + { + tileentityskull.setType(stack.getMetadata()); + } + + tileentityskull.setSkullRotation(i); + Blocks.skull.checkWitherSpawn(worldIn, pos, tileentityskull); + } + + --stack.stackSize; + } + + return true; + } + } + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) + { + for (int i = 0; i < skullTypes.length; ++i) + { + subItems.add(new ItemStack(itemIn, 1, i)); + } + } + + /** + * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is + * placed as a Block (mostly used with ItemBlocks). + */ + public int getMetadata(int damage) + { + return damage; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack stack) + { + int i = stack.getMetadata(); + + if (i < 0 || i >= skullTypes.length) + { + i = 0; + } + + return super.getUnlocalizedName() + "." + skullTypes[i]; + } + + public String getItemStackDisplayName(ItemStack stack) + { + if (stack.getMetadata() == 3 && stack.hasTagCompound()) + { + if (stack.getTagCompound().hasKey("SkullOwner", 8)) + { + return StatCollector.translateToLocalFormatted("item.skull.player.name", new Object[] {stack.getTagCompound().getString("SkullOwner")}); + } + + if (stack.getTagCompound().hasKey("SkullOwner", 10)) + { + NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("SkullOwner"); + + if (nbttagcompound.hasKey("Name", 8)) + { + return StatCollector.translateToLocalFormatted("item.skull.player.name", new Object[] {nbttagcompound.getString("Name")}); + } + } + } + + return super.getItemStackDisplayName(stack); + } + + /** + * Called when an ItemStack with NBT data is read to potentially that ItemStack's NBT data + */ + public boolean updateItemStackNBT(NBTTagCompound nbt) + { + super.updateItemStackNBT(nbt); + + if (nbt.hasKey("SkullOwner", 8) && nbt.getString("SkullOwner").length() > 0) + { + GameProfile gameprofile = new GameProfile((UUID)null, nbt.getString("SkullOwner")); + gameprofile = TileEntitySkull.updateGameprofile(gameprofile); + nbt.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile)); + return true; + } + else + { + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemSlab.java b/src/minecraft/net/minecraft/item/ItemSlab.java new file mode 100644 index 0000000..a96649f --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemSlab.java @@ -0,0 +1,132 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockSlab; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemSlab extends ItemBlock +{ + private final BlockSlab singleSlab; + private final BlockSlab doubleSlab; + + public ItemSlab(Block block, BlockSlab singleSlab, BlockSlab doubleSlab) + { + super(block); + this.singleSlab = singleSlab; + this.doubleSlab = doubleSlab; + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + /** + * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is + * placed as a Block (mostly used with ItemBlocks). + */ + public int getMetadata(int damage) + { + return damage; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack stack) + { + return this.singleSlab.getUnlocalizedName(stack.getMetadata()); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (stack.stackSize == 0) + { + return false; + } + else if (!playerIn.canPlayerEdit(pos.offset(side), side, stack)) + { + return false; + } + else + { + Object object = this.singleSlab.getVariant(stack); + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == this.singleSlab) + { + IProperty iproperty = this.singleSlab.getVariantProperty(); + Comparable comparable = iblockstate.getValue(iproperty); + BlockSlab.EnumBlockHalf blockslab$enumblockhalf = (BlockSlab.EnumBlockHalf)iblockstate.getValue(BlockSlab.HALF); + + if ((side == EnumFacing.UP && blockslab$enumblockhalf == BlockSlab.EnumBlockHalf.BOTTOM || side == EnumFacing.DOWN && blockslab$enumblockhalf == BlockSlab.EnumBlockHalf.TOP) && comparable == object) + { + IBlockState iblockstate1 = this.doubleSlab.getDefaultState().withProperty(iproperty, comparable); + + if (worldIn.checkNoEntityCollision(this.doubleSlab.getCollisionBoundingBox(worldIn, pos, iblockstate1)) && worldIn.setBlockState(pos, iblockstate1, 3)) + { + worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.doubleSlab.stepSound.getPlaceSound(), (this.doubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, this.doubleSlab.stepSound.getFrequency() * 0.8F); + --stack.stackSize; + } + + return true; + } + } + + return this.tryPlace(stack, worldIn, pos.offset(side), object) ? true : super.onItemUse(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + } + } + + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) + { + BlockPos blockpos = pos; + IProperty iproperty = this.singleSlab.getVariantProperty(); + Object object = this.singleSlab.getVariant(stack); + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == this.singleSlab) + { + boolean flag = iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP; + + if ((side == EnumFacing.UP && !flag || side == EnumFacing.DOWN && flag) && object == iblockstate.getValue(iproperty)) + { + return true; + } + } + + pos = pos.offset(side); + IBlockState iblockstate1 = worldIn.getBlockState(pos); + return iblockstate1.getBlock() == this.singleSlab && object == iblockstate1.getValue(iproperty) ? true : super.canPlaceBlockOnSide(worldIn, blockpos, side, player, stack); + } + + private boolean tryPlace(ItemStack stack, World worldIn, BlockPos pos, Object variantInStack) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock() == this.singleSlab) + { + Comparable comparable = iblockstate.getValue(this.singleSlab.getVariantProperty()); + + if (comparable == variantInStack) + { + IBlockState iblockstate1 = this.doubleSlab.getDefaultState().withProperty((IProperty)this.singleSlab.getVariantProperty(), comparable); + + if (worldIn.checkNoEntityCollision(this.doubleSlab.getCollisionBoundingBox(worldIn, pos, iblockstate1)) && worldIn.setBlockState(pos, iblockstate1, 3)) + { + worldIn.playSoundEffect((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), this.doubleSlab.stepSound.getPlaceSound(), (this.doubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, this.doubleSlab.stepSound.getFrequency() * 0.8F); + --stack.stackSize; + } + + return true; + } + } + + return false; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemSnow.java b/src/minecraft/net/minecraft/item/ItemSnow.java new file mode 100644 index 0000000..3c139f2 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemSnow.java @@ -0,0 +1,77 @@ +package net.minecraft.item; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockSnow; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class ItemSnow extends ItemBlock +{ + public ItemSnow(Block block) + { + super(block); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + /** + * Called when a Block is right-clicked with this Item + */ + public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + if (stack.stackSize == 0) + { + return false; + } + else if (!playerIn.canPlayerEdit(pos, side, stack)) + { + return false; + } + else + { + IBlockState iblockstate = worldIn.getBlockState(pos); + Block block = iblockstate.getBlock(); + BlockPos blockpos = pos; + + if ((side != EnumFacing.UP || block != this.block) && !block.isReplaceable(worldIn, pos)) + { + blockpos = pos.offset(side); + iblockstate = worldIn.getBlockState(blockpos); + block = iblockstate.getBlock(); + } + + if (block == this.block) + { + int i = ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue(); + + if (i <= 7) + { + IBlockState iblockstate1 = iblockstate.withProperty(BlockSnow.LAYERS, Integer.valueOf(i + 1)); + AxisAlignedBB axisalignedbb = this.block.getCollisionBoundingBox(worldIn, blockpos, iblockstate1); + + if (axisalignedbb != null && worldIn.checkNoEntityCollision(axisalignedbb) && worldIn.setBlockState(blockpos, iblockstate1, 2)) + { + worldIn.playSoundEffect((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F), this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getFrequency() * 0.8F); + --stack.stackSize; + return true; + } + } + } + + return super.onItemUse(stack, playerIn, worldIn, blockpos, side, hitX, hitY, hitZ); + } + } + + /** + * Converts the given ItemStack damage value into a metadata value to be placed in the world when this Item is + * placed as a Block (mostly used with ItemBlocks). + */ + public int getMetadata(int damage) + { + return damage; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemSnowball.java b/src/minecraft/net/minecraft/item/ItemSnowball.java new file mode 100644 index 0000000..6523a0e --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemSnowball.java @@ -0,0 +1,37 @@ +package net.minecraft.item; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntitySnowball; +import net.minecraft.stats.StatList; +import net.minecraft.world.World; + +public class ItemSnowball extends Item +{ + public ItemSnowball() + { + this.maxStackSize = 16; + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + if (!playerIn.capabilities.isCreativeMode) + { + --itemStackIn.stackSize; + } + + worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!worldIn.isRemote) + { + worldIn.spawnEntityInWorld(new EntitySnowball(worldIn, playerIn)); + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return itemStackIn; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemSoup.java b/src/minecraft/net/minecraft/item/ItemSoup.java new file mode 100644 index 0000000..0143ab7 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemSoup.java @@ -0,0 +1,24 @@ +package net.minecraft.item; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.world.World; + +public class ItemSoup extends ItemFood +{ + public ItemSoup(int healAmount) + { + super(healAmount, false); + this.setMaxStackSize(1); + } + + /** + * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using + * the Item before the action is complete. + */ + public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn) + { + super.onItemUseFinish(stack, worldIn, playerIn); + return new ItemStack(Items.bowl); + } +} diff --git a/src/minecraft/net/minecraft/item/ItemSpade.java b/src/minecraft/net/minecraft/item/ItemSpade.java new file mode 100644 index 0000000..8222ce7 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemSpade.java @@ -0,0 +1,24 @@ +package net.minecraft.item; + +import com.google.common.collect.Sets; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; + +public class ItemSpade extends ItemTool +{ + private static final Set EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.clay, Blocks.dirt, Blocks.farmland, Blocks.grass, Blocks.gravel, Blocks.mycelium, Blocks.sand, Blocks.snow, Blocks.snow_layer, Blocks.soul_sand}); + + public ItemSpade(Item.ToolMaterial material) + { + super(1.0F, material, EFFECTIVE_ON); + } + + /** + * Check whether this Item can harvest the given Block + */ + public boolean canHarvestBlock(Block blockIn) + { + return blockIn == Blocks.snow_layer ? true : blockIn == Blocks.snow; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemStack.java b/src/minecraft/net/minecraft/item/ItemStack.java new file mode 100644 index 0000000..3d32e09 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemStack.java @@ -0,0 +1,1086 @@ +package net.minecraft.item; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Lists; +import com.google.common.collect.Multimap; +import java.text.DecimalFormat; +import java.util.List; +import java.util.Random; +import java.util.Map.Entry; +import net.minecraft.block.Block; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentDurability; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.event.HoverEvent; +import net.minecraft.init.Items; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.stats.StatList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public final class ItemStack +{ + public static final DecimalFormat DECIMALFORMAT = new DecimalFormat("#.###"); + + /** Size of the stack. */ + public int stackSize; + + /** + * Number of animation frames to go when receiving an item (by walking into it, for example). + */ + public int animationsToGo; + private Item item; + + /** + * A NBTTagMap containing data about an ItemStack. Can only be used for non stackable items + */ + private NBTTagCompound stackTagCompound; + private int itemDamage; + + /** Item frame this stack is on, or null if not on an item frame. */ + private EntityItemFrame itemFrame; + private Block canDestroyCacheBlock; + private boolean canDestroyCacheResult; + private Block canPlaceOnCacheBlock; + private boolean canPlaceOnCacheResult; + + public ItemStack(Block blockIn) + { + this((Block)blockIn, 1); + } + + public ItemStack(Block blockIn, int amount) + { + this((Block)blockIn, amount, 0); + } + + public ItemStack(Block blockIn, int amount, int meta) + { + this(Item.getItemFromBlock(blockIn), amount, meta); + } + + public ItemStack(Item itemIn) + { + this((Item)itemIn, 1); + } + + public ItemStack(Item itemIn, int amount) + { + this((Item)itemIn, amount, 0); + } + + public ItemStack(Item itemIn, int amount, int meta) + { + this.canDestroyCacheBlock = null; + this.canDestroyCacheResult = false; + this.canPlaceOnCacheBlock = null; + this.canPlaceOnCacheResult = false; + this.item = itemIn; + this.stackSize = amount; + this.itemDamage = meta; + + if (this.itemDamage < 0) + { + this.itemDamage = 0; + } + } + + public static ItemStack loadItemStackFromNBT(NBTTagCompound nbt) + { + ItemStack itemstack = new ItemStack(); + itemstack.readFromNBT(nbt); + return itemstack.getItem() != null ? itemstack : null; + } + + private ItemStack() + { + this.canDestroyCacheBlock = null; + this.canDestroyCacheResult = false; + this.canPlaceOnCacheBlock = null; + this.canPlaceOnCacheResult = false; + } + + /** + * Splits off a stack of the given amount of this stack and reduces this stack by the amount. + */ + public ItemStack splitStack(int amount) + { + ItemStack itemstack = new ItemStack(this.item, amount, this.itemDamage); + + if (this.stackTagCompound != null) + { + itemstack.stackTagCompound = (NBTTagCompound)this.stackTagCompound.copy(); + } + + this.stackSize -= amount; + return itemstack; + } + + /** + * Returns the object corresponding to the stack. + */ + public Item getItem() + { + return this.item; + } + + /** + * Called when the player uses this ItemStack on a Block (right-click). Places blocks, etc. (Legacy name: + * tryPlaceItemIntoWorld) + */ + public boolean onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + { + boolean flag = this.getItem().onItemUse(this, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + + if (flag) + { + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this.item)]); + } + + return flag; + } + + public float getStrVsBlock(Block blockIn) + { + return this.getItem().getStrVsBlock(this, blockIn); + } + + /** + * Called whenever this item stack is equipped and right clicked. Returns the new item stack to put in the position + * where this item is. Args: world, player + */ + public ItemStack useItemRightClick(World worldIn, EntityPlayer playerIn) + { + return this.getItem().onItemRightClick(this, worldIn, playerIn); + } + + /** + * Called when the item in use count reach 0, e.g. item food eaten. Return the new ItemStack. Args : world, entity + */ + public ItemStack onItemUseFinish(World worldIn, EntityPlayer playerIn) + { + return this.getItem().onItemUseFinish(this, worldIn, playerIn); + } + + /** + * Write the stack fields to a NBT object. Return the new NBT object. + */ + public NBTTagCompound writeToNBT(NBTTagCompound nbt) + { + ResourceLocation resourcelocation = (ResourceLocation)Item.itemRegistry.getNameForObject(this.item); + nbt.setString("id", resourcelocation == null ? "minecraft:air" : resourcelocation.toString()); + nbt.setByte("Count", (byte)this.stackSize); + nbt.setShort("Damage", (short)this.itemDamage); + + if (this.stackTagCompound != null) + { + nbt.setTag("tag", this.stackTagCompound); + } + + return nbt; + } + + /** + * Read the stack fields from a NBT object. + */ + public void readFromNBT(NBTTagCompound nbt) + { + if (nbt.hasKey("id", 8)) + { + this.item = Item.getByNameOrId(nbt.getString("id")); + } + else + { + this.item = Item.getItemById(nbt.getShort("id")); + } + + this.stackSize = nbt.getByte("Count"); + this.itemDamage = nbt.getShort("Damage"); + + if (this.itemDamage < 0) + { + this.itemDamage = 0; + } + + if (nbt.hasKey("tag", 10)) + { + this.stackTagCompound = nbt.getCompoundTag("tag"); + + if (this.item != null) + { + this.item.updateItemStackNBT(this.stackTagCompound); + } + } + } + + /** + * Returns maximum size of the stack. + */ + public int getMaxStackSize() + { + return this.getItem().getItemStackLimit(); + } + + /** + * Returns true if the ItemStack can hold 2 or more units of the item. + */ + public boolean isStackable() + { + return this.getMaxStackSize() > 1 && (!this.isItemStackDamageable() || !this.isItemDamaged()); + } + + /** + * true if this itemStack is damageable + */ + public boolean isItemStackDamageable() + { + return this.item == null ? false : (this.item.getMaxDamage() <= 0 ? false : !this.hasTagCompound() || !this.getTagCompound().getBoolean("Unbreakable")); + } + + public boolean getHasSubtypes() + { + return this.item.getHasSubtypes(); + } + + /** + * returns true when a damageable item is damaged + */ + public boolean isItemDamaged() + { + return this.isItemStackDamageable() && this.itemDamage > 0; + } + + public int getItemDamage() + { + return this.itemDamage; + } + + public int getMetadata() + { + return this.itemDamage; + } + + public void setItemDamage(int meta) + { + this.itemDamage = meta; + + if (this.itemDamage < 0) + { + this.itemDamage = 0; + } + } + + /** + * Returns the max damage an item in the stack can take. + */ + public int getMaxDamage() + { + return this.item.getMaxDamage(); + } + + /** + * Attempts to damage the ItemStack with par1 amount of damage, If the ItemStack has the Unbreaking enchantment + * there is a chance for each point of damage to be negated. Returns true if it takes more damage than + * getMaxDamage(). Returns false otherwise or if the ItemStack can't be damaged or if all points of damage are + * negated. + */ + public boolean attemptDamageItem(int amount, Random rand) + { + if (!this.isItemStackDamageable()) + { + return false; + } + else + { + if (amount > 0) + { + int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, this); + int j = 0; + + for (int k = 0; i > 0 && k < amount; ++k) + { + if (EnchantmentDurability.negateDamage(this, i, rand)) + { + ++j; + } + } + + amount -= j; + + if (amount <= 0) + { + return false; + } + } + + this.itemDamage += amount; + return this.itemDamage > this.getMaxDamage(); + } + } + + /** + * Damages the item in the ItemStack + */ + public void damageItem(int amount, EntityLivingBase entityIn) + { + if (!(entityIn instanceof EntityPlayer) || !((EntityPlayer)entityIn).capabilities.isCreativeMode) + { + if (this.isItemStackDamageable()) + { + if (this.attemptDamageItem(amount, entityIn.getRNG())) + { + entityIn.renderBrokenItemStack(this); + --this.stackSize; + + if (entityIn instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)entityIn; + entityplayer.triggerAchievement(StatList.objectBreakStats[Item.getIdFromItem(this.item)]); + + if (this.stackSize == 0 && this.getItem() instanceof ItemBow) + { + entityplayer.destroyCurrentEquippedItem(); + } + } + + if (this.stackSize < 0) + { + this.stackSize = 0; + } + + this.itemDamage = 0; + } + } + } + } + + /** + * Calls the corresponding fct in di + */ + public void hitEntity(EntityLivingBase entityIn, EntityPlayer playerIn) + { + boolean flag = this.item.hitEntity(this, entityIn, playerIn); + + if (flag) + { + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this.item)]); + } + } + + /** + * Called when a Block is destroyed using this ItemStack + */ + public void onBlockDestroyed(World worldIn, Block blockIn, BlockPos pos, EntityPlayer playerIn) + { + boolean flag = this.item.onBlockDestroyed(this, worldIn, blockIn, pos, playerIn); + + if (flag) + { + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this.item)]); + } + } + + /** + * Check whether the given Block can be harvested using this ItemStack. + */ + public boolean canHarvestBlock(Block blockIn) + { + return this.item.canHarvestBlock(blockIn); + } + + public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn) + { + return this.item.itemInteractionForEntity(this, playerIn, entityIn); + } + + /** + * Returns a new stack with the same properties. + */ + public ItemStack copy() + { + ItemStack itemstack = new ItemStack(this.item, this.stackSize, this.itemDamage); + + if (this.stackTagCompound != null) + { + itemstack.stackTagCompound = (NBTTagCompound)this.stackTagCompound.copy(); + } + + return itemstack; + } + + public static boolean areItemStackTagsEqual(ItemStack stackA, ItemStack stackB) + { + return stackA == null && stackB == null ? true : (stackA != null && stackB != null ? (stackA.stackTagCompound == null && stackB.stackTagCompound != null ? false : stackA.stackTagCompound == null || stackA.stackTagCompound.equals(stackB.stackTagCompound)) : false); + } + + /** + * compares ItemStack argument1 with ItemStack argument2; returns true if both ItemStacks are equal + */ + public static boolean areItemStacksEqual(ItemStack stackA, ItemStack stackB) + { + return stackA == null && stackB == null ? true : (stackA != null && stackB != null ? stackA.isItemStackEqual(stackB) : false); + } + + /** + * compares ItemStack argument to the instance ItemStack; returns true if both ItemStacks are equal + */ + private boolean isItemStackEqual(ItemStack other) + { + return this.stackSize != other.stackSize ? false : (this.item != other.item ? false : (this.itemDamage != other.itemDamage ? false : (this.stackTagCompound == null && other.stackTagCompound != null ? false : this.stackTagCompound == null || this.stackTagCompound.equals(other.stackTagCompound)))); + } + + /** + * Compares Item and damage value of the two stacks + */ + public static boolean areItemsEqual(ItemStack stackA, ItemStack stackB) + { + return stackA == null && stackB == null ? true : (stackA != null && stackB != null ? stackA.isItemEqual(stackB) : false); + } + + /** + * compares ItemStack argument to the instance ItemStack; returns true if the Items contained in both ItemStacks are + * equal + */ + public boolean isItemEqual(ItemStack other) + { + return other != null && this.item == other.item && this.itemDamage == other.itemDamage; + } + + public String getUnlocalizedName() + { + return this.item.getUnlocalizedName(this); + } + + /** + * Creates a copy of a ItemStack, a null parameters will return a null. + */ + public static ItemStack copyItemStack(ItemStack stack) + { + return stack == null ? null : stack.copy(); + } + + public String toString() + { + return this.stackSize + "x" + this.item.getUnlocalizedName() + "@" + this.itemDamage; + } + + /** + * Called each tick as long the ItemStack in on player inventory. Used to progress the pickup animation and update + * maps. + */ + public void updateAnimation(World worldIn, Entity entityIn, int inventorySlot, boolean isCurrentItem) + { + if (this.animationsToGo > 0) + { + --this.animationsToGo; + } + + this.item.onUpdate(this, worldIn, entityIn, inventorySlot, isCurrentItem); + } + + public void onCrafting(World worldIn, EntityPlayer playerIn, int amount) + { + playerIn.addStat(StatList.objectCraftStats[Item.getIdFromItem(this.item)], amount); + this.item.onCreated(this, worldIn, playerIn); + } + + public boolean getIsItemStackEqual(ItemStack p_179549_1_) + { + return this.isItemStackEqual(p_179549_1_); + } + + public int getMaxItemUseDuration() + { + return this.getItem().getMaxItemUseDuration(this); + } + + public EnumAction getItemUseAction() + { + return this.getItem().getItemUseAction(this); + } + + /** + * Called when the player releases the use item button. Args: world, entityplayer, itemInUseCount + */ + public void onPlayerStoppedUsing(World worldIn, EntityPlayer playerIn, int timeLeft) + { + this.getItem().onPlayerStoppedUsing(this, worldIn, playerIn, timeLeft); + } + + /** + * Returns true if the ItemStack has an NBTTagCompound. Currently used to store enchantments. + */ + public boolean hasTagCompound() + { + return this.stackTagCompound != null; + } + + /** + * Returns the NBTTagCompound of the ItemStack. + */ + public NBTTagCompound getTagCompound() + { + return this.stackTagCompound; + } + + /** + * Get an NBTTagCompound from this stack's NBT data. + */ + public NBTTagCompound getSubCompound(String key, boolean create) + { + if (this.stackTagCompound != null && this.stackTagCompound.hasKey(key, 10)) + { + return this.stackTagCompound.getCompoundTag(key); + } + else if (create) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + this.setTagInfo(key, nbttagcompound); + return nbttagcompound; + } + else + { + return null; + } + } + + public NBTTagList getEnchantmentTagList() + { + return this.stackTagCompound == null ? null : this.stackTagCompound.getTagList("ench", 10); + } + + /** + * Assigns a NBTTagCompound to the ItemStack, minecraft validates that only non-stackable items can have it. + */ + public void setTagCompound(NBTTagCompound nbt) + { + this.stackTagCompound = nbt; + } + + /** + * returns the display name of the itemstack + */ + public String getDisplayName() + { + String s = this.getItem().getItemStackDisplayName(this); + + if (this.stackTagCompound != null && this.stackTagCompound.hasKey("display", 10)) + { + NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display"); + + if (nbttagcompound.hasKey("Name", 8)) + { + s = nbttagcompound.getString("Name"); + } + } + + return s; + } + + public ItemStack setStackDisplayName(String displayName) + { + if (this.stackTagCompound == null) + { + this.stackTagCompound = new NBTTagCompound(); + } + + if (!this.stackTagCompound.hasKey("display", 10)) + { + this.stackTagCompound.setTag("display", new NBTTagCompound()); + } + + this.stackTagCompound.getCompoundTag("display").setString("Name", displayName); + return this; + } + + /** + * Clear any custom name set for this ItemStack + */ + public void clearCustomName() + { + if (this.stackTagCompound != null) + { + if (this.stackTagCompound.hasKey("display", 10)) + { + NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display"); + nbttagcompound.removeTag("Name"); + + if (nbttagcompound.hasNoTags()) + { + this.stackTagCompound.removeTag("display"); + + if (this.stackTagCompound.hasNoTags()) + { + this.setTagCompound((NBTTagCompound)null); + } + } + } + } + } + + /** + * Returns true if the itemstack has a display name + */ + public boolean hasDisplayName() + { + return this.stackTagCompound == null ? false : (!this.stackTagCompound.hasKey("display", 10) ? false : this.stackTagCompound.getCompoundTag("display").hasKey("Name", 8)); + } + + public List getTooltip(EntityPlayer playerIn, boolean advanced) + { + List list = Lists.newArrayList(); + String s = this.getDisplayName(); + + if (this.hasDisplayName()) + { + s = EnumChatFormatting.ITALIC + s; + } + + s = s + EnumChatFormatting.RESET; + + if (advanced) + { + String s1 = ""; + + if (s.length() > 0) + { + s = s + " ("; + s1 = ")"; + } + + int i = Item.getIdFromItem(this.item); + + if (this.getHasSubtypes()) + { + s = s + String.format("#%04d/%d%s", new Object[] {Integer.valueOf(i), Integer.valueOf(this.itemDamage), s1}); + } + else + { + s = s + String.format("#%04d%s", new Object[] {Integer.valueOf(i), s1}); + } + } + else if (!this.hasDisplayName() && this.item == Items.filled_map) + { + s = s + " #" + this.itemDamage; + } + + list.add(s); + int i1 = 0; + + if (this.hasTagCompound() && this.stackTagCompound.hasKey("HideFlags", 99)) + { + i1 = this.stackTagCompound.getInteger("HideFlags"); + } + + if ((i1 & 32) == 0) + { + this.item.addInformation(this, playerIn, list, advanced); + } + + if (this.hasTagCompound()) + { + if ((i1 & 1) == 0) + { + NBTTagList nbttaglist = this.getEnchantmentTagList(); + + if (nbttaglist != null) + { + for (int j = 0; j < nbttaglist.tagCount(); ++j) + { + int k = nbttaglist.getCompoundTagAt(j).getShort("id"); + int l = nbttaglist.getCompoundTagAt(j).getShort("lvl"); + + if (Enchantment.getEnchantmentById(k) != null) + { + list.add(Enchantment.getEnchantmentById(k).getTranslatedName(l)); + } + } + } + } + + if (this.stackTagCompound.hasKey("display", 10)) + { + NBTTagCompound nbttagcompound = this.stackTagCompound.getCompoundTag("display"); + + if (nbttagcompound.hasKey("color", 3)) + { + if (advanced) + { + list.add("Color: #" + Integer.toHexString(nbttagcompound.getInteger("color")).toUpperCase()); + } + else + { + list.add(EnumChatFormatting.ITALIC + StatCollector.translateToLocal("item.dyed")); + } + } + + if (nbttagcompound.getTagId("Lore") == 9) + { + NBTTagList nbttaglist1 = nbttagcompound.getTagList("Lore", 8); + + if (nbttaglist1.tagCount() > 0) + { + for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1) + { + list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + nbttaglist1.getStringTagAt(j1)); + } + } + } + } + } + + Multimap multimap = this.getAttributeModifiers(); + + if (!multimap.isEmpty() && (i1 & 2) == 0) + { + list.add(""); + + for (Entry entry : multimap.entries()) + { + AttributeModifier attributemodifier = (AttributeModifier)entry.getValue(); + double d0 = attributemodifier.getAmount(); + + if (attributemodifier.getID() == Item.itemModifierUUID) + { + d0 += (double)EnchantmentHelper.func_152377_a(this, EnumCreatureAttribute.UNDEFINED); + } + + double d1; + + if (attributemodifier.getOperation() != 1 && attributemodifier.getOperation() != 2) + { + d1 = d0; + } + else + { + d1 = d0 * 100.0D; + } + + if (d0 > 0.0D) + { + list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier.getOperation(), new Object[] {DECIMALFORMAT.format(d1), StatCollector.translateToLocal("attribute.name." + (String)entry.getKey())})); + } + else if (d0 < 0.0D) + { + d1 = d1 * -1.0D; + list.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted("attribute.modifier.take." + attributemodifier.getOperation(), new Object[] {DECIMALFORMAT.format(d1), StatCollector.translateToLocal("attribute.name." + (String)entry.getKey())})); + } + } + } + + if (this.hasTagCompound() && this.getTagCompound().getBoolean("Unbreakable") && (i1 & 4) == 0) + { + list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocal("item.unbreakable")); + } + + if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanDestroy", 9) && (i1 & 8) == 0) + { + NBTTagList nbttaglist2 = this.stackTagCompound.getTagList("CanDestroy", 8); + + if (nbttaglist2.tagCount() > 0) + { + list.add(""); + list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("item.canBreak")); + + for (int k1 = 0; k1 < nbttaglist2.tagCount(); ++k1) + { + Block block = Block.getBlockFromName(nbttaglist2.getStringTagAt(k1)); + + if (block != null) + { + list.add(EnumChatFormatting.DARK_GRAY + block.getLocalizedName()); + } + else + { + list.add(EnumChatFormatting.DARK_GRAY + "missingno"); + } + } + } + } + + if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanPlaceOn", 9) && (i1 & 16) == 0) + { + NBTTagList nbttaglist3 = this.stackTagCompound.getTagList("CanPlaceOn", 8); + + if (nbttaglist3.tagCount() > 0) + { + list.add(""); + list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("item.canPlace")); + + for (int l1 = 0; l1 < nbttaglist3.tagCount(); ++l1) + { + Block block1 = Block.getBlockFromName(nbttaglist3.getStringTagAt(l1)); + + if (block1 != null) + { + list.add(EnumChatFormatting.DARK_GRAY + block1.getLocalizedName()); + } + else + { + list.add(EnumChatFormatting.DARK_GRAY + "missingno"); + } + } + } + } + + if (advanced) + { + if (this.isItemDamaged()) + { + list.add("Durability: " + (this.getMaxDamage() - this.getItemDamage()) + " / " + this.getMaxDamage()); + } + + list.add(EnumChatFormatting.DARK_GRAY + ((ResourceLocation)Item.itemRegistry.getNameForObject(this.item)).toString()); + + if (this.hasTagCompound()) + { + list.add(EnumChatFormatting.DARK_GRAY + "NBT: " + this.getTagCompound().getKeySet().size() + " tag(s)"); + } + } + + return list; + } + + public boolean hasEffect() + { + return this.getItem().hasEffect(this); + } + + public EnumRarity getRarity() + { + return this.getItem().getRarity(this); + } + + /** + * True if it is a tool and has no enchantments to begin with + */ + public boolean isItemEnchantable() + { + return !this.getItem().isItemTool(this) ? false : !this.isItemEnchanted(); + } + + /** + * Adds an enchantment with a desired level on the ItemStack. + */ + public void addEnchantment(Enchantment ench, int level) + { + if (this.stackTagCompound == null) + { + this.setTagCompound(new NBTTagCompound()); + } + + if (!this.stackTagCompound.hasKey("ench", 9)) + { + this.stackTagCompound.setTag("ench", new NBTTagList()); + } + + NBTTagList nbttaglist = this.stackTagCompound.getTagList("ench", 10); + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setShort("id", (short)ench.effectId); + nbttagcompound.setShort("lvl", (short)((byte)level)); + nbttaglist.appendTag(nbttagcompound); + } + + /** + * True if the item has enchantment data + */ + public boolean isItemEnchanted() + { + return this.stackTagCompound != null && this.stackTagCompound.hasKey("ench", 9); + } + + public void setTagInfo(String key, NBTBase value) + { + if (this.stackTagCompound == null) + { + this.setTagCompound(new NBTTagCompound()); + } + + this.stackTagCompound.setTag(key, value); + } + + public boolean canEditBlocks() + { + return this.getItem().canItemEditBlocks(); + } + + /** + * Return whether this stack is on an item frame. + */ + public boolean isOnItemFrame() + { + return this.itemFrame != null; + } + + /** + * Set the item frame this stack is on. + */ + public void setItemFrame(EntityItemFrame frame) + { + this.itemFrame = frame; + } + + /** + * Return the item frame this stack is on. Returns null if not on an item frame. + */ + public EntityItemFrame getItemFrame() + { + return this.itemFrame; + } + + /** + * Get this stack's repair cost, or 0 if no repair cost is defined. + */ + public int getRepairCost() + { + return this.hasTagCompound() && this.stackTagCompound.hasKey("RepairCost", 3) ? this.stackTagCompound.getInteger("RepairCost") : 0; + } + + /** + * Set this stack's repair cost. + */ + public void setRepairCost(int cost) + { + if (!this.hasTagCompound()) + { + this.stackTagCompound = new NBTTagCompound(); + } + + this.stackTagCompound.setInteger("RepairCost", cost); + } + + public Multimap getAttributeModifiers() + { + Multimap multimap; + + if (this.hasTagCompound() && this.stackTagCompound.hasKey("AttributeModifiers", 9)) + { + multimap = HashMultimap.create(); + NBTTagList nbttaglist = this.stackTagCompound.getTagList("AttributeModifiers", 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + AttributeModifier attributemodifier = SharedMonsterAttributes.readAttributeModifierFromNBT(nbttagcompound); + + if (attributemodifier != null && attributemodifier.getID().getLeastSignificantBits() != 0L && attributemodifier.getID().getMostSignificantBits() != 0L) + { + multimap.put(nbttagcompound.getString("AttributeName"), attributemodifier); + } + } + } + else + { + multimap = this.getItem().getItemAttributeModifiers(); + } + + return multimap; + } + + public void setItem(Item newItem) + { + this.item = newItem; + } + + /** + * Get a ChatComponent for this Item's display name that shows this Item on hover + */ + public IChatComponent getChatComponent() + { + ChatComponentText chatcomponenttext = new ChatComponentText(this.getDisplayName()); + + if (this.hasDisplayName()) + { + chatcomponenttext.getChatStyle().setItalic(Boolean.valueOf(true)); + } + + IChatComponent ichatcomponent = (new ChatComponentText("[")).appendSibling(chatcomponenttext).appendText("]"); + + if (this.item != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + this.writeToNBT(nbttagcompound); + ichatcomponent.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new ChatComponentText(nbttagcompound.toString()))); + ichatcomponent.getChatStyle().setColor(this.getRarity().rarityColor); + } + + return ichatcomponent; + } + + public boolean canDestroy(Block blockIn) + { + if (blockIn == this.canDestroyCacheBlock) + { + return this.canDestroyCacheResult; + } + else + { + this.canDestroyCacheBlock = blockIn; + + if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanDestroy", 9)) + { + NBTTagList nbttaglist = this.stackTagCompound.getTagList("CanDestroy", 8); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + Block block = Block.getBlockFromName(nbttaglist.getStringTagAt(i)); + + if (block == blockIn) + { + this.canDestroyCacheResult = true; + return true; + } + } + } + + this.canDestroyCacheResult = false; + return false; + } + } + + public boolean canPlaceOn(Block blockIn) + { + if (blockIn == this.canPlaceOnCacheBlock) + { + return this.canPlaceOnCacheResult; + } + else + { + this.canPlaceOnCacheBlock = blockIn; + + if (this.hasTagCompound() && this.stackTagCompound.hasKey("CanPlaceOn", 9)) + { + NBTTagList nbttaglist = this.stackTagCompound.getTagList("CanPlaceOn", 8); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + Block block = Block.getBlockFromName(nbttaglist.getStringTagAt(i)); + + if (block == blockIn) + { + this.canPlaceOnCacheResult = true; + return true; + } + } + } + + this.canPlaceOnCacheResult = false; + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/item/ItemSword.java b/src/minecraft/net/minecraft/item/ItemSword.java new file mode 100644 index 0000000..f32fe3f --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemSword.java @@ -0,0 +1,144 @@ +package net.minecraft.item; + +import com.google.common.collect.Multimap; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class ItemSword extends Item +{ + private float attackDamage; + private final Item.ToolMaterial material; + + public ItemSword(Item.ToolMaterial material) + { + this.material = material; + this.maxStackSize = 1; + this.setMaxDamage(material.getMaxUses()); + this.setCreativeTab(CreativeTabs.tabCombat); + this.attackDamage = 4.0F + material.getDamageVsEntity(); + } + + /** + * Returns the amount of damage this item will deal. One heart of damage is equal to 2 damage points. + */ + public float getDamageVsEntity() + { + return this.material.getDamageVsEntity(); + } + + public float getStrVsBlock(ItemStack stack, Block block) + { + if (block == Blocks.web) + { + return 15.0F; + } + else + { + Material material = block.getMaterial(); + return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.gourd ? 1.0F : 1.5F; + } + } + + /** + * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise + * the damage on the stack. + */ + public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) + { + stack.damageItem(1, attacker); + return true; + } + + /** + * Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic. + */ + public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) + { + if ((double)blockIn.getBlockHardness(worldIn, pos) != 0.0D) + { + stack.damageItem(2, playerIn); + } + + return true; + } + + /** + * Returns True is the item is renderer in full 3D when hold. + */ + public boolean isFull3D() + { + return true; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack stack) + { + return EnumAction.BLOCK; + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack stack) + { + return 72000; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn)); + return itemStackIn; + } + + /** + * Check whether this Item can harvest the given Block + */ + public boolean canHarvestBlock(Block blockIn) + { + return blockIn == Blocks.web; + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return this.material.getEnchantability(); + } + + /** + * Return the name for this tool's material. + */ + public String getToolMaterialName() + { + return this.material.toString(); + } + + /** + * Return whether this item is repairable in an anvil. + */ + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) + { + return this.material.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); + } + + public Multimap getItemAttributeModifiers() + { + Multimap multimap = super.getItemAttributeModifiers(); + multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Weapon modifier", (double)this.attackDamage, 0)); + return multimap; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemTool.java b/src/minecraft/net/minecraft/item/ItemTool.java new file mode 100644 index 0000000..ff8ef38 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemTool.java @@ -0,0 +1,106 @@ +package net.minecraft.item; + +import com.google.common.collect.Multimap; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class ItemTool extends Item +{ + private Set effectiveBlocks; + protected float efficiencyOnProperMaterial = 4.0F; + + /** Damage versus entities. */ + private float damageVsEntity; + + /** The material this tool is made from. */ + protected Item.ToolMaterial toolMaterial; + + protected ItemTool(float attackDamage, Item.ToolMaterial material, Set effectiveBlocks) + { + this.toolMaterial = material; + this.effectiveBlocks = effectiveBlocks; + this.maxStackSize = 1; + this.setMaxDamage(material.getMaxUses()); + this.efficiencyOnProperMaterial = material.getEfficiencyOnProperMaterial(); + this.damageVsEntity = attackDamage + material.getDamageVsEntity(); + this.setCreativeTab(CreativeTabs.tabTools); + } + + public float getStrVsBlock(ItemStack stack, Block block) + { + return this.effectiveBlocks.contains(block) ? this.efficiencyOnProperMaterial : 1.0F; + } + + /** + * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise + * the damage on the stack. + */ + public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) + { + stack.damageItem(2, attacker); + return true; + } + + /** + * Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic. + */ + public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) + { + if ((double)blockIn.getBlockHardness(worldIn, pos) != 0.0D) + { + stack.damageItem(1, playerIn); + } + + return true; + } + + /** + * Returns True is the item is renderer in full 3D when hold. + */ + public boolean isFull3D() + { + return true; + } + + public Item.ToolMaterial getToolMaterial() + { + return this.toolMaterial; + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return this.toolMaterial.getEnchantability(); + } + + /** + * Return the name for this tool's material. + */ + public String getToolMaterialName() + { + return this.toolMaterial.toString(); + } + + /** + * Return whether this item is repairable in an anvil. + */ + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) + { + return this.toolMaterial.getRepairItem() == repair.getItem() ? true : super.getIsRepairable(toRepair, repair); + } + + public Multimap getItemAttributeModifiers() + { + Multimap multimap = super.getItemAttributeModifiers(); + multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Tool modifier", (double)this.damageVsEntity, 0)); + return multimap; + } +} diff --git a/src/minecraft/net/minecraft/item/ItemWritableBook.java b/src/minecraft/net/minecraft/item/ItemWritableBook.java new file mode 100644 index 0000000..aefe107 --- /dev/null +++ b/src/minecraft/net/minecraft/item/ItemWritableBook.java @@ -0,0 +1,61 @@ +package net.minecraft.item; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.stats.StatList; +import net.minecraft.world.World; + +public class ItemWritableBook extends Item +{ + public ItemWritableBook() + { + this.setMaxStackSize(1); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + playerIn.displayGUIBook(itemStackIn); + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + return itemStackIn; + } + + /** + * this method returns true if the book's NBT Tag List "pages" is valid + */ + public static boolean isNBTValid(NBTTagCompound nbt) + { + if (nbt == null) + { + return false; + } + else if (!nbt.hasKey("pages", 9)) + { + return false; + } + else + { + NBTTagList nbttaglist = nbt.getTagList("pages", 8); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + String s = nbttaglist.getStringTagAt(i); + + if (s == null) + { + return false; + } + + if (s.length() > 32767) + { + return false; + } + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/CraftingManager.java b/src/minecraft/net/minecraft/item/crafting/CraftingManager.java new file mode 100644 index 0000000..962fdb5 --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/CraftingManager.java @@ -0,0 +1,352 @@ +package net.minecraft.item.crafting; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.BlockStone; +import net.minecraft.block.BlockStoneSlab; +import net.minecraft.block.BlockStoneSlabNew; +import net.minecraft.block.BlockWall; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class CraftingManager +{ + /** The static instance of this class */ + private static final CraftingManager instance = new CraftingManager(); + private final List recipes = Lists.newArrayList(); + + /** + * Returns the static instance of this class + */ + public static CraftingManager getInstance() + { + return instance; + } + + private CraftingManager() + { + (new RecipesTools()).addRecipes(this); + (new RecipesWeapons()).addRecipes(this); + (new RecipesIngots()).addRecipes(this); + (new RecipesFood()).addRecipes(this); + (new RecipesCrafting()).addRecipes(this); + (new RecipesArmor()).addRecipes(this); + (new RecipesDyes()).addRecipes(this); + this.recipes.add(new RecipesArmorDyes()); + this.recipes.add(new RecipeBookCloning()); + this.recipes.add(new RecipesMapCloning()); + this.recipes.add(new RecipesMapExtending()); + this.recipes.add(new RecipeFireworks()); + this.recipes.add(new RecipeRepairItem()); + (new RecipesBanners()).addRecipes(this); + this.addRecipe(new ItemStack(Items.paper, 3), new Object[] {"###", '#', Items.reeds}); + this.addShapelessRecipe(new ItemStack(Items.book, 1), new Object[] {Items.paper, Items.paper, Items.paper, Items.leather}); + this.addShapelessRecipe(new ItemStack(Items.writable_book, 1), new Object[] {Items.book, new ItemStack(Items.dye, 1, EnumDyeColor.BLACK.getDyeDamage()), Items.feather}); + this.addRecipe(new ItemStack(Blocks.oak_fence, 3), new Object[] {"W#W", "W#W", '#', Items.stick, 'W', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.OAK.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.birch_fence, 3), new Object[] {"W#W", "W#W", '#', Items.stick, 'W', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.BIRCH.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.spruce_fence, 3), new Object[] {"W#W", "W#W", '#', Items.stick, 'W', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.SPRUCE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.jungle_fence, 3), new Object[] {"W#W", "W#W", '#', Items.stick, 'W', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.JUNGLE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.acacia_fence, 3), new Object[] {"W#W", "W#W", '#', Items.stick, 'W', new ItemStack(Blocks.planks, 1, 4 + BlockPlanks.EnumType.ACACIA.getMetadata() - 4)}); + this.addRecipe(new ItemStack(Blocks.dark_oak_fence, 3), new Object[] {"W#W", "W#W", '#', Items.stick, 'W', new ItemStack(Blocks.planks, 1, 4 + BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4)}); + this.addRecipe(new ItemStack(Blocks.cobblestone_wall, 6, BlockWall.EnumType.NORMAL.getMetadata()), new Object[] {"###", "###", '#', Blocks.cobblestone}); + this.addRecipe(new ItemStack(Blocks.cobblestone_wall, 6, BlockWall.EnumType.MOSSY.getMetadata()), new Object[] {"###", "###", '#', Blocks.mossy_cobblestone}); + this.addRecipe(new ItemStack(Blocks.nether_brick_fence, 6), new Object[] {"###", "###", '#', Blocks.nether_brick}); + this.addRecipe(new ItemStack(Blocks.oak_fence_gate, 1), new Object[] {"#W#", "#W#", '#', Items.stick, 'W', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.OAK.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.birch_fence_gate, 1), new Object[] {"#W#", "#W#", '#', Items.stick, 'W', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.BIRCH.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.spruce_fence_gate, 1), new Object[] {"#W#", "#W#", '#', Items.stick, 'W', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.SPRUCE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.jungle_fence_gate, 1), new Object[] {"#W#", "#W#", '#', Items.stick, 'W', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.JUNGLE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.acacia_fence_gate, 1), new Object[] {"#W#", "#W#", '#', Items.stick, 'W', new ItemStack(Blocks.planks, 1, 4 + BlockPlanks.EnumType.ACACIA.getMetadata() - 4)}); + this.addRecipe(new ItemStack(Blocks.dark_oak_fence_gate, 1), new Object[] {"#W#", "#W#", '#', Items.stick, 'W', new ItemStack(Blocks.planks, 1, 4 + BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4)}); + this.addRecipe(new ItemStack(Blocks.jukebox, 1), new Object[] {"###", "#X#", "###", '#', Blocks.planks, 'X', Items.diamond}); + this.addRecipe(new ItemStack(Items.lead, 2), new Object[] {"~~ ", "~O ", " ~", '~', Items.string, 'O', Items.slime_ball}); + this.addRecipe(new ItemStack(Blocks.noteblock, 1), new Object[] {"###", "#X#", "###", '#', Blocks.planks, 'X', Items.redstone}); + this.addRecipe(new ItemStack(Blocks.bookshelf, 1), new Object[] {"###", "XXX", "###", '#', Blocks.planks, 'X', Items.book}); + this.addRecipe(new ItemStack(Blocks.snow, 1), new Object[] {"##", "##", '#', Items.snowball}); + this.addRecipe(new ItemStack(Blocks.snow_layer, 6), new Object[] {"###", '#', Blocks.snow}); + this.addRecipe(new ItemStack(Blocks.clay, 1), new Object[] {"##", "##", '#', Items.clay_ball}); + this.addRecipe(new ItemStack(Blocks.brick_block, 1), new Object[] {"##", "##", '#', Items.brick}); + this.addRecipe(new ItemStack(Blocks.glowstone, 1), new Object[] {"##", "##", '#', Items.glowstone_dust}); + this.addRecipe(new ItemStack(Blocks.quartz_block, 1), new Object[] {"##", "##", '#', Items.quartz}); + this.addRecipe(new ItemStack(Blocks.wool, 1), new Object[] {"##", "##", '#', Items.string}); + this.addRecipe(new ItemStack(Blocks.tnt, 1), new Object[] {"X#X", "#X#", "X#X", 'X', Items.gunpowder, '#', Blocks.sand}); + this.addRecipe(new ItemStack(Blocks.stone_slab, 6, BlockStoneSlab.EnumType.COBBLESTONE.getMetadata()), new Object[] {"###", '#', Blocks.cobblestone}); + this.addRecipe(new ItemStack(Blocks.stone_slab, 6, BlockStoneSlab.EnumType.STONE.getMetadata()), new Object[] {"###", '#', new ItemStack(Blocks.stone, BlockStone.EnumType.STONE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.stone_slab, 6, BlockStoneSlab.EnumType.SAND.getMetadata()), new Object[] {"###", '#', Blocks.sandstone}); + this.addRecipe(new ItemStack(Blocks.stone_slab, 6, BlockStoneSlab.EnumType.BRICK.getMetadata()), new Object[] {"###", '#', Blocks.brick_block}); + this.addRecipe(new ItemStack(Blocks.stone_slab, 6, BlockStoneSlab.EnumType.SMOOTHBRICK.getMetadata()), new Object[] {"###", '#', Blocks.stonebrick}); + this.addRecipe(new ItemStack(Blocks.stone_slab, 6, BlockStoneSlab.EnumType.NETHERBRICK.getMetadata()), new Object[] {"###", '#', Blocks.nether_brick}); + this.addRecipe(new ItemStack(Blocks.stone_slab, 6, BlockStoneSlab.EnumType.QUARTZ.getMetadata()), new Object[] {"###", '#', Blocks.quartz_block}); + this.addRecipe(new ItemStack(Blocks.stone_slab2, 6, BlockStoneSlabNew.EnumType.RED_SANDSTONE.getMetadata()), new Object[] {"###", '#', Blocks.red_sandstone}); + this.addRecipe(new ItemStack(Blocks.wooden_slab, 6, 0), new Object[] {"###", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.OAK.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.wooden_slab, 6, BlockPlanks.EnumType.BIRCH.getMetadata()), new Object[] {"###", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.BIRCH.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.wooden_slab, 6, BlockPlanks.EnumType.SPRUCE.getMetadata()), new Object[] {"###", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.SPRUCE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.wooden_slab, 6, BlockPlanks.EnumType.JUNGLE.getMetadata()), new Object[] {"###", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.JUNGLE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.wooden_slab, 6, 4 + BlockPlanks.EnumType.ACACIA.getMetadata() - 4), new Object[] {"###", '#', new ItemStack(Blocks.planks, 1, 4 + BlockPlanks.EnumType.ACACIA.getMetadata() - 4)}); + this.addRecipe(new ItemStack(Blocks.wooden_slab, 6, 4 + BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4), new Object[] {"###", '#', new ItemStack(Blocks.planks, 1, 4 + BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4)}); + this.addRecipe(new ItemStack(Blocks.ladder, 3), new Object[] {"# #", "###", "# #", '#', Items.stick}); + this.addRecipe(new ItemStack(Items.oak_door, 3), new Object[] {"##", "##", "##", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.OAK.getMetadata())}); + this.addRecipe(new ItemStack(Items.spruce_door, 3), new Object[] {"##", "##", "##", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.SPRUCE.getMetadata())}); + this.addRecipe(new ItemStack(Items.birch_door, 3), new Object[] {"##", "##", "##", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.BIRCH.getMetadata())}); + this.addRecipe(new ItemStack(Items.jungle_door, 3), new Object[] {"##", "##", "##", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.JUNGLE.getMetadata())}); + this.addRecipe(new ItemStack(Items.acacia_door, 3), new Object[] {"##", "##", "##", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.ACACIA.getMetadata())}); + this.addRecipe(new ItemStack(Items.dark_oak_door, 3), new Object[] {"##", "##", "##", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.DARK_OAK.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.trapdoor, 2), new Object[] {"###", "###", '#', Blocks.planks}); + this.addRecipe(new ItemStack(Items.iron_door, 3), new Object[] {"##", "##", "##", '#', Items.iron_ingot}); + this.addRecipe(new ItemStack(Blocks.iron_trapdoor, 1), new Object[] {"##", "##", '#', Items.iron_ingot}); + this.addRecipe(new ItemStack(Items.sign, 3), new Object[] {"###", "###", " X ", '#', Blocks.planks, 'X', Items.stick}); + this.addRecipe(new ItemStack(Items.cake, 1), new Object[] {"AAA", "BEB", "CCC", 'A', Items.milk_bucket, 'B', Items.sugar, 'C', Items.wheat, 'E', Items.egg}); + this.addRecipe(new ItemStack(Items.sugar, 1), new Object[] {"#", '#', Items.reeds}); + this.addRecipe(new ItemStack(Blocks.planks, 4, BlockPlanks.EnumType.OAK.getMetadata()), new Object[] {"#", '#', new ItemStack(Blocks.log, 1, BlockPlanks.EnumType.OAK.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.planks, 4, BlockPlanks.EnumType.SPRUCE.getMetadata()), new Object[] {"#", '#', new ItemStack(Blocks.log, 1, BlockPlanks.EnumType.SPRUCE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.planks, 4, BlockPlanks.EnumType.BIRCH.getMetadata()), new Object[] {"#", '#', new ItemStack(Blocks.log, 1, BlockPlanks.EnumType.BIRCH.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.planks, 4, BlockPlanks.EnumType.JUNGLE.getMetadata()), new Object[] {"#", '#', new ItemStack(Blocks.log, 1, BlockPlanks.EnumType.JUNGLE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.planks, 4, 4 + BlockPlanks.EnumType.ACACIA.getMetadata() - 4), new Object[] {"#", '#', new ItemStack(Blocks.log2, 1, BlockPlanks.EnumType.ACACIA.getMetadata() - 4)}); + this.addRecipe(new ItemStack(Blocks.planks, 4, 4 + BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4), new Object[] {"#", '#', new ItemStack(Blocks.log2, 1, BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4)}); + this.addRecipe(new ItemStack(Items.stick, 4), new Object[] {"#", "#", '#', Blocks.planks}); + this.addRecipe(new ItemStack(Blocks.torch, 4), new Object[] {"X", "#", 'X', Items.coal, '#', Items.stick}); + this.addRecipe(new ItemStack(Blocks.torch, 4), new Object[] {"X", "#", 'X', new ItemStack(Items.coal, 1, 1), '#', Items.stick}); + this.addRecipe(new ItemStack(Items.bowl, 4), new Object[] {"# #", " # ", '#', Blocks.planks}); + this.addRecipe(new ItemStack(Items.glass_bottle, 3), new Object[] {"# #", " # ", '#', Blocks.glass}); + this.addRecipe(new ItemStack(Blocks.rail, 16), new Object[] {"X X", "X#X", "X X", 'X', Items.iron_ingot, '#', Items.stick}); + this.addRecipe(new ItemStack(Blocks.golden_rail, 6), new Object[] {"X X", "X#X", "XRX", 'X', Items.gold_ingot, 'R', Items.redstone, '#', Items.stick}); + this.addRecipe(new ItemStack(Blocks.activator_rail, 6), new Object[] {"XSX", "X#X", "XSX", 'X', Items.iron_ingot, '#', Blocks.redstone_torch, 'S', Items.stick}); + this.addRecipe(new ItemStack(Blocks.detector_rail, 6), new Object[] {"X X", "X#X", "XRX", 'X', Items.iron_ingot, 'R', Items.redstone, '#', Blocks.stone_pressure_plate}); + this.addRecipe(new ItemStack(Items.minecart, 1), new Object[] {"# #", "###", '#', Items.iron_ingot}); + this.addRecipe(new ItemStack(Items.cauldron, 1), new Object[] {"# #", "# #", "###", '#', Items.iron_ingot}); + this.addRecipe(new ItemStack(Items.brewing_stand, 1), new Object[] {" B ", "###", '#', Blocks.cobblestone, 'B', Items.blaze_rod}); + this.addRecipe(new ItemStack(Blocks.lit_pumpkin, 1), new Object[] {"A", "B", 'A', Blocks.pumpkin, 'B', Blocks.torch}); + this.addRecipe(new ItemStack(Items.chest_minecart, 1), new Object[] {"A", "B", 'A', Blocks.chest, 'B', Items.minecart}); + this.addRecipe(new ItemStack(Items.furnace_minecart, 1), new Object[] {"A", "B", 'A', Blocks.furnace, 'B', Items.minecart}); + this.addRecipe(new ItemStack(Items.tnt_minecart, 1), new Object[] {"A", "B", 'A', Blocks.tnt, 'B', Items.minecart}); + this.addRecipe(new ItemStack(Items.hopper_minecart, 1), new Object[] {"A", "B", 'A', Blocks.hopper, 'B', Items.minecart}); + this.addRecipe(new ItemStack(Items.boat, 1), new Object[] {"# #", "###", '#', Blocks.planks}); + this.addRecipe(new ItemStack(Items.bucket, 1), new Object[] {"# #", " # ", '#', Items.iron_ingot}); + this.addRecipe(new ItemStack(Items.flower_pot, 1), new Object[] {"# #", " # ", '#', Items.brick}); + this.addShapelessRecipe(new ItemStack(Items.flint_and_steel, 1), new Object[] {new ItemStack(Items.iron_ingot, 1), new ItemStack(Items.flint, 1)}); + this.addRecipe(new ItemStack(Items.bread, 1), new Object[] {"###", '#', Items.wheat}); + this.addRecipe(new ItemStack(Blocks.oak_stairs, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.OAK.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.birch_stairs, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.BIRCH.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.spruce_stairs, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.SPRUCE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.jungle_stairs, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Blocks.planks, 1, BlockPlanks.EnumType.JUNGLE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.acacia_stairs, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Blocks.planks, 1, 4 + BlockPlanks.EnumType.ACACIA.getMetadata() - 4)}); + this.addRecipe(new ItemStack(Blocks.dark_oak_stairs, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Blocks.planks, 1, 4 + BlockPlanks.EnumType.DARK_OAK.getMetadata() - 4)}); + this.addRecipe(new ItemStack(Items.fishing_rod, 1), new Object[] {" #", " #X", "# X", '#', Items.stick, 'X', Items.string}); + this.addRecipe(new ItemStack(Items.carrot_on_a_stick, 1), new Object[] {"# ", " X", '#', Items.fishing_rod, 'X', Items.carrot}); + this.addRecipe(new ItemStack(Blocks.stone_stairs, 4), new Object[] {"# ", "## ", "###", '#', Blocks.cobblestone}); + this.addRecipe(new ItemStack(Blocks.brick_stairs, 4), new Object[] {"# ", "## ", "###", '#', Blocks.brick_block}); + this.addRecipe(new ItemStack(Blocks.stone_brick_stairs, 4), new Object[] {"# ", "## ", "###", '#', Blocks.stonebrick}); + this.addRecipe(new ItemStack(Blocks.nether_brick_stairs, 4), new Object[] {"# ", "## ", "###", '#', Blocks.nether_brick}); + this.addRecipe(new ItemStack(Blocks.sandstone_stairs, 4), new Object[] {"# ", "## ", "###", '#', Blocks.sandstone}); + this.addRecipe(new ItemStack(Blocks.red_sandstone_stairs, 4), new Object[] {"# ", "## ", "###", '#', Blocks.red_sandstone}); + this.addRecipe(new ItemStack(Blocks.quartz_stairs, 4), new Object[] {"# ", "## ", "###", '#', Blocks.quartz_block}); + this.addRecipe(new ItemStack(Items.painting, 1), new Object[] {"###", "#X#", "###", '#', Items.stick, 'X', Blocks.wool}); + this.addRecipe(new ItemStack(Items.item_frame, 1), new Object[] {"###", "#X#", "###", '#', Items.stick, 'X', Items.leather}); + this.addRecipe(new ItemStack(Items.golden_apple, 1, 0), new Object[] {"###", "#X#", "###", '#', Items.gold_ingot, 'X', Items.apple}); + this.addRecipe(new ItemStack(Items.golden_apple, 1, 1), new Object[] {"###", "#X#", "###", '#', Blocks.gold_block, 'X', Items.apple}); + this.addRecipe(new ItemStack(Items.golden_carrot, 1, 0), new Object[] {"###", "#X#", "###", '#', Items.gold_nugget, 'X', Items.carrot}); + this.addRecipe(new ItemStack(Items.speckled_melon, 1), new Object[] {"###", "#X#", "###", '#', Items.gold_nugget, 'X', Items.melon}); + this.addRecipe(new ItemStack(Blocks.lever, 1), new Object[] {"X", "#", '#', Blocks.cobblestone, 'X', Items.stick}); + this.addRecipe(new ItemStack(Blocks.tripwire_hook, 2), new Object[] {"I", "S", "#", '#', Blocks.planks, 'S', Items.stick, 'I', Items.iron_ingot}); + this.addRecipe(new ItemStack(Blocks.redstone_torch, 1), new Object[] {"X", "#", '#', Items.stick, 'X', Items.redstone}); + this.addRecipe(new ItemStack(Items.repeater, 1), new Object[] {"#X#", "III", '#', Blocks.redstone_torch, 'X', Items.redstone, 'I', new ItemStack(Blocks.stone, 1, BlockStone.EnumType.STONE.getMetadata())}); + this.addRecipe(new ItemStack(Items.comparator, 1), new Object[] {" # ", "#X#", "III", '#', Blocks.redstone_torch, 'X', Items.quartz, 'I', new ItemStack(Blocks.stone, 1, BlockStone.EnumType.STONE.getMetadata())}); + this.addRecipe(new ItemStack(Items.clock, 1), new Object[] {" # ", "#X#", " # ", '#', Items.gold_ingot, 'X', Items.redstone}); + this.addRecipe(new ItemStack(Items.compass, 1), new Object[] {" # ", "#X#", " # ", '#', Items.iron_ingot, 'X', Items.redstone}); + this.addRecipe(new ItemStack(Items.map, 1), new Object[] {"###", "#X#", "###", '#', Items.paper, 'X', Items.compass}); + this.addRecipe(new ItemStack(Blocks.stone_button, 1), new Object[] {"#", '#', new ItemStack(Blocks.stone, 1, BlockStone.EnumType.STONE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.wooden_button, 1), new Object[] {"#", '#', Blocks.planks}); + this.addRecipe(new ItemStack(Blocks.stone_pressure_plate, 1), new Object[] {"##", '#', new ItemStack(Blocks.stone, 1, BlockStone.EnumType.STONE.getMetadata())}); + this.addRecipe(new ItemStack(Blocks.wooden_pressure_plate, 1), new Object[] {"##", '#', Blocks.planks}); + this.addRecipe(new ItemStack(Blocks.heavy_weighted_pressure_plate, 1), new Object[] {"##", '#', Items.iron_ingot}); + this.addRecipe(new ItemStack(Blocks.light_weighted_pressure_plate, 1), new Object[] {"##", '#', Items.gold_ingot}); + this.addRecipe(new ItemStack(Blocks.dispenser, 1), new Object[] {"###", "#X#", "#R#", '#', Blocks.cobblestone, 'X', Items.bow, 'R', Items.redstone}); + this.addRecipe(new ItemStack(Blocks.dropper, 1), new Object[] {"###", "# #", "#R#", '#', Blocks.cobblestone, 'R', Items.redstone}); + this.addRecipe(new ItemStack(Blocks.piston, 1), new Object[] {"TTT", "#X#", "#R#", '#', Blocks.cobblestone, 'X', Items.iron_ingot, 'R', Items.redstone, 'T', Blocks.planks}); + this.addRecipe(new ItemStack(Blocks.sticky_piston, 1), new Object[] {"S", "P", 'S', Items.slime_ball, 'P', Blocks.piston}); + this.addRecipe(new ItemStack(Items.bed, 1), new Object[] {"###", "XXX", '#', Blocks.wool, 'X', Blocks.planks}); + this.addRecipe(new ItemStack(Blocks.enchanting_table, 1), new Object[] {" B ", "D#D", "###", '#', Blocks.obsidian, 'B', Items.book, 'D', Items.diamond}); + this.addRecipe(new ItemStack(Blocks.anvil, 1), new Object[] {"III", " i ", "iii", 'I', Blocks.iron_block, 'i', Items.iron_ingot}); + this.addRecipe(new ItemStack(Items.leather), new Object[] {"##", "##", '#', Items.rabbit_hide}); + this.addShapelessRecipe(new ItemStack(Items.ender_eye, 1), new Object[] {Items.ender_pearl, Items.blaze_powder}); + this.addShapelessRecipe(new ItemStack(Items.fire_charge, 3), new Object[] {Items.gunpowder, Items.blaze_powder, Items.coal}); + this.addShapelessRecipe(new ItemStack(Items.fire_charge, 3), new Object[] {Items.gunpowder, Items.blaze_powder, new ItemStack(Items.coal, 1, 1)}); + this.addRecipe(new ItemStack(Blocks.daylight_detector), new Object[] {"GGG", "QQQ", "WWW", 'G', Blocks.glass, 'Q', Items.quartz, 'W', Blocks.wooden_slab}); + this.addRecipe(new ItemStack(Blocks.hopper), new Object[] {"I I", "ICI", " I ", 'I', Items.iron_ingot, 'C', Blocks.chest}); + this.addRecipe(new ItemStack(Items.armor_stand, 1), new Object[] {"///", " / ", "/_/", '/', Items.stick, '_', new ItemStack(Blocks.stone_slab, 1, BlockStoneSlab.EnumType.STONE.getMetadata())}); + Collections.sort(this.recipes, new Comparator() + { + public int compare(IRecipe p_compare_1_, IRecipe p_compare_2_) + { + return p_compare_1_ instanceof ShapelessRecipes && p_compare_2_ instanceof ShapedRecipes ? 1 : (p_compare_2_ instanceof ShapelessRecipes && p_compare_1_ instanceof ShapedRecipes ? -1 : (p_compare_2_.getRecipeSize() < p_compare_1_.getRecipeSize() ? -1 : (p_compare_2_.getRecipeSize() > p_compare_1_.getRecipeSize() ? 1 : 0))); + } + }); + } + + /** + * Adds a shaped recipe to the games recipe list. + */ + public ShapedRecipes addRecipe(ItemStack stack, Object... recipeComponents) + { + String s = ""; + int i = 0; + int j = 0; + int k = 0; + + if (recipeComponents[i] instanceof String[]) + { + String[] astring = (String[])((String[])recipeComponents[i++]); + + for (int l = 0; l < astring.length; ++l) + { + String s2 = astring[l]; + ++k; + j = s2.length(); + s = s + s2; + } + } + else + { + while (recipeComponents[i] instanceof String) + { + String s1 = (String)recipeComponents[i++]; + ++k; + j = s1.length(); + s = s + s1; + } + } + + Map map; + + for (map = Maps.newHashMap(); i < recipeComponents.length; i += 2) + { + Character character = (Character)recipeComponents[i]; + ItemStack itemstack = null; + + if (recipeComponents[i + 1] instanceof Item) + { + itemstack = new ItemStack((Item)recipeComponents[i + 1]); + } + else if (recipeComponents[i + 1] instanceof Block) + { + itemstack = new ItemStack((Block)recipeComponents[i + 1], 1, 32767); + } + else if (recipeComponents[i + 1] instanceof ItemStack) + { + itemstack = (ItemStack)recipeComponents[i + 1]; + } + + map.put(character, itemstack); + } + + ItemStack[] aitemstack = new ItemStack[j * k]; + + for (int i1 = 0; i1 < j * k; ++i1) + { + char c0 = s.charAt(i1); + + if (map.containsKey(Character.valueOf(c0))) + { + aitemstack[i1] = ((ItemStack)map.get(Character.valueOf(c0))).copy(); + } + else + { + aitemstack[i1] = null; + } + } + + ShapedRecipes shapedrecipes = new ShapedRecipes(j, k, aitemstack, stack); + this.recipes.add(shapedrecipes); + return shapedrecipes; + } + + /** + * Adds a shapeless crafting recipe to the the game. + */ + public void addShapelessRecipe(ItemStack stack, Object... recipeComponents) + { + List list = Lists.newArrayList(); + + for (Object object : recipeComponents) + { + if (object instanceof ItemStack) + { + list.add(((ItemStack)object).copy()); + } + else if (object instanceof Item) + { + list.add(new ItemStack((Item)object)); + } + else + { + if (!(object instanceof Block)) + { + throw new IllegalArgumentException("Invalid shapeless recipe: unknown type " + object.getClass().getName() + "!"); + } + + list.add(new ItemStack((Block)object)); + } + } + + this.recipes.add(new ShapelessRecipes(stack, list)); + } + + /** + * Adds an IRecipe to the list of crafting recipes. + */ + public void addRecipe(IRecipe recipe) + { + this.recipes.add(recipe); + } + + /** + * Retrieves an ItemStack that has multiple recipes for it. + */ + public ItemStack findMatchingRecipe(InventoryCrafting p_82787_1_, World worldIn) + { + for (IRecipe irecipe : this.recipes) + { + if (irecipe.matches(p_82787_1_, worldIn)) + { + return irecipe.getCraftingResult(p_82787_1_); + } + } + + return null; + } + + public ItemStack[] func_180303_b(InventoryCrafting p_180303_1_, World worldIn) + { + for (IRecipe irecipe : this.recipes) + { + if (irecipe.matches(p_180303_1_, worldIn)) + { + return irecipe.getRemainingItems(p_180303_1_); + } + } + + ItemStack[] aitemstack = new ItemStack[p_180303_1_.getSizeInventory()]; + + for (int i = 0; i < aitemstack.length; ++i) + { + aitemstack[i] = p_180303_1_.getStackInSlot(i); + } + + return aitemstack; + } + + public List getRecipeList() + { + return this.recipes; + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java b/src/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java new file mode 100644 index 0000000..aa2aaee --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/FurnaceRecipes.java @@ -0,0 +1,132 @@ +package net.minecraft.item.crafting; + +import com.google.common.collect.Maps; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.block.Block; +import net.minecraft.block.BlockStoneBrick; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemFishFood; +import net.minecraft.item.ItemStack; + +public class FurnaceRecipes +{ + private static final FurnaceRecipes smeltingBase = new FurnaceRecipes(); + private Map smeltingList = Maps.newHashMap(); + private Map experienceList = Maps.newHashMap(); + + /** + * Returns an instance of FurnaceRecipes. + */ + public static FurnaceRecipes instance() + { + return smeltingBase; + } + + private FurnaceRecipes() + { + this.addSmeltingRecipeForBlock(Blocks.iron_ore, new ItemStack(Items.iron_ingot), 0.7F); + this.addSmeltingRecipeForBlock(Blocks.gold_ore, new ItemStack(Items.gold_ingot), 1.0F); + this.addSmeltingRecipeForBlock(Blocks.diamond_ore, new ItemStack(Items.diamond), 1.0F); + this.addSmeltingRecipeForBlock(Blocks.sand, new ItemStack(Blocks.glass), 0.1F); + this.addSmelting(Items.porkchop, new ItemStack(Items.cooked_porkchop), 0.35F); + this.addSmelting(Items.beef, new ItemStack(Items.cooked_beef), 0.35F); + this.addSmelting(Items.chicken, new ItemStack(Items.cooked_chicken), 0.35F); + this.addSmelting(Items.rabbit, new ItemStack(Items.cooked_rabbit), 0.35F); + this.addSmelting(Items.mutton, new ItemStack(Items.cooked_mutton), 0.35F); + this.addSmeltingRecipeForBlock(Blocks.cobblestone, new ItemStack(Blocks.stone), 0.1F); + this.addSmeltingRecipe(new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.DEFAULT_META), new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.CRACKED_META), 0.1F); + this.addSmelting(Items.clay_ball, new ItemStack(Items.brick), 0.3F); + this.addSmeltingRecipeForBlock(Blocks.clay, new ItemStack(Blocks.hardened_clay), 0.35F); + this.addSmeltingRecipeForBlock(Blocks.cactus, new ItemStack(Items.dye, 1, EnumDyeColor.GREEN.getDyeDamage()), 0.2F); + this.addSmeltingRecipeForBlock(Blocks.log, new ItemStack(Items.coal, 1, 1), 0.15F); + this.addSmeltingRecipeForBlock(Blocks.log2, new ItemStack(Items.coal, 1, 1), 0.15F); + this.addSmeltingRecipeForBlock(Blocks.emerald_ore, new ItemStack(Items.emerald), 1.0F); + this.addSmelting(Items.potato, new ItemStack(Items.baked_potato), 0.35F); + this.addSmeltingRecipeForBlock(Blocks.netherrack, new ItemStack(Items.netherbrick), 0.1F); + this.addSmeltingRecipe(new ItemStack(Blocks.sponge, 1, 1), new ItemStack(Blocks.sponge, 1, 0), 0.15F); + + for (ItemFishFood.FishType itemfishfood$fishtype : ItemFishFood.FishType.values()) + { + if (itemfishfood$fishtype.canCook()) + { + this.addSmeltingRecipe(new ItemStack(Items.fish, 1, itemfishfood$fishtype.getMetadata()), new ItemStack(Items.cooked_fish, 1, itemfishfood$fishtype.getMetadata()), 0.35F); + } + } + + this.addSmeltingRecipeForBlock(Blocks.coal_ore, new ItemStack(Items.coal), 0.1F); + this.addSmeltingRecipeForBlock(Blocks.redstone_ore, new ItemStack(Items.redstone), 0.7F); + this.addSmeltingRecipeForBlock(Blocks.lapis_ore, new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), 0.2F); + this.addSmeltingRecipeForBlock(Blocks.quartz_ore, new ItemStack(Items.quartz), 0.2F); + } + + /** + * Adds a smelting recipe, where the input item is an instance of Block. + */ + public void addSmeltingRecipeForBlock(Block input, ItemStack stack, float experience) + { + this.addSmelting(Item.getItemFromBlock(input), stack, experience); + } + + /** + * Adds a smelting recipe using an Item as the input item. + */ + public void addSmelting(Item input, ItemStack stack, float experience) + { + this.addSmeltingRecipe(new ItemStack(input, 1, 32767), stack, experience); + } + + /** + * Adds a smelting recipe using an ItemStack as the input for the recipe. + */ + public void addSmeltingRecipe(ItemStack input, ItemStack stack, float experience) + { + this.smeltingList.put(input, stack); + this.experienceList.put(stack, Float.valueOf(experience)); + } + + /** + * Returns the smelting result of an item. + */ + public ItemStack getSmeltingResult(ItemStack stack) + { + for (Entry entry : this.smeltingList.entrySet()) + { + if (this.compareItemStacks(stack, (ItemStack)entry.getKey())) + { + return (ItemStack)entry.getValue(); + } + } + + return null; + } + + /** + * Compares two itemstacks to ensure that they are the same. This checks both the item and the metadata of the item. + */ + private boolean compareItemStacks(ItemStack stack1, ItemStack stack2) + { + return stack2.getItem() == stack1.getItem() && (stack2.getMetadata() == 32767 || stack2.getMetadata() == stack1.getMetadata()); + } + + public Map getSmeltingList() + { + return this.smeltingList; + } + + public float getSmeltingExperience(ItemStack stack) + { + for (Entry entry : this.experienceList.entrySet()) + { + if (this.compareItemStacks(stack, (ItemStack)entry.getKey())) + { + return ((Float)entry.getValue()).floatValue(); + } + } + + return 0.0F; + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/IRecipe.java b/src/minecraft/net/minecraft/item/crafting/IRecipe.java new file mode 100644 index 0000000..b6a3505 --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/IRecipe.java @@ -0,0 +1,27 @@ +package net.minecraft.item.crafting; + +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public interface IRecipe +{ + /** + * Used to check if a recipe matches current crafting inventory + */ + boolean matches(InventoryCrafting inv, World worldIn); + + /** + * Returns an Item that is the result of this recipe + */ + ItemStack getCraftingResult(InventoryCrafting inv); + + /** + * Returns the size of the recipe area + */ + int getRecipeSize(); + + ItemStack getRecipeOutput(); + + ItemStack[] getRemainingItems(InventoryCrafting inv); +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipeBookCloning.java b/src/minecraft/net/minecraft/item/crafting/RecipeBookCloning.java new file mode 100644 index 0000000..758183a --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipeBookCloning.java @@ -0,0 +1,134 @@ +package net.minecraft.item.crafting; + +import net.minecraft.init.Items; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemEditableBook; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public class RecipeBookCloning implements IRecipe +{ + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(InventoryCrafting inv, World worldIn) + { + int i = 0; + ItemStack itemstack = null; + + for (int j = 0; j < inv.getSizeInventory(); ++j) + { + ItemStack itemstack1 = inv.getStackInSlot(j); + + if (itemstack1 != null) + { + if (itemstack1.getItem() == Items.written_book) + { + if (itemstack != null) + { + return false; + } + + itemstack = itemstack1; + } + else + { + if (itemstack1.getItem() != Items.writable_book) + { + return false; + } + + ++i; + } + } + } + + return itemstack != null && i > 0; + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack getCraftingResult(InventoryCrafting inv) + { + int i = 0; + ItemStack itemstack = null; + + for (int j = 0; j < inv.getSizeInventory(); ++j) + { + ItemStack itemstack1 = inv.getStackInSlot(j); + + if (itemstack1 != null) + { + if (itemstack1.getItem() == Items.written_book) + { + if (itemstack != null) + { + return null; + } + + itemstack = itemstack1; + } + else + { + if (itemstack1.getItem() != Items.writable_book) + { + return null; + } + + ++i; + } + } + } + + if (itemstack != null && i >= 1 && ItemEditableBook.getGeneration(itemstack) < 2) + { + ItemStack itemstack2 = new ItemStack(Items.written_book, i); + itemstack2.setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); + itemstack2.getTagCompound().setInteger("generation", ItemEditableBook.getGeneration(itemstack) + 1); + + if (itemstack.hasDisplayName()) + { + itemstack2.setStackDisplayName(itemstack.getDisplayName()); + } + + return itemstack2; + } + else + { + return null; + } + } + + /** + * Returns the size of the recipe area + */ + public int getRecipeSize() + { + return 9; + } + + public ItemStack getRecipeOutput() + { + return null; + } + + public ItemStack[] getRemainingItems(InventoryCrafting inv) + { + ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()]; + + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null && itemstack.getItem() instanceof ItemEditableBook) + { + aitemstack[i] = itemstack; + break; + } + } + + return aitemstack; + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipeFireworks.java b/src/minecraft/net/minecraft/item/crafting/RecipeFireworks.java new file mode 100644 index 0000000..0e5d82f --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipeFireworks.java @@ -0,0 +1,270 @@ +package net.minecraft.item.crafting; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.init.Items; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemDye; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.world.World; + +public class RecipeFireworks implements IRecipe +{ + private ItemStack field_92102_a; + + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(InventoryCrafting inv, World worldIn) + { + this.field_92102_a = null; + int i = 0; + int j = 0; + int k = 0; + int l = 0; + int i1 = 0; + int j1 = 0; + + for (int k1 = 0; k1 < inv.getSizeInventory(); ++k1) + { + ItemStack itemstack = inv.getStackInSlot(k1); + + if (itemstack != null) + { + if (itemstack.getItem() == Items.gunpowder) + { + ++j; + } + else if (itemstack.getItem() == Items.firework_charge) + { + ++l; + } + else if (itemstack.getItem() == Items.dye) + { + ++k; + } + else if (itemstack.getItem() == Items.paper) + { + ++i; + } + else if (itemstack.getItem() == Items.glowstone_dust) + { + ++i1; + } + else if (itemstack.getItem() == Items.diamond) + { + ++i1; + } + else if (itemstack.getItem() == Items.fire_charge) + { + ++j1; + } + else if (itemstack.getItem() == Items.feather) + { + ++j1; + } + else if (itemstack.getItem() == Items.gold_nugget) + { + ++j1; + } + else + { + if (itemstack.getItem() != Items.skull) + { + return false; + } + + ++j1; + } + } + } + + i1 = i1 + k + j1; + + if (j <= 3 && i <= 1) + { + if (j >= 1 && i == 1 && i1 == 0) + { + this.field_92102_a = new ItemStack(Items.fireworks); + + if (l > 0) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + NBTTagCompound nbttagcompound3 = new NBTTagCompound(); + NBTTagList nbttaglist = new NBTTagList(); + + for (int k2 = 0; k2 < inv.getSizeInventory(); ++k2) + { + ItemStack itemstack3 = inv.getStackInSlot(k2); + + if (itemstack3 != null && itemstack3.getItem() == Items.firework_charge && itemstack3.hasTagCompound() && itemstack3.getTagCompound().hasKey("Explosion", 10)) + { + nbttaglist.appendTag(itemstack3.getTagCompound().getCompoundTag("Explosion")); + } + } + + nbttagcompound3.setTag("Explosions", nbttaglist); + nbttagcompound3.setByte("Flight", (byte)j); + nbttagcompound1.setTag("Fireworks", nbttagcompound3); + this.field_92102_a.setTagCompound(nbttagcompound1); + } + + return true; + } + else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) + { + this.field_92102_a = new ItemStack(Items.firework_charge); + NBTTagCompound nbttagcompound = new NBTTagCompound(); + NBTTagCompound nbttagcompound2 = new NBTTagCompound(); + byte b0 = 0; + List list = Lists.newArrayList(); + + for (int l1 = 0; l1 < inv.getSizeInventory(); ++l1) + { + ItemStack itemstack2 = inv.getStackInSlot(l1); + + if (itemstack2 != null) + { + if (itemstack2.getItem() == Items.dye) + { + list.add(Integer.valueOf(ItemDye.dyeColors[itemstack2.getMetadata() & 15])); + } + else if (itemstack2.getItem() == Items.glowstone_dust) + { + nbttagcompound2.setBoolean("Flicker", true); + } + else if (itemstack2.getItem() == Items.diamond) + { + nbttagcompound2.setBoolean("Trail", true); + } + else if (itemstack2.getItem() == Items.fire_charge) + { + b0 = 1; + } + else if (itemstack2.getItem() == Items.feather) + { + b0 = 4; + } + else if (itemstack2.getItem() == Items.gold_nugget) + { + b0 = 2; + } + else if (itemstack2.getItem() == Items.skull) + { + b0 = 3; + } + } + } + + int[] aint1 = new int[list.size()]; + + for (int l2 = 0; l2 < aint1.length; ++l2) + { + aint1[l2] = ((Integer)list.get(l2)).intValue(); + } + + nbttagcompound2.setIntArray("Colors", aint1); + nbttagcompound2.setByte("Type", b0); + nbttagcompound.setTag("Explosion", nbttagcompound2); + this.field_92102_a.setTagCompound(nbttagcompound); + return true; + } + else if (j == 0 && i == 0 && l == 1 && k > 0 && k == i1) + { + List list1 = Lists.newArrayList(); + + for (int i2 = 0; i2 < inv.getSizeInventory(); ++i2) + { + ItemStack itemstack1 = inv.getStackInSlot(i2); + + if (itemstack1 != null) + { + if (itemstack1.getItem() == Items.dye) + { + list1.add(Integer.valueOf(ItemDye.dyeColors[itemstack1.getMetadata() & 15])); + } + else if (itemstack1.getItem() == Items.firework_charge) + { + this.field_92102_a = itemstack1.copy(); + this.field_92102_a.stackSize = 1; + } + } + } + + int[] aint = new int[list1.size()]; + + for (int j2 = 0; j2 < aint.length; ++j2) + { + aint[j2] = ((Integer)list1.get(j2)).intValue(); + } + + if (this.field_92102_a != null && this.field_92102_a.hasTagCompound()) + { + NBTTagCompound nbttagcompound4 = this.field_92102_a.getTagCompound().getCompoundTag("Explosion"); + + if (nbttagcompound4 == null) + { + return false; + } + else + { + nbttagcompound4.setIntArray("FadeColors", aint); + return true; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack getCraftingResult(InventoryCrafting inv) + { + return this.field_92102_a.copy(); + } + + /** + * Returns the size of the recipe area + */ + public int getRecipeSize() + { + return 10; + } + + public ItemStack getRecipeOutput() + { + return this.field_92102_a; + } + + public ItemStack[] getRemainingItems(InventoryCrafting inv) + { + ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()]; + + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null && itemstack.getItem().hasContainerItem()) + { + aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); + } + } + + return aitemstack; + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java b/src/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java new file mode 100644 index 0000000..d1bea4e --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipeRepairItem.java @@ -0,0 +1,123 @@ +package net.minecraft.item.crafting; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class RecipeRepairItem implements IRecipe +{ + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(InventoryCrafting inv, World worldIn) + { + List list = Lists.newArrayList(); + + for (int i = 0; i < inv.getSizeInventory(); ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null) + { + list.add(itemstack); + + if (list.size() > 1) + { + ItemStack itemstack1 = (ItemStack)list.get(0); + + if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) + { + return false; + } + } + } + } + + return list.size() == 2; + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack getCraftingResult(InventoryCrafting inv) + { + List list = Lists.newArrayList(); + + for (int i = 0; i < inv.getSizeInventory(); ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null) + { + list.add(itemstack); + + if (list.size() > 1) + { + ItemStack itemstack1 = (ItemStack)list.get(0); + + if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable()) + { + return null; + } + } + } + } + + if (list.size() == 2) + { + ItemStack itemstack2 = (ItemStack)list.get(0); + ItemStack itemstack3 = (ItemStack)list.get(1); + + if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isDamageable()) + { + Item item = itemstack2.getItem(); + int j = item.getMaxDamage() - itemstack2.getItemDamage(); + int k = item.getMaxDamage() - itemstack3.getItemDamage(); + int l = j + k + item.getMaxDamage() * 5 / 100; + int i1 = item.getMaxDamage() - l; + + if (i1 < 0) + { + i1 = 0; + } + + return new ItemStack(itemstack2.getItem(), 1, i1); + } + } + + return null; + } + + /** + * Returns the size of the recipe area + */ + public int getRecipeSize() + { + return 4; + } + + public ItemStack getRecipeOutput() + { + return null; + } + + public ItemStack[] getRemainingItems(InventoryCrafting inv) + { + ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()]; + + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null && itemstack.getItem().hasContainerItem()) + { + aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); + } + } + + return aitemstack; + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipesArmor.java b/src/minecraft/net/minecraft/item/crafting/RecipesArmor.java new file mode 100644 index 0000000..eaf9507 --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipesArmor.java @@ -0,0 +1,28 @@ +package net.minecraft.item.crafting; + +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class RecipesArmor +{ + private String[][] recipePatterns = new String[][] {{"XXX", "X X"}, {"X X", "XXX", "XXX"}, {"XXX", "X X", "X X"}, {"X X", "X X"}}; + private Item[][] recipeItems = new Item[][] {{Items.leather, Items.iron_ingot, Items.diamond, Items.gold_ingot}, {Items.leather_helmet, Items.iron_helmet, Items.diamond_helmet, Items.golden_helmet}, {Items.leather_chestplate, Items.iron_chestplate, Items.diamond_chestplate, Items.golden_chestplate}, {Items.leather_leggings, Items.iron_leggings, Items.diamond_leggings, Items.golden_leggings}, {Items.leather_boots, Items.iron_boots, Items.diamond_boots, Items.golden_boots}}; + + /** + * Adds the armor recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager craftManager) + { + for (int i = 0; i < this.recipeItems[0].length; ++i) + { + Item item = this.recipeItems[0][i]; + + for (int j = 0; j < this.recipeItems.length - 1; ++j) + { + Item item1 = this.recipeItems[j + 1][i]; + craftManager.addRecipe(new ItemStack(item1), new Object[] {this.recipePatterns[j], 'X', item}); + } + } + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java b/src/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java new file mode 100644 index 0000000..0bf979f --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipesArmorDyes.java @@ -0,0 +1,167 @@ +package net.minecraft.item.crafting; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.init.Items; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class RecipesArmorDyes implements IRecipe +{ + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(InventoryCrafting inv, World worldIn) + { + ItemStack itemstack = null; + List list = Lists.newArrayList(); + + for (int i = 0; i < inv.getSizeInventory(); ++i) + { + ItemStack itemstack1 = inv.getStackInSlot(i); + + if (itemstack1 != null) + { + if (itemstack1.getItem() instanceof ItemArmor) + { + ItemArmor itemarmor = (ItemArmor)itemstack1.getItem(); + + if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.LEATHER || itemstack != null) + { + return false; + } + + itemstack = itemstack1; + } + else + { + if (itemstack1.getItem() != Items.dye) + { + return false; + } + + list.add(itemstack1); + } + } + } + + return itemstack != null && !list.isEmpty(); + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack getCraftingResult(InventoryCrafting inv) + { + ItemStack itemstack = null; + int[] aint = new int[3]; + int i = 0; + int j = 0; + ItemArmor itemarmor = null; + + for (int k = 0; k < inv.getSizeInventory(); ++k) + { + ItemStack itemstack1 = inv.getStackInSlot(k); + + if (itemstack1 != null) + { + if (itemstack1.getItem() instanceof ItemArmor) + { + itemarmor = (ItemArmor)itemstack1.getItem(); + + if (itemarmor.getArmorMaterial() != ItemArmor.ArmorMaterial.LEATHER || itemstack != null) + { + return null; + } + + itemstack = itemstack1.copy(); + itemstack.stackSize = 1; + + if (itemarmor.hasColor(itemstack1)) + { + int l = itemarmor.getColor(itemstack); + float f = (float)(l >> 16 & 255) / 255.0F; + float f1 = (float)(l >> 8 & 255) / 255.0F; + float f2 = (float)(l & 255) / 255.0F; + i = (int)((float)i + Math.max(f, Math.max(f1, f2)) * 255.0F); + aint[0] = (int)((float)aint[0] + f * 255.0F); + aint[1] = (int)((float)aint[1] + f1 * 255.0F); + aint[2] = (int)((float)aint[2] + f2 * 255.0F); + ++j; + } + } + else + { + if (itemstack1.getItem() != Items.dye) + { + return null; + } + + float[] afloat = EntitySheep.func_175513_a(EnumDyeColor.byDyeDamage(itemstack1.getMetadata())); + int l1 = (int)(afloat[0] * 255.0F); + int i2 = (int)(afloat[1] * 255.0F); + int j2 = (int)(afloat[2] * 255.0F); + i += Math.max(l1, Math.max(i2, j2)); + aint[0] += l1; + aint[1] += i2; + aint[2] += j2; + ++j; + } + } + } + + if (itemarmor == null) + { + return null; + } + else + { + int i1 = aint[0] / j; + int j1 = aint[1] / j; + int k1 = aint[2] / j; + float f3 = (float)i / (float)j; + float f4 = (float)Math.max(i1, Math.max(j1, k1)); + i1 = (int)((float)i1 * f3 / f4); + j1 = (int)((float)j1 * f3 / f4); + k1 = (int)((float)k1 * f3 / f4); + int lvt_12_3_ = (i1 << 8) + j1; + lvt_12_3_ = (lvt_12_3_ << 8) + k1; + itemarmor.setColor(itemstack, lvt_12_3_); + return itemstack; + } + } + + /** + * Returns the size of the recipe area + */ + public int getRecipeSize() + { + return 10; + } + + public ItemStack getRecipeOutput() + { + return null; + } + + public ItemStack[] getRemainingItems(InventoryCrafting inv) + { + ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()]; + + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null && itemstack.getItem().hasContainerItem()) + { + aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); + } + } + + return aitemstack; + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipesBanners.java b/src/minecraft/net/minecraft/item/crafting/RecipesBanners.java new file mode 100644 index 0000000..141e446 --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipesBanners.java @@ -0,0 +1,377 @@ +package net.minecraft.item.crafting; + +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntityBanner; +import net.minecraft.world.World; + +public class RecipesBanners +{ + /** + * Adds the banner recipes to the CraftingManager. + */ + void addRecipes(CraftingManager p_179534_1_) + { + for (EnumDyeColor enumdyecolor : EnumDyeColor.values()) + { + p_179534_1_.addRecipe(new ItemStack(Items.banner, 1, enumdyecolor.getDyeDamage()), new Object[] {"###", "###", " | ", '#', new ItemStack(Blocks.wool, 1, enumdyecolor.getMetadata()), '|', Items.stick}); + } + + p_179534_1_.addRecipe(new RecipesBanners.RecipeDuplicatePattern()); + p_179534_1_.addRecipe(new RecipesBanners.RecipeAddPattern()); + } + + static class RecipeAddPattern implements IRecipe + { + private RecipeAddPattern() + { + } + + public boolean matches(InventoryCrafting inv, World worldIn) + { + boolean flag = false; + + for (int i = 0; i < inv.getSizeInventory(); ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null && itemstack.getItem() == Items.banner) + { + if (flag) + { + return false; + } + + if (TileEntityBanner.getPatterns(itemstack) >= 6) + { + return false; + } + + flag = true; + } + } + + if (!flag) + { + return false; + } + else + { + return this.func_179533_c(inv) != null; + } + } + + public ItemStack getCraftingResult(InventoryCrafting inv) + { + ItemStack itemstack = null; + + for (int i = 0; i < inv.getSizeInventory(); ++i) + { + ItemStack itemstack1 = inv.getStackInSlot(i); + + if (itemstack1 != null && itemstack1.getItem() == Items.banner) + { + itemstack = itemstack1.copy(); + itemstack.stackSize = 1; + break; + } + } + + TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = this.func_179533_c(inv); + + if (tileentitybanner$enumbannerpattern != null) + { + int k = 0; + + for (int j = 0; j < inv.getSizeInventory(); ++j) + { + ItemStack itemstack2 = inv.getStackInSlot(j); + + if (itemstack2 != null && itemstack2.getItem() == Items.dye) + { + k = itemstack2.getMetadata(); + break; + } + } + + NBTTagCompound nbttagcompound1 = itemstack.getSubCompound("BlockEntityTag", true); + NBTTagList nbttaglist = null; + + if (nbttagcompound1.hasKey("Patterns", 9)) + { + nbttaglist = nbttagcompound1.getTagList("Patterns", 10); + } + else + { + nbttaglist = new NBTTagList(); + nbttagcompound1.setTag("Patterns", nbttaglist); + } + + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("Pattern", tileentitybanner$enumbannerpattern.getPatternID()); + nbttagcompound.setInteger("Color", k); + nbttaglist.appendTag(nbttagcompound); + } + + return itemstack; + } + + public int getRecipeSize() + { + return 10; + } + + public ItemStack getRecipeOutput() + { + return null; + } + + public ItemStack[] getRemainingItems(InventoryCrafting inv) + { + ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()]; + + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null && itemstack.getItem().hasContainerItem()) + { + aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); + } + } + + return aitemstack; + } + + private TileEntityBanner.EnumBannerPattern func_179533_c(InventoryCrafting p_179533_1_) + { + for (TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern : TileEntityBanner.EnumBannerPattern.values()) + { + if (tileentitybanner$enumbannerpattern.hasValidCrafting()) + { + boolean flag = true; + + if (tileentitybanner$enumbannerpattern.hasCraftingStack()) + { + boolean flag1 = false; + boolean flag2 = false; + + for (int i = 0; i < p_179533_1_.getSizeInventory() && flag; ++i) + { + ItemStack itemstack = p_179533_1_.getStackInSlot(i); + + if (itemstack != null && itemstack.getItem() != Items.banner) + { + if (itemstack.getItem() == Items.dye) + { + if (flag2) + { + flag = false; + break; + } + + flag2 = true; + } + else + { + if (flag1 || !itemstack.isItemEqual(tileentitybanner$enumbannerpattern.getCraftingStack())) + { + flag = false; + break; + } + + flag1 = true; + } + } + } + + if (!flag1) + { + flag = false; + } + } + else if (p_179533_1_.getSizeInventory() == tileentitybanner$enumbannerpattern.getCraftingLayers().length * tileentitybanner$enumbannerpattern.getCraftingLayers()[0].length()) + { + int j = -1; + + for (int k = 0; k < p_179533_1_.getSizeInventory() && flag; ++k) + { + int l = k / 3; + int i1 = k % 3; + ItemStack itemstack1 = p_179533_1_.getStackInSlot(k); + + if (itemstack1 != null && itemstack1.getItem() != Items.banner) + { + if (itemstack1.getItem() != Items.dye) + { + flag = false; + break; + } + + if (j != -1 && j != itemstack1.getMetadata()) + { + flag = false; + break; + } + + if (tileentitybanner$enumbannerpattern.getCraftingLayers()[l].charAt(i1) == 32) + { + flag = false; + break; + } + + j = itemstack1.getMetadata(); + } + else if (tileentitybanner$enumbannerpattern.getCraftingLayers()[l].charAt(i1) != 32) + { + flag = false; + break; + } + } + } + else + { + flag = false; + } + + if (flag) + { + return tileentitybanner$enumbannerpattern; + } + } + } + + return null; + } + } + + static class RecipeDuplicatePattern implements IRecipe + { + private RecipeDuplicatePattern() + { + } + + public boolean matches(InventoryCrafting inv, World worldIn) + { + ItemStack itemstack = null; + ItemStack itemstack1 = null; + + for (int i = 0; i < inv.getSizeInventory(); ++i) + { + ItemStack itemstack2 = inv.getStackInSlot(i); + + if (itemstack2 != null) + { + if (itemstack2.getItem() != Items.banner) + { + return false; + } + + if (itemstack != null && itemstack1 != null) + { + return false; + } + + int j = TileEntityBanner.getBaseColor(itemstack2); + boolean flag = TileEntityBanner.getPatterns(itemstack2) > 0; + + if (itemstack != null) + { + if (flag) + { + return false; + } + + if (j != TileEntityBanner.getBaseColor(itemstack)) + { + return false; + } + + itemstack1 = itemstack2; + } + else if (itemstack1 != null) + { + if (!flag) + { + return false; + } + + if (j != TileEntityBanner.getBaseColor(itemstack1)) + { + return false; + } + + itemstack = itemstack2; + } + else if (flag) + { + itemstack = itemstack2; + } + else + { + itemstack1 = itemstack2; + } + } + } + + return itemstack != null && itemstack1 != null; + } + + public ItemStack getCraftingResult(InventoryCrafting inv) + { + for (int i = 0; i < inv.getSizeInventory(); ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null && TileEntityBanner.getPatterns(itemstack) > 0) + { + ItemStack itemstack1 = itemstack.copy(); + itemstack1.stackSize = 1; + return itemstack1; + } + } + + return null; + } + + public int getRecipeSize() + { + return 2; + } + + public ItemStack getRecipeOutput() + { + return null; + } + + public ItemStack[] getRemainingItems(InventoryCrafting inv) + { + ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()]; + + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null) + { + if (itemstack.getItem().hasContainerItem()) + { + aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); + } + else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0) + { + aitemstack[i] = itemstack.copy(); + aitemstack[i].stackSize = 1; + } + } + } + + return aitemstack; + } + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipesCrafting.java b/src/minecraft/net/minecraft/item/crafting/RecipesCrafting.java new file mode 100644 index 0000000..fb05a99 --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipesCrafting.java @@ -0,0 +1,59 @@ +package net.minecraft.item.crafting; + +import net.minecraft.block.BlockDirt; +import net.minecraft.block.BlockPrismarine; +import net.minecraft.block.BlockQuartz; +import net.minecraft.block.BlockRedSandstone; +import net.minecraft.block.BlockSand; +import net.minecraft.block.BlockSandStone; +import net.minecraft.block.BlockStone; +import net.minecraft.block.BlockStoneBrick; +import net.minecraft.block.BlockStoneSlab; +import net.minecraft.block.BlockStoneSlabNew; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.ItemStack; + +public class RecipesCrafting +{ + /** + * Adds the crafting recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager p_77589_1_) + { + p_77589_1_.addRecipe(new ItemStack(Blocks.chest), new Object[] {"###", "# #", "###", '#', Blocks.planks}); + p_77589_1_.addRecipe(new ItemStack(Blocks.trapped_chest), new Object[] {"#-", '#', Blocks.chest, '-', Blocks.tripwire_hook}); + p_77589_1_.addRecipe(new ItemStack(Blocks.ender_chest), new Object[] {"###", "#E#", "###", '#', Blocks.obsidian, 'E', Items.ender_eye}); + p_77589_1_.addRecipe(new ItemStack(Blocks.furnace), new Object[] {"###", "# #", "###", '#', Blocks.cobblestone}); + p_77589_1_.addRecipe(new ItemStack(Blocks.crafting_table), new Object[] {"##", "##", '#', Blocks.planks}); + p_77589_1_.addRecipe(new ItemStack(Blocks.sandstone), new Object[] {"##", "##", '#', new ItemStack(Blocks.sand, 1, BlockSand.EnumType.SAND.getMetadata())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.red_sandstone), new Object[] {"##", "##", '#', new ItemStack(Blocks.sand, 1, BlockSand.EnumType.RED_SAND.getMetadata())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.sandstone, 4, BlockSandStone.EnumType.SMOOTH.getMetadata()), new Object[] {"##", "##", '#', new ItemStack(Blocks.sandstone, 1, BlockSandStone.EnumType.DEFAULT.getMetadata())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.red_sandstone, 4, BlockRedSandstone.EnumType.SMOOTH.getMetadata()), new Object[] {"##", "##", '#', new ItemStack(Blocks.red_sandstone, 1, BlockRedSandstone.EnumType.DEFAULT.getMetadata())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.sandstone, 1, BlockSandStone.EnumType.CHISELED.getMetadata()), new Object[] {"#", "#", '#', new ItemStack(Blocks.stone_slab, 1, BlockStoneSlab.EnumType.SAND.getMetadata())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.red_sandstone, 1, BlockRedSandstone.EnumType.CHISELED.getMetadata()), new Object[] {"#", "#", '#', new ItemStack(Blocks.stone_slab2, 1, BlockStoneSlabNew.EnumType.RED_SANDSTONE.getMetadata())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.quartz_block, 1, BlockQuartz.EnumType.CHISELED.getMetadata()), new Object[] {"#", "#", '#', new ItemStack(Blocks.stone_slab, 1, BlockStoneSlab.EnumType.QUARTZ.getMetadata())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.quartz_block, 2, BlockQuartz.EnumType.LINES_Y.getMetadata()), new Object[] {"#", "#", '#', new ItemStack(Blocks.quartz_block, 1, BlockQuartz.EnumType.DEFAULT.getMetadata())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.stonebrick, 4), new Object[] {"##", "##", '#', new ItemStack(Blocks.stone, 1, BlockStone.EnumType.STONE.getMetadata())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.CHISELED_META), new Object[] {"#", "#", '#', new ItemStack(Blocks.stone_slab, 1, BlockStoneSlab.EnumType.SMOOTHBRICK.getMetadata())}); + p_77589_1_.addShapelessRecipe(new ItemStack(Blocks.stonebrick, 1, BlockStoneBrick.MOSSY_META), new Object[] {Blocks.stonebrick, Blocks.vine}); + p_77589_1_.addShapelessRecipe(new ItemStack(Blocks.mossy_cobblestone, 1), new Object[] {Blocks.cobblestone, Blocks.vine}); + p_77589_1_.addRecipe(new ItemStack(Blocks.iron_bars, 16), new Object[] {"###", "###", '#', Items.iron_ingot}); + p_77589_1_.addRecipe(new ItemStack(Blocks.glass_pane, 16), new Object[] {"###", "###", '#', Blocks.glass}); + p_77589_1_.addRecipe(new ItemStack(Blocks.redstone_lamp, 1), new Object[] {" R ", "RGR", " R ", 'R', Items.redstone, 'G', Blocks.glowstone}); + p_77589_1_.addRecipe(new ItemStack(Blocks.beacon, 1), new Object[] {"GGG", "GSG", "OOO", 'G', Blocks.glass, 'S', Items.nether_star, 'O', Blocks.obsidian}); + p_77589_1_.addRecipe(new ItemStack(Blocks.nether_brick, 1), new Object[] {"NN", "NN", 'N', Items.netherbrick}); + p_77589_1_.addRecipe(new ItemStack(Blocks.stone, 2, BlockStone.EnumType.DIORITE.getMetadata()), new Object[] {"CQ", "QC", 'C', Blocks.cobblestone, 'Q', Items.quartz}); + p_77589_1_.addShapelessRecipe(new ItemStack(Blocks.stone, 1, BlockStone.EnumType.GRANITE.getMetadata()), new Object[] {new ItemStack(Blocks.stone, 1, BlockStone.EnumType.DIORITE.getMetadata()), Items.quartz}); + p_77589_1_.addShapelessRecipe(new ItemStack(Blocks.stone, 2, BlockStone.EnumType.ANDESITE.getMetadata()), new Object[] {new ItemStack(Blocks.stone, 1, BlockStone.EnumType.DIORITE.getMetadata()), Blocks.cobblestone}); + p_77589_1_.addRecipe(new ItemStack(Blocks.dirt, 4, BlockDirt.DirtType.COARSE_DIRT.getMetadata()), new Object[] {"DG", "GD", 'D', new ItemStack(Blocks.dirt, 1, BlockDirt.DirtType.DIRT.getMetadata()), 'G', Blocks.gravel}); + p_77589_1_.addRecipe(new ItemStack(Blocks.stone, 4, BlockStone.EnumType.DIORITE_SMOOTH.getMetadata()), new Object[] {"SS", "SS", 'S', new ItemStack(Blocks.stone, 1, BlockStone.EnumType.DIORITE.getMetadata())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.stone, 4, BlockStone.EnumType.GRANITE_SMOOTH.getMetadata()), new Object[] {"SS", "SS", 'S', new ItemStack(Blocks.stone, 1, BlockStone.EnumType.GRANITE.getMetadata())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.stone, 4, BlockStone.EnumType.ANDESITE_SMOOTH.getMetadata()), new Object[] {"SS", "SS", 'S', new ItemStack(Blocks.stone, 1, BlockStone.EnumType.ANDESITE.getMetadata())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.prismarine, 1, BlockPrismarine.ROUGH_META), new Object[] {"SS", "SS", 'S', Items.prismarine_shard}); + p_77589_1_.addRecipe(new ItemStack(Blocks.prismarine, 1, BlockPrismarine.BRICKS_META), new Object[] {"SSS", "SSS", "SSS", 'S', Items.prismarine_shard}); + p_77589_1_.addRecipe(new ItemStack(Blocks.prismarine, 1, BlockPrismarine.DARK_META), new Object[] {"SSS", "SIS", "SSS", 'S', Items.prismarine_shard, 'I', new ItemStack(Items.dye, 1, EnumDyeColor.BLACK.getDyeDamage())}); + p_77589_1_.addRecipe(new ItemStack(Blocks.sea_lantern, 1, 0), new Object[] {"SCS", "CCC", "SCS", 'S', Items.prismarine_shard, 'C', Items.prismarine_crystals}); + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipesDyes.java b/src/minecraft/net/minecraft/item/crafting/RecipesDyes.java new file mode 100644 index 0000000..bfd85ce --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipesDyes.java @@ -0,0 +1,59 @@ +package net.minecraft.item.crafting; + +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.block.BlockFlower; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class RecipesDyes +{ + /** + * Adds the dye recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager p_77607_1_) + { + for (int i = 0; i < 16; ++i) + { + p_77607_1_.addShapelessRecipe(new ItemStack(Blocks.wool, 1, i), new Object[] {new ItemStack(Items.dye, 1, 15 - i), new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, 0)}); + p_77607_1_.addRecipe(new ItemStack(Blocks.stained_hardened_clay, 8, 15 - i), new Object[] {"###", "#X#", "###", '#', new ItemStack(Blocks.hardened_clay), 'X', new ItemStack(Items.dye, 1, i)}); + p_77607_1_.addRecipe(new ItemStack(Blocks.stained_glass, 8, 15 - i), new Object[] {"###", "#X#", "###", '#', new ItemStack(Blocks.glass), 'X', new ItemStack(Items.dye, 1, i)}); + p_77607_1_.addRecipe(new ItemStack(Blocks.stained_glass_pane, 16, i), new Object[] {"###", "###", '#', new ItemStack(Blocks.stained_glass, 1, i)}); + } + + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 1, EnumDyeColor.YELLOW.getDyeDamage()), new Object[] {new ItemStack(Blocks.yellow_flower, 1, BlockFlower.EnumFlowerType.DANDELION.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 1, EnumDyeColor.RED.getDyeDamage()), new Object[] {new ItemStack(Blocks.red_flower, 1, BlockFlower.EnumFlowerType.POPPY.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 3, EnumDyeColor.WHITE.getDyeDamage()), new Object[] {Items.bone}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.PINK.getDyeDamage()), new Object[] {new ItemStack(Items.dye, 1, EnumDyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.WHITE.getDyeDamage())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.ORANGE.getDyeDamage()), new Object[] {new ItemStack(Items.dye, 1, EnumDyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.YELLOW.getDyeDamage())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.LIME.getDyeDamage()), new Object[] {new ItemStack(Items.dye, 1, EnumDyeColor.GREEN.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.WHITE.getDyeDamage())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.GRAY.getDyeDamage()), new Object[] {new ItemStack(Items.dye, 1, EnumDyeColor.BLACK.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.WHITE.getDyeDamage())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.SILVER.getDyeDamage()), new Object[] {new ItemStack(Items.dye, 1, EnumDyeColor.GRAY.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.WHITE.getDyeDamage())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 3, EnumDyeColor.SILVER.getDyeDamage()), new Object[] {new ItemStack(Items.dye, 1, EnumDyeColor.BLACK.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.WHITE.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.WHITE.getDyeDamage())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.LIGHT_BLUE.getDyeDamage()), new Object[] {new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.WHITE.getDyeDamage())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.CYAN.getDyeDamage()), new Object[] {new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.GREEN.getDyeDamage())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.PURPLE.getDyeDamage()), new Object[] {new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.RED.getDyeDamage())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.MAGENTA.getDyeDamage()), new Object[] {new ItemStack(Items.dye, 1, EnumDyeColor.PURPLE.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.PINK.getDyeDamage())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 3, EnumDyeColor.MAGENTA.getDyeDamage()), new Object[] {new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.PINK.getDyeDamage())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 4, EnumDyeColor.MAGENTA.getDyeDamage()), new Object[] {new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.RED.getDyeDamage()), new ItemStack(Items.dye, 1, EnumDyeColor.WHITE.getDyeDamage())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 1, EnumDyeColor.LIGHT_BLUE.getDyeDamage()), new Object[] {new ItemStack(Blocks.red_flower, 1, BlockFlower.EnumFlowerType.BLUE_ORCHID.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 1, EnumDyeColor.MAGENTA.getDyeDamage()), new Object[] {new ItemStack(Blocks.red_flower, 1, BlockFlower.EnumFlowerType.ALLIUM.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 1, EnumDyeColor.SILVER.getDyeDamage()), new Object[] {new ItemStack(Blocks.red_flower, 1, BlockFlower.EnumFlowerType.HOUSTONIA.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 1, EnumDyeColor.RED.getDyeDamage()), new Object[] {new ItemStack(Blocks.red_flower, 1, BlockFlower.EnumFlowerType.RED_TULIP.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 1, EnumDyeColor.ORANGE.getDyeDamage()), new Object[] {new ItemStack(Blocks.red_flower, 1, BlockFlower.EnumFlowerType.ORANGE_TULIP.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 1, EnumDyeColor.SILVER.getDyeDamage()), new Object[] {new ItemStack(Blocks.red_flower, 1, BlockFlower.EnumFlowerType.WHITE_TULIP.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 1, EnumDyeColor.PINK.getDyeDamage()), new Object[] {new ItemStack(Blocks.red_flower, 1, BlockFlower.EnumFlowerType.PINK_TULIP.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 1, EnumDyeColor.SILVER.getDyeDamage()), new Object[] {new ItemStack(Blocks.red_flower, 1, BlockFlower.EnumFlowerType.OXEYE_DAISY.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.YELLOW.getDyeDamage()), new Object[] {new ItemStack(Blocks.double_plant, 1, BlockDoublePlant.EnumPlantType.SUNFLOWER.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.MAGENTA.getDyeDamage()), new Object[] {new ItemStack(Blocks.double_plant, 1, BlockDoublePlant.EnumPlantType.SYRINGA.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.RED.getDyeDamage()), new Object[] {new ItemStack(Blocks.double_plant, 1, BlockDoublePlant.EnumPlantType.ROSE.getMeta())}); + p_77607_1_.addShapelessRecipe(new ItemStack(Items.dye, 2, EnumDyeColor.PINK.getDyeDamage()), new Object[] {new ItemStack(Blocks.double_plant, 1, BlockDoublePlant.EnumPlantType.PAEONIA.getMeta())}); + + for (int j = 0; j < 16; ++j) + { + p_77607_1_.addRecipe(new ItemStack(Blocks.carpet, 3, j), new Object[] {"##", '#', new ItemStack(Blocks.wool, 1, j)}); + } + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipesFood.java b/src/minecraft/net/minecraft/item/crafting/RecipesFood.java new file mode 100644 index 0000000..40dfef2 --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipesFood.java @@ -0,0 +1,27 @@ +package net.minecraft.item.crafting; + +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.ItemStack; + +public class RecipesFood +{ + /** + * Adds the food recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager p_77608_1_) + { + p_77608_1_.addShapelessRecipe(new ItemStack(Items.mushroom_stew), new Object[] {Blocks.brown_mushroom, Blocks.red_mushroom, Items.bowl}); + p_77608_1_.addRecipe(new ItemStack(Items.cookie, 8), new Object[] {"#X#", 'X', new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage()), '#', Items.wheat}); + p_77608_1_.addRecipe(new ItemStack(Items.rabbit_stew), new Object[] {" R ", "CPM", " B ", 'R', new ItemStack(Items.cooked_rabbit), 'C', Items.carrot, 'P', Items.baked_potato, 'M', Blocks.brown_mushroom, 'B', Items.bowl}); + p_77608_1_.addRecipe(new ItemStack(Items.rabbit_stew), new Object[] {" R ", "CPD", " B ", 'R', new ItemStack(Items.cooked_rabbit), 'C', Items.carrot, 'P', Items.baked_potato, 'D', Blocks.red_mushroom, 'B', Items.bowl}); + p_77608_1_.addRecipe(new ItemStack(Blocks.melon_block), new Object[] {"MMM", "MMM", "MMM", 'M', Items.melon}); + p_77608_1_.addRecipe(new ItemStack(Items.melon_seeds), new Object[] {"M", 'M', Items.melon}); + p_77608_1_.addRecipe(new ItemStack(Items.pumpkin_seeds, 4), new Object[] {"M", 'M', Blocks.pumpkin}); + p_77608_1_.addShapelessRecipe(new ItemStack(Items.pumpkin_pie), new Object[] {Blocks.pumpkin, Items.sugar, Items.egg}); + p_77608_1_.addShapelessRecipe(new ItemStack(Items.fermented_spider_eye), new Object[] {Items.spider_eye, Blocks.brown_mushroom, Items.sugar}); + p_77608_1_.addShapelessRecipe(new ItemStack(Items.blaze_powder, 2), new Object[] {Items.blaze_rod}); + p_77608_1_.addShapelessRecipe(new ItemStack(Items.magma_cream), new Object[] {Items.blaze_powder, Items.slime_ball}); + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipesIngots.java b/src/minecraft/net/minecraft/item/crafting/RecipesIngots.java new file mode 100644 index 0000000..b30cc54 --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipesIngots.java @@ -0,0 +1,29 @@ +package net.minecraft.item.crafting; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.ItemStack; + +public class RecipesIngots +{ + private Object[][] recipeItems = new Object[][] {{Blocks.gold_block, new ItemStack(Items.gold_ingot, 9)}, {Blocks.iron_block, new ItemStack(Items.iron_ingot, 9)}, {Blocks.diamond_block, new ItemStack(Items.diamond, 9)}, {Blocks.emerald_block, new ItemStack(Items.emerald, 9)}, {Blocks.lapis_block, new ItemStack(Items.dye, 9, EnumDyeColor.BLUE.getDyeDamage())}, {Blocks.redstone_block, new ItemStack(Items.redstone, 9)}, {Blocks.coal_block, new ItemStack(Items.coal, 9, 0)}, {Blocks.hay_block, new ItemStack(Items.wheat, 9)}, {Blocks.slime_block, new ItemStack(Items.slime_ball, 9)}}; + + /** + * Adds the ingot recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager p_77590_1_) + { + for (int i = 0; i < this.recipeItems.length; ++i) + { + Block block = (Block)this.recipeItems[i][0]; + ItemStack itemstack = (ItemStack)this.recipeItems[i][1]; + p_77590_1_.addRecipe(new ItemStack(block), new Object[] {"###", "###", "###", '#', itemstack}); + p_77590_1_.addRecipe(itemstack, new Object[] {"#", '#', block}); + } + + p_77590_1_.addRecipe(new ItemStack(Items.gold_ingot), new Object[] {"###", "###", "###", '#', Items.gold_nugget}); + p_77590_1_.addRecipe(new ItemStack(Items.gold_nugget, 9), new Object[] {"#", '#', Items.gold_ingot}); + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java b/src/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java new file mode 100644 index 0000000..bdc28f0 --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipesMapCloning.java @@ -0,0 +1,129 @@ +package net.minecraft.item.crafting; + +import net.minecraft.init.Items; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class RecipesMapCloning implements IRecipe +{ + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(InventoryCrafting inv, World worldIn) + { + int i = 0; + ItemStack itemstack = null; + + for (int j = 0; j < inv.getSizeInventory(); ++j) + { + ItemStack itemstack1 = inv.getStackInSlot(j); + + if (itemstack1 != null) + { + if (itemstack1.getItem() == Items.filled_map) + { + if (itemstack != null) + { + return false; + } + + itemstack = itemstack1; + } + else + { + if (itemstack1.getItem() != Items.map) + { + return false; + } + + ++i; + } + } + } + + return itemstack != null && i > 0; + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack getCraftingResult(InventoryCrafting inv) + { + int i = 0; + ItemStack itemstack = null; + + for (int j = 0; j < inv.getSizeInventory(); ++j) + { + ItemStack itemstack1 = inv.getStackInSlot(j); + + if (itemstack1 != null) + { + if (itemstack1.getItem() == Items.filled_map) + { + if (itemstack != null) + { + return null; + } + + itemstack = itemstack1; + } + else + { + if (itemstack1.getItem() != Items.map) + { + return null; + } + + ++i; + } + } + } + + if (itemstack != null && i >= 1) + { + ItemStack itemstack2 = new ItemStack(Items.filled_map, i + 1, itemstack.getMetadata()); + + if (itemstack.hasDisplayName()) + { + itemstack2.setStackDisplayName(itemstack.getDisplayName()); + } + + return itemstack2; + } + else + { + return null; + } + } + + /** + * Returns the size of the recipe area + */ + public int getRecipeSize() + { + return 9; + } + + public ItemStack getRecipeOutput() + { + return null; + } + + public ItemStack[] getRemainingItems(InventoryCrafting inv) + { + ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()]; + + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null && itemstack.getItem().hasContainerItem()) + { + aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); + } + } + + return aitemstack; + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipesMapExtending.java b/src/minecraft/net/minecraft/item/crafting/RecipesMapExtending.java new file mode 100644 index 0000000..6331ef9 --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipesMapExtending.java @@ -0,0 +1,80 @@ +package net.minecraft.item.crafting; + +import net.minecraft.init.Items; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraft.world.storage.MapData; + +public class RecipesMapExtending extends ShapedRecipes +{ + public RecipesMapExtending() + { + super(3, 3, new ItemStack[] {new ItemStack(Items.paper), new ItemStack(Items.paper), new ItemStack(Items.paper), new ItemStack(Items.paper), new ItemStack(Items.filled_map, 0, 32767), new ItemStack(Items.paper), new ItemStack(Items.paper), new ItemStack(Items.paper), new ItemStack(Items.paper)}, new ItemStack(Items.map, 0, 0)); + } + + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(InventoryCrafting inv, World worldIn) + { + if (!super.matches(inv, worldIn)) + { + return false; + } + else + { + ItemStack itemstack = null; + + for (int i = 0; i < inv.getSizeInventory() && itemstack == null; ++i) + { + ItemStack itemstack1 = inv.getStackInSlot(i); + + if (itemstack1 != null && itemstack1.getItem() == Items.filled_map) + { + itemstack = itemstack1; + } + } + + if (itemstack == null) + { + return false; + } + else + { + MapData mapdata = Items.filled_map.getMapData(itemstack, worldIn); + return mapdata == null ? false : mapdata.scale < 4; + } + } + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack getCraftingResult(InventoryCrafting inv) + { + ItemStack itemstack = null; + + for (int i = 0; i < inv.getSizeInventory() && itemstack == null; ++i) + { + ItemStack itemstack1 = inv.getStackInSlot(i); + + if (itemstack1 != null && itemstack1.getItem() == Items.filled_map) + { + itemstack = itemstack1; + } + } + + itemstack = itemstack.copy(); + itemstack.stackSize = 1; + + if (itemstack.getTagCompound() == null) + { + itemstack.setTagCompound(new NBTTagCompound()); + } + + itemstack.getTagCompound().setBoolean("map_is_scaling", true); + return itemstack; + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipesTools.java b/src/minecraft/net/minecraft/item/crafting/RecipesTools.java new file mode 100644 index 0000000..a185060 --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipesTools.java @@ -0,0 +1,31 @@ +package net.minecraft.item.crafting; + +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class RecipesTools +{ + private String[][] recipePatterns = new String[][] {{"XXX", " # ", " # "}, {"X", "#", "#"}, {"XX", "X#", " #"}, {"XX", " #", " #"}}; + private Object[][] recipeItems = new Object[][] {{Blocks.planks, Blocks.cobblestone, Items.iron_ingot, Items.diamond, Items.gold_ingot}, {Items.wooden_pickaxe, Items.stone_pickaxe, Items.iron_pickaxe, Items.diamond_pickaxe, Items.golden_pickaxe}, {Items.wooden_shovel, Items.stone_shovel, Items.iron_shovel, Items.diamond_shovel, Items.golden_shovel}, {Items.wooden_axe, Items.stone_axe, Items.iron_axe, Items.diamond_axe, Items.golden_axe}, {Items.wooden_hoe, Items.stone_hoe, Items.iron_hoe, Items.diamond_hoe, Items.golden_hoe}}; + + /** + * Adds the tool recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager p_77586_1_) + { + for (int i = 0; i < this.recipeItems[0].length; ++i) + { + Object object = this.recipeItems[0][i]; + + for (int j = 0; j < this.recipeItems.length - 1; ++j) + { + Item item = (Item)this.recipeItems[j + 1][i]; + p_77586_1_.addRecipe(new ItemStack(item), new Object[] {this.recipePatterns[j], '#', Items.stick, 'X', object}); + } + } + + p_77586_1_.addRecipe(new ItemStack(Items.shears), new Object[] {" #", "# ", '#', Items.iron_ingot}); + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/RecipesWeapons.java b/src/minecraft/net/minecraft/item/crafting/RecipesWeapons.java new file mode 100644 index 0000000..6fa3d12 --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/RecipesWeapons.java @@ -0,0 +1,32 @@ +package net.minecraft.item.crafting; + +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class RecipesWeapons +{ + private String[][] recipePatterns = new String[][] {{"X", "X", "#"}}; + private Object[][] recipeItems = new Object[][] {{Blocks.planks, Blocks.cobblestone, Items.iron_ingot, Items.diamond, Items.gold_ingot}, {Items.wooden_sword, Items.stone_sword, Items.iron_sword, Items.diamond_sword, Items.golden_sword}}; + + /** + * Adds the weapon recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager p_77583_1_) + { + for (int i = 0; i < this.recipeItems[0].length; ++i) + { + Object object = this.recipeItems[0][i]; + + for (int j = 0; j < this.recipeItems.length - 1; ++j) + { + Item item = (Item)this.recipeItems[j + 1][i]; + p_77583_1_.addRecipe(new ItemStack(item), new Object[] {this.recipePatterns[j], '#', Items.stick, 'X', object}); + } + } + + p_77583_1_.addRecipe(new ItemStack(Items.bow, 1), new Object[] {" #X", "# X", " #X", 'X', Items.string, '#', Items.stick}); + p_77583_1_.addRecipe(new ItemStack(Items.arrow, 4), new Object[] {"X", "#", "Y", 'Y', Items.feather, 'X', Items.flint, '#', Items.stick}); + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/ShapedRecipes.java b/src/minecraft/net/minecraft/item/crafting/ShapedRecipes.java new file mode 100644 index 0000000..edaccb7 --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/ShapedRecipes.java @@ -0,0 +1,157 @@ +package net.minecraft.item.crafting; + +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public class ShapedRecipes implements IRecipe +{ + /** How many horizontal slots this recipe is wide. */ + private final int recipeWidth; + + /** How many vertical slots this recipe uses. */ + private final int recipeHeight; + + /** Is a array of ItemStack that composes the recipe. */ + private final ItemStack[] recipeItems; + + /** Is the ItemStack that you get when craft the recipe. */ + private final ItemStack recipeOutput; + private boolean copyIngredientNBT; + + public ShapedRecipes(int width, int height, ItemStack[] p_i1917_3_, ItemStack output) + { + this.recipeWidth = width; + this.recipeHeight = height; + this.recipeItems = p_i1917_3_; + this.recipeOutput = output; + } + + public ItemStack getRecipeOutput() + { + return this.recipeOutput; + } + + public ItemStack[] getRemainingItems(InventoryCrafting inv) + { + ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()]; + + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null && itemstack.getItem().hasContainerItem()) + { + aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); + } + } + + return aitemstack; + } + + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(InventoryCrafting inv, World worldIn) + { + for (int i = 0; i <= 3 - this.recipeWidth; ++i) + { + for (int j = 0; j <= 3 - this.recipeHeight; ++j) + { + if (this.checkMatch(inv, i, j, true)) + { + return true; + } + + if (this.checkMatch(inv, i, j, false)) + { + return true; + } + } + } + + return false; + } + + /** + * Checks if the region of a crafting inventory is match for the recipe. + */ + private boolean checkMatch(InventoryCrafting p_77573_1_, int p_77573_2_, int p_77573_3_, boolean p_77573_4_) + { + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 3; ++j) + { + int k = i - p_77573_2_; + int l = j - p_77573_3_; + ItemStack itemstack = null; + + if (k >= 0 && l >= 0 && k < this.recipeWidth && l < this.recipeHeight) + { + if (p_77573_4_) + { + itemstack = this.recipeItems[this.recipeWidth - k - 1 + l * this.recipeWidth]; + } + else + { + itemstack = this.recipeItems[k + l * this.recipeWidth]; + } + } + + ItemStack itemstack1 = p_77573_1_.getStackInRowAndColumn(i, j); + + if (itemstack1 != null || itemstack != null) + { + if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null) + { + return false; + } + + if (itemstack.getItem() != itemstack1.getItem()) + { + return false; + } + + if (itemstack.getMetadata() != 32767 && itemstack.getMetadata() != itemstack1.getMetadata()) + { + return false; + } + } + } + } + + return true; + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack getCraftingResult(InventoryCrafting inv) + { + ItemStack itemstack = this.getRecipeOutput().copy(); + + if (this.copyIngredientNBT) + { + for (int i = 0; i < inv.getSizeInventory(); ++i) + { + ItemStack itemstack1 = inv.getStackInSlot(i); + + if (itemstack1 != null && itemstack1.hasTagCompound()) + { + itemstack.setTagCompound((NBTTagCompound)itemstack1.getTagCompound().copy()); + } + } + } + + return itemstack; + } + + /** + * Returns the size of the recipe area + */ + public int getRecipeSize() + { + return this.recipeWidth * this.recipeHeight; + } +} diff --git a/src/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java b/src/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java new file mode 100644 index 0000000..727215f --- /dev/null +++ b/src/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java @@ -0,0 +1,96 @@ +package net.minecraft.item.crafting; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class ShapelessRecipes implements IRecipe +{ + /** Is the ItemStack that you get when craft the recipe. */ + private final ItemStack recipeOutput; + private final List recipeItems; + + public ShapelessRecipes(ItemStack output, List inputList) + { + this.recipeOutput = output; + this.recipeItems = inputList; + } + + public ItemStack getRecipeOutput() + { + return this.recipeOutput; + } + + public ItemStack[] getRemainingItems(InventoryCrafting inv) + { + ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()]; + + for (int i = 0; i < aitemstack.length; ++i) + { + ItemStack itemstack = inv.getStackInSlot(i); + + if (itemstack != null && itemstack.getItem().hasContainerItem()) + { + aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem()); + } + } + + return aitemstack; + } + + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(InventoryCrafting inv, World worldIn) + { + List list = Lists.newArrayList(this.recipeItems); + + for (int i = 0; i < inv.getHeight(); ++i) + { + for (int j = 0; j < inv.getWidth(); ++j) + { + ItemStack itemstack = inv.getStackInRowAndColumn(j, i); + + if (itemstack != null) + { + boolean flag = false; + + for (ItemStack itemstack1 : list) + { + if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getMetadata() == 32767 || itemstack.getMetadata() == itemstack1.getMetadata())) + { + flag = true; + list.remove(itemstack1); + break; + } + } + + if (!flag) + { + return false; + } + } + } + } + + return list.isEmpty(); + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack getCraftingResult(InventoryCrafting inv) + { + return this.recipeOutput.copy(); + } + + /** + * Returns the size of the recipe area + */ + public int getRecipeSize() + { + return this.recipeItems.size(); + } +} diff --git a/src/minecraft/net/minecraft/nbt/CompressedStreamTools.java b/src/minecraft/net/minecraft/nbt/CompressedStreamTools.java new file mode 100644 index 0000000..7cfce9b --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/CompressedStreamTools.java @@ -0,0 +1,193 @@ +package net.minecraft.nbt; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.DataInput; +import java.io.DataInputStream; +import java.io.DataOutput; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.util.ReportedException; + +public class CompressedStreamTools +{ + /** + * Load the gzipped compound from the inputstream. + */ + public static NBTTagCompound readCompressed(InputStream is) throws IOException + { + DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(is))); + NBTTagCompound nbttagcompound; + + try + { + nbttagcompound = read(datainputstream, NBTSizeTracker.INFINITE); + } + finally + { + datainputstream.close(); + } + + return nbttagcompound; + } + + /** + * Write the compound, gzipped, to the outputstream. + */ + public static void writeCompressed(NBTTagCompound p_74799_0_, OutputStream outputStream) throws IOException + { + DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(outputStream))); + + try + { + write(p_74799_0_, dataoutputstream); + } + finally + { + dataoutputstream.close(); + } + } + + public static void safeWrite(NBTTagCompound p_74793_0_, File p_74793_1_) throws IOException + { + File file1 = new File(p_74793_1_.getAbsolutePath() + "_tmp"); + + if (file1.exists()) + { + file1.delete(); + } + + write(p_74793_0_, file1); + + if (p_74793_1_.exists()) + { + p_74793_1_.delete(); + } + + if (p_74793_1_.exists()) + { + throw new IOException("Failed to delete " + p_74793_1_); + } + else + { + file1.renameTo(p_74793_1_); + } + } + + public static void write(NBTTagCompound p_74795_0_, File p_74795_1_) throws IOException + { + DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(p_74795_1_)); + + try + { + write(p_74795_0_, dataoutputstream); + } + finally + { + dataoutputstream.close(); + } + } + + public static NBTTagCompound read(File p_74797_0_) throws IOException + { + if (!p_74797_0_.exists()) + { + return null; + } + else + { + DataInputStream datainputstream = new DataInputStream(new FileInputStream(p_74797_0_)); + NBTTagCompound nbttagcompound; + + try + { + nbttagcompound = read(datainputstream, NBTSizeTracker.INFINITE); + } + finally + { + datainputstream.close(); + } + + return nbttagcompound; + } + } + + /** + * Reads from a CompressedStream. + */ + public static NBTTagCompound read(DataInputStream inputStream) throws IOException + { + return read(inputStream, NBTSizeTracker.INFINITE); + } + + /** + * Reads the given DataInput, constructs, and returns an NBTTagCompound with the data from the DataInput + */ + public static NBTTagCompound read(DataInput p_152456_0_, NBTSizeTracker p_152456_1_) throws IOException + { + NBTBase nbtbase = func_152455_a(p_152456_0_, 0, p_152456_1_); + + if (nbtbase instanceof NBTTagCompound) + { + return (NBTTagCompound)nbtbase; + } + else + { + throw new IOException("Root tag must be a named compound tag"); + } + } + + public static void write(NBTTagCompound p_74800_0_, DataOutput p_74800_1_) throws IOException + { + writeTag(p_74800_0_, p_74800_1_); + } + + private static void writeTag(NBTBase p_150663_0_, DataOutput p_150663_1_) throws IOException + { + p_150663_1_.writeByte(p_150663_0_.getId()); + + if (p_150663_0_.getId() != 0) + { + p_150663_1_.writeUTF(""); + p_150663_0_.write(p_150663_1_); + } + } + + private static NBTBase func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) throws IOException + { + byte b0 = p_152455_0_.readByte(); + + if (b0 == 0) + { + return new NBTTagEnd(); + } + else + { + p_152455_0_.readUTF(); + NBTBase nbtbase = NBTBase.createNewByType(b0); + + try + { + nbtbase.read(p_152455_0_, p_152455_1_, p_152455_2_); + return nbtbase; + } + catch (IOException ioexception) + { + CrashReport crashreport = CrashReport.makeCrashReport(ioexception, "Loading NBT data"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("NBT Tag"); + crashreportcategory.addCrashSection("Tag name", "[UNNAMED TAG]"); + crashreportcategory.addCrashSection("Tag type", Byte.valueOf(b0)); + throw new ReportedException(crashreport); + } + } + } +} diff --git a/src/minecraft/net/minecraft/nbt/JsonToNBT.java b/src/minecraft/net/minecraft/nbt/JsonToNBT.java new file mode 100644 index 0000000..5554aca --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/JsonToNBT.java @@ -0,0 +1,553 @@ +package net.minecraft.nbt; + +import com.google.common.base.Splitter; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import java.util.Stack; +import java.util.regex.Pattern; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class JsonToNBT +{ + private static final Logger logger = LogManager.getLogger(); + private static final Pattern field_179273_b = Pattern.compile("\\[[-+\\d|,\\s]+\\]"); + + public static NBTTagCompound getTagFromJson(String jsonString) throws NBTException + { + jsonString = jsonString.trim(); + + if (!jsonString.startsWith("{")) + { + throw new NBTException("Invalid tag encountered, expected \'{\' as first char."); + } + else if (func_150310_b(jsonString) != 1) + { + throw new NBTException("Encountered multiple top tags, only one expected"); + } + else + { + return (NBTTagCompound)func_150316_a("tag", jsonString).parse(); + } + } + + static int func_150310_b(String p_150310_0_) throws NBTException + { + int i = 0; + boolean flag = false; + Stack stack = new Stack(); + + for (int j = 0; j < p_150310_0_.length(); ++j) + { + char c0 = p_150310_0_.charAt(j); + + if (c0 == 34) + { + if (func_179271_b(p_150310_0_, j)) + { + if (!flag) + { + throw new NBTException("Illegal use of \\\": " + p_150310_0_); + } + } + else + { + flag = !flag; + } + } + else if (!flag) + { + if (c0 != 123 && c0 != 91) + { + if (c0 == 125 && (stack.isEmpty() || ((Character)stack.pop()).charValue() != 123)) + { + throw new NBTException("Unbalanced curly brackets {}: " + p_150310_0_); + } + + if (c0 == 93 && (stack.isEmpty() || ((Character)stack.pop()).charValue() != 91)) + { + throw new NBTException("Unbalanced square brackets []: " + p_150310_0_); + } + } + else + { + if (stack.isEmpty()) + { + ++i; + } + + stack.push(Character.valueOf(c0)); + } + } + } + + if (flag) + { + throw new NBTException("Unbalanced quotation: " + p_150310_0_); + } + else if (!stack.isEmpty()) + { + throw new NBTException("Unbalanced brackets: " + p_150310_0_); + } + else + { + if (i == 0 && !p_150310_0_.isEmpty()) + { + i = 1; + } + + return i; + } + } + + static JsonToNBT.Any func_179272_a(String... p_179272_0_) throws NBTException + { + return func_150316_a(p_179272_0_[0], p_179272_0_[1]); + } + + static JsonToNBT.Any func_150316_a(String p_150316_0_, String p_150316_1_) throws NBTException + { + p_150316_1_ = p_150316_1_.trim(); + + if (p_150316_1_.startsWith("{")) + { + p_150316_1_ = p_150316_1_.substring(1, p_150316_1_.length() - 1); + JsonToNBT.Compound jsontonbt$compound; + String s1; + + for (jsontonbt$compound = new JsonToNBT.Compound(p_150316_0_); p_150316_1_.length() > 0; p_150316_1_ = p_150316_1_.substring(s1.length() + 1)) + { + s1 = func_150314_a(p_150316_1_, true); + + if (s1.length() > 0) + { + boolean flag1 = false; + jsontonbt$compound.field_150491_b.add(func_179270_a(s1, flag1)); + } + + if (p_150316_1_.length() < s1.length() + 1) + { + break; + } + + char c1 = p_150316_1_.charAt(s1.length()); + + if (c1 != 44 && c1 != 123 && c1 != 125 && c1 != 91 && c1 != 93) + { + throw new NBTException("Unexpected token \'" + c1 + "\' at: " + p_150316_1_.substring(s1.length())); + } + } + + return jsontonbt$compound; + } + else if (p_150316_1_.startsWith("[") && !field_179273_b.matcher(p_150316_1_).matches()) + { + p_150316_1_ = p_150316_1_.substring(1, p_150316_1_.length() - 1); + JsonToNBT.List jsontonbt$list; + String s; + + for (jsontonbt$list = new JsonToNBT.List(p_150316_0_); p_150316_1_.length() > 0; p_150316_1_ = p_150316_1_.substring(s.length() + 1)) + { + s = func_150314_a(p_150316_1_, false); + + if (s.length() > 0) + { + boolean flag = true; + jsontonbt$list.field_150492_b.add(func_179270_a(s, flag)); + } + + if (p_150316_1_.length() < s.length() + 1) + { + break; + } + + char c0 = p_150316_1_.charAt(s.length()); + + if (c0 != 44 && c0 != 123 && c0 != 125 && c0 != 91 && c0 != 93) + { + throw new NBTException("Unexpected token \'" + c0 + "\' at: " + p_150316_1_.substring(s.length())); + } + } + + return jsontonbt$list; + } + else + { + return new JsonToNBT.Primitive(p_150316_0_, p_150316_1_); + } + } + + private static JsonToNBT.Any func_179270_a(String p_179270_0_, boolean p_179270_1_) throws NBTException + { + String s = func_150313_b(p_179270_0_, p_179270_1_); + String s1 = func_150311_c(p_179270_0_, p_179270_1_); + return func_179272_a(new String[] {s, s1}); + } + + private static String func_150314_a(String p_150314_0_, boolean p_150314_1_) throws NBTException + { + int i = func_150312_a(p_150314_0_, ':'); + int j = func_150312_a(p_150314_0_, ','); + + if (p_150314_1_) + { + if (i == -1) + { + throw new NBTException("Unable to locate name/value separator for string: " + p_150314_0_); + } + + if (j != -1 && j < i) + { + throw new NBTException("Name error at: " + p_150314_0_); + } + } + else if (i == -1 || i > j) + { + i = -1; + } + + return func_179269_a(p_150314_0_, i); + } + + private static String func_179269_a(String p_179269_0_, int p_179269_1_) throws NBTException + { + Stack stack = new Stack(); + int i = p_179269_1_ + 1; + boolean flag = false; + boolean flag1 = false; + boolean flag2 = false; + + for (int j = 0; i < p_179269_0_.length(); ++i) + { + char c0 = p_179269_0_.charAt(i); + + if (c0 == 34) + { + if (func_179271_b(p_179269_0_, i)) + { + if (!flag) + { + throw new NBTException("Illegal use of \\\": " + p_179269_0_); + } + } + else + { + flag = !flag; + + if (flag && !flag2) + { + flag1 = true; + } + + if (!flag) + { + j = i; + } + } + } + else if (!flag) + { + if (c0 != 123 && c0 != 91) + { + if (c0 == 125 && (stack.isEmpty() || ((Character)stack.pop()).charValue() != 123)) + { + throw new NBTException("Unbalanced curly brackets {}: " + p_179269_0_); + } + + if (c0 == 93 && (stack.isEmpty() || ((Character)stack.pop()).charValue() != 91)) + { + throw new NBTException("Unbalanced square brackets []: " + p_179269_0_); + } + + if (c0 == 44 && stack.isEmpty()) + { + return p_179269_0_.substring(0, i); + } + } + else + { + stack.push(Character.valueOf(c0)); + } + } + + if (!Character.isWhitespace(c0)) + { + if (!flag && flag1 && j != i) + { + return p_179269_0_.substring(0, j + 1); + } + + flag2 = true; + } + } + + return p_179269_0_.substring(0, i); + } + + private static String func_150313_b(String p_150313_0_, boolean p_150313_1_) throws NBTException + { + if (p_150313_1_) + { + p_150313_0_ = p_150313_0_.trim(); + + if (p_150313_0_.startsWith("{") || p_150313_0_.startsWith("[")) + { + return ""; + } + } + + int i = func_150312_a(p_150313_0_, ':'); + + if (i == -1) + { + if (p_150313_1_) + { + return ""; + } + else + { + throw new NBTException("Unable to locate name/value separator for string: " + p_150313_0_); + } + } + else + { + return p_150313_0_.substring(0, i).trim(); + } + } + + private static String func_150311_c(String p_150311_0_, boolean p_150311_1_) throws NBTException + { + if (p_150311_1_) + { + p_150311_0_ = p_150311_0_.trim(); + + if (p_150311_0_.startsWith("{") || p_150311_0_.startsWith("[")) + { + return p_150311_0_; + } + } + + int i = func_150312_a(p_150311_0_, ':'); + + if (i == -1) + { + if (p_150311_1_) + { + return p_150311_0_; + } + else + { + throw new NBTException("Unable to locate name/value separator for string: " + p_150311_0_); + } + } + else + { + return p_150311_0_.substring(i + 1).trim(); + } + } + + private static int func_150312_a(String p_150312_0_, char p_150312_1_) + { + int i = 0; + + for (boolean flag = true; i < p_150312_0_.length(); ++i) + { + char c0 = p_150312_0_.charAt(i); + + if (c0 == 34) + { + if (!func_179271_b(p_150312_0_, i)) + { + flag = !flag; + } + } + else if (flag) + { + if (c0 == p_150312_1_) + { + return i; + } + + if (c0 == 123 || c0 == 91) + { + return -1; + } + } + } + + return -1; + } + + private static boolean func_179271_b(String p_179271_0_, int p_179271_1_) + { + return p_179271_1_ > 0 && p_179271_0_.charAt(p_179271_1_ - 1) == 92 && !func_179271_b(p_179271_0_, p_179271_1_ - 1); + } + + abstract static class Any + { + protected String json; + + public abstract NBTBase parse() throws NBTException; + } + + static class Compound extends JsonToNBT.Any + { + protected java.util.List field_150491_b = Lists.newArrayList(); + + public Compound(String p_i45137_1_) + { + this.json = p_i45137_1_; + } + + public NBTBase parse() throws NBTException + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + for (JsonToNBT.Any jsontonbt$any : this.field_150491_b) + { + nbttagcompound.setTag(jsontonbt$any.json, jsontonbt$any.parse()); + } + + return nbttagcompound; + } + } + + static class List extends JsonToNBT.Any + { + protected java.util.List field_150492_b = Lists.newArrayList(); + + public List(String json) + { + this.json = json; + } + + public NBTBase parse() throws NBTException + { + NBTTagList nbttaglist = new NBTTagList(); + + for (JsonToNBT.Any jsontonbt$any : this.field_150492_b) + { + nbttaglist.appendTag(jsontonbt$any.parse()); + } + + return nbttaglist; + } + } + + static class Primitive extends JsonToNBT.Any + { + private static final Pattern DOUBLE = Pattern.compile("[-+]?[0-9]*\\.?[0-9]+[d|D]"); + private static final Pattern FLOAT = Pattern.compile("[-+]?[0-9]*\\.?[0-9]+[f|F]"); + private static final Pattern BYTE = Pattern.compile("[-+]?[0-9]+[b|B]"); + private static final Pattern LONG = Pattern.compile("[-+]?[0-9]+[l|L]"); + private static final Pattern SHORT = Pattern.compile("[-+]?[0-9]+[s|S]"); + private static final Pattern INTEGER = Pattern.compile("[-+]?[0-9]+"); + private static final Pattern DOUBLE_UNTYPED = Pattern.compile("[-+]?[0-9]*\\.?[0-9]+"); + private static final Splitter SPLITTER = Splitter.on(',').omitEmptyStrings(); + protected String jsonValue; + + public Primitive(String p_i45139_1_, String p_i45139_2_) + { + this.json = p_i45139_1_; + this.jsonValue = p_i45139_2_; + } + + public NBTBase parse() throws NBTException + { + try + { + if (DOUBLE.matcher(this.jsonValue).matches()) + { + return new NBTTagDouble(Double.parseDouble(this.jsonValue.substring(0, this.jsonValue.length() - 1))); + } + + if (FLOAT.matcher(this.jsonValue).matches()) + { + return new NBTTagFloat(Float.parseFloat(this.jsonValue.substring(0, this.jsonValue.length() - 1))); + } + + if (BYTE.matcher(this.jsonValue).matches()) + { + return new NBTTagByte(Byte.parseByte(this.jsonValue.substring(0, this.jsonValue.length() - 1))); + } + + if (LONG.matcher(this.jsonValue).matches()) + { + return new NBTTagLong(Long.parseLong(this.jsonValue.substring(0, this.jsonValue.length() - 1))); + } + + if (SHORT.matcher(this.jsonValue).matches()) + { + return new NBTTagShort(Short.parseShort(this.jsonValue.substring(0, this.jsonValue.length() - 1))); + } + + if (INTEGER.matcher(this.jsonValue).matches()) + { + return new NBTTagInt(Integer.parseInt(this.jsonValue)); + } + + if (DOUBLE_UNTYPED.matcher(this.jsonValue).matches()) + { + return new NBTTagDouble(Double.parseDouble(this.jsonValue)); + } + + if (this.jsonValue.equalsIgnoreCase("true") || this.jsonValue.equalsIgnoreCase("false")) + { + return new NBTTagByte((byte)(Boolean.parseBoolean(this.jsonValue) ? 1 : 0)); + } + } + catch (NumberFormatException var6) + { + this.jsonValue = this.jsonValue.replaceAll("\\\\\"", "\""); + return new NBTTagString(this.jsonValue); + } + + if (this.jsonValue.startsWith("[") && this.jsonValue.endsWith("]")) + { + String s = this.jsonValue.substring(1, this.jsonValue.length() - 1); + String[] astring = (String[])Iterables.toArray(SPLITTER.split(s), String.class); + + try + { + int[] aint = new int[astring.length]; + + for (int j = 0; j < astring.length; ++j) + { + aint[j] = Integer.parseInt(astring[j].trim()); + } + + return new NBTTagIntArray(aint); + } + catch (NumberFormatException var5) + { + return new NBTTagString(this.jsonValue); + } + } + else + { + if (this.jsonValue.startsWith("\"") && this.jsonValue.endsWith("\"")) + { + this.jsonValue = this.jsonValue.substring(1, this.jsonValue.length() - 1); + } + + this.jsonValue = this.jsonValue.replaceAll("\\\\\"", "\""); + StringBuilder stringbuilder = new StringBuilder(); + + for (int i = 0; i < this.jsonValue.length(); ++i) + { + if (i < this.jsonValue.length() - 1 && this.jsonValue.charAt(i) == 92 && this.jsonValue.charAt(i + 1) == 92) + { + stringbuilder.append('\\'); + ++i; + } + else + { + stringbuilder.append(this.jsonValue.charAt(i)); + } + } + + return new NBTTagString(stringbuilder.toString()); + } + } + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTBase.java b/src/minecraft/net/minecraft/nbt/NBTBase.java new file mode 100644 index 0000000..6f86a54 --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTBase.java @@ -0,0 +1,123 @@ +package net.minecraft.nbt; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public abstract class NBTBase +{ + public static final String[] NBT_TYPES = new String[] {"END", "BYTE", "SHORT", "INT", "LONG", "FLOAT", "DOUBLE", "BYTE[]", "STRING", "LIST", "COMPOUND", "INT[]"}; + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + abstract void write(DataOutput output) throws IOException; + + abstract void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException; + + public abstract String toString(); + + /** + * Gets the type byte for the tag. + */ + public abstract byte getId(); + + /** + * Creates a new NBTBase object that corresponds with the passed in id. + */ + protected static NBTBase createNewByType(byte id) + { + switch (id) + { + case 0: + return new NBTTagEnd(); + + case 1: + return new NBTTagByte(); + + case 2: + return new NBTTagShort(); + + case 3: + return new NBTTagInt(); + + case 4: + return new NBTTagLong(); + + case 5: + return new NBTTagFloat(); + + case 6: + return new NBTTagDouble(); + + case 7: + return new NBTTagByteArray(); + + case 8: + return new NBTTagString(); + + case 9: + return new NBTTagList(); + + case 10: + return new NBTTagCompound(); + + case 11: + return new NBTTagIntArray(); + + default: + return null; + } + } + + /** + * Creates a clone of the tag. + */ + public abstract NBTBase copy(); + + /** + * Return whether this compound has no tags. + */ + public boolean hasNoTags() + { + return false; + } + + public boolean equals(Object p_equals_1_) + { + if (!(p_equals_1_ instanceof NBTBase)) + { + return false; + } + else + { + NBTBase nbtbase = (NBTBase)p_equals_1_; + return this.getId() == nbtbase.getId(); + } + } + + public int hashCode() + { + return this.getId(); + } + + protected String getString() + { + return this.toString(); + } + + public abstract static class NBTPrimitive extends NBTBase + { + public abstract long getLong(); + + public abstract int getInt(); + + public abstract short getShort(); + + public abstract byte getByte(); + + public abstract double getDouble(); + + public abstract float getFloat(); + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTException.java b/src/minecraft/net/minecraft/nbt/NBTException.java new file mode 100644 index 0000000..1a8b884 --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTException.java @@ -0,0 +1,9 @@ +package net.minecraft.nbt; + +public class NBTException extends Exception +{ + public NBTException(String p_i45136_1_) + { + super(p_i45136_1_); + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTSizeTracker.java b/src/minecraft/net/minecraft/nbt/NBTSizeTracker.java new file mode 100644 index 0000000..378ffbe --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTSizeTracker.java @@ -0,0 +1,31 @@ +package net.minecraft.nbt; + +public class NBTSizeTracker +{ + public static final NBTSizeTracker INFINITE = new NBTSizeTracker(0L) + { + public void read(long bits) + { + } + }; + private final long max; + private long read; + + public NBTSizeTracker(long max) + { + this.max = max; + } + + /** + * Tracks the reading of the given amount of bits(!) + */ + public void read(long bits) + { + this.read += bits / 8L; + + if (this.read > this.max) + { + throw new RuntimeException("Tried to read NBT tag that was too big; tried to allocate: " + this.read + "bytes where max allowed: " + this.max); + } + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTTagByte.java b/src/minecraft/net/minecraft/nbt/NBTTagByte.java new file mode 100644 index 0000000..91e6964 --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTTagByte.java @@ -0,0 +1,103 @@ +package net.minecraft.nbt; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagByte extends NBTBase.NBTPrimitive +{ + /** The byte value for the tag. */ + private byte data; + + NBTTagByte() + { + } + + public NBTTagByte(byte data) + { + this.data = data; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput output) throws IOException + { + output.writeByte(this.data); + } + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + sizeTracker.read(72L); + this.data = input.readByte(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)1; + } + + public String toString() + { + return "" + this.data + "b"; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagByte(this.data); + } + + public boolean equals(Object p_equals_1_) + { + if (super.equals(p_equals_1_)) + { + NBTTagByte nbttagbyte = (NBTTagByte)p_equals_1_; + return this.data == nbttagbyte.data; + } + else + { + return false; + } + } + + public int hashCode() + { + return super.hashCode() ^ this.data; + } + + public long getLong() + { + return (long)this.data; + } + + public int getInt() + { + return this.data; + } + + public short getShort() + { + return (short)this.data; + } + + public byte getByte() + { + return this.data; + } + + public double getDouble() + { + return (double)this.data; + } + + public float getFloat() + { + return (float)this.data; + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTTagByteArray.java b/src/minecraft/net/minecraft/nbt/NBTTagByteArray.java new file mode 100644 index 0000000..ba8129a --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTTagByteArray.java @@ -0,0 +1,77 @@ +package net.minecraft.nbt; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Arrays; + +public class NBTTagByteArray extends NBTBase +{ + /** The byte array stored in the tag. */ + private byte[] data; + + NBTTagByteArray() + { + } + + public NBTTagByteArray(byte[] data) + { + this.data = data; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput output) throws IOException + { + output.writeInt(this.data.length); + output.write(this.data); + } + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + sizeTracker.read(192L); + int i = input.readInt(); + sizeTracker.read((long)(8 * i)); + this.data = new byte[i]; + input.readFully(this.data); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)7; + } + + public String toString() + { + return "[" + this.data.length + " bytes]"; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + byte[] abyte = new byte[this.data.length]; + System.arraycopy(this.data, 0, abyte, 0, this.data.length); + return new NBTTagByteArray(abyte); + } + + public boolean equals(Object p_equals_1_) + { + return super.equals(p_equals_1_) ? Arrays.equals(this.data, ((NBTTagByteArray)p_equals_1_).data) : false; + } + + public int hashCode() + { + return super.hashCode() ^ Arrays.hashCode(this.data); + } + + public byte[] getByteArray() + { + return this.data; + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTTagCompound.java b/src/minecraft/net/minecraft/nbt/NBTTagCompound.java new file mode 100644 index 0000000..ddba6ec --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTTagCompound.java @@ -0,0 +1,551 @@ +package net.minecraft.nbt; + +import com.google.common.collect.Maps; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; +import java.util.concurrent.Callable; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.util.ReportedException; + +public class NBTTagCompound extends NBTBase +{ + private Map tagMap = Maps.newHashMap(); + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput output) throws IOException + { + for (String s : this.tagMap.keySet()) + { + NBTBase nbtbase = (NBTBase)this.tagMap.get(s); + writeEntry(s, nbtbase, output); + } + + output.writeByte(0); + } + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + sizeTracker.read(384L); + + if (depth > 512) + { + throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512"); + } + else + { + this.tagMap.clear(); + byte b0; + + while ((b0 = readType(input, sizeTracker)) != 0) + { + String s = readKey(input, sizeTracker); + sizeTracker.read((long)(224 + 16 * s.length())); + NBTBase nbtbase = readNBT(b0, s, input, depth + 1, sizeTracker); + + if (this.tagMap.put(s, nbtbase) != null) + { + sizeTracker.read(288L); + } + } + } + } + + public Set getKeySet() + { + return this.tagMap.keySet(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)10; + } + + /** + * Stores the given tag into the map with the given string key. This is mostly used to store tag lists. + */ + public void setTag(String key, NBTBase value) + { + this.tagMap.put(key, value); + } + + /** + * Stores a new NBTTagByte with the given byte value into the map with the given string key. + */ + public void setByte(String key, byte value) + { + this.tagMap.put(key, new NBTTagByte(value)); + } + + /** + * Stores a new NBTTagShort with the given short value into the map with the given string key. + */ + public void setShort(String key, short value) + { + this.tagMap.put(key, new NBTTagShort(value)); + } + + /** + * Stores a new NBTTagInt with the given integer value into the map with the given string key. + */ + public void setInteger(String key, int value) + { + this.tagMap.put(key, new NBTTagInt(value)); + } + + /** + * Stores a new NBTTagLong with the given long value into the map with the given string key. + */ + public void setLong(String key, long value) + { + this.tagMap.put(key, new NBTTagLong(value)); + } + + /** + * Stores a new NBTTagFloat with the given float value into the map with the given string key. + */ + public void setFloat(String key, float value) + { + this.tagMap.put(key, new NBTTagFloat(value)); + } + + /** + * Stores a new NBTTagDouble with the given double value into the map with the given string key. + */ + public void setDouble(String key, double value) + { + this.tagMap.put(key, new NBTTagDouble(value)); + } + + /** + * Stores a new NBTTagString with the given string value into the map with the given string key. + */ + public void setString(String key, String value) + { + this.tagMap.put(key, new NBTTagString(value)); + } + + /** + * Stores a new NBTTagByteArray with the given array as data into the map with the given string key. + */ + public void setByteArray(String key, byte[] value) + { + this.tagMap.put(key, new NBTTagByteArray(value)); + } + + /** + * Stores a new NBTTagIntArray with the given array as data into the map with the given string key. + */ + public void setIntArray(String key, int[] value) + { + this.tagMap.put(key, new NBTTagIntArray(value)); + } + + /** + * Stores the given boolean value as a NBTTagByte, storing 1 for true and 0 for false, using the given string key. + */ + public void setBoolean(String key, boolean value) + { + this.setByte(key, (byte)(value ? 1 : 0)); + } + + /** + * gets a generic tag with the specified name + */ + public NBTBase getTag(String key) + { + return (NBTBase)this.tagMap.get(key); + } + + /** + * Gets the ID byte for the given tag key + */ + public byte getTagId(String key) + { + NBTBase nbtbase = (NBTBase)this.tagMap.get(key); + return nbtbase != null ? nbtbase.getId() : 0; + } + + /** + * Returns whether the given string has been previously stored as a key in the map. + */ + public boolean hasKey(String key) + { + return this.tagMap.containsKey(key); + } + + public boolean hasKey(String key, int type) + { + int i = this.getTagId(key); + + if (i == type) + { + return true; + } + else if (type != 99) + { + if (i > 0) + { + ; + } + + return false; + } + else + { + return i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6; + } + } + + /** + * Retrieves a byte value using the specified key, or 0 if no such key was stored. + */ + public byte getByte(String key) + { + try + { + return !this.hasKey(key, 99) ? 0 : ((NBTBase.NBTPrimitive)this.tagMap.get(key)).getByte(); + } + catch (ClassCastException var3) + { + return (byte)0; + } + } + + /** + * Retrieves a short value using the specified key, or 0 if no such key was stored. + */ + public short getShort(String key) + { + try + { + return !this.hasKey(key, 99) ? 0 : ((NBTBase.NBTPrimitive)this.tagMap.get(key)).getShort(); + } + catch (ClassCastException var3) + { + return (short)0; + } + } + + /** + * Retrieves an integer value using the specified key, or 0 if no such key was stored. + */ + public int getInteger(String key) + { + try + { + return !this.hasKey(key, 99) ? 0 : ((NBTBase.NBTPrimitive)this.tagMap.get(key)).getInt(); + } + catch (ClassCastException var3) + { + return 0; + } + } + + /** + * Retrieves a long value using the specified key, or 0 if no such key was stored. + */ + public long getLong(String key) + { + try + { + return !this.hasKey(key, 99) ? 0L : ((NBTBase.NBTPrimitive)this.tagMap.get(key)).getLong(); + } + catch (ClassCastException var3) + { + return 0L; + } + } + + /** + * Retrieves a float value using the specified key, or 0 if no such key was stored. + */ + public float getFloat(String key) + { + try + { + return !this.hasKey(key, 99) ? 0.0F : ((NBTBase.NBTPrimitive)this.tagMap.get(key)).getFloat(); + } + catch (ClassCastException var3) + { + return 0.0F; + } + } + + /** + * Retrieves a double value using the specified key, or 0 if no such key was stored. + */ + public double getDouble(String key) + { + try + { + return !this.hasKey(key, 99) ? 0.0D : ((NBTBase.NBTPrimitive)this.tagMap.get(key)).getDouble(); + } + catch (ClassCastException var3) + { + return 0.0D; + } + } + + /** + * Retrieves a string value using the specified key, or an empty string if no such key was stored. + */ + public String getString(String key) + { + try + { + return !this.hasKey(key, 8) ? "" : ((NBTBase)this.tagMap.get(key)).getString(); + } + catch (ClassCastException var3) + { + return ""; + } + } + + /** + * Retrieves a byte array using the specified key, or a zero-length array if no such key was stored. + */ + public byte[] getByteArray(String key) + { + try + { + return !this.hasKey(key, 7) ? new byte[0] : ((NBTTagByteArray)this.tagMap.get(key)).getByteArray(); + } + catch (ClassCastException classcastexception) + { + throw new ReportedException(this.createCrashReport(key, 7, classcastexception)); + } + } + + /** + * Retrieves an int array using the specified key, or a zero-length array if no such key was stored. + */ + public int[] getIntArray(String key) + { + try + { + return !this.hasKey(key, 11) ? new int[0] : ((NBTTagIntArray)this.tagMap.get(key)).getIntArray(); + } + catch (ClassCastException classcastexception) + { + throw new ReportedException(this.createCrashReport(key, 11, classcastexception)); + } + } + + /** + * Retrieves a NBTTagCompound subtag matching the specified key, or a new empty NBTTagCompound if no such key was + * stored. + */ + public NBTTagCompound getCompoundTag(String key) + { + try + { + return !this.hasKey(key, 10) ? new NBTTagCompound() : (NBTTagCompound)this.tagMap.get(key); + } + catch (ClassCastException classcastexception) + { + throw new ReportedException(this.createCrashReport(key, 10, classcastexception)); + } + } + + /** + * Gets the NBTTagList object with the given name. Args: name, NBTBase type + */ + public NBTTagList getTagList(String key, int type) + { + try + { + if (this.getTagId(key) != 9) + { + return new NBTTagList(); + } + else + { + NBTTagList nbttaglist = (NBTTagList)this.tagMap.get(key); + return nbttaglist.tagCount() > 0 && nbttaglist.getTagType() != type ? new NBTTagList() : nbttaglist; + } + } + catch (ClassCastException classcastexception) + { + throw new ReportedException(this.createCrashReport(key, 9, classcastexception)); + } + } + + /** + * Retrieves a boolean value using the specified key, or false if no such key was stored. This uses the getByte + * method. + */ + public boolean getBoolean(String key) + { + return this.getByte(key) != 0; + } + + /** + * Remove the specified tag. + */ + public void removeTag(String key) + { + this.tagMap.remove(key); + } + + public String toString() + { + StringBuilder stringbuilder = new StringBuilder("{"); + + for (Entry entry : this.tagMap.entrySet()) + { + if (stringbuilder.length() != 1) + { + stringbuilder.append(','); + } + + stringbuilder.append((String)entry.getKey()).append(':').append(entry.getValue()); + } + + return stringbuilder.append('}').toString(); + } + + /** + * Return whether this compound has no tags. + */ + public boolean hasNoTags() + { + return this.tagMap.isEmpty(); + } + + /** + * Create a crash report which indicates a NBT read error. + */ + private CrashReport createCrashReport(final String key, final int expectedType, ClassCastException ex) + { + CrashReport crashreport = CrashReport.makeCrashReport(ex, "Reading NBT data"); + CrashReportCategory crashreportcategory = crashreport.makeCategoryDepth("Corrupt NBT tag", 1); + crashreportcategory.addCrashSectionCallable("Tag type found", new Callable() + { + public String call() throws Exception + { + return NBTBase.NBT_TYPES[((NBTBase)NBTTagCompound.this.tagMap.get(key)).getId()]; + } + }); + crashreportcategory.addCrashSectionCallable("Tag type expected", new Callable() + { + public String call() throws Exception + { + return NBTBase.NBT_TYPES[expectedType]; + } + }); + crashreportcategory.addCrashSection("Tag name", key); + return crashreport; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + for (String s : this.tagMap.keySet()) + { + nbttagcompound.setTag(s, ((NBTBase)this.tagMap.get(s)).copy()); + } + + return nbttagcompound; + } + + public boolean equals(Object p_equals_1_) + { + if (super.equals(p_equals_1_)) + { + NBTTagCompound nbttagcompound = (NBTTagCompound)p_equals_1_; + return this.tagMap.entrySet().equals(nbttagcompound.tagMap.entrySet()); + } + else + { + return false; + } + } + + public int hashCode() + { + return super.hashCode() ^ this.tagMap.hashCode(); + } + + private static void writeEntry(String name, NBTBase data, DataOutput output) throws IOException + { + output.writeByte(data.getId()); + + if (data.getId() != 0) + { + output.writeUTF(name); + data.write(output); + } + } + + private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException + { + return input.readByte(); + } + + private static String readKey(DataInput input, NBTSizeTracker sizeTracker) throws IOException + { + return input.readUTF(); + } + + static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + NBTBase nbtbase = NBTBase.createNewByType(id); + + try + { + nbtbase.read(input, depth, sizeTracker); + return nbtbase; + } + catch (IOException ioexception) + { + CrashReport crashreport = CrashReport.makeCrashReport(ioexception, "Loading NBT data"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("NBT Tag"); + crashreportcategory.addCrashSection("Tag name", key); + crashreportcategory.addCrashSection("Tag type", Byte.valueOf(id)); + throw new ReportedException(crashreport); + } + } + + /** + * Merges this NBTTagCompound with the given compound. Any sub-compounds are merged using the same methods, other + * types of tags are overwritten from the given compound. + */ + public void merge(NBTTagCompound other) + { + for (String s : other.tagMap.keySet()) + { + NBTBase nbtbase = (NBTBase)other.tagMap.get(s); + + if (nbtbase.getId() == 10) + { + if (this.hasKey(s, 10)) + { + NBTTagCompound nbttagcompound = this.getCompoundTag(s); + nbttagcompound.merge((NBTTagCompound)nbtbase); + } + else + { + this.setTag(s, nbtbase.copy()); + } + } + else + { + this.setTag(s, nbtbase.copy()); + } + } + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTTagDouble.java b/src/minecraft/net/minecraft/nbt/NBTTagDouble.java new file mode 100644 index 0000000..65aa9b5 --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTTagDouble.java @@ -0,0 +1,105 @@ +package net.minecraft.nbt; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import net.minecraft.util.MathHelper; + +public class NBTTagDouble extends NBTBase.NBTPrimitive +{ + /** The double value for the tag. */ + private double data; + + NBTTagDouble() + { + } + + public NBTTagDouble(double data) + { + this.data = data; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput output) throws IOException + { + output.writeDouble(this.data); + } + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + sizeTracker.read(128L); + this.data = input.readDouble(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)6; + } + + public String toString() + { + return "" + this.data + "d"; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagDouble(this.data); + } + + public boolean equals(Object p_equals_1_) + { + if (super.equals(p_equals_1_)) + { + NBTTagDouble nbttagdouble = (NBTTagDouble)p_equals_1_; + return this.data == nbttagdouble.data; + } + else + { + return false; + } + } + + public int hashCode() + { + long i = Double.doubleToLongBits(this.data); + return super.hashCode() ^ (int)(i ^ i >>> 32); + } + + public long getLong() + { + return (long)Math.floor(this.data); + } + + public int getInt() + { + return MathHelper.floor_double(this.data); + } + + public short getShort() + { + return (short)(MathHelper.floor_double(this.data) & 65535); + } + + public byte getByte() + { + return (byte)(MathHelper.floor_double(this.data) & 255); + } + + public double getDouble() + { + return this.data; + } + + public float getFloat() + { + return (float)this.data; + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTTagEnd.java b/src/minecraft/net/minecraft/nbt/NBTTagEnd.java new file mode 100644 index 0000000..295cc63 --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTTagEnd.java @@ -0,0 +1,41 @@ +package net.minecraft.nbt; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagEnd extends NBTBase +{ + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + sizeTracker.read(64L); + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput output) throws IOException + { + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)0; + } + + public String toString() + { + return "END"; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagEnd(); + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTTagFloat.java b/src/minecraft/net/minecraft/nbt/NBTTagFloat.java new file mode 100644 index 0000000..cb6674b --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTTagFloat.java @@ -0,0 +1,104 @@ +package net.minecraft.nbt; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import net.minecraft.util.MathHelper; + +public class NBTTagFloat extends NBTBase.NBTPrimitive +{ + /** The float value for the tag. */ + private float data; + + NBTTagFloat() + { + } + + public NBTTagFloat(float data) + { + this.data = data; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput output) throws IOException + { + output.writeFloat(this.data); + } + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + sizeTracker.read(96L); + this.data = input.readFloat(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)5; + } + + public String toString() + { + return "" + this.data + "f"; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagFloat(this.data); + } + + public boolean equals(Object p_equals_1_) + { + if (super.equals(p_equals_1_)) + { + NBTTagFloat nbttagfloat = (NBTTagFloat)p_equals_1_; + return this.data == nbttagfloat.data; + } + else + { + return false; + } + } + + public int hashCode() + { + return super.hashCode() ^ Float.floatToIntBits(this.data); + } + + public long getLong() + { + return (long)this.data; + } + + public int getInt() + { + return MathHelper.floor_float(this.data); + } + + public short getShort() + { + return (short)(MathHelper.floor_float(this.data) & 65535); + } + + public byte getByte() + { + return (byte)(MathHelper.floor_float(this.data) & 255); + } + + public double getDouble() + { + return (double)this.data; + } + + public float getFloat() + { + return this.data; + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTTagInt.java b/src/minecraft/net/minecraft/nbt/NBTTagInt.java new file mode 100644 index 0000000..61d68de --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTTagInt.java @@ -0,0 +1,103 @@ +package net.minecraft.nbt; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagInt extends NBTBase.NBTPrimitive +{ + /** The integer value for the tag. */ + private int data; + + NBTTagInt() + { + } + + public NBTTagInt(int data) + { + this.data = data; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput output) throws IOException + { + output.writeInt(this.data); + } + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + sizeTracker.read(96L); + this.data = input.readInt(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)3; + } + + public String toString() + { + return "" + this.data; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagInt(this.data); + } + + public boolean equals(Object p_equals_1_) + { + if (super.equals(p_equals_1_)) + { + NBTTagInt nbttagint = (NBTTagInt)p_equals_1_; + return this.data == nbttagint.data; + } + else + { + return false; + } + } + + public int hashCode() + { + return super.hashCode() ^ this.data; + } + + public long getLong() + { + return (long)this.data; + } + + public int getInt() + { + return this.data; + } + + public short getShort() + { + return (short)(this.data & 65535); + } + + public byte getByte() + { + return (byte)(this.data & 255); + } + + public double getDouble() + { + return (double)this.data; + } + + public float getFloat() + { + return (float)this.data; + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTTagIntArray.java b/src/minecraft/net/minecraft/nbt/NBTTagIntArray.java new file mode 100644 index 0000000..7cd26b6 --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTTagIntArray.java @@ -0,0 +1,92 @@ +package net.minecraft.nbt; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Arrays; + +public class NBTTagIntArray extends NBTBase +{ + /** The array of saved integers */ + private int[] intArray; + + NBTTagIntArray() + { + } + + public NBTTagIntArray(int[] p_i45132_1_) + { + this.intArray = p_i45132_1_; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput output) throws IOException + { + output.writeInt(this.intArray.length); + + for (int i = 0; i < this.intArray.length; ++i) + { + output.writeInt(this.intArray[i]); + } + } + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + sizeTracker.read(192L); + int i = input.readInt(); + sizeTracker.read((long)(32 * i)); + this.intArray = new int[i]; + + for (int j = 0; j < i; ++j) + { + this.intArray[j] = input.readInt(); + } + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)11; + } + + public String toString() + { + String s = "["; + + for (int i : this.intArray) + { + s = s + i + ","; + } + + return s + "]"; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + int[] aint = new int[this.intArray.length]; + System.arraycopy(this.intArray, 0, aint, 0, this.intArray.length); + return new NBTTagIntArray(aint); + } + + public boolean equals(Object p_equals_1_) + { + return super.equals(p_equals_1_) ? Arrays.equals(this.intArray, ((NBTTagIntArray)p_equals_1_).intArray) : false; + } + + public int hashCode() + { + return super.hashCode() ^ Arrays.hashCode(this.intArray); + } + + public int[] getIntArray() + { + return this.intArray; + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTTagList.java b/src/minecraft/net/minecraft/nbt/NBTTagList.java new file mode 100644 index 0000000..a04a056 --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTTagList.java @@ -0,0 +1,300 @@ +package net.minecraft.nbt; + +import com.google.common.collect.Lists; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.List; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class NBTTagList extends NBTBase +{ + private static final Logger LOGGER = LogManager.getLogger(); + private List tagList = Lists.newArrayList(); + + /** + * The type byte for the tags in the list - they must all be of the same type. + */ + private byte tagType = 0; + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput output) throws IOException + { + if (!this.tagList.isEmpty()) + { + this.tagType = ((NBTBase)this.tagList.get(0)).getId(); + } + else + { + this.tagType = 0; + } + + output.writeByte(this.tagType); + output.writeInt(this.tagList.size()); + + for (int i = 0; i < this.tagList.size(); ++i) + { + ((NBTBase)this.tagList.get(i)).write(output); + } + } + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + sizeTracker.read(296L); + + if (depth > 512) + { + throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512"); + } + else + { + this.tagType = input.readByte(); + int i = input.readInt(); + + if (this.tagType == 0 && i > 0) + { + throw new RuntimeException("Missing type on ListTag"); + } + else + { + sizeTracker.read(32L * (long)i); + this.tagList = Lists.newArrayListWithCapacity(i); + + for (int j = 0; j < i; ++j) + { + NBTBase nbtbase = NBTBase.createNewByType(this.tagType); + nbtbase.read(input, depth + 1, sizeTracker); + this.tagList.add(nbtbase); + } + } + } + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)9; + } + + public String toString() + { + StringBuilder stringbuilder = new StringBuilder("["); + + for (int i = 0; i < this.tagList.size(); ++i) + { + if (i != 0) + { + stringbuilder.append(','); + } + + stringbuilder.append(i).append(':').append(this.tagList.get(i)); + } + + return stringbuilder.append(']').toString(); + } + + /** + * Adds the provided tag to the end of the list. There is no check to verify this tag is of the same type as any + * previous tag. + */ + public void appendTag(NBTBase nbt) + { + if (nbt.getId() == 0) + { + LOGGER.warn("Invalid TagEnd added to ListTag"); + } + else + { + if (this.tagType == 0) + { + this.tagType = nbt.getId(); + } + else if (this.tagType != nbt.getId()) + { + LOGGER.warn("Adding mismatching tag types to tag list"); + return; + } + + this.tagList.add(nbt); + } + } + + /** + * Set the given index to the given tag + */ + public void set(int idx, NBTBase nbt) + { + if (nbt.getId() == 0) + { + LOGGER.warn("Invalid TagEnd added to ListTag"); + } + else if (idx >= 0 && idx < this.tagList.size()) + { + if (this.tagType == 0) + { + this.tagType = nbt.getId(); + } + else if (this.tagType != nbt.getId()) + { + LOGGER.warn("Adding mismatching tag types to tag list"); + return; + } + + this.tagList.set(idx, nbt); + } + else + { + LOGGER.warn("index out of bounds to set tag in tag list"); + } + } + + /** + * Removes a tag at the given index. + */ + public NBTBase removeTag(int i) + { + return (NBTBase)this.tagList.remove(i); + } + + /** + * Return whether this compound has no tags. + */ + public boolean hasNoTags() + { + return this.tagList.isEmpty(); + } + + /** + * Retrieves the NBTTagCompound at the specified index in the list + */ + public NBTTagCompound getCompoundTagAt(int i) + { + if (i >= 0 && i < this.tagList.size()) + { + NBTBase nbtbase = (NBTBase)this.tagList.get(i); + return nbtbase.getId() == 10 ? (NBTTagCompound)nbtbase : new NBTTagCompound(); + } + else + { + return new NBTTagCompound(); + } + } + + public int[] getIntArrayAt(int i) + { + if (i >= 0 && i < this.tagList.size()) + { + NBTBase nbtbase = (NBTBase)this.tagList.get(i); + return nbtbase.getId() == 11 ? ((NBTTagIntArray)nbtbase).getIntArray() : new int[0]; + } + else + { + return new int[0]; + } + } + + public double getDoubleAt(int i) + { + if (i >= 0 && i < this.tagList.size()) + { + NBTBase nbtbase = (NBTBase)this.tagList.get(i); + return nbtbase.getId() == 6 ? ((NBTTagDouble)nbtbase).getDouble() : 0.0D; + } + else + { + return 0.0D; + } + } + + public float getFloatAt(int i) + { + if (i >= 0 && i < this.tagList.size()) + { + NBTBase nbtbase = (NBTBase)this.tagList.get(i); + return nbtbase.getId() == 5 ? ((NBTTagFloat)nbtbase).getFloat() : 0.0F; + } + else + { + return 0.0F; + } + } + + /** + * Retrieves the tag String value at the specified index in the list + */ + public String getStringTagAt(int i) + { + if (i >= 0 && i < this.tagList.size()) + { + NBTBase nbtbase = (NBTBase)this.tagList.get(i); + return nbtbase.getId() == 8 ? nbtbase.getString() : nbtbase.toString(); + } + else + { + return ""; + } + } + + /** + * Get the tag at the given position + */ + public NBTBase get(int idx) + { + return (NBTBase)(idx >= 0 && idx < this.tagList.size() ? (NBTBase)this.tagList.get(idx) : new NBTTagEnd()); + } + + /** + * Returns the number of tags in the list. + */ + public int tagCount() + { + return this.tagList.size(); + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + NBTTagList nbttaglist = new NBTTagList(); + nbttaglist.tagType = this.tagType; + + for (NBTBase nbtbase : this.tagList) + { + NBTBase nbtbase1 = nbtbase.copy(); + nbttaglist.tagList.add(nbtbase1); + } + + return nbttaglist; + } + + public boolean equals(Object p_equals_1_) + { + if (super.equals(p_equals_1_)) + { + NBTTagList nbttaglist = (NBTTagList)p_equals_1_; + + if (this.tagType == nbttaglist.tagType) + { + return this.tagList.equals(nbttaglist.tagList); + } + } + + return false; + } + + public int hashCode() + { + return super.hashCode() ^ this.tagList.hashCode(); + } + + public int getTagType() + { + return this.tagType; + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTTagLong.java b/src/minecraft/net/minecraft/nbt/NBTTagLong.java new file mode 100644 index 0000000..ceb5f1b --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTTagLong.java @@ -0,0 +1,103 @@ +package net.minecraft.nbt; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagLong extends NBTBase.NBTPrimitive +{ + /** The long value for the tag. */ + private long data; + + NBTTagLong() + { + } + + public NBTTagLong(long data) + { + this.data = data; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput output) throws IOException + { + output.writeLong(this.data); + } + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + sizeTracker.read(128L); + this.data = input.readLong(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)4; + } + + public String toString() + { + return "" + this.data + "L"; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagLong(this.data); + } + + public boolean equals(Object p_equals_1_) + { + if (super.equals(p_equals_1_)) + { + NBTTagLong nbttaglong = (NBTTagLong)p_equals_1_; + return this.data == nbttaglong.data; + } + else + { + return false; + } + } + + public int hashCode() + { + return super.hashCode() ^ (int)(this.data ^ this.data >>> 32); + } + + public long getLong() + { + return this.data; + } + + public int getInt() + { + return (int)(this.data & -1L); + } + + public short getShort() + { + return (short)((int)(this.data & 65535L)); + } + + public byte getByte() + { + return (byte)((int)(this.data & 255L)); + } + + public double getDouble() + { + return (double)this.data; + } + + public float getFloat() + { + return (float)this.data; + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTTagShort.java b/src/minecraft/net/minecraft/nbt/NBTTagShort.java new file mode 100644 index 0000000..a326b7a --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTTagShort.java @@ -0,0 +1,103 @@ +package net.minecraft.nbt; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagShort extends NBTBase.NBTPrimitive +{ + /** The short value for the tag. */ + private short data; + + public NBTTagShort() + { + } + + public NBTTagShort(short data) + { + this.data = data; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput output) throws IOException + { + output.writeShort(this.data); + } + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + sizeTracker.read(80L); + this.data = input.readShort(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)2; + } + + public String toString() + { + return "" + this.data + "s"; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagShort(this.data); + } + + public boolean equals(Object p_equals_1_) + { + if (super.equals(p_equals_1_)) + { + NBTTagShort nbttagshort = (NBTTagShort)p_equals_1_; + return this.data == nbttagshort.data; + } + else + { + return false; + } + } + + public int hashCode() + { + return super.hashCode() ^ this.data; + } + + public long getLong() + { + return (long)this.data; + } + + public int getInt() + { + return this.data; + } + + public short getShort() + { + return this.data; + } + + public byte getByte() + { + return (byte)(this.data & 255); + } + + public double getDouble() + { + return (double)this.data; + } + + public float getFloat() + { + return (float)this.data; + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTTagString.java b/src/minecraft/net/minecraft/nbt/NBTTagString.java new file mode 100644 index 0000000..2dc5e2d --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTTagString.java @@ -0,0 +1,93 @@ +package net.minecraft.nbt; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagString extends NBTBase +{ + /** The string value for the tag (cannot be empty). */ + private String data; + + public NBTTagString() + { + this.data = ""; + } + + public NBTTagString(String data) + { + this.data = data; + + if (data == null) + { + throw new IllegalArgumentException("Empty string not allowed"); + } + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput output) throws IOException + { + output.writeUTF(this.data); + } + + void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException + { + sizeTracker.read(288L); + this.data = input.readUTF(); + sizeTracker.read((long)(16 * this.data.length())); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)8; + } + + public String toString() + { + return "\"" + this.data.replace("\"", "\\\"") + "\""; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagString(this.data); + } + + /** + * Return whether this compound has no tags. + */ + public boolean hasNoTags() + { + return this.data.isEmpty(); + } + + public boolean equals(Object p_equals_1_) + { + if (!super.equals(p_equals_1_)) + { + return false; + } + else + { + NBTTagString nbttagstring = (NBTTagString)p_equals_1_; + return this.data == null && nbttagstring.data == null || this.data != null && this.data.equals(nbttagstring.data); + } + } + + public int hashCode() + { + return super.hashCode() ^ this.data.hashCode(); + } + + public String getString() + { + return this.data; + } +} diff --git a/src/minecraft/net/minecraft/nbt/NBTUtil.java b/src/minecraft/net/minecraft/nbt/NBTUtil.java new file mode 100644 index 0000000..06b093f --- /dev/null +++ b/src/minecraft/net/minecraft/nbt/NBTUtil.java @@ -0,0 +1,195 @@ +package net.minecraft.nbt; + +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import java.util.UUID; +import net.minecraft.util.StringUtils; + +public final class NBTUtil +{ + /** + * Reads and returns a GameProfile that has been saved to the passed in NBTTagCompound + */ + public static GameProfile readGameProfileFromNBT(NBTTagCompound compound) + { + String s = null; + String s1 = null; + + if (compound.hasKey("Name", 8)) + { + s = compound.getString("Name"); + } + + if (compound.hasKey("Id", 8)) + { + s1 = compound.getString("Id"); + } + + if (StringUtils.isNullOrEmpty(s) && StringUtils.isNullOrEmpty(s1)) + { + return null; + } + else + { + UUID uuid; + + try + { + uuid = UUID.fromString(s1); + } + catch (Throwable var12) + { + uuid = null; + } + + GameProfile gameprofile = new GameProfile(uuid, s); + + if (compound.hasKey("Properties", 10)) + { + NBTTagCompound nbttagcompound = compound.getCompoundTag("Properties"); + + for (String s2 : nbttagcompound.getKeySet()) + { + NBTTagList nbttaglist = nbttagcompound.getTagList(s2, 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + String s3 = nbttagcompound1.getString("Value"); + + if (nbttagcompound1.hasKey("Signature", 8)) + { + gameprofile.getProperties().put(s2, new Property(s2, s3, nbttagcompound1.getString("Signature"))); + } + else + { + gameprofile.getProperties().put(s2, new Property(s2, s3)); + } + } + } + } + + return gameprofile; + } + } + + /** + * Writes a GameProfile to an NBTTagCompound. + */ + public static NBTTagCompound writeGameProfile(NBTTagCompound tagCompound, GameProfile profile) + { + if (!StringUtils.isNullOrEmpty(profile.getName())) + { + tagCompound.setString("Name", profile.getName()); + } + + if (profile.getId() != null) + { + tagCompound.setString("Id", profile.getId().toString()); + } + + if (!profile.getProperties().isEmpty()) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + for (String s : profile.getProperties().keySet()) + { + NBTTagList nbttaglist = new NBTTagList(); + + for (Property property : profile.getProperties().get(s)) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setString("Value", property.getValue()); + + if (property.hasSignature()) + { + nbttagcompound1.setString("Signature", property.getSignature()); + } + + nbttaglist.appendTag(nbttagcompound1); + } + + nbttagcompound.setTag(s, nbttaglist); + } + + tagCompound.setTag("Properties", nbttagcompound); + } + + return tagCompound; + } + + public static boolean func_181123_a(NBTBase p_181123_0_, NBTBase p_181123_1_, boolean p_181123_2_) + { + if (p_181123_0_ == p_181123_1_) + { + return true; + } + else if (p_181123_0_ == null) + { + return true; + } + else if (p_181123_1_ == null) + { + return false; + } + else if (!p_181123_0_.getClass().equals(p_181123_1_.getClass())) + { + return false; + } + else if (p_181123_0_ instanceof NBTTagCompound) + { + NBTTagCompound nbttagcompound = (NBTTagCompound)p_181123_0_; + NBTTagCompound nbttagcompound1 = (NBTTagCompound)p_181123_1_; + + for (String s : nbttagcompound.getKeySet()) + { + NBTBase nbtbase1 = nbttagcompound.getTag(s); + + if (!func_181123_a(nbtbase1, nbttagcompound1.getTag(s), p_181123_2_)) + { + return false; + } + } + + return true; + } + else if (p_181123_0_ instanceof NBTTagList && p_181123_2_) + { + NBTTagList nbttaglist = (NBTTagList)p_181123_0_; + NBTTagList nbttaglist1 = (NBTTagList)p_181123_1_; + + if (nbttaglist.tagCount() == 0) + { + return nbttaglist1.tagCount() == 0; + } + else + { + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTBase nbtbase = nbttaglist.get(i); + boolean flag = false; + + for (int j = 0; j < nbttaglist1.tagCount(); ++j) + { + if (func_181123_a(nbtbase, nbttaglist1.get(j), p_181123_2_)) + { + flag = true; + break; + } + } + + if (!flag) + { + return false; + } + } + + return true; + } + } + else + { + return p_181123_0_.equals(p_181123_1_); + } + } +} diff --git a/src/minecraft/net/minecraft/network/EnumConnectionState.java b/src/minecraft/net/minecraft/network/EnumConnectionState.java new file mode 100644 index 0000000..d051db8 --- /dev/null +++ b/src/minecraft/net/minecraft/network/EnumConnectionState.java @@ -0,0 +1,344 @@ +package net.minecraft.network; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.Maps; +import java.util.Map; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.network.login.client.C00PacketLoginStart; +import net.minecraft.network.login.client.C01PacketEncryptionResponse; +import net.minecraft.network.login.server.S00PacketDisconnect; +import net.minecraft.network.login.server.S01PacketEncryptionRequest; +import net.minecraft.network.login.server.S02PacketLoginSuccess; +import net.minecraft.network.login.server.S03PacketEnableCompression; +import net.minecraft.network.play.client.C00PacketKeepAlive; +import net.minecraft.network.play.client.C01PacketChatMessage; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; +import net.minecraft.network.play.client.C09PacketHeldItemChange; +import net.minecraft.network.play.client.C0APacketAnimation; +import net.minecraft.network.play.client.C0BPacketEntityAction; +import net.minecraft.network.play.client.C0CPacketInput; +import net.minecraft.network.play.client.C0DPacketCloseWindow; +import net.minecraft.network.play.client.C0EPacketClickWindow; +import net.minecraft.network.play.client.C0FPacketConfirmTransaction; +import net.minecraft.network.play.client.C10PacketCreativeInventoryAction; +import net.minecraft.network.play.client.C11PacketEnchantItem; +import net.minecraft.network.play.client.C12PacketUpdateSign; +import net.minecraft.network.play.client.C13PacketPlayerAbilities; +import net.minecraft.network.play.client.C14PacketTabComplete; +import net.minecraft.network.play.client.C15PacketClientSettings; +import net.minecraft.network.play.client.C16PacketClientStatus; +import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraft.network.play.client.C18PacketSpectate; +import net.minecraft.network.play.client.C19PacketResourcePackStatus; +import net.minecraft.network.play.server.S00PacketKeepAlive; +import net.minecraft.network.play.server.S01PacketJoinGame; +import net.minecraft.network.play.server.S02PacketChat; +import net.minecraft.network.play.server.S03PacketTimeUpdate; +import net.minecraft.network.play.server.S04PacketEntityEquipment; +import net.minecraft.network.play.server.S05PacketSpawnPosition; +import net.minecraft.network.play.server.S06PacketUpdateHealth; +import net.minecraft.network.play.server.S07PacketRespawn; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.network.play.server.S09PacketHeldItemChange; +import net.minecraft.network.play.server.S0APacketUseBed; +import net.minecraft.network.play.server.S0BPacketAnimation; +import net.minecraft.network.play.server.S0CPacketSpawnPlayer; +import net.minecraft.network.play.server.S0DPacketCollectItem; +import net.minecraft.network.play.server.S0EPacketSpawnObject; +import net.minecraft.network.play.server.S0FPacketSpawnMob; +import net.minecraft.network.play.server.S10PacketSpawnPainting; +import net.minecraft.network.play.server.S11PacketSpawnExperienceOrb; +import net.minecraft.network.play.server.S12PacketEntityVelocity; +import net.minecraft.network.play.server.S13PacketDestroyEntities; +import net.minecraft.network.play.server.S14PacketEntity; +import net.minecraft.network.play.server.S18PacketEntityTeleport; +import net.minecraft.network.play.server.S19PacketEntityHeadLook; +import net.minecraft.network.play.server.S19PacketEntityStatus; +import net.minecraft.network.play.server.S1BPacketEntityAttach; +import net.minecraft.network.play.server.S1CPacketEntityMetadata; +import net.minecraft.network.play.server.S1DPacketEntityEffect; +import net.minecraft.network.play.server.S1EPacketRemoveEntityEffect; +import net.minecraft.network.play.server.S1FPacketSetExperience; +import net.minecraft.network.play.server.S20PacketEntityProperties; +import net.minecraft.network.play.server.S21PacketChunkData; +import net.minecraft.network.play.server.S22PacketMultiBlockChange; +import net.minecraft.network.play.server.S23PacketBlockChange; +import net.minecraft.network.play.server.S24PacketBlockAction; +import net.minecraft.network.play.server.S25PacketBlockBreakAnim; +import net.minecraft.network.play.server.S26PacketMapChunkBulk; +import net.minecraft.network.play.server.S27PacketExplosion; +import net.minecraft.network.play.server.S28PacketEffect; +import net.minecraft.network.play.server.S29PacketSoundEffect; +import net.minecraft.network.play.server.S2APacketParticles; +import net.minecraft.network.play.server.S2BPacketChangeGameState; +import net.minecraft.network.play.server.S2CPacketSpawnGlobalEntity; +import net.minecraft.network.play.server.S2DPacketOpenWindow; +import net.minecraft.network.play.server.S2EPacketCloseWindow; +import net.minecraft.network.play.server.S2FPacketSetSlot; +import net.minecraft.network.play.server.S30PacketWindowItems; +import net.minecraft.network.play.server.S31PacketWindowProperty; +import net.minecraft.network.play.server.S32PacketConfirmTransaction; +import net.minecraft.network.play.server.S33PacketUpdateSign; +import net.minecraft.network.play.server.S34PacketMaps; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.network.play.server.S36PacketSignEditorOpen; +import net.minecraft.network.play.server.S37PacketStatistics; +import net.minecraft.network.play.server.S38PacketPlayerListItem; +import net.minecraft.network.play.server.S39PacketPlayerAbilities; +import net.minecraft.network.play.server.S3APacketTabComplete; +import net.minecraft.network.play.server.S3BPacketScoreboardObjective; +import net.minecraft.network.play.server.S3CPacketUpdateScore; +import net.minecraft.network.play.server.S3DPacketDisplayScoreboard; +import net.minecraft.network.play.server.S3EPacketTeams; +import net.minecraft.network.play.server.S3FPacketCustomPayload; +import net.minecraft.network.play.server.S40PacketDisconnect; +import net.minecraft.network.play.server.S41PacketServerDifficulty; +import net.minecraft.network.play.server.S42PacketCombatEvent; +import net.minecraft.network.play.server.S43PacketCamera; +import net.minecraft.network.play.server.S44PacketWorldBorder; +import net.minecraft.network.play.server.S45PacketTitle; +import net.minecraft.network.play.server.S46PacketSetCompressionLevel; +import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter; +import net.minecraft.network.play.server.S48PacketResourcePackSend; +import net.minecraft.network.play.server.S49PacketUpdateEntityNBT; +import net.minecraft.network.status.client.C00PacketServerQuery; +import net.minecraft.network.status.client.C01PacketPing; +import net.minecraft.network.status.server.S00PacketServerInfo; +import net.minecraft.network.status.server.S01PacketPong; +import org.apache.logging.log4j.LogManager; + +public enum EnumConnectionState +{ + HANDSHAKING(-1) + { + { + this.registerPacket(EnumPacketDirection.SERVERBOUND, C00Handshake.class); + } + }, + PLAY(0) + { + { + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S00PacketKeepAlive.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S01PacketJoinGame.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S02PacketChat.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S03PacketTimeUpdate.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S04PacketEntityEquipment.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S05PacketSpawnPosition.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S06PacketUpdateHealth.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S07PacketRespawn.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S08PacketPlayerPosLook.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S09PacketHeldItemChange.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0APacketUseBed.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0BPacketAnimation.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0CPacketSpawnPlayer.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0DPacketCollectItem.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0EPacketSpawnObject.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0FPacketSpawnMob.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S10PacketSpawnPainting.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S11PacketSpawnExperienceOrb.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S12PacketEntityVelocity.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S13PacketDestroyEntities.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.S15PacketEntityRelMove.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.S16PacketEntityLook.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S14PacketEntity.S17PacketEntityLookMove.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S18PacketEntityTeleport.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S19PacketEntityHeadLook.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S19PacketEntityStatus.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1BPacketEntityAttach.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1CPacketEntityMetadata.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1DPacketEntityEffect.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1EPacketRemoveEntityEffect.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1FPacketSetExperience.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S20PacketEntityProperties.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S21PacketChunkData.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S22PacketMultiBlockChange.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S23PacketBlockChange.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S24PacketBlockAction.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S25PacketBlockBreakAnim.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S26PacketMapChunkBulk.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S27PacketExplosion.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S28PacketEffect.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S29PacketSoundEffect.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2APacketParticles.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2BPacketChangeGameState.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2CPacketSpawnGlobalEntity.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2DPacketOpenWindow.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2EPacketCloseWindow.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S2FPacketSetSlot.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S30PacketWindowItems.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S31PacketWindowProperty.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S32PacketConfirmTransaction.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S33PacketUpdateSign.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S34PacketMaps.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S35PacketUpdateTileEntity.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S36PacketSignEditorOpen.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S37PacketStatistics.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S38PacketPlayerListItem.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S39PacketPlayerAbilities.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3APacketTabComplete.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3BPacketScoreboardObjective.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3CPacketUpdateScore.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3DPacketDisplayScoreboard.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3EPacketTeams.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S3FPacketCustomPayload.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S40PacketDisconnect.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S41PacketServerDifficulty.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S42PacketCombatEvent.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S43PacketCamera.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S44PacketWorldBorder.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S45PacketTitle.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S46PacketSetCompressionLevel.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S47PacketPlayerListHeaderFooter.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S48PacketResourcePackSend.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S49PacketUpdateEntityNBT.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C00PacketKeepAlive.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C01PacketChatMessage.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C02PacketUseEntity.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C04PacketPlayerPosition.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C05PacketPlayerLook.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C03PacketPlayer.C06PacketPlayerPosLook.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C07PacketPlayerDigging.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C08PacketPlayerBlockPlacement.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C09PacketHeldItemChange.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C0APacketAnimation.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C0BPacketEntityAction.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C0CPacketInput.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C0DPacketCloseWindow.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C0EPacketClickWindow.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C0FPacketConfirmTransaction.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C10PacketCreativeInventoryAction.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C11PacketEnchantItem.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C12PacketUpdateSign.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C13PacketPlayerAbilities.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C14PacketTabComplete.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C15PacketClientSettings.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C16PacketClientStatus.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C17PacketCustomPayload.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C18PacketSpectate.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C19PacketResourcePackStatus.class); + } + }, + STATUS(1) + { + { + this.registerPacket(EnumPacketDirection.SERVERBOUND, C00PacketServerQuery.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S00PacketServerInfo.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C01PacketPing.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S01PacketPong.class); + } + }, + LOGIN(2) + { + { + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S00PacketDisconnect.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S01PacketEncryptionRequest.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S02PacketLoginSuccess.class); + this.registerPacket(EnumPacketDirection.CLIENTBOUND, S03PacketEnableCompression.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C00PacketLoginStart.class); + this.registerPacket(EnumPacketDirection.SERVERBOUND, C01PacketEncryptionResponse.class); + } + }; + + private static int field_181136_e = -1; + private static int field_181137_f = 2; + private static final EnumConnectionState[] STATES_BY_ID = new EnumConnectionState[field_181137_f - field_181136_e + 1]; + private static final Map < Class , EnumConnectionState > STATES_BY_CLASS = Maps. < Class , EnumConnectionState > newHashMap(); + private final int id; + private final Map < EnumPacketDirection, BiMap < Integer, Class >> directionMaps; + + private EnumConnectionState(int protocolId) + { + this.directionMaps = Maps.newEnumMap(EnumPacketDirection.class); + this.id = protocolId; + } + + protected EnumConnectionState registerPacket(EnumPacketDirection direction, Class packetClass) + { + BiMap < Integer, Class > bimap = (BiMap)this.directionMaps.get(direction); + + if (bimap == null) + { + bimap = HashBiMap. < Integer, Class > create(); + this.directionMaps.put(direction, bimap); + } + + if (bimap.containsValue(packetClass)) + { + String s = direction + " packet " + packetClass + " is already known to ID " + bimap.inverse().get(packetClass); + LogManager.getLogger().fatal(s); + throw new IllegalArgumentException(s); + } + else + { + bimap.put(Integer.valueOf(bimap.size()), packetClass); + return this; + } + } + + public Integer getPacketId(EnumPacketDirection direction, Packet packetIn) + { + return (Integer)((BiMap)this.directionMaps.get(direction)).inverse().get(packetIn.getClass()); + } + + public Packet getPacket(EnumPacketDirection direction, int packetId) throws InstantiationException, IllegalAccessException { + Class oclass = (Class)((BiMap)this.directionMaps.get(direction)).get(Integer.valueOf(packetId)); + return oclass == null ? null : (Packet)oclass.newInstance(); + } + + public int getId() + { + return this.id; + } + + public static EnumConnectionState getById(int stateId) + { + return stateId >= field_181136_e && stateId <= field_181137_f ? STATES_BY_ID[stateId - field_181136_e] : null; + } + + public static EnumConnectionState getFromPacket(Packet packetIn) + { + return (EnumConnectionState)STATES_BY_CLASS.get(packetIn.getClass()); + } + + static { + for (EnumConnectionState enumconnectionstate : values()) + { + int i = enumconnectionstate.getId(); + + if (i < field_181136_e || i > field_181137_f) + { + throw new Error("Invalid protocol ID " + Integer.toString(i)); + } + + STATES_BY_ID[i - field_181136_e] = enumconnectionstate; + + for (EnumPacketDirection enumpacketdirection : enumconnectionstate.directionMaps.keySet()) + { + for (Class oclass : (enumconnectionstate.directionMaps.get(enumpacketdirection)).values()) + { + if (STATES_BY_CLASS.containsKey(oclass) && STATES_BY_CLASS.get(oclass) != enumconnectionstate) + { + throw new Error("Packet " + oclass + " is already assigned to protocol " + STATES_BY_CLASS.get(oclass) + " - can\'t reassign to " + enumconnectionstate); + } + + try + { + oclass.newInstance(); + } + catch (Throwable var10) + { + throw new Error("Packet " + oclass + " fails instantiation checks! " + oclass); + } + + STATES_BY_CLASS.put(oclass, enumconnectionstate); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/network/EnumPacketDirection.java b/src/minecraft/net/minecraft/network/EnumPacketDirection.java new file mode 100644 index 0000000..134151f --- /dev/null +++ b/src/minecraft/net/minecraft/network/EnumPacketDirection.java @@ -0,0 +1,7 @@ +package net.minecraft.network; + +public enum EnumPacketDirection +{ + SERVERBOUND, + CLIENTBOUND; +} diff --git a/src/minecraft/net/minecraft/network/INetHandler.java b/src/minecraft/net/minecraft/network/INetHandler.java new file mode 100644 index 0000000..2e213eb --- /dev/null +++ b/src/minecraft/net/minecraft/network/INetHandler.java @@ -0,0 +1,11 @@ +package net.minecraft.network; + +import net.minecraft.util.IChatComponent; + +public interface INetHandler +{ + /** + * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination + */ + void onDisconnect(IChatComponent reason); +} diff --git a/src/minecraft/net/minecraft/network/NetHandlerPlayServer.java b/src/minecraft/net/minecraft/network/NetHandlerPlayServer.java new file mode 100644 index 0000000..92d4093 --- /dev/null +++ b/src/minecraft/net/minecraft/network/NetHandlerPlayServer.java @@ -0,0 +1,1460 @@ +package net.minecraft.network; + +import com.google.common.collect.Lists; +import com.google.common.primitives.Doubles; +import com.google.common.primitives.Floats; +import com.google.common.util.concurrent.Futures; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.util.concurrent.Future; +import io.netty.util.concurrent.GenericFutureListener; +import java.io.IOException; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Set; +import java.util.concurrent.Callable; +import net.minecraft.block.material.Material; +import net.minecraft.command.server.CommandBlockLogic; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityMinecartCommandBlock; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerBeacon; +import net.minecraft.inventory.ContainerMerchant; +import net.minecraft.inventory.ContainerRepair; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemEditableBook; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemWritableBook; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.network.play.INetHandlerPlayServer; +import net.minecraft.network.play.client.C00PacketKeepAlive; +import net.minecraft.network.play.client.C01PacketChatMessage; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; +import net.minecraft.network.play.client.C09PacketHeldItemChange; +import net.minecraft.network.play.client.C0APacketAnimation; +import net.minecraft.network.play.client.C0BPacketEntityAction; +import net.minecraft.network.play.client.C0CPacketInput; +import net.minecraft.network.play.client.C0DPacketCloseWindow; +import net.minecraft.network.play.client.C0EPacketClickWindow; +import net.minecraft.network.play.client.C0FPacketConfirmTransaction; +import net.minecraft.network.play.client.C10PacketCreativeInventoryAction; +import net.minecraft.network.play.client.C11PacketEnchantItem; +import net.minecraft.network.play.client.C12PacketUpdateSign; +import net.minecraft.network.play.client.C13PacketPlayerAbilities; +import net.minecraft.network.play.client.C14PacketTabComplete; +import net.minecraft.network.play.client.C15PacketClientSettings; +import net.minecraft.network.play.client.C16PacketClientStatus; +import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraft.network.play.client.C18PacketSpectate; +import net.minecraft.network.play.client.C19PacketResourcePackStatus; +import net.minecraft.network.play.server.S00PacketKeepAlive; +import net.minecraft.network.play.server.S02PacketChat; +import net.minecraft.network.play.server.S07PacketRespawn; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.network.play.server.S18PacketEntityTeleport; +import net.minecraft.network.play.server.S23PacketBlockChange; +import net.minecraft.network.play.server.S2FPacketSetSlot; +import net.minecraft.network.play.server.S32PacketConfirmTransaction; +import net.minecraft.network.play.server.S3APacketTabComplete; +import net.minecraft.network.play.server.S40PacketDisconnect; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.management.UserListBansEntry; +import net.minecraft.stats.AchievementList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityCommandBlock; +import net.minecraft.tileentity.TileEntitySign; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatAllowedCharacters; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ITickable; +import net.minecraft.util.IntHashMap; +import net.minecraft.util.ReportedException; +import net.minecraft.world.WorldServer; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class NetHandlerPlayServer implements INetHandlerPlayServer, ITickable +{ + private static final Logger logger = LogManager.getLogger(); + public final NetworkManager netManager; + private final MinecraftServer serverController; + public EntityPlayerMP playerEntity; + private int networkTickCount; + private int field_175090_f; + + /** + * Used to keep track of how the player is floating while gamerules should prevent that. Surpassing 80 ticks means + * kick + */ + private int floatingTickCount; + private boolean field_147366_g; + private int field_147378_h; + private long lastPingTime; + private long lastSentPingPacket; + + /** + * Incremented by 20 each time a user sends a chat message, decreased by one every tick. Non-ops kicked when over + * 200 + */ + private int chatSpamThresholdCount; + private int itemDropThreshold; + private IntHashMap field_147372_n = new IntHashMap(); + private double lastPosX; + private double lastPosY; + private double lastPosZ; + private boolean hasMoved = true; + + public NetHandlerPlayServer(MinecraftServer server, NetworkManager networkManagerIn, EntityPlayerMP playerIn) + { + this.serverController = server; + this.netManager = networkManagerIn; + networkManagerIn.setNetHandler(this); + this.playerEntity = playerIn; + playerIn.playerNetServerHandler = this; + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + this.field_147366_g = false; + ++this.networkTickCount; + this.serverController.theProfiler.startSection("keepAlive"); + + if ((long)this.networkTickCount - this.lastSentPingPacket > 40L) + { + this.lastSentPingPacket = (long)this.networkTickCount; + this.lastPingTime = this.currentTimeMillis(); + this.field_147378_h = (int)this.lastPingTime; + this.sendPacket(new S00PacketKeepAlive(this.field_147378_h)); + } + + this.serverController.theProfiler.endSection(); + + if (this.chatSpamThresholdCount > 0) + { + --this.chatSpamThresholdCount; + } + + if (this.itemDropThreshold > 0) + { + --this.itemDropThreshold; + } + + if (this.playerEntity.getLastActiveTime() > 0L && this.serverController.getMaxPlayerIdleMinutes() > 0 && MinecraftServer.getCurrentTimeMillis() - this.playerEntity.getLastActiveTime() > (long)(this.serverController.getMaxPlayerIdleMinutes() * 1000 * 60)) + { + this.kickPlayerFromServer("You have been idle for too long!"); + } + } + + public NetworkManager getNetworkManager() + { + return this.netManager; + } + + /** + * Kick a player from the server with a reason + */ + public void kickPlayerFromServer(String reason) + { + final ChatComponentText chatcomponenttext = new ChatComponentText(reason); + this.netManager.sendPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener < Future > () + { + public void operationComplete(Future p_operationComplete_1_) throws Exception + { + NetHandlerPlayServer.this.netManager.closeChannel(chatcomponenttext); + } + }, new GenericFutureListener[0]); + this.netManager.disableAutoRead(); + Futures.getUnchecked(this.serverController.addScheduledTask(new Runnable() + { + public void run() + { + NetHandlerPlayServer.this.netManager.checkDisconnected(); + } + })); + } + + /** + * Processes player movement input. Includes walking, strafing, jumping, sneaking; excludes riding and toggling + * flying/sprinting + */ + public void processInput(C0CPacketInput packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + this.playerEntity.setEntityActionState(packetIn.getStrafeSpeed(), packetIn.getForwardSpeed(), packetIn.isJumping(), packetIn.isSneaking()); + } + + private boolean func_183006_b(C03PacketPlayer p_183006_1_) + { + return !Doubles.isFinite(p_183006_1_.getPositionX()) || !Doubles.isFinite(p_183006_1_.getPositionY()) || !Doubles.isFinite(p_183006_1_.getPositionZ()) || !Floats.isFinite(p_183006_1_.getPitch()) || !Floats.isFinite(p_183006_1_.getYaw()); + } + + /** + * Processes clients perspective on player positioning and/or orientation + */ + public void processPlayer(C03PacketPlayer packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + + if (this.func_183006_b(packetIn)) + { + this.kickPlayerFromServer("Invalid move packet received"); + } + else + { + WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); + this.field_147366_g = true; + + if (!this.playerEntity.playerConqueredTheEnd) + { + double d0 = this.playerEntity.posX; + double d1 = this.playerEntity.posY; + double d2 = this.playerEntity.posZ; + double d3 = 0.0D; + double d4 = packetIn.getPositionX() - this.lastPosX; + double d5 = packetIn.getPositionY() - this.lastPosY; + double d6 = packetIn.getPositionZ() - this.lastPosZ; + + if (packetIn.isMoving()) + { + d3 = d4 * d4 + d5 * d5 + d6 * d6; + + if (!this.hasMoved && d3 < 0.25D) + { + this.hasMoved = true; + } + } + + if (this.hasMoved) + { + this.field_175090_f = this.networkTickCount; + + if (this.playerEntity.ridingEntity != null) + { + float f4 = this.playerEntity.rotationYaw; + float f = this.playerEntity.rotationPitch; + this.playerEntity.ridingEntity.updateRiderPosition(); + double d16 = this.playerEntity.posX; + double d17 = this.playerEntity.posY; + double d18 = this.playerEntity.posZ; + + if (packetIn.getRotating()) + { + f4 = packetIn.getYaw(); + f = packetIn.getPitch(); + } + + this.playerEntity.onGround = packetIn.isOnGround(); + this.playerEntity.onUpdateEntity(); + this.playerEntity.setPositionAndRotation(d16, d17, d18, f4, f); + + if (this.playerEntity.ridingEntity != null) + { + this.playerEntity.ridingEntity.updateRiderPosition(); + } + + this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + + if (this.playerEntity.ridingEntity != null) + { + if (d3 > 4.0D) + { + Entity entity = this.playerEntity.ridingEntity; + this.playerEntity.playerNetServerHandler.sendPacket(new S18PacketEntityTeleport(entity)); + this.setPlayerLocation(this.playerEntity.posX, this.playerEntity.posY, this.playerEntity.posZ, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch); + } + + this.playerEntity.ridingEntity.isAirBorne = true; + } + + if (this.hasMoved) + { + this.lastPosX = this.playerEntity.posX; + this.lastPosY = this.playerEntity.posY; + this.lastPosZ = this.playerEntity.posZ; + } + + worldserver.updateEntity(this.playerEntity); + return; + } + + if (this.playerEntity.isPlayerSleeping()) + { + this.playerEntity.onUpdateEntity(); + this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch); + worldserver.updateEntity(this.playerEntity); + return; + } + + double d7 = this.playerEntity.posY; + this.lastPosX = this.playerEntity.posX; + this.lastPosY = this.playerEntity.posY; + this.lastPosZ = this.playerEntity.posZ; + double d8 = this.playerEntity.posX; + double d9 = this.playerEntity.posY; + double d10 = this.playerEntity.posZ; + float f1 = this.playerEntity.rotationYaw; + float f2 = this.playerEntity.rotationPitch; + + if (packetIn.isMoving() && packetIn.getPositionY() == -999.0D) + { + packetIn.setMoving(false); + } + + if (packetIn.isMoving()) + { + d8 = packetIn.getPositionX(); + d9 = packetIn.getPositionY(); + d10 = packetIn.getPositionZ(); + + if (Math.abs(packetIn.getPositionX()) > 3.0E7D || Math.abs(packetIn.getPositionZ()) > 3.0E7D) + { + this.kickPlayerFromServer("Illegal position"); + return; + } + } + + if (packetIn.getRotating()) + { + f1 = packetIn.getYaw(); + f2 = packetIn.getPitch(); + } + + this.playerEntity.onUpdateEntity(); + this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2); + + if (!this.hasMoved) + { + return; + } + + double d11 = d8 - this.playerEntity.posX; + double d12 = d9 - this.playerEntity.posY; + double d13 = d10 - this.playerEntity.posZ; + double d14 = this.playerEntity.motionX * this.playerEntity.motionX + this.playerEntity.motionY * this.playerEntity.motionY + this.playerEntity.motionZ * this.playerEntity.motionZ; + double d15 = d11 * d11 + d12 * d12 + d13 * d13; + + if (d15 - d14 > 100.0D && (!this.serverController.isSinglePlayer() || !this.serverController.getServerOwner().equals(this.playerEntity.getName()))) + { + logger.warn(this.playerEntity.getName() + " moved too quickly! " + d11 + "," + d12 + "," + d13 + " (" + d11 + ", " + d12 + ", " + d13 + ")"); + this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch); + return; + } + + float f3 = 0.0625F; + boolean flag = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.getEntityBoundingBox().contract((double)f3, (double)f3, (double)f3)).isEmpty(); + + if (this.playerEntity.onGround && !packetIn.isOnGround() && d12 > 0.0D) + { + this.playerEntity.jump(); + } + + this.playerEntity.moveEntity(d11, d12, d13); + this.playerEntity.onGround = packetIn.isOnGround(); + d11 = d8 - this.playerEntity.posX; + d12 = d9 - this.playerEntity.posY; + + if (d12 > -0.5D || d12 < 0.5D) + { + d12 = 0.0D; + } + + d13 = d10 - this.playerEntity.posZ; + d15 = d11 * d11 + d12 * d12 + d13 * d13; + boolean flag1 = false; + + if (d15 > 0.0625D && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.theItemInWorldManager.isCreative()) + { + flag1 = true; + logger.warn(this.playerEntity.getName() + " moved wrongly!"); + } + + this.playerEntity.setPositionAndRotation(d8, d9, d10, f1, f2); + this.playerEntity.addMovementStat(this.playerEntity.posX - d0, this.playerEntity.posY - d1, this.playerEntity.posZ - d2); + + if (!this.playerEntity.noClip) + { + boolean flag2 = worldserver.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.getEntityBoundingBox().contract((double)f3, (double)f3, (double)f3)).isEmpty(); + + if (flag && (flag1 || !flag2) && !this.playerEntity.isPlayerSleeping()) + { + this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, f1, f2); + return; + } + } + + AxisAlignedBB axisalignedbb = this.playerEntity.getEntityBoundingBox().expand((double)f3, (double)f3, (double)f3).addCoord(0.0D, -0.55D, 0.0D); + + if (!this.serverController.isFlightAllowed() && !this.playerEntity.capabilities.allowFlying && !worldserver.checkBlockCollision(axisalignedbb)) + { + if (d12 >= -0.03125D) + { + ++this.floatingTickCount; + + if (this.floatingTickCount > 80) + { + logger.warn(this.playerEntity.getName() + " was kicked for floating too long!"); + this.kickPlayerFromServer("Flying is not enabled on this server"); + return; + } + } + } + else + { + this.floatingTickCount = 0; + } + + this.playerEntity.onGround = packetIn.isOnGround(); + this.serverController.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + this.playerEntity.handleFalling(this.playerEntity.posY - d7, packetIn.isOnGround()); + } + else if (this.networkTickCount - this.field_175090_f > 20) + { + this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch); + } + } + } + } + + public void setPlayerLocation(double x, double y, double z, float yaw, float pitch) + { + this.setPlayerLocation(x, y, z, yaw, pitch, Collections.emptySet()); + } + + public void setPlayerLocation(double x, double y, double z, float yaw, float pitch, Set relativeSet) + { + this.hasMoved = false; + this.lastPosX = x; + this.lastPosY = y; + this.lastPosZ = z; + + if (relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.X)) + { + this.lastPosX += this.playerEntity.posX; + } + + if (relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.Y)) + { + this.lastPosY += this.playerEntity.posY; + } + + if (relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.Z)) + { + this.lastPosZ += this.playerEntity.posZ; + } + + float f = yaw; + float f1 = pitch; + + if (relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.Y_ROT)) + { + f = yaw + this.playerEntity.rotationYaw; + } + + if (relativeSet.contains(S08PacketPlayerPosLook.EnumFlags.X_ROT)) + { + f1 = pitch + this.playerEntity.rotationPitch; + } + + this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ, f, f1); + this.playerEntity.playerNetServerHandler.sendPacket(new S08PacketPlayerPosLook(x, y, z, yaw, pitch, relativeSet)); + } + + /** + * Processes the player initiating/stopping digging on a particular spot, as well as a player dropping items?. (0: + * initiated, 1: reinitiated, 2? , 3-4 drop item (respectively without or with player control), 5: stopped; x,y,z, + * side clicked on;) + */ + public void processPlayerDigging(C07PacketPlayerDigging packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); + BlockPos blockpos = packetIn.getPosition(); + this.playerEntity.markPlayerActive(); + + switch (packetIn.getStatus()) + { + case DROP_ITEM: + if (!this.playerEntity.isSpectator()) + { + this.playerEntity.dropOneItem(false); + } + + return; + + case DROP_ALL_ITEMS: + if (!this.playerEntity.isSpectator()) + { + this.playerEntity.dropOneItem(true); + } + + return; + + case RELEASE_USE_ITEM: + this.playerEntity.stopUsingItem(); + return; + + case START_DESTROY_BLOCK: + case ABORT_DESTROY_BLOCK: + case STOP_DESTROY_BLOCK: + double d0 = this.playerEntity.posX - ((double)blockpos.getX() + 0.5D); + double d1 = this.playerEntity.posY - ((double)blockpos.getY() + 0.5D) + 1.5D; + double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D); + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + + if (d3 > 36.0D) + { + return; + } + else if (blockpos.getY() >= this.serverController.getBuildLimit()) + { + return; + } + else + { + if (packetIn.getStatus() == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK) + { + if (!this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) + { + this.playerEntity.theItemInWorldManager.onBlockClicked(blockpos, packetIn.getFacing()); + } + else + { + this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos)); + } + } + else + { + if (packetIn.getStatus() == C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK) + { + this.playerEntity.theItemInWorldManager.blockRemoving(blockpos); + } + else if (packetIn.getStatus() == C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK) + { + this.playerEntity.theItemInWorldManager.cancelDestroyingBlock(); + } + + if (worldserver.getBlockState(blockpos).getBlock().getMaterial() != Material.air) + { + this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos)); + } + } + + return; + } + + default: + throw new IllegalArgumentException("Invalid player action"); + } + } + + /** + * Processes block placement and block activation (anvil, furnace, etc.) + */ + public void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); + ItemStack itemstack = this.playerEntity.inventory.getCurrentItem(); + boolean flag = false; + BlockPos blockpos = packetIn.getPosition(); + EnumFacing enumfacing = EnumFacing.getFront(packetIn.getPlacedBlockDirection()); + this.playerEntity.markPlayerActive(); + + if (packetIn.getPlacedBlockDirection() == 255) + { + if (itemstack == null) + { + return; + } + + this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, worldserver, itemstack); + } + else if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit()) + { + if (this.hasMoved && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < 64.0D && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) + { + this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, worldserver, itemstack, blockpos, enumfacing, packetIn.getPlacedBlockOffsetX(), packetIn.getPlacedBlockOffsetY(), packetIn.getPlacedBlockOffsetZ()); + } + + flag = true; + } + else + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("build.tooHigh", new Object[] {Integer.valueOf(this.serverController.getBuildLimit())}); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); + this.playerEntity.playerNetServerHandler.sendPacket(new S02PacketChat(chatcomponenttranslation)); + flag = true; + } + + if (flag) + { + this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos)); + this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos.offset(enumfacing))); + } + + itemstack = this.playerEntity.inventory.getCurrentItem(); + + if (itemstack != null && itemstack.stackSize == 0) + { + this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = null; + itemstack = null; + } + + if (itemstack == null || itemstack.getMaxItemUseDuration() == 0) + { + this.playerEntity.isChangingQuantityOnly = true; + this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = ItemStack.copyItemStack(this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem]); + Slot slot = this.playerEntity.openContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem); + this.playerEntity.openContainer.detectAndSendChanges(); + this.playerEntity.isChangingQuantityOnly = false; + + if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), packetIn.getStack())) + { + this.sendPacket(new S2FPacketSetSlot(this.playerEntity.openContainer.windowId, slot.slotNumber, this.playerEntity.inventory.getCurrentItem())); + } + } + } + + public void handleSpectate(C18PacketSpectate packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + + if (this.playerEntity.isSpectator()) + { + Entity entity = null; + + for (WorldServer worldserver : this.serverController.worldServers) + { + if (worldserver != null) + { + entity = packetIn.getEntity(worldserver); + + if (entity != null) + { + break; + } + } + } + + if (entity != null) + { + this.playerEntity.setSpectatingEntity(this.playerEntity); + this.playerEntity.mountEntity((Entity)null); + + if (entity.worldObj != this.playerEntity.worldObj) + { + WorldServer worldserver1 = this.playerEntity.getServerForPlayer(); + WorldServer worldserver2 = (WorldServer)entity.worldObj; + this.playerEntity.dimension = entity.dimension; + this.sendPacket(new S07PacketRespawn(this.playerEntity.dimension, worldserver1.getDifficulty(), worldserver1.getWorldInfo().getTerrainType(), this.playerEntity.theItemInWorldManager.getGameType())); + worldserver1.removePlayerEntityDangerously(this.playerEntity); + this.playerEntity.isDead = false; + this.playerEntity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); + + if (this.playerEntity.isEntityAlive()) + { + worldserver1.updateEntityWithOptionalForce(this.playerEntity, false); + worldserver2.spawnEntityInWorld(this.playerEntity); + worldserver2.updateEntityWithOptionalForce(this.playerEntity, false); + } + + this.playerEntity.setWorld(worldserver2); + this.serverController.getConfigurationManager().preparePlayer(this.playerEntity, worldserver1); + this.playerEntity.setPositionAndUpdate(entity.posX, entity.posY, entity.posZ); + this.playerEntity.theItemInWorldManager.setWorld(worldserver2); + this.serverController.getConfigurationManager().updateTimeAndWeatherForPlayer(this.playerEntity, worldserver2); + this.serverController.getConfigurationManager().syncPlayerInventory(this.playerEntity); + } + else + { + this.playerEntity.setPositionAndUpdate(entity.posX, entity.posY, entity.posZ); + } + } + } + } + + public void handleResourcePackStatus(C19PacketResourcePackStatus packetIn) + { + } + + /** + * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination + */ + public void onDisconnect(IChatComponent reason) + { + logger.info(this.playerEntity.getName() + " lost connection: " + reason); + this.serverController.refreshStatusNextTick(); + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("multiplayer.player.left", new Object[] {this.playerEntity.getDisplayName()}); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.YELLOW); + this.serverController.getConfigurationManager().sendChatMsg(chatcomponenttranslation); + this.playerEntity.mountEntityAndWakeUp(); + this.serverController.getConfigurationManager().playerLoggedOut(this.playerEntity); + + if (this.serverController.isSinglePlayer() && this.playerEntity.getName().equals(this.serverController.getServerOwner())) + { + logger.info("Stopping singleplayer server as player logged out"); + this.serverController.initiateShutdown(); + } + } + + public void sendPacket(final Packet packetIn) + { + if (packetIn instanceof S02PacketChat) + { + S02PacketChat s02packetchat = (S02PacketChat)packetIn; + EntityPlayer.EnumChatVisibility entityplayer$enumchatvisibility = this.playerEntity.getChatVisibility(); + + if (entityplayer$enumchatvisibility == EntityPlayer.EnumChatVisibility.HIDDEN) + { + return; + } + + if (entityplayer$enumchatvisibility == EntityPlayer.EnumChatVisibility.SYSTEM && !s02packetchat.isChat()) + { + return; + } + } + + try + { + this.netManager.sendPacket(packetIn); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Sending packet"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Packet being sent"); + crashreportcategory.addCrashSectionCallable("Packet class", new Callable() + { + public String call() throws Exception + { + return packetIn.getClass().getCanonicalName(); + } + }); + throw new ReportedException(crashreport); + } + } + + /** + * Updates which quickbar slot is selected + */ + public void processHeldItemChange(C09PacketHeldItemChange packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + + if (packetIn.getSlotId() >= 0 && packetIn.getSlotId() < InventoryPlayer.getHotbarSize()) + { + this.playerEntity.inventory.currentItem = packetIn.getSlotId(); + this.playerEntity.markPlayerActive(); + } + else + { + logger.warn(this.playerEntity.getName() + " tried to set an invalid carried item"); + } + } + + /** + * Process chat messages (broadcast back to clients) and commands (executes) + */ + public void processChatMessage(C01PacketChatMessage packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + + if (this.playerEntity.getChatVisibility() == EntityPlayer.EnumChatVisibility.HIDDEN) + { + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.cannotSend", new Object[0]); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); + this.sendPacket(new S02PacketChat(chatcomponenttranslation)); + } + else + { + this.playerEntity.markPlayerActive(); + String s = packetIn.getMessage(); + s = StringUtils.normalizeSpace(s); + + for (int i = 0; i < s.length(); ++i) + { + if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i))) + { + this.kickPlayerFromServer("Illegal characters in chat"); + return; + } + } + + if (s.startsWith("/")) + { + this.handleSlashCommand(s); + } + else + { + IChatComponent ichatcomponent = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.getDisplayName(), s}); + this.serverController.getConfigurationManager().sendChatMsgImpl(ichatcomponent, false); + } + + this.chatSpamThresholdCount += 20; + + if (this.chatSpamThresholdCount > 200 && !this.serverController.getConfigurationManager().canSendCommands(this.playerEntity.getGameProfile())) + { + this.kickPlayerFromServer("disconnect.spam"); + } + } + } + + /** + * Handle commands that start with a / + */ + private void handleSlashCommand(String command) + { + this.serverController.getCommandManager().executeCommand(this.playerEntity, command); + } + + public void handleAnimation(C0APacketAnimation packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + this.playerEntity.markPlayerActive(); + this.playerEntity.swingItem(); + } + + /** + * Processes a range of action-types: sneaking, sprinting, waking from sleep, opening the inventory or setting jump + * height of the horse the player is riding + */ + public void processEntityAction(C0BPacketEntityAction packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + this.playerEntity.markPlayerActive(); + + switch (packetIn.getAction()) + { + case START_SNEAKING: + this.playerEntity.setSneaking(true); + break; + + case STOP_SNEAKING: + this.playerEntity.setSneaking(false); + break; + + case START_SPRINTING: + this.playerEntity.setSprinting(true); + break; + + case STOP_SPRINTING: + this.playerEntity.setSprinting(false); + break; + + case STOP_SLEEPING: + this.playerEntity.wakeUpPlayer(false, true, true); + this.hasMoved = false; + break; + + case RIDING_JUMP: + if (this.playerEntity.ridingEntity instanceof EntityHorse) + { + ((EntityHorse)this.playerEntity.ridingEntity).setJumpPower(packetIn.getAuxData()); + } + + break; + + case OPEN_INVENTORY: + if (this.playerEntity.ridingEntity instanceof EntityHorse) + { + ((EntityHorse)this.playerEntity.ridingEntity).openGUI(this.playerEntity); + } + + break; + + default: + throw new IllegalArgumentException("Invalid client command!"); + } + } + + /** + * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently + * equipped item + */ + public void processUseEntity(C02PacketUseEntity packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); + Entity entity = packetIn.getEntityFromWorld(worldserver); + this.playerEntity.markPlayerActive(); + + if (entity != null) + { + boolean flag = this.playerEntity.canEntityBeSeen(entity); + double d0 = 36.0D; + + if (!flag) + { + d0 = 9.0D; + } + + if (this.playerEntity.getDistanceSqToEntity(entity) < d0) + { + if (packetIn.getAction() == C02PacketUseEntity.Action.INTERACT) + { + this.playerEntity.interactWith(entity); + } + else if (packetIn.getAction() == C02PacketUseEntity.Action.INTERACT_AT) + { + entity.interactAt(this.playerEntity, packetIn.getHitVec()); + } + else if (packetIn.getAction() == C02PacketUseEntity.Action.ATTACK) + { + if (entity instanceof EntityItem || entity instanceof EntityXPOrb || entity instanceof EntityArrow || entity == this.playerEntity) + { + this.kickPlayerFromServer("Attempting to attack an invalid entity"); + this.serverController.logWarning("Player " + this.playerEntity.getName() + " tried to attack an invalid entity"); + return; + } + + this.playerEntity.attackTargetEntityWithCurrentItem(entity); + } + } + } + } + + /** + * Processes the client status updates: respawn attempt from player, opening statistics or achievements, or + * acquiring 'open inventory' achievement + */ + public void processClientStatus(C16PacketClientStatus packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + this.playerEntity.markPlayerActive(); + C16PacketClientStatus.EnumState c16packetclientstatus$enumstate = packetIn.getStatus(); + + switch (c16packetclientstatus$enumstate) + { + case PERFORM_RESPAWN: + if (this.playerEntity.playerConqueredTheEnd) + { + this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, true); + } + else if (this.playerEntity.getServerForPlayer().getWorldInfo().isHardcoreModeEnabled()) + { + if (this.serverController.isSinglePlayer() && this.playerEntity.getName().equals(this.serverController.getServerOwner())) + { + this.playerEntity.playerNetServerHandler.kickPlayerFromServer("You have died. Game over, man, it\'s game over!"); + this.serverController.deleteWorldAndStopServer(); + } + else + { + UserListBansEntry userlistbansentry = new UserListBansEntry(this.playerEntity.getGameProfile(), (Date)null, "(You just lost the game)", (Date)null, "Death in Hardcore"); + this.serverController.getConfigurationManager().getBannedPlayers().addEntry(userlistbansentry); + this.playerEntity.playerNetServerHandler.kickPlayerFromServer("You have died. Game over, man, it\'s game over!"); + } + } + else + { + if (this.playerEntity.getHealth() > 0.0F) + { + return; + } + + this.playerEntity = this.serverController.getConfigurationManager().recreatePlayerEntity(this.playerEntity, 0, false); + } + + break; + + case REQUEST_STATS: + this.playerEntity.getStatFile().func_150876_a(this.playerEntity); + break; + + case OPEN_INVENTORY_ACHIEVEMENT: + this.playerEntity.triggerAchievement(AchievementList.openInventory); + } + } + + /** + * Processes the client closing windows (container) + */ + public void processCloseWindow(C0DPacketCloseWindow packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + this.playerEntity.closeContainer(); + } + + /** + * Executes a container/inventory slot manipulation as indicated by the packet. Sends the serverside result if they + * didn't match the indicated result and prevents further manipulation by the player until he confirms that it has + * the same open container/inventory + */ + public void processClickWindow(C0EPacketClickWindow packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + this.playerEntity.markPlayerActive(); + + if (this.playerEntity.openContainer.windowId == packetIn.getWindowId() && this.playerEntity.openContainer.getCanCraft(this.playerEntity)) + { + if (this.playerEntity.isSpectator()) + { + List list = Lists.newArrayList(); + + for (int i = 0; i < this.playerEntity.openContainer.inventorySlots.size(); ++i) + { + list.add(((Slot)this.playerEntity.openContainer.inventorySlots.get(i)).getStack()); + } + + this.playerEntity.updateCraftingInventory(this.playerEntity.openContainer, list); + } + else + { + ItemStack itemstack = this.playerEntity.openContainer.slotClick(packetIn.getSlotId(), packetIn.getUsedButton(), packetIn.getMode(), this.playerEntity); + + if (ItemStack.areItemStacksEqual(packetIn.getClickedItem(), itemstack)) + { + this.playerEntity.playerNetServerHandler.sendPacket(new S32PacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), true)); + this.playerEntity.isChangingQuantityOnly = true; + this.playerEntity.openContainer.detectAndSendChanges(); + this.playerEntity.updateHeldItem(); + this.playerEntity.isChangingQuantityOnly = false; + } + else + { + this.field_147372_n.addKey(this.playerEntity.openContainer.windowId, Short.valueOf(packetIn.getActionNumber())); + this.playerEntity.playerNetServerHandler.sendPacket(new S32PacketConfirmTransaction(packetIn.getWindowId(), packetIn.getActionNumber(), false)); + this.playerEntity.openContainer.setCanCraft(this.playerEntity, false); + List list1 = Lists.newArrayList(); + + for (int j = 0; j < this.playerEntity.openContainer.inventorySlots.size(); ++j) + { + list1.add(((Slot)this.playerEntity.openContainer.inventorySlots.get(j)).getStack()); + } + + this.playerEntity.updateCraftingInventory(this.playerEntity.openContainer, list1); + } + } + } + } + + /** + * Enchants the item identified by the packet given some convoluted conditions (matching window, which + * should/shouldn't be in use?) + */ + public void processEnchantItem(C11PacketEnchantItem packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + this.playerEntity.markPlayerActive(); + + if (this.playerEntity.openContainer.windowId == packetIn.getWindowId() && this.playerEntity.openContainer.getCanCraft(this.playerEntity) && !this.playerEntity.isSpectator()) + { + this.playerEntity.openContainer.enchantItem(this.playerEntity, packetIn.getButton()); + this.playerEntity.openContainer.detectAndSendChanges(); + } + } + + /** + * Update the server with an ItemStack in a slot. + */ + public void processCreativeInventoryAction(C10PacketCreativeInventoryAction packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + + if (this.playerEntity.theItemInWorldManager.isCreative()) + { + boolean flag = packetIn.getSlotId() < 0; + ItemStack itemstack = packetIn.getStack(); + + if (itemstack != null && itemstack.hasTagCompound() && itemstack.getTagCompound().hasKey("BlockEntityTag", 10)) + { + NBTTagCompound nbttagcompound = itemstack.getTagCompound().getCompoundTag("BlockEntityTag"); + + if (nbttagcompound.hasKey("x") && nbttagcompound.hasKey("y") && nbttagcompound.hasKey("z")) + { + BlockPos blockpos = new BlockPos(nbttagcompound.getInteger("x"), nbttagcompound.getInteger("y"), nbttagcompound.getInteger("z")); + TileEntity tileentity = this.playerEntity.worldObj.getTileEntity(blockpos); + + if (tileentity != null) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + tileentity.writeToNBT(nbttagcompound1); + nbttagcompound1.removeTag("x"); + nbttagcompound1.removeTag("y"); + nbttagcompound1.removeTag("z"); + itemstack.setTagInfo("BlockEntityTag", nbttagcompound1); + } + } + } + + boolean flag1 = packetIn.getSlotId() >= 1 && packetIn.getSlotId() < 36 + InventoryPlayer.getHotbarSize(); + boolean flag2 = itemstack == null || itemstack.getItem() != null; + boolean flag3 = itemstack == null || itemstack.getMetadata() >= 0 && itemstack.stackSize <= 64 && itemstack.stackSize > 0; + + if (flag1 && flag2 && flag3) + { + if (itemstack == null) + { + this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), (ItemStack)null); + } + else + { + this.playerEntity.inventoryContainer.putStackInSlot(packetIn.getSlotId(), itemstack); + } + + this.playerEntity.inventoryContainer.setCanCraft(this.playerEntity, true); + } + else if (flag && flag2 && flag3 && this.itemDropThreshold < 200) + { + this.itemDropThreshold += 20; + EntityItem entityitem = this.playerEntity.dropPlayerItemWithRandomChoice(itemstack, true); + + if (entityitem != null) + { + entityitem.setAgeToCreativeDespawnTime(); + } + } + } + } + + /** + * Received in response to the server requesting to confirm that the client-side open container matches the servers' + * after a mismatched container-slot manipulation. It will unlock the player's ability to manipulate the container + * contents + */ + public void processConfirmTransaction(C0FPacketConfirmTransaction packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + Short oshort = (Short)this.field_147372_n.lookup(this.playerEntity.openContainer.windowId); + + if (oshort != null && packetIn.getUid() == oshort.shortValue() && this.playerEntity.openContainer.windowId == packetIn.getWindowId() && !this.playerEntity.openContainer.getCanCraft(this.playerEntity) && !this.playerEntity.isSpectator()) + { + this.playerEntity.openContainer.setCanCraft(this.playerEntity, true); + } + } + + public void processUpdateSign(C12PacketUpdateSign packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + this.playerEntity.markPlayerActive(); + WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); + BlockPos blockpos = packetIn.getPosition(); + + if (worldserver.isBlockLoaded(blockpos)) + { + TileEntity tileentity = worldserver.getTileEntity(blockpos); + + if (!(tileentity instanceof TileEntitySign)) + { + return; + } + + TileEntitySign tileentitysign = (TileEntitySign)tileentity; + + if (!tileentitysign.getIsEditable() || tileentitysign.getPlayer() != this.playerEntity) + { + this.serverController.logWarning("Player " + this.playerEntity.getName() + " just tried to change non-editable sign"); + return; + } + + IChatComponent[] aichatcomponent = packetIn.getLines(); + + for (int i = 0; i < aichatcomponent.length; ++i) + { + tileentitysign.signText[i] = new ChatComponentText(EnumChatFormatting.getTextWithoutFormattingCodes(aichatcomponent[i].getUnformattedText())); + } + + tileentitysign.markDirty(); + worldserver.markBlockForUpdate(blockpos); + } + } + + /** + * Updates a players' ping statistics + */ + public void processKeepAlive(C00PacketKeepAlive packetIn) + { + if (packetIn.getKey() == this.field_147378_h) + { + int i = (int)(this.currentTimeMillis() - this.lastPingTime); + this.playerEntity.ping = (this.playerEntity.ping * 3 + i) / 4; + } + } + + private long currentTimeMillis() + { + return System.nanoTime() / 1000000L; + } + + /** + * Processes a player starting/stopping flying + */ + public void processPlayerAbilities(C13PacketPlayerAbilities packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + this.playerEntity.capabilities.isFlying = packetIn.isFlying() && this.playerEntity.capabilities.allowFlying; + } + + /** + * Retrieves possible tab completions for the requested command string and sends them to the client + */ + public void processTabComplete(C14PacketTabComplete packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + List list = Lists.newArrayList(); + + for (String s : this.serverController.getTabCompletions(this.playerEntity, packetIn.getMessage(), packetIn.getTargetBlock())) + { + list.add(s); + } + + this.playerEntity.playerNetServerHandler.sendPacket(new S3APacketTabComplete((String[])list.toArray(new String[list.size()]))); + } + + /** + * Updates serverside copy of client settings: language, render distance, chat visibility, chat colours, difficulty, + * and whether to show the cape + */ + public void processClientSettings(C15PacketClientSettings packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + this.playerEntity.handleClientSettings(packetIn); + } + + /** + * Synchronizes serverside and clientside book contents and signing + */ + public void processVanilla250Packet(C17PacketCustomPayload packetIn) + { + PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); + + if ("MC|BEdit".equals(packetIn.getChannelName())) + { + PacketBuffer packetbuffer3 = new PacketBuffer(Unpooled.wrappedBuffer((ByteBuf)packetIn.getBufferData())); + + try + { + ItemStack itemstack1 = packetbuffer3.readItemStackFromBuffer(); + + if (itemstack1 != null) + { + if (!ItemWritableBook.isNBTValid(itemstack1.getTagCompound())) + { + throw new IOException("Invalid book tag!"); + } + + ItemStack itemstack3 = this.playerEntity.inventory.getCurrentItem(); + + if (itemstack3 == null) + { + return; + } + + if (itemstack1.getItem() == Items.writable_book && itemstack1.getItem() == itemstack3.getItem()) + { + itemstack3.setTagInfo("pages", itemstack1.getTagCompound().getTagList("pages", 8)); + } + + return; + } + } + catch (Exception exception3) + { + logger.error((String)"Couldn\'t handle book info", (Throwable)exception3); + return; + } + finally + { + packetbuffer3.release(); + } + + return; + } + else if ("MC|BSign".equals(packetIn.getChannelName())) + { + PacketBuffer packetbuffer2 = new PacketBuffer(Unpooled.wrappedBuffer((ByteBuf)packetIn.getBufferData())); + + try + { + ItemStack itemstack = packetbuffer2.readItemStackFromBuffer(); + + if (itemstack != null) + { + if (!ItemEditableBook.validBookTagContents(itemstack.getTagCompound())) + { + throw new IOException("Invalid book tag!"); + } + + ItemStack itemstack2 = this.playerEntity.inventory.getCurrentItem(); + + if (itemstack2 == null) + { + return; + } + + if (itemstack.getItem() == Items.written_book && itemstack2.getItem() == Items.writable_book) + { + itemstack2.setTagInfo("author", new NBTTagString(this.playerEntity.getName())); + itemstack2.setTagInfo("title", new NBTTagString(itemstack.getTagCompound().getString("title"))); + itemstack2.setTagInfo("pages", itemstack.getTagCompound().getTagList("pages", 8)); + itemstack2.setItem(Items.written_book); + } + + return; + } + } + catch (Exception exception4) + { + logger.error((String)"Couldn\'t sign book", (Throwable)exception4); + return; + } + finally + { + packetbuffer2.release(); + } + + return; + } + else if ("MC|TrSel".equals(packetIn.getChannelName())) + { + try + { + int i = packetIn.getBufferData().readInt(); + Container container = this.playerEntity.openContainer; + + if (container instanceof ContainerMerchant) + { + ((ContainerMerchant)container).setCurrentRecipeIndex(i); + } + } + catch (Exception exception2) + { + logger.error((String)"Couldn\'t select trade", (Throwable)exception2); + } + } + else if ("MC|AdvCdm".equals(packetIn.getChannelName())) + { + if (!this.serverController.isCommandBlockEnabled()) + { + this.playerEntity.addChatMessage(new ChatComponentTranslation("advMode.notEnabled", new Object[0])); + } + else if (this.playerEntity.canCommandSenderUseCommand(2, "") && this.playerEntity.capabilities.isCreativeMode) + { + PacketBuffer packetbuffer = packetIn.getBufferData(); + + try + { + int j = packetbuffer.readByte(); + CommandBlockLogic commandblocklogic = null; + + if (j == 0) + { + TileEntity tileentity = this.playerEntity.worldObj.getTileEntity(new BlockPos(packetbuffer.readInt(), packetbuffer.readInt(), packetbuffer.readInt())); + + if (tileentity instanceof TileEntityCommandBlock) + { + commandblocklogic = ((TileEntityCommandBlock)tileentity).getCommandBlockLogic(); + } + } + else if (j == 1) + { + Entity entity = this.playerEntity.worldObj.getEntityByID(packetbuffer.readInt()); + + if (entity instanceof EntityMinecartCommandBlock) + { + commandblocklogic = ((EntityMinecartCommandBlock)entity).getCommandBlockLogic(); + } + } + + String s1 = packetbuffer.readStringFromBuffer(packetbuffer.readableBytes()); + boolean flag = packetbuffer.readBoolean(); + + if (commandblocklogic != null) + { + commandblocklogic.setCommand(s1); + commandblocklogic.setTrackOutput(flag); + + if (!flag) + { + commandblocklogic.setLastOutput((IChatComponent)null); + } + + commandblocklogic.updateCommand(); + this.playerEntity.addChatMessage(new ChatComponentTranslation("advMode.setCommand.success", new Object[] {s1})); + } + } + catch (Exception exception1) + { + logger.error((String)"Couldn\'t set command block", (Throwable)exception1); + } + finally + { + packetbuffer.release(); + } + } + else + { + this.playerEntity.addChatMessage(new ChatComponentTranslation("advMode.notAllowed", new Object[0])); + } + } + else if ("MC|Beacon".equals(packetIn.getChannelName())) + { + if (this.playerEntity.openContainer instanceof ContainerBeacon) + { + try + { + PacketBuffer packetbuffer1 = packetIn.getBufferData(); + int k = packetbuffer1.readInt(); + int l = packetbuffer1.readInt(); + ContainerBeacon containerbeacon = (ContainerBeacon)this.playerEntity.openContainer; + Slot slot = containerbeacon.getSlot(0); + + if (slot.getHasStack()) + { + slot.decrStackSize(1); + IInventory iinventory = containerbeacon.func_180611_e(); + iinventory.setField(1, k); + iinventory.setField(2, l); + iinventory.markDirty(); + } + } + catch (Exception exception) + { + logger.error((String)"Couldn\'t set beacon", (Throwable)exception); + } + } + } + else if ("MC|ItemName".equals(packetIn.getChannelName()) && this.playerEntity.openContainer instanceof ContainerRepair) + { + ContainerRepair containerrepair = (ContainerRepair)this.playerEntity.openContainer; + + if (packetIn.getBufferData() != null && packetIn.getBufferData().readableBytes() >= 1) + { + String s = ChatAllowedCharacters.filterAllowedCharacters(packetIn.getBufferData().readStringFromBuffer(32767)); + + if (s.length() <= 30) + { + containerrepair.updateItemName(s); + } + } + else + { + containerrepair.updateItemName(""); + } + } + } +} diff --git a/src/minecraft/net/minecraft/network/NettyCompressionDecoder.java b/src/minecraft/net/minecraft/network/NettyCompressionDecoder.java new file mode 100644 index 0000000..7596a28 --- /dev/null +++ b/src/minecraft/net/minecraft/network/NettyCompressionDecoder.java @@ -0,0 +1,61 @@ +package net.minecraft.network; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.ByteToMessageDecoder; +import io.netty.handler.codec.DecoderException; +import java.util.List; +import java.util.zip.DataFormatException; +import java.util.zip.Inflater; + +public class NettyCompressionDecoder extends ByteToMessageDecoder +{ + private final Inflater inflater; + private int treshold; + + public NettyCompressionDecoder(int treshold) + { + this.treshold = treshold; + this.inflater = new Inflater(); + } + + protected void decode(ChannelHandlerContext p_decode_1_, ByteBuf p_decode_2_, List p_decode_3_) throws DataFormatException, Exception + { + if (p_decode_2_.readableBytes() != 0) + { + PacketBuffer packetbuffer = new PacketBuffer(p_decode_2_); + int i = packetbuffer.readVarIntFromBuffer(); + + if (i == 0) + { + p_decode_3_.add(packetbuffer.readBytes(packetbuffer.readableBytes())); + } + else + { + if (i < this.treshold) + { + throw new DecoderException("Badly compressed packet - size of " + i + " is below server threshold of " + this.treshold); + } + + if (i > 2097152) + { + throw new DecoderException("Badly compressed packet - size of " + i + " is larger than protocol maximum of " + 2097152); + } + + byte[] abyte = new byte[packetbuffer.readableBytes()]; + packetbuffer.readBytes(abyte); + this.inflater.setInput(abyte); + byte[] abyte1 = new byte[i]; + this.inflater.inflate(abyte1); + p_decode_3_.add(Unpooled.wrappedBuffer(abyte1)); + this.inflater.reset(); + } + } + } + + public void setCompressionTreshold(int treshold) + { + this.treshold = treshold; + } +} diff --git a/src/minecraft/net/minecraft/network/NettyCompressionEncoder.java b/src/minecraft/net/minecraft/network/NettyCompressionEncoder.java new file mode 100644 index 0000000..8aca97f --- /dev/null +++ b/src/minecraft/net/minecraft/network/NettyCompressionEncoder.java @@ -0,0 +1,52 @@ +package net.minecraft.network; + +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToByteEncoder; +import java.util.zip.Deflater; + +public class NettyCompressionEncoder extends MessageToByteEncoder +{ + private final byte[] buffer = new byte[8192]; + private final Deflater deflater; + private int treshold; + + public NettyCompressionEncoder(int treshold) + { + this.treshold = treshold; + this.deflater = new Deflater(); + } + + protected void encode(ChannelHandlerContext p_encode_1_, ByteBuf p_encode_2_, ByteBuf p_encode_3_) throws Exception + { + int i = p_encode_2_.readableBytes(); + PacketBuffer packetbuffer = new PacketBuffer(p_encode_3_); + + if (i < this.treshold) + { + packetbuffer.writeVarIntToBuffer(0); + packetbuffer.writeBytes(p_encode_2_); + } + else + { + byte[] abyte = new byte[i]; + p_encode_2_.readBytes(abyte); + packetbuffer.writeVarIntToBuffer(abyte.length); + this.deflater.setInput(abyte, 0, i); + this.deflater.finish(); + + while (!this.deflater.finished()) + { + int j = this.deflater.deflate(this.buffer); + packetbuffer.writeBytes((byte[])this.buffer, 0, j); + } + + this.deflater.reset(); + } + } + + public void setCompressionTreshold(int treshold) + { + this.treshold = treshold; + } +} diff --git a/src/minecraft/net/minecraft/network/NettyEncryptingDecoder.java b/src/minecraft/net/minecraft/network/NettyEncryptingDecoder.java new file mode 100644 index 0000000..11bab63 --- /dev/null +++ b/src/minecraft/net/minecraft/network/NettyEncryptingDecoder.java @@ -0,0 +1,23 @@ +package net.minecraft.network; + +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToMessageDecoder; +import java.util.List; +import javax.crypto.Cipher; +import javax.crypto.ShortBufferException; + +public class NettyEncryptingDecoder extends MessageToMessageDecoder +{ + private final NettyEncryptionTranslator decryptionCodec; + + public NettyEncryptingDecoder(Cipher cipher) + { + this.decryptionCodec = new NettyEncryptionTranslator(cipher); + } + + protected void decode(ChannelHandlerContext p_decode_1_, ByteBuf p_decode_2_, List p_decode_3_) throws ShortBufferException, Exception + { + p_decode_3_.add(this.decryptionCodec.decipher(p_decode_1_, p_decode_2_)); + } +} diff --git a/src/minecraft/net/minecraft/network/NettyEncryptingEncoder.java b/src/minecraft/net/minecraft/network/NettyEncryptingEncoder.java new file mode 100644 index 0000000..e4ec004 --- /dev/null +++ b/src/minecraft/net/minecraft/network/NettyEncryptingEncoder.java @@ -0,0 +1,22 @@ +package net.minecraft.network; + +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToByteEncoder; +import javax.crypto.Cipher; +import javax.crypto.ShortBufferException; + +public class NettyEncryptingEncoder extends MessageToByteEncoder +{ + private final NettyEncryptionTranslator encryptionCodec; + + public NettyEncryptingEncoder(Cipher cipher) + { + this.encryptionCodec = new NettyEncryptionTranslator(cipher); + } + + protected void encode(ChannelHandlerContext p_encode_1_, ByteBuf p_encode_2_, ByteBuf p_encode_3_) throws ShortBufferException, Exception + { + this.encryptionCodec.cipher(p_encode_2_, p_encode_3_); + } +} diff --git a/src/minecraft/net/minecraft/network/NettyEncryptionTranslator.java b/src/minecraft/net/minecraft/network/NettyEncryptionTranslator.java new file mode 100644 index 0000000..633d385 --- /dev/null +++ b/src/minecraft/net/minecraft/network/NettyEncryptionTranslator.java @@ -0,0 +1,54 @@ +package net.minecraft.network; + +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import javax.crypto.Cipher; +import javax.crypto.ShortBufferException; + +public class NettyEncryptionTranslator +{ + private final Cipher cipher; + private byte[] field_150505_b = new byte[0]; + private byte[] field_150506_c = new byte[0]; + + protected NettyEncryptionTranslator(Cipher cipherIn) + { + this.cipher = cipherIn; + } + + private byte[] func_150502_a(ByteBuf p_150502_1_) + { + int i = p_150502_1_.readableBytes(); + + if (this.field_150505_b.length < i) + { + this.field_150505_b = new byte[i]; + } + + p_150502_1_.readBytes((byte[])this.field_150505_b, 0, i); + return this.field_150505_b; + } + + protected ByteBuf decipher(ChannelHandlerContext ctx, ByteBuf buffer) throws ShortBufferException + { + int i = buffer.readableBytes(); + byte[] abyte = this.func_150502_a(buffer); + ByteBuf bytebuf = ctx.alloc().heapBuffer(this.cipher.getOutputSize(i)); + bytebuf.writerIndex(this.cipher.update(abyte, 0, i, bytebuf.array(), bytebuf.arrayOffset())); + return bytebuf; + } + + protected void cipher(ByteBuf p_150504_1_, ByteBuf p_150504_2_) throws ShortBufferException + { + int i = p_150504_1_.readableBytes(); + byte[] abyte = this.func_150502_a(p_150504_1_); + int j = this.cipher.getOutputSize(i); + + if (this.field_150506_c.length < j) + { + this.field_150506_c = new byte[j]; + } + + p_150504_2_.writeBytes((byte[])this.field_150506_c, 0, this.cipher.update(abyte, 0, i, this.field_150506_c)); + } +} diff --git a/src/minecraft/net/minecraft/network/NetworkManager.java b/src/minecraft/net/minecraft/network/NetworkManager.java new file mode 100644 index 0000000..9349d37 --- /dev/null +++ b/src/minecraft/net/minecraft/network/NetworkManager.java @@ -0,0 +1,518 @@ +package net.minecraft.network; + +import com.google.common.collect.Queues; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import io.netty.bootstrap.Bootstrap; +import io.netty.channel.Channel; +import io.netty.channel.ChannelException; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelFutureListener; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.channel.epoll.Epoll; +import io.netty.channel.epoll.EpollEventLoopGroup; +import io.netty.channel.epoll.EpollSocketChannel; +import io.netty.channel.local.LocalChannel; +import io.netty.channel.local.LocalEventLoopGroup; +import io.netty.channel.local.LocalServerChannel; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioSocketChannel; +import io.netty.handler.timeout.ReadTimeoutHandler; +import io.netty.handler.timeout.TimeoutException; +import io.netty.util.AttributeKey; +import io.netty.util.concurrent.Future; +import io.netty.util.concurrent.GenericFutureListener; +import java.net.InetAddress; +import java.net.SocketAddress; +import java.util.Queue; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import javax.crypto.SecretKey; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.CryptManager; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ITickable; +import net.minecraft.util.LazyLoadBase; +import net.minecraft.util.MessageDeserializer; +import net.minecraft.util.MessageDeserializer2; +import net.minecraft.util.MessageSerializer; +import net.minecraft.util.MessageSerializer2; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.Validate; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.MarkerManager; + +public class NetworkManager extends SimpleChannelInboundHandler +{ + private static final Logger logger = LogManager.getLogger(); + public static final Marker logMarkerNetwork = MarkerManager.getMarker("NETWORK"); + public static final Marker logMarkerPackets = MarkerManager.getMarker("NETWORK_PACKETS", logMarkerNetwork); + public static final AttributeKey attrKeyConnectionState = AttributeKey.valueOf("protocol"); + public static final LazyLoadBase CLIENT_NIO_EVENTLOOP = new LazyLoadBase() + { + protected NioEventLoopGroup load() + { + return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Client IO #%d").setDaemon(true).build()); + } + }; + public static final LazyLoadBase field_181125_e = new LazyLoadBase() + { + protected EpollEventLoopGroup load() + { + return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Client IO #%d").setDaemon(true).build()); + } + }; + public static final LazyLoadBase CLIENT_LOCAL_EVENTLOOP = new LazyLoadBase() + { + protected LocalEventLoopGroup load() + { + return new LocalEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Client IO #%d").setDaemon(true).build()); + } + }; + private final EnumPacketDirection direction; + private final Queue outboundPacketsQueue = Queues.newConcurrentLinkedQueue(); + private final ReentrantReadWriteLock field_181680_j = new ReentrantReadWriteLock(); + + /** The active channel */ + private Channel channel; + + /** The address of the remote party */ + private SocketAddress socketAddress; + + /** The INetHandler instance responsible for processing received packets */ + private INetHandler packetListener; + + /** A String indicating why the network has shutdown. */ + private IChatComponent terminationReason; + private boolean isEncrypted; + private boolean disconnected; + + public NetworkManager(EnumPacketDirection packetDirection) + { + this.direction = packetDirection; + } + + public void channelActive(ChannelHandlerContext p_channelActive_1_) throws Exception + { + super.channelActive(p_channelActive_1_); + this.channel = p_channelActive_1_.channel(); + this.socketAddress = this.channel.remoteAddress(); + + try + { + this.setConnectionState(EnumConnectionState.HANDSHAKING); + } + catch (Throwable throwable) + { + logger.fatal((Object)throwable); + } + } + + /** + * Sets the new connection state and registers which packets this channel may send and receive + */ + public void setConnectionState(EnumConnectionState newState) + { + this.channel.attr(attrKeyConnectionState).set(newState); + this.channel.config().setAutoRead(true); + logger.debug("Enabled auto read"); + } + + public void channelInactive(ChannelHandlerContext p_channelInactive_1_) throws Exception + { + this.closeChannel(new ChatComponentTranslation("disconnect.endOfStream", new Object[0])); + } + + public void exceptionCaught(ChannelHandlerContext p_exceptionCaught_1_, Throwable p_exceptionCaught_2_) throws Exception + { + ChatComponentTranslation chatcomponenttranslation; + + if (p_exceptionCaught_2_ instanceof TimeoutException) + { + chatcomponenttranslation = new ChatComponentTranslation("disconnect.timeout", new Object[0]); + } + else + { + chatcomponenttranslation = new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Internal Exception: " + p_exceptionCaught_2_}); + } + + this.closeChannel(chatcomponenttranslation); + } + + protected void channelRead0(ChannelHandlerContext p_channelRead0_1_, Packet p_channelRead0_2_) throws Exception + { + if (this.channel.isOpen()) + { + try + { + p_channelRead0_2_.processPacket(this.packetListener); + } + catch (ThreadQuickExitException var4) + { + ; + } + } + } + + /** + * Sets the NetHandler for this NetworkManager, no checks are made if this handler is suitable for the particular + * connection state (protocol) + */ + public void setNetHandler(INetHandler handler) + { + Validate.notNull(handler, "packetListener", new Object[0]); + logger.debug("Set listener of {} to {}", new Object[] {this, handler}); + this.packetListener = handler; + } + + public void sendPacket(Packet packetIn) + { + if (this.isChannelOpen()) + { + this.flushOutboundQueue(); + this.dispatchPacket(packetIn, (GenericFutureListener > [])null); + } + else + { + this.field_181680_j.writeLock().lock(); + + try + { + this.outboundPacketsQueue.add(new NetworkManager.InboundHandlerTuplePacketListener(packetIn, (GenericFutureListener[])null)); + } + finally + { + this.field_181680_j.writeLock().unlock(); + } + } + } + + public void sendPacket(Packet packetIn, GenericFutureListener > listener, GenericFutureListener > ... listeners) + { + if (this.isChannelOpen()) + { + this.flushOutboundQueue(); + this.dispatchPacket(packetIn, (GenericFutureListener[])ArrayUtils.add(listeners, 0, listener)); + } + else + { + this.field_181680_j.writeLock().lock(); + + try + { + this.outboundPacketsQueue.add(new NetworkManager.InboundHandlerTuplePacketListener(packetIn, (GenericFutureListener[])ArrayUtils.add(listeners, 0, listener))); + } + finally + { + this.field_181680_j.writeLock().unlock(); + } + } + } + + /** + * Will commit the packet to the channel. If the current thread 'owns' the channel it will write and flush the + * packet, otherwise it will add a task for the channel eventloop thread to do that. + */ + private void dispatchPacket(final Packet inPacket, final GenericFutureListener > [] futureListeners) + { + final EnumConnectionState enumconnectionstate = EnumConnectionState.getFromPacket(inPacket); + final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.channel.attr(attrKeyConnectionState).get(); + + if (enumconnectionstate1 != enumconnectionstate) + { + logger.debug("Disabled auto read"); + this.channel.config().setAutoRead(false); + } + + if (this.channel.eventLoop().inEventLoop()) + { + if (enumconnectionstate != enumconnectionstate1) + { + this.setConnectionState(enumconnectionstate); + } + + ChannelFuture channelfuture = this.channel.writeAndFlush(inPacket); + + if (futureListeners != null) + { + channelfuture.addListeners(futureListeners); + } + + channelfuture.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); + } + else + { + this.channel.eventLoop().execute(new Runnable() + { + public void run() + { + if (enumconnectionstate != enumconnectionstate1) + { + NetworkManager.this.setConnectionState(enumconnectionstate); + } + + ChannelFuture channelfuture1 = NetworkManager.this.channel.writeAndFlush(inPacket); + + if (futureListeners != null) + { + channelfuture1.addListeners(futureListeners); + } + + channelfuture1.addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE); + } + }); + } + } + + /** + * Will iterate through the outboundPacketQueue and dispatch all Packets + */ + private void flushOutboundQueue() + { + if (this.channel != null && this.channel.isOpen()) + { + this.field_181680_j.readLock().lock(); + + try + { + while (!this.outboundPacketsQueue.isEmpty()) + { + NetworkManager.InboundHandlerTuplePacketListener networkmanager$inboundhandlertuplepacketlistener = (NetworkManager.InboundHandlerTuplePacketListener)this.outboundPacketsQueue.poll(); + this.dispatchPacket(networkmanager$inboundhandlertuplepacketlistener.packet, networkmanager$inboundhandlertuplepacketlistener.futureListeners); + } + } + finally + { + this.field_181680_j.readLock().unlock(); + } + } + } + + /** + * Checks timeouts and processes all packets received + */ + public void processReceivedPackets() + { + this.flushOutboundQueue(); + + if (this.packetListener instanceof ITickable) + { + ((ITickable)this.packetListener).update(); + } + + this.channel.flush(); + } + + /** + * Returns the socket address of the remote side. Server-only. + */ + public SocketAddress getRemoteAddress() + { + return this.socketAddress; + } + + /** + * Closes the channel, the parameter can be used for an exit message (not certain how it gets sent) + */ + public void closeChannel(IChatComponent message) + { + if (this.channel.isOpen()) + { + this.channel.close().awaitUninterruptibly(); + this.terminationReason = message; + } + } + + /** + * True if this NetworkManager uses a memory connection (single player game). False may imply both an active TCP + * connection or simply no active connection at all + */ + public boolean isLocalChannel() + { + return this.channel instanceof LocalChannel || this.channel instanceof LocalServerChannel; + } + + public static NetworkManager func_181124_a(InetAddress p_181124_0_, int p_181124_1_, boolean p_181124_2_) + { + final NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.CLIENTBOUND); + Class oclass; + LazyLoadBase lazyloadbase; + + if (Epoll.isAvailable() && p_181124_2_) + { + oclass = EpollSocketChannel.class; + lazyloadbase = field_181125_e; + } + else + { + oclass = NioSocketChannel.class; + lazyloadbase = CLIENT_NIO_EVENTLOOP; + } + + ((Bootstrap)((Bootstrap)((Bootstrap)(new Bootstrap()).group((EventLoopGroup)lazyloadbase.getValue())).handler(new ChannelInitializer() + { + protected void initChannel(Channel p_initChannel_1_) throws Exception + { + try + { + p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true)); + } + catch (ChannelException var3) + { + ; + } + + p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.CLIENTBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"packet_handler", (ChannelHandler)networkmanager); + } + })).channel(oclass)).connect(p_181124_0_, p_181124_1_).syncUninterruptibly(); + return networkmanager; + } + + /** + * Prepares a clientside NetworkManager: establishes a connection to the socket supplied and configures the channel + * pipeline. Returns the newly created instance. + */ + public static NetworkManager provideLocalClient(SocketAddress address) + { + final NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.CLIENTBOUND); + ((Bootstrap)((Bootstrap)((Bootstrap)(new Bootstrap()).group((EventLoopGroup)CLIENT_LOCAL_EVENTLOOP.getValue())).handler(new ChannelInitializer() + { + protected void initChannel(Channel p_initChannel_1_) throws Exception + { + p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); + } + })).channel(LocalChannel.class)).connect(address).syncUninterruptibly(); + return networkmanager; + } + + /** + * Adds an encoder+decoder to the channel pipeline. The parameter is the secret key used for encrypted communication + */ + public void enableEncryption(SecretKey key) + { + this.isEncrypted = true; + this.channel.pipeline().addBefore("splitter", "decrypt", new NettyEncryptingDecoder(CryptManager.createNetCipherInstance(2, key))); + this.channel.pipeline().addBefore("prepender", "encrypt", new NettyEncryptingEncoder(CryptManager.createNetCipherInstance(1, key))); + } + + public boolean getIsencrypted() + { + return this.isEncrypted; + } + + /** + * Returns true if this NetworkManager has an active channel, false otherwise + */ + public boolean isChannelOpen() + { + return this.channel != null && this.channel.isOpen(); + } + + public boolean hasNoChannel() + { + return this.channel == null; + } + + /** + * Gets the current handler for processing packets + */ + public INetHandler getNetHandler() + { + return this.packetListener; + } + + /** + * If this channel is closed, returns the exit message, null otherwise. + */ + public IChatComponent getExitMessage() + { + return this.terminationReason; + } + + /** + * Switches the channel to manual reading modus + */ + public void disableAutoRead() + { + this.channel.config().setAutoRead(false); + } + + public void setCompressionTreshold(int treshold) + { + if (treshold >= 0) + { + if (this.channel.pipeline().get("decompress") instanceof NettyCompressionDecoder) + { + ((NettyCompressionDecoder)this.channel.pipeline().get("decompress")).setCompressionTreshold(treshold); + } + else + { + this.channel.pipeline().addBefore("decoder", "decompress", new NettyCompressionDecoder(treshold)); + } + + if (this.channel.pipeline().get("compress") instanceof NettyCompressionEncoder) + { + ((NettyCompressionEncoder)this.channel.pipeline().get("decompress")).setCompressionTreshold(treshold); + } + else + { + this.channel.pipeline().addBefore("encoder", "compress", new NettyCompressionEncoder(treshold)); + } + } + else + { + if (this.channel.pipeline().get("decompress") instanceof NettyCompressionDecoder) + { + this.channel.pipeline().remove("decompress"); + } + + if (this.channel.pipeline().get("compress") instanceof NettyCompressionEncoder) + { + this.channel.pipeline().remove("compress"); + } + } + } + + public void checkDisconnected() + { + if (this.channel != null && !this.channel.isOpen()) + { + if (!this.disconnected) + { + this.disconnected = true; + + if (this.getExitMessage() != null) + { + this.getNetHandler().onDisconnect(this.getExitMessage()); + } + else if (this.getNetHandler() != null) + { + this.getNetHandler().onDisconnect(new ChatComponentText("Disconnected")); + } + } + else + { + logger.warn("handleDisconnection() called twice"); + } + } + } + + static class InboundHandlerTuplePacketListener + { + private final Packet packet; + private final GenericFutureListener > [] futureListeners; + + public InboundHandlerTuplePacketListener(Packet inPacket, GenericFutureListener > ... inFutureListeners) + { + this.packet = inPacket; + this.futureListeners = inFutureListeners; + } + } +} diff --git a/src/minecraft/net/minecraft/network/NetworkSystem.java b/src/minecraft/net/minecraft/network/NetworkSystem.java new file mode 100644 index 0000000..bf12f45 --- /dev/null +++ b/src/minecraft/net/minecraft/network/NetworkSystem.java @@ -0,0 +1,242 @@ +package net.minecraft.network; + +import com.google.common.collect.Lists; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.Channel; +import io.netty.channel.ChannelException; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.epoll.Epoll; +import io.netty.channel.epoll.EpollEventLoopGroup; +import io.netty.channel.epoll.EpollServerSocketChannel; +import io.netty.channel.local.LocalAddress; +import io.netty.channel.local.LocalEventLoopGroup; +import io.netty.channel.local.LocalServerChannel; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.ServerSocketChannel; +import io.netty.channel.socket.nio.NioServerSocketChannel; +import io.netty.handler.timeout.ReadTimeoutHandler; +import io.netty.util.concurrent.Future; +import io.netty.util.concurrent.GenericFutureListener; +import java.io.IOException; +import java.net.InetAddress; +import java.net.SocketAddress; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.Callable; +import net.minecraft.client.network.NetHandlerHandshakeMemory; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.network.play.server.S40PacketDisconnect; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.network.NetHandlerHandshakeTCP; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.LazyLoadBase; +import net.minecraft.util.MessageDeserializer; +import net.minecraft.util.MessageDeserializer2; +import net.minecraft.util.MessageSerializer; +import net.minecraft.util.MessageSerializer2; +import net.minecraft.util.ReportedException; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class NetworkSystem +{ + private static final Logger logger = LogManager.getLogger(); + public static final LazyLoadBase eventLoops = new LazyLoadBase() + { + protected NioEventLoopGroup load() + { + return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).build()); + } + }; + public static final LazyLoadBase field_181141_b = new LazyLoadBase() + { + protected EpollEventLoopGroup load() + { + return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).build()); + } + }; + public static final LazyLoadBase SERVER_LOCAL_EVENTLOOP = new LazyLoadBase() + { + protected LocalEventLoopGroup load() + { + return new LocalEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Server IO #%d").setDaemon(true).build()); + } + }; + + /** Reference to the MinecraftServer object. */ + private final MinecraftServer mcServer; + + /** True if this NetworkSystem has never had his endpoints terminated */ + public volatile boolean isAlive; + private final List endpoints = Collections.synchronizedList(Lists.newArrayList()); + private final List networkManagers = Collections.synchronizedList(Lists.newArrayList()); + + public NetworkSystem(MinecraftServer server) + { + this.mcServer = server; + this.isAlive = true; + } + + /** + * Adds a channel that listens on publicly accessible network ports + */ + public void addLanEndpoint(InetAddress address, int port) throws IOException + { + synchronized (this.endpoints) + { + Class oclass; + LazyLoadBase lazyloadbase; + + if (Epoll.isAvailable() && this.mcServer.func_181035_ah()) + { + oclass = EpollServerSocketChannel.class; + lazyloadbase = field_181141_b; + logger.info("Using epoll channel type"); + } + else + { + oclass = NioServerSocketChannel.class; + lazyloadbase = eventLoops; + logger.info("Using default channel type"); + } + + this.endpoints.add(((ServerBootstrap)((ServerBootstrap)(new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer() + { + protected void initChannel(Channel p_initChannel_1_) throws Exception + { + try + { + p_initChannel_1_.config().setOption(ChannelOption.TCP_NODELAY, Boolean.valueOf(true)); + } + catch (ChannelException var3) + { + ; + } + + p_initChannel_1_.pipeline().addLast((String)"timeout", (ChannelHandler)(new ReadTimeoutHandler(30))).addLast((String)"legacy_query", (ChannelHandler)(new PingResponseHandler(NetworkSystem.this))).addLast((String)"splitter", (ChannelHandler)(new MessageDeserializer2())).addLast((String)"decoder", (ChannelHandler)(new MessageDeserializer(EnumPacketDirection.SERVERBOUND))).addLast((String)"prepender", (ChannelHandler)(new MessageSerializer2())).addLast((String)"encoder", (ChannelHandler)(new MessageSerializer(EnumPacketDirection.CLIENTBOUND))); + NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); + NetworkSystem.this.networkManagers.add(networkmanager); + p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); + networkmanager.setNetHandler(new NetHandlerHandshakeTCP(NetworkSystem.this.mcServer, networkmanager)); + } + }).group((EventLoopGroup)lazyloadbase.getValue()).localAddress(address, port)).bind().syncUninterruptibly()); + } + } + + /** + * Adds a channel that listens locally + */ + public SocketAddress addLocalEndpoint() + { + ChannelFuture channelfuture; + + synchronized (this.endpoints) + { + channelfuture = ((ServerBootstrap)((ServerBootstrap)(new ServerBootstrap()).channel(LocalServerChannel.class)).childHandler(new ChannelInitializer() + { + protected void initChannel(Channel p_initChannel_1_) throws Exception + { + NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND); + networkmanager.setNetHandler(new NetHandlerHandshakeMemory(NetworkSystem.this.mcServer, networkmanager)); + NetworkSystem.this.networkManagers.add(networkmanager); + p_initChannel_1_.pipeline().addLast((String)"packet_handler", (ChannelHandler)networkmanager); + } + }).group((EventLoopGroup)eventLoops.getValue()).localAddress(LocalAddress.ANY)).bind().syncUninterruptibly(); + this.endpoints.add(channelfuture); + } + + return channelfuture.channel().localAddress(); + } + + /** + * Shuts down all open endpoints (with immediate effect?) + */ + public void terminateEndpoints() + { + this.isAlive = false; + + for (ChannelFuture channelfuture : this.endpoints) + { + try + { + channelfuture.channel().close().sync(); + } + catch (InterruptedException var4) + { + logger.error("Interrupted whilst closing channel"); + } + } + } + + /** + * Will try to process the packets received by each NetworkManager, gracefully manage processing failures and cleans + * up dead connections + */ + public void networkTick() + { + synchronized (this.networkManagers) + { + Iterator iterator = this.networkManagers.iterator(); + + while (iterator.hasNext()) + { + final NetworkManager networkmanager = (NetworkManager)iterator.next(); + + if (!networkmanager.hasNoChannel()) + { + if (!networkmanager.isChannelOpen()) + { + iterator.remove(); + networkmanager.checkDisconnected(); + } + else + { + try + { + networkmanager.processReceivedPackets(); + } + catch (Exception exception) + { + if (networkmanager.isLocalChannel()) + { + CrashReport crashreport = CrashReport.makeCrashReport(exception, "Ticking memory connection"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Ticking connection"); + crashreportcategory.addCrashSectionCallable("Connection", new Callable() + { + public String call() throws Exception + { + return networkmanager.toString(); + } + }); + throw new ReportedException(crashreport); + } + + logger.warn((String)("Failed to handle packet for " + networkmanager.getRemoteAddress()), (Throwable)exception); + final ChatComponentText chatcomponenttext = new ChatComponentText("Internal server error"); + networkmanager.sendPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener < Future > () + { + public void operationComplete(Future p_operationComplete_1_) throws Exception + { + networkmanager.closeChannel(chatcomponenttext); + } + }, new GenericFutureListener[0]); + networkmanager.disableAutoRead(); + } + } + } + } + } + } + + public MinecraftServer getServer() + { + return this.mcServer; + } +} diff --git a/src/minecraft/net/minecraft/network/Packet.java b/src/minecraft/net/minecraft/network/Packet.java new file mode 100644 index 0000000..2448057 --- /dev/null +++ b/src/minecraft/net/minecraft/network/Packet.java @@ -0,0 +1,21 @@ +package net.minecraft.network; + +import java.io.IOException; + +public interface Packet +{ + /** + * Reads the raw packet data from the data stream. + */ + void readPacketData(PacketBuffer buf) throws IOException; + + /** + * Writes the raw packet data to the data stream. + */ + void writePacketData(PacketBuffer buf) throws IOException; + + /** + * Passes this Packet on to the NetHandler for processing. + */ + void processPacket(T handler); +} diff --git a/src/minecraft/net/minecraft/network/PacketBuffer.java b/src/minecraft/net/minecraft/network/PacketBuffer.java new file mode 100644 index 0000000..e30af25 --- /dev/null +++ b/src/minecraft/net/minecraft/network/PacketBuffer.java @@ -0,0 +1,1044 @@ +package net.minecraft.network; + +import com.google.common.base.Charsets; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufAllocator; +import io.netty.buffer.ByteBufInputStream; +import io.netty.buffer.ByteBufOutputStream; +import io.netty.buffer.ByteBufProcessor; +import io.netty.handler.codec.DecoderException; +import io.netty.handler.codec.EncoderException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.channels.GatheringByteChannel; +import java.nio.channels.ScatteringByteChannel; +import java.nio.charset.Charset; +import java.util.UUID; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTSizeTracker; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IChatComponent; + +public class PacketBuffer extends ByteBuf +{ + private final ByteBuf buf; + + public PacketBuffer(ByteBuf wrapped) + { + this.buf = wrapped; + } + + /** + * Calculates the number of bytes required to fit the supplied int (0-5) if it were to be read/written using + * readVarIntFromBuffer or writeVarIntToBuffer + */ + public static int getVarIntSize(int input) + { + for (int i = 1; i < 5; ++i) + { + if ((input & -1 << i * 7) == 0) + { + return i; + } + } + + return 5; + } + + public void writeByteArray(byte[] array) + { + this.writeVarIntToBuffer(array.length); + this.writeBytes(array); + } + + public byte[] readByteArray() + { + byte[] abyte = new byte[this.readVarIntFromBuffer()]; + this.readBytes(abyte); + return abyte; + } + + public BlockPos readBlockPos() + { + return BlockPos.fromLong(this.readLong()); + } + + public void writeBlockPos(BlockPos pos) + { + this.writeLong(pos.toLong()); + } + + public IChatComponent readChatComponent() throws IOException + { + return IChatComponent.Serializer.jsonToComponent(this.readStringFromBuffer(32767)); + } + + public void writeChatComponent(IChatComponent component) throws IOException + { + this.writeString(IChatComponent.Serializer.componentToJson(component)); + } + + public > T readEnumValue(Class enumClass) + { + return (T)((Enum[])enumClass.getEnumConstants())[this.readVarIntFromBuffer()]; + } + + public void writeEnumValue(Enum value) + { + this.writeVarIntToBuffer(value.ordinal()); + } + + /** + * Reads a compressed int from the buffer. To do so it maximally reads 5 byte-sized chunks whose most significant + * bit dictates whether another byte should be read. + */ + public int readVarIntFromBuffer() + { + int i = 0; + int j = 0; + + while (true) + { + byte b0 = this.readByte(); + i |= (b0 & 127) << j++ * 7; + + if (j > 5) + { + throw new RuntimeException("VarInt too big"); + } + + if ((b0 & 128) != 128) + { + break; + } + } + + return i; + } + + public long readVarLong() + { + long i = 0L; + int j = 0; + + while (true) + { + byte b0 = this.readByte(); + i |= (long)(b0 & 127) << j++ * 7; + + if (j > 10) + { + throw new RuntimeException("VarLong too big"); + } + + if ((b0 & 128) != 128) + { + break; + } + } + + return i; + } + + public void writeUuid(UUID uuid) + { + this.writeLong(uuid.getMostSignificantBits()); + this.writeLong(uuid.getLeastSignificantBits()); + } + + public UUID readUuid() + { + return new UUID(this.readLong(), this.readLong()); + } + + /** + * Writes a compressed int to the buffer. The smallest number of bytes to fit the passed int will be written. Of + * each such byte only 7 bits will be used to describe the actual value since its most significant bit dictates + * whether the next byte is part of that same int. Micro-optimization for int values that are expected to have + * values below 128. + */ + public void writeVarIntToBuffer(int input) + { + while ((input & -128) != 0) + { + this.writeByte(input & 127 | 128); + input >>>= 7; + } + + this.writeByte(input); + } + + public void writeVarLong(long value) + { + while ((value & -128L) != 0L) + { + this.writeByte((int)(value & 127L) | 128); + value >>>= 7; + } + + this.writeByte((int)value); + } + + /** + * Writes a compressed NBTTagCompound to this buffer + */ + public void writeNBTTagCompoundToBuffer(NBTTagCompound nbt) + { + if (nbt == null) + { + this.writeByte(0); + } + else + { + try + { + CompressedStreamTools.write(nbt, new ByteBufOutputStream(this)); + } + catch (IOException ioexception) + { + throw new EncoderException(ioexception); + } + } + } + + /** + * Reads a compressed NBTTagCompound from this buffer + */ + public NBTTagCompound readNBTTagCompoundFromBuffer() throws IOException + { + int i = this.readerIndex(); + byte b0 = this.readByte(); + + if (b0 == 0) + { + return null; + } + else + { + this.readerIndex(i); + return CompressedStreamTools.read(new ByteBufInputStream(this), new NBTSizeTracker(2097152L)); + } + } + + /** + * Writes the ItemStack's ID (short), then size (byte), then damage. (short) + */ + public void writeItemStackToBuffer(ItemStack stack) + { + if (stack == null) + { + this.writeShort(-1); + } + else + { + this.writeShort(Item.getIdFromItem(stack.getItem())); + this.writeByte(stack.stackSize); + this.writeShort(stack.getMetadata()); + NBTTagCompound nbttagcompound = null; + + if (stack.getItem().isDamageable() || stack.getItem().getShareTag()) + { + nbttagcompound = stack.getTagCompound(); + } + + this.writeNBTTagCompoundToBuffer(nbttagcompound); + } + } + + /** + * Reads an ItemStack from this buffer + */ + public ItemStack readItemStackFromBuffer() throws IOException + { + ItemStack itemstack = null; + int i = this.readShort(); + + if (i >= 0) + { + int j = this.readByte(); + int k = this.readShort(); + itemstack = new ItemStack(Item.getItemById(i), j, k); + itemstack.setTagCompound(this.readNBTTagCompoundFromBuffer()); + } + + return itemstack; + } + + /** + * Reads a string from this buffer. Expected parameter is maximum allowed string length. Will throw IOException if + * string length exceeds this value! + */ + public String readStringFromBuffer(int maxLength) + { + int i = this.readVarIntFromBuffer(); + + if (i > maxLength * 4) + { + throw new DecoderException("The received encoded string buffer length is longer than maximum allowed (" + i + " > " + maxLength * 4 + ")"); + } + else if (i < 0) + { + throw new DecoderException("The received encoded string buffer length is less than zero! Weird string!"); + } + else + { + String s = new String(this.readBytes(i).array(), Charsets.UTF_8); + + if (s.length() > maxLength) + { + throw new DecoderException("The received string length is longer than maximum allowed (" + i + " > " + maxLength + ")"); + } + else + { + return s; + } + } + } + + public PacketBuffer writeString(String string) + { + byte[] abyte = string.getBytes(Charsets.UTF_8); + + if (abyte.length > 32767) + { + throw new EncoderException("String too big (was " + string.length() + " bytes encoded, max " + 32767 + ")"); + } + else + { + this.writeVarIntToBuffer(abyte.length); + this.writeBytes(abyte); + return this; + } + } + + public int capacity() + { + return this.buf.capacity(); + } + + public ByteBuf capacity(int p_capacity_1_) + { + return this.buf.capacity(p_capacity_1_); + } + + public int maxCapacity() + { + return this.buf.maxCapacity(); + } + + public ByteBufAllocator alloc() + { + return this.buf.alloc(); + } + + public ByteOrder order() + { + return this.buf.order(); + } + + public ByteBuf order(ByteOrder p_order_1_) + { + return this.buf.order(p_order_1_); + } + + public ByteBuf unwrap() + { + return this.buf.unwrap(); + } + + public boolean isDirect() + { + return this.buf.isDirect(); + } + + public int readerIndex() + { + return this.buf.readerIndex(); + } + + public ByteBuf readerIndex(int p_readerIndex_1_) + { + return this.buf.readerIndex(p_readerIndex_1_); + } + + public int writerIndex() + { + return this.buf.writerIndex(); + } + + public ByteBuf writerIndex(int p_writerIndex_1_) + { + return this.buf.writerIndex(p_writerIndex_1_); + } + + public ByteBuf setIndex(int p_setIndex_1_, int p_setIndex_2_) + { + return this.buf.setIndex(p_setIndex_1_, p_setIndex_2_); + } + + public int readableBytes() + { + return this.buf.readableBytes(); + } + + public int writableBytes() + { + return this.buf.writableBytes(); + } + + public int maxWritableBytes() + { + return this.buf.maxWritableBytes(); + } + + public boolean isReadable() + { + return this.buf.isReadable(); + } + + public boolean isReadable(int p_isReadable_1_) + { + return this.buf.isReadable(p_isReadable_1_); + } + + public boolean isWritable() + { + return this.buf.isWritable(); + } + + public boolean isWritable(int p_isWritable_1_) + { + return this.buf.isWritable(p_isWritable_1_); + } + + public ByteBuf clear() + { + return this.buf.clear(); + } + + public ByteBuf markReaderIndex() + { + return this.buf.markReaderIndex(); + } + + public ByteBuf resetReaderIndex() + { + return this.buf.resetReaderIndex(); + } + + public ByteBuf markWriterIndex() + { + return this.buf.markWriterIndex(); + } + + public ByteBuf resetWriterIndex() + { + return this.buf.resetWriterIndex(); + } + + public ByteBuf discardReadBytes() + { + return this.buf.discardReadBytes(); + } + + public ByteBuf discardSomeReadBytes() + { + return this.buf.discardSomeReadBytes(); + } + + public ByteBuf ensureWritable(int p_ensureWritable_1_) + { + return this.buf.ensureWritable(p_ensureWritable_1_); + } + + public int ensureWritable(int p_ensureWritable_1_, boolean p_ensureWritable_2_) + { + return this.buf.ensureWritable(p_ensureWritable_1_, p_ensureWritable_2_); + } + + public boolean getBoolean(int p_getBoolean_1_) + { + return this.buf.getBoolean(p_getBoolean_1_); + } + + public byte getByte(int p_getByte_1_) + { + return this.buf.getByte(p_getByte_1_); + } + + public short getUnsignedByte(int p_getUnsignedByte_1_) + { + return this.buf.getUnsignedByte(p_getUnsignedByte_1_); + } + + public short getShort(int p_getShort_1_) + { + return this.buf.getShort(p_getShort_1_); + } + + public int getUnsignedShort(int p_getUnsignedShort_1_) + { + return this.buf.getUnsignedShort(p_getUnsignedShort_1_); + } + + public int getMedium(int p_getMedium_1_) + { + return this.buf.getMedium(p_getMedium_1_); + } + + public int getUnsignedMedium(int p_getUnsignedMedium_1_) + { + return this.buf.getUnsignedMedium(p_getUnsignedMedium_1_); + } + + public int getInt(int p_getInt_1_) + { + return this.buf.getInt(p_getInt_1_); + } + + public long getUnsignedInt(int p_getUnsignedInt_1_) + { + return this.buf.getUnsignedInt(p_getUnsignedInt_1_); + } + + public long getLong(int p_getLong_1_) + { + return this.buf.getLong(p_getLong_1_); + } + + public char getChar(int p_getChar_1_) + { + return this.buf.getChar(p_getChar_1_); + } + + public float getFloat(int p_getFloat_1_) + { + return this.buf.getFloat(p_getFloat_1_); + } + + public double getDouble(int p_getDouble_1_) + { + return this.buf.getDouble(p_getDouble_1_); + } + + public ByteBuf getBytes(int p_getBytes_1_, ByteBuf p_getBytes_2_) + { + return this.buf.getBytes(p_getBytes_1_, p_getBytes_2_); + } + + public ByteBuf getBytes(int p_getBytes_1_, ByteBuf p_getBytes_2_, int p_getBytes_3_) + { + return this.buf.getBytes(p_getBytes_1_, p_getBytes_2_, p_getBytes_3_); + } + + public ByteBuf getBytes(int p_getBytes_1_, ByteBuf p_getBytes_2_, int p_getBytes_3_, int p_getBytes_4_) + { + return this.buf.getBytes(p_getBytes_1_, p_getBytes_2_, p_getBytes_3_, p_getBytes_4_); + } + + public ByteBuf getBytes(int p_getBytes_1_, byte[] p_getBytes_2_) + { + return this.buf.getBytes(p_getBytes_1_, p_getBytes_2_); + } + + public ByteBuf getBytes(int p_getBytes_1_, byte[] p_getBytes_2_, int p_getBytes_3_, int p_getBytes_4_) + { + return this.buf.getBytes(p_getBytes_1_, p_getBytes_2_, p_getBytes_3_, p_getBytes_4_); + } + + public ByteBuf getBytes(int p_getBytes_1_, ByteBuffer p_getBytes_2_) + { + return this.buf.getBytes(p_getBytes_1_, p_getBytes_2_); + } + + public ByteBuf getBytes(int p_getBytes_1_, OutputStream p_getBytes_2_, int p_getBytes_3_) throws IOException + { + return this.buf.getBytes(p_getBytes_1_, p_getBytes_2_, p_getBytes_3_); + } + + public int getBytes(int p_getBytes_1_, GatheringByteChannel p_getBytes_2_, int p_getBytes_3_) throws IOException + { + return this.buf.getBytes(p_getBytes_1_, p_getBytes_2_, p_getBytes_3_); + } + + public ByteBuf setBoolean(int p_setBoolean_1_, boolean p_setBoolean_2_) + { + return this.buf.setBoolean(p_setBoolean_1_, p_setBoolean_2_); + } + + public ByteBuf setByte(int p_setByte_1_, int p_setByte_2_) + { + return this.buf.setByte(p_setByte_1_, p_setByte_2_); + } + + public ByteBuf setShort(int p_setShort_1_, int p_setShort_2_) + { + return this.buf.setShort(p_setShort_1_, p_setShort_2_); + } + + public ByteBuf setMedium(int p_setMedium_1_, int p_setMedium_2_) + { + return this.buf.setMedium(p_setMedium_1_, p_setMedium_2_); + } + + public ByteBuf setInt(int p_setInt_1_, int p_setInt_2_) + { + return this.buf.setInt(p_setInt_1_, p_setInt_2_); + } + + public ByteBuf setLong(int p_setLong_1_, long p_setLong_2_) + { + return this.buf.setLong(p_setLong_1_, p_setLong_2_); + } + + public ByteBuf setChar(int p_setChar_1_, int p_setChar_2_) + { + return this.buf.setChar(p_setChar_1_, p_setChar_2_); + } + + public ByteBuf setFloat(int p_setFloat_1_, float p_setFloat_2_) + { + return this.buf.setFloat(p_setFloat_1_, p_setFloat_2_); + } + + public ByteBuf setDouble(int p_setDouble_1_, double p_setDouble_2_) + { + return this.buf.setDouble(p_setDouble_1_, p_setDouble_2_); + } + + public ByteBuf setBytes(int p_setBytes_1_, ByteBuf p_setBytes_2_) + { + return this.buf.setBytes(p_setBytes_1_, p_setBytes_2_); + } + + public ByteBuf setBytes(int p_setBytes_1_, ByteBuf p_setBytes_2_, int p_setBytes_3_) + { + return this.buf.setBytes(p_setBytes_1_, p_setBytes_2_, p_setBytes_3_); + } + + public ByteBuf setBytes(int p_setBytes_1_, ByteBuf p_setBytes_2_, int p_setBytes_3_, int p_setBytes_4_) + { + return this.buf.setBytes(p_setBytes_1_, p_setBytes_2_, p_setBytes_3_, p_setBytes_4_); + } + + public ByteBuf setBytes(int p_setBytes_1_, byte[] p_setBytes_2_) + { + return this.buf.setBytes(p_setBytes_1_, p_setBytes_2_); + } + + public ByteBuf setBytes(int p_setBytes_1_, byte[] p_setBytes_2_, int p_setBytes_3_, int p_setBytes_4_) + { + return this.buf.setBytes(p_setBytes_1_, p_setBytes_2_, p_setBytes_3_, p_setBytes_4_); + } + + public ByteBuf setBytes(int p_setBytes_1_, ByteBuffer p_setBytes_2_) + { + return this.buf.setBytes(p_setBytes_1_, p_setBytes_2_); + } + + public int setBytes(int p_setBytes_1_, InputStream p_setBytes_2_, int p_setBytes_3_) throws IOException + { + return this.buf.setBytes(p_setBytes_1_, p_setBytes_2_, p_setBytes_3_); + } + + public int setBytes(int p_setBytes_1_, ScatteringByteChannel p_setBytes_2_, int p_setBytes_3_) throws IOException + { + return this.buf.setBytes(p_setBytes_1_, p_setBytes_2_, p_setBytes_3_); + } + + public ByteBuf setZero(int p_setZero_1_, int p_setZero_2_) + { + return this.buf.setZero(p_setZero_1_, p_setZero_2_); + } + + public boolean readBoolean() + { + return this.buf.readBoolean(); + } + + public byte readByte() + { + return this.buf.readByte(); + } + + public short readUnsignedByte() + { + return this.buf.readUnsignedByte(); + } + + public short readShort() + { + return this.buf.readShort(); + } + + public int readUnsignedShort() + { + return this.buf.readUnsignedShort(); + } + + public int readMedium() + { + return this.buf.readMedium(); + } + + public int readUnsignedMedium() + { + return this.buf.readUnsignedMedium(); + } + + public int readInt() + { + return this.buf.readInt(); + } + + public long readUnsignedInt() + { + return this.buf.readUnsignedInt(); + } + + public long readLong() + { + return this.buf.readLong(); + } + + public char readChar() + { + return this.buf.readChar(); + } + + public float readFloat() + { + return this.buf.readFloat(); + } + + public double readDouble() + { + return this.buf.readDouble(); + } + + public ByteBuf readBytes(int p_readBytes_1_) + { + return this.buf.readBytes(p_readBytes_1_); + } + + public ByteBuf readSlice(int p_readSlice_1_) + { + return this.buf.readSlice(p_readSlice_1_); + } + + public ByteBuf readBytes(ByteBuf p_readBytes_1_) + { + return this.buf.readBytes(p_readBytes_1_); + } + + public ByteBuf readBytes(ByteBuf p_readBytes_1_, int p_readBytes_2_) + { + return this.buf.readBytes(p_readBytes_1_, p_readBytes_2_); + } + + public ByteBuf readBytes(ByteBuf p_readBytes_1_, int p_readBytes_2_, int p_readBytes_3_) + { + return this.buf.readBytes(p_readBytes_1_, p_readBytes_2_, p_readBytes_3_); + } + + public ByteBuf readBytes(byte[] p_readBytes_1_) + { + return this.buf.readBytes(p_readBytes_1_); + } + + public ByteBuf readBytes(byte[] p_readBytes_1_, int p_readBytes_2_, int p_readBytes_3_) + { + return this.buf.readBytes(p_readBytes_1_, p_readBytes_2_, p_readBytes_3_); + } + + public ByteBuf readBytes(ByteBuffer p_readBytes_1_) + { + return this.buf.readBytes(p_readBytes_1_); + } + + public ByteBuf readBytes(OutputStream p_readBytes_1_, int p_readBytes_2_) throws IOException + { + return this.buf.readBytes(p_readBytes_1_, p_readBytes_2_); + } + + public int readBytes(GatheringByteChannel p_readBytes_1_, int p_readBytes_2_) throws IOException + { + return this.buf.readBytes(p_readBytes_1_, p_readBytes_2_); + } + + public ByteBuf skipBytes(int p_skipBytes_1_) + { + return this.buf.skipBytes(p_skipBytes_1_); + } + + public ByteBuf writeBoolean(boolean p_writeBoolean_1_) + { + return this.buf.writeBoolean(p_writeBoolean_1_); + } + + public ByteBuf writeByte(int p_writeByte_1_) + { + return this.buf.writeByte(p_writeByte_1_); + } + + public ByteBuf writeShort(int p_writeShort_1_) + { + return this.buf.writeShort(p_writeShort_1_); + } + + public ByteBuf writeMedium(int p_writeMedium_1_) + { + return this.buf.writeMedium(p_writeMedium_1_); + } + + public ByteBuf writeInt(int p_writeInt_1_) + { + return this.buf.writeInt(p_writeInt_1_); + } + + public ByteBuf writeLong(long p_writeLong_1_) + { + return this.buf.writeLong(p_writeLong_1_); + } + + public ByteBuf writeChar(int p_writeChar_1_) + { + return this.buf.writeChar(p_writeChar_1_); + } + + public ByteBuf writeFloat(float p_writeFloat_1_) + { + return this.buf.writeFloat(p_writeFloat_1_); + } + + public ByteBuf writeDouble(double p_writeDouble_1_) + { + return this.buf.writeDouble(p_writeDouble_1_); + } + + public ByteBuf writeBytes(ByteBuf p_writeBytes_1_) + { + return this.buf.writeBytes(p_writeBytes_1_); + } + + public ByteBuf writeBytes(ByteBuf p_writeBytes_1_, int p_writeBytes_2_) + { + return this.buf.writeBytes(p_writeBytes_1_, p_writeBytes_2_); + } + + public ByteBuf writeBytes(ByteBuf p_writeBytes_1_, int p_writeBytes_2_, int p_writeBytes_3_) + { + return this.buf.writeBytes(p_writeBytes_1_, p_writeBytes_2_, p_writeBytes_3_); + } + + public ByteBuf writeBytes(byte[] p_writeBytes_1_) + { + return this.buf.writeBytes(p_writeBytes_1_); + } + + public ByteBuf writeBytes(byte[] p_writeBytes_1_, int p_writeBytes_2_, int p_writeBytes_3_) + { + return this.buf.writeBytes(p_writeBytes_1_, p_writeBytes_2_, p_writeBytes_3_); + } + + public ByteBuf writeBytes(ByteBuffer p_writeBytes_1_) + { + return this.buf.writeBytes(p_writeBytes_1_); + } + + public int writeBytes(InputStream p_writeBytes_1_, int p_writeBytes_2_) throws IOException + { + return this.buf.writeBytes(p_writeBytes_1_, p_writeBytes_2_); + } + + public int writeBytes(ScatteringByteChannel p_writeBytes_1_, int p_writeBytes_2_) throws IOException + { + return this.buf.writeBytes(p_writeBytes_1_, p_writeBytes_2_); + } + + public ByteBuf writeZero(int p_writeZero_1_) + { + return this.buf.writeZero(p_writeZero_1_); + } + + public int indexOf(int p_indexOf_1_, int p_indexOf_2_, byte p_indexOf_3_) + { + return this.buf.indexOf(p_indexOf_1_, p_indexOf_2_, p_indexOf_3_); + } + + public int bytesBefore(byte p_bytesBefore_1_) + { + return this.buf.bytesBefore(p_bytesBefore_1_); + } + + public int bytesBefore(int p_bytesBefore_1_, byte p_bytesBefore_2_) + { + return this.buf.bytesBefore(p_bytesBefore_1_, p_bytesBefore_2_); + } + + public int bytesBefore(int p_bytesBefore_1_, int p_bytesBefore_2_, byte p_bytesBefore_3_) + { + return this.buf.bytesBefore(p_bytesBefore_1_, p_bytesBefore_2_, p_bytesBefore_3_); + } + + public int forEachByte(ByteBufProcessor p_forEachByte_1_) + { + return this.buf.forEachByte(p_forEachByte_1_); + } + + public int forEachByte(int p_forEachByte_1_, int p_forEachByte_2_, ByteBufProcessor p_forEachByte_3_) + { + return this.buf.forEachByte(p_forEachByte_1_, p_forEachByte_2_, p_forEachByte_3_); + } + + public int forEachByteDesc(ByteBufProcessor p_forEachByteDesc_1_) + { + return this.buf.forEachByteDesc(p_forEachByteDesc_1_); + } + + public int forEachByteDesc(int p_forEachByteDesc_1_, int p_forEachByteDesc_2_, ByteBufProcessor p_forEachByteDesc_3_) + { + return this.buf.forEachByteDesc(p_forEachByteDesc_1_, p_forEachByteDesc_2_, p_forEachByteDesc_3_); + } + + public ByteBuf copy() + { + return this.buf.copy(); + } + + public ByteBuf copy(int p_copy_1_, int p_copy_2_) + { + return this.buf.copy(p_copy_1_, p_copy_2_); + } + + public ByteBuf slice() + { + return this.buf.slice(); + } + + public ByteBuf slice(int p_slice_1_, int p_slice_2_) + { + return this.buf.slice(p_slice_1_, p_slice_2_); + } + + public ByteBuf duplicate() + { + return this.buf.duplicate(); + } + + public int nioBufferCount() + { + return this.buf.nioBufferCount(); + } + + public ByteBuffer nioBuffer() + { + return this.buf.nioBuffer(); + } + + public ByteBuffer nioBuffer(int p_nioBuffer_1_, int p_nioBuffer_2_) + { + return this.buf.nioBuffer(p_nioBuffer_1_, p_nioBuffer_2_); + } + + public ByteBuffer internalNioBuffer(int p_internalNioBuffer_1_, int p_internalNioBuffer_2_) + { + return this.buf.internalNioBuffer(p_internalNioBuffer_1_, p_internalNioBuffer_2_); + } + + public ByteBuffer[] nioBuffers() + { + return this.buf.nioBuffers(); + } + + public ByteBuffer[] nioBuffers(int p_nioBuffers_1_, int p_nioBuffers_2_) + { + return this.buf.nioBuffers(p_nioBuffers_1_, p_nioBuffers_2_); + } + + public boolean hasArray() + { + return this.buf.hasArray(); + } + + public byte[] array() + { + return this.buf.array(); + } + + public int arrayOffset() + { + return this.buf.arrayOffset(); + } + + public boolean hasMemoryAddress() + { + return this.buf.hasMemoryAddress(); + } + + public long memoryAddress() + { + return this.buf.memoryAddress(); + } + + public String toString(Charset p_toString_1_) + { + return this.buf.toString(p_toString_1_); + } + + public String toString(int p_toString_1_, int p_toString_2_, Charset p_toString_3_) + { + return this.buf.toString(p_toString_1_, p_toString_2_, p_toString_3_); + } + + public int hashCode() + { + return this.buf.hashCode(); + } + + public boolean equals(Object p_equals_1_) + { + return this.buf.equals(p_equals_1_); + } + + public int compareTo(ByteBuf p_compareTo_1_) + { + return this.buf.compareTo(p_compareTo_1_); + } + + public String toString() + { + return this.buf.toString(); + } + + public ByteBuf retain(int p_retain_1_) + { + return this.buf.retain(p_retain_1_); + } + + public ByteBuf retain() + { + return this.buf.retain(); + } + + public int refCnt() + { + return this.buf.refCnt(); + } + + public boolean release() + { + return this.buf.release(); + } + + public boolean release(int p_release_1_) + { + return this.buf.release(p_release_1_); + } +} diff --git a/src/minecraft/net/minecraft/network/PacketThreadUtil.java b/src/minecraft/net/minecraft/network/PacketThreadUtil.java new file mode 100644 index 0000000..5613c73 --- /dev/null +++ b/src/minecraft/net/minecraft/network/PacketThreadUtil.java @@ -0,0 +1,21 @@ +package net.minecraft.network; + +import net.minecraft.util.IThreadListener; + +public class PacketThreadUtil +{ + public static void checkThreadAndEnqueue(final Packet p_180031_0_, final T p_180031_1_, IThreadListener p_180031_2_) throws ThreadQuickExitException + { + if (!p_180031_2_.isCallingFromMinecraftThread()) + { + p_180031_2_.addScheduledTask(new Runnable() + { + public void run() + { + p_180031_0_.processPacket(p_180031_1_); + } + }); + throw ThreadQuickExitException.field_179886_a; + } + } +} diff --git a/src/minecraft/net/minecraft/network/PingResponseHandler.java b/src/minecraft/net/minecraft/network/PingResponseHandler.java new file mode 100644 index 0000000..41e5efb --- /dev/null +++ b/src/minecraft/net/minecraft/network/PingResponseHandler.java @@ -0,0 +1,125 @@ +package net.minecraft.network; + +import com.google.common.base.Charsets; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.ChannelFutureListener; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInboundHandlerAdapter; +import java.net.InetSocketAddress; +import net.minecraft.server.MinecraftServer; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class PingResponseHandler extends ChannelInboundHandlerAdapter +{ + private static final Logger logger = LogManager.getLogger(); + private NetworkSystem networkSystem; + + public PingResponseHandler(NetworkSystem networkSystemIn) + { + this.networkSystem = networkSystemIn; + } + + public void channelRead(ChannelHandlerContext p_channelRead_1_, Object p_channelRead_2_) throws Exception + { + ByteBuf bytebuf = (ByteBuf)p_channelRead_2_; + bytebuf.markReaderIndex(); + boolean flag = true; + + try + { + if (bytebuf.readUnsignedByte() == 254) + { + InetSocketAddress inetsocketaddress = (InetSocketAddress)p_channelRead_1_.channel().remoteAddress(); + MinecraftServer minecraftserver = this.networkSystem.getServer(); + int i = bytebuf.readableBytes(); + + switch (i) + { + case 0: + logger.debug("Ping: (<1.3.x) from {}:{}", new Object[] {inetsocketaddress.getAddress(), Integer.valueOf(inetsocketaddress.getPort())}); + String s2 = String.format("%s\u00a7%d\u00a7%d", new Object[] {minecraftserver.getMOTD(), Integer.valueOf(minecraftserver.getCurrentPlayerCount()), Integer.valueOf(minecraftserver.getMaxPlayers())}); + this.writeAndFlush(p_channelRead_1_, this.getStringBuffer(s2)); + break; + + case 1: + if (bytebuf.readUnsignedByte() != 1) + { + return; + } + + logger.debug("Ping: (1.4-1.5.x) from {}:{}", new Object[] {inetsocketaddress.getAddress(), Integer.valueOf(inetsocketaddress.getPort())}); + String s = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] {Integer.valueOf(127), minecraftserver.getMinecraftVersion(), minecraftserver.getMOTD(), Integer.valueOf(minecraftserver.getCurrentPlayerCount()), Integer.valueOf(minecraftserver.getMaxPlayers())}); + this.writeAndFlush(p_channelRead_1_, this.getStringBuffer(s)); + break; + + default: + boolean flag1 = bytebuf.readUnsignedByte() == 1; + flag1 = flag1 & bytebuf.readUnsignedByte() == 250; + flag1 = flag1 & "MC|PingHost".equals(new String(bytebuf.readBytes(bytebuf.readShort() * 2).array(), Charsets.UTF_16BE)); + int j = bytebuf.readUnsignedShort(); + flag1 = flag1 & bytebuf.readUnsignedByte() >= 73; + flag1 = flag1 & 3 + bytebuf.readBytes(bytebuf.readShort() * 2).array().length + 4 == j; + flag1 = flag1 & bytebuf.readInt() <= 65535; + flag1 = flag1 & bytebuf.readableBytes() == 0; + + if (!flag1) + { + return; + } + + logger.debug("Ping: (1.6) from {}:{}", new Object[] {inetsocketaddress.getAddress(), Integer.valueOf(inetsocketaddress.getPort())}); + String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", new Object[] {Integer.valueOf(127), minecraftserver.getMinecraftVersion(), minecraftserver.getMOTD(), Integer.valueOf(minecraftserver.getCurrentPlayerCount()), Integer.valueOf(minecraftserver.getMaxPlayers())}); + ByteBuf bytebuf1 = this.getStringBuffer(s1); + + try + { + this.writeAndFlush(p_channelRead_1_, bytebuf1); + } + finally + { + bytebuf1.release(); + } + } + + bytebuf.release(); + flag = false; + return; + } + } + catch (RuntimeException var21) + { + return; + } + finally + { + if (flag) + { + bytebuf.resetReaderIndex(); + p_channelRead_1_.channel().pipeline().remove("legacy_query"); + p_channelRead_1_.fireChannelRead(p_channelRead_2_); + } + } + } + + private void writeAndFlush(ChannelHandlerContext ctx, ByteBuf data) + { + ctx.pipeline().firstContext().writeAndFlush(data).addListener(ChannelFutureListener.CLOSE); + } + + private ByteBuf getStringBuffer(String string) + { + ByteBuf bytebuf = Unpooled.buffer(); + bytebuf.writeByte(255); + char[] achar = string.toCharArray(); + bytebuf.writeShort(achar.length); + + for (char c0 : achar) + { + bytebuf.writeChar(c0); + } + + return bytebuf; + } +} diff --git a/src/minecraft/net/minecraft/network/ServerStatusResponse.java b/src/minecraft/net/minecraft/network/ServerStatusResponse.java new file mode 100644 index 0000000..ce19dc7 --- /dev/null +++ b/src/minecraft/net/minecraft/network/ServerStatusResponse.java @@ -0,0 +1,248 @@ +package net.minecraft.network; + +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.mojang.authlib.GameProfile; +import java.lang.reflect.Type; +import java.util.UUID; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.JsonUtils; + +public class ServerStatusResponse +{ + private IChatComponent serverMotd; + private ServerStatusResponse.PlayerCountData playerCount; + private ServerStatusResponse.MinecraftProtocolVersionIdentifier protocolVersion; + private String favicon; + + public IChatComponent getServerDescription() + { + return this.serverMotd; + } + + public void setServerDescription(IChatComponent motd) + { + this.serverMotd = motd; + } + + public ServerStatusResponse.PlayerCountData getPlayerCountData() + { + return this.playerCount; + } + + public void setPlayerCountData(ServerStatusResponse.PlayerCountData countData) + { + this.playerCount = countData; + } + + public ServerStatusResponse.MinecraftProtocolVersionIdentifier getProtocolVersionInfo() + { + return this.protocolVersion; + } + + public void setProtocolVersionInfo(ServerStatusResponse.MinecraftProtocolVersionIdentifier protocolVersionData) + { + this.protocolVersion = protocolVersionData; + } + + public void setFavicon(String faviconBlob) + { + this.favicon = faviconBlob; + } + + public String getFavicon() + { + return this.favicon; + } + + public static class MinecraftProtocolVersionIdentifier + { + private final String name; + private final int protocol; + + public MinecraftProtocolVersionIdentifier(String nameIn, int protocolIn) + { + this.name = nameIn; + this.protocol = protocolIn; + } + + public String getName() + { + return this.name; + } + + public int getProtocol() + { + return this.protocol; + } + + public static class Serializer implements JsonDeserializer, JsonSerializer + { + public ServerStatusResponse.MinecraftProtocolVersionIdentifier deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "version"); + return new ServerStatusResponse.MinecraftProtocolVersionIdentifier(JsonUtils.getString(jsonobject, "name"), JsonUtils.getInt(jsonobject, "protocol")); + } + + public JsonElement serialize(ServerStatusResponse.MinecraftProtocolVersionIdentifier p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) + { + JsonObject jsonobject = new JsonObject(); + jsonobject.addProperty("name", p_serialize_1_.getName()); + jsonobject.addProperty("protocol", (Number)Integer.valueOf(p_serialize_1_.getProtocol())); + return jsonobject; + } + } + } + + public static class PlayerCountData + { + private final int maxPlayers; + private final int onlinePlayerCount; + private GameProfile[] players; + + public PlayerCountData(int maxOnlinePlayers, int onlinePlayers) + { + this.maxPlayers = maxOnlinePlayers; + this.onlinePlayerCount = onlinePlayers; + } + + public int getMaxPlayers() + { + return this.maxPlayers; + } + + public int getOnlinePlayerCount() + { + return this.onlinePlayerCount; + } + + public GameProfile[] getPlayers() + { + return this.players; + } + + public void setPlayers(GameProfile[] playersIn) + { + this.players = playersIn; + } + + public static class Serializer implements JsonDeserializer, JsonSerializer + { + public ServerStatusResponse.PlayerCountData deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "players"); + ServerStatusResponse.PlayerCountData serverstatusresponse$playercountdata = new ServerStatusResponse.PlayerCountData(JsonUtils.getInt(jsonobject, "max"), JsonUtils.getInt(jsonobject, "online")); + + if (JsonUtils.isJsonArray(jsonobject, "sample")) + { + JsonArray jsonarray = JsonUtils.getJsonArray(jsonobject, "sample"); + + if (jsonarray.size() > 0) + { + GameProfile[] agameprofile = new GameProfile[jsonarray.size()]; + + for (int i = 0; i < agameprofile.length; ++i) + { + JsonObject jsonobject1 = JsonUtils.getJsonObject(jsonarray.get(i), "player[" + i + "]"); + String s = JsonUtils.getString(jsonobject1, "id"); + agameprofile[i] = new GameProfile(UUID.fromString(s), JsonUtils.getString(jsonobject1, "name")); + } + + serverstatusresponse$playercountdata.setPlayers(agameprofile); + } + } + + return serverstatusresponse$playercountdata; + } + + public JsonElement serialize(ServerStatusResponse.PlayerCountData p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) + { + JsonObject jsonobject = new JsonObject(); + jsonobject.addProperty("max", (Number)Integer.valueOf(p_serialize_1_.getMaxPlayers())); + jsonobject.addProperty("online", (Number)Integer.valueOf(p_serialize_1_.getOnlinePlayerCount())); + + if (p_serialize_1_.getPlayers() != null && p_serialize_1_.getPlayers().length > 0) + { + JsonArray jsonarray = new JsonArray(); + + for (int i = 0; i < p_serialize_1_.getPlayers().length; ++i) + { + JsonObject jsonobject1 = new JsonObject(); + UUID uuid = p_serialize_1_.getPlayers()[i].getId(); + jsonobject1.addProperty("id", uuid == null ? "" : uuid.toString()); + jsonobject1.addProperty("name", p_serialize_1_.getPlayers()[i].getName()); + jsonarray.add(jsonobject1); + } + + jsonobject.add("sample", jsonarray); + } + + return jsonobject; + } + } + } + + public static class Serializer implements JsonDeserializer, JsonSerializer + { + public ServerStatusResponse deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = JsonUtils.getJsonObject(p_deserialize_1_, "status"); + ServerStatusResponse serverstatusresponse = new ServerStatusResponse(); + + if (jsonobject.has("description")) + { + serverstatusresponse.setServerDescription((IChatComponent)p_deserialize_3_.deserialize(jsonobject.get("description"), IChatComponent.class)); + } + + if (jsonobject.has("players")) + { + serverstatusresponse.setPlayerCountData((ServerStatusResponse.PlayerCountData)p_deserialize_3_.deserialize(jsonobject.get("players"), ServerStatusResponse.PlayerCountData.class)); + } + + if (jsonobject.has("version")) + { + serverstatusresponse.setProtocolVersionInfo((ServerStatusResponse.MinecraftProtocolVersionIdentifier)p_deserialize_3_.deserialize(jsonobject.get("version"), ServerStatusResponse.MinecraftProtocolVersionIdentifier.class)); + } + + if (jsonobject.has("favicon")) + { + serverstatusresponse.setFavicon(JsonUtils.getString(jsonobject, "favicon")); + } + + return serverstatusresponse; + } + + public JsonElement serialize(ServerStatusResponse p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) + { + JsonObject jsonobject = new JsonObject(); + + if (p_serialize_1_.getServerDescription() != null) + { + jsonobject.add("description", p_serialize_3_.serialize(p_serialize_1_.getServerDescription())); + } + + if (p_serialize_1_.getPlayerCountData() != null) + { + jsonobject.add("players", p_serialize_3_.serialize(p_serialize_1_.getPlayerCountData())); + } + + if (p_serialize_1_.getProtocolVersionInfo() != null) + { + jsonobject.add("version", p_serialize_3_.serialize(p_serialize_1_.getProtocolVersionInfo())); + } + + if (p_serialize_1_.getFavicon() != null) + { + jsonobject.addProperty("favicon", p_serialize_1_.getFavicon()); + } + + return jsonobject; + } + } +} diff --git a/src/minecraft/net/minecraft/network/ThreadQuickExitException.java b/src/minecraft/net/minecraft/network/ThreadQuickExitException.java new file mode 100644 index 0000000..ec8f67c --- /dev/null +++ b/src/minecraft/net/minecraft/network/ThreadQuickExitException.java @@ -0,0 +1,17 @@ +package net.minecraft.network; + +public final class ThreadQuickExitException extends RuntimeException +{ + public static final ThreadQuickExitException field_179886_a = new ThreadQuickExitException(); + + private ThreadQuickExitException() + { + this.setStackTrace(new StackTraceElement[0]); + } + + public synchronized Throwable fillInStackTrace() + { + this.setStackTrace(new StackTraceElement[0]); + return this; + } +} diff --git a/src/minecraft/net/minecraft/network/handshake/INetHandlerHandshakeServer.java b/src/minecraft/net/minecraft/network/handshake/INetHandlerHandshakeServer.java new file mode 100644 index 0000000..51e5215 --- /dev/null +++ b/src/minecraft/net/minecraft/network/handshake/INetHandlerHandshakeServer.java @@ -0,0 +1,14 @@ +package net.minecraft.network.handshake; + +import net.minecraft.network.INetHandler; +import net.minecraft.network.handshake.client.C00Handshake; + +public interface INetHandlerHandshakeServer extends INetHandler +{ + /** + * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The + * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention + * must pass a versioncheck or receive a disconnect otherwise + */ + void processHandshake(C00Handshake packetIn); +} diff --git a/src/minecraft/net/minecraft/network/handshake/client/C00Handshake.java b/src/minecraft/net/minecraft/network/handshake/client/C00Handshake.java new file mode 100644 index 0000000..575d3ed --- /dev/null +++ b/src/minecraft/net/minecraft/network/handshake/client/C00Handshake.java @@ -0,0 +1,67 @@ +package net.minecraft.network.handshake.client; + +import java.io.IOException; +import net.minecraft.network.EnumConnectionState; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.handshake.INetHandlerHandshakeServer; + +public class C00Handshake implements Packet +{ + private int protocolVersion; + private String ip; + private int port; + private EnumConnectionState requestedState; + + public C00Handshake() + { + } + + public C00Handshake(int version, String ip, int port, EnumConnectionState requestedState) + { + this.protocolVersion = version; + this.ip = ip; + this.port = port; + this.requestedState = requestedState; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.protocolVersion = buf.readVarIntFromBuffer(); + this.ip = buf.readStringFromBuffer(255); + this.port = buf.readUnsignedShort(); + this.requestedState = EnumConnectionState.getById(buf.readVarIntFromBuffer()); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.protocolVersion); + buf.writeString(this.ip); + buf.writeShort(this.port); + buf.writeVarIntToBuffer(this.requestedState.getId()); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerHandshakeServer handler) + { + handler.processHandshake(this); + } + + public EnumConnectionState getRequestedState() + { + return this.requestedState; + } + + public int getProtocolVersion() + { + return this.protocolVersion; + } +} diff --git a/src/minecraft/net/minecraft/network/login/INetHandlerLoginClient.java b/src/minecraft/net/minecraft/network/login/INetHandlerLoginClient.java new file mode 100644 index 0000000..f8264f7 --- /dev/null +++ b/src/minecraft/net/minecraft/network/login/INetHandlerLoginClient.java @@ -0,0 +1,18 @@ +package net.minecraft.network.login; + +import net.minecraft.network.INetHandler; +import net.minecraft.network.login.server.S00PacketDisconnect; +import net.minecraft.network.login.server.S01PacketEncryptionRequest; +import net.minecraft.network.login.server.S02PacketLoginSuccess; +import net.minecraft.network.login.server.S03PacketEnableCompression; + +public interface INetHandlerLoginClient extends INetHandler +{ + void handleEncryptionRequest(S01PacketEncryptionRequest packetIn); + + void handleLoginSuccess(S02PacketLoginSuccess packetIn); + + void handleDisconnect(S00PacketDisconnect packetIn); + + void handleEnableCompression(S03PacketEnableCompression packetIn); +} diff --git a/src/minecraft/net/minecraft/network/login/INetHandlerLoginServer.java b/src/minecraft/net/minecraft/network/login/INetHandlerLoginServer.java new file mode 100644 index 0000000..6b45c38 --- /dev/null +++ b/src/minecraft/net/minecraft/network/login/INetHandlerLoginServer.java @@ -0,0 +1,12 @@ +package net.minecraft.network.login; + +import net.minecraft.network.INetHandler; +import net.minecraft.network.login.client.C00PacketLoginStart; +import net.minecraft.network.login.client.C01PacketEncryptionResponse; + +public interface INetHandlerLoginServer extends INetHandler +{ + void processLoginStart(C00PacketLoginStart packetIn); + + void processEncryptionResponse(C01PacketEncryptionResponse packetIn); +} diff --git a/src/minecraft/net/minecraft/network/login/client/C00PacketLoginStart.java b/src/minecraft/net/minecraft/network/login/client/C00PacketLoginStart.java new file mode 100644 index 0000000..f46c9d3 --- /dev/null +++ b/src/minecraft/net/minecraft/network/login/client/C00PacketLoginStart.java @@ -0,0 +1,51 @@ +package net.minecraft.network.login.client; + +import com.mojang.authlib.GameProfile; +import java.io.IOException; +import java.util.UUID; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.login.INetHandlerLoginServer; + +public class C00PacketLoginStart implements Packet +{ + private GameProfile profile; + + public C00PacketLoginStart() + { + } + + public C00PacketLoginStart(GameProfile profileIn) + { + this.profile = profileIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.profile = new GameProfile((UUID)null, buf.readStringFromBuffer(16)); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.profile.getName()); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerLoginServer handler) + { + handler.processLoginStart(this); + } + + public GameProfile getProfile() + { + return this.profile; + } +} diff --git a/src/minecraft/net/minecraft/network/login/client/C01PacketEncryptionResponse.java b/src/minecraft/net/minecraft/network/login/client/C01PacketEncryptionResponse.java new file mode 100644 index 0000000..316bc26 --- /dev/null +++ b/src/minecraft/net/minecraft/network/login/client/C01PacketEncryptionResponse.java @@ -0,0 +1,62 @@ +package net.minecraft.network.login.client; + +import java.io.IOException; +import java.security.PrivateKey; +import java.security.PublicKey; +import javax.crypto.SecretKey; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.login.INetHandlerLoginServer; +import net.minecraft.util.CryptManager; + +public class C01PacketEncryptionResponse implements Packet +{ + private byte[] secretKeyEncrypted = new byte[0]; + private byte[] verifyTokenEncrypted = new byte[0]; + + public C01PacketEncryptionResponse() + { + } + + public C01PacketEncryptionResponse(SecretKey secretKey, PublicKey publicKey, byte[] verifyToken) + { + this.secretKeyEncrypted = CryptManager.encryptData(publicKey, secretKey.getEncoded()); + this.verifyTokenEncrypted = CryptManager.encryptData(publicKey, verifyToken); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.secretKeyEncrypted = buf.readByteArray(); + this.verifyTokenEncrypted = buf.readByteArray(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByteArray(this.secretKeyEncrypted); + buf.writeByteArray(this.verifyTokenEncrypted); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerLoginServer handler) + { + handler.processEncryptionResponse(this); + } + + public SecretKey getSecretKey(PrivateKey key) + { + return CryptManager.decryptSharedKey(key, this.secretKeyEncrypted); + } + + public byte[] getVerifyToken(PrivateKey key) + { + return key == null ? this.verifyTokenEncrypted : CryptManager.decryptData(key, this.verifyTokenEncrypted); + } +} diff --git a/src/minecraft/net/minecraft/network/login/server/S00PacketDisconnect.java b/src/minecraft/net/minecraft/network/login/server/S00PacketDisconnect.java new file mode 100644 index 0000000..4d7b11f --- /dev/null +++ b/src/minecraft/net/minecraft/network/login/server/S00PacketDisconnect.java @@ -0,0 +1,50 @@ +package net.minecraft.network.login.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.login.INetHandlerLoginClient; +import net.minecraft.util.IChatComponent; + +public class S00PacketDisconnect implements Packet +{ + private IChatComponent reason; + + public S00PacketDisconnect() + { + } + + public S00PacketDisconnect(IChatComponent reasonIn) + { + this.reason = reasonIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.reason = buf.readChatComponent(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeChatComponent(this.reason); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerLoginClient handler) + { + handler.handleDisconnect(this); + } + + public IChatComponent func_149603_c() + { + return this.reason; + } +} diff --git a/src/minecraft/net/minecraft/network/login/server/S01PacketEncryptionRequest.java b/src/minecraft/net/minecraft/network/login/server/S01PacketEncryptionRequest.java new file mode 100644 index 0000000..74bc817 --- /dev/null +++ b/src/minecraft/net/minecraft/network/login/server/S01PacketEncryptionRequest.java @@ -0,0 +1,69 @@ +package net.minecraft.network.login.server; + +import java.io.IOException; +import java.security.PublicKey; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.login.INetHandlerLoginClient; +import net.minecraft.util.CryptManager; + +public class S01PacketEncryptionRequest implements Packet +{ + private String hashedServerId; + private PublicKey publicKey; + private byte[] verifyToken; + + public S01PacketEncryptionRequest() + { + } + + public S01PacketEncryptionRequest(String serverId, PublicKey key, byte[] verifyToken) + { + this.hashedServerId = serverId; + this.publicKey = key; + this.verifyToken = verifyToken; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.hashedServerId = buf.readStringFromBuffer(20); + this.publicKey = CryptManager.decodePublicKey(buf.readByteArray()); + this.verifyToken = buf.readByteArray(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.hashedServerId); + buf.writeByteArray(this.publicKey.getEncoded()); + buf.writeByteArray(this.verifyToken); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerLoginClient handler) + { + handler.handleEncryptionRequest(this); + } + + public String getServerId() + { + return this.hashedServerId; + } + + public PublicKey getPublicKey() + { + return this.publicKey; + } + + public byte[] getVerifyToken() + { + return this.verifyToken; + } +} diff --git a/src/minecraft/net/minecraft/network/login/server/S02PacketLoginSuccess.java b/src/minecraft/net/minecraft/network/login/server/S02PacketLoginSuccess.java new file mode 100644 index 0000000..30d4166 --- /dev/null +++ b/src/minecraft/net/minecraft/network/login/server/S02PacketLoginSuccess.java @@ -0,0 +1,56 @@ +package net.minecraft.network.login.server; + +import com.mojang.authlib.GameProfile; +import java.io.IOException; +import java.util.UUID; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.login.INetHandlerLoginClient; + +public class S02PacketLoginSuccess implements Packet +{ + private GameProfile profile; + + public S02PacketLoginSuccess() + { + } + + public S02PacketLoginSuccess(GameProfile profileIn) + { + this.profile = profileIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + String s = buf.readStringFromBuffer(36); + String s1 = buf.readStringFromBuffer(16); + UUID uuid = UUID.fromString(s); + this.profile = new GameProfile(uuid, s1); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + UUID uuid = this.profile.getId(); + buf.writeString(uuid == null ? "" : uuid.toString()); + buf.writeString(this.profile.getName()); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerLoginClient handler) + { + handler.handleLoginSuccess(this); + } + + public GameProfile getProfile() + { + return this.profile; + } +} diff --git a/src/minecraft/net/minecraft/network/login/server/S03PacketEnableCompression.java b/src/minecraft/net/minecraft/network/login/server/S03PacketEnableCompression.java new file mode 100644 index 0000000..8dae3ce --- /dev/null +++ b/src/minecraft/net/minecraft/network/login/server/S03PacketEnableCompression.java @@ -0,0 +1,49 @@ +package net.minecraft.network.login.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.login.INetHandlerLoginClient; + +public class S03PacketEnableCompression implements Packet +{ + private int compressionTreshold; + + public S03PacketEnableCompression() + { + } + + public S03PacketEnableCompression(int compressionTresholdIn) + { + this.compressionTreshold = compressionTresholdIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.compressionTreshold = buf.readVarIntFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.compressionTreshold); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerLoginClient handler) + { + handler.handleEnableCompression(this); + } + + public int getCompressionTreshold() + { + return this.compressionTreshold; + } +} diff --git a/src/minecraft/net/minecraft/network/play/INetHandlerPlayClient.java b/src/minecraft/net/minecraft/network/play/INetHandlerPlayClient.java new file mode 100644 index 0000000..f81027e --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/INetHandlerPlayClient.java @@ -0,0 +1,385 @@ +package net.minecraft.network.play; + +import net.minecraft.network.INetHandler; +import net.minecraft.network.play.server.S00PacketKeepAlive; +import net.minecraft.network.play.server.S01PacketJoinGame; +import net.minecraft.network.play.server.S02PacketChat; +import net.minecraft.network.play.server.S03PacketTimeUpdate; +import net.minecraft.network.play.server.S04PacketEntityEquipment; +import net.minecraft.network.play.server.S05PacketSpawnPosition; +import net.minecraft.network.play.server.S06PacketUpdateHealth; +import net.minecraft.network.play.server.S07PacketRespawn; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.network.play.server.S09PacketHeldItemChange; +import net.minecraft.network.play.server.S0APacketUseBed; +import net.minecraft.network.play.server.S0BPacketAnimation; +import net.minecraft.network.play.server.S0CPacketSpawnPlayer; +import net.minecraft.network.play.server.S0DPacketCollectItem; +import net.minecraft.network.play.server.S0EPacketSpawnObject; +import net.minecraft.network.play.server.S0FPacketSpawnMob; +import net.minecraft.network.play.server.S10PacketSpawnPainting; +import net.minecraft.network.play.server.S11PacketSpawnExperienceOrb; +import net.minecraft.network.play.server.S12PacketEntityVelocity; +import net.minecraft.network.play.server.S13PacketDestroyEntities; +import net.minecraft.network.play.server.S14PacketEntity; +import net.minecraft.network.play.server.S18PacketEntityTeleport; +import net.minecraft.network.play.server.S19PacketEntityHeadLook; +import net.minecraft.network.play.server.S19PacketEntityStatus; +import net.minecraft.network.play.server.S1BPacketEntityAttach; +import net.minecraft.network.play.server.S1CPacketEntityMetadata; +import net.minecraft.network.play.server.S1DPacketEntityEffect; +import net.minecraft.network.play.server.S1EPacketRemoveEntityEffect; +import net.minecraft.network.play.server.S1FPacketSetExperience; +import net.minecraft.network.play.server.S20PacketEntityProperties; +import net.minecraft.network.play.server.S21PacketChunkData; +import net.minecraft.network.play.server.S22PacketMultiBlockChange; +import net.minecraft.network.play.server.S23PacketBlockChange; +import net.minecraft.network.play.server.S24PacketBlockAction; +import net.minecraft.network.play.server.S25PacketBlockBreakAnim; +import net.minecraft.network.play.server.S26PacketMapChunkBulk; +import net.minecraft.network.play.server.S27PacketExplosion; +import net.minecraft.network.play.server.S28PacketEffect; +import net.minecraft.network.play.server.S29PacketSoundEffect; +import net.minecraft.network.play.server.S2APacketParticles; +import net.minecraft.network.play.server.S2BPacketChangeGameState; +import net.minecraft.network.play.server.S2CPacketSpawnGlobalEntity; +import net.minecraft.network.play.server.S2DPacketOpenWindow; +import net.minecraft.network.play.server.S2EPacketCloseWindow; +import net.minecraft.network.play.server.S2FPacketSetSlot; +import net.minecraft.network.play.server.S30PacketWindowItems; +import net.minecraft.network.play.server.S31PacketWindowProperty; +import net.minecraft.network.play.server.S32PacketConfirmTransaction; +import net.minecraft.network.play.server.S33PacketUpdateSign; +import net.minecraft.network.play.server.S34PacketMaps; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.network.play.server.S36PacketSignEditorOpen; +import net.minecraft.network.play.server.S37PacketStatistics; +import net.minecraft.network.play.server.S38PacketPlayerListItem; +import net.minecraft.network.play.server.S39PacketPlayerAbilities; +import net.minecraft.network.play.server.S3APacketTabComplete; +import net.minecraft.network.play.server.S3BPacketScoreboardObjective; +import net.minecraft.network.play.server.S3CPacketUpdateScore; +import net.minecraft.network.play.server.S3DPacketDisplayScoreboard; +import net.minecraft.network.play.server.S3EPacketTeams; +import net.minecraft.network.play.server.S3FPacketCustomPayload; +import net.minecraft.network.play.server.S40PacketDisconnect; +import net.minecraft.network.play.server.S41PacketServerDifficulty; +import net.minecraft.network.play.server.S42PacketCombatEvent; +import net.minecraft.network.play.server.S43PacketCamera; +import net.minecraft.network.play.server.S44PacketWorldBorder; +import net.minecraft.network.play.server.S45PacketTitle; +import net.minecraft.network.play.server.S46PacketSetCompressionLevel; +import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter; +import net.minecraft.network.play.server.S48PacketResourcePackSend; +import net.minecraft.network.play.server.S49PacketUpdateEntityNBT; + +public interface INetHandlerPlayClient extends INetHandler +{ + /** + * Spawns an instance of the objecttype indicated by the packet and sets its position and momentum + */ + void handleSpawnObject(S0EPacketSpawnObject packetIn); + + /** + * Spawns an experience orb and sets its value (amount of XP) + */ + void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn); + + /** + * Handles globally visible entities. Used in vanilla for lightning bolts + */ + void handleSpawnGlobalEntity(S2CPacketSpawnGlobalEntity packetIn); + + /** + * Spawns the mob entity at the specified location, with the specified rotation, momentum and type. Updates the + * entities Datawatchers with the entity metadata specified in the packet + */ + void handleSpawnMob(S0FPacketSpawnMob packetIn); + + /** + * May create a scoreboard objective, remove an objective from the scoreboard or update an objectives' displayname + */ + void handleScoreboardObjective(S3BPacketScoreboardObjective packetIn); + + /** + * Handles the spawning of a painting object + */ + void handleSpawnPainting(S10PacketSpawnPainting packetIn); + + /** + * Handles the creation of a nearby player entity, sets the position and held item + */ + void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn); + + /** + * Renders a specified animation: Waking up a player, a living entity swinging its currently held item, being hurt + * or receiving a critical hit by normal or magical means + */ + void handleAnimation(S0BPacketAnimation packetIn); + + /** + * Updates the players statistics or achievements + */ + void handleStatistics(S37PacketStatistics packetIn); + + /** + * Updates all registered IWorldAccess instances with destroyBlockInWorldPartially + */ + void handleBlockBreakAnim(S25PacketBlockBreakAnim packetIn); + + /** + * Creates a sign in the specified location if it didn't exist and opens the GUI to edit its text + */ + void handleSignEditorOpen(S36PacketSignEditorOpen packetIn); + + /** + * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, + * beacons, skulls, flowerpot + */ + void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn); + + /** + * Triggers Block.onBlockEventReceived, which is implemented in BlockPistonBase for extension/retraction, BlockNote + * for setting the instrument (including audiovisual feedback) and in BlockContainer to set the number of players + * accessing a (Ender)Chest + */ + void handleBlockAction(S24PacketBlockAction packetIn); + + /** + * Updates the block and metadata and generates a blockupdate (and notify the clients) + */ + void handleBlockChange(S23PacketBlockChange packetIn); + + /** + * Prints a chatmessage in the chat GUI + */ + void handleChat(S02PacketChat packetIn); + + /** + * Displays the available command-completion options the server knows of + */ + void handleTabComplete(S3APacketTabComplete packetIn); + + /** + * Received from the servers PlayerManager if between 1 and 64 blocks in a chunk are changed. If only one block + * requires an update, the server sends S23PacketBlockChange and if 64 or more blocks are changed, the server sends + * S21PacketChunkData + */ + void handleMultiBlockChange(S22PacketMultiBlockChange packetIn); + + /** + * Updates the worlds MapStorage with the specified MapData for the specified map-identifier and invokes a + * MapItemRenderer for it + */ + void handleMaps(S34PacketMaps packetIn); + + /** + * Verifies that the server and client are synchronized with respect to the inventory/container opened by the player + * and confirms if it is the case. + */ + void handleConfirmTransaction(S32PacketConfirmTransaction packetIn); + + /** + * Resets the ItemStack held in hand and closes the window that is opened + */ + void handleCloseWindow(S2EPacketCloseWindow packetIn); + + /** + * Handles the placement of a specified ItemStack in a specified container/inventory slot + */ + void handleWindowItems(S30PacketWindowItems packetIn); + + /** + * Displays a GUI by ID. In order starting from id 0: Chest, Workbench, Furnace, Dispenser, Enchanting table, + * Brewing stand, Villager merchant, Beacon, Anvil, Hopper, Dropper, Horse + */ + void handleOpenWindow(S2DPacketOpenWindow packetIn); + + /** + * Sets the progressbar of the opened window to the specified value + */ + void handleWindowProperty(S31PacketWindowProperty packetIn); + + /** + * Handles pickin up an ItemStack or dropping one in your inventory or an open (non-creative) container + */ + void handleSetSlot(S2FPacketSetSlot packetIn); + + /** + * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to + * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the + * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server + * resourcepack for the client to load. + */ + void handleCustomPayload(S3FPacketCustomPayload packetIn); + + /** + * Closes the network channel + */ + void handleDisconnect(S40PacketDisconnect packetIn); + + /** + * Retrieves the player identified by the packet, puts him to sleep if possible (and flags whether all players are + * asleep) + */ + void handleUseBed(S0APacketUseBed packetIn); + + /** + * Invokes the entities' handleUpdateHealth method which is implemented in LivingBase (hurt/death), + * MinecartMobSpawner (spawn delay), FireworkRocket & MinecartTNT (explosion), IronGolem (throwing,...), Witch + * (spawn particles), Zombie (villager transformation), Animal (breeding mode particles), Horse (breeding/smoke + * particles), Sheep (...), Tameable (...), Villager (particles for breeding mode, angry and happy), Wolf (...) + */ + void handleEntityStatus(S19PacketEntityStatus packetIn); + + void handleEntityAttach(S1BPacketEntityAttach packetIn); + + /** + * Initiates a new explosion (sound, particles, drop spawn) for the affected blocks indicated by the packet. + */ + void handleExplosion(S27PacketExplosion packetIn); + + void handleChangeGameState(S2BPacketChangeGameState packetIn); + + void handleKeepAlive(S00PacketKeepAlive packetIn); + + /** + * Updates the specified chunk with the supplied data, marks it for re-rendering and lighting recalculation + */ + void handleChunkData(S21PacketChunkData packetIn); + + void handleMapChunkBulk(S26PacketMapChunkBulk packetIn); + + void handleEffect(S28PacketEffect packetIn); + + /** + * Registers some server properties (gametype,hardcore-mode,terraintype,difficulty,player limit), creates a new + * WorldClient and sets the player initial dimension + */ + void handleJoinGame(S01PacketJoinGame packetIn); + + /** + * Updates the specified entity's position by the specified relative moment and absolute rotation. Note that + * subclassing of the packet allows for the specification of a subset of this data (e.g. only rel. position, abs. + * rotation or both). + */ + void handleEntityMovement(S14PacketEntity packetIn); + + /** + * Handles changes in player positioning and rotation such as when travelling to a new dimension, (re)spawning, + * mounting horses etc. Seems to immediately reply to the server with the clients post-processing perspective on the + * player positioning + */ + void handlePlayerPosLook(S08PacketPlayerPosLook packetIn); + + /** + * Spawns a specified number of particles at the specified location with a randomized displacement according to + * specified bounds + */ + void handleParticles(S2APacketParticles packetIn); + + void handlePlayerAbilities(S39PacketPlayerAbilities packetIn); + + void handlePlayerListItem(S38PacketPlayerListItem packetIn); + + /** + * Locally eliminates the entities. Invoked by the server when the items are in fact destroyed, or the player is no + * longer registered as required to monitor them. The latter happens when distance between the player and item + * increases beyond a certain treshold (typically the viewing distance) + */ + void handleDestroyEntities(S13PacketDestroyEntities packetIn); + + void handleRemoveEntityEffect(S1EPacketRemoveEntityEffect packetIn); + + void handleRespawn(S07PacketRespawn packetIn); + + /** + * Updates the direction in which the specified entity is looking, normally this head rotation is independent of the + * rotation of the entity itself + */ + void handleEntityHeadLook(S19PacketEntityHeadLook packetIn); + + /** + * Updates which hotbar slot of the player is currently selected + */ + void handleHeldItemChange(S09PacketHeldItemChange packetIn); + + /** + * Removes or sets the ScoreObjective to be displayed at a particular scoreboard position (list, sidebar, below + * name) + */ + void handleDisplayScoreboard(S3DPacketDisplayScoreboard packetIn); + + /** + * Invoked when the server registers new proximate objects in your watchlist or when objects in your watchlist have + * changed -> Registers any changes locally + */ + void handleEntityMetadata(S1CPacketEntityMetadata packetIn); + + /** + * Sets the velocity of the specified entity to the specified value + */ + void handleEntityVelocity(S12PacketEntityVelocity packetIn); + + void handleEntityEquipment(S04PacketEntityEquipment packetIn); + + void handleSetExperience(S1FPacketSetExperience packetIn); + + void handleUpdateHealth(S06PacketUpdateHealth packetIn); + + /** + * Updates a team managed by the scoreboard: Create/Remove the team registration, Register/Remove the player-team- + * memberships, Set team displayname/prefix/suffix and/or whether friendly fire is enabled + */ + void handleTeams(S3EPacketTeams packetIn); + + /** + * Either updates the score with a specified value or removes the score for an objective + */ + void handleUpdateScore(S3CPacketUpdateScore packetIn); + + void handleSpawnPosition(S05PacketSpawnPosition packetIn); + + void handleTimeUpdate(S03PacketTimeUpdate packetIn); + + /** + * Updates a specified sign with the specified text lines + */ + void handleUpdateSign(S33PacketUpdateSign packetIn); + + void handleSoundEffect(S29PacketSoundEffect packetIn); + + void handleCollectItem(S0DPacketCollectItem packetIn); + + /** + * Updates an entity's position and rotation as specified by the packet + */ + void handleEntityTeleport(S18PacketEntityTeleport packetIn); + + /** + * Updates en entity's attributes and their respective modifiers, which are used for speed bonusses (player + * sprinting, animals fleeing, baby speed), weapon/tool attackDamage, hostiles followRange randomization, zombie + * maxHealth and knockback resistance as well as reinforcement spawning chance. + */ + void handleEntityProperties(S20PacketEntityProperties packetIn); + + void handleEntityEffect(S1DPacketEntityEffect packetIn); + + void handleCombatEvent(S42PacketCombatEvent packetIn); + + void handleServerDifficulty(S41PacketServerDifficulty packetIn); + + void handleCamera(S43PacketCamera packetIn); + + void handleWorldBorder(S44PacketWorldBorder packetIn); + + void handleTitle(S45PacketTitle packetIn); + + void handleSetCompressionLevel(S46PacketSetCompressionLevel packetIn); + + void handlePlayerListHeaderFooter(S47PacketPlayerListHeaderFooter packetIn); + + void handleResourcePack(S48PacketResourcePackSend packetIn); + + void handleEntityNBT(S49PacketUpdateEntityNBT packetIn); +} diff --git a/src/minecraft/net/minecraft/network/play/INetHandlerPlayServer.java b/src/minecraft/net/minecraft/network/play/INetHandlerPlayServer.java new file mode 100644 index 0000000..3793206 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/INetHandlerPlayServer.java @@ -0,0 +1,144 @@ +package net.minecraft.network.play; + +import net.minecraft.network.INetHandler; +import net.minecraft.network.play.client.C00PacketKeepAlive; +import net.minecraft.network.play.client.C01PacketChatMessage; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; +import net.minecraft.network.play.client.C09PacketHeldItemChange; +import net.minecraft.network.play.client.C0APacketAnimation; +import net.minecraft.network.play.client.C0BPacketEntityAction; +import net.minecraft.network.play.client.C0CPacketInput; +import net.minecraft.network.play.client.C0DPacketCloseWindow; +import net.minecraft.network.play.client.C0EPacketClickWindow; +import net.minecraft.network.play.client.C0FPacketConfirmTransaction; +import net.minecraft.network.play.client.C10PacketCreativeInventoryAction; +import net.minecraft.network.play.client.C11PacketEnchantItem; +import net.minecraft.network.play.client.C12PacketUpdateSign; +import net.minecraft.network.play.client.C13PacketPlayerAbilities; +import net.minecraft.network.play.client.C14PacketTabComplete; +import net.minecraft.network.play.client.C15PacketClientSettings; +import net.minecraft.network.play.client.C16PacketClientStatus; +import net.minecraft.network.play.client.C17PacketCustomPayload; +import net.minecraft.network.play.client.C18PacketSpectate; +import net.minecraft.network.play.client.C19PacketResourcePackStatus; + +public interface INetHandlerPlayServer extends INetHandler +{ + void handleAnimation(C0APacketAnimation packetIn); + + /** + * Process chat messages (broadcast back to clients) and commands (executes) + */ + void processChatMessage(C01PacketChatMessage packetIn); + + /** + * Retrieves possible tab completions for the requested command string and sends them to the client + */ + void processTabComplete(C14PacketTabComplete packetIn); + + /** + * Processes the client status updates: respawn attempt from player, opening statistics or achievements, or + * acquiring 'open inventory' achievement + */ + void processClientStatus(C16PacketClientStatus packetIn); + + /** + * Updates serverside copy of client settings: language, render distance, chat visibility, chat colours, difficulty, + * and whether to show the cape + */ + void processClientSettings(C15PacketClientSettings packetIn); + + /** + * Received in response to the server requesting to confirm that the client-side open container matches the servers' + * after a mismatched container-slot manipulation. It will unlock the player's ability to manipulate the container + * contents + */ + void processConfirmTransaction(C0FPacketConfirmTransaction packetIn); + + /** + * Enchants the item identified by the packet given some convoluted conditions (matching window, which + * should/shouldn't be in use?) + */ + void processEnchantItem(C11PacketEnchantItem packetIn); + + /** + * Executes a container/inventory slot manipulation as indicated by the packet. Sends the serverside result if they + * didn't match the indicated result and prevents further manipulation by the player until he confirms that it has + * the same open container/inventory + */ + void processClickWindow(C0EPacketClickWindow packetIn); + + /** + * Processes the client closing windows (container) + */ + void processCloseWindow(C0DPacketCloseWindow packetIn); + + /** + * Synchronizes serverside and clientside book contents and signing + */ + void processVanilla250Packet(C17PacketCustomPayload packetIn); + + /** + * Processes interactions ((un)leashing, opening command block GUI) and attacks on an entity with players currently + * equipped item + */ + void processUseEntity(C02PacketUseEntity packetIn); + + /** + * Updates a players' ping statistics + */ + void processKeepAlive(C00PacketKeepAlive packetIn); + + /** + * Processes clients perspective on player positioning and/or orientation + */ + void processPlayer(C03PacketPlayer packetIn); + + /** + * Processes a player starting/stopping flying + */ + void processPlayerAbilities(C13PacketPlayerAbilities packetIn); + + /** + * Processes the player initiating/stopping digging on a particular spot, as well as a player dropping items?. (0: + * initiated, 1: reinitiated, 2? , 3-4 drop item (respectively without or with player control), 5: stopped; x,y,z, + * side clicked on;) + */ + void processPlayerDigging(C07PacketPlayerDigging packetIn); + + /** + * Processes a range of action-types: sneaking, sprinting, waking from sleep, opening the inventory or setting jump + * height of the horse the player is riding + */ + void processEntityAction(C0BPacketEntityAction packetIn); + + /** + * Processes player movement input. Includes walking, strafing, jumping, sneaking; excludes riding and toggling + * flying/sprinting + */ + void processInput(C0CPacketInput packetIn); + + /** + * Updates which quickbar slot is selected + */ + void processHeldItemChange(C09PacketHeldItemChange packetIn); + + /** + * Update the server with an ItemStack in a slot. + */ + void processCreativeInventoryAction(C10PacketCreativeInventoryAction packetIn); + + void processUpdateSign(C12PacketUpdateSign packetIn); + + /** + * Processes block placement and block activation (anvil, furnace, etc.) + */ + void processPlayerBlockPlacement(C08PacketPlayerBlockPlacement packetIn); + + void handleSpectate(C18PacketSpectate packetIn); + + void handleResourcePackStatus(C19PacketResourcePackStatus packetIn); +} diff --git a/src/minecraft/net/minecraft/network/play/client/C00PacketKeepAlive.java b/src/minecraft/net/minecraft/network/play/client/C00PacketKeepAlive.java new file mode 100644 index 0000000..8fca574 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C00PacketKeepAlive.java @@ -0,0 +1,49 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C00PacketKeepAlive implements Packet +{ + private int key; + + public C00PacketKeepAlive() + { + } + + public C00PacketKeepAlive(int key) + { + this.key = key; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processKeepAlive(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.key = buf.readVarIntFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.key); + } + + public int getKey() + { + return this.key; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C01PacketChatMessage.java b/src/minecraft/net/minecraft/network/play/client/C01PacketChatMessage.java new file mode 100644 index 0000000..6467fec --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C01PacketChatMessage.java @@ -0,0 +1,54 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C01PacketChatMessage implements Packet +{ + private String message; + + public C01PacketChatMessage() + { + } + + public C01PacketChatMessage(String messageIn) + { + if (messageIn.length() > 100) + { + messageIn = messageIn.substring(0, 100); + } + + this.message = messageIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.message = buf.readStringFromBuffer(100); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.message); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processChatMessage(this); + } + + public String getMessage() + { + return this.message; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C02PacketUseEntity.java b/src/minecraft/net/minecraft/network/play/client/C02PacketUseEntity.java new file mode 100644 index 0000000..94bcfce --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C02PacketUseEntity.java @@ -0,0 +1,92 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class C02PacketUseEntity implements Packet +{ + private int entityId; + private C02PacketUseEntity.Action action; + private Vec3 hitVec; + + public C02PacketUseEntity() + { + } + + public C02PacketUseEntity(Entity entity, C02PacketUseEntity.Action action) + { + this.entityId = entity.getEntityId(); + this.action = action; + } + + public C02PacketUseEntity(Entity entity, Vec3 hitVec) + { + this(entity, C02PacketUseEntity.Action.INTERACT_AT); + this.hitVec = hitVec; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + this.action = (C02PacketUseEntity.Action)buf.readEnumValue(C02PacketUseEntity.Action.class); + + if (this.action == C02PacketUseEntity.Action.INTERACT_AT) + { + this.hitVec = new Vec3((double)buf.readFloat(), (double)buf.readFloat(), (double)buf.readFloat()); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + buf.writeEnumValue(this.action); + + if (this.action == C02PacketUseEntity.Action.INTERACT_AT) + { + buf.writeFloat((float)this.hitVec.xCoord); + buf.writeFloat((float)this.hitVec.yCoord); + buf.writeFloat((float)this.hitVec.zCoord); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processUseEntity(this); + } + + public Entity getEntityFromWorld(World worldIn) + { + return worldIn.getEntityByID(this.entityId); + } + + public C02PacketUseEntity.Action getAction() + { + return this.action; + } + + public Vec3 getHitVec() + { + return this.hitVec; + } + + public static enum Action + { + INTERACT, + ATTACK, + INTERACT_AT; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C03PacketPlayer.java b/src/minecraft/net/minecraft/network/play/client/C03PacketPlayer.java new file mode 100644 index 0000000..188a64e --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C03PacketPlayer.java @@ -0,0 +1,200 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C03PacketPlayer implements Packet +{ + protected double x; + protected double y; + protected double z; + protected float yaw; + protected float pitch; + protected boolean onGround; + protected boolean moving; + protected boolean rotating; + + public C03PacketPlayer() + { + } + + public C03PacketPlayer(boolean isOnGround) + { + this.onGround = isOnGround; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processPlayer(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.onGround = buf.readUnsignedByte() != 0; + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.onGround ? 1 : 0); + } + + public double getPositionX() + { + return this.x; + } + + public double getPositionY() + { + return this.y; + } + + public double getPositionZ() + { + return this.z; + } + + public float getYaw() + { + return this.yaw; + } + + public float getPitch() + { + return this.pitch; + } + + public boolean isOnGround() + { + return this.onGround; + } + + public boolean isMoving() + { + return this.moving; + } + + public boolean getRotating() + { + return this.rotating; + } + + public void setMoving(boolean isMoving) + { + this.moving = isMoving; + } + + public static class C04PacketPlayerPosition extends C03PacketPlayer + { + public C04PacketPlayerPosition() + { + this.moving = true; + } + + public C04PacketPlayerPosition(double posX, double posY, double posZ, boolean isOnGround) + { + this.x = posX; + this.y = posY; + this.z = posZ; + this.onGround = isOnGround; + this.moving = true; + } + + public void readPacketData(PacketBuffer buf) throws IOException + { + this.x = buf.readDouble(); + this.y = buf.readDouble(); + this.z = buf.readDouble(); + super.readPacketData(buf); + } + + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeDouble(this.x); + buf.writeDouble(this.y); + buf.writeDouble(this.z); + super.writePacketData(buf); + } + } + + public static class C05PacketPlayerLook extends C03PacketPlayer + { + public C05PacketPlayerLook() + { + this.rotating = true; + } + + public C05PacketPlayerLook(float playerYaw, float playerPitch, boolean isOnGround) + { + this.yaw = playerYaw; + this.pitch = playerPitch; + this.onGround = isOnGround; + this.rotating = true; + } + + public void readPacketData(PacketBuffer buf) throws IOException + { + this.yaw = buf.readFloat(); + this.pitch = buf.readFloat(); + super.readPacketData(buf); + } + + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeFloat(this.yaw); + buf.writeFloat(this.pitch); + super.writePacketData(buf); + } + } + + public static class C06PacketPlayerPosLook extends C03PacketPlayer + { + public C06PacketPlayerPosLook() + { + this.moving = true; + this.rotating = true; + } + + public C06PacketPlayerPosLook(double playerX, double playerY, double playerZ, float playerYaw, float playerPitch, boolean playerIsOnGround) + { + this.x = playerX; + this.y = playerY; + this.z = playerZ; + this.yaw = playerYaw; + this.pitch = playerPitch; + this.onGround = playerIsOnGround; + this.rotating = true; + this.moving = true; + } + + public void readPacketData(PacketBuffer buf) throws IOException + { + this.x = buf.readDouble(); + this.y = buf.readDouble(); + this.z = buf.readDouble(); + this.yaw = buf.readFloat(); + this.pitch = buf.readFloat(); + super.readPacketData(buf); + } + + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeDouble(this.x); + buf.writeDouble(this.y); + buf.writeDouble(this.z); + buf.writeFloat(this.yaw); + buf.writeFloat(this.pitch); + super.writePacketData(buf); + } + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C07PacketPlayerDigging.java b/src/minecraft/net/minecraft/network/play/client/C07PacketPlayerDigging.java new file mode 100644 index 0000000..08ce6a3 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C07PacketPlayerDigging.java @@ -0,0 +1,81 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; + +public class C07PacketPlayerDigging implements Packet +{ + private BlockPos position; + private EnumFacing facing; + + /** Status of the digging (started, ongoing, broken). */ + private C07PacketPlayerDigging.Action status; + + public C07PacketPlayerDigging() + { + } + + public C07PacketPlayerDigging(C07PacketPlayerDigging.Action statusIn, BlockPos posIn, EnumFacing facingIn) + { + this.status = statusIn; + this.position = posIn; + this.facing = facingIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.status = (C07PacketPlayerDigging.Action)buf.readEnumValue(C07PacketPlayerDigging.Action.class); + this.position = buf.readBlockPos(); + this.facing = EnumFacing.getFront(buf.readUnsignedByte()); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeEnumValue(this.status); + buf.writeBlockPos(this.position); + buf.writeByte(this.facing.getIndex()); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processPlayerDigging(this); + } + + public BlockPos getPosition() + { + return this.position; + } + + public EnumFacing getFacing() + { + return this.facing; + } + + public C07PacketPlayerDigging.Action getStatus() + { + return this.status; + } + + public static enum Action + { + START_DESTROY_BLOCK, + ABORT_DESTROY_BLOCK, + STOP_DESTROY_BLOCK, + DROP_ALL_ITEMS, + DROP_ITEM, + RELEASE_USE_ITEM; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C08PacketPlayerBlockPlacement.java b/src/minecraft/net/minecraft/network/play/client/C08PacketPlayerBlockPlacement.java new file mode 100644 index 0000000..5ffd36c --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C08PacketPlayerBlockPlacement.java @@ -0,0 +1,111 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.item.ItemStack; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; +import net.minecraft.util.BlockPos; + +public class C08PacketPlayerBlockPlacement implements Packet +{ + private static final BlockPos field_179726_a = new BlockPos(-1, -1, -1); + private BlockPos position; + private int placedBlockDirection; + private ItemStack stack; + private float facingX; + private float facingY; + private float facingZ; + + public C08PacketPlayerBlockPlacement() + { + } + + public C08PacketPlayerBlockPlacement(ItemStack stackIn) + { + this(field_179726_a, 255, stackIn, 0.0F, 0.0F, 0.0F); + } + + public C08PacketPlayerBlockPlacement(BlockPos positionIn, int placedBlockDirectionIn, ItemStack stackIn, float facingXIn, float facingYIn, float facingZIn) + { + this.position = positionIn; + this.placedBlockDirection = placedBlockDirectionIn; + this.stack = stackIn != null ? stackIn.copy() : null; + this.facingX = facingXIn; + this.facingY = facingYIn; + this.facingZ = facingZIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.position = buf.readBlockPos(); + this.placedBlockDirection = buf.readUnsignedByte(); + this.stack = buf.readItemStackFromBuffer(); + this.facingX = (float)buf.readUnsignedByte() / 16.0F; + this.facingY = (float)buf.readUnsignedByte() / 16.0F; + this.facingZ = (float)buf.readUnsignedByte() / 16.0F; + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeBlockPos(this.position); + buf.writeByte(this.placedBlockDirection); + buf.writeItemStackToBuffer(this.stack); + buf.writeByte((int)(this.facingX * 16.0F)); + buf.writeByte((int)(this.facingY * 16.0F)); + buf.writeByte((int)(this.facingZ * 16.0F)); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processPlayerBlockPlacement(this); + } + + public BlockPos getPosition() + { + return this.position; + } + + public int getPlacedBlockDirection() + { + return this.placedBlockDirection; + } + + public ItemStack getStack() + { + return this.stack; + } + + /** + * Returns the offset from xPosition where the actual click took place. + */ + public float getPlacedBlockOffsetX() + { + return this.facingX; + } + + /** + * Returns the offset from yPosition where the actual click took place. + */ + public float getPlacedBlockOffsetY() + { + return this.facingY; + } + + /** + * Returns the offset from zPosition where the actual click took place. + */ + public float getPlacedBlockOffsetZ() + { + return this.facingZ; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C09PacketHeldItemChange.java b/src/minecraft/net/minecraft/network/play/client/C09PacketHeldItemChange.java new file mode 100644 index 0000000..0203f58 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C09PacketHeldItemChange.java @@ -0,0 +1,49 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C09PacketHeldItemChange implements Packet +{ + private int slotId; + + public C09PacketHeldItemChange() + { + } + + public C09PacketHeldItemChange(int slotId) + { + this.slotId = slotId; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.slotId = buf.readShort(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeShort(this.slotId); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processHeldItemChange(this); + } + + public int getSlotId() + { + return this.slotId; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C0APacketAnimation.java b/src/minecraft/net/minecraft/network/play/client/C0APacketAnimation.java new file mode 100644 index 0000000..c6ef5da --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C0APacketAnimation.java @@ -0,0 +1,31 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C0APacketAnimation implements Packet +{ + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.handleAnimation(this); + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C0BPacketEntityAction.java b/src/minecraft/net/minecraft/network/play/client/C0BPacketEntityAction.java new file mode 100644 index 0000000..bd496e0 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C0BPacketEntityAction.java @@ -0,0 +1,79 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C0BPacketEntityAction implements Packet +{ + private int entityID; + private C0BPacketEntityAction.Action action; + private int auxData; + + public C0BPacketEntityAction() + { + } + + public C0BPacketEntityAction(Entity entity, C0BPacketEntityAction.Action action) + { + this(entity, action, 0); + } + + public C0BPacketEntityAction(Entity entity, C0BPacketEntityAction.Action action, int auxData) + { + this.entityID = entity.getEntityId(); + this.action = action; + this.auxData = auxData; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityID = buf.readVarIntFromBuffer(); + this.action = (C0BPacketEntityAction.Action)buf.readEnumValue(C0BPacketEntityAction.Action.class); + this.auxData = buf.readVarIntFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityID); + buf.writeEnumValue(this.action); + buf.writeVarIntToBuffer(this.auxData); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processEntityAction(this); + } + + public C0BPacketEntityAction.Action getAction() + { + return this.action; + } + + public int getAuxData() + { + return this.auxData; + } + + public static enum Action + { + START_SNEAKING, + STOP_SNEAKING, + STOP_SLEEPING, + START_SPRINTING, + STOP_SPRINTING, + RIDING_JUMP, + OPEN_INVENTORY; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C0CPacketInput.java b/src/minecraft/net/minecraft/network/play/client/C0CPacketInput.java new file mode 100644 index 0000000..a8d7afc --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C0CPacketInput.java @@ -0,0 +1,91 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C0CPacketInput implements Packet +{ + /** Positive for left strafe, negative for right */ + private float strafeSpeed; + + /** Positive for forward, negative for backward */ + private float forwardSpeed; + private boolean jumping; + private boolean sneaking; + + public C0CPacketInput() + { + } + + public C0CPacketInput(float strafeSpeed, float forwardSpeed, boolean jumping, boolean sneaking) + { + this.strafeSpeed = strafeSpeed; + this.forwardSpeed = forwardSpeed; + this.jumping = jumping; + this.sneaking = sneaking; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.strafeSpeed = buf.readFloat(); + this.forwardSpeed = buf.readFloat(); + byte b0 = buf.readByte(); + this.jumping = (b0 & 1) > 0; + this.sneaking = (b0 & 2) > 0; + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeFloat(this.strafeSpeed); + buf.writeFloat(this.forwardSpeed); + byte b0 = 0; + + if (this.jumping) + { + b0 = (byte)(b0 | 1); + } + + if (this.sneaking) + { + b0 = (byte)(b0 | 2); + } + + buf.writeByte(b0); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processInput(this); + } + + public float getStrafeSpeed() + { + return this.strafeSpeed; + } + + public float getForwardSpeed() + { + return this.forwardSpeed; + } + + public boolean isJumping() + { + return this.jumping; + } + + public boolean isSneaking() + { + return this.sneaking; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C0DPacketCloseWindow.java b/src/minecraft/net/minecraft/network/play/client/C0DPacketCloseWindow.java new file mode 100644 index 0000000..1060245 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C0DPacketCloseWindow.java @@ -0,0 +1,44 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C0DPacketCloseWindow implements Packet +{ + private int windowId; + + public C0DPacketCloseWindow() + { + } + + public C0DPacketCloseWindow(int windowId) + { + this.windowId = windowId; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processCloseWindow(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.windowId = buf.readByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.windowId); + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C0EPacketClickWindow.java b/src/minecraft/net/minecraft/network/play/client/C0EPacketClickWindow.java new file mode 100644 index 0000000..46368d4 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C0EPacketClickWindow.java @@ -0,0 +1,106 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.item.ItemStack; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C0EPacketClickWindow implements Packet +{ + /** The id of the window which was clicked. 0 for player inventory. */ + private int windowId; + + /** Id of the clicked slot */ + private int slotId; + + /** Button used */ + private int usedButton; + + /** A unique number for the action, used for transaction handling */ + private short actionNumber; + + /** The item stack present in the slot */ + private ItemStack clickedItem; + + /** Inventory operation mode */ + private int mode; + + public C0EPacketClickWindow() + { + } + + public C0EPacketClickWindow(int windowId, int slotId, int usedButton, int mode, ItemStack clickedItem, short actionNumber) + { + this.windowId = windowId; + this.slotId = slotId; + this.usedButton = usedButton; + this.clickedItem = clickedItem != null ? clickedItem.copy() : null; + this.actionNumber = actionNumber; + this.mode = mode; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processClickWindow(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.windowId = buf.readByte(); + this.slotId = buf.readShort(); + this.usedButton = buf.readByte(); + this.actionNumber = buf.readShort(); + this.mode = buf.readByte(); + this.clickedItem = buf.readItemStackFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.windowId); + buf.writeShort(this.slotId); + buf.writeByte(this.usedButton); + buf.writeShort(this.actionNumber); + buf.writeByte(this.mode); + buf.writeItemStackToBuffer(this.clickedItem); + } + + public int getWindowId() + { + return this.windowId; + } + + public int getSlotId() + { + return this.slotId; + } + + public int getUsedButton() + { + return this.usedButton; + } + + public short getActionNumber() + { + return this.actionNumber; + } + + public ItemStack getClickedItem() + { + return this.clickedItem; + } + + public int getMode() + { + return this.mode; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C0FPacketConfirmTransaction.java b/src/minecraft/net/minecraft/network/play/client/C0FPacketConfirmTransaction.java new file mode 100644 index 0000000..2709d64 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C0FPacketConfirmTransaction.java @@ -0,0 +1,62 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C0FPacketConfirmTransaction implements Packet +{ + private int windowId; + private short uid; + private boolean accepted; + + public C0FPacketConfirmTransaction() + { + } + + public C0FPacketConfirmTransaction(int windowId, short uid, boolean accepted) + { + this.windowId = windowId; + this.uid = uid; + this.accepted = accepted; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processConfirmTransaction(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.windowId = buf.readByte(); + this.uid = buf.readShort(); + this.accepted = buf.readByte() != 0; + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.windowId); + buf.writeShort(this.uid); + buf.writeByte(this.accepted ? 1 : 0); + } + + public int getWindowId() + { + return this.windowId; + } + + public short getUid() + { + return this.uid; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C10PacketCreativeInventoryAction.java b/src/minecraft/net/minecraft/network/play/client/C10PacketCreativeInventoryAction.java new file mode 100644 index 0000000..eee17f0 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C10PacketCreativeInventoryAction.java @@ -0,0 +1,59 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.item.ItemStack; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C10PacketCreativeInventoryAction implements Packet +{ + private int slotId; + private ItemStack stack; + + public C10PacketCreativeInventoryAction() + { + } + + public C10PacketCreativeInventoryAction(int slotIdIn, ItemStack stackIn) + { + this.slotId = slotIdIn; + this.stack = stackIn != null ? stackIn.copy() : null; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processCreativeInventoryAction(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.slotId = buf.readShort(); + this.stack = buf.readItemStackFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeShort(this.slotId); + buf.writeItemStackToBuffer(this.stack); + } + + public int getSlotId() + { + return this.slotId; + } + + public ItemStack getStack() + { + return this.stack; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C11PacketEnchantItem.java b/src/minecraft/net/minecraft/network/play/client/C11PacketEnchantItem.java new file mode 100644 index 0000000..297e937 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C11PacketEnchantItem.java @@ -0,0 +1,58 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C11PacketEnchantItem implements Packet +{ + private int windowId; + private int button; + + public C11PacketEnchantItem() + { + } + + public C11PacketEnchantItem(int windowId, int button) + { + this.windowId = windowId; + this.button = button; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processEnchantItem(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.windowId = buf.readByte(); + this.button = buf.readByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.windowId); + buf.writeByte(this.button); + } + + public int getWindowId() + { + return this.windowId; + } + + public int getButton() + { + return this.button; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java b/src/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java new file mode 100644 index 0000000..922fcd0 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C12PacketUpdateSign.java @@ -0,0 +1,73 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IChatComponent; + +public class C12PacketUpdateSign implements Packet +{ + private BlockPos pos; + private IChatComponent[] lines; + + public C12PacketUpdateSign() + { + } + + public C12PacketUpdateSign(BlockPos pos, IChatComponent[] lines) + { + this.pos = pos; + this.lines = new IChatComponent[] {lines[0], lines[1], lines[2], lines[3]}; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.pos = buf.readBlockPos(); + this.lines = new IChatComponent[4]; + + for (int i = 0; i < 4; ++i) + { + String s = buf.readStringFromBuffer(384); + IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s); + this.lines[i] = ichatcomponent; + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeBlockPos(this.pos); + + for (int i = 0; i < 4; ++i) + { + IChatComponent ichatcomponent = this.lines[i]; + String s = IChatComponent.Serializer.componentToJson(ichatcomponent); + buf.writeString(s); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processUpdateSign(this); + } + + public BlockPos getPosition() + { + return this.pos; + } + + public IChatComponent[] getLines() + { + return this.lines; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C13PacketPlayerAbilities.java b/src/minecraft/net/minecraft/network/play/client/C13PacketPlayerAbilities.java new file mode 100644 index 0000000..2945cd7 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C13PacketPlayerAbilities.java @@ -0,0 +1,135 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.entity.player.PlayerCapabilities; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C13PacketPlayerAbilities implements Packet +{ + private boolean invulnerable; + private boolean flying; + private boolean allowFlying; + private boolean creativeMode; + private float flySpeed; + private float walkSpeed; + + public C13PacketPlayerAbilities() + { + } + + public C13PacketPlayerAbilities(PlayerCapabilities capabilities) + { + this.setInvulnerable(capabilities.disableDamage); + this.setFlying(capabilities.isFlying); + this.setAllowFlying(capabilities.allowFlying); + this.setCreativeMode(capabilities.isCreativeMode); + this.setFlySpeed(capabilities.getFlySpeed()); + this.setWalkSpeed(capabilities.getWalkSpeed()); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + byte b0 = buf.readByte(); + this.setInvulnerable((b0 & 1) > 0); + this.setFlying((b0 & 2) > 0); + this.setAllowFlying((b0 & 4) > 0); + this.setCreativeMode((b0 & 8) > 0); + this.setFlySpeed(buf.readFloat()); + this.setWalkSpeed(buf.readFloat()); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + byte b0 = 0; + + if (this.isInvulnerable()) + { + b0 = (byte)(b0 | 1); + } + + if (this.isFlying()) + { + b0 = (byte)(b0 | 2); + } + + if (this.isAllowFlying()) + { + b0 = (byte)(b0 | 4); + } + + if (this.isCreativeMode()) + { + b0 = (byte)(b0 | 8); + } + + buf.writeByte(b0); + buf.writeFloat(this.flySpeed); + buf.writeFloat(this.walkSpeed); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processPlayerAbilities(this); + } + + public boolean isInvulnerable() + { + return this.invulnerable; + } + + public void setInvulnerable(boolean isInvulnerable) + { + this.invulnerable = isInvulnerable; + } + + public boolean isFlying() + { + return this.flying; + } + + public void setFlying(boolean isFlying) + { + this.flying = isFlying; + } + + public boolean isAllowFlying() + { + return this.allowFlying; + } + + public void setAllowFlying(boolean isAllowFlying) + { + this.allowFlying = isAllowFlying; + } + + public boolean isCreativeMode() + { + return this.creativeMode; + } + + public void setCreativeMode(boolean isCreativeMode) + { + this.creativeMode = isCreativeMode; + } + + public void setFlySpeed(float flySpeedIn) + { + this.flySpeed = flySpeedIn; + } + + public void setWalkSpeed(float walkSpeedIn) + { + this.walkSpeed = walkSpeedIn; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C14PacketTabComplete.java b/src/minecraft/net/minecraft/network/play/client/C14PacketTabComplete.java new file mode 100644 index 0000000..7538021 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C14PacketTabComplete.java @@ -0,0 +1,76 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; +import net.minecraft.util.BlockPos; +import org.apache.commons.lang3.StringUtils; + +public class C14PacketTabComplete implements Packet +{ + private String message; + private BlockPos targetBlock; + + public C14PacketTabComplete() + { + } + + public C14PacketTabComplete(String msg) + { + this(msg, (BlockPos)null); + } + + public C14PacketTabComplete(String msg, BlockPos target) + { + this.message = msg; + this.targetBlock = target; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.message = buf.readStringFromBuffer(32767); + boolean flag = buf.readBoolean(); + + if (flag) + { + this.targetBlock = buf.readBlockPos(); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(StringUtils.substring(this.message, 0, 32767)); + boolean flag = this.targetBlock != null; + buf.writeBoolean(flag); + + if (flag) + { + buf.writeBlockPos(this.targetBlock); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processTabComplete(this); + } + + public String getMessage() + { + return this.message; + } + + public BlockPos getTargetBlock() + { + return this.targetBlock; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C15PacketClientSettings.java b/src/minecraft/net/minecraft/network/play/client/C15PacketClientSettings.java new file mode 100644 index 0000000..1eb7070 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C15PacketClientSettings.java @@ -0,0 +1,81 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C15PacketClientSettings implements Packet +{ + private String lang; + private int view; + private EntityPlayer.EnumChatVisibility chatVisibility; + private boolean enableColors; + private int modelPartFlags; + + public C15PacketClientSettings() + { + } + + public C15PacketClientSettings(String langIn, int viewIn, EntityPlayer.EnumChatVisibility chatVisibilityIn, boolean enableColorsIn, int modelPartFlagsIn) + { + this.lang = langIn; + this.view = viewIn; + this.chatVisibility = chatVisibilityIn; + this.enableColors = enableColorsIn; + this.modelPartFlags = modelPartFlagsIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.lang = buf.readStringFromBuffer(7); + this.view = buf.readByte(); + this.chatVisibility = EntityPlayer.EnumChatVisibility.getEnumChatVisibility(buf.readByte()); + this.enableColors = buf.readBoolean(); + this.modelPartFlags = buf.readUnsignedByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.lang); + buf.writeByte(this.view); + buf.writeByte(this.chatVisibility.getChatVisibility()); + buf.writeBoolean(this.enableColors); + buf.writeByte(this.modelPartFlags); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processClientSettings(this); + } + + public String getLang() + { + return this.lang; + } + + public EntityPlayer.EnumChatVisibility getChatVisibility() + { + return this.chatVisibility; + } + + public boolean isColorsEnabled() + { + return this.enableColors; + } + + public int getModelPartFlags() + { + return this.modelPartFlags; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C16PacketClientStatus.java b/src/minecraft/net/minecraft/network/play/client/C16PacketClientStatus.java new file mode 100644 index 0000000..5699cb7 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C16PacketClientStatus.java @@ -0,0 +1,56 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C16PacketClientStatus implements Packet +{ + private C16PacketClientStatus.EnumState status; + + public C16PacketClientStatus() + { + } + + public C16PacketClientStatus(C16PacketClientStatus.EnumState statusIn) + { + this.status = statusIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.status = (C16PacketClientStatus.EnumState)buf.readEnumValue(C16PacketClientStatus.EnumState.class); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeEnumValue(this.status); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processClientStatus(this); + } + + public C16PacketClientStatus.EnumState getStatus() + { + return this.status; + } + + public static enum EnumState + { + PERFORM_RESPAWN, + REQUEST_STATS, + OPEN_INVENTORY_ACHIEVEMENT; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java b/src/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java new file mode 100644 index 0000000..fd94c33 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C17PacketCustomPayload.java @@ -0,0 +1,73 @@ +package net.minecraft.network.play.client; + +import io.netty.buffer.ByteBuf; +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C17PacketCustomPayload implements Packet +{ + private String channel; + private PacketBuffer data; + + public C17PacketCustomPayload() + { + } + + public C17PacketCustomPayload(String channelIn, PacketBuffer dataIn) + { + this.channel = channelIn; + this.data = dataIn; + + if (dataIn.writerIndex() > 32767) + { + throw new IllegalArgumentException("Payload may not be larger than 32767 bytes"); + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.channel = buf.readStringFromBuffer(20); + int i = buf.readableBytes(); + + if (i >= 0 && i <= 32767) + { + this.data = new PacketBuffer(buf.readBytes(i)); + } + else + { + throw new IOException("Payload may not be larger than 32767 bytes"); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.channel); + buf.writeBytes((ByteBuf)this.data); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.processVanilla250Packet(this); + } + + public String getChannelName() + { + return this.channel; + } + + public PacketBuffer getBufferData() + { + return this.data; + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C18PacketSpectate.java b/src/minecraft/net/minecraft/network/play/client/C18PacketSpectate.java new file mode 100644 index 0000000..58422a5 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C18PacketSpectate.java @@ -0,0 +1,52 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import java.util.UUID; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; +import net.minecraft.world.WorldServer; + +public class C18PacketSpectate implements Packet +{ + private UUID id; + + public C18PacketSpectate() + { + } + + public C18PacketSpectate(UUID id) + { + this.id = id; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.id = buf.readUuid(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeUuid(this.id); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.handleSpectate(this); + } + + public Entity getEntity(WorldServer worldIn) + { + return worldIn.getEntityFromUuid(this.id); + } +} diff --git a/src/minecraft/net/minecraft/network/play/client/C19PacketResourcePackStatus.java b/src/minecraft/net/minecraft/network/play/client/C19PacketResourcePackStatus.java new file mode 100644 index 0000000..bf3aa5e --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/client/C19PacketResourcePackStatus.java @@ -0,0 +1,61 @@ +package net.minecraft.network.play.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayServer; + +public class C19PacketResourcePackStatus implements Packet +{ + private String hash; + private C19PacketResourcePackStatus.Action status; + + public C19PacketResourcePackStatus() + { + } + + public C19PacketResourcePackStatus(String hashIn, C19PacketResourcePackStatus.Action statusIn) + { + if (hashIn.length() > 40) + { + hashIn = hashIn.substring(0, 40); + } + + this.hash = hashIn; + this.status = statusIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.hash = buf.readStringFromBuffer(40); + this.status = (C19PacketResourcePackStatus.Action)buf.readEnumValue(C19PacketResourcePackStatus.Action.class); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.hash); + buf.writeEnumValue(this.status); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayServer handler) + { + handler.handleResourcePackStatus(this); + } + + public static enum Action + { + SUCCESSFULLY_LOADED, + DECLINED, + FAILED_DOWNLOAD, + ACCEPTED; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S00PacketKeepAlive.java b/src/minecraft/net/minecraft/network/play/server/S00PacketKeepAlive.java new file mode 100644 index 0000000..0be904b --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S00PacketKeepAlive.java @@ -0,0 +1,49 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S00PacketKeepAlive implements Packet +{ + private int id; + + public S00PacketKeepAlive() + { + } + + public S00PacketKeepAlive(int idIn) + { + this.id = idIn; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleKeepAlive(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.id = buf.readVarIntFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.id); + } + + public int func_149134_c() + { + return this.id; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S01PacketJoinGame.java b/src/minecraft/net/minecraft/network/play/server/S01PacketJoinGame.java new file mode 100644 index 0000000..076d0c9 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S01PacketJoinGame.java @@ -0,0 +1,129 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.WorldType; + +public class S01PacketJoinGame implements Packet +{ + private int entityId; + private boolean hardcoreMode; + private WorldSettings.GameType gameType; + private int dimension; + private EnumDifficulty difficulty; + private int maxPlayers; + private WorldType worldType; + private boolean reducedDebugInfo; + + public S01PacketJoinGame() + { + } + + public S01PacketJoinGame(int entityIdIn, WorldSettings.GameType gameTypeIn, boolean hardcoreModeIn, int dimensionIn, EnumDifficulty difficultyIn, int maxPlayersIn, WorldType worldTypeIn, boolean reducedDebugInfoIn) + { + this.entityId = entityIdIn; + this.dimension = dimensionIn; + this.difficulty = difficultyIn; + this.gameType = gameTypeIn; + this.maxPlayers = maxPlayersIn; + this.hardcoreMode = hardcoreModeIn; + this.worldType = worldTypeIn; + this.reducedDebugInfo = reducedDebugInfoIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readInt(); + int i = buf.readUnsignedByte(); + this.hardcoreMode = (i & 8) == 8; + i = i & -9; + this.gameType = WorldSettings.GameType.getByID(i); + this.dimension = buf.readByte(); + this.difficulty = EnumDifficulty.getDifficultyEnum(buf.readUnsignedByte()); + this.maxPlayers = buf.readUnsignedByte(); + this.worldType = WorldType.parseWorldType(buf.readStringFromBuffer(16)); + + if (this.worldType == null) + { + this.worldType = WorldType.DEFAULT; + } + + this.reducedDebugInfo = buf.readBoolean(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeInt(this.entityId); + int i = this.gameType.getID(); + + if (this.hardcoreMode) + { + i |= 8; + } + + buf.writeByte(i); + buf.writeByte(this.dimension); + buf.writeByte(this.difficulty.getDifficultyId()); + buf.writeByte(this.maxPlayers); + buf.writeString(this.worldType.getWorldTypeName()); + buf.writeBoolean(this.reducedDebugInfo); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleJoinGame(this); + } + + public int getEntityId() + { + return this.entityId; + } + + public boolean isHardcoreMode() + { + return this.hardcoreMode; + } + + public WorldSettings.GameType getGameType() + { + return this.gameType; + } + + public int getDimension() + { + return this.dimension; + } + + public EnumDifficulty getDifficulty() + { + return this.difficulty; + } + + public int getMaxPlayers() + { + return this.maxPlayers; + } + + public WorldType getWorldType() + { + return this.worldType; + } + + public boolean isReducedDebugInfo() + { + return this.reducedDebugInfo; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S02PacketChat.java b/src/minecraft/net/minecraft/network/play/server/S02PacketChat.java new file mode 100644 index 0000000..649db79 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S02PacketChat.java @@ -0,0 +1,73 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.IChatComponent; + +public class S02PacketChat implements Packet +{ + private IChatComponent chatComponent; + private byte type; + + public S02PacketChat() + { + } + + public S02PacketChat(IChatComponent component) + { + this(component, (byte)1); + } + + public S02PacketChat(IChatComponent message, byte typeIn) + { + this.chatComponent = message; + this.type = typeIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.chatComponent = buf.readChatComponent(); + this.type = buf.readByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeChatComponent(this.chatComponent); + buf.writeByte(this.type); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleChat(this); + } + + public IChatComponent getChatComponent() + { + return this.chatComponent; + } + + public boolean isChat() + { + return this.type == 1 || this.type == 2; + } + + /** + * Returns the id of the area to display the text, 2 for above the action bar, anything else currently for the chat + * window + */ + public byte getType() + { + return this.type; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S03PacketTimeUpdate.java b/src/minecraft/net/minecraft/network/play/server/S03PacketTimeUpdate.java new file mode 100644 index 0000000..4a34d35 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S03PacketTimeUpdate.java @@ -0,0 +1,68 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S03PacketTimeUpdate implements Packet +{ + private long totalWorldTime; + private long worldTime; + + public S03PacketTimeUpdate() + { + } + + public S03PacketTimeUpdate(long totalWorldTimeIn, long totalTimeIn, boolean doDayLightCycle) + { + this.totalWorldTime = totalWorldTimeIn; + this.worldTime = totalTimeIn; + + if (!doDayLightCycle) + { + this.worldTime = -this.worldTime; + + if (this.worldTime == 0L) + { + this.worldTime = -1L; + } + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.totalWorldTime = buf.readLong(); + this.worldTime = buf.readLong(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeLong(this.totalWorldTime); + buf.writeLong(this.worldTime); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleTimeUpdate(this); + } + + public long getTotalWorldTime() + { + return this.totalWorldTime; + } + + public long getWorldTime() + { + return this.worldTime; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S04PacketEntityEquipment.java b/src/minecraft/net/minecraft/network/play/server/S04PacketEntityEquipment.java new file mode 100644 index 0000000..2abcd3f --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S04PacketEntityEquipment.java @@ -0,0 +1,68 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.item.ItemStack; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S04PacketEntityEquipment implements Packet +{ + private int entityID; + private int equipmentSlot; + private ItemStack itemStack; + + public S04PacketEntityEquipment() + { + } + + public S04PacketEntityEquipment(int entityIDIn, int p_i45221_2_, ItemStack itemStackIn) + { + this.entityID = entityIDIn; + this.equipmentSlot = p_i45221_2_; + this.itemStack = itemStackIn == null ? null : itemStackIn.copy(); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityID = buf.readVarIntFromBuffer(); + this.equipmentSlot = buf.readShort(); + this.itemStack = buf.readItemStackFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityID); + buf.writeShort(this.equipmentSlot); + buf.writeItemStackToBuffer(this.itemStack); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleEntityEquipment(this); + } + + public ItemStack getItemStack() + { + return this.itemStack; + } + + public int getEntityID() + { + return this.entityID; + } + + public int getEquipmentSlot() + { + return this.equipmentSlot; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S05PacketSpawnPosition.java b/src/minecraft/net/minecraft/network/play/server/S05PacketSpawnPosition.java new file mode 100644 index 0000000..ff16656 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S05PacketSpawnPosition.java @@ -0,0 +1,50 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.BlockPos; + +public class S05PacketSpawnPosition implements Packet +{ + private BlockPos spawnBlockPos; + + public S05PacketSpawnPosition() + { + } + + public S05PacketSpawnPosition(BlockPos spawnBlockPosIn) + { + this.spawnBlockPos = spawnBlockPosIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.spawnBlockPos = buf.readBlockPos(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeBlockPos(this.spawnBlockPos); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleSpawnPosition(this); + } + + public BlockPos getSpawnPos() + { + return this.spawnBlockPos; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S06PacketUpdateHealth.java b/src/minecraft/net/minecraft/network/play/server/S06PacketUpdateHealth.java new file mode 100644 index 0000000..59deeaf --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S06PacketUpdateHealth.java @@ -0,0 +1,67 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S06PacketUpdateHealth implements Packet +{ + private float health; + private int foodLevel; + private float saturationLevel; + + public S06PacketUpdateHealth() + { + } + + public S06PacketUpdateHealth(float healthIn, int foodLevelIn, float saturationIn) + { + this.health = healthIn; + this.foodLevel = foodLevelIn; + this.saturationLevel = saturationIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.health = buf.readFloat(); + this.foodLevel = buf.readVarIntFromBuffer(); + this.saturationLevel = buf.readFloat(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeFloat(this.health); + buf.writeVarIntToBuffer(this.foodLevel); + buf.writeFloat(this.saturationLevel); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleUpdateHealth(this); + } + + public float getHealth() + { + return this.health; + } + + public int getFoodLevel() + { + return this.foodLevel; + } + + public float getSaturationLevel() + { + return this.saturationLevel; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S07PacketRespawn.java b/src/minecraft/net/minecraft/network/play/server/S07PacketRespawn.java new file mode 100644 index 0000000..c2fe3d1 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S07PacketRespawn.java @@ -0,0 +1,84 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.WorldType; + +public class S07PacketRespawn implements Packet +{ + private int dimensionID; + private EnumDifficulty difficulty; + private WorldSettings.GameType gameType; + private WorldType worldType; + + public S07PacketRespawn() + { + } + + public S07PacketRespawn(int dimensionIDIn, EnumDifficulty difficultyIn, WorldType worldTypeIn, WorldSettings.GameType gameTypeIn) + { + this.dimensionID = dimensionIDIn; + this.difficulty = difficultyIn; + this.gameType = gameTypeIn; + this.worldType = worldTypeIn; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleRespawn(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.dimensionID = buf.readInt(); + this.difficulty = EnumDifficulty.getDifficultyEnum(buf.readUnsignedByte()); + this.gameType = WorldSettings.GameType.getByID(buf.readUnsignedByte()); + this.worldType = WorldType.parseWorldType(buf.readStringFromBuffer(16)); + + if (this.worldType == null) + { + this.worldType = WorldType.DEFAULT; + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeInt(this.dimensionID); + buf.writeByte(this.difficulty.getDifficultyId()); + buf.writeByte(this.gameType.getID()); + buf.writeString(this.worldType.getWorldTypeName()); + } + + public int getDimensionID() + { + return this.dimensionID; + } + + public EnumDifficulty getDifficulty() + { + return this.difficulty; + } + + public WorldSettings.GameType getGameType() + { + return this.gameType; + } + + public WorldType getWorldType() + { + return this.worldType; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S08PacketPlayerPosLook.java b/src/minecraft/net/minecraft/network/play/server/S08PacketPlayerPosLook.java new file mode 100644 index 0000000..8057933 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S08PacketPlayerPosLook.java @@ -0,0 +1,149 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import java.util.EnumSet; +import java.util.Set; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S08PacketPlayerPosLook implements Packet +{ + private double x; + private double y; + private double z; + private float yaw; + private float pitch; + private Set field_179835_f; + + public S08PacketPlayerPosLook() + { + } + + public S08PacketPlayerPosLook(double xIn, double yIn, double zIn, float yawIn, float pitchIn, Set p_i45993_9_) + { + this.x = xIn; + this.y = yIn; + this.z = zIn; + this.yaw = yawIn; + this.pitch = pitchIn; + this.field_179835_f = p_i45993_9_; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.x = buf.readDouble(); + this.y = buf.readDouble(); + this.z = buf.readDouble(); + this.yaw = buf.readFloat(); + this.pitch = buf.readFloat(); + this.field_179835_f = S08PacketPlayerPosLook.EnumFlags.func_180053_a(buf.readUnsignedByte()); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeDouble(this.x); + buf.writeDouble(this.y); + buf.writeDouble(this.z); + buf.writeFloat(this.yaw); + buf.writeFloat(this.pitch); + buf.writeByte(S08PacketPlayerPosLook.EnumFlags.func_180056_a(this.field_179835_f)); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handlePlayerPosLook(this); + } + + public double getX() + { + return this.x; + } + + public double getY() + { + return this.y; + } + + public double getZ() + { + return this.z; + } + + public float getYaw() + { + return this.yaw; + } + + public float getPitch() + { + return this.pitch; + } + + public Set func_179834_f() + { + return this.field_179835_f; + } + + public static enum EnumFlags + { + X(0), + Y(1), + Z(2), + Y_ROT(3), + X_ROT(4); + + private int field_180058_f; + + private EnumFlags(int p_i45992_3_) + { + this.field_180058_f = p_i45992_3_; + } + + private int func_180055_a() + { + return 1 << this.field_180058_f; + } + + private boolean func_180054_b(int p_180054_1_) + { + return (p_180054_1_ & this.func_180055_a()) == this.func_180055_a(); + } + + public static Set func_180053_a(int p_180053_0_) + { + Set set = EnumSet.noneOf(S08PacketPlayerPosLook.EnumFlags.class); + + for (S08PacketPlayerPosLook.EnumFlags s08packetplayerposlook$enumflags : values()) + { + if (s08packetplayerposlook$enumflags.func_180054_b(p_180053_0_)) + { + set.add(s08packetplayerposlook$enumflags); + } + } + + return set; + } + + public static int func_180056_a(Set p_180056_0_) + { + int i = 0; + + for (S08PacketPlayerPosLook.EnumFlags s08packetplayerposlook$enumflags : p_180056_0_) + { + i |= s08packetplayerposlook$enumflags.func_180055_a(); + } + + return i; + } + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S09PacketHeldItemChange.java b/src/minecraft/net/minecraft/network/play/server/S09PacketHeldItemChange.java new file mode 100644 index 0000000..04b4419 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S09PacketHeldItemChange.java @@ -0,0 +1,49 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S09PacketHeldItemChange implements Packet +{ + private int heldItemHotbarIndex; + + public S09PacketHeldItemChange() + { + } + + public S09PacketHeldItemChange(int hotbarIndexIn) + { + this.heldItemHotbarIndex = hotbarIndexIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.heldItemHotbarIndex = buf.readByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.heldItemHotbarIndex); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleHeldItemChange(this); + } + + public int getHeldItemHotbarIndex() + { + return this.heldItemHotbarIndex; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S0APacketUseBed.java b/src/minecraft/net/minecraft/network/play/server/S0APacketUseBed.java new file mode 100644 index 0000000..6e5a47e --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S0APacketUseBed.java @@ -0,0 +1,63 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class S0APacketUseBed implements Packet +{ + private int playerID; + + /** Block location of the head part of the bed */ + private BlockPos bedPos; + + public S0APacketUseBed() + { + } + + public S0APacketUseBed(EntityPlayer player, BlockPos bedPosIn) + { + this.playerID = player.getEntityId(); + this.bedPos = bedPosIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.playerID = buf.readVarIntFromBuffer(); + this.bedPos = buf.readBlockPos(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.playerID); + buf.writeBlockPos(this.bedPos); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleUseBed(this); + } + + public EntityPlayer getPlayer(World worldIn) + { + return (EntityPlayer)worldIn.getEntityByID(this.playerID); + } + + public BlockPos getBedPosition() + { + return this.bedPos; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S0BPacketAnimation.java b/src/minecraft/net/minecraft/network/play/server/S0BPacketAnimation.java new file mode 100644 index 0000000..50b5acf --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S0BPacketAnimation.java @@ -0,0 +1,59 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S0BPacketAnimation implements Packet +{ + private int entityId; + private int type; + + public S0BPacketAnimation() + { + } + + public S0BPacketAnimation(Entity ent, int animationType) + { + this.entityId = ent.getEntityId(); + this.type = animationType; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + this.type = buf.readUnsignedByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + buf.writeByte(this.type); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleAnimation(this); + } + + public int getEntityID() + { + return this.entityId; + } + + public int getAnimationType() + { + return this.type; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S0CPacketSpawnPlayer.java b/src/minecraft/net/minecraft/network/play/server/S0CPacketSpawnPlayer.java new file mode 100644 index 0000000..288ef2f --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S0CPacketSpawnPlayer.java @@ -0,0 +1,135 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import net.minecraft.entity.DataWatcher; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.MathHelper; + +public class S0CPacketSpawnPlayer implements Packet +{ + private int entityId; + private UUID playerId; + private int x; + private int y; + private int z; + private byte yaw; + private byte pitch; + private int currentItem; + private DataWatcher watcher; + private List field_148958_j; + + public S0CPacketSpawnPlayer() + { + } + + public S0CPacketSpawnPlayer(EntityPlayer player) + { + this.entityId = player.getEntityId(); + this.playerId = player.getGameProfile().getId(); + this.x = MathHelper.floor_double(player.posX * 32.0D); + this.y = MathHelper.floor_double(player.posY * 32.0D); + this.z = MathHelper.floor_double(player.posZ * 32.0D); + this.yaw = (byte)((int)(player.rotationYaw * 256.0F / 360.0F)); + this.pitch = (byte)((int)(player.rotationPitch * 256.0F / 360.0F)); + ItemStack itemstack = player.inventory.getCurrentItem(); + this.currentItem = itemstack == null ? 0 : Item.getIdFromItem(itemstack.getItem()); + this.watcher = player.getDataWatcher(); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + this.playerId = buf.readUuid(); + this.x = buf.readInt(); + this.y = buf.readInt(); + this.z = buf.readInt(); + this.yaw = buf.readByte(); + this.pitch = buf.readByte(); + this.currentItem = buf.readShort(); + this.field_148958_j = DataWatcher.readWatchedListFromPacketBuffer(buf); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + buf.writeUuid(this.playerId); + buf.writeInt(this.x); + buf.writeInt(this.y); + buf.writeInt(this.z); + buf.writeByte(this.yaw); + buf.writeByte(this.pitch); + buf.writeShort(this.currentItem); + this.watcher.writeTo(buf); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleSpawnPlayer(this); + } + + public List func_148944_c() + { + if (this.field_148958_j == null) + { + this.field_148958_j = this.watcher.getAllWatched(); + } + + return this.field_148958_j; + } + + public int getEntityID() + { + return this.entityId; + } + + public UUID getPlayer() + { + return this.playerId; + } + + public int getX() + { + return this.x; + } + + public int getY() + { + return this.y; + } + + public int getZ() + { + return this.z; + } + + public byte getYaw() + { + return this.yaw; + } + + public byte getPitch() + { + return this.pitch; + } + + public int getCurrentItemID() + { + return this.currentItem; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S0DPacketCollectItem.java b/src/minecraft/net/minecraft/network/play/server/S0DPacketCollectItem.java new file mode 100644 index 0000000..801d6c4 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S0DPacketCollectItem.java @@ -0,0 +1,58 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S0DPacketCollectItem implements Packet +{ + private int collectedItemEntityId; + private int entityId; + + public S0DPacketCollectItem() + { + } + + public S0DPacketCollectItem(int collectedItemEntityIdIn, int entityIdIn) + { + this.collectedItemEntityId = collectedItemEntityIdIn; + this.entityId = entityIdIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.collectedItemEntityId = buf.readVarIntFromBuffer(); + this.entityId = buf.readVarIntFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.collectedItemEntityId); + buf.writeVarIntToBuffer(this.entityId); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleCollectItem(this); + } + + public int getCollectedItemEntityID() + { + return this.collectedItemEntityId; + } + + public int getEntityID() + { + return this.entityId; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S0EPacketSpawnObject.java b/src/minecraft/net/minecraft/network/play/server/S0EPacketSpawnObject.java new file mode 100644 index 0000000..e64c212 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S0EPacketSpawnObject.java @@ -0,0 +1,228 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.MathHelper; + +public class S0EPacketSpawnObject implements Packet +{ + private int entityId; + private int x; + private int y; + private int z; + private int speedX; + private int speedY; + private int speedZ; + private int pitch; + private int yaw; + private int type; + private int field_149020_k; + + public S0EPacketSpawnObject() + { + } + + public S0EPacketSpawnObject(Entity entityIn, int typeIn) + { + this(entityIn, typeIn, 0); + } + + public S0EPacketSpawnObject(Entity entityIn, int typeIn, int p_i45166_3_) + { + this.entityId = entityIn.getEntityId(); + this.x = MathHelper.floor_double(entityIn.posX * 32.0D); + this.y = MathHelper.floor_double(entityIn.posY * 32.0D); + this.z = MathHelper.floor_double(entityIn.posZ * 32.0D); + this.pitch = MathHelper.floor_float(entityIn.rotationPitch * 256.0F / 360.0F); + this.yaw = MathHelper.floor_float(entityIn.rotationYaw * 256.0F / 360.0F); + this.type = typeIn; + this.field_149020_k = p_i45166_3_; + + if (p_i45166_3_ > 0) + { + double d0 = entityIn.motionX; + double d1 = entityIn.motionY; + double d2 = entityIn.motionZ; + double d3 = 3.9D; + + if (d0 < -d3) + { + d0 = -d3; + } + + if (d1 < -d3) + { + d1 = -d3; + } + + if (d2 < -d3) + { + d2 = -d3; + } + + if (d0 > d3) + { + d0 = d3; + } + + if (d1 > d3) + { + d1 = d3; + } + + if (d2 > d3) + { + d2 = d3; + } + + this.speedX = (int)(d0 * 8000.0D); + this.speedY = (int)(d1 * 8000.0D); + this.speedZ = (int)(d2 * 8000.0D); + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + this.type = buf.readByte(); + this.x = buf.readInt(); + this.y = buf.readInt(); + this.z = buf.readInt(); + this.pitch = buf.readByte(); + this.yaw = buf.readByte(); + this.field_149020_k = buf.readInt(); + + if (this.field_149020_k > 0) + { + this.speedX = buf.readShort(); + this.speedY = buf.readShort(); + this.speedZ = buf.readShort(); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + buf.writeByte(this.type); + buf.writeInt(this.x); + buf.writeInt(this.y); + buf.writeInt(this.z); + buf.writeByte(this.pitch); + buf.writeByte(this.yaw); + buf.writeInt(this.field_149020_k); + + if (this.field_149020_k > 0) + { + buf.writeShort(this.speedX); + buf.writeShort(this.speedY); + buf.writeShort(this.speedZ); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleSpawnObject(this); + } + + public int getEntityID() + { + return this.entityId; + } + + public int getX() + { + return this.x; + } + + public int getY() + { + return this.y; + } + + public int getZ() + { + return this.z; + } + + public int getSpeedX() + { + return this.speedX; + } + + public int getSpeedY() + { + return this.speedY; + } + + public int getSpeedZ() + { + return this.speedZ; + } + + public int getPitch() + { + return this.pitch; + } + + public int getYaw() + { + return this.yaw; + } + + public int getType() + { + return this.type; + } + + public int func_149009_m() + { + return this.field_149020_k; + } + + public void setX(int newX) + { + this.x = newX; + } + + public void setY(int newY) + { + this.y = newY; + } + + public void setZ(int newZ) + { + this.z = newZ; + } + + public void setSpeedX(int newSpeedX) + { + this.speedX = newSpeedX; + } + + public void setSpeedY(int newSpeedY) + { + this.speedY = newSpeedY; + } + + public void setSpeedZ(int newSpeedZ) + { + this.speedZ = newSpeedZ; + } + + public void func_149002_g(int p_149002_1_) + { + this.field_149020_k = p_149002_1_; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S0FPacketSpawnMob.java b/src/minecraft/net/minecraft/network/play/server/S0FPacketSpawnMob.java new file mode 100644 index 0000000..2955358 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S0FPacketSpawnMob.java @@ -0,0 +1,194 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import java.util.List; +import net.minecraft.entity.DataWatcher; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.MathHelper; + +public class S0FPacketSpawnMob implements Packet +{ + private int entityId; + private int type; + private int x; + private int y; + private int z; + private int velocityX; + private int velocityY; + private int velocityZ; + private byte yaw; + private byte pitch; + private byte headPitch; + private DataWatcher field_149043_l; + private List watcher; + + public S0FPacketSpawnMob() + { + } + + public S0FPacketSpawnMob(EntityLivingBase entityIn) + { + this.entityId = entityIn.getEntityId(); + this.type = (byte)EntityList.getEntityID(entityIn); + this.x = MathHelper.floor_double(entityIn.posX * 32.0D); + this.y = MathHelper.floor_double(entityIn.posY * 32.0D); + this.z = MathHelper.floor_double(entityIn.posZ * 32.0D); + this.yaw = (byte)((int)(entityIn.rotationYaw * 256.0F / 360.0F)); + this.pitch = (byte)((int)(entityIn.rotationPitch * 256.0F / 360.0F)); + this.headPitch = (byte)((int)(entityIn.rotationYawHead * 256.0F / 360.0F)); + double d0 = 3.9D; + double d1 = entityIn.motionX; + double d2 = entityIn.motionY; + double d3 = entityIn.motionZ; + + if (d1 < -d0) + { + d1 = -d0; + } + + if (d2 < -d0) + { + d2 = -d0; + } + + if (d3 < -d0) + { + d3 = -d0; + } + + if (d1 > d0) + { + d1 = d0; + } + + if (d2 > d0) + { + d2 = d0; + } + + if (d3 > d0) + { + d3 = d0; + } + + this.velocityX = (int)(d1 * 8000.0D); + this.velocityY = (int)(d2 * 8000.0D); + this.velocityZ = (int)(d3 * 8000.0D); + this.field_149043_l = entityIn.getDataWatcher(); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + this.type = buf.readByte() & 255; + this.x = buf.readInt(); + this.y = buf.readInt(); + this.z = buf.readInt(); + this.yaw = buf.readByte(); + this.pitch = buf.readByte(); + this.headPitch = buf.readByte(); + this.velocityX = buf.readShort(); + this.velocityY = buf.readShort(); + this.velocityZ = buf.readShort(); + this.watcher = DataWatcher.readWatchedListFromPacketBuffer(buf); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + buf.writeByte(this.type & 255); + buf.writeInt(this.x); + buf.writeInt(this.y); + buf.writeInt(this.z); + buf.writeByte(this.yaw); + buf.writeByte(this.pitch); + buf.writeByte(this.headPitch); + buf.writeShort(this.velocityX); + buf.writeShort(this.velocityY); + buf.writeShort(this.velocityZ); + this.field_149043_l.writeTo(buf); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleSpawnMob(this); + } + + public List func_149027_c() + { + if (this.watcher == null) + { + this.watcher = this.field_149043_l.getAllWatched(); + } + + return this.watcher; + } + + public int getEntityID() + { + return this.entityId; + } + + public int getEntityType() + { + return this.type; + } + + public int getX() + { + return this.x; + } + + public int getY() + { + return this.y; + } + + public int getZ() + { + return this.z; + } + + public int getVelocityX() + { + return this.velocityX; + } + + public int getVelocityY() + { + return this.velocityY; + } + + public int getVelocityZ() + { + return this.velocityZ; + } + + public byte getYaw() + { + return this.yaw; + } + + public byte getPitch() + { + return this.pitch; + } + + public byte getHeadPitch() + { + return this.headPitch; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S10PacketSpawnPainting.java b/src/minecraft/net/minecraft/network/play/server/S10PacketSpawnPainting.java new file mode 100644 index 0000000..94ac573 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S10PacketSpawnPainting.java @@ -0,0 +1,79 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.item.EntityPainting; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; + +public class S10PacketSpawnPainting implements Packet +{ + private int entityID; + private BlockPos position; + private EnumFacing facing; + private String title; + + public S10PacketSpawnPainting() + { + } + + public S10PacketSpawnPainting(EntityPainting painting) + { + this.entityID = painting.getEntityId(); + this.position = painting.getHangingPosition(); + this.facing = painting.facingDirection; + this.title = painting.art.title; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityID = buf.readVarIntFromBuffer(); + this.title = buf.readStringFromBuffer(EntityPainting.EnumArt.field_180001_A); + this.position = buf.readBlockPos(); + this.facing = EnumFacing.getHorizontal(buf.readUnsignedByte()); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityID); + buf.writeString(this.title); + buf.writeBlockPos(this.position); + buf.writeByte(this.facing.getHorizontalIndex()); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleSpawnPainting(this); + } + + public int getEntityID() + { + return this.entityID; + } + + public BlockPos getPosition() + { + return this.position; + } + + public EnumFacing getFacing() + { + return this.facing; + } + + public String getTitle() + { + return this.title; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S11PacketSpawnExperienceOrb.java b/src/minecraft/net/minecraft/network/play/server/S11PacketSpawnExperienceOrb.java new file mode 100644 index 0000000..c287b27 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S11PacketSpawnExperienceOrb.java @@ -0,0 +1,87 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.MathHelper; + +public class S11PacketSpawnExperienceOrb implements Packet +{ + private int entityID; + private int posX; + private int posY; + private int posZ; + private int xpValue; + + public S11PacketSpawnExperienceOrb() + { + } + + public S11PacketSpawnExperienceOrb(EntityXPOrb xpOrb) + { + this.entityID = xpOrb.getEntityId(); + this.posX = MathHelper.floor_double(xpOrb.posX * 32.0D); + this.posY = MathHelper.floor_double(xpOrb.posY * 32.0D); + this.posZ = MathHelper.floor_double(xpOrb.posZ * 32.0D); + this.xpValue = xpOrb.getXpValue(); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityID = buf.readVarIntFromBuffer(); + this.posX = buf.readInt(); + this.posY = buf.readInt(); + this.posZ = buf.readInt(); + this.xpValue = buf.readShort(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityID); + buf.writeInt(this.posX); + buf.writeInt(this.posY); + buf.writeInt(this.posZ); + buf.writeShort(this.xpValue); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleSpawnExperienceOrb(this); + } + + public int getEntityID() + { + return this.entityID; + } + + public int getX() + { + return this.posX; + } + + public int getY() + { + return this.posY; + } + + public int getZ() + { + return this.posZ; + } + + public int getXPValue() + { + return this.xpValue; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S12PacketEntityVelocity.java b/src/minecraft/net/minecraft/network/play/server/S12PacketEntityVelocity.java new file mode 100644 index 0000000..6696c6d --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S12PacketEntityVelocity.java @@ -0,0 +1,114 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S12PacketEntityVelocity implements Packet +{ + private int entityID; + private int motionX; + private int motionY; + private int motionZ; + + public S12PacketEntityVelocity() + { + } + + public S12PacketEntityVelocity(Entity entityIn) + { + this(entityIn.getEntityId(), entityIn.motionX, entityIn.motionY, entityIn.motionZ); + } + + public S12PacketEntityVelocity(int entityIDIn, double motionXIn, double motionYIn, double motionZIn) + { + this.entityID = entityIDIn; + double d0 = 3.9D; + + if (motionXIn < -d0) + { + motionXIn = -d0; + } + + if (motionYIn < -d0) + { + motionYIn = -d0; + } + + if (motionZIn < -d0) + { + motionZIn = -d0; + } + + if (motionXIn > d0) + { + motionXIn = d0; + } + + if (motionYIn > d0) + { + motionYIn = d0; + } + + if (motionZIn > d0) + { + motionZIn = d0; + } + + this.motionX = (int)(motionXIn * 8000.0D); + this.motionY = (int)(motionYIn * 8000.0D); + this.motionZ = (int)(motionZIn * 8000.0D); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityID = buf.readVarIntFromBuffer(); + this.motionX = buf.readShort(); + this.motionY = buf.readShort(); + this.motionZ = buf.readShort(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityID); + buf.writeShort(this.motionX); + buf.writeShort(this.motionY); + buf.writeShort(this.motionZ); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleEntityVelocity(this); + } + + public int getEntityID() + { + return this.entityID; + } + + public int getMotionX() + { + return this.motionX; + } + + public int getMotionY() + { + return this.motionY; + } + + public int getMotionZ() + { + return this.motionZ; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S13PacketDestroyEntities.java b/src/minecraft/net/minecraft/network/play/server/S13PacketDestroyEntities.java new file mode 100644 index 0000000..cee8fa6 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S13PacketDestroyEntities.java @@ -0,0 +1,59 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S13PacketDestroyEntities implements Packet +{ + private int[] entityIDs; + + public S13PacketDestroyEntities() + { + } + + public S13PacketDestroyEntities(int... entityIDsIn) + { + this.entityIDs = entityIDsIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityIDs = new int[buf.readVarIntFromBuffer()]; + + for (int i = 0; i < this.entityIDs.length; ++i) + { + this.entityIDs[i] = buf.readVarIntFromBuffer(); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityIDs.length); + + for (int i = 0; i < this.entityIDs.length; ++i) + { + buf.writeVarIntToBuffer(this.entityIDs[i]); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleDestroyEntities(this); + } + + public int[] getEntityIDs() + { + return this.entityIDs; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S14PacketEntity.java b/src/minecraft/net/minecraft/network/play/server/S14PacketEntity.java new file mode 100644 index 0000000..7316733 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S14PacketEntity.java @@ -0,0 +1,207 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.world.World; + +public class S14PacketEntity implements Packet +{ + protected int entityId; + protected byte posX; + protected byte posY; + protected byte posZ; + protected byte yaw; + protected byte pitch; + protected boolean onGround; + protected boolean field_149069_g; + + public S14PacketEntity() + { + } + + public S14PacketEntity(int entityIdIn) + { + this.entityId = entityIdIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleEntityMovement(this); + } + + public String toString() + { + return "Entity_" + super.toString(); + } + + public Entity getEntity(World worldIn) + { + return worldIn.getEntityByID(this.entityId); + } + + public byte func_149062_c() + { + return this.posX; + } + + public byte func_149061_d() + { + return this.posY; + } + + public byte func_149064_e() + { + return this.posZ; + } + + public byte func_149066_f() + { + return this.yaw; + } + + public byte func_149063_g() + { + return this.pitch; + } + + public boolean func_149060_h() + { + return this.field_149069_g; + } + + public boolean getOnGround() + { + return this.onGround; + } + + public static class S15PacketEntityRelMove extends S14PacketEntity + { + public S15PacketEntityRelMove() + { + } + + public S15PacketEntityRelMove(int entityIdIn, byte x, byte y, byte z, boolean onGroundIn) + { + super(entityIdIn); + this.posX = x; + this.posY = y; + this.posZ = z; + this.onGround = onGroundIn; + } + + public void readPacketData(PacketBuffer buf) throws IOException + { + super.readPacketData(buf); + this.posX = buf.readByte(); + this.posY = buf.readByte(); + this.posZ = buf.readByte(); + this.onGround = buf.readBoolean(); + } + + public void writePacketData(PacketBuffer buf) throws IOException + { + super.writePacketData(buf); + buf.writeByte(this.posX); + buf.writeByte(this.posY); + buf.writeByte(this.posZ); + buf.writeBoolean(this.onGround); + } + } + + public static class S16PacketEntityLook extends S14PacketEntity + { + public S16PacketEntityLook() + { + this.field_149069_g = true; + } + + public S16PacketEntityLook(int entityIdIn, byte yawIn, byte pitchIn, boolean onGroundIn) + { + super(entityIdIn); + this.yaw = yawIn; + this.pitch = pitchIn; + this.field_149069_g = true; + this.onGround = onGroundIn; + } + + public void readPacketData(PacketBuffer buf) throws IOException + { + super.readPacketData(buf); + this.yaw = buf.readByte(); + this.pitch = buf.readByte(); + this.onGround = buf.readBoolean(); + } + + public void writePacketData(PacketBuffer buf) throws IOException + { + super.writePacketData(buf); + buf.writeByte(this.yaw); + buf.writeByte(this.pitch); + buf.writeBoolean(this.onGround); + } + } + + public static class S17PacketEntityLookMove extends S14PacketEntity + { + public S17PacketEntityLookMove() + { + this.field_149069_g = true; + } + + public S17PacketEntityLookMove(int p_i45973_1_, byte p_i45973_2_, byte p_i45973_3_, byte p_i45973_4_, byte p_i45973_5_, byte p_i45973_6_, boolean p_i45973_7_) + { + super(p_i45973_1_); + this.posX = p_i45973_2_; + this.posY = p_i45973_3_; + this.posZ = p_i45973_4_; + this.yaw = p_i45973_5_; + this.pitch = p_i45973_6_; + this.onGround = p_i45973_7_; + this.field_149069_g = true; + } + + public void readPacketData(PacketBuffer buf) throws IOException + { + super.readPacketData(buf); + this.posX = buf.readByte(); + this.posY = buf.readByte(); + this.posZ = buf.readByte(); + this.yaw = buf.readByte(); + this.pitch = buf.readByte(); + this.onGround = buf.readBoolean(); + } + + public void writePacketData(PacketBuffer buf) throws IOException + { + super.writePacketData(buf); + buf.writeByte(this.posX); + buf.writeByte(this.posY); + buf.writeByte(this.posZ); + buf.writeByte(this.yaw); + buf.writeByte(this.pitch); + buf.writeBoolean(this.onGround); + } + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S18PacketEntityTeleport.java b/src/minecraft/net/minecraft/network/play/server/S18PacketEntityTeleport.java new file mode 100644 index 0000000..6a8fbbc --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S18PacketEntityTeleport.java @@ -0,0 +1,116 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.MathHelper; + +public class S18PacketEntityTeleport implements Packet +{ + private int entityId; + private int posX; + private int posY; + private int posZ; + private byte yaw; + private byte pitch; + private boolean onGround; + + public S18PacketEntityTeleport() + { + } + + public S18PacketEntityTeleport(Entity entityIn) + { + this.entityId = entityIn.getEntityId(); + this.posX = MathHelper.floor_double(entityIn.posX * 32.0D); + this.posY = MathHelper.floor_double(entityIn.posY * 32.0D); + this.posZ = MathHelper.floor_double(entityIn.posZ * 32.0D); + this.yaw = (byte)((int)(entityIn.rotationYaw * 256.0F / 360.0F)); + this.pitch = (byte)((int)(entityIn.rotationPitch * 256.0F / 360.0F)); + this.onGround = entityIn.onGround; + } + + public S18PacketEntityTeleport(int entityIdIn, int posXIn, int posYIn, int posZIn, byte yawIn, byte pitchIn, boolean onGroundIn) + { + this.entityId = entityIdIn; + this.posX = posXIn; + this.posY = posYIn; + this.posZ = posZIn; + this.yaw = yawIn; + this.pitch = pitchIn; + this.onGround = onGroundIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + this.posX = buf.readInt(); + this.posY = buf.readInt(); + this.posZ = buf.readInt(); + this.yaw = buf.readByte(); + this.pitch = buf.readByte(); + this.onGround = buf.readBoolean(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + buf.writeInt(this.posX); + buf.writeInt(this.posY); + buf.writeInt(this.posZ); + buf.writeByte(this.yaw); + buf.writeByte(this.pitch); + buf.writeBoolean(this.onGround); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleEntityTeleport(this); + } + + public int getEntityId() + { + return this.entityId; + } + + public int getX() + { + return this.posX; + } + + public int getY() + { + return this.posY; + } + + public int getZ() + { + return this.posZ; + } + + public byte getYaw() + { + return this.yaw; + } + + public byte getPitch() + { + return this.pitch; + } + + public boolean getOnGround() + { + return this.onGround; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S19PacketEntityHeadLook.java b/src/minecraft/net/minecraft/network/play/server/S19PacketEntityHeadLook.java new file mode 100644 index 0000000..cfff1b4 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S19PacketEntityHeadLook.java @@ -0,0 +1,60 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.world.World; + +public class S19PacketEntityHeadLook implements Packet +{ + private int entityId; + private byte yaw; + + public S19PacketEntityHeadLook() + { + } + + public S19PacketEntityHeadLook(Entity entityIn, byte p_i45214_2_) + { + this.entityId = entityIn.getEntityId(); + this.yaw = p_i45214_2_; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + this.yaw = buf.readByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + buf.writeByte(this.yaw); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleEntityHeadLook(this); + } + + public Entity getEntity(World worldIn) + { + return worldIn.getEntityByID(this.entityId); + } + + public byte getYaw() + { + return this.yaw; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S19PacketEntityStatus.java b/src/minecraft/net/minecraft/network/play/server/S19PacketEntityStatus.java new file mode 100644 index 0000000..cedd479 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S19PacketEntityStatus.java @@ -0,0 +1,60 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.world.World; + +public class S19PacketEntityStatus implements Packet +{ + private int entityId; + private byte logicOpcode; + + public S19PacketEntityStatus() + { + } + + public S19PacketEntityStatus(Entity entityIn, byte opCodeIn) + { + this.entityId = entityIn.getEntityId(); + this.logicOpcode = opCodeIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readInt(); + this.logicOpcode = buf.readByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeInt(this.entityId); + buf.writeByte(this.logicOpcode); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleEntityStatus(this); + } + + public Entity getEntity(World worldIn) + { + return worldIn.getEntityByID(this.entityId); + } + + public byte getOpCode() + { + return this.logicOpcode; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S1BPacketEntityAttach.java b/src/minecraft/net/minecraft/network/play/server/S1BPacketEntityAttach.java new file mode 100644 index 0000000..f1c017b --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S1BPacketEntityAttach.java @@ -0,0 +1,68 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S1BPacketEntityAttach implements Packet +{ + private int leash; + private int entityId; + private int vehicleEntityId; + + public S1BPacketEntityAttach() + { + } + + public S1BPacketEntityAttach(int leashIn, Entity entityIn, Entity vehicle) + { + this.leash = leashIn; + this.entityId = entityIn.getEntityId(); + this.vehicleEntityId = vehicle != null ? vehicle.getEntityId() : -1; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readInt(); + this.vehicleEntityId = buf.readInt(); + this.leash = buf.readUnsignedByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeInt(this.entityId); + buf.writeInt(this.vehicleEntityId); + buf.writeByte(this.leash); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleEntityAttach(this); + } + + public int getLeash() + { + return this.leash; + } + + public int getEntityId() + { + return this.entityId; + } + + public int getVehicleEntityId() + { + return this.vehicleEntityId; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S1CPacketEntityMetadata.java b/src/minecraft/net/minecraft/network/play/server/S1CPacketEntityMetadata.java new file mode 100644 index 0000000..f953ed0 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S1CPacketEntityMetadata.java @@ -0,0 +1,68 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import java.util.List; +import net.minecraft.entity.DataWatcher; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S1CPacketEntityMetadata implements Packet +{ + private int entityId; + private List field_149378_b; + + public S1CPacketEntityMetadata() + { + } + + public S1CPacketEntityMetadata(int entityIdIn, DataWatcher p_i45217_2_, boolean p_i45217_3_) + { + this.entityId = entityIdIn; + + if (p_i45217_3_) + { + this.field_149378_b = p_i45217_2_.getAllWatched(); + } + else + { + this.field_149378_b = p_i45217_2_.getChanged(); + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + this.field_149378_b = DataWatcher.readWatchedListFromPacketBuffer(buf); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + DataWatcher.writeWatchedListToPacketBuffer(this.field_149378_b, buf); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleEntityMetadata(this); + } + + public List func_149376_c() + { + return this.field_149378_b; + } + + public int getEntityId() + { + return this.entityId; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S1DPacketEntityEffect.java b/src/minecraft/net/minecraft/network/play/server/S1DPacketEntityEffect.java new file mode 100644 index 0000000..9de4751 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S1DPacketEntityEffect.java @@ -0,0 +1,100 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.potion.PotionEffect; + +public class S1DPacketEntityEffect implements Packet +{ + private int entityId; + private byte effectId; + private byte amplifier; + private int duration; + private byte hideParticles; + + public S1DPacketEntityEffect() + { + } + + public S1DPacketEntityEffect(int entityIdIn, PotionEffect effect) + { + this.entityId = entityIdIn; + this.effectId = (byte)(effect.getPotionID() & 255); + this.amplifier = (byte)(effect.getAmplifier() & 255); + + if (effect.getDuration() > 32767) + { + this.duration = 32767; + } + else + { + this.duration = effect.getDuration(); + } + + this.hideParticles = (byte)(effect.getIsShowParticles() ? 1 : 0); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + this.effectId = buf.readByte(); + this.amplifier = buf.readByte(); + this.duration = buf.readVarIntFromBuffer(); + this.hideParticles = buf.readByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + buf.writeByte(this.effectId); + buf.writeByte(this.amplifier); + buf.writeVarIntToBuffer(this.duration); + buf.writeByte(this.hideParticles); + } + + public boolean func_149429_c() + { + return this.duration == 32767; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleEntityEffect(this); + } + + public int getEntityId() + { + return this.entityId; + } + + public byte getEffectId() + { + return this.effectId; + } + + public byte getAmplifier() + { + return this.amplifier; + } + + public int getDuration() + { + return this.duration; + } + + public boolean func_179707_f() + { + return this.hideParticles != 0; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S1EPacketRemoveEntityEffect.java b/src/minecraft/net/minecraft/network/play/server/S1EPacketRemoveEntityEffect.java new file mode 100644 index 0000000..c2f4380 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S1EPacketRemoveEntityEffect.java @@ -0,0 +1,59 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.potion.PotionEffect; + +public class S1EPacketRemoveEntityEffect implements Packet +{ + private int entityId; + private int effectId; + + public S1EPacketRemoveEntityEffect() + { + } + + public S1EPacketRemoveEntityEffect(int entityIdIn, PotionEffect effect) + { + this.entityId = entityIdIn; + this.effectId = effect.getPotionID(); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + this.effectId = buf.readUnsignedByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + buf.writeByte(this.effectId); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleRemoveEntityEffect(this); + } + + public int getEntityId() + { + return this.entityId; + } + + public int getEffectId() + { + return this.effectId; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S1FPacketSetExperience.java b/src/minecraft/net/minecraft/network/play/server/S1FPacketSetExperience.java new file mode 100644 index 0000000..d2ff3c4 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S1FPacketSetExperience.java @@ -0,0 +1,67 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S1FPacketSetExperience implements Packet +{ + private float field_149401_a; + private int totalExperience; + private int level; + + public S1FPacketSetExperience() + { + } + + public S1FPacketSetExperience(float p_i45222_1_, int totalExperienceIn, int levelIn) + { + this.field_149401_a = p_i45222_1_; + this.totalExperience = totalExperienceIn; + this.level = levelIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.field_149401_a = buf.readFloat(); + this.level = buf.readVarIntFromBuffer(); + this.totalExperience = buf.readVarIntFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeFloat(this.field_149401_a); + buf.writeVarIntToBuffer(this.level); + buf.writeVarIntToBuffer(this.totalExperience); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleSetExperience(this); + } + + public float func_149397_c() + { + return this.field_149401_a; + } + + public int getTotalExperience() + { + return this.totalExperience; + } + + public int getLevel() + { + return this.level; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S20PacketEntityProperties.java b/src/minecraft/net/minecraft/network/play/server/S20PacketEntityProperties.java new file mode 100644 index 0000000..591ec55 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S20PacketEntityProperties.java @@ -0,0 +1,127 @@ +package net.minecraft.network.play.server; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Collection; +import java.util.List; +import java.util.UUID; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S20PacketEntityProperties implements Packet +{ + private int entityId; + private final List field_149444_b = Lists.newArrayList(); + + public S20PacketEntityProperties() + { + } + + public S20PacketEntityProperties(int entityIdIn, Collection p_i45236_2_) + { + this.entityId = entityIdIn; + + for (IAttributeInstance iattributeinstance : p_i45236_2_) + { + this.field_149444_b.add(new S20PacketEntityProperties.Snapshot(iattributeinstance.getAttribute().getAttributeUnlocalizedName(), iattributeinstance.getBaseValue(), iattributeinstance.func_111122_c())); + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + int i = buf.readInt(); + + for (int j = 0; j < i; ++j) + { + String s = buf.readStringFromBuffer(64); + double d0 = buf.readDouble(); + List list = Lists.newArrayList(); + int k = buf.readVarIntFromBuffer(); + + for (int l = 0; l < k; ++l) + { + UUID uuid = buf.readUuid(); + list.add(new AttributeModifier(uuid, "Unknown synced attribute modifier", buf.readDouble(), buf.readByte())); + } + + this.field_149444_b.add(new S20PacketEntityProperties.Snapshot(s, d0, list)); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + buf.writeInt(this.field_149444_b.size()); + + for (S20PacketEntityProperties.Snapshot s20packetentityproperties$snapshot : this.field_149444_b) + { + buf.writeString(s20packetentityproperties$snapshot.func_151409_a()); + buf.writeDouble(s20packetentityproperties$snapshot.func_151410_b()); + buf.writeVarIntToBuffer(s20packetentityproperties$snapshot.func_151408_c().size()); + + for (AttributeModifier attributemodifier : s20packetentityproperties$snapshot.func_151408_c()) + { + buf.writeUuid(attributemodifier.getID()); + buf.writeDouble(attributemodifier.getAmount()); + buf.writeByte(attributemodifier.getOperation()); + } + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleEntityProperties(this); + } + + public int getEntityId() + { + return this.entityId; + } + + public List func_149441_d() + { + return this.field_149444_b; + } + + public class Snapshot + { + private final String field_151412_b; + private final double field_151413_c; + private final Collection field_151411_d; + + public Snapshot(String p_i45235_2_, double p_i45235_3_, Collection p_i45235_5_) + { + this.field_151412_b = p_i45235_2_; + this.field_151413_c = p_i45235_3_; + this.field_151411_d = p_i45235_5_; + } + + public String func_151409_a() + { + return this.field_151412_b; + } + + public double func_151410_b() + { + return this.field_151413_c; + } + + public Collection func_151408_c() + { + return this.field_151411_d; + } + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java b/src/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java new file mode 100644 index 0000000..5d26d41 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S21PacketChunkData.java @@ -0,0 +1,161 @@ +package net.minecraft.network.play.server; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; + +public class S21PacketChunkData implements Packet +{ + private int chunkX; + private int chunkZ; + private S21PacketChunkData.Extracted extractedData; + private boolean field_149279_g; + + public S21PacketChunkData() + { + } + + public S21PacketChunkData(Chunk chunkIn, boolean p_i45196_2_, int p_i45196_3_) + { + this.chunkX = chunkIn.xPosition; + this.chunkZ = chunkIn.zPosition; + this.field_149279_g = p_i45196_2_; + this.extractedData = func_179756_a(chunkIn, p_i45196_2_, !chunkIn.getWorld().provider.getHasNoSky(), p_i45196_3_); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.chunkX = buf.readInt(); + this.chunkZ = buf.readInt(); + this.field_149279_g = buf.readBoolean(); + this.extractedData = new S21PacketChunkData.Extracted(); + this.extractedData.dataSize = buf.readShort(); + this.extractedData.data = buf.readByteArray(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeInt(this.chunkX); + buf.writeInt(this.chunkZ); + buf.writeBoolean(this.field_149279_g); + buf.writeShort((short)(this.extractedData.dataSize & 65535)); + buf.writeByteArray(this.extractedData.data); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleChunkData(this); + } + + public byte[] func_149272_d() + { + return this.extractedData.data; + } + + protected static int func_180737_a(int p_180737_0_, boolean p_180737_1_, boolean p_180737_2_) + { + int i = p_180737_0_ * 2 * 16 * 16 * 16; + int j = p_180737_0_ * 16 * 16 * 16 / 2; + int k = p_180737_1_ ? p_180737_0_ * 16 * 16 * 16 / 2 : 0; + int l = p_180737_2_ ? 256 : 0; + return i + j + k + l; + } + + public static S21PacketChunkData.Extracted func_179756_a(Chunk p_179756_0_, boolean p_179756_1_, boolean p_179756_2_, int p_179756_3_) + { + ExtendedBlockStorage[] aextendedblockstorage = p_179756_0_.getBlockStorageArray(); + S21PacketChunkData.Extracted s21packetchunkdata$extracted = new S21PacketChunkData.Extracted(); + List list = Lists.newArrayList(); + + for (int i = 0; i < aextendedblockstorage.length; ++i) + { + ExtendedBlockStorage extendedblockstorage = aextendedblockstorage[i]; + + if (extendedblockstorage != null && (!p_179756_1_ || !extendedblockstorage.isEmpty()) && (p_179756_3_ & 1 << i) != 0) + { + s21packetchunkdata$extracted.dataSize |= 1 << i; + list.add(extendedblockstorage); + } + } + + s21packetchunkdata$extracted.data = new byte[func_180737_a(Integer.bitCount(s21packetchunkdata$extracted.dataSize), p_179756_2_, p_179756_1_)]; + int j = 0; + + for (ExtendedBlockStorage extendedblockstorage1 : list) + { + char[] achar = extendedblockstorage1.getData(); + + for (char c0 : achar) + { + s21packetchunkdata$extracted.data[j++] = (byte)(c0 & 255); + s21packetchunkdata$extracted.data[j++] = (byte)(c0 >> 8 & 255); + } + } + + for (ExtendedBlockStorage extendedblockstorage2 : list) + { + j = func_179757_a(extendedblockstorage2.getBlocklightArray().getData(), s21packetchunkdata$extracted.data, j); + } + + if (p_179756_2_) + { + for (ExtendedBlockStorage extendedblockstorage3 : list) + { + j = func_179757_a(extendedblockstorage3.getSkylightArray().getData(), s21packetchunkdata$extracted.data, j); + } + } + + if (p_179756_1_) + { + func_179757_a(p_179756_0_.getBiomeArray(), s21packetchunkdata$extracted.data, j); + } + + return s21packetchunkdata$extracted; + } + + private static int func_179757_a(byte[] p_179757_0_, byte[] p_179757_1_, int p_179757_2_) + { + System.arraycopy(p_179757_0_, 0, p_179757_1_, p_179757_2_, p_179757_0_.length); + return p_179757_2_ + p_179757_0_.length; + } + + public int getChunkX() + { + return this.chunkX; + } + + public int getChunkZ() + { + return this.chunkZ; + } + + public int getExtractedSize() + { + return this.extractedData.dataSize; + } + + public boolean func_149274_i() + { + return this.field_149279_g; + } + + public static class Extracted + { + public byte[] data; + public int dataSize; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S22PacketMultiBlockChange.java b/src/minecraft/net/minecraft/network/play/server/S22PacketMultiBlockChange.java new file mode 100644 index 0000000..3ddc0e3 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S22PacketMultiBlockChange.java @@ -0,0 +1,108 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.BlockPos; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.chunk.Chunk; + +public class S22PacketMultiBlockChange implements Packet +{ + private ChunkCoordIntPair chunkPosCoord; + private S22PacketMultiBlockChange.BlockUpdateData[] changedBlocks; + + public S22PacketMultiBlockChange() + { + } + + public S22PacketMultiBlockChange(int p_i45181_1_, short[] crammedPositionsIn, Chunk chunkIn) + { + this.chunkPosCoord = new ChunkCoordIntPair(chunkIn.xPosition, chunkIn.zPosition); + this.changedBlocks = new S22PacketMultiBlockChange.BlockUpdateData[p_i45181_1_]; + + for (int i = 0; i < this.changedBlocks.length; ++i) + { + this.changedBlocks[i] = new S22PacketMultiBlockChange.BlockUpdateData(crammedPositionsIn[i], chunkIn); + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.chunkPosCoord = new ChunkCoordIntPair(buf.readInt(), buf.readInt()); + this.changedBlocks = new S22PacketMultiBlockChange.BlockUpdateData[buf.readVarIntFromBuffer()]; + + for (int i = 0; i < this.changedBlocks.length; ++i) + { + this.changedBlocks[i] = new S22PacketMultiBlockChange.BlockUpdateData(buf.readShort(), (IBlockState)Block.BLOCK_STATE_IDS.getByValue(buf.readVarIntFromBuffer())); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeInt(this.chunkPosCoord.chunkXPos); + buf.writeInt(this.chunkPosCoord.chunkZPos); + buf.writeVarIntToBuffer(this.changedBlocks.length); + + for (S22PacketMultiBlockChange.BlockUpdateData s22packetmultiblockchange$blockupdatedata : this.changedBlocks) + { + buf.writeShort(s22packetmultiblockchange$blockupdatedata.func_180089_b()); + buf.writeVarIntToBuffer(Block.BLOCK_STATE_IDS.get(s22packetmultiblockchange$blockupdatedata.getBlockState())); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleMultiBlockChange(this); + } + + public S22PacketMultiBlockChange.BlockUpdateData[] getChangedBlocks() + { + return this.changedBlocks; + } + + public class BlockUpdateData + { + private final short chunkPosCrammed; + private final IBlockState blockState; + + public BlockUpdateData(short p_i45984_2_, IBlockState state) + { + this.chunkPosCrammed = p_i45984_2_; + this.blockState = state; + } + + public BlockUpdateData(short p_i45985_2_, Chunk chunkIn) + { + this.chunkPosCrammed = p_i45985_2_; + this.blockState = chunkIn.getBlockState(this.getPos()); + } + + public BlockPos getPos() + { + return new BlockPos(S22PacketMultiBlockChange.this.chunkPosCoord.getBlock(this.chunkPosCrammed >> 12 & 15, this.chunkPosCrammed & 255, this.chunkPosCrammed >> 8 & 15)); + } + + public short func_180089_b() + { + return this.chunkPosCrammed; + } + + public IBlockState getBlockState() + { + return this.blockState; + } + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S23PacketBlockChange.java b/src/minecraft/net/minecraft/network/play/server/S23PacketBlockChange.java new file mode 100644 index 0000000..9cd5fcf --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S23PacketBlockChange.java @@ -0,0 +1,62 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class S23PacketBlockChange implements Packet +{ + private BlockPos blockPosition; + private IBlockState blockState; + + public S23PacketBlockChange() + { + } + + public S23PacketBlockChange(World worldIn, BlockPos blockPositionIn) + { + this.blockPosition = blockPositionIn; + this.blockState = worldIn.getBlockState(blockPositionIn); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.blockPosition = buf.readBlockPos(); + this.blockState = (IBlockState)Block.BLOCK_STATE_IDS.getByValue(buf.readVarIntFromBuffer()); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeBlockPos(this.blockPosition); + buf.writeVarIntToBuffer(Block.BLOCK_STATE_IDS.get(this.blockState)); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleBlockChange(this); + } + + public IBlockState getBlockState() + { + return this.blockState; + } + + public BlockPos getBlockPosition() + { + return this.blockPosition; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S24PacketBlockAction.java b/src/minecraft/net/minecraft/network/play/server/S24PacketBlockAction.java new file mode 100644 index 0000000..eeef7a9 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S24PacketBlockAction.java @@ -0,0 +1,84 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.block.Block; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.BlockPos; + +public class S24PacketBlockAction implements Packet +{ + private BlockPos blockPosition; + private int instrument; + private int pitch; + private Block block; + + public S24PacketBlockAction() + { + } + + public S24PacketBlockAction(BlockPos blockPositionIn, Block blockIn, int instrumentIn, int pitchIn) + { + this.blockPosition = blockPositionIn; + this.instrument = instrumentIn; + this.pitch = pitchIn; + this.block = blockIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.blockPosition = buf.readBlockPos(); + this.instrument = buf.readUnsignedByte(); + this.pitch = buf.readUnsignedByte(); + this.block = Block.getBlockById(buf.readVarIntFromBuffer() & 4095); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeBlockPos(this.blockPosition); + buf.writeByte(this.instrument); + buf.writeByte(this.pitch); + buf.writeVarIntToBuffer(Block.getIdFromBlock(this.block) & 4095); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleBlockAction(this); + } + + public BlockPos getBlockPosition() + { + return this.blockPosition; + } + + /** + * instrument data for noteblocks + */ + public int getData1() + { + return this.instrument; + } + + /** + * pitch data for noteblocks + */ + public int getData2() + { + return this.pitch; + } + + public Block getBlockType() + { + return this.block; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S25PacketBlockBreakAnim.java b/src/minecraft/net/minecraft/network/play/server/S25PacketBlockBreakAnim.java new file mode 100644 index 0000000..b4f5cc2 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S25PacketBlockBreakAnim.java @@ -0,0 +1,68 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.BlockPos; + +public class S25PacketBlockBreakAnim implements Packet +{ + private int breakerId; + private BlockPos position; + private int progress; + + public S25PacketBlockBreakAnim() + { + } + + public S25PacketBlockBreakAnim(int breakerId, BlockPos pos, int progress) + { + this.breakerId = breakerId; + this.position = pos; + this.progress = progress; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.breakerId = buf.readVarIntFromBuffer(); + this.position = buf.readBlockPos(); + this.progress = buf.readUnsignedByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.breakerId); + buf.writeBlockPos(this.position); + buf.writeByte(this.progress); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleBlockBreakAnim(this); + } + + public int getBreakerId() + { + return this.breakerId; + } + + public BlockPos getPosition() + { + return this.position; + } + + public int getProgress() + { + return this.progress; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java b/src/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java new file mode 100644 index 0000000..32dc795 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S26PacketMapChunkBulk.java @@ -0,0 +1,118 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import java.util.List; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.world.chunk.Chunk; + +public class S26PacketMapChunkBulk implements Packet +{ + private int[] xPositions; + private int[] zPositions; + private S21PacketChunkData.Extracted[] chunksData; + private boolean isOverworld; + + public S26PacketMapChunkBulk() + { + } + + public S26PacketMapChunkBulk(List chunks) + { + int i = chunks.size(); + this.xPositions = new int[i]; + this.zPositions = new int[i]; + this.chunksData = new S21PacketChunkData.Extracted[i]; + this.isOverworld = !((Chunk)chunks.get(0)).getWorld().provider.getHasNoSky(); + + for (int j = 0; j < i; ++j) + { + Chunk chunk = (Chunk)chunks.get(j); + S21PacketChunkData.Extracted s21packetchunkdata$extracted = S21PacketChunkData.func_179756_a(chunk, true, this.isOverworld, 65535); + this.xPositions[j] = chunk.xPosition; + this.zPositions[j] = chunk.zPosition; + this.chunksData[j] = s21packetchunkdata$extracted; + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.isOverworld = buf.readBoolean(); + int i = buf.readVarIntFromBuffer(); + this.xPositions = new int[i]; + this.zPositions = new int[i]; + this.chunksData = new S21PacketChunkData.Extracted[i]; + + for (int j = 0; j < i; ++j) + { + this.xPositions[j] = buf.readInt(); + this.zPositions[j] = buf.readInt(); + this.chunksData[j] = new S21PacketChunkData.Extracted(); + this.chunksData[j].dataSize = buf.readShort() & 65535; + this.chunksData[j].data = new byte[S21PacketChunkData.func_180737_a(Integer.bitCount(this.chunksData[j].dataSize), this.isOverworld, true)]; + } + + for (int k = 0; k < i; ++k) + { + buf.readBytes(this.chunksData[k].data); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeBoolean(this.isOverworld); + buf.writeVarIntToBuffer(this.chunksData.length); + + for (int i = 0; i < this.xPositions.length; ++i) + { + buf.writeInt(this.xPositions[i]); + buf.writeInt(this.zPositions[i]); + buf.writeShort((short)(this.chunksData[i].dataSize & 65535)); + } + + for (int j = 0; j < this.xPositions.length; ++j) + { + buf.writeBytes(this.chunksData[j].data); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleMapChunkBulk(this); + } + + public int getChunkX(int p_149255_1_) + { + return this.xPositions[p_149255_1_]; + } + + public int getChunkZ(int p_149253_1_) + { + return this.zPositions[p_149253_1_]; + } + + public int getChunkCount() + { + return this.xPositions.length; + } + + public byte[] getChunkBytes(int p_149256_1_) + { + return this.chunksData[p_149256_1_].data; + } + + public int getChunkSize(int p_179754_1_) + { + return this.chunksData[p_179754_1_].dataSize; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S27PacketExplosion.java b/src/minecraft/net/minecraft/network/play/server/S27PacketExplosion.java new file mode 100644 index 0000000..6b84547 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S27PacketExplosion.java @@ -0,0 +1,147 @@ +package net.minecraft.network.play.server; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; + +public class S27PacketExplosion implements Packet +{ + private double posX; + private double posY; + private double posZ; + private float strength; + private List affectedBlockPositions; + private float field_149152_f; + private float field_149153_g; + private float field_149159_h; + + public S27PacketExplosion() + { + } + + public S27PacketExplosion(double p_i45193_1_, double y, double z, float strengthIn, List affectedBlocksIn, Vec3 p_i45193_9_) + { + this.posX = p_i45193_1_; + this.posY = y; + this.posZ = z; + this.strength = strengthIn; + this.affectedBlockPositions = Lists.newArrayList(affectedBlocksIn); + + if (p_i45193_9_ != null) + { + this.field_149152_f = (float)p_i45193_9_.xCoord; + this.field_149153_g = (float)p_i45193_9_.yCoord; + this.field_149159_h = (float)p_i45193_9_.zCoord; + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.posX = (double)buf.readFloat(); + this.posY = (double)buf.readFloat(); + this.posZ = (double)buf.readFloat(); + this.strength = buf.readFloat(); + int i = buf.readInt(); + this.affectedBlockPositions = Lists.newArrayListWithCapacity(i); + int j = (int)this.posX; + int k = (int)this.posY; + int l = (int)this.posZ; + + for (int i1 = 0; i1 < i; ++i1) + { + int j1 = buf.readByte() + j; + int k1 = buf.readByte() + k; + int l1 = buf.readByte() + l; + this.affectedBlockPositions.add(new BlockPos(j1, k1, l1)); + } + + this.field_149152_f = buf.readFloat(); + this.field_149153_g = buf.readFloat(); + this.field_149159_h = buf.readFloat(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeFloat((float)this.posX); + buf.writeFloat((float)this.posY); + buf.writeFloat((float)this.posZ); + buf.writeFloat(this.strength); + buf.writeInt(this.affectedBlockPositions.size()); + int i = (int)this.posX; + int j = (int)this.posY; + int k = (int)this.posZ; + + for (BlockPos blockpos : this.affectedBlockPositions) + { + int l = blockpos.getX() - i; + int i1 = blockpos.getY() - j; + int j1 = blockpos.getZ() - k; + buf.writeByte(l); + buf.writeByte(i1); + buf.writeByte(j1); + } + + buf.writeFloat(this.field_149152_f); + buf.writeFloat(this.field_149153_g); + buf.writeFloat(this.field_149159_h); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleExplosion(this); + } + + public float func_149149_c() + { + return this.field_149152_f; + } + + public float func_149144_d() + { + return this.field_149153_g; + } + + public float func_149147_e() + { + return this.field_149159_h; + } + + public double getX() + { + return this.posX; + } + + public double getY() + { + return this.posY; + } + + public double getZ() + { + return this.posZ; + } + + public float getStrength() + { + return this.strength; + } + + public List getAffectedBlockPositions() + { + return this.affectedBlockPositions; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S28PacketEffect.java b/src/minecraft/net/minecraft/network/play/server/S28PacketEffect.java new file mode 100644 index 0000000..52b5a3f --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S28PacketEffect.java @@ -0,0 +1,81 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.BlockPos; + +public class S28PacketEffect implements Packet +{ + private int soundType; + private BlockPos soundPos; + + /** can be a block/item id or other depending on the soundtype */ + private int soundData; + + /** If true the sound is played across the server */ + private boolean serverWide; + + public S28PacketEffect() + { + } + + public S28PacketEffect(int soundTypeIn, BlockPos soundPosIn, int soundDataIn, boolean serverWideIn) + { + this.soundType = soundTypeIn; + this.soundPos = soundPosIn; + this.soundData = soundDataIn; + this.serverWide = serverWideIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.soundType = buf.readInt(); + this.soundPos = buf.readBlockPos(); + this.soundData = buf.readInt(); + this.serverWide = buf.readBoolean(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeInt(this.soundType); + buf.writeBlockPos(this.soundPos); + buf.writeInt(this.soundData); + buf.writeBoolean(this.serverWide); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleEffect(this); + } + + public boolean isSoundServerwide() + { + return this.serverWide; + } + + public int getSoundType() + { + return this.soundType; + } + + public int getSoundData() + { + return this.soundData; + } + + public BlockPos getSoundPos() + { + return this.soundPos; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S29PacketSoundEffect.java b/src/minecraft/net/minecraft/network/play/server/S29PacketSoundEffect.java new file mode 100644 index 0000000..405a5ee --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S29PacketSoundEffect.java @@ -0,0 +1,98 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.MathHelper; +import org.apache.commons.lang3.Validate; + +public class S29PacketSoundEffect implements Packet +{ + private String soundName; + private int posX; + private int posY = Integer.MAX_VALUE; + private int posZ; + private float soundVolume; + private int soundPitch; + + public S29PacketSoundEffect() + { + } + + public S29PacketSoundEffect(String soundNameIn, double soundX, double soundY, double soundZ, float volume, float pitch) + { + Validate.notNull(soundNameIn, "name", new Object[0]); + this.soundName = soundNameIn; + this.posX = (int)(soundX * 8.0D); + this.posY = (int)(soundY * 8.0D); + this.posZ = (int)(soundZ * 8.0D); + this.soundVolume = volume; + this.soundPitch = (int)(pitch * 63.0F); + pitch = MathHelper.clamp_float(pitch, 0.0F, 255.0F); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.soundName = buf.readStringFromBuffer(256); + this.posX = buf.readInt(); + this.posY = buf.readInt(); + this.posZ = buf.readInt(); + this.soundVolume = buf.readFloat(); + this.soundPitch = buf.readUnsignedByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.soundName); + buf.writeInt(this.posX); + buf.writeInt(this.posY); + buf.writeInt(this.posZ); + buf.writeFloat(this.soundVolume); + buf.writeByte(this.soundPitch); + } + + public String getSoundName() + { + return this.soundName; + } + + public double getX() + { + return (double)((float)this.posX / 8.0F); + } + + public double getY() + { + return (double)((float)this.posY / 8.0F); + } + + public double getZ() + { + return (double)((float)this.posZ / 8.0F); + } + + public float getVolume() + { + return this.soundVolume; + } + + public float getPitch() + { + return (float)this.soundPitch / 63.0F; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleSoundEffect(this); + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S2APacketParticles.java b/src/minecraft/net/minecraft/network/play/server/S2APacketParticles.java new file mode 100644 index 0000000..1f124b9 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S2APacketParticles.java @@ -0,0 +1,189 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.EnumParticleTypes; + +public class S2APacketParticles implements Packet +{ + private EnumParticleTypes particleType; + private float xCoord; + private float yCoord; + private float zCoord; + private float xOffset; + private float yOffset; + private float zOffset; + private float particleSpeed; + private int particleCount; + private boolean longDistance; + + /** + * These are the block/item ids and possibly metaData ids that are used to color or texture the particle. + */ + private int[] particleArguments; + + public S2APacketParticles() + { + } + + public S2APacketParticles(EnumParticleTypes particleTypeIn, boolean longDistanceIn, float x, float y, float z, float xOffsetIn, float yOffset, float zOffset, float particleSpeedIn, int particleCountIn, int... particleArgumentsIn) + { + this.particleType = particleTypeIn; + this.longDistance = longDistanceIn; + this.xCoord = x; + this.yCoord = y; + this.zCoord = z; + this.xOffset = xOffsetIn; + this.yOffset = yOffset; + this.zOffset = zOffset; + this.particleSpeed = particleSpeedIn; + this.particleCount = particleCountIn; + this.particleArguments = particleArgumentsIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.particleType = EnumParticleTypes.getParticleFromId(buf.readInt()); + + if (this.particleType == null) + { + this.particleType = EnumParticleTypes.BARRIER; + } + + this.longDistance = buf.readBoolean(); + this.xCoord = buf.readFloat(); + this.yCoord = buf.readFloat(); + this.zCoord = buf.readFloat(); + this.xOffset = buf.readFloat(); + this.yOffset = buf.readFloat(); + this.zOffset = buf.readFloat(); + this.particleSpeed = buf.readFloat(); + this.particleCount = buf.readInt(); + int i = this.particleType.getArgumentCount(); + this.particleArguments = new int[i]; + + for (int j = 0; j < i; ++j) + { + this.particleArguments[j] = buf.readVarIntFromBuffer(); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeInt(this.particleType.getParticleID()); + buf.writeBoolean(this.longDistance); + buf.writeFloat(this.xCoord); + buf.writeFloat(this.yCoord); + buf.writeFloat(this.zCoord); + buf.writeFloat(this.xOffset); + buf.writeFloat(this.yOffset); + buf.writeFloat(this.zOffset); + buf.writeFloat(this.particleSpeed); + buf.writeInt(this.particleCount); + int i = this.particleType.getArgumentCount(); + + for (int j = 0; j < i; ++j) + { + buf.writeVarIntToBuffer(this.particleArguments[j]); + } + } + + public EnumParticleTypes getParticleType() + { + return this.particleType; + } + + public boolean isLongDistance() + { + return this.longDistance; + } + + /** + * Gets the x coordinate to spawn the particle. + */ + public double getXCoordinate() + { + return (double)this.xCoord; + } + + /** + * Gets the y coordinate to spawn the particle. + */ + public double getYCoordinate() + { + return (double)this.yCoord; + } + + /** + * Gets the z coordinate to spawn the particle. + */ + public double getZCoordinate() + { + return (double)this.zCoord; + } + + /** + * Gets the x coordinate offset for the particle. The particle may use the offset for particle spread. + */ + public float getXOffset() + { + return this.xOffset; + } + + /** + * Gets the y coordinate offset for the particle. The particle may use the offset for particle spread. + */ + public float getYOffset() + { + return this.yOffset; + } + + /** + * Gets the z coordinate offset for the particle. The particle may use the offset for particle spread. + */ + public float getZOffset() + { + return this.zOffset; + } + + /** + * Gets the speed of the particle animation (used in client side rendering). + */ + public float getParticleSpeed() + { + return this.particleSpeed; + } + + /** + * Gets the amount of particles to spawn + */ + public int getParticleCount() + { + return this.particleCount; + } + + /** + * Gets the particle arguments. Some particles rely on block and/or item ids and sometimes metadata ids to color or + * texture the particle. + */ + public int[] getParticleArgs() + { + return this.particleArguments; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleParticles(this); + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S2BPacketChangeGameState.java b/src/minecraft/net/minecraft/network/play/server/S2BPacketChangeGameState.java new file mode 100644 index 0000000..f632c0e --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S2BPacketChangeGameState.java @@ -0,0 +1,59 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S2BPacketChangeGameState implements Packet +{ + public static final String[] MESSAGE_NAMES = new String[] {"tile.bed.notValid"}; + private int state; + private float field_149141_c; + + public S2BPacketChangeGameState() + { + } + + public S2BPacketChangeGameState(int stateIn, float p_i45194_2_) + { + this.state = stateIn; + this.field_149141_c = p_i45194_2_; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.state = buf.readUnsignedByte(); + this.field_149141_c = buf.readFloat(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.state); + buf.writeFloat(this.field_149141_c); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleChangeGameState(this); + } + + public int getGameState() + { + return this.state; + } + + public float func_149137_d() + { + return this.field_149141_c; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S2CPacketSpawnGlobalEntity.java b/src/minecraft/net/minecraft/network/play/server/S2CPacketSpawnGlobalEntity.java new file mode 100644 index 0000000..a389299 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S2CPacketSpawnGlobalEntity.java @@ -0,0 +1,92 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.MathHelper; + +public class S2CPacketSpawnGlobalEntity implements Packet +{ + private int entityId; + private int x; + private int y; + private int z; + private int type; + + public S2CPacketSpawnGlobalEntity() + { + } + + public S2CPacketSpawnGlobalEntity(Entity entityIn) + { + this.entityId = entityIn.getEntityId(); + this.x = MathHelper.floor_double(entityIn.posX * 32.0D); + this.y = MathHelper.floor_double(entityIn.posY * 32.0D); + this.z = MathHelper.floor_double(entityIn.posZ * 32.0D); + + if (entityIn instanceof EntityLightningBolt) + { + this.type = 1; + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + this.type = buf.readByte(); + this.x = buf.readInt(); + this.y = buf.readInt(); + this.z = buf.readInt(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + buf.writeByte(this.type); + buf.writeInt(this.x); + buf.writeInt(this.y); + buf.writeInt(this.z); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleSpawnGlobalEntity(this); + } + + public int func_149052_c() + { + return this.entityId; + } + + public int func_149051_d() + { + return this.x; + } + + public int func_149050_e() + { + return this.y; + } + + public int func_149049_f() + { + return this.z; + } + + public int func_149053_g() + { + return this.type; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S2DPacketOpenWindow.java b/src/minecraft/net/minecraft/network/play/server/S2DPacketOpenWindow.java new file mode 100644 index 0000000..4a2c75b --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S2DPacketOpenWindow.java @@ -0,0 +1,109 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.IChatComponent; + +public class S2DPacketOpenWindow implements Packet +{ + private int windowId; + private String inventoryType; + private IChatComponent windowTitle; + private int slotCount; + private int entityId; + + public S2DPacketOpenWindow() + { + } + + public S2DPacketOpenWindow(int incomingWindowId, String incomingWindowTitle, IChatComponent windowTitleIn) + { + this(incomingWindowId, incomingWindowTitle, windowTitleIn, 0); + } + + public S2DPacketOpenWindow(int windowIdIn, String guiId, IChatComponent windowTitleIn, int slotCountIn) + { + this.windowId = windowIdIn; + this.inventoryType = guiId; + this.windowTitle = windowTitleIn; + this.slotCount = slotCountIn; + } + + public S2DPacketOpenWindow(int windowIdIn, String guiId, IChatComponent windowTitleIn, int slotCountIn, int incomingEntityId) + { + this(windowIdIn, guiId, windowTitleIn, slotCountIn); + this.entityId = incomingEntityId; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleOpenWindow(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.windowId = buf.readUnsignedByte(); + this.inventoryType = buf.readStringFromBuffer(32); + this.windowTitle = buf.readChatComponent(); + this.slotCount = buf.readUnsignedByte(); + + if (this.inventoryType.equals("EntityHorse")) + { + this.entityId = buf.readInt(); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.windowId); + buf.writeString(this.inventoryType); + buf.writeChatComponent(this.windowTitle); + buf.writeByte(this.slotCount); + + if (this.inventoryType.equals("EntityHorse")) + { + buf.writeInt(this.entityId); + } + } + + public int getWindowId() + { + return this.windowId; + } + + public String getGuiId() + { + return this.inventoryType; + } + + public IChatComponent getWindowTitle() + { + return this.windowTitle; + } + + public int getSlotCount() + { + return this.slotCount; + } + + public int getEntityId() + { + return this.entityId; + } + + public boolean hasSlots() + { + return this.slotCount > 0; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S2EPacketCloseWindow.java b/src/minecraft/net/minecraft/network/play/server/S2EPacketCloseWindow.java new file mode 100644 index 0000000..932783e --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S2EPacketCloseWindow.java @@ -0,0 +1,44 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S2EPacketCloseWindow implements Packet +{ + private int windowId; + + public S2EPacketCloseWindow() + { + } + + public S2EPacketCloseWindow(int windowIdIn) + { + this.windowId = windowIdIn; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleCloseWindow(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.windowId = buf.readUnsignedByte(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.windowId); + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S2FPacketSetSlot.java b/src/minecraft/net/minecraft/network/play/server/S2FPacketSetSlot.java new file mode 100644 index 0000000..c548a6a --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S2FPacketSetSlot.java @@ -0,0 +1,68 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.item.ItemStack; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S2FPacketSetSlot implements Packet +{ + private int windowId; + private int slot; + private ItemStack item; + + public S2FPacketSetSlot() + { + } + + public S2FPacketSetSlot(int windowIdIn, int slotIn, ItemStack itemIn) + { + this.windowId = windowIdIn; + this.slot = slotIn; + this.item = itemIn == null ? null : itemIn.copy(); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleSetSlot(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.windowId = buf.readByte(); + this.slot = buf.readShort(); + this.item = buf.readItemStackFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.windowId); + buf.writeShort(this.slot); + buf.writeItemStackToBuffer(this.item); + } + + public int func_149175_c() + { + return this.windowId; + } + + public int func_149173_d() + { + return this.slot; + } + + public ItemStack func_149174_e() + { + return this.item; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S30PacketWindowItems.java b/src/minecraft/net/minecraft/network/play/server/S30PacketWindowItems.java new file mode 100644 index 0000000..cdd14ab --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S30PacketWindowItems.java @@ -0,0 +1,77 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import java.util.List; +import net.minecraft.item.ItemStack; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S30PacketWindowItems implements Packet +{ + private int windowId; + private ItemStack[] itemStacks; + + public S30PacketWindowItems() + { + } + + public S30PacketWindowItems(int windowIdIn, List p_i45186_2_) + { + this.windowId = windowIdIn; + this.itemStacks = new ItemStack[p_i45186_2_.size()]; + + for (int i = 0; i < this.itemStacks.length; ++i) + { + ItemStack itemstack = (ItemStack)p_i45186_2_.get(i); + this.itemStacks[i] = itemstack == null ? null : itemstack.copy(); + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.windowId = buf.readUnsignedByte(); + int i = buf.readShort(); + this.itemStacks = new ItemStack[i]; + + for (int j = 0; j < i; ++j) + { + this.itemStacks[j] = buf.readItemStackFromBuffer(); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.windowId); + buf.writeShort(this.itemStacks.length); + + for (ItemStack itemstack : this.itemStacks) + { + buf.writeItemStackToBuffer(itemstack); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleWindowItems(this); + } + + public int func_148911_c() + { + return this.windowId; + } + + public ItemStack[] getItemStacks() + { + return this.itemStacks; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S31PacketWindowProperty.java b/src/minecraft/net/minecraft/network/play/server/S31PacketWindowProperty.java new file mode 100644 index 0000000..9c8ec48 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S31PacketWindowProperty.java @@ -0,0 +1,67 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S31PacketWindowProperty implements Packet +{ + private int windowId; + private int varIndex; + private int varValue; + + public S31PacketWindowProperty() + { + } + + public S31PacketWindowProperty(int windowIdIn, int varIndexIn, int varValueIn) + { + this.windowId = windowIdIn; + this.varIndex = varIndexIn; + this.varValue = varValueIn; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleWindowProperty(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.windowId = buf.readUnsignedByte(); + this.varIndex = buf.readShort(); + this.varValue = buf.readShort(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.windowId); + buf.writeShort(this.varIndex); + buf.writeShort(this.varValue); + } + + public int getWindowId() + { + return this.windowId; + } + + public int getVarIndex() + { + return this.varIndex; + } + + public int getVarValue() + { + return this.varValue; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S32PacketConfirmTransaction.java b/src/minecraft/net/minecraft/network/play/server/S32PacketConfirmTransaction.java new file mode 100644 index 0000000..8704116 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S32PacketConfirmTransaction.java @@ -0,0 +1,67 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S32PacketConfirmTransaction implements Packet +{ + private int windowId; + private short actionNumber; + private boolean field_148893_c; + + public S32PacketConfirmTransaction() + { + } + + public S32PacketConfirmTransaction(int windowIdIn, short actionNumberIn, boolean p_i45182_3_) + { + this.windowId = windowIdIn; + this.actionNumber = actionNumberIn; + this.field_148893_c = p_i45182_3_; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleConfirmTransaction(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.windowId = buf.readUnsignedByte(); + this.actionNumber = buf.readShort(); + this.field_148893_c = buf.readBoolean(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.windowId); + buf.writeShort(this.actionNumber); + buf.writeBoolean(this.field_148893_c); + } + + public int getWindowId() + { + return this.windowId; + } + + public short getActionNumber() + { + return this.actionNumber; + } + + public boolean func_148888_e() + { + return this.field_148893_c; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S33PacketUpdateSign.java b/src/minecraft/net/minecraft/network/play/server/S33PacketUpdateSign.java new file mode 100644 index 0000000..785e5ac --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S33PacketUpdateSign.java @@ -0,0 +1,72 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.World; + +public class S33PacketUpdateSign implements Packet +{ + private World world; + private BlockPos blockPos; + private IChatComponent[] lines; + + public S33PacketUpdateSign() + { + } + + public S33PacketUpdateSign(World worldIn, BlockPos blockPosIn, IChatComponent[] linesIn) + { + this.world = worldIn; + this.blockPos = blockPosIn; + this.lines = new IChatComponent[] {linesIn[0], linesIn[1], linesIn[2], linesIn[3]}; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.blockPos = buf.readBlockPos(); + this.lines = new IChatComponent[4]; + + for (int i = 0; i < 4; ++i) + { + this.lines[i] = buf.readChatComponent(); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeBlockPos(this.blockPos); + + for (int i = 0; i < 4; ++i) + { + buf.writeChatComponent(this.lines[i]); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleUpdateSign(this); + } + + public BlockPos getPos() + { + return this.blockPos; + } + + public IChatComponent[] getLines() + { + return this.lines; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S34PacketMaps.java b/src/minecraft/net/minecraft/network/play/server/S34PacketMaps.java new file mode 100644 index 0000000..6242e84 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S34PacketMaps.java @@ -0,0 +1,134 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import java.util.Collection; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.Vec4b; +import net.minecraft.world.storage.MapData; + +public class S34PacketMaps implements Packet +{ + private int mapId; + private byte mapScale; + private Vec4b[] mapVisiblePlayersVec4b; + private int mapMinX; + private int mapMinY; + private int mapMaxX; + private int mapMaxY; + private byte[] mapDataBytes; + + public S34PacketMaps() + { + } + + public S34PacketMaps(int mapIdIn, byte scale, Collection visiblePlayers, byte[] colors, int minX, int minY, int maxX, int maxY) + { + this.mapId = mapIdIn; + this.mapScale = scale; + this.mapVisiblePlayersVec4b = (Vec4b[])visiblePlayers.toArray(new Vec4b[visiblePlayers.size()]); + this.mapMinX = minX; + this.mapMinY = minY; + this.mapMaxX = maxX; + this.mapMaxY = maxY; + this.mapDataBytes = new byte[maxX * maxY]; + + for (int i = 0; i < maxX; ++i) + { + for (int j = 0; j < maxY; ++j) + { + this.mapDataBytes[i + j * maxX] = colors[minX + i + (minY + j) * 128]; + } + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.mapId = buf.readVarIntFromBuffer(); + this.mapScale = buf.readByte(); + this.mapVisiblePlayersVec4b = new Vec4b[buf.readVarIntFromBuffer()]; + + for (int i = 0; i < this.mapVisiblePlayersVec4b.length; ++i) + { + short short1 = (short)buf.readByte(); + this.mapVisiblePlayersVec4b[i] = new Vec4b((byte)(short1 >> 4 & 15), buf.readByte(), buf.readByte(), (byte)(short1 & 15)); + } + + this.mapMaxX = buf.readUnsignedByte(); + + if (this.mapMaxX > 0) + { + this.mapMaxY = buf.readUnsignedByte(); + this.mapMinX = buf.readUnsignedByte(); + this.mapMinY = buf.readUnsignedByte(); + this.mapDataBytes = buf.readByteArray(); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.mapId); + buf.writeByte(this.mapScale); + buf.writeVarIntToBuffer(this.mapVisiblePlayersVec4b.length); + + for (Vec4b vec4b : this.mapVisiblePlayersVec4b) + { + buf.writeByte((vec4b.func_176110_a() & 15) << 4 | vec4b.func_176111_d() & 15); + buf.writeByte(vec4b.func_176112_b()); + buf.writeByte(vec4b.func_176113_c()); + } + + buf.writeByte(this.mapMaxX); + + if (this.mapMaxX > 0) + { + buf.writeByte(this.mapMaxY); + buf.writeByte(this.mapMinX); + buf.writeByte(this.mapMinY); + buf.writeByteArray(this.mapDataBytes); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleMaps(this); + } + + public int getMapId() + { + return this.mapId; + } + + /** + * Sets new MapData from the packet to given MapData param + */ + public void setMapdataTo(MapData mapdataIn) + { + mapdataIn.scale = this.mapScale; + mapdataIn.mapDecorations.clear(); + + for (int i = 0; i < this.mapVisiblePlayersVec4b.length; ++i) + { + Vec4b vec4b = this.mapVisiblePlayersVec4b[i]; + mapdataIn.mapDecorations.put("icon-" + i, vec4b); + } + + for (int j = 0; j < this.mapMaxX; ++j) + { + for (int k = 0; k < this.mapMaxY; ++k) + { + mapdataIn.colors[this.mapMinX + j + (this.mapMinY + k) * 128] = this.mapDataBytes[j + k * this.mapMaxX]; + } + } + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S35PacketUpdateTileEntity.java b/src/minecraft/net/minecraft/network/play/server/S35PacketUpdateTileEntity.java new file mode 100644 index 0000000..591f349 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S35PacketUpdateTileEntity.java @@ -0,0 +1,71 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.BlockPos; + +public class S35PacketUpdateTileEntity implements Packet +{ + private BlockPos blockPos; + + /** Used only for vanilla tile entities */ + private int metadata; + private NBTTagCompound nbt; + + public S35PacketUpdateTileEntity() + { + } + + public S35PacketUpdateTileEntity(BlockPos blockPosIn, int metadataIn, NBTTagCompound nbtIn) + { + this.blockPos = blockPosIn; + this.metadata = metadataIn; + this.nbt = nbtIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.blockPos = buf.readBlockPos(); + this.metadata = buf.readUnsignedByte(); + this.nbt = buf.readNBTTagCompoundFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeBlockPos(this.blockPos); + buf.writeByte((byte)this.metadata); + buf.writeNBTTagCompoundToBuffer(this.nbt); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleUpdateTileEntity(this); + } + + public BlockPos getPos() + { + return this.blockPos; + } + + public int getTileEntityType() + { + return this.metadata; + } + + public NBTTagCompound getNbtCompound() + { + return this.nbt; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S36PacketSignEditorOpen.java b/src/minecraft/net/minecraft/network/play/server/S36PacketSignEditorOpen.java new file mode 100644 index 0000000..0be9dc6 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S36PacketSignEditorOpen.java @@ -0,0 +1,50 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.BlockPos; + +public class S36PacketSignEditorOpen implements Packet +{ + private BlockPos signPosition; + + public S36PacketSignEditorOpen() + { + } + + public S36PacketSignEditorOpen(BlockPos signPositionIn) + { + this.signPosition = signPositionIn; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleSignEditorOpen(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.signPosition = buf.readBlockPos(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeBlockPos(this.signPosition); + } + + public BlockPos getSignPosition() + { + return this.signPosition; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S37PacketStatistics.java b/src/minecraft/net/minecraft/network/play/server/S37PacketStatistics.java new file mode 100644 index 0000000..46ba04f --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S37PacketStatistics.java @@ -0,0 +1,72 @@ +package net.minecraft.network.play.server; + +import com.google.common.collect.Maps; +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.stats.StatBase; +import net.minecraft.stats.StatList; + +public class S37PacketStatistics implements Packet +{ + private Map field_148976_a; + + public S37PacketStatistics() + { + } + + public S37PacketStatistics(Map p_i45173_1_) + { + this.field_148976_a = p_i45173_1_; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleStatistics(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + int i = buf.readVarIntFromBuffer(); + this.field_148976_a = Maps.newHashMap(); + + for (int j = 0; j < i; ++j) + { + StatBase statbase = StatList.getOneShotStat(buf.readStringFromBuffer(32767)); + int k = buf.readVarIntFromBuffer(); + + if (statbase != null) + { + this.field_148976_a.put(statbase, Integer.valueOf(k)); + } + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.field_148976_a.size()); + + for (Entry entry : this.field_148976_a.entrySet()) + { + buf.writeString(((StatBase)entry.getKey()).statId); + buf.writeVarIntToBuffer(((Integer)entry.getValue()).intValue()); + } + } + + public Map func_148974_c() + { + return this.field_148976_a; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S38PacketPlayerListItem.java b/src/minecraft/net/minecraft/network/play/server/S38PacketPlayerListItem.java new file mode 100644 index 0000000..bddc421 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S38PacketPlayerListItem.java @@ -0,0 +1,271 @@ +package net.minecraft.network.play.server; + +import com.google.common.base.Objects; +import com.google.common.collect.Lists; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import java.io.IOException; +import java.util.List; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.WorldSettings; + +public class S38PacketPlayerListItem implements Packet +{ + private S38PacketPlayerListItem.Action action; + private final List players = Lists.newArrayList(); + + public S38PacketPlayerListItem() + { + } + + public S38PacketPlayerListItem(S38PacketPlayerListItem.Action actionIn, EntityPlayerMP... players) + { + this.action = actionIn; + + for (EntityPlayerMP entityplayermp : players) + { + this.players.add(new S38PacketPlayerListItem.AddPlayerData(entityplayermp.getGameProfile(), entityplayermp.ping, entityplayermp.theItemInWorldManager.getGameType(), entityplayermp.getTabListDisplayName())); + } + } + + public S38PacketPlayerListItem(S38PacketPlayerListItem.Action actionIn, Iterable players) + { + this.action = actionIn; + + for (EntityPlayerMP entityplayermp : players) + { + this.players.add(new S38PacketPlayerListItem.AddPlayerData(entityplayermp.getGameProfile(), entityplayermp.ping, entityplayermp.theItemInWorldManager.getGameType(), entityplayermp.getTabListDisplayName())); + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.action = (S38PacketPlayerListItem.Action)buf.readEnumValue(S38PacketPlayerListItem.Action.class); + int i = buf.readVarIntFromBuffer(); + + for (int j = 0; j < i; ++j) + { + GameProfile gameprofile = null; + int k = 0; + WorldSettings.GameType worldsettings$gametype = null; + IChatComponent ichatcomponent = null; + + switch (this.action) + { + case ADD_PLAYER: + gameprofile = new GameProfile(buf.readUuid(), buf.readStringFromBuffer(16)); + int l = buf.readVarIntFromBuffer(); + int i1 = 0; + + for (; i1 < l; ++i1) + { + String s = buf.readStringFromBuffer(32767); + String s1 = buf.readStringFromBuffer(32767); + + if (buf.readBoolean()) + { + gameprofile.getProperties().put(s, new Property(s, s1, buf.readStringFromBuffer(32767))); + } + else + { + gameprofile.getProperties().put(s, new Property(s, s1)); + } + } + + worldsettings$gametype = WorldSettings.GameType.getByID(buf.readVarIntFromBuffer()); + k = buf.readVarIntFromBuffer(); + + if (buf.readBoolean()) + { + ichatcomponent = buf.readChatComponent(); + } + + break; + + case UPDATE_GAME_MODE: + gameprofile = new GameProfile(buf.readUuid(), (String)null); + worldsettings$gametype = WorldSettings.GameType.getByID(buf.readVarIntFromBuffer()); + break; + + case UPDATE_LATENCY: + gameprofile = new GameProfile(buf.readUuid(), (String)null); + k = buf.readVarIntFromBuffer(); + break; + + case UPDATE_DISPLAY_NAME: + gameprofile = new GameProfile(buf.readUuid(), (String)null); + + if (buf.readBoolean()) + { + ichatcomponent = buf.readChatComponent(); + } + + break; + + case REMOVE_PLAYER: + gameprofile = new GameProfile(buf.readUuid(), (String)null); + } + + this.players.add(new S38PacketPlayerListItem.AddPlayerData(gameprofile, k, worldsettings$gametype, ichatcomponent)); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeEnumValue(this.action); + buf.writeVarIntToBuffer(this.players.size()); + + for (S38PacketPlayerListItem.AddPlayerData s38packetplayerlistitem$addplayerdata : this.players) + { + switch (this.action) + { + case ADD_PLAYER: + buf.writeUuid(s38packetplayerlistitem$addplayerdata.getProfile().getId()); + buf.writeString(s38packetplayerlistitem$addplayerdata.getProfile().getName()); + buf.writeVarIntToBuffer(s38packetplayerlistitem$addplayerdata.getProfile().getProperties().size()); + + for (Property property : s38packetplayerlistitem$addplayerdata.getProfile().getProperties().values()) + { + buf.writeString(property.getName()); + buf.writeString(property.getValue()); + + if (property.hasSignature()) + { + buf.writeBoolean(true); + buf.writeString(property.getSignature()); + } + else + { + buf.writeBoolean(false); + } + } + + buf.writeVarIntToBuffer(s38packetplayerlistitem$addplayerdata.getGameMode().getID()); + buf.writeVarIntToBuffer(s38packetplayerlistitem$addplayerdata.getPing()); + + if (s38packetplayerlistitem$addplayerdata.getDisplayName() == null) + { + buf.writeBoolean(false); + } + else + { + buf.writeBoolean(true); + buf.writeChatComponent(s38packetplayerlistitem$addplayerdata.getDisplayName()); + } + + break; + + case UPDATE_GAME_MODE: + buf.writeUuid(s38packetplayerlistitem$addplayerdata.getProfile().getId()); + buf.writeVarIntToBuffer(s38packetplayerlistitem$addplayerdata.getGameMode().getID()); + break; + + case UPDATE_LATENCY: + buf.writeUuid(s38packetplayerlistitem$addplayerdata.getProfile().getId()); + buf.writeVarIntToBuffer(s38packetplayerlistitem$addplayerdata.getPing()); + break; + + case UPDATE_DISPLAY_NAME: + buf.writeUuid(s38packetplayerlistitem$addplayerdata.getProfile().getId()); + + if (s38packetplayerlistitem$addplayerdata.getDisplayName() == null) + { + buf.writeBoolean(false); + } + else + { + buf.writeBoolean(true); + buf.writeChatComponent(s38packetplayerlistitem$addplayerdata.getDisplayName()); + } + + break; + + case REMOVE_PLAYER: + buf.writeUuid(s38packetplayerlistitem$addplayerdata.getProfile().getId()); + } + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handlePlayerListItem(this); + } + + public List func_179767_a() + { + return this.players; + } + + public S38PacketPlayerListItem.Action func_179768_b() + { + return this.action; + } + + public String toString() + { + return Objects.toStringHelper(this).add("action", this.action).add("entries", this.players).toString(); + } + + public static enum Action + { + ADD_PLAYER, + UPDATE_GAME_MODE, + UPDATE_LATENCY, + UPDATE_DISPLAY_NAME, + REMOVE_PLAYER; + } + + public class AddPlayerData + { + private final int ping; + private final WorldSettings.GameType gamemode; + private final GameProfile profile; + private final IChatComponent displayName; + + public AddPlayerData(GameProfile profile, int pingIn, WorldSettings.GameType gamemodeIn, IChatComponent displayNameIn) + { + this.profile = profile; + this.ping = pingIn; + this.gamemode = gamemodeIn; + this.displayName = displayNameIn; + } + + public GameProfile getProfile() + { + return this.profile; + } + + public int getPing() + { + return this.ping; + } + + public WorldSettings.GameType getGameMode() + { + return this.gamemode; + } + + public IChatComponent getDisplayName() + { + return this.displayName; + } + + public String toString() + { + return Objects.toStringHelper(this).add("latency", this.ping).add("gameMode", this.gamemode).add("profile", this.profile).add("displayName", this.displayName == null ? null : IChatComponent.Serializer.componentToJson(this.displayName)).toString(); + } + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S39PacketPlayerAbilities.java b/src/minecraft/net/minecraft/network/play/server/S39PacketPlayerAbilities.java new file mode 100644 index 0000000..dd6ef3b --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S39PacketPlayerAbilities.java @@ -0,0 +1,145 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.player.PlayerCapabilities; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S39PacketPlayerAbilities implements Packet +{ + private boolean invulnerable; + private boolean flying; + private boolean allowFlying; + private boolean creativeMode; + private float flySpeed; + private float walkSpeed; + + public S39PacketPlayerAbilities() + { + } + + public S39PacketPlayerAbilities(PlayerCapabilities capabilities) + { + this.setInvulnerable(capabilities.disableDamage); + this.setFlying(capabilities.isFlying); + this.setAllowFlying(capabilities.allowFlying); + this.setCreativeMode(capabilities.isCreativeMode); + this.setFlySpeed(capabilities.getFlySpeed()); + this.setWalkSpeed(capabilities.getWalkSpeed()); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + byte b0 = buf.readByte(); + this.setInvulnerable((b0 & 1) > 0); + this.setFlying((b0 & 2) > 0); + this.setAllowFlying((b0 & 4) > 0); + this.setCreativeMode((b0 & 8) > 0); + this.setFlySpeed(buf.readFloat()); + this.setWalkSpeed(buf.readFloat()); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + byte b0 = 0; + + if (this.isInvulnerable()) + { + b0 = (byte)(b0 | 1); + } + + if (this.isFlying()) + { + b0 = (byte)(b0 | 2); + } + + if (this.isAllowFlying()) + { + b0 = (byte)(b0 | 4); + } + + if (this.isCreativeMode()) + { + b0 = (byte)(b0 | 8); + } + + buf.writeByte(b0); + buf.writeFloat(this.flySpeed); + buf.writeFloat(this.walkSpeed); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handlePlayerAbilities(this); + } + + public boolean isInvulnerable() + { + return this.invulnerable; + } + + public void setInvulnerable(boolean isInvulnerable) + { + this.invulnerable = isInvulnerable; + } + + public boolean isFlying() + { + return this.flying; + } + + public void setFlying(boolean isFlying) + { + this.flying = isFlying; + } + + public boolean isAllowFlying() + { + return this.allowFlying; + } + + public void setAllowFlying(boolean isAllowFlying) + { + this.allowFlying = isAllowFlying; + } + + public boolean isCreativeMode() + { + return this.creativeMode; + } + + public void setCreativeMode(boolean isCreativeMode) + { + this.creativeMode = isCreativeMode; + } + + public float getFlySpeed() + { + return this.flySpeed; + } + + public void setFlySpeed(float flySpeedIn) + { + this.flySpeed = flySpeedIn; + } + + public float getWalkSpeed() + { + return this.walkSpeed; + } + + public void setWalkSpeed(float walkSpeedIn) + { + this.walkSpeed = walkSpeedIn; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S3APacketTabComplete.java b/src/minecraft/net/minecraft/network/play/server/S3APacketTabComplete.java new file mode 100644 index 0000000..22019c5 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S3APacketTabComplete.java @@ -0,0 +1,59 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S3APacketTabComplete implements Packet +{ + private String[] matches; + + public S3APacketTabComplete() + { + } + + public S3APacketTabComplete(String[] matchesIn) + { + this.matches = matchesIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.matches = new String[buf.readVarIntFromBuffer()]; + + for (int i = 0; i < this.matches.length; ++i) + { + this.matches[i] = buf.readStringFromBuffer(32767); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.matches.length); + + for (String s : this.matches) + { + buf.writeString(s); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleTabComplete(this); + } + + public String[] func_149630_c() + { + return this.matches; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S3BPacketScoreboardObjective.java b/src/minecraft/net/minecraft/network/play/server/S3BPacketScoreboardObjective.java new file mode 100644 index 0000000..8dcbf1e --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S3BPacketScoreboardObjective.java @@ -0,0 +1,86 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.scoreboard.IScoreObjectiveCriteria; +import net.minecraft.scoreboard.ScoreObjective; + +public class S3BPacketScoreboardObjective implements Packet +{ + private String objectiveName; + private String objectiveValue; + private IScoreObjectiveCriteria.EnumRenderType type; + private int field_149342_c; + + public S3BPacketScoreboardObjective() + { + } + + public S3BPacketScoreboardObjective(ScoreObjective p_i45224_1_, int p_i45224_2_) + { + this.objectiveName = p_i45224_1_.getName(); + this.objectiveValue = p_i45224_1_.getDisplayName(); + this.type = p_i45224_1_.getCriteria().getRenderType(); + this.field_149342_c = p_i45224_2_; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.objectiveName = buf.readStringFromBuffer(16); + this.field_149342_c = buf.readByte(); + + if (this.field_149342_c == 0 || this.field_149342_c == 2) + { + this.objectiveValue = buf.readStringFromBuffer(32); + this.type = IScoreObjectiveCriteria.EnumRenderType.func_178795_a(buf.readStringFromBuffer(16)); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.objectiveName); + buf.writeByte(this.field_149342_c); + + if (this.field_149342_c == 0 || this.field_149342_c == 2) + { + buf.writeString(this.objectiveValue); + buf.writeString(this.type.func_178796_a()); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleScoreboardObjective(this); + } + + public String func_149339_c() + { + return this.objectiveName; + } + + public String func_149337_d() + { + return this.objectiveValue; + } + + public int func_149338_e() + { + return this.field_149342_c; + } + + public IScoreObjectiveCriteria.EnumRenderType func_179817_d() + { + return this.type; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S3CPacketUpdateScore.java b/src/minecraft/net/minecraft/network/play/server/S3CPacketUpdateScore.java new file mode 100644 index 0000000..f2e37b5 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S3CPacketUpdateScore.java @@ -0,0 +1,108 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; + +public class S3CPacketUpdateScore implements Packet +{ + private String name = ""; + private String objective = ""; + private int value; + private S3CPacketUpdateScore.Action action; + + public S3CPacketUpdateScore() + { + } + + public S3CPacketUpdateScore(Score scoreIn) + { + this.name = scoreIn.getPlayerName(); + this.objective = scoreIn.getObjective().getName(); + this.value = scoreIn.getScorePoints(); + this.action = S3CPacketUpdateScore.Action.CHANGE; + } + + public S3CPacketUpdateScore(String nameIn) + { + this.name = nameIn; + this.objective = ""; + this.value = 0; + this.action = S3CPacketUpdateScore.Action.REMOVE; + } + + public S3CPacketUpdateScore(String nameIn, ScoreObjective objectiveIn) + { + this.name = nameIn; + this.objective = objectiveIn.getName(); + this.value = 0; + this.action = S3CPacketUpdateScore.Action.REMOVE; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.name = buf.readStringFromBuffer(40); + this.action = (S3CPacketUpdateScore.Action)buf.readEnumValue(S3CPacketUpdateScore.Action.class); + this.objective = buf.readStringFromBuffer(16); + + if (this.action != S3CPacketUpdateScore.Action.REMOVE) + { + this.value = buf.readVarIntFromBuffer(); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.name); + buf.writeEnumValue(this.action); + buf.writeString(this.objective); + + if (this.action != S3CPacketUpdateScore.Action.REMOVE) + { + buf.writeVarIntToBuffer(this.value); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleUpdateScore(this); + } + + public String getPlayerName() + { + return this.name; + } + + public String getObjectiveName() + { + return this.objective; + } + + public int getScoreValue() + { + return this.value; + } + + public S3CPacketUpdateScore.Action getScoreAction() + { + return this.action; + } + + public static enum Action + { + CHANGE, + REMOVE; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S3DPacketDisplayScoreboard.java b/src/minecraft/net/minecraft/network/play/server/S3DPacketDisplayScoreboard.java new file mode 100644 index 0000000..9d1006c --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S3DPacketDisplayScoreboard.java @@ -0,0 +1,67 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.scoreboard.ScoreObjective; + +public class S3DPacketDisplayScoreboard implements Packet +{ + private int position; + private String scoreName; + + public S3DPacketDisplayScoreboard() + { + } + + public S3DPacketDisplayScoreboard(int positionIn, ScoreObjective scoreIn) + { + this.position = positionIn; + + if (scoreIn == null) + { + this.scoreName = ""; + } + else + { + this.scoreName = scoreIn.getName(); + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.position = buf.readByte(); + this.scoreName = buf.readStringFromBuffer(16); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.position); + buf.writeString(this.scoreName); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleDisplayScoreboard(this); + } + + public int func_149371_c() + { + return this.position; + } + + public String func_149370_d() + { + return this.scoreName; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S3EPacketTeams.java b/src/minecraft/net/minecraft/network/play/server/S3EPacketTeams.java new file mode 100644 index 0000000..dd2d569 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S3EPacketTeams.java @@ -0,0 +1,187 @@ +package net.minecraft.network.play.server; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Collection; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Team; + +public class S3EPacketTeams implements Packet +{ + private String field_149320_a = ""; + private String field_149318_b = ""; + private String field_149319_c = ""; + private String field_149316_d = ""; + private String field_179816_e; + private int field_179815_f; + private Collection field_149317_e; + private int field_149314_f; + private int field_149315_g; + + public S3EPacketTeams() + { + this.field_179816_e = Team.EnumVisible.ALWAYS.field_178830_e; + this.field_179815_f = -1; + this.field_149317_e = Lists.newArrayList(); + } + + public S3EPacketTeams(ScorePlayerTeam p_i45225_1_, int p_i45225_2_) + { + this.field_179816_e = Team.EnumVisible.ALWAYS.field_178830_e; + this.field_179815_f = -1; + this.field_149317_e = Lists.newArrayList(); + this.field_149320_a = p_i45225_1_.getRegisteredName(); + this.field_149314_f = p_i45225_2_; + + if (p_i45225_2_ == 0 || p_i45225_2_ == 2) + { + this.field_149318_b = p_i45225_1_.getTeamName(); + this.field_149319_c = p_i45225_1_.getColorPrefix(); + this.field_149316_d = p_i45225_1_.getColorSuffix(); + this.field_149315_g = p_i45225_1_.func_98299_i(); + this.field_179816_e = p_i45225_1_.getNameTagVisibility().field_178830_e; + this.field_179815_f = p_i45225_1_.getChatFormat().getColorIndex(); + } + + if (p_i45225_2_ == 0) + { + this.field_149317_e.addAll(p_i45225_1_.getMembershipCollection()); + } + } + + public S3EPacketTeams(ScorePlayerTeam p_i45226_1_, Collection p_i45226_2_, int p_i45226_3_) + { + this.field_179816_e = Team.EnumVisible.ALWAYS.field_178830_e; + this.field_179815_f = -1; + this.field_149317_e = Lists.newArrayList(); + + if (p_i45226_3_ != 3 && p_i45226_3_ != 4) + { + throw new IllegalArgumentException("Method must be join or leave for player constructor"); + } + else if (p_i45226_2_ != null && !p_i45226_2_.isEmpty()) + { + this.field_149314_f = p_i45226_3_; + this.field_149320_a = p_i45226_1_.getRegisteredName(); + this.field_149317_e.addAll(p_i45226_2_); + } + else + { + throw new IllegalArgumentException("Players cannot be null/empty"); + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.field_149320_a = buf.readStringFromBuffer(16); + this.field_149314_f = buf.readByte(); + + if (this.field_149314_f == 0 || this.field_149314_f == 2) + { + this.field_149318_b = buf.readStringFromBuffer(32); + this.field_149319_c = buf.readStringFromBuffer(16); + this.field_149316_d = buf.readStringFromBuffer(16); + this.field_149315_g = buf.readByte(); + this.field_179816_e = buf.readStringFromBuffer(32); + this.field_179815_f = buf.readByte(); + } + + if (this.field_149314_f == 0 || this.field_149314_f == 3 || this.field_149314_f == 4) + { + int i = buf.readVarIntFromBuffer(); + + for (int j = 0; j < i; ++j) + { + this.field_149317_e.add(buf.readStringFromBuffer(40)); + } + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.field_149320_a); + buf.writeByte(this.field_149314_f); + + if (this.field_149314_f == 0 || this.field_149314_f == 2) + { + buf.writeString(this.field_149318_b); + buf.writeString(this.field_149319_c); + buf.writeString(this.field_149316_d); + buf.writeByte(this.field_149315_g); + buf.writeString(this.field_179816_e); + buf.writeByte(this.field_179815_f); + } + + if (this.field_149314_f == 0 || this.field_149314_f == 3 || this.field_149314_f == 4) + { + buf.writeVarIntToBuffer(this.field_149317_e.size()); + + for (String s : this.field_149317_e) + { + buf.writeString(s); + } + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleTeams(this); + } + + public String func_149312_c() + { + return this.field_149320_a; + } + + public String func_149306_d() + { + return this.field_149318_b; + } + + public String func_149311_e() + { + return this.field_149319_c; + } + + public String func_149309_f() + { + return this.field_149316_d; + } + + public Collection func_149310_g() + { + return this.field_149317_e; + } + + public int func_149307_h() + { + return this.field_149314_f; + } + + public int func_149308_i() + { + return this.field_149315_g; + } + + public int func_179813_h() + { + return this.field_179815_f; + } + + public String func_179814_i() + { + return this.field_179816_e; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java b/src/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java new file mode 100644 index 0000000..9cdb1df --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java @@ -0,0 +1,73 @@ +package net.minecraft.network.play.server; + +import io.netty.buffer.ByteBuf; +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S3FPacketCustomPayload implements Packet +{ + private String channel; + private PacketBuffer data; + + public S3FPacketCustomPayload() + { + } + + public S3FPacketCustomPayload(String channelName, PacketBuffer dataIn) + { + this.channel = channelName; + this.data = dataIn; + + if (dataIn.writerIndex() > 1048576) + { + throw new IllegalArgumentException("Payload may not be larger than 1048576 bytes"); + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.channel = buf.readStringFromBuffer(20); + int i = buf.readableBytes(); + + if (i >= 0 && i <= 1048576) + { + this.data = new PacketBuffer(buf.readBytes(i)); + } + else + { + throw new IOException("Payload may not be larger than 1048576 bytes"); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.channel); + buf.writeBytes((ByteBuf)this.data); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleCustomPayload(this); + } + + public String getChannelName() + { + return this.channel; + } + + public PacketBuffer getBufferData() + { + return this.data; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S40PacketDisconnect.java b/src/minecraft/net/minecraft/network/play/server/S40PacketDisconnect.java new file mode 100644 index 0000000..22c4200 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S40PacketDisconnect.java @@ -0,0 +1,50 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.IChatComponent; + +public class S40PacketDisconnect implements Packet +{ + private IChatComponent reason; + + public S40PacketDisconnect() + { + } + + public S40PacketDisconnect(IChatComponent reasonIn) + { + this.reason = reasonIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.reason = buf.readChatComponent(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeChatComponent(this.reason); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleDisconnect(this); + } + + public IChatComponent getReason() + { + return this.reason; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S41PacketServerDifficulty.java b/src/minecraft/net/minecraft/network/play/server/S41PacketServerDifficulty.java new file mode 100644 index 0000000..f60aaa1 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S41PacketServerDifficulty.java @@ -0,0 +1,57 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.world.EnumDifficulty; + +public class S41PacketServerDifficulty implements Packet +{ + private EnumDifficulty difficulty; + private boolean difficultyLocked; + + public S41PacketServerDifficulty() + { + } + + public S41PacketServerDifficulty(EnumDifficulty difficultyIn, boolean lockedIn) + { + this.difficulty = difficultyIn; + this.difficultyLocked = lockedIn; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleServerDifficulty(this); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.difficulty = EnumDifficulty.getDifficultyEnum(buf.readUnsignedByte()); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeByte(this.difficulty.getDifficultyId()); + } + + public boolean isDifficultyLocked() + { + return this.difficultyLocked; + } + + public EnumDifficulty getDifficulty() + { + return this.difficulty; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S42PacketCombatEvent.java b/src/minecraft/net/minecraft/network/play/server/S42PacketCombatEvent.java new file mode 100644 index 0000000..ffd57e7 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S42PacketCombatEvent.java @@ -0,0 +1,96 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.CombatTracker; + +public class S42PacketCombatEvent implements Packet +{ + public S42PacketCombatEvent.Event eventType; + public int field_179774_b; + public int field_179775_c; + public int field_179772_d; + public String deathMessage; + + public S42PacketCombatEvent() + { + } + + @SuppressWarnings("incomplete-switch") + public S42PacketCombatEvent(CombatTracker combatTrackerIn, S42PacketCombatEvent.Event combatEventType) + { + this.eventType = combatEventType; + EntityLivingBase entitylivingbase = combatTrackerIn.func_94550_c(); + + switch (combatEventType) + { + case END_COMBAT: + this.field_179772_d = combatTrackerIn.func_180134_f(); + this.field_179775_c = entitylivingbase == null ? -1 : entitylivingbase.getEntityId(); + break; + + case ENTITY_DIED: + this.field_179774_b = combatTrackerIn.getFighter().getEntityId(); + this.field_179775_c = entitylivingbase == null ? -1 : entitylivingbase.getEntityId(); + this.deathMessage = combatTrackerIn.getDeathMessage().getUnformattedText(); + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.eventType = (S42PacketCombatEvent.Event)buf.readEnumValue(S42PacketCombatEvent.Event.class); + + if (this.eventType == S42PacketCombatEvent.Event.END_COMBAT) + { + this.field_179772_d = buf.readVarIntFromBuffer(); + this.field_179775_c = buf.readInt(); + } + else if (this.eventType == S42PacketCombatEvent.Event.ENTITY_DIED) + { + this.field_179774_b = buf.readVarIntFromBuffer(); + this.field_179775_c = buf.readInt(); + this.deathMessage = buf.readStringFromBuffer(32767); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeEnumValue(this.eventType); + + if (this.eventType == S42PacketCombatEvent.Event.END_COMBAT) + { + buf.writeVarIntToBuffer(this.field_179772_d); + buf.writeInt(this.field_179775_c); + } + else if (this.eventType == S42PacketCombatEvent.Event.ENTITY_DIED) + { + buf.writeVarIntToBuffer(this.field_179774_b); + buf.writeInt(this.field_179775_c); + buf.writeString(this.deathMessage); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleCombatEvent(this); + } + + public static enum Event + { + ENTER_COMBAT, + END_COMBAT, + ENTITY_DIED; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S43PacketCamera.java b/src/minecraft/net/minecraft/network/play/server/S43PacketCamera.java new file mode 100644 index 0000000..9a5a5f3 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S43PacketCamera.java @@ -0,0 +1,51 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.world.World; + +public class S43PacketCamera implements Packet +{ + public int entityId; + + public S43PacketCamera() + { + } + + public S43PacketCamera(Entity entityIn) + { + this.entityId = entityIn.getEntityId(); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleCamera(this); + } + + public Entity getEntity(World worldIn) + { + return worldIn.getEntityByID(this.entityId); + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S44PacketWorldBorder.java b/src/minecraft/net/minecraft/network/play/server/S44PacketWorldBorder.java new file mode 100644 index 0000000..e093c78 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S44PacketWorldBorder.java @@ -0,0 +1,185 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.world.border.WorldBorder; + +public class S44PacketWorldBorder implements Packet +{ + private S44PacketWorldBorder.Action action; + private int size; + private double centerX; + private double centerZ; + private double targetSize; + private double diameter; + private long timeUntilTarget; + private int warningTime; + private int warningDistance; + + public S44PacketWorldBorder() + { + } + + public S44PacketWorldBorder(WorldBorder border, S44PacketWorldBorder.Action actionIn) + { + this.action = actionIn; + this.centerX = border.getCenterX(); + this.centerZ = border.getCenterZ(); + this.diameter = border.getDiameter(); + this.targetSize = border.getTargetSize(); + this.timeUntilTarget = border.getTimeUntilTarget(); + this.size = border.getSize(); + this.warningDistance = border.getWarningDistance(); + this.warningTime = border.getWarningTime(); + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.action = (S44PacketWorldBorder.Action)buf.readEnumValue(S44PacketWorldBorder.Action.class); + + switch (this.action) + { + case SET_SIZE: + this.targetSize = buf.readDouble(); + break; + + case LERP_SIZE: + this.diameter = buf.readDouble(); + this.targetSize = buf.readDouble(); + this.timeUntilTarget = buf.readVarLong(); + break; + + case SET_CENTER: + this.centerX = buf.readDouble(); + this.centerZ = buf.readDouble(); + break; + + case SET_WARNING_BLOCKS: + this.warningDistance = buf.readVarIntFromBuffer(); + break; + + case SET_WARNING_TIME: + this.warningTime = buf.readVarIntFromBuffer(); + break; + + case INITIALIZE: + this.centerX = buf.readDouble(); + this.centerZ = buf.readDouble(); + this.diameter = buf.readDouble(); + this.targetSize = buf.readDouble(); + this.timeUntilTarget = buf.readVarLong(); + this.size = buf.readVarIntFromBuffer(); + this.warningDistance = buf.readVarIntFromBuffer(); + this.warningTime = buf.readVarIntFromBuffer(); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeEnumValue(this.action); + + switch (this.action) + { + case SET_SIZE: + buf.writeDouble(this.targetSize); + break; + + case LERP_SIZE: + buf.writeDouble(this.diameter); + buf.writeDouble(this.targetSize); + buf.writeVarLong(this.timeUntilTarget); + break; + + case SET_CENTER: + buf.writeDouble(this.centerX); + buf.writeDouble(this.centerZ); + break; + + case SET_WARNING_BLOCKS: + buf.writeVarIntToBuffer(this.warningDistance); + break; + + case SET_WARNING_TIME: + buf.writeVarIntToBuffer(this.warningTime); + break; + + case INITIALIZE: + buf.writeDouble(this.centerX); + buf.writeDouble(this.centerZ); + buf.writeDouble(this.diameter); + buf.writeDouble(this.targetSize); + buf.writeVarLong(this.timeUntilTarget); + buf.writeVarIntToBuffer(this.size); + buf.writeVarIntToBuffer(this.warningDistance); + buf.writeVarIntToBuffer(this.warningTime); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleWorldBorder(this); + } + + public void func_179788_a(WorldBorder border) + { + switch (this.action) + { + case SET_SIZE: + border.setTransition(this.targetSize); + break; + + case LERP_SIZE: + border.setTransition(this.diameter, this.targetSize, this.timeUntilTarget); + break; + + case SET_CENTER: + border.setCenter(this.centerX, this.centerZ); + break; + + case SET_WARNING_BLOCKS: + border.setWarningDistance(this.warningDistance); + break; + + case SET_WARNING_TIME: + border.setWarningTime(this.warningTime); + break; + + case INITIALIZE: + border.setCenter(this.centerX, this.centerZ); + + if (this.timeUntilTarget > 0L) + { + border.setTransition(this.diameter, this.targetSize, this.timeUntilTarget); + } + else + { + border.setTransition(this.targetSize); + } + + border.setSize(this.size); + border.setWarningDistance(this.warningDistance); + border.setWarningTime(this.warningTime); + } + } + + public static enum Action + { + SET_SIZE, + LERP_SIZE, + SET_CENTER, + INITIALIZE, + SET_WARNING_TIME, + SET_WARNING_BLOCKS; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S45PacketTitle.java b/src/minecraft/net/minecraft/network/play/server/S45PacketTitle.java new file mode 100644 index 0000000..c6108d5 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S45PacketTitle.java @@ -0,0 +1,147 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.IChatComponent; + +public class S45PacketTitle implements Packet +{ + private S45PacketTitle.Type type; + private IChatComponent message; + private int fadeInTime; + private int displayTime; + private int fadeOutTime; + + public S45PacketTitle() + { + } + + public S45PacketTitle(S45PacketTitle.Type type, IChatComponent message) + { + this(type, message, -1, -1, -1); + } + + public S45PacketTitle(int fadeInTime, int displayTime, int fadeOutTime) + { + this(S45PacketTitle.Type.TIMES, (IChatComponent)null, fadeInTime, displayTime, fadeOutTime); + } + + public S45PacketTitle(S45PacketTitle.Type type, IChatComponent message, int fadeInTime, int displayTime, int fadeOutTime) + { + this.type = type; + this.message = message; + this.fadeInTime = fadeInTime; + this.displayTime = displayTime; + this.fadeOutTime = fadeOutTime; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.type = (S45PacketTitle.Type)buf.readEnumValue(S45PacketTitle.Type.class); + + if (this.type == S45PacketTitle.Type.TITLE || this.type == S45PacketTitle.Type.SUBTITLE) + { + this.message = buf.readChatComponent(); + } + + if (this.type == S45PacketTitle.Type.TIMES) + { + this.fadeInTime = buf.readInt(); + this.displayTime = buf.readInt(); + this.fadeOutTime = buf.readInt(); + } + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeEnumValue(this.type); + + if (this.type == S45PacketTitle.Type.TITLE || this.type == S45PacketTitle.Type.SUBTITLE) + { + buf.writeChatComponent(this.message); + } + + if (this.type == S45PacketTitle.Type.TIMES) + { + buf.writeInt(this.fadeInTime); + buf.writeInt(this.displayTime); + buf.writeInt(this.fadeOutTime); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleTitle(this); + } + + public S45PacketTitle.Type getType() + { + return this.type; + } + + public IChatComponent getMessage() + { + return this.message; + } + + public int getFadeInTime() + { + return this.fadeInTime; + } + + public int getDisplayTime() + { + return this.displayTime; + } + + public int getFadeOutTime() + { + return this.fadeOutTime; + } + + public static enum Type + { + TITLE, + SUBTITLE, + TIMES, + CLEAR, + RESET; + + public static S45PacketTitle.Type byName(String name) + { + for (S45PacketTitle.Type s45packettitle$type : values()) + { + if (s45packettitle$type.name().equalsIgnoreCase(name)) + { + return s45packettitle$type; + } + } + + return TITLE; + } + + public static String[] getNames() + { + String[] astring = new String[values().length]; + int i = 0; + + for (S45PacketTitle.Type s45packettitle$type : values()) + { + astring[i++] = s45packettitle$type.name().toLowerCase(); + } + + return astring; + } + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S46PacketSetCompressionLevel.java b/src/minecraft/net/minecraft/network/play/server/S46PacketSetCompressionLevel.java new file mode 100644 index 0000000..971b312 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S46PacketSetCompressionLevel.java @@ -0,0 +1,40 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S46PacketSetCompressionLevel implements Packet +{ + private int field_179761_a; + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.field_179761_a = buf.readVarIntFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.field_179761_a); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleSetCompressionLevel(this); + } + + public int func_179760_a() + { + return this.field_179761_a; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S47PacketPlayerListHeaderFooter.java b/src/minecraft/net/minecraft/network/play/server/S47PacketPlayerListHeaderFooter.java new file mode 100644 index 0000000..f3b4ccc --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S47PacketPlayerListHeaderFooter.java @@ -0,0 +1,58 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.util.IChatComponent; + +public class S47PacketPlayerListHeaderFooter implements Packet +{ + private IChatComponent header; + private IChatComponent footer; + + public S47PacketPlayerListHeaderFooter() + { + } + + public S47PacketPlayerListHeaderFooter(IChatComponent headerIn) + { + this.header = headerIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.header = buf.readChatComponent(); + this.footer = buf.readChatComponent(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeChatComponent(this.header); + buf.writeChatComponent(this.footer); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handlePlayerListHeaderFooter(this); + } + + public IChatComponent getHeader() + { + return this.header; + } + + public IChatComponent getFooter() + { + return this.footer; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S48PacketResourcePackSend.java b/src/minecraft/net/minecraft/network/play/server/S48PacketResourcePackSend.java new file mode 100644 index 0000000..4420f27 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S48PacketResourcePackSend.java @@ -0,0 +1,63 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; + +public class S48PacketResourcePackSend implements Packet +{ + private String url; + private String hash; + + public S48PacketResourcePackSend() + { + } + + public S48PacketResourcePackSend(String url, String hash) + { + this.url = url; + this.hash = hash; + + if (hash.length() > 40) + { + throw new IllegalArgumentException("Hash is too long (max 40, was " + hash.length() + ")"); + } + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.url = buf.readStringFromBuffer(32767); + this.hash = buf.readStringFromBuffer(40); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(this.url); + buf.writeString(this.hash); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleResourcePack(this); + } + + public String getURL() + { + return this.url; + } + + public String getHash() + { + return this.hash; + } +} diff --git a/src/minecraft/net/minecraft/network/play/server/S49PacketUpdateEntityNBT.java b/src/minecraft/net/minecraft/network/play/server/S49PacketUpdateEntityNBT.java new file mode 100644 index 0000000..c001003 --- /dev/null +++ b/src/minecraft/net/minecraft/network/play/server/S49PacketUpdateEntityNBT.java @@ -0,0 +1,61 @@ +package net.minecraft.network.play.server; + +import java.io.IOException; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.world.World; + +public class S49PacketUpdateEntityNBT implements Packet +{ + private int entityId; + private NBTTagCompound tagCompound; + + public S49PacketUpdateEntityNBT() + { + } + + public S49PacketUpdateEntityNBT(int entityIdIn, NBTTagCompound tagCompoundIn) + { + this.entityId = entityIdIn; + this.tagCompound = tagCompoundIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.entityId = buf.readVarIntFromBuffer(); + this.tagCompound = buf.readNBTTagCompoundFromBuffer(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeVarIntToBuffer(this.entityId); + buf.writeNBTTagCompoundToBuffer(this.tagCompound); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerPlayClient handler) + { + handler.handleEntityNBT(this); + } + + public NBTTagCompound getTagCompound() + { + return this.tagCompound; + } + + public Entity getEntity(World worldIn) + { + return worldIn.getEntityByID(this.entityId); + } +} diff --git a/src/minecraft/net/minecraft/network/rcon/RConConsoleSource.java b/src/minecraft/net/minecraft/network/rcon/RConConsoleSource.java new file mode 100644 index 0000000..fa708ff --- /dev/null +++ b/src/minecraft/net/minecraft/network/rcon/RConConsoleSource.java @@ -0,0 +1,99 @@ +package net.minecraft.network.rcon; + +import net.minecraft.command.CommandResultStats; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.Entity; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class RConConsoleSource implements ICommandSender +{ + /** Single instance of RConConsoleSource */ + private static final RConConsoleSource instance = new RConConsoleSource(); + + /** RCon string buffer for log. */ + private StringBuffer buffer = new StringBuffer(); + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return "Rcon"; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return new ChatComponentText(this.getName()); + } + + /** + * Send a chat message to the CommandSender + */ + public void addChatMessage(IChatComponent component) + { + this.buffer.append(component.getUnformattedText()); + } + + /** + * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not + */ + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { + return true; + } + + /** + * Get the position in the world. {@code null} is not allowed! If you are not an entity in the world, return + * the coordinates 0, 0, 0 + */ + public BlockPos getPosition() + { + return new BlockPos(0, 0, 0); + } + + /** + * Get the position vector. {@code null} is not allowed! If you are not an entity in the world, return 0.0D, + * 0.0D, 0.0D + */ + public Vec3 getPositionVector() + { + return new Vec3(0.0D, 0.0D, 0.0D); + } + + /** + * Get the world, if available. {@code null} is not allowed! If you are not an entity in the world, return + * the overworld + */ + public World getEntityWorld() + { + return MinecraftServer.getServer().getEntityWorld(); + } + + /** + * Returns the entity associated with the command sender. MAY BE NULL! + */ + public Entity getCommandSenderEntity() + { + return null; + } + + /** + * Returns true if the command sender should be sent feedback about executed commands + */ + public boolean sendCommandFeedback() + { + return true; + } + + public void setCommandStat(CommandResultStats.Type type, int amount) + { + } +} diff --git a/src/minecraft/net/minecraft/network/status/INetHandlerStatusClient.java b/src/minecraft/net/minecraft/network/status/INetHandlerStatusClient.java new file mode 100644 index 0000000..ebff468 --- /dev/null +++ b/src/minecraft/net/minecraft/network/status/INetHandlerStatusClient.java @@ -0,0 +1,12 @@ +package net.minecraft.network.status; + +import net.minecraft.network.INetHandler; +import net.minecraft.network.status.server.S00PacketServerInfo; +import net.minecraft.network.status.server.S01PacketPong; + +public interface INetHandlerStatusClient extends INetHandler +{ + void handleServerInfo(S00PacketServerInfo packetIn); + + void handlePong(S01PacketPong packetIn); +} diff --git a/src/minecraft/net/minecraft/network/status/INetHandlerStatusServer.java b/src/minecraft/net/minecraft/network/status/INetHandlerStatusServer.java new file mode 100644 index 0000000..cfdd5b3 --- /dev/null +++ b/src/minecraft/net/minecraft/network/status/INetHandlerStatusServer.java @@ -0,0 +1,12 @@ +package net.minecraft.network.status; + +import net.minecraft.network.INetHandler; +import net.minecraft.network.status.client.C00PacketServerQuery; +import net.minecraft.network.status.client.C01PacketPing; + +public interface INetHandlerStatusServer extends INetHandler +{ + void processPing(C01PacketPing packetIn); + + void processServerQuery(C00PacketServerQuery packetIn); +} diff --git a/src/minecraft/net/minecraft/network/status/client/C00PacketServerQuery.java b/src/minecraft/net/minecraft/network/status/client/C00PacketServerQuery.java new file mode 100644 index 0000000..e702c2e --- /dev/null +++ b/src/minecraft/net/minecraft/network/status/client/C00PacketServerQuery.java @@ -0,0 +1,31 @@ +package net.minecraft.network.status.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.status.INetHandlerStatusServer; + +public class C00PacketServerQuery implements Packet +{ + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerStatusServer handler) + { + handler.processServerQuery(this); + } +} diff --git a/src/minecraft/net/minecraft/network/status/client/C01PacketPing.java b/src/minecraft/net/minecraft/network/status/client/C01PacketPing.java new file mode 100644 index 0000000..189f27e --- /dev/null +++ b/src/minecraft/net/minecraft/network/status/client/C01PacketPing.java @@ -0,0 +1,49 @@ +package net.minecraft.network.status.client; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.status.INetHandlerStatusServer; + +public class C01PacketPing implements Packet +{ + private long clientTime; + + public C01PacketPing() + { + } + + public C01PacketPing(long ping) + { + this.clientTime = ping; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.clientTime = buf.readLong(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeLong(this.clientTime); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerStatusServer handler) + { + handler.processPing(this); + } + + public long getClientTime() + { + return this.clientTime; + } +} diff --git a/src/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java b/src/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java new file mode 100644 index 0000000..fe92be2 --- /dev/null +++ b/src/minecraft/net/minecraft/network/status/server/S00PacketServerInfo.java @@ -0,0 +1,56 @@ +package net.minecraft.network.status.server; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.ServerStatusResponse; +import net.minecraft.network.status.INetHandlerStatusClient; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.EnumTypeAdapterFactory; +import net.minecraft.util.IChatComponent; + +public class S00PacketServerInfo implements Packet +{ + private static final Gson GSON = (new GsonBuilder()).registerTypeAdapter(ServerStatusResponse.MinecraftProtocolVersionIdentifier.class, new ServerStatusResponse.MinecraftProtocolVersionIdentifier.Serializer()).registerTypeAdapter(ServerStatusResponse.PlayerCountData.class, new ServerStatusResponse.PlayerCountData.Serializer()).registerTypeAdapter(ServerStatusResponse.class, new ServerStatusResponse.Serializer()).registerTypeHierarchyAdapter(IChatComponent.class, new IChatComponent.Serializer()).registerTypeHierarchyAdapter(ChatStyle.class, new ChatStyle.Serializer()).registerTypeAdapterFactory(new EnumTypeAdapterFactory()).create(); + private ServerStatusResponse response; + + public S00PacketServerInfo() + { + } + + public S00PacketServerInfo(ServerStatusResponse responseIn) + { + this.response = responseIn; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.response = (ServerStatusResponse)GSON.fromJson(buf.readStringFromBuffer(32767), ServerStatusResponse.class); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeString(GSON.toJson((Object)this.response)); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerStatusClient handler) + { + handler.handleServerInfo(this); + } + + public ServerStatusResponse getResponse() + { + return this.response; + } +} diff --git a/src/minecraft/net/minecraft/network/status/server/S01PacketPong.java b/src/minecraft/net/minecraft/network/status/server/S01PacketPong.java new file mode 100644 index 0000000..1b66921 --- /dev/null +++ b/src/minecraft/net/minecraft/network/status/server/S01PacketPong.java @@ -0,0 +1,44 @@ +package net.minecraft.network.status.server; + +import java.io.IOException; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.status.INetHandlerStatusClient; + +public class S01PacketPong implements Packet +{ + private long clientTime; + + public S01PacketPong() + { + } + + public S01PacketPong(long time) + { + this.clientTime = time; + } + + /** + * Reads the raw packet data from the data stream. + */ + public void readPacketData(PacketBuffer buf) throws IOException + { + this.clientTime = buf.readLong(); + } + + /** + * Writes the raw packet data to the data stream. + */ + public void writePacketData(PacketBuffer buf) throws IOException + { + buf.writeLong(this.clientTime); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(INetHandlerStatusClient handler) + { + handler.handlePong(this); + } +} diff --git a/src/minecraft/net/minecraft/pathfinding/Path.java b/src/minecraft/net/minecraft/pathfinding/Path.java new file mode 100644 index 0000000..e146acc --- /dev/null +++ b/src/minecraft/net/minecraft/pathfinding/Path.java @@ -0,0 +1,175 @@ +package net.minecraft.pathfinding; + +public class Path +{ + /** Contains the points in this path */ + private PathPoint[] pathPoints = new PathPoint[1024]; + + /** The number of points in this path */ + private int count; + + /** + * Adds a point to the path + */ + public PathPoint addPoint(PathPoint point) + { + if (point.index >= 0) + { + throw new IllegalStateException("OW KNOWS!"); + } + else + { + if (this.count == this.pathPoints.length) + { + PathPoint[] apathpoint = new PathPoint[this.count << 1]; + System.arraycopy(this.pathPoints, 0, apathpoint, 0, this.count); + this.pathPoints = apathpoint; + } + + this.pathPoints[this.count] = point; + point.index = this.count; + this.sortBack(this.count++); + return point; + } + } + + /** + * Clears the path + */ + public void clearPath() + { + this.count = 0; + } + + /** + * Returns and removes the first point in the path + */ + public PathPoint dequeue() + { + PathPoint pathpoint = this.pathPoints[0]; + this.pathPoints[0] = this.pathPoints[--this.count]; + this.pathPoints[this.count] = null; + + if (this.count > 0) + { + this.sortForward(0); + } + + pathpoint.index = -1; + return pathpoint; + } + + /** + * Changes the provided point's distance to target + */ + public void changeDistance(PathPoint p_75850_1_, float p_75850_2_) + { + float f = p_75850_1_.distanceToTarget; + p_75850_1_.distanceToTarget = p_75850_2_; + + if (p_75850_2_ < f) + { + this.sortBack(p_75850_1_.index); + } + else + { + this.sortForward(p_75850_1_.index); + } + } + + /** + * Sorts a point to the left + */ + private void sortBack(int p_75847_1_) + { + PathPoint pathpoint = this.pathPoints[p_75847_1_]; + int i; + + for (float f = pathpoint.distanceToTarget; p_75847_1_ > 0; p_75847_1_ = i) + { + i = p_75847_1_ - 1 >> 1; + PathPoint pathpoint1 = this.pathPoints[i]; + + if (f >= pathpoint1.distanceToTarget) + { + break; + } + + this.pathPoints[p_75847_1_] = pathpoint1; + pathpoint1.index = p_75847_1_; + } + + this.pathPoints[p_75847_1_] = pathpoint; + pathpoint.index = p_75847_1_; + } + + /** + * Sorts a point to the right + */ + private void sortForward(int p_75846_1_) + { + PathPoint pathpoint = this.pathPoints[p_75846_1_]; + float f = pathpoint.distanceToTarget; + + while (true) + { + int i = 1 + (p_75846_1_ << 1); + int j = i + 1; + + if (i >= this.count) + { + break; + } + + PathPoint pathpoint1 = this.pathPoints[i]; + float f1 = pathpoint1.distanceToTarget; + PathPoint pathpoint2; + float f2; + + if (j >= this.count) + { + pathpoint2 = null; + f2 = Float.POSITIVE_INFINITY; + } + else + { + pathpoint2 = this.pathPoints[j]; + f2 = pathpoint2.distanceToTarget; + } + + if (f1 < f2) + { + if (f1 >= f) + { + break; + } + + this.pathPoints[p_75846_1_] = pathpoint1; + pathpoint1.index = p_75846_1_; + p_75846_1_ = i; + } + else + { + if (f2 >= f) + { + break; + } + + this.pathPoints[p_75846_1_] = pathpoint2; + pathpoint2.index = p_75846_1_; + p_75846_1_ = j; + } + } + + this.pathPoints[p_75846_1_] = pathpoint; + pathpoint.index = p_75846_1_; + } + + /** + * Returns true if this path contains no points + */ + public boolean isPathEmpty() + { + return this.count == 0; + } +} diff --git a/src/minecraft/net/minecraft/pathfinding/PathEntity.java b/src/minecraft/net/minecraft/pathfinding/PathEntity.java new file mode 100644 index 0000000..1e744d9 --- /dev/null +++ b/src/minecraft/net/minecraft/pathfinding/PathEntity.java @@ -0,0 +1,129 @@ +package net.minecraft.pathfinding; + +import net.minecraft.entity.Entity; +import net.minecraft.util.Vec3; + +public class PathEntity +{ + /** The actual points in the path */ + private final PathPoint[] points; + + /** PathEntity Array Index the Entity is currently targeting */ + private int currentPathIndex; + + /** The total length of the path */ + private int pathLength; + + public PathEntity(PathPoint[] pathpoints) + { + this.points = pathpoints; + this.pathLength = pathpoints.length; + } + + /** + * Directs this path to the next point in its array + */ + public void incrementPathIndex() + { + ++this.currentPathIndex; + } + + /** + * Returns true if this path has reached the end + */ + public boolean isFinished() + { + return this.currentPathIndex >= this.pathLength; + } + + /** + * returns the last PathPoint of the Array + */ + public PathPoint getFinalPathPoint() + { + return this.pathLength > 0 ? this.points[this.pathLength - 1] : null; + } + + /** + * return the PathPoint located at the specified PathIndex, usually the current one + */ + public PathPoint getPathPointFromIndex(int index) + { + return this.points[index]; + } + + public int getCurrentPathLength() + { + return this.pathLength; + } + + public void setCurrentPathLength(int length) + { + this.pathLength = length; + } + + public int getCurrentPathIndex() + { + return this.currentPathIndex; + } + + public void setCurrentPathIndex(int currentPathIndexIn) + { + this.currentPathIndex = currentPathIndexIn; + } + + /** + * Gets the vector of the PathPoint associated with the given index. + */ + public Vec3 getVectorFromIndex(Entity entityIn, int index) + { + double d0 = (double)this.points[index].xCoord + (double)((int)(entityIn.width + 1.0F)) * 0.5D; + double d1 = (double)this.points[index].yCoord; + double d2 = (double)this.points[index].zCoord + (double)((int)(entityIn.width + 1.0F)) * 0.5D; + return new Vec3(d0, d1, d2); + } + + /** + * returns the current PathEntity target node as Vec3D + */ + public Vec3 getPosition(Entity entityIn) + { + return this.getVectorFromIndex(entityIn, this.currentPathIndex); + } + + /** + * Returns true if the EntityPath are the same. Non instance related equals. + */ + public boolean isSamePath(PathEntity pathentityIn) + { + if (pathentityIn == null) + { + return false; + } + else if (pathentityIn.points.length != this.points.length) + { + return false; + } + else + { + for (int i = 0; i < this.points.length; ++i) + { + if (this.points[i].xCoord != pathentityIn.points[i].xCoord || this.points[i].yCoord != pathentityIn.points[i].yCoord || this.points[i].zCoord != pathentityIn.points[i].zCoord) + { + return false; + } + } + + return true; + } + } + + /** + * Returns true if the final PathPoint in the PathEntity is equal to Vec3D coords. + */ + public boolean isDestinationSame(Vec3 vec) + { + PathPoint pathpoint = this.getFinalPathPoint(); + return pathpoint == null ? false : pathpoint.xCoord == (int)vec.xCoord && pathpoint.zCoord == (int)vec.zCoord; + } +} diff --git a/src/minecraft/net/minecraft/pathfinding/PathFinder.java b/src/minecraft/net/minecraft/pathfinding/PathFinder.java new file mode 100644 index 0000000..284b1c5 --- /dev/null +++ b/src/minecraft/net/minecraft/pathfinding/PathFinder.java @@ -0,0 +1,139 @@ +package net.minecraft.pathfinding; + +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.pathfinder.NodeProcessor; + +public class PathFinder +{ + /** The path being generated */ + private Path path = new Path(); + + /** Selection of path points to add to the path */ + private PathPoint[] pathOptions = new PathPoint[32]; + private NodeProcessor nodeProcessor; + + public PathFinder(NodeProcessor nodeProcessorIn) + { + this.nodeProcessor = nodeProcessorIn; + } + + /** + * Creates a path from one entity to another within a minimum distance + */ + public PathEntity createEntityPathTo(IBlockAccess blockaccess, Entity entityFrom, Entity entityTo, float dist) + { + return this.createEntityPathTo(blockaccess, entityFrom, entityTo.posX, entityTo.getEntityBoundingBox().minY, entityTo.posZ, dist); + } + + /** + * Creates a path from an entity to a specified location within a minimum distance + */ + public PathEntity createEntityPathTo(IBlockAccess blockaccess, Entity entityIn, BlockPos targetPos, float dist) + { + return this.createEntityPathTo(blockaccess, entityIn, (double)((float)targetPos.getX() + 0.5F), (double)((float)targetPos.getY() + 0.5F), (double)((float)targetPos.getZ() + 0.5F), dist); + } + + /** + * Internal implementation of creating a path from an entity to a point + */ + private PathEntity createEntityPathTo(IBlockAccess blockaccess, Entity entityIn, double x, double y, double z, float distance) + { + this.path.clearPath(); + this.nodeProcessor.initProcessor(blockaccess, entityIn); + PathPoint pathpoint = this.nodeProcessor.getPathPointTo(entityIn); + PathPoint pathpoint1 = this.nodeProcessor.getPathPointToCoords(entityIn, x, y, z); + PathEntity pathentity = this.addToPath(entityIn, pathpoint, pathpoint1, distance); + this.nodeProcessor.postProcess(); + return pathentity; + } + + /** + * Adds a path from start to end and returns the whole path + */ + private PathEntity addToPath(Entity entityIn, PathPoint pathpointStart, PathPoint pathpointEnd, float maxDistance) + { + pathpointStart.totalPathDistance = 0.0F; + pathpointStart.distanceToNext = pathpointStart.distanceToSquared(pathpointEnd); + pathpointStart.distanceToTarget = pathpointStart.distanceToNext; + this.path.clearPath(); + this.path.addPoint(pathpointStart); + PathPoint pathpoint = pathpointStart; + + while (!this.path.isPathEmpty()) + { + PathPoint pathpoint1 = this.path.dequeue(); + + if (pathpoint1.equals(pathpointEnd)) + { + return this.createEntityPath(pathpointStart, pathpointEnd); + } + + if (pathpoint1.distanceToSquared(pathpointEnd) < pathpoint.distanceToSquared(pathpointEnd)) + { + pathpoint = pathpoint1; + } + + pathpoint1.visited = true; + int i = this.nodeProcessor.findPathOptions(this.pathOptions, entityIn, pathpoint1, pathpointEnd, maxDistance); + + for (int j = 0; j < i; ++j) + { + PathPoint pathpoint2 = this.pathOptions[j]; + float f = pathpoint1.totalPathDistance + pathpoint1.distanceToSquared(pathpoint2); + + if (f < maxDistance * 2.0F && (!pathpoint2.isAssigned() || f < pathpoint2.totalPathDistance)) + { + pathpoint2.previous = pathpoint1; + pathpoint2.totalPathDistance = f; + pathpoint2.distanceToNext = pathpoint2.distanceToSquared(pathpointEnd); + + if (pathpoint2.isAssigned()) + { + this.path.changeDistance(pathpoint2, pathpoint2.totalPathDistance + pathpoint2.distanceToNext); + } + else + { + pathpoint2.distanceToTarget = pathpoint2.totalPathDistance + pathpoint2.distanceToNext; + this.path.addPoint(pathpoint2); + } + } + } + } + + if (pathpoint == pathpointStart) + { + return null; + } + else + { + return this.createEntityPath(pathpointStart, pathpoint); + } + } + + /** + * Returns a new PathEntity for a given start and end point + */ + private PathEntity createEntityPath(PathPoint start, PathPoint end) + { + int i = 1; + + for (PathPoint pathpoint = end; pathpoint.previous != null; pathpoint = pathpoint.previous) + { + ++i; + } + + PathPoint[] apathpoint = new PathPoint[i]; + PathPoint pathpoint1 = end; + --i; + + for (apathpoint[i] = end; pathpoint1.previous != null; apathpoint[i] = pathpoint1) + { + pathpoint1 = pathpoint1.previous; + --i; + } + + return new PathEntity(apathpoint); + } +} diff --git a/src/minecraft/net/minecraft/pathfinding/PathNavigate.java b/src/minecraft/net/minecraft/pathfinding/PathNavigate.java new file mode 100644 index 0000000..e118bc8 --- /dev/null +++ b/src/minecraft/net/minecraft/pathfinding/PathNavigate.java @@ -0,0 +1,337 @@ +package net.minecraft.pathfinding; + +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.ChunkCache; +import net.minecraft.world.World; + +public abstract class PathNavigate +{ + protected EntityLiving theEntity; + protected World worldObj; + + /** The PathEntity being followed. */ + protected PathEntity currentPath; + protected double speed; + + /** + * The number of blocks (extra) +/- in each axis that get pulled out as cache for the pathfinder's search space + */ + private final IAttributeInstance pathSearchRange; + + /** Time, in number of ticks, following the current path */ + private int totalTicks; + + /** + * The time when the last position check was done (to detect successful movement) + */ + private int ticksAtLastPos; + + /** + * Coordinates of the entity's position last time a check was done (part of monitoring getting 'stuck') + */ + private Vec3 lastPosCheck = new Vec3(0.0D, 0.0D, 0.0D); + private float heightRequirement = 1.0F; + private final PathFinder pathFinder; + + public PathNavigate(EntityLiving entitylivingIn, World worldIn) + { + this.theEntity = entitylivingIn; + this.worldObj = worldIn; + this.pathSearchRange = entitylivingIn.getEntityAttribute(SharedMonsterAttributes.followRange); + this.pathFinder = this.getPathFinder(); + } + + protected abstract PathFinder getPathFinder(); + + /** + * Sets the speed + */ + public void setSpeed(double speedIn) + { + this.speed = speedIn; + } + + /** + * Gets the maximum distance that the path finding will search in. + */ + public float getPathSearchRange() + { + return (float)this.pathSearchRange.getAttributeValue(); + } + + /** + * Returns the path to the given coordinates. Args : x, y, z + */ + public final PathEntity getPathToXYZ(double x, double y, double z) + { + return this.getPathToPos(new BlockPos(MathHelper.floor_double(x), (int)y, MathHelper.floor_double(z))); + } + + /** + * Returns path to given BlockPos + */ + public PathEntity getPathToPos(BlockPos pos) + { + if (!this.canNavigate()) + { + return null; + } + else + { + float f = this.getPathSearchRange(); + this.worldObj.theProfiler.startSection("pathfind"); + BlockPos blockpos = new BlockPos(this.theEntity); + int i = (int)(f + 8.0F); + ChunkCache chunkcache = new ChunkCache(this.worldObj, blockpos.add(-i, -i, -i), blockpos.add(i, i, i), 0); + PathEntity pathentity = this.pathFinder.createEntityPathTo(chunkcache, this.theEntity, pos, f); + this.worldObj.theProfiler.endSection(); + return pathentity; + } + } + + /** + * Try to find and set a path to XYZ. Returns true if successful. Args : x, y, z, speed + */ + public boolean tryMoveToXYZ(double x, double y, double z, double speedIn) + { + PathEntity pathentity = this.getPathToXYZ((double)MathHelper.floor_double(x), (double)((int)y), (double)MathHelper.floor_double(z)); + return this.setPath(pathentity, speedIn); + } + + /** + * Sets vertical space requirement for path + */ + public void setHeightRequirement(float jumpHeight) + { + this.heightRequirement = jumpHeight; + } + + /** + * Returns the path to the given EntityLiving. Args : entity + */ + public PathEntity getPathToEntityLiving(Entity entityIn) + { + if (!this.canNavigate()) + { + return null; + } + else + { + float f = this.getPathSearchRange(); + this.worldObj.theProfiler.startSection("pathfind"); + BlockPos blockpos = (new BlockPos(this.theEntity)).up(); + int i = (int)(f + 16.0F); + ChunkCache chunkcache = new ChunkCache(this.worldObj, blockpos.add(-i, -i, -i), blockpos.add(i, i, i), 0); + PathEntity pathentity = this.pathFinder.createEntityPathTo(chunkcache, this.theEntity, entityIn, f); + this.worldObj.theProfiler.endSection(); + return pathentity; + } + } + + /** + * Try to find and set a path to EntityLiving. Returns true if successful. Args : entity, speed + */ + public boolean tryMoveToEntityLiving(Entity entityIn, double speedIn) + { + PathEntity pathentity = this.getPathToEntityLiving(entityIn); + return pathentity != null ? this.setPath(pathentity, speedIn) : false; + } + + /** + * Sets a new path. If it's diferent from the old path. Checks to adjust path for sun avoiding, and stores start + * coords. Args : path, speed + */ + public boolean setPath(PathEntity pathentityIn, double speedIn) + { + if (pathentityIn == null) + { + this.currentPath = null; + return false; + } + else + { + if (!pathentityIn.isSamePath(this.currentPath)) + { + this.currentPath = pathentityIn; + } + + this.removeSunnyPath(); + + if (this.currentPath.getCurrentPathLength() == 0) + { + return false; + } + else + { + this.speed = speedIn; + Vec3 vec3 = this.getEntityPosition(); + this.ticksAtLastPos = this.totalTicks; + this.lastPosCheck = vec3; + return true; + } + } + } + + /** + * gets the actively used PathEntity + */ + public PathEntity getPath() + { + return this.currentPath; + } + + public void onUpdateNavigation() + { + ++this.totalTicks; + + if (!this.noPath()) + { + if (this.canNavigate()) + { + this.pathFollow(); + } + else if (this.currentPath != null && this.currentPath.getCurrentPathIndex() < this.currentPath.getCurrentPathLength()) + { + Vec3 vec3 = this.getEntityPosition(); + Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, this.currentPath.getCurrentPathIndex()); + + if (vec3.yCoord > vec31.yCoord && !this.theEntity.onGround && MathHelper.floor_double(vec3.xCoord) == MathHelper.floor_double(vec31.xCoord) && MathHelper.floor_double(vec3.zCoord) == MathHelper.floor_double(vec31.zCoord)) + { + this.currentPath.setCurrentPathIndex(this.currentPath.getCurrentPathIndex() + 1); + } + } + + if (!this.noPath()) + { + Vec3 vec32 = this.currentPath.getPosition(this.theEntity); + + if (vec32 != null) + { + AxisAlignedBB axisalignedbb1 = (new AxisAlignedBB(vec32.xCoord, vec32.yCoord, vec32.zCoord, vec32.xCoord, vec32.yCoord, vec32.zCoord)).expand(0.5D, 0.5D, 0.5D); + List list = this.worldObj.getCollidingBoundingBoxes(this.theEntity, axisalignedbb1.addCoord(0.0D, -1.0D, 0.0D)); + double d0 = -1.0D; + axisalignedbb1 = axisalignedbb1.offset(0.0D, 1.0D, 0.0D); + + for (AxisAlignedBB axisalignedbb : list) + { + d0 = axisalignedbb.calculateYOffset(axisalignedbb1, d0); + } + + this.theEntity.getMoveHelper().setMoveTo(vec32.xCoord, vec32.yCoord + d0, vec32.zCoord, this.speed); + } + } + } + } + + protected void pathFollow() + { + Vec3 vec3 = this.getEntityPosition(); + int i = this.currentPath.getCurrentPathLength(); + + for (int j = this.currentPath.getCurrentPathIndex(); j < this.currentPath.getCurrentPathLength(); ++j) + { + if (this.currentPath.getPathPointFromIndex(j).yCoord != (int)vec3.yCoord) + { + i = j; + break; + } + } + + float f = this.theEntity.width * this.theEntity.width * this.heightRequirement; + + for (int k = this.currentPath.getCurrentPathIndex(); k < i; ++k) + { + Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, k); + + if (vec3.squareDistanceTo(vec31) < (double)f) + { + this.currentPath.setCurrentPathIndex(k + 1); + } + } + + int j1 = MathHelper.ceiling_float_int(this.theEntity.width); + int k1 = (int)this.theEntity.height + 1; + int l = j1; + + for (int i1 = i - 1; i1 >= this.currentPath.getCurrentPathIndex(); --i1) + { + if (this.isDirectPathBetweenPoints(vec3, this.currentPath.getVectorFromIndex(this.theEntity, i1), j1, k1, l)) + { + this.currentPath.setCurrentPathIndex(i1); + break; + } + } + + this.checkForStuck(vec3); + } + + /** + * Checks if entity haven't been moved when last checked and if so, clears current {@link + * net.minecraft.pathfinding.PathEntity} + */ + protected void checkForStuck(Vec3 positionVec3) + { + if (this.totalTicks - this.ticksAtLastPos > 100) + { + if (positionVec3.squareDistanceTo(this.lastPosCheck) < 2.25D) + { + this.clearPathEntity(); + } + + this.ticksAtLastPos = this.totalTicks; + this.lastPosCheck = positionVec3; + } + } + + /** + * If null path or reached the end + */ + public boolean noPath() + { + return this.currentPath == null || this.currentPath.isFinished(); + } + + /** + * sets active PathEntity to null + */ + public void clearPathEntity() + { + this.currentPath = null; + } + + protected abstract Vec3 getEntityPosition(); + + /** + * If on ground or swimming and can swim + */ + protected abstract boolean canNavigate(); + + /** + * Returns true if the entity is in water or lava, false otherwise + */ + protected boolean isInLiquid() + { + return this.theEntity.isInWater() || this.theEntity.isInLava(); + } + + /** + * Trims path data from the end to the first sun covered block + */ + protected void removeSunnyPath() + { + } + + /** + * Returns true when an entity of specified size could safely walk in a straight line between the two points. Args: + * pos1, pos2, entityXSize, entityYSize, entityZSize + */ + protected abstract boolean isDirectPathBetweenPoints(Vec3 posVec31, Vec3 posVec32, int sizeX, int sizeY, int sizeZ); +} diff --git a/src/minecraft/net/minecraft/pathfinding/PathNavigateClimber.java b/src/minecraft/net/minecraft/pathfinding/PathNavigateClimber.java new file mode 100644 index 0000000..55adfe5 --- /dev/null +++ b/src/minecraft/net/minecraft/pathfinding/PathNavigateClimber.java @@ -0,0 +1,79 @@ +package net.minecraft.pathfinding; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class PathNavigateClimber extends PathNavigateGround +{ + /** Current path navigation target */ + private BlockPos targetPosition; + + public PathNavigateClimber(EntityLiving entityLivingIn, World worldIn) + { + super(entityLivingIn, worldIn); + } + + /** + * Returns path to given BlockPos + */ + public PathEntity getPathToPos(BlockPos pos) + { + this.targetPosition = pos; + return super.getPathToPos(pos); + } + + /** + * Returns the path to the given EntityLiving. Args : entity + */ + public PathEntity getPathToEntityLiving(Entity entityIn) + { + this.targetPosition = new BlockPos(entityIn); + return super.getPathToEntityLiving(entityIn); + } + + /** + * Try to find and set a path to EntityLiving. Returns true if successful. Args : entity, speed + */ + public boolean tryMoveToEntityLiving(Entity entityIn, double speedIn) + { + PathEntity pathentity = this.getPathToEntityLiving(entityIn); + + if (pathentity != null) + { + return this.setPath(pathentity, speedIn); + } + else + { + this.targetPosition = new BlockPos(entityIn); + this.speed = speedIn; + return true; + } + } + + public void onUpdateNavigation() + { + if (!this.noPath()) + { + super.onUpdateNavigation(); + } + else + { + if (this.targetPosition != null) + { + double d0 = (double)(this.theEntity.width * this.theEntity.width); + + if (this.theEntity.getDistanceSqToCenter(this.targetPosition) >= d0 && (this.theEntity.posY <= (double)this.targetPosition.getY() || this.theEntity.getDistanceSqToCenter(new BlockPos(this.targetPosition.getX(), MathHelper.floor_double(this.theEntity.posY), this.targetPosition.getZ())) >= d0)) + { + this.theEntity.getMoveHelper().setMoveTo((double)this.targetPosition.getX(), (double)this.targetPosition.getY(), (double)this.targetPosition.getZ(), this.speed); + } + else + { + this.targetPosition = null; + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/pathfinding/PathNavigateGround.java b/src/minecraft/net/minecraft/pathfinding/PathNavigateGround.java new file mode 100644 index 0000000..3a39747 --- /dev/null +++ b/src/minecraft/net/minecraft/pathfinding/PathNavigateGround.java @@ -0,0 +1,296 @@ +package net.minecraft.pathfinding; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.pathfinder.WalkNodeProcessor; + +public class PathNavigateGround extends PathNavigate +{ + protected WalkNodeProcessor nodeProcessor; + private boolean shouldAvoidSun; + + public PathNavigateGround(EntityLiving entitylivingIn, World worldIn) + { + super(entitylivingIn, worldIn); + } + + protected PathFinder getPathFinder() + { + this.nodeProcessor = new WalkNodeProcessor(); + this.nodeProcessor.setEnterDoors(true); + return new PathFinder(this.nodeProcessor); + } + + /** + * If on ground or swimming and can swim + */ + protected boolean canNavigate() + { + return this.theEntity.onGround || this.getCanSwim() && this.isInLiquid() || this.theEntity.isRiding() && this.theEntity instanceof EntityZombie && this.theEntity.ridingEntity instanceof EntityChicken; + } + + protected Vec3 getEntityPosition() + { + return new Vec3(this.theEntity.posX, (double)this.getPathablePosY(), this.theEntity.posZ); + } + + /** + * Gets the safe pathing Y position for the entity depending on if it can path swim or not + */ + private int getPathablePosY() + { + if (this.theEntity.isInWater() && this.getCanSwim()) + { + int i = (int)this.theEntity.getEntityBoundingBox().minY; + Block block = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.theEntity.posX), i, MathHelper.floor_double(this.theEntity.posZ))).getBlock(); + int j = 0; + + while (block == Blocks.flowing_water || block == Blocks.water) + { + ++i; + block = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.theEntity.posX), i, MathHelper.floor_double(this.theEntity.posZ))).getBlock(); + ++j; + + if (j > 16) + { + return (int)this.theEntity.getEntityBoundingBox().minY; + } + } + + return i; + } + else + { + return (int)(this.theEntity.getEntityBoundingBox().minY + 0.5D); + } + } + + /** + * Trims path data from the end to the first sun covered block + */ + protected void removeSunnyPath() + { + super.removeSunnyPath(); + + if (this.shouldAvoidSun) + { + if (this.worldObj.canSeeSky(new BlockPos(MathHelper.floor_double(this.theEntity.posX), (int)(this.theEntity.getEntityBoundingBox().minY + 0.5D), MathHelper.floor_double(this.theEntity.posZ)))) + { + return; + } + + for (int i = 0; i < this.currentPath.getCurrentPathLength(); ++i) + { + PathPoint pathpoint = this.currentPath.getPathPointFromIndex(i); + + if (this.worldObj.canSeeSky(new BlockPos(pathpoint.xCoord, pathpoint.yCoord, pathpoint.zCoord))) + { + this.currentPath.setCurrentPathLength(i - 1); + return; + } + } + } + } + + /** + * Returns true when an entity of specified size could safely walk in a straight line between the two points. Args: + * pos1, pos2, entityXSize, entityYSize, entityZSize + */ + protected boolean isDirectPathBetweenPoints(Vec3 posVec31, Vec3 posVec32, int sizeX, int sizeY, int sizeZ) + { + int i = MathHelper.floor_double(posVec31.xCoord); + int j = MathHelper.floor_double(posVec31.zCoord); + double d0 = posVec32.xCoord - posVec31.xCoord; + double d1 = posVec32.zCoord - posVec31.zCoord; + double d2 = d0 * d0 + d1 * d1; + + if (d2 < 1.0E-8D) + { + return false; + } + else + { + double d3 = 1.0D / Math.sqrt(d2); + d0 = d0 * d3; + d1 = d1 * d3; + sizeX = sizeX + 2; + sizeZ = sizeZ + 2; + + if (!this.isSafeToStandAt(i, (int)posVec31.yCoord, j, sizeX, sizeY, sizeZ, posVec31, d0, d1)) + { + return false; + } + else + { + sizeX = sizeX - 2; + sizeZ = sizeZ - 2; + double d4 = 1.0D / Math.abs(d0); + double d5 = 1.0D / Math.abs(d1); + double d6 = (double)(i * 1) - posVec31.xCoord; + double d7 = (double)(j * 1) - posVec31.zCoord; + + if (d0 >= 0.0D) + { + ++d6; + } + + if (d1 >= 0.0D) + { + ++d7; + } + + d6 = d6 / d0; + d7 = d7 / d1; + int k = d0 < 0.0D ? -1 : 1; + int l = d1 < 0.0D ? -1 : 1; + int i1 = MathHelper.floor_double(posVec32.xCoord); + int j1 = MathHelper.floor_double(posVec32.zCoord); + int k1 = i1 - i; + int l1 = j1 - j; + + while (k1 * k > 0 || l1 * l > 0) + { + if (d6 < d7) + { + d6 += d4; + i += k; + k1 = i1 - i; + } + else + { + d7 += d5; + j += l; + l1 = j1 - j; + } + + if (!this.isSafeToStandAt(i, (int)posVec31.yCoord, j, sizeX, sizeY, sizeZ, posVec31, d0, d1)) + { + return false; + } + } + + return true; + } + } + } + + /** + * Returns true when an entity could stand at a position, including solid blocks under the entire entity. + */ + private boolean isSafeToStandAt(int x, int y, int z, int sizeX, int sizeY, int sizeZ, Vec3 vec31, double p_179683_8_, double p_179683_10_) + { + int i = x - sizeX / 2; + int j = z - sizeZ / 2; + + if (!this.isPositionClear(i, y, j, sizeX, sizeY, sizeZ, vec31, p_179683_8_, p_179683_10_)) + { + return false; + } + else + { + for (int k = i; k < i + sizeX; ++k) + { + for (int l = j; l < j + sizeZ; ++l) + { + double d0 = (double)k + 0.5D - vec31.xCoord; + double d1 = (double)l + 0.5D - vec31.zCoord; + + if (d0 * p_179683_8_ + d1 * p_179683_10_ >= 0.0D) + { + Block block = this.worldObj.getBlockState(new BlockPos(k, y - 1, l)).getBlock(); + Material material = block.getMaterial(); + + if (material == Material.air) + { + return false; + } + + if (material == Material.water && !this.theEntity.isInWater()) + { + return false; + } + + if (material == Material.lava) + { + return false; + } + } + } + } + + return true; + } + } + + /** + * Returns true if an entity does not collide with any solid blocks at the position. + */ + private boolean isPositionClear(int p_179692_1_, int p_179692_2_, int p_179692_3_, int p_179692_4_, int p_179692_5_, int p_179692_6_, Vec3 p_179692_7_, double p_179692_8_, double p_179692_10_) + { + for (BlockPos blockpos : BlockPos.getAllInBox(new BlockPos(p_179692_1_, p_179692_2_, p_179692_3_), new BlockPos(p_179692_1_ + p_179692_4_ - 1, p_179692_2_ + p_179692_5_ - 1, p_179692_3_ + p_179692_6_ - 1))) + { + double d0 = (double)blockpos.getX() + 0.5D - p_179692_7_.xCoord; + double d1 = (double)blockpos.getZ() + 0.5D - p_179692_7_.zCoord; + + if (d0 * p_179692_8_ + d1 * p_179692_10_ >= 0.0D) + { + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + + if (!block.isPassable(this.worldObj, blockpos)) + { + return false; + } + } + } + + return true; + } + + public void setAvoidsWater(boolean avoidsWater) + { + this.nodeProcessor.setAvoidsWater(avoidsWater); + } + + public boolean getAvoidsWater() + { + return this.nodeProcessor.getAvoidsWater(); + } + + public void setBreakDoors(boolean canBreakDoors) + { + this.nodeProcessor.setBreakDoors(canBreakDoors); + } + + public void setEnterDoors(boolean par1) + { + this.nodeProcessor.setEnterDoors(par1); + } + + public boolean getEnterDoors() + { + return this.nodeProcessor.getEnterDoors(); + } + + public void setCanSwim(boolean canSwim) + { + this.nodeProcessor.setCanSwim(canSwim); + } + + public boolean getCanSwim() + { + return this.nodeProcessor.getCanSwim(); + } + + public void setAvoidSun(boolean par1) + { + this.shouldAvoidSun = par1; + } +} diff --git a/src/minecraft/net/minecraft/pathfinding/PathNavigateSwimmer.java b/src/minecraft/net/minecraft/pathfinding/PathNavigateSwimmer.java new file mode 100644 index 0000000..24ecdd2 --- /dev/null +++ b/src/minecraft/net/minecraft/pathfinding/PathNavigateSwimmer.java @@ -0,0 +1,76 @@ +package net.minecraft.pathfinding; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraft.world.pathfinder.SwimNodeProcessor; + +public class PathNavigateSwimmer extends PathNavigate +{ + public PathNavigateSwimmer(EntityLiving entitylivingIn, World worldIn) + { + super(entitylivingIn, worldIn); + } + + protected PathFinder getPathFinder() + { + return new PathFinder(new SwimNodeProcessor()); + } + + /** + * If on ground or swimming and can swim + */ + protected boolean canNavigate() + { + return this.isInLiquid(); + } + + protected Vec3 getEntityPosition() + { + return new Vec3(this.theEntity.posX, this.theEntity.posY + (double)this.theEntity.height * 0.5D, this.theEntity.posZ); + } + + protected void pathFollow() + { + Vec3 vec3 = this.getEntityPosition(); + float f = this.theEntity.width * this.theEntity.width; + int i = 6; + + if (vec3.squareDistanceTo(this.currentPath.getVectorFromIndex(this.theEntity, this.currentPath.getCurrentPathIndex())) < (double)f) + { + this.currentPath.incrementPathIndex(); + } + + for (int j = Math.min(this.currentPath.getCurrentPathIndex() + i, this.currentPath.getCurrentPathLength() - 1); j > this.currentPath.getCurrentPathIndex(); --j) + { + Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, j); + + if (vec31.squareDistanceTo(vec3) <= 36.0D && this.isDirectPathBetweenPoints(vec3, vec31, 0, 0, 0)) + { + this.currentPath.setCurrentPathIndex(j); + break; + } + } + + this.checkForStuck(vec3); + } + + /** + * Trims path data from the end to the first sun covered block + */ + protected void removeSunnyPath() + { + super.removeSunnyPath(); + } + + /** + * Returns true when an entity of specified size could safely walk in a straight line between the two points. Args: + * pos1, pos2, entityXSize, entityYSize, entityZSize + */ + protected boolean isDirectPathBetweenPoints(Vec3 posVec31, Vec3 posVec32, int sizeX, int sizeY, int sizeZ) + { + MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(posVec31, new Vec3(posVec32.xCoord, posVec32.yCoord + (double)this.theEntity.height * 0.5D, posVec32.zCoord), false, true, false); + return movingobjectposition == null || movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.MISS; + } +} diff --git a/src/minecraft/net/minecraft/pathfinding/PathPoint.java b/src/minecraft/net/minecraft/pathfinding/PathPoint.java new file mode 100644 index 0000000..8416c0b --- /dev/null +++ b/src/minecraft/net/minecraft/pathfinding/PathPoint.java @@ -0,0 +1,102 @@ +package net.minecraft.pathfinding; + +import net.minecraft.util.MathHelper; + +public class PathPoint +{ + /** The x coordinate of this point */ + public final int xCoord; + + /** The y coordinate of this point */ + public final int yCoord; + + /** The z coordinate of this point */ + public final int zCoord; + + /** A hash of the coordinates used to identify this point */ + private final int hash; + + /** The index of this point in its assigned path */ + int index = -1; + + /** The distance along the path to this point */ + float totalPathDistance; + + /** The linear distance to the next point */ + float distanceToNext; + + /** The distance to the target */ + float distanceToTarget; + + /** The point preceding this in its assigned path */ + PathPoint previous; + + /** True if the pathfinder has already visited this point */ + public boolean visited; + + public PathPoint(int x, int y, int z) + { + this.xCoord = x; + this.yCoord = y; + this.zCoord = z; + this.hash = makeHash(x, y, z); + } + + public static int makeHash(int x, int y, int z) + { + return y & 255 | (x & 32767) << 8 | (z & 32767) << 24 | (x < 0 ? Integer.MIN_VALUE : 0) | (z < 0 ? 32768 : 0); + } + + /** + * Returns the linear distance to another path point + */ + public float distanceTo(PathPoint pathpointIn) + { + float f = (float)(pathpointIn.xCoord - this.xCoord); + float f1 = (float)(pathpointIn.yCoord - this.yCoord); + float f2 = (float)(pathpointIn.zCoord - this.zCoord); + return MathHelper.sqrt_float(f * f + f1 * f1 + f2 * f2); + } + + /** + * Returns the squared distance to another path point + */ + public float distanceToSquared(PathPoint pathpointIn) + { + float f = (float)(pathpointIn.xCoord - this.xCoord); + float f1 = (float)(pathpointIn.yCoord - this.yCoord); + float f2 = (float)(pathpointIn.zCoord - this.zCoord); + return f * f + f1 * f1 + f2 * f2; + } + + public boolean equals(Object p_equals_1_) + { + if (!(p_equals_1_ instanceof PathPoint)) + { + return false; + } + else + { + PathPoint pathpoint = (PathPoint)p_equals_1_; + return this.hash == pathpoint.hash && this.xCoord == pathpoint.xCoord && this.yCoord == pathpoint.yCoord && this.zCoord == pathpoint.zCoord; + } + } + + public int hashCode() + { + return this.hash; + } + + /** + * Returns true if this point has already been assigned to a path + */ + public boolean isAssigned() + { + return this.index >= 0; + } + + public String toString() + { + return this.xCoord + ", " + this.yCoord + ", " + this.zCoord; + } +} diff --git a/src/minecraft/net/minecraft/potion/Potion.java b/src/minecraft/net/minecraft/potion/Potion.java new file mode 100644 index 0000000..4a59b5d --- /dev/null +++ b/src/minecraft/net/minecraft/potion/Potion.java @@ -0,0 +1,378 @@ +package net.minecraft.potion; + +import com.google.common.collect.Maps; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.Map.Entry; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.BaseAttributeMap; +import net.minecraft.entity.ai.attributes.IAttribute; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.DamageSource; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StringUtils; + +public class Potion +{ + /** The array of potion types. */ + public static final Potion[] potionTypes = new Potion[32]; + private static final Map field_180150_I = Maps.newHashMap(); + public static final Potion field_180151_b = null; + public static final Potion moveSpeed = (new Potion(1, new ResourceLocation("speed"), false, 8171462)).setPotionName("potion.moveSpeed").setIconIndex(0, 0).registerPotionAttributeModifier(SharedMonsterAttributes.movementSpeed, "91AEAA56-376B-4498-935B-2F7F68070635", 0.20000000298023224D, 2); + public static final Potion moveSlowdown = (new Potion(2, new ResourceLocation("slowness"), true, 5926017)).setPotionName("potion.moveSlowdown").setIconIndex(1, 0).registerPotionAttributeModifier(SharedMonsterAttributes.movementSpeed, "7107DE5E-7CE8-4030-940E-514C1F160890", -0.15000000596046448D, 2); + public static final Potion digSpeed = (new Potion(3, new ResourceLocation("haste"), false, 14270531)).setPotionName("potion.digSpeed").setIconIndex(2, 0).setEffectiveness(1.5D); + public static final Potion digSlowdown = (new Potion(4, new ResourceLocation("mining_fatigue"), true, 4866583)).setPotionName("potion.digSlowDown").setIconIndex(3, 0); + public static final Potion damageBoost = (new PotionAttackDamage(5, new ResourceLocation("strength"), false, 9643043)).setPotionName("potion.damageBoost").setIconIndex(4, 0).registerPotionAttributeModifier(SharedMonsterAttributes.attackDamage, "648D7064-6A60-4F59-8ABE-C2C23A6DD7A9", 2.5D, 2); + public static final Potion heal = (new PotionHealth(6, new ResourceLocation("instant_health"), false, 16262179)).setPotionName("potion.heal"); + public static final Potion harm = (new PotionHealth(7, new ResourceLocation("instant_damage"), true, 4393481)).setPotionName("potion.harm"); + public static final Potion jump = (new Potion(8, new ResourceLocation("jump_boost"), false, 2293580)).setPotionName("potion.jump").setIconIndex(2, 1); + public static final Potion confusion = (new Potion(9, new ResourceLocation("nausea"), true, 5578058)).setPotionName("potion.confusion").setIconIndex(3, 1).setEffectiveness(0.25D); + + /** The regeneration Potion object. */ + public static final Potion regeneration = (new Potion(10, new ResourceLocation("regeneration"), false, 13458603)).setPotionName("potion.regeneration").setIconIndex(7, 0).setEffectiveness(0.25D); + public static final Potion resistance = (new Potion(11, new ResourceLocation("resistance"), false, 10044730)).setPotionName("potion.resistance").setIconIndex(6, 1); + + /** The fire resistance Potion object. */ + public static final Potion fireResistance = (new Potion(12, new ResourceLocation("fire_resistance"), false, 14981690)).setPotionName("potion.fireResistance").setIconIndex(7, 1); + + /** The water breathing Potion object. */ + public static final Potion waterBreathing = (new Potion(13, new ResourceLocation("water_breathing"), false, 3035801)).setPotionName("potion.waterBreathing").setIconIndex(0, 2); + + /** The invisibility Potion object. */ + public static final Potion invisibility = (new Potion(14, new ResourceLocation("invisibility"), false, 8356754)).setPotionName("potion.invisibility").setIconIndex(0, 1); + + /** The blindness Potion object. */ + public static final Potion blindness = (new Potion(15, new ResourceLocation("blindness"), true, 2039587)).setPotionName("potion.blindness").setIconIndex(5, 1).setEffectiveness(0.25D); + + /** The night vision Potion object. */ + public static final Potion nightVision = (new Potion(16, new ResourceLocation("night_vision"), false, 2039713)).setPotionName("potion.nightVision").setIconIndex(4, 1); + + /** The hunger Potion object. */ + public static final Potion hunger = (new Potion(17, new ResourceLocation("hunger"), true, 5797459)).setPotionName("potion.hunger").setIconIndex(1, 1); + + /** The weakness Potion object. */ + public static final Potion weakness = (new PotionAttackDamage(18, new ResourceLocation("weakness"), true, 4738376)).setPotionName("potion.weakness").setIconIndex(5, 0).registerPotionAttributeModifier(SharedMonsterAttributes.attackDamage, "22653B89-116E-49DC-9B6B-9971489B5BE5", 2.0D, 0); + + /** The poison Potion object. */ + public static final Potion poison = (new Potion(19, new ResourceLocation("poison"), true, 5149489)).setPotionName("potion.poison").setIconIndex(6, 0).setEffectiveness(0.25D); + + /** The wither Potion object. */ + public static final Potion wither = (new Potion(20, new ResourceLocation("wither"), true, 3484199)).setPotionName("potion.wither").setIconIndex(1, 2).setEffectiveness(0.25D); + + /** The health boost Potion object. */ + public static final Potion healthBoost = (new PotionHealthBoost(21, new ResourceLocation("health_boost"), false, 16284963)).setPotionName("potion.healthBoost").setIconIndex(2, 2).registerPotionAttributeModifier(SharedMonsterAttributes.maxHealth, "5D6F0BA2-1186-46AC-B896-C61C5CEE99CC", 4.0D, 0); + + /** The absorption Potion object. */ + public static final Potion absorption = (new PotionAbsorption(22, new ResourceLocation("absorption"), false, 2445989)).setPotionName("potion.absorption").setIconIndex(2, 2); + + /** The saturation Potion object. */ + public static final Potion saturation = (new PotionHealth(23, new ResourceLocation("saturation"), false, 16262179)).setPotionName("potion.saturation"); + public static final Potion field_180153_z = null; + public static final Potion field_180147_A = null; + public static final Potion field_180148_B = null; + public static final Potion field_180149_C = null; + public static final Potion field_180143_D = null; + public static final Potion field_180144_E = null; + public static final Potion field_180145_F = null; + public static final Potion field_180146_G = null; + + /** The Id of a Potion object. */ + public final int id; + private final Map attributeModifierMap = Maps.newHashMap(); + + /** + * This field indicated if the effect is 'bad' - negative - for the entity. + */ + private final boolean isBadEffect; + + /** Is the color of the liquid for this potion. */ + private final int liquidColor; + + /** The name of the Potion. */ + private String name = ""; + + /** The index for the icon displayed when the potion effect is active. */ + private int statusIconIndex = -1; + private double effectiveness; + private boolean usable; + + protected Potion(int potionID, ResourceLocation location, boolean badEffect, int potionColor) + { + this.id = potionID; + potionTypes[potionID] = this; + field_180150_I.put(location, this); + this.isBadEffect = badEffect; + + if (badEffect) + { + this.effectiveness = 0.5D; + } + else + { + this.effectiveness = 1.0D; + } + + this.liquidColor = potionColor; + } + + public static Potion getPotionFromResourceLocation(String location) + { + return (Potion)field_180150_I.get(new ResourceLocation(location)); + } + + public static Set func_181168_c() + { + return field_180150_I.keySet(); + } + + /** + * Sets the index for the icon displayed in the player's inventory when the status is active. + */ + protected Potion setIconIndex(int p_76399_1_, int p_76399_2_) + { + this.statusIconIndex = p_76399_1_ + p_76399_2_ * 8; + return this; + } + + /** + * returns the ID of the potion + */ + public int getId() + { + return this.id; + } + + public void performEffect(EntityLivingBase entityLivingBaseIn, int p_76394_2_) + { + if (this.id == regeneration.id) + { + if (entityLivingBaseIn.getHealth() < entityLivingBaseIn.getMaxHealth()) + { + entityLivingBaseIn.heal(1.0F); + } + } + else if (this.id == poison.id) + { + if (entityLivingBaseIn.getHealth() > 1.0F) + { + entityLivingBaseIn.attackEntityFrom(DamageSource.magic, 1.0F); + } + } + else if (this.id == wither.id) + { + entityLivingBaseIn.attackEntityFrom(DamageSource.wither, 1.0F); + } + else if (this.id == hunger.id && entityLivingBaseIn instanceof EntityPlayer) + { + ((EntityPlayer)entityLivingBaseIn).addExhaustion(0.025F * (float)(p_76394_2_ + 1)); + } + else if (this.id == saturation.id && entityLivingBaseIn instanceof EntityPlayer) + { + if (!entityLivingBaseIn.worldObj.isRemote) + { + ((EntityPlayer)entityLivingBaseIn).getFoodStats().addStats(p_76394_2_ + 1, 1.0F); + } + } + else if ((this.id != heal.id || entityLivingBaseIn.isEntityUndead()) && (this.id != harm.id || !entityLivingBaseIn.isEntityUndead())) + { + if (this.id == harm.id && !entityLivingBaseIn.isEntityUndead() || this.id == heal.id && entityLivingBaseIn.isEntityUndead()) + { + entityLivingBaseIn.attackEntityFrom(DamageSource.magic, (float)(6 << p_76394_2_)); + } + } + else + { + entityLivingBaseIn.heal((float)Math.max(4 << p_76394_2_, 0)); + } + } + + public void affectEntity(Entity p_180793_1_, Entity p_180793_2_, EntityLivingBase entityLivingBaseIn, int p_180793_4_, double p_180793_5_) + { + if ((this.id != heal.id || entityLivingBaseIn.isEntityUndead()) && (this.id != harm.id || !entityLivingBaseIn.isEntityUndead())) + { + if (this.id == harm.id && !entityLivingBaseIn.isEntityUndead() || this.id == heal.id && entityLivingBaseIn.isEntityUndead()) + { + int j = (int)(p_180793_5_ * (double)(6 << p_180793_4_) + 0.5D); + + if (p_180793_1_ == null) + { + entityLivingBaseIn.attackEntityFrom(DamageSource.magic, (float)j); + } + else + { + entityLivingBaseIn.attackEntityFrom(DamageSource.causeIndirectMagicDamage(p_180793_1_, p_180793_2_), (float)j); + } + } + } + else + { + int i = (int)(p_180793_5_ * (double)(4 << p_180793_4_) + 0.5D); + entityLivingBaseIn.heal((float)i); + } + } + + /** + * Returns true if the potion has an instant effect instead of a continuous one (eg Harming) + */ + public boolean isInstant() + { + return false; + } + + /** + * checks if Potion effect is ready to be applied this tick. + */ + public boolean isReady(int p_76397_1_, int p_76397_2_) + { + if (this.id == regeneration.id) + { + int k = 50 >> p_76397_2_; + return k > 0 ? p_76397_1_ % k == 0 : true; + } + else if (this.id == poison.id) + { + int j = 25 >> p_76397_2_; + return j > 0 ? p_76397_1_ % j == 0 : true; + } + else if (this.id == wither.id) + { + int i = 40 >> p_76397_2_; + return i > 0 ? p_76397_1_ % i == 0 : true; + } + else + { + return this.id == hunger.id; + } + } + + /** + * Set the potion name. + */ + public Potion setPotionName(String nameIn) + { + this.name = nameIn; + return this; + } + + /** + * returns the name of the potion + */ + public String getName() + { + return this.name; + } + + /** + * Returns true if the potion has a associated status icon to display in then inventory when active. + */ + public boolean hasStatusIcon() + { + return this.statusIconIndex >= 0; + } + + /** + * Returns the index for the icon to display when the potion is active. + */ + public int getStatusIconIndex() + { + return this.statusIconIndex; + } + + /** + * This method returns true if the potion effect is bad - negative - for the entity. + */ + public boolean isBadEffect() + { + return this.isBadEffect; + } + + public static String getDurationString(PotionEffect effect) + { + if (effect.getIsPotionDurationMax()) + { + return "**:**"; + } + else + { + int i = effect.getDuration(); + return StringUtils.ticksToElapsedTime(i); + } + } + + protected Potion setEffectiveness(double effectivenessIn) + { + this.effectiveness = effectivenessIn; + return this; + } + + public double getEffectiveness() + { + return this.effectiveness; + } + + public boolean isUsable() + { + return this.usable; + } + + /** + * Returns the color of the potion liquid. + */ + public int getLiquidColor() + { + return this.liquidColor; + } + + /** + * Used by potions to register the attribute they modify. + */ + public Potion registerPotionAttributeModifier(IAttribute p_111184_1_, String p_111184_2_, double p_111184_3_, int p_111184_5_) + { + AttributeModifier attributemodifier = new AttributeModifier(UUID.fromString(p_111184_2_), this.getName(), p_111184_3_, p_111184_5_); + this.attributeModifierMap.put(p_111184_1_, attributemodifier); + return this; + } + + public Map getAttributeModifierMap() + { + return this.attributeModifierMap; + } + + public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier) + { + for (Entry entry : this.attributeModifierMap.entrySet()) + { + IAttributeInstance iattributeinstance = p_111187_2_.getAttributeInstance((IAttribute)entry.getKey()); + + if (iattributeinstance != null) + { + iattributeinstance.removeModifier((AttributeModifier)entry.getValue()); + } + } + } + + public void applyAttributesModifiersToEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111185_2_, int amplifier) + { + for (Entry entry : this.attributeModifierMap.entrySet()) + { + IAttributeInstance iattributeinstance = p_111185_2_.getAttributeInstance((IAttribute)entry.getKey()); + + if (iattributeinstance != null) + { + AttributeModifier attributemodifier = (AttributeModifier)entry.getValue(); + iattributeinstance.removeModifier(attributemodifier); + iattributeinstance.applyModifier(new AttributeModifier(attributemodifier.getID(), this.getName() + " " + amplifier, this.getAttributeModifierAmount(amplifier, attributemodifier), attributemodifier.getOperation())); + } + } + } + + public double getAttributeModifierAmount(int p_111183_1_, AttributeModifier modifier) + { + return modifier.getAmount() * (double)(p_111183_1_ + 1); + } +} diff --git a/src/minecraft/net/minecraft/potion/PotionAbsorption.java b/src/minecraft/net/minecraft/potion/PotionAbsorption.java new file mode 100644 index 0000000..56a1ca5 --- /dev/null +++ b/src/minecraft/net/minecraft/potion/PotionAbsorption.java @@ -0,0 +1,25 @@ +package net.minecraft.potion; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.attributes.BaseAttributeMap; +import net.minecraft.util.ResourceLocation; + +public class PotionAbsorption extends Potion +{ + protected PotionAbsorption(int potionID, ResourceLocation location, boolean badEffect, int potionColor) + { + super(potionID, location, badEffect, potionColor); + } + + public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier) + { + entityLivingBaseIn.setAbsorptionAmount(entityLivingBaseIn.getAbsorptionAmount() - (float)(4 * (amplifier + 1))); + super.removeAttributesModifiersFromEntity(entityLivingBaseIn, p_111187_2_, amplifier); + } + + public void applyAttributesModifiersToEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111185_2_, int amplifier) + { + entityLivingBaseIn.setAbsorptionAmount(entityLivingBaseIn.getAbsorptionAmount() + (float)(4 * (amplifier + 1))); + super.applyAttributesModifiersToEntity(entityLivingBaseIn, p_111185_2_, amplifier); + } +} diff --git a/src/minecraft/net/minecraft/potion/PotionAttackDamage.java b/src/minecraft/net/minecraft/potion/PotionAttackDamage.java new file mode 100644 index 0000000..ac13196 --- /dev/null +++ b/src/minecraft/net/minecraft/potion/PotionAttackDamage.java @@ -0,0 +1,17 @@ +package net.minecraft.potion; + +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.util.ResourceLocation; + +public class PotionAttackDamage extends Potion +{ + protected PotionAttackDamage(int potionID, ResourceLocation location, boolean badEffect, int potionColor) + { + super(potionID, location, badEffect, potionColor); + } + + public double getAttributeModifierAmount(int p_111183_1_, AttributeModifier modifier) + { + return this.id == Potion.weakness.id ? (double)(-0.5F * (float)(p_111183_1_ + 1)) : 1.3D * (double)(p_111183_1_ + 1); + } +} diff --git a/src/minecraft/net/minecraft/potion/PotionEffect.java b/src/minecraft/net/minecraft/potion/PotionEffect.java new file mode 100644 index 0000000..f44acea --- /dev/null +++ b/src/minecraft/net/minecraft/potion/PotionEffect.java @@ -0,0 +1,255 @@ +package net.minecraft.potion; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class PotionEffect +{ + private static final Logger LOGGER = LogManager.getLogger(); + + /** ID value of the potion this effect matches. */ + private int potionID; + + /** The duration of the potion effect */ + private int duration; + + /** The amplifier of the potion effect */ + private int amplifier; + + /** Whether the potion is a splash potion */ + private boolean isSplashPotion; + + /** Whether the potion effect came from a beacon */ + private boolean isAmbient; + + /** True if potion effect duration is at maximum, false otherwise. */ + private boolean isPotionDurationMax; + private boolean showParticles; + + public PotionEffect(int id, int effectDuration) + { + this(id, effectDuration, 0); + } + + public PotionEffect(int id, int effectDuration, int effectAmplifier) + { + this(id, effectDuration, effectAmplifier, false, true); + } + + public PotionEffect(int id, int effectDuration, int effectAmplifier, boolean ambient, boolean showParticles) + { + this.potionID = id; + this.duration = effectDuration; + this.amplifier = effectAmplifier; + this.isAmbient = ambient; + this.showParticles = showParticles; + } + + public PotionEffect(PotionEffect other) + { + this.potionID = other.potionID; + this.duration = other.duration; + this.amplifier = other.amplifier; + this.isAmbient = other.isAmbient; + this.showParticles = other.showParticles; + } + + /** + * merges the input PotionEffect into this one if this.amplifier <= tomerge.amplifier. The duration in the supplied + * potion effect is assumed to be greater. + */ + public void combine(PotionEffect other) + { + if (this.potionID != other.potionID) + { + LOGGER.warn("This method should only be called for matching effects!"); + } + + if (other.amplifier > this.amplifier) + { + this.amplifier = other.amplifier; + this.duration = other.duration; + } + else if (other.amplifier == this.amplifier && this.duration < other.duration) + { + this.duration = other.duration; + } + else if (!other.isAmbient && this.isAmbient) + { + this.isAmbient = other.isAmbient; + } + + this.showParticles = other.showParticles; + } + + /** + * Retrieve the ID of the potion this effect matches. + */ + public int getPotionID() + { + return this.potionID; + } + + public int getDuration() + { + return this.duration; + } + + public int getAmplifier() + { + return this.amplifier; + } + + /** + * Set whether this potion is a splash potion. + */ + public void setSplashPotion(boolean splashPotion) + { + this.isSplashPotion = splashPotion; + } + + /** + * Gets whether this potion effect originated from a beacon + */ + public boolean getIsAmbient() + { + return this.isAmbient; + } + + public boolean getIsShowParticles() + { + return this.showParticles; + } + + public boolean onUpdate(EntityLivingBase entityIn) + { + if (this.duration > 0) + { + if (Potion.potionTypes[this.potionID].isReady(this.duration, this.amplifier)) + { + this.performEffect(entityIn); + } + + this.deincrementDuration(); + } + + return this.duration > 0; + } + + private int deincrementDuration() + { + return --this.duration; + } + + public void performEffect(EntityLivingBase entityIn) + { + if (this.duration > 0) + { + Potion.potionTypes[this.potionID].performEffect(entityIn, this.amplifier); + } + } + + public String getEffectName() + { + return Potion.potionTypes[this.potionID].getName(); + } + + public int hashCode() + { + return this.potionID; + } + + public String toString() + { + String s = ""; + + if (this.getAmplifier() > 0) + { + s = this.getEffectName() + " x " + (this.getAmplifier() + 1) + ", Duration: " + this.getDuration(); + } + else + { + s = this.getEffectName() + ", Duration: " + this.getDuration(); + } + + if (this.isSplashPotion) + { + s = s + ", Splash: true"; + } + + if (!this.showParticles) + { + s = s + ", Particles: false"; + } + + return Potion.potionTypes[this.potionID].isUsable() ? "(" + s + ")" : s; + } + + public boolean equals(Object p_equals_1_) + { + if (!(p_equals_1_ instanceof PotionEffect)) + { + return false; + } + else + { + PotionEffect potioneffect = (PotionEffect)p_equals_1_; + return this.potionID == potioneffect.potionID && this.amplifier == potioneffect.amplifier && this.duration == potioneffect.duration && this.isSplashPotion == potioneffect.isSplashPotion && this.isAmbient == potioneffect.isAmbient; + } + } + + /** + * Write a custom potion effect to a potion item's NBT data. + */ + public NBTTagCompound writeCustomPotionEffectToNBT(NBTTagCompound nbt) + { + nbt.setByte("Id", (byte)this.getPotionID()); + nbt.setByte("Amplifier", (byte)this.getAmplifier()); + nbt.setInteger("Duration", this.getDuration()); + nbt.setBoolean("Ambient", this.getIsAmbient()); + nbt.setBoolean("ShowParticles", this.getIsShowParticles()); + return nbt; + } + + /** + * Read a custom potion effect from a potion item's NBT data. + */ + public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound nbt) + { + int i = nbt.getByte("Id"); + + if (i >= 0 && i < Potion.potionTypes.length && Potion.potionTypes[i] != null) + { + int j = nbt.getByte("Amplifier"); + int k = nbt.getInteger("Duration"); + boolean flag = nbt.getBoolean("Ambient"); + boolean flag1 = true; + + if (nbt.hasKey("ShowParticles", 1)) + { + flag1 = nbt.getBoolean("ShowParticles"); + } + + return new PotionEffect(i, k, j, flag, flag1); + } + else + { + return null; + } + } + + /** + * Toggle the isPotionDurationMax field. + */ + public void setPotionDurationMax(boolean maxDuration) + { + this.isPotionDurationMax = maxDuration; + } + + public boolean getIsPotionDurationMax() + { + return this.isPotionDurationMax; + } +} diff --git a/src/minecraft/net/minecraft/potion/PotionHealth.java b/src/minecraft/net/minecraft/potion/PotionHealth.java new file mode 100644 index 0000000..13d065c --- /dev/null +++ b/src/minecraft/net/minecraft/potion/PotionHealth.java @@ -0,0 +1,27 @@ +package net.minecraft.potion; + +import net.minecraft.util.ResourceLocation; + +public class PotionHealth extends Potion +{ + public PotionHealth(int potionID, ResourceLocation location, boolean badEffect, int potionColor) + { + super(potionID, location, badEffect, potionColor); + } + + /** + * Returns true if the potion has an instant effect instead of a continuous one (eg Harming) + */ + public boolean isInstant() + { + return true; + } + + /** + * checks if Potion effect is ready to be applied this tick. + */ + public boolean isReady(int p_76397_1_, int p_76397_2_) + { + return p_76397_1_ >= 1; + } +} diff --git a/src/minecraft/net/minecraft/potion/PotionHealthBoost.java b/src/minecraft/net/minecraft/potion/PotionHealthBoost.java new file mode 100644 index 0000000..f0a16ba --- /dev/null +++ b/src/minecraft/net/minecraft/potion/PotionHealthBoost.java @@ -0,0 +1,23 @@ +package net.minecraft.potion; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.attributes.BaseAttributeMap; +import net.minecraft.util.ResourceLocation; + +public class PotionHealthBoost extends Potion +{ + public PotionHealthBoost(int potionID, ResourceLocation location, boolean badEffect, int potionColor) + { + super(potionID, location, badEffect, potionColor); + } + + public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, BaseAttributeMap p_111187_2_, int amplifier) + { + super.removeAttributesModifiersFromEntity(entityLivingBaseIn, p_111187_2_, amplifier); + + if (entityLivingBaseIn.getHealth() > entityLivingBaseIn.getMaxHealth()) + { + entityLivingBaseIn.setHealth(entityLivingBaseIn.getMaxHealth()); + } + } +} diff --git a/src/minecraft/net/minecraft/potion/PotionHelper.java b/src/minecraft/net/minecraft/potion/PotionHelper.java new file mode 100644 index 0000000..84caddd --- /dev/null +++ b/src/minecraft/net/minecraft/potion/PotionHelper.java @@ -0,0 +1,629 @@ +package net.minecraft.potion; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import net.minecraft.util.IntegerCache; +import optifine.Config; +import optifine.CustomColors; + +public class PotionHelper +{ + public static final String field_77924_a = null; + public static final String sugarEffect = "-0+1-2-3&4-4+13"; + public static final String ghastTearEffect = "+0-1-2-3&4-4+13"; + public static final String spiderEyeEffect = "-0-1+2-3&4-4+13"; + public static final String fermentedSpiderEyeEffect = "-0+3-4+13"; + public static final String speckledMelonEffect = "+0-1+2-3&4-4+13"; + public static final String blazePowderEffect = "+0-1-2+3&4-4+13"; + public static final String magmaCreamEffect = "+0+1-2-3&4-4+13"; + public static final String redstoneEffect = "-5+6-7"; + public static final String glowstoneEffect = "+5-6-7"; + public static final String gunpowderEffect = "+14&13-13"; + public static final String goldenCarrotEffect = "-0+1+2-3+13&4-4"; + public static final String pufferfishEffect = "+0-1+2+3+13&4-4"; + public static final String rabbitFootEffect = "+0+1-2+3&4-4+13"; + private static final Map potionRequirements = Maps.newHashMap(); + private static final Map potionAmplifiers = Maps.newHashMap(); + private static final Map DATAVALUE_COLORS = Maps.newHashMap(); + + /** An array of possible potion prefix names, as translation IDs. */ + private static final String[] potionPrefixes = new String[] {"potion.prefix.mundane", "potion.prefix.uninteresting", "potion.prefix.bland", "potion.prefix.clear", "potion.prefix.milky", "potion.prefix.diffuse", "potion.prefix.artless", "potion.prefix.thin", "potion.prefix.awkward", "potion.prefix.flat", "potion.prefix.bulky", "potion.prefix.bungling", "potion.prefix.buttered", "potion.prefix.smooth", "potion.prefix.suave", "potion.prefix.debonair", "potion.prefix.thick", "potion.prefix.elegant", "potion.prefix.fancy", "potion.prefix.charming", "potion.prefix.dashing", "potion.prefix.refined", "potion.prefix.cordial", "potion.prefix.sparkling", "potion.prefix.potent", "potion.prefix.foul", "potion.prefix.odorless", "potion.prefix.rank", "potion.prefix.harsh", "potion.prefix.acrid", "potion.prefix.gross", "potion.prefix.stinky"}; + private static final String __OBFID = "CL_00000078"; + + /** + * Checks if the bit at 1 << j is on in i. + */ + public static boolean checkFlag(int p_77914_0_, int p_77914_1_) + { + return (p_77914_0_ & 1 << p_77914_1_) != 0; + } + + /** + * Returns 1 if the flag is set, 0 if it is not set. + */ + private static int isFlagSet(int p_77910_0_, int p_77910_1_) + { + return checkFlag(p_77910_0_, p_77910_1_) ? 1 : 0; + } + + /** + * Returns 0 if the flag is set, 1 if it is not set. + */ + private static int isFlagUnset(int p_77916_0_, int p_77916_1_) + { + return checkFlag(p_77916_0_, p_77916_1_) ? 0 : 1; + } + + /** + * Given a potion data value, get its prefix index number. + */ + public static int getPotionPrefixIndex(int dataValue) + { + return func_77908_a(dataValue, 5, 4, 3, 2, 1); + } + + /** + * Given a {@link Collection}<{@link PotionEffect}> will return an Integer color. + */ + public static int calcPotionLiquidColor(Collection p_77911_0_) + { + int i = 3694022; + + if (p_77911_0_ != null && !p_77911_0_.isEmpty()) + { + float f = 0.0F; + float f1 = 0.0F; + float f2 = 0.0F; + float f3 = 0.0F; + + for (Object potioneffect0 : p_77911_0_) + { + PotionEffect potioneffect = (PotionEffect) potioneffect0; + + if (potioneffect.getIsShowParticles()) + { + int j = Potion.potionTypes[potioneffect.getPotionID()].getLiquidColor(); + + if (Config.isCustomColors()) + { + j = CustomColors.getPotionColor(potioneffect.getPotionID(), j); + } + + for (int k = 0; k <= potioneffect.getAmplifier(); ++k) + { + f += (float)(j >> 16 & 255) / 255.0F; + f1 += (float)(j >> 8 & 255) / 255.0F; + f2 += (float)(j >> 0 & 255) / 255.0F; + ++f3; + } + } + } + + if (f3 == 0.0F) + { + return 0; + } + else + { + f = f / f3 * 255.0F; + f1 = f1 / f3 * 255.0F; + f2 = f2 / f3 * 255.0F; + return (int)f << 16 | (int)f1 << 8 | (int)f2; + } + } + else + { + if (Config.isCustomColors()) + { + i = CustomColors.getPotionColor(0, i); + } + + return i; + } + } + + /** + * Check whether a {@link Collection}<{@link PotionEffect}> are all ambient. + */ + public static boolean getAreAmbient(Collection potionEffects) + { + for (Object potioneffect : potionEffects) + { + if (!((PotionEffect) potioneffect).getIsAmbient()) + { + return false; + } + } + + return true; + } + + /** + * Given a potion data value, get the associated liquid color (optionally bypassing the cache) + */ + public static int getLiquidColor(int dataValue, boolean bypassCache) + { + Integer integer = IntegerCache.func_181756_a(dataValue); + + if (!bypassCache) + { + if (DATAVALUE_COLORS.containsKey(integer)) + { + return ((Integer)DATAVALUE_COLORS.get(integer)).intValue(); + } + else + { + int i = calcPotionLiquidColor(getPotionEffects(integer.intValue(), false)); + DATAVALUE_COLORS.put(integer, Integer.valueOf(i)); + return i; + } + } + else + { + return calcPotionLiquidColor(getPotionEffects(integer.intValue(), true)); + } + } + + /** + * Given a potion data value, get its prefix as a translation ID. + */ + public static String getPotionPrefix(int dataValue) + { + int i = getPotionPrefixIndex(dataValue); + return potionPrefixes[i]; + } + + private static int func_77904_a(boolean p_77904_0_, boolean p_77904_1_, boolean p_77904_2_, int p_77904_3_, int p_77904_4_, int p_77904_5_, int p_77904_6_) + { + int i = 0; + + if (p_77904_0_) + { + i = isFlagUnset(p_77904_6_, p_77904_4_); + } + else if (p_77904_3_ != -1) + { + if (p_77904_3_ == 0 && countSetFlags(p_77904_6_) == p_77904_4_) + { + i = 1; + } + else if (p_77904_3_ == 1 && countSetFlags(p_77904_6_) > p_77904_4_) + { + i = 1; + } + else if (p_77904_3_ == 2 && countSetFlags(p_77904_6_) < p_77904_4_) + { + i = 1; + } + } + else + { + i = isFlagSet(p_77904_6_, p_77904_4_); + } + + if (p_77904_1_) + { + i *= p_77904_5_; + } + + if (p_77904_2_) + { + i *= -1; + } + + return i; + } + + /** + * Returns the number of 1 bits in the given integer. + */ + private static int countSetFlags(int p_77907_0_) + { + int i; + + for (i = 0; p_77907_0_ > 0; ++i) + { + p_77907_0_ &= p_77907_0_ - 1; + } + + return i; + } + + private static int parsePotionEffects(String p_77912_0_, int p_77912_1_, int p_77912_2_, int p_77912_3_) + { + if (p_77912_1_ < p_77912_0_.length() && p_77912_2_ >= 0 && p_77912_1_ < p_77912_2_) + { + int i = p_77912_0_.indexOf(124, p_77912_1_); + + if (i >= 0 && i < p_77912_2_) + { + int l1 = parsePotionEffects(p_77912_0_, p_77912_1_, i - 1, p_77912_3_); + + if (l1 > 0) + { + return l1; + } + else + { + int i2 = parsePotionEffects(p_77912_0_, i + 1, p_77912_2_, p_77912_3_); + return i2 > 0 ? i2 : 0; + } + } + else + { + int j = p_77912_0_.indexOf(38, p_77912_1_); + + if (j >= 0 && j < p_77912_2_) + { + int k = parsePotionEffects(p_77912_0_, p_77912_1_, j - 1, p_77912_3_); + + if (k <= 0) + { + return 0; + } + else + { + int j2 = parsePotionEffects(p_77912_0_, j + 1, p_77912_2_, p_77912_3_); + return j2 <= 0 ? 0 : (k > j2 ? k : j2); + } + } + else + { + boolean flag = false; + boolean flag1 = false; + boolean flag2 = false; + boolean flag3 = false; + boolean flag4 = false; + byte b0 = -1; + int l = 0; + int i1 = 0; + int j1 = 0; + + for (int k1 = p_77912_1_; k1 < p_77912_2_; ++k1) + { + char c0 = p_77912_0_.charAt(k1); + + if (c0 >= 48 && c0 <= 57) + { + if (flag) + { + i1 = c0 - 48; + flag1 = true; + } + else + { + l = l * 10; + l = l + (c0 - 48); + flag2 = true; + } + } + else if (c0 == 42) + { + flag = true; + } + else if (c0 == 33) + { + if (flag2) + { + j1 += func_77904_a(flag3, flag1, flag4, b0, l, i1, p_77912_3_); + flag3 = false; + flag4 = false; + flag = false; + flag1 = false; + flag2 = false; + i1 = 0; + l = 0; + b0 = -1; + } + + flag3 = true; + } + else if (c0 == 45) + { + if (flag2) + { + j1 += func_77904_a(flag3, flag1, flag4, b0, l, i1, p_77912_3_); + flag3 = false; + flag4 = false; + flag = false; + flag1 = false; + flag2 = false; + i1 = 0; + l = 0; + b0 = -1; + } + + flag4 = true; + } + else if (c0 != 61 && c0 != 60 && c0 != 62) + { + if (c0 == 43 && flag2) + { + j1 += func_77904_a(flag3, flag1, flag4, b0, l, i1, p_77912_3_); + flag3 = false; + flag4 = false; + flag = false; + flag1 = false; + flag2 = false; + i1 = 0; + l = 0; + b0 = -1; + } + } + else + { + if (flag2) + { + j1 += func_77904_a(flag3, flag1, flag4, b0, l, i1, p_77912_3_); + flag3 = false; + flag4 = false; + flag = false; + flag1 = false; + flag2 = false; + i1 = 0; + l = 0; + b0 = -1; + } + + if (c0 == 61) + { + b0 = 0; + } + else if (c0 == 60) + { + b0 = 2; + } + else if (c0 == 62) + { + b0 = 1; + } + } + } + + if (flag2) + { + j1 += func_77904_a(flag3, flag1, flag4, b0, l, i1, p_77912_3_); + } + + return j1; + } + } + } + else + { + return 0; + } + } + + /** + * Returns a list of effects for the specified potion damage value. + */ + public static List getPotionEffects(int p_77917_0_, boolean p_77917_1_) + { + ArrayList arraylist = null; + + for (Potion potion : Potion.potionTypes) + { + if (potion != null && (!potion.isUsable() || p_77917_1_)) + { + String s = (String)potionRequirements.get(Integer.valueOf(potion.getId())); + + if (s != null) + { + int i = parsePotionEffects(s, 0, s.length(), p_77917_0_); + + if (i > 0) + { + int j = 0; + String s1 = (String)potionAmplifiers.get(Integer.valueOf(potion.getId())); + + if (s1 != null) + { + j = parsePotionEffects(s1, 0, s1.length(), p_77917_0_); + + if (j < 0) + { + j = 0; + } + } + + if (potion.isInstant()) + { + i = 1; + } + else + { + i = 1200 * (i * 3 + (i - 1) * 2); + i = i >> j; + i = (int)Math.round((double)i * potion.getEffectiveness()); + + if ((p_77917_0_ & 16384) != 0) + { + i = (int)Math.round((double)i * 0.75D + 0.5D); + } + } + + if (arraylist == null) + { + arraylist = Lists.newArrayList(); + } + + PotionEffect potioneffect = new PotionEffect(potion.getId(), i, j); + + if ((p_77917_0_ & 16384) != 0) + { + potioneffect.setSplashPotion(true); + } + + arraylist.add(potioneffect); + } + } + } + } + + return arraylist; + } + + /** + * Manipulates the specified bit of the potion damage value according to the rules passed from applyIngredient. + */ + private static int brewBitOperations(int p_77906_0_, int p_77906_1_, boolean p_77906_2_, boolean p_77906_3_, boolean p_77906_4_) + { + if (p_77906_4_) + { + if (!checkFlag(p_77906_0_, p_77906_1_)) + { + return 0; + } + } + else if (p_77906_2_) + { + p_77906_0_ &= ~(1 << p_77906_1_); + } + else if (p_77906_3_) + { + if ((p_77906_0_ & 1 << p_77906_1_) == 0) + { + p_77906_0_ |= 1 << p_77906_1_; + } + else + { + p_77906_0_ &= ~(1 << p_77906_1_); + } + } + else + { + p_77906_0_ |= 1 << p_77906_1_; + } + + return p_77906_0_; + } + + /** + * Returns the new potion damage value after the specified ingredient info is applied to the specified potion. + */ + public static int applyIngredient(int p_77913_0_, String p_77913_1_) + { + byte b0 = 0; + int i = p_77913_1_.length(); + boolean flag = false; + boolean flag1 = false; + boolean flag2 = false; + boolean flag3 = false; + int j = 0; + + for (int k = b0; k < i; ++k) + { + char c0 = p_77913_1_.charAt(k); + + if (c0 >= 48 && c0 <= 57) + { + j = j * 10; + j = j + (c0 - 48); + flag = true; + } + else if (c0 == 33) + { + if (flag) + { + p_77913_0_ = brewBitOperations(p_77913_0_, j, flag2, flag1, flag3); + flag3 = false; + flag1 = false; + flag2 = false; + flag = false; + j = 0; + } + + flag1 = true; + } + else if (c0 == 45) + { + if (flag) + { + p_77913_0_ = brewBitOperations(p_77913_0_, j, flag2, flag1, flag3); + flag3 = false; + flag1 = false; + flag2 = false; + flag = false; + j = 0; + } + + flag2 = true; + } + else if (c0 == 43) + { + if (flag) + { + p_77913_0_ = brewBitOperations(p_77913_0_, j, flag2, flag1, flag3); + flag3 = false; + flag1 = false; + flag2 = false; + flag = false; + j = 0; + } + } + else if (c0 == 38) + { + if (flag) + { + p_77913_0_ = brewBitOperations(p_77913_0_, j, flag2, flag1, flag3); + flag3 = false; + flag1 = false; + flag2 = false; + flag = false; + j = 0; + } + + flag3 = true; + } + } + + if (flag) + { + p_77913_0_ = brewBitOperations(p_77913_0_, j, flag2, flag1, flag3); + } + + return p_77913_0_ & 32767; + } + + public static int func_77908_a(int p_77908_0_, int p_77908_1_, int p_77908_2_, int p_77908_3_, int p_77908_4_, int p_77908_5_) + { + return (checkFlag(p_77908_0_, p_77908_1_) ? 16 : 0) | (checkFlag(p_77908_0_, p_77908_2_) ? 8 : 0) | (checkFlag(p_77908_0_, p_77908_3_) ? 4 : 0) | (checkFlag(p_77908_0_, p_77908_4_) ? 2 : 0) | (checkFlag(p_77908_0_, p_77908_5_) ? 1 : 0); + } + + public static void clearPotionColorCache() + { + DATAVALUE_COLORS.clear(); + } + + static + { + potionRequirements.put(Integer.valueOf(Potion.regeneration.getId()), "0 & !1 & !2 & !3 & 0+6"); + potionRequirements.put(Integer.valueOf(Potion.moveSpeed.getId()), "!0 & 1 & !2 & !3 & 1+6"); + potionRequirements.put(Integer.valueOf(Potion.fireResistance.getId()), "0 & 1 & !2 & !3 & 0+6"); + potionRequirements.put(Integer.valueOf(Potion.heal.getId()), "0 & !1 & 2 & !3"); + potionRequirements.put(Integer.valueOf(Potion.poison.getId()), "!0 & !1 & 2 & !3 & 2+6"); + potionRequirements.put(Integer.valueOf(Potion.weakness.getId()), "!0 & !1 & !2 & 3 & 3+6"); + potionRequirements.put(Integer.valueOf(Potion.harm.getId()), "!0 & !1 & 2 & 3"); + potionRequirements.put(Integer.valueOf(Potion.moveSlowdown.getId()), "!0 & 1 & !2 & 3 & 3+6"); + potionRequirements.put(Integer.valueOf(Potion.damageBoost.getId()), "0 & !1 & !2 & 3 & 3+6"); + potionRequirements.put(Integer.valueOf(Potion.nightVision.getId()), "!0 & 1 & 2 & !3 & 2+6"); + potionRequirements.put(Integer.valueOf(Potion.invisibility.getId()), "!0 & 1 & 2 & 3 & 2+6"); + potionRequirements.put(Integer.valueOf(Potion.waterBreathing.getId()), "0 & !1 & 2 & 3 & 2+6"); + potionRequirements.put(Integer.valueOf(Potion.jump.getId()), "0 & 1 & !2 & 3 & 3+6"); + potionAmplifiers.put(Integer.valueOf(Potion.moveSpeed.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.digSpeed.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.damageBoost.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.regeneration.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.harm.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.heal.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.resistance.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.poison.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.jump.getId()), "5"); + } +} diff --git a/src/minecraft/net/minecraft/profiler/IPlayerUsage.java b/src/minecraft/net/minecraft/profiler/IPlayerUsage.java new file mode 100644 index 0000000..9f012c5 --- /dev/null +++ b/src/minecraft/net/minecraft/profiler/IPlayerUsage.java @@ -0,0 +1,13 @@ +package net.minecraft.profiler; + +public interface IPlayerUsage +{ + void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper); + + void addServerTypeToSnooper(PlayerUsageSnooper playerSnooper); + + /** + * Returns whether snooping is enabled or not. + */ + boolean isSnooperEnabled(); +} diff --git a/src/minecraft/net/minecraft/profiler/PlayerUsageSnooper.java b/src/minecraft/net/minecraft/profiler/PlayerUsageSnooper.java new file mode 100644 index 0000000..6f53e94 --- /dev/null +++ b/src/minecraft/net/minecraft/profiler/PlayerUsageSnooper.java @@ -0,0 +1,186 @@ +package net.minecraft.profiler; + +import com.google.common.collect.Maps; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; +import java.util.UUID; +import java.util.Map.Entry; +import net.minecraft.util.HttpUtil; + +public class PlayerUsageSnooper +{ + private final Map field_152773_a = Maps.newHashMap(); + private final Map field_152774_b = Maps.newHashMap(); + private final String uniqueID = UUID.randomUUID().toString(); + + /** URL of the server to send the report to */ + private final URL serverUrl; + private final IPlayerUsage playerStatsCollector; + + /** set to fire the snooperThread every 15 mins */ + private final Timer threadTrigger = new Timer("Snooper Timer", true); + private final Object syncLock = new Object(); + private final long minecraftStartTimeMilis; + private boolean isRunning; + + /** incremented on every getSelfCounterFor */ + private int selfCounter; + + public PlayerUsageSnooper(String p_i1563_1_, IPlayerUsage playerStatCollector, long startTime) + { + try + { + this.serverUrl = new URL("http://snoop.minecraft.net/" + p_i1563_1_ + "?version=" + 2); + } + catch (MalformedURLException var6) + { + throw new IllegalArgumentException(); + } + + this.playerStatsCollector = playerStatCollector; + this.minecraftStartTimeMilis = startTime; + } + + /** + * Note issuing start multiple times is not an error. + */ + public void startSnooper() + { + if (!this.isRunning) + { + this.isRunning = true; + this.func_152766_h(); + this.threadTrigger.schedule(new TimerTask() + { + public void run() + { + if (PlayerUsageSnooper.this.playerStatsCollector.isSnooperEnabled()) + { + Map map; + + synchronized (PlayerUsageSnooper.this.syncLock) + { + map = Maps.newHashMap(PlayerUsageSnooper.this.field_152774_b); + + if (PlayerUsageSnooper.this.selfCounter == 0) + { + map.putAll(PlayerUsageSnooper.this.field_152773_a); + } + + map.put("snooper_count", Integer.valueOf(PlayerUsageSnooper.this.selfCounter++)); + map.put("snooper_token", PlayerUsageSnooper.this.uniqueID); + } + + HttpUtil.postMap(PlayerUsageSnooper.this.serverUrl, map, true); + } + } + }, 0L, 900000L); + } + } + + private void func_152766_h() + { + this.addJvmArgsToSnooper(); + this.addClientStat("snooper_token", this.uniqueID); + this.addStatToSnooper("snooper_token", this.uniqueID); + this.addStatToSnooper("os_name", System.getProperty("os.name")); + this.addStatToSnooper("os_version", System.getProperty("os.version")); + this.addStatToSnooper("os_architecture", System.getProperty("os.arch")); + this.addStatToSnooper("java_version", System.getProperty("java.version")); + this.addClientStat("version", "1.8.8"); + this.playerStatsCollector.addServerTypeToSnooper(this); + } + + private void addJvmArgsToSnooper() + { + RuntimeMXBean runtimemxbean = ManagementFactory.getRuntimeMXBean(); + List list = runtimemxbean.getInputArguments(); + int i = 0; + + for (String s : list) + { + if (s.startsWith("-X")) + { + this.addClientStat("jvm_arg[" + i++ + "]", s); + } + } + + this.addClientStat("jvm_args", Integer.valueOf(i)); + } + + public void addMemoryStatsToSnooper() + { + this.addStatToSnooper("memory_total", Long.valueOf(Runtime.getRuntime().totalMemory())); + this.addStatToSnooper("memory_max", Long.valueOf(Runtime.getRuntime().maxMemory())); + this.addStatToSnooper("memory_free", Long.valueOf(Runtime.getRuntime().freeMemory())); + this.addStatToSnooper("cpu_cores", Integer.valueOf(Runtime.getRuntime().availableProcessors())); + this.playerStatsCollector.addServerStatsToSnooper(this); + } + + public void addClientStat(String p_152768_1_, Object p_152768_2_) + { + synchronized (this.syncLock) + { + this.field_152774_b.put(p_152768_1_, p_152768_2_); + } + } + + public void addStatToSnooper(String p_152767_1_, Object p_152767_2_) + { + synchronized (this.syncLock) + { + this.field_152773_a.put(p_152767_1_, p_152767_2_); + } + } + + public Map getCurrentStats() + { + Map map = Maps.newLinkedHashMap(); + + synchronized (this.syncLock) + { + this.addMemoryStatsToSnooper(); + + for (Entry entry : this.field_152773_a.entrySet()) + { + map.put(entry.getKey(), entry.getValue().toString()); + } + + for (Entry entry1 : this.field_152774_b.entrySet()) + { + map.put(entry1.getKey(), entry1.getValue().toString()); + } + + return map; + } + } + + public boolean isSnooperRunning() + { + return this.isRunning; + } + + public void stopSnooper() + { + this.threadTrigger.cancel(); + } + + public String getUniqueID() + { + return this.uniqueID; + } + + /** + * Returns the saved value of System#currentTimeMillis when the game started + */ + public long getMinecraftStartTimeMillis() + { + return this.minecraftStartTimeMilis; + } +} diff --git a/src/minecraft/net/minecraft/profiler/Profiler.java b/src/minecraft/net/minecraft/profiler/Profiler.java new file mode 100644 index 0000000..1e84577 --- /dev/null +++ b/src/minecraft/net/minecraft/profiler/Profiler.java @@ -0,0 +1,276 @@ +package net.minecraft.profiler; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import net.minecraft.client.renderer.GlStateManager; +import optifine.Config; +import optifine.Lagometer; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class Profiler +{ + private static final Logger logger = LogManager.getLogger(); + + /** List of parent sections */ + private final List sectionList = Lists.newArrayList(); + + /** List of timestamps (System.nanoTime) */ + private final List timestampList = Lists.newArrayList(); + + /** Flag profiling enabled */ + public boolean profilingEnabled; + + /** Current profiling section */ + private String profilingSection = ""; + + /** Profiling map */ + private final Map profilingMap = Maps.newHashMap(); + private static final String __OBFID = "CL_00001497"; + public boolean profilerGlobalEnabled = true; + private boolean profilerLocalEnabled; + private static final String SCHEDULED_EXECUTABLES = "scheduledExecutables"; + private static final String TICK = "tick"; + private static final String PRE_RENDER_ERRORS = "preRenderErrors"; + private static final String RENDER = "render"; + private static final String DISPLAY = "display"; + private static final int HASH_SCHEDULED_EXECUTABLES = "scheduledExecutables".hashCode(); + private static final int HASH_TICK = "tick".hashCode(); + private static final int HASH_PRE_RENDER_ERRORS = "preRenderErrors".hashCode(); + private static final int HASH_RENDER = "render".hashCode(); + private static final int HASH_DISPLAY = "display".hashCode(); + + public Profiler() + { + this.profilerLocalEnabled = this.profilerGlobalEnabled; + } + + /** + * Clear profiling. + */ + public void clearProfiling() + { + this.profilingMap.clear(); + this.profilingSection = ""; + this.sectionList.clear(); + this.profilerLocalEnabled = this.profilerGlobalEnabled; + } + + /** + * Start section + */ + public void startSection(String name) + { + if (Lagometer.isActive()) + { + int i = name.hashCode(); + + if (i == HASH_SCHEDULED_EXECUTABLES && name.equals("scheduledExecutables")) + { + Lagometer.timerScheduledExecutables.start(); + } + else if (i == HASH_TICK && name.equals("tick") && Config.isMinecraftThread()) + { + Lagometer.timerScheduledExecutables.end(); + Lagometer.timerTick.start(); + } + else if (i == HASH_PRE_RENDER_ERRORS && name.equals("preRenderErrors")) + { + Lagometer.timerTick.end(); + } + } + + if (Config.isFastRender()) + { + int j = name.hashCode(); + + if (j == HASH_RENDER && name.equals("render")) + { + GlStateManager.clearEnabled = false; + } + else if (j == HASH_DISPLAY && name.equals("display")) + { + GlStateManager.clearEnabled = true; + } + } + + if (this.profilerLocalEnabled) + { + if (this.profilingEnabled) + { + if (this.profilingSection.length() > 0) + { + this.profilingSection = this.profilingSection + "."; + } + + this.profilingSection = this.profilingSection + name; + this.sectionList.add(this.profilingSection); + this.timestampList.add(Long.valueOf(System.nanoTime())); + } + } + } + + /** + * End section + */ + public void endSection() + { + if (this.profilerLocalEnabled) + { + if (this.profilingEnabled) + { + long i = System.nanoTime(); + long j = ((Long)this.timestampList.remove(this.timestampList.size() - 1)).longValue(); + this.sectionList.remove(this.sectionList.size() - 1); + long k = i - j; + + if (this.profilingMap.containsKey(this.profilingSection)) + { + this.profilingMap.put(this.profilingSection, Long.valueOf(((Long)this.profilingMap.get(this.profilingSection)).longValue() + k)); + } + else + { + this.profilingMap.put(this.profilingSection, Long.valueOf(k)); + } + + if (k > 100000000L) + { + logger.warn("Something\'s taking too long! \'" + this.profilingSection + "\' took aprox " + (double)k / 1000000.0D + " ms"); + } + + this.profilingSection = !this.sectionList.isEmpty() ? (String)this.sectionList.get(this.sectionList.size() - 1) : ""; + } + } + } + + /** + * Get profiling data + */ + public List getProfilingData(String p_76321_1_) + { + this.profilerLocalEnabled = this.profilerGlobalEnabled; + + if (!this.profilerLocalEnabled) + { + return new ArrayList(Arrays.asList(new Profiler.Result[] {new Profiler.Result("root", 0.0D, 0.0D)})); + } + else if (!this.profilingEnabled) + { + return null; + } + else + { + long i = this.profilingMap.containsKey("root") ? ((Long)this.profilingMap.get("root")).longValue() : 0L; + long j = this.profilingMap.containsKey(p_76321_1_) ? ((Long)this.profilingMap.get(p_76321_1_)).longValue() : -1L; + ArrayList arraylist = Lists.newArrayList(); + + if (p_76321_1_.length() > 0) + { + p_76321_1_ = p_76321_1_ + "."; + } + + long k = 0L; + + for (Object s : this.profilingMap.keySet()) + { + if (((String) s).length() > p_76321_1_.length() && ((String) s).startsWith(p_76321_1_) && ((String) s).indexOf(".", p_76321_1_.length() + 1) < 0) + { + k += ((Long)this.profilingMap.get(s)).longValue(); + } + } + + float f = (float)k; + + if (k < j) + { + k = j; + } + + if (i < k) + { + i = k; + } + + for (Object s10 : this.profilingMap.keySet()) + { + String s1 = (String)s10; + + if (s1.length() > p_76321_1_.length() && s1.startsWith(p_76321_1_) && s1.indexOf(".", p_76321_1_.length() + 1) < 0) + { + long l = ((Long)this.profilingMap.get(s1)).longValue(); + double d0 = (double)l * 100.0D / (double)k; + double d1 = (double)l * 100.0D / (double)i; + String s2 = s1.substring(p_76321_1_.length()); + arraylist.add(new Profiler.Result(s2, d0, d1)); + } + } + + for (Object s3 : this.profilingMap.keySet()) + { + this.profilingMap.put(s3, Long.valueOf(((Long)this.profilingMap.get(s3)).longValue() * 950L / 1000L)); + } + + if ((float)k > f) + { + arraylist.add(new Profiler.Result("unspecified", (double)((float)k - f) * 100.0D / (double)k, (double)((float)k - f) * 100.0D / (double)i)); + } + + Collections.sort(arraylist); + arraylist.add(0, new Profiler.Result(p_76321_1_, 100.0D, (double)k * 100.0D / (double)i)); + return arraylist; + } + } + + /** + * End current section and start a new section + */ + public void endStartSection(String name) + { + if (this.profilerLocalEnabled) + { + this.endSection(); + this.startSection(name); + } + } + + public String getNameOfLastSection() + { + return this.sectionList.size() == 0 ? "[UNKNOWN]" : (String)this.sectionList.get(this.sectionList.size() - 1); + } + + public static final class Result implements Comparable + { + public double field_76332_a; + public double field_76330_b; + public String field_76331_c; + private static final String __OBFID = "CL_00001498"; + + public Result(String p_i1554_1_, double p_i1554_2_, double p_i1554_4_) + { + this.field_76331_c = p_i1554_1_; + this.field_76332_a = p_i1554_2_; + this.field_76330_b = p_i1554_4_; + } + + public int compareTo(Profiler.Result p_compareTo_1_) + { + return p_compareTo_1_.field_76332_a < this.field_76332_a ? -1 : (p_compareTo_1_.field_76332_a > this.field_76332_a ? 1 : p_compareTo_1_.field_76331_c.compareTo(this.field_76331_c)); + } + + public int func_76329_a() + { + return (this.field_76331_c.hashCode() & 11184810) + 4473924; + } + + public int compareTo(Object p_compareTo_1_) + { + return this.compareTo((Profiler.Result)p_compareTo_1_); + } + } +} diff --git a/src/minecraft/net/minecraft/realms/DisconnectedRealmsScreen.java b/src/minecraft/net/minecraft/realms/DisconnectedRealmsScreen.java new file mode 100644 index 0000000..41acef0 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/DisconnectedRealmsScreen.java @@ -0,0 +1,63 @@ +package net.minecraft.realms; + +import java.util.List; +import net.minecraft.util.IChatComponent; + +public class DisconnectedRealmsScreen extends RealmsScreen +{ + private String title; + private IChatComponent reason; + private List lines; + private final RealmsScreen parent; + private int textHeight; + + public DisconnectedRealmsScreen(RealmsScreen p_i45742_1_, String p_i45742_2_, IChatComponent p_i45742_3_) + { + this.parent = p_i45742_1_; + this.title = getLocalizedString(p_i45742_2_); + this.reason = p_i45742_3_; + } + + public void init() + { + Realms.setConnectedToRealms(false); + this.buttonsClear(); + this.lines = this.fontSplit(this.reason.getFormattedText(), this.width() - 50); + this.textHeight = this.lines.size() * this.fontLineHeight(); + this.buttonsAdd(newButton(0, this.width() / 2 - 100, this.height() / 2 + this.textHeight / 2 + this.fontLineHeight(), getLocalizedString("gui.back"))); + } + + public void keyPressed(char p_keyPressed_1_, int p_keyPressed_2_) + { + if (p_keyPressed_2_ == 1) + { + Realms.setScreen(this.parent); + } + } + + public void buttonClicked(RealmsButton p_buttonClicked_1_) + { + if (p_buttonClicked_1_.id() == 0) + { + Realms.setScreen(this.parent); + } + } + + public void render(int p_render_1_, int p_render_2_, float p_render_3_) + { + this.renderBackground(); + this.drawCenteredString(this.title, this.width() / 2, this.height() / 2 - this.textHeight / 2 - this.fontLineHeight() * 2, 11184810); + int i = this.height() / 2 - this.textHeight / 2; + + if (this.lines != null) + { + for (String s : this.lines) + { + this.drawCenteredString(s, this.width() / 2, i, 16777215); + i += this.fontLineHeight(); + } + } + + super.render(p_render_1_, p_render_2_, p_render_3_); + } +} diff --git a/src/minecraft/net/minecraft/realms/Realms.java b/src/minecraft/net/minecraft/realms/Realms.java new file mode 100644 index 0000000..3c1eb0c --- /dev/null +++ b/src/minecraft/net/minecraft/realms/Realms.java @@ -0,0 +1,105 @@ +package net.minecraft.realms; + +import com.google.common.util.concurrent.ListenableFuture; +import com.mojang.authlib.GameProfile; +import com.mojang.util.UUIDTypeAdapter; +import java.net.Proxy; +import net.minecraft.client.Minecraft; +import net.minecraft.util.Session; +import net.minecraft.world.WorldSettings; + +public class Realms +{ + public static boolean isTouchScreen() + { + return Minecraft.getMinecraft().gameSettings.touchscreen; + } + + public static Proxy getProxy() + { + return Minecraft.getMinecraft().getProxy(); + } + + public static String sessionId() + { + Session session = Minecraft.getMinecraft().getSession(); + return session == null ? null : session.getSessionID(); + } + + public static String userName() + { + Session session = Minecraft.getMinecraft().getSession(); + return session == null ? null : session.getUsername(); + } + + public static long currentTimeMillis() + { + return Minecraft.getSystemTime(); + } + + public static String getSessionId() + { + return Minecraft.getMinecraft().getSession().getSessionID(); + } + + public static String getUUID() + { + return Minecraft.getMinecraft().getSession().getPlayerID(); + } + + public static String getName() + { + return Minecraft.getMinecraft().getSession().getUsername(); + } + + public static String uuidToName(String p_uuidToName_0_) + { + return Minecraft.getMinecraft().getSessionService().fillProfileProperties(new GameProfile(UUIDTypeAdapter.fromString(p_uuidToName_0_), (String)null), false).getName(); + } + + public static void setScreen(RealmsScreen p_setScreen_0_) + { + Minecraft.getMinecraft().displayGuiScreen(p_setScreen_0_.getProxy()); + } + + public static String getGameDirectoryPath() + { + return Minecraft.getMinecraft().mcDataDir.getAbsolutePath(); + } + + public static int survivalId() + { + return WorldSettings.GameType.SURVIVAL.getID(); + } + + public static int creativeId() + { + return WorldSettings.GameType.CREATIVE.getID(); + } + + public static int adventureId() + { + return WorldSettings.GameType.ADVENTURE.getID(); + } + + public static int spectatorId() + { + return WorldSettings.GameType.SPECTATOR.getID(); + } + + public static void setConnectedToRealms(boolean p_setConnectedToRealms_0_) + { + Minecraft.getMinecraft().func_181537_a(p_setConnectedToRealms_0_); + } + + public static ListenableFuture downloadResourcePack(String p_downloadResourcePack_0_, String p_downloadResourcePack_1_) + { + ListenableFuture listenablefuture = Minecraft.getMinecraft().getResourcePackRepository().downloadResourcePack(p_downloadResourcePack_0_, p_downloadResourcePack_1_); + return listenablefuture; + } + + public static void clearResourcePack() + { + Minecraft.getMinecraft().getResourcePackRepository().func_148529_f(); + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsAnvilLevelStorageSource.java b/src/minecraft/net/minecraft/realms/RealmsAnvilLevelStorageSource.java new file mode 100644 index 0000000..3457a55 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsAnvilLevelStorageSource.java @@ -0,0 +1,75 @@ +package net.minecraft.realms; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.client.AnvilConverterException; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.world.storage.ISaveFormat; +import net.minecraft.world.storage.SaveFormatComparator; + +public class RealmsAnvilLevelStorageSource +{ + private ISaveFormat levelStorageSource; + + public RealmsAnvilLevelStorageSource(ISaveFormat p_i1106_1_) + { + this.levelStorageSource = p_i1106_1_; + } + + public String getName() + { + return this.levelStorageSource.getName(); + } + + public boolean levelExists(String p_levelExists_1_) + { + return this.levelStorageSource.canLoadWorld(p_levelExists_1_); + } + + public boolean convertLevel(String p_convertLevel_1_, IProgressUpdate p_convertLevel_2_) + { + return this.levelStorageSource.convertMapFormat(p_convertLevel_1_, p_convertLevel_2_); + } + + public boolean requiresConversion(String p_requiresConversion_1_) + { + return this.levelStorageSource.isOldMapFormat(p_requiresConversion_1_); + } + + public boolean isNewLevelIdAcceptable(String p_isNewLevelIdAcceptable_1_) + { + return this.levelStorageSource.func_154335_d(p_isNewLevelIdAcceptable_1_); + } + + public boolean deleteLevel(String p_deleteLevel_1_) + { + return this.levelStorageSource.deleteWorldDirectory(p_deleteLevel_1_); + } + + public boolean isConvertible(String p_isConvertible_1_) + { + return this.levelStorageSource.func_154334_a(p_isConvertible_1_); + } + + public void renameLevel(String p_renameLevel_1_, String p_renameLevel_2_) + { + this.levelStorageSource.renameWorld(p_renameLevel_1_, p_renameLevel_2_); + } + + public void clearAll() + { + this.levelStorageSource.flushCache(); + } + + public List getLevelList() throws AnvilConverterException + { + List list = Lists.newArrayList(); + + for (SaveFormatComparator saveformatcomparator : this.levelStorageSource.getSaveList()) + { + list.add(new RealmsLevelSummary(saveformatcomparator)); + } + + return list; + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsBridge.java b/src/minecraft/net/minecraft/realms/RealmsBridge.java new file mode 100644 index 0000000..e7d98c3 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsBridge.java @@ -0,0 +1,36 @@ +package net.minecraft.realms; + +import java.lang.reflect.Constructor; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class RealmsBridge extends RealmsScreen +{ + private static final Logger LOGGER = LogManager.getLogger(); + private GuiScreen previousScreen; + + public void switchToRealms(GuiScreen p_switchToRealms_1_) + { + this.previousScreen = p_switchToRealms_1_; + + try + { + Class oclass = Class.forName("com.mojang.realmsclient.RealmsMainScreen"); + Constructor constructor = oclass.getDeclaredConstructor(new Class[] {RealmsScreen.class}); + constructor.setAccessible(true); + Object object = constructor.newInstance(new Object[] {this}); + Minecraft.getMinecraft().displayGuiScreen(((RealmsScreen)object).getProxy()); + } + catch (Exception exception) + { + LOGGER.error((String)"Realms module missing", (Throwable)exception); + } + } + + public void init() + { + Minecraft.getMinecraft().displayGuiScreen(this.previousScreen); + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsBufferBuilder.java b/src/minecraft/net/minecraft/realms/RealmsBufferBuilder.java new file mode 100644 index 0000000..8d02741 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsBufferBuilder.java @@ -0,0 +1,151 @@ +package net.minecraft.realms; + +import java.nio.ByteBuffer; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.VertexFormat; + +public class RealmsBufferBuilder +{ + private WorldRenderer b; + + public RealmsBufferBuilder(WorldRenderer p_i46442_1_) + { + this.b = p_i46442_1_; + } + + public RealmsBufferBuilder from(WorldRenderer p_from_1_) + { + this.b = p_from_1_; + return this; + } + + public void sortQuads(float p_sortQuads_1_, float p_sortQuads_2_, float p_sortQuads_3_) + { + this.b.func_181674_a(p_sortQuads_1_, p_sortQuads_2_, p_sortQuads_3_); + } + + public void fixupQuadColor(int p_fixupQuadColor_1_) + { + this.b.putColor4(p_fixupQuadColor_1_); + } + + public ByteBuffer getBuffer() + { + return this.b.getByteBuffer(); + } + + public void postNormal(float p_postNormal_1_, float p_postNormal_2_, float p_postNormal_3_) + { + this.b.putNormal(p_postNormal_1_, p_postNormal_2_, p_postNormal_3_); + } + + public int getDrawMode() + { + return this.b.getDrawMode(); + } + + public void offset(double p_offset_1_, double p_offset_3_, double p_offset_5_) + { + this.b.setTranslation(p_offset_1_, p_offset_3_, p_offset_5_); + } + + public void restoreState(WorldRenderer.State p_restoreState_1_) + { + this.b.setVertexState(p_restoreState_1_); + } + + public void endVertex() + { + this.b.endVertex(); + } + + public RealmsBufferBuilder normal(float p_normal_1_, float p_normal_2_, float p_normal_3_) + { + return this.from(this.b.normal(p_normal_1_, p_normal_2_, p_normal_3_)); + } + + public void end() + { + this.b.finishDrawing(); + } + + public void begin(int p_begin_1_, VertexFormat p_begin_2_) + { + this.b.begin(p_begin_1_, p_begin_2_); + } + + public RealmsBufferBuilder color(int p_color_1_, int p_color_2_, int p_color_3_, int p_color_4_) + { + return this.from(this.b.color(p_color_1_, p_color_2_, p_color_3_, p_color_4_)); + } + + public void faceTex2(int p_faceTex2_1_, int p_faceTex2_2_, int p_faceTex2_3_, int p_faceTex2_4_) + { + this.b.putBrightness4(p_faceTex2_1_, p_faceTex2_2_, p_faceTex2_3_, p_faceTex2_4_); + } + + public void postProcessFacePosition(double p_postProcessFacePosition_1_, double p_postProcessFacePosition_3_, double p_postProcessFacePosition_5_) + { + this.b.putPosition(p_postProcessFacePosition_1_, p_postProcessFacePosition_3_, p_postProcessFacePosition_5_); + } + + public void fixupVertexColor(float p_fixupVertexColor_1_, float p_fixupVertexColor_2_, float p_fixupVertexColor_3_, int p_fixupVertexColor_4_) + { + this.b.putColorRGB_F(p_fixupVertexColor_1_, p_fixupVertexColor_2_, p_fixupVertexColor_3_, p_fixupVertexColor_4_); + } + + public RealmsBufferBuilder color(float p_color_1_, float p_color_2_, float p_color_3_, float p_color_4_) + { + return this.from(this.b.color(p_color_1_, p_color_2_, p_color_3_, p_color_4_)); + } + + public RealmsVertexFormat getVertexFormat() + { + return new RealmsVertexFormat(this.b.getVertexFormat()); + } + + public void faceTint(float p_faceTint_1_, float p_faceTint_2_, float p_faceTint_3_, int p_faceTint_4_) + { + this.b.putColorMultiplier(p_faceTint_1_, p_faceTint_2_, p_faceTint_3_, p_faceTint_4_); + } + + public RealmsBufferBuilder tex2(int p_tex2_1_, int p_tex2_2_) + { + return this.from(this.b.lightmap(p_tex2_1_, p_tex2_2_)); + } + + public void putBulkData(int[] p_putBulkData_1_) + { + this.b.addVertexData(p_putBulkData_1_); + } + + public RealmsBufferBuilder tex(double p_tex_1_, double p_tex_3_) + { + return this.from(this.b.tex(p_tex_1_, p_tex_3_)); + } + + public int getVertexCount() + { + return this.b.getVertexCount(); + } + + public void clear() + { + this.b.reset(); + } + + public RealmsBufferBuilder vertex(double p_vertex_1_, double p_vertex_3_, double p_vertex_5_) + { + return this.from(this.b.pos(p_vertex_1_, p_vertex_3_, p_vertex_5_)); + } + + public void fixupQuadColor(float p_fixupQuadColor_1_, float p_fixupQuadColor_2_, float p_fixupQuadColor_3_) + { + this.b.putColorRGB_F4(p_fixupQuadColor_1_, p_fixupQuadColor_2_, p_fixupQuadColor_3_); + } + + public void noColor() + { + this.b.markDirty(); + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsButton.java b/src/minecraft/net/minecraft/realms/RealmsButton.java new file mode 100644 index 0000000..6ee0d4d --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsButton.java @@ -0,0 +1,89 @@ +package net.minecraft.realms; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiButtonRealmsProxy; +import net.minecraft.util.ResourceLocation; + +public class RealmsButton +{ + protected static final ResourceLocation WIDGETS_LOCATION = new ResourceLocation("textures/gui/widgets.png"); + private GuiButtonRealmsProxy proxy; + + public RealmsButton(int p_i1177_1_, int p_i1177_2_, int p_i1177_3_, String p_i1177_4_) + { + this.proxy = new GuiButtonRealmsProxy(this, p_i1177_1_, p_i1177_2_, p_i1177_3_, p_i1177_4_); + } + + public RealmsButton(int p_i1178_1_, int p_i1178_2_, int p_i1178_3_, int p_i1178_4_, int p_i1178_5_, String p_i1178_6_) + { + this.proxy = new GuiButtonRealmsProxy(this, p_i1178_1_, p_i1178_2_, p_i1178_3_, p_i1178_6_, p_i1178_4_, p_i1178_5_); + } + + public GuiButton getProxy() + { + return this.proxy; + } + + public int id() + { + return this.proxy.getId(); + } + + public boolean active() + { + return this.proxy.getEnabled(); + } + + public void active(boolean p_active_1_) + { + this.proxy.setEnabled(p_active_1_); + } + + public void msg(String p_msg_1_) + { + this.proxy.setText(p_msg_1_); + } + + public int getWidth() + { + return this.proxy.getButtonWidth(); + } + + public int getHeight() + { + return this.proxy.func_175232_g(); + } + + public int y() + { + return this.proxy.getPositionY(); + } + + public void render(int p_render_1_, int p_render_2_) + { + this.proxy.drawButton(Minecraft.getMinecraft(), p_render_1_, p_render_2_); + } + + public void clicked(int p_clicked_1_, int p_clicked_2_) + { + } + + public void released(int p_released_1_, int p_released_2_) + { + } + + public void blit(int p_blit_1_, int p_blit_2_, int p_blit_3_, int p_blit_4_, int p_blit_5_, int p_blit_6_) + { + this.proxy.drawTexturedModalRect(p_blit_1_, p_blit_2_, p_blit_3_, p_blit_4_, p_blit_5_, p_blit_6_); + } + + public void renderBg(int p_renderBg_1_, int p_renderBg_2_) + { + } + + public int getYImage(boolean p_getYImage_1_) + { + return this.proxy.func_154312_c(p_getYImage_1_); + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsClickableScrolledSelectionList.java b/src/minecraft/net/minecraft/realms/RealmsClickableScrolledSelectionList.java new file mode 100644 index 0000000..1776e58 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsClickableScrolledSelectionList.java @@ -0,0 +1,106 @@ +package net.minecraft.realms; + +import net.minecraft.client.gui.GuiClickableScrolledSelectionListProxy; + +public class RealmsClickableScrolledSelectionList +{ + private final GuiClickableScrolledSelectionListProxy proxy; + + public RealmsClickableScrolledSelectionList(int p_i46052_1_, int p_i46052_2_, int p_i46052_3_, int p_i46052_4_, int p_i46052_5_) + { + this.proxy = new GuiClickableScrolledSelectionListProxy(this, p_i46052_1_, p_i46052_2_, p_i46052_3_, p_i46052_4_, p_i46052_5_); + } + + public void render(int p_render_1_, int p_render_2_, float p_render_3_) + { + this.proxy.drawScreen(p_render_1_, p_render_2_, p_render_3_); + } + + public int width() + { + return this.proxy.func_178044_e(); + } + + public int ym() + { + return this.proxy.func_178042_f(); + } + + public int xm() + { + return this.proxy.func_178045_g(); + } + + protected void renderItem(int p_renderItem_1_, int p_renderItem_2_, int p_renderItem_3_, int p_renderItem_4_, Tezzelator p_renderItem_5_, int p_renderItem_6_, int p_renderItem_7_) + { + } + + public void renderItem(int p_renderItem_1_, int p_renderItem_2_, int p_renderItem_3_, int p_renderItem_4_, int p_renderItem_5_, int p_renderItem_6_) + { + this.renderItem(p_renderItem_1_, p_renderItem_2_, p_renderItem_3_, p_renderItem_4_, Tezzelator.instance, p_renderItem_5_, p_renderItem_6_); + } + + public int getItemCount() + { + return 0; + } + + public void selectItem(int p_selectItem_1_, boolean p_selectItem_2_, int p_selectItem_3_, int p_selectItem_4_) + { + } + + public boolean isSelectedItem(int p_isSelectedItem_1_) + { + return false; + } + + public void renderBackground() + { + } + + public int getMaxPosition() + { + return 0; + } + + public int getScrollbarPosition() + { + return this.proxy.func_178044_e() / 2 + 124; + } + + public void mouseEvent() + { + this.proxy.handleMouseInput(); + } + + public void customMouseEvent(int p_customMouseEvent_1_, int p_customMouseEvent_2_, int p_customMouseEvent_3_, float p_customMouseEvent_4_, int p_customMouseEvent_5_) + { + } + + public void scroll(int p_scroll_1_) + { + this.proxy.scrollBy(p_scroll_1_); + } + + public int getScroll() + { + return this.proxy.getAmountScrolled(); + } + + protected void renderList(int p_renderList_1_, int p_renderList_2_, int p_renderList_3_, int p_renderList_4_) + { + } + + public void itemClicked(int p_itemClicked_1_, int p_itemClicked_2_, int p_itemClicked_3_, int p_itemClicked_4_, int p_itemClicked_5_) + { + } + + public void renderSelected(int p_renderSelected_1_, int p_renderSelected_2_, int p_renderSelected_3_, Tezzelator p_renderSelected_4_) + { + } + + public void setLeftPos(int p_setLeftPos_1_) + { + this.proxy.setSlotXBoundsFromLeft(p_setLeftPos_1_); + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsConnect.java b/src/minecraft/net/minecraft/realms/RealmsConnect.java new file mode 100644 index 0000000..c97af8f --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsConnect.java @@ -0,0 +1,124 @@ +package net.minecraft.realms; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetHandlerLoginClient; +import net.minecraft.network.EnumConnectionState; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.network.login.client.C00PacketLoginStart; +import net.minecraft.util.ChatComponentTranslation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class RealmsConnect +{ + private static final Logger LOGGER = LogManager.getLogger(); + private final RealmsScreen onlineScreen; + private volatile boolean aborted = false; + private NetworkManager connection; + + public RealmsConnect(RealmsScreen p_i1079_1_) + { + this.onlineScreen = p_i1079_1_; + } + + public void connect(final String p_connect_1_, final int p_connect_2_) + { + Realms.setConnectedToRealms(true); + (new Thread("Realms-connect-task") + { + public void run() + { + InetAddress inetaddress = null; + + try + { + inetaddress = InetAddress.getByName(p_connect_1_); + + if (RealmsConnect.this.aborted) + { + return; + } + + RealmsConnect.this.connection = NetworkManager.func_181124_a(inetaddress, p_connect_2_, Minecraft.getMinecraft().gameSettings.func_181148_f()); + + if (RealmsConnect.this.aborted) + { + return; + } + + RealmsConnect.this.connection.setNetHandler(new NetHandlerLoginClient(RealmsConnect.this.connection, Minecraft.getMinecraft(), RealmsConnect.this.onlineScreen.getProxy())); + + if (RealmsConnect.this.aborted) + { + return; + } + + RealmsConnect.this.connection.sendPacket(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN)); + + if (RealmsConnect.this.aborted) + { + return; + } + + RealmsConnect.this.connection.sendPacket(new C00PacketLoginStart(Minecraft.getMinecraft().getSession().getProfile())); + } + catch (UnknownHostException unknownhostexception) + { + Realms.clearResourcePack(); + + if (RealmsConnect.this.aborted) + { + return; + } + + RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)unknownhostexception); + Minecraft.getMinecraft().getResourcePackRepository().func_148529_f(); + Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host \'" + p_connect_1_ + "\'"}))); + } + catch (Exception exception) + { + Realms.clearResourcePack(); + + if (RealmsConnect.this.aborted) + { + return; + } + + RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)exception); + String s = exception.toString(); + + if (inetaddress != null) + { + String s1 = inetaddress.toString() + ":" + p_connect_2_; + s = s.replaceAll(s1, ""); + } + + Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new ChatComponentTranslation("disconnect.genericReason", new Object[] {s}))); + } + } + }).start(); + } + + public void abort() + { + this.aborted = true; + } + + public void tick() + { + if (this.connection != null) + { + if (this.connection.isChannelOpen()) + { + this.connection.processReceivedPackets(); + } + else + { + this.connection.checkDisconnected(); + } + } + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsDefaultVertexFormat.java b/src/minecraft/net/minecraft/realms/RealmsDefaultVertexFormat.java new file mode 100644 index 0000000..926498e --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsDefaultVertexFormat.java @@ -0,0 +1,71 @@ +package net.minecraft.realms; + +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; + +public class RealmsDefaultVertexFormat +{ + public static final RealmsVertexFormat BLOCK = new RealmsVertexFormat(new VertexFormat()); + public static final RealmsVertexFormat BLOCK_NORMALS = new RealmsVertexFormat(new VertexFormat()); + public static final RealmsVertexFormat ENTITY = new RealmsVertexFormat(new VertexFormat()); + public static final RealmsVertexFormat PARTICLE = new RealmsVertexFormat(new VertexFormat()); + public static final RealmsVertexFormat POSITION = new RealmsVertexFormat(new VertexFormat()); + public static final RealmsVertexFormat POSITION_COLOR = new RealmsVertexFormat(new VertexFormat()); + public static final RealmsVertexFormat POSITION_TEX = new RealmsVertexFormat(new VertexFormat()); + public static final RealmsVertexFormat POSITION_NORMAL = new RealmsVertexFormat(new VertexFormat()); + public static final RealmsVertexFormat POSITION_TEX_COLOR = new RealmsVertexFormat(new VertexFormat()); + public static final RealmsVertexFormat POSITION_TEX_NORMAL = new RealmsVertexFormat(new VertexFormat()); + public static final RealmsVertexFormat POSITION_TEX2_COLOR = new RealmsVertexFormat(new VertexFormat()); + public static final RealmsVertexFormat POSITION_TEX_COLOR_NORMAL = new RealmsVertexFormat(new VertexFormat()); + public static final RealmsVertexFormatElement ELEMENT_POSITION = new RealmsVertexFormatElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3)); + public static final RealmsVertexFormatElement ELEMENT_COLOR = new RealmsVertexFormatElement(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4)); + public static final RealmsVertexFormatElement ELEMENT_UV0 = new RealmsVertexFormatElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2)); + public static final RealmsVertexFormatElement ELEMENT_UV1 = new RealmsVertexFormatElement(new VertexFormatElement(1, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.UV, 2)); + public static final RealmsVertexFormatElement ELEMENT_NORMAL = new RealmsVertexFormatElement(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3)); + public static final RealmsVertexFormatElement ELEMENT_PADDING = new RealmsVertexFormatElement(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1)); + + static + { + BLOCK.addElement(ELEMENT_POSITION); + BLOCK.addElement(ELEMENT_COLOR); + BLOCK.addElement(ELEMENT_UV0); + BLOCK.addElement(ELEMENT_UV1); + BLOCK_NORMALS.addElement(ELEMENT_POSITION); + BLOCK_NORMALS.addElement(ELEMENT_COLOR); + BLOCK_NORMALS.addElement(ELEMENT_UV0); + BLOCK_NORMALS.addElement(ELEMENT_NORMAL); + BLOCK_NORMALS.addElement(ELEMENT_PADDING); + ENTITY.addElement(ELEMENT_POSITION); + ENTITY.addElement(ELEMENT_UV0); + ENTITY.addElement(ELEMENT_NORMAL); + ENTITY.addElement(ELEMENT_PADDING); + PARTICLE.addElement(ELEMENT_POSITION); + PARTICLE.addElement(ELEMENT_UV0); + PARTICLE.addElement(ELEMENT_COLOR); + PARTICLE.addElement(ELEMENT_UV1); + POSITION.addElement(ELEMENT_POSITION); + POSITION_COLOR.addElement(ELEMENT_POSITION); + POSITION_COLOR.addElement(ELEMENT_COLOR); + POSITION_TEX.addElement(ELEMENT_POSITION); + POSITION_TEX.addElement(ELEMENT_UV0); + POSITION_NORMAL.addElement(ELEMENT_POSITION); + POSITION_NORMAL.addElement(ELEMENT_NORMAL); + POSITION_NORMAL.addElement(ELEMENT_PADDING); + POSITION_TEX_COLOR.addElement(ELEMENT_POSITION); + POSITION_TEX_COLOR.addElement(ELEMENT_UV0); + POSITION_TEX_COLOR.addElement(ELEMENT_COLOR); + POSITION_TEX_NORMAL.addElement(ELEMENT_POSITION); + POSITION_TEX_NORMAL.addElement(ELEMENT_UV0); + POSITION_TEX_NORMAL.addElement(ELEMENT_NORMAL); + POSITION_TEX_NORMAL.addElement(ELEMENT_PADDING); + POSITION_TEX2_COLOR.addElement(ELEMENT_POSITION); + POSITION_TEX2_COLOR.addElement(ELEMENT_UV0); + POSITION_TEX2_COLOR.addElement(ELEMENT_UV1); + POSITION_TEX2_COLOR.addElement(ELEMENT_COLOR); + POSITION_TEX_COLOR_NORMAL.addElement(ELEMENT_POSITION); + POSITION_TEX_COLOR_NORMAL.addElement(ELEMENT_UV0); + POSITION_TEX_COLOR_NORMAL.addElement(ELEMENT_COLOR); + POSITION_TEX_COLOR_NORMAL.addElement(ELEMENT_NORMAL); + POSITION_TEX_COLOR_NORMAL.addElement(ELEMENT_PADDING); + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsEditBox.java b/src/minecraft/net/minecraft/realms/RealmsEditBox.java new file mode 100644 index 0000000..d5846d3 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsEditBox.java @@ -0,0 +1,64 @@ +package net.minecraft.realms; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiTextField; + +public class RealmsEditBox +{ + private final GuiTextField editBox; + + public RealmsEditBox(int p_i45743_1_, int p_i45743_2_, int p_i45743_3_, int p_i45743_4_, int p_i45743_5_) + { + this.editBox = new GuiTextField(p_i45743_1_, Minecraft.getMinecraft().fontRendererObj, p_i45743_2_, p_i45743_3_, p_i45743_4_, p_i45743_5_); + } + + public String getValue() + { + return this.editBox.getText(); + } + + public void tick() + { + this.editBox.updateCursorCounter(); + } + + public void setFocus(boolean p_setFocus_1_) + { + this.editBox.setFocused(p_setFocus_1_); + } + + public void setValue(String p_setValue_1_) + { + this.editBox.setText(p_setValue_1_); + } + + public void keyPressed(char p_keyPressed_1_, int p_keyPressed_2_) + { + this.editBox.textboxKeyTyped(p_keyPressed_1_, p_keyPressed_2_); + } + + public boolean isFocused() + { + return this.editBox.isFocused(); + } + + public void mouseClicked(int p_mouseClicked_1_, int p_mouseClicked_2_, int p_mouseClicked_3_) + { + this.editBox.mouseClicked(p_mouseClicked_1_, p_mouseClicked_2_, p_mouseClicked_3_); + } + + public void render() + { + this.editBox.drawTextBox(); + } + + public void setMaxLength(int p_setMaxLength_1_) + { + this.editBox.setMaxStringLength(p_setMaxLength_1_); + } + + public void setIsEditable(boolean p_setIsEditable_1_) + { + this.editBox.setEnabled(p_setIsEditable_1_); + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsLevelSummary.java b/src/minecraft/net/minecraft/realms/RealmsLevelSummary.java new file mode 100644 index 0000000..d4dd859 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsLevelSummary.java @@ -0,0 +1,63 @@ +package net.minecraft.realms; + +import net.minecraft.world.storage.SaveFormatComparator; + +public class RealmsLevelSummary implements Comparable +{ + private SaveFormatComparator levelSummary; + + public RealmsLevelSummary(SaveFormatComparator p_i1109_1_) + { + this.levelSummary = p_i1109_1_; + } + + public int getGameMode() + { + return this.levelSummary.getEnumGameType().getID(); + } + + public String getLevelId() + { + return this.levelSummary.getFileName(); + } + + public boolean hasCheats() + { + return this.levelSummary.getCheatsEnabled(); + } + + public boolean isHardcore() + { + return this.levelSummary.isHardcoreModeEnabled(); + } + + public boolean isRequiresConversion() + { + return this.levelSummary.requiresConversion(); + } + + public String getLevelName() + { + return this.levelSummary.getDisplayName(); + } + + public long getLastPlayed() + { + return this.levelSummary.getLastTimePlayed(); + } + + public int compareTo(SaveFormatComparator p_compareTo_1_) + { + return this.levelSummary.compareTo(p_compareTo_1_); + } + + public long getSizeOnDisk() + { + return this.levelSummary.getSizeOnDisk(); + } + + public int compareTo(RealmsLevelSummary p_compareTo_1_) + { + return this.levelSummary.getLastTimePlayed() < p_compareTo_1_.getLastPlayed() ? 1 : (this.levelSummary.getLastTimePlayed() > p_compareTo_1_.getLastPlayed() ? -1 : this.levelSummary.getFileName().compareTo(p_compareTo_1_.getLevelId())); + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsMth.java b/src/minecraft/net/minecraft/realms/RealmsMth.java new file mode 100644 index 0000000..1e732fc --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsMth.java @@ -0,0 +1,173 @@ +package net.minecraft.realms; + +import java.util.Random; +import net.minecraft.util.MathHelper; +import org.apache.commons.lang3.StringUtils; + +public class RealmsMth +{ + public static float sin(float p_sin_0_) + { + return MathHelper.sin(p_sin_0_); + } + + public static double nextDouble(Random p_nextDouble_0_, double p_nextDouble_1_, double p_nextDouble_3_) + { + return MathHelper.getRandomDoubleInRange(p_nextDouble_0_, p_nextDouble_1_, p_nextDouble_3_); + } + + public static int ceil(float p_ceil_0_) + { + return MathHelper.ceiling_float_int(p_ceil_0_); + } + + public static int floor(double p_floor_0_) + { + return MathHelper.floor_double(p_floor_0_); + } + + public static int intFloorDiv(int p_intFloorDiv_0_, int p_intFloorDiv_1_) + { + return MathHelper.bucketInt(p_intFloorDiv_0_, p_intFloorDiv_1_); + } + + public static float abs(float p_abs_0_) + { + return MathHelper.abs(p_abs_0_); + } + + public static int clamp(int p_clamp_0_, int p_clamp_1_, int p_clamp_2_) + { + return MathHelper.clamp_int(p_clamp_0_, p_clamp_1_, p_clamp_2_); + } + + public static double clampedLerp(double p_clampedLerp_0_, double p_clampedLerp_2_, double p_clampedLerp_4_) + { + return MathHelper.denormalizeClamp(p_clampedLerp_0_, p_clampedLerp_2_, p_clampedLerp_4_); + } + + public static int ceil(double p_ceil_0_) + { + return MathHelper.ceiling_double_int(p_ceil_0_); + } + + public static boolean isEmpty(String p_isEmpty_0_) + { + return StringUtils.isEmpty(p_isEmpty_0_); + } + + public static long lfloor(double p_lfloor_0_) + { + return MathHelper.floor_double_long(p_lfloor_0_); + } + + public static float sqrt(double p_sqrt_0_) + { + return MathHelper.sqrt_double(p_sqrt_0_); + } + + public static double clamp(double p_clamp_0_, double p_clamp_2_, double p_clamp_4_) + { + return MathHelper.clamp_double(p_clamp_0_, p_clamp_2_, p_clamp_4_); + } + + public static int getInt(String p_getInt_0_, int p_getInt_1_) + { + return MathHelper.parseIntWithDefault(p_getInt_0_, p_getInt_1_); + } + + public static double getDouble(String p_getDouble_0_, double p_getDouble_1_) + { + return MathHelper.parseDoubleWithDefault(p_getDouble_0_, p_getDouble_1_); + } + + public static int log2(int p_log2_0_) + { + return MathHelper.calculateLogBaseTwo(p_log2_0_); + } + + public static int absFloor(double p_absFloor_0_) + { + return MathHelper.func_154353_e(p_absFloor_0_); + } + + public static int smallestEncompassingPowerOfTwo(int p_smallestEncompassingPowerOfTwo_0_) + { + return MathHelper.roundUpToPowerOfTwo(p_smallestEncompassingPowerOfTwo_0_); + } + + public static float sqrt(float p_sqrt_0_) + { + return MathHelper.sqrt_float(p_sqrt_0_); + } + + public static float cos(float p_cos_0_) + { + return MathHelper.cos(p_cos_0_); + } + + public static int getInt(String p_getInt_0_, int p_getInt_1_, int p_getInt_2_) + { + return MathHelper.parseIntWithDefaultAndMax(p_getInt_0_, p_getInt_1_, p_getInt_2_); + } + + public static int fastFloor(double p_fastFloor_0_) + { + return MathHelper.truncateDoubleToInt(p_fastFloor_0_); + } + + public static double absMax(double p_absMax_0_, double p_absMax_2_) + { + return MathHelper.abs_max(p_absMax_0_, p_absMax_2_); + } + + public static float nextFloat(Random p_nextFloat_0_, float p_nextFloat_1_, float p_nextFloat_2_) + { + return MathHelper.randomFloatClamp(p_nextFloat_0_, p_nextFloat_1_, p_nextFloat_2_); + } + + public static double wrapDegrees(double p_wrapDegrees_0_) + { + return MathHelper.wrapAngleTo180_double(p_wrapDegrees_0_); + } + + public static float wrapDegrees(float p_wrapDegrees_0_) + { + return MathHelper.wrapAngleTo180_float(p_wrapDegrees_0_); + } + + public static float clamp(float p_clamp_0_, float p_clamp_1_, float p_clamp_2_) + { + return MathHelper.clamp_float(p_clamp_0_, p_clamp_1_, p_clamp_2_); + } + + public static double getDouble(String p_getDouble_0_, double p_getDouble_1_, double p_getDouble_3_) + { + return MathHelper.parseDoubleWithDefaultAndMax(p_getDouble_0_, p_getDouble_1_, p_getDouble_3_); + } + + public static int roundUp(int p_roundUp_0_, int p_roundUp_1_) + { + return MathHelper.func_154354_b(p_roundUp_0_, p_roundUp_1_); + } + + public static double average(long[] p_average_0_) + { + return MathHelper.average(p_average_0_); + } + + public static int floor(float p_floor_0_) + { + return MathHelper.floor_float(p_floor_0_); + } + + public static int abs(int p_abs_0_) + { + return MathHelper.abs_int(p_abs_0_); + } + + public static int nextInt(Random p_nextInt_0_, int p_nextInt_1_, int p_nextInt_2_) + { + return MathHelper.getRandomIntegerInRange(p_nextInt_0_, p_nextInt_1_, p_nextInt_2_); + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsScreen.java b/src/minecraft/net/minecraft/realms/RealmsScreen.java new file mode 100644 index 0000000..63a1ce5 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsScreen.java @@ -0,0 +1,250 @@ +package net.minecraft.realms; + +import com.mojang.util.UUIDTypeAdapter; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreenRealmsProxy; +import net.minecraft.client.resources.DefaultPlayerSkin; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class RealmsScreen +{ + public static final int SKIN_HEAD_U = 8; + public static final int SKIN_HEAD_V = 8; + public static final int SKIN_HEAD_WIDTH = 8; + public static final int SKIN_HEAD_HEIGHT = 8; + public static final int SKIN_HAT_U = 40; + public static final int SKIN_HAT_V = 8; + public static final int SKIN_HAT_WIDTH = 8; + public static final int SKIN_HAT_HEIGHT = 8; + public static final int SKIN_TEX_WIDTH = 64; + public static final int SKIN_TEX_HEIGHT = 64; + protected Minecraft minecraft; + public int width; + public int height; + private GuiScreenRealmsProxy proxy = new GuiScreenRealmsProxy(this); + + public GuiScreenRealmsProxy getProxy() + { + return this.proxy; + } + + public void init() + { + } + + public void init(Minecraft p_init_1_, int p_init_2_, int p_init_3_) + { + } + + public void drawCenteredString(String p_drawCenteredString_1_, int p_drawCenteredString_2_, int p_drawCenteredString_3_, int p_drawCenteredString_4_) + { + this.proxy.func_154325_a(p_drawCenteredString_1_, p_drawCenteredString_2_, p_drawCenteredString_3_, p_drawCenteredString_4_); + } + + public void drawString(String p_drawString_1_, int p_drawString_2_, int p_drawString_3_, int p_drawString_4_) + { + this.proxy.func_154322_b(p_drawString_1_, p_drawString_2_, p_drawString_3_, p_drawString_4_); + } + + public void blit(int p_blit_1_, int p_blit_2_, int p_blit_3_, int p_blit_4_, int p_blit_5_, int p_blit_6_) + { + this.proxy.drawTexturedModalRect(p_blit_1_, p_blit_2_, p_blit_3_, p_blit_4_, p_blit_5_, p_blit_6_); + } + + public static void blit(int p_blit_0_, int p_blit_1_, float p_blit_2_, float p_blit_3_, int p_blit_4_, int p_blit_5_, int p_blit_6_, int p_blit_7_, float p_blit_8_, float p_blit_9_) + { + Gui.drawScaledCustomSizeModalRect(p_blit_0_, p_blit_1_, p_blit_2_, p_blit_3_, p_blit_4_, p_blit_5_, p_blit_6_, p_blit_7_, p_blit_8_, p_blit_9_); + } + + public static void blit(int p_blit_0_, int p_blit_1_, float p_blit_2_, float p_blit_3_, int p_blit_4_, int p_blit_5_, float p_blit_6_, float p_blit_7_) + { + Gui.drawModalRectWithCustomSizedTexture(p_blit_0_, p_blit_1_, p_blit_2_, p_blit_3_, p_blit_4_, p_blit_5_, p_blit_6_, p_blit_7_); + } + + public void fillGradient(int p_fillGradient_1_, int p_fillGradient_2_, int p_fillGradient_3_, int p_fillGradient_4_, int p_fillGradient_5_, int p_fillGradient_6_) + { + this.proxy.drawGradientRect(p_fillGradient_1_, p_fillGradient_2_, p_fillGradient_3_, p_fillGradient_4_, p_fillGradient_5_, p_fillGradient_6_); + } + + public void renderBackground() + { + this.proxy.drawDefaultBackground(); + } + + public boolean isPauseScreen() + { + return this.proxy.doesGuiPauseGame(); + } + + public void renderBackground(int p_renderBackground_1_) + { + this.proxy.drawWorldBackground(p_renderBackground_1_); + } + + public void render(int p_render_1_, int p_render_2_, float p_render_3_) + { + for (int i = 0; i < this.proxy.func_154320_j().size(); ++i) + { + ((RealmsButton)this.proxy.func_154320_j().get(i)).render(p_render_1_, p_render_2_); + } + } + + public void renderTooltip(ItemStack p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_) + { + this.proxy.renderToolTip(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_); + } + + public void renderTooltip(String p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_) + { + this.proxy.drawCreativeTabHoveringText(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_); + } + + public void renderTooltip(List p_renderTooltip_1_, int p_renderTooltip_2_, int p_renderTooltip_3_) + { + this.proxy.drawHoveringText(p_renderTooltip_1_, p_renderTooltip_2_, p_renderTooltip_3_); + } + + public static void bindFace(String p_bindFace_0_, String p_bindFace_1_) + { + ResourceLocation resourcelocation = AbstractClientPlayer.getLocationSkin(p_bindFace_1_); + + if (resourcelocation == null) + { + resourcelocation = DefaultPlayerSkin.getDefaultSkin(UUIDTypeAdapter.fromString(p_bindFace_0_)); + } + + AbstractClientPlayer.getDownloadImageSkin(resourcelocation, p_bindFace_1_); + Minecraft.getMinecraft().getTextureManager().bindTexture(resourcelocation); + } + + public static void bind(String p_bind_0_) + { + ResourceLocation resourcelocation = new ResourceLocation(p_bind_0_); + Minecraft.getMinecraft().getTextureManager().bindTexture(resourcelocation); + } + + public void tick() + { + } + + public int width() + { + return this.proxy.width; + } + + public int height() + { + return this.proxy.height; + } + + public int fontLineHeight() + { + return this.proxy.func_154329_h(); + } + + public int fontWidth(String p_fontWidth_1_) + { + return this.proxy.func_154326_c(p_fontWidth_1_); + } + + public void fontDrawShadow(String p_fontDrawShadow_1_, int p_fontDrawShadow_2_, int p_fontDrawShadow_3_, int p_fontDrawShadow_4_) + { + this.proxy.func_154319_c(p_fontDrawShadow_1_, p_fontDrawShadow_2_, p_fontDrawShadow_3_, p_fontDrawShadow_4_); + } + + public List fontSplit(String p_fontSplit_1_, int p_fontSplit_2_) + { + return this.proxy.func_154323_a(p_fontSplit_1_, p_fontSplit_2_); + } + + public void buttonClicked(RealmsButton p_buttonClicked_1_) + { + } + + public static RealmsButton newButton(int p_newButton_0_, int p_newButton_1_, int p_newButton_2_, String p_newButton_3_) + { + return new RealmsButton(p_newButton_0_, p_newButton_1_, p_newButton_2_, p_newButton_3_); + } + + public static RealmsButton newButton(int p_newButton_0_, int p_newButton_1_, int p_newButton_2_, int p_newButton_3_, int p_newButton_4_, String p_newButton_5_) + { + return new RealmsButton(p_newButton_0_, p_newButton_1_, p_newButton_2_, p_newButton_3_, p_newButton_4_, p_newButton_5_); + } + + public void buttonsClear() + { + this.proxy.func_154324_i(); + } + + public void buttonsAdd(RealmsButton p_buttonsAdd_1_) + { + this.proxy.func_154327_a(p_buttonsAdd_1_); + } + + public List buttons() + { + return this.proxy.func_154320_j(); + } + + public void buttonsRemove(RealmsButton p_buttonsRemove_1_) + { + this.proxy.func_154328_b(p_buttonsRemove_1_); + } + + public RealmsEditBox newEditBox(int p_newEditBox_1_, int p_newEditBox_2_, int p_newEditBox_3_, int p_newEditBox_4_, int p_newEditBox_5_) + { + return new RealmsEditBox(p_newEditBox_1_, p_newEditBox_2_, p_newEditBox_3_, p_newEditBox_4_, p_newEditBox_5_); + } + + public void mouseClicked(int p_mouseClicked_1_, int p_mouseClicked_2_, int p_mouseClicked_3_) + { + } + + public void mouseEvent() + { + } + + public void keyboardEvent() + { + } + + public void mouseReleased(int p_mouseReleased_1_, int p_mouseReleased_2_, int p_mouseReleased_3_) + { + } + + public void mouseDragged(int p_mouseDragged_1_, int p_mouseDragged_2_, int p_mouseDragged_3_, long p_mouseDragged_4_) + { + } + + public void keyPressed(char p_keyPressed_1_, int p_keyPressed_2_) + { + } + + public void confirmResult(boolean p_confirmResult_1_, int p_confirmResult_2_) + { + } + + public static String getLocalizedString(String p_getLocalizedString_0_) + { + return I18n.format(p_getLocalizedString_0_, new Object[0]); + } + + public static String getLocalizedString(String p_getLocalizedString_0_, Object... p_getLocalizedString_1_) + { + return I18n.format(p_getLocalizedString_0_, p_getLocalizedString_1_); + } + + public RealmsAnvilLevelStorageSource getLevelStorageSource() + { + return new RealmsAnvilLevelStorageSource(Minecraft.getMinecraft().getSaveLoader()); + } + + public void removed() + { + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsScrolledSelectionList.java b/src/minecraft/net/minecraft/realms/RealmsScrolledSelectionList.java new file mode 100644 index 0000000..eaf682e --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsScrolledSelectionList.java @@ -0,0 +1,89 @@ +package net.minecraft.realms; + +import net.minecraft.client.gui.GuiSlotRealmsProxy; + +public class RealmsScrolledSelectionList +{ + private final GuiSlotRealmsProxy proxy; + + public RealmsScrolledSelectionList(int p_i1119_1_, int p_i1119_2_, int p_i1119_3_, int p_i1119_4_, int p_i1119_5_) + { + this.proxy = new GuiSlotRealmsProxy(this, p_i1119_1_, p_i1119_2_, p_i1119_3_, p_i1119_4_, p_i1119_5_); + } + + public void render(int p_render_1_, int p_render_2_, float p_render_3_) + { + this.proxy.drawScreen(p_render_1_, p_render_2_, p_render_3_); + } + + public int width() + { + return this.proxy.func_154338_k(); + } + + public int ym() + { + return this.proxy.func_154339_l(); + } + + public int xm() + { + return this.proxy.func_154337_m(); + } + + protected void renderItem(int p_renderItem_1_, int p_renderItem_2_, int p_renderItem_3_, int p_renderItem_4_, Tezzelator p_renderItem_5_, int p_renderItem_6_, int p_renderItem_7_) + { + } + + public void renderItem(int p_renderItem_1_, int p_renderItem_2_, int p_renderItem_3_, int p_renderItem_4_, int p_renderItem_5_, int p_renderItem_6_) + { + this.renderItem(p_renderItem_1_, p_renderItem_2_, p_renderItem_3_, p_renderItem_4_, Tezzelator.instance, p_renderItem_5_, p_renderItem_6_); + } + + public int getItemCount() + { + return 0; + } + + public void selectItem(int p_selectItem_1_, boolean p_selectItem_2_, int p_selectItem_3_, int p_selectItem_4_) + { + } + + public boolean isSelectedItem(int p_isSelectedItem_1_) + { + return false; + } + + public void renderBackground() + { + } + + public int getMaxPosition() + { + return 0; + } + + public int getScrollbarPosition() + { + return this.proxy.func_154338_k() / 2 + 124; + } + + public void mouseEvent() + { + this.proxy.handleMouseInput(); + } + + public void scroll(int p_scroll_1_) + { + this.proxy.scrollBy(p_scroll_1_); + } + + public int getScroll() + { + return this.proxy.getAmountScrolled(); + } + + protected void renderList(int p_renderList_1_, int p_renderList_2_, int p_renderList_3_, int p_renderList_4_) + { + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsServerAddress.java b/src/minecraft/net/minecraft/realms/RealmsServerAddress.java new file mode 100644 index 0000000..d65b42b --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsServerAddress.java @@ -0,0 +1,31 @@ +package net.minecraft.realms; + +import net.minecraft.client.multiplayer.ServerAddress; + +public class RealmsServerAddress +{ + private final String host; + private final int port; + + protected RealmsServerAddress(String p_i1121_1_, int p_i1121_2_) + { + this.host = p_i1121_1_; + this.port = p_i1121_2_; + } + + public String getHost() + { + return this.host; + } + + public int getPort() + { + return this.port; + } + + public static RealmsServerAddress parseString(String p_parseString_0_) + { + ServerAddress serveraddress = ServerAddress.func_78860_a(p_parseString_0_); + return new RealmsServerAddress(serveraddress.getIP(), serveraddress.getPort()); + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsServerPing.java b/src/minecraft/net/minecraft/realms/RealmsServerPing.java new file mode 100644 index 0000000..d573026 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsServerPing.java @@ -0,0 +1,8 @@ +package net.minecraft.realms; + +public class RealmsServerPing +{ + public volatile String nrOfPlayers = "0"; + public volatile long lastPingSnapshot = 0L; + public volatile String playerList = ""; +} diff --git a/src/minecraft/net/minecraft/realms/RealmsServerStatusPinger.java b/src/minecraft/net/minecraft/realms/RealmsServerStatusPinger.java new file mode 100644 index 0000000..f5fa8a0 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsServerStatusPinger.java @@ -0,0 +1,149 @@ +package net.minecraft.realms; + +import com.google.common.collect.Lists; +import com.mojang.authlib.GameProfile; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import net.minecraft.network.EnumConnectionState; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.ServerStatusResponse; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.network.status.INetHandlerStatusClient; +import net.minecraft.network.status.client.C00PacketServerQuery; +import net.minecraft.network.status.client.C01PacketPing; +import net.minecraft.network.status.server.S00PacketServerInfo; +import net.minecraft.network.status.server.S01PacketPong; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class RealmsServerStatusPinger +{ + private static final Logger LOGGER = LogManager.getLogger(); + private final List connections = Collections.synchronizedList(Lists.newArrayList()); + + public void pingServer(final String p_pingServer_1_, final RealmsServerPing p_pingServer_2_) throws UnknownHostException + { + if (p_pingServer_1_ != null && !p_pingServer_1_.startsWith("0.0.0.0") && !p_pingServer_1_.isEmpty()) + { + RealmsServerAddress realmsserveraddress = RealmsServerAddress.parseString(p_pingServer_1_); + final NetworkManager networkmanager = NetworkManager.func_181124_a(InetAddress.getByName(realmsserveraddress.getHost()), realmsserveraddress.getPort(), false); + this.connections.add(networkmanager); + networkmanager.setNetHandler(new INetHandlerStatusClient() + { + private boolean field_154345_e = false; + public void handleServerInfo(S00PacketServerInfo packetIn) + { + ServerStatusResponse serverstatusresponse = packetIn.getResponse(); + + if (serverstatusresponse.getPlayerCountData() != null) + { + p_pingServer_2_.nrOfPlayers = String.valueOf(serverstatusresponse.getPlayerCountData().getOnlinePlayerCount()); + + if (ArrayUtils.isNotEmpty(serverstatusresponse.getPlayerCountData().getPlayers())) + { + StringBuilder stringbuilder = new StringBuilder(); + + for (GameProfile gameprofile : serverstatusresponse.getPlayerCountData().getPlayers()) + { + if (stringbuilder.length() > 0) + { + stringbuilder.append("\n"); + } + + stringbuilder.append(gameprofile.getName()); + } + + if (serverstatusresponse.getPlayerCountData().getPlayers().length < serverstatusresponse.getPlayerCountData().getOnlinePlayerCount()) + { + if (stringbuilder.length() > 0) + { + stringbuilder.append("\n"); + } + + stringbuilder.append("... and ").append(serverstatusresponse.getPlayerCountData().getOnlinePlayerCount() - serverstatusresponse.getPlayerCountData().getPlayers().length).append(" more ..."); + } + + p_pingServer_2_.playerList = stringbuilder.toString(); + } + } + else + { + p_pingServer_2_.playerList = ""; + } + + networkmanager.sendPacket(new C01PacketPing(Realms.currentTimeMillis())); + this.field_154345_e = true; + } + public void handlePong(S01PacketPong packetIn) + { + networkmanager.closeChannel(new ChatComponentText("Finished")); + } + public void onDisconnect(IChatComponent reason) + { + if (!this.field_154345_e) + { + RealmsServerStatusPinger.LOGGER.error("Can\'t ping " + p_pingServer_1_ + ": " + reason.getUnformattedText()); + } + } + }); + + try + { + networkmanager.sendPacket(new C00Handshake(RealmsSharedConstants.NETWORK_PROTOCOL_VERSION, realmsserveraddress.getHost(), realmsserveraddress.getPort(), EnumConnectionState.STATUS)); + networkmanager.sendPacket(new C00PacketServerQuery()); + } + catch (Throwable throwable) + { + LOGGER.error((Object)throwable); + } + } + } + + public void tick() + { + synchronized (this.connections) + { + Iterator iterator = this.connections.iterator(); + + while (iterator.hasNext()) + { + NetworkManager networkmanager = (NetworkManager)iterator.next(); + + if (networkmanager.isChannelOpen()) + { + networkmanager.processReceivedPackets(); + } + else + { + iterator.remove(); + networkmanager.checkDisconnected(); + } + } + } + } + + public void removeAll() + { + synchronized (this.connections) + { + Iterator iterator = this.connections.iterator(); + + while (iterator.hasNext()) + { + NetworkManager networkmanager = (NetworkManager)iterator.next(); + + if (networkmanager.isChannelOpen()) + { + iterator.remove(); + networkmanager.closeChannel(new ChatComponentText("Cancelled")); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsSharedConstants.java b/src/minecraft/net/minecraft/realms/RealmsSharedConstants.java new file mode 100644 index 0000000..5e28f1c --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsSharedConstants.java @@ -0,0 +1,11 @@ +package net.minecraft.realms; + +import net.minecraft.util.ChatAllowedCharacters; + +public class RealmsSharedConstants +{ + public static int NETWORK_PROTOCOL_VERSION = 47; + public static int TICKS_PER_SECOND = 20; + public static String VERSION_STRING = "1.8.8"; + public static char[] ILLEGAL_FILE_CHARACTERS = ChatAllowedCharacters.allowedCharactersArray; +} diff --git a/src/minecraft/net/minecraft/realms/RealmsSimpleScrolledSelectionList.java b/src/minecraft/net/minecraft/realms/RealmsSimpleScrolledSelectionList.java new file mode 100644 index 0000000..ea3c7d1 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsSimpleScrolledSelectionList.java @@ -0,0 +1,89 @@ +package net.minecraft.realms; + +import net.minecraft.client.gui.GuiSimpleScrolledSelectionListProxy; + +public class RealmsSimpleScrolledSelectionList +{ + private final GuiSimpleScrolledSelectionListProxy proxy; + + public RealmsSimpleScrolledSelectionList(int p_i45803_1_, int p_i45803_2_, int p_i45803_3_, int p_i45803_4_, int p_i45803_5_) + { + this.proxy = new GuiSimpleScrolledSelectionListProxy(this, p_i45803_1_, p_i45803_2_, p_i45803_3_, p_i45803_4_, p_i45803_5_); + } + + public void render(int p_render_1_, int p_render_2_, float p_render_3_) + { + this.proxy.drawScreen(p_render_1_, p_render_2_, p_render_3_); + } + + public int width() + { + return this.proxy.getWidth(); + } + + public int ym() + { + return this.proxy.getMouseY(); + } + + public int xm() + { + return this.proxy.getMouseX(); + } + + protected void renderItem(int p_renderItem_1_, int p_renderItem_2_, int p_renderItem_3_, int p_renderItem_4_, Tezzelator p_renderItem_5_, int p_renderItem_6_, int p_renderItem_7_) + { + } + + public void renderItem(int p_renderItem_1_, int p_renderItem_2_, int p_renderItem_3_, int p_renderItem_4_, int p_renderItem_5_, int p_renderItem_6_) + { + this.renderItem(p_renderItem_1_, p_renderItem_2_, p_renderItem_3_, p_renderItem_4_, Tezzelator.instance, p_renderItem_5_, p_renderItem_6_); + } + + public int getItemCount() + { + return 0; + } + + public void selectItem(int p_selectItem_1_, boolean p_selectItem_2_, int p_selectItem_3_, int p_selectItem_4_) + { + } + + public boolean isSelectedItem(int p_isSelectedItem_1_) + { + return false; + } + + public void renderBackground() + { + } + + public int getMaxPosition() + { + return 0; + } + + public int getScrollbarPosition() + { + return this.proxy.getWidth() / 2 + 124; + } + + public void mouseEvent() + { + this.proxy.handleMouseInput(); + } + + public void scroll(int p_scroll_1_) + { + this.proxy.scrollBy(p_scroll_1_); + } + + public int getScroll() + { + return this.proxy.getAmountScrolled(); + } + + protected void renderList(int p_renderList_1_, int p_renderList_2_, int p_renderList_3_, int p_renderList_4_) + { + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsSliderButton.java b/src/minecraft/net/minecraft/realms/RealmsSliderButton.java new file mode 100644 index 0000000..1760226 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsSliderButton.java @@ -0,0 +1,104 @@ +package net.minecraft.realms; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.MathHelper; + +public class RealmsSliderButton extends RealmsButton +{ + public float value; + public boolean sliding; + private final float minValue; + private final float maxValue; + private int steps; + + public RealmsSliderButton(int p_i1056_1_, int p_i1056_2_, int p_i1056_3_, int p_i1056_4_, int p_i1056_5_, int p_i1056_6_) + { + this(p_i1056_1_, p_i1056_2_, p_i1056_3_, p_i1056_4_, p_i1056_6_, 0, 1.0F, (float)p_i1056_5_); + } + + public RealmsSliderButton(int p_i1057_1_, int p_i1057_2_, int p_i1057_3_, int p_i1057_4_, int p_i1057_5_, int p_i1057_6_, float p_i1057_7_, float p_i1057_8_) + { + super(p_i1057_1_, p_i1057_2_, p_i1057_3_, p_i1057_4_, 20, ""); + this.value = 1.0F; + this.minValue = p_i1057_7_; + this.maxValue = p_i1057_8_; + this.value = this.toPct((float)p_i1057_6_); + this.getProxy().displayString = this.getMessage(); + } + + public String getMessage() + { + return ""; + } + + public float toPct(float p_toPct_1_) + { + return MathHelper.clamp_float((this.clamp(p_toPct_1_) - this.minValue) / (this.maxValue - this.minValue), 0.0F, 1.0F); + } + + public float toValue(float p_toValue_1_) + { + return this.clamp(this.minValue + (this.maxValue - this.minValue) * MathHelper.clamp_float(p_toValue_1_, 0.0F, 1.0F)); + } + + public float clamp(float p_clamp_1_) + { + p_clamp_1_ = this.clampSteps(p_clamp_1_); + return MathHelper.clamp_float(p_clamp_1_, this.minValue, this.maxValue); + } + + protected float clampSteps(float p_clampSteps_1_) + { + if (this.steps > 0) + { + p_clampSteps_1_ = (float)(this.steps * Math.round(p_clampSteps_1_ / (float)this.steps)); + } + + return p_clampSteps_1_; + } + + public int getYImage(boolean p_getYImage_1_) + { + return 0; + } + + public void renderBg(int p_renderBg_1_, int p_renderBg_2_) + { + if (this.getProxy().visible) + { + if (this.sliding) + { + this.value = (float)(p_renderBg_1_ - (this.getProxy().xPosition + 4)) / (float)(this.getProxy().getButtonWidth() - 8); + this.value = MathHelper.clamp_float(this.value, 0.0F, 1.0F); + float f = this.toValue(this.value); + this.clicked(f); + this.value = this.toPct(f); + this.getProxy().displayString = this.getMessage(); + } + + Minecraft.getMinecraft().getTextureManager().bindTexture(WIDGETS_LOCATION); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.blit(this.getProxy().xPosition + (int)(this.value * (float)(this.getProxy().getButtonWidth() - 8)), this.getProxy().yPosition, 0, 66, 4, 20); + this.blit(this.getProxy().xPosition + (int)(this.value * (float)(this.getProxy().getButtonWidth() - 8)) + 4, this.getProxy().yPosition, 196, 66, 4, 20); + } + } + + public void clicked(int p_clicked_1_, int p_clicked_2_) + { + this.value = (float)(p_clicked_1_ - (this.getProxy().xPosition + 4)) / (float)(this.getProxy().getButtonWidth() - 8); + this.value = MathHelper.clamp_float(this.value, 0.0F, 1.0F); + this.clicked(this.toValue(this.value)); + this.getProxy().displayString = this.getMessage(); + this.sliding = true; + } + + public void clicked(float p_clicked_1_) + { + } + + public void released(int p_released_1_, int p_released_2_) + { + this.sliding = false; + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsVertexFormat.java b/src/minecraft/net/minecraft/realms/RealmsVertexFormat.java new file mode 100644 index 0000000..afbb03b --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsVertexFormat.java @@ -0,0 +1,119 @@ +package net.minecraft.realms; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; + +public class RealmsVertexFormat +{ + private VertexFormat v; + + public RealmsVertexFormat(VertexFormat p_i46456_1_) + { + this.v = p_i46456_1_; + } + + public RealmsVertexFormat from(VertexFormat p_from_1_) + { + this.v = p_from_1_; + return this; + } + + public VertexFormat getVertexFormat() + { + return this.v; + } + + public void clear() + { + this.v.clear(); + } + + public int getUvOffset(int p_getUvOffset_1_) + { + return this.v.getUvOffsetById(p_getUvOffset_1_); + } + + public int getElementCount() + { + return this.v.getElementCount(); + } + + public boolean hasColor() + { + return this.v.hasColor(); + } + + public boolean hasUv(int p_hasUv_1_) + { + return this.v.hasUvOffset(p_hasUv_1_); + } + + public RealmsVertexFormatElement getElement(int p_getElement_1_) + { + return new RealmsVertexFormatElement(this.v.getElement(p_getElement_1_)); + } + + public RealmsVertexFormat addElement(RealmsVertexFormatElement p_addElement_1_) + { + return this.from(this.v.func_181721_a(p_addElement_1_.getVertexFormatElement())); + } + + public int getColorOffset() + { + return this.v.getColorOffset(); + } + + public List getElements() + { + List list = new ArrayList(); + + for (VertexFormatElement vertexformatelement : this.v.getElements()) + { + list.add(new RealmsVertexFormatElement(vertexformatelement)); + } + + return list; + } + + public boolean hasNormal() + { + return this.v.hasNormal(); + } + + public int getVertexSize() + { + return this.v.getNextOffset(); + } + + public int getOffset(int p_getOffset_1_) + { + return this.v.func_181720_d(p_getOffset_1_); + } + + public int getNormalOffset() + { + return this.v.getNormalOffset(); + } + + public int getIntegerSize() + { + return this.v.func_181719_f(); + } + + public boolean equals(Object p_equals_1_) + { + return this.v.equals(p_equals_1_); + } + + public int hashCode() + { + return this.v.hashCode(); + } + + public String toString() + { + return this.v.toString(); + } +} diff --git a/src/minecraft/net/minecraft/realms/RealmsVertexFormatElement.java b/src/minecraft/net/minecraft/realms/RealmsVertexFormatElement.java new file mode 100644 index 0000000..7d7f538 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/RealmsVertexFormatElement.java @@ -0,0 +1,53 @@ +package net.minecraft.realms; + +import net.minecraft.client.renderer.vertex.VertexFormatElement; + +public class RealmsVertexFormatElement +{ + private VertexFormatElement v; + + public RealmsVertexFormatElement(VertexFormatElement p_i46463_1_) + { + this.v = p_i46463_1_; + } + + public VertexFormatElement getVertexFormatElement() + { + return this.v; + } + + public boolean isPosition() + { + return this.v.isPositionElement(); + } + + public int getIndex() + { + return this.v.getIndex(); + } + + public int getByteSize() + { + return this.v.getSize(); + } + + public int getCount() + { + return this.v.getElementCount(); + } + + public int hashCode() + { + return this.v.hashCode(); + } + + public boolean equals(Object p_equals_1_) + { + return this.v.equals(p_equals_1_); + } + + public String toString() + { + return this.v.toString(); + } +} diff --git a/src/minecraft/net/minecraft/realms/Tezzelator.java b/src/minecraft/net/minecraft/realms/Tezzelator.java new file mode 100644 index 0000000..fb76d74 --- /dev/null +++ b/src/minecraft/net/minecraft/realms/Tezzelator.java @@ -0,0 +1,61 @@ +package net.minecraft.realms; + +import net.minecraft.client.renderer.Tessellator; + +public class Tezzelator +{ + public static Tessellator t = Tessellator.getInstance(); + public static final Tezzelator instance = new Tezzelator(); + + public void end() + { + t.draw(); + } + + public Tezzelator vertex(double p_vertex_1_, double p_vertex_3_, double p_vertex_5_) + { + t.getWorldRenderer().pos(p_vertex_1_, p_vertex_3_, p_vertex_5_); + return this; + } + + public void color(float p_color_1_, float p_color_2_, float p_color_3_, float p_color_4_) + { + t.getWorldRenderer().color(p_color_1_, p_color_2_, p_color_3_, p_color_4_); + } + + public void tex2(short p_tex2_1_, short p_tex2_2_) + { + t.getWorldRenderer().lightmap(p_tex2_1_, p_tex2_2_); + } + + public void normal(float p_normal_1_, float p_normal_2_, float p_normal_3_) + { + t.getWorldRenderer().normal(p_normal_1_, p_normal_2_, p_normal_3_); + } + + public void begin(int p_begin_1_, RealmsVertexFormat p_begin_2_) + { + t.getWorldRenderer().begin(p_begin_1_, p_begin_2_.getVertexFormat()); + } + + public void endVertex() + { + t.getWorldRenderer().endVertex(); + } + + public void offset(double p_offset_1_, double p_offset_3_, double p_offset_5_) + { + t.getWorldRenderer().setTranslation(p_offset_1_, p_offset_3_, p_offset_5_); + } + + public RealmsBufferBuilder color(int p_color_1_, int p_color_2_, int p_color_3_, int p_color_4_) + { + return new RealmsBufferBuilder(t.getWorldRenderer().color(p_color_1_, p_color_2_, p_color_3_, p_color_4_)); + } + + public Tezzelator tex(double p_tex_1_, double p_tex_3_) + { + t.getWorldRenderer().tex(p_tex_1_, p_tex_3_); + return this; + } +} diff --git a/src/minecraft/net/minecraft/scoreboard/GoalColor.java b/src/minecraft/net/minecraft/scoreboard/GoalColor.java new file mode 100644 index 0000000..cb59d82 --- /dev/null +++ b/src/minecraft/net/minecraft/scoreboard/GoalColor.java @@ -0,0 +1,36 @@ +package net.minecraft.scoreboard; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.EnumChatFormatting; + +public class GoalColor implements IScoreObjectiveCriteria +{ + private final String goalName; + + public GoalColor(String p_i45549_1_, EnumChatFormatting p_i45549_2_) + { + this.goalName = p_i45549_1_ + p_i45549_2_.getFriendlyName(); + IScoreObjectiveCriteria.INSTANCES.put(this.goalName, this); + } + + public String getName() + { + return this.goalName; + } + + public int func_96635_a(List p_96635_1_) + { + return 0; + } + + public boolean isReadOnly() + { + return false; + } + + public IScoreObjectiveCriteria.EnumRenderType getRenderType() + { + return IScoreObjectiveCriteria.EnumRenderType.INTEGER; + } +} diff --git a/src/minecraft/net/minecraft/scoreboard/IScoreObjectiveCriteria.java b/src/minecraft/net/minecraft/scoreboard/IScoreObjectiveCriteria.java new file mode 100644 index 0000000..1a7456f --- /dev/null +++ b/src/minecraft/net/minecraft/scoreboard/IScoreObjectiveCriteria.java @@ -0,0 +1,60 @@ +package net.minecraft.scoreboard; + +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.EnumChatFormatting; + +public interface IScoreObjectiveCriteria +{ + Map INSTANCES = Maps.newHashMap(); + IScoreObjectiveCriteria DUMMY = new ScoreDummyCriteria("dummy"); + IScoreObjectiveCriteria TRIGGER = new ScoreDummyCriteria("trigger"); + IScoreObjectiveCriteria deathCount = new ScoreDummyCriteria("deathCount"); + IScoreObjectiveCriteria playerKillCount = new ScoreDummyCriteria("playerKillCount"); + IScoreObjectiveCriteria totalKillCount = new ScoreDummyCriteria("totalKillCount"); + IScoreObjectiveCriteria health = new ScoreHealthCriteria("health"); + IScoreObjectiveCriteria[] field_178792_h = new IScoreObjectiveCriteria[] {new GoalColor("teamkill.", EnumChatFormatting.BLACK), new GoalColor("teamkill.", EnumChatFormatting.DARK_BLUE), new GoalColor("teamkill.", EnumChatFormatting.DARK_GREEN), new GoalColor("teamkill.", EnumChatFormatting.DARK_AQUA), new GoalColor("teamkill.", EnumChatFormatting.DARK_RED), new GoalColor("teamkill.", EnumChatFormatting.DARK_PURPLE), new GoalColor("teamkill.", EnumChatFormatting.GOLD), new GoalColor("teamkill.", EnumChatFormatting.GRAY), new GoalColor("teamkill.", EnumChatFormatting.DARK_GRAY), new GoalColor("teamkill.", EnumChatFormatting.BLUE), new GoalColor("teamkill.", EnumChatFormatting.GREEN), new GoalColor("teamkill.", EnumChatFormatting.AQUA), new GoalColor("teamkill.", EnumChatFormatting.RED), new GoalColor("teamkill.", EnumChatFormatting.LIGHT_PURPLE), new GoalColor("teamkill.", EnumChatFormatting.YELLOW), new GoalColor("teamkill.", EnumChatFormatting.WHITE)}; + IScoreObjectiveCriteria[] field_178793_i = new IScoreObjectiveCriteria[] {new GoalColor("killedByTeam.", EnumChatFormatting.BLACK), new GoalColor("killedByTeam.", EnumChatFormatting.DARK_BLUE), new GoalColor("killedByTeam.", EnumChatFormatting.DARK_GREEN), new GoalColor("killedByTeam.", EnumChatFormatting.DARK_AQUA), new GoalColor("killedByTeam.", EnumChatFormatting.DARK_RED), new GoalColor("killedByTeam.", EnumChatFormatting.DARK_PURPLE), new GoalColor("killedByTeam.", EnumChatFormatting.GOLD), new GoalColor("killedByTeam.", EnumChatFormatting.GRAY), new GoalColor("killedByTeam.", EnumChatFormatting.DARK_GRAY), new GoalColor("killedByTeam.", EnumChatFormatting.BLUE), new GoalColor("killedByTeam.", EnumChatFormatting.GREEN), new GoalColor("killedByTeam.", EnumChatFormatting.AQUA), new GoalColor("killedByTeam.", EnumChatFormatting.RED), new GoalColor("killedByTeam.", EnumChatFormatting.LIGHT_PURPLE), new GoalColor("killedByTeam.", EnumChatFormatting.YELLOW), new GoalColor("killedByTeam.", EnumChatFormatting.WHITE)}; + + String getName(); + + int func_96635_a(List p_96635_1_); + + boolean isReadOnly(); + + IScoreObjectiveCriteria.EnumRenderType getRenderType(); + + public static enum EnumRenderType + { + INTEGER("integer"), + HEARTS("hearts"); + + private static final Map field_178801_c = Maps.newHashMap(); + private final String field_178798_d; + + private EnumRenderType(String p_i45548_3_) + { + this.field_178798_d = p_i45548_3_; + } + + public String func_178796_a() + { + return this.field_178798_d; + } + + public static IScoreObjectiveCriteria.EnumRenderType func_178795_a(String p_178795_0_) + { + IScoreObjectiveCriteria.EnumRenderType iscoreobjectivecriteria$enumrendertype = (IScoreObjectiveCriteria.EnumRenderType)field_178801_c.get(p_178795_0_); + return iscoreobjectivecriteria$enumrendertype == null ? INTEGER : iscoreobjectivecriteria$enumrendertype; + } + + static { + for (IScoreObjectiveCriteria.EnumRenderType iscoreobjectivecriteria$enumrendertype : values()) + { + field_178801_c.put(iscoreobjectivecriteria$enumrendertype.func_178796_a(), iscoreobjectivecriteria$enumrendertype); + } + } + } +} diff --git a/src/minecraft/net/minecraft/scoreboard/Score.java b/src/minecraft/net/minecraft/scoreboard/Score.java new file mode 100644 index 0000000..433e239 --- /dev/null +++ b/src/minecraft/net/minecraft/scoreboard/Score.java @@ -0,0 +1,116 @@ +package net.minecraft.scoreboard; + +import java.util.Comparator; +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; + +public class Score +{ + public static final Comparator scoreComparator = new Comparator() + { + public int compare(Score p_compare_1_, Score p_compare_2_) + { + return p_compare_1_.getScorePoints() > p_compare_2_.getScorePoints() ? 1 : (p_compare_1_.getScorePoints() < p_compare_2_.getScorePoints() ? -1 : p_compare_2_.getPlayerName().compareToIgnoreCase(p_compare_1_.getPlayerName())); + } + }; + private final Scoreboard theScoreboard; + private final ScoreObjective theScoreObjective; + private final String scorePlayerName; + private int scorePoints; + private boolean locked; + private boolean field_178818_g; + + public Score(Scoreboard theScoreboardIn, ScoreObjective theScoreObjectiveIn, String scorePlayerNameIn) + { + this.theScoreboard = theScoreboardIn; + this.theScoreObjective = theScoreObjectiveIn; + this.scorePlayerName = scorePlayerNameIn; + this.field_178818_g = true; + } + + public void increseScore(int amount) + { + if (this.theScoreObjective.getCriteria().isReadOnly()) + { + throw new IllegalStateException("Cannot modify read-only score"); + } + else + { + this.setScorePoints(this.getScorePoints() + amount); + } + } + + public void decreaseScore(int amount) + { + if (this.theScoreObjective.getCriteria().isReadOnly()) + { + throw new IllegalStateException("Cannot modify read-only score"); + } + else + { + this.setScorePoints(this.getScorePoints() - amount); + } + } + + public void func_96648_a() + { + if (this.theScoreObjective.getCriteria().isReadOnly()) + { + throw new IllegalStateException("Cannot modify read-only score"); + } + else + { + this.increseScore(1); + } + } + + public int getScorePoints() + { + return this.scorePoints; + } + + public void setScorePoints(int points) + { + int i = this.scorePoints; + this.scorePoints = points; + + if (i != points || this.field_178818_g) + { + this.field_178818_g = false; + this.getScoreScoreboard().func_96536_a(this); + } + } + + public ScoreObjective getObjective() + { + return this.theScoreObjective; + } + + /** + * Returns the name of the player this score belongs to + */ + public String getPlayerName() + { + return this.scorePlayerName; + } + + public Scoreboard getScoreScoreboard() + { + return this.theScoreboard; + } + + public boolean isLocked() + { + return this.locked; + } + + public void setLocked(boolean locked) + { + this.locked = locked; + } + + public void func_96651_a(List p_96651_1_) + { + this.setScorePoints(this.theScoreObjective.getCriteria().func_96635_a(p_96651_1_)); + } +} diff --git a/src/minecraft/net/minecraft/scoreboard/ScoreDummyCriteria.java b/src/minecraft/net/minecraft/scoreboard/ScoreDummyCriteria.java new file mode 100644 index 0000000..e476af4 --- /dev/null +++ b/src/minecraft/net/minecraft/scoreboard/ScoreDummyCriteria.java @@ -0,0 +1,35 @@ +package net.minecraft.scoreboard; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; + +public class ScoreDummyCriteria implements IScoreObjectiveCriteria +{ + private final String dummyName; + + public ScoreDummyCriteria(String name) + { + this.dummyName = name; + IScoreObjectiveCriteria.INSTANCES.put(name, this); + } + + public String getName() + { + return this.dummyName; + } + + public int func_96635_a(List p_96635_1_) + { + return 0; + } + + public boolean isReadOnly() + { + return false; + } + + public IScoreObjectiveCriteria.EnumRenderType getRenderType() + { + return IScoreObjectiveCriteria.EnumRenderType.INTEGER; + } +} diff --git a/src/minecraft/net/minecraft/scoreboard/ScoreHealthCriteria.java b/src/minecraft/net/minecraft/scoreboard/ScoreHealthCriteria.java new file mode 100644 index 0000000..52ddd54 --- /dev/null +++ b/src/minecraft/net/minecraft/scoreboard/ScoreHealthCriteria.java @@ -0,0 +1,40 @@ +package net.minecraft.scoreboard; + +import java.util.List; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.MathHelper; + +public class ScoreHealthCriteria extends ScoreDummyCriteria +{ + public ScoreHealthCriteria(String name) + { + super(name); + } + + public int func_96635_a(List p_96635_1_) + { + float f = 0.0F; + + for (EntityPlayer entityplayer : p_96635_1_) + { + f += entityplayer.getHealth() + entityplayer.getAbsorptionAmount(); + } + + if (p_96635_1_.size() > 0) + { + f /= (float)p_96635_1_.size(); + } + + return MathHelper.ceiling_float_int(f); + } + + public boolean isReadOnly() + { + return true; + } + + public IScoreObjectiveCriteria.EnumRenderType getRenderType() + { + return IScoreObjectiveCriteria.EnumRenderType.HEARTS; + } +} diff --git a/src/minecraft/net/minecraft/scoreboard/ScoreObjective.java b/src/minecraft/net/minecraft/scoreboard/ScoreObjective.java new file mode 100644 index 0000000..e28e9c5 --- /dev/null +++ b/src/minecraft/net/minecraft/scoreboard/ScoreObjective.java @@ -0,0 +1,58 @@ +package net.minecraft.scoreboard; + +public class ScoreObjective +{ + private final Scoreboard theScoreboard; + private final String name; + + /** The ScoreObjectiveCriteria for this objetive */ + private final IScoreObjectiveCriteria objectiveCriteria; + private IScoreObjectiveCriteria.EnumRenderType renderType; + private String displayName; + + public ScoreObjective(Scoreboard theScoreboardIn, String nameIn, IScoreObjectiveCriteria objectiveCriteriaIn) + { + this.theScoreboard = theScoreboardIn; + this.name = nameIn; + this.objectiveCriteria = objectiveCriteriaIn; + this.displayName = nameIn; + this.renderType = objectiveCriteriaIn.getRenderType(); + } + + public Scoreboard getScoreboard() + { + return this.theScoreboard; + } + + public String getName() + { + return this.name; + } + + public IScoreObjectiveCriteria getCriteria() + { + return this.objectiveCriteria; + } + + public String getDisplayName() + { + return this.displayName; + } + + public void setDisplayName(String nameIn) + { + this.displayName = nameIn; + this.theScoreboard.func_96532_b(this); + } + + public IScoreObjectiveCriteria.EnumRenderType getRenderType() + { + return this.renderType; + } + + public void setRenderType(IScoreObjectiveCriteria.EnumRenderType type) + { + this.renderType = type; + this.theScoreboard.func_96532_b(this); + } +} diff --git a/src/minecraft/net/minecraft/scoreboard/ScorePlayerTeam.java b/src/minecraft/net/minecraft/scoreboard/ScorePlayerTeam.java new file mode 100644 index 0000000..bfd5d81 --- /dev/null +++ b/src/minecraft/net/minecraft/scoreboard/ScorePlayerTeam.java @@ -0,0 +1,184 @@ +package net.minecraft.scoreboard; + +import com.google.common.collect.Sets; +import java.util.Collection; +import java.util.Set; +import net.minecraft.util.EnumChatFormatting; + +public class ScorePlayerTeam extends Team +{ + private final Scoreboard theScoreboard; + private final String registeredName; + private final Set membershipSet = Sets.newHashSet(); + private String teamNameSPT; + private String namePrefixSPT = ""; + private String colorSuffix = ""; + private boolean allowFriendlyFire = true; + private boolean canSeeFriendlyInvisibles = true; + private Team.EnumVisible nameTagVisibility = Team.EnumVisible.ALWAYS; + private Team.EnumVisible deathMessageVisibility = Team.EnumVisible.ALWAYS; + private EnumChatFormatting chatFormat = EnumChatFormatting.RESET; + + public ScorePlayerTeam(Scoreboard theScoreboardIn, String name) + { + this.theScoreboard = theScoreboardIn; + this.registeredName = name; + this.teamNameSPT = name; + } + + /** + * Retrieve the name by which this team is registered in the scoreboard + */ + public String getRegisteredName() + { + return this.registeredName; + } + + public String getTeamName() + { + return this.teamNameSPT; + } + + public void setTeamName(String name) + { + if (name == null) + { + throw new IllegalArgumentException("Name cannot be null"); + } + else + { + this.teamNameSPT = name; + this.theScoreboard.sendTeamUpdate(this); + } + } + + public Collection getMembershipCollection() + { + return this.membershipSet; + } + + /** + * Returns the color prefix for the player's team name + */ + public String getColorPrefix() + { + return this.namePrefixSPT; + } + + public void setNamePrefix(String prefix) + { + if (prefix == null) + { + throw new IllegalArgumentException("Prefix cannot be null"); + } + else + { + this.namePrefixSPT = prefix; + this.theScoreboard.sendTeamUpdate(this); + } + } + + /** + * Returns the color suffix for the player's team name + */ + public String getColorSuffix() + { + return this.colorSuffix; + } + + public void setNameSuffix(String suffix) + { + this.colorSuffix = suffix; + this.theScoreboard.sendTeamUpdate(this); + } + + public String formatString(String input) + { + return this.getColorPrefix() + input + this.getColorSuffix(); + } + + /** + * Returns the player name including the color prefixes and suffixes + */ + public static String formatPlayerName(Team p_96667_0_, String p_96667_1_) + { + return p_96667_0_ == null ? p_96667_1_ : p_96667_0_.formatString(p_96667_1_); + } + + public boolean getAllowFriendlyFire() + { + return this.allowFriendlyFire; + } + + public void setAllowFriendlyFire(boolean friendlyFire) + { + this.allowFriendlyFire = friendlyFire; + this.theScoreboard.sendTeamUpdate(this); + } + + public boolean getSeeFriendlyInvisiblesEnabled() + { + return this.canSeeFriendlyInvisibles; + } + + public void setSeeFriendlyInvisiblesEnabled(boolean friendlyInvisibles) + { + this.canSeeFriendlyInvisibles = friendlyInvisibles; + this.theScoreboard.sendTeamUpdate(this); + } + + public Team.EnumVisible getNameTagVisibility() + { + return this.nameTagVisibility; + } + + public Team.EnumVisible getDeathMessageVisibility() + { + return this.deathMessageVisibility; + } + + public void setNameTagVisibility(Team.EnumVisible p_178772_1_) + { + this.nameTagVisibility = p_178772_1_; + this.theScoreboard.sendTeamUpdate(this); + } + + public void setDeathMessageVisibility(Team.EnumVisible p_178773_1_) + { + this.deathMessageVisibility = p_178773_1_; + this.theScoreboard.sendTeamUpdate(this); + } + + public int func_98299_i() + { + int i = 0; + + if (this.getAllowFriendlyFire()) + { + i |= 1; + } + + if (this.getSeeFriendlyInvisiblesEnabled()) + { + i |= 2; + } + + return i; + } + + public void func_98298_a(int p_98298_1_) + { + this.setAllowFriendlyFire((p_98298_1_ & 1) > 0); + this.setSeeFriendlyInvisiblesEnabled((p_98298_1_ & 2) > 0); + } + + public void setChatFormat(EnumChatFormatting p_178774_1_) + { + this.chatFormat = p_178774_1_; + } + + public EnumChatFormatting getChatFormat() + { + return this.chatFormat; + } +} diff --git a/src/minecraft/net/minecraft/scoreboard/Scoreboard.java b/src/minecraft/net/minecraft/scoreboard/Scoreboard.java new file mode 100644 index 0000000..b0d84a8 --- /dev/null +++ b/src/minecraft/net/minecraft/scoreboard/Scoreboard.java @@ -0,0 +1,518 @@ +package net.minecraft.scoreboard; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.EnumChatFormatting; + +public class Scoreboard +{ + private final Map scoreObjectives = Maps.newHashMap(); + private final Map> scoreObjectiveCriterias = Maps.>newHashMap(); + private final Map> entitiesScoreObjectives = Maps.>newHashMap(); + + /** Index 0 is tab menu, 1 is sidebar, and 2 is below name */ + private final ScoreObjective[] objectiveDisplaySlots = new ScoreObjective[19]; + private final Map teams = Maps.newHashMap(); + private final Map teamMemberships = Maps.newHashMap(); + private static String[] field_178823_g = null; + + /** + * Returns a ScoreObjective for the objective name + */ + public ScoreObjective getObjective(String name) + { + return (ScoreObjective)this.scoreObjectives.get(name); + } + + /** + * Create and returns the score objective for the given name and ScoreCriteria + */ + public ScoreObjective addScoreObjective(String name, IScoreObjectiveCriteria criteria) + { + if (name.length() > 16) + { + throw new IllegalArgumentException("The objective name \'" + name + "\' is too long!"); + } + else + { + ScoreObjective scoreobjective = this.getObjective(name); + + if (scoreobjective != null) + { + throw new IllegalArgumentException("An objective with the name \'" + name + "\' already exists!"); + } + else + { + scoreobjective = new ScoreObjective(this, name, criteria); + List list = (List)this.scoreObjectiveCriterias.get(criteria); + + if (list == null) + { + list = Lists.newArrayList(); + this.scoreObjectiveCriterias.put(criteria, list); + } + + list.add(scoreobjective); + this.scoreObjectives.put(name, scoreobjective); + this.onScoreObjectiveAdded(scoreobjective); + return scoreobjective; + } + } + } + + public Collection getObjectivesFromCriteria(IScoreObjectiveCriteria criteria) + { + Collection collection = (Collection)this.scoreObjectiveCriterias.get(criteria); + return collection == null ? Lists.newArrayList() : Lists.newArrayList(collection); + } + + /** + * Returns if the entity has the given ScoreObjective + */ + public boolean entityHasObjective(String name, ScoreObjective p_178819_2_) + { + Map map = (Map)this.entitiesScoreObjectives.get(name); + + if (map == null) + { + return false; + } + else + { + Score score = (Score)map.get(p_178819_2_); + return score != null; + } + } + + /** + * Returns the value of the given objective for the given entity name + */ + public Score getValueFromObjective(String name, ScoreObjective objective) + { + if (name.length() > 40) + { + throw new IllegalArgumentException("The player name \'" + name + "\' is too long!"); + } + else + { + Map map = (Map)this.entitiesScoreObjectives.get(name); + + if (map == null) + { + map = Maps.newHashMap(); + this.entitiesScoreObjectives.put(name, map); + } + + Score score = (Score)map.get(objective); + + if (score == null) + { + score = new Score(this, objective, name); + map.put(objective, score); + } + + return score; + } + } + + public Collection getSortedScores(ScoreObjective objective) + { + List list = Lists.newArrayList(); + + for (Map map : this.entitiesScoreObjectives.values()) + { + Score score = (Score)map.get(objective); + + if (score != null) + { + list.add(score); + } + } + + Collections.sort(list, Score.scoreComparator); + return list; + } + + public Collection getScoreObjectives() + { + return this.scoreObjectives.values(); + } + + public Collection getObjectiveNames() + { + return this.entitiesScoreObjectives.keySet(); + } + + /** + * Remove the given ScoreObjective for the given Entity name. + */ + public void removeObjectiveFromEntity(String name, ScoreObjective objective) + { + if (objective == null) + { + Map map = (Map)this.entitiesScoreObjectives.remove(name); + + if (map != null) + { + this.func_96516_a(name); + } + } + else + { + Map map2 = (Map)this.entitiesScoreObjectives.get(name); + + if (map2 != null) + { + Score score = (Score)map2.remove(objective); + + if (map2.size() < 1) + { + Map map1 = (Map)this.entitiesScoreObjectives.remove(name); + + if (map1 != null) + { + this.func_96516_a(name); + } + } + else if (score != null) + { + this.func_178820_a(name, objective); + } + } + } + } + + public Collection getScores() + { + Collection> collection = this.entitiesScoreObjectives.values(); + List list = Lists.newArrayList(); + + for (Map map : collection) + { + list.addAll(map.values()); + } + + return list; + } + + public Map getObjectivesForEntity(String name) + { + Map map = (Map)this.entitiesScoreObjectives.get(name); + + if (map == null) + { + map = Maps.newHashMap(); + } + + return map; + } + + public void removeObjective(ScoreObjective p_96519_1_) + { + this.scoreObjectives.remove(p_96519_1_.getName()); + + for (int i = 0; i < 19; ++i) + { + if (this.getObjectiveInDisplaySlot(i) == p_96519_1_) + { + this.setObjectiveInDisplaySlot(i, (ScoreObjective)null); + } + } + + List list = (List)this.scoreObjectiveCriterias.get(p_96519_1_.getCriteria()); + + if (list != null) + { + list.remove(p_96519_1_); + } + + for (Map map : this.entitiesScoreObjectives.values()) + { + map.remove(p_96519_1_); + } + + this.func_96533_c(p_96519_1_); + } + + /** + * 0 is tab menu, 1 is sidebar, 2 is below name + */ + public void setObjectiveInDisplaySlot(int p_96530_1_, ScoreObjective p_96530_2_) + { + this.objectiveDisplaySlots[p_96530_1_] = p_96530_2_; + } + + /** + * 0 is tab menu, 1 is sidebar, 2 is below name + */ + public ScoreObjective getObjectiveInDisplaySlot(int p_96539_1_) + { + return this.objectiveDisplaySlots[p_96539_1_]; + } + + /** + * Retrieve the ScorePlayerTeam instance identified by the passed team name + */ + public ScorePlayerTeam getTeam(String p_96508_1_) + { + return (ScorePlayerTeam)this.teams.get(p_96508_1_); + } + + public ScorePlayerTeam createTeam(String p_96527_1_) + { + if (p_96527_1_.length() > 16) + { + throw new IllegalArgumentException("The team name \'" + p_96527_1_ + "\' is too long!"); + } + else + { + ScorePlayerTeam scoreplayerteam = this.getTeam(p_96527_1_); + + if (scoreplayerteam != null) + { + throw new IllegalArgumentException("A team with the name \'" + p_96527_1_ + "\' already exists!"); + } + else + { + scoreplayerteam = new ScorePlayerTeam(this, p_96527_1_); + this.teams.put(p_96527_1_, scoreplayerteam); + this.broadcastTeamCreated(scoreplayerteam); + return scoreplayerteam; + } + } + } + + /** + * Removes the team from the scoreboard, updates all player memberships and broadcasts the deletion to all players + */ + public void removeTeam(ScorePlayerTeam p_96511_1_) + { + this.teams.remove(p_96511_1_.getRegisteredName()); + + for (String s : p_96511_1_.getMembershipCollection()) + { + this.teamMemberships.remove(s); + } + + this.func_96513_c(p_96511_1_); + } + + /** + * Adds a player to the given team + */ + public boolean addPlayerToTeam(String player, String newTeam) + { + if (player.length() > 40) + { + throw new IllegalArgumentException("The player name \'" + player + "\' is too long!"); + } + else if (!this.teams.containsKey(newTeam)) + { + return false; + } + else + { + ScorePlayerTeam scoreplayerteam = this.getTeam(newTeam); + + if (this.getPlayersTeam(player) != null) + { + this.removePlayerFromTeams(player); + } + + this.teamMemberships.put(player, scoreplayerteam); + scoreplayerteam.getMembershipCollection().add(player); + return true; + } + } + + public boolean removePlayerFromTeams(String p_96524_1_) + { + ScorePlayerTeam scoreplayerteam = this.getPlayersTeam(p_96524_1_); + + if (scoreplayerteam != null) + { + this.removePlayerFromTeam(p_96524_1_, scoreplayerteam); + return true; + } + else + { + return false; + } + } + + /** + * Removes the given username from the given ScorePlayerTeam. If the player is not on the team then an + * IllegalStateException is thrown. + */ + public void removePlayerFromTeam(String p_96512_1_, ScorePlayerTeam p_96512_2_) + { + if (this.getPlayersTeam(p_96512_1_) != p_96512_2_) + { + throw new IllegalStateException("Player is either on another team or not on any team. Cannot remove from team \'" + p_96512_2_.getRegisteredName() + "\'."); + } + else + { + this.teamMemberships.remove(p_96512_1_); + p_96512_2_.getMembershipCollection().remove(p_96512_1_); + } + } + + public Collection getTeamNames() + { + return this.teams.keySet(); + } + + public Collection getTeams() + { + return this.teams.values(); + } + + /** + * Gets the ScorePlayerTeam object for the given username. + */ + public ScorePlayerTeam getPlayersTeam(String p_96509_1_) + { + return (ScorePlayerTeam)this.teamMemberships.get(p_96509_1_); + } + + /** + * Called when a score objective is added + */ + public void onScoreObjectiveAdded(ScoreObjective scoreObjectiveIn) + { + } + + public void func_96532_b(ScoreObjective p_96532_1_) + { + } + + public void func_96533_c(ScoreObjective p_96533_1_) + { + } + + public void func_96536_a(Score p_96536_1_) + { + } + + public void func_96516_a(String p_96516_1_) + { + } + + public void func_178820_a(String p_178820_1_, ScoreObjective p_178820_2_) + { + } + + /** + * This packet will notify the players that this team is created, and that will register it on the client + */ + public void broadcastTeamCreated(ScorePlayerTeam playerTeam) + { + } + + /** + * This packet will notify the players that this team is updated + */ + public void sendTeamUpdate(ScorePlayerTeam playerTeam) + { + } + + public void func_96513_c(ScorePlayerTeam playerTeam) + { + } + + /** + * Returns 'list' for 0, 'sidebar' for 1, 'belowName for 2, otherwise null. + */ + public static String getObjectiveDisplaySlot(int p_96517_0_) + { + switch (p_96517_0_) + { + case 0: + return "list"; + + case 1: + return "sidebar"; + + case 2: + return "belowName"; + + default: + if (p_96517_0_ >= 3 && p_96517_0_ <= 18) + { + EnumChatFormatting enumchatformatting = EnumChatFormatting.func_175744_a(p_96517_0_ - 3); + + if (enumchatformatting != null && enumchatformatting != EnumChatFormatting.RESET) + { + return "sidebar.team." + enumchatformatting.getFriendlyName(); + } + } + + return null; + } + } + + /** + * Returns 0 for (case-insensitive) 'list', 1 for 'sidebar', 2 for 'belowName', otherwise -1. + */ + public static int getObjectiveDisplaySlotNumber(String p_96537_0_) + { + if (p_96537_0_.equalsIgnoreCase("list")) + { + return 0; + } + else if (p_96537_0_.equalsIgnoreCase("sidebar")) + { + return 1; + } + else if (p_96537_0_.equalsIgnoreCase("belowName")) + { + return 2; + } + else + { + if (p_96537_0_.startsWith("sidebar.team.")) + { + String s = p_96537_0_.substring("sidebar.team.".length()); + EnumChatFormatting enumchatformatting = EnumChatFormatting.getValueByName(s); + + if (enumchatformatting != null && enumchatformatting.getColorIndex() >= 0) + { + return enumchatformatting.getColorIndex() + 3; + } + } + + return -1; + } + } + + public static String[] getDisplaySlotStrings() + { + if (field_178823_g == null) + { + field_178823_g = new String[19]; + + for (int i = 0; i < 19; ++i) + { + field_178823_g[i] = getObjectiveDisplaySlot(i); + } + } + + return field_178823_g; + } + + public void func_181140_a(Entity p_181140_1_) + { + if (p_181140_1_ != null && !(p_181140_1_ instanceof EntityPlayer) && !p_181140_1_.isEntityAlive()) + { + String s = p_181140_1_.getUniqueID().toString(); + this.removeObjectiveFromEntity(s, (ScoreObjective)null); + this.removePlayerFromTeams(s); + } + } +} diff --git a/src/minecraft/net/minecraft/scoreboard/ScoreboardSaveData.java b/src/minecraft/net/minecraft/scoreboard/ScoreboardSaveData.java new file mode 100644 index 0000000..4f1fe56 --- /dev/null +++ b/src/minecraft/net/minecraft/scoreboard/ScoreboardSaveData.java @@ -0,0 +1,308 @@ +package net.minecraft.scoreboard; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.WorldSavedData; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ScoreboardSaveData extends WorldSavedData +{ + private static final Logger logger = LogManager.getLogger(); + private Scoreboard theScoreboard; + private NBTTagCompound delayedInitNbt; + + public ScoreboardSaveData() + { + this("scoreboard"); + } + + public ScoreboardSaveData(String name) + { + super(name); + } + + public void setScoreboard(Scoreboard scoreboardIn) + { + this.theScoreboard = scoreboardIn; + + if (this.delayedInitNbt != null) + { + this.readFromNBT(this.delayedInitNbt); + } + } + + /** + * reads in data from the NBTTagCompound into this MapDataBase + */ + public void readFromNBT(NBTTagCompound nbt) + { + if (this.theScoreboard == null) + { + this.delayedInitNbt = nbt; + } + else + { + this.readObjectives(nbt.getTagList("Objectives", 10)); + this.readScores(nbt.getTagList("PlayerScores", 10)); + + if (nbt.hasKey("DisplaySlots", 10)) + { + this.readDisplayConfig(nbt.getCompoundTag("DisplaySlots")); + } + + if (nbt.hasKey("Teams", 9)) + { + this.readTeams(nbt.getTagList("Teams", 10)); + } + } + } + + protected void readTeams(NBTTagList p_96498_1_) + { + for (int i = 0; i < p_96498_1_.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = p_96498_1_.getCompoundTagAt(i); + String s = nbttagcompound.getString("Name"); + + if (s.length() > 16) + { + s = s.substring(0, 16); + } + + ScorePlayerTeam scoreplayerteam = this.theScoreboard.createTeam(s); + String s1 = nbttagcompound.getString("DisplayName"); + + if (s1.length() > 32) + { + s1 = s1.substring(0, 32); + } + + scoreplayerteam.setTeamName(s1); + + if (nbttagcompound.hasKey("TeamColor", 8)) + { + scoreplayerteam.setChatFormat(EnumChatFormatting.getValueByName(nbttagcompound.getString("TeamColor"))); + } + + scoreplayerteam.setNamePrefix(nbttagcompound.getString("Prefix")); + scoreplayerteam.setNameSuffix(nbttagcompound.getString("Suffix")); + + if (nbttagcompound.hasKey("AllowFriendlyFire", 99)) + { + scoreplayerteam.setAllowFriendlyFire(nbttagcompound.getBoolean("AllowFriendlyFire")); + } + + if (nbttagcompound.hasKey("SeeFriendlyInvisibles", 99)) + { + scoreplayerteam.setSeeFriendlyInvisiblesEnabled(nbttagcompound.getBoolean("SeeFriendlyInvisibles")); + } + + if (nbttagcompound.hasKey("NameTagVisibility", 8)) + { + Team.EnumVisible team$enumvisible = Team.EnumVisible.func_178824_a(nbttagcompound.getString("NameTagVisibility")); + + if (team$enumvisible != null) + { + scoreplayerteam.setNameTagVisibility(team$enumvisible); + } + } + + if (nbttagcompound.hasKey("DeathMessageVisibility", 8)) + { + Team.EnumVisible team$enumvisible1 = Team.EnumVisible.func_178824_a(nbttagcompound.getString("DeathMessageVisibility")); + + if (team$enumvisible1 != null) + { + scoreplayerteam.setDeathMessageVisibility(team$enumvisible1); + } + } + + this.func_96502_a(scoreplayerteam, nbttagcompound.getTagList("Players", 8)); + } + } + + protected void func_96502_a(ScorePlayerTeam p_96502_1_, NBTTagList p_96502_2_) + { + for (int i = 0; i < p_96502_2_.tagCount(); ++i) + { + this.theScoreboard.addPlayerToTeam(p_96502_2_.getStringTagAt(i), p_96502_1_.getRegisteredName()); + } + } + + protected void readDisplayConfig(NBTTagCompound p_96504_1_) + { + for (int i = 0; i < 19; ++i) + { + if (p_96504_1_.hasKey("slot_" + i, 8)) + { + String s = p_96504_1_.getString("slot_" + i); + ScoreObjective scoreobjective = this.theScoreboard.getObjective(s); + this.theScoreboard.setObjectiveInDisplaySlot(i, scoreobjective); + } + } + } + + protected void readObjectives(NBTTagList nbt) + { + for (int i = 0; i < nbt.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbt.getCompoundTagAt(i); + IScoreObjectiveCriteria iscoreobjectivecriteria = (IScoreObjectiveCriteria)IScoreObjectiveCriteria.INSTANCES.get(nbttagcompound.getString("CriteriaName")); + + if (iscoreobjectivecriteria != null) + { + String s = nbttagcompound.getString("Name"); + + if (s.length() > 16) + { + s = s.substring(0, 16); + } + + ScoreObjective scoreobjective = this.theScoreboard.addScoreObjective(s, iscoreobjectivecriteria); + scoreobjective.setDisplayName(nbttagcompound.getString("DisplayName")); + scoreobjective.setRenderType(IScoreObjectiveCriteria.EnumRenderType.func_178795_a(nbttagcompound.getString("RenderType"))); + } + } + } + + protected void readScores(NBTTagList nbt) + { + for (int i = 0; i < nbt.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbt.getCompoundTagAt(i); + ScoreObjective scoreobjective = this.theScoreboard.getObjective(nbttagcompound.getString("Objective")); + String s = nbttagcompound.getString("Name"); + + if (s.length() > 40) + { + s = s.substring(0, 40); + } + + Score score = this.theScoreboard.getValueFromObjective(s, scoreobjective); + score.setScorePoints(nbttagcompound.getInteger("Score")); + + if (nbttagcompound.hasKey("Locked")) + { + score.setLocked(nbttagcompound.getBoolean("Locked")); + } + } + } + + /** + * write data to NBTTagCompound from this MapDataBase, similar to Entities and TileEntities + */ + public void writeToNBT(NBTTagCompound nbt) + { + if (this.theScoreboard == null) + { + logger.warn("Tried to save scoreboard without having a scoreboard..."); + } + else + { + nbt.setTag("Objectives", this.objectivesToNbt()); + nbt.setTag("PlayerScores", this.scoresToNbt()); + nbt.setTag("Teams", this.func_96496_a()); + this.func_96497_d(nbt); + } + } + + protected NBTTagList func_96496_a() + { + NBTTagList nbttaglist = new NBTTagList(); + + for (ScorePlayerTeam scoreplayerteam : this.theScoreboard.getTeams()) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("Name", scoreplayerteam.getRegisteredName()); + nbttagcompound.setString("DisplayName", scoreplayerteam.getTeamName()); + + if (scoreplayerteam.getChatFormat().getColorIndex() >= 0) + { + nbttagcompound.setString("TeamColor", scoreplayerteam.getChatFormat().getFriendlyName()); + } + + nbttagcompound.setString("Prefix", scoreplayerteam.getColorPrefix()); + nbttagcompound.setString("Suffix", scoreplayerteam.getColorSuffix()); + nbttagcompound.setBoolean("AllowFriendlyFire", scoreplayerteam.getAllowFriendlyFire()); + nbttagcompound.setBoolean("SeeFriendlyInvisibles", scoreplayerteam.getSeeFriendlyInvisiblesEnabled()); + nbttagcompound.setString("NameTagVisibility", scoreplayerteam.getNameTagVisibility().field_178830_e); + nbttagcompound.setString("DeathMessageVisibility", scoreplayerteam.getDeathMessageVisibility().field_178830_e); + NBTTagList nbttaglist1 = new NBTTagList(); + + for (String s : scoreplayerteam.getMembershipCollection()) + { + nbttaglist1.appendTag(new NBTTagString(s)); + } + + nbttagcompound.setTag("Players", nbttaglist1); + nbttaglist.appendTag(nbttagcompound); + } + + return nbttaglist; + } + + protected void func_96497_d(NBTTagCompound p_96497_1_) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + boolean flag = false; + + for (int i = 0; i < 19; ++i) + { + ScoreObjective scoreobjective = this.theScoreboard.getObjectiveInDisplaySlot(i); + + if (scoreobjective != null) + { + nbttagcompound.setString("slot_" + i, scoreobjective.getName()); + flag = true; + } + } + + if (flag) + { + p_96497_1_.setTag("DisplaySlots", nbttagcompound); + } + } + + protected NBTTagList objectivesToNbt() + { + NBTTagList nbttaglist = new NBTTagList(); + + for (ScoreObjective scoreobjective : this.theScoreboard.getScoreObjectives()) + { + if (scoreobjective.getCriteria() != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("Name", scoreobjective.getName()); + nbttagcompound.setString("CriteriaName", scoreobjective.getCriteria().getName()); + nbttagcompound.setString("DisplayName", scoreobjective.getDisplayName()); + nbttagcompound.setString("RenderType", scoreobjective.getRenderType().func_178796_a()); + nbttaglist.appendTag(nbttagcompound); + } + } + + return nbttaglist; + } + + protected NBTTagList scoresToNbt() + { + NBTTagList nbttaglist = new NBTTagList(); + + for (Score score : this.theScoreboard.getScores()) + { + if (score.getObjective() != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("Name", score.getPlayerName()); + nbttagcompound.setString("Objective", score.getObjective().getName()); + nbttagcompound.setInteger("Score", score.getScorePoints()); + nbttagcompound.setBoolean("Locked", score.isLocked()); + nbttaglist.appendTag(nbttagcompound); + } + } + + return nbttaglist; + } +} diff --git a/src/minecraft/net/minecraft/scoreboard/ServerScoreboard.java b/src/minecraft/net/minecraft/scoreboard/ServerScoreboard.java new file mode 100644 index 0000000..30db8a2 --- /dev/null +++ b/src/minecraft/net/minecraft/scoreboard/ServerScoreboard.java @@ -0,0 +1,271 @@ +package net.minecraft.scoreboard; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S3BPacketScoreboardObjective; +import net.minecraft.network.play.server.S3CPacketUpdateScore; +import net.minecraft.network.play.server.S3DPacketDisplayScoreboard; +import net.minecraft.network.play.server.S3EPacketTeams; +import net.minecraft.server.MinecraftServer; + +public class ServerScoreboard extends Scoreboard +{ + private final MinecraftServer scoreboardMCServer; + private final Set field_96553_b = Sets.newHashSet(); + private ScoreboardSaveData scoreboardSaveData; + + public ServerScoreboard(MinecraftServer mcServer) + { + this.scoreboardMCServer = mcServer; + } + + public void func_96536_a(Score p_96536_1_) + { + super.func_96536_a(p_96536_1_); + + if (this.field_96553_b.contains(p_96536_1_.getObjective())) + { + this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3CPacketUpdateScore(p_96536_1_)); + } + + this.func_96551_b(); + } + + public void func_96516_a(String p_96516_1_) + { + super.func_96516_a(p_96516_1_); + this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3CPacketUpdateScore(p_96516_1_)); + this.func_96551_b(); + } + + public void func_178820_a(String p_178820_1_, ScoreObjective p_178820_2_) + { + super.func_178820_a(p_178820_1_, p_178820_2_); + this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3CPacketUpdateScore(p_178820_1_, p_178820_2_)); + this.func_96551_b(); + } + + /** + * 0 is tab menu, 1 is sidebar, 2 is below name + */ + public void setObjectiveInDisplaySlot(int p_96530_1_, ScoreObjective p_96530_2_) + { + ScoreObjective scoreobjective = this.getObjectiveInDisplaySlot(p_96530_1_); + super.setObjectiveInDisplaySlot(p_96530_1_, p_96530_2_); + + if (scoreobjective != p_96530_2_ && scoreobjective != null) + { + if (this.func_96552_h(scoreobjective) > 0) + { + this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3DPacketDisplayScoreboard(p_96530_1_, p_96530_2_)); + } + else + { + this.getPlayerIterator(scoreobjective); + } + } + + if (p_96530_2_ != null) + { + if (this.field_96553_b.contains(p_96530_2_)) + { + this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3DPacketDisplayScoreboard(p_96530_1_, p_96530_2_)); + } + else + { + this.func_96549_e(p_96530_2_); + } + } + + this.func_96551_b(); + } + + /** + * Adds a player to the given team + */ + public boolean addPlayerToTeam(String player, String newTeam) + { + if (super.addPlayerToTeam(player, newTeam)) + { + ScorePlayerTeam scoreplayerteam = this.getTeam(newTeam); + this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3EPacketTeams(scoreplayerteam, Arrays.asList(new String[] {player}), 3)); + this.func_96551_b(); + return true; + } + else + { + return false; + } + } + + /** + * Removes the given username from the given ScorePlayerTeam. If the player is not on the team then an + * IllegalStateException is thrown. + */ + public void removePlayerFromTeam(String p_96512_1_, ScorePlayerTeam p_96512_2_) + { + super.removePlayerFromTeam(p_96512_1_, p_96512_2_); + this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3EPacketTeams(p_96512_2_, Arrays.asList(new String[] {p_96512_1_}), 4)); + this.func_96551_b(); + } + + /** + * Called when a score objective is added + */ + public void onScoreObjectiveAdded(ScoreObjective scoreObjectiveIn) + { + super.onScoreObjectiveAdded(scoreObjectiveIn); + this.func_96551_b(); + } + + public void func_96532_b(ScoreObjective p_96532_1_) + { + super.func_96532_b(p_96532_1_); + + if (this.field_96553_b.contains(p_96532_1_)) + { + this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3BPacketScoreboardObjective(p_96532_1_, 2)); + } + + this.func_96551_b(); + } + + public void func_96533_c(ScoreObjective p_96533_1_) + { + super.func_96533_c(p_96533_1_); + + if (this.field_96553_b.contains(p_96533_1_)) + { + this.getPlayerIterator(p_96533_1_); + } + + this.func_96551_b(); + } + + /** + * This packet will notify the players that this team is created, and that will register it on the client + */ + public void broadcastTeamCreated(ScorePlayerTeam playerTeam) + { + super.broadcastTeamCreated(playerTeam); + this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3EPacketTeams(playerTeam, 0)); + this.func_96551_b(); + } + + /** + * This packet will notify the players that this team is updated + */ + public void sendTeamUpdate(ScorePlayerTeam playerTeam) + { + super.sendTeamUpdate(playerTeam); + this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3EPacketTeams(playerTeam, 2)); + this.func_96551_b(); + } + + public void func_96513_c(ScorePlayerTeam playerTeam) + { + super.func_96513_c(playerTeam); + this.scoreboardMCServer.getConfigurationManager().sendPacketToAllPlayers(new S3EPacketTeams(playerTeam, 1)); + this.func_96551_b(); + } + + public void func_96547_a(ScoreboardSaveData p_96547_1_) + { + this.scoreboardSaveData = p_96547_1_; + } + + protected void func_96551_b() + { + if (this.scoreboardSaveData != null) + { + this.scoreboardSaveData.markDirty(); + } + } + + public List func_96550_d(ScoreObjective p_96550_1_) + { + List list = Lists.newArrayList(); + list.add(new S3BPacketScoreboardObjective(p_96550_1_, 0)); + + for (int i = 0; i < 19; ++i) + { + if (this.getObjectiveInDisplaySlot(i) == p_96550_1_) + { + list.add(new S3DPacketDisplayScoreboard(i, p_96550_1_)); + } + } + + for (Score score : this.getSortedScores(p_96550_1_)) + { + list.add(new S3CPacketUpdateScore(score)); + } + + return list; + } + + public void func_96549_e(ScoreObjective p_96549_1_) + { + List list = this.func_96550_d(p_96549_1_); + + for (EntityPlayerMP entityplayermp : this.scoreboardMCServer.getConfigurationManager().func_181057_v()) + { + for (Packet packet : list) + { + entityplayermp.playerNetServerHandler.sendPacket(packet); + } + } + + this.field_96553_b.add(p_96549_1_); + } + + public List func_96548_f(ScoreObjective p_96548_1_) + { + List list = Lists.newArrayList(); + list.add(new S3BPacketScoreboardObjective(p_96548_1_, 1)); + + for (int i = 0; i < 19; ++i) + { + if (this.getObjectiveInDisplaySlot(i) == p_96548_1_) + { + list.add(new S3DPacketDisplayScoreboard(i, p_96548_1_)); + } + } + + return list; + } + + public void getPlayerIterator(ScoreObjective p_96546_1_) + { + List list = this.func_96548_f(p_96546_1_); + + for (EntityPlayerMP entityplayermp : this.scoreboardMCServer.getConfigurationManager().func_181057_v()) + { + for (Packet packet : list) + { + entityplayermp.playerNetServerHandler.sendPacket(packet); + } + } + + this.field_96553_b.remove(p_96546_1_); + } + + public int func_96552_h(ScoreObjective p_96552_1_) + { + int i = 0; + + for (int j = 0; j < 19; ++j) + { + if (this.getObjectiveInDisplaySlot(j) == p_96552_1_) + { + ++i; + } + } + + return i; + } +} diff --git a/src/minecraft/net/minecraft/scoreboard/Team.java b/src/minecraft/net/minecraft/scoreboard/Team.java new file mode 100644 index 0000000..c598527 --- /dev/null +++ b/src/minecraft/net/minecraft/scoreboard/Team.java @@ -0,0 +1,68 @@ +package net.minecraft.scoreboard; + +import com.google.common.collect.Maps; +import java.util.Collection; +import java.util.Map; + +public abstract class Team +{ + /** + * Same as == + */ + public boolean isSameTeam(Team other) + { + return other == null ? false : this == other; + } + + /** + * Retrieve the name by which this team is registered in the scoreboard + */ + public abstract String getRegisteredName(); + + public abstract String formatString(String input); + + public abstract boolean getSeeFriendlyInvisiblesEnabled(); + + public abstract boolean getAllowFriendlyFire(); + + public abstract Team.EnumVisible getNameTagVisibility(); + + public abstract Collection getMembershipCollection(); + + public abstract Team.EnumVisible getDeathMessageVisibility(); + + public static enum EnumVisible + { + ALWAYS("always", 0), + NEVER("never", 1), + HIDE_FOR_OTHER_TEAMS("hideForOtherTeams", 2), + HIDE_FOR_OWN_TEAM("hideForOwnTeam", 3); + + private static Map field_178828_g = Maps.newHashMap(); + public final String field_178830_e; + public final int field_178827_f; + + public static String[] func_178825_a() + { + return (String[])field_178828_g.keySet().toArray(new String[field_178828_g.size()]); + } + + public static Team.EnumVisible func_178824_a(String p_178824_0_) + { + return (Team.EnumVisible)field_178828_g.get(p_178824_0_); + } + + private EnumVisible(String p_i45550_3_, int p_i45550_4_) + { + this.field_178830_e = p_i45550_3_; + this.field_178827_f = p_i45550_4_; + } + + static { + for (Team.EnumVisible team$enumvisible : values()) + { + field_178828_g.put(team$enumvisible.field_178830_e, team$enumvisible); + } + } + } +} diff --git a/src/minecraft/net/minecraft/server/MinecraftServer.java b/src/minecraft/net/minecraft/server/MinecraftServer.java new file mode 100644 index 0000000..1a46d3f --- /dev/null +++ b/src/minecraft/net/minecraft/server/MinecraftServer.java @@ -0,0 +1,1546 @@ +package net.minecraft.server; + +import com.google.common.base.Charsets; +import com.google.common.collect.Lists; +import com.google.common.collect.Queues; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListenableFutureTask; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.GameProfileRepository; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; + +import animeware.event.impl.WorldUnloadEvent; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufOutputStream; +import io.netty.buffer.Unpooled; +import io.netty.handler.codec.base64.Base64; +import java.awt.GraphicsEnvironment; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.Proxy; +import java.security.KeyPair; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Queue; +import java.util.Random; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.Executors; +import java.util.concurrent.FutureTask; +import javax.imageio.ImageIO; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandResultStats; +import net.minecraft.command.ICommandManager; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.ServerCommandManager; +import net.minecraft.crash.CrashReport; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.NetworkSystem; +import net.minecraft.network.ServerStatusResponse; +import net.minecraft.network.play.server.S03PacketTimeUpdate; +import net.minecraft.profiler.IPlayerUsage; +import net.minecraft.profiler.PlayerUsageSnooper; +import net.minecraft.profiler.Profiler; +import net.minecraft.server.management.PlayerProfileCache; +import net.minecraft.server.management.ServerConfigurationManager; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.IThreadListener; +import net.minecraft.util.ITickable; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ReportedException; +import net.minecraft.util.Util; +import net.minecraft.util.Vec3; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.World; +import net.minecraft.world.WorldManager; +import net.minecraft.world.WorldServer; +import net.minecraft.world.WorldServerMulti; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.WorldType; +import net.minecraft.world.chunk.storage.AnvilSaveConverter; +import net.minecraft.world.demo.DemoWorldServer; +import net.minecraft.world.storage.ISaveFormat; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; +import org.apache.commons.lang3.Validate; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public abstract class MinecraftServer implements Runnable, ICommandSender, IThreadListener, IPlayerUsage +{ + private static final Logger logger = LogManager.getLogger(); + public static final File USER_CACHE_FILE = new File("usercache.json"); + + /** Instance of Minecraft Server. */ + private static MinecraftServer mcServer; + private final ISaveFormat anvilConverterForAnvilFile; + + /** The PlayerUsageSnooper instance. */ + private final PlayerUsageSnooper usageSnooper = new PlayerUsageSnooper("server", this, getCurrentTimeMillis()); + private final File anvilFile; + private final List playersOnline = Lists.newArrayList(); + protected final ICommandManager commandManager; + public final Profiler theProfiler = new Profiler(); + private final NetworkSystem networkSystem; + private final ServerStatusResponse statusResponse = new ServerStatusResponse(); + private final Random random = new Random(); + + /** The server's port. */ + private int serverPort = -1; + + /** The server world instances. */ + public WorldServer[] worldServers; + + /** The ServerConfigurationManager instance. */ + private ServerConfigurationManager serverConfigManager; + + /** + * Indicates whether the server is running or not. Set to false to initiate a shutdown. + */ + private boolean serverRunning = true; + + /** Indicates to other classes that the server is safely stopped. */ + private boolean serverStopped; + + /** Incremented every tick. */ + private int tickCounter; + protected final Proxy serverProxy; + + /** + * The task the server is currently working on(and will output on outputPercentRemaining). + */ + public String currentTask; + + /** The percentage of the current task finished so far. */ + public int percentDone; + + /** True if the server is in online mode. */ + private boolean onlineMode; + + /** True if the server has animals turned on. */ + private boolean canSpawnAnimals; + private boolean canSpawnNPCs; + + /** Indicates whether PvP is active on the server or not. */ + private boolean pvpEnabled; + + /** Determines if flight is allowed or not. */ + private boolean allowFlight; + + /** The server MOTD string. */ + private String motd; + + /** Maximum build height. */ + private int buildLimit; + private int maxPlayerIdleMinutes = 0; + public final long[] tickTimeArray = new long[100]; + + /** Stats are [dimension][tick%100] system.nanoTime is stored. */ + public long[][] timeOfLastDimensionTick; + private KeyPair serverKeyPair; + + /** Username of the server owner (for integrated servers) */ + private String serverOwner; + private String folderName; + private String worldName; + private boolean isDemo; + private boolean enableBonusChest; + + /** + * If true, there is no need to save chunks or stop the server, because that is already being done. + */ + private boolean worldIsBeingDeleted; + + /** The texture pack for the server */ + private String resourcePackUrl = ""; + private String resourcePackHash = ""; + private boolean serverIsRunning; + + /** + * Set when warned for "Can't keep up", which triggers again after 15 seconds. + */ + private long timeOfLastWarning; + private String userMessage; + private boolean startProfiling; + private boolean isGamemodeForced; + private final YggdrasilAuthenticationService authService; + private final MinecraftSessionService sessionService; + private long nanoTimeSinceStatusRefresh = 0L; + private final GameProfileRepository profileRepo; + private final PlayerProfileCache profileCache; + protected final Queue < FutureTask> futureTaskQueue = Queues. < FutureTask> newArrayDeque(); + private Thread serverThread; + private long currentTime = getCurrentTimeMillis(); + + public MinecraftServer(Proxy proxy, File workDir) + { + this.serverProxy = proxy; + mcServer = this; + this.anvilFile = null; + this.networkSystem = null; + this.profileCache = new PlayerProfileCache(this, workDir); + this.commandManager = null; + this.anvilConverterForAnvilFile = null; + this.authService = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString()); + this.sessionService = this.authService.createMinecraftSessionService(); + this.profileRepo = this.authService.createProfileRepository(); + } + + public MinecraftServer(File workDir, Proxy proxy, File profileCacheDir) + { + this.serverProxy = proxy; + mcServer = this; + this.anvilFile = workDir; + this.networkSystem = new NetworkSystem(this); + this.profileCache = new PlayerProfileCache(this, profileCacheDir); + this.commandManager = this.createNewCommandManager(); + this.anvilConverterForAnvilFile = new AnvilSaveConverter(workDir); + this.authService = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString()); + this.sessionService = this.authService.createMinecraftSessionService(); + this.profileRepo = this.authService.createProfileRepository(); + } + + protected ServerCommandManager createNewCommandManager() + { + return new ServerCommandManager(); + } + + /** + * Initialises the server and starts it. + */ + protected abstract boolean startServer() throws IOException; + + protected void convertMapIfNeeded(String worldNameIn) + { + if (this.getActiveAnvilConverter().isOldMapFormat(worldNameIn)) + { + logger.info("Converting map!"); + this.setUserMessage("menu.convertingLevel"); + this.getActiveAnvilConverter().convertMapFormat(worldNameIn, new IProgressUpdate() + { + private long startTime = System.currentTimeMillis(); + public void displaySavingString(String message) + { + } + public void resetProgressAndMessage(String message) + { + } + public void setLoadingProgress(int progress) + { + if (System.currentTimeMillis() - this.startTime >= 1000L) + { + this.startTime = System.currentTimeMillis(); + MinecraftServer.logger.info("Converting... " + progress + "%"); + } + } + public void setDoneWorking() + { + } + public void displayLoadingString(String message) + { + } + }); + } + } + + /** + * Typically "menu.convertingLevel", "menu.loadingLevel" or others. + */ + + protected synchronized void setUserMessage(String message) + { + this.userMessage = message; + } + + public synchronized String getUserMessage() + { + return this.userMessage; + } + + protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) + { + this.convertMapIfNeeded(p_71247_1_); + this.setUserMessage("menu.loadingLevel"); + this.worldServers = new WorldServer[3]; + this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; + ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(p_71247_1_, true); + this.setResourcePackFromWorld(this.getFolderName(), isavehandler); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); + WorldSettings worldsettings; + + if (worldinfo == null) + { + if (this.isDemo()) + { + worldsettings = DemoWorldServer.demoWorldSettings; + } + else + { + worldsettings = new WorldSettings(seed, this.getGameType(), this.canStructuresSpawn(), this.isHardcore(), type); + worldsettings.setWorldName(p_71247_6_); + + if (this.enableBonusChest) + { + worldsettings.enableBonusChest(); + } + } + + worldinfo = new WorldInfo(worldsettings, p_71247_2_); + } + else + { + worldinfo.setWorldName(p_71247_2_); + worldsettings = new WorldSettings(worldinfo); + } + + for (int i = 0; i < this.worldServers.length; ++i) + { + int j = 0; + + if (i == 1) + { + j = -1; + } + + if (i == 2) + { + j = 1; + } + + if (i == 0) + { + if (this.isDemo()) + { + this.worldServers[i] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); + } + else + { + this.worldServers[i] = (WorldServer)(new WorldServer(this, isavehandler, worldinfo, j, this.theProfiler)).init(); + } + + this.worldServers[i].initialize(worldsettings); + } + else + { + this.worldServers[i] = (WorldServer)(new WorldServerMulti(this, isavehandler, j, this.worldServers[0], this.theProfiler)).init(); + } + + this.worldServers[i].addWorldAccess(new WorldManager(this, this.worldServers[i])); + + if (!this.isSinglePlayer()) + { + this.worldServers[i].getWorldInfo().setGameType(this.getGameType()); + } + } + + this.serverConfigManager.setPlayerManager(this.worldServers); + this.setDifficultyForAllWorlds(this.getDifficulty()); + this.initialWorldChunkLoad(); + } + + protected void initialWorldChunkLoad() + { + int i = 16; + int j = 4; + int k = 192; + int l = 625; + int i1 = 0; + this.setUserMessage("menu.generatingTerrain"); + int j1 = 0; + logger.info("Preparing start region for level " + j1); + WorldServer worldserver = this.worldServers[j1]; + BlockPos blockpos = worldserver.getSpawnPoint(); + long k1 = getCurrentTimeMillis(); + + for (int l1 = -192; l1 <= 192 && this.isServerRunning(); l1 += 16) + { + for (int i2 = -192; i2 <= 192 && this.isServerRunning(); i2 += 16) + { + long j2 = getCurrentTimeMillis(); + + if (j2 - k1 > 1000L) + { + this.outputPercentRemaining("Preparing spawn area", i1 * 100 / 625); + k1 = j2; + } + + ++i1; + worldserver.theChunkProviderServer.loadChunk(blockpos.getX() + l1 >> 4, blockpos.getZ() + i2 >> 4); + } + } + + this.clearCurrentTask(); + } + + protected void setResourcePackFromWorld(String worldNameIn, ISaveHandler saveHandlerIn) + { + File file1 = new File(saveHandlerIn.getWorldDirectory(), "resources.zip"); + + if (file1.isFile()) + { + this.setResourcePack("level://" + worldNameIn + "/" + file1.getName(), ""); + } + } + + public abstract boolean canStructuresSpawn(); + + public abstract WorldSettings.GameType getGameType(); + + /** + * Get the server's difficulty + */ + public abstract EnumDifficulty getDifficulty(); + + /** + * Defaults to false. + */ + public abstract boolean isHardcore(); + + public abstract int getOpPermissionLevel(); + + public abstract boolean func_181034_q(); + + public abstract boolean func_183002_r(); + + /** + * Used to display a percent remaining given text and the percentage. + */ + protected void outputPercentRemaining(String message, int percent) + { + this.currentTask = message; + this.percentDone = percent; + logger.info(message + ": " + percent + "%"); + } + + /** + * Set current task to null and set its percentage to 0. + */ + protected void clearCurrentTask() + { + this.currentTask = null; + this.percentDone = 0; + } + + /** + * par1 indicates if a log message should be output. + */ + protected void saveAllWorlds(boolean dontLog) + { + if (!this.worldIsBeingDeleted) + { + for (WorldServer worldserver : this.worldServers) + { + if (worldserver != null) + { + if (!dontLog) + { + logger.info("Saving chunks for level \'" + worldserver.getWorldInfo().getWorldName() + "\'/" + worldserver.provider.getDimensionName()); + } + + try + { + worldserver.saveAllChunks(true, (IProgressUpdate)null); + } + catch (MinecraftException minecraftexception) + { + logger.warn(minecraftexception.getMessage()); + } + } + } + } + } + + /** + * Saves all necessary data as preparation for stopping the server. + */ + public void stopServer() + { + if (!this.worldIsBeingDeleted) + { + logger.info("Stopping server"); + + if (this.getNetworkSystem() != null) + { + this.getNetworkSystem().terminateEndpoints(); + } + + if (this.serverConfigManager != null) + { + logger.info("Saving players"); + this.serverConfigManager.saveAllPlayerData(); + this.serverConfigManager.removeAllPlayers(); + } + + if (this.worldServers != null) + { + logger.info("Saving worlds"); + this.saveAllWorlds(false); + + for (int i = 0; i < this.worldServers.length; ++i) + { + WorldServer worldserver = this.worldServers[i]; + new WorldUnloadEvent(worldserver); + worldserver.flush(); + } + } + + if (this.usageSnooper.isSnooperRunning()) + { + this.usageSnooper.stopSnooper(); + } + } + } + + public boolean isServerRunning() + { + return this.serverRunning; + } + + /** + * Sets the serverRunning variable to false, in order to get the server to shut down. + */ + public void initiateShutdown() + { + this.serverRunning = false; + } + + protected void setInstance() + { + mcServer = this; + } + + public void run() + { + try + { + if (this.startServer()) + { + this.currentTime = getCurrentTimeMillis(); + long i = 0L; + this.statusResponse.setServerDescription(new ChatComponentText(this.motd)); + this.statusResponse.setProtocolVersionInfo(new ServerStatusResponse.MinecraftProtocolVersionIdentifier("1.8.8", 47)); + this.addFaviconToStatusResponse(this.statusResponse); + + while (this.serverRunning) + { + long k = getCurrentTimeMillis(); + long j = k - this.currentTime; + + if (j > 2000L && this.currentTime - this.timeOfLastWarning >= 15000L) + { + logger.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] {Long.valueOf(j), Long.valueOf(j / 50L)}); + j = 2000L; + this.timeOfLastWarning = this.currentTime; + } + + if (j < 0L) + { + logger.warn("Time ran backwards! Did the system time change?"); + j = 0L; + } + + i += j; + this.currentTime = k; + + if (this.worldServers[0].areAllPlayersAsleep()) + { + this.tick(); + i = 0L; + } + else + { + while (i > 50L) + { + i -= 50L; + this.tick(); + } + } + + Thread.sleep(Math.max(1L, 50L - i)); + this.serverIsRunning = true; + } + } + else + { + this.finalTick((CrashReport)null); + } + } + catch (Throwable throwable1) + { + logger.error("Encountered an unexpected exception", throwable1); + CrashReport crashreport = null; + + if (throwable1 instanceof ReportedException) + { + crashreport = this.addServerInfoToCrashReport(((ReportedException)throwable1).getCrashReport()); + } + else + { + crashreport = this.addServerInfoToCrashReport(new CrashReport("Exception in server tick loop", throwable1)); + } + + File file1 = new File(new File(this.getDataDirectory(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt"); + + if (crashreport.saveToFile(file1)) + { + logger.error("This crash report has been saved to: " + file1.getAbsolutePath()); + } + else + { + logger.error("We were unable to save this crash report to disk."); + } + + this.finalTick(crashreport); + } + finally + { + try + { + this.serverStopped = true; + this.stopServer(); + } + catch (Throwable throwable) + { + logger.error("Exception stopping the server", throwable); + } + finally + { + this.systemExitNow(); + } + } + } + + private void addFaviconToStatusResponse(ServerStatusResponse response) + { + File file1 = this.getFile("server-icon.png"); + + if (file1.isFile()) + { + ByteBuf bytebuf = Unpooled.buffer(); + + try + { + BufferedImage bufferedimage = ImageIO.read(file1); + Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]); + Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]); + ImageIO.write(bufferedimage, "PNG", (OutputStream)(new ByteBufOutputStream(bytebuf))); + ByteBuf bytebuf1 = Base64.encode(bytebuf); + response.setFavicon("data:image/png;base64," + bytebuf1.toString(Charsets.UTF_8)); + } + catch (Exception exception) + { + logger.error((String)"Couldn\'t load server icon", (Throwable)exception); + } + finally + { + bytebuf.release(); + } + } + } + + public File getDataDirectory() + { + return new File("."); + } + + /** + * Called on exit from the main run() loop. + */ + protected void finalTick(CrashReport report) + { + } + + /** + * Directly calls System.exit(0), instantly killing the program. + */ + protected void systemExitNow() + { + } + + /** + * Main function called by run() every loop. + */ + public void tick() + { + long i = System.nanoTime(); + ++this.tickCounter; + + if (this.startProfiling) + { + this.startProfiling = false; + this.theProfiler.profilingEnabled = true; + this.theProfiler.clearProfiling(); + } + + this.theProfiler.startSection("root"); + this.updateTimeLightAndEntities(); + + if (i - this.nanoTimeSinceStatusRefresh >= 5000000000L) + { + this.nanoTimeSinceStatusRefresh = i; + this.statusResponse.setPlayerCountData(new ServerStatusResponse.PlayerCountData(this.getMaxPlayers(), this.getCurrentPlayerCount())); + GameProfile[] agameprofile = new GameProfile[Math.min(this.getCurrentPlayerCount(), 12)]; + int j = MathHelper.getRandomIntegerInRange(this.random, 0, this.getCurrentPlayerCount() - agameprofile.length); + + for (int k = 0; k < agameprofile.length; ++k) + { + agameprofile[k] = ((EntityPlayerMP)this.serverConfigManager.func_181057_v().get(j + k)).getGameProfile(); + } + + Collections.shuffle(Arrays.asList(agameprofile)); + this.statusResponse.getPlayerCountData().setPlayers(agameprofile); + } + + if (this.tickCounter % 900 == 0) + { + this.theProfiler.startSection("save"); + this.serverConfigManager.saveAllPlayerData(); + this.saveAllWorlds(true); + this.theProfiler.endSection(); + } + + this.theProfiler.startSection("tallying"); + this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - i; + this.theProfiler.endSection(); + this.theProfiler.startSection("snooper"); + + if (!this.usageSnooper.isSnooperRunning() && this.tickCounter > 100) + { + this.usageSnooper.startSnooper(); + } + + if (this.tickCounter % 6000 == 0) + { + this.usageSnooper.addMemoryStatsToSnooper(); + } + + this.theProfiler.endSection(); + this.theProfiler.endSection(); + } + + public void updateTimeLightAndEntities() + { + this.theProfiler.startSection("jobs"); + + synchronized (this.futureTaskQueue) + { + while (!this.futureTaskQueue.isEmpty()) + { + Util.func_181617_a((FutureTask)this.futureTaskQueue.poll(), logger); + } + } + + this.theProfiler.endStartSection("levels"); + + for (int j = 0; j < this.worldServers.length; ++j) + { + long i = System.nanoTime(); + + if (j == 0 || this.getAllowNether()) + { + WorldServer worldserver = this.worldServers[j]; + this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName()); + + if (this.tickCounter % 20 == 0) + { + this.theProfiler.startSection("timeSync"); + this.serverConfigManager.sendPacketToAllPlayersInDimension(new S03PacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionId()); + this.theProfiler.endSection(); + } + + this.theProfiler.startSection("tick"); + + try + { + worldserver.tick(); + } + catch (Throwable throwable1) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world"); + worldserver.addWorldInfoToCrashReport(crashreport); + throw new ReportedException(crashreport); + } + + try + { + worldserver.updateEntities(); + } + catch (Throwable throwable) + { + CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Exception ticking world entities"); + worldserver.addWorldInfoToCrashReport(crashreport1); + throw new ReportedException(crashreport1); + } + + this.theProfiler.endSection(); + this.theProfiler.startSection("tracker"); + worldserver.getEntityTracker().updateTrackedEntities(); + this.theProfiler.endSection(); + this.theProfiler.endSection(); + } + + this.timeOfLastDimensionTick[j][this.tickCounter % 100] = System.nanoTime() - i; + } + + this.theProfiler.endStartSection("connection"); + this.getNetworkSystem().networkTick(); + this.theProfiler.endStartSection("players"); + this.serverConfigManager.onTick(); + this.theProfiler.endStartSection("tickables"); + + for (int k = 0; k < this.playersOnline.size(); ++k) + { + ((ITickable)this.playersOnline.get(k)).update(); + } + + this.theProfiler.endSection(); + } + + public boolean getAllowNether() + { + return true; + } + + public void startServerThread() + { + this.serverThread = new Thread(this, "Server thread"); + this.serverThread.start(); + } + + /** + * Returns a File object from the specified string. + */ + public File getFile(String fileName) + { + return new File(this.getDataDirectory(), fileName); + } + + /** + * Logs the message with a level of WARN. + */ + public void logWarning(String msg) + { + logger.warn(msg); + } + + /** + * Gets the worldServer by the given dimension. + */ + public WorldServer worldServerForDimension(int dimension) + { + return dimension == -1 ? this.worldServers[1] : (dimension == 1 ? this.worldServers[2] : this.worldServers[0]); + } + + /** + * Returns the server's Minecraft version as string. + */ + public String getMinecraftVersion() + { + return "1.8.8"; + } + + /** + * Returns the number of players currently on the server. + */ + public int getCurrentPlayerCount() + { + return this.serverConfigManager.getCurrentPlayerCount(); + } + + /** + * Returns the maximum number of players allowed on the server. + */ + public int getMaxPlayers() + { + return this.serverConfigManager.getMaxPlayers(); + } + + /** + * Returns an array of the usernames of all the connected players. + */ + public String[] getAllUsernames() + { + return this.serverConfigManager.getAllUsernames(); + } + + /** + * Returns an array of the GameProfiles of all the connected players + */ + public GameProfile[] getGameProfiles() + { + return this.serverConfigManager.getAllProfiles(); + } + + public String getServerModName() + { + return "vanilla"; + } + + /** + * Adds the server info, including from theWorldServer, to the crash report. + */ + public CrashReport addServerInfoToCrashReport(CrashReport report) + { + report.getCategory().addCrashSectionCallable("Profiler Position", new Callable() + { + public String call() throws Exception + { + return MinecraftServer.this.theProfiler.profilingEnabled ? MinecraftServer.this.theProfiler.getNameOfLastSection() : "N/A (disabled)"; + } + }); + + if (this.serverConfigManager != null) + { + report.getCategory().addCrashSectionCallable("Player Count", new Callable() + { + public String call() + { + return MinecraftServer.this.serverConfigManager.getCurrentPlayerCount() + " / " + MinecraftServer.this.serverConfigManager.getMaxPlayers() + "; " + MinecraftServer.this.serverConfigManager.func_181057_v(); + } + }); + } + + return report; + } + + public List getTabCompletions(ICommandSender sender, String input, BlockPos pos) + { + List list = Lists.newArrayList(); + + if (input.startsWith("/")) + { + input = input.substring(1); + boolean flag = !input.contains(" "); + List list1 = this.commandManager.getTabCompletionOptions(sender, input, pos); + + if (list1 != null) + { + for (String s2 : list1) + { + if (flag) + { + list.add("/" + s2); + } + else + { + list.add(s2); + } + } + } + + return list; + } + else + { + String[] astring = input.split(" ", -1); + String s = astring[astring.length - 1]; + + for (String s1 : this.serverConfigManager.getAllUsernames()) + { + if (CommandBase.doesStringStartWith(s, s1)) + { + list.add(s1); + } + } + + return list; + } + } + + /** + * Gets mcServer. + */ + public static MinecraftServer getServer() + { + return mcServer; + } + + public boolean isAnvilFileSet() + { + return this.anvilFile != null; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return "Server"; + } + + /** + * Send a chat message to the CommandSender + */ + public void addChatMessage(IChatComponent component) + { + logger.info(component.getUnformattedText()); + } + + /** + * Returns {@code true} if the CommandSender is allowed to execute the command, {@code false} if not + */ + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { + return true; + } + + public ICommandManager getCommandManager() + { + return this.commandManager; + } + + /** + * Gets KeyPair instanced in MinecraftServer. + */ + public KeyPair getKeyPair() + { + return this.serverKeyPair; + } + + /** + * Returns the username of the server owner (for integrated servers) + */ + public String getServerOwner() + { + return this.serverOwner; + } + + /** + * Sets the username of the owner of this server (in the case of an integrated server) + */ + public void setServerOwner(String owner) + { + this.serverOwner = owner; + } + + public boolean isSinglePlayer() + { + return this.serverOwner != null; + } + + public String getFolderName() + { + return this.folderName; + } + + public void setFolderName(String name) + { + this.folderName = name; + } + + public void setWorldName(String p_71246_1_) + { + this.worldName = p_71246_1_; + } + + public String getWorldName() + { + return this.worldName; + } + + public void setKeyPair(KeyPair keyPair) + { + this.serverKeyPair = keyPair; + } + + public void setDifficultyForAllWorlds(EnumDifficulty difficulty) + { + for (int i = 0; i < this.worldServers.length; ++i) + { + World world = this.worldServers[i]; + + if (world != null) + { + if (world.getWorldInfo().isHardcoreModeEnabled()) + { + world.getWorldInfo().setDifficulty(EnumDifficulty.HARD); + world.setAllowedSpawnTypes(true, true); + } + else if (this.isSinglePlayer()) + { + world.getWorldInfo().setDifficulty(difficulty); + world.setAllowedSpawnTypes(world.getDifficulty() != EnumDifficulty.PEACEFUL, true); + } + else + { + world.getWorldInfo().setDifficulty(difficulty); + world.setAllowedSpawnTypes(this.allowSpawnMonsters(), this.canSpawnAnimals); + } + } + } + } + + protected boolean allowSpawnMonsters() + { + return true; + } + + /** + * Gets whether this is a demo or not. + */ + public boolean isDemo() + { + return this.isDemo; + } + + /** + * Sets whether this is a demo or not. + */ + public void setDemo(boolean demo) + { + this.isDemo = demo; + } + + public void canCreateBonusChest(boolean enable) + { + this.enableBonusChest = enable; + } + + public ISaveFormat getActiveAnvilConverter() + { + return this.anvilConverterForAnvilFile; + } + + /** + * WARNING : directly calls + * getActiveAnvilConverter().deleteWorldDirectory(theWorldServer[0].getSaveHandler().getWorldDirectoryName()); + */ + public void deleteWorldAndStopServer() + { + this.worldIsBeingDeleted = true; + this.getActiveAnvilConverter().flushCache(); + + for (int i = 0; i < this.worldServers.length; ++i) + { + WorldServer worldserver = this.worldServers[i]; + + if (worldserver != null) + { + new WorldUnloadEvent(worldserver); + worldserver.flush(); + } + } + + this.getActiveAnvilConverter().deleteWorldDirectory(this.worldServers[0].getSaveHandler().getWorldDirectoryName()); + this.initiateShutdown(); + } + + public String getResourcePackUrl() + { + return this.resourcePackUrl; + } + + public String getResourcePackHash() + { + return this.resourcePackHash; + } + + public void setResourcePack(String url, String hash) + { + this.resourcePackUrl = url; + this.resourcePackHash = hash; + } + + public void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper) + { + playerSnooper.addClientStat("whitelist_enabled", Boolean.valueOf(false)); + playerSnooper.addClientStat("whitelist_count", Integer.valueOf(0)); + + if (this.serverConfigManager != null) + { + playerSnooper.addClientStat("players_current", Integer.valueOf(this.getCurrentPlayerCount())); + playerSnooper.addClientStat("players_max", Integer.valueOf(this.getMaxPlayers())); + playerSnooper.addClientStat("players_seen", Integer.valueOf(this.serverConfigManager.getAvailablePlayerDat().length)); + } + + playerSnooper.addClientStat("uses_auth", Boolean.valueOf(this.onlineMode)); + playerSnooper.addClientStat("gui_state", this.getGuiEnabled() ? "enabled" : "disabled"); + playerSnooper.addClientStat("run_time", Long.valueOf((getCurrentTimeMillis() - playerSnooper.getMinecraftStartTimeMillis()) / 60L * 1000L)); + playerSnooper.addClientStat("avg_tick_ms", Integer.valueOf((int)(MathHelper.average(this.tickTimeArray) * 1.0E-6D))); + int i = 0; + + if (this.worldServers != null) + { + for (int j = 0; j < this.worldServers.length; ++j) + { + if (this.worldServers[j] != null) + { + WorldServer worldserver = this.worldServers[j]; + WorldInfo worldinfo = worldserver.getWorldInfo(); + playerSnooper.addClientStat("world[" + i + "][dimension]", Integer.valueOf(worldserver.provider.getDimensionId())); + playerSnooper.addClientStat("world[" + i + "][mode]", worldinfo.getGameType()); + playerSnooper.addClientStat("world[" + i + "][difficulty]", worldserver.getDifficulty()); + playerSnooper.addClientStat("world[" + i + "][hardcore]", Boolean.valueOf(worldinfo.isHardcoreModeEnabled())); + playerSnooper.addClientStat("world[" + i + "][generator_name]", worldinfo.getTerrainType().getWorldTypeName()); + playerSnooper.addClientStat("world[" + i + "][generator_version]", Integer.valueOf(worldinfo.getTerrainType().getGeneratorVersion())); + playerSnooper.addClientStat("world[" + i + "][height]", Integer.valueOf(this.buildLimit)); + playerSnooper.addClientStat("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.getChunkProvider().getLoadedChunkCount())); + ++i; + } + } + } + + playerSnooper.addClientStat("worlds", Integer.valueOf(i)); + } + + public void addServerTypeToSnooper(PlayerUsageSnooper playerSnooper) + { + playerSnooper.addStatToSnooper("singleplayer", Boolean.valueOf(this.isSinglePlayer())); + playerSnooper.addStatToSnooper("server_brand", this.getServerModName()); + playerSnooper.addStatToSnooper("gui_supported", GraphicsEnvironment.isHeadless() ? "headless" : "supported"); + playerSnooper.addStatToSnooper("dedicated", Boolean.valueOf(this.isDedicatedServer())); + } + + /** + * Returns whether snooping is enabled or not. + */ + public boolean isSnooperEnabled() + { + return true; + } + + public abstract boolean isDedicatedServer(); + + public boolean isServerInOnlineMode() + { + return this.onlineMode; + } + + public void setOnlineMode(boolean online) + { + this.onlineMode = online; + } + + public boolean getCanSpawnAnimals() + { + return this.canSpawnAnimals; + } + + public void setCanSpawnAnimals(boolean spawnAnimals) + { + this.canSpawnAnimals = spawnAnimals; + } + + public boolean getCanSpawnNPCs() + { + return this.canSpawnNPCs; + } + + public abstract boolean func_181035_ah(); + + public void setCanSpawnNPCs(boolean spawnNpcs) + { + this.canSpawnNPCs = spawnNpcs; + } + + public boolean isPVPEnabled() + { + return this.pvpEnabled; + } + + public void setAllowPvp(boolean allowPvp) + { + this.pvpEnabled = allowPvp; + } + + public boolean isFlightAllowed() + { + return this.allowFlight; + } + + public void setAllowFlight(boolean allow) + { + this.allowFlight = allow; + } + + /** + * Return whether command blocks are enabled. + */ + public abstract boolean isCommandBlockEnabled(); + + public String getMOTD() + { + return this.motd; + } + + public void setMOTD(String motdIn) + { + this.motd = motdIn; + } + + public int getBuildLimit() + { + return this.buildLimit; + } + + public void setBuildLimit(int maxBuildHeight) + { + this.buildLimit = maxBuildHeight; + } + + public boolean isServerStopped() + { + return this.serverStopped; + } + + public ServerConfigurationManager getConfigurationManager() + { + return this.serverConfigManager; + } + + public void setConfigManager(ServerConfigurationManager configManager) + { + this.serverConfigManager = configManager; + } + + /** + * Sets the game type for all worlds. + */ + public void setGameType(WorldSettings.GameType gameMode) + { + for (int i = 0; i < this.worldServers.length; ++i) + { + getServer().worldServers[i].getWorldInfo().setGameType(gameMode); + } + } + + public NetworkSystem getNetworkSystem() + { + return this.networkSystem; + } + + public boolean serverIsInRunLoop() + { + return this.serverIsRunning; + } + + public boolean getGuiEnabled() + { + return false; + } + + /** + * On dedicated does nothing. On integrated, sets commandsAllowedForAll, gameType and allows external connections. + */ + public abstract String shareToLAN(WorldSettings.GameType type, boolean allowCheats); + + public int getTickCounter() + { + return this.tickCounter; + } + + public void enableProfiling() + { + this.startProfiling = true; + } + + public PlayerUsageSnooper getPlayerUsageSnooper() + { + return this.usageSnooper; + } + + /** + * Get the position in the world. {@code null} is not allowed! If you are not an entity in the world, return + * the coordinates 0, 0, 0 + */ + public BlockPos getPosition() + { + return BlockPos.ORIGIN; + } + + /** + * Get the position vector. {@code null} is not allowed! If you are not an entity in the world, return 0.0D, + * 0.0D, 0.0D + */ + public Vec3 getPositionVector() + { + return new Vec3(0.0D, 0.0D, 0.0D); + } + + /** + * Get the world, if available. {@code null} is not allowed! If you are not an entity in the world, return + * the overworld + */ + public World getEntityWorld() + { + return this.worldServers[0]; + } + + /** + * Returns the entity associated with the command sender. MAY BE NULL! + */ + public Entity getCommandSenderEntity() + { + return null; + } + + /** + * Return the spawn protection area's size. + */ + public int getSpawnProtectionSize() + { + return 16; + } + + public boolean isBlockProtected(World worldIn, BlockPos pos, EntityPlayer playerIn) + { + return false; + } + + public boolean getForceGamemode() + { + return this.isGamemodeForced; + } + + public Proxy getServerProxy() + { + return this.serverProxy; + } + + public static long getCurrentTimeMillis() + { + return System.currentTimeMillis(); + } + + public int getMaxPlayerIdleMinutes() + { + return this.maxPlayerIdleMinutes; + } + + public void setPlayerIdleTimeout(int idleTimeout) + { + this.maxPlayerIdleMinutes = idleTimeout; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return new ChatComponentText(this.getName()); + } + + public boolean isAnnouncingPlayerAchievements() + { + return true; + } + + public MinecraftSessionService getMinecraftSessionService() + { + return this.sessionService; + } + + public GameProfileRepository getGameProfileRepository() + { + return this.profileRepo; + } + + public PlayerProfileCache getPlayerProfileCache() + { + return this.profileCache; + } + + public ServerStatusResponse getServerStatusResponse() + { + return this.statusResponse; + } + + public void refreshStatusNextTick() + { + this.nanoTimeSinceStatusRefresh = 0L; + } + + public Entity getEntityFromUuid(UUID uuid) + { + for (WorldServer worldserver : this.worldServers) + { + if (worldserver != null) + { + Entity entity = worldserver.getEntityFromUuid(uuid); + + if (entity != null) + { + return entity; + } + } + } + + return null; + } + + /** + * Returns true if the command sender should be sent feedback about executed commands + */ + public boolean sendCommandFeedback() + { + return getServer().worldServers[0].getGameRules().getBoolean("sendCommandFeedback"); + } + + public void setCommandStat(CommandResultStats.Type type, int amount) + { + } + + public int getMaxWorldSize() + { + return 29999984; + } + + public ListenableFuture callFromMainThread(Callable callable) + { + Validate.notNull(callable); + + if (!this.isCallingFromMinecraftThread() && !this.isServerStopped()) + { + ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable); + + synchronized (this.futureTaskQueue) + { + this.futureTaskQueue.add(listenablefuturetask); + return listenablefuturetask; + } + } + else + { + try + { + return Futures.immediateFuture(callable.call()); + } + catch (Exception exception) + { + return Futures.immediateFailedCheckedFuture(exception); + } + } + } + + public ListenableFuture addScheduledTask(Runnable runnableToSchedule) + { + Validate.notNull(runnableToSchedule); + return this.callFromMainThread(Executors.callable(runnableToSchedule)); + } + + public boolean isCallingFromMinecraftThread() + { + return Thread.currentThread() == this.serverThread; + } + + /** + * The compression treshold. If the packet is larger than the specified amount of bytes, it will be compressed + */ + public int getNetworkCompressionTreshold() + { + return 256; + } +} diff --git a/src/minecraft/net/minecraft/server/integrated/IntegratedPlayerList.java b/src/minecraft/net/minecraft/server/integrated/IntegratedPlayerList.java new file mode 100644 index 0000000..ced5da3 --- /dev/null +++ b/src/minecraft/net/minecraft/server/integrated/IntegratedPlayerList.java @@ -0,0 +1,56 @@ +package net.minecraft.server.integrated; + +import com.mojang.authlib.GameProfile; +import java.net.SocketAddress; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.management.ServerConfigurationManager; + +public class IntegratedPlayerList extends ServerConfigurationManager +{ + /** + * Holds the NBT data for the host player's save file, so this can be written to level.dat. + */ + private NBTTagCompound hostPlayerData; + + public IntegratedPlayerList(IntegratedServer p_i1314_1_) + { + super(p_i1314_1_); + this.setViewDistance(10); + } + + /** + * also stores the NBTTags if this is an intergratedPlayerList + */ + protected void writePlayerData(EntityPlayerMP playerIn) + { + if (playerIn.getName().equals(this.getServerInstance().getServerOwner())) + { + this.hostPlayerData = new NBTTagCompound(); + playerIn.writeToNBT(this.hostPlayerData); + } + + super.writePlayerData(playerIn); + } + + /** + * checks ban-lists, then white-lists, then space for the server. Returns null on success, or an error message + */ + public String allowUserToConnect(SocketAddress address, GameProfile profile) + { + return profile.getName().equalsIgnoreCase(this.getServerInstance().getServerOwner()) && this.getPlayerByUsername(profile.getName()) != null ? "That name is already taken." : super.allowUserToConnect(address, profile); + } + + public IntegratedServer getServerInstance() + { + return (IntegratedServer)super.getServerInstance(); + } + + /** + * On integrated servers, returns the host's player data to be written to level.dat. + */ + public NBTTagCompound getHostPlayerData() + { + return this.hostPlayerData; + } +} diff --git a/src/minecraft/net/minecraft/server/integrated/IntegratedServer.java b/src/minecraft/net/minecraft/server/integrated/IntegratedServer.java new file mode 100644 index 0000000..7c003b5 --- /dev/null +++ b/src/minecraft/net/minecraft/server/integrated/IntegratedServer.java @@ -0,0 +1,508 @@ +package net.minecraft.server.integrated; + +import com.google.common.collect.Lists; +import com.google.common.util.concurrent.Futures; +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; +import java.util.Queue; +import java.util.concurrent.Callable; +import java.util.concurrent.FutureTask; +import net.minecraft.client.ClientBrandRetriever; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ThreadLanServerPing; +import net.minecraft.command.ServerCommandManager; +import net.minecraft.crash.CrashReport; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.profiler.PlayerUsageSnooper; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.CryptManager; +import net.minecraft.util.HttpUtil; +import net.minecraft.util.Util; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.WorldManager; +import net.minecraft.world.WorldServer; +import net.minecraft.world.WorldServerMulti; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.WorldType; +import net.minecraft.world.demo.DemoWorldServer; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; +import optifine.Reflector; +import optifine.WorldServerOF; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class IntegratedServer extends MinecraftServer +{ + private static final Logger logger = LogManager.getLogger(); + + /** The Minecraft instance. */ + private final Minecraft mc; + private final WorldSettings theWorldSettings; + private boolean isGamePaused; + private boolean isPublic; + private ThreadLanServerPing lanServerPing; + private static final String __OBFID = "CL_00001129"; + + public IntegratedServer(Minecraft mcIn) + { + super(mcIn.getProxy(), new File(mcIn.mcDataDir, USER_CACHE_FILE.getName())); + this.mc = mcIn; + this.theWorldSettings = null; + } + + public IntegratedServer(Minecraft mcIn, String folderName, String worldName, WorldSettings settings) + { + super(new File(mcIn.mcDataDir, "saves"), mcIn.getProxy(), new File(mcIn.mcDataDir, USER_CACHE_FILE.getName())); + this.setServerOwner(mcIn.getSession().getUsername()); + this.setFolderName(folderName); + this.setWorldName(worldName); + this.setDemo(mcIn.isDemo()); + this.canCreateBonusChest(settings.isBonusChestEnabled()); + this.setBuildLimit(256); + this.setConfigManager(new IntegratedPlayerList(this)); + this.mc = mcIn; + this.theWorldSettings = this.isDemo() ? DemoWorldServer.demoWorldSettings : settings; + } + + protected ServerCommandManager createNewCommandManager() + { + return new IntegratedServerCommandManager(); + } + + protected void loadAllWorlds(String p_71247_1_, String p_71247_2_, long seed, WorldType type, String p_71247_6_) + { + this.convertMapIfNeeded(p_71247_1_); + ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(p_71247_1_, true); + this.setResourcePackFromWorld(this.getFolderName(), isavehandler); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); + + if (Reflector.DimensionManager.exists()) + { + WorldServer worldserver = this.isDemo() ? (WorldServer)((WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, 0, this.theProfiler)).init()) : (WorldServer)(new WorldServerOF(this, isavehandler, worldinfo, 0, this.theProfiler)).init(); + worldserver.initialize(this.theWorldSettings); + Integer[] ainteger = (Integer[])((Integer[])Reflector.call(Reflector.DimensionManager_getStaticDimensionIDs, new Object[0])); + Integer[] ainteger1 = ainteger; + int i = ainteger.length; + + for (int j = 0; j < i; ++j) + { + int k = ainteger1[j].intValue(); + WorldServer worldserver1 = k == 0 ? worldserver : (WorldServer)((WorldServer)(new WorldServerMulti(this, isavehandler, k, worldserver, this.theProfiler)).init()); + worldserver1.addWorldAccess(new WorldManager(this, worldserver1)); + + if (!this.isSinglePlayer()) + { + worldserver1.getWorldInfo().setGameType(this.getGameType()); + } + + if (Reflector.EventBus.exists()) + { + Reflector.postForgeBusEvent(Reflector.WorldEvent_Load_Constructor, new Object[] {worldserver1}); + } + } + + this.getConfigurationManager().setPlayerManager(new WorldServer[] {worldserver}); + + if (worldserver.getWorldInfo().getDifficulty() == null) + { + this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); + } + } + else + { + this.worldServers = new WorldServer[3]; + this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; + this.setResourcePackFromWorld(this.getFolderName(), isavehandler); + + if (worldinfo == null) + { + worldinfo = new WorldInfo(this.theWorldSettings, p_71247_2_); + } + else + { + worldinfo.setWorldName(p_71247_2_); + } + + for (int l = 0; l < this.worldServers.length; ++l) + { + byte b0 = 0; + + if (l == 1) + { + b0 = -1; + } + + if (l == 2) + { + b0 = 1; + } + + if (l == 0) + { + if (this.isDemo()) + { + this.worldServers[l] = (WorldServer)(new DemoWorldServer(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); + } + else + { + this.worldServers[l] = (WorldServer)(new WorldServerOF(this, isavehandler, worldinfo, b0, this.theProfiler)).init(); + } + + this.worldServers[l].initialize(this.theWorldSettings); + } + else + { + this.worldServers[l] = (WorldServer)(new WorldServerMulti(this, isavehandler, b0, this.worldServers[0], this.theProfiler)).init(); + } + + this.worldServers[l].addWorldAccess(new WorldManager(this, this.worldServers[l])); + } + + this.getConfigurationManager().setPlayerManager(this.worldServers); + + if (this.worldServers[0].getWorldInfo().getDifficulty() == null) + { + this.setDifficultyForAllWorlds(this.mc.gameSettings.difficulty); + } + } + + this.initialWorldChunkLoad(); + } + + /** + * Initialises the server and starts it. + */ + protected boolean startServer() throws IOException + { + logger.info("Starting integrated minecraft server version 1.8.8"); + this.setOnlineMode(true); + this.setCanSpawnAnimals(true); + this.setCanSpawnNPCs(true); + this.setAllowPvp(true); + this.setAllowFlight(true); + logger.info("Generating keypair"); + this.setKeyPair(CryptManager.generateKeyPair()); + + if (Reflector.FMLCommonHandler_handleServerAboutToStart.exists()) + { + Object object = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]); + + if (!Reflector.callBoolean(object, Reflector.FMLCommonHandler_handleServerAboutToStart, new Object[] {this})) + { + return false; + } + } + + this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.getWorldName()); + this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName()); + + if (Reflector.FMLCommonHandler_handleServerStarting.exists()) + { + Object object1 = Reflector.call(Reflector.FMLCommonHandler_instance, new Object[0]); + + if (Reflector.FMLCommonHandler_handleServerStarting.getReturnType() == Boolean.TYPE) + { + return Reflector.callBoolean(object1, Reflector.FMLCommonHandler_handleServerStarting, new Object[] {this}); + } + + Reflector.callVoid(object1, Reflector.FMLCommonHandler_handleServerStarting, new Object[] {this}); + } + + return true; + } + + /** + * Main function called by run() every loop. + */ + public void tick() + { + boolean flag = this.isGamePaused; + this.isGamePaused = Minecraft.getMinecraft().getNetHandler() != null && Minecraft.getMinecraft().isGamePaused(); + + if (!flag && this.isGamePaused) + { + logger.info("Saving and pausing game..."); + this.getConfigurationManager().saveAllPlayerData(); + this.saveAllWorlds(false); + } + + if (this.isGamePaused) + { + Queue var3 = this.futureTaskQueue; + + synchronized (this.futureTaskQueue) + { + while (!this.futureTaskQueue.isEmpty()) + { + Util.func_181617_a((FutureTask)this.futureTaskQueue.poll(), logger); + } + } + } + else + { + super.tick(); + + if (this.mc.gameSettings.renderDistanceChunks != this.getConfigurationManager().getViewDistance()) + { + logger.info("Changing view distance to {}, from {}", new Object[] {Integer.valueOf(this.mc.gameSettings.renderDistanceChunks), Integer.valueOf(this.getConfigurationManager().getViewDistance())}); + this.getConfigurationManager().setViewDistance(this.mc.gameSettings.renderDistanceChunks); + } + + if (this.mc.theWorld != null) + { + WorldInfo worldinfo = this.worldServers[0].getWorldInfo(); + WorldInfo worldinfo1 = this.mc.theWorld.getWorldInfo(); + + if (!worldinfo.isDifficultyLocked() && worldinfo1.getDifficulty() != worldinfo.getDifficulty()) + { + logger.info("Changing difficulty to {}, from {}", new Object[] {worldinfo1.getDifficulty(), worldinfo.getDifficulty()}); + this.setDifficultyForAllWorlds(worldinfo1.getDifficulty()); + } + else if (worldinfo1.isDifficultyLocked() && !worldinfo.isDifficultyLocked()) + { + logger.info("Locking difficulty to {}", new Object[] {worldinfo1.getDifficulty()}); + + for (WorldServer worldserver : this.worldServers) + { + if (worldserver != null) + { + worldserver.getWorldInfo().setDifficultyLocked(true); + } + } + } + } + } + } + + public boolean canStructuresSpawn() + { + return false; + } + + public WorldSettings.GameType getGameType() + { + return this.theWorldSettings.getGameType(); + } + + /** + * Get the server's difficulty + */ + public EnumDifficulty getDifficulty() + { + return this.mc.theWorld == null ? this.mc.gameSettings.difficulty : this.mc.theWorld.getWorldInfo().getDifficulty(); + } + + /** + * Defaults to false. + */ + public boolean isHardcore() + { + return this.theWorldSettings.getHardcoreEnabled(); + } + + public boolean func_181034_q() + { + return true; + } + + public boolean func_183002_r() + { + return true; + } + + public File getDataDirectory() + { + return this.mc.mcDataDir; + } + + public boolean func_181035_ah() + { + return false; + } + + public boolean isDedicatedServer() + { + return false; + } + + /** + * Called on exit from the main run() loop. + */ + protected void finalTick(CrashReport report) + { + this.mc.crashed(report); + } + + /** + * Adds the server info, including from theWorldServer, to the crash report. + */ + public CrashReport addServerInfoToCrashReport(CrashReport report) + { + report = super.addServerInfoToCrashReport(report); + report.getCategory().addCrashSectionCallable("Type", new Callable() + { + private static final String __OBFID = "CL_00001130"; + public String call() throws Exception + { + return "Integrated Server (map_client.txt)"; + } + }); + report.getCategory().addCrashSectionCallable("Is Modded", new Callable() + { + private static final String __OBFID = "CL_00001131"; + public String call() throws Exception + { + String s = ClientBrandRetriever.getClientModName(); + + if (!s.equals("vanilla")) + { + return "Definitely; Client brand changed to \'" + s + "\'"; + } + else + { + s = IntegratedServer.this.getServerModName(); + return !s.equals("vanilla") ? "Definitely; Server brand changed to \'" + s + "\'" : (Minecraft.class.getSigners() == null ? "Very likely; Jar signature invalidated" : "Probably not. Jar signature remains and both client + server brands are untouched."); + } + } + }); + return report; + } + + public void setDifficultyForAllWorlds(EnumDifficulty difficulty) + { + super.setDifficultyForAllWorlds(difficulty); + + if (this.mc.theWorld != null) + { + this.mc.theWorld.getWorldInfo().setDifficulty(difficulty); + } + } + + public void addServerStatsToSnooper(PlayerUsageSnooper playerSnooper) + { + super.addServerStatsToSnooper(playerSnooper); + playerSnooper.addClientStat("snooper_partner", this.mc.getPlayerUsageSnooper().getUniqueID()); + } + + /** + * Returns whether snooping is enabled or not. + */ + public boolean isSnooperEnabled() + { + return Minecraft.getMinecraft().isSnooperEnabled(); + } + + /** + * On dedicated does nothing. On integrated, sets commandsAllowedForAll, gameType and allows external connections. + */ + public String shareToLAN(WorldSettings.GameType type, boolean allowCheats) + { + try + { + int i = -1; + + try + { + i = HttpUtil.getSuitableLanPort(); + } + catch (IOException var5) + { + ; + } + + if (i <= 0) + { + i = 25564; + } + + this.getNetworkSystem().addLanEndpoint((InetAddress)null, i); + logger.info("Started on " + i); + this.isPublic = true; + this.lanServerPing = new ThreadLanServerPing(this.getMOTD(), i + ""); + this.lanServerPing.start(); + this.getConfigurationManager().setGameType(type); + this.getConfigurationManager().setCommandsAllowedForAll(allowCheats); + return i + ""; + } + catch (IOException var6) + { + return null; + } + } + + /** + * Saves all necessary data as preparation for stopping the server. + */ + public void stopServer() + { + super.stopServer(); + + if (this.lanServerPing != null) + { + this.lanServerPing.interrupt(); + this.lanServerPing = null; + } + } + + /** + * Sets the serverRunning variable to false, in order to get the server to shut down. + */ + public void initiateShutdown() + { + Futures.getUnchecked(this.addScheduledTask(new Runnable() + { + private static final String __OBFID = "CL_00002380"; + public void run() + { + for (EntityPlayerMP entityplayermp : Lists.newArrayList(IntegratedServer.this.getConfigurationManager().func_181057_v())) + { + IntegratedServer.this.getConfigurationManager().playerLoggedOut(entityplayermp); + } + } + })); + super.initiateShutdown(); + + if (this.lanServerPing != null) + { + this.lanServerPing.interrupt(); + this.lanServerPing = null; + } + } + + public void setStaticInstance() + { + this.setInstance(); + } + + /** + * Returns true if this integrated server is open to LAN + */ + public boolean getPublic() + { + return this.isPublic; + } + + /** + * Sets the game type for all worlds. + */ + public void setGameType(WorldSettings.GameType gameMode) + { + this.getConfigurationManager().setGameType(gameMode); + } + + /** + * Return whether command blocks are enabled. + */ + public boolean isCommandBlockEnabled() + { + return true; + } + + public int getOpPermissionLevel() + { + return 4; + } +} diff --git a/src/minecraft/net/minecraft/server/integrated/IntegratedServerCommandManager.java b/src/minecraft/net/minecraft/server/integrated/IntegratedServerCommandManager.java new file mode 100644 index 0000000..b7b93f4 --- /dev/null +++ b/src/minecraft/net/minecraft/server/integrated/IntegratedServerCommandManager.java @@ -0,0 +1,7 @@ +package net.minecraft.server.integrated; + +import net.minecraft.command.ServerCommandManager; + +public class IntegratedServerCommandManager extends ServerCommandManager +{ +} diff --git a/src/minecraft/net/minecraft/server/management/BanEntry.java b/src/minecraft/net/minecraft/server/management/BanEntry.java new file mode 100644 index 0000000..dbbcf3a --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/BanEntry.java @@ -0,0 +1,78 @@ +package net.minecraft.server.management; + +import com.google.gson.JsonObject; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +public abstract class BanEntry extends UserListEntry +{ + public static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"); + protected final Date banStartDate; + protected final String bannedBy; + protected final Date banEndDate; + protected final String reason; + + public BanEntry(T valueIn, Date startDate, String banner, Date endDate, String banReason) + { + super(valueIn); + this.banStartDate = startDate == null ? new Date() : startDate; + this.bannedBy = banner == null ? "(Unknown)" : banner; + this.banEndDate = endDate; + this.reason = banReason == null ? "Banned by an operator." : banReason; + } + + protected BanEntry(T p_i1174_1_, JsonObject p_i1174_2_) + { + super(p_i1174_1_, p_i1174_2_); + Date date; + + try + { + date = p_i1174_2_.has("created") ? dateFormat.parse(p_i1174_2_.get("created").getAsString()) : new Date(); + } + catch (ParseException var7) + { + date = new Date(); + } + + this.banStartDate = date; + this.bannedBy = p_i1174_2_.has("source") ? p_i1174_2_.get("source").getAsString() : "(Unknown)"; + Date date1; + + try + { + date1 = p_i1174_2_.has("expires") ? dateFormat.parse(p_i1174_2_.get("expires").getAsString()) : null; + } + catch (ParseException var6) + { + date1 = null; + } + + this.banEndDate = date1; + this.reason = p_i1174_2_.has("reason") ? p_i1174_2_.get("reason").getAsString() : "Banned by an operator."; + } + + public Date getBanEndDate() + { + return this.banEndDate; + } + + public String getBanReason() + { + return this.reason; + } + + boolean hasBanExpired() + { + return this.banEndDate == null ? false : this.banEndDate.before(new Date()); + } + + protected void onSerialization(JsonObject data) + { + data.addProperty("created", dateFormat.format(this.banStartDate)); + data.addProperty("source", this.bannedBy); + data.addProperty("expires", this.banEndDate == null ? "forever" : dateFormat.format(this.banEndDate)); + data.addProperty("reason", this.reason); + } +} diff --git a/src/minecraft/net/minecraft/server/management/BanList.java b/src/minecraft/net/minecraft/server/management/BanList.java new file mode 100644 index 0000000..5988b8c --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/BanList.java @@ -0,0 +1,47 @@ +package net.minecraft.server.management; + +import com.google.gson.JsonObject; +import java.io.File; +import java.net.SocketAddress; + +public class BanList extends UserList +{ + public BanList(File bansFile) + { + super(bansFile); + } + + protected UserListEntry createEntry(JsonObject entryData) + { + return new IPBanEntry(entryData); + } + + public boolean isBanned(SocketAddress address) + { + String s = this.addressToString(address); + return this.hasEntry(s); + } + + public IPBanEntry getBanEntry(SocketAddress address) + { + String s = this.addressToString(address); + return (IPBanEntry)this.getEntry(s); + } + + private String addressToString(SocketAddress address) + { + String s = address.toString(); + + if (s.contains("/")) + { + s = s.substring(s.indexOf(47) + 1); + } + + if (s.contains(":")) + { + s = s.substring(0, s.indexOf(58)); + } + + return s; + } +} diff --git a/src/minecraft/net/minecraft/server/management/IPBanEntry.java b/src/minecraft/net/minecraft/server/management/IPBanEntry.java new file mode 100644 index 0000000..722800c --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/IPBanEntry.java @@ -0,0 +1,36 @@ +package net.minecraft.server.management; + +import com.google.gson.JsonObject; +import java.util.Date; + +public class IPBanEntry extends BanEntry +{ + public IPBanEntry(String p_i46330_1_) + { + this(p_i46330_1_, (Date)null, (String)null, (Date)null, (String)null); + } + + public IPBanEntry(String p_i1159_1_, Date startDate, String banner, Date endDate, String p_i1159_5_) + { + super(p_i1159_1_, startDate, banner, endDate, p_i1159_5_); + } + + public IPBanEntry(JsonObject p_i46331_1_) + { + super(getIPFromJson(p_i46331_1_), p_i46331_1_); + } + + private static String getIPFromJson(JsonObject json) + { + return json.has("ip") ? json.get("ip").getAsString() : null; + } + + protected void onSerialization(JsonObject data) + { + if (this.getValue() != null) + { + data.addProperty("ip", (String)this.getValue()); + super.onSerialization(data); + } + } +} diff --git a/src/minecraft/net/minecraft/server/management/ItemInWorldManager.java b/src/minecraft/net/minecraft/server/management/ItemInWorldManager.java new file mode 100644 index 0000000..913fdd4 --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/ItemInWorldManager.java @@ -0,0 +1,455 @@ +package net.minecraft.server.management; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockChest; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.network.play.server.S23PacketBlockChange; +import net.minecraft.network.play.server.S38PacketPlayerListItem; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.ILockableContainer; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.WorldSettings; + +public class ItemInWorldManager +{ + /** The world object that this object is connected to. */ + public World theWorld; + + /** The EntityPlayerMP object that this object is connected to. */ + public EntityPlayerMP thisPlayerMP; + private WorldSettings.GameType gameType = WorldSettings.GameType.NOT_SET; + + /** True if the player is destroying a block */ + private boolean isDestroyingBlock; + private int initialDamage; + private BlockPos field_180240_f = BlockPos.ORIGIN; + private int curblockDamage; + + /** + * Set to true when the "finished destroying block" packet is received but the block wasn't fully damaged yet. The + * block will not be destroyed while this is false. + */ + private boolean receivedFinishDiggingPacket; + private BlockPos field_180241_i = BlockPos.ORIGIN; + private int initialBlockDamage; + private int durabilityRemainingOnBlock = -1; + + public ItemInWorldManager(World worldIn) + { + this.theWorld = worldIn; + } + + public void setGameType(WorldSettings.GameType type) + { + this.gameType = type; + type.configurePlayerCapabilities(this.thisPlayerMP.capabilities); + this.thisPlayerMP.sendPlayerAbilities(); + this.thisPlayerMP.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.UPDATE_GAME_MODE, new EntityPlayerMP[] {this.thisPlayerMP})); + } + + public WorldSettings.GameType getGameType() + { + return this.gameType; + } + + public boolean survivalOrAdventure() + { + return this.gameType.isSurvivalOrAdventure(); + } + + /** + * Get if we are in creative game mode. + */ + public boolean isCreative() + { + return this.gameType.isCreative(); + } + + /** + * if the gameType is currently NOT_SET then change it to par1 + */ + public void initializeGameType(WorldSettings.GameType type) + { + if (this.gameType == WorldSettings.GameType.NOT_SET) + { + this.gameType = type; + } + + this.setGameType(this.gameType); + } + + public void updateBlockRemoving() + { + ++this.curblockDamage; + + if (this.receivedFinishDiggingPacket) + { + int i = this.curblockDamage - this.initialBlockDamage; + Block block = this.theWorld.getBlockState(this.field_180241_i).getBlock(); + + if (block.getMaterial() == Material.air) + { + this.receivedFinishDiggingPacket = false; + } + else + { + float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180241_i) * (float)(i + 1); + int j = (int)(f * 10.0F); + + if (j != this.durabilityRemainingOnBlock) + { + this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), this.field_180241_i, j); + this.durabilityRemainingOnBlock = j; + } + + if (f >= 1.0F) + { + this.receivedFinishDiggingPacket = false; + this.tryHarvestBlock(this.field_180241_i); + } + } + } + else if (this.isDestroyingBlock) + { + Block block1 = this.theWorld.getBlockState(this.field_180240_f).getBlock(); + + if (block1.getMaterial() == Material.air) + { + this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), this.field_180240_f, -1); + this.durabilityRemainingOnBlock = -1; + this.isDestroyingBlock = false; + } + else + { + int k = this.curblockDamage - this.initialDamage; + float f1 = block1.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.field_180241_i) * (float)(k + 1); + int l = (int)(f1 * 10.0F); + + if (l != this.durabilityRemainingOnBlock) + { + this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), this.field_180240_f, l); + this.durabilityRemainingOnBlock = l; + } + } + } + } + + /** + * If not creative, it calls sendBlockBreakProgress until the block is broken first. tryHarvestBlock can also be the + * result of this call. + */ + public void onBlockClicked(BlockPos pos, EnumFacing side) + { + if (this.isCreative()) + { + if (!this.theWorld.extinguishFire((EntityPlayer)null, pos, side)) + { + this.tryHarvestBlock(pos); + } + } + else + { + Block block = this.theWorld.getBlockState(pos).getBlock(); + + if (this.gameType.isAdventure()) + { + if (this.gameType == WorldSettings.GameType.SPECTATOR) + { + return; + } + + if (!this.thisPlayerMP.isAllowEdit()) + { + ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); + + if (itemstack == null) + { + return; + } + + if (!itemstack.canDestroy(block)) + { + return; + } + } + } + + this.theWorld.extinguishFire((EntityPlayer)null, pos, side); + this.initialDamage = this.curblockDamage; + float f = 1.0F; + + if (block.getMaterial() != Material.air) + { + block.onBlockClicked(this.theWorld, pos, this.thisPlayerMP); + f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos); + } + + if (block.getMaterial() != Material.air && f >= 1.0F) + { + this.tryHarvestBlock(pos); + } + else + { + this.isDestroyingBlock = true; + this.field_180240_f = pos; + int i = (int)(f * 10.0F); + this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), pos, i); + this.durabilityRemainingOnBlock = i; + } + } + } + + public void blockRemoving(BlockPos pos) + { + if (pos.equals(this.field_180240_f)) + { + int i = this.curblockDamage - this.initialDamage; + Block block = this.theWorld.getBlockState(pos).getBlock(); + + if (block.getMaterial() != Material.air) + { + float f = block.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, pos) * (float)(i + 1); + + if (f >= 0.7F) + { + this.isDestroyingBlock = false; + this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), pos, -1); + this.tryHarvestBlock(pos); + } + else if (!this.receivedFinishDiggingPacket) + { + this.isDestroyingBlock = false; + this.receivedFinishDiggingPacket = true; + this.field_180241_i = pos; + this.initialBlockDamage = this.initialDamage; + } + } + } + } + + /** + * Stops the block breaking process + */ + public void cancelDestroyingBlock() + { + this.isDestroyingBlock = false; + this.theWorld.sendBlockBreakProgress(this.thisPlayerMP.getEntityId(), this.field_180240_f, -1); + } + + /** + * Removes a block and triggers the appropriate events + */ + private boolean removeBlock(BlockPos pos) + { + IBlockState iblockstate = this.theWorld.getBlockState(pos); + iblockstate.getBlock().onBlockHarvested(this.theWorld, pos, iblockstate, this.thisPlayerMP); + boolean flag = this.theWorld.setBlockToAir(pos); + + if (flag) + { + iblockstate.getBlock().onBlockDestroyedByPlayer(this.theWorld, pos, iblockstate); + } + + return flag; + } + + /** + * Attempts to harvest a block + */ + public boolean tryHarvestBlock(BlockPos pos) + { + if (this.gameType.isCreative() && this.thisPlayerMP.getHeldItem() != null && this.thisPlayerMP.getHeldItem().getItem() instanceof ItemSword) + { + return false; + } + else + { + IBlockState iblockstate = this.theWorld.getBlockState(pos); + TileEntity tileentity = this.theWorld.getTileEntity(pos); + + if (this.gameType.isAdventure()) + { + if (this.gameType == WorldSettings.GameType.SPECTATOR) + { + return false; + } + + if (!this.thisPlayerMP.isAllowEdit()) + { + ItemStack itemstack = this.thisPlayerMP.getCurrentEquippedItem(); + + if (itemstack == null) + { + return false; + } + + if (!itemstack.canDestroy(iblockstate.getBlock())) + { + return false; + } + } + } + + this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, pos, Block.getStateId(iblockstate)); + boolean flag1 = this.removeBlock(pos); + + if (this.isCreative()) + { + this.thisPlayerMP.playerNetServerHandler.sendPacket(new S23PacketBlockChange(this.theWorld, pos)); + } + else + { + ItemStack itemstack1 = this.thisPlayerMP.getCurrentEquippedItem(); + boolean flag = this.thisPlayerMP.canHarvestBlock(iblockstate.getBlock()); + + if (itemstack1 != null) + { + itemstack1.onBlockDestroyed(this.theWorld, iblockstate.getBlock(), pos, this.thisPlayerMP); + + if (itemstack1.stackSize == 0) + { + this.thisPlayerMP.destroyCurrentEquippedItem(); + } + } + + if (flag1 && flag) + { + iblockstate.getBlock().harvestBlock(this.theWorld, this.thisPlayerMP, pos, iblockstate, tileentity); + } + } + + return flag1; + } + } + + /** + * Attempts to right-click use an item by the given EntityPlayer in the given World + */ + public boolean tryUseItem(EntityPlayer player, World worldIn, ItemStack stack) + { + if (this.gameType == WorldSettings.GameType.SPECTATOR) + { + return false; + } + else + { + int i = stack.stackSize; + int j = stack.getMetadata(); + ItemStack itemstack = stack.useItemRightClick(worldIn, player); + + if (itemstack != stack || itemstack != null && (itemstack.stackSize != i || itemstack.getMaxItemUseDuration() > 0 || itemstack.getMetadata() != j)) + { + player.inventory.mainInventory[player.inventory.currentItem] = itemstack; + + if (this.isCreative()) + { + itemstack.stackSize = i; + + if (itemstack.isItemStackDamageable()) + { + itemstack.setItemDamage(j); + } + } + + if (itemstack.stackSize == 0) + { + player.inventory.mainInventory[player.inventory.currentItem] = null; + } + + if (!player.isUsingItem()) + { + ((EntityPlayerMP)player).sendContainerToPlayer(player.inventoryContainer); + } + + return true; + } + else + { + return false; + } + } + } + + /** + * Activate the clicked on block, otherwise use the held item. + */ + public boolean activateBlockOrUseItem(EntityPlayer player, World worldIn, ItemStack stack, BlockPos pos, EnumFacing side, float offsetX, float offsetY, float offsetZ) + { + if (this.gameType == WorldSettings.GameType.SPECTATOR) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof ILockableContainer) + { + Block block = worldIn.getBlockState(pos).getBlock(); + ILockableContainer ilockablecontainer = (ILockableContainer)tileentity; + + if (ilockablecontainer instanceof TileEntityChest && block instanceof BlockChest) + { + ilockablecontainer = ((BlockChest)block).getLockableContainer(worldIn, pos); + } + + if (ilockablecontainer != null) + { + player.displayGUIChest(ilockablecontainer); + return true; + } + } + else if (tileentity instanceof IInventory) + { + player.displayGUIChest((IInventory)tileentity); + return true; + } + + return false; + } + else + { + if (!player.isSneaking() || player.getHeldItem() == null) + { + IBlockState iblockstate = worldIn.getBlockState(pos); + + if (iblockstate.getBlock().onBlockActivated(worldIn, pos, iblockstate, player, side, offsetX, offsetY, offsetZ)) + { + return true; + } + } + + if (stack == null) + { + return false; + } + else if (this.isCreative()) + { + int j = stack.getMetadata(); + int i = stack.stackSize; + boolean flag = stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); + stack.setItemDamage(j); + stack.stackSize = i; + return flag; + } + else + { + return stack.onItemUse(player, worldIn, pos, side, offsetX, offsetY, offsetZ); + } + } + } + + /** + * Sets the world instance. + */ + public void setWorld(WorldServer serverWorld) + { + this.theWorld = serverWorld; + } +} diff --git a/src/minecraft/net/minecraft/server/management/LowerStringMap.java b/src/minecraft/net/minecraft/server/management/LowerStringMap.java new file mode 100644 index 0000000..ba99178 --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/LowerStringMap.java @@ -0,0 +1,75 @@ +package net.minecraft.server.management; + +import com.google.common.collect.Maps; +import java.util.Collection; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; + +public class LowerStringMap implements Map +{ + private final Map internalMap = Maps.newLinkedHashMap(); + + public int size() + { + return this.internalMap.size(); + } + + public boolean isEmpty() + { + return this.internalMap.isEmpty(); + } + + public boolean containsKey(Object p_containsKey_1_) + { + return this.internalMap.containsKey(p_containsKey_1_.toString().toLowerCase()); + } + + public boolean containsValue(Object p_containsValue_1_) + { + return this.internalMap.containsKey(p_containsValue_1_); + } + + public V get(Object p_get_1_) + { + return this.internalMap.get(p_get_1_.toString().toLowerCase()); + } + + public V put(String p_put_1_, V p_put_2_) + { + return this.internalMap.put(p_put_1_.toLowerCase(), p_put_2_); + } + + public V remove(Object p_remove_1_) + { + return this.internalMap.remove(p_remove_1_.toString().toLowerCase()); + } + + public void putAll(Map p_putAll_1_) + { + for (Entry entry : p_putAll_1_.entrySet()) + { + this.put((String)entry.getKey(), entry.getValue()); + } + } + + public void clear() + { + this.internalMap.clear(); + } + + public Set keySet() + { + return this.internalMap.keySet(); + } + + public Collection values() + { + return this.internalMap.values(); + } + + public Set> entrySet() + { + return this.internalMap.entrySet(); + } +} diff --git a/src/minecraft/net/minecraft/server/management/PlayerManager.java b/src/minecraft/net/minecraft/server/management/PlayerManager.java new file mode 100644 index 0000000..4732075 --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/PlayerManager.java @@ -0,0 +1,539 @@ +package net.minecraft.server.management; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S21PacketChunkData; +import net.minecraft.network.play.server.S22PacketMultiBlockChange; +import net.minecraft.network.play.server.S23PacketBlockChange; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.LongHashMap; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class PlayerManager +{ + private static final Logger pmLogger = LogManager.getLogger(); + private final WorldServer theWorldServer; + private final List players = Lists.newArrayList(); + private final LongHashMap playerInstances = new LongHashMap(); + private final List playerInstancesToUpdate = Lists.newArrayList(); + private final List playerInstanceList = Lists.newArrayList(); + + /** + * Number of chunks the server sends to the client. Valid 3<=x<=15. In server.properties. + */ + private int playerViewRadius; + + /** time what is using to check if InhabitedTime should be calculated */ + private long previousTotalWorldTime; + + /** x, z direction vectors: east, south, west, north */ + private final int[][] xzDirectionsConst = new int[][] {{1, 0}, {0, 1}, { -1, 0}, {0, -1}}; + + public PlayerManager(WorldServer serverWorld) + { + this.theWorldServer = serverWorld; + this.setPlayerViewRadius(serverWorld.getMinecraftServer().getConfigurationManager().getViewDistance()); + } + + /** + * Returns the WorldServer associated with this PlayerManager + */ + public WorldServer getWorldServer() + { + return this.theWorldServer; + } + + /** + * updates all the player instances that need to be updated + */ + public void updatePlayerInstances() + { + long i = this.theWorldServer.getTotalWorldTime(); + + if (i - this.previousTotalWorldTime > 8000L) + { + this.previousTotalWorldTime = i; + + for (int j = 0; j < this.playerInstanceList.size(); ++j) + { + PlayerManager.PlayerInstance playermanager$playerinstance = (PlayerManager.PlayerInstance)this.playerInstanceList.get(j); + playermanager$playerinstance.onUpdate(); + playermanager$playerinstance.processChunk(); + } + } + else + { + for (int k = 0; k < this.playerInstancesToUpdate.size(); ++k) + { + PlayerManager.PlayerInstance playermanager$playerinstance1 = (PlayerManager.PlayerInstance)this.playerInstancesToUpdate.get(k); + playermanager$playerinstance1.onUpdate(); + } + } + + this.playerInstancesToUpdate.clear(); + + if (this.players.isEmpty()) + { + WorldProvider worldprovider = this.theWorldServer.provider; + + if (!worldprovider.canRespawnHere()) + { + this.theWorldServer.theChunkProviderServer.unloadAllChunks(); + } + } + } + + public boolean hasPlayerInstance(int chunkX, int chunkZ) + { + long i = (long)chunkX + 2147483647L | (long)chunkZ + 2147483647L << 32; + return this.playerInstances.getValueByKey(i) != null; + } + + /** + * passi n the chunk x and y and a flag as to whether or not the instance should be made if it doesnt exist + */ + private PlayerManager.PlayerInstance getPlayerInstance(int chunkX, int chunkZ, boolean createIfAbsent) + { + long i = (long)chunkX + 2147483647L | (long)chunkZ + 2147483647L << 32; + PlayerManager.PlayerInstance playermanager$playerinstance = (PlayerManager.PlayerInstance)this.playerInstances.getValueByKey(i); + + if (playermanager$playerinstance == null && createIfAbsent) + { + playermanager$playerinstance = new PlayerManager.PlayerInstance(chunkX, chunkZ); + this.playerInstances.add(i, playermanager$playerinstance); + this.playerInstanceList.add(playermanager$playerinstance); + } + + return playermanager$playerinstance; + } + + public void markBlockForUpdate(BlockPos pos) + { + int i = pos.getX() >> 4; + int j = pos.getZ() >> 4; + PlayerManager.PlayerInstance playermanager$playerinstance = this.getPlayerInstance(i, j, false); + + if (playermanager$playerinstance != null) + { + playermanager$playerinstance.flagChunkForUpdate(pos.getX() & 15, pos.getY(), pos.getZ() & 15); + } + } + + /** + * Adds an EntityPlayerMP to the PlayerManager and to all player instances within player visibility + */ + public void addPlayer(EntityPlayerMP player) + { + int i = (int)player.posX >> 4; + int j = (int)player.posZ >> 4; + player.managedPosX = player.posX; + player.managedPosZ = player.posZ; + + for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k) + { + for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l) + { + this.getPlayerInstance(k, l, true).addPlayer(player); + } + } + + this.players.add(player); + this.filterChunkLoadQueue(player); + } + + /** + * Removes all chunks from the given player's chunk load queue that are not in viewing range of the player. + */ + public void filterChunkLoadQueue(EntityPlayerMP player) + { + List list = Lists.newArrayList(player.loadedChunks); + int i = 0; + int j = this.playerViewRadius; + int k = (int)player.posX >> 4; + int l = (int)player.posZ >> 4; + int i1 = 0; + int j1 = 0; + ChunkCoordIntPair chunkcoordintpair = this.getPlayerInstance(k, l, true).chunkCoords; + player.loadedChunks.clear(); + + if (list.contains(chunkcoordintpair)) + { + player.loadedChunks.add(chunkcoordintpair); + } + + for (int k1 = 1; k1 <= j * 2; ++k1) + { + for (int l1 = 0; l1 < 2; ++l1) + { + int[] aint = this.xzDirectionsConst[i++ % 4]; + + for (int i2 = 0; i2 < k1; ++i2) + { + i1 += aint[0]; + j1 += aint[1]; + chunkcoordintpair = this.getPlayerInstance(k + i1, l + j1, true).chunkCoords; + + if (list.contains(chunkcoordintpair)) + { + player.loadedChunks.add(chunkcoordintpair); + } + } + } + } + + i = i % 4; + + for (int j2 = 0; j2 < j * 2; ++j2) + { + i1 += this.xzDirectionsConst[i][0]; + j1 += this.xzDirectionsConst[i][1]; + chunkcoordintpair = this.getPlayerInstance(k + i1, l + j1, true).chunkCoords; + + if (list.contains(chunkcoordintpair)) + { + player.loadedChunks.add(chunkcoordintpair); + } + } + } + + /** + * Removes an EntityPlayerMP from the PlayerManager. + */ + public void removePlayer(EntityPlayerMP player) + { + int i = (int)player.managedPosX >> 4; + int j = (int)player.managedPosZ >> 4; + + for (int k = i - this.playerViewRadius; k <= i + this.playerViewRadius; ++k) + { + for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l) + { + PlayerManager.PlayerInstance playermanager$playerinstance = this.getPlayerInstance(k, l, false); + + if (playermanager$playerinstance != null) + { + playermanager$playerinstance.removePlayer(player); + } + } + } + + this.players.remove(player); + } + + /** + * Determine if two rectangles centered at the given points overlap for the provided radius. Arguments: x1, z1, x2, + * z2, radius. + */ + private boolean overlaps(int x1, int z1, int x2, int z2, int radius) + { + int i = x1 - x2; + int j = z1 - z2; + return i >= -radius && i <= radius ? j >= -radius && j <= radius : false; + } + + /** + * update chunks around a player being moved by server logic (e.g. cart, boat) + */ + public void updateMountedMovingPlayer(EntityPlayerMP player) + { + int i = (int)player.posX >> 4; + int j = (int)player.posZ >> 4; + double d0 = player.managedPosX - player.posX; + double d1 = player.managedPosZ - player.posZ; + double d2 = d0 * d0 + d1 * d1; + + if (d2 >= 64.0D) + { + int k = (int)player.managedPosX >> 4; + int l = (int)player.managedPosZ >> 4; + int i1 = this.playerViewRadius; + int j1 = i - k; + int k1 = j - l; + + if (j1 != 0 || k1 != 0) + { + for (int l1 = i - i1; l1 <= i + i1; ++l1) + { + for (int i2 = j - i1; i2 <= j + i1; ++i2) + { + if (!this.overlaps(l1, i2, k, l, i1)) + { + this.getPlayerInstance(l1, i2, true).addPlayer(player); + } + + if (!this.overlaps(l1 - j1, i2 - k1, i, j, i1)) + { + PlayerManager.PlayerInstance playermanager$playerinstance = this.getPlayerInstance(l1 - j1, i2 - k1, false); + + if (playermanager$playerinstance != null) + { + playermanager$playerinstance.removePlayer(player); + } + } + } + } + + this.filterChunkLoadQueue(player); + player.managedPosX = player.posX; + player.managedPosZ = player.posZ; + } + } + } + + public boolean isPlayerWatchingChunk(EntityPlayerMP player, int chunkX, int chunkZ) + { + PlayerManager.PlayerInstance playermanager$playerinstance = this.getPlayerInstance(chunkX, chunkZ, false); + return playermanager$playerinstance != null && playermanager$playerinstance.playersWatchingChunk.contains(player) && !player.loadedChunks.contains(playermanager$playerinstance.chunkCoords); + } + + public void setPlayerViewRadius(int radius) + { + radius = MathHelper.clamp_int(radius, 3, 32); + + if (radius != this.playerViewRadius) + { + int i = radius - this.playerViewRadius; + + for (EntityPlayerMP entityplayermp : Lists.newArrayList(this.players)) + { + int j = (int)entityplayermp.posX >> 4; + int k = (int)entityplayermp.posZ >> 4; + + if (i > 0) + { + for (int j1 = j - radius; j1 <= j + radius; ++j1) + { + for (int k1 = k - radius; k1 <= k + radius; ++k1) + { + PlayerManager.PlayerInstance playermanager$playerinstance = this.getPlayerInstance(j1, k1, true); + + if (!playermanager$playerinstance.playersWatchingChunk.contains(entityplayermp)) + { + playermanager$playerinstance.addPlayer(entityplayermp); + } + } + } + } + else + { + for (int l = j - this.playerViewRadius; l <= j + this.playerViewRadius; ++l) + { + for (int i1 = k - this.playerViewRadius; i1 <= k + this.playerViewRadius; ++i1) + { + if (!this.overlaps(l, i1, j, k, radius)) + { + this.getPlayerInstance(l, i1, true).removePlayer(entityplayermp); + } + } + } + } + } + + this.playerViewRadius = radius; + } + } + + /** + * Get the furthest viewable block given player's view distance + */ + public static int getFurthestViewableBlock(int distance) + { + return distance * 16 - 16; + } + + class PlayerInstance + { + private final List playersWatchingChunk = Lists.newArrayList(); + private final ChunkCoordIntPair chunkCoords; + private short[] locationOfBlockChange = new short[64]; + private int numBlocksToUpdate; + private int flagsYAreasToUpdate; + private long previousWorldTime; + + public PlayerInstance(int chunkX, int chunkZ) + { + this.chunkCoords = new ChunkCoordIntPair(chunkX, chunkZ); + PlayerManager.this.getWorldServer().theChunkProviderServer.loadChunk(chunkX, chunkZ); + } + + public void addPlayer(EntityPlayerMP player) + { + if (this.playersWatchingChunk.contains(player)) + { + PlayerManager.pmLogger.debug("Failed to add player. {} already is in chunk {}, {}", new Object[] {player, Integer.valueOf(this.chunkCoords.chunkXPos), Integer.valueOf(this.chunkCoords.chunkZPos)}); + } + else + { + if (this.playersWatchingChunk.isEmpty()) + { + this.previousWorldTime = PlayerManager.this.theWorldServer.getTotalWorldTime(); + } + + this.playersWatchingChunk.add(player); + player.loadedChunks.add(this.chunkCoords); + } + } + + public void removePlayer(EntityPlayerMP player) + { + if (this.playersWatchingChunk.contains(player)) + { + Chunk chunk = PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); + + if (chunk.isPopulated()) + { + player.playerNetServerHandler.sendPacket(new S21PacketChunkData(chunk, true, 0)); + } + + this.playersWatchingChunk.remove(player); + player.loadedChunks.remove(this.chunkCoords); + + if (this.playersWatchingChunk.isEmpty()) + { + long i = (long)this.chunkCoords.chunkXPos + 2147483647L | (long)this.chunkCoords.chunkZPos + 2147483647L << 32; + this.increaseInhabitedTime(chunk); + PlayerManager.this.playerInstances.remove(i); + PlayerManager.this.playerInstanceList.remove(this); + + if (this.numBlocksToUpdate > 0) + { + PlayerManager.this.playerInstancesToUpdate.remove(this); + } + + PlayerManager.this.getWorldServer().theChunkProviderServer.dropChunk(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos); + } + } + } + + public void processChunk() + { + this.increaseInhabitedTime(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos)); + } + + private void increaseInhabitedTime(Chunk theChunk) + { + theChunk.setInhabitedTime(theChunk.getInhabitedTime() + PlayerManager.this.theWorldServer.getTotalWorldTime() - this.previousWorldTime); + this.previousWorldTime = PlayerManager.this.theWorldServer.getTotalWorldTime(); + } + + public void flagChunkForUpdate(int x, int y, int z) + { + if (this.numBlocksToUpdate == 0) + { + PlayerManager.this.playerInstancesToUpdate.add(this); + } + + this.flagsYAreasToUpdate |= 1 << (y >> 4); + + if (this.numBlocksToUpdate < 64) + { + short short1 = (short)(x << 12 | z << 8 | y); + + for (int i = 0; i < this.numBlocksToUpdate; ++i) + { + if (this.locationOfBlockChange[i] == short1) + { + return; + } + } + + this.locationOfBlockChange[this.numBlocksToUpdate++] = short1; + } + } + + public void sendToAllPlayersWatchingChunk(Packet thePacket) + { + for (int i = 0; i < this.playersWatchingChunk.size(); ++i) + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playersWatchingChunk.get(i); + + if (!entityplayermp.loadedChunks.contains(this.chunkCoords)) + { + entityplayermp.playerNetServerHandler.sendPacket(thePacket); + } + } + } + + public void onUpdate() + { + if (this.numBlocksToUpdate != 0) + { + if (this.numBlocksToUpdate == 1) + { + int i = (this.locationOfBlockChange[0] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; + int j = this.locationOfBlockChange[0] & 255; + int k = (this.locationOfBlockChange[0] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; + BlockPos blockpos = new BlockPos(i, j, k); + this.sendToAllPlayersWatchingChunk(new S23PacketBlockChange(PlayerManager.this.theWorldServer, blockpos)); + + if (PlayerManager.this.theWorldServer.getBlockState(blockpos).getBlock().hasTileEntity()) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos)); + } + } + else if (this.numBlocksToUpdate == 64) + { + int i1 = this.chunkCoords.chunkXPos * 16; + int k1 = this.chunkCoords.chunkZPos * 16; + this.sendToAllPlayersWatchingChunk(new S21PacketChunkData(PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos), false, this.flagsYAreasToUpdate)); + + for (int i2 = 0; i2 < 16; ++i2) + { + if ((this.flagsYAreasToUpdate & 1 << i2) != 0) + { + int k2 = i2 << 4; + List list = PlayerManager.this.theWorldServer.getTileEntitiesIn(i1, k2, k1, i1 + 16, k2 + 16, k1 + 16); + + for (int l = 0; l < list.size(); ++l) + { + this.sendTileToAllPlayersWatchingChunk((TileEntity)list.get(l)); + } + } + } + } + else + { + this.sendToAllPlayersWatchingChunk(new S22PacketMultiBlockChange(this.numBlocksToUpdate, this.locationOfBlockChange, PlayerManager.this.theWorldServer.getChunkFromChunkCoords(this.chunkCoords.chunkXPos, this.chunkCoords.chunkZPos))); + + for (int j1 = 0; j1 < this.numBlocksToUpdate; ++j1) + { + int l1 = (this.locationOfBlockChange[j1] >> 12 & 15) + this.chunkCoords.chunkXPos * 16; + int j2 = this.locationOfBlockChange[j1] & 255; + int l2 = (this.locationOfBlockChange[j1] >> 8 & 15) + this.chunkCoords.chunkZPos * 16; + BlockPos blockpos1 = new BlockPos(l1, j2, l2); + + if (PlayerManager.this.theWorldServer.getBlockState(blockpos1).getBlock().hasTileEntity()) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.this.theWorldServer.getTileEntity(blockpos1)); + } + } + } + + this.numBlocksToUpdate = 0; + this.flagsYAreasToUpdate = 0; + } + } + + private void sendTileToAllPlayersWatchingChunk(TileEntity theTileEntity) + { + if (theTileEntity != null) + { + Packet packet = theTileEntity.getDescriptionPacket(); + + if (packet != null) + { + this.sendToAllPlayersWatchingChunk(packet); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/server/management/PlayerProfileCache.java b/src/minecraft/net/minecraft/server/management/PlayerProfileCache.java new file mode 100644 index 0000000..5e0e7fd --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/PlayerProfileCache.java @@ -0,0 +1,401 @@ +package net.minecraft.server.management; + +import com.google.common.base.Charsets; +import com.google.common.collect.Iterators; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.io.Files; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.mojang.authlib.Agent; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.ProfileLookupCallback; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.UUID; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import org.apache.commons.io.IOUtils; + +public class PlayerProfileCache +{ + public static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"); + private final Map usernameToProfileEntryMap = Maps.newHashMap(); + private final Map uuidToProfileEntryMap = Maps.newHashMap(); + private final LinkedList gameProfiles = Lists.newLinkedList(); + private final MinecraftServer mcServer; + protected final Gson gson; + private final File usercacheFile; + private static final ParameterizedType TYPE = new ParameterizedType() + { + public Type[] getActualTypeArguments() + { + return new Type[] {PlayerProfileCache.ProfileEntry.class}; + } + public Type getRawType() + { + return List.class; + } + public Type getOwnerType() + { + return null; + } + }; + + public PlayerProfileCache(MinecraftServer server, File cacheFile) + { + this.mcServer = server; + this.usercacheFile = cacheFile; + GsonBuilder gsonbuilder = new GsonBuilder(); + gsonbuilder.registerTypeHierarchyAdapter(PlayerProfileCache.ProfileEntry.class, new PlayerProfileCache.Serializer()); + this.gson = gsonbuilder.create(); + this.load(); + } + + /** + * Get a GameProfile given the MinecraftServer and the player's username. + + * The UUID of the GameProfile will not be null. If the server is offline, a UUID based on the hash of the + * username will be used. + */ + private static GameProfile getGameProfile(MinecraftServer server, String username) + { + final GameProfile[] agameprofile = new GameProfile[1]; + ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback() + { + public void onProfileLookupSucceeded(GameProfile p_onProfileLookupSucceeded_1_) + { + agameprofile[0] = p_onProfileLookupSucceeded_1_; + } + public void onProfileLookupFailed(GameProfile p_onProfileLookupFailed_1_, Exception p_onProfileLookupFailed_2_) + { + agameprofile[0] = null; + } + }; + server.getGameProfileRepository().findProfilesByNames(new String[] {username}, Agent.MINECRAFT, profilelookupcallback); + + if (!server.isServerInOnlineMode() && agameprofile[0] == null) + { + UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, username)); + GameProfile gameprofile = new GameProfile(uuid, username); + profilelookupcallback.onProfileLookupSucceeded(gameprofile); + } + + return agameprofile[0]; + } + + /** + * Add an entry to this cache + */ + public void addEntry(GameProfile gameProfile) + { + this.addEntry(gameProfile, (Date)null); + } + + /** + * Add an entry to this cache + */ + private void addEntry(GameProfile gameProfile, Date expirationDate) + { + UUID uuid = gameProfile.getId(); + + if (expirationDate == null) + { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.add(2, 1); + expirationDate = calendar.getTime(); + } + + String s = gameProfile.getName().toLowerCase(Locale.ROOT); + PlayerProfileCache.ProfileEntry playerprofilecache$profileentry = new PlayerProfileCache.ProfileEntry(gameProfile, expirationDate); + + if (this.uuidToProfileEntryMap.containsKey(uuid)) + { + PlayerProfileCache.ProfileEntry playerprofilecache$profileentry1 = (PlayerProfileCache.ProfileEntry)this.uuidToProfileEntryMap.get(uuid); + this.usernameToProfileEntryMap.remove(playerprofilecache$profileentry1.getGameProfile().getName().toLowerCase(Locale.ROOT)); + this.gameProfiles.remove(gameProfile); + } + + this.usernameToProfileEntryMap.put(gameProfile.getName().toLowerCase(Locale.ROOT), playerprofilecache$profileentry); + this.uuidToProfileEntryMap.put(uuid, playerprofilecache$profileentry); + this.gameProfiles.addFirst(gameProfile); + this.save(); + } + + /** + * Get a player's GameProfile given their username. Mojang's server's will be contacted if the entry is not cached + * locally. + */ + public GameProfile getGameProfileForUsername(String username) + { + String s = username.toLowerCase(Locale.ROOT); + PlayerProfileCache.ProfileEntry playerprofilecache$profileentry = (PlayerProfileCache.ProfileEntry)this.usernameToProfileEntryMap.get(s); + + if (playerprofilecache$profileentry != null && (new Date()).getTime() >= playerprofilecache$profileentry.expirationDate.getTime()) + { + this.uuidToProfileEntryMap.remove(playerprofilecache$profileentry.getGameProfile().getId()); + this.usernameToProfileEntryMap.remove(playerprofilecache$profileentry.getGameProfile().getName().toLowerCase(Locale.ROOT)); + this.gameProfiles.remove(playerprofilecache$profileentry.getGameProfile()); + playerprofilecache$profileentry = null; + } + + if (playerprofilecache$profileentry != null) + { + GameProfile gameprofile = playerprofilecache$profileentry.getGameProfile(); + this.gameProfiles.remove(gameprofile); + this.gameProfiles.addFirst(gameprofile); + } + else + { + GameProfile gameprofile1 = getGameProfile(this.mcServer, s); + + if (gameprofile1 != null) + { + this.addEntry(gameprofile1); + playerprofilecache$profileentry = (PlayerProfileCache.ProfileEntry)this.usernameToProfileEntryMap.get(s); + } + } + + this.save(); + return playerprofilecache$profileentry == null ? null : playerprofilecache$profileentry.getGameProfile(); + } + + /** + * Get an array of the usernames that are cached in this cache + */ + public String[] getUsernames() + { + List list = Lists.newArrayList(this.usernameToProfileEntryMap.keySet()); + return (String[])list.toArray(new String[list.size()]); + } + + /** + * Get a player's {@link GameProfile} given their UUID + */ + public GameProfile getProfileByUUID(UUID uuid) + { + PlayerProfileCache.ProfileEntry playerprofilecache$profileentry = (PlayerProfileCache.ProfileEntry)this.uuidToProfileEntryMap.get(uuid); + return playerprofilecache$profileentry == null ? null : playerprofilecache$profileentry.getGameProfile(); + } + + /** + * Get a {@link ProfileEntry} by UUID + */ + private PlayerProfileCache.ProfileEntry getByUUID(UUID uuid) + { + PlayerProfileCache.ProfileEntry playerprofilecache$profileentry = (PlayerProfileCache.ProfileEntry)this.uuidToProfileEntryMap.get(uuid); + + if (playerprofilecache$profileentry != null) + { + GameProfile gameprofile = playerprofilecache$profileentry.getGameProfile(); + this.gameProfiles.remove(gameprofile); + this.gameProfiles.addFirst(gameprofile); + } + + return playerprofilecache$profileentry; + } + + /** + * Load the cached profiles from disk + */ + public void load() + { + BufferedReader bufferedreader = null; + + try + { + bufferedreader = Files.newReader(this.usercacheFile, Charsets.UTF_8); + List list = (List)this.gson.fromJson((Reader)bufferedreader, TYPE); + this.usernameToProfileEntryMap.clear(); + this.uuidToProfileEntryMap.clear(); + this.gameProfiles.clear(); + + for (PlayerProfileCache.ProfileEntry playerprofilecache$profileentry : Lists.reverse(list)) + { + if (playerprofilecache$profileentry != null) + { + this.addEntry(playerprofilecache$profileentry.getGameProfile(), playerprofilecache$profileentry.getExpirationDate()); + } + } + } + catch (FileNotFoundException var9) + { + ; + } + catch (JsonParseException var10) + { + ; + } + finally + { + IOUtils.closeQuietly((Reader)bufferedreader); + } + } + + /** + * Save the cached profiles to disk + */ + public void save() + { + String s = this.gson.toJson((Object)this.getEntriesWithLimit(1000)); + BufferedWriter bufferedwriter = null; + + try + { + bufferedwriter = Files.newWriter(this.usercacheFile, Charsets.UTF_8); + bufferedwriter.write(s); + return; + } + catch (FileNotFoundException var8) + { + ; + } + catch (IOException var9) + { + return; + } + finally + { + IOUtils.closeQuietly((Writer)bufferedwriter); + } + } + + private List getEntriesWithLimit(int limitSize) + { + ArrayList arraylist = Lists.newArrayList(); + + for (GameProfile gameprofile : Lists.newArrayList(Iterators.limit(this.gameProfiles.iterator(), limitSize))) + { + PlayerProfileCache.ProfileEntry playerprofilecache$profileentry = this.getByUUID(gameprofile.getId()); + + if (playerprofilecache$profileentry != null) + { + arraylist.add(playerprofilecache$profileentry); + } + } + + return arraylist; + } + + class ProfileEntry + { + private final GameProfile gameProfile; + private final Date expirationDate; + + private ProfileEntry(GameProfile gameProfileIn, Date expirationDateIn) + { + this.gameProfile = gameProfileIn; + this.expirationDate = expirationDateIn; + } + + public GameProfile getGameProfile() + { + return this.gameProfile; + } + + public Date getExpirationDate() + { + return this.expirationDate; + } + } + + class Serializer implements JsonDeserializer, JsonSerializer + { + private Serializer() + { + } + + public JsonElement serialize(PlayerProfileCache.ProfileEntry p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) + { + JsonObject jsonobject = new JsonObject(); + jsonobject.addProperty("name", p_serialize_1_.getGameProfile().getName()); + UUID uuid = p_serialize_1_.getGameProfile().getId(); + jsonobject.addProperty("uuid", uuid == null ? "" : uuid.toString()); + jsonobject.addProperty("expiresOn", PlayerProfileCache.dateFormat.format(p_serialize_1_.getExpirationDate())); + return jsonobject; + } + + public PlayerProfileCache.ProfileEntry deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + if (p_deserialize_1_.isJsonObject()) + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + JsonElement jsonelement = jsonobject.get("name"); + JsonElement jsonelement1 = jsonobject.get("uuid"); + JsonElement jsonelement2 = jsonobject.get("expiresOn"); + + if (jsonelement != null && jsonelement1 != null) + { + String s = jsonelement1.getAsString(); + String s1 = jsonelement.getAsString(); + Date date = null; + + if (jsonelement2 != null) + { + try + { + date = PlayerProfileCache.dateFormat.parse(jsonelement2.getAsString()); + } + catch (ParseException var14) + { + date = null; + } + } + + if (s1 != null && s != null) + { + UUID uuid; + + try + { + uuid = UUID.fromString(s); + } + catch (Throwable var13) + { + return null; + } + + PlayerProfileCache.ProfileEntry playerprofilecache$profileentry = PlayerProfileCache.this.new ProfileEntry(new GameProfile(uuid, s1), date); + return playerprofilecache$profileentry; + } + else + { + return null; + } + } + else + { + return null; + } + } + else + { + return null; + } + } + } +} diff --git a/src/minecraft/net/minecraft/server/management/PreYggdrasilConverter.java b/src/minecraft/net/minecraft/server/management/PreYggdrasilConverter.java new file mode 100644 index 0000000..07793a7 --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/PreYggdrasilConverter.java @@ -0,0 +1,91 @@ +package net.minecraft.server.management; + +import com.google.common.base.Predicate; +import com.google.common.collect.Iterators; +import com.google.common.collect.Lists; +import com.mojang.authlib.Agent; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.ProfileLookupCallback; +import java.io.File; +import java.util.Collection; +import java.util.List; +import java.util.UUID; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class PreYggdrasilConverter +{ + private static final Logger LOGGER = LogManager.getLogger(); + public static final File OLD_IPBAN_FILE = new File("banned-ips.txt"); + public static final File OLD_PLAYERBAN_FILE = new File("banned-players.txt"); + public static final File OLD_OPS_FILE = new File("ops.txt"); + public static final File OLD_WHITELIST_FILE = new File("white-list.txt"); + + private static void lookupNames(MinecraftServer server, Collection names, ProfileLookupCallback callback) + { + String[] astring = (String[])Iterators.toArray(Iterators.filter(names.iterator(), new Predicate() + { + public boolean apply(String p_apply_1_) + { + return !StringUtils.isNullOrEmpty(p_apply_1_); + } + }), String.class); + + if (server.isServerInOnlineMode()) + { + server.getGameProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, callback); + } + else + { + for (String s : astring) + { + UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, s)); + GameProfile gameprofile = new GameProfile(uuid, s); + callback.onProfileLookupSucceeded(gameprofile); + } + } + } + + public static String getStringUUIDFromName(String p_152719_0_) + { + if (!StringUtils.isNullOrEmpty(p_152719_0_) && p_152719_0_.length() <= 16) + { + final MinecraftServer minecraftserver = MinecraftServer.getServer(); + GameProfile gameprofile = minecraftserver.getPlayerProfileCache().getGameProfileForUsername(p_152719_0_); + + if (gameprofile != null && gameprofile.getId() != null) + { + return gameprofile.getId().toString(); + } + else if (!minecraftserver.isSinglePlayer() && minecraftserver.isServerInOnlineMode()) + { + final List list = Lists.newArrayList(); + ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback() + { + public void onProfileLookupSucceeded(GameProfile p_onProfileLookupSucceeded_1_) + { + minecraftserver.getPlayerProfileCache().addEntry(p_onProfileLookupSucceeded_1_); + list.add(p_onProfileLookupSucceeded_1_); + } + public void onProfileLookupFailed(GameProfile p_onProfileLookupFailed_1_, Exception p_onProfileLookupFailed_2_) + { + PreYggdrasilConverter.LOGGER.warn((String)("Could not lookup user whitelist entry for " + p_onProfileLookupFailed_1_.getName()), (Throwable)p_onProfileLookupFailed_2_); + } + }; + lookupNames(minecraftserver, Lists.newArrayList(new String[] {p_152719_0_}), profilelookupcallback); + return list.size() > 0 && ((GameProfile)list.get(0)).getId() != null ? ((GameProfile)list.get(0)).getId().toString() : ""; + } + else + { + return EntityPlayer.getUUID(new GameProfile((UUID)null, p_152719_0_)).toString(); + } + } + else + { + return p_152719_0_; + } + } +} diff --git a/src/minecraft/net/minecraft/server/management/ServerConfigurationManager.java b/src/minecraft/net/minecraft/server/management/ServerConfigurationManager.java new file mode 100644 index 0000000..a88af66 --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/ServerConfigurationManager.java @@ -0,0 +1,1077 @@ +package net.minecraft.server.management; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.mojang.authlib.GameProfile; +import io.netty.buffer.Unpooled; +import java.io.File; +import java.net.SocketAddress; +import java.text.SimpleDateFormat; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetHandlerPlayServer; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.server.S01PacketJoinGame; +import net.minecraft.network.play.server.S02PacketChat; +import net.minecraft.network.play.server.S03PacketTimeUpdate; +import net.minecraft.network.play.server.S05PacketSpawnPosition; +import net.minecraft.network.play.server.S07PacketRespawn; +import net.minecraft.network.play.server.S09PacketHeldItemChange; +import net.minecraft.network.play.server.S1DPacketEntityEffect; +import net.minecraft.network.play.server.S1FPacketSetExperience; +import net.minecraft.network.play.server.S2BPacketChangeGameState; +import net.minecraft.network.play.server.S38PacketPlayerListItem; +import net.minecraft.network.play.server.S39PacketPlayerAbilities; +import net.minecraft.network.play.server.S3EPacketTeams; +import net.minecraft.network.play.server.S3FPacketCustomPayload; +import net.minecraft.network.play.server.S41PacketServerDifficulty; +import net.minecraft.network.play.server.S44PacketWorldBorder; +import net.minecraft.potion.PotionEffect; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.ServerScoreboard; +import net.minecraft.scoreboard.Team; +import net.minecraft.server.MinecraftServer; +import net.minecraft.stats.StatList; +import net.minecraft.stats.StatisticsFile; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.border.IBorderListener; +import net.minecraft.world.border.WorldBorder; +import net.minecraft.world.demo.DemoWorldManager; +import net.minecraft.world.storage.IPlayerFileData; +import net.minecraft.world.storage.WorldInfo; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public abstract class ServerConfigurationManager +{ + public static final File FILE_PLAYERBANS = new File("banned-players.json"); + public static final File FILE_IPBANS = new File("banned-ips.json"); + public static final File FILE_OPS = new File("ops.json"); + public static final File FILE_WHITELIST = new File("whitelist.json"); + private static final Logger logger = LogManager.getLogger(); + private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z"); + + /** Reference to the MinecraftServer object. */ + private final MinecraftServer mcServer; + private final List playerEntityList = Lists.newArrayList(); + private final Map uuidToPlayerMap = Maps.newHashMap(); + private final UserListBans bannedPlayers; + private final BanList bannedIPs; + + /** A set containing the OPs. */ + private final UserListOps ops; + + /** The Set of all whitelisted players. */ + private final UserListWhitelist whiteListedPlayers; + private final Map playerStatFiles; + + /** Reference to the PlayerNBTManager object. */ + private IPlayerFileData playerNBTManagerObj; + + /** + * Server setting to only allow OPs and whitelisted players to join the server. + */ + private boolean whiteListEnforced; + + /** The maximum number of players that can be connected at a time. */ + protected int maxPlayers; + private int viewDistance; + private WorldSettings.GameType gameType; + + /** True if all players are allowed to use commands (cheats). */ + private boolean commandsAllowedForAll; + + /** + * index into playerEntities of player to ping, updated every tick; currently hardcoded to max at 200 players + */ + private int playerPingIndex; + + public ServerConfigurationManager(MinecraftServer server) + { + this.bannedPlayers = new UserListBans(FILE_PLAYERBANS); + this.bannedIPs = new BanList(FILE_IPBANS); + this.ops = new UserListOps(FILE_OPS); + this.whiteListedPlayers = new UserListWhitelist(FILE_WHITELIST); + this.playerStatFiles = Maps.newHashMap(); + this.mcServer = server; + this.bannedPlayers.setLanServer(false); + this.bannedIPs.setLanServer(false); + this.maxPlayers = 8; + } + + public void initializeConnectionToPlayer(NetworkManager netManager, EntityPlayerMP playerIn) + { + GameProfile gameprofile = playerIn.getGameProfile(); + PlayerProfileCache playerprofilecache = this.mcServer.getPlayerProfileCache(); + GameProfile gameprofile1 = playerprofilecache.getProfileByUUID(gameprofile.getId()); + String s = gameprofile1 == null ? gameprofile.getName() : gameprofile1.getName(); + playerprofilecache.addEntry(gameprofile); + NBTTagCompound nbttagcompound = this.readPlayerDataFromFile(playerIn); + playerIn.setWorld(this.mcServer.worldServerForDimension(playerIn.dimension)); + playerIn.theItemInWorldManager.setWorld((WorldServer)playerIn.worldObj); + String s1 = "local"; + + if (netManager.getRemoteAddress() != null) + { + s1 = netManager.getRemoteAddress().toString(); + } + + logger.info(playerIn.getName() + "[" + s1 + "] logged in with entity id " + playerIn.getEntityId() + " at (" + playerIn.posX + ", " + playerIn.posY + ", " + playerIn.posZ + ")"); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); + WorldInfo worldinfo = worldserver.getWorldInfo(); + BlockPos blockpos = worldserver.getSpawnPoint(); + this.setPlayerGameTypeBasedOnOther(playerIn, (EntityPlayerMP)null, worldserver); + NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.mcServer, netManager, playerIn); + nethandlerplayserver.sendPacket(new S01PacketJoinGame(playerIn.getEntityId(), playerIn.theItemInWorldManager.getGameType(), worldinfo.isHardcoreModeEnabled(), worldserver.provider.getDimensionId(), worldserver.getDifficulty(), this.getMaxPlayers(), worldinfo.getTerrainType(), worldserver.getGameRules().getBoolean("reducedDebugInfo"))); + nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).writeString(this.getServerInstance().getServerModName()))); + nethandlerplayserver.sendPacket(new S41PacketServerDifficulty(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked())); + nethandlerplayserver.sendPacket(new S05PacketSpawnPosition(blockpos)); + nethandlerplayserver.sendPacket(new S39PacketPlayerAbilities(playerIn.capabilities)); + nethandlerplayserver.sendPacket(new S09PacketHeldItemChange(playerIn.inventory.currentItem)); + playerIn.getStatFile().func_150877_d(); + playerIn.getStatFile().sendAchievements(playerIn); + this.sendScoreboard((ServerScoreboard)worldserver.getScoreboard(), playerIn); + this.mcServer.refreshStatusNextTick(); + ChatComponentTranslation chatcomponenttranslation; + + if (!playerIn.getName().equalsIgnoreCase(s)) + { + chatcomponenttranslation = new ChatComponentTranslation("multiplayer.player.joined.renamed", new Object[] {playerIn.getDisplayName(), s}); + } + else + { + chatcomponenttranslation = new ChatComponentTranslation("multiplayer.player.joined", new Object[] {playerIn.getDisplayName()}); + } + + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.YELLOW); + this.sendChatMsg(chatcomponenttranslation); + this.playerLoggedIn(playerIn); + nethandlerplayserver.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); + this.updateTimeAndWeatherForPlayer(playerIn, worldserver); + + if (this.mcServer.getResourcePackUrl().length() > 0) + { + playerIn.loadResourcePack(this.mcServer.getResourcePackUrl(), this.mcServer.getResourcePackHash()); + } + + for (PotionEffect potioneffect : playerIn.getActivePotionEffects()) + { + nethandlerplayserver.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); + } + + playerIn.addSelfToInternalCraftingInventory(); + + if (nbttagcompound != null && nbttagcompound.hasKey("Riding", 10)) + { + Entity entity = EntityList.createEntityFromNBT(nbttagcompound.getCompoundTag("Riding"), worldserver); + + if (entity != null) + { + entity.forceSpawn = true; + worldserver.spawnEntityInWorld(entity); + playerIn.mountEntity(entity); + entity.forceSpawn = false; + } + } + } + + protected void sendScoreboard(ServerScoreboard scoreboardIn, EntityPlayerMP playerIn) + { + Set set = Sets.newHashSet(); + + for (ScorePlayerTeam scoreplayerteam : scoreboardIn.getTeams()) + { + playerIn.playerNetServerHandler.sendPacket(new S3EPacketTeams(scoreplayerteam, 0)); + } + + for (int i = 0; i < 19; ++i) + { + ScoreObjective scoreobjective = scoreboardIn.getObjectiveInDisplaySlot(i); + + if (scoreobjective != null && !set.contains(scoreobjective)) + { + for (Packet packet : scoreboardIn.func_96550_d(scoreobjective)) + { + playerIn.playerNetServerHandler.sendPacket(packet); + } + + set.add(scoreobjective); + } + } + } + + /** + * Sets the NBT manager to the one for the WorldServer given. + */ + public void setPlayerManager(WorldServer[] worldServers) + { + this.playerNBTManagerObj = worldServers[0].getSaveHandler().getPlayerNBTManager(); + worldServers[0].getWorldBorder().addListener(new IBorderListener() + { + public void onSizeChanged(WorldBorder border, double newSize) + { + ServerConfigurationManager.this.sendPacketToAllPlayers(new S44PacketWorldBorder(border, S44PacketWorldBorder.Action.SET_SIZE)); + } + public void onTransitionStarted(WorldBorder border, double oldSize, double newSize, long time) + { + ServerConfigurationManager.this.sendPacketToAllPlayers(new S44PacketWorldBorder(border, S44PacketWorldBorder.Action.LERP_SIZE)); + } + public void onCenterChanged(WorldBorder border, double x, double z) + { + ServerConfigurationManager.this.sendPacketToAllPlayers(new S44PacketWorldBorder(border, S44PacketWorldBorder.Action.SET_CENTER)); + } + public void onWarningTimeChanged(WorldBorder border, int newTime) + { + ServerConfigurationManager.this.sendPacketToAllPlayers(new S44PacketWorldBorder(border, S44PacketWorldBorder.Action.SET_WARNING_TIME)); + } + public void onWarningDistanceChanged(WorldBorder border, int newDistance) + { + ServerConfigurationManager.this.sendPacketToAllPlayers(new S44PacketWorldBorder(border, S44PacketWorldBorder.Action.SET_WARNING_BLOCKS)); + } + public void onDamageAmountChanged(WorldBorder border, double newAmount) + { + } + public void onDamageBufferChanged(WorldBorder border, double newSize) + { + } + }); + } + + public void preparePlayer(EntityPlayerMP playerIn, WorldServer worldIn) + { + WorldServer worldserver = playerIn.getServerForPlayer(); + + if (worldIn != null) + { + worldIn.getPlayerManager().removePlayer(playerIn); + } + + worldserver.getPlayerManager().addPlayer(playerIn); + worldserver.theChunkProviderServer.loadChunk((int)playerIn.posX >> 4, (int)playerIn.posZ >> 4); + } + + public int getEntityViewDistance() + { + return PlayerManager.getFurthestViewableBlock(this.getViewDistance()); + } + + /** + * called during player login. reads the player information from disk. + */ + public NBTTagCompound readPlayerDataFromFile(EntityPlayerMP playerIn) + { + NBTTagCompound nbttagcompound = this.mcServer.worldServers[0].getWorldInfo().getPlayerNBTTagCompound(); + NBTTagCompound nbttagcompound1; + + if (playerIn.getName().equals(this.mcServer.getServerOwner()) && nbttagcompound != null) + { + playerIn.readFromNBT(nbttagcompound); + nbttagcompound1 = nbttagcompound; + logger.debug("loading single player"); + } + else + { + nbttagcompound1 = this.playerNBTManagerObj.readPlayerData(playerIn); + } + + return nbttagcompound1; + } + + /** + * also stores the NBTTags if this is an intergratedPlayerList + */ + protected void writePlayerData(EntityPlayerMP playerIn) + { + this.playerNBTManagerObj.writePlayerData(playerIn); + StatisticsFile statisticsfile = (StatisticsFile)this.playerStatFiles.get(playerIn.getUniqueID()); + + if (statisticsfile != null) + { + statisticsfile.saveStatFile(); + } + } + + /** + * Called when a player successfully logs in. Reads player data from disk and inserts the player into the world. + */ + public void playerLoggedIn(EntityPlayerMP playerIn) + { + this.playerEntityList.add(playerIn); + this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn); + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {playerIn})); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); + worldserver.spawnEntityInWorld(playerIn); + this.preparePlayer(playerIn, (WorldServer)null); + + for (int i = 0; i < this.playerEntityList.size(); ++i) + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i); + playerIn.playerNetServerHandler.sendPacket(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.ADD_PLAYER, new EntityPlayerMP[] {entityplayermp})); + } + } + + /** + * using player's dimension, update their movement when in a vehicle (e.g. cart, boat) + */ + public void serverUpdateMountedMovingPlayer(EntityPlayerMP playerIn) + { + playerIn.getServerForPlayer().getPlayerManager().updateMountedMovingPlayer(playerIn); + } + + /** + * Called when a player disconnects from the game. Writes player data to disk and removes them from the world. + */ + public void playerLoggedOut(EntityPlayerMP playerIn) + { + playerIn.triggerAchievement(StatList.leaveGameStat); + this.writePlayerData(playerIn); + WorldServer worldserver = playerIn.getServerForPlayer(); + + if (playerIn.ridingEntity != null) + { + worldserver.removePlayerEntityDangerously(playerIn.ridingEntity); + logger.debug("removing player mount"); + } + + worldserver.removeEntity(playerIn); + worldserver.getPlayerManager().removePlayer(playerIn); + this.playerEntityList.remove(playerIn); + UUID uuid = playerIn.getUniqueID(); + EntityPlayerMP entityplayermp = (EntityPlayerMP)this.uuidToPlayerMap.get(uuid); + + if (entityplayermp == playerIn) + { + this.uuidToPlayerMap.remove(uuid); + this.playerStatFiles.remove(uuid); + } + + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.REMOVE_PLAYER, new EntityPlayerMP[] {playerIn})); + } + + /** + * checks ban-lists, then white-lists, then space for the server. Returns null on success, or an error message + */ + public String allowUserToConnect(SocketAddress address, GameProfile profile) + { + if (this.bannedPlayers.isBanned(profile)) + { + UserListBansEntry userlistbansentry = (UserListBansEntry)this.bannedPlayers.getEntry(profile); + String s1 = "You are banned from this server!\nReason: " + userlistbansentry.getBanReason(); + + if (userlistbansentry.getBanEndDate() != null) + { + s1 = s1 + "\nYour ban will be removed on " + dateFormat.format(userlistbansentry.getBanEndDate()); + } + + return s1; + } + else if (!this.canJoin(profile)) + { + return "You are not white-listed on this server!"; + } + else if (this.bannedIPs.isBanned(address)) + { + IPBanEntry ipbanentry = this.bannedIPs.getBanEntry(address); + String s = "Your IP address is banned from this server!\nReason: " + ipbanentry.getBanReason(); + + if (ipbanentry.getBanEndDate() != null) + { + s = s + "\nYour ban will be removed on " + dateFormat.format(ipbanentry.getBanEndDate()); + } + + return s; + } + else + { + return this.playerEntityList.size() >= this.maxPlayers && !this.func_183023_f(profile) ? "The server is full!" : null; + } + } + + /** + * also checks for multiple logins across servers + */ + public EntityPlayerMP createPlayerForUser(GameProfile profile) + { + UUID uuid = EntityPlayer.getUUID(profile); + List list = Lists.newArrayList(); + + for (int i = 0; i < this.playerEntityList.size(); ++i) + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i); + + if (entityplayermp.getUniqueID().equals(uuid)) + { + list.add(entityplayermp); + } + } + + EntityPlayerMP entityplayermp2 = (EntityPlayerMP)this.uuidToPlayerMap.get(profile.getId()); + + if (entityplayermp2 != null && !list.contains(entityplayermp2)) + { + list.add(entityplayermp2); + } + + for (EntityPlayerMP entityplayermp1 : list) + { + entityplayermp1.playerNetServerHandler.kickPlayerFromServer("You logged in from another location"); + } + + ItemInWorldManager iteminworldmanager; + + if (this.mcServer.isDemo()) + { + iteminworldmanager = new DemoWorldManager(this.mcServer.worldServerForDimension(0)); + } + else + { + iteminworldmanager = new ItemInWorldManager(this.mcServer.worldServerForDimension(0)); + } + + return new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(0), profile, iteminworldmanager); + } + + /** + * Called on respawn + */ + public EntityPlayerMP recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd) + { + playerIn.getServerForPlayer().getEntityTracker().removePlayerFromTrackers(playerIn); + playerIn.getServerForPlayer().getEntityTracker().untrackEntity(playerIn); + playerIn.getServerForPlayer().getPlayerManager().removePlayer(playerIn); + this.playerEntityList.remove(playerIn); + this.mcServer.worldServerForDimension(playerIn.dimension).removePlayerEntityDangerously(playerIn); + BlockPos blockpos = playerIn.getBedLocation(); + boolean flag = playerIn.isSpawnForced(); + playerIn.dimension = dimension; + ItemInWorldManager iteminworldmanager; + + if (this.mcServer.isDemo()) + { + iteminworldmanager = new DemoWorldManager(this.mcServer.worldServerForDimension(playerIn.dimension)); + } + else + { + iteminworldmanager = new ItemInWorldManager(this.mcServer.worldServerForDimension(playerIn.dimension)); + } + + EntityPlayerMP entityplayermp = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(playerIn.dimension), playerIn.getGameProfile(), iteminworldmanager); + entityplayermp.playerNetServerHandler = playerIn.playerNetServerHandler; + entityplayermp.clonePlayer(playerIn, conqueredEnd); + entityplayermp.setEntityId(playerIn.getEntityId()); + entityplayermp.func_174817_o(playerIn); + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); + this.setPlayerGameTypeBasedOnOther(entityplayermp, playerIn, worldserver); + + if (blockpos != null) + { + BlockPos blockpos1 = EntityPlayer.getBedSpawnLocation(this.mcServer.worldServerForDimension(playerIn.dimension), blockpos, flag); + + if (blockpos1 != null) + { + entityplayermp.setLocationAndAngles((double)((float)blockpos1.getX() + 0.5F), (double)((float)blockpos1.getY() + 0.1F), (double)((float)blockpos1.getZ() + 0.5F), 0.0F, 0.0F); + entityplayermp.setSpawnPoint(blockpos, flag); + } + else + { + entityplayermp.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(0, 0.0F)); + } + } + + worldserver.theChunkProviderServer.loadChunk((int)entityplayermp.posX >> 4, (int)entityplayermp.posZ >> 4); + + while (!worldserver.getCollidingBoundingBoxes(entityplayermp, entityplayermp.getEntityBoundingBox()).isEmpty() && entityplayermp.posY < 256.0D) + { + entityplayermp.setPosition(entityplayermp.posX, entityplayermp.posY + 1.0D, entityplayermp.posZ); + } + + entityplayermp.playerNetServerHandler.sendPacket(new S07PacketRespawn(entityplayermp.dimension, entityplayermp.worldObj.getDifficulty(), entityplayermp.worldObj.getWorldInfo().getTerrainType(), entityplayermp.theItemInWorldManager.getGameType())); + BlockPos blockpos2 = worldserver.getSpawnPoint(); + entityplayermp.playerNetServerHandler.setPlayerLocation(entityplayermp.posX, entityplayermp.posY, entityplayermp.posZ, entityplayermp.rotationYaw, entityplayermp.rotationPitch); + entityplayermp.playerNetServerHandler.sendPacket(new S05PacketSpawnPosition(blockpos2)); + entityplayermp.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(entityplayermp.experience, entityplayermp.experienceTotal, entityplayermp.experienceLevel)); + this.updateTimeAndWeatherForPlayer(entityplayermp, worldserver); + worldserver.getPlayerManager().addPlayer(entityplayermp); + worldserver.spawnEntityInWorld(entityplayermp); + this.playerEntityList.add(entityplayermp); + this.uuidToPlayerMap.put(entityplayermp.getUniqueID(), entityplayermp); + entityplayermp.addSelfToInternalCraftingInventory(); + entityplayermp.setHealth(entityplayermp.getHealth()); + return entityplayermp; + } + + /** + * moves provided player from overworld to nether or vice versa + */ + public void transferPlayerToDimension(EntityPlayerMP playerIn, int dimension) + { + int i = playerIn.dimension; + WorldServer worldserver = this.mcServer.worldServerForDimension(playerIn.dimension); + playerIn.dimension = dimension; + WorldServer worldserver1 = this.mcServer.worldServerForDimension(playerIn.dimension); + playerIn.playerNetServerHandler.sendPacket(new S07PacketRespawn(playerIn.dimension, playerIn.worldObj.getDifficulty(), playerIn.worldObj.getWorldInfo().getTerrainType(), playerIn.theItemInWorldManager.getGameType())); + worldserver.removePlayerEntityDangerously(playerIn); + playerIn.isDead = false; + this.transferEntityToWorld(playerIn, i, worldserver, worldserver1); + this.preparePlayer(playerIn, worldserver); + playerIn.playerNetServerHandler.setPlayerLocation(playerIn.posX, playerIn.posY, playerIn.posZ, playerIn.rotationYaw, playerIn.rotationPitch); + playerIn.theItemInWorldManager.setWorld(worldserver1); + this.updateTimeAndWeatherForPlayer(playerIn, worldserver1); + this.syncPlayerInventory(playerIn); + + for (PotionEffect potioneffect : playerIn.getActivePotionEffects()) + { + playerIn.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(playerIn.getEntityId(), potioneffect)); + } + } + + /** + * Transfers an entity from a world to another world. + */ + public void transferEntityToWorld(Entity entityIn, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) + { + double d0 = entityIn.posX; + double d1 = entityIn.posZ; + double d2 = 8.0D; + float f = entityIn.rotationYaw; + p_82448_3_.theProfiler.startSection("moving"); + + if (entityIn.dimension == -1) + { + d0 = MathHelper.clamp_double(d0 / d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); + d1 = MathHelper.clamp_double(d1 / d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); + entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); + + if (entityIn.isEntityAlive()) + { + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } + else if (entityIn.dimension == 0) + { + d0 = MathHelper.clamp_double(d0 * d2, p_82448_4_.getWorldBorder().minX() + 16.0D, p_82448_4_.getWorldBorder().maxX() - 16.0D); + d1 = MathHelper.clamp_double(d1 * d2, p_82448_4_.getWorldBorder().minZ() + 16.0D, p_82448_4_.getWorldBorder().maxZ() - 16.0D); + entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); + + if (entityIn.isEntityAlive()) + { + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } + else + { + BlockPos blockpos; + + if (p_82448_2_ == 1) + { + blockpos = p_82448_4_.getSpawnPoint(); + } + else + { + blockpos = p_82448_4_.getSpawnCoordinate(); + } + + d0 = (double)blockpos.getX(); + entityIn.posY = (double)blockpos.getY(); + d1 = (double)blockpos.getZ(); + entityIn.setLocationAndAngles(d0, entityIn.posY, d1, 90.0F, 0.0F); + + if (entityIn.isEntityAlive()) + { + p_82448_3_.updateEntityWithOptionalForce(entityIn, false); + } + } + + p_82448_3_.theProfiler.endSection(); + + if (p_82448_2_ != 1) + { + p_82448_3_.theProfiler.startSection("placing"); + d0 = (double)MathHelper.clamp_int((int)d0, -29999872, 29999872); + d1 = (double)MathHelper.clamp_int((int)d1, -29999872, 29999872); + + if (entityIn.isEntityAlive()) + { + entityIn.setLocationAndAngles(d0, entityIn.posY, d1, entityIn.rotationYaw, entityIn.rotationPitch); + p_82448_4_.getDefaultTeleporter().placeInPortal(entityIn, f); + p_82448_4_.spawnEntityInWorld(entityIn); + p_82448_4_.updateEntityWithOptionalForce(entityIn, false); + } + + p_82448_3_.theProfiler.endSection(); + } + + entityIn.setWorld(p_82448_4_); + } + + /** + * self explanitory + */ + public void onTick() + { + if (++this.playerPingIndex > 600) + { + this.sendPacketToAllPlayers(new S38PacketPlayerListItem(S38PacketPlayerListItem.Action.UPDATE_LATENCY, this.playerEntityList)); + this.playerPingIndex = 0; + } + } + + public void sendPacketToAllPlayers(Packet packetIn) + { + for (int i = 0; i < this.playerEntityList.size(); ++i) + { + ((EntityPlayerMP)this.playerEntityList.get(i)).playerNetServerHandler.sendPacket(packetIn); + } + } + + public void sendPacketToAllPlayersInDimension(Packet packetIn, int dimension) + { + for (int i = 0; i < this.playerEntityList.size(); ++i) + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i); + + if (entityplayermp.dimension == dimension) + { + entityplayermp.playerNetServerHandler.sendPacket(packetIn); + } + } + } + + public void sendMessageToAllTeamMembers(EntityPlayer player, IChatComponent message) + { + Team team = player.getTeam(); + + if (team != null) + { + for (String s : team.getMembershipCollection()) + { + EntityPlayerMP entityplayermp = this.getPlayerByUsername(s); + + if (entityplayermp != null && entityplayermp != player) + { + entityplayermp.addChatMessage(message); + } + } + } + } + + public void sendMessageToTeamOrEvryPlayer(EntityPlayer player, IChatComponent message) + { + Team team = player.getTeam(); + + if (team == null) + { + this.sendChatMsg(message); + } + else + { + for (int i = 0; i < this.playerEntityList.size(); ++i) + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i); + + if (entityplayermp.getTeam() != team) + { + entityplayermp.addChatMessage(message); + } + } + } + } + + public String func_181058_b(boolean p_181058_1_) + { + String s = ""; + List list = Lists.newArrayList(this.playerEntityList); + + for (int i = 0; i < ((List)list).size(); ++i) + { + if (i > 0) + { + s = s + ", "; + } + + s = s + ((EntityPlayerMP)list.get(i)).getName(); + + if (p_181058_1_) + { + s = s + " (" + ((EntityPlayerMP)list.get(i)).getUniqueID().toString() + ")"; + } + } + + return s; + } + + /** + * Returns an array of the usernames of all the connected players. + */ + public String[] getAllUsernames() + { + String[] astring = new String[this.playerEntityList.size()]; + + for (int i = 0; i < this.playerEntityList.size(); ++i) + { + astring[i] = ((EntityPlayerMP)this.playerEntityList.get(i)).getName(); + } + + return astring; + } + + public GameProfile[] getAllProfiles() + { + GameProfile[] agameprofile = new GameProfile[this.playerEntityList.size()]; + + for (int i = 0; i < this.playerEntityList.size(); ++i) + { + agameprofile[i] = ((EntityPlayerMP)this.playerEntityList.get(i)).getGameProfile(); + } + + return agameprofile; + } + + public UserListBans getBannedPlayers() + { + return this.bannedPlayers; + } + + public BanList getBannedIPs() + { + return this.bannedIPs; + } + + public void addOp(GameProfile profile) + { + this.ops.addEntry(new UserListOpsEntry(profile, this.mcServer.getOpPermissionLevel(), this.ops.func_183026_b(profile))); + } + + public void removeOp(GameProfile profile) + { + this.ops.removeEntry(profile); + } + + public boolean canJoin(GameProfile profile) + { + return !this.whiteListEnforced || this.ops.hasEntry(profile) || this.whiteListedPlayers.hasEntry(profile); + } + + public boolean canSendCommands(GameProfile profile) + { + return this.ops.hasEntry(profile) || this.mcServer.isSinglePlayer() && this.mcServer.worldServers[0].getWorldInfo().areCommandsAllowed() && this.mcServer.getServerOwner().equalsIgnoreCase(profile.getName()) || this.commandsAllowedForAll; + } + + public EntityPlayerMP getPlayerByUsername(String username) + { + for (EntityPlayerMP entityplayermp : this.playerEntityList) + { + if (entityplayermp.getName().equalsIgnoreCase(username)) + { + return entityplayermp; + } + } + + return null; + } + + /** + * params: x,y,z,r,dimension. The packet is sent to all players within r radius of x,y,z (r^2>x^2+y^2+z^2) + */ + public void sendToAllNear(double x, double y, double z, double radius, int dimension, Packet packetIn) + { + this.sendToAllNearExcept((EntityPlayer)null, x, y, z, radius, dimension, packetIn); + } + + /** + * params: srcPlayer,x,y,z,r,dimension. The packet is not sent to the srcPlayer, but all other players within the + * search radius + */ + public void sendToAllNearExcept(EntityPlayer p_148543_1_, double x, double y, double z, double radius, int dimension, Packet p_148543_11_) + { + for (int i = 0; i < this.playerEntityList.size(); ++i) + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(i); + + if (entityplayermp != p_148543_1_ && entityplayermp.dimension == dimension) + { + double d0 = x - entityplayermp.posX; + double d1 = y - entityplayermp.posY; + double d2 = z - entityplayermp.posZ; + + if (d0 * d0 + d1 * d1 + d2 * d2 < radius * radius) + { + entityplayermp.playerNetServerHandler.sendPacket(p_148543_11_); + } + } + } + } + + /** + * Saves all of the players' current states. + */ + public void saveAllPlayerData() + { + for (int i = 0; i < this.playerEntityList.size(); ++i) + { + this.writePlayerData((EntityPlayerMP)this.playerEntityList.get(i)); + } + } + + public void addWhitelistedPlayer(GameProfile profile) + { + this.whiteListedPlayers.addEntry(new UserListWhitelistEntry(profile)); + } + + public void removePlayerFromWhitelist(GameProfile profile) + { + this.whiteListedPlayers.removeEntry(profile); + } + + public UserListWhitelist getWhitelistedPlayers() + { + return this.whiteListedPlayers; + } + + public String[] getWhitelistedPlayerNames() + { + return this.whiteListedPlayers.getKeys(); + } + + public UserListOps getOppedPlayers() + { + return this.ops; + } + + public String[] getOppedPlayerNames() + { + return this.ops.getKeys(); + } + + /** + * Either does nothing, or calls readWhiteList. + */ + public void loadWhiteList() + { + } + + /** + * Updates the time and weather for the given player to those of the given world + */ + public void updateTimeAndWeatherForPlayer(EntityPlayerMP playerIn, WorldServer worldIn) + { + WorldBorder worldborder = this.mcServer.worldServers[0].getWorldBorder(); + playerIn.playerNetServerHandler.sendPacket(new S44PacketWorldBorder(worldborder, S44PacketWorldBorder.Action.INITIALIZE)); + playerIn.playerNetServerHandler.sendPacket(new S03PacketTimeUpdate(worldIn.getTotalWorldTime(), worldIn.getWorldTime(), worldIn.getGameRules().getBoolean("doDaylightCycle"))); + + if (worldIn.isRaining()) + { + playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F)); + playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7, worldIn.getRainStrength(1.0F))); + playerIn.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, worldIn.getThunderStrength(1.0F))); + } + } + + /** + * sends the players inventory to himself + */ + public void syncPlayerInventory(EntityPlayerMP playerIn) + { + playerIn.sendContainerToPlayer(playerIn.inventoryContainer); + playerIn.setPlayerHealthUpdated(); + playerIn.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(playerIn.inventory.currentItem)); + } + + /** + * Returns the number of players currently on the server. + */ + public int getCurrentPlayerCount() + { + return this.playerEntityList.size(); + } + + /** + * Returns the maximum number of players allowed on the server. + */ + public int getMaxPlayers() + { + return this.maxPlayers; + } + + /** + * Returns an array of usernames for which player.dat exists for. + */ + public String[] getAvailablePlayerDat() + { + return this.mcServer.worldServers[0].getSaveHandler().getPlayerNBTManager().getAvailablePlayerDat(); + } + + public void setWhiteListEnabled(boolean whitelistEnabled) + { + this.whiteListEnforced = whitelistEnabled; + } + + public List getPlayersMatchingAddress(String address) + { + List list = Lists.newArrayList(); + + for (EntityPlayerMP entityplayermp : this.playerEntityList) + { + if (entityplayermp.getPlayerIP().equals(address)) + { + list.add(entityplayermp); + } + } + + return list; + } + + /** + * Gets the View Distance. + */ + public int getViewDistance() + { + return this.viewDistance; + } + + public MinecraftServer getServerInstance() + { + return this.mcServer; + } + + /** + * On integrated servers, returns the host's player data to be written to level.dat. + */ + public NBTTagCompound getHostPlayerData() + { + return null; + } + + public void setGameType(WorldSettings.GameType p_152604_1_) + { + this.gameType = p_152604_1_; + } + + private void setPlayerGameTypeBasedOnOther(EntityPlayerMP p_72381_1_, EntityPlayerMP p_72381_2_, World worldIn) + { + if (p_72381_2_ != null) + { + p_72381_1_.theItemInWorldManager.setGameType(p_72381_2_.theItemInWorldManager.getGameType()); + } + else if (this.gameType != null) + { + p_72381_1_.theItemInWorldManager.setGameType(this.gameType); + } + + p_72381_1_.theItemInWorldManager.initializeGameType(worldIn.getWorldInfo().getGameType()); + } + + /** + * Sets whether all players are allowed to use commands (cheats) on the server. + */ + public void setCommandsAllowedForAll(boolean p_72387_1_) + { + this.commandsAllowedForAll = p_72387_1_; + } + + /** + * Kicks everyone with "Server closed" as reason. + */ + public void removeAllPlayers() + { + for (int i = 0; i < this.playerEntityList.size(); ++i) + { + ((EntityPlayerMP)this.playerEntityList.get(i)).playerNetServerHandler.kickPlayerFromServer("Server closed"); + } + } + + public void sendChatMsgImpl(IChatComponent component, boolean isChat) + { + this.mcServer.addChatMessage(component); + byte b0 = (byte)(isChat ? 1 : 0); + this.sendPacketToAllPlayers(new S02PacketChat(component, b0)); + } + + /** + * Sends the given string to every player as chat message. + */ + public void sendChatMsg(IChatComponent component) + { + this.sendChatMsgImpl(component, true); + } + + public StatisticsFile getPlayerStatsFile(EntityPlayer playerIn) + { + UUID uuid = playerIn.getUniqueID(); + StatisticsFile statisticsfile = uuid == null ? null : (StatisticsFile)this.playerStatFiles.get(uuid); + + if (statisticsfile == null) + { + File file1 = new File(this.mcServer.worldServerForDimension(0).getSaveHandler().getWorldDirectory(), "stats"); + File file2 = new File(file1, uuid.toString() + ".json"); + + if (!file2.exists()) + { + File file3 = new File(file1, playerIn.getName() + ".json"); + + if (file3.exists() && file3.isFile()) + { + file3.renameTo(file2); + } + } + + statisticsfile = new StatisticsFile(this.mcServer, file2); + statisticsfile.readStatFile(); + this.playerStatFiles.put(uuid, statisticsfile); + } + + return statisticsfile; + } + + public void setViewDistance(int distance) + { + this.viewDistance = distance; + + if (this.mcServer.worldServers != null) + { + for (WorldServer worldserver : this.mcServer.worldServers) + { + if (worldserver != null) + { + worldserver.getPlayerManager().setPlayerViewRadius(distance); + } + } + } + } + + public List func_181057_v() + { + return this.playerEntityList; + } + + /** + * Get's the EntityPlayerMP object representing the player with the UUID. + */ + public EntityPlayerMP getPlayerByUUID(UUID playerUUID) + { + return (EntityPlayerMP)this.uuidToPlayerMap.get(playerUUID); + } + + public boolean func_183023_f(GameProfile p_183023_1_) + { + return false; + } +} diff --git a/src/minecraft/net/minecraft/server/management/UserList.java b/src/minecraft/net/minecraft/server/management/UserList.java new file mode 100644 index 0000000..27b6930 --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/UserList.java @@ -0,0 +1,200 @@ +package net.minecraft.server.management; + +import com.google.common.base.Charsets; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.io.Files; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.io.BufferedWriter; +import java.io.File; +import java.io.IOException; +import java.io.Writer; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class UserList> +{ + protected static final Logger logger = LogManager.getLogger(); + protected final Gson gson; + private final File saveFile; + private final Map values = Maps.newHashMap(); + private boolean lanServer = true; + private static final ParameterizedType saveFileFormat = new ParameterizedType() + { + public Type[] getActualTypeArguments() + { + return new Type[] {UserListEntry.class}; + } + public Type getRawType() + { + return List.class; + } + public Type getOwnerType() + { + return null; + } + }; + + public UserList(File saveFile) + { + this.saveFile = saveFile; + GsonBuilder gsonbuilder = (new GsonBuilder()).setPrettyPrinting(); + gsonbuilder.registerTypeHierarchyAdapter(UserListEntry.class, new UserList.Serializer()); + this.gson = gsonbuilder.create(); + } + + public boolean isLanServer() + { + return this.lanServer; + } + + public void setLanServer(boolean state) + { + this.lanServer = state; + } + + /** + * Adds an entry to the list + */ + public void addEntry(V entry) + { + this.values.put(this.getObjectKey(entry.getValue()), entry); + + try + { + this.writeChanges(); + } + catch (IOException ioexception) + { + logger.warn((String)"Could not save the list after adding a user.", (Throwable)ioexception); + } + } + + public V getEntry(K obj) + { + this.removeExpired(); + return (V)((UserListEntry)this.values.get(this.getObjectKey(obj))); + } + + public void removeEntry(K p_152684_1_) + { + this.values.remove(this.getObjectKey(p_152684_1_)); + + try + { + this.writeChanges(); + } + catch (IOException ioexception) + { + logger.warn((String)"Could not save the list after removing a user.", (Throwable)ioexception); + } + } + + public String[] getKeys() + { + return (String[])this.values.keySet().toArray(new String[this.values.size()]); + } + + /** + * Gets the key value for the given object + */ + protected String getObjectKey(K obj) + { + return obj.toString(); + } + + protected boolean hasEntry(K entry) + { + return this.values.containsKey(this.getObjectKey(entry)); + } + + /** + * Removes expired bans from the list. See {@link BanEntry#hasBanExpired} + */ + private void removeExpired() + { + List list = Lists.newArrayList(); + + for (V v : this.values.values()) + { + if (v.hasBanExpired()) + { + list.add(v.getValue()); + } + } + + for (K k : list) + { + this.values.remove(k); + } + } + + protected UserListEntry createEntry(JsonObject entryData) + { + return new UserListEntry((Object)null, entryData); + } + + protected Map getValues() + { + return this.values; + } + + public void writeChanges() throws IOException + { + Collection collection = this.values.values(); + String s = this.gson.toJson((Object)collection); + BufferedWriter bufferedwriter = null; + + try + { + bufferedwriter = Files.newWriter(this.saveFile, Charsets.UTF_8); + bufferedwriter.write(s); + } + finally + { + IOUtils.closeQuietly((Writer)bufferedwriter); + } + } + + class Serializer implements JsonDeserializer>, JsonSerializer> + { + private Serializer() + { + } + + public JsonElement serialize(UserListEntry p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) + { + JsonObject jsonobject = new JsonObject(); + p_serialize_1_.onSerialization(jsonobject); + return jsonobject; + } + + public UserListEntry deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + if (p_deserialize_1_.isJsonObject()) + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + UserListEntry userlistentry = UserList.this.createEntry(jsonobject); + return userlistentry; + } + else + { + return null; + } + } + } +} diff --git a/src/minecraft/net/minecraft/server/management/UserListBans.java b/src/minecraft/net/minecraft/server/management/UserListBans.java new file mode 100644 index 0000000..a083ec9 --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/UserListBans.java @@ -0,0 +1,57 @@ +package net.minecraft.server.management; + +import com.google.gson.JsonObject; +import com.mojang.authlib.GameProfile; +import java.io.File; + +public class UserListBans extends UserList +{ + public UserListBans(File bansFile) + { + super(bansFile); + } + + protected UserListEntry createEntry(JsonObject entryData) + { + return new UserListBansEntry(entryData); + } + + public boolean isBanned(GameProfile profile) + { + return this.hasEntry(profile); + } + + public String[] getKeys() + { + String[] astring = new String[this.getValues().size()]; + int i = 0; + + for (UserListBansEntry userlistbansentry : this.getValues().values()) + { + astring[i++] = ((GameProfile)userlistbansentry.getValue()).getName(); + } + + return astring; + } + + /** + * Gets the key value for the given object + */ + protected String getObjectKey(GameProfile obj) + { + return obj.getId().toString(); + } + + public GameProfile isUsernameBanned(String username) + { + for (UserListBansEntry userlistbansentry : this.getValues().values()) + { + if (username.equalsIgnoreCase(((GameProfile)userlistbansentry.getValue()).getName())) + { + return (GameProfile)userlistbansentry.getValue(); + } + } + + return null; + } +} diff --git a/src/minecraft/net/minecraft/server/management/UserListBansEntry.java b/src/minecraft/net/minecraft/server/management/UserListBansEntry.java new file mode 100644 index 0000000..fb5ed34 --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/UserListBansEntry.java @@ -0,0 +1,58 @@ +package net.minecraft.server.management; + +import com.google.gson.JsonObject; +import com.mojang.authlib.GameProfile; +import java.util.Date; +import java.util.UUID; + +public class UserListBansEntry extends BanEntry +{ + public UserListBansEntry(GameProfile profile) + { + this(profile, (Date)null, (String)null, (Date)null, (String)null); + } + + public UserListBansEntry(GameProfile profile, Date startDate, String banner, Date endDate, String banReason) + { + super(profile, endDate, banner, endDate, banReason); + } + + public UserListBansEntry(JsonObject p_i1136_1_) + { + super(func_152648_b(p_i1136_1_), p_i1136_1_); + } + + protected void onSerialization(JsonObject data) + { + if (this.getValue() != null) + { + data.addProperty("uuid", ((GameProfile)this.getValue()).getId() == null ? "" : ((GameProfile)this.getValue()).getId().toString()); + data.addProperty("name", ((GameProfile)this.getValue()).getName()); + super.onSerialization(data); + } + } + + private static GameProfile func_152648_b(JsonObject p_152648_0_) + { + if (p_152648_0_.has("uuid") && p_152648_0_.has("name")) + { + String s = p_152648_0_.get("uuid").getAsString(); + UUID uuid; + + try + { + uuid = UUID.fromString(s); + } + catch (Throwable var4) + { + return null; + } + + return new GameProfile(uuid, p_152648_0_.get("name").getAsString()); + } + else + { + return null; + } + } +} diff --git a/src/minecraft/net/minecraft/server/management/UserListEntry.java b/src/minecraft/net/minecraft/server/management/UserListEntry.java new file mode 100644 index 0000000..5fce9a6 --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/UserListEntry.java @@ -0,0 +1,32 @@ +package net.minecraft.server.management; + +import com.google.gson.JsonObject; + +public class UserListEntry +{ + private final T value; + + public UserListEntry(T p_i1146_1_) + { + this.value = p_i1146_1_; + } + + protected UserListEntry(T p_i1147_1_, JsonObject p_i1147_2_) + { + this.value = p_i1147_1_; + } + + T getValue() + { + return this.value; + } + + boolean hasBanExpired() + { + return false; + } + + protected void onSerialization(JsonObject data) + { + } +} diff --git a/src/minecraft/net/minecraft/server/management/UserListOps.java b/src/minecraft/net/minecraft/server/management/UserListOps.java new file mode 100644 index 0000000..2bd64ad --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/UserListOps.java @@ -0,0 +1,61 @@ +package net.minecraft.server.management; + +import com.google.gson.JsonObject; +import com.mojang.authlib.GameProfile; +import java.io.File; + +public class UserListOps extends UserList +{ + public UserListOps(File saveFile) + { + super(saveFile); + } + + protected UserListEntry createEntry(JsonObject entryData) + { + return new UserListOpsEntry(entryData); + } + + public String[] getKeys() + { + String[] astring = new String[this.getValues().size()]; + int i = 0; + + for (UserListOpsEntry userlistopsentry : this.getValues().values()) + { + astring[i++] = ((GameProfile)userlistopsentry.getValue()).getName(); + } + + return astring; + } + + public boolean func_183026_b(GameProfile p_183026_1_) + { + UserListOpsEntry userlistopsentry = (UserListOpsEntry)this.getEntry(p_183026_1_); + return userlistopsentry != null ? userlistopsentry.func_183024_b() : false; + } + + /** + * Gets the key value for the given object + */ + protected String getObjectKey(GameProfile obj) + { + return obj.getId().toString(); + } + + /** + * Gets the GameProfile of based on the provided username. + */ + public GameProfile getGameProfileFromName(String username) + { + for (UserListOpsEntry userlistopsentry : this.getValues().values()) + { + if (username.equalsIgnoreCase(((GameProfile)userlistopsentry.getValue()).getName())) + { + return (GameProfile)userlistopsentry.getValue(); + } + } + + return null; + } +} diff --git a/src/minecraft/net/minecraft/server/management/UserListOpsEntry.java b/src/minecraft/net/minecraft/server/management/UserListOpsEntry.java new file mode 100644 index 0000000..8d7ba33 --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/UserListOpsEntry.java @@ -0,0 +1,74 @@ +package net.minecraft.server.management; + +import com.google.gson.JsonObject; +import com.mojang.authlib.GameProfile; +import java.util.UUID; + +public class UserListOpsEntry extends UserListEntry +{ + private final int field_152645_a; + private final boolean field_183025_b; + + public UserListOpsEntry(GameProfile p_i46492_1_, int p_i46492_2_, boolean p_i46492_3_) + { + super(p_i46492_1_); + this.field_152645_a = p_i46492_2_; + this.field_183025_b = p_i46492_3_; + } + + public UserListOpsEntry(JsonObject p_i1150_1_) + { + super(func_152643_b(p_i1150_1_), p_i1150_1_); + this.field_152645_a = p_i1150_1_.has("level") ? p_i1150_1_.get("level").getAsInt() : 0; + this.field_183025_b = p_i1150_1_.has("bypassesPlayerLimit") && p_i1150_1_.get("bypassesPlayerLimit").getAsBoolean(); + } + + /** + * Gets the permission level of the user, as defined in the "level" attribute of the ops.json file + */ + public int getPermissionLevel() + { + return this.field_152645_a; + } + + public boolean func_183024_b() + { + return this.field_183025_b; + } + + protected void onSerialization(JsonObject data) + { + if (this.getValue() != null) + { + data.addProperty("uuid", ((GameProfile)this.getValue()).getId() == null ? "" : ((GameProfile)this.getValue()).getId().toString()); + data.addProperty("name", ((GameProfile)this.getValue()).getName()); + super.onSerialization(data); + data.addProperty("level", (Number)Integer.valueOf(this.field_152645_a)); + data.addProperty("bypassesPlayerLimit", Boolean.valueOf(this.field_183025_b)); + } + } + + private static GameProfile func_152643_b(JsonObject p_152643_0_) + { + if (p_152643_0_.has("uuid") && p_152643_0_.has("name")) + { + String s = p_152643_0_.get("uuid").getAsString(); + UUID uuid; + + try + { + uuid = UUID.fromString(s); + } + catch (Throwable var4) + { + return null; + } + + return new GameProfile(uuid, p_152643_0_.get("name").getAsString()); + } + else + { + return null; + } + } +} diff --git a/src/minecraft/net/minecraft/server/management/UserListWhitelist.java b/src/minecraft/net/minecraft/server/management/UserListWhitelist.java new file mode 100644 index 0000000..5836f98 --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/UserListWhitelist.java @@ -0,0 +1,52 @@ +package net.minecraft.server.management; + +import com.google.gson.JsonObject; +import com.mojang.authlib.GameProfile; +import java.io.File; + +public class UserListWhitelist extends UserList +{ + public UserListWhitelist(File p_i1132_1_) + { + super(p_i1132_1_); + } + + protected UserListEntry createEntry(JsonObject entryData) + { + return new UserListWhitelistEntry(entryData); + } + + public String[] getKeys() + { + String[] astring = new String[this.getValues().size()]; + int i = 0; + + for (UserListWhitelistEntry userlistwhitelistentry : this.getValues().values()) + { + astring[i++] = ((GameProfile)userlistwhitelistentry.getValue()).getName(); + } + + return astring; + } + + /** + * Gets the key value for the given object + */ + protected String getObjectKey(GameProfile obj) + { + return obj.getId().toString(); + } + + public GameProfile func_152706_a(String p_152706_1_) + { + for (UserListWhitelistEntry userlistwhitelistentry : this.getValues().values()) + { + if (p_152706_1_.equalsIgnoreCase(((GameProfile)userlistwhitelistentry.getValue()).getName())) + { + return (GameProfile)userlistwhitelistentry.getValue(); + } + } + + return null; + } +} diff --git a/src/minecraft/net/minecraft/server/management/UserListWhitelistEntry.java b/src/minecraft/net/minecraft/server/management/UserListWhitelistEntry.java new file mode 100644 index 0000000..2bb4eab --- /dev/null +++ b/src/minecraft/net/minecraft/server/management/UserListWhitelistEntry.java @@ -0,0 +1,52 @@ +package net.minecraft.server.management; + +import com.google.gson.JsonObject; +import com.mojang.authlib.GameProfile; +import java.util.UUID; + +public class UserListWhitelistEntry extends UserListEntry +{ + public UserListWhitelistEntry(GameProfile profile) + { + super(profile); + } + + public UserListWhitelistEntry(JsonObject p_i1130_1_) + { + super(gameProfileFromJsonObject(p_i1130_1_), p_i1130_1_); + } + + protected void onSerialization(JsonObject data) + { + if (this.getValue() != null) + { + data.addProperty("uuid", ((GameProfile)this.getValue()).getId() == null ? "" : ((GameProfile)this.getValue()).getId().toString()); + data.addProperty("name", ((GameProfile)this.getValue()).getName()); + super.onSerialization(data); + } + } + + private static GameProfile gameProfileFromJsonObject(JsonObject p_152646_0_) + { + if (p_152646_0_.has("uuid") && p_152646_0_.has("name")) + { + String s = p_152646_0_.get("uuid").getAsString(); + UUID uuid; + + try + { + uuid = UUID.fromString(s); + } + catch (Throwable var4) + { + return null; + } + + return new GameProfile(uuid, p_152646_0_.get("name").getAsString()); + } + else + { + return null; + } + } +} diff --git a/src/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java b/src/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java new file mode 100644 index 0000000..a25e99d --- /dev/null +++ b/src/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java @@ -0,0 +1,70 @@ +package net.minecraft.server.network; + +import net.minecraft.network.EnumConnectionState; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.handshake.INetHandlerHandshakeServer; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.network.login.server.S00PacketDisconnect; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; + +public class NetHandlerHandshakeTCP implements INetHandlerHandshakeServer +{ + private final MinecraftServer server; + private final NetworkManager networkManager; + + public NetHandlerHandshakeTCP(MinecraftServer serverIn, NetworkManager netManager) + { + this.server = serverIn; + this.networkManager = netManager; + } + + /** + * There are two recognized intentions for initiating a handshake: logging in and acquiring server status. The + * NetworkManager's protocol will be reconfigured according to the specified intention, although a login-intention + * must pass a versioncheck or receive a disconnect otherwise + */ + public void processHandshake(C00Handshake packetIn) + { + switch (packetIn.getRequestedState()) + { + case LOGIN: + this.networkManager.setConnectionState(EnumConnectionState.LOGIN); + + if (packetIn.getProtocolVersion() > 47) + { + ChatComponentText chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.8"); + this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext)); + this.networkManager.closeChannel(chatcomponenttext); + } + else if (packetIn.getProtocolVersion() < 47) + { + ChatComponentText chatcomponenttext1 = new ChatComponentText("Outdated client! Please use 1.8.8"); + this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext1)); + this.networkManager.closeChannel(chatcomponenttext1); + } + else + { + this.networkManager.setNetHandler(new NetHandlerLoginServer(this.server, this.networkManager)); + } + + break; + + case STATUS: + this.networkManager.setConnectionState(EnumConnectionState.STATUS); + this.networkManager.setNetHandler(new NetHandlerStatusServer(this.server, this.networkManager)); + break; + + default: + throw new UnsupportedOperationException("Invalid intention " + packetIn.getRequestedState()); + } + } + + /** + * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination + */ + public void onDisconnect(IChatComponent reason) + { + } +} diff --git a/src/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java b/src/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java new file mode 100644 index 0000000..a229b08 --- /dev/null +++ b/src/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java @@ -0,0 +1,248 @@ +package net.minecraft.server.network; + +import com.google.common.base.Charsets; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.exceptions.AuthenticationUnavailableException; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelFutureListener; +import io.netty.util.concurrent.GenericFutureListener; +import java.math.BigInteger; +import java.security.PrivateKey; +import java.util.Arrays; +import java.util.Random; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicInteger; +import javax.crypto.SecretKey; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.login.INetHandlerLoginServer; +import net.minecraft.network.login.client.C00PacketLoginStart; +import net.minecraft.network.login.client.C01PacketEncryptionResponse; +import net.minecraft.network.login.server.S00PacketDisconnect; +import net.minecraft.network.login.server.S01PacketEncryptionRequest; +import net.minecraft.network.login.server.S02PacketLoginSuccess; +import net.minecraft.network.login.server.S03PacketEnableCompression; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.CryptManager; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ITickable; +import org.apache.commons.lang3.Validate; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class NetHandlerLoginServer implements INetHandlerLoginServer, ITickable +{ + private static final AtomicInteger AUTHENTICATOR_THREAD_ID = new AtomicInteger(0); + private static final Logger logger = LogManager.getLogger(); + private static final Random RANDOM = new Random(); + private final byte[] verifyToken = new byte[4]; + private final MinecraftServer server; + public final NetworkManager networkManager; + private NetHandlerLoginServer.LoginState currentLoginState = NetHandlerLoginServer.LoginState.HELLO; + + /** How long has player been trying to login into the server. */ + private int connectionTimer; + private GameProfile loginGameProfile; + private String serverId = ""; + private SecretKey secretKey; + private EntityPlayerMP field_181025_l; + + public NetHandlerLoginServer(MinecraftServer p_i45298_1_, NetworkManager p_i45298_2_) + { + this.server = p_i45298_1_; + this.networkManager = p_i45298_2_; + RANDOM.nextBytes(this.verifyToken); + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + if (this.currentLoginState == NetHandlerLoginServer.LoginState.READY_TO_ACCEPT) + { + this.tryAcceptPlayer(); + } + else if (this.currentLoginState == NetHandlerLoginServer.LoginState.DELAY_ACCEPT) + { + EntityPlayerMP entityplayermp = this.server.getConfigurationManager().getPlayerByUUID(this.loginGameProfile.getId()); + + if (entityplayermp == null) + { + this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; + this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.field_181025_l); + this.field_181025_l = null; + } + } + + if (this.connectionTimer++ == 600) + { + this.closeConnection("Took too long to log in"); + } + } + + public void closeConnection(String reason) + { + try + { + logger.info("Disconnecting " + this.getConnectionInfo() + ": " + reason); + ChatComponentText chatcomponenttext = new ChatComponentText(reason); + this.networkManager.sendPacket(new S00PacketDisconnect(chatcomponenttext)); + this.networkManager.closeChannel(chatcomponenttext); + } + catch (Exception exception) + { + logger.error((String)"Error whilst disconnecting player", (Throwable)exception); + } + } + + public void tryAcceptPlayer() + { + if (!this.loginGameProfile.isComplete()) + { + this.loginGameProfile = this.getOfflineProfile(this.loginGameProfile); + } + + String s = this.server.getConfigurationManager().allowUserToConnect(this.networkManager.getRemoteAddress(), this.loginGameProfile); + + if (s != null) + { + this.closeConnection(s); + } + else + { + this.currentLoginState = NetHandlerLoginServer.LoginState.ACCEPTED; + + if (this.server.getNetworkCompressionTreshold() >= 0 && !this.networkManager.isLocalChannel()) + { + this.networkManager.sendPacket(new S03PacketEnableCompression(this.server.getNetworkCompressionTreshold()), new ChannelFutureListener() + { + public void operationComplete(ChannelFuture p_operationComplete_1_) throws Exception + { + NetHandlerLoginServer.this.networkManager.setCompressionTreshold(NetHandlerLoginServer.this.server.getNetworkCompressionTreshold()); + } + }, new GenericFutureListener[0]); + } + + this.networkManager.sendPacket(new S02PacketLoginSuccess(this.loginGameProfile)); + EntityPlayerMP entityplayermp = this.server.getConfigurationManager().getPlayerByUUID(this.loginGameProfile.getId()); + + if (entityplayermp != null) + { + this.currentLoginState = NetHandlerLoginServer.LoginState.DELAY_ACCEPT; + this.field_181025_l = this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile); + } + else + { + this.server.getConfigurationManager().initializeConnectionToPlayer(this.networkManager, this.server.getConfigurationManager().createPlayerForUser(this.loginGameProfile)); + } + } + } + + /** + * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination + */ + public void onDisconnect(IChatComponent reason) + { + logger.info(this.getConnectionInfo() + " lost connection: " + reason.getUnformattedText()); + } + + public String getConnectionInfo() + { + return this.loginGameProfile != null ? this.loginGameProfile.toString() + " (" + this.networkManager.getRemoteAddress().toString() + ")" : String.valueOf((Object)this.networkManager.getRemoteAddress()); + } + + public void processLoginStart(C00PacketLoginStart packetIn) + { + Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.HELLO, "Unexpected hello packet", new Object[0]); + this.loginGameProfile = packetIn.getProfile(); + + if (this.server.isServerInOnlineMode() && !this.networkManager.isLocalChannel()) + { + this.currentLoginState = NetHandlerLoginServer.LoginState.KEY; + this.networkManager.sendPacket(new S01PacketEncryptionRequest(this.serverId, this.server.getKeyPair().getPublic(), this.verifyToken)); + } + else + { + this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; + } + } + + public void processEncryptionResponse(C01PacketEncryptionResponse packetIn) + { + Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.KEY, "Unexpected key packet", new Object[0]); + PrivateKey privatekey = this.server.getKeyPair().getPrivate(); + + if (!Arrays.equals(this.verifyToken, packetIn.getVerifyToken(privatekey))) + { + throw new IllegalStateException("Invalid nonce!"); + } + else + { + this.secretKey = packetIn.getSecretKey(privatekey); + this.currentLoginState = NetHandlerLoginServer.LoginState.AUTHENTICATING; + this.networkManager.enableEncryption(this.secretKey); + (new Thread("User Authenticator #" + AUTHENTICATOR_THREAD_ID.incrementAndGet()) + { + public void run() + { + GameProfile gameprofile = NetHandlerLoginServer.this.loginGameProfile; + + try + { + String s = (new BigInteger(CryptManager.getServerIdHash(NetHandlerLoginServer.this.serverId, NetHandlerLoginServer.this.server.getKeyPair().getPublic(), NetHandlerLoginServer.this.secretKey))).toString(16); + NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s); + + if (NetHandlerLoginServer.this.loginGameProfile != null) + { + NetHandlerLoginServer.logger.info("UUID of player " + NetHandlerLoginServer.this.loginGameProfile.getName() + " is " + NetHandlerLoginServer.this.loginGameProfile.getId()); + NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; + } + else if (NetHandlerLoginServer.this.server.isSinglePlayer()) + { + NetHandlerLoginServer.logger.warn("Failed to verify username but will let them in anyway!"); + NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile); + NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; + } + else + { + NetHandlerLoginServer.this.closeConnection("Failed to verify username!"); + NetHandlerLoginServer.logger.error("Username \'" + NetHandlerLoginServer.this.loginGameProfile.getName() + "\' tried to join with an invalid session"); + } + } + catch (AuthenticationUnavailableException var3) + { + if (NetHandlerLoginServer.this.server.isSinglePlayer()) + { + NetHandlerLoginServer.logger.warn("Authentication servers are down but will let them in anyway!"); + NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile); + NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT; + } + else + { + NetHandlerLoginServer.this.closeConnection("Authentication servers are down. Please try again later, sorry!"); + NetHandlerLoginServer.logger.error("Couldn\'t verify username because servers are unavailable"); + } + } + } + }).start(); + } + } + + protected GameProfile getOfflineProfile(GameProfile original) + { + UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + original.getName()).getBytes(Charsets.UTF_8)); + return new GameProfile(uuid, original.getName()); + } + + static enum LoginState + { + HELLO, + KEY, + AUTHENTICATING, + READY_TO_ACCEPT, + DELAY_ACCEPT, + ACCEPTED; + } +} diff --git a/src/minecraft/net/minecraft/server/network/NetHandlerStatusServer.java b/src/minecraft/net/minecraft/server/network/NetHandlerStatusServer.java new file mode 100644 index 0000000..c1f6e1d --- /dev/null +++ b/src/minecraft/net/minecraft/server/network/NetHandlerStatusServer.java @@ -0,0 +1,51 @@ +package net.minecraft.server.network; + +import net.minecraft.network.NetworkManager; +import net.minecraft.network.status.INetHandlerStatusServer; +import net.minecraft.network.status.client.C00PacketServerQuery; +import net.minecraft.network.status.client.C01PacketPing; +import net.minecraft.network.status.server.S00PacketServerInfo; +import net.minecraft.network.status.server.S01PacketPong; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; + +public class NetHandlerStatusServer implements INetHandlerStatusServer +{ + private static final IChatComponent field_183007_a = new ChatComponentText("Status request has been handled."); + private final MinecraftServer server; + private final NetworkManager networkManager; + private boolean field_183008_d; + + public NetHandlerStatusServer(MinecraftServer serverIn, NetworkManager netManager) + { + this.server = serverIn; + this.networkManager = netManager; + } + + /** + * Invoked when disconnecting, the parameter is a ChatComponent describing the reason for termination + */ + public void onDisconnect(IChatComponent reason) + { + } + + public void processServerQuery(C00PacketServerQuery packetIn) + { + if (this.field_183008_d) + { + this.networkManager.closeChannel(field_183007_a); + } + else + { + this.field_183008_d = true; + this.networkManager.sendPacket(new S00PacketServerInfo(this.server.getServerStatusResponse())); + } + } + + public void processPing(C01PacketPing packetIn) + { + this.networkManager.sendPacket(new S01PacketPong(packetIn.getClientTime())); + this.networkManager.closeChannel(field_183007_a); + } +} diff --git a/src/minecraft/net/minecraft/stats/Achievement.java b/src/minecraft/net/minecraft/stats/Achievement.java new file mode 100644 index 0000000..a2d3fbe --- /dev/null +++ b/src/minecraft/net/minecraft/stats/Achievement.java @@ -0,0 +1,167 @@ +package net.minecraft.stats; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.IJsonSerializable; +import net.minecraft.util.StatCollector; + +public class Achievement extends StatBase +{ + /** + * Is the column (related to center of achievement gui, in 24 pixels unit) that the achievement will be displayed. + */ + public final int displayColumn; + + /** + * Is the row (related to center of achievement gui, in 24 pixels unit) that the achievement will be displayed. + */ + public final int displayRow; + + /** + * Holds the parent achievement, that must be taken before this achievement is avaiable. + */ + public final Achievement parentAchievement; + + /** + * Holds the description of the achievement, ready to be formatted and/or displayed. + */ + private final String achievementDescription; + + /** + * Holds a string formatter for the achievement, some of then needs extra dynamic info - like the key used to open + * the inventory. + */ + private IStatStringFormat statStringFormatter; + + /** + * Holds the ItemStack that will be used to draw the achievement into the GUI. + */ + public final ItemStack theItemStack; + + /** + * Special achievements have a 'spiked' (on normal texture pack) frame, special achievements are the hardest ones to + * achieve. + */ + private boolean isSpecial; + + public Achievement(String p_i46327_1_, String p_i46327_2_, int column, int row, Item p_i46327_5_, Achievement parent) + { + this(p_i46327_1_, p_i46327_2_, column, row, new ItemStack(p_i46327_5_), parent); + } + + public Achievement(String p_i45301_1_, String p_i45301_2_, int column, int row, Block p_i45301_5_, Achievement parent) + { + this(p_i45301_1_, p_i45301_2_, column, row, new ItemStack(p_i45301_5_), parent); + } + + public Achievement(String p_i45302_1_, String p_i45302_2_, int column, int row, ItemStack p_i45302_5_, Achievement parent) + { + super(p_i45302_1_, new ChatComponentTranslation("achievement." + p_i45302_2_, new Object[0])); + this.theItemStack = p_i45302_5_; + this.achievementDescription = "achievement." + p_i45302_2_ + ".desc"; + this.displayColumn = column; + this.displayRow = row; + + if (column < AchievementList.minDisplayColumn) + { + AchievementList.minDisplayColumn = column; + } + + if (row < AchievementList.minDisplayRow) + { + AchievementList.minDisplayRow = row; + } + + if (column > AchievementList.maxDisplayColumn) + { + AchievementList.maxDisplayColumn = column; + } + + if (row > AchievementList.maxDisplayRow) + { + AchievementList.maxDisplayRow = row; + } + + this.parentAchievement = parent; + } + + /** + * Initializes the current stat as independent (i.e., lacking prerequisites for being updated) and returns the + * current instance. + */ + public Achievement initIndependentStat() + { + this.isIndependent = true; + return this; + } + + /** + * Special achievements have a 'spiked' (on normal texture pack) frame, special achievements are the hardest ones to + * achieve. + */ + public Achievement setSpecial() + { + this.isSpecial = true; + return this; + } + + /** + * Register the stat into StatList. + */ + public Achievement registerStat() + { + super.registerStat(); + AchievementList.achievementList.add(this); + return this; + } + + /** + * Returns whether or not the StatBase-derived class is a statistic (running counter) or an achievement (one-shot). + */ + public boolean isAchievement() + { + return true; + } + + public IChatComponent getStatName() + { + IChatComponent ichatcomponent = super.getStatName(); + ichatcomponent.getChatStyle().setColor(this.getSpecial() ? EnumChatFormatting.DARK_PURPLE : EnumChatFormatting.GREEN); + return ichatcomponent; + } + + public Achievement func_150953_b(Class p_150953_1_) + { + return (Achievement)super.func_150953_b(p_150953_1_); + } + + /** + * Returns the fully description of the achievement - ready to be displayed on screen. + */ + public String getDescription() + { + return this.statStringFormatter != null ? this.statStringFormatter.formatString(StatCollector.translateToLocal(this.achievementDescription)) : StatCollector.translateToLocal(this.achievementDescription); + } + + /** + * Defines a string formatter for the achievement. + */ + public Achievement setStatStringFormatter(IStatStringFormat p_75988_1_) + { + this.statStringFormatter = p_75988_1_; + return this; + } + + /** + * Special achievements have a 'spiked' (on normal texture pack) frame, special achievements are the hardest ones to + * achieve. + */ + public boolean getSpecial() + { + return this.isSpecial; + } +} diff --git a/src/minecraft/net/minecraft/stats/AchievementList.java b/src/minecraft/net/minecraft/stats/AchievementList.java new file mode 100644 index 0000000..9000e55 --- /dev/null +++ b/src/minecraft/net/minecraft/stats/AchievementList.java @@ -0,0 +1,127 @@ +package net.minecraft.stats; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.JsonSerializableSet; + +public class AchievementList +{ + /** Is the smallest column used to display a achievement on the GUI. */ + public static int minDisplayColumn; + + /** Is the smallest row used to display a achievement on the GUI. */ + public static int minDisplayRow; + + /** Is the biggest column used to display a achievement on the GUI. */ + public static int maxDisplayColumn; + + /** Is the biggest row used to display a achievement on the GUI. */ + public static int maxDisplayRow; + public static List achievementList = Lists.newArrayList(); + + /** Is the 'open inventory' achievement. */ + public static Achievement openInventory = (new Achievement("achievement.openInventory", "openInventory", 0, 0, Items.book, (Achievement)null)).initIndependentStat().registerStat(); + + /** Is the 'getting wood' achievement. */ + public static Achievement mineWood = (new Achievement("achievement.mineWood", "mineWood", 2, 1, Blocks.log, openInventory)).registerStat(); + + /** Is the 'benchmarking' achievement. */ + public static Achievement buildWorkBench = (new Achievement("achievement.buildWorkBench", "buildWorkBench", 4, -1, Blocks.crafting_table, mineWood)).registerStat(); + + /** Is the 'time to mine' achievement. */ + public static Achievement buildPickaxe = (new Achievement("achievement.buildPickaxe", "buildPickaxe", 4, 2, Items.wooden_pickaxe, buildWorkBench)).registerStat(); + + /** Is the 'hot topic' achievement. */ + public static Achievement buildFurnace = (new Achievement("achievement.buildFurnace", "buildFurnace", 3, 4, Blocks.furnace, buildPickaxe)).registerStat(); + + /** Is the 'acquire hardware' achievement. */ + public static Achievement acquireIron = (new Achievement("achievement.acquireIron", "acquireIron", 1, 4, Items.iron_ingot, buildFurnace)).registerStat(); + + /** Is the 'time to farm' achievement. */ + public static Achievement buildHoe = (new Achievement("achievement.buildHoe", "buildHoe", 2, -3, Items.wooden_hoe, buildWorkBench)).registerStat(); + + /** Is the 'bake bread' achievement. */ + public static Achievement makeBread = (new Achievement("achievement.makeBread", "makeBread", -1, -3, Items.bread, buildHoe)).registerStat(); + + /** Is the 'the lie' achievement. */ + public static Achievement bakeCake = (new Achievement("achievement.bakeCake", "bakeCake", 0, -5, Items.cake, buildHoe)).registerStat(); + + /** Is the 'getting a upgrade' achievement. */ + public static Achievement buildBetterPickaxe = (new Achievement("achievement.buildBetterPickaxe", "buildBetterPickaxe", 6, 2, Items.stone_pickaxe, buildPickaxe)).registerStat(); + + /** Is the 'delicious fish' achievement. */ + public static Achievement cookFish = (new Achievement("achievement.cookFish", "cookFish", 2, 6, Items.cooked_fish, buildFurnace)).registerStat(); + + /** Is the 'on a rail' achievement */ + public static Achievement onARail = (new Achievement("achievement.onARail", "onARail", 2, 3, Blocks.rail, acquireIron)).setSpecial().registerStat(); + + /** Is the 'time to strike' achievement. */ + public static Achievement buildSword = (new Achievement("achievement.buildSword", "buildSword", 6, -1, Items.wooden_sword, buildWorkBench)).registerStat(); + + /** Is the 'monster hunter' achievement. */ + public static Achievement killEnemy = (new Achievement("achievement.killEnemy", "killEnemy", 8, -1, Items.bone, buildSword)).registerStat(); + + /** is the 'cow tipper' achievement. */ + public static Achievement killCow = (new Achievement("achievement.killCow", "killCow", 7, -3, Items.leather, buildSword)).registerStat(); + + /** Is the 'when pig fly' achievement. */ + public static Achievement flyPig = (new Achievement("achievement.flyPig", "flyPig", 9, -3, Items.saddle, killCow)).setSpecial().registerStat(); + + /** The achievement for killing a Skeleton from 50 meters aways. */ + public static Achievement snipeSkeleton = (new Achievement("achievement.snipeSkeleton", "snipeSkeleton", 7, 0, Items.bow, killEnemy)).setSpecial().registerStat(); + + /** Is the 'DIAMONDS!' achievement */ + public static Achievement diamonds = (new Achievement("achievement.diamonds", "diamonds", -1, 5, Blocks.diamond_ore, acquireIron)).registerStat(); + public static Achievement diamondsToYou = (new Achievement("achievement.diamondsToYou", "diamondsToYou", -1, 2, Items.diamond, diamonds)).registerStat(); + + /** Is the 'We Need to Go Deeper' achievement */ + public static Achievement portal = (new Achievement("achievement.portal", "portal", -1, 7, Blocks.obsidian, diamonds)).registerStat(); + + /** Is the 'Return to Sender' achievement */ + public static Achievement ghast = (new Achievement("achievement.ghast", "ghast", -4, 8, Items.ghast_tear, portal)).setSpecial().registerStat(); + + /** Is the 'Into Fire' achievement */ + public static Achievement blazeRod = (new Achievement("achievement.blazeRod", "blazeRod", 0, 9, Items.blaze_rod, portal)).registerStat(); + + /** Is the 'Local Brewery' achievement */ + public static Achievement potion = (new Achievement("achievement.potion", "potion", 2, 8, Items.potionitem, blazeRod)).registerStat(); + + /** Is the 'The End?' achievement */ + public static Achievement theEnd = (new Achievement("achievement.theEnd", "theEnd", 3, 10, Items.ender_eye, blazeRod)).setSpecial().registerStat(); + + /** Is the 'The End.' achievement */ + public static Achievement theEnd2 = (new Achievement("achievement.theEnd2", "theEnd2", 4, 13, Blocks.dragon_egg, theEnd)).setSpecial().registerStat(); + + /** Is the 'Enchanter' achievement */ + public static Achievement enchantments = (new Achievement("achievement.enchantments", "enchantments", -4, 4, Blocks.enchanting_table, diamonds)).registerStat(); + public static Achievement overkill = (new Achievement("achievement.overkill", "overkill", -4, 1, Items.diamond_sword, enchantments)).setSpecial().registerStat(); + + /** Is the 'Librarian' achievement */ + public static Achievement bookcase = (new Achievement("achievement.bookcase", "bookcase", -3, 6, Blocks.bookshelf, enchantments)).registerStat(); + + /** Is the 'Repopulation' achievement */ + public static Achievement breedCow = (new Achievement("achievement.breedCow", "breedCow", 7, -5, Items.wheat, killCow)).registerStat(); + + /** Is the 'The Beginning?' achievement */ + public static Achievement spawnWither = (new Achievement("achievement.spawnWither", "spawnWither", 7, 12, new ItemStack(Items.skull, 1, 1), theEnd2)).registerStat(); + + /** Is the 'The Beginning.' achievement */ + public static Achievement killWither = (new Achievement("achievement.killWither", "killWither", 7, 10, Items.nether_star, spawnWither)).registerStat(); + + /** Is the 'Beaconator' achievement */ + public static Achievement fullBeacon = (new Achievement("achievement.fullBeacon", "fullBeacon", 7, 8, Blocks.beacon, killWither)).setSpecial().registerStat(); + + /** Is the 'Adventuring Time' achievement */ + public static Achievement exploreAllBiomes = (new Achievement("achievement.exploreAllBiomes", "exploreAllBiomes", 4, 8, Items.diamond_boots, theEnd)).func_150953_b(JsonSerializableSet.class).setSpecial().registerStat(); + public static Achievement overpowered = (new Achievement("achievement.overpowered", "overpowered", 6, 4, new ItemStack(Items.golden_apple, 1, 1), buildBetterPickaxe)).setSpecial().registerStat(); + + /** + * A stub functions called to make the static initializer for this class run. + */ + public static void init() + { + } +} diff --git a/src/minecraft/net/minecraft/stats/IStatStringFormat.java b/src/minecraft/net/minecraft/stats/IStatStringFormat.java new file mode 100644 index 0000000..64240eb --- /dev/null +++ b/src/minecraft/net/minecraft/stats/IStatStringFormat.java @@ -0,0 +1,9 @@ +package net.minecraft.stats; + +public interface IStatStringFormat +{ + /** + * Formats the strings based on 'IStatStringFormat' interface. + */ + String formatString(String p_74535_1_); +} diff --git a/src/minecraft/net/minecraft/stats/IStatType.java b/src/minecraft/net/minecraft/stats/IStatType.java new file mode 100644 index 0000000..4a945a4 --- /dev/null +++ b/src/minecraft/net/minecraft/stats/IStatType.java @@ -0,0 +1,9 @@ +package net.minecraft.stats; + +public interface IStatType +{ + /** + * Formats a given stat for human consumption. + */ + String format(int p_75843_1_); +} diff --git a/src/minecraft/net/minecraft/stats/ObjectiveStat.java b/src/minecraft/net/minecraft/stats/ObjectiveStat.java new file mode 100644 index 0000000..3a1015a --- /dev/null +++ b/src/minecraft/net/minecraft/stats/ObjectiveStat.java @@ -0,0 +1,14 @@ +package net.minecraft.stats; + +import net.minecraft.scoreboard.ScoreDummyCriteria; + +public class ObjectiveStat extends ScoreDummyCriteria +{ + private final StatBase field_151459_g; + + public ObjectiveStat(StatBase p_i45483_1_) + { + super(p_i45483_1_.statId); + this.field_151459_g = p_i45483_1_; + } +} diff --git a/src/minecraft/net/minecraft/stats/StatBase.java b/src/minecraft/net/minecraft/stats/StatBase.java new file mode 100644 index 0000000..8bf4c10 --- /dev/null +++ b/src/minecraft/net/minecraft/stats/StatBase.java @@ -0,0 +1,174 @@ +package net.minecraft.stats; + +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.util.Locale; +import net.minecraft.event.HoverEvent; +import net.minecraft.scoreboard.IScoreObjectiveCriteria; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.IJsonSerializable; + +public class StatBase +{ + /** The Stat ID */ + public final String statId; + + /** The Stat name */ + private final IChatComponent statName; + public boolean isIndependent; + private final IStatType type; + private final IScoreObjectiveCriteria field_150957_c; + private Class field_150956_d; + private static NumberFormat numberFormat = NumberFormat.getIntegerInstance(Locale.US); + public static IStatType simpleStatType = new IStatType() + { + public String format(int p_75843_1_) + { + return StatBase.numberFormat.format((long)p_75843_1_); + } + }; + private static DecimalFormat decimalFormat = new DecimalFormat("########0.00"); + public static IStatType timeStatType = new IStatType() + { + public String format(int p_75843_1_) + { + double d0 = (double)p_75843_1_ / 20.0D; + double d1 = d0 / 60.0D; + double d2 = d1 / 60.0D; + double d3 = d2 / 24.0D; + double d4 = d3 / 365.0D; + return d4 > 0.5D ? StatBase.decimalFormat.format(d4) + " y" : (d3 > 0.5D ? StatBase.decimalFormat.format(d3) + " d" : (d2 > 0.5D ? StatBase.decimalFormat.format(d2) + " h" : (d1 > 0.5D ? StatBase.decimalFormat.format(d1) + " m" : d0 + " s"))); + } + }; + public static IStatType distanceStatType = new IStatType() + { + public String format(int p_75843_1_) + { + double d0 = (double)p_75843_1_ / 100.0D; + double d1 = d0 / 1000.0D; + return d1 > 0.5D ? StatBase.decimalFormat.format(d1) + " km" : (d0 > 0.5D ? StatBase.decimalFormat.format(d0) + " m" : p_75843_1_ + " cm"); + } + }; + public static IStatType field_111202_k = new IStatType() + { + public String format(int p_75843_1_) + { + return StatBase.decimalFormat.format((double)p_75843_1_ * 0.1D); + } + }; + + public StatBase(String statIdIn, IChatComponent statNameIn, IStatType typeIn) + { + this.statId = statIdIn; + this.statName = statNameIn; + this.type = typeIn; + this.field_150957_c = new ObjectiveStat(this); + IScoreObjectiveCriteria.INSTANCES.put(this.field_150957_c.getName(), this.field_150957_c); + } + + public StatBase(String statIdIn, IChatComponent statNameIn) + { + this(statIdIn, statNameIn, simpleStatType); + } + + /** + * Initializes the current stat as independent (i.e., lacking prerequisites for being updated) and returns the + * current instance. + */ + public StatBase initIndependentStat() + { + this.isIndependent = true; + return this; + } + + /** + * Register the stat into StatList. + */ + public StatBase registerStat() + { + if (StatList.oneShotStats.containsKey(this.statId)) + { + throw new RuntimeException("Duplicate stat id: \"" + ((StatBase)StatList.oneShotStats.get(this.statId)).statName + "\" and \"" + this.statName + "\" at id " + this.statId); + } + else + { + StatList.allStats.add(this); + StatList.oneShotStats.put(this.statId, this); + return this; + } + } + + /** + * Returns whether or not the StatBase-derived class is a statistic (running counter) or an achievement (one-shot). + */ + public boolean isAchievement() + { + return false; + } + + public String format(int p_75968_1_) + { + return this.type.format(p_75968_1_); + } + + public IChatComponent getStatName() + { + IChatComponent ichatcomponent = this.statName.createCopy(); + ichatcomponent.getChatStyle().setColor(EnumChatFormatting.GRAY); + ichatcomponent.getChatStyle().setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ACHIEVEMENT, new ChatComponentText(this.statId))); + return ichatcomponent; + } + + public IChatComponent func_150955_j() + { + IChatComponent ichatcomponent = this.getStatName(); + IChatComponent ichatcomponent1 = (new ChatComponentText("[")).appendSibling(ichatcomponent).appendText("]"); + ichatcomponent1.setChatStyle(ichatcomponent.getChatStyle()); + return ichatcomponent1; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) + { + StatBase statbase = (StatBase)p_equals_1_; + return this.statId.equals(statbase.statId); + } + else + { + return false; + } + } + + public int hashCode() + { + return this.statId.hashCode(); + } + + public String toString() + { + return "Stat{id=" + this.statId + ", nameId=" + this.statName + ", awardLocallyOnly=" + this.isIndependent + ", formatter=" + this.type + ", objectiveCriteria=" + this.field_150957_c + '}'; + } + + public IScoreObjectiveCriteria func_150952_k() + { + return this.field_150957_c; + } + + public Class func_150954_l() + { + return this.field_150956_d; + } + + public StatBase func_150953_b(Class p_150953_1_) + { + this.field_150956_d = p_150953_1_; + return this; + } +} diff --git a/src/minecraft/net/minecraft/stats/StatBasic.java b/src/minecraft/net/minecraft/stats/StatBasic.java new file mode 100644 index 0000000..5b3b3b6 --- /dev/null +++ b/src/minecraft/net/minecraft/stats/StatBasic.java @@ -0,0 +1,26 @@ +package net.minecraft.stats; + +import net.minecraft.util.IChatComponent; + +public class StatBasic extends StatBase +{ + public StatBasic(String statIdIn, IChatComponent statNameIn, IStatType typeIn) + { + super(statIdIn, statNameIn, typeIn); + } + + public StatBasic(String statIdIn, IChatComponent statNameIn) + { + super(statIdIn, statNameIn); + } + + /** + * Register the stat into StatList. + */ + public StatBase registerStat() + { + super.registerStat(); + StatList.generalStats.add(this); + return this; + } +} diff --git a/src/minecraft/net/minecraft/stats/StatCrafting.java b/src/minecraft/net/minecraft/stats/StatCrafting.java new file mode 100644 index 0000000..b04352e --- /dev/null +++ b/src/minecraft/net/minecraft/stats/StatCrafting.java @@ -0,0 +1,27 @@ +package net.minecraft.stats; + +import net.minecraft.item.Item; +import net.minecraft.scoreboard.IScoreObjectiveCriteria; +import net.minecraft.util.IChatComponent; + +public class StatCrafting extends StatBase +{ + private final Item field_150960_a; + + public StatCrafting(String p_i45910_1_, String p_i45910_2_, IChatComponent statNameIn, Item p_i45910_4_) + { + super(p_i45910_1_ + p_i45910_2_, statNameIn); + this.field_150960_a = p_i45910_4_; + int i = Item.getIdFromItem(p_i45910_4_); + + if (i != 0) + { + IScoreObjectiveCriteria.INSTANCES.put(p_i45910_1_ + i, this.func_150952_k()); + } + } + + public Item func_150959_a() + { + return this.field_150960_a; + } +} diff --git a/src/minecraft/net/minecraft/stats/StatFileWriter.java b/src/minecraft/net/minecraft/stats/StatFileWriter.java new file mode 100644 index 0000000..6f55180 --- /dev/null +++ b/src/minecraft/net/minecraft/stats/StatFileWriter.java @@ -0,0 +1,100 @@ +package net.minecraft.stats; + +import com.google.common.collect.Maps; +import java.util.Map; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.IJsonSerializable; +import net.minecraft.util.TupleIntJsonSerializable; + +public class StatFileWriter +{ + protected final Map statsData = Maps.newConcurrentMap(); + + /** + * Returns true if the achievement has been unlocked. + */ + public boolean hasAchievementUnlocked(Achievement achievementIn) + { + return this.readStat(achievementIn) > 0; + } + + /** + * Returns true if the parent has been unlocked, or there is no parent + */ + public boolean canUnlockAchievement(Achievement achievementIn) + { + return achievementIn.parentAchievement == null || this.hasAchievementUnlocked(achievementIn.parentAchievement); + } + + public int func_150874_c(Achievement p_150874_1_) + { + if (this.hasAchievementUnlocked(p_150874_1_)) + { + return 0; + } + else + { + int i = 0; + + for (Achievement achievement = p_150874_1_.parentAchievement; achievement != null && !this.hasAchievementUnlocked(achievement); ++i) + { + achievement = achievement.parentAchievement; + } + + return i; + } + } + + public void increaseStat(EntityPlayer player, StatBase stat, int amount) + { + if (!stat.isAchievement() || this.canUnlockAchievement((Achievement)stat)) + { + this.unlockAchievement(player, stat, this.readStat(stat) + amount); + } + } + + /** + * Triggers the logging of an achievement and attempts to announce to server + */ + public void unlockAchievement(EntityPlayer playerIn, StatBase statIn, int p_150873_3_) + { + TupleIntJsonSerializable tupleintjsonserializable = (TupleIntJsonSerializable)this.statsData.get(statIn); + + if (tupleintjsonserializable == null) + { + tupleintjsonserializable = new TupleIntJsonSerializable(); + this.statsData.put(statIn, tupleintjsonserializable); + } + + tupleintjsonserializable.setIntegerValue(p_150873_3_); + } + + /** + * Reads the given stat and returns its value as an int. + */ + public int readStat(StatBase stat) + { + TupleIntJsonSerializable tupleintjsonserializable = (TupleIntJsonSerializable)this.statsData.get(stat); + return tupleintjsonserializable == null ? 0 : tupleintjsonserializable.getIntegerValue(); + } + + public T func_150870_b(StatBase p_150870_1_) + { + TupleIntJsonSerializable tupleintjsonserializable = (TupleIntJsonSerializable)this.statsData.get(p_150870_1_); + return (T)(tupleintjsonserializable != null ? tupleintjsonserializable.getJsonSerializableValue() : null); + } + + public T func_150872_a(StatBase p_150872_1_, T p_150872_2_) + { + TupleIntJsonSerializable tupleintjsonserializable = (TupleIntJsonSerializable)this.statsData.get(p_150872_1_); + + if (tupleintjsonserializable == null) + { + tupleintjsonserializable = new TupleIntJsonSerializable(); + this.statsData.put(p_150872_1_, tupleintjsonserializable); + } + + tupleintjsonserializable.setJsonSerializableValue(p_150872_2_); + return (T)p_150872_2_; + } +} diff --git a/src/minecraft/net/minecraft/stats/StatList.java b/src/minecraft/net/minecraft/stats/StatList.java new file mode 100644 index 0000000..c2c2e66 --- /dev/null +++ b/src/minecraft/net/minecraft/stats/StatList.java @@ -0,0 +1,302 @@ +package net.minecraft.stats; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.util.List; +import java.util.Map; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityList; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.ResourceLocation; + +public class StatList +{ + protected static Map oneShotStats = Maps.newHashMap(); + public static List allStats = Lists.newArrayList(); + public static List generalStats = Lists.newArrayList(); + public static List itemStats = Lists.newArrayList(); + public static List objectMineStats = Lists.newArrayList(); + + /** number of times you've left a game */ + public static StatBase leaveGameStat = (new StatBasic("stat.leaveGame", new ChatComponentTranslation("stat.leaveGame", new Object[0]))).initIndependentStat().registerStat(); + + /** number of minutes you have played */ + public static StatBase minutesPlayedStat = (new StatBasic("stat.playOneMinute", new ChatComponentTranslation("stat.playOneMinute", new Object[0]), StatBase.timeStatType)).initIndependentStat().registerStat(); + public static StatBase timeSinceDeathStat = (new StatBasic("stat.timeSinceDeath", new ChatComponentTranslation("stat.timeSinceDeath", new Object[0]), StatBase.timeStatType)).initIndependentStat().registerStat(); + + /** distance you've walked */ + public static StatBase distanceWalkedStat = (new StatBasic("stat.walkOneCm", new ChatComponentTranslation("stat.walkOneCm", new Object[0]), StatBase.distanceStatType)).initIndependentStat().registerStat(); + public static StatBase distanceCrouchedStat = (new StatBasic("stat.crouchOneCm", new ChatComponentTranslation("stat.crouchOneCm", new Object[0]), StatBase.distanceStatType)).initIndependentStat().registerStat(); + public static StatBase distanceSprintedStat = (new StatBasic("stat.sprintOneCm", new ChatComponentTranslation("stat.sprintOneCm", new Object[0]), StatBase.distanceStatType)).initIndependentStat().registerStat(); + + /** distance you have swam */ + public static StatBase distanceSwumStat = (new StatBasic("stat.swimOneCm", new ChatComponentTranslation("stat.swimOneCm", new Object[0]), StatBase.distanceStatType)).initIndependentStat().registerStat(); + + /** the distance you have fallen */ + public static StatBase distanceFallenStat = (new StatBasic("stat.fallOneCm", new ChatComponentTranslation("stat.fallOneCm", new Object[0]), StatBase.distanceStatType)).initIndependentStat().registerStat(); + + /** the distance you've climbed */ + public static StatBase distanceClimbedStat = (new StatBasic("stat.climbOneCm", new ChatComponentTranslation("stat.climbOneCm", new Object[0]), StatBase.distanceStatType)).initIndependentStat().registerStat(); + + /** the distance you've flown */ + public static StatBase distanceFlownStat = (new StatBasic("stat.flyOneCm", new ChatComponentTranslation("stat.flyOneCm", new Object[0]), StatBase.distanceStatType)).initIndependentStat().registerStat(); + + /** the distance you've dived */ + public static StatBase distanceDoveStat = (new StatBasic("stat.diveOneCm", new ChatComponentTranslation("stat.diveOneCm", new Object[0]), StatBase.distanceStatType)).initIndependentStat().registerStat(); + + /** the distance you've traveled by minecart */ + public static StatBase distanceByMinecartStat = (new StatBasic("stat.minecartOneCm", new ChatComponentTranslation("stat.minecartOneCm", new Object[0]), StatBase.distanceStatType)).initIndependentStat().registerStat(); + + /** the distance you've traveled by boat */ + public static StatBase distanceByBoatStat = (new StatBasic("stat.boatOneCm", new ChatComponentTranslation("stat.boatOneCm", new Object[0]), StatBase.distanceStatType)).initIndependentStat().registerStat(); + + /** the distance you've traveled by pig */ + public static StatBase distanceByPigStat = (new StatBasic("stat.pigOneCm", new ChatComponentTranslation("stat.pigOneCm", new Object[0]), StatBase.distanceStatType)).initIndependentStat().registerStat(); + public static StatBase distanceByHorseStat = (new StatBasic("stat.horseOneCm", new ChatComponentTranslation("stat.horseOneCm", new Object[0]), StatBase.distanceStatType)).initIndependentStat().registerStat(); + + /** the times you've jumped */ + public static StatBase jumpStat = (new StatBasic("stat.jump", new ChatComponentTranslation("stat.jump", new Object[0]))).initIndependentStat().registerStat(); + + /** the distance you've dropped (or times you've fallen?) */ + public static StatBase dropStat = (new StatBasic("stat.drop", new ChatComponentTranslation("stat.drop", new Object[0]))).initIndependentStat().registerStat(); + + /** the amount of damage you've dealt */ + public static StatBase damageDealtStat = (new StatBasic("stat.damageDealt", new ChatComponentTranslation("stat.damageDealt", new Object[0]), StatBase.field_111202_k)).registerStat(); + + /** the amount of damage you have taken */ + public static StatBase damageTakenStat = (new StatBasic("stat.damageTaken", new ChatComponentTranslation("stat.damageTaken", new Object[0]), StatBase.field_111202_k)).registerStat(); + + /** the number of times you have died */ + public static StatBase deathsStat = (new StatBasic("stat.deaths", new ChatComponentTranslation("stat.deaths", new Object[0]))).registerStat(); + + /** the number of mobs you have killed */ + public static StatBase mobKillsStat = (new StatBasic("stat.mobKills", new ChatComponentTranslation("stat.mobKills", new Object[0]))).registerStat(); + + /** the number of animals you have bred */ + public static StatBase animalsBredStat = (new StatBasic("stat.animalsBred", new ChatComponentTranslation("stat.animalsBred", new Object[0]))).registerStat(); + + /** counts the number of times you've killed a player */ + public static StatBase playerKillsStat = (new StatBasic("stat.playerKills", new ChatComponentTranslation("stat.playerKills", new Object[0]))).registerStat(); + public static StatBase fishCaughtStat = (new StatBasic("stat.fishCaught", new ChatComponentTranslation("stat.fishCaught", new Object[0]))).registerStat(); + public static StatBase junkFishedStat = (new StatBasic("stat.junkFished", new ChatComponentTranslation("stat.junkFished", new Object[0]))).registerStat(); + public static StatBase treasureFishedStat = (new StatBasic("stat.treasureFished", new ChatComponentTranslation("stat.treasureFished", new Object[0]))).registerStat(); + public static StatBase timesTalkedToVillagerStat = (new StatBasic("stat.talkedToVillager", new ChatComponentTranslation("stat.talkedToVillager", new Object[0]))).registerStat(); + public static StatBase timesTradedWithVillagerStat = (new StatBasic("stat.tradedWithVillager", new ChatComponentTranslation("stat.tradedWithVillager", new Object[0]))).registerStat(); + public static StatBase field_181724_H = (new StatBasic("stat.cakeSlicesEaten", new ChatComponentTranslation("stat.cakeSlicesEaten", new Object[0]))).registerStat(); + public static StatBase field_181725_I = (new StatBasic("stat.cauldronFilled", new ChatComponentTranslation("stat.cauldronFilled", new Object[0]))).registerStat(); + public static StatBase field_181726_J = (new StatBasic("stat.cauldronUsed", new ChatComponentTranslation("stat.cauldronUsed", new Object[0]))).registerStat(); + public static StatBase field_181727_K = (new StatBasic("stat.armorCleaned", new ChatComponentTranslation("stat.armorCleaned", new Object[0]))).registerStat(); + public static StatBase field_181728_L = (new StatBasic("stat.bannerCleaned", new ChatComponentTranslation("stat.bannerCleaned", new Object[0]))).registerStat(); + public static StatBase field_181729_M = (new StatBasic("stat.brewingstandInteraction", new ChatComponentTranslation("stat.brewingstandInteraction", new Object[0]))).registerStat(); + public static StatBase field_181730_N = (new StatBasic("stat.beaconInteraction", new ChatComponentTranslation("stat.beaconInteraction", new Object[0]))).registerStat(); + public static StatBase field_181731_O = (new StatBasic("stat.dropperInspected", new ChatComponentTranslation("stat.dropperInspected", new Object[0]))).registerStat(); + public static StatBase field_181732_P = (new StatBasic("stat.hopperInspected", new ChatComponentTranslation("stat.hopperInspected", new Object[0]))).registerStat(); + public static StatBase field_181733_Q = (new StatBasic("stat.dispenserInspected", new ChatComponentTranslation("stat.dispenserInspected", new Object[0]))).registerStat(); + public static StatBase field_181734_R = (new StatBasic("stat.noteblockPlayed", new ChatComponentTranslation("stat.noteblockPlayed", new Object[0]))).registerStat(); + public static StatBase field_181735_S = (new StatBasic("stat.noteblockTuned", new ChatComponentTranslation("stat.noteblockTuned", new Object[0]))).registerStat(); + public static StatBase field_181736_T = (new StatBasic("stat.flowerPotted", new ChatComponentTranslation("stat.flowerPotted", new Object[0]))).registerStat(); + public static StatBase field_181737_U = (new StatBasic("stat.trappedChestTriggered", new ChatComponentTranslation("stat.trappedChestTriggered", new Object[0]))).registerStat(); + public static StatBase field_181738_V = (new StatBasic("stat.enderchestOpened", new ChatComponentTranslation("stat.enderchestOpened", new Object[0]))).registerStat(); + public static StatBase field_181739_W = (new StatBasic("stat.itemEnchanted", new ChatComponentTranslation("stat.itemEnchanted", new Object[0]))).registerStat(); + public static StatBase field_181740_X = (new StatBasic("stat.recordPlayed", new ChatComponentTranslation("stat.recordPlayed", new Object[0]))).registerStat(); + public static StatBase field_181741_Y = (new StatBasic("stat.furnaceInteraction", new ChatComponentTranslation("stat.furnaceInteraction", new Object[0]))).registerStat(); + public static StatBase field_181742_Z = (new StatBasic("stat.craftingTableInteraction", new ChatComponentTranslation("stat.workbenchInteraction", new Object[0]))).registerStat(); + public static StatBase field_181723_aa = (new StatBasic("stat.chestOpened", new ChatComponentTranslation("stat.chestOpened", new Object[0]))).registerStat(); + public static final StatBase[] mineBlockStatArray = new StatBase[4096]; + + /** Tracks the number of items a given block or item has been crafted. */ + public static final StatBase[] objectCraftStats = new StatBase[32000]; + + /** Tracks the number of times a given block or item has been used. */ + public static final StatBase[] objectUseStats = new StatBase[32000]; + + /** Tracks the number of times a given block or item has been broken. */ + public static final StatBase[] objectBreakStats = new StatBase[32000]; + + public static void init() + { + initMiningStats(); + initStats(); + initItemDepleteStats(); + initCraftableStats(); + AchievementList.init(); + EntityList.func_151514_a(); + } + + /** + * Initializes statistics related to craftable items. Is only called after both block and item stats have been + * initialized. + */ + private static void initCraftableStats() + { + Set set = Sets.newHashSet(); + + for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) + { + if (irecipe.getRecipeOutput() != null) + { + set.add(irecipe.getRecipeOutput().getItem()); + } + } + + for (ItemStack itemstack : FurnaceRecipes.instance().getSmeltingList().values()) + { + set.add(itemstack.getItem()); + } + + for (Item item : set) + { + if (item != null) + { + int i = Item.getIdFromItem(item); + String s = func_180204_a(item); + + if (s != null) + { + objectCraftStats[i] = (new StatCrafting("stat.craftItem.", s, new ChatComponentTranslation("stat.craftItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat(); + } + } + } + + replaceAllSimilarBlocks(objectCraftStats); + } + + private static void initMiningStats() + { + for (Block block : Block.blockRegistry) + { + Item item = Item.getItemFromBlock(block); + + if (item != null) + { + int i = Block.getIdFromBlock(block); + String s = func_180204_a(item); + + if (s != null && block.getEnableStats()) + { + mineBlockStatArray[i] = (new StatCrafting("stat.mineBlock.", s, new ChatComponentTranslation("stat.mineBlock", new Object[] {(new ItemStack(block)).getChatComponent()}), item)).registerStat(); + objectMineStats.add((StatCrafting)mineBlockStatArray[i]); + } + } + } + + replaceAllSimilarBlocks(mineBlockStatArray); + } + + private static void initStats() + { + for (Item item : Item.itemRegistry) + { + if (item != null) + { + int i = Item.getIdFromItem(item); + String s = func_180204_a(item); + + if (s != null) + { + objectUseStats[i] = (new StatCrafting("stat.useItem.", s, new ChatComponentTranslation("stat.useItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat(); + + if (!(item instanceof ItemBlock)) + { + itemStats.add((StatCrafting)objectUseStats[i]); + } + } + } + } + + replaceAllSimilarBlocks(objectUseStats); + } + + private static void initItemDepleteStats() + { + for (Item item : Item.itemRegistry) + { + if (item != null) + { + int i = Item.getIdFromItem(item); + String s = func_180204_a(item); + + if (s != null && item.isDamageable()) + { + objectBreakStats[i] = (new StatCrafting("stat.breakItem.", s, new ChatComponentTranslation("stat.breakItem", new Object[] {(new ItemStack(item)).getChatComponent()}), item)).registerStat(); + } + } + } + + replaceAllSimilarBlocks(objectBreakStats); + } + + private static String func_180204_a(Item p_180204_0_) + { + ResourceLocation resourcelocation = (ResourceLocation)Item.itemRegistry.getNameForObject(p_180204_0_); + return resourcelocation != null ? resourcelocation.toString().replace(':', '.') : null; + } + + /** + * Forces all dual blocks to count for each other on the stats list + */ + private static void replaceAllSimilarBlocks(StatBase[] p_75924_0_) + { + mergeStatBases(p_75924_0_, Blocks.water, Blocks.flowing_water); + mergeStatBases(p_75924_0_, Blocks.lava, Blocks.flowing_lava); + mergeStatBases(p_75924_0_, Blocks.lit_pumpkin, Blocks.pumpkin); + mergeStatBases(p_75924_0_, Blocks.lit_furnace, Blocks.furnace); + mergeStatBases(p_75924_0_, Blocks.lit_redstone_ore, Blocks.redstone_ore); + mergeStatBases(p_75924_0_, Blocks.powered_repeater, Blocks.unpowered_repeater); + mergeStatBases(p_75924_0_, Blocks.powered_comparator, Blocks.unpowered_comparator); + mergeStatBases(p_75924_0_, Blocks.redstone_torch, Blocks.unlit_redstone_torch); + mergeStatBases(p_75924_0_, Blocks.lit_redstone_lamp, Blocks.redstone_lamp); + mergeStatBases(p_75924_0_, Blocks.double_stone_slab, Blocks.stone_slab); + mergeStatBases(p_75924_0_, Blocks.double_wooden_slab, Blocks.wooden_slab); + mergeStatBases(p_75924_0_, Blocks.double_stone_slab2, Blocks.stone_slab2); + mergeStatBases(p_75924_0_, Blocks.grass, Blocks.dirt); + mergeStatBases(p_75924_0_, Blocks.farmland, Blocks.dirt); + } + + /** + * Merge {@link StatBase} object references for similar blocks + */ + private static void mergeStatBases(StatBase[] statBaseIn, Block p_151180_1_, Block p_151180_2_) + { + int i = Block.getIdFromBlock(p_151180_1_); + int j = Block.getIdFromBlock(p_151180_2_); + + if (statBaseIn[i] != null && statBaseIn[j] == null) + { + statBaseIn[j] = statBaseIn[i]; + } + else + { + allStats.remove(statBaseIn[i]); + objectMineStats.remove(statBaseIn[i]); + generalStats.remove(statBaseIn[i]); + statBaseIn[i] = statBaseIn[j]; + } + } + + public static StatBase getStatKillEntity(EntityList.EntityEggInfo eggInfo) + { + String s = EntityList.getStringFromID(eggInfo.spawnedID); + return s == null ? null : (new StatBase("stat.killEntity." + s, new ChatComponentTranslation("stat.entityKill", new Object[] {new ChatComponentTranslation("entity." + s + ".name", new Object[0])}))).registerStat(); + } + + public static StatBase getStatEntityKilledBy(EntityList.EntityEggInfo eggInfo) + { + String s = EntityList.getStringFromID(eggInfo.spawnedID); + return s == null ? null : (new StatBase("stat.entityKilledBy." + s, new ChatComponentTranslation("stat.entityKilledBy", new Object[] {new ChatComponentTranslation("entity." + s + ".name", new Object[0])}))).registerStat(); + } + + public static StatBase getOneShotStat(String p_151177_0_) + { + return (StatBase)oneShotStats.get(p_151177_0_); + } +} diff --git a/src/minecraft/net/minecraft/stats/StatisticsFile.java b/src/minecraft/net/minecraft/stats/StatisticsFile.java new file mode 100644 index 0000000..9403f28 --- /dev/null +++ b/src/minecraft/net/minecraft/stats/StatisticsFile.java @@ -0,0 +1,250 @@ +package net.minecraft.stats; + +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonParser; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.play.server.S37PacketStatistics; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IJsonSerializable; +import net.minecraft.util.TupleIntJsonSerializable; +import org.apache.commons.io.FileUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class StatisticsFile extends StatFileWriter +{ + private static final Logger logger = LogManager.getLogger(); + private final MinecraftServer mcServer; + private final File statsFile; + private final Set field_150888_e = Sets.newHashSet(); + private int field_150885_f = -300; + private boolean field_150886_g = false; + + public StatisticsFile(MinecraftServer serverIn, File statsFileIn) + { + this.mcServer = serverIn; + this.statsFile = statsFileIn; + } + + public void readStatFile() + { + if (this.statsFile.isFile()) + { + try + { + this.statsData.clear(); + this.statsData.putAll(this.parseJson(FileUtils.readFileToString(this.statsFile))); + } + catch (IOException ioexception) + { + logger.error((String)("Couldn\'t read statistics file " + this.statsFile), (Throwable)ioexception); + } + catch (JsonParseException jsonparseexception) + { + logger.error((String)("Couldn\'t parse statistics file " + this.statsFile), (Throwable)jsonparseexception); + } + } + } + + public void saveStatFile() + { + try + { + FileUtils.writeStringToFile(this.statsFile, dumpJson(this.statsData)); + } + catch (IOException ioexception) + { + logger.error((String)"Couldn\'t save stats", (Throwable)ioexception); + } + } + + /** + * Triggers the logging of an achievement and attempts to announce to server + */ + public void unlockAchievement(EntityPlayer playerIn, StatBase statIn, int p_150873_3_) + { + int i = statIn.isAchievement() ? this.readStat(statIn) : 0; + super.unlockAchievement(playerIn, statIn, p_150873_3_); + this.field_150888_e.add(statIn); + + if (statIn.isAchievement() && i == 0 && p_150873_3_ > 0) + { + this.field_150886_g = true; + + if (this.mcServer.isAnnouncingPlayerAchievements()) + { + this.mcServer.getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.achievement", new Object[] {playerIn.getDisplayName(), statIn.func_150955_j()})); + } + } + + if (statIn.isAchievement() && i > 0 && p_150873_3_ == 0) + { + this.field_150886_g = true; + + if (this.mcServer.isAnnouncingPlayerAchievements()) + { + this.mcServer.getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.achievement.taken", new Object[] {playerIn.getDisplayName(), statIn.func_150955_j()})); + } + } + } + + public Set func_150878_c() + { + Set set = Sets.newHashSet(this.field_150888_e); + this.field_150888_e.clear(); + this.field_150886_g = false; + return set; + } + + public Map parseJson(String p_150881_1_) + { + JsonElement jsonelement = (new JsonParser()).parse(p_150881_1_); + + if (!jsonelement.isJsonObject()) + { + return Maps.newHashMap(); + } + else + { + JsonObject jsonobject = jsonelement.getAsJsonObject(); + Map map = Maps.newHashMap(); + + for (Entry entry : jsonobject.entrySet()) + { + StatBase statbase = StatList.getOneShotStat((String)entry.getKey()); + + if (statbase != null) + { + TupleIntJsonSerializable tupleintjsonserializable = new TupleIntJsonSerializable(); + + if (((JsonElement)entry.getValue()).isJsonPrimitive() && ((JsonElement)entry.getValue()).getAsJsonPrimitive().isNumber()) + { + tupleintjsonserializable.setIntegerValue(((JsonElement)entry.getValue()).getAsInt()); + } + else if (((JsonElement)entry.getValue()).isJsonObject()) + { + JsonObject jsonobject1 = ((JsonElement)entry.getValue()).getAsJsonObject(); + + if (jsonobject1.has("value") && jsonobject1.get("value").isJsonPrimitive() && jsonobject1.get("value").getAsJsonPrimitive().isNumber()) + { + tupleintjsonserializable.setIntegerValue(jsonobject1.getAsJsonPrimitive("value").getAsInt()); + } + + if (jsonobject1.has("progress") && statbase.func_150954_l() != null) + { + try + { + Constructor constructor = statbase.func_150954_l().getConstructor(new Class[0]); + IJsonSerializable ijsonserializable = (IJsonSerializable)constructor.newInstance(new Object[0]); + ijsonserializable.fromJson(jsonobject1.get("progress")); + tupleintjsonserializable.setJsonSerializableValue(ijsonserializable); + } + catch (Throwable throwable) + { + logger.warn("Invalid statistic progress in " + this.statsFile, throwable); + } + } + } + + map.put(statbase, tupleintjsonserializable); + } + else + { + logger.warn("Invalid statistic in " + this.statsFile + ": Don\'t know what " + (String)entry.getKey() + " is"); + } + } + + return map; + } + } + + public static String dumpJson(Map p_150880_0_) + { + JsonObject jsonobject = new JsonObject(); + + for (Entry entry : p_150880_0_.entrySet()) + { + if (((TupleIntJsonSerializable)entry.getValue()).getJsonSerializableValue() != null) + { + JsonObject jsonobject1 = new JsonObject(); + jsonobject1.addProperty("value", (Number)Integer.valueOf(((TupleIntJsonSerializable)entry.getValue()).getIntegerValue())); + + try + { + jsonobject1.add("progress", ((TupleIntJsonSerializable)entry.getValue()).getJsonSerializableValue().getSerializableElement()); + } + catch (Throwable throwable) + { + logger.warn("Couldn\'t save statistic " + ((StatBase)entry.getKey()).getStatName() + ": error serializing progress", throwable); + } + + jsonobject.add(((StatBase)entry.getKey()).statId, jsonobject1); + } + else + { + jsonobject.addProperty(((StatBase)entry.getKey()).statId, (Number)Integer.valueOf(((TupleIntJsonSerializable)entry.getValue()).getIntegerValue())); + } + } + + return jsonobject.toString(); + } + + public void func_150877_d() + { + for (StatBase statbase : this.statsData.keySet()) + { + this.field_150888_e.add(statbase); + } + } + + public void func_150876_a(EntityPlayerMP p_150876_1_) + { + int i = this.mcServer.getTickCounter(); + Map map = Maps.newHashMap(); + + if (this.field_150886_g || i - this.field_150885_f > 300) + { + this.field_150885_f = i; + + for (StatBase statbase : this.func_150878_c()) + { + map.put(statbase, Integer.valueOf(this.readStat(statbase))); + } + } + + p_150876_1_.playerNetServerHandler.sendPacket(new S37PacketStatistics(map)); + } + + public void sendAchievements(EntityPlayerMP player) + { + Map map = Maps.newHashMap(); + + for (Achievement achievement : AchievementList.achievementList) + { + if (this.hasAchievementUnlocked(achievement)) + { + map.put(achievement, Integer.valueOf(this.readStat(achievement))); + this.field_150888_e.remove(achievement); + } + } + + player.playerNetServerHandler.sendPacket(new S37PacketStatistics(map)); + } + + public boolean func_150879_e() + { + return this.field_150886_g; + } +} diff --git a/src/minecraft/net/minecraft/tileentity/IHopper.java b/src/minecraft/net/minecraft/tileentity/IHopper.java new file mode 100644 index 0000000..ad7d1b3 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/IHopper.java @@ -0,0 +1,27 @@ +package net.minecraft.tileentity; + +import net.minecraft.inventory.IInventory; +import net.minecraft.world.World; + +public interface IHopper extends IInventory +{ + /** + * Returns the worldObj for this tileEntity. + */ + World getWorld(); + + /** + * Gets the world X position for this hopper entity. + */ + double getXPos(); + + /** + * Gets the world Y position for this hopper entity. + */ + double getYPos(); + + /** + * Gets the world Z position for this hopper entity. + */ + double getZPos(); +} diff --git a/src/minecraft/net/minecraft/tileentity/MobSpawnerBaseLogic.java b/src/minecraft/net/minecraft/tileentity/MobSpawnerBaseLogic.java new file mode 100644 index 0000000..f84c59b --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/MobSpawnerBaseLogic.java @@ -0,0 +1,441 @@ +package net.minecraft.tileentity; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.StringUtils; +import net.minecraft.util.WeightedRandom; +import net.minecraft.world.World; + +public abstract class MobSpawnerBaseLogic +{ + /** The delay to spawn. */ + private int spawnDelay = 20; + private String mobID = "Pig"; + private final List minecartToSpawn = Lists.newArrayList(); + private MobSpawnerBaseLogic.WeightedRandomMinecart randomEntity; + + /** The rotation of the mob inside the mob spawner */ + private double mobRotation; + + /** the previous rotation of the mob inside the mob spawner */ + private double prevMobRotation; + private int minSpawnDelay = 200; + private int maxSpawnDelay = 800; + private int spawnCount = 4; + + /** Cached instance of the entity to render inside the spawner. */ + private Entity cachedEntity; + private int maxNearbyEntities = 6; + + /** The distance from which a player activates the spawner. */ + private int activatingRangeFromPlayer = 16; + + /** The range coefficient for spawning entities around. */ + private int spawnRange = 4; + + /** + * Gets the entity name that should be spawned. + */ + private String getEntityNameToSpawn() + { + if (this.getRandomEntity() == null) + { + if (this.mobID != null && this.mobID.equals("Minecart")) + { + this.mobID = "MinecartRideable"; + } + + return this.mobID; + } + else + { + return this.getRandomEntity().entityType; + } + } + + public void setEntityName(String name) + { + this.mobID = name; + } + + /** + * Returns true if there's a player close enough to this mob spawner to activate it. + */ + private boolean isActivated() + { + BlockPos blockpos = this.getSpawnerPosition(); + return this.getSpawnerWorld().isAnyPlayerWithinRangeAt((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D, (double)this.activatingRangeFromPlayer); + } + + public void updateSpawner() + { + if (this.isActivated()) + { + BlockPos blockpos = this.getSpawnerPosition(); + + if (this.getSpawnerWorld().isRemote) + { + double d3 = (double)((float)blockpos.getX() + this.getSpawnerWorld().rand.nextFloat()); + double d4 = (double)((float)blockpos.getY() + this.getSpawnerWorld().rand.nextFloat()); + double d5 = (double)((float)blockpos.getZ() + this.getSpawnerWorld().rand.nextFloat()); + this.getSpawnerWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d3, d4, d5, 0.0D, 0.0D, 0.0D, new int[0]); + this.getSpawnerWorld().spawnParticle(EnumParticleTypes.FLAME, d3, d4, d5, 0.0D, 0.0D, 0.0D, new int[0]); + + if (this.spawnDelay > 0) + { + --this.spawnDelay; + } + + this.prevMobRotation = this.mobRotation; + this.mobRotation = (this.mobRotation + (double)(1000.0F / ((float)this.spawnDelay + 200.0F))) % 360.0D; + } + else + { + if (this.spawnDelay == -1) + { + this.resetTimer(); + } + + if (this.spawnDelay > 0) + { + --this.spawnDelay; + return; + } + + boolean flag = false; + + for (int i = 0; i < this.spawnCount; ++i) + { + Entity entity = EntityList.createEntityByName(this.getEntityNameToSpawn(), this.getSpawnerWorld()); + + if (entity == null) + { + return; + } + + int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).expand((double)this.spawnRange, (double)this.spawnRange, (double)this.spawnRange)).size(); + + if (j >= this.maxNearbyEntities) + { + this.resetTimer(); + return; + } + + double d0 = (double)blockpos.getX() + (this.getSpawnerWorld().rand.nextDouble() - this.getSpawnerWorld().rand.nextDouble()) * (double)this.spawnRange + 0.5D; + double d1 = (double)(blockpos.getY() + this.getSpawnerWorld().rand.nextInt(3) - 1); + double d2 = (double)blockpos.getZ() + (this.getSpawnerWorld().rand.nextDouble() - this.getSpawnerWorld().rand.nextDouble()) * (double)this.spawnRange + 0.5D; + EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; + entity.setLocationAndAngles(d0, d1, d2, this.getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F); + + if (entityliving == null || entityliving.getCanSpawnHere() && entityliving.isNotColliding()) + { + this.spawnNewEntity(entity, true); + this.getSpawnerWorld().playAuxSFX(2004, blockpos, 0); + + if (entityliving != null) + { + entityliving.spawnExplosionParticle(); + } + + flag = true; + } + } + + if (flag) + { + this.resetTimer(); + } + } + } + } + + private Entity spawnNewEntity(Entity entityIn, boolean spawn) + { + if (this.getRandomEntity() != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + entityIn.writeToNBTOptional(nbttagcompound); + + for (String s : this.getRandomEntity().nbtData.getKeySet()) + { + NBTBase nbtbase = this.getRandomEntity().nbtData.getTag(s); + nbttagcompound.setTag(s, nbtbase.copy()); + } + + entityIn.readFromNBT(nbttagcompound); + + if (entityIn.worldObj != null && spawn) + { + entityIn.worldObj.spawnEntityInWorld(entityIn); + } + + NBTTagCompound nbttagcompound2; + + for (Entity entity = entityIn; nbttagcompound.hasKey("Riding", 10); nbttagcompound = nbttagcompound2) + { + nbttagcompound2 = nbttagcompound.getCompoundTag("Riding"); + Entity entity1 = EntityList.createEntityByName(nbttagcompound2.getString("id"), entityIn.worldObj); + + if (entity1 != null) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + entity1.writeToNBTOptional(nbttagcompound1); + + for (String s1 : nbttagcompound2.getKeySet()) + { + NBTBase nbtbase1 = nbttagcompound2.getTag(s1); + nbttagcompound1.setTag(s1, nbtbase1.copy()); + } + + entity1.readFromNBT(nbttagcompound1); + entity1.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch); + + if (entityIn.worldObj != null && spawn) + { + entityIn.worldObj.spawnEntityInWorld(entity1); + } + + entity.mountEntity(entity1); + } + + entity = entity1; + } + } + else if (entityIn instanceof EntityLivingBase && entityIn.worldObj != null && spawn) + { + if (entityIn instanceof EntityLiving) + { + ((EntityLiving)entityIn).onInitialSpawn(entityIn.worldObj.getDifficultyForLocation(new BlockPos(entityIn)), (IEntityLivingData)null); + } + + entityIn.worldObj.spawnEntityInWorld(entityIn); + } + + return entityIn; + } + + private void resetTimer() + { + if (this.maxSpawnDelay <= this.minSpawnDelay) + { + this.spawnDelay = this.minSpawnDelay; + } + else + { + int i = this.maxSpawnDelay - this.minSpawnDelay; + this.spawnDelay = this.minSpawnDelay + this.getSpawnerWorld().rand.nextInt(i); + } + + if (this.minecartToSpawn.size() > 0) + { + this.setRandomEntity((MobSpawnerBaseLogic.WeightedRandomMinecart)WeightedRandom.getRandomItem(this.getSpawnerWorld().rand, this.minecartToSpawn)); + } + + this.func_98267_a(1); + } + + public void readFromNBT(NBTTagCompound nbt) + { + this.mobID = nbt.getString("EntityId"); + this.spawnDelay = nbt.getShort("Delay"); + this.minecartToSpawn.clear(); + + if (nbt.hasKey("SpawnPotentials", 9)) + { + NBTTagList nbttaglist = nbt.getTagList("SpawnPotentials", 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + this.minecartToSpawn.add(new MobSpawnerBaseLogic.WeightedRandomMinecart(nbttaglist.getCompoundTagAt(i))); + } + } + + if (nbt.hasKey("SpawnData", 10)) + { + this.setRandomEntity(new MobSpawnerBaseLogic.WeightedRandomMinecart(nbt.getCompoundTag("SpawnData"), this.mobID)); + } + else + { + this.setRandomEntity((MobSpawnerBaseLogic.WeightedRandomMinecart)null); + } + + if (nbt.hasKey("MinSpawnDelay", 99)) + { + this.minSpawnDelay = nbt.getShort("MinSpawnDelay"); + this.maxSpawnDelay = nbt.getShort("MaxSpawnDelay"); + this.spawnCount = nbt.getShort("SpawnCount"); + } + + if (nbt.hasKey("MaxNearbyEntities", 99)) + { + this.maxNearbyEntities = nbt.getShort("MaxNearbyEntities"); + this.activatingRangeFromPlayer = nbt.getShort("RequiredPlayerRange"); + } + + if (nbt.hasKey("SpawnRange", 99)) + { + this.spawnRange = nbt.getShort("SpawnRange"); + } + + if (this.getSpawnerWorld() != null) + { + this.cachedEntity = null; + } + } + + public void writeToNBT(NBTTagCompound nbt) + { + String s = this.getEntityNameToSpawn(); + + if (!StringUtils.isNullOrEmpty(s)) + { + nbt.setString("EntityId", s); + nbt.setShort("Delay", (short)this.spawnDelay); + nbt.setShort("MinSpawnDelay", (short)this.minSpawnDelay); + nbt.setShort("MaxSpawnDelay", (short)this.maxSpawnDelay); + nbt.setShort("SpawnCount", (short)this.spawnCount); + nbt.setShort("MaxNearbyEntities", (short)this.maxNearbyEntities); + nbt.setShort("RequiredPlayerRange", (short)this.activatingRangeFromPlayer); + nbt.setShort("SpawnRange", (short)this.spawnRange); + + if (this.getRandomEntity() != null) + { + nbt.setTag("SpawnData", this.getRandomEntity().nbtData.copy()); + } + + if (this.getRandomEntity() != null || this.minecartToSpawn.size() > 0) + { + NBTTagList nbttaglist = new NBTTagList(); + + if (this.minecartToSpawn.size() > 0) + { + for (MobSpawnerBaseLogic.WeightedRandomMinecart mobspawnerbaselogic$weightedrandomminecart : this.minecartToSpawn) + { + nbttaglist.appendTag(mobspawnerbaselogic$weightedrandomminecart.toNBT()); + } + } + else + { + nbttaglist.appendTag(this.getRandomEntity().toNBT()); + } + + nbt.setTag("SpawnPotentials", nbttaglist); + } + } + } + + public Entity func_180612_a(World worldIn) + { + if (this.cachedEntity == null) + { + Entity entity = EntityList.createEntityByName(this.getEntityNameToSpawn(), worldIn); + + if (entity != null) + { + entity = this.spawnNewEntity(entity, false); + this.cachedEntity = entity; + } + } + + return this.cachedEntity; + } + + /** + * Sets the delay to minDelay if parameter given is 1, else return false. + */ + public boolean setDelayToMin(int delay) + { + if (delay == 1 && this.getSpawnerWorld().isRemote) + { + this.spawnDelay = this.minSpawnDelay; + return true; + } + else + { + return false; + } + } + + private MobSpawnerBaseLogic.WeightedRandomMinecart getRandomEntity() + { + return this.randomEntity; + } + + public void setRandomEntity(MobSpawnerBaseLogic.WeightedRandomMinecart p_98277_1_) + { + this.randomEntity = p_98277_1_; + } + + public abstract void func_98267_a(int id); + + public abstract World getSpawnerWorld(); + + public abstract BlockPos getSpawnerPosition(); + + public double getMobRotation() + { + return this.mobRotation; + } + + public double getPrevMobRotation() + { + return this.prevMobRotation; + } + + public class WeightedRandomMinecart extends WeightedRandom.Item + { + private final NBTTagCompound nbtData; + private final String entityType; + + public WeightedRandomMinecart(NBTTagCompound tagCompound) + { + this(tagCompound.getCompoundTag("Properties"), tagCompound.getString("Type"), tagCompound.getInteger("Weight")); + } + + public WeightedRandomMinecart(NBTTagCompound tagCompound, String type) + { + this(tagCompound, type, 1); + } + + private WeightedRandomMinecart(NBTTagCompound tagCompound, String type, int weight) + { + super(weight); + + if (type.equals("Minecart")) + { + if (tagCompound != null) + { + type = EntityMinecart.EnumMinecartType.byNetworkID(tagCompound.getInteger("Type")).getName(); + } + else + { + type = "MinecartRideable"; + } + } + + this.nbtData = tagCompound; + this.entityType = type; + } + + public NBTTagCompound toNBT() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setTag("Properties", this.nbtData); + nbttagcompound.setString("Type", this.entityType); + nbttagcompound.setInteger("Weight", this.itemWeight); + return nbttagcompound; + } + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntity.java b/src/minecraft/net/minecraft/tileentity/TileEntity.java new file mode 100644 index 0000000..69b9bde --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntity.java @@ -0,0 +1,317 @@ +package net.minecraft.tileentity; + +import com.google.common.collect.Maps; +import java.util.Map; +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.block.BlockJukebox; +import net.minecraft.block.state.IBlockState; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public abstract class TileEntity +{ + private static final Logger logger = LogManager.getLogger(); + private static Map < String, Class > nameToClassMap = Maps. < String, Class > newHashMap(); + private static Map < Class , String > classToNameMap = Maps. < Class , String > newHashMap(); + + /** the instance of the world the tile entity is in. */ + protected World worldObj; + protected BlockPos pos = BlockPos.ORIGIN; + protected boolean tileEntityInvalid; + private int blockMetadata = -1; + + /** the Block type that this TileEntity is contained within */ + protected Block blockType; + + /** + * Adds a new two-way mapping between the class and its string name in both hashmaps. + */ + private static void addMapping(Class cl, String id) + { + if (nameToClassMap.containsKey(id)) + { + throw new IllegalArgumentException("Duplicate id: " + id); + } + else + { + nameToClassMap.put(id, cl); + classToNameMap.put(cl, id); + } + } + + /** + * Returns the worldObj for this tileEntity. + */ + public World getWorld() + { + return this.worldObj; + } + + /** + * Sets the worldObj for this tileEntity. + */ + public void setWorldObj(World worldIn) + { + this.worldObj = worldIn; + } + + /** + * Returns true if the worldObj isn't null. + */ + public boolean hasWorldObj() + { + return this.worldObj != null; + } + + public void readFromNBT(NBTTagCompound compound) + { + this.pos = new BlockPos(compound.getInteger("x"), compound.getInteger("y"), compound.getInteger("z")); + } + + public void writeToNBT(NBTTagCompound compound) + { + String s = (String)classToNameMap.get(this.getClass()); + + if (s == null) + { + throw new RuntimeException(this.getClass() + " is missing a mapping! This is a bug!"); + } + else + { + compound.setString("id", s); + compound.setInteger("x", this.pos.getX()); + compound.setInteger("y", this.pos.getY()); + compound.setInteger("z", this.pos.getZ()); + } + } + + /** + * Creates a new entity and loads its data from the specified NBT. + */ + public static TileEntity createAndLoadEntity(NBTTagCompound nbt) + { + TileEntity tileentity = null; + + try + { + Class oclass = (Class)nameToClassMap.get(nbt.getString("id")); + + if (oclass != null) + { + tileentity = (TileEntity)oclass.newInstance(); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + + if (tileentity != null) + { + tileentity.readFromNBT(nbt); + } + else + { + logger.warn("Skipping BlockEntity with id " + nbt.getString("id")); + } + + return tileentity; + } + + public int getBlockMetadata() + { + if (this.blockMetadata == -1) + { + IBlockState iblockstate = this.worldObj.getBlockState(this.pos); + this.blockMetadata = iblockstate.getBlock().getMetaFromState(iblockstate); + } + + return this.blockMetadata; + } + + /** + * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it + * hasn't changed and skip it. + */ + public void markDirty() + { + if (this.worldObj != null) + { + IBlockState iblockstate = this.worldObj.getBlockState(this.pos); + this.blockMetadata = iblockstate.getBlock().getMetaFromState(iblockstate); + this.worldObj.markChunkDirty(this.pos, this); + + if (this.getBlockType() != Blocks.air) + { + this.worldObj.updateComparatorOutputLevel(this.pos, this.getBlockType()); + } + } + } + + /** + * Returns the square of the distance between this entity and the passed in coordinates. + */ + public double getDistanceSq(double x, double y, double z) + { + double d0 = (double)this.pos.getX() + 0.5D - x; + double d1 = (double)this.pos.getY() + 0.5D - y; + double d2 = (double)this.pos.getZ() + 0.5D - z; + return d0 * d0 + d1 * d1 + d2 * d2; + } + + public double getMaxRenderDistanceSquared() + { + return 4096.0D; + } + + public BlockPos getPos() + { + return this.pos; + } + + /** + * Gets the block type at the location of this entity (client-only). + */ + public Block getBlockType() + { + if (this.blockType == null) + { + this.blockType = this.worldObj.getBlockState(this.pos).getBlock(); + } + + return this.blockType; + } + + /** + * Allows for a specialized description packet to be created. This is often used to sync tile entity data from the + * server to the client easily. For example this is used by signs to synchronise the text to be displayed. + */ + public Packet getDescriptionPacket() + { + return null; + } + + public boolean isInvalid() + { + return this.tileEntityInvalid; + } + + /** + * invalidates a tile entity + */ + public void invalidate() + { + this.tileEntityInvalid = true; + } + + /** + * validates a tile entity + */ + public void validate() + { + this.tileEntityInvalid = false; + } + + public boolean receiveClientEvent(int id, int type) + { + return false; + } + + public void updateContainingBlockInfo() + { + this.blockType = null; + this.blockMetadata = -1; + } + + public void addInfoToCrashReport(CrashReportCategory reportCategory) + { + reportCategory.addCrashSectionCallable("Name", new Callable() + { + public String call() throws Exception + { + return (String)TileEntity.classToNameMap.get(TileEntity.this.getClass()) + " // " + TileEntity.this.getClass().getCanonicalName(); + } + }); + + if (this.worldObj != null) + { + CrashReportCategory.addBlockInfo(reportCategory, this.pos, this.getBlockType(), this.getBlockMetadata()); + reportCategory.addCrashSectionCallable("Actual block type", new Callable() + { + public String call() throws Exception + { + int i = Block.getIdFromBlock(TileEntity.this.worldObj.getBlockState(TileEntity.this.pos).getBlock()); + + try + { + return String.format("ID #%d (%s // %s)", new Object[] {Integer.valueOf(i), Block.getBlockById(i).getUnlocalizedName(), Block.getBlockById(i).getClass().getCanonicalName()}); + } + catch (Throwable var3) + { + return "ID #" + i; + } + } + }); + reportCategory.addCrashSectionCallable("Actual block data value", new Callable() + { + public String call() throws Exception + { + IBlockState iblockstate = TileEntity.this.worldObj.getBlockState(TileEntity.this.pos); + int i = iblockstate.getBlock().getMetaFromState(iblockstate); + + if (i < 0) + { + return "Unknown? (Got " + i + ")"; + } + else + { + String s = String.format("%4s", new Object[] {Integer.toBinaryString(i)}).replace(" ", "0"); + return String.format("%1$d / 0x%1$X / 0b%2$s", new Object[] {Integer.valueOf(i), s}); + } + } + }); + } + } + + public void setPos(BlockPos posIn) + { + this.pos = posIn; + } + + public boolean func_183000_F() + { + return false; + } + + static + { + addMapping(TileEntityFurnace.class, "Furnace"); + addMapping(TileEntityChest.class, "Chest"); + addMapping(TileEntityEnderChest.class, "EnderChest"); + addMapping(BlockJukebox.TileEntityJukebox.class, "RecordPlayer"); + addMapping(TileEntityDispenser.class, "Trap"); + addMapping(TileEntityDropper.class, "Dropper"); + addMapping(TileEntitySign.class, "Sign"); + addMapping(TileEntityMobSpawner.class, "MobSpawner"); + addMapping(TileEntityNote.class, "Music"); + addMapping(TileEntityPiston.class, "Piston"); + addMapping(TileEntityBrewingStand.class, "Cauldron"); + addMapping(TileEntityEnchantmentTable.class, "EnchantTable"); + addMapping(TileEntityEndPortal.class, "Airportal"); + addMapping(TileEntityCommandBlock.class, "Control"); + addMapping(TileEntityBeacon.class, "Beacon"); + addMapping(TileEntitySkull.class, "Skull"); + addMapping(TileEntityDaylightDetector.class, "DLDetector"); + addMapping(TileEntityHopper.class, "Hopper"); + addMapping(TileEntityComparator.class, "Comparator"); + addMapping(TileEntityFlowerPot.class, "FlowerPot"); + addMapping(TileEntityBanner.class, "Banner"); + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityBanner.java b/src/minecraft/net/minecraft/tileentity/TileEntityBanner.java new file mode 100644 index 0000000..5f06cad --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityBanner.java @@ -0,0 +1,323 @@ +package net.minecraft.tileentity; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.block.BlockFlower; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; + +public class TileEntityBanner extends TileEntity +{ + private int baseColor; + + /** A list of all the banner patterns. */ + private NBTTagList patterns; + private boolean field_175119_g; + private List patternList; + private List colorList; + + /** + * This is a String representation of this banners pattern and color lists, used for texture caching. + */ + private String patternResourceLocation; + + public void setItemValues(ItemStack stack) + { + this.patterns = null; + + if (stack.hasTagCompound() && stack.getTagCompound().hasKey("BlockEntityTag", 10)) + { + NBTTagCompound nbttagcompound = stack.getTagCompound().getCompoundTag("BlockEntityTag"); + + if (nbttagcompound.hasKey("Patterns")) + { + this.patterns = (NBTTagList)nbttagcompound.getTagList("Patterns", 10).copy(); + } + + if (nbttagcompound.hasKey("Base", 99)) + { + this.baseColor = nbttagcompound.getInteger("Base"); + } + else + { + this.baseColor = stack.getMetadata() & 15; + } + } + else + { + this.baseColor = stack.getMetadata() & 15; + } + + this.patternList = null; + this.colorList = null; + this.patternResourceLocation = ""; + this.field_175119_g = true; + } + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + func_181020_a(compound, this.baseColor, this.patterns); + } + + public static void func_181020_a(NBTTagCompound p_181020_0_, int p_181020_1_, NBTTagList p_181020_2_) + { + p_181020_0_.setInteger("Base", p_181020_1_); + + if (p_181020_2_ != null) + { + p_181020_0_.setTag("Patterns", p_181020_2_); + } + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + this.baseColor = compound.getInteger("Base"); + this.patterns = compound.getTagList("Patterns", 10); + this.patternList = null; + this.colorList = null; + this.patternResourceLocation = null; + this.field_175119_g = true; + } + + /** + * Allows for a specialized description packet to be created. This is often used to sync tile entity data from the + * server to the client easily. For example this is used by signs to synchronise the text to be displayed. + */ + public Packet getDescriptionPacket() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + this.writeToNBT(nbttagcompound); + return new S35PacketUpdateTileEntity(this.pos, 6, nbttagcompound); + } + + public int getBaseColor() + { + return this.baseColor; + } + + public static int getBaseColor(ItemStack stack) + { + NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false); + return nbttagcompound != null && nbttagcompound.hasKey("Base") ? nbttagcompound.getInteger("Base") : stack.getMetadata(); + } + + /** + * Retrieves the amount of patterns stored on an ItemStack. If the tag does not exist this value will be 0. + */ + public static int getPatterns(ItemStack stack) + { + NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false); + return nbttagcompound != null && nbttagcompound.hasKey("Patterns") ? nbttagcompound.getTagList("Patterns", 10).tagCount() : 0; + } + + public List getPatternList() + { + this.initializeBannerData(); + return this.patternList; + } + + public NBTTagList func_181021_d() + { + return this.patterns; + } + + public List getColorList() + { + this.initializeBannerData(); + return this.colorList; + } + + public String func_175116_e() + { + this.initializeBannerData(); + return this.patternResourceLocation; + } + + /** + * Establishes all of the basic properties for the banner. This will also apply the data from the tile entities nbt + * tag compounds. + */ + private void initializeBannerData() + { + if (this.patternList == null || this.colorList == null || this.patternResourceLocation == null) + { + if (!this.field_175119_g) + { + this.patternResourceLocation = ""; + } + else + { + this.patternList = Lists.newArrayList(); + this.colorList = Lists.newArrayList(); + this.patternList.add(TileEntityBanner.EnumBannerPattern.BASE); + this.colorList.add(EnumDyeColor.byDyeDamage(this.baseColor)); + this.patternResourceLocation = "b" + this.baseColor; + + if (this.patterns != null) + { + for (int i = 0; i < this.patterns.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = this.patterns.getCompoundTagAt(i); + TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound.getString("Pattern")); + + if (tileentitybanner$enumbannerpattern != null) + { + this.patternList.add(tileentitybanner$enumbannerpattern); + int j = nbttagcompound.getInteger("Color"); + this.colorList.add(EnumDyeColor.byDyeDamage(j)); + this.patternResourceLocation = this.patternResourceLocation + tileentitybanner$enumbannerpattern.getPatternID() + j; + } + } + } + } + } + } + + /** + * Removes all the banner related data from a provided instance of ItemStack. + */ + public static void removeBannerData(ItemStack stack) + { + NBTTagCompound nbttagcompound = stack.getSubCompound("BlockEntityTag", false); + + if (nbttagcompound != null && nbttagcompound.hasKey("Patterns", 9)) + { + NBTTagList nbttaglist = nbttagcompound.getTagList("Patterns", 10); + + if (nbttaglist.tagCount() > 0) + { + nbttaglist.removeTag(nbttaglist.tagCount() - 1); + + if (nbttaglist.hasNoTags()) + { + stack.getTagCompound().removeTag("BlockEntityTag"); + + if (stack.getTagCompound().hasNoTags()) + { + stack.setTagCompound((NBTTagCompound)null); + } + } + } + } + } + + public static enum EnumBannerPattern + { + BASE("base", "b"), + SQUARE_BOTTOM_LEFT("square_bottom_left", "bl", " ", " ", "# "), + SQUARE_BOTTOM_RIGHT("square_bottom_right", "br", " ", " ", " #"), + SQUARE_TOP_LEFT("square_top_left", "tl", "# ", " ", " "), + SQUARE_TOP_RIGHT("square_top_right", "tr", " #", " ", " "), + STRIPE_BOTTOM("stripe_bottom", "bs", " ", " ", "###"), + STRIPE_TOP("stripe_top", "ts", "###", " ", " "), + STRIPE_LEFT("stripe_left", "ls", "# ", "# ", "# "), + STRIPE_RIGHT("stripe_right", "rs", " #", " #", " #"), + STRIPE_CENTER("stripe_center", "cs", " # ", " # ", " # "), + STRIPE_MIDDLE("stripe_middle", "ms", " ", "###", " "), + STRIPE_DOWNRIGHT("stripe_downright", "drs", "# ", " # ", " #"), + STRIPE_DOWNLEFT("stripe_downleft", "dls", " #", " # ", "# "), + STRIPE_SMALL("small_stripes", "ss", "# #", "# #", " "), + CROSS("cross", "cr", "# #", " # ", "# #"), + STRAIGHT_CROSS("straight_cross", "sc", " # ", "###", " # "), + TRIANGLE_BOTTOM("triangle_bottom", "bt", " ", " # ", "# #"), + TRIANGLE_TOP("triangle_top", "tt", "# #", " # ", " "), + TRIANGLES_BOTTOM("triangles_bottom", "bts", " ", "# #", " # "), + TRIANGLES_TOP("triangles_top", "tts", " # ", "# #", " "), + DIAGONAL_LEFT("diagonal_left", "ld", "## ", "# ", " "), + DIAGONAL_RIGHT("diagonal_up_right", "rd", " ", " #", " ##"), + DIAGONAL_LEFT_MIRROR("diagonal_up_left", "lud", " ", "# ", "## "), + DIAGONAL_RIGHT_MIRROR("diagonal_right", "rud", " ##", " #", " "), + CIRCLE_MIDDLE("circle", "mc", " ", " # ", " "), + RHOMBUS_MIDDLE("rhombus", "mr", " # ", "# #", " # "), + HALF_VERTICAL("half_vertical", "vh", "## ", "## ", "## "), + HALF_HORIZONTAL("half_horizontal", "hh", "###", "###", " "), + HALF_VERTICAL_MIRROR("half_vertical_right", "vhr", " ##", " ##", " ##"), + HALF_HORIZONTAL_MIRROR("half_horizontal_bottom", "hhb", " ", "###", "###"), + BORDER("border", "bo", "###", "# #", "###"), + CURLY_BORDER("curly_border", "cbo", new ItemStack(Blocks.vine)), + CREEPER("creeper", "cre", new ItemStack(Items.skull, 1, 4)), + GRADIENT("gradient", "gra", "# #", " # ", " # "), + GRADIENT_UP("gradient_up", "gru", " # ", " # ", "# #"), + BRICKS("bricks", "bri", new ItemStack(Blocks.brick_block)), + SKULL("skull", "sku", new ItemStack(Items.skull, 1, 1)), + FLOWER("flower", "flo", new ItemStack(Blocks.red_flower, 1, BlockFlower.EnumFlowerType.OXEYE_DAISY.getMeta())), + MOJANG("mojang", "moj", new ItemStack(Items.golden_apple, 1, 1)); + + private String patternName; + private String patternID; + private String[] craftingLayers; + private ItemStack patternCraftingStack; + + private EnumBannerPattern(String name, String id) + { + this.craftingLayers = new String[3]; + this.patternName = name; + this.patternID = id; + } + + private EnumBannerPattern(String name, String id, ItemStack craftingItem) + { + this(name, id); + this.patternCraftingStack = craftingItem; + } + + private EnumBannerPattern(String name, String id, String craftingTop, String craftingMid, String craftingBot) + { + this(name, id); + this.craftingLayers[0] = craftingTop; + this.craftingLayers[1] = craftingMid; + this.craftingLayers[2] = craftingBot; + } + + public String getPatternName() + { + return this.patternName; + } + + public String getPatternID() + { + return this.patternID; + } + + public String[] getCraftingLayers() + { + return this.craftingLayers; + } + + public boolean hasValidCrafting() + { + return this.patternCraftingStack != null || this.craftingLayers[0] != null; + } + + public boolean hasCraftingStack() + { + return this.patternCraftingStack != null; + } + + public ItemStack getCraftingStack() + { + return this.patternCraftingStack; + } + + public static TileEntityBanner.EnumBannerPattern getPatternByID(String id) + { + for (TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern : values()) + { + if (tileentitybanner$enumbannerpattern.patternID.equals(id)) + { + return tileentitybanner$enumbannerpattern; + } + } + + return null; + } + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityBeacon.java b/src/minecraft/net/minecraft/tileentity/TileEntityBeacon.java new file mode 100644 index 0000000..2297632 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityBeacon.java @@ -0,0 +1,507 @@ +package net.minecraft.tileentity; + +import com.google.common.collect.Lists; +import java.util.Arrays; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockStainedGlass; +import net.minecraft.block.BlockStainedGlassPane; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerBeacon; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ITickable; + +public class TileEntityBeacon extends TileEntityLockable implements ITickable, IInventory +{ + /** List of effects that Beacon can apply */ + public static final Potion[][] effectsList = new Potion[][] {{Potion.moveSpeed, Potion.digSpeed}, {Potion.resistance, Potion.jump}, {Potion.damageBoost}, {Potion.regeneration}}; + private final List beamSegments = Lists.newArrayList(); + private long beamRenderCounter; + private float field_146014_j; + private boolean isComplete; + + /** Level of this beacon's pyramid. */ + private int levels = -1; + + /** Primary potion effect given by this beacon. */ + private int primaryEffect; + + /** Secondary potion effect given by this beacon. */ + private int secondaryEffect; + + /** Item given to this beacon as payment. */ + private ItemStack payment; + private String customName; + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + if (this.worldObj.getTotalWorldTime() % 80L == 0L) + { + this.updateBeacon(); + } + } + + public void updateBeacon() + { + this.updateSegmentColors(); + this.addEffectsToPlayers(); + } + + private void addEffectsToPlayers() + { + if (this.isComplete && this.levels > 0 && !this.worldObj.isRemote && this.primaryEffect > 0) + { + double d0 = (double)(this.levels * 10 + 10); + int i = 0; + + if (this.levels >= 4 && this.primaryEffect == this.secondaryEffect) + { + i = 1; + } + + int j = this.pos.getX(); + int k = this.pos.getY(); + int l = this.pos.getZ(); + AxisAlignedBB axisalignedbb = (new AxisAlignedBB((double)j, (double)k, (double)l, (double)(j + 1), (double)(k + 1), (double)(l + 1))).expand(d0, d0, d0).addCoord(0.0D, (double)this.worldObj.getHeight(), 0.0D); + List list = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb); + + for (EntityPlayer entityplayer : list) + { + entityplayer.addPotionEffect(new PotionEffect(this.primaryEffect, 180, i, true, true)); + } + + if (this.levels >= 4 && this.primaryEffect != this.secondaryEffect && this.secondaryEffect > 0) + { + for (EntityPlayer entityplayer1 : list) + { + entityplayer1.addPotionEffect(new PotionEffect(this.secondaryEffect, 180, 0, true, true)); + } + } + } + } + + private void updateSegmentColors() + { + int i = this.levels; + int j = this.pos.getX(); + int k = this.pos.getY(); + int l = this.pos.getZ(); + this.levels = 0; + this.beamSegments.clear(); + this.isComplete = true; + TileEntityBeacon.BeamSegment tileentitybeacon$beamsegment = new TileEntityBeacon.BeamSegment(EntitySheep.func_175513_a(EnumDyeColor.WHITE)); + this.beamSegments.add(tileentitybeacon$beamsegment); + boolean flag = true; + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int i1 = k + 1; i1 < 256; ++i1) + { + IBlockState iblockstate = this.worldObj.getBlockState(blockpos$mutableblockpos.func_181079_c(j, i1, l)); + float[] afloat; + + if (iblockstate.getBlock() == Blocks.stained_glass) + { + afloat = EntitySheep.func_175513_a((EnumDyeColor)iblockstate.getValue(BlockStainedGlass.COLOR)); + } + else + { + if (iblockstate.getBlock() != Blocks.stained_glass_pane) + { + if (iblockstate.getBlock().getLightOpacity() >= 15 && iblockstate.getBlock() != Blocks.bedrock) + { + this.isComplete = false; + this.beamSegments.clear(); + break; + } + + tileentitybeacon$beamsegment.incrementHeight(); + continue; + } + + afloat = EntitySheep.func_175513_a((EnumDyeColor)iblockstate.getValue(BlockStainedGlassPane.COLOR)); + } + + if (!flag) + { + afloat = new float[] {(tileentitybeacon$beamsegment.getColors()[0] + afloat[0]) / 2.0F, (tileentitybeacon$beamsegment.getColors()[1] + afloat[1]) / 2.0F, (tileentitybeacon$beamsegment.getColors()[2] + afloat[2]) / 2.0F}; + } + + if (Arrays.equals(afloat, tileentitybeacon$beamsegment.getColors())) + { + tileentitybeacon$beamsegment.incrementHeight(); + } + else + { + tileentitybeacon$beamsegment = new TileEntityBeacon.BeamSegment(afloat); + this.beamSegments.add(tileentitybeacon$beamsegment); + } + + flag = false; + } + + if (this.isComplete) + { + for (int l1 = 1; l1 <= 4; this.levels = l1++) + { + int i2 = k - l1; + + if (i2 < 0) + { + break; + } + + boolean flag1 = true; + + for (int j1 = j - l1; j1 <= j + l1 && flag1; ++j1) + { + for (int k1 = l - l1; k1 <= l + l1; ++k1) + { + Block block = this.worldObj.getBlockState(new BlockPos(j1, i2, k1)).getBlock(); + + if (block != Blocks.emerald_block && block != Blocks.gold_block && block != Blocks.diamond_block && block != Blocks.iron_block) + { + flag1 = false; + break; + } + } + } + + if (!flag1) + { + break; + } + } + + if (this.levels == 0) + { + this.isComplete = false; + } + } + + if (!this.worldObj.isRemote && this.levels == 4 && i < this.levels) + { + for (EntityPlayer entityplayer : this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, (new AxisAlignedBB((double)j, (double)k, (double)l, (double)j, (double)(k - 4), (double)l)).expand(10.0D, 5.0D, 10.0D))) + { + entityplayer.triggerAchievement(AchievementList.fullBeacon); + } + } + } + + public List getBeamSegments() + { + return this.beamSegments; + } + + public float shouldBeamRender() + { + if (!this.isComplete) + { + return 0.0F; + } + else + { + int i = (int)(this.worldObj.getTotalWorldTime() - this.beamRenderCounter); + this.beamRenderCounter = this.worldObj.getTotalWorldTime(); + + if (i > 1) + { + this.field_146014_j -= (float)i / 40.0F; + + if (this.field_146014_j < 0.0F) + { + this.field_146014_j = 0.0F; + } + } + + this.field_146014_j += 0.025F; + + if (this.field_146014_j > 1.0F) + { + this.field_146014_j = 1.0F; + } + + return this.field_146014_j; + } + } + + /** + * Allows for a specialized description packet to be created. This is often used to sync tile entity data from the + * server to the client easily. For example this is used by signs to synchronise the text to be displayed. + */ + public Packet getDescriptionPacket() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + this.writeToNBT(nbttagcompound); + return new S35PacketUpdateTileEntity(this.pos, 3, nbttagcompound); + } + + public double getMaxRenderDistanceSquared() + { + return 65536.0D; + } + + private int func_183001_h(int p_183001_1_) + { + if (p_183001_1_ >= 0 && p_183001_1_ < Potion.potionTypes.length && Potion.potionTypes[p_183001_1_] != null) + { + Potion potion = Potion.potionTypes[p_183001_1_]; + return potion != Potion.moveSpeed && potion != Potion.digSpeed && potion != Potion.resistance && potion != Potion.jump && potion != Potion.damageBoost && potion != Potion.regeneration ? 0 : p_183001_1_; + } + else + { + return 0; + } + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + this.primaryEffect = this.func_183001_h(compound.getInteger("Primary")); + this.secondaryEffect = this.func_183001_h(compound.getInteger("Secondary")); + this.levels = compound.getInteger("Levels"); + } + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + compound.setInteger("Primary", this.primaryEffect); + compound.setInteger("Secondary", this.secondaryEffect); + compound.setInteger("Levels", this.levels); + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return 1; + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + return index == 0 ? this.payment : null; + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + if (index == 0 && this.payment != null) + { + if (count >= this.payment.stackSize) + { + ItemStack itemstack = this.payment; + this.payment = null; + return itemstack; + } + else + { + this.payment.stackSize -= count; + return new ItemStack(this.payment.getItem(), count, this.payment.getMetadata()); + } + } + else + { + return null; + } + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + if (index == 0 && this.payment != null) + { + ItemStack itemstack = this.payment; + this.payment = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + if (index == 0) + { + this.payment = stack; + } + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.hasCustomName() ? this.customName : "container.beacon"; + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return this.customName != null && this.customName.length() > 0; + } + + public void setName(String name) + { + this.customName = name; + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return 1; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; + } + + public void openInventory(EntityPlayer player) + { + } + + public void closeInventory(EntityPlayer player) + { + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return stack.getItem() == Items.emerald || stack.getItem() == Items.diamond || stack.getItem() == Items.gold_ingot || stack.getItem() == Items.iron_ingot; + } + + public String getGuiID() + { + return "minecraft:beacon"; + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + return new ContainerBeacon(playerInventory, this); + } + + public int getField(int id) + { + switch (id) + { + case 0: + return this.levels; + + case 1: + return this.primaryEffect; + + case 2: + return this.secondaryEffect; + + default: + return 0; + } + } + + public void setField(int id, int value) + { + switch (id) + { + case 0: + this.levels = value; + break; + + case 1: + this.primaryEffect = this.func_183001_h(value); + break; + + case 2: + this.secondaryEffect = this.func_183001_h(value); + } + } + + public int getFieldCount() + { + return 3; + } + + public void clear() + { + this.payment = null; + } + + public boolean receiveClientEvent(int id, int type) + { + if (id == 1) + { + this.updateBeacon(); + return true; + } + else + { + return super.receiveClientEvent(id, type); + } + } + + public static class BeamSegment + { + private final float[] colors; + private int height; + + public BeamSegment(float[] p_i45669_1_) + { + this.colors = p_i45669_1_; + this.height = 1; + } + + protected void incrementHeight() + { + ++this.height; + } + + public float[] getColors() + { + return this.colors; + } + + public int getHeight() + { + return this.height; + } + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java b/src/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java new file mode 100644 index 0000000..ef2adcd --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java @@ -0,0 +1,448 @@ +package net.minecraft.tileentity; + +import java.util.Arrays; +import java.util.List; +import net.minecraft.block.BlockBrewingStand; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerBrewingStand; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemPotion; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.potion.PotionEffect; +import net.minecraft.potion.PotionHelper; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; + +public class TileEntityBrewingStand extends TileEntityLockable implements ITickable, ISidedInventory +{ + /** an array of the input slot indices */ + private static final int[] inputSlots = new int[] {3}; + + /** an array of the output slot indices */ + private static final int[] outputSlots = new int[] {0, 1, 2}; + + /** The ItemStacks currently placed in the slots of the brewing stand */ + private ItemStack[] brewingItemStacks = new ItemStack[4]; + private int brewTime; + + /** + * an integer with each bit specifying whether that slot of the stand contains a potion + */ + private boolean[] filledSlots; + + /** + * used to check if the current ingredient has been removed from the brewing stand during brewing + */ + private Item ingredientID; + private String customName; + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.hasCustomName() ? this.customName : "container.brewing"; + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return this.customName != null && this.customName.length() > 0; + } + + public void setName(String name) + { + this.customName = name; + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.brewingItemStacks.length; + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + if (this.brewTime > 0) + { + --this.brewTime; + + if (this.brewTime == 0) + { + this.brewPotions(); + this.markDirty(); + } + else if (!this.canBrew()) + { + this.brewTime = 0; + this.markDirty(); + } + else if (this.ingredientID != this.brewingItemStacks[3].getItem()) + { + this.brewTime = 0; + this.markDirty(); + } + } + else if (this.canBrew()) + { + this.brewTime = 400; + this.ingredientID = this.brewingItemStacks[3].getItem(); + } + + if (!this.worldObj.isRemote) + { + boolean[] aboolean = this.func_174902_m(); + + if (!Arrays.equals(aboolean, this.filledSlots)) + { + this.filledSlots = aboolean; + IBlockState iblockstate = this.worldObj.getBlockState(this.getPos()); + + if (!(iblockstate.getBlock() instanceof BlockBrewingStand)) + { + return; + } + + for (int i = 0; i < BlockBrewingStand.HAS_BOTTLE.length; ++i) + { + iblockstate = iblockstate.withProperty(BlockBrewingStand.HAS_BOTTLE[i], Boolean.valueOf(aboolean[i])); + } + + this.worldObj.setBlockState(this.pos, iblockstate, 2); + } + } + } + + private boolean canBrew() + { + if (this.brewingItemStacks[3] != null && this.brewingItemStacks[3].stackSize > 0) + { + ItemStack itemstack = this.brewingItemStacks[3]; + + if (!itemstack.getItem().isPotionIngredient(itemstack)) + { + return false; + } + else + { + boolean flag = false; + + for (int i = 0; i < 3; ++i) + { + if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) + { + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.getPotionResult(j, itemstack); + + if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k)) + { + flag = true; + break; + } + + List list = Items.potionitem.getEffects(j); + List list1 = Items.potionitem.getEffects(k); + + if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k) + { + flag = true; + break; + } + } + } + + return flag; + } + } + else + { + return false; + } + } + + private void brewPotions() + { + if (this.canBrew()) + { + ItemStack itemstack = this.brewingItemStacks[3]; + + for (int i = 0; i < 3; ++i) + { + if (this.brewingItemStacks[i] != null && this.brewingItemStacks[i].getItem() == Items.potionitem) + { + int j = this.brewingItemStacks[i].getMetadata(); + int k = this.getPotionResult(j, itemstack); + List list = Items.potionitem.getEffects(j); + List list1 = Items.potionitem.getEffects(k); + + if (j > 0 && list == list1 || list != null && (list.equals(list1) || list1 == null)) + { + if (!ItemPotion.isSplash(j) && ItemPotion.isSplash(k)) + { + this.brewingItemStacks[i].setItemDamage(k); + } + } + else if (j != k) + { + this.brewingItemStacks[i].setItemDamage(k); + } + } + } + + if (itemstack.getItem().hasContainerItem()) + { + this.brewingItemStacks[3] = new ItemStack(itemstack.getItem().getContainerItem()); + } + else + { + --this.brewingItemStacks[3].stackSize; + + if (this.brewingItemStacks[3].stackSize <= 0) + { + this.brewingItemStacks[3] = null; + } + } + } + } + + /** + * The result of brewing a potion of the specified damage value with an ingredient itemstack. + */ + private int getPotionResult(int meta, ItemStack stack) + { + return stack == null ? meta : (stack.getItem().isPotionIngredient(stack) ? PotionHelper.applyIngredient(meta, stack.getItem().getPotionEffect(stack)) : meta); + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + NBTTagList nbttaglist = compound.getTagList("Items", 10); + this.brewingItemStacks = new ItemStack[this.getSizeInventory()]; + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound.getByte("Slot"); + + if (j >= 0 && j < this.brewingItemStacks.length) + { + this.brewingItemStacks[j] = ItemStack.loadItemStackFromNBT(nbttagcompound); + } + } + + this.brewTime = compound.getShort("BrewTime"); + + if (compound.hasKey("CustomName", 8)) + { + this.customName = compound.getString("CustomName"); + } + } + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + compound.setShort("BrewTime", (short)this.brewTime); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.brewingItemStacks.length; ++i) + { + if (this.brewingItemStacks[i] != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Slot", (byte)i); + this.brewingItemStacks[i].writeToNBT(nbttagcompound); + nbttaglist.appendTag(nbttagcompound); + } + } + + compound.setTag("Items", nbttaglist); + + if (this.hasCustomName()) + { + compound.setString("CustomName", this.customName); + } + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + return index >= 0 && index < this.brewingItemStacks.length ? this.brewingItemStacks[index] : null; + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + if (index >= 0 && index < this.brewingItemStacks.length) + { + ItemStack itemstack = this.brewingItemStacks[index]; + this.brewingItemStacks[index] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + if (index >= 0 && index < this.brewingItemStacks.length) + { + ItemStack itemstack = this.brewingItemStacks[index]; + this.brewingItemStacks[index] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + if (index >= 0 && index < this.brewingItemStacks.length) + { + this.brewingItemStacks[index] = stack; + } + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; + } + + public void openInventory(EntityPlayer player) + { + } + + public void closeInventory(EntityPlayer player) + { + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return index == 3 ? stack.getItem().isPotionIngredient(stack) : stack.getItem() == Items.potionitem || stack.getItem() == Items.glass_bottle; + } + + public boolean[] func_174902_m() + { + boolean[] aboolean = new boolean[3]; + + for (int i = 0; i < 3; ++i) + { + if (this.brewingItemStacks[i] != null) + { + aboolean[i] = true; + } + } + + return aboolean; + } + + public int[] getSlotsForFace(EnumFacing side) + { + return side == EnumFacing.UP ? inputSlots : outputSlots; + } + + /** + * Returns true if automation can insert the given item in the given slot from the given side. Args: slot, item, + * side + */ + public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) + { + return this.isItemValidForSlot(index, itemStackIn); + } + + /** + * Returns true if automation can extract the given item in the given slot from the given side. Args: slot, item, + * side + */ + public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) + { + return true; + } + + public String getGuiID() + { + return "minecraft:brewing_stand"; + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + return new ContainerBrewingStand(playerInventory, this); + } + + public int getField(int id) + { + switch (id) + { + case 0: + return this.brewTime; + + default: + return 0; + } + } + + public void setField(int id, int value) + { + switch (id) + { + case 0: + this.brewTime = value; + + default: + } + } + + public int getFieldCount() + { + return 1; + } + + public void clear() + { + for (int i = 0; i < this.brewingItemStacks.length; ++i) + { + this.brewingItemStacks[i] = null; + } + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityChest.java b/src/minecraft/net/minecraft/tileentity/TileEntityChest.java new file mode 100644 index 0000000..c5dc3eb --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityChest.java @@ -0,0 +1,524 @@ +package net.minecraft.tileentity; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockChest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryLargeChest; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; + +public class TileEntityChest extends TileEntityLockable implements ITickable, IInventory +{ + private ItemStack[] chestContents = new ItemStack[27]; + + /** Determines if the check for adjacent chests has taken place. */ + public boolean adjacentChestChecked; + + /** Contains the chest tile located adjacent to this one (if any) */ + public TileEntityChest adjacentChestZNeg; + + /** Contains the chest tile located adjacent to this one (if any) */ + public TileEntityChest adjacentChestXPos; + + /** Contains the chest tile located adjacent to this one (if any) */ + public TileEntityChest adjacentChestXNeg; + + /** Contains the chest tile located adjacent to this one (if any) */ + public TileEntityChest adjacentChestZPos; + + /** The current angle of the lid (between 0 and 1) */ + public float lidAngle; + + /** The angle of the lid last tick */ + public float prevLidAngle; + + /** The number of players currently using this chest */ + public int numPlayersUsing; + + /** Server sync counter (once per 20 ticks) */ + private int ticksSinceSync; + private int cachedChestType; + private String customName; + + public TileEntityChest() + { + this.cachedChestType = -1; + } + + public TileEntityChest(int chestType) + { + this.cachedChestType = chestType; + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return 27; + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + return this.chestContents[index]; + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + if (this.chestContents[index] != null) + { + if (this.chestContents[index].stackSize <= count) + { + ItemStack itemstack1 = this.chestContents[index]; + this.chestContents[index] = null; + this.markDirty(); + return itemstack1; + } + else + { + ItemStack itemstack = this.chestContents[index].splitStack(count); + + if (this.chestContents[index].stackSize == 0) + { + this.chestContents[index] = null; + } + + this.markDirty(); + return itemstack; + } + } + else + { + return null; + } + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + if (this.chestContents[index] != null) + { + ItemStack itemstack = this.chestContents[index]; + this.chestContents[index] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + this.chestContents[index] = stack; + + if (stack != null && stack.stackSize > this.getInventoryStackLimit()) + { + stack.stackSize = this.getInventoryStackLimit(); + } + + this.markDirty(); + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.hasCustomName() ? this.customName : "container.chest"; + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return this.customName != null && this.customName.length() > 0; + } + + public void setCustomName(String name) + { + this.customName = name; + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + NBTTagList nbttaglist = compound.getTagList("Items", 10); + this.chestContents = new ItemStack[this.getSizeInventory()]; + + if (compound.hasKey("CustomName", 8)) + { + this.customName = compound.getString("CustomName"); + } + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound.getByte("Slot") & 255; + + if (j >= 0 && j < this.chestContents.length) + { + this.chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound); + } + } + } + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.chestContents.length; ++i) + { + if (this.chestContents[i] != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Slot", (byte)i); + this.chestContents[i].writeToNBT(nbttagcompound); + nbttaglist.appendTag(nbttagcompound); + } + } + + compound.setTag("Items", nbttaglist); + + if (this.hasCustomName()) + { + compound.setString("CustomName", this.customName); + } + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; + } + + public void updateContainingBlockInfo() + { + super.updateContainingBlockInfo(); + this.adjacentChestChecked = false; + } + + @SuppressWarnings("incomplete-switch") + private void func_174910_a(TileEntityChest chestTe, EnumFacing side) + { + if (chestTe.isInvalid()) + { + this.adjacentChestChecked = false; + } + else if (this.adjacentChestChecked) + { + switch (side) + { + case NORTH: + if (this.adjacentChestZNeg != chestTe) + { + this.adjacentChestChecked = false; + } + + break; + + case SOUTH: + if (this.adjacentChestZPos != chestTe) + { + this.adjacentChestChecked = false; + } + + break; + + case EAST: + if (this.adjacentChestXPos != chestTe) + { + this.adjacentChestChecked = false; + } + + break; + + case WEST: + if (this.adjacentChestXNeg != chestTe) + { + this.adjacentChestChecked = false; + } + } + } + } + + /** + * Performs the check for adjacent chests to determine if this chest is double or not. + */ + public void checkForAdjacentChests() + { + if (!this.adjacentChestChecked) + { + this.adjacentChestChecked = true; + this.adjacentChestXNeg = this.getAdjacentChest(EnumFacing.WEST); + this.adjacentChestXPos = this.getAdjacentChest(EnumFacing.EAST); + this.adjacentChestZNeg = this.getAdjacentChest(EnumFacing.NORTH); + this.adjacentChestZPos = this.getAdjacentChest(EnumFacing.SOUTH); + } + } + + protected TileEntityChest getAdjacentChest(EnumFacing side) + { + BlockPos blockpos = this.pos.offset(side); + + if (this.isChestAt(blockpos)) + { + TileEntity tileentity = this.worldObj.getTileEntity(blockpos); + + if (tileentity instanceof TileEntityChest) + { + TileEntityChest tileentitychest = (TileEntityChest)tileentity; + tileentitychest.func_174910_a(this, side.getOpposite()); + return tileentitychest; + } + } + + return null; + } + + private boolean isChestAt(BlockPos posIn) + { + if (this.worldObj == null) + { + return false; + } + else + { + Block block = this.worldObj.getBlockState(posIn).getBlock(); + return block instanceof BlockChest && ((BlockChest)block).chestType == this.getChestType(); + } + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + this.checkForAdjacentChests(); + int i = this.pos.getX(); + int j = this.pos.getY(); + int k = this.pos.getZ(); + ++this.ticksSinceSync; + + if (!this.worldObj.isRemote && this.numPlayersUsing != 0 && (this.ticksSinceSync + i + j + k) % 200 == 0) + { + this.numPlayersUsing = 0; + float f = 5.0F; + + for (EntityPlayer entityplayer : this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB((double)((float)i - f), (double)((float)j - f), (double)((float)k - f), (double)((float)(i + 1) + f), (double)((float)(j + 1) + f), (double)((float)(k + 1) + f)))) + { + if (entityplayer.openContainer instanceof ContainerChest) + { + IInventory iinventory = ((ContainerChest)entityplayer.openContainer).getLowerChestInventory(); + + if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest)iinventory).isPartOfLargeChest(this)) + { + ++this.numPlayersUsing; + } + } + } + } + + this.prevLidAngle = this.lidAngle; + float f1 = 0.1F; + + if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) + { + double d1 = (double)i + 0.5D; + double d2 = (double)k + 0.5D; + + if (this.adjacentChestZPos != null) + { + d2 += 0.5D; + } + + if (this.adjacentChestXPos != null) + { + d1 += 0.5D; + } + + this.worldObj.playSoundEffect(d1, (double)j + 0.5D, d2, "random.chestopen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + + if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) + { + float f2 = this.lidAngle; + + if (this.numPlayersUsing > 0) + { + this.lidAngle += f1; + } + else + { + this.lidAngle -= f1; + } + + if (this.lidAngle > 1.0F) + { + this.lidAngle = 1.0F; + } + + float f3 = 0.5F; + + if (this.lidAngle < f3 && f2 >= f3 && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) + { + double d3 = (double)i + 0.5D; + double d0 = (double)k + 0.5D; + + if (this.adjacentChestZPos != null) + { + d0 += 0.5D; + } + + if (this.adjacentChestXPos != null) + { + d3 += 0.5D; + } + + this.worldObj.playSoundEffect(d3, (double)j + 0.5D, d0, "random.chestclosed", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + + if (this.lidAngle < 0.0F) + { + this.lidAngle = 0.0F; + } + } + } + + public boolean receiveClientEvent(int id, int type) + { + if (id == 1) + { + this.numPlayersUsing = type; + return true; + } + else + { + return super.receiveClientEvent(id, type); + } + } + + public void openInventory(EntityPlayer player) + { + if (!player.isSpectator()) + { + if (this.numPlayersUsing < 0) + { + this.numPlayersUsing = 0; + } + + ++this.numPlayersUsing; + this.worldObj.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing); + this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType()); + this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType()); + } + } + + public void closeInventory(EntityPlayer player) + { + if (!player.isSpectator() && this.getBlockType() instanceof BlockChest) + { + --this.numPlayersUsing; + this.worldObj.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing); + this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType()); + this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType()); + } + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return true; + } + + /** + * invalidates a tile entity + */ + public void invalidate() + { + super.invalidate(); + this.updateContainingBlockInfo(); + this.checkForAdjacentChests(); + } + + public int getChestType() + { + if (this.cachedChestType == -1) + { + if (this.worldObj == null || !(this.getBlockType() instanceof BlockChest)) + { + return 0; + } + + this.cachedChestType = ((BlockChest)this.getBlockType()).chestType; + } + + return this.cachedChestType; + } + + public String getGuiID() + { + return "minecraft:chest"; + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + return new ContainerChest(playerInventory, this, playerIn); + } + + public int getField(int id) + { + return 0; + } + + public void setField(int id, int value) + { + } + + public int getFieldCount() + { + return 0; + } + + public void clear() + { + for (int i = 0; i < this.chestContents.length; ++i) + { + this.chestContents[i] = null; + } + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityCommandBlock.java b/src/minecraft/net/minecraft/tileentity/TileEntityCommandBlock.java new file mode 100644 index 0000000..acbb884 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityCommandBlock.java @@ -0,0 +1,92 @@ +package net.minecraft.tileentity; + +import io.netty.buffer.ByteBuf; +import net.minecraft.command.CommandResultStats; +import net.minecraft.command.server.CommandBlockLogic; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class TileEntityCommandBlock extends TileEntity +{ + private final CommandBlockLogic commandBlockLogic = new CommandBlockLogic() + { + public BlockPos getPosition() + { + return TileEntityCommandBlock.this.pos; + } + public Vec3 getPositionVector() + { + return new Vec3((double)TileEntityCommandBlock.this.pos.getX() + 0.5D, (double)TileEntityCommandBlock.this.pos.getY() + 0.5D, (double)TileEntityCommandBlock.this.pos.getZ() + 0.5D); + } + public World getEntityWorld() + { + return TileEntityCommandBlock.this.getWorld(); + } + public void setCommand(String command) + { + super.setCommand(command); + TileEntityCommandBlock.this.markDirty(); + } + public void updateCommand() + { + TileEntityCommandBlock.this.getWorld().markBlockForUpdate(TileEntityCommandBlock.this.pos); + } + public int func_145751_f() + { + return 0; + } + public void func_145757_a(ByteBuf p_145757_1_) + { + p_145757_1_.writeInt(TileEntityCommandBlock.this.pos.getX()); + p_145757_1_.writeInt(TileEntityCommandBlock.this.pos.getY()); + p_145757_1_.writeInt(TileEntityCommandBlock.this.pos.getZ()); + } + public Entity getCommandSenderEntity() + { + return null; + } + }; + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + this.commandBlockLogic.writeDataToNBT(compound); + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + this.commandBlockLogic.readDataFromNBT(compound); + } + + /** + * Allows for a specialized description packet to be created. This is often used to sync tile entity data from the + * server to the client easily. For example this is used by signs to synchronise the text to be displayed. + */ + public Packet getDescriptionPacket() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + this.writeToNBT(nbttagcompound); + return new S35PacketUpdateTileEntity(this.pos, 2, nbttagcompound); + } + + public boolean func_183000_F() + { + return true; + } + + public CommandBlockLogic getCommandBlockLogic() + { + return this.commandBlockLogic; + } + + public CommandResultStats getCommandResultStats() + { + return this.commandBlockLogic.getCommandResultStats(); + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityComparator.java b/src/minecraft/net/minecraft/tileentity/TileEntityComparator.java new file mode 100644 index 0000000..755b9c8 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityComparator.java @@ -0,0 +1,30 @@ +package net.minecraft.tileentity; + +import net.minecraft.nbt.NBTTagCompound; + +public class TileEntityComparator extends TileEntity +{ + private int outputSignal; + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + compound.setInteger("OutputSignal", this.outputSignal); + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + this.outputSignal = compound.getInteger("OutputSignal"); + } + + public int getOutputSignal() + { + return this.outputSignal; + } + + public void setOutputSignal(int p_145995_1_) + { + this.outputSignal = p_145995_1_; + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityDaylightDetector.java b/src/minecraft/net/minecraft/tileentity/TileEntityDaylightDetector.java new file mode 100644 index 0000000..f24023a --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityDaylightDetector.java @@ -0,0 +1,23 @@ +package net.minecraft.tileentity; + +import net.minecraft.block.BlockDaylightDetector; +import net.minecraft.util.ITickable; + +public class TileEntityDaylightDetector extends TileEntity implements ITickable +{ + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + if (this.worldObj != null && !this.worldObj.isRemote && this.worldObj.getTotalWorldTime() % 20L == 0L) + { + this.blockType = this.getBlockType(); + + if (this.blockType instanceof BlockDaylightDetector) + { + ((BlockDaylightDetector)this.blockType).updatePower(this.worldObj, this.pos); + } + } + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityDispenser.java b/src/minecraft/net/minecraft/tileentity/TileEntityDispenser.java new file mode 100644 index 0000000..79fd407 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityDispenser.java @@ -0,0 +1,265 @@ +package net.minecraft.tileentity; + +import java.util.Random; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerDispenser; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class TileEntityDispenser extends TileEntityLockable implements IInventory +{ + private static final Random RNG = new Random(); + private ItemStack[] stacks = new ItemStack[9]; + protected String customName; + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return 9; + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + return this.stacks[index]; + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + if (this.stacks[index] != null) + { + if (this.stacks[index].stackSize <= count) + { + ItemStack itemstack1 = this.stacks[index]; + this.stacks[index] = null; + this.markDirty(); + return itemstack1; + } + else + { + ItemStack itemstack = this.stacks[index].splitStack(count); + + if (this.stacks[index].stackSize == 0) + { + this.stacks[index] = null; + } + + this.markDirty(); + return itemstack; + } + } + else + { + return null; + } + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + if (this.stacks[index] != null) + { + ItemStack itemstack = this.stacks[index]; + this.stacks[index] = null; + return itemstack; + } + else + { + return null; + } + } + + public int getDispenseSlot() + { + int i = -1; + int j = 1; + + for (int k = 0; k < this.stacks.length; ++k) + { + if (this.stacks[k] != null && RNG.nextInt(j++) == 0) + { + i = k; + } + } + + return i; + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + this.stacks[index] = stack; + + if (stack != null && stack.stackSize > this.getInventoryStackLimit()) + { + stack.stackSize = this.getInventoryStackLimit(); + } + + this.markDirty(); + } + + /** + * Add the given ItemStack to this Dispenser. Return the Slot the Item was placed in or -1 if no free slot is + * available. + */ + public int addItemStack(ItemStack stack) + { + for (int i = 0; i < this.stacks.length; ++i) + { + if (this.stacks[i] == null || this.stacks[i].getItem() == null) + { + this.setInventorySlotContents(i, stack); + return i; + } + } + + return -1; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.hasCustomName() ? this.customName : "container.dispenser"; + } + + public void setCustomName(String customName) + { + this.customName = customName; + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return this.customName != null; + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + NBTTagList nbttaglist = compound.getTagList("Items", 10); + this.stacks = new ItemStack[this.getSizeInventory()]; + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound.getByte("Slot") & 255; + + if (j >= 0 && j < this.stacks.length) + { + this.stacks[j] = ItemStack.loadItemStackFromNBT(nbttagcompound); + } + } + + if (compound.hasKey("CustomName", 8)) + { + this.customName = compound.getString("CustomName"); + } + } + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.stacks.length; ++i) + { + if (this.stacks[i] != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Slot", (byte)i); + this.stacks[i].writeToNBT(nbttagcompound); + nbttaglist.appendTag(nbttagcompound); + } + } + + compound.setTag("Items", nbttaglist); + + if (this.hasCustomName()) + { + compound.setString("CustomName", this.customName); + } + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; + } + + public void openInventory(EntityPlayer player) + { + } + + public void closeInventory(EntityPlayer player) + { + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return true; + } + + public String getGuiID() + { + return "minecraft:dispenser"; + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + return new ContainerDispenser(playerInventory, this); + } + + public int getField(int id) + { + return 0; + } + + public void setField(int id, int value) + { + } + + public int getFieldCount() + { + return 0; + } + + public void clear() + { + for (int i = 0; i < this.stacks.length; ++i) + { + this.stacks[i] = null; + } + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityDropper.java b/src/minecraft/net/minecraft/tileentity/TileEntityDropper.java new file mode 100644 index 0000000..30adef6 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityDropper.java @@ -0,0 +1,17 @@ +package net.minecraft.tileentity; + +public class TileEntityDropper extends TileEntityDispenser +{ + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.hasCustomName() ? this.customName : "container.dropper"; + } + + public String getGuiID() + { + return "minecraft:dropper"; + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityEnchantmentTable.java b/src/minecraft/net/minecraft/tileentity/TileEntityEnchantmentTable.java new file mode 100644 index 0000000..e117e2a --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityEnchantmentTable.java @@ -0,0 +1,169 @@ +package net.minecraft.tileentity; + +import java.util.Random; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerEnchantment; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.ITickable; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IInteractionObject; + +public class TileEntityEnchantmentTable extends TileEntity implements ITickable, IInteractionObject +{ + public int tickCount; + public float pageFlip; + public float pageFlipPrev; + public float field_145932_k; + public float field_145929_l; + public float bookSpread; + public float bookSpreadPrev; + public float bookRotation; + public float bookRotationPrev; + public float field_145924_q; + private static Random rand = new Random(); + private String customName; + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + + if (this.hasCustomName()) + { + compound.setString("CustomName", this.customName); + } + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + + if (compound.hasKey("CustomName", 8)) + { + this.customName = compound.getString("CustomName"); + } + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + this.bookSpreadPrev = this.bookSpread; + this.bookRotationPrev = this.bookRotation; + EntityPlayer entityplayer = this.worldObj.getClosestPlayer((double)((float)this.pos.getX() + 0.5F), (double)((float)this.pos.getY() + 0.5F), (double)((float)this.pos.getZ() + 0.5F), 3.0D); + + if (entityplayer != null) + { + double d0 = entityplayer.posX - (double)((float)this.pos.getX() + 0.5F); + double d1 = entityplayer.posZ - (double)((float)this.pos.getZ() + 0.5F); + this.field_145924_q = (float)MathHelper.func_181159_b(d1, d0); + this.bookSpread += 0.1F; + + if (this.bookSpread < 0.5F || rand.nextInt(40) == 0) + { + float f1 = this.field_145932_k; + + while (true) + { + this.field_145932_k += (float)(rand.nextInt(4) - rand.nextInt(4)); + + if (f1 != this.field_145932_k) + { + break; + } + } + } + } + else + { + this.field_145924_q += 0.02F; + this.bookSpread -= 0.1F; + } + + while (this.bookRotation >= (float)Math.PI) + { + this.bookRotation -= ((float)Math.PI * 2F); + } + + while (this.bookRotation < -(float)Math.PI) + { + this.bookRotation += ((float)Math.PI * 2F); + } + + while (this.field_145924_q >= (float)Math.PI) + { + this.field_145924_q -= ((float)Math.PI * 2F); + } + + while (this.field_145924_q < -(float)Math.PI) + { + this.field_145924_q += ((float)Math.PI * 2F); + } + + float f2; + + for (f2 = this.field_145924_q - this.bookRotation; f2 >= (float)Math.PI; f2 -= ((float)Math.PI * 2F)) + { + ; + } + + while (f2 < -(float)Math.PI) + { + f2 += ((float)Math.PI * 2F); + } + + this.bookRotation += f2 * 0.4F; + this.bookSpread = MathHelper.clamp_float(this.bookSpread, 0.0F, 1.0F); + ++this.tickCount; + this.pageFlipPrev = this.pageFlip; + float f = (this.field_145932_k - this.pageFlip) * 0.4F; + float f3 = 0.2F; + f = MathHelper.clamp_float(f, -f3, f3); + this.field_145929_l += (f - this.field_145929_l) * 0.9F; + this.pageFlip += this.field_145929_l; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.hasCustomName() ? this.customName : "container.enchant"; + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return this.customName != null && this.customName.length() > 0; + } + + public void setCustomName(String customNameIn) + { + this.customName = customNameIn; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return (IChatComponent)(this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + return new ContainerEnchantment(playerInventory, this.worldObj, this.pos); + } + + public String getGuiID() + { + return "minecraft:enchanting_table"; + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityEndPortal.java b/src/minecraft/net/minecraft/tileentity/TileEntityEndPortal.java new file mode 100644 index 0000000..3aa0d3e --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityEndPortal.java @@ -0,0 +1,5 @@ +package net.minecraft.tileentity; + +public class TileEntityEndPortal extends TileEntity +{ +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityEnderChest.java b/src/minecraft/net/minecraft/tileentity/TileEntityEnderChest.java new file mode 100644 index 0000000..c3e2e5b --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityEnderChest.java @@ -0,0 +1,111 @@ +package net.minecraft.tileentity; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.ITickable; + +public class TileEntityEnderChest extends TileEntity implements ITickable +{ + public float lidAngle; + + /** The angle of the ender chest lid last tick */ + public float prevLidAngle; + public int numPlayersUsing; + private int ticksSinceSync; + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + if (++this.ticksSinceSync % 20 * 4 == 0) + { + this.worldObj.addBlockEvent(this.pos, Blocks.ender_chest, 1, this.numPlayersUsing); + } + + this.prevLidAngle = this.lidAngle; + int i = this.pos.getX(); + int j = this.pos.getY(); + int k = this.pos.getZ(); + float f = 0.1F; + + if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F) + { + double d0 = (double)i + 0.5D; + double d1 = (double)k + 0.5D; + this.worldObj.playSoundEffect(d0, (double)j + 0.5D, d1, "random.chestopen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + + if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) + { + float f2 = this.lidAngle; + + if (this.numPlayersUsing > 0) + { + this.lidAngle += f; + } + else + { + this.lidAngle -= f; + } + + if (this.lidAngle > 1.0F) + { + this.lidAngle = 1.0F; + } + + float f1 = 0.5F; + + if (this.lidAngle < f1 && f2 >= f1) + { + double d3 = (double)i + 0.5D; + double d2 = (double)k + 0.5D; + this.worldObj.playSoundEffect(d3, (double)j + 0.5D, d2, "random.chestclosed", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + + if (this.lidAngle < 0.0F) + { + this.lidAngle = 0.0F; + } + } + } + + public boolean receiveClientEvent(int id, int type) + { + if (id == 1) + { + this.numPlayersUsing = type; + return true; + } + else + { + return super.receiveClientEvent(id, type); + } + } + + /** + * invalidates a tile entity + */ + public void invalidate() + { + this.updateContainingBlockInfo(); + super.invalidate(); + } + + public void openChest() + { + ++this.numPlayersUsing; + this.worldObj.addBlockEvent(this.pos, Blocks.ender_chest, 1, this.numPlayersUsing); + } + + public void closeChest() + { + --this.numPlayersUsing; + this.worldObj.addBlockEvent(this.pos, Blocks.ender_chest, 1, this.numPlayersUsing); + } + + public boolean canBeUsed(EntityPlayer p_145971_1_) + { + return this.worldObj.getTileEntity(this.pos) != this ? false : p_145971_1_.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityFlowerPot.java b/src/minecraft/net/minecraft/tileentity/TileEntityFlowerPot.java new file mode 100644 index 0000000..cebf369 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityFlowerPot.java @@ -0,0 +1,76 @@ +package net.minecraft.tileentity; + +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.ResourceLocation; + +public class TileEntityFlowerPot extends TileEntity +{ + private Item flowerPotItem; + private int flowerPotData; + + public TileEntityFlowerPot() + { + } + + public TileEntityFlowerPot(Item potItem, int potData) + { + this.flowerPotItem = potItem; + this.flowerPotData = potData; + } + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + ResourceLocation resourcelocation = (ResourceLocation)Item.itemRegistry.getNameForObject(this.flowerPotItem); + compound.setString("Item", resourcelocation == null ? "" : resourcelocation.toString()); + compound.setInteger("Data", this.flowerPotData); + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + + if (compound.hasKey("Item", 8)) + { + this.flowerPotItem = Item.getByNameOrId(compound.getString("Item")); + } + else + { + this.flowerPotItem = Item.getItemById(compound.getInteger("Item")); + } + + this.flowerPotData = compound.getInteger("Data"); + } + + /** + * Allows for a specialized description packet to be created. This is often used to sync tile entity data from the + * server to the client easily. For example this is used by signs to synchronise the text to be displayed. + */ + public Packet getDescriptionPacket() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + this.writeToNBT(nbttagcompound); + nbttagcompound.removeTag("Item"); + nbttagcompound.setInteger("Item", Item.getIdFromItem(this.flowerPotItem)); + return new S35PacketUpdateTileEntity(this.pos, 5, nbttagcompound); + } + + public void setFlowerPotData(Item potItem, int potData) + { + this.flowerPotItem = potItem; + this.flowerPotData = potData; + } + + public Item getFlowerPotItem() + { + return this.flowerPotItem; + } + + public int getFlowerPotData() + { + return this.flowerPotData; + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityFurnace.java b/src/minecraft/net/minecraft/tileentity/TileEntityFurnace.java new file mode 100644 index 0000000..910d44b --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityFurnace.java @@ -0,0 +1,522 @@ +package net.minecraft.tileentity; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockFurnace; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerFurnace; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.inventory.SlotFurnaceFuel; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemHoe; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.item.ItemTool; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; +import net.minecraft.util.MathHelper; + +public class TileEntityFurnace extends TileEntityLockable implements ITickable, ISidedInventory +{ + private static final int[] slotsTop = new int[] {0}; + private static final int[] slotsBottom = new int[] {2, 1}; + private static final int[] slotsSides = new int[] {1}; + + /** + * The ItemStacks that hold the items currently being used in the furnace + */ + private ItemStack[] furnaceItemStacks = new ItemStack[3]; + + /** The number of ticks that the furnace will keep burning */ + private int furnaceBurnTime; + + /** + * The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for + */ + private int currentItemBurnTime; + private int cookTime; + private int totalCookTime; + private String furnaceCustomName; + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.furnaceItemStacks.length; + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + return this.furnaceItemStacks[index]; + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + if (this.furnaceItemStacks[index] != null) + { + if (this.furnaceItemStacks[index].stackSize <= count) + { + ItemStack itemstack1 = this.furnaceItemStacks[index]; + this.furnaceItemStacks[index] = null; + return itemstack1; + } + else + { + ItemStack itemstack = this.furnaceItemStacks[index].splitStack(count); + + if (this.furnaceItemStacks[index].stackSize == 0) + { + this.furnaceItemStacks[index] = null; + } + + return itemstack; + } + } + else + { + return null; + } + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + if (this.furnaceItemStacks[index] != null) + { + ItemStack itemstack = this.furnaceItemStacks[index]; + this.furnaceItemStacks[index] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + boolean flag = stack != null && stack.isItemEqual(this.furnaceItemStacks[index]) && ItemStack.areItemStackTagsEqual(stack, this.furnaceItemStacks[index]); + this.furnaceItemStacks[index] = stack; + + if (stack != null && stack.stackSize > this.getInventoryStackLimit()) + { + stack.stackSize = this.getInventoryStackLimit(); + } + + if (index == 0 && !flag) + { + this.totalCookTime = this.getCookTime(stack); + this.cookTime = 0; + this.markDirty(); + } + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.hasCustomName() ? this.furnaceCustomName : "container.furnace"; + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return this.furnaceCustomName != null && this.furnaceCustomName.length() > 0; + } + + public void setCustomInventoryName(String p_145951_1_) + { + this.furnaceCustomName = p_145951_1_; + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + NBTTagList nbttaglist = compound.getTagList("Items", 10); + this.furnaceItemStacks = new ItemStack[this.getSizeInventory()]; + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound.getByte("Slot"); + + if (j >= 0 && j < this.furnaceItemStacks.length) + { + this.furnaceItemStacks[j] = ItemStack.loadItemStackFromNBT(nbttagcompound); + } + } + + this.furnaceBurnTime = compound.getShort("BurnTime"); + this.cookTime = compound.getShort("CookTime"); + this.totalCookTime = compound.getShort("CookTimeTotal"); + this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); + + if (compound.hasKey("CustomName", 8)) + { + this.furnaceCustomName = compound.getString("CustomName"); + } + } + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + compound.setShort("BurnTime", (short)this.furnaceBurnTime); + compound.setShort("CookTime", (short)this.cookTime); + compound.setShort("CookTimeTotal", (short)this.totalCookTime); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.furnaceItemStacks.length; ++i) + { + if (this.furnaceItemStacks[i] != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Slot", (byte)i); + this.furnaceItemStacks[i].writeToNBT(nbttagcompound); + nbttaglist.appendTag(nbttagcompound); + } + } + + compound.setTag("Items", nbttaglist); + + if (this.hasCustomName()) + { + compound.setString("CustomName", this.furnaceCustomName); + } + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Furnace isBurning + */ + public boolean isBurning() + { + return this.furnaceBurnTime > 0; + } + + public static boolean isBurning(IInventory p_174903_0_) + { + return p_174903_0_.getField(0) > 0; + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + boolean flag = this.isBurning(); + boolean flag1 = false; + + if (this.isBurning()) + { + --this.furnaceBurnTime; + } + + if (!this.worldObj.isRemote) + { + if (this.isBurning() || this.furnaceItemStacks[1] != null && this.furnaceItemStacks[0] != null) + { + if (!this.isBurning() && this.canSmelt()) + { + this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); + + if (this.isBurning()) + { + flag1 = true; + + if (this.furnaceItemStacks[1] != null) + { + --this.furnaceItemStacks[1].stackSize; + + if (this.furnaceItemStacks[1].stackSize == 0) + { + Item item = this.furnaceItemStacks[1].getItem().getContainerItem(); + this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null; + } + } + } + } + + if (this.isBurning() && this.canSmelt()) + { + ++this.cookTime; + + if (this.cookTime == this.totalCookTime) + { + this.cookTime = 0; + this.totalCookTime = this.getCookTime(this.furnaceItemStacks[0]); + this.smeltItem(); + flag1 = true; + } + } + else + { + this.cookTime = 0; + } + } + else if (!this.isBurning() && this.cookTime > 0) + { + this.cookTime = MathHelper.clamp_int(this.cookTime - 2, 0, this.totalCookTime); + } + + if (flag != this.isBurning()) + { + flag1 = true; + BlockFurnace.setState(this.isBurning(), this.worldObj, this.pos); + } + } + + if (flag1) + { + this.markDirty(); + } + } + + public int getCookTime(ItemStack stack) + { + return 200; + } + + /** + * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc. + */ + private boolean canSmelt() + { + if (this.furnaceItemStacks[0] == null) + { + return false; + } + else + { + ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); + return itemstack == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(itemstack) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize()))); + } + } + + /** + * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack + */ + public void smeltItem() + { + if (this.canSmelt()) + { + ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]); + + if (this.furnaceItemStacks[2] == null) + { + this.furnaceItemStacks[2] = itemstack.copy(); + } + else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) + { + ++this.furnaceItemStacks[2].stackSize; + } + + if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) + { + this.furnaceItemStacks[1] = new ItemStack(Items.water_bucket); + } + + --this.furnaceItemStacks[0].stackSize; + + if (this.furnaceItemStacks[0].stackSize <= 0) + { + this.furnaceItemStacks[0] = null; + } + } + } + + /** + * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't + * fuel + */ + public static int getItemBurnTime(ItemStack p_145952_0_) + { + if (p_145952_0_ == null) + { + return 0; + } + else + { + Item item = p_145952_0_.getItem(); + + if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) + { + Block block = Block.getBlockFromItem(item); + + if (block == Blocks.wooden_slab) + { + return 150; + } + + if (block.getMaterial() == Material.wood) + { + return 300; + } + + if (block == Blocks.coal_block) + { + return 16000; + } + } + + return item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe)item).getMaterialName().equals("WOOD") ? 200 : (item == Items.stick ? 100 : (item == Items.coal ? 1600 : (item == Items.lava_bucket ? 20000 : (item == Item.getItemFromBlock(Blocks.sapling) ? 100 : (item == Items.blaze_rod ? 2400 : 0))))))); + } + } + + public static boolean isItemFuel(ItemStack p_145954_0_) + { + return getItemBurnTime(p_145954_0_) > 0; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; + } + + public void openInventory(EntityPlayer player) + { + } + + public void closeInventory(EntityPlayer player) + { + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return index == 2 ? false : (index != 1 ? true : isItemFuel(stack) || SlotFurnaceFuel.isBucket(stack)); + } + + public int[] getSlotsForFace(EnumFacing side) + { + return side == EnumFacing.DOWN ? slotsBottom : (side == EnumFacing.UP ? slotsTop : slotsSides); + } + + /** + * Returns true if automation can insert the given item in the given slot from the given side. Args: slot, item, + * side + */ + public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) + { + return this.isItemValidForSlot(index, itemStackIn); + } + + /** + * Returns true if automation can extract the given item in the given slot from the given side. Args: slot, item, + * side + */ + public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) + { + if (direction == EnumFacing.DOWN && index == 1) + { + Item item = stack.getItem(); + + if (item != Items.water_bucket && item != Items.bucket) + { + return false; + } + } + + return true; + } + + public String getGuiID() + { + return "minecraft:furnace"; + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + return new ContainerFurnace(playerInventory, this); + } + + public int getField(int id) + { + switch (id) + { + case 0: + return this.furnaceBurnTime; + + case 1: + return this.currentItemBurnTime; + + case 2: + return this.cookTime; + + case 3: + return this.totalCookTime; + + default: + return 0; + } + } + + public void setField(int id, int value) + { + switch (id) + { + case 0: + this.furnaceBurnTime = value; + break; + + case 1: + this.currentItemBurnTime = value; + break; + + case 2: + this.cookTime = value; + break; + + case 3: + this.totalCookTime = value; + } + } + + public int getFieldCount() + { + return 4; + } + + public void clear() + { + for (int i = 0; i < this.furnaceItemStacks.length; ++i) + { + this.furnaceItemStacks[i] = null; + } + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityHopper.java b/src/minecraft/net/minecraft/tileentity/TileEntityHopper.java new file mode 100644 index 0000000..e98f95b --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityHopper.java @@ -0,0 +1,752 @@ +package net.minecraft.tileentity; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockChest; +import net.minecraft.block.BlockHopper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerHopper; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class TileEntityHopper extends TileEntityLockable implements IHopper, ITickable +{ + private ItemStack[] inventory = new ItemStack[5]; + private String customName; + private int transferCooldown = -1; + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + NBTTagList nbttaglist = compound.getTagList("Items", 10); + this.inventory = new ItemStack[this.getSizeInventory()]; + + if (compound.hasKey("CustomName", 8)) + { + this.customName = compound.getString("CustomName"); + } + + this.transferCooldown = compound.getInteger("TransferCooldown"); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound.getByte("Slot"); + + if (j >= 0 && j < this.inventory.length) + { + this.inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound); + } + } + } + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.inventory.length; ++i) + { + if (this.inventory[i] != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Slot", (byte)i); + this.inventory[i].writeToNBT(nbttagcompound); + nbttaglist.appendTag(nbttagcompound); + } + } + + compound.setTag("Items", nbttaglist); + compound.setInteger("TransferCooldown", this.transferCooldown); + + if (this.hasCustomName()) + { + compound.setString("CustomName", this.customName); + } + } + + /** + * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it + * hasn't changed and skip it. + */ + public void markDirty() + { + super.markDirty(); + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.inventory.length; + } + + /** + * Returns the stack in the given slot. + */ + public ItemStack getStackInSlot(int index) + { + return this.inventory[index]; + } + + /** + * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + */ + public ItemStack decrStackSize(int index, int count) + { + if (this.inventory[index] != null) + { + if (this.inventory[index].stackSize <= count) + { + ItemStack itemstack1 = this.inventory[index]; + this.inventory[index] = null; + return itemstack1; + } + else + { + ItemStack itemstack = this.inventory[index].splitStack(count); + + if (this.inventory[index].stackSize == 0) + { + this.inventory[index] = null; + } + + return itemstack; + } + } + else + { + return null; + } + } + + /** + * Removes a stack from the given slot and returns it. + */ + public ItemStack removeStackFromSlot(int index) + { + if (this.inventory[index] != null) + { + ItemStack itemstack = this.inventory[index]; + this.inventory[index] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int index, ItemStack stack) + { + this.inventory[index] = stack; + + if (stack != null && stack.stackSize > this.getInventoryStackLimit()) + { + stack.stackSize = this.getInventoryStackLimit(); + } + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getName() + { + return this.hasCustomName() ? this.customName : "container.hopper"; + } + + /** + * Returns true if this thing is named + */ + public boolean hasCustomName() + { + return this.customName != null && this.customName.length() > 0; + } + + public void setCustomName(String customNameIn) + { + this.customName = customNameIn; + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer player) + { + return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; + } + + public void openInventory(EntityPlayer player) + { + } + + public void closeInventory(EntityPlayer player) + { + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int index, ItemStack stack) + { + return true; + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + if (this.worldObj != null && !this.worldObj.isRemote) + { + --this.transferCooldown; + + if (!this.isOnTransferCooldown()) + { + this.setTransferCooldown(0); + this.updateHopper(); + } + } + } + + public boolean updateHopper() + { + if (this.worldObj != null && !this.worldObj.isRemote) + { + if (!this.isOnTransferCooldown() && BlockHopper.isEnabled(this.getBlockMetadata())) + { + boolean flag = false; + + if (!this.isEmpty()) + { + flag = this.transferItemsOut(); + } + + if (!this.isFull()) + { + flag = captureDroppedItems(this) || flag; + } + + if (flag) + { + this.setTransferCooldown(8); + this.markDirty(); + return true; + } + } + + return false; + } + else + { + return false; + } + } + + private boolean isEmpty() + { + for (ItemStack itemstack : this.inventory) + { + if (itemstack != null) + { + return false; + } + } + + return true; + } + + private boolean isFull() + { + for (ItemStack itemstack : this.inventory) + { + if (itemstack == null || itemstack.stackSize != itemstack.getMaxStackSize()) + { + return false; + } + } + + return true; + } + + private boolean transferItemsOut() + { + IInventory iinventory = this.getInventoryForHopperTransfer(); + + if (iinventory == null) + { + return false; + } + else + { + EnumFacing enumfacing = BlockHopper.getFacing(this.getBlockMetadata()).getOpposite(); + + if (this.isInventoryFull(iinventory, enumfacing)) + { + return false; + } + else + { + for (int i = 0; i < this.getSizeInventory(); ++i) + { + if (this.getStackInSlot(i) != null) + { + ItemStack itemstack = this.getStackInSlot(i).copy(); + ItemStack itemstack1 = putStackInInventoryAllSlots(iinventory, this.decrStackSize(i, 1), enumfacing); + + if (itemstack1 == null || itemstack1.stackSize == 0) + { + iinventory.markDirty(); + return true; + } + + this.setInventorySlotContents(i, itemstack); + } + } + + return false; + } + } + } + + /** + * Returns false if the inventory has any room to place items in + */ + private boolean isInventoryFull(IInventory inventoryIn, EnumFacing side) + { + if (inventoryIn instanceof ISidedInventory) + { + ISidedInventory isidedinventory = (ISidedInventory)inventoryIn; + int[] aint = isidedinventory.getSlotsForFace(side); + + for (int k = 0; k < aint.length; ++k) + { + ItemStack itemstack1 = isidedinventory.getStackInSlot(aint[k]); + + if (itemstack1 == null || itemstack1.stackSize != itemstack1.getMaxStackSize()) + { + return false; + } + } + } + else + { + int i = inventoryIn.getSizeInventory(); + + for (int j = 0; j < i; ++j) + { + ItemStack itemstack = inventoryIn.getStackInSlot(j); + + if (itemstack == null || itemstack.stackSize != itemstack.getMaxStackSize()) + { + return false; + } + } + } + + return true; + } + + /** + * Returns false if the specified IInventory contains any items + */ + private static boolean isInventoryEmpty(IInventory inventoryIn, EnumFacing side) + { + if (inventoryIn instanceof ISidedInventory) + { + ISidedInventory isidedinventory = (ISidedInventory)inventoryIn; + int[] aint = isidedinventory.getSlotsForFace(side); + + for (int i = 0; i < aint.length; ++i) + { + if (isidedinventory.getStackInSlot(aint[i]) != null) + { + return false; + } + } + } + else + { + int j = inventoryIn.getSizeInventory(); + + for (int k = 0; k < j; ++k) + { + if (inventoryIn.getStackInSlot(k) != null) + { + return false; + } + } + } + + return true; + } + + public static boolean captureDroppedItems(IHopper p_145891_0_) + { + IInventory iinventory = getHopperInventory(p_145891_0_); + + if (iinventory != null) + { + EnumFacing enumfacing = EnumFacing.DOWN; + + if (isInventoryEmpty(iinventory, enumfacing)) + { + return false; + } + + if (iinventory instanceof ISidedInventory) + { + ISidedInventory isidedinventory = (ISidedInventory)iinventory; + int[] aint = isidedinventory.getSlotsForFace(enumfacing); + + for (int i = 0; i < aint.length; ++i) + { + if (pullItemFromSlot(p_145891_0_, iinventory, aint[i], enumfacing)) + { + return true; + } + } + } + else + { + int j = iinventory.getSizeInventory(); + + for (int k = 0; k < j; ++k) + { + if (pullItemFromSlot(p_145891_0_, iinventory, k, enumfacing)) + { + return true; + } + } + } + } + else + { + for (EntityItem entityitem : func_181556_a(p_145891_0_.getWorld(), p_145891_0_.getXPos(), p_145891_0_.getYPos() + 1.0D, p_145891_0_.getZPos())) + { + if (putDropInInventoryAllSlots(p_145891_0_, entityitem)) + { + return true; + } + } + } + + return false; + } + + /** + * Pulls from the specified slot in the inventory and places in any available slot in the hopper. Returns true if + * the entire stack was moved + */ + private static boolean pullItemFromSlot(IHopper hopper, IInventory inventoryIn, int index, EnumFacing direction) + { + ItemStack itemstack = inventoryIn.getStackInSlot(index); + + if (itemstack != null && canExtractItemFromSlot(inventoryIn, itemstack, index, direction)) + { + ItemStack itemstack1 = itemstack.copy(); + ItemStack itemstack2 = putStackInInventoryAllSlots(hopper, inventoryIn.decrStackSize(index, 1), (EnumFacing)null); + + if (itemstack2 == null || itemstack2.stackSize == 0) + { + inventoryIn.markDirty(); + return true; + } + + inventoryIn.setInventorySlotContents(index, itemstack1); + } + + return false; + } + + /** + * Attempts to place the passed EntityItem's stack into the inventory using as many slots as possible. Returns false + * if the stackSize of the drop was not depleted. + */ + public static boolean putDropInInventoryAllSlots(IInventory p_145898_0_, EntityItem itemIn) + { + boolean flag = false; + + if (itemIn == null) + { + return false; + } + else + { + ItemStack itemstack = itemIn.getEntityItem().copy(); + ItemStack itemstack1 = putStackInInventoryAllSlots(p_145898_0_, itemstack, (EnumFacing)null); + + if (itemstack1 != null && itemstack1.stackSize != 0) + { + itemIn.setEntityItemStack(itemstack1); + } + else + { + flag = true; + itemIn.setDead(); + } + + return flag; + } + } + + /** + * Attempts to place the passed stack in the inventory, using as many slots as required. Returns leftover items + */ + public static ItemStack putStackInInventoryAllSlots(IInventory inventoryIn, ItemStack stack, EnumFacing side) + { + if (inventoryIn instanceof ISidedInventory && side != null) + { + ISidedInventory isidedinventory = (ISidedInventory)inventoryIn; + int[] aint = isidedinventory.getSlotsForFace(side); + + for (int k = 0; k < aint.length && stack != null && stack.stackSize > 0; ++k) + { + stack = insertStack(inventoryIn, stack, aint[k], side); + } + } + else + { + int i = inventoryIn.getSizeInventory(); + + for (int j = 0; j < i && stack != null && stack.stackSize > 0; ++j) + { + stack = insertStack(inventoryIn, stack, j, side); + } + } + + if (stack != null && stack.stackSize == 0) + { + stack = null; + } + + return stack; + } + + /** + * Can this hopper insert the specified item from the specified slot on the specified side? + */ + private static boolean canInsertItemInSlot(IInventory inventoryIn, ItemStack stack, int index, EnumFacing side) + { + return !inventoryIn.isItemValidForSlot(index, stack) ? false : !(inventoryIn instanceof ISidedInventory) || ((ISidedInventory)inventoryIn).canInsertItem(index, stack, side); + } + + /** + * Can this hopper extract the specified item from the specified slot on the specified side? + */ + private static boolean canExtractItemFromSlot(IInventory inventoryIn, ItemStack stack, int index, EnumFacing side) + { + return !(inventoryIn instanceof ISidedInventory) || ((ISidedInventory)inventoryIn).canExtractItem(index, stack, side); + } + + /** + * Insert the specified stack to the specified inventory and return any leftover items + */ + private static ItemStack insertStack(IInventory inventoryIn, ItemStack stack, int index, EnumFacing side) + { + ItemStack itemstack = inventoryIn.getStackInSlot(index); + + if (canInsertItemInSlot(inventoryIn, stack, index, side)) + { + boolean flag = false; + + if (itemstack == null) + { + inventoryIn.setInventorySlotContents(index, stack); + stack = null; + flag = true; + } + else if (canCombine(itemstack, stack)) + { + int i = stack.getMaxStackSize() - itemstack.stackSize; + int j = Math.min(stack.stackSize, i); + stack.stackSize -= j; + itemstack.stackSize += j; + flag = j > 0; + } + + if (flag) + { + if (inventoryIn instanceof TileEntityHopper) + { + TileEntityHopper tileentityhopper = (TileEntityHopper)inventoryIn; + + if (tileentityhopper.mayTransfer()) + { + tileentityhopper.setTransferCooldown(8); + } + + inventoryIn.markDirty(); + } + + inventoryIn.markDirty(); + } + } + + return stack; + } + + /** + * Returns the IInventory that this hopper is pointing into + */ + private IInventory getInventoryForHopperTransfer() + { + EnumFacing enumfacing = BlockHopper.getFacing(this.getBlockMetadata()); + return getInventoryAtPosition(this.getWorld(), (double)(this.pos.getX() + enumfacing.getFrontOffsetX()), (double)(this.pos.getY() + enumfacing.getFrontOffsetY()), (double)(this.pos.getZ() + enumfacing.getFrontOffsetZ())); + } + + /** + * Returns the IInventory for the specified hopper + */ + public static IInventory getHopperInventory(IHopper hopper) + { + return getInventoryAtPosition(hopper.getWorld(), hopper.getXPos(), hopper.getYPos() + 1.0D, hopper.getZPos()); + } + + public static List func_181556_a(World p_181556_0_, double p_181556_1_, double p_181556_3_, double p_181556_5_) + { + return p_181556_0_.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(p_181556_1_ - 0.5D, p_181556_3_ - 0.5D, p_181556_5_ - 0.5D, p_181556_1_ + 0.5D, p_181556_3_ + 0.5D, p_181556_5_ + 0.5D), EntitySelectors.selectAnything); + } + + /** + * Returns the IInventory (if applicable) of the TileEntity at the specified position + */ + public static IInventory getInventoryAtPosition(World worldIn, double x, double y, double z) + { + IInventory iinventory = null; + int i = MathHelper.floor_double(x); + int j = MathHelper.floor_double(y); + int k = MathHelper.floor_double(z); + BlockPos blockpos = new BlockPos(i, j, k); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block.hasTileEntity()) + { + TileEntity tileentity = worldIn.getTileEntity(blockpos); + + if (tileentity instanceof IInventory) + { + iinventory = (IInventory)tileentity; + + if (iinventory instanceof TileEntityChest && block instanceof BlockChest) + { + iinventory = ((BlockChest)block).getLockableContainer(worldIn, blockpos); + } + } + } + + if (iinventory == null) + { + List list = worldIn.getEntitiesInAABBexcluding((Entity)null, new AxisAlignedBB(x - 0.5D, y - 0.5D, z - 0.5D, x + 0.5D, y + 0.5D, z + 0.5D), EntitySelectors.selectInventories); + + if (list.size() > 0) + { + iinventory = (IInventory)list.get(worldIn.rand.nextInt(list.size())); + } + } + + return iinventory; + } + + private static boolean canCombine(ItemStack stack1, ItemStack stack2) + { + return stack1.getItem() != stack2.getItem() ? false : (stack1.getMetadata() != stack2.getMetadata() ? false : (stack1.stackSize > stack1.getMaxStackSize() ? false : ItemStack.areItemStackTagsEqual(stack1, stack2))); + } + + /** + * Gets the world X position for this hopper entity. + */ + public double getXPos() + { + return (double)this.pos.getX() + 0.5D; + } + + /** + * Gets the world Y position for this hopper entity. + */ + public double getYPos() + { + return (double)this.pos.getY() + 0.5D; + } + + /** + * Gets the world Z position for this hopper entity. + */ + public double getZPos() + { + return (double)this.pos.getZ() + 0.5D; + } + + public void setTransferCooldown(int ticks) + { + this.transferCooldown = ticks; + } + + public boolean isOnTransferCooldown() + { + return this.transferCooldown > 0; + } + + public boolean mayTransfer() + { + return this.transferCooldown <= 1; + } + + public String getGuiID() + { + return "minecraft:hopper"; + } + + public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) + { + return new ContainerHopper(playerInventory, this, playerIn); + } + + public int getField(int id) + { + return 0; + } + + public void setField(int id, int value) + { + } + + public int getFieldCount() + { + return 0; + } + + public void clear() + { + for (int i = 0; i < this.inventory.length; ++i) + { + this.inventory[i] = null; + } + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityLockable.java b/src/minecraft/net/minecraft/tileentity/TileEntityLockable.java new file mode 100644 index 0000000..0cd8164 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityLockable.java @@ -0,0 +1,53 @@ +package net.minecraft.tileentity; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.IInteractionObject; +import net.minecraft.world.ILockableContainer; +import net.minecraft.world.LockCode; + +public abstract class TileEntityLockable extends TileEntity implements IInteractionObject, ILockableContainer +{ + private LockCode code = LockCode.EMPTY_CODE; + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + this.code = LockCode.fromNBT(compound); + } + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + + if (this.code != null) + { + this.code.toNBT(compound); + } + } + + public boolean isLocked() + { + return this.code != null && !this.code.isEmpty(); + } + + public LockCode getLockCode() + { + return this.code; + } + + public void setLockCode(LockCode code) + { + this.code = code; + } + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + public IChatComponent getDisplayName() + { + return (IChatComponent)(this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityMobSpawner.java b/src/minecraft/net/minecraft/tileentity/TileEntityMobSpawner.java new file mode 100644 index 0000000..9b4b0f3 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityMobSpawner.java @@ -0,0 +1,84 @@ +package net.minecraft.tileentity; + +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ITickable; +import net.minecraft.world.World; + +public class TileEntityMobSpawner extends TileEntity implements ITickable +{ + private final MobSpawnerBaseLogic spawnerLogic = new MobSpawnerBaseLogic() + { + public void func_98267_a(int id) + { + TileEntityMobSpawner.this.worldObj.addBlockEvent(TileEntityMobSpawner.this.pos, Blocks.mob_spawner, id, 0); + } + public World getSpawnerWorld() + { + return TileEntityMobSpawner.this.worldObj; + } + public BlockPos getSpawnerPosition() + { + return TileEntityMobSpawner.this.pos; + } + public void setRandomEntity(MobSpawnerBaseLogic.WeightedRandomMinecart p_98277_1_) + { + super.setRandomEntity(p_98277_1_); + + if (this.getSpawnerWorld() != null) + { + this.getSpawnerWorld().markBlockForUpdate(TileEntityMobSpawner.this.pos); + } + } + }; + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + this.spawnerLogic.readFromNBT(compound); + } + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + this.spawnerLogic.writeToNBT(compound); + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + this.spawnerLogic.updateSpawner(); + } + + /** + * Allows for a specialized description packet to be created. This is often used to sync tile entity data from the + * server to the client easily. For example this is used by signs to synchronise the text to be displayed. + */ + public Packet getDescriptionPacket() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + this.writeToNBT(nbttagcompound); + nbttagcompound.removeTag("SpawnPotentials"); + return new S35PacketUpdateTileEntity(this.pos, 1, nbttagcompound); + } + + public boolean receiveClientEvent(int id, int type) + { + return this.spawnerLogic.setDelayToMin(id) ? true : super.receiveClientEvent(id, type); + } + + public boolean func_183000_F() + { + return true; + } + + public MobSpawnerBaseLogic getSpawnerBaseLogic() + { + return this.spawnerLogic; + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityNote.java b/src/minecraft/net/minecraft/tileentity/TileEntityNote.java new file mode 100644 index 0000000..f5fcf27 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityNote.java @@ -0,0 +1,70 @@ +package net.minecraft.tileentity; + +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class TileEntityNote extends TileEntity +{ + /** Note to play */ + public byte note; + + /** stores the latest redstone state */ + public boolean previousRedstoneState; + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + compound.setByte("note", this.note); + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + this.note = compound.getByte("note"); + this.note = (byte)MathHelper.clamp_int(this.note, 0, 24); + } + + /** + * change pitch by -> (currentPitch + 1) % 25 + */ + public void changePitch() + { + this.note = (byte)((this.note + 1) % 25); + this.markDirty(); + } + + public void triggerNote(World worldIn, BlockPos p_175108_2_) + { + if (worldIn.getBlockState(p_175108_2_.up()).getBlock().getMaterial() == Material.air) + { + Material material = worldIn.getBlockState(p_175108_2_.down()).getBlock().getMaterial(); + int i = 0; + + if (material == Material.rock) + { + i = 1; + } + + if (material == Material.sand) + { + i = 2; + } + + if (material == Material.glass) + { + i = 3; + } + + if (material == Material.wood) + { + i = 4; + } + + worldIn.addBlockEvent(p_175108_2_, Blocks.noteblock, i, this.note); + } + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntityPiston.java b/src/minecraft/net/minecraft/tileentity/TileEntityPiston.java new file mode 100644 index 0000000..9bbd824 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntityPiston.java @@ -0,0 +1,219 @@ +package net.minecraft.tileentity; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; + +public class TileEntityPiston extends TileEntity implements ITickable +{ + private IBlockState pistonState; + private EnumFacing pistonFacing; + + /** if this piston is extending or not */ + private boolean extending; + private boolean shouldHeadBeRendered; + private float progress; + + /** the progress in (de)extending */ + private float lastProgress; + private List field_174933_k = Lists.newArrayList(); + + public TileEntityPiston() + { + } + + public TileEntityPiston(IBlockState pistonStateIn, EnumFacing pistonFacingIn, boolean extendingIn, boolean shouldHeadBeRenderedIn) + { + this.pistonState = pistonStateIn; + this.pistonFacing = pistonFacingIn; + this.extending = extendingIn; + this.shouldHeadBeRendered = shouldHeadBeRenderedIn; + } + + public IBlockState getPistonState() + { + return this.pistonState; + } + + public int getBlockMetadata() + { + return 0; + } + + /** + * Returns true if a piston is extending + */ + public boolean isExtending() + { + return this.extending; + } + + public EnumFacing getFacing() + { + return this.pistonFacing; + } + + public boolean shouldPistonHeadBeRendered() + { + return this.shouldHeadBeRendered; + } + + /** + * Get interpolated progress value (between lastProgress and progress) given the fractional time between ticks as an + * argument + */ + public float getProgress(float ticks) + { + if (ticks > 1.0F) + { + ticks = 1.0F; + } + + return this.lastProgress + (this.progress - this.lastProgress) * ticks; + } + + public float getOffsetX(float ticks) + { + return this.extending ? (this.getProgress(ticks) - 1.0F) * (float)this.pistonFacing.getFrontOffsetX() : (1.0F - this.getProgress(ticks)) * (float)this.pistonFacing.getFrontOffsetX(); + } + + public float getOffsetY(float ticks) + { + return this.extending ? (this.getProgress(ticks) - 1.0F) * (float)this.pistonFacing.getFrontOffsetY() : (1.0F - this.getProgress(ticks)) * (float)this.pistonFacing.getFrontOffsetY(); + } + + public float getOffsetZ(float ticks) + { + return this.extending ? (this.getProgress(ticks) - 1.0F) * (float)this.pistonFacing.getFrontOffsetZ() : (1.0F - this.getProgress(ticks)) * (float)this.pistonFacing.getFrontOffsetZ(); + } + + private void launchWithSlimeBlock(float p_145863_1_, float p_145863_2_) + { + if (this.extending) + { + p_145863_1_ = 1.0F - p_145863_1_; + } + else + { + --p_145863_1_; + } + + AxisAlignedBB axisalignedbb = Blocks.piston_extension.getBoundingBox(this.worldObj, this.pos, this.pistonState, p_145863_1_, this.pistonFacing); + + if (axisalignedbb != null) + { + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb); + + if (!list.isEmpty()) + { + this.field_174933_k.addAll(list); + + for (Entity entity : this.field_174933_k) + { + if (this.pistonState.getBlock() == Blocks.slime_block && this.extending) + { + switch (this.pistonFacing.getAxis()) + { + case X: + entity.motionX = (double)this.pistonFacing.getFrontOffsetX(); + break; + + case Y: + entity.motionY = (double)this.pistonFacing.getFrontOffsetY(); + break; + + case Z: + entity.motionZ = (double)this.pistonFacing.getFrontOffsetZ(); + } + } + else + { + entity.moveEntity((double)(p_145863_2_ * (float)this.pistonFacing.getFrontOffsetX()), (double)(p_145863_2_ * (float)this.pistonFacing.getFrontOffsetY()), (double)(p_145863_2_ * (float)this.pistonFacing.getFrontOffsetZ())); + } + } + + this.field_174933_k.clear(); + } + } + } + + /** + * removes a piston's tile entity (and if the piston is moving, stops it) + */ + public void clearPistonTileEntity() + { + if (this.lastProgress < 1.0F && this.worldObj != null) + { + this.lastProgress = this.progress = 1.0F; + this.worldObj.removeTileEntity(this.pos); + this.invalidate(); + + if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) + { + this.worldObj.setBlockState(this.pos, this.pistonState, 3); + this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); + } + } + } + + /** + * Like the old updateEntity(), except more generic. + */ + public void update() + { + this.lastProgress = this.progress; + + if (this.lastProgress >= 1.0F) + { + this.launchWithSlimeBlock(1.0F, 0.25F); + this.worldObj.removeTileEntity(this.pos); + this.invalidate(); + + if (this.worldObj.getBlockState(this.pos).getBlock() == Blocks.piston_extension) + { + this.worldObj.setBlockState(this.pos, this.pistonState, 3); + this.worldObj.notifyBlockOfStateChange(this.pos, this.pistonState.getBlock()); + } + } + else + { + this.progress += 0.5F; + + if (this.progress >= 1.0F) + { + this.progress = 1.0F; + } + + if (this.extending) + { + this.launchWithSlimeBlock(this.progress, this.progress - this.lastProgress + 0.0625F); + } + } + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + this.pistonState = Block.getBlockById(compound.getInteger("blockId")).getStateFromMeta(compound.getInteger("blockData")); + this.pistonFacing = EnumFacing.getFront(compound.getInteger("facing")); + this.lastProgress = this.progress = compound.getFloat("progress"); + this.extending = compound.getBoolean("extending"); + } + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + compound.setInteger("blockId", Block.getIdFromBlock(this.pistonState.getBlock())); + compound.setInteger("blockData", this.pistonState.getBlock().getMetaFromState(this.pistonState)); + compound.setInteger("facing", this.pistonFacing.getIndex()); + compound.setFloat("progress", this.lastProgress); + compound.setBoolean("extending", this.extending); + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntitySign.java b/src/minecraft/net/minecraft/tileentity/TileEntitySign.java new file mode 100644 index 0000000..770cd35 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntitySign.java @@ -0,0 +1,231 @@ +package net.minecraft.tileentity; + +import com.google.gson.JsonParseException; +import net.minecraft.command.CommandException; +import net.minecraft.command.CommandResultStats; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.event.ClickEvent; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S33PacketUpdateSign; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentProcessor; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class TileEntitySign extends TileEntity +{ + public final IChatComponent[] signText = new IChatComponent[] {new ChatComponentText(""), new ChatComponentText(""), new ChatComponentText(""), new ChatComponentText("")}; + + /** + * The index of the line currently being edited. Only used on client side, but defined on both. Note this is only + * really used when the > < are going to be visible. + */ + public int lineBeingEdited = -1; + private boolean isEditable = true; + private EntityPlayer player; + private final CommandResultStats stats = new CommandResultStats(); + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + + for (int i = 0; i < 4; ++i) + { + String s = IChatComponent.Serializer.componentToJson(this.signText[i]); + compound.setString("Text" + (i + 1), s); + } + + this.stats.writeStatsToNBT(compound); + } + + public void readFromNBT(NBTTagCompound compound) + { + this.isEditable = false; + super.readFromNBT(compound); + ICommandSender icommandsender = new ICommandSender() + { + public String getName() + { + return "Sign"; + } + public IChatComponent getDisplayName() + { + return new ChatComponentText(this.getName()); + } + public void addChatMessage(IChatComponent component) + { + } + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { + return true; + } + public BlockPos getPosition() + { + return TileEntitySign.this.pos; + } + public Vec3 getPositionVector() + { + return new Vec3((double)TileEntitySign.this.pos.getX() + 0.5D, (double)TileEntitySign.this.pos.getY() + 0.5D, (double)TileEntitySign.this.pos.getZ() + 0.5D); + } + public World getEntityWorld() + { + return TileEntitySign.this.worldObj; + } + public Entity getCommandSenderEntity() + { + return null; + } + public boolean sendCommandFeedback() + { + return false; + } + public void setCommandStat(CommandResultStats.Type type, int amount) + { + } + }; + + for (int i = 0; i < 4; ++i) + { + String s = compound.getString("Text" + (i + 1)); + + try + { + IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s); + + try + { + this.signText[i] = ChatComponentProcessor.processComponent(icommandsender, ichatcomponent, (Entity)null); + } + catch (CommandException var7) + { + this.signText[i] = ichatcomponent; + } + } + catch (JsonParseException var8) + { + this.signText[i] = new ChatComponentText(s); + } + } + + this.stats.readStatsFromNBT(compound); + } + + /** + * Allows for a specialized description packet to be created. This is often used to sync tile entity data from the + * server to the client easily. For example this is used by signs to synchronise the text to be displayed. + */ + public Packet getDescriptionPacket() + { + IChatComponent[] aichatcomponent = new IChatComponent[4]; + System.arraycopy(this.signText, 0, aichatcomponent, 0, 4); + return new S33PacketUpdateSign(this.worldObj, this.pos, aichatcomponent); + } + + public boolean func_183000_F() + { + return true; + } + + public boolean getIsEditable() + { + return this.isEditable; + } + + /** + * Sets the sign's isEditable flag to the specified parameter. + */ + public void setEditable(boolean isEditableIn) + { + this.isEditable = isEditableIn; + + if (!isEditableIn) + { + this.player = null; + } + } + + public void setPlayer(EntityPlayer playerIn) + { + this.player = playerIn; + } + + public EntityPlayer getPlayer() + { + return this.player; + } + + public boolean executeCommand(final EntityPlayer playerIn) + { + ICommandSender icommandsender = new ICommandSender() + { + public String getName() + { + return playerIn.getName(); + } + public IChatComponent getDisplayName() + { + return playerIn.getDisplayName(); + } + public void addChatMessage(IChatComponent component) + { + } + public boolean canCommandSenderUseCommand(int permLevel, String commandName) + { + return permLevel <= 2; + } + public BlockPos getPosition() + { + return TileEntitySign.this.pos; + } + public Vec3 getPositionVector() + { + return new Vec3((double)TileEntitySign.this.pos.getX() + 0.5D, (double)TileEntitySign.this.pos.getY() + 0.5D, (double)TileEntitySign.this.pos.getZ() + 0.5D); + } + public World getEntityWorld() + { + return playerIn.getEntityWorld(); + } + public Entity getCommandSenderEntity() + { + return playerIn; + } + public boolean sendCommandFeedback() + { + return false; + } + public void setCommandStat(CommandResultStats.Type type, int amount) + { + TileEntitySign.this.stats.func_179672_a(this, type, amount); + } + }; + + for (int i = 0; i < this.signText.length; ++i) + { + ChatStyle chatstyle = this.signText[i] == null ? null : this.signText[i].getChatStyle(); + + if (chatstyle != null && chatstyle.getChatClickEvent() != null) + { + ClickEvent clickevent = chatstyle.getChatClickEvent(); + + if (clickevent.getAction() == ClickEvent.Action.RUN_COMMAND) + { + MinecraftServer.getServer().getCommandManager().executeCommand(icommandsender, clickevent.getValue()); + } + } + } + + return true; + } + + public CommandResultStats getStats() + { + return this.stats; + } +} diff --git a/src/minecraft/net/minecraft/tileentity/TileEntitySkull.java b/src/minecraft/net/minecraft/tileentity/TileEntitySkull.java new file mode 100644 index 0000000..dcf4302 --- /dev/null +++ b/src/minecraft/net/minecraft/tileentity/TileEntitySkull.java @@ -0,0 +1,147 @@ +package net.minecraft.tileentity; + +import com.google.common.collect.Iterables; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import java.util.UUID; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.StringUtils; + +public class TileEntitySkull extends TileEntity +{ + private int skullType; + private int skullRotation; + private GameProfile playerProfile = null; + + public void writeToNBT(NBTTagCompound compound) + { + super.writeToNBT(compound); + compound.setByte("SkullType", (byte)(this.skullType & 255)); + compound.setByte("Rot", (byte)(this.skullRotation & 255)); + + if (this.playerProfile != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + NBTUtil.writeGameProfile(nbttagcompound, this.playerProfile); + compound.setTag("Owner", nbttagcompound); + } + } + + public void readFromNBT(NBTTagCompound compound) + { + super.readFromNBT(compound); + this.skullType = compound.getByte("SkullType"); + this.skullRotation = compound.getByte("Rot"); + + if (this.skullType == 3) + { + if (compound.hasKey("Owner", 10)) + { + this.playerProfile = NBTUtil.readGameProfileFromNBT(compound.getCompoundTag("Owner")); + } + else if (compound.hasKey("ExtraType", 8)) + { + String s = compound.getString("ExtraType"); + + if (!StringUtils.isNullOrEmpty(s)) + { + this.playerProfile = new GameProfile((UUID)null, s); + this.updatePlayerProfile(); + } + } + } + } + + public GameProfile getPlayerProfile() + { + return this.playerProfile; + } + + /** + * Allows for a specialized description packet to be created. This is often used to sync tile entity data from the + * server to the client easily. For example this is used by signs to synchronise the text to be displayed. + */ + public Packet getDescriptionPacket() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + this.writeToNBT(nbttagcompound); + return new S35PacketUpdateTileEntity(this.pos, 4, nbttagcompound); + } + + public void setType(int type) + { + this.skullType = type; + this.playerProfile = null; + } + + public void setPlayerProfile(GameProfile playerProfile) + { + this.skullType = 3; + this.playerProfile = playerProfile; + this.updatePlayerProfile(); + } + + private void updatePlayerProfile() + { + this.playerProfile = updateGameprofile(this.playerProfile); + this.markDirty(); + } + + public static GameProfile updateGameprofile(GameProfile input) + { + if (input != null && !StringUtils.isNullOrEmpty(input.getName())) + { + if (input.isComplete() && input.getProperties().containsKey("textures")) + { + return input; + } + else if (MinecraftServer.getServer() == null) + { + return input; + } + else + { + GameProfile gameprofile = MinecraftServer.getServer().getPlayerProfileCache().getGameProfileForUsername(input.getName()); + + if (gameprofile == null) + { + return input; + } + else + { + Property property = (Property)Iterables.getFirst(gameprofile.getProperties().get("textures"), null); + + if (property == null) + { + gameprofile = MinecraftServer.getServer().getMinecraftSessionService().fillProfileProperties(gameprofile, true); + } + + return gameprofile; + } + } + } + else + { + return input; + } + } + + public int getSkullType() + { + return this.skullType; + } + + public int getSkullRotation() + { + return this.skullRotation; + } + + public void setSkullRotation(int rotation) + { + this.skullRotation = rotation; + } +} diff --git a/src/minecraft/net/minecraft/util/AxisAlignedBB.java b/src/minecraft/net/minecraft/util/AxisAlignedBB.java new file mode 100644 index 0000000..d05c331 --- /dev/null +++ b/src/minecraft/net/minecraft/util/AxisAlignedBB.java @@ -0,0 +1,412 @@ +package net.minecraft.util; + +public class AxisAlignedBB +{ + public final double minX; + public final double minY; + public final double minZ; + public final double maxX; + public final double maxY; + public final double maxZ; + + public AxisAlignedBB(double x1, double y1, double z1, double x2, double y2, double z2) + { + this.minX = Math.min(x1, x2); + this.minY = Math.min(y1, y2); + this.minZ = Math.min(z1, z2); + this.maxX = Math.max(x1, x2); + this.maxY = Math.max(y1, y2); + this.maxZ = Math.max(z1, z2); + } + + public AxisAlignedBB(BlockPos pos1, BlockPos pos2) + { + this.minX = (double)pos1.getX(); + this.minY = (double)pos1.getY(); + this.minZ = (double)pos1.getZ(); + this.maxX = (double)pos2.getX(); + this.maxY = (double)pos2.getY(); + this.maxZ = (double)pos2.getZ(); + } + + /** + * Adds the coordinates to the bounding box extending it if the point lies outside the current ranges. Args: x, y, z + */ + public AxisAlignedBB addCoord(double x, double y, double z) + { + double d0 = this.minX; + double d1 = this.minY; + double d2 = this.minZ; + double d3 = this.maxX; + double d4 = this.maxY; + double d5 = this.maxZ; + + if (x < 0.0D) + { + d0 += x; + } + else if (x > 0.0D) + { + d3 += x; + } + + if (y < 0.0D) + { + d1 += y; + } + else if (y > 0.0D) + { + d4 += y; + } + + if (z < 0.0D) + { + d2 += z; + } + else if (z > 0.0D) + { + d5 += z; + } + + return new AxisAlignedBB(d0, d1, d2, d3, d4, d5); + } + + /** + * Returns a bounding box expanded by the specified vector (if negative numbers are given it will shrink). Args: x, + * y, z + */ + public AxisAlignedBB expand(double x, double y, double z) + { + double d0 = this.minX - x; + double d1 = this.minY - y; + double d2 = this.minZ - z; + double d3 = this.maxX + x; + double d4 = this.maxY + y; + double d5 = this.maxZ + z; + return new AxisAlignedBB(d0, d1, d2, d3, d4, d5); + } + + public AxisAlignedBB union(AxisAlignedBB other) + { + double d0 = Math.min(this.minX, other.minX); + double d1 = Math.min(this.minY, other.minY); + double d2 = Math.min(this.minZ, other.minZ); + double d3 = Math.max(this.maxX, other.maxX); + double d4 = Math.max(this.maxY, other.maxY); + double d5 = Math.max(this.maxZ, other.maxZ); + return new AxisAlignedBB(d0, d1, d2, d3, d4, d5); + } + + /** + * returns an AABB with corners x1, y1, z1 and x2, y2, z2 + */ + public static AxisAlignedBB fromBounds(double x1, double y1, double z1, double x2, double y2, double z2) + { + double d0 = Math.min(x1, x2); + double d1 = Math.min(y1, y2); + double d2 = Math.min(z1, z2); + double d3 = Math.max(x1, x2); + double d4 = Math.max(y1, y2); + double d5 = Math.max(z1, z2); + return new AxisAlignedBB(d0, d1, d2, d3, d4, d5); + } + + /** + * Offsets the current bounding box by the specified coordinates. Args: x, y, z + */ + public AxisAlignedBB offset(double x, double y, double z) + { + return new AxisAlignedBB(this.minX + x, this.minY + y, this.minZ + z, this.maxX + x, this.maxY + y, this.maxZ + z); + } + + /** + * if instance and the argument bounding boxes overlap in the Y and Z dimensions, calculate the offset between them + * in the X dimension. return var2 if the bounding boxes do not overlap or if var2 is closer to 0 then the + * calculated offset. Otherwise return the calculated offset. + */ + public double calculateXOffset(AxisAlignedBB other, double offsetX) + { + if (other.maxY > this.minY && other.minY < this.maxY && other.maxZ > this.minZ && other.minZ < this.maxZ) + { + if (offsetX > 0.0D && other.maxX <= this.minX) + { + double d1 = this.minX - other.maxX; + + if (d1 < offsetX) + { + offsetX = d1; + } + } + else if (offsetX < 0.0D && other.minX >= this.maxX) + { + double d0 = this.maxX - other.minX; + + if (d0 > offsetX) + { + offsetX = d0; + } + } + + return offsetX; + } + else + { + return offsetX; + } + } + + /** + * if instance and the argument bounding boxes overlap in the X and Z dimensions, calculate the offset between them + * in the Y dimension. return var2 if the bounding boxes do not overlap or if var2 is closer to 0 then the + * calculated offset. Otherwise return the calculated offset. + */ + public double calculateYOffset(AxisAlignedBB other, double offsetY) + { + if (other.maxX > this.minX && other.minX < this.maxX && other.maxZ > this.minZ && other.minZ < this.maxZ) + { + if (offsetY > 0.0D && other.maxY <= this.minY) + { + double d1 = this.minY - other.maxY; + + if (d1 < offsetY) + { + offsetY = d1; + } + } + else if (offsetY < 0.0D && other.minY >= this.maxY) + { + double d0 = this.maxY - other.minY; + + if (d0 > offsetY) + { + offsetY = d0; + } + } + + return offsetY; + } + else + { + return offsetY; + } + } + + /** + * if instance and the argument bounding boxes overlap in the Y and X dimensions, calculate the offset between them + * in the Z dimension. return var2 if the bounding boxes do not overlap or if var2 is closer to 0 then the + * calculated offset. Otherwise return the calculated offset. + */ + public double calculateZOffset(AxisAlignedBB other, double offsetZ) + { + if (other.maxX > this.minX && other.minX < this.maxX && other.maxY > this.minY && other.minY < this.maxY) + { + if (offsetZ > 0.0D && other.maxZ <= this.minZ) + { + double d1 = this.minZ - other.maxZ; + + if (d1 < offsetZ) + { + offsetZ = d1; + } + } + else if (offsetZ < 0.0D && other.minZ >= this.maxZ) + { + double d0 = this.maxZ - other.minZ; + + if (d0 > offsetZ) + { + offsetZ = d0; + } + } + + return offsetZ; + } + else + { + return offsetZ; + } + } + + /** + * Returns whether the given bounding box intersects with this one. Args: axisAlignedBB + */ + public boolean intersectsWith(AxisAlignedBB other) + { + return other.maxX > this.minX && other.minX < this.maxX ? (other.maxY > this.minY && other.minY < this.maxY ? other.maxZ > this.minZ && other.minZ < this.maxZ : false) : false; + } + + /** + * Returns if the supplied Vec3D is completely inside the bounding box + */ + public boolean isVecInside(Vec3 vec) + { + return vec.xCoord > this.minX && vec.xCoord < this.maxX ? (vec.yCoord > this.minY && vec.yCoord < this.maxY ? vec.zCoord > this.minZ && vec.zCoord < this.maxZ : false) : false; + } + + /** + * Returns the average length of the edges of the bounding box. + */ + public double getAverageEdgeLength() + { + double d0 = this.maxX - this.minX; + double d1 = this.maxY - this.minY; + double d2 = this.maxZ - this.minZ; + return (d0 + d1 + d2) / 3.0D; + } + + /** + * Returns a bounding box that is inset by the specified amounts + */ + public AxisAlignedBB contract(double x, double y, double z) + { + double d0 = this.minX + x; + double d1 = this.minY + y; + double d2 = this.minZ + z; + double d3 = this.maxX - x; + double d4 = this.maxY - y; + double d5 = this.maxZ - z; + return new AxisAlignedBB(d0, d1, d2, d3, d4, d5); + } + + public MovingObjectPosition calculateIntercept(Vec3 vecA, Vec3 vecB) + { + Vec3 vec3 = vecA.getIntermediateWithXValue(vecB, this.minX); + Vec3 vec31 = vecA.getIntermediateWithXValue(vecB, this.maxX); + Vec3 vec32 = vecA.getIntermediateWithYValue(vecB, this.minY); + Vec3 vec33 = vecA.getIntermediateWithYValue(vecB, this.maxY); + Vec3 vec34 = vecA.getIntermediateWithZValue(vecB, this.minZ); + Vec3 vec35 = vecA.getIntermediateWithZValue(vecB, this.maxZ); + + if (!this.isVecInYZ(vec3)) + { + vec3 = null; + } + + if (!this.isVecInYZ(vec31)) + { + vec31 = null; + } + + if (!this.isVecInXZ(vec32)) + { + vec32 = null; + } + + if (!this.isVecInXZ(vec33)) + { + vec33 = null; + } + + if (!this.isVecInXY(vec34)) + { + vec34 = null; + } + + if (!this.isVecInXY(vec35)) + { + vec35 = null; + } + + Vec3 vec36 = null; + + if (vec3 != null) + { + vec36 = vec3; + } + + if (vec31 != null && (vec36 == null || vecA.squareDistanceTo(vec31) < vecA.squareDistanceTo(vec36))) + { + vec36 = vec31; + } + + if (vec32 != null && (vec36 == null || vecA.squareDistanceTo(vec32) < vecA.squareDistanceTo(vec36))) + { + vec36 = vec32; + } + + if (vec33 != null && (vec36 == null || vecA.squareDistanceTo(vec33) < vecA.squareDistanceTo(vec36))) + { + vec36 = vec33; + } + + if (vec34 != null && (vec36 == null || vecA.squareDistanceTo(vec34) < vecA.squareDistanceTo(vec36))) + { + vec36 = vec34; + } + + if (vec35 != null && (vec36 == null || vecA.squareDistanceTo(vec35) < vecA.squareDistanceTo(vec36))) + { + vec36 = vec35; + } + + if (vec36 == null) + { + return null; + } + else + { + EnumFacing enumfacing = null; + + if (vec36 == vec3) + { + enumfacing = EnumFacing.WEST; + } + else if (vec36 == vec31) + { + enumfacing = EnumFacing.EAST; + } + else if (vec36 == vec32) + { + enumfacing = EnumFacing.DOWN; + } + else if (vec36 == vec33) + { + enumfacing = EnumFacing.UP; + } + else if (vec36 == vec34) + { + enumfacing = EnumFacing.NORTH; + } + else + { + enumfacing = EnumFacing.SOUTH; + } + + return new MovingObjectPosition(vec36, enumfacing); + } + } + + /** + * Checks if the specified vector is within the YZ dimensions of the bounding box. Args: Vec3D + */ + private boolean isVecInYZ(Vec3 vec) + { + return vec == null ? false : vec.yCoord >= this.minY && vec.yCoord <= this.maxY && vec.zCoord >= this.minZ && vec.zCoord <= this.maxZ; + } + + /** + * Checks if the specified vector is within the XZ dimensions of the bounding box. Args: Vec3D + */ + private boolean isVecInXZ(Vec3 vec) + { + return vec == null ? false : vec.xCoord >= this.minX && vec.xCoord <= this.maxX && vec.zCoord >= this.minZ && vec.zCoord <= this.maxZ; + } + + /** + * Checks if the specified vector is within the XY dimensions of the bounding box. Args: Vec3D + */ + private boolean isVecInXY(Vec3 vec) + { + return vec == null ? false : vec.xCoord >= this.minX && vec.xCoord <= this.maxX && vec.yCoord >= this.minY && vec.yCoord <= this.maxY; + } + + public String toString() + { + return "box[" + this.minX + ", " + this.minY + ", " + this.minZ + " -> " + this.maxX + ", " + this.maxY + ", " + this.maxZ + "]"; + } + + public boolean func_181656_b() + { + return Double.isNaN(this.minX) || Double.isNaN(this.minY) || Double.isNaN(this.minZ) || Double.isNaN(this.maxX) || Double.isNaN(this.maxY) || Double.isNaN(this.maxZ); + } +} diff --git a/src/minecraft/net/minecraft/util/BlockPos.java b/src/minecraft/net/minecraft/util/BlockPos.java new file mode 100644 index 0000000..a941439 --- /dev/null +++ b/src/minecraft/net/minecraft/util/BlockPos.java @@ -0,0 +1,366 @@ +package net.minecraft.util; + +import com.google.common.collect.AbstractIterator; +import java.util.Iterator; +import net.minecraft.entity.Entity; + +public class BlockPos extends Vec3i +{ + /** The BlockPos with all coordinates 0 */ + public static final BlockPos ORIGIN = new BlockPos(0, 0, 0); + private static final int NUM_X_BITS = 1 + MathHelper.calculateLogBaseTwo(MathHelper.roundUpToPowerOfTwo(30000000)); + private static final int NUM_Z_BITS = NUM_X_BITS; + private static final int NUM_Y_BITS = 64 - NUM_X_BITS - NUM_Z_BITS; + private static final int Y_SHIFT = 0 + NUM_Z_BITS; + private static final int X_SHIFT = Y_SHIFT + NUM_Y_BITS; + private static final long X_MASK = (1L << NUM_X_BITS) - 1L; + private static final long Y_MASK = (1L << NUM_Y_BITS) - 1L; + private static final long Z_MASK = (1L << NUM_Z_BITS) - 1L; + + public BlockPos(int x, int y, int z) + { + super(x, y, z); + } + + public BlockPos(double x, double y, double z) + { + super(x, y, z); + } + + public BlockPos(Entity source) + { + this(source.posX, source.posY, source.posZ); + } + + public BlockPos(Vec3 source) + { + this(source.xCoord, source.yCoord, source.zCoord); + } + + public BlockPos(Vec3i source) + { + this(source.getX(), source.getY(), source.getZ()); + } + + /** + * Add the given coordinates to the coordinates of this BlockPos + */ + public BlockPos add(double x, double y, double z) + { + return x == 0.0D && y == 0.0D && z == 0.0D ? this : new BlockPos((double)this.getX() + x, (double)this.getY() + y, (double)this.getZ() + z); + } + + /** + * Add the given coordinates to the coordinates of this BlockPos + */ + public BlockPos add(int x, int y, int z) + { + return x == 0 && y == 0 && z == 0 ? this : new BlockPos(this.getX() + x, this.getY() + y, this.getZ() + z); + } + + /** + * Add the given Vector to this BlockPos + */ + public BlockPos add(Vec3i vec) + { + return vec.getX() == 0 && vec.getY() == 0 && vec.getZ() == 0 ? this : new BlockPos(this.getX() + vec.getX(), this.getY() + vec.getY(), this.getZ() + vec.getZ()); + } + + /** + * Subtract the given Vector from this BlockPos + */ + public BlockPos subtract(Vec3i vec) + { + return vec.getX() == 0 && vec.getY() == 0 && vec.getZ() == 0 ? this : new BlockPos(this.getX() - vec.getX(), this.getY() - vec.getY(), this.getZ() - vec.getZ()); + } + + /** + * Offset this BlockPos 1 block up + */ + public BlockPos up() + { + return this.up(1); + } + + /** + * Offset this BlockPos n blocks up + */ + public BlockPos up(int n) + { + return this.offset(EnumFacing.UP, n); + } + + /** + * Offset this BlockPos 1 block down + */ + public BlockPos down() + { + return this.down(1); + } + + /** + * Offset this BlockPos n blocks down + */ + public BlockPos down(int n) + { + return this.offset(EnumFacing.DOWN, n); + } + + /** + * Offset this BlockPos 1 block in northern direction + */ + public BlockPos north() + { + return this.north(1); + } + + /** + * Offset this BlockPos n blocks in northern direction + */ + public BlockPos north(int n) + { + return this.offset(EnumFacing.NORTH, n); + } + + /** + * Offset this BlockPos 1 block in southern direction + */ + public BlockPos south() + { + return this.south(1); + } + + /** + * Offset this BlockPos n blocks in southern direction + */ + public BlockPos south(int n) + { + return this.offset(EnumFacing.SOUTH, n); + } + + /** + * Offset this BlockPos 1 block in western direction + */ + public BlockPos west() + { + return this.west(1); + } + + /** + * Offset this BlockPos n blocks in western direction + */ + public BlockPos west(int n) + { + return this.offset(EnumFacing.WEST, n); + } + + /** + * Offset this BlockPos 1 block in eastern direction + */ + public BlockPos east() + { + return this.east(1); + } + + /** + * Offset this BlockPos n blocks in eastern direction + */ + public BlockPos east(int n) + { + return this.offset(EnumFacing.EAST, n); + } + + /** + * Offset this BlockPos 1 block in the given direction + */ + public BlockPos offset(EnumFacing facing) + { + return this.offset(facing, 1); + } + + /** + * Offsets this BlockPos n blocks in the given direction + */ + public BlockPos offset(EnumFacing facing, int n) + { + return n == 0 ? this : new BlockPos(this.getX() + facing.getFrontOffsetX() * n, this.getY() + facing.getFrontOffsetY() * n, this.getZ() + facing.getFrontOffsetZ() * n); + } + + /** + * Calculate the cross product of this and the given Vector + */ + public BlockPos crossProduct(Vec3i vec) + { + return new BlockPos(this.getY() * vec.getZ() - this.getZ() * vec.getY(), this.getZ() * vec.getX() - this.getX() * vec.getZ(), this.getX() * vec.getY() - this.getY() * vec.getX()); + } + + /** + * Serialize this BlockPos into a long value + */ + public long toLong() + { + return ((long)this.getX() & X_MASK) << X_SHIFT | ((long)this.getY() & Y_MASK) << Y_SHIFT | ((long)this.getZ() & Z_MASK) << 0; + } + + /** + * Create a BlockPos from a serialized long value (created by toLong) + */ + public static BlockPos fromLong(long serialized) + { + int i = (int)(serialized << 64 - X_SHIFT - NUM_X_BITS >> 64 - NUM_X_BITS); + int j = (int)(serialized << 64 - Y_SHIFT - NUM_Y_BITS >> 64 - NUM_Y_BITS); + int k = (int)(serialized << 64 - NUM_Z_BITS >> 64 - NUM_Z_BITS); + return new BlockPos(i, j, k); + } + + public static Iterable getAllInBox(BlockPos from, BlockPos to) + { + final BlockPos blockpos = new BlockPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ())); + final BlockPos blockpos1 = new BlockPos(Math.max(from.getX(), to.getX()), Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ())); + return new Iterable() + { + public Iterator iterator() + { + return new AbstractIterator() + { + private BlockPos lastReturned = null; + protected BlockPos computeNext() + { + if (this.lastReturned == null) + { + this.lastReturned = blockpos; + return this.lastReturned; + } + else if (this.lastReturned.equals(blockpos1)) + { + return (BlockPos)this.endOfData(); + } + else + { + int i = this.lastReturned.getX(); + int j = this.lastReturned.getY(); + int k = this.lastReturned.getZ(); + + if (i < blockpos1.getX()) + { + ++i; + } + else if (j < blockpos1.getY()) + { + i = blockpos.getX(); + ++j; + } + else if (k < blockpos1.getZ()) + { + i = blockpos.getX(); + j = blockpos.getY(); + ++k; + } + + this.lastReturned = new BlockPos(i, j, k); + return this.lastReturned; + } + } + }; + } + }; + } + + public static Iterable getAllInBoxMutable(BlockPos from, BlockPos to) + { + final BlockPos blockpos = new BlockPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ())); + final BlockPos blockpos1 = new BlockPos(Math.max(from.getX(), to.getX()), Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ())); + return new Iterable() + { + public Iterator iterator() + { + return new AbstractIterator() + { + private BlockPos.MutableBlockPos theBlockPos = null; + protected BlockPos.MutableBlockPos computeNext() + { + if (this.theBlockPos == null) + { + this.theBlockPos = new BlockPos.MutableBlockPos(blockpos.getX(), blockpos.getY(), blockpos.getZ()); + return this.theBlockPos; + } + else if (this.theBlockPos.equals(blockpos1)) + { + return (BlockPos.MutableBlockPos)this.endOfData(); + } + else + { + int i = this.theBlockPos.getX(); + int j = this.theBlockPos.getY(); + int k = this.theBlockPos.getZ(); + + if (i < blockpos1.getX()) + { + ++i; + } + else if (j < blockpos1.getY()) + { + i = blockpos.getX(); + ++j; + } + else if (k < blockpos1.getZ()) + { + i = blockpos.getX(); + j = blockpos.getY(); + ++k; + } + + this.theBlockPos.x = i; + this.theBlockPos.y = j; + this.theBlockPos.z = k; + return this.theBlockPos; + } + } + }; + } + }; + } + + public static final class MutableBlockPos extends BlockPos + { + private int x; + private int y; + private int z; + + public MutableBlockPos() + { + this(0, 0, 0); + } + + public MutableBlockPos(int x_, int y_, int z_) + { + super(0, 0, 0); + this.x = x_; + this.y = y_; + this.z = z_; + } + + public int getX() + { + return this.x; + } + + public int getY() + { + return this.y; + } + + public int getZ() + { + return this.z; + } + + public BlockPos.MutableBlockPos func_181079_c(int p_181079_1_, int p_181079_2_, int p_181079_3_) + { + this.x = p_181079_1_; + this.y = p_181079_2_; + this.z = p_181079_3_; + return this; + } + } +} diff --git a/src/minecraft/net/minecraft/util/Cartesian.java b/src/minecraft/net/minecraft/util/Cartesian.java new file mode 100644 index 0000000..fba8ad8 --- /dev/null +++ b/src/minecraft/net/minecraft/util/Cartesian.java @@ -0,0 +1,174 @@ +package net.minecraft.util; + +import com.google.common.base.Function; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.UnmodifiableIterator; +import java.lang.reflect.Array; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; + +public class Cartesian +{ + public static Iterable cartesianProduct(Class clazz, Iterable > sets) + { + return new Cartesian.Product(clazz, (Iterable[])toArray(Iterable.class, sets)); + } + + public static Iterable> cartesianProduct(Iterable > sets) + { + return arraysAsLists(cartesianProduct(Object.class, sets)); + } + + private static Iterable> arraysAsLists(Iterable arrays) + { + return Iterables.transform(arrays, new Cartesian.GetList()); + } + + private static T[] toArray(Class clazz, Iterable it) + { + List list = Lists.newArrayList(); + + for (T t : it) + { + list.add(t); + } + + return (T[])((Object[])list.toArray(createArray(clazz, list.size()))); + } + + private static T[] createArray(Class p_179319_0_, int p_179319_1_) + { + return (T[])((Object[])((Object[])Array.newInstance(p_179319_0_, p_179319_1_))); + } + + static class GetList implements Function> + { + private GetList() + { + } + + public List apply(Object[] p_apply_1_) + { + return Arrays.asList((T[])p_apply_1_); + } + } + + static class Product implements Iterable + { + private final Class clazz; + private final Iterable [] iterables; + + private Product(Class clazz, Iterable [] iterables) + { + this.clazz = clazz; + this.iterables = iterables; + } + + public Iterator iterator() + { + return (Iterator)(this.iterables.length <= 0 ? Collections.singletonList((Object[])Cartesian.createArray(this.clazz, 0)).iterator() : new Cartesian.Product.ProductIterator(this.clazz, this.iterables)); + } + + static class ProductIterator extends UnmodifiableIterator + { + private int index; + private final Iterable [] iterables; + private final Iterator [] iterators; + private final T[] results; + + private ProductIterator(Class clazz, Iterable [] iterables) + { + this.index = -2; + this.iterables = iterables; + this.iterators = (Iterator[])Cartesian.createArray(Iterator.class, this.iterables.length); + + for (int i = 0; i < this.iterables.length; ++i) + { + this.iterators[i] = iterables[i].iterator(); + } + + this.results = Cartesian.createArray(clazz, this.iterators.length); + } + + private void endOfData() + { + this.index = -1; + Arrays.fill(this.iterators, (Object)null); + Arrays.fill(this.results, (Object)null); + } + + public boolean hasNext() + { + if (this.index == -2) + { + this.index = 0; + + for (Iterator iterator1 : this.iterators) + { + if (!iterator1.hasNext()) + { + this.endOfData(); + break; + } + } + + return true; + } + else + { + if (this.index >= this.iterators.length) + { + for (this.index = this.iterators.length - 1; this.index >= 0; --this.index) + { + Iterator iterator = this.iterators[this.index]; + + if (iterator.hasNext()) + { + break; + } + + if (this.index == 0) + { + this.endOfData(); + break; + } + + iterator = this.iterables[this.index].iterator(); + this.iterators[this.index] = iterator; + + if (!iterator.hasNext()) + { + this.endOfData(); + break; + } + } + } + + return this.index >= 0; + } + } + + public T[] next() + { + if (!this.hasNext()) + { + throw new NoSuchElementException(); + } + else + { + while (this.index < this.iterators.length) + { + this.results[this.index] = this.iterators[this.index].next(); + ++this.index; + } + + return (T[])((Object[])this.results.clone()); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/util/ChatAllowedCharacters.java b/src/minecraft/net/minecraft/util/ChatAllowedCharacters.java new file mode 100644 index 0000000..fe8464b --- /dev/null +++ b/src/minecraft/net/minecraft/util/ChatAllowedCharacters.java @@ -0,0 +1,32 @@ +package net.minecraft.util; + +public class ChatAllowedCharacters +{ + /** + * Array of the special characters that are allowed in any text drawing of Minecraft. + */ + public static final char[] allowedCharactersArray = new char[] {'/', '\n', '\r', '\t', '\u0000', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':'}; + + public static boolean isAllowedCharacter(char character) + { + return character != 167 && character >= 32 && character != 127; + } + + /** + * Filter string by only keeping those characters for which isAllowedCharacter() returns true. + */ + public static String filterAllowedCharacters(String input) + { + StringBuilder stringbuilder = new StringBuilder(); + + for (char c0 : input.toCharArray()) + { + if (isAllowedCharacter(c0)) + { + stringbuilder.append(c0); + } + } + + return stringbuilder.toString(); + } +} diff --git a/src/minecraft/net/minecraft/util/ChatComponentProcessor.java b/src/minecraft/net/minecraft/util/ChatComponentProcessor.java new file mode 100644 index 0000000..808a33f --- /dev/null +++ b/src/minecraft/net/minecraft/util/ChatComponentProcessor.java @@ -0,0 +1,86 @@ +package net.minecraft.util; + +import java.util.List; +import net.minecraft.command.CommandException; +import net.minecraft.command.EntityNotFoundException; +import net.minecraft.command.ICommandSender; +import net.minecraft.command.PlayerSelector; +import net.minecraft.entity.Entity; + +public class ChatComponentProcessor +{ + public static IChatComponent processComponent(ICommandSender commandSender, IChatComponent component, Entity entityIn) throws CommandException + { + IChatComponent ichatcomponent = null; + + if (component instanceof ChatComponentScore) + { + ChatComponentScore chatcomponentscore = (ChatComponentScore)component; + String s = chatcomponentscore.getName(); + + if (PlayerSelector.hasArguments(s)) + { + List list = PlayerSelector.matchEntities(commandSender, s, Entity.class); + + if (list.size() != 1) + { + throw new EntityNotFoundException(); + } + + s = ((Entity)list.get(0)).getName(); + } + + ichatcomponent = entityIn != null && s.equals("*") ? new ChatComponentScore(entityIn.getName(), chatcomponentscore.getObjective()) : new ChatComponentScore(s, chatcomponentscore.getObjective()); + ((ChatComponentScore)ichatcomponent).setValue(chatcomponentscore.getUnformattedTextForChat()); + } + else if (component instanceof ChatComponentSelector) + { + String s1 = ((ChatComponentSelector)component).getSelector(); + ichatcomponent = PlayerSelector.matchEntitiesToChatComponent(commandSender, s1); + + if (ichatcomponent == null) + { + ichatcomponent = new ChatComponentText(""); + } + } + else if (component instanceof ChatComponentText) + { + ichatcomponent = new ChatComponentText(((ChatComponentText)component).getChatComponentText_TextValue()); + } + else + { + if (!(component instanceof ChatComponentTranslation)) + { + return component; + } + + Object[] aobject = ((ChatComponentTranslation)component).getFormatArgs(); + + for (int i = 0; i < aobject.length; ++i) + { + Object object = aobject[i]; + + if (object instanceof IChatComponent) + { + aobject[i] = processComponent(commandSender, (IChatComponent)object, entityIn); + } + } + + ichatcomponent = new ChatComponentTranslation(((ChatComponentTranslation)component).getKey(), aobject); + } + + ChatStyle chatstyle = component.getChatStyle(); + + if (chatstyle != null) + { + ichatcomponent.setChatStyle(chatstyle.createShallowCopy()); + } + + for (IChatComponent ichatcomponent1 : component.getSiblings()) + { + ichatcomponent.appendSibling(processComponent(commandSender, ichatcomponent1, entityIn)); + } + + return ichatcomponent; + } +} diff --git a/src/minecraft/net/minecraft/util/ChatComponentScore.java b/src/minecraft/net/minecraft/util/ChatComponentScore.java new file mode 100644 index 0000000..5222123 --- /dev/null +++ b/src/minecraft/net/minecraft/util/ChatComponentScore.java @@ -0,0 +1,105 @@ +package net.minecraft.util; + +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.server.MinecraftServer; + +public class ChatComponentScore extends ChatComponentStyle +{ + private final String name; + private final String objective; + + /** The value displayed instead of the real score (may be null) */ + private String value = ""; + + public ChatComponentScore(String nameIn, String objectiveIn) + { + this.name = nameIn; + this.objective = objectiveIn; + } + + public String getName() + { + return this.name; + } + + public String getObjective() + { + return this.objective; + } + + /** + * Sets the value displayed instead of the real score. + */ + public void setValue(String valueIn) + { + this.value = valueIn; + } + + /** + * Gets the text of this component, without any special formatting codes added, for chat. TODO: why is this two + * different methods? + */ + public String getUnformattedTextForChat() + { + MinecraftServer minecraftserver = MinecraftServer.getServer(); + + if (minecraftserver != null && minecraftserver.isAnvilFileSet() && StringUtils.isNullOrEmpty(this.value)) + { + Scoreboard scoreboard = minecraftserver.worldServerForDimension(0).getScoreboard(); + ScoreObjective scoreobjective = scoreboard.getObjective(this.objective); + + if (scoreboard.entityHasObjective(this.name, scoreobjective)) + { + Score score = scoreboard.getValueFromObjective(this.name, scoreobjective); + this.setValue(String.format("%d", new Object[] {Integer.valueOf(score.getScorePoints())})); + } + else + { + this.value = ""; + } + } + + return this.value; + } + + /** + * Creates a copy of this component. Almost a deep copy, except the style is shallow-copied. + */ + public ChatComponentScore createCopy() + { + ChatComponentScore chatcomponentscore = new ChatComponentScore(this.name, this.objective); + chatcomponentscore.setValue(this.value); + chatcomponentscore.setChatStyle(this.getChatStyle().createShallowCopy()); + + for (IChatComponent ichatcomponent : this.getSiblings()) + { + chatcomponentscore.appendSibling(ichatcomponent.createCopy()); + } + + return chatcomponentscore; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof ChatComponentScore)) + { + return false; + } + else + { + ChatComponentScore chatcomponentscore = (ChatComponentScore)p_equals_1_; + return this.name.equals(chatcomponentscore.name) && this.objective.equals(chatcomponentscore.objective) && super.equals(p_equals_1_); + } + } + + public String toString() + { + return "ScoreComponent{name=\'" + this.name + '\'' + "objective=\'" + this.objective + '\'' + ", siblings=" + this.siblings + ", style=" + this.getChatStyle() + '}'; + } +} diff --git a/src/minecraft/net/minecraft/util/ChatComponentSelector.java b/src/minecraft/net/minecraft/util/ChatComponentSelector.java new file mode 100644 index 0000000..a4df199 --- /dev/null +++ b/src/minecraft/net/minecraft/util/ChatComponentSelector.java @@ -0,0 +1,69 @@ +package net.minecraft.util; + +public class ChatComponentSelector extends ChatComponentStyle +{ + /** + * The selector used to find the matching entities of this text component + */ + private final String selector; + + public ChatComponentSelector(String selectorIn) + { + this.selector = selectorIn; + } + + /** + * Gets the selector of this component, in plain text. + */ + public String getSelector() + { + return this.selector; + } + + /** + * Gets the text of this component, without any special formatting codes added, for chat. TODO: why is this two + * different methods? + */ + public String getUnformattedTextForChat() + { + return this.selector; + } + + /** + * Creates a copy of this component. Almost a deep copy, except the style is shallow-copied. + */ + public ChatComponentSelector createCopy() + { + ChatComponentSelector chatcomponentselector = new ChatComponentSelector(this.selector); + chatcomponentselector.setChatStyle(this.getChatStyle().createShallowCopy()); + + for (IChatComponent ichatcomponent : this.getSiblings()) + { + chatcomponentselector.appendSibling(ichatcomponent.createCopy()); + } + + return chatcomponentselector; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof ChatComponentSelector)) + { + return false; + } + else + { + ChatComponentSelector chatcomponentselector = (ChatComponentSelector)p_equals_1_; + return this.selector.equals(chatcomponentselector.selector) && super.equals(p_equals_1_); + } + } + + public String toString() + { + return "SelectorComponent{pattern=\'" + this.selector + '\'' + ", siblings=" + this.siblings + ", style=" + this.getChatStyle() + '}'; + } +} diff --git a/src/minecraft/net/minecraft/util/ChatComponentStyle.java b/src/minecraft/net/minecraft/util/ChatComponentStyle.java new file mode 100644 index 0000000..29dc1cd --- /dev/null +++ b/src/minecraft/net/minecraft/util/ChatComponentStyle.java @@ -0,0 +1,148 @@ +package net.minecraft.util; + +import com.google.common.base.Function; +import com.google.common.collect.Iterators; +import com.google.common.collect.Lists; +import java.util.Iterator; +import java.util.List; + +public abstract class ChatComponentStyle implements IChatComponent +{ + protected List siblings = Lists.newArrayList(); + private ChatStyle style; + + /** + * Appends the given component to the end of this one. + */ + public IChatComponent appendSibling(IChatComponent component) + { + component.getChatStyle().setParentStyle(this.getChatStyle()); + this.siblings.add(component); + return this; + } + + public List getSiblings() + { + return this.siblings; + } + + /** + * Appends the given text to the end of this component. + */ + public IChatComponent appendText(String text) + { + return this.appendSibling(new ChatComponentText(text)); + } + + public IChatComponent setChatStyle(ChatStyle style) + { + this.style = style; + + for (IChatComponent ichatcomponent : this.siblings) + { + ichatcomponent.getChatStyle().setParentStyle(this.getChatStyle()); + } + + return this; + } + + public ChatStyle getChatStyle() + { + if (this.style == null) + { + this.style = new ChatStyle(); + + for (IChatComponent ichatcomponent : this.siblings) + { + ichatcomponent.getChatStyle().setParentStyle(this.style); + } + } + + return this.style; + } + + public Iterator iterator() + { + return Iterators.concat(Iterators.forArray(new ChatComponentStyle[] {this}), createDeepCopyIterator(this.siblings)); + } + + /** + * Get the text of this component, and all child components, with all special formatting codes removed. + */ + public final String getUnformattedText() + { + StringBuilder stringbuilder = new StringBuilder(); + + for (IChatComponent ichatcomponent : this) + { + stringbuilder.append(ichatcomponent.getUnformattedTextForChat()); + } + + return stringbuilder.toString(); + } + + /** + * Gets the text of this component, with formatting codes added for rendering. + */ + public final String getFormattedText() + { + StringBuilder stringbuilder = new StringBuilder(); + + for (IChatComponent ichatcomponent : this) + { + stringbuilder.append(ichatcomponent.getChatStyle().getFormattingCode()); + stringbuilder.append(ichatcomponent.getUnformattedTextForChat()); + stringbuilder.append((Object)EnumChatFormatting.RESET); + } + + return stringbuilder.toString(); + } + + public static Iterator createDeepCopyIterator(Iterable components) + { + Iterator iterator = Iterators.concat(Iterators.transform(components.iterator(), new Function>() + { + public Iterator apply(IChatComponent p_apply_1_) + { + return p_apply_1_.iterator(); + } + })); + iterator = Iterators.transform(iterator, new Function() + { + public IChatComponent apply(IChatComponent p_apply_1_) + { + IChatComponent ichatcomponent = p_apply_1_.createCopy(); + ichatcomponent.setChatStyle(ichatcomponent.getChatStyle().createDeepCopy()); + return ichatcomponent; + } + }); + return iterator; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof ChatComponentStyle)) + { + return false; + } + else + { + ChatComponentStyle chatcomponentstyle = (ChatComponentStyle)p_equals_1_; + return this.siblings.equals(chatcomponentstyle.siblings) && this.getChatStyle().equals(chatcomponentstyle.getChatStyle()); + } + } + + public int hashCode() + { + return 31 * this.style.hashCode() + this.siblings.hashCode(); + } + + public String toString() + { + return "BaseComponent{style=" + this.style + ", siblings=" + this.siblings + '}'; + } +} diff --git a/src/minecraft/net/minecraft/util/ChatComponentText.java b/src/minecraft/net/minecraft/util/ChatComponentText.java new file mode 100644 index 0000000..78ab11f --- /dev/null +++ b/src/minecraft/net/minecraft/util/ChatComponentText.java @@ -0,0 +1,67 @@ +package net.minecraft.util; + +public class ChatComponentText extends ChatComponentStyle +{ + private final String text; + + public ChatComponentText(String msg) + { + this.text = msg; + } + + /** + * Gets the text value of this ChatComponentText. TODO: what are getUnformattedText and getUnformattedTextForChat + * missing that made someone decide to create a third equivalent method that only ChatComponentText can implement? + */ + public String getChatComponentText_TextValue() + { + return this.text; + } + + /** + * Gets the text of this component, without any special formatting codes added, for chat. TODO: why is this two + * different methods? + */ + public String getUnformattedTextForChat() + { + return this.text; + } + + /** + * Creates a copy of this component. Almost a deep copy, except the style is shallow-copied. + */ + public ChatComponentText createCopy() + { + ChatComponentText chatcomponenttext = new ChatComponentText(this.text); + chatcomponenttext.setChatStyle(this.getChatStyle().createShallowCopy()); + + for (IChatComponent ichatcomponent : this.getSiblings()) + { + chatcomponenttext.appendSibling(ichatcomponent.createCopy()); + } + + return chatcomponenttext; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof ChatComponentText)) + { + return false; + } + else + { + ChatComponentText chatcomponenttext = (ChatComponentText)p_equals_1_; + return this.text.equals(chatcomponenttext.getChatComponentText_TextValue()) && super.equals(p_equals_1_); + } + } + + public String toString() + { + return "TextComponent{text=\'" + this.text + '\'' + ", siblings=" + this.siblings + ", style=" + this.getChatStyle() + '}'; + } +} diff --git a/src/minecraft/net/minecraft/util/ChatComponentTranslation.java b/src/minecraft/net/minecraft/util/ChatComponentTranslation.java new file mode 100644 index 0000000..cba5540 --- /dev/null +++ b/src/minecraft/net/minecraft/util/ChatComponentTranslation.java @@ -0,0 +1,277 @@ +package net.minecraft.util; + +import com.google.common.collect.Iterators; +import com.google.common.collect.Lists; +import java.util.Arrays; +import java.util.IllegalFormatException; +import java.util.Iterator; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class ChatComponentTranslation extends ChatComponentStyle +{ + private final String key; + private final Object[] formatArgs; + private final Object syncLock = new Object(); + private long lastTranslationUpdateTimeInMilliseconds = -1L; + List children = Lists.newArrayList(); + public static final Pattern stringVariablePattern = Pattern.compile("%(?:(\\d+)\\$)?([A-Za-z%]|$)"); + + public ChatComponentTranslation(String translationKey, Object... args) + { + this.key = translationKey; + this.formatArgs = args; + + for (Object object : args) + { + if (object instanceof IChatComponent) + { + ((IChatComponent)object).getChatStyle().setParentStyle(this.getChatStyle()); + } + } + } + + /** + * ensures that our children are initialized from the most recent string translation mapping. + */ + synchronized void ensureInitialized() + { + synchronized (this.syncLock) + { + long i = StatCollector.getLastTranslationUpdateTimeInMilliseconds(); + + if (i == this.lastTranslationUpdateTimeInMilliseconds) + { + return; + } + + this.lastTranslationUpdateTimeInMilliseconds = i; + this.children.clear(); + } + + try + { + this.initializeFromFormat(StatCollector.translateToLocal(this.key)); + } + catch (ChatComponentTranslationFormatException chatcomponenttranslationformatexception) + { + this.children.clear(); + + try + { + this.initializeFromFormat(StatCollector.translateToFallback(this.key)); + } + catch (ChatComponentTranslationFormatException var5) + { + throw chatcomponenttranslationformatexception; + } + } + } + + /** + * initializes our children from a format string, using the format args to fill in the placeholder variables. + */ + protected void initializeFromFormat(String format) + { + boolean flag = false; + Matcher matcher = stringVariablePattern.matcher(format); + int i = 0; + int j = 0; + + try + { + int l; + + for (; matcher.find(j); j = l) + { + int k = matcher.start(); + l = matcher.end(); + + if (k > j) + { + ChatComponentText chatcomponenttext = new ChatComponentText(String.format(format.substring(j, k), new Object[0])); + chatcomponenttext.getChatStyle().setParentStyle(this.getChatStyle()); + this.children.add(chatcomponenttext); + } + + String s2 = matcher.group(2); + String s = format.substring(k, l); + + if ("%".equals(s2) && "%%".equals(s)) + { + ChatComponentText chatcomponenttext2 = new ChatComponentText("%"); + chatcomponenttext2.getChatStyle().setParentStyle(this.getChatStyle()); + this.children.add(chatcomponenttext2); + } + else + { + if (!"s".equals(s2)) + { + throw new ChatComponentTranslationFormatException(this, "Unsupported format: \'" + s + "\'"); + } + + String s1 = matcher.group(1); + int i1 = s1 != null ? Integer.parseInt(s1) - 1 : i++; + + if (i1 < this.formatArgs.length) + { + this.children.add(this.getFormatArgumentAsComponent(i1)); + } + } + } + + if (j < format.length()) + { + ChatComponentText chatcomponenttext1 = new ChatComponentText(String.format(format.substring(j), new Object[0])); + chatcomponenttext1.getChatStyle().setParentStyle(this.getChatStyle()); + this.children.add(chatcomponenttext1); + } + } + catch (IllegalFormatException illegalformatexception) + { + throw new ChatComponentTranslationFormatException(this, illegalformatexception); + } + } + + private IChatComponent getFormatArgumentAsComponent(int index) + { + if (index >= this.formatArgs.length) + { + throw new ChatComponentTranslationFormatException(this, index); + } + else + { + Object object = this.formatArgs[index]; + IChatComponent ichatcomponent; + + if (object instanceof IChatComponent) + { + ichatcomponent = (IChatComponent)object; + } + else + { + ichatcomponent = new ChatComponentText(object == null ? "null" : object.toString()); + ichatcomponent.getChatStyle().setParentStyle(this.getChatStyle()); + } + + return ichatcomponent; + } + } + + public IChatComponent setChatStyle(ChatStyle style) + { + super.setChatStyle(style); + + for (Object object : this.formatArgs) + { + if (object instanceof IChatComponent) + { + ((IChatComponent)object).getChatStyle().setParentStyle(this.getChatStyle()); + } + } + + if (this.lastTranslationUpdateTimeInMilliseconds > -1L) + { + for (IChatComponent ichatcomponent : this.children) + { + ichatcomponent.getChatStyle().setParentStyle(style); + } + } + + return this; + } + + public Iterator iterator() + { + this.ensureInitialized(); + return Iterators.concat(createDeepCopyIterator(this.children), createDeepCopyIterator(this.siblings)); + } + + /** + * Gets the text of this component, without any special formatting codes added, for chat. TODO: why is this two + * different methods? + */ + public String getUnformattedTextForChat() + { + this.ensureInitialized(); + StringBuilder stringbuilder = new StringBuilder(); + + for (IChatComponent ichatcomponent : this.children) + { + stringbuilder.append(ichatcomponent.getUnformattedTextForChat()); + } + + return stringbuilder.toString(); + } + + /** + * Creates a copy of this component. Almost a deep copy, except the style is shallow-copied. + */ + public ChatComponentTranslation createCopy() + { + Object[] aobject = new Object[this.formatArgs.length]; + + for (int i = 0; i < this.formatArgs.length; ++i) + { + if (this.formatArgs[i] instanceof IChatComponent) + { + aobject[i] = ((IChatComponent)this.formatArgs[i]).createCopy(); + } + else + { + aobject[i] = this.formatArgs[i]; + } + } + + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(this.key, aobject); + chatcomponenttranslation.setChatStyle(this.getChatStyle().createShallowCopy()); + + for (IChatComponent ichatcomponent : this.getSiblings()) + { + chatcomponenttranslation.appendSibling(ichatcomponent.createCopy()); + } + + return chatcomponenttranslation; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof ChatComponentTranslation)) + { + return false; + } + else + { + ChatComponentTranslation chatcomponenttranslation = (ChatComponentTranslation)p_equals_1_; + return Arrays.equals(this.formatArgs, chatcomponenttranslation.formatArgs) && this.key.equals(chatcomponenttranslation.key) && super.equals(p_equals_1_); + } + } + + public int hashCode() + { + int i = super.hashCode(); + i = 31 * i + this.key.hashCode(); + i = 31 * i + Arrays.hashCode(this.formatArgs); + return i; + } + + public String toString() + { + return "TranslatableComponent{key=\'" + this.key + '\'' + ", args=" + Arrays.toString(this.formatArgs) + ", siblings=" + this.siblings + ", style=" + this.getChatStyle() + '}'; + } + + public String getKey() + { + return this.key; + } + + public Object[] getFormatArgs() + { + return this.formatArgs; + } +} diff --git a/src/minecraft/net/minecraft/util/ChatComponentTranslationFormatException.java b/src/minecraft/net/minecraft/util/ChatComponentTranslationFormatException.java new file mode 100644 index 0000000..daf4a52 --- /dev/null +++ b/src/minecraft/net/minecraft/util/ChatComponentTranslationFormatException.java @@ -0,0 +1,19 @@ +package net.minecraft.util; + +public class ChatComponentTranslationFormatException extends IllegalArgumentException +{ + public ChatComponentTranslationFormatException(ChatComponentTranslation component, String message) + { + super(String.format("Error parsing: %s: %s", new Object[] {component, message})); + } + + public ChatComponentTranslationFormatException(ChatComponentTranslation component, int index) + { + super(String.format("Invalid index %d requested for %s", new Object[] {Integer.valueOf(index), component})); + } + + public ChatComponentTranslationFormatException(ChatComponentTranslation component, Throwable cause) + { + super(String.format("Error while parsing: %s", new Object[] {component}), cause); + } +} diff --git a/src/minecraft/net/minecraft/util/ChatStyle.java b/src/minecraft/net/minecraft/util/ChatStyle.java new file mode 100644 index 0000000..bfbcd81 --- /dev/null +++ b/src/minecraft/net/minecraft/util/ChatStyle.java @@ -0,0 +1,643 @@ +package net.minecraft.util; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; +import net.minecraft.event.ClickEvent; +import net.minecraft.event.HoverEvent; + +public class ChatStyle +{ + /** + * The parent of this ChatStyle. Used for looking up values that this instance does not override. + */ + private ChatStyle parentStyle; + private EnumChatFormatting color; + private Boolean bold; + private Boolean italic; + private Boolean underlined; + private Boolean strikethrough; + private Boolean obfuscated; + private ClickEvent chatClickEvent; + private HoverEvent chatHoverEvent; + private String insertion; + + /** + * The base of the ChatStyle hierarchy. All ChatStyle instances are implicitly children of this. + */ + private static final ChatStyle rootStyle = new ChatStyle() + { + public EnumChatFormatting getColor() + { + return null; + } + public boolean getBold() + { + return false; + } + public boolean getItalic() + { + return false; + } + public boolean getStrikethrough() + { + return false; + } + public boolean getUnderlined() + { + return false; + } + public boolean getObfuscated() + { + return false; + } + public ClickEvent getChatClickEvent() + { + return null; + } + public HoverEvent getChatHoverEvent() + { + return null; + } + public String getInsertion() + { + return null; + } + public ChatStyle setColor(EnumChatFormatting color) + { + throw new UnsupportedOperationException(); + } + public ChatStyle setBold(Boolean boldIn) + { + throw new UnsupportedOperationException(); + } + public ChatStyle setItalic(Boolean italic) + { + throw new UnsupportedOperationException(); + } + public ChatStyle setStrikethrough(Boolean strikethrough) + { + throw new UnsupportedOperationException(); + } + public ChatStyle setUnderlined(Boolean underlined) + { + throw new UnsupportedOperationException(); + } + public ChatStyle setObfuscated(Boolean obfuscated) + { + throw new UnsupportedOperationException(); + } + public ChatStyle setChatClickEvent(ClickEvent event) + { + throw new UnsupportedOperationException(); + } + public ChatStyle setChatHoverEvent(HoverEvent event) + { + throw new UnsupportedOperationException(); + } + public ChatStyle setParentStyle(ChatStyle parent) + { + throw new UnsupportedOperationException(); + } + public String toString() + { + return "Style.ROOT"; + } + public ChatStyle createShallowCopy() + { + return this; + } + public ChatStyle createDeepCopy() + { + return this; + } + public String getFormattingCode() + { + return ""; + } + }; + + /** + * Gets the effective color of this ChatStyle. + */ + public EnumChatFormatting getColor() + { + return this.color == null ? this.getParent().getColor() : this.color; + } + + /** + * Whether or not text of this ChatStyle should be in bold. + */ + public boolean getBold() + { + return this.bold == null ? this.getParent().getBold() : this.bold.booleanValue(); + } + + /** + * Whether or not text of this ChatStyle should be italicized. + */ + public boolean getItalic() + { + return this.italic == null ? this.getParent().getItalic() : this.italic.booleanValue(); + } + + /** + * Whether or not to format text of this ChatStyle using strikethrough. + */ + public boolean getStrikethrough() + { + return this.strikethrough == null ? this.getParent().getStrikethrough() : this.strikethrough.booleanValue(); + } + + /** + * Whether or not text of this ChatStyle should be underlined. + */ + public boolean getUnderlined() + { + return this.underlined == null ? this.getParent().getUnderlined() : this.underlined.booleanValue(); + } + + /** + * Whether or not text of this ChatStyle should be obfuscated. + */ + public boolean getObfuscated() + { + return this.obfuscated == null ? this.getParent().getObfuscated() : this.obfuscated.booleanValue(); + } + + /** + * Whether or not this style is empty (inherits everything from the parent). + */ + public boolean isEmpty() + { + return this.bold == null && this.italic == null && this.strikethrough == null && this.underlined == null && this.obfuscated == null && this.color == null && this.chatClickEvent == null && this.chatHoverEvent == null; + } + + /** + * The effective chat click event. + */ + public ClickEvent getChatClickEvent() + { + return this.chatClickEvent == null ? this.getParent().getChatClickEvent() : this.chatClickEvent; + } + + /** + * The effective chat hover event. + */ + public HoverEvent getChatHoverEvent() + { + return this.chatHoverEvent == null ? this.getParent().getChatHoverEvent() : this.chatHoverEvent; + } + + /** + * Get the text to be inserted into Chat when the component is shift-clicked + */ + public String getInsertion() + { + return this.insertion == null ? this.getParent().getInsertion() : this.insertion; + } + + /** + * Sets the color for this ChatStyle to the given value. Only use color values for this; set other values using the + * specific methods. + */ + public ChatStyle setColor(EnumChatFormatting color) + { + this.color = color; + return this; + } + + /** + * Sets whether or not text of this ChatStyle should be in bold. Set to false if, e.g., the parent style is bold + * and you want text of this style to be unbolded. + */ + public ChatStyle setBold(Boolean boldIn) + { + this.bold = boldIn; + return this; + } + + /** + * Sets whether or not text of this ChatStyle should be italicized. Set to false if, e.g., the parent style is + * italicized and you want to override that for this style. + */ + public ChatStyle setItalic(Boolean italic) + { + this.italic = italic; + return this; + } + + /** + * Sets whether or not to format text of this ChatStyle using strikethrough. Set to false if, e.g., the parent + * style uses strikethrough and you want to override that for this style. + */ + public ChatStyle setStrikethrough(Boolean strikethrough) + { + this.strikethrough = strikethrough; + return this; + } + + /** + * Sets whether or not text of this ChatStyle should be underlined. Set to false if, e.g., the parent style is + * underlined and you want to override that for this style. + */ + public ChatStyle setUnderlined(Boolean underlined) + { + this.underlined = underlined; + return this; + } + + /** + * Sets whether or not text of this ChatStyle should be obfuscated. Set to false if, e.g., the parent style is + * obfuscated and you want to override that for this style. + */ + public ChatStyle setObfuscated(Boolean obfuscated) + { + this.obfuscated = obfuscated; + return this; + } + + /** + * Sets the event that should be run when text of this ChatStyle is clicked on. + */ + public ChatStyle setChatClickEvent(ClickEvent event) + { + this.chatClickEvent = event; + return this; + } + + /** + * Sets the event that should be run when text of this ChatStyle is hovered over. + */ + public ChatStyle setChatHoverEvent(HoverEvent event) + { + this.chatHoverEvent = event; + return this; + } + + /** + * Set a text to be inserted into Chat when the component is shift-clicked + */ + public ChatStyle setInsertion(String insertion) + { + this.insertion = insertion; + return this; + } + + /** + * Sets the fallback ChatStyle to use if this ChatStyle does not override some value. Without a parent, obvious + * defaults are used (bold: false, underlined: false, etc). + */ + public ChatStyle setParentStyle(ChatStyle parent) + { + this.parentStyle = parent; + return this; + } + + /** + * Gets the equivalent text formatting code for this style, without the initial section sign (U+00A7) character. + */ + public String getFormattingCode() + { + if (this.isEmpty()) + { + return this.parentStyle != null ? this.parentStyle.getFormattingCode() : ""; + } + else + { + StringBuilder stringbuilder = new StringBuilder(); + + if (this.getColor() != null) + { + stringbuilder.append((Object)this.getColor()); + } + + if (this.getBold()) + { + stringbuilder.append((Object)EnumChatFormatting.BOLD); + } + + if (this.getItalic()) + { + stringbuilder.append((Object)EnumChatFormatting.ITALIC); + } + + if (this.getUnderlined()) + { + stringbuilder.append((Object)EnumChatFormatting.UNDERLINE); + } + + if (this.getObfuscated()) + { + stringbuilder.append((Object)EnumChatFormatting.OBFUSCATED); + } + + if (this.getStrikethrough()) + { + stringbuilder.append((Object)EnumChatFormatting.STRIKETHROUGH); + } + + return stringbuilder.toString(); + } + } + + /** + * Gets the immediate parent of this ChatStyle. + */ + private ChatStyle getParent() + { + return this.parentStyle == null ? rootStyle : this.parentStyle; + } + + public String toString() + { + return "Style{hasParent=" + (this.parentStyle != null) + ", color=" + this.color + ", bold=" + this.bold + ", italic=" + this.italic + ", underlined=" + this.underlined + ", obfuscated=" + this.obfuscated + ", clickEvent=" + this.getChatClickEvent() + ", hoverEvent=" + this.getChatHoverEvent() + ", insertion=" + this.getInsertion() + '}'; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof ChatStyle)) + { + return false; + } + else + { + boolean flag; + label0: + { + ChatStyle chatstyle = (ChatStyle)p_equals_1_; + + if (this.getBold() == chatstyle.getBold() && this.getColor() == chatstyle.getColor() && this.getItalic() == chatstyle.getItalic() && this.getObfuscated() == chatstyle.getObfuscated() && this.getStrikethrough() == chatstyle.getStrikethrough() && this.getUnderlined() == chatstyle.getUnderlined()) + { + label85: + { + if (this.getChatClickEvent() != null) + { + if (!this.getChatClickEvent().equals(chatstyle.getChatClickEvent())) + { + break label85; + } + } + else if (chatstyle.getChatClickEvent() != null) + { + break label85; + } + + if (this.getChatHoverEvent() != null) + { + if (!this.getChatHoverEvent().equals(chatstyle.getChatHoverEvent())) + { + break label85; + } + } + else if (chatstyle.getChatHoverEvent() != null) + { + break label85; + } + + if (this.getInsertion() != null) + { + if (this.getInsertion().equals(chatstyle.getInsertion())) + { + break label0; + } + } + else if (chatstyle.getInsertion() == null) + { + break label0; + } + } + } + + flag = false; + return flag; + } + flag = true; + return flag; + } + } + + public int hashCode() + { + int i = this.color.hashCode(); + i = 31 * i + this.bold.hashCode(); + i = 31 * i + this.italic.hashCode(); + i = 31 * i + this.underlined.hashCode(); + i = 31 * i + this.strikethrough.hashCode(); + i = 31 * i + this.obfuscated.hashCode(); + i = 31 * i + this.chatClickEvent.hashCode(); + i = 31 * i + this.chatHoverEvent.hashCode(); + i = 31 * i + this.insertion.hashCode(); + return i; + } + + /** + * Creates a shallow copy of this style. Changes to this instance's values will not be reflected in the copy, but + * changes to the parent style's values WILL be reflected in both this instance and the copy, wherever either does + * not override a value. + */ + public ChatStyle createShallowCopy() + { + ChatStyle chatstyle = new ChatStyle(); + chatstyle.bold = this.bold; + chatstyle.italic = this.italic; + chatstyle.strikethrough = this.strikethrough; + chatstyle.underlined = this.underlined; + chatstyle.obfuscated = this.obfuscated; + chatstyle.color = this.color; + chatstyle.chatClickEvent = this.chatClickEvent; + chatstyle.chatHoverEvent = this.chatHoverEvent; + chatstyle.parentStyle = this.parentStyle; + chatstyle.insertion = this.insertion; + return chatstyle; + } + + /** + * Creates a deep copy of this style. No changes to this instance or its parent style will be reflected in the + * copy. + */ + public ChatStyle createDeepCopy() + { + ChatStyle chatstyle = new ChatStyle(); + chatstyle.setBold(Boolean.valueOf(this.getBold())); + chatstyle.setItalic(Boolean.valueOf(this.getItalic())); + chatstyle.setStrikethrough(Boolean.valueOf(this.getStrikethrough())); + chatstyle.setUnderlined(Boolean.valueOf(this.getUnderlined())); + chatstyle.setObfuscated(Boolean.valueOf(this.getObfuscated())); + chatstyle.setColor(this.getColor()); + chatstyle.setChatClickEvent(this.getChatClickEvent()); + chatstyle.setChatHoverEvent(this.getChatHoverEvent()); + chatstyle.setInsertion(this.getInsertion()); + return chatstyle; + } + + public static class Serializer implements JsonDeserializer, JsonSerializer + { + public ChatStyle deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + if (p_deserialize_1_.isJsonObject()) + { + ChatStyle chatstyle = new ChatStyle(); + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + + if (jsonobject == null) + { + return null; + } + else + { + if (jsonobject.has("bold")) + { + chatstyle.bold = Boolean.valueOf(jsonobject.get("bold").getAsBoolean()); + } + + if (jsonobject.has("italic")) + { + chatstyle.italic = Boolean.valueOf(jsonobject.get("italic").getAsBoolean()); + } + + if (jsonobject.has("underlined")) + { + chatstyle.underlined = Boolean.valueOf(jsonobject.get("underlined").getAsBoolean()); + } + + if (jsonobject.has("strikethrough")) + { + chatstyle.strikethrough = Boolean.valueOf(jsonobject.get("strikethrough").getAsBoolean()); + } + + if (jsonobject.has("obfuscated")) + { + chatstyle.obfuscated = Boolean.valueOf(jsonobject.get("obfuscated").getAsBoolean()); + } + + if (jsonobject.has("color")) + { + chatstyle.color = (EnumChatFormatting)p_deserialize_3_.deserialize(jsonobject.get("color"), EnumChatFormatting.class); + } + + if (jsonobject.has("insertion")) + { + chatstyle.insertion = jsonobject.get("insertion").getAsString(); + } + + if (jsonobject.has("clickEvent")) + { + JsonObject jsonobject1 = jsonobject.getAsJsonObject("clickEvent"); + + if (jsonobject1 != null) + { + JsonPrimitive jsonprimitive = jsonobject1.getAsJsonPrimitive("action"); + ClickEvent.Action clickevent$action = jsonprimitive == null ? null : ClickEvent.Action.getValueByCanonicalName(jsonprimitive.getAsString()); + JsonPrimitive jsonprimitive1 = jsonobject1.getAsJsonPrimitive("value"); + String s = jsonprimitive1 == null ? null : jsonprimitive1.getAsString(); + + if (clickevent$action != null && s != null && clickevent$action.shouldAllowInChat()) + { + chatstyle.chatClickEvent = new ClickEvent(clickevent$action, s); + } + } + } + + if (jsonobject.has("hoverEvent")) + { + JsonObject jsonobject2 = jsonobject.getAsJsonObject("hoverEvent"); + + if (jsonobject2 != null) + { + JsonPrimitive jsonprimitive2 = jsonobject2.getAsJsonPrimitive("action"); + HoverEvent.Action hoverevent$action = jsonprimitive2 == null ? null : HoverEvent.Action.getValueByCanonicalName(jsonprimitive2.getAsString()); + IChatComponent ichatcomponent = (IChatComponent)p_deserialize_3_.deserialize(jsonobject2.get("value"), IChatComponent.class); + + if (hoverevent$action != null && ichatcomponent != null && hoverevent$action.shouldAllowInChat()) + { + chatstyle.chatHoverEvent = new HoverEvent(hoverevent$action, ichatcomponent); + } + } + } + + return chatstyle; + } + } + else + { + return null; + } + } + + public JsonElement serialize(ChatStyle p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) + { + if (p_serialize_1_.isEmpty()) + { + return null; + } + else + { + JsonObject jsonobject = new JsonObject(); + + if (p_serialize_1_.bold != null) + { + jsonobject.addProperty("bold", p_serialize_1_.bold); + } + + if (p_serialize_1_.italic != null) + { + jsonobject.addProperty("italic", p_serialize_1_.italic); + } + + if (p_serialize_1_.underlined != null) + { + jsonobject.addProperty("underlined", p_serialize_1_.underlined); + } + + if (p_serialize_1_.strikethrough != null) + { + jsonobject.addProperty("strikethrough", p_serialize_1_.strikethrough); + } + + if (p_serialize_1_.obfuscated != null) + { + jsonobject.addProperty("obfuscated", p_serialize_1_.obfuscated); + } + + if (p_serialize_1_.color != null) + { + jsonobject.add("color", p_serialize_3_.serialize(p_serialize_1_.color)); + } + + if (p_serialize_1_.insertion != null) + { + jsonobject.add("insertion", p_serialize_3_.serialize(p_serialize_1_.insertion)); + } + + if (p_serialize_1_.chatClickEvent != null) + { + JsonObject jsonobject1 = new JsonObject(); + jsonobject1.addProperty("action", p_serialize_1_.chatClickEvent.getAction().getCanonicalName()); + jsonobject1.addProperty("value", p_serialize_1_.chatClickEvent.getValue()); + jsonobject.add("clickEvent", jsonobject1); + } + + if (p_serialize_1_.chatHoverEvent != null) + { + JsonObject jsonobject2 = new JsonObject(); + jsonobject2.addProperty("action", p_serialize_1_.chatHoverEvent.getAction().getCanonicalName()); + jsonobject2.add("value", p_serialize_3_.serialize(p_serialize_1_.chatHoverEvent.getValue())); + jsonobject.add("hoverEvent", jsonobject2); + } + + return jsonobject; + } + } + } +} diff --git a/src/minecraft/net/minecraft/util/ClassInheritanceMultiMap.java b/src/minecraft/net/minecraft/util/ClassInheritanceMultiMap.java new file mode 100644 index 0000000..9cc95fa --- /dev/null +++ b/src/minecraft/net/minecraft/util/ClassInheritanceMultiMap.java @@ -0,0 +1,148 @@ +package net.minecraft.util; + +import com.google.common.collect.Iterators; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.util.AbstractSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +public class ClassInheritanceMultiMap extends AbstractSet +{ + private static final Set < Class> field_181158_a = Sets. < Class> newHashSet(); + private final Map < Class, List> map = Maps. < Class, List> newHashMap(); + private final Set < Class> knownKeys = Sets. < Class> newIdentityHashSet(); + private final Class baseClass; + private final List field_181745_e = Lists.newArrayList(); + + public ClassInheritanceMultiMap(Class baseClassIn) + { + this.baseClass = baseClassIn; + this.knownKeys.add(baseClassIn); + this.map.put(baseClassIn, this.field_181745_e); + + for (Class oclass : field_181158_a) + { + this.createLookup(oclass); + } + } + + protected void createLookup(Class clazz) + { + field_181158_a.add(clazz); + + for (T t : this.field_181745_e) + { + if (clazz.isAssignableFrom(t.getClass())) + { + this.func_181743_a(t, clazz); + } + } + + this.knownKeys.add(clazz); + } + + protected Class func_181157_b(Class p_181157_1_) + { + if (this.baseClass.isAssignableFrom(p_181157_1_)) + { + if (!this.knownKeys.contains(p_181157_1_)) + { + this.createLookup(p_181157_1_); + } + + return p_181157_1_; + } + else + { + throw new IllegalArgumentException("Don\'t know how to search for " + p_181157_1_); + } + } + + public boolean add(T p_add_1_) + { + for (Class oclass : this.knownKeys) + { + if (oclass.isAssignableFrom(p_add_1_.getClass())) + { + this.func_181743_a(p_add_1_, oclass); + } + } + + return true; + } + + private void func_181743_a(T p_181743_1_, Class p_181743_2_) + { + List list = (List)this.map.get(p_181743_2_); + + if (list == null) + { + this.map.put(p_181743_2_, Lists.newArrayList(p_181743_1_)); + } + else + { + list.add(p_181743_1_); + } + } + + public boolean remove(Object p_remove_1_) + { + T t = (T)p_remove_1_; + boolean flag = false; + + for (Class oclass : this.knownKeys) + { + if (oclass.isAssignableFrom(t.getClass())) + { + List list = (List)this.map.get(oclass); + + if (list != null && list.remove(t)) + { + flag = true; + } + } + } + + return flag; + } + + public boolean contains(Object p_contains_1_) + { + return Iterators.contains(this.getByClass(p_contains_1_.getClass()).iterator(), p_contains_1_); + } + + public Iterable getByClass(final Class clazz) + { + return new Iterable() + { + public Iterator iterator() + { + List list = (List)ClassInheritanceMultiMap.this.map.get(ClassInheritanceMultiMap.this.func_181157_b(clazz)); + + if (list == null) + { + return Iterators.emptyIterator(); + } + else + { + Iterator iterator = list.iterator(); + return Iterators.filter(iterator, clazz); + } + } + }; + } + + public Iterator iterator() + { + return this.field_181745_e.isEmpty() ? Iterators.emptyIterator() : Iterators.unmodifiableIterator(this.field_181745_e.iterator()); + } + + public int size() + { + return this.field_181745_e.size(); + } +} diff --git a/src/minecraft/net/minecraft/util/CombatEntry.java b/src/minecraft/net/minecraft/util/CombatEntry.java new file mode 100644 index 0000000..06473ad --- /dev/null +++ b/src/minecraft/net/minecraft/util/CombatEntry.java @@ -0,0 +1,59 @@ +package net.minecraft.util; + +import net.minecraft.entity.EntityLivingBase; + +public class CombatEntry +{ + private final DamageSource damageSrc; + private final int field_94567_b; + private final float damage; + private final float health; + private final String field_94566_e; + private final float fallDistance; + + public CombatEntry(DamageSource damageSrcIn, int p_i1564_2_, float healthAmount, float damageAmount, String p_i1564_5_, float fallDistanceIn) + { + this.damageSrc = damageSrcIn; + this.field_94567_b = p_i1564_2_; + this.damage = damageAmount; + this.health = healthAmount; + this.field_94566_e = p_i1564_5_; + this.fallDistance = fallDistanceIn; + } + + /** + * Get the DamageSource of the CombatEntry instance. + */ + public DamageSource getDamageSrc() + { + return this.damageSrc; + } + + public float func_94563_c() + { + return this.damage; + } + + /** + * Returns true if {@link net.minecraft.util.DamageSource#getEntity() damage source} is a living entity + */ + public boolean isLivingDamageSrc() + { + return this.damageSrc.getEntity() instanceof EntityLivingBase; + } + + public String func_94562_g() + { + return this.field_94566_e; + } + + public IChatComponent getDamageSrcDisplayName() + { + return this.getDamageSrc().getEntity() == null ? null : this.getDamageSrc().getEntity().getDisplayName(); + } + + public float getDamageAmount() + { + return this.damageSrc == DamageSource.outOfWorld ? Float.MAX_VALUE : this.fallDistance; + } +} diff --git a/src/minecraft/net/minecraft/util/CombatTracker.java b/src/minecraft/net/minecraft/util/CombatTracker.java new file mode 100644 index 0000000..c80054a --- /dev/null +++ b/src/minecraft/net/minecraft/util/CombatTracker.java @@ -0,0 +1,263 @@ +package net.minecraft.util; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; + +public class CombatTracker +{ + private final List combatEntries = Lists.newArrayList(); + + /** The entity tracked. */ + private final EntityLivingBase fighter; + private int field_94555_c; + private int field_152775_d; + private int field_152776_e; + private boolean field_94552_d; + private boolean field_94553_e; + private String field_94551_f; + + public CombatTracker(EntityLivingBase fighterIn) + { + this.fighter = fighterIn; + } + + public void func_94545_a() + { + this.func_94542_g(); + + if (this.fighter.isOnLadder()) + { + Block block = this.fighter.worldObj.getBlockState(new BlockPos(this.fighter.posX, this.fighter.getEntityBoundingBox().minY, this.fighter.posZ)).getBlock(); + + if (block == Blocks.ladder) + { + this.field_94551_f = "ladder"; + } + else if (block == Blocks.vine) + { + this.field_94551_f = "vines"; + } + } + else if (this.fighter.isInWater()) + { + this.field_94551_f = "water"; + } + } + + /** + * Adds an entry for the combat tracker + */ + public void trackDamage(DamageSource damageSrc, float healthIn, float damageAmount) + { + this.reset(); + this.func_94545_a(); + CombatEntry combatentry = new CombatEntry(damageSrc, this.fighter.ticksExisted, healthIn, damageAmount, this.field_94551_f, this.fighter.fallDistance); + this.combatEntries.add(combatentry); + this.field_94555_c = this.fighter.ticksExisted; + this.field_94553_e = true; + + if (combatentry.isLivingDamageSrc() && !this.field_94552_d && this.fighter.isEntityAlive()) + { + this.field_94552_d = true; + this.field_152775_d = this.fighter.ticksExisted; + this.field_152776_e = this.field_152775_d; + this.fighter.sendEnterCombat(); + } + } + + public IChatComponent getDeathMessage() + { + if (this.combatEntries.size() == 0) + { + return new ChatComponentTranslation("death.attack.generic", new Object[] {this.fighter.getDisplayName()}); + } + else + { + CombatEntry combatentry = this.func_94544_f(); + CombatEntry combatentry1 = (CombatEntry)this.combatEntries.get(this.combatEntries.size() - 1); + IChatComponent ichatcomponent1 = combatentry1.getDamageSrcDisplayName(); + Entity entity = combatentry1.getDamageSrc().getEntity(); + IChatComponent ichatcomponent; + + if (combatentry != null && combatentry1.getDamageSrc() == DamageSource.fall) + { + IChatComponent ichatcomponent2 = combatentry.getDamageSrcDisplayName(); + + if (combatentry.getDamageSrc() != DamageSource.fall && combatentry.getDamageSrc() != DamageSource.outOfWorld) + { + if (ichatcomponent2 != null && (ichatcomponent1 == null || !ichatcomponent2.equals(ichatcomponent1))) + { + Entity entity1 = combatentry.getDamageSrc().getEntity(); + ItemStack itemstack1 = entity1 instanceof EntityLivingBase ? ((EntityLivingBase)entity1).getHeldItem() : null; + + if (itemstack1 != null && itemstack1.hasDisplayName()) + { + ichatcomponent = new ChatComponentTranslation("death.fell.assist.item", new Object[] {this.fighter.getDisplayName(), ichatcomponent2, itemstack1.getChatComponent()}); + } + else + { + ichatcomponent = new ChatComponentTranslation("death.fell.assist", new Object[] {this.fighter.getDisplayName(), ichatcomponent2}); + } + } + else if (ichatcomponent1 != null) + { + ItemStack itemstack = entity instanceof EntityLivingBase ? ((EntityLivingBase)entity).getHeldItem() : null; + + if (itemstack != null && itemstack.hasDisplayName()) + { + ichatcomponent = new ChatComponentTranslation("death.fell.finish.item", new Object[] {this.fighter.getDisplayName(), ichatcomponent1, itemstack.getChatComponent()}); + } + else + { + ichatcomponent = new ChatComponentTranslation("death.fell.finish", new Object[] {this.fighter.getDisplayName(), ichatcomponent1}); + } + } + else + { + ichatcomponent = new ChatComponentTranslation("death.fell.killer", new Object[] {this.fighter.getDisplayName()}); + } + } + else + { + ichatcomponent = new ChatComponentTranslation("death.fell.accident." + this.func_94548_b(combatentry), new Object[] {this.fighter.getDisplayName()}); + } + } + else + { + ichatcomponent = combatentry1.getDamageSrc().getDeathMessage(this.fighter); + } + + return ichatcomponent; + } + } + + public EntityLivingBase func_94550_c() + { + EntityLivingBase entitylivingbase = null; + EntityPlayer entityplayer = null; + float f = 0.0F; + float f1 = 0.0F; + + for (CombatEntry combatentry : this.combatEntries) + { + if (combatentry.getDamageSrc().getEntity() instanceof EntityPlayer && (entityplayer == null || combatentry.func_94563_c() > f1)) + { + f1 = combatentry.func_94563_c(); + entityplayer = (EntityPlayer)combatentry.getDamageSrc().getEntity(); + } + + if (combatentry.getDamageSrc().getEntity() instanceof EntityLivingBase && (entitylivingbase == null || combatentry.func_94563_c() > f)) + { + f = combatentry.func_94563_c(); + entitylivingbase = (EntityLivingBase)combatentry.getDamageSrc().getEntity(); + } + } + + if (entityplayer != null && f1 >= f / 3.0F) + { + return entityplayer; + } + else + { + return entitylivingbase; + } + } + + private CombatEntry func_94544_f() + { + CombatEntry combatentry = null; + CombatEntry combatentry1 = null; + int i = 0; + float f = 0.0F; + + for (int j = 0; j < this.combatEntries.size(); ++j) + { + CombatEntry combatentry2 = (CombatEntry)this.combatEntries.get(j); + CombatEntry combatentry3 = j > 0 ? (CombatEntry)this.combatEntries.get(j - 1) : null; + + if ((combatentry2.getDamageSrc() == DamageSource.fall || combatentry2.getDamageSrc() == DamageSource.outOfWorld) && combatentry2.getDamageAmount() > 0.0F && (combatentry == null || combatentry2.getDamageAmount() > f)) + { + if (j > 0) + { + combatentry = combatentry3; + } + else + { + combatentry = combatentry2; + } + + f = combatentry2.getDamageAmount(); + } + + if (combatentry2.func_94562_g() != null && (combatentry1 == null || combatentry2.func_94563_c() > (float)i)) + { + combatentry1 = combatentry2; + } + } + + if (f > 5.0F && combatentry != null) + { + return combatentry; + } + else if (i > 5 && combatentry1 != null) + { + return combatentry1; + } + else + { + return null; + } + } + + private String func_94548_b(CombatEntry p_94548_1_) + { + return p_94548_1_.func_94562_g() == null ? "generic" : p_94548_1_.func_94562_g(); + } + + public int func_180134_f() + { + return this.field_94552_d ? this.fighter.ticksExisted - this.field_152775_d : this.field_152776_e - this.field_152775_d; + } + + private void func_94542_g() + { + this.field_94551_f = null; + } + + /** + * Resets this trackers list of combat entries + */ + public void reset() + { + int i = this.field_94552_d ? 300 : 100; + + if (this.field_94553_e && (!this.fighter.isEntityAlive() || this.fighter.ticksExisted - this.field_94555_c > i)) + { + boolean flag = this.field_94552_d; + this.field_94553_e = false; + this.field_94552_d = false; + this.field_152776_e = this.fighter.ticksExisted; + + if (flag) + { + this.fighter.sendEndCombat(); + } + + this.combatEntries.clear(); + } + } + + /** + * Returns EntityLivingBase assigned for this CombatTracker + */ + public EntityLivingBase getFighter() + { + return this.fighter; + } +} diff --git a/src/minecraft/net/minecraft/util/CryptManager.java b/src/minecraft/net/minecraft/util/CryptManager.java new file mode 100644 index 0000000..6e07ec3 --- /dev/null +++ b/src/minecraft/net/minecraft/util/CryptManager.java @@ -0,0 +1,222 @@ +package net.minecraft.util; + +import java.io.UnsupportedEncodingException; +import java.security.GeneralSecurityException; +import java.security.InvalidKeyException; +import java.security.Key; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.spec.AlgorithmParameterSpec; +import java.security.spec.EncodedKeySpec; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.X509EncodedKeySpec; +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.KeyGenerator; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class CryptManager +{ + private static final Logger LOGGER = LogManager.getLogger(); + + /** + * Generate a new shared secret AES key from a secure random source + */ + public static SecretKey createNewSharedKey() + { + try + { + KeyGenerator keygenerator = KeyGenerator.getInstance("AES"); + keygenerator.init(128); + return keygenerator.generateKey(); + } + catch (NoSuchAlgorithmException nosuchalgorithmexception) + { + throw new Error(nosuchalgorithmexception); + } + } + + /** + * Generates RSA KeyPair + */ + public static KeyPair generateKeyPair() + { + try + { + KeyPairGenerator keypairgenerator = KeyPairGenerator.getInstance("RSA"); + keypairgenerator.initialize(1024); + return keypairgenerator.generateKeyPair(); + } + catch (NoSuchAlgorithmException nosuchalgorithmexception) + { + nosuchalgorithmexception.printStackTrace(); + LOGGER.error("Key pair generation failed!"); + return null; + } + } + + /** + * Compute a serverId hash for use by sendSessionRequest() + */ + public static byte[] getServerIdHash(String serverId, PublicKey publicKey, SecretKey secretKey) + { + try + { + return digestOperation("SHA-1", new byte[][] {serverId.getBytes("ISO_8859_1"), secretKey.getEncoded(), publicKey.getEncoded()}); + } + catch (UnsupportedEncodingException unsupportedencodingexception) + { + unsupportedencodingexception.printStackTrace(); + return null; + } + } + + /** + * Compute a message digest on arbitrary byte[] data + */ + private static byte[] digestOperation(String algorithm, byte[]... data) + { + try + { + MessageDigest messagedigest = MessageDigest.getInstance(algorithm); + + for (byte[] abyte : data) + { + messagedigest.update(abyte); + } + + return messagedigest.digest(); + } + catch (NoSuchAlgorithmException nosuchalgorithmexception) + { + nosuchalgorithmexception.printStackTrace(); + return null; + } + } + + /** + * Create a new PublicKey from encoded X.509 data + */ + public static PublicKey decodePublicKey(byte[] encodedKey) + { + try + { + EncodedKeySpec encodedkeyspec = new X509EncodedKeySpec(encodedKey); + KeyFactory keyfactory = KeyFactory.getInstance("RSA"); + return keyfactory.generatePublic(encodedkeyspec); + } + catch (NoSuchAlgorithmException var3) + { + ; + } + catch (InvalidKeySpecException var4) + { + ; + } + + LOGGER.error("Public key reconstitute failed!"); + return null; + } + + /** + * Decrypt shared secret AES key using RSA private key + */ + public static SecretKey decryptSharedKey(PrivateKey key, byte[] secretKeyEncrypted) + { + return new SecretKeySpec(decryptData(key, secretKeyEncrypted), "AES"); + } + + /** + * Encrypt byte[] data with RSA public key + */ + public static byte[] encryptData(Key key, byte[] data) + { + return cipherOperation(1, key, data); + } + + /** + * Decrypt byte[] data with RSA private key + */ + public static byte[] decryptData(Key key, byte[] data) + { + return cipherOperation(2, key, data); + } + + /** + * Encrypt or decrypt byte[] data using the specified key + */ + private static byte[] cipherOperation(int opMode, Key key, byte[] data) + { + try + { + return createTheCipherInstance(opMode, key.getAlgorithm(), key).doFinal(data); + } + catch (IllegalBlockSizeException illegalblocksizeexception) + { + illegalblocksizeexception.printStackTrace(); + } + catch (BadPaddingException badpaddingexception) + { + badpaddingexception.printStackTrace(); + } + + LOGGER.error("Cipher data failed!"); + return null; + } + + /** + * Creates the Cipher Instance. + */ + private static Cipher createTheCipherInstance(int opMode, String transformation, Key key) + { + try + { + Cipher cipher = Cipher.getInstance(transformation); + cipher.init(opMode, key); + return cipher; + } + catch (InvalidKeyException invalidkeyexception) + { + invalidkeyexception.printStackTrace(); + } + catch (NoSuchAlgorithmException nosuchalgorithmexception) + { + nosuchalgorithmexception.printStackTrace(); + } + catch (NoSuchPaddingException nosuchpaddingexception) + { + nosuchpaddingexception.printStackTrace(); + } + + LOGGER.error("Cipher creation failed!"); + return null; + } + + /** + * Creates an Cipher instance using the AES/CFB8/NoPadding algorithm. Used for protocol encryption. + */ + public static Cipher createNetCipherInstance(int opMode, Key key) + { + try + { + Cipher cipher = Cipher.getInstance("AES/CFB8/NoPadding"); + cipher.init(opMode, (Key)key, (AlgorithmParameterSpec)(new IvParameterSpec(key.getEncoded()))); + return cipher; + } + catch (GeneralSecurityException generalsecurityexception) + { + throw new RuntimeException(generalsecurityexception); + } + } +} diff --git a/src/minecraft/net/minecraft/util/DamageSource.java b/src/minecraft/net/minecraft/util/DamageSource.java new file mode 100644 index 0000000..d913f45 --- /dev/null +++ b/src/minecraft/net/minecraft/util/DamageSource.java @@ -0,0 +1,274 @@ +package net.minecraft.util; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityFireball; +import net.minecraft.world.Explosion; + +public class DamageSource +{ + public static DamageSource inFire = (new DamageSource("inFire")).setFireDamage(); + public static DamageSource lightningBolt = new DamageSource("lightningBolt"); + public static DamageSource onFire = (new DamageSource("onFire")).setDamageBypassesArmor().setFireDamage(); + public static DamageSource lava = (new DamageSource("lava")).setFireDamage(); + public static DamageSource inWall = (new DamageSource("inWall")).setDamageBypassesArmor(); + public static DamageSource drown = (new DamageSource("drown")).setDamageBypassesArmor(); + public static DamageSource starve = (new DamageSource("starve")).setDamageBypassesArmor().setDamageIsAbsolute(); + public static DamageSource cactus = new DamageSource("cactus"); + public static DamageSource fall = (new DamageSource("fall")).setDamageBypassesArmor(); + public static DamageSource outOfWorld = (new DamageSource("outOfWorld")).setDamageBypassesArmor().setDamageAllowedInCreativeMode(); + public static DamageSource generic = (new DamageSource("generic")).setDamageBypassesArmor(); + public static DamageSource magic = (new DamageSource("magic")).setDamageBypassesArmor().setMagicDamage(); + public static DamageSource wither = (new DamageSource("wither")).setDamageBypassesArmor(); + public static DamageSource anvil = new DamageSource("anvil"); + public static DamageSource fallingBlock = new DamageSource("fallingBlock"); + + /** This kind of damage can be blocked or not. */ + private boolean isUnblockable; + private boolean isDamageAllowedInCreativeMode; + + /** + * Whether or not the damage ignores modification by potion effects or enchantments. + */ + private boolean damageIsAbsolute; + private float hungerDamage = 0.3F; + + /** This kind of damage is based on fire or not. */ + private boolean fireDamage; + + /** This kind of damage is based on a projectile or not. */ + private boolean projectile; + + /** + * Whether this damage source will have its damage amount scaled based on the current difficulty. + */ + private boolean difficultyScaled; + + /** Whether the damage is magic based. */ + private boolean magicDamage; + private boolean explosion; + public String damageType; + + public static DamageSource causeMobDamage(EntityLivingBase mob) + { + return new EntityDamageSource("mob", mob); + } + + /** + * returns an EntityDamageSource of type player + */ + public static DamageSource causePlayerDamage(EntityPlayer player) + { + return new EntityDamageSource("player", player); + } + + /** + * returns EntityDamageSourceIndirect of an arrow + */ + public static DamageSource causeArrowDamage(EntityArrow arrow, Entity p_76353_1_) + { + return (new EntityDamageSourceIndirect("arrow", arrow, p_76353_1_)).setProjectile(); + } + + /** + * returns EntityDamageSourceIndirect of a fireball + */ + public static DamageSource causeFireballDamage(EntityFireball fireball, Entity p_76362_1_) + { + return p_76362_1_ == null ? (new EntityDamageSourceIndirect("onFire", fireball, fireball)).setFireDamage().setProjectile() : (new EntityDamageSourceIndirect("fireball", fireball, p_76362_1_)).setFireDamage().setProjectile(); + } + + public static DamageSource causeThrownDamage(Entity p_76356_0_, Entity p_76356_1_) + { + return (new EntityDamageSourceIndirect("thrown", p_76356_0_, p_76356_1_)).setProjectile(); + } + + public static DamageSource causeIndirectMagicDamage(Entity p_76354_0_, Entity p_76354_1_) + { + return (new EntityDamageSourceIndirect("indirectMagic", p_76354_0_, p_76354_1_)).setDamageBypassesArmor().setMagicDamage(); + } + + /** + * Returns the EntityDamageSource of the Thorns enchantment + */ + public static DamageSource causeThornsDamage(Entity p_92087_0_) + { + return (new EntityDamageSource("thorns", p_92087_0_)).setIsThornsDamage().setMagicDamage(); + } + + public static DamageSource setExplosionSource(Explosion explosionIn) + { + return explosionIn != null && explosionIn.getExplosivePlacedBy() != null ? (new EntityDamageSource("explosion.player", explosionIn.getExplosivePlacedBy())).setDifficultyScaled().setExplosion() : (new DamageSource("explosion")).setDifficultyScaled().setExplosion(); + } + + /** + * Returns true if the damage is projectile based. + */ + public boolean isProjectile() + { + return this.projectile; + } + + /** + * Define the damage type as projectile based. + */ + public DamageSource setProjectile() + { + this.projectile = true; + return this; + } + + public boolean isExplosion() + { + return this.explosion; + } + + public DamageSource setExplosion() + { + this.explosion = true; + return this; + } + + public boolean isUnblockable() + { + return this.isUnblockable; + } + + /** + * How much satiate(food) is consumed by this DamageSource + */ + public float getHungerDamage() + { + return this.hungerDamage; + } + + public boolean canHarmInCreative() + { + return this.isDamageAllowedInCreativeMode; + } + + /** + * Whether or not the damage ignores modification by potion effects or enchantments. + */ + public boolean isDamageAbsolute() + { + return this.damageIsAbsolute; + } + + protected DamageSource(String damageTypeIn) + { + this.damageType = damageTypeIn; + } + + public Entity getSourceOfDamage() + { + return this.getEntity(); + } + + public Entity getEntity() + { + return null; + } + + protected DamageSource setDamageBypassesArmor() + { + this.isUnblockable = true; + this.hungerDamage = 0.0F; + return this; + } + + protected DamageSource setDamageAllowedInCreativeMode() + { + this.isDamageAllowedInCreativeMode = true; + return this; + } + + /** + * Sets a value indicating whether the damage is absolute (ignores modification by potion effects or enchantments), + * and also clears out hunger damage. + */ + protected DamageSource setDamageIsAbsolute() + { + this.damageIsAbsolute = true; + this.hungerDamage = 0.0F; + return this; + } + + /** + * Define the damage type as fire based. + */ + protected DamageSource setFireDamage() + { + this.fireDamage = true; + return this; + } + + /** + * Gets the death message that is displayed when the player dies + */ + public IChatComponent getDeathMessage(EntityLivingBase p_151519_1_) + { + EntityLivingBase entitylivingbase = p_151519_1_.func_94060_bK(); + String s = "death.attack." + this.damageType; + String s1 = s + ".player"; + return entitylivingbase != null && StatCollector.canTranslate(s1) ? new ChatComponentTranslation(s1, new Object[] {p_151519_1_.getDisplayName(), entitylivingbase.getDisplayName()}): new ChatComponentTranslation(s, new Object[] {p_151519_1_.getDisplayName()}); + } + + /** + * Returns true if the damage is fire based. + */ + public boolean isFireDamage() + { + return this.fireDamage; + } + + /** + * Return the name of damage type. + */ + public String getDamageType() + { + return this.damageType; + } + + /** + * Set whether this damage source will have its damage amount scaled based on the current difficulty. + */ + public DamageSource setDifficultyScaled() + { + this.difficultyScaled = true; + return this; + } + + /** + * Return whether this damage source will have its damage amount scaled based on the current difficulty. + */ + public boolean isDifficultyScaled() + { + return this.difficultyScaled; + } + + /** + * Returns true if the damage is magic based. + */ + public boolean isMagicDamage() + { + return this.magicDamage; + } + + /** + * Define the damage type as magic based. + */ + public DamageSource setMagicDamage() + { + this.magicDamage = true; + return this; + } + + public boolean isCreativePlayer() + { + Entity entity = this.getEntity(); + return entity instanceof EntityPlayer && ((EntityPlayer)entity).capabilities.isCreativeMode; + } +} diff --git a/src/minecraft/net/minecraft/util/EnchantmentNameParts.java b/src/minecraft/net/minecraft/util/EnchantmentNameParts.java new file mode 100644 index 0000000..ca0a990 --- /dev/null +++ b/src/minecraft/net/minecraft/util/EnchantmentNameParts.java @@ -0,0 +1,44 @@ +package net.minecraft.util; + +import java.util.Random; + +public class EnchantmentNameParts +{ + private static final EnchantmentNameParts instance = new EnchantmentNameParts(); + private Random rand = new Random(); + private String[] namePartsArray = "the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale ".split(" "); + + public static EnchantmentNameParts getInstance() + { + return instance; + } + + /** + * Randomly generates a new name built up of 3 or 4 randomly selected words. + */ + public String generateNewRandomName() + { + int i = this.rand.nextInt(2) + 3; + String s = ""; + + for (int j = 0; j < i; ++j) + { + if (j > 0) + { + s = s + " "; + } + + s = s + this.namePartsArray[this.rand.nextInt(this.namePartsArray.length)]; + } + + return s; + } + + /** + * Resets the underlying random number generator using a given seed. + */ + public void reseedRandomGenerator(long seed) + { + this.rand.setSeed(seed); + } +} diff --git a/src/minecraft/net/minecraft/util/EntityDamageSource.java b/src/minecraft/net/minecraft/util/EntityDamageSource.java new file mode 100644 index 0000000..690b179 --- /dev/null +++ b/src/minecraft/net/minecraft/util/EntityDamageSource.java @@ -0,0 +1,60 @@ +package net.minecraft.util; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +public class EntityDamageSource extends DamageSource +{ + protected Entity damageSourceEntity; + + /** + * Whether this EntityDamageSource is from an entity wearing Thorns-enchanted armor. + */ + private boolean isThornsDamage = false; + + public EntityDamageSource(String p_i1567_1_, Entity damageSourceEntityIn) + { + super(p_i1567_1_); + this.damageSourceEntity = damageSourceEntityIn; + } + + /** + * Sets this EntityDamageSource as originating from Thorns armor + */ + public EntityDamageSource setIsThornsDamage() + { + this.isThornsDamage = true; + return this; + } + + public boolean getIsThornsDamage() + { + return this.isThornsDamage; + } + + public Entity getEntity() + { + return this.damageSourceEntity; + } + + /** + * Gets the death message that is displayed when the player dies + */ + public IChatComponent getDeathMessage(EntityLivingBase p_151519_1_) + { + ItemStack itemstack = this.damageSourceEntity instanceof EntityLivingBase ? ((EntityLivingBase)this.damageSourceEntity).getHeldItem() : null; + String s = "death.attack." + this.damageType; + String s1 = s + ".item"; + return itemstack != null && itemstack.hasDisplayName() && StatCollector.canTranslate(s1) ? new ChatComponentTranslation(s1, new Object[] {p_151519_1_.getDisplayName(), this.damageSourceEntity.getDisplayName(), itemstack.getChatComponent()}): new ChatComponentTranslation(s, new Object[] {p_151519_1_.getDisplayName(), this.damageSourceEntity.getDisplayName()}); + } + + /** + * Return whether this damage source will have its damage amount scaled based on the current difficulty. + */ + public boolean isDifficultyScaled() + { + return this.damageSourceEntity != null && this.damageSourceEntity instanceof EntityLivingBase && !(this.damageSourceEntity instanceof EntityPlayer); + } +} diff --git a/src/minecraft/net/minecraft/util/EntityDamageSourceIndirect.java b/src/minecraft/net/minecraft/util/EntityDamageSourceIndirect.java new file mode 100644 index 0000000..58d8a99 --- /dev/null +++ b/src/minecraft/net/minecraft/util/EntityDamageSourceIndirect.java @@ -0,0 +1,38 @@ +package net.minecraft.util; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; + +public class EntityDamageSourceIndirect extends EntityDamageSource +{ + private Entity indirectEntity; + + public EntityDamageSourceIndirect(String p_i1568_1_, Entity p_i1568_2_, Entity indirectEntityIn) + { + super(p_i1568_1_, p_i1568_2_); + this.indirectEntity = indirectEntityIn; + } + + public Entity getSourceOfDamage() + { + return this.damageSourceEntity; + } + + public Entity getEntity() + { + return this.indirectEntity; + } + + /** + * Gets the death message that is displayed when the player dies + */ + public IChatComponent getDeathMessage(EntityLivingBase p_151519_1_) + { + IChatComponent ichatcomponent = this.indirectEntity == null ? this.damageSourceEntity.getDisplayName() : this.indirectEntity.getDisplayName(); + ItemStack itemstack = this.indirectEntity instanceof EntityLivingBase ? ((EntityLivingBase)this.indirectEntity).getHeldItem() : null; + String s = "death.attack." + this.damageType; + String s1 = s + ".item"; + return itemstack != null && itemstack.hasDisplayName() && StatCollector.canTranslate(s1) ? new ChatComponentTranslation(s1, new Object[] {p_151519_1_.getDisplayName(), ichatcomponent, itemstack.getChatComponent()}): new ChatComponentTranslation(s, new Object[] {p_151519_1_.getDisplayName(), ichatcomponent}); + } +} diff --git a/src/minecraft/net/minecraft/util/EntitySelectors.java b/src/minecraft/net/minecraft/util/EntitySelectors.java new file mode 100644 index 0000000..74b48cd --- /dev/null +++ b/src/minecraft/net/minecraft/util/EntitySelectors.java @@ -0,0 +1,69 @@ +package net.minecraft.util; + +import com.google.common.base.Predicate; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +public final class EntitySelectors +{ + public static final Predicate selectAnything = new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_.isEntityAlive(); + } + }; + public static final Predicate IS_STANDALONE = new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_.isEntityAlive() && p_apply_1_.riddenByEntity == null && p_apply_1_.ridingEntity == null; + } + }; + public static final Predicate selectInventories = new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return p_apply_1_ instanceof IInventory && p_apply_1_.isEntityAlive(); + } + }; + public static final Predicate NOT_SPECTATING = new Predicate() + { + public boolean apply(Entity p_apply_1_) + { + return !(p_apply_1_ instanceof EntityPlayer) || !((EntityPlayer)p_apply_1_).isSpectator(); + } + }; + + public static class ArmoredMob implements Predicate + { + private final ItemStack armor; + + public ArmoredMob(ItemStack armor) + { + this.armor = armor; + } + + public boolean apply(Entity p_apply_1_) + { + if (!p_apply_1_.isEntityAlive()) + { + return false; + } + else if (!(p_apply_1_ instanceof EntityLivingBase)) + { + return false; + } + else + { + EntityLivingBase entitylivingbase = (EntityLivingBase)p_apply_1_; + return entitylivingbase.getEquipmentInSlot(EntityLiving.getArmorPosition(this.armor)) != null ? false : (entitylivingbase instanceof EntityLiving ? ((EntityLiving)entitylivingbase).canPickUpLoot() : (entitylivingbase instanceof EntityArmorStand ? true : entitylivingbase instanceof EntityPlayer)); + } + } + } +} diff --git a/src/minecraft/net/minecraft/util/EnumChatFormatting.java b/src/minecraft/net/minecraft/util/EnumChatFormatting.java new file mode 100644 index 0000000..372b57f --- /dev/null +++ b/src/minecraft/net/minecraft/util/EnumChatFormatting.java @@ -0,0 +1,177 @@ +package net.minecraft.util; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; + +public enum EnumChatFormatting +{ + BLACK("BLACK", '0', 0), + DARK_BLUE("DARK_BLUE", '1', 1), + DARK_GREEN("DARK_GREEN", '2', 2), + DARK_AQUA("DARK_AQUA", '3', 3), + DARK_RED("DARK_RED", '4', 4), + DARK_PURPLE("DARK_PURPLE", '5', 5), + GOLD("GOLD", '6', 6), + GRAY("GRAY", '7', 7), + DARK_GRAY("DARK_GRAY", '8', 8), + BLUE("BLUE", '9', 9), + GREEN("GREEN", 'a', 10), + AQUA("AQUA", 'b', 11), + RED("RED", 'c', 12), + LIGHT_PURPLE("LIGHT_PURPLE", 'd', 13), + YELLOW("YELLOW", 'e', 14), + WHITE("WHITE", 'f', 15), + OBFUSCATED("OBFUSCATED", 'k', true), + BOLD("BOLD", 'l', true), + STRIKETHROUGH("STRIKETHROUGH", 'm', true), + UNDERLINE("UNDERLINE", 'n', true), + ITALIC("ITALIC", 'o', true), + RESET("RESET", 'r', -1); + + private static final Map nameMapping = Maps.newHashMap(); + + /** + * Matches formatting codes that indicate that the client should treat the following text as bold, recolored, + * obfuscated, etc. + */ + private static final Pattern formattingCodePattern = Pattern.compile("(?i)" + String.valueOf('\u00a7') + "[0-9A-FK-OR]"); + + /** The name of this color/formatting */ + private final String name; + + /** The formatting code that produces this format. */ + private final char formattingCode; + private final boolean fancyStyling; + + /** + * The control string (section sign + formatting code) that can be inserted into client-side text to display + * subsequent text in this format. + */ + private final String controlString; + + /** The numerical index that represents this color */ + private final int colorIndex; + + private static String func_175745_c(String p_175745_0_) + { + return p_175745_0_.toLowerCase().replaceAll("[^a-z]", ""); + } + + private EnumChatFormatting(String formattingName, char formattingCodeIn, int colorIndex) + { + this(formattingName, formattingCodeIn, false, colorIndex); + } + + private EnumChatFormatting(String formattingName, char formattingCodeIn, boolean fancyStylingIn) + { + this(formattingName, formattingCodeIn, fancyStylingIn, -1); + } + + private EnumChatFormatting(String formattingName, char formattingCodeIn, boolean fancyStylingIn, int colorIndex) + { + this.name = formattingName; + this.formattingCode = formattingCodeIn; + this.fancyStyling = fancyStylingIn; + this.colorIndex = colorIndex; + this.controlString = "\u00a7" + formattingCodeIn; + } + + /** + * Returns the numerical color index that represents this formatting + */ + public int getColorIndex() + { + return this.colorIndex; + } + + /** + * False if this is just changing the color or resetting; true otherwise. + */ + public boolean isFancyStyling() + { + return this.fancyStyling; + } + + /** + * Checks if this is a color code. + */ + public boolean isColor() + { + return !this.fancyStyling && this != RESET; + } + + /** + * Gets the friendly name of this value. + */ + public String getFriendlyName() + { + return this.name().toLowerCase(); + } + + public String toString() + { + return this.controlString; + } + + /** + * Returns a copy of the given string, with formatting codes stripped away. + */ + public static String getTextWithoutFormattingCodes(String text) + { + return text == null ? null : formattingCodePattern.matcher(text).replaceAll(""); + } + + /** + * Gets a value by its friendly name; null if the given name does not map to a defined value. + */ + public static EnumChatFormatting getValueByName(String friendlyName) + { + return friendlyName == null ? null : (EnumChatFormatting)nameMapping.get(func_175745_c(friendlyName)); + } + + public static EnumChatFormatting func_175744_a(int p_175744_0_) + { + if (p_175744_0_ < 0) + { + return RESET; + } + else + { + for (EnumChatFormatting enumchatformatting : values()) + { + if (enumchatformatting.getColorIndex() == p_175744_0_) + { + return enumchatformatting; + } + } + + return null; + } + } + + public static Collection getValidValues(boolean p_96296_0_, boolean p_96296_1_) + { + List list = Lists.newArrayList(); + + for (EnumChatFormatting enumchatformatting : values()) + { + if ((!enumchatformatting.isColor() || p_96296_0_) && (!enumchatformatting.isFancyStyling() || p_96296_1_)) + { + list.add(enumchatformatting.getFriendlyName()); + } + } + + return list; + } + + static { + for (EnumChatFormatting enumchatformatting : values()) + { + nameMapping.put(func_175745_c(enumchatformatting.name), enumchatformatting); + } + } +} diff --git a/src/minecraft/net/minecraft/util/EnumFacing.java b/src/minecraft/net/minecraft/util/EnumFacing.java new file mode 100644 index 0000000..f037fb8 --- /dev/null +++ b/src/minecraft/net/minecraft/util/EnumFacing.java @@ -0,0 +1,602 @@ +package net.minecraft.util; + +import com.google.common.base.Predicate; +import com.google.common.collect.Iterators; +import com.google.common.collect.Maps; +import java.util.Iterator; +import java.util.Map; +import java.util.Random; + +public enum EnumFacing implements IStringSerializable +{ + DOWN("DOWN", 0, 0, 1, -1, "down", EnumFacing.AxisDirection.NEGATIVE, EnumFacing.Axis.Y, new Vec3i(0, -1, 0)), + UP("UP", 1, 1, 0, -1, "up", EnumFacing.AxisDirection.POSITIVE, EnumFacing.Axis.Y, new Vec3i(0, 1, 0)), + NORTH("NORTH", 2, 2, 3, 2, "north", EnumFacing.AxisDirection.NEGATIVE, EnumFacing.Axis.Z, new Vec3i(0, 0, -1)), + SOUTH("SOUTH", 3, 3, 2, 0, "south", EnumFacing.AxisDirection.POSITIVE, EnumFacing.Axis.Z, new Vec3i(0, 0, 1)), + WEST("WEST", 4, 4, 5, 1, "west", EnumFacing.AxisDirection.NEGATIVE, EnumFacing.Axis.X, new Vec3i(-1, 0, 0)), + EAST("EAST", 5, 5, 4, 3, "east", EnumFacing.AxisDirection.POSITIVE, EnumFacing.Axis.X, new Vec3i(1, 0, 0)); + + /** Ordering index for D-U-N-S-W-E */ + private final int index; + + /** Index of the opposite Facing in the VALUES array */ + private final int opposite; + + /** Ordering index for the HORIZONTALS field (S-W-N-E) */ + private final int horizontalIndex; + private final String name; + private final EnumFacing.Axis axis; + private final EnumFacing.AxisDirection axisDirection; + + /** Normalized Vector that points in the direction of this Facing */ + private final Vec3i directionVec; + + /** All facings in D-U-N-S-W-E order */ + public static final EnumFacing[] VALUES = new EnumFacing[6]; + + /** All Facings with horizontal axis in order S-W-N-E */ + private static final EnumFacing[] HORIZONTALS = new EnumFacing[4]; + private static final Map NAME_LOOKUP = Maps.newHashMap(); + private static final EnumFacing[] $VALUES = new EnumFacing[]{DOWN, UP, NORTH, SOUTH, WEST, EAST}; + private static final String __OBFID = "CL_00001201"; + + private EnumFacing(String p_i17_3_, int p_i17_4_, int p_i17_5_, int p_i17_6_, int p_i17_7_, String p_i17_8_, EnumFacing.AxisDirection p_i17_9_, EnumFacing.Axis p_i17_10_, Vec3i p_i17_11_) + { + this.index = p_i17_5_; + this.horizontalIndex = p_i17_7_; + this.opposite = p_i17_6_; + this.name = p_i17_8_; + this.axis = p_i17_10_; + this.axisDirection = p_i17_9_; + this.directionVec = p_i17_11_; + } + + /** + * Get the Index of this Facing (0-5). The order is D-U-N-S-W-E + */ + public int getIndex() + { + return this.index; + } + + /** + * Get the index of this horizontal facing (0-3). The order is S-W-N-E + */ + public int getHorizontalIndex() + { + return this.horizontalIndex; + } + + /** + * Get the AxisDirection of this Facing. + */ + public EnumFacing.AxisDirection getAxisDirection() + { + return this.axisDirection; + } + + /** + * Get the opposite Facing (e.g. DOWN => UP) + */ + public EnumFacing getOpposite() + { + return VALUES[this.opposite]; + } + + /** + * Rotate this Facing around the given axis clockwise. If this facing cannot be rotated around the given axis, + * returns this facing without rotating. + */ + public EnumFacing rotateAround(EnumFacing.Axis axis) + { + switch (EnumFacing.EnumFacing$1.field_179515_a[axis.ordinal()]) + { + case 1: + if (this != WEST && this != EAST) + { + return this.rotateX(); + } + + return this; + + case 2: + if (this != UP && this != DOWN) + { + return this.rotateY(); + } + + return this; + + case 3: + if (this != NORTH && this != SOUTH) + { + return this.rotateZ(); + } + + return this; + + default: + throw new IllegalStateException("Unable to get CW facing for axis " + axis); + } + } + + /** + * Rotate this Facing around the Y axis clockwise (NORTH => EAST => SOUTH => WEST => NORTH) + */ + public EnumFacing rotateY() + { + switch (EnumFacing.EnumFacing$1.field_179513_b[this.ordinal()]) + { + case 1: + return EAST; + + case 2: + return SOUTH; + + case 3: + return WEST; + + case 4: + return NORTH; + + default: + throw new IllegalStateException("Unable to get Y-rotated facing of " + this); + } + } + + /** + * Rotate this Facing around the X axis (NORTH => DOWN => SOUTH => UP => NORTH) + */ + private EnumFacing rotateX() + { + switch (EnumFacing.EnumFacing$1.field_179513_b[this.ordinal()]) + { + case 1: + return DOWN; + + case 2: + case 4: + default: + throw new IllegalStateException("Unable to get X-rotated facing of " + this); + + case 3: + return UP; + + case 5: + return NORTH; + + case 6: + return SOUTH; + } + } + + /** + * Rotate this Facing around the Z axis (EAST => DOWN => WEST => UP => EAST) + */ + private EnumFacing rotateZ() + { + switch (EnumFacing.EnumFacing$1.field_179513_b[this.ordinal()]) + { + case 2: + return DOWN; + + case 3: + default: + throw new IllegalStateException("Unable to get Z-rotated facing of " + this); + + case 4: + return UP; + + case 5: + return EAST; + + case 6: + return WEST; + } + } + + /** + * Rotate this Facing around the Y axis counter-clockwise (NORTH => WEST => SOUTH => EAST => NORTH) + */ + public EnumFacing rotateYCCW() + { + switch (EnumFacing.EnumFacing$1.field_179513_b[this.ordinal()]) + { + case 1: + return WEST; + + case 2: + return NORTH; + + case 3: + return EAST; + + case 4: + return SOUTH; + + default: + throw new IllegalStateException("Unable to get CCW facing of " + this); + } + } + + /** + * Returns a offset that addresses the block in front of this facing. + */ + public int getFrontOffsetX() + { + return this.axis == EnumFacing.Axis.X ? this.axisDirection.getOffset() : 0; + } + + public int getFrontOffsetY() + { + return this.axis == EnumFacing.Axis.Y ? this.axisDirection.getOffset() : 0; + } + + /** + * Returns a offset that addresses the block in front of this facing. + */ + public int getFrontOffsetZ() + { + return this.axis == EnumFacing.Axis.Z ? this.axisDirection.getOffset() : 0; + } + + /** + * Same as getName, but does not override the method from Enum. + */ + public String getName2() + { + return this.name; + } + + public EnumFacing.Axis getAxis() + { + return this.axis; + } + + /** + * Get the facing specified by the given name + */ + public static EnumFacing byName(String name) + { + return name == null ? null : (EnumFacing)NAME_LOOKUP.get(name.toLowerCase()); + } + + /** + * Get a Facing by it's index (0-5). The order is D-U-N-S-W-E. Named getFront for legacy reasons. + */ + public static EnumFacing getFront(int index) + { + return VALUES[MathHelper.abs_int(index % VALUES.length)]; + } + + /** + * Get a Facing by it's horizontal index (0-3). The order is S-W-N-E. + */ + public static EnumFacing getHorizontal(int p_176731_0_) + { + return HORIZONTALS[MathHelper.abs_int(p_176731_0_ % HORIZONTALS.length)]; + } + + /** + * Get the Facing corresponding to the given angle (0-360). An angle of 0 is SOUTH, an angle of 90 would be WEST. + */ + public static EnumFacing fromAngle(double angle) + { + return getHorizontal(MathHelper.floor_double(angle / 90.0D + 0.5D) & 3); + } + + /** + * Choose a random Facing using the given Random + */ + public static EnumFacing random(Random rand) + { + return values()[rand.nextInt(values().length)]; + } + + public static EnumFacing getFacingFromVector(float p_176737_0_, float p_176737_1_, float p_176737_2_) + { + EnumFacing enumfacing = NORTH; + float f = Float.MIN_VALUE; + + for (EnumFacing enumfacing1 : values()) + { + float f1 = p_176737_0_ * (float)enumfacing1.directionVec.getX() + p_176737_1_ * (float)enumfacing1.directionVec.getY() + p_176737_2_ * (float)enumfacing1.directionVec.getZ(); + + if (f1 > f) + { + f = f1; + enumfacing = enumfacing1; + } + } + + return enumfacing; + } + + public String toString() + { + return this.name; + } + + public String getName() + { + return this.name; + } + + public static EnumFacing func_181076_a(EnumFacing.AxisDirection p_181076_0_, EnumFacing.Axis p_181076_1_) + { + for (EnumFacing enumfacing : values()) + { + if (enumfacing.getAxisDirection() == p_181076_0_ && enumfacing.getAxis() == p_181076_1_) + { + return enumfacing; + } + } + + throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_); + } + + /** + * Get a normalized Vector that points in the direction of this Facing. + */ + public Vec3i getDirectionVec() + { + return this.directionVec; + } + + static { + for (EnumFacing enumfacing : values()) + { + VALUES[enumfacing.index] = enumfacing; + + if (enumfacing.getAxis().isHorizontal()) + { + HORIZONTALS[enumfacing.horizontalIndex] = enumfacing; + } + + NAME_LOOKUP.put(enumfacing.getName2().toLowerCase(), enumfacing); + } + } + + static final class EnumFacing$1 { + static final int[] field_179515_a; + static final int[] field_179513_b; + static final int[] field_179514_c = new int[EnumFacing.Plane.values().length]; + private static final String __OBFID = "CL_00002322"; + + static { + try { + field_179514_c[EnumFacing.Plane.HORIZONTAL.ordinal()] = 1; + } + catch (NoSuchFieldError var11) + { + ; + } + + try { + field_179514_c[EnumFacing.Plane.VERTICAL.ordinal()] = 2; + } + catch (NoSuchFieldError var10) + { + ; + } + + field_179513_b = new int[EnumFacing.values().length]; + + try { + field_179513_b[EnumFacing.NORTH.ordinal()] = 1; + } + catch (NoSuchFieldError var9) + { + ; + } + + try { + field_179513_b[EnumFacing.EAST.ordinal()] = 2; + } + catch (NoSuchFieldError var8) + { + ; + } + + try { + field_179513_b[EnumFacing.SOUTH.ordinal()] = 3; + } + catch (NoSuchFieldError var7) + { + ; + } + + try { + field_179513_b[EnumFacing.WEST.ordinal()] = 4; + } + catch (NoSuchFieldError var6) + { + ; + } + + try { + field_179513_b[EnumFacing.UP.ordinal()] = 5; + } + catch (NoSuchFieldError var5) + { + ; + } + + try { + field_179513_b[EnumFacing.DOWN.ordinal()] = 6; + } + catch (NoSuchFieldError var4) + { + ; + } + + field_179515_a = new int[EnumFacing.Axis.values().length]; + + try { + field_179515_a[EnumFacing.Axis.X.ordinal()] = 1; + } + catch (NoSuchFieldError var3) + { + ; + } + + try { + field_179515_a[EnumFacing.Axis.Y.ordinal()] = 2; + } + catch (NoSuchFieldError var2) + { + ; + } + + try { + field_179515_a[EnumFacing.Axis.Z.ordinal()] = 3; + } + catch (NoSuchFieldError var1) + { + ; + } + } + } + + public static enum Axis implements Predicate, IStringSerializable { + X("X", 0, "x", EnumFacing.Plane.HORIZONTAL), + Y("Y", 1, "y", EnumFacing.Plane.VERTICAL), + Z("Z", 2, "z", EnumFacing.Plane.HORIZONTAL); + + private static final Map NAME_LOOKUP = Maps.newHashMap(); + private final String name; + private final EnumFacing.Plane plane; + private static final EnumFacing.Axis[] $VALUES = new EnumFacing.Axis[]{X, Y, Z}; + private static final String __OBFID = "CL_00002321"; + + private Axis(String p_i14_3_, int p_i14_4_, String p_i14_5_, EnumFacing.Plane p_i14_6_) + { + this.name = p_i14_5_; + this.plane = p_i14_6_; + } + + public static EnumFacing.Axis byName(String name) + { + return name == null ? null : (EnumFacing.Axis)NAME_LOOKUP.get(name.toLowerCase()); + } + + public String getName2() + { + return this.name; + } + + public boolean isVertical() + { + return this.plane == EnumFacing.Plane.VERTICAL; + } + + public boolean isHorizontal() + { + return this.plane == EnumFacing.Plane.HORIZONTAL; + } + + public String toString() + { + return this.name; + } + + public boolean apply(EnumFacing p_apply_1_) + { + return p_apply_1_ != null && p_apply_1_.getAxis() == this; + } + + public EnumFacing.Plane getPlane() + { + return this.plane; + } + + public String getName() + { + return this.name; + } + + public boolean apply(Object p_apply_1_) + { + return this.apply((EnumFacing)p_apply_1_); + } + + static { + for (EnumFacing.Axis enumfacing$axis : values()) + { + NAME_LOOKUP.put(enumfacing$axis.getName2().toLowerCase(), enumfacing$axis); + } + } + } + + public static enum AxisDirection { + POSITIVE("POSITIVE", 0, 1, "Towards positive"), + NEGATIVE("NEGATIVE", 1, -1, "Towards negative"); + + private final int offset; + private final String description; + private static final EnumFacing.AxisDirection[] $VALUES = new EnumFacing.AxisDirection[]{POSITIVE, NEGATIVE}; + private static final String __OBFID = "CL_00002320"; + + private AxisDirection(String p_i15_3_, int p_i15_4_, int p_i15_5_, String p_i15_6_) + { + this.offset = p_i15_5_; + this.description = p_i15_6_; + } + + public int getOffset() + { + return this.offset; + } + + public String toString() + { + return this.description; + } + } + + public static enum Plane implements Predicate, Iterable { + HORIZONTAL("HORIZONTAL", 0), + VERTICAL("VERTICAL", 1); + + private static final EnumFacing.Plane[] $VALUES = new EnumFacing.Plane[]{HORIZONTAL, VERTICAL}; + private static final String __OBFID = "CL_00002319"; + + private Plane(String p_i16_3_, int p_i16_4_) + { + } + + public EnumFacing[] facings() + { + switch (EnumFacing.EnumFacing$1.field_179514_c[this.ordinal()]) + { + case 1: + return new EnumFacing[] {EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST}; + case 2: + return new EnumFacing[] {EnumFacing.UP, EnumFacing.DOWN}; + default: + throw new Error("Someone\'s been tampering with the universe!"); + } + } + + public EnumFacing random(Random rand) + { + EnumFacing[] aenumfacing = this.facings(); + return aenumfacing[rand.nextInt(aenumfacing.length)]; + } + + public boolean apply(EnumFacing p_apply_1_) + { + return p_apply_1_ != null && p_apply_1_.getAxis().getPlane() == this; + } + + public Iterator iterator() + { + return Iterators.forArray(this.facings()); + } + + public boolean apply(Object p_apply_1_) + { + return this.apply((EnumFacing)p_apply_1_); + } + } +} diff --git a/src/minecraft/net/minecraft/util/EnumParticleTypes.java b/src/minecraft/net/minecraft/util/EnumParticleTypes.java new file mode 100644 index 0000000..a27c57c --- /dev/null +++ b/src/minecraft/net/minecraft/util/EnumParticleTypes.java @@ -0,0 +1,126 @@ +package net.minecraft.util; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; + +public enum EnumParticleTypes +{ + EXPLOSION_NORMAL("explode", 0, true), + EXPLOSION_LARGE("largeexplode", 1, true), + EXPLOSION_HUGE("hugeexplosion", 2, true), + FIREWORKS_SPARK("fireworksSpark", 3, false), + WATER_BUBBLE("bubble", 4, false), + WATER_SPLASH("splash", 5, false), + WATER_WAKE("wake", 6, false), + SUSPENDED("suspended", 7, false), + SUSPENDED_DEPTH("depthsuspend", 8, false), + CRIT("crit", 9, false), + CRIT_MAGIC("magicCrit", 10, false), + SMOKE_NORMAL("smoke", 11, false), + SMOKE_LARGE("largesmoke", 12, false), + SPELL("spell", 13, false), + SPELL_INSTANT("instantSpell", 14, false), + SPELL_MOB("mobSpell", 15, false), + SPELL_MOB_AMBIENT("mobSpellAmbient", 16, false), + SPELL_WITCH("witchMagic", 17, false), + DRIP_WATER("dripWater", 18, false), + DRIP_LAVA("dripLava", 19, false), + VILLAGER_ANGRY("angryVillager", 20, false), + VILLAGER_HAPPY("happyVillager", 21, false), + TOWN_AURA("townaura", 22, false), + NOTE("note", 23, false), + PORTAL("portal", 24, false), + ENCHANTMENT_TABLE("enchantmenttable", 25, false), + FLAME("flame", 26, false), + LAVA("lava", 27, false), + FOOTSTEP("footstep", 28, false), + CLOUD("cloud", 29, false), + REDSTONE("reddust", 30, false), + SNOWBALL("snowballpoof", 31, false), + SNOW_SHOVEL("snowshovel", 32, false), + SLIME("slime", 33, false), + HEART("heart", 34, false), + BARRIER("barrier", 35, false), + ITEM_CRACK("iconcrack_", 36, false, 2), + BLOCK_CRACK("blockcrack_", 37, false, 1), + BLOCK_DUST("blockdust_", 38, false, 1), + WATER_DROP("droplet", 39, false), + ITEM_TAKE("take", 40, false), + MOB_APPEARANCE("mobappearance", 41, true); + + private final String particleName; + private final int particleID; + private final boolean shouldIgnoreRange; + private final int argumentCount; + private static final Map PARTICLES = Maps.newHashMap(); + private static final String[] PARTICLE_NAMES; + + private EnumParticleTypes(String particleNameIn, int particleIDIn, boolean p_i46011_5_, int argumentCountIn) + { + this.particleName = particleNameIn; + this.particleID = particleIDIn; + this.shouldIgnoreRange = p_i46011_5_; + this.argumentCount = argumentCountIn; + } + + private EnumParticleTypes(String particleNameIn, int particleIDIn, boolean p_i46012_5_) + { + this(particleNameIn, particleIDIn, p_i46012_5_, 0); + } + + public static String[] getParticleNames() + { + return PARTICLE_NAMES; + } + + public String getParticleName() + { + return this.particleName; + } + + public int getParticleID() + { + return this.particleID; + } + + public int getArgumentCount() + { + return this.argumentCount; + } + + public boolean getShouldIgnoreRange() + { + return this.shouldIgnoreRange; + } + + public boolean hasArguments() + { + return this.argumentCount > 0; + } + + /** + * Gets the relative EnumParticleTypes by id. + */ + public static EnumParticleTypes getParticleFromId(int particleId) + { + return (EnumParticleTypes)PARTICLES.get(Integer.valueOf(particleId)); + } + + static { + List list = Lists.newArrayList(); + + for (EnumParticleTypes enumparticletypes : values()) + { + PARTICLES.put(Integer.valueOf(enumparticletypes.getParticleID()), enumparticletypes); + + if (!enumparticletypes.getParticleName().endsWith("_")) + { + list.add(enumparticletypes.getParticleName()); + } + } + + PARTICLE_NAMES = (String[])list.toArray(new String[list.size()]); + } +} diff --git a/src/minecraft/net/minecraft/util/EnumTypeAdapterFactory.java b/src/minecraft/net/minecraft/util/EnumTypeAdapterFactory.java new file mode 100644 index 0000000..5276922 --- /dev/null +++ b/src/minecraft/net/minecraft/util/EnumTypeAdapterFactory.java @@ -0,0 +1,67 @@ +package net.minecraft.util; + +import com.google.common.collect.Maps; +import com.google.gson.Gson; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonToken; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Locale; +import java.util.Map; + +public class EnumTypeAdapterFactory implements TypeAdapterFactory +{ + public TypeAdapter create(Gson p_create_1_, TypeToken p_create_2_) + { + Class oclass = (Class)p_create_2_.getRawType(); + + if (!oclass.isEnum()) + { + return null; + } + else + { + final Map map = Maps.newHashMap(); + + for (T t : oclass.getEnumConstants()) + { + map.put(this.func_151232_a(t), t); + } + + return new TypeAdapter() + { + public void write(JsonWriter p_write_1_, T p_write_2_) throws IOException + { + if (p_write_2_ == null) + { + p_write_1_.nullValue(); + } + else + { + p_write_1_.value(EnumTypeAdapterFactory.this.func_151232_a(p_write_2_)); + } + } + public T read(JsonReader p_read_1_) throws IOException + { + if (p_read_1_.peek() == JsonToken.NULL) + { + p_read_1_.nextNull(); + return (T)null; + } + else + { + return (T)map.get(p_read_1_.nextString()); + } + } + }; + } + } + + private String func_151232_a(Object p_151232_1_) + { + return p_151232_1_ instanceof Enum ? ((Enum)p_151232_1_).name().toLowerCase(Locale.US) : p_151232_1_.toString().toLowerCase(Locale.US); + } +} diff --git a/src/minecraft/net/minecraft/util/EnumWorldBlockLayer.java b/src/minecraft/net/minecraft/util/EnumWorldBlockLayer.java new file mode 100644 index 0000000..8b19104 --- /dev/null +++ b/src/minecraft/net/minecraft/util/EnumWorldBlockLayer.java @@ -0,0 +1,21 @@ +package net.minecraft.util; + +public enum EnumWorldBlockLayer +{ + SOLID("Solid"), + CUTOUT_MIPPED("Mipped Cutout"), + CUTOUT("Cutout"), + TRANSLUCENT("Translucent"); + + private final String layerName; + + private EnumWorldBlockLayer(String layerNameIn) + { + this.layerName = layerNameIn; + } + + public String toString() + { + return this.layerName; + } +} diff --git a/src/minecraft/net/minecraft/util/FoodStats.java b/src/minecraft/net/minecraft/util/FoodStats.java new file mode 100644 index 0000000..4cede0d --- /dev/null +++ b/src/minecraft/net/minecraft/util/FoodStats.java @@ -0,0 +1,162 @@ +package net.minecraft.util; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.EnumDifficulty; + +public class FoodStats +{ + /** The player's food level. */ + private int foodLevel = 20; + + /** The player's food saturation. */ + private float foodSaturationLevel = 5.0F; + + /** The player's food exhaustion. */ + private float foodExhaustionLevel; + + /** The player's food timer value. */ + private int foodTimer; + private int prevFoodLevel = 20; + + /** + * Add food stats. + */ + public void addStats(int foodLevelIn, float foodSaturationModifier) + { + this.foodLevel = Math.min(foodLevelIn + this.foodLevel, 20); + this.foodSaturationLevel = Math.min(this.foodSaturationLevel + (float)foodLevelIn * foodSaturationModifier * 2.0F, (float)this.foodLevel); + } + + public void addStats(ItemFood foodItem, ItemStack p_151686_2_) + { + this.addStats(foodItem.getHealAmount(p_151686_2_), foodItem.getSaturationModifier(p_151686_2_)); + } + + /** + * Handles the food game logic. + */ + public void onUpdate(EntityPlayer player) + { + EnumDifficulty enumdifficulty = player.worldObj.getDifficulty(); + this.prevFoodLevel = this.foodLevel; + + if (this.foodExhaustionLevel > 4.0F) + { + this.foodExhaustionLevel -= 4.0F; + + if (this.foodSaturationLevel > 0.0F) + { + this.foodSaturationLevel = Math.max(this.foodSaturationLevel - 1.0F, 0.0F); + } + else if (enumdifficulty != EnumDifficulty.PEACEFUL) + { + this.foodLevel = Math.max(this.foodLevel - 1, 0); + } + } + + if (player.worldObj.getGameRules().getBoolean("naturalRegeneration") && this.foodLevel >= 18 && player.shouldHeal()) + { + ++this.foodTimer; + + if (this.foodTimer >= 80) + { + player.heal(1.0F); + this.addExhaustion(3.0F); + this.foodTimer = 0; + } + } + else if (this.foodLevel <= 0) + { + ++this.foodTimer; + + if (this.foodTimer >= 80) + { + if (player.getHealth() > 10.0F || enumdifficulty == EnumDifficulty.HARD || player.getHealth() > 1.0F && enumdifficulty == EnumDifficulty.NORMAL) + { + player.attackEntityFrom(DamageSource.starve, 1.0F); + } + + this.foodTimer = 0; + } + } + else + { + this.foodTimer = 0; + } + } + + /** + * Reads the food data for the player. + */ + public void readNBT(NBTTagCompound p_75112_1_) + { + if (p_75112_1_.hasKey("foodLevel", 99)) + { + this.foodLevel = p_75112_1_.getInteger("foodLevel"); + this.foodTimer = p_75112_1_.getInteger("foodTickTimer"); + this.foodSaturationLevel = p_75112_1_.getFloat("foodSaturationLevel"); + this.foodExhaustionLevel = p_75112_1_.getFloat("foodExhaustionLevel"); + } + } + + /** + * Writes the food data for the player. + */ + public void writeNBT(NBTTagCompound p_75117_1_) + { + p_75117_1_.setInteger("foodLevel", this.foodLevel); + p_75117_1_.setInteger("foodTickTimer", this.foodTimer); + p_75117_1_.setFloat("foodSaturationLevel", this.foodSaturationLevel); + p_75117_1_.setFloat("foodExhaustionLevel", this.foodExhaustionLevel); + } + + /** + * Get the player's food level. + */ + public int getFoodLevel() + { + return this.foodLevel; + } + + public int getPrevFoodLevel() + { + return this.prevFoodLevel; + } + + /** + * Get whether the player must eat food. + */ + public boolean needFood() + { + return this.foodLevel < 20; + } + + /** + * adds input to foodExhaustionLevel to a max of 40 + */ + public void addExhaustion(float p_75113_1_) + { + this.foodExhaustionLevel = Math.min(this.foodExhaustionLevel + p_75113_1_, 40.0F); + } + + /** + * Get the player's food saturation level. + */ + public float getSaturationLevel() + { + return this.foodSaturationLevel; + } + + public void setFoodLevel(int foodLevelIn) + { + this.foodLevel = foodLevelIn; + } + + public void setFoodSaturationLevel(float foodSaturationLevelIn) + { + this.foodSaturationLevel = foodSaturationLevelIn; + } +} diff --git a/src/minecraft/net/minecraft/util/FrameTimer.java b/src/minecraft/net/minecraft/util/FrameTimer.java new file mode 100644 index 0000000..d965c4f --- /dev/null +++ b/src/minecraft/net/minecraft/util/FrameTimer.java @@ -0,0 +1,56 @@ +package net.minecraft.util; + +public class FrameTimer +{ + private final long[] field_181752_a = new long[240]; + private int field_181753_b; + private int field_181754_c; + private int field_181755_d; + + public void func_181747_a(long p_181747_1_) + { + this.field_181752_a[this.field_181755_d] = p_181747_1_; + ++this.field_181755_d; + + if (this.field_181755_d == 240) + { + this.field_181755_d = 0; + } + + if (this.field_181754_c < 240) + { + this.field_181753_b = 0; + ++this.field_181754_c; + } + else + { + this.field_181753_b = this.func_181751_b(this.field_181755_d + 1); + } + } + + public int func_181748_a(long p_181748_1_, int p_181748_3_) + { + double d0 = (double)p_181748_1_ / 1.6666666E7D; + return (int)(d0 * (double)p_181748_3_); + } + + public int func_181749_a() + { + return this.field_181753_b; + } + + public int func_181750_b() + { + return this.field_181755_d; + } + + public int func_181751_b(int p_181751_1_) + { + return p_181751_1_ % 240; + } + + public long[] func_181746_c() + { + return this.field_181752_a; + } +} diff --git a/src/minecraft/net/minecraft/util/HttpUtil.java b/src/minecraft/net/minecraft/util/HttpUtil.java new file mode 100644 index 0000000..9dc5bd6 --- /dev/null +++ b/src/minecraft/net/minecraft/util/HttpUtil.java @@ -0,0 +1,342 @@ +package net.minecraft.util; + +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.Proxy; +import java.net.ServerSocket; +import java.net.URL; +import java.net.URLEncoder; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.Executors; +import java.util.concurrent.atomic.AtomicInteger; +import net.minecraft.server.MinecraftServer; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class HttpUtil +{ + public static final ListeningExecutorService field_180193_a = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool((new ThreadFactoryBuilder()).setDaemon(true).setNameFormat("Downloader %d").build())); + + /** The number of download threads that we have started so far. */ + private static final AtomicInteger downloadThreadsStarted = new AtomicInteger(0); + private static final Logger logger = LogManager.getLogger(); + + /** + * Builds an encoded HTTP POST content string from a string map + */ + public static String buildPostString(Map data) + { + StringBuilder stringbuilder = new StringBuilder(); + + for (Entry entry : data.entrySet()) + { + if (stringbuilder.length() > 0) + { + stringbuilder.append('&'); + } + + try + { + stringbuilder.append(URLEncoder.encode((String)entry.getKey(), "UTF-8")); + } + catch (UnsupportedEncodingException unsupportedencodingexception1) + { + unsupportedencodingexception1.printStackTrace(); + } + + if (entry.getValue() != null) + { + stringbuilder.append('='); + + try + { + stringbuilder.append(URLEncoder.encode(entry.getValue().toString(), "UTF-8")); + } + catch (UnsupportedEncodingException unsupportedencodingexception) + { + unsupportedencodingexception.printStackTrace(); + } + } + } + + return stringbuilder.toString(); + } + + /** + * Sends a POST to the given URL using the map as the POST args + */ + public static String postMap(URL url, Map data, boolean skipLoggingErrors) + { + return post(url, buildPostString(data), skipLoggingErrors); + } + + /** + * Sends a POST to the given URL + */ + private static String post(URL url, String content, boolean skipLoggingErrors) + { + try + { + Proxy proxy = MinecraftServer.getServer() == null ? null : MinecraftServer.getServer().getServerProxy(); + + if (proxy == null) + { + proxy = Proxy.NO_PROXY; + } + + HttpURLConnection httpurlconnection = (HttpURLConnection)url.openConnection(proxy); + httpurlconnection.setRequestMethod("POST"); + httpurlconnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + httpurlconnection.setRequestProperty("Content-Length", "" + content.getBytes().length); + httpurlconnection.setRequestProperty("Content-Language", "en-US"); + httpurlconnection.setUseCaches(false); + httpurlconnection.setDoInput(true); + httpurlconnection.setDoOutput(true); + DataOutputStream dataoutputstream = new DataOutputStream(httpurlconnection.getOutputStream()); + dataoutputstream.writeBytes(content); + dataoutputstream.flush(); + dataoutputstream.close(); + BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(httpurlconnection.getInputStream())); + StringBuffer stringbuffer = new StringBuffer(); + String s; + + while ((s = bufferedreader.readLine()) != null) + { + stringbuffer.append(s); + stringbuffer.append('\r'); + } + + bufferedreader.close(); + return stringbuffer.toString(); + } + catch (Exception exception) + { + if (!skipLoggingErrors) + { + logger.error((String)("Could not post to " + url), (Throwable)exception); + } + + return ""; + } + } + + public static ListenableFuture downloadResourcePack(final File saveFile, final String packUrl, final Map p_180192_2_, final int maxSize, final IProgressUpdate p_180192_4_, final Proxy p_180192_5_) + { + ListenableFuture listenablefuture = field_180193_a.submit(new Runnable() + { + public void run() + { + HttpURLConnection httpurlconnection = null; + InputStream inputstream = null; + OutputStream outputstream = null; + + if (p_180192_4_ != null) + { + p_180192_4_.resetProgressAndMessage("Downloading Resource Pack"); + p_180192_4_.displayLoadingString("Making Request..."); + } + + try + { + try + { + byte[] abyte = new byte[4096]; + URL url = new URL(packUrl); + httpurlconnection = (HttpURLConnection)url.openConnection(p_180192_5_); + float f = 0.0F; + float f1 = (float)p_180192_2_.entrySet().size(); + + for (Entry entry : p_180192_2_.entrySet()) + { + httpurlconnection.setRequestProperty((String)entry.getKey(), (String)entry.getValue()); + + if (p_180192_4_ != null) + { + p_180192_4_.setLoadingProgress((int)(++f / f1 * 100.0F)); + } + } + + inputstream = httpurlconnection.getInputStream(); + f1 = (float)httpurlconnection.getContentLength(); + int i = httpurlconnection.getContentLength(); + + if (p_180192_4_ != null) + { + p_180192_4_.displayLoadingString(String.format("Downloading file (%.2f MB)...", new Object[] {Float.valueOf(f1 / 1000.0F / 1000.0F)})); + } + + if (saveFile.exists()) + { + long j = saveFile.length(); + + if (j == (long)i) + { + if (p_180192_4_ != null) + { + p_180192_4_.setDoneWorking(); + } + + return; + } + + HttpUtil.logger.warn("Deleting " + saveFile + " as it does not match what we currently have (" + i + " vs our " + j + ")."); + FileUtils.deleteQuietly(saveFile); + } + else if (saveFile.getParentFile() != null) + { + saveFile.getParentFile().mkdirs(); + } + + outputstream = new DataOutputStream(new FileOutputStream(saveFile)); + + if (maxSize > 0 && f1 > (float)maxSize) + { + if (p_180192_4_ != null) + { + p_180192_4_.setDoneWorking(); + } + + throw new IOException("Filesize is bigger than maximum allowed (file is " + f + ", limit is " + maxSize + ")"); + } + + int k = 0; + + while ((k = inputstream.read(abyte)) >= 0) + { + f += (float)k; + + if (p_180192_4_ != null) + { + p_180192_4_.setLoadingProgress((int)(f / f1 * 100.0F)); + } + + if (maxSize > 0 && f > (float)maxSize) + { + if (p_180192_4_ != null) + { + p_180192_4_.setDoneWorking(); + } + + throw new IOException("Filesize was bigger than maximum allowed (got >= " + f + ", limit was " + maxSize + ")"); + } + + if (Thread.interrupted()) + { + HttpUtil.logger.error("INTERRUPTED"); + + if (p_180192_4_ != null) + { + p_180192_4_.setDoneWorking(); + } + + return; + } + + outputstream.write(abyte, 0, k); + } + + if (p_180192_4_ != null) + { + p_180192_4_.setDoneWorking(); + return; + } + } + catch (Throwable throwable) + { + throwable.printStackTrace(); + + if (httpurlconnection != null) + { + InputStream inputstream1 = httpurlconnection.getErrorStream(); + + try + { + HttpUtil.logger.error(IOUtils.toString(inputstream1)); + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + + if (p_180192_4_ != null) + { + p_180192_4_.setDoneWorking(); + return; + } + } + } + finally + { + IOUtils.closeQuietly(inputstream); + IOUtils.closeQuietly(outputstream); + } + } + }); + return (ListenableFuture) listenablefuture; + } + + public static int getSuitableLanPort() throws IOException + { + ServerSocket serversocket = null; + int i = -1; + + try + { + serversocket = new ServerSocket(0); + i = serversocket.getLocalPort(); + } + finally + { + try + { + if (serversocket != null) + { + serversocket.close(); + } + } + catch (IOException var8) + { + ; + } + } + + return i; + } + + /** + * Send a GET request to the given URL. + */ + public static String get(URL url) throws IOException + { + HttpURLConnection httpurlconnection = (HttpURLConnection)url.openConnection(); + httpurlconnection.setRequestMethod("GET"); + BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(httpurlconnection.getInputStream())); + StringBuilder stringbuilder = new StringBuilder(); + String s; + + while ((s = bufferedreader.readLine()) != null) + { + stringbuilder.append(s); + stringbuilder.append('\r'); + } + + bufferedreader.close(); + return stringbuilder.toString(); + } +} diff --git a/src/minecraft/net/minecraft/util/IChatComponent.java b/src/minecraft/net/minecraft/util/IChatComponent.java new file mode 100644 index 0000000..8aac606 --- /dev/null +++ b/src/minecraft/net/minecraft/util/IChatComponent.java @@ -0,0 +1,294 @@ +package net.minecraft.util; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; +import java.util.List; +import java.util.Map.Entry; + +public interface IChatComponent extends Iterable +{ + IChatComponent setChatStyle(ChatStyle style); + + ChatStyle getChatStyle(); + + /** + * Appends the given text to the end of this component. + */ + IChatComponent appendText(String text); + + /** + * Appends the given component to the end of this one. + */ + IChatComponent appendSibling(IChatComponent component); + + /** + * Gets the text of this component, without any special formatting codes added, for chat. TODO: why is this two + * different methods? + */ + String getUnformattedTextForChat(); + + /** + * Get the text of this component, and all child components, with all special formatting codes removed. + */ + String getUnformattedText(); + + /** + * Gets the text of this component, with formatting codes added for rendering. + */ + String getFormattedText(); + + List getSiblings(); + + /** + * Creates a copy of this component. Almost a deep copy, except the style is shallow-copied. + */ + IChatComponent createCopy(); + + public static class Serializer implements JsonDeserializer, JsonSerializer + { + private static final Gson GSON; + + public IChatComponent deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + if (p_deserialize_1_.isJsonPrimitive()) + { + return new ChatComponentText(p_deserialize_1_.getAsString()); + } + else if (!p_deserialize_1_.isJsonObject()) + { + if (p_deserialize_1_.isJsonArray()) + { + JsonArray jsonarray1 = p_deserialize_1_.getAsJsonArray(); + IChatComponent ichatcomponent1 = null; + + for (JsonElement jsonelement : jsonarray1) + { + IChatComponent ichatcomponent2 = this.deserialize(jsonelement, jsonelement.getClass(), p_deserialize_3_); + + if (ichatcomponent1 == null) + { + ichatcomponent1 = ichatcomponent2; + } + else + { + ichatcomponent1.appendSibling(ichatcomponent2); + } + } + + return ichatcomponent1; + } + else + { + throw new JsonParseException("Don\'t know how to turn " + p_deserialize_1_.toString() + " into a Component"); + } + } + else + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + IChatComponent ichatcomponent; + + if (jsonobject.has("text")) + { + ichatcomponent = new ChatComponentText(jsonobject.get("text").getAsString()); + } + else if (jsonobject.has("translate")) + { + String s = jsonobject.get("translate").getAsString(); + + if (jsonobject.has("with")) + { + JsonArray jsonarray = jsonobject.getAsJsonArray("with"); + Object[] aobject = new Object[jsonarray.size()]; + + for (int i = 0; i < aobject.length; ++i) + { + aobject[i] = this.deserialize(jsonarray.get(i), p_deserialize_2_, p_deserialize_3_); + + if (aobject[i] instanceof ChatComponentText) + { + ChatComponentText chatcomponenttext = (ChatComponentText)aobject[i]; + + if (chatcomponenttext.getChatStyle().isEmpty() && chatcomponenttext.getSiblings().isEmpty()) + { + aobject[i] = chatcomponenttext.getChatComponentText_TextValue(); + } + } + } + + ichatcomponent = new ChatComponentTranslation(s, aobject); + } + else + { + ichatcomponent = new ChatComponentTranslation(s, new Object[0]); + } + } + else if (jsonobject.has("score")) + { + JsonObject jsonobject1 = jsonobject.getAsJsonObject("score"); + + if (!jsonobject1.has("name") || !jsonobject1.has("objective")) + { + throw new JsonParseException("A score component needs a least a name and an objective"); + } + + ichatcomponent = new ChatComponentScore(JsonUtils.getString(jsonobject1, "name"), JsonUtils.getString(jsonobject1, "objective")); + + if (jsonobject1.has("value")) + { + ((ChatComponentScore)ichatcomponent).setValue(JsonUtils.getString(jsonobject1, "value")); + } + } + else + { + if (!jsonobject.has("selector")) + { + throw new JsonParseException("Don\'t know how to turn " + p_deserialize_1_.toString() + " into a Component"); + } + + ichatcomponent = new ChatComponentSelector(JsonUtils.getString(jsonobject, "selector")); + } + + if (jsonobject.has("extra")) + { + JsonArray jsonarray2 = jsonobject.getAsJsonArray("extra"); + + if (jsonarray2.size() <= 0) + { + throw new JsonParseException("Unexpected empty array of components"); + } + + for (int j = 0; j < jsonarray2.size(); ++j) + { + ichatcomponent.appendSibling(this.deserialize(jsonarray2.get(j), p_deserialize_2_, p_deserialize_3_)); + } + } + + ichatcomponent.setChatStyle((ChatStyle)p_deserialize_3_.deserialize(p_deserialize_1_, ChatStyle.class)); + return ichatcomponent; + } + } + + private void serializeChatStyle(ChatStyle style, JsonObject object, JsonSerializationContext ctx) + { + JsonElement jsonelement = ctx.serialize(style); + + if (jsonelement.isJsonObject()) + { + JsonObject jsonobject = (JsonObject)jsonelement; + + for (Entry entry : jsonobject.entrySet()) + { + object.add((String)entry.getKey(), (JsonElement)entry.getValue()); + } + } + } + + public JsonElement serialize(IChatComponent p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) + { + if (p_serialize_1_ instanceof ChatComponentText && p_serialize_1_.getChatStyle().isEmpty() && p_serialize_1_.getSiblings().isEmpty()) + { + return new JsonPrimitive(((ChatComponentText)p_serialize_1_).getChatComponentText_TextValue()); + } + else + { + JsonObject jsonobject = new JsonObject(); + + if (!p_serialize_1_.getChatStyle().isEmpty()) + { + this.serializeChatStyle(p_serialize_1_.getChatStyle(), jsonobject, p_serialize_3_); + } + + if (!p_serialize_1_.getSiblings().isEmpty()) + { + JsonArray jsonarray = new JsonArray(); + + for (IChatComponent ichatcomponent : p_serialize_1_.getSiblings()) + { + jsonarray.add(this.serialize((IChatComponent)ichatcomponent, ichatcomponent.getClass(), p_serialize_3_)); + } + + jsonobject.add("extra", jsonarray); + } + + if (p_serialize_1_ instanceof ChatComponentText) + { + jsonobject.addProperty("text", ((ChatComponentText)p_serialize_1_).getChatComponentText_TextValue()); + } + else if (p_serialize_1_ instanceof ChatComponentTranslation) + { + ChatComponentTranslation chatcomponenttranslation = (ChatComponentTranslation)p_serialize_1_; + jsonobject.addProperty("translate", chatcomponenttranslation.getKey()); + + if (chatcomponenttranslation.getFormatArgs() != null && chatcomponenttranslation.getFormatArgs().length > 0) + { + JsonArray jsonarray1 = new JsonArray(); + + for (Object object : chatcomponenttranslation.getFormatArgs()) + { + if (object instanceof IChatComponent) + { + jsonarray1.add(this.serialize((IChatComponent)((IChatComponent)object), object.getClass(), p_serialize_3_)); + } + else + { + jsonarray1.add(new JsonPrimitive(String.valueOf(object))); + } + } + + jsonobject.add("with", jsonarray1); + } + } + else if (p_serialize_1_ instanceof ChatComponentScore) + { + ChatComponentScore chatcomponentscore = (ChatComponentScore)p_serialize_1_; + JsonObject jsonobject1 = new JsonObject(); + jsonobject1.addProperty("name", chatcomponentscore.getName()); + jsonobject1.addProperty("objective", chatcomponentscore.getObjective()); + jsonobject1.addProperty("value", chatcomponentscore.getUnformattedTextForChat()); + jsonobject.add("score", jsonobject1); + } + else + { + if (!(p_serialize_1_ instanceof ChatComponentSelector)) + { + throw new IllegalArgumentException("Don\'t know how to serialize " + p_serialize_1_ + " as a Component"); + } + + ChatComponentSelector chatcomponentselector = (ChatComponentSelector)p_serialize_1_; + jsonobject.addProperty("selector", chatcomponentselector.getSelector()); + } + + return jsonobject; + } + } + + public static String componentToJson(IChatComponent component) + { + return GSON.toJson((Object)component); + } + + public static IChatComponent jsonToComponent(String json) + { + return (IChatComponent)GSON.fromJson(json, IChatComponent.class); + } + + static + { + GsonBuilder gsonbuilder = new GsonBuilder(); + gsonbuilder.registerTypeHierarchyAdapter(IChatComponent.class, new IChatComponent.Serializer()); + gsonbuilder.registerTypeHierarchyAdapter(ChatStyle.class, new ChatStyle.Serializer()); + gsonbuilder.registerTypeAdapterFactory(new EnumTypeAdapterFactory()); + GSON = gsonbuilder.create(); + } + } +} diff --git a/src/minecraft/net/minecraft/util/IJsonSerializable.java b/src/minecraft/net/minecraft/util/IJsonSerializable.java new file mode 100644 index 0000000..464f93f --- /dev/null +++ b/src/minecraft/net/minecraft/util/IJsonSerializable.java @@ -0,0 +1,13 @@ +package net.minecraft.util; + +import com.google.gson.JsonElement; + +public interface IJsonSerializable +{ + void fromJson(JsonElement json); + + /** + * Gets the JsonElement that can be serialized. + */ + JsonElement getSerializableElement(); +} diff --git a/src/minecraft/net/minecraft/util/IObjectIntIterable.java b/src/minecraft/net/minecraft/util/IObjectIntIterable.java new file mode 100644 index 0000000..35172e5 --- /dev/null +++ b/src/minecraft/net/minecraft/util/IObjectIntIterable.java @@ -0,0 +1,5 @@ +package net.minecraft.util; + +public interface IObjectIntIterable extends Iterable +{ +} diff --git a/src/minecraft/net/minecraft/util/IProgressUpdate.java b/src/minecraft/net/minecraft/util/IProgressUpdate.java new file mode 100644 index 0000000..250afe6 --- /dev/null +++ b/src/minecraft/net/minecraft/util/IProgressUpdate.java @@ -0,0 +1,27 @@ +package net.minecraft.util; + +public interface IProgressUpdate +{ + /** + * Shows the 'Saving level' string. + */ + void displaySavingString(String message); + + /** + * this string, followed by "working..." and then the "% complete" are the 3 lines shown. This resets progress to 0, + * and the WorkingString to "working...". + */ + void resetProgressAndMessage(String message); + + /** + * Displays a string on the loading screen supposed to indicate what is being done currently. + */ + void displayLoadingString(String message); + + /** + * Updates the progress bar on the loading screen to the specified amount. Args: loadProgress + */ + void setLoadingProgress(int progress); + + void setDoneWorking(); +} diff --git a/src/minecraft/net/minecraft/util/IRegistry.java b/src/minecraft/net/minecraft/util/IRegistry.java new file mode 100644 index 0000000..46da24b --- /dev/null +++ b/src/minecraft/net/minecraft/util/IRegistry.java @@ -0,0 +1,11 @@ +package net.minecraft.util; + +public interface IRegistry extends Iterable +{ + V getObject(K name); + + /** + * Register an object on this registry. + */ + void putObject(K p_82595_1_, V p_82595_2_); +} diff --git a/src/minecraft/net/minecraft/util/IStringSerializable.java b/src/minecraft/net/minecraft/util/IStringSerializable.java new file mode 100644 index 0000000..bffc686 --- /dev/null +++ b/src/minecraft/net/minecraft/util/IStringSerializable.java @@ -0,0 +1,6 @@ +package net.minecraft.util; + +public interface IStringSerializable +{ + String getName(); +} diff --git a/src/minecraft/net/minecraft/util/IThreadListener.java b/src/minecraft/net/minecraft/util/IThreadListener.java new file mode 100644 index 0000000..9b9703e --- /dev/null +++ b/src/minecraft/net/minecraft/util/IThreadListener.java @@ -0,0 +1,10 @@ +package net.minecraft.util; + +import com.google.common.util.concurrent.ListenableFuture; + +public interface IThreadListener +{ + ListenableFuture addScheduledTask(Runnable runnableToSchedule); + + boolean isCallingFromMinecraftThread(); +} diff --git a/src/minecraft/net/minecraft/util/ITickable.java b/src/minecraft/net/minecraft/util/ITickable.java new file mode 100644 index 0000000..bd8ce4a --- /dev/null +++ b/src/minecraft/net/minecraft/util/ITickable.java @@ -0,0 +1,9 @@ +package net.minecraft.util; + +public interface ITickable +{ + /** + * Like the old updateEntity(), except more generic. + */ + void update(); +} diff --git a/src/minecraft/net/minecraft/util/IntHashMap.java b/src/minecraft/net/minecraft/util/IntHashMap.java new file mode 100644 index 0000000..15002ac --- /dev/null +++ b/src/minecraft/net/minecraft/util/IntHashMap.java @@ -0,0 +1,282 @@ +package net.minecraft.util; + +public class IntHashMap +{ + private transient IntHashMap.Entry[] slots = new IntHashMap.Entry[16]; + + /** The number of items stored in this map */ + private transient int count; + + /** The grow threshold */ + private int threshold = 12; + + /** The scale factor used to determine when to grow the table */ + private final float growFactor = 0.75F; + + /** + * Makes the passed in integer suitable for hashing by a number of shifts + */ + private static int computeHash(int integer) + { + integer = integer ^ integer >>> 20 ^ integer >>> 12; + return integer ^ integer >>> 7 ^ integer >>> 4; + } + + /** + * Computes the index of the slot for the hash and slot count passed in. + */ + private static int getSlotIndex(int hash, int slotCount) + { + return hash & slotCount - 1; + } + + /** + * Returns the object associated to a key + */ + public V lookup(int p_76041_1_) + { + int i = computeHash(p_76041_1_); + + for (IntHashMap.Entry entry = this.slots[getSlotIndex(i, this.slots.length)]; entry != null; entry = entry.nextEntry) + { + if (entry.hashEntry == p_76041_1_) + { + return entry.valueEntry; + } + } + + return (V)null; + } + + /** + * Returns true if this hash table contains the specified item. + */ + public boolean containsItem(int p_76037_1_) + { + return this.lookupEntry(p_76037_1_) != null; + } + + final IntHashMap.Entry lookupEntry(int p_76045_1_) + { + int i = computeHash(p_76045_1_); + + for (IntHashMap.Entry entry = this.slots[getSlotIndex(i, this.slots.length)]; entry != null; entry = entry.nextEntry) + { + if (entry.hashEntry == p_76045_1_) + { + return entry; + } + } + + return null; + } + + /** + * Adds a key and associated value to this map + */ + public void addKey(int p_76038_1_, V p_76038_2_) + { + int i = computeHash(p_76038_1_); + int j = getSlotIndex(i, this.slots.length); + + for (IntHashMap.Entry entry = this.slots[j]; entry != null; entry = entry.nextEntry) + { + if (entry.hashEntry == p_76038_1_) + { + entry.valueEntry = p_76038_2_; + return; + } + } + + this.insert(i, p_76038_1_, p_76038_2_, j); + } + + /** + * Increases the number of hash slots + */ + private void grow(int p_76047_1_) + { + IntHashMap.Entry[] entry = this.slots; + int i = entry.length; + + if (i == 1073741824) + { + this.threshold = Integer.MAX_VALUE; + } + else + { + IntHashMap.Entry[] entry1 = new IntHashMap.Entry[p_76047_1_]; + this.copyTo(entry1); + this.slots = entry1; + this.threshold = (int)((float)p_76047_1_ * this.growFactor); + } + } + + /** + * Copies the hash slots to a new array + */ + private void copyTo(IntHashMap.Entry[] p_76048_1_) + { + IntHashMap.Entry[] entry = this.slots; + int i = p_76048_1_.length; + + for (int j = 0; j < entry.length; ++j) + { + IntHashMap.Entry entry1 = entry[j]; + + if (entry1 != null) + { + entry[j] = null; + + while (true) + { + IntHashMap.Entry entry2 = entry1.nextEntry; + int k = getSlotIndex(entry1.slotHash, i); + entry1.nextEntry = p_76048_1_[k]; + p_76048_1_[k] = entry1; + entry1 = entry2; + + if (entry2 == null) + { + break; + } + } + } + } + } + + /** + * Removes the specified object from the map and returns it + */ + public V removeObject(int p_76049_1_) + { + IntHashMap.Entry entry = this.removeEntry(p_76049_1_); + return (V)(entry == null ? null : entry.valueEntry); + } + + final IntHashMap.Entry removeEntry(int p_76036_1_) + { + int i = computeHash(p_76036_1_); + int j = getSlotIndex(i, this.slots.length); + IntHashMap.Entry entry = this.slots[j]; + IntHashMap.Entry entry1; + IntHashMap.Entry entry2; + + for (entry1 = entry; entry1 != null; entry1 = entry2) + { + entry2 = entry1.nextEntry; + + if (entry1.hashEntry == p_76036_1_) + { + --this.count; + + if (entry == entry1) + { + this.slots[j] = entry2; + } + else + { + entry.nextEntry = entry2; + } + + return entry1; + } + + entry = entry1; + } + + return entry1; + } + + /** + * Removes all entries from the map + */ + public void clearMap() + { + IntHashMap.Entry[] entry = this.slots; + + for (int i = 0; i < entry.length; ++i) + { + entry[i] = null; + } + + this.count = 0; + } + + /** + * Adds an object to a slot + */ + private void insert(int p_76040_1_, int p_76040_2_, V p_76040_3_, int p_76040_4_) + { + IntHashMap.Entry entry = this.slots[p_76040_4_]; + this.slots[p_76040_4_] = new IntHashMap.Entry(p_76040_1_, p_76040_2_, p_76040_3_, entry); + + if (this.count++ >= this.threshold) + { + this.grow(2 * this.slots.length); + } + } + + static class Entry + { + final int hashEntry; + V valueEntry; + IntHashMap.Entry nextEntry; + final int slotHash; + + Entry(int p_i1552_1_, int p_i1552_2_, V p_i1552_3_, IntHashMap.Entry p_i1552_4_) + { + this.valueEntry = p_i1552_3_; + this.nextEntry = p_i1552_4_; + this.hashEntry = p_i1552_2_; + this.slotHash = p_i1552_1_; + } + + public final int getHash() + { + return this.hashEntry; + } + + public final V getValue() + { + return this.valueEntry; + } + + public final boolean equals(Object p_equals_1_) + { + if (!(p_equals_1_ instanceof IntHashMap.Entry)) + { + return false; + } + else + { + IntHashMap.Entry entry = (IntHashMap.Entry)p_equals_1_; + Object object = Integer.valueOf(this.getHash()); + Object object1 = Integer.valueOf(entry.getHash()); + + if (object == object1 || object != null && object.equals(object1)) + { + Object object2 = this.getValue(); + Object object3 = entry.getValue(); + + if (object2 == object3 || object2 != null && object2.equals(object3)) + { + return true; + } + } + + return false; + } + } + + public final int hashCode() + { + return IntHashMap.computeHash(this.hashEntry); + } + + public final String toString() + { + return this.getHash() + "=" + this.getValue(); + } + } +} diff --git a/src/minecraft/net/minecraft/util/IntegerCache.java b/src/minecraft/net/minecraft/util/IntegerCache.java new file mode 100644 index 0000000..cda195a --- /dev/null +++ b/src/minecraft/net/minecraft/util/IntegerCache.java @@ -0,0 +1,21 @@ +package net.minecraft.util; + +public class IntegerCache +{ + private static final Integer[] field_181757_a = new Integer[65535]; + + public static Integer func_181756_a(int p_181756_0_) + { + return p_181756_0_ > 0 && p_181756_0_ < field_181757_a.length ? field_181757_a[p_181756_0_] : Integer.valueOf(p_181756_0_); + } + + static + { + int i = 0; + + for (int j = field_181757_a.length; i < j; ++i) + { + field_181757_a[i] = Integer.valueOf(i); + } + } +} diff --git a/src/minecraft/net/minecraft/util/JsonSerializableSet.java b/src/minecraft/net/minecraft/util/JsonSerializableSet.java new file mode 100644 index 0000000..27a3ce0 --- /dev/null +++ b/src/minecraft/net/minecraft/util/JsonSerializableSet.java @@ -0,0 +1,44 @@ +package net.minecraft.util; + +import com.google.common.collect.ForwardingSet; +import com.google.common.collect.Sets; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; +import java.util.Set; + +public class JsonSerializableSet extends ForwardingSet implements IJsonSerializable +{ + private final Set underlyingSet = Sets.newHashSet(); + + public void fromJson(JsonElement json) + { + if (json.isJsonArray()) + { + for (JsonElement jsonelement : json.getAsJsonArray()) + { + this.add(jsonelement.getAsString()); + } + } + } + + /** + * Gets the JsonElement that can be serialized. + */ + public JsonElement getSerializableElement() + { + JsonArray jsonarray = new JsonArray(); + + for (String s : this) + { + jsonarray.add(new JsonPrimitive(s)); + } + + return jsonarray; + } + + protected Set delegate() + { + return this.underlyingSet; + } +} diff --git a/src/minecraft/net/minecraft/util/JsonUtils.java b/src/minecraft/net/minecraft/util/JsonUtils.java new file mode 100644 index 0000000..a0e5d3b --- /dev/null +++ b/src/minecraft/net/minecraft/util/JsonUtils.java @@ -0,0 +1,337 @@ +package net.minecraft.util; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSyntaxException; + +public class JsonUtils +{ + /** + * Does the given JsonObject contain a string field with the given name? + */ + public static boolean isString(JsonObject p_151205_0_, String p_151205_1_) + { + return !isJsonPrimitive(p_151205_0_, p_151205_1_) ? false : p_151205_0_.getAsJsonPrimitive(p_151205_1_).isString(); + } + + /** + * Is the given JsonElement a string? + */ + public static boolean isString(JsonElement p_151211_0_) + { + return !p_151211_0_.isJsonPrimitive() ? false : p_151211_0_.getAsJsonPrimitive().isString(); + } + + public static boolean isBoolean(JsonObject p_180199_0_, String p_180199_1_) + { + return !isJsonPrimitive(p_180199_0_, p_180199_1_) ? false : p_180199_0_.getAsJsonPrimitive(p_180199_1_).isBoolean(); + } + + /** + * Does the given JsonObject contain an array field with the given name? + */ + public static boolean isJsonArray(JsonObject p_151202_0_, String p_151202_1_) + { + return !hasField(p_151202_0_, p_151202_1_) ? false : p_151202_0_.get(p_151202_1_).isJsonArray(); + } + + /** + * Does the given JsonObject contain a field with the given name whose type is primitive (String, Java primitive, or + * Java primitive wrapper)? + */ + public static boolean isJsonPrimitive(JsonObject p_151201_0_, String p_151201_1_) + { + return !hasField(p_151201_0_, p_151201_1_) ? false : p_151201_0_.get(p_151201_1_).isJsonPrimitive(); + } + + /** + * Does the given JsonObject contain a field with the given name? + */ + public static boolean hasField(JsonObject p_151204_0_, String p_151204_1_) + { + return p_151204_0_ == null ? false : p_151204_0_.get(p_151204_1_) != null; + } + + /** + * Gets the string value of the given JsonElement. Expects the second parameter to be the name of the element's + * field if an error message needs to be thrown. + */ + public static String getString(JsonElement p_151206_0_, String p_151206_1_) + { + if (p_151206_0_.isJsonPrimitive()) + { + return p_151206_0_.getAsString(); + } + else + { + throw new JsonSyntaxException("Expected " + p_151206_1_ + " to be a string, was " + toString(p_151206_0_)); + } + } + + /** + * Gets the string value of the field on the JsonObject with the given name. + */ + public static String getString(JsonObject p_151200_0_, String p_151200_1_) + { + if (p_151200_0_.has(p_151200_1_)) + { + return getString(p_151200_0_.get(p_151200_1_), p_151200_1_); + } + else + { + throw new JsonSyntaxException("Missing " + p_151200_1_ + ", expected to find a string"); + } + } + + /** + * Gets the string value of the field on the JsonObject with the given name, or the given default value if the field + * is missing. + */ + public static String getString(JsonObject p_151219_0_, String p_151219_1_, String p_151219_2_) + { + return p_151219_0_.has(p_151219_1_) ? getString(p_151219_0_.get(p_151219_1_), p_151219_1_) : p_151219_2_; + } + + /** + * Gets the boolean value of the given JsonElement. Expects the second parameter to be the name of the element's + * field if an error message needs to be thrown. + */ + public static boolean getBoolean(JsonElement p_151216_0_, String p_151216_1_) + { + if (p_151216_0_.isJsonPrimitive()) + { + return p_151216_0_.getAsBoolean(); + } + else + { + throw new JsonSyntaxException("Expected " + p_151216_1_ + " to be a Boolean, was " + toString(p_151216_0_)); + } + } + + /** + * Gets the boolean value of the field on the JsonObject with the given name. + */ + public static boolean getBoolean(JsonObject p_151212_0_, String p_151212_1_) + { + if (p_151212_0_.has(p_151212_1_)) + { + return getBoolean(p_151212_0_.get(p_151212_1_), p_151212_1_); + } + else + { + throw new JsonSyntaxException("Missing " + p_151212_1_ + ", expected to find a Boolean"); + } + } + + /** + * Gets the boolean value of the field on the JsonObject with the given name, or the given default value if the + * field is missing. + */ + public static boolean getBoolean(JsonObject p_151209_0_, String p_151209_1_, boolean p_151209_2_) + { + return p_151209_0_.has(p_151209_1_) ? getBoolean(p_151209_0_.get(p_151209_1_), p_151209_1_) : p_151209_2_; + } + + /** + * Gets the float value of the given JsonElement. Expects the second parameter to be the name of the element's + * field if an error message needs to be thrown. + */ + public static float getFloat(JsonElement p_151220_0_, String p_151220_1_) + { + if (p_151220_0_.isJsonPrimitive() && p_151220_0_.getAsJsonPrimitive().isNumber()) + { + return p_151220_0_.getAsFloat(); + } + else + { + throw new JsonSyntaxException("Expected " + p_151220_1_ + " to be a Float, was " + toString(p_151220_0_)); + } + } + + /** + * Gets the float value of the field on the JsonObject with the given name. + */ + public static float getFloat(JsonObject p_151217_0_, String p_151217_1_) + { + if (p_151217_0_.has(p_151217_1_)) + { + return getFloat(p_151217_0_.get(p_151217_1_), p_151217_1_); + } + else + { + throw new JsonSyntaxException("Missing " + p_151217_1_ + ", expected to find a Float"); + } + } + + /** + * Gets the float value of the field on the JsonObject with the given name, or the given default value if the field + * is missing. + */ + public static float getFloat(JsonObject p_151221_0_, String p_151221_1_, float p_151221_2_) + { + return p_151221_0_.has(p_151221_1_) ? getFloat(p_151221_0_.get(p_151221_1_), p_151221_1_) : p_151221_2_; + } + + /** + * Gets the integer value of the given JsonElement. Expects the second parameter to be the name of the element's + * field if an error message needs to be thrown. + */ + public static int getInt(JsonElement p_151215_0_, String p_151215_1_) + { + if (p_151215_0_.isJsonPrimitive() && p_151215_0_.getAsJsonPrimitive().isNumber()) + { + return p_151215_0_.getAsInt(); + } + else + { + throw new JsonSyntaxException("Expected " + p_151215_1_ + " to be a Int, was " + toString(p_151215_0_)); + } + } + + /** + * Gets the integer value of the field on the JsonObject with the given name. + */ + public static int getInt(JsonObject p_151203_0_, String p_151203_1_) + { + if (p_151203_0_.has(p_151203_1_)) + { + return getInt(p_151203_0_.get(p_151203_1_), p_151203_1_); + } + else + { + throw new JsonSyntaxException("Missing " + p_151203_1_ + ", expected to find a Int"); + } + } + + /** + * Gets the integer value of the field on the JsonObject with the given name, or the given default value if the + * field is missing. + */ + public static int getInt(JsonObject p_151208_0_, String p_151208_1_, int p_151208_2_) + { + return p_151208_0_.has(p_151208_1_) ? getInt(p_151208_0_.get(p_151208_1_), p_151208_1_) : p_151208_2_; + } + + /** + * Gets the given JsonElement as a JsonObject. Expects the second parameter to be the name of the element's field + * if an error message needs to be thrown. + */ + public static JsonObject getJsonObject(JsonElement p_151210_0_, String p_151210_1_) + { + if (p_151210_0_.isJsonObject()) + { + return p_151210_0_.getAsJsonObject(); + } + else + { + throw new JsonSyntaxException("Expected " + p_151210_1_ + " to be a JsonObject, was " + toString(p_151210_0_)); + } + } + + public static JsonObject getJsonObject(JsonObject base, String key) + { + if (base.has(key)) + { + return getJsonObject(base.get(key), key); + } + else + { + throw new JsonSyntaxException("Missing " + key + ", expected to find a JsonObject"); + } + } + + /** + * Gets the JsonObject field on the JsonObject with the given name, or the given default value if the field is + * missing. + */ + public static JsonObject getJsonObject(JsonObject p_151218_0_, String p_151218_1_, JsonObject p_151218_2_) + { + return p_151218_0_.has(p_151218_1_) ? getJsonObject(p_151218_0_.get(p_151218_1_), p_151218_1_) : p_151218_2_; + } + + /** + * Gets the given JsonElement as a JsonArray. Expects the second parameter to be the name of the element's field if + * an error message needs to be thrown. + */ + public static JsonArray getJsonArray(JsonElement p_151207_0_, String p_151207_1_) + { + if (p_151207_0_.isJsonArray()) + { + return p_151207_0_.getAsJsonArray(); + } + else + { + throw new JsonSyntaxException("Expected " + p_151207_1_ + " to be a JsonArray, was " + toString(p_151207_0_)); + } + } + + /** + * Gets the JsonArray field on the JsonObject with the given name. + */ + public static JsonArray getJsonArray(JsonObject p_151214_0_, String p_151214_1_) + { + if (p_151214_0_.has(p_151214_1_)) + { + return getJsonArray(p_151214_0_.get(p_151214_1_), p_151214_1_); + } + else + { + throw new JsonSyntaxException("Missing " + p_151214_1_ + ", expected to find a JsonArray"); + } + } + + /** + * Gets the JsonArray field on the JsonObject with the given name, or the given default value if the field is + * missing. + */ + public static JsonArray getJsonArray(JsonObject p_151213_0_, String p_151213_1_, JsonArray p_151213_2_) + { + return p_151213_0_.has(p_151213_1_) ? getJsonArray(p_151213_0_.get(p_151213_1_), p_151213_1_) : p_151213_2_; + } + + /** + * Gets a human-readable description of the given JsonElement's type. For example: "a number (4)" + */ + public static String toString(JsonElement p_151222_0_) + { + String s = org.apache.commons.lang3.StringUtils.abbreviateMiddle(String.valueOf((Object)p_151222_0_), "...", 10); + + if (p_151222_0_ == null) + { + return "null (missing)"; + } + else if (p_151222_0_.isJsonNull()) + { + return "null (json)"; + } + else if (p_151222_0_.isJsonArray()) + { + return "an array (" + s + ")"; + } + else if (p_151222_0_.isJsonObject()) + { + return "an object (" + s + ")"; + } + else + { + if (p_151222_0_.isJsonPrimitive()) + { + JsonPrimitive jsonprimitive = p_151222_0_.getAsJsonPrimitive(); + + if (jsonprimitive.isNumber()) + { + return "a number (" + s + ")"; + } + + if (jsonprimitive.isBoolean()) + { + return "a boolean (" + s + ")"; + } + } + + return s; + } + } +} diff --git a/src/minecraft/net/minecraft/util/LazyLoadBase.java b/src/minecraft/net/minecraft/util/LazyLoadBase.java new file mode 100644 index 0000000..de33456 --- /dev/null +++ b/src/minecraft/net/minecraft/util/LazyLoadBase.java @@ -0,0 +1,20 @@ +package net.minecraft.util; + +public abstract class LazyLoadBase +{ + private T value; + private boolean isLoaded = false; + + public T getValue() + { + if (!this.isLoaded) + { + this.isLoaded = true; + this.value = this.load(); + } + + return this.value; + } + + protected abstract T load(); +} diff --git a/src/minecraft/net/minecraft/util/LoggingPrintStream.java b/src/minecraft/net/minecraft/util/LoggingPrintStream.java new file mode 100644 index 0000000..75d89e7 --- /dev/null +++ b/src/minecraft/net/minecraft/util/LoggingPrintStream.java @@ -0,0 +1,35 @@ +package net.minecraft.util; + +import java.io.OutputStream; +import java.io.PrintStream; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class LoggingPrintStream extends PrintStream +{ + private static final Logger LOGGER = LogManager.getLogger(); + private final String domain; + + public LoggingPrintStream(String domainIn, OutputStream outStream) + { + super(outStream); + this.domain = domainIn; + } + + public void println(String p_println_1_) + { + this.logString(p_println_1_); + } + + public void println(Object p_println_1_) + { + this.logString(String.valueOf(p_println_1_)); + } + + private void logString(String string) + { + StackTraceElement[] astacktraceelement = Thread.currentThread().getStackTrace(); + StackTraceElement stacktraceelement = astacktraceelement[Math.min(3, astacktraceelement.length)]; + LOGGER.info("[{}]@.({}:{}): {}", new Object[] {this.domain, stacktraceelement.getFileName(), Integer.valueOf(stacktraceelement.getLineNumber()), string}); + } +} diff --git a/src/minecraft/net/minecraft/util/LongHashMap.java b/src/minecraft/net/minecraft/util/LongHashMap.java new file mode 100644 index 0000000..3415a79 --- /dev/null +++ b/src/minecraft/net/minecraft/util/LongHashMap.java @@ -0,0 +1,316 @@ +package net.minecraft.util; + +public class LongHashMap +{ + /** the array of all elements in the hash */ + private transient LongHashMap.Entry[] hashArray = new LongHashMap.Entry[4096]; + + /** the number of elements in the hash array */ + private transient int numHashElements; + private int mask; + + /** + * the maximum amount of elements in the hash (probably 3/4 the size due to meh hashing function) + */ + private int capacity = 3072; + + /** + * percent of the hasharray that can be used without hash colliding probably + */ + private final float percentUseable = 0.75F; + + /** count of times elements have been added/removed */ + private transient volatile int modCount; + private static final String __OBFID = "CL_00001492"; + + public LongHashMap() + { + this.mask = this.hashArray.length - 1; + } + + /** + * returns the hashed key given the original key + */ + private static int getHashedKey(long originalKey) + { + return (int)(originalKey ^ originalKey >>> 27); + } + + /** + * the hash function + */ + private static int hash(int integer) + { + integer = integer ^ integer >>> 20 ^ integer >>> 12; + return integer ^ integer >>> 7 ^ integer >>> 4; + } + + /** + * gets the index in the hash given the array length and the hashed key + */ + private static int getHashIndex(int p_76158_0_, int p_76158_1_) + { + return p_76158_0_ & p_76158_1_; + } + + public int getNumHashElements() + { + return this.numHashElements; + } + + /** + * get the value from the map given the key + */ + public Object getValueByKey(long p_76164_1_) + { + int i = getHashedKey(p_76164_1_); + + for (LongHashMap.Entry longhashmap$entry = this.hashArray[getHashIndex(i, this.mask)]; longhashmap$entry != null; longhashmap$entry = longhashmap$entry.nextEntry) + { + if (longhashmap$entry.key == p_76164_1_) + { + return longhashmap$entry.value; + } + } + + return null; + } + + public boolean containsItem(long p_76161_1_) + { + return this.getEntry(p_76161_1_) != null; + } + + final LongHashMap.Entry getEntry(long p_76160_1_) + { + int i = getHashedKey(p_76160_1_); + + for (LongHashMap.Entry longhashmap$entry = this.hashArray[getHashIndex(i, this.mask)]; longhashmap$entry != null; longhashmap$entry = longhashmap$entry.nextEntry) + { + if (longhashmap$entry.key == p_76160_1_) + { + return longhashmap$entry; + } + } + + return null; + } + + /** + * Add a key-value pair. + */ + public void add(long p_76163_1_, Object p_76163_3_) + { + int i = getHashedKey(p_76163_1_); + int j = getHashIndex(i, this.mask); + + for (LongHashMap.Entry longhashmap$entry = this.hashArray[j]; longhashmap$entry != null; longhashmap$entry = longhashmap$entry.nextEntry) + { + if (longhashmap$entry.key == p_76163_1_) + { + longhashmap$entry.value = p_76163_3_; + return; + } + } + + ++this.modCount; + this.createKey(i, p_76163_1_, p_76163_3_, j); + } + + /** + * resizes the table + */ + private void resizeTable(int p_76153_1_) + { + LongHashMap.Entry[] alonghashmap$entry = this.hashArray; + int i = alonghashmap$entry.length; + + if (i == 1073741824) + { + this.capacity = Integer.MAX_VALUE; + } + else + { + LongHashMap.Entry[] alonghashmap$entry1 = new LongHashMap.Entry[p_76153_1_]; + this.copyHashTableTo(alonghashmap$entry1); + this.hashArray = alonghashmap$entry1; + this.mask = this.hashArray.length - 1; + float f = (float)p_76153_1_; + this.getClass(); + this.capacity = (int)(f * 0.75F); + } + } + + /** + * copies the hash table to the specified array + */ + private void copyHashTableTo(LongHashMap.Entry[] p_76154_1_) + { + LongHashMap.Entry[] alonghashmap$entry = this.hashArray; + int i = p_76154_1_.length; + + for (int j = 0; j < alonghashmap$entry.length; ++j) + { + LongHashMap.Entry longhashmap$entry = alonghashmap$entry[j]; + + if (longhashmap$entry != null) + { + alonghashmap$entry[j] = null; + + while (true) + { + LongHashMap.Entry longhashmap$entry1 = longhashmap$entry.nextEntry; + int k = getHashIndex(longhashmap$entry.hash, i - 1); + longhashmap$entry.nextEntry = p_76154_1_[k]; + p_76154_1_[k] = longhashmap$entry; + longhashmap$entry = longhashmap$entry1; + + if (longhashmap$entry1 == null) + { + break; + } + } + } + } + } + + /** + * calls the removeKey method and returns removed object + */ + public Object remove(long p_76159_1_) + { + LongHashMap.Entry longhashmap$entry = this.removeKey(p_76159_1_); + return longhashmap$entry == null ? null : longhashmap$entry.value; + } + + /** + * removes the key from the hash linked list + */ + final LongHashMap.Entry removeKey(long p_76152_1_) + { + int i = getHashedKey(p_76152_1_); + int j = getHashIndex(i, this.mask); + LongHashMap.Entry longhashmap$entry = this.hashArray[j]; + LongHashMap.Entry longhashmap$entry1; + LongHashMap.Entry longhashmap$entry2; + + for (longhashmap$entry1 = longhashmap$entry; longhashmap$entry1 != null; longhashmap$entry1 = longhashmap$entry2) + { + longhashmap$entry2 = longhashmap$entry1.nextEntry; + + if (longhashmap$entry1.key == p_76152_1_) + { + ++this.modCount; + --this.numHashElements; + + if (longhashmap$entry == longhashmap$entry1) + { + this.hashArray[j] = longhashmap$entry2; + } + else + { + longhashmap$entry.nextEntry = longhashmap$entry2; + } + + return longhashmap$entry1; + } + + longhashmap$entry = longhashmap$entry1; + } + + return longhashmap$entry1; + } + + /** + * creates the key in the hash table + */ + private void createKey(int p_76156_1_, long p_76156_2_, Object p_76156_4_, int p_76156_5_) + { + LongHashMap.Entry longhashmap$entry = this.hashArray[p_76156_5_]; + this.hashArray[p_76156_5_] = new LongHashMap.Entry(p_76156_1_, p_76156_2_, p_76156_4_, longhashmap$entry); + + if (this.numHashElements++ >= this.capacity) + { + this.resizeTable(2 * this.hashArray.length); + } + } + + public double getKeyDistribution() + { + int i = 0; + + for (int j = 0; j < this.hashArray.length; ++j) + { + if (this.hashArray[j] != null) + { + ++i; + } + } + + return 1.0D * (double)i / (double)this.numHashElements; + } + + static class Entry + { + final long key; + Object value; + LongHashMap.Entry nextEntry; + final int hash; + private static final String __OBFID = "CL_00001493"; + + Entry(int p_i1553_1_, long p_i1553_2_, Object p_i1553_4_, LongHashMap.Entry p_i1553_5_) + { + this.value = p_i1553_4_; + this.nextEntry = p_i1553_5_; + this.key = p_i1553_2_; + this.hash = p_i1553_1_; + } + + public final long getKey() + { + return this.key; + } + + public final Object getValue() + { + return this.value; + } + + public final boolean equals(Object p_equals_1_) + { + if (!(p_equals_1_ instanceof LongHashMap.Entry)) + { + return false; + } + else + { + LongHashMap.Entry longhashmap$entry = (LongHashMap.Entry)p_equals_1_; + Long olong = Long.valueOf(this.getKey()); + Long olong1 = Long.valueOf(longhashmap$entry.getKey()); + + if (olong == olong1 || olong != null && olong.equals(olong1)) + { + Object object = this.getValue(); + Object object1 = longhashmap$entry.getValue(); + + if (object == object1 || object != null && object.equals(object1)) + { + return true; + } + } + + return false; + } + } + + public final int hashCode() + { + return LongHashMap.getHashedKey(this.key); + } + + public final String toString() + { + return this.getKey() + "=" + this.getValue(); + } + } +} diff --git a/src/minecraft/net/minecraft/util/MapPopulator.java b/src/minecraft/net/minecraft/util/MapPopulator.java new file mode 100644 index 0000000..21506e2 --- /dev/null +++ b/src/minecraft/net/minecraft/util/MapPopulator.java @@ -0,0 +1,33 @@ +package net.minecraft.util; + +import com.google.common.collect.Maps; +import java.util.Iterator; +import java.util.Map; +import java.util.NoSuchElementException; + +public class MapPopulator +{ + public static Map createMap(Iterable keys, Iterable values) + { + return populateMap(keys, values, Maps.newLinkedHashMap()); + } + + public static Map populateMap(Iterable keys, Iterable values, Map map) + { + Iterator iterator = values.iterator(); + + for (K k : keys) + { + map.put(k, iterator.next()); + } + + if (iterator.hasNext()) + { + throw new NoSuchElementException(); + } + else + { + return map; + } + } +} diff --git a/src/minecraft/net/minecraft/util/MathHelper.java b/src/minecraft/net/minecraft/util/MathHelper.java new file mode 100644 index 0000000..f70974b --- /dev/null +++ b/src/minecraft/net/minecraft/util/MathHelper.java @@ -0,0 +1,588 @@ +package net.minecraft.util; + +import java.util.Random; +import java.util.UUID; + +public class MathHelper +{ + public static final float SQRT_2 = sqrt_float(2.0F); + private static final int SIN_BITS = 12; + private static final int SIN_MASK = 4095; + private static final int SIN_COUNT = 4096; + public static final float PI = (float)Math.PI; + public static final float PI2 = ((float)Math.PI * 2F); + public static final float PId2 = ((float)Math.PI / 2F); + private static final float radFull = ((float)Math.PI * 2F); + private static final float degFull = 360.0F; + private static final float radToIndex = 651.8986F; + private static final float degToIndex = 11.377778F; + public static final float deg2Rad = 0.017453292F; + private static final float[] SIN_TABLE_FAST = new float[4096]; + public static boolean fastMath = false; + + /** + * A table of sin values computed from 0 (inclusive) to 2*pi (exclusive), with steps of 2*PI / 65536. + */ + private static final float[] SIN_TABLE = new float[65536]; + + /** + * Though it looks like an array, this is really more like a mapping. Key (index of this array) is the upper 5 bits + * of the result of multiplying a 32-bit unsigned integer by the B(2, 5) De Bruijn sequence 0x077CB531. Value + * (value stored in the array) is the unique index (from the right) of the leftmost one-bit in a 32-bit unsigned + * integer that can cause the upper 5 bits to get that value. Used for highly optimized "find the log-base-2 of + * this number" calculations. + */ + private static final int[] multiplyDeBruijnBitPosition; + private static final double field_181163_d; + private static final double[] field_181164_e; + private static final double[] field_181165_f; + private static final String __OBFID = "CL_00001496"; + + /** + * sin looked up in a table + */ + public static float sin(float p_76126_0_) + { + return fastMath ? SIN_TABLE_FAST[(int)(p_76126_0_ * 651.8986F) & 4095] : SIN_TABLE[(int)(p_76126_0_ * 10430.378F) & 65535]; + } + + /** + * cos looked up in the sin table with the appropriate offset + */ + public static float cos(float value) + { + return fastMath ? SIN_TABLE_FAST[(int)((value + ((float)Math.PI / 2F)) * 651.8986F) & 4095] : SIN_TABLE[(int)(value * 10430.378F + 16384.0F) & 65535]; + } + + public static float sqrt_float(float value) + { + return (float)Math.sqrt((double)value); + } + + public static float sqrt_double(double value) + { + return (float)Math.sqrt(value); + } + + /** + * Returns the greatest integer less than or equal to the float argument + */ + public static int floor_float(float value) + { + int i = (int)value; + return value < (float)i ? i - 1 : i; + } + + /** + * returns par0 cast as an int, and no greater than Integer.MAX_VALUE-1024 + */ + public static int truncateDoubleToInt(double value) + { + return (int)(value + 1024.0D) - 1024; + } + + /** + * Returns the greatest integer less than or equal to the double argument + */ + public static int floor_double(double value) + { + int i = (int)value; + return value < (double)i ? i - 1 : i; + } + + /** + * Long version of floor_double + */ + public static long floor_double_long(double value) + { + long i = (long)value; + return value < (double)i ? i - 1L : i; + } + + public static int func_154353_e(double value) + { + return (int)(value >= 0.0D ? value : -value + 1.0D); + } + + public static float abs(float value) + { + return value >= 0.0F ? value : -value; + } + + /** + * Returns the unsigned value of an int. + */ + public static int abs_int(int value) + { + return value >= 0 ? value : -value; + } + + public static int ceiling_float_int(float value) + { + int i = (int)value; + return value > (float)i ? i + 1 : i; + } + + public static int ceiling_double_int(double value) + { + int i = (int)value; + return value > (double)i ? i + 1 : i; + } + + /** + * Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and + * third parameters. + */ + public static int clamp_int(int num, int min, int max) + { + return num < min ? min : (num > max ? max : num); + } + + /** + * Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and + * third parameters + */ + public static float clamp_float(float num, float min, float max) + { + return num < min ? min : (num > max ? max : num); + } + + public static double clamp_double(double num, double min, double max) + { + return num < min ? min : (num > max ? max : num); + } + + public static double denormalizeClamp(double p_151238_0_, double p_151238_2_, double p_151238_4_) + { + return p_151238_4_ < 0.0D ? p_151238_0_ : (p_151238_4_ > 1.0D ? p_151238_2_ : p_151238_0_ + (p_151238_2_ - p_151238_0_) * p_151238_4_); + } + + /** + * Maximum of the absolute value of two numbers. + */ + public static double abs_max(double p_76132_0_, double p_76132_2_) + { + if (p_76132_0_ < 0.0D) + { + p_76132_0_ = -p_76132_0_; + } + + if (p_76132_2_ < 0.0D) + { + p_76132_2_ = -p_76132_2_; + } + + return p_76132_0_ > p_76132_2_ ? p_76132_0_ : p_76132_2_; + } + + /** + * Buckets an integer with specifed bucket sizes. Args: i, bucketSize + */ + public static int bucketInt(int p_76137_0_, int p_76137_1_) + { + return p_76137_0_ < 0 ? -((-p_76137_0_ - 1) / p_76137_1_) - 1 : p_76137_0_ / p_76137_1_; + } + + public static int getRandomIntegerInRange(Random p_76136_0_, int p_76136_1_, int p_76136_2_) + { + return p_76136_1_ >= p_76136_2_ ? p_76136_1_ : p_76136_0_.nextInt(p_76136_2_ - p_76136_1_ + 1) + p_76136_1_; + } + + public static float randomFloatClamp(Random p_151240_0_, float p_151240_1_, float p_151240_2_) + { + return p_151240_1_ >= p_151240_2_ ? p_151240_1_ : p_151240_0_.nextFloat() * (p_151240_2_ - p_151240_1_) + p_151240_1_; + } + + public static double getRandomDoubleInRange(Random p_82716_0_, double p_82716_1_, double p_82716_3_) + { + return p_82716_1_ >= p_82716_3_ ? p_82716_1_ : p_82716_0_.nextDouble() * (p_82716_3_ - p_82716_1_) + p_82716_1_; + } + + public static double average(long[] values) + { + long i = 0L; + + for (long j : values) + { + i += j; + } + + return (double)i / (double)values.length; + } + + public static boolean epsilonEquals(float p_180185_0_, float p_180185_1_) + { + return abs(p_180185_1_ - p_180185_0_) < 1.0E-5F; + } + + public static int normalizeAngle(int p_180184_0_, int p_180184_1_) + { + return (p_180184_0_ % p_180184_1_ + p_180184_1_) % p_180184_1_; + } + + /** + * the angle is reduced to an angle between -180 and +180 by mod, and a 360 check + */ + public static float wrapAngleTo180_float(float value) + { + value = value % 360.0F; + + if (value >= 180.0F) + { + value -= 360.0F; + } + + if (value < -180.0F) + { + value += 360.0F; + } + + return value; + } + + /** + * the angle is reduced to an angle between -180 and +180 by mod, and a 360 check + */ + public static double wrapAngleTo180_double(double value) + { + value = value % 360.0D; + + if (value >= 180.0D) + { + value -= 360.0D; + } + + if (value < -180.0D) + { + value += 360.0D; + } + + return value; + } + + /** + * parses the string as integer or returns the second parameter if it fails + */ + public static int parseIntWithDefault(String p_82715_0_, int p_82715_1_) + { + try + { + return Integer.parseInt(p_82715_0_); + } + catch (Throwable var3) + { + return p_82715_1_; + } + } + + /** + * parses the string as integer or returns the second parameter if it fails. this value is capped to par2 + */ + public static int parseIntWithDefaultAndMax(String p_82714_0_, int p_82714_1_, int p_82714_2_) + { + return Math.max(p_82714_2_, parseIntWithDefault(p_82714_0_, p_82714_1_)); + } + + /** + * parses the string as double or returns the second parameter if it fails. + */ + public static double parseDoubleWithDefault(String p_82712_0_, double p_82712_1_) + { + try + { + return Double.parseDouble(p_82712_0_); + } + catch (Throwable var4) + { + return p_82712_1_; + } + } + + public static double parseDoubleWithDefaultAndMax(String p_82713_0_, double p_82713_1_, double p_82713_3_) + { + return Math.max(p_82713_3_, parseDoubleWithDefault(p_82713_0_, p_82713_1_)); + } + + /** + * Returns the input value rounded up to the next highest power of two. + */ + public static int roundUpToPowerOfTwo(int value) + { + int i = value - 1; + i = i | i >> 1; + i = i | i >> 2; + i = i | i >> 4; + i = i | i >> 8; + i = i | i >> 16; + return i + 1; + } + + /** + * Is the given value a power of two? (1, 2, 4, 8, 16, ...) + */ + private static boolean isPowerOfTwo(int value) + { + return value != 0 && (value & value - 1) == 0; + } + + /** + * Uses a B(2, 5) De Bruijn sequence and a lookup table to efficiently calculate the log-base-two of the given + * value. Optimized for cases where the input value is a power-of-two. If the input value is not a power-of-two, + * then subtract 1 from the return value. + */ + private static int calculateLogBaseTwoDeBruijn(int value) + { + value = isPowerOfTwo(value) ? value : roundUpToPowerOfTwo(value); + return multiplyDeBruijnBitPosition[(int)((long)value * 125613361L >> 27) & 31]; + } + + /** + * Efficiently calculates the floor of the base-2 log of an integer value. This is effectively the index of the + * highest bit that is set. For example, if the number in binary is 0...100101, this will return 5. + */ + public static int calculateLogBaseTwo(int value) + { + return calculateLogBaseTwoDeBruijn(value) - (isPowerOfTwo(value) ? 0 : 1); + } + + public static int func_154354_b(int p_154354_0_, int p_154354_1_) + { + if (p_154354_1_ == 0) + { + return 0; + } + else if (p_154354_0_ == 0) + { + return p_154354_1_; + } + else + { + if (p_154354_0_ < 0) + { + p_154354_1_ *= -1; + } + + int i = p_154354_0_ % p_154354_1_; + return i == 0 ? p_154354_0_ : p_154354_0_ + p_154354_1_ - i; + } + } + + public static int func_180183_b(float p_180183_0_, float p_180183_1_, float p_180183_2_) + { + return func_180181_b(floor_float(p_180183_0_ * 255.0F), floor_float(p_180183_1_ * 255.0F), floor_float(p_180183_2_ * 255.0F)); + } + + public static int func_180181_b(int p_180181_0_, int p_180181_1_, int p_180181_2_) + { + int i = (p_180181_0_ << 8) + p_180181_1_; + i = (i << 8) + p_180181_2_; + return i; + } + + public static int func_180188_d(int p_180188_0_, int p_180188_1_) + { + int i = (p_180188_0_ & 16711680) >> 16; + int j = (p_180188_1_ & 16711680) >> 16; + int k = (p_180188_0_ & 65280) >> 8; + int l = (p_180188_1_ & 65280) >> 8; + int i1 = (p_180188_0_ & 255) >> 0; + int j1 = (p_180188_1_ & 255) >> 0; + int k1 = (int)((float)i * (float)j / 255.0F); + int l1 = (int)((float)k * (float)l / 255.0F); + int i2 = (int)((float)i1 * (float)j1 / 255.0F); + return p_180188_0_ & -16777216 | k1 << 16 | l1 << 8 | i2; + } + + public static double func_181162_h(double p_181162_0_) + { + return p_181162_0_ - Math.floor(p_181162_0_); + } + + public static long getPositionRandom(Vec3i pos) + { + return getCoordinateRandom(pos.getX(), pos.getY(), pos.getZ()); + } + + public static long getCoordinateRandom(int x, int y, int z) + { + long i = (long)(x * 3129871) ^ (long)z * 116129781L ^ (long)y; + i = i * i * 42317861L + i * 11L; + return i; + } + + public static UUID getRandomUuid(Random rand) + { + long i = rand.nextLong() & -61441L | 16384L; + long j = rand.nextLong() & 4611686018427387903L | Long.MIN_VALUE; + return new UUID(i, j); + } + + public static double func_181160_c(double p_181160_0_, double p_181160_2_, double p_181160_4_) + { + return (p_181160_0_ - p_181160_2_) / (p_181160_4_ - p_181160_2_); + } + + public static double func_181159_b(double p_181159_0_, double p_181159_2_) + { + double d0 = p_181159_2_ * p_181159_2_ + p_181159_0_ * p_181159_0_; + + if (Double.isNaN(d0)) + { + return Double.NaN; + } + else + { + boolean flag = p_181159_0_ < 0.0D; + + if (flag) + { + p_181159_0_ = -p_181159_0_; + } + + boolean flag1 = p_181159_2_ < 0.0D; + + if (flag1) + { + p_181159_2_ = -p_181159_2_; + } + + boolean flag2 = p_181159_0_ > p_181159_2_; + + if (flag2) + { + double d1 = p_181159_2_; + p_181159_2_ = p_181159_0_; + p_181159_0_ = d1; + } + + double d9 = func_181161_i(d0); + p_181159_2_ = p_181159_2_ * d9; + p_181159_0_ = p_181159_0_ * d9; + double d2 = field_181163_d + p_181159_0_; + int i = (int)Double.doubleToRawLongBits(d2); + double d3 = field_181164_e[i]; + double d4 = field_181165_f[i]; + double d5 = d2 - field_181163_d; + double d6 = p_181159_0_ * d4 - p_181159_2_ * d5; + double d7 = (6.0D + d6 * d6) * d6 * 0.16666666666666666D; + double d8 = d3 + d7; + + if (flag2) + { + d8 = (Math.PI / 2D) - d8; + } + + if (flag1) + { + d8 = Math.PI - d8; + } + + if (flag) + { + d8 = -d8; + } + + return d8; + } + } + + public static double func_181161_i(double p_181161_0_) + { + double d0 = 0.5D * p_181161_0_; + long i = Double.doubleToRawLongBits(p_181161_0_); + i = 6910469410427058090L - (i >> 1); + p_181161_0_ = Double.longBitsToDouble(i); + p_181161_0_ = p_181161_0_ * (1.5D - d0 * p_181161_0_ * p_181161_0_); + return p_181161_0_; + } + + public static int func_181758_c(float p_181758_0_, float p_181758_1_, float p_181758_2_) + { + int i = (int)(p_181758_0_ * 6.0F) % 6; + float f = p_181758_0_ * 6.0F - (float)i; + float f1 = p_181758_2_ * (1.0F - p_181758_1_); + float f2 = p_181758_2_ * (1.0F - f * p_181758_1_); + float f3 = p_181758_2_ * (1.0F - (1.0F - f) * p_181758_1_); + float f4; + float f5; + float f6; + + switch (i) + { + case 0: + f4 = p_181758_2_; + f5 = f3; + f6 = f1; + break; + + case 1: + f4 = f2; + f5 = p_181758_2_; + f6 = f1; + break; + + case 2: + f4 = f1; + f5 = p_181758_2_; + f6 = f3; + break; + + case 3: + f4 = f1; + f5 = f2; + f6 = p_181758_2_; + break; + + case 4: + f4 = f3; + f5 = f1; + f6 = p_181758_2_; + break; + + case 5: + f4 = p_181758_2_; + f5 = f1; + f6 = f2; + break; + + default: + throw new RuntimeException("Something went wrong when converting from HSV to RGB. Input was " + p_181758_0_ + ", " + p_181758_1_ + ", " + p_181758_2_); + } + + int j = clamp_int((int)(f4 * 255.0F), 0, 255); + int k = clamp_int((int)(f5 * 255.0F), 0, 255); + int l = clamp_int((int)(f6 * 255.0F), 0, 255); + return j << 16 | k << 8 | l; + } + + static + { + for (int i = 0; i < 65536; ++i) + { + SIN_TABLE[i] = (float)Math.sin((double)i * Math.PI * 2.0D / 65536.0D); + } + + for (int j = 0; j < 4096; ++j) + { + SIN_TABLE_FAST[j] = (float)Math.sin((double)(((float)j + 0.5F) / 4096.0F * ((float)Math.PI * 2F))); + } + + for (int l = 0; l < 360; l += 90) + { + SIN_TABLE_FAST[(int)((float)l * 11.377778F) & 4095] = (float)Math.sin((double)((float)l * 0.017453292F)); + } + + multiplyDeBruijnBitPosition = new int[] {0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9}; + field_181163_d = Double.longBitsToDouble(4805340802404319232L); + field_181164_e = new double[257]; + field_181165_f = new double[257]; + + for (int k = 0; k < 257; ++k) + { + double d1 = (double)k / 256.0D; + double d0 = Math.asin(d1); + field_181165_f[k] = Math.cos(d0); + field_181164_e[k] = d0; + } + } +} diff --git a/src/minecraft/net/minecraft/util/Matrix4f.java b/src/minecraft/net/minecraft/util/Matrix4f.java new file mode 100644 index 0000000..8f7ea07 --- /dev/null +++ b/src/minecraft/net/minecraft/util/Matrix4f.java @@ -0,0 +1,29 @@ +package net.minecraft.util; + +public class Matrix4f extends org.lwjgl.util.vector.Matrix4f +{ + public Matrix4f(float[] p_i46413_1_) + { + this.m00 = p_i46413_1_[0]; + this.m01 = p_i46413_1_[1]; + this.m02 = p_i46413_1_[2]; + this.m03 = p_i46413_1_[3]; + this.m10 = p_i46413_1_[4]; + this.m11 = p_i46413_1_[5]; + this.m12 = p_i46413_1_[6]; + this.m13 = p_i46413_1_[7]; + this.m20 = p_i46413_1_[8]; + this.m21 = p_i46413_1_[9]; + this.m22 = p_i46413_1_[10]; + this.m23 = p_i46413_1_[11]; + this.m30 = p_i46413_1_[12]; + this.m31 = p_i46413_1_[13]; + this.m32 = p_i46413_1_[14]; + this.m33 = p_i46413_1_[15]; + } + + public Matrix4f() + { + this.m00 = this.m01 = this.m02 = this.m03 = this.m10 = this.m11 = this.m12 = this.m13 = this.m20 = this.m21 = this.m22 = this.m23 = this.m30 = this.m31 = this.m32 = this.m33 = 0.0F; + } +} diff --git a/src/minecraft/net/minecraft/util/MessageDeserializer.java b/src/minecraft/net/minecraft/util/MessageDeserializer.java new file mode 100644 index 0000000..dddaada --- /dev/null +++ b/src/minecraft/net/minecraft/util/MessageDeserializer.java @@ -0,0 +1,61 @@ +package net.minecraft.util; + +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.ByteToMessageDecoder; +import java.io.IOException; +import java.util.List; +import net.minecraft.network.EnumConnectionState; +import net.minecraft.network.EnumPacketDirection; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.MarkerManager; + +public class MessageDeserializer extends ByteToMessageDecoder +{ + private static final Logger logger = LogManager.getLogger(); + private static final Marker RECEIVED_PACKET_MARKER = MarkerManager.getMarker("PACKET_RECEIVED", NetworkManager.logMarkerPackets); + private final EnumPacketDirection direction; + + public MessageDeserializer(EnumPacketDirection direction) + { + this.direction = direction; + } + + protected void decode(ChannelHandlerContext p_decode_1_, ByteBuf p_decode_2_, List p_decode_3_) throws IOException, InstantiationException, IllegalAccessException, Exception + { + if (p_decode_2_.readableBytes() != 0) + { + PacketBuffer packetbuffer = new PacketBuffer(p_decode_2_); + int i = packetbuffer.readVarIntFromBuffer(); + Packet packet = ((EnumConnectionState)p_decode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get()).getPacket(this.direction, i); + + if (packet == null) + { + throw new IOException("Bad packet id " + i); + } + else + { + packet.readPacketData(packetbuffer); + + if (packetbuffer.readableBytes() > 0) + { + throw new IOException("Packet " + ((EnumConnectionState)p_decode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get()).getId() + "/" + i + " (" + packet.getClass().getSimpleName() + ") was larger than I expected, found " + packetbuffer.readableBytes() + " bytes extra whilst reading packet " + i); + } + else + { + p_decode_3_.add(packet); + + if (logger.isDebugEnabled()) + { + logger.debug(RECEIVED_PACKET_MARKER, " IN: [{}:{}] {}", new Object[] {p_decode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get(), Integer.valueOf(i), packet.getClass().getName()}); + } + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/util/MessageDeserializer2.java b/src/minecraft/net/minecraft/util/MessageDeserializer2.java new file mode 100644 index 0000000..5de4c95 --- /dev/null +++ b/src/minecraft/net/minecraft/util/MessageDeserializer2.java @@ -0,0 +1,55 @@ +package net.minecraft.util; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.ByteToMessageDecoder; +import io.netty.handler.codec.CorruptedFrameException; +import java.util.List; +import net.minecraft.network.PacketBuffer; + +public class MessageDeserializer2 extends ByteToMessageDecoder +{ + protected void decode(ChannelHandlerContext p_decode_1_, ByteBuf p_decode_2_, List p_decode_3_) throws Exception + { + p_decode_2_.markReaderIndex(); + byte[] abyte = new byte[3]; + + for (int i = 0; i < abyte.length; ++i) + { + if (!p_decode_2_.isReadable()) + { + p_decode_2_.resetReaderIndex(); + return; + } + + abyte[i] = p_decode_2_.readByte(); + + if (abyte[i] >= 0) + { + PacketBuffer packetbuffer = new PacketBuffer(Unpooled.wrappedBuffer(abyte)); + + try + { + int j = packetbuffer.readVarIntFromBuffer(); + + if (p_decode_2_.readableBytes() >= j) + { + p_decode_3_.add(p_decode_2_.readBytes(j)); + return; + } + + p_decode_2_.resetReaderIndex(); + } + finally + { + packetbuffer.release(); + } + + return; + } + } + + throw new CorruptedFrameException("length wider than 21-bit"); + } +} diff --git a/src/minecraft/net/minecraft/util/MessageSerializer.java b/src/minecraft/net/minecraft/util/MessageSerializer.java new file mode 100644 index 0000000..9463125 --- /dev/null +++ b/src/minecraft/net/minecraft/util/MessageSerializer.java @@ -0,0 +1,57 @@ +package net.minecraft.util; + +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToByteEncoder; +import java.io.IOException; +import net.minecraft.network.EnumConnectionState; +import net.minecraft.network.EnumPacketDirection; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.server.S0CPacketSpawnPlayer; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.MarkerManager; + +public class MessageSerializer extends MessageToByteEncoder +{ + private static final Logger logger = LogManager.getLogger(); + private static final Marker RECEIVED_PACKET_MARKER = MarkerManager.getMarker("PACKET_SENT", NetworkManager.logMarkerPackets); + private final EnumPacketDirection direction; + + public MessageSerializer(EnumPacketDirection direction) + { + this.direction = direction; + } + + protected void encode(ChannelHandlerContext p_encode_1_, Packet p_encode_2_, ByteBuf p_encode_3_) throws IOException, Exception + { + Integer integer = ((EnumConnectionState)p_encode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get()).getPacketId(this.direction, p_encode_2_); + + if (logger.isDebugEnabled()) + { + logger.debug(RECEIVED_PACKET_MARKER, "OUT: [{}:{}] {}", new Object[] {p_encode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get(), integer, p_encode_2_.getClass().getName()}); + } + + if (integer == null) + { + throw new IOException("Can\'t serialize unregistered packet"); + } + else + { + PacketBuffer packetbuffer = new PacketBuffer(p_encode_3_); + packetbuffer.writeVarIntToBuffer(integer.intValue()); + + try + { + p_encode_2_.writePacketData(packetbuffer); + } + catch (Throwable throwable) + { + logger.error((Object)throwable); + } + } + } +} diff --git a/src/minecraft/net/minecraft/util/MessageSerializer2.java b/src/minecraft/net/minecraft/util/MessageSerializer2.java new file mode 100644 index 0000000..25bdd87 --- /dev/null +++ b/src/minecraft/net/minecraft/util/MessageSerializer2.java @@ -0,0 +1,27 @@ +package net.minecraft.util; + +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToByteEncoder; +import net.minecraft.network.PacketBuffer; + +public class MessageSerializer2 extends MessageToByteEncoder +{ + protected void encode(ChannelHandlerContext p_encode_1_, ByteBuf p_encode_2_, ByteBuf p_encode_3_) throws Exception + { + int i = p_encode_2_.readableBytes(); + int j = PacketBuffer.getVarIntSize(i); + + if (j > 3) + { + throw new IllegalArgumentException("unable to fit " + i + " into " + 3); + } + else + { + PacketBuffer packetbuffer = new PacketBuffer(p_encode_3_); + packetbuffer.ensureWritable(j + i); + packetbuffer.writeVarIntToBuffer(i); + packetbuffer.writeBytes(p_encode_2_, p_encode_2_.readerIndex(), i); + } + } +} diff --git a/src/minecraft/net/minecraft/util/MinecraftError.java b/src/minecraft/net/minecraft/util/MinecraftError.java new file mode 100644 index 0000000..83c1361 --- /dev/null +++ b/src/minecraft/net/minecraft/util/MinecraftError.java @@ -0,0 +1,5 @@ +package net.minecraft.util; + +public class MinecraftError extends Error +{ +} diff --git a/src/minecraft/net/minecraft/util/MouseFilter.java b/src/minecraft/net/minecraft/util/MouseFilter.java new file mode 100644 index 0000000..bffdead --- /dev/null +++ b/src/minecraft/net/minecraft/util/MouseFilter.java @@ -0,0 +1,33 @@ +package net.minecraft.util; + +public class MouseFilter +{ + private float field_76336_a; + private float field_76334_b; + private float field_76335_c; + + /** + * Smooths mouse input + */ + public float smooth(float p_76333_1_, float p_76333_2_) + { + this.field_76336_a += p_76333_1_; + p_76333_1_ = (this.field_76336_a - this.field_76334_b) * p_76333_2_; + this.field_76335_c += (p_76333_1_ - this.field_76335_c) * 0.5F; + + if (p_76333_1_ > 0.0F && p_76333_1_ > this.field_76335_c || p_76333_1_ < 0.0F && p_76333_1_ < this.field_76335_c) + { + p_76333_1_ = this.field_76335_c; + } + + this.field_76334_b += p_76333_1_; + return p_76333_1_; + } + + public void reset() + { + this.field_76336_a = 0.0F; + this.field_76334_b = 0.0F; + this.field_76335_c = 0.0F; + } +} diff --git a/src/minecraft/net/minecraft/util/MouseHelper.java b/src/minecraft/net/minecraft/util/MouseHelper.java new file mode 100644 index 0000000..b1f84cc --- /dev/null +++ b/src/minecraft/net/minecraft/util/MouseHelper.java @@ -0,0 +1,38 @@ +package net.minecraft.util; + +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; + +public class MouseHelper +{ + /** Mouse delta X this frame */ + public int deltaX; + + /** Mouse delta Y this frame */ + public int deltaY; + + /** + * Grabs the mouse cursor it doesn't move and isn't seen. + */ + public void grabMouseCursor() + { + Mouse.setGrabbed(true); + this.deltaX = 0; + this.deltaY = 0; + } + + /** + * Ungrabs the mouse cursor so it can be moved and set it to the center of the screen + */ + public void ungrabMouseCursor() + { + Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2); + Mouse.setGrabbed(false); + } + + public void mouseXYChange() + { + this.deltaX = Mouse.getDX(); + this.deltaY = Mouse.getDY(); + } +} diff --git a/src/minecraft/net/minecraft/util/MovementInput.java b/src/minecraft/net/minecraft/util/MovementInput.java new file mode 100644 index 0000000..afce2dc --- /dev/null +++ b/src/minecraft/net/minecraft/util/MovementInput.java @@ -0,0 +1,20 @@ +package net.minecraft.util; + +public class MovementInput +{ + /** + * The speed at which the player is strafing. Postive numbers to the left and negative to the right. + */ + public float moveStrafe; + + /** + * The speed at which the player is moving forward. Negative numbers will move backwards. + */ + public float moveForward; + public boolean jump; + public boolean sneak; + + public void updatePlayerMoveState() + { + } +} diff --git a/src/minecraft/net/minecraft/util/MovementInputFromOptions.java b/src/minecraft/net/minecraft/util/MovementInputFromOptions.java new file mode 100644 index 0000000..f5c5192 --- /dev/null +++ b/src/minecraft/net/minecraft/util/MovementInputFromOptions.java @@ -0,0 +1,48 @@ +package net.minecraft.util; + +import net.minecraft.client.settings.GameSettings; + +public class MovementInputFromOptions extends MovementInput +{ + private final GameSettings gameSettings; + + public MovementInputFromOptions(GameSettings gameSettingsIn) + { + this.gameSettings = gameSettingsIn; + } + + public void updatePlayerMoveState() + { + this.moveStrafe = 0.0F; + this.moveForward = 0.0F; + + if (this.gameSettings.keyBindForward.isKeyDown()) + { + ++this.moveForward; + } + + if (this.gameSettings.keyBindBack.isKeyDown()) + { + --this.moveForward; + } + + if (this.gameSettings.keyBindLeft.isKeyDown()) + { + ++this.moveStrafe; + } + + if (this.gameSettings.keyBindRight.isKeyDown()) + { + --this.moveStrafe; + } + + this.jump = this.gameSettings.keyBindJump.isKeyDown(); + this.sneak = this.gameSettings.keyBindSneak.isKeyDown(); + + if (this.sneak) + { + this.moveStrafe = (float)((double)this.moveStrafe * 0.3D); + this.moveForward = (float)((double)this.moveForward * 0.3D); + } + } +} diff --git a/src/minecraft/net/minecraft/util/MovingObjectPosition.java b/src/minecraft/net/minecraft/util/MovingObjectPosition.java new file mode 100644 index 0000000..33c5551 --- /dev/null +++ b/src/minecraft/net/minecraft/util/MovingObjectPosition.java @@ -0,0 +1,65 @@ +package net.minecraft.util; + +import net.minecraft.entity.Entity; + +public class MovingObjectPosition +{ + private BlockPos blockPos; + + /** What type of ray trace hit was this? 0 = block, 1 = entity */ + public MovingObjectPosition.MovingObjectType typeOfHit; + public EnumFacing sideHit; + + /** The vector position of the hit */ + public Vec3 hitVec; + + /** The hit entity */ + public Entity entityHit; + + public MovingObjectPosition(Vec3 hitVecIn, EnumFacing facing, BlockPos blockPosIn) + { + this(MovingObjectPosition.MovingObjectType.BLOCK, hitVecIn, facing, blockPosIn); + } + + public MovingObjectPosition(Vec3 p_i45552_1_, EnumFacing facing) + { + this(MovingObjectPosition.MovingObjectType.BLOCK, p_i45552_1_, facing, BlockPos.ORIGIN); + } + + public MovingObjectPosition(Entity p_i2304_1_) + { + this(p_i2304_1_, new Vec3(p_i2304_1_.posX, p_i2304_1_.posY, p_i2304_1_.posZ)); + } + + public MovingObjectPosition(MovingObjectPosition.MovingObjectType typeOfHitIn, Vec3 hitVecIn, EnumFacing sideHitIn, BlockPos blockPosIn) + { + this.typeOfHit = typeOfHitIn; + this.blockPos = blockPosIn; + this.sideHit = sideHitIn; + this.hitVec = new Vec3(hitVecIn.xCoord, hitVecIn.yCoord, hitVecIn.zCoord); + } + + public MovingObjectPosition(Entity entityHitIn, Vec3 hitVecIn) + { + this.typeOfHit = MovingObjectPosition.MovingObjectType.ENTITY; + this.entityHit = entityHitIn; + this.hitVec = hitVecIn; + } + + public BlockPos getBlockPos() + { + return this.blockPos; + } + + public String toString() + { + return "HitResult{type=" + this.typeOfHit + ", blockpos=" + this.blockPos + ", f=" + this.sideHit + ", pos=" + this.hitVec + ", entity=" + this.entityHit + '}'; + } + + public static enum MovingObjectType + { + MISS, + BLOCK, + ENTITY; + } +} diff --git a/src/minecraft/net/minecraft/util/ObjectIntIdentityMap.java b/src/minecraft/net/minecraft/util/ObjectIntIdentityMap.java new file mode 100644 index 0000000..a0a1296 --- /dev/null +++ b/src/minecraft/net/minecraft/util/ObjectIntIdentityMap.java @@ -0,0 +1,48 @@ +package net.minecraft.util; + +import com.google.common.base.Predicates; +import com.google.common.collect.Iterators; +import com.google.common.collect.Lists; +import java.util.IdentityHashMap; +import java.util.Iterator; +import java.util.List; + +public class ObjectIntIdentityMap implements IObjectIntIterable +{ + private final IdentityHashMap identityMap = new IdentityHashMap(512); + private final List objectList = Lists.newArrayList(); + private static final String __OBFID = "CL_00001203"; + + public void put(Object key, int value) + { + this.identityMap.put(key, Integer.valueOf(value)); + + while (this.objectList.size() <= value) + { + this.objectList.add((Object)null); + } + + this.objectList.set(value, key); + } + + public int get(Object key) + { + Integer integer = (Integer)this.identityMap.get(key); + return integer == null ? -1 : integer.intValue(); + } + + public final Object getByValue(int value) + { + return value >= 0 && value < this.objectList.size() ? this.objectList.get(value) : null; + } + + public Iterator iterator() + { + return Iterators.filter(this.objectList.iterator(), Predicates.notNull()); + } + + public List getObjectList() + { + return this.objectList; + } +} diff --git a/src/minecraft/net/minecraft/util/RegistryDefaulted.java b/src/minecraft/net/minecraft/util/RegistryDefaulted.java new file mode 100644 index 0000000..797fe4b --- /dev/null +++ b/src/minecraft/net/minecraft/util/RegistryDefaulted.java @@ -0,0 +1,20 @@ +package net.minecraft.util; + +public class RegistryDefaulted extends RegistrySimple +{ + /** + * Default object for this registry, returned when an object is not found. + */ + private final V defaultObject; + + public RegistryDefaulted(V defaultObjectIn) + { + this.defaultObject = defaultObjectIn; + } + + public V getObject(K name) + { + V v = super.getObject(name); + return (V)(v == null ? this.defaultObject : v); + } +} diff --git a/src/minecraft/net/minecraft/util/RegistryNamespaced.java b/src/minecraft/net/minecraft/util/RegistryNamespaced.java new file mode 100644 index 0000000..751db21 --- /dev/null +++ b/src/minecraft/net/minecraft/util/RegistryNamespaced.java @@ -0,0 +1,70 @@ +package net.minecraft.util; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import java.util.Iterator; +import java.util.Map; + +public class RegistryNamespaced extends RegistrySimple implements IObjectIntIterable +{ + protected final ObjectIntIdentityMap underlyingIntegerMap = new ObjectIntIdentityMap(); + protected final Map inverseObjectRegistry; + + public RegistryNamespaced() + { + this.inverseObjectRegistry = ((BiMap)this.registryObjects).inverse(); + } + + public void register(int id, K p_177775_2_, V p_177775_3_) + { + this.underlyingIntegerMap.put(p_177775_3_, id); + this.putObject(p_177775_2_, p_177775_3_); + } + + protected Map createUnderlyingMap() + { + return HashBiMap.create(); + } + + public V getObject(K name) + { + return super.getObject(name); + } + + /** + * Gets the name we use to identify the given object. + */ + public K getNameForObject(V p_177774_1_) + { + return (K)this.inverseObjectRegistry.get(p_177774_1_); + } + + /** + * Does this registry contain an entry for the given key? + */ + public boolean containsKey(K p_148741_1_) + { + return super.containsKey(p_148741_1_); + } + + /** + * Gets the integer ID we use to identify the given object. + */ + public int getIDForObject(V p_148757_1_) + { + return this.underlyingIntegerMap.get(p_148757_1_); + } + + /** + * Gets the object identified by the given ID. + */ + public V getObjectById(int id) + { + return (V)this.underlyingIntegerMap.getByValue(id); + } + + public Iterator iterator() + { + return this.underlyingIntegerMap.iterator(); + } +} diff --git a/src/minecraft/net/minecraft/util/RegistryNamespacedDefaultedByKey.java b/src/minecraft/net/minecraft/util/RegistryNamespacedDefaultedByKey.java new file mode 100644 index 0000000..92f7d94 --- /dev/null +++ b/src/minecraft/net/minecraft/util/RegistryNamespacedDefaultedByKey.java @@ -0,0 +1,52 @@ +package net.minecraft.util; + +import org.apache.commons.lang3.Validate; + +public class RegistryNamespacedDefaultedByKey extends RegistryNamespaced +{ + /** The key of the default value. */ + private final K defaultValueKey; + + /** + * The default value for this registry, retrurned in the place of a null value. + */ + private V defaultValue; + + public RegistryNamespacedDefaultedByKey(K p_i46017_1_) + { + this.defaultValueKey = p_i46017_1_; + } + + public void register(int id, K p_177775_2_, V p_177775_3_) + { + if (this.defaultValueKey.equals(p_177775_2_)) + { + this.defaultValue = p_177775_3_; + } + + super.register(id, p_177775_2_, p_177775_3_); + } + + /** + * validates that this registry's key is non-null + */ + public void validateKey() + { + Validate.notNull(this.defaultValueKey); + } + + public V getObject(K name) + { + V v = super.getObject(name); + return (V)(v == null ? this.defaultValue : v); + } + + /** + * Gets the object identified by the given ID. + */ + public V getObjectById(int id) + { + V v = super.getObjectById(id); + return (V)(v == null ? this.defaultValue : v); + } +} diff --git a/src/minecraft/net/minecraft/util/RegistrySimple.java b/src/minecraft/net/minecraft/util/RegistrySimple.java new file mode 100644 index 0000000..8893d4a --- /dev/null +++ b/src/minecraft/net/minecraft/util/RegistrySimple.java @@ -0,0 +1,60 @@ +package net.minecraft.util; + +import com.google.common.collect.Maps; +import java.util.Collections; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import org.apache.commons.lang3.Validate; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class RegistrySimple implements IRegistry +{ + private static final Logger logger = LogManager.getLogger(); + protected final Map registryObjects = this.createUnderlyingMap(); + + protected Map createUnderlyingMap() + { + return Maps.newHashMap(); + } + + public V getObject(K name) + { + return this.registryObjects.get(name); + } + + /** + * Register an object on this registry. + */ + public void putObject(K p_82595_1_, V p_82595_2_) + { + Validate.notNull(p_82595_1_); + Validate.notNull(p_82595_2_); + + if (this.registryObjects.containsKey(p_82595_1_)) + { + logger.debug("Adding duplicate key \'" + p_82595_1_ + "\' to registry"); + } + + this.registryObjects.put(p_82595_1_, p_82595_2_); + } + + public Set getKeys() + { + return Collections.unmodifiableSet(this.registryObjects.keySet()); + } + + /** + * Does this registry contain an entry for the given key? + */ + public boolean containsKey(K p_148741_1_) + { + return this.registryObjects.containsKey(p_148741_1_); + } + + public Iterator iterator() + { + return this.registryObjects.values().iterator(); + } +} diff --git a/src/minecraft/net/minecraft/util/ReportedException.java b/src/minecraft/net/minecraft/util/ReportedException.java new file mode 100644 index 0000000..87451ba --- /dev/null +++ b/src/minecraft/net/minecraft/util/ReportedException.java @@ -0,0 +1,32 @@ +package net.minecraft.util; + +import net.minecraft.crash.CrashReport; + +public class ReportedException extends RuntimeException +{ + /** Instance of CrashReport. */ + private final CrashReport theReportedExceptionCrashReport; + + public ReportedException(CrashReport report) + { + this.theReportedExceptionCrashReport = report; + } + + /** + * Gets the CrashReport wrapped by this exception. + */ + public CrashReport getCrashReport() + { + return this.theReportedExceptionCrashReport; + } + + public Throwable getCause() + { + return this.theReportedExceptionCrashReport.getCrashCause(); + } + + public String getMessage() + { + return this.theReportedExceptionCrashReport.getDescription(); + } +} diff --git a/src/minecraft/net/minecraft/util/ResourceLocation.java b/src/minecraft/net/minecraft/util/ResourceLocation.java new file mode 100644 index 0000000..cc40f81 --- /dev/null +++ b/src/minecraft/net/minecraft/util/ResourceLocation.java @@ -0,0 +1,85 @@ +package net.minecraft.util; + +import org.apache.commons.lang3.Validate; + +public class ResourceLocation +{ + protected final String resourceDomain; + protected final String resourcePath; + + protected ResourceLocation(int p_i45928_1_, String... resourceName) + { + this.resourceDomain = org.apache.commons.lang3.StringUtils.isEmpty(resourceName[0]) ? "minecraft" : resourceName[0].toLowerCase(); + this.resourcePath = resourceName[1]; + Validate.notNull(this.resourcePath); + } + + public ResourceLocation(String resourceName) + { + this(0, splitObjectName(resourceName)); + } + + public ResourceLocation(String resourceDomainIn, String resourcePathIn) + { + this(0, new String[] {resourceDomainIn, resourcePathIn}); + } + + /** + * Splits an object name (such as minecraft:apple) into the domain and path parts and returns these as an array of + * length 2. If no colon is present in the passed value the returned array will contain {null, toSplit}. + */ + protected static String[] splitObjectName(String toSplit) + { + String[] astring = new String[] {null, toSplit}; + int i = toSplit.indexOf(58); + + if (i >= 0) + { + astring[1] = toSplit.substring(i + 1, toSplit.length()); + + if (i > 1) + { + astring[0] = toSplit.substring(0, i); + } + } + + return astring; + } + + public String getResourcePath() + { + return this.resourcePath; + } + + public String getResourceDomain() + { + return this.resourceDomain; + } + + public String toString() + { + return this.resourceDomain + ':' + this.resourcePath; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof ResourceLocation)) + { + return false; + } + else + { + ResourceLocation resourcelocation = (ResourceLocation)p_equals_1_; + return this.resourceDomain.equals(resourcelocation.resourceDomain) && this.resourcePath.equals(resourcelocation.resourcePath); + } + } + + public int hashCode() + { + return 31 * this.resourceDomain.hashCode() + this.resourcePath.hashCode(); + } +} diff --git a/src/minecraft/net/minecraft/util/Rotations.java b/src/minecraft/net/minecraft/util/Rotations.java new file mode 100644 index 0000000..e803f62 --- /dev/null +++ b/src/minecraft/net/minecraft/util/Rotations.java @@ -0,0 +1,76 @@ +package net.minecraft.util; + +import net.minecraft.nbt.NBTTagFloat; +import net.minecraft.nbt.NBTTagList; + +public class Rotations +{ + /** Rotation on the X axis */ + protected final float x; + + /** Rotation on the Y axis */ + protected final float y; + + /** Rotation on the Z axis */ + protected final float z; + + public Rotations(float x, float y, float z) + { + this.x = x; + this.y = y; + this.z = z; + } + + public Rotations(NBTTagList nbt) + { + this.x = nbt.getFloatAt(0); + this.y = nbt.getFloatAt(1); + this.z = nbt.getFloatAt(2); + } + + public NBTTagList writeToNBT() + { + NBTTagList nbttaglist = new NBTTagList(); + nbttaglist.appendTag(new NBTTagFloat(this.x)); + nbttaglist.appendTag(new NBTTagFloat(this.y)); + nbttaglist.appendTag(new NBTTagFloat(this.z)); + return nbttaglist; + } + + public boolean equals(Object p_equals_1_) + { + if (!(p_equals_1_ instanceof Rotations)) + { + return false; + } + else + { + Rotations rotations = (Rotations)p_equals_1_; + return this.x == rotations.x && this.y == rotations.y && this.z == rotations.z; + } + } + + /** + * Gets the X axis rotation + */ + public float getX() + { + return this.x; + } + + /** + * Gets the Y axis rotation + */ + public float getY() + { + return this.y; + } + + /** + * Gets the Z axis rotation + */ + public float getZ() + { + return this.z; + } +} diff --git a/src/minecraft/net/minecraft/util/ScreenShotHelper.java b/src/minecraft/net/minecraft/util/ScreenShotHelper.java new file mode 100644 index 0000000..5b4c3e1 --- /dev/null +++ b/src/minecraft/net/minecraft/util/ScreenShotHelper.java @@ -0,0 +1,152 @@ +package net.minecraft.util; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.nio.IntBuffer; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import javax.imageio.ImageIO; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.event.ClickEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class ScreenShotHelper +{ + private static final Logger logger = LogManager.getLogger(); + private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss"); + + /** A buffer to hold pixel values returned by OpenGL. */ + private static IntBuffer pixelBuffer; + + /** + * The built-up array that contains all the pixel values returned by OpenGL. + */ + private static int[] pixelValues; + + /** + * Saves a screenshot in the game directory with a time-stamped filename. Args: gameDirectory, + * requestedWidthInPixels, requestedHeightInPixels, frameBuffer + */ + public static IChatComponent saveScreenshot(File gameDirectory, int width, int height, Framebuffer buffer) + { + return saveScreenshot(gameDirectory, (String)null, width, height, buffer); + } + + /** + * Saves a screenshot in the game directory with the given file name (or null to generate a time-stamped name). + * Args: gameDirectory, fileName, requestedWidthInPixels, requestedHeightInPixels, frameBuffer + */ + public static IChatComponent saveScreenshot(File gameDirectory, String screenshotName, int width, int height, Framebuffer buffer) + { + try + { + File file1 = new File(gameDirectory, "screenshots"); + file1.mkdir(); + + if (OpenGlHelper.isFramebufferEnabled()) + { + width = buffer.framebufferTextureWidth; + height = buffer.framebufferTextureHeight; + } + + int i = width * height; + + if (pixelBuffer == null || pixelBuffer.capacity() < i) + { + pixelBuffer = BufferUtils.createIntBuffer(i); + pixelValues = new int[i]; + } + + GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1); + GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); + pixelBuffer.clear(); + + if (OpenGlHelper.isFramebufferEnabled()) + { + GlStateManager.bindTexture(buffer.framebufferTexture); + GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)pixelBuffer); + } + else + { + GL11.glReadPixels(0, 0, width, height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)pixelBuffer); + } + + pixelBuffer.get(pixelValues); + TextureUtil.processPixelValues(pixelValues, width, height); + BufferedImage bufferedimage = null; + + if (OpenGlHelper.isFramebufferEnabled()) + { + bufferedimage = new BufferedImage(buffer.framebufferWidth, buffer.framebufferHeight, 1); + int j = buffer.framebufferTextureHeight - buffer.framebufferHeight; + + for (int k = j; k < buffer.framebufferTextureHeight; ++k) + { + for (int l = 0; l < buffer.framebufferWidth; ++l) + { + bufferedimage.setRGB(l, k - j, pixelValues[k * buffer.framebufferTextureWidth + l]); + } + } + } + else + { + bufferedimage = new BufferedImage(width, height, 1); + bufferedimage.setRGB(0, 0, width, height, pixelValues, 0, width); + } + + File file2; + + if (screenshotName == null) + { + file2 = getTimestampedPNGFileForDirectory(file1); + } + else + { + file2 = new File(file1, screenshotName); + } + + ImageIO.write(bufferedimage, "png", (File)file2); + IChatComponent ichatcomponent = new ChatComponentText(file2.getName()); + ichatcomponent.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath())); + ichatcomponent.getChatStyle().setUnderlined(Boolean.valueOf(true)); + return new ChatComponentTranslation("screenshot.success", new Object[] {ichatcomponent}); + } + catch (Exception exception) + { + logger.warn((String)"Couldn\'t save screenshot", (Throwable)exception); + return new ChatComponentTranslation("screenshot.failure", new Object[] {exception.getMessage()}); + } + } + + /** + * Creates a unique PNG file in the given directory named by a timestamp. Handles cases where the timestamp alone + * is not enough to create a uniquely named file, though it still might suffer from an unlikely race condition where + * the filename was unique when this method was called, but another process or thread created a file at the same + * path immediately after this method returned. + */ + private static File getTimestampedPNGFileForDirectory(File gameDirectory) + { + String s = dateFormat.format(new Date()).toString(); + int i = 1; + + while (true) + { + File file1 = new File(gameDirectory, s + (i == 1 ? "" : "_" + i) + ".png"); + + if (!file1.exists()) + { + return file1; + } + + ++i; + } + } +} diff --git a/src/minecraft/net/minecraft/util/Session.java b/src/minecraft/net/minecraft/util/Session.java new file mode 100644 index 0000000..1dd05d5 --- /dev/null +++ b/src/minecraft/net/minecraft/util/Session.java @@ -0,0 +1,90 @@ +package net.minecraft.util; + +import com.google.common.collect.Maps; +import com.mojang.authlib.GameProfile; +import com.mojang.util.UUIDTypeAdapter; +import java.util.Map; +import java.util.UUID; + +public class Session +{ + private final String username; + private final String playerID; + private final String token; + private final Session.Type sessionType; + + public Session(String usernameIn, String playerIDIn, String tokenIn, String sessionTypeIn) + { + this.username = usernameIn; + this.playerID = playerIDIn; + this.token = tokenIn; + this.sessionType = Session.Type.setSessionType(sessionTypeIn); + } + + public String getSessionID() + { + return "token:" + this.token + ":" + this.playerID; + } + + public String getPlayerID() + { + return this.playerID; + } + + public String getUsername() + { + return this.username; + } + + public String getToken() + { + return this.token; + } + + public GameProfile getProfile() + { + try + { + UUID uuid = UUIDTypeAdapter.fromString(this.getPlayerID()); + return new GameProfile(uuid, this.getUsername()); + } + catch (IllegalArgumentException var2) + { + return new GameProfile((UUID)null, this.getUsername()); + } + } + + /** + * Returns either 'legacy' or 'mojang' whether the account is migrated or not + */ + public Session.Type getSessionType() + { + return this.sessionType; + } + + public static enum Type + { + LEGACY("legacy"), + MOJANG("mojang"); + + private static final Map SESSION_TYPES = Maps.newHashMap(); + private final String sessionType; + + private Type(String sessionTypeIn) + { + this.sessionType = sessionTypeIn; + } + + public static Session.Type setSessionType(String sessionTypeIn) + { + return (Session.Type)SESSION_TYPES.get(sessionTypeIn.toLowerCase()); + } + + static { + for (Session.Type session$type : values()) + { + SESSION_TYPES.put(session$type.sessionType, session$type); + } + } + } +} diff --git a/src/minecraft/net/minecraft/util/StatCollector.java b/src/minecraft/net/minecraft/util/StatCollector.java new file mode 100644 index 0000000..9beaef1 --- /dev/null +++ b/src/minecraft/net/minecraft/util/StatCollector.java @@ -0,0 +1,53 @@ +package net.minecraft.util; + +public class StatCollector +{ + private static StringTranslate localizedName = StringTranslate.getInstance(); + + /** + * A StringTranslate instance using the hardcoded default locale (en_US). Used as a fallback in case the shared + * StringTranslate singleton instance fails to translate a key. + */ + private static StringTranslate fallbackTranslator = new StringTranslate(); + + /** + * Translates a Stat name + */ + public static String translateToLocal(String key) + { + return localizedName.translateKey(key); + } + + /** + * Translates a Stat name with format args + */ + public static String translateToLocalFormatted(String key, Object... format) + { + return localizedName.translateKeyFormat(key, format); + } + + /** + * Translates a Stat name using the fallback (hardcoded en_US) locale. Looks like it's only intended to be used if + * translateToLocal fails. + */ + public static String translateToFallback(String key) + { + return fallbackTranslator.translateKey(key); + } + + /** + * Determines whether or not translateToLocal will find a translation for the given key. + */ + public static boolean canTranslate(String key) + { + return localizedName.isKeyTranslated(key); + } + + /** + * Gets the time, in milliseconds since epoch, that the translation mapping was last updated + */ + public static long getLastTranslationUpdateTimeInMilliseconds() + { + return localizedName.getLastUpdateTimeInMilliseconds(); + } +} diff --git a/src/minecraft/net/minecraft/util/StringTranslate.java b/src/minecraft/net/minecraft/util/StringTranslate.java new file mode 100644 index 0000000..194ea6c --- /dev/null +++ b/src/minecraft/net/minecraft/util/StringTranslate.java @@ -0,0 +1,135 @@ +package net.minecraft.util; + +import com.google.common.base.Splitter; +import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; +import java.io.IOException; +import java.io.InputStream; +import java.util.IllegalFormatException; +import java.util.Map; +import java.util.regex.Pattern; +import org.apache.commons.io.Charsets; +import org.apache.commons.io.IOUtils; + +public class StringTranslate +{ + /** + * Pattern that matches numeric variable placeholders in a resource string, such as "%d", "%3$d", "%.2f" + */ + private static final Pattern numericVariablePattern = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]"); + + /** + * A Splitter that splits a string on the first "=". For example, "a=b=c" would split into ["a", "b=c"]. + */ + private static final Splitter equalSignSplitter = Splitter.on('=').limit(2); + + /** Is the private singleton instance of StringTranslate. */ + private static StringTranslate instance = new StringTranslate(); + private final Map languageList = Maps.newHashMap(); + + /** + * The time, in milliseconds since epoch, that this instance was last updated + */ + private long lastUpdateTimeInMilliseconds; + + public StringTranslate() + { + try + { + InputStream inputstream = StringTranslate.class.getResourceAsStream("/assets/minecraft/lang/en_US.lang"); + + for (String s : IOUtils.readLines(inputstream, Charsets.UTF_8)) + { + if (!s.isEmpty() && s.charAt(0) != 35) + { + String[] astring = (String[])Iterables.toArray(equalSignSplitter.split(s), String.class); + + if (astring != null && astring.length == 2) + { + String s1 = astring[0]; + String s2 = numericVariablePattern.matcher(astring[1]).replaceAll("%$1s"); + this.languageList.put(s1, s2); + } + } + } + + this.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); + } + catch (IOException var7) + { + ; + } + } + + /** + * Return the StringTranslate singleton instance + */ + static StringTranslate getInstance() + { + return instance; + } + + /** + * Replaces all the current instance's translations with the ones that are passed in. + */ + + public static synchronized void replaceWith(Map p_135063_0_) + { + instance.languageList.clear(); + instance.languageList.putAll(p_135063_0_); + instance.lastUpdateTimeInMilliseconds = System.currentTimeMillis(); + } + + /** + * Translate a key to current language. + */ + + public synchronized String translateKey(String key) + { + return this.tryTranslateKey(key); + } + + /** + * Translate a key to current language applying String.format() + */ + + public synchronized String translateKeyFormat(String key, Object... format) + { + String s = this.tryTranslateKey(key); + + try + { + return String.format(s, format); + } + catch (IllegalFormatException var5) + { + return "Format error: " + s; + } + } + + /** + * Tries to look up a translation for the given key; spits back the key if no result was found. + */ + private String tryTranslateKey(String key) + { + String s = (String)this.languageList.get(key); + return s == null ? key : s; + } + + /** + * Returns true if the passed key is in the translation table. + */ + + public synchronized boolean isKeyTranslated(String key) + { + return this.languageList.containsKey(key); + } + + /** + * Gets the time, in milliseconds since epoch, that this instance was last updated + */ + public long getLastUpdateTimeInMilliseconds() + { + return this.lastUpdateTimeInMilliseconds; + } +} diff --git a/src/minecraft/net/minecraft/util/StringUtils.java b/src/minecraft/net/minecraft/util/StringUtils.java new file mode 100644 index 0000000..28ee9c2 --- /dev/null +++ b/src/minecraft/net/minecraft/util/StringUtils.java @@ -0,0 +1,32 @@ +package net.minecraft.util; + +import java.util.regex.Pattern; + +public class StringUtils +{ + private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]"); + + /** + * Returns the time elapsed for the given number of ticks, in "mm:ss" format. + */ + public static String ticksToElapsedTime(int ticks) + { + int i = ticks / 20; + int j = i / 60; + i = i % 60; + return i < 10 ? j + ":0" + i : j + ":" + i; + } + + public static String stripControlCodes(String p_76338_0_) + { + return patternControlCode.matcher(p_76338_0_).replaceAll(""); + } + + /** + * Returns a value indicating whether the given string is null or empty. + */ + public static boolean isNullOrEmpty(String string) + { + return org.apache.commons.lang3.StringUtils.isEmpty(string); + } +} diff --git a/src/minecraft/net/minecraft/util/ThreadSafeBoundList.java b/src/minecraft/net/minecraft/util/ThreadSafeBoundList.java new file mode 100644 index 0000000..1dbc5ad --- /dev/null +++ b/src/minecraft/net/minecraft/util/ThreadSafeBoundList.java @@ -0,0 +1,64 @@ +package net.minecraft.util; + +import java.lang.reflect.Array; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +public class ThreadSafeBoundList +{ + private final T[] field_152759_a; + private final Class field_152760_b; + private final ReadWriteLock field_152761_c = new ReentrantReadWriteLock(); + private int field_152762_d; + private int field_152763_e; + + public ThreadSafeBoundList(Class p_i1126_1_, int p_i1126_2_) + { + this.field_152760_b = p_i1126_1_; + this.field_152759_a = (T[])Array.newInstance(p_i1126_1_, p_i1126_2_); + } + + public T func_152757_a(T p_152757_1_) + { + this.field_152761_c.writeLock().lock(); + this.field_152759_a[this.field_152763_e] = p_152757_1_; + this.field_152763_e = (this.field_152763_e + 1) % this.func_152758_b(); + + if (this.field_152762_d < this.func_152758_b()) + { + ++this.field_152762_d; + } + + this.field_152761_c.writeLock().unlock(); + return (T)p_152757_1_; + } + + public int func_152758_b() + { + this.field_152761_c.readLock().lock(); + int i = this.field_152759_a.length; + this.field_152761_c.readLock().unlock(); + return i; + } + + public T[] func_152756_c() + { + T[] at = (T[])((Object[])Array.newInstance(this.field_152760_b, this.field_152762_d)); + this.field_152761_c.readLock().lock(); + + for (int i = 0; i < this.field_152762_d; ++i) + { + int j = (this.field_152763_e - this.field_152762_d + i) % this.func_152758_b(); + + if (j < 0) + { + j += this.func_152758_b(); + } + + at[i] = this.field_152759_a[j]; + } + + this.field_152761_c.readLock().unlock(); + return at; + } +} diff --git a/src/minecraft/net/minecraft/util/Timer.java b/src/minecraft/net/minecraft/util/Timer.java new file mode 100644 index 0000000..8befbc5 --- /dev/null +++ b/src/minecraft/net/minecraft/util/Timer.java @@ -0,0 +1,116 @@ +package net.minecraft.util; + +import net.minecraft.client.Minecraft; + +public class Timer +{ + /** The number of timer ticks per second of real time */ + private float ticksPerSecond; + + /** + * The time reported by the high-resolution clock at the last call of updateTimer(), in seconds + */ + private double lastHRTime; + + /** + * How many full ticks have turned over since the last call to updateTimer(), capped at 10. + */ + public int elapsedTicks; + + /** + * How much time has elapsed since the last tick, in ticks, for use by display rendering routines (range: 0.0 - + * 1.0). This field is frozen if the display is paused to eliminate jitter. + */ + public float renderPartialTicks; + + /** + * A multiplier to make the timer (and therefore the game) go faster or slower. 0.5 makes the game run at half- + * speed. + */ + public float timerSpeed = 1.0F; + + /** + * How much time has elapsed since the last tick, in ticks (range: 0.0 - 1.0). + */ + public float elapsedPartialTicks; + + /** + * The time reported by the system clock at the last sync, in milliseconds + */ + private long lastSyncSysClock; + + /** + * The time reported by the high-resolution clock at the last sync, in milliseconds + */ + private long lastSyncHRClock; + private long field_74285_i; + + /** + * A ratio used to sync the high-resolution clock to the system clock, updated once per second + */ + private double timeSyncAdjustment = 1.0D; + + public Timer(float p_i1018_1_) + { + this.setTicksPerSecond(p_i1018_1_); + this.lastSyncSysClock = Minecraft.getSystemTime(); + this.lastSyncHRClock = System.nanoTime() / 1000000L; + } + + /** + * Updates all fields of the Timer using the current time + */ + public void updateTimer() + { + long i = Minecraft.getSystemTime(); + long j = i - this.lastSyncSysClock; + long k = System.nanoTime() / 1000000L; + double d0 = (double)k / 1000.0D; + + if (j <= 1000L && j >= 0L) + { + this.field_74285_i += j; + + if (this.field_74285_i > 1000L) + { + long l = k - this.lastSyncHRClock; + double d1 = (double)this.field_74285_i / (double)l; + this.timeSyncAdjustment += (d1 - this.timeSyncAdjustment) * 0.20000000298023224D; + this.lastSyncHRClock = k; + this.field_74285_i = 0L; + } + + if (this.field_74285_i < 0L) + { + this.lastSyncHRClock = k; + } + } + else + { + this.lastHRTime = d0; + } + + this.lastSyncSysClock = i; + double d2 = (d0 - this.lastHRTime) * this.timeSyncAdjustment; + this.lastHRTime = d0; + d2 = MathHelper.clamp_double(d2, 0.0D, 1.0D); + this.elapsedPartialTicks = (float)((double)this.elapsedPartialTicks + d2 * (double)this.timerSpeed * (double)this.getTicksPerSecond()); + this.elapsedTicks = (int)this.elapsedPartialTicks; + this.elapsedPartialTicks -= (float)this.elapsedTicks; + + if (this.elapsedTicks > 10) + { + this.elapsedTicks = 10; + } + + this.renderPartialTicks = this.elapsedPartialTicks; + } + + public float getTicksPerSecond() { + return ticksPerSecond; + } + + public void setTicksPerSecond(float ticksPerSecond) { + this.ticksPerSecond = ticksPerSecond; + } +} diff --git a/src/minecraft/net/minecraft/util/Tuple.java b/src/minecraft/net/minecraft/util/Tuple.java new file mode 100644 index 0000000..a6b91b9 --- /dev/null +++ b/src/minecraft/net/minecraft/util/Tuple.java @@ -0,0 +1,29 @@ +package net.minecraft.util; + +public class Tuple +{ + private A a; + private B b; + + public Tuple(A aIn, B bIn) + { + this.a = aIn; + this.b = bIn; + } + + /** + * Get the first Object in the Tuple + */ + public A getFirst() + { + return this.a; + } + + /** + * Get the second Object in the Tuple + */ + public B getSecond() + { + return this.b; + } +} diff --git a/src/minecraft/net/minecraft/util/TupleIntJsonSerializable.java b/src/minecraft/net/minecraft/util/TupleIntJsonSerializable.java new file mode 100644 index 0000000..7577e83 --- /dev/null +++ b/src/minecraft/net/minecraft/util/TupleIntJsonSerializable.java @@ -0,0 +1,36 @@ +package net.minecraft.util; + +public class TupleIntJsonSerializable +{ + private int integerValue; + private IJsonSerializable jsonSerializableValue; + + /** + * Gets the integer value stored in this tuple. + */ + public int getIntegerValue() + { + return this.integerValue; + } + + /** + * Sets this tuple's integer value to the given value. + */ + public void setIntegerValue(int integerValueIn) + { + this.integerValue = integerValueIn; + } + + public T getJsonSerializableValue() + { + return (T)this.jsonSerializableValue; + } + + /** + * Sets this tuple's JsonSerializable value to the given value. + */ + public void setJsonSerializableValue(IJsonSerializable jsonSerializableValueIn) + { + this.jsonSerializableValue = jsonSerializableValueIn; + } +} diff --git a/src/minecraft/net/minecraft/util/Util.java b/src/minecraft/net/minecraft/util/Util.java new file mode 100644 index 0000000..0546273 --- /dev/null +++ b/src/minecraft/net/minecraft/util/Util.java @@ -0,0 +1,45 @@ +package net.minecraft.util; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.FutureTask; +import org.apache.logging.log4j.Logger; + +import net.minecraft.client.Minecraft; + +public class Util +{ + public Minecraft mc = Minecraft.getMinecraft(); + public static Util.EnumOS getOSType() + { + String s = System.getProperty("os.name").toLowerCase(); + return s.contains("win") ? Util.EnumOS.WINDOWS : (s.contains("mac") ? Util.EnumOS.OSX : (s.contains("solaris") ? Util.EnumOS.SOLARIS : (s.contains("sunos") ? Util.EnumOS.SOLARIS : (s.contains("linux") ? Util.EnumOS.LINUX : (s.contains("unix") ? Util.EnumOS.LINUX : Util.EnumOS.UNKNOWN))))); + } + + public static V func_181617_a(FutureTask p_181617_0_, Logger p_181617_1_) + { + try + { + p_181617_0_.run(); + return p_181617_0_.get(); + } + catch (ExecutionException executionexception) + { + p_181617_1_.fatal((String)"Error executing task", (Throwable)executionexception); + } + catch (InterruptedException interruptedexception) + { + p_181617_1_.fatal((String)"Error executing task", (Throwable)interruptedexception); + } + + return (V)null; + } + + public static enum EnumOS + { + LINUX, + SOLARIS, + WINDOWS, + OSX, + UNKNOWN; + } +} diff --git a/src/minecraft/net/minecraft/util/Vec3.java b/src/minecraft/net/minecraft/util/Vec3.java new file mode 100644 index 0000000..927b804 --- /dev/null +++ b/src/minecraft/net/minecraft/util/Vec3.java @@ -0,0 +1,212 @@ +package net.minecraft.util; + +public class Vec3 +{ + /** X coordinate of Vec3D */ + public final double xCoord; + + /** Y coordinate of Vec3D */ + public final double yCoord; + + /** Z coordinate of Vec3D */ + public final double zCoord; + + public Vec3(double x, double y, double z) + { + if (x == -0.0D) + { + x = 0.0D; + } + + if (y == -0.0D) + { + y = 0.0D; + } + + if (z == -0.0D) + { + z = 0.0D; + } + + this.xCoord = x; + this.yCoord = y; + this.zCoord = z; + } + + public Vec3(Vec3i p_i46377_1_) + { + this((double)p_i46377_1_.getX(), (double)p_i46377_1_.getY(), (double)p_i46377_1_.getZ()); + } + + /** + * Returns a new vector with the result of the specified vector minus this. + */ + public Vec3 subtractReverse(Vec3 vec) + { + return new Vec3(vec.xCoord - this.xCoord, vec.yCoord - this.yCoord, vec.zCoord - this.zCoord); + } + + /** + * Normalizes the vector to a length of 1 (except if it is the zero vector) + */ + public Vec3 normalize() + { + double d0 = (double)MathHelper.sqrt_double(this.xCoord * this.xCoord + this.yCoord * this.yCoord + this.zCoord * this.zCoord); + return d0 < 1.0E-4D ? new Vec3(0.0D, 0.0D, 0.0D) : new Vec3(this.xCoord / d0, this.yCoord / d0, this.zCoord / d0); + } + + public double dotProduct(Vec3 vec) + { + return this.xCoord * vec.xCoord + this.yCoord * vec.yCoord + this.zCoord * vec.zCoord; + } + + /** + * Returns a new vector with the result of this vector x the specified vector. + */ + public Vec3 crossProduct(Vec3 vec) + { + return new Vec3(this.yCoord * vec.zCoord - this.zCoord * vec.yCoord, this.zCoord * vec.xCoord - this.xCoord * vec.zCoord, this.xCoord * vec.yCoord - this.yCoord * vec.xCoord); + } + + public Vec3 subtract(Vec3 vec) + { + return this.subtract(vec.xCoord, vec.yCoord, vec.zCoord); + } + + public Vec3 subtract(double x, double y, double z) + { + return this.addVector(-x, -y, -z); + } + + public Vec3 add(Vec3 vec) + { + return this.addVector(vec.xCoord, vec.yCoord, vec.zCoord); + } + + /** + * Adds the specified x,y,z vector components to this vector and returns the resulting vector. Does not change this + * vector. + */ + public Vec3 addVector(double x, double y, double z) + { + return new Vec3(this.xCoord + x, this.yCoord + y, this.zCoord + z); + } + + /** + * Euclidean distance between this and the specified vector, returned as double. + */ + public double distanceTo(Vec3 vec) + { + double d0 = vec.xCoord - this.xCoord; + double d1 = vec.yCoord - this.yCoord; + double d2 = vec.zCoord - this.zCoord; + return (double)MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2); + } + + /** + * The square of the Euclidean distance between this and the specified vector. + */ + public double squareDistanceTo(Vec3 vec) + { + double d0 = vec.xCoord - this.xCoord; + double d1 = vec.yCoord - this.yCoord; + double d2 = vec.zCoord - this.zCoord; + return d0 * d0 + d1 * d1 + d2 * d2; + } + + /** + * Returns the length of the vector. + */ + public double lengthVector() + { + return (double)MathHelper.sqrt_double(this.xCoord * this.xCoord + this.yCoord * this.yCoord + this.zCoord * this.zCoord); + } + + /** + * Returns a new vector with x value equal to the second parameter, along the line between this vector and the + * passed in vector, or null if not possible. + */ + public Vec3 getIntermediateWithXValue(Vec3 vec, double x) + { + double d0 = vec.xCoord - this.xCoord; + double d1 = vec.yCoord - this.yCoord; + double d2 = vec.zCoord - this.zCoord; + + if (d0 * d0 < 1.0000000116860974E-7D) + { + return null; + } + else + { + double d3 = (x - this.xCoord) / d0; + return d3 >= 0.0D && d3 <= 1.0D ? new Vec3(this.xCoord + d0 * d3, this.yCoord + d1 * d3, this.zCoord + d2 * d3) : null; + } + } + + /** + * Returns a new vector with y value equal to the second parameter, along the line between this vector and the + * passed in vector, or null if not possible. + */ + public Vec3 getIntermediateWithYValue(Vec3 vec, double y) + { + double d0 = vec.xCoord - this.xCoord; + double d1 = vec.yCoord - this.yCoord; + double d2 = vec.zCoord - this.zCoord; + + if (d1 * d1 < 1.0000000116860974E-7D) + { + return null; + } + else + { + double d3 = (y - this.yCoord) / d1; + return d3 >= 0.0D && d3 <= 1.0D ? new Vec3(this.xCoord + d0 * d3, this.yCoord + d1 * d3, this.zCoord + d2 * d3) : null; + } + } + + /** + * Returns a new vector with z value equal to the second parameter, along the line between this vector and the + * passed in vector, or null if not possible. + */ + public Vec3 getIntermediateWithZValue(Vec3 vec, double z) + { + double d0 = vec.xCoord - this.xCoord; + double d1 = vec.yCoord - this.yCoord; + double d2 = vec.zCoord - this.zCoord; + + if (d2 * d2 < 1.0000000116860974E-7D) + { + return null; + } + else + { + double d3 = (z - this.zCoord) / d2; + return d3 >= 0.0D && d3 <= 1.0D ? new Vec3(this.xCoord + d0 * d3, this.yCoord + d1 * d3, this.zCoord + d2 * d3) : null; + } + } + + public String toString() + { + return "(" + this.xCoord + ", " + this.yCoord + ", " + this.zCoord + ")"; + } + + public Vec3 rotatePitch(float pitch) + { + float f = MathHelper.cos(pitch); + float f1 = MathHelper.sin(pitch); + double d0 = this.xCoord; + double d1 = this.yCoord * (double)f + this.zCoord * (double)f1; + double d2 = this.zCoord * (double)f - this.yCoord * (double)f1; + return new Vec3(d0, d1, d2); + } + + public Vec3 rotateYaw(float yaw) + { + float f = MathHelper.cos(yaw); + float f1 = MathHelper.sin(yaw); + double d0 = this.xCoord * (double)f + this.zCoord * (double)f1; + double d1 = this.yCoord; + double d2 = this.zCoord * (double)f - this.xCoord * (double)f1; + return new Vec3(d0, d1, d2); + } +} diff --git a/src/minecraft/net/minecraft/util/Vec3i.java b/src/minecraft/net/minecraft/util/Vec3i.java new file mode 100644 index 0000000..92fd84c --- /dev/null +++ b/src/minecraft/net/minecraft/util/Vec3i.java @@ -0,0 +1,124 @@ +package net.minecraft.util; + +import com.google.common.base.Objects; + +public class Vec3i implements Comparable +{ + /** The Null vector constant (0, 0, 0) */ + public static final Vec3i NULL_VECTOR = new Vec3i(0, 0, 0); + + /** X coordinate */ + private final int x; + + /** Y coordinate */ + private final int y; + + /** Z coordinate */ + private final int z; + + public Vec3i(int xIn, int yIn, int zIn) + { + this.x = xIn; + this.y = yIn; + this.z = zIn; + } + + public Vec3i(double xIn, double yIn, double zIn) + { + this(MathHelper.floor_double(xIn), MathHelper.floor_double(yIn), MathHelper.floor_double(zIn)); + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof Vec3i)) + { + return false; + } + else + { + Vec3i vec3i = (Vec3i)p_equals_1_; + return this.getX() != vec3i.getX() ? false : (this.getY() != vec3i.getY() ? false : this.getZ() == vec3i.getZ()); + } + } + + public int hashCode() + { + return (this.getY() + this.getZ() * 31) * 31 + this.getX(); + } + + public int compareTo(Vec3i p_compareTo_1_) + { + return this.getY() == p_compareTo_1_.getY() ? (this.getZ() == p_compareTo_1_.getZ() ? this.getX() - p_compareTo_1_.getX() : this.getZ() - p_compareTo_1_.getZ()) : this.getY() - p_compareTo_1_.getY(); + } + + /** + * Get the X coordinate + */ + public int getX() + { + return this.x; + } + + /** + * Get the Y coordinate + */ + public int getY() + { + return this.y; + } + + /** + * Get the Z coordinate + */ + public int getZ() + { + return this.z; + } + + /** + * Calculate the cross product of this and the given Vector + */ + public Vec3i crossProduct(Vec3i vec) + { + return new Vec3i(this.getY() * vec.getZ() - this.getZ() * vec.getY(), this.getZ() * vec.getX() - this.getX() * vec.getZ(), this.getX() * vec.getY() - this.getY() * vec.getX()); + } + + /** + * Calculate squared distance to the given coordinates + */ + public double distanceSq(double toX, double toY, double toZ) + { + double d0 = (double)this.getX() - toX; + double d1 = (double)this.getY() - toY; + double d2 = (double)this.getZ() - toZ; + return d0 * d0 + d1 * d1 + d2 * d2; + } + + /** + * Compute square of distance from point x, y, z to center of this Block + */ + public double distanceSqToCenter(double xIn, double yIn, double zIn) + { + double d0 = (double)this.getX() + 0.5D - xIn; + double d1 = (double)this.getY() + 0.5D - yIn; + double d2 = (double)this.getZ() + 0.5D - zIn; + return d0 * d0 + d1 * d1 + d2 * d2; + } + + /** + * Calculate squared distance to the given Vector + */ + public double distanceSq(Vec3i to) + { + return this.distanceSq((double)to.getX(), (double)to.getY(), (double)to.getZ()); + } + + public String toString() + { + return Objects.toStringHelper(this).add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).toString(); + } +} diff --git a/src/minecraft/net/minecraft/util/Vec4b.java b/src/minecraft/net/minecraft/util/Vec4b.java new file mode 100644 index 0000000..edb7248 --- /dev/null +++ b/src/minecraft/net/minecraft/util/Vec4b.java @@ -0,0 +1,71 @@ +package net.minecraft.util; + +public class Vec4b +{ + private byte field_176117_a; + private byte field_176115_b; + private byte field_176116_c; + private byte field_176114_d; + + public Vec4b(byte p_i45555_1_, byte p_i45555_2_, byte p_i45555_3_, byte p_i45555_4_) + { + this.field_176117_a = p_i45555_1_; + this.field_176115_b = p_i45555_2_; + this.field_176116_c = p_i45555_3_; + this.field_176114_d = p_i45555_4_; + } + + public Vec4b(Vec4b p_i45556_1_) + { + this.field_176117_a = p_i45556_1_.field_176117_a; + this.field_176115_b = p_i45556_1_.field_176115_b; + this.field_176116_c = p_i45556_1_.field_176116_c; + this.field_176114_d = p_i45556_1_.field_176114_d; + } + + public byte func_176110_a() + { + return this.field_176117_a; + } + + public byte func_176112_b() + { + return this.field_176115_b; + } + + public byte func_176113_c() + { + return this.field_176116_c; + } + + public byte func_176111_d() + { + return this.field_176114_d; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof Vec4b)) + { + return false; + } + else + { + Vec4b vec4b = (Vec4b)p_equals_1_; + return this.field_176117_a != vec4b.field_176117_a ? false : (this.field_176114_d != vec4b.field_176114_d ? false : (this.field_176115_b != vec4b.field_176115_b ? false : this.field_176116_c == vec4b.field_176116_c)); + } + } + + public int hashCode() + { + int i = this.field_176117_a; + i = 31 * i + this.field_176115_b; + i = 31 * i + this.field_176116_c; + i = 31 * i + this.field_176114_d; + return i; + } +} diff --git a/src/minecraft/net/minecraft/util/Vector3d.java b/src/minecraft/net/minecraft/util/Vector3d.java new file mode 100644 index 0000000..5d20737 --- /dev/null +++ b/src/minecraft/net/minecraft/util/Vector3d.java @@ -0,0 +1,13 @@ +package net.minecraft.util; + +public class Vector3d +{ + public double field_181059_a; + public double field_181060_b; + public double field_181061_c; + + public Vector3d() + { + this.field_181059_a = this.field_181060_b = this.field_181061_c = 0.0D; + } +} diff --git a/src/minecraft/net/minecraft/util/WeightedRandom.java b/src/minecraft/net/minecraft/util/WeightedRandom.java new file mode 100644 index 0000000..7d129ed --- /dev/null +++ b/src/minecraft/net/minecraft/util/WeightedRandom.java @@ -0,0 +1,65 @@ +package net.minecraft.util; + +import java.util.Collection; +import java.util.Random; + +public class WeightedRandom +{ + /** + * Returns the total weight of all items in a collection. + */ + public static int getTotalWeight(Collection collection) + { + int i = 0; + + for (WeightedRandom.Item weightedrandom$item : collection) + { + i += weightedrandom$item.itemWeight; + } + + return i; + } + + public static T getRandomItem(Random random, Collection collection, int totalWeight) + { + if (totalWeight <= 0) + { + throw new IllegalArgumentException(); + } + else + { + int i = random.nextInt(totalWeight); + return getRandomItem(collection, i); + } + } + + public static T getRandomItem(Collection collection, int weight) + { + for (T t : collection) + { + weight -= t.itemWeight; + + if (weight < 0) + { + return t; + } + } + + return (T)null; + } + + public static T getRandomItem(Random random, Collection collection) + { + return getRandomItem(random, collection, getTotalWeight(collection)); + } + + public static class Item + { + protected int itemWeight; + + public Item(int itemWeightIn) + { + this.itemWeight = itemWeightIn; + } + } +} diff --git a/src/minecraft/net/minecraft/util/WeightedRandomChestContent.java b/src/minecraft/net/minecraft/util/WeightedRandomChestContent.java new file mode 100644 index 0000000..e29748b --- /dev/null +++ b/src/minecraft/net/minecraft/util/WeightedRandomChestContent.java @@ -0,0 +1,95 @@ +package net.minecraft.util; + +import com.google.common.collect.Lists; +import java.util.Collections; +import java.util.List; +import java.util.Random; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityDispenser; + +public class WeightedRandomChestContent extends WeightedRandom.Item +{ + /** The Item/Block ID to generate in the Chest. */ + private ItemStack theItemId; + + /** The minimum stack size of generated item. */ + private int minStackSize; + + /** The maximum stack size of generated item. */ + private int maxStackSize; + + public WeightedRandomChestContent(Item p_i45311_1_, int p_i45311_2_, int minimumChance, int maximumChance, int itemWeightIn) + { + super(itemWeightIn); + this.theItemId = new ItemStack(p_i45311_1_, 1, p_i45311_2_); + this.minStackSize = minimumChance; + this.maxStackSize = maximumChance; + } + + public WeightedRandomChestContent(ItemStack stack, int minimumChance, int maximumChance, int itemWeightIn) + { + super(itemWeightIn); + this.theItemId = stack; + this.minStackSize = minimumChance; + this.maxStackSize = maximumChance; + } + + public static void generateChestContents(Random random, List listIn, IInventory inv, int max) + { + for (int i = 0; i < max; ++i) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn); + int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1); + + if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) + { + ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); + itemstack1.stackSize = j; + inv.setInventorySlotContents(random.nextInt(inv.getSizeInventory()), itemstack1); + } + else + { + for (int k = 0; k < j; ++k) + { + ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); + itemstack.stackSize = 1; + inv.setInventorySlotContents(random.nextInt(inv.getSizeInventory()), itemstack); + } + } + } + } + + public static void generateDispenserContents(Random random, List listIn, TileEntityDispenser dispenser, int max) + { + for (int i = 0; i < max; ++i) + { + WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn); + int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1); + + if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j) + { + ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy(); + itemstack1.stackSize = j; + dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1); + } + else + { + for (int k = 0; k < j; ++k) + { + ItemStack itemstack = weightedrandomchestcontent.theItemId.copy(); + itemstack.stackSize = 1; + dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack); + } + } + } + } + + public static List func_177629_a(List p_177629_0_, WeightedRandomChestContent... p_177629_1_) + { + List list = Lists.newArrayList(p_177629_0_); + Collections.addAll(list, p_177629_1_); + return list; + } +} diff --git a/src/minecraft/net/minecraft/util/WeightedRandomFishable.java b/src/minecraft/net/minecraft/util/WeightedRandomFishable.java new file mode 100644 index 0000000..5f15f78 --- /dev/null +++ b/src/minecraft/net/minecraft/util/WeightedRandomFishable.java @@ -0,0 +1,60 @@ +package net.minecraft.util; + +import java.util.Random; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.item.ItemStack; + +public class WeightedRandomFishable extends WeightedRandom.Item +{ + private final ItemStack returnStack; + private float maxDamagePercent; + private boolean enchantable; + + public WeightedRandomFishable(ItemStack returnStackIn, int itemWeightIn) + { + super(itemWeightIn); + this.returnStack = returnStackIn; + } + + public ItemStack getItemStack(Random random) + { + ItemStack itemstack = this.returnStack.copy(); + + if (this.maxDamagePercent > 0.0F) + { + int i = (int)(this.maxDamagePercent * (float)this.returnStack.getMaxDamage()); + int j = itemstack.getMaxDamage() - random.nextInt(random.nextInt(i) + 1); + + if (j > i) + { + j = i; + } + + if (j < 1) + { + j = 1; + } + + itemstack.setItemDamage(j); + } + + if (this.enchantable) + { + EnchantmentHelper.addRandomEnchantment(random, itemstack, 30); + } + + return itemstack; + } + + public WeightedRandomFishable setMaxDamagePercent(float maxDamagePercentIn) + { + this.maxDamagePercent = maxDamagePercentIn; + return this; + } + + public WeightedRandomFishable setEnchantable() + { + this.enchantable = true; + return this; + } +} diff --git a/src/minecraft/net/minecraft/village/MerchantRecipe.java b/src/minecraft/net/minecraft/village/MerchantRecipe.java new file mode 100644 index 0000000..4f9fdb1 --- /dev/null +++ b/src/minecraft/net/minecraft/village/MerchantRecipe.java @@ -0,0 +1,180 @@ +package net.minecraft.village; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class MerchantRecipe +{ + /** Item the Villager buys. */ + private ItemStack itemToBuy; + + /** Second Item the Villager buys. */ + private ItemStack secondItemToBuy; + + /** Item the Villager sells. */ + private ItemStack itemToSell; + + /** + * Saves how much has been tool used when put into to slot to be enchanted. + */ + private int toolUses; + + /** Maximum times this trade can be used. */ + private int maxTradeUses; + private boolean rewardsExp; + + public MerchantRecipe(NBTTagCompound tagCompound) + { + this.readFromTags(tagCompound); + } + + public MerchantRecipe(ItemStack buy1, ItemStack buy2, ItemStack sell) + { + this(buy1, buy2, sell, 0, 7); + } + + public MerchantRecipe(ItemStack buy1, ItemStack buy2, ItemStack sell, int toolUsesIn, int maxTradeUsesIn) + { + this.itemToBuy = buy1; + this.secondItemToBuy = buy2; + this.itemToSell = sell; + this.toolUses = toolUsesIn; + this.maxTradeUses = maxTradeUsesIn; + this.rewardsExp = true; + } + + public MerchantRecipe(ItemStack buy1, ItemStack sell) + { + this(buy1, (ItemStack)null, sell); + } + + public MerchantRecipe(ItemStack buy1, Item sellItem) + { + this(buy1, new ItemStack(sellItem)); + } + + /** + * Gets the itemToBuy. + */ + public ItemStack getItemToBuy() + { + return this.itemToBuy; + } + + /** + * Gets secondItemToBuy. + */ + public ItemStack getSecondItemToBuy() + { + return this.secondItemToBuy; + } + + /** + * Gets if Villager has secondItemToBuy. + */ + public boolean hasSecondItemToBuy() + { + return this.secondItemToBuy != null; + } + + /** + * Gets itemToSell. + */ + public ItemStack getItemToSell() + { + return this.itemToSell; + } + + public int getToolUses() + { + return this.toolUses; + } + + public int getMaxTradeUses() + { + return this.maxTradeUses; + } + + public void incrementToolUses() + { + ++this.toolUses; + } + + public void increaseMaxTradeUses(int increment) + { + this.maxTradeUses += increment; + } + + public boolean isRecipeDisabled() + { + return this.toolUses >= this.maxTradeUses; + } + + /** + * Compensates {@link net.minecraft.village.MerchantRecipe#toolUses toolUses} with {@link + * net.minecraft.village.MerchantRecipe#maxTradeUses maxTradeUses} + */ + public void compensateToolUses() + { + this.toolUses = this.maxTradeUses; + } + + public boolean getRewardsExp() + { + return this.rewardsExp; + } + + public void readFromTags(NBTTagCompound tagCompound) + { + NBTTagCompound nbttagcompound = tagCompound.getCompoundTag("buy"); + this.itemToBuy = ItemStack.loadItemStackFromNBT(nbttagcompound); + NBTTagCompound nbttagcompound1 = tagCompound.getCompoundTag("sell"); + this.itemToSell = ItemStack.loadItemStackFromNBT(nbttagcompound1); + + if (tagCompound.hasKey("buyB", 10)) + { + this.secondItemToBuy = ItemStack.loadItemStackFromNBT(tagCompound.getCompoundTag("buyB")); + } + + if (tagCompound.hasKey("uses", 99)) + { + this.toolUses = tagCompound.getInteger("uses"); + } + + if (tagCompound.hasKey("maxUses", 99)) + { + this.maxTradeUses = tagCompound.getInteger("maxUses"); + } + else + { + this.maxTradeUses = 7; + } + + if (tagCompound.hasKey("rewardExp", 1)) + { + this.rewardsExp = tagCompound.getBoolean("rewardExp"); + } + else + { + this.rewardsExp = true; + } + } + + public NBTTagCompound writeToTags() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setTag("buy", this.itemToBuy.writeToNBT(new NBTTagCompound())); + nbttagcompound.setTag("sell", this.itemToSell.writeToNBT(new NBTTagCompound())); + + if (this.secondItemToBuy != null) + { + nbttagcompound.setTag("buyB", this.secondItemToBuy.writeToNBT(new NBTTagCompound())); + } + + nbttagcompound.setInteger("uses", this.toolUses); + nbttagcompound.setInteger("maxUses", this.maxTradeUses); + nbttagcompound.setBoolean("rewardExp", this.rewardsExp); + return nbttagcompound; + } +} diff --git a/src/minecraft/net/minecraft/village/MerchantRecipeList.java b/src/minecraft/net/minecraft/village/MerchantRecipeList.java new file mode 100644 index 0000000..d93ef49 --- /dev/null +++ b/src/minecraft/net/minecraft/village/MerchantRecipeList.java @@ -0,0 +1,133 @@ +package net.minecraft.village; + +import java.io.IOException; +import java.util.ArrayList; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.network.PacketBuffer; + +public class MerchantRecipeList extends ArrayList +{ + public MerchantRecipeList() + { + } + + public MerchantRecipeList(NBTTagCompound compound) + { + this.readRecipiesFromTags(compound); + } + + /** + * can par1,par2 be used to in crafting recipe par3 + */ + public MerchantRecipe canRecipeBeUsed(ItemStack p_77203_1_, ItemStack p_77203_2_, int p_77203_3_) + { + if (p_77203_3_ > 0 && p_77203_3_ < this.size()) + { + MerchantRecipe merchantrecipe1 = (MerchantRecipe)this.get(p_77203_3_); + return !this.func_181078_a(p_77203_1_, merchantrecipe1.getItemToBuy()) || (p_77203_2_ != null || merchantrecipe1.hasSecondItemToBuy()) && (!merchantrecipe1.hasSecondItemToBuy() || !this.func_181078_a(p_77203_2_, merchantrecipe1.getSecondItemToBuy())) || p_77203_1_.stackSize < merchantrecipe1.getItemToBuy().stackSize || merchantrecipe1.hasSecondItemToBuy() && p_77203_2_.stackSize < merchantrecipe1.getSecondItemToBuy().stackSize ? null : merchantrecipe1; + } + else + { + for (int i = 0; i < this.size(); ++i) + { + MerchantRecipe merchantrecipe = (MerchantRecipe)this.get(i); + + if (this.func_181078_a(p_77203_1_, merchantrecipe.getItemToBuy()) && p_77203_1_.stackSize >= merchantrecipe.getItemToBuy().stackSize && (!merchantrecipe.hasSecondItemToBuy() && p_77203_2_ == null || merchantrecipe.hasSecondItemToBuy() && this.func_181078_a(p_77203_2_, merchantrecipe.getSecondItemToBuy()) && p_77203_2_.stackSize >= merchantrecipe.getSecondItemToBuy().stackSize)) + { + return merchantrecipe; + } + } + + return null; + } + } + + private boolean func_181078_a(ItemStack p_181078_1_, ItemStack p_181078_2_) + { + return ItemStack.areItemsEqual(p_181078_1_, p_181078_2_) && (!p_181078_2_.hasTagCompound() || p_181078_1_.hasTagCompound() && NBTUtil.func_181123_a(p_181078_2_.getTagCompound(), p_181078_1_.getTagCompound(), false)); + } + + public void writeToBuf(PacketBuffer buffer) + { + buffer.writeByte((byte)(this.size() & 255)); + + for (int i = 0; i < this.size(); ++i) + { + MerchantRecipe merchantrecipe = (MerchantRecipe)this.get(i); + buffer.writeItemStackToBuffer(merchantrecipe.getItemToBuy()); + buffer.writeItemStackToBuffer(merchantrecipe.getItemToSell()); + ItemStack itemstack = merchantrecipe.getSecondItemToBuy(); + buffer.writeBoolean(itemstack != null); + + if (itemstack != null) + { + buffer.writeItemStackToBuffer(itemstack); + } + + buffer.writeBoolean(merchantrecipe.isRecipeDisabled()); + buffer.writeInt(merchantrecipe.getToolUses()); + buffer.writeInt(merchantrecipe.getMaxTradeUses()); + } + } + + public static MerchantRecipeList readFromBuf(PacketBuffer buffer) throws IOException + { + MerchantRecipeList merchantrecipelist = new MerchantRecipeList(); + int i = buffer.readByte() & 255; + + for (int j = 0; j < i; ++j) + { + ItemStack itemstack = buffer.readItemStackFromBuffer(); + ItemStack itemstack1 = buffer.readItemStackFromBuffer(); + ItemStack itemstack2 = null; + + if (buffer.readBoolean()) + { + itemstack2 = buffer.readItemStackFromBuffer(); + } + + boolean flag = buffer.readBoolean(); + int k = buffer.readInt(); + int l = buffer.readInt(); + MerchantRecipe merchantrecipe = new MerchantRecipe(itemstack, itemstack2, itemstack1, k, l); + + if (flag) + { + merchantrecipe.compensateToolUses(); + } + + merchantrecipelist.add(merchantrecipe); + } + + return merchantrecipelist; + } + + public void readRecipiesFromTags(NBTTagCompound compound) + { + NBTTagList nbttaglist = compound.getTagList("Recipes", 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + this.add(new MerchantRecipe(nbttagcompound)); + } + } + + public NBTTagCompound getRecipiesAsTags() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + NBTTagList nbttaglist = new NBTTagList(); + + for (int i = 0; i < this.size(); ++i) + { + MerchantRecipe merchantrecipe = (MerchantRecipe)this.get(i); + nbttaglist.appendTag(merchantrecipe.writeToTags()); + } + + nbttagcompound.setTag("Recipes", nbttaglist); + return nbttagcompound; + } +} diff --git a/src/minecraft/net/minecraft/village/Village.java b/src/minecraft/net/minecraft/village/Village.java new file mode 100644 index 0000000..bf5bcfc --- /dev/null +++ b/src/minecraft/net/minecraft/village/Village.java @@ -0,0 +1,582 @@ +package net.minecraft.village; + +import com.google.common.collect.Lists; +import com.mojang.authlib.GameProfile; +import java.util.Iterator; +import java.util.List; +import java.util.TreeMap; +import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.material.Material; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.management.PlayerProfileCache; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class Village +{ + private World worldObj; + private final List villageDoorInfoList = Lists.newArrayList(); + + /** + * This is the sum of all door coordinates and used to calculate the actual village center by dividing by the number + * of doors. + */ + private BlockPos centerHelper = BlockPos.ORIGIN; + + /** This is the actual village center. */ + private BlockPos center = BlockPos.ORIGIN; + private int villageRadius; + private int lastAddDoorTimestamp; + private int tickCounter; + private int numVillagers; + + /** Timestamp of tick count when villager last bred */ + private int noBreedTicks; + private TreeMap playerReputation = new TreeMap(); + private List villageAgressors = Lists.newArrayList(); + private int numIronGolems; + + public Village() + { + } + + public Village(World worldIn) + { + this.worldObj = worldIn; + } + + public void setWorld(World worldIn) + { + this.worldObj = worldIn; + } + + /** + * Called periodically by VillageCollection + */ + public void tick(int p_75560_1_) + { + this.tickCounter = p_75560_1_; + this.removeDeadAndOutOfRangeDoors(); + this.removeDeadAndOldAgressors(); + + if (p_75560_1_ % 20 == 0) + { + this.updateNumVillagers(); + } + + if (p_75560_1_ % 30 == 0) + { + this.updateNumIronGolems(); + } + + int i = this.numVillagers / 10; + + if (this.numIronGolems < i && this.villageDoorInfoList.size() > 20 && this.worldObj.rand.nextInt(7000) == 0) + { + Vec3 vec3 = this.func_179862_a(this.center, 2, 4, 2); + + if (vec3 != null) + { + EntityIronGolem entityirongolem = new EntityIronGolem(this.worldObj); + entityirongolem.setPosition(vec3.xCoord, vec3.yCoord, vec3.zCoord); + this.worldObj.spawnEntityInWorld(entityirongolem); + ++this.numIronGolems; + } + } + } + + private Vec3 func_179862_a(BlockPos p_179862_1_, int p_179862_2_, int p_179862_3_, int p_179862_4_) + { + for (int i = 0; i < 10; ++i) + { + BlockPos blockpos = p_179862_1_.add(this.worldObj.rand.nextInt(16) - 8, this.worldObj.rand.nextInt(6) - 3, this.worldObj.rand.nextInt(16) - 8); + + if (this.func_179866_a(blockpos) && this.func_179861_a(new BlockPos(p_179862_2_, p_179862_3_, p_179862_4_), blockpos)) + { + return new Vec3((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ()); + } + } + + return null; + } + + private boolean func_179861_a(BlockPos p_179861_1_, BlockPos p_179861_2_) + { + if (!World.doesBlockHaveSolidTopSurface(this.worldObj, p_179861_2_.down())) + { + return false; + } + else + { + int i = p_179861_2_.getX() - p_179861_1_.getX() / 2; + int j = p_179861_2_.getZ() - p_179861_1_.getZ() / 2; + + for (int k = i; k < i + p_179861_1_.getX(); ++k) + { + for (int l = p_179861_2_.getY(); l < p_179861_2_.getY() + p_179861_1_.getY(); ++l) + { + for (int i1 = j; i1 < j + p_179861_1_.getZ(); ++i1) + { + if (this.worldObj.getBlockState(new BlockPos(k, l, i1)).getBlock().isNormalCube()) + { + return false; + } + } + } + } + + return true; + } + } + + private void updateNumIronGolems() + { + List list = this.worldObj.getEntitiesWithinAABB(EntityIronGolem.class, new AxisAlignedBB((double)(this.center.getX() - this.villageRadius), (double)(this.center.getY() - 4), (double)(this.center.getZ() - this.villageRadius), (double)(this.center.getX() + this.villageRadius), (double)(this.center.getY() + 4), (double)(this.center.getZ() + this.villageRadius))); + this.numIronGolems = list.size(); + } + + private void updateNumVillagers() + { + List list = this.worldObj.getEntitiesWithinAABB(EntityVillager.class, new AxisAlignedBB((double)(this.center.getX() - this.villageRadius), (double)(this.center.getY() - 4), (double)(this.center.getZ() - this.villageRadius), (double)(this.center.getX() + this.villageRadius), (double)(this.center.getY() + 4), (double)(this.center.getZ() + this.villageRadius))); + this.numVillagers = list.size(); + + if (this.numVillagers == 0) + { + this.playerReputation.clear(); + } + } + + public BlockPos getCenter() + { + return this.center; + } + + public int getVillageRadius() + { + return this.villageRadius; + } + + /** + * Actually get num village door info entries, but that boils down to number of doors. Called by + * EntityAIVillagerMate and VillageSiege + */ + public int getNumVillageDoors() + { + return this.villageDoorInfoList.size(); + } + + public int getTicksSinceLastDoorAdding() + { + return this.tickCounter - this.lastAddDoorTimestamp; + } + + public int getNumVillagers() + { + return this.numVillagers; + } + + public boolean func_179866_a(BlockPos pos) + { + return this.center.distanceSq(pos) < (double)(this.villageRadius * this.villageRadius); + } + + public List getVillageDoorInfoList() + { + return this.villageDoorInfoList; + } + + public VillageDoorInfo getNearestDoor(BlockPos pos) + { + VillageDoorInfo villagedoorinfo = null; + int i = Integer.MAX_VALUE; + + for (VillageDoorInfo villagedoorinfo1 : this.villageDoorInfoList) + { + int j = villagedoorinfo1.getDistanceToDoorBlockSq(pos); + + if (j < i) + { + villagedoorinfo = villagedoorinfo1; + i = j; + } + } + + return villagedoorinfo; + } + + /** + * Returns {@link net.minecraft.village.VillageDoorInfo VillageDoorInfo} from given block position + */ + public VillageDoorInfo getDoorInfo(BlockPos pos) + { + VillageDoorInfo villagedoorinfo = null; + int i = Integer.MAX_VALUE; + + for (VillageDoorInfo villagedoorinfo1 : this.villageDoorInfoList) + { + int j = villagedoorinfo1.getDistanceToDoorBlockSq(pos); + + if (j > 256) + { + j = j * 1000; + } + else + { + j = villagedoorinfo1.getDoorOpeningRestrictionCounter(); + } + + if (j < i) + { + villagedoorinfo = villagedoorinfo1; + i = j; + } + } + + return villagedoorinfo; + } + + /** + * if door not existed in this village, null will be returned + */ + public VillageDoorInfo getExistedDoor(BlockPos doorBlock) + { + if (this.center.distanceSq(doorBlock) > (double)(this.villageRadius * this.villageRadius)) + { + return null; + } + else + { + for (VillageDoorInfo villagedoorinfo : this.villageDoorInfoList) + { + if (villagedoorinfo.getDoorBlockPos().getX() == doorBlock.getX() && villagedoorinfo.getDoorBlockPos().getZ() == doorBlock.getZ() && Math.abs(villagedoorinfo.getDoorBlockPos().getY() - doorBlock.getY()) <= 1) + { + return villagedoorinfo; + } + } + + return null; + } + } + + public void addVillageDoorInfo(VillageDoorInfo doorInfo) + { + this.villageDoorInfoList.add(doorInfo); + this.centerHelper = this.centerHelper.add(doorInfo.getDoorBlockPos()); + this.updateVillageRadiusAndCenter(); + this.lastAddDoorTimestamp = doorInfo.getInsidePosY(); + } + + /** + * Returns true, if there is not a single village door left. Called by VillageCollection + */ + public boolean isAnnihilated() + { + return this.villageDoorInfoList.isEmpty(); + } + + public void addOrRenewAgressor(EntityLivingBase entitylivingbaseIn) + { + for (Village.VillageAggressor village$villageaggressor : this.villageAgressors) + { + if (village$villageaggressor.agressor == entitylivingbaseIn) + { + village$villageaggressor.agressionTime = this.tickCounter; + return; + } + } + + this.villageAgressors.add(new Village.VillageAggressor(entitylivingbaseIn, this.tickCounter)); + } + + public EntityLivingBase findNearestVillageAggressor(EntityLivingBase entitylivingbaseIn) + { + double d0 = Double.MAX_VALUE; + Village.VillageAggressor village$villageaggressor = null; + + for (int i = 0; i < this.villageAgressors.size(); ++i) + { + Village.VillageAggressor village$villageaggressor1 = (Village.VillageAggressor)this.villageAgressors.get(i); + double d1 = village$villageaggressor1.agressor.getDistanceSqToEntity(entitylivingbaseIn); + + if (d1 <= d0) + { + village$villageaggressor = village$villageaggressor1; + d0 = d1; + } + } + + return village$villageaggressor != null ? village$villageaggressor.agressor : null; + } + + public EntityPlayer getNearestTargetPlayer(EntityLivingBase villageDefender) + { + double d0 = Double.MAX_VALUE; + EntityPlayer entityplayer = null; + + for (String s : this.playerReputation.keySet()) + { + if (this.isPlayerReputationTooLow(s)) + { + EntityPlayer entityplayer1 = this.worldObj.getPlayerEntityByName(s); + + if (entityplayer1 != null) + { + double d1 = entityplayer1.getDistanceSqToEntity(villageDefender); + + if (d1 <= d0) + { + entityplayer = entityplayer1; + d0 = d1; + } + } + } + } + + return entityplayer; + } + + private void removeDeadAndOldAgressors() + { + Iterator iterator = this.villageAgressors.iterator(); + + while (iterator.hasNext()) + { + Village.VillageAggressor village$villageaggressor = (Village.VillageAggressor)iterator.next(); + + if (!village$villageaggressor.agressor.isEntityAlive() || Math.abs(this.tickCounter - village$villageaggressor.agressionTime) > 300) + { + iterator.remove(); + } + } + } + + private void removeDeadAndOutOfRangeDoors() + { + boolean flag = false; + boolean flag1 = this.worldObj.rand.nextInt(50) == 0; + Iterator iterator = this.villageDoorInfoList.iterator(); + + while (iterator.hasNext()) + { + VillageDoorInfo villagedoorinfo = (VillageDoorInfo)iterator.next(); + + if (flag1) + { + villagedoorinfo.resetDoorOpeningRestrictionCounter(); + } + + if (!this.isWoodDoor(villagedoorinfo.getDoorBlockPos()) || Math.abs(this.tickCounter - villagedoorinfo.getInsidePosY()) > 1200) + { + this.centerHelper = this.centerHelper.subtract(villagedoorinfo.getDoorBlockPos()); + flag = true; + villagedoorinfo.setIsDetachedFromVillageFlag(true); + iterator.remove(); + } + } + + if (flag) + { + this.updateVillageRadiusAndCenter(); + } + } + + private boolean isWoodDoor(BlockPos pos) + { + Block block = this.worldObj.getBlockState(pos).getBlock(); + return block instanceof BlockDoor ? block.getMaterial() == Material.wood : false; + } + + private void updateVillageRadiusAndCenter() + { + int i = this.villageDoorInfoList.size(); + + if (i == 0) + { + this.center = new BlockPos(0, 0, 0); + this.villageRadius = 0; + } + else + { + this.center = new BlockPos(this.centerHelper.getX() / i, this.centerHelper.getY() / i, this.centerHelper.getZ() / i); + int j = 0; + + for (VillageDoorInfo villagedoorinfo : this.villageDoorInfoList) + { + j = Math.max(villagedoorinfo.getDistanceToDoorBlockSq(this.center), j); + } + + this.villageRadius = Math.max(32, (int)Math.sqrt((double)j) + 1); + } + } + + /** + * Return the village reputation for a player + */ + public int getReputationForPlayer(String p_82684_1_) + { + Integer integer = (Integer)this.playerReputation.get(p_82684_1_); + return integer != null ? integer.intValue() : 0; + } + + /** + * Set the village reputation for a player. + */ + public int setReputationForPlayer(String p_82688_1_, int p_82688_2_) + { + int i = this.getReputationForPlayer(p_82688_1_); + int j = MathHelper.clamp_int(i + p_82688_2_, -30, 10); + this.playerReputation.put(p_82688_1_, Integer.valueOf(j)); + return j; + } + + /** + * Return whether this player has a too low reputation with this village. + */ + public boolean isPlayerReputationTooLow(String p_82687_1_) + { + return this.getReputationForPlayer(p_82687_1_) <= -15; + } + + /** + * Read this village's data from NBT. + */ + public void readVillageDataFromNBT(NBTTagCompound p_82690_1_) + { + this.numVillagers = p_82690_1_.getInteger("PopSize"); + this.villageRadius = p_82690_1_.getInteger("Radius"); + this.numIronGolems = p_82690_1_.getInteger("Golems"); + this.lastAddDoorTimestamp = p_82690_1_.getInteger("Stable"); + this.tickCounter = p_82690_1_.getInteger("Tick"); + this.noBreedTicks = p_82690_1_.getInteger("MTick"); + this.center = new BlockPos(p_82690_1_.getInteger("CX"), p_82690_1_.getInteger("CY"), p_82690_1_.getInteger("CZ")); + this.centerHelper = new BlockPos(p_82690_1_.getInteger("ACX"), p_82690_1_.getInteger("ACY"), p_82690_1_.getInteger("ACZ")); + NBTTagList nbttaglist = p_82690_1_.getTagList("Doors", 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + VillageDoorInfo villagedoorinfo = new VillageDoorInfo(new BlockPos(nbttagcompound.getInteger("X"), nbttagcompound.getInteger("Y"), nbttagcompound.getInteger("Z")), nbttagcompound.getInteger("IDX"), nbttagcompound.getInteger("IDZ"), nbttagcompound.getInteger("TS")); + this.villageDoorInfoList.add(villagedoorinfo); + } + + NBTTagList nbttaglist1 = p_82690_1_.getTagList("Players", 10); + + for (int j = 0; j < nbttaglist1.tagCount(); ++j) + { + NBTTagCompound nbttagcompound1 = nbttaglist1.getCompoundTagAt(j); + + if (nbttagcompound1.hasKey("UUID")) + { + PlayerProfileCache playerprofilecache = MinecraftServer.getServer().getPlayerProfileCache(); + GameProfile gameprofile = playerprofilecache.getProfileByUUID(UUID.fromString(nbttagcompound1.getString("UUID"))); + + if (gameprofile != null) + { + this.playerReputation.put(gameprofile.getName(), Integer.valueOf(nbttagcompound1.getInteger("S"))); + } + } + else + { + this.playerReputation.put(nbttagcompound1.getString("Name"), Integer.valueOf(nbttagcompound1.getInteger("S"))); + } + } + } + + /** + * Write this village's data to NBT. + */ + public void writeVillageDataToNBT(NBTTagCompound p_82689_1_) + { + p_82689_1_.setInteger("PopSize", this.numVillagers); + p_82689_1_.setInteger("Radius", this.villageRadius); + p_82689_1_.setInteger("Golems", this.numIronGolems); + p_82689_1_.setInteger("Stable", this.lastAddDoorTimestamp); + p_82689_1_.setInteger("Tick", this.tickCounter); + p_82689_1_.setInteger("MTick", this.noBreedTicks); + p_82689_1_.setInteger("CX", this.center.getX()); + p_82689_1_.setInteger("CY", this.center.getY()); + p_82689_1_.setInteger("CZ", this.center.getZ()); + p_82689_1_.setInteger("ACX", this.centerHelper.getX()); + p_82689_1_.setInteger("ACY", this.centerHelper.getY()); + p_82689_1_.setInteger("ACZ", this.centerHelper.getZ()); + NBTTagList nbttaglist = new NBTTagList(); + + for (VillageDoorInfo villagedoorinfo : this.villageDoorInfoList) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("X", villagedoorinfo.getDoorBlockPos().getX()); + nbttagcompound.setInteger("Y", villagedoorinfo.getDoorBlockPos().getY()); + nbttagcompound.setInteger("Z", villagedoorinfo.getDoorBlockPos().getZ()); + nbttagcompound.setInteger("IDX", villagedoorinfo.getInsideOffsetX()); + nbttagcompound.setInteger("IDZ", villagedoorinfo.getInsideOffsetZ()); + nbttagcompound.setInteger("TS", villagedoorinfo.getInsidePosY()); + nbttaglist.appendTag(nbttagcompound); + } + + p_82689_1_.setTag("Doors", nbttaglist); + NBTTagList nbttaglist1 = new NBTTagList(); + + for (String s : this.playerReputation.keySet()) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + PlayerProfileCache playerprofilecache = MinecraftServer.getServer().getPlayerProfileCache(); + GameProfile gameprofile = playerprofilecache.getGameProfileForUsername(s); + + if (gameprofile != null) + { + nbttagcompound1.setString("UUID", gameprofile.getId().toString()); + nbttagcompound1.setInteger("S", ((Integer)this.playerReputation.get(s)).intValue()); + nbttaglist1.appendTag(nbttagcompound1); + } + } + + p_82689_1_.setTag("Players", nbttaglist1); + } + + /** + * Prevent villager breeding for a fixed interval of time + */ + public void endMatingSeason() + { + this.noBreedTicks = this.tickCounter; + } + + /** + * Return whether villagers mating refractory period has passed + */ + public boolean isMatingSeason() + { + return this.noBreedTicks == 0 || this.tickCounter - this.noBreedTicks >= 3600; + } + + public void setDefaultPlayerReputation(int p_82683_1_) + { + for (String s : this.playerReputation.keySet()) + { + this.setReputationForPlayer(s, p_82683_1_); + } + } + + class VillageAggressor + { + public EntityLivingBase agressor; + public int agressionTime; + + VillageAggressor(EntityLivingBase p_i1674_2_, int p_i1674_3_) + { + this.agressor = p_i1674_2_; + this.agressionTime = p_i1674_3_; + } + } +} diff --git a/src/minecraft/net/minecraft/village/VillageCollection.java b/src/minecraft/net/minecraft/village/VillageCollection.java new file mode 100644 index 0000000..e471870 --- /dev/null +++ b/src/minecraft/net/minecraft/village/VillageCollection.java @@ -0,0 +1,305 @@ +package net.minecraft.village; + +import com.google.common.collect.Lists; +import java.util.Iterator; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.material.Material; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldSavedData; + +public class VillageCollection extends WorldSavedData +{ + private World worldObj; + private final List villagerPositionsList = Lists.newArrayList(); + private final List newDoors = Lists.newArrayList(); + private final List villageList = Lists.newArrayList(); + private int tickCounter; + + public VillageCollection(String name) + { + super(name); + } + + public VillageCollection(World worldIn) + { + super(fileNameForProvider(worldIn.provider)); + this.worldObj = worldIn; + this.markDirty(); + } + + public void setWorldsForAll(World worldIn) + { + this.worldObj = worldIn; + + for (Village village : this.villageList) + { + village.setWorld(worldIn); + } + } + + public void addToVillagerPositionList(BlockPos pos) + { + if (this.villagerPositionsList.size() <= 64) + { + if (!this.positionInList(pos)) + { + this.villagerPositionsList.add(pos); + } + } + } + + /** + * Runs a single tick for the village collection + */ + public void tick() + { + ++this.tickCounter; + + for (Village village : this.villageList) + { + village.tick(this.tickCounter); + } + + this.removeAnnihilatedVillages(); + this.dropOldestVillagerPosition(); + this.addNewDoorsToVillageOrCreateVillage(); + + if (this.tickCounter % 400 == 0) + { + this.markDirty(); + } + } + + private void removeAnnihilatedVillages() + { + Iterator iterator = this.villageList.iterator(); + + while (iterator.hasNext()) + { + Village village = (Village)iterator.next(); + + if (village.isAnnihilated()) + { + iterator.remove(); + this.markDirty(); + } + } + } + + public List getVillageList() + { + return this.villageList; + } + + public Village getNearestVillage(BlockPos doorBlock, int radius) + { + Village village = null; + double d0 = 3.4028234663852886E38D; + + for (Village village1 : this.villageList) + { + double d1 = village1.getCenter().distanceSq(doorBlock); + + if (d1 < d0) + { + float f = (float)(radius + village1.getVillageRadius()); + + if (d1 <= (double)(f * f)) + { + village = village1; + d0 = d1; + } + } + } + + return village; + } + + private void dropOldestVillagerPosition() + { + if (!this.villagerPositionsList.isEmpty()) + { + this.addDoorsAround((BlockPos)this.villagerPositionsList.remove(0)); + } + } + + private void addNewDoorsToVillageOrCreateVillage() + { + for (int i = 0; i < this.newDoors.size(); ++i) + { + VillageDoorInfo villagedoorinfo = (VillageDoorInfo)this.newDoors.get(i); + Village village = this.getNearestVillage(villagedoorinfo.getDoorBlockPos(), 32); + + if (village == null) + { + village = new Village(this.worldObj); + this.villageList.add(village); + this.markDirty(); + } + + village.addVillageDoorInfo(villagedoorinfo); + } + + this.newDoors.clear(); + } + + private void addDoorsAround(BlockPos central) + { + int i = 16; + int j = 4; + int k = 16; + + for (int l = -i; l < i; ++l) + { + for (int i1 = -j; i1 < j; ++i1) + { + for (int j1 = -k; j1 < k; ++j1) + { + BlockPos blockpos = central.add(l, i1, j1); + + if (this.isWoodDoor(blockpos)) + { + VillageDoorInfo villagedoorinfo = this.checkDoorExistence(blockpos); + + if (villagedoorinfo == null) + { + this.addToNewDoorsList(blockpos); + } + else + { + villagedoorinfo.func_179849_a(this.tickCounter); + } + } + } + } + } + } + + /** + * returns the VillageDoorInfo if it exists in any village or in the newDoor list, otherwise returns null + */ + private VillageDoorInfo checkDoorExistence(BlockPos doorBlock) + { + for (VillageDoorInfo villagedoorinfo : this.newDoors) + { + if (villagedoorinfo.getDoorBlockPos().getX() == doorBlock.getX() && villagedoorinfo.getDoorBlockPos().getZ() == doorBlock.getZ() && Math.abs(villagedoorinfo.getDoorBlockPos().getY() - doorBlock.getY()) <= 1) + { + return villagedoorinfo; + } + } + + for (Village village : this.villageList) + { + VillageDoorInfo villagedoorinfo1 = village.getExistedDoor(doorBlock); + + if (villagedoorinfo1 != null) + { + return villagedoorinfo1; + } + } + + return null; + } + + private void addToNewDoorsList(BlockPos doorBlock) + { + EnumFacing enumfacing = BlockDoor.getFacing(this.worldObj, doorBlock); + EnumFacing enumfacing1 = enumfacing.getOpposite(); + int i = this.countBlocksCanSeeSky(doorBlock, enumfacing, 5); + int j = this.countBlocksCanSeeSky(doorBlock, enumfacing1, i + 1); + + if (i != j) + { + this.newDoors.add(new VillageDoorInfo(doorBlock, i < j ? enumfacing : enumfacing1, this.tickCounter)); + } + } + + /** + * Check five blocks in the direction. The centerPos will not be checked. + */ + private int countBlocksCanSeeSky(BlockPos centerPos, EnumFacing direction, int limitation) + { + int i = 0; + + for (int j = 1; j <= 5; ++j) + { + if (this.worldObj.canSeeSky(centerPos.offset(direction, j))) + { + ++i; + + if (i >= limitation) + { + return i; + } + } + } + + return i; + } + + private boolean positionInList(BlockPos pos) + { + for (BlockPos blockpos : this.villagerPositionsList) + { + if (blockpos.equals(pos)) + { + return true; + } + } + + return false; + } + + private boolean isWoodDoor(BlockPos doorPos) + { + Block block = this.worldObj.getBlockState(doorPos).getBlock(); + return block instanceof BlockDoor ? block.getMaterial() == Material.wood : false; + } + + /** + * reads in data from the NBTTagCompound into this MapDataBase + */ + public void readFromNBT(NBTTagCompound nbt) + { + this.tickCounter = nbt.getInteger("Tick"); + NBTTagList nbttaglist = nbt.getTagList("Villages", 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + Village village = new Village(); + village.readVillageDataFromNBT(nbttagcompound); + this.villageList.add(village); + } + } + + /** + * write data to NBTTagCompound from this MapDataBase, similar to Entities and TileEntities + */ + public void writeToNBT(NBTTagCompound nbt) + { + nbt.setInteger("Tick", this.tickCounter); + NBTTagList nbttaglist = new NBTTagList(); + + for (Village village : this.villageList) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + village.writeVillageDataToNBT(nbttagcompound); + nbttaglist.appendTag(nbttagcompound); + } + + nbt.setTag("Villages", nbttaglist); + } + + public static String fileNameForProvider(WorldProvider provider) + { + return "villages" + provider.getInternalNameSuffix(); + } +} diff --git a/src/minecraft/net/minecraft/village/VillageDoorInfo.java b/src/minecraft/net/minecraft/village/VillageDoorInfo.java new file mode 100644 index 0000000..f9d2989 --- /dev/null +++ b/src/minecraft/net/minecraft/village/VillageDoorInfo.java @@ -0,0 +1,115 @@ +package net.minecraft.village; + +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; + +public class VillageDoorInfo +{ + /** a block representing the door. Could be either upper or lower part */ + private final BlockPos doorBlockPos; + private final BlockPos insideBlock; + + /** the inside direction is where can see less sky */ + private final EnumFacing insideDirection; + private int lastActivityTimestamp; + private boolean isDetachedFromVillageFlag; + private int doorOpeningRestrictionCounter; + + public VillageDoorInfo(BlockPos p_i45871_1_, int p_i45871_2_, int p_i45871_3_, int p_i45871_4_) + { + this(p_i45871_1_, getFaceDirection(p_i45871_2_, p_i45871_3_), p_i45871_4_); + } + + private static EnumFacing getFaceDirection(int deltaX, int deltaZ) + { + return deltaX < 0 ? EnumFacing.WEST : (deltaX > 0 ? EnumFacing.EAST : (deltaZ < 0 ? EnumFacing.NORTH : EnumFacing.SOUTH)); + } + + public VillageDoorInfo(BlockPos p_i45872_1_, EnumFacing p_i45872_2_, int p_i45872_3_) + { + this.doorBlockPos = p_i45872_1_; + this.insideDirection = p_i45872_2_; + this.insideBlock = p_i45872_1_.offset(p_i45872_2_, 2); + this.lastActivityTimestamp = p_i45872_3_; + } + + /** + * Returns the squared distance between this door and the given coordinate. + */ + public int getDistanceSquared(int p_75474_1_, int p_75474_2_, int p_75474_3_) + { + return (int)this.doorBlockPos.distanceSq((double)p_75474_1_, (double)p_75474_2_, (double)p_75474_3_); + } + + public int getDistanceToDoorBlockSq(BlockPos p_179848_1_) + { + return (int)p_179848_1_.distanceSq(this.getDoorBlockPos()); + } + + public int getDistanceToInsideBlockSq(BlockPos p_179846_1_) + { + return (int)this.insideBlock.distanceSq(p_179846_1_); + } + + public boolean func_179850_c(BlockPos p_179850_1_) + { + int i = p_179850_1_.getX() - this.doorBlockPos.getX(); + int j = p_179850_1_.getZ() - this.doorBlockPos.getY(); + return i * this.insideDirection.getFrontOffsetX() + j * this.insideDirection.getFrontOffsetZ() >= 0; + } + + public void resetDoorOpeningRestrictionCounter() + { + this.doorOpeningRestrictionCounter = 0; + } + + public void incrementDoorOpeningRestrictionCounter() + { + ++this.doorOpeningRestrictionCounter; + } + + public int getDoorOpeningRestrictionCounter() + { + return this.doorOpeningRestrictionCounter; + } + + public BlockPos getDoorBlockPos() + { + return this.doorBlockPos; + } + + public BlockPos getInsideBlockPos() + { + return this.insideBlock; + } + + public int getInsideOffsetX() + { + return this.insideDirection.getFrontOffsetX() * 2; + } + + public int getInsideOffsetZ() + { + return this.insideDirection.getFrontOffsetZ() * 2; + } + + public int getInsidePosY() + { + return this.lastActivityTimestamp; + } + + public void func_179849_a(int p_179849_1_) + { + this.lastActivityTimestamp = p_179849_1_; + } + + public boolean getIsDetachedFromVillageFlag() + { + return this.isDetachedFromVillageFlag; + } + + public void setIsDetachedFromVillageFlag(boolean p_179853_1_) + { + this.isDetachedFromVillageFlag = p_179853_1_; + } +} diff --git a/src/minecraft/net/minecraft/village/VillageSiege.java b/src/minecraft/net/minecraft/village/VillageSiege.java new file mode 100644 index 0000000..ac1ec75 --- /dev/null +++ b/src/minecraft/net/minecraft/village/VillageSiege.java @@ -0,0 +1,210 @@ +package net.minecraft.village; + +import java.util.Iterator; +import java.util.List; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.SpawnerAnimals; +import net.minecraft.world.World; + +public class VillageSiege +{ + private World worldObj; + private boolean field_75535_b; + private int field_75536_c = -1; + private int field_75533_d; + private int field_75534_e; + + /** Instance of Village. */ + private Village theVillage; + private int field_75532_g; + private int field_75538_h; + private int field_75539_i; + + public VillageSiege(World worldIn) + { + this.worldObj = worldIn; + } + + /** + * Runs a single tick for the village siege + */ + public void tick() + { + if (this.worldObj.isDaytime()) + { + this.field_75536_c = 0; + } + else if (this.field_75536_c != 2) + { + if (this.field_75536_c == 0) + { + float f = this.worldObj.getCelestialAngle(0.0F); + + if ((double)f < 0.5D || (double)f > 0.501D) + { + return; + } + + this.field_75536_c = this.worldObj.rand.nextInt(10) == 0 ? 1 : 2; + this.field_75535_b = false; + + if (this.field_75536_c == 2) + { + return; + } + } + + if (this.field_75536_c != -1) + { + if (!this.field_75535_b) + { + if (!this.func_75529_b()) + { + return; + } + + this.field_75535_b = true; + } + + if (this.field_75534_e > 0) + { + --this.field_75534_e; + } + else + { + this.field_75534_e = 2; + + if (this.field_75533_d > 0) + { + this.spawnZombie(); + --this.field_75533_d; + } + else + { + this.field_75536_c = 2; + } + } + } + } + } + + private boolean func_75529_b() + { + List list = this.worldObj.playerEntities; + Iterator iterator = list.iterator(); + + while (true) + { + if (!iterator.hasNext()) + { + return false; + } + + EntityPlayer entityplayer = (EntityPlayer)iterator.next(); + + if (!entityplayer.isSpectator()) + { + this.theVillage = this.worldObj.getVillageCollection().getNearestVillage(new BlockPos(entityplayer), 1); + + if (this.theVillage != null && this.theVillage.getNumVillageDoors() >= 10 && this.theVillage.getTicksSinceLastDoorAdding() >= 20 && this.theVillage.getNumVillagers() >= 20) + { + BlockPos blockpos = this.theVillage.getCenter(); + float f = (float)this.theVillage.getVillageRadius(); + boolean flag = false; + + for (int i = 0; i < 10; ++i) + { + float f1 = this.worldObj.rand.nextFloat() * (float)Math.PI * 2.0F; + this.field_75532_g = blockpos.getX() + (int)((double)(MathHelper.cos(f1) * f) * 0.9D); + this.field_75538_h = blockpos.getY(); + this.field_75539_i = blockpos.getZ() + (int)((double)(MathHelper.sin(f1) * f) * 0.9D); + flag = false; + + for (Village village : this.worldObj.getVillageCollection().getVillageList()) + { + if (village != this.theVillage && village.func_179866_a(new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i))) + { + flag = true; + break; + } + } + + if (!flag) + { + break; + } + } + + if (flag) + { + return false; + } + + Vec3 vec3 = this.func_179867_a(new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i)); + + if (vec3 != null) + { + break; + } + } + } + } + + this.field_75534_e = 0; + this.field_75533_d = 20; + return true; + } + + private boolean spawnZombie() + { + Vec3 vec3 = this.func_179867_a(new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i)); + + if (vec3 == null) + { + return false; + } + else + { + EntityZombie entityzombie; + + try + { + entityzombie = new EntityZombie(this.worldObj); + entityzombie.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null); + entityzombie.setVillager(false); + } + catch (Exception exception) + { + exception.printStackTrace(); + return false; + } + + entityzombie.setLocationAndAngles(vec3.xCoord, vec3.yCoord, vec3.zCoord, this.worldObj.rand.nextFloat() * 360.0F, 0.0F); + this.worldObj.spawnEntityInWorld(entityzombie); + BlockPos blockpos = this.theVillage.getCenter(); + entityzombie.setHomePosAndDistance(blockpos, this.theVillage.getVillageRadius()); + return true; + } + } + + private Vec3 func_179867_a(BlockPos p_179867_1_) + { + for (int i = 0; i < 10; ++i) + { + BlockPos blockpos = p_179867_1_.add(this.worldObj.rand.nextInt(16) - 8, this.worldObj.rand.nextInt(6) - 3, this.worldObj.rand.nextInt(16) - 8); + + if (this.theVillage.func_179866_a(blockpos) && SpawnerAnimals.canCreatureTypeSpawnAtLocation(EntityLiving.SpawnPlacementType.ON_GROUND, this.worldObj, blockpos)) + { + return new Vec3((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ()); + } + } + + return null; + } +} diff --git a/src/minecraft/net/minecraft/world/ChunkCache.java b/src/minecraft/net/minecraft/world/ChunkCache.java new file mode 100644 index 0000000..27a01da --- /dev/null +++ b/src/minecraft/net/minecraft/world/ChunkCache.java @@ -0,0 +1,185 @@ +package net.minecraft.world; + +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; + +public class ChunkCache implements IBlockAccess +{ + protected int chunkX; + protected int chunkZ; + protected Chunk[][] chunkArray; + + /** set by !chunk.getAreLevelsEmpty */ + protected boolean hasExtendedLevels; + + /** Reference to the World object. */ + protected World worldObj; + + public ChunkCache(World worldIn, BlockPos posFromIn, BlockPos posToIn, int subIn) + { + this.worldObj = worldIn; + this.chunkX = posFromIn.getX() - subIn >> 4; + this.chunkZ = posFromIn.getZ() - subIn >> 4; + int i = posToIn.getX() + subIn >> 4; + int j = posToIn.getZ() + subIn >> 4; + this.chunkArray = new Chunk[i - this.chunkX + 1][j - this.chunkZ + 1]; + this.hasExtendedLevels = true; + + for (int k = this.chunkX; k <= i; ++k) + { + for (int l = this.chunkZ; l <= j; ++l) + { + this.chunkArray[k - this.chunkX][l - this.chunkZ] = worldIn.getChunkFromChunkCoords(k, l); + } + } + + for (int i1 = posFromIn.getX() >> 4; i1 <= posToIn.getX() >> 4; ++i1) + { + for (int j1 = posFromIn.getZ() >> 4; j1 <= posToIn.getZ() >> 4; ++j1) + { + Chunk chunk = this.chunkArray[i1 - this.chunkX][j1 - this.chunkZ]; + + if (chunk != null && !chunk.getAreLevelsEmpty(posFromIn.getY(), posToIn.getY())) + { + this.hasExtendedLevels = false; + } + } + } + } + + /** + * set by !chunk.getAreLevelsEmpty + */ + public boolean extendedLevelsInChunkCache() + { + return this.hasExtendedLevels; + } + + public TileEntity getTileEntity(BlockPos pos) + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; + return this.chunkArray[i][j].getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE); + } + + public int getCombinedLight(BlockPos pos, int lightValue) + { + int i = this.getLightForExt(EnumSkyBlock.SKY, pos); + int j = this.getLightForExt(EnumSkyBlock.BLOCK, pos); + + if (j < lightValue) + { + j = lightValue; + } + + return i << 20 | j << 4; + } + + public IBlockState getBlockState(BlockPos pos) + { + if (pos.getY() >= 0 && pos.getY() < 256) + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; + + if (i >= 0 && i < this.chunkArray.length && j >= 0 && j < this.chunkArray[i].length) + { + Chunk chunk = this.chunkArray[i][j]; + + if (chunk != null) + { + return chunk.getBlockState(pos); + } + } + } + + return Blocks.air.getDefaultState(); + } + + public BiomeGenBase getBiomeGenForCoords(BlockPos pos) + { + return this.worldObj.getBiomeGenForCoords(pos); + } + + private int getLightForExt(EnumSkyBlock p_175629_1_, BlockPos pos) + { + if (p_175629_1_ == EnumSkyBlock.SKY && this.worldObj.provider.getHasNoSky()) + { + return 0; + } + else if (pos.getY() >= 0 && pos.getY() < 256) + { + if (this.getBlockState(pos).getBlock().getUseNeighborBrightness()) + { + int l = 0; + + for (EnumFacing enumfacing : EnumFacing.values()) + { + int k = this.getLightFor(p_175629_1_, pos.offset(enumfacing)); + + if (k > l) + { + l = k; + } + + if (l >= 15) + { + return l; + } + } + + return l; + } + else + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; + return this.chunkArray[i][j].getLightFor(p_175629_1_, pos); + } + } + else + { + return p_175629_1_.defaultLightValue; + } + } + + /** + * Checks to see if an air block exists at the provided location. Note that this only checks to see if the blocks + * material is set to air, meaning it is possible for non-vanilla blocks to still pass this check. + */ + public boolean isAirBlock(BlockPos pos) + { + return this.getBlockState(pos).getBlock().getMaterial() == Material.air; + } + + public int getLightFor(EnumSkyBlock p_175628_1_, BlockPos pos) + { + if (pos.getY() >= 0 && pos.getY() < 256) + { + int i = (pos.getX() >> 4) - this.chunkX; + int j = (pos.getZ() >> 4) - this.chunkZ; + return this.chunkArray[i][j].getLightFor(p_175628_1_, pos); + } + else + { + return p_175628_1_.defaultLightValue; + } + } + + public int getStrongPower(BlockPos pos, EnumFacing direction) + { + IBlockState iblockstate = this.getBlockState(pos); + return iblockstate.getBlock().getStrongPower(this, pos, iblockstate, direction); + } + + public WorldType getWorldType() + { + return this.worldObj.getWorldType(); + } +} diff --git a/src/minecraft/net/minecraft/world/ChunkCoordIntPair.java b/src/minecraft/net/minecraft/world/ChunkCoordIntPair.java new file mode 100644 index 0000000..3a8042e --- /dev/null +++ b/src/minecraft/net/minecraft/world/ChunkCoordIntPair.java @@ -0,0 +1,120 @@ +package net.minecraft.world; + +import net.minecraft.util.BlockPos; + +public class ChunkCoordIntPair +{ + /** The X position of this Chunk Coordinate Pair */ + public final int chunkXPos; + + /** The Z position of this Chunk Coordinate Pair */ + public final int chunkZPos; + private static final String __OBFID = "CL_00000133"; + private int cachedHashCode = 0; + + public ChunkCoordIntPair(int x, int z) + { + this.chunkXPos = x; + this.chunkZPos = z; + } + + /** + * converts a chunk coordinate pair to an integer (suitable for hashing) + */ + public static long chunkXZ2Int(int x, int z) + { + return (long)x & 4294967295L | ((long)z & 4294967295L) << 32; + } + + public int hashCode() + { + if (this.cachedHashCode == 0) + { + int i = 1664525 * this.chunkXPos + 1013904223; + int j = 1664525 * (this.chunkZPos ^ -559038737) + 1013904223; + this.cachedHashCode = i ^ j; + } + + return this.cachedHashCode; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (!(p_equals_1_ instanceof ChunkCoordIntPair)) + { + return false; + } + else + { + ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair)p_equals_1_; + return this.chunkXPos == chunkcoordintpair.chunkXPos && this.chunkZPos == chunkcoordintpair.chunkZPos; + } + } + + public int getCenterXPos() + { + return (this.chunkXPos << 4) + 8; + } + + public int getCenterZPosition() + { + return (this.chunkZPos << 4) + 8; + } + + /** + * Get the first world X coordinate that belongs to this Chunk + */ + public int getXStart() + { + return this.chunkXPos << 4; + } + + /** + * Get the first world Z coordinate that belongs to this Chunk + */ + public int getZStart() + { + return this.chunkZPos << 4; + } + + /** + * Get the last world X coordinate that belongs to this Chunk + */ + public int getXEnd() + { + return (this.chunkXPos << 4) + 15; + } + + /** + * Get the last world Z coordinate that belongs to this Chunk + */ + public int getZEnd() + { + return (this.chunkZPos << 4) + 15; + } + + /** + * Get the World coordinates of the Block with the given Chunk coordinates relative to this chunk + */ + public BlockPos getBlock(int x, int y, int z) + { + return new BlockPos((this.chunkXPos << 4) + x, y, (this.chunkZPos << 4) + z); + } + + /** + * Get the coordinates of the Block in the center of this chunk with the given Y coordinate + */ + public BlockPos getCenterBlock(int y) + { + return new BlockPos(this.getCenterXPos(), y, this.getCenterZPosition()); + } + + public String toString() + { + return "[" + this.chunkXPos + ", " + this.chunkZPos + "]"; + } +} diff --git a/src/minecraft/net/minecraft/world/ColorizerFoliage.java b/src/minecraft/net/minecraft/world/ColorizerFoliage.java new file mode 100644 index 0000000..523b6b5 --- /dev/null +++ b/src/minecraft/net/minecraft/world/ColorizerFoliage.java @@ -0,0 +1,44 @@ +package net.minecraft.world; + +public class ColorizerFoliage +{ + /** Color buffer for foliage */ + private static int[] foliageBuffer = new int[65536]; + + public static void setFoliageBiomeColorizer(int[] p_77467_0_) + { + foliageBuffer = p_77467_0_; + } + + /** + * Gets foliage color from temperature and humidity. Args: temperature, humidity + */ + public static int getFoliageColor(double p_77470_0_, double p_77470_2_) + { + p_77470_2_ = p_77470_2_ * p_77470_0_; + int i = (int)((1.0D - p_77470_0_) * 255.0D); + int j = (int)((1.0D - p_77470_2_) * 255.0D); + return foliageBuffer[j << 8 | i]; + } + + /** + * Gets the foliage color for pine type (metadata 1) trees + */ + public static int getFoliageColorPine() + { + return 6396257; + } + + /** + * Gets the foliage color for birch type (metadata 2) trees + */ + public static int getFoliageColorBirch() + { + return 8431445; + } + + public static int getFoliageColorBasic() + { + return 4764952; + } +} diff --git a/src/minecraft/net/minecraft/world/ColorizerGrass.java b/src/minecraft/net/minecraft/world/ColorizerGrass.java new file mode 100644 index 0000000..8240602 --- /dev/null +++ b/src/minecraft/net/minecraft/world/ColorizerGrass.java @@ -0,0 +1,24 @@ +package net.minecraft.world; + +public class ColorizerGrass +{ + /** Color buffer for grass */ + private static int[] grassBuffer = new int[65536]; + + public static void setGrassBiomeColorizer(int[] p_77479_0_) + { + grassBuffer = p_77479_0_; + } + + /** + * Gets grass color from temperature and humidity. Args: temperature, humidity + */ + public static int getGrassColor(double p_77480_0_, double p_77480_2_) + { + p_77480_2_ = p_77480_2_ * p_77480_0_; + int i = (int)((1.0D - p_77480_0_) * 255.0D); + int j = (int)((1.0D - p_77480_2_) * 255.0D); + int k = j << 8 | i; + return k > grassBuffer.length ? -65281 : grassBuffer[k]; + } +} diff --git a/src/minecraft/net/minecraft/world/DifficultyInstance.java b/src/minecraft/net/minecraft/world/DifficultyInstance.java new file mode 100644 index 0000000..372db1d --- /dev/null +++ b/src/minecraft/net/minecraft/world/DifficultyInstance.java @@ -0,0 +1,51 @@ +package net.minecraft.world; + +import net.minecraft.util.MathHelper; + +public class DifficultyInstance +{ + private final EnumDifficulty worldDifficulty; + private final float additionalDifficulty; + + public DifficultyInstance(EnumDifficulty worldDifficulty, long worldTime, long chunkInhabitedTime, float moonPhaseFactor) + { + this.worldDifficulty = worldDifficulty; + this.additionalDifficulty = this.calculateAdditionalDifficulty(worldDifficulty, worldTime, chunkInhabitedTime, moonPhaseFactor); + } + + public float getAdditionalDifficulty() + { + return this.additionalDifficulty; + } + + public float getClampedAdditionalDifficulty() + { + return this.additionalDifficulty < 2.0F ? 0.0F : (this.additionalDifficulty > 4.0F ? 1.0F : (this.additionalDifficulty - 2.0F) / 2.0F); + } + + private float calculateAdditionalDifficulty(EnumDifficulty difficulty, long worldTime, long chunkInhabitedTime, float moonPhaseFactor) + { + if (difficulty == EnumDifficulty.PEACEFUL) + { + return 0.0F; + } + else + { + boolean flag = difficulty == EnumDifficulty.HARD; + float f = 0.75F; + float f1 = MathHelper.clamp_float(((float)worldTime + -72000.0F) / 1440000.0F, 0.0F, 1.0F) * 0.25F; + f = f + f1; + float f2 = 0.0F; + f2 = f2 + MathHelper.clamp_float((float)chunkInhabitedTime / 3600000.0F, 0.0F, 1.0F) * (flag ? 1.0F : 0.75F); + f2 = f2 + MathHelper.clamp_float(moonPhaseFactor * 0.25F, 0.0F, f1); + + if (difficulty == EnumDifficulty.EASY) + { + f2 *= 0.5F; + } + + f = f + f2; + return (float)difficulty.getDifficultyId() * f; + } + } +} diff --git a/src/minecraft/net/minecraft/world/EnumDifficulty.java b/src/minecraft/net/minecraft/world/EnumDifficulty.java new file mode 100644 index 0000000..a010eb2 --- /dev/null +++ b/src/minecraft/net/minecraft/world/EnumDifficulty.java @@ -0,0 +1,41 @@ +package net.minecraft.world; + +public enum EnumDifficulty +{ + PEACEFUL(0, "options.difficulty.peaceful"), + EASY(1, "options.difficulty.easy"), + NORMAL(2, "options.difficulty.normal"), + HARD(3, "options.difficulty.hard"); + + private static final EnumDifficulty[] difficultyEnums = new EnumDifficulty[values().length]; + private final int difficultyId; + private final String difficultyResourceKey; + + private EnumDifficulty(int difficultyIdIn, String difficultyResourceKeyIn) + { + this.difficultyId = difficultyIdIn; + this.difficultyResourceKey = difficultyResourceKeyIn; + } + + public int getDifficultyId() + { + return this.difficultyId; + } + + public static EnumDifficulty getDifficultyEnum(int p_151523_0_) + { + return difficultyEnums[p_151523_0_ % difficultyEnums.length]; + } + + public String getDifficultyResourceKey() + { + return this.difficultyResourceKey; + } + + static { + for (EnumDifficulty enumdifficulty : values()) + { + difficultyEnums[enumdifficulty.difficultyId] = enumdifficulty; + } + } +} diff --git a/src/minecraft/net/minecraft/world/EnumSkyBlock.java b/src/minecraft/net/minecraft/world/EnumSkyBlock.java new file mode 100644 index 0000000..37a6069 --- /dev/null +++ b/src/minecraft/net/minecraft/world/EnumSkyBlock.java @@ -0,0 +1,14 @@ +package net.minecraft.world; + +public enum EnumSkyBlock +{ + SKY(15), + BLOCK(0); + + public final int defaultLightValue; + + private EnumSkyBlock(int p_i1961_3_) + { + this.defaultLightValue = p_i1961_3_; + } +} diff --git a/src/minecraft/net/minecraft/world/Explosion.java b/src/minecraft/net/minecraft/world/Explosion.java new file mode 100644 index 0000000..64a4fc3 --- /dev/null +++ b/src/minecraft/net/minecraft/world/Explosion.java @@ -0,0 +1,261 @@ +package net.minecraft.world; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.enchantment.EnchantmentProtection; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; + +public class Explosion +{ + /** whether or not the explosion sets fire to blocks around it */ + private final boolean isFlaming; + + /** whether or not this explosion spawns smoke particles */ + private final boolean isSmoking; + private final Random explosionRNG; + private final World worldObj; + private final double explosionX; + private final double explosionY; + private final double explosionZ; + private final Entity exploder; + private final float explosionSize; + private final List affectedBlockPositions; + private final Map playerKnockbackMap; + + public Explosion(World worldIn, Entity p_i45752_2_, double p_i45752_3_, double p_i45752_5_, double p_i45752_7_, float p_i45752_9_, List p_i45752_10_) + { + this(worldIn, p_i45752_2_, p_i45752_3_, p_i45752_5_, p_i45752_7_, p_i45752_9_, false, true, p_i45752_10_); + } + + public Explosion(World worldIn, Entity p_i45753_2_, double p_i45753_3_, double p_i45753_5_, double p_i45753_7_, float p_i45753_9_, boolean p_i45753_10_, boolean p_i45753_11_, List p_i45753_12_) + { + this(worldIn, p_i45753_2_, p_i45753_3_, p_i45753_5_, p_i45753_7_, p_i45753_9_, p_i45753_10_, p_i45753_11_); + this.affectedBlockPositions.addAll(p_i45753_12_); + } + + public Explosion(World worldIn, Entity p_i45754_2_, double p_i45754_3_, double p_i45754_5_, double p_i45754_7_, float size, boolean p_i45754_10_, boolean p_i45754_11_) + { + this.explosionRNG = new Random(); + this.affectedBlockPositions = Lists.newArrayList(); + this.playerKnockbackMap = Maps.newHashMap(); + this.worldObj = worldIn; + this.exploder = p_i45754_2_; + this.explosionSize = size; + this.explosionX = p_i45754_3_; + this.explosionY = p_i45754_5_; + this.explosionZ = p_i45754_7_; + this.isFlaming = p_i45754_10_; + this.isSmoking = p_i45754_11_; + } + + /** + * Does the first part of the explosion (destroy blocks) + */ + public void doExplosionA() + { + Set set = Sets.newHashSet(); + int i = 16; + + for (int j = 0; j < 16; ++j) + { + for (int k = 0; k < 16; ++k) + { + for (int l = 0; l < 16; ++l) + { + if (j == 0 || j == 15 || k == 0 || k == 15 || l == 0 || l == 15) + { + double d0 = (double)((float)j / 15.0F * 2.0F - 1.0F); + double d1 = (double)((float)k / 15.0F * 2.0F - 1.0F); + double d2 = (double)((float)l / 15.0F * 2.0F - 1.0F); + double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); + d0 = d0 / d3; + d1 = d1 / d3; + d2 = d2 / d3; + float f = this.explosionSize * (0.7F + this.worldObj.rand.nextFloat() * 0.6F); + double d4 = this.explosionX; + double d6 = this.explosionY; + double d8 = this.explosionZ; + + for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) + { + BlockPos blockpos = new BlockPos(d4, d6, d8); + IBlockState iblockstate = this.worldObj.getBlockState(blockpos); + + if (iblockstate.getBlock().getMaterial() != Material.air) + { + float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance((Entity)null); + f -= (f2 + 0.3F) * 0.3F; + } + + if (f > 0.0F && (this.exploder == null || this.exploder.verifyExplosion(this, this.worldObj, blockpos, iblockstate, f))) + { + set.add(blockpos); + } + + d4 += d0 * 0.30000001192092896D; + d6 += d1 * 0.30000001192092896D; + d8 += d2 * 0.30000001192092896D; + } + } + } + } + } + + this.affectedBlockPositions.addAll(set); + float f3 = this.explosionSize * 2.0F; + int k1 = MathHelper.floor_double(this.explosionX - (double)f3 - 1.0D); + int l1 = MathHelper.floor_double(this.explosionX + (double)f3 + 1.0D); + int i2 = MathHelper.floor_double(this.explosionY - (double)f3 - 1.0D); + int i1 = MathHelper.floor_double(this.explosionY + (double)f3 + 1.0D); + int j2 = MathHelper.floor_double(this.explosionZ - (double)f3 - 1.0D); + int j1 = MathHelper.floor_double(this.explosionZ + (double)f3 + 1.0D); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, new AxisAlignedBB((double)k1, (double)i2, (double)j2, (double)l1, (double)i1, (double)j1)); + Vec3 vec3 = new Vec3(this.explosionX, this.explosionY, this.explosionZ); + + for (int k2 = 0; k2 < list.size(); ++k2) + { + Entity entity = (Entity)list.get(k2); + + if (!entity.isImmuneToExplosions()) + { + double d12 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double)f3; + + if (d12 <= 1.0D) + { + double d5 = entity.posX - this.explosionX; + double d7 = entity.posY + (double)entity.getEyeHeight() - this.explosionY; + double d9 = entity.posZ - this.explosionZ; + double d13 = (double)MathHelper.sqrt_double(d5 * d5 + d7 * d7 + d9 * d9); + + if (d13 != 0.0D) + { + d5 = d5 / d13; + d7 = d7 / d13; + d9 = d9 / d13; + double d14 = (double)this.worldObj.getBlockDensity(vec3, entity.getEntityBoundingBox()); + double d10 = (1.0D - d12) * d14; + entity.attackEntityFrom(DamageSource.setExplosionSource(this), (float)((int)((d10 * d10 + d10) / 2.0D * 8.0D * (double)f3 + 1.0D))); + double d11 = EnchantmentProtection.func_92092_a(entity, d10); + entity.motionX += d5 * d11; + entity.motionY += d7 * d11; + entity.motionZ += d9 * d11; + + if (entity instanceof EntityPlayer && !((EntityPlayer)entity).capabilities.disableDamage) + { + this.playerKnockbackMap.put((EntityPlayer)entity, new Vec3(d5 * d10, d7 * d10, d9 * d10)); + } + } + } + } + } + } + + /** + * Does the second part of the explosion (sound, particles, drop spawn) + */ + public void doExplosionB(boolean spawnParticles) + { + this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + + if (this.explosionSize >= 2.0F && this.isSmoking) + { + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D, new int[0]); + } + else + { + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D, new int[0]); + } + + if (this.isSmoking) + { + for (BlockPos blockpos : this.affectedBlockPositions) + { + Block block = this.worldObj.getBlockState(blockpos).getBlock(); + + if (spawnParticles) + { + double d0 = (double)((float)blockpos.getX() + this.worldObj.rand.nextFloat()); + double d1 = (double)((float)blockpos.getY() + this.worldObj.rand.nextFloat()); + double d2 = (double)((float)blockpos.getZ() + this.worldObj.rand.nextFloat()); + double d3 = d0 - this.explosionX; + double d4 = d1 - this.explosionY; + double d5 = d2 - this.explosionZ; + double d6 = (double)MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5); + d3 = d3 / d6; + d4 = d4 / d6; + d5 = d5 / d6; + double d7 = 0.5D / (d6 / (double)this.explosionSize + 0.1D); + d7 = d7 * (double)(this.worldObj.rand.nextFloat() * this.worldObj.rand.nextFloat() + 0.3F); + d3 = d3 * d7; + d4 = d4 * d7; + d5 = d5 * d7; + this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D, d3, d4, d5, new int[0]); + this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, d3, d4, d5, new int[0]); + } + + if (block.getMaterial() != Material.air) + { + if (block.canDropFromExplosion(this)) + { + block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); + } + + this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState(), 3); + block.onBlockDestroyedByExplosion(this.worldObj, blockpos, this); + } + } + } + + if (this.isFlaming) + { + for (BlockPos blockpos1 : this.affectedBlockPositions) + { + if (this.worldObj.getBlockState(blockpos1).getBlock().getMaterial() == Material.air && this.worldObj.getBlockState(blockpos1.down()).getBlock().isFullBlock() && this.explosionRNG.nextInt(3) == 0) + { + this.worldObj.setBlockState(blockpos1, Blocks.fire.getDefaultState()); + } + } + } + } + + public Map getPlayerKnockbackMap() + { + return this.playerKnockbackMap; + } + + /** + * Returns either the entity that placed the explosive block, the entity that caused the explosion or null. + */ + public EntityLivingBase getExplosivePlacedBy() + { + return this.exploder == null ? null : (this.exploder instanceof EntityTNTPrimed ? ((EntityTNTPrimed)this.exploder).getTntPlacedBy() : (this.exploder instanceof EntityLivingBase ? (EntityLivingBase)this.exploder : null)); + } + + public void func_180342_d() + { + this.affectedBlockPositions.clear(); + } + + public List getAffectedBlockPositions() + { + return this.affectedBlockPositions; + } +} diff --git a/src/minecraft/net/minecraft/world/GameRules.java b/src/minecraft/net/minecraft/world/GameRules.java new file mode 100644 index 0000000..b5a8543 --- /dev/null +++ b/src/minecraft/net/minecraft/world/GameRules.java @@ -0,0 +1,215 @@ +package net.minecraft.world; + +import java.util.Set; +import java.util.TreeMap; +import net.minecraft.nbt.NBTTagCompound; + +public class GameRules +{ + private TreeMap theGameRules = new TreeMap(); + private static final String __OBFID = "CL_00000136"; + + public GameRules() + { + this.addGameRule("doFireTick", "true", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("mobGriefing", "true", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("keepInventory", "false", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("doMobSpawning", "true", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("doMobLoot", "true", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("doTileDrops", "true", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("doEntityDrops", "true", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("commandBlockOutput", "true", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("naturalRegeneration", "true", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("doDaylightCycle", "true", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("logAdminCommands", "true", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("showDeathMessages", "true", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("randomTickSpeed", "3", GameRules.ValueType.NUMERICAL_VALUE); + this.addGameRule("sendCommandFeedback", "true", GameRules.ValueType.BOOLEAN_VALUE); + this.addGameRule("reducedDebugInfo", "false", GameRules.ValueType.BOOLEAN_VALUE); + } + + public void addGameRule(String key, String value, GameRules.ValueType type) + { + this.theGameRules.put(key, new GameRules.Value(value, type)); + } + + public void setOrCreateGameRule(String key, String ruleValue) + { + GameRules.Value gamerules$value = (GameRules.Value)this.theGameRules.get(key); + + if (gamerules$value != null) + { + gamerules$value.setValue(ruleValue); + } + else + { + this.addGameRule(key, ruleValue, GameRules.ValueType.ANY_VALUE); + } + } + + /** + * Gets the string Game Rule value. + */ + public String getString(String name) + { + GameRules.Value gamerules$value = (GameRules.Value)this.theGameRules.get(name); + return gamerules$value != null ? gamerules$value.getString() : ""; + } + + /** + * Gets the boolean Game Rule value. + */ + public boolean getBoolean(String name) + { + GameRules.Value gamerules$value = (GameRules.Value)this.theGameRules.get(name); + return gamerules$value != null ? gamerules$value.getBoolean() : false; + } + + public int getInt(String name) + { + GameRules.Value gamerules$value = (GameRules.Value)this.theGameRules.get(name); + return gamerules$value != null ? gamerules$value.getInt() : 0; + } + + /** + * Return the defined game rules as NBT. + */ + public NBTTagCompound writeToNBT() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + for (Object s : this.theGameRules.keySet()) + { + GameRules.Value gamerules$value = (GameRules.Value)this.theGameRules.get(s); + nbttagcompound.setString((String) s, gamerules$value.getString()); + } + + return nbttagcompound; + } + + /** + * Set defined game rules from NBT. + */ + public void readFromNBT(NBTTagCompound nbt) + { + for (String s : nbt.getKeySet()) + { + String s1 = nbt.getString(s); + this.setOrCreateGameRule(s, s1); + } + } + + /** + * Return the defined game rules. + */ + public String[] getRules() + { + Set set = this.theGameRules.keySet(); + return (String[])((String[])set.toArray(new String[set.size()])); + } + + /** + * Return whether the specified game rule is defined. + */ + public boolean hasRule(String name) + { + return this.theGameRules.containsKey(name); + } + + public boolean areSameType(String key, GameRules.ValueType otherValue) + { + GameRules.Value gamerules$value = (GameRules.Value)this.theGameRules.get(key); + return gamerules$value != null && (gamerules$value.getType() == otherValue || otherValue == GameRules.ValueType.ANY_VALUE); + } + + static class Value + { + private String valueString; + private boolean valueBoolean; + private int valueInteger; + private double valueDouble; + private final GameRules.ValueType type; + private static final String __OBFID = "CL_00000137"; + + public Value(String value, GameRules.ValueType type) + { + this.type = type; + this.setValue(value); + } + + public void setValue(String value) + { + this.valueString = value; + + if (value != null) + { + if (value.equals("false")) + { + this.valueBoolean = false; + return; + } + + if (value.equals("true")) + { + this.valueBoolean = true; + return; + } + } + + this.valueBoolean = Boolean.parseBoolean(value); + this.valueInteger = this.valueBoolean ? 1 : 0; + + try + { + this.valueInteger = Integer.parseInt(value); + } + catch (NumberFormatException var4) + { + ; + } + + try + { + this.valueDouble = Double.parseDouble(value); + } + catch (NumberFormatException var3) + { + ; + } + } + + public String getString() + { + return this.valueString; + } + + public boolean getBoolean() + { + return this.valueBoolean; + } + + public int getInt() + { + return this.valueInteger; + } + + public GameRules.ValueType getType() + { + return this.type; + } + } + + public static enum ValueType + { + ANY_VALUE("ANY_VALUE", 0), + BOOLEAN_VALUE("BOOLEAN_VALUE", 1), + NUMERICAL_VALUE("NUMERICAL_VALUE", 2); + + private static final GameRules.ValueType[] $VALUES = new GameRules.ValueType[]{ANY_VALUE, BOOLEAN_VALUE, NUMERICAL_VALUE}; + private static final String __OBFID = "CL_00002151"; + + private ValueType(String p_i19_3_, int p_i19_4_) + { + } + } +} diff --git a/src/minecraft/net/minecraft/world/IBlockAccess.java b/src/minecraft/net/minecraft/world/IBlockAccess.java new file mode 100644 index 0000000..3597e23 --- /dev/null +++ b/src/minecraft/net/minecraft/world/IBlockAccess.java @@ -0,0 +1,33 @@ +package net.minecraft.world; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.biome.BiomeGenBase; + +public interface IBlockAccess +{ + TileEntity getTileEntity(BlockPos pos); + + int getCombinedLight(BlockPos pos, int lightValue); + + IBlockState getBlockState(BlockPos pos); + + /** + * Checks to see if an air block exists at the provided location. Note that this only checks to see if the blocks + * material is set to air, meaning it is possible for non-vanilla blocks to still pass this check. + */ + boolean isAirBlock(BlockPos pos); + + BiomeGenBase getBiomeGenForCoords(BlockPos pos); + + /** + * set by !chunk.getAreLevelsEmpty + */ + boolean extendedLevelsInChunkCache(); + + int getStrongPower(BlockPos pos, EnumFacing direction); + + WorldType getWorldType(); +} diff --git a/src/minecraft/net/minecraft/world/IInteractionObject.java b/src/minecraft/net/minecraft/world/IInteractionObject.java new file mode 100644 index 0000000..6a49f18 --- /dev/null +++ b/src/minecraft/net/minecraft/world/IInteractionObject.java @@ -0,0 +1,12 @@ +package net.minecraft.world; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; + +public interface IInteractionObject extends IWorldNameable +{ + Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn); + + String getGuiID(); +} diff --git a/src/minecraft/net/minecraft/world/ILockableContainer.java b/src/minecraft/net/minecraft/world/ILockableContainer.java new file mode 100644 index 0000000..07cf659 --- /dev/null +++ b/src/minecraft/net/minecraft/world/ILockableContainer.java @@ -0,0 +1,12 @@ +package net.minecraft.world; + +import net.minecraft.inventory.IInventory; + +public interface ILockableContainer extends IInventory, IInteractionObject +{ + boolean isLocked(); + + void setLockCode(LockCode code); + + LockCode getLockCode(); +} diff --git a/src/minecraft/net/minecraft/world/IWorldAccess.java b/src/minecraft/net/minecraft/world/IWorldAccess.java new file mode 100644 index 0000000..8deb711 --- /dev/null +++ b/src/minecraft/net/minecraft/world/IWorldAccess.java @@ -0,0 +1,50 @@ +package net.minecraft.world; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; + +public interface IWorldAccess +{ + void markBlockForUpdate(BlockPos pos); + + void notifyLightSet(BlockPos pos); + + /** + * On the client, re-renders all blocks in this range, inclusive. On the server, does nothing. Args: min x, min y, + * min z, max x, max y, max z + */ + void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2); + + /** + * Plays the specified sound. Arg: soundName, x, y, z, volume, pitch + */ + void playSound(String soundName, double x, double y, double z, float volume, float pitch); + + /** + * Plays sound to all near players except the player reference given + */ + void playSoundToNearExcept(EntityPlayer except, String soundName, double x, double y, double z, float volume, float pitch); + + void spawnParticle(int particleID, boolean ignoreRange, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int... p_180442_15_); + + /** + * Called on all IWorldAccesses when an entity is created or loaded. On client worlds, starts downloading any + * necessary textures. On server worlds, adds the entity to the entity tracker. + */ + void onEntityAdded(Entity entityIn); + + /** + * Called on all IWorldAccesses when an entity is unloaded or destroyed. On client worlds, releases any downloaded + * textures. On server worlds, removes the entity from the entity tracker. + */ + void onEntityRemoved(Entity entityIn); + + void playRecord(String recordName, BlockPos blockPosIn); + + void broadcastSound(int p_180440_1_, BlockPos p_180440_2_, int p_180440_3_); + + void playAuxSFX(EntityPlayer player, int sfxType, BlockPos blockPosIn, int p_180439_4_); + + void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress); +} diff --git a/src/minecraft/net/minecraft/world/IWorldNameable.java b/src/minecraft/net/minecraft/world/IWorldNameable.java new file mode 100644 index 0000000..47df66b --- /dev/null +++ b/src/minecraft/net/minecraft/world/IWorldNameable.java @@ -0,0 +1,21 @@ +package net.minecraft.world; + +import net.minecraft.util.IChatComponent; + +public interface IWorldNameable +{ + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + String getName(); + + /** + * Returns true if this thing is named + */ + boolean hasCustomName(); + + /** + * Get the formatted ChatComponent that will be used for the sender's username in chat + */ + IChatComponent getDisplayName(); +} diff --git a/src/minecraft/net/minecraft/world/LockCode.java b/src/minecraft/net/minecraft/world/LockCode.java new file mode 100644 index 0000000..033bd5d --- /dev/null +++ b/src/minecraft/net/minecraft/world/LockCode.java @@ -0,0 +1,42 @@ +package net.minecraft.world; + +import net.minecraft.nbt.NBTTagCompound; + +public class LockCode +{ + public static final LockCode EMPTY_CODE = new LockCode(""); + private final String lock; + + public LockCode(String code) + { + this.lock = code; + } + + public boolean isEmpty() + { + return this.lock == null || this.lock.isEmpty(); + } + + public String getLock() + { + return this.lock; + } + + public void toNBT(NBTTagCompound nbt) + { + nbt.setString("Lock", this.lock); + } + + public static LockCode fromNBT(NBTTagCompound nbt) + { + if (nbt.hasKey("Lock", 8)) + { + String s = nbt.getString("Lock"); + return new LockCode(s); + } + else + { + return EMPTY_CODE; + } + } +} diff --git a/src/minecraft/net/minecraft/world/MinecraftException.java b/src/minecraft/net/minecraft/world/MinecraftException.java new file mode 100644 index 0000000..7730d42 --- /dev/null +++ b/src/minecraft/net/minecraft/world/MinecraftException.java @@ -0,0 +1,9 @@ +package net.minecraft.world; + +public class MinecraftException extends Exception +{ + public MinecraftException(String msg) + { + super(msg); + } +} diff --git a/src/minecraft/net/minecraft/world/NextTickListEntry.java b/src/minecraft/net/minecraft/world/NextTickListEntry.java new file mode 100644 index 0000000..55ba3e4 --- /dev/null +++ b/src/minecraft/net/minecraft/world/NextTickListEntry.java @@ -0,0 +1,73 @@ +package net.minecraft.world; + +import net.minecraft.block.Block; +import net.minecraft.util.BlockPos; + +public class NextTickListEntry implements Comparable +{ + /** The id number for the next tick entry */ + private static long nextTickEntryID; + private final Block block; + public final BlockPos position; + + /** Time this tick is scheduled to occur at */ + public long scheduledTime; + public int priority; + + /** The id of the tick entry */ + private long tickEntryID; + + public NextTickListEntry(BlockPos p_i45745_1_, Block p_i45745_2_) + { + this.tickEntryID = (long)(nextTickEntryID++); + this.position = p_i45745_1_; + this.block = p_i45745_2_; + } + + public boolean equals(Object p_equals_1_) + { + if (!(p_equals_1_ instanceof NextTickListEntry)) + { + return false; + } + else + { + NextTickListEntry nextticklistentry = (NextTickListEntry)p_equals_1_; + return this.position.equals(nextticklistentry.position) && Block.isEqualTo(this.block, nextticklistentry.block); + } + } + + public int hashCode() + { + return this.position.hashCode(); + } + + /** + * Sets the scheduled time for this tick entry + */ + public NextTickListEntry setScheduledTime(long p_77176_1_) + { + this.scheduledTime = p_77176_1_; + return this; + } + + public void setPriority(int p_82753_1_) + { + this.priority = p_82753_1_; + } + + public int compareTo(NextTickListEntry p_compareTo_1_) + { + return this.scheduledTime < p_compareTo_1_.scheduledTime ? -1 : (this.scheduledTime > p_compareTo_1_.scheduledTime ? 1 : (this.priority != p_compareTo_1_.priority ? this.priority - p_compareTo_1_.priority : (this.tickEntryID < p_compareTo_1_.tickEntryID ? -1 : (this.tickEntryID > p_compareTo_1_.tickEntryID ? 1 : 0)))); + } + + public String toString() + { + return Block.getIdFromBlock(this.block) + ": " + this.position + ", " + this.scheduledTime + ", " + this.priority + ", " + this.tickEntryID; + } + + public Block getBlock() + { + return this.block; + } +} diff --git a/src/minecraft/net/minecraft/world/SpawnerAnimals.java b/src/minecraft/net/minecraft/world/SpawnerAnimals.java new file mode 100644 index 0000000..a8ab062 --- /dev/null +++ b/src/minecraft/net/minecraft/world/SpawnerAnimals.java @@ -0,0 +1,272 @@ +package net.minecraft.world; + +import com.google.common.collect.Sets; +import java.util.List; +import java.util.Random; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntitySpawnPlacementRegistry; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.WeightedRandom; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; + +public final class SpawnerAnimals +{ + private static final int MOB_COUNT_DIV = (int)Math.pow(17.0D, 2.0D); + private final Set eligibleChunksForSpawning = Sets.newHashSet(); + + /** + * adds all chunks within the spawn radius of the players to eligibleChunksForSpawning. pars: the world, + * hostileCreatures, passiveCreatures. returns number of eligible chunks. + */ + public int findChunksForSpawning(WorldServer p_77192_1_, boolean spawnHostileMobs, boolean spawnPeacefulMobs, boolean p_77192_4_) + { + if (!spawnHostileMobs && !spawnPeacefulMobs) + { + return 0; + } + else + { + this.eligibleChunksForSpawning.clear(); + int i = 0; + + for (EntityPlayer entityplayer : p_77192_1_.playerEntities) + { + if (!entityplayer.isSpectator()) + { + int j = MathHelper.floor_double(entityplayer.posX / 16.0D); + int k = MathHelper.floor_double(entityplayer.posZ / 16.0D); + int l = 8; + + for (int i1 = -l; i1 <= l; ++i1) + { + for (int j1 = -l; j1 <= l; ++j1) + { + boolean flag = i1 == -l || i1 == l || j1 == -l || j1 == l; + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i1 + j, j1 + k); + + if (!this.eligibleChunksForSpawning.contains(chunkcoordintpair)) + { + ++i; + + if (!flag && p_77192_1_.getWorldBorder().contains(chunkcoordintpair)) + { + this.eligibleChunksForSpawning.add(chunkcoordintpair); + } + } + } + } + } + } + + int i4 = 0; + BlockPos blockpos2 = p_77192_1_.getSpawnPoint(); + + for (EnumCreatureType enumcreaturetype : EnumCreatureType.values()) + { + if ((!enumcreaturetype.getPeacefulCreature() || spawnPeacefulMobs) && (enumcreaturetype.getPeacefulCreature() || spawnHostileMobs) && (!enumcreaturetype.getAnimal() || p_77192_4_)) + { + int j4 = p_77192_1_.countEntities(enumcreaturetype.getCreatureClass()); + int k4 = enumcreaturetype.getMaxNumberOfCreature() * i / MOB_COUNT_DIV; + + if (j4 <= k4) + { + label374: + + for (ChunkCoordIntPair chunkcoordintpair1 : this.eligibleChunksForSpawning) + { + BlockPos blockpos = getRandomChunkPosition(p_77192_1_, chunkcoordintpair1.chunkXPos, chunkcoordintpair1.chunkZPos); + int k1 = blockpos.getX(); + int l1 = blockpos.getY(); + int i2 = blockpos.getZ(); + Block block = p_77192_1_.getBlockState(blockpos).getBlock(); + + if (!block.isNormalCube()) + { + int j2 = 0; + + for (int k2 = 0; k2 < 3; ++k2) + { + int l2 = k1; + int i3 = l1; + int j3 = i2; + int k3 = 6; + BiomeGenBase.SpawnListEntry biomegenbase$spawnlistentry = null; + IEntityLivingData ientitylivingdata = null; + + for (int l3 = 0; l3 < 4; ++l3) + { + l2 += p_77192_1_.rand.nextInt(k3) - p_77192_1_.rand.nextInt(k3); + i3 += p_77192_1_.rand.nextInt(1) - p_77192_1_.rand.nextInt(1); + j3 += p_77192_1_.rand.nextInt(k3) - p_77192_1_.rand.nextInt(k3); + BlockPos blockpos1 = new BlockPos(l2, i3, j3); + float f = (float)l2 + 0.5F; + float f1 = (float)j3 + 0.5F; + + if (!p_77192_1_.isAnyPlayerWithinRangeAt((double)f, (double)i3, (double)f1, 24.0D) && blockpos2.distanceSq((double)f, (double)i3, (double)f1) >= 576.0D) + { + if (biomegenbase$spawnlistentry == null) + { + biomegenbase$spawnlistentry = p_77192_1_.getSpawnListEntryForTypeAt(enumcreaturetype, blockpos1); + + if (biomegenbase$spawnlistentry == null) + { + break; + } + } + + if (p_77192_1_.canCreatureTypeSpawnHere(enumcreaturetype, biomegenbase$spawnlistentry, blockpos1) && canCreatureTypeSpawnAtLocation(EntitySpawnPlacementRegistry.getPlacementForEntity(biomegenbase$spawnlistentry.entityClass), p_77192_1_, blockpos1)) + { + EntityLiving entityliving; + + try + { + entityliving = (EntityLiving)biomegenbase$spawnlistentry.entityClass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {p_77192_1_}); + } + catch (Exception exception) + { + exception.printStackTrace(); + return i4; + } + + entityliving.setLocationAndAngles((double)f, (double)i3, (double)f1, p_77192_1_.rand.nextFloat() * 360.0F, 0.0F); + + if (entityliving.getCanSpawnHere() && entityliving.isNotColliding()) + { + ientitylivingdata = entityliving.onInitialSpawn(p_77192_1_.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata); + + if (entityliving.isNotColliding()) + { + ++j2; + p_77192_1_.spawnEntityInWorld(entityliving); + } + + if (j2 >= entityliving.getMaxSpawnedInChunk()) + { + continue label374; + } + } + + i4 += j2; + } + } + } + } + } + } + } + } + } + + return i4; + } + } + + protected static BlockPos getRandomChunkPosition(World worldIn, int x, int z) + { + Chunk chunk = worldIn.getChunkFromChunkCoords(x, z); + int i = x * 16 + worldIn.rand.nextInt(16); + int j = z * 16 + worldIn.rand.nextInt(16); + int k = MathHelper.func_154354_b(chunk.getHeight(new BlockPos(i, 0, j)) + 1, 16); + int l = worldIn.rand.nextInt(k > 0 ? k : chunk.getTopFilledSegment() + 16 - 1); + return new BlockPos(i, l, j); + } + + public static boolean canCreatureTypeSpawnAtLocation(EntityLiving.SpawnPlacementType p_180267_0_, World worldIn, BlockPos pos) + { + if (!worldIn.getWorldBorder().contains(pos)) + { + return false; + } + else + { + Block block = worldIn.getBlockState(pos).getBlock(); + + if (p_180267_0_ == EntityLiving.SpawnPlacementType.IN_WATER) + { + return block.getMaterial().isLiquid() && worldIn.getBlockState(pos.down()).getBlock().getMaterial().isLiquid() && !worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); + } + else + { + BlockPos blockpos = pos.down(); + + if (!World.doesBlockHaveSolidTopSurface(worldIn, blockpos)) + { + return false; + } + else + { + Block block1 = worldIn.getBlockState(blockpos).getBlock(); + boolean flag = block1 != Blocks.bedrock && block1 != Blocks.barrier; + return flag && !block.isNormalCube() && !block.getMaterial().isLiquid() && !worldIn.getBlockState(pos.up()).getBlock().isNormalCube(); + } + } + } + } + + /** + * Called during chunk generation to spawn initial creatures. + */ + public static void performWorldGenSpawning(World worldIn, BiomeGenBase p_77191_1_, int p_77191_2_, int p_77191_3_, int p_77191_4_, int p_77191_5_, Random p_77191_6_) + { + List list = p_77191_1_.getSpawnableList(EnumCreatureType.CREATURE); + + if (!list.isEmpty()) + { + while (p_77191_6_.nextFloat() < p_77191_1_.getSpawningChance()) + { + BiomeGenBase.SpawnListEntry biomegenbase$spawnlistentry = (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(worldIn.rand, list); + int i = biomegenbase$spawnlistentry.minGroupCount + p_77191_6_.nextInt(1 + biomegenbase$spawnlistentry.maxGroupCount - biomegenbase$spawnlistentry.minGroupCount); + IEntityLivingData ientitylivingdata = null; + int j = p_77191_2_ + p_77191_6_.nextInt(p_77191_4_); + int k = p_77191_3_ + p_77191_6_.nextInt(p_77191_5_); + int l = j; + int i1 = k; + + for (int j1 = 0; j1 < i; ++j1) + { + boolean flag = false; + + for (int k1 = 0; !flag && k1 < 4; ++k1) + { + BlockPos blockpos = worldIn.getTopSolidOrLiquidBlock(new BlockPos(j, 0, k)); + + if (canCreatureTypeSpawnAtLocation(EntityLiving.SpawnPlacementType.ON_GROUND, worldIn, blockpos)) + { + EntityLiving entityliving; + + try + { + entityliving = (EntityLiving)biomegenbase$spawnlistentry.entityClass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {worldIn}); + } + catch (Exception exception) + { + exception.printStackTrace(); + continue; + } + + entityliving.setLocationAndAngles((double)((float)j + 0.5F), (double)blockpos.getY(), (double)((float)k + 0.5F), p_77191_6_.nextFloat() * 360.0F, 0.0F); + worldIn.spawnEntityInWorld(entityliving); + ientitylivingdata = entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), ientitylivingdata); + flag = true; + } + + j += p_77191_6_.nextInt(5) - p_77191_6_.nextInt(5); + + for (k += p_77191_6_.nextInt(5) - p_77191_6_.nextInt(5); j < p_77191_2_ || j >= p_77191_2_ + p_77191_4_ || k < p_77191_3_ || k >= p_77191_3_ + p_77191_4_; k = i1 + p_77191_6_.nextInt(5) - p_77191_6_.nextInt(5)) + { + j = l + p_77191_6_.nextInt(5) - p_77191_6_.nextInt(5); + } + } + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/Teleporter.java b/src/minecraft/net/minecraft/world/Teleporter.java new file mode 100644 index 0000000..5c40821 --- /dev/null +++ b/src/minecraft/net/minecraft/world/Teleporter.java @@ -0,0 +1,430 @@ +package net.minecraft.world; + +import com.google.common.collect.Lists; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import net.minecraft.block.BlockPortal; +import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.pattern.BlockPattern; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.LongHashMap; +import net.minecraft.util.MathHelper; + +public class Teleporter +{ + private final WorldServer worldServerInstance; + + /** A private Random() function in Teleporter */ + private final Random random; + private final LongHashMap destinationCoordinateCache = new LongHashMap(); + private final List destinationCoordinateKeys = Lists.newArrayList(); + + public Teleporter(WorldServer worldIn) + { + this.worldServerInstance = worldIn; + this.random = new Random(worldIn.getSeed()); + } + + public void placeInPortal(Entity entityIn, float rotationYaw) + { + if (this.worldServerInstance.provider.getDimensionId() != 1) + { + if (!this.placeInExistingPortal(entityIn, rotationYaw)) + { + this.makePortal(entityIn); + this.placeInExistingPortal(entityIn, rotationYaw); + } + } + else + { + int i = MathHelper.floor_double(entityIn.posX); + int j = MathHelper.floor_double(entityIn.posY) - 1; + int k = MathHelper.floor_double(entityIn.posZ); + int l = 1; + int i1 = 0; + + for (int j1 = -2; j1 <= 2; ++j1) + { + for (int k1 = -2; k1 <= 2; ++k1) + { + for (int l1 = -1; l1 < 3; ++l1) + { + int i2 = i + k1 * l + j1 * i1; + int j2 = j + l1; + int k2 = k + k1 * i1 - j1 * l; + boolean flag = l1 < 0; + this.worldServerInstance.setBlockState(new BlockPos(i2, j2, k2), flag ? Blocks.obsidian.getDefaultState() : Blocks.air.getDefaultState()); + } + } + } + + entityIn.setLocationAndAngles((double)i, (double)j, (double)k, entityIn.rotationYaw, 0.0F); + entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D; + } + } + + public boolean placeInExistingPortal(Entity entityIn, float rotationYaw) + { + int i = 128; + double d0 = -1.0D; + int j = MathHelper.floor_double(entityIn.posX); + int k = MathHelper.floor_double(entityIn.posZ); + boolean flag = true; + BlockPos blockpos = BlockPos.ORIGIN; + long l = ChunkCoordIntPair.chunkXZ2Int(j, k); + + if (this.destinationCoordinateCache.containsItem(l)) + { + Teleporter.PortalPosition teleporter$portalposition = (Teleporter.PortalPosition)this.destinationCoordinateCache.getValueByKey(l); + d0 = 0.0D; + blockpos = teleporter$portalposition; + teleporter$portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime(); + flag = false; + } + else + { + BlockPos blockpos3 = new BlockPos(entityIn); + + for (int i1 = -128; i1 <= 128; ++i1) + { + BlockPos blockpos2; + + for (int j1 = -128; j1 <= 128; ++j1) + { + for (BlockPos blockpos1 = blockpos3.add(i1, this.worldServerInstance.getActualHeight() - 1 - blockpos3.getY(), j1); blockpos1.getY() >= 0; blockpos1 = blockpos2) + { + blockpos2 = blockpos1.down(); + + if (this.worldServerInstance.getBlockState(blockpos1).getBlock() == Blocks.portal) + { + while (this.worldServerInstance.getBlockState(blockpos2 = blockpos1.down()).getBlock() == Blocks.portal) + { + blockpos1 = blockpos2; + } + + double d1 = blockpos1.distanceSq(blockpos3); + + if (d0 < 0.0D || d1 < d0) + { + d0 = d1; + blockpos = blockpos1; + } + } + } + } + } + } + + if (d0 >= 0.0D) + { + if (flag) + { + this.destinationCoordinateCache.add(l, new Teleporter.PortalPosition(blockpos, this.worldServerInstance.getTotalWorldTime())); + this.destinationCoordinateKeys.add(Long.valueOf(l)); + } + + double d5 = (double)blockpos.getX() + 0.5D; + double d6 = (double)blockpos.getY() + 0.5D; + double d7 = (double)blockpos.getZ() + 0.5D; + BlockPattern.PatternHelper blockpattern$patternhelper = Blocks.portal.func_181089_f(this.worldServerInstance, blockpos); + boolean flag1 = blockpattern$patternhelper.getFinger().rotateY().getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE; + double d2 = blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? (double)blockpattern$patternhelper.func_181117_a().getZ() : (double)blockpattern$patternhelper.func_181117_a().getX(); + d6 = (double)(blockpattern$patternhelper.func_181117_a().getY() + 1) - entityIn.func_181014_aG().yCoord * (double)blockpattern$patternhelper.func_181119_e(); + + if (flag1) + { + ++d2; + } + + if (blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X) + { + d7 = d2 + (1.0D - entityIn.func_181014_aG().xCoord) * (double)blockpattern$patternhelper.func_181118_d() * (double)blockpattern$patternhelper.getFinger().rotateY().getAxisDirection().getOffset(); + } + else + { + d5 = d2 + (1.0D - entityIn.func_181014_aG().xCoord) * (double)blockpattern$patternhelper.func_181118_d() * (double)blockpattern$patternhelper.getFinger().rotateY().getAxisDirection().getOffset(); + } + + float f = 0.0F; + float f1 = 0.0F; + float f2 = 0.0F; + float f3 = 0.0F; + + if (blockpattern$patternhelper.getFinger().getOpposite() == entityIn.func_181012_aH()) + { + f = 1.0F; + f1 = 1.0F; + } + else if (blockpattern$patternhelper.getFinger().getOpposite() == entityIn.func_181012_aH().getOpposite()) + { + f = -1.0F; + f1 = -1.0F; + } + else if (blockpattern$patternhelper.getFinger().getOpposite() == entityIn.func_181012_aH().rotateY()) + { + f2 = 1.0F; + f3 = -1.0F; + } + else + { + f2 = -1.0F; + f3 = 1.0F; + } + + double d3 = entityIn.motionX; + double d4 = entityIn.motionZ; + entityIn.motionX = d3 * (double)f + d4 * (double)f3; + entityIn.motionZ = d3 * (double)f2 + d4 * (double)f1; + entityIn.rotationYaw = rotationYaw - (float)(entityIn.func_181012_aH().getOpposite().getHorizontalIndex() * 90) + (float)(blockpattern$patternhelper.getFinger().getHorizontalIndex() * 90); + entityIn.setLocationAndAngles(d5, d6, d7, entityIn.rotationYaw, entityIn.rotationPitch); + return true; + } + else + { + return false; + } + } + + public boolean makePortal(Entity p_85188_1_) + { + int i = 16; + double d0 = -1.0D; + int j = MathHelper.floor_double(p_85188_1_.posX); + int k = MathHelper.floor_double(p_85188_1_.posY); + int l = MathHelper.floor_double(p_85188_1_.posZ); + int i1 = j; + int j1 = k; + int k1 = l; + int l1 = 0; + int i2 = this.random.nextInt(4); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int j2 = j - i; j2 <= j + i; ++j2) + { + double d1 = (double)j2 + 0.5D - p_85188_1_.posX; + + for (int l2 = l - i; l2 <= l + i; ++l2) + { + double d2 = (double)l2 + 0.5D - p_85188_1_.posZ; + label142: + + for (int j3 = this.worldServerInstance.getActualHeight() - 1; j3 >= 0; --j3) + { + if (this.worldServerInstance.isAirBlock(blockpos$mutableblockpos.func_181079_c(j2, j3, l2))) + { + while (j3 > 0 && this.worldServerInstance.isAirBlock(blockpos$mutableblockpos.func_181079_c(j2, j3 - 1, l2))) + { + --j3; + } + + for (int k3 = i2; k3 < i2 + 4; ++k3) + { + int l3 = k3 % 2; + int i4 = 1 - l3; + + if (k3 % 4 >= 2) + { + l3 = -l3; + i4 = -i4; + } + + for (int j4 = 0; j4 < 3; ++j4) + { + for (int k4 = 0; k4 < 4; ++k4) + { + for (int l4 = -1; l4 < 4; ++l4) + { + int i5 = j2 + (k4 - 1) * l3 + j4 * i4; + int j5 = j3 + l4; + int k5 = l2 + (k4 - 1) * i4 - j4 * l3; + blockpos$mutableblockpos.func_181079_c(i5, j5, k5); + + if (l4 < 0 && !this.worldServerInstance.getBlockState(blockpos$mutableblockpos).getBlock().getMaterial().isSolid() || l4 >= 0 && !this.worldServerInstance.isAirBlock(blockpos$mutableblockpos)) + { + continue label142; + } + } + } + } + + double d5 = (double)j3 + 0.5D - p_85188_1_.posY; + double d7 = d1 * d1 + d5 * d5 + d2 * d2; + + if (d0 < 0.0D || d7 < d0) + { + d0 = d7; + i1 = j2; + j1 = j3; + k1 = l2; + l1 = k3 % 4; + } + } + } + } + } + } + + if (d0 < 0.0D) + { + for (int l5 = j - i; l5 <= j + i; ++l5) + { + double d3 = (double)l5 + 0.5D - p_85188_1_.posX; + + for (int j6 = l - i; j6 <= l + i; ++j6) + { + double d4 = (double)j6 + 0.5D - p_85188_1_.posZ; + label562: + + for (int i7 = this.worldServerInstance.getActualHeight() - 1; i7 >= 0; --i7) + { + if (this.worldServerInstance.isAirBlock(blockpos$mutableblockpos.func_181079_c(l5, i7, j6))) + { + while (i7 > 0 && this.worldServerInstance.isAirBlock(blockpos$mutableblockpos.func_181079_c(l5, i7 - 1, j6))) + { + --i7; + } + + for (int k7 = i2; k7 < i2 + 2; ++k7) + { + int j8 = k7 % 2; + int j9 = 1 - j8; + + for (int j10 = 0; j10 < 4; ++j10) + { + for (int j11 = -1; j11 < 4; ++j11) + { + int j12 = l5 + (j10 - 1) * j8; + int i13 = i7 + j11; + int j13 = j6 + (j10 - 1) * j9; + blockpos$mutableblockpos.func_181079_c(j12, i13, j13); + + if (j11 < 0 && !this.worldServerInstance.getBlockState(blockpos$mutableblockpos).getBlock().getMaterial().isSolid() || j11 >= 0 && !this.worldServerInstance.isAirBlock(blockpos$mutableblockpos)) + { + continue label562; + } + } + } + + double d6 = (double)i7 + 0.5D - p_85188_1_.posY; + double d8 = d3 * d3 + d6 * d6 + d4 * d4; + + if (d0 < 0.0D || d8 < d0) + { + d0 = d8; + i1 = l5; + j1 = i7; + k1 = j6; + l1 = k7 % 2; + } + } + } + } + } + } + } + + int i6 = i1; + int k2 = j1; + int k6 = k1; + int l6 = l1 % 2; + int i3 = 1 - l6; + + if (l1 % 4 >= 2) + { + l6 = -l6; + i3 = -i3; + } + + if (d0 < 0.0D) + { + j1 = MathHelper.clamp_int(j1, 70, this.worldServerInstance.getActualHeight() - 10); + k2 = j1; + + for (int j7 = -1; j7 <= 1; ++j7) + { + for (int l7 = 1; l7 < 3; ++l7) + { + for (int k8 = -1; k8 < 3; ++k8) + { + int k9 = i6 + (l7 - 1) * l6 + j7 * i3; + int k10 = k2 + k8; + int k11 = k6 + (l7 - 1) * i3 - j7 * l6; + boolean flag = k8 < 0; + this.worldServerInstance.setBlockState(new BlockPos(k9, k10, k11), flag ? Blocks.obsidian.getDefaultState() : Blocks.air.getDefaultState()); + } + } + } + } + + IBlockState iblockstate = Blocks.portal.getDefaultState().withProperty(BlockPortal.AXIS, l6 != 0 ? EnumFacing.Axis.X : EnumFacing.Axis.Z); + + for (int i8 = 0; i8 < 4; ++i8) + { + for (int l8 = 0; l8 < 4; ++l8) + { + for (int l9 = -1; l9 < 4; ++l9) + { + int l10 = i6 + (l8 - 1) * l6; + int l11 = k2 + l9; + int k12 = k6 + (l8 - 1) * i3; + boolean flag1 = l8 == 0 || l8 == 3 || l9 == -1 || l9 == 3; + this.worldServerInstance.setBlockState(new BlockPos(l10, l11, k12), flag1 ? Blocks.obsidian.getDefaultState() : iblockstate, 2); + } + } + + for (int i9 = 0; i9 < 4; ++i9) + { + for (int i10 = -1; i10 < 4; ++i10) + { + int i11 = i6 + (i9 - 1) * l6; + int i12 = k2 + i10; + int l12 = k6 + (i9 - 1) * i3; + BlockPos blockpos = new BlockPos(i11, i12, l12); + this.worldServerInstance.notifyNeighborsOfStateChange(blockpos, this.worldServerInstance.getBlockState(blockpos).getBlock()); + } + } + } + + return true; + } + + /** + * called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a + * WorldServer.getTotalWorldTime() value. + */ + public void removeStalePortalLocations(long worldTime) + { + if (worldTime % 100L == 0L) + { + Iterator iterator = this.destinationCoordinateKeys.iterator(); + long i = worldTime - 300L; + + while (iterator.hasNext()) + { + Long olong = (Long)iterator.next(); + Teleporter.PortalPosition teleporter$portalposition = (Teleporter.PortalPosition)this.destinationCoordinateCache.getValueByKey(olong.longValue()); + + if (teleporter$portalposition == null || teleporter$portalposition.lastUpdateTime < i) + { + iterator.remove(); + this.destinationCoordinateCache.remove(olong.longValue()); + } + } + } + } + + public class PortalPosition extends BlockPos + { + public long lastUpdateTime; + + public PortalPosition(BlockPos pos, long lastUpdate) + { + super(pos.getX(), pos.getY(), pos.getZ()); + this.lastUpdateTime = lastUpdate; + } + } +} diff --git a/src/minecraft/net/minecraft/world/World.java b/src/minecraft/net/minecraft/world/World.java new file mode 100644 index 0000000..3de5529 --- /dev/null +++ b/src/minecraft/net/minecraft/world/World.java @@ -0,0 +1,3859 @@ +package net.minecraft.world; + +import com.google.common.base.Predicate; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.util.Calendar; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Callable; +import net.minecraft.block.Block; +import net.minecraft.block.BlockHopper; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.BlockSlab; +import net.minecraft.block.BlockSnow; +import net.minecraft.block.BlockStairs; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.profiler.Profiler; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.server.MinecraftServer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.ITickable; +import net.minecraft.util.IntHashMap; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.ReportedException; +import net.minecraft.util.Vec3; +import net.minecraft.village.VillageCollection; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.border.WorldBorder; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.structure.StructureBoundingBox; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.MapStorage; +import net.minecraft.world.storage.WorldInfo; + +public abstract class World implements IBlockAccess +{ + private int field_181546_a = 63; + + /** + * boolean; if true updates scheduled by scheduleBlockUpdate happen immediately + */ + protected boolean scheduledUpdatesAreImmediate; + public final List loadedEntityList = Lists.newArrayList(); + protected final List unloadedEntityList = Lists.newArrayList(); + public final List loadedTileEntityList = Lists.newArrayList(); + public final List tickableTileEntities = Lists.newArrayList(); + private final List addedTileEntityList = Lists.newArrayList(); + private final List tileEntitiesToBeRemoved = Lists.newArrayList(); + public final List playerEntities = Lists.newArrayList(); + public final List weatherEffects = Lists.newArrayList(); + protected final IntHashMap entitiesById = new IntHashMap(); + private long cloudColour = 16777215L; + + /** How much light is subtracted from full daylight */ + private int skylightSubtracted; + + /** + * Contains the current Linear Congruential Generator seed for block updates. Used with an A value of 3 and a C + * value of 0x3c6ef35f, producing a highly planar series of values ill-suited for choosing random blocks in a + * 16x128x16 field. + */ + protected int updateLCG = (new Random()).nextInt(); + + /** + * magic number used to generate fast random numbers for 3d distribution within a chunk + */ + protected final int DIST_HASH_MAGIC = 1013904223; + protected float prevRainingStrength; + protected float rainingStrength; + protected float prevThunderingStrength; + protected float thunderingStrength; + + /** + * Set to 2 whenever a lightning bolt is generated in SSP. Decrements if > 0 in updateWeather(). Value appears to be + * unused. + */ + private int lastLightningBolt; + + /** RNG for World. */ + public final Random rand = new Random(); + + /** The WorldProvider instance that World uses. */ + public final WorldProvider provider; + protected List worldAccesses = Lists.newArrayList(); + + /** Handles chunk operations and caching */ + protected IChunkProvider chunkProvider; + protected final ISaveHandler saveHandler; + + /** + * holds information about a world (size on disk, time, spawn point, seed, ...) + */ + public WorldInfo worldInfo; + + /** + * if set, this flag forces a request to load a chunk to load the chunk rather than defaulting to the world's + * chunkprovider's dummy if possible + */ + protected boolean findingSpawnPoint; + protected MapStorage mapStorage; + protected VillageCollection villageCollectionObj; + public final Profiler theProfiler; + private final Calendar theCalendar = Calendar.getInstance(); + protected Scoreboard worldScoreboard = new Scoreboard(); + + /** + * True if the world is a 'slave' client; changes will not be saved or propagated from this world. For example, + * server worlds have this set to false, client worlds have this set to true. + */ + public final boolean isRemote; + protected Set activeChunkSet = Sets.newHashSet(); + + /** number of ticks until the next random ambients play */ + private int ambientTickCountdown; + + /** indicates if enemies are spawned or not */ + protected boolean spawnHostileMobs; + + /** A flag indicating whether we should spawn peaceful mobs. */ + protected boolean spawnPeacefulMobs; + private boolean processingLoadedTiles; + private final WorldBorder worldBorder; + + /** + * is a temporary list of blocks and light values used when updating light levels. Holds up to 32x32x32 blocks (the + * maximum influence of a light source.) Every element is a packed bit value: 0000000000LLLLzzzzzzyyyyyyxxxxxx. The + * 4-bit L is a light level used when darkening blocks. 6-bit numbers x, y and z represent the block's offset from + * the original block, plus 32 (i.e. value of 31 would mean a -1 offset + */ + int[] lightUpdateBlockList; + + protected World(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) + { + this.ambientTickCountdown = this.rand.nextInt(12000); + this.spawnHostileMobs = true; + this.spawnPeacefulMobs = true; + this.lightUpdateBlockList = new int[32768]; + this.saveHandler = saveHandlerIn; + this.theProfiler = profilerIn; + this.worldInfo = info; + this.provider = providerIn; + this.isRemote = client; + this.worldBorder = providerIn.getWorldBorder(); + } + + public World init() + { + return this; + } + + public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) + { + if (this.isBlockLoaded(pos)) + { + Chunk chunk = this.getChunkFromBlockCoords(pos); + + try + { + return chunk.getBiome(pos, this.provider.getWorldChunkManager()); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting biome"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Coordinates of biome request"); + crashreportcategory.addCrashSectionCallable("Location", new Callable() + { + public String call() throws Exception + { + return CrashReportCategory.getCoordinateInfo(pos); + } + }); + throw new ReportedException(crashreport); + } + } + else + { + return this.provider.getWorldChunkManager().getBiomeGenerator(pos, BiomeGenBase.plains); + } + } + + public WorldChunkManager getWorldChunkManager() + { + return this.provider.getWorldChunkManager(); + } + + /** + * Creates the chunk provider for this world. Called in the constructor. Retrieves provider from worldProvider? + */ + protected abstract IChunkProvider createChunkProvider(); + + public void initialize(WorldSettings settings) + { + this.worldInfo.setServerInitialized(true); + } + + /** + * Sets a new spawn location by finding an uncovered block at a random (x,z) location in the chunk. + */ + public void setInitialSpawnLocation() + { + this.setSpawnPoint(new BlockPos(8, 64, 8)); + } + + public Block getGroundAboveSeaLevel(BlockPos pos) + { + BlockPos blockpos; + + for (blockpos = new BlockPos(pos.getX(), this.func_181545_F(), pos.getZ()); !this.isAirBlock(blockpos.up()); blockpos = blockpos.up()) + { + ; + } + + return this.getBlockState(blockpos).getBlock(); + } + + /** + * Check if the given BlockPos has valid coordinates + */ + private boolean isValid(BlockPos pos) + { + return pos.getX() >= -30000000 && pos.getZ() >= -30000000 && pos.getX() < 30000000 && pos.getZ() < 30000000 && pos.getY() >= 0 && pos.getY() < 256; + } + + /** + * Checks to see if an air block exists at the provided location. Note that this only checks to see if the blocks + * material is set to air, meaning it is possible for non-vanilla blocks to still pass this check. + */ + public boolean isAirBlock(BlockPos pos) + { + return this.getBlockState(pos).getBlock().getMaterial() == Material.air; + } + + public boolean isBlockLoaded(BlockPos pos) + { + return this.isBlockLoaded(pos, true); + } + + public boolean isBlockLoaded(BlockPos pos, boolean allowEmpty) + { + return !this.isValid(pos) ? false : this.isChunkLoaded(pos.getX() >> 4, pos.getZ() >> 4, allowEmpty); + } + + public boolean isAreaLoaded(BlockPos center, int radius) + { + return this.isAreaLoaded(center, radius, true); + } + + public boolean isAreaLoaded(BlockPos center, int radius, boolean allowEmpty) + { + return this.isAreaLoaded(center.getX() - radius, center.getY() - radius, center.getZ() - radius, center.getX() + radius, center.getY() + radius, center.getZ() + radius, allowEmpty); + } + + public boolean isAreaLoaded(BlockPos from, BlockPos to) + { + return this.isAreaLoaded(from, to, true); + } + + public boolean isAreaLoaded(BlockPos from, BlockPos to, boolean allowEmpty) + { + return this.isAreaLoaded(from.getX(), from.getY(), from.getZ(), to.getX(), to.getY(), to.getZ(), allowEmpty); + } + + public boolean isAreaLoaded(StructureBoundingBox box) + { + return this.isAreaLoaded(box, true); + } + + public boolean isAreaLoaded(StructureBoundingBox box, boolean allowEmpty) + { + return this.isAreaLoaded(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ, allowEmpty); + } + + private boolean isAreaLoaded(int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, boolean allowEmpty) + { + if (yEnd >= 0 && yStart < 256) + { + xStart = xStart >> 4; + zStart = zStart >> 4; + xEnd = xEnd >> 4; + zEnd = zEnd >> 4; + + for (int i = xStart; i <= xEnd; ++i) + { + for (int j = zStart; j <= zEnd; ++j) + { + if (!this.isChunkLoaded(i, j, allowEmpty)) + { + return false; + } + } + } + + return true; + } + else + { + return false; + } + } + + protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) + { + return this.chunkProvider.chunkExists(x, z) && (allowEmpty || !this.chunkProvider.provideChunk(x, z).isEmpty()); + } + + public Chunk getChunkFromBlockCoords(BlockPos pos) + { + return this.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4); + } + + /** + * Returns back a chunk looked up by chunk coordinates Args: x, y + */ + public Chunk getChunkFromChunkCoords(int chunkX, int chunkZ) + { + return this.chunkProvider.provideChunk(chunkX, chunkZ); + } + + /** + * Sets the block state at a given location. Flag 1 will cause a block update. Flag 2 will send the change to + * clients (you almost always want this). Flag 4 prevents the block from being re-rendered, if this is a client + * world. Flags can be added together. + */ + public boolean setBlockState(BlockPos pos, IBlockState newState, int flags) + { + if (!this.isValid(pos)) + { + return false; + } + else if (!this.isRemote && this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD) + { + return false; + } + else + { + Chunk chunk = this.getChunkFromBlockCoords(pos); + Block block = newState.getBlock(); + IBlockState iblockstate = chunk.setBlockState(pos, newState); + + if (iblockstate == null) + { + return false; + } + else + { + Block block1 = iblockstate.getBlock(); + + if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue()) + { + this.theProfiler.startSection("checkLight"); + this.checkLight(pos); + this.theProfiler.endSection(); + } + + if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated()) + { + this.markBlockForUpdate(pos); + } + + if (!this.isRemote && (flags & 1) != 0) + { + this.notifyNeighborsRespectDebug(pos, iblockstate.getBlock()); + + if (block.hasComparatorInputOverride()) + { + this.updateComparatorOutputLevel(pos, block); + } + } + + return true; + } + } + } + + public boolean setBlockToAir(BlockPos pos) + { + return this.setBlockState(pos, Blocks.air.getDefaultState(), 3); + } + + /** + * Sets a block to air, but also plays the sound and particles and can spawn drops + */ + public boolean destroyBlock(BlockPos pos, boolean dropBlock) + { + IBlockState iblockstate = this.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if (block.getMaterial() == Material.air) + { + return false; + } + else + { + this.playAuxSFX(2001, pos, Block.getStateId(iblockstate)); + + if (dropBlock) + { + block.dropBlockAsItem(this, pos, iblockstate, 0); + } + + return this.setBlockState(pos, Blocks.air.getDefaultState(), 3); + } + } + + /** + * Convenience method to update the block on both the client and server + */ + public boolean setBlockState(BlockPos pos, IBlockState state) + { + return this.setBlockState(pos, state, 3); + } + + public void markBlockForUpdate(BlockPos pos) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).markBlockForUpdate(pos); + } + } + + public void notifyNeighborsRespectDebug(BlockPos pos, Block blockType) + { + if (this.worldInfo.getTerrainType() != WorldType.DEBUG_WORLD) + { + this.notifyNeighborsOfStateChange(pos, blockType); + } + } + + /** + * marks a vertical line of blocks as dirty + */ + public void markBlocksDirtyVertical(int x1, int z1, int x2, int z2) + { + if (x2 > z2) + { + int i = z2; + z2 = x2; + x2 = i; + } + + if (!this.provider.getHasNoSky()) + { + for (int j = x2; j <= z2; ++j) + { + this.checkLightFor(EnumSkyBlock.SKY, new BlockPos(x1, j, z1)); + } + } + + this.markBlockRangeForRenderUpdate(x1, x2, z1, x1, z2, z1); + } + + public void markBlockRangeForRenderUpdate(BlockPos rangeMin, BlockPos rangeMax) + { + this.markBlockRangeForRenderUpdate(rangeMin.getX(), rangeMin.getY(), rangeMin.getZ(), rangeMax.getX(), rangeMax.getY(), rangeMax.getZ()); + } + + public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).markBlockRangeForRenderUpdate(x1, y1, z1, x2, y2, z2); + } + } + + public void notifyNeighborsOfStateChange(BlockPos pos, Block blockType) + { + this.notifyBlockOfStateChange(pos.west(), blockType); + this.notifyBlockOfStateChange(pos.east(), blockType); + this.notifyBlockOfStateChange(pos.down(), blockType); + this.notifyBlockOfStateChange(pos.up(), blockType); + this.notifyBlockOfStateChange(pos.north(), blockType); + this.notifyBlockOfStateChange(pos.south(), blockType); + } + + public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, EnumFacing skipSide) + { + if (skipSide != EnumFacing.WEST) + { + this.notifyBlockOfStateChange(pos.west(), blockType); + } + + if (skipSide != EnumFacing.EAST) + { + this.notifyBlockOfStateChange(pos.east(), blockType); + } + + if (skipSide != EnumFacing.DOWN) + { + this.notifyBlockOfStateChange(pos.down(), blockType); + } + + if (skipSide != EnumFacing.UP) + { + this.notifyBlockOfStateChange(pos.up(), blockType); + } + + if (skipSide != EnumFacing.NORTH) + { + this.notifyBlockOfStateChange(pos.north(), blockType); + } + + if (skipSide != EnumFacing.SOUTH) + { + this.notifyBlockOfStateChange(pos.south(), blockType); + } + } + + public void notifyBlockOfStateChange(BlockPos pos, final Block blockIn) + { + if (!this.isRemote) + { + IBlockState iblockstate = this.getBlockState(pos); + + try + { + iblockstate.getBlock().onNeighborBlockChange(this, pos, iblockstate, blockIn); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception while updating neighbours"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being updated"); + crashreportcategory.addCrashSectionCallable("Source block type", new Callable() + { + public String call() throws Exception + { + try + { + return String.format("ID #%d (%s // %s)", new Object[] {Integer.valueOf(Block.getIdFromBlock(blockIn)), blockIn.getUnlocalizedName(), blockIn.getClass().getCanonicalName()}); + } + catch (Throwable var2) + { + return "ID #" + Block.getIdFromBlock(blockIn); + } + } + }); + CrashReportCategory.addBlockInfo(crashreportcategory, pos, iblockstate); + throw new ReportedException(crashreport); + } + } + } + + public boolean isBlockTickPending(BlockPos pos, Block blockType) + { + return false; + } + + public boolean canSeeSky(BlockPos pos) + { + return this.getChunkFromBlockCoords(pos).canSeeSky(pos); + } + + public boolean canBlockSeeSky(BlockPos pos) + { + if (pos.getY() >= this.func_181545_F()) + { + return this.canSeeSky(pos); + } + else + { + BlockPos blockpos = new BlockPos(pos.getX(), this.func_181545_F(), pos.getZ()); + + if (!this.canSeeSky(blockpos)) + { + return false; + } + else + { + for (blockpos = blockpos.down(); blockpos.getY() > pos.getY(); blockpos = blockpos.down()) + { + Block block = this.getBlockState(blockpos).getBlock(); + + if (block.getLightOpacity() > 0 && !block.getMaterial().isLiquid()) + { + return false; + } + } + + return true; + } + } + } + + public int getLight(BlockPos pos) + { + if (pos.getY() < 0) + { + return 0; + } + else + { + if (pos.getY() >= 256) + { + pos = new BlockPos(pos.getX(), 255, pos.getZ()); + } + + return this.getChunkFromBlockCoords(pos).getLightSubtracted(pos, 0); + } + } + + public int getLightFromNeighbors(BlockPos pos) + { + return this.getLight(pos, true); + } + + public int getLight(BlockPos pos, boolean checkNeighbors) + { + if (pos.getX() >= -30000000 && pos.getZ() >= -30000000 && pos.getX() < 30000000 && pos.getZ() < 30000000) + { + if (checkNeighbors && this.getBlockState(pos).getBlock().getUseNeighborBrightness()) + { + int i1 = this.getLight(pos.up(), false); + int i = this.getLight(pos.east(), false); + int j = this.getLight(pos.west(), false); + int k = this.getLight(pos.south(), false); + int l = this.getLight(pos.north(), false); + + if (i > i1) + { + i1 = i; + } + + if (j > i1) + { + i1 = j; + } + + if (k > i1) + { + i1 = k; + } + + if (l > i1) + { + i1 = l; + } + + return i1; + } + else if (pos.getY() < 0) + { + return 0; + } + else + { + if (pos.getY() >= 256) + { + pos = new BlockPos(pos.getX(), 255, pos.getZ()); + } + + Chunk chunk = this.getChunkFromBlockCoords(pos); + return chunk.getLightSubtracted(pos, this.skylightSubtracted); + } + } + else + { + return 15; + } + } + + /** + * Returns the position at this x, z coordinate in the chunk with y set to the value from the height map. + */ + public BlockPos getHeight(BlockPos pos) + { + int i; + + if (pos.getX() >= -30000000 && pos.getZ() >= -30000000 && pos.getX() < 30000000 && pos.getZ() < 30000000) + { + if (this.isChunkLoaded(pos.getX() >> 4, pos.getZ() >> 4, true)) + { + i = this.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4).getHeightValue(pos.getX() & 15, pos.getZ() & 15); + } + else + { + i = 0; + } + } + else + { + i = this.func_181545_F() + 1; + } + + return new BlockPos(pos.getX(), i, pos.getZ()); + } + + /** + * Gets the lowest height of the chunk where sunlight directly reaches + */ + public int getChunksLowestHorizon(int x, int z) + { + if (x >= -30000000 && z >= -30000000 && x < 30000000 && z < 30000000) + { + if (!this.isChunkLoaded(x >> 4, z >> 4, true)) + { + return 0; + } + else + { + Chunk chunk = this.getChunkFromChunkCoords(x >> 4, z >> 4); + return chunk.getLowestHeight(); + } + } + else + { + return this.func_181545_F() + 1; + } + } + + public int getLightFromNeighborsFor(EnumSkyBlock type, BlockPos pos) + { + if (this.provider.getHasNoSky() && type == EnumSkyBlock.SKY) + { + return 0; + } + else + { + if (pos.getY() < 0) + { + pos = new BlockPos(pos.getX(), 0, pos.getZ()); + } + + if (!this.isValid(pos)) + { + return type.defaultLightValue; + } + else if (!this.isBlockLoaded(pos)) + { + return type.defaultLightValue; + } + else if (this.getBlockState(pos).getBlock().getUseNeighborBrightness()) + { + int i1 = this.getLightFor(type, pos.up()); + int i = this.getLightFor(type, pos.east()); + int j = this.getLightFor(type, pos.west()); + int k = this.getLightFor(type, pos.south()); + int l = this.getLightFor(type, pos.north()); + + if (i > i1) + { + i1 = i; + } + + if (j > i1) + { + i1 = j; + } + + if (k > i1) + { + i1 = k; + } + + if (l > i1) + { + i1 = l; + } + + return i1; + } + else + { + Chunk chunk = this.getChunkFromBlockCoords(pos); + return chunk.getLightFor(type, pos); + } + } + } + + public int getLightFor(EnumSkyBlock type, BlockPos pos) + { + if (pos.getY() < 0) + { + pos = new BlockPos(pos.getX(), 0, pos.getZ()); + } + + if (!this.isValid(pos)) + { + return type.defaultLightValue; + } + else if (!this.isBlockLoaded(pos)) + { + return type.defaultLightValue; + } + else + { + Chunk chunk = this.getChunkFromBlockCoords(pos); + return chunk.getLightFor(type, pos); + } + } + + public void setLightFor(EnumSkyBlock type, BlockPos pos, int lightValue) + { + if (this.isValid(pos)) + { + if (this.isBlockLoaded(pos)) + { + Chunk chunk = this.getChunkFromBlockCoords(pos); + chunk.setLightFor(type, pos, lightValue); + this.notifyLightSet(pos); + } + } + } + + public void notifyLightSet(BlockPos pos) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).notifyLightSet(pos); + } + } + + public int getCombinedLight(BlockPos pos, int lightValue) + { + int i = this.getLightFromNeighborsFor(EnumSkyBlock.SKY, pos); + int j = this.getLightFromNeighborsFor(EnumSkyBlock.BLOCK, pos); + + if (j < lightValue) + { + j = lightValue; + } + + return i << 20 | j << 4; + } + + public float getLightBrightness(BlockPos pos) + { + return this.provider.getLightBrightnessTable()[this.getLightFromNeighbors(pos)]; + } + + public IBlockState getBlockState(BlockPos pos) + { + if (!this.isValid(pos)) + { + return Blocks.air.getDefaultState(); + } + else + { + Chunk chunk = this.getChunkFromBlockCoords(pos); + return chunk.getBlockState(pos); + } + } + + /** + * Checks whether its daytime by seeing if the light subtracted from the skylight is less than 4 + */ + public boolean isDaytime() + { + return this.skylightSubtracted < 4; + } + + /** + * ray traces all blocks, including non-collideable ones + */ + public MovingObjectPosition rayTraceBlocks(Vec3 p_72933_1_, Vec3 p_72933_2_) + { + return this.rayTraceBlocks(p_72933_1_, p_72933_2_, false, false, false); + } + + public MovingObjectPosition rayTraceBlocks(Vec3 start, Vec3 end, boolean stopOnLiquid) + { + return this.rayTraceBlocks(start, end, stopOnLiquid, false, false); + } + + /** + * Performs a raycast against all blocks in the world. Args : Vec1, Vec2, stopOnLiquid, + * ignoreBlockWithoutBoundingBox, returnLastUncollidableBlock + */ + public MovingObjectPosition rayTraceBlocks(Vec3 vec31, Vec3 vec32, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) + { + if (!Double.isNaN(vec31.xCoord) && !Double.isNaN(vec31.yCoord) && !Double.isNaN(vec31.zCoord)) + { + if (!Double.isNaN(vec32.xCoord) && !Double.isNaN(vec32.yCoord) && !Double.isNaN(vec32.zCoord)) + { + int i = MathHelper.floor_double(vec32.xCoord); + int j = MathHelper.floor_double(vec32.yCoord); + int k = MathHelper.floor_double(vec32.zCoord); + int l = MathHelper.floor_double(vec31.xCoord); + int i1 = MathHelper.floor_double(vec31.yCoord); + int j1 = MathHelper.floor_double(vec31.zCoord); + BlockPos blockpos = new BlockPos(l, i1, j1); + IBlockState iblockstate = this.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + + if ((!ignoreBlockWithoutBoundingBox || block.getCollisionBoundingBox(this, blockpos, iblockstate) != null) && block.canCollideCheck(iblockstate, stopOnLiquid)) + { + MovingObjectPosition movingobjectposition = block.collisionRayTrace(this, blockpos, vec31, vec32); + + if (movingobjectposition != null) + { + return movingobjectposition; + } + } + + MovingObjectPosition movingobjectposition2 = null; + int k1 = 200; + + while (k1-- >= 0) + { + if (Double.isNaN(vec31.xCoord) || Double.isNaN(vec31.yCoord) || Double.isNaN(vec31.zCoord)) + { + return null; + } + + if (l == i && i1 == j && j1 == k) + { + return returnLastUncollidableBlock ? movingobjectposition2 : null; + } + + boolean flag2 = true; + boolean flag = true; + boolean flag1 = true; + double d0 = 999.0D; + double d1 = 999.0D; + double d2 = 999.0D; + + if (i > l) + { + d0 = (double)l + 1.0D; + } + else if (i < l) + { + d0 = (double)l + 0.0D; + } + else + { + flag2 = false; + } + + if (j > i1) + { + d1 = (double)i1 + 1.0D; + } + else if (j < i1) + { + d1 = (double)i1 + 0.0D; + } + else + { + flag = false; + } + + if (k > j1) + { + d2 = (double)j1 + 1.0D; + } + else if (k < j1) + { + d2 = (double)j1 + 0.0D; + } + else + { + flag1 = false; + } + + double d3 = 999.0D; + double d4 = 999.0D; + double d5 = 999.0D; + double d6 = vec32.xCoord - vec31.xCoord; + double d7 = vec32.yCoord - vec31.yCoord; + double d8 = vec32.zCoord - vec31.zCoord; + + if (flag2) + { + d3 = (d0 - vec31.xCoord) / d6; + } + + if (flag) + { + d4 = (d1 - vec31.yCoord) / d7; + } + + if (flag1) + { + d5 = (d2 - vec31.zCoord) / d8; + } + + if (d3 == -0.0D) + { + d3 = -1.0E-4D; + } + + if (d4 == -0.0D) + { + d4 = -1.0E-4D; + } + + if (d5 == -0.0D) + { + d5 = -1.0E-4D; + } + + EnumFacing enumfacing; + + if (d3 < d4 && d3 < d5) + { + enumfacing = i > l ? EnumFacing.WEST : EnumFacing.EAST; + vec31 = new Vec3(d0, vec31.yCoord + d7 * d3, vec31.zCoord + d8 * d3); + } + else if (d4 < d5) + { + enumfacing = j > i1 ? EnumFacing.DOWN : EnumFacing.UP; + vec31 = new Vec3(vec31.xCoord + d6 * d4, d1, vec31.zCoord + d8 * d4); + } + else + { + enumfacing = k > j1 ? EnumFacing.NORTH : EnumFacing.SOUTH; + vec31 = new Vec3(vec31.xCoord + d6 * d5, vec31.yCoord + d7 * d5, d2); + } + + l = MathHelper.floor_double(vec31.xCoord) - (enumfacing == EnumFacing.EAST ? 1 : 0); + i1 = MathHelper.floor_double(vec31.yCoord) - (enumfacing == EnumFacing.UP ? 1 : 0); + j1 = MathHelper.floor_double(vec31.zCoord) - (enumfacing == EnumFacing.SOUTH ? 1 : 0); + blockpos = new BlockPos(l, i1, j1); + IBlockState iblockstate1 = this.getBlockState(blockpos); + Block block1 = iblockstate1.getBlock(); + + if (!ignoreBlockWithoutBoundingBox || block1.getCollisionBoundingBox(this, blockpos, iblockstate1) != null) + { + if (block1.canCollideCheck(iblockstate1, stopOnLiquid)) + { + MovingObjectPosition movingobjectposition1 = block1.collisionRayTrace(this, blockpos, vec31, vec32); + + if (movingobjectposition1 != null) + { + return movingobjectposition1; + } + } + else + { + movingobjectposition2 = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec31, enumfacing, blockpos); + } + } + } + + return returnLastUncollidableBlock ? movingobjectposition2 : null; + } + else + { + return null; + } + } + else + { + return null; + } + } + + /** + * Plays a sound at the entity's position. Args: entity, sound, volume (relative to 1.0), and frequency (or pitch, + * also relative to 1.0). + */ + public void playSoundAtEntity(Entity entityIn, String name, float volume, float pitch) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playSound(name, entityIn.posX, entityIn.posY, entityIn.posZ, volume, pitch); + } + } + + /** + * Plays sound to all near players except the player reference given + */ + public void playSoundToNearExcept(EntityPlayer player, String name, float volume, float pitch) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playSoundToNearExcept(player, name, player.posX, player.posY, player.posZ, volume, pitch); + } + } + + /** + * Play a sound effect. Many many parameters for this function. Not sure what they do, but a classic call is : + * (double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, 'random.door_open', 1.0F, world.rand.nextFloat() * 0.1F + + * 0.9F with i,j,k position of the block. + */ + public void playSoundEffect(double x, double y, double z, String soundName, float volume, float pitch) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playSound(soundName, x, y, z, volume, pitch); + } + } + + /** + * par8 is loudness, all pars passed to minecraftInstance.sndManager.playSound + */ + public void playSound(double x, double y, double z, String soundName, float volume, float pitch, boolean distanceDelay) + { + } + + public void playRecord(BlockPos pos, String name) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playRecord(name, pos); + } + } + + public void spawnParticle(EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int... p_175688_14_) + { + this.spawnParticle(particleType.getParticleID(), particleType.getShouldIgnoreRange(), xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, p_175688_14_); + } + + public void spawnParticle(EnumParticleTypes particleType, boolean p_175682_2_, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int... p_175682_15_) + { + this.spawnParticle(particleType.getParticleID(), particleType.getShouldIgnoreRange() | p_175682_2_, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, p_175682_15_); + } + + private void spawnParticle(int particleID, boolean p_175720_2_, double xCood, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int... p_175720_15_) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).spawnParticle(particleID, p_175720_2_, xCood, yCoord, zCoord, xOffset, yOffset, zOffset, p_175720_15_); + } + } + + /** + * adds a lightning bolt to the list of lightning bolts in this world. + */ + public boolean addWeatherEffect(Entity entityIn) + { + this.weatherEffects.add(entityIn); + return true; + } + + /** + * Called when an entity is spawned in the world. This includes players. + */ + public boolean spawnEntityInWorld(Entity entityIn) + { + int i = MathHelper.floor_double(entityIn.posX / 16.0D); + int j = MathHelper.floor_double(entityIn.posZ / 16.0D); + boolean flag = entityIn.forceSpawn; + + if (entityIn instanceof EntityPlayer) + { + flag = true; + } + + if (!flag && !this.isChunkLoaded(i, j, true)) + { + return false; + } + else + { + if (entityIn instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)entityIn; + this.playerEntities.add(entityplayer); + this.updateAllPlayersSleepingFlag(); + } + + this.getChunkFromChunkCoords(i, j).addEntity(entityIn); + this.loadedEntityList.add(entityIn); + this.onEntityAdded(entityIn); + return true; + } + } + + protected void onEntityAdded(Entity entityIn) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).onEntityAdded(entityIn); + } + } + + protected void onEntityRemoved(Entity entityIn) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).onEntityRemoved(entityIn); + } + } + + /** + * Schedule the entity for removal during the next tick. Marks the entity dead in anticipation. + */ + public void removeEntity(Entity entityIn) + { + if (entityIn.riddenByEntity != null) + { + entityIn.riddenByEntity.mountEntity((Entity)null); + } + + if (entityIn.ridingEntity != null) + { + entityIn.mountEntity((Entity)null); + } + + entityIn.setDead(); + + if (entityIn instanceof EntityPlayer) + { + this.playerEntities.remove(entityIn); + this.updateAllPlayersSleepingFlag(); + this.onEntityRemoved(entityIn); + } + } + + /** + * Do NOT use this method to remove normal entities- use normal removeEntity + */ + public void removePlayerEntityDangerously(Entity entityIn) + { + entityIn.setDead(); + + if (entityIn instanceof EntityPlayer) + { + this.playerEntities.remove(entityIn); + this.updateAllPlayersSleepingFlag(); + } + + int i = entityIn.chunkCoordX; + int j = entityIn.chunkCoordZ; + + if (entityIn.addedToChunk && this.isChunkLoaded(i, j, true)) + { + this.getChunkFromChunkCoords(i, j).removeEntity(entityIn); + } + + this.loadedEntityList.remove(entityIn); + this.onEntityRemoved(entityIn); + } + + /** + * Adds a IWorldAccess to the list of worldAccesses + */ + public void addWorldAccess(IWorldAccess worldAccess) + { + this.worldAccesses.add(worldAccess); + } + + /** + * Removes a worldAccess from the worldAccesses object + */ + public void removeWorldAccess(IWorldAccess worldAccess) + { + this.worldAccesses.remove(worldAccess); + } + + public List getCollidingBoundingBoxes(Entity entityIn, AxisAlignedBB bb) + { + List list = Lists.newArrayList(); + int i = MathHelper.floor_double(bb.minX); + int j = MathHelper.floor_double(bb.maxX + 1.0D); + int k = MathHelper.floor_double(bb.minY); + int l = MathHelper.floor_double(bb.maxY + 1.0D); + int i1 = MathHelper.floor_double(bb.minZ); + int j1 = MathHelper.floor_double(bb.maxZ + 1.0D); + WorldBorder worldborder = this.getWorldBorder(); + boolean flag = entityIn.isOutsideBorder(); + boolean flag1 = this.isInsideBorder(worldborder, entityIn); + IBlockState iblockstate = Blocks.stone.getDefaultState(); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = i1; l1 < j1; ++l1) + { + if (this.isBlockLoaded(blockpos$mutableblockpos.func_181079_c(k1, 64, l1))) + { + for (int i2 = k - 1; i2 < l; ++i2) + { + blockpos$mutableblockpos.func_181079_c(k1, i2, l1); + + if (flag && flag1) + { + entityIn.setOutsideBorder(false); + } + else if (!flag && !flag1) + { + entityIn.setOutsideBorder(true); + } + + IBlockState iblockstate1 = iblockstate; + + if (worldborder.contains(blockpos$mutableblockpos) || !flag1) + { + iblockstate1 = this.getBlockState(blockpos$mutableblockpos); + } + + iblockstate1.getBlock().addCollisionBoxesToList(this, blockpos$mutableblockpos, iblockstate1, bb, list, entityIn); + } + } + } + } + + double d0 = 0.25D; + List list1 = this.getEntitiesWithinAABBExcludingEntity(entityIn, bb.expand(d0, d0, d0)); + + for (int j2 = 0; j2 < list1.size(); ++j2) + { + if (entityIn.riddenByEntity != list1 && entityIn.ridingEntity != list1) + { + AxisAlignedBB axisalignedbb = ((Entity)list1.get(j2)).getCollisionBoundingBox(); + + if (axisalignedbb != null && axisalignedbb.intersectsWith(bb)) + { + list.add(axisalignedbb); + } + + axisalignedbb = entityIn.getCollisionBox((Entity)list1.get(j2)); + + if (axisalignedbb != null && axisalignedbb.intersectsWith(bb)) + { + list.add(axisalignedbb); + } + } + } + + return list; + } + + public boolean isInsideBorder(WorldBorder worldBorderIn, Entity entityIn) + { + double d0 = worldBorderIn.minX(); + double d1 = worldBorderIn.minZ(); + double d2 = worldBorderIn.maxX(); + double d3 = worldBorderIn.maxZ(); + + if (entityIn.isOutsideBorder()) + { + ++d0; + ++d1; + --d2; + --d3; + } + else + { + --d0; + --d1; + ++d2; + ++d3; + } + + return entityIn.posX > d0 && entityIn.posX < d2 && entityIn.posZ > d1 && entityIn.posZ < d3; + } + + public List func_147461_a(AxisAlignedBB bb) + { + List list = Lists.newArrayList(); + int i = MathHelper.floor_double(bb.minX); + int j = MathHelper.floor_double(bb.maxX + 1.0D); + int k = MathHelper.floor_double(bb.minY); + int l = MathHelper.floor_double(bb.maxY + 1.0D); + int i1 = MathHelper.floor_double(bb.minZ); + int j1 = MathHelper.floor_double(bb.maxZ + 1.0D); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = i1; l1 < j1; ++l1) + { + if (this.isBlockLoaded(blockpos$mutableblockpos.func_181079_c(k1, 64, l1))) + { + for (int i2 = k - 1; i2 < l; ++i2) + { + blockpos$mutableblockpos.func_181079_c(k1, i2, l1); + IBlockState iblockstate; + + if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) + { + iblockstate = this.getBlockState(blockpos$mutableblockpos); + } + else + { + iblockstate = Blocks.bedrock.getDefaultState(); + } + + iblockstate.getBlock().addCollisionBoxesToList(this, blockpos$mutableblockpos, iblockstate, bb, list, (Entity)null); + } + } + } + } + + return list; + } + + /** + * Returns the amount of skylight subtracted for the current time + */ + public int calculateSkylightSubtracted(float p_72967_1_) + { + float f = this.getCelestialAngle(p_72967_1_); + float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F); + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + f1 = 1.0F - f1; + f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72967_1_) * 5.0F) / 16.0D)); + f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72967_1_) * 5.0F) / 16.0D)); + f1 = 1.0F - f1; + return (int)(f1 * 11.0F); + } + + /** + * Returns the sun brightness - checks time of day, rain and thunder + */ + public float getSunBrightness(float p_72971_1_) + { + float f = this.getCelestialAngle(p_72971_1_); + float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.2F); + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + f1 = 1.0F - f1; + f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72971_1_) * 5.0F) / 16.0D)); + f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72971_1_) * 5.0F) / 16.0D)); + return f1 * 0.8F + 0.2F; + } + + /** + * Calculates the color for the skybox + */ + public Vec3 getSkyColor(Entity entityIn, float partialTicks) + { + float f = this.getCelestialAngle(partialTicks); + float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + int i = MathHelper.floor_double(entityIn.posX); + int j = MathHelper.floor_double(entityIn.posY); + int k = MathHelper.floor_double(entityIn.posZ); + BlockPos blockpos = new BlockPos(i, j, k); + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(blockpos); + float f2 = biomegenbase.getFloatTemperature(blockpos); + int l = biomegenbase.getSkyColorByTemp(f2); + float f3 = (float)(l >> 16 & 255) / 255.0F; + float f4 = (float)(l >> 8 & 255) / 255.0F; + float f5 = (float)(l & 255) / 255.0F; + f3 = f3 * f1; + f4 = f4 * f1; + f5 = f5 * f1; + float f6 = this.getRainStrength(partialTicks); + + if (f6 > 0.0F) + { + float f7 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.6F; + float f8 = 1.0F - f6 * 0.75F; + f3 = f3 * f8 + f7 * (1.0F - f8); + f4 = f4 * f8 + f7 * (1.0F - f8); + f5 = f5 * f8 + f7 * (1.0F - f8); + } + + float f10 = this.getThunderStrength(partialTicks); + + if (f10 > 0.0F) + { + float f11 = (f3 * 0.3F + f4 * 0.59F + f5 * 0.11F) * 0.2F; + float f9 = 1.0F - f10 * 0.75F; + f3 = f3 * f9 + f11 * (1.0F - f9); + f4 = f4 * f9 + f11 * (1.0F - f9); + f5 = f5 * f9 + f11 * (1.0F - f9); + } + + if (this.lastLightningBolt > 0) + { + float f12 = (float)this.lastLightningBolt - partialTicks; + + if (f12 > 1.0F) + { + f12 = 1.0F; + } + + f12 = f12 * 0.45F; + f3 = f3 * (1.0F - f12) + 0.8F * f12; + f4 = f4 * (1.0F - f12) + 0.8F * f12; + f5 = f5 * (1.0F - f12) + 1.0F * f12; + } + + return new Vec3((double)f3, (double)f4, (double)f5); + } + + /** + * calls calculateCelestialAngle + */ + public float getCelestialAngle(float partialTicks) + { + return this.provider.calculateCelestialAngle(this.worldInfo.getWorldTime(), partialTicks); + } + + public int getMoonPhase() + { + return this.provider.getMoonPhase(this.worldInfo.getWorldTime()); + } + + /** + * gets the current fullness of the moon expressed as a float between 1.0 and 0.0, in steps of .25 + */ + public float getCurrentMoonPhaseFactor() + { + return WorldProvider.moonPhaseFactors[this.provider.getMoonPhase(this.worldInfo.getWorldTime())]; + } + + /** + * Return getCelestialAngle()*2*PI + */ + public float getCelestialAngleRadians(float partialTicks) + { + float f = this.getCelestialAngle(partialTicks); + return f * (float)Math.PI * 2.0F; + } + + public Vec3 getCloudColour(float partialTicks) + { + float f = this.getCelestialAngle(partialTicks); + float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + float f2 = (float)(this.cloudColour >> 16 & 255L) / 255.0F; + float f3 = (float)(this.cloudColour >> 8 & 255L) / 255.0F; + float f4 = (float)(this.cloudColour & 255L) / 255.0F; + float f5 = this.getRainStrength(partialTicks); + + if (f5 > 0.0F) + { + float f6 = (f2 * 0.3F + f3 * 0.59F + f4 * 0.11F) * 0.6F; + float f7 = 1.0F - f5 * 0.95F; + f2 = f2 * f7 + f6 * (1.0F - f7); + f3 = f3 * f7 + f6 * (1.0F - f7); + f4 = f4 * f7 + f6 * (1.0F - f7); + } + + f2 = f2 * (f1 * 0.9F + 0.1F); + f3 = f3 * (f1 * 0.9F + 0.1F); + f4 = f4 * (f1 * 0.85F + 0.15F); + float f9 = this.getThunderStrength(partialTicks); + + if (f9 > 0.0F) + { + float f10 = (f2 * 0.3F + f3 * 0.59F + f4 * 0.11F) * 0.2F; + float f8 = 1.0F - f9 * 0.95F; + f2 = f2 * f8 + f10 * (1.0F - f8); + f3 = f3 * f8 + f10 * (1.0F - f8); + f4 = f4 * f8 + f10 * (1.0F - f8); + } + + return new Vec3((double)f2, (double)f3, (double)f4); + } + + /** + * Returns vector(ish) with R/G/B for fog + */ + public Vec3 getFogColor(float partialTicks) + { + float f = this.getCelestialAngle(partialTicks); + return this.provider.getFogColor(f, partialTicks); + } + + public BlockPos getPrecipitationHeight(BlockPos pos) + { + return this.getChunkFromBlockCoords(pos).getPrecipitationHeight(pos); + } + + /** + * Finds the highest block on the x and z coordinate that is solid or liquid, and returns its y coord. + */ + public BlockPos getTopSolidOrLiquidBlock(BlockPos pos) + { + Chunk chunk = this.getChunkFromBlockCoords(pos); + BlockPos blockpos; + BlockPos blockpos1; + + for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) + { + blockpos1 = blockpos.down(); + Material material = chunk.getBlock(blockpos1).getMaterial(); + + if (material.blocksMovement() && material != Material.leaves) + { + break; + } + } + + return blockpos; + } + + /** + * How bright are stars in the sky + */ + public float getStarBrightness(float partialTicks) + { + float f = this.getCelestialAngle(partialTicks); + float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.25F); + f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F); + return f1 * f1 * 0.5F; + } + + public void scheduleUpdate(BlockPos pos, Block blockIn, int delay) + { + } + + public void updateBlockTick(BlockPos pos, Block blockIn, int delay, int priority) + { + } + + public void scheduleBlockUpdate(BlockPos pos, Block blockIn, int delay, int priority) + { + } + + /** + * Updates (and cleans up) entities and tile entities + */ + public void updateEntities() + { + this.theProfiler.startSection("entities"); + this.theProfiler.startSection("global"); + + for (int i = 0; i < this.weatherEffects.size(); ++i) + { + Entity entity = (Entity)this.weatherEffects.get(i); + + try + { + ++entity.ticksExisted; + entity.onUpdate(); + } + catch (Throwable throwable2) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable2, "Ticking entity"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being ticked"); + + if (entity == null) + { + crashreportcategory.addCrashSection("Entity", "~~NULL~~"); + } + else + { + entity.addEntityCrashInfo(crashreportcategory); + } + + throw new ReportedException(crashreport); + } + + if (entity.isDead) + { + this.weatherEffects.remove(i--); + } + } + + this.theProfiler.endStartSection("remove"); + this.loadedEntityList.removeAll(this.unloadedEntityList); + + for (int k = 0; k < this.unloadedEntityList.size(); ++k) + { + Entity entity1 = (Entity)this.unloadedEntityList.get(k); + int j = entity1.chunkCoordX; + int l1 = entity1.chunkCoordZ; + + if (entity1.addedToChunk && this.isChunkLoaded(j, l1, true)) + { + this.getChunkFromChunkCoords(j, l1).removeEntity(entity1); + } + } + + for (int l = 0; l < this.unloadedEntityList.size(); ++l) + { + this.onEntityRemoved((Entity)this.unloadedEntityList.get(l)); + } + + this.unloadedEntityList.clear(); + this.theProfiler.endStartSection("regular"); + + for (int i1 = 0; i1 < this.loadedEntityList.size(); ++i1) + { + Entity entity2 = (Entity)this.loadedEntityList.get(i1); + + if (entity2.ridingEntity != null) + { + if (!entity2.ridingEntity.isDead && entity2.ridingEntity.riddenByEntity == entity2) + { + continue; + } + + entity2.ridingEntity.riddenByEntity = null; + entity2.ridingEntity = null; + } + + this.theProfiler.startSection("tick"); + + if (!entity2.isDead) + { + try + { + this.updateEntity(entity2); + } + catch (Throwable throwable1) + { + CrashReport crashreport1 = CrashReport.makeCrashReport(throwable1, "Ticking entity"); + CrashReportCategory crashreportcategory2 = crashreport1.makeCategory("Entity being ticked"); + entity2.addEntityCrashInfo(crashreportcategory2); + throw new ReportedException(crashreport1); + } + } + + this.theProfiler.endSection(); + this.theProfiler.startSection("remove"); + + if (entity2.isDead) + { + int k1 = entity2.chunkCoordX; + int i2 = entity2.chunkCoordZ; + + if (entity2.addedToChunk && this.isChunkLoaded(k1, i2, true)) + { + this.getChunkFromChunkCoords(k1, i2).removeEntity(entity2); + } + + this.loadedEntityList.remove(i1--); + this.onEntityRemoved(entity2); + } + + this.theProfiler.endSection(); + } + + this.theProfiler.endStartSection("blockEntities"); + this.processingLoadedTiles = true; + Iterator iterator = this.tickableTileEntities.iterator(); + + while (iterator.hasNext()) + { + TileEntity tileentity = (TileEntity)iterator.next(); + + if (!tileentity.isInvalid() && tileentity.hasWorldObj()) + { + BlockPos blockpos = tileentity.getPos(); + + if (this.isBlockLoaded(blockpos) && this.worldBorder.contains(blockpos)) + { + try + { + ((ITickable)tileentity).update(); + } + catch (Throwable throwable) + { + CrashReport crashreport2 = CrashReport.makeCrashReport(throwable, "Ticking block entity"); + CrashReportCategory crashreportcategory1 = crashreport2.makeCategory("Block entity being ticked"); + tileentity.addInfoToCrashReport(crashreportcategory1); + throw new ReportedException(crashreport2); + } + } + } + + if (tileentity.isInvalid()) + { + iterator.remove(); + this.loadedTileEntityList.remove(tileentity); + + if (this.isBlockLoaded(tileentity.getPos())) + { + this.getChunkFromBlockCoords(tileentity.getPos()).removeTileEntity(tileentity.getPos()); + } + } + } + + this.processingLoadedTiles = false; + + if (!this.tileEntitiesToBeRemoved.isEmpty()) + { + this.tickableTileEntities.removeAll(this.tileEntitiesToBeRemoved); + this.loadedTileEntityList.removeAll(this.tileEntitiesToBeRemoved); + this.tileEntitiesToBeRemoved.clear(); + } + + this.theProfiler.endStartSection("pendingBlockEntities"); + + if (!this.addedTileEntityList.isEmpty()) + { + for (int j1 = 0; j1 < this.addedTileEntityList.size(); ++j1) + { + TileEntity tileentity1 = (TileEntity)this.addedTileEntityList.get(j1); + + if (!tileentity1.isInvalid()) + { + if (!this.loadedTileEntityList.contains(tileentity1)) + { + this.addTileEntity(tileentity1); + } + + if (this.isBlockLoaded(tileentity1.getPos())) + { + this.getChunkFromBlockCoords(tileentity1.getPos()).addTileEntity(tileentity1.getPos(), tileentity1); + } + + this.markBlockForUpdate(tileentity1.getPos()); + } + } + + this.addedTileEntityList.clear(); + } + + this.theProfiler.endSection(); + this.theProfiler.endSection(); + } + + public boolean addTileEntity(TileEntity tile) + { + boolean flag = this.loadedTileEntityList.add(tile); + + if (flag && tile instanceof ITickable) + { + this.tickableTileEntities.add(tile); + } + + return flag; + } + + public void addTileEntities(Collection tileEntityCollection) + { + if (this.processingLoadedTiles) + { + this.addedTileEntityList.addAll(tileEntityCollection); + } + else + { + for (TileEntity tileentity : tileEntityCollection) + { + this.loadedTileEntityList.add(tileentity); + + if (tileentity instanceof ITickable) + { + this.tickableTileEntities.add(tileentity); + } + } + } + } + + /** + * Will update the entity in the world if the chunk the entity is in is currently loaded. Args: entity + */ + public void updateEntity(Entity ent) + { + this.updateEntityWithOptionalForce(ent, true); + } + + /** + * Will update the entity in the world if the chunk the entity is in is currently loaded or its forced to update. + * Args: entity, forceUpdate + */ + public void updateEntityWithOptionalForce(Entity entityIn, boolean forceUpdate) + { + int i = MathHelper.floor_double(entityIn.posX); + int j = MathHelper.floor_double(entityIn.posZ); + int k = 32; + + if (!forceUpdate || this.isAreaLoaded(i - k, 0, j - k, i + k, 0, j + k, true)) + { + entityIn.lastTickPosX = entityIn.posX; + entityIn.lastTickPosY = entityIn.posY; + entityIn.lastTickPosZ = entityIn.posZ; + entityIn.prevRotationYaw = entityIn.rotationYaw; + entityIn.prevRotationPitch = entityIn.rotationPitch; + + if (forceUpdate && entityIn.addedToChunk) + { + ++entityIn.ticksExisted; + + if (entityIn.ridingEntity != null) + { + entityIn.updateRidden(); + } + else + { + entityIn.onUpdate(); + } + } + + this.theProfiler.startSection("chunkCheck"); + + if (Double.isNaN(entityIn.posX) || Double.isInfinite(entityIn.posX)) + { + entityIn.posX = entityIn.lastTickPosX; + } + + if (Double.isNaN(entityIn.posY) || Double.isInfinite(entityIn.posY)) + { + entityIn.posY = entityIn.lastTickPosY; + } + + if (Double.isNaN(entityIn.posZ) || Double.isInfinite(entityIn.posZ)) + { + entityIn.posZ = entityIn.lastTickPosZ; + } + + if (Double.isNaN((double)entityIn.rotationPitch) || Double.isInfinite((double)entityIn.rotationPitch)) + { + entityIn.rotationPitch = entityIn.prevRotationPitch; + } + + if (Double.isNaN((double)entityIn.rotationYaw) || Double.isInfinite((double)entityIn.rotationYaw)) + { + entityIn.rotationYaw = entityIn.prevRotationYaw; + } + + int l = MathHelper.floor_double(entityIn.posX / 16.0D); + int i1 = MathHelper.floor_double(entityIn.posY / 16.0D); + int j1 = MathHelper.floor_double(entityIn.posZ / 16.0D); + + if (!entityIn.addedToChunk || entityIn.chunkCoordX != l || entityIn.chunkCoordY != i1 || entityIn.chunkCoordZ != j1) + { + if (entityIn.addedToChunk && this.isChunkLoaded(entityIn.chunkCoordX, entityIn.chunkCoordZ, true)) + { + this.getChunkFromChunkCoords(entityIn.chunkCoordX, entityIn.chunkCoordZ).removeEntityAtIndex(entityIn, entityIn.chunkCoordY); + } + + if (this.isChunkLoaded(l, j1, true)) + { + entityIn.addedToChunk = true; + this.getChunkFromChunkCoords(l, j1).addEntity(entityIn); + } + else + { + entityIn.addedToChunk = false; + } + } + + this.theProfiler.endSection(); + + if (forceUpdate && entityIn.addedToChunk && entityIn.riddenByEntity != null) + { + if (!entityIn.riddenByEntity.isDead && entityIn.riddenByEntity.ridingEntity == entityIn) + { + this.updateEntity(entityIn.riddenByEntity); + } + else + { + entityIn.riddenByEntity.ridingEntity = null; + entityIn.riddenByEntity = null; + } + } + } + } + + /** + * Returns true if there are no solid, live entities in the specified AxisAlignedBB + */ + public boolean checkNoEntityCollision(AxisAlignedBB bb) + { + return this.checkNoEntityCollision(bb, (Entity)null); + } + + /** + * Returns true if there are no solid, live entities in the specified AxisAlignedBB, excluding the given entity + */ + public boolean checkNoEntityCollision(AxisAlignedBB bb, Entity entityIn) + { + List list = this.getEntitiesWithinAABBExcludingEntity((Entity)null, bb); + + for (int i = 0; i < list.size(); ++i) + { + Entity entity = (Entity)list.get(i); + + if (!entity.isDead && entity.preventEntitySpawning && entity != entityIn && (entityIn == null || entityIn.ridingEntity != entity && entityIn.riddenByEntity != entity)) + { + return false; + } + } + + return true; + } + + /** + * Returns true if there are any blocks in the region constrained by an AxisAlignedBB + */ + public boolean checkBlockCollision(AxisAlignedBB bb) + { + int i = MathHelper.floor_double(bb.minX); + int j = MathHelper.floor_double(bb.maxX); + int k = MathHelper.floor_double(bb.minY); + int l = MathHelper.floor_double(bb.maxY); + int i1 = MathHelper.floor_double(bb.minZ); + int j1 = MathHelper.floor_double(bb.maxZ); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k1 = i; k1 <= j; ++k1) + { + for (int l1 = k; l1 <= l; ++l1) + { + for (int i2 = i1; i2 <= j1; ++i2) + { + Block block = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock(); + + if (block.getMaterial() != Material.air) + { + return true; + } + } + } + } + + return false; + } + + /** + * Returns if any of the blocks within the aabb are liquids. Args: aabb + */ + public boolean isAnyLiquid(AxisAlignedBB bb) + { + int i = MathHelper.floor_double(bb.minX); + int j = MathHelper.floor_double(bb.maxX); + int k = MathHelper.floor_double(bb.minY); + int l = MathHelper.floor_double(bb.maxY); + int i1 = MathHelper.floor_double(bb.minZ); + int j1 = MathHelper.floor_double(bb.maxZ); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k1 = i; k1 <= j; ++k1) + { + for (int l1 = k; l1 <= l; ++l1) + { + for (int i2 = i1; i2 <= j1; ++i2) + { + Block block = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock(); + + if (block.getMaterial().isLiquid()) + { + return true; + } + } + } + } + + return false; + } + + public boolean isFlammableWithin(AxisAlignedBB bb) + { + int i = MathHelper.floor_double(bb.minX); + int j = MathHelper.floor_double(bb.maxX + 1.0D); + int k = MathHelper.floor_double(bb.minY); + int l = MathHelper.floor_double(bb.maxY + 1.0D); + int i1 = MathHelper.floor_double(bb.minZ); + int j1 = MathHelper.floor_double(bb.maxZ + 1.0D); + + if (this.isAreaLoaded(i, k, i1, j, l, j1, true)) + { + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = k; l1 < l; ++l1) + { + for (int i2 = i1; i2 < j1; ++i2) + { + Block block = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock(); + + if (block == Blocks.fire || block == Blocks.flowing_lava || block == Blocks.lava) + { + return true; + } + } + } + } + } + + return false; + } + + /** + * handles the acceleration of an object whilst in water. Not sure if it is used elsewhere. + */ + public boolean handleMaterialAcceleration(AxisAlignedBB bb, Material materialIn, Entity entityIn) + { + int i = MathHelper.floor_double(bb.minX); + int j = MathHelper.floor_double(bb.maxX + 1.0D); + int k = MathHelper.floor_double(bb.minY); + int l = MathHelper.floor_double(bb.maxY + 1.0D); + int i1 = MathHelper.floor_double(bb.minZ); + int j1 = MathHelper.floor_double(bb.maxZ + 1.0D); + + if (!this.isAreaLoaded(i, k, i1, j, l, j1, true)) + { + return false; + } + else + { + boolean flag = false; + Vec3 vec3 = new Vec3(0.0D, 0.0D, 0.0D); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = k; l1 < l; ++l1) + { + for (int i2 = i1; i2 < j1; ++i2) + { + blockpos$mutableblockpos.func_181079_c(k1, l1, i2); + IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos); + Block block = iblockstate.getBlock(); + + if (block.getMaterial() == materialIn) + { + double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue())); + + if ((double)l >= d0) + { + flag = true; + vec3 = block.modifyAcceleration(this, blockpos$mutableblockpos, entityIn, vec3); + } + } + } + } + } + + if (vec3.lengthVector() > 0.0D && entityIn.isPushedByWater()) + { + vec3 = vec3.normalize(); + double d1 = 0.014D; + entityIn.motionX += vec3.xCoord * d1; + entityIn.motionY += vec3.yCoord * d1; + entityIn.motionZ += vec3.zCoord * d1; + } + + return flag; + } + } + + /** + * Returns true if the given bounding box contains the given material + */ + public boolean isMaterialInBB(AxisAlignedBB bb, Material materialIn) + { + int i = MathHelper.floor_double(bb.minX); + int j = MathHelper.floor_double(bb.maxX + 1.0D); + int k = MathHelper.floor_double(bb.minY); + int l = MathHelper.floor_double(bb.maxY + 1.0D); + int i1 = MathHelper.floor_double(bb.minZ); + int j1 = MathHelper.floor_double(bb.maxZ + 1.0D); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = k; l1 < l; ++l1) + { + for (int i2 = i1; i2 < j1; ++i2) + { + if (this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock().getMaterial() == materialIn) + { + return true; + } + } + } + } + + return false; + } + + /** + * checks if the given AABB is in the material given. Used while swimming. + */ + public boolean isAABBInMaterial(AxisAlignedBB bb, Material materialIn) + { + int i = MathHelper.floor_double(bb.minX); + int j = MathHelper.floor_double(bb.maxX + 1.0D); + int k = MathHelper.floor_double(bb.minY); + int l = MathHelper.floor_double(bb.maxY + 1.0D); + int i1 = MathHelper.floor_double(bb.minZ); + int j1 = MathHelper.floor_double(bb.maxZ + 1.0D); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k1 = i; k1 < j; ++k1) + { + for (int l1 = k; l1 < l; ++l1) + { + for (int i2 = i1; i2 < j1; ++i2) + { + IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)); + Block block = iblockstate.getBlock(); + + if (block.getMaterial() == materialIn) + { + int j2 = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue(); + double d0 = (double)(l1 + 1); + + if (j2 < 8) + { + d0 = (double)(l1 + 1) - (double)j2 / 8.0D; + } + + if (d0 >= bb.minY) + { + return true; + } + } + } + } + } + + return false; + } + + /** + * Creates an explosion. Args: entity, x, y, z, strength + */ + public Explosion createExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isSmoking) + { + return this.newExplosion(entityIn, x, y, z, strength, false, isSmoking); + } + + /** + * returns a new explosion. Does initiation (at time of writing Explosion is not finished) + */ + public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) + { + Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); + explosion.doExplosionA(); + explosion.doExplosionB(true); + return explosion; + } + + /** + * Gets the percentage of real blocks within within a bounding box, along a specified vector. + */ + public float getBlockDensity(Vec3 vec, AxisAlignedBB bb) + { + double d0 = 1.0D / ((bb.maxX - bb.minX) * 2.0D + 1.0D); + double d1 = 1.0D / ((bb.maxY - bb.minY) * 2.0D + 1.0D); + double d2 = 1.0D / ((bb.maxZ - bb.minZ) * 2.0D + 1.0D); + double d3 = (1.0D - Math.floor(1.0D / d0) * d0) / 2.0D; + double d4 = (1.0D - Math.floor(1.0D / d2) * d2) / 2.0D; + + if (d0 >= 0.0D && d1 >= 0.0D && d2 >= 0.0D) + { + int i = 0; + int j = 0; + + for (float f = 0.0F; f <= 1.0F; f = (float)((double)f + d0)) + { + for (float f1 = 0.0F; f1 <= 1.0F; f1 = (float)((double)f1 + d1)) + { + for (float f2 = 0.0F; f2 <= 1.0F; f2 = (float)((double)f2 + d2)) + { + double d5 = bb.minX + (bb.maxX - bb.minX) * (double)f; + double d6 = bb.minY + (bb.maxY - bb.minY) * (double)f1; + double d7 = bb.minZ + (bb.maxZ - bb.minZ) * (double)f2; + + if (this.rayTraceBlocks(new Vec3(d5 + d3, d6, d7 + d4), vec) == null) + { + ++i; + } + + ++j; + } + } + } + + return (float)i / (float)j; + } + else + { + return 0.0F; + } + } + + /** + * Attempts to extinguish a fire + */ + public boolean extinguishFire(EntityPlayer player, BlockPos pos, EnumFacing side) + { + pos = pos.offset(side); + + if (this.getBlockState(pos).getBlock() == Blocks.fire) + { + this.playAuxSFXAtEntity(player, 1004, pos, 0); + this.setBlockToAir(pos); + return true; + } + else + { + return false; + } + } + + /** + * This string is 'All: (number of loaded entities)' Viewable by press ing F3 + */ + public String getDebugLoadedEntities() + { + return "All: " + this.loadedEntityList.size(); + } + + /** + * Returns the name of the current chunk provider, by calling chunkprovider.makeString() + */ + public String getProviderName() + { + return this.chunkProvider.makeString(); + } + + public TileEntity getTileEntity(BlockPos pos) + { + if (!this.isValid(pos)) + { + return null; + } + else + { + TileEntity tileentity = null; + + if (this.processingLoadedTiles) + { + for (int i = 0; i < this.addedTileEntityList.size(); ++i) + { + TileEntity tileentity1 = (TileEntity)this.addedTileEntityList.get(i); + + if (!tileentity1.isInvalid() && tileentity1.getPos().equals(pos)) + { + tileentity = tileentity1; + break; + } + } + } + + if (tileentity == null) + { + tileentity = this.getChunkFromBlockCoords(pos).getTileEntity(pos, Chunk.EnumCreateEntityType.IMMEDIATE); + } + + if (tileentity == null) + { + for (int j = 0; j < this.addedTileEntityList.size(); ++j) + { + TileEntity tileentity2 = (TileEntity)this.addedTileEntityList.get(j); + + if (!tileentity2.isInvalid() && tileentity2.getPos().equals(pos)) + { + tileentity = tileentity2; + break; + } + } + } + + return tileentity; + } + } + + public void setTileEntity(BlockPos pos, TileEntity tileEntityIn) + { + if (tileEntityIn != null && !tileEntityIn.isInvalid()) + { + if (this.processingLoadedTiles) + { + tileEntityIn.setPos(pos); + Iterator iterator = this.addedTileEntityList.iterator(); + + while (iterator.hasNext()) + { + TileEntity tileentity = (TileEntity)iterator.next(); + + if (tileentity.getPos().equals(pos)) + { + tileentity.invalidate(); + iterator.remove(); + } + } + + this.addedTileEntityList.add(tileEntityIn); + } + else + { + this.addTileEntity(tileEntityIn); + this.getChunkFromBlockCoords(pos).addTileEntity(pos, tileEntityIn); + } + } + } + + public void removeTileEntity(BlockPos pos) + { + TileEntity tileentity = this.getTileEntity(pos); + + if (tileentity != null && this.processingLoadedTiles) + { + tileentity.invalidate(); + this.addedTileEntityList.remove(tileentity); + } + else + { + if (tileentity != null) + { + this.addedTileEntityList.remove(tileentity); + this.loadedTileEntityList.remove(tileentity); + this.tickableTileEntities.remove(tileentity); + } + + this.getChunkFromBlockCoords(pos).removeTileEntity(pos); + } + } + + /** + * Adds the specified TileEntity to the pending removal list. + */ + public void markTileEntityForRemoval(TileEntity tileEntityIn) + { + this.tileEntitiesToBeRemoved.add(tileEntityIn); + } + + public boolean isBlockFullCube(BlockPos pos) + { + IBlockState iblockstate = this.getBlockState(pos); + AxisAlignedBB axisalignedbb = iblockstate.getBlock().getCollisionBoundingBox(this, pos, iblockstate); + return axisalignedbb != null && axisalignedbb.getAverageEdgeLength() >= 1.0D; + } + + public static boolean doesBlockHaveSolidTopSurface(IBlockAccess blockAccess, BlockPos pos) + { + IBlockState iblockstate = blockAccess.getBlockState(pos); + Block block = iblockstate.getBlock(); + return block.getMaterial().isOpaque() && block.isFullCube() ? true : (block instanceof BlockStairs ? iblockstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP : (block instanceof BlockSlab ? iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue() == 7 : false)))); + } + + /** + * Checks if a block's material is opaque, and that it takes up a full cube + */ + public boolean isBlockNormalCube(BlockPos pos, boolean _default) + { + if (!this.isValid(pos)) + { + return _default; + } + else + { + Chunk chunk = this.chunkProvider.provideChunk(pos); + + if (chunk.isEmpty()) + { + return _default; + } + else + { + Block block = this.getBlockState(pos).getBlock(); + return block.getMaterial().isOpaque() && block.isFullCube(); + } + } + } + + /** + * Called on construction of the World class to setup the initial skylight values + */ + public void calculateInitialSkylight() + { + int i = this.calculateSkylightSubtracted(1.0F); + + if (i != this.skylightSubtracted) + { + this.skylightSubtracted = i; + } + } + + /** + * first boolean for hostile mobs and second for peaceful mobs + */ + public void setAllowedSpawnTypes(boolean hostile, boolean peaceful) + { + this.spawnHostileMobs = hostile; + this.spawnPeacefulMobs = peaceful; + } + + /** + * Runs a single tick for the world + */ + public void tick() + { + this.updateWeather(); + } + + /** + * Called from World constructor to set rainingStrength and thunderingStrength + */ + protected void calculateInitialWeather() + { + if (this.worldInfo.isRaining()) + { + this.rainingStrength = 1.0F; + + if (this.worldInfo.isThundering()) + { + this.thunderingStrength = 1.0F; + } + } + } + + /** + * Updates all weather states. + */ + protected void updateWeather() + { + if (!this.provider.getHasNoSky()) + { + if (!this.isRemote) + { + int i = this.worldInfo.getCleanWeatherTime(); + + if (i > 0) + { + --i; + this.worldInfo.setCleanWeatherTime(i); + this.worldInfo.setThunderTime(this.worldInfo.isThundering() ? 1 : 2); + this.worldInfo.setRainTime(this.worldInfo.isRaining() ? 1 : 2); + } + + int j = this.worldInfo.getThunderTime(); + + if (j <= 0) + { + if (this.worldInfo.isThundering()) + { + this.worldInfo.setThunderTime(this.rand.nextInt(12000) + 3600); + } + else + { + this.worldInfo.setThunderTime(this.rand.nextInt(168000) + 12000); + } + } + else + { + --j; + this.worldInfo.setThunderTime(j); + + if (j <= 0) + { + this.worldInfo.setThundering(!this.worldInfo.isThundering()); + } + } + + this.prevThunderingStrength = this.thunderingStrength; + + if (this.worldInfo.isThundering()) + { + this.thunderingStrength = (float)((double)this.thunderingStrength + 0.01D); + } + else + { + this.thunderingStrength = (float)((double)this.thunderingStrength - 0.01D); + } + + this.thunderingStrength = MathHelper.clamp_float(this.thunderingStrength, 0.0F, 1.0F); + int k = this.worldInfo.getRainTime(); + + if (k <= 0) + { + if (this.worldInfo.isRaining()) + { + this.worldInfo.setRainTime(this.rand.nextInt(12000) + 12000); + } + else + { + this.worldInfo.setRainTime(this.rand.nextInt(168000) + 12000); + } + } + else + { + --k; + this.worldInfo.setRainTime(k); + + if (k <= 0) + { + this.worldInfo.setRaining(!this.worldInfo.isRaining()); + } + } + + this.prevRainingStrength = this.rainingStrength; + + if (this.worldInfo.isRaining()) + { + this.rainingStrength = (float)((double)this.rainingStrength + 0.01D); + } + else + { + this.rainingStrength = (float)((double)this.rainingStrength - 0.01D); + } + + this.rainingStrength = MathHelper.clamp_float(this.rainingStrength, 0.0F, 1.0F); + } + } + } + + protected void setActivePlayerChunksAndCheckLight() + { + this.activeChunkSet.clear(); + this.theProfiler.startSection("buildList"); + + for (int i = 0; i < this.playerEntities.size(); ++i) + { + EntityPlayer entityplayer = (EntityPlayer)this.playerEntities.get(i); + int j = MathHelper.floor_double(entityplayer.posX / 16.0D); + int k = MathHelper.floor_double(entityplayer.posZ / 16.0D); + int l = this.getRenderDistanceChunks(); + + for (int i1 = -l; i1 <= l; ++i1) + { + for (int j1 = -l; j1 <= l; ++j1) + { + this.activeChunkSet.add(new ChunkCoordIntPair(i1 + j, j1 + k)); + } + } + } + + this.theProfiler.endSection(); + + if (this.ambientTickCountdown > 0) + { + --this.ambientTickCountdown; + } + + this.theProfiler.startSection("playerCheckLight"); + + if (!this.playerEntities.isEmpty()) + { + int k1 = this.rand.nextInt(this.playerEntities.size()); + EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(k1); + int l1 = MathHelper.floor_double(entityplayer1.posX) + this.rand.nextInt(11) - 5; + int i2 = MathHelper.floor_double(entityplayer1.posY) + this.rand.nextInt(11) - 5; + int j2 = MathHelper.floor_double(entityplayer1.posZ) + this.rand.nextInt(11) - 5; + this.checkLight(new BlockPos(l1, i2, j2)); + } + + this.theProfiler.endSection(); + } + + protected abstract int getRenderDistanceChunks(); + + protected void playMoodSoundAndCheckLight(int p_147467_1_, int p_147467_2_, Chunk chunkIn) + { + this.theProfiler.endStartSection("moodSound"); + + if (this.ambientTickCountdown == 0 && !this.isRemote) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + int i = this.updateLCG >> 2; + int j = i & 15; + int k = i >> 8 & 15; + int l = i >> 16 & 255; + BlockPos blockpos = new BlockPos(j, l, k); + Block block = chunkIn.getBlock(blockpos); + j = j + p_147467_1_; + k = k + p_147467_2_; + + if (block.getMaterial() == Material.air && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0) + { + EntityPlayer entityplayer = this.getClosestPlayer((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D); + + if (entityplayer != null && entityplayer.getDistanceSq((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D) > 4.0D) + { + this.playSoundEffect((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.rand.nextFloat() * 0.2F); + this.ambientTickCountdown = this.rand.nextInt(12000) + 6000; + } + } + } + + this.theProfiler.endStartSection("checkLight"); + chunkIn.enqueueRelightChecks(); + } + + protected void updateBlocks() + { + this.setActivePlayerChunksAndCheckLight(); + } + + public void forceBlockUpdateTick(Block blockType, BlockPos pos, Random random) + { + this.scheduledUpdatesAreImmediate = true; + blockType.updateTick(this, pos, this.getBlockState(pos), random); + this.scheduledUpdatesAreImmediate = false; + } + + public boolean canBlockFreezeWater(BlockPos pos) + { + return this.canBlockFreeze(pos, false); + } + + public boolean canBlockFreezeNoWater(BlockPos pos) + { + return this.canBlockFreeze(pos, true); + } + + /** + * Checks to see if a given block is both water and cold enough to freeze. + */ + public boolean canBlockFreeze(BlockPos pos, boolean noWaterAdj) + { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); + float f = biomegenbase.getFloatTemperature(pos); + + if (f > 0.15F) + { + return false; + } + else + { + if (pos.getY() >= 0 && pos.getY() < 256 && this.getLightFor(EnumSkyBlock.BLOCK, pos) < 10) + { + IBlockState iblockstate = this.getBlockState(pos); + Block block = iblockstate.getBlock(); + + if ((block == Blocks.water || block == Blocks.flowing_water) && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0) + { + if (!noWaterAdj) + { + return true; + } + + boolean flag = this.isWater(pos.west()) && this.isWater(pos.east()) && this.isWater(pos.north()) && this.isWater(pos.south()); + + if (!flag) + { + return true; + } + } + } + + return false; + } + } + + private boolean isWater(BlockPos pos) + { + return this.getBlockState(pos).getBlock().getMaterial() == Material.water; + } + + /** + * Checks to see if a given block can accumulate snow from it snowing + */ + public boolean canSnowAt(BlockPos pos, boolean checkLight) + { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); + float f = biomegenbase.getFloatTemperature(pos); + + if (f > 0.15F) + { + return false; + } + else if (!checkLight) + { + return true; + } + else + { + if (pos.getY() >= 0 && pos.getY() < 256 && this.getLightFor(EnumSkyBlock.BLOCK, pos) < 10) + { + Block block = this.getBlockState(pos).getBlock(); + + if (block.getMaterial() == Material.air && Blocks.snow_layer.canPlaceBlockAt(this, pos)) + { + return true; + } + } + + return false; + } + } + + public boolean checkLight(BlockPos pos) + { + boolean flag = false; + + if (!this.provider.getHasNoSky()) + { + flag |= this.checkLightFor(EnumSkyBlock.SKY, pos); + } + + flag = flag | this.checkLightFor(EnumSkyBlock.BLOCK, pos); + return flag; + } + + /** + * gets the light level at the supplied position + */ + private int getRawLight(BlockPos pos, EnumSkyBlock lightType) + { + if (lightType == EnumSkyBlock.SKY && this.canSeeSky(pos)) + { + return 15; + } + else + { + Block block = this.getBlockState(pos).getBlock(); + int i = lightType == EnumSkyBlock.SKY ? 0 : block.getLightValue(); + int j = block.getLightOpacity(); + + if (j >= 15 && block.getLightValue() > 0) + { + j = 1; + } + + if (j < 1) + { + j = 1; + } + + if (j >= 15) + { + return 0; + } + else if (i >= 14) + { + return i; + } + else + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + BlockPos blockpos = pos.offset(enumfacing); + int k = this.getLightFor(lightType, blockpos) - j; + + if (k > i) + { + i = k; + } + + if (i >= 14) + { + return i; + } + } + + return i; + } + } + } + + public boolean checkLightFor(EnumSkyBlock lightType, BlockPos pos) + { + if (!this.isAreaLoaded(pos, 17, false)) + { + return false; + } + else + { + int i = 0; + int j = 0; + this.theProfiler.startSection("getBrightness"); + int k = this.getLightFor(lightType, pos); + int l = this.getRawLight(pos, lightType); + int i1 = pos.getX(); + int j1 = pos.getY(); + int k1 = pos.getZ(); + + if (l > k) + { + this.lightUpdateBlockList[j++] = 133152; + } + else if (l < k) + { + this.lightUpdateBlockList[j++] = 133152 | k << 18; + + while (i < j) + { + int l1 = this.lightUpdateBlockList[i++]; + int i2 = (l1 & 63) - 32 + i1; + int j2 = (l1 >> 6 & 63) - 32 + j1; + int k2 = (l1 >> 12 & 63) - 32 + k1; + int l2 = l1 >> 18 & 15; + BlockPos blockpos = new BlockPos(i2, j2, k2); + int i3 = this.getLightFor(lightType, blockpos); + + if (i3 == l2) + { + this.setLightFor(lightType, blockpos, 0); + + if (l2 > 0) + { + int j3 = MathHelper.abs_int(i2 - i1); + int k3 = MathHelper.abs_int(j2 - j1); + int l3 = MathHelper.abs_int(k2 - k1); + + if (j3 + k3 + l3 < 17) + { + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (EnumFacing enumfacing : EnumFacing.values()) + { + int i4 = i2 + enumfacing.getFrontOffsetX(); + int j4 = j2 + enumfacing.getFrontOffsetY(); + int k4 = k2 + enumfacing.getFrontOffsetZ(); + blockpos$mutableblockpos.func_181079_c(i4, j4, k4); + int l4 = Math.max(1, this.getBlockState(blockpos$mutableblockpos).getBlock().getLightOpacity()); + i3 = this.getLightFor(lightType, blockpos$mutableblockpos); + + if (i3 == l2 - l4 && j < this.lightUpdateBlockList.length) + { + this.lightUpdateBlockList[j++] = i4 - i1 + 32 | j4 - j1 + 32 << 6 | k4 - k1 + 32 << 12 | l2 - l4 << 18; + } + } + } + } + } + } + + i = 0; + } + + this.theProfiler.endSection(); + this.theProfiler.startSection("checkedPosition < toCheckCount"); + + while (i < j) + { + int i5 = this.lightUpdateBlockList[i++]; + int j5 = (i5 & 63) - 32 + i1; + int k5 = (i5 >> 6 & 63) - 32 + j1; + int l5 = (i5 >> 12 & 63) - 32 + k1; + BlockPos blockpos1 = new BlockPos(j5, k5, l5); + int i6 = this.getLightFor(lightType, blockpos1); + int j6 = this.getRawLight(blockpos1, lightType); + + if (j6 != i6) + { + this.setLightFor(lightType, blockpos1, j6); + + if (j6 > i6) + { + int k6 = Math.abs(j5 - i1); + int l6 = Math.abs(k5 - j1); + int i7 = Math.abs(l5 - k1); + boolean flag = j < this.lightUpdateBlockList.length - 6; + + if (k6 + l6 + i7 < 17 && flag) + { + if (this.getLightFor(lightType, blockpos1.west()) < j6) + { + this.lightUpdateBlockList[j++] = j5 - 1 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 - k1 + 32 << 12); + } + + if (this.getLightFor(lightType, blockpos1.east()) < j6) + { + this.lightUpdateBlockList[j++] = j5 + 1 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 - k1 + 32 << 12); + } + + if (this.getLightFor(lightType, blockpos1.down()) < j6) + { + this.lightUpdateBlockList[j++] = j5 - i1 + 32 + (k5 - 1 - j1 + 32 << 6) + (l5 - k1 + 32 << 12); + } + + if (this.getLightFor(lightType, blockpos1.up()) < j6) + { + this.lightUpdateBlockList[j++] = j5 - i1 + 32 + (k5 + 1 - j1 + 32 << 6) + (l5 - k1 + 32 << 12); + } + + if (this.getLightFor(lightType, blockpos1.north()) < j6) + { + this.lightUpdateBlockList[j++] = j5 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 - 1 - k1 + 32 << 12); + } + + if (this.getLightFor(lightType, blockpos1.south()) < j6) + { + this.lightUpdateBlockList[j++] = j5 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 + 1 - k1 + 32 << 12); + } + } + } + } + } + + this.theProfiler.endSection(); + return true; + } + } + + /** + * Runs through the list of updates to run and ticks them + */ + public boolean tickUpdates(boolean p_72955_1_) + { + return false; + } + + public List getPendingBlockUpdates(Chunk chunkIn, boolean p_72920_2_) + { + return null; + } + + public List func_175712_a(StructureBoundingBox structureBB, boolean p_175712_2_) + { + return null; + } + + public List getEntitiesWithinAABBExcludingEntity(Entity entityIn, AxisAlignedBB bb) + { + return this.getEntitiesInAABBexcluding(entityIn, bb, EntitySelectors.NOT_SPECTATING); + } + + public List getEntitiesInAABBexcluding(Entity entityIn, AxisAlignedBB boundingBox, Predicate predicate) + { + List list = Lists.newArrayList(); + int i = MathHelper.floor_double((boundingBox.minX - 2.0D) / 16.0D); + int j = MathHelper.floor_double((boundingBox.maxX + 2.0D) / 16.0D); + int k = MathHelper.floor_double((boundingBox.minZ - 2.0D) / 16.0D); + int l = MathHelper.floor_double((boundingBox.maxZ + 2.0D) / 16.0D); + + for (int i1 = i; i1 <= j; ++i1) + { + for (int j1 = k; j1 <= l; ++j1) + { + if (this.isChunkLoaded(i1, j1, true)) + { + this.getChunkFromChunkCoords(i1, j1).getEntitiesWithinAABBForEntity(entityIn, boundingBox, list, predicate); + } + } + } + + return list; + } + + public List getEntities(Class entityType, Predicate filter) + { + List list = Lists.newArrayList(); + + for (Entity entity : this.loadedEntityList) + { + if (entityType.isAssignableFrom(entity.getClass()) && filter.apply((T)entity)) + { + list.add((T)entity); + } + } + + return list; + } + + public List getPlayers(Class playerType, Predicate filter) + { + List list = Lists.newArrayList(); + + for (Entity entity : this.playerEntities) + { + if (playerType.isAssignableFrom(entity.getClass()) && filter.apply((T)entity)) + { + list.add((T)entity); + } + } + + return list; + } + + public List getEntitiesWithinAABB(Class classEntity, AxisAlignedBB bb) + { + return this.getEntitiesWithinAABB(classEntity, bb, EntitySelectors.NOT_SPECTATING); + } + + public List getEntitiesWithinAABB(Class clazz, AxisAlignedBB aabb, Predicate filter) + { + int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); + int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D); + int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); + int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D); + List list = Lists.newArrayList(); + + for (int i1 = i; i1 <= j; ++i1) + { + for (int j1 = k; j1 <= l; ++j1) + { + if (this.isChunkLoaded(i1, j1, true)) + { + this.getChunkFromChunkCoords(i1, j1).getEntitiesOfTypeWithinAAAB(clazz, aabb, list, filter); + } + } + } + + return list; + } + + public T findNearestEntityWithinAABB(Class entityType, AxisAlignedBB aabb, T closestTo) + { + List list = this.getEntitiesWithinAABB(entityType, aabb); + T t = null; + double d0 = Double.MAX_VALUE; + + for (int i = 0; i < list.size(); ++i) + { + T t1 = list.get(i); + + if (t1 != closestTo && EntitySelectors.NOT_SPECTATING.apply(t1)) + { + double d1 = closestTo.getDistanceSqToEntity(t1); + + if (d1 <= d0) + { + t = t1; + d0 = d1; + } + } + } + + return t; + } + + /** + * Returns the Entity with the given ID, or null if it doesn't exist in this World. + */ + public Entity getEntityByID(int id) + { + return (Entity)this.entitiesById.lookup(id); + } + + public List getLoadedEntityList() + { + return this.loadedEntityList; + } + + public void markChunkDirty(BlockPos pos, TileEntity unusedTileEntity) + { + if (this.isBlockLoaded(pos)) + { + this.getChunkFromBlockCoords(pos).setChunkModified(); + } + } + + /** + * Counts how many entities of an entity class exist in the world. Args: entityClass + */ + public int countEntities(Class entityType) + { + int i = 0; + + for (Entity entity : this.loadedEntityList) + { + if ((!(entity instanceof EntityLiving) || !((EntityLiving)entity).isNoDespawnRequired()) && entityType.isAssignableFrom(entity.getClass())) + { + ++i; + } + } + + return i; + } + + public void loadEntities(Collection entityCollection) + { + this.loadedEntityList.addAll(entityCollection); + + for (Entity entity : entityCollection) + { + this.onEntityAdded(entity); + } + } + + public void unloadEntities(Collection entityCollection) + { + this.unloadedEntityList.addAll(entityCollection); + } + + public boolean canBlockBePlaced(Block blockIn, BlockPos pos, boolean p_175716_3_, EnumFacing side, Entity entityIn, ItemStack itemStackIn) + { + Block block = this.getBlockState(pos).getBlock(); + AxisAlignedBB axisalignedbb = p_175716_3_ ? null : blockIn.getCollisionBoundingBox(this, pos, blockIn.getDefaultState()); + return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn) ? false : (block.getMaterial() == Material.circuits && blockIn == Blocks.anvil ? true : block.getMaterial().isReplaceable() && blockIn.canReplace(this, pos, side, itemStackIn)); + } + + public int func_181545_F() + { + return this.field_181546_a; + } + + public void func_181544_b(int p_181544_1_) + { + this.field_181546_a = p_181544_1_; + } + + public int getStrongPower(BlockPos pos, EnumFacing direction) + { + IBlockState iblockstate = this.getBlockState(pos); + return iblockstate.getBlock().getStrongPower(this, pos, iblockstate, direction); + } + + public WorldType getWorldType() + { + return this.worldInfo.getTerrainType(); + } + + /** + * Returns the single highest strong power out of all directions using getStrongPower(BlockPos, EnumFacing) + */ + public int getStrongPower(BlockPos pos) + { + int i = 0; + i = Math.max(i, this.getStrongPower(pos.down(), EnumFacing.DOWN)); + + if (i >= 15) + { + return i; + } + else + { + i = Math.max(i, this.getStrongPower(pos.up(), EnumFacing.UP)); + + if (i >= 15) + { + return i; + } + else + { + i = Math.max(i, this.getStrongPower(pos.north(), EnumFacing.NORTH)); + + if (i >= 15) + { + return i; + } + else + { + i = Math.max(i, this.getStrongPower(pos.south(), EnumFacing.SOUTH)); + + if (i >= 15) + { + return i; + } + else + { + i = Math.max(i, this.getStrongPower(pos.west(), EnumFacing.WEST)); + + if (i >= 15) + { + return i; + } + else + { + i = Math.max(i, this.getStrongPower(pos.east(), EnumFacing.EAST)); + return i >= 15 ? i : i; + } + } + } + } + } + } + + public boolean isSidePowered(BlockPos pos, EnumFacing side) + { + return this.getRedstonePower(pos, side) > 0; + } + + public int getRedstonePower(BlockPos pos, EnumFacing facing) + { + IBlockState iblockstate = this.getBlockState(pos); + Block block = iblockstate.getBlock(); + return block.isNormalCube() ? this.getStrongPower(pos) : block.getWeakPower(this, pos, iblockstate, facing); + } + + public boolean isBlockPowered(BlockPos pos) + { + return this.getRedstonePower(pos.down(), EnumFacing.DOWN) > 0 ? true : (this.getRedstonePower(pos.up(), EnumFacing.UP) > 0 ? true : (this.getRedstonePower(pos.north(), EnumFacing.NORTH) > 0 ? true : (this.getRedstonePower(pos.south(), EnumFacing.SOUTH) > 0 ? true : (this.getRedstonePower(pos.west(), EnumFacing.WEST) > 0 ? true : this.getRedstonePower(pos.east(), EnumFacing.EAST) > 0)))); + } + + /** + * Checks if the specified block or its neighbors are powered by a neighboring block. Used by blocks like TNT and + * Doors. + */ + public int isBlockIndirectlyGettingPowered(BlockPos pos) + { + int i = 0; + + for (EnumFacing enumfacing : EnumFacing.values()) + { + int j = this.getRedstonePower(pos.offset(enumfacing), enumfacing); + + if (j >= 15) + { + return 15; + } + + if (j > i) + { + i = j; + } + } + + return i; + } + + /** + * Gets the closest player to the entity within the specified distance (if distance is less than 0 then ignored). + * Args: entity, dist + */ + public EntityPlayer getClosestPlayerToEntity(Entity entityIn, double distance) + { + return this.getClosestPlayer(entityIn.posX, entityIn.posY, entityIn.posZ, distance); + } + + /** + * Gets the closest player to the point within the specified distance (distance can be set to less than 0 to not + * limit the distance). Args: x, y, z, dist + */ + public EntityPlayer getClosestPlayer(double x, double y, double z, double distance) + { + double d0 = -1.0D; + EntityPlayer entityplayer = null; + + for (int i = 0; i < this.playerEntities.size(); ++i) + { + EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i); + + if (EntitySelectors.NOT_SPECTATING.apply(entityplayer1)) + { + double d1 = entityplayer1.getDistanceSq(x, y, z); + + if ((distance < 0.0D || d1 < distance * distance) && (d0 == -1.0D || d1 < d0)) + { + d0 = d1; + entityplayer = entityplayer1; + } + } + } + + return entityplayer; + } + + public boolean isAnyPlayerWithinRangeAt(double x, double y, double z, double range) + { + for (int i = 0; i < this.playerEntities.size(); ++i) + { + EntityPlayer entityplayer = (EntityPlayer)this.playerEntities.get(i); + + if (EntitySelectors.NOT_SPECTATING.apply(entityplayer)) + { + double d0 = entityplayer.getDistanceSq(x, y, z); + + if (range < 0.0D || d0 < range * range) + { + return true; + } + } + } + + return false; + } + + /** + * Find a player by name in this world. + */ + public EntityPlayer getPlayerEntityByName(String name) + { + for (int i = 0; i < this.playerEntities.size(); ++i) + { + EntityPlayer entityplayer = (EntityPlayer)this.playerEntities.get(i); + + if (name.equals(entityplayer.getName())) + { + return entityplayer; + } + } + + return null; + } + + public EntityPlayer getPlayerEntityByUUID(UUID uuid) + { + for (int i = 0; i < this.playerEntities.size(); ++i) + { + EntityPlayer entityplayer = (EntityPlayer)this.playerEntities.get(i); + + if (uuid.equals(entityplayer.getUniqueID())) + { + return entityplayer; + } + } + + return null; + } + + /** + * If on MP, sends a quitting packet. + */ + public void sendQuittingDisconnectingPacket() + { + } + + /** + * Checks whether the session lock file was modified by another process + */ + public void checkSessionLock() throws MinecraftException + { + this.saveHandler.checkSessionLock(); + } + + public void setTotalWorldTime(long worldTime) + { + this.worldInfo.setWorldTotalTime(worldTime); + } + + /** + * gets the random world seed + */ + public long getSeed() + { + return this.worldInfo.getSeed(); + } + + public long getTotalWorldTime() + { + return this.worldInfo.getWorldTotalTime(); + } + + public long getWorldTime() + { + return this.worldInfo.getWorldTime(); + } + + /** + * Sets the world time. + */ + public void setWorldTime(long time) + { + this.worldInfo.setWorldTime(time); + } + + /** + * Gets the spawn point in the world + */ + public BlockPos getSpawnPoint() + { + BlockPos blockpos = new BlockPos(this.worldInfo.getSpawnX(), this.worldInfo.getSpawnY(), this.worldInfo.getSpawnZ()); + + if (!this.getWorldBorder().contains(blockpos)) + { + blockpos = this.getHeight(new BlockPos(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); + } + + return blockpos; + } + + public void setSpawnPoint(BlockPos pos) + { + this.worldInfo.setSpawn(pos); + } + + /** + * spwans an entity and loads surrounding chunks + */ + public void joinEntityInSurroundings(Entity entityIn) + { + int i = MathHelper.floor_double(entityIn.posX / 16.0D); + int j = MathHelper.floor_double(entityIn.posZ / 16.0D); + int k = 2; + + for (int l = i - k; l <= i + k; ++l) + { + for (int i1 = j - k; i1 <= j + k; ++i1) + { + this.getChunkFromChunkCoords(l, i1); + } + } + + if (!this.loadedEntityList.contains(entityIn)) + { + this.loadedEntityList.add(entityIn); + } + } + + public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) + { + return true; + } + + /** + * sends a Packet 38 (Entity Status) to all tracked players of that entity + */ + public void setEntityState(Entity entityIn, byte state) + { + } + + /** + * gets the world's chunk provider + */ + public IChunkProvider getChunkProvider() + { + return this.chunkProvider; + } + + public void addBlockEvent(BlockPos pos, Block blockIn, int eventID, int eventParam) + { + blockIn.onBlockEventReceived(this, pos, this.getBlockState(pos), eventID, eventParam); + } + + /** + * Returns this world's current save handler + */ + public ISaveHandler getSaveHandler() + { + return this.saveHandler; + } + + /** + * Returns the world's WorldInfo object + */ + public WorldInfo getWorldInfo() + { + return this.worldInfo; + } + + /** + * Gets the GameRules instance. + */ + public GameRules getGameRules() + { + return this.worldInfo.getGameRulesInstance(); + } + + /** + * Updates the flag that indicates whether or not all players in the world are sleeping. + */ + public void updateAllPlayersSleepingFlag() + { + } + + public float getThunderStrength(float delta) + { + return (this.prevThunderingStrength + (this.thunderingStrength - this.prevThunderingStrength) * delta) * this.getRainStrength(delta); + } + + /** + * Sets the strength of the thunder. + */ + public void setThunderStrength(float strength) + { + this.prevThunderingStrength = strength; + this.thunderingStrength = strength; + } + + /** + * Returns rain strength. + */ + public float getRainStrength(float delta) + { + return this.prevRainingStrength + (this.rainingStrength - this.prevRainingStrength) * delta; + } + + /** + * Sets the strength of the rain. + */ + public void setRainStrength(float strength) + { + this.prevRainingStrength = strength; + this.rainingStrength = strength; + } + + /** + * Returns true if the current thunder strength (weighted with the rain strength) is greater than 0.9 + */ + public boolean isThundering() + { + return (double)this.getThunderStrength(1.0F) > 0.9D; + } + + /** + * Returns true if the current rain strength is greater than 0.2 + */ + public boolean isRaining() + { + return (double)this.getRainStrength(1.0F) > 0.2D; + } + + public boolean canLightningStrike(BlockPos strikePosition) + { + if (!this.isRaining()) + { + return false; + } + else if (!this.canSeeSky(strikePosition)) + { + return false; + } + else if (this.getPrecipitationHeight(strikePosition).getY() > strikePosition.getY()) + { + return false; + } + else + { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(strikePosition); + return biomegenbase.getEnableSnow() ? false : (this.canSnowAt(strikePosition, false) ? false : biomegenbase.canSpawnLightningBolt()); + } + } + + public boolean isBlockinHighHumidity(BlockPos pos) + { + BiomeGenBase biomegenbase = this.getBiomeGenForCoords(pos); + return biomegenbase.isHighHumidity(); + } + + public MapStorage getMapStorage() + { + return this.mapStorage; + } + + /** + * Assigns the given String id to the given MapDataBase using the MapStorage, removing any existing ones of the same + * id. + */ + public void setItemData(String dataID, WorldSavedData worldSavedDataIn) + { + this.mapStorage.setData(dataID, worldSavedDataIn); + } + + /** + * Loads an existing MapDataBase corresponding to the given String id from disk using the MapStorage, instantiating + * the given Class, or returns null if none such file exists. args: Class to instantiate, String dataid + */ + public WorldSavedData loadItemData(Class clazz, String dataID) + { + return this.mapStorage.loadData(clazz, dataID); + } + + /** + * Returns an unique new data id from the MapStorage for the given prefix and saves the idCounts map to the + * 'idcounts' file. + */ + public int getUniqueDataId(String key) + { + return this.mapStorage.getUniqueDataId(key); + } + + public void playBroadcastSound(int p_175669_1_, BlockPos pos, int p_175669_3_) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).broadcastSound(p_175669_1_, pos, p_175669_3_); + } + } + + public void playAuxSFX(int p_175718_1_, BlockPos pos, int p_175718_3_) + { + this.playAuxSFXAtEntity((EntityPlayer)null, p_175718_1_, pos, p_175718_3_); + } + + public void playAuxSFXAtEntity(EntityPlayer player, int sfxType, BlockPos pos, int p_180498_4_) + { + try + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + ((IWorldAccess)this.worldAccesses.get(i)).playAuxSFX(player, sfxType, pos, p_180498_4_); + } + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Playing level event"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Level event being played"); + crashreportcategory.addCrashSection("Block coordinates", CrashReportCategory.getCoordinateInfo(pos)); + crashreportcategory.addCrashSection("Event source", player); + crashreportcategory.addCrashSection("Event type", Integer.valueOf(sfxType)); + crashreportcategory.addCrashSection("Event data", Integer.valueOf(p_180498_4_)); + throw new ReportedException(crashreport); + } + } + + /** + * Returns maximum world height. + */ + public int getHeight() + { + return 256; + } + + /** + * Returns current world height. + */ + public int getActualHeight() + { + return this.provider.getHasNoSky() ? 128 : 256; + } + + /** + * puts the World Random seed to a specific state dependant on the inputs + */ + public Random setRandomSeed(int p_72843_1_, int p_72843_2_, int p_72843_3_) + { + long i = (long)p_72843_1_ * 341873128712L + (long)p_72843_2_ * 132897987541L + this.getWorldInfo().getSeed() + (long)p_72843_3_; + this.rand.setSeed(i); + return this.rand; + } + + public BlockPos getStrongholdPos(String name, BlockPos pos) + { + return this.getChunkProvider().getStrongholdGen(this, name, pos); + } + + /** + * set by !chunk.getAreLevelsEmpty + */ + public boolean extendedLevelsInChunkCache() + { + return false; + } + + /** + * Returns horizon height for use in rendering the sky. + */ + public double getHorizon() + { + return this.worldInfo.getTerrainType() == WorldType.FLAT ? 0.0D : 63.0D; + } + + /** + * Adds some basic stats of the world to the given crash report. + */ + public CrashReportCategory addWorldInfoToCrashReport(CrashReport report) + { + CrashReportCategory crashreportcategory = report.makeCategoryDepth("Affected level", 1); + crashreportcategory.addCrashSection("Level name", this.worldInfo == null ? "????" : this.worldInfo.getWorldName()); + crashreportcategory.addCrashSectionCallable("All players", new Callable() + { + public String call() + { + return World.this.playerEntities.size() + " total; " + World.this.playerEntities.toString(); + } + }); + crashreportcategory.addCrashSectionCallable("Chunk stats", new Callable() + { + public String call() + { + return World.this.chunkProvider.makeString(); + } + }); + + try + { + this.worldInfo.addToCrashReport(crashreportcategory); + } + catch (Throwable throwable) + { + crashreportcategory.addCrashSectionThrowable("Level Data Unobtainable", throwable); + } + + return crashreportcategory; + } + + public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) + { + for (int i = 0; i < this.worldAccesses.size(); ++i) + { + IWorldAccess iworldaccess = (IWorldAccess)this.worldAccesses.get(i); + iworldaccess.sendBlockBreakProgress(breakerId, pos, progress); + } + } + + /** + * returns a calendar object containing the current date + */ + public Calendar getCurrentDate() + { + if (this.getTotalWorldTime() % 600L == 0L) + { + this.theCalendar.setTimeInMillis(MinecraftServer.getCurrentTimeMillis()); + } + + return this.theCalendar; + } + + public void makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, NBTTagCompound compund) + { + } + + public Scoreboard getScoreboard() + { + return this.worldScoreboard; + } + + public void updateComparatorOutputLevel(BlockPos pos, Block blockIn) + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + BlockPos blockpos = pos.offset((EnumFacing) enumfacing); + + if (this.isBlockLoaded(blockpos)) + { + IBlockState iblockstate = this.getBlockState(blockpos); + + if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) + { + iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); + } + else if (iblockstate.getBlock().isNormalCube()) + { + blockpos = blockpos.offset((EnumFacing) enumfacing); + iblockstate = this.getBlockState(blockpos); + + if (Blocks.unpowered_comparator.isAssociated(iblockstate.getBlock())) + { + iblockstate.getBlock().onNeighborBlockChange(this, blockpos, iblockstate, blockIn); + } + } + } + } + } + + public DifficultyInstance getDifficultyForLocation(BlockPos pos) + { + long i = 0L; + float f = 0.0F; + + if (this.isBlockLoaded(pos)) + { + f = this.getCurrentMoonPhaseFactor(); + i = this.getChunkFromBlockCoords(pos).getInhabitedTime(); + } + + return new DifficultyInstance(this.getDifficulty(), this.getWorldTime(), i, f); + } + + public EnumDifficulty getDifficulty() + { + return this.getWorldInfo().getDifficulty(); + } + + public int getSkylightSubtracted() + { + return this.skylightSubtracted; + } + + public void setSkylightSubtracted(int newSkylightSubtracted) + { + this.skylightSubtracted = newSkylightSubtracted; + } + + public int getLastLightningBolt() + { + return this.lastLightningBolt; + } + + public void setLastLightningBolt(int lastLightningBoltIn) + { + this.lastLightningBolt = lastLightningBoltIn; + } + + public boolean isFindingSpawnPoint() + { + return this.findingSpawnPoint; + } + + public VillageCollection getVillageCollection() + { + return this.villageCollectionObj; + } + + public WorldBorder getWorldBorder() + { + return this.worldBorder; + } + + /** + * Returns true if the chunk is located near the spawn point + */ + public boolean isSpawnChunk(int x, int z) + { + BlockPos blockpos = this.getSpawnPoint(); + int i = x * 16 + 8 - blockpos.getX(); + int j = z * 16 + 8 - blockpos.getZ(); + int k = 128; + return i >= -k && i <= k && j >= -k && j <= k; + } +} diff --git a/src/minecraft/net/minecraft/world/WorldManager.java b/src/minecraft/net/minecraft/world/WorldManager.java new file mode 100644 index 0000000..e9907af --- /dev/null +++ b/src/minecraft/net/minecraft/world/WorldManager.java @@ -0,0 +1,113 @@ +package net.minecraft.world; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.play.server.S25PacketBlockBreakAnim; +import net.minecraft.network.play.server.S28PacketEffect; +import net.minecraft.network.play.server.S29PacketSoundEffect; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; + +public class WorldManager implements IWorldAccess +{ + /** Reference to the MinecraftServer object. */ + private MinecraftServer mcServer; + + /** The WorldServer object. */ + private WorldServer theWorldServer; + + public WorldManager(MinecraftServer p_i1517_1_, WorldServer p_i1517_2_) + { + this.mcServer = p_i1517_1_; + this.theWorldServer = p_i1517_2_; + } + + public void spawnParticle(int particleID, boolean ignoreRange, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int... p_180442_15_) + { + } + + /** + * Called on all IWorldAccesses when an entity is created or loaded. On client worlds, starts downloading any + * necessary textures. On server worlds, adds the entity to the entity tracker. + */ + public void onEntityAdded(Entity entityIn) + { + this.theWorldServer.getEntityTracker().trackEntity(entityIn); + } + + /** + * Called on all IWorldAccesses when an entity is unloaded or destroyed. On client worlds, releases any downloaded + * textures. On server worlds, removes the entity from the entity tracker. + */ + public void onEntityRemoved(Entity entityIn) + { + this.theWorldServer.getEntityTracker().untrackEntity(entityIn); + this.theWorldServer.getScoreboard().func_181140_a(entityIn); + } + + /** + * Plays the specified sound. Arg: soundName, x, y, z, volume, pitch + */ + public void playSound(String soundName, double x, double y, double z, float volume, float pitch) + { + this.mcServer.getConfigurationManager().sendToAllNear(x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.theWorldServer.provider.getDimensionId(), new S29PacketSoundEffect(soundName, x, y, z, volume, pitch)); + } + + /** + * Plays sound to all near players except the player reference given + */ + public void playSoundToNearExcept(EntityPlayer except, String soundName, double x, double y, double z, float volume, float pitch) + { + this.mcServer.getConfigurationManager().sendToAllNearExcept(except, x, y, z, volume > 1.0F ? (double)(16.0F * volume) : 16.0D, this.theWorldServer.provider.getDimensionId(), new S29PacketSoundEffect(soundName, x, y, z, volume, pitch)); + } + + /** + * On the client, re-renders all blocks in this range, inclusive. On the server, does nothing. Args: min x, min y, + * min z, max x, max y, max z + */ + public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) + { + } + + public void markBlockForUpdate(BlockPos pos) + { + this.theWorldServer.getPlayerManager().markBlockForUpdate(pos); + } + + public void notifyLightSet(BlockPos pos) + { + } + + public void playRecord(String recordName, BlockPos blockPosIn) + { + } + + public void playAuxSFX(EntityPlayer player, int sfxType, BlockPos blockPosIn, int p_180439_4_) + { + this.mcServer.getConfigurationManager().sendToAllNearExcept(player, (double)blockPosIn.getX(), (double)blockPosIn.getY(), (double)blockPosIn.getZ(), 64.0D, this.theWorldServer.provider.getDimensionId(), new S28PacketEffect(sfxType, blockPosIn, p_180439_4_, false)); + } + + public void broadcastSound(int p_180440_1_, BlockPos p_180440_2_, int p_180440_3_) + { + this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S28PacketEffect(p_180440_1_, p_180440_2_, p_180440_3_, true)); + } + + public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) + { + for (EntityPlayerMP entityplayermp : this.mcServer.getConfigurationManager().func_181057_v()) + { + if (entityplayermp != null && entityplayermp.worldObj == this.theWorldServer && entityplayermp.getEntityId() != breakerId) + { + double d0 = (double)pos.getX() - entityplayermp.posX; + double d1 = (double)pos.getY() - entityplayermp.posY; + double d2 = (double)pos.getZ() - entityplayermp.posZ; + + if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) + { + entityplayermp.playerNetServerHandler.sendPacket(new S25PacketBlockBreakAnim(breakerId, pos, progress)); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/WorldProvider.java b/src/minecraft/net/minecraft/world/WorldProvider.java new file mode 100644 index 0000000..7f495c6 --- /dev/null +++ b/src/minecraft/net/minecraft/world/WorldProvider.java @@ -0,0 +1,283 @@ +package net.minecraft.world; + +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.biome.WorldChunkManagerHell; +import net.minecraft.world.border.WorldBorder; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.ChunkProviderDebug; +import net.minecraft.world.gen.ChunkProviderFlat; +import net.minecraft.world.gen.ChunkProviderGenerate; +import net.minecraft.world.gen.FlatGeneratorInfo; + +public abstract class WorldProvider +{ + public static final float[] moonPhaseFactors = new float[] {1.0F, 0.75F, 0.5F, 0.25F, 0.0F, 0.25F, 0.5F, 0.75F}; + + /** world object being used */ + protected World worldObj; + private WorldType terrainType; + private String generatorSettings; + + /** World chunk manager being used to generate chunks */ + protected WorldChunkManager worldChunkMgr; + + /** + * States whether the Hell world provider is used(true) or if the normal world provider is used(false) + */ + protected boolean isHellWorld; + + /** + * A boolean that tells if a world does not have a sky. Used in calculating weather and skylight + */ + protected boolean hasNoSky; + + /** Light to brightness conversion table */ + protected final float[] lightBrightnessTable = new float[16]; + + /** The id for the dimension (ex. -1: Nether, 0: Overworld, 1: The End) */ + protected int dimensionId; + + /** Array for sunrise/sunset colors (RGBA) */ + private final float[] colorsSunriseSunset = new float[4]; + + /** + * associate an existing world with a World provider, and setup its lightbrightness table + */ + public final void registerWorld(World worldIn) + { + this.worldObj = worldIn; + this.terrainType = worldIn.getWorldInfo().getTerrainType(); + this.generatorSettings = worldIn.getWorldInfo().getGeneratorOptions(); + this.registerWorldChunkManager(); + this.generateLightBrightnessTable(); + } + + /** + * Creates the light to brightness table + */ + protected void generateLightBrightnessTable() + { + float f = 0.0F; + + for (int i = 0; i <= 15; ++i) + { + float f1 = 1.0F - (float)i / 15.0F; + this.lightBrightnessTable[i] = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f; + } + } + + /** + * creates a new world chunk manager for WorldProvider + */ + protected void registerWorldChunkManager() + { + WorldType worldtype = this.worldObj.getWorldInfo().getTerrainType(); + + if (worldtype == WorldType.FLAT) + { + FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.createFlatGeneratorFromString(this.worldObj.getWorldInfo().getGeneratorOptions()); + this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.getBiomeFromBiomeList(flatgeneratorinfo.getBiome(), BiomeGenBase.field_180279_ad), 0.5F); + } + else if (worldtype == WorldType.DEBUG_WORLD) + { + this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.plains, 0.0F); + } + else + { + this.worldChunkMgr = new WorldChunkManager(this.worldObj); + } + } + + /** + * Returns a new chunk provider which generates chunks for this world + */ + public IChunkProvider createChunkGenerator() + { + return (IChunkProvider)(this.terrainType == WorldType.FLAT ? new ChunkProviderFlat(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : (this.terrainType == WorldType.DEBUG_WORLD ? new ChunkProviderDebug(this.worldObj) : (this.terrainType == WorldType.CUSTOMIZED ? new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings) : new ChunkProviderGenerate(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.generatorSettings)))); + } + + /** + * Will check if the x, z position specified is alright to be set as the map spawn point + */ + public boolean canCoordinateBeSpawn(int x, int z) + { + return this.worldObj.getGroundAboveSeaLevel(new BlockPos(x, 0, z)) == Blocks.grass; + } + + /** + * Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime) + */ + public float calculateCelestialAngle(long p_76563_1_, float p_76563_3_) + { + int i = (int)(p_76563_1_ % 24000L); + float f = ((float)i + p_76563_3_) / 24000.0F - 0.25F; + + if (f < 0.0F) + { + ++f; + } + + if (f > 1.0F) + { + --f; + } + + f = 1.0F - (float)((Math.cos((double)f * Math.PI) + 1.0D) / 2.0D); + f = f + (f - f) / 3.0F; + return f; + } + + public int getMoonPhase(long p_76559_1_) + { + return (int)(p_76559_1_ / 24000L % 8L + 8L) % 8; + } + + /** + * Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions. + */ + public boolean isSurfaceWorld() + { + return true; + } + + /** + * Returns array with sunrise/sunset colors + */ + public float[] calcSunriseSunsetColors(float celestialAngle, float partialTicks) + { + float f = 0.4F; + float f1 = MathHelper.cos(celestialAngle * (float)Math.PI * 2.0F) - 0.0F; + float f2 = -0.0F; + + if (f1 >= f2 - f && f1 <= f2 + f) + { + float f3 = (f1 - f2) / f * 0.5F + 0.5F; + float f4 = 1.0F - (1.0F - MathHelper.sin(f3 * (float)Math.PI)) * 0.99F; + f4 = f4 * f4; + this.colorsSunriseSunset[0] = f3 * 0.3F + 0.7F; + this.colorsSunriseSunset[1] = f3 * f3 * 0.7F + 0.2F; + this.colorsSunriseSunset[2] = f3 * f3 * 0.0F + 0.2F; + this.colorsSunriseSunset[3] = f4; + return this.colorsSunriseSunset; + } + else + { + return null; + } + } + + /** + * Return Vec3D with biome specific fog color + */ + public Vec3 getFogColor(float p_76562_1_, float p_76562_2_) + { + float f = MathHelper.cos(p_76562_1_ * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + float f1 = 0.7529412F; + float f2 = 0.84705883F; + float f3 = 1.0F; + f1 = f1 * (f * 0.94F + 0.06F); + f2 = f2 * (f * 0.94F + 0.06F); + f3 = f3 * (f * 0.91F + 0.09F); + return new Vec3((double)f1, (double)f2, (double)f3); + } + + /** + * True if the player can respawn in this dimension (true = overworld, false = nether). + */ + public boolean canRespawnHere() + { + return true; + } + + public static WorldProvider getProviderForDimension(int dimension) + { + return (WorldProvider)(dimension == -1 ? new WorldProviderHell() : (dimension == 0 ? new WorldProviderSurface() : (dimension == 1 ? new WorldProviderEnd() : null))); + } + + /** + * the y level at which clouds are rendered. + */ + public float getCloudHeight() + { + return 128.0F; + } + + public boolean isSkyColored() + { + return true; + } + + public BlockPos getSpawnCoordinate() + { + return null; + } + + public int getAverageGroundLevel() + { + return this.terrainType == WorldType.FLAT ? 4 : this.worldObj.func_181545_F() + 1; + } + + /** + * Returns a double value representing the Y value relative to the top of the map at which void fog is at its + * maximum. The default factor of 0.03125 relative to 256, for example, means the void fog will be at its maximum at + * (256*0.03125), or 8. + */ + public double getVoidFogYFactor() + { + return this.terrainType == WorldType.FLAT ? 1.0D : 0.03125D; + } + + /** + * Returns true if the given X,Z coordinate should show environmental fog. + */ + public boolean doesXZShowFog(int x, int z) + { + return false; + } + + /** + * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld". + */ + public abstract String getDimensionName(); + + public abstract String getInternalNameSuffix(); + + public WorldChunkManager getWorldChunkManager() + { + return this.worldChunkMgr; + } + + public boolean doesWaterVaporize() + { + return this.isHellWorld; + } + + public boolean getHasNoSky() + { + return this.hasNoSky; + } + + public float[] getLightBrightnessTable() + { + return this.lightBrightnessTable; + } + + /** + * Gets the dimension of the provider + */ + public int getDimensionId() + { + return this.dimensionId; + } + + public WorldBorder getWorldBorder() + { + return new WorldBorder(); + } +} diff --git a/src/minecraft/net/minecraft/world/WorldProviderEnd.java b/src/minecraft/net/minecraft/world/WorldProviderEnd.java new file mode 100644 index 0000000..3b2747b --- /dev/null +++ b/src/minecraft/net/minecraft/world/WorldProviderEnd.java @@ -0,0 +1,131 @@ +package net.minecraft.world; + +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.WorldChunkManagerHell; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.ChunkProviderEnd; + +public class WorldProviderEnd extends WorldProvider +{ + /** + * creates a new world chunk manager for WorldProvider + */ + public void registerWorldChunkManager() + { + this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.sky, 0.0F); + this.dimensionId = 1; + this.hasNoSky = true; + } + + /** + * Returns a new chunk provider which generates chunks for this world + */ + public IChunkProvider createChunkGenerator() + { + return new ChunkProviderEnd(this.worldObj, this.worldObj.getSeed()); + } + + /** + * Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime) + */ + public float calculateCelestialAngle(long p_76563_1_, float p_76563_3_) + { + return 0.0F; + } + + /** + * Returns array with sunrise/sunset colors + */ + public float[] calcSunriseSunsetColors(float celestialAngle, float partialTicks) + { + return null; + } + + /** + * Return Vec3D with biome specific fog color + */ + public Vec3 getFogColor(float p_76562_1_, float p_76562_2_) + { + int i = 10518688; + float f = MathHelper.cos(p_76562_1_ * (float)Math.PI * 2.0F) * 2.0F + 0.5F; + f = MathHelper.clamp_float(f, 0.0F, 1.0F); + float f1 = (float)(i >> 16 & 255) / 255.0F; + float f2 = (float)(i >> 8 & 255) / 255.0F; + float f3 = (float)(i & 255) / 255.0F; + f1 = f1 * (f * 0.0F + 0.15F); + f2 = f2 * (f * 0.0F + 0.15F); + f3 = f3 * (f * 0.0F + 0.15F); + return new Vec3((double)f1, (double)f2, (double)f3); + } + + public boolean isSkyColored() + { + return false; + } + + /** + * True if the player can respawn in this dimension (true = overworld, false = nether). + */ + public boolean canRespawnHere() + { + return false; + } + + /** + * Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions. + */ + public boolean isSurfaceWorld() + { + return false; + } + + /** + * the y level at which clouds are rendered. + */ + public float getCloudHeight() + { + return 8.0F; + } + + /** + * Will check if the x, z position specified is alright to be set as the map spawn point + */ + public boolean canCoordinateBeSpawn(int x, int z) + { + return this.worldObj.getGroundAboveSeaLevel(new BlockPos(x, 0, z)).getMaterial().blocksMovement(); + } + + public BlockPos getSpawnCoordinate() + { + return new BlockPos(100, 50, 0); + } + + public int getAverageGroundLevel() + { + return 50; + } + + /** + * Returns true if the given X,Z coordinate should show environmental fog. + */ + public boolean doesXZShowFog(int x, int z) + { + return true; + } + + /** + * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld". + */ + public String getDimensionName() + { + return "The End"; + } + + public String getInternalNameSuffix() + { + return "_end"; + } +} diff --git a/src/minecraft/net/minecraft/world/WorldProviderHell.java b/src/minecraft/net/minecraft/world/WorldProviderHell.java new file mode 100644 index 0000000..242c3b9 --- /dev/null +++ b/src/minecraft/net/minecraft/world/WorldProviderHell.java @@ -0,0 +1,120 @@ +package net.minecraft.world; + +import net.minecraft.util.Vec3; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.WorldChunkManagerHell; +import net.minecraft.world.border.WorldBorder; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.ChunkProviderHell; + +public class WorldProviderHell extends WorldProvider +{ + /** + * creates a new world chunk manager for WorldProvider + */ + public void registerWorldChunkManager() + { + this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.hell, 0.0F); + this.isHellWorld = true; + this.hasNoSky = true; + this.dimensionId = -1; + } + + /** + * Return Vec3D with biome specific fog color + */ + public Vec3 getFogColor(float p_76562_1_, float p_76562_2_) + { + return new Vec3(0.20000000298023224D, 0.029999999329447746D, 0.029999999329447746D); + } + + /** + * Creates the light to brightness table + */ + protected void generateLightBrightnessTable() + { + float f = 0.1F; + + for (int i = 0; i <= 15; ++i) + { + float f1 = 1.0F - (float)i / 15.0F; + this.lightBrightnessTable[i] = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f; + } + } + + /** + * Returns a new chunk provider which generates chunks for this world + */ + public IChunkProvider createChunkGenerator() + { + return new ChunkProviderHell(this.worldObj, this.worldObj.getWorldInfo().isMapFeaturesEnabled(), this.worldObj.getSeed()); + } + + /** + * Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions. + */ + public boolean isSurfaceWorld() + { + return false; + } + + /** + * Will check if the x, z position specified is alright to be set as the map spawn point + */ + public boolean canCoordinateBeSpawn(int x, int z) + { + return false; + } + + /** + * Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime) + */ + public float calculateCelestialAngle(long p_76563_1_, float p_76563_3_) + { + return 0.5F; + } + + /** + * True if the player can respawn in this dimension (true = overworld, false = nether). + */ + public boolean canRespawnHere() + { + return false; + } + + /** + * Returns true if the given X,Z coordinate should show environmental fog. + */ + public boolean doesXZShowFog(int x, int z) + { + return true; + } + + /** + * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld". + */ + public String getDimensionName() + { + return "Nether"; + } + + public String getInternalNameSuffix() + { + return "_nether"; + } + + public WorldBorder getWorldBorder() + { + return new WorldBorder() + { + public double getCenterX() + { + return super.getCenterX() / 8.0D; + } + public double getCenterZ() + { + return super.getCenterZ() / 8.0D; + } + }; + } +} diff --git a/src/minecraft/net/minecraft/world/WorldProviderSurface.java b/src/minecraft/net/minecraft/world/WorldProviderSurface.java new file mode 100644 index 0000000..1351b39 --- /dev/null +++ b/src/minecraft/net/minecraft/world/WorldProviderSurface.java @@ -0,0 +1,17 @@ +package net.minecraft.world; + +public class WorldProviderSurface extends WorldProvider +{ + /** + * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld". + */ + public String getDimensionName() + { + return "Overworld"; + } + + public String getInternalNameSuffix() + { + return ""; + } +} diff --git a/src/minecraft/net/minecraft/world/WorldSavedData.java b/src/minecraft/net/minecraft/world/WorldSavedData.java new file mode 100644 index 0000000..01c1380 --- /dev/null +++ b/src/minecraft/net/minecraft/world/WorldSavedData.java @@ -0,0 +1,51 @@ +package net.minecraft.world; + +import net.minecraft.nbt.NBTTagCompound; + +public abstract class WorldSavedData +{ + /** The name of the map data nbt */ + public final String mapName; + + /** Whether this MapDataBase needs saving to disk. */ + private boolean dirty; + + public WorldSavedData(String name) + { + this.mapName = name; + } + + /** + * reads in data from the NBTTagCompound into this MapDataBase + */ + public abstract void readFromNBT(NBTTagCompound nbt); + + /** + * write data to NBTTagCompound from this MapDataBase, similar to Entities and TileEntities + */ + public abstract void writeToNBT(NBTTagCompound nbt); + + /** + * Marks this MapDataBase dirty, to be saved to disk when the level next saves. + */ + public void markDirty() + { + this.setDirty(true); + } + + /** + * Sets the dirty state of this MapDataBase, whether it needs saving to disk. + */ + public void setDirty(boolean isDirty) + { + this.dirty = isDirty; + } + + /** + * Whether this MapDataBase needs saving to disk. + */ + public boolean isDirty() + { + return this.dirty; + } +} diff --git a/src/minecraft/net/minecraft/world/WorldServer.java b/src/minecraft/net/minecraft/world/WorldServer.java new file mode 100644 index 0000000..ebf4c0a --- /dev/null +++ b/src/minecraft/net/minecraft/world/WorldServer.java @@ -0,0 +1,1185 @@ +package net.minecraft.world; + +import com.google.common.base.Predicate; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.google.common.util.concurrent.ListenableFuture; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.TreeSet; +import java.util.UUID; +import net.minecraft.block.Block; +import net.minecraft.block.BlockEventData; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EntityTracker; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.INpc; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityWaterMob; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S19PacketEntityStatus; +import net.minecraft.network.play.server.S24PacketBlockAction; +import net.minecraft.network.play.server.S27PacketExplosion; +import net.minecraft.network.play.server.S2APacketParticles; +import net.minecraft.network.play.server.S2BPacketChangeGameState; +import net.minecraft.network.play.server.S2CPacketSpawnGlobalEntity; +import net.minecraft.profiler.Profiler; +import net.minecraft.scoreboard.ScoreboardSaveData; +import net.minecraft.scoreboard.ServerScoreboard; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.management.PlayerManager; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.IThreadListener; +import net.minecraft.util.ReportedException; +import net.minecraft.util.Vec3; +import net.minecraft.util.WeightedRandom; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.village.VillageCollection; +import net.minecraft.village.VillageSiege; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; +import net.minecraft.world.chunk.storage.IChunkLoader; +import net.minecraft.world.gen.ChunkProviderServer; +import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; +import net.minecraft.world.gen.structure.StructureBoundingBox; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.MapStorage; +import net.minecraft.world.storage.WorldInfo; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class WorldServer extends World implements IThreadListener +{ + private static final Logger logger = LogManager.getLogger(); + private final MinecraftServer mcServer; + private final EntityTracker theEntityTracker; + private final PlayerManager thePlayerManager; + private final Set pendingTickListEntriesHashSet = Sets.newHashSet(); + private final TreeSet pendingTickListEntriesTreeSet = new TreeSet(); + private final Map entitiesByUuid = Maps.newHashMap(); + public ChunkProviderServer theChunkProviderServer; + + /** Whether level saving is disabled or not */ + public boolean disableLevelSaving; + + /** is false if there are no players */ + private boolean allPlayersSleeping; + private int updateEntityTick; + + /** + * the teleporter to use when the entity is being transferred into the dimension + */ + private final Teleporter worldTeleporter; + private final SpawnerAnimals mobSpawner = new SpawnerAnimals(); + protected final VillageSiege villageSiege = new VillageSiege(this); + private WorldServer.ServerBlockEventList[] field_147490_S = new WorldServer.ServerBlockEventList[] {new WorldServer.ServerBlockEventList(), new WorldServer.ServerBlockEventList()}; + private int blockEventCacheIndex; + private static final List bonusChestContent = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.stick, 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.planks), 0, 1, 3, 10), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log), 0, 1, 3, 10), new WeightedRandomChestContent(Items.stone_axe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_axe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.stone_pickaxe, 0, 1, 1, 3), new WeightedRandomChestContent(Items.wooden_pickaxe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.apple, 0, 2, 3, 5), new WeightedRandomChestContent(Items.bread, 0, 2, 3, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.log2), 0, 1, 3, 10)}); + private List pendingTickListEntriesThisTick = Lists.newArrayList(); + + public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) + { + super(saveHandlerIn, info, WorldProvider.getProviderForDimension(dimensionId), profilerIn, false); + this.mcServer = server; + this.theEntityTracker = new EntityTracker(this); + this.thePlayerManager = new PlayerManager(this); + this.provider.registerWorld(this); + this.chunkProvider = this.createChunkProvider(); + this.worldTeleporter = new Teleporter(this); + this.calculateInitialSkylight(); + this.calculateInitialWeather(); + this.getWorldBorder().setSize(server.getMaxWorldSize()); + } + + public World init() + { + this.mapStorage = new MapStorage(this.saveHandler); + String s = VillageCollection.fileNameForProvider(this.provider); + VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); + this.mapStorage.setData(s, this.villageCollectionObj); + } + else + { + this.villageCollectionObj = villagecollection; + this.villageCollectionObj.setWorldsForAll(this); + } + + this.worldScoreboard = new ServerScoreboard(this.mcServer); + ScoreboardSaveData scoreboardsavedata = (ScoreboardSaveData)this.mapStorage.loadData(ScoreboardSaveData.class, "scoreboard"); + + if (scoreboardsavedata == null) + { + scoreboardsavedata = new ScoreboardSaveData(); + this.mapStorage.setData("scoreboard", scoreboardsavedata); + } + + scoreboardsavedata.setScoreboard(this.worldScoreboard); + ((ServerScoreboard)this.worldScoreboard).func_96547_a(scoreboardsavedata); + this.getWorldBorder().setCenter(this.worldInfo.getBorderCenterX(), this.worldInfo.getBorderCenterZ()); + this.getWorldBorder().setDamageAmount(this.worldInfo.getBorderDamagePerBlock()); + this.getWorldBorder().setDamageBuffer(this.worldInfo.getBorderSafeZone()); + this.getWorldBorder().setWarningDistance(this.worldInfo.getBorderWarningDistance()); + this.getWorldBorder().setWarningTime(this.worldInfo.getBorderWarningTime()); + + if (this.worldInfo.getBorderLerpTime() > 0L) + { + this.getWorldBorder().setTransition(this.worldInfo.getBorderSize(), this.worldInfo.getBorderLerpTarget(), this.worldInfo.getBorderLerpTime()); + } + else + { + this.getWorldBorder().setTransition(this.worldInfo.getBorderSize()); + } + + return this; + } + + /** + * Runs a single tick for the world + */ + public void tick() + { + super.tick(); + + if (this.getWorldInfo().isHardcoreModeEnabled() && this.getDifficulty() != EnumDifficulty.HARD) + { + this.getWorldInfo().setDifficulty(EnumDifficulty.HARD); + } + + this.provider.getWorldChunkManager().cleanupCache(); + + if (this.areAllPlayersAsleep()) + { + if (this.getGameRules().getBoolean("doDaylightCycle")) + { + long i = this.worldInfo.getWorldTime() + 24000L; + this.worldInfo.setWorldTime(i - i % 24000L); + } + + this.wakeAllPlayers(); + } + + this.theProfiler.startSection("mobSpawner"); + + if (this.getGameRules().getBoolean("doMobSpawning") && this.worldInfo.getTerrainType() != WorldType.DEBUG_WORLD) + { + this.mobSpawner.findChunksForSpawning(this, this.spawnHostileMobs, this.spawnPeacefulMobs, this.worldInfo.getWorldTotalTime() % 400L == 0L); + } + + this.theProfiler.endStartSection("chunkSource"); + this.chunkProvider.unloadQueuedChunks(); + int j = this.calculateSkylightSubtracted(1.0F); + + if (j != this.getSkylightSubtracted()) + { + this.setSkylightSubtracted(j); + } + + this.worldInfo.setWorldTotalTime(this.worldInfo.getWorldTotalTime() + 1L); + + if (this.getGameRules().getBoolean("doDaylightCycle")) + { + this.worldInfo.setWorldTime(this.worldInfo.getWorldTime() + 1L); + } + + this.theProfiler.endStartSection("tickPending"); + this.tickUpdates(false); + this.theProfiler.endStartSection("tickBlocks"); + this.updateBlocks(); + this.theProfiler.endStartSection("chunkMap"); + this.thePlayerManager.updatePlayerInstances(); + this.theProfiler.endStartSection("village"); + this.villageCollectionObj.tick(); + this.villageSiege.tick(); + this.theProfiler.endStartSection("portalForcer"); + this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime()); + this.theProfiler.endSection(); + this.sendQueuedBlockEvents(); + } + + public BiomeGenBase.SpawnListEntry getSpawnListEntryForTypeAt(EnumCreatureType creatureType, BlockPos pos) + { + List list = this.getChunkProvider().getPossibleCreatures(creatureType, pos); + return list != null && !list.isEmpty() ? (BiomeGenBase.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list) : null; + } + + public boolean canCreatureTypeSpawnHere(EnumCreatureType creatureType, BiomeGenBase.SpawnListEntry spawnListEntry, BlockPos pos) + { + List list = this.getChunkProvider().getPossibleCreatures(creatureType, pos); + return list != null && !list.isEmpty() ? list.contains(spawnListEntry) : false; + } + + /** + * Updates the flag that indicates whether or not all players in the world are sleeping. + */ + public void updateAllPlayersSleepingFlag() + { + this.allPlayersSleeping = false; + + if (!this.playerEntities.isEmpty()) + { + int i = 0; + int j = 0; + + for (EntityPlayer entityplayer : this.playerEntities) + { + if (entityplayer.isSpectator()) + { + ++i; + } + else if (entityplayer.isPlayerSleeping()) + { + ++j; + } + } + + this.allPlayersSleeping = j > 0 && j >= this.playerEntities.size() - i; + } + } + + protected void wakeAllPlayers() + { + this.allPlayersSleeping = false; + + for (EntityPlayer entityplayer : this.playerEntities) + { + if (entityplayer.isPlayerSleeping()) + { + entityplayer.wakeUpPlayer(false, false, true); + } + } + + this.resetRainAndThunder(); + } + + private void resetRainAndThunder() + { + this.worldInfo.setRainTime(0); + this.worldInfo.setRaining(false); + this.worldInfo.setThunderTime(0); + this.worldInfo.setThundering(false); + } + + public boolean areAllPlayersAsleep() + { + if (this.allPlayersSleeping && !this.isRemote) + { + for (EntityPlayer entityplayer : this.playerEntities) + { + if (entityplayer.isSpectator() || !entityplayer.isPlayerFullyAsleep()) + { + return false; + } + } + + return true; + } + else + { + return false; + } + } + + /** + * Sets a new spawn location by finding an uncovered block at a random (x,z) location in the chunk. + */ + public void setInitialSpawnLocation() + { + if (this.worldInfo.getSpawnY() <= 0) + { + this.worldInfo.setSpawnY(this.func_181545_F() + 1); + } + + int i = this.worldInfo.getSpawnX(); + int j = this.worldInfo.getSpawnZ(); + int k = 0; + + while (this.getGroundAboveSeaLevel(new BlockPos(i, 0, j)).getMaterial() == Material.air) + { + i += this.rand.nextInt(8) - this.rand.nextInt(8); + j += this.rand.nextInt(8) - this.rand.nextInt(8); + ++k; + + if (k == 10000) + { + break; + } + } + + this.worldInfo.setSpawnX(i); + this.worldInfo.setSpawnZ(j); + } + + protected void updateBlocks() + { + super.updateBlocks(); + + if (this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD) + { + for (ChunkCoordIntPair chunkcoordintpair1 : this.activeChunkSet) + { + this.getChunkFromChunkCoords(chunkcoordintpair1.chunkXPos, chunkcoordintpair1.chunkZPos).func_150804_b(false); + } + } + else + { + int i = 0; + int j = 0; + + for (ChunkCoordIntPair chunkcoordintpair : this.activeChunkSet) + { + int k = chunkcoordintpair.chunkXPos * 16; + int l = chunkcoordintpair.chunkZPos * 16; + this.theProfiler.startSection("getChunk"); + Chunk chunk = this.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos); + this.playMoodSoundAndCheckLight(k, l, chunk); + this.theProfiler.endStartSection("tickChunk"); + chunk.func_150804_b(false); + this.theProfiler.endStartSection("thunder"); + + if (this.rand.nextInt(100000) == 0 && this.isRaining() && this.isThundering()) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + int i1 = this.updateLCG >> 2; + BlockPos blockpos = this.adjustPosToNearbyEntity(new BlockPos(k + (i1 & 15), 0, l + (i1 >> 8 & 15))); + + if (this.canLightningStrike(blockpos)) + { + this.addWeatherEffect(new EntityLightningBolt(this, (double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ())); + } + } + + this.theProfiler.endStartSection("iceandsnow"); + + if (this.rand.nextInt(16) == 0) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + int k2 = this.updateLCG >> 2; + BlockPos blockpos2 = this.getPrecipitationHeight(new BlockPos(k + (k2 & 15), 0, l + (k2 >> 8 & 15))); + BlockPos blockpos1 = blockpos2.down(); + + if (this.canBlockFreezeNoWater(blockpos1)) + { + this.setBlockState(blockpos1, Blocks.ice.getDefaultState()); + } + + if (this.isRaining() && this.canSnowAt(blockpos2, true)) + { + this.setBlockState(blockpos2, Blocks.snow_layer.getDefaultState()); + } + + if (this.isRaining() && this.getBiomeGenForCoords(blockpos1).canSpawnLightningBolt()) + { + this.getBlockState(blockpos1).getBlock().fillWithRain(this, blockpos1); + } + } + + this.theProfiler.endStartSection("tickBlocks"); + int l2 = this.getGameRules().getInt("randomTickSpeed"); + + if (l2 > 0) + { + for (ExtendedBlockStorage extendedblockstorage : chunk.getBlockStorageArray()) + { + if (extendedblockstorage != null && extendedblockstorage.getNeedsRandomTick()) + { + for (int j1 = 0; j1 < l2; ++j1) + { + this.updateLCG = this.updateLCG * 3 + 1013904223; + int k1 = this.updateLCG >> 2; + int l1 = k1 & 15; + int i2 = k1 >> 8 & 15; + int j2 = k1 >> 16 & 15; + ++j; + IBlockState iblockstate = extendedblockstorage.get(l1, j2, i2); + Block block = iblockstate.getBlock(); + + if (block.getTickRandomly()) + { + ++i; + block.randomTick(this, new BlockPos(l1 + k, j2 + extendedblockstorage.getYLocation(), i2 + l), iblockstate, this.rand); + } + } + } + } + } + + this.theProfiler.endSection(); + } + } + } + + protected BlockPos adjustPosToNearbyEntity(BlockPos pos) + { + BlockPos blockpos = this.getPrecipitationHeight(pos); + AxisAlignedBB axisalignedbb = (new AxisAlignedBB(blockpos, new BlockPos(blockpos.getX(), this.getHeight(), blockpos.getZ()))).expand(3.0D, 3.0D, 3.0D); + List list = this.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb, new Predicate() + { + public boolean apply(EntityLivingBase p_apply_1_) + { + return p_apply_1_ != null && p_apply_1_.isEntityAlive() && WorldServer.this.canSeeSky(p_apply_1_.getPosition()); + } + }); + return !list.isEmpty() ? ((EntityLivingBase)list.get(this.rand.nextInt(list.size()))).getPosition() : blockpos; + } + + public boolean isBlockTickPending(BlockPos pos, Block blockType) + { + NextTickListEntry nextticklistentry = new NextTickListEntry(pos, blockType); + return this.pendingTickListEntriesThisTick.contains(nextticklistentry); + } + + public void scheduleUpdate(BlockPos pos, Block blockIn, int delay) + { + this.updateBlockTick(pos, blockIn, delay, 0); + } + + public void updateBlockTick(BlockPos pos, Block blockIn, int delay, int priority) + { + NextTickListEntry nextticklistentry = new NextTickListEntry(pos, blockIn); + int i = 0; + + if (this.scheduledUpdatesAreImmediate && blockIn.getMaterial() != Material.air) + { + if (blockIn.requiresUpdates()) + { + i = 8; + + if (this.isAreaLoaded(nextticklistentry.position.add(-i, -i, -i), nextticklistentry.position.add(i, i, i))) + { + IBlockState iblockstate = this.getBlockState(nextticklistentry.position); + + if (iblockstate.getBlock().getMaterial() != Material.air && iblockstate.getBlock() == nextticklistentry.getBlock()) + { + iblockstate.getBlock().updateTick(this, nextticklistentry.position, iblockstate, this.rand); + } + } + + return; + } + + delay = 1; + } + + if (this.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i))) + { + if (blockIn.getMaterial() != Material.air) + { + nextticklistentry.setScheduledTime((long)delay + this.worldInfo.getWorldTotalTime()); + nextticklistentry.setPriority(priority); + } + + if (!this.pendingTickListEntriesHashSet.contains(nextticklistentry)) + { + this.pendingTickListEntriesHashSet.add(nextticklistentry); + this.pendingTickListEntriesTreeSet.add(nextticklistentry); + } + } + } + + public void scheduleBlockUpdate(BlockPos pos, Block blockIn, int delay, int priority) + { + NextTickListEntry nextticklistentry = new NextTickListEntry(pos, blockIn); + nextticklistentry.setPriority(priority); + + if (blockIn.getMaterial() != Material.air) + { + nextticklistentry.setScheduledTime((long)delay + this.worldInfo.getWorldTotalTime()); + } + + if (!this.pendingTickListEntriesHashSet.contains(nextticklistentry)) + { + this.pendingTickListEntriesHashSet.add(nextticklistentry); + this.pendingTickListEntriesTreeSet.add(nextticklistentry); + } + } + + /** + * Updates (and cleans up) entities and tile entities + */ + public void updateEntities() + { + if (this.playerEntities.isEmpty()) + { + if (this.updateEntityTick++ >= 1200) + { + return; + } + } + else + { + this.resetUpdateEntityTick(); + } + + super.updateEntities(); + } + + /** + * Resets the updateEntityTick field to 0 + */ + public void resetUpdateEntityTick() + { + this.updateEntityTick = 0; + } + + /** + * Runs through the list of updates to run and ticks them + */ + public boolean tickUpdates(boolean p_72955_1_) + { + if (this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD) + { + return false; + } + else + { + int i = this.pendingTickListEntriesTreeSet.size(); + + if (i != this.pendingTickListEntriesHashSet.size()) + { + throw new IllegalStateException("TickNextTick list out of synch"); + } + else + { + if (i > 1000) + { + i = 1000; + } + + this.theProfiler.startSection("cleaning"); + + for (int j = 0; j < i; ++j) + { + NextTickListEntry nextticklistentry = (NextTickListEntry)this.pendingTickListEntriesTreeSet.first(); + + if (!p_72955_1_ && nextticklistentry.scheduledTime > this.worldInfo.getWorldTotalTime()) + { + break; + } + + this.pendingTickListEntriesTreeSet.remove(nextticklistentry); + this.pendingTickListEntriesHashSet.remove(nextticklistentry); + this.pendingTickListEntriesThisTick.add(nextticklistentry); + } + + this.theProfiler.endSection(); + this.theProfiler.startSection("ticking"); + Iterator iterator = this.pendingTickListEntriesThisTick.iterator(); + + while (iterator.hasNext()) + { + NextTickListEntry nextticklistentry1 = (NextTickListEntry)iterator.next(); + iterator.remove(); + int k = 0; + + if (this.isAreaLoaded(nextticklistentry1.position.add(-k, -k, -k), nextticklistentry1.position.add(k, k, k))) + { + IBlockState iblockstate = this.getBlockState(nextticklistentry1.position); + + if (iblockstate.getBlock().getMaterial() != Material.air && Block.isEqualTo(iblockstate.getBlock(), nextticklistentry1.getBlock())) + { + try + { + iblockstate.getBlock().updateTick(this, nextticklistentry1.position, iblockstate, this.rand); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception while ticking a block"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being ticked"); + CrashReportCategory.addBlockInfo(crashreportcategory, nextticklistentry1.position, iblockstate); + throw new ReportedException(crashreport); + } + } + } + else + { + this.scheduleUpdate(nextticklistentry1.position, nextticklistentry1.getBlock(), 0); + } + } + + this.theProfiler.endSection(); + this.pendingTickListEntriesThisTick.clear(); + return !this.pendingTickListEntriesTreeSet.isEmpty(); + } + } + } + + public List getPendingBlockUpdates(Chunk chunkIn, boolean p_72920_2_) + { + ChunkCoordIntPair chunkcoordintpair = chunkIn.getChunkCoordIntPair(); + int i = (chunkcoordintpair.chunkXPos << 4) - 2; + int j = i + 16 + 2; + int k = (chunkcoordintpair.chunkZPos << 4) - 2; + int l = k + 16 + 2; + return this.func_175712_a(new StructureBoundingBox(i, 0, k, j, 256, l), p_72920_2_); + } + + public List func_175712_a(StructureBoundingBox structureBB, boolean p_175712_2_) + { + List list = null; + + for (int i = 0; i < 2; ++i) + { + Iterator iterator; + + if (i == 0) + { + iterator = this.pendingTickListEntriesTreeSet.iterator(); + } + else + { + iterator = this.pendingTickListEntriesThisTick.iterator(); + } + + while (iterator.hasNext()) + { + NextTickListEntry nextticklistentry = (NextTickListEntry)iterator.next(); + BlockPos blockpos = nextticklistentry.position; + + if (blockpos.getX() >= structureBB.minX && blockpos.getX() < structureBB.maxX && blockpos.getZ() >= structureBB.minZ && blockpos.getZ() < structureBB.maxZ) + { + if (p_175712_2_) + { + this.pendingTickListEntriesHashSet.remove(nextticklistentry); + iterator.remove(); + } + + if (list == null) + { + list = Lists.newArrayList(); + } + + list.add(nextticklistentry); + } + } + } + + return list; + } + + /** + * Will update the entity in the world if the chunk the entity is in is currently loaded or its forced to update. + * Args: entity, forceUpdate + */ + public void updateEntityWithOptionalForce(Entity entityIn, boolean forceUpdate) + { + if (!this.canSpawnAnimals() && (entityIn instanceof EntityAnimal || entityIn instanceof EntityWaterMob)) + { + entityIn.setDead(); + } + + if (!this.canSpawnNPCs() && entityIn instanceof INpc) + { + entityIn.setDead(); + } + + super.updateEntityWithOptionalForce(entityIn, forceUpdate); + } + + private boolean canSpawnNPCs() + { + return this.mcServer.getCanSpawnNPCs(); + } + + private boolean canSpawnAnimals() + { + return this.mcServer.getCanSpawnAnimals(); + } + + /** + * Creates the chunk provider for this world. Called in the constructor. Retrieves provider from worldProvider? + */ + protected IChunkProvider createChunkProvider() + { + IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider); + this.theChunkProviderServer = new ChunkProviderServer(this, ichunkloader, this.provider.createChunkGenerator()); + return this.theChunkProviderServer; + } + + public List getTileEntitiesIn(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) + { + List list = Lists.newArrayList(); + + for (int i = 0; i < this.loadedTileEntityList.size(); ++i) + { + TileEntity tileentity = (TileEntity)this.loadedTileEntityList.get(i); + BlockPos blockpos = tileentity.getPos(); + + if (blockpos.getX() >= minX && blockpos.getY() >= minY && blockpos.getZ() >= minZ && blockpos.getX() < maxX && blockpos.getY() < maxY && blockpos.getZ() < maxZ) + { + list.add(tileentity); + } + } + + return list; + } + + public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) + { + return !this.mcServer.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos); + } + + public void initialize(WorldSettings settings) + { + if (!this.worldInfo.isInitialized()) + { + try + { + this.createSpawnPosition(settings); + + if (this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD) + { + this.setDebugWorldSettings(); + } + + super.initialize(settings); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception initializing level"); + + try + { + this.addWorldInfoToCrashReport(crashreport); + } + catch (Throwable var5) + { + ; + } + + throw new ReportedException(crashreport); + } + + this.worldInfo.setServerInitialized(true); + } + } + + private void setDebugWorldSettings() + { + this.worldInfo.setMapFeaturesEnabled(false); + this.worldInfo.setAllowCommands(true); + this.worldInfo.setRaining(false); + this.worldInfo.setThundering(false); + this.worldInfo.setCleanWeatherTime(1000000000); + this.worldInfo.setWorldTime(6000L); + this.worldInfo.setGameType(WorldSettings.GameType.SPECTATOR); + this.worldInfo.setHardcore(false); + this.worldInfo.setDifficulty(EnumDifficulty.PEACEFUL); + this.worldInfo.setDifficultyLocked(true); + this.getGameRules().setOrCreateGameRule("doDaylightCycle", "false"); + } + + /** + * creates a spawn position at random within 256 blocks of 0,0 + */ + private void createSpawnPosition(WorldSettings p_73052_1_) + { + if (!this.provider.canRespawnHere()) + { + this.worldInfo.setSpawn(BlockPos.ORIGIN.up(this.provider.getAverageGroundLevel())); + } + else if (this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD) + { + this.worldInfo.setSpawn(BlockPos.ORIGIN.up()); + } + else + { + this.findingSpawnPoint = true; + WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager(); + List list = worldchunkmanager.getBiomesToSpawnIn(); + Random random = new Random(this.getSeed()); + BlockPos blockpos = worldchunkmanager.findBiomePosition(0, 0, 256, list, random); + int i = 0; + int j = this.provider.getAverageGroundLevel(); + int k = 0; + + if (blockpos != null) + { + i = blockpos.getX(); + k = blockpos.getZ(); + } + else + { + logger.warn("Unable to find spawn biome"); + } + + int l = 0; + + while (!this.provider.canCoordinateBeSpawn(i, k)) + { + i += random.nextInt(64) - random.nextInt(64); + k += random.nextInt(64) - random.nextInt(64); + ++l; + + if (l == 1000) + { + break; + } + } + + this.worldInfo.setSpawn(new BlockPos(i, j, k)); + this.findingSpawnPoint = false; + + if (p_73052_1_.isBonusChestEnabled()) + { + this.createBonusChest(); + } + } + } + + /** + * Creates the bonus chest in the world. + */ + protected void createBonusChest() + { + WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(bonusChestContent, 10); + + for (int i = 0; i < 10; ++i) + { + int j = this.worldInfo.getSpawnX() + this.rand.nextInt(6) - this.rand.nextInt(6); + int k = this.worldInfo.getSpawnZ() + this.rand.nextInt(6) - this.rand.nextInt(6); + BlockPos blockpos = this.getTopSolidOrLiquidBlock(new BlockPos(j, 0, k)).up(); + + if (worldgeneratorbonuschest.generate(this, this.rand, blockpos)) + { + break; + } + } + } + + /** + * Returns null for anything other than the End + */ + public BlockPos getSpawnCoordinate() + { + return this.provider.getSpawnCoordinate(); + } + + /** + * Saves all chunks to disk while updating progress bar. + */ + public void saveAllChunks(boolean p_73044_1_, IProgressUpdate progressCallback) throws MinecraftException + { + if (this.chunkProvider.canSave()) + { + if (progressCallback != null) + { + progressCallback.displaySavingString("Saving level"); + } + + this.saveLevel(); + + if (progressCallback != null) + { + progressCallback.displayLoadingString("Saving chunks"); + } + + this.chunkProvider.saveChunks(p_73044_1_, progressCallback); + + for (Chunk chunk : Lists.newArrayList(this.theChunkProviderServer.func_152380_a())) + { + if (chunk != null && !this.thePlayerManager.hasPlayerInstance(chunk.xPosition, chunk.zPosition)) + { + this.theChunkProviderServer.dropChunk(chunk.xPosition, chunk.zPosition); + } + } + } + } + + /** + * saves chunk data - currently only called during execution of the Save All command + */ + public void saveChunkData() + { + if (this.chunkProvider.canSave()) + { + this.chunkProvider.saveExtraData(); + } + } + + /** + * Saves the chunks to disk. + */ + protected void saveLevel() throws MinecraftException + { + this.checkSessionLock(); + this.worldInfo.setBorderSize(this.getWorldBorder().getDiameter()); + this.worldInfo.getBorderCenterX(this.getWorldBorder().getCenterX()); + this.worldInfo.getBorderCenterZ(this.getWorldBorder().getCenterZ()); + this.worldInfo.setBorderSafeZone(this.getWorldBorder().getDamageBuffer()); + this.worldInfo.setBorderDamagePerBlock(this.getWorldBorder().getDamageAmount()); + this.worldInfo.setBorderWarningDistance(this.getWorldBorder().getWarningDistance()); + this.worldInfo.setBorderWarningTime(this.getWorldBorder().getWarningTime()); + this.worldInfo.setBorderLerpTarget(this.getWorldBorder().getTargetSize()); + this.worldInfo.setBorderLerpTime(this.getWorldBorder().getTimeUntilTarget()); + this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getHostPlayerData()); + this.mapStorage.saveAllData(); + } + + protected void onEntityAdded(Entity entityIn) + { + super.onEntityAdded(entityIn); + this.entitiesById.addKey(entityIn.getEntityId(), entityIn); + this.entitiesByUuid.put(entityIn.getUniqueID(), entityIn); + Entity[] aentity = entityIn.getParts(); + + if (aentity != null) + { + for (int i = 0; i < aentity.length; ++i) + { + this.entitiesById.addKey(aentity[i].getEntityId(), aentity[i]); + } + } + } + + protected void onEntityRemoved(Entity entityIn) + { + super.onEntityRemoved(entityIn); + this.entitiesById.removeObject(entityIn.getEntityId()); + this.entitiesByUuid.remove(entityIn.getUniqueID()); + Entity[] aentity = entityIn.getParts(); + + if (aentity != null) + { + for (int i = 0; i < aentity.length; ++i) + { + this.entitiesById.removeObject(aentity[i].getEntityId()); + } + } + } + + /** + * adds a lightning bolt to the list of lightning bolts in this world. + */ + public boolean addWeatherEffect(Entity entityIn) + { + if (super.addWeatherEffect(entityIn)) + { + this.mcServer.getConfigurationManager().sendToAllNear(entityIn.posX, entityIn.posY, entityIn.posZ, 512.0D, this.provider.getDimensionId(), new S2CPacketSpawnGlobalEntity(entityIn)); + return true; + } + else + { + return false; + } + } + + /** + * sends a Packet 38 (Entity Status) to all tracked players of that entity + */ + public void setEntityState(Entity entityIn, byte state) + { + this.getEntityTracker().func_151248_b(entityIn, new S19PacketEntityStatus(entityIn, state)); + } + + /** + * returns a new explosion. Does initiation (at time of writing Explosion is not finished) + */ + public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) + { + Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking); + explosion.doExplosionA(); + explosion.doExplosionB(false); + + if (!isSmoking) + { + explosion.func_180342_d(); + } + + for (EntityPlayer entityplayer : this.playerEntities) + { + if (entityplayer.getDistanceSq(x, y, z) < 4096.0D) + { + ((EntityPlayerMP)entityplayer).playerNetServerHandler.sendPacket(new S27PacketExplosion(x, y, z, strength, explosion.getAffectedBlockPositions(), (Vec3)explosion.getPlayerKnockbackMap().get(entityplayer))); + } + } + + return explosion; + } + + public void addBlockEvent(BlockPos pos, Block blockIn, int eventID, int eventParam) + { + BlockEventData blockeventdata = new BlockEventData(pos, blockIn, eventID, eventParam); + + for (BlockEventData blockeventdata1 : this.field_147490_S[this.blockEventCacheIndex]) + { + if (blockeventdata1.equals(blockeventdata)) + { + return; + } + } + + this.field_147490_S[this.blockEventCacheIndex].add(blockeventdata); + } + + private void sendQueuedBlockEvents() + { + while (!this.field_147490_S[this.blockEventCacheIndex].isEmpty()) + { + int i = this.blockEventCacheIndex; + this.blockEventCacheIndex ^= 1; + + for (BlockEventData blockeventdata : this.field_147490_S[i]) + { + if (this.fireBlockEvent(blockeventdata)) + { + this.mcServer.getConfigurationManager().sendToAllNear((double)blockeventdata.getPosition().getX(), (double)blockeventdata.getPosition().getY(), (double)blockeventdata.getPosition().getZ(), 64.0D, this.provider.getDimensionId(), new S24PacketBlockAction(blockeventdata.getPosition(), blockeventdata.getBlock(), blockeventdata.getEventID(), blockeventdata.getEventParameter())); + } + } + + this.field_147490_S[i].clear(); + } + } + + private boolean fireBlockEvent(BlockEventData event) + { + IBlockState iblockstate = this.getBlockState(event.getPosition()); + return iblockstate.getBlock() == event.getBlock() ? iblockstate.getBlock().onBlockEventReceived(this, event.getPosition(), iblockstate, event.getEventID(), event.getEventParameter()) : false; + } + + /** + * Syncs all changes to disk and wait for completion. + */ + public void flush() + { + this.saveHandler.flush(); + } + + /** + * Updates all weather states. + */ + protected void updateWeather() + { + boolean flag = this.isRaining(); + super.updateWeather(); + + if (this.prevRainingStrength != this.rainingStrength) + { + this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.getDimensionId()); + } + + if (this.prevThunderingStrength != this.thunderingStrength) + { + this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionId()); + } + + if (flag != this.isRaining()) + { + if (flag) + { + this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F)); + } + else + { + this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(1, 0.0F)); + } + + this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, this.rainingStrength)); + this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, this.thunderingStrength)); + } + } + + protected int getRenderDistanceChunks() + { + return this.mcServer.getConfigurationManager().getViewDistance(); + } + + public MinecraftServer getMinecraftServer() + { + return this.mcServer; + } + + /** + * Gets the EntityTracker + */ + public EntityTracker getEntityTracker() + { + return this.theEntityTracker; + } + + public PlayerManager getPlayerManager() + { + return this.thePlayerManager; + } + + public Teleporter getDefaultTeleporter() + { + return this.worldTeleporter; + } + + /** + * Spawns the desired particle and sends the necessary packets to the relevant connected players. + */ + public void spawnParticle(EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord, int numberOfParticles, double p_175739_9_, double p_175739_11_, double p_175739_13_, double p_175739_15_, int... p_175739_17_) + { + this.spawnParticle(particleType, false, xCoord, yCoord, zCoord, numberOfParticles, p_175739_9_, p_175739_11_, p_175739_13_, p_175739_15_, p_175739_17_); + } + + /** + * Spawns the desired particle and sends the necessary packets to the relevant connected players. + */ + public void spawnParticle(EnumParticleTypes particleType, boolean longDistance, double xCoord, double yCoord, double zCoord, int numberOfParticles, double xOffset, double yOffset, double zOffset, double particleSpeed, int... p_180505_18_) + { + Packet packet = new S2APacketParticles(particleType, longDistance, (float)xCoord, (float)yCoord, (float)zCoord, (float)xOffset, (float)yOffset, (float)zOffset, (float)particleSpeed, numberOfParticles, p_180505_18_); + + for (int i = 0; i < this.playerEntities.size(); ++i) + { + EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntities.get(i); + BlockPos blockpos = entityplayermp.getPosition(); + double d0 = blockpos.distanceSq(xCoord, yCoord, zCoord); + + if (d0 <= 256.0D || longDistance && d0 <= 65536.0D) + { + entityplayermp.playerNetServerHandler.sendPacket(packet); + } + } + } + + public Entity getEntityFromUuid(UUID uuid) + { + return (Entity)this.entitiesByUuid.get(uuid); + } + + public ListenableFuture addScheduledTask(Runnable runnableToSchedule) + { + return this.mcServer.addScheduledTask(runnableToSchedule); + } + + public boolean isCallingFromMinecraftThread() + { + return this.mcServer.isCallingFromMinecraftThread(); + } + + static class ServerBlockEventList extends ArrayList + { + private ServerBlockEventList() + { + } + } +} diff --git a/src/minecraft/net/minecraft/world/WorldServerMulti.java b/src/minecraft/net/minecraft/world/WorldServerMulti.java new file mode 100644 index 0000000..ebf2c82 --- /dev/null +++ b/src/minecraft/net/minecraft/world/WorldServerMulti.java @@ -0,0 +1,79 @@ +package net.minecraft.world; + +import net.minecraft.profiler.Profiler; +import net.minecraft.server.MinecraftServer; +import net.minecraft.village.VillageCollection; +import net.minecraft.world.border.IBorderListener; +import net.minecraft.world.border.WorldBorder; +import net.minecraft.world.storage.DerivedWorldInfo; +import net.minecraft.world.storage.ISaveHandler; + +public class WorldServerMulti extends WorldServer +{ + private WorldServer delegate; + + public WorldServerMulti(MinecraftServer server, ISaveHandler saveHandlerIn, int dimensionId, WorldServer delegate, Profiler profilerIn) + { + super(server, saveHandlerIn, new DerivedWorldInfo(delegate.getWorldInfo()), dimensionId, profilerIn); + this.delegate = delegate; + delegate.getWorldBorder().addListener(new IBorderListener() + { + public void onSizeChanged(WorldBorder border, double newSize) + { + WorldServerMulti.this.getWorldBorder().setTransition(newSize); + } + public void onTransitionStarted(WorldBorder border, double oldSize, double newSize, long time) + { + WorldServerMulti.this.getWorldBorder().setTransition(oldSize, newSize, time); + } + public void onCenterChanged(WorldBorder border, double x, double z) + { + WorldServerMulti.this.getWorldBorder().setCenter(x, z); + } + public void onWarningTimeChanged(WorldBorder border, int newTime) + { + WorldServerMulti.this.getWorldBorder().setWarningTime(newTime); + } + public void onWarningDistanceChanged(WorldBorder border, int newDistance) + { + WorldServerMulti.this.getWorldBorder().setWarningDistance(newDistance); + } + public void onDamageAmountChanged(WorldBorder border, double newAmount) + { + WorldServerMulti.this.getWorldBorder().setDamageAmount(newAmount); + } + public void onDamageBufferChanged(WorldBorder border, double newSize) + { + WorldServerMulti.this.getWorldBorder().setDamageBuffer(newSize); + } + }); + } + + /** + * Saves the chunks to disk. + */ + protected void saveLevel() throws MinecraftException + { + } + + public World init() + { + this.mapStorage = this.delegate.getMapStorage(); + this.worldScoreboard = this.delegate.getScoreboard(); + String s = VillageCollection.fileNameForProvider(this.provider); + VillageCollection villagecollection = (VillageCollection)this.mapStorage.loadData(VillageCollection.class, s); + + if (villagecollection == null) + { + this.villageCollectionObj = new VillageCollection(this); + this.mapStorage.setData(s, this.villageCollectionObj); + } + else + { + this.villageCollectionObj = villagecollection; + this.villageCollectionObj.setWorldsForAll(this); + } + + return this; + } +} diff --git a/src/minecraft/net/minecraft/world/WorldSettings.java b/src/minecraft/net/minecraft/world/WorldSettings.java new file mode 100644 index 0000000..bddafea --- /dev/null +++ b/src/minecraft/net/minecraft/world/WorldSettings.java @@ -0,0 +1,229 @@ +package net.minecraft.world; + +import net.minecraft.entity.player.PlayerCapabilities; +import net.minecraft.world.storage.WorldInfo; + +public final class WorldSettings +{ + /** The seed for the map. */ + private final long seed; + + /** The EnumGameType. */ + private final WorldSettings.GameType theGameType; + + /** + * Switch for the map features. 'true' for enabled, 'false' for disabled. + */ + private final boolean mapFeaturesEnabled; + + /** True if hardcore mode is enabled */ + private final boolean hardcoreEnabled; + private final WorldType terrainType; + + /** True if Commands (cheats) are allowed. */ + private boolean commandsAllowed; + + /** True if the Bonus Chest is enabled. */ + private boolean bonusChestEnabled; + private String worldName; + + public WorldSettings(long seedIn, WorldSettings.GameType gameType, boolean enableMapFeatures, boolean hardcoreMode, WorldType worldTypeIn) + { + this.worldName = ""; + this.seed = seedIn; + this.theGameType = gameType; + this.mapFeaturesEnabled = enableMapFeatures; + this.hardcoreEnabled = hardcoreMode; + this.terrainType = worldTypeIn; + } + + public WorldSettings(WorldInfo info) + { + this(info.getSeed(), info.getGameType(), info.isMapFeaturesEnabled(), info.isHardcoreModeEnabled(), info.getTerrainType()); + } + + /** + * Enables the bonus chest. + */ + public WorldSettings enableBonusChest() + { + this.bonusChestEnabled = true; + return this; + } + + /** + * Enables Commands (cheats). + */ + public WorldSettings enableCommands() + { + this.commandsAllowed = true; + return this; + } + + public WorldSettings setWorldName(String name) + { + this.worldName = name; + return this; + } + + /** + * Returns true if the Bonus Chest is enabled. + */ + public boolean isBonusChestEnabled() + { + return this.bonusChestEnabled; + } + + /** + * Returns the seed for the world. + */ + public long getSeed() + { + return this.seed; + } + + /** + * Gets the game type. + */ + public WorldSettings.GameType getGameType() + { + return this.theGameType; + } + + /** + * Returns true if hardcore mode is enabled, otherwise false + */ + public boolean getHardcoreEnabled() + { + return this.hardcoreEnabled; + } + + /** + * Get whether the map features (e.g. strongholds) generation is enabled or disabled. + */ + public boolean isMapFeaturesEnabled() + { + return this.mapFeaturesEnabled; + } + + public WorldType getTerrainType() + { + return this.terrainType; + } + + /** + * Returns true if Commands (cheats) are allowed. + */ + public boolean areCommandsAllowed() + { + return this.commandsAllowed; + } + + /** + * Gets the GameType by ID + */ + public static WorldSettings.GameType getGameTypeById(int id) + { + return WorldSettings.GameType.getByID(id); + } + + public String getWorldName() + { + return this.worldName; + } + + public static enum GameType + { + NOT_SET(-1, ""), + SURVIVAL(0, "survival"), + CREATIVE(1, "creative"), + ADVENTURE(2, "adventure"), + SPECTATOR(3, "spectator"); + + int id; + String name; + + private GameType(int typeId, String nameIn) + { + this.id = typeId; + this.name = nameIn; + } + + public int getID() + { + return this.id; + } + + public String getName() + { + return this.name; + } + + public void configurePlayerCapabilities(PlayerCapabilities capabilities) + { + if (this == CREATIVE) + { + capabilities.allowFlying = true; + capabilities.isCreativeMode = true; + capabilities.disableDamage = true; + } + else if (this == SPECTATOR) + { + capabilities.allowFlying = true; + capabilities.isCreativeMode = false; + capabilities.disableDamage = true; + capabilities.isFlying = true; + } + else + { + capabilities.allowFlying = false; + capabilities.isCreativeMode = false; + capabilities.disableDamage = false; + capabilities.isFlying = false; + } + + capabilities.allowEdit = !this.isAdventure(); + } + + public boolean isAdventure() + { + return this == ADVENTURE || this == SPECTATOR; + } + + public boolean isCreative() + { + return this == CREATIVE; + } + + public boolean isSurvivalOrAdventure() + { + return this == SURVIVAL || this == ADVENTURE; + } + + public static WorldSettings.GameType getByID(int idIn) + { + for (WorldSettings.GameType worldsettings$gametype : values()) + { + if (worldsettings$gametype.id == idIn) + { + return worldsettings$gametype; + } + } + + return SURVIVAL; + } + + public static WorldSettings.GameType getByName(String p_77142_0_) + { + for (WorldSettings.GameType worldsettings$gametype : values()) + { + if (worldsettings$gametype.name.equals(p_77142_0_)) + { + return worldsettings$gametype; + } + } + + return SURVIVAL; + } + } +} diff --git a/src/minecraft/net/minecraft/world/WorldType.java b/src/minecraft/net/minecraft/world/WorldType.java new file mode 100644 index 0000000..48b5aaf --- /dev/null +++ b/src/minecraft/net/minecraft/world/WorldType.java @@ -0,0 +1,155 @@ +package net.minecraft.world; + +public class WorldType +{ + /** List of world types. */ + public static final WorldType[] worldTypes = new WorldType[16]; + + /** Default world type. */ + public static final WorldType DEFAULT = (new WorldType(0, "default", 1)).setVersioned(); + + /** Flat world type. */ + public static final WorldType FLAT = new WorldType(1, "flat"); + + /** Large Biome world Type. */ + public static final WorldType LARGE_BIOMES = new WorldType(2, "largeBiomes"); + + /** amplified world type */ + public static final WorldType AMPLIFIED = (new WorldType(3, "amplified")).setNotificationData(); + public static final WorldType CUSTOMIZED = new WorldType(4, "customized"); + public static final WorldType DEBUG_WORLD = new WorldType(5, "debug_all_block_states"); + + /** Default (1.1) world type. */ + public static final WorldType DEFAULT_1_1 = (new WorldType(8, "default_1_1", 0)).setCanBeCreated(false); + + /** ID for this world type. */ + private final int worldTypeId; + private final String worldType; + + /** The int version of the ChunkProvider that generated this world. */ + private final int generatorVersion; + + /** + * Whether this world type can be generated. Normally true; set to false for out-of-date generator versions. + */ + private boolean canBeCreated; + + /** Whether this WorldType has a version or not. */ + private boolean isWorldTypeVersioned; + private boolean hasNotificationData; + + private WorldType(int id, String name) + { + this(id, name, 0); + } + + private WorldType(int id, String name, int version) + { + this.worldType = name; + this.generatorVersion = version; + this.canBeCreated = true; + this.worldTypeId = id; + worldTypes[id] = this; + } + + public String getWorldTypeName() + { + return this.worldType; + } + + /** + * Gets the translation key for the name of this world type. + */ + public String getTranslateName() + { + return "generator." + this.worldType; + } + + public String func_151359_c() + { + return this.getTranslateName() + ".info"; + } + + /** + * Returns generatorVersion. + */ + public int getGeneratorVersion() + { + return this.generatorVersion; + } + + public WorldType getWorldTypeForGeneratorVersion(int version) + { + return this == DEFAULT && version == 0 ? DEFAULT_1_1 : this; + } + + /** + * Sets canBeCreated to the provided value, and returns this. + */ + private WorldType setCanBeCreated(boolean enable) + { + this.canBeCreated = enable; + return this; + } + + /** + * Gets whether this WorldType can be used to generate a new world. + */ + public boolean getCanBeCreated() + { + return this.canBeCreated; + } + + /** + * Flags this world type as having an associated version. + */ + private WorldType setVersioned() + { + this.isWorldTypeVersioned = true; + return this; + } + + /** + * Returns true if this world Type has a version associated with it. + */ + public boolean isVersioned() + { + return this.isWorldTypeVersioned; + } + + public static WorldType parseWorldType(String type) + { + for (int i = 0; i < worldTypes.length; ++i) + { + if (worldTypes[i] != null && worldTypes[i].worldType.equalsIgnoreCase(type)) + { + return worldTypes[i]; + } + } + + return null; + } + + public int getWorldTypeID() + { + return this.worldTypeId; + } + + /** + * returns true if selecting this worldtype from the customize menu should display the generator.[worldtype].info + * message + */ + public boolean showWorldInfoNotice() + { + return this.hasNotificationData; + } + + /** + * enables the display of generator.[worldtype].info message on the customize world menu + */ + private WorldType setNotificationData() + { + this.hasNotificationData = true; + return this; + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeCache.java b/src/minecraft/net/minecraft/world/biome/BiomeCache.java new file mode 100644 index 0000000..17d9e91 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeCache.java @@ -0,0 +1,106 @@ +package net.minecraft.world.biome; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.LongHashMap; + +public class BiomeCache +{ + /** Reference to the WorldChunkManager */ + private final WorldChunkManager chunkManager; + + /** The last time this BiomeCache was cleaned, in milliseconds. */ + private long lastCleanupTime; + private LongHashMap cacheMap = new LongHashMap(); + private List cache = Lists.newArrayList(); + + public BiomeCache(WorldChunkManager chunkManagerIn) + { + this.chunkManager = chunkManagerIn; + } + + /** + * Returns a biome cache block at location specified. + */ + public BiomeCache.Block getBiomeCacheBlock(int x, int z) + { + x = x >> 4; + z = z >> 4; + long i = (long)x & 4294967295L | ((long)z & 4294967295L) << 32; + BiomeCache.Block biomecache$block = (BiomeCache.Block)this.cacheMap.getValueByKey(i); + + if (biomecache$block == null) + { + biomecache$block = new BiomeCache.Block(x, z); + this.cacheMap.add(i, biomecache$block); + this.cache.add(biomecache$block); + } + + biomecache$block.lastAccessTime = MinecraftServer.getCurrentTimeMillis(); + return biomecache$block; + } + + public BiomeGenBase func_180284_a(int x, int z, BiomeGenBase p_180284_3_) + { + BiomeGenBase biomegenbase = this.getBiomeCacheBlock(x, z).getBiomeGenAt(x, z); + return biomegenbase == null ? p_180284_3_ : biomegenbase; + } + + /** + * Removes BiomeCacheBlocks from this cache that haven't been accessed in at least 30 seconds. + */ + public void cleanupCache() + { + long i = MinecraftServer.getCurrentTimeMillis(); + long j = i - this.lastCleanupTime; + + if (j > 7500L || j < 0L) + { + this.lastCleanupTime = i; + + for (int k = 0; k < this.cache.size(); ++k) + { + BiomeCache.Block biomecache$block = (BiomeCache.Block)this.cache.get(k); + long l = i - biomecache$block.lastAccessTime; + + if (l > 30000L || l < 0L) + { + this.cache.remove(k--); + long i1 = (long)biomecache$block.xPosition & 4294967295L | ((long)biomecache$block.zPosition & 4294967295L) << 32; + this.cacheMap.remove(i1); + } + } + } + } + + /** + * Returns the array of cached biome types in the BiomeCacheBlock at the given location. + */ + public BiomeGenBase[] getCachedBiomes(int x, int z) + { + return this.getBiomeCacheBlock(x, z).biomes; + } + + public class Block + { + public float[] rainfallValues = new float[256]; + public BiomeGenBase[] biomes = new BiomeGenBase[256]; + public int xPosition; + public int zPosition; + public long lastAccessTime; + + public Block(int x, int z) + { + this.xPosition = x; + this.zPosition = z; + BiomeCache.this.chunkManager.getRainfall(this.rainfallValues, x << 4, z << 4, 16, 16); + BiomeCache.this.chunkManager.getBiomeGenAt(this.biomes, x << 4, z << 4, 16, 16, false); + } + + public BiomeGenBase getBiomeGenAt(int x, int z) + { + return this.biomes[x & 15 | (z & 15) << 4]; + } + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeColorHelper.java b/src/minecraft/net/minecraft/world/biome/BiomeColorHelper.java new file mode 100644 index 0000000..cb4861a --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeColorHelper.java @@ -0,0 +1,66 @@ +package net.minecraft.world.biome; + +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; + +public class BiomeColorHelper +{ + private static final BiomeColorHelper.ColorResolver field_180291_a = new BiomeColorHelper.ColorResolver() + { + public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) + { + return p_180283_1_.getGrassColorAtPos(blockPosition); + } + }; + private static final BiomeColorHelper.ColorResolver field_180289_b = new BiomeColorHelper.ColorResolver() + { + public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) + { + return p_180283_1_.getFoliageColorAtPos(blockPosition); + } + }; + private static final BiomeColorHelper.ColorResolver field_180290_c = new BiomeColorHelper.ColorResolver() + { + public int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition) + { + return p_180283_1_.waterColorMultiplier; + } + }; + + private static int func_180285_a(IBlockAccess p_180285_0_, BlockPos p_180285_1_, BiomeColorHelper.ColorResolver p_180285_2_) + { + int i = 0; + int j = 0; + int k = 0; + + for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(p_180285_1_.add(-1, 0, -1), p_180285_1_.add(1, 0, 1))) + { + int l = p_180285_2_.getColorAtPos(p_180285_0_.getBiomeGenForCoords(blockpos$mutableblockpos), blockpos$mutableblockpos); + i += (l & 16711680) >> 16; + j += (l & 65280) >> 8; + k += l & 255; + } + + return (i / 9 & 255) << 16 | (j / 9 & 255) << 8 | k / 9 & 255; + } + + public static int getGrassColorAtPos(IBlockAccess p_180286_0_, BlockPos p_180286_1_) + { + return func_180285_a(p_180286_0_, p_180286_1_, field_180291_a); + } + + public static int getFoliageColorAtPos(IBlockAccess p_180287_0_, BlockPos p_180287_1_) + { + return func_180285_a(p_180287_0_, p_180287_1_, field_180289_b); + } + + public static int getWaterColorAtPos(IBlockAccess p_180288_0_, BlockPos p_180288_1_) + { + return func_180285_a(p_180288_0_, p_180288_1_, field_180290_c); + } + + interface ColorResolver + { + int getColorAtPos(BiomeGenBase p_180283_1_, BlockPos blockPosition); + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeDecorator.java b/src/minecraft/net/minecraft/world/biome/BiomeDecorator.java new file mode 100644 index 0000000..3575018 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeDecorator.java @@ -0,0 +1,495 @@ +package net.minecraft.world.biome; + +import java.util.Random; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.BlockStone; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.gen.ChunkProviderSettings; +import net.minecraft.world.gen.GeneratorBushFeature; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenBigMushroom; +import net.minecraft.world.gen.feature.WorldGenCactus; +import net.minecraft.world.gen.feature.WorldGenClay; +import net.minecraft.world.gen.feature.WorldGenDeadBush; +import net.minecraft.world.gen.feature.WorldGenFlowers; +import net.minecraft.world.gen.feature.WorldGenLiquids; +import net.minecraft.world.gen.feature.WorldGenMinable; +import net.minecraft.world.gen.feature.WorldGenPumpkin; +import net.minecraft.world.gen.feature.WorldGenReed; +import net.minecraft.world.gen.feature.WorldGenSand; +import net.minecraft.world.gen.feature.WorldGenWaterlily; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class BiomeDecorator +{ + /** The world the BiomeDecorator is currently decorating */ + protected World currentWorld; + + /** The Biome Decorator's random number generator. */ + protected Random randomGenerator; + protected BlockPos field_180294_c; + protected ChunkProviderSettings chunkProviderSettings; + + /** The clay generator. */ + protected WorldGenerator clayGen = new WorldGenClay(4); + + /** The sand generator. */ + protected WorldGenerator sandGen = new WorldGenSand(Blocks.sand, 7); + + /** The gravel generator. */ + protected WorldGenerator gravelAsSandGen = new WorldGenSand(Blocks.gravel, 6); + + /** The dirt generator. */ + protected WorldGenerator dirtGen; + protected WorldGenerator gravelGen; + protected WorldGenerator graniteGen; + protected WorldGenerator dioriteGen; + protected WorldGenerator andesiteGen; + protected WorldGenerator coalGen; + protected WorldGenerator ironGen; + + /** Field that holds gold WorldGenMinable */ + protected WorldGenerator goldGen; + protected WorldGenerator redstoneGen; + protected WorldGenerator diamondGen; + + /** Field that holds Lapis WorldGenMinable */ + protected WorldGenerator lapisGen; + protected WorldGenFlowers yellowFlowerGen = new WorldGenFlowers(Blocks.yellow_flower, BlockFlower.EnumFlowerType.DANDELION); + + /** Field that holds mushroomBrown WorldGenFlowers */ + protected WorldGenerator mushroomBrownGen = new GeneratorBushFeature(Blocks.brown_mushroom); + + /** Field that holds mushroomRed WorldGenFlowers */ + protected WorldGenerator mushroomRedGen = new GeneratorBushFeature(Blocks.red_mushroom); + + /** Field that holds big mushroom generator */ + protected WorldGenerator bigMushroomGen = new WorldGenBigMushroom(); + + /** Field that holds WorldGenReed */ + protected WorldGenerator reedGen = new WorldGenReed(); + + /** Field that holds WorldGenCactus */ + protected WorldGenerator cactusGen = new WorldGenCactus(); + + /** The water lily generation! */ + protected WorldGenerator waterlilyGen = new WorldGenWaterlily(); + + /** Amount of waterlilys per chunk. */ + protected int waterlilyPerChunk; + + /** + * The number of trees to attempt to generate per chunk. Up to 10 in forests, none in deserts. + */ + protected int treesPerChunk; + + /** + * The number of yellow flower patches to generate per chunk. The game generates much less than this number, since + * it attempts to generate them at a random altitude. + */ + protected int flowersPerChunk = 2; + + /** The amount of tall grass to generate per chunk. */ + protected int grassPerChunk = 1; + + /** + * The number of dead bushes to generate per chunk. Used in deserts and swamps. + */ + protected int deadBushPerChunk; + + /** + * The number of extra mushroom patches per chunk. It generates 1/4 this number in brown mushroom patches, and 1/8 + * this number in red mushroom patches. These mushrooms go beyond the default base number of mushrooms. + */ + protected int mushroomsPerChunk; + + /** + * The number of reeds to generate per chunk. Reeds won't generate if the randomly selected placement is unsuitable. + */ + protected int reedsPerChunk; + + /** + * The number of cactus plants to generate per chunk. Cacti only work on sand. + */ + protected int cactiPerChunk; + + /** + * The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. + */ + protected int sandPerChunk = 1; + + /** + * The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. There + * appear to be two separate fields for this. + */ + protected int sandPerChunk2 = 3; + + /** + * The number of clay patches to generate per chunk. Only generates when part of it is underwater. + */ + protected int clayPerChunk = 1; + + /** Amount of big mushrooms per chunk */ + protected int bigMushroomsPerChunk; + + /** True if decorator should generate surface lava & water */ + public boolean generateLakes = true; + + public void decorate(World worldIn, Random random, BiomeGenBase p_180292_3_, BlockPos p_180292_4_) + { + if (this.currentWorld != null) + { + throw new RuntimeException("Already decorating"); + } + else + { + this.currentWorld = worldIn; + String s = worldIn.getWorldInfo().getGeneratorOptions(); + + if (s != null) + { + this.chunkProviderSettings = ChunkProviderSettings.Factory.jsonToFactory(s).func_177864_b(); + } + else + { + this.chunkProviderSettings = ChunkProviderSettings.Factory.jsonToFactory("").func_177864_b(); + } + + this.randomGenerator = random; + this.field_180294_c = p_180292_4_; + this.dirtGen = new WorldGenMinable(Blocks.dirt.getDefaultState(), this.chunkProviderSettings.dirtSize); + this.gravelGen = new WorldGenMinable(Blocks.gravel.getDefaultState(), this.chunkProviderSettings.gravelSize); + this.graniteGen = new WorldGenMinable(Blocks.stone.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.GRANITE), this.chunkProviderSettings.graniteSize); + this.dioriteGen = new WorldGenMinable(Blocks.stone.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.DIORITE), this.chunkProviderSettings.dioriteSize); + this.andesiteGen = new WorldGenMinable(Blocks.stone.getDefaultState().withProperty(BlockStone.VARIANT, BlockStone.EnumType.ANDESITE), this.chunkProviderSettings.andesiteSize); + this.coalGen = new WorldGenMinable(Blocks.coal_ore.getDefaultState(), this.chunkProviderSettings.coalSize); + this.ironGen = new WorldGenMinable(Blocks.iron_ore.getDefaultState(), this.chunkProviderSettings.ironSize); + this.goldGen = new WorldGenMinable(Blocks.gold_ore.getDefaultState(), this.chunkProviderSettings.goldSize); + this.redstoneGen = new WorldGenMinable(Blocks.redstone_ore.getDefaultState(), this.chunkProviderSettings.redstoneSize); + this.diamondGen = new WorldGenMinable(Blocks.diamond_ore.getDefaultState(), this.chunkProviderSettings.diamondSize); + this.lapisGen = new WorldGenMinable(Blocks.lapis_ore.getDefaultState(), this.chunkProviderSettings.lapisSize); + this.genDecorations(p_180292_3_); + this.currentWorld = null; + this.randomGenerator = null; + } + } + + protected void genDecorations(BiomeGenBase biomeGenBaseIn) + { + this.generateOres(); + + for (int i = 0; i < this.sandPerChunk2; ++i) + { + int j = this.randomGenerator.nextInt(16) + 8; + int k = this.randomGenerator.nextInt(16) + 8; + this.sandGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(j, 0, k))); + } + + for (int i1 = 0; i1 < this.clayPerChunk; ++i1) + { + int l1 = this.randomGenerator.nextInt(16) + 8; + int i6 = this.randomGenerator.nextInt(16) + 8; + this.clayGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(l1, 0, i6))); + } + + for (int j1 = 0; j1 < this.sandPerChunk; ++j1) + { + int i2 = this.randomGenerator.nextInt(16) + 8; + int j6 = this.randomGenerator.nextInt(16) + 8; + this.gravelAsSandGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(i2, 0, j6))); + } + + int k1 = this.treesPerChunk; + + if (this.randomGenerator.nextInt(10) == 0) + { + ++k1; + } + + for (int j2 = 0; j2 < k1; ++j2) + { + int k6 = this.randomGenerator.nextInt(16) + 8; + int l = this.randomGenerator.nextInt(16) + 8; + WorldGenAbstractTree worldgenabstracttree = biomeGenBaseIn.genBigTreeChance(this.randomGenerator); + worldgenabstracttree.func_175904_e(); + BlockPos blockpos = this.currentWorld.getHeight(this.field_180294_c.add(k6, 0, l)); + + if (worldgenabstracttree.generate(this.currentWorld, this.randomGenerator, blockpos)) + { + worldgenabstracttree.func_180711_a(this.currentWorld, this.randomGenerator, blockpos); + } + } + + for (int k2 = 0; k2 < this.bigMushroomsPerChunk; ++k2) + { + int l6 = this.randomGenerator.nextInt(16) + 8; + int k10 = this.randomGenerator.nextInt(16) + 8; + this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getHeight(this.field_180294_c.add(l6, 0, k10))); + } + + for (int l2 = 0; l2 < this.flowersPerChunk; ++l2) + { + int i7 = this.randomGenerator.nextInt(16) + 8; + int l10 = this.randomGenerator.nextInt(16) + 8; + int j14 = this.currentWorld.getHeight(this.field_180294_c.add(i7, 0, l10)).getY() + 32; + + if (j14 > 0) + { + int k17 = this.randomGenerator.nextInt(j14); + BlockPos blockpos1 = this.field_180294_c.add(i7, k17, l10); + BlockFlower.EnumFlowerType blockflower$enumflowertype = biomeGenBaseIn.pickRandomFlower(this.randomGenerator, blockpos1); + BlockFlower blockflower = blockflower$enumflowertype.getBlockType().getBlock(); + + if (blockflower.getMaterial() != Material.air) + { + this.yellowFlowerGen.setGeneratedBlock(blockflower, blockflower$enumflowertype); + this.yellowFlowerGen.generate(this.currentWorld, this.randomGenerator, blockpos1); + } + } + } + + for (int i3 = 0; i3 < this.grassPerChunk; ++i3) + { + int j7 = this.randomGenerator.nextInt(16) + 8; + int i11 = this.randomGenerator.nextInt(16) + 8; + int k14 = this.currentWorld.getHeight(this.field_180294_c.add(j7, 0, i11)).getY() * 2; + + if (k14 > 0) + { + int l17 = this.randomGenerator.nextInt(k14); + biomeGenBaseIn.getRandomWorldGenForGrass(this.randomGenerator).generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j7, l17, i11)); + } + } + + for (int j3 = 0; j3 < this.deadBushPerChunk; ++j3) + { + int k7 = this.randomGenerator.nextInt(16) + 8; + int j11 = this.randomGenerator.nextInt(16) + 8; + int l14 = this.currentWorld.getHeight(this.field_180294_c.add(k7, 0, j11)).getY() * 2; + + if (l14 > 0) + { + int i18 = this.randomGenerator.nextInt(l14); + (new WorldGenDeadBush()).generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(k7, i18, j11)); + } + } + + for (int k3 = 0; k3 < this.waterlilyPerChunk; ++k3) + { + int l7 = this.randomGenerator.nextInt(16) + 8; + int k11 = this.randomGenerator.nextInt(16) + 8; + int i15 = this.currentWorld.getHeight(this.field_180294_c.add(l7, 0, k11)).getY() * 2; + + if (i15 > 0) + { + int j18 = this.randomGenerator.nextInt(i15); + BlockPos blockpos4; + BlockPos blockpos7; + + for (blockpos4 = this.field_180294_c.add(l7, j18, k11); blockpos4.getY() > 0; blockpos4 = blockpos7) + { + blockpos7 = blockpos4.down(); + + if (!this.currentWorld.isAirBlock(blockpos7)) + { + break; + } + } + + this.waterlilyGen.generate(this.currentWorld, this.randomGenerator, blockpos4); + } + } + + for (int l3 = 0; l3 < this.mushroomsPerChunk; ++l3) + { + if (this.randomGenerator.nextInt(4) == 0) + { + int i8 = this.randomGenerator.nextInt(16) + 8; + int l11 = this.randomGenerator.nextInt(16) + 8; + BlockPos blockpos2 = this.currentWorld.getHeight(this.field_180294_c.add(i8, 0, l11)); + this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, blockpos2); + } + + if (this.randomGenerator.nextInt(8) == 0) + { + int j8 = this.randomGenerator.nextInt(16) + 8; + int i12 = this.randomGenerator.nextInt(16) + 8; + int j15 = this.currentWorld.getHeight(this.field_180294_c.add(j8, 0, i12)).getY() * 2; + + if (j15 > 0) + { + int k18 = this.randomGenerator.nextInt(j15); + BlockPos blockpos5 = this.field_180294_c.add(j8, k18, i12); + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, blockpos5); + } + } + } + + if (this.randomGenerator.nextInt(4) == 0) + { + int i4 = this.randomGenerator.nextInt(16) + 8; + int k8 = this.randomGenerator.nextInt(16) + 8; + int j12 = this.currentWorld.getHeight(this.field_180294_c.add(i4, 0, k8)).getY() * 2; + + if (j12 > 0) + { + int k15 = this.randomGenerator.nextInt(j12); + this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(i4, k15, k8)); + } + } + + if (this.randomGenerator.nextInt(8) == 0) + { + int j4 = this.randomGenerator.nextInt(16) + 8; + int l8 = this.randomGenerator.nextInt(16) + 8; + int k12 = this.currentWorld.getHeight(this.field_180294_c.add(j4, 0, l8)).getY() * 2; + + if (k12 > 0) + { + int l15 = this.randomGenerator.nextInt(k12); + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j4, l15, l8)); + } + } + + for (int k4 = 0; k4 < this.reedsPerChunk; ++k4) + { + int i9 = this.randomGenerator.nextInt(16) + 8; + int l12 = this.randomGenerator.nextInt(16) + 8; + int i16 = this.currentWorld.getHeight(this.field_180294_c.add(i9, 0, l12)).getY() * 2; + + if (i16 > 0) + { + int l18 = this.randomGenerator.nextInt(i16); + this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(i9, l18, l12)); + } + } + + for (int l4 = 0; l4 < 10; ++l4) + { + int j9 = this.randomGenerator.nextInt(16) + 8; + int i13 = this.randomGenerator.nextInt(16) + 8; + int j16 = this.currentWorld.getHeight(this.field_180294_c.add(j9, 0, i13)).getY() * 2; + + if (j16 > 0) + { + int i19 = this.randomGenerator.nextInt(j16); + this.reedGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(j9, i19, i13)); + } + } + + if (this.randomGenerator.nextInt(32) == 0) + { + int i5 = this.randomGenerator.nextInt(16) + 8; + int k9 = this.randomGenerator.nextInt(16) + 8; + int j13 = this.currentWorld.getHeight(this.field_180294_c.add(i5, 0, k9)).getY() * 2; + + if (j13 > 0) + { + int k16 = this.randomGenerator.nextInt(j13); + (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(i5, k16, k9)); + } + } + + for (int j5 = 0; j5 < this.cactiPerChunk; ++j5) + { + int l9 = this.randomGenerator.nextInt(16) + 8; + int k13 = this.randomGenerator.nextInt(16) + 8; + int l16 = this.currentWorld.getHeight(this.field_180294_c.add(l9, 0, k13)).getY() * 2; + + if (l16 > 0) + { + int j19 = this.randomGenerator.nextInt(l16); + this.cactusGen.generate(this.currentWorld, this.randomGenerator, this.field_180294_c.add(l9, j19, k13)); + } + } + + if (this.generateLakes) + { + for (int k5 = 0; k5 < 50; ++k5) + { + int i10 = this.randomGenerator.nextInt(16) + 8; + int l13 = this.randomGenerator.nextInt(16) + 8; + int i17 = this.randomGenerator.nextInt(248) + 8; + + if (i17 > 0) + { + int k19 = this.randomGenerator.nextInt(i17); + BlockPos blockpos6 = this.field_180294_c.add(i10, k19, l13); + (new WorldGenLiquids(Blocks.flowing_water)).generate(this.currentWorld, this.randomGenerator, blockpos6); + } + } + + for (int l5 = 0; l5 < 20; ++l5) + { + int j10 = this.randomGenerator.nextInt(16) + 8; + int i14 = this.randomGenerator.nextInt(16) + 8; + int j17 = this.randomGenerator.nextInt(this.randomGenerator.nextInt(this.randomGenerator.nextInt(240) + 8) + 8); + BlockPos blockpos3 = this.field_180294_c.add(j10, j17, i14); + (new WorldGenLiquids(Blocks.flowing_lava)).generate(this.currentWorld, this.randomGenerator, blockpos3); + } + } + } + + /** + * Standard ore generation helper. Generates most ores. + */ + protected void genStandardOre1(int blockCount, WorldGenerator generator, int minHeight, int maxHeight) + { + if (maxHeight < minHeight) + { + int i = minHeight; + minHeight = maxHeight; + maxHeight = i; + } + else if (maxHeight == minHeight) + { + if (minHeight < 255) + { + ++maxHeight; + } + else + { + --minHeight; + } + } + + for (int j = 0; j < blockCount; ++j) + { + BlockPos blockpos = this.field_180294_c.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(maxHeight - minHeight) + minHeight, this.randomGenerator.nextInt(16)); + generator.generate(this.currentWorld, this.randomGenerator, blockpos); + } + } + + /** + * Standard ore generation helper. Generates Lapis Lazuli. + */ + protected void genStandardOre2(int blockCount, WorldGenerator generator, int centerHeight, int spread) + { + for (int i = 0; i < blockCount; ++i) + { + BlockPos blockpos = this.field_180294_c.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(spread) + this.randomGenerator.nextInt(spread) + centerHeight - spread, this.randomGenerator.nextInt(16)); + generator.generate(this.currentWorld, this.randomGenerator, blockpos); + } + } + + /** + * Generates ores in the current chunk + */ + protected void generateOres() + { + this.genStandardOre1(this.chunkProviderSettings.dirtCount, this.dirtGen, this.chunkProviderSettings.dirtMinHeight, this.chunkProviderSettings.dirtMaxHeight); + this.genStandardOre1(this.chunkProviderSettings.gravelCount, this.gravelGen, this.chunkProviderSettings.gravelMinHeight, this.chunkProviderSettings.gravelMaxHeight); + this.genStandardOre1(this.chunkProviderSettings.dioriteCount, this.dioriteGen, this.chunkProviderSettings.dioriteMinHeight, this.chunkProviderSettings.dioriteMaxHeight); + this.genStandardOre1(this.chunkProviderSettings.graniteCount, this.graniteGen, this.chunkProviderSettings.graniteMinHeight, this.chunkProviderSettings.graniteMaxHeight); + this.genStandardOre1(this.chunkProviderSettings.andesiteCount, this.andesiteGen, this.chunkProviderSettings.andesiteMinHeight, this.chunkProviderSettings.andesiteMaxHeight); + this.genStandardOre1(this.chunkProviderSettings.coalCount, this.coalGen, this.chunkProviderSettings.coalMinHeight, this.chunkProviderSettings.coalMaxHeight); + this.genStandardOre1(this.chunkProviderSettings.ironCount, this.ironGen, this.chunkProviderSettings.ironMinHeight, this.chunkProviderSettings.ironMaxHeight); + this.genStandardOre1(this.chunkProviderSettings.goldCount, this.goldGen, this.chunkProviderSettings.goldMinHeight, this.chunkProviderSettings.goldMaxHeight); + this.genStandardOre1(this.chunkProviderSettings.redstoneCount, this.redstoneGen, this.chunkProviderSettings.redstoneMinHeight, this.chunkProviderSettings.redstoneMaxHeight); + this.genStandardOre1(this.chunkProviderSettings.diamondCount, this.diamondGen, this.chunkProviderSettings.diamondMinHeight, this.chunkProviderSettings.diamondMaxHeight); + this.genStandardOre2(this.chunkProviderSettings.lapisCount, this.lapisGen, this.chunkProviderSettings.lapisCenterHeight, this.chunkProviderSettings.lapisSpread); + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeEndDecorator.java b/src/minecraft/net/minecraft/world/biome/BiomeEndDecorator.java new file mode 100644 index 0000000..e9594f2 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeEndDecorator.java @@ -0,0 +1,30 @@ +package net.minecraft.world.biome; + +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.init.Blocks; +import net.minecraft.world.gen.feature.WorldGenSpikes; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class BiomeEndDecorator extends BiomeDecorator +{ + protected WorldGenerator spikeGen = new WorldGenSpikes(Blocks.end_stone); + + protected void genDecorations(BiomeGenBase biomeGenBaseIn) + { + this.generateOres(); + + if (this.randomGenerator.nextInt(5) == 0) + { + int i = this.randomGenerator.nextInt(16) + 8; + int j = this.randomGenerator.nextInt(16) + 8; + this.spikeGen.generate(this.currentWorld, this.randomGenerator, this.currentWorld.getTopSolidOrLiquidBlock(this.field_180294_c.add(i, 0, j))); + } + + if (this.field_180294_c.getX() == 0 && this.field_180294_c.getZ() == 0) + { + EntityDragon entitydragon = new EntityDragon(this.currentWorld); + entitydragon.setLocationAndAngles(0.0D, 128.0D, 0.0D, this.randomGenerator.nextFloat() * 360.0F, 0.0F); + this.currentWorld.spawnEntityInWorld(entitydragon); + } + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenBase.java b/src/minecraft/net/minecraft/world/biome/BiomeGenBase.java new file mode 100644 index 0000000..c5e0e18 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenBase.java @@ -0,0 +1,688 @@ +package net.minecraft.world.biome; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.BlockSand; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.monster.EntityWitch; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.entity.passive.EntityCow; +import net.minecraft.entity.passive.EntityPig; +import net.minecraft.entity.passive.EntityRabbit; +import net.minecraft.entity.passive.EntitySheep; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.WeightedRandom; +import net.minecraft.world.ColorizerFoliage; +import net.minecraft.world.ColorizerGrass; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.gen.NoiseGeneratorPerlin; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenBigTree; +import net.minecraft.world.gen.feature.WorldGenDoublePlant; +import net.minecraft.world.gen.feature.WorldGenSwamp; +import net.minecraft.world.gen.feature.WorldGenTallGrass; +import net.minecraft.world.gen.feature.WorldGenTrees; +import net.minecraft.world.gen.feature.WorldGenerator; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public abstract class BiomeGenBase +{ + private static final Logger logger = LogManager.getLogger(); + protected static final BiomeGenBase.Height height_Default = new BiomeGenBase.Height(0.1F, 0.2F); + protected static final BiomeGenBase.Height height_ShallowWaters = new BiomeGenBase.Height(-0.5F, 0.0F); + protected static final BiomeGenBase.Height height_Oceans = new BiomeGenBase.Height(-1.0F, 0.1F); + protected static final BiomeGenBase.Height height_DeepOceans = new BiomeGenBase.Height(-1.8F, 0.1F); + protected static final BiomeGenBase.Height height_LowPlains = new BiomeGenBase.Height(0.125F, 0.05F); + protected static final BiomeGenBase.Height height_MidPlains = new BiomeGenBase.Height(0.2F, 0.2F); + protected static final BiomeGenBase.Height height_LowHills = new BiomeGenBase.Height(0.45F, 0.3F); + protected static final BiomeGenBase.Height height_HighPlateaus = new BiomeGenBase.Height(1.5F, 0.025F); + protected static final BiomeGenBase.Height height_MidHills = new BiomeGenBase.Height(1.0F, 0.5F); + protected static final BiomeGenBase.Height height_Shores = new BiomeGenBase.Height(0.0F, 0.025F); + protected static final BiomeGenBase.Height height_RockyWaters = new BiomeGenBase.Height(0.1F, 0.8F); + protected static final BiomeGenBase.Height height_LowIslands = new BiomeGenBase.Height(0.2F, 0.3F); + protected static final BiomeGenBase.Height height_PartiallySubmerged = new BiomeGenBase.Height(-0.2F, 0.1F); + + /** An array of all the biomes, indexed by biome id. */ + private static final BiomeGenBase[] biomeList = new BiomeGenBase[256]; + public static final Set explorationBiomesList = Sets.newHashSet(); + public static final Map BIOME_ID_MAP = Maps.newHashMap(); + public static final BiomeGenBase ocean = (new BiomeGenOcean(0)).setColor(112).setBiomeName("Ocean").setHeight(height_Oceans); + public static final BiomeGenBase plains = (new BiomeGenPlains(1)).setColor(9286496).setBiomeName("Plains"); + public static final BiomeGenBase desert = (new BiomeGenDesert(2)).setColor(16421912).setBiomeName("Desert").setDisableRain().setTemperatureRainfall(2.0F, 0.0F).setHeight(height_LowPlains); + public static final BiomeGenBase extremeHills = (new BiomeGenHills(3, false)).setColor(6316128).setBiomeName("Extreme Hills").setHeight(height_MidHills).setTemperatureRainfall(0.2F, 0.3F); + public static final BiomeGenBase forest = (new BiomeGenForest(4, 0)).setColor(353825).setBiomeName("Forest"); + public static final BiomeGenBase taiga = (new BiomeGenTaiga(5, 0)).setColor(747097).setBiomeName("Taiga").setFillerBlockMetadata(5159473).setTemperatureRainfall(0.25F, 0.8F).setHeight(height_MidPlains); + public static final BiomeGenBase swampland = (new BiomeGenSwamp(6)).setColor(522674).setBiomeName("Swampland").setFillerBlockMetadata(9154376).setHeight(height_PartiallySubmerged).setTemperatureRainfall(0.8F, 0.9F); + public static final BiomeGenBase river = (new BiomeGenRiver(7)).setColor(255).setBiomeName("River").setHeight(height_ShallowWaters); + public static final BiomeGenBase hell = (new BiomeGenHell(8)).setColor(16711680).setBiomeName("Hell").setDisableRain().setTemperatureRainfall(2.0F, 0.0F); + + /** Is the biome used for sky world. */ + public static final BiomeGenBase sky = (new BiomeGenEnd(9)).setColor(8421631).setBiomeName("The End").setDisableRain(); + public static final BiomeGenBase frozenOcean = (new BiomeGenOcean(10)).setColor(9474208).setBiomeName("FrozenOcean").setEnableSnow().setHeight(height_Oceans).setTemperatureRainfall(0.0F, 0.5F); + public static final BiomeGenBase frozenRiver = (new BiomeGenRiver(11)).setColor(10526975).setBiomeName("FrozenRiver").setEnableSnow().setHeight(height_ShallowWaters).setTemperatureRainfall(0.0F, 0.5F); + public static final BiomeGenBase icePlains = (new BiomeGenSnow(12, false)).setColor(16777215).setBiomeName("Ice Plains").setEnableSnow().setTemperatureRainfall(0.0F, 0.5F).setHeight(height_LowPlains); + public static final BiomeGenBase iceMountains = (new BiomeGenSnow(13, false)).setColor(10526880).setBiomeName("Ice Mountains").setEnableSnow().setHeight(height_LowHills).setTemperatureRainfall(0.0F, 0.5F); + public static final BiomeGenBase mushroomIsland = (new BiomeGenMushroomIsland(14)).setColor(16711935).setBiomeName("MushroomIsland").setTemperatureRainfall(0.9F, 1.0F).setHeight(height_LowIslands); + public static final BiomeGenBase mushroomIslandShore = (new BiomeGenMushroomIsland(15)).setColor(10486015).setBiomeName("MushroomIslandShore").setTemperatureRainfall(0.9F, 1.0F).setHeight(height_Shores); + + /** Beach biome. */ + public static final BiomeGenBase beach = (new BiomeGenBeach(16)).setColor(16440917).setBiomeName("Beach").setTemperatureRainfall(0.8F, 0.4F).setHeight(height_Shores); + + /** Desert Hills biome. */ + public static final BiomeGenBase desertHills = (new BiomeGenDesert(17)).setColor(13786898).setBiomeName("DesertHills").setDisableRain().setTemperatureRainfall(2.0F, 0.0F).setHeight(height_LowHills); + + /** Forest Hills biome. */ + public static final BiomeGenBase forestHills = (new BiomeGenForest(18, 0)).setColor(2250012).setBiomeName("ForestHills").setHeight(height_LowHills); + + /** Taiga Hills biome. */ + public static final BiomeGenBase taigaHills = (new BiomeGenTaiga(19, 0)).setColor(1456435).setBiomeName("TaigaHills").setFillerBlockMetadata(5159473).setTemperatureRainfall(0.25F, 0.8F).setHeight(height_LowHills); + + /** Extreme Hills Edge biome. */ + public static final BiomeGenBase extremeHillsEdge = (new BiomeGenHills(20, true)).setColor(7501978).setBiomeName("Extreme Hills Edge").setHeight(height_MidHills.attenuate()).setTemperatureRainfall(0.2F, 0.3F); + + /** Jungle biome identifier */ + public static final BiomeGenBase jungle = (new BiomeGenJungle(21, false)).setColor(5470985).setBiomeName("Jungle").setFillerBlockMetadata(5470985).setTemperatureRainfall(0.95F, 0.9F); + public static final BiomeGenBase jungleHills = (new BiomeGenJungle(22, false)).setColor(2900485).setBiomeName("JungleHills").setFillerBlockMetadata(5470985).setTemperatureRainfall(0.95F, 0.9F).setHeight(height_LowHills); + public static final BiomeGenBase jungleEdge = (new BiomeGenJungle(23, true)).setColor(6458135).setBiomeName("JungleEdge").setFillerBlockMetadata(5470985).setTemperatureRainfall(0.95F, 0.8F); + public static final BiomeGenBase deepOcean = (new BiomeGenOcean(24)).setColor(48).setBiomeName("Deep Ocean").setHeight(height_DeepOceans); + public static final BiomeGenBase stoneBeach = (new BiomeGenStoneBeach(25)).setColor(10658436).setBiomeName("Stone Beach").setTemperatureRainfall(0.2F, 0.3F).setHeight(height_RockyWaters); + public static final BiomeGenBase coldBeach = (new BiomeGenBeach(26)).setColor(16445632).setBiomeName("Cold Beach").setTemperatureRainfall(0.05F, 0.3F).setHeight(height_Shores).setEnableSnow(); + public static final BiomeGenBase birchForest = (new BiomeGenForest(27, 2)).setBiomeName("Birch Forest").setColor(3175492); + public static final BiomeGenBase birchForestHills = (new BiomeGenForest(28, 2)).setBiomeName("Birch Forest Hills").setColor(2055986).setHeight(height_LowHills); + public static final BiomeGenBase roofedForest = (new BiomeGenForest(29, 3)).setColor(4215066).setBiomeName("Roofed Forest"); + public static final BiomeGenBase coldTaiga = (new BiomeGenTaiga(30, 0)).setColor(3233098).setBiomeName("Cold Taiga").setFillerBlockMetadata(5159473).setEnableSnow().setTemperatureRainfall(-0.5F, 0.4F).setHeight(height_MidPlains).func_150563_c(16777215); + public static final BiomeGenBase coldTaigaHills = (new BiomeGenTaiga(31, 0)).setColor(2375478).setBiomeName("Cold Taiga Hills").setFillerBlockMetadata(5159473).setEnableSnow().setTemperatureRainfall(-0.5F, 0.4F).setHeight(height_LowHills).func_150563_c(16777215); + public static final BiomeGenBase megaTaiga = (new BiomeGenTaiga(32, 1)).setColor(5858897).setBiomeName("Mega Taiga").setFillerBlockMetadata(5159473).setTemperatureRainfall(0.3F, 0.8F).setHeight(height_MidPlains); + public static final BiomeGenBase megaTaigaHills = (new BiomeGenTaiga(33, 1)).setColor(4542270).setBiomeName("Mega Taiga Hills").setFillerBlockMetadata(5159473).setTemperatureRainfall(0.3F, 0.8F).setHeight(height_LowHills); + public static final BiomeGenBase extremeHillsPlus = (new BiomeGenHills(34, true)).setColor(5271632).setBiomeName("Extreme Hills+").setHeight(height_MidHills).setTemperatureRainfall(0.2F, 0.3F); + public static final BiomeGenBase savanna = (new BiomeGenSavanna(35)).setColor(12431967).setBiomeName("Savanna").setTemperatureRainfall(1.2F, 0.0F).setDisableRain().setHeight(height_LowPlains); + public static final BiomeGenBase savannaPlateau = (new BiomeGenSavanna(36)).setColor(10984804).setBiomeName("Savanna Plateau").setTemperatureRainfall(1.0F, 0.0F).setDisableRain().setHeight(height_HighPlateaus); + public static final BiomeGenBase mesa = (new BiomeGenMesa(37, false, false)).setColor(14238997).setBiomeName("Mesa"); + public static final BiomeGenBase mesaPlateau_F = (new BiomeGenMesa(38, false, true)).setColor(11573093).setBiomeName("Mesa Plateau F").setHeight(height_HighPlateaus); + public static final BiomeGenBase mesaPlateau = (new BiomeGenMesa(39, false, false)).setColor(13274213).setBiomeName("Mesa Plateau").setHeight(height_HighPlateaus); + public static final BiomeGenBase field_180279_ad = ocean; + protected static final NoiseGeneratorPerlin temperatureNoise; + protected static final NoiseGeneratorPerlin GRASS_COLOR_NOISE; + protected static final WorldGenDoublePlant DOUBLE_PLANT_GENERATOR; + public String biomeName; + public int color; + public int field_150609_ah; + + /** The block expected to be on the top of this biome */ + public IBlockState topBlock = Blocks.grass.getDefaultState(); + + /** The block to fill spots in when not on the top */ + public IBlockState fillerBlock = Blocks.dirt.getDefaultState(); + public int fillerBlockMetadata = 5169201; + + /** The minimum height of this biome. Default 0.1. */ + public float minHeight; + + /** The maximum height of this biome. Default 0.3. */ + public float maxHeight; + + /** The temperature of this biome. */ + public float temperature; + + /** The rainfall in this biome. */ + public float rainfall; + + /** Color tint applied to water depending on biome */ + public int waterColorMultiplier; + + /** The biome decorator. */ + public BiomeDecorator theBiomeDecorator; + protected List spawnableMonsterList; + protected List spawnableCreatureList; + protected List spawnableWaterCreatureList; + protected List spawnableCaveCreatureList; + + /** Set to true if snow is enabled for this biome. */ + protected boolean enableSnow; + + /** + * Is true (default) if the biome support rain (desert and nether can't have rain) + */ + protected boolean enableRain; + + /** The id number to this biome, and its index in the biomeList array. */ + public final int biomeID; + + /** The tree generator. */ + protected WorldGenTrees worldGeneratorTrees; + + /** The big tree generator. */ + protected WorldGenBigTree worldGeneratorBigTree; + + /** The swamp tree generator. */ + protected WorldGenSwamp worldGeneratorSwamp; + + protected BiomeGenBase(int id) + { + this.minHeight = height_Default.rootHeight; + this.maxHeight = height_Default.variation; + this.temperature = 0.5F; + this.rainfall = 0.5F; + this.waterColorMultiplier = 16777215; + this.spawnableMonsterList = Lists.newArrayList(); + this.spawnableCreatureList = Lists.newArrayList(); + this.spawnableWaterCreatureList = Lists.newArrayList(); + this.spawnableCaveCreatureList = Lists.newArrayList(); + this.enableRain = true; + this.worldGeneratorTrees = new WorldGenTrees(false); + this.worldGeneratorBigTree = new WorldGenBigTree(false); + this.worldGeneratorSwamp = new WorldGenSwamp(); + this.biomeID = id; + biomeList[id] = this; + this.theBiomeDecorator = this.createBiomeDecorator(); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityRabbit.class, 10, 3, 3)); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityPig.class, 10, 4, 4)); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 10, 4, 4)); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 8, 4, 4)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 100, 4, 4)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityCreeper.class, 100, 4, 4)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySlime.class, 100, 4, 4)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityEnderman.class, 10, 1, 4)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1)); + this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); + this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); + } + + /** + * Allocate a new BiomeDecorator for this BiomeGenBase + */ + protected BiomeDecorator createBiomeDecorator() + { + return new BiomeDecorator(); + } + + /** + * Sets the temperature and rainfall of this biome. + */ + protected BiomeGenBase setTemperatureRainfall(float temperatureIn, float rainfallIn) + { + if (temperatureIn > 0.1F && temperatureIn < 0.2F) + { + throw new IllegalArgumentException("Please avoid temperatures in the range 0.1 - 0.2 because of snow"); + } + else + { + this.temperature = temperatureIn; + this.rainfall = rainfallIn; + return this; + } + } + + protected final BiomeGenBase setHeight(BiomeGenBase.Height heights) + { + this.minHeight = heights.rootHeight; + this.maxHeight = heights.variation; + return this; + } + + /** + * Disable the rain for the biome. + */ + protected BiomeGenBase setDisableRain() + { + this.enableRain = false; + return this; + } + + public WorldGenAbstractTree genBigTreeChance(Random rand) + { + return (WorldGenAbstractTree)(rand.nextInt(10) == 0 ? this.worldGeneratorBigTree : this.worldGeneratorTrees); + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + public WorldGenerator getRandomWorldGenForGrass(Random rand) + { + return new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS); + } + + public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) + { + return rand.nextInt(3) > 0 ? BlockFlower.EnumFlowerType.DANDELION : BlockFlower.EnumFlowerType.POPPY; + } + + /** + * sets enableSnow to true during biome initialization. returns BiomeGenBase. + */ + protected BiomeGenBase setEnableSnow() + { + this.enableSnow = true; + return this; + } + + protected BiomeGenBase setBiomeName(String name) + { + this.biomeName = name; + return this; + } + + protected BiomeGenBase setFillerBlockMetadata(int meta) + { + this.fillerBlockMetadata = meta; + return this; + } + + protected BiomeGenBase setColor(int colorIn) + { + this.func_150557_a(colorIn, false); + return this; + } + + protected BiomeGenBase func_150563_c(int p_150563_1_) + { + this.field_150609_ah = p_150563_1_; + return this; + } + + protected BiomeGenBase func_150557_a(int p_150557_1_, boolean p_150557_2_) + { + this.color = p_150557_1_; + + if (p_150557_2_) + { + this.field_150609_ah = (p_150557_1_ & 16711422) >> 1; + } + else + { + this.field_150609_ah = p_150557_1_; + } + + return this; + } + + /** + * takes temperature, returns color + */ + public int getSkyColorByTemp(float p_76731_1_) + { + p_76731_1_ = p_76731_1_ / 3.0F; + p_76731_1_ = MathHelper.clamp_float(p_76731_1_, -1.0F, 1.0F); + return MathHelper.func_181758_c(0.62222224F - p_76731_1_ * 0.05F, 0.5F + p_76731_1_ * 0.1F, 1.0F); + } + + public List getSpawnableList(EnumCreatureType creatureType) + { + switch (creatureType) + { + case MONSTER: + return this.spawnableMonsterList; + + case CREATURE: + return this.spawnableCreatureList; + + case WATER_CREATURE: + return this.spawnableWaterCreatureList; + + case AMBIENT: + return this.spawnableCaveCreatureList; + + default: + return Collections.emptyList(); + } + } + + /** + * Returns true if the biome have snowfall instead a normal rain. + */ + public boolean getEnableSnow() + { + return this.isSnowyBiome(); + } + + /** + * Return true if the biome supports lightning bolt spawn, either by have the bolts enabled and have rain enabled. + */ + public boolean canSpawnLightningBolt() + { + return this.isSnowyBiome() ? false : this.enableRain; + } + + /** + * Checks to see if the rainfall level of the biome is extremely high + */ + public boolean isHighHumidity() + { + return this.rainfall > 0.85F; + } + + /** + * returns the chance a creature has to spawn. + */ + public float getSpawningChance() + { + return 0.1F; + } + + /** + * Gets an integer representation of this biome's rainfall + */ + public final int getIntRainfall() + { + return (int)(this.rainfall * 65536.0F); + } + + /** + * Gets a floating point representation of this biome's rainfall + */ + public final float getFloatRainfall() + { + return this.rainfall; + } + + /** + * Gets a floating point representation of this biome's temperature + */ + public final float getFloatTemperature(BlockPos pos) + { + if (pos.getY() > 64) + { + float f = (float)(temperatureNoise.func_151601_a((double)pos.getX() * 1.0D / 8.0D, (double)pos.getZ() * 1.0D / 8.0D) * 4.0D); + return this.temperature - (f + (float)pos.getY() - 64.0F) * 0.05F / 30.0F; + } + else + { + return this.temperature; + } + } + + public void decorate(World worldIn, Random rand, BlockPos pos) + { + this.theBiomeDecorator.decorate(worldIn, rand, this, pos); + } + + public int getGrassColorAtPos(BlockPos pos) + { + double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F); + double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); + return ColorizerGrass.getGrassColor(d0, d1); + } + + public int getFoliageColorAtPos(BlockPos pos) + { + double d0 = (double)MathHelper.clamp_float(this.getFloatTemperature(pos), 0.0F, 1.0F); + double d1 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); + return ColorizerFoliage.getFoliageColor(d0, d1); + } + + public boolean isSnowyBiome() + { + return this.enableSnow; + } + + public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) + { + this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_); + } + + public final void generateBiomeTerrain(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180628_4_, int p_180628_5_, double p_180628_6_) + { + int i = worldIn.func_181545_F(); + IBlockState iblockstate = this.topBlock; + IBlockState iblockstate1 = this.fillerBlock; + int j = -1; + int k = (int)(p_180628_6_ / 3.0D + 3.0D + rand.nextDouble() * 0.25D); + int l = p_180628_4_ & 15; + int i1 = p_180628_5_ & 15; + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int j1 = 255; j1 >= 0; --j1) + { + if (j1 <= rand.nextInt(5)) + { + chunkPrimerIn.setBlockState(i1, j1, l, Blocks.bedrock.getDefaultState()); + } + else + { + IBlockState iblockstate2 = chunkPrimerIn.getBlockState(i1, j1, l); + + if (iblockstate2.getBlock().getMaterial() == Material.air) + { + j = -1; + } + else if (iblockstate2.getBlock() == Blocks.stone) + { + if (j == -1) + { + if (k <= 0) + { + iblockstate = null; + iblockstate1 = Blocks.stone.getDefaultState(); + } + else if (j1 >= i - 4 && j1 <= i + 1) + { + iblockstate = this.topBlock; + iblockstate1 = this.fillerBlock; + } + + if (j1 < i && (iblockstate == null || iblockstate.getBlock().getMaterial() == Material.air)) + { + if (this.getFloatTemperature(blockpos$mutableblockpos.func_181079_c(p_180628_4_, j1, p_180628_5_)) < 0.15F) + { + iblockstate = Blocks.ice.getDefaultState(); + } + else + { + iblockstate = Blocks.water.getDefaultState(); + } + } + + j = k; + + if (j1 >= i - 1) + { + chunkPrimerIn.setBlockState(i1, j1, l, iblockstate); + } + else if (j1 < i - 7 - k) + { + iblockstate = null; + iblockstate1 = Blocks.stone.getDefaultState(); + chunkPrimerIn.setBlockState(i1, j1, l, Blocks.gravel.getDefaultState()); + } + else + { + chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1); + } + } + else if (j > 0) + { + --j; + chunkPrimerIn.setBlockState(i1, j1, l, iblockstate1); + + if (j == 0 && iblockstate1.getBlock() == Blocks.sand) + { + j = rand.nextInt(4) + Math.max(0, j1 - 63); + iblockstate1 = iblockstate1.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState(); + } + } + } + } + } + } + + /** + * Creates a mutated version of the biome and places it into the biomeList with an index equal to the original plus + * 128 + */ + protected BiomeGenBase createMutation() + { + return this.createMutatedBiome(this.biomeID + 128); + } + + protected BiomeGenBase createMutatedBiome(int p_180277_1_) + { + return new BiomeGenMutated(p_180277_1_, this); + } + + public Class getBiomeClass() + { + return this.getClass(); + } + + /** + * returns true if the biome specified is equal to this biome + */ + public boolean isEqualTo(BiomeGenBase biome) + { + return biome == this ? true : (biome == null ? false : this.getBiomeClass() == biome.getBiomeClass()); + } + + public BiomeGenBase.TempCategory getTempCategory() + { + return (double)this.temperature < 0.2D ? BiomeGenBase.TempCategory.COLD : ((double)this.temperature < 1.0D ? BiomeGenBase.TempCategory.MEDIUM : BiomeGenBase.TempCategory.WARM); + } + + public static BiomeGenBase[] getBiomeGenArray() + { + return biomeList; + } + + /** + * return the biome specified by biomeID, or 0 (ocean) if out of bounds + */ + public static BiomeGenBase getBiome(int id) + { + return getBiomeFromBiomeList(id, (BiomeGenBase)null); + } + + public static BiomeGenBase getBiomeFromBiomeList(int biomeId, BiomeGenBase biome) + { + if (biomeId >= 0 && biomeId <= biomeList.length) + { + BiomeGenBase biomegenbase = biomeList[biomeId]; + return biomegenbase == null ? biome : biomegenbase; + } + else + { + logger.warn("Biome ID is out of bounds: " + biomeId + ", defaulting to 0 (Ocean)"); + return ocean; + } + } + + static + { + plains.createMutation(); + desert.createMutation(); + forest.createMutation(); + taiga.createMutation(); + swampland.createMutation(); + icePlains.createMutation(); + jungle.createMutation(); + jungleEdge.createMutation(); + coldTaiga.createMutation(); + savanna.createMutation(); + savannaPlateau.createMutation(); + mesa.createMutation(); + mesaPlateau_F.createMutation(); + mesaPlateau.createMutation(); + birchForest.createMutation(); + birchForestHills.createMutation(); + roofedForest.createMutation(); + megaTaiga.createMutation(); + extremeHills.createMutation(); + extremeHillsPlus.createMutation(); + megaTaiga.createMutatedBiome(megaTaigaHills.biomeID + 128).setBiomeName("Redwood Taiga Hills M"); + + for (BiomeGenBase biomegenbase : biomeList) + { + if (biomegenbase != null) + { + if (BIOME_ID_MAP.containsKey(biomegenbase.biomeName)) + { + throw new Error("Biome \"" + biomegenbase.biomeName + "\" is defined as both ID " + ((BiomeGenBase)BIOME_ID_MAP.get(biomegenbase.biomeName)).biomeID + " and " + biomegenbase.biomeID); + } + + BIOME_ID_MAP.put(biomegenbase.biomeName, biomegenbase); + + if (biomegenbase.biomeID < 128) + { + explorationBiomesList.add(biomegenbase); + } + } + } + + explorationBiomesList.remove(hell); + explorationBiomesList.remove(sky); + explorationBiomesList.remove(frozenOcean); + explorationBiomesList.remove(extremeHillsEdge); + temperatureNoise = new NoiseGeneratorPerlin(new Random(1234L), 1); + GRASS_COLOR_NOISE = new NoiseGeneratorPerlin(new Random(2345L), 1); + DOUBLE_PLANT_GENERATOR = new WorldGenDoublePlant(); + } + + public static class Height + { + public float rootHeight; + public float variation; + + public Height(float rootHeightIn, float variationIn) + { + this.rootHeight = rootHeightIn; + this.variation = variationIn; + } + + public BiomeGenBase.Height attenuate() + { + return new BiomeGenBase.Height(this.rootHeight * 0.8F, this.variation * 0.6F); + } + } + + public static class SpawnListEntry extends WeightedRandom.Item + { + public Class entityClass; + public int minGroupCount; + public int maxGroupCount; + + public SpawnListEntry(Class entityclassIn, int weight, int groupCountMin, int groupCountMax) + { + super(weight); + this.entityClass = entityclassIn; + this.minGroupCount = groupCountMin; + this.maxGroupCount = groupCountMax; + } + + public String toString() + { + return this.entityClass.getSimpleName() + "*(" + this.minGroupCount + "-" + this.maxGroupCount + "):" + this.itemWeight; + } + } + + public static enum TempCategory + { + OCEAN, + COLD, + MEDIUM, + WARM; + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenBeach.java b/src/minecraft/net/minecraft/world/biome/BiomeGenBeach.java new file mode 100644 index 0000000..e00ae44 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenBeach.java @@ -0,0 +1,18 @@ +package net.minecraft.world.biome; + +import net.minecraft.init.Blocks; + +public class BiomeGenBeach extends BiomeGenBase +{ + public BiomeGenBeach(int p_i1969_1_) + { + super(p_i1969_1_); + this.spawnableCreatureList.clear(); + this.topBlock = Blocks.sand.getDefaultState(); + this.fillerBlock = Blocks.sand.getDefaultState(); + this.theBiomeDecorator.treesPerChunk = -999; + this.theBiomeDecorator.deadBushPerChunk = 0; + this.theBiomeDecorator.reedsPerChunk = 0; + this.theBiomeDecorator.cactiPerChunk = 0; + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenDesert.java b/src/minecraft/net/minecraft/world/biome/BiomeGenDesert.java new file mode 100644 index 0000000..c978621 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenDesert.java @@ -0,0 +1,36 @@ +package net.minecraft.world.biome; + +import java.util.Random; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenDesertWells; + +public class BiomeGenDesert extends BiomeGenBase +{ + public BiomeGenDesert(int p_i1977_1_) + { + super(p_i1977_1_); + this.spawnableCreatureList.clear(); + this.topBlock = Blocks.sand.getDefaultState(); + this.fillerBlock = Blocks.sand.getDefaultState(); + this.theBiomeDecorator.treesPerChunk = -999; + this.theBiomeDecorator.deadBushPerChunk = 2; + this.theBiomeDecorator.reedsPerChunk = 50; + this.theBiomeDecorator.cactiPerChunk = 10; + this.spawnableCreatureList.clear(); + } + + public void decorate(World worldIn, Random rand, BlockPos pos) + { + super.decorate(worldIn, rand, pos); + + if (rand.nextInt(1000) == 0) + { + int i = rand.nextInt(16) + 8; + int j = rand.nextInt(16) + 8; + BlockPos blockpos = worldIn.getHeight(pos.add(i, 0, j)).up(); + (new WorldGenDesertWells()).generate(worldIn, rand, blockpos); + } + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenEnd.java b/src/minecraft/net/minecraft/world/biome/BiomeGenEnd.java new file mode 100644 index 0000000..8f3d807 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenEnd.java @@ -0,0 +1,28 @@ +package net.minecraft.world.biome; + +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.init.Blocks; + +public class BiomeGenEnd extends BiomeGenBase +{ + public BiomeGenEnd(int p_i1990_1_) + { + super(p_i1990_1_); + this.spawnableMonsterList.clear(); + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + this.spawnableCaveCreatureList.clear(); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityEnderman.class, 10, 4, 4)); + this.topBlock = Blocks.dirt.getDefaultState(); + this.fillerBlock = Blocks.dirt.getDefaultState(); + this.theBiomeDecorator = new BiomeEndDecorator(); + } + + /** + * takes temperature, returns color + */ + public int getSkyColorByTemp(float p_76731_1_) + { + return 0; + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenForest.java b/src/minecraft/net/minecraft/world/biome/BiomeGenForest.java new file mode 100644 index 0000000..c58d7bc --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenForest.java @@ -0,0 +1,201 @@ +package net.minecraft.world.biome; + +import java.util.Random; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.block.BlockFlower; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenBigMushroom; +import net.minecraft.world.gen.feature.WorldGenCanopyTree; +import net.minecraft.world.gen.feature.WorldGenForest; + +public class BiomeGenForest extends BiomeGenBase +{ + private int field_150632_aF; + protected static final WorldGenForest field_150629_aC = new WorldGenForest(false, true); + protected static final WorldGenForest field_150630_aD = new WorldGenForest(false, false); + protected static final WorldGenCanopyTree field_150631_aE = new WorldGenCanopyTree(false); + + public BiomeGenForest(int p_i45377_1_, int p_i45377_2_) + { + super(p_i45377_1_); + this.field_150632_aF = p_i45377_2_; + this.theBiomeDecorator.treesPerChunk = 10; + this.theBiomeDecorator.grassPerChunk = 2; + + if (this.field_150632_aF == 1) + { + this.theBiomeDecorator.treesPerChunk = 6; + this.theBiomeDecorator.flowersPerChunk = 100; + this.theBiomeDecorator.grassPerChunk = 1; + } + + this.setFillerBlockMetadata(5159473); + this.setTemperatureRainfall(0.7F, 0.8F); + + if (this.field_150632_aF == 2) + { + this.field_150609_ah = 353825; + this.color = 3175492; + this.setTemperatureRainfall(0.6F, 0.6F); + } + + if (this.field_150632_aF == 0) + { + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 5, 4, 4)); + } + + if (this.field_150632_aF == 3) + { + this.theBiomeDecorator.treesPerChunk = -999; + } + } + + protected BiomeGenBase func_150557_a(int p_150557_1_, boolean p_150557_2_) + { + if (this.field_150632_aF == 2) + { + this.field_150609_ah = 353825; + this.color = p_150557_1_; + + if (p_150557_2_) + { + this.field_150609_ah = (this.field_150609_ah & 16711422) >> 1; + } + + return this; + } + else + { + return super.func_150557_a(p_150557_1_, p_150557_2_); + } + } + + public WorldGenAbstractTree genBigTreeChance(Random rand) + { + return (WorldGenAbstractTree)(this.field_150632_aF == 3 && rand.nextInt(3) > 0 ? field_150631_aE : (this.field_150632_aF != 2 && rand.nextInt(5) != 0 ? this.worldGeneratorTrees : field_150630_aD)); + } + + public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) + { + if (this.field_150632_aF == 1) + { + double d0 = MathHelper.clamp_double((1.0D + GRASS_COLOR_NOISE.func_151601_a((double)pos.getX() / 48.0D, (double)pos.getZ() / 48.0D)) / 2.0D, 0.0D, 0.9999D); + BlockFlower.EnumFlowerType blockflower$enumflowertype = BlockFlower.EnumFlowerType.values()[(int)(d0 * (double)BlockFlower.EnumFlowerType.values().length)]; + return blockflower$enumflowertype == BlockFlower.EnumFlowerType.BLUE_ORCHID ? BlockFlower.EnumFlowerType.POPPY : blockflower$enumflowertype; + } + else + { + return super.pickRandomFlower(rand, pos); + } + } + + public void decorate(World worldIn, Random rand, BlockPos pos) + { + if (this.field_150632_aF == 3) + { + for (int i = 0; i < 4; ++i) + { + for (int j = 0; j < 4; ++j) + { + int k = i * 4 + 1 + 8 + rand.nextInt(3); + int l = j * 4 + 1 + 8 + rand.nextInt(3); + BlockPos blockpos = worldIn.getHeight(pos.add(k, 0, l)); + + if (rand.nextInt(20) == 0) + { + WorldGenBigMushroom worldgenbigmushroom = new WorldGenBigMushroom(); + worldgenbigmushroom.generate(worldIn, rand, blockpos); + } + else + { + WorldGenAbstractTree worldgenabstracttree = this.genBigTreeChance(rand); + worldgenabstracttree.func_175904_e(); + + if (worldgenabstracttree.generate(worldIn, rand, blockpos)) + { + worldgenabstracttree.func_180711_a(worldIn, rand, blockpos); + } + } + } + } + } + + int j1 = rand.nextInt(5) - 3; + + if (this.field_150632_aF == 1) + { + j1 += 2; + } + + for (int k1 = 0; k1 < j1; ++k1) + { + int l1 = rand.nextInt(3); + + if (l1 == 0) + { + DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.SYRINGA); + } + else if (l1 == 1) + { + DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.ROSE); + } + else if (l1 == 2) + { + DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.PAEONIA); + } + + for (int i2 = 0; i2 < 5; ++i2) + { + int j2 = rand.nextInt(16) + 8; + int k2 = rand.nextInt(16) + 8; + int i1 = rand.nextInt(worldIn.getHeight(pos.add(j2, 0, k2)).getY() + 32); + + if (DOUBLE_PLANT_GENERATOR.generate(worldIn, rand, new BlockPos(pos.getX() + j2, i1, pos.getZ() + k2))) + { + break; + } + } + } + + super.decorate(worldIn, rand, pos); + } + + public int getGrassColorAtPos(BlockPos pos) + { + int i = super.getGrassColorAtPos(pos); + return this.field_150632_aF == 3 ? (i & 16711422) + 2634762 >> 1 : i; + } + + protected BiomeGenBase createMutatedBiome(final int p_180277_1_) + { + if (this.biomeID == BiomeGenBase.forest.biomeID) + { + BiomeGenForest biomegenforest = new BiomeGenForest(p_180277_1_, 1); + biomegenforest.setHeight(new BiomeGenBase.Height(this.minHeight, this.maxHeight + 0.2F)); + biomegenforest.setBiomeName("Flower Forest"); + biomegenforest.func_150557_a(6976549, true); + biomegenforest.setFillerBlockMetadata(8233509); + return biomegenforest; + } + else + { + return this.biomeID != BiomeGenBase.birchForest.biomeID && this.biomeID != BiomeGenBase.birchForestHills.biomeID ? new BiomeGenMutated(p_180277_1_, this) + { + public void decorate(World worldIn, Random rand, BlockPos pos) + { + this.baseBiome.decorate(worldIn, rand, pos); + } + }: new BiomeGenMutated(p_180277_1_, this) + { + public WorldGenAbstractTree genBigTreeChance(Random rand) + { + return rand.nextBoolean() ? BiomeGenForest.field_150629_aC : BiomeGenForest.field_150630_aD; + } + }; + } + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenHell.java b/src/minecraft/net/minecraft/world/biome/BiomeGenHell.java new file mode 100644 index 0000000..c9dfa53 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenHell.java @@ -0,0 +1,20 @@ +package net.minecraft.world.biome; + +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.monster.EntityMagmaCube; +import net.minecraft.entity.monster.EntityPigZombie; + +public class BiomeGenHell extends BiomeGenBase +{ + public BiomeGenHell(int p_i1981_1_) + { + super(p_i1981_1_); + this.spawnableMonsterList.clear(); + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + this.spawnableCaveCreatureList.clear(); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityGhast.class, 50, 4, 4)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 100, 4, 4)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityMagmaCube.class, 1, 4, 4)); + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenHills.java b/src/minecraft/net/minecraft/world/biome/BiomeGenHills.java new file mode 100644 index 0000000..46b889d --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenHills.java @@ -0,0 +1,103 @@ +package net.minecraft.world.biome; + +import java.util.Random; +import net.minecraft.block.BlockSilverfish; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenMinable; +import net.minecraft.world.gen.feature.WorldGenTaiga2; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class BiomeGenHills extends BiomeGenBase +{ + private WorldGenerator theWorldGenerator = new WorldGenMinable(Blocks.monster_egg.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.STONE), 9); + private WorldGenTaiga2 field_150634_aD = new WorldGenTaiga2(false); + private int field_150635_aE = 0; + private int field_150636_aF = 1; + private int field_150637_aG = 2; + private int field_150638_aH; + + protected BiomeGenHills(int p_i45373_1_, boolean p_i45373_2_) + { + super(p_i45373_1_); + this.field_150638_aH = this.field_150635_aE; + + if (p_i45373_2_) + { + this.theBiomeDecorator.treesPerChunk = 3; + this.field_150638_aH = this.field_150636_aF; + } + } + + public WorldGenAbstractTree genBigTreeChance(Random rand) + { + return (WorldGenAbstractTree)(rand.nextInt(3) > 0 ? this.field_150634_aD : super.genBigTreeChance(rand)); + } + + public void decorate(World worldIn, Random rand, BlockPos pos) + { + super.decorate(worldIn, rand, pos); + int i = 3 + rand.nextInt(6); + + for (int j = 0; j < i; ++j) + { + int k = rand.nextInt(16); + int l = rand.nextInt(28) + 4; + int i1 = rand.nextInt(16); + BlockPos blockpos = pos.add(k, l, i1); + + if (worldIn.getBlockState(blockpos).getBlock() == Blocks.stone) + { + worldIn.setBlockState(blockpos, Blocks.emerald_ore.getDefaultState(), 2); + } + } + + for (i = 0; i < 7; ++i) + { + int j1 = rand.nextInt(16); + int k1 = rand.nextInt(64); + int l1 = rand.nextInt(16); + this.theWorldGenerator.generate(worldIn, rand, pos.add(j1, k1, l1)); + } + } + + public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) + { + this.topBlock = Blocks.grass.getDefaultState(); + this.fillerBlock = Blocks.dirt.getDefaultState(); + + if ((p_180622_6_ < -1.0D || p_180622_6_ > 2.0D) && this.field_150638_aH == this.field_150637_aG) + { + this.topBlock = Blocks.gravel.getDefaultState(); + this.fillerBlock = Blocks.gravel.getDefaultState(); + } + else if (p_180622_6_ > 1.0D && this.field_150638_aH != this.field_150636_aF) + { + this.topBlock = Blocks.stone.getDefaultState(); + this.fillerBlock = Blocks.stone.getDefaultState(); + } + + this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_); + } + + /** + * this creates a mutation specific to Hills biomes + */ + private BiomeGenHills mutateHills(BiomeGenBase p_150633_1_) + { + this.field_150638_aH = this.field_150637_aG; + this.func_150557_a(p_150633_1_.color, true); + this.setBiomeName(p_150633_1_.biomeName + " M"); + this.setHeight(new BiomeGenBase.Height(p_150633_1_.minHeight, p_150633_1_.maxHeight)); + this.setTemperatureRainfall(p_150633_1_.temperature, p_150633_1_.rainfall); + return this; + } + + protected BiomeGenBase createMutatedBiome(int p_180277_1_) + { + return (new BiomeGenHills(p_180277_1_, false)).mutateHills(this); + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenJungle.java b/src/minecraft/net/minecraft/world/biome/BiomeGenJungle.java new file mode 100644 index 0000000..c19d0a7 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenJungle.java @@ -0,0 +1,86 @@ +package net.minecraft.world.biome; + +import java.util.Random; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockOldLeaf; +import net.minecraft.block.BlockOldLog; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenMegaJungle; +import net.minecraft.world.gen.feature.WorldGenMelon; +import net.minecraft.world.gen.feature.WorldGenShrub; +import net.minecraft.world.gen.feature.WorldGenTallGrass; +import net.minecraft.world.gen.feature.WorldGenTrees; +import net.minecraft.world.gen.feature.WorldGenVines; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class BiomeGenJungle extends BiomeGenBase +{ + private boolean field_150614_aC; + private static final IBlockState field_181620_aE = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE); + private static final IBlockState field_181621_aF = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + private static final IBlockState field_181622_aG = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + + public BiomeGenJungle(int p_i45379_1_, boolean p_i45379_2_) + { + super(p_i45379_1_); + this.field_150614_aC = p_i45379_2_; + + if (p_i45379_2_) + { + this.theBiomeDecorator.treesPerChunk = 2; + } + else + { + this.theBiomeDecorator.treesPerChunk = 50; + } + + this.theBiomeDecorator.grassPerChunk = 25; + this.theBiomeDecorator.flowersPerChunk = 4; + + if (!p_i45379_2_) + { + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityOcelot.class, 2, 1, 1)); + } + + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 10, 4, 4)); + } + + public WorldGenAbstractTree genBigTreeChance(Random rand) + { + return (WorldGenAbstractTree)(rand.nextInt(10) == 0 ? this.worldGeneratorBigTree : (rand.nextInt(2) == 0 ? new WorldGenShrub(field_181620_aE, field_181622_aG) : (!this.field_150614_aC && rand.nextInt(3) == 0 ? new WorldGenMegaJungle(false, 10, 20, field_181620_aE, field_181621_aF) : new WorldGenTrees(false, 4 + rand.nextInt(7), field_181620_aE, field_181621_aF, true)))); + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + public WorldGenerator getRandomWorldGenForGrass(Random rand) + { + return rand.nextInt(4) == 0 ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS); + } + + public void decorate(World worldIn, Random rand, BlockPos pos) + { + super.decorate(worldIn, rand, pos); + int i = rand.nextInt(16) + 8; + int j = rand.nextInt(16) + 8; + int k = rand.nextInt(worldIn.getHeight(pos.add(i, 0, j)).getY() * 2); + (new WorldGenMelon()).generate(worldIn, rand, pos.add(i, k, j)); + WorldGenVines worldgenvines = new WorldGenVines(); + + for (j = 0; j < 50; ++j) + { + k = rand.nextInt(16) + 8; + int l = 128; + int i1 = rand.nextInt(16) + 8; + worldgenvines.generate(worldIn, rand, pos.add(k, 128, i1)); + } + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenMesa.java b/src/minecraft/net/minecraft/world/biome/BiomeGenMesa.java new file mode 100644 index 0000000..a4cb575 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenMesa.java @@ -0,0 +1,335 @@ +package net.minecraft.world.biome; + +import java.util.Arrays; +import java.util.Random; +import net.minecraft.block.BlockColored; +import net.minecraft.block.BlockDirt; +import net.minecraft.block.BlockSand; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.gen.NoiseGeneratorPerlin; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; + +public class BiomeGenMesa extends BiomeGenBase +{ + private IBlockState[] field_150621_aC; + private long field_150622_aD; + private NoiseGeneratorPerlin field_150623_aE; + private NoiseGeneratorPerlin field_150624_aF; + private NoiseGeneratorPerlin field_150625_aG; + private boolean field_150626_aH; + private boolean field_150620_aI; + + public BiomeGenMesa(int p_i45380_1_, boolean p_i45380_2_, boolean p_i45380_3_) + { + super(p_i45380_1_); + this.field_150626_aH = p_i45380_2_; + this.field_150620_aI = p_i45380_3_; + this.setDisableRain(); + this.setTemperatureRainfall(2.0F, 0.0F); + this.spawnableCreatureList.clear(); + this.topBlock = Blocks.sand.getDefaultState().withProperty(BlockSand.VARIANT, BlockSand.EnumType.RED_SAND); + this.fillerBlock = Blocks.stained_hardened_clay.getDefaultState(); + this.theBiomeDecorator.treesPerChunk = -999; + this.theBiomeDecorator.deadBushPerChunk = 20; + this.theBiomeDecorator.reedsPerChunk = 3; + this.theBiomeDecorator.cactiPerChunk = 5; + this.theBiomeDecorator.flowersPerChunk = 0; + this.spawnableCreatureList.clear(); + + if (p_i45380_3_) + { + this.theBiomeDecorator.treesPerChunk = 5; + } + } + + public WorldGenAbstractTree genBigTreeChance(Random rand) + { + return this.worldGeneratorTrees; + } + + public int getFoliageColorAtPos(BlockPos pos) + { + return 10387789; + } + + public int getGrassColorAtPos(BlockPos pos) + { + return 9470285; + } + + public void decorate(World worldIn, Random rand, BlockPos pos) + { + super.decorate(worldIn, rand, pos); + } + + public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) + { + if (this.field_150621_aC == null || this.field_150622_aD != worldIn.getSeed()) + { + this.func_150619_a(worldIn.getSeed()); + } + + if (this.field_150623_aE == null || this.field_150624_aF == null || this.field_150622_aD != worldIn.getSeed()) + { + Random random = new Random(this.field_150622_aD); + this.field_150623_aE = new NoiseGeneratorPerlin(random, 4); + this.field_150624_aF = new NoiseGeneratorPerlin(random, 1); + } + + this.field_150622_aD = worldIn.getSeed(); + double d4 = 0.0D; + + if (this.field_150626_aH) + { + int i = (p_180622_4_ & -16) + (p_180622_5_ & 15); + int j = (p_180622_5_ & -16) + (p_180622_4_ & 15); + double d0 = Math.min(Math.abs(p_180622_6_), this.field_150623_aE.func_151601_a((double)i * 0.25D, (double)j * 0.25D)); + + if (d0 > 0.0D) + { + double d1 = 0.001953125D; + double d2 = Math.abs(this.field_150624_aF.func_151601_a((double)i * d1, (double)j * d1)); + d4 = d0 * d0 * 2.5D; + double d3 = Math.ceil(d2 * 50.0D) + 14.0D; + + if (d4 > d3) + { + d4 = d3; + } + + d4 = d4 + 64.0D; + } + } + + int j1 = p_180622_4_ & 15; + int k1 = p_180622_5_ & 15; + int l1 = worldIn.func_181545_F(); + IBlockState iblockstate = Blocks.stained_hardened_clay.getDefaultState(); + IBlockState iblockstate3 = this.fillerBlock; + int k = (int)(p_180622_6_ / 3.0D + 3.0D + rand.nextDouble() * 0.25D); + boolean flag = Math.cos(p_180622_6_ / 3.0D * Math.PI) > 0.0D; + int l = -1; + boolean flag1 = false; + + for (int i1 = 255; i1 >= 0; --i1) + { + if (chunkPrimerIn.getBlockState(k1, i1, j1).getBlock().getMaterial() == Material.air && i1 < (int)d4) + { + chunkPrimerIn.setBlockState(k1, i1, j1, Blocks.stone.getDefaultState()); + } + + if (i1 <= rand.nextInt(5)) + { + chunkPrimerIn.setBlockState(k1, i1, j1, Blocks.bedrock.getDefaultState()); + } + else + { + IBlockState iblockstate1 = chunkPrimerIn.getBlockState(k1, i1, j1); + + if (iblockstate1.getBlock().getMaterial() == Material.air) + { + l = -1; + } + else if (iblockstate1.getBlock() == Blocks.stone) + { + if (l == -1) + { + flag1 = false; + + if (k <= 0) + { + iblockstate = null; + iblockstate3 = Blocks.stone.getDefaultState(); + } + else if (i1 >= l1 - 4 && i1 <= l1 + 1) + { + iblockstate = Blocks.stained_hardened_clay.getDefaultState(); + iblockstate3 = this.fillerBlock; + } + + if (i1 < l1 && (iblockstate == null || iblockstate.getBlock().getMaterial() == Material.air)) + { + iblockstate = Blocks.water.getDefaultState(); + } + + l = k + Math.max(0, i1 - l1); + + if (i1 < l1 - 1) + { + chunkPrimerIn.setBlockState(k1, i1, j1, iblockstate3); + + if (iblockstate3.getBlock() == Blocks.stained_hardened_clay) + { + chunkPrimerIn.setBlockState(k1, i1, j1, iblockstate3.getBlock().getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.ORANGE)); + } + } + else if (this.field_150620_aI && i1 > 86 + k * 2) + { + if (flag) + { + chunkPrimerIn.setBlockState(k1, i1, j1, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT)); + } + else + { + chunkPrimerIn.setBlockState(k1, i1, j1, Blocks.grass.getDefaultState()); + } + } + else if (i1 <= l1 + 3 + k) + { + chunkPrimerIn.setBlockState(k1, i1, j1, this.topBlock); + flag1 = true; + } + else + { + IBlockState iblockstate4; + + if (i1 >= 64 && i1 <= 127) + { + if (flag) + { + iblockstate4 = Blocks.hardened_clay.getDefaultState(); + } + else + { + iblockstate4 = this.func_180629_a(p_180622_4_, i1, p_180622_5_); + } + } + else + { + iblockstate4 = Blocks.stained_hardened_clay.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.ORANGE); + } + + chunkPrimerIn.setBlockState(k1, i1, j1, iblockstate4); + } + } + else if (l > 0) + { + --l; + + if (flag1) + { + chunkPrimerIn.setBlockState(k1, i1, j1, Blocks.stained_hardened_clay.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.ORANGE)); + } + else + { + IBlockState iblockstate2 = this.func_180629_a(p_180622_4_, i1, p_180622_5_); + chunkPrimerIn.setBlockState(k1, i1, j1, iblockstate2); + } + } + } + } + } + } + + private void func_150619_a(long p_150619_1_) + { + this.field_150621_aC = new IBlockState[64]; + Arrays.fill(this.field_150621_aC, Blocks.hardened_clay.getDefaultState()); + Random random = new Random(p_150619_1_); + this.field_150625_aG = new NoiseGeneratorPerlin(random, 1); + + for (int l1 = 0; l1 < 64; ++l1) + { + l1 += random.nextInt(5) + 1; + + if (l1 < 64) + { + this.field_150621_aC[l1] = Blocks.stained_hardened_clay.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.ORANGE); + } + } + + int i2 = random.nextInt(4) + 2; + + for (int i = 0; i < i2; ++i) + { + int j = random.nextInt(3) + 1; + int k = random.nextInt(64); + + for (int l = 0; k + l < 64 && l < j; ++l) + { + this.field_150621_aC[k + l] = Blocks.stained_hardened_clay.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.YELLOW); + } + } + + int j2 = random.nextInt(4) + 2; + + for (int k2 = 0; k2 < j2; ++k2) + { + int i3 = random.nextInt(3) + 2; + int l3 = random.nextInt(64); + + for (int i1 = 0; l3 + i1 < 64 && i1 < i3; ++i1) + { + this.field_150621_aC[l3 + i1] = Blocks.stained_hardened_clay.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.BROWN); + } + } + + int l2 = random.nextInt(4) + 2; + + for (int j3 = 0; j3 < l2; ++j3) + { + int i4 = random.nextInt(3) + 1; + int k4 = random.nextInt(64); + + for (int j1 = 0; k4 + j1 < 64 && j1 < i4; ++j1) + { + this.field_150621_aC[k4 + j1] = Blocks.stained_hardened_clay.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.RED); + } + } + + int k3 = random.nextInt(3) + 3; + int j4 = 0; + + for (int l4 = 0; l4 < k3; ++l4) + { + int i5 = 1; + j4 += random.nextInt(16) + 4; + + for (int k1 = 0; j4 + k1 < 64 && k1 < i5; ++k1) + { + this.field_150621_aC[j4 + k1] = Blocks.stained_hardened_clay.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.WHITE); + + if (j4 + k1 > 1 && random.nextBoolean()) + { + this.field_150621_aC[j4 + k1 - 1] = Blocks.stained_hardened_clay.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.SILVER); + } + + if (j4 + k1 < 63 && random.nextBoolean()) + { + this.field_150621_aC[j4 + k1 + 1] = Blocks.stained_hardened_clay.getDefaultState().withProperty(BlockColored.COLOR, EnumDyeColor.SILVER); + } + } + } + } + + private IBlockState func_180629_a(int p_180629_1_, int p_180629_2_, int p_180629_3_) + { + int i = (int)Math.round(this.field_150625_aG.func_151601_a((double)p_180629_1_ * 1.0D / 512.0D, (double)p_180629_1_ * 1.0D / 512.0D) * 2.0D); + return this.field_150621_aC[(p_180629_2_ + i + 64) % 64]; + } + + protected BiomeGenBase createMutatedBiome(int p_180277_1_) + { + boolean flag = this.biomeID == BiomeGenBase.mesa.biomeID; + BiomeGenMesa biomegenmesa = new BiomeGenMesa(p_180277_1_, flag, this.field_150620_aI); + + if (!flag) + { + biomegenmesa.setHeight(height_LowHills); + biomegenmesa.setBiomeName(this.biomeName + " M"); + } + else + { + biomegenmesa.setBiomeName(this.biomeName + " (Bryce)"); + } + + biomegenmesa.func_150557_a(this.color, true); + return biomegenmesa; + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenMushroomIsland.java b/src/minecraft/net/minecraft/world/biome/BiomeGenMushroomIsland.java new file mode 100644 index 0000000..5dc3a6e --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenMushroomIsland.java @@ -0,0 +1,22 @@ +package net.minecraft.world.biome; + +import net.minecraft.entity.passive.EntityMooshroom; +import net.minecraft.init.Blocks; + +public class BiomeGenMushroomIsland extends BiomeGenBase +{ + public BiomeGenMushroomIsland(int p_i1984_1_) + { + super(p_i1984_1_); + this.theBiomeDecorator.treesPerChunk = -100; + this.theBiomeDecorator.flowersPerChunk = -100; + this.theBiomeDecorator.grassPerChunk = -100; + this.theBiomeDecorator.mushroomsPerChunk = 1; + this.theBiomeDecorator.bigMushroomsPerChunk = 1; + this.topBlock = Blocks.mycelium.getDefaultState(); + this.spawnableMonsterList.clear(); + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityMooshroom.class, 8, 4, 8)); + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenMutated.java b/src/minecraft/net/minecraft/world/biome/BiomeGenMutated.java new file mode 100644 index 0000000..ae8a23e --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenMutated.java @@ -0,0 +1,90 @@ +package net.minecraft.world.biome; + +import com.google.common.collect.Lists; +import java.util.Random; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; + +public class BiomeGenMutated extends BiomeGenBase +{ + protected BiomeGenBase baseBiome; + + public BiomeGenMutated(int id, BiomeGenBase biome) + { + super(id); + this.baseBiome = biome; + this.func_150557_a(biome.color, true); + this.biomeName = biome.biomeName + " M"; + this.topBlock = biome.topBlock; + this.fillerBlock = biome.fillerBlock; + this.fillerBlockMetadata = biome.fillerBlockMetadata; + this.minHeight = biome.minHeight; + this.maxHeight = biome.maxHeight; + this.temperature = biome.temperature; + this.rainfall = biome.rainfall; + this.waterColorMultiplier = biome.waterColorMultiplier; + this.enableSnow = biome.enableSnow; + this.enableRain = biome.enableRain; + this.spawnableCreatureList = Lists.newArrayList(biome.spawnableCreatureList); + this.spawnableMonsterList = Lists.newArrayList(biome.spawnableMonsterList); + this.spawnableCaveCreatureList = Lists.newArrayList(biome.spawnableCaveCreatureList); + this.spawnableWaterCreatureList = Lists.newArrayList(biome.spawnableWaterCreatureList); + this.temperature = biome.temperature; + this.rainfall = biome.rainfall; + this.minHeight = biome.minHeight + 0.1F; + this.maxHeight = biome.maxHeight + 0.2F; + } + + public void decorate(World worldIn, Random rand, BlockPos pos) + { + this.baseBiome.theBiomeDecorator.decorate(worldIn, rand, this, pos); + } + + public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) + { + this.baseBiome.genTerrainBlocks(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_); + } + + /** + * returns the chance a creature has to spawn. + */ + public float getSpawningChance() + { + return this.baseBiome.getSpawningChance(); + } + + public WorldGenAbstractTree genBigTreeChance(Random rand) + { + return this.baseBiome.genBigTreeChance(rand); + } + + public int getFoliageColorAtPos(BlockPos pos) + { + return this.baseBiome.getFoliageColorAtPos(pos); + } + + public int getGrassColorAtPos(BlockPos pos) + { + return this.baseBiome.getGrassColorAtPos(pos); + } + + public Class getBiomeClass() + { + return this.baseBiome.getBiomeClass(); + } + + /** + * returns true if the biome specified is equal to this biome + */ + public boolean isEqualTo(BiomeGenBase biome) + { + return this.baseBiome.isEqualTo(biome); + } + + public BiomeGenBase.TempCategory getTempCategory() + { + return this.baseBiome.getTempCategory(); + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenOcean.java b/src/minecraft/net/minecraft/world/biome/BiomeGenOcean.java new file mode 100644 index 0000000..c3ebfd0 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenOcean.java @@ -0,0 +1,24 @@ +package net.minecraft.world.biome; + +import java.util.Random; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; + +public class BiomeGenOcean extends BiomeGenBase +{ + public BiomeGenOcean(int p_i1985_1_) + { + super(p_i1985_1_); + this.spawnableCreatureList.clear(); + } + + public BiomeGenBase.TempCategory getTempCategory() + { + return BiomeGenBase.TempCategory.OCEAN; + } + + public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) + { + super.genTerrainBlocks(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_); + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenPlains.java b/src/minecraft/net/minecraft/world/biome/BiomeGenPlains.java new file mode 100644 index 0000000..647889e --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenPlains.java @@ -0,0 +1,109 @@ +package net.minecraft.world.biome; + +import java.util.Random; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.block.BlockFlower; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class BiomeGenPlains extends BiomeGenBase +{ + protected boolean field_150628_aC; + + protected BiomeGenPlains(int p_i1986_1_) + { + super(p_i1986_1_); + this.setTemperatureRainfall(0.8F, 0.4F); + this.setHeight(height_LowPlains); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityHorse.class, 5, 2, 6)); + this.theBiomeDecorator.treesPerChunk = -999; + this.theBiomeDecorator.flowersPerChunk = 4; + this.theBiomeDecorator.grassPerChunk = 10; + } + + public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) + { + double d0 = GRASS_COLOR_NOISE.func_151601_a((double)pos.getX() / 200.0D, (double)pos.getZ() / 200.0D); + + if (d0 < -0.8D) + { + int j = rand.nextInt(4); + + switch (j) + { + case 0: + return BlockFlower.EnumFlowerType.ORANGE_TULIP; + + case 1: + return BlockFlower.EnumFlowerType.RED_TULIP; + + case 2: + return BlockFlower.EnumFlowerType.PINK_TULIP; + + case 3: + default: + return BlockFlower.EnumFlowerType.WHITE_TULIP; + } + } + else if (rand.nextInt(3) > 0) + { + int i = rand.nextInt(3); + return i == 0 ? BlockFlower.EnumFlowerType.POPPY : (i == 1 ? BlockFlower.EnumFlowerType.HOUSTONIA : BlockFlower.EnumFlowerType.OXEYE_DAISY); + } + else + { + return BlockFlower.EnumFlowerType.DANDELION; + } + } + + public void decorate(World worldIn, Random rand, BlockPos pos) + { + double d0 = GRASS_COLOR_NOISE.func_151601_a((double)(pos.getX() + 8) / 200.0D, (double)(pos.getZ() + 8) / 200.0D); + + if (d0 < -0.8D) + { + this.theBiomeDecorator.flowersPerChunk = 15; + this.theBiomeDecorator.grassPerChunk = 5; + } + else + { + this.theBiomeDecorator.flowersPerChunk = 4; + this.theBiomeDecorator.grassPerChunk = 10; + DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.GRASS); + + for (int i = 0; i < 7; ++i) + { + int j = rand.nextInt(16) + 8; + int k = rand.nextInt(16) + 8; + int l = rand.nextInt(worldIn.getHeight(pos.add(j, 0, k)).getY() + 32); + DOUBLE_PLANT_GENERATOR.generate(worldIn, rand, pos.add(j, l, k)); + } + } + + if (this.field_150628_aC) + { + DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.SUNFLOWER); + + for (int i1 = 0; i1 < 10; ++i1) + { + int j1 = rand.nextInt(16) + 8; + int k1 = rand.nextInt(16) + 8; + int l1 = rand.nextInt(worldIn.getHeight(pos.add(j1, 0, k1)).getY() + 32); + DOUBLE_PLANT_GENERATOR.generate(worldIn, rand, pos.add(j1, l1, k1)); + } + } + + super.decorate(worldIn, rand, pos); + } + + protected BiomeGenBase createMutatedBiome(int p_180277_1_) + { + BiomeGenPlains biomegenplains = new BiomeGenPlains(p_180277_1_); + biomegenplains.setBiomeName("Sunflower Plains"); + biomegenplains.field_150628_aC = true; + biomegenplains.setColor(9286496); + biomegenplains.field_150609_ah = 14273354; + return biomegenplains; + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenRiver.java b/src/minecraft/net/minecraft/world/biome/BiomeGenRiver.java new file mode 100644 index 0000000..430af57 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenRiver.java @@ -0,0 +1,10 @@ +package net.minecraft.world.biome; + +public class BiomeGenRiver extends BiomeGenBase +{ + public BiomeGenRiver(int p_i1987_1_) + { + super(p_i1987_1_); + this.spawnableCreatureList.clear(); + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenSavanna.java b/src/minecraft/net/minecraft/world/biome/BiomeGenSavanna.java new file mode 100644 index 0000000..a12246c --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenSavanna.java @@ -0,0 +1,89 @@ +package net.minecraft.world.biome; + +import java.util.Random; +import net.minecraft.block.BlockDirt; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.entity.passive.EntityHorse; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenSavannaTree; + +public class BiomeGenSavanna extends BiomeGenBase +{ + private static final WorldGenSavannaTree field_150627_aC = new WorldGenSavannaTree(false); + + protected BiomeGenSavanna(int p_i45383_1_) + { + super(p_i45383_1_); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityHorse.class, 1, 2, 6)); + this.theBiomeDecorator.treesPerChunk = 1; + this.theBiomeDecorator.flowersPerChunk = 4; + this.theBiomeDecorator.grassPerChunk = 20; + } + + public WorldGenAbstractTree genBigTreeChance(Random rand) + { + return (WorldGenAbstractTree)(rand.nextInt(5) > 0 ? field_150627_aC : this.worldGeneratorTrees); + } + + protected BiomeGenBase createMutatedBiome(int p_180277_1_) + { + BiomeGenBase biomegenbase = new BiomeGenSavanna.Mutated(p_180277_1_, this); + biomegenbase.temperature = (this.temperature + 1.0F) * 0.5F; + biomegenbase.minHeight = this.minHeight * 0.5F + 0.3F; + biomegenbase.maxHeight = this.maxHeight * 0.5F + 1.2F; + return biomegenbase; + } + + public void decorate(World worldIn, Random rand, BlockPos pos) + { + DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.GRASS); + + for (int i = 0; i < 7; ++i) + { + int j = rand.nextInt(16) + 8; + int k = rand.nextInt(16) + 8; + int l = rand.nextInt(worldIn.getHeight(pos.add(j, 0, k)).getY() + 32); + DOUBLE_PLANT_GENERATOR.generate(worldIn, rand, pos.add(j, l, k)); + } + + super.decorate(worldIn, rand, pos); + } + + public static class Mutated extends BiomeGenMutated + { + public Mutated(int p_i45382_1_, BiomeGenBase p_i45382_2_) + { + super(p_i45382_1_, p_i45382_2_); + this.theBiomeDecorator.treesPerChunk = 2; + this.theBiomeDecorator.flowersPerChunk = 2; + this.theBiomeDecorator.grassPerChunk = 5; + } + + public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) + { + this.topBlock = Blocks.grass.getDefaultState(); + this.fillerBlock = Blocks.dirt.getDefaultState(); + + if (p_180622_6_ > 1.75D) + { + this.topBlock = Blocks.stone.getDefaultState(); + this.fillerBlock = Blocks.stone.getDefaultState(); + } + else if (p_180622_6_ > -0.5D) + { + this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT); + } + + this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_); + } + + public void decorate(World worldIn, Random rand, BlockPos pos) + { + this.theBiomeDecorator.decorate(worldIn, rand, this, pos); + } + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenSnow.java b/src/minecraft/net/minecraft/world/biome/BiomeGenSnow.java new file mode 100644 index 0000000..5a50b68 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenSnow.java @@ -0,0 +1,65 @@ +package net.minecraft.world.biome; + +import java.util.Random; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenIcePath; +import net.minecraft.world.gen.feature.WorldGenIceSpike; +import net.minecraft.world.gen.feature.WorldGenTaiga2; + +public class BiomeGenSnow extends BiomeGenBase +{ + private boolean field_150615_aC; + private WorldGenIceSpike field_150616_aD = new WorldGenIceSpike(); + private WorldGenIcePath field_150617_aE = new WorldGenIcePath(4); + + public BiomeGenSnow(int p_i45378_1_, boolean p_i45378_2_) + { + super(p_i45378_1_); + this.field_150615_aC = p_i45378_2_; + + if (p_i45378_2_) + { + this.topBlock = Blocks.snow.getDefaultState(); + } + + this.spawnableCreatureList.clear(); + } + + public void decorate(World worldIn, Random rand, BlockPos pos) + { + if (this.field_150615_aC) + { + for (int i = 0; i < 3; ++i) + { + int j = rand.nextInt(16) + 8; + int k = rand.nextInt(16) + 8; + this.field_150616_aD.generate(worldIn, rand, worldIn.getHeight(pos.add(j, 0, k))); + } + + for (int l = 0; l < 2; ++l) + { + int i1 = rand.nextInt(16) + 8; + int j1 = rand.nextInt(16) + 8; + this.field_150617_aE.generate(worldIn, rand, worldIn.getHeight(pos.add(i1, 0, j1))); + } + } + + super.decorate(worldIn, rand, pos); + } + + public WorldGenAbstractTree genBigTreeChance(Random rand) + { + return new WorldGenTaiga2(false); + } + + protected BiomeGenBase createMutatedBiome(int p_180277_1_) + { + BiomeGenBase biomegenbase = (new BiomeGenSnow(p_180277_1_, true)).func_150557_a(13828095, true).setBiomeName(this.biomeName + " Spikes").setEnableSnow().setTemperatureRainfall(0.0F, 0.5F).setHeight(new BiomeGenBase.Height(this.minHeight + 0.1F, this.maxHeight + 0.1F)); + biomegenbase.minHeight = this.minHeight + 0.3F; + biomegenbase.maxHeight = this.maxHeight + 0.4F; + return biomegenbase; + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenStoneBeach.java b/src/minecraft/net/minecraft/world/biome/BiomeGenStoneBeach.java new file mode 100644 index 0000000..55a0278 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenStoneBeach.java @@ -0,0 +1,18 @@ +package net.minecraft.world.biome; + +import net.minecraft.init.Blocks; + +public class BiomeGenStoneBeach extends BiomeGenBase +{ + public BiomeGenStoneBeach(int p_i45384_1_) + { + super(p_i45384_1_); + this.spawnableCreatureList.clear(); + this.topBlock = Blocks.stone.getDefaultState(); + this.fillerBlock = Blocks.stone.getDefaultState(); + this.theBiomeDecorator.treesPerChunk = -999; + this.theBiomeDecorator.deadBushPerChunk = 0; + this.theBiomeDecorator.reedsPerChunk = 0; + this.theBiomeDecorator.cactiPerChunk = 0; + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java b/src/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java new file mode 100644 index 0000000..f0170da --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenSwamp.java @@ -0,0 +1,83 @@ +package net.minecraft.world.biome; + +import java.util.Random; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.material.Material; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; + +public class BiomeGenSwamp extends BiomeGenBase +{ + protected BiomeGenSwamp(int p_i1988_1_) + { + super(p_i1988_1_); + this.theBiomeDecorator.treesPerChunk = 2; + this.theBiomeDecorator.flowersPerChunk = 1; + this.theBiomeDecorator.deadBushPerChunk = 1; + this.theBiomeDecorator.mushroomsPerChunk = 8; + this.theBiomeDecorator.reedsPerChunk = 10; + this.theBiomeDecorator.clayPerChunk = 1; + this.theBiomeDecorator.waterlilyPerChunk = 4; + this.theBiomeDecorator.sandPerChunk2 = 0; + this.theBiomeDecorator.sandPerChunk = 0; + this.theBiomeDecorator.grassPerChunk = 5; + this.waterColorMultiplier = 14745518; + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySlime.class, 1, 1, 1)); + } + + public WorldGenAbstractTree genBigTreeChance(Random rand) + { + return this.worldGeneratorSwamp; + } + + public int getGrassColorAtPos(BlockPos pos) + { + double d0 = GRASS_COLOR_NOISE.func_151601_a((double)pos.getX() * 0.0225D, (double)pos.getZ() * 0.0225D); + return d0 < -0.1D ? 5011004 : 6975545; + } + + public int getFoliageColorAtPos(BlockPos pos) + { + return 6975545; + } + + public BlockFlower.EnumFlowerType pickRandomFlower(Random rand, BlockPos pos) + { + return BlockFlower.EnumFlowerType.BLUE_ORCHID; + } + + public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) + { + double d0 = GRASS_COLOR_NOISE.func_151601_a((double)p_180622_4_ * 0.25D, (double)p_180622_5_ * 0.25D); + + if (d0 > 0.0D) + { + int i = p_180622_4_ & 15; + int j = p_180622_5_ & 15; + + for (int k = 255; k >= 0; --k) + { + if (chunkPrimerIn.getBlockState(j, k, i).getBlock().getMaterial() != Material.air) + { + if (k == 62 && chunkPrimerIn.getBlockState(j, k, i).getBlock() != Blocks.water) + { + chunkPrimerIn.setBlockState(j, k, i, Blocks.water.getDefaultState()); + + if (d0 < 0.12D) + { + chunkPrimerIn.setBlockState(j, k + 1, i, Blocks.waterlily.getDefaultState()); + } + } + + break; + } + } + } + + this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_); + } +} diff --git a/src/minecraft/net/minecraft/world/biome/BiomeGenTaiga.java b/src/minecraft/net/minecraft/world/biome/BiomeGenTaiga.java new file mode 100644 index 0000000..1efe3d6 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/BiomeGenTaiga.java @@ -0,0 +1,114 @@ +package net.minecraft.world.biome; + +import java.util.Random; +import net.minecraft.block.BlockDirt; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.entity.passive.EntityWolf; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenBlockBlob; +import net.minecraft.world.gen.feature.WorldGenMegaPineTree; +import net.minecraft.world.gen.feature.WorldGenTaiga1; +import net.minecraft.world.gen.feature.WorldGenTaiga2; +import net.minecraft.world.gen.feature.WorldGenTallGrass; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class BiomeGenTaiga extends BiomeGenBase +{ + private static final WorldGenTaiga1 field_150639_aC = new WorldGenTaiga1(); + private static final WorldGenTaiga2 field_150640_aD = new WorldGenTaiga2(false); + private static final WorldGenMegaPineTree field_150641_aE = new WorldGenMegaPineTree(false, false); + private static final WorldGenMegaPineTree field_150642_aF = new WorldGenMegaPineTree(false, true); + private static final WorldGenBlockBlob field_150643_aG = new WorldGenBlockBlob(Blocks.mossy_cobblestone, 0); + private int field_150644_aH; + + public BiomeGenTaiga(int p_i45385_1_, int p_i45385_2_) + { + super(p_i45385_1_); + this.field_150644_aH = p_i45385_2_; + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 8, 4, 4)); + this.theBiomeDecorator.treesPerChunk = 10; + + if (p_i45385_2_ != 1 && p_i45385_2_ != 2) + { + this.theBiomeDecorator.grassPerChunk = 1; + this.theBiomeDecorator.mushroomsPerChunk = 1; + } + else + { + this.theBiomeDecorator.grassPerChunk = 7; + this.theBiomeDecorator.deadBushPerChunk = 1; + this.theBiomeDecorator.mushroomsPerChunk = 3; + } + } + + public WorldGenAbstractTree genBigTreeChance(Random rand) + { + return (WorldGenAbstractTree)((this.field_150644_aH == 1 || this.field_150644_aH == 2) && rand.nextInt(3) == 0 ? (this.field_150644_aH != 2 && rand.nextInt(13) != 0 ? field_150641_aE : field_150642_aF) : (rand.nextInt(3) == 0 ? field_150639_aC : field_150640_aD)); + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + public WorldGenerator getRandomWorldGenForGrass(Random rand) + { + return rand.nextInt(5) > 0 ? new WorldGenTallGrass(BlockTallGrass.EnumType.FERN) : new WorldGenTallGrass(BlockTallGrass.EnumType.GRASS); + } + + public void decorate(World worldIn, Random rand, BlockPos pos) + { + if (this.field_150644_aH == 1 || this.field_150644_aH == 2) + { + int i = rand.nextInt(3); + + for (int j = 0; j < i; ++j) + { + int k = rand.nextInt(16) + 8; + int l = rand.nextInt(16) + 8; + BlockPos blockpos = worldIn.getHeight(pos.add(k, 0, l)); + field_150643_aG.generate(worldIn, rand, blockpos); + } + } + + DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.FERN); + + for (int i1 = 0; i1 < 7; ++i1) + { + int j1 = rand.nextInt(16) + 8; + int k1 = rand.nextInt(16) + 8; + int l1 = rand.nextInt(worldIn.getHeight(pos.add(j1, 0, k1)).getY() + 32); + DOUBLE_PLANT_GENERATOR.generate(worldIn, rand, pos.add(j1, l1, k1)); + } + + super.decorate(worldIn, rand, pos); + } + + public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int p_180622_4_, int p_180622_5_, double p_180622_6_) + { + if (this.field_150644_aH == 1 || this.field_150644_aH == 2) + { + this.topBlock = Blocks.grass.getDefaultState(); + this.fillerBlock = Blocks.dirt.getDefaultState(); + + if (p_180622_6_ > 1.75D) + { + this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.COARSE_DIRT); + } + else if (p_180622_6_ > -0.95D) + { + this.topBlock = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL); + } + } + + this.generateBiomeTerrain(worldIn, rand, chunkPrimerIn, p_180622_4_, p_180622_5_, p_180622_6_); + } + + protected BiomeGenBase createMutatedBiome(int p_180277_1_) + { + return this.biomeID == BiomeGenBase.megaTaiga.biomeID ? (new BiomeGenTaiga(p_180277_1_, 2)).func_150557_a(5858897, true).setBiomeName("Mega Spruce Taiga").setFillerBlockMetadata(5159473).setTemperatureRainfall(0.25F, 0.8F).setHeight(new BiomeGenBase.Height(this.minHeight, this.maxHeight)) : super.createMutatedBiome(p_180277_1_); + } +} diff --git a/src/minecraft/net/minecraft/world/biome/WorldChunkManager.java b/src/minecraft/net/minecraft/world/biome/WorldChunkManager.java new file mode 100644 index 0000000..97e7776 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/WorldChunkManager.java @@ -0,0 +1,279 @@ +package net.minecraft.world.biome; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Random; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ReportedException; +import net.minecraft.world.World; +import net.minecraft.world.WorldType; +import net.minecraft.world.gen.layer.GenLayer; +import net.minecraft.world.gen.layer.IntCache; + +public class WorldChunkManager +{ + private GenLayer genBiomes; + + /** A GenLayer containing the indices into BiomeGenBase.biomeList[] */ + private GenLayer biomeIndexLayer; + + /** The biome list. */ + private BiomeCache biomeCache; + private List biomesToSpawnIn; + private String field_180301_f; + + protected WorldChunkManager() + { + this.biomeCache = new BiomeCache(this); + this.field_180301_f = ""; + this.biomesToSpawnIn = Lists.newArrayList(); + this.biomesToSpawnIn.add(BiomeGenBase.forest); + this.biomesToSpawnIn.add(BiomeGenBase.plains); + this.biomesToSpawnIn.add(BiomeGenBase.taiga); + this.biomesToSpawnIn.add(BiomeGenBase.taigaHills); + this.biomesToSpawnIn.add(BiomeGenBase.forestHills); + this.biomesToSpawnIn.add(BiomeGenBase.jungle); + this.biomesToSpawnIn.add(BiomeGenBase.jungleHills); + } + + public WorldChunkManager(long seed, WorldType p_i45744_3_, String p_i45744_4_) + { + this(); + this.field_180301_f = p_i45744_4_; + GenLayer[] agenlayer = GenLayer.initializeAllBiomeGenerators(seed, p_i45744_3_, p_i45744_4_); + this.genBiomes = agenlayer[0]; + this.biomeIndexLayer = agenlayer[1]; + } + + public WorldChunkManager(World worldIn) + { + this(worldIn.getSeed(), worldIn.getWorldInfo().getTerrainType(), worldIn.getWorldInfo().getGeneratorOptions()); + } + + public List getBiomesToSpawnIn() + { + return this.biomesToSpawnIn; + } + + /** + * Returns the biome generator + */ + public BiomeGenBase getBiomeGenerator(BlockPos pos) + { + return this.getBiomeGenerator(pos, (BiomeGenBase)null); + } + + public BiomeGenBase getBiomeGenerator(BlockPos pos, BiomeGenBase biomeGenBaseIn) + { + return this.biomeCache.func_180284_a(pos.getX(), pos.getZ(), biomeGenBaseIn); + } + + /** + * Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length. + */ + public float[] getRainfall(float[] listToReuse, int x, int z, int width, int length) + { + IntCache.resetIntCache(); + + if (listToReuse == null || listToReuse.length < width * length) + { + listToReuse = new float[width * length]; + } + + int[] aint = this.biomeIndexLayer.getInts(x, z, width, length); + + for (int i = 0; i < width * length; ++i) + { + try + { + float f = (float)BiomeGenBase.getBiomeFromBiomeList(aint[i], BiomeGenBase.field_180279_ad).getIntRainfall() / 65536.0F; + + if (f > 1.0F) + { + f = 1.0F; + } + + listToReuse[i] = f; + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("DownfallBlock"); + crashreportcategory.addCrashSection("biome id", Integer.valueOf(i)); + crashreportcategory.addCrashSection("downfalls[] size", Integer.valueOf(listToReuse.length)); + crashreportcategory.addCrashSection("x", Integer.valueOf(x)); + crashreportcategory.addCrashSection("z", Integer.valueOf(z)); + crashreportcategory.addCrashSection("w", Integer.valueOf(width)); + crashreportcategory.addCrashSection("h", Integer.valueOf(length)); + throw new ReportedException(crashreport); + } + } + + return listToReuse; + } + + /** + * Return an adjusted version of a given temperature based on the y height + */ + public float getTemperatureAtHeight(float p_76939_1_, int p_76939_2_) + { + return p_76939_1_; + } + + /** + * Returns an array of biomes for the location input. + */ + public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] biomes, int x, int z, int width, int height) + { + IntCache.resetIntCache(); + + if (biomes == null || biomes.length < width * height) + { + biomes = new BiomeGenBase[width * height]; + } + + int[] aint = this.genBiomes.getInts(x, z, width, height); + + try + { + for (int i = 0; i < width * height; ++i) + { + biomes[i] = BiomeGenBase.getBiomeFromBiomeList(aint[i], BiomeGenBase.field_180279_ad); + } + + return biomes; + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("RawBiomeBlock"); + crashreportcategory.addCrashSection("biomes[] size", Integer.valueOf(biomes.length)); + crashreportcategory.addCrashSection("x", Integer.valueOf(x)); + crashreportcategory.addCrashSection("z", Integer.valueOf(z)); + crashreportcategory.addCrashSection("w", Integer.valueOf(width)); + crashreportcategory.addCrashSection("h", Integer.valueOf(height)); + throw new ReportedException(crashreport); + } + } + + /** + * Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the + * WorldChunkManager Args: oldBiomeList, x, z, width, depth + */ + public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] oldBiomeList, int x, int z, int width, int depth) + { + return this.getBiomeGenAt(oldBiomeList, x, z, width, depth, true); + } + + /** + * Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false, + * don't check biomeCache to avoid infinite loop in BiomeCacheBlock) + */ + public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int z, int width, int length, boolean cacheFlag) + { + IntCache.resetIntCache(); + + if (listToReuse == null || listToReuse.length < width * length) + { + listToReuse = new BiomeGenBase[width * length]; + } + + if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0) + { + BiomeGenBase[] abiomegenbase = this.biomeCache.getCachedBiomes(x, z); + System.arraycopy(abiomegenbase, 0, listToReuse, 0, width * length); + return listToReuse; + } + else + { + int[] aint = this.biomeIndexLayer.getInts(x, z, width, length); + + for (int i = 0; i < width * length; ++i) + { + listToReuse[i] = BiomeGenBase.getBiomeFromBiomeList(aint[i], BiomeGenBase.field_180279_ad); + } + + return listToReuse; + } + } + + /** + * checks given Chunk's Biomes against List of allowed ones + */ + public boolean areBiomesViable(int p_76940_1_, int p_76940_2_, int p_76940_3_, List p_76940_4_) + { + IntCache.resetIntCache(); + int i = p_76940_1_ - p_76940_3_ >> 2; + int j = p_76940_2_ - p_76940_3_ >> 2; + int k = p_76940_1_ + p_76940_3_ >> 2; + int l = p_76940_2_ + p_76940_3_ >> 2; + int i1 = k - i + 1; + int j1 = l - j + 1; + int[] aint = this.genBiomes.getInts(i, j, i1, j1); + + try + { + for (int k1 = 0; k1 < i1 * j1; ++k1) + { + BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k1]); + + if (!p_76940_4_.contains(biomegenbase)) + { + return false; + } + } + + return true; + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Layer"); + crashreportcategory.addCrashSection("Layer", this.genBiomes.toString()); + crashreportcategory.addCrashSection("x", Integer.valueOf(p_76940_1_)); + crashreportcategory.addCrashSection("z", Integer.valueOf(p_76940_2_)); + crashreportcategory.addCrashSection("radius", Integer.valueOf(p_76940_3_)); + crashreportcategory.addCrashSection("allowed", p_76940_4_); + throw new ReportedException(crashreport); + } + } + + public BlockPos findBiomePosition(int x, int z, int range, List biomes, Random random) + { + IntCache.resetIntCache(); + int i = x - range >> 2; + int j = z - range >> 2; + int k = x + range >> 2; + int l = z + range >> 2; + int i1 = k - i + 1; + int j1 = l - j + 1; + int[] aint = this.genBiomes.getInts(i, j, i1, j1); + BlockPos blockpos = null; + int k1 = 0; + + for (int l1 = 0; l1 < i1 * j1; ++l1) + { + int i2 = i + l1 % i1 << 2; + int j2 = j + l1 / i1 << 2; + BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[l1]); + + if (biomes.contains(biomegenbase) && (blockpos == null || random.nextInt(k1 + 1) == 0)) + { + blockpos = new BlockPos(i2, 0, j2); + ++k1; + } + } + + return blockpos; + } + + /** + * Calls the WorldChunkManager's biomeCache.cleanupCache() + */ + public void cleanupCache() + { + this.biomeCache.cleanupCache(); + } +} diff --git a/src/minecraft/net/minecraft/world/biome/WorldChunkManagerHell.java b/src/minecraft/net/minecraft/world/biome/WorldChunkManagerHell.java new file mode 100644 index 0000000..9898955 --- /dev/null +++ b/src/minecraft/net/minecraft/world/biome/WorldChunkManagerHell.java @@ -0,0 +1,94 @@ +package net.minecraft.world.biome; + +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import net.minecraft.util.BlockPos; + +public class WorldChunkManagerHell extends WorldChunkManager +{ + /** The biome generator object. */ + private BiomeGenBase biomeGenerator; + + /** The rainfall in the world */ + private float rainfall; + + public WorldChunkManagerHell(BiomeGenBase p_i45374_1_, float p_i45374_2_) + { + this.biomeGenerator = p_i45374_1_; + this.rainfall = p_i45374_2_; + } + + /** + * Returns the biome generator + */ + public BiomeGenBase getBiomeGenerator(BlockPos pos) + { + return this.biomeGenerator; + } + + /** + * Returns an array of biomes for the location input. + */ + public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] biomes, int x, int z, int width, int height) + { + if (biomes == null || biomes.length < width * height) + { + biomes = new BiomeGenBase[width * height]; + } + + Arrays.fill(biomes, 0, width * height, this.biomeGenerator); + return biomes; + } + + /** + * Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length. + */ + public float[] getRainfall(float[] listToReuse, int x, int z, int width, int length) + { + if (listToReuse == null || listToReuse.length < width * length) + { + listToReuse = new float[width * length]; + } + + Arrays.fill(listToReuse, 0, width * length, this.rainfall); + return listToReuse; + } + + /** + * Returns biomes to use for the blocks and loads the other data like temperature and humidity onto the + * WorldChunkManager Args: oldBiomeList, x, z, width, depth + */ + public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] oldBiomeList, int x, int z, int width, int depth) + { + if (oldBiomeList == null || oldBiomeList.length < width * depth) + { + oldBiomeList = new BiomeGenBase[width * depth]; + } + + Arrays.fill(oldBiomeList, 0, width * depth, this.biomeGenerator); + return oldBiomeList; + } + + /** + * Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length, cacheFlag (if false, + * don't check biomeCache to avoid infinite loop in BiomeCacheBlock) + */ + public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int z, int width, int length, boolean cacheFlag) + { + return this.loadBlockGeneratorData(listToReuse, x, z, width, length); + } + + public BlockPos findBiomePosition(int x, int z, int range, List biomes, Random random) + { + return biomes.contains(this.biomeGenerator) ? new BlockPos(x - range + random.nextInt(range * 2 + 1), 0, z - range + random.nextInt(range * 2 + 1)) : null; + } + + /** + * checks given Chunk's Biomes against List of allowed ones + */ + public boolean areBiomesViable(int p_76940_1_, int p_76940_2_, int p_76940_3_, List p_76940_4_) + { + return p_76940_4_.contains(this.biomeGenerator); + } +} diff --git a/src/minecraft/net/minecraft/world/border/EnumBorderStatus.java b/src/minecraft/net/minecraft/world/border/EnumBorderStatus.java new file mode 100644 index 0000000..efb36c1 --- /dev/null +++ b/src/minecraft/net/minecraft/world/border/EnumBorderStatus.java @@ -0,0 +1,24 @@ +package net.minecraft.world.border; + +public enum EnumBorderStatus +{ + GROWING(4259712), + SHRINKING(16724016), + STATIONARY(2138367); + + private final int id; + + private EnumBorderStatus(int id) + { + this.id = id; + } + + /** + * Returns an integer that represents the state of the world border. Growing, Shrinking and Stationary all have + * unique values. + */ + public int getID() + { + return this.id; + } +} diff --git a/src/minecraft/net/minecraft/world/border/IBorderListener.java b/src/minecraft/net/minecraft/world/border/IBorderListener.java new file mode 100644 index 0000000..15e5aff --- /dev/null +++ b/src/minecraft/net/minecraft/world/border/IBorderListener.java @@ -0,0 +1,18 @@ +package net.minecraft.world.border; + +public interface IBorderListener +{ + void onSizeChanged(WorldBorder border, double newSize); + + void onTransitionStarted(WorldBorder border, double oldSize, double newSize, long time); + + void onCenterChanged(WorldBorder border, double x, double z); + + void onWarningTimeChanged(WorldBorder border, int newTime); + + void onWarningDistanceChanged(WorldBorder border, int newDistance); + + void onDamageAmountChanged(WorldBorder border, double newAmount); + + void onDamageBufferChanged(WorldBorder border, double newSize); +} diff --git a/src/minecraft/net/minecraft/world/border/WorldBorder.java b/src/minecraft/net/minecraft/world/border/WorldBorder.java new file mode 100644 index 0000000..82d7900 --- /dev/null +++ b/src/minecraft/net/minecraft/world/border/WorldBorder.java @@ -0,0 +1,277 @@ +package net.minecraft.world.border; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.entity.Entity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.world.ChunkCoordIntPair; + +public class WorldBorder +{ + private final List listeners = Lists.newArrayList(); + private double centerX = 0.0D; + private double centerZ = 0.0D; + private double startDiameter = 6.0E7D; + private double endDiameter; + private long endTime; + private long startTime; + private int worldSize; + private double damageAmount; + private double damageBuffer; + private int warningTime; + private int warningDistance; + + public WorldBorder() + { + this.endDiameter = this.startDiameter; + this.worldSize = 29999984; + this.damageAmount = 0.2D; + this.damageBuffer = 5.0D; + this.warningTime = 15; + this.warningDistance = 5; + } + + public boolean contains(BlockPos pos) + { + return (double)(pos.getX() + 1) > this.minX() && (double)pos.getX() < this.maxX() && (double)(pos.getZ() + 1) > this.minZ() && (double)pos.getZ() < this.maxZ(); + } + + public boolean contains(ChunkCoordIntPair range) + { + return (double)range.getXEnd() > this.minX() && (double)range.getXStart() < this.maxX() && (double)range.getZEnd() > this.minZ() && (double)range.getZStart() < this.maxZ(); + } + + public boolean contains(AxisAlignedBB bb) + { + return bb.maxX > this.minX() && bb.minX < this.maxX() && bb.maxZ > this.minZ() && bb.minZ < this.maxZ(); + } + + public double getClosestDistance(Entity entityIn) + { + return this.getClosestDistance(entityIn.posX, entityIn.posZ); + } + + public double getClosestDistance(double x, double z) + { + double d0 = z - this.minZ(); + double d1 = this.maxZ() - z; + double d2 = x - this.minX(); + double d3 = this.maxX() - x; + double d4 = Math.min(d2, d3); + d4 = Math.min(d4, d0); + return Math.min(d4, d1); + } + + public EnumBorderStatus getStatus() + { + return this.endDiameter < this.startDiameter ? EnumBorderStatus.SHRINKING : (this.endDiameter > this.startDiameter ? EnumBorderStatus.GROWING : EnumBorderStatus.STATIONARY); + } + + public double minX() + { + double d0 = this.getCenterX() - this.getDiameter() / 2.0D; + + if (d0 < (double)(-this.worldSize)) + { + d0 = (double)(-this.worldSize); + } + + return d0; + } + + public double minZ() + { + double d0 = this.getCenterZ() - this.getDiameter() / 2.0D; + + if (d0 < (double)(-this.worldSize)) + { + d0 = (double)(-this.worldSize); + } + + return d0; + } + + public double maxX() + { + double d0 = this.getCenterX() + this.getDiameter() / 2.0D; + + if (d0 > (double)this.worldSize) + { + d0 = (double)this.worldSize; + } + + return d0; + } + + public double maxZ() + { + double d0 = this.getCenterZ() + this.getDiameter() / 2.0D; + + if (d0 > (double)this.worldSize) + { + d0 = (double)this.worldSize; + } + + return d0; + } + + public double getCenterX() + { + return this.centerX; + } + + public double getCenterZ() + { + return this.centerZ; + } + + public void setCenter(double x, double z) + { + this.centerX = x; + this.centerZ = z; + + for (IBorderListener iborderlistener : this.getListeners()) + { + iborderlistener.onCenterChanged(this, x, z); + } + } + + public double getDiameter() + { + if (this.getStatus() != EnumBorderStatus.STATIONARY) + { + double d0 = (double)((float)(System.currentTimeMillis() - this.startTime) / (float)(this.endTime - this.startTime)); + + if (d0 < 1.0D) + { + return this.startDiameter + (this.endDiameter - this.startDiameter) * d0; + } + + this.setTransition(this.endDiameter); + } + + return this.startDiameter; + } + + public long getTimeUntilTarget() + { + return this.getStatus() != EnumBorderStatus.STATIONARY ? this.endTime - System.currentTimeMillis() : 0L; + } + + public double getTargetSize() + { + return this.endDiameter; + } + + public void setTransition(double newSize) + { + this.startDiameter = newSize; + this.endDiameter = newSize; + this.endTime = System.currentTimeMillis(); + this.startTime = this.endTime; + + for (IBorderListener iborderlistener : this.getListeners()) + { + iborderlistener.onSizeChanged(this, newSize); + } + } + + public void setTransition(double oldSize, double newSize, long time) + { + this.startDiameter = oldSize; + this.endDiameter = newSize; + this.startTime = System.currentTimeMillis(); + this.endTime = this.startTime + time; + + for (IBorderListener iborderlistener : this.getListeners()) + { + iborderlistener.onTransitionStarted(this, oldSize, newSize, time); + } + } + + protected List getListeners() + { + return Lists.newArrayList(this.listeners); + } + + public void addListener(IBorderListener listener) + { + this.listeners.add(listener); + } + + public void setSize(int size) + { + this.worldSize = size; + } + + public int getSize() + { + return this.worldSize; + } + + public double getDamageBuffer() + { + return this.damageBuffer; + } + + public void setDamageBuffer(double bufferSize) + { + this.damageBuffer = bufferSize; + + for (IBorderListener iborderlistener : this.getListeners()) + { + iborderlistener.onDamageBufferChanged(this, bufferSize); + } + } + + public double getDamageAmount() + { + return this.damageAmount; + } + + public void setDamageAmount(double newAmount) + { + this.damageAmount = newAmount; + + for (IBorderListener iborderlistener : this.getListeners()) + { + iborderlistener.onDamageAmountChanged(this, newAmount); + } + } + + public double getResizeSpeed() + { + return this.endTime == this.startTime ? 0.0D : Math.abs(this.startDiameter - this.endDiameter) / (double)(this.endTime - this.startTime); + } + + public int getWarningTime() + { + return this.warningTime; + } + + public void setWarningTime(int warningTime) + { + this.warningTime = warningTime; + + for (IBorderListener iborderlistener : this.getListeners()) + { + iborderlistener.onWarningTimeChanged(this, warningTime); + } + } + + public int getWarningDistance() + { + return this.warningDistance; + } + + public void setWarningDistance(int warningDistance) + { + this.warningDistance = warningDistance; + + for (IBorderListener iborderlistener : this.getListeners()) + { + iborderlistener.onWarningDistanceChanged(this, warningDistance); + } + } +} diff --git a/src/minecraft/net/minecraft/world/chunk/Chunk.java b/src/minecraft/net/minecraft/world/chunk/Chunk.java new file mode 100644 index 0000000..346b867 --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/Chunk.java @@ -0,0 +1,1706 @@ +package net.minecraft.world.chunk; + +import com.google.common.base.Predicate; +import com.google.common.collect.Maps; +import com.google.common.collect.Queues; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentLinkedQueue; +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ClassInheritanceMultiMap; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ReportedException; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.World; +import net.minecraft.world.WorldType; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; +import net.minecraft.world.gen.ChunkProviderDebug; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class Chunk +{ + private static final Logger logger = LogManager.getLogger(); + + /** + * Used to store block IDs, block MSBs, Sky-light maps, Block-light maps, and metadata. Each entry corresponds to a + * logical segment of 16x16x16 blocks, stacked vertically. + */ + private final ExtendedBlockStorage[] storageArrays; + + /** + * Contains a 16x16 mapping on the X/Z plane of the biome ID to which each colum belongs. + */ + private final byte[] blockBiomeArray; + + /** + * A map, similar to heightMap, that tracks how far down precipitation can fall. + */ + private final int[] precipitationHeightMap; + + /** Which columns need their skylightMaps updated. */ + private final boolean[] updateSkylightColumns; + + /** Whether or not this Chunk is currently loaded into the World */ + private boolean isChunkLoaded; + + /** Reference to the World object. */ + private final World worldObj; + private final int[] heightMap; + + /** The x coordinate of the chunk. */ + public final int xPosition; + + /** The z coordinate of the chunk. */ + public final int zPosition; + private boolean isGapLightingUpdated; + private final Map chunkTileEntityMap; + private final ClassInheritanceMultiMap[] entityLists; + + /** Boolean value indicating if the terrain is populated. */ + private boolean isTerrainPopulated; + private boolean isLightPopulated; + private boolean field_150815_m; + + /** + * Set to true if the chunk has been modified and needs to be updated internally. + */ + private boolean isModified; + + /** + * Whether this Chunk has any Entities and thus requires saving on every tick + */ + private boolean hasEntities; + + /** The time according to World.worldTime when this chunk was last saved */ + private long lastSaveTime; + + /** Lowest value in the heightmap. */ + private int heightMapMinimum; + + /** the cumulative number of ticks players have been in this chunk */ + private long inhabitedTime; + + /** + * Contains the current round-robin relight check index, and is implied as the relight check location as well. + */ + private int queuedLightChecks; + private ConcurrentLinkedQueue tileEntityPosQueue; + + public Chunk(World worldIn, int x, int z) + { + this.storageArrays = new ExtendedBlockStorage[16]; + this.blockBiomeArray = new byte[256]; + this.precipitationHeightMap = new int[256]; + this.updateSkylightColumns = new boolean[256]; + this.chunkTileEntityMap = Maps.newHashMap(); + this.queuedLightChecks = 4096; + this.tileEntityPosQueue = Queues.newConcurrentLinkedQueue(); + this.entityLists = (ClassInheritanceMultiMap[])(new ClassInheritanceMultiMap[16]); + this.worldObj = worldIn; + this.xPosition = x; + this.zPosition = z; + this.heightMap = new int[256]; + + for (int i = 0; i < this.entityLists.length; ++i) + { + this.entityLists[i] = new ClassInheritanceMultiMap(Entity.class); + } + + Arrays.fill((int[])this.precipitationHeightMap, (int) - 999); + Arrays.fill(this.blockBiomeArray, (byte) - 1); + } + + public Chunk(World worldIn, ChunkPrimer primer, int x, int z) + { + this(worldIn, x, z); + int i = 256; + boolean flag = !worldIn.provider.getHasNoSky(); + + for (int j = 0; j < 16; ++j) + { + for (int k = 0; k < 16; ++k) + { + for (int l = 0; l < i; ++l) + { + int i1 = j * i * 16 | k * i | l; + IBlockState iblockstate = primer.getBlockState(i1); + + if (iblockstate.getBlock().getMaterial() != Material.air) + { + int j1 = l >> 4; + + if (this.storageArrays[j1] == null) + { + this.storageArrays[j1] = new ExtendedBlockStorage(j1 << 4, flag); + } + + this.storageArrays[j1].set(j, l & 15, k, iblockstate); + } + } + } + } + } + + /** + * Checks whether the chunk is at the X/Z location specified + */ + public boolean isAtLocation(int x, int z) + { + return x == this.xPosition && z == this.zPosition; + } + + public int getHeight(BlockPos pos) + { + return this.getHeightValue(pos.getX() & 15, pos.getZ() & 15); + } + + /** + * Returns the value in the height map at this x, z coordinate in the chunk + */ + public int getHeightValue(int x, int z) + { + return this.heightMap[z << 4 | x]; + } + + /** + * Returns the topmost ExtendedBlockStorage instance for this Chunk that actually contains a block. + */ + public int getTopFilledSegment() + { + for (int i = this.storageArrays.length - 1; i >= 0; --i) + { + if (this.storageArrays[i] != null) + { + return this.storageArrays[i].getYLocation(); + } + } + + return 0; + } + + /** + * Returns the ExtendedBlockStorage array for this Chunk. + */ + public ExtendedBlockStorage[] getBlockStorageArray() + { + return this.storageArrays; + } + + /** + * Generates the height map for a chunk from scratch + */ + protected void generateHeightMap() + { + int i = this.getTopFilledSegment(); + this.heightMapMinimum = Integer.MAX_VALUE; + + for (int j = 0; j < 16; ++j) + { + for (int k = 0; k < 16; ++k) + { + this.precipitationHeightMap[j + (k << 4)] = -999; + + for (int l = i + 16; l > 0; --l) + { + Block block = this.getBlock0(j, l - 1, k); + + if (block.getLightOpacity() != 0) + { + this.heightMap[k << 4 | j] = l; + + if (l < this.heightMapMinimum) + { + this.heightMapMinimum = l; + } + + break; + } + } + } + } + + this.isModified = true; + } + + /** + * Generates the initial skylight map for the chunk upon generation or load. + */ + public void generateSkylightMap() + { + int i = this.getTopFilledSegment(); + this.heightMapMinimum = Integer.MAX_VALUE; + + for (int j = 0; j < 16; ++j) + { + for (int k = 0; k < 16; ++k) + { + this.precipitationHeightMap[j + (k << 4)] = -999; + + for (int l = i + 16; l > 0; --l) + { + if (this.getBlockLightOpacity(j, l - 1, k) != 0) + { + this.heightMap[k << 4 | j] = l; + + if (l < this.heightMapMinimum) + { + this.heightMapMinimum = l; + } + + break; + } + } + + if (!this.worldObj.provider.getHasNoSky()) + { + int k1 = 15; + int i1 = i + 16 - 1; + + while (true) + { + int j1 = this.getBlockLightOpacity(j, i1, k); + + if (j1 == 0 && k1 != 15) + { + j1 = 1; + } + + k1 -= j1; + + if (k1 > 0) + { + ExtendedBlockStorage extendedblockstorage = this.storageArrays[i1 >> 4]; + + if (extendedblockstorage != null) + { + extendedblockstorage.setExtSkylightValue(j, i1 & 15, k, k1); + this.worldObj.notifyLightSet(new BlockPos((this.xPosition << 4) + j, i1, (this.zPosition << 4) + k)); + } + } + + --i1; + + if (i1 <= 0 || k1 <= 0) + { + break; + } + } + } + } + } + + this.isModified = true; + } + + /** + * Propagates a given sky-visible block's light value downward and upward to neighboring blocks as necessary. + */ + private void propagateSkylightOcclusion(int x, int z) + { + this.updateSkylightColumns[x + z * 16] = true; + this.isGapLightingUpdated = true; + } + + private void recheckGaps(boolean p_150803_1_) + { + this.worldObj.theProfiler.startSection("recheckGaps"); + + if (this.worldObj.isAreaLoaded(new BlockPos(this.xPosition * 16 + 8, 0, this.zPosition * 16 + 8), 16)) + { + for (int i = 0; i < 16; ++i) + { + for (int j = 0; j < 16; ++j) + { + if (this.updateSkylightColumns[i + j * 16]) + { + this.updateSkylightColumns[i + j * 16] = false; + int k = this.getHeightValue(i, j); + int l = this.xPosition * 16 + i; + int i1 = this.zPosition * 16 + j; + int j1 = Integer.MAX_VALUE; + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + j1 = Math.min(j1, this.worldObj.getChunksLowestHorizon(l + ((EnumFacing) enumfacing).getFrontOffsetX(), i1 + ((EnumFacing) enumfacing).getFrontOffsetZ())); + } + + this.checkSkylightNeighborHeight(l, i1, j1); + + for (Object enumfacing1 : EnumFacing.Plane.HORIZONTAL) + { + this.checkSkylightNeighborHeight(l + ((EnumFacing) enumfacing1).getFrontOffsetX(), i1 + ((EnumFacing) enumfacing1).getFrontOffsetZ(), k); + } + + if (p_150803_1_) + { + this.worldObj.theProfiler.endSection(); + return; + } + } + } + } + + this.isGapLightingUpdated = false; + } + + this.worldObj.theProfiler.endSection(); + } + + /** + * Checks the height of a block next to a sky-visible block and schedules a lighting update as necessary. + */ + private void checkSkylightNeighborHeight(int x, int z, int maxValue) + { + int i = this.worldObj.getHeight(new BlockPos(x, 0, z)).getY(); + + if (i > maxValue) + { + this.updateSkylightNeighborHeight(x, z, maxValue, i + 1); + } + else if (i < maxValue) + { + this.updateSkylightNeighborHeight(x, z, i, maxValue + 1); + } + } + + private void updateSkylightNeighborHeight(int x, int z, int startY, int endY) + { + if (endY > startY && this.worldObj.isAreaLoaded(new BlockPos(x, 0, z), 16)) + { + for (int i = startY; i < endY; ++i) + { + this.worldObj.checkLightFor(EnumSkyBlock.SKY, new BlockPos(x, i, z)); + } + + this.isModified = true; + } + } + + /** + * Initiates the recalculation of both the block-light and sky-light for a given block inside a chunk. + */ + private void relightBlock(int x, int y, int z) + { + int i = this.heightMap[z << 4 | x] & 255; + int j = i; + + if (y > i) + { + j = y; + } + + while (j > 0 && this.getBlockLightOpacity(x, j - 1, z) == 0) + { + --j; + } + + if (j != i) + { + this.worldObj.markBlocksDirtyVertical(x + this.xPosition * 16, z + this.zPosition * 16, j, i); + this.heightMap[z << 4 | x] = j; + int k = this.xPosition * 16 + x; + int l = this.zPosition * 16 + z; + + if (!this.worldObj.provider.getHasNoSky()) + { + if (j < i) + { + for (int j1 = j; j1 < i; ++j1) + { + ExtendedBlockStorage extendedblockstorage2 = this.storageArrays[j1 >> 4]; + + if (extendedblockstorage2 != null) + { + extendedblockstorage2.setExtSkylightValue(x, j1 & 15, z, 15); + this.worldObj.notifyLightSet(new BlockPos((this.xPosition << 4) + x, j1, (this.zPosition << 4) + z)); + } + } + } + else + { + for (int i1 = i; i1 < j; ++i1) + { + ExtendedBlockStorage extendedblockstorage = this.storageArrays[i1 >> 4]; + + if (extendedblockstorage != null) + { + extendedblockstorage.setExtSkylightValue(x, i1 & 15, z, 0); + this.worldObj.notifyLightSet(new BlockPos((this.xPosition << 4) + x, i1, (this.zPosition << 4) + z)); + } + } + } + + int k1 = 15; + + while (j > 0 && k1 > 0) + { + --j; + int i2 = this.getBlockLightOpacity(x, j, z); + + if (i2 == 0) + { + i2 = 1; + } + + k1 -= i2; + + if (k1 < 0) + { + k1 = 0; + } + + ExtendedBlockStorage extendedblockstorage1 = this.storageArrays[j >> 4]; + + if (extendedblockstorage1 != null) + { + extendedblockstorage1.setExtSkylightValue(x, j & 15, z, k1); + } + } + } + + int l1 = this.heightMap[z << 4 | x]; + int j2 = i; + int k2 = l1; + + if (l1 < i) + { + j2 = l1; + k2 = i; + } + + if (l1 < this.heightMapMinimum) + { + this.heightMapMinimum = l1; + } + + if (!this.worldObj.provider.getHasNoSky()) + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + this.updateSkylightNeighborHeight(k + ((EnumFacing) enumfacing).getFrontOffsetX(), l + ((EnumFacing) enumfacing).getFrontOffsetZ(), j2, k2); + } + + this.updateSkylightNeighborHeight(k, l, j2, k2); + } + + this.isModified = true; + } + } + + public int getBlockLightOpacity(BlockPos pos) + { + return this.getBlock(pos).getLightOpacity(); + } + + private int getBlockLightOpacity(int x, int y, int z) + { + return this.getBlock0(x, y, z).getLightOpacity(); + } + + /** + * Returns the block corresponding to the given coordinates inside a chunk. + */ + private Block getBlock0(int x, int y, int z) + { + Block block = Blocks.air; + + if (y >= 0 && y >> 4 < this.storageArrays.length) + { + ExtendedBlockStorage extendedblockstorage = this.storageArrays[y >> 4]; + + if (extendedblockstorage != null) + { + try + { + block = extendedblockstorage.getBlockByExtId(x, y & 15, z); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block"); + throw new ReportedException(crashreport); + } + } + } + + return block; + } + + public Block getBlock(final int x, final int y, final int z) + { + try + { + return this.getBlock0(x & 15, y, z & 15); + } + catch (ReportedException reportedexception) + { + CrashReportCategory crashreportcategory = reportedexception.getCrashReport().makeCategory("Block being got"); + crashreportcategory.addCrashSectionCallable("Location", new Callable() + { + public String call() throws Exception + { + return CrashReportCategory.getCoordinateInfo(new BlockPos(Chunk.this.xPosition * 16 + x, y, Chunk.this.zPosition * 16 + z)); + } + }); + throw reportedexception; + } + } + + public Block getBlock(final BlockPos pos) + { + try + { + return this.getBlock0(pos.getX() & 15, pos.getY(), pos.getZ() & 15); + } + catch (ReportedException reportedexception) + { + CrashReportCategory crashreportcategory = reportedexception.getCrashReport().makeCategory("Block being got"); + crashreportcategory.addCrashSectionCallable("Location", new Callable() + { + public String call() throws Exception + { + return CrashReportCategory.getCoordinateInfo(pos); + } + }); + throw reportedexception; + } + } + + public IBlockState getBlockState(final BlockPos pos) + { + if (this.worldObj.getWorldType() == WorldType.DEBUG_WORLD) + { + IBlockState iblockstate = null; + + if (pos.getY() == 60) + { + iblockstate = Blocks.barrier.getDefaultState(); + } + + if (pos.getY() == 70) + { + iblockstate = ChunkProviderDebug.func_177461_b(pos.getX(), pos.getZ()); + } + + return iblockstate == null ? Blocks.air.getDefaultState() : iblockstate; + } + else + { + try + { + if (pos.getY() >= 0 && pos.getY() >> 4 < this.storageArrays.length) + { + ExtendedBlockStorage extendedblockstorage = this.storageArrays[pos.getY() >> 4]; + + if (extendedblockstorage != null) + { + int j = pos.getX() & 15; + int k = pos.getY() & 15; + int i = pos.getZ() & 15; + return extendedblockstorage.get(j, k, i); + } + } + + return Blocks.air.getDefaultState(); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block state"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being got"); + crashreportcategory.addCrashSectionCallable("Location", new Callable() + { + public String call() throws Exception + { + return CrashReportCategory.getCoordinateInfo(pos); + } + }); + throw new ReportedException(crashreport); + } + } + } + + /** + * Return the metadata corresponding to the given coordinates inside a chunk. + */ + private int getBlockMetadata(int x, int y, int z) + { + if (y >> 4 >= this.storageArrays.length) + { + return 0; + } + else + { + ExtendedBlockStorage extendedblockstorage = this.storageArrays[y >> 4]; + return extendedblockstorage != null ? extendedblockstorage.getExtBlockMetadata(x, y & 15, z) : 0; + } + } + + public int getBlockMetadata(BlockPos pos) + { + return this.getBlockMetadata(pos.getX() & 15, pos.getY(), pos.getZ() & 15); + } + + public IBlockState setBlockState(BlockPos pos, IBlockState state) + { + int i = pos.getX() & 15; + int j = pos.getY(); + int k = pos.getZ() & 15; + int l = k << 4 | i; + + if (j >= this.precipitationHeightMap[l] - 1) + { + this.precipitationHeightMap[l] = -999; + } + + int i1 = this.heightMap[l]; + IBlockState iblockstate = this.getBlockState(pos); + + if (iblockstate == state) + { + return null; + } + else + { + Block block = state.getBlock(); + Block block1 = iblockstate.getBlock(); + ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4]; + boolean flag = false; + + if (extendedblockstorage == null) + { + if (block == Blocks.air) + { + return null; + } + + extendedblockstorage = this.storageArrays[j >> 4] = new ExtendedBlockStorage(j >> 4 << 4, !this.worldObj.provider.getHasNoSky()); + flag = j >= i1; + } + + extendedblockstorage.set(i, j & 15, k, state); + + if (block1 != block) + { + if (!this.worldObj.isRemote) + { + block1.breakBlock(this.worldObj, pos, iblockstate); + } + else if (block1 instanceof ITileEntityProvider) + { + this.worldObj.removeTileEntity(pos); + } + } + + if (extendedblockstorage.getBlockByExtId(i, j & 15, k) != block) + { + return null; + } + else + { + if (flag) + { + this.generateSkylightMap(); + } + else + { + int j1 = block.getLightOpacity(); + int k1 = block1.getLightOpacity(); + + if (j1 > 0) + { + if (j >= i1) + { + this.relightBlock(i, j + 1, k); + } + } + else if (j == i1 - 1) + { + this.relightBlock(i, j, k); + } + + if (j1 != k1 && (j1 < k1 || this.getLightFor(EnumSkyBlock.SKY, pos) > 0 || this.getLightFor(EnumSkyBlock.BLOCK, pos) > 0)) + { + this.propagateSkylightOcclusion(i, k); + } + } + + if (block1 instanceof ITileEntityProvider) + { + TileEntity tileentity = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); + + if (tileentity != null) + { + tileentity.updateContainingBlockInfo(); + } + } + + if (!this.worldObj.isRemote && block1 != block) + { + block.onBlockAdded(this.worldObj, pos, state); + } + + if (block instanceof ITileEntityProvider) + { + TileEntity tileentity1 = this.getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK); + + if (tileentity1 == null) + { + tileentity1 = ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, block.getMetaFromState(state)); + this.worldObj.setTileEntity(pos, tileentity1); + } + + if (tileentity1 != null) + { + tileentity1.updateContainingBlockInfo(); + } + } + + this.isModified = true; + return iblockstate; + } + } + } + + public int getLightFor(EnumSkyBlock p_177413_1_, BlockPos pos) + { + int i = pos.getX() & 15; + int j = pos.getY(); + int k = pos.getZ() & 15; + ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4]; + return extendedblockstorage == null ? (this.canSeeSky(pos) ? p_177413_1_.defaultLightValue : 0) : (p_177413_1_ == EnumSkyBlock.SKY ? (this.worldObj.provider.getHasNoSky() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k)) : (p_177413_1_ == EnumSkyBlock.BLOCK ? extendedblockstorage.getExtBlocklightValue(i, j & 15, k) : p_177413_1_.defaultLightValue)); + } + + public void setLightFor(EnumSkyBlock p_177431_1_, BlockPos pos, int value) + { + int i = pos.getX() & 15; + int j = pos.getY(); + int k = pos.getZ() & 15; + ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4]; + + if (extendedblockstorage == null) + { + extendedblockstorage = this.storageArrays[j >> 4] = new ExtendedBlockStorage(j >> 4 << 4, !this.worldObj.provider.getHasNoSky()); + this.generateSkylightMap(); + } + + this.isModified = true; + + if (p_177431_1_ == EnumSkyBlock.SKY) + { + if (!this.worldObj.provider.getHasNoSky()) + { + extendedblockstorage.setExtSkylightValue(i, j & 15, k, value); + } + } + else if (p_177431_1_ == EnumSkyBlock.BLOCK) + { + extendedblockstorage.setExtBlocklightValue(i, j & 15, k, value); + } + } + + public int getLightSubtracted(BlockPos pos, int amount) + { + int i = pos.getX() & 15; + int j = pos.getY(); + int k = pos.getZ() & 15; + ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4]; + + if (extendedblockstorage == null) + { + return !this.worldObj.provider.getHasNoSky() && amount < EnumSkyBlock.SKY.defaultLightValue ? EnumSkyBlock.SKY.defaultLightValue - amount : 0; + } + else + { + int l = this.worldObj.provider.getHasNoSky() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k); + l = l - amount; + int i1 = extendedblockstorage.getExtBlocklightValue(i, j & 15, k); + + if (i1 > l) + { + l = i1; + } + + return l; + } + } + + /** + * Adds an entity to the chunk. Args: entity + */ + public void addEntity(Entity entityIn) + { + this.hasEntities = true; + int i = MathHelper.floor_double(entityIn.posX / 16.0D); + int j = MathHelper.floor_double(entityIn.posZ / 16.0D); + + if (i != this.xPosition || j != this.zPosition) + { + logger.warn("Wrong location! (" + i + ", " + j + ") should be (" + this.xPosition + ", " + this.zPosition + "), " + entityIn, new Object[] {entityIn}); + entityIn.setDead(); + } + + int k = MathHelper.floor_double(entityIn.posY / 16.0D); + + if (k < 0) + { + k = 0; + } + + if (k >= this.entityLists.length) + { + k = this.entityLists.length - 1; + } + + entityIn.addedToChunk = true; + entityIn.chunkCoordX = this.xPosition; + entityIn.chunkCoordY = k; + entityIn.chunkCoordZ = this.zPosition; + this.entityLists[k].add(entityIn); + } + + /** + * removes entity using its y chunk coordinate as its index + */ + public void removeEntity(Entity entityIn) + { + this.removeEntityAtIndex(entityIn, entityIn.chunkCoordY); + } + + /** + * Removes entity at the specified index from the entity array. + */ + public void removeEntityAtIndex(Entity entityIn, int p_76608_2_) + { + if (p_76608_2_ < 0) + { + p_76608_2_ = 0; + } + + if (p_76608_2_ >= this.entityLists.length) + { + p_76608_2_ = this.entityLists.length - 1; + } + + this.entityLists[p_76608_2_].remove(entityIn); + } + + public boolean canSeeSky(BlockPos pos) + { + int i = pos.getX() & 15; + int j = pos.getY(); + int k = pos.getZ() & 15; + return j >= this.heightMap[k << 4 | i]; + } + + private TileEntity createNewTileEntity(BlockPos pos) + { + Block block = this.getBlock(pos); + return !block.hasTileEntity() ? null : ((ITileEntityProvider)block).createNewTileEntity(this.worldObj, this.getBlockMetadata(pos)); + } + + public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) + { + TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(pos); + + if (tileentity == null) + { + if (p_177424_2_ == Chunk.EnumCreateEntityType.IMMEDIATE) + { + tileentity = this.createNewTileEntity(pos); + this.worldObj.setTileEntity(pos, tileentity); + } + else if (p_177424_2_ == Chunk.EnumCreateEntityType.QUEUED) + { + this.tileEntityPosQueue.add(pos); + } + } + else if (tileentity.isInvalid()) + { + this.chunkTileEntityMap.remove(pos); + return null; + } + + return tileentity; + } + + public void addTileEntity(TileEntity tileEntityIn) + { + this.addTileEntity(tileEntityIn.getPos(), tileEntityIn); + + if (this.isChunkLoaded) + { + this.worldObj.addTileEntity(tileEntityIn); + } + } + + public void addTileEntity(BlockPos pos, TileEntity tileEntityIn) + { + tileEntityIn.setWorldObj(this.worldObj); + tileEntityIn.setPos(pos); + + if (this.getBlock(pos) instanceof ITileEntityProvider) + { + if (this.chunkTileEntityMap.containsKey(pos)) + { + ((TileEntity)this.chunkTileEntityMap.get(pos)).invalidate(); + } + + tileEntityIn.validate(); + this.chunkTileEntityMap.put(pos, tileEntityIn); + } + } + + public void removeTileEntity(BlockPos pos) + { + if (this.isChunkLoaded) + { + TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.remove(pos); + + if (tileentity != null) + { + tileentity.invalidate(); + } + } + } + + /** + * Called when this Chunk is loaded by the ChunkProvider + */ + public void onChunkLoad() + { + this.isChunkLoaded = true; + this.worldObj.addTileEntities(this.chunkTileEntityMap.values()); + + for (int i = 0; i < this.entityLists.length; ++i) + { + for (Entity entity : this.entityLists[i]) + { + entity.onChunkLoad(); + } + + this.worldObj.loadEntities(this.entityLists[i]); + } + } + + /** + * Called when this Chunk is unloaded by the ChunkProvider + */ + public void onChunkUnload() + { + this.isChunkLoaded = false; + + for (TileEntity tileentity : this.chunkTileEntityMap.values()) + { + this.worldObj.markTileEntityForRemoval(tileentity); + } + + for (int i = 0; i < this.entityLists.length; ++i) + { + this.worldObj.unloadEntities(this.entityLists[i]); + } + } + + /** + * Sets the isModified flag for this Chunk + */ + public void setChunkModified() + { + this.isModified = true; + } + + /** + * Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity. + */ + public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate p_177414_4_) + { + int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); + int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); + i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); + j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); + + for (int k = i; k <= j; ++k) + { + if (!this.entityLists[k].isEmpty()) + { + for (Entity entity : this.entityLists[k]) + { + if (entity.getEntityBoundingBox().intersectsWith(aabb) && entity != entityIn) + { + if (p_177414_4_ == null || p_177414_4_.apply(entity)) + { + listToFill.add(entity); + } + + Entity[] aentity = entity.getParts(); + + if (aentity != null) + { + for (int l = 0; l < aentity.length; ++l) + { + entity = aentity[l]; + + if (entity != entityIn && entity.getEntityBoundingBox().intersectsWith(aabb) && (p_177414_4_ == null || p_177414_4_.apply(entity))) + { + listToFill.add(entity); + } + } + } + } + } + } + } + } + + public void getEntitiesOfTypeWithinAAAB(Class entityClass, AxisAlignedBB aabb, List listToFill, Predicate p_177430_4_) + { + int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D); + int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D); + i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1); + j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1); + + for (int k = i; k <= j; ++k) + { + for (T t : this.entityLists[k].getByClass(entityClass)) + { + if (t.getEntityBoundingBox().intersectsWith(aabb) && (p_177430_4_ == null || p_177430_4_.apply(t))) + { + listToFill.add(t); + } + } + } + } + + /** + * Returns true if this Chunk needs to be saved + */ + public boolean needsSaving(boolean p_76601_1_) + { + if (p_76601_1_) + { + if (this.hasEntities && this.worldObj.getTotalWorldTime() != this.lastSaveTime || this.isModified) + { + return true; + } + } + else if (this.hasEntities && this.worldObj.getTotalWorldTime() >= this.lastSaveTime + 600L) + { + return true; + } + + return this.isModified; + } + + public Random getRandomWithSeed(long seed) + { + return new Random(this.worldObj.getSeed() + (long)(this.xPosition * this.xPosition * 4987142) + (long)(this.xPosition * 5947611) + (long)(this.zPosition * this.zPosition) * 4392871L + (long)(this.zPosition * 389711) ^ seed); + } + + public boolean isEmpty() + { + return false; + } + + public void populateChunk(IChunkProvider p_76624_1_, IChunkProvider p_76624_2_, int p_76624_3_, int p_76624_4_) + { + boolean flag = p_76624_1_.chunkExists(p_76624_3_, p_76624_4_ - 1); + boolean flag1 = p_76624_1_.chunkExists(p_76624_3_ + 1, p_76624_4_); + boolean flag2 = p_76624_1_.chunkExists(p_76624_3_, p_76624_4_ + 1); + boolean flag3 = p_76624_1_.chunkExists(p_76624_3_ - 1, p_76624_4_); + boolean flag4 = p_76624_1_.chunkExists(p_76624_3_ - 1, p_76624_4_ - 1); + boolean flag5 = p_76624_1_.chunkExists(p_76624_3_ + 1, p_76624_4_ + 1); + boolean flag6 = p_76624_1_.chunkExists(p_76624_3_ - 1, p_76624_4_ + 1); + boolean flag7 = p_76624_1_.chunkExists(p_76624_3_ + 1, p_76624_4_ - 1); + + if (flag1 && flag2 && flag5) + { + if (!this.isTerrainPopulated) + { + p_76624_1_.populate(p_76624_2_, p_76624_3_, p_76624_4_); + } + else + { + p_76624_1_.func_177460_a(p_76624_2_, this, p_76624_3_, p_76624_4_); + } + } + + if (flag3 && flag2 && flag6) + { + Chunk chunk = p_76624_1_.provideChunk(p_76624_3_ - 1, p_76624_4_); + + if (!chunk.isTerrainPopulated) + { + p_76624_1_.populate(p_76624_2_, p_76624_3_ - 1, p_76624_4_); + } + else + { + p_76624_1_.func_177460_a(p_76624_2_, chunk, p_76624_3_ - 1, p_76624_4_); + } + } + + if (flag && flag1 && flag7) + { + Chunk chunk1 = p_76624_1_.provideChunk(p_76624_3_, p_76624_4_ - 1); + + if (!chunk1.isTerrainPopulated) + { + p_76624_1_.populate(p_76624_2_, p_76624_3_, p_76624_4_ - 1); + } + else + { + p_76624_1_.func_177460_a(p_76624_2_, chunk1, p_76624_3_, p_76624_4_ - 1); + } + } + + if (flag4 && flag && flag3) + { + Chunk chunk2 = p_76624_1_.provideChunk(p_76624_3_ - 1, p_76624_4_ - 1); + + if (!chunk2.isTerrainPopulated) + { + p_76624_1_.populate(p_76624_2_, p_76624_3_ - 1, p_76624_4_ - 1); + } + else + { + p_76624_1_.func_177460_a(p_76624_2_, chunk2, p_76624_3_ - 1, p_76624_4_ - 1); + } + } + } + + public BlockPos getPrecipitationHeight(BlockPos pos) + { + int i = pos.getX() & 15; + int j = pos.getZ() & 15; + int k = i | j << 4; + BlockPos blockpos = new BlockPos(pos.getX(), this.precipitationHeightMap[k], pos.getZ()); + + if (blockpos.getY() == -999) + { + int l = this.getTopFilledSegment() + 15; + blockpos = new BlockPos(pos.getX(), l, pos.getZ()); + int i1 = -1; + + while (blockpos.getY() > 0 && i1 == -1) + { + Block block = this.getBlock(blockpos); + Material material = block.getMaterial(); + + if (!material.blocksMovement() && !material.isLiquid()) + { + blockpos = blockpos.down(); + } + else + { + i1 = blockpos.getY() + 1; + } + } + + this.precipitationHeightMap[k] = i1; + } + + return new BlockPos(pos.getX(), this.precipitationHeightMap[k], pos.getZ()); + } + + public void func_150804_b(boolean p_150804_1_) + { + if (this.isGapLightingUpdated && !this.worldObj.provider.getHasNoSky() && !p_150804_1_) + { + this.recheckGaps(this.worldObj.isRemote); + } + + this.field_150815_m = true; + + if (!this.isLightPopulated && this.isTerrainPopulated) + { + this.func_150809_p(); + } + + while (!this.tileEntityPosQueue.isEmpty()) + { + BlockPos blockpos = (BlockPos)this.tileEntityPosQueue.poll(); + + if (this.getTileEntity(blockpos, Chunk.EnumCreateEntityType.CHECK) == null && this.getBlock(blockpos).hasTileEntity()) + { + TileEntity tileentity = this.createNewTileEntity(blockpos); + this.worldObj.setTileEntity(blockpos, tileentity); + this.worldObj.markBlockRangeForRenderUpdate(blockpos, blockpos); + } + } + } + + public boolean isPopulated() + { + return this.field_150815_m && this.isTerrainPopulated && this.isLightPopulated; + } + + /** + * Gets a ChunkCoordIntPair representing the Chunk's position. + */ + public ChunkCoordIntPair getChunkCoordIntPair() + { + return new ChunkCoordIntPair(this.xPosition, this.zPosition); + } + + /** + * Returns whether the ExtendedBlockStorages containing levels (in blocks) from arg 1 to arg 2 are fully empty + * (true) or not (false). + */ + public boolean getAreLevelsEmpty(int startY, int endY) + { + if (startY < 0) + { + startY = 0; + } + + if (endY >= 256) + { + endY = 255; + } + + for (int i = startY; i <= endY; i += 16) + { + ExtendedBlockStorage extendedblockstorage = this.storageArrays[i >> 4]; + + if (extendedblockstorage != null && !extendedblockstorage.isEmpty()) + { + return false; + } + } + + return true; + } + + public void setStorageArrays(ExtendedBlockStorage[] newStorageArrays) + { + if (this.storageArrays.length != newStorageArrays.length) + { + logger.warn("Could not set level chunk sections, array length is " + newStorageArrays.length + " instead of " + this.storageArrays.length); + } + else + { + for (int i = 0; i < this.storageArrays.length; ++i) + { + this.storageArrays[i] = newStorageArrays[i]; + } + } + } + + /** + * Initialize this chunk with new binary data. + */ + public void fillChunk(byte[] p_177439_1_, int p_177439_2_, boolean p_177439_3_) + { + int i = 0; + boolean flag = !this.worldObj.provider.getHasNoSky(); + + for (int j = 0; j < this.storageArrays.length; ++j) + { + if ((p_177439_2_ & 1 << j) != 0) + { + if (this.storageArrays[j] == null) + { + this.storageArrays[j] = new ExtendedBlockStorage(j << 4, flag); + } + + char[] achar = this.storageArrays[j].getData(); + + for (int k = 0; k < achar.length; ++k) + { + achar[k] = (char)((p_177439_1_[i + 1] & 255) << 8 | p_177439_1_[i] & 255); + i += 2; + } + } + else if (p_177439_3_ && this.storageArrays[j] != null) + { + this.storageArrays[j] = null; + } + } + + for (int l = 0; l < this.storageArrays.length; ++l) + { + if ((p_177439_2_ & 1 << l) != 0 && this.storageArrays[l] != null) + { + NibbleArray nibblearray = this.storageArrays[l].getBlocklightArray(); + System.arraycopy(p_177439_1_, i, nibblearray.getData(), 0, nibblearray.getData().length); + i += nibblearray.getData().length; + } + } + + if (flag) + { + for (int i1 = 0; i1 < this.storageArrays.length; ++i1) + { + if ((p_177439_2_ & 1 << i1) != 0 && this.storageArrays[i1] != null) + { + NibbleArray nibblearray1 = this.storageArrays[i1].getSkylightArray(); + System.arraycopy(p_177439_1_, i, nibblearray1.getData(), 0, nibblearray1.getData().length); + i += nibblearray1.getData().length; + } + } + } + + if (p_177439_3_) + { + System.arraycopy(p_177439_1_, i, this.blockBiomeArray, 0, this.blockBiomeArray.length); + int k1 = i + this.blockBiomeArray.length; + } + + for (int j1 = 0; j1 < this.storageArrays.length; ++j1) + { + if (this.storageArrays[j1] != null && (p_177439_2_ & 1 << j1) != 0) + { + this.storageArrays[j1].removeInvalidBlocks(); + } + } + + this.isLightPopulated = true; + this.isTerrainPopulated = true; + this.generateHeightMap(); + + for (TileEntity tileentity : this.chunkTileEntityMap.values()) + { + tileentity.updateContainingBlockInfo(); + } + } + + public BiomeGenBase getBiome(BlockPos pos, WorldChunkManager chunkManager) + { + int i = pos.getX() & 15; + int j = pos.getZ() & 15; + int k = this.blockBiomeArray[j << 4 | i] & 255; + + if (k == 255) + { + BiomeGenBase biomegenbase = chunkManager.getBiomeGenerator(pos, BiomeGenBase.plains); + k = biomegenbase.biomeID; + this.blockBiomeArray[j << 4 | i] = (byte)(k & 255); + } + + BiomeGenBase biomegenbase1 = BiomeGenBase.getBiome(k); + return biomegenbase1 == null ? BiomeGenBase.plains : biomegenbase1; + } + + /** + * Returns an array containing a 16x16 mapping on the X/Z of block positions in this Chunk to biome IDs. + */ + public byte[] getBiomeArray() + { + return this.blockBiomeArray; + } + + /** + * Accepts a 256-entry array that contains a 16x16 mapping on the X/Z plane of block positions in this Chunk to + * biome IDs. + */ + public void setBiomeArray(byte[] biomeArray) + { + if (this.blockBiomeArray.length != biomeArray.length) + { + logger.warn("Could not set level chunk biomes, array length is " + biomeArray.length + " instead of " + this.blockBiomeArray.length); + } + else + { + for (int i = 0; i < this.blockBiomeArray.length; ++i) + { + this.blockBiomeArray[i] = biomeArray[i]; + } + } + } + + /** + * Resets the relight check index to 0 for this Chunk. + */ + public void resetRelightChecks() + { + this.queuedLightChecks = 0; + } + + /** + * Called once-per-chunk-per-tick, and advances the round-robin relight check index by up to 8 blocks at a time. In + * a worst-case scenario, can potentially take up to 25.6 seconds, calculated via (4096/8)/20, to re-check all + * blocks in a chunk, which may explain lagging light updates on initial world generation. + */ + public void enqueueRelightChecks() + { + BlockPos blockpos = new BlockPos(this.xPosition << 4, 0, this.zPosition << 4); + + for (int i = 0; i < 8; ++i) + { + if (this.queuedLightChecks >= 4096) + { + return; + } + + int j = this.queuedLightChecks % 16; + int k = this.queuedLightChecks / 16 % 16; + int l = this.queuedLightChecks / 256; + ++this.queuedLightChecks; + + for (int i1 = 0; i1 < 16; ++i1) + { + BlockPos blockpos1 = blockpos.add(k, (j << 4) + i1, l); + boolean flag = i1 == 0 || i1 == 15 || k == 0 || k == 15 || l == 0 || l == 15; + + if (this.storageArrays[j] == null && flag || this.storageArrays[j] != null && this.storageArrays[j].getBlockByExtId(k, i1, l).getMaterial() == Material.air) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + BlockPos blockpos2 = blockpos1.offset(enumfacing); + + if (this.worldObj.getBlockState(blockpos2).getBlock().getLightValue() > 0) + { + this.worldObj.checkLight(blockpos2); + } + } + + this.worldObj.checkLight(blockpos1); + } + } + } + } + + public void func_150809_p() + { + this.isTerrainPopulated = true; + this.isLightPopulated = true; + BlockPos blockpos = new BlockPos(this.xPosition << 4, 0, this.zPosition << 4); + + if (!this.worldObj.provider.getHasNoSky()) + { + if (this.worldObj.isAreaLoaded(blockpos.add(-1, 0, -1), blockpos.add(16, this.worldObj.func_181545_F(), 16))) + { + label92: + + for (int i = 0; i < 16; ++i) + { + for (int j = 0; j < 16; ++j) + { + if (!this.func_150811_f(i, j)) + { + this.isLightPopulated = false; + break label92; + } + } + } + + if (this.isLightPopulated) + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + int k = ((EnumFacing) enumfacing).getAxisDirection() == EnumFacing.AxisDirection.POSITIVE ? 16 : 1; + this.worldObj.getChunkFromBlockCoords(blockpos.offset((EnumFacing) enumfacing, k)).func_180700_a(((EnumFacing) enumfacing).getOpposite()); + } + + this.func_177441_y(); + } + } + else + { + this.isLightPopulated = false; + } + } + } + + private void func_177441_y() + { + for (int i = 0; i < this.updateSkylightColumns.length; ++i) + { + this.updateSkylightColumns[i] = true; + } + + this.recheckGaps(false); + } + + private void func_180700_a(EnumFacing p_180700_1_) + { + if (this.isTerrainPopulated) + { + if (p_180700_1_ == EnumFacing.EAST) + { + for (int i = 0; i < 16; ++i) + { + this.func_150811_f(15, i); + } + } + else if (p_180700_1_ == EnumFacing.WEST) + { + for (int j = 0; j < 16; ++j) + { + this.func_150811_f(0, j); + } + } + else if (p_180700_1_ == EnumFacing.SOUTH) + { + for (int k = 0; k < 16; ++k) + { + this.func_150811_f(k, 15); + } + } + else if (p_180700_1_ == EnumFacing.NORTH) + { + for (int l = 0; l < 16; ++l) + { + this.func_150811_f(l, 0); + } + } + } + } + + private boolean func_150811_f(int x, int z) + { + int i = this.getTopFilledSegment(); + boolean flag = false; + boolean flag1 = false; + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos((this.xPosition << 4) + x, 0, (this.zPosition << 4) + z); + + for (int j = i + 16 - 1; j > this.worldObj.func_181545_F() || j > 0 && !flag1; --j) + { + blockpos$mutableblockpos.func_181079_c(blockpos$mutableblockpos.getX(), j, blockpos$mutableblockpos.getZ()); + int k = this.getBlockLightOpacity(blockpos$mutableblockpos); + + if (k == 255 && blockpos$mutableblockpos.getY() < this.worldObj.func_181545_F()) + { + flag1 = true; + } + + if (!flag && k > 0) + { + flag = true; + } + else if (flag && k == 0 && !this.worldObj.checkLight(blockpos$mutableblockpos)) + { + return false; + } + } + + for (int l = blockpos$mutableblockpos.getY(); l > 0; --l) + { + blockpos$mutableblockpos.func_181079_c(blockpos$mutableblockpos.getX(), l, blockpos$mutableblockpos.getZ()); + + if (this.getBlock(blockpos$mutableblockpos).getLightValue() > 0) + { + this.worldObj.checkLight(blockpos$mutableblockpos); + } + } + + return true; + } + + public boolean isLoaded() + { + return this.isChunkLoaded; + } + + public void setChunkLoaded(boolean loaded) + { + this.isChunkLoaded = loaded; + } + + public World getWorld() + { + return this.worldObj; + } + + public int[] getHeightMap() + { + return this.heightMap; + } + + public void setHeightMap(int[] newHeightMap) + { + if (this.heightMap.length != newHeightMap.length) + { + logger.warn("Could not set level chunk heightmap, array length is " + newHeightMap.length + " instead of " + this.heightMap.length); + } + else + { + for (int i = 0; i < this.heightMap.length; ++i) + { + this.heightMap[i] = newHeightMap[i]; + } + } + } + + public Map getTileEntityMap() + { + return this.chunkTileEntityMap; + } + + public ClassInheritanceMultiMap[] getEntityLists() + { + return this.entityLists; + } + + public boolean isTerrainPopulated() + { + return this.isTerrainPopulated; + } + + public void setTerrainPopulated(boolean terrainPopulated) + { + this.isTerrainPopulated = terrainPopulated; + } + + public boolean isLightPopulated() + { + return this.isLightPopulated; + } + + public void setLightPopulated(boolean lightPopulated) + { + this.isLightPopulated = lightPopulated; + } + + public void setModified(boolean modified) + { + this.isModified = modified; + } + + public void setHasEntities(boolean hasEntitiesIn) + { + this.hasEntities = hasEntitiesIn; + } + + public void setLastSaveTime(long saveTime) + { + this.lastSaveTime = saveTime; + } + + public int getLowestHeight() + { + return this.heightMapMinimum; + } + + public long getInhabitedTime() + { + return this.inhabitedTime; + } + + public void setInhabitedTime(long newInhabitedTime) + { + this.inhabitedTime = newInhabitedTime; + } + + public static enum EnumCreateEntityType + { + IMMEDIATE, + QUEUED, + CHECK; + } +} diff --git a/src/minecraft/net/minecraft/world/chunk/ChunkPrimer.java b/src/minecraft/net/minecraft/world/chunk/ChunkPrimer.java new file mode 100644 index 0000000..11bded9 --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/ChunkPrimer.java @@ -0,0 +1,48 @@ +package net.minecraft.world.chunk; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; + +public class ChunkPrimer +{ + private final short[] data = new short[65536]; + private final IBlockState defaultState = Blocks.air.getDefaultState(); + + public IBlockState getBlockState(int x, int y, int z) + { + int i = x << 12 | z << 8 | y; + return this.getBlockState(i); + } + + public IBlockState getBlockState(int index) + { + if (index >= 0 && index < this.data.length) + { + IBlockState iblockstate = (IBlockState)Block.BLOCK_STATE_IDS.getByValue(this.data[index]); + return iblockstate != null ? iblockstate : this.defaultState; + } + else + { + throw new IndexOutOfBoundsException("The coordinate is out of range"); + } + } + + public void setBlockState(int x, int y, int z, IBlockState state) + { + int i = x << 12 | z << 8 | y; + this.setBlockState(i, state); + } + + public void setBlockState(int index, IBlockState state) + { + if (index >= 0 && index < this.data.length) + { + this.data[index] = (short)Block.BLOCK_STATE_IDS.get(state); + } + else + { + throw new IndexOutOfBoundsException("The coordinate is out of range"); + } + } +} diff --git a/src/minecraft/net/minecraft/world/chunk/EmptyChunk.java b/src/minecraft/net/minecraft/world/chunk/EmptyChunk.java new file mode 100644 index 0000000..8d4f0f3 --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/EmptyChunk.java @@ -0,0 +1,182 @@ +package net.minecraft.world.chunk; + +import com.google.common.base.Predicate; +import java.util.List; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.World; + +public class EmptyChunk extends Chunk +{ + public EmptyChunk(World worldIn, int x, int z) + { + super(worldIn, x, z); + } + + /** + * Checks whether the chunk is at the X/Z location specified + */ + public boolean isAtLocation(int x, int z) + { + return x == this.xPosition && z == this.zPosition; + } + + /** + * Returns the value in the height map at this x, z coordinate in the chunk + */ + public int getHeightValue(int x, int z) + { + return 0; + } + + /** + * Generates the height map for a chunk from scratch + */ + public void generateHeightMap() + { + } + + /** + * Generates the initial skylight map for the chunk upon generation or load. + */ + public void generateSkylightMap() + { + } + + public Block getBlock(BlockPos pos) + { + return Blocks.air; + } + + public int getBlockLightOpacity(BlockPos pos) + { + return 255; + } + + public int getBlockMetadata(BlockPos pos) + { + return 0; + } + + public int getLightFor(EnumSkyBlock p_177413_1_, BlockPos pos) + { + return p_177413_1_.defaultLightValue; + } + + public void setLightFor(EnumSkyBlock p_177431_1_, BlockPos pos, int value) + { + } + + public int getLightSubtracted(BlockPos pos, int amount) + { + return 0; + } + + /** + * Adds an entity to the chunk. Args: entity + */ + public void addEntity(Entity entityIn) + { + } + + /** + * removes entity using its y chunk coordinate as its index + */ + public void removeEntity(Entity entityIn) + { + } + + /** + * Removes entity at the specified index from the entity array. + */ + public void removeEntityAtIndex(Entity entityIn, int p_76608_2_) + { + } + + public boolean canSeeSky(BlockPos pos) + { + return false; + } + + public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType p_177424_2_) + { + return null; + } + + public void addTileEntity(TileEntity tileEntityIn) + { + } + + public void addTileEntity(BlockPos pos, TileEntity tileEntityIn) + { + } + + public void removeTileEntity(BlockPos pos) + { + } + + /** + * Called when this Chunk is loaded by the ChunkProvider + */ + public void onChunkLoad() + { + } + + /** + * Called when this Chunk is unloaded by the ChunkProvider + */ + public void onChunkUnload() + { + } + + /** + * Sets the isModified flag for this Chunk + */ + public void setChunkModified() + { + } + + /** + * Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity. + */ + public void getEntitiesWithinAABBForEntity(Entity entityIn, AxisAlignedBB aabb, List listToFill, Predicate p_177414_4_) + { + } + + public void getEntitiesOfTypeWithinAAAB(Class entityClass, AxisAlignedBB aabb, List listToFill, Predicate p_177430_4_) + { + } + + /** + * Returns true if this Chunk needs to be saved + */ + public boolean needsSaving(boolean p_76601_1_) + { + return false; + } + + public Random getRandomWithSeed(long seed) + { + return new Random(this.getWorld().getSeed() + (long)(this.xPosition * this.xPosition * 4987142) + (long)(this.xPosition * 5947611) + (long)(this.zPosition * this.zPosition) * 4392871L + (long)(this.zPosition * 389711) ^ seed); + } + + public boolean isEmpty() + { + return true; + } + + /** + * Returns whether the ExtendedBlockStorages containing levels (in blocks) from arg 1 to arg 2 are fully empty + * (true) or not (false). + */ + public boolean getAreLevelsEmpty(int startY, int endY) + { + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/chunk/IChunkProvider.java b/src/minecraft/net/minecraft/world/chunk/IChunkProvider.java new file mode 100644 index 0000000..cb93b2e --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/IChunkProvider.java @@ -0,0 +1,66 @@ +package net.minecraft.world.chunk; + +import java.util.List; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; + +public interface IChunkProvider +{ + /** + * Checks to see if a chunk exists at x, z + */ + boolean chunkExists(int x, int z); + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + Chunk provideChunk(int x, int z); + + Chunk provideChunk(BlockPos blockPosIn); + + /** + * Populates chunk with ores etc etc + */ + void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_); + + boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_); + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + boolean saveChunks(boolean p_73151_1_, IProgressUpdate progressCallback); + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + boolean unloadQueuedChunks(); + + /** + * Returns if the IChunkProvider supports saving. + */ + boolean canSave(); + + /** + * Converts the instance data to a readable string. + */ + String makeString(); + + List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos); + + BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position); + + int getLoadedChunkCount(); + + void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_); + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + void saveExtraData(); +} diff --git a/src/minecraft/net/minecraft/world/chunk/NibbleArray.java b/src/minecraft/net/minecraft/world/chunk/NibbleArray.java new file mode 100644 index 0000000..722ee45 --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/NibbleArray.java @@ -0,0 +1,81 @@ +package net.minecraft.world.chunk; + +public class NibbleArray +{ + /** + * Byte array of data stored in this holder. Possibly a light map or some chunk data. Data is accessed in 4-bit + * pieces. + */ + private final byte[] data; + + public NibbleArray() + { + this.data = new byte[2048]; + } + + public NibbleArray(byte[] storageArray) + { + this.data = storageArray; + + if (storageArray.length != 2048) + { + throw new IllegalArgumentException("ChunkNibbleArrays should be 2048 bytes not: " + storageArray.length); + } + } + + /** + * Returns the nibble of data corresponding to the passed in x, y, z. y is at most 6 bits, z is at most 4. + */ + public int get(int x, int y, int z) + { + return this.getFromIndex(this.getCoordinateIndex(x, y, z)); + } + + /** + * Arguments are x, y, z, val. Sets the nibble of data at x << 11 | z << 7 | y to val. + */ + public void set(int x, int y, int z, int value) + { + this.setIndex(this.getCoordinateIndex(x, y, z), value); + } + + private int getCoordinateIndex(int x, int y, int z) + { + return y << 8 | z << 4 | x; + } + + public int getFromIndex(int index) + { + int i = this.getNibbleIndex(index); + return this.isLowerNibble(index) ? this.data[i] & 15 : this.data[i] >> 4 & 15; + } + + public void setIndex(int index, int value) + { + int i = this.getNibbleIndex(index); + + if (this.isLowerNibble(index)) + { + this.data[i] = (byte)(this.data[i] & 240 | value & 15); + } + else + { + this.data[i] = (byte)(this.data[i] & 15 | (value & 15) << 4); + } + } + + private boolean isLowerNibble(int index) + { + return (index & 1) == 0; + } + + private int getNibbleIndex(int index) + { + return index >> 1; + } + + public byte[] getData() + { + return this.data; + } +} diff --git a/src/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java b/src/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java new file mode 100644 index 0000000..b6b4e03 --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java @@ -0,0 +1,483 @@ +package net.minecraft.world.chunk.storage; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.NextTickListEntry; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.NibbleArray; +import net.minecraft.world.storage.IThreadedFileIO; +import net.minecraft.world.storage.ThreadedFileIOBase; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class AnvilChunkLoader implements IChunkLoader, IThreadedFileIO +{ + private static final Logger logger = LogManager.getLogger(); + private Map chunksToRemove = new ConcurrentHashMap(); + private Set pendingAnvilChunksCoordinates = Collections.newSetFromMap(new ConcurrentHashMap()); + + /** Save directory for chunks using the Anvil format */ + private final File chunkSaveLocation; + private boolean field_183014_e = false; + + public AnvilChunkLoader(File chunkSaveLocationIn) + { + this.chunkSaveLocation = chunkSaveLocationIn; + } + + /** + * Loads the specified(XZ) chunk into the specified world. + */ + public Chunk loadChunk(World worldIn, int x, int z) throws IOException + { + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z); + NBTTagCompound nbttagcompound = (NBTTagCompound)this.chunksToRemove.get(chunkcoordintpair); + + if (nbttagcompound == null) + { + DataInputStream datainputstream = RegionFileCache.getChunkInputStream(this.chunkSaveLocation, x, z); + + if (datainputstream == null) + { + return null; + } + + nbttagcompound = CompressedStreamTools.read(datainputstream); + } + + return this.checkedReadChunkFromNBT(worldIn, x, z, nbttagcompound); + } + + /** + * Wraps readChunkFromNBT. Checks the coordinates and several NBT tags. + */ + protected Chunk checkedReadChunkFromNBT(World worldIn, int x, int z, NBTTagCompound p_75822_4_) + { + if (!p_75822_4_.hasKey("Level", 10)) + { + logger.error("Chunk file at " + x + "," + z + " is missing level data, skipping"); + return null; + } + else + { + NBTTagCompound nbttagcompound = p_75822_4_.getCompoundTag("Level"); + + if (!nbttagcompound.hasKey("Sections", 9)) + { + logger.error("Chunk file at " + x + "," + z + " is missing block data, skipping"); + return null; + } + else + { + Chunk chunk = this.readChunkFromNBT(worldIn, nbttagcompound); + + if (!chunk.isAtLocation(x, z)) + { + logger.error("Chunk file at " + x + "," + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + chunk.xPosition + ", " + chunk.zPosition + ")"); + nbttagcompound.setInteger("xPos", x); + nbttagcompound.setInteger("zPos", z); + chunk = this.readChunkFromNBT(worldIn, nbttagcompound); + } + + return chunk; + } + } + } + + public void saveChunk(World worldIn, Chunk chunkIn) throws MinecraftException, IOException + { + worldIn.checkSessionLock(); + + try + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound.setTag("Level", nbttagcompound1); + this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1); + this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound); + } + catch (Exception exception) + { + logger.error((String)"Failed to save chunk", (Throwable)exception); + } + } + + protected void addChunkToPending(ChunkCoordIntPair p_75824_1_, NBTTagCompound p_75824_2_) + { + if (!this.pendingAnvilChunksCoordinates.contains(p_75824_1_)) + { + this.chunksToRemove.put(p_75824_1_, p_75824_2_); + } + + ThreadedFileIOBase.getThreadedIOInstance().queueIO(this); + } + + /** + * Returns a boolean stating if the write was unsuccessful. + */ + public boolean writeNextIO() + { + if (this.chunksToRemove.isEmpty()) + { + if (this.field_183014_e) + { + logger.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", new Object[] {this.chunkSaveLocation.getName()}); + } + + return false; + } + else + { + ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair)this.chunksToRemove.keySet().iterator().next(); + boolean lvt_3_1_; + + try + { + this.pendingAnvilChunksCoordinates.add(chunkcoordintpair); + NBTTagCompound nbttagcompound = (NBTTagCompound)this.chunksToRemove.remove(chunkcoordintpair); + + if (nbttagcompound != null) + { + try + { + this.func_183013_b(chunkcoordintpair, nbttagcompound); + } + catch (Exception exception) + { + logger.error((String)"Failed to save chunk", (Throwable)exception); + } + } + + lvt_3_1_ = true; + } + finally + { + this.pendingAnvilChunksCoordinates.remove(chunkcoordintpair); + } + + return lvt_3_1_; + } + } + + private void func_183013_b(ChunkCoordIntPair p_183013_1_, NBTTagCompound p_183013_2_) throws IOException + { + DataOutputStream dataoutputstream = RegionFileCache.getChunkOutputStream(this.chunkSaveLocation, p_183013_1_.chunkXPos, p_183013_1_.chunkZPos); + CompressedStreamTools.write(p_183013_2_, dataoutputstream); + dataoutputstream.close(); + } + + /** + * Save extra data associated with this Chunk not normally saved during autosave, only during chunk unload. + * Currently unused. + */ + public void saveExtraChunkData(World worldIn, Chunk chunkIn) throws IOException + { + } + + /** + * Called every World.tick() + */ + public void chunkTick() + { + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unused. + */ + public void saveExtraData() + { + try + { + this.field_183014_e = true; + + while (true) + { + if (this.writeNextIO()) + { + continue; + } + } + } + finally + { + this.field_183014_e = false; + } + } + + /** + * Writes the Chunk passed as an argument to the NBTTagCompound also passed, using the World argument to retrieve + * the Chunk's last update time. + */ + private void writeChunkToNBT(Chunk chunkIn, World worldIn, NBTTagCompound p_75820_3_) + { + p_75820_3_.setByte("V", (byte)1); + p_75820_3_.setInteger("xPos", chunkIn.xPosition); + p_75820_3_.setInteger("zPos", chunkIn.zPosition); + p_75820_3_.setLong("LastUpdate", worldIn.getTotalWorldTime()); + p_75820_3_.setIntArray("HeightMap", chunkIn.getHeightMap()); + p_75820_3_.setBoolean("TerrainPopulated", chunkIn.isTerrainPopulated()); + p_75820_3_.setBoolean("LightPopulated", chunkIn.isLightPopulated()); + p_75820_3_.setLong("InhabitedTime", chunkIn.getInhabitedTime()); + ExtendedBlockStorage[] aextendedblockstorage = chunkIn.getBlockStorageArray(); + NBTTagList nbttaglist = new NBTTagList(); + boolean flag = !worldIn.provider.getHasNoSky(); + + for (ExtendedBlockStorage extendedblockstorage : aextendedblockstorage) + { + if (extendedblockstorage != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Y", (byte)(extendedblockstorage.getYLocation() >> 4 & 255)); + byte[] abyte = new byte[extendedblockstorage.getData().length]; + NibbleArray nibblearray = new NibbleArray(); + NibbleArray nibblearray1 = null; + + for (int i = 0; i < extendedblockstorage.getData().length; ++i) + { + char c0 = extendedblockstorage.getData()[i]; + int j = i & 15; + int k = i >> 8 & 15; + int l = i >> 4 & 15; + + if (c0 >> 12 != 0) + { + if (nibblearray1 == null) + { + nibblearray1 = new NibbleArray(); + } + + nibblearray1.set(j, k, l, c0 >> 12); + } + + abyte[i] = (byte)(c0 >> 4 & 255); + nibblearray.set(j, k, l, c0 & 15); + } + + nbttagcompound.setByteArray("Blocks", abyte); + nbttagcompound.setByteArray("Data", nibblearray.getData()); + + if (nibblearray1 != null) + { + nbttagcompound.setByteArray("Add", nibblearray1.getData()); + } + + nbttagcompound.setByteArray("BlockLight", extendedblockstorage.getBlocklightArray().getData()); + + if (flag) + { + nbttagcompound.setByteArray("SkyLight", extendedblockstorage.getSkylightArray().getData()); + } + else + { + nbttagcompound.setByteArray("SkyLight", new byte[extendedblockstorage.getBlocklightArray().getData().length]); + } + + nbttaglist.appendTag(nbttagcompound); + } + } + + p_75820_3_.setTag("Sections", nbttaglist); + p_75820_3_.setByteArray("Biomes", chunkIn.getBiomeArray()); + chunkIn.setHasEntities(false); + NBTTagList nbttaglist1 = new NBTTagList(); + + for (int i1 = 0; i1 < chunkIn.getEntityLists().length; ++i1) + { + for (Entity entity : chunkIn.getEntityLists()[i1]) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + + if (entity.writeToNBTOptional(nbttagcompound1)) + { + chunkIn.setHasEntities(true); + nbttaglist1.appendTag(nbttagcompound1); + } + } + } + + p_75820_3_.setTag("Entities", nbttaglist1); + NBTTagList nbttaglist2 = new NBTTagList(); + + for (TileEntity tileentity : chunkIn.getTileEntityMap().values()) + { + NBTTagCompound nbttagcompound2 = new NBTTagCompound(); + tileentity.writeToNBT(nbttagcompound2); + nbttaglist2.appendTag(nbttagcompound2); + } + + p_75820_3_.setTag("TileEntities", nbttaglist2); + List list = worldIn.getPendingBlockUpdates(chunkIn, false); + + if (list != null) + { + long j1 = worldIn.getTotalWorldTime(); + NBTTagList nbttaglist3 = new NBTTagList(); + + for (NextTickListEntry nextticklistentry : list) + { + NBTTagCompound nbttagcompound3 = new NBTTagCompound(); + ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(nextticklistentry.getBlock()); + nbttagcompound3.setString("i", resourcelocation == null ? "" : resourcelocation.toString()); + nbttagcompound3.setInteger("x", nextticklistentry.position.getX()); + nbttagcompound3.setInteger("y", nextticklistentry.position.getY()); + nbttagcompound3.setInteger("z", nextticklistentry.position.getZ()); + nbttagcompound3.setInteger("t", (int)(nextticklistentry.scheduledTime - j1)); + nbttagcompound3.setInteger("p", nextticklistentry.priority); + nbttaglist3.appendTag(nbttagcompound3); + } + + p_75820_3_.setTag("TileTicks", nbttaglist3); + } + } + + /** + * Reads the data stored in the passed NBTTagCompound and creates a Chunk with that data in the passed World. + * Returns the created Chunk. + */ + private Chunk readChunkFromNBT(World worldIn, NBTTagCompound p_75823_2_) + { + int i = p_75823_2_.getInteger("xPos"); + int j = p_75823_2_.getInteger("zPos"); + Chunk chunk = new Chunk(worldIn, i, j); + chunk.setHeightMap(p_75823_2_.getIntArray("HeightMap")); + chunk.setTerrainPopulated(p_75823_2_.getBoolean("TerrainPopulated")); + chunk.setLightPopulated(p_75823_2_.getBoolean("LightPopulated")); + chunk.setInhabitedTime(p_75823_2_.getLong("InhabitedTime")); + NBTTagList nbttaglist = p_75823_2_.getTagList("Sections", 10); + int k = 16; + ExtendedBlockStorage[] aextendedblockstorage = new ExtendedBlockStorage[k]; + boolean flag = !worldIn.provider.getHasNoSky(); + + for (int l = 0; l < nbttaglist.tagCount(); ++l) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(l); + int i1 = nbttagcompound.getByte("Y"); + ExtendedBlockStorage extendedblockstorage = new ExtendedBlockStorage(i1 << 4, flag); + byte[] abyte = nbttagcompound.getByteArray("Blocks"); + NibbleArray nibblearray = new NibbleArray(nbttagcompound.getByteArray("Data")); + NibbleArray nibblearray1 = nbttagcompound.hasKey("Add", 7) ? new NibbleArray(nbttagcompound.getByteArray("Add")) : null; + char[] achar = new char[abyte.length]; + + for (int j1 = 0; j1 < achar.length; ++j1) + { + int k1 = j1 & 15; + int l1 = j1 >> 8 & 15; + int i2 = j1 >> 4 & 15; + int j2 = nibblearray1 != null ? nibblearray1.get(k1, l1, i2) : 0; + achar[j1] = (char)(j2 << 12 | (abyte[j1] & 255) << 4 | nibblearray.get(k1, l1, i2)); + } + + extendedblockstorage.setData(achar); + extendedblockstorage.setBlocklightArray(new NibbleArray(nbttagcompound.getByteArray("BlockLight"))); + + if (flag) + { + extendedblockstorage.setSkylightArray(new NibbleArray(nbttagcompound.getByteArray("SkyLight"))); + } + + extendedblockstorage.removeInvalidBlocks(); + aextendedblockstorage[i1] = extendedblockstorage; + } + + chunk.setStorageArrays(aextendedblockstorage); + + if (p_75823_2_.hasKey("Biomes", 7)) + { + chunk.setBiomeArray(p_75823_2_.getByteArray("Biomes")); + } + + NBTTagList nbttaglist1 = p_75823_2_.getTagList("Entities", 10); + + if (nbttaglist1 != null) + { + for (int k2 = 0; k2 < nbttaglist1.tagCount(); ++k2) + { + NBTTagCompound nbttagcompound1 = nbttaglist1.getCompoundTagAt(k2); + Entity entity = EntityList.createEntityFromNBT(nbttagcompound1, worldIn); + chunk.setHasEntities(true); + + if (entity != null) + { + chunk.addEntity(entity); + Entity entity1 = entity; + + for (NBTTagCompound nbttagcompound4 = nbttagcompound1; nbttagcompound4.hasKey("Riding", 10); nbttagcompound4 = nbttagcompound4.getCompoundTag("Riding")) + { + Entity entity2 = EntityList.createEntityFromNBT(nbttagcompound4.getCompoundTag("Riding"), worldIn); + + if (entity2 != null) + { + chunk.addEntity(entity2); + entity1.mountEntity(entity2); + } + + entity1 = entity2; + } + } + } + } + + NBTTagList nbttaglist2 = p_75823_2_.getTagList("TileEntities", 10); + + if (nbttaglist2 != null) + { + for (int l2 = 0; l2 < nbttaglist2.tagCount(); ++l2) + { + NBTTagCompound nbttagcompound2 = nbttaglist2.getCompoundTagAt(l2); + TileEntity tileentity = TileEntity.createAndLoadEntity(nbttagcompound2); + + if (tileentity != null) + { + chunk.addTileEntity(tileentity); + } + } + } + + if (p_75823_2_.hasKey("TileTicks", 9)) + { + NBTTagList nbttaglist3 = p_75823_2_.getTagList("TileTicks", 10); + + if (nbttaglist3 != null) + { + for (int i3 = 0; i3 < nbttaglist3.tagCount(); ++i3) + { + NBTTagCompound nbttagcompound3 = nbttaglist3.getCompoundTagAt(i3); + Block block; + + if (nbttagcompound3.hasKey("i", 8)) + { + block = Block.getBlockFromName(nbttagcompound3.getString("i")); + } + else + { + block = Block.getBlockById(nbttagcompound3.getInteger("i")); + } + + worldIn.scheduleBlockUpdate(new BlockPos(nbttagcompound3.getInteger("x"), nbttagcompound3.getInteger("y"), nbttagcompound3.getInteger("z")), block, nbttagcompound3.getInteger("t"), nbttagcompound3.getInteger("p")); + } + } + } + + return chunk; + } +} diff --git a/src/minecraft/net/minecraft/world/chunk/storage/AnvilSaveConverter.java b/src/minecraft/net/minecraft/world/chunk/storage/AnvilSaveConverter.java new file mode 100644 index 0000000..0982e0c --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/storage/AnvilSaveConverter.java @@ -0,0 +1,290 @@ +package net.minecraft.world.chunk.storage; + +import com.google.common.collect.Lists; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import net.minecraft.client.AnvilConverterException; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.world.WorldType; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.biome.WorldChunkManagerHell; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.SaveFormatComparator; +import net.minecraft.world.storage.SaveFormatOld; +import net.minecraft.world.storage.WorldInfo; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class AnvilSaveConverter extends SaveFormatOld +{ + private static final Logger logger = LogManager.getLogger(); + + public AnvilSaveConverter(File p_i2144_1_) + { + super(p_i2144_1_); + } + + /** + * Returns the name of the save format. + */ + public String getName() + { + return "Anvil"; + } + + public List getSaveList() throws AnvilConverterException + { + if (this.savesDirectory != null && this.savesDirectory.exists() && this.savesDirectory.isDirectory()) + { + List list = Lists.newArrayList(); + File[] afile = this.savesDirectory.listFiles(); + + for (File file1 : afile) + { + if (file1.isDirectory()) + { + String s = file1.getName(); + WorldInfo worldinfo = this.getWorldInfo(s); + + if (worldinfo != null && (worldinfo.getSaveVersion() == 19132 || worldinfo.getSaveVersion() == 19133)) + { + boolean flag = worldinfo.getSaveVersion() != this.getSaveVersion(); + String s1 = worldinfo.getWorldName(); + + if (StringUtils.isEmpty(s1)) + { + s1 = s; + } + + long i = 0L; + list.add(new SaveFormatComparator(s, s1, worldinfo.getLastTimePlayed(), i, worldinfo.getGameType(), flag, worldinfo.isHardcoreModeEnabled(), worldinfo.areCommandsAllowed())); + } + } + } + + return list; + } + else + { + throw new AnvilConverterException("Unable to read or access folder where game worlds are saved!"); + } + } + + protected int getSaveVersion() + { + return 19133; + } + + public void flushCache() + { + RegionFileCache.clearRegionFileReferences(); + } + + /** + * Returns back a loader for the specified save directory + */ + public ISaveHandler getSaveLoader(String saveName, boolean storePlayerdata) + { + return new AnvilSaveHandler(this.savesDirectory, saveName, storePlayerdata); + } + + public boolean func_154334_a(String saveName) + { + WorldInfo worldinfo = this.getWorldInfo(saveName); + return worldinfo != null && worldinfo.getSaveVersion() == 19132; + } + + /** + * gets if the map is old chunk saving (true) or McRegion (false) + */ + public boolean isOldMapFormat(String saveName) + { + WorldInfo worldinfo = this.getWorldInfo(saveName); + return worldinfo != null && worldinfo.getSaveVersion() != this.getSaveVersion(); + } + + /** + * converts the map to mcRegion + */ + public boolean convertMapFormat(String filename, IProgressUpdate progressCallback) + { + progressCallback.setLoadingProgress(0); + List list = Lists.newArrayList(); + List list1 = Lists.newArrayList(); + List list2 = Lists.newArrayList(); + File file1 = new File(this.savesDirectory, filename); + File file2 = new File(file1, "DIM-1"); + File file3 = new File(file1, "DIM1"); + logger.info("Scanning folders..."); + this.addRegionFilesToCollection(file1, list); + + if (file2.exists()) + { + this.addRegionFilesToCollection(file2, list1); + } + + if (file3.exists()) + { + this.addRegionFilesToCollection(file3, list2); + } + + int i = list.size() + list1.size() + list2.size(); + logger.info("Total conversion count is " + i); + WorldInfo worldinfo = this.getWorldInfo(filename); + WorldChunkManager worldchunkmanager = null; + + if (worldinfo.getTerrainType() == WorldType.FLAT) + { + worldchunkmanager = new WorldChunkManagerHell(BiomeGenBase.plains, 0.5F); + } + else + { + worldchunkmanager = new WorldChunkManager(worldinfo.getSeed(), worldinfo.getTerrainType(), worldinfo.getGeneratorOptions()); + } + + this.convertFile(new File(file1, "region"), list, worldchunkmanager, 0, i, progressCallback); + this.convertFile(new File(file2, "region"), list1, new WorldChunkManagerHell(BiomeGenBase.hell, 0.0F), list.size(), i, progressCallback); + this.convertFile(new File(file3, "region"), list2, new WorldChunkManagerHell(BiomeGenBase.sky, 0.0F), list.size() + list1.size(), i, progressCallback); + worldinfo.setSaveVersion(19133); + + if (worldinfo.getTerrainType() == WorldType.DEFAULT_1_1) + { + worldinfo.setTerrainType(WorldType.DEFAULT); + } + + this.createFile(filename); + ISaveHandler isavehandler = this.getSaveLoader(filename, false); + isavehandler.saveWorldInfo(worldinfo); + return true; + } + + /** + * par: filename for the level.dat_mcr backup + */ + private void createFile(String filename) + { + File file1 = new File(this.savesDirectory, filename); + + if (!file1.exists()) + { + logger.warn("Unable to create level.dat_mcr backup"); + } + else + { + File file2 = new File(file1, "level.dat"); + + if (!file2.exists()) + { + logger.warn("Unable to create level.dat_mcr backup"); + } + else + { + File file3 = new File(file1, "level.dat_mcr"); + + if (!file2.renameTo(file3)) + { + logger.warn("Unable to create level.dat_mcr backup"); + } + } + } + } + + private void convertFile(File p_75813_1_, Iterable p_75813_2_, WorldChunkManager p_75813_3_, int p_75813_4_, int p_75813_5_, IProgressUpdate p_75813_6_) + { + for (File file1 : p_75813_2_) + { + this.convertChunks(p_75813_1_, file1, p_75813_3_, p_75813_4_, p_75813_5_, p_75813_6_); + ++p_75813_4_; + int i = (int)Math.round(100.0D * (double)p_75813_4_ / (double)p_75813_5_); + p_75813_6_.setLoadingProgress(i); + } + } + + /** + * copies a 32x32 chunk set from par2File to par1File, via AnvilConverterData + */ + private void convertChunks(File p_75811_1_, File p_75811_2_, WorldChunkManager p_75811_3_, int p_75811_4_, int p_75811_5_, IProgressUpdate progressCallback) + { + try + { + String s = p_75811_2_.getName(); + RegionFile regionfile = new RegionFile(p_75811_2_); + RegionFile regionfile1 = new RegionFile(new File(p_75811_1_, s.substring(0, s.length() - ".mcr".length()) + ".mca")); + + for (int i = 0; i < 32; ++i) + { + for (int j = 0; j < 32; ++j) + { + if (regionfile.isChunkSaved(i, j) && !regionfile1.isChunkSaved(i, j)) + { + DataInputStream datainputstream = regionfile.getChunkDataInputStream(i, j); + + if (datainputstream == null) + { + logger.warn("Failed to fetch input stream"); + } + else + { + NBTTagCompound nbttagcompound = CompressedStreamTools.read(datainputstream); + datainputstream.close(); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Level"); + ChunkLoader.AnvilConverterData chunkloader$anvilconverterdata = ChunkLoader.load(nbttagcompound1); + NBTTagCompound nbttagcompound2 = new NBTTagCompound(); + NBTTagCompound nbttagcompound3 = new NBTTagCompound(); + nbttagcompound2.setTag("Level", nbttagcompound3); + ChunkLoader.convertToAnvilFormat(chunkloader$anvilconverterdata, nbttagcompound3, p_75811_3_); + DataOutputStream dataoutputstream = regionfile1.getChunkDataOutputStream(i, j); + CompressedStreamTools.write(nbttagcompound2, dataoutputstream); + dataoutputstream.close(); + } + } + } + + int k = (int)Math.round(100.0D * (double)(p_75811_4_ * 1024) / (double)(p_75811_5_ * 1024)); + int l = (int)Math.round(100.0D * (double)((i + 1) * 32 + p_75811_4_ * 1024) / (double)(p_75811_5_ * 1024)); + + if (l > k) + { + progressCallback.setLoadingProgress(l); + } + } + + regionfile.close(); + regionfile1.close(); + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + + /** + * filters the files in the par1 directory, and adds them to the par2 collections + */ + private void addRegionFilesToCollection(File worldDir, Collection collection) + { + File file1 = new File(worldDir, "region"); + File[] afile = file1.listFiles(new FilenameFilter() + { + public boolean accept(File p_accept_1_, String p_accept_2_) + { + return p_accept_2_.endsWith(".mcr"); + } + }); + + if (afile != null) + { + Collections.addAll(collection, afile); + } + } +} diff --git a/src/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java b/src/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java new file mode 100644 index 0000000..61ce5a6 --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/storage/AnvilSaveHandler.java @@ -0,0 +1,69 @@ +package net.minecraft.world.chunk.storage; + +import java.io.File; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldProviderEnd; +import net.minecraft.world.WorldProviderHell; +import net.minecraft.world.storage.SaveHandler; +import net.minecraft.world.storage.ThreadedFileIOBase; +import net.minecraft.world.storage.WorldInfo; + +public class AnvilSaveHandler extends SaveHandler +{ + public AnvilSaveHandler(File savesDirectory, String p_i2142_2_, boolean storePlayerdata) + { + super(savesDirectory, p_i2142_2_, storePlayerdata); + } + + /** + * initializes and returns the chunk loader for the specified world provider + */ + public IChunkLoader getChunkLoader(WorldProvider provider) + { + File file1 = this.getWorldDirectory(); + + if (provider instanceof WorldProviderHell) + { + File file3 = new File(file1, "DIM-1"); + file3.mkdirs(); + return new AnvilChunkLoader(file3); + } + else if (provider instanceof WorldProviderEnd) + { + File file2 = new File(file1, "DIM1"); + file2.mkdirs(); + return new AnvilChunkLoader(file2); + } + else + { + return new AnvilChunkLoader(file1); + } + } + + /** + * Saves the given World Info with the given NBTTagCompound as the Player. + */ + public void saveWorldInfoWithPlayer(WorldInfo worldInformation, NBTTagCompound tagCompound) + { + worldInformation.setSaveVersion(19133); + super.saveWorldInfoWithPlayer(worldInformation, tagCompound); + } + + /** + * Called to flush all changes to disk, waiting for them to complete. + */ + public void flush() + { + try + { + ThreadedFileIOBase.getThreadedIOInstance().waitForFinish(); + } + catch (InterruptedException interruptedexception) + { + interruptedexception.printStackTrace(); + } + + RegionFileCache.clearRegionFileReferences(); + } +} diff --git a/src/minecraft/net/minecraft/world/chunk/storage/ChunkLoader.java b/src/minecraft/net/minecraft/world/chunk/storage/ChunkLoader.java new file mode 100644 index 0000000..40a6043 --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/storage/ChunkLoader.java @@ -0,0 +1,154 @@ +package net.minecraft.world.chunk.storage; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.BlockPos; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.chunk.NibbleArray; + +public class ChunkLoader +{ + public static ChunkLoader.AnvilConverterData load(NBTTagCompound nbt) + { + int i = nbt.getInteger("xPos"); + int j = nbt.getInteger("zPos"); + ChunkLoader.AnvilConverterData chunkloader$anvilconverterdata = new ChunkLoader.AnvilConverterData(i, j); + chunkloader$anvilconverterdata.blocks = nbt.getByteArray("Blocks"); + chunkloader$anvilconverterdata.data = new NibbleArrayReader(nbt.getByteArray("Data"), 7); + chunkloader$anvilconverterdata.skyLight = new NibbleArrayReader(nbt.getByteArray("SkyLight"), 7); + chunkloader$anvilconverterdata.blockLight = new NibbleArrayReader(nbt.getByteArray("BlockLight"), 7); + chunkloader$anvilconverterdata.heightmap = nbt.getByteArray("HeightMap"); + chunkloader$anvilconverterdata.terrainPopulated = nbt.getBoolean("TerrainPopulated"); + chunkloader$anvilconverterdata.entities = nbt.getTagList("Entities", 10); + chunkloader$anvilconverterdata.tileEntities = nbt.getTagList("TileEntities", 10); + chunkloader$anvilconverterdata.tileTicks = nbt.getTagList("TileTicks", 10); + + try + { + chunkloader$anvilconverterdata.lastUpdated = nbt.getLong("LastUpdate"); + } + catch (ClassCastException var5) + { + chunkloader$anvilconverterdata.lastUpdated = (long)nbt.getInteger("LastUpdate"); + } + + return chunkloader$anvilconverterdata; + } + + public static void convertToAnvilFormat(ChunkLoader.AnvilConverterData p_76690_0_, NBTTagCompound p_76690_1_, WorldChunkManager p_76690_2_) + { + p_76690_1_.setInteger("xPos", p_76690_0_.x); + p_76690_1_.setInteger("zPos", p_76690_0_.z); + p_76690_1_.setLong("LastUpdate", p_76690_0_.lastUpdated); + int[] aint = new int[p_76690_0_.heightmap.length]; + + for (int i = 0; i < p_76690_0_.heightmap.length; ++i) + { + aint[i] = p_76690_0_.heightmap[i]; + } + + p_76690_1_.setIntArray("HeightMap", aint); + p_76690_1_.setBoolean("TerrainPopulated", p_76690_0_.terrainPopulated); + NBTTagList nbttaglist = new NBTTagList(); + + for (int j = 0; j < 8; ++j) + { + boolean flag = true; + + for (int k = 0; k < 16 && flag; ++k) + { + for (int l = 0; l < 16 && flag; ++l) + { + for (int i1 = 0; i1 < 16; ++i1) + { + int j1 = k << 11 | i1 << 7 | l + (j << 4); + int k1 = p_76690_0_.blocks[j1]; + + if (k1 != 0) + { + flag = false; + break; + } + } + } + } + + if (!flag) + { + byte[] abyte1 = new byte[4096]; + NibbleArray nibblearray = new NibbleArray(); + NibbleArray nibblearray1 = new NibbleArray(); + NibbleArray nibblearray2 = new NibbleArray(); + + for (int j3 = 0; j3 < 16; ++j3) + { + for (int l1 = 0; l1 < 16; ++l1) + { + for (int i2 = 0; i2 < 16; ++i2) + { + int j2 = j3 << 11 | i2 << 7 | l1 + (j << 4); + int k2 = p_76690_0_.blocks[j2]; + abyte1[l1 << 8 | i2 << 4 | j3] = (byte)(k2 & 255); + nibblearray.set(j3, l1, i2, p_76690_0_.data.get(j3, l1 + (j << 4), i2)); + nibblearray1.set(j3, l1, i2, p_76690_0_.skyLight.get(j3, l1 + (j << 4), i2)); + nibblearray2.set(j3, l1, i2, p_76690_0_.blockLight.get(j3, l1 + (j << 4), i2)); + } + } + } + + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setByte("Y", (byte)(j & 255)); + nbttagcompound.setByteArray("Blocks", abyte1); + nbttagcompound.setByteArray("Data", nibblearray.getData()); + nbttagcompound.setByteArray("SkyLight", nibblearray1.getData()); + nbttagcompound.setByteArray("BlockLight", nibblearray2.getData()); + nbttaglist.appendTag(nbttagcompound); + } + } + + p_76690_1_.setTag("Sections", nbttaglist); + byte[] abyte = new byte[256]; + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int l2 = 0; l2 < 16; ++l2) + { + for (int i3 = 0; i3 < 16; ++i3) + { + blockpos$mutableblockpos.func_181079_c(p_76690_0_.x << 4 | l2, 0, p_76690_0_.z << 4 | i3); + abyte[i3 << 4 | l2] = (byte)(p_76690_2_.getBiomeGenerator(blockpos$mutableblockpos, BiomeGenBase.field_180279_ad).biomeID & 255); + } + } + + p_76690_1_.setByteArray("Biomes", abyte); + p_76690_1_.setTag("Entities", p_76690_0_.entities); + p_76690_1_.setTag("TileEntities", p_76690_0_.tileEntities); + + if (p_76690_0_.tileTicks != null) + { + p_76690_1_.setTag("TileTicks", p_76690_0_.tileTicks); + } + } + + public static class AnvilConverterData + { + public long lastUpdated; + public boolean terrainPopulated; + public byte[] heightmap; + public NibbleArrayReader blockLight; + public NibbleArrayReader skyLight; + public NibbleArrayReader data; + public byte[] blocks; + public NBTTagList entities; + public NBTTagList tileEntities; + public NBTTagList tileTicks; + public final int x; + public final int z; + + public AnvilConverterData(int p_i1999_1_, int p_i1999_2_) + { + this.x = p_i1999_1_; + this.z = p_i1999_2_; + } + } +} diff --git a/src/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java b/src/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java new file mode 100644 index 0000000..fe95d5b --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/storage/ExtendedBlockStorage.java @@ -0,0 +1,250 @@ +package net.minecraft.world.chunk.storage; + +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.world.chunk.NibbleArray; +import optifine.Reflector; + +public class ExtendedBlockStorage +{ + /** + * Contains the bottom-most Y block represented by this ExtendedBlockStorage. Typically a multiple of 16. + */ + private int yBase; + + /** + * A total count of the number of non-air blocks in this block storage's Chunk. + */ + private int blockRefCount; + + /** + * Contains the number of blocks in this block storage's parent chunk that require random ticking. Used to cull the + * Chunk from random tick updates for performance reasons. + */ + private int tickRefCount; + private char[] data; + + /** The NibbleArray containing a block of Block-light data. */ + private NibbleArray blocklightArray; + + /** The NibbleArray containing a block of Sky-light data. */ + private NibbleArray skylightArray; + private static final String __OBFID = "CL_00000375"; + + public ExtendedBlockStorage(int y, boolean storeSkylight) + { + this.yBase = y; + this.data = new char[4096]; + this.blocklightArray = new NibbleArray(); + + if (storeSkylight) + { + this.skylightArray = new NibbleArray(); + } + } + + public IBlockState get(int x, int y, int z) + { + IBlockState iblockstate = (IBlockState)Block.BLOCK_STATE_IDS.getByValue(this.data[y << 8 | z << 4 | x]); + return iblockstate != null ? iblockstate : Blocks.air.getDefaultState(); + } + + public void set(int x, int y, int z, IBlockState state) + { + if (Reflector.IExtendedBlockState.isInstance(state)) + { + state = (IBlockState)Reflector.call(state, Reflector.IExtendedBlockState_getClean, new Object[0]); + } + + IBlockState iblockstate = this.get(x, y, z); + Block block = iblockstate.getBlock(); + Block block1 = state.getBlock(); + + if (block != Blocks.air) + { + --this.blockRefCount; + + if (block.getTickRandomly()) + { + --this.tickRefCount; + } + } + + if (block1 != Blocks.air) + { + ++this.blockRefCount; + + if (block1.getTickRandomly()) + { + ++this.tickRefCount; + } + } + + this.data[y << 8 | z << 4 | x] = (char)Block.BLOCK_STATE_IDS.get(state); + } + + /** + * Returns the block for a location in a chunk, with the extended ID merged from a byte array and a NibbleArray to + * form a full 12-bit block ID. + */ + public Block getBlockByExtId(int x, int y, int z) + { + return this.get(x, y, z).getBlock(); + } + + /** + * Returns the metadata associated with the block at the given coordinates in this ExtendedBlockStorage. + */ + public int getExtBlockMetadata(int x, int y, int z) + { + IBlockState iblockstate = this.get(x, y, z); + return iblockstate.getBlock().getMetaFromState(iblockstate); + } + + /** + * Returns whether or not this block storage's Chunk is fully empty, based on its internal reference count. + */ + public boolean isEmpty() + { + return this.blockRefCount == 0; + } + + /** + * Returns whether or not this block storage's Chunk will require random ticking, used to avoid looping through + * random block ticks when there are no blocks that would randomly tick. + */ + public boolean getNeedsRandomTick() + { + return this.tickRefCount > 0; + } + + /** + * Returns the Y location of this ExtendedBlockStorage. + */ + public int getYLocation() + { + return this.yBase; + } + + /** + * Sets the saved Sky-light value in the extended block storage structure. + */ + public void setExtSkylightValue(int x, int y, int z, int value) + { + this.skylightArray.set(x, y, z, value); + } + + /** + * Gets the saved Sky-light value in the extended block storage structure. + */ + public int getExtSkylightValue(int x, int y, int z) + { + return this.skylightArray.get(x, y, z); + } + + /** + * Sets the saved Block-light value in the extended block storage structure. + */ + public void setExtBlocklightValue(int x, int y, int z, int value) + { + this.blocklightArray.set(x, y, z, value); + } + + /** + * Gets the saved Block-light value in the extended block storage structure. + */ + public int getExtBlocklightValue(int x, int y, int z) + { + return this.blocklightArray.get(x, y, z); + } + + public void removeInvalidBlocks() + { + List list = Block.BLOCK_STATE_IDS.getObjectList(); + int i = list.size(); + int j = 0; + int k = 0; + + for (int l = 0; l < 16; ++l) + { + int i1 = l << 8; + + for (int j1 = 0; j1 < 16; ++j1) + { + int k1 = i1 | j1 << 4; + + for (int l1 = 0; l1 < 16; ++l1) + { + int i2 = this.data[k1 | l1]; + + if (i2 > 0) + { + ++j; + + if (i2 < i) + { + IBlockState iblockstate = (IBlockState)list.get(i2); + + if (iblockstate != null) + { + Block block = iblockstate.getBlock(); + + if (block.getTickRandomly()) + { + ++k; + } + } + } + } + } + } + } + + this.blockRefCount = j; + this.tickRefCount = k; + } + + public char[] getData() + { + return this.data; + } + + public void setData(char[] dataArray) + { + this.data = dataArray; + } + + /** + * Returns the NibbleArray instance containing Block-light data. + */ + public NibbleArray getBlocklightArray() + { + return this.blocklightArray; + } + + /** + * Returns the NibbleArray instance containing Sky-light data. + */ + public NibbleArray getSkylightArray() + { + return this.skylightArray; + } + + /** + * Sets the NibbleArray instance used for Block-light values in this particular storage block. + */ + public void setBlocklightArray(NibbleArray newBlocklightArray) + { + this.blocklightArray = newBlocklightArray; + } + + /** + * Sets the NibbleArray instance used for Sky-light values in this particular storage block. + */ + public void setSkylightArray(NibbleArray newSkylightArray) + { + this.skylightArray = newSkylightArray; + } +} diff --git a/src/minecraft/net/minecraft/world/chunk/storage/IChunkLoader.java b/src/minecraft/net/minecraft/world/chunk/storage/IChunkLoader.java new file mode 100644 index 0000000..ae39d13 --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/storage/IChunkLoader.java @@ -0,0 +1,33 @@ +package net.minecraft.world.chunk.storage; + +import java.io.IOException; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +public interface IChunkLoader +{ + /** + * Loads the specified(XZ) chunk into the specified world. + */ + Chunk loadChunk(World worldIn, int x, int z) throws IOException; + + void saveChunk(World worldIn, Chunk chunkIn) throws MinecraftException, IOException; + + /** + * Save extra data associated with this Chunk not normally saved during autosave, only during chunk unload. + * Currently unused. + */ + void saveExtraChunkData(World worldIn, Chunk chunkIn) throws IOException; + + /** + * Called every World.tick() + */ + void chunkTick(); + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unused. + */ + void saveExtraData(); +} diff --git a/src/minecraft/net/minecraft/world/chunk/storage/NibbleArrayReader.java b/src/minecraft/net/minecraft/world/chunk/storage/NibbleArrayReader.java new file mode 100644 index 0000000..4c78de0 --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/storage/NibbleArrayReader.java @@ -0,0 +1,23 @@ +package net.minecraft.world.chunk.storage; + +public class NibbleArrayReader +{ + public final byte[] data; + private final int depthBits; + private final int depthBitsPlusFour; + + public NibbleArrayReader(byte[] dataIn, int depthBitsIn) + { + this.data = dataIn; + this.depthBits = depthBitsIn; + this.depthBitsPlusFour = depthBitsIn + 4; + } + + public int get(int p_76686_1_, int p_76686_2_, int p_76686_3_) + { + int i = p_76686_1_ << this.depthBitsPlusFour | p_76686_3_ << this.depthBits | p_76686_2_; + int j = i >> 1; + int k = i & 1; + return k == 0 ? this.data[j] & 15 : this.data[j] >> 4 & 15; + } +} diff --git a/src/minecraft/net/minecraft/world/chunk/storage/RegionFile.java b/src/minecraft/net/minecraft/world/chunk/storage/RegionFile.java new file mode 100644 index 0000000..a651d24 --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/storage/RegionFile.java @@ -0,0 +1,367 @@ +package net.minecraft.world.chunk.storage; + +import com.google.common.collect.Lists; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.List; +import java.util.zip.DeflaterOutputStream; +import java.util.zip.GZIPInputStream; +import java.util.zip.InflaterInputStream; +import net.minecraft.server.MinecraftServer; + +public class RegionFile +{ + private static final byte[] emptySector = new byte[4096]; + private final File fileName; + private RandomAccessFile dataFile; + private final int[] offsets = new int[1024]; + private final int[] chunkTimestamps = new int[1024]; + private List sectorFree; + + /** McRegion sizeDelta */ + private int sizeDelta; + private long lastModified; + + public RegionFile(File fileNameIn) + { + this.fileName = fileNameIn; + this.sizeDelta = 0; + + try + { + if (fileNameIn.exists()) + { + this.lastModified = fileNameIn.lastModified(); + } + + this.dataFile = new RandomAccessFile(fileNameIn, "rw"); + + if (this.dataFile.length() < 4096L) + { + for (int i = 0; i < 1024; ++i) + { + this.dataFile.writeInt(0); + } + + for (int i1 = 0; i1 < 1024; ++i1) + { + this.dataFile.writeInt(0); + } + + this.sizeDelta += 8192; + } + + if ((this.dataFile.length() & 4095L) != 0L) + { + for (int j1 = 0; (long)j1 < (this.dataFile.length() & 4095L); ++j1) + { + this.dataFile.write(0); + } + } + + int k1 = (int)this.dataFile.length() / 4096; + this.sectorFree = Lists.newArrayListWithCapacity(k1); + + for (int j = 0; j < k1; ++j) + { + this.sectorFree.add(Boolean.valueOf(true)); + } + + this.sectorFree.set(0, Boolean.valueOf(false)); + this.sectorFree.set(1, Boolean.valueOf(false)); + this.dataFile.seek(0L); + + for (int l1 = 0; l1 < 1024; ++l1) + { + int k = this.dataFile.readInt(); + this.offsets[l1] = k; + + if (k != 0 && (k >> 8) + (k & 255) <= this.sectorFree.size()) + { + for (int l = 0; l < (k & 255); ++l) + { + this.sectorFree.set((k >> 8) + l, Boolean.valueOf(false)); + } + } + } + + for (int i2 = 0; i2 < 1024; ++i2) + { + int j2 = this.dataFile.readInt(); + this.chunkTimestamps[i2] = j2; + } + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + + /** + * Returns an uncompressed chunk stream from the region file. + */ + + public synchronized DataInputStream getChunkDataInputStream(int x, int z) + { + if (this.outOfBounds(x, z)) + { + return null; + } + else + { + try + { + int i = this.getOffset(x, z); + + if (i == 0) + { + return null; + } + else + { + int j = i >> 8; + int k = i & 255; + + if (j + k > this.sectorFree.size()) + { + return null; + } + else + { + this.dataFile.seek((long)(j * 4096)); + int l = this.dataFile.readInt(); + + if (l > 4096 * k) + { + return null; + } + else if (l <= 0) + { + return null; + } + else + { + byte b0 = this.dataFile.readByte(); + + if (b0 == 1) + { + byte[] abyte1 = new byte[l - 1]; + this.dataFile.read(abyte1); + return new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(abyte1)))); + } + else if (b0 == 2) + { + byte[] abyte = new byte[l - 1]; + this.dataFile.read(abyte); + return new DataInputStream(new BufferedInputStream(new InflaterInputStream(new ByteArrayInputStream(abyte)))); + } + else + { + return null; + } + } + } + } + } + catch (IOException var9) + { + return null; + } + } + } + + /** + * Returns an output stream used to write chunk data. Data is on disk when the returned stream is closed. + */ + public DataOutputStream getChunkDataOutputStream(int x, int z) + { + return this.outOfBounds(x, z) ? null : new DataOutputStream(new DeflaterOutputStream(new RegionFile.ChunkBuffer(x, z))); + } + + /** + * args: x, z, data, length - write chunk data at (x, z) to disk + */ + + protected synchronized void write(int x, int z, byte[] data, int length) + { + try + { + int i = this.getOffset(x, z); + int j = i >> 8; + int k = i & 255; + int l = (length + 5) / 4096 + 1; + + if (l >= 256) + { + return; + } + + if (j != 0 && k == l) + { + this.write(j, data, length); + } + else + { + for (int i1 = 0; i1 < k; ++i1) + { + this.sectorFree.set(j + i1, Boolean.valueOf(true)); + } + + int l1 = this.sectorFree.indexOf(Boolean.valueOf(true)); + int j1 = 0; + + if (l1 != -1) + { + for (int k1 = l1; k1 < this.sectorFree.size(); ++k1) + { + if (j1 != 0) + { + if (((Boolean)this.sectorFree.get(k1)).booleanValue()) + { + ++j1; + } + else + { + j1 = 0; + } + } + else if (((Boolean)this.sectorFree.get(k1)).booleanValue()) + { + l1 = k1; + j1 = 1; + } + + if (j1 >= l) + { + break; + } + } + } + + if (j1 >= l) + { + j = l1; + this.setOffset(x, z, l1 << 8 | l); + + for (int j2 = 0; j2 < l; ++j2) + { + this.sectorFree.set(j + j2, Boolean.valueOf(false)); + } + + this.write(j, data, length); + } + else + { + this.dataFile.seek(this.dataFile.length()); + j = this.sectorFree.size(); + + for (int i2 = 0; i2 < l; ++i2) + { + this.dataFile.write(emptySector); + this.sectorFree.add(Boolean.valueOf(false)); + } + + this.sizeDelta += 4096 * l; + this.write(j, data, length); + this.setOffset(x, z, j << 8 | l); + } + } + + this.setChunkTimestamp(x, z, (int)(MinecraftServer.getCurrentTimeMillis() / 1000L)); + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + + /** + * args: sectorNumber, data, length - write the chunk data to this RegionFile + */ + private void write(int sectorNumber, byte[] data, int length) throws IOException + { + this.dataFile.seek((long)(sectorNumber * 4096)); + this.dataFile.writeInt(length + 1); + this.dataFile.writeByte(2); + this.dataFile.write(data, 0, length); + } + + /** + * args: x, z - check region bounds + */ + private boolean outOfBounds(int x, int z) + { + return x < 0 || x >= 32 || z < 0 || z >= 32; + } + + /** + * args: x, z - get chunk's offset in region file + */ + private int getOffset(int x, int z) + { + return this.offsets[x + z * 32]; + } + + /** + * args: x, z, - true if chunk has been saved / converted + */ + public boolean isChunkSaved(int x, int z) + { + return this.getOffset(x, z) != 0; + } + + /** + * args: x, z, offset - sets the chunk's offset in the region file + */ + private void setOffset(int x, int z, int offset) throws IOException + { + this.offsets[x + z * 32] = offset; + this.dataFile.seek((long)((x + z * 32) * 4)); + this.dataFile.writeInt(offset); + } + + /** + * args: x, z, timestamp - sets the chunk's write timestamp + */ + private void setChunkTimestamp(int x, int z, int timestamp) throws IOException + { + this.chunkTimestamps[x + z * 32] = timestamp; + this.dataFile.seek((long)(4096 + (x + z * 32) * 4)); + this.dataFile.writeInt(timestamp); + } + + /** + * close this RegionFile and prevent further writes + */ + public void close() throws IOException + { + if (this.dataFile != null) + { + this.dataFile.close(); + } + } + + class ChunkBuffer extends ByteArrayOutputStream + { + private int chunkX; + private int chunkZ; + + public ChunkBuffer(int x, int z) + { + super(8096); + this.chunkX = x; + this.chunkZ = z; + } + + public void close() throws IOException + { + RegionFile.this.write(this.chunkX, this.chunkZ, this.buf, this.count); + } + } +} diff --git a/src/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java b/src/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java new file mode 100644 index 0000000..6b3ab50 --- /dev/null +++ b/src/minecraft/net/minecraft/world/chunk/storage/RegionFileCache.java @@ -0,0 +1,83 @@ +package net.minecraft.world.chunk.storage; + +import com.google.common.collect.Maps; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.util.Map; + +public class RegionFileCache +{ + private static final Map regionsByFilename = Maps.newHashMap(); + + public static synchronized RegionFile createOrLoadRegionFile(File worldDir, int chunkX, int chunkZ) + { + File file1 = new File(worldDir, "region"); + File file2 = new File(file1, "r." + (chunkX >> 5) + "." + (chunkZ >> 5) + ".mca"); + RegionFile regionfile = (RegionFile)regionsByFilename.get(file2); + + if (regionfile != null) + { + return regionfile; + } + else + { + if (!file1.exists()) + { + file1.mkdirs(); + } + + if (regionsByFilename.size() >= 256) + { + clearRegionFileReferences(); + } + + RegionFile regionfile1 = new RegionFile(file2); + regionsByFilename.put(file2, regionfile1); + return regionfile1; + } + } + + /** + * clears region file references + */ + + public static synchronized void clearRegionFileReferences() + { + for (RegionFile regionfile : regionsByFilename.values()) + { + try + { + if (regionfile != null) + { + regionfile.close(); + } + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + + regionsByFilename.clear(); + } + + /** + * Returns an input stream for the specified chunk. Args: worldDir, chunkX, chunkZ + */ + public static DataInputStream getChunkInputStream(File worldDir, int chunkX, int chunkZ) + { + RegionFile regionfile = createOrLoadRegionFile(worldDir, chunkX, chunkZ); + return regionfile.getChunkDataInputStream(chunkX & 31, chunkZ & 31); + } + + /** + * Returns an output stream for the specified chunk. Args: worldDir, chunkX, chunkZ + */ + public static DataOutputStream getChunkOutputStream(File worldDir, int chunkX, int chunkZ) + { + RegionFile regionfile = createOrLoadRegionFile(worldDir, chunkX, chunkZ); + return regionfile.getChunkDataOutputStream(chunkX & 31, chunkZ & 31); + } +} diff --git a/src/minecraft/net/minecraft/world/demo/DemoWorldManager.java b/src/minecraft/net/minecraft/world/demo/DemoWorldManager.java new file mode 100644 index 0000000..6a9e716 --- /dev/null +++ b/src/minecraft/net/minecraft/world/demo/DemoWorldManager.java @@ -0,0 +1,147 @@ +package net.minecraft.world.demo; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.server.S2BPacketChangeGameState; +import net.minecraft.server.management.ItemInWorldManager; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class DemoWorldManager extends ItemInWorldManager +{ + private boolean field_73105_c; + private boolean demoTimeExpired; + private int field_73104_e; + private int field_73102_f; + + public DemoWorldManager(World worldIn) + { + super(worldIn); + } + + public void updateBlockRemoving() + { + super.updateBlockRemoving(); + ++this.field_73102_f; + long i = this.theWorld.getTotalWorldTime(); + long j = i / 24000L + 1L; + + if (!this.field_73105_c && this.field_73102_f > 20) + { + this.field_73105_c = true; + this.thisPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(5, 0.0F)); + } + + this.demoTimeExpired = i > 120500L; + + if (this.demoTimeExpired) + { + ++this.field_73104_e; + } + + if (i % 24000L == 500L) + { + if (j <= 6L) + { + this.thisPlayerMP.addChatMessage(new ChatComponentTranslation("demo.day." + j, new Object[0])); + } + } + else if (j == 1L) + { + if (i == 100L) + { + this.thisPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(5, 101.0F)); + } + else if (i == 175L) + { + this.thisPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(5, 102.0F)); + } + else if (i == 250L) + { + this.thisPlayerMP.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(5, 103.0F)); + } + } + else if (j == 5L && i % 24000L == 22000L) + { + this.thisPlayerMP.addChatMessage(new ChatComponentTranslation("demo.day.warning", new Object[0])); + } + } + + /** + * Sends a message to the player reminding them that this is the demo version + */ + private void sendDemoReminder() + { + if (this.field_73104_e > 100) + { + this.thisPlayerMP.addChatMessage(new ChatComponentTranslation("demo.reminder", new Object[0])); + this.field_73104_e = 0; + } + } + + /** + * If not creative, it calls sendBlockBreakProgress until the block is broken first. tryHarvestBlock can also be the + * result of this call. + */ + public void onBlockClicked(BlockPos pos, EnumFacing side) + { + if (this.demoTimeExpired) + { + this.sendDemoReminder(); + } + else + { + super.onBlockClicked(pos, side); + } + } + + public void blockRemoving(BlockPos pos) + { + if (!this.demoTimeExpired) + { + super.blockRemoving(pos); + } + } + + /** + * Attempts to harvest a block + */ + public boolean tryHarvestBlock(BlockPos pos) + { + return this.demoTimeExpired ? false : super.tryHarvestBlock(pos); + } + + /** + * Attempts to right-click use an item by the given EntityPlayer in the given World + */ + public boolean tryUseItem(EntityPlayer player, World worldIn, ItemStack stack) + { + if (this.demoTimeExpired) + { + this.sendDemoReminder(); + return false; + } + else + { + return super.tryUseItem(player, worldIn, stack); + } + } + + /** + * Activate the clicked on block, otherwise use the held item. + */ + public boolean activateBlockOrUseItem(EntityPlayer player, World worldIn, ItemStack stack, BlockPos pos, EnumFacing side, float offsetX, float offsetY, float offsetZ) + { + if (this.demoTimeExpired) + { + this.sendDemoReminder(); + return false; + } + else + { + return super.activateBlockOrUseItem(player, worldIn, stack, pos, side, offsetX, offsetY, offsetZ); + } + } +} diff --git a/src/minecraft/net/minecraft/world/demo/DemoWorldServer.java b/src/minecraft/net/minecraft/world/demo/DemoWorldServer.java new file mode 100644 index 0000000..6f09475 --- /dev/null +++ b/src/minecraft/net/minecraft/world/demo/DemoWorldServer.java @@ -0,0 +1,21 @@ +package net.minecraft.world.demo; + +import net.minecraft.profiler.Profiler; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.WorldServer; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.WorldType; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; + +public class DemoWorldServer extends WorldServer +{ + private static final long demoWorldSeed = (long)"North Carolina".hashCode(); + public static final WorldSettings demoWorldSettings = (new WorldSettings(demoWorldSeed, WorldSettings.GameType.SURVIVAL, true, false, WorldType.DEFAULT)).enableBonusChest(); + + public DemoWorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo worldInfoIn, int dimensionId, Profiler profilerIn) + { + super(server, saveHandlerIn, worldInfoIn, dimensionId, profilerIn); + this.worldInfo.populateFromWorldSettings(demoWorldSettings); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/ChunkProviderDebug.java b/src/minecraft/net/minecraft/world/gen/ChunkProviderDebug.java new file mode 100644 index 0000000..2720aba --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/ChunkProviderDebug.java @@ -0,0 +1,187 @@ +package net.minecraft.world.gen; + +import com.google.common.collect.Lists; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.chunk.IChunkProvider; + +public class ChunkProviderDebug implements IChunkProvider +{ + private static final List field_177464_a = Lists.newArrayList(); + private static final int field_177462_b; + private static final int field_181039_c; + private final World world; + + public ChunkProviderDebug(World worldIn) + { + this.world = worldIn; + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int x, int z) + { + ChunkPrimer chunkprimer = new ChunkPrimer(); + + for (int i = 0; i < 16; ++i) + { + for (int j = 0; j < 16; ++j) + { + int k = x * 16 + i; + int l = z * 16 + j; + chunkprimer.setBlockState(i, 60, j, Blocks.barrier.getDefaultState()); + IBlockState iblockstate = func_177461_b(k, l); + + if (iblockstate != null) + { + chunkprimer.setBlockState(i, 70, j, iblockstate); + } + } + } + + Chunk chunk = new Chunk(this.world, chunkprimer, x, z); + chunk.generateSkylightMap(); + BiomeGenBase[] abiomegenbase = this.world.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16); + byte[] abyte = chunk.getBiomeArray(); + + for (int i1 = 0; i1 < abyte.length; ++i1) + { + abyte[i1] = (byte)abiomegenbase[i1].biomeID; + } + + chunk.generateSkylightMap(); + return chunk; + } + + public static IBlockState func_177461_b(int p_177461_0_, int p_177461_1_) + { + IBlockState iblockstate = null; + + if (p_177461_0_ > 0 && p_177461_1_ > 0 && p_177461_0_ % 2 != 0 && p_177461_1_ % 2 != 0) + { + p_177461_0_ = p_177461_0_ / 2; + p_177461_1_ = p_177461_1_ / 2; + + if (p_177461_0_ <= field_177462_b && p_177461_1_ <= field_181039_c) + { + int i = MathHelper.abs_int(p_177461_0_ * field_177462_b + p_177461_1_); + + if (i < field_177464_a.size()) + { + iblockstate = (IBlockState)field_177464_a.get(i); + } + } + } + + return iblockstate; + } + + /** + * Checks to see if a chunk exists at x, z + */ + public boolean chunkExists(int x, int z) + { + return true; + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + } + + public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) + { + return false; + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean p_73151_1_, IProgressUpdate progressCallback) + { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() + { + } + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return true; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "DebugLevelSource"; + } + + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) + { + BiomeGenBase biomegenbase = this.world.getBiomeGenForCoords(pos); + return biomegenbase.getSpawnableList(creatureType); + } + + public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) + { + return null; + } + + public int getLoadedChunkCount() + { + return 0; + } + + public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) + { + } + + public Chunk provideChunk(BlockPos blockPosIn) + { + return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4); + } + + static + { + for (Block block : Block.blockRegistry) + { + field_177464_a.addAll(block.getBlockState().getValidStates()); + } + + field_177462_b = MathHelper.ceiling_float_int(MathHelper.sqrt_float((float)field_177464_a.size())); + field_181039_c = MathHelper.ceiling_float_int((float)field_177464_a.size() / (float)field_177462_b); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java b/src/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java new file mode 100644 index 0000000..4d0e923 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/ChunkProviderEnd.java @@ -0,0 +1,366 @@ +package net.minecraft.world.gen; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.BlockFalling; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.chunk.IChunkProvider; + +public class ChunkProviderEnd implements IChunkProvider +{ + private Random endRNG; + private NoiseGeneratorOctaves noiseGen1; + private NoiseGeneratorOctaves noiseGen2; + private NoiseGeneratorOctaves noiseGen3; + public NoiseGeneratorOctaves noiseGen4; + public NoiseGeneratorOctaves noiseGen5; + private World endWorld; + private double[] densities; + + /** The biomes that are used to generate the chunk */ + private BiomeGenBase[] biomesForGeneration; + double[] noiseData1; + double[] noiseData2; + double[] noiseData3; + double[] noiseData4; + double[] noiseData5; + + public ChunkProviderEnd(World worldIn, long p_i2007_2_) + { + this.endWorld = worldIn; + this.endRNG = new Random(p_i2007_2_); + this.noiseGen1 = new NoiseGeneratorOctaves(this.endRNG, 16); + this.noiseGen2 = new NoiseGeneratorOctaves(this.endRNG, 16); + this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); + this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); + this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); + } + + public void func_180520_a(int p_180520_1_, int p_180520_2_, ChunkPrimer p_180520_3_) + { + int i = 2; + int j = i + 1; + int k = 33; + int l = i + 1; + this.densities = this.initializeNoiseField(this.densities, p_180520_1_ * i, 0, p_180520_2_ * i, j, k, l); + + for (int i1 = 0; i1 < i; ++i1) + { + for (int j1 = 0; j1 < i; ++j1) + { + for (int k1 = 0; k1 < 32; ++k1) + { + double d0 = 0.25D; + double d1 = this.densities[((i1 + 0) * l + j1 + 0) * k + k1 + 0]; + double d2 = this.densities[((i1 + 0) * l + j1 + 1) * k + k1 + 0]; + double d3 = this.densities[((i1 + 1) * l + j1 + 0) * k + k1 + 0]; + double d4 = this.densities[((i1 + 1) * l + j1 + 1) * k + k1 + 0]; + double d5 = (this.densities[((i1 + 0) * l + j1 + 0) * k + k1 + 1] - d1) * d0; + double d6 = (this.densities[((i1 + 0) * l + j1 + 1) * k + k1 + 1] - d2) * d0; + double d7 = (this.densities[((i1 + 1) * l + j1 + 0) * k + k1 + 1] - d3) * d0; + double d8 = (this.densities[((i1 + 1) * l + j1 + 1) * k + k1 + 1] - d4) * d0; + + for (int l1 = 0; l1 < 4; ++l1) + { + double d9 = 0.125D; + double d10 = d1; + double d11 = d2; + double d12 = (d3 - d1) * d9; + double d13 = (d4 - d2) * d9; + + for (int i2 = 0; i2 < 8; ++i2) + { + double d14 = 0.125D; + double d15 = d10; + double d16 = (d11 - d10) * d14; + + for (int j2 = 0; j2 < 8; ++j2) + { + IBlockState iblockstate = null; + + if (d15 > 0.0D) + { + iblockstate = Blocks.end_stone.getDefaultState(); + } + + int k2 = i2 + i1 * 8; + int l2 = l1 + k1 * 4; + int i3 = j2 + j1 * 8; + p_180520_3_.setBlockState(k2, l2, i3, iblockstate); + d15 += d16; + } + + d10 += d12; + d11 += d13; + } + + d1 += d5; + d2 += d6; + d3 += d7; + d4 += d8; + } + } + } + } + } + + public void func_180519_a(ChunkPrimer p_180519_1_) + { + for (int i = 0; i < 16; ++i) + { + for (int j = 0; j < 16; ++j) + { + int k = 1; + int l = -1; + IBlockState iblockstate = Blocks.end_stone.getDefaultState(); + IBlockState iblockstate1 = Blocks.end_stone.getDefaultState(); + + for (int i1 = 127; i1 >= 0; --i1) + { + IBlockState iblockstate2 = p_180519_1_.getBlockState(i, i1, j); + + if (iblockstate2.getBlock().getMaterial() == Material.air) + { + l = -1; + } + else if (iblockstate2.getBlock() == Blocks.stone) + { + if (l == -1) + { + if (k <= 0) + { + iblockstate = Blocks.air.getDefaultState(); + iblockstate1 = Blocks.end_stone.getDefaultState(); + } + + l = k; + + if (i1 >= 0) + { + p_180519_1_.setBlockState(i, i1, j, iblockstate); + } + else + { + p_180519_1_.setBlockState(i, i1, j, iblockstate1); + } + } + else if (l > 0) + { + --l; + p_180519_1_.setBlockState(i, i1, j, iblockstate1); + } + } + } + } + } + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int x, int z) + { + this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L); + ChunkPrimer chunkprimer = new ChunkPrimer(); + this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); + this.func_180520_a(x, z, chunkprimer); + this.func_180519_a(chunkprimer); + Chunk chunk = new Chunk(this.endWorld, chunkprimer, x, z); + byte[] abyte = chunk.getBiomeArray(); + + for (int i = 0; i < abyte.length; ++i) + { + abyte[i] = (byte)this.biomesForGeneration[i].biomeID; + } + + chunk.generateSkylightMap(); + return chunk; + } + + /** + * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the + * size. + */ + private double[] initializeNoiseField(double[] p_73187_1_, int p_73187_2_, int p_73187_3_, int p_73187_4_, int p_73187_5_, int p_73187_6_, int p_73187_7_) + { + if (p_73187_1_ == null) + { + p_73187_1_ = new double[p_73187_5_ * p_73187_6_ * p_73187_7_]; + } + + double d0 = 684.412D; + double d1 = 684.412D; + this.noiseData4 = this.noiseGen4.generateNoiseOctaves(this.noiseData4, p_73187_2_, p_73187_4_, p_73187_5_, p_73187_7_, 1.121D, 1.121D, 0.5D); + this.noiseData5 = this.noiseGen5.generateNoiseOctaves(this.noiseData5, p_73187_2_, p_73187_4_, p_73187_5_, p_73187_7_, 200.0D, 200.0D, 0.5D); + d0 = d0 * 2.0D; + this.noiseData1 = this.noiseGen3.generateNoiseOctaves(this.noiseData1, p_73187_2_, p_73187_3_, p_73187_4_, p_73187_5_, p_73187_6_, p_73187_7_, d0 / 80.0D, d1 / 160.0D, d0 / 80.0D); + this.noiseData2 = this.noiseGen1.generateNoiseOctaves(this.noiseData2, p_73187_2_, p_73187_3_, p_73187_4_, p_73187_5_, p_73187_6_, p_73187_7_, d0, d1, d0); + this.noiseData3 = this.noiseGen2.generateNoiseOctaves(this.noiseData3, p_73187_2_, p_73187_3_, p_73187_4_, p_73187_5_, p_73187_6_, p_73187_7_, d0, d1, d0); + int i = 0; + + for (int j = 0; j < p_73187_5_; ++j) + { + for (int k = 0; k < p_73187_7_; ++k) + { + float f = (float)(j + p_73187_2_) / 1.0F; + float f1 = (float)(k + p_73187_4_) / 1.0F; + float f2 = 100.0F - MathHelper.sqrt_float(f * f + f1 * f1) * 8.0F; + + if (f2 > 80.0F) + { + f2 = 80.0F; + } + + if (f2 < -100.0F) + { + f2 = -100.0F; + } + + for (int l = 0; l < p_73187_6_; ++l) + { + double d2 = 0.0D; + double d3 = this.noiseData2[i] / 512.0D; + double d4 = this.noiseData3[i] / 512.0D; + double d5 = (this.noiseData1[i] / 10.0D + 1.0D) / 2.0D; + + if (d5 < 0.0D) + { + d2 = d3; + } + else if (d5 > 1.0D) + { + d2 = d4; + } + else + { + d2 = d3 + (d4 - d3) * d5; + } + + d2 = d2 - 8.0D; + d2 = d2 + (double)f2; + int i1 = 2; + + if (l > p_73187_6_ / 2 - i1) + { + double d6 = (double)((float)(l - (p_73187_6_ / 2 - i1)) / 64.0F); + d6 = MathHelper.clamp_double(d6, 0.0D, 1.0D); + d2 = d2 * (1.0D - d6) + -3000.0D * d6; + } + + i1 = 8; + + if (l < i1) + { + double d7 = (double)((float)(i1 - l) / ((float)i1 - 1.0F)); + d2 = d2 * (1.0D - d7) + -30.0D * d7; + } + + p_73187_1_[i] = d2; + ++i; + } + } + } + + return p_73187_1_; + } + + /** + * Checks to see if a chunk exists at x, z + */ + public boolean chunkExists(int x, int z) + { + return true; + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + BlockFalling.fallInstantly = true; + BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); + this.endWorld.getBiomeGenForCoords(blockpos.add(16, 0, 16)).decorate(this.endWorld, this.endWorld.rand, blockpos); + BlockFalling.fallInstantly = false; + } + + public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) + { + return false; + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean p_73151_1_, IProgressUpdate progressCallback) + { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() + { + } + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return true; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "RandomLevelSource"; + } + + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) + { + return this.endWorld.getBiomeGenForCoords(pos).getSpawnableList(creatureType); + } + + public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) + { + return null; + } + + public int getLoadedChunkCount() + { + return 0; + } + + public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) + { + } + + public Chunk provideChunk(BlockPos blockPosIn) + { + return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/ChunkProviderFlat.java b/src/minecraft/net/minecraft/world/gen/ChunkProviderFlat.java new file mode 100644 index 0000000..00c3a93 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/ChunkProviderFlat.java @@ -0,0 +1,315 @@ +package net.minecraft.world.gen; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Map; +import java.util.Random; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.feature.WorldGenDungeons; +import net.minecraft.world.gen.feature.WorldGenLakes; +import net.minecraft.world.gen.structure.MapGenMineshaft; +import net.minecraft.world.gen.structure.MapGenScatteredFeature; +import net.minecraft.world.gen.structure.MapGenStronghold; +import net.minecraft.world.gen.structure.MapGenStructure; +import net.minecraft.world.gen.structure.MapGenVillage; +import net.minecraft.world.gen.structure.StructureOceanMonument; + +public class ChunkProviderFlat implements IChunkProvider +{ + private World worldObj; + private Random random; + private final IBlockState[] cachedBlockIDs = new IBlockState[256]; + private final FlatGeneratorInfo flatWorldGenInfo; + private final List structureGenerators = Lists.newArrayList(); + private final boolean hasDecoration; + private final boolean hasDungeons; + private WorldGenLakes waterLakeGenerator; + private WorldGenLakes lavaLakeGenerator; + + public ChunkProviderFlat(World worldIn, long seed, boolean generateStructures, String flatGeneratorSettings) + { + this.worldObj = worldIn; + this.random = new Random(seed); + this.flatWorldGenInfo = FlatGeneratorInfo.createFlatGeneratorFromString(flatGeneratorSettings); + + if (generateStructures) + { + Map> map = this.flatWorldGenInfo.getWorldFeatures(); + + if (map.containsKey("village")) + { + Map map1 = (Map)map.get("village"); + + if (!map1.containsKey("size")) + { + map1.put("size", "1"); + } + + this.structureGenerators.add(new MapGenVillage(map1)); + } + + if (map.containsKey("biome_1")) + { + this.structureGenerators.add(new MapGenScatteredFeature((Map)map.get("biome_1"))); + } + + if (map.containsKey("mineshaft")) + { + this.structureGenerators.add(new MapGenMineshaft((Map)map.get("mineshaft"))); + } + + if (map.containsKey("stronghold")) + { + this.structureGenerators.add(new MapGenStronghold((Map)map.get("stronghold"))); + } + + if (map.containsKey("oceanmonument")) + { + this.structureGenerators.add(new StructureOceanMonument((Map)map.get("oceanmonument"))); + } + } + + if (this.flatWorldGenInfo.getWorldFeatures().containsKey("lake")) + { + this.waterLakeGenerator = new WorldGenLakes(Blocks.water); + } + + if (this.flatWorldGenInfo.getWorldFeatures().containsKey("lava_lake")) + { + this.lavaLakeGenerator = new WorldGenLakes(Blocks.lava); + } + + this.hasDungeons = this.flatWorldGenInfo.getWorldFeatures().containsKey("dungeon"); + int j = 0; + int k = 0; + boolean flag = true; + + for (FlatLayerInfo flatlayerinfo : this.flatWorldGenInfo.getFlatLayers()) + { + for (int i = flatlayerinfo.getMinY(); i < flatlayerinfo.getMinY() + flatlayerinfo.getLayerCount(); ++i) + { + IBlockState iblockstate = flatlayerinfo.func_175900_c(); + + if (iblockstate.getBlock() != Blocks.air) + { + flag = false; + this.cachedBlockIDs[i] = iblockstate; + } + } + + if (flatlayerinfo.func_175900_c().getBlock() == Blocks.air) + { + k += flatlayerinfo.getLayerCount(); + } + else + { + j += flatlayerinfo.getLayerCount() + k; + k = 0; + } + } + + worldIn.func_181544_b(j); + this.hasDecoration = flag ? false : this.flatWorldGenInfo.getWorldFeatures().containsKey("decoration"); + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int x, int z) + { + ChunkPrimer chunkprimer = new ChunkPrimer(); + + for (int i = 0; i < this.cachedBlockIDs.length; ++i) + { + IBlockState iblockstate = this.cachedBlockIDs[i]; + + if (iblockstate != null) + { + for (int j = 0; j < 16; ++j) + { + for (int k = 0; k < 16; ++k) + { + chunkprimer.setBlockState(j, i, k, iblockstate); + } + } + } + } + + for (MapGenBase mapgenbase : this.structureGenerators) + { + mapgenbase.generate(this, this.worldObj, x, z, chunkprimer); + } + + Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z); + BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16); + byte[] abyte = chunk.getBiomeArray(); + + for (int l = 0; l < abyte.length; ++l) + { + abyte[l] = (byte)abiomegenbase[l].biomeID; + } + + chunk.generateSkylightMap(); + return chunk; + } + + /** + * Checks to see if a chunk exists at x, z + */ + public boolean chunkExists(int x, int z) + { + return true; + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + int i = p_73153_2_ * 16; + int j = p_73153_3_ * 16; + BlockPos blockpos = new BlockPos(i, 0, j); + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(new BlockPos(i + 16, 0, j + 16)); + boolean flag = false; + this.random.setSeed(this.worldObj.getSeed()); + long k = this.random.nextLong() / 2L * 2L + 1L; + long l = this.random.nextLong() / 2L * 2L + 1L; + this.random.setSeed((long)p_73153_2_ * k + (long)p_73153_3_ * l ^ this.worldObj.getSeed()); + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + + for (MapGenStructure mapgenstructure : this.structureGenerators) + { + boolean flag1 = mapgenstructure.generateStructure(this.worldObj, this.random, chunkcoordintpair); + + if (mapgenstructure instanceof MapGenVillage) + { + flag |= flag1; + } + } + + if (this.waterLakeGenerator != null && !flag && this.random.nextInt(4) == 0) + { + this.waterLakeGenerator.generate(this.worldObj, this.random, blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(256), this.random.nextInt(16) + 8)); + } + + if (this.lavaLakeGenerator != null && !flag && this.random.nextInt(8) == 0) + { + BlockPos blockpos1 = blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(this.random.nextInt(248) + 8), this.random.nextInt(16) + 8); + + if (blockpos1.getY() < this.worldObj.func_181545_F() || this.random.nextInt(10) == 0) + { + this.lavaLakeGenerator.generate(this.worldObj, this.random, blockpos1); + } + } + + if (this.hasDungeons) + { + for (int i1 = 0; i1 < 8; ++i1) + { + (new WorldGenDungeons()).generate(this.worldObj, this.random, blockpos.add(this.random.nextInt(16) + 8, this.random.nextInt(256), this.random.nextInt(16) + 8)); + } + } + + if (this.hasDecoration) + { + biomegenbase.decorate(this.worldObj, this.random, blockpos); + } + } + + public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) + { + return false; + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean p_73151_1_, IProgressUpdate progressCallback) + { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() + { + } + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return true; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "FlatLevelSource"; + } + + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) + { + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos); + return biomegenbase.getSpawnableList(creatureType); + } + + public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) + { + if ("Stronghold".equals(structureName)) + { + for (MapGenStructure mapgenstructure : this.structureGenerators) + { + if (mapgenstructure instanceof MapGenStronghold) + { + return mapgenstructure.getClosestStrongholdPos(worldIn, position); + } + } + } + + return null; + } + + public int getLoadedChunkCount() + { + return 0; + } + + public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) + { + for (MapGenStructure mapgenstructure : this.structureGenerators) + { + mapgenstructure.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null); + } + } + + public Chunk provideChunk(BlockPos blockPosIn) + { + return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java b/src/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java new file mode 100644 index 0000000..05c9112 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/ChunkProviderGenerate.java @@ -0,0 +1,595 @@ +package net.minecraft.world.gen; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFalling; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.SpawnerAnimals; +import net.minecraft.world.World; +import net.minecraft.world.WorldType; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.feature.WorldGenDungeons; +import net.minecraft.world.gen.feature.WorldGenLakes; +import net.minecraft.world.gen.structure.MapGenMineshaft; +import net.minecraft.world.gen.structure.MapGenScatteredFeature; +import net.minecraft.world.gen.structure.MapGenStronghold; +import net.minecraft.world.gen.structure.MapGenVillage; +import net.minecraft.world.gen.structure.StructureOceanMonument; + +public class ChunkProviderGenerate implements IChunkProvider +{ + /** RNG. */ + private Random rand; + private NoiseGeneratorOctaves field_147431_j; + private NoiseGeneratorOctaves field_147432_k; + private NoiseGeneratorOctaves field_147429_l; + private NoiseGeneratorPerlin field_147430_m; + + /** A NoiseGeneratorOctaves used in generating terrain */ + public NoiseGeneratorOctaves noiseGen5; + + /** A NoiseGeneratorOctaves used in generating terrain */ + public NoiseGeneratorOctaves noiseGen6; + public NoiseGeneratorOctaves mobSpawnerNoise; + + /** Reference to the World object. */ + private World worldObj; + + /** are map structures going to be generated (e.g. strongholds) */ + private final boolean mapFeaturesEnabled; + private WorldType field_177475_o; + private final double[] field_147434_q; + private final float[] parabolicField; + private ChunkProviderSettings settings; + private Block field_177476_s = Blocks.water; + private double[] stoneNoise = new double[256]; + private MapGenBase caveGenerator = new MapGenCaves(); + + /** Holds Stronghold Generator */ + private MapGenStronghold strongholdGenerator = new MapGenStronghold(); + + /** Holds Village Generator */ + private MapGenVillage villageGenerator = new MapGenVillage(); + + /** Holds Mineshaft Generator */ + private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft(); + private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature(); + + /** Holds ravine generator */ + private MapGenBase ravineGenerator = new MapGenRavine(); + private StructureOceanMonument oceanMonumentGenerator = new StructureOceanMonument(); + + /** The biomes that are used to generate the chunk */ + private BiomeGenBase[] biomesForGeneration; + double[] field_147427_d; + double[] field_147428_e; + double[] field_147425_f; + double[] field_147426_g; + + public ChunkProviderGenerate(World worldIn, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_) + { + this.worldObj = worldIn; + this.mapFeaturesEnabled = p_i45636_4_; + this.field_177475_o = worldIn.getWorldInfo().getTerrainType(); + this.rand = new Random(p_i45636_2_); + this.field_147431_j = new NoiseGeneratorOctaves(this.rand, 16); + this.field_147432_k = new NoiseGeneratorOctaves(this.rand, 16); + this.field_147429_l = new NoiseGeneratorOctaves(this.rand, 8); + this.field_147430_m = new NoiseGeneratorPerlin(this.rand, 4); + this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); + this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); + this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); + this.field_147434_q = new double[825]; + this.parabolicField = new float[25]; + + for (int i = -2; i <= 2; ++i) + { + for (int j = -2; j <= 2; ++j) + { + float f = 10.0F / MathHelper.sqrt_float((float)(i * i + j * j) + 0.2F); + this.parabolicField[i + 2 + (j + 2) * 5] = f; + } + } + + if (p_i45636_5_ != null) + { + this.settings = ChunkProviderSettings.Factory.jsonToFactory(p_i45636_5_).func_177864_b(); + this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water; + worldIn.func_181544_b(this.settings.seaLevel); + } + } + + public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_) + { + this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, p_180518_1_ * 4 - 2, p_180518_2_ * 4 - 2, 10, 10); + this.func_147423_a(p_180518_1_ * 4, 0, p_180518_2_ * 4); + + for (int i = 0; i < 4; ++i) + { + int j = i * 5; + int k = (i + 1) * 5; + + for (int l = 0; l < 4; ++l) + { + int i1 = (j + l) * 33; + int j1 = (j + l + 1) * 33; + int k1 = (k + l) * 33; + int l1 = (k + l + 1) * 33; + + for (int i2 = 0; i2 < 32; ++i2) + { + double d0 = 0.125D; + double d1 = this.field_147434_q[i1 + i2]; + double d2 = this.field_147434_q[j1 + i2]; + double d3 = this.field_147434_q[k1 + i2]; + double d4 = this.field_147434_q[l1 + i2]; + double d5 = (this.field_147434_q[i1 + i2 + 1] - d1) * d0; + double d6 = (this.field_147434_q[j1 + i2 + 1] - d2) * d0; + double d7 = (this.field_147434_q[k1 + i2 + 1] - d3) * d0; + double d8 = (this.field_147434_q[l1 + i2 + 1] - d4) * d0; + + for (int j2 = 0; j2 < 8; ++j2) + { + double d9 = 0.25D; + double d10 = d1; + double d11 = d2; + double d12 = (d3 - d1) * d9; + double d13 = (d4 - d2) * d9; + + for (int k2 = 0; k2 < 4; ++k2) + { + double d14 = 0.25D; + double d16 = (d11 - d10) * d14; + double lvt_45_1_ = d10 - d16; + + for (int l2 = 0; l2 < 4; ++l2) + { + if ((lvt_45_1_ += d16) > 0.0D) + { + p_180518_3_.setBlockState(i * 4 + k2, i2 * 8 + j2, l * 4 + l2, Blocks.stone.getDefaultState()); + } + else if (i2 * 8 + j2 < this.settings.seaLevel) + { + p_180518_3_.setBlockState(i * 4 + k2, i2 * 8 + j2, l * 4 + l2, this.field_177476_s.getDefaultState()); + } + } + + d10 += d12; + d11 += d13; + } + + d1 += d5; + d2 += d6; + d3 += d7; + d4 += d8; + } + } + } + } + } + + public void replaceBlocksForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) + { + double d0 = 0.03125D; + this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); + + for (int i = 0; i < 16; ++i) + { + for (int j = 0; j < 16; ++j) + { + BiomeGenBase biomegenbase = p_180517_4_[j + i * 16]; + biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_180517_3_, p_180517_1_ * 16 + i, p_180517_2_ * 16 + j, this.stoneNoise[j + i * 16]); + } + } + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int x, int z) + { + this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L); + ChunkPrimer chunkprimer = new ChunkPrimer(); + this.setBlocksInChunk(x, z, chunkprimer); + this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); + this.replaceBlocksForBiome(x, z, chunkprimer, this.biomesForGeneration); + + if (this.settings.useCaves) + { + this.caveGenerator.generate(this, this.worldObj, x, z, chunkprimer); + } + + if (this.settings.useRavines) + { + this.ravineGenerator.generate(this, this.worldObj, x, z, chunkprimer); + } + + if (this.settings.useMineShafts && this.mapFeaturesEnabled) + { + this.mineshaftGenerator.generate(this, this.worldObj, x, z, chunkprimer); + } + + if (this.settings.useVillages && this.mapFeaturesEnabled) + { + this.villageGenerator.generate(this, this.worldObj, x, z, chunkprimer); + } + + if (this.settings.useStrongholds && this.mapFeaturesEnabled) + { + this.strongholdGenerator.generate(this, this.worldObj, x, z, chunkprimer); + } + + if (this.settings.useTemples && this.mapFeaturesEnabled) + { + this.scatteredFeatureGenerator.generate(this, this.worldObj, x, z, chunkprimer); + } + + if (this.settings.useMonuments && this.mapFeaturesEnabled) + { + this.oceanMonumentGenerator.generate(this, this.worldObj, x, z, chunkprimer); + } + + Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z); + byte[] abyte = chunk.getBiomeArray(); + + for (int i = 0; i < abyte.length; ++i) + { + abyte[i] = (byte)this.biomesForGeneration[i].biomeID; + } + + chunk.generateSkylightMap(); + return chunk; + } + + private void func_147423_a(int p_147423_1_, int p_147423_2_, int p_147423_3_) + { + this.field_147426_g = this.noiseGen6.generateNoiseOctaves(this.field_147426_g, p_147423_1_, p_147423_3_, 5, 5, (double)this.settings.depthNoiseScaleX, (double)this.settings.depthNoiseScaleZ, (double)this.settings.depthNoiseScaleExponent); + float f = this.settings.coordinateScale; + float f1 = this.settings.heightScale; + this.field_147427_d = this.field_147429_l.generateNoiseOctaves(this.field_147427_d, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, (double)(f / this.settings.mainNoiseScaleX), (double)(f1 / this.settings.mainNoiseScaleY), (double)(f / this.settings.mainNoiseScaleZ)); + this.field_147428_e = this.field_147431_j.generateNoiseOctaves(this.field_147428_e, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, (double)f, (double)f1, (double)f); + this.field_147425_f = this.field_147432_k.generateNoiseOctaves(this.field_147425_f, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, (double)f, (double)f1, (double)f); + p_147423_3_ = 0; + p_147423_1_ = 0; + int i = 0; + int j = 0; + + for (int k = 0; k < 5; ++k) + { + for (int l = 0; l < 5; ++l) + { + float f2 = 0.0F; + float f3 = 0.0F; + float f4 = 0.0F; + int i1 = 2; + BiomeGenBase biomegenbase = this.biomesForGeneration[k + 2 + (l + 2) * 10]; + + for (int j1 = -i1; j1 <= i1; ++j1) + { + for (int k1 = -i1; k1 <= i1; ++k1) + { + BiomeGenBase biomegenbase1 = this.biomesForGeneration[k + j1 + 2 + (l + k1 + 2) * 10]; + float f5 = this.settings.biomeDepthOffSet + biomegenbase1.minHeight * this.settings.biomeDepthWeight; + float f6 = this.settings.biomeScaleOffset + biomegenbase1.maxHeight * this.settings.biomeScaleWeight; + + if (this.field_177475_o == WorldType.AMPLIFIED && f5 > 0.0F) + { + f5 = 1.0F + f5 * 2.0F; + f6 = 1.0F + f6 * 4.0F; + } + + float f7 = this.parabolicField[j1 + 2 + (k1 + 2) * 5] / (f5 + 2.0F); + + if (biomegenbase1.minHeight > biomegenbase.minHeight) + { + f7 /= 2.0F; + } + + f2 += f6 * f7; + f3 += f5 * f7; + f4 += f7; + } + } + + f2 = f2 / f4; + f3 = f3 / f4; + f2 = f2 * 0.9F + 0.1F; + f3 = (f3 * 4.0F - 1.0F) / 8.0F; + double d7 = this.field_147426_g[j] / 8000.0D; + + if (d7 < 0.0D) + { + d7 = -d7 * 0.3D; + } + + d7 = d7 * 3.0D - 2.0D; + + if (d7 < 0.0D) + { + d7 = d7 / 2.0D; + + if (d7 < -1.0D) + { + d7 = -1.0D; + } + + d7 = d7 / 1.4D; + d7 = d7 / 2.0D; + } + else + { + if (d7 > 1.0D) + { + d7 = 1.0D; + } + + d7 = d7 / 8.0D; + } + + ++j; + double d8 = (double)f3; + double d9 = (double)f2; + d8 = d8 + d7 * 0.2D; + d8 = d8 * (double)this.settings.baseSize / 8.0D; + double d0 = (double)this.settings.baseSize + d8 * 4.0D; + + for (int l1 = 0; l1 < 33; ++l1) + { + double d1 = ((double)l1 - d0) * (double)this.settings.stretchY * 128.0D / 256.0D / d9; + + if (d1 < 0.0D) + { + d1 *= 4.0D; + } + + double d2 = this.field_147428_e[i] / (double)this.settings.lowerLimitScale; + double d3 = this.field_147425_f[i] / (double)this.settings.upperLimitScale; + double d4 = (this.field_147427_d[i] / 10.0D + 1.0D) / 2.0D; + double d5 = MathHelper.denormalizeClamp(d2, d3, d4) - d1; + + if (l1 > 29) + { + double d6 = (double)((float)(l1 - 29) / 3.0F); + d5 = d5 * (1.0D - d6) + -10.0D * d6; + } + + this.field_147434_q[i] = d5; + ++i; + } + } + } + } + + /** + * Checks to see if a chunk exists at x, z + */ + public boolean chunkExists(int x, int z) + { + return true; + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + BlockFalling.fallInstantly = true; + int i = p_73153_2_ * 16; + int j = p_73153_3_ * 16; + BlockPos blockpos = new BlockPos(i, 0, j); + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos.add(16, 0, 16)); + this.rand.setSeed(this.worldObj.getSeed()); + long k = this.rand.nextLong() / 2L * 2L + 1L; + long l = this.rand.nextLong() / 2L * 2L + 1L; + this.rand.setSeed((long)p_73153_2_ * k + (long)p_73153_3_ * l ^ this.worldObj.getSeed()); + boolean flag = false; + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + + if (this.settings.useMineShafts && this.mapFeaturesEnabled) + { + this.mineshaftGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); + } + + if (this.settings.useVillages && this.mapFeaturesEnabled) + { + flag = this.villageGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); + } + + if (this.settings.useStrongholds && this.mapFeaturesEnabled) + { + this.strongholdGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); + } + + if (this.settings.useTemples && this.mapFeaturesEnabled) + { + this.scatteredFeatureGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); + } + + if (this.settings.useMonuments && this.mapFeaturesEnabled) + { + this.oceanMonumentGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair); + } + + if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0) + { + int i1 = this.rand.nextInt(16) + 8; + int j1 = this.rand.nextInt(256); + int k1 = this.rand.nextInt(16) + 8; + (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, blockpos.add(i1, j1, k1)); + } + + if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes) + { + int i2 = this.rand.nextInt(16) + 8; + int l2 = this.rand.nextInt(this.rand.nextInt(248) + 8); + int k3 = this.rand.nextInt(16) + 8; + + if (l2 < this.worldObj.func_181545_F() || this.rand.nextInt(this.settings.lavaLakeChance / 8) == 0) + { + (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, blockpos.add(i2, l2, k3)); + } + } + + if (this.settings.useDungeons) + { + for (int j2 = 0; j2 < this.settings.dungeonChance; ++j2) + { + int i3 = this.rand.nextInt(16) + 8; + int l3 = this.rand.nextInt(256); + int l1 = this.rand.nextInt(16) + 8; + (new WorldGenDungeons()).generate(this.worldObj, this.rand, blockpos.add(i3, l3, l1)); + } + } + + biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(i, 0, j)); + SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, i + 8, j + 8, 16, 16, this.rand); + blockpos = blockpos.add(8, 0, 8); + + for (int k2 = 0; k2 < 16; ++k2) + { + for (int j3 = 0; j3 < 16; ++j3) + { + BlockPos blockpos1 = this.worldObj.getPrecipitationHeight(blockpos.add(k2, 0, j3)); + BlockPos blockpos2 = blockpos1.down(); + + if (this.worldObj.canBlockFreezeWater(blockpos2)) + { + this.worldObj.setBlockState(blockpos2, Blocks.ice.getDefaultState(), 2); + } + + if (this.worldObj.canSnowAt(blockpos1, true)) + { + this.worldObj.setBlockState(blockpos1, Blocks.snow_layer.getDefaultState(), 2); + } + } + } + + BlockFalling.fallInstantly = false; + } + + public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) + { + boolean flag = false; + + if (this.settings.useMonuments && this.mapFeaturesEnabled && p_177460_2_.getInhabitedTime() < 3600L) + { + flag |= this.oceanMonumentGenerator.generateStructure(this.worldObj, this.rand, new ChunkCoordIntPair(p_177460_3_, p_177460_4_)); + } + + return flag; + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean p_73151_1_, IProgressUpdate progressCallback) + { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() + { + } + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return true; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "RandomLevelSource"; + } + + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) + { + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos); + + if (this.mapFeaturesEnabled) + { + if (creatureType == EnumCreatureType.MONSTER && this.scatteredFeatureGenerator.func_175798_a(pos)) + { + return this.scatteredFeatureGenerator.getScatteredFeatureSpawnList(); + } + + if (creatureType == EnumCreatureType.MONSTER && this.settings.useMonuments && this.oceanMonumentGenerator.func_175796_a(this.worldObj, pos)) + { + return this.oceanMonumentGenerator.func_175799_b(); + } + } + + return biomegenbase.getSpawnableList(creatureType); + } + + public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) + { + return "Stronghold".equals(structureName) && this.strongholdGenerator != null ? this.strongholdGenerator.getClosestStrongholdPos(worldIn, position) : null; + } + + public int getLoadedChunkCount() + { + return 0; + } + + public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) + { + if (this.settings.useMineShafts && this.mapFeaturesEnabled) + { + this.mineshaftGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null); + } + + if (this.settings.useVillages && this.mapFeaturesEnabled) + { + this.villageGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null); + } + + if (this.settings.useStrongholds && this.mapFeaturesEnabled) + { + this.strongholdGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null); + } + + if (this.settings.useTemples && this.mapFeaturesEnabled) + { + this.scatteredFeatureGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null); + } + + if (this.settings.useMonuments && this.mapFeaturesEnabled) + { + this.oceanMonumentGenerator.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null); + } + } + + public Chunk provideChunk(BlockPos blockPosIn) + { + return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/ChunkProviderHell.java b/src/minecraft/net/minecraft/world/gen/ChunkProviderHell.java new file mode 100644 index 0000000..5bdfa96 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/ChunkProviderHell.java @@ -0,0 +1,521 @@ +package net.minecraft.world.gen; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.BlockFalling; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.pattern.BlockHelper; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.feature.WorldGenFire; +import net.minecraft.world.gen.feature.WorldGenGlowStone1; +import net.minecraft.world.gen.feature.WorldGenGlowStone2; +import net.minecraft.world.gen.feature.WorldGenHellLava; +import net.minecraft.world.gen.feature.WorldGenMinable; +import net.minecraft.world.gen.feature.WorldGenerator; +import net.minecraft.world.gen.structure.MapGenNetherBridge; + +public class ChunkProviderHell implements IChunkProvider +{ + /** Is the world that the nether is getting generated. */ + private final World worldObj; + private final boolean field_177466_i; + private final Random hellRNG; + + /** + * Holds the noise used to determine whether slowsand can be generated at a location + */ + private double[] slowsandNoise = new double[256]; + private double[] gravelNoise = new double[256]; + + /** + * Holds the noise used to determine whether something other than netherrack can be generated at a location + */ + private double[] netherrackExclusivityNoise = new double[256]; + private double[] noiseField; + + /** A NoiseGeneratorOctaves used in generating nether terrain */ + private final NoiseGeneratorOctaves netherNoiseGen1; + private final NoiseGeneratorOctaves netherNoiseGen2; + private final NoiseGeneratorOctaves netherNoiseGen3; + + /** Determines whether slowsand or gravel can be generated at a location */ + private final NoiseGeneratorOctaves slowsandGravelNoiseGen; + + /** + * Determines whether something other than nettherack can be generated at a location + */ + private final NoiseGeneratorOctaves netherrackExculsivityNoiseGen; + public final NoiseGeneratorOctaves netherNoiseGen6; + public final NoiseGeneratorOctaves netherNoiseGen7; + private final WorldGenFire field_177470_t = new WorldGenFire(); + private final WorldGenGlowStone1 field_177469_u = new WorldGenGlowStone1(); + private final WorldGenGlowStone2 field_177468_v = new WorldGenGlowStone2(); + private final WorldGenerator field_177467_w = new WorldGenMinable(Blocks.quartz_ore.getDefaultState(), 14, BlockHelper.forBlock(Blocks.netherrack)); + private final WorldGenHellLava field_177473_x = new WorldGenHellLava(Blocks.flowing_lava, true); + private final WorldGenHellLava field_177472_y = new WorldGenHellLava(Blocks.flowing_lava, false); + private final GeneratorBushFeature field_177471_z = new GeneratorBushFeature(Blocks.brown_mushroom); + private final GeneratorBushFeature field_177465_A = new GeneratorBushFeature(Blocks.red_mushroom); + private final MapGenNetherBridge genNetherBridge = new MapGenNetherBridge(); + private final MapGenBase netherCaveGenerator = new MapGenCavesHell(); + double[] noiseData1; + double[] noiseData2; + double[] noiseData3; + double[] noiseData4; + double[] noiseData5; + + public ChunkProviderHell(World worldIn, boolean p_i45637_2_, long p_i45637_3_) + { + this.worldObj = worldIn; + this.field_177466_i = p_i45637_2_; + this.hellRNG = new Random(p_i45637_3_); + this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); + this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); + this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); + this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); + this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); + this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); + this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); + worldIn.func_181544_b(63); + } + + public void func_180515_a(int p_180515_1_, int p_180515_2_, ChunkPrimer p_180515_3_) + { + int i = 4; + int j = this.worldObj.func_181545_F() / 2 + 1; + int k = i + 1; + int l = 17; + int i1 = i + 1; + this.noiseField = this.initializeNoiseField(this.noiseField, p_180515_1_ * i, 0, p_180515_2_ * i, k, l, i1); + + for (int j1 = 0; j1 < i; ++j1) + { + for (int k1 = 0; k1 < i; ++k1) + { + for (int l1 = 0; l1 < 16; ++l1) + { + double d0 = 0.125D; + double d1 = this.noiseField[((j1 + 0) * i1 + k1 + 0) * l + l1 + 0]; + double d2 = this.noiseField[((j1 + 0) * i1 + k1 + 1) * l + l1 + 0]; + double d3 = this.noiseField[((j1 + 1) * i1 + k1 + 0) * l + l1 + 0]; + double d4 = this.noiseField[((j1 + 1) * i1 + k1 + 1) * l + l1 + 0]; + double d5 = (this.noiseField[((j1 + 0) * i1 + k1 + 0) * l + l1 + 1] - d1) * d0; + double d6 = (this.noiseField[((j1 + 0) * i1 + k1 + 1) * l + l1 + 1] - d2) * d0; + double d7 = (this.noiseField[((j1 + 1) * i1 + k1 + 0) * l + l1 + 1] - d3) * d0; + double d8 = (this.noiseField[((j1 + 1) * i1 + k1 + 1) * l + l1 + 1] - d4) * d0; + + for (int i2 = 0; i2 < 8; ++i2) + { + double d9 = 0.25D; + double d10 = d1; + double d11 = d2; + double d12 = (d3 - d1) * d9; + double d13 = (d4 - d2) * d9; + + for (int j2 = 0; j2 < 4; ++j2) + { + double d14 = 0.25D; + double d15 = d10; + double d16 = (d11 - d10) * d14; + + for (int k2 = 0; k2 < 4; ++k2) + { + IBlockState iblockstate = null; + + if (l1 * 8 + i2 < j) + { + iblockstate = Blocks.lava.getDefaultState(); + } + + if (d15 > 0.0D) + { + iblockstate = Blocks.netherrack.getDefaultState(); + } + + int l2 = j2 + j1 * 4; + int i3 = i2 + l1 * 8; + int j3 = k2 + k1 * 4; + p_180515_3_.setBlockState(l2, i3, j3, iblockstate); + d15 += d16; + } + + d10 += d12; + d11 += d13; + } + + d1 += d5; + d2 += d6; + d3 += d7; + d4 += d8; + } + } + } + } + } + + public void func_180516_b(int p_180516_1_, int p_180516_2_, ChunkPrimer p_180516_3_) + { + int i = this.worldObj.func_181545_F() + 1; + double d0 = 0.03125D; + this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0, d0, 1.0D); + this.gravelNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.gravelNoise, p_180516_1_ * 16, 109, p_180516_2_ * 16, 16, 1, 16, d0, 1.0D, d0); + this.netherrackExclusivityNoise = this.netherrackExculsivityNoiseGen.generateNoiseOctaves(this.netherrackExclusivityNoise, p_180516_1_ * 16, p_180516_2_ * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D); + + for (int j = 0; j < 16; ++j) + { + for (int k = 0; k < 16; ++k) + { + boolean flag = this.slowsandNoise[j + k * 16] + this.hellRNG.nextDouble() * 0.2D > 0.0D; + boolean flag1 = this.gravelNoise[j + k * 16] + this.hellRNG.nextDouble() * 0.2D > 0.0D; + int l = (int)(this.netherrackExclusivityNoise[j + k * 16] / 3.0D + 3.0D + this.hellRNG.nextDouble() * 0.25D); + int i1 = -1; + IBlockState iblockstate = Blocks.netherrack.getDefaultState(); + IBlockState iblockstate1 = Blocks.netherrack.getDefaultState(); + + for (int j1 = 127; j1 >= 0; --j1) + { + if (j1 < 127 - this.hellRNG.nextInt(5) && j1 > this.hellRNG.nextInt(5)) + { + IBlockState iblockstate2 = p_180516_3_.getBlockState(k, j1, j); + + if (iblockstate2.getBlock() != null && iblockstate2.getBlock().getMaterial() != Material.air) + { + if (iblockstate2.getBlock() == Blocks.netherrack) + { + if (i1 == -1) + { + if (l <= 0) + { + iblockstate = null; + iblockstate1 = Blocks.netherrack.getDefaultState(); + } + else if (j1 >= i - 4 && j1 <= i + 1) + { + iblockstate = Blocks.netherrack.getDefaultState(); + iblockstate1 = Blocks.netherrack.getDefaultState(); + + if (flag1) + { + iblockstate = Blocks.gravel.getDefaultState(); + iblockstate1 = Blocks.netherrack.getDefaultState(); + } + + if (flag) + { + iblockstate = Blocks.soul_sand.getDefaultState(); + iblockstate1 = Blocks.soul_sand.getDefaultState(); + } + } + + if (j1 < i && (iblockstate == null || iblockstate.getBlock().getMaterial() == Material.air)) + { + iblockstate = Blocks.lava.getDefaultState(); + } + + i1 = l; + + if (j1 >= i - 1) + { + p_180516_3_.setBlockState(k, j1, j, iblockstate); + } + else + { + p_180516_3_.setBlockState(k, j1, j, iblockstate1); + } + } + else if (i1 > 0) + { + --i1; + p_180516_3_.setBlockState(k, j1, j, iblockstate1); + } + } + } + else + { + i1 = -1; + } + } + else + { + p_180516_3_.setBlockState(k, j1, j, Blocks.bedrock.getDefaultState()); + } + } + } + } + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int x, int z) + { + this.hellRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L); + ChunkPrimer chunkprimer = new ChunkPrimer(); + this.func_180515_a(x, z, chunkprimer); + this.func_180516_b(x, z, chunkprimer); + this.netherCaveGenerator.generate(this, this.worldObj, x, z, chunkprimer); + + if (this.field_177466_i) + { + this.genNetherBridge.generate(this, this.worldObj, x, z, chunkprimer); + } + + Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z); + BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, x * 16, z * 16, 16, 16); + byte[] abyte = chunk.getBiomeArray(); + + for (int i = 0; i < abyte.length; ++i) + { + abyte[i] = (byte)abiomegenbase[i].biomeID; + } + + chunk.resetRelightChecks(); + return chunk; + } + + /** + * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the + * size. + */ + private double[] initializeNoiseField(double[] p_73164_1_, int p_73164_2_, int p_73164_3_, int p_73164_4_, int p_73164_5_, int p_73164_6_, int p_73164_7_) + { + if (p_73164_1_ == null) + { + p_73164_1_ = new double[p_73164_5_ * p_73164_6_ * p_73164_7_]; + } + + double d0 = 684.412D; + double d1 = 2053.236D; + this.noiseData4 = this.netherNoiseGen6.generateNoiseOctaves(this.noiseData4, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, 1, p_73164_7_, 1.0D, 0.0D, 1.0D); + this.noiseData5 = this.netherNoiseGen7.generateNoiseOctaves(this.noiseData5, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, 1, p_73164_7_, 100.0D, 0.0D, 100.0D); + this.noiseData1 = this.netherNoiseGen3.generateNoiseOctaves(this.noiseData1, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_, d0 / 80.0D, d1 / 60.0D, d0 / 80.0D); + this.noiseData2 = this.netherNoiseGen1.generateNoiseOctaves(this.noiseData2, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_, d0, d1, d0); + this.noiseData3 = this.netherNoiseGen2.generateNoiseOctaves(this.noiseData3, p_73164_2_, p_73164_3_, p_73164_4_, p_73164_5_, p_73164_6_, p_73164_7_, d0, d1, d0); + int i = 0; + double[] adouble = new double[p_73164_6_]; + + for (int j = 0; j < p_73164_6_; ++j) + { + adouble[j] = Math.cos((double)j * Math.PI * 6.0D / (double)p_73164_6_) * 2.0D; + double d2 = (double)j; + + if (j > p_73164_6_ / 2) + { + d2 = (double)(p_73164_6_ - 1 - j); + } + + if (d2 < 4.0D) + { + d2 = 4.0D - d2; + adouble[j] -= d2 * d2 * d2 * 10.0D; + } + } + + for (int l = 0; l < p_73164_5_; ++l) + { + for (int i1 = 0; i1 < p_73164_7_; ++i1) + { + double d3 = 0.0D; + + for (int k = 0; k < p_73164_6_; ++k) + { + double d4 = 0.0D; + double d5 = adouble[k]; + double d6 = this.noiseData2[i] / 512.0D; + double d7 = this.noiseData3[i] / 512.0D; + double d8 = (this.noiseData1[i] / 10.0D + 1.0D) / 2.0D; + + if (d8 < 0.0D) + { + d4 = d6; + } + else if (d8 > 1.0D) + { + d4 = d7; + } + else + { + d4 = d6 + (d7 - d6) * d8; + } + + d4 = d4 - d5; + + if (k > p_73164_6_ - 4) + { + double d9 = (double)((float)(k - (p_73164_6_ - 4)) / 3.0F); + d4 = d4 * (1.0D - d9) + -10.0D * d9; + } + + if ((double)k < d3) + { + double d10 = (d3 - (double)k) / 4.0D; + d10 = MathHelper.clamp_double(d10, 0.0D, 1.0D); + d4 = d4 * (1.0D - d10) + -10.0D * d10; + } + + p_73164_1_[i] = d4; + ++i; + } + } + } + + return p_73164_1_; + } + + /** + * Checks to see if a chunk exists at x, z + */ + public boolean chunkExists(int x, int z) + { + return true; + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + BlockFalling.fallInstantly = true; + BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_); + this.genNetherBridge.generateStructure(this.worldObj, this.hellRNG, chunkcoordintpair); + + for (int i = 0; i < 8; ++i) + { + this.field_177472_y.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + + for (int j = 0; j < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; ++j) + { + this.field_177470_t.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + + for (int k = 0; k < this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); ++k) + { + this.field_177469_u.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(120) + 4, this.hellRNG.nextInt(16) + 8)); + } + + for (int l = 0; l < 10; ++l) + { + this.field_177468_v.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + + if (this.hellRNG.nextBoolean()) + { + this.field_177471_z.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + + if (this.hellRNG.nextBoolean()) + { + this.field_177465_A.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16) + 8, this.hellRNG.nextInt(128), this.hellRNG.nextInt(16) + 8)); + } + + for (int i1 = 0; i1 < 16; ++i1) + { + this.field_177467_w.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); + } + + for (int j1 = 0; j1 < 16; ++j1) + { + this.field_177473_x.generate(this.worldObj, this.hellRNG, blockpos.add(this.hellRNG.nextInt(16), this.hellRNG.nextInt(108) + 10, this.hellRNG.nextInt(16))); + } + + BlockFalling.fallInstantly = false; + } + + public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) + { + return false; + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean p_73151_1_, IProgressUpdate progressCallback) + { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() + { + } + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return true; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "HellRandomLevelSource"; + } + + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) + { + if (creatureType == EnumCreatureType.MONSTER) + { + if (this.genNetherBridge.func_175795_b(pos)) + { + return this.genNetherBridge.getSpawnList(); + } + + if (this.genNetherBridge.func_175796_a(this.worldObj, pos) && this.worldObj.getBlockState(pos.down()).getBlock() == Blocks.nether_brick) + { + return this.genNetherBridge.getSpawnList(); + } + } + + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos); + return biomegenbase.getSpawnableList(creatureType); + } + + public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) + { + return null; + } + + public int getLoadedChunkCount() + { + return 0; + } + + public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) + { + this.genNetherBridge.generate(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null); + } + + public Chunk provideChunk(BlockPos blockPosIn) + { + return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/ChunkProviderServer.java b/src/minecraft/net/minecraft/world/gen/ChunkProviderServer.java new file mode 100644 index 0000000..9e54534 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/ChunkProviderServer.java @@ -0,0 +1,375 @@ +package net.minecraft.world.gen; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.LongHashMap; +import net.minecraft.util.ReportedException; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.EmptyChunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.chunk.storage.IChunkLoader; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class ChunkProviderServer implements IChunkProvider +{ + private static final Logger logger = LogManager.getLogger(); + private Set droppedChunksSet = Collections.newSetFromMap(new ConcurrentHashMap()); + + /** a dummy chunk, returned in place of an actual chunk. */ + private Chunk dummyChunk; + + /** + * chunk generator object. Calls to load nonexistent chunks are forwarded to this object. + */ + private IChunkProvider serverChunkGenerator; + private IChunkLoader chunkLoader; + + /** + * if set, this flag forces a request to load a chunk to load the chunk rather than defaulting to the dummy if + * possible + */ + public boolean chunkLoadOverride = true; + private LongHashMap id2ChunkMap = new LongHashMap(); + private List loadedChunks = Lists.newArrayList(); + private WorldServer worldObj; + + public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) + { + this.dummyChunk = new EmptyChunk(p_i1520_1_, 0, 0); + this.worldObj = p_i1520_1_; + this.chunkLoader = p_i1520_2_; + this.serverChunkGenerator = p_i1520_3_; + } + + /** + * Checks to see if a chunk exists at x, z + */ + public boolean chunkExists(int x, int z) + { + return this.id2ChunkMap.containsItem(ChunkCoordIntPair.chunkXZ2Int(x, z)); + } + + public List func_152380_a() + { + return this.loadedChunks; + } + + public void dropChunk(int p_73241_1_, int p_73241_2_) + { + if (this.worldObj.provider.canRespawnHere()) + { + if (!this.worldObj.isSpawnChunk(p_73241_1_, p_73241_2_)) + { + this.droppedChunksSet.add(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(p_73241_1_, p_73241_2_))); + } + } + else + { + this.droppedChunksSet.add(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(p_73241_1_, p_73241_2_))); + } + } + + /** + * marks all chunks for unload, ignoring those near the spawn + */ + public void unloadAllChunks() + { + for (Chunk chunk : this.loadedChunks) + { + this.dropChunk(chunk.xPosition, chunk.zPosition); + } + } + + /** + * loads or generates the chunk at the chunk location specified + */ + public Chunk loadChunk(int p_73158_1_, int p_73158_2_) + { + long i = ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_); + this.droppedChunksSet.remove(Long.valueOf(i)); + Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(i); + + if (chunk == null) + { + chunk = this.loadChunkFromFile(p_73158_1_, p_73158_2_); + + if (chunk == null) + { + if (this.serverChunkGenerator == null) + { + chunk = this.dummyChunk; + } + else + { + try + { + chunk = this.serverChunkGenerator.provideChunk(p_73158_1_, p_73158_2_); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception generating new chunk"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Chunk to be generated"); + crashreportcategory.addCrashSection("Location", String.format("%d,%d", new Object[] {Integer.valueOf(p_73158_1_), Integer.valueOf(p_73158_2_)})); + crashreportcategory.addCrashSection("Position hash", Long.valueOf(i)); + crashreportcategory.addCrashSection("Generator", this.serverChunkGenerator.makeString()); + throw new ReportedException(crashreport); + } + } + } + + this.id2ChunkMap.add(i, chunk); + this.loadedChunks.add(chunk); + chunk.onChunkLoad(); + chunk.populateChunk(this, this, p_73158_1_, p_73158_2_); + } + + return chunk; + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int x, int z) + { + Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(x, z)); + return chunk == null ? (!this.worldObj.isFindingSpawnPoint() && !this.chunkLoadOverride ? this.dummyChunk : this.loadChunk(x, z)) : chunk; + } + + private Chunk loadChunkFromFile(int x, int z) + { + if (this.chunkLoader == null) + { + return null; + } + else + { + try + { + Chunk chunk = this.chunkLoader.loadChunk(this.worldObj, x, z); + + if (chunk != null) + { + chunk.setLastSaveTime(this.worldObj.getTotalWorldTime()); + + if (this.serverChunkGenerator != null) + { + this.serverChunkGenerator.recreateStructures(chunk, x, z); + } + } + + return chunk; + } + catch (Exception exception) + { + logger.error((String)"Couldn\'t load chunk", (Throwable)exception); + return null; + } + } + } + + private void saveChunkExtraData(Chunk p_73243_1_) + { + if (this.chunkLoader != null) + { + try + { + this.chunkLoader.saveExtraChunkData(this.worldObj, p_73243_1_); + } + catch (Exception exception) + { + logger.error((String)"Couldn\'t save entities", (Throwable)exception); + } + } + } + + private void saveChunkData(Chunk p_73242_1_) + { + if (this.chunkLoader != null) + { + try + { + p_73242_1_.setLastSaveTime(this.worldObj.getTotalWorldTime()); + this.chunkLoader.saveChunk(this.worldObj, p_73242_1_); + } + catch (IOException ioexception) + { + logger.error((String)"Couldn\'t save chunk", (Throwable)ioexception); + } + catch (MinecraftException minecraftexception) + { + logger.error((String)"Couldn\'t save chunk; already in use by another instance of Minecraft?", (Throwable)minecraftexception); + } + } + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) + { + Chunk chunk = this.provideChunk(p_73153_2_, p_73153_3_); + + if (!chunk.isTerrainPopulated()) + { + chunk.func_150809_p(); + + if (this.serverChunkGenerator != null) + { + this.serverChunkGenerator.populate(p_73153_1_, p_73153_2_, p_73153_3_); + chunk.setChunkModified(); + } + } + } + + public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) + { + if (this.serverChunkGenerator != null && this.serverChunkGenerator.func_177460_a(p_177460_1_, p_177460_2_, p_177460_3_, p_177460_4_)) + { + Chunk chunk = this.provideChunk(p_177460_3_, p_177460_4_); + chunk.setChunkModified(); + return true; + } + else + { + return false; + } + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean p_73151_1_, IProgressUpdate progressCallback) + { + int i = 0; + List list = Lists.newArrayList(this.loadedChunks); + + for (int j = 0; j < ((List)list).size(); ++j) + { + Chunk chunk = (Chunk)list.get(j); + + if (p_73151_1_) + { + this.saveChunkExtraData(chunk); + } + + if (chunk.needsSaving(p_73151_1_)) + { + this.saveChunkData(chunk); + chunk.setModified(false); + ++i; + + if (i == 24 && !p_73151_1_) + { + return false; + } + } + } + + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() + { + if (this.chunkLoader != null) + { + this.chunkLoader.saveExtraData(); + } + } + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + if (!this.worldObj.disableLevelSaving) + { + for (int i = 0; i < 100; ++i) + { + if (!this.droppedChunksSet.isEmpty()) + { + Long olong = (Long)this.droppedChunksSet.iterator().next(); + Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(olong.longValue()); + + if (chunk != null) + { + chunk.onChunkUnload(); + this.saveChunkData(chunk); + this.saveChunkExtraData(chunk); + this.id2ChunkMap.remove(olong.longValue()); + this.loadedChunks.remove(chunk); + } + + this.droppedChunksSet.remove(olong); + } + } + + if (this.chunkLoader != null) + { + this.chunkLoader.chunkTick(); + } + } + + return this.serverChunkGenerator.unloadQueuedChunks(); + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return !this.worldObj.disableLevelSaving; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "ServerChunkCache: " + this.id2ChunkMap.getNumHashElements() + " Drop: " + this.droppedChunksSet.size(); + } + + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) + { + return this.serverChunkGenerator.getPossibleCreatures(creatureType, pos); + } + + public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) + { + return this.serverChunkGenerator.getStrongholdGen(worldIn, structureName, position); + } + + public int getLoadedChunkCount() + { + return this.id2ChunkMap.getNumHashElements(); + } + + public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) + { + } + + public Chunk provideChunk(BlockPos blockPosIn) + { + return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/ChunkProviderSettings.java b/src/minecraft/net/minecraft/world/gen/ChunkProviderSettings.java new file mode 100644 index 0000000..d55e5ba --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/ChunkProviderSettings.java @@ -0,0 +1,671 @@ +package net.minecraft.world.gen; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; +import net.minecraft.util.JsonUtils; +import net.minecraft.world.biome.BiomeGenBase; + +public class ChunkProviderSettings +{ + public final float coordinateScale; + public final float heightScale; + public final float upperLimitScale; + public final float lowerLimitScale; + public final float depthNoiseScaleX; + public final float depthNoiseScaleZ; + public final float depthNoiseScaleExponent; + public final float mainNoiseScaleX; + public final float mainNoiseScaleY; + public final float mainNoiseScaleZ; + public final float baseSize; + public final float stretchY; + public final float biomeDepthWeight; + public final float biomeDepthOffSet; + public final float biomeScaleWeight; + public final float biomeScaleOffset; + public final int seaLevel; + public final boolean useCaves; + public final boolean useDungeons; + public final int dungeonChance; + public final boolean useStrongholds; + public final boolean useVillages; + public final boolean useMineShafts; + public final boolean useTemples; + public final boolean useMonuments; + public final boolean useRavines; + public final boolean useWaterLakes; + public final int waterLakeChance; + public final boolean useLavaLakes; + public final int lavaLakeChance; + public final boolean useLavaOceans; + public final int fixedBiome; + public final int biomeSize; + public final int riverSize; + public final int dirtSize; + public final int dirtCount; + public final int dirtMinHeight; + public final int dirtMaxHeight; + public final int gravelSize; + public final int gravelCount; + public final int gravelMinHeight; + public final int gravelMaxHeight; + public final int graniteSize; + public final int graniteCount; + public final int graniteMinHeight; + public final int graniteMaxHeight; + public final int dioriteSize; + public final int dioriteCount; + public final int dioriteMinHeight; + public final int dioriteMaxHeight; + public final int andesiteSize; + public final int andesiteCount; + public final int andesiteMinHeight; + public final int andesiteMaxHeight; + public final int coalSize; + public final int coalCount; + public final int coalMinHeight; + public final int coalMaxHeight; + public final int ironSize; + public final int ironCount; + public final int ironMinHeight; + public final int ironMaxHeight; + public final int goldSize; + public final int goldCount; + public final int goldMinHeight; + public final int goldMaxHeight; + public final int redstoneSize; + public final int redstoneCount; + public final int redstoneMinHeight; + public final int redstoneMaxHeight; + public final int diamondSize; + public final int diamondCount; + public final int diamondMinHeight; + public final int diamondMaxHeight; + public final int lapisSize; + public final int lapisCount; + public final int lapisCenterHeight; + public final int lapisSpread; + + private ChunkProviderSettings(ChunkProviderSettings.Factory settingsFactory) + { + this.coordinateScale = settingsFactory.coordinateScale; + this.heightScale = settingsFactory.heightScale; + this.upperLimitScale = settingsFactory.upperLimitScale; + this.lowerLimitScale = settingsFactory.lowerLimitScale; + this.depthNoiseScaleX = settingsFactory.depthNoiseScaleX; + this.depthNoiseScaleZ = settingsFactory.depthNoiseScaleZ; + this.depthNoiseScaleExponent = settingsFactory.depthNoiseScaleExponent; + this.mainNoiseScaleX = settingsFactory.mainNoiseScaleX; + this.mainNoiseScaleY = settingsFactory.mainNoiseScaleY; + this.mainNoiseScaleZ = settingsFactory.mainNoiseScaleZ; + this.baseSize = settingsFactory.baseSize; + this.stretchY = settingsFactory.stretchY; + this.biomeDepthWeight = settingsFactory.biomeDepthWeight; + this.biomeDepthOffSet = settingsFactory.biomeDepthOffset; + this.biomeScaleWeight = settingsFactory.biomeScaleWeight; + this.biomeScaleOffset = settingsFactory.biomeScaleOffset; + this.seaLevel = settingsFactory.seaLevel; + this.useCaves = settingsFactory.useCaves; + this.useDungeons = settingsFactory.useDungeons; + this.dungeonChance = settingsFactory.dungeonChance; + this.useStrongholds = settingsFactory.useStrongholds; + this.useVillages = settingsFactory.useVillages; + this.useMineShafts = settingsFactory.useMineShafts; + this.useTemples = settingsFactory.useTemples; + this.useMonuments = settingsFactory.useMonuments; + this.useRavines = settingsFactory.useRavines; + this.useWaterLakes = settingsFactory.useWaterLakes; + this.waterLakeChance = settingsFactory.waterLakeChance; + this.useLavaLakes = settingsFactory.useLavaLakes; + this.lavaLakeChance = settingsFactory.lavaLakeChance; + this.useLavaOceans = settingsFactory.useLavaOceans; + this.fixedBiome = settingsFactory.fixedBiome; + this.biomeSize = settingsFactory.biomeSize; + this.riverSize = settingsFactory.riverSize; + this.dirtSize = settingsFactory.dirtSize; + this.dirtCount = settingsFactory.dirtCount; + this.dirtMinHeight = settingsFactory.dirtMinHeight; + this.dirtMaxHeight = settingsFactory.dirtMaxHeight; + this.gravelSize = settingsFactory.gravelSize; + this.gravelCount = settingsFactory.gravelCount; + this.gravelMinHeight = settingsFactory.gravelMinHeight; + this.gravelMaxHeight = settingsFactory.gravelMaxHeight; + this.graniteSize = settingsFactory.graniteSize; + this.graniteCount = settingsFactory.graniteCount; + this.graniteMinHeight = settingsFactory.graniteMinHeight; + this.graniteMaxHeight = settingsFactory.graniteMaxHeight; + this.dioriteSize = settingsFactory.dioriteSize; + this.dioriteCount = settingsFactory.dioriteCount; + this.dioriteMinHeight = settingsFactory.dioriteMinHeight; + this.dioriteMaxHeight = settingsFactory.dioriteMaxHeight; + this.andesiteSize = settingsFactory.andesiteSize; + this.andesiteCount = settingsFactory.andesiteCount; + this.andesiteMinHeight = settingsFactory.andesiteMinHeight; + this.andesiteMaxHeight = settingsFactory.andesiteMaxHeight; + this.coalSize = settingsFactory.coalSize; + this.coalCount = settingsFactory.coalCount; + this.coalMinHeight = settingsFactory.coalMinHeight; + this.coalMaxHeight = settingsFactory.coalMaxHeight; + this.ironSize = settingsFactory.ironSize; + this.ironCount = settingsFactory.ironCount; + this.ironMinHeight = settingsFactory.ironMinHeight; + this.ironMaxHeight = settingsFactory.ironMaxHeight; + this.goldSize = settingsFactory.goldSize; + this.goldCount = settingsFactory.goldCount; + this.goldMinHeight = settingsFactory.goldMinHeight; + this.goldMaxHeight = settingsFactory.goldMaxHeight; + this.redstoneSize = settingsFactory.redstoneSize; + this.redstoneCount = settingsFactory.redstoneCount; + this.redstoneMinHeight = settingsFactory.redstoneMinHeight; + this.redstoneMaxHeight = settingsFactory.redstoneMaxHeight; + this.diamondSize = settingsFactory.diamondSize; + this.diamondCount = settingsFactory.diamondCount; + this.diamondMinHeight = settingsFactory.diamondMinHeight; + this.diamondMaxHeight = settingsFactory.diamondMaxHeight; + this.lapisSize = settingsFactory.lapisSize; + this.lapisCount = settingsFactory.lapisCount; + this.lapisCenterHeight = settingsFactory.lapisCenterHeight; + this.lapisSpread = settingsFactory.lapisSpread; + } + + public static class Factory + { + static final Gson JSON_ADAPTER = (new GsonBuilder()).registerTypeAdapter(ChunkProviderSettings.Factory.class, new ChunkProviderSettings.Serializer()).create(); + public float coordinateScale = 684.412F; + public float heightScale = 684.412F; + public float upperLimitScale = 512.0F; + public float lowerLimitScale = 512.0F; + public float depthNoiseScaleX = 200.0F; + public float depthNoiseScaleZ = 200.0F; + public float depthNoiseScaleExponent = 0.5F; + public float mainNoiseScaleX = 80.0F; + public float mainNoiseScaleY = 160.0F; + public float mainNoiseScaleZ = 80.0F; + public float baseSize = 8.5F; + public float stretchY = 12.0F; + public float biomeDepthWeight = 1.0F; + public float biomeDepthOffset = 0.0F; + public float biomeScaleWeight = 1.0F; + public float biomeScaleOffset = 0.0F; + public int seaLevel = 63; + public boolean useCaves = true; + public boolean useDungeons = true; + public int dungeonChance = 8; + public boolean useStrongholds = true; + public boolean useVillages = true; + public boolean useMineShafts = true; + public boolean useTemples = true; + public boolean useMonuments = true; + public boolean useRavines = true; + public boolean useWaterLakes = true; + public int waterLakeChance = 4; + public boolean useLavaLakes = true; + public int lavaLakeChance = 80; + public boolean useLavaOceans = false; + public int fixedBiome = -1; + public int biomeSize = 4; + public int riverSize = 4; + public int dirtSize = 33; + public int dirtCount = 10; + public int dirtMinHeight = 0; + public int dirtMaxHeight = 256; + public int gravelSize = 33; + public int gravelCount = 8; + public int gravelMinHeight = 0; + public int gravelMaxHeight = 256; + public int graniteSize = 33; + public int graniteCount = 10; + public int graniteMinHeight = 0; + public int graniteMaxHeight = 80; + public int dioriteSize = 33; + public int dioriteCount = 10; + public int dioriteMinHeight = 0; + public int dioriteMaxHeight = 80; + public int andesiteSize = 33; + public int andesiteCount = 10; + public int andesiteMinHeight = 0; + public int andesiteMaxHeight = 80; + public int coalSize = 17; + public int coalCount = 20; + public int coalMinHeight = 0; + public int coalMaxHeight = 128; + public int ironSize = 9; + public int ironCount = 20; + public int ironMinHeight = 0; + public int ironMaxHeight = 64; + public int goldSize = 9; + public int goldCount = 2; + public int goldMinHeight = 0; + public int goldMaxHeight = 32; + public int redstoneSize = 8; + public int redstoneCount = 8; + public int redstoneMinHeight = 0; + public int redstoneMaxHeight = 16; + public int diamondSize = 8; + public int diamondCount = 1; + public int diamondMinHeight = 0; + public int diamondMaxHeight = 16; + public int lapisSize = 7; + public int lapisCount = 1; + public int lapisCenterHeight = 16; + public int lapisSpread = 16; + + public static ChunkProviderSettings.Factory jsonToFactory(String p_177865_0_) + { + if (p_177865_0_.length() == 0) + { + return new ChunkProviderSettings.Factory(); + } + else + { + try + { + return (ChunkProviderSettings.Factory)JSON_ADAPTER.fromJson(p_177865_0_, ChunkProviderSettings.Factory.class); + } + catch (Exception var2) + { + return new ChunkProviderSettings.Factory(); + } + } + } + + public String toString() + { + return JSON_ADAPTER.toJson((Object)this); + } + + public Factory() + { + this.func_177863_a(); + } + + public void func_177863_a() + { + this.coordinateScale = 684.412F; + this.heightScale = 684.412F; + this.upperLimitScale = 512.0F; + this.lowerLimitScale = 512.0F; + this.depthNoiseScaleX = 200.0F; + this.depthNoiseScaleZ = 200.0F; + this.depthNoiseScaleExponent = 0.5F; + this.mainNoiseScaleX = 80.0F; + this.mainNoiseScaleY = 160.0F; + this.mainNoiseScaleZ = 80.0F; + this.baseSize = 8.5F; + this.stretchY = 12.0F; + this.biomeDepthWeight = 1.0F; + this.biomeDepthOffset = 0.0F; + this.biomeScaleWeight = 1.0F; + this.biomeScaleOffset = 0.0F; + this.seaLevel = 63; + this.useCaves = true; + this.useDungeons = true; + this.dungeonChance = 8; + this.useStrongholds = true; + this.useVillages = true; + this.useMineShafts = true; + this.useTemples = true; + this.useMonuments = true; + this.useRavines = true; + this.useWaterLakes = true; + this.waterLakeChance = 4; + this.useLavaLakes = true; + this.lavaLakeChance = 80; + this.useLavaOceans = false; + this.fixedBiome = -1; + this.biomeSize = 4; + this.riverSize = 4; + this.dirtSize = 33; + this.dirtCount = 10; + this.dirtMinHeight = 0; + this.dirtMaxHeight = 256; + this.gravelSize = 33; + this.gravelCount = 8; + this.gravelMinHeight = 0; + this.gravelMaxHeight = 256; + this.graniteSize = 33; + this.graniteCount = 10; + this.graniteMinHeight = 0; + this.graniteMaxHeight = 80; + this.dioriteSize = 33; + this.dioriteCount = 10; + this.dioriteMinHeight = 0; + this.dioriteMaxHeight = 80; + this.andesiteSize = 33; + this.andesiteCount = 10; + this.andesiteMinHeight = 0; + this.andesiteMaxHeight = 80; + this.coalSize = 17; + this.coalCount = 20; + this.coalMinHeight = 0; + this.coalMaxHeight = 128; + this.ironSize = 9; + this.ironCount = 20; + this.ironMinHeight = 0; + this.ironMaxHeight = 64; + this.goldSize = 9; + this.goldCount = 2; + this.goldMinHeight = 0; + this.goldMaxHeight = 32; + this.redstoneSize = 8; + this.redstoneCount = 8; + this.redstoneMinHeight = 0; + this.redstoneMaxHeight = 16; + this.diamondSize = 8; + this.diamondCount = 1; + this.diamondMinHeight = 0; + this.diamondMaxHeight = 16; + this.lapisSize = 7; + this.lapisCount = 1; + this.lapisCenterHeight = 16; + this.lapisSpread = 16; + } + + public boolean equals(Object p_equals_1_) + { + if (this == p_equals_1_) + { + return true; + } + else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) + { + ChunkProviderSettings.Factory chunkprovidersettings$factory = (ChunkProviderSettings.Factory)p_equals_1_; + return this.andesiteCount != chunkprovidersettings$factory.andesiteCount ? false : (this.andesiteMaxHeight != chunkprovidersettings$factory.andesiteMaxHeight ? false : (this.andesiteMinHeight != chunkprovidersettings$factory.andesiteMinHeight ? false : (this.andesiteSize != chunkprovidersettings$factory.andesiteSize ? false : (Float.compare(chunkprovidersettings$factory.baseSize, this.baseSize) != 0 ? false : (Float.compare(chunkprovidersettings$factory.biomeDepthOffset, this.biomeDepthOffset) != 0 ? false : (Float.compare(chunkprovidersettings$factory.biomeDepthWeight, this.biomeDepthWeight) != 0 ? false : (Float.compare(chunkprovidersettings$factory.biomeScaleOffset, this.biomeScaleOffset) != 0 ? false : (Float.compare(chunkprovidersettings$factory.biomeScaleWeight, this.biomeScaleWeight) != 0 ? false : (this.biomeSize != chunkprovidersettings$factory.biomeSize ? false : (this.coalCount != chunkprovidersettings$factory.coalCount ? false : (this.coalMaxHeight != chunkprovidersettings$factory.coalMaxHeight ? false : (this.coalMinHeight != chunkprovidersettings$factory.coalMinHeight ? false : (this.coalSize != chunkprovidersettings$factory.coalSize ? false : (Float.compare(chunkprovidersettings$factory.coordinateScale, this.coordinateScale) != 0 ? false : (Float.compare(chunkprovidersettings$factory.depthNoiseScaleExponent, this.depthNoiseScaleExponent) != 0 ? false : (Float.compare(chunkprovidersettings$factory.depthNoiseScaleX, this.depthNoiseScaleX) != 0 ? false : (Float.compare(chunkprovidersettings$factory.depthNoiseScaleZ, this.depthNoiseScaleZ) != 0 ? false : (this.diamondCount != chunkprovidersettings$factory.diamondCount ? false : (this.diamondMaxHeight != chunkprovidersettings$factory.diamondMaxHeight ? false : (this.diamondMinHeight != chunkprovidersettings$factory.diamondMinHeight ? false : (this.diamondSize != chunkprovidersettings$factory.diamondSize ? false : (this.dioriteCount != chunkprovidersettings$factory.dioriteCount ? false : (this.dioriteMaxHeight != chunkprovidersettings$factory.dioriteMaxHeight ? false : (this.dioriteMinHeight != chunkprovidersettings$factory.dioriteMinHeight ? false : (this.dioriteSize != chunkprovidersettings$factory.dioriteSize ? false : (this.dirtCount != chunkprovidersettings$factory.dirtCount ? false : (this.dirtMaxHeight != chunkprovidersettings$factory.dirtMaxHeight ? false : (this.dirtMinHeight != chunkprovidersettings$factory.dirtMinHeight ? false : (this.dirtSize != chunkprovidersettings$factory.dirtSize ? false : (this.dungeonChance != chunkprovidersettings$factory.dungeonChance ? false : (this.fixedBiome != chunkprovidersettings$factory.fixedBiome ? false : (this.goldCount != chunkprovidersettings$factory.goldCount ? false : (this.goldMaxHeight != chunkprovidersettings$factory.goldMaxHeight ? false : (this.goldMinHeight != chunkprovidersettings$factory.goldMinHeight ? false : (this.goldSize != chunkprovidersettings$factory.goldSize ? false : (this.graniteCount != chunkprovidersettings$factory.graniteCount ? false : (this.graniteMaxHeight != chunkprovidersettings$factory.graniteMaxHeight ? false : (this.graniteMinHeight != chunkprovidersettings$factory.graniteMinHeight ? false : (this.graniteSize != chunkprovidersettings$factory.graniteSize ? false : (this.gravelCount != chunkprovidersettings$factory.gravelCount ? false : (this.gravelMaxHeight != chunkprovidersettings$factory.gravelMaxHeight ? false : (this.gravelMinHeight != chunkprovidersettings$factory.gravelMinHeight ? false : (this.gravelSize != chunkprovidersettings$factory.gravelSize ? false : (Float.compare(chunkprovidersettings$factory.heightScale, this.heightScale) != 0 ? false : (this.ironCount != chunkprovidersettings$factory.ironCount ? false : (this.ironMaxHeight != chunkprovidersettings$factory.ironMaxHeight ? false : (this.ironMinHeight != chunkprovidersettings$factory.ironMinHeight ? false : (this.ironSize != chunkprovidersettings$factory.ironSize ? false : (this.lapisCenterHeight != chunkprovidersettings$factory.lapisCenterHeight ? false : (this.lapisCount != chunkprovidersettings$factory.lapisCount ? false : (this.lapisSize != chunkprovidersettings$factory.lapisSize ? false : (this.lapisSpread != chunkprovidersettings$factory.lapisSpread ? false : (this.lavaLakeChance != chunkprovidersettings$factory.lavaLakeChance ? false : (Float.compare(chunkprovidersettings$factory.lowerLimitScale, this.lowerLimitScale) != 0 ? false : (Float.compare(chunkprovidersettings$factory.mainNoiseScaleX, this.mainNoiseScaleX) != 0 ? false : (Float.compare(chunkprovidersettings$factory.mainNoiseScaleY, this.mainNoiseScaleY) != 0 ? false : (Float.compare(chunkprovidersettings$factory.mainNoiseScaleZ, this.mainNoiseScaleZ) != 0 ? false : (this.redstoneCount != chunkprovidersettings$factory.redstoneCount ? false : (this.redstoneMaxHeight != chunkprovidersettings$factory.redstoneMaxHeight ? false : (this.redstoneMinHeight != chunkprovidersettings$factory.redstoneMinHeight ? false : (this.redstoneSize != chunkprovidersettings$factory.redstoneSize ? false : (this.riverSize != chunkprovidersettings$factory.riverSize ? false : (this.seaLevel != chunkprovidersettings$factory.seaLevel ? false : (Float.compare(chunkprovidersettings$factory.stretchY, this.stretchY) != 0 ? false : (Float.compare(chunkprovidersettings$factory.upperLimitScale, this.upperLimitScale) != 0 ? false : (this.useCaves != chunkprovidersettings$factory.useCaves ? false : (this.useDungeons != chunkprovidersettings$factory.useDungeons ? false : (this.useLavaLakes != chunkprovidersettings$factory.useLavaLakes ? false : (this.useLavaOceans != chunkprovidersettings$factory.useLavaOceans ? false : (this.useMineShafts != chunkprovidersettings$factory.useMineShafts ? false : (this.useRavines != chunkprovidersettings$factory.useRavines ? false : (this.useStrongholds != chunkprovidersettings$factory.useStrongholds ? false : (this.useTemples != chunkprovidersettings$factory.useTemples ? false : (this.useMonuments != chunkprovidersettings$factory.useMonuments ? false : (this.useVillages != chunkprovidersettings$factory.useVillages ? false : (this.useWaterLakes != chunkprovidersettings$factory.useWaterLakes ? false : this.waterLakeChance == chunkprovidersettings$factory.waterLakeChance)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); + } + else + { + return false; + } + } + + public int hashCode() + { + int i = this.coordinateScale != 0.0F ? Float.floatToIntBits(this.coordinateScale) : 0; + i = 31 * i + (this.heightScale != 0.0F ? Float.floatToIntBits(this.heightScale) : 0); + i = 31 * i + (this.upperLimitScale != 0.0F ? Float.floatToIntBits(this.upperLimitScale) : 0); + i = 31 * i + (this.lowerLimitScale != 0.0F ? Float.floatToIntBits(this.lowerLimitScale) : 0); + i = 31 * i + (this.depthNoiseScaleX != 0.0F ? Float.floatToIntBits(this.depthNoiseScaleX) : 0); + i = 31 * i + (this.depthNoiseScaleZ != 0.0F ? Float.floatToIntBits(this.depthNoiseScaleZ) : 0); + i = 31 * i + (this.depthNoiseScaleExponent != 0.0F ? Float.floatToIntBits(this.depthNoiseScaleExponent) : 0); + i = 31 * i + (this.mainNoiseScaleX != 0.0F ? Float.floatToIntBits(this.mainNoiseScaleX) : 0); + i = 31 * i + (this.mainNoiseScaleY != 0.0F ? Float.floatToIntBits(this.mainNoiseScaleY) : 0); + i = 31 * i + (this.mainNoiseScaleZ != 0.0F ? Float.floatToIntBits(this.mainNoiseScaleZ) : 0); + i = 31 * i + (this.baseSize != 0.0F ? Float.floatToIntBits(this.baseSize) : 0); + i = 31 * i + (this.stretchY != 0.0F ? Float.floatToIntBits(this.stretchY) : 0); + i = 31 * i + (this.biomeDepthWeight != 0.0F ? Float.floatToIntBits(this.biomeDepthWeight) : 0); + i = 31 * i + (this.biomeDepthOffset != 0.0F ? Float.floatToIntBits(this.biomeDepthOffset) : 0); + i = 31 * i + (this.biomeScaleWeight != 0.0F ? Float.floatToIntBits(this.biomeScaleWeight) : 0); + i = 31 * i + (this.biomeScaleOffset != 0.0F ? Float.floatToIntBits(this.biomeScaleOffset) : 0); + i = 31 * i + this.seaLevel; + i = 31 * i + (this.useCaves ? 1 : 0); + i = 31 * i + (this.useDungeons ? 1 : 0); + i = 31 * i + this.dungeonChance; + i = 31 * i + (this.useStrongholds ? 1 : 0); + i = 31 * i + (this.useVillages ? 1 : 0); + i = 31 * i + (this.useMineShafts ? 1 : 0); + i = 31 * i + (this.useTemples ? 1 : 0); + i = 31 * i + (this.useMonuments ? 1 : 0); + i = 31 * i + (this.useRavines ? 1 : 0); + i = 31 * i + (this.useWaterLakes ? 1 : 0); + i = 31 * i + this.waterLakeChance; + i = 31 * i + (this.useLavaLakes ? 1 : 0); + i = 31 * i + this.lavaLakeChance; + i = 31 * i + (this.useLavaOceans ? 1 : 0); + i = 31 * i + this.fixedBiome; + i = 31 * i + this.biomeSize; + i = 31 * i + this.riverSize; + i = 31 * i + this.dirtSize; + i = 31 * i + this.dirtCount; + i = 31 * i + this.dirtMinHeight; + i = 31 * i + this.dirtMaxHeight; + i = 31 * i + this.gravelSize; + i = 31 * i + this.gravelCount; + i = 31 * i + this.gravelMinHeight; + i = 31 * i + this.gravelMaxHeight; + i = 31 * i + this.graniteSize; + i = 31 * i + this.graniteCount; + i = 31 * i + this.graniteMinHeight; + i = 31 * i + this.graniteMaxHeight; + i = 31 * i + this.dioriteSize; + i = 31 * i + this.dioriteCount; + i = 31 * i + this.dioriteMinHeight; + i = 31 * i + this.dioriteMaxHeight; + i = 31 * i + this.andesiteSize; + i = 31 * i + this.andesiteCount; + i = 31 * i + this.andesiteMinHeight; + i = 31 * i + this.andesiteMaxHeight; + i = 31 * i + this.coalSize; + i = 31 * i + this.coalCount; + i = 31 * i + this.coalMinHeight; + i = 31 * i + this.coalMaxHeight; + i = 31 * i + this.ironSize; + i = 31 * i + this.ironCount; + i = 31 * i + this.ironMinHeight; + i = 31 * i + this.ironMaxHeight; + i = 31 * i + this.goldSize; + i = 31 * i + this.goldCount; + i = 31 * i + this.goldMinHeight; + i = 31 * i + this.goldMaxHeight; + i = 31 * i + this.redstoneSize; + i = 31 * i + this.redstoneCount; + i = 31 * i + this.redstoneMinHeight; + i = 31 * i + this.redstoneMaxHeight; + i = 31 * i + this.diamondSize; + i = 31 * i + this.diamondCount; + i = 31 * i + this.diamondMinHeight; + i = 31 * i + this.diamondMaxHeight; + i = 31 * i + this.lapisSize; + i = 31 * i + this.lapisCount; + i = 31 * i + this.lapisCenterHeight; + i = 31 * i + this.lapisSpread; + return i; + } + + public ChunkProviderSettings func_177864_b() + { + return new ChunkProviderSettings(this); + } + } + + public static class Serializer implements JsonDeserializer, JsonSerializer + { + public ChunkProviderSettings.Factory deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException + { + JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); + ChunkProviderSettings.Factory chunkprovidersettings$factory = new ChunkProviderSettings.Factory(); + + try + { + chunkprovidersettings$factory.coordinateScale = JsonUtils.getFloat(jsonobject, "coordinateScale", chunkprovidersettings$factory.coordinateScale); + chunkprovidersettings$factory.heightScale = JsonUtils.getFloat(jsonobject, "heightScale", chunkprovidersettings$factory.heightScale); + chunkprovidersettings$factory.lowerLimitScale = JsonUtils.getFloat(jsonobject, "lowerLimitScale", chunkprovidersettings$factory.lowerLimitScale); + chunkprovidersettings$factory.upperLimitScale = JsonUtils.getFloat(jsonobject, "upperLimitScale", chunkprovidersettings$factory.upperLimitScale); + chunkprovidersettings$factory.depthNoiseScaleX = JsonUtils.getFloat(jsonobject, "depthNoiseScaleX", chunkprovidersettings$factory.depthNoiseScaleX); + chunkprovidersettings$factory.depthNoiseScaleZ = JsonUtils.getFloat(jsonobject, "depthNoiseScaleZ", chunkprovidersettings$factory.depthNoiseScaleZ); + chunkprovidersettings$factory.depthNoiseScaleExponent = JsonUtils.getFloat(jsonobject, "depthNoiseScaleExponent", chunkprovidersettings$factory.depthNoiseScaleExponent); + chunkprovidersettings$factory.mainNoiseScaleX = JsonUtils.getFloat(jsonobject, "mainNoiseScaleX", chunkprovidersettings$factory.mainNoiseScaleX); + chunkprovidersettings$factory.mainNoiseScaleY = JsonUtils.getFloat(jsonobject, "mainNoiseScaleY", chunkprovidersettings$factory.mainNoiseScaleY); + chunkprovidersettings$factory.mainNoiseScaleZ = JsonUtils.getFloat(jsonobject, "mainNoiseScaleZ", chunkprovidersettings$factory.mainNoiseScaleZ); + chunkprovidersettings$factory.baseSize = JsonUtils.getFloat(jsonobject, "baseSize", chunkprovidersettings$factory.baseSize); + chunkprovidersettings$factory.stretchY = JsonUtils.getFloat(jsonobject, "stretchY", chunkprovidersettings$factory.stretchY); + chunkprovidersettings$factory.biomeDepthWeight = JsonUtils.getFloat(jsonobject, "biomeDepthWeight", chunkprovidersettings$factory.biomeDepthWeight); + chunkprovidersettings$factory.biomeDepthOffset = JsonUtils.getFloat(jsonobject, "biomeDepthOffset", chunkprovidersettings$factory.biomeDepthOffset); + chunkprovidersettings$factory.biomeScaleWeight = JsonUtils.getFloat(jsonobject, "biomeScaleWeight", chunkprovidersettings$factory.biomeScaleWeight); + chunkprovidersettings$factory.biomeScaleOffset = JsonUtils.getFloat(jsonobject, "biomeScaleOffset", chunkprovidersettings$factory.biomeScaleOffset); + chunkprovidersettings$factory.seaLevel = JsonUtils.getInt(jsonobject, "seaLevel", chunkprovidersettings$factory.seaLevel); + chunkprovidersettings$factory.useCaves = JsonUtils.getBoolean(jsonobject, "useCaves", chunkprovidersettings$factory.useCaves); + chunkprovidersettings$factory.useDungeons = JsonUtils.getBoolean(jsonobject, "useDungeons", chunkprovidersettings$factory.useDungeons); + chunkprovidersettings$factory.dungeonChance = JsonUtils.getInt(jsonobject, "dungeonChance", chunkprovidersettings$factory.dungeonChance); + chunkprovidersettings$factory.useStrongholds = JsonUtils.getBoolean(jsonobject, "useStrongholds", chunkprovidersettings$factory.useStrongholds); + chunkprovidersettings$factory.useVillages = JsonUtils.getBoolean(jsonobject, "useVillages", chunkprovidersettings$factory.useVillages); + chunkprovidersettings$factory.useMineShafts = JsonUtils.getBoolean(jsonobject, "useMineShafts", chunkprovidersettings$factory.useMineShafts); + chunkprovidersettings$factory.useTemples = JsonUtils.getBoolean(jsonobject, "useTemples", chunkprovidersettings$factory.useTemples); + chunkprovidersettings$factory.useMonuments = JsonUtils.getBoolean(jsonobject, "useMonuments", chunkprovidersettings$factory.useMonuments); + chunkprovidersettings$factory.useRavines = JsonUtils.getBoolean(jsonobject, "useRavines", chunkprovidersettings$factory.useRavines); + chunkprovidersettings$factory.useWaterLakes = JsonUtils.getBoolean(jsonobject, "useWaterLakes", chunkprovidersettings$factory.useWaterLakes); + chunkprovidersettings$factory.waterLakeChance = JsonUtils.getInt(jsonobject, "waterLakeChance", chunkprovidersettings$factory.waterLakeChance); + chunkprovidersettings$factory.useLavaLakes = JsonUtils.getBoolean(jsonobject, "useLavaLakes", chunkprovidersettings$factory.useLavaLakes); + chunkprovidersettings$factory.lavaLakeChance = JsonUtils.getInt(jsonobject, "lavaLakeChance", chunkprovidersettings$factory.lavaLakeChance); + chunkprovidersettings$factory.useLavaOceans = JsonUtils.getBoolean(jsonobject, "useLavaOceans", chunkprovidersettings$factory.useLavaOceans); + chunkprovidersettings$factory.fixedBiome = JsonUtils.getInt(jsonobject, "fixedBiome", chunkprovidersettings$factory.fixedBiome); + + if (chunkprovidersettings$factory.fixedBiome < 38 && chunkprovidersettings$factory.fixedBiome >= -1) + { + if (chunkprovidersettings$factory.fixedBiome >= BiomeGenBase.hell.biomeID) + { + chunkprovidersettings$factory.fixedBiome += 2; + } + } + else + { + chunkprovidersettings$factory.fixedBiome = -1; + } + + chunkprovidersettings$factory.biomeSize = JsonUtils.getInt(jsonobject, "biomeSize", chunkprovidersettings$factory.biomeSize); + chunkprovidersettings$factory.riverSize = JsonUtils.getInt(jsonobject, "riverSize", chunkprovidersettings$factory.riverSize); + chunkprovidersettings$factory.dirtSize = JsonUtils.getInt(jsonobject, "dirtSize", chunkprovidersettings$factory.dirtSize); + chunkprovidersettings$factory.dirtCount = JsonUtils.getInt(jsonobject, "dirtCount", chunkprovidersettings$factory.dirtCount); + chunkprovidersettings$factory.dirtMinHeight = JsonUtils.getInt(jsonobject, "dirtMinHeight", chunkprovidersettings$factory.dirtMinHeight); + chunkprovidersettings$factory.dirtMaxHeight = JsonUtils.getInt(jsonobject, "dirtMaxHeight", chunkprovidersettings$factory.dirtMaxHeight); + chunkprovidersettings$factory.gravelSize = JsonUtils.getInt(jsonobject, "gravelSize", chunkprovidersettings$factory.gravelSize); + chunkprovidersettings$factory.gravelCount = JsonUtils.getInt(jsonobject, "gravelCount", chunkprovidersettings$factory.gravelCount); + chunkprovidersettings$factory.gravelMinHeight = JsonUtils.getInt(jsonobject, "gravelMinHeight", chunkprovidersettings$factory.gravelMinHeight); + chunkprovidersettings$factory.gravelMaxHeight = JsonUtils.getInt(jsonobject, "gravelMaxHeight", chunkprovidersettings$factory.gravelMaxHeight); + chunkprovidersettings$factory.graniteSize = JsonUtils.getInt(jsonobject, "graniteSize", chunkprovidersettings$factory.graniteSize); + chunkprovidersettings$factory.graniteCount = JsonUtils.getInt(jsonobject, "graniteCount", chunkprovidersettings$factory.graniteCount); + chunkprovidersettings$factory.graniteMinHeight = JsonUtils.getInt(jsonobject, "graniteMinHeight", chunkprovidersettings$factory.graniteMinHeight); + chunkprovidersettings$factory.graniteMaxHeight = JsonUtils.getInt(jsonobject, "graniteMaxHeight", chunkprovidersettings$factory.graniteMaxHeight); + chunkprovidersettings$factory.dioriteSize = JsonUtils.getInt(jsonobject, "dioriteSize", chunkprovidersettings$factory.dioriteSize); + chunkprovidersettings$factory.dioriteCount = JsonUtils.getInt(jsonobject, "dioriteCount", chunkprovidersettings$factory.dioriteCount); + chunkprovidersettings$factory.dioriteMinHeight = JsonUtils.getInt(jsonobject, "dioriteMinHeight", chunkprovidersettings$factory.dioriteMinHeight); + chunkprovidersettings$factory.dioriteMaxHeight = JsonUtils.getInt(jsonobject, "dioriteMaxHeight", chunkprovidersettings$factory.dioriteMaxHeight); + chunkprovidersettings$factory.andesiteSize = JsonUtils.getInt(jsonobject, "andesiteSize", chunkprovidersettings$factory.andesiteSize); + chunkprovidersettings$factory.andesiteCount = JsonUtils.getInt(jsonobject, "andesiteCount", chunkprovidersettings$factory.andesiteCount); + chunkprovidersettings$factory.andesiteMinHeight = JsonUtils.getInt(jsonobject, "andesiteMinHeight", chunkprovidersettings$factory.andesiteMinHeight); + chunkprovidersettings$factory.andesiteMaxHeight = JsonUtils.getInt(jsonobject, "andesiteMaxHeight", chunkprovidersettings$factory.andesiteMaxHeight); + chunkprovidersettings$factory.coalSize = JsonUtils.getInt(jsonobject, "coalSize", chunkprovidersettings$factory.coalSize); + chunkprovidersettings$factory.coalCount = JsonUtils.getInt(jsonobject, "coalCount", chunkprovidersettings$factory.coalCount); + chunkprovidersettings$factory.coalMinHeight = JsonUtils.getInt(jsonobject, "coalMinHeight", chunkprovidersettings$factory.coalMinHeight); + chunkprovidersettings$factory.coalMaxHeight = JsonUtils.getInt(jsonobject, "coalMaxHeight", chunkprovidersettings$factory.coalMaxHeight); + chunkprovidersettings$factory.ironSize = JsonUtils.getInt(jsonobject, "ironSize", chunkprovidersettings$factory.ironSize); + chunkprovidersettings$factory.ironCount = JsonUtils.getInt(jsonobject, "ironCount", chunkprovidersettings$factory.ironCount); + chunkprovidersettings$factory.ironMinHeight = JsonUtils.getInt(jsonobject, "ironMinHeight", chunkprovidersettings$factory.ironMinHeight); + chunkprovidersettings$factory.ironMaxHeight = JsonUtils.getInt(jsonobject, "ironMaxHeight", chunkprovidersettings$factory.ironMaxHeight); + chunkprovidersettings$factory.goldSize = JsonUtils.getInt(jsonobject, "goldSize", chunkprovidersettings$factory.goldSize); + chunkprovidersettings$factory.goldCount = JsonUtils.getInt(jsonobject, "goldCount", chunkprovidersettings$factory.goldCount); + chunkprovidersettings$factory.goldMinHeight = JsonUtils.getInt(jsonobject, "goldMinHeight", chunkprovidersettings$factory.goldMinHeight); + chunkprovidersettings$factory.goldMaxHeight = JsonUtils.getInt(jsonobject, "goldMaxHeight", chunkprovidersettings$factory.goldMaxHeight); + chunkprovidersettings$factory.redstoneSize = JsonUtils.getInt(jsonobject, "redstoneSize", chunkprovidersettings$factory.redstoneSize); + chunkprovidersettings$factory.redstoneCount = JsonUtils.getInt(jsonobject, "redstoneCount", chunkprovidersettings$factory.redstoneCount); + chunkprovidersettings$factory.redstoneMinHeight = JsonUtils.getInt(jsonobject, "redstoneMinHeight", chunkprovidersettings$factory.redstoneMinHeight); + chunkprovidersettings$factory.redstoneMaxHeight = JsonUtils.getInt(jsonobject, "redstoneMaxHeight", chunkprovidersettings$factory.redstoneMaxHeight); + chunkprovidersettings$factory.diamondSize = JsonUtils.getInt(jsonobject, "diamondSize", chunkprovidersettings$factory.diamondSize); + chunkprovidersettings$factory.diamondCount = JsonUtils.getInt(jsonobject, "diamondCount", chunkprovidersettings$factory.diamondCount); + chunkprovidersettings$factory.diamondMinHeight = JsonUtils.getInt(jsonobject, "diamondMinHeight", chunkprovidersettings$factory.diamondMinHeight); + chunkprovidersettings$factory.diamondMaxHeight = JsonUtils.getInt(jsonobject, "diamondMaxHeight", chunkprovidersettings$factory.diamondMaxHeight); + chunkprovidersettings$factory.lapisSize = JsonUtils.getInt(jsonobject, "lapisSize", chunkprovidersettings$factory.lapisSize); + chunkprovidersettings$factory.lapisCount = JsonUtils.getInt(jsonobject, "lapisCount", chunkprovidersettings$factory.lapisCount); + chunkprovidersettings$factory.lapisCenterHeight = JsonUtils.getInt(jsonobject, "lapisCenterHeight", chunkprovidersettings$factory.lapisCenterHeight); + chunkprovidersettings$factory.lapisSpread = JsonUtils.getInt(jsonobject, "lapisSpread", chunkprovidersettings$factory.lapisSpread); + } + catch (Exception var7) + { + ; + } + + return chunkprovidersettings$factory; + } + + public JsonElement serialize(ChunkProviderSettings.Factory p_serialize_1_, Type p_serialize_2_, JsonSerializationContext p_serialize_3_) + { + JsonObject jsonobject = new JsonObject(); + jsonobject.addProperty("coordinateScale", (Number)Float.valueOf(p_serialize_1_.coordinateScale)); + jsonobject.addProperty("heightScale", (Number)Float.valueOf(p_serialize_1_.heightScale)); + jsonobject.addProperty("lowerLimitScale", (Number)Float.valueOf(p_serialize_1_.lowerLimitScale)); + jsonobject.addProperty("upperLimitScale", (Number)Float.valueOf(p_serialize_1_.upperLimitScale)); + jsonobject.addProperty("depthNoiseScaleX", (Number)Float.valueOf(p_serialize_1_.depthNoiseScaleX)); + jsonobject.addProperty("depthNoiseScaleZ", (Number)Float.valueOf(p_serialize_1_.depthNoiseScaleZ)); + jsonobject.addProperty("depthNoiseScaleExponent", (Number)Float.valueOf(p_serialize_1_.depthNoiseScaleExponent)); + jsonobject.addProperty("mainNoiseScaleX", (Number)Float.valueOf(p_serialize_1_.mainNoiseScaleX)); + jsonobject.addProperty("mainNoiseScaleY", (Number)Float.valueOf(p_serialize_1_.mainNoiseScaleY)); + jsonobject.addProperty("mainNoiseScaleZ", (Number)Float.valueOf(p_serialize_1_.mainNoiseScaleZ)); + jsonobject.addProperty("baseSize", (Number)Float.valueOf(p_serialize_1_.baseSize)); + jsonobject.addProperty("stretchY", (Number)Float.valueOf(p_serialize_1_.stretchY)); + jsonobject.addProperty("biomeDepthWeight", (Number)Float.valueOf(p_serialize_1_.biomeDepthWeight)); + jsonobject.addProperty("biomeDepthOffset", (Number)Float.valueOf(p_serialize_1_.biomeDepthOffset)); + jsonobject.addProperty("biomeScaleWeight", (Number)Float.valueOf(p_serialize_1_.biomeScaleWeight)); + jsonobject.addProperty("biomeScaleOffset", (Number)Float.valueOf(p_serialize_1_.biomeScaleOffset)); + jsonobject.addProperty("seaLevel", (Number)Integer.valueOf(p_serialize_1_.seaLevel)); + jsonobject.addProperty("useCaves", Boolean.valueOf(p_serialize_1_.useCaves)); + jsonobject.addProperty("useDungeons", Boolean.valueOf(p_serialize_1_.useDungeons)); + jsonobject.addProperty("dungeonChance", (Number)Integer.valueOf(p_serialize_1_.dungeonChance)); + jsonobject.addProperty("useStrongholds", Boolean.valueOf(p_serialize_1_.useStrongholds)); + jsonobject.addProperty("useVillages", Boolean.valueOf(p_serialize_1_.useVillages)); + jsonobject.addProperty("useMineShafts", Boolean.valueOf(p_serialize_1_.useMineShafts)); + jsonobject.addProperty("useTemples", Boolean.valueOf(p_serialize_1_.useTemples)); + jsonobject.addProperty("useMonuments", Boolean.valueOf(p_serialize_1_.useMonuments)); + jsonobject.addProperty("useRavines", Boolean.valueOf(p_serialize_1_.useRavines)); + jsonobject.addProperty("useWaterLakes", Boolean.valueOf(p_serialize_1_.useWaterLakes)); + jsonobject.addProperty("waterLakeChance", (Number)Integer.valueOf(p_serialize_1_.waterLakeChance)); + jsonobject.addProperty("useLavaLakes", Boolean.valueOf(p_serialize_1_.useLavaLakes)); + jsonobject.addProperty("lavaLakeChance", (Number)Integer.valueOf(p_serialize_1_.lavaLakeChance)); + jsonobject.addProperty("useLavaOceans", Boolean.valueOf(p_serialize_1_.useLavaOceans)); + jsonobject.addProperty("fixedBiome", (Number)Integer.valueOf(p_serialize_1_.fixedBiome)); + jsonobject.addProperty("biomeSize", (Number)Integer.valueOf(p_serialize_1_.biomeSize)); + jsonobject.addProperty("riverSize", (Number)Integer.valueOf(p_serialize_1_.riverSize)); + jsonobject.addProperty("dirtSize", (Number)Integer.valueOf(p_serialize_1_.dirtSize)); + jsonobject.addProperty("dirtCount", (Number)Integer.valueOf(p_serialize_1_.dirtCount)); + jsonobject.addProperty("dirtMinHeight", (Number)Integer.valueOf(p_serialize_1_.dirtMinHeight)); + jsonobject.addProperty("dirtMaxHeight", (Number)Integer.valueOf(p_serialize_1_.dirtMaxHeight)); + jsonobject.addProperty("gravelSize", (Number)Integer.valueOf(p_serialize_1_.gravelSize)); + jsonobject.addProperty("gravelCount", (Number)Integer.valueOf(p_serialize_1_.gravelCount)); + jsonobject.addProperty("gravelMinHeight", (Number)Integer.valueOf(p_serialize_1_.gravelMinHeight)); + jsonobject.addProperty("gravelMaxHeight", (Number)Integer.valueOf(p_serialize_1_.gravelMaxHeight)); + jsonobject.addProperty("graniteSize", (Number)Integer.valueOf(p_serialize_1_.graniteSize)); + jsonobject.addProperty("graniteCount", (Number)Integer.valueOf(p_serialize_1_.graniteCount)); + jsonobject.addProperty("graniteMinHeight", (Number)Integer.valueOf(p_serialize_1_.graniteMinHeight)); + jsonobject.addProperty("graniteMaxHeight", (Number)Integer.valueOf(p_serialize_1_.graniteMaxHeight)); + jsonobject.addProperty("dioriteSize", (Number)Integer.valueOf(p_serialize_1_.dioriteSize)); + jsonobject.addProperty("dioriteCount", (Number)Integer.valueOf(p_serialize_1_.dioriteCount)); + jsonobject.addProperty("dioriteMinHeight", (Number)Integer.valueOf(p_serialize_1_.dioriteMinHeight)); + jsonobject.addProperty("dioriteMaxHeight", (Number)Integer.valueOf(p_serialize_1_.dioriteMaxHeight)); + jsonobject.addProperty("andesiteSize", (Number)Integer.valueOf(p_serialize_1_.andesiteSize)); + jsonobject.addProperty("andesiteCount", (Number)Integer.valueOf(p_serialize_1_.andesiteCount)); + jsonobject.addProperty("andesiteMinHeight", (Number)Integer.valueOf(p_serialize_1_.andesiteMinHeight)); + jsonobject.addProperty("andesiteMaxHeight", (Number)Integer.valueOf(p_serialize_1_.andesiteMaxHeight)); + jsonobject.addProperty("coalSize", (Number)Integer.valueOf(p_serialize_1_.coalSize)); + jsonobject.addProperty("coalCount", (Number)Integer.valueOf(p_serialize_1_.coalCount)); + jsonobject.addProperty("coalMinHeight", (Number)Integer.valueOf(p_serialize_1_.coalMinHeight)); + jsonobject.addProperty("coalMaxHeight", (Number)Integer.valueOf(p_serialize_1_.coalMaxHeight)); + jsonobject.addProperty("ironSize", (Number)Integer.valueOf(p_serialize_1_.ironSize)); + jsonobject.addProperty("ironCount", (Number)Integer.valueOf(p_serialize_1_.ironCount)); + jsonobject.addProperty("ironMinHeight", (Number)Integer.valueOf(p_serialize_1_.ironMinHeight)); + jsonobject.addProperty("ironMaxHeight", (Number)Integer.valueOf(p_serialize_1_.ironMaxHeight)); + jsonobject.addProperty("goldSize", (Number)Integer.valueOf(p_serialize_1_.goldSize)); + jsonobject.addProperty("goldCount", (Number)Integer.valueOf(p_serialize_1_.goldCount)); + jsonobject.addProperty("goldMinHeight", (Number)Integer.valueOf(p_serialize_1_.goldMinHeight)); + jsonobject.addProperty("goldMaxHeight", (Number)Integer.valueOf(p_serialize_1_.goldMaxHeight)); + jsonobject.addProperty("redstoneSize", (Number)Integer.valueOf(p_serialize_1_.redstoneSize)); + jsonobject.addProperty("redstoneCount", (Number)Integer.valueOf(p_serialize_1_.redstoneCount)); + jsonobject.addProperty("redstoneMinHeight", (Number)Integer.valueOf(p_serialize_1_.redstoneMinHeight)); + jsonobject.addProperty("redstoneMaxHeight", (Number)Integer.valueOf(p_serialize_1_.redstoneMaxHeight)); + jsonobject.addProperty("diamondSize", (Number)Integer.valueOf(p_serialize_1_.diamondSize)); + jsonobject.addProperty("diamondCount", (Number)Integer.valueOf(p_serialize_1_.diamondCount)); + jsonobject.addProperty("diamondMinHeight", (Number)Integer.valueOf(p_serialize_1_.diamondMinHeight)); + jsonobject.addProperty("diamondMaxHeight", (Number)Integer.valueOf(p_serialize_1_.diamondMaxHeight)); + jsonobject.addProperty("lapisSize", (Number)Integer.valueOf(p_serialize_1_.lapisSize)); + jsonobject.addProperty("lapisCount", (Number)Integer.valueOf(p_serialize_1_.lapisCount)); + jsonobject.addProperty("lapisCenterHeight", (Number)Integer.valueOf(p_serialize_1_.lapisCenterHeight)); + jsonobject.addProperty("lapisSpread", (Number)Integer.valueOf(p_serialize_1_.lapisSpread)); + return jsonobject; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/FlatGeneratorInfo.java b/src/minecraft/net/minecraft/world/gen/FlatGeneratorInfo.java new file mode 100644 index 0000000..dbd5f89 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/FlatGeneratorInfo.java @@ -0,0 +1,328 @@ +package net.minecraft.world.gen; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +import net.minecraft.world.biome.BiomeGenBase; + +public class FlatGeneratorInfo +{ + private final List flatLayers = Lists.newArrayList(); + private final Map> worldFeatures = Maps.>newHashMap(); + private int biomeToUse; + + /** + * Return the biome used on this preset. + */ + public int getBiome() + { + return this.biomeToUse; + } + + /** + * Set the biome used on this preset. + */ + public void setBiome(int p_82647_1_) + { + this.biomeToUse = p_82647_1_; + } + + public Map> getWorldFeatures() + { + return this.worldFeatures; + } + + public List getFlatLayers() + { + return this.flatLayers; + } + + public void func_82645_d() + { + int i = 0; + + for (FlatLayerInfo flatlayerinfo : this.flatLayers) + { + flatlayerinfo.setMinY(i); + i += flatlayerinfo.getLayerCount(); + } + } + + public String toString() + { + StringBuilder stringbuilder = new StringBuilder(); + stringbuilder.append((int)3); + stringbuilder.append(";"); + + for (int i = 0; i < this.flatLayers.size(); ++i) + { + if (i > 0) + { + stringbuilder.append(","); + } + + stringbuilder.append(((FlatLayerInfo)this.flatLayers.get(i)).toString()); + } + + stringbuilder.append(";"); + stringbuilder.append(this.biomeToUse); + + if (!this.worldFeatures.isEmpty()) + { + stringbuilder.append(";"); + int k = 0; + + for (Entry> entry : this.worldFeatures.entrySet()) + { + if (k++ > 0) + { + stringbuilder.append(","); + } + + stringbuilder.append(((String)entry.getKey()).toLowerCase()); + Map map = (Map)entry.getValue(); + + if (!map.isEmpty()) + { + stringbuilder.append("("); + int j = 0; + + for (Entry entry1 : map.entrySet()) + { + if (j++ > 0) + { + stringbuilder.append(" "); + } + + stringbuilder.append((String)entry1.getKey()); + stringbuilder.append("="); + stringbuilder.append((String)entry1.getValue()); + } + + stringbuilder.append(")"); + } + } + } + else + { + stringbuilder.append(";"); + } + + return stringbuilder.toString(); + } + + private static FlatLayerInfo func_180715_a(int p_180715_0_, String p_180715_1_, int p_180715_2_) + { + String[] astring = p_180715_0_ >= 3 ? p_180715_1_.split("\\*", 2) : p_180715_1_.split("x", 2); + int i = 1; + int j = 0; + + if (astring.length == 2) + { + try + { + i = Integer.parseInt(astring[0]); + + if (p_180715_2_ + i >= 256) + { + i = 256 - p_180715_2_; + } + + if (i < 0) + { + i = 0; + } + } + catch (Throwable var8) + { + return null; + } + } + + Block block = null; + + try + { + String s = astring[astring.length - 1]; + + if (p_180715_0_ < 3) + { + astring = s.split(":", 2); + + if (astring.length > 1) + { + j = Integer.parseInt(astring[1]); + } + + block = Block.getBlockById(Integer.parseInt(astring[0])); + } + else + { + astring = s.split(":", 3); + block = astring.length > 1 ? Block.getBlockFromName(astring[0] + ":" + astring[1]) : null; + + if (block != null) + { + j = astring.length > 2 ? Integer.parseInt(astring[2]) : 0; + } + else + { + block = Block.getBlockFromName(astring[0]); + + if (block != null) + { + j = astring.length > 1 ? Integer.parseInt(astring[1]) : 0; + } + } + + if (block == null) + { + return null; + } + } + + if (block == Blocks.air) + { + j = 0; + } + + if (j < 0 || j > 15) + { + j = 0; + } + } + catch (Throwable var9) + { + return null; + } + + FlatLayerInfo flatlayerinfo = new FlatLayerInfo(p_180715_0_, i, block, j); + flatlayerinfo.setMinY(p_180715_2_); + return flatlayerinfo; + } + + private static List func_180716_a(int p_180716_0_, String p_180716_1_) + { + if (p_180716_1_ != null && p_180716_1_.length() >= 1) + { + List list = Lists.newArrayList(); + String[] astring = p_180716_1_.split(","); + int i = 0; + + for (String s : astring) + { + FlatLayerInfo flatlayerinfo = func_180715_a(p_180716_0_, s, i); + + if (flatlayerinfo == null) + { + return null; + } + + list.add(flatlayerinfo); + i += flatlayerinfo.getLayerCount(); + } + + return list; + } + else + { + return null; + } + } + + public static FlatGeneratorInfo createFlatGeneratorFromString(String p_82651_0_) + { + if (p_82651_0_ == null) + { + return getDefaultFlatGenerator(); + } + else + { + String[] astring = p_82651_0_.split(";", -1); + int i = astring.length == 1 ? 0 : MathHelper.parseIntWithDefault(astring[0], 0); + + if (i >= 0 && i <= 3) + { + FlatGeneratorInfo flatgeneratorinfo = new FlatGeneratorInfo(); + int j = astring.length == 1 ? 0 : 1; + List list = func_180716_a(i, astring[j++]); + + if (list != null && !list.isEmpty()) + { + flatgeneratorinfo.getFlatLayers().addAll(list); + flatgeneratorinfo.func_82645_d(); + int k = BiomeGenBase.plains.biomeID; + + if (i > 0 && astring.length > j) + { + k = MathHelper.parseIntWithDefault(astring[j++], k); + } + + flatgeneratorinfo.setBiome(k); + + if (i > 0 && astring.length > j) + { + String[] astring1 = astring[j++].toLowerCase().split(","); + + for (String s : astring1) + { + String[] astring2 = s.split("\\(", 2); + Map map = Maps.newHashMap(); + + if (astring2[0].length() > 0) + { + flatgeneratorinfo.getWorldFeatures().put(astring2[0], map); + + if (astring2.length > 1 && astring2[1].endsWith(")") && astring2[1].length() > 1) + { + String[] astring3 = astring2[1].substring(0, astring2[1].length() - 1).split(" "); + + for (int l = 0; l < astring3.length; ++l) + { + String[] astring4 = astring3[l].split("=", 2); + + if (astring4.length == 2) + { + map.put(astring4[0], astring4[1]); + } + } + } + } + } + } + else + { + flatgeneratorinfo.getWorldFeatures().put("village", Maps.newHashMap()); + } + + return flatgeneratorinfo; + } + else + { + return getDefaultFlatGenerator(); + } + } + else + { + return getDefaultFlatGenerator(); + } + } + } + + public static FlatGeneratorInfo getDefaultFlatGenerator() + { + FlatGeneratorInfo flatgeneratorinfo = new FlatGeneratorInfo(); + flatgeneratorinfo.setBiome(BiomeGenBase.plains.biomeID); + flatgeneratorinfo.getFlatLayers().add(new FlatLayerInfo(1, Blocks.bedrock)); + flatgeneratorinfo.getFlatLayers().add(new FlatLayerInfo(2, Blocks.dirt)); + flatgeneratorinfo.getFlatLayers().add(new FlatLayerInfo(1, Blocks.grass)); + flatgeneratorinfo.func_82645_d(); + flatgeneratorinfo.getWorldFeatures().put("village", Maps.newHashMap()); + return flatgeneratorinfo; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/FlatLayerInfo.java b/src/minecraft/net/minecraft/world/gen/FlatLayerInfo.java new file mode 100644 index 0000000..c3427af --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/FlatLayerInfo.java @@ -0,0 +1,110 @@ +package net.minecraft.world.gen; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.ResourceLocation; + +public class FlatLayerInfo +{ + private final int field_175902_a; + private IBlockState field_175901_b; + + /** Amount of layers for this set of layers. */ + private int layerCount; + private int layerMinimumY; + + public FlatLayerInfo(int p_i45467_1_, Block p_i45467_2_) + { + this(3, p_i45467_1_, p_i45467_2_); + } + + public FlatLayerInfo(int p_i45627_1_, int p_i45627_2_, Block p_i45627_3_) + { + this.layerCount = 1; + this.field_175902_a = p_i45627_1_; + this.layerCount = p_i45627_2_; + this.field_175901_b = p_i45627_3_.getDefaultState(); + } + + public FlatLayerInfo(int p_i45628_1_, int p_i45628_2_, Block p_i45628_3_, int p_i45628_4_) + { + this(p_i45628_1_, p_i45628_2_, p_i45628_3_); + this.field_175901_b = p_i45628_3_.getStateFromMeta(p_i45628_4_); + } + + /** + * Return the amount of layers for this set of layers. + */ + public int getLayerCount() + { + return this.layerCount; + } + + public IBlockState func_175900_c() + { + return this.field_175901_b; + } + + private Block func_151536_b() + { + return this.field_175901_b.getBlock(); + } + + /** + * Return the block metadata used on this set of layers. + */ + private int getFillBlockMeta() + { + return this.field_175901_b.getBlock().getMetaFromState(this.field_175901_b); + } + + /** + * Return the minimum Y coordinate for this layer, set during generation. + */ + public int getMinY() + { + return this.layerMinimumY; + } + + /** + * Set the minimum Y coordinate for this layer. + */ + public void setMinY(int p_82660_1_) + { + this.layerMinimumY = p_82660_1_; + } + + public String toString() + { + String s; + + if (this.field_175902_a >= 3) + { + ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.func_151536_b()); + s = resourcelocation == null ? "null" : resourcelocation.toString(); + + if (this.layerCount > 1) + { + s = this.layerCount + "*" + s; + } + } + else + { + s = Integer.toString(Block.getIdFromBlock(this.func_151536_b())); + + if (this.layerCount > 1) + { + s = this.layerCount + "x" + s; + } + } + + int i = this.getFillBlockMeta(); + + if (i > 0) + { + s = s + ":" + i; + } + + return s; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/GeneratorBushFeature.java b/src/minecraft/net/minecraft/world/gen/GeneratorBushFeature.java new file mode 100644 index 0000000..07e0bc2 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/GeneratorBushFeature.java @@ -0,0 +1,32 @@ +package net.minecraft.world.gen; + +import java.util.Random; +import net.minecraft.block.BlockBush; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class GeneratorBushFeature extends WorldGenerator +{ + private BlockBush field_175908_a; + + public GeneratorBushFeature(BlockBush p_i45633_1_) + { + this.field_175908_a = p_i45633_1_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + for (int i = 0; i < 64; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); + + if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < 255) && this.field_175908_a.canBlockStay(worldIn, blockpos, this.field_175908_a.getDefaultState())) + { + worldIn.setBlockState(blockpos, this.field_175908_a.getDefaultState(), 2); + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/MapGenBase.java b/src/minecraft/net/minecraft/world/gen/MapGenBase.java new file mode 100644 index 0000000..e33fc3c --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/MapGenBase.java @@ -0,0 +1,45 @@ +package net.minecraft.world.gen; + +import java.util.Random; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.chunk.IChunkProvider; + +public class MapGenBase +{ + /** The number of Chunks to gen-check in any given direction. */ + protected int range = 8; + + /** The RNG used by the MapGen classes. */ + protected Random rand = new Random(); + + /** This world object. */ + protected World worldObj; + + public void generate(IChunkProvider chunkProviderIn, World worldIn, int x, int z, ChunkPrimer chunkPrimerIn) + { + int i = this.range; + this.worldObj = worldIn; + this.rand.setSeed(worldIn.getSeed()); + long j = this.rand.nextLong(); + long k = this.rand.nextLong(); + + for (int l = x - i; l <= x + i; ++l) + { + for (int i1 = z - i; i1 <= z + i; ++i1) + { + long j1 = (long)l * j; + long k1 = (long)i1 * k; + this.rand.setSeed(j1 ^ k1 ^ worldIn.getSeed()); + this.recursiveGenerate(worldIn, l, i1, x, z, chunkPrimerIn); + } + } + } + + /** + * Recursively called by generate() + */ + protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn) + { + } +} diff --git a/src/minecraft/net/minecraft/world/gen/MapGenCaves.java b/src/minecraft/net/minecraft/world/gen/MapGenCaves.java new file mode 100644 index 0000000..66553af --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/MapGenCaves.java @@ -0,0 +1,267 @@ +package net.minecraft.world.gen; + +import com.google.common.base.Objects; +import java.util.Random; +import net.minecraft.block.BlockSand; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; + +public class MapGenCaves extends MapGenBase +{ + protected void func_180703_a(long p_180703_1_, int p_180703_3_, int p_180703_4_, ChunkPrimer p_180703_5_, double p_180703_6_, double p_180703_8_, double p_180703_10_) + { + this.func_180702_a(p_180703_1_, p_180703_3_, p_180703_4_, p_180703_5_, p_180703_6_, p_180703_8_, p_180703_10_, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); + } + + protected void func_180702_a(long p_180702_1_, int p_180702_3_, int p_180702_4_, ChunkPrimer p_180702_5_, double p_180702_6_, double p_180702_8_, double p_180702_10_, float p_180702_12_, float p_180702_13_, float p_180702_14_, int p_180702_15_, int p_180702_16_, double p_180702_17_) + { + double d0 = (double)(p_180702_3_ * 16 + 8); + double d1 = (double)(p_180702_4_ * 16 + 8); + float f = 0.0F; + float f1 = 0.0F; + Random random = new Random(p_180702_1_); + + if (p_180702_16_ <= 0) + { + int i = this.range * 16 - 16; + p_180702_16_ = i - random.nextInt(i / 4); + } + + boolean flag2 = false; + + if (p_180702_15_ == -1) + { + p_180702_15_ = p_180702_16_ / 2; + flag2 = true; + } + + int j = random.nextInt(p_180702_16_ / 2) + p_180702_16_ / 4; + + for (boolean flag = random.nextInt(6) == 0; p_180702_15_ < p_180702_16_; ++p_180702_15_) + { + double d2 = 1.5D + (double)(MathHelper.sin((float)p_180702_15_ * (float)Math.PI / (float)p_180702_16_) * p_180702_12_ * 1.0F); + double d3 = d2 * p_180702_17_; + float f2 = MathHelper.cos(p_180702_14_); + float f3 = MathHelper.sin(p_180702_14_); + p_180702_6_ += (double)(MathHelper.cos(p_180702_13_) * f2); + p_180702_8_ += (double)f3; + p_180702_10_ += (double)(MathHelper.sin(p_180702_13_) * f2); + + if (flag) + { + p_180702_14_ = p_180702_14_ * 0.92F; + } + else + { + p_180702_14_ = p_180702_14_ * 0.7F; + } + + p_180702_14_ = p_180702_14_ + f1 * 0.1F; + p_180702_13_ += f * 0.1F; + f1 = f1 * 0.9F; + f = f * 0.75F; + f1 = f1 + (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 2.0F; + f = f + (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 4.0F; + + if (!flag2 && p_180702_15_ == j && p_180702_12_ > 1.0F && p_180702_16_ > 0) + { + this.func_180702_a(random.nextLong(), p_180702_3_, p_180702_4_, p_180702_5_, p_180702_6_, p_180702_8_, p_180702_10_, random.nextFloat() * 0.5F + 0.5F, p_180702_13_ - ((float)Math.PI / 2F), p_180702_14_ / 3.0F, p_180702_15_, p_180702_16_, 1.0D); + this.func_180702_a(random.nextLong(), p_180702_3_, p_180702_4_, p_180702_5_, p_180702_6_, p_180702_8_, p_180702_10_, random.nextFloat() * 0.5F + 0.5F, p_180702_13_ + ((float)Math.PI / 2F), p_180702_14_ / 3.0F, p_180702_15_, p_180702_16_, 1.0D); + return; + } + + if (flag2 || random.nextInt(4) != 0) + { + double d4 = p_180702_6_ - d0; + double d5 = p_180702_10_ - d1; + double d6 = (double)(p_180702_16_ - p_180702_15_); + double d7 = (double)(p_180702_12_ + 2.0F + 16.0F); + + if (d4 * d4 + d5 * d5 - d6 * d6 > d7 * d7) + { + return; + } + + if (p_180702_6_ >= d0 - 16.0D - d2 * 2.0D && p_180702_10_ >= d1 - 16.0D - d2 * 2.0D && p_180702_6_ <= d0 + 16.0D + d2 * 2.0D && p_180702_10_ <= d1 + 16.0D + d2 * 2.0D) + { + int k2 = MathHelper.floor_double(p_180702_6_ - d2) - p_180702_3_ * 16 - 1; + int k = MathHelper.floor_double(p_180702_6_ + d2) - p_180702_3_ * 16 + 1; + int l2 = MathHelper.floor_double(p_180702_8_ - d3) - 1; + int l = MathHelper.floor_double(p_180702_8_ + d3) + 1; + int i3 = MathHelper.floor_double(p_180702_10_ - d2) - p_180702_4_ * 16 - 1; + int i1 = MathHelper.floor_double(p_180702_10_ + d2) - p_180702_4_ * 16 + 1; + + if (k2 < 0) + { + k2 = 0; + } + + if (k > 16) + { + k = 16; + } + + if (l2 < 1) + { + l2 = 1; + } + + if (l > 248) + { + l = 248; + } + + if (i3 < 0) + { + i3 = 0; + } + + if (i1 > 16) + { + i1 = 16; + } + + boolean flag3 = false; + + for (int j1 = k2; !flag3 && j1 < k; ++j1) + { + for (int k1 = i3; !flag3 && k1 < i1; ++k1) + { + for (int l1 = l + 1; !flag3 && l1 >= l2 - 1; --l1) + { + if (l1 >= 0 && l1 < 256) + { + IBlockState iblockstate = p_180702_5_.getBlockState(j1, l1, k1); + + if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) + { + flag3 = true; + } + + if (l1 != l2 - 1 && j1 != k2 && j1 != k - 1 && k1 != i3 && k1 != i1 - 1) + { + l1 = l2; + } + } + } + } + } + + if (!flag3) + { + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int j3 = k2; j3 < k; ++j3) + { + double d10 = ((double)(j3 + p_180702_3_ * 16) + 0.5D - p_180702_6_) / d2; + + for (int i2 = i3; i2 < i1; ++i2) + { + double d8 = ((double)(i2 + p_180702_4_ * 16) + 0.5D - p_180702_10_) / d2; + boolean flag1 = false; + + if (d10 * d10 + d8 * d8 < 1.0D) + { + for (int j2 = l; j2 > l2; --j2) + { + double d9 = ((double)(j2 - 1) + 0.5D - p_180702_8_) / d3; + + if (d9 > -0.7D && d10 * d10 + d9 * d9 + d8 * d8 < 1.0D) + { + IBlockState iblockstate1 = p_180702_5_.getBlockState(j3, j2, i2); + IBlockState iblockstate2 = (IBlockState)Objects.firstNonNull(p_180702_5_.getBlockState(j3, j2 + 1, i2), Blocks.air.getDefaultState()); + + if (iblockstate1.getBlock() == Blocks.grass || iblockstate1.getBlock() == Blocks.mycelium) + { + flag1 = true; + } + + if (this.func_175793_a(iblockstate1, iblockstate2)) + { + if (j2 - 1 < 10) + { + p_180702_5_.setBlockState(j3, j2, i2, Blocks.lava.getDefaultState()); + } + else + { + p_180702_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); + + if (iblockstate2.getBlock() == Blocks.sand) + { + p_180702_5_.setBlockState(j3, j2 + 1, i2, iblockstate2.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND ? Blocks.red_sandstone.getDefaultState() : Blocks.sandstone.getDefaultState()); + } + + if (flag1 && p_180702_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) + { + blockpos$mutableblockpos.func_181079_c(j3 + p_180702_3_ * 16, 0, i2 + p_180702_4_ * 16); + p_180702_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock.getBlock().getDefaultState()); + } + } + } + } + } + } + } + } + + if (flag2) + { + break; + } + } + } + } + } + } + + protected boolean func_175793_a(IBlockState p_175793_1_, IBlockState p_175793_2_) + { + return p_175793_1_.getBlock() == Blocks.stone ? true : (p_175793_1_.getBlock() == Blocks.dirt ? true : (p_175793_1_.getBlock() == Blocks.grass ? true : (p_175793_1_.getBlock() == Blocks.hardened_clay ? true : (p_175793_1_.getBlock() == Blocks.stained_hardened_clay ? true : (p_175793_1_.getBlock() == Blocks.sandstone ? true : (p_175793_1_.getBlock() == Blocks.red_sandstone ? true : (p_175793_1_.getBlock() == Blocks.mycelium ? true : (p_175793_1_.getBlock() == Blocks.snow_layer ? true : (p_175793_1_.getBlock() == Blocks.sand || p_175793_1_.getBlock() == Blocks.gravel) && p_175793_2_.getBlock().getMaterial() != Material.water)))))))); + } + + /** + * Recursively called by generate() + */ + protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn) + { + int i = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(15) + 1) + 1); + + if (this.rand.nextInt(7) != 0) + { + i = 0; + } + + for (int j = 0; j < i; ++j) + { + double d0 = (double)(chunkX * 16 + this.rand.nextInt(16)); + double d1 = (double)this.rand.nextInt(this.rand.nextInt(120) + 8); + double d2 = (double)(chunkZ * 16 + this.rand.nextInt(16)); + int k = 1; + + if (this.rand.nextInt(4) == 0) + { + this.func_180703_a(this.rand.nextLong(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2); + k += this.rand.nextInt(4); + } + + for (int l = 0; l < k; ++l) + { + float f = this.rand.nextFloat() * (float)Math.PI * 2.0F; + float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; + float f2 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat(); + + if (this.rand.nextInt(10) == 0) + { + f2 *= this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F; + } + + this.func_180702_a(this.rand.nextLong(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2, f2, f, f1, 0, 0, 1.0D); + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/MapGenCavesHell.java b/src/minecraft/net/minecraft/world/gen/MapGenCavesHell.java new file mode 100644 index 0000000..180f78c --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/MapGenCavesHell.java @@ -0,0 +1,222 @@ +package net.minecraft.world.gen; + +import java.util.Random; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; + +public class MapGenCavesHell extends MapGenBase +{ + protected void func_180705_a(long p_180705_1_, int p_180705_3_, int p_180705_4_, ChunkPrimer p_180705_5_, double p_180705_6_, double p_180705_8_, double p_180705_10_) + { + this.func_180704_a(p_180705_1_, p_180705_3_, p_180705_4_, p_180705_5_, p_180705_6_, p_180705_8_, p_180705_10_, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); + } + + protected void func_180704_a(long p_180704_1_, int p_180704_3_, int p_180704_4_, ChunkPrimer p_180704_5_, double p_180704_6_, double p_180704_8_, double p_180704_10_, float p_180704_12_, float p_180704_13_, float p_180704_14_, int p_180704_15_, int p_180704_16_, double p_180704_17_) + { + double d0 = (double)(p_180704_3_ * 16 + 8); + double d1 = (double)(p_180704_4_ * 16 + 8); + float f = 0.0F; + float f1 = 0.0F; + Random random = new Random(p_180704_1_); + + if (p_180704_16_ <= 0) + { + int i = this.range * 16 - 16; + p_180704_16_ = i - random.nextInt(i / 4); + } + + boolean flag1 = false; + + if (p_180704_15_ == -1) + { + p_180704_15_ = p_180704_16_ / 2; + flag1 = true; + } + + int j = random.nextInt(p_180704_16_ / 2) + p_180704_16_ / 4; + + for (boolean flag = random.nextInt(6) == 0; p_180704_15_ < p_180704_16_; ++p_180704_15_) + { + double d2 = 1.5D + (double)(MathHelper.sin((float)p_180704_15_ * (float)Math.PI / (float)p_180704_16_) * p_180704_12_ * 1.0F); + double d3 = d2 * p_180704_17_; + float f2 = MathHelper.cos(p_180704_14_); + float f3 = MathHelper.sin(p_180704_14_); + p_180704_6_ += (double)(MathHelper.cos(p_180704_13_) * f2); + p_180704_8_ += (double)f3; + p_180704_10_ += (double)(MathHelper.sin(p_180704_13_) * f2); + + if (flag) + { + p_180704_14_ = p_180704_14_ * 0.92F; + } + else + { + p_180704_14_ = p_180704_14_ * 0.7F; + } + + p_180704_14_ = p_180704_14_ + f1 * 0.1F; + p_180704_13_ += f * 0.1F; + f1 = f1 * 0.9F; + f = f * 0.75F; + f1 = f1 + (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 2.0F; + f = f + (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 4.0F; + + if (!flag1 && p_180704_15_ == j && p_180704_12_ > 1.0F) + { + this.func_180704_a(random.nextLong(), p_180704_3_, p_180704_4_, p_180704_5_, p_180704_6_, p_180704_8_, p_180704_10_, random.nextFloat() * 0.5F + 0.5F, p_180704_13_ - ((float)Math.PI / 2F), p_180704_14_ / 3.0F, p_180704_15_, p_180704_16_, 1.0D); + this.func_180704_a(random.nextLong(), p_180704_3_, p_180704_4_, p_180704_5_, p_180704_6_, p_180704_8_, p_180704_10_, random.nextFloat() * 0.5F + 0.5F, p_180704_13_ + ((float)Math.PI / 2F), p_180704_14_ / 3.0F, p_180704_15_, p_180704_16_, 1.0D); + return; + } + + if (flag1 || random.nextInt(4) != 0) + { + double d4 = p_180704_6_ - d0; + double d5 = p_180704_10_ - d1; + double d6 = (double)(p_180704_16_ - p_180704_15_); + double d7 = (double)(p_180704_12_ + 2.0F + 16.0F); + + if (d4 * d4 + d5 * d5 - d6 * d6 > d7 * d7) + { + return; + } + + if (p_180704_6_ >= d0 - 16.0D - d2 * 2.0D && p_180704_10_ >= d1 - 16.0D - d2 * 2.0D && p_180704_6_ <= d0 + 16.0D + d2 * 2.0D && p_180704_10_ <= d1 + 16.0D + d2 * 2.0D) + { + int j2 = MathHelper.floor_double(p_180704_6_ - d2) - p_180704_3_ * 16 - 1; + int k = MathHelper.floor_double(p_180704_6_ + d2) - p_180704_3_ * 16 + 1; + int k2 = MathHelper.floor_double(p_180704_8_ - d3) - 1; + int l = MathHelper.floor_double(p_180704_8_ + d3) + 1; + int l2 = MathHelper.floor_double(p_180704_10_ - d2) - p_180704_4_ * 16 - 1; + int i1 = MathHelper.floor_double(p_180704_10_ + d2) - p_180704_4_ * 16 + 1; + + if (j2 < 0) + { + j2 = 0; + } + + if (k > 16) + { + k = 16; + } + + if (k2 < 1) + { + k2 = 1; + } + + if (l > 120) + { + l = 120; + } + + if (l2 < 0) + { + l2 = 0; + } + + if (i1 > 16) + { + i1 = 16; + } + + boolean flag2 = false; + + for (int j1 = j2; !flag2 && j1 < k; ++j1) + { + for (int k1 = l2; !flag2 && k1 < i1; ++k1) + { + for (int l1 = l + 1; !flag2 && l1 >= k2 - 1; --l1) + { + if (l1 >= 0 && l1 < 128) + { + IBlockState iblockstate = p_180704_5_.getBlockState(j1, l1, k1); + + if (iblockstate.getBlock() == Blocks.flowing_lava || iblockstate.getBlock() == Blocks.lava) + { + flag2 = true; + } + + if (l1 != k2 - 1 && j1 != j2 && j1 != k - 1 && k1 != l2 && k1 != i1 - 1) + { + l1 = k2; + } + } + } + } + } + + if (!flag2) + { + for (int i3 = j2; i3 < k; ++i3) + { + double d10 = ((double)(i3 + p_180704_3_ * 16) + 0.5D - p_180704_6_) / d2; + + for (int j3 = l2; j3 < i1; ++j3) + { + double d8 = ((double)(j3 + p_180704_4_ * 16) + 0.5D - p_180704_10_) / d2; + + for (int i2 = l; i2 > k2; --i2) + { + double d9 = ((double)(i2 - 1) + 0.5D - p_180704_8_) / d3; + + if (d9 > -0.7D && d10 * d10 + d9 * d9 + d8 * d8 < 1.0D) + { + IBlockState iblockstate1 = p_180704_5_.getBlockState(i3, i2, j3); + + if (iblockstate1.getBlock() == Blocks.netherrack || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) + { + p_180704_5_.setBlockState(i3, i2, j3, Blocks.air.getDefaultState()); + } + } + } + } + } + + if (flag1) + { + break; + } + } + } + } + } + } + + /** + * Recursively called by generate() + */ + protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn) + { + int i = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(10) + 1) + 1); + + if (this.rand.nextInt(5) != 0) + { + i = 0; + } + + for (int j = 0; j < i; ++j) + { + double d0 = (double)(chunkX * 16 + this.rand.nextInt(16)); + double d1 = (double)this.rand.nextInt(128); + double d2 = (double)(chunkZ * 16 + this.rand.nextInt(16)); + int k = 1; + + if (this.rand.nextInt(4) == 0) + { + this.func_180705_a(this.rand.nextLong(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2); + k += this.rand.nextInt(4); + } + + for (int l = 0; l < k; ++l) + { + float f = this.rand.nextFloat() * (float)Math.PI * 2.0F; + float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; + float f2 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat(); + this.func_180704_a(this.rand.nextLong(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2, f2 * 2.0F, f, f1, 0, 0, 0.5D); + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/MapGenRavine.java b/src/minecraft/net/minecraft/world/gen/MapGenRavine.java new file mode 100644 index 0000000..fc78784 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/MapGenRavine.java @@ -0,0 +1,227 @@ +package net.minecraft.world.gen; + +import java.util.Random; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; + +public class MapGenRavine extends MapGenBase +{ + private float[] field_75046_d = new float[1024]; + + protected void func_180707_a(long p_180707_1_, int p_180707_3_, int p_180707_4_, ChunkPrimer p_180707_5_, double p_180707_6_, double p_180707_8_, double p_180707_10_, float p_180707_12_, float p_180707_13_, float p_180707_14_, int p_180707_15_, int p_180707_16_, double p_180707_17_) + { + Random random = new Random(p_180707_1_); + double d0 = (double)(p_180707_3_ * 16 + 8); + double d1 = (double)(p_180707_4_ * 16 + 8); + float f = 0.0F; + float f1 = 0.0F; + + if (p_180707_16_ <= 0) + { + int i = this.range * 16 - 16; + p_180707_16_ = i - random.nextInt(i / 4); + } + + boolean flag1 = false; + + if (p_180707_15_ == -1) + { + p_180707_15_ = p_180707_16_ / 2; + flag1 = true; + } + + float f2 = 1.0F; + + for (int j = 0; j < 256; ++j) + { + if (j == 0 || random.nextInt(3) == 0) + { + f2 = 1.0F + random.nextFloat() * random.nextFloat() * 1.0F; + } + + this.field_75046_d[j] = f2 * f2; + } + + for (; p_180707_15_ < p_180707_16_; ++p_180707_15_) + { + double d9 = 1.5D + (double)(MathHelper.sin((float)p_180707_15_ * (float)Math.PI / (float)p_180707_16_) * p_180707_12_ * 1.0F); + double d2 = d9 * p_180707_17_; + d9 = d9 * ((double)random.nextFloat() * 0.25D + 0.75D); + d2 = d2 * ((double)random.nextFloat() * 0.25D + 0.75D); + float f3 = MathHelper.cos(p_180707_14_); + float f4 = MathHelper.sin(p_180707_14_); + p_180707_6_ += (double)(MathHelper.cos(p_180707_13_) * f3); + p_180707_8_ += (double)f4; + p_180707_10_ += (double)(MathHelper.sin(p_180707_13_) * f3); + p_180707_14_ = p_180707_14_ * 0.7F; + p_180707_14_ = p_180707_14_ + f1 * 0.05F; + p_180707_13_ += f * 0.05F; + f1 = f1 * 0.8F; + f = f * 0.5F; + f1 = f1 + (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 2.0F; + f = f + (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 4.0F; + + if (flag1 || random.nextInt(4) != 0) + { + double d3 = p_180707_6_ - d0; + double d4 = p_180707_10_ - d1; + double d5 = (double)(p_180707_16_ - p_180707_15_); + double d6 = (double)(p_180707_12_ + 2.0F + 16.0F); + + if (d3 * d3 + d4 * d4 - d5 * d5 > d6 * d6) + { + return; + } + + if (p_180707_6_ >= d0 - 16.0D - d9 * 2.0D && p_180707_10_ >= d1 - 16.0D - d9 * 2.0D && p_180707_6_ <= d0 + 16.0D + d9 * 2.0D && p_180707_10_ <= d1 + 16.0D + d9 * 2.0D) + { + int k2 = MathHelper.floor_double(p_180707_6_ - d9) - p_180707_3_ * 16 - 1; + int k = MathHelper.floor_double(p_180707_6_ + d9) - p_180707_3_ * 16 + 1; + int l2 = MathHelper.floor_double(p_180707_8_ - d2) - 1; + int l = MathHelper.floor_double(p_180707_8_ + d2) + 1; + int i3 = MathHelper.floor_double(p_180707_10_ - d9) - p_180707_4_ * 16 - 1; + int i1 = MathHelper.floor_double(p_180707_10_ + d9) - p_180707_4_ * 16 + 1; + + if (k2 < 0) + { + k2 = 0; + } + + if (k > 16) + { + k = 16; + } + + if (l2 < 1) + { + l2 = 1; + } + + if (l > 248) + { + l = 248; + } + + if (i3 < 0) + { + i3 = 0; + } + + if (i1 > 16) + { + i1 = 16; + } + + boolean flag2 = false; + + for (int j1 = k2; !flag2 && j1 < k; ++j1) + { + for (int k1 = i3; !flag2 && k1 < i1; ++k1) + { + for (int l1 = l + 1; !flag2 && l1 >= l2 - 1; --l1) + { + if (l1 >= 0 && l1 < 256) + { + IBlockState iblockstate = p_180707_5_.getBlockState(j1, l1, k1); + + if (iblockstate.getBlock() == Blocks.flowing_water || iblockstate.getBlock() == Blocks.water) + { + flag2 = true; + } + + if (l1 != l2 - 1 && j1 != k2 && j1 != k - 1 && k1 != i3 && k1 != i1 - 1) + { + l1 = l2; + } + } + } + } + } + + if (!flag2) + { + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int j3 = k2; j3 < k; ++j3) + { + double d10 = ((double)(j3 + p_180707_3_ * 16) + 0.5D - p_180707_6_) / d9; + + for (int i2 = i3; i2 < i1; ++i2) + { + double d7 = ((double)(i2 + p_180707_4_ * 16) + 0.5D - p_180707_10_) / d9; + boolean flag = false; + + if (d10 * d10 + d7 * d7 < 1.0D) + { + for (int j2 = l; j2 > l2; --j2) + { + double d8 = ((double)(j2 - 1) + 0.5D - p_180707_8_) / d2; + + if ((d10 * d10 + d7 * d7) * (double)this.field_75046_d[j2 - 1] + d8 * d8 / 6.0D < 1.0D) + { + IBlockState iblockstate1 = p_180707_5_.getBlockState(j3, j2, i2); + + if (iblockstate1.getBlock() == Blocks.grass) + { + flag = true; + } + + if (iblockstate1.getBlock() == Blocks.stone || iblockstate1.getBlock() == Blocks.dirt || iblockstate1.getBlock() == Blocks.grass) + { + if (j2 - 1 < 10) + { + p_180707_5_.setBlockState(j3, j2, i2, Blocks.flowing_lava.getDefaultState()); + } + else + { + p_180707_5_.setBlockState(j3, j2, i2, Blocks.air.getDefaultState()); + + if (flag && p_180707_5_.getBlockState(j3, j2 - 1, i2).getBlock() == Blocks.dirt) + { + blockpos$mutableblockpos.func_181079_c(j3 + p_180707_3_ * 16, 0, i2 + p_180707_4_ * 16); + p_180707_5_.setBlockState(j3, j2 - 1, i2, this.worldObj.getBiomeGenForCoords(blockpos$mutableblockpos).topBlock); + } + } + } + } + } + } + } + } + + if (flag1) + { + break; + } + } + } + } + } + } + + /** + * Recursively called by generate() + */ + protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn) + { + if (this.rand.nextInt(50) == 0) + { + double d0 = (double)(chunkX * 16 + this.rand.nextInt(16)); + double d1 = (double)(this.rand.nextInt(this.rand.nextInt(40) + 8) + 20); + double d2 = (double)(chunkZ * 16 + this.rand.nextInt(16)); + int i = 1; + + for (int j = 0; j < i; ++j) + { + float f = this.rand.nextFloat() * (float)Math.PI * 2.0F; + float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; + float f2 = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * 2.0F; + this.func_180707_a(this.rand.nextLong(), p_180701_4_, p_180701_5_, chunkPrimerIn, d0, d1, d2, f2, f, f1, 0, 0, 3.0D); + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/NoiseGenerator.java b/src/minecraft/net/minecraft/world/gen/NoiseGenerator.java new file mode 100644 index 0000000..7eaa0d6 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/NoiseGenerator.java @@ -0,0 +1,5 @@ +package net.minecraft.world.gen; + +public abstract class NoiseGenerator +{ +} diff --git a/src/minecraft/net/minecraft/world/gen/NoiseGeneratorImproved.java b/src/minecraft/net/minecraft/world/gen/NoiseGeneratorImproved.java new file mode 100644 index 0000000..19f9eec --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/NoiseGeneratorImproved.java @@ -0,0 +1,200 @@ +package net.minecraft.world.gen; + +import java.util.Random; + +public class NoiseGeneratorImproved extends NoiseGenerator +{ + private int[] permutations; + public double xCoord; + public double yCoord; + public double zCoord; + private static final double[] field_152381_e = new double[] {1.0D, -1.0D, 1.0D, -1.0D, 1.0D, -1.0D, 1.0D, -1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 0.0D, -1.0D, 0.0D}; + private static final double[] field_152382_f = new double[] {1.0D, 1.0D, -1.0D, -1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D, -1.0D, 1.0D, -1.0D, 1.0D, -1.0D, 1.0D, -1.0D}; + private static final double[] field_152383_g = new double[] {0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D, -1.0D, -1.0D, 1.0D, 1.0D, -1.0D, -1.0D, 0.0D, 1.0D, 0.0D, -1.0D}; + private static final double[] field_152384_h = new double[] {1.0D, -1.0D, 1.0D, -1.0D, 1.0D, -1.0D, 1.0D, -1.0D, 0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 0.0D, -1.0D, 0.0D}; + private static final double[] field_152385_i = new double[] {0.0D, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D, -1.0D, -1.0D, 1.0D, 1.0D, -1.0D, -1.0D, 0.0D, 1.0D, 0.0D, -1.0D}; + + public NoiseGeneratorImproved() + { + this(new Random()); + } + + public NoiseGeneratorImproved(Random p_i45469_1_) + { + this.permutations = new int[512]; + this.xCoord = p_i45469_1_.nextDouble() * 256.0D; + this.yCoord = p_i45469_1_.nextDouble() * 256.0D; + this.zCoord = p_i45469_1_.nextDouble() * 256.0D; + + for (int i = 0; i < 256; this.permutations[i] = i++) + { + ; + } + + for (int l = 0; l < 256; ++l) + { + int j = p_i45469_1_.nextInt(256 - l) + l; + int k = this.permutations[l]; + this.permutations[l] = this.permutations[j]; + this.permutations[j] = k; + this.permutations[l + 256] = this.permutations[l]; + } + } + + public final double lerp(double p_76311_1_, double p_76311_3_, double p_76311_5_) + { + return p_76311_3_ + p_76311_1_ * (p_76311_5_ - p_76311_3_); + } + + public final double func_76309_a(int p_76309_1_, double p_76309_2_, double p_76309_4_) + { + int i = p_76309_1_ & 15; + return field_152384_h[i] * p_76309_2_ + field_152385_i[i] * p_76309_4_; + } + + public final double grad(int p_76310_1_, double p_76310_2_, double p_76310_4_, double p_76310_6_) + { + int i = p_76310_1_ & 15; + return field_152381_e[i] * p_76310_2_ + field_152382_f[i] * p_76310_4_ + field_152383_g[i] * p_76310_6_; + } + + /** + * pars: noiseArray , xOffset , yOffset , zOffset , xSize , ySize , zSize , xScale, yScale , zScale , noiseScale. + * noiseArray should be xSize*ySize*zSize in size + */ + public void populateNoiseArray(double[] p_76308_1_, double p_76308_2_, double p_76308_4_, double p_76308_6_, int p_76308_8_, int p_76308_9_, int p_76308_10_, double p_76308_11_, double p_76308_13_, double p_76308_15_, double p_76308_17_) + { + if (p_76308_9_ == 1) + { + int i5 = 0; + int j5 = 0; + int j = 0; + int k5 = 0; + double d14 = 0.0D; + double d15 = 0.0D; + int l5 = 0; + double d16 = 1.0D / p_76308_17_; + + for (int j2 = 0; j2 < p_76308_8_; ++j2) + { + double d17 = p_76308_2_ + (double)j2 * p_76308_11_ + this.xCoord; + int i6 = (int)d17; + + if (d17 < (double)i6) + { + --i6; + } + + int k2 = i6 & 255; + d17 = d17 - (double)i6; + double d18 = d17 * d17 * d17 * (d17 * (d17 * 6.0D - 15.0D) + 10.0D); + + for (int j6 = 0; j6 < p_76308_10_; ++j6) + { + double d19 = p_76308_6_ + (double)j6 * p_76308_15_ + this.zCoord; + int k6 = (int)d19; + + if (d19 < (double)k6) + { + --k6; + } + + int l6 = k6 & 255; + d19 = d19 - (double)k6; + double d20 = d19 * d19 * d19 * (d19 * (d19 * 6.0D - 15.0D) + 10.0D); + i5 = this.permutations[k2] + 0; + j5 = this.permutations[i5] + l6; + j = this.permutations[k2 + 1] + 0; + k5 = this.permutations[j] + l6; + d14 = this.lerp(d18, this.func_76309_a(this.permutations[j5], d17, d19), this.grad(this.permutations[k5], d17 - 1.0D, 0.0D, d19)); + d15 = this.lerp(d18, this.grad(this.permutations[j5 + 1], d17, 0.0D, d19 - 1.0D), this.grad(this.permutations[k5 + 1], d17 - 1.0D, 0.0D, d19 - 1.0D)); + double d21 = this.lerp(d20, d14, d15); + int i7 = l5++; + p_76308_1_[i7] += d21 * d16; + } + } + } + else + { + int i = 0; + double d0 = 1.0D / p_76308_17_; + int k = -1; + int l = 0; + int i1 = 0; + int j1 = 0; + int k1 = 0; + int l1 = 0; + int i2 = 0; + double d1 = 0.0D; + double d2 = 0.0D; + double d3 = 0.0D; + double d4 = 0.0D; + + for (int l2 = 0; l2 < p_76308_8_; ++l2) + { + double d5 = p_76308_2_ + (double)l2 * p_76308_11_ + this.xCoord; + int i3 = (int)d5; + + if (d5 < (double)i3) + { + --i3; + } + + int j3 = i3 & 255; + d5 = d5 - (double)i3; + double d6 = d5 * d5 * d5 * (d5 * (d5 * 6.0D - 15.0D) + 10.0D); + + for (int k3 = 0; k3 < p_76308_10_; ++k3) + { + double d7 = p_76308_6_ + (double)k3 * p_76308_15_ + this.zCoord; + int l3 = (int)d7; + + if (d7 < (double)l3) + { + --l3; + } + + int i4 = l3 & 255; + d7 = d7 - (double)l3; + double d8 = d7 * d7 * d7 * (d7 * (d7 * 6.0D - 15.0D) + 10.0D); + + for (int j4 = 0; j4 < p_76308_9_; ++j4) + { + double d9 = p_76308_4_ + (double)j4 * p_76308_13_ + this.yCoord; + int k4 = (int)d9; + + if (d9 < (double)k4) + { + --k4; + } + + int l4 = k4 & 255; + d9 = d9 - (double)k4; + double d10 = d9 * d9 * d9 * (d9 * (d9 * 6.0D - 15.0D) + 10.0D); + + if (j4 == 0 || l4 != k) + { + k = l4; + l = this.permutations[j3] + l4; + i1 = this.permutations[l] + i4; + j1 = this.permutations[l + 1] + i4; + k1 = this.permutations[j3 + 1] + l4; + l1 = this.permutations[k1] + i4; + i2 = this.permutations[k1 + 1] + i4; + d1 = this.lerp(d6, this.grad(this.permutations[i1], d5, d9, d7), this.grad(this.permutations[l1], d5 - 1.0D, d9, d7)); + d2 = this.lerp(d6, this.grad(this.permutations[j1], d5, d9 - 1.0D, d7), this.grad(this.permutations[i2], d5 - 1.0D, d9 - 1.0D, d7)); + d3 = this.lerp(d6, this.grad(this.permutations[i1 + 1], d5, d9, d7 - 1.0D), this.grad(this.permutations[l1 + 1], d5 - 1.0D, d9, d7 - 1.0D)); + d4 = this.lerp(d6, this.grad(this.permutations[j1 + 1], d5, d9 - 1.0D, d7 - 1.0D), this.grad(this.permutations[i2 + 1], d5 - 1.0D, d9 - 1.0D, d7 - 1.0D)); + } + + double d11 = this.lerp(d10, d1, d2); + double d12 = this.lerp(d10, d3, d4); + double d13 = this.lerp(d8, d11, d12); + int j7 = i++; + p_76308_1_[j7] += d13 * d0; + } + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/NoiseGeneratorOctaves.java b/src/minecraft/net/minecraft/world/gen/NoiseGeneratorOctaves.java new file mode 100644 index 0000000..01d79e3 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/NoiseGeneratorOctaves.java @@ -0,0 +1,72 @@ +package net.minecraft.world.gen; + +import java.util.Random; +import net.minecraft.util.MathHelper; + +public class NoiseGeneratorOctaves extends NoiseGenerator +{ + /** + * Collection of noise generation functions. Output is combined to produce different octaves of noise. + */ + private NoiseGeneratorImproved[] generatorCollection; + private int octaves; + + public NoiseGeneratorOctaves(Random p_i2111_1_, int p_i2111_2_) + { + this.octaves = p_i2111_2_; + this.generatorCollection = new NoiseGeneratorImproved[p_i2111_2_]; + + for (int i = 0; i < p_i2111_2_; ++i) + { + this.generatorCollection[i] = new NoiseGeneratorImproved(p_i2111_1_); + } + } + + /** + * pars:(par2,3,4=noiseOffset ; so that adjacent noise segments connect) (pars5,6,7=x,y,zArraySize),(pars8,10,12 = + * x,y,z noiseScale) + */ + public double[] generateNoiseOctaves(double[] p_76304_1_, int p_76304_2_, int p_76304_3_, int p_76304_4_, int p_76304_5_, int p_76304_6_, int p_76304_7_, double p_76304_8_, double p_76304_10_, double p_76304_12_) + { + if (p_76304_1_ == null) + { + p_76304_1_ = new double[p_76304_5_ * p_76304_6_ * p_76304_7_]; + } + else + { + for (int i = 0; i < p_76304_1_.length; ++i) + { + p_76304_1_[i] = 0.0D; + } + } + + double d3 = 1.0D; + + for (int j = 0; j < this.octaves; ++j) + { + double d0 = (double)p_76304_2_ * d3 * p_76304_8_; + double d1 = (double)p_76304_3_ * d3 * p_76304_10_; + double d2 = (double)p_76304_4_ * d3 * p_76304_12_; + long k = MathHelper.floor_double_long(d0); + long l = MathHelper.floor_double_long(d2); + d0 = d0 - (double)k; + d2 = d2 - (double)l; + k = k % 16777216L; + l = l % 16777216L; + d0 = d0 + (double)k; + d2 = d2 + (double)l; + this.generatorCollection[j].populateNoiseArray(p_76304_1_, d0, d1, d2, p_76304_5_, p_76304_6_, p_76304_7_, p_76304_8_ * d3, p_76304_10_ * d3, p_76304_12_ * d3, d3); + d3 /= 2.0D; + } + + return p_76304_1_; + } + + /** + * Bouncer function to the main one with some default arguments. + */ + public double[] generateNoiseOctaves(double[] p_76305_1_, int p_76305_2_, int p_76305_3_, int p_76305_4_, int p_76305_5_, double p_76305_6_, double p_76305_8_, double p_76305_10_) + { + return this.generateNoiseOctaves(p_76305_1_, p_76305_2_, 10, p_76305_3_, p_76305_4_, 1, p_76305_5_, p_76305_6_, 1.0D, p_76305_8_); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/NoiseGeneratorPerlin.java b/src/minecraft/net/minecraft/world/gen/NoiseGeneratorPerlin.java new file mode 100644 index 0000000..1743647 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/NoiseGeneratorPerlin.java @@ -0,0 +1,66 @@ +package net.minecraft.world.gen; + +import java.util.Random; + +public class NoiseGeneratorPerlin extends NoiseGenerator +{ + private NoiseGeneratorSimplex[] field_151603_a; + private int field_151602_b; + + public NoiseGeneratorPerlin(Random p_i45470_1_, int p_i45470_2_) + { + this.field_151602_b = p_i45470_2_; + this.field_151603_a = new NoiseGeneratorSimplex[p_i45470_2_]; + + for (int i = 0; i < p_i45470_2_; ++i) + { + this.field_151603_a[i] = new NoiseGeneratorSimplex(p_i45470_1_); + } + } + + public double func_151601_a(double p_151601_1_, double p_151601_3_) + { + double d0 = 0.0D; + double d1 = 1.0D; + + for (int i = 0; i < this.field_151602_b; ++i) + { + d0 += this.field_151603_a[i].func_151605_a(p_151601_1_ * d1, p_151601_3_ * d1) / d1; + d1 /= 2.0D; + } + + return d0; + } + + public double[] func_151599_a(double[] p_151599_1_, double p_151599_2_, double p_151599_4_, int p_151599_6_, int p_151599_7_, double p_151599_8_, double p_151599_10_, double p_151599_12_) + { + return this.func_151600_a(p_151599_1_, p_151599_2_, p_151599_4_, p_151599_6_, p_151599_7_, p_151599_8_, p_151599_10_, p_151599_12_, 0.5D); + } + + public double[] func_151600_a(double[] p_151600_1_, double p_151600_2_, double p_151600_4_, int p_151600_6_, int p_151600_7_, double p_151600_8_, double p_151600_10_, double p_151600_12_, double p_151600_14_) + { + if (p_151600_1_ != null && p_151600_1_.length >= p_151600_6_ * p_151600_7_) + { + for (int i = 0; i < p_151600_1_.length; ++i) + { + p_151600_1_[i] = 0.0D; + } + } + else + { + p_151600_1_ = new double[p_151600_6_ * p_151600_7_]; + } + + double d1 = 1.0D; + double d0 = 1.0D; + + for (int j = 0; j < this.field_151602_b; ++j) + { + this.field_151603_a[j].func_151606_a(p_151600_1_, p_151600_2_, p_151600_4_, p_151600_6_, p_151600_7_, p_151600_8_ * d0 * d1, p_151600_10_ * d0 * d1, 0.55D / d1); + d0 *= p_151600_12_; + d1 *= p_151600_14_; + } + + return p_151600_1_; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/NoiseGeneratorSimplex.java b/src/minecraft/net/minecraft/world/gen/NoiseGeneratorSimplex.java new file mode 100644 index 0000000..741069e --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/NoiseGeneratorSimplex.java @@ -0,0 +1,216 @@ +package net.minecraft.world.gen; + +import java.util.Random; + +public class NoiseGeneratorSimplex +{ + private static int[][] field_151611_e = new int[][] {{1, 1, 0}, { -1, 1, 0}, {1, -1, 0}, { -1, -1, 0}, {1, 0, 1}, { -1, 0, 1}, {1, 0, -1}, { -1, 0, -1}, {0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1}}; + public static final double field_151614_a = Math.sqrt(3.0D); + private int[] field_151608_f; + public double field_151612_b; + public double field_151613_c; + public double field_151610_d; + private static final double field_151609_g = 0.5D * (field_151614_a - 1.0D); + private static final double field_151615_h = (3.0D - field_151614_a) / 6.0D; + + public NoiseGeneratorSimplex() + { + this(new Random()); + } + + public NoiseGeneratorSimplex(Random p_i45471_1_) + { + this.field_151608_f = new int[512]; + this.field_151612_b = p_i45471_1_.nextDouble() * 256.0D; + this.field_151613_c = p_i45471_1_.nextDouble() * 256.0D; + this.field_151610_d = p_i45471_1_.nextDouble() * 256.0D; + + for (int i = 0; i < 256; this.field_151608_f[i] = i++) + { + ; + } + + for (int l = 0; l < 256; ++l) + { + int j = p_i45471_1_.nextInt(256 - l) + l; + int k = this.field_151608_f[l]; + this.field_151608_f[l] = this.field_151608_f[j]; + this.field_151608_f[j] = k; + this.field_151608_f[l + 256] = this.field_151608_f[l]; + } + } + + private static int func_151607_a(double p_151607_0_) + { + return p_151607_0_ > 0.0D ? (int)p_151607_0_ : (int)p_151607_0_ - 1; + } + + private static double func_151604_a(int[] p_151604_0_, double p_151604_1_, double p_151604_3_) + { + return (double)p_151604_0_[0] * p_151604_1_ + (double)p_151604_0_[1] * p_151604_3_; + } + + public double func_151605_a(double p_151605_1_, double p_151605_3_) + { + double d3 = 0.5D * (field_151614_a - 1.0D); + double d4 = (p_151605_1_ + p_151605_3_) * d3; + int i = func_151607_a(p_151605_1_ + d4); + int j = func_151607_a(p_151605_3_ + d4); + double d5 = (3.0D - field_151614_a) / 6.0D; + double d6 = (double)(i + j) * d5; + double d7 = (double)i - d6; + double d8 = (double)j - d6; + double d9 = p_151605_1_ - d7; + double d10 = p_151605_3_ - d8; + int k; + int l; + + if (d9 > d10) + { + k = 1; + l = 0; + } + else + { + k = 0; + l = 1; + } + + double d11 = d9 - (double)k + d5; + double d12 = d10 - (double)l + d5; + double d13 = d9 - 1.0D + 2.0D * d5; + double d14 = d10 - 1.0D + 2.0D * d5; + int i1 = i & 255; + int j1 = j & 255; + int k1 = this.field_151608_f[i1 + this.field_151608_f[j1]] % 12; + int l1 = this.field_151608_f[i1 + k + this.field_151608_f[j1 + l]] % 12; + int i2 = this.field_151608_f[i1 + 1 + this.field_151608_f[j1 + 1]] % 12; + double d15 = 0.5D - d9 * d9 - d10 * d10; + double d0; + + if (d15 < 0.0D) + { + d0 = 0.0D; + } + else + { + d15 = d15 * d15; + d0 = d15 * d15 * func_151604_a(field_151611_e[k1], d9, d10); + } + + double d16 = 0.5D - d11 * d11 - d12 * d12; + double d1; + + if (d16 < 0.0D) + { + d1 = 0.0D; + } + else + { + d16 = d16 * d16; + d1 = d16 * d16 * func_151604_a(field_151611_e[l1], d11, d12); + } + + double d17 = 0.5D - d13 * d13 - d14 * d14; + double d2; + + if (d17 < 0.0D) + { + d2 = 0.0D; + } + else + { + d17 = d17 * d17; + d2 = d17 * d17 * func_151604_a(field_151611_e[i2], d13, d14); + } + + return 70.0D * (d0 + d1 + d2); + } + + public void func_151606_a(double[] p_151606_1_, double p_151606_2_, double p_151606_4_, int p_151606_6_, int p_151606_7_, double p_151606_8_, double p_151606_10_, double p_151606_12_) + { + int i = 0; + + for (int j = 0; j < p_151606_7_; ++j) + { + double d0 = (p_151606_4_ + (double)j) * p_151606_10_ + this.field_151613_c; + + for (int k = 0; k < p_151606_6_; ++k) + { + double d1 = (p_151606_2_ + (double)k) * p_151606_8_ + this.field_151612_b; + double d5 = (d1 + d0) * field_151609_g; + int l = func_151607_a(d1 + d5); + int i1 = func_151607_a(d0 + d5); + double d6 = (double)(l + i1) * field_151615_h; + double d7 = (double)l - d6; + double d8 = (double)i1 - d6; + double d9 = d1 - d7; + double d10 = d0 - d8; + int j1; + int k1; + + if (d9 > d10) + { + j1 = 1; + k1 = 0; + } + else + { + j1 = 0; + k1 = 1; + } + + double d11 = d9 - (double)j1 + field_151615_h; + double d12 = d10 - (double)k1 + field_151615_h; + double d13 = d9 - 1.0D + 2.0D * field_151615_h; + double d14 = d10 - 1.0D + 2.0D * field_151615_h; + int l1 = l & 255; + int i2 = i1 & 255; + int j2 = this.field_151608_f[l1 + this.field_151608_f[i2]] % 12; + int k2 = this.field_151608_f[l1 + j1 + this.field_151608_f[i2 + k1]] % 12; + int l2 = this.field_151608_f[l1 + 1 + this.field_151608_f[i2 + 1]] % 12; + double d15 = 0.5D - d9 * d9 - d10 * d10; + double d2; + + if (d15 < 0.0D) + { + d2 = 0.0D; + } + else + { + d15 = d15 * d15; + d2 = d15 * d15 * func_151604_a(field_151611_e[j2], d9, d10); + } + + double d16 = 0.5D - d11 * d11 - d12 * d12; + double d3; + + if (d16 < 0.0D) + { + d3 = 0.0D; + } + else + { + d16 = d16 * d16; + d3 = d16 * d16 * func_151604_a(field_151611_e[k2], d11, d12); + } + + double d17 = 0.5D - d13 * d13 - d14 * d14; + double d4; + + if (d17 < 0.0D) + { + d4 = 0.0D; + } + else + { + d17 = d17 * d17; + d4 = d17 * d17 * func_151604_a(field_151611_e[l2], d13, d14); + } + + int i3 = i++; + p_151606_1_[i3] += 70.0D * (d2 + d3 + d4) * p_151606_12_; + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java new file mode 100644 index 0000000..c3872b7 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenAbstractTree.java @@ -0,0 +1,34 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public abstract class WorldGenAbstractTree extends WorldGenerator +{ + public WorldGenAbstractTree(boolean p_i45448_1_) + { + super(p_i45448_1_); + } + + protected boolean func_150523_a(Block p_150523_1_) + { + Material material = p_150523_1_.getMaterial(); + return material == Material.air || material == Material.leaves || p_150523_1_ == Blocks.grass || p_150523_1_ == Blocks.dirt || p_150523_1_ == Blocks.log || p_150523_1_ == Blocks.log2 || p_150523_1_ == Blocks.sapling || p_150523_1_ == Blocks.vine; + } + + public void func_180711_a(World worldIn, Random p_180711_2_, BlockPos p_180711_3_) + { + } + + protected void func_175921_a(World worldIn, BlockPos p_175921_2_) + { + if (worldIn.getBlockState(p_175921_2_).getBlock() != Blocks.dirt) + { + this.setBlockAndNotifyAdequately(worldIn, p_175921_2_, Blocks.dirt.getDefaultState()); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java new file mode 100644 index 0000000..b30d8c7 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenBigMushroom.java @@ -0,0 +1,222 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockHugeMushroom; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenBigMushroom extends WorldGenerator +{ + /** The mushroom type. 0 for brown, 1 for red. */ + private Block mushroomType; + + public WorldGenBigMushroom(Block p_i46449_1_) + { + super(true); + this.mushroomType = p_i46449_1_; + } + + public WorldGenBigMushroom() + { + super(false); + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + if (this.mushroomType == null) + { + this.mushroomType = rand.nextBoolean() ? Blocks.brown_mushroom_block : Blocks.red_mushroom_block; + } + + int i = rand.nextInt(3) + 4; + boolean flag = true; + + if (position.getY() >= 1 && position.getY() + i + 1 < 256) + { + for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) + { + int k = 3; + + if (j <= position.getY() + 3) + { + k = 0; + } + + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) + { + for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) + { + if (j >= 0 && j < 256) + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock(); + + if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) + { + flag = false; + } + } + else + { + flag = false; + } + } + } + } + + if (!flag) + { + return false; + } + else + { + Block block1 = worldIn.getBlockState(position.down()).getBlock(); + + if (block1 != Blocks.dirt && block1 != Blocks.grass && block1 != Blocks.mycelium) + { + return false; + } + else + { + int k2 = position.getY() + i; + + if (this.mushroomType == Blocks.red_mushroom_block) + { + k2 = position.getY() + i - 3; + } + + for (int l2 = k2; l2 <= position.getY() + i; ++l2) + { + int j3 = 1; + + if (l2 < position.getY() + i) + { + ++j3; + } + + if (this.mushroomType == Blocks.brown_mushroom_block) + { + j3 = 3; + } + + int k3 = position.getX() - j3; + int l3 = position.getX() + j3; + int j1 = position.getZ() - j3; + int k1 = position.getZ() + j3; + + for (int l1 = k3; l1 <= l3; ++l1) + { + for (int i2 = j1; i2 <= k1; ++i2) + { + int j2 = 5; + + if (l1 == k3) + { + --j2; + } + else if (l1 == l3) + { + ++j2; + } + + if (i2 == j1) + { + j2 -= 3; + } + else if (i2 == k1) + { + j2 += 3; + } + + BlockHugeMushroom.EnumType blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.byMetadata(j2); + + if (this.mushroomType == Blocks.brown_mushroom_block || l2 < position.getY() + i) + { + if ((l1 == k3 || l1 == l3) && (i2 == j1 || i2 == k1)) + { + continue; + } + + if (l1 == position.getX() - (j3 - 1) && i2 == j1) + { + blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_WEST; + } + + if (l1 == k3 && i2 == position.getZ() - (j3 - 1)) + { + blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_WEST; + } + + if (l1 == position.getX() + (j3 - 1) && i2 == j1) + { + blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_EAST; + } + + if (l1 == l3 && i2 == position.getZ() - (j3 - 1)) + { + blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.NORTH_EAST; + } + + if (l1 == position.getX() - (j3 - 1) && i2 == k1) + { + blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_WEST; + } + + if (l1 == k3 && i2 == position.getZ() + (j3 - 1)) + { + blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_WEST; + } + + if (l1 == position.getX() + (j3 - 1) && i2 == k1) + { + blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_EAST; + } + + if (l1 == l3 && i2 == position.getZ() + (j3 - 1)) + { + blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.SOUTH_EAST; + } + } + + if (blockhugemushroom$enumtype == BlockHugeMushroom.EnumType.CENTER && l2 < position.getY() + i) + { + blockhugemushroom$enumtype = BlockHugeMushroom.EnumType.ALL_INSIDE; + } + + if (position.getY() >= position.getY() + i - 1 || blockhugemushroom$enumtype != BlockHugeMushroom.EnumType.ALL_INSIDE) + { + BlockPos blockpos = new BlockPos(l1, l2, i2); + + if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, blockhugemushroom$enumtype)); + } + } + } + } + } + + for (int i3 = 0; i3 < i; ++i3) + { + Block block2 = worldIn.getBlockState(position.up(i3)).getBlock(); + + if (!block2.isFullBlock()) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(i3), this.mushroomType.getDefaultState().withProperty(BlockHugeMushroom.VARIANT, BlockHugeMushroom.EnumType.STEM)); + } + } + + return true; + } + } + } + else + { + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java new file mode 100644 index 0000000..1fd6e61 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenBigTree.java @@ -0,0 +1,377 @@ +package net.minecraft.world.gen.feature; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockLog; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class WorldGenBigTree extends WorldGenAbstractTree +{ + private Random rand; + private World world; + private BlockPos basePos = BlockPos.ORIGIN; + int heightLimit; + int height; + double heightAttenuation = 0.618D; + double branchSlope = 0.381D; + double scaleWidth = 1.0D; + double leafDensity = 1.0D; + int trunkSize = 1; + int heightLimitLimit = 12; + + /** + * Sets the distance limit for how far away the generator will populate leaves from the base leaf node. + */ + int leafDistanceLimit = 4; + List field_175948_j; + + public WorldGenBigTree(boolean p_i2008_1_) + { + super(p_i2008_1_); + } + + /** + * Generates a list of leaf nodes for the tree, to be populated by generateLeaves. + */ + void generateLeafNodeList() + { + this.height = (int)((double)this.heightLimit * this.heightAttenuation); + + if (this.height >= this.heightLimit) + { + this.height = this.heightLimit - 1; + } + + int i = (int)(1.382D + Math.pow(this.leafDensity * (double)this.heightLimit / 13.0D, 2.0D)); + + if (i < 1) + { + i = 1; + } + + int j = this.basePos.getY() + this.height; + int k = this.heightLimit - this.leafDistanceLimit; + this.field_175948_j = Lists.newArrayList(); + this.field_175948_j.add(new WorldGenBigTree.FoliageCoordinates(this.basePos.up(k), j)); + + for (; k >= 0; --k) + { + float f = this.layerSize(k); + + if (f >= 0.0F) + { + for (int l = 0; l < i; ++l) + { + double d0 = this.scaleWidth * (double)f * ((double)this.rand.nextFloat() + 0.328D); + double d1 = (double)(this.rand.nextFloat() * 2.0F) * Math.PI; + double d2 = d0 * Math.sin(d1) + 0.5D; + double d3 = d0 * Math.cos(d1) + 0.5D; + BlockPos blockpos = this.basePos.add(d2, (double)(k - 1), d3); + BlockPos blockpos1 = blockpos.up(this.leafDistanceLimit); + + if (this.checkBlockLine(blockpos, blockpos1) == -1) + { + int i1 = this.basePos.getX() - blockpos.getX(); + int j1 = this.basePos.getZ() - blockpos.getZ(); + double d4 = (double)blockpos.getY() - Math.sqrt((double)(i1 * i1 + j1 * j1)) * this.branchSlope; + int k1 = d4 > (double)j ? j : (int)d4; + BlockPos blockpos2 = new BlockPos(this.basePos.getX(), k1, this.basePos.getZ()); + + if (this.checkBlockLine(blockpos2, blockpos) == -1) + { + this.field_175948_j.add(new WorldGenBigTree.FoliageCoordinates(blockpos, blockpos2.getY())); + } + } + } + } + } + } + + void func_181631_a(BlockPos p_181631_1_, float p_181631_2_, IBlockState p_181631_3_) + { + int i = (int)((double)p_181631_2_ + 0.618D); + + for (int j = -i; j <= i; ++j) + { + for (int k = -i; k <= i; ++k) + { + if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_181631_2_ * p_181631_2_)) + { + BlockPos blockpos = p_181631_1_.add(j, 0, k); + Material material = this.world.getBlockState(blockpos).getBlock().getMaterial(); + + if (material == Material.air || material == Material.leaves) + { + this.setBlockAndNotifyAdequately(this.world, blockpos, p_181631_3_); + } + } + } + } + } + + /** + * Gets the rough size of a layer of the tree. + */ + float layerSize(int p_76490_1_) + { + if ((float)p_76490_1_ < (float)this.heightLimit * 0.3F) + { + return -1.0F; + } + else + { + float f = (float)this.heightLimit / 2.0F; + float f1 = f - (float)p_76490_1_; + float f2 = MathHelper.sqrt_float(f * f - f1 * f1); + + if (f1 == 0.0F) + { + f2 = f; + } + else if (Math.abs(f1) >= f) + { + return 0.0F; + } + + return f2 * 0.5F; + } + } + + float leafSize(int p_76495_1_) + { + return p_76495_1_ >= 0 && p_76495_1_ < this.leafDistanceLimit ? (p_76495_1_ != 0 && p_76495_1_ != this.leafDistanceLimit - 1 ? 3.0F : 2.0F) : -1.0F; + } + + /** + * Generates the leaves surrounding an individual entry in the leafNodes list. + */ + void generateLeafNode(BlockPos pos) + { + for (int i = 0; i < this.leafDistanceLimit; ++i) + { + this.func_181631_a(pos.up(i), this.leafSize(i), Blocks.leaves.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false))); + } + } + + void func_175937_a(BlockPos p_175937_1_, BlockPos p_175937_2_, Block p_175937_3_) + { + BlockPos blockpos = p_175937_2_.add(-p_175937_1_.getX(), -p_175937_1_.getY(), -p_175937_1_.getZ()); + int i = this.getGreatestDistance(blockpos); + float f = (float)blockpos.getX() / (float)i; + float f1 = (float)blockpos.getY() / (float)i; + float f2 = (float)blockpos.getZ() / (float)i; + + for (int j = 0; j <= i; ++j) + { + BlockPos blockpos1 = p_175937_1_.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); + BlockLog.EnumAxis blocklog$enumaxis = this.func_175938_b(p_175937_1_, blockpos1); + this.setBlockAndNotifyAdequately(this.world, blockpos1, p_175937_3_.getDefaultState().withProperty(BlockLog.LOG_AXIS, blocklog$enumaxis)); + } + } + + /** + * Returns the absolute greatest distance in the BlockPos object. + */ + private int getGreatestDistance(BlockPos posIn) + { + int i = MathHelper.abs_int(posIn.getX()); + int j = MathHelper.abs_int(posIn.getY()); + int k = MathHelper.abs_int(posIn.getZ()); + return k > i && k > j ? k : (j > i ? j : i); + } + + private BlockLog.EnumAxis func_175938_b(BlockPos p_175938_1_, BlockPos p_175938_2_) + { + BlockLog.EnumAxis blocklog$enumaxis = BlockLog.EnumAxis.Y; + int i = Math.abs(p_175938_2_.getX() - p_175938_1_.getX()); + int j = Math.abs(p_175938_2_.getZ() - p_175938_1_.getZ()); + int k = Math.max(i, j); + + if (k > 0) + { + if (i == k) + { + blocklog$enumaxis = BlockLog.EnumAxis.X; + } + else if (j == k) + { + blocklog$enumaxis = BlockLog.EnumAxis.Z; + } + } + + return blocklog$enumaxis; + } + + /** + * Generates the leaf portion of the tree as specified by the leafNodes list. + */ + void generateLeaves() + { + for (WorldGenBigTree.FoliageCoordinates worldgenbigtree$foliagecoordinates : this.field_175948_j) + { + this.generateLeafNode(worldgenbigtree$foliagecoordinates); + } + } + + /** + * Indicates whether or not a leaf node requires additional wood to be added to preserve integrity. + */ + boolean leafNodeNeedsBase(int p_76493_1_) + { + return (double)p_76493_1_ >= (double)this.heightLimit * 0.2D; + } + + /** + * Places the trunk for the big tree that is being generated. Able to generate double-sized trunks by changing a + * field that is always 1 to 2. + */ + void generateTrunk() + { + BlockPos blockpos = this.basePos; + BlockPos blockpos1 = this.basePos.up(this.height); + Block block = Blocks.log; + this.func_175937_a(blockpos, blockpos1, block); + + if (this.trunkSize == 2) + { + this.func_175937_a(blockpos.east(), blockpos1.east(), block); + this.func_175937_a(blockpos.east().south(), blockpos1.east().south(), block); + this.func_175937_a(blockpos.south(), blockpos1.south(), block); + } + } + + /** + * Generates additional wood blocks to fill out the bases of different leaf nodes that would otherwise degrade. + */ + void generateLeafNodeBases() + { + for (WorldGenBigTree.FoliageCoordinates worldgenbigtree$foliagecoordinates : this.field_175948_j) + { + int i = worldgenbigtree$foliagecoordinates.func_177999_q(); + BlockPos blockpos = new BlockPos(this.basePos.getX(), i, this.basePos.getZ()); + + if (!blockpos.equals(worldgenbigtree$foliagecoordinates) && this.leafNodeNeedsBase(i - this.basePos.getY())) + { + this.func_175937_a(blockpos, worldgenbigtree$foliagecoordinates, Blocks.log); + } + } + } + + /** + * Checks a line of blocks in the world from the first coordinate to triplet to the second, returning the distance + * (in blocks) before a non-air, non-leaf block is encountered and/or the end is encountered. + */ + int checkBlockLine(BlockPos posOne, BlockPos posTwo) + { + BlockPos blockpos = posTwo.add(-posOne.getX(), -posOne.getY(), -posOne.getZ()); + int i = this.getGreatestDistance(blockpos); + float f = (float)blockpos.getX() / (float)i; + float f1 = (float)blockpos.getY() / (float)i; + float f2 = (float)blockpos.getZ() / (float)i; + + if (i == 0) + { + return -1; + } + else + { + for (int j = 0; j <= i; ++j) + { + BlockPos blockpos1 = posOne.add((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2)); + + if (!this.func_150523_a(this.world.getBlockState(blockpos1).getBlock())) + { + return j; + } + } + + return -1; + } + } + + public void func_175904_e() + { + this.leafDistanceLimit = 5; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + this.world = worldIn; + this.basePos = position; + this.rand = new Random(rand.nextLong()); + + if (this.heightLimit == 0) + { + this.heightLimit = 5 + this.rand.nextInt(this.heightLimitLimit); + } + + if (!this.validTreeLocation()) + { + return false; + } + else + { + this.generateLeafNodeList(); + this.generateLeaves(); + this.generateTrunk(); + this.generateLeafNodeBases(); + return true; + } + } + + /** + * Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height + * limit, is valid. + */ + private boolean validTreeLocation() + { + Block block = this.world.getBlockState(this.basePos.down()).getBlock(); + + if (block != Blocks.dirt && block != Blocks.grass && block != Blocks.farmland) + { + return false; + } + else + { + int i = this.checkBlockLine(this.basePos, this.basePos.up(this.heightLimit - 1)); + + if (i == -1) + { + return true; + } + else if (i < 6) + { + return false; + } + else + { + this.heightLimit = i; + return true; + } + } + } + + static class FoliageCoordinates extends BlockPos + { + private final int field_178000_b; + + public FoliageCoordinates(BlockPos p_i45635_1_, int p_i45635_2_) + { + super(p_i45635_1_.getX(), p_i45635_1_.getY(), p_i45635_1_.getZ()); + this.field_178000_b = p_i45635_2_; + } + + public int func_177999_q() + { + return this.field_178000_b; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenBlockBlob.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenBlockBlob.java new file mode 100644 index 0000000..06bff0f --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenBlockBlob.java @@ -0,0 +1,72 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenBlockBlob extends WorldGenerator +{ + private final Block field_150545_a; + private final int field_150544_b; + + public WorldGenBlockBlob(Block p_i45450_1_, int p_i45450_2_) + { + super(false); + this.field_150545_a = p_i45450_1_; + this.field_150544_b = p_i45450_2_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + while (true) + { + label0: + { + if (position.getY() > 3) + { + if (worldIn.isAirBlock(position.down())) + { + break label0; + } + + Block block = worldIn.getBlockState(position.down()).getBlock(); + + if (block != Blocks.grass && block != Blocks.dirt && block != Blocks.stone) + { + break label0; + } + } + + if (position.getY() <= 3) + { + return false; + } + + int i1 = this.field_150544_b; + + for (int i = 0; i1 >= 0 && i < 3; ++i) + { + int j = i1 + rand.nextInt(2); + int k = i1 + rand.nextInt(2); + int l = i1 + rand.nextInt(2); + float f = (float)(j + k + l) * 0.333F + 0.5F; + + for (BlockPos blockpos : BlockPos.getAllInBox(position.add(-j, -k, -l), position.add(j, k, l))) + { + if (blockpos.distanceSq(position) <= (double)(f * f)) + { + worldIn.setBlockState(blockpos, this.field_150545_a.getDefaultState(), 4); + } + } + + position = position.add(-(i1 + 1) + rand.nextInt(2 + i1 * 2), 0 - rand.nextInt(2), -(i1 + 1) + rand.nextInt(2 + i1 * 2)); + } + + return true; + } + position = position.down(); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenCactus.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenCactus.java new file mode 100644 index 0000000..9a4112e --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenCactus.java @@ -0,0 +1,32 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenCactus extends WorldGenerator +{ + public boolean generate(World worldIn, Random rand, BlockPos position) + { + for (int i = 0; i < 10; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); + + if (worldIn.isAirBlock(blockpos)) + { + int j = 1 + rand.nextInt(rand.nextInt(3) + 1); + + for (int k = 0; k < j; ++k) + { + if (Blocks.cactus.canBlockStay(worldIn, blockpos)) + { + worldIn.setBlockState(blockpos.up(k), Blocks.cactus.getDefaultState(), 2); + } + } + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java new file mode 100644 index 0000000..48ebe93 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java @@ -0,0 +1,219 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockNewLeaf; +import net.minecraft.block.BlockNewLog; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class WorldGenCanopyTree extends WorldGenAbstractTree +{ + private static final IBlockState field_181640_a = Blocks.log2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.DARK_OAK); + private static final IBlockState field_181641_b = Blocks.leaves2.getDefaultState().withProperty(BlockNewLeaf.VARIANT, BlockPlanks.EnumType.DARK_OAK).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + + public WorldGenCanopyTree(boolean p_i45461_1_) + { + super(p_i45461_1_); + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + int i = rand.nextInt(3) + rand.nextInt(2) + 6; + int j = position.getX(); + int k = position.getY(); + int l = position.getZ(); + + if (k >= 1 && k + i + 1 < 256) + { + BlockPos blockpos = position.down(); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block != Blocks.grass && block != Blocks.dirt) + { + return false; + } + else if (!this.func_181638_a(worldIn, position, i)) + { + return false; + } + else + { + this.func_175921_a(worldIn, blockpos); + this.func_175921_a(worldIn, blockpos.east()); + this.func_175921_a(worldIn, blockpos.south()); + this.func_175921_a(worldIn, blockpos.south().east()); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); + int i1 = i - rand.nextInt(4); + int j1 = 2 - rand.nextInt(3); + int k1 = j; + int l1 = l; + int i2 = k + i - 1; + + for (int j2 = 0; j2 < i; ++j2) + { + if (j2 >= i1 && j1 > 0) + { + k1 += enumfacing.getFrontOffsetX(); + l1 += enumfacing.getFrontOffsetZ(); + --j1; + } + + int k2 = k + j2; + BlockPos blockpos1 = new BlockPos(k1, k2, l1); + Material material = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); + + if (material == Material.air || material == Material.leaves) + { + this.func_181639_b(worldIn, blockpos1); + this.func_181639_b(worldIn, blockpos1.east()); + this.func_181639_b(worldIn, blockpos1.south()); + this.func_181639_b(worldIn, blockpos1.east().south()); + } + } + + for (int i3 = -2; i3 <= 0; ++i3) + { + for (int l3 = -2; l3 <= 0; ++l3) + { + int k4 = -1; + this.func_150526_a(worldIn, k1 + i3, i2 + k4, l1 + l3); + this.func_150526_a(worldIn, 1 + k1 - i3, i2 + k4, l1 + l3); + this.func_150526_a(worldIn, k1 + i3, i2 + k4, 1 + l1 - l3); + this.func_150526_a(worldIn, 1 + k1 - i3, i2 + k4, 1 + l1 - l3); + + if ((i3 > -2 || l3 > -1) && (i3 != -1 || l3 != -2)) + { + k4 = 1; + this.func_150526_a(worldIn, k1 + i3, i2 + k4, l1 + l3); + this.func_150526_a(worldIn, 1 + k1 - i3, i2 + k4, l1 + l3); + this.func_150526_a(worldIn, k1 + i3, i2 + k4, 1 + l1 - l3); + this.func_150526_a(worldIn, 1 + k1 - i3, i2 + k4, 1 + l1 - l3); + } + } + } + + if (rand.nextBoolean()) + { + this.func_150526_a(worldIn, k1, i2 + 2, l1); + this.func_150526_a(worldIn, k1 + 1, i2 + 2, l1); + this.func_150526_a(worldIn, k1 + 1, i2 + 2, l1 + 1); + this.func_150526_a(worldIn, k1, i2 + 2, l1 + 1); + } + + for (int j3 = -3; j3 <= 4; ++j3) + { + for (int i4 = -3; i4 <= 4; ++i4) + { + if ((j3 != -3 || i4 != -3) && (j3 != -3 || i4 != 4) && (j3 != 4 || i4 != -3) && (j3 != 4 || i4 != 4) && (Math.abs(j3) < 3 || Math.abs(i4) < 3)) + { + this.func_150526_a(worldIn, k1 + j3, i2, l1 + i4); + } + } + } + + for (int k3 = -1; k3 <= 2; ++k3) + { + for (int j4 = -1; j4 <= 2; ++j4) + { + if ((k3 < 0 || k3 > 1 || j4 < 0 || j4 > 1) && rand.nextInt(3) <= 0) + { + int l4 = rand.nextInt(3) + 2; + + for (int i5 = 0; i5 < l4; ++i5) + { + this.func_181639_b(worldIn, new BlockPos(j + k3, i2 - i5 - 1, l + j4)); + } + + for (int j5 = -1; j5 <= 1; ++j5) + { + for (int l2 = -1; l2 <= 1; ++l2) + { + this.func_150526_a(worldIn, k1 + k3 + j5, i2, l1 + j4 + l2); + } + } + + for (int k5 = -2; k5 <= 2; ++k5) + { + for (int l5 = -2; l5 <= 2; ++l5) + { + if (Math.abs(k5) != 2 || Math.abs(l5) != 2) + { + this.func_150526_a(worldIn, k1 + k3 + k5, i2 - 1, l1 + j4 + l5); + } + } + } + } + } + } + + return true; + } + } + else + { + return false; + } + } + + private boolean func_181638_a(World p_181638_1_, BlockPos p_181638_2_, int p_181638_3_) + { + int i = p_181638_2_.getX(); + int j = p_181638_2_.getY(); + int k = p_181638_2_.getZ(); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int l = 0; l <= p_181638_3_ + 1; ++l) + { + int i1 = 1; + + if (l == 0) + { + i1 = 0; + } + + if (l >= p_181638_3_ - 1) + { + i1 = 2; + } + + for (int j1 = -i1; j1 <= i1; ++j1) + { + for (int k1 = -i1; k1 <= i1; ++k1) + { + if (!this.func_150523_a(p_181638_1_.getBlockState(blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1)).getBlock())) + { + return false; + } + } + } + } + + return true; + } + + private void func_181639_b(World p_181639_1_, BlockPos p_181639_2_) + { + if (this.func_150523_a(p_181639_1_.getBlockState(p_181639_2_).getBlock())) + { + this.setBlockAndNotifyAdequately(p_181639_1_, p_181639_2_, field_181640_a); + } + } + + private void func_150526_a(World worldIn, int p_150526_2_, int p_150526_3_, int p_150526_4_) + { + BlockPos blockpos = new BlockPos(p_150526_2_, p_150526_3_, p_150526_4_); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block.getMaterial() == Material.air) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181641_b); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenClay.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenClay.java new file mode 100644 index 0000000..37df224 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenClay.java @@ -0,0 +1,59 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenClay extends WorldGenerator +{ + private Block field_150546_a = Blocks.clay; + + /** The number of blocks to generate. */ + private int numberOfBlocks; + + public WorldGenClay(int p_i2011_1_) + { + this.numberOfBlocks = p_i2011_1_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + if (worldIn.getBlockState(position).getBlock().getMaterial() != Material.water) + { + return false; + } + else + { + int i = rand.nextInt(this.numberOfBlocks - 2) + 2; + int j = 1; + + for (int k = position.getX() - i; k <= position.getX() + i; ++k) + { + for (int l = position.getZ() - i; l <= position.getZ() + i; ++l) + { + int i1 = k - position.getX(); + int j1 = l - position.getZ(); + + if (i1 * i1 + j1 * j1 <= i * i) + { + for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1) + { + BlockPos blockpos = new BlockPos(k, k1, l); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block == Blocks.dirt || block == Blocks.clay) + { + worldIn.setBlockState(blockpos, this.field_150546_a.getDefaultState(), 2); + } + } + } + } + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java new file mode 100644 index 0000000..0440d43 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenDeadBush.java @@ -0,0 +1,33 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenDeadBush extends WorldGenerator +{ + public boolean generate(World worldIn, Random rand, BlockPos position) + { + Block block; + + while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) + { + position = position.down(); + } + + for (int i = 0; i < 4; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); + + if (worldIn.isAirBlock(blockpos) && Blocks.deadbush.canBlockStay(worldIn, blockpos, Blocks.deadbush.getDefaultState())) + { + worldIn.setBlockState(blockpos, Blocks.deadbush.getDefaultState(), 2); + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenDesertWells.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenDesertWells.java new file mode 100644 index 0000000..6d49e49 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenDesertWells.java @@ -0,0 +1,106 @@ +package net.minecraft.world.gen.feature; + +import com.google.common.base.Predicates; +import java.util.Random; +import net.minecraft.block.BlockSand; +import net.minecraft.block.BlockSlab; +import net.minecraft.block.BlockStoneSlab; +import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.pattern.BlockStateHelper; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class WorldGenDesertWells extends WorldGenerator +{ + private static final BlockStateHelper field_175913_a = BlockStateHelper.forBlock(Blocks.sand).where(BlockSand.VARIANT, Predicates.equalTo(BlockSand.EnumType.SAND)); + private final IBlockState field_175911_b = Blocks.stone_slab.getDefaultState().withProperty(BlockStoneSlab.VARIANT, BlockStoneSlab.EnumType.SAND).withProperty(BlockSlab.HALF, BlockSlab.EnumBlockHalf.BOTTOM); + private final IBlockState field_175912_c = Blocks.sandstone.getDefaultState(); + private final IBlockState field_175910_d = Blocks.flowing_water.getDefaultState(); + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + while (worldIn.isAirBlock(position) && position.getY() > 2) + { + position = position.down(); + } + + if (!field_175913_a.apply(worldIn.getBlockState(position))) + { + return false; + } + else + { + for (int i = -2; i <= 2; ++i) + { + for (int j = -2; j <= 2; ++j) + { + if (worldIn.isAirBlock(position.add(i, -1, j)) && worldIn.isAirBlock(position.add(i, -2, j))) + { + return false; + } + } + } + + for (int l = -1; l <= 0; ++l) + { + for (int l1 = -2; l1 <= 2; ++l1) + { + for (int k = -2; k <= 2; ++k) + { + worldIn.setBlockState(position.add(l1, l, k), this.field_175912_c, 2); + } + } + } + + worldIn.setBlockState(position, this.field_175910_d, 2); + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + worldIn.setBlockState(position.offset((EnumFacing) enumfacing), this.field_175910_d, 2); + } + + for (int i1 = -2; i1 <= 2; ++i1) + { + for (int i2 = -2; i2 <= 2; ++i2) + { + if (i1 == -2 || i1 == 2 || i2 == -2 || i2 == 2) + { + worldIn.setBlockState(position.add(i1, 1, i2), this.field_175912_c, 2); + } + } + } + + worldIn.setBlockState(position.add(2, 1, 0), this.field_175911_b, 2); + worldIn.setBlockState(position.add(-2, 1, 0), this.field_175911_b, 2); + worldIn.setBlockState(position.add(0, 1, 2), this.field_175911_b, 2); + worldIn.setBlockState(position.add(0, 1, -2), this.field_175911_b, 2); + + for (int j1 = -1; j1 <= 1; ++j1) + { + for (int j2 = -1; j2 <= 1; ++j2) + { + if (j1 == 0 && j2 == 0) + { + worldIn.setBlockState(position.add(j1, 4, j2), this.field_175912_c, 2); + } + else + { + worldIn.setBlockState(position.add(j1, 4, j2), this.field_175911_b, 2); + } + } + } + + for (int k1 = 1; k1 <= 3; ++k1) + { + worldIn.setBlockState(position.add(-1, k1, -1), this.field_175912_c, 2); + worldIn.setBlockState(position.add(-1, k1, 1), this.field_175912_c, 2); + worldIn.setBlockState(position.add(1, k1, -1), this.field_175912_c, 2); + worldIn.setBlockState(position.add(1, k1, 1), this.field_175912_c, 2); + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenDoublePlant.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenDoublePlant.java new file mode 100644 index 0000000..7880a2b --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenDoublePlant.java @@ -0,0 +1,35 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenDoublePlant extends WorldGenerator +{ + private BlockDoublePlant.EnumPlantType field_150549_a; + + public void setPlantType(BlockDoublePlant.EnumPlantType p_180710_1_) + { + this.field_150549_a = p_180710_1_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + boolean flag = false; + + for (int i = 0; i < 64; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); + + if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < 254) && Blocks.double_plant.canPlaceBlockAt(worldIn, blockpos)) + { + Blocks.double_plant.placeAt(worldIn, blockpos, this.field_150549_a, 2); + flag = true; + } + } + + return flag; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java new file mode 100644 index 0000000..319a5de --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenDungeons.java @@ -0,0 +1,167 @@ +package net.minecraft.world.gen.feature; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.tileentity.TileEntityMobSpawner; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.world.World; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class WorldGenDungeons extends WorldGenerator +{ + private static final Logger field_175918_a = LogManager.getLogger(); + private static final String[] SPAWNERTYPES = new String[] {"Skeleton", "Zombie", "Zombie", "Spider"}; + private static final List CHESTCONTENT = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 4, 10), new WeightedRandomChestContent(Items.bread, 0, 1, 1, 10), new WeightedRandomChestContent(Items.wheat, 0, 1, 4, 10), new WeightedRandomChestContent(Items.gunpowder, 0, 1, 4, 10), new WeightedRandomChestContent(Items.string, 0, 1, 4, 10), new WeightedRandomChestContent(Items.bucket, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_apple, 0, 1, 1, 1), new WeightedRandomChestContent(Items.redstone, 0, 1, 4, 10), new WeightedRandomChestContent(Items.record_13, 0, 1, 1, 4), new WeightedRandomChestContent(Items.record_cat, 0, 1, 1, 4), new WeightedRandomChestContent(Items.name_tag, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 2), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 1)}); + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + int i = 3; + int j = rand.nextInt(2) + 2; + int k = -j - 1; + int l = j + 1; + int i1 = -1; + int j1 = 4; + int k1 = rand.nextInt(2) + 2; + int l1 = -k1 - 1; + int i2 = k1 + 1; + int j2 = 0; + + for (int k2 = k; k2 <= l; ++k2) + { + for (int l2 = -1; l2 <= 4; ++l2) + { + for (int i3 = l1; i3 <= i2; ++i3) + { + BlockPos blockpos = position.add(k2, l2, i3); + Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); + boolean flag = material.isSolid(); + + if (l2 == -1 && !flag) + { + return false; + } + + if (l2 == 4 && !flag) + { + return false; + } + + if ((k2 == k || k2 == l || i3 == l1 || i3 == i2) && l2 == 0 && worldIn.isAirBlock(blockpos) && worldIn.isAirBlock(blockpos.up())) + { + ++j2; + } + } + } + } + + if (j2 >= 1 && j2 <= 5) + { + for (int k3 = k; k3 <= l; ++k3) + { + for (int i4 = 3; i4 >= -1; --i4) + { + for (int k4 = l1; k4 <= i2; ++k4) + { + BlockPos blockpos1 = position.add(k3, i4, k4); + + if (k3 != k && i4 != -1 && k4 != l1 && k3 != l && i4 != 4 && k4 != i2) + { + if (worldIn.getBlockState(blockpos1).getBlock() != Blocks.chest) + { + worldIn.setBlockToAir(blockpos1); + } + } + else if (blockpos1.getY() >= 0 && !worldIn.getBlockState(blockpos1.down()).getBlock().getMaterial().isSolid()) + { + worldIn.setBlockToAir(blockpos1); + } + else if (worldIn.getBlockState(blockpos1).getBlock().getMaterial().isSolid() && worldIn.getBlockState(blockpos1).getBlock() != Blocks.chest) + { + if (i4 == -1 && rand.nextInt(4) != 0) + { + worldIn.setBlockState(blockpos1, Blocks.mossy_cobblestone.getDefaultState(), 2); + } + else + { + worldIn.setBlockState(blockpos1, Blocks.cobblestone.getDefaultState(), 2); + } + } + } + } + } + + for (int l3 = 0; l3 < 2; ++l3) + { + for (int j4 = 0; j4 < 3; ++j4) + { + int l4 = position.getX() + rand.nextInt(j * 2 + 1) - j; + int i5 = position.getY(); + int j5 = position.getZ() + rand.nextInt(k1 * 2 + 1) - k1; + BlockPos blockpos2 = new BlockPos(l4, i5, j5); + + if (worldIn.isAirBlock(blockpos2)) + { + int j3 = 0; + + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (worldIn.getBlockState(blockpos2.offset((EnumFacing) enumfacing)).getBlock().getMaterial().isSolid()) + { + ++j3; + } + } + + if (j3 == 1) + { + worldIn.setBlockState(blockpos2, Blocks.chest.correctFacing(worldIn, blockpos2, Blocks.chest.getDefaultState()), 2); + List list = WeightedRandomChestContent.func_177629_a(CHESTCONTENT, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(rand)}); + TileEntity tileentity1 = worldIn.getTileEntity(blockpos2); + + if (tileentity1 instanceof TileEntityChest) + { + WeightedRandomChestContent.generateChestContents(rand, list, (TileEntityChest)tileentity1, 8); + } + + break; + } + } + } + } + + worldIn.setBlockState(position, Blocks.mob_spawner.getDefaultState(), 2); + TileEntity tileentity = worldIn.getTileEntity(position); + + if (tileentity instanceof TileEntityMobSpawner) + { + ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic().setEntityName(this.pickMobSpawner(rand)); + } + else + { + field_175918_a.error("Failed to fetch mob spawner entity at (" + position.getX() + ", " + position.getY() + ", " + position.getZ() + ")"); + } + + return true; + } + else + { + return false; + } + } + + /** + * Randomly decides which spawner to use in a dungeon + */ + private String pickMobSpawner(Random p_76543_1_) + { + return SPAWNERTYPES[p_76543_1_.nextInt(SPAWNERTYPES.length)]; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenFire.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenFire.java new file mode 100644 index 0000000..0cb3c3d --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenFire.java @@ -0,0 +1,24 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenFire extends WorldGenerator +{ + public boolean generate(World worldIn, Random rand, BlockPos position) + { + for (int i = 0; i < 64; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); + + if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).getBlock() == Blocks.netherrack) + { + worldIn.setBlockState(blockpos, Blocks.fire.getDefaultState(), 2); + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenFlowers.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenFlowers.java new file mode 100644 index 0000000..bbe8e77 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenFlowers.java @@ -0,0 +1,39 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenFlowers extends WorldGenerator +{ + private BlockFlower flower; + private IBlockState field_175915_b; + + public WorldGenFlowers(BlockFlower p_i45632_1_, BlockFlower.EnumFlowerType p_i45632_2_) + { + this.setGeneratedBlock(p_i45632_1_, p_i45632_2_); + } + + public void setGeneratedBlock(BlockFlower p_175914_1_, BlockFlower.EnumFlowerType p_175914_2_) + { + this.flower = p_175914_1_; + this.field_175915_b = p_175914_1_.getDefaultState().withProperty(p_175914_1_.getTypeProperty(), p_175914_2_); + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + for (int i = 0; i < 64; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); + + if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky() || blockpos.getY() < 255) && this.flower.canBlockStay(worldIn, blockpos, this.field_175915_b)) + { + worldIn.setBlockState(blockpos, this.field_175915_b, 2); + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java new file mode 100644 index 0000000..cd80f84 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenForest.java @@ -0,0 +1,136 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockOldLeaf; +import net.minecraft.block.BlockOldLog; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenForest extends WorldGenAbstractTree +{ + private static final IBlockState field_181629_a = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.BIRCH); + private static final IBlockState field_181630_b = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.BIRCH).withProperty(BlockOldLeaf.CHECK_DECAY, Boolean.valueOf(false)); + private boolean useExtraRandomHeight; + + public WorldGenForest(boolean p_i45449_1_, boolean p_i45449_2_) + { + super(p_i45449_1_); + this.useExtraRandomHeight = p_i45449_2_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + int i = rand.nextInt(3) + 5; + + if (this.useExtraRandomHeight) + { + i += rand.nextInt(7); + } + + boolean flag = true; + + if (position.getY() >= 1 && position.getY() + i + 1 <= 256) + { + for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) + { + int k = 1; + + if (j == position.getY()) + { + k = 0; + } + + if (j >= position.getY() + 1 + i - 2) + { + k = 2; + } + + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) + { + for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) + { + if (j >= 0 && j < 256) + { + if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock())) + { + flag = false; + } + } + else + { + flag = false; + } + } + } + } + + if (!flag) + { + return false; + } + else + { + Block block1 = worldIn.getBlockState(position.down()).getBlock(); + + if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) + { + this.func_175921_a(worldIn, position.down()); + + for (int i2 = position.getY() - 3 + i; i2 <= position.getY() + i; ++i2) + { + int k2 = i2 - (position.getY() + i); + int l2 = 1 - k2 / 2; + + for (int i3 = position.getX() - l2; i3 <= position.getX() + l2; ++i3) + { + int j1 = i3 - position.getX(); + + for (int k1 = position.getZ() - l2; k1 <= position.getZ() + l2; ++k1) + { + int l1 = k1 - position.getZ(); + + if (Math.abs(j1) != l2 || Math.abs(l1) != l2 || rand.nextInt(2) != 0 && k2 != 0) + { + BlockPos blockpos = new BlockPos(i3, i2, k1); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181630_b); + } + } + } + } + } + + for (int j2 = 0; j2 < i; ++j2) + { + Block block2 = worldIn.getBlockState(position.up(j2)).getBlock(); + + if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(j2), field_181629_a); + } + } + + return true; + } + else + { + return false; + } + } + } + else + { + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java new file mode 100644 index 0000000..27bc39e --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone1.java @@ -0,0 +1,57 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class WorldGenGlowStone1 extends WorldGenerator +{ + public boolean generate(World worldIn, Random rand, BlockPos position) + { + if (!worldIn.isAirBlock(position)) + { + return false; + } + else if (worldIn.getBlockState(position.up()).getBlock() != Blocks.netherrack) + { + return false; + } + else + { + worldIn.setBlockState(position, Blocks.glowstone.getDefaultState(), 2); + + for (int i = 0; i < 1500; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), -rand.nextInt(12), rand.nextInt(8) - rand.nextInt(8)); + + if (worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air) + { + int j = 0; + + for (EnumFacing enumfacing : EnumFacing.values()) + { + if (worldIn.getBlockState(blockpos.offset(enumfacing)).getBlock() == Blocks.glowstone) + { + ++j; + } + + if (j > 1) + { + break; + } + } + + if (j == 1) + { + worldIn.setBlockState(blockpos, Blocks.glowstone.getDefaultState(), 2); + } + } + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java new file mode 100644 index 0000000..49d36b7 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenGlowStone2.java @@ -0,0 +1,57 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class WorldGenGlowStone2 extends WorldGenerator +{ + public boolean generate(World worldIn, Random rand, BlockPos position) + { + if (!worldIn.isAirBlock(position)) + { + return false; + } + else if (worldIn.getBlockState(position.up()).getBlock() != Blocks.netherrack) + { + return false; + } + else + { + worldIn.setBlockState(position, Blocks.glowstone.getDefaultState(), 2); + + for (int i = 0; i < 1500; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), -rand.nextInt(12), rand.nextInt(8) - rand.nextInt(8)); + + if (worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air) + { + int j = 0; + + for (EnumFacing enumfacing : EnumFacing.values()) + { + if (worldIn.getBlockState(blockpos.offset(enumfacing)).getBlock() == Blocks.glowstone) + { + ++j; + } + + if (j > 1) + { + break; + } + } + + if (j == 1) + { + worldIn.setBlockState(blockpos, Blocks.glowstone.getDefaultState(), 2); + } + } + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java new file mode 100644 index 0000000..aa6698a --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenHellLava.java @@ -0,0 +1,96 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenHellLava extends WorldGenerator +{ + private final Block field_150553_a; + private final boolean field_94524_b; + + public WorldGenHellLava(Block p_i45453_1_, boolean p_i45453_2_) + { + this.field_150553_a = p_i45453_1_; + this.field_94524_b = p_i45453_2_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + if (worldIn.getBlockState(position.up()).getBlock() != Blocks.netherrack) + { + return false; + } + else if (worldIn.getBlockState(position).getBlock().getMaterial() != Material.air && worldIn.getBlockState(position).getBlock() != Blocks.netherrack) + { + return false; + } + else + { + int i = 0; + + if (worldIn.getBlockState(position.west()).getBlock() == Blocks.netherrack) + { + ++i; + } + + if (worldIn.getBlockState(position.east()).getBlock() == Blocks.netherrack) + { + ++i; + } + + if (worldIn.getBlockState(position.north()).getBlock() == Blocks.netherrack) + { + ++i; + } + + if (worldIn.getBlockState(position.south()).getBlock() == Blocks.netherrack) + { + ++i; + } + + if (worldIn.getBlockState(position.down()).getBlock() == Blocks.netherrack) + { + ++i; + } + + int j = 0; + + if (worldIn.isAirBlock(position.west())) + { + ++j; + } + + if (worldIn.isAirBlock(position.east())) + { + ++j; + } + + if (worldIn.isAirBlock(position.north())) + { + ++j; + } + + if (worldIn.isAirBlock(position.south())) + { + ++j; + } + + if (worldIn.isAirBlock(position.down())) + { + ++j; + } + + if (!this.field_94524_b && i == 4 && j == 1 || i == 5) + { + worldIn.setBlockState(position, this.field_150553_a.getDefaultState(), 2); + worldIn.forceBlockUpdateTick(this.field_150553_a, position, rand); + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java new file mode 100644 index 0000000..bd1ac81 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java @@ -0,0 +1,153 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public abstract class WorldGenHugeTrees extends WorldGenAbstractTree +{ + /** The base height of the tree */ + protected final int baseHeight; + + /** Sets the metadata for the wood blocks used */ + protected final IBlockState woodMetadata; + + /** Sets the metadata for the leaves used in huge trees */ + protected final IBlockState leavesMetadata; + protected int extraRandomHeight; + + public WorldGenHugeTrees(boolean p_i46447_1_, int p_i46447_2_, int p_i46447_3_, IBlockState p_i46447_4_, IBlockState p_i46447_5_) + { + super(p_i46447_1_); + this.baseHeight = p_i46447_2_; + this.extraRandomHeight = p_i46447_3_; + this.woodMetadata = p_i46447_4_; + this.leavesMetadata = p_i46447_5_; + } + + protected int func_150533_a(Random p_150533_1_) + { + int i = p_150533_1_.nextInt(3) + this.baseHeight; + + if (this.extraRandomHeight > 1) + { + i += p_150533_1_.nextInt(this.extraRandomHeight); + } + + return i; + } + + private boolean func_175926_c(World worldIn, BlockPos p_175926_2_, int p_175926_3_) + { + boolean flag = true; + + if (p_175926_2_.getY() >= 1 && p_175926_2_.getY() + p_175926_3_ + 1 <= 256) + { + for (int i = 0; i <= 1 + p_175926_3_; ++i) + { + int j = 2; + + if (i == 0) + { + j = 1; + } + else if (i >= 1 + p_175926_3_ - 2) + { + j = 2; + } + + for (int k = -j; k <= j && flag; ++k) + { + for (int l = -j; l <= j && flag; ++l) + { + if (p_175926_2_.getY() + i < 0 || p_175926_2_.getY() + i >= 256 || !this.func_150523_a(worldIn.getBlockState(p_175926_2_.add(k, i, l)).getBlock())) + { + flag = false; + } + } + } + } + + return flag; + } + else + { + return false; + } + } + + private boolean func_175927_a(BlockPos p_175927_1_, World worldIn) + { + BlockPos blockpos = p_175927_1_.down(); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if ((block == Blocks.grass || block == Blocks.dirt) && p_175927_1_.getY() >= 2) + { + this.func_175921_a(worldIn, blockpos); + this.func_175921_a(worldIn, blockpos.east()); + this.func_175921_a(worldIn, blockpos.south()); + this.func_175921_a(worldIn, blockpos.south().east()); + return true; + } + else + { + return false; + } + } + + protected boolean func_175929_a(World worldIn, Random p_175929_2_, BlockPos p_175929_3_, int p_175929_4_) + { + return this.func_175926_c(worldIn, p_175929_3_, p_175929_4_) && this.func_175927_a(p_175929_3_, worldIn); + } + + protected void func_175925_a(World worldIn, BlockPos p_175925_2_, int p_175925_3_) + { + int i = p_175925_3_ * p_175925_3_; + + for (int j = -p_175925_3_; j <= p_175925_3_ + 1; ++j) + { + for (int k = -p_175925_3_; k <= p_175925_3_ + 1; ++k) + { + int l = j - 1; + int i1 = k - 1; + + if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i) + { + BlockPos blockpos = p_175925_2_.add(j, 0, k); + Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); + + if (material == Material.air || material == Material.leaves) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); + } + } + } + } + } + + protected void func_175928_b(World worldIn, BlockPos p_175928_2_, int p_175928_3_) + { + int i = p_175928_3_ * p_175928_3_; + + for (int j = -p_175928_3_; j <= p_175928_3_; ++j) + { + for (int k = -p_175928_3_; k <= p_175928_3_; ++k) + { + if (j * j + k * k <= i) + { + BlockPos blockpos = p_175928_2_.add(j, 0, k); + Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); + + if (material == Material.air || material == Material.leaves) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); + } + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenIcePath.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenIcePath.java new file mode 100644 index 0000000..0cde8b8 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenIcePath.java @@ -0,0 +1,61 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenIcePath extends WorldGenerator +{ + private Block block = Blocks.packed_ice; + private int basePathWidth; + + public WorldGenIcePath(int p_i45454_1_) + { + this.basePathWidth = p_i45454_1_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + while (worldIn.isAirBlock(position) && position.getY() > 2) + { + position = position.down(); + } + + if (worldIn.getBlockState(position).getBlock() != Blocks.snow) + { + return false; + } + else + { + int i = rand.nextInt(this.basePathWidth - 2) + 2; + int j = 1; + + for (int k = position.getX() - i; k <= position.getX() + i; ++k) + { + for (int l = position.getZ() - i; l <= position.getZ() + i; ++l) + { + int i1 = k - position.getX(); + int j1 = l - position.getZ(); + + if (i1 * i1 + j1 * j1 <= i * i) + { + for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1) + { + BlockPos blockpos = new BlockPos(k, k1, l); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) + { + worldIn.setBlockState(blockpos, this.block.getDefaultState(), 2); + } + } + } + } + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java new file mode 100644 index 0000000..cf6cd88 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenIceSpike.java @@ -0,0 +1,119 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class WorldGenIceSpike extends WorldGenerator +{ + public boolean generate(World worldIn, Random rand, BlockPos position) + { + while (worldIn.isAirBlock(position) && position.getY() > 2) + { + position = position.down(); + } + + if (worldIn.getBlockState(position).getBlock() != Blocks.snow) + { + return false; + } + else + { + position = position.up(rand.nextInt(4)); + int i = rand.nextInt(4) + 7; + int j = i / 4 + rand.nextInt(2); + + if (j > 1 && rand.nextInt(60) == 0) + { + position = position.up(10 + rand.nextInt(30)); + } + + for (int k = 0; k < i; ++k) + { + float f = (1.0F - (float)k / (float)i) * (float)j; + int l = MathHelper.ceiling_float_int(f); + + for (int i1 = -l; i1 <= l; ++i1) + { + float f1 = (float)MathHelper.abs_int(i1) - 0.25F; + + for (int j1 = -l; j1 <= l; ++j1) + { + float f2 = (float)MathHelper.abs_int(j1) - 0.25F; + + if ((i1 == 0 && j1 == 0 || f1 * f1 + f2 * f2 <= f * f) && (i1 != -l && i1 != l && j1 != -l && j1 != l || rand.nextFloat() <= 0.75F)) + { + Block block = worldIn.getBlockState(position.add(i1, k, j1)).getBlock(); + + if (block.getMaterial() == Material.air || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(i1, k, j1), Blocks.packed_ice.getDefaultState()); + } + + if (k != 0 && l > 1) + { + block = worldIn.getBlockState(position.add(i1, -k, j1)).getBlock(); + + if (block.getMaterial() == Material.air || block == Blocks.dirt || block == Blocks.snow || block == Blocks.ice) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(i1, -k, j1), Blocks.packed_ice.getDefaultState()); + } + } + } + } + } + } + + int k1 = j - 1; + + if (k1 < 0) + { + k1 = 0; + } + else if (k1 > 1) + { + k1 = 1; + } + + for (int l1 = -k1; l1 <= k1; ++l1) + { + for (int i2 = -k1; i2 <= k1; ++i2) + { + BlockPos blockpos = position.add(l1, -1, i2); + int j2 = 50; + + if (Math.abs(l1) == 1 && Math.abs(i2) == 1) + { + j2 = rand.nextInt(5); + } + + while (blockpos.getY() > 50) + { + Block block1 = worldIn.getBlockState(blockpos).getBlock(); + + if (block1.getMaterial() != Material.air && block1 != Blocks.dirt && block1 != Blocks.snow && block1 != Blocks.ice && block1 != Blocks.packed_ice) + { + break; + } + + this.setBlockAndNotifyAdequately(worldIn, blockpos, Blocks.packed_ice.getDefaultState()); + blockpos = blockpos.down(); + --j2; + + if (j2 <= 0) + { + blockpos = blockpos.down(rand.nextInt(5) + 1); + j2 = rand.nextInt(5); + } + } + } + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenLakes.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenLakes.java new file mode 100644 index 0000000..54c1d3b --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenLakes.java @@ -0,0 +1,173 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; + +public class WorldGenLakes extends WorldGenerator +{ + private Block block; + + public WorldGenLakes(Block blockIn) + { + this.block = blockIn; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + for (position = position.add(-8, 0, -8); position.getY() > 5 && worldIn.isAirBlock(position); position = position.down()) + { + ; + } + + if (position.getY() <= 4) + { + return false; + } + else + { + position = position.down(4); + boolean[] aboolean = new boolean[2048]; + int i = rand.nextInt(4) + 4; + + for (int j = 0; j < i; ++j) + { + double d0 = rand.nextDouble() * 6.0D + 3.0D; + double d1 = rand.nextDouble() * 4.0D + 2.0D; + double d2 = rand.nextDouble() * 6.0D + 3.0D; + double d3 = rand.nextDouble() * (16.0D - d0 - 2.0D) + 1.0D + d0 / 2.0D; + double d4 = rand.nextDouble() * (8.0D - d1 - 4.0D) + 2.0D + d1 / 2.0D; + double d5 = rand.nextDouble() * (16.0D - d2 - 2.0D) + 1.0D + d2 / 2.0D; + + for (int l = 1; l < 15; ++l) + { + for (int i1 = 1; i1 < 15; ++i1) + { + for (int j1 = 1; j1 < 7; ++j1) + { + double d6 = ((double)l - d3) / (d0 / 2.0D); + double d7 = ((double)j1 - d4) / (d1 / 2.0D); + double d8 = ((double)i1 - d5) / (d2 / 2.0D); + double d9 = d6 * d6 + d7 * d7 + d8 * d8; + + if (d9 < 1.0D) + { + aboolean[(l * 16 + i1) * 8 + j1] = true; + } + } + } + } + } + + for (int k1 = 0; k1 < 16; ++k1) + { + for (int l2 = 0; l2 < 16; ++l2) + { + for (int k = 0; k < 8; ++k) + { + boolean flag = !aboolean[(k1 * 16 + l2) * 8 + k] && (k1 < 15 && aboolean[((k1 + 1) * 16 + l2) * 8 + k] || k1 > 0 && aboolean[((k1 - 1) * 16 + l2) * 8 + k] || l2 < 15 && aboolean[(k1 * 16 + l2 + 1) * 8 + k] || l2 > 0 && aboolean[(k1 * 16 + (l2 - 1)) * 8 + k] || k < 7 && aboolean[(k1 * 16 + l2) * 8 + k + 1] || k > 0 && aboolean[(k1 * 16 + l2) * 8 + (k - 1)]); + + if (flag) + { + Material material = worldIn.getBlockState(position.add(k1, k, l2)).getBlock().getMaterial(); + + if (k >= 4 && material.isLiquid()) + { + return false; + } + + if (k < 4 && !material.isSolid() && worldIn.getBlockState(position.add(k1, k, l2)).getBlock() != this.block) + { + return false; + } + } + } + } + } + + for (int l1 = 0; l1 < 16; ++l1) + { + for (int i3 = 0; i3 < 16; ++i3) + { + for (int i4 = 0; i4 < 8; ++i4) + { + if (aboolean[(l1 * 16 + i3) * 8 + i4]) + { + worldIn.setBlockState(position.add(l1, i4, i3), i4 >= 4 ? Blocks.air.getDefaultState() : this.block.getDefaultState(), 2); + } + } + } + } + + for (int i2 = 0; i2 < 16; ++i2) + { + for (int j3 = 0; j3 < 16; ++j3) + { + for (int j4 = 4; j4 < 8; ++j4) + { + if (aboolean[(i2 * 16 + j3) * 8 + j4]) + { + BlockPos blockpos = position.add(i2, j4 - 1, j3); + + if (worldIn.getBlockState(blockpos).getBlock() == Blocks.dirt && worldIn.getLightFor(EnumSkyBlock.SKY, position.add(i2, j4, j3)) > 0) + { + BiomeGenBase biomegenbase = worldIn.getBiomeGenForCoords(blockpos); + + if (biomegenbase.topBlock.getBlock() == Blocks.mycelium) + { + worldIn.setBlockState(blockpos, Blocks.mycelium.getDefaultState(), 2); + } + else + { + worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState(), 2); + } + } + } + } + } + } + + if (this.block.getMaterial() == Material.lava) + { + for (int j2 = 0; j2 < 16; ++j2) + { + for (int k3 = 0; k3 < 16; ++k3) + { + for (int k4 = 0; k4 < 8; ++k4) + { + boolean flag1 = !aboolean[(j2 * 16 + k3) * 8 + k4] && (j2 < 15 && aboolean[((j2 + 1) * 16 + k3) * 8 + k4] || j2 > 0 && aboolean[((j2 - 1) * 16 + k3) * 8 + k4] || k3 < 15 && aboolean[(j2 * 16 + k3 + 1) * 8 + k4] || k3 > 0 && aboolean[(j2 * 16 + (k3 - 1)) * 8 + k4] || k4 < 7 && aboolean[(j2 * 16 + k3) * 8 + k4 + 1] || k4 > 0 && aboolean[(j2 * 16 + k3) * 8 + (k4 - 1)]); + + if (flag1 && (k4 < 4 || rand.nextInt(2) != 0) && worldIn.getBlockState(position.add(j2, k4, k3)).getBlock().getMaterial().isSolid()) + { + worldIn.setBlockState(position.add(j2, k4, k3), Blocks.stone.getDefaultState(), 2); + } + } + } + } + } + + if (this.block.getMaterial() == Material.water) + { + for (int k2 = 0; k2 < 16; ++k2) + { + for (int l3 = 0; l3 < 16; ++l3) + { + int l4 = 4; + + if (worldIn.canBlockFreezeWater(position.add(k2, l4, l3))) + { + worldIn.setBlockState(position.add(k2, l4, l3), Blocks.ice.getDefaultState(), 2); + } + } + } + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java new file mode 100644 index 0000000..4fa2be6 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenLiquids.java @@ -0,0 +1,88 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenLiquids extends WorldGenerator +{ + private Block block; + + public WorldGenLiquids(Block p_i45465_1_) + { + this.block = p_i45465_1_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + if (worldIn.getBlockState(position.up()).getBlock() != Blocks.stone) + { + return false; + } + else if (worldIn.getBlockState(position.down()).getBlock() != Blocks.stone) + { + return false; + } + else if (worldIn.getBlockState(position).getBlock().getMaterial() != Material.air && worldIn.getBlockState(position).getBlock() != Blocks.stone) + { + return false; + } + else + { + int i = 0; + + if (worldIn.getBlockState(position.west()).getBlock() == Blocks.stone) + { + ++i; + } + + if (worldIn.getBlockState(position.east()).getBlock() == Blocks.stone) + { + ++i; + } + + if (worldIn.getBlockState(position.north()).getBlock() == Blocks.stone) + { + ++i; + } + + if (worldIn.getBlockState(position.south()).getBlock() == Blocks.stone) + { + ++i; + } + + int j = 0; + + if (worldIn.isAirBlock(position.west())) + { + ++j; + } + + if (worldIn.isAirBlock(position.east())) + { + ++j; + } + + if (worldIn.isAirBlock(position.north())) + { + ++j; + } + + if (worldIn.isAirBlock(position.south())) + { + ++j; + } + + if (i == 3 && j == 1) + { + worldIn.setBlockState(position, this.block.getDefaultState(), 2); + worldIn.forceBlockUpdateTick(this.block, position, rand); + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java new file mode 100644 index 0000000..3c63bb8 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenMegaJungle.java @@ -0,0 +1,133 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.BlockVine; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class WorldGenMegaJungle extends WorldGenHugeTrees +{ + public WorldGenMegaJungle(boolean p_i46448_1_, int p_i46448_2_, int p_i46448_3_, IBlockState p_i46448_4_, IBlockState p_i46448_5_) + { + super(p_i46448_1_, p_i46448_2_, p_i46448_3_, p_i46448_4_, p_i46448_5_); + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + int i = this.func_150533_a(rand); + + if (!this.func_175929_a(worldIn, rand, position, i)) + { + return false; + } + else + { + this.func_175930_c(worldIn, position.up(i), 2); + + for (int j = position.getY() + i - 2 - rand.nextInt(4); j > position.getY() + i / 2; j -= 2 + rand.nextInt(4)) + { + float f = rand.nextFloat() * (float)Math.PI * 2.0F; + int k = position.getX() + (int)(0.5F + MathHelper.cos(f) * 4.0F); + int l = position.getZ() + (int)(0.5F + MathHelper.sin(f) * 4.0F); + + for (int i1 = 0; i1 < 5; ++i1) + { + k = position.getX() + (int)(1.5F + MathHelper.cos(f) * (float)i1); + l = position.getZ() + (int)(1.5F + MathHelper.sin(f) * (float)i1); + this.setBlockAndNotifyAdequately(worldIn, new BlockPos(k, j - 3 + i1 / 2, l), this.woodMetadata); + } + + int j2 = 1 + rand.nextInt(2); + int j1 = j; + + for (int k1 = j - j2; k1 <= j1; ++k1) + { + int l1 = k1 - j1; + this.func_175928_b(worldIn, new BlockPos(k, k1, l), 1 - l1); + } + } + + for (int i2 = 0; i2 < i; ++i2) + { + BlockPos blockpos = position.up(i2); + + if (this.func_150523_a(worldIn.getBlockState(blockpos).getBlock())) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.woodMetadata); + + if (i2 > 0) + { + this.func_181632_a(worldIn, rand, blockpos.west(), BlockVine.EAST); + this.func_181632_a(worldIn, rand, blockpos.north(), BlockVine.SOUTH); + } + } + + if (i2 < i - 1) + { + BlockPos blockpos1 = blockpos.east(); + + if (this.func_150523_a(worldIn.getBlockState(blockpos1).getBlock())) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos1, this.woodMetadata); + + if (i2 > 0) + { + this.func_181632_a(worldIn, rand, blockpos1.east(), BlockVine.WEST); + this.func_181632_a(worldIn, rand, blockpos1.north(), BlockVine.SOUTH); + } + } + + BlockPos blockpos2 = blockpos.south().east(); + + if (this.func_150523_a(worldIn.getBlockState(blockpos2).getBlock())) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos2, this.woodMetadata); + + if (i2 > 0) + { + this.func_181632_a(worldIn, rand, blockpos2.east(), BlockVine.WEST); + this.func_181632_a(worldIn, rand, blockpos2.south(), BlockVine.NORTH); + } + } + + BlockPos blockpos3 = blockpos.south(); + + if (this.func_150523_a(worldIn.getBlockState(blockpos3).getBlock())) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos3, this.woodMetadata); + + if (i2 > 0) + { + this.func_181632_a(worldIn, rand, blockpos3.west(), BlockVine.EAST); + this.func_181632_a(worldIn, rand, blockpos3.south(), BlockVine.NORTH); + } + } + } + } + + return true; + } + } + + private void func_181632_a(World p_181632_1_, Random p_181632_2_, BlockPos p_181632_3_, PropertyBool p_181632_4_) + { + if (p_181632_2_.nextInt(3) > 0 && p_181632_1_.isAirBlock(p_181632_3_)) + { + this.setBlockAndNotifyAdequately(p_181632_1_, p_181632_3_, Blocks.vine.getDefaultState().withProperty(p_181632_4_, Boolean.valueOf(true))); + } + } + + private void func_175930_c(World worldIn, BlockPos p_175930_2_, int p_175930_3_) + { + int i = 2; + + for (int j = -i; j <= 0; ++j) + { + this.func_175925_a(worldIn, p_175930_2_.up(j), p_175930_3_ + 1 - j); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java new file mode 100644 index 0000000..cf88708 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenMegaPineTree.java @@ -0,0 +1,147 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDirt; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockOldLeaf; +import net.minecraft.block.BlockOldLog; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class WorldGenMegaPineTree extends WorldGenHugeTrees +{ + private static final IBlockState field_181633_e = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE); + private static final IBlockState field_181634_f = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + private static final IBlockState field_181635_g = Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.PODZOL); + private boolean useBaseHeight; + + public WorldGenMegaPineTree(boolean p_i45457_1_, boolean p_i45457_2_) + { + super(p_i45457_1_, 13, 15, field_181633_e, field_181634_f); + this.useBaseHeight = p_i45457_2_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + int i = this.func_150533_a(rand); + + if (!this.func_175929_a(worldIn, rand, position, i)) + { + return false; + } + else + { + this.func_150541_c(worldIn, position.getX(), position.getZ(), position.getY() + i, 0, rand); + + for (int j = 0; j < i; ++j) + { + Block block = worldIn.getBlockState(position.up(j)).getBlock(); + + if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(j), this.woodMetadata); + } + + if (j < i - 1) + { + block = worldIn.getBlockState(position.add(1, j, 0)).getBlock(); + + if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 0), this.woodMetadata); + } + + block = worldIn.getBlockState(position.add(1, j, 1)).getBlock(); + + if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(1, j, 1), this.woodMetadata); + } + + block = worldIn.getBlockState(position.add(0, j, 1)).getBlock(); + + if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves) + { + this.setBlockAndNotifyAdequately(worldIn, position.add(0, j, 1), this.woodMetadata); + } + } + } + + return true; + } + } + + private void func_150541_c(World worldIn, int p_150541_2_, int p_150541_3_, int p_150541_4_, int p_150541_5_, Random p_150541_6_) + { + int i = p_150541_6_.nextInt(5) + (this.useBaseHeight ? this.baseHeight : 3); + int j = 0; + + for (int k = p_150541_4_ - i; k <= p_150541_4_; ++k) + { + int l = p_150541_4_ - k; + int i1 = p_150541_5_ + MathHelper.floor_float((float)l / (float)i * 3.5F); + this.func_175925_a(worldIn, new BlockPos(p_150541_2_, k, p_150541_3_), i1 + (l > 0 && i1 == j && (k & 1) == 0 ? 1 : 0)); + j = i1; + } + } + + public void func_180711_a(World worldIn, Random p_180711_2_, BlockPos p_180711_3_) + { + this.func_175933_b(worldIn, p_180711_3_.west().north()); + this.func_175933_b(worldIn, p_180711_3_.east(2).north()); + this.func_175933_b(worldIn, p_180711_3_.west().south(2)); + this.func_175933_b(worldIn, p_180711_3_.east(2).south(2)); + + for (int i = 0; i < 5; ++i) + { + int j = p_180711_2_.nextInt(64); + int k = j % 8; + int l = j / 8; + + if (k == 0 || k == 7 || l == 0 || l == 7) + { + this.func_175933_b(worldIn, p_180711_3_.add(-3 + k, 0, -3 + l)); + } + } + } + + private void func_175933_b(World worldIn, BlockPos p_175933_2_) + { + for (int i = -2; i <= 2; ++i) + { + for (int j = -2; j <= 2; ++j) + { + if (Math.abs(i) != 2 || Math.abs(j) != 2) + { + this.func_175934_c(worldIn, p_175933_2_.add(i, 0, j)); + } + } + } + } + + private void func_175934_c(World worldIn, BlockPos p_175934_2_) + { + for (int i = 2; i >= -3; --i) + { + BlockPos blockpos = p_175934_2_.up(i); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block == Blocks.grass || block == Blocks.dirt) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181635_g); + break; + } + + if (block.getMaterial() != Material.air && i < 0) + { + break; + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenMelon.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenMelon.java new file mode 100644 index 0000000..9b46a55 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenMelon.java @@ -0,0 +1,24 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenMelon extends WorldGenerator +{ + public boolean generate(World worldIn, Random rand, BlockPos position) + { + for (int i = 0; i < 64; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); + + if (Blocks.melon_block.canPlaceBlockAt(worldIn, blockpos) && worldIn.getBlockState(blockpos.down()).getBlock() == Blocks.grass) + { + worldIn.setBlockState(blockpos, Blocks.melon_block.getDefaultState(), 2); + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java new file mode 100644 index 0000000..1364804 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenMinable.java @@ -0,0 +1,92 @@ +package net.minecraft.world.gen.feature; + +import com.google.common.base.Predicate; +import java.util.Random; +import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.pattern.BlockHelper; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class WorldGenMinable extends WorldGenerator +{ + private final IBlockState oreBlock; + + /** The number of blocks to generate. */ + private final int numberOfBlocks; + private final Predicate predicate; + + public WorldGenMinable(IBlockState state, int blockCount) + { + this(state, blockCount, BlockHelper.forBlock(Blocks.stone)); + } + + public WorldGenMinable(IBlockState state, int blockCount, Predicate p_i45631_3_) + { + this.oreBlock = state; + this.numberOfBlocks = blockCount; + this.predicate = p_i45631_3_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + float f = rand.nextFloat() * (float)Math.PI; + double d0 = (double)((float)(position.getX() + 8) + MathHelper.sin(f) * (float)this.numberOfBlocks / 8.0F); + double d1 = (double)((float)(position.getX() + 8) - MathHelper.sin(f) * (float)this.numberOfBlocks / 8.0F); + double d2 = (double)((float)(position.getZ() + 8) + MathHelper.cos(f) * (float)this.numberOfBlocks / 8.0F); + double d3 = (double)((float)(position.getZ() + 8) - MathHelper.cos(f) * (float)this.numberOfBlocks / 8.0F); + double d4 = (double)(position.getY() + rand.nextInt(3) - 2); + double d5 = (double)(position.getY() + rand.nextInt(3) - 2); + + for (int i = 0; i < this.numberOfBlocks; ++i) + { + float f1 = (float)i / (float)this.numberOfBlocks; + double d6 = d0 + (d1 - d0) * (double)f1; + double d7 = d4 + (d5 - d4) * (double)f1; + double d8 = d2 + (d3 - d2) * (double)f1; + double d9 = rand.nextDouble() * (double)this.numberOfBlocks / 16.0D; + double d10 = (double)(MathHelper.sin((float)Math.PI * f1) + 1.0F) * d9 + 1.0D; + double d11 = (double)(MathHelper.sin((float)Math.PI * f1) + 1.0F) * d9 + 1.0D; + int j = MathHelper.floor_double(d6 - d10 / 2.0D); + int k = MathHelper.floor_double(d7 - d11 / 2.0D); + int l = MathHelper.floor_double(d8 - d10 / 2.0D); + int i1 = MathHelper.floor_double(d6 + d10 / 2.0D); + int j1 = MathHelper.floor_double(d7 + d11 / 2.0D); + int k1 = MathHelper.floor_double(d8 + d10 / 2.0D); + + for (int l1 = j; l1 <= i1; ++l1) + { + double d12 = ((double)l1 + 0.5D - d6) / (d10 / 2.0D); + + if (d12 * d12 < 1.0D) + { + for (int i2 = k; i2 <= j1; ++i2) + { + double d13 = ((double)i2 + 0.5D - d7) / (d11 / 2.0D); + + if (d12 * d12 + d13 * d13 < 1.0D) + { + for (int j2 = l; j2 <= k1; ++j2) + { + double d14 = ((double)j2 + 0.5D - d8) / (d10 / 2.0D); + + if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D) + { + BlockPos blockpos = new BlockPos(l1, i2, j2); + + if (this.predicate.apply(worldIn.getBlockState(blockpos))) + { + worldIn.setBlockState(blockpos, this.oreBlock, 2); + } + } + } + } + } + } + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenPumpkin.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenPumpkin.java new file mode 100644 index 0000000..e6602a4 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenPumpkin.java @@ -0,0 +1,26 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.BlockPumpkin; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class WorldGenPumpkin extends WorldGenerator +{ + public boolean generate(World worldIn, Random rand, BlockPos position) + { + for (int i = 0; i < 64; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); + + if (worldIn.isAirBlock(blockpos) && worldIn.getBlockState(blockpos.down()).getBlock() == Blocks.grass && Blocks.pumpkin.canPlaceBlockAt(worldIn, blockpos)) + { + worldIn.setBlockState(blockpos, Blocks.pumpkin.getDefaultState().withProperty(BlockPumpkin.FACING, EnumFacing.Plane.HORIZONTAL.random(rand)), 2); + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenReed.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenReed.java new file mode 100644 index 0000000..fb05db5 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenReed.java @@ -0,0 +1,38 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenReed extends WorldGenerator +{ + public boolean generate(World worldIn, Random rand, BlockPos position) + { + for (int i = 0; i < 20; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(4) - rand.nextInt(4), 0, rand.nextInt(4) - rand.nextInt(4)); + + if (worldIn.isAirBlock(blockpos)) + { + BlockPos blockpos1 = blockpos.down(); + + if (worldIn.getBlockState(blockpos1.west()).getBlock().getMaterial() == Material.water || worldIn.getBlockState(blockpos1.east()).getBlock().getMaterial() == Material.water || worldIn.getBlockState(blockpos1.north()).getBlock().getMaterial() == Material.water || worldIn.getBlockState(blockpos1.south()).getBlock().getMaterial() == Material.water) + { + int j = 2 + rand.nextInt(rand.nextInt(3) + 1); + + for (int k = 0; k < j; ++k) + { + if (Blocks.reeds.canBlockStay(worldIn, blockpos)) + { + worldIn.setBlockState(blockpos.up(k), Blocks.reeds.getDefaultState(), 2); + } + } + } + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenSand.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenSand.java new file mode 100644 index 0000000..d375609 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenSand.java @@ -0,0 +1,60 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenSand extends WorldGenerator +{ + private Block block; + + /** The maximum radius used when generating a patch of blocks. */ + private int radius; + + public WorldGenSand(Block p_i45462_1_, int p_i45462_2_) + { + this.block = p_i45462_1_; + this.radius = p_i45462_2_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + if (worldIn.getBlockState(position).getBlock().getMaterial() != Material.water) + { + return false; + } + else + { + int i = rand.nextInt(this.radius - 2) + 2; + int j = 2; + + for (int k = position.getX() - i; k <= position.getX() + i; ++k) + { + for (int l = position.getZ() - i; l <= position.getZ() + i; ++l) + { + int i1 = k - position.getX(); + int j1 = l - position.getZ(); + + if (i1 * i1 + j1 * j1 <= i * i) + { + for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1) + { + BlockPos blockpos = new BlockPos(k, k1, l); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block == Blocks.dirt || block == Blocks.grass) + { + worldIn.setBlockState(blockpos, this.block.getDefaultState(), 2); + } + } + } + } + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java new file mode 100644 index 0000000..d6fe456 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java @@ -0,0 +1,219 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockNewLeaf; +import net.minecraft.block.BlockNewLog; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class WorldGenSavannaTree extends WorldGenAbstractTree +{ + private static final IBlockState field_181643_a = Blocks.log2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA); + private static final IBlockState field_181644_b = Blocks.leaves2.getDefaultState().withProperty(BlockNewLeaf.VARIANT, BlockPlanks.EnumType.ACACIA).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + + public WorldGenSavannaTree(boolean p_i45463_1_) + { + super(p_i45463_1_); + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + int i = rand.nextInt(3) + rand.nextInt(3) + 5; + boolean flag = true; + + if (position.getY() >= 1 && position.getY() + i + 1 <= 256) + { + for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) + { + int k = 1; + + if (j == position.getY()) + { + k = 0; + } + + if (j >= position.getY() + 1 + i - 2) + { + k = 2; + } + + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) + { + for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) + { + if (j >= 0 && j < 256) + { + if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock())) + { + flag = false; + } + } + else + { + flag = false; + } + } + } + } + + if (!flag) + { + return false; + } + else + { + Block block = worldIn.getBlockState(position.down()).getBlock(); + + if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 256 - i - 1) + { + this.func_175921_a(worldIn, position.down()); + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand); + int k2 = i - rand.nextInt(4) - 1; + int l2 = 3 - rand.nextInt(3); + int i3 = position.getX(); + int j1 = position.getZ(); + int k1 = 0; + + for (int l1 = 0; l1 < i; ++l1) + { + int i2 = position.getY() + l1; + + if (l1 >= k2 && l2 > 0) + { + i3 += enumfacing.getFrontOffsetX(); + j1 += enumfacing.getFrontOffsetZ(); + --l2; + } + + BlockPos blockpos = new BlockPos(i3, i2, j1); + Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial(); + + if (material == Material.air || material == Material.leaves) + { + this.func_181642_b(worldIn, blockpos); + k1 = i2; + } + } + + BlockPos blockpos2 = new BlockPos(i3, k1, j1); + + for (int j3 = -3; j3 <= 3; ++j3) + { + for (int i4 = -3; i4 <= 3; ++i4) + { + if (Math.abs(j3) != 3 || Math.abs(i4) != 3) + { + this.func_175924_b(worldIn, blockpos2.add(j3, 0, i4)); + } + } + } + + blockpos2 = blockpos2.up(); + + for (int k3 = -1; k3 <= 1; ++k3) + { + for (int j4 = -1; j4 <= 1; ++j4) + { + this.func_175924_b(worldIn, blockpos2.add(k3, 0, j4)); + } + } + + this.func_175924_b(worldIn, blockpos2.east(2)); + this.func_175924_b(worldIn, blockpos2.west(2)); + this.func_175924_b(worldIn, blockpos2.south(2)); + this.func_175924_b(worldIn, blockpos2.north(2)); + i3 = position.getX(); + j1 = position.getZ(); + EnumFacing enumfacing1 = EnumFacing.Plane.HORIZONTAL.random(rand); + + if (enumfacing1 != enumfacing) + { + int l3 = k2 - rand.nextInt(2) - 1; + int k4 = 1 + rand.nextInt(3); + k1 = 0; + + for (int l4 = l3; l4 < i && k4 > 0; --k4) + { + if (l4 >= 1) + { + int j2 = position.getY() + l4; + i3 += enumfacing1.getFrontOffsetX(); + j1 += enumfacing1.getFrontOffsetZ(); + BlockPos blockpos1 = new BlockPos(i3, j2, j1); + Material material1 = worldIn.getBlockState(blockpos1).getBlock().getMaterial(); + + if (material1 == Material.air || material1 == Material.leaves) + { + this.func_181642_b(worldIn, blockpos1); + k1 = j2; + } + } + + ++l4; + } + + if (k1 > 0) + { + BlockPos blockpos3 = new BlockPos(i3, k1, j1); + + for (int i5 = -2; i5 <= 2; ++i5) + { + for (int k5 = -2; k5 <= 2; ++k5) + { + if (Math.abs(i5) != 2 || Math.abs(k5) != 2) + { + this.func_175924_b(worldIn, blockpos3.add(i5, 0, k5)); + } + } + } + + blockpos3 = blockpos3.up(); + + for (int j5 = -1; j5 <= 1; ++j5) + { + for (int l5 = -1; l5 <= 1; ++l5) + { + this.func_175924_b(worldIn, blockpos3.add(j5, 0, l5)); + } + } + } + } + + return true; + } + else + { + return false; + } + } + } + else + { + return false; + } + } + + private void func_181642_b(World p_181642_1_, BlockPos p_181642_2_) + { + this.setBlockAndNotifyAdequately(p_181642_1_, p_181642_2_, field_181643_a); + } + + private void func_175924_b(World worldIn, BlockPos p_175924_2_) + { + Material material = worldIn.getBlockState(p_175924_2_).getBlock().getMaterial(); + + if (material == Material.air || material == Material.leaves) + { + this.setBlockAndNotifyAdequately(worldIn, p_175924_2_, field_181644_b); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java new file mode 100644 index 0000000..d7c1272 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java @@ -0,0 +1,68 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenShrub extends WorldGenTrees +{ + private final IBlockState leavesMetadata; + private final IBlockState woodMetadata; + + public WorldGenShrub(IBlockState p_i46450_1_, IBlockState p_i46450_2_) + { + super(false); + this.woodMetadata = p_i46450_1_; + this.leavesMetadata = p_i46450_2_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + Block block; + + while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) + { + position = position.down(); + } + + Block block1 = worldIn.getBlockState(position).getBlock(); + + if (block1 == Blocks.dirt || block1 == Blocks.grass) + { + position = position.up(); + this.setBlockAndNotifyAdequately(worldIn, position, this.woodMetadata); + + for (int i = position.getY(); i <= position.getY() + 2; ++i) + { + int j = i - position.getY(); + int k = 2 - j; + + for (int l = position.getX() - k; l <= position.getX() + k; ++l) + { + int i1 = l - position.getX(); + + for (int j1 = position.getZ() - k; j1 <= position.getZ() + k; ++j1) + { + int k1 = j1 - position.getZ(); + + if (Math.abs(i1) != k || Math.abs(k1) != k || rand.nextInt(2) != 0) + { + BlockPos blockpos = new BlockPos(l, i, j1); + + if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata); + } + } + } + } + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenSpikes.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenSpikes.java new file mode 100644 index 0000000..b712771 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenSpikes.java @@ -0,0 +1,70 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenSpikes extends WorldGenerator +{ + private Block baseBlockRequired; + + public WorldGenSpikes(Block p_i45464_1_) + { + this.baseBlockRequired = p_i45464_1_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + if (worldIn.isAirBlock(position) && worldIn.getBlockState(position.down()).getBlock() == this.baseBlockRequired) + { + int i = rand.nextInt(32) + 6; + int j = rand.nextInt(4) + 1; + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k = position.getX() - j; k <= position.getX() + j; ++k) + { + for (int l = position.getZ() - j; l <= position.getZ() + j; ++l) + { + int i1 = k - position.getX(); + int j1 = l - position.getZ(); + + if (i1 * i1 + j1 * j1 <= j * j + 1 && worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k, position.getY() - 1, l)).getBlock() != this.baseBlockRequired) + { + return false; + } + } + } + + for (int l1 = position.getY(); l1 < position.getY() + i && l1 < 256; ++l1) + { + for (int i2 = position.getX() - j; i2 <= position.getX() + j; ++i2) + { + for (int j2 = position.getZ() - j; j2 <= position.getZ() + j; ++j2) + { + int k2 = i2 - position.getX(); + int k1 = j2 - position.getZ(); + + if (k2 * k2 + k1 * k1 <= j * j + 1) + { + worldIn.setBlockState(new BlockPos(i2, l1, j2), Blocks.obsidian.getDefaultState(), 2); + } + } + } + } + + Entity entity = new EntityEnderCrystal(worldIn); + entity.setLocationAndAngles((double)((float)position.getX() + 0.5F), (double)(position.getY() + i), (double)((float)position.getZ() + 0.5F), rand.nextFloat() * 360.0F, 0.0F); + worldIn.spawnEntityInWorld(entity); + worldIn.setBlockState(position.up(i), Blocks.bedrock.getDefaultState(), 2); + return true; + } + else + { + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java new file mode 100644 index 0000000..c00cf78 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenSwamp.java @@ -0,0 +1,200 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockOldLeaf; +import net.minecraft.block.BlockOldLog; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.BlockVine; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenSwamp extends WorldGenAbstractTree +{ + private static final IBlockState field_181648_a = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK); + private static final IBlockState field_181649_b = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockOldLeaf.CHECK_DECAY, Boolean.valueOf(false)); + + public WorldGenSwamp() + { + super(false); + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + int i; + + for (i = rand.nextInt(4) + 5; worldIn.getBlockState(position.down()).getBlock().getMaterial() == Material.water; position = position.down()) + { + ; + } + + boolean flag = true; + + if (position.getY() >= 1 && position.getY() + i + 1 <= 256) + { + for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) + { + int k = 1; + + if (j == position.getY()) + { + k = 0; + } + + if (j >= position.getY() + 1 + i - 2) + { + k = 3; + } + + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) + { + for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) + { + if (j >= 0 && j < 256) + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock(); + + if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) + { + if (block != Blocks.water && block != Blocks.flowing_water) + { + flag = false; + } + else if (j > position.getY()) + { + flag = false; + } + } + } + else + { + flag = false; + } + } + } + } + + if (!flag) + { + return false; + } + else + { + Block block1 = worldIn.getBlockState(position.down()).getBlock(); + + if ((block1 == Blocks.grass || block1 == Blocks.dirt) && position.getY() < 256 - i - 1) + { + this.func_175921_a(worldIn, position.down()); + + for (int l1 = position.getY() - 3 + i; l1 <= position.getY() + i; ++l1) + { + int k2 = l1 - (position.getY() + i); + int i3 = 2 - k2 / 2; + + for (int k3 = position.getX() - i3; k3 <= position.getX() + i3; ++k3) + { + int l3 = k3 - position.getX(); + + for (int j1 = position.getZ() - i3; j1 <= position.getZ() + i3; ++j1) + { + int k1 = j1 - position.getZ(); + + if (Math.abs(l3) != i3 || Math.abs(k1) != i3 || rand.nextInt(2) != 0 && k2 != 0) + { + BlockPos blockpos = new BlockPos(k3, l1, j1); + + if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181649_b); + } + } + } + } + } + + for (int i2 = 0; i2 < i; ++i2) + { + Block block2 = worldIn.getBlockState(position.up(i2)).getBlock(); + + if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2 == Blocks.flowing_water || block2 == Blocks.water) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(i2), field_181648_a); + } + } + + for (int j2 = position.getY() - 3 + i; j2 <= position.getY() + i; ++j2) + { + int l2 = j2 - (position.getY() + i); + int j3 = 2 - l2 / 2; + BlockPos.MutableBlockPos blockpos$mutableblockpos1 = new BlockPos.MutableBlockPos(); + + for (int i4 = position.getX() - j3; i4 <= position.getX() + j3; ++i4) + { + for (int j4 = position.getZ() - j3; j4 <= position.getZ() + j3; ++j4) + { + blockpos$mutableblockpos1.func_181079_c(i4, j2, j4); + + if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) + { + BlockPos blockpos3 = blockpos$mutableblockpos1.west(); + BlockPos blockpos4 = blockpos$mutableblockpos1.east(); + BlockPos blockpos1 = blockpos$mutableblockpos1.north(); + BlockPos blockpos2 = blockpos$mutableblockpos1.south(); + + if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) + { + this.func_181647_a(worldIn, blockpos3, BlockVine.EAST); + } + + if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) + { + this.func_181647_a(worldIn, blockpos4, BlockVine.WEST); + } + + if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) + { + this.func_181647_a(worldIn, blockpos1, BlockVine.SOUTH); + } + + if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) + { + this.func_181647_a(worldIn, blockpos2, BlockVine.NORTH); + } + } + } + } + } + + return true; + } + else + { + return false; + } + } + } + else + { + return false; + } + } + + private void func_181647_a(World p_181647_1_, BlockPos p_181647_2_, PropertyBool p_181647_3_) + { + IBlockState iblockstate = Blocks.vine.getDefaultState().withProperty(p_181647_3_, Boolean.valueOf(true)); + this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); + int i = 4; + + for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().getMaterial() == Material.air && i > 0; --i) + { + this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate); + p_181647_2_ = p_181647_2_.down(); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java new file mode 100644 index 0000000..1946c0a --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga1.java @@ -0,0 +1,137 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockOldLeaf; +import net.minecraft.block.BlockOldLog; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenTaiga1 extends WorldGenAbstractTree +{ + private static final IBlockState field_181636_a = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE); + private static final IBlockState field_181637_b = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + + public WorldGenTaiga1() + { + super(false); + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + int i = rand.nextInt(5) + 7; + int j = i - rand.nextInt(2) - 3; + int k = i - j; + int l = 1 + rand.nextInt(k + 1); + boolean flag = true; + + if (position.getY() >= 1 && position.getY() + i + 1 <= 256) + { + for (int i1 = position.getY(); i1 <= position.getY() + 1 + i && flag; ++i1) + { + int j1 = 1; + + if (i1 - position.getY() < j) + { + j1 = 0; + } + else + { + j1 = l; + } + + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k1 = position.getX() - j1; k1 <= position.getX() + j1 && flag; ++k1) + { + for (int l1 = position.getZ() - j1; l1 <= position.getZ() + j1 && flag; ++l1) + { + if (i1 >= 0 && i1 < 256) + { + if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).getBlock())) + { + flag = false; + } + } + else + { + flag = false; + } + } + } + } + + if (!flag) + { + return false; + } + else + { + Block block = worldIn.getBlockState(position.down()).getBlock(); + + if ((block == Blocks.grass || block == Blocks.dirt) && position.getY() < 256 - i - 1) + { + this.func_175921_a(worldIn, position.down()); + int k2 = 0; + + for (int l2 = position.getY() + i; l2 >= position.getY() + j; --l2) + { + for (int j3 = position.getX() - k2; j3 <= position.getX() + k2; ++j3) + { + int k3 = j3 - position.getX(); + + for (int i2 = position.getZ() - k2; i2 <= position.getZ() + k2; ++i2) + { + int j2 = i2 - position.getZ(); + + if (Math.abs(k3) != k2 || Math.abs(j2) != k2 || k2 <= 0) + { + BlockPos blockpos = new BlockPos(j3, l2, i2); + + if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181637_b); + } + } + } + } + + if (k2 >= 1 && l2 == position.getY() + j + 1) + { + --k2; + } + else if (k2 < l) + { + ++k2; + } + } + + for (int i3 = 0; i3 < i - 1; ++i3) + { + Block block1 = worldIn.getBlockState(position.up(i3)).getBlock(); + + if (block1.getMaterial() == Material.air || block1.getMaterial() == Material.leaves) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(i3), field_181636_a); + } + } + + return true; + } + else + { + return false; + } + } + } + else + { + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java new file mode 100644 index 0000000..8ec9846 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenTaiga2.java @@ -0,0 +1,152 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockOldLeaf; +import net.minecraft.block.BlockOldLog; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenTaiga2 extends WorldGenAbstractTree +{ + private static final IBlockState field_181645_a = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE); + private static final IBlockState field_181646_b = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.SPRUCE).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + + public WorldGenTaiga2(boolean p_i2025_1_) + { + super(p_i2025_1_); + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + int i = rand.nextInt(4) + 6; + int j = 1 + rand.nextInt(2); + int k = i - j; + int l = 2 + rand.nextInt(2); + boolean flag = true; + + if (position.getY() >= 1 && position.getY() + i + 1 <= 256) + { + for (int i1 = position.getY(); i1 <= position.getY() + 1 + i && flag; ++i1) + { + int j1 = 1; + + if (i1 - position.getY() < j) + { + j1 = 0; + } + else + { + j1 = l; + } + + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k1 = position.getX() - j1; k1 <= position.getX() + j1 && flag; ++k1) + { + for (int l1 = position.getZ() - j1; l1 <= position.getZ() + j1 && flag; ++l1) + { + if (i1 >= 0 && i1 < 256) + { + Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).getBlock(); + + if (block.getMaterial() != Material.air && block.getMaterial() != Material.leaves) + { + flag = false; + } + } + else + { + flag = false; + } + } + } + } + + if (!flag) + { + return false; + } + else + { + Block block1 = worldIn.getBlockState(position.down()).getBlock(); + + if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) + { + this.func_175921_a(worldIn, position.down()); + int i3 = rand.nextInt(2); + int j3 = 1; + int k3 = 0; + + for (int l3 = 0; l3 <= k; ++l3) + { + int j4 = position.getY() + i - l3; + + for (int i2 = position.getX() - i3; i2 <= position.getX() + i3; ++i2) + { + int j2 = i2 - position.getX(); + + for (int k2 = position.getZ() - i3; k2 <= position.getZ() + i3; ++k2) + { + int l2 = k2 - position.getZ(); + + if (Math.abs(j2) != i3 || Math.abs(l2) != i3 || i3 <= 0) + { + BlockPos blockpos = new BlockPos(i2, j4, k2); + + if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, field_181646_b); + } + } + } + } + + if (i3 >= j3) + { + i3 = k3; + k3 = 1; + ++j3; + + if (j3 > l) + { + j3 = l; + } + } + else + { + ++i3; + } + } + + int i4 = rand.nextInt(3); + + for (int k4 = 0; k4 < i - i4; ++k4) + { + Block block2 = worldIn.getBlockState(position.up(k4)).getBlock(); + + if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(k4), field_181645_a); + } + } + + return true; + } + else + { + return false; + } + } + } + else + { + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java new file mode 100644 index 0000000..e1872ec --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenTallGrass.java @@ -0,0 +1,42 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenTallGrass extends WorldGenerator +{ + private final IBlockState tallGrassState; + + public WorldGenTallGrass(BlockTallGrass.EnumType p_i45629_1_) + { + this.tallGrassState = Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, p_i45629_1_); + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + Block block; + + while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) + { + position = position.down(); + } + + for (int i = 0; i < 128; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); + + if (worldIn.isAirBlock(blockpos) && Blocks.tallgrass.canBlockStay(worldIn, blockpos, this.tallGrassState)) + { + worldIn.setBlockState(blockpos, this.tallGrassState, 2); + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java new file mode 100644 index 0000000..0c6764e --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java @@ -0,0 +1,262 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockCocoa; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockOldLeaf; +import net.minecraft.block.BlockOldLog; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.BlockVine; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class WorldGenTrees extends WorldGenAbstractTree +{ + private static final IBlockState field_181653_a = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK); + private static final IBlockState field_181654_b = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + + /** The minimum height of a generated tree. */ + private final int minTreeHeight; + + /** True if this tree should grow Vines. */ + private final boolean vinesGrow; + + /** The metadata value of the wood to use in tree generation. */ + private final IBlockState metaWood; + + /** The metadata value of the leaves to use in tree generation. */ + private final IBlockState metaLeaves; + + public WorldGenTrees(boolean p_i2027_1_) + { + this(p_i2027_1_, 4, field_181653_a, field_181654_b, false); + } + + public WorldGenTrees(boolean p_i46446_1_, int p_i46446_2_, IBlockState p_i46446_3_, IBlockState p_i46446_4_, boolean p_i46446_5_) + { + super(p_i46446_1_); + this.minTreeHeight = p_i46446_2_; + this.metaWood = p_i46446_3_; + this.metaLeaves = p_i46446_4_; + this.vinesGrow = p_i46446_5_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + int i = rand.nextInt(3) + this.minTreeHeight; + boolean flag = true; + + if (position.getY() >= 1 && position.getY() + i + 1 <= 256) + { + for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) + { + int k = 1; + + if (j == position.getY()) + { + k = 0; + } + + if (j >= position.getY() + 1 + i - 2) + { + k = 2; + } + + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) + { + for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) + { + if (j >= 0 && j < 256) + { + if (!this.func_150523_a(worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, j, i1)).getBlock())) + { + flag = false; + } + } + else + { + flag = false; + } + } + } + } + + if (!flag) + { + return false; + } + else + { + Block block1 = worldIn.getBlockState(position.down()).getBlock(); + + if ((block1 == Blocks.grass || block1 == Blocks.dirt || block1 == Blocks.farmland) && position.getY() < 256 - i - 1) + { + this.func_175921_a(worldIn, position.down()); + int k2 = 3; + int l2 = 0; + + for (int i3 = position.getY() - k2 + i; i3 <= position.getY() + i; ++i3) + { + int i4 = i3 - (position.getY() + i); + int j1 = l2 + 1 - i4 / 2; + + for (int k1 = position.getX() - j1; k1 <= position.getX() + j1; ++k1) + { + int l1 = k1 - position.getX(); + + for (int i2 = position.getZ() - j1; i2 <= position.getZ() + j1; ++i2) + { + int j2 = i2 - position.getZ(); + + if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0) + { + BlockPos blockpos = new BlockPos(k1, i3, i2); + Block block = worldIn.getBlockState(blockpos).getBlock(); + + if (block.getMaterial() == Material.air || block.getMaterial() == Material.leaves || block.getMaterial() == Material.vine) + { + this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves); + } + } + } + } + } + + for (int j3 = 0; j3 < i; ++j3) + { + Block block2 = worldIn.getBlockState(position.up(j3)).getBlock(); + + if (block2.getMaterial() == Material.air || block2.getMaterial() == Material.leaves || block2.getMaterial() == Material.vine) + { + this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood); + + if (this.vinesGrow && j3 > 0) + { + if (rand.nextInt(3) > 0 && worldIn.isAirBlock(position.add(-1, j3, 0))) + { + this.func_181651_a(worldIn, position.add(-1, j3, 0), BlockVine.EAST); + } + + if (rand.nextInt(3) > 0 && worldIn.isAirBlock(position.add(1, j3, 0))) + { + this.func_181651_a(worldIn, position.add(1, j3, 0), BlockVine.WEST); + } + + if (rand.nextInt(3) > 0 && worldIn.isAirBlock(position.add(0, j3, -1))) + { + this.func_181651_a(worldIn, position.add(0, j3, -1), BlockVine.SOUTH); + } + + if (rand.nextInt(3) > 0 && worldIn.isAirBlock(position.add(0, j3, 1))) + { + this.func_181651_a(worldIn, position.add(0, j3, 1), BlockVine.NORTH); + } + } + } + } + + if (this.vinesGrow) + { + for (int k3 = position.getY() - 3 + i; k3 <= position.getY() + i; ++k3) + { + int j4 = k3 - (position.getY() + i); + int k4 = 2 - j4 / 2; + BlockPos.MutableBlockPos blockpos$mutableblockpos1 = new BlockPos.MutableBlockPos(); + + for (int l4 = position.getX() - k4; l4 <= position.getX() + k4; ++l4) + { + for (int i5 = position.getZ() - k4; i5 <= position.getZ() + k4; ++i5) + { + blockpos$mutableblockpos1.func_181079_c(l4, k3, i5); + + if (worldIn.getBlockState(blockpos$mutableblockpos1).getBlock().getMaterial() == Material.leaves) + { + BlockPos blockpos2 = blockpos$mutableblockpos1.west(); + BlockPos blockpos3 = blockpos$mutableblockpos1.east(); + BlockPos blockpos4 = blockpos$mutableblockpos1.north(); + BlockPos blockpos1 = blockpos$mutableblockpos1.south(); + + if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().getMaterial() == Material.air) + { + this.func_181650_b(worldIn, blockpos2, BlockVine.EAST); + } + + if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getBlock().getMaterial() == Material.air) + { + this.func_181650_b(worldIn, blockpos3, BlockVine.WEST); + } + + if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().getMaterial() == Material.air) + { + this.func_181650_b(worldIn, blockpos4, BlockVine.SOUTH); + } + + if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().getMaterial() == Material.air) + { + this.func_181650_b(worldIn, blockpos1, BlockVine.NORTH); + } + } + } + } + } + + if (rand.nextInt(5) == 0 && i > 5) + { + for (int l3 = 0; l3 < 2; ++l3) + { + for (Object enumfacing : EnumFacing.Plane.HORIZONTAL) + { + if (rand.nextInt(4 - l3) == 0) + { + EnumFacing enumfacing1 = ((EnumFacing) enumfacing).getOpposite(); + this.func_181652_a(worldIn, rand.nextInt(3), position.add(enumfacing1.getFrontOffsetX(), i - 5 + l3, enumfacing1.getFrontOffsetZ()), (EnumFacing) enumfacing); + } + } + } + } + } + + return true; + } + else + { + return false; + } + } + } + else + { + return false; + } + } + + private void func_181652_a(World p_181652_1_, int p_181652_2_, BlockPos p_181652_3_, EnumFacing p_181652_4_) + { + this.setBlockAndNotifyAdequately(p_181652_1_, p_181652_3_, Blocks.cocoa.getDefaultState().withProperty(BlockCocoa.AGE, Integer.valueOf(p_181652_2_)).withProperty(BlockCocoa.FACING, p_181652_4_)); + } + + private void func_181651_a(World p_181651_1_, BlockPos p_181651_2_, PropertyBool p_181651_3_) + { + this.setBlockAndNotifyAdequately(p_181651_1_, p_181651_2_, Blocks.vine.getDefaultState().withProperty(p_181651_3_, Boolean.valueOf(true))); + } + + private void func_181650_b(World p_181650_1_, BlockPos p_181650_2_, PropertyBool p_181650_3_) + { + this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); + int i = 4; + + for (p_181650_2_ = p_181650_2_.down(); p_181650_1_.getBlockState(p_181650_2_).getBlock().getMaterial() == Material.air && i > 0; --i) + { + this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_); + p_181650_2_ = p_181650_2_.down(); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenVines.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenVines.java new file mode 100644 index 0000000..f8aa294 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenVines.java @@ -0,0 +1,37 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.BlockVine; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class WorldGenVines extends WorldGenerator +{ + public boolean generate(World worldIn, Random rand, BlockPos position) + { + for (; position.getY() < 128; position = position.up()) + { + if (worldIn.isAirBlock(position)) + { + for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL.facings()) + { + if (Blocks.vine.canPlaceBlockOnSide(worldIn, position, enumfacing)) + { + IBlockState iblockstate = Blocks.vine.getDefaultState().withProperty(BlockVine.NORTH, Boolean.valueOf(enumfacing == EnumFacing.NORTH)).withProperty(BlockVine.EAST, Boolean.valueOf(enumfacing == EnumFacing.EAST)).withProperty(BlockVine.SOUTH, Boolean.valueOf(enumfacing == EnumFacing.SOUTH)).withProperty(BlockVine.WEST, Boolean.valueOf(enumfacing == EnumFacing.WEST)); + worldIn.setBlockState(position, iblockstate, 2); + break; + } + } + } + else + { + position = position.add(rand.nextInt(4) - rand.nextInt(4), 0, rand.nextInt(4) - rand.nextInt(4)); + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenWaterlily.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenWaterlily.java new file mode 100644 index 0000000..b0a43ee --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenWaterlily.java @@ -0,0 +1,26 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class WorldGenWaterlily extends WorldGenerator +{ + public boolean generate(World worldIn, Random rand, BlockPos position) + { + for (int i = 0; i < 10; ++i) + { + int j = position.getX() + rand.nextInt(8) - rand.nextInt(8); + int k = position.getY() + rand.nextInt(4) - rand.nextInt(4); + int l = position.getZ() + rand.nextInt(8) - rand.nextInt(8); + + if (worldIn.isAirBlock(new BlockPos(j, k, l)) && Blocks.waterlily.canPlaceBlockAt(worldIn, new BlockPos(j, k, l))) + { + worldIn.setBlockState(new BlockPos(j, k, l), Blocks.waterlily.getDefaultState(), 2); + } + } + + return true; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGenerator.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGenerator.java new file mode 100644 index 0000000..438bb62 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGenerator.java @@ -0,0 +1,43 @@ +package net.minecraft.world.gen.feature; + +import java.util.Random; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public abstract class WorldGenerator +{ + /** + * Sets wither or not the generator should notify blocks of blocks it changes. When the world is first generated, + * this is false, when saplings grow, this is true. + */ + private final boolean doBlockNotify; + + public WorldGenerator() + { + this(false); + } + + public WorldGenerator(boolean notify) + { + this.doBlockNotify = notify; + } + + public abstract boolean generate(World worldIn, Random rand, BlockPos position); + + public void func_175904_e() + { + } + + protected void setBlockAndNotifyAdequately(World worldIn, BlockPos pos, IBlockState state) + { + if (this.doBlockNotify) + { + worldIn.setBlockState(pos, state, 3); + } + else + { + worldIn.setBlockState(pos, state, 2); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java b/src/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java new file mode 100644 index 0000000..bd862a6 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/feature/WorldGeneratorBonusChest.java @@ -0,0 +1,92 @@ +package net.minecraft.world.gen.feature; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.BlockPos; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.world.World; + +public class WorldGeneratorBonusChest extends WorldGenerator +{ + private final List chestItems; + + /** + * Value of this int will determine how much items gonna generate in Bonus Chest. + */ + private final int itemsToGenerateInBonusChest; + + public WorldGeneratorBonusChest(List p_i45634_1_, int p_i45634_2_) + { + this.chestItems = p_i45634_1_; + this.itemsToGenerateInBonusChest = p_i45634_2_; + } + + public boolean generate(World worldIn, Random rand, BlockPos position) + { + Block block; + + while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 1) + { + position = position.down(); + } + + if (position.getY() < 1) + { + return false; + } + else + { + position = position.up(); + + for (int i = 0; i < 4; ++i) + { + BlockPos blockpos = position.add(rand.nextInt(4) - rand.nextInt(4), rand.nextInt(3) - rand.nextInt(3), rand.nextInt(4) - rand.nextInt(4)); + + if (worldIn.isAirBlock(blockpos) && World.doesBlockHaveSolidTopSurface(worldIn, blockpos.down())) + { + worldIn.setBlockState(blockpos, Blocks.chest.getDefaultState(), 2); + TileEntity tileentity = worldIn.getTileEntity(blockpos); + + if (tileentity instanceof TileEntityChest) + { + WeightedRandomChestContent.generateChestContents(rand, this.chestItems, (TileEntityChest)tileentity, this.itemsToGenerateInBonusChest); + } + + BlockPos blockpos1 = blockpos.east(); + BlockPos blockpos2 = blockpos.west(); + BlockPos blockpos3 = blockpos.north(); + BlockPos blockpos4 = blockpos.south(); + + if (worldIn.isAirBlock(blockpos2) && World.doesBlockHaveSolidTopSurface(worldIn, blockpos2.down())) + { + worldIn.setBlockState(blockpos2, Blocks.torch.getDefaultState(), 2); + } + + if (worldIn.isAirBlock(blockpos1) && World.doesBlockHaveSolidTopSurface(worldIn, blockpos1.down())) + { + worldIn.setBlockState(blockpos1, Blocks.torch.getDefaultState(), 2); + } + + if (worldIn.isAirBlock(blockpos3) && World.doesBlockHaveSolidTopSurface(worldIn, blockpos3.down())) + { + worldIn.setBlockState(blockpos3, Blocks.torch.getDefaultState(), 2); + } + + if (worldIn.isAirBlock(blockpos4) && World.doesBlockHaveSolidTopSurface(worldIn, blockpos4.down())) + { + worldIn.setBlockState(blockpos4, Blocks.torch.getDefaultState(), 2); + } + + return true; + } + } + + return false; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayer.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayer.java new file mode 100644 index 0000000..1540efe --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayer.java @@ -0,0 +1,239 @@ +package net.minecraft.world.gen.layer; + +import java.util.concurrent.Callable; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.util.ReportedException; +import net.minecraft.world.WorldType; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.ChunkProviderSettings; + +public abstract class GenLayer +{ + /** seed from World#getWorldSeed that is used in the LCG prng */ + private long worldGenSeed; + + /** parent GenLayer that was provided via the constructor */ + protected GenLayer parent; + + /** + * final part of the LCG prng that uses the chunk X, Z coords along with the other two seeds to generate + * pseudorandom numbers + */ + private long chunkSeed; + + /** base seed to the LCG prng provided via the constructor */ + protected long baseSeed; + + public static GenLayer[] initializeAllBiomeGenerators(long seed, WorldType p_180781_2_, String p_180781_3_) + { + GenLayer genlayer = new GenLayerIsland(1L); + genlayer = new GenLayerFuzzyZoom(2000L, genlayer); + GenLayerAddIsland genlayeraddisland = new GenLayerAddIsland(1L, genlayer); + GenLayerZoom genlayerzoom = new GenLayerZoom(2001L, genlayeraddisland); + GenLayerAddIsland genlayeraddisland1 = new GenLayerAddIsland(2L, genlayerzoom); + genlayeraddisland1 = new GenLayerAddIsland(50L, genlayeraddisland1); + genlayeraddisland1 = new GenLayerAddIsland(70L, genlayeraddisland1); + GenLayerRemoveTooMuchOcean genlayerremovetoomuchocean = new GenLayerRemoveTooMuchOcean(2L, genlayeraddisland1); + GenLayerAddSnow genlayeraddsnow = new GenLayerAddSnow(2L, genlayerremovetoomuchocean); + GenLayerAddIsland genlayeraddisland2 = new GenLayerAddIsland(3L, genlayeraddsnow); + GenLayerEdge genlayeredge = new GenLayerEdge(2L, genlayeraddisland2, GenLayerEdge.Mode.COOL_WARM); + genlayeredge = new GenLayerEdge(2L, genlayeredge, GenLayerEdge.Mode.HEAT_ICE); + genlayeredge = new GenLayerEdge(3L, genlayeredge, GenLayerEdge.Mode.SPECIAL); + GenLayerZoom genlayerzoom1 = new GenLayerZoom(2002L, genlayeredge); + genlayerzoom1 = new GenLayerZoom(2003L, genlayerzoom1); + GenLayerAddIsland genlayeraddisland3 = new GenLayerAddIsland(4L, genlayerzoom1); + GenLayerAddMushroomIsland genlayeraddmushroomisland = new GenLayerAddMushroomIsland(5L, genlayeraddisland3); + GenLayerDeepOcean genlayerdeepocean = new GenLayerDeepOcean(4L, genlayeraddmushroomisland); + GenLayer genlayer4 = GenLayerZoom.magnify(1000L, genlayerdeepocean, 0); + ChunkProviderSettings chunkprovidersettings = null; + int i = 4; + int j = i; + + if (p_180781_2_ == WorldType.CUSTOMIZED && p_180781_3_.length() > 0) + { + chunkprovidersettings = ChunkProviderSettings.Factory.jsonToFactory(p_180781_3_).func_177864_b(); + i = chunkprovidersettings.biomeSize; + j = chunkprovidersettings.riverSize; + } + + if (p_180781_2_ == WorldType.LARGE_BIOMES) + { + i = 6; + } + + GenLayer lvt_8_1_ = GenLayerZoom.magnify(1000L, genlayer4, 0); + GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, lvt_8_1_); + GenLayerBiome lvt_9_1_ = new GenLayerBiome(200L, genlayer4, p_180781_2_, p_180781_3_); + GenLayer genlayer6 = GenLayerZoom.magnify(1000L, lvt_9_1_, 2); + GenLayerBiomeEdge genlayerbiomeedge = new GenLayerBiomeEdge(1000L, genlayer6); + GenLayer lvt_10_1_ = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); + GenLayer genlayerhills = new GenLayerHills(1000L, genlayerbiomeedge, lvt_10_1_); + GenLayer genlayer5 = GenLayerZoom.magnify(1000L, genlayerriverinit, 2); + genlayer5 = GenLayerZoom.magnify(1000L, genlayer5, j); + GenLayerRiver genlayerriver = new GenLayerRiver(1L, genlayer5); + GenLayerSmooth genlayersmooth = new GenLayerSmooth(1000L, genlayerriver); + genlayerhills = new GenLayerRareBiome(1001L, genlayerhills); + + for (int k = 0; k < i; ++k) + { + genlayerhills = new GenLayerZoom((long)(1000 + k), genlayerhills); + + if (k == 0) + { + genlayerhills = new GenLayerAddIsland(3L, genlayerhills); + } + + if (k == 1 || i == 1) + { + genlayerhills = new GenLayerShore(1000L, genlayerhills); + } + } + + GenLayerSmooth genlayersmooth1 = new GenLayerSmooth(1000L, genlayerhills); + GenLayerRiverMix genlayerrivermix = new GenLayerRiverMix(100L, genlayersmooth1, genlayersmooth); + GenLayer genlayer3 = new GenLayerVoronoiZoom(10L, genlayerrivermix); + genlayerrivermix.initWorldGenSeed(seed); + genlayer3.initWorldGenSeed(seed); + return new GenLayer[] {genlayerrivermix, genlayer3, genlayerrivermix}; + } + + public GenLayer(long p_i2125_1_) + { + this.baseSeed = p_i2125_1_; + this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L; + this.baseSeed += p_i2125_1_; + this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L; + this.baseSeed += p_i2125_1_; + this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L; + this.baseSeed += p_i2125_1_; + } + + /** + * Initialize layer's local worldGenSeed based on its own baseSeed and the world's global seed (passed in as an + * argument). + */ + public void initWorldGenSeed(long seed) + { + this.worldGenSeed = seed; + + if (this.parent != null) + { + this.parent.initWorldGenSeed(seed); + } + + this.worldGenSeed *= this.worldGenSeed * 6364136223846793005L + 1442695040888963407L; + this.worldGenSeed += this.baseSeed; + this.worldGenSeed *= this.worldGenSeed * 6364136223846793005L + 1442695040888963407L; + this.worldGenSeed += this.baseSeed; + this.worldGenSeed *= this.worldGenSeed * 6364136223846793005L + 1442695040888963407L; + this.worldGenSeed += this.baseSeed; + } + + /** + * Initialize layer's current chunkSeed based on the local worldGenSeed and the (x,z) chunk coordinates. + */ + public void initChunkSeed(long p_75903_1_, long p_75903_3_) + { + this.chunkSeed = this.worldGenSeed; + this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; + this.chunkSeed += p_75903_1_; + this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; + this.chunkSeed += p_75903_3_; + this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; + this.chunkSeed += p_75903_1_; + this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; + this.chunkSeed += p_75903_3_; + } + + /** + * returns a LCG pseudo random number from [0, x). Args: int x + */ + protected int nextInt(int p_75902_1_) + { + int i = (int)((this.chunkSeed >> 24) % (long)p_75902_1_); + + if (i < 0) + { + i += p_75902_1_; + } + + this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; + this.chunkSeed += this.worldGenSeed; + return i; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public abstract int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight); + + protected static boolean biomesEqualOrMesaPlateau(int biomeIDA, int biomeIDB) + { + if (biomeIDA == biomeIDB) + { + return true; + } + else if (biomeIDA != BiomeGenBase.mesaPlateau_F.biomeID && biomeIDA != BiomeGenBase.mesaPlateau.biomeID) + { + final BiomeGenBase biomegenbase = BiomeGenBase.getBiome(biomeIDA); + final BiomeGenBase biomegenbase1 = BiomeGenBase.getBiome(biomeIDB); + + try + { + return biomegenbase != null && biomegenbase1 != null ? biomegenbase.isEqualTo(biomegenbase1) : false; + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Comparing biomes"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Biomes being compared"); + crashreportcategory.addCrashSection("Biome A ID", Integer.valueOf(biomeIDA)); + crashreportcategory.addCrashSection("Biome B ID", Integer.valueOf(biomeIDB)); + crashreportcategory.addCrashSectionCallable("Biome A", new Callable() + { + public String call() throws Exception + { + return String.valueOf((Object)biomegenbase); + } + }); + crashreportcategory.addCrashSectionCallable("Biome B", new Callable() + { + public String call() throws Exception + { + return String.valueOf((Object)biomegenbase1); + } + }); + throw new ReportedException(crashreport); + } + } + else + { + return biomeIDB == BiomeGenBase.mesaPlateau_F.biomeID || biomeIDB == BiomeGenBase.mesaPlateau.biomeID; + } + } + + /** + * returns true if the biomeId is one of the various ocean biomes. + */ + protected static boolean isBiomeOceanic(int p_151618_0_) + { + return p_151618_0_ == BiomeGenBase.ocean.biomeID || p_151618_0_ == BiomeGenBase.deepOcean.biomeID || p_151618_0_ == BiomeGenBase.frozenOcean.biomeID; + } + + /** + * selects a random integer from a set of provided integers + */ + protected int selectRandom(int... p_151619_1_) + { + return p_151619_1_[this.nextInt(p_151619_1_.length)]; + } + + /** + * returns the most frequently occurring number of the set, or a random number from those provided + */ + protected int selectModeOrRandom(int p_151617_1_, int p_151617_2_, int p_151617_3_, int p_151617_4_) + { + return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.selectRandom(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerAddIsland.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerAddIsland.java new file mode 100644 index 0000000..b5729d9 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerAddIsland.java @@ -0,0 +1,103 @@ +package net.minecraft.world.gen.layer; + +public class GenLayerAddIsland extends GenLayer +{ + public GenLayerAddIsland(long p_i2119_1_, GenLayer p_i2119_3_) + { + super(p_i2119_1_); + this.parent = p_i2119_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int i = areaX - 1; + int j = areaY - 1; + int k = areaWidth + 2; + int l = areaHeight + 2; + int[] aint = this.parent.getInts(i, j, k, l); + int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i1 = 0; i1 < areaHeight; ++i1) + { + for (int j1 = 0; j1 < areaWidth; ++j1) + { + int k1 = aint[j1 + 0 + (i1 + 0) * k]; + int l1 = aint[j1 + 2 + (i1 + 0) * k]; + int i2 = aint[j1 + 0 + (i1 + 2) * k]; + int j2 = aint[j1 + 2 + (i1 + 2) * k]; + int k2 = aint[j1 + 1 + (i1 + 1) * k]; + this.initChunkSeed((long)(j1 + areaX), (long)(i1 + areaY)); + + if (k2 != 0 || k1 == 0 && l1 == 0 && i2 == 0 && j2 == 0) + { + if (k2 > 0 && (k1 == 0 || l1 == 0 || i2 == 0 || j2 == 0)) + { + if (this.nextInt(5) == 0) + { + if (k2 == 4) + { + aint1[j1 + i1 * areaWidth] = 4; + } + else + { + aint1[j1 + i1 * areaWidth] = 0; + } + } + else + { + aint1[j1 + i1 * areaWidth] = k2; + } + } + else + { + aint1[j1 + i1 * areaWidth] = k2; + } + } + else + { + int l2 = 1; + int i3 = 1; + + if (k1 != 0 && this.nextInt(l2++) == 0) + { + i3 = k1; + } + + if (l1 != 0 && this.nextInt(l2++) == 0) + { + i3 = l1; + } + + if (i2 != 0 && this.nextInt(l2++) == 0) + { + i3 = i2; + } + + if (j2 != 0 && this.nextInt(l2++) == 0) + { + i3 = j2; + } + + if (this.nextInt(3) == 0) + { + aint1[j1 + i1 * areaWidth] = i3; + } + else if (i3 == 4) + { + aint1[j1 + i1 * areaWidth] = 4; + } + else + { + aint1[j1 + i1 * areaWidth] = 0; + } + } + } + } + + return aint1; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerAddMushroomIsland.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerAddMushroomIsland.java new file mode 100644 index 0000000..f1281ed --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerAddMushroomIsland.java @@ -0,0 +1,50 @@ +package net.minecraft.world.gen.layer; + +import net.minecraft.world.biome.BiomeGenBase; + +public class GenLayerAddMushroomIsland extends GenLayer +{ + public GenLayerAddMushroomIsland(long p_i2120_1_, GenLayer p_i2120_3_) + { + super(p_i2120_1_); + this.parent = p_i2120_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int i = areaX - 1; + int j = areaY - 1; + int k = areaWidth + 2; + int l = areaHeight + 2; + int[] aint = this.parent.getInts(i, j, k, l); + int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i1 = 0; i1 < areaHeight; ++i1) + { + for (int j1 = 0; j1 < areaWidth; ++j1) + { + int k1 = aint[j1 + 0 + (i1 + 0) * k]; + int l1 = aint[j1 + 2 + (i1 + 0) * k]; + int i2 = aint[j1 + 0 + (i1 + 2) * k]; + int j2 = aint[j1 + 2 + (i1 + 2) * k]; + int k2 = aint[j1 + 1 + (i1 + 1) * k]; + this.initChunkSeed((long)(j1 + areaX), (long)(i1 + areaY)); + + if (k2 == 0 && k1 == 0 && l1 == 0 && i2 == 0 && j2 == 0 && this.nextInt(100) == 0) + { + aint1[j1 + i1 * areaWidth] = BiomeGenBase.mushroomIsland.biomeID; + } + else + { + aint1[j1 + i1 * areaWidth] = k2; + } + } + } + + return aint1; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerAddSnow.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerAddSnow.java new file mode 100644 index 0000000..8438a51 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerAddSnow.java @@ -0,0 +1,59 @@ +package net.minecraft.world.gen.layer; + +public class GenLayerAddSnow extends GenLayer +{ + public GenLayerAddSnow(long p_i2121_1_, GenLayer p_i2121_3_) + { + super(p_i2121_1_); + this.parent = p_i2121_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int i = areaX - 1; + int j = areaY - 1; + int k = areaWidth + 2; + int l = areaHeight + 2; + int[] aint = this.parent.getInts(i, j, k, l); + int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i1 = 0; i1 < areaHeight; ++i1) + { + for (int j1 = 0; j1 < areaWidth; ++j1) + { + int k1 = aint[j1 + 1 + (i1 + 1) * k]; + this.initChunkSeed((long)(j1 + areaX), (long)(i1 + areaY)); + + if (k1 == 0) + { + aint1[j1 + i1 * areaWidth] = 0; + } + else + { + int l1 = this.nextInt(6); + + if (l1 == 0) + { + l1 = 4; + } + else if (l1 <= 1) + { + l1 = 3; + } + else + { + l1 = 1; + } + + aint1[j1 + i1 * areaWidth] = l1; + } + } + } + + return aint1; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java new file mode 100644 index 0000000..97c7681 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerBiome.java @@ -0,0 +1,118 @@ +package net.minecraft.world.gen.layer; + +import net.minecraft.world.WorldType; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.ChunkProviderSettings; + +public class GenLayerBiome extends GenLayer +{ + private BiomeGenBase[] field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.desert, BiomeGenBase.savanna, BiomeGenBase.savanna, BiomeGenBase.plains}; + private BiomeGenBase[] field_151621_d = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.roofedForest, BiomeGenBase.extremeHills, BiomeGenBase.plains, BiomeGenBase.birchForest, BiomeGenBase.swampland}; + private BiomeGenBase[] field_151622_e = new BiomeGenBase[] {BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.taiga, BiomeGenBase.plains}; + private BiomeGenBase[] field_151620_f = new BiomeGenBase[] {BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.icePlains, BiomeGenBase.coldTaiga}; + private final ChunkProviderSettings field_175973_g; + + public GenLayerBiome(long p_i45560_1_, GenLayer p_i45560_3_, WorldType p_i45560_4_, String p_i45560_5_) + { + super(p_i45560_1_); + this.parent = p_i45560_3_; + + if (p_i45560_4_ == WorldType.DEFAULT_1_1) + { + this.field_151623_c = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga}; + this.field_175973_g = null; + } + else if (p_i45560_4_ == WorldType.CUSTOMIZED) + { + this.field_175973_g = ChunkProviderSettings.Factory.jsonToFactory(p_i45560_5_).func_177864_b(); + } + else + { + this.field_175973_g = null; + } + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int[] aint = this.parent.getInts(areaX, areaY, areaWidth, areaHeight); + int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i = 0; i < areaHeight; ++i) + { + for (int j = 0; j < areaWidth; ++j) + { + this.initChunkSeed((long)(j + areaX), (long)(i + areaY)); + int k = aint[j + i * areaWidth]; + int l = (k & 3840) >> 8; + k = k & -3841; + + if (this.field_175973_g != null && this.field_175973_g.fixedBiome >= 0) + { + aint1[j + i * areaWidth] = this.field_175973_g.fixedBiome; + } + else if (isBiomeOceanic(k)) + { + aint1[j + i * areaWidth] = k; + } + else if (k == BiomeGenBase.mushroomIsland.biomeID) + { + aint1[j + i * areaWidth] = k; + } + else if (k == 1) + { + if (l > 0) + { + if (this.nextInt(3) == 0) + { + aint1[j + i * areaWidth] = BiomeGenBase.mesaPlateau.biomeID; + } + else + { + aint1[j + i * areaWidth] = BiomeGenBase.mesaPlateau_F.biomeID; + } + } + else + { + aint1[j + i * areaWidth] = this.field_151623_c[this.nextInt(this.field_151623_c.length)].biomeID; + } + } + else if (k == 2) + { + if (l > 0) + { + aint1[j + i * areaWidth] = BiomeGenBase.jungle.biomeID; + } + else + { + aint1[j + i * areaWidth] = this.field_151621_d[this.nextInt(this.field_151621_d.length)].biomeID; + } + } + else if (k == 3) + { + if (l > 0) + { + aint1[j + i * areaWidth] = BiomeGenBase.megaTaiga.biomeID; + } + else + { + aint1[j + i * areaWidth] = this.field_151622_e[this.nextInt(this.field_151622_e.length)].biomeID; + } + } + else if (k == 4) + { + aint1[j + i * areaWidth] = this.field_151620_f[this.nextInt(this.field_151620_f.length)].biomeID; + } + else + { + aint1[j + i * areaWidth] = BiomeGenBase.mushroomIsland.biomeID; + } + } + } + + return aint1; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerBiomeEdge.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerBiomeEdge.java new file mode 100644 index 0000000..a1491d2 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerBiomeEdge.java @@ -0,0 +1,166 @@ +package net.minecraft.world.gen.layer; + +import net.minecraft.world.biome.BiomeGenBase; + +public class GenLayerBiomeEdge extends GenLayer +{ + public GenLayerBiomeEdge(long p_i45475_1_, GenLayer p_i45475_3_) + { + super(p_i45475_1_); + this.parent = p_i45475_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int[] aint = this.parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2); + int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i = 0; i < areaHeight; ++i) + { + for (int j = 0; j < areaWidth; ++j) + { + this.initChunkSeed((long)(j + areaX), (long)(i + areaY)); + int k = aint[j + 1 + (i + 1) * (areaWidth + 2)]; + + if (!this.replaceBiomeEdgeIfNecessary(aint, aint1, j, i, areaWidth, k, BiomeGenBase.extremeHills.biomeID, BiomeGenBase.extremeHillsEdge.biomeID) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, BiomeGenBase.mesaPlateau_F.biomeID, BiomeGenBase.mesa.biomeID) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, BiomeGenBase.mesaPlateau.biomeID, BiomeGenBase.mesa.biomeID) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, BiomeGenBase.megaTaiga.biomeID, BiomeGenBase.taiga.biomeID)) + { + if (k == BiomeGenBase.desert.biomeID) + { + int l1 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; + int i2 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; + int j2 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; + int k2 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; + + if (l1 != BiomeGenBase.icePlains.biomeID && i2 != BiomeGenBase.icePlains.biomeID && j2 != BiomeGenBase.icePlains.biomeID && k2 != BiomeGenBase.icePlains.biomeID) + { + aint1[j + i * areaWidth] = k; + } + else + { + aint1[j + i * areaWidth] = BiomeGenBase.extremeHillsPlus.biomeID; + } + } + else if (k == BiomeGenBase.swampland.biomeID) + { + int l = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; + int i1 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; + int j1 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; + int k1 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; + + if (l != BiomeGenBase.desert.biomeID && i1 != BiomeGenBase.desert.biomeID && j1 != BiomeGenBase.desert.biomeID && k1 != BiomeGenBase.desert.biomeID && l != BiomeGenBase.coldTaiga.biomeID && i1 != BiomeGenBase.coldTaiga.biomeID && j1 != BiomeGenBase.coldTaiga.biomeID && k1 != BiomeGenBase.coldTaiga.biomeID && l != BiomeGenBase.icePlains.biomeID && i1 != BiomeGenBase.icePlains.biomeID && j1 != BiomeGenBase.icePlains.biomeID && k1 != BiomeGenBase.icePlains.biomeID) + { + if (l != BiomeGenBase.jungle.biomeID && k1 != BiomeGenBase.jungle.biomeID && i1 != BiomeGenBase.jungle.biomeID && j1 != BiomeGenBase.jungle.biomeID) + { + aint1[j + i * areaWidth] = k; + } + else + { + aint1[j + i * areaWidth] = BiomeGenBase.jungleEdge.biomeID; + } + } + else + { + aint1[j + i * areaWidth] = BiomeGenBase.plains.biomeID; + } + } + else + { + aint1[j + i * areaWidth] = k; + } + } + } + } + + return aint1; + } + + /** + * Creates a border around a biome if necessary, e.g. A transition from hot to cold climates would otherwise occur. + */ + private boolean replaceBiomeEdgeIfNecessary(int[] p_151636_1_, int[] p_151636_2_, int p_151636_3_, int p_151636_4_, int p_151636_5_, int p_151636_6_, int p_151636_7_, int p_151636_8_) + { + if (!biomesEqualOrMesaPlateau(p_151636_6_, p_151636_7_)) + { + return false; + } + else + { + int i = p_151636_1_[p_151636_3_ + 1 + (p_151636_4_ + 1 - 1) * (p_151636_5_ + 2)]; + int j = p_151636_1_[p_151636_3_ + 1 + 1 + (p_151636_4_ + 1) * (p_151636_5_ + 2)]; + int k = p_151636_1_[p_151636_3_ + 1 - 1 + (p_151636_4_ + 1) * (p_151636_5_ + 2)]; + int l = p_151636_1_[p_151636_3_ + 1 + (p_151636_4_ + 1 + 1) * (p_151636_5_ + 2)]; + + if (this.canBiomesBeNeighbors(i, p_151636_7_) && this.canBiomesBeNeighbors(j, p_151636_7_) && this.canBiomesBeNeighbors(k, p_151636_7_) && this.canBiomesBeNeighbors(l, p_151636_7_)) + { + p_151636_2_[p_151636_3_ + p_151636_4_ * p_151636_5_] = p_151636_6_; + } + else + { + p_151636_2_[p_151636_3_ + p_151636_4_ * p_151636_5_] = p_151636_8_; + } + + return true; + } + } + + /** + * Creates a border around a biome. + */ + private boolean replaceBiomeEdge(int[] p_151635_1_, int[] p_151635_2_, int p_151635_3_, int p_151635_4_, int p_151635_5_, int p_151635_6_, int p_151635_7_, int p_151635_8_) + { + if (p_151635_6_ != p_151635_7_) + { + return false; + } + else + { + int i = p_151635_1_[p_151635_3_ + 1 + (p_151635_4_ + 1 - 1) * (p_151635_5_ + 2)]; + int j = p_151635_1_[p_151635_3_ + 1 + 1 + (p_151635_4_ + 1) * (p_151635_5_ + 2)]; + int k = p_151635_1_[p_151635_3_ + 1 - 1 + (p_151635_4_ + 1) * (p_151635_5_ + 2)]; + int l = p_151635_1_[p_151635_3_ + 1 + (p_151635_4_ + 1 + 1) * (p_151635_5_ + 2)]; + + if (biomesEqualOrMesaPlateau(i, p_151635_7_) && biomesEqualOrMesaPlateau(j, p_151635_7_) && biomesEqualOrMesaPlateau(k, p_151635_7_) && biomesEqualOrMesaPlateau(l, p_151635_7_)) + { + p_151635_2_[p_151635_3_ + p_151635_4_ * p_151635_5_] = p_151635_6_; + } + else + { + p_151635_2_[p_151635_3_ + p_151635_4_ * p_151635_5_] = p_151635_8_; + } + + return true; + } + } + + /** + * Returns if two biomes can logically be neighbors. If one is hot and the other cold, for example, it returns + * false. + */ + private boolean canBiomesBeNeighbors(int p_151634_1_, int p_151634_2_) + { + if (biomesEqualOrMesaPlateau(p_151634_1_, p_151634_2_)) + { + return true; + } + else + { + BiomeGenBase biomegenbase = BiomeGenBase.getBiome(p_151634_1_); + BiomeGenBase biomegenbase1 = BiomeGenBase.getBiome(p_151634_2_); + + if (biomegenbase != null && biomegenbase1 != null) + { + BiomeGenBase.TempCategory biomegenbase$tempcategory = biomegenbase.getTempCategory(); + BiomeGenBase.TempCategory biomegenbase$tempcategory1 = biomegenbase1.getTempCategory(); + return biomegenbase$tempcategory == biomegenbase$tempcategory1 || biomegenbase$tempcategory == BiomeGenBase.TempCategory.MEDIUM || biomegenbase$tempcategory1 == BiomeGenBase.TempCategory.MEDIUM; + } + else + { + return false; + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerDeepOcean.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerDeepOcean.java new file mode 100644 index 0000000..0e38db1 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerDeepOcean.java @@ -0,0 +1,70 @@ +package net.minecraft.world.gen.layer; + +import net.minecraft.world.biome.BiomeGenBase; + +public class GenLayerDeepOcean extends GenLayer +{ + public GenLayerDeepOcean(long p_i45472_1_, GenLayer p_i45472_3_) + { + super(p_i45472_1_); + this.parent = p_i45472_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int i = areaX - 1; + int j = areaY - 1; + int k = areaWidth + 2; + int l = areaHeight + 2; + int[] aint = this.parent.getInts(i, j, k, l); + int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i1 = 0; i1 < areaHeight; ++i1) + { + for (int j1 = 0; j1 < areaWidth; ++j1) + { + int k1 = aint[j1 + 1 + (i1 + 1 - 1) * (areaWidth + 2)]; + int l1 = aint[j1 + 1 + 1 + (i1 + 1) * (areaWidth + 2)]; + int i2 = aint[j1 + 1 - 1 + (i1 + 1) * (areaWidth + 2)]; + int j2 = aint[j1 + 1 + (i1 + 1 + 1) * (areaWidth + 2)]; + int k2 = aint[j1 + 1 + (i1 + 1) * k]; + int l2 = 0; + + if (k1 == 0) + { + ++l2; + } + + if (l1 == 0) + { + ++l2; + } + + if (i2 == 0) + { + ++l2; + } + + if (j2 == 0) + { + ++l2; + } + + if (k2 == 0 && l2 > 3) + { + aint1[j1 + i1 * areaWidth] = BiomeGenBase.deepOcean.biomeID; + } + else + { + aint1[j1 + i1 * areaWidth] = k2; + } + } + } + + return aint1; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerEdge.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerEdge.java new file mode 100644 index 0000000..84c335f --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerEdge.java @@ -0,0 +1,139 @@ +package net.minecraft.world.gen.layer; + +public class GenLayerEdge extends GenLayer +{ + private final GenLayerEdge.Mode field_151627_c; + + public GenLayerEdge(long p_i45474_1_, GenLayer p_i45474_3_, GenLayerEdge.Mode p_i45474_4_) + { + super(p_i45474_1_); + this.parent = p_i45474_3_; + this.field_151627_c = p_i45474_4_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + switch (this.field_151627_c) + { + case COOL_WARM: + default: + return this.getIntsCoolWarm(areaX, areaY, areaWidth, areaHeight); + + case HEAT_ICE: + return this.getIntsHeatIce(areaX, areaY, areaWidth, areaHeight); + + case SPECIAL: + return this.getIntsSpecial(areaX, areaY, areaWidth, areaHeight); + } + } + + private int[] getIntsCoolWarm(int p_151626_1_, int p_151626_2_, int p_151626_3_, int p_151626_4_) + { + int i = p_151626_1_ - 1; + int j = p_151626_2_ - 1; + int k = 1 + p_151626_3_ + 1; + int l = 1 + p_151626_4_ + 1; + int[] aint = this.parent.getInts(i, j, k, l); + int[] aint1 = IntCache.getIntCache(p_151626_3_ * p_151626_4_); + + for (int i1 = 0; i1 < p_151626_4_; ++i1) + { + for (int j1 = 0; j1 < p_151626_3_; ++j1) + { + this.initChunkSeed((long)(j1 + p_151626_1_), (long)(i1 + p_151626_2_)); + int k1 = aint[j1 + 1 + (i1 + 1) * k]; + + if (k1 == 1) + { + int l1 = aint[j1 + 1 + (i1 + 1 - 1) * k]; + int i2 = aint[j1 + 1 + 1 + (i1 + 1) * k]; + int j2 = aint[j1 + 1 - 1 + (i1 + 1) * k]; + int k2 = aint[j1 + 1 + (i1 + 1 + 1) * k]; + boolean flag = l1 == 3 || i2 == 3 || j2 == 3 || k2 == 3; + boolean flag1 = l1 == 4 || i2 == 4 || j2 == 4 || k2 == 4; + + if (flag || flag1) + { + k1 = 2; + } + } + + aint1[j1 + i1 * p_151626_3_] = k1; + } + } + + return aint1; + } + + private int[] getIntsHeatIce(int p_151624_1_, int p_151624_2_, int p_151624_3_, int p_151624_4_) + { + int i = p_151624_1_ - 1; + int j = p_151624_2_ - 1; + int k = 1 + p_151624_3_ + 1; + int l = 1 + p_151624_4_ + 1; + int[] aint = this.parent.getInts(i, j, k, l); + int[] aint1 = IntCache.getIntCache(p_151624_3_ * p_151624_4_); + + for (int i1 = 0; i1 < p_151624_4_; ++i1) + { + for (int j1 = 0; j1 < p_151624_3_; ++j1) + { + int k1 = aint[j1 + 1 + (i1 + 1) * k]; + + if (k1 == 4) + { + int l1 = aint[j1 + 1 + (i1 + 1 - 1) * k]; + int i2 = aint[j1 + 1 + 1 + (i1 + 1) * k]; + int j2 = aint[j1 + 1 - 1 + (i1 + 1) * k]; + int k2 = aint[j1 + 1 + (i1 + 1 + 1) * k]; + boolean flag = l1 == 2 || i2 == 2 || j2 == 2 || k2 == 2; + boolean flag1 = l1 == 1 || i2 == 1 || j2 == 1 || k2 == 1; + + if (flag1 || flag) + { + k1 = 3; + } + } + + aint1[j1 + i1 * p_151624_3_] = k1; + } + } + + return aint1; + } + + private int[] getIntsSpecial(int p_151625_1_, int p_151625_2_, int p_151625_3_, int p_151625_4_) + { + int[] aint = this.parent.getInts(p_151625_1_, p_151625_2_, p_151625_3_, p_151625_4_); + int[] aint1 = IntCache.getIntCache(p_151625_3_ * p_151625_4_); + + for (int i = 0; i < p_151625_4_; ++i) + { + for (int j = 0; j < p_151625_3_; ++j) + { + this.initChunkSeed((long)(j + p_151625_1_), (long)(i + p_151625_2_)); + int k = aint[j + i * p_151625_3_]; + + if (k != 0 && this.nextInt(13) == 0) + { + k |= 1 + this.nextInt(15) << 8 & 3840; + } + + aint1[j + i * p_151625_3_] = k; + } + } + + return aint1; + } + + public static enum Mode + { + COOL_WARM, + HEAT_ICE, + SPECIAL; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerFuzzyZoom.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerFuzzyZoom.java new file mode 100644 index 0000000..f95eed8 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerFuzzyZoom.java @@ -0,0 +1,17 @@ +package net.minecraft.world.gen.layer; + +public class GenLayerFuzzyZoom extends GenLayerZoom +{ + public GenLayerFuzzyZoom(long p_i2123_1_, GenLayer p_i2123_3_) + { + super(p_i2123_1_, p_i2123_3_); + } + + /** + * returns the most frequently occurring number of the set, or a random number from those provided + */ + protected int selectModeOrRandom(int p_151617_1_, int p_151617_2_, int p_151617_3_, int p_151617_4_) + { + return this.selectRandom(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_}); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerHills.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerHills.java new file mode 100644 index 0000000..65833b2 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerHills.java @@ -0,0 +1,198 @@ +package net.minecraft.world.gen.layer; + +import net.minecraft.world.biome.BiomeGenBase; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class GenLayerHills extends GenLayer +{ + private static final Logger logger = LogManager.getLogger(); + private GenLayer field_151628_d; + + public GenLayerHills(long p_i45479_1_, GenLayer p_i45479_3_, GenLayer p_i45479_4_) + { + super(p_i45479_1_); + this.parent = p_i45479_3_; + this.field_151628_d = p_i45479_4_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int[] aint = this.parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2); + int[] aint1 = this.field_151628_d.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2); + int[] aint2 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i = 0; i < areaHeight; ++i) + { + for (int j = 0; j < areaWidth; ++j) + { + this.initChunkSeed((long)(j + areaX), (long)(i + areaY)); + int k = aint[j + 1 + (i + 1) * (areaWidth + 2)]; + int l = aint1[j + 1 + (i + 1) * (areaWidth + 2)]; + boolean flag = (l - 2) % 29 == 0; + + if (k > 255) + { + logger.debug("old! " + k); + } + + if (k != 0 && l >= 2 && (l - 2) % 29 == 1 && k < 128) + { + if (BiomeGenBase.getBiome(k + 128) != null) + { + aint2[j + i * areaWidth] = k + 128; + } + else + { + aint2[j + i * areaWidth] = k; + } + } + else if (this.nextInt(3) != 0 && !flag) + { + aint2[j + i * areaWidth] = k; + } + else + { + int i1 = k; + + if (k == BiomeGenBase.desert.biomeID) + { + i1 = BiomeGenBase.desertHills.biomeID; + } + else if (k == BiomeGenBase.forest.biomeID) + { + i1 = BiomeGenBase.forestHills.biomeID; + } + else if (k == BiomeGenBase.birchForest.biomeID) + { + i1 = BiomeGenBase.birchForestHills.biomeID; + } + else if (k == BiomeGenBase.roofedForest.biomeID) + { + i1 = BiomeGenBase.plains.biomeID; + } + else if (k == BiomeGenBase.taiga.biomeID) + { + i1 = BiomeGenBase.taigaHills.biomeID; + } + else if (k == BiomeGenBase.megaTaiga.biomeID) + { + i1 = BiomeGenBase.megaTaigaHills.biomeID; + } + else if (k == BiomeGenBase.coldTaiga.biomeID) + { + i1 = BiomeGenBase.coldTaigaHills.biomeID; + } + else if (k == BiomeGenBase.plains.biomeID) + { + if (this.nextInt(3) == 0) + { + i1 = BiomeGenBase.forestHills.biomeID; + } + else + { + i1 = BiomeGenBase.forest.biomeID; + } + } + else if (k == BiomeGenBase.icePlains.biomeID) + { + i1 = BiomeGenBase.iceMountains.biomeID; + } + else if (k == BiomeGenBase.jungle.biomeID) + { + i1 = BiomeGenBase.jungleHills.biomeID; + } + else if (k == BiomeGenBase.ocean.biomeID) + { + i1 = BiomeGenBase.deepOcean.biomeID; + } + else if (k == BiomeGenBase.extremeHills.biomeID) + { + i1 = BiomeGenBase.extremeHillsPlus.biomeID; + } + else if (k == BiomeGenBase.savanna.biomeID) + { + i1 = BiomeGenBase.savannaPlateau.biomeID; + } + else if (biomesEqualOrMesaPlateau(k, BiomeGenBase.mesaPlateau_F.biomeID)) + { + i1 = BiomeGenBase.mesa.biomeID; + } + else if (k == BiomeGenBase.deepOcean.biomeID && this.nextInt(3) == 0) + { + int j1 = this.nextInt(2); + + if (j1 == 0) + { + i1 = BiomeGenBase.plains.biomeID; + } + else + { + i1 = BiomeGenBase.forest.biomeID; + } + } + + if (flag && i1 != k) + { + if (BiomeGenBase.getBiome(i1 + 128) != null) + { + i1 += 128; + } + else + { + i1 = k; + } + } + + if (i1 == k) + { + aint2[j + i * areaWidth] = k; + } + else + { + int k2 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; + int k1 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; + int l1 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; + int i2 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; + int j2 = 0; + + if (biomesEqualOrMesaPlateau(k2, k)) + { + ++j2; + } + + if (biomesEqualOrMesaPlateau(k1, k)) + { + ++j2; + } + + if (biomesEqualOrMesaPlateau(l1, k)) + { + ++j2; + } + + if (biomesEqualOrMesaPlateau(i2, k)) + { + ++j2; + } + + if (j2 >= 3) + { + aint2[j + i * areaWidth] = i1; + } + else + { + aint2[j + i * areaWidth] = k; + } + } + } + } + } + + return aint2; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerIsland.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerIsland.java new file mode 100644 index 0000000..e9d4393 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerIsland.java @@ -0,0 +1,34 @@ +package net.minecraft.world.gen.layer; + +public class GenLayerIsland extends GenLayer +{ + public GenLayerIsland(long p_i2124_1_) + { + super(p_i2124_1_); + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int[] aint = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i = 0; i < areaHeight; ++i) + { + for (int j = 0; j < areaWidth; ++j) + { + this.initChunkSeed((long)(areaX + j), (long)(areaY + i)); + aint[j + i * areaWidth] = this.nextInt(10) == 0 ? 1 : 0; + } + } + + if (areaX > -areaWidth && areaX <= 0 && areaY > -areaHeight && areaY <= 0) + { + aint[-areaX + -areaY * areaWidth] = 1; + } + + return aint; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerRareBiome.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerRareBiome.java new file mode 100644 index 0000000..c6127a1 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerRareBiome.java @@ -0,0 +1,49 @@ +package net.minecraft.world.gen.layer; + +import net.minecraft.world.biome.BiomeGenBase; + +public class GenLayerRareBiome extends GenLayer +{ + public GenLayerRareBiome(long p_i45478_1_, GenLayer p_i45478_3_) + { + super(p_i45478_1_); + this.parent = p_i45478_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int[] aint = this.parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2); + int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i = 0; i < areaHeight; ++i) + { + for (int j = 0; j < areaWidth; ++j) + { + this.initChunkSeed((long)(j + areaX), (long)(i + areaY)); + int k = aint[j + 1 + (i + 1) * (areaWidth + 2)]; + + if (this.nextInt(57) == 0) + { + if (k == BiomeGenBase.plains.biomeID) + { + aint1[j + i * areaWidth] = BiomeGenBase.plains.biomeID + 128; + } + else + { + aint1[j + i * areaWidth] = k; + } + } + else + { + aint1[j + i * areaWidth] = k; + } + } + } + + return aint1; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerRemoveTooMuchOcean.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerRemoveTooMuchOcean.java new file mode 100644 index 0000000..0b96053 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerRemoveTooMuchOcean.java @@ -0,0 +1,45 @@ +package net.minecraft.world.gen.layer; + +public class GenLayerRemoveTooMuchOcean extends GenLayer +{ + public GenLayerRemoveTooMuchOcean(long p_i45480_1_, GenLayer p_i45480_3_) + { + super(p_i45480_1_); + this.parent = p_i45480_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int i = areaX - 1; + int j = areaY - 1; + int k = areaWidth + 2; + int l = areaHeight + 2; + int[] aint = this.parent.getInts(i, j, k, l); + int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i1 = 0; i1 < areaHeight; ++i1) + { + for (int j1 = 0; j1 < areaWidth; ++j1) + { + int k1 = aint[j1 + 1 + (i1 + 1 - 1) * (areaWidth + 2)]; + int l1 = aint[j1 + 1 + 1 + (i1 + 1) * (areaWidth + 2)]; + int i2 = aint[j1 + 1 - 1 + (i1 + 1) * (areaWidth + 2)]; + int j2 = aint[j1 + 1 + (i1 + 1 + 1) * (areaWidth + 2)]; + int k2 = aint[j1 + 1 + (i1 + 1) * k]; + aint1[j1 + i1 * areaWidth] = k2; + this.initChunkSeed((long)(j1 + areaX), (long)(i1 + areaY)); + + if (k2 == 0 && k1 == 0 && l1 == 0 && i2 == 0 && j2 == 0 && this.nextInt(2) == 0) + { + aint1[j1 + i1 * areaWidth] = 1; + } + } + } + + return aint1; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerRiver.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerRiver.java new file mode 100644 index 0000000..f96f9b7 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerRiver.java @@ -0,0 +1,54 @@ +package net.minecraft.world.gen.layer; + +import net.minecraft.world.biome.BiomeGenBase; + +public class GenLayerRiver extends GenLayer +{ + public GenLayerRiver(long p_i2128_1_, GenLayer p_i2128_3_) + { + super(p_i2128_1_); + super.parent = p_i2128_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int i = areaX - 1; + int j = areaY - 1; + int k = areaWidth + 2; + int l = areaHeight + 2; + int[] aint = this.parent.getInts(i, j, k, l); + int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i1 = 0; i1 < areaHeight; ++i1) + { + for (int j1 = 0; j1 < areaWidth; ++j1) + { + int k1 = this.func_151630_c(aint[j1 + 0 + (i1 + 1) * k]); + int l1 = this.func_151630_c(aint[j1 + 2 + (i1 + 1) * k]); + int i2 = this.func_151630_c(aint[j1 + 1 + (i1 + 0) * k]); + int j2 = this.func_151630_c(aint[j1 + 1 + (i1 + 2) * k]); + int k2 = this.func_151630_c(aint[j1 + 1 + (i1 + 1) * k]); + + if (k2 == k1 && k2 == i2 && k2 == l1 && k2 == j2) + { + aint1[j1 + i1 * areaWidth] = -1; + } + else + { + aint1[j1 + i1 * areaWidth] = BiomeGenBase.river.biomeID; + } + } + } + + return aint1; + } + + private int func_151630_c(int p_151630_1_) + { + return p_151630_1_ >= 2 ? 2 + (p_151630_1_ & 1) : p_151630_1_; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerRiverInit.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerRiverInit.java new file mode 100644 index 0000000..04844da --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerRiverInit.java @@ -0,0 +1,31 @@ +package net.minecraft.world.gen.layer; + +public class GenLayerRiverInit extends GenLayer +{ + public GenLayerRiverInit(long p_i2127_1_, GenLayer p_i2127_3_) + { + super(p_i2127_1_); + this.parent = p_i2127_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int[] aint = this.parent.getInts(areaX, areaY, areaWidth, areaHeight); + int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i = 0; i < areaHeight; ++i) + { + for (int j = 0; j < areaWidth; ++j) + { + this.initChunkSeed((long)(j + areaX), (long)(i + areaY)); + aint1[j + i * areaWidth] = aint[j + i * areaWidth] > 0 ? this.nextInt(299999) + 2 : 0; + } + } + + return aint1; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerRiverMix.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerRiverMix.java new file mode 100644 index 0000000..e64924a --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerRiverMix.java @@ -0,0 +1,70 @@ +package net.minecraft.world.gen.layer; + +import net.minecraft.world.biome.BiomeGenBase; + +public class GenLayerRiverMix extends GenLayer +{ + private GenLayer biomePatternGeneratorChain; + private GenLayer riverPatternGeneratorChain; + + public GenLayerRiverMix(long p_i2129_1_, GenLayer p_i2129_3_, GenLayer p_i2129_4_) + { + super(p_i2129_1_); + this.biomePatternGeneratorChain = p_i2129_3_; + this.riverPatternGeneratorChain = p_i2129_4_; + } + + /** + * Initialize layer's local worldGenSeed based on its own baseSeed and the world's global seed (passed in as an + * argument). + */ + public void initWorldGenSeed(long seed) + { + this.biomePatternGeneratorChain.initWorldGenSeed(seed); + this.riverPatternGeneratorChain.initWorldGenSeed(seed); + super.initWorldGenSeed(seed); + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int[] aint = this.biomePatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight); + int[] aint1 = this.riverPatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight); + int[] aint2 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i = 0; i < areaWidth * areaHeight; ++i) + { + if (aint[i] != BiomeGenBase.ocean.biomeID && aint[i] != BiomeGenBase.deepOcean.biomeID) + { + if (aint1[i] == BiomeGenBase.river.biomeID) + { + if (aint[i] == BiomeGenBase.icePlains.biomeID) + { + aint2[i] = BiomeGenBase.frozenRiver.biomeID; + } + else if (aint[i] != BiomeGenBase.mushroomIsland.biomeID && aint[i] != BiomeGenBase.mushroomIslandShore.biomeID) + { + aint2[i] = aint1[i] & 255; + } + else + { + aint2[i] = BiomeGenBase.mushroomIslandShore.biomeID; + } + } + else + { + aint2[i] = aint[i]; + } + } + else + { + aint2[i] = aint[i]; + } + } + + return aint2; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerShore.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerShore.java new file mode 100644 index 0000000..6f646d9 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerShore.java @@ -0,0 +1,167 @@ +package net.minecraft.world.gen.layer; + +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.BiomeGenJungle; +import net.minecraft.world.biome.BiomeGenMesa; + +public class GenLayerShore extends GenLayer +{ + public GenLayerShore(long p_i2130_1_, GenLayer p_i2130_3_) + { + super(p_i2130_1_); + this.parent = p_i2130_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int[] aint = this.parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2); + int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i = 0; i < areaHeight; ++i) + { + for (int j = 0; j < areaWidth; ++j) + { + this.initChunkSeed((long)(j + areaX), (long)(i + areaY)); + int k = aint[j + 1 + (i + 1) * (areaWidth + 2)]; + BiomeGenBase biomegenbase = BiomeGenBase.getBiome(k); + + if (k == BiomeGenBase.mushroomIsland.biomeID) + { + int j2 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; + int i3 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; + int l3 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; + int k4 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; + + if (j2 != BiomeGenBase.ocean.biomeID && i3 != BiomeGenBase.ocean.biomeID && l3 != BiomeGenBase.ocean.biomeID && k4 != BiomeGenBase.ocean.biomeID) + { + aint1[j + i * areaWidth] = k; + } + else + { + aint1[j + i * areaWidth] = BiomeGenBase.mushroomIslandShore.biomeID; + } + } + else if (biomegenbase != null && biomegenbase.getBiomeClass() == BiomeGenJungle.class) + { + int i2 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; + int l2 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; + int k3 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; + int j4 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; + + if (this.func_151631_c(i2) && this.func_151631_c(l2) && this.func_151631_c(k3) && this.func_151631_c(j4)) + { + if (!isBiomeOceanic(i2) && !isBiomeOceanic(l2) && !isBiomeOceanic(k3) && !isBiomeOceanic(j4)) + { + aint1[j + i * areaWidth] = k; + } + else + { + aint1[j + i * areaWidth] = BiomeGenBase.beach.biomeID; + } + } + else + { + aint1[j + i * areaWidth] = BiomeGenBase.jungleEdge.biomeID; + } + } + else if (k != BiomeGenBase.extremeHills.biomeID && k != BiomeGenBase.extremeHillsPlus.biomeID && k != BiomeGenBase.extremeHillsEdge.biomeID) + { + if (biomegenbase != null && biomegenbase.isSnowyBiome()) + { + this.func_151632_a(aint, aint1, j, i, areaWidth, k, BiomeGenBase.coldBeach.biomeID); + } + else if (k != BiomeGenBase.mesa.biomeID && k != BiomeGenBase.mesaPlateau_F.biomeID) + { + if (k != BiomeGenBase.ocean.biomeID && k != BiomeGenBase.deepOcean.biomeID && k != BiomeGenBase.river.biomeID && k != BiomeGenBase.swampland.biomeID) + { + int l1 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; + int k2 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; + int j3 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; + int i4 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; + + if (!isBiomeOceanic(l1) && !isBiomeOceanic(k2) && !isBiomeOceanic(j3) && !isBiomeOceanic(i4)) + { + aint1[j + i * areaWidth] = k; + } + else + { + aint1[j + i * areaWidth] = BiomeGenBase.beach.biomeID; + } + } + else + { + aint1[j + i * areaWidth] = k; + } + } + else + { + int l = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; + int i1 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; + int j1 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; + int k1 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; + + if (!isBiomeOceanic(l) && !isBiomeOceanic(i1) && !isBiomeOceanic(j1) && !isBiomeOceanic(k1)) + { + if (this.func_151633_d(l) && this.func_151633_d(i1) && this.func_151633_d(j1) && this.func_151633_d(k1)) + { + aint1[j + i * areaWidth] = k; + } + else + { + aint1[j + i * areaWidth] = BiomeGenBase.desert.biomeID; + } + } + else + { + aint1[j + i * areaWidth] = k; + } + } + } + else + { + this.func_151632_a(aint, aint1, j, i, areaWidth, k, BiomeGenBase.stoneBeach.biomeID); + } + } + } + + return aint1; + } + + private void func_151632_a(int[] p_151632_1_, int[] p_151632_2_, int p_151632_3_, int p_151632_4_, int p_151632_5_, int p_151632_6_, int p_151632_7_) + { + if (isBiomeOceanic(p_151632_6_)) + { + p_151632_2_[p_151632_3_ + p_151632_4_ * p_151632_5_] = p_151632_6_; + } + else + { + int i = p_151632_1_[p_151632_3_ + 1 + (p_151632_4_ + 1 - 1) * (p_151632_5_ + 2)]; + int j = p_151632_1_[p_151632_3_ + 1 + 1 + (p_151632_4_ + 1) * (p_151632_5_ + 2)]; + int k = p_151632_1_[p_151632_3_ + 1 - 1 + (p_151632_4_ + 1) * (p_151632_5_ + 2)]; + int l = p_151632_1_[p_151632_3_ + 1 + (p_151632_4_ + 1 + 1) * (p_151632_5_ + 2)]; + + if (!isBiomeOceanic(i) && !isBiomeOceanic(j) && !isBiomeOceanic(k) && !isBiomeOceanic(l)) + { + p_151632_2_[p_151632_3_ + p_151632_4_ * p_151632_5_] = p_151632_6_; + } + else + { + p_151632_2_[p_151632_3_ + p_151632_4_ * p_151632_5_] = p_151632_7_; + } + } + } + + private boolean func_151631_c(int p_151631_1_) + { + return BiomeGenBase.getBiome(p_151631_1_) != null && BiomeGenBase.getBiome(p_151631_1_).getBiomeClass() == BiomeGenJungle.class ? true : p_151631_1_ == BiomeGenBase.jungleEdge.biomeID || p_151631_1_ == BiomeGenBase.jungle.biomeID || p_151631_1_ == BiomeGenBase.jungleHills.biomeID || p_151631_1_ == BiomeGenBase.forest.biomeID || p_151631_1_ == BiomeGenBase.taiga.biomeID || isBiomeOceanic(p_151631_1_); + } + + private boolean func_151633_d(int p_151633_1_) + { + return BiomeGenBase.getBiome(p_151633_1_) instanceof BiomeGenMesa; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerSmooth.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerSmooth.java new file mode 100644 index 0000000..4a94d29 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerSmooth.java @@ -0,0 +1,66 @@ +package net.minecraft.world.gen.layer; + +public class GenLayerSmooth extends GenLayer +{ + public GenLayerSmooth(long p_i2131_1_, GenLayer p_i2131_3_) + { + super(p_i2131_1_); + super.parent = p_i2131_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int i = areaX - 1; + int j = areaY - 1; + int k = areaWidth + 2; + int l = areaHeight + 2; + int[] aint = this.parent.getInts(i, j, k, l); + int[] aint1 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int i1 = 0; i1 < areaHeight; ++i1) + { + for (int j1 = 0; j1 < areaWidth; ++j1) + { + int k1 = aint[j1 + 0 + (i1 + 1) * k]; + int l1 = aint[j1 + 2 + (i1 + 1) * k]; + int i2 = aint[j1 + 1 + (i1 + 0) * k]; + int j2 = aint[j1 + 1 + (i1 + 2) * k]; + int k2 = aint[j1 + 1 + (i1 + 1) * k]; + + if (k1 == l1 && i2 == j2) + { + this.initChunkSeed((long)(j1 + areaX), (long)(i1 + areaY)); + + if (this.nextInt(2) == 0) + { + k2 = k1; + } + else + { + k2 = i2; + } + } + else + { + if (k1 == l1) + { + k2 = k1; + } + + if (i2 == j2) + { + k2 = i2; + } + } + + aint1[j1 + i1 * areaWidth] = k2; + } + } + + return aint1; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerVoronoiZoom.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerVoronoiZoom.java new file mode 100644 index 0000000..e1ace18 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerVoronoiZoom.java @@ -0,0 +1,95 @@ +package net.minecraft.world.gen.layer; + +public class GenLayerVoronoiZoom extends GenLayer +{ + public GenLayerVoronoiZoom(long p_i2133_1_, GenLayer p_i2133_3_) + { + super(p_i2133_1_); + super.parent = p_i2133_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + areaX = areaX - 2; + areaY = areaY - 2; + int i = areaX >> 2; + int j = areaY >> 2; + int k = (areaWidth >> 2) + 2; + int l = (areaHeight >> 2) + 2; + int[] aint = this.parent.getInts(i, j, k, l); + int i1 = k - 1 << 2; + int j1 = l - 1 << 2; + int[] aint1 = IntCache.getIntCache(i1 * j1); + + for (int k1 = 0; k1 < l - 1; ++k1) + { + int l1 = 0; + int i2 = aint[l1 + 0 + (k1 + 0) * k]; + + for (int j2 = aint[l1 + 0 + (k1 + 1) * k]; l1 < k - 1; ++l1) + { + double d0 = 3.6D; + this.initChunkSeed((long)(l1 + i << 2), (long)(k1 + j << 2)); + double d1 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D; + double d2 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D; + this.initChunkSeed((long)(l1 + i + 1 << 2), (long)(k1 + j << 2)); + double d3 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D; + double d4 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D; + this.initChunkSeed((long)(l1 + i << 2), (long)(k1 + j + 1 << 2)); + double d5 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D; + double d6 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D; + this.initChunkSeed((long)(l1 + i + 1 << 2), (long)(k1 + j + 1 << 2)); + double d7 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D; + double d8 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * 3.6D + 4.0D; + int k2 = aint[l1 + 1 + (k1 + 0) * k] & 255; + int l2 = aint[l1 + 1 + (k1 + 1) * k] & 255; + + for (int i3 = 0; i3 < 4; ++i3) + { + int j3 = ((k1 << 2) + i3) * i1 + (l1 << 2); + + for (int k3 = 0; k3 < 4; ++k3) + { + double d9 = ((double)i3 - d2) * ((double)i3 - d2) + ((double)k3 - d1) * ((double)k3 - d1); + double d10 = ((double)i3 - d4) * ((double)i3 - d4) + ((double)k3 - d3) * ((double)k3 - d3); + double d11 = ((double)i3 - d6) * ((double)i3 - d6) + ((double)k3 - d5) * ((double)k3 - d5); + double d12 = ((double)i3 - d8) * ((double)i3 - d8) + ((double)k3 - d7) * ((double)k3 - d7); + + if (d9 < d10 && d9 < d11 && d9 < d12) + { + aint1[j3++] = i2; + } + else if (d10 < d9 && d10 < d11 && d10 < d12) + { + aint1[j3++] = k2; + } + else if (d11 < d9 && d11 < d10 && d11 < d12) + { + aint1[j3++] = j2; + } + else + { + aint1[j3++] = l2; + } + } + } + + i2 = k2; + j2 = l2; + } + } + + int[] aint2 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int l3 = 0; l3 < areaHeight; ++l3) + { + System.arraycopy(aint1, (l3 + (areaY & 3)) * i1 + (areaX & 3), aint2, l3 * areaWidth, areaWidth); + } + + return aint2; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/GenLayerZoom.java b/src/minecraft/net/minecraft/world/gen/layer/GenLayerZoom.java new file mode 100644 index 0000000..5e09b54 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/GenLayerZoom.java @@ -0,0 +1,70 @@ +package net.minecraft.world.gen.layer; + +public class GenLayerZoom extends GenLayer +{ + public GenLayerZoom(long p_i2134_1_, GenLayer p_i2134_3_) + { + super(p_i2134_1_); + super.parent = p_i2134_3_; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) + { + int i = areaX >> 1; + int j = areaY >> 1; + int k = (areaWidth >> 1) + 2; + int l = (areaHeight >> 1) + 2; + int[] aint = this.parent.getInts(i, j, k, l); + int i1 = k - 1 << 1; + int j1 = l - 1 << 1; + int[] aint1 = IntCache.getIntCache(i1 * j1); + + for (int k1 = 0; k1 < l - 1; ++k1) + { + int l1 = (k1 << 1) * i1; + int i2 = 0; + int j2 = aint[i2 + 0 + (k1 + 0) * k]; + + for (int k2 = aint[i2 + 0 + (k1 + 1) * k]; i2 < k - 1; ++i2) + { + this.initChunkSeed((long)(i2 + i << 1), (long)(k1 + j << 1)); + int l2 = aint[i2 + 1 + (k1 + 0) * k]; + int i3 = aint[i2 + 1 + (k1 + 1) * k]; + aint1[l1] = j2; + aint1[l1++ + i1] = this.selectRandom(new int[] {j2, k2}); + aint1[l1] = this.selectRandom(new int[] {j2, l2}); + aint1[l1++ + i1] = this.selectModeOrRandom(j2, l2, k2, i3); + j2 = l2; + k2 = i3; + } + } + + int[] aint2 = IntCache.getIntCache(areaWidth * areaHeight); + + for (int j3 = 0; j3 < areaHeight; ++j3) + { + System.arraycopy(aint1, (j3 + (areaY & 1)) * i1 + (areaX & 1), aint2, j3 * areaWidth, areaWidth); + } + + return aint2; + } + + /** + * Magnify a layer. Parms are seed adjustment, layer, number of times to magnify + */ + public static GenLayer magnify(long p_75915_0_, GenLayer p_75915_2_, int p_75915_3_) + { + GenLayer genlayer = p_75915_2_; + + for (int i = 0; i < p_75915_3_; ++i) + { + genlayer = new GenLayerZoom(p_75915_0_ + (long)i, genlayer); + } + + return genlayer; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/layer/IntCache.java b/src/minecraft/net/minecraft/world/gen/layer/IntCache.java new file mode 100644 index 0000000..4793b41 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/layer/IntCache.java @@ -0,0 +1,85 @@ +package net.minecraft.world.gen.layer; + +import com.google.common.collect.Lists; +import java.util.List; + +public class IntCache +{ + private static int intCacheSize = 256; + private static List freeSmallArrays = Lists.newArrayList(); + private static List inUseSmallArrays = Lists.newArrayList(); + private static List freeLargeArrays = Lists.newArrayList(); + private static List inUseLargeArrays = Lists.newArrayList(); + + public static synchronized int[] getIntCache(int p_76445_0_) + { + if (p_76445_0_ <= 256) + { + if (freeSmallArrays.isEmpty()) + { + int[] aint4 = new int[256]; + inUseSmallArrays.add(aint4); + return aint4; + } + else + { + int[] aint3 = (int[])freeSmallArrays.remove(freeSmallArrays.size() - 1); + inUseSmallArrays.add(aint3); + return aint3; + } + } + else if (p_76445_0_ > intCacheSize) + { + intCacheSize = p_76445_0_; + freeLargeArrays.clear(); + inUseLargeArrays.clear(); + int[] aint2 = new int[intCacheSize]; + inUseLargeArrays.add(aint2); + return aint2; + } + else if (freeLargeArrays.isEmpty()) + { + int[] aint1 = new int[intCacheSize]; + inUseLargeArrays.add(aint1); + return aint1; + } + else + { + int[] aint = (int[])freeLargeArrays.remove(freeLargeArrays.size() - 1); + inUseLargeArrays.add(aint); + return aint; + } + } + + /** + * Mark all pre-allocated arrays as available for re-use by moving them to the appropriate free lists. + */ + + public static synchronized void resetIntCache() + { + if (!freeLargeArrays.isEmpty()) + { + freeLargeArrays.remove(freeLargeArrays.size() - 1); + } + + if (!freeSmallArrays.isEmpty()) + { + freeSmallArrays.remove(freeSmallArrays.size() - 1); + } + + freeLargeArrays.addAll(inUseLargeArrays); + freeSmallArrays.addAll(inUseSmallArrays); + inUseLargeArrays.clear(); + inUseSmallArrays.clear(); + } + + /** + * Gets a human-readable string that indicates the sizes of all the cache fields. Basically a synchronized static + * toString. + */ + + public static synchronized String getCacheSizes() + { + return "cache: " + freeLargeArrays.size() + ", tcache: " + freeSmallArrays.size() + ", allocated: " + inUseLargeArrays.size() + ", tallocated: " + inUseSmallArrays.size(); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java b/src/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java new file mode 100644 index 0000000..7ee8a49 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/ComponentScatteredFeaturePieces.java @@ -0,0 +1,702 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Random; +import net.minecraft.block.BlockFlowerPot; +import net.minecraft.block.BlockLever; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.BlockSandStone; +import net.minecraft.block.BlockStoneBrick; +import net.minecraft.block.BlockStoneSlab; +import net.minecraft.block.BlockTripWire; +import net.minecraft.block.BlockTripWireHook; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.monster.EntityWitch; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.world.World; + +public class ComponentScatteredFeaturePieces +{ + public static void registerScatteredFeaturePieces() + { + MapGenStructureIO.registerStructureComponent(ComponentScatteredFeaturePieces.DesertPyramid.class, "TeDP"); + MapGenStructureIO.registerStructureComponent(ComponentScatteredFeaturePieces.JunglePyramid.class, "TeJP"); + MapGenStructureIO.registerStructureComponent(ComponentScatteredFeaturePieces.SwampHut.class, "TeSH"); + } + + public static class DesertPyramid extends ComponentScatteredFeaturePieces.Feature + { + private boolean[] field_74940_h = new boolean[4]; + private static final List itemsToGenerateInTemple = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 3), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10), new WeightedRandomChestContent(Items.gold_ingot, 0, 2, 7, 15), new WeightedRandomChestContent(Items.emerald, 0, 1, 3, 2), new WeightedRandomChestContent(Items.bone, 0, 4, 6, 20), new WeightedRandomChestContent(Items.rotten_flesh, 0, 3, 7, 16), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 3), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 1), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 1), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 1)}); + + public DesertPyramid() + { + } + + public DesertPyramid(Random p_i2062_1_, int p_i2062_2_, int p_i2062_3_) + { + super(p_i2062_1_, p_i2062_2_, 64, p_i2062_3_, 21, 15, 21); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("hasPlacedChest0", this.field_74940_h[0]); + tagCompound.setBoolean("hasPlacedChest1", this.field_74940_h[1]); + tagCompound.setBoolean("hasPlacedChest2", this.field_74940_h[2]); + tagCompound.setBoolean("hasPlacedChest3", this.field_74940_h[3]); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.field_74940_h[0] = tagCompound.getBoolean("hasPlacedChest0"); + this.field_74940_h[1] = tagCompound.getBoolean("hasPlacedChest1"); + this.field_74940_h[2] = tagCompound.getBoolean("hasPlacedChest2"); + this.field_74940_h[3] = tagCompound.getBoolean("hasPlacedChest3"); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, -4, 0, this.scatteredFeatureSizeX - 1, 0, this.scatteredFeatureSizeZ - 1, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + + for (int i = 1; i <= 9; ++i) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, i, i, i, this.scatteredFeatureSizeX - 1 - i, i, this.scatteredFeatureSizeZ - 1 - i, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, i + 1, i, i + 1, this.scatteredFeatureSizeX - 2 - i, i, this.scatteredFeatureSizeZ - 2 - i, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + for (int j2 = 0; j2 < this.scatteredFeatureSizeX; ++j2) + { + for (int j = 0; j < this.scatteredFeatureSizeZ; ++j) + { + int k = -5; + this.replaceAirAndLiquidDownwards(worldIn, Blocks.sandstone.getDefaultState(), j2, k, j, structureBoundingBoxIn); + } + } + + int k2 = this.getMetadataWithOffset(Blocks.sandstone_stairs, 3); + int l2 = this.getMetadataWithOffset(Blocks.sandstone_stairs, 2); + int i3 = this.getMetadataWithOffset(Blocks.sandstone_stairs, 0); + int l = this.getMetadataWithOffset(Blocks.sandstone_stairs, 1); + int i1 = ~EnumDyeColor.ORANGE.getDyeDamage() & 15; + int j1 = ~EnumDyeColor.BLUE.getDyeDamage() & 15; + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 9, 4, Blocks.sandstone.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 10, 1, 3, 10, 3, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(k2), 2, 10, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(l2), 2, 10, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(i3), 0, 10, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(l), 4, 10, 2, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 5, 0, 0, this.scatteredFeatureSizeX - 1, 9, 4, Blocks.sandstone.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 4, 10, 1, this.scatteredFeatureSizeX - 2, 10, 3, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(k2), this.scatteredFeatureSizeX - 3, 10, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(l2), this.scatteredFeatureSizeX - 3, 10, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(i3), this.scatteredFeatureSizeX - 5, 10, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(l), this.scatteredFeatureSizeX - 1, 10, 2, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 0, 0, 12, 4, 4, Blocks.sandstone.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 1, 0, 11, 3, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 9, 1, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 9, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 9, 3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 10, 3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 11, 3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 11, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 11, 1, 1, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 8, 3, 3, Blocks.sandstone.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 2, 8, 2, 2, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, 1, 16, 3, 3, Blocks.sandstone.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, 2, 16, 2, 2, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 4, 5, this.scatteredFeatureSizeX - 6, 4, this.scatteredFeatureSizeZ - 6, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 4, 9, 11, 4, 11, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 8, 8, 3, 8, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, 8, 12, 3, 8, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 12, 8, 3, 12, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, 12, 12, 3, 12, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 5, 4, 4, 11, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 5, 1, 5, this.scatteredFeatureSizeX - 2, 4, 11, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 7, 9, 6, 7, 11, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 7, 7, 9, this.scatteredFeatureSizeX - 7, 7, 11, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, 9, 5, 7, 11, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 6, 5, 9, this.scatteredFeatureSizeX - 6, 7, 11, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 5, 5, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 5, 6, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 6, 6, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), this.scatteredFeatureSizeX - 6, 5, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), this.scatteredFeatureSizeX - 6, 6, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), this.scatteredFeatureSizeX - 7, 6, 10, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 4, 4, 2, 6, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 3, 4, 4, this.scatteredFeatureSizeX - 3, 6, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(k2), 2, 4, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(k2), 2, 3, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(k2), this.scatteredFeatureSizeX - 3, 4, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(k2), this.scatteredFeatureSizeX - 3, 3, 4, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 3, 2, 2, 3, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 3, 1, 3, this.scatteredFeatureSizeX - 2, 2, 3, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getDefaultState(), 1, 1, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getDefaultState(), this.scatteredFeatureSizeX - 2, 1, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.SAND.getMetadata()), 1, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.SAND.getMetadata()), this.scatteredFeatureSizeX - 2, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(l), 2, 1, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone_stairs.getStateFromMeta(i3), this.scatteredFeatureSizeX - 3, 1, 2, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 3, 5, 4, 3, 18, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 5, 3, 5, this.scatteredFeatureSizeX - 5, 3, 17, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 5, 4, 2, 16, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.scatteredFeatureSizeX - 6, 1, 5, this.scatteredFeatureSizeX - 5, 2, 16, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + + for (int k1 = 5; k1 <= 17; k1 += 2) + { + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 4, 1, k1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), 4, 2, k1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), this.scatteredFeatureSizeX - 5, 1, k1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), this.scatteredFeatureSizeX - 5, 2, k1, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 10, 0, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 10, 0, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 9, 0, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 11, 0, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 8, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 12, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 7, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 13, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 9, 0, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 11, 0, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 10, 0, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 10, 0, 13, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(j1), 10, 0, 10, structureBoundingBoxIn); + + for (int j3 = 0; j3 <= this.scatteredFeatureSizeX - 1; j3 += this.scatteredFeatureSizeX - 1) + { + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 3, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 3, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 4, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), j3, 4, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 4, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 5, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 5, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 5, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 6, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), j3, 6, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 6, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 7, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 7, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), j3, 7, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 8, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 8, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), j3, 8, 3, structureBoundingBoxIn); + } + + for (int k3 = 2; k3 <= this.scatteredFeatureSizeX - 3; k3 += this.scatteredFeatureSizeX - 3 - 2) + { + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 - 1, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 + 1, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 - 1, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 + 1, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3 - 1, 4, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), k3, 4, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3 + 1, 4, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 - 1, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 + 1, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3 - 1, 6, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), k3, 6, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3 + 1, 6, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3 - 1, 7, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3, 7, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), k3 + 1, 7, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 - 1, 8, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3, 8, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), k3 + 1, 8, 0, structureBoundingBoxIn); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 4, 0, 12, 6, 0, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 8, 6, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 12, 6, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 9, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), 10, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stained_hardened_clay.getStateFromMeta(i1), 11, 5, 0, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, -14, 8, 12, -11, 12, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, -10, 8, 12, -10, 12, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, -9, 8, 12, -9, 12, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, -8, 8, 12, -1, 12, Blocks.sandstone.getDefaultState(), Blocks.sandstone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, -11, 9, 11, -1, 11, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.stone_pressure_plate.getDefaultState(), 10, -11, 10, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, -13, 9, 11, -13, 11, Blocks.tnt.getDefaultState(), Blocks.air.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 8, -11, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 8, -10, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), 7, -10, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 7, -11, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 12, -11, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 12, -10, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), 13, -10, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 13, -11, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 10, -11, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 10, -10, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), 10, -10, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 10, -11, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 10, -11, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 10, -10, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.CHISELED.getMetadata()), 10, -10, 13, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()), 10, -11, 13, structureBoundingBoxIn); + + for (Object enumfacing0 : EnumFacing.Plane.HORIZONTAL) + { + EnumFacing enumfacing = (EnumFacing) enumfacing0; + + if (!this.field_74940_h[enumfacing.getHorizontalIndex()]) + { + int l1 = enumfacing.getFrontOffsetX() * 2; + int i2 = enumfacing.getFrontOffsetZ() * 2; + this.field_74940_h[enumfacing.getHorizontalIndex()] = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 10 + l1, -11, 10 + i2, WeightedRandomChestContent.func_177629_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); + } + } + + return true; + } + } + + abstract static class Feature extends StructureComponent + { + protected int scatteredFeatureSizeX; + protected int scatteredFeatureSizeY; + protected int scatteredFeatureSizeZ; + protected int field_74936_d = -1; + + public Feature() + { + } + + protected Feature(Random p_i2065_1_, int p_i2065_2_, int p_i2065_3_, int p_i2065_4_, int p_i2065_5_, int p_i2065_6_, int p_i2065_7_) + { + super(0); + this.scatteredFeatureSizeX = p_i2065_5_; + this.scatteredFeatureSizeY = p_i2065_6_; + this.scatteredFeatureSizeZ = p_i2065_7_; + this.coordBaseMode = EnumFacing.Plane.HORIZONTAL.random(p_i2065_1_); + + switch (this.coordBaseMode) + { + case NORTH: + case SOUTH: + this.boundingBox = new StructureBoundingBox(p_i2065_2_, p_i2065_3_, p_i2065_4_, p_i2065_2_ + p_i2065_5_ - 1, p_i2065_3_ + p_i2065_6_ - 1, p_i2065_4_ + p_i2065_7_ - 1); + break; + + default: + this.boundingBox = new StructureBoundingBox(p_i2065_2_, p_i2065_3_, p_i2065_4_, p_i2065_2_ + p_i2065_7_ - 1, p_i2065_3_ + p_i2065_6_ - 1, p_i2065_4_ + p_i2065_5_ - 1); + } + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + tagCompound.setInteger("Width", this.scatteredFeatureSizeX); + tagCompound.setInteger("Height", this.scatteredFeatureSizeY); + tagCompound.setInteger("Depth", this.scatteredFeatureSizeZ); + tagCompound.setInteger("HPos", this.field_74936_d); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + this.scatteredFeatureSizeX = tagCompound.getInteger("Width"); + this.scatteredFeatureSizeY = tagCompound.getInteger("Height"); + this.scatteredFeatureSizeZ = tagCompound.getInteger("Depth"); + this.field_74936_d = tagCompound.getInteger("HPos"); + } + + protected boolean func_74935_a(World worldIn, StructureBoundingBox p_74935_2_, int p_74935_3_) + { + if (this.field_74936_d >= 0) + { + return true; + } + else + { + int i = 0; + int j = 0; + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k) + { + for (int l = this.boundingBox.minX; l <= this.boundingBox.maxX; ++l) + { + blockpos$mutableblockpos.func_181079_c(l, 64, k); + + if (p_74935_2_.isVecInside(blockpos$mutableblockpos)) + { + i += Math.max(worldIn.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(), worldIn.provider.getAverageGroundLevel()); + ++j; + } + } + } + + if (j == 0) + { + return false; + } + else + { + this.field_74936_d = i / j; + this.boundingBox.offset(0, this.field_74936_d - this.boundingBox.minY + p_74935_3_, 0); + return true; + } + } + } + } + + public static class JunglePyramid extends ComponentScatteredFeaturePieces.Feature + { + private boolean field_74947_h; + private boolean field_74948_i; + private boolean field_74945_j; + private boolean field_74946_k; + private static final List field_175816_i = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 3), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10), new WeightedRandomChestContent(Items.gold_ingot, 0, 2, 7, 15), new WeightedRandomChestContent(Items.emerald, 0, 1, 3, 2), new WeightedRandomChestContent(Items.bone, 0, 4, 6, 20), new WeightedRandomChestContent(Items.rotten_flesh, 0, 3, 7, 16), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 3), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 1), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 1), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 1)}); + private static final List field_175815_j = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.arrow, 0, 2, 7, 30)}); + private static ComponentScatteredFeaturePieces.JunglePyramid.Stones junglePyramidsRandomScatteredStones = new ComponentScatteredFeaturePieces.JunglePyramid.Stones(); + + public JunglePyramid() + { + } + + public JunglePyramid(Random p_i2064_1_, int p_i2064_2_, int p_i2064_3_) + { + super(p_i2064_1_, p_i2064_2_, 64, p_i2064_3_, 12, 10, 15); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("placedMainChest", this.field_74947_h); + tagCompound.setBoolean("placedHiddenChest", this.field_74948_i); + tagCompound.setBoolean("placedTrap1", this.field_74945_j); + tagCompound.setBoolean("placedTrap2", this.field_74946_k); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.field_74947_h = tagCompound.getBoolean("placedMainChest"); + this.field_74948_i = tagCompound.getBoolean("placedHiddenChest"); + this.field_74945_j = tagCompound.getBoolean("placedTrap1"); + this.field_74946_k = tagCompound.getBoolean("placedTrap2"); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (!this.func_74935_a(worldIn, structureBoundingBoxIn, 0)) + { + return false; + } + else + { + int i = this.getMetadataWithOffset(Blocks.stone_stairs, 3); + int j = this.getMetadataWithOffset(Blocks.stone_stairs, 2); + int k = this.getMetadataWithOffset(Blocks.stone_stairs, 0); + int l = this.getMetadataWithOffset(Blocks.stone_stairs, 1); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, -4, 0, this.scatteredFeatureSizeX - 1, 0, this.scatteredFeatureSizeZ - 1, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 2, 1, 2, 9, 2, 2, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 2, 1, 12, 9, 2, 12, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 2, 1, 3, 2, 2, 11, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 9, 1, 3, 9, 2, 11, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 3, 1, 10, 6, 1, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 3, 13, 10, 6, 13, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 3, 2, 1, 6, 12, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 10, 3, 2, 10, 6, 12, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 2, 3, 2, 9, 3, 12, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 2, 6, 2, 9, 6, 12, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 3, 7, 3, 8, 7, 11, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 8, 4, 7, 8, 10, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithAir(worldIn, structureBoundingBoxIn, 3, 1, 3, 8, 2, 11); + this.fillWithAir(worldIn, structureBoundingBoxIn, 4, 3, 6, 7, 3, 9); + this.fillWithAir(worldIn, structureBoundingBoxIn, 2, 4, 2, 9, 5, 12); + this.fillWithAir(worldIn, structureBoundingBoxIn, 4, 6, 5, 7, 6, 9); + this.fillWithAir(worldIn, structureBoundingBoxIn, 5, 7, 6, 6, 7, 8); + this.fillWithAir(worldIn, structureBoundingBoxIn, 5, 1, 2, 6, 2, 2); + this.fillWithAir(worldIn, structureBoundingBoxIn, 5, 2, 12, 6, 2, 12); + this.fillWithAir(worldIn, structureBoundingBoxIn, 5, 5, 1, 6, 5, 1); + this.fillWithAir(worldIn, structureBoundingBoxIn, 5, 5, 13, 6, 5, 13); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 1, 5, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 10, 5, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 1, 5, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 10, 5, 9, structureBoundingBoxIn); + + for (int i1 = 0; i1 <= 14; i1 += 14) + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 2, 4, i1, 2, 5, i1, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 4, i1, 4, 5, i1, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 7, 4, i1, 7, 5, i1, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 9, 4, i1, 9, 5, i1, false, randomIn, junglePyramidsRandomScatteredStones); + } + + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 5, 6, 0, 6, 6, 0, false, randomIn, junglePyramidsRandomScatteredStones); + + for (int k1 = 0; k1 <= 11; k1 += 11) + { + for (int j1 = 2; j1 <= 12; j1 += 2) + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, k1, 4, j1, k1, 5, j1, false, randomIn, junglePyramidsRandomScatteredStones); + } + + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, k1, 6, 5, k1, 6, 5, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, k1, 6, 9, k1, 6, 9, false, randomIn, junglePyramidsRandomScatteredStones); + } + + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 2, 7, 2, 2, 9, 2, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 9, 7, 2, 9, 9, 2, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 2, 7, 12, 2, 9, 12, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 9, 7, 12, 9, 9, 12, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 9, 4, 4, 9, 4, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 7, 9, 4, 7, 9, 4, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 9, 10, 4, 9, 10, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 7, 9, 10, 7, 9, 10, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 5, 9, 7, 6, 9, 7, false, randomIn, junglePyramidsRandomScatteredStones); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 5, 9, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 6, 9, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(j), 5, 9, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(j), 6, 9, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 4, 0, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 5, 0, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 6, 0, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 7, 0, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 4, 1, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 4, 2, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 4, 3, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 7, 1, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 7, 2, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 7, 3, 10, structureBoundingBoxIn); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 1, 9, 4, 1, 9, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 7, 1, 9, 7, 1, 9, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 1, 10, 7, 2, 10, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 5, 4, 5, 6, 4, 5, false, randomIn, junglePyramidsRandomScatteredStones); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(k), 4, 4, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(l), 7, 4, 5, structureBoundingBoxIn); + + for (int l1 = 0; l1 < 4; ++l1) + { + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(j), 5, 0 - l1, 6 + l1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(j), 6, 0 - l1, 6 + l1, structureBoundingBoxIn); + this.fillWithAir(worldIn, structureBoundingBoxIn, 5, 0 - l1, 7 + l1, 6, 0 - l1, 9 + l1); + } + + this.fillWithAir(worldIn, structureBoundingBoxIn, 1, -3, 12, 10, -1, 13); + this.fillWithAir(worldIn, structureBoundingBoxIn, 1, -3, 1, 3, -1, 13); + this.fillWithAir(worldIn, structureBoundingBoxIn, 1, -3, 1, 9, -1, 5); + + for (int i2 = 1; i2 <= 13; i2 += 2) + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, -3, i2, 1, -2, i2, false, randomIn, junglePyramidsRandomScatteredStones); + } + + for (int j2 = 2; j2 <= 12; j2 += 2) + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, -1, j2, 3, -1, j2, false, randomIn, junglePyramidsRandomScatteredStones); + } + + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 2, -2, 1, 5, -2, 1, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 7, -2, 1, 9, -2, 1, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 6, -3, 1, 6, -3, 1, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 6, -1, 1, 6, -1, 1, false, randomIn, junglePyramidsRandomScatteredStones); + this.setBlockState(worldIn, Blocks.tripwire_hook.getStateFromMeta(this.getMetadataWithOffset(Blocks.tripwire_hook, EnumFacing.EAST.getHorizontalIndex())).withProperty(BlockTripWireHook.ATTACHED, Boolean.valueOf(true)), 1, -3, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.tripwire_hook.getStateFromMeta(this.getMetadataWithOffset(Blocks.tripwire_hook, EnumFacing.WEST.getHorizontalIndex())).withProperty(BlockTripWireHook.ATTACHED, Boolean.valueOf(true)), 4, -3, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.tripwire.getDefaultState().withProperty(BlockTripWire.ATTACHED, Boolean.valueOf(true)), 2, -3, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.tripwire.getDefaultState().withProperty(BlockTripWire.ATTACHED, Boolean.valueOf(true)), 3, -3, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 5, -3, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 5, -3, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 5, -3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 5, -3, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 5, -3, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 5, -3, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 5, -3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 4, -3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 3, -3, 1, structureBoundingBoxIn); + + if (!this.field_74945_j) + { + this.field_74945_j = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 3, -2, 1, EnumFacing.NORTH.getIndex(), field_175815_j, 2); + } + + this.setBlockState(worldIn, Blocks.vine.getStateFromMeta(15), 3, -2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.tripwire_hook.getStateFromMeta(this.getMetadataWithOffset(Blocks.tripwire_hook, EnumFacing.NORTH.getHorizontalIndex())).withProperty(BlockTripWireHook.ATTACHED, Boolean.valueOf(true)), 7, -3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.tripwire_hook.getStateFromMeta(this.getMetadataWithOffset(Blocks.tripwire_hook, EnumFacing.SOUTH.getHorizontalIndex())).withProperty(BlockTripWireHook.ATTACHED, Boolean.valueOf(true)), 7, -3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.tripwire.getDefaultState().withProperty(BlockTripWire.ATTACHED, Boolean.valueOf(true)), 7, -3, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.tripwire.getDefaultState().withProperty(BlockTripWire.ATTACHED, Boolean.valueOf(true)), 7, -3, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.tripwire.getDefaultState().withProperty(BlockTripWire.ATTACHED, Boolean.valueOf(true)), 7, -3, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 8, -3, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 9, -3, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 9, -3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 9, -3, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 9, -2, 4, structureBoundingBoxIn); + + if (!this.field_74946_k) + { + this.field_74946_k = this.generateDispenserContents(worldIn, structureBoundingBoxIn, randomIn, 9, -2, 3, EnumFacing.WEST.getIndex(), field_175815_j, 2); + } + + this.setBlockState(worldIn, Blocks.vine.getStateFromMeta(15), 8, -1, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.vine.getStateFromMeta(15), 8, -2, 3, structureBoundingBoxIn); + + if (!this.field_74947_h) + { + this.field_74947_h = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 8, -3, 3, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); + } + + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 9, -3, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 8, -3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 4, -3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 5, -2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 5, -1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 6, -3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 7, -2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 7, -1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 8, -3, 5, structureBoundingBoxIn); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 9, -1, 1, 9, -1, 5, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithAir(worldIn, structureBoundingBoxIn, 8, -3, 8, 10, -1, 10); + this.setBlockState(worldIn, Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CHISELED_META), 8, -2, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CHISELED_META), 9, -2, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CHISELED_META), 10, -2, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.lever.getStateFromMeta(BlockLever.getMetadataForFacing(EnumFacing.getFront(this.getMetadataWithOffset(Blocks.lever, EnumFacing.NORTH.getIndex())))), 8, -2, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.lever.getStateFromMeta(BlockLever.getMetadataForFacing(EnumFacing.getFront(this.getMetadataWithOffset(Blocks.lever, EnumFacing.NORTH.getIndex())))), 9, -2, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.lever.getStateFromMeta(BlockLever.getMetadataForFacing(EnumFacing.getFront(this.getMetadataWithOffset(Blocks.lever, EnumFacing.NORTH.getIndex())))), 10, -2, 12, structureBoundingBoxIn); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 8, -3, 8, 8, -3, 10, false, randomIn, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 10, -3, 8, 10, -3, 10, false, randomIn, junglePyramidsRandomScatteredStones); + this.setBlockState(worldIn, Blocks.mossy_cobblestone.getDefaultState(), 10, -2, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 8, -2, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 8, -2, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.redstone_wire.getDefaultState(), 10, -1, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sticky_piston.getStateFromMeta(EnumFacing.UP.getIndex()), 9, -2, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sticky_piston.getStateFromMeta(this.getMetadataWithOffset(Blocks.sticky_piston, EnumFacing.WEST.getIndex())), 10, -2, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.sticky_piston.getStateFromMeta(this.getMetadataWithOffset(Blocks.sticky_piston, EnumFacing.WEST.getIndex())), 10, -1, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.unpowered_repeater.getStateFromMeta(this.getMetadataWithOffset(Blocks.unpowered_repeater, EnumFacing.NORTH.getHorizontalIndex())), 10, -2, 10, structureBoundingBoxIn); + + if (!this.field_74948_i) + { + this.field_74948_i = this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 9, -3, 10, WeightedRandomChestContent.func_177629_a(field_175816_i, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(5)); + } + + return true; + } + } + + static class Stones extends StructureComponent.BlockSelector + { + private Stones() + { + } + + public void selectBlocks(Random rand, int x, int y, int z, boolean p_75062_5_) + { + if (rand.nextFloat() < 0.4F) + { + this.blockstate = Blocks.cobblestone.getDefaultState(); + } + else + { + this.blockstate = Blocks.mossy_cobblestone.getDefaultState(); + } + } + } + } + + public static class SwampHut extends ComponentScatteredFeaturePieces.Feature + { + private boolean hasWitch; + + public SwampHut() + { + } + + public SwampHut(Random p_i2066_1_, int p_i2066_2_, int p_i2066_3_) + { + super(p_i2066_1_, p_i2066_2_, 64, p_i2066_3_, 7, 7, 9); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("Witch", this.hasWitch); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.hasWitch = tagCompound.getBoolean("Witch"); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (!this.func_74935_a(worldIn, structureBoundingBoxIn, 0)) + { + return false; + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 5, 1, 7, Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 2, 5, 4, 7, Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 0, 4, 1, 0, Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 2, 2, 3, 3, 2, Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 3, 1, 3, 6, Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 3, 5, 3, 6, Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 2, 7, 4, 3, 7, Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), Blocks.planks.getStateFromMeta(BlockPlanks.EnumType.SPRUCE.getMetadata()), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 2, 1, 3, 2, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 0, 2, 5, 3, 2, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 7, 1, 3, 7, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 0, 7, 5, 3, 7, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 2, 3, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 3, 3, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 1, 3, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 5, 3, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 5, 3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.flower_pot.getDefaultState().withProperty(BlockFlowerPot.CONTENTS, BlockFlowerPot.EnumFlowerType.MUSHROOM_RED), 1, 3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.crafting_table.getDefaultState(), 3, 2, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cauldron.getDefaultState(), 4, 2, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 5, 2, 1, structureBoundingBoxIn); + int i = this.getMetadataWithOffset(Blocks.oak_stairs, 3); + int j = this.getMetadataWithOffset(Blocks.oak_stairs, 1); + int k = this.getMetadataWithOffset(Blocks.oak_stairs, 0); + int l = this.getMetadataWithOffset(Blocks.oak_stairs, 2); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 1, 6, 4, 1, Blocks.spruce_stairs.getStateFromMeta(i), Blocks.spruce_stairs.getStateFromMeta(i), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 2, 0, 4, 7, Blocks.spruce_stairs.getStateFromMeta(k), Blocks.spruce_stairs.getStateFromMeta(k), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 4, 2, 6, 4, 7, Blocks.spruce_stairs.getStateFromMeta(j), Blocks.spruce_stairs.getStateFromMeta(j), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 8, 6, 4, 8, Blocks.spruce_stairs.getStateFromMeta(l), Blocks.spruce_stairs.getStateFromMeta(l), false); + + for (int i1 = 2; i1 <= 7; i1 += 5) + { + for (int j1 = 1; j1 <= 5; j1 += 4) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.log.getDefaultState(), j1, -1, i1, structureBoundingBoxIn); + } + } + + if (!this.hasWitch) + { + int l1 = this.getXWithOffset(2, 5); + int i2 = this.getYWithOffset(2); + int k1 = this.getZWithOffset(2, 5); + + if (structureBoundingBoxIn.isVecInside(new BlockPos(l1, i2, k1))) + { + this.hasWitch = true; + EntityWitch entitywitch = new EntityWitch(worldIn); + entitywitch.setLocationAndAngles((double)l1 + 0.5D, (double)i2, (double)k1 + 0.5D, 0.0F, 0.0F); + entitywitch.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(l1, i2, k1)), (IEntityLivingData)null); + worldIn.spawnEntityInWorld(entitywitch); + } + } + + return true; + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/MapGenMineshaft.java b/src/minecraft/net/minecraft/world/gen/structure/MapGenMineshaft.java new file mode 100644 index 0000000..f6f38e0 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/MapGenMineshaft.java @@ -0,0 +1,40 @@ +package net.minecraft.world.gen.structure; + +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.util.MathHelper; + +public class MapGenMineshaft extends MapGenStructure +{ + private double field_82673_e = 0.004D; + + public MapGenMineshaft() + { + } + + public String getStructureName() + { + return "Mineshaft"; + } + + public MapGenMineshaft(Map p_i2034_1_) + { + for (Entry entry : p_i2034_1_.entrySet()) + { + if (((String)entry.getKey()).equals("chance")) + { + this.field_82673_e = MathHelper.parseDoubleWithDefault((String)entry.getValue(), this.field_82673_e); + } + } + } + + protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) + { + return this.rand.nextDouble() < this.field_82673_e && this.rand.nextInt(80) < Math.max(Math.abs(chunkX), Math.abs(chunkZ)); + } + + protected StructureStart getStructureStart(int chunkX, int chunkZ) + { + return new StructureMineshaftStart(this.worldObj, this.rand, chunkX, chunkZ); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/MapGenNetherBridge.java b/src/minecraft/net/minecraft/world/gen/structure/MapGenNetherBridge.java new file mode 100644 index 0000000..e306a61 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/MapGenNetherBridge.java @@ -0,0 +1,74 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Random; +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.entity.monster.EntityMagmaCube; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; + +public class MapGenNetherBridge extends MapGenStructure +{ + private List spawnList = Lists.newArrayList(); + + public MapGenNetherBridge() + { + this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityBlaze.class, 10, 2, 3)); + this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 5, 4, 4)); + this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 10, 4, 4)); + this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityMagmaCube.class, 3, 4, 4)); + } + + public String getStructureName() + { + return "Fortress"; + } + + public List getSpawnList() + { + return this.spawnList; + } + + protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) + { + int i = chunkX >> 4; + int j = chunkZ >> 4; + this.rand.setSeed((long)(i ^ j << 4) ^ this.worldObj.getSeed()); + this.rand.nextInt(); + return this.rand.nextInt(3) != 0 ? false : (chunkX != (i << 4) + 4 + this.rand.nextInt(8) ? false : chunkZ == (j << 4) + 4 + this.rand.nextInt(8)); + } + + protected StructureStart getStructureStart(int chunkX, int chunkZ) + { + return new MapGenNetherBridge.Start(this.worldObj, this.rand, chunkX, chunkZ); + } + + public static class Start extends StructureStart + { + public Start() + { + } + + public Start(World worldIn, Random p_i2040_2_, int p_i2040_3_, int p_i2040_4_) + { + super(p_i2040_3_, p_i2040_4_); + StructureNetherBridgePieces.Start structurenetherbridgepieces$start = new StructureNetherBridgePieces.Start(p_i2040_2_, (p_i2040_3_ << 4) + 2, (p_i2040_4_ << 4) + 2); + this.components.add(structurenetherbridgepieces$start); + structurenetherbridgepieces$start.buildComponent(structurenetherbridgepieces$start, this.components, p_i2040_2_); + List list = structurenetherbridgepieces$start.field_74967_d; + + while (!list.isEmpty()) + { + int i = p_i2040_2_.nextInt(list.size()); + StructureComponent structurecomponent = (StructureComponent)list.remove(i); + structurecomponent.buildComponent(structurenetherbridgepieces$start, this.components, p_i2040_2_); + } + + this.updateBoundingBox(); + this.setRandomHeight(worldIn, p_i2040_2_, 48, 70); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/MapGenScatteredFeature.java b/src/minecraft/net/minecraft/world/gen/structure/MapGenScatteredFeature.java new file mode 100644 index 0000000..f12c15d --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/MapGenScatteredFeature.java @@ -0,0 +1,154 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.collect.Lists; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Map.Entry; +import net.minecraft.entity.monster.EntityWitch; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; + +public class MapGenScatteredFeature extends MapGenStructure +{ + private static final List biomelist = Arrays.asList(new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desertHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills, BiomeGenBase.swampland}); + private List scatteredFeatureSpawnList; + + /** the maximum distance between scattered features */ + private int maxDistanceBetweenScatteredFeatures; + + /** the minimum distance between scattered features */ + private int minDistanceBetweenScatteredFeatures; + + public MapGenScatteredFeature() + { + this.scatteredFeatureSpawnList = Lists.newArrayList(); + this.maxDistanceBetweenScatteredFeatures = 32; + this.minDistanceBetweenScatteredFeatures = 8; + this.scatteredFeatureSpawnList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 1, 1, 1)); + } + + public MapGenScatteredFeature(Map p_i2061_1_) + { + this(); + + for (Entry entry : p_i2061_1_.entrySet()) + { + if (((String)entry.getKey()).equals("distance")) + { + this.maxDistanceBetweenScatteredFeatures = MathHelper.parseIntWithDefaultAndMax((String)entry.getValue(), this.maxDistanceBetweenScatteredFeatures, this.minDistanceBetweenScatteredFeatures + 1); + } + } + } + + public String getStructureName() + { + return "Temple"; + } + + protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) + { + int i = chunkX; + int j = chunkZ; + + if (chunkX < 0) + { + chunkX -= this.maxDistanceBetweenScatteredFeatures - 1; + } + + if (chunkZ < 0) + { + chunkZ -= this.maxDistanceBetweenScatteredFeatures - 1; + } + + int k = chunkX / this.maxDistanceBetweenScatteredFeatures; + int l = chunkZ / this.maxDistanceBetweenScatteredFeatures; + Random random = this.worldObj.setRandomSeed(k, l, 14357617); + k = k * this.maxDistanceBetweenScatteredFeatures; + l = l * this.maxDistanceBetweenScatteredFeatures; + k = k + random.nextInt(this.maxDistanceBetweenScatteredFeatures - this.minDistanceBetweenScatteredFeatures); + l = l + random.nextInt(this.maxDistanceBetweenScatteredFeatures - this.minDistanceBetweenScatteredFeatures); + + if (i == k && j == l) + { + BiomeGenBase biomegenbase = this.worldObj.getWorldChunkManager().getBiomeGenerator(new BlockPos(i * 16 + 8, 0, j * 16 + 8)); + + if (biomegenbase == null) + { + return false; + } + + for (BiomeGenBase biomegenbase1 : biomelist) + { + if (biomegenbase == biomegenbase1) + { + return true; + } + } + } + + return false; + } + + protected StructureStart getStructureStart(int chunkX, int chunkZ) + { + return new MapGenScatteredFeature.Start(this.worldObj, this.rand, chunkX, chunkZ); + } + + public boolean func_175798_a(BlockPos p_175798_1_) + { + StructureStart structurestart = this.func_175797_c(p_175798_1_); + + if (structurestart != null && structurestart instanceof MapGenScatteredFeature.Start && !structurestart.components.isEmpty()) + { + StructureComponent structurecomponent = (StructureComponent)structurestart.components.getFirst(); + return structurecomponent instanceof ComponentScatteredFeaturePieces.SwampHut; + } + else + { + return false; + } + } + + public List getScatteredFeatureSpawnList() + { + return this.scatteredFeatureSpawnList; + } + + public static class Start extends StructureStart + { + public Start() + { + } + + public Start(World worldIn, Random p_i2060_2_, int p_i2060_3_, int p_i2060_4_) + { + super(p_i2060_3_, p_i2060_4_); + BiomeGenBase biomegenbase = worldIn.getBiomeGenForCoords(new BlockPos(p_i2060_3_ * 16 + 8, 0, p_i2060_4_ * 16 + 8)); + + if (biomegenbase != BiomeGenBase.jungle && biomegenbase != BiomeGenBase.jungleHills) + { + if (biomegenbase == BiomeGenBase.swampland) + { + ComponentScatteredFeaturePieces.SwampHut componentscatteredfeaturepieces$swamphut = new ComponentScatteredFeaturePieces.SwampHut(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16); + this.components.add(componentscatteredfeaturepieces$swamphut); + } + else if (biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills) + { + ComponentScatteredFeaturePieces.DesertPyramid componentscatteredfeaturepieces$desertpyramid = new ComponentScatteredFeaturePieces.DesertPyramid(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16); + this.components.add(componentscatteredfeaturepieces$desertpyramid); + } + } + else + { + ComponentScatteredFeaturePieces.JunglePyramid componentscatteredfeaturepieces$junglepyramid = new ComponentScatteredFeaturePieces.JunglePyramid(p_i2060_2_, p_i2060_3_ * 16, p_i2060_4_ * 16); + this.components.add(componentscatteredfeaturepieces$junglepyramid); + } + + this.updateBoundingBox(); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java b/src/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java new file mode 100644 index 0000000..af4cc4a --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/MapGenStronghold.java @@ -0,0 +1,167 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Map.Entry; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; + +public class MapGenStronghold extends MapGenStructure +{ + private List field_151546_e; + + /** + * is spawned false and set true once the defined BiomeGenBases were compared with the present ones + */ + private boolean ranBiomeCheck; + private ChunkCoordIntPair[] structureCoords; + private double field_82671_h; + private int field_82672_i; + + public MapGenStronghold() + { + this.structureCoords = new ChunkCoordIntPair[3]; + this.field_82671_h = 32.0D; + this.field_82672_i = 3; + this.field_151546_e = Lists.newArrayList(); + + for (BiomeGenBase biomegenbase : BiomeGenBase.getBiomeGenArray()) + { + if (biomegenbase != null && biomegenbase.minHeight > 0.0F) + { + this.field_151546_e.add(biomegenbase); + } + } + } + + public MapGenStronghold(Map p_i2068_1_) + { + this(); + + for (Entry entry : p_i2068_1_.entrySet()) + { + if (((String)entry.getKey()).equals("distance")) + { + this.field_82671_h = MathHelper.parseDoubleWithDefaultAndMax((String)entry.getValue(), this.field_82671_h, 1.0D); + } + else if (((String)entry.getKey()).equals("count")) + { + this.structureCoords = new ChunkCoordIntPair[MathHelper.parseIntWithDefaultAndMax((String)entry.getValue(), this.structureCoords.length, 1)]; + } + else if (((String)entry.getKey()).equals("spread")) + { + this.field_82672_i = MathHelper.parseIntWithDefaultAndMax((String)entry.getValue(), this.field_82672_i, 1); + } + } + } + + public String getStructureName() + { + return "Stronghold"; + } + + protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) + { + if (!this.ranBiomeCheck) + { + Random random = new Random(); + random.setSeed(this.worldObj.getSeed()); + double d0 = random.nextDouble() * Math.PI * 2.0D; + int i = 1; + + for (int j = 0; j < this.structureCoords.length; ++j) + { + double d1 = (1.25D * (double)i + random.nextDouble()) * this.field_82671_h * (double)i; + int k = (int)Math.round(Math.cos(d0) * d1); + int l = (int)Math.round(Math.sin(d0) * d1); + BlockPos blockpos = this.worldObj.getWorldChunkManager().findBiomePosition((k << 4) + 8, (l << 4) + 8, 112, this.field_151546_e, random); + + if (blockpos != null) + { + k = blockpos.getX() >> 4; + l = blockpos.getZ() >> 4; + } + + this.structureCoords[j] = new ChunkCoordIntPair(k, l); + d0 += (Math.PI * 2D) * (double)i / (double)this.field_82672_i; + + if (j == this.field_82672_i) + { + i += 2 + random.nextInt(5); + this.field_82672_i += 1 + random.nextInt(2); + } + } + + this.ranBiomeCheck = true; + } + + for (ChunkCoordIntPair chunkcoordintpair : this.structureCoords) + { + if (chunkX == chunkcoordintpair.chunkXPos && chunkZ == chunkcoordintpair.chunkZPos) + { + return true; + } + } + + return false; + } + + protected List getCoordList() + { + List list = Lists.newArrayList(); + + for (ChunkCoordIntPair chunkcoordintpair : this.structureCoords) + { + if (chunkcoordintpair != null) + { + list.add(chunkcoordintpair.getCenterBlock(64)); + } + } + + return list; + } + + protected StructureStart getStructureStart(int chunkX, int chunkZ) + { + MapGenStronghold.Start mapgenstronghold$start; + + for (mapgenstronghold$start = new MapGenStronghold.Start(this.worldObj, this.rand, chunkX, chunkZ); mapgenstronghold$start.getComponents().isEmpty() || ((StructureStrongholdPieces.Stairs2)mapgenstronghold$start.getComponents().get(0)).strongholdPortalRoom == null; mapgenstronghold$start = new MapGenStronghold.Start(this.worldObj, this.rand, chunkX, chunkZ)) + { + ; + } + + return mapgenstronghold$start; + } + + public static class Start extends StructureStart + { + public Start() + { + } + + public Start(World worldIn, Random p_i2067_2_, int p_i2067_3_, int p_i2067_4_) + { + super(p_i2067_3_, p_i2067_4_); + StructureStrongholdPieces.prepareStructurePieces(); + StructureStrongholdPieces.Stairs2 structurestrongholdpieces$stairs2 = new StructureStrongholdPieces.Stairs2(0, p_i2067_2_, (p_i2067_3_ << 4) + 2, (p_i2067_4_ << 4) + 2); + this.components.add(structurestrongholdpieces$stairs2); + structurestrongholdpieces$stairs2.buildComponent(structurestrongholdpieces$stairs2, this.components, p_i2067_2_); + List list = structurestrongholdpieces$stairs2.field_75026_c; + + while (!list.isEmpty()) + { + int i = p_i2067_2_.nextInt(list.size()); + StructureComponent structurecomponent = (StructureComponent)list.remove(i); + structurecomponent.buildComponent(structurestrongholdpieces$stairs2, this.components, p_i2067_2_); + } + + this.updateBoundingBox(); + this.markAvailableHeight(worldIn, p_i2067_2_, 10); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java b/src/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java new file mode 100644 index 0000000..5e9858c --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/MapGenStructure.java @@ -0,0 +1,314 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.collect.Maps; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.Callable; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.LongHashMap; +import net.minecraft.util.ReportedException; +import net.minecraft.util.Vec3i; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.gen.MapGenBase; +import net.minecraft.world.storage.MapStorage; +import optifine.Reflector; + +public abstract class MapGenStructure extends MapGenBase +{ + private MapGenStructureData structureData; + + /** + * Used to store a list of all structures that have been recursively generated. Used so that during recursive + * generation, the structure generator can avoid generating structures that intersect ones that have already been + * placed. + */ + protected Map structureMap = Maps.newHashMap(); + private static final String __OBFID = "CL_00000505"; + private LongHashMap structureLongMap = new LongHashMap(); + + public abstract String getStructureName(); + + /** + * Recursively called by generate() + */ + protected final void recursiveGenerate(World worldIn, final int chunkX, final int chunkZ, int p_180701_4_, int p_180701_5_, ChunkPrimer chunkPrimerIn) + { + this.func_143027_a(worldIn); + + if (!this.structureLongMap.containsItem(ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ))) + { + this.rand.nextInt(); + + try + { + if (this.canSpawnStructureAtCoords(chunkX, chunkZ)) + { + StructureStart structurestart = this.getStructureStart(chunkX, chunkZ); + this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ)), structurestart); + this.structureLongMap.add(ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ), structurestart); + this.func_143026_a(chunkX, chunkZ, structurestart); + } + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception preparing structure feature"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Feature being prepared"); + crashreportcategory.addCrashSectionCallable("Is feature chunk", new Callable() + { + private static final String __OBFID = "CL_00000506"; + public String call() throws Exception + { + return MapGenStructure.this.canSpawnStructureAtCoords(chunkX, chunkZ) ? "True" : "False"; + } + }); + crashreportcategory.addCrashSection("Chunk location", String.format("%d,%d", new Object[] {Integer.valueOf(chunkX), Integer.valueOf(chunkZ)})); + crashreportcategory.addCrashSectionCallable("Chunk pos hash", new Callable() + { + private static final String __OBFID = "CL_00000507"; + public String call() throws Exception + { + return String.valueOf(ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ)); + } + }); + crashreportcategory.addCrashSectionCallable("Structure type", new Callable() + { + private static final String __OBFID = "CL_00000508"; + public String call() throws Exception + { + return MapGenStructure.this.getClass().getCanonicalName(); + } + }); + throw new ReportedException(crashreport); + } + } + } + + public boolean generateStructure(World worldIn, Random randomIn, ChunkCoordIntPair chunkCoord) + { + this.func_143027_a(worldIn); + int i = (chunkCoord.chunkXPos << 4) + 8; + int j = (chunkCoord.chunkZPos << 4) + 8; + boolean flag = false; + + for (Object structurestart0 : this.structureMap.values()) + { + StructureStart structurestart = (StructureStart) structurestart0; + + if (structurestart.isSizeableStructure() && structurestart.func_175788_a(chunkCoord) && structurestart.getBoundingBox().intersectsWith(i, j, i + 15, j + 15)) + { + structurestart.generateStructure(worldIn, randomIn, new StructureBoundingBox(i, j, i + 15, j + 15)); + structurestart.func_175787_b(chunkCoord); + flag = true; + this.func_143026_a(structurestart.getChunkPosX(), structurestart.getChunkPosZ(), structurestart); + } + } + + return flag; + } + + public boolean func_175795_b(BlockPos pos) + { + this.func_143027_a(this.worldObj); + return this.func_175797_c(pos) != null; + } + + protected StructureStart func_175797_c(BlockPos pos) + { + label24: + + for (Object structurestart0 : this.structureMap.values()) + { + StructureStart structurestart = (StructureStart)structurestart0; + + if (structurestart.isSizeableStructure() && structurestart.getBoundingBox().isVecInside(pos)) + { + Iterator iterator = structurestart.getComponents().iterator(); + + while (true) + { + if (!iterator.hasNext()) + { + continue label24; + } + + StructureComponent structurecomponent = (StructureComponent)iterator.next(); + + if (structurecomponent.getBoundingBox().isVecInside(pos)) + { + break; + } + } + + return structurestart; + } + } + + return null; + } + + public boolean func_175796_a(World worldIn, BlockPos pos) + { + this.func_143027_a(worldIn); + + for (Object structurestart0 : this.structureMap.values()) + { + StructureStart structurestart = (StructureStart)structurestart0; + + if (structurestart.isSizeableStructure() && structurestart.getBoundingBox().isVecInside(pos)) + { + return true; + } + } + + return false; + } + + public BlockPos getClosestStrongholdPos(World worldIn, BlockPos pos) + { + this.worldObj = worldIn; + this.func_143027_a(worldIn); + this.rand.setSeed(worldIn.getSeed()); + long i = this.rand.nextLong(); + long j = this.rand.nextLong(); + long k = (long)(pos.getX() >> 4) * i; + long l = (long)(pos.getZ() >> 4) * j; + this.rand.setSeed(k ^ l ^ worldIn.getSeed()); + this.recursiveGenerate(worldIn, pos.getX() >> 4, pos.getZ() >> 4, 0, 0, (ChunkPrimer)null); + double d0 = Double.MAX_VALUE; + BlockPos blockpos = null; + + for (Object structurestart0 : this.structureMap.values()) + { + StructureStart structurestart = (StructureStart)structurestart0; + + if (structurestart.isSizeableStructure()) + { + StructureComponent structurecomponent = (StructureComponent)structurestart.getComponents().get(0); + BlockPos blockpos1 = structurecomponent.getBoundingBoxCenter(); + double d1 = blockpos1.distanceSq(pos); + + if (d1 < d0) + { + d0 = d1; + blockpos = blockpos1; + } + } + } + + if (blockpos != null) + { + return blockpos; + } + else + { + List list = this.getCoordList(); + + if (list != null) + { + BlockPos blockpos3 = null; + + for (Object blockpos2 : list) + { + double d2 = ((BlockPos) blockpos2).distanceSq(pos); + + if (d2 < d0) + { + d0 = d2; + blockpos3 = (BlockPos) blockpos2; + } + } + + return blockpos3; + } + else + { + return null; + } + } + } + + /** + * Returns a list of other locations at which the structure generation has been run, or null if not relevant to this + * structure generator. + */ + protected List getCoordList() + { + return null; + } + + private void func_143027_a(World worldIn) + { + if (this.structureData == null) + { + if (Reflector.ForgeWorld_getPerWorldStorage.exists()) + { + MapStorage mapstorage = (MapStorage)Reflector.call(worldIn, Reflector.ForgeWorld_getPerWorldStorage, new Object[0]); + this.structureData = (MapGenStructureData)mapstorage.loadData(MapGenStructureData.class, this.getStructureName()); + } + else + { + this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName()); + } + + if (this.structureData == null) + { + this.structureData = new MapGenStructureData(this.getStructureName()); + + if (Reflector.ForgeWorld_getPerWorldStorage.exists()) + { + MapStorage mapstorage1 = (MapStorage)Reflector.call(worldIn, Reflector.ForgeWorld_getPerWorldStorage, new Object[0]); + mapstorage1.setData(this.getStructureName(), this.structureData); + } + else + { + worldIn.setItemData(this.getStructureName(), this.structureData); + } + } + else + { + NBTTagCompound nbttagcompound1 = this.structureData.getTagCompound(); + + for (String s : nbttagcompound1.getKeySet()) + { + NBTBase nbtbase = nbttagcompound1.getTag(s); + + if (nbtbase.getId() == 10) + { + NBTTagCompound nbttagcompound = (NBTTagCompound)nbtbase; + + if (nbttagcompound.hasKey("ChunkX") && nbttagcompound.hasKey("ChunkZ")) + { + int i = nbttagcompound.getInteger("ChunkX"); + int j = nbttagcompound.getInteger("ChunkZ"); + StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound, worldIn); + + if (structurestart != null) + { + this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(i, j)), structurestart); + this.structureLongMap.add(ChunkCoordIntPair.chunkXZ2Int(i, j), structurestart); + } + } + } + } + } + } + } + + private void func_143026_a(int p_143026_1_, int p_143026_2_, StructureStart start) + { + this.structureData.writeInstance(start.writeStructureComponentsToNBT(p_143026_1_, p_143026_2_), p_143026_1_, p_143026_2_); + this.structureData.markDirty(); + } + + protected abstract boolean canSpawnStructureAtCoords(int chunkX, int chunkZ); + + protected abstract StructureStart getStructureStart(int chunkX, int chunkZ); +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/MapGenStructureData.java b/src/minecraft/net/minecraft/world/gen/structure/MapGenStructureData.java new file mode 100644 index 0000000..d792367 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/MapGenStructureData.java @@ -0,0 +1,49 @@ +package net.minecraft.world.gen.structure; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.WorldSavedData; + +public class MapGenStructureData extends WorldSavedData +{ + private NBTTagCompound tagCompound = new NBTTagCompound(); + + public MapGenStructureData(String name) + { + super(name); + } + + /** + * reads in data from the NBTTagCompound into this MapDataBase + */ + public void readFromNBT(NBTTagCompound nbt) + { + this.tagCompound = nbt.getCompoundTag("Features"); + } + + /** + * write data to NBTTagCompound from this MapDataBase, similar to Entities and TileEntities + */ + public void writeToNBT(NBTTagCompound nbt) + { + nbt.setTag("Features", this.tagCompound); + } + + /** + * Writes the NBT tag of an instance of this structure type to the internal NBT tag, using the chunkcoordinates as + * the key + */ + public void writeInstance(NBTTagCompound tagCompoundIn, int chunkX, int chunkZ) + { + this.tagCompound.setTag(formatChunkCoords(chunkX, chunkZ), tagCompoundIn); + } + + public static String formatChunkCoords(int chunkX, int chunkZ) + { + return "[" + chunkX + "," + chunkZ + "]"; + } + + public NBTTagCompound getTagCompound() + { + return this.tagCompound; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/MapGenStructureIO.java b/src/minecraft/net/minecraft/world/gen/structure/MapGenStructureIO.java new file mode 100644 index 0000000..ef14dab --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/MapGenStructureIO.java @@ -0,0 +1,117 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.collect.Maps; +import java.util.Map; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class MapGenStructureIO +{ + private static final Logger logger = LogManager.getLogger(); + private static Map < String, Class > startNameToClassMap = Maps. < String, Class > newHashMap(); + private static Map < Class , String > startClassToNameMap = Maps. < Class , String > newHashMap(); + private static Map < String, Class > componentNameToClassMap = Maps. < String, Class > newHashMap(); + private static Map < Class , String > componentClassToNameMap = Maps. < Class , String > newHashMap(); + + private static void registerStructure(Class startClass, String structureName) + { + startNameToClassMap.put(structureName, startClass); + startClassToNameMap.put(startClass, structureName); + } + + static void registerStructureComponent(Class componentClass, String componentName) + { + componentNameToClassMap.put(componentName, componentClass); + componentClassToNameMap.put(componentClass, componentName); + } + + public static String getStructureStartName(StructureStart start) + { + return (String)startClassToNameMap.get(start.getClass()); + } + + public static String getStructureComponentName(StructureComponent component) + { + return (String)componentClassToNameMap.get(component.getClass()); + } + + public static StructureStart getStructureStart(NBTTagCompound tagCompound, World worldIn) + { + StructureStart structurestart = null; + + try + { + Class oclass = (Class)startNameToClassMap.get(tagCompound.getString("id")); + + if (oclass != null) + { + structurestart = (StructureStart)oclass.newInstance(); + } + } + catch (Exception exception) + { + logger.warn("Failed Start with id " + tagCompound.getString("id")); + exception.printStackTrace(); + } + + if (structurestart != null) + { + structurestart.readStructureComponentsFromNBT(worldIn, tagCompound); + } + else + { + logger.warn("Skipping Structure with id " + tagCompound.getString("id")); + } + + return structurestart; + } + + public static StructureComponent getStructureComponent(NBTTagCompound tagCompound, World worldIn) + { + StructureComponent structurecomponent = null; + + try + { + Class oclass = (Class)componentNameToClassMap.get(tagCompound.getString("id")); + + if (oclass != null) + { + structurecomponent = (StructureComponent)oclass.newInstance(); + } + } + catch (Exception exception) + { + logger.warn("Failed Piece with id " + tagCompound.getString("id")); + exception.printStackTrace(); + } + + if (structurecomponent != null) + { + structurecomponent.readStructureBaseNBT(worldIn, tagCompound); + } + else + { + logger.warn("Skipping Piece with id " + tagCompound.getString("id")); + } + + return structurecomponent; + } + + static + { + registerStructure(StructureMineshaftStart.class, "Mineshaft"); + registerStructure(MapGenVillage.Start.class, "Village"); + registerStructure(MapGenNetherBridge.Start.class, "Fortress"); + registerStructure(MapGenStronghold.Start.class, "Stronghold"); + registerStructure(MapGenScatteredFeature.Start.class, "Temple"); + registerStructure(StructureOceanMonument.StartMonument.class, "Monument"); + StructureMineshaftPieces.registerStructurePieces(); + StructureVillagePieces.registerVillagePieces(); + StructureNetherBridgePieces.registerNetherFortressPieces(); + StructureStrongholdPieces.registerStrongholdPieces(); + ComponentScatteredFeaturePieces.registerScatteredFeaturePieces(); + StructureOceanMonumentPieces.registerOceanMonumentPieces(); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/MapGenVillage.java b/src/minecraft/net/minecraft/world/gen/structure/MapGenVillage.java new file mode 100644 index 0000000..fa2b6a0 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/MapGenVillage.java @@ -0,0 +1,156 @@ +package net.minecraft.world.gen.structure; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Map.Entry; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; + +public class MapGenVillage extends MapGenStructure +{ + public static final List villageSpawnBiomes = Arrays.asList(new BiomeGenBase[] {BiomeGenBase.plains, BiomeGenBase.desert, BiomeGenBase.savanna}); + + /** World terrain type, 0 for normal, 1 for flat map */ + private int terrainType; + private int field_82665_g; + private int field_82666_h; + + public MapGenVillage() + { + this.field_82665_g = 32; + this.field_82666_h = 8; + } + + public MapGenVillage(Map p_i2093_1_) + { + this(); + + for (Entry entry : p_i2093_1_.entrySet()) + { + if (((String)entry.getKey()).equals("size")) + { + this.terrainType = MathHelper.parseIntWithDefaultAndMax((String)entry.getValue(), this.terrainType, 0); + } + else if (((String)entry.getKey()).equals("distance")) + { + this.field_82665_g = MathHelper.parseIntWithDefaultAndMax((String)entry.getValue(), this.field_82665_g, this.field_82666_h + 1); + } + } + } + + public String getStructureName() + { + return "Village"; + } + + protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) + { + int i = chunkX; + int j = chunkZ; + + if (chunkX < 0) + { + chunkX -= this.field_82665_g - 1; + } + + if (chunkZ < 0) + { + chunkZ -= this.field_82665_g - 1; + } + + int k = chunkX / this.field_82665_g; + int l = chunkZ / this.field_82665_g; + Random random = this.worldObj.setRandomSeed(k, l, 10387312); + k = k * this.field_82665_g; + l = l * this.field_82665_g; + k = k + random.nextInt(this.field_82665_g - this.field_82666_h); + l = l + random.nextInt(this.field_82665_g - this.field_82666_h); + + if (i == k && j == l) + { + boolean flag = this.worldObj.getWorldChunkManager().areBiomesViable(i * 16 + 8, j * 16 + 8, 0, villageSpawnBiomes); + + if (flag) + { + return true; + } + } + + return false; + } + + protected StructureStart getStructureStart(int chunkX, int chunkZ) + { + return new MapGenVillage.Start(this.worldObj, this.rand, chunkX, chunkZ, this.terrainType); + } + + public static class Start extends StructureStart + { + private boolean hasMoreThanTwoComponents; + + public Start() + { + } + + public Start(World worldIn, Random rand, int x, int z, int p_i2092_5_) + { + super(x, z); + List list = StructureVillagePieces.getStructureVillageWeightedPieceList(rand, p_i2092_5_); + StructureVillagePieces.Start structurevillagepieces$start = new StructureVillagePieces.Start(worldIn.getWorldChunkManager(), 0, rand, (x << 4) + 2, (z << 4) + 2, list, p_i2092_5_); + this.components.add(structurevillagepieces$start); + structurevillagepieces$start.buildComponent(structurevillagepieces$start, this.components, rand); + List list1 = structurevillagepieces$start.field_74930_j; + List list2 = structurevillagepieces$start.field_74932_i; + + while (!list1.isEmpty() || !list2.isEmpty()) + { + if (list1.isEmpty()) + { + int i = rand.nextInt(list2.size()); + StructureComponent structurecomponent = (StructureComponent)list2.remove(i); + structurecomponent.buildComponent(structurevillagepieces$start, this.components, rand); + } + else + { + int j = rand.nextInt(list1.size()); + StructureComponent structurecomponent2 = (StructureComponent)list1.remove(j); + structurecomponent2.buildComponent(structurevillagepieces$start, this.components, rand); + } + } + + this.updateBoundingBox(); + int k = 0; + + for (StructureComponent structurecomponent1 : this.components) + { + if (!(structurecomponent1 instanceof StructureVillagePieces.Road)) + { + ++k; + } + } + + this.hasMoreThanTwoComponents = k > 2; + } + + public boolean isSizeableStructure() + { + return this.hasMoreThanTwoComponents; + } + + public void writeToNBT(NBTTagCompound tagCompound) + { + super.writeToNBT(tagCompound); + tagCompound.setBoolean("Valid", this.hasMoreThanTwoComponents); + } + + public void readFromNBT(NBTTagCompound tagCompound) + { + super.readFromNBT(tagCompound); + this.hasMoreThanTwoComponents = tagCompound.getBoolean("Valid"); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/StructureBoundingBox.java b/src/minecraft/net/minecraft/world/gen/structure/StructureBoundingBox.java new file mode 100644 index 0000000..56daf18 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/StructureBoundingBox.java @@ -0,0 +1,217 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.base.Objects; +import net.minecraft.nbt.NBTTagIntArray; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3i; + +public class StructureBoundingBox +{ + /** The first x coordinate of a bounding box. */ + public int minX; + + /** The first y coordinate of a bounding box. */ + public int minY; + + /** The first z coordinate of a bounding box. */ + public int minZ; + + /** The second x coordinate of a bounding box. */ + public int maxX; + + /** The second y coordinate of a bounding box. */ + public int maxY; + + /** The second z coordinate of a bounding box. */ + public int maxZ; + + public StructureBoundingBox() + { + } + + public StructureBoundingBox(int[] coords) + { + if (coords.length == 6) + { + this.minX = coords[0]; + this.minY = coords[1]; + this.minZ = coords[2]; + this.maxX = coords[3]; + this.maxY = coords[4]; + this.maxZ = coords[5]; + } + } + + /** + * returns a new StructureBoundingBox with MAX values + */ + public static StructureBoundingBox getNewBoundingBox() + { + return new StructureBoundingBox(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE); + } + + /** + * Create a bounding box with the specified dimensions and rotate it. Used to project a possible new component + * Bounding Box - to check if it would cut anything already spawned + */ + public static StructureBoundingBox getComponentToAddBoundingBox(int p_175897_0_, int p_175897_1_, int p_175897_2_, int p_175897_3_, int p_175897_4_, int p_175897_5_, int p_175897_6_, int p_175897_7_, int p_175897_8_, EnumFacing p_175897_9_) + { + switch (p_175897_9_) + { + case NORTH: + return new StructureBoundingBox(p_175897_0_ + p_175897_3_, p_175897_1_ + p_175897_4_, p_175897_2_ - p_175897_8_ + 1 + p_175897_5_, p_175897_0_ + p_175897_6_ - 1 + p_175897_3_, p_175897_1_ + p_175897_7_ - 1 + p_175897_4_, p_175897_2_ + p_175897_5_); + + case SOUTH: + return new StructureBoundingBox(p_175897_0_ + p_175897_3_, p_175897_1_ + p_175897_4_, p_175897_2_ + p_175897_5_, p_175897_0_ + p_175897_6_ - 1 + p_175897_3_, p_175897_1_ + p_175897_7_ - 1 + p_175897_4_, p_175897_2_ + p_175897_8_ - 1 + p_175897_5_); + + case WEST: + return new StructureBoundingBox(p_175897_0_ - p_175897_8_ + 1 + p_175897_5_, p_175897_1_ + p_175897_4_, p_175897_2_ + p_175897_3_, p_175897_0_ + p_175897_5_, p_175897_1_ + p_175897_7_ - 1 + p_175897_4_, p_175897_2_ + p_175897_6_ - 1 + p_175897_3_); + + case EAST: + return new StructureBoundingBox(p_175897_0_ + p_175897_5_, p_175897_1_ + p_175897_4_, p_175897_2_ + p_175897_3_, p_175897_0_ + p_175897_8_ - 1 + p_175897_5_, p_175897_1_ + p_175897_7_ - 1 + p_175897_4_, p_175897_2_ + p_175897_6_ - 1 + p_175897_3_); + + default: + return new StructureBoundingBox(p_175897_0_ + p_175897_3_, p_175897_1_ + p_175897_4_, p_175897_2_ + p_175897_5_, p_175897_0_ + p_175897_6_ - 1 + p_175897_3_, p_175897_1_ + p_175897_7_ - 1 + p_175897_4_, p_175897_2_ + p_175897_8_ - 1 + p_175897_5_); + } + } + + public static StructureBoundingBox func_175899_a(int p_175899_0_, int p_175899_1_, int p_175899_2_, int p_175899_3_, int p_175899_4_, int p_175899_5_) + { + return new StructureBoundingBox(Math.min(p_175899_0_, p_175899_3_), Math.min(p_175899_1_, p_175899_4_), Math.min(p_175899_2_, p_175899_5_), Math.max(p_175899_0_, p_175899_3_), Math.max(p_175899_1_, p_175899_4_), Math.max(p_175899_2_, p_175899_5_)); + } + + public StructureBoundingBox(StructureBoundingBox structurebb) + { + this.minX = structurebb.minX; + this.minY = structurebb.minY; + this.minZ = structurebb.minZ; + this.maxX = structurebb.maxX; + this.maxY = structurebb.maxY; + this.maxZ = structurebb.maxZ; + } + + public StructureBoundingBox(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax) + { + this.minX = xMin; + this.minY = yMin; + this.minZ = zMin; + this.maxX = xMax; + this.maxY = yMax; + this.maxZ = zMax; + } + + public StructureBoundingBox(Vec3i vec1, Vec3i vec2) + { + this.minX = Math.min(vec1.getX(), vec2.getX()); + this.minY = Math.min(vec1.getY(), vec2.getY()); + this.minZ = Math.min(vec1.getZ(), vec2.getZ()); + this.maxX = Math.max(vec1.getX(), vec2.getX()); + this.maxY = Math.max(vec1.getY(), vec2.getY()); + this.maxZ = Math.max(vec1.getZ(), vec2.getZ()); + } + + public StructureBoundingBox(int xMin, int zMin, int xMax, int zMax) + { + this.minX = xMin; + this.minZ = zMin; + this.maxX = xMax; + this.maxZ = zMax; + this.minY = 1; + this.maxY = 512; + } + + /** + * Discover if bounding box can fit within the current bounding box object. + */ + public boolean intersectsWith(StructureBoundingBox structurebb) + { + return this.maxX >= structurebb.minX && this.minX <= structurebb.maxX && this.maxZ >= structurebb.minZ && this.minZ <= structurebb.maxZ && this.maxY >= structurebb.minY && this.minY <= structurebb.maxY; + } + + /** + * Discover if a coordinate is inside the bounding box area. + */ + public boolean intersectsWith(int minXIn, int minZIn, int maxXIn, int maxZIn) + { + return this.maxX >= minXIn && this.minX <= maxXIn && this.maxZ >= minZIn && this.minZ <= maxZIn; + } + + /** + * Expands a bounding box's dimensions to include the supplied bounding box. + */ + public void expandTo(StructureBoundingBox sbb) + { + this.minX = Math.min(this.minX, sbb.minX); + this.minY = Math.min(this.minY, sbb.minY); + this.minZ = Math.min(this.minZ, sbb.minZ); + this.maxX = Math.max(this.maxX, sbb.maxX); + this.maxY = Math.max(this.maxY, sbb.maxY); + this.maxZ = Math.max(this.maxZ, sbb.maxZ); + } + + /** + * Offsets the current bounding box by the specified coordinates. Args: x, y, z + */ + public void offset(int x, int y, int z) + { + this.minX += x; + this.minY += y; + this.minZ += z; + this.maxX += x; + this.maxY += y; + this.maxZ += z; + } + + /** + * Checks if given Vec3i is inside of StructureBoundingBox + */ + public boolean isVecInside(Vec3i vec) + { + return vec.getX() >= this.minX && vec.getX() <= this.maxX && vec.getZ() >= this.minZ && vec.getZ() <= this.maxZ && vec.getY() >= this.minY && vec.getY() <= this.maxY; + } + + public Vec3i func_175896_b() + { + return new Vec3i(this.maxX - this.minX, this.maxY - this.minY, this.maxZ - this.minZ); + } + + /** + * Get dimension of the bounding box in the x direction. + */ + public int getXSize() + { + return this.maxX - this.minX + 1; + } + + /** + * Get dimension of the bounding box in the y direction. + */ + public int getYSize() + { + return this.maxY - this.minY + 1; + } + + /** + * Get dimension of the bounding box in the z direction. + */ + public int getZSize() + { + return this.maxZ - this.minZ + 1; + } + + public Vec3i getCenter() + { + return new BlockPos(this.minX + (this.maxX - this.minX + 1) / 2, this.minY + (this.maxY - this.minY + 1) / 2, this.minZ + (this.maxZ - this.minZ + 1) / 2); + } + + public String toString() + { + return Objects.toStringHelper(this).add("x0", this.minX).add("y0", this.minY).add("z0", this.minZ).add("x1", this.maxX).add("y1", this.maxY).add("z1", this.maxZ).toString(); + } + + public NBTTagIntArray toNBTTagIntArray() + { + return new NBTTagIntArray(new int[] {this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ}); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/StructureComponent.java b/src/minecraft/net/minecraft/world/gen/structure/StructureComponent.java new file mode 100644 index 0000000..1cf6cf1 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/StructureComponent.java @@ -0,0 +1,853 @@ +package net.minecraft.world.gen.structure; + +import java.util.List; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDirectional; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemDoor; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.tileentity.TileEntityDispenser; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.world.World; + +public abstract class StructureComponent +{ + protected StructureBoundingBox boundingBox; + + /** switches the Coordinate System base off the Bounding Box */ + protected EnumFacing coordBaseMode; + + /** The type ID of this component. */ + protected int componentType; + + public StructureComponent() + { + } + + protected StructureComponent(int type) + { + this.componentType = type; + } + + /** + * Writes structure base data (id, boundingbox, {@link + * net.minecraft.world.gen.structure.StructureComponent#coordBaseMode coordBase} and {@link + * net.minecraft.world.gen.structure.StructureComponent#componentType componentType}) to new NBTTagCompound and + * returns it. + */ + public NBTTagCompound createStructureBaseNBT() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("id", MapGenStructureIO.getStructureComponentName(this)); + nbttagcompound.setTag("BB", this.boundingBox.toNBTTagIntArray()); + nbttagcompound.setInteger("O", this.coordBaseMode == null ? -1 : this.coordBaseMode.getHorizontalIndex()); + nbttagcompound.setInteger("GD", this.componentType); + this.writeStructureToNBT(nbttagcompound); + return nbttagcompound; + } + + /** + * (abstract) Helper method to write subclass data to NBT + */ + protected abstract void writeStructureToNBT(NBTTagCompound tagCompound); + + /** + * Reads and sets structure base data (boundingbox, {@link + * net.minecraft.world.gen.structure.StructureComponent#coordBaseMode coordBase} and {@link + * net.minecraft.world.gen.structure.StructureComponent#componentType componentType}) + */ + public void readStructureBaseNBT(World worldIn, NBTTagCompound tagCompound) + { + if (tagCompound.hasKey("BB")) + { + this.boundingBox = new StructureBoundingBox(tagCompound.getIntArray("BB")); + } + + int i = tagCompound.getInteger("O"); + this.coordBaseMode = i == -1 ? null : EnumFacing.getHorizontal(i); + this.componentType = tagCompound.getInteger("GD"); + this.readStructureFromNBT(tagCompound); + } + + /** + * (abstract) Helper method to read subclass data from NBT + */ + protected abstract void readStructureFromNBT(NBTTagCompound tagCompound); + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public abstract boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn); + + public StructureBoundingBox getBoundingBox() + { + return this.boundingBox; + } + + /** + * Returns the component type ID of this component. + */ + public int getComponentType() + { + return this.componentType; + } + + /** + * Discover if bounding box can fit within the current bounding box object. + */ + public static StructureComponent findIntersecting(List listIn, StructureBoundingBox boundingboxIn) + { + for (StructureComponent structurecomponent : listIn) + { + if (structurecomponent.getBoundingBox() != null && structurecomponent.getBoundingBox().intersectsWith(boundingboxIn)) + { + return structurecomponent; + } + } + + return null; + } + + public BlockPos getBoundingBoxCenter() + { + return new BlockPos(this.boundingBox.getCenter()); + } + + /** + * checks the entire StructureBoundingBox for Liquids + */ + protected boolean isLiquidInStructureBoundingBox(World worldIn, StructureBoundingBox boundingboxIn) + { + int i = Math.max(this.boundingBox.minX - 1, boundingboxIn.minX); + int j = Math.max(this.boundingBox.minY - 1, boundingboxIn.minY); + int k = Math.max(this.boundingBox.minZ - 1, boundingboxIn.minZ); + int l = Math.min(this.boundingBox.maxX + 1, boundingboxIn.maxX); + int i1 = Math.min(this.boundingBox.maxY + 1, boundingboxIn.maxY); + int j1 = Math.min(this.boundingBox.maxZ + 1, boundingboxIn.maxZ); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k1 = i; k1 <= l; ++k1) + { + for (int l1 = k; l1 <= j1; ++l1) + { + if (worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, j, l1)).getBlock().getMaterial().isLiquid()) + { + return true; + } + + if (worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).getBlock().getMaterial().isLiquid()) + { + return true; + } + } + } + + for (int i2 = i; i2 <= l; ++i2) + { + for (int k2 = j; k2 <= i1; ++k2) + { + if (worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(i2, k2, k)).getBlock().getMaterial().isLiquid()) + { + return true; + } + + if (worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(i2, k2, j1)).getBlock().getMaterial().isLiquid()) + { + return true; + } + } + } + + for (int j2 = k; j2 <= j1; ++j2) + { + for (int l2 = j; l2 <= i1; ++l2) + { + if (worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(i, l2, j2)).getBlock().getMaterial().isLiquid()) + { + return true; + } + + if (worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, l2, j2)).getBlock().getMaterial().isLiquid()) + { + return true; + } + } + } + + return false; + } + + protected int getXWithOffset(int x, int z) + { + if (this.coordBaseMode == null) + { + return x; + } + else + { + switch (this.coordBaseMode) + { + case NORTH: + case SOUTH: + return this.boundingBox.minX + x; + + case WEST: + return this.boundingBox.maxX - z; + + case EAST: + return this.boundingBox.minX + z; + + default: + return x; + } + } + } + + protected int getYWithOffset(int y) + { + return this.coordBaseMode == null ? y : y + this.boundingBox.minY; + } + + protected int getZWithOffset(int x, int z) + { + if (this.coordBaseMode == null) + { + return z; + } + else + { + switch (this.coordBaseMode) + { + case NORTH: + return this.boundingBox.maxZ - z; + + case SOUTH: + return this.boundingBox.minZ + z; + + case WEST: + case EAST: + return this.boundingBox.minZ + x; + + default: + return z; + } + } + } + + /** + * Returns the direction-shifted metadata for blocks that require orientation, e.g. doors, stairs, ladders. + */ + protected int getMetadataWithOffset(Block blockIn, int meta) + { + if (blockIn == Blocks.rail) + { + if (this.coordBaseMode == EnumFacing.WEST || this.coordBaseMode == EnumFacing.EAST) + { + if (meta == 1) + { + return 0; + } + + return 1; + } + } + else if (blockIn instanceof BlockDoor) + { + if (this.coordBaseMode == EnumFacing.SOUTH) + { + if (meta == 0) + { + return 2; + } + + if (meta == 2) + { + return 0; + } + } + else + { + if (this.coordBaseMode == EnumFacing.WEST) + { + return meta + 1 & 3; + } + + if (this.coordBaseMode == EnumFacing.EAST) + { + return meta + 3 & 3; + } + } + } + else if (blockIn != Blocks.stone_stairs && blockIn != Blocks.oak_stairs && blockIn != Blocks.nether_brick_stairs && blockIn != Blocks.stone_brick_stairs && blockIn != Blocks.sandstone_stairs) + { + if (blockIn == Blocks.ladder) + { + if (this.coordBaseMode == EnumFacing.SOUTH) + { + if (meta == EnumFacing.NORTH.getIndex()) + { + return EnumFacing.SOUTH.getIndex(); + } + + if (meta == EnumFacing.SOUTH.getIndex()) + { + return EnumFacing.NORTH.getIndex(); + } + } + else if (this.coordBaseMode == EnumFacing.WEST) + { + if (meta == EnumFacing.NORTH.getIndex()) + { + return EnumFacing.WEST.getIndex(); + } + + if (meta == EnumFacing.SOUTH.getIndex()) + { + return EnumFacing.EAST.getIndex(); + } + + if (meta == EnumFacing.WEST.getIndex()) + { + return EnumFacing.NORTH.getIndex(); + } + + if (meta == EnumFacing.EAST.getIndex()) + { + return EnumFacing.SOUTH.getIndex(); + } + } + else if (this.coordBaseMode == EnumFacing.EAST) + { + if (meta == EnumFacing.NORTH.getIndex()) + { + return EnumFacing.EAST.getIndex(); + } + + if (meta == EnumFacing.SOUTH.getIndex()) + { + return EnumFacing.WEST.getIndex(); + } + + if (meta == EnumFacing.WEST.getIndex()) + { + return EnumFacing.NORTH.getIndex(); + } + + if (meta == EnumFacing.EAST.getIndex()) + { + return EnumFacing.SOUTH.getIndex(); + } + } + } + else if (blockIn == Blocks.stone_button) + { + if (this.coordBaseMode == EnumFacing.SOUTH) + { + if (meta == 3) + { + return 4; + } + + if (meta == 4) + { + return 3; + } + } + else if (this.coordBaseMode == EnumFacing.WEST) + { + if (meta == 3) + { + return 1; + } + + if (meta == 4) + { + return 2; + } + + if (meta == 2) + { + return 3; + } + + if (meta == 1) + { + return 4; + } + } + else if (this.coordBaseMode == EnumFacing.EAST) + { + if (meta == 3) + { + return 2; + } + + if (meta == 4) + { + return 1; + } + + if (meta == 2) + { + return 3; + } + + if (meta == 1) + { + return 4; + } + } + } + else if (blockIn != Blocks.tripwire_hook && !(blockIn instanceof BlockDirectional)) + { + if (blockIn == Blocks.piston || blockIn == Blocks.sticky_piston || blockIn == Blocks.lever || blockIn == Blocks.dispenser) + { + if (this.coordBaseMode == EnumFacing.SOUTH) + { + if (meta == EnumFacing.NORTH.getIndex() || meta == EnumFacing.SOUTH.getIndex()) + { + return EnumFacing.getFront(meta).getOpposite().getIndex(); + } + } + else if (this.coordBaseMode == EnumFacing.WEST) + { + if (meta == EnumFacing.NORTH.getIndex()) + { + return EnumFacing.WEST.getIndex(); + } + + if (meta == EnumFacing.SOUTH.getIndex()) + { + return EnumFacing.EAST.getIndex(); + } + + if (meta == EnumFacing.WEST.getIndex()) + { + return EnumFacing.NORTH.getIndex(); + } + + if (meta == EnumFacing.EAST.getIndex()) + { + return EnumFacing.SOUTH.getIndex(); + } + } + else if (this.coordBaseMode == EnumFacing.EAST) + { + if (meta == EnumFacing.NORTH.getIndex()) + { + return EnumFacing.EAST.getIndex(); + } + + if (meta == EnumFacing.SOUTH.getIndex()) + { + return EnumFacing.WEST.getIndex(); + } + + if (meta == EnumFacing.WEST.getIndex()) + { + return EnumFacing.NORTH.getIndex(); + } + + if (meta == EnumFacing.EAST.getIndex()) + { + return EnumFacing.SOUTH.getIndex(); + } + } + } + } + else + { + EnumFacing enumfacing = EnumFacing.getHorizontal(meta); + + if (this.coordBaseMode == EnumFacing.SOUTH) + { + if (enumfacing == EnumFacing.SOUTH || enumfacing == EnumFacing.NORTH) + { + return enumfacing.getOpposite().getHorizontalIndex(); + } + } + else if (this.coordBaseMode == EnumFacing.WEST) + { + if (enumfacing == EnumFacing.NORTH) + { + return EnumFacing.WEST.getHorizontalIndex(); + } + + if (enumfacing == EnumFacing.SOUTH) + { + return EnumFacing.EAST.getHorizontalIndex(); + } + + if (enumfacing == EnumFacing.WEST) + { + return EnumFacing.NORTH.getHorizontalIndex(); + } + + if (enumfacing == EnumFacing.EAST) + { + return EnumFacing.SOUTH.getHorizontalIndex(); + } + } + else if (this.coordBaseMode == EnumFacing.EAST) + { + if (enumfacing == EnumFacing.NORTH) + { + return EnumFacing.EAST.getHorizontalIndex(); + } + + if (enumfacing == EnumFacing.SOUTH) + { + return EnumFacing.WEST.getHorizontalIndex(); + } + + if (enumfacing == EnumFacing.WEST) + { + return EnumFacing.NORTH.getHorizontalIndex(); + } + + if (enumfacing == EnumFacing.EAST) + { + return EnumFacing.SOUTH.getHorizontalIndex(); + } + } + } + } + else if (this.coordBaseMode == EnumFacing.SOUTH) + { + if (meta == 2) + { + return 3; + } + + if (meta == 3) + { + return 2; + } + } + else if (this.coordBaseMode == EnumFacing.WEST) + { + if (meta == 0) + { + return 2; + } + + if (meta == 1) + { + return 3; + } + + if (meta == 2) + { + return 0; + } + + if (meta == 3) + { + return 1; + } + } + else if (this.coordBaseMode == EnumFacing.EAST) + { + if (meta == 0) + { + return 2; + } + + if (meta == 1) + { + return 3; + } + + if (meta == 2) + { + return 1; + } + + if (meta == 3) + { + return 0; + } + } + + return meta; + } + + protected void setBlockState(World worldIn, IBlockState blockstateIn, int x, int y, int z, StructureBoundingBox boundingboxIn) + { + BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); + + if (boundingboxIn.isVecInside(blockpos)) + { + worldIn.setBlockState(blockpos, blockstateIn, 2); + } + } + + protected IBlockState getBlockStateFromPos(World worldIn, int x, int y, int z, StructureBoundingBox boundingboxIn) + { + int i = this.getXWithOffset(x, z); + int j = this.getYWithOffset(y); + int k = this.getZWithOffset(x, z); + BlockPos blockpos = new BlockPos(i, j, k); + return !boundingboxIn.isVecInside(blockpos) ? Blocks.air.getDefaultState() : worldIn.getBlockState(blockpos); + } + + /** + * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int + * maxZ) + */ + protected void fillWithAir(World worldIn, StructureBoundingBox structurebb, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) + { + for (int i = minY; i <= maxY; ++i) + { + for (int j = minX; j <= maxX; ++j) + { + for (int k = minZ; k <= maxZ; ++k) + { + this.setBlockState(worldIn, Blocks.air.getDefaultState(), j, i, k, structurebb); + } + } + } + } + + /** + * Fill the given area with the selected blocks + */ + protected void fillWithBlocks(World worldIn, StructureBoundingBox boundingboxIn, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, IBlockState boundaryBlockState, IBlockState insideBlockState, boolean existingOnly) + { + for (int i = yMin; i <= yMax; ++i) + { + for (int j = xMin; j <= xMax; ++j) + { + for (int k = zMin; k <= zMax; ++k) + { + if (!existingOnly || this.getBlockStateFromPos(worldIn, j, i, k, boundingboxIn).getBlock().getMaterial() != Material.air) + { + if (i != yMin && i != yMax && j != xMin && j != xMax && k != zMin && k != zMax) + { + this.setBlockState(worldIn, insideBlockState, j, i, k, boundingboxIn); + } + else + { + this.setBlockState(worldIn, boundaryBlockState, j, i, k, boundingboxIn); + } + } + } + } + } + } + + /** + * arguments: World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int + * maxZ, boolean alwaysreplace, Random rand, StructurePieceBlockSelector blockselector + */ + protected void fillWithRandomizedBlocks(World worldIn, StructureBoundingBox boundingboxIn, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, boolean alwaysReplace, Random rand, StructureComponent.BlockSelector blockselector) + { + for (int i = minY; i <= maxY; ++i) + { + for (int j = minX; j <= maxX; ++j) + { + for (int k = minZ; k <= maxZ; ++k) + { + if (!alwaysReplace || this.getBlockStateFromPos(worldIn, j, i, k, boundingboxIn).getBlock().getMaterial() != Material.air) + { + blockselector.selectBlocks(rand, j, i, k, i == minY || i == maxY || j == minX || j == maxX || k == minZ || k == maxZ); + this.setBlockState(worldIn, blockselector.getBlockState(), j, i, k, boundingboxIn); + } + } + } + } + } + + protected void func_175805_a(World worldIn, StructureBoundingBox boundingboxIn, Random rand, float chance, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, IBlockState blockstate1, IBlockState blockstate2, boolean p_175805_13_) + { + for (int i = minY; i <= maxY; ++i) + { + for (int j = minX; j <= maxX; ++j) + { + for (int k = minZ; k <= maxZ; ++k) + { + if (rand.nextFloat() <= chance && (!p_175805_13_ || this.getBlockStateFromPos(worldIn, j, i, k, boundingboxIn).getBlock().getMaterial() != Material.air)) + { + if (i != minY && i != maxY && j != minX && j != maxX && k != minZ && k != maxZ) + { + this.setBlockState(worldIn, blockstate2, j, i, k, boundingboxIn); + } + else + { + this.setBlockState(worldIn, blockstate1, j, i, k, boundingboxIn); + } + } + } + } + } + } + + protected void randomlyPlaceBlock(World worldIn, StructureBoundingBox boundingboxIn, Random rand, float chance, int x, int y, int z, IBlockState blockstateIn) + { + if (rand.nextFloat() < chance) + { + this.setBlockState(worldIn, blockstateIn, x, y, z, boundingboxIn); + } + } + + protected void randomlyRareFillWithBlocks(World worldIn, StructureBoundingBox boundingboxIn, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, IBlockState blockstateIn, boolean p_180777_10_) + { + float f = (float)(maxX - minX + 1); + float f1 = (float)(maxY - minY + 1); + float f2 = (float)(maxZ - minZ + 1); + float f3 = (float)minX + f / 2.0F; + float f4 = (float)minZ + f2 / 2.0F; + + for (int i = minY; i <= maxY; ++i) + { + float f5 = (float)(i - minY) / f1; + + for (int j = minX; j <= maxX; ++j) + { + float f6 = ((float)j - f3) / (f * 0.5F); + + for (int k = minZ; k <= maxZ; ++k) + { + float f7 = ((float)k - f4) / (f2 * 0.5F); + + if (!p_180777_10_ || this.getBlockStateFromPos(worldIn, j, i, k, boundingboxIn).getBlock().getMaterial() != Material.air) + { + float f8 = f6 * f6 + f5 * f5 + f7 * f7; + + if (f8 <= 1.05F) + { + this.setBlockState(worldIn, blockstateIn, j, i, k, boundingboxIn); + } + } + } + } + } + } + + /** + * Deletes all continuous blocks from selected position upwards. Stops at hitting air. + */ + protected void clearCurrentPositionBlocksUpwards(World worldIn, int x, int y, int z, StructureBoundingBox structurebb) + { + BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); + + if (structurebb.isVecInside(blockpos)) + { + while (!worldIn.isAirBlock(blockpos) && blockpos.getY() < 255) + { + worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2); + blockpos = blockpos.up(); + } + } + } + + /** + * Replaces air and liquid from given position downwards. Stops when hitting anything else than air or liquid + */ + protected void replaceAirAndLiquidDownwards(World worldIn, IBlockState blockstateIn, int x, int y, int z, StructureBoundingBox boundingboxIn) + { + int i = this.getXWithOffset(x, z); + int j = this.getYWithOffset(y); + int k = this.getZWithOffset(x, z); + + if (boundingboxIn.isVecInside(new BlockPos(i, j, k))) + { + while ((worldIn.isAirBlock(new BlockPos(i, j, k)) || worldIn.getBlockState(new BlockPos(i, j, k)).getBlock().getMaterial().isLiquid()) && j > 1) + { + worldIn.setBlockState(new BlockPos(i, j, k), blockstateIn, 2); + --j; + } + } + } + + protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List listIn, int max) + { + BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); + + if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.chest) + { + IBlockState iblockstate = Blocks.chest.getDefaultState(); + worldIn.setBlockState(blockpos, Blocks.chest.correctFacing(worldIn, blockpos, iblockstate), 2); + TileEntity tileentity = worldIn.getTileEntity(blockpos); + + if (tileentity instanceof TileEntityChest) + { + WeightedRandomChestContent.generateChestContents(rand, listIn, (TileEntityChest)tileentity, max); + } + + return true; + } + else + { + return false; + } + } + + protected boolean generateDispenserContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, int meta, List listIn, int max) + { + BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); + + if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.dispenser) + { + worldIn.setBlockState(blockpos, Blocks.dispenser.getStateFromMeta(this.getMetadataWithOffset(Blocks.dispenser, meta)), 2); + TileEntity tileentity = worldIn.getTileEntity(blockpos); + + if (tileentity instanceof TileEntityDispenser) + { + WeightedRandomChestContent.generateDispenserContents(rand, listIn, (TileEntityDispenser)tileentity, max); + } + + return true; + } + else + { + return false; + } + } + + /** + * Places door on given position + */ + protected void placeDoorCurrentPosition(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, EnumFacing facing) + { + BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); + + if (boundingBoxIn.isVecInside(blockpos)) + { + ItemDoor.placeDoor(worldIn, blockpos, facing.rotateYCCW(), Blocks.oak_door); + } + } + + public void func_181138_a(int p_181138_1_, int p_181138_2_, int p_181138_3_) + { + this.boundingBox.offset(p_181138_1_, p_181138_2_, p_181138_3_); + } + + public abstract static class BlockSelector + { + protected IBlockState blockstate = Blocks.air.getDefaultState(); + + public abstract void selectBlocks(Random rand, int x, int y, int z, boolean p_75062_5_); + + public IBlockState getBlockState() + { + return this.blockstate; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java b/src/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java new file mode 100644 index 0000000..6ef7cd1 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/StructureMineshaftPieces.java @@ -0,0 +1,832 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Random; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.item.EntityMinecartChest; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityMobSpawner; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.world.World; + +@SuppressWarnings("incomplete-switch") +public class StructureMineshaftPieces +{ + private static final List CHEST_CONTENT_WEIGHT_LIST = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 5), new WeightedRandomChestContent(Items.redstone, 0, 4, 9, 5), new WeightedRandomChestContent(Items.dye, EnumDyeColor.BLUE.getDyeDamage(), 4, 9, 5), new WeightedRandomChestContent(Items.diamond, 0, 1, 2, 3), new WeightedRandomChestContent(Items.coal, 0, 3, 8, 10), new WeightedRandomChestContent(Items.bread, 0, 1, 3, 15), new WeightedRandomChestContent(Items.iron_pickaxe, 0, 1, 1, 1), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.rail), 0, 4, 8, 1), new WeightedRandomChestContent(Items.melon_seeds, 0, 2, 4, 10), new WeightedRandomChestContent(Items.pumpkin_seeds, 0, 2, 4, 10), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 3), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 1)}); + + public static void registerStructurePieces() + { + MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Corridor.class, "MSCorridor"); + MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Cross.class, "MSCrossing"); + MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Room.class, "MSRoom"); + MapGenStructureIO.registerStructureComponent(StructureMineshaftPieces.Stairs.class, "MSStairs"); + } + + private static StructureComponent func_175892_a(List listIn, Random rand, int x, int y, int z, EnumFacing facing, int type) + { + int i = rand.nextInt(100); + + if (i >= 80) + { + StructureBoundingBox structureboundingbox = StructureMineshaftPieces.Cross.func_175813_a(listIn, rand, x, y, z, facing); + + if (structureboundingbox != null) + { + return new StructureMineshaftPieces.Cross(type, rand, structureboundingbox, facing); + } + } + else if (i >= 70) + { + StructureBoundingBox structureboundingbox1 = StructureMineshaftPieces.Stairs.func_175812_a(listIn, rand, x, y, z, facing); + + if (structureboundingbox1 != null) + { + return new StructureMineshaftPieces.Stairs(type, rand, structureboundingbox1, facing); + } + } + else + { + StructureBoundingBox structureboundingbox2 = StructureMineshaftPieces.Corridor.func_175814_a(listIn, rand, x, y, z, facing); + + if (structureboundingbox2 != null) + { + return new StructureMineshaftPieces.Corridor(type, rand, structureboundingbox2, facing); + } + } + + return null; + } + + private static StructureComponent func_175890_b(StructureComponent componentIn, List listIn, Random rand, int x, int y, int z, EnumFacing facing, int type) + { + if (type > 8) + { + return null; + } + else if (Math.abs(x - componentIn.getBoundingBox().minX) <= 80 && Math.abs(z - componentIn.getBoundingBox().minZ) <= 80) + { + StructureComponent structurecomponent = func_175892_a(listIn, rand, x, y, z, facing, type + 1); + + if (structurecomponent != null) + { + listIn.add(structurecomponent); + structurecomponent.buildComponent(componentIn, listIn, rand); + } + + return structurecomponent; + } + else + { + return null; + } + } + + public static class Corridor extends StructureComponent + { + private boolean hasRails; + private boolean hasSpiders; + private boolean spawnerPlaced; + private int sectionCount; + + public Corridor() + { + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + tagCompound.setBoolean("hr", this.hasRails); + tagCompound.setBoolean("sc", this.hasSpiders); + tagCompound.setBoolean("hps", this.spawnerPlaced); + tagCompound.setInteger("Num", this.sectionCount); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + this.hasRails = tagCompound.getBoolean("hr"); + this.hasSpiders = tagCompound.getBoolean("sc"); + this.spawnerPlaced = tagCompound.getBoolean("hps"); + this.sectionCount = tagCompound.getInteger("Num"); + } + + public Corridor(int type, Random rand, StructureBoundingBox structurebb, EnumFacing facing) + { + super(type); + this.coordBaseMode = facing; + this.boundingBox = structurebb; + this.hasRails = rand.nextInt(3) == 0; + this.hasSpiders = !this.hasRails && rand.nextInt(23) == 0; + + if (this.coordBaseMode != EnumFacing.NORTH && this.coordBaseMode != EnumFacing.SOUTH) + { + this.sectionCount = structurebb.getXSize() / 5; + } + else + { + this.sectionCount = structurebb.getZSize() / 5; + } + } + + public static StructureBoundingBox func_175814_a(List p_175814_0_, Random rand, int x, int y, int z, EnumFacing facing) + { + StructureBoundingBox structureboundingbox = new StructureBoundingBox(x, y, z, x, y + 2, z); + int i; + + for (i = rand.nextInt(3) + 2; i > 0; --i) + { + int j = i * 5; + + switch (facing) + { + case NORTH: + structureboundingbox.maxX = x + 2; + structureboundingbox.minZ = z - (j - 1); + break; + + case SOUTH: + structureboundingbox.maxX = x + 2; + structureboundingbox.maxZ = z + (j - 1); + break; + + case WEST: + structureboundingbox.minX = x - (j - 1); + structureboundingbox.maxZ = z + 2; + break; + + case EAST: + structureboundingbox.maxX = x + (j - 1); + structureboundingbox.maxZ = z + 2; + } + + if (StructureComponent.findIntersecting(p_175814_0_, structureboundingbox) == null) + { + break; + } + } + + return i > 0 ? structureboundingbox : null; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + int i = this.getComponentType(); + int j = rand.nextInt(4); + + if (this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case NORTH: + if (j <= 1) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ - 1, this.coordBaseMode, i); + } + else if (j == 2) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ, EnumFacing.WEST, i); + } + else + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ, EnumFacing.EAST, i); + } + + break; + + case SOUTH: + if (j <= 1) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.maxZ + 1, this.coordBaseMode, i); + } + else if (j == 2) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.maxZ - 3, EnumFacing.WEST, i); + } + else + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.maxZ - 3, EnumFacing.EAST, i); + } + + break; + + case WEST: + if (j <= 1) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ, this.coordBaseMode, i); + } + else if (j == 2) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ - 1, EnumFacing.NORTH, i); + } + else + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.maxZ + 1, EnumFacing.SOUTH, i); + } + + break; + + case EAST: + if (j <= 1) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ, this.coordBaseMode, i); + } + else if (j == 2) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.maxX - 3, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.minZ - 1, EnumFacing.NORTH, i); + } + else + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.maxX - 3, this.boundingBox.minY - 1 + rand.nextInt(3), this.boundingBox.maxZ + 1, EnumFacing.SOUTH, i); + } + } + } + + if (i < 8) + { + if (this.coordBaseMode != EnumFacing.NORTH && this.coordBaseMode != EnumFacing.SOUTH) + { + for (int i1 = this.boundingBox.minX + 3; i1 + 3 <= this.boundingBox.maxX; i1 += 5) + { + int j1 = rand.nextInt(5); + + if (j1 == 0) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, i1, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, i + 1); + } + else if (j1 == 1) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, i1, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, i + 1); + } + } + } + else + { + for (int k = this.boundingBox.minZ + 3; k + 3 <= this.boundingBox.maxZ; k += 5) + { + int l = rand.nextInt(5); + + if (l == 0) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, k, EnumFacing.WEST, i + 1); + } + else if (l == 1) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, k, EnumFacing.EAST, i + 1); + } + } + } + } + } + + protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List listIn, int max) + { + BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); + + if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air) + { + int i = rand.nextBoolean() ? 1 : 0; + worldIn.setBlockState(blockpos, Blocks.rail.getStateFromMeta(this.getMetadataWithOffset(Blocks.rail, i)), 2); + EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F)); + WeightedRandomChestContent.generateChestContents(rand, listIn, entityminecartchest, max); + worldIn.spawnEntityInWorld(entityminecartchest); + return true; + } + else + { + return false; + } + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + int i = 0; + int j = 2; + int k = 0; + int l = 2; + int i1 = this.sectionCount * 5 - 1; + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 2, 1, i1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.func_175805_a(worldIn, structureBoundingBoxIn, randomIn, 0.8F, 0, 2, 0, 2, 2, i1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + + if (this.hasSpiders) + { + this.func_175805_a(worldIn, structureBoundingBoxIn, randomIn, 0.6F, 0, 0, 0, 2, 1, i1, Blocks.web.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + for (int j1 = 0; j1 < this.sectionCount; ++j1) + { + int k1 = 2 + j1 * 5; + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, k1, 0, 1, k1, Blocks.oak_fence.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 0, k1, 2, 1, k1, Blocks.oak_fence.getDefaultState(), Blocks.air.getDefaultState(), false); + + if (randomIn.nextInt(4) == 0) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, k1, 0, 2, k1, Blocks.planks.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 2, k1, 2, 2, k1, Blocks.planks.getDefaultState(), Blocks.air.getDefaultState(), false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, k1, 2, 2, k1, Blocks.planks.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 0, 2, k1 - 1, Blocks.web.getDefaultState()); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 2, 2, k1 - 1, Blocks.web.getDefaultState()); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 0, 2, k1 + 1, Blocks.web.getDefaultState()); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 2, 2, k1 + 1, Blocks.web.getDefaultState()); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 0, 2, k1 - 2, Blocks.web.getDefaultState()); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 2, 2, k1 - 2, Blocks.web.getDefaultState()); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 0, 2, k1 + 2, Blocks.web.getDefaultState()); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 2, 2, k1 + 2, Blocks.web.getDefaultState()); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 1, 2, k1 - 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.05F, 1, 2, k1 + 1, Blocks.torch.getStateFromMeta(EnumFacing.UP.getIndex())); + + if (randomIn.nextInt(100) == 0) + { + this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 2, 0, k1 - 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.CHEST_CONTENT_WEIGHT_LIST, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 3 + randomIn.nextInt(4)); + } + + if (randomIn.nextInt(100) == 0) + { + this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 0, 0, k1 + 1, WeightedRandomChestContent.func_177629_a(StructureMineshaftPieces.CHEST_CONTENT_WEIGHT_LIST, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 3 + randomIn.nextInt(4)); + } + + if (this.hasSpiders && !this.spawnerPlaced) + { + int l1 = this.getYWithOffset(0); + int i2 = k1 - 1 + randomIn.nextInt(3); + int j2 = this.getXWithOffset(1, i2); + i2 = this.getZWithOffset(1, i2); + BlockPos blockpos = new BlockPos(j2, l1, i2); + + if (structureBoundingBoxIn.isVecInside(blockpos)) + { + this.spawnerPlaced = true; + worldIn.setBlockState(blockpos, Blocks.mob_spawner.getDefaultState(), 2); + TileEntity tileentity = worldIn.getTileEntity(blockpos); + + if (tileentity instanceof TileEntityMobSpawner) + { + ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic().setEntityName("CaveSpider"); + } + } + } + } + + for (int k2 = 0; k2 <= 2; ++k2) + { + for (int i3 = 0; i3 <= i1; ++i3) + { + int j3 = -1; + IBlockState iblockstate1 = this.getBlockStateFromPos(worldIn, k2, j3, i3, structureBoundingBoxIn); + + if (iblockstate1.getBlock().getMaterial() == Material.air) + { + int k3 = -1; + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), k2, k3, i3, structureBoundingBoxIn); + } + } + } + + if (this.hasRails) + { + for (int l2 = 0; l2 <= i1; ++l2) + { + IBlockState iblockstate = this.getBlockStateFromPos(worldIn, 1, -1, l2, structureBoundingBoxIn); + + if (iblockstate.getBlock().getMaterial() != Material.air && iblockstate.getBlock().isFullBlock()) + { + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.7F, 1, 0, l2, Blocks.rail.getStateFromMeta(this.getMetadataWithOffset(Blocks.rail, 0))); + } + } + } + + return true; + } + } + } + + public static class Cross extends StructureComponent + { + private EnumFacing corridorDirection; + private boolean isMultipleFloors; + + public Cross() + { + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + tagCompound.setBoolean("tf", this.isMultipleFloors); + tagCompound.setInteger("D", this.corridorDirection.getHorizontalIndex()); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + this.isMultipleFloors = tagCompound.getBoolean("tf"); + this.corridorDirection = EnumFacing.getHorizontal(tagCompound.getInteger("D")); + } + + public Cross(int type, Random rand, StructureBoundingBox structurebb, EnumFacing facing) + { + super(type); + this.corridorDirection = facing; + this.boundingBox = structurebb; + this.isMultipleFloors = structurebb.getYSize() > 3; + } + + public static StructureBoundingBox func_175813_a(List listIn, Random rand, int x, int y, int z, EnumFacing facing) + { + StructureBoundingBox structureboundingbox = new StructureBoundingBox(x, y, z, x, y + 2, z); + + if (rand.nextInt(4) == 0) + { + structureboundingbox.maxY += 4; + } + + switch (facing) + { + case NORTH: + structureboundingbox.minX = x - 1; + structureboundingbox.maxX = x + 3; + structureboundingbox.minZ = z - 4; + break; + + case SOUTH: + structureboundingbox.minX = x - 1; + structureboundingbox.maxX = x + 3; + structureboundingbox.maxZ = z + 4; + break; + + case WEST: + structureboundingbox.minX = x - 4; + structureboundingbox.minZ = z - 1; + structureboundingbox.maxZ = z + 3; + break; + + case EAST: + structureboundingbox.maxX = x + 4; + structureboundingbox.minZ = z - 1; + structureboundingbox.maxZ = z + 3; + } + + return StructureComponent.findIntersecting(listIn, structureboundingbox) != null ? null : structureboundingbox; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + int i = this.getComponentType(); + + switch (this.corridorDirection) + { + case NORTH: + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, i); + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, EnumFacing.WEST, i); + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, EnumFacing.EAST, i); + break; + + case SOUTH: + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, i); + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, EnumFacing.WEST, i); + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, EnumFacing.EAST, i); + break; + + case WEST: + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, i); + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, i); + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, EnumFacing.WEST, i); + break; + + case EAST: + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, i); + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, i); + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, EnumFacing.EAST, i); + } + + if (this.isMultipleFloors) + { + if (rand.nextBoolean()) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ - 1, EnumFacing.NORTH, i); + } + + if (rand.nextBoolean()) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ + 1, EnumFacing.WEST, i); + } + + if (rand.nextBoolean()) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ + 1, EnumFacing.EAST, i); + } + + if (rand.nextBoolean()) + { + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, i); + } + } + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + if (this.isMultipleFloors) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.minY + 3 - 1, this.boundingBox.maxZ, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.minY + 3 - 1, this.boundingBox.maxZ - 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.minX + 1, this.boundingBox.maxY - 2, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.minX, this.boundingBox.maxY - 2, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ - 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.minX + 1, this.boundingBox.minY + 3, this.boundingBox.minZ + 1, this.boundingBox.maxX - 1, this.boundingBox.minY + 3, this.boundingBox.maxZ - 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ - 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.minX + 1, this.boundingBox.maxY, this.boundingBox.minZ + 1, Blocks.planks.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ - 1, this.boundingBox.minX + 1, this.boundingBox.maxY, this.boundingBox.maxZ - 1, Blocks.planks.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.maxX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.minZ + 1, Blocks.planks.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.maxX - 1, this.boundingBox.minY, this.boundingBox.maxZ - 1, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ - 1, Blocks.planks.getDefaultState(), Blocks.air.getDefaultState(), false); + + for (int i = this.boundingBox.minX; i <= this.boundingBox.maxX; ++i) + { + for (int j = this.boundingBox.minZ; j <= this.boundingBox.maxZ; ++j) + { + if (this.getBlockStateFromPos(worldIn, i, this.boundingBox.minY - 1, j, structureBoundingBoxIn).getBlock().getMaterial() == Material.air) + { + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), i, this.boundingBox.minY - 1, j, structureBoundingBoxIn); + } + } + } + + return true; + } + } + } + + public static class Room extends StructureComponent + { + private List roomsLinkedToTheRoom = Lists.newLinkedList(); + + public Room() + { + } + + public Room(int type, Random rand, int x, int z) + { + super(type); + this.boundingBox = new StructureBoundingBox(x, 50, z, x + 7 + rand.nextInt(6), 54 + rand.nextInt(6), z + 7 + rand.nextInt(6)); + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + int i = this.getComponentType(); + int j = this.boundingBox.getYSize() - 3 - 1; + + if (j <= 0) + { + j = 1; + } + + for (int k = 0; k < this.boundingBox.getXSize(); k = k + 4) + { + k = k + rand.nextInt(this.boundingBox.getXSize()); + + if (k + 3 > this.boundingBox.getXSize()) + { + break; + } + + StructureComponent structurecomponent = StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX + k, this.boundingBox.minY + rand.nextInt(j) + 1, this.boundingBox.minZ - 1, EnumFacing.NORTH, i); + + if (structurecomponent != null) + { + StructureBoundingBox structureboundingbox = structurecomponent.getBoundingBox(); + this.roomsLinkedToTheRoom.add(new StructureBoundingBox(structureboundingbox.minX, structureboundingbox.minY, this.boundingBox.minZ, structureboundingbox.maxX, structureboundingbox.maxY, this.boundingBox.minZ + 1)); + } + } + + for (int k = 0; k < this.boundingBox.getXSize(); k = k + 4) + { + k = k + rand.nextInt(this.boundingBox.getXSize()); + + if (k + 3 > this.boundingBox.getXSize()) + { + break; + } + + StructureComponent structurecomponent1 = StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX + k, this.boundingBox.minY + rand.nextInt(j) + 1, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, i); + + if (structurecomponent1 != null) + { + StructureBoundingBox structureboundingbox1 = structurecomponent1.getBoundingBox(); + this.roomsLinkedToTheRoom.add(new StructureBoundingBox(structureboundingbox1.minX, structureboundingbox1.minY, this.boundingBox.maxZ - 1, structureboundingbox1.maxX, structureboundingbox1.maxY, this.boundingBox.maxZ)); + } + } + + for (int k = 0; k < this.boundingBox.getZSize(); k = k + 4) + { + k = k + rand.nextInt(this.boundingBox.getZSize()); + + if (k + 3 > this.boundingBox.getZSize()) + { + break; + } + + StructureComponent structurecomponent2 = StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY + rand.nextInt(j) + 1, this.boundingBox.minZ + k, EnumFacing.WEST, i); + + if (structurecomponent2 != null) + { + StructureBoundingBox structureboundingbox2 = structurecomponent2.getBoundingBox(); + this.roomsLinkedToTheRoom.add(new StructureBoundingBox(this.boundingBox.minX, structureboundingbox2.minY, structureboundingbox2.minZ, this.boundingBox.minX + 1, structureboundingbox2.maxY, structureboundingbox2.maxZ)); + } + } + + for (int k = 0; k < this.boundingBox.getZSize(); k = k + 4) + { + k = k + rand.nextInt(this.boundingBox.getZSize()); + + if (k + 3 > this.boundingBox.getZSize()) + { + break; + } + + StructureComponent structurecomponent3 = StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + rand.nextInt(j) + 1, this.boundingBox.minZ + k, EnumFacing.EAST, i); + + if (structurecomponent3 != null) + { + StructureBoundingBox structureboundingbox3 = structurecomponent3.getBoundingBox(); + this.roomsLinkedToTheRoom.add(new StructureBoundingBox(this.boundingBox.maxX - 1, structureboundingbox3.minY, structureboundingbox3.minZ, this.boundingBox.maxX, structureboundingbox3.maxY, structureboundingbox3.maxZ)); + } + } + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX, this.boundingBox.minY, this.boundingBox.maxZ, Blocks.dirt.getDefaultState(), Blocks.air.getDefaultState(), true); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.minX, this.boundingBox.minY + 1, this.boundingBox.minZ, this.boundingBox.maxX, Math.min(this.boundingBox.minY + 3, this.boundingBox.maxY), this.boundingBox.maxZ, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + + for (StructureBoundingBox structureboundingbox : this.roomsLinkedToTheRoom) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, structureboundingbox.minX, structureboundingbox.maxY - 2, structureboundingbox.minZ, structureboundingbox.maxX, structureboundingbox.maxY, structureboundingbox.maxZ, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + this.randomlyRareFillWithBlocks(worldIn, structureBoundingBoxIn, this.boundingBox.minX, this.boundingBox.minY + 4, this.boundingBox.minZ, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ, Blocks.air.getDefaultState(), false); + return true; + } + } + + public void func_181138_a(int p_181138_1_, int p_181138_2_, int p_181138_3_) + { + super.func_181138_a(p_181138_1_, p_181138_2_, p_181138_3_); + + for (StructureBoundingBox structureboundingbox : this.roomsLinkedToTheRoom) + { + structureboundingbox.offset(p_181138_1_, p_181138_2_, p_181138_3_); + } + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + NBTTagList nbttaglist = new NBTTagList(); + + for (StructureBoundingBox structureboundingbox : this.roomsLinkedToTheRoom) + { + nbttaglist.appendTag(structureboundingbox.toNBTTagIntArray()); + } + + tagCompound.setTag("Entrances", nbttaglist); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + NBTTagList nbttaglist = tagCompound.getTagList("Entrances", 11); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + this.roomsLinkedToTheRoom.add(new StructureBoundingBox(nbttaglist.getIntArrayAt(i))); + } + } + } + + public static class Stairs extends StructureComponent + { + public Stairs() + { + } + + public Stairs(int type, Random rand, StructureBoundingBox structurebb, EnumFacing facing) + { + super(type); + this.coordBaseMode = facing; + this.boundingBox = structurebb; + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + } + + public static StructureBoundingBox func_175812_a(List listIn, Random rand, int x, int y, int z, EnumFacing facing) + { + StructureBoundingBox structureboundingbox = new StructureBoundingBox(x, y - 5, z, x, y + 2, z); + + switch (facing) + { + case NORTH: + structureboundingbox.maxX = x + 2; + structureboundingbox.minZ = z - 8; + break; + + case SOUTH: + structureboundingbox.maxX = x + 2; + structureboundingbox.maxZ = z + 8; + break; + + case WEST: + structureboundingbox.minX = x - 8; + structureboundingbox.maxZ = z + 2; + break; + + case EAST: + structureboundingbox.maxX = x + 8; + structureboundingbox.maxZ = z + 2; + } + + return StructureComponent.findIntersecting(listIn, structureboundingbox) != null ? null : structureboundingbox; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + int i = this.getComponentType(); + + if (this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case NORTH: + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, i); + break; + + case SOUTH: + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, i); + break; + + case WEST: + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ, EnumFacing.WEST, i); + break; + + case EAST: + StructureMineshaftPieces.func_175890_b(componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ, EnumFacing.EAST, i); + } + } + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 2, 7, 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 7, 2, 2, 8, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + + for (int i = 0; i < 5; ++i) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5 - i - (i < 4 ? 1 : 0), 2 + i, 2, 7 - i, 2 + i, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + return true; + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/StructureMineshaftStart.java b/src/minecraft/net/minecraft/world/gen/structure/StructureMineshaftStart.java new file mode 100644 index 0000000..37b2c47 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/StructureMineshaftStart.java @@ -0,0 +1,21 @@ +package net.minecraft.world.gen.structure; + +import java.util.Random; +import net.minecraft.world.World; + +public class StructureMineshaftStart extends StructureStart +{ + public StructureMineshaftStart() + { + } + + public StructureMineshaftStart(World worldIn, Random rand, int chunkX, int chunkZ) + { + super(chunkX, chunkZ); + StructureMineshaftPieces.Room structuremineshaftpieces$room = new StructureMineshaftPieces.Room(0, rand, (chunkX << 4) + 2, (chunkZ << 4) + 2); + this.components.add(structuremineshaftpieces$room); + structuremineshaftpieces$room.buildComponent(structuremineshaftpieces$room, this.components, rand); + this.updateBoundingBox(); + this.markAvailableHeight(worldIn, rand, 10); + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java b/src/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java new file mode 100644 index 0000000..23f1ac8 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java @@ -0,0 +1,1398 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Random; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityMobSpawner; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.world.World; + +@SuppressWarnings("incomplete-switch") +public class StructureNetherBridgePieces +{ + private static final StructureNetherBridgePieces.PieceWeight[] primaryComponents = new StructureNetherBridgePieces.PieceWeight[] {new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Straight.class, 30, 0, true), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Crossing3.class, 10, 4), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Crossing.class, 10, 4), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Stairs.class, 10, 3), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Throne.class, 5, 2), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Entrance.class, 5, 1)}; + private static final StructureNetherBridgePieces.PieceWeight[] secondaryComponents = new StructureNetherBridgePieces.PieceWeight[] {new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Corridor5.class, 25, 0, true), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Crossing2.class, 15, 5), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Corridor2.class, 5, 10), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Corridor.class, 5, 10), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Corridor3.class, 10, 3, true), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.Corridor4.class, 7, 2), new StructureNetherBridgePieces.PieceWeight(StructureNetherBridgePieces.NetherStalkRoom.class, 5, 2)}; + + public static void registerNetherFortressPieces() + { + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Crossing3.class, "NeBCr"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.End.class, "NeBEF"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Straight.class, "NeBS"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor3.class, "NeCCS"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor4.class, "NeCTB"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Entrance.class, "NeCE"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Crossing2.class, "NeSCSC"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor.class, "NeSCLT"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor5.class, "NeSC"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Corridor2.class, "NeSCRT"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.NetherStalkRoom.class, "NeCSR"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Throne.class, "NeMT"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Crossing.class, "NeRC"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Stairs.class, "NeSR"); + MapGenStructureIO.registerStructureComponent(StructureNetherBridgePieces.Start.class, "NeStart"); + } + + private static StructureNetherBridgePieces.Piece func_175887_b(StructureNetherBridgePieces.PieceWeight p_175887_0_, List p_175887_1_, Random p_175887_2_, int p_175887_3_, int p_175887_4_, int p_175887_5_, EnumFacing p_175887_6_, int p_175887_7_) + { + Class oclass = p_175887_0_.weightClass; + StructureNetherBridgePieces.Piece structurenetherbridgepieces$piece = null; + + if (oclass == StructureNetherBridgePieces.Straight.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.Straight.func_175882_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_); + } + else if (oclass == StructureNetherBridgePieces.Crossing3.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.Crossing3.func_175885_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_); + } + else if (oclass == StructureNetherBridgePieces.Crossing.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.Crossing.func_175873_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_); + } + else if (oclass == StructureNetherBridgePieces.Stairs.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.Stairs.func_175872_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_7_, p_175887_6_); + } + else if (oclass == StructureNetherBridgePieces.Throne.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.Throne.func_175874_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_7_, p_175887_6_); + } + else if (oclass == StructureNetherBridgePieces.Entrance.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.Entrance.func_175881_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_); + } + else if (oclass == StructureNetherBridgePieces.Corridor5.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.Corridor5.func_175877_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_); + } + else if (oclass == StructureNetherBridgePieces.Corridor2.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.Corridor2.func_175876_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_); + } + else if (oclass == StructureNetherBridgePieces.Corridor.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.Corridor.func_175879_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_); + } + else if (oclass == StructureNetherBridgePieces.Corridor3.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.Corridor3.func_175883_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_); + } + else if (oclass == StructureNetherBridgePieces.Corridor4.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.Corridor4.func_175880_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_); + } + else if (oclass == StructureNetherBridgePieces.Crossing2.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.Crossing2.func_175878_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_); + } + else if (oclass == StructureNetherBridgePieces.NetherStalkRoom.class) + { + structurenetherbridgepieces$piece = StructureNetherBridgePieces.NetherStalkRoom.func_175875_a(p_175887_1_, p_175887_2_, p_175887_3_, p_175887_4_, p_175887_5_, p_175887_6_, p_175887_7_); + } + + return structurenetherbridgepieces$piece; + } + + public static class Corridor extends StructureNetherBridgePieces.Piece + { + private boolean field_111021_b; + + public Corridor() + { + } + + public Corridor(int p_i45615_1_, Random p_i45615_2_, StructureBoundingBox p_i45615_3_, EnumFacing p_i45615_4_) + { + super(p_i45615_1_); + this.coordBaseMode = p_i45615_4_; + this.boundingBox = p_i45615_3_; + this.field_111021_b = p_i45615_2_.nextInt(3) == 0; + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.field_111021_b = tagCompound.getBoolean("Chest"); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("Chest", this.field_111021_b); + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentX((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 0, 1, true); + } + + public static StructureNetherBridgePieces.Corridor func_175879_a(List p_175879_0_, Random p_175879_1_, int p_175879_2_, int p_175879_3_, int p_175879_4_, EnumFacing p_175879_5_, int p_175879_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175879_2_, p_175879_3_, p_175879_4_, -1, 0, 0, 5, 7, 5, p_175879_5_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175879_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.Corridor(p_175879_6_, p_175879_1_, structureboundingbox, p_175879_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 1, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 4, 5, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 2, 0, 4, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 3, 1, 4, 4, 1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 3, 3, 4, 4, 3, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 5, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 4, 3, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 4, 1, 4, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 3, 4, 3, 4, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + if (this.field_111021_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + { + this.field_111021_b = false; + this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, field_111019_a, 2 + randomIn.nextInt(4)); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + for (int i = 0; i <= 4; ++i) + { + for (int j = 0; j <= 4; ++j) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), i, -1, j, structureBoundingBoxIn); + } + } + + return true; + } + } + + public static class Corridor2 extends StructureNetherBridgePieces.Piece + { + private boolean field_111020_b; + + public Corridor2() + { + } + + public Corridor2(int p_i45613_1_, Random p_i45613_2_, StructureBoundingBox p_i45613_3_, EnumFacing p_i45613_4_) + { + super(p_i45613_1_); + this.coordBaseMode = p_i45613_4_; + this.boundingBox = p_i45613_3_; + this.field_111020_b = p_i45613_2_.nextInt(3) == 0; + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.field_111020_b = tagCompound.getBoolean("Chest"); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("Chest", this.field_111020_b); + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentZ((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 0, 1, true); + } + + public static StructureNetherBridgePieces.Corridor2 func_175876_a(List p_175876_0_, Random p_175876_1_, int p_175876_2_, int p_175876_3_, int p_175876_4_, EnumFacing p_175876_5_, int p_175876_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175876_2_, p_175876_3_, p_175876_4_, -1, 0, 0, 5, 7, 5, p_175876_5_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175876_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.Corridor2(p_175876_6_, p_175876_1_, structureboundingbox, p_175876_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 1, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 4, 5, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 1, 0, 4, 1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 3, 0, 4, 3, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 2, 0, 4, 5, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 4, 4, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 4, 1, 4, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 3, 4, 3, 4, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + if (this.field_111020_b && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(1, 3), this.getYWithOffset(2), this.getZWithOffset(1, 3)))) + { + this.field_111020_b = false; + this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 1, 2, 3, field_111019_a, 2 + randomIn.nextInt(4)); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + for (int i = 0; i <= 4; ++i) + { + for (int j = 0; j <= 4; ++j) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), i, -1, j, structureBoundingBoxIn); + } + } + + return true; + } + } + + public static class Corridor3 extends StructureNetherBridgePieces.Piece + { + public Corridor3() + { + } + + public Corridor3(int p_i45619_1_, Random p_i45619_2_, StructureBoundingBox p_i45619_3_, EnumFacing p_i45619_4_) + { + super(p_i45619_1_); + this.coordBaseMode = p_i45619_4_; + this.boundingBox = p_i45619_3_; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 1, 0, true); + } + + public static StructureNetherBridgePieces.Corridor3 func_175883_a(List p_175883_0_, Random p_175883_1_, int p_175883_2_, int p_175883_3_, int p_175883_4_, EnumFacing p_175883_5_, int p_175883_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175883_2_, p_175883_3_, p_175883_4_, -1, -7, 0, 5, 14, 10, p_175883_5_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175883_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.Corridor3(p_175883_6_, p_175883_1_, structureboundingbox, p_175883_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + int i = this.getMetadataWithOffset(Blocks.nether_brick_stairs, 2); + + for (int j = 0; j <= 9; ++j) + { + int k = Math.max(1, 7 - j); + int l = Math.min(Math.max(k + 5, 14 - j), 13); + int i1 = j; + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, j, 4, k, j, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, k + 1, j, 3, l - 1, j, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + + if (j <= 6) + { + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(i), 1, k + 1, j, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(i), 2, k + 1, j, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(i), 3, k + 1, j, structureBoundingBoxIn); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, l, j, 4, l, j, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, k + 1, j, 0, l - 1, j, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, k + 1, j, 4, l - 1, j, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + if ((j & 1) == 0) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, k + 2, j, 0, k + 3, j, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, k + 2, j, 4, k + 3, j, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + } + + for (int j1 = 0; j1 <= 4; ++j1) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), j1, -1, i1, structureBoundingBoxIn); + } + } + + return true; + } + } + + public static class Corridor4 extends StructureNetherBridgePieces.Piece + { + public Corridor4() + { + } + + public Corridor4(int p_i45618_1_, Random p_i45618_2_, StructureBoundingBox p_i45618_3_, EnumFacing p_i45618_4_) + { + super(p_i45618_1_); + this.coordBaseMode = p_i45618_4_; + this.boundingBox = p_i45618_3_; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + int i = 1; + + if (this.coordBaseMode == EnumFacing.WEST || this.coordBaseMode == EnumFacing.NORTH) + { + i = 5; + } + + this.getNextComponentX((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 0, i, rand.nextInt(8) > 0); + this.getNextComponentZ((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 0, i, rand.nextInt(8) > 0); + } + + public static StructureNetherBridgePieces.Corridor4 func_175880_a(List p_175880_0_, Random p_175880_1_, int p_175880_2_, int p_175880_3_, int p_175880_4_, EnumFacing p_175880_5_, int p_175880_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175880_2_, p_175880_3_, p_175880_4_, -3, 0, 0, 9, 7, 9, p_175880_5_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175880_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.Corridor4(p_175880_6_, p_175880_1_, structureboundingbox, p_175880_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 8, 1, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 8, 5, 8, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 8, 6, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 2, 5, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 2, 0, 8, 5, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 0, 1, 4, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 3, 0, 7, 4, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 4, 8, 2, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 4, 2, 2, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 4, 7, 2, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 8, 8, 3, 8, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 6, 0, 3, 7, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 3, 6, 8, 3, 7, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 4, 0, 5, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 3, 4, 8, 5, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 5, 2, 5, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 3, 5, 7, 5, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 5, 1, 5, 5, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 4, 5, 7, 5, 5, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + + for (int i = 0; i <= 5; ++i) + { + for (int j = 0; j <= 8; ++j) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), j, -1, i, structureBoundingBoxIn); + } + } + + return true; + } + } + + public static class Corridor5 extends StructureNetherBridgePieces.Piece + { + public Corridor5() + { + } + + public Corridor5(int p_i45614_1_, Random p_i45614_2_, StructureBoundingBox p_i45614_3_, EnumFacing p_i45614_4_) + { + super(p_i45614_1_); + this.coordBaseMode = p_i45614_4_; + this.boundingBox = p_i45614_3_; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 1, 0, true); + } + + public static StructureNetherBridgePieces.Corridor5 func_175877_a(List p_175877_0_, Random p_175877_1_, int p_175877_2_, int p_175877_3_, int p_175877_4_, EnumFacing p_175877_5_, int p_175877_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175877_2_, p_175877_3_, p_175877_4_, -1, 0, 0, 5, 7, 5, p_175877_5_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175877_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.Corridor5(p_175877_6_, p_175877_1_, structureboundingbox, p_175877_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 1, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 4, 5, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 2, 0, 4, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 1, 0, 4, 1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 3, 0, 4, 3, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 3, 1, 4, 4, 1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 3, 3, 4, 4, 3, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + for (int i = 0; i <= 4; ++i) + { + for (int j = 0; j <= 4; ++j) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), i, -1, j, structureBoundingBoxIn); + } + } + + return true; + } + } + + public static class Crossing extends StructureNetherBridgePieces.Piece + { + public Crossing() + { + } + + public Crossing(int p_i45610_1_, Random p_i45610_2_, StructureBoundingBox p_i45610_3_, EnumFacing p_i45610_4_) + { + super(p_i45610_1_); + this.coordBaseMode = p_i45610_4_; + this.boundingBox = p_i45610_3_; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 2, 0, false); + this.getNextComponentX((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 0, 2, false); + this.getNextComponentZ((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 0, 2, false); + } + + public static StructureNetherBridgePieces.Crossing func_175873_a(List p_175873_0_, Random p_175873_1_, int p_175873_2_, int p_175873_3_, int p_175873_4_, EnumFacing p_175873_5_, int p_175873_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175873_2_, p_175873_3_, p_175873_4_, -2, 0, 0, 7, 9, 7, p_175873_5_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175873_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.Crossing(p_175873_6_, p_175873_1_, structureboundingbox, p_175873_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 6, 1, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 6, 7, 6, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 1, 6, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 6, 1, 6, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 0, 6, 6, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 6, 6, 6, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 6, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 5, 0, 6, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 2, 0, 6, 6, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 2, 5, 6, 6, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 6, 0, 4, 6, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 0, 4, 5, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 6, 6, 4, 6, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 6, 4, 5, 6, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 2, 0, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 2, 0, 5, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 6, 2, 6, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 5, 2, 6, 5, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + + for (int i = 0; i <= 6; ++i) + { + for (int j = 0; j <= 6; ++j) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), i, -1, j, structureBoundingBoxIn); + } + } + + return true; + } + } + + public static class Crossing2 extends StructureNetherBridgePieces.Piece + { + public Crossing2() + { + } + + public Crossing2(int p_i45616_1_, Random p_i45616_2_, StructureBoundingBox p_i45616_3_, EnumFacing p_i45616_4_) + { + super(p_i45616_1_); + this.coordBaseMode = p_i45616_4_; + this.boundingBox = p_i45616_3_; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 1, 0, true); + this.getNextComponentX((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 0, 1, true); + this.getNextComponentZ((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 0, 1, true); + } + + public static StructureNetherBridgePieces.Crossing2 func_175878_a(List p_175878_0_, Random p_175878_1_, int p_175878_2_, int p_175878_3_, int p_175878_4_, EnumFacing p_175878_5_, int p_175878_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175878_2_, p_175878_3_, p_175878_4_, -1, 0, 0, 5, 7, 5, p_175878_5_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175878_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.Crossing2(p_175878_6_, p_175878_1_, structureboundingbox, p_175878_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 1, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 4, 5, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 5, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 2, 0, 4, 5, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 4, 0, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 2, 4, 4, 5, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 0, 4, 6, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + for (int i = 0; i <= 4; ++i) + { + for (int j = 0; j <= 4; ++j) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), i, -1, j, structureBoundingBoxIn); + } + } + + return true; + } + } + + public static class Crossing3 extends StructureNetherBridgePieces.Piece + { + public Crossing3() + { + } + + public Crossing3(int p_i45622_1_, Random p_i45622_2_, StructureBoundingBox p_i45622_3_, EnumFacing p_i45622_4_) + { + super(p_i45622_1_); + this.coordBaseMode = p_i45622_4_; + this.boundingBox = p_i45622_3_; + } + + protected Crossing3(Random p_i2042_1_, int p_i2042_2_, int p_i2042_3_) + { + super(0); + this.coordBaseMode = EnumFacing.Plane.HORIZONTAL.random(p_i2042_1_); + + switch (this.coordBaseMode) + { + case NORTH: + case SOUTH: + this.boundingBox = new StructureBoundingBox(p_i2042_2_, 64, p_i2042_3_, p_i2042_2_ + 19 - 1, 73, p_i2042_3_ + 19 - 1); + break; + + default: + this.boundingBox = new StructureBoundingBox(p_i2042_2_, 64, p_i2042_3_, p_i2042_2_ + 19 - 1, 73, p_i2042_3_ + 19 - 1); + } + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 8, 3, false); + this.getNextComponentX((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 3, 8, false); + this.getNextComponentZ((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 3, 8, false); + } + + public static StructureNetherBridgePieces.Crossing3 func_175885_a(List p_175885_0_, Random p_175885_1_, int p_175885_2_, int p_175885_3_, int p_175885_4_, EnumFacing p_175885_5_, int p_175885_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175885_2_, p_175885_3_, p_175885_4_, -8, -3, 0, 19, 10, 19, p_175885_5_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175885_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.Crossing3(p_175885_6_, p_175885_1_, structureboundingbox, p_175885_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 3, 0, 11, 4, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 7, 18, 4, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 0, 10, 7, 18, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 8, 18, 7, 10, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 5, 0, 7, 5, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 5, 11, 7, 5, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 5, 0, 11, 5, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 5, 11, 11, 5, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 7, 7, 5, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 5, 7, 18, 5, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 11, 7, 5, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 5, 11, 18, 5, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 0, 11, 2, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 13, 11, 2, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 0, 0, 11, 1, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 0, 15, 11, 1, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + for (int i = 7; i <= 11; ++i) + { + for (int j = 0; j <= 2; ++j) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), i, -1, j, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), i, -1, 18 - j, structureBoundingBoxIn); + } + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 7, 5, 2, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 13, 2, 7, 18, 2, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 7, 3, 1, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 15, 0, 7, 18, 1, 11, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + for (int k = 0; k <= 2; ++k) + { + for (int l = 7; l <= 11; ++l) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), k, -1, l, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), 18 - k, -1, l, structureBoundingBoxIn); + } + } + + return true; + } + } + + public static class End extends StructureNetherBridgePieces.Piece + { + private int fillSeed; + + public End() + { + } + + public End(int p_i45621_1_, Random p_i45621_2_, StructureBoundingBox p_i45621_3_, EnumFacing p_i45621_4_) + { + super(p_i45621_1_); + this.coordBaseMode = p_i45621_4_; + this.boundingBox = p_i45621_3_; + this.fillSeed = p_i45621_2_.nextInt(); + } + + public static StructureNetherBridgePieces.End func_175884_a(List p_175884_0_, Random p_175884_1_, int p_175884_2_, int p_175884_3_, int p_175884_4_, EnumFacing p_175884_5_, int p_175884_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175884_2_, p_175884_3_, p_175884_4_, -1, -3, 0, 5, 10, 8, p_175884_5_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175884_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.End(p_175884_6_, p_175884_1_, structureboundingbox, p_175884_5_) : null; + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.fillSeed = tagCompound.getInteger("Seed"); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setInteger("Seed", this.fillSeed); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + Random random = new Random((long)this.fillSeed); + + for (int i = 0; i <= 4; ++i) + { + for (int j = 3; j <= 4; ++j) + { + int k = random.nextInt(8); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, i, j, 0, i, j, k, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + } + } + + int l = random.nextInt(8); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 0, 5, l, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + l = random.nextInt(8); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 5, 0, 4, 5, l, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + for (l = 0; l <= 4; ++l) + { + int i1 = random.nextInt(5); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, l, 2, 0, l, 2, i1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + } + + for (l = 0; l <= 4; ++l) + { + for (int j1 = 0; j1 <= 1; ++j1) + { + int k1 = random.nextInt(3); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, l, j1, 0, l, j1, k1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + } + } + + return true; + } + } + + public static class Entrance extends StructureNetherBridgePieces.Piece + { + public Entrance() + { + } + + public Entrance(int p_i45617_1_, Random p_i45617_2_, StructureBoundingBox p_i45617_3_, EnumFacing p_i45617_4_) + { + super(p_i45617_1_); + this.coordBaseMode = p_i45617_4_; + this.boundingBox = p_i45617_3_; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 5, 3, true); + } + + public static StructureNetherBridgePieces.Entrance func_175881_a(List p_175881_0_, Random p_175881_1_, int p_175881_2_, int p_175881_3_, int p_175881_4_, EnumFacing p_175881_5_, int p_175881_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175881_2_, p_175881_3_, p_175881_4_, -5, -3, 0, 13, 14, 13, p_175881_5_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175881_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.Entrance(p_175881_6_, p_175881_1_, structureboundingbox, p_175881_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 0, 12, 4, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 12, 13, 12, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 1, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 5, 0, 12, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 11, 4, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 11, 10, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 9, 11, 7, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 0, 4, 12, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 0, 10, 12, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 9, 0, 7, 12, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 11, 2, 10, 12, 10, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 8, 0, 7, 8, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + + for (int i = 1; i <= 11; i += 2) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, i, 10, 0, i, 11, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, i, 10, 12, i, 11, 12, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 10, i, 0, 11, i, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 10, i, 12, 11, i, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.nether_brick.getDefaultState(), i, 13, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick.getDefaultState(), i, 13, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick.getDefaultState(), 0, 13, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick.getDefaultState(), 12, 13, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), i + 1, 13, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), i + 1, 13, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, i + 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 12, 13, i + 1, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 12, 13, 0, structureBoundingBoxIn); + + for (int k = 3; k <= 9; k += 2) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 7, k, 1, 8, k, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 7, k, 11, 8, k, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 2, 0, 8, 2, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 4, 12, 2, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 0, 8, 1, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 9, 8, 1, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 4, 3, 1, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 0, 4, 12, 1, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + for (int l = 4; l <= 8; ++l) + { + for (int j = 0; j <= 2; ++j) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), l, -1, j, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), l, -1, 12 - j, structureBoundingBoxIn); + } + } + + for (int i1 = 0; i1 <= 2; ++i1) + { + for (int j1 = 4; j1 <= 8; ++j1) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), i1, -1, j1, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), 12 - i1, -1, j1, structureBoundingBoxIn); + } + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, 5, 7, 5, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 6, 6, 4, 6, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.nether_brick.getDefaultState(), 6, 0, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.flowing_lava.getDefaultState(), 6, 5, 6, structureBoundingBoxIn); + BlockPos blockpos = new BlockPos(this.getXWithOffset(6, 6), this.getYWithOffset(5), this.getZWithOffset(6, 6)); + + if (structureBoundingBoxIn.isVecInside(blockpos)) + { + worldIn.forceBlockUpdateTick(Blocks.flowing_lava, blockpos, randomIn); + } + + return true; + } + } + + public static class NetherStalkRoom extends StructureNetherBridgePieces.Piece + { + public NetherStalkRoom() + { + } + + public NetherStalkRoom(int p_i45612_1_, Random p_i45612_2_, StructureBoundingBox p_i45612_3_, EnumFacing p_i45612_4_) + { + super(p_i45612_1_); + this.coordBaseMode = p_i45612_4_; + this.boundingBox = p_i45612_3_; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 5, 3, true); + this.getNextComponentNormal((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 5, 11, true); + } + + public static StructureNetherBridgePieces.NetherStalkRoom func_175875_a(List p_175875_0_, Random p_175875_1_, int p_175875_2_, int p_175875_3_, int p_175875_4_, EnumFacing p_175875_5_, int p_175875_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175875_2_, p_175875_3_, p_175875_4_, -5, -3, 0, 13, 14, 13, p_175875_5_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175875_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.NetherStalkRoom(p_175875_6_, p_175875_1_, structureboundingbox, p_175875_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 0, 12, 4, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 12, 13, 12, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 1, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 5, 0, 12, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 11, 4, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 11, 10, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 9, 11, 7, 12, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 0, 4, 12, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 0, 10, 12, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 9, 0, 7, 12, 1, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 11, 2, 10, 12, 10, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + for (int i = 1; i <= 11; i += 2) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, i, 10, 0, i, 11, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, i, 10, 12, i, 11, 12, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 10, i, 0, 11, i, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 10, i, 12, 11, i, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.nether_brick.getDefaultState(), i, 13, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick.getDefaultState(), i, 13, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick.getDefaultState(), 0, 13, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick.getDefaultState(), 12, 13, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), i + 1, 13, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), i + 1, 13, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, i + 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 12, 13, i + 1, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 0, 13, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 12, 13, 0, structureBoundingBoxIn); + + for (int j1 = 3; j1 <= 9; j1 += 2) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 7, j1, 1, 8, j1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 7, j1, 11, 8, j1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + } + + int k1 = this.getMetadataWithOffset(Blocks.nether_brick_stairs, 3); + + for (int j = 0; j <= 6; ++j) + { + int k = j + 4; + + for (int l = 5; l <= 7; ++l) + { + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(k1), l, 5 + j, k, structureBoundingBoxIn); + } + + if (k >= 5 && k <= 8) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, k, 7, j + 4, k, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + } + else if (k >= 9 && k <= 10) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 8, k, 7, j + 4, k, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + } + + if (j >= 1) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 6 + j, k, 7, 9 + j, k, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + } + + for (int l1 = 5; l1 <= 7; ++l1) + { + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(k1), l1, 12, 11, structureBoundingBoxIn); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 6, 7, 5, 7, 7, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 6, 7, 7, 7, 7, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 13, 12, 7, 13, 12, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 2, 3, 5, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 9, 3, 5, 10, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 4, 2, 5, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 5, 2, 10, 5, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 5, 9, 10, 5, 10, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 5, 4, 10, 5, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + int i2 = this.getMetadataWithOffset(Blocks.nether_brick_stairs, 0); + int j2 = this.getMetadataWithOffset(Blocks.nether_brick_stairs, 1); + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(j2), 4, 5, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(j2), 4, 5, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(j2), 4, 5, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(j2), 4, 5, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(i2), 8, 5, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(i2), 8, 5, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(i2), 8, 5, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_stairs.getStateFromMeta(i2), 8, 5, 10, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 4, 4, 4, 4, 8, Blocks.soul_sand.getDefaultState(), Blocks.soul_sand.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 4, 4, 9, 4, 8, Blocks.soul_sand.getDefaultState(), Blocks.soul_sand.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 5, 4, 4, 5, 8, Blocks.nether_wart.getDefaultState(), Blocks.nether_wart.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 4, 9, 5, 8, Blocks.nether_wart.getDefaultState(), Blocks.nether_wart.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 2, 0, 8, 2, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 4, 12, 2, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 0, 8, 1, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 9, 8, 1, 12, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 4, 3, 1, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 0, 4, 12, 1, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + for (int k2 = 4; k2 <= 8; ++k2) + { + for (int i1 = 0; i1 <= 2; ++i1) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), k2, -1, i1, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), k2, -1, 12 - i1, structureBoundingBoxIn); + } + } + + for (int l2 = 0; l2 <= 2; ++l2) + { + for (int i3 = 4; i3 <= 8; ++i3) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), l2, -1, i3, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), 12 - l2, -1, i3, structureBoundingBoxIn); + } + } + + return true; + } + } + + abstract static class Piece extends StructureComponent + { + protected static final List field_111019_a = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 5), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 5), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 15), new WeightedRandomChestContent(Items.golden_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.flint_and_steel, 0, 1, 1, 5), new WeightedRandomChestContent(Items.nether_wart, 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 10), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 8), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 5), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 3), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 2, 4, 2)}); + + public Piece() + { + } + + protected Piece(int p_i2054_1_) + { + super(p_i2054_1_); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + } + + private int getTotalWeight(List p_74960_1_) + { + boolean flag = false; + int i = 0; + + for (StructureNetherBridgePieces.PieceWeight structurenetherbridgepieces$pieceweight : p_74960_1_) + { + if (structurenetherbridgepieces$pieceweight.field_78824_d > 0 && structurenetherbridgepieces$pieceweight.field_78827_c < structurenetherbridgepieces$pieceweight.field_78824_d) + { + flag = true; + } + + i += structurenetherbridgepieces$pieceweight.field_78826_b; + } + + return flag ? i : -1; + } + + private StructureNetherBridgePieces.Piece func_175871_a(StructureNetherBridgePieces.Start p_175871_1_, List p_175871_2_, List p_175871_3_, Random p_175871_4_, int p_175871_5_, int p_175871_6_, int p_175871_7_, EnumFacing p_175871_8_, int p_175871_9_) + { + int i = this.getTotalWeight(p_175871_2_); + boolean flag = i > 0 && p_175871_9_ <= 30; + int j = 0; + + while (j < 5 && flag) + { + ++j; + int k = p_175871_4_.nextInt(i); + + for (StructureNetherBridgePieces.PieceWeight structurenetherbridgepieces$pieceweight : p_175871_2_) + { + k -= structurenetherbridgepieces$pieceweight.field_78826_b; + + if (k < 0) + { + if (!structurenetherbridgepieces$pieceweight.func_78822_a(p_175871_9_) || structurenetherbridgepieces$pieceweight == p_175871_1_.theNetherBridgePieceWeight && !structurenetherbridgepieces$pieceweight.field_78825_e) + { + break; + } + + StructureNetherBridgePieces.Piece structurenetherbridgepieces$piece = StructureNetherBridgePieces.func_175887_b(structurenetherbridgepieces$pieceweight, p_175871_3_, p_175871_4_, p_175871_5_, p_175871_6_, p_175871_7_, p_175871_8_, p_175871_9_); + + if (structurenetherbridgepieces$piece != null) + { + ++structurenetherbridgepieces$pieceweight.field_78827_c; + p_175871_1_.theNetherBridgePieceWeight = structurenetherbridgepieces$pieceweight; + + if (!structurenetherbridgepieces$pieceweight.func_78823_a()) + { + p_175871_2_.remove(structurenetherbridgepieces$pieceweight); + } + + return structurenetherbridgepieces$piece; + } + } + } + } + + return StructureNetherBridgePieces.End.func_175884_a(p_175871_3_, p_175871_4_, p_175871_5_, p_175871_6_, p_175871_7_, p_175871_8_, p_175871_9_); + } + + private StructureComponent func_175870_a(StructureNetherBridgePieces.Start p_175870_1_, List p_175870_2_, Random p_175870_3_, int p_175870_4_, int p_175870_5_, int p_175870_6_, EnumFacing p_175870_7_, int p_175870_8_, boolean p_175870_9_) + { + if (Math.abs(p_175870_4_ - p_175870_1_.getBoundingBox().minX) <= 112 && Math.abs(p_175870_6_ - p_175870_1_.getBoundingBox().minZ) <= 112) + { + List list = p_175870_1_.primaryWeights; + + if (p_175870_9_) + { + list = p_175870_1_.secondaryWeights; + } + + StructureComponent structurecomponent = this.func_175871_a(p_175870_1_, list, p_175870_2_, p_175870_3_, p_175870_4_, p_175870_5_, p_175870_6_, p_175870_7_, p_175870_8_ + 1); + + if (structurecomponent != null) + { + p_175870_2_.add(structurecomponent); + p_175870_1_.field_74967_d.add(structurecomponent); + } + + return structurecomponent; + } + else + { + return StructureNetherBridgePieces.End.func_175884_a(p_175870_2_, p_175870_3_, p_175870_4_, p_175870_5_, p_175870_6_, p_175870_7_, p_175870_8_); + } + } + + protected StructureComponent getNextComponentNormal(StructureNetherBridgePieces.Start p_74963_1_, List p_74963_2_, Random p_74963_3_, int p_74963_4_, int p_74963_5_, boolean p_74963_6_) + { + if (this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case NORTH: + return this.func_175870_a(p_74963_1_, p_74963_2_, p_74963_3_, this.boundingBox.minX + p_74963_4_, this.boundingBox.minY + p_74963_5_, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType(), p_74963_6_); + + case SOUTH: + return this.func_175870_a(p_74963_1_, p_74963_2_, p_74963_3_, this.boundingBox.minX + p_74963_4_, this.boundingBox.minY + p_74963_5_, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType(), p_74963_6_); + + case WEST: + return this.func_175870_a(p_74963_1_, p_74963_2_, p_74963_3_, this.boundingBox.minX - 1, this.boundingBox.minY + p_74963_5_, this.boundingBox.minZ + p_74963_4_, this.coordBaseMode, this.getComponentType(), p_74963_6_); + + case EAST: + return this.func_175870_a(p_74963_1_, p_74963_2_, p_74963_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74963_5_, this.boundingBox.minZ + p_74963_4_, this.coordBaseMode, this.getComponentType(), p_74963_6_); + } + } + + return null; + } + + protected StructureComponent getNextComponentX(StructureNetherBridgePieces.Start p_74961_1_, List p_74961_2_, Random p_74961_3_, int p_74961_4_, int p_74961_5_, boolean p_74961_6_) + { + if (this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case NORTH: + return this.func_175870_a(p_74961_1_, p_74961_2_, p_74961_3_, this.boundingBox.minX - 1, this.boundingBox.minY + p_74961_4_, this.boundingBox.minZ + p_74961_5_, EnumFacing.WEST, this.getComponentType(), p_74961_6_); + + case SOUTH: + return this.func_175870_a(p_74961_1_, p_74961_2_, p_74961_3_, this.boundingBox.minX - 1, this.boundingBox.minY + p_74961_4_, this.boundingBox.minZ + p_74961_5_, EnumFacing.WEST, this.getComponentType(), p_74961_6_); + + case WEST: + return this.func_175870_a(p_74961_1_, p_74961_2_, p_74961_3_, this.boundingBox.minX + p_74961_5_, this.boundingBox.minY + p_74961_4_, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType(), p_74961_6_); + + case EAST: + return this.func_175870_a(p_74961_1_, p_74961_2_, p_74961_3_, this.boundingBox.minX + p_74961_5_, this.boundingBox.minY + p_74961_4_, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType(), p_74961_6_); + } + } + + return null; + } + + protected StructureComponent getNextComponentZ(StructureNetherBridgePieces.Start p_74965_1_, List p_74965_2_, Random p_74965_3_, int p_74965_4_, int p_74965_5_, boolean p_74965_6_) + { + if (this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case NORTH: + return this.func_175870_a(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74965_4_, this.boundingBox.minZ + p_74965_5_, EnumFacing.EAST, this.getComponentType(), p_74965_6_); + + case SOUTH: + return this.func_175870_a(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74965_4_, this.boundingBox.minZ + p_74965_5_, EnumFacing.EAST, this.getComponentType(), p_74965_6_); + + case WEST: + return this.func_175870_a(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.minX + p_74965_5_, this.boundingBox.minY + p_74965_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType(), p_74965_6_); + + case EAST: + return this.func_175870_a(p_74965_1_, p_74965_2_, p_74965_3_, this.boundingBox.minX + p_74965_5_, this.boundingBox.minY + p_74965_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType(), p_74965_6_); + } + } + + return null; + } + + protected static boolean isAboveGround(StructureBoundingBox p_74964_0_) + { + return p_74964_0_ != null && p_74964_0_.minY > 10; + } + } + + static class PieceWeight + { + public Class weightClass; + public final int field_78826_b; + public int field_78827_c; + public int field_78824_d; + public boolean field_78825_e; + + public PieceWeight(Class p_i2055_1_, int p_i2055_2_, int p_i2055_3_, boolean p_i2055_4_) + { + this.weightClass = p_i2055_1_; + this.field_78826_b = p_i2055_2_; + this.field_78824_d = p_i2055_3_; + this.field_78825_e = p_i2055_4_; + } + + public PieceWeight(Class p_i2056_1_, int p_i2056_2_, int p_i2056_3_) + { + this(p_i2056_1_, p_i2056_2_, p_i2056_3_, false); + } + + public boolean func_78822_a(int p_78822_1_) + { + return this.field_78824_d == 0 || this.field_78827_c < this.field_78824_d; + } + + public boolean func_78823_a() + { + return this.field_78824_d == 0 || this.field_78827_c < this.field_78824_d; + } + } + + public static class Stairs extends StructureNetherBridgePieces.Piece + { + public Stairs() + { + } + + public Stairs(int p_i45609_1_, Random p_i45609_2_, StructureBoundingBox p_i45609_3_, EnumFacing p_i45609_4_) + { + super(p_i45609_1_); + this.coordBaseMode = p_i45609_4_; + this.boundingBox = p_i45609_3_; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentZ((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 6, 2, false); + } + + public static StructureNetherBridgePieces.Stairs func_175872_a(List p_175872_0_, Random p_175872_1_, int p_175872_2_, int p_175872_3_, int p_175872_4_, int p_175872_5_, EnumFacing p_175872_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175872_2_, p_175872_3_, p_175872_4_, -2, 0, 0, 7, 11, 7, p_175872_6_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175872_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.Stairs(p_175872_5_, p_175872_1_, structureboundingbox, p_175872_6_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 6, 1, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 6, 10, 6, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 1, 8, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 0, 6, 8, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 1, 0, 8, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 2, 1, 6, 8, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 6, 5, 8, 6, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 2, 0, 5, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 3, 2, 6, 5, 2, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 3, 4, 6, 5, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.nether_brick.getDefaultState(), 5, 2, 5, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 2, 5, 4, 3, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 2, 5, 3, 4, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 2, 5, 2, 5, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 5, 1, 6, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 7, 1, 5, 7, 4, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 8, 2, 6, 8, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 6, 0, 4, 8, 0, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 0, 4, 5, 0, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + + for (int i = 0; i <= 6; ++i) + { + for (int j = 0; j <= 6; ++j) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), i, -1, j, structureBoundingBoxIn); + } + } + + return true; + } + } + + public static class Start extends StructureNetherBridgePieces.Crossing3 + { + public StructureNetherBridgePieces.PieceWeight theNetherBridgePieceWeight; + public List primaryWeights; + public List secondaryWeights; + public List field_74967_d = Lists.newArrayList(); + + public Start() + { + } + + public Start(Random p_i2059_1_, int p_i2059_2_, int p_i2059_3_) + { + super(p_i2059_1_, p_i2059_2_, p_i2059_3_); + this.primaryWeights = Lists.newArrayList(); + + for (StructureNetherBridgePieces.PieceWeight structurenetherbridgepieces$pieceweight : StructureNetherBridgePieces.primaryComponents) + { + structurenetherbridgepieces$pieceweight.field_78827_c = 0; + this.primaryWeights.add(structurenetherbridgepieces$pieceweight); + } + + this.secondaryWeights = Lists.newArrayList(); + + for (StructureNetherBridgePieces.PieceWeight structurenetherbridgepieces$pieceweight1 : StructureNetherBridgePieces.secondaryComponents) + { + structurenetherbridgepieces$pieceweight1.field_78827_c = 0; + this.secondaryWeights.add(structurenetherbridgepieces$pieceweight1); + } + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + } + } + + public static class Straight extends StructureNetherBridgePieces.Piece + { + public Straight() + { + } + + public Straight(int p_i45620_1_, Random p_i45620_2_, StructureBoundingBox p_i45620_3_, EnumFacing p_i45620_4_) + { + super(p_i45620_1_); + this.coordBaseMode = p_i45620_4_; + this.boundingBox = p_i45620_3_; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureNetherBridgePieces.Start)componentIn, listIn, rand, 1, 3, false); + } + + public static StructureNetherBridgePieces.Straight func_175882_a(List p_175882_0_, Random p_175882_1_, int p_175882_2_, int p_175882_3_, int p_175882_4_, EnumFacing p_175882_5_, int p_175882_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175882_2_, p_175882_3_, p_175882_4_, -1, -3, 0, 5, 10, 19, p_175882_5_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175882_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.Straight(p_175882_6_, p_175882_1_, structureboundingbox, p_175882_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 0, 4, 4, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 0, 3, 7, 18, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 0, 5, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 5, 0, 4, 5, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 4, 2, 5, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 13, 4, 2, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 1, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 15, 4, 1, 18, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + + for (int i = 0; i <= 4; ++i) + { + for (int j = 0; j <= 2; ++j) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), i, -1, j, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), i, -1, 18 - j, structureBoundingBoxIn); + } + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 4, 1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 4, 0, 4, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 14, 0, 4, 14, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 17, 0, 4, 17, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 4, 4, 1, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 3, 4, 4, 4, 4, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 3, 14, 4, 4, 14, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 17, 4, 4, 17, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + return true; + } + } + + public static class Throne extends StructureNetherBridgePieces.Piece + { + private boolean hasSpawner; + + public Throne() + { + } + + public Throne(int p_i45611_1_, Random p_i45611_2_, StructureBoundingBox p_i45611_3_, EnumFacing p_i45611_4_) + { + super(p_i45611_1_); + this.coordBaseMode = p_i45611_4_; + this.boundingBox = p_i45611_3_; + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.hasSpawner = tagCompound.getBoolean("Mob"); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("Mob", this.hasSpawner); + } + + public static StructureNetherBridgePieces.Throne func_175874_a(List p_175874_0_, Random p_175874_1_, int p_175874_2_, int p_175874_3_, int p_175874_4_, int p_175874_5_, EnumFacing p_175874_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175874_2_, p_175874_3_, p_175874_4_, -2, 0, 0, 7, 8, 9, p_175874_6_); + return isAboveGround(structureboundingbox) && StructureComponent.findIntersecting(p_175874_0_, structureboundingbox) == null ? new StructureNetherBridgePieces.Throne(p_175874_5_, p_175874_1_, structureboundingbox, p_175874_6_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 6, 7, 7, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 5, 1, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 1, 5, 2, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 2, 5, 3, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 3, 5, 4, 7, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 1, 4, 2, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 0, 5, 4, 2, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 2, 1, 5, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, 2, 5, 5, 3, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 3, 0, 5, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 5, 3, 6, 5, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 8, 5, 5, 8, Blocks.nether_brick.getDefaultState(), Blocks.nether_brick.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 1, 6, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.nether_brick_fence.getDefaultState(), 5, 6, 3, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 3, 0, 6, 8, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 6, 3, 6, 6, 8, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 6, 8, 5, 7, 8, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 8, 8, 4, 8, 8, Blocks.nether_brick_fence.getDefaultState(), Blocks.nether_brick_fence.getDefaultState(), false); + + if (!this.hasSpawner) + { + BlockPos blockpos = new BlockPos(this.getXWithOffset(3, 5), this.getYWithOffset(5), this.getZWithOffset(3, 5)); + + if (structureBoundingBoxIn.isVecInside(blockpos)) + { + this.hasSpawner = true; + worldIn.setBlockState(blockpos, Blocks.mob_spawner.getDefaultState(), 2); + TileEntity tileentity = worldIn.getTileEntity(blockpos); + + if (tileentity instanceof TileEntityMobSpawner) + { + ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic().setEntityName("Blaze"); + } + } + } + + for (int i = 0; i <= 6; ++i) + { + for (int j = 0; j <= 6; ++j) + { + this.replaceAirAndLiquidDownwards(worldIn, Blocks.nether_brick.getDefaultState(), i, -1, j, structureBoundingBoxIn); + } + } + + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/StructureOceanMonument.java b/src/minecraft/net/minecraft/world/gen/structure/StructureOceanMonument.java new file mode 100644 index 0000000..717162c --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/StructureOceanMonument.java @@ -0,0 +1,197 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.Map.Entry; +import net.minecraft.entity.monster.EntityGuardian; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; + +public class StructureOceanMonument extends MapGenStructure +{ + private int field_175800_f; + private int field_175801_g; + public static final List field_175802_d = Arrays.asList(new BiomeGenBase[] {BiomeGenBase.ocean, BiomeGenBase.deepOcean, BiomeGenBase.river, BiomeGenBase.frozenOcean, BiomeGenBase.frozenRiver}); + private static final List field_175803_h = Lists.newArrayList(); + + public StructureOceanMonument() + { + this.field_175800_f = 32; + this.field_175801_g = 5; + } + + public StructureOceanMonument(Map p_i45608_1_) + { + this(); + + for (Entry entry : p_i45608_1_.entrySet()) + { + if (((String)entry.getKey()).equals("spacing")) + { + this.field_175800_f = MathHelper.parseIntWithDefaultAndMax((String)entry.getValue(), this.field_175800_f, 1); + } + else if (((String)entry.getKey()).equals("separation")) + { + this.field_175801_g = MathHelper.parseIntWithDefaultAndMax((String)entry.getValue(), this.field_175801_g, 1); + } + } + } + + public String getStructureName() + { + return "Monument"; + } + + protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) + { + int i = chunkX; + int j = chunkZ; + + if (chunkX < 0) + { + chunkX -= this.field_175800_f - 1; + } + + if (chunkZ < 0) + { + chunkZ -= this.field_175800_f - 1; + } + + int k = chunkX / this.field_175800_f; + int l = chunkZ / this.field_175800_f; + Random random = this.worldObj.setRandomSeed(k, l, 10387313); + k = k * this.field_175800_f; + l = l * this.field_175800_f; + k = k + (random.nextInt(this.field_175800_f - this.field_175801_g) + random.nextInt(this.field_175800_f - this.field_175801_g)) / 2; + l = l + (random.nextInt(this.field_175800_f - this.field_175801_g) + random.nextInt(this.field_175800_f - this.field_175801_g)) / 2; + + if (i == k && j == l) + { + if (this.worldObj.getWorldChunkManager().getBiomeGenerator(new BlockPos(i * 16 + 8, 64, j * 16 + 8), (BiomeGenBase)null) != BiomeGenBase.deepOcean) + { + return false; + } + + boolean flag = this.worldObj.getWorldChunkManager().areBiomesViable(i * 16 + 8, j * 16 + 8, 29, field_175802_d); + + if (flag) + { + return true; + } + } + + return false; + } + + protected StructureStart getStructureStart(int chunkX, int chunkZ) + { + return new StructureOceanMonument.StartMonument(this.worldObj, this.rand, chunkX, chunkZ); + } + + public List func_175799_b() + { + return field_175803_h; + } + + static + { + field_175803_h.add(new BiomeGenBase.SpawnListEntry(EntityGuardian.class, 1, 2, 4)); + } + + public static class StartMonument extends StructureStart + { + private Set field_175791_c = Sets.newHashSet(); + private boolean field_175790_d; + + public StartMonument() + { + } + + public StartMonument(World worldIn, Random p_i45607_2_, int p_i45607_3_, int p_i45607_4_) + { + super(p_i45607_3_, p_i45607_4_); + this.func_175789_b(worldIn, p_i45607_2_, p_i45607_3_, p_i45607_4_); + } + + private void func_175789_b(World worldIn, Random p_175789_2_, int p_175789_3_, int p_175789_4_) + { + p_175789_2_.setSeed(worldIn.getSeed()); + long i = p_175789_2_.nextLong(); + long j = p_175789_2_.nextLong(); + long k = (long)p_175789_3_ * i; + long l = (long)p_175789_4_ * j; + p_175789_2_.setSeed(k ^ l ^ worldIn.getSeed()); + int i1 = p_175789_3_ * 16 + 8 - 29; + int j1 = p_175789_4_ * 16 + 8 - 29; + EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(p_175789_2_); + this.components.add(new StructureOceanMonumentPieces.MonumentBuilding(p_175789_2_, i1, j1, enumfacing)); + this.updateBoundingBox(); + this.field_175790_d = true; + } + + public void generateStructure(World worldIn, Random rand, StructureBoundingBox structurebb) + { + if (!this.field_175790_d) + { + this.components.clear(); + this.func_175789_b(worldIn, rand, this.getChunkPosX(), this.getChunkPosZ()); + } + + super.generateStructure(worldIn, rand, structurebb); + } + + public boolean func_175788_a(ChunkCoordIntPair pair) + { + return this.field_175791_c.contains(pair) ? false : super.func_175788_a(pair); + } + + public void func_175787_b(ChunkCoordIntPair pair) + { + super.func_175787_b(pair); + this.field_175791_c.add(pair); + } + + public void writeToNBT(NBTTagCompound tagCompound) + { + super.writeToNBT(tagCompound); + NBTTagList nbttaglist = new NBTTagList(); + + for (ChunkCoordIntPair chunkcoordintpair : this.field_175791_c) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("X", chunkcoordintpair.chunkXPos); + nbttagcompound.setInteger("Z", chunkcoordintpair.chunkZPos); + nbttaglist.appendTag(nbttagcompound); + } + + tagCompound.setTag("Processed", nbttaglist); + } + + public void readFromNBT(NBTTagCompound tagCompound) + { + super.readFromNBT(tagCompound); + + if (tagCompound.hasKey("Processed", 9)) + { + NBTTagList nbttaglist = tagCompound.getTagList("Processed", 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + this.field_175791_c.add(new ChunkCoordIntPair(nbttagcompound.getInteger("X"), nbttagcompound.getInteger("Z"))); + } + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/StructureOceanMonumentPieces.java b/src/minecraft/net/minecraft/world/gen/structure/StructureOceanMonumentPieces.java new file mode 100644 index 0000000..854d443 --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/StructureOceanMonumentPieces.java @@ -0,0 +1,2238 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.collect.Lists; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import net.minecraft.block.BlockPrismarine; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.monster.EntityGuardian; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class StructureOceanMonumentPieces +{ + public static void registerOceanMonumentPieces() + { + MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.MonumentBuilding.class, "OMB"); + MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.MonumentCoreRoom.class, "OMCR"); + MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleXRoom.class, "OMDXR"); + MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleXYRoom.class, "OMDXYR"); + MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleYRoom.class, "OMDYR"); + MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleYZRoom.class, "OMDYZR"); + MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.DoubleZRoom.class, "OMDZR"); + MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.EntryRoom.class, "OMEntry"); + MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.Penthouse.class, "OMPenthouse"); + MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.SimpleRoom.class, "OMSimple"); + MapGenStructureIO.registerStructureComponent(StructureOceanMonumentPieces.SimpleTopRoom.class, "OMSimpleT"); + } + + public static class DoubleXRoom extends StructureOceanMonumentPieces.Piece + { + public DoubleXRoom() + { + } + + public DoubleXRoom(EnumFacing p_i45597_1_, StructureOceanMonumentPieces.RoomDefinition p_i45597_2_, Random p_i45597_3_) + { + super(1, p_i45597_1_, p_i45597_2_, 2, 1, 1); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition = this.field_175830_k.field_175965_b[EnumFacing.EAST.getIndex()]; + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition1 = this.field_175830_k; + + if (this.field_175830_k.field_175967_a / 25 > 0) + { + this.func_175821_a(worldIn, structureBoundingBoxIn, 8, 0, structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.DOWN.getIndex()]); + this.func_175821_a(worldIn, structureBoundingBoxIn, 0, 0, structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.DOWN.getIndex()]); + } + + if (structureoceanmonumentpieces$roomdefinition1.field_175965_b[EnumFacing.UP.getIndex()] == null) + { + this.func_175819_a(worldIn, structureBoundingBoxIn, 1, 4, 1, 7, 4, 6, field_175828_a); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175965_b[EnumFacing.UP.getIndex()] == null) + { + this.func_175819_a(worldIn, structureBoundingBoxIn, 8, 4, 1, 14, 4, 6, field_175828_a); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 0, 0, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 15, 3, 0, 15, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 0, 15, 3, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 7, 14, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 2, 7, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 15, 2, 0, 15, 2, 7, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 15, 2, 0, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 7, 14, 2, 7, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 15, 1, 0, 15, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 15, 1, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 7, 14, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 0, 10, 1, 4, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 2, 0, 9, 2, 3, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 3, 0, 10, 3, 4, field_175826_b, field_175826_b, false); + this.setBlockState(worldIn, field_175825_e, 6, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 9, 2, 3, structureBoundingBoxIn); + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 1, 0, 4, 2, 0, false); + } + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 1, 7, 4, 2, 7, false); + } + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 0, 1, 3, 0, 2, 4, false); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 11, 1, 0, 12, 2, 0, false); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 11, 1, 7, 12, 2, 7, false); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 15, 1, 3, 15, 2, 4, false); + } + + return true; + } + } + + public static class DoubleXYRoom extends StructureOceanMonumentPieces.Piece + { + public DoubleXYRoom() + { + } + + public DoubleXYRoom(EnumFacing p_i45596_1_, StructureOceanMonumentPieces.RoomDefinition p_i45596_2_, Random p_i45596_3_) + { + super(1, p_i45596_1_, p_i45596_2_, 2, 2, 1); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition = this.field_175830_k.field_175965_b[EnumFacing.EAST.getIndex()]; + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition1 = this.field_175830_k; + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition2 = structureoceanmonumentpieces$roomdefinition1.field_175965_b[EnumFacing.UP.getIndex()]; + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition3 = structureoceanmonumentpieces$roomdefinition.field_175965_b[EnumFacing.UP.getIndex()]; + + if (this.field_175830_k.field_175967_a / 25 > 0) + { + this.func_175821_a(worldIn, structureBoundingBoxIn, 8, 0, structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.DOWN.getIndex()]); + this.func_175821_a(worldIn, structureBoundingBoxIn, 0, 0, structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.DOWN.getIndex()]); + } + + if (structureoceanmonumentpieces$roomdefinition2.field_175965_b[EnumFacing.UP.getIndex()] == null) + { + this.func_175819_a(worldIn, structureBoundingBoxIn, 1, 8, 1, 7, 8, 6, field_175828_a); + } + + if (structureoceanmonumentpieces$roomdefinition3.field_175965_b[EnumFacing.UP.getIndex()] == null) + { + this.func_175819_a(worldIn, structureBoundingBoxIn, 8, 8, 1, 14, 8, 6, field_175828_a); + } + + for (int i = 1; i <= 7; ++i) + { + IBlockState iblockstate = field_175826_b; + + if (i == 2 || i == 6) + { + iblockstate = field_175828_a; + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, i, 0, 0, i, 7, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 15, i, 0, 15, i, 7, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, i, 0, 15, i, 0, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, i, 7, 14, i, 7, iblockstate, iblockstate, false); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 3, 2, 7, 4, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 2, 4, 7, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 5, 4, 7, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 13, 1, 3, 13, 7, 4, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 1, 2, 12, 7, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 1, 5, 12, 7, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 3, 5, 3, 4, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 1, 3, 10, 3, 4, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 7, 2, 10, 7, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, 2, 5, 7, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 5, 2, 10, 7, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, 5, 5, 7, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 5, 5, 10, 7, 5, field_175826_b, field_175826_b, false); + this.setBlockState(worldIn, field_175826_b, 6, 6, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 9, 6, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 6, 6, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 9, 6, 5, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 4, 3, 6, 4, 4, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 4, 3, 10, 4, 4, field_175826_b, field_175826_b, false); + this.setBlockState(worldIn, field_175825_e, 5, 4, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 5, 4, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 10, 4, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 10, 4, 5, structureBoundingBoxIn); + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 1, 0, 4, 2, 0, false); + } + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 1, 7, 4, 2, 7, false); + } + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 0, 1, 3, 0, 2, 4, false); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 11, 1, 0, 12, 2, 0, false); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 11, 1, 7, 12, 2, 7, false); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 15, 1, 3, 15, 2, 4, false); + } + + if (structureoceanmonumentpieces$roomdefinition2.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 5, 0, 4, 6, 0, false); + } + + if (structureoceanmonumentpieces$roomdefinition2.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 5, 7, 4, 6, 7, false); + } + + if (structureoceanmonumentpieces$roomdefinition2.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 0, 5, 3, 0, 6, 4, false); + } + + if (structureoceanmonumentpieces$roomdefinition3.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 11, 5, 0, 12, 6, 0, false); + } + + if (structureoceanmonumentpieces$roomdefinition3.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 11, 5, 7, 12, 6, 7, false); + } + + if (structureoceanmonumentpieces$roomdefinition3.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 15, 5, 3, 15, 6, 4, false); + } + + return true; + } + } + + public static class DoubleYRoom extends StructureOceanMonumentPieces.Piece + { + public DoubleYRoom() + { + } + + public DoubleYRoom(EnumFacing p_i45595_1_, StructureOceanMonumentPieces.RoomDefinition p_i45595_2_, Random p_i45595_3_) + { + super(1, p_i45595_1_, p_i45595_2_, 1, 2, 1); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_175830_k.field_175967_a / 25 > 0) + { + this.func_175821_a(worldIn, structureBoundingBoxIn, 0, 0, this.field_175830_k.field_175966_c[EnumFacing.DOWN.getIndex()]); + } + + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition = this.field_175830_k.field_175965_b[EnumFacing.UP.getIndex()]; + + if (structureoceanmonumentpieces$roomdefinition.field_175965_b[EnumFacing.UP.getIndex()] == null) + { + this.func_175819_a(worldIn, structureBoundingBoxIn, 1, 8, 1, 6, 8, 6, field_175828_a); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 0, 0, 4, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 4, 0, 7, 4, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 0, 6, 4, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 7, 6, 4, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 4, 1, 2, 4, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 2, 1, 4, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 4, 1, 5, 4, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 4, 2, 6, 4, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 4, 5, 2, 4, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 5, 1, 4, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 4, 5, 5, 4, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 4, 5, 6, 4, 5, field_175826_b, field_175826_b, false); + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition1 = this.field_175830_k; + + for (int i = 1; i <= 5; i += 4) + { + int j = 0; + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, i, j, 2, i + 2, j, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, i, j, 5, i + 2, j, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, i + 2, j, 4, i + 2, j, field_175826_b, field_175826_b, false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, i, j, 7, i + 2, j, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, i + 1, j, 7, i + 1, j, field_175828_a, field_175828_a, false); + } + + j = 7; + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, i, j, 2, i + 2, j, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, i, j, 5, i + 2, j, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, i + 2, j, 4, i + 2, j, field_175826_b, field_175826_b, false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, i, j, 7, i + 2, j, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, i + 1, j, 7, i + 1, j, field_175828_a, field_175828_a, false); + } + + int k = 0; + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, k, i, 2, k, i + 2, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, k, i, 5, k, i + 2, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, k, i + 2, 3, k, i + 2, 4, field_175826_b, field_175826_b, false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, k, i, 0, k, i + 2, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, k, i + 1, 0, k, i + 1, 7, field_175828_a, field_175828_a, false); + } + + k = 7; + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, k, i, 2, k, i + 2, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, k, i, 5, k, i + 2, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, k, i + 2, 3, k, i + 2, 4, field_175826_b, field_175826_b, false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, k, i, 0, k, i + 2, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, k, i + 1, 0, k, i + 1, 7, field_175828_a, field_175828_a, false); + } + + structureoceanmonumentpieces$roomdefinition1 = structureoceanmonumentpieces$roomdefinition; + } + + return true; + } + } + + public static class DoubleYZRoom extends StructureOceanMonumentPieces.Piece + { + public DoubleYZRoom() + { + } + + public DoubleYZRoom(EnumFacing p_i45594_1_, StructureOceanMonumentPieces.RoomDefinition p_i45594_2_, Random p_i45594_3_) + { + super(1, p_i45594_1_, p_i45594_2_, 1, 2, 2); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition = this.field_175830_k.field_175965_b[EnumFacing.NORTH.getIndex()]; + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition1 = this.field_175830_k; + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition2 = structureoceanmonumentpieces$roomdefinition.field_175965_b[EnumFacing.UP.getIndex()]; + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition3 = structureoceanmonumentpieces$roomdefinition1.field_175965_b[EnumFacing.UP.getIndex()]; + + if (this.field_175830_k.field_175967_a / 25 > 0) + { + this.func_175821_a(worldIn, structureBoundingBoxIn, 0, 8, structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.DOWN.getIndex()]); + this.func_175821_a(worldIn, structureBoundingBoxIn, 0, 0, structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.DOWN.getIndex()]); + } + + if (structureoceanmonumentpieces$roomdefinition3.field_175965_b[EnumFacing.UP.getIndex()] == null) + { + this.func_175819_a(worldIn, structureBoundingBoxIn, 1, 8, 1, 6, 8, 7, field_175828_a); + } + + if (structureoceanmonumentpieces$roomdefinition2.field_175965_b[EnumFacing.UP.getIndex()] == null) + { + this.func_175819_a(worldIn, structureBoundingBoxIn, 1, 8, 8, 6, 8, 14, field_175828_a); + } + + for (int i = 1; i <= 7; ++i) + { + IBlockState iblockstate = field_175826_b; + + if (i == 2 || i == 6) + { + iblockstate = field_175828_a; + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, i, 0, 0, i, 15, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, i, 0, 7, i, 15, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, i, 0, 6, i, 0, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, i, 15, 6, i, 15, iblockstate, iblockstate, false); + } + + for (int j = 1; j <= 7; ++j) + { + IBlockState iblockstate1 = field_175827_c; + + if (j == 2 || j == 6) + { + iblockstate1 = field_175825_e; + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, j, 7, 4, j, 8, iblockstate1, iblockstate1, false); + } + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 1, 0, 4, 2, 0, false); + } + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 7, 1, 3, 7, 2, 4, false); + } + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 0, 1, 3, 0, 2, 4, false); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 1, 15, 4, 2, 15, false); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 0, 1, 11, 0, 2, 12, false); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 7, 1, 11, 7, 2, 12, false); + } + + if (structureoceanmonumentpieces$roomdefinition3.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 5, 0, 4, 6, 0, false); + } + + if (structureoceanmonumentpieces$roomdefinition3.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 7, 5, 3, 7, 6, 4, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 4, 2, 6, 4, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 2, 6, 3, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 5, 6, 3, 5, field_175826_b, field_175826_b, false); + } + + if (structureoceanmonumentpieces$roomdefinition3.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 0, 5, 3, 0, 6, 4, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 2, 2, 4, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 2, 1, 3, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 5, 1, 3, 5, field_175826_b, field_175826_b, false); + } + + if (structureoceanmonumentpieces$roomdefinition2.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 5, 15, 4, 6, 15, false); + } + + if (structureoceanmonumentpieces$roomdefinition2.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 0, 5, 11, 0, 6, 12, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 10, 2, 4, 13, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 10, 1, 3, 10, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 13, 1, 3, 13, field_175826_b, field_175826_b, false); + } + + if (structureoceanmonumentpieces$roomdefinition2.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 7, 5, 11, 7, 6, 12, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 4, 10, 6, 4, 13, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 10, 6, 3, 10, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 13, 6, 3, 13, field_175826_b, field_175826_b, false); + } + + return true; + } + } + + public static class DoubleZRoom extends StructureOceanMonumentPieces.Piece + { + public DoubleZRoom() + { + } + + public DoubleZRoom(EnumFacing p_i45593_1_, StructureOceanMonumentPieces.RoomDefinition p_i45593_2_, Random p_i45593_3_) + { + super(1, p_i45593_1_, p_i45593_2_, 1, 1, 2); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition = this.field_175830_k.field_175965_b[EnumFacing.NORTH.getIndex()]; + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition1 = this.field_175830_k; + + if (this.field_175830_k.field_175967_a / 25 > 0) + { + this.func_175821_a(worldIn, structureBoundingBoxIn, 0, 8, structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.DOWN.getIndex()]); + this.func_175821_a(worldIn, structureBoundingBoxIn, 0, 0, structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.DOWN.getIndex()]); + } + + if (structureoceanmonumentpieces$roomdefinition1.field_175965_b[EnumFacing.UP.getIndex()] == null) + { + this.func_175819_a(worldIn, structureBoundingBoxIn, 1, 4, 1, 6, 4, 7, field_175828_a); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175965_b[EnumFacing.UP.getIndex()] == null) + { + this.func_175819_a(worldIn, structureBoundingBoxIn, 1, 4, 8, 6, 4, 14, field_175828_a); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 0, 0, 3, 15, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 3, 0, 7, 3, 15, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 0, 7, 3, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 15, 6, 3, 15, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 2, 15, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 0, 7, 2, 15, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 7, 2, 0, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 15, 6, 2, 15, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 1, 15, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 1, 0, 7, 1, 15, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 7, 1, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 15, 6, 1, 15, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 1, 1, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 1, 6, 1, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 1, 1, 3, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 3, 1, 6, 3, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 13, 1, 1, 14, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 13, 6, 1, 14, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 13, 1, 3, 14, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 3, 13, 6, 3, 14, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 6, 2, 3, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 6, 5, 3, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 9, 2, 3, 9, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 9, 5, 3, 9, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 2, 6, 4, 2, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 2, 9, 4, 2, 9, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 2, 7, 2, 2, 8, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 7, 5, 2, 8, field_175826_b, field_175826_b, false); + this.setBlockState(worldIn, field_175825_e, 2, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 5, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 2, 2, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 5, 2, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 2, 3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 5, 3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 2, 3, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 5, 3, 10, structureBoundingBoxIn); + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 1, 0, 4, 2, 0, false); + } + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 7, 1, 3, 7, 2, 4, false); + } + + if (structureoceanmonumentpieces$roomdefinition1.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 0, 1, 3, 0, 2, 4, false); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 1, 15, 4, 2, 15, false); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 0, 1, 11, 0, 2, 12, false); + } + + if (structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 7, 1, 11, 7, 2, 12, false); + } + + return true; + } + } + + public static class EntryRoom extends StructureOceanMonumentPieces.Piece + { + public EntryRoom() + { + } + + public EntryRoom(EnumFacing p_i45592_1_, StructureOceanMonumentPieces.RoomDefinition p_i45592_2_) + { + super(1, p_i45592_1_, p_i45592_2_, 1, 1, 1); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 0, 2, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 3, 0, 7, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 1, 2, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 2, 0, 7, 2, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 1, 0, 7, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 7, 7, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 2, 3, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 0, 6, 3, 0, field_175826_b, field_175826_b, false); + + if (this.field_175830_k.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 1, 7, 4, 2, 7, false); + } + + if (this.field_175830_k.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 0, 1, 3, 1, 2, 4, false); + } + + if (this.field_175830_k.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 6, 1, 3, 7, 2, 4, false); + } + + return true; + } + } + + static class FitSimpleRoomHelper implements StructureOceanMonumentPieces.MonumentRoomFitHelper + { + private FitSimpleRoomHelper() + { + } + + public boolean func_175969_a(StructureOceanMonumentPieces.RoomDefinition p_175969_1_) + { + return true; + } + + public StructureOceanMonumentPieces.Piece func_175968_a(EnumFacing p_175968_1_, StructureOceanMonumentPieces.RoomDefinition p_175968_2_, Random p_175968_3_) + { + p_175968_2_.field_175963_d = true; + return new StructureOceanMonumentPieces.SimpleRoom(p_175968_1_, p_175968_2_, p_175968_3_); + } + } + + static class FitSimpleRoomTopHelper implements StructureOceanMonumentPieces.MonumentRoomFitHelper + { + private FitSimpleRoomTopHelper() + { + } + + public boolean func_175969_a(StructureOceanMonumentPieces.RoomDefinition p_175969_1_) + { + return !p_175969_1_.field_175966_c[EnumFacing.WEST.getIndex()] && !p_175969_1_.field_175966_c[EnumFacing.EAST.getIndex()] && !p_175969_1_.field_175966_c[EnumFacing.NORTH.getIndex()] && !p_175969_1_.field_175966_c[EnumFacing.SOUTH.getIndex()] && !p_175969_1_.field_175966_c[EnumFacing.UP.getIndex()]; + } + + public StructureOceanMonumentPieces.Piece func_175968_a(EnumFacing p_175968_1_, StructureOceanMonumentPieces.RoomDefinition p_175968_2_, Random p_175968_3_) + { + p_175968_2_.field_175963_d = true; + return new StructureOceanMonumentPieces.SimpleTopRoom(p_175968_1_, p_175968_2_, p_175968_3_); + } + } + + public static class MonumentBuilding extends StructureOceanMonumentPieces.Piece + { + private StructureOceanMonumentPieces.RoomDefinition field_175845_o; + private StructureOceanMonumentPieces.RoomDefinition field_175844_p; + private List field_175843_q = Lists.newArrayList(); + + public MonumentBuilding() + { + } + + public MonumentBuilding(Random p_i45599_1_, int p_i45599_2_, int p_i45599_3_, EnumFacing p_i45599_4_) + { + super(0); + this.coordBaseMode = p_i45599_4_; + + switch (this.coordBaseMode) + { + case NORTH: + case SOUTH: + this.boundingBox = new StructureBoundingBox(p_i45599_2_, 39, p_i45599_3_, p_i45599_2_ + 58 - 1, 61, p_i45599_3_ + 58 - 1); + break; + + default: + this.boundingBox = new StructureBoundingBox(p_i45599_2_, 39, p_i45599_3_, p_i45599_2_ + 58 - 1, 61, p_i45599_3_ + 58 - 1); + } + + List list = this.func_175836_a(p_i45599_1_); + this.field_175845_o.field_175963_d = true; + this.field_175843_q.add(new StructureOceanMonumentPieces.EntryRoom(this.coordBaseMode, this.field_175845_o)); + this.field_175843_q.add(new StructureOceanMonumentPieces.MonumentCoreRoom(this.coordBaseMode, this.field_175844_p, p_i45599_1_)); + List list1 = Lists.newArrayList(); + list1.add(new StructureOceanMonumentPieces.XYDoubleRoomFitHelper()); + list1.add(new StructureOceanMonumentPieces.YZDoubleRoomFitHelper()); + list1.add(new StructureOceanMonumentPieces.ZDoubleRoomFitHelper()); + list1.add(new StructureOceanMonumentPieces.XDoubleRoomFitHelper()); + list1.add(new StructureOceanMonumentPieces.YDoubleRoomFitHelper()); + list1.add(new StructureOceanMonumentPieces.FitSimpleRoomTopHelper()); + list1.add(new StructureOceanMonumentPieces.FitSimpleRoomHelper()); + label319: + + for (StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition : list) + { + if (!structureoceanmonumentpieces$roomdefinition.field_175963_d && !structureoceanmonumentpieces$roomdefinition.func_175961_b()) + { + Iterator iterator = list1.iterator(); + StructureOceanMonumentPieces.MonumentRoomFitHelper structureoceanmonumentpieces$monumentroomfithelper; + + while (true) + { + if (!iterator.hasNext()) + { + continue label319; + } + + structureoceanmonumentpieces$monumentroomfithelper = (StructureOceanMonumentPieces.MonumentRoomFitHelper)iterator.next(); + + if (structureoceanmonumentpieces$monumentroomfithelper.func_175969_a(structureoceanmonumentpieces$roomdefinition)) + { + break; + } + } + + this.field_175843_q.add(structureoceanmonumentpieces$monumentroomfithelper.func_175968_a(this.coordBaseMode, structureoceanmonumentpieces$roomdefinition, p_i45599_1_)); + } + } + + int j = this.boundingBox.minY; + int k = this.getXWithOffset(9, 22); + int l = this.getZWithOffset(9, 22); + + for (StructureOceanMonumentPieces.Piece structureoceanmonumentpieces$piece : this.field_175843_q) + { + structureoceanmonumentpieces$piece.getBoundingBox().offset(k, j, l); + } + + StructureBoundingBox structureboundingbox1 = StructureBoundingBox.func_175899_a(this.getXWithOffset(1, 1), this.getYWithOffset(1), this.getZWithOffset(1, 1), this.getXWithOffset(23, 21), this.getYWithOffset(8), this.getZWithOffset(23, 21)); + StructureBoundingBox structureboundingbox2 = StructureBoundingBox.func_175899_a(this.getXWithOffset(34, 1), this.getYWithOffset(1), this.getZWithOffset(34, 1), this.getXWithOffset(56, 21), this.getYWithOffset(8), this.getZWithOffset(56, 21)); + StructureBoundingBox structureboundingbox = StructureBoundingBox.func_175899_a(this.getXWithOffset(22, 22), this.getYWithOffset(13), this.getZWithOffset(22, 22), this.getXWithOffset(35, 35), this.getYWithOffset(17), this.getZWithOffset(35, 35)); + int i = p_i45599_1_.nextInt(); + this.field_175843_q.add(new StructureOceanMonumentPieces.WingRoom(this.coordBaseMode, structureboundingbox1, i++)); + this.field_175843_q.add(new StructureOceanMonumentPieces.WingRoom(this.coordBaseMode, structureboundingbox2, i++)); + this.field_175843_q.add(new StructureOceanMonumentPieces.Penthouse(this.coordBaseMode, structureboundingbox)); + } + + private List func_175836_a(Random p_175836_1_) + { + StructureOceanMonumentPieces.RoomDefinition[] astructureoceanmonumentpieces$roomdefinition = new StructureOceanMonumentPieces.RoomDefinition[75]; + + for (int i = 0; i < 5; ++i) + { + for (int j = 0; j < 4; ++j) + { + int k = 0; + int l = func_175820_a(i, k, j); + astructureoceanmonumentpieces$roomdefinition[l] = new StructureOceanMonumentPieces.RoomDefinition(l); + } + } + + for (int i2 = 0; i2 < 5; ++i2) + { + for (int l2 = 0; l2 < 4; ++l2) + { + int k3 = 1; + int j4 = func_175820_a(i2, k3, l2); + astructureoceanmonumentpieces$roomdefinition[j4] = new StructureOceanMonumentPieces.RoomDefinition(j4); + } + } + + for (int j2 = 1; j2 < 4; ++j2) + { + for (int i3 = 0; i3 < 2; ++i3) + { + int l3 = 2; + int k4 = func_175820_a(j2, l3, i3); + astructureoceanmonumentpieces$roomdefinition[k4] = new StructureOceanMonumentPieces.RoomDefinition(k4); + } + } + + this.field_175845_o = astructureoceanmonumentpieces$roomdefinition[field_175823_g]; + + for (int k2 = 0; k2 < 5; ++k2) + { + for (int j3 = 0; j3 < 5; ++j3) + { + for (int i4 = 0; i4 < 3; ++i4) + { + int l4 = func_175820_a(k2, i4, j3); + + if (astructureoceanmonumentpieces$roomdefinition[l4] != null) + { + for (EnumFacing enumfacing : EnumFacing.values()) + { + int i1 = k2 + enumfacing.getFrontOffsetX(); + int j1 = i4 + enumfacing.getFrontOffsetY(); + int k1 = j3 + enumfacing.getFrontOffsetZ(); + + if (i1 >= 0 && i1 < 5 && k1 >= 0 && k1 < 5 && j1 >= 0 && j1 < 3) + { + int l1 = func_175820_a(i1, j1, k1); + + if (astructureoceanmonumentpieces$roomdefinition[l1] != null) + { + if (k1 != j3) + { + astructureoceanmonumentpieces$roomdefinition[l4].func_175957_a(enumfacing.getOpposite(), astructureoceanmonumentpieces$roomdefinition[l1]); + } + else + { + astructureoceanmonumentpieces$roomdefinition[l4].func_175957_a(enumfacing, astructureoceanmonumentpieces$roomdefinition[l1]); + } + } + } + } + } + } + } + } + + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition; + astructureoceanmonumentpieces$roomdefinition[field_175831_h].func_175957_a(EnumFacing.UP, structureoceanmonumentpieces$roomdefinition = new StructureOceanMonumentPieces.RoomDefinition(1003)); + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition1; + astructureoceanmonumentpieces$roomdefinition[field_175832_i].func_175957_a(EnumFacing.SOUTH, structureoceanmonumentpieces$roomdefinition1 = new StructureOceanMonumentPieces.RoomDefinition(1001)); + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition2; + astructureoceanmonumentpieces$roomdefinition[field_175829_j].func_175957_a(EnumFacing.SOUTH, structureoceanmonumentpieces$roomdefinition2 = new StructureOceanMonumentPieces.RoomDefinition(1002)); + structureoceanmonumentpieces$roomdefinition.field_175963_d = true; + structureoceanmonumentpieces$roomdefinition1.field_175963_d = true; + structureoceanmonumentpieces$roomdefinition2.field_175963_d = true; + this.field_175845_o.field_175964_e = true; + this.field_175844_p = astructureoceanmonumentpieces$roomdefinition[func_175820_a(p_175836_1_.nextInt(4), 0, 2)]; + this.field_175844_p.field_175963_d = true; + this.field_175844_p.field_175965_b[EnumFacing.EAST.getIndex()].field_175963_d = true; + this.field_175844_p.field_175965_b[EnumFacing.NORTH.getIndex()].field_175963_d = true; + this.field_175844_p.field_175965_b[EnumFacing.EAST.getIndex()].field_175965_b[EnumFacing.NORTH.getIndex()].field_175963_d = true; + this.field_175844_p.field_175965_b[EnumFacing.UP.getIndex()].field_175963_d = true; + this.field_175844_p.field_175965_b[EnumFacing.EAST.getIndex()].field_175965_b[EnumFacing.UP.getIndex()].field_175963_d = true; + this.field_175844_p.field_175965_b[EnumFacing.NORTH.getIndex()].field_175965_b[EnumFacing.UP.getIndex()].field_175963_d = true; + this.field_175844_p.field_175965_b[EnumFacing.EAST.getIndex()].field_175965_b[EnumFacing.NORTH.getIndex()].field_175965_b[EnumFacing.UP.getIndex()].field_175963_d = true; + List list = Lists.newArrayList(); + + for (StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition4 : astructureoceanmonumentpieces$roomdefinition) + { + if (structureoceanmonumentpieces$roomdefinition4 != null) + { + structureoceanmonumentpieces$roomdefinition4.func_175958_a(); + list.add(structureoceanmonumentpieces$roomdefinition4); + } + } + + structureoceanmonumentpieces$roomdefinition.func_175958_a(); + Collections.shuffle(list, p_175836_1_); + int i5 = 1; + + for (StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition3 : list) + { + int j5 = 0; + int k5 = 0; + + while (j5 < 2 && k5 < 5) + { + ++k5; + int l5 = p_175836_1_.nextInt(6); + + if (structureoceanmonumentpieces$roomdefinition3.field_175966_c[l5]) + { + int i6 = EnumFacing.getFront(l5).getOpposite().getIndex(); + structureoceanmonumentpieces$roomdefinition3.field_175966_c[l5] = false; + structureoceanmonumentpieces$roomdefinition3.field_175965_b[l5].field_175966_c[i6] = false; + + if (structureoceanmonumentpieces$roomdefinition3.func_175959_a(i5++) && structureoceanmonumentpieces$roomdefinition3.field_175965_b[l5].func_175959_a(i5++)) + { + ++j5; + } + else + { + structureoceanmonumentpieces$roomdefinition3.field_175966_c[l5] = true; + structureoceanmonumentpieces$roomdefinition3.field_175965_b[l5].field_175966_c[i6] = true; + } + } + } + } + + list.add(structureoceanmonumentpieces$roomdefinition); + list.add(structureoceanmonumentpieces$roomdefinition1); + list.add(structureoceanmonumentpieces$roomdefinition2); + return list; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + int i = Math.max(worldIn.func_181545_F(), 64) - this.boundingBox.minY; + this.func_181655_a(worldIn, structureBoundingBoxIn, 0, 0, 0, 58, i, 58, false); + this.func_175840_a(false, 0, worldIn, randomIn, structureBoundingBoxIn); + this.func_175840_a(true, 33, worldIn, randomIn, structureBoundingBoxIn); + this.func_175839_b(worldIn, randomIn, structureBoundingBoxIn); + this.func_175837_c(worldIn, randomIn, structureBoundingBoxIn); + this.func_175841_d(worldIn, randomIn, structureBoundingBoxIn); + this.func_175835_e(worldIn, randomIn, structureBoundingBoxIn); + this.func_175842_f(worldIn, randomIn, structureBoundingBoxIn); + this.func_175838_g(worldIn, randomIn, structureBoundingBoxIn); + + for (int j = 0; j < 7; ++j) + { + int k = 0; + + while (k < 7) + { + if (k == 0 && j == 3) + { + k = 6; + } + + int l = j * 9; + int i1 = k * 9; + + for (int j1 = 0; j1 < 4; ++j1) + { + for (int k1 = 0; k1 < 4; ++k1) + { + this.setBlockState(worldIn, field_175826_b, l + j1, 0, i1 + k1, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, field_175826_b, l + j1, -1, i1 + k1, structureBoundingBoxIn); + } + } + + if (j != 0 && j != 6) + { + k += 6; + } + else + { + ++k; + } + } + } + + for (int l1 = 0; l1 < 5; ++l1) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, -1 - l1, 0 + l1 * 2, -1 - l1, -1 - l1, 23, 58 + l1, false); + this.func_181655_a(worldIn, structureBoundingBoxIn, 58 + l1, 0 + l1 * 2, -1 - l1, 58 + l1, 23, 58 + l1, false); + this.func_181655_a(worldIn, structureBoundingBoxIn, 0 - l1, 0 + l1 * 2, -1 - l1, 57 + l1, 23, -1 - l1, false); + this.func_181655_a(worldIn, structureBoundingBoxIn, 0 - l1, 0 + l1 * 2, 58 + l1, 57 + l1, 23, 58 + l1, false); + } + + for (StructureOceanMonumentPieces.Piece structureoceanmonumentpieces$piece : this.field_175843_q) + { + if (structureoceanmonumentpieces$piece.getBoundingBox().intersectsWith(structureBoundingBoxIn)) + { + structureoceanmonumentpieces$piece.addComponentParts(worldIn, randomIn, structureBoundingBoxIn); + } + } + + return true; + } + + private void func_175840_a(boolean p_175840_1_, int p_175840_2_, World worldIn, Random p_175840_4_, StructureBoundingBox p_175840_5_) + { + int i = 24; + + if (this.func_175818_a(p_175840_5_, p_175840_2_, 0, p_175840_2_ + 23, 20)) + { + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + 0, 0, 0, p_175840_2_ + 24, 0, 20, field_175828_a, field_175828_a, false); + this.func_181655_a(worldIn, p_175840_5_, p_175840_2_ + 0, 1, 0, p_175840_2_ + 24, 10, 20, false); + + for (int j = 0; j < 4; ++j) + { + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + j, j + 1, j, p_175840_2_ + j, j + 1, 20, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + j + 7, j + 5, j + 7, p_175840_2_ + j + 7, j + 5, 20, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + 17 - j, j + 5, j + 7, p_175840_2_ + 17 - j, j + 5, 20, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + 24 - j, j + 1, j, p_175840_2_ + 24 - j, j + 1, 20, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + j + 1, j + 1, j, p_175840_2_ + 23 - j, j + 1, j, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + j + 8, j + 5, j + 7, p_175840_2_ + 16 - j, j + 5, j + 7, field_175826_b, field_175826_b, false); + } + + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + 4, 4, 4, p_175840_2_ + 6, 4, 20, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + 7, 4, 4, p_175840_2_ + 17, 4, 6, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + 18, 4, 4, p_175840_2_ + 20, 4, 20, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + 11, 8, 11, p_175840_2_ + 13, 8, 20, field_175828_a, field_175828_a, false); + this.setBlockState(worldIn, field_175824_d, p_175840_2_ + 12, 9, 12, p_175840_5_); + this.setBlockState(worldIn, field_175824_d, p_175840_2_ + 12, 9, 15, p_175840_5_); + this.setBlockState(worldIn, field_175824_d, p_175840_2_ + 12, 9, 18, p_175840_5_); + int j1 = p_175840_1_ ? p_175840_2_ + 19 : p_175840_2_ + 5; + int k = p_175840_1_ ? p_175840_2_ + 5 : p_175840_2_ + 19; + + for (int l = 20; l >= 5; l -= 3) + { + this.setBlockState(worldIn, field_175824_d, j1, 5, l, p_175840_5_); + } + + for (int k1 = 19; k1 >= 7; k1 -= 3) + { + this.setBlockState(worldIn, field_175824_d, k, 5, k1, p_175840_5_); + } + + for (int l1 = 0; l1 < 4; ++l1) + { + int i1 = p_175840_1_ ? p_175840_2_ + (24 - (17 - l1 * 3)) : p_175840_2_ + 17 - l1 * 3; + this.setBlockState(worldIn, field_175824_d, i1, 5, 5, p_175840_5_); + } + + this.setBlockState(worldIn, field_175824_d, k, 5, 5, p_175840_5_); + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + 11, 1, 12, p_175840_2_ + 13, 7, 12, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175840_5_, p_175840_2_ + 12, 1, 11, p_175840_2_ + 12, 7, 13, field_175828_a, field_175828_a, false); + } + } + + private void func_175839_b(World worldIn, Random p_175839_2_, StructureBoundingBox p_175839_3_) + { + if (this.func_175818_a(p_175839_3_, 22, 5, 35, 17)) + { + this.func_181655_a(worldIn, p_175839_3_, 25, 0, 0, 32, 8, 20, false); + + for (int i = 0; i < 4; ++i) + { + this.fillWithBlocks(worldIn, p_175839_3_, 24, 2, 5 + i * 4, 24, 4, 5 + i * 4, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175839_3_, 22, 4, 5 + i * 4, 23, 4, 5 + i * 4, field_175826_b, field_175826_b, false); + this.setBlockState(worldIn, field_175826_b, 25, 5, 5 + i * 4, p_175839_3_); + this.setBlockState(worldIn, field_175826_b, 26, 6, 5 + i * 4, p_175839_3_); + this.setBlockState(worldIn, field_175825_e, 26, 5, 5 + i * 4, p_175839_3_); + this.fillWithBlocks(worldIn, p_175839_3_, 33, 2, 5 + i * 4, 33, 4, 5 + i * 4, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175839_3_, 34, 4, 5 + i * 4, 35, 4, 5 + i * 4, field_175826_b, field_175826_b, false); + this.setBlockState(worldIn, field_175826_b, 32, 5, 5 + i * 4, p_175839_3_); + this.setBlockState(worldIn, field_175826_b, 31, 6, 5 + i * 4, p_175839_3_); + this.setBlockState(worldIn, field_175825_e, 31, 5, 5 + i * 4, p_175839_3_); + this.fillWithBlocks(worldIn, p_175839_3_, 27, 6, 5 + i * 4, 30, 6, 5 + i * 4, field_175828_a, field_175828_a, false); + } + } + } + + private void func_175837_c(World worldIn, Random p_175837_2_, StructureBoundingBox p_175837_3_) + { + if (this.func_175818_a(p_175837_3_, 15, 20, 42, 21)) + { + this.fillWithBlocks(worldIn, p_175837_3_, 15, 0, 21, 42, 0, 21, field_175828_a, field_175828_a, false); + this.func_181655_a(worldIn, p_175837_3_, 26, 1, 21, 31, 3, 21, false); + this.fillWithBlocks(worldIn, p_175837_3_, 21, 12, 21, 36, 12, 21, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175837_3_, 17, 11, 21, 40, 11, 21, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175837_3_, 16, 10, 21, 41, 10, 21, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175837_3_, 15, 7, 21, 42, 9, 21, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175837_3_, 16, 6, 21, 41, 6, 21, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175837_3_, 17, 5, 21, 40, 5, 21, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175837_3_, 21, 4, 21, 36, 4, 21, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175837_3_, 22, 3, 21, 26, 3, 21, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175837_3_, 31, 3, 21, 35, 3, 21, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175837_3_, 23, 2, 21, 25, 2, 21, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175837_3_, 32, 2, 21, 34, 2, 21, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175837_3_, 28, 4, 20, 29, 4, 21, field_175826_b, field_175826_b, false); + this.setBlockState(worldIn, field_175826_b, 27, 3, 21, p_175837_3_); + this.setBlockState(worldIn, field_175826_b, 30, 3, 21, p_175837_3_); + this.setBlockState(worldIn, field_175826_b, 26, 2, 21, p_175837_3_); + this.setBlockState(worldIn, field_175826_b, 31, 2, 21, p_175837_3_); + this.setBlockState(worldIn, field_175826_b, 25, 1, 21, p_175837_3_); + this.setBlockState(worldIn, field_175826_b, 32, 1, 21, p_175837_3_); + + for (int i = 0; i < 7; ++i) + { + this.setBlockState(worldIn, field_175827_c, 28 - i, 6 + i, 21, p_175837_3_); + this.setBlockState(worldIn, field_175827_c, 29 + i, 6 + i, 21, p_175837_3_); + } + + for (int j = 0; j < 4; ++j) + { + this.setBlockState(worldIn, field_175827_c, 28 - j, 9 + j, 21, p_175837_3_); + this.setBlockState(worldIn, field_175827_c, 29 + j, 9 + j, 21, p_175837_3_); + } + + this.setBlockState(worldIn, field_175827_c, 28, 12, 21, p_175837_3_); + this.setBlockState(worldIn, field_175827_c, 29, 12, 21, p_175837_3_); + + for (int k = 0; k < 3; ++k) + { + this.setBlockState(worldIn, field_175827_c, 22 - k * 2, 8, 21, p_175837_3_); + this.setBlockState(worldIn, field_175827_c, 22 - k * 2, 9, 21, p_175837_3_); + this.setBlockState(worldIn, field_175827_c, 35 + k * 2, 8, 21, p_175837_3_); + this.setBlockState(worldIn, field_175827_c, 35 + k * 2, 9, 21, p_175837_3_); + } + + this.func_181655_a(worldIn, p_175837_3_, 15, 13, 21, 42, 15, 21, false); + this.func_181655_a(worldIn, p_175837_3_, 15, 1, 21, 15, 6, 21, false); + this.func_181655_a(worldIn, p_175837_3_, 16, 1, 21, 16, 5, 21, false); + this.func_181655_a(worldIn, p_175837_3_, 17, 1, 21, 20, 4, 21, false); + this.func_181655_a(worldIn, p_175837_3_, 21, 1, 21, 21, 3, 21, false); + this.func_181655_a(worldIn, p_175837_3_, 22, 1, 21, 22, 2, 21, false); + this.func_181655_a(worldIn, p_175837_3_, 23, 1, 21, 24, 1, 21, false); + this.func_181655_a(worldIn, p_175837_3_, 42, 1, 21, 42, 6, 21, false); + this.func_181655_a(worldIn, p_175837_3_, 41, 1, 21, 41, 5, 21, false); + this.func_181655_a(worldIn, p_175837_3_, 37, 1, 21, 40, 4, 21, false); + this.func_181655_a(worldIn, p_175837_3_, 36, 1, 21, 36, 3, 21, false); + this.func_181655_a(worldIn, p_175837_3_, 33, 1, 21, 34, 1, 21, false); + this.func_181655_a(worldIn, p_175837_3_, 35, 1, 21, 35, 2, 21, false); + } + } + + private void func_175841_d(World worldIn, Random p_175841_2_, StructureBoundingBox p_175841_3_) + { + if (this.func_175818_a(p_175841_3_, 21, 21, 36, 36)) + { + this.fillWithBlocks(worldIn, p_175841_3_, 21, 0, 22, 36, 0, 36, field_175828_a, field_175828_a, false); + this.func_181655_a(worldIn, p_175841_3_, 21, 1, 22, 36, 23, 36, false); + + for (int i = 0; i < 4; ++i) + { + this.fillWithBlocks(worldIn, p_175841_3_, 21 + i, 13 + i, 21 + i, 36 - i, 13 + i, 21 + i, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175841_3_, 21 + i, 13 + i, 36 - i, 36 - i, 13 + i, 36 - i, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175841_3_, 21 + i, 13 + i, 22 + i, 21 + i, 13 + i, 35 - i, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175841_3_, 36 - i, 13 + i, 22 + i, 36 - i, 13 + i, 35 - i, field_175826_b, field_175826_b, false); + } + + this.fillWithBlocks(worldIn, p_175841_3_, 25, 16, 25, 32, 16, 32, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175841_3_, 25, 17, 25, 25, 19, 25, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175841_3_, 32, 17, 25, 32, 19, 25, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175841_3_, 25, 17, 32, 25, 19, 32, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175841_3_, 32, 17, 32, 32, 19, 32, field_175826_b, field_175826_b, false); + this.setBlockState(worldIn, field_175826_b, 26, 20, 26, p_175841_3_); + this.setBlockState(worldIn, field_175826_b, 27, 21, 27, p_175841_3_); + this.setBlockState(worldIn, field_175825_e, 27, 20, 27, p_175841_3_); + this.setBlockState(worldIn, field_175826_b, 26, 20, 31, p_175841_3_); + this.setBlockState(worldIn, field_175826_b, 27, 21, 30, p_175841_3_); + this.setBlockState(worldIn, field_175825_e, 27, 20, 30, p_175841_3_); + this.setBlockState(worldIn, field_175826_b, 31, 20, 31, p_175841_3_); + this.setBlockState(worldIn, field_175826_b, 30, 21, 30, p_175841_3_); + this.setBlockState(worldIn, field_175825_e, 30, 20, 30, p_175841_3_); + this.setBlockState(worldIn, field_175826_b, 31, 20, 26, p_175841_3_); + this.setBlockState(worldIn, field_175826_b, 30, 21, 27, p_175841_3_); + this.setBlockState(worldIn, field_175825_e, 30, 20, 27, p_175841_3_); + this.fillWithBlocks(worldIn, p_175841_3_, 28, 21, 27, 29, 21, 27, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175841_3_, 27, 21, 28, 27, 21, 29, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175841_3_, 28, 21, 30, 29, 21, 30, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175841_3_, 30, 21, 28, 30, 21, 29, field_175828_a, field_175828_a, false); + } + } + + private void func_175835_e(World worldIn, Random p_175835_2_, StructureBoundingBox p_175835_3_) + { + if (this.func_175818_a(p_175835_3_, 0, 21, 6, 58)) + { + this.fillWithBlocks(worldIn, p_175835_3_, 0, 0, 21, 6, 0, 57, field_175828_a, field_175828_a, false); + this.func_181655_a(worldIn, p_175835_3_, 0, 1, 21, 6, 7, 57, false); + this.fillWithBlocks(worldIn, p_175835_3_, 4, 4, 21, 6, 4, 53, field_175828_a, field_175828_a, false); + + for (int i = 0; i < 4; ++i) + { + this.fillWithBlocks(worldIn, p_175835_3_, i, i + 1, 21, i, i + 1, 57 - i, field_175826_b, field_175826_b, false); + } + + for (int j = 23; j < 53; j += 3) + { + this.setBlockState(worldIn, field_175824_d, 5, 5, j, p_175835_3_); + } + + this.setBlockState(worldIn, field_175824_d, 5, 5, 52, p_175835_3_); + + for (int k = 0; k < 4; ++k) + { + this.fillWithBlocks(worldIn, p_175835_3_, k, k + 1, 21, k, k + 1, 57 - k, field_175826_b, field_175826_b, false); + } + + this.fillWithBlocks(worldIn, p_175835_3_, 4, 1, 52, 6, 3, 52, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175835_3_, 5, 1, 51, 5, 3, 53, field_175828_a, field_175828_a, false); + } + + if (this.func_175818_a(p_175835_3_, 51, 21, 58, 58)) + { + this.fillWithBlocks(worldIn, p_175835_3_, 51, 0, 21, 57, 0, 57, field_175828_a, field_175828_a, false); + this.func_181655_a(worldIn, p_175835_3_, 51, 1, 21, 57, 7, 57, false); + this.fillWithBlocks(worldIn, p_175835_3_, 51, 4, 21, 53, 4, 53, field_175828_a, field_175828_a, false); + + for (int l = 0; l < 4; ++l) + { + this.fillWithBlocks(worldIn, p_175835_3_, 57 - l, l + 1, 21, 57 - l, l + 1, 57 - l, field_175826_b, field_175826_b, false); + } + + for (int i1 = 23; i1 < 53; i1 += 3) + { + this.setBlockState(worldIn, field_175824_d, 52, 5, i1, p_175835_3_); + } + + this.setBlockState(worldIn, field_175824_d, 52, 5, 52, p_175835_3_); + this.fillWithBlocks(worldIn, p_175835_3_, 51, 1, 52, 53, 3, 52, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175835_3_, 52, 1, 51, 52, 3, 53, field_175828_a, field_175828_a, false); + } + + if (this.func_175818_a(p_175835_3_, 0, 51, 57, 57)) + { + this.fillWithBlocks(worldIn, p_175835_3_, 7, 0, 51, 50, 0, 57, field_175828_a, field_175828_a, false); + this.func_181655_a(worldIn, p_175835_3_, 7, 1, 51, 50, 10, 57, false); + + for (int j1 = 0; j1 < 4; ++j1) + { + this.fillWithBlocks(worldIn, p_175835_3_, j1 + 1, j1 + 1, 57 - j1, 56 - j1, j1 + 1, 57 - j1, field_175826_b, field_175826_b, false); + } + } + } + + private void func_175842_f(World worldIn, Random p_175842_2_, StructureBoundingBox p_175842_3_) + { + if (this.func_175818_a(p_175842_3_, 7, 21, 13, 50)) + { + this.fillWithBlocks(worldIn, p_175842_3_, 7, 0, 21, 13, 0, 50, field_175828_a, field_175828_a, false); + this.func_181655_a(worldIn, p_175842_3_, 7, 1, 21, 13, 10, 50, false); + this.fillWithBlocks(worldIn, p_175842_3_, 11, 8, 21, 13, 8, 53, field_175828_a, field_175828_a, false); + + for (int i = 0; i < 4; ++i) + { + this.fillWithBlocks(worldIn, p_175842_3_, i + 7, i + 5, 21, i + 7, i + 5, 54, field_175826_b, field_175826_b, false); + } + + for (int j = 21; j <= 45; j += 3) + { + this.setBlockState(worldIn, field_175824_d, 12, 9, j, p_175842_3_); + } + } + + if (this.func_175818_a(p_175842_3_, 44, 21, 50, 54)) + { + this.fillWithBlocks(worldIn, p_175842_3_, 44, 0, 21, 50, 0, 50, field_175828_a, field_175828_a, false); + this.func_181655_a(worldIn, p_175842_3_, 44, 1, 21, 50, 10, 50, false); + this.fillWithBlocks(worldIn, p_175842_3_, 44, 8, 21, 46, 8, 53, field_175828_a, field_175828_a, false); + + for (int k = 0; k < 4; ++k) + { + this.fillWithBlocks(worldIn, p_175842_3_, 50 - k, k + 5, 21, 50 - k, k + 5, 54, field_175826_b, field_175826_b, false); + } + + for (int l = 21; l <= 45; l += 3) + { + this.setBlockState(worldIn, field_175824_d, 45, 9, l, p_175842_3_); + } + } + + if (this.func_175818_a(p_175842_3_, 8, 44, 49, 54)) + { + this.fillWithBlocks(worldIn, p_175842_3_, 14, 0, 44, 43, 0, 50, field_175828_a, field_175828_a, false); + this.func_181655_a(worldIn, p_175842_3_, 14, 1, 44, 43, 10, 50, false); + + for (int i1 = 12; i1 <= 45; i1 += 3) + { + this.setBlockState(worldIn, field_175824_d, i1, 9, 45, p_175842_3_); + this.setBlockState(worldIn, field_175824_d, i1, 9, 52, p_175842_3_); + + if (i1 == 12 || i1 == 18 || i1 == 24 || i1 == 33 || i1 == 39 || i1 == 45) + { + this.setBlockState(worldIn, field_175824_d, i1, 9, 47, p_175842_3_); + this.setBlockState(worldIn, field_175824_d, i1, 9, 50, p_175842_3_); + this.setBlockState(worldIn, field_175824_d, i1, 10, 45, p_175842_3_); + this.setBlockState(worldIn, field_175824_d, i1, 10, 46, p_175842_3_); + this.setBlockState(worldIn, field_175824_d, i1, 10, 51, p_175842_3_); + this.setBlockState(worldIn, field_175824_d, i1, 10, 52, p_175842_3_); + this.setBlockState(worldIn, field_175824_d, i1, 11, 47, p_175842_3_); + this.setBlockState(worldIn, field_175824_d, i1, 11, 50, p_175842_3_); + this.setBlockState(worldIn, field_175824_d, i1, 12, 48, p_175842_3_); + this.setBlockState(worldIn, field_175824_d, i1, 12, 49, p_175842_3_); + } + } + + for (int j1 = 0; j1 < 3; ++j1) + { + this.fillWithBlocks(worldIn, p_175842_3_, 8 + j1, 5 + j1, 54, 49 - j1, 5 + j1, 54, field_175828_a, field_175828_a, false); + } + + this.fillWithBlocks(worldIn, p_175842_3_, 11, 8, 54, 46, 8, 54, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175842_3_, 14, 8, 44, 43, 8, 53, field_175828_a, field_175828_a, false); + } + } + + private void func_175838_g(World worldIn, Random p_175838_2_, StructureBoundingBox p_175838_3_) + { + if (this.func_175818_a(p_175838_3_, 14, 21, 20, 43)) + { + this.fillWithBlocks(worldIn, p_175838_3_, 14, 0, 21, 20, 0, 43, field_175828_a, field_175828_a, false); + this.func_181655_a(worldIn, p_175838_3_, 14, 1, 22, 20, 14, 43, false); + this.fillWithBlocks(worldIn, p_175838_3_, 18, 12, 22, 20, 12, 39, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175838_3_, 18, 12, 21, 20, 12, 21, field_175826_b, field_175826_b, false); + + for (int i = 0; i < 4; ++i) + { + this.fillWithBlocks(worldIn, p_175838_3_, i + 14, i + 9, 21, i + 14, i + 9, 43 - i, field_175826_b, field_175826_b, false); + } + + for (int j = 23; j <= 39; j += 3) + { + this.setBlockState(worldIn, field_175824_d, 19, 13, j, p_175838_3_); + } + } + + if (this.func_175818_a(p_175838_3_, 37, 21, 43, 43)) + { + this.fillWithBlocks(worldIn, p_175838_3_, 37, 0, 21, 43, 0, 43, field_175828_a, field_175828_a, false); + this.func_181655_a(worldIn, p_175838_3_, 37, 1, 22, 43, 14, 43, false); + this.fillWithBlocks(worldIn, p_175838_3_, 37, 12, 22, 39, 12, 39, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175838_3_, 37, 12, 21, 39, 12, 21, field_175826_b, field_175826_b, false); + + for (int k = 0; k < 4; ++k) + { + this.fillWithBlocks(worldIn, p_175838_3_, 43 - k, k + 9, 21, 43 - k, k + 9, 43 - k, field_175826_b, field_175826_b, false); + } + + for (int l = 23; l <= 39; l += 3) + { + this.setBlockState(worldIn, field_175824_d, 38, 13, l, p_175838_3_); + } + } + + if (this.func_175818_a(p_175838_3_, 15, 37, 42, 43)) + { + this.fillWithBlocks(worldIn, p_175838_3_, 21, 0, 37, 36, 0, 43, field_175828_a, field_175828_a, false); + this.func_181655_a(worldIn, p_175838_3_, 21, 1, 37, 36, 14, 43, false); + this.fillWithBlocks(worldIn, p_175838_3_, 21, 12, 37, 36, 12, 39, field_175828_a, field_175828_a, false); + + for (int i1 = 0; i1 < 4; ++i1) + { + this.fillWithBlocks(worldIn, p_175838_3_, 15 + i1, i1 + 9, 43 - i1, 42 - i1, i1 + 9, 43 - i1, field_175826_b, field_175826_b, false); + } + + for (int j1 = 21; j1 <= 36; j1 += 3) + { + this.setBlockState(worldIn, field_175824_d, j1, 13, 38, p_175838_3_); + } + } + } + } + + public static class MonumentCoreRoom extends StructureOceanMonumentPieces.Piece + { + public MonumentCoreRoom() + { + } + + public MonumentCoreRoom(EnumFacing p_i45598_1_, StructureOceanMonumentPieces.RoomDefinition p_i45598_2_, Random p_i45598_3_) + { + super(1, p_i45598_1_, p_i45598_2_, 2, 2, 2); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.func_175819_a(worldIn, structureBoundingBoxIn, 1, 8, 0, 14, 8, 14, field_175828_a); + int i = 7; + IBlockState iblockstate = field_175826_b; + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, i, 0, 0, i, 15, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 15, i, 0, 15, i, 15, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, i, 0, 15, i, 0, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, i, 15, 14, i, 15, iblockstate, iblockstate, false); + + for (i = 1; i <= 6; ++i) + { + iblockstate = field_175826_b; + + if (i == 2 || i == 6) + { + iblockstate = field_175828_a; + } + + for (int j = 0; j <= 15; j += 15) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, j, i, 0, j, i, 1, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, j, i, 6, j, i, 9, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, j, i, 14, j, i, 15, iblockstate, iblockstate, false); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, i, 0, 1, i, 0, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, i, 0, 9, i, 0, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 14, i, 0, 14, i, 0, iblockstate, iblockstate, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, i, 15, 14, i, 15, iblockstate, iblockstate, false); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 3, 6, 9, 6, 9, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 4, 7, 8, 5, 8, Blocks.gold_block.getDefaultState(), Blocks.gold_block.getDefaultState(), false); + + for (i = 3; i <= 6; i += 3) + { + for (int k = 6; k <= 9; k += 3) + { + this.setBlockState(worldIn, field_175825_e, k, i, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, k, i, 9, structureBoundingBoxIn); + } + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 6, 5, 2, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 9, 5, 2, 9, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 1, 6, 10, 2, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 1, 9, 10, 2, 9, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 5, 6, 2, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 1, 5, 9, 2, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 10, 6, 2, 10, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 1, 10, 9, 2, 10, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 5, 5, 6, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 10, 5, 6, 10, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 2, 5, 10, 6, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 2, 10, 10, 6, 10, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 7, 1, 5, 7, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 7, 1, 10, 7, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 7, 9, 5, 7, 14, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 7, 9, 10, 7, 14, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 7, 5, 6, 7, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 7, 10, 6, 7, 10, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 7, 5, 14, 7, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 7, 10, 14, 7, 10, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 2, 2, 1, 3, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 2, 3, 1, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 13, 1, 2, 13, 1, 3, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, 2, 12, 1, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 12, 2, 1, 13, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 13, 3, 1, 13, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 13, 1, 12, 13, 1, 13, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, 13, 12, 1, 13, field_175826_b, field_175826_b, false); + return true; + } + } + + interface MonumentRoomFitHelper + { + boolean func_175969_a(StructureOceanMonumentPieces.RoomDefinition p_175969_1_); + + StructureOceanMonumentPieces.Piece func_175968_a(EnumFacing p_175968_1_, StructureOceanMonumentPieces.RoomDefinition p_175968_2_, Random p_175968_3_); + } + + public static class Penthouse extends StructureOceanMonumentPieces.Piece + { + public Penthouse() + { + } + + public Penthouse(EnumFacing p_i45591_1_, StructureBoundingBox p_i45591_2_) + { + super(p_i45591_1_, p_i45591_2_); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, -1, 2, 11, -1, 11, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, -1, 0, 1, -1, 11, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, -1, 0, 13, -1, 11, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, -1, 0, 11, -1, 1, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, -1, 12, 11, -1, 13, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 0, 13, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 13, 0, 0, 13, 0, 13, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 12, 0, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 13, 12, 0, 13, field_175826_b, field_175826_b, false); + + for (int i = 2; i <= 11; i += 3) + { + this.setBlockState(worldIn, field_175825_e, 0, 0, i, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 13, 0, i, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, i, 0, 0, structureBoundingBoxIn); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 0, 3, 4, 0, 9, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 0, 3, 11, 0, 9, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 9, 9, 0, 11, field_175826_b, field_175826_b, false); + this.setBlockState(worldIn, field_175826_b, 5, 0, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 8, 0, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 10, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 3, 0, 10, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 0, 3, 3, 0, 7, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 0, 3, 10, 0, 7, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 0, 10, 7, 0, 10, field_175827_c, field_175827_c, false); + int l = 3; + + for (int j = 0; j < 2; ++j) + { + for (int k = 2; k <= 8; k += 3) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, l, 0, k, l, 2, k, field_175826_b, field_175826_b, false); + } + + l = 10; + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 0, 10, 5, 2, 10, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 0, 10, 8, 2, 10, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, -1, 7, 7, -1, 8, field_175827_c, field_175827_c, false); + this.func_181655_a(worldIn, structureBoundingBoxIn, 6, -1, 3, 7, -1, 4, false); + this.func_175817_a(worldIn, structureBoundingBoxIn, 6, 1, 6); + return true; + } + } + + public abstract static class Piece extends StructureComponent + { + protected static final IBlockState field_175828_a = Blocks.prismarine.getStateFromMeta(BlockPrismarine.ROUGH_META); + protected static final IBlockState field_175826_b = Blocks.prismarine.getStateFromMeta(BlockPrismarine.BRICKS_META); + protected static final IBlockState field_175827_c = Blocks.prismarine.getStateFromMeta(BlockPrismarine.DARK_META); + protected static final IBlockState field_175824_d = field_175826_b; + protected static final IBlockState field_175825_e = Blocks.sea_lantern.getDefaultState(); + protected static final IBlockState field_175822_f = Blocks.water.getDefaultState(); + protected static final int field_175823_g = func_175820_a(2, 0, 0); + protected static final int field_175831_h = func_175820_a(2, 2, 0); + protected static final int field_175832_i = func_175820_a(0, 1, 0); + protected static final int field_175829_j = func_175820_a(4, 1, 0); + protected StructureOceanMonumentPieces.RoomDefinition field_175830_k; + + protected static final int func_175820_a(int p_175820_0_, int p_175820_1_, int p_175820_2_) + { + return p_175820_1_ * 25 + p_175820_2_ * 5 + p_175820_0_; + } + + public Piece() + { + super(0); + } + + public Piece(int p_i45588_1_) + { + super(p_i45588_1_); + } + + public Piece(EnumFacing p_i45589_1_, StructureBoundingBox p_i45589_2_) + { + super(1); + this.coordBaseMode = p_i45589_1_; + this.boundingBox = p_i45589_2_; + } + + protected Piece(int p_i45590_1_, EnumFacing p_i45590_2_, StructureOceanMonumentPieces.RoomDefinition p_i45590_3_, int p_i45590_4_, int p_i45590_5_, int p_i45590_6_) + { + super(p_i45590_1_); + this.coordBaseMode = p_i45590_2_; + this.field_175830_k = p_i45590_3_; + int i = p_i45590_3_.field_175967_a; + int j = i % 5; + int k = i / 5 % 5; + int l = i / 25; + + if (p_i45590_2_ != EnumFacing.NORTH && p_i45590_2_ != EnumFacing.SOUTH) + { + this.boundingBox = new StructureBoundingBox(0, 0, 0, p_i45590_6_ * 8 - 1, p_i45590_5_ * 4 - 1, p_i45590_4_ * 8 - 1); + } + else + { + this.boundingBox = new StructureBoundingBox(0, 0, 0, p_i45590_4_ * 8 - 1, p_i45590_5_ * 4 - 1, p_i45590_6_ * 8 - 1); + } + + switch (p_i45590_2_) + { + case NORTH: + this.boundingBox.offset(j * 8, l * 4, -(k + p_i45590_6_) * 8 + 1); + break; + + case SOUTH: + this.boundingBox.offset(j * 8, l * 4, k * 8); + break; + + case WEST: + this.boundingBox.offset(-(k + p_i45590_6_) * 8 + 1, l * 4, j * 8); + break; + + default: + this.boundingBox.offset(k * 8, l * 4, j * 8); + } + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + } + + protected void func_181655_a(World p_181655_1_, StructureBoundingBox p_181655_2_, int p_181655_3_, int p_181655_4_, int p_181655_5_, int p_181655_6_, int p_181655_7_, int p_181655_8_, boolean p_181655_9_) + { + for (int i = p_181655_4_; i <= p_181655_7_; ++i) + { + for (int j = p_181655_3_; j <= p_181655_6_; ++j) + { + for (int k = p_181655_5_; k <= p_181655_8_; ++k) + { + if (!p_181655_9_ || this.getBlockStateFromPos(p_181655_1_, j, i, k, p_181655_2_).getBlock().getMaterial() != Material.air) + { + if (this.getYWithOffset(i) >= p_181655_1_.func_181545_F()) + { + this.setBlockState(p_181655_1_, Blocks.air.getDefaultState(), j, i, k, p_181655_2_); + } + else + { + this.setBlockState(p_181655_1_, field_175822_f, j, i, k, p_181655_2_); + } + } + } + } + } + } + + protected void func_175821_a(World worldIn, StructureBoundingBox p_175821_2_, int p_175821_3_, int p_175821_4_, boolean p_175821_5_) + { + if (p_175821_5_) + { + this.fillWithBlocks(worldIn, p_175821_2_, p_175821_3_ + 0, 0, p_175821_4_ + 0, p_175821_3_ + 2, 0, p_175821_4_ + 8 - 1, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175821_2_, p_175821_3_ + 5, 0, p_175821_4_ + 0, p_175821_3_ + 8 - 1, 0, p_175821_4_ + 8 - 1, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175821_2_, p_175821_3_ + 3, 0, p_175821_4_ + 0, p_175821_3_ + 4, 0, p_175821_4_ + 2, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175821_2_, p_175821_3_ + 3, 0, p_175821_4_ + 5, p_175821_3_ + 4, 0, p_175821_4_ + 8 - 1, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, p_175821_2_, p_175821_3_ + 3, 0, p_175821_4_ + 2, p_175821_3_ + 4, 0, p_175821_4_ + 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175821_2_, p_175821_3_ + 3, 0, p_175821_4_ + 5, p_175821_3_ + 4, 0, p_175821_4_ + 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175821_2_, p_175821_3_ + 2, 0, p_175821_4_ + 3, p_175821_3_ + 2, 0, p_175821_4_ + 4, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, p_175821_2_, p_175821_3_ + 5, 0, p_175821_4_ + 3, p_175821_3_ + 5, 0, p_175821_4_ + 4, field_175826_b, field_175826_b, false); + } + else + { + this.fillWithBlocks(worldIn, p_175821_2_, p_175821_3_ + 0, 0, p_175821_4_ + 0, p_175821_3_ + 8 - 1, 0, p_175821_4_ + 8 - 1, field_175828_a, field_175828_a, false); + } + } + + protected void func_175819_a(World worldIn, StructureBoundingBox p_175819_2_, int p_175819_3_, int p_175819_4_, int p_175819_5_, int p_175819_6_, int p_175819_7_, int p_175819_8_, IBlockState p_175819_9_) + { + for (int i = p_175819_4_; i <= p_175819_7_; ++i) + { + for (int j = p_175819_3_; j <= p_175819_6_; ++j) + { + for (int k = p_175819_5_; k <= p_175819_8_; ++k) + { + if (this.getBlockStateFromPos(worldIn, j, i, k, p_175819_2_) == field_175822_f) + { + this.setBlockState(worldIn, p_175819_9_, j, i, k, p_175819_2_); + } + } + } + } + } + + protected boolean func_175818_a(StructureBoundingBox p_175818_1_, int p_175818_2_, int p_175818_3_, int p_175818_4_, int p_175818_5_) + { + int i = this.getXWithOffset(p_175818_2_, p_175818_3_); + int j = this.getZWithOffset(p_175818_2_, p_175818_3_); + int k = this.getXWithOffset(p_175818_4_, p_175818_5_); + int l = this.getZWithOffset(p_175818_4_, p_175818_5_); + return p_175818_1_.intersectsWith(Math.min(i, k), Math.min(j, l), Math.max(i, k), Math.max(j, l)); + } + + protected boolean func_175817_a(World worldIn, StructureBoundingBox p_175817_2_, int p_175817_3_, int p_175817_4_, int p_175817_5_) + { + int i = this.getXWithOffset(p_175817_3_, p_175817_5_); + int j = this.getYWithOffset(p_175817_4_); + int k = this.getZWithOffset(p_175817_3_, p_175817_5_); + + if (p_175817_2_.isVecInside(new BlockPos(i, j, k))) + { + EntityGuardian entityguardian = new EntityGuardian(worldIn); + entityguardian.setElder(true); + entityguardian.heal(entityguardian.getMaxHealth()); + entityguardian.setLocationAndAngles((double)i + 0.5D, (double)j, (double)k + 0.5D, 0.0F, 0.0F); + entityguardian.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityguardian)), (IEntityLivingData)null); + worldIn.spawnEntityInWorld(entityguardian); + return true; + } + else + { + return false; + } + } + } + + static class RoomDefinition + { + int field_175967_a; + StructureOceanMonumentPieces.RoomDefinition[] field_175965_b = new StructureOceanMonumentPieces.RoomDefinition[6]; + boolean[] field_175966_c = new boolean[6]; + boolean field_175963_d; + boolean field_175964_e; + int field_175962_f; + + public RoomDefinition(int p_i45584_1_) + { + this.field_175967_a = p_i45584_1_; + } + + public void func_175957_a(EnumFacing p_175957_1_, StructureOceanMonumentPieces.RoomDefinition p_175957_2_) + { + this.field_175965_b[p_175957_1_.getIndex()] = p_175957_2_; + p_175957_2_.field_175965_b[p_175957_1_.getOpposite().getIndex()] = this; + } + + public void func_175958_a() + { + for (int i = 0; i < 6; ++i) + { + this.field_175966_c[i] = this.field_175965_b[i] != null; + } + } + + public boolean func_175959_a(int p_175959_1_) + { + if (this.field_175964_e) + { + return true; + } + else + { + this.field_175962_f = p_175959_1_; + + for (int i = 0; i < 6; ++i) + { + if (this.field_175965_b[i] != null && this.field_175966_c[i] && this.field_175965_b[i].field_175962_f != p_175959_1_ && this.field_175965_b[i].func_175959_a(p_175959_1_)) + { + return true; + } + } + + return false; + } + } + + public boolean func_175961_b() + { + return this.field_175967_a >= 75; + } + + public int func_175960_c() + { + int i = 0; + + for (int j = 0; j < 6; ++j) + { + if (this.field_175966_c[j]) + { + ++i; + } + } + + return i; + } + } + + public static class SimpleRoom extends StructureOceanMonumentPieces.Piece + { + private int field_175833_o; + + public SimpleRoom() + { + } + + public SimpleRoom(EnumFacing p_i45587_1_, StructureOceanMonumentPieces.RoomDefinition p_i45587_2_, Random p_i45587_3_) + { + super(1, p_i45587_1_, p_i45587_2_, 1, 1, 1); + this.field_175833_o = p_i45587_3_.nextInt(3); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_175830_k.field_175967_a / 25 > 0) + { + this.func_175821_a(worldIn, structureBoundingBoxIn, 0, 0, this.field_175830_k.field_175966_c[EnumFacing.DOWN.getIndex()]); + } + + if (this.field_175830_k.field_175965_b[EnumFacing.UP.getIndex()] == null) + { + this.func_175819_a(worldIn, structureBoundingBoxIn, 1, 4, 1, 6, 4, 6, field_175828_a); + } + + boolean flag = this.field_175833_o != 0 && randomIn.nextBoolean() && !this.field_175830_k.field_175966_c[EnumFacing.DOWN.getIndex()] && !this.field_175830_k.field_175966_c[EnumFacing.UP.getIndex()] && this.field_175830_k.func_175960_c() > 1; + + if (this.field_175833_o == 0) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 2, 1, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 0, 2, 3, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 2, 2, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 2, 2, 0, field_175828_a, field_175828_a, false); + this.setBlockState(worldIn, field_175825_e, 1, 2, 1, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 0, 7, 1, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 3, 0, 7, 3, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 0, 7, 2, 2, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 0, 6, 2, 0, field_175828_a, field_175828_a, false); + this.setBlockState(worldIn, field_175825_e, 6, 2, 1, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 5, 2, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 5, 2, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 5, 0, 2, 7, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 7, 2, 2, 7, field_175828_a, field_175828_a, false); + this.setBlockState(worldIn, field_175825_e, 1, 2, 6, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 5, 7, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 3, 5, 7, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 5, 7, 2, 7, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 7, 6, 2, 7, field_175828_a, field_175828_a, false); + this.setBlockState(worldIn, field_175825_e, 6, 2, 6, structureBoundingBoxIn); + + if (this.field_175830_k.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 3, 0, 4, 3, 0, field_175826_b, field_175826_b, false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 3, 0, 4, 3, 1, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 2, 0, 4, 2, 0, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 0, 4, 1, 1, field_175826_b, field_175826_b, false); + } + + if (this.field_175830_k.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 3, 7, 4, 3, 7, field_175826_b, field_175826_b, false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 3, 6, 4, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 2, 7, 4, 2, 7, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 6, 4, 1, 7, field_175826_b, field_175826_b, false); + } + + if (this.field_175830_k.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 3, 0, 3, 4, field_175826_b, field_175826_b, false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 3, 1, 3, 4, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 3, 0, 2, 4, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 3, 1, 1, 4, field_175826_b, field_175826_b, false); + } + + if (this.field_175830_k.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 3, 3, 7, 3, 4, field_175826_b, field_175826_b, false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 3, 3, 7, 3, 4, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 3, 7, 2, 4, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 3, 7, 1, 4, field_175826_b, field_175826_b, false); + } + } + else if (this.field_175833_o == 1) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 2, 2, 3, 2, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 5, 2, 3, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 5, 5, 3, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 2, 5, 3, 2, field_175826_b, field_175826_b, false); + this.setBlockState(worldIn, field_175825_e, 2, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 2, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 5, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 5, 2, 2, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 1, 3, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 1, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 7, 1, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 6, 0, 3, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 7, 7, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 1, 6, 7, 3, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 0, 7, 3, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 1, 1, 7, 3, 1, field_175826_b, field_175826_b, false); + this.setBlockState(worldIn, field_175828_a, 1, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175828_a, 0, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175828_a, 1, 2, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175828_a, 0, 2, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175828_a, 6, 2, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175828_a, 7, 2, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175828_a, 6, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175828_a, 7, 2, 1, structureBoundingBoxIn); + + if (!this.field_175830_k.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 0, 6, 3, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 6, 2, 0, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 6, 1, 0, field_175826_b, field_175826_b, false); + } + + if (!this.field_175830_k.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 7, 6, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 7, 6, 2, 7, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 7, 6, 1, 7, field_175826_b, field_175826_b, false); + } + + if (!this.field_175830_k.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 1, 0, 3, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 1, 0, 2, 6, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 1, 6, field_175826_b, field_175826_b, false); + } + + if (!this.field_175830_k.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 3, 1, 7, 3, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 1, 7, 2, 6, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 1, 1, 7, 1, 6, field_175826_b, field_175826_b, false); + } + } + else if (this.field_175833_o == 2) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 1, 0, 7, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 6, 1, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 7, 6, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 2, 7, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 0, 7, 2, 7, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 6, 2, 0, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 7, 6, 2, 7, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 0, 0, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 3, 0, 7, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 0, 6, 3, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 7, 6, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 3, 0, 2, 4, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 1, 3, 7, 2, 4, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 0, 4, 2, 0, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 7, 4, 2, 7, field_175827_c, field_175827_c, false); + + if (this.field_175830_k.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 1, 0, 4, 2, 0, false); + } + + if (this.field_175830_k.field_175966_c[EnumFacing.NORTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 1, 7, 4, 2, 7, false); + } + + if (this.field_175830_k.field_175966_c[EnumFacing.WEST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 0, 1, 3, 0, 2, 4, false); + } + + if (this.field_175830_k.field_175966_c[EnumFacing.EAST.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 7, 1, 3, 7, 2, 4, false); + } + } + + if (flag) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 3, 4, 1, 4, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 2, 3, 4, 2, 4, field_175828_a, field_175828_a, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 3, 3, 4, 3, 4, field_175826_b, field_175826_b, false); + } + + return true; + } + } + + public static class SimpleTopRoom extends StructureOceanMonumentPieces.Piece + { + public SimpleTopRoom() + { + } + + public SimpleTopRoom(EnumFacing p_i45586_1_, StructureOceanMonumentPieces.RoomDefinition p_i45586_2_, Random p_i45586_3_) + { + super(1, p_i45586_1_, p_i45586_2_, 1, 1, 1); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_175830_k.field_175967_a / 25 > 0) + { + this.func_175821_a(worldIn, structureBoundingBoxIn, 0, 0, this.field_175830_k.field_175966_c[EnumFacing.DOWN.getIndex()]); + } + + if (this.field_175830_k.field_175965_b[EnumFacing.UP.getIndex()] == null) + { + this.func_175819_a(worldIn, structureBoundingBoxIn, 1, 4, 1, 6, 4, 6, field_175828_a); + } + + for (int i = 1; i <= 6; ++i) + { + for (int j = 1; j <= 6; ++j) + { + if (randomIn.nextInt(3) != 0) + { + int k = 2 + (randomIn.nextInt(4) == 0 ? 0 : 1); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, i, k, j, i, 3, j, Blocks.sponge.getStateFromMeta(1), Blocks.sponge.getStateFromMeta(1), false); + } + } + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 1, 0, 7, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 6, 1, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 7, 6, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 2, 7, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 0, 7, 2, 7, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 6, 2, 0, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 7, 6, 2, 7, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 0, 0, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 3, 0, 7, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 0, 6, 3, 0, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 7, 6, 3, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 3, 0, 2, 4, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 1, 3, 7, 2, 4, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 0, 4, 2, 0, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 7, 4, 2, 7, field_175827_c, field_175827_c, false); + + if (this.field_175830_k.field_175966_c[EnumFacing.SOUTH.getIndex()]) + { + this.func_181655_a(worldIn, structureBoundingBoxIn, 3, 1, 0, 4, 2, 0, false); + } + + return true; + } + } + + public static class WingRoom extends StructureOceanMonumentPieces.Piece + { + private int field_175834_o; + + public WingRoom() + { + } + + public WingRoom(EnumFacing p_i45585_1_, StructureBoundingBox p_i45585_2_, int p_i45585_3_) + { + super(p_i45585_1_, p_i45585_2_); + this.field_175834_o = p_i45585_3_ & 1; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_175834_o == 0) + { + for (int i = 0; i < 4; ++i) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10 - i, 3 - i, 20 - i, 12 + i, 3 - i, 20, field_175826_b, field_175826_b, false); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 0, 6, 15, 0, 16, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 0, 6, 6, 3, 20, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 16, 0, 6, 16, 3, 20, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 1, 7, 7, 1, 20, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 15, 1, 7, 15, 1, 20, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 1, 6, 9, 3, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 13, 1, 6, 15, 3, 6, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 7, 9, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 13, 1, 7, 14, 1, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 0, 5, 13, 0, 5, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 0, 7, 12, 0, 7, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 0, 10, 8, 0, 12, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 14, 0, 10, 14, 0, 12, field_175827_c, field_175827_c, false); + + for (int i1 = 18; i1 >= 7; i1 -= 3) + { + this.setBlockState(worldIn, field_175825_e, 6, 3, i1, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 16, 3, i1, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, field_175825_e, 10, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 12, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 10, 0, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 12, 0, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 8, 3, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 14, 3, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 4, 2, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 4, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 4, 0, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 18, 2, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 18, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 18, 0, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 4, 2, 18, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 4, 1, 18, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 4, 0, 18, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 18, 2, 18, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, 18, 1, 18, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 18, 0, 18, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 9, 7, 20, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, 13, 7, 20, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 0, 21, 7, 4, 21, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 15, 0, 21, 16, 4, 21, field_175826_b, field_175826_b, false); + this.func_175817_a(worldIn, structureBoundingBoxIn, 11, 2, 16); + } + else if (this.field_175834_o == 1) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 3, 18, 13, 3, 20, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 0, 18, 9, 2, 18, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 13, 0, 18, 13, 2, 18, field_175826_b, field_175826_b, false); + int j1 = 9; + int j = 20; + int k = 5; + + for (int l = 0; l < 2; ++l) + { + this.setBlockState(worldIn, field_175826_b, j1, k + 1, j, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, j1, k, j, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175826_b, j1, k - 1, j, structureBoundingBoxIn); + j1 = 13; + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 3, 7, 15, 3, 14, field_175826_b, field_175826_b, false); + j1 = 10; + + for (int k1 = 0; k1 < 2; ++k1) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, j1, 0, 10, j1, 6, 10, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, j1, 0, 12, j1, 6, 12, field_175826_b, field_175826_b, false); + this.setBlockState(worldIn, field_175825_e, j1, 0, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, j1, 0, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, j1, 4, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, field_175825_e, j1, 4, 12, structureBoundingBoxIn); + j1 = 12; + } + + j1 = 8; + + for (int l1 = 0; l1 < 2; ++l1) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, j1, 0, 7, j1, 2, 7, field_175826_b, field_175826_b, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, j1, 0, 14, j1, 2, 14, field_175826_b, field_175826_b, false); + j1 = 14; + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 3, 8, 8, 3, 13, field_175827_c, field_175827_c, false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 14, 3, 8, 14, 3, 13, field_175827_c, field_175827_c, false); + this.func_175817_a(worldIn, structureBoundingBoxIn, 11, 5, 13); + } + + return true; + } + } + + static class XDoubleRoomFitHelper implements StructureOceanMonumentPieces.MonumentRoomFitHelper + { + private XDoubleRoomFitHelper() + { + } + + public boolean func_175969_a(StructureOceanMonumentPieces.RoomDefinition p_175969_1_) + { + return p_175969_1_.field_175966_c[EnumFacing.EAST.getIndex()] && !p_175969_1_.field_175965_b[EnumFacing.EAST.getIndex()].field_175963_d; + } + + public StructureOceanMonumentPieces.Piece func_175968_a(EnumFacing p_175968_1_, StructureOceanMonumentPieces.RoomDefinition p_175968_2_, Random p_175968_3_) + { + p_175968_2_.field_175963_d = true; + p_175968_2_.field_175965_b[EnumFacing.EAST.getIndex()].field_175963_d = true; + return new StructureOceanMonumentPieces.DoubleXRoom(p_175968_1_, p_175968_2_, p_175968_3_); + } + } + + static class XYDoubleRoomFitHelper implements StructureOceanMonumentPieces.MonumentRoomFitHelper + { + private XYDoubleRoomFitHelper() + { + } + + public boolean func_175969_a(StructureOceanMonumentPieces.RoomDefinition p_175969_1_) + { + if (p_175969_1_.field_175966_c[EnumFacing.EAST.getIndex()] && !p_175969_1_.field_175965_b[EnumFacing.EAST.getIndex()].field_175963_d && p_175969_1_.field_175966_c[EnumFacing.UP.getIndex()] && !p_175969_1_.field_175965_b[EnumFacing.UP.getIndex()].field_175963_d) + { + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition = p_175969_1_.field_175965_b[EnumFacing.EAST.getIndex()]; + return structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.UP.getIndex()] && !structureoceanmonumentpieces$roomdefinition.field_175965_b[EnumFacing.UP.getIndex()].field_175963_d; + } + else + { + return false; + } + } + + public StructureOceanMonumentPieces.Piece func_175968_a(EnumFacing p_175968_1_, StructureOceanMonumentPieces.RoomDefinition p_175968_2_, Random p_175968_3_) + { + p_175968_2_.field_175963_d = true; + p_175968_2_.field_175965_b[EnumFacing.EAST.getIndex()].field_175963_d = true; + p_175968_2_.field_175965_b[EnumFacing.UP.getIndex()].field_175963_d = true; + p_175968_2_.field_175965_b[EnumFacing.EAST.getIndex()].field_175965_b[EnumFacing.UP.getIndex()].field_175963_d = true; + return new StructureOceanMonumentPieces.DoubleXYRoom(p_175968_1_, p_175968_2_, p_175968_3_); + } + } + + static class YDoubleRoomFitHelper implements StructureOceanMonumentPieces.MonumentRoomFitHelper + { + private YDoubleRoomFitHelper() + { + } + + public boolean func_175969_a(StructureOceanMonumentPieces.RoomDefinition p_175969_1_) + { + return p_175969_1_.field_175966_c[EnumFacing.UP.getIndex()] && !p_175969_1_.field_175965_b[EnumFacing.UP.getIndex()].field_175963_d; + } + + public StructureOceanMonumentPieces.Piece func_175968_a(EnumFacing p_175968_1_, StructureOceanMonumentPieces.RoomDefinition p_175968_2_, Random p_175968_3_) + { + p_175968_2_.field_175963_d = true; + p_175968_2_.field_175965_b[EnumFacing.UP.getIndex()].field_175963_d = true; + return new StructureOceanMonumentPieces.DoubleYRoom(p_175968_1_, p_175968_2_, p_175968_3_); + } + } + + static class YZDoubleRoomFitHelper implements StructureOceanMonumentPieces.MonumentRoomFitHelper + { + private YZDoubleRoomFitHelper() + { + } + + public boolean func_175969_a(StructureOceanMonumentPieces.RoomDefinition p_175969_1_) + { + if (p_175969_1_.field_175966_c[EnumFacing.NORTH.getIndex()] && !p_175969_1_.field_175965_b[EnumFacing.NORTH.getIndex()].field_175963_d && p_175969_1_.field_175966_c[EnumFacing.UP.getIndex()] && !p_175969_1_.field_175965_b[EnumFacing.UP.getIndex()].field_175963_d) + { + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition = p_175969_1_.field_175965_b[EnumFacing.NORTH.getIndex()]; + return structureoceanmonumentpieces$roomdefinition.field_175966_c[EnumFacing.UP.getIndex()] && !structureoceanmonumentpieces$roomdefinition.field_175965_b[EnumFacing.UP.getIndex()].field_175963_d; + } + else + { + return false; + } + } + + public StructureOceanMonumentPieces.Piece func_175968_a(EnumFacing p_175968_1_, StructureOceanMonumentPieces.RoomDefinition p_175968_2_, Random p_175968_3_) + { + p_175968_2_.field_175963_d = true; + p_175968_2_.field_175965_b[EnumFacing.NORTH.getIndex()].field_175963_d = true; + p_175968_2_.field_175965_b[EnumFacing.UP.getIndex()].field_175963_d = true; + p_175968_2_.field_175965_b[EnumFacing.NORTH.getIndex()].field_175965_b[EnumFacing.UP.getIndex()].field_175963_d = true; + return new StructureOceanMonumentPieces.DoubleYZRoom(p_175968_1_, p_175968_2_, p_175968_3_); + } + } + + static class ZDoubleRoomFitHelper implements StructureOceanMonumentPieces.MonumentRoomFitHelper + { + private ZDoubleRoomFitHelper() + { + } + + public boolean func_175969_a(StructureOceanMonumentPieces.RoomDefinition p_175969_1_) + { + return p_175969_1_.field_175966_c[EnumFacing.NORTH.getIndex()] && !p_175969_1_.field_175965_b[EnumFacing.NORTH.getIndex()].field_175963_d; + } + + public StructureOceanMonumentPieces.Piece func_175968_a(EnumFacing p_175968_1_, StructureOceanMonumentPieces.RoomDefinition p_175968_2_, Random p_175968_3_) + { + StructureOceanMonumentPieces.RoomDefinition structureoceanmonumentpieces$roomdefinition = p_175968_2_; + + if (!p_175968_2_.field_175966_c[EnumFacing.NORTH.getIndex()] || p_175968_2_.field_175965_b[EnumFacing.NORTH.getIndex()].field_175963_d) + { + structureoceanmonumentpieces$roomdefinition = p_175968_2_.field_175965_b[EnumFacing.SOUTH.getIndex()]; + } + + structureoceanmonumentpieces$roomdefinition.field_175963_d = true; + structureoceanmonumentpieces$roomdefinition.field_175965_b[EnumFacing.NORTH.getIndex()].field_175963_d = true; + return new StructureOceanMonumentPieces.DoubleZRoom(p_175968_1_, structureoceanmonumentpieces$roomdefinition, p_175968_3_); + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/StructureStart.java b/src/minecraft/net/minecraft/world/gen/structure/StructureStart.java new file mode 100644 index 0000000..59a4b9f --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/StructureStart.java @@ -0,0 +1,187 @@ +package net.minecraft.world.gen.structure; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Random; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; + +public abstract class StructureStart +{ + protected LinkedList components = new LinkedList(); + protected StructureBoundingBox boundingBox; + private int chunkPosX; + private int chunkPosZ; + + public StructureStart() + { + } + + public StructureStart(int chunkX, int chunkZ) + { + this.chunkPosX = chunkX; + this.chunkPosZ = chunkZ; + } + + public StructureBoundingBox getBoundingBox() + { + return this.boundingBox; + } + + public LinkedList getComponents() + { + return this.components; + } + + /** + * Keeps iterating Structure Pieces and spawning them until the checks tell it to stop + */ + public void generateStructure(World worldIn, Random rand, StructureBoundingBox structurebb) + { + Iterator iterator = this.components.iterator(); + + while (iterator.hasNext()) + { + StructureComponent structurecomponent = (StructureComponent)iterator.next(); + + if (structurecomponent.getBoundingBox().intersectsWith(structurebb) && !structurecomponent.addComponentParts(worldIn, rand, structurebb)) + { + iterator.remove(); + } + } + } + + /** + * Calculates total bounding box based on components' bounding boxes and saves it to boundingBox + */ + protected void updateBoundingBox() + { + this.boundingBox = StructureBoundingBox.getNewBoundingBox(); + + for (StructureComponent structurecomponent : this.components) + { + this.boundingBox.expandTo(structurecomponent.getBoundingBox()); + } + } + + public NBTTagCompound writeStructureComponentsToNBT(int chunkX, int chunkZ) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setString("id", MapGenStructureIO.getStructureStartName(this)); + nbttagcompound.setInteger("ChunkX", chunkX); + nbttagcompound.setInteger("ChunkZ", chunkZ); + nbttagcompound.setTag("BB", this.boundingBox.toNBTTagIntArray()); + NBTTagList nbttaglist = new NBTTagList(); + + for (StructureComponent structurecomponent : this.components) + { + nbttaglist.appendTag(structurecomponent.createStructureBaseNBT()); + } + + nbttagcompound.setTag("Children", nbttaglist); + this.writeToNBT(nbttagcompound); + return nbttagcompound; + } + + public void writeToNBT(NBTTagCompound tagCompound) + { + } + + public void readStructureComponentsFromNBT(World worldIn, NBTTagCompound tagCompound) + { + this.chunkPosX = tagCompound.getInteger("ChunkX"); + this.chunkPosZ = tagCompound.getInteger("ChunkZ"); + + if (tagCompound.hasKey("BB")) + { + this.boundingBox = new StructureBoundingBox(tagCompound.getIntArray("BB")); + } + + NBTTagList nbttaglist = tagCompound.getTagList("Children", 10); + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + this.components.add(MapGenStructureIO.getStructureComponent(nbttaglist.getCompoundTagAt(i), worldIn)); + } + + this.readFromNBT(tagCompound); + } + + public void readFromNBT(NBTTagCompound tagCompound) + { + } + + /** + * offsets the structure Bounding Boxes up to a certain height, typically 63 - 10 + */ + protected void markAvailableHeight(World worldIn, Random rand, int p_75067_3_) + { + int i = worldIn.func_181545_F() - p_75067_3_; + int j = this.boundingBox.getYSize() + 1; + + if (j < i) + { + j += rand.nextInt(i - j); + } + + int k = j - this.boundingBox.maxY; + this.boundingBox.offset(0, k, 0); + + for (StructureComponent structurecomponent : this.components) + { + structurecomponent.func_181138_a(0, k, 0); + } + } + + protected void setRandomHeight(World worldIn, Random rand, int p_75070_3_, int p_75070_4_) + { + int i = p_75070_4_ - p_75070_3_ + 1 - this.boundingBox.getYSize(); + int j = 1; + + if (i > 1) + { + j = p_75070_3_ + rand.nextInt(i); + } + else + { + j = p_75070_3_; + } + + int k = j - this.boundingBox.minY; + this.boundingBox.offset(0, k, 0); + + for (StructureComponent structurecomponent : this.components) + { + structurecomponent.func_181138_a(0, k, 0); + } + } + + /** + * currently only defined for Villages, returns true if Village has more than 2 non-road components + */ + public boolean isSizeableStructure() + { + return true; + } + + public boolean func_175788_a(ChunkCoordIntPair pair) + { + return true; + } + + public void func_175787_b(ChunkCoordIntPair pair) + { + } + + public int getChunkPosX() + { + return this.chunkPosX; + } + + public int getChunkPosZ() + { + return this.chunkPosZ; + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java b/src/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java new file mode 100644 index 0000000..2d1939a --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/StructureStrongholdPieces.java @@ -0,0 +1,1638 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.collect.Lists; +import java.util.List; +import java.util.Random; +import net.minecraft.block.BlockEndPortalFrame; +import net.minecraft.block.BlockSilverfish; +import net.minecraft.block.BlockStoneBrick; +import net.minecraft.block.BlockStoneSlab; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityMobSpawner; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.world.World; + +@SuppressWarnings("incomplete-switch") +public class StructureStrongholdPieces +{ + private static final StructureStrongholdPieces.PieceWeight[] pieceWeightArray = new StructureStrongholdPieces.PieceWeight[] {new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Straight.class, 40, 0), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Prison.class, 5, 5), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.LeftTurn.class, 20, 0), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.RightTurn.class, 20, 0), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.RoomCrossing.class, 10, 6), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.StairsStraight.class, 5, 5), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Stairs.class, 5, 5), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Crossing.class, 5, 4), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.ChestCorridor.class, 5, 4), new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.Library.class, 10, 2) + { + public boolean canSpawnMoreStructuresOfType(int p_75189_1_) + { + return super.canSpawnMoreStructuresOfType(p_75189_1_) && p_75189_1_ > 4; + } + }, new StructureStrongholdPieces.PieceWeight(StructureStrongholdPieces.PortalRoom.class, 20, 1) + { + public boolean canSpawnMoreStructuresOfType(int p_75189_1_) + { + return super.canSpawnMoreStructuresOfType(p_75189_1_) && p_75189_1_ > 5; + } + } + }; + private static List structurePieceList; + private static Class strongComponentType; + static int totalWeight; + private static final StructureStrongholdPieces.Stones strongholdStones = new StructureStrongholdPieces.Stones(); + + public static void registerStrongholdPieces() + { + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.ChestCorridor.class, "SHCC"); + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Corridor.class, "SHFC"); + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Crossing.class, "SH5C"); + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.LeftTurn.class, "SHLT"); + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Library.class, "SHLi"); + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.PortalRoom.class, "SHPR"); + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Prison.class, "SHPH"); + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.RightTurn.class, "SHRT"); + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.RoomCrossing.class, "SHRC"); + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Stairs.class, "SHSD"); + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Stairs2.class, "SHStart"); + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.Straight.class, "SHS"); + MapGenStructureIO.registerStructureComponent(StructureStrongholdPieces.StairsStraight.class, "SHSSD"); + } + + /** + * sets up Arrays with the Structure pieces and their weights + */ + public static void prepareStructurePieces() + { + structurePieceList = Lists.newArrayList(); + + for (StructureStrongholdPieces.PieceWeight structurestrongholdpieces$pieceweight : pieceWeightArray) + { + structurestrongholdpieces$pieceweight.instancesSpawned = 0; + structurePieceList.add(structurestrongholdpieces$pieceweight); + } + + strongComponentType = null; + } + + private static boolean canAddStructurePieces() + { + boolean flag = false; + totalWeight = 0; + + for (StructureStrongholdPieces.PieceWeight structurestrongholdpieces$pieceweight : structurePieceList) + { + if (structurestrongholdpieces$pieceweight.instancesLimit > 0 && structurestrongholdpieces$pieceweight.instancesSpawned < structurestrongholdpieces$pieceweight.instancesLimit) + { + flag = true; + } + + totalWeight += structurestrongholdpieces$pieceweight.pieceWeight; + } + + return flag; + } + + private static StructureStrongholdPieces.Stronghold func_175954_a(Class p_175954_0_, List p_175954_1_, Random p_175954_2_, int p_175954_3_, int p_175954_4_, int p_175954_5_, EnumFacing p_175954_6_, int p_175954_7_) + { + StructureStrongholdPieces.Stronghold structurestrongholdpieces$stronghold = null; + + if (p_175954_0_ == StructureStrongholdPieces.Straight.class) + { + structurestrongholdpieces$stronghold = StructureStrongholdPieces.Straight.func_175862_a(p_175954_1_, p_175954_2_, p_175954_3_, p_175954_4_, p_175954_5_, p_175954_6_, p_175954_7_); + } + else if (p_175954_0_ == StructureStrongholdPieces.Prison.class) + { + structurestrongholdpieces$stronghold = StructureStrongholdPieces.Prison.func_175860_a(p_175954_1_, p_175954_2_, p_175954_3_, p_175954_4_, p_175954_5_, p_175954_6_, p_175954_7_); + } + else if (p_175954_0_ == StructureStrongholdPieces.LeftTurn.class) + { + structurestrongholdpieces$stronghold = StructureStrongholdPieces.LeftTurn.func_175867_a(p_175954_1_, p_175954_2_, p_175954_3_, p_175954_4_, p_175954_5_, p_175954_6_, p_175954_7_); + } + else if (p_175954_0_ == StructureStrongholdPieces.RightTurn.class) + { + structurestrongholdpieces$stronghold = StructureStrongholdPieces.RightTurn.func_175867_a(p_175954_1_, p_175954_2_, p_175954_3_, p_175954_4_, p_175954_5_, p_175954_6_, p_175954_7_); + } + else if (p_175954_0_ == StructureStrongholdPieces.RoomCrossing.class) + { + structurestrongholdpieces$stronghold = StructureStrongholdPieces.RoomCrossing.func_175859_a(p_175954_1_, p_175954_2_, p_175954_3_, p_175954_4_, p_175954_5_, p_175954_6_, p_175954_7_); + } + else if (p_175954_0_ == StructureStrongholdPieces.StairsStraight.class) + { + structurestrongholdpieces$stronghold = StructureStrongholdPieces.StairsStraight.func_175861_a(p_175954_1_, p_175954_2_, p_175954_3_, p_175954_4_, p_175954_5_, p_175954_6_, p_175954_7_); + } + else if (p_175954_0_ == StructureStrongholdPieces.Stairs.class) + { + structurestrongholdpieces$stronghold = StructureStrongholdPieces.Stairs.func_175863_a(p_175954_1_, p_175954_2_, p_175954_3_, p_175954_4_, p_175954_5_, p_175954_6_, p_175954_7_); + } + else if (p_175954_0_ == StructureStrongholdPieces.Crossing.class) + { + structurestrongholdpieces$stronghold = StructureStrongholdPieces.Crossing.func_175866_a(p_175954_1_, p_175954_2_, p_175954_3_, p_175954_4_, p_175954_5_, p_175954_6_, p_175954_7_); + } + else if (p_175954_0_ == StructureStrongholdPieces.ChestCorridor.class) + { + structurestrongholdpieces$stronghold = StructureStrongholdPieces.ChestCorridor.func_175868_a(p_175954_1_, p_175954_2_, p_175954_3_, p_175954_4_, p_175954_5_, p_175954_6_, p_175954_7_); + } + else if (p_175954_0_ == StructureStrongholdPieces.Library.class) + { + structurestrongholdpieces$stronghold = StructureStrongholdPieces.Library.func_175864_a(p_175954_1_, p_175954_2_, p_175954_3_, p_175954_4_, p_175954_5_, p_175954_6_, p_175954_7_); + } + else if (p_175954_0_ == StructureStrongholdPieces.PortalRoom.class) + { + structurestrongholdpieces$stronghold = StructureStrongholdPieces.PortalRoom.func_175865_a(p_175954_1_, p_175954_2_, p_175954_3_, p_175954_4_, p_175954_5_, p_175954_6_, p_175954_7_); + } + + return structurestrongholdpieces$stronghold; + } + + private static StructureStrongholdPieces.Stronghold func_175955_b(StructureStrongholdPieces.Stairs2 p_175955_0_, List p_175955_1_, Random p_175955_2_, int p_175955_3_, int p_175955_4_, int p_175955_5_, EnumFacing p_175955_6_, int p_175955_7_) + { + if (!canAddStructurePieces()) + { + return null; + } + else + { + if (strongComponentType != null) + { + StructureStrongholdPieces.Stronghold structurestrongholdpieces$stronghold = func_175954_a(strongComponentType, p_175955_1_, p_175955_2_, p_175955_3_, p_175955_4_, p_175955_5_, p_175955_6_, p_175955_7_); + strongComponentType = null; + + if (structurestrongholdpieces$stronghold != null) + { + return structurestrongholdpieces$stronghold; + } + } + + int j = 0; + + while (j < 5) + { + ++j; + int i = p_175955_2_.nextInt(totalWeight); + + for (StructureStrongholdPieces.PieceWeight structurestrongholdpieces$pieceweight : structurePieceList) + { + i -= structurestrongholdpieces$pieceweight.pieceWeight; + + if (i < 0) + { + if (!structurestrongholdpieces$pieceweight.canSpawnMoreStructuresOfType(p_175955_7_) || structurestrongholdpieces$pieceweight == p_175955_0_.strongholdPieceWeight) + { + break; + } + + StructureStrongholdPieces.Stronghold structurestrongholdpieces$stronghold1 = func_175954_a(structurestrongholdpieces$pieceweight.pieceClass, p_175955_1_, p_175955_2_, p_175955_3_, p_175955_4_, p_175955_5_, p_175955_6_, p_175955_7_); + + if (structurestrongholdpieces$stronghold1 != null) + { + ++structurestrongholdpieces$pieceweight.instancesSpawned; + p_175955_0_.strongholdPieceWeight = structurestrongholdpieces$pieceweight; + + if (!structurestrongholdpieces$pieceweight.canSpawnMoreStructures()) + { + structurePieceList.remove(structurestrongholdpieces$pieceweight); + } + + return structurestrongholdpieces$stronghold1; + } + } + } + } + + StructureBoundingBox structureboundingbox = StructureStrongholdPieces.Corridor.func_175869_a(p_175955_1_, p_175955_2_, p_175955_3_, p_175955_4_, p_175955_5_, p_175955_6_); + + if (structureboundingbox != null && structureboundingbox.minY > 1) + { + return new StructureStrongholdPieces.Corridor(p_175955_7_, p_175955_2_, structureboundingbox, p_175955_6_); + } + else + { + return null; + } + } + } + + private static StructureComponent func_175953_c(StructureStrongholdPieces.Stairs2 p_175953_0_, List p_175953_1_, Random p_175953_2_, int p_175953_3_, int p_175953_4_, int p_175953_5_, EnumFacing p_175953_6_, int p_175953_7_) + { + if (p_175953_7_ > 50) + { + return null; + } + else if (Math.abs(p_175953_3_ - p_175953_0_.getBoundingBox().minX) <= 112 && Math.abs(p_175953_5_ - p_175953_0_.getBoundingBox().minZ) <= 112) + { + StructureComponent structurecomponent = func_175955_b(p_175953_0_, p_175953_1_, p_175953_2_, p_175953_3_, p_175953_4_, p_175953_5_, p_175953_6_, p_175953_7_ + 1); + + if (structurecomponent != null) + { + p_175953_1_.add(structurecomponent); + p_175953_0_.field_75026_c.add(structurecomponent); + } + + return structurecomponent; + } + else + { + return null; + } + } + + public static class ChestCorridor extends StructureStrongholdPieces.Stronghold + { + private static final List strongholdChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.ender_pearl, 0, 1, 1, 10), new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 3), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 5), new WeightedRandomChestContent(Items.redstone, 0, 4, 9, 5), new WeightedRandomChestContent(Items.bread, 0, 1, 3, 15), new WeightedRandomChestContent(Items.apple, 0, 1, 3, 15), new WeightedRandomChestContent(Items.iron_pickaxe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_helmet, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_leggings, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_boots, 0, 1, 1, 5), new WeightedRandomChestContent(Items.golden_apple, 0, 1, 1, 1), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 1), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 1), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 1), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 1)}); + private boolean hasMadeChest; + + public ChestCorridor() + { + } + + public ChestCorridor(int p_i45582_1_, Random p_i45582_2_, StructureBoundingBox p_i45582_3_, EnumFacing p_i45582_4_) + { + super(p_i45582_1_); + this.coordBaseMode = p_i45582_4_; + this.field_143013_d = this.getRandomDoor(p_i45582_2_); + this.boundingBox = p_i45582_3_; + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("Chest", this.hasMadeChest); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.hasMadeChest = tagCompound.getBoolean("Chest"); + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 1); + } + + public static StructureStrongholdPieces.ChestCorridor func_175868_a(List p_175868_0_, Random p_175868_1_, int p_175868_2_, int p_175868_3_, int p_175868_4_, EnumFacing p_175868_5_, int p_175868_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175868_2_, p_175868_3_, p_175868_4_, -1, -1, 0, 5, 5, 7, p_175868_5_); + return canStrongholdGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175868_0_, structureboundingbox) == null ? new StructureStrongholdPieces.ChestCorridor(p_175868_6_, p_175868_1_, structureboundingbox, p_175868_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 4, 6, true, randomIn, StructureStrongholdPieces.strongholdStones); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.field_143013_d, 1, 1, 0); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, StructureStrongholdPieces.Stronghold.Door.OPENING, 1, 1, 6); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 2, 3, 1, 4, Blocks.stonebrick.getDefaultState(), Blocks.stonebrick.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.SMOOTHBRICK.getMetadata()), 3, 1, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.SMOOTHBRICK.getMetadata()), 3, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.SMOOTHBRICK.getMetadata()), 3, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.SMOOTHBRICK.getMetadata()), 3, 2, 4, structureBoundingBoxIn); + + for (int i = 2; i <= 4; ++i) + { + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.SMOOTHBRICK.getMetadata()), 2, 1, i, structureBoundingBoxIn); + } + + if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(3, 3), this.getYWithOffset(2), this.getZWithOffset(3, 3)))) + { + this.hasMadeChest = true; + this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 2, 3, WeightedRandomChestContent.func_177629_a(strongholdChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 2 + randomIn.nextInt(2)); + } + + return true; + } + } + } + + public static class Corridor extends StructureStrongholdPieces.Stronghold + { + private int field_74993_a; + + public Corridor() + { + } + + public Corridor(int p_i45581_1_, Random p_i45581_2_, StructureBoundingBox p_i45581_3_, EnumFacing p_i45581_4_) + { + super(p_i45581_1_); + this.coordBaseMode = p_i45581_4_; + this.boundingBox = p_i45581_3_; + this.field_74993_a = p_i45581_4_ != EnumFacing.NORTH && p_i45581_4_ != EnumFacing.SOUTH ? p_i45581_3_.getXSize() : p_i45581_3_.getZSize(); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setInteger("Steps", this.field_74993_a); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.field_74993_a = tagCompound.getInteger("Steps"); + } + + public static StructureBoundingBox func_175869_a(List p_175869_0_, Random p_175869_1_, int p_175869_2_, int p_175869_3_, int p_175869_4_, EnumFacing p_175869_5_) + { + int i = 3; + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175869_2_, p_175869_3_, p_175869_4_, -1, -1, 0, 5, 5, 4, p_175869_5_); + StructureComponent structurecomponent = StructureComponent.findIntersecting(p_175869_0_, structureboundingbox); + + if (structurecomponent == null) + { + return null; + } + else + { + if (structurecomponent.getBoundingBox().minY == structureboundingbox.minY) + { + for (int j = 3; j >= 1; --j) + { + structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175869_2_, p_175869_3_, p_175869_4_, -1, -1, 0, 5, 5, j - 1, p_175869_5_); + + if (!structurecomponent.getBoundingBox().intersectsWith(structureboundingbox)) + { + return StructureBoundingBox.getComponentToAddBoundingBox(p_175869_2_, p_175869_3_, p_175869_4_, -1, -1, 0, 5, 5, j, p_175869_5_); + } + } + } + + return null; + } + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + for (int i = 0; i < this.field_74993_a; ++i) + { + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 0, 0, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 1, 0, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 2, 0, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 3, 0, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 4, 0, i, structureBoundingBoxIn); + + for (int j = 1; j <= 3; ++j) + { + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 0, j, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 1, j, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, j, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 3, j, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 4, j, i, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 0, 4, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 1, 4, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 2, 4, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 3, 4, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 4, 4, i, structureBoundingBoxIn); + } + + return true; + } + } + } + + public static class Crossing extends StructureStrongholdPieces.Stronghold + { + private boolean field_74996_b; + private boolean field_74997_c; + private boolean field_74995_d; + private boolean field_74999_h; + + public Crossing() + { + } + + public Crossing(int p_i45580_1_, Random p_i45580_2_, StructureBoundingBox p_i45580_3_, EnumFacing p_i45580_4_) + { + super(p_i45580_1_); + this.coordBaseMode = p_i45580_4_; + this.field_143013_d = this.getRandomDoor(p_i45580_2_); + this.boundingBox = p_i45580_3_; + this.field_74996_b = p_i45580_2_.nextBoolean(); + this.field_74997_c = p_i45580_2_.nextBoolean(); + this.field_74995_d = p_i45580_2_.nextBoolean(); + this.field_74999_h = p_i45580_2_.nextInt(3) > 0; + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("leftLow", this.field_74996_b); + tagCompound.setBoolean("leftHigh", this.field_74997_c); + tagCompound.setBoolean("rightLow", this.field_74995_d); + tagCompound.setBoolean("rightHigh", this.field_74999_h); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.field_74996_b = tagCompound.getBoolean("leftLow"); + this.field_74997_c = tagCompound.getBoolean("leftHigh"); + this.field_74995_d = tagCompound.getBoolean("rightLow"); + this.field_74999_h = tagCompound.getBoolean("rightHigh"); + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + int i = 3; + int j = 5; + + if (this.coordBaseMode == EnumFacing.WEST || this.coordBaseMode == EnumFacing.NORTH) + { + i = 8 - i; + j = 8 - j; + } + + this.getNextComponentNormal((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 5, 1); + + if (this.field_74996_b) + { + this.getNextComponentX((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, i, 1); + } + + if (this.field_74997_c) + { + this.getNextComponentX((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, j, 7); + } + + if (this.field_74995_d) + { + this.getNextComponentZ((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, i, 1); + } + + if (this.field_74999_h) + { + this.getNextComponentZ((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, j, 7); + } + } + + public static StructureStrongholdPieces.Crossing func_175866_a(List p_175866_0_, Random p_175866_1_, int p_175866_2_, int p_175866_3_, int p_175866_4_, EnumFacing p_175866_5_, int p_175866_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175866_2_, p_175866_3_, p_175866_4_, -4, -3, 0, 10, 9, 11, p_175866_5_); + return canStrongholdGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175866_0_, structureboundingbox) == null ? new StructureStrongholdPieces.Crossing(p_175866_6_, p_175866_1_, structureboundingbox, p_175866_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 9, 8, 10, true, randomIn, StructureStrongholdPieces.strongholdStones); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.field_143013_d, 4, 3, 0); + + if (this.field_74996_b) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 1, 0, 5, 3, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + if (this.field_74995_d) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 3, 1, 9, 5, 3, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + if (this.field_74997_c) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 7, 0, 7, 9, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + if (this.field_74999_h) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 5, 7, 9, 7, 9, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 10, 7, 3, 10, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 2, 1, 8, 2, 6, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 1, 5, 4, 4, 9, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 8, 1, 5, 8, 4, 9, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 4, 7, 3, 4, 9, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 3, 5, 3, 3, 6, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 4, 3, 3, 4, Blocks.stone_slab.getDefaultState(), Blocks.stone_slab.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 6, 3, 4, 6, Blocks.stone_slab.getDefaultState(), Blocks.stone_slab.getDefaultState(), false); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 5, 1, 7, 7, 1, 8, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 9, 7, 1, 9, Blocks.stone_slab.getDefaultState(), Blocks.stone_slab.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 2, 7, 7, 2, 7, Blocks.stone_slab.getDefaultState(), Blocks.stone_slab.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 5, 7, 4, 5, 9, Blocks.stone_slab.getDefaultState(), Blocks.stone_slab.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 7, 8, 5, 9, Blocks.stone_slab.getDefaultState(), Blocks.stone_slab.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, 7, 7, 5, 9, Blocks.double_stone_slab.getDefaultState(), Blocks.double_stone_slab.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), 6, 5, 6, structureBoundingBoxIn); + return true; + } + } + } + + public static class LeftTurn extends StructureStrongholdPieces.Stronghold + { + public LeftTurn() + { + } + + public LeftTurn(int p_i45579_1_, Random p_i45579_2_, StructureBoundingBox p_i45579_3_, EnumFacing p_i45579_4_) + { + super(p_i45579_1_); + this.coordBaseMode = p_i45579_4_; + this.field_143013_d = this.getRandomDoor(p_i45579_2_); + this.boundingBox = p_i45579_3_; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + if (this.coordBaseMode != EnumFacing.NORTH && this.coordBaseMode != EnumFacing.EAST) + { + this.getNextComponentZ((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 1); + } + else + { + this.getNextComponentX((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 1); + } + } + + public static StructureStrongholdPieces.LeftTurn func_175867_a(List p_175867_0_, Random p_175867_1_, int p_175867_2_, int p_175867_3_, int p_175867_4_, EnumFacing p_175867_5_, int p_175867_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175867_2_, p_175867_3_, p_175867_4_, -1, -1, 0, 5, 5, 5, p_175867_5_); + return canStrongholdGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175867_0_, structureboundingbox) == null ? new StructureStrongholdPieces.LeftTurn(p_175867_6_, p_175867_1_, structureboundingbox, p_175867_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 4, 4, true, randomIn, StructureStrongholdPieces.strongholdStones); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.field_143013_d, 1, 1, 0); + + if (this.coordBaseMode != EnumFacing.NORTH && this.coordBaseMode != EnumFacing.EAST) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 4, 3, 3, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 3, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + return true; + } + } + } + + public static class Library extends StructureStrongholdPieces.Stronghold + { + private static final List strongholdLibraryChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.book, 0, 1, 3, 20), new WeightedRandomChestContent(Items.paper, 0, 2, 7, 20), new WeightedRandomChestContent(Items.map, 0, 1, 1, 1), new WeightedRandomChestContent(Items.compass, 0, 1, 1, 1)}); + private boolean isLargeRoom; + + public Library() + { + } + + public Library(int p_i45578_1_, Random p_i45578_2_, StructureBoundingBox p_i45578_3_, EnumFacing p_i45578_4_) + { + super(p_i45578_1_); + this.coordBaseMode = p_i45578_4_; + this.field_143013_d = this.getRandomDoor(p_i45578_2_); + this.boundingBox = p_i45578_3_; + this.isLargeRoom = p_i45578_3_.getYSize() > 6; + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("Tall", this.isLargeRoom); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.isLargeRoom = tagCompound.getBoolean("Tall"); + } + + public static StructureStrongholdPieces.Library func_175864_a(List p_175864_0_, Random p_175864_1_, int p_175864_2_, int p_175864_3_, int p_175864_4_, EnumFacing p_175864_5_, int p_175864_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175864_2_, p_175864_3_, p_175864_4_, -4, -1, 0, 14, 11, 15, p_175864_5_); + + if (!canStrongholdGoDeeper(structureboundingbox) || StructureComponent.findIntersecting(p_175864_0_, structureboundingbox) != null) + { + structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175864_2_, p_175864_3_, p_175864_4_, -4, -1, 0, 14, 6, 15, p_175864_5_); + + if (!canStrongholdGoDeeper(structureboundingbox) || StructureComponent.findIntersecting(p_175864_0_, structureboundingbox) != null) + { + return null; + } + } + + return new StructureStrongholdPieces.Library(p_175864_6_, p_175864_1_, structureboundingbox, p_175864_5_); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + int i = 11; + + if (!this.isLargeRoom) + { + i = 6; + } + + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 13, i - 1, 14, true, randomIn, StructureStrongholdPieces.strongholdStones); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.field_143013_d, 4, 1, 0); + this.func_175805_a(worldIn, structureBoundingBoxIn, randomIn, 0.07F, 2, 1, 1, 11, 4, 13, Blocks.web.getDefaultState(), Blocks.web.getDefaultState(), false); + int j = 1; + int k = 12; + + for (int l = 1; l <= 13; ++l) + { + if ((l - 1) % 4 == 0) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, l, 1, 4, l, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, l, 12, 4, l, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), 2, 3, l, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), 11, 3, l, structureBoundingBoxIn); + + if (this.isLargeRoom) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 6, l, 1, 9, l, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 6, l, 12, 9, l, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + } + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, l, 1, 4, l, Blocks.bookshelf.getDefaultState(), Blocks.bookshelf.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 1, l, 12, 4, l, Blocks.bookshelf.getDefaultState(), Blocks.bookshelf.getDefaultState(), false); + + if (this.isLargeRoom) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 6, l, 1, 9, l, Blocks.bookshelf.getDefaultState(), Blocks.bookshelf.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 6, l, 12, 9, l, Blocks.bookshelf.getDefaultState(), Blocks.bookshelf.getDefaultState(), false); + } + } + } + + for (int k1 = 3; k1 < 12; k1 += 2) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, k1, 4, 3, k1, Blocks.bookshelf.getDefaultState(), Blocks.bookshelf.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, k1, 7, 3, k1, Blocks.bookshelf.getDefaultState(), Blocks.bookshelf.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 1, k1, 10, 3, k1, Blocks.bookshelf.getDefaultState(), Blocks.bookshelf.getDefaultState(), false); + } + + if (this.isLargeRoom) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 3, 5, 13, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 5, 1, 12, 5, 13, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 5, 1, 9, 5, 2, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 5, 12, 9, 5, 13, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 9, 5, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 5, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 9, 5, 10, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 6, 2, 3, 6, 12, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 6, 2, 10, 6, 10, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 6, 2, 9, 6, 2, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 6, 12, 8, 6, 12, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 9, 6, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 8, 6, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 9, 6, 10, structureBoundingBoxIn); + int l1 = this.getMetadataWithOffset(Blocks.ladder, 3); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(l1), 10, 1, 13, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(l1), 10, 2, 13, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(l1), 10, 3, 13, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(l1), 10, 4, 13, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(l1), 10, 5, 13, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(l1), 10, 6, 13, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(l1), 10, 7, 13, structureBoundingBoxIn); + int i1 = 7; + int j1 = 7; + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), i1 - 1, 9, j1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), i1, 9, j1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), i1 - 1, 8, j1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), i1, 8, j1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), i1 - 1, 7, j1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), i1, 7, j1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), i1 - 2, 7, j1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), i1 + 1, 7, j1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), i1 - 1, 7, j1 - 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), i1 - 1, 7, j1 + 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), i1, 7, j1 - 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), i1, 7, j1 + 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), i1 - 2, 8, j1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), i1 + 1, 8, j1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), i1 - 1, 8, j1 - 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), i1 - 1, 8, j1 + 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), i1, 8, j1 - 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), i1, 8, j1 + 1, structureBoundingBoxIn); + } + + this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 3, 5, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn, 1, 5, 2)}), 1 + randomIn.nextInt(4)); + + if (this.isLargeRoom) + { + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 12, 9, 1, structureBoundingBoxIn); + this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 12, 8, 1, WeightedRandomChestContent.func_177629_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn, 1, 5, 2)}), 1 + randomIn.nextInt(4)); + } + + return true; + } + } + } + + static class PieceWeight + { + public Class pieceClass; + public final int pieceWeight; + public int instancesSpawned; + public int instancesLimit; + + public PieceWeight(Class p_i2076_1_, int p_i2076_2_, int p_i2076_3_) + { + this.pieceClass = p_i2076_1_; + this.pieceWeight = p_i2076_2_; + this.instancesLimit = p_i2076_3_; + } + + public boolean canSpawnMoreStructuresOfType(int p_75189_1_) + { + return this.instancesLimit == 0 || this.instancesSpawned < this.instancesLimit; + } + + public boolean canSpawnMoreStructures() + { + return this.instancesLimit == 0 || this.instancesSpawned < this.instancesLimit; + } + } + + public static class PortalRoom extends StructureStrongholdPieces.Stronghold + { + private boolean hasSpawner; + + public PortalRoom() + { + } + + public PortalRoom(int p_i45577_1_, Random p_i45577_2_, StructureBoundingBox p_i45577_3_, EnumFacing p_i45577_4_) + { + super(p_i45577_1_); + this.coordBaseMode = p_i45577_4_; + this.boundingBox = p_i45577_3_; + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("Mob", this.hasSpawner); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.hasSpawner = tagCompound.getBoolean("Mob"); + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + if (componentIn != null) + { + ((StructureStrongholdPieces.Stairs2)componentIn).strongholdPortalRoom = this; + } + } + + public static StructureStrongholdPieces.PortalRoom func_175865_a(List p_175865_0_, Random p_175865_1_, int p_175865_2_, int p_175865_3_, int p_175865_4_, EnumFacing p_175865_5_, int p_175865_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175865_2_, p_175865_3_, p_175865_4_, -4, -1, 0, 11, 8, 16, p_175865_5_); + return canStrongholdGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175865_0_, structureboundingbox) == null ? new StructureStrongholdPieces.PortalRoom(p_175865_6_, p_175865_1_, structureboundingbox, p_175865_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 10, 7, 15, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, StructureStrongholdPieces.Stronghold.Door.GRATES, 4, 1, 0); + int i = 6; + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, i, 1, 1, i, 14, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 9, i, 1, 9, i, 14, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 2, i, 1, 8, i, 2, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 2, i, 14, 8, i, 14, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 2, 1, 4, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 8, 1, 1, 9, 1, 4, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 1, 1, 3, Blocks.flowing_lava.getDefaultState(), Blocks.flowing_lava.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 1, 1, 9, 1, 3, Blocks.flowing_lava.getDefaultState(), Blocks.flowing_lava.getDefaultState(), false); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 3, 1, 8, 7, 1, 12, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 9, 6, 1, 11, Blocks.flowing_lava.getDefaultState(), Blocks.flowing_lava.getDefaultState(), false); + + for (int j = 3; j < 14; j += 2) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, j, 0, 4, j, Blocks.iron_bars.getDefaultState(), Blocks.iron_bars.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 3, j, 10, 4, j, Blocks.iron_bars.getDefaultState(), Blocks.iron_bars.getDefaultState(), false); + } + + for (int k1 = 2; k1 < 9; k1 += 2) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, k1, 3, 15, k1, 4, 15, Blocks.iron_bars.getDefaultState(), Blocks.iron_bars.getDefaultState(), false); + } + + int l1 = this.getMetadataWithOffset(Blocks.stone_brick_stairs, 3); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 1, 5, 6, 1, 7, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 2, 6, 6, 2, 7, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 3, 7, 6, 3, 7, false, randomIn, StructureStrongholdPieces.strongholdStones); + + for (int k = 4; k <= 6; ++k) + { + this.setBlockState(worldIn, Blocks.stone_brick_stairs.getStateFromMeta(l1), k, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_brick_stairs.getStateFromMeta(l1), k, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_brick_stairs.getStateFromMeta(l1), k, 3, 6, structureBoundingBoxIn); + } + + int i2 = EnumFacing.NORTH.getHorizontalIndex(); + int l = EnumFacing.SOUTH.getHorizontalIndex(); + int i1 = EnumFacing.EAST.getHorizontalIndex(); + int j1 = EnumFacing.WEST.getHorizontalIndex(); + + if (this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case SOUTH: + i2 = EnumFacing.SOUTH.getHorizontalIndex(); + l = EnumFacing.NORTH.getHorizontalIndex(); + break; + + case WEST: + i2 = EnumFacing.WEST.getHorizontalIndex(); + l = EnumFacing.EAST.getHorizontalIndex(); + i1 = EnumFacing.SOUTH.getHorizontalIndex(); + j1 = EnumFacing.NORTH.getHorizontalIndex(); + break; + + case EAST: + i2 = EnumFacing.EAST.getHorizontalIndex(); + l = EnumFacing.WEST.getHorizontalIndex(); + i1 = EnumFacing.SOUTH.getHorizontalIndex(); + j1 = EnumFacing.NORTH.getHorizontalIndex(); + } + } + + this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(i2).withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(randomIn.nextFloat() > 0.9F)), 4, 3, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(i2).withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(randomIn.nextFloat() > 0.9F)), 5, 3, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(i2).withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(randomIn.nextFloat() > 0.9F)), 6, 3, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(l).withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(randomIn.nextFloat() > 0.9F)), 4, 3, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(l).withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(randomIn.nextFloat() > 0.9F)), 5, 3, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(l).withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(randomIn.nextFloat() > 0.9F)), 6, 3, 12, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(i1).withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(randomIn.nextFloat() > 0.9F)), 3, 3, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(i1).withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(randomIn.nextFloat() > 0.9F)), 3, 3, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(i1).withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(randomIn.nextFloat() > 0.9F)), 3, 3, 11, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(j1).withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(randomIn.nextFloat() > 0.9F)), 7, 3, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(j1).withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(randomIn.nextFloat() > 0.9F)), 7, 3, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(j1).withProperty(BlockEndPortalFrame.EYE, Boolean.valueOf(randomIn.nextFloat() > 0.9F)), 7, 3, 11, structureBoundingBoxIn); + + if (!this.hasSpawner) + { + i = this.getYWithOffset(3); + BlockPos blockpos = new BlockPos(this.getXWithOffset(5, 6), i, this.getZWithOffset(5, 6)); + + if (structureBoundingBoxIn.isVecInside(blockpos)) + { + this.hasSpawner = true; + worldIn.setBlockState(blockpos, Blocks.mob_spawner.getDefaultState(), 2); + TileEntity tileentity = worldIn.getTileEntity(blockpos); + + if (tileentity instanceof TileEntityMobSpawner) + { + ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic().setEntityName("Silverfish"); + } + } + } + + return true; + } + } + + public static class Prison extends StructureStrongholdPieces.Stronghold + { + public Prison() + { + } + + public Prison(int p_i45576_1_, Random p_i45576_2_, StructureBoundingBox p_i45576_3_, EnumFacing p_i45576_4_) + { + super(p_i45576_1_); + this.coordBaseMode = p_i45576_4_; + this.field_143013_d = this.getRandomDoor(p_i45576_2_); + this.boundingBox = p_i45576_3_; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 1); + } + + public static StructureStrongholdPieces.Prison func_175860_a(List p_175860_0_, Random p_175860_1_, int p_175860_2_, int p_175860_3_, int p_175860_4_, EnumFacing p_175860_5_, int p_175860_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175860_2_, p_175860_3_, p_175860_4_, -1, -1, 0, 9, 5, 11, p_175860_5_); + return canStrongholdGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175860_0_, structureboundingbox) == null ? new StructureStrongholdPieces.Prison(p_175860_6_, p_175860_1_, structureboundingbox, p_175860_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 8, 4, 10, true, randomIn, StructureStrongholdPieces.strongholdStones); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.field_143013_d, 1, 1, 0); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 10, 3, 3, 10, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 4, 3, 1, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 1, 3, 4, 3, 3, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 1, 7, 4, 3, 7, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 4, 1, 9, 4, 3, 9, false, randomIn, StructureStrongholdPieces.strongholdStones); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 4, 4, 3, 6, Blocks.iron_bars.getDefaultState(), Blocks.iron_bars.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 5, 7, 3, 5, Blocks.iron_bars.getDefaultState(), Blocks.iron_bars.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), 4, 3, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), 4, 3, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.iron_door.getStateFromMeta(this.getMetadataWithOffset(Blocks.iron_door, 3)), 4, 1, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.iron_door.getStateFromMeta(this.getMetadataWithOffset(Blocks.iron_door, 3) + 8), 4, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.iron_door.getStateFromMeta(this.getMetadataWithOffset(Blocks.iron_door, 3)), 4, 1, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.iron_door.getStateFromMeta(this.getMetadataWithOffset(Blocks.iron_door, 3) + 8), 4, 2, 8, structureBoundingBoxIn); + return true; + } + } + } + + public static class RightTurn extends StructureStrongholdPieces.LeftTurn + { + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + if (this.coordBaseMode != EnumFacing.NORTH && this.coordBaseMode != EnumFacing.EAST) + { + this.getNextComponentX((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 1); + } + else + { + this.getNextComponentZ((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 1); + } + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 4, 4, true, randomIn, StructureStrongholdPieces.strongholdStones); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.field_143013_d, 1, 1, 0); + + if (this.coordBaseMode != EnumFacing.NORTH && this.coordBaseMode != EnumFacing.EAST) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 3, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 4, 3, 3, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + return true; + } + } + } + + public static class RoomCrossing extends StructureStrongholdPieces.Stronghold + { + private static final List strongholdRoomCrossingChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 5), new WeightedRandomChestContent(Items.redstone, 0, 4, 9, 5), new WeightedRandomChestContent(Items.coal, 0, 3, 8, 10), new WeightedRandomChestContent(Items.bread, 0, 1, 3, 15), new WeightedRandomChestContent(Items.apple, 0, 1, 3, 15), new WeightedRandomChestContent(Items.iron_pickaxe, 0, 1, 1, 1)}); + protected int roomType; + + public RoomCrossing() + { + } + + public RoomCrossing(int p_i45575_1_, Random p_i45575_2_, StructureBoundingBox p_i45575_3_, EnumFacing p_i45575_4_) + { + super(p_i45575_1_); + this.coordBaseMode = p_i45575_4_; + this.field_143013_d = this.getRandomDoor(p_i45575_2_); + this.boundingBox = p_i45575_3_; + this.roomType = p_i45575_2_.nextInt(5); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setInteger("Type", this.roomType); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.roomType = tagCompound.getInteger("Type"); + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 4, 1); + this.getNextComponentX((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 4); + this.getNextComponentZ((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 4); + } + + public static StructureStrongholdPieces.RoomCrossing func_175859_a(List p_175859_0_, Random p_175859_1_, int p_175859_2_, int p_175859_3_, int p_175859_4_, EnumFacing p_175859_5_, int p_175859_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175859_2_, p_175859_3_, p_175859_4_, -4, -1, 0, 11, 7, 11, p_175859_5_); + return canStrongholdGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175859_0_, structureboundingbox) == null ? new StructureStrongholdPieces.RoomCrossing(p_175859_6_, p_175859_1_, structureboundingbox, p_175859_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 10, 6, 10, true, randomIn, StructureStrongholdPieces.strongholdStones); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.field_143013_d, 4, 1, 0); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 10, 6, 3, 10, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 4, 0, 3, 6, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 1, 4, 10, 3, 6, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + + switch (this.roomType) + { + case 0: + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 5, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 5, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 5, 3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), 4, 3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), 6, 3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), 5, 3, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), 5, 3, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getDefaultState(), 4, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getDefaultState(), 4, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getDefaultState(), 4, 1, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getDefaultState(), 6, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getDefaultState(), 6, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getDefaultState(), 6, 1, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getDefaultState(), 5, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getDefaultState(), 5, 1, 6, structureBoundingBoxIn); + break; + + case 1: + for (int i1 = 0; i1 < 5; ++i1) + { + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 3, 1, 3 + i1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 7, 1, 3 + i1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 3 + i1, 1, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 3 + i1, 1, 7, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 5, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 5, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 5, 3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.flowing_water.getDefaultState(), 5, 4, 5, structureBoundingBoxIn); + break; + + case 2: + for (int i = 1; i <= 9; ++i) + { + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 1, 3, i, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 9, 3, i, structureBoundingBoxIn); + } + + for (int j = 1; j <= 9; ++j) + { + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), j, 3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), j, 3, 9, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 5, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 5, 1, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 5, 3, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 5, 3, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 6, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 3, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 6, 3, 5, structureBoundingBoxIn); + + for (int k = 1; k <= 3; ++k) + { + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, k, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 6, k, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, k, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 6, k, 6, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.torch.getDefaultState(), 5, 3, 5, structureBoundingBoxIn); + + for (int l = 2; l <= 8; ++l) + { + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 2, 3, l, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 3, 3, l, structureBoundingBoxIn); + + if (l <= 3 || l >= 7) + { + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 4, 3, l, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 5, 3, l, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 6, 3, l, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 7, 3, l, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 3, l, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 1, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(this.getMetadataWithOffset(Blocks.ladder, EnumFacing.WEST.getIndex())), 9, 3, 3, structureBoundingBoxIn); + this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 3, 4, 8, WeightedRandomChestContent.func_177629_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Items.enchanted_book.getRandom(randomIn)}), 1 + randomIn.nextInt(4)); + } + + return true; + } + } + } + + public static class Stairs extends StructureStrongholdPieces.Stronghold + { + private boolean field_75024_a; + + public Stairs() + { + } + + public Stairs(int p_i2081_1_, Random p_i2081_2_, int p_i2081_3_, int p_i2081_4_) + { + super(p_i2081_1_); + this.field_75024_a = true; + this.coordBaseMode = EnumFacing.Plane.HORIZONTAL.random(p_i2081_2_); + this.field_143013_d = StructureStrongholdPieces.Stronghold.Door.OPENING; + + switch (this.coordBaseMode) + { + case NORTH: + case SOUTH: + this.boundingBox = new StructureBoundingBox(p_i2081_3_, 64, p_i2081_4_, p_i2081_3_ + 5 - 1, 74, p_i2081_4_ + 5 - 1); + break; + + default: + this.boundingBox = new StructureBoundingBox(p_i2081_3_, 64, p_i2081_4_, p_i2081_3_ + 5 - 1, 74, p_i2081_4_ + 5 - 1); + } + } + + public Stairs(int p_i45574_1_, Random p_i45574_2_, StructureBoundingBox p_i45574_3_, EnumFacing p_i45574_4_) + { + super(p_i45574_1_); + this.field_75024_a = false; + this.coordBaseMode = p_i45574_4_; + this.field_143013_d = this.getRandomDoor(p_i45574_2_); + this.boundingBox = p_i45574_3_; + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("Source", this.field_75024_a); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.field_75024_a = tagCompound.getBoolean("Source"); + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + if (this.field_75024_a) + { + StructureStrongholdPieces.strongComponentType = StructureStrongholdPieces.Crossing.class; + } + + this.getNextComponentNormal((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 1); + } + + public static StructureStrongholdPieces.Stairs func_175863_a(List p_175863_0_, Random p_175863_1_, int p_175863_2_, int p_175863_3_, int p_175863_4_, EnumFacing p_175863_5_, int p_175863_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175863_2_, p_175863_3_, p_175863_4_, -1, -7, 0, 5, 11, 5, p_175863_5_); + return canStrongholdGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175863_0_, structureboundingbox) == null ? new StructureStrongholdPieces.Stairs(p_175863_6_, p_175863_1_, structureboundingbox, p_175863_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 10, 4, true, randomIn, StructureStrongholdPieces.strongholdStones); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.field_143013_d, 1, 7, 0); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, StructureStrongholdPieces.Stronghold.Door.OPENING, 1, 1, 4); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 2, 6, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 1, 5, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.STONE.getMetadata()), 1, 6, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 1, 5, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 1, 4, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.STONE.getMetadata()), 1, 5, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 2, 4, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 3, 3, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.STONE.getMetadata()), 3, 4, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 3, 3, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 3, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.STONE.getMetadata()), 3, 3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 2, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 1, 1, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.STONE.getMetadata()), 1, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 1, 1, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_slab.getStateFromMeta(BlockStoneSlab.EnumType.STONE.getMetadata()), 1, 1, 3, structureBoundingBoxIn); + return true; + } + } + } + + public static class Stairs2 extends StructureStrongholdPieces.Stairs + { + public StructureStrongholdPieces.PieceWeight strongholdPieceWeight; + public StructureStrongholdPieces.PortalRoom strongholdPortalRoom; + public List field_75026_c = Lists.newArrayList(); + + public Stairs2() + { + } + + public Stairs2(int p_i2083_1_, Random p_i2083_2_, int p_i2083_3_, int p_i2083_4_) + { + super(0, p_i2083_2_, p_i2083_3_, p_i2083_4_); + } + + public BlockPos getBoundingBoxCenter() + { + return this.strongholdPortalRoom != null ? this.strongholdPortalRoom.getBoundingBoxCenter() : super.getBoundingBoxCenter(); + } + } + + public static class StairsStraight extends StructureStrongholdPieces.Stronghold + { + public StairsStraight() + { + } + + public StairsStraight(int p_i45572_1_, Random p_i45572_2_, StructureBoundingBox p_i45572_3_, EnumFacing p_i45572_4_) + { + super(p_i45572_1_); + this.coordBaseMode = p_i45572_4_; + this.field_143013_d = this.getRandomDoor(p_i45572_2_); + this.boundingBox = p_i45572_3_; + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 1); + } + + public static StructureStrongholdPieces.StairsStraight func_175861_a(List p_175861_0_, Random p_175861_1_, int p_175861_2_, int p_175861_3_, int p_175861_4_, EnumFacing p_175861_5_, int p_175861_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175861_2_, p_175861_3_, p_175861_4_, -1, -7, 0, 5, 11, 8, p_175861_5_); + return canStrongholdGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175861_0_, structureboundingbox) == null ? new StructureStrongholdPieces.StairsStraight(p_175861_6_, p_175861_1_, structureboundingbox, p_175861_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 10, 7, true, randomIn, StructureStrongholdPieces.strongholdStones); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.field_143013_d, 1, 7, 0); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, StructureStrongholdPieces.Stronghold.Door.OPENING, 1, 1, 7); + int i = this.getMetadataWithOffset(Blocks.stone_stairs, 2); + + for (int j = 0; j < 6; ++j) + { + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 1, 6 - j, 1 + j, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 2, 6 - j, 1 + j, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(i), 3, 6 - j, 1 + j, structureBoundingBoxIn); + + if (j < 5) + { + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 1, 5 - j, 1 + j, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 2, 5 - j, 1 + j, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), 3, 5 - j, 1 + j, structureBoundingBoxIn); + } + } + + return true; + } + } + } + + static class Stones extends StructureComponent.BlockSelector + { + private Stones() + { + } + + public void selectBlocks(Random rand, int x, int y, int z, boolean p_75062_5_) + { + if (p_75062_5_) + { + float f = rand.nextFloat(); + + if (f < 0.2F) + { + this.blockstate = Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CRACKED_META); + } + else if (f < 0.5F) + { + this.blockstate = Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.MOSSY_META); + } + else if (f < 0.55F) + { + this.blockstate = Blocks.monster_egg.getStateFromMeta(BlockSilverfish.EnumType.STONEBRICK.getMetadata()); + } + else + { + this.blockstate = Blocks.stonebrick.getDefaultState(); + } + } + else + { + this.blockstate = Blocks.air.getDefaultState(); + } + } + } + + public static class Straight extends StructureStrongholdPieces.Stronghold + { + private boolean expandsX; + private boolean expandsZ; + + public Straight() + { + } + + public Straight(int p_i45573_1_, Random p_i45573_2_, StructureBoundingBox p_i45573_3_, EnumFacing p_i45573_4_) + { + super(p_i45573_1_); + this.coordBaseMode = p_i45573_4_; + this.field_143013_d = this.getRandomDoor(p_i45573_2_); + this.boundingBox = p_i45573_3_; + this.expandsX = p_i45573_2_.nextInt(2) == 0; + this.expandsZ = p_i45573_2_.nextInt(2) == 0; + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("Left", this.expandsX); + tagCompound.setBoolean("Right", this.expandsZ); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.expandsX = tagCompound.getBoolean("Left"); + this.expandsZ = tagCompound.getBoolean("Right"); + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + this.getNextComponentNormal((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 1); + + if (this.expandsX) + { + this.getNextComponentX((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 2); + } + + if (this.expandsZ) + { + this.getNextComponentZ((StructureStrongholdPieces.Stairs2)componentIn, listIn, rand, 1, 2); + } + } + + public static StructureStrongholdPieces.Straight func_175862_a(List p_175862_0_, Random p_175862_1_, int p_175862_2_, int p_175862_3_, int p_175862_4_, EnumFacing p_175862_5_, int p_175862_6_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175862_2_, p_175862_3_, p_175862_4_, -1, -1, 0, 5, 5, 7, p_175862_5_); + return canStrongholdGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175862_0_, structureboundingbox) == null ? new StructureStrongholdPieces.Straight(p_175862_6_, p_175862_1_, structureboundingbox, p_175862_5_) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.isLiquidInStructureBoundingBox(worldIn, structureBoundingBoxIn)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 4, 6, true, randomIn, StructureStrongholdPieces.strongholdStones); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, this.field_143013_d, 1, 1, 0); + this.placeDoor(worldIn, randomIn, structureBoundingBoxIn, StructureStrongholdPieces.Stronghold.Door.OPENING, 1, 1, 6); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 1, 2, 1, Blocks.torch.getDefaultState()); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 3, 2, 1, Blocks.torch.getDefaultState()); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 1, 2, 5, Blocks.torch.getDefaultState()); + this.randomlyPlaceBlock(worldIn, structureBoundingBoxIn, randomIn, 0.1F, 3, 2, 5, Blocks.torch.getDefaultState()); + + if (this.expandsX) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 2, 0, 3, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + if (this.expandsZ) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 2, 4, 3, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + } + + return true; + } + } + } + + abstract static class Stronghold extends StructureComponent + { + protected StructureStrongholdPieces.Stronghold.Door field_143013_d = StructureStrongholdPieces.Stronghold.Door.OPENING; + + public Stronghold() + { + } + + protected Stronghold(int p_i2087_1_) + { + super(p_i2087_1_); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + tagCompound.setString("EntryDoor", this.field_143013_d.name()); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + this.field_143013_d = StructureStrongholdPieces.Stronghold.Door.valueOf(tagCompound.getString("EntryDoor")); + } + + protected void placeDoor(World worldIn, Random p_74990_2_, StructureBoundingBox p_74990_3_, StructureStrongholdPieces.Stronghold.Door p_74990_4_, int p_74990_5_, int p_74990_6_, int p_74990_7_) + { + switch (p_74990_4_) + { + case OPENING: + default: + this.fillWithBlocks(worldIn, p_74990_3_, p_74990_5_, p_74990_6_, p_74990_7_, p_74990_5_ + 3 - 1, p_74990_6_ + 3 - 1, p_74990_7_, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + break; + + case WOOD_DOOR: + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_, p_74990_6_, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_, p_74990_6_ + 1, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_, p_74990_6_ + 2, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_ + 1, p_74990_6_ + 2, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_ + 2, p_74990_6_ + 2, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_ + 2, p_74990_6_ + 1, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_ + 2, p_74990_6_, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.oak_door.getDefaultState(), p_74990_5_ + 1, p_74990_6_, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.oak_door.getStateFromMeta(8), p_74990_5_ + 1, p_74990_6_ + 1, p_74990_7_, p_74990_3_); + break; + + case GRATES: + this.setBlockState(worldIn, Blocks.air.getDefaultState(), p_74990_5_ + 1, p_74990_6_, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), p_74990_5_ + 1, p_74990_6_ + 1, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), p_74990_5_, p_74990_6_, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), p_74990_5_, p_74990_6_ + 1, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), p_74990_5_, p_74990_6_ + 2, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), p_74990_5_ + 1, p_74990_6_ + 2, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), p_74990_5_ + 2, p_74990_6_ + 2, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), p_74990_5_ + 2, p_74990_6_ + 1, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), p_74990_5_ + 2, p_74990_6_, p_74990_7_, p_74990_3_); + break; + + case IRON_DOOR: + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_, p_74990_6_, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_, p_74990_6_ + 1, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_, p_74990_6_ + 2, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_ + 1, p_74990_6_ + 2, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_ + 2, p_74990_6_ + 2, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_ + 2, p_74990_6_ + 1, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stonebrick.getDefaultState(), p_74990_5_ + 2, p_74990_6_, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.iron_door.getDefaultState(), p_74990_5_ + 1, p_74990_6_, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.iron_door.getStateFromMeta(8), p_74990_5_ + 1, p_74990_6_ + 1, p_74990_7_, p_74990_3_); + this.setBlockState(worldIn, Blocks.stone_button.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_button, 4)), p_74990_5_ + 2, p_74990_6_ + 1, p_74990_7_ + 1, p_74990_3_); + this.setBlockState(worldIn, Blocks.stone_button.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_button, 3)), p_74990_5_ + 2, p_74990_6_ + 1, p_74990_7_ - 1, p_74990_3_); + } + } + + protected StructureStrongholdPieces.Stronghold.Door getRandomDoor(Random p_74988_1_) + { + int i = p_74988_1_.nextInt(5); + + switch (i) + { + case 0: + case 1: + default: + return StructureStrongholdPieces.Stronghold.Door.OPENING; + + case 2: + return StructureStrongholdPieces.Stronghold.Door.WOOD_DOOR; + + case 3: + return StructureStrongholdPieces.Stronghold.Door.GRATES; + + case 4: + return StructureStrongholdPieces.Stronghold.Door.IRON_DOOR; + } + } + + protected StructureComponent getNextComponentNormal(StructureStrongholdPieces.Stairs2 p_74986_1_, List p_74986_2_, Random p_74986_3_, int p_74986_4_, int p_74986_5_) + { + if (this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case NORTH: + return StructureStrongholdPieces.func_175953_c(p_74986_1_, p_74986_2_, p_74986_3_, this.boundingBox.minX + p_74986_4_, this.boundingBox.minY + p_74986_5_, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType()); + + case SOUTH: + return StructureStrongholdPieces.func_175953_c(p_74986_1_, p_74986_2_, p_74986_3_, this.boundingBox.minX + p_74986_4_, this.boundingBox.minY + p_74986_5_, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType()); + + case WEST: + return StructureStrongholdPieces.func_175953_c(p_74986_1_, p_74986_2_, p_74986_3_, this.boundingBox.minX - 1, this.boundingBox.minY + p_74986_5_, this.boundingBox.minZ + p_74986_4_, this.coordBaseMode, this.getComponentType()); + + case EAST: + return StructureStrongholdPieces.func_175953_c(p_74986_1_, p_74986_2_, p_74986_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74986_5_, this.boundingBox.minZ + p_74986_4_, this.coordBaseMode, this.getComponentType()); + } + } + + return null; + } + + protected StructureComponent getNextComponentX(StructureStrongholdPieces.Stairs2 p_74989_1_, List p_74989_2_, Random p_74989_3_, int p_74989_4_, int p_74989_5_) + { + if (this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case NORTH: + return StructureStrongholdPieces.func_175953_c(p_74989_1_, p_74989_2_, p_74989_3_, this.boundingBox.minX - 1, this.boundingBox.minY + p_74989_4_, this.boundingBox.minZ + p_74989_5_, EnumFacing.WEST, this.getComponentType()); + + case SOUTH: + return StructureStrongholdPieces.func_175953_c(p_74989_1_, p_74989_2_, p_74989_3_, this.boundingBox.minX - 1, this.boundingBox.minY + p_74989_4_, this.boundingBox.minZ + p_74989_5_, EnumFacing.WEST, this.getComponentType()); + + case WEST: + return StructureStrongholdPieces.func_175953_c(p_74989_1_, p_74989_2_, p_74989_3_, this.boundingBox.minX + p_74989_5_, this.boundingBox.minY + p_74989_4_, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType()); + + case EAST: + return StructureStrongholdPieces.func_175953_c(p_74989_1_, p_74989_2_, p_74989_3_, this.boundingBox.minX + p_74989_5_, this.boundingBox.minY + p_74989_4_, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType()); + } + } + + return null; + } + + protected StructureComponent getNextComponentZ(StructureStrongholdPieces.Stairs2 p_74987_1_, List p_74987_2_, Random p_74987_3_, int p_74987_4_, int p_74987_5_) + { + if (this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case NORTH: + return StructureStrongholdPieces.func_175953_c(p_74987_1_, p_74987_2_, p_74987_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74987_4_, this.boundingBox.minZ + p_74987_5_, EnumFacing.EAST, this.getComponentType()); + + case SOUTH: + return StructureStrongholdPieces.func_175953_c(p_74987_1_, p_74987_2_, p_74987_3_, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74987_4_, this.boundingBox.minZ + p_74987_5_, EnumFacing.EAST, this.getComponentType()); + + case WEST: + return StructureStrongholdPieces.func_175953_c(p_74987_1_, p_74987_2_, p_74987_3_, this.boundingBox.minX + p_74987_5_, this.boundingBox.minY + p_74987_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType()); + + case EAST: + return StructureStrongholdPieces.func_175953_c(p_74987_1_, p_74987_2_, p_74987_3_, this.boundingBox.minX + p_74987_5_, this.boundingBox.minY + p_74987_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType()); + } + } + + return null; + } + + protected static boolean canStrongholdGoDeeper(StructureBoundingBox p_74991_0_) + { + return p_74991_0_ != null && p_74991_0_.minY > 10; + } + + public static enum Door + { + OPENING, + WOOD_DOOR, + GRATES, + IRON_DOOR; + } + } +} diff --git a/src/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java b/src/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java new file mode 100644 index 0000000..f88a76e --- /dev/null +++ b/src/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java @@ -0,0 +1,1883 @@ +package net.minecraft.world.gen.structure; + +import com.google.common.collect.Lists; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import net.minecraft.block.Block; +import net.minecraft.block.BlockSandStone; +import net.minecraft.block.BlockStairs; +import net.minecraft.block.BlockTorch; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.WorldChunkManager; + +@SuppressWarnings("incomplete-switch") +public class StructureVillagePieces +{ + public static void registerVillagePieces() + { + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House1.class, "ViBH"); + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Field1.class, "ViDF"); + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Field2.class, "ViF"); + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Torch.class, "ViL"); + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Hall.class, "ViPH"); + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House4Garden.class, "ViSH"); + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.WoodHut.class, "ViSmH"); + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Church.class, "ViST"); + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House2.class, "ViS"); + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Start.class, "ViStart"); + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Path.class, "ViSR"); + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House3.class, "ViTRH"); + MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Well.class, "ViW"); + } + + public static List getStructureVillageWeightedPieceList(Random random, int p_75084_1_) + { + List list = Lists.newArrayList(); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House4Garden.class, 4, MathHelper.getRandomIntegerInRange(random, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Church.class, 20, MathHelper.getRandomIntegerInRange(random, 0 + p_75084_1_, 1 + p_75084_1_))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House1.class, 20, MathHelper.getRandomIntegerInRange(random, 0 + p_75084_1_, 2 + p_75084_1_))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.WoodHut.class, 3, MathHelper.getRandomIntegerInRange(random, 2 + p_75084_1_, 5 + p_75084_1_ * 3))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Hall.class, 15, MathHelper.getRandomIntegerInRange(random, 0 + p_75084_1_, 2 + p_75084_1_))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field1.class, 3, MathHelper.getRandomIntegerInRange(random, 1 + p_75084_1_, 4 + p_75084_1_))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.getRandomIntegerInRange(random, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.getRandomIntegerInRange(random, 0, 1 + p_75084_1_))); + list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.getRandomIntegerInRange(random, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) + { + if (((StructureVillagePieces.PieceWeight)iterator.next()).villagePiecesLimit == 0) + { + iterator.remove(); + } + } + + return list; + } + + private static int func_75079_a(List p_75079_0_) + { + boolean flag = false; + int i = 0; + + for (StructureVillagePieces.PieceWeight structurevillagepieces$pieceweight : p_75079_0_) + { + if (structurevillagepieces$pieceweight.villagePiecesLimit > 0 && structurevillagepieces$pieceweight.villagePiecesSpawned < structurevillagepieces$pieceweight.villagePiecesLimit) + { + flag = true; + } + + i += structurevillagepieces$pieceweight.villagePieceWeight; + } + + return flag ? i : -1; + } + + private static StructureVillagePieces.Village func_176065_a(StructureVillagePieces.Start start, StructureVillagePieces.PieceWeight weight, List p_176065_2_, Random rand, int p_176065_4_, int p_176065_5_, int p_176065_6_, EnumFacing facing, int p_176065_8_) + { + Class oclass = weight.villagePieceClass; + StructureVillagePieces.Village structurevillagepieces$village = null; + + if (oclass == StructureVillagePieces.House4Garden.class) + { + structurevillagepieces$village = StructureVillagePieces.House4Garden.func_175858_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); + } + else if (oclass == StructureVillagePieces.Church.class) + { + structurevillagepieces$village = StructureVillagePieces.Church.func_175854_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); + } + else if (oclass == StructureVillagePieces.House1.class) + { + structurevillagepieces$village = StructureVillagePieces.House1.func_175850_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); + } + else if (oclass == StructureVillagePieces.WoodHut.class) + { + structurevillagepieces$village = StructureVillagePieces.WoodHut.func_175853_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); + } + else if (oclass == StructureVillagePieces.Hall.class) + { + structurevillagepieces$village = StructureVillagePieces.Hall.func_175857_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); + } + else if (oclass == StructureVillagePieces.Field1.class) + { + structurevillagepieces$village = StructureVillagePieces.Field1.func_175851_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); + } + else if (oclass == StructureVillagePieces.Field2.class) + { + structurevillagepieces$village = StructureVillagePieces.Field2.func_175852_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); + } + else if (oclass == StructureVillagePieces.House2.class) + { + structurevillagepieces$village = StructureVillagePieces.House2.func_175855_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); + } + else if (oclass == StructureVillagePieces.House3.class) + { + structurevillagepieces$village = StructureVillagePieces.House3.func_175849_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_); + } + + return structurevillagepieces$village; + } + + private static StructureVillagePieces.Village func_176067_c(StructureVillagePieces.Start start, List p_176067_1_, Random rand, int p_176067_3_, int p_176067_4_, int p_176067_5_, EnumFacing facing, int p_176067_7_) + { + int i = func_75079_a(start.structureVillageWeightedPieceList); + + if (i <= 0) + { + return null; + } + else + { + int j = 0; + + while (j < 5) + { + ++j; + int k = rand.nextInt(i); + + for (StructureVillagePieces.PieceWeight structurevillagepieces$pieceweight : start.structureVillageWeightedPieceList) + { + k -= structurevillagepieces$pieceweight.villagePieceWeight; + + if (k < 0) + { + if (!structurevillagepieces$pieceweight.canSpawnMoreVillagePiecesOfType(p_176067_7_) || structurevillagepieces$pieceweight == start.structVillagePieceWeight && start.structureVillageWeightedPieceList.size() > 1) + { + break; + } + + StructureVillagePieces.Village structurevillagepieces$village = func_176065_a(start, structurevillagepieces$pieceweight, p_176067_1_, rand, p_176067_3_, p_176067_4_, p_176067_5_, facing, p_176067_7_); + + if (structurevillagepieces$village != null) + { + ++structurevillagepieces$pieceweight.villagePiecesSpawned; + start.structVillagePieceWeight = structurevillagepieces$pieceweight; + + if (!structurevillagepieces$pieceweight.canSpawnMoreVillagePieces()) + { + start.structureVillageWeightedPieceList.remove(structurevillagepieces$pieceweight); + } + + return structurevillagepieces$village; + } + } + } + } + + StructureBoundingBox structureboundingbox = StructureVillagePieces.Torch.func_175856_a(start, p_176067_1_, rand, p_176067_3_, p_176067_4_, p_176067_5_, facing); + + if (structureboundingbox != null) + { + return new StructureVillagePieces.Torch(start, p_176067_7_, rand, structureboundingbox, facing); + } + else + { + return null; + } + } + } + + private static StructureComponent func_176066_d(StructureVillagePieces.Start start, List p_176066_1_, Random rand, int p_176066_3_, int p_176066_4_, int p_176066_5_, EnumFacing facing, int p_176066_7_) + { + if (p_176066_7_ > 50) + { + return null; + } + else if (Math.abs(p_176066_3_ - start.getBoundingBox().minX) <= 112 && Math.abs(p_176066_5_ - start.getBoundingBox().minZ) <= 112) + { + StructureComponent structurecomponent = func_176067_c(start, p_176066_1_, rand, p_176066_3_, p_176066_4_, p_176066_5_, facing, p_176066_7_ + 1); + + if (structurecomponent != null) + { + int i = (structurecomponent.boundingBox.minX + structurecomponent.boundingBox.maxX) / 2; + int j = (structurecomponent.boundingBox.minZ + structurecomponent.boundingBox.maxZ) / 2; + int k = structurecomponent.boundingBox.maxX - structurecomponent.boundingBox.minX; + int l = structurecomponent.boundingBox.maxZ - structurecomponent.boundingBox.minZ; + int i1 = k > l ? k : l; + + if (start.getWorldChunkManager().areBiomesViable(i, j, i1 / 2 + 4, MapGenVillage.villageSpawnBiomes)) + { + p_176066_1_.add(structurecomponent); + start.field_74932_i.add(structurecomponent); + return structurecomponent; + } + } + + return null; + } + else + { + return null; + } + } + + private static StructureComponent func_176069_e(StructureVillagePieces.Start start, List p_176069_1_, Random rand, int p_176069_3_, int p_176069_4_, int p_176069_5_, EnumFacing facing, int p_176069_7_) + { + if (p_176069_7_ > 3 + start.terrainType) + { + return null; + } + else if (Math.abs(p_176069_3_ - start.getBoundingBox().minX) <= 112 && Math.abs(p_176069_5_ - start.getBoundingBox().minZ) <= 112) + { + StructureBoundingBox structureboundingbox = StructureVillagePieces.Path.func_175848_a(start, p_176069_1_, rand, p_176069_3_, p_176069_4_, p_176069_5_, facing); + + if (structureboundingbox != null && structureboundingbox.minY > 10) + { + StructureComponent structurecomponent = new StructureVillagePieces.Path(start, p_176069_7_, rand, structureboundingbox, facing); + int i = (structurecomponent.boundingBox.minX + structurecomponent.boundingBox.maxX) / 2; + int j = (structurecomponent.boundingBox.minZ + structurecomponent.boundingBox.maxZ) / 2; + int k = structurecomponent.boundingBox.maxX - structurecomponent.boundingBox.minX; + int l = structurecomponent.boundingBox.maxZ - structurecomponent.boundingBox.minZ; + int i1 = k > l ? k : l; + + if (start.getWorldChunkManager().areBiomesViable(i, j, i1 / 2 + 4, MapGenVillage.villageSpawnBiomes)) + { + p_176069_1_.add(structurecomponent); + start.field_74930_j.add(structurecomponent); + return structurecomponent; + } + } + + return null; + } + else + { + return null; + } + } + + public static class Church extends StructureVillagePieces.Village + { + public Church() + { + } + + public Church(StructureVillagePieces.Start start, int p_i45564_2_, Random rand, StructureBoundingBox p_i45564_4_, EnumFacing facing) + { + super(start, p_i45564_2_); + this.coordBaseMode = facing; + this.boundingBox = p_i45564_4_; + } + + public static StructureVillagePieces.Church func_175854_a(StructureVillagePieces.Start start, List p_175854_1_, Random rand, int p_175854_3_, int p_175854_4_, int p_175854_5_, EnumFacing facing, int p_175854_7_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175854_3_, p_175854_4_, p_175854_5_, 0, 0, 0, 5, 12, 9, facing); + return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175854_1_, structureboundingbox) == null ? new StructureVillagePieces.Church(start, p_175854_7_, rand, structureboundingbox, facing) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 12 - 1, 0); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 3, 3, 7, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 3, 9, 3, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 3, 0, 8, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 3, 10, 0, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 10, 3, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 4, 10, 3, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 4, 0, 4, 7, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 4, 4, 4, 7, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 8, 3, 4, 8, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 4, 3, 10, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 5, 3, 5, 7, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 9, 0, 4, 9, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 0, 4, 4, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 11, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 11, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 2, 11, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 2, 11, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 1, 1, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 1, 1, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 2, 1, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 3, 1, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 3, 1, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 1, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 2, 1, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 3, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 1)), 1, 2, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 0)), 3, 2, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 3, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 3, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 6, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 7, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 6, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 7, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 6, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 7, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 6, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 7, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 3, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 3, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 3, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 2, 4, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), 1, 4, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateYCCW()), 3, 4, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 2, 4, 5, structureBoundingBoxIn); + int i = this.getMetadataWithOffset(Blocks.ladder, 4); + + for (int j = 1; j <= 9; ++j) + { + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, j, 3, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 1, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 2, 0, structureBoundingBoxIn); + this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 2, 1, 0, EnumFacing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1))); + + if (this.getBlockStateFromPos(worldIn, 2, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 2, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air) + { + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 2, 0, -1, structureBoundingBoxIn); + } + + for (int l = 0; l < 9; ++l) + { + for (int k = 0; k < 5; ++k) + { + this.clearCurrentPositionBlocksUpwards(worldIn, k, 12, l, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), k, -1, l, structureBoundingBoxIn); + } + } + + this.spawnVillagers(worldIn, structureBoundingBoxIn, 2, 1, 2, 1); + return true; + } + + protected int func_180779_c(int p_180779_1_, int p_180779_2_) + { + return 2; + } + } + + public static class Field1 extends StructureVillagePieces.Village + { + private Block cropTypeA; + private Block cropTypeB; + private Block cropTypeC; + private Block cropTypeD; + + public Field1() + { + } + + public Field1(StructureVillagePieces.Start start, int p_i45570_2_, Random rand, StructureBoundingBox p_i45570_4_, EnumFacing facing) + { + super(start, p_i45570_2_); + this.coordBaseMode = facing; + this.boundingBox = p_i45570_4_; + this.cropTypeA = this.func_151559_a(rand); + this.cropTypeB = this.func_151559_a(rand); + this.cropTypeC = this.func_151559_a(rand); + this.cropTypeD = this.func_151559_a(rand); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setInteger("CA", Block.blockRegistry.getIDForObject(this.cropTypeA)); + tagCompound.setInteger("CB", Block.blockRegistry.getIDForObject(this.cropTypeB)); + tagCompound.setInteger("CC", Block.blockRegistry.getIDForObject(this.cropTypeC)); + tagCompound.setInteger("CD", Block.blockRegistry.getIDForObject(this.cropTypeD)); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.cropTypeA = Block.getBlockById(tagCompound.getInteger("CA")); + this.cropTypeB = Block.getBlockById(tagCompound.getInteger("CB")); + this.cropTypeC = Block.getBlockById(tagCompound.getInteger("CC")); + this.cropTypeD = Block.getBlockById(tagCompound.getInteger("CD")); + } + + private Block func_151559_a(Random rand) + { + switch (rand.nextInt(5)) + { + case 0: + return Blocks.carrots; + + case 1: + return Blocks.potatoes; + + default: + return Blocks.wheat; + } + } + + public static StructureVillagePieces.Field1 func_175851_a(StructureVillagePieces.Start start, List p_175851_1_, Random rand, int p_175851_3_, int p_175851_4_, int p_175851_5_, EnumFacing facing, int p_175851_7_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175851_3_, p_175851_4_, p_175851_5_, 0, 0, 0, 13, 4, 9, facing); + return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175851_1_, structureboundingbox) == null ? new StructureVillagePieces.Field1(start, p_175851_7_, rand, structureboundingbox, facing) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 12, 4, 8, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 2, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 1, 5, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 0, 1, 8, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 0, 1, 11, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 0, 0, 6, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 0, 0, 12, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 11, 0, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 8, 11, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 0, 1, 3, 0, 7, Blocks.water.getDefaultState(), Blocks.water.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 0, 1, 9, 0, 7, Blocks.water.getDefaultState(), Blocks.water.getDefaultState(), false); + + for (int i = 1; i <= 7; ++i) + { + this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 1, 1, i, structureBoundingBoxIn); + this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 2, 1, i, structureBoundingBoxIn); + this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 4, 1, i, structureBoundingBoxIn); + this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 5, 1, i, structureBoundingBoxIn); + this.setBlockState(worldIn, this.cropTypeC.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 7, 1, i, structureBoundingBoxIn); + this.setBlockState(worldIn, this.cropTypeC.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 8, 1, i, structureBoundingBoxIn); + this.setBlockState(worldIn, this.cropTypeD.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 10, 1, i, structureBoundingBoxIn); + this.setBlockState(worldIn, this.cropTypeD.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 11, 1, i, structureBoundingBoxIn); + } + + for (int k = 0; k < 9; ++k) + { + for (int j = 0; j < 13; ++j) + { + this.clearCurrentPositionBlocksUpwards(worldIn, j, 4, k, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.dirt.getDefaultState(), j, -1, k, structureBoundingBoxIn); + } + } + + return true; + } + } + + public static class Field2 extends StructureVillagePieces.Village + { + private Block cropTypeA; + private Block cropTypeB; + + public Field2() + { + } + + public Field2(StructureVillagePieces.Start start, int p_i45569_2_, Random rand, StructureBoundingBox p_i45569_4_, EnumFacing facing) + { + super(start, p_i45569_2_); + this.coordBaseMode = facing; + this.boundingBox = p_i45569_4_; + this.cropTypeA = this.func_151560_a(rand); + this.cropTypeB = this.func_151560_a(rand); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setInteger("CA", Block.blockRegistry.getIDForObject(this.cropTypeA)); + tagCompound.setInteger("CB", Block.blockRegistry.getIDForObject(this.cropTypeB)); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.cropTypeA = Block.getBlockById(tagCompound.getInteger("CA")); + this.cropTypeB = Block.getBlockById(tagCompound.getInteger("CB")); + } + + private Block func_151560_a(Random rand) + { + switch (rand.nextInt(5)) + { + case 0: + return Blocks.carrots; + + case 1: + return Blocks.potatoes; + + default: + return Blocks.wheat; + } + } + + public static StructureVillagePieces.Field2 func_175852_a(StructureVillagePieces.Start start, List p_175852_1_, Random rand, int p_175852_3_, int p_175852_4_, int p_175852_5_, EnumFacing facing, int p_175852_7_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175852_3_, p_175852_4_, p_175852_5_, 0, 0, 0, 7, 4, 9, facing); + return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175852_1_, structureboundingbox) == null ? new StructureVillagePieces.Field2(start, p_175852_7_, rand, structureboundingbox, facing) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 6, 4, 8, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 2, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 1, 5, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 0, 0, 6, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 5, 0, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 8, 5, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 0, 1, 3, 0, 7, Blocks.water.getDefaultState(), Blocks.water.getDefaultState(), false); + + for (int i = 1; i <= 7; ++i) + { + this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 1, 1, i, structureBoundingBoxIn); + this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 2, 1, i, structureBoundingBoxIn); + this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 4, 1, i, structureBoundingBoxIn); + this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 5, 1, i, structureBoundingBoxIn); + } + + for (int k = 0; k < 9; ++k) + { + for (int j = 0; j < 7; ++j) + { + this.clearCurrentPositionBlocksUpwards(worldIn, j, 4, k, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.dirt.getDefaultState(), j, -1, k, structureBoundingBoxIn); + } + } + + return true; + } + } + + public static class Hall extends StructureVillagePieces.Village + { + public Hall() + { + } + + public Hall(StructureVillagePieces.Start start, int p_i45567_2_, Random rand, StructureBoundingBox p_i45567_4_, EnumFacing facing) + { + super(start, p_i45567_2_); + this.coordBaseMode = facing; + this.boundingBox = p_i45567_4_; + } + + public static StructureVillagePieces.Hall func_175857_a(StructureVillagePieces.Start start, List p_175857_1_, Random rand, int p_175857_3_, int p_175857_4_, int p_175857_5_, EnumFacing facing, int p_175857_7_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175857_3_, p_175857_4_, p_175857_5_, 0, 0, 0, 9, 7, 11, facing); + return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175857_1_, structureboundingbox) == null ? new StructureVillagePieces.Hall(start, p_175857_7_, rand, structureboundingbox, facing) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 7 - 1, 0); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 7, 4, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 6, 8, 4, 10, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 0, 6, 8, 0, 10, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 6, 0, 6, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 6, 2, 1, 10, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 6, 8, 1, 10, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 10, 7, 1, 10, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 7, 0, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 3, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 0, 0, 8, 3, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 7, 1, 0, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 5, 7, 1, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 7, 3, 0, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 5, 7, 3, 5, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 1, 8, 4, 1, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 4, 8, 4, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 2, 8, 5, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 0, 4, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 0, 4, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 4, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 4, 3, structureBoundingBoxIn); + int i = this.getMetadataWithOffset(Blocks.oak_stairs, 3); + int j = this.getMetadataWithOffset(Blocks.oak_stairs, 2); + + for (int k = -1; k <= 2; ++k) + { + for (int l = 0; l <= 8; ++l) + { + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i), l, 4 + k, k, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j), l, 4 + k, 5 - k, structureBoundingBoxIn); + } + } + + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 2, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 8, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 8, 2, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 3, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 5, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 6, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 2, 1, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getDefaultState(), 2, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 1, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 3)), 2, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 1)), 1, 1, 3, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 0, 1, 7, 0, 3, Blocks.double_stone_slab.getDefaultState(), Blocks.double_stone_slab.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.double_stone_slab.getDefaultState(), 6, 1, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.double_stone_slab.getDefaultState(), 6, 1, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 1, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 2, 3, 1, structureBoundingBoxIn); + this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 2, 1, 0, EnumFacing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1))); + + if (this.getBlockStateFromPos(worldIn, 2, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 2, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air) + { + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 2, 0, -1, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 6, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 6, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 6, 3, 4, structureBoundingBoxIn); + this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 6, 1, 5, EnumFacing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1))); + + for (int i1 = 0; i1 < 5; ++i1) + { + for (int j1 = 0; j1 < 9; ++j1) + { + this.clearCurrentPositionBlocksUpwards(worldIn, j1, 7, i1, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), j1, -1, i1, structureBoundingBoxIn); + } + } + + this.spawnVillagers(worldIn, structureBoundingBoxIn, 4, 1, 2, 2); + return true; + } + + protected int func_180779_c(int p_180779_1_, int p_180779_2_) + { + return p_180779_1_ == 0 ? 4 : super.func_180779_c(p_180779_1_, p_180779_2_); + } + } + + public static class House1 extends StructureVillagePieces.Village + { + public House1() + { + } + + public House1(StructureVillagePieces.Start start, int p_i45571_2_, Random rand, StructureBoundingBox p_i45571_4_, EnumFacing facing) + { + super(start, p_i45571_2_); + this.coordBaseMode = facing; + this.boundingBox = p_i45571_4_; + } + + public static StructureVillagePieces.House1 func_175850_a(StructureVillagePieces.Start start, List p_175850_1_, Random rand, int p_175850_3_, int p_175850_4_, int p_175850_5_, EnumFacing facing, int p_175850_7_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175850_3_, p_175850_4_, p_175850_5_, 0, 0, 0, 9, 9, 6, facing); + return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175850_1_, structureboundingbox) == null ? new StructureVillagePieces.House1(start, p_175850_7_, rand, structureboundingbox, facing) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 9 - 1, 0); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 7, 5, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 8, 0, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 8, 5, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 1, 8, 6, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 7, 2, 8, 7, 3, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + int i = this.getMetadataWithOffset(Blocks.oak_stairs, 3); + int j = this.getMetadataWithOffset(Blocks.oak_stairs, 2); + + for (int k = -1; k <= 2; ++k) + { + for (int l = 0; l <= 8; ++l) + { + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i), l, 6 + k, k, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j), l, 6 + k, 5 - k, structureBoundingBoxIn); + } + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 1, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 5, 8, 1, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 0, 8, 1, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 0, 7, 1, 0, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 4, 0, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 5, 0, 4, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 2, 5, 8, 4, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 2, 0, 8, 4, 0, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 1, 0, 4, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 5, 7, 4, 5, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 2, 1, 8, 4, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 7, 4, 0, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 5, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 6, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 5, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 6, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 3, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 3, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 3, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 3, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 3, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 5, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 6, 2, 5, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 1, 7, 4, 1, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 4, 7, 4, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 4, 7, 3, 4, Blocks.bookshelf.getDefaultState(), Blocks.bookshelf.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 7, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 0)), 7, 1, 3, structureBoundingBoxIn); + int j1 = this.getMetadataWithOffset(Blocks.oak_stairs, 3); + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j1), 6, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j1), 5, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j1), 4, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j1), 3, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 6, 1, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getDefaultState(), 6, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 1, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getDefaultState(), 4, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.crafting_table.getDefaultState(), 7, 1, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 1, 1, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 1, 2, 0, structureBoundingBoxIn); + this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 1, 1, 0, EnumFacing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1))); + + if (this.getBlockStateFromPos(worldIn, 1, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 1, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air) + { + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 1, 0, -1, structureBoundingBoxIn); + } + + for (int k1 = 0; k1 < 6; ++k1) + { + for (int i1 = 0; i1 < 9; ++i1) + { + this.clearCurrentPositionBlocksUpwards(worldIn, i1, 9, k1, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), i1, -1, k1, structureBoundingBoxIn); + } + } + + this.spawnVillagers(worldIn, structureBoundingBoxIn, 2, 1, 2, 1); + return true; + } + + protected int func_180779_c(int p_180779_1_, int p_180779_2_) + { + return 1; + } + } + + public static class House2 extends StructureVillagePieces.Village + { + private static final List villageBlacksmithChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 3), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 5), new WeightedRandomChestContent(Items.bread, 0, 1, 3, 15), new WeightedRandomChestContent(Items.apple, 0, 1, 3, 15), new WeightedRandomChestContent(Items.iron_pickaxe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_helmet, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_leggings, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_boots, 0, 1, 1, 5), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 3, 7, 5), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.sapling), 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 3), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 1), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 1), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 1)}); + private boolean hasMadeChest; + + public House2() + { + } + + public House2(StructureVillagePieces.Start start, int p_i45563_2_, Random rand, StructureBoundingBox p_i45563_4_, EnumFacing facing) + { + super(start, p_i45563_2_); + this.coordBaseMode = facing; + this.boundingBox = p_i45563_4_; + } + + public static StructureVillagePieces.House2 func_175855_a(StructureVillagePieces.Start start, List p_175855_1_, Random rand, int p_175855_3_, int p_175855_4_, int p_175855_5_, EnumFacing facing, int p_175855_7_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175855_3_, p_175855_4_, p_175855_5_, 0, 0, 0, 10, 6, 7, facing); + return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175855_1_, structureboundingbox) == null ? new StructureVillagePieces.House2(start, p_175855_7_, rand, structureboundingbox, facing) : null; + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("Chest", this.hasMadeChest); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.hasMadeChest = tagCompound.getBoolean("Chest"); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 9, 4, 6, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 9, 0, 6, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 0, 9, 4, 6, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 9, 5, 6, Blocks.stone_slab.getDefaultState(), Blocks.stone_slab.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 8, 5, 5, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 2, 3, 0, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 4, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 0, 3, 4, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 6, 0, 4, 6, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 3, 3, 1, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 2, 3, 3, 2, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 3, 5, 3, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 5, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 6, 5, 3, 6, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 0, 5, 3, 0, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 1, 0, 9, 3, 0, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 4, 9, 4, 6, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.flowing_lava.getDefaultState(), 7, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.flowing_lava.getDefaultState(), 8, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), 9, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), 9, 2, 4, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 4, 8, 2, 5, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 6, 1, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.furnace.getDefaultState(), 6, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.furnace.getDefaultState(), 6, 3, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.double_stone_slab.getDefaultState(), 8, 1, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 2, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 2, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 2, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getDefaultState(), 2, 2, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 1, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 3)), 2, 1, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 1)), 1, 1, 4, structureBoundingBoxIn); + + if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5)))) + { + this.hasMadeChest = true; + this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, villageBlacksmithChestContents, 3 + randomIn.nextInt(6)); + } + + for (int i = 6; i <= 8; ++i) + { + if (this.getBlockStateFromPos(worldIn, i, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, i, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air) + { + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), i, 0, -1, structureBoundingBoxIn); + } + } + + for (int k = 0; k < 7; ++k) + { + for (int j = 0; j < 10; ++j) + { + this.clearCurrentPositionBlocksUpwards(worldIn, j, 6, k, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), j, -1, k, structureBoundingBoxIn); + } + } + + this.spawnVillagers(worldIn, structureBoundingBoxIn, 7, 1, 1, 1); + return true; + } + + protected int func_180779_c(int p_180779_1_, int p_180779_2_) + { + return 3; + } + } + + public static class House3 extends StructureVillagePieces.Village + { + public House3() + { + } + + public House3(StructureVillagePieces.Start start, int p_i45561_2_, Random rand, StructureBoundingBox p_i45561_4_, EnumFacing facing) + { + super(start, p_i45561_2_); + this.coordBaseMode = facing; + this.boundingBox = p_i45561_4_; + } + + public static StructureVillagePieces.House3 func_175849_a(StructureVillagePieces.Start start, List p_175849_1_, Random rand, int p_175849_3_, int p_175849_4_, int p_175849_5_, EnumFacing facing, int p_175849_7_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175849_3_, p_175849_4_, p_175849_5_, 0, 0, 0, 9, 7, 12, facing); + return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175849_1_, structureboundingbox) == null ? new StructureVillagePieces.House3(start, p_175849_7_, rand, structureboundingbox, facing) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 7 - 1, 0); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 7, 4, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 6, 8, 4, 10, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 0, 5, 8, 0, 10, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 7, 0, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 3, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 0, 0, 8, 3, 10, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 7, 2, 0, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 5, 2, 1, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 0, 6, 2, 3, 10, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 0, 10, 7, 3, 10, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 7, 3, 0, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 5, 2, 3, 5, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 1, 8, 4, 1, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 4, 3, 4, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 2, 8, 5, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 0, 4, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 0, 4, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 4, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 4, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 4, 4, structureBoundingBoxIn); + int i = this.getMetadataWithOffset(Blocks.oak_stairs, 3); + int j = this.getMetadataWithOffset(Blocks.oak_stairs, 2); + + for (int k = -1; k <= 2; ++k) + { + for (int l = 0; l <= 8; ++l) + { + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i), l, 4 + k, k, structureBoundingBoxIn); + + if ((k > -1 || l <= 1) && (k > 0 || l <= 3) && (k > 1 || l <= 4 || l >= 6)) + { + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j), l, 4 + k, 5 - k, structureBoundingBoxIn); + } + } + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 4, 5, 3, 4, 10, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 4, 2, 7, 4, 10, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 5, 4, 4, 5, 10, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 5, 4, 6, 5, 10, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 6, 3, 5, 6, 10, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + int k1 = this.getMetadataWithOffset(Blocks.oak_stairs, 0); + + for (int l1 = 4; l1 >= 1; --l1) + { + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), l1, 2 + l1, 7 - l1, structureBoundingBoxIn); + + for (int i1 = 8 - l1; i1 <= 10; ++i1) + { + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(k1), l1, 2 + l1, i1, structureBoundingBoxIn); + } + } + + int i2 = this.getMetadataWithOffset(Blocks.oak_stairs, 1); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 6, 6, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 7, 5, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i2), 6, 6, 4, structureBoundingBoxIn); + + for (int j2 = 6; j2 <= 8; ++j2) + { + for (int j1 = 5; j1 <= 10; ++j1) + { + this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i2), j2, 12 - j2, j1, structureBoundingBoxIn); + } + } + + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 2, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 4, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 5, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 6, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 8, 2, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 8, 2, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 2, 5, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 8, 2, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 8, 2, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 2, 2, 6, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 2, 7, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 2, 8, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 2, 2, 9, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 4, 4, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 5, 4, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 6, 4, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 5, 5, 10, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 1, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 2, 3, 1, structureBoundingBoxIn); + this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 2, 1, 0, EnumFacing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1))); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, -1, 3, 2, -1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + + if (this.getBlockStateFromPos(worldIn, 2, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 2, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air) + { + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 2, 0, -1, structureBoundingBoxIn); + } + + for (int k2 = 0; k2 < 5; ++k2) + { + for (int i3 = 0; i3 < 9; ++i3) + { + this.clearCurrentPositionBlocksUpwards(worldIn, i3, 7, k2, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), i3, -1, k2, structureBoundingBoxIn); + } + } + + for (int l2 = 5; l2 < 11; ++l2) + { + for (int j3 = 2; j3 < 9; ++j3) + { + this.clearCurrentPositionBlocksUpwards(worldIn, j3, 7, l2, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), j3, -1, l2, structureBoundingBoxIn); + } + } + + this.spawnVillagers(worldIn, structureBoundingBoxIn, 4, 1, 2, 2); + return true; + } + } + + public static class House4Garden extends StructureVillagePieces.Village + { + private boolean isRoofAccessible; + + public House4Garden() + { + } + + public House4Garden(StructureVillagePieces.Start start, int p_i45566_2_, Random rand, StructureBoundingBox p_i45566_4_, EnumFacing facing) + { + super(start, p_i45566_2_); + this.coordBaseMode = facing; + this.boundingBox = p_i45566_4_; + this.isRoofAccessible = rand.nextBoolean(); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setBoolean("Terrace", this.isRoofAccessible); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.isRoofAccessible = tagCompound.getBoolean("Terrace"); + } + + public static StructureVillagePieces.House4Garden func_175858_a(StructureVillagePieces.Start start, List p_175858_1_, Random rand, int p_175858_3_, int p_175858_4_, int p_175858_5_, EnumFacing facing, int p_175858_7_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175858_3_, p_175858_4_, p_175858_5_, 0, 0, 0, 5, 6, 5, facing); + return StructureComponent.findIntersecting(p_175858_1_, structureboundingbox) != null ? null : new StructureVillagePieces.House4Garden(start, p_175858_7_, rand, structureboundingbox, facing); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 0, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 0, 4, 4, 4, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 1, 3, 4, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 1, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 1, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 2, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 3, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 1, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 2, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 3, 4, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 4, 3, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 4, 3, 3, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 2, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 1, 1, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 1, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 1, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 2, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 3, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 3, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 3, 1, 0, structureBoundingBoxIn); + + if (this.getBlockStateFromPos(worldIn, 2, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 2, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air) + { + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 2, 0, -1, structureBoundingBoxIn); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 3, 3, 3, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + + if (this.isRoofAccessible) + { + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 0, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 2, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 3, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 5, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 0, 5, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 5, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 2, 5, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 3, 5, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 5, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 5, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 5, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 5, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 0, 5, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 0, 5, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 0, 5, 3, structureBoundingBoxIn); + } + + if (this.isRoofAccessible) + { + int i = this.getMetadataWithOffset(Blocks.ladder, 3); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, 1, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, 2, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, 3, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, 4, 3, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 2, 3, 1, structureBoundingBoxIn); + + for (int k = 0; k < 5; ++k) + { + for (int j = 0; j < 5; ++j) + { + this.clearCurrentPositionBlocksUpwards(worldIn, j, 6, k, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), j, -1, k, structureBoundingBoxIn); + } + } + + this.spawnVillagers(worldIn, structureBoundingBoxIn, 1, 1, 2, 1); + return true; + } + } + + public static class Path extends StructureVillagePieces.Road + { + private int length; + + public Path() + { + } + + public Path(StructureVillagePieces.Start start, int p_i45562_2_, Random rand, StructureBoundingBox p_i45562_4_, EnumFacing facing) + { + super(start, p_i45562_2_); + this.coordBaseMode = facing; + this.boundingBox = p_i45562_4_; + this.length = Math.max(p_i45562_4_.getXSize(), p_i45562_4_.getZSize()); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setInteger("Length", this.length); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.length = tagCompound.getInteger("Length"); + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + boolean flag = false; + + for (int i = rand.nextInt(5); i < this.length - 8; i += 2 + rand.nextInt(5)) + { + StructureComponent structurecomponent = this.getNextComponentNN((StructureVillagePieces.Start)componentIn, listIn, rand, 0, i); + + if (structurecomponent != null) + { + i += Math.max(structurecomponent.boundingBox.getXSize(), structurecomponent.boundingBox.getZSize()); + flag = true; + } + } + + for (int j = rand.nextInt(5); j < this.length - 8; j += 2 + rand.nextInt(5)) + { + StructureComponent structurecomponent1 = this.getNextComponentPP((StructureVillagePieces.Start)componentIn, listIn, rand, 0, j); + + if (structurecomponent1 != null) + { + j += Math.max(structurecomponent1.boundingBox.getXSize(), structurecomponent1.boundingBox.getZSize()); + flag = true; + } + } + + if (flag && rand.nextInt(3) > 0 && this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case NORTH: + StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ, EnumFacing.WEST, this.getComponentType()); + break; + + case SOUTH: + StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, EnumFacing.WEST, this.getComponentType()); + break; + + case WEST: + StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType()); + break; + + case EAST: + StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX - 2, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType()); + } + } + + if (flag && rand.nextInt(3) > 0 && this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case NORTH: + StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ, EnumFacing.EAST, this.getComponentType()); + break; + + case SOUTH: + StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, EnumFacing.EAST, this.getComponentType()); + break; + + case WEST: + StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType()); + break; + + case EAST: + StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX - 2, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType()); + } + } + } + + public static StructureBoundingBox func_175848_a(StructureVillagePieces.Start start, List p_175848_1_, Random rand, int p_175848_3_, int p_175848_4_, int p_175848_5_, EnumFacing facing) + { + for (int i = 7 * MathHelper.getRandomIntegerInRange(rand, 3, 5); i >= 7; i -= 7) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175848_3_, p_175848_4_, p_175848_5_, 0, 0, 0, 3, 3, i, facing); + + if (StructureComponent.findIntersecting(p_175848_1_, structureboundingbox) == null) + { + return structureboundingbox; + } + } + + return null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + IBlockState iblockstate = this.func_175847_a(Blocks.gravel.getDefaultState()); + IBlockState iblockstate1 = this.func_175847_a(Blocks.cobblestone.getDefaultState()); + + for (int i = this.boundingBox.minX; i <= this.boundingBox.maxX; ++i) + { + for (int j = this.boundingBox.minZ; j <= this.boundingBox.maxZ; ++j) + { + BlockPos blockpos = new BlockPos(i, 64, j); + + if (structureBoundingBoxIn.isVecInside(blockpos)) + { + blockpos = worldIn.getTopSolidOrLiquidBlock(blockpos).down(); + worldIn.setBlockState(blockpos, iblockstate, 2); + worldIn.setBlockState(blockpos.down(), iblockstate1, 2); + } + } + } + + return true; + } + } + + public static class PieceWeight + { + public Class villagePieceClass; + public final int villagePieceWeight; + public int villagePiecesSpawned; + public int villagePiecesLimit; + + public PieceWeight(Class p_i2098_1_, int p_i2098_2_, int p_i2098_3_) + { + this.villagePieceClass = p_i2098_1_; + this.villagePieceWeight = p_i2098_2_; + this.villagePiecesLimit = p_i2098_3_; + } + + public boolean canSpawnMoreVillagePiecesOfType(int p_75085_1_) + { + return this.villagePiecesLimit == 0 || this.villagePiecesSpawned < this.villagePiecesLimit; + } + + public boolean canSpawnMoreVillagePieces() + { + return this.villagePiecesLimit == 0 || this.villagePiecesSpawned < this.villagePiecesLimit; + } + } + + public abstract static class Road extends StructureVillagePieces.Village + { + public Road() + { + } + + protected Road(StructureVillagePieces.Start start, int type) + { + super(start, type); + } + } + + public static class Start extends StructureVillagePieces.Well + { + public WorldChunkManager worldChunkMngr; + public boolean inDesert; + public int terrainType; + public StructureVillagePieces.PieceWeight structVillagePieceWeight; + public List structureVillageWeightedPieceList; + public List field_74932_i = Lists.newArrayList(); + public List field_74930_j = Lists.newArrayList(); + + public Start() + { + } + + public Start(WorldChunkManager chunkManagerIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List p_i2104_6_, int p_i2104_7_) + { + super((StructureVillagePieces.Start)null, 0, rand, p_i2104_4_, p_i2104_5_); + this.worldChunkMngr = chunkManagerIn; + this.structureVillageWeightedPieceList = p_i2104_6_; + this.terrainType = p_i2104_7_; + BiomeGenBase biomegenbase = chunkManagerIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad); + this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills; + this.func_175846_a(this.inDesert); + } + + public WorldChunkManager getWorldChunkManager() + { + return this.worldChunkMngr; + } + } + + public static class Torch extends StructureVillagePieces.Village + { + public Torch() + { + } + + public Torch(StructureVillagePieces.Start start, int p_i45568_2_, Random rand, StructureBoundingBox p_i45568_4_, EnumFacing facing) + { + super(start, p_i45568_2_); + this.coordBaseMode = facing; + this.boundingBox = p_i45568_4_; + } + + public static StructureBoundingBox func_175856_a(StructureVillagePieces.Start start, List p_175856_1_, Random rand, int p_175856_3_, int p_175856_4_, int p_175856_5_, EnumFacing facing) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175856_3_, p_175856_4_, p_175856_5_, 0, 0, 0, 3, 4, 2, facing); + return StructureComponent.findIntersecting(p_175856_1_, structureboundingbox) != null ? null : structureboundingbox; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 2, 3, 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 0, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 1, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 2, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.wool.getStateFromMeta(EnumDyeColor.WHITE.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn); + boolean flag = this.coordBaseMode == EnumFacing.EAST || this.coordBaseMode == EnumFacing.NORTH; + this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), flag ? 2 : 0, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 1, 3, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateYCCW()), flag ? 0 : 2, 3, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 1, 3, -1, structureBoundingBoxIn); + return true; + } + } + + abstract static class Village extends StructureComponent + { + protected int field_143015_k = -1; + private int villagersSpawned; + private boolean isDesertVillage; + + public Village() + { + } + + protected Village(StructureVillagePieces.Start start, int type) + { + super(type); + + if (start != null) + { + this.isDesertVillage = start.inDesert; + } + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + tagCompound.setInteger("HPos", this.field_143015_k); + tagCompound.setInteger("VCount", this.villagersSpawned); + tagCompound.setBoolean("Desert", this.isDesertVillage); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + this.field_143015_k = tagCompound.getInteger("HPos"); + this.villagersSpawned = tagCompound.getInteger("VCount"); + this.isDesertVillage = tagCompound.getBoolean("Desert"); + } + + protected StructureComponent getNextComponentNN(StructureVillagePieces.Start start, List p_74891_2_, Random rand, int p_74891_4_, int p_74891_5_) + { + if (this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case NORTH: + return StructureVillagePieces.func_176066_d(start, p_74891_2_, rand, this.boundingBox.minX - 1, this.boundingBox.minY + p_74891_4_, this.boundingBox.minZ + p_74891_5_, EnumFacing.WEST, this.getComponentType()); + + case SOUTH: + return StructureVillagePieces.func_176066_d(start, p_74891_2_, rand, this.boundingBox.minX - 1, this.boundingBox.minY + p_74891_4_, this.boundingBox.minZ + p_74891_5_, EnumFacing.WEST, this.getComponentType()); + + case WEST: + return StructureVillagePieces.func_176066_d(start, p_74891_2_, rand, this.boundingBox.minX + p_74891_5_, this.boundingBox.minY + p_74891_4_, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType()); + + case EAST: + return StructureVillagePieces.func_176066_d(start, p_74891_2_, rand, this.boundingBox.minX + p_74891_5_, this.boundingBox.minY + p_74891_4_, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType()); + } + } + + return null; + } + + protected StructureComponent getNextComponentPP(StructureVillagePieces.Start start, List p_74894_2_, Random rand, int p_74894_4_, int p_74894_5_) + { + if (this.coordBaseMode != null) + { + switch (this.coordBaseMode) + { + case NORTH: + return StructureVillagePieces.func_176066_d(start, p_74894_2_, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74894_4_, this.boundingBox.minZ + p_74894_5_, EnumFacing.EAST, this.getComponentType()); + + case SOUTH: + return StructureVillagePieces.func_176066_d(start, p_74894_2_, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74894_4_, this.boundingBox.minZ + p_74894_5_, EnumFacing.EAST, this.getComponentType()); + + case WEST: + return StructureVillagePieces.func_176066_d(start, p_74894_2_, rand, this.boundingBox.minX + p_74894_5_, this.boundingBox.minY + p_74894_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType()); + + case EAST: + return StructureVillagePieces.func_176066_d(start, p_74894_2_, rand, this.boundingBox.minX + p_74894_5_, this.boundingBox.minY + p_74894_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType()); + } + } + + return null; + } + + protected int getAverageGroundLevel(World worldIn, StructureBoundingBox p_74889_2_) + { + int i = 0; + int j = 0; + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k) + { + for (int l = this.boundingBox.minX; l <= this.boundingBox.maxX; ++l) + { + blockpos$mutableblockpos.func_181079_c(l, 64, k); + + if (p_74889_2_.isVecInside(blockpos$mutableblockpos)) + { + i += Math.max(worldIn.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(), worldIn.provider.getAverageGroundLevel()); + ++j; + } + } + } + + if (j == 0) + { + return -1; + } + else + { + return i / j; + } + } + + protected static boolean canVillageGoDeeper(StructureBoundingBox p_74895_0_) + { + return p_74895_0_ != null && p_74895_0_.minY > 10; + } + + protected void spawnVillagers(World worldIn, StructureBoundingBox p_74893_2_, int p_74893_3_, int p_74893_4_, int p_74893_5_, int p_74893_6_) + { + if (this.villagersSpawned < p_74893_6_) + { + for (int i = this.villagersSpawned; i < p_74893_6_; ++i) + { + int j = this.getXWithOffset(p_74893_3_ + i, p_74893_5_); + int k = this.getYWithOffset(p_74893_4_); + int l = this.getZWithOffset(p_74893_3_ + i, p_74893_5_); + + if (!p_74893_2_.isVecInside(new BlockPos(j, k, l))) + { + break; + } + + ++this.villagersSpawned; + EntityVillager entityvillager = new EntityVillager(worldIn); + entityvillager.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F); + entityvillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null); + entityvillager.setProfession(this.func_180779_c(i, entityvillager.getProfession())); + worldIn.spawnEntityInWorld(entityvillager); + } + } + } + + protected int func_180779_c(int p_180779_1_, int p_180779_2_) + { + return p_180779_2_; + } + + protected IBlockState func_175847_a(IBlockState p_175847_1_) + { + if (this.isDesertVillage) + { + if (p_175847_1_.getBlock() == Blocks.log || p_175847_1_.getBlock() == Blocks.log2) + { + return Blocks.sandstone.getDefaultState(); + } + + if (p_175847_1_.getBlock() == Blocks.cobblestone) + { + return Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.DEFAULT.getMetadata()); + } + + if (p_175847_1_.getBlock() == Blocks.planks) + { + return Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata()); + } + + if (p_175847_1_.getBlock() == Blocks.oak_stairs) + { + return Blocks.sandstone_stairs.getDefaultState().withProperty(BlockStairs.FACING, p_175847_1_.getValue(BlockStairs.FACING)); + } + + if (p_175847_1_.getBlock() == Blocks.stone_stairs) + { + return Blocks.sandstone_stairs.getDefaultState().withProperty(BlockStairs.FACING, p_175847_1_.getValue(BlockStairs.FACING)); + } + + if (p_175847_1_.getBlock() == Blocks.gravel) + { + return Blocks.sandstone.getDefaultState(); + } + } + + return p_175847_1_; + } + + protected void setBlockState(World worldIn, IBlockState blockstateIn, int x, int y, int z, StructureBoundingBox boundingboxIn) + { + IBlockState iblockstate = this.func_175847_a(blockstateIn); + super.setBlockState(worldIn, iblockstate, x, y, z, boundingboxIn); + } + + protected void fillWithBlocks(World worldIn, StructureBoundingBox boundingboxIn, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, IBlockState boundaryBlockState, IBlockState insideBlockState, boolean existingOnly) + { + IBlockState iblockstate = this.func_175847_a(boundaryBlockState); + IBlockState iblockstate1 = this.func_175847_a(insideBlockState); + super.fillWithBlocks(worldIn, boundingboxIn, xMin, yMin, zMin, xMax, yMax, zMax, iblockstate, iblockstate1, existingOnly); + } + + protected void replaceAirAndLiquidDownwards(World worldIn, IBlockState blockstateIn, int x, int y, int z, StructureBoundingBox boundingboxIn) + { + IBlockState iblockstate = this.func_175847_a(blockstateIn); + super.replaceAirAndLiquidDownwards(worldIn, iblockstate, x, y, z, boundingboxIn); + } + + protected void func_175846_a(boolean p_175846_1_) + { + this.isDesertVillage = p_175846_1_; + } + } + + public static class Well extends StructureVillagePieces.Village + { + public Well() + { + } + + public Well(StructureVillagePieces.Start start, int p_i2109_2_, Random rand, int p_i2109_4_, int p_i2109_5_) + { + super(start, p_i2109_2_); + this.coordBaseMode = EnumFacing.Plane.HORIZONTAL.random(rand); + + switch (this.coordBaseMode) + { + case NORTH: + case SOUTH: + this.boundingBox = new StructureBoundingBox(p_i2109_4_, 64, p_i2109_5_, p_i2109_4_ + 6 - 1, 78, p_i2109_5_ + 6 - 1); + break; + + default: + this.boundingBox = new StructureBoundingBox(p_i2109_4_, 64, p_i2109_5_, p_i2109_4_ + 6 - 1, 78, p_i2109_5_ + 6 - 1); + } + } + + public void buildComponent(StructureComponent componentIn, List listIn, Random rand) + { + StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, EnumFacing.WEST, this.getComponentType()); + StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, EnumFacing.EAST, this.getComponentType()); + StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType()); + StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType()); + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 3, 0); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 4, 12, 4, Blocks.cobblestone.getDefaultState(), Blocks.flowing_water.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 12, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 3, 12, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 12, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 3, 12, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 13, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 14, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 13, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 14, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 13, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 14, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 13, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 14, 4, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 15, 1, 4, 15, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + + for (int i = 0; i <= 5; ++i) + { + for (int j = 0; j <= 5; ++j) + { + if (j == 0 || j == 5 || i == 0 || i == 5) + { + this.setBlockState(worldIn, Blocks.gravel.getDefaultState(), j, 11, i, structureBoundingBoxIn); + this.clearCurrentPositionBlocksUpwards(worldIn, j, 12, i, structureBoundingBoxIn); + } + } + } + + return true; + } + } + + public static class WoodHut extends StructureVillagePieces.Village + { + private boolean isTallHouse; + private int tablePosition; + + public WoodHut() + { + } + + public WoodHut(StructureVillagePieces.Start start, int p_i45565_2_, Random rand, StructureBoundingBox p_i45565_4_, EnumFacing facing) + { + super(start, p_i45565_2_); + this.coordBaseMode = facing; + this.boundingBox = p_i45565_4_; + this.isTallHouse = rand.nextBoolean(); + this.tablePosition = rand.nextInt(3); + } + + protected void writeStructureToNBT(NBTTagCompound tagCompound) + { + super.writeStructureToNBT(tagCompound); + tagCompound.setInteger("T", this.tablePosition); + tagCompound.setBoolean("C", this.isTallHouse); + } + + protected void readStructureFromNBT(NBTTagCompound tagCompound) + { + super.readStructureFromNBT(tagCompound); + this.tablePosition = tagCompound.getInteger("T"); + this.isTallHouse = tagCompound.getBoolean("C"); + } + + public static StructureVillagePieces.WoodHut func_175853_a(StructureVillagePieces.Start start, List p_175853_1_, Random rand, int p_175853_3_, int p_175853_4_, int p_175853_5_, EnumFacing facing, int p_175853_7_) + { + StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175853_3_, p_175853_4_, p_175853_5_, 0, 0, 0, 4, 6, 5, facing); + return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175853_1_, structureboundingbox) == null ? new StructureVillagePieces.WoodHut(start, p_175853_7_, rand, structureboundingbox, facing) : null; + } + + public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0); + } + + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 3, 5, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 3, 0, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 2, 0, 3, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false); + + if (this.isTallHouse) + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 1, 2, 4, 3, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + } + else + { + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 2, 5, 3, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + } + + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 1, 4, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 2, 4, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 1, 4, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 2, 4, 4, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 4, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 4, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 4, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 3, 4, 1, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 3, 4, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.log.getDefaultState(), 3, 4, 3, structureBoundingBoxIn); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 3, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 0, 3, 3, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 4, 0, 3, 4, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 4, 3, 3, 4, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 1, 3, 3, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 2, 3, 0, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 4, 2, 3, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 3, 2, 2, structureBoundingBoxIn); + + if (this.tablePosition > 0) + { + this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), this.tablePosition, 1, 3, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getDefaultState(), this.tablePosition, 2, 3, structureBoundingBoxIn); + } + + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 1, 1, 0, structureBoundingBoxIn); + this.setBlockState(worldIn, Blocks.air.getDefaultState(), 1, 2, 0, structureBoundingBoxIn); + this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 1, 1, 0, EnumFacing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1))); + + if (this.getBlockStateFromPos(worldIn, 1, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 1, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air) + { + this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 1, 0, -1, structureBoundingBoxIn); + } + + for (int i = 0; i < 5; ++i) + { + for (int j = 0; j < 4; ++j) + { + this.clearCurrentPositionBlocksUpwards(worldIn, j, 6, i, structureBoundingBoxIn); + this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), j, -1, i, structureBoundingBoxIn); + } + } + + this.spawnVillagers(worldIn, structureBoundingBoxIn, 1, 1, 2, 1); + return true; + } + } +} diff --git a/src/minecraft/net/minecraft/world/pathfinder/NodeProcessor.java b/src/minecraft/net/minecraft/world/pathfinder/NodeProcessor.java new file mode 100644 index 0000000..69e681e --- /dev/null +++ b/src/minecraft/net/minecraft/world/pathfinder/NodeProcessor.java @@ -0,0 +1,63 @@ +package net.minecraft.world.pathfinder; + +import net.minecraft.entity.Entity; +import net.minecraft.pathfinding.PathPoint; +import net.minecraft.util.IntHashMap; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; + +public abstract class NodeProcessor +{ + protected IBlockAccess blockaccess; + protected IntHashMap pointMap = new IntHashMap(); + protected int entitySizeX; + protected int entitySizeY; + protected int entitySizeZ; + + public void initProcessor(IBlockAccess iblockaccessIn, Entity entityIn) + { + this.blockaccess = iblockaccessIn; + this.pointMap.clearMap(); + this.entitySizeX = MathHelper.floor_float(entityIn.width + 1.0F); + this.entitySizeY = MathHelper.floor_float(entityIn.height + 1.0F); + this.entitySizeZ = MathHelper.floor_float(entityIn.width + 1.0F); + } + + /** + * This method is called when all nodes have been processed and PathEntity is created. + * {@link net.minecraft.world.pathfinder.WalkNodeProcessor WalkNodeProcessor} uses this to change its field {@link + * net.minecraft.world.pathfinder.WalkNodeProcessor#avoidsWater avoidsWater} + */ + public void postProcess() + { + } + + /** + * Returns a mapped point or creates and adds one + */ + protected PathPoint openPoint(int x, int y, int z) + { + int i = PathPoint.makeHash(x, y, z); + PathPoint pathpoint = (PathPoint)this.pointMap.lookup(i); + + if (pathpoint == null) + { + pathpoint = new PathPoint(x, y, z); + this.pointMap.addKey(i, pathpoint); + } + + return pathpoint; + } + + /** + * Returns given entity's position as PathPoint + */ + public abstract PathPoint getPathPointTo(Entity entityIn); + + /** + * Returns PathPoint for given coordinates + */ + public abstract PathPoint getPathPointToCoords(Entity entityIn, double x, double y, double target); + + public abstract int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance); +} diff --git a/src/minecraft/net/minecraft/world/pathfinder/SwimNodeProcessor.java b/src/minecraft/net/minecraft/world/pathfinder/SwimNodeProcessor.java new file mode 100644 index 0000000..89a2e06 --- /dev/null +++ b/src/minecraft/net/minecraft/world/pathfinder/SwimNodeProcessor.java @@ -0,0 +1,93 @@ +package net.minecraft.world.pathfinder; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.pathfinding.PathPoint; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; + +public class SwimNodeProcessor extends NodeProcessor +{ + public void initProcessor(IBlockAccess iblockaccessIn, Entity entityIn) + { + super.initProcessor(iblockaccessIn, entityIn); + } + + /** + * This method is called when all nodes have been processed and PathEntity is created. + * {@link net.minecraft.world.pathfinder.WalkNodeProcessor WalkNodeProcessor} uses this to change its field {@link + * net.minecraft.world.pathfinder.WalkNodeProcessor#avoidsWater avoidsWater} + */ + public void postProcess() + { + super.postProcess(); + } + + /** + * Returns given entity's position as PathPoint + */ + public PathPoint getPathPointTo(Entity entityIn) + { + return this.openPoint(MathHelper.floor_double(entityIn.getEntityBoundingBox().minX), MathHelper.floor_double(entityIn.getEntityBoundingBox().minY + 0.5D), MathHelper.floor_double(entityIn.getEntityBoundingBox().minZ)); + } + + /** + * Returns PathPoint for given coordinates + */ + public PathPoint getPathPointToCoords(Entity entityIn, double x, double y, double target) + { + return this.openPoint(MathHelper.floor_double(x - (double)(entityIn.width / 2.0F)), MathHelper.floor_double(y + 0.5D), MathHelper.floor_double(target - (double)(entityIn.width / 2.0F))); + } + + public int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) + { + int i = 0; + + for (EnumFacing enumfacing : EnumFacing.values()) + { + PathPoint pathpoint = this.getSafePoint(entityIn, currentPoint.xCoord + enumfacing.getFrontOffsetX(), currentPoint.yCoord + enumfacing.getFrontOffsetY(), currentPoint.zCoord + enumfacing.getFrontOffsetZ()); + + if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance) + { + pathOptions[i++] = pathpoint; + } + } + + return i; + } + + /** + * Returns a point that the entity can safely move to + */ + private PathPoint getSafePoint(Entity entityIn, int x, int y, int z) + { + int i = this.func_176186_b(entityIn, x, y, z); + return i == -1 ? this.openPoint(x, y, z) : null; + } + + private int func_176186_b(Entity entityIn, int x, int y, int z) + { + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int i = x; i < x + this.entitySizeX; ++i) + { + for (int j = y; j < y + this.entitySizeY; ++j) + { + for (int k = z; k < z + this.entitySizeZ; ++k) + { + Block block = this.blockaccess.getBlockState(blockpos$mutableblockpos.func_181079_c(i, j, k)).getBlock(); + + if (block.getMaterial() != Material.water) + { + return 0; + } + } + } + } + + return -1; + } +} diff --git a/src/minecraft/net/minecraft/world/pathfinder/WalkNodeProcessor.java b/src/minecraft/net/minecraft/world/pathfinder/WalkNodeProcessor.java new file mode 100644 index 0000000..c8cd3e1 --- /dev/null +++ b/src/minecraft/net/minecraft/world/pathfinder/WalkNodeProcessor.java @@ -0,0 +1,308 @@ +package net.minecraft.world.pathfinder; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.BlockFence; +import net.minecraft.block.BlockFenceGate; +import net.minecraft.block.BlockRailBase; +import net.minecraft.block.BlockWall; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.pathfinding.PathPoint; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; + +public class WalkNodeProcessor extends NodeProcessor +{ + private boolean canEnterDoors; + private boolean canBreakDoors; + private boolean avoidsWater; + private boolean canSwim; + private boolean shouldAvoidWater; + + public void initProcessor(IBlockAccess iblockaccessIn, Entity entityIn) + { + super.initProcessor(iblockaccessIn, entityIn); + this.shouldAvoidWater = this.avoidsWater; + } + + /** + * This method is called when all nodes have been processed and PathEntity is created. + * {@link net.minecraft.world.pathfinder.WalkNodeProcessor WalkNodeProcessor} uses this to change its field {@link + * net.minecraft.world.pathfinder.WalkNodeProcessor#avoidsWater avoidsWater} + */ + public void postProcess() + { + super.postProcess(); + this.avoidsWater = this.shouldAvoidWater; + } + + /** + * Returns given entity's position as PathPoint + */ + public PathPoint getPathPointTo(Entity entityIn) + { + int i; + + if (this.canSwim && entityIn.isInWater()) + { + i = (int)entityIn.getEntityBoundingBox().minY; + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor_double(entityIn.posX), i, MathHelper.floor_double(entityIn.posZ)); + + for (Block block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock(); block == Blocks.flowing_water || block == Blocks.water; block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock()) + { + ++i; + blockpos$mutableblockpos.func_181079_c(MathHelper.floor_double(entityIn.posX), i, MathHelper.floor_double(entityIn.posZ)); + } + + this.avoidsWater = false; + } + else + { + i = MathHelper.floor_double(entityIn.getEntityBoundingBox().minY + 0.5D); + } + + return this.openPoint(MathHelper.floor_double(entityIn.getEntityBoundingBox().minX), i, MathHelper.floor_double(entityIn.getEntityBoundingBox().minZ)); + } + + /** + * Returns PathPoint for given coordinates + */ + public PathPoint getPathPointToCoords(Entity entityIn, double x, double y, double target) + { + return this.openPoint(MathHelper.floor_double(x - (double)(entityIn.width / 2.0F)), MathHelper.floor_double(y), MathHelper.floor_double(target - (double)(entityIn.width / 2.0F))); + } + + public int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) + { + int i = 0; + int j = 0; + + if (this.getVerticalOffset(entityIn, currentPoint.xCoord, currentPoint.yCoord + 1, currentPoint.zCoord) == 1) + { + j = 1; + } + + PathPoint pathpoint = this.getSafePoint(entityIn, currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord + 1, j); + PathPoint pathpoint1 = this.getSafePoint(entityIn, currentPoint.xCoord - 1, currentPoint.yCoord, currentPoint.zCoord, j); + PathPoint pathpoint2 = this.getSafePoint(entityIn, currentPoint.xCoord + 1, currentPoint.yCoord, currentPoint.zCoord, j); + PathPoint pathpoint3 = this.getSafePoint(entityIn, currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord - 1, j); + + if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance) + { + pathOptions[i++] = pathpoint; + } + + if (pathpoint1 != null && !pathpoint1.visited && pathpoint1.distanceTo(targetPoint) < maxDistance) + { + pathOptions[i++] = pathpoint1; + } + + if (pathpoint2 != null && !pathpoint2.visited && pathpoint2.distanceTo(targetPoint) < maxDistance) + { + pathOptions[i++] = pathpoint2; + } + + if (pathpoint3 != null && !pathpoint3.visited && pathpoint3.distanceTo(targetPoint) < maxDistance) + { + pathOptions[i++] = pathpoint3; + } + + return i; + } + + /** + * Returns a point that the entity can safely move to + */ + private PathPoint getSafePoint(Entity entityIn, int x, int y, int z, int p_176171_5_) + { + PathPoint pathpoint = null; + int i = this.getVerticalOffset(entityIn, x, y, z); + + if (i == 2) + { + return this.openPoint(x, y, z); + } + else + { + if (i == 1) + { + pathpoint = this.openPoint(x, y, z); + } + + if (pathpoint == null && p_176171_5_ > 0 && i != -3 && i != -4 && this.getVerticalOffset(entityIn, x, y + p_176171_5_, z) == 1) + { + pathpoint = this.openPoint(x, y + p_176171_5_, z); + y += p_176171_5_; + } + + if (pathpoint != null) + { + int j = 0; + int k; + + for (k = 0; y > 0; pathpoint = this.openPoint(x, y, z)) + { + k = this.getVerticalOffset(entityIn, x, y - 1, z); + + if (this.avoidsWater && k == -1) + { + return null; + } + + if (k != 1) + { + break; + } + + if (j++ >= entityIn.getMaxFallHeight()) + { + return null; + } + + --y; + + if (y <= 0) + { + return null; + } + } + + if (k == -2) + { + return null; + } + } + + return pathpoint; + } + } + + /** + * Checks if an entity collides with blocks at a position. + * Returns 1 if clear, 0 for colliding with any solid block, -1 for water(if avoids water), + * -2 for lava, -3 for fence and wall, -4 for closed trapdoor, 2 if otherwise clear except for open trapdoor or + * water(if not avoiding) + */ + private int getVerticalOffset(Entity entityIn, int x, int y, int z) + { + return func_176170_a(this.blockaccess, entityIn, x, y, z, this.entitySizeX, this.entitySizeY, this.entitySizeZ, this.avoidsWater, this.canBreakDoors, this.canEnterDoors); + } + + public static int func_176170_a(IBlockAccess blockaccessIn, Entity entityIn, int x, int y, int z, int sizeX, int sizeY, int sizeZ, boolean avoidWater, boolean breakDoors, boolean enterDoors) + { + boolean flag = false; + BlockPos blockpos = new BlockPos(entityIn); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int i = x; i < x + sizeX; ++i) + { + for (int j = y; j < y + sizeY; ++j) + { + for (int k = z; k < z + sizeZ; ++k) + { + blockpos$mutableblockpos.func_181079_c(i, j, k); + Block block = blockaccessIn.getBlockState(blockpos$mutableblockpos).getBlock(); + + if (block.getMaterial() != Material.air) + { + if (block != Blocks.trapdoor && block != Blocks.iron_trapdoor) + { + if (block != Blocks.flowing_water && block != Blocks.water) + { + if (!enterDoors && block instanceof BlockDoor && block.getMaterial() == Material.wood) + { + return 0; + } + } + else + { + if (avoidWater) + { + return -1; + } + + flag = true; + } + } + else + { + flag = true; + } + + if (entityIn.worldObj.getBlockState(blockpos$mutableblockpos).getBlock() instanceof BlockRailBase) + { + if (!(entityIn.worldObj.getBlockState(blockpos).getBlock() instanceof BlockRailBase) && !(entityIn.worldObj.getBlockState(blockpos.down()).getBlock() instanceof BlockRailBase)) + { + return -3; + } + } + else if (!block.isPassable(blockaccessIn, blockpos$mutableblockpos) && (!breakDoors || !(block instanceof BlockDoor) || block.getMaterial() != Material.wood)) + { + if (block instanceof BlockFence || block instanceof BlockFenceGate || block instanceof BlockWall) + { + return -3; + } + + if (block == Blocks.trapdoor || block == Blocks.iron_trapdoor) + { + return -4; + } + + Material material = block.getMaterial(); + + if (material != Material.lava) + { + return 0; + } + + if (!entityIn.isInLava()) + { + return -2; + } + } + } + } + } + } + + return flag ? 2 : 1; + } + + public void setEnterDoors(boolean canEnterDoorsIn) + { + this.canEnterDoors = canEnterDoorsIn; + } + + public void setBreakDoors(boolean canBreakDoorsIn) + { + this.canBreakDoors = canBreakDoorsIn; + } + + public void setAvoidsWater(boolean avoidsWaterIn) + { + this.avoidsWater = avoidsWaterIn; + } + + public void setCanSwim(boolean canSwimIn) + { + this.canSwim = canSwimIn; + } + + public boolean getEnterDoors() + { + return this.canEnterDoors; + } + + public boolean getCanSwim() + { + return this.canSwim; + } + + public boolean getAvoidsWater() + { + return this.avoidsWater; + } +} diff --git a/src/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java b/src/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java new file mode 100644 index 0000000..11e33e1 --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/DerivedWorldInfo.java @@ -0,0 +1,310 @@ +package net.minecraft.world.storage; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.BlockPos; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.GameRules; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.WorldType; + +public class DerivedWorldInfo extends WorldInfo +{ + /** Instance of WorldInfo. */ + private final WorldInfo theWorldInfo; + + public DerivedWorldInfo(WorldInfo p_i2145_1_) + { + this.theWorldInfo = p_i2145_1_; + } + + /** + * Gets the NBTTagCompound for the worldInfo + */ + public NBTTagCompound getNBTTagCompound() + { + return this.theWorldInfo.getNBTTagCompound(); + } + + /** + * Creates a new NBTTagCompound for the world, with the given NBTTag as the "Player" + */ + public NBTTagCompound cloneNBTCompound(NBTTagCompound nbt) + { + return this.theWorldInfo.cloneNBTCompound(nbt); + } + + /** + * Returns the seed of current world. + */ + public long getSeed() + { + return this.theWorldInfo.getSeed(); + } + + /** + * Returns the x spawn position + */ + public int getSpawnX() + { + return this.theWorldInfo.getSpawnX(); + } + + /** + * Return the Y axis spawning point of the player. + */ + public int getSpawnY() + { + return this.theWorldInfo.getSpawnY(); + } + + /** + * Returns the z spawn position + */ + public int getSpawnZ() + { + return this.theWorldInfo.getSpawnZ(); + } + + public long getWorldTotalTime() + { + return this.theWorldInfo.getWorldTotalTime(); + } + + /** + * Get current world time + */ + public long getWorldTime() + { + return this.theWorldInfo.getWorldTime(); + } + + public long getSizeOnDisk() + { + return this.theWorldInfo.getSizeOnDisk(); + } + + /** + * Returns the player's NBTTagCompound to be loaded + */ + public NBTTagCompound getPlayerNBTTagCompound() + { + return this.theWorldInfo.getPlayerNBTTagCompound(); + } + + /** + * Get current world name + */ + public String getWorldName() + { + return this.theWorldInfo.getWorldName(); + } + + /** + * Returns the save version of this world + */ + public int getSaveVersion() + { + return this.theWorldInfo.getSaveVersion(); + } + + /** + * Return the last time the player was in this world. + */ + public long getLastTimePlayed() + { + return this.theWorldInfo.getLastTimePlayed(); + } + + /** + * Returns true if it is thundering, false otherwise. + */ + public boolean isThundering() + { + return this.theWorldInfo.isThundering(); + } + + /** + * Returns the number of ticks until next thunderbolt. + */ + public int getThunderTime() + { + return this.theWorldInfo.getThunderTime(); + } + + /** + * Returns true if it is raining, false otherwise. + */ + public boolean isRaining() + { + return this.theWorldInfo.isRaining(); + } + + /** + * Return the number of ticks until rain. + */ + public int getRainTime() + { + return this.theWorldInfo.getRainTime(); + } + + /** + * Gets the GameType. + */ + public WorldSettings.GameType getGameType() + { + return this.theWorldInfo.getGameType(); + } + + /** + * Set the x spawn position to the passed in value + */ + public void setSpawnX(int x) + { + } + + /** + * Sets the y spawn position + */ + public void setSpawnY(int y) + { + } + + /** + * Set the z spawn position to the passed in value + */ + public void setSpawnZ(int z) + { + } + + public void setWorldTotalTime(long time) + { + } + + /** + * Set current world time + */ + public void setWorldTime(long time) + { + } + + public void setSpawn(BlockPos spawnPoint) + { + } + + public void setWorldName(String worldName) + { + } + + /** + * Sets the save version of the world + */ + public void setSaveVersion(int version) + { + } + + /** + * Sets whether it is thundering or not. + */ + public void setThundering(boolean thunderingIn) + { + } + + /** + * Defines the number of ticks until next thunderbolt. + */ + public void setThunderTime(int time) + { + } + + /** + * Sets whether it is raining or not. + */ + public void setRaining(boolean isRaining) + { + } + + /** + * Sets the number of ticks until rain. + */ + public void setRainTime(int time) + { + } + + /** + * Get whether the map features (e.g. strongholds) generation is enabled or disabled. + */ + public boolean isMapFeaturesEnabled() + { + return this.theWorldInfo.isMapFeaturesEnabled(); + } + + /** + * Returns true if hardcore mode is enabled, otherwise false + */ + public boolean isHardcoreModeEnabled() + { + return this.theWorldInfo.isHardcoreModeEnabled(); + } + + public WorldType getTerrainType() + { + return this.theWorldInfo.getTerrainType(); + } + + public void setTerrainType(WorldType type) + { + } + + /** + * Returns true if commands are allowed on this World. + */ + public boolean areCommandsAllowed() + { + return this.theWorldInfo.areCommandsAllowed(); + } + + public void setAllowCommands(boolean allow) + { + } + + /** + * Returns true if the World is initialized. + */ + public boolean isInitialized() + { + return this.theWorldInfo.isInitialized(); + } + + /** + * Sets the initialization status of the World. + */ + public void setServerInitialized(boolean initializedIn) + { + } + + /** + * Gets the GameRules class Instance. + */ + public GameRules getGameRulesInstance() + { + return this.theWorldInfo.getGameRulesInstance(); + } + + public EnumDifficulty getDifficulty() + { + return this.theWorldInfo.getDifficulty(); + } + + public void setDifficulty(EnumDifficulty newDifficulty) + { + } + + public boolean isDifficultyLocked() + { + return this.theWorldInfo.isDifficultyLocked(); + } + + public void setDifficultyLocked(boolean locked) + { + } +} diff --git a/src/minecraft/net/minecraft/world/storage/IPlayerFileData.java b/src/minecraft/net/minecraft/world/storage/IPlayerFileData.java new file mode 100644 index 0000000..514b28e --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/IPlayerFileData.java @@ -0,0 +1,22 @@ +package net.minecraft.world.storage; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; + +public interface IPlayerFileData +{ + /** + * Writes the player data to disk from the specified PlayerEntityMP. + */ + void writePlayerData(EntityPlayer player); + + /** + * Reads the player data from disk into the specified PlayerEntityMP. + */ + NBTTagCompound readPlayerData(EntityPlayer player); + + /** + * Returns an array of usernames for which player.dat exists for. + */ + String[] getAvailablePlayerDat(); +} diff --git a/src/minecraft/net/minecraft/world/storage/ISaveFormat.java b/src/minecraft/net/minecraft/world/storage/ISaveFormat.java new file mode 100644 index 0000000..4ed42d5 --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/ISaveFormat.java @@ -0,0 +1,58 @@ +package net.minecraft.world.storage; + +import java.util.List; +import net.minecraft.client.AnvilConverterException; +import net.minecraft.util.IProgressUpdate; + +public interface ISaveFormat +{ + /** + * Returns the name of the save format. + */ + String getName(); + + /** + * Returns back a loader for the specified save directory + */ + ISaveHandler getSaveLoader(String saveName, boolean storePlayerdata); + + List getSaveList() throws AnvilConverterException; + + void flushCache(); + + /** + * Returns the world's WorldInfo object + */ + WorldInfo getWorldInfo(String saveName); + + boolean func_154335_d(String p_154335_1_); + + /** + * @args: Takes one argument - the name of the directory of the world to delete. @desc: Delete the world by deleting + * the associated directory recursively. + */ + boolean deleteWorldDirectory(String p_75802_1_); + + /** + * Renames the world by storing the new name in level.dat. It does *not* rename the directory containing the world + * data. + */ + void renameWorld(String dirName, String newName); + + boolean func_154334_a(String saveName); + + /** + * gets if the map is old chunk saving (true) or McRegion (false) + */ + boolean isOldMapFormat(String saveName); + + /** + * converts the map to mcRegion + */ + boolean convertMapFormat(String filename, IProgressUpdate progressCallback); + + /** + * Return whether the given world can be loaded. + */ + boolean canLoadWorld(String p_90033_1_); +} diff --git a/src/minecraft/net/minecraft/world/storage/ISaveHandler.java b/src/minecraft/net/minecraft/world/storage/ISaveHandler.java new file mode 100644 index 0000000..b058896 --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/ISaveHandler.java @@ -0,0 +1,57 @@ +package net.minecraft.world.storage; + +import java.io.File; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.chunk.storage.IChunkLoader; + +public interface ISaveHandler +{ + /** + * Loads and returns the world info + */ + WorldInfo loadWorldInfo(); + + /** + * Checks the session lock to prevent save collisions + */ + void checkSessionLock() throws MinecraftException; + + /** + * initializes and returns the chunk loader for the specified world provider + */ + IChunkLoader getChunkLoader(WorldProvider provider); + + /** + * Saves the given World Info with the given NBTTagCompound as the Player. + */ + void saveWorldInfoWithPlayer(WorldInfo worldInformation, NBTTagCompound tagCompound); + + /** + * used to update level.dat from old format to MCRegion format + */ + void saveWorldInfo(WorldInfo worldInformation); + + IPlayerFileData getPlayerNBTManager(); + + /** + * Called to flush all changes to disk, waiting for them to complete. + */ + void flush(); + + /** + * Gets the File object corresponding to the base directory of this world. + */ + File getWorldDirectory(); + + /** + * Gets the file location of the given map + */ + File getMapFileFromName(String mapName); + + /** + * Returns the name of the directory where world information is saved. + */ + String getWorldDirectoryName(); +} diff --git a/src/minecraft/net/minecraft/world/storage/IThreadedFileIO.java b/src/minecraft/net/minecraft/world/storage/IThreadedFileIO.java new file mode 100644 index 0000000..f166968 --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/IThreadedFileIO.java @@ -0,0 +1,9 @@ +package net.minecraft.world.storage; + +public interface IThreadedFileIO +{ + /** + * Returns a boolean stating if the write was unsuccessful. + */ + boolean writeNextIO(); +} diff --git a/src/minecraft/net/minecraft/world/storage/MapData.java b/src/minecraft/net/minecraft/world/storage/MapData.java new file mode 100644 index 0000000..bb34b2e --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/MapData.java @@ -0,0 +1,297 @@ +package net.minecraft.world.storage; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.List; +import java.util.Map; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S34PacketMaps; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec4b; +import net.minecraft.world.World; +import net.minecraft.world.WorldSavedData; + +public class MapData extends WorldSavedData +{ + public int xCenter; + public int zCenter; + public byte dimension; + public byte scale; + + /** colours */ + public byte[] colors = new byte[16384]; + public List playersArrayList = Lists.newArrayList(); + private Map playersHashMap = Maps.newHashMap(); + public Map mapDecorations = Maps.newLinkedHashMap(); + + public MapData(String mapname) + { + super(mapname); + } + + public void calculateMapCenter(double x, double z, int mapScale) + { + int i = 128 * (1 << mapScale); + int j = MathHelper.floor_double((x + 64.0D) / (double)i); + int k = MathHelper.floor_double((z + 64.0D) / (double)i); + this.xCenter = j * i + i / 2 - 64; + this.zCenter = k * i + i / 2 - 64; + } + + /** + * reads in data from the NBTTagCompound into this MapDataBase + */ + public void readFromNBT(NBTTagCompound nbt) + { + this.dimension = nbt.getByte("dimension"); + this.xCenter = nbt.getInteger("xCenter"); + this.zCenter = nbt.getInteger("zCenter"); + this.scale = nbt.getByte("scale"); + this.scale = (byte)MathHelper.clamp_int(this.scale, 0, 4); + int i = nbt.getShort("width"); + int j = nbt.getShort("height"); + + if (i == 128 && j == 128) + { + this.colors = nbt.getByteArray("colors"); + } + else + { + byte[] abyte = nbt.getByteArray("colors"); + this.colors = new byte[16384]; + int k = (128 - i) / 2; + int l = (128 - j) / 2; + + for (int i1 = 0; i1 < j; ++i1) + { + int j1 = i1 + l; + + if (j1 >= 0 || j1 < 128) + { + for (int k1 = 0; k1 < i; ++k1) + { + int l1 = k1 + k; + + if (l1 >= 0 || l1 < 128) + { + this.colors[l1 + j1 * 128] = abyte[k1 + i1 * i]; + } + } + } + } + } + } + + /** + * write data to NBTTagCompound from this MapDataBase, similar to Entities and TileEntities + */ + public void writeToNBT(NBTTagCompound nbt) + { + nbt.setByte("dimension", this.dimension); + nbt.setInteger("xCenter", this.xCenter); + nbt.setInteger("zCenter", this.zCenter); + nbt.setByte("scale", this.scale); + nbt.setShort("width", (short)128); + nbt.setShort("height", (short)128); + nbt.setByteArray("colors", this.colors); + } + + /** + * Adds the player passed to the list of visible players and checks to see which players are visible + */ + public void updateVisiblePlayers(EntityPlayer player, ItemStack mapStack) + { + if (!this.playersHashMap.containsKey(player)) + { + MapData.MapInfo mapdata$mapinfo = new MapData.MapInfo(player); + this.playersHashMap.put(player, mapdata$mapinfo); + this.playersArrayList.add(mapdata$mapinfo); + } + + if (!player.inventory.hasItemStack(mapStack)) + { + this.mapDecorations.remove(player.getName()); + } + + for (int i = 0; i < this.playersArrayList.size(); ++i) + { + MapData.MapInfo mapdata$mapinfo1 = (MapData.MapInfo)this.playersArrayList.get(i); + + if (!mapdata$mapinfo1.entityplayerObj.isDead && (mapdata$mapinfo1.entityplayerObj.inventory.hasItemStack(mapStack) || mapStack.isOnItemFrame())) + { + if (!mapStack.isOnItemFrame() && mapdata$mapinfo1.entityplayerObj.dimension == this.dimension) + { + this.updateDecorations(0, mapdata$mapinfo1.entityplayerObj.worldObj, mapdata$mapinfo1.entityplayerObj.getName(), mapdata$mapinfo1.entityplayerObj.posX, mapdata$mapinfo1.entityplayerObj.posZ, (double)mapdata$mapinfo1.entityplayerObj.rotationYaw); + } + } + else + { + this.playersHashMap.remove(mapdata$mapinfo1.entityplayerObj); + this.playersArrayList.remove(mapdata$mapinfo1); + } + } + + if (mapStack.isOnItemFrame()) + { + EntityItemFrame entityitemframe = mapStack.getItemFrame(); + BlockPos blockpos = entityitemframe.getHangingPosition(); + this.updateDecorations(1, player.worldObj, "frame-" + entityitemframe.getEntityId(), (double)blockpos.getX(), (double)blockpos.getZ(), (double)(entityitemframe.facingDirection.getHorizontalIndex() * 90)); + } + + if (mapStack.hasTagCompound() && mapStack.getTagCompound().hasKey("Decorations", 9)) + { + NBTTagList nbttaglist = mapStack.getTagCompound().getTagList("Decorations", 10); + + for (int j = 0; j < nbttaglist.tagCount(); ++j) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(j); + + if (!this.mapDecorations.containsKey(nbttagcompound.getString("id"))) + { + this.updateDecorations(nbttagcompound.getByte("type"), player.worldObj, nbttagcompound.getString("id"), nbttagcompound.getDouble("x"), nbttagcompound.getDouble("z"), nbttagcompound.getDouble("rot")); + } + } + } + } + + private void updateDecorations(int type, World worldIn, String entityIdentifier, double worldX, double worldZ, double rotation) + { + int i = 1 << this.scale; + float f = (float)(worldX - (double)this.xCenter) / (float)i; + float f1 = (float)(worldZ - (double)this.zCenter) / (float)i; + byte b0 = (byte)((int)((double)(f * 2.0F) + 0.5D)); + byte b1 = (byte)((int)((double)(f1 * 2.0F) + 0.5D)); + int j = 63; + byte b2; + + if (f >= (float)(-j) && f1 >= (float)(-j) && f <= (float)j && f1 <= (float)j) + { + rotation = rotation + (rotation < 0.0D ? -8.0D : 8.0D); + b2 = (byte)((int)(rotation * 16.0D / 360.0D)); + + if (this.dimension < 0) + { + int k = (int)(worldIn.getWorldInfo().getWorldTime() / 10L); + b2 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15); + } + } + else + { + if (Math.abs(f) >= 320.0F || Math.abs(f1) >= 320.0F) + { + this.mapDecorations.remove(entityIdentifier); + return; + } + + type = 6; + b2 = 0; + + if (f <= (float)(-j)) + { + b0 = (byte)((int)((double)(j * 2) + 2.5D)); + } + + if (f1 <= (float)(-j)) + { + b1 = (byte)((int)((double)(j * 2) + 2.5D)); + } + + if (f >= (float)j) + { + b0 = (byte)(j * 2 + 1); + } + + if (f1 >= (float)j) + { + b1 = (byte)(j * 2 + 1); + } + } + + this.mapDecorations.put(entityIdentifier, new Vec4b((byte)type, b0, b1, b2)); + } + + public Packet getMapPacket(ItemStack mapStack, World worldIn, EntityPlayer player) + { + MapData.MapInfo mapdata$mapinfo = (MapData.MapInfo)this.playersHashMap.get(player); + return mapdata$mapinfo == null ? null : mapdata$mapinfo.getPacket(mapStack); + } + + public void updateMapData(int x, int y) + { + super.markDirty(); + + for (MapData.MapInfo mapdata$mapinfo : this.playersArrayList) + { + mapdata$mapinfo.update(x, y); + } + } + + public MapData.MapInfo getMapInfo(EntityPlayer player) + { + MapData.MapInfo mapdata$mapinfo = (MapData.MapInfo)this.playersHashMap.get(player); + + if (mapdata$mapinfo == null) + { + mapdata$mapinfo = new MapData.MapInfo(player); + this.playersHashMap.put(player, mapdata$mapinfo); + this.playersArrayList.add(mapdata$mapinfo); + } + + return mapdata$mapinfo; + } + + public class MapInfo + { + public final EntityPlayer entityplayerObj; + private boolean field_176105_d = true; + private int minX = 0; + private int minY = 0; + private int maxX = 127; + private int maxY = 127; + private int field_176109_i; + public int field_82569_d; + + public MapInfo(EntityPlayer player) + { + this.entityplayerObj = player; + } + + public Packet getPacket(ItemStack stack) + { + if (this.field_176105_d) + { + this.field_176105_d = false; + return new S34PacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.mapDecorations.values(), MapData.this.colors, this.minX, this.minY, this.maxX + 1 - this.minX, this.maxY + 1 - this.minY); + } + else + { + return this.field_176109_i++ % 5 == 0 ? new S34PacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.mapDecorations.values(), MapData.this.colors, 0, 0, 0, 0) : null; + } + } + + public void update(int x, int y) + { + if (this.field_176105_d) + { + this.minX = Math.min(this.minX, x); + this.minY = Math.min(this.minY, y); + this.maxX = Math.max(this.maxX, x); + this.maxY = Math.max(this.maxY, y); + } + else + { + this.field_176105_d = true; + this.minX = x; + this.minY = y; + this.maxX = x; + this.maxY = y; + } + } + } +} diff --git a/src/minecraft/net/minecraft/world/storage/MapStorage.java b/src/minecraft/net/minecraft/world/storage/MapStorage.java new file mode 100644 index 0000000..8df2125 --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/MapStorage.java @@ -0,0 +1,236 @@ +package net.minecraft.world.storage; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.List; +import java.util.Map; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagShort; +import net.minecraft.world.WorldSavedData; + +public class MapStorage +{ + private ISaveHandler saveHandler; + protected Map loadedDataMap = Maps.newHashMap(); + private List loadedDataList = Lists.newArrayList(); + private Map idCounts = Maps.newHashMap(); + + public MapStorage(ISaveHandler saveHandlerIn) + { + this.saveHandler = saveHandlerIn; + this.loadIdCounts(); + } + + /** + * Loads an existing MapDataBase corresponding to the given String id from disk, instantiating the given Class, or + * returns null if none such file exists. args: Class to instantiate, String dataid + */ + public WorldSavedData loadData(Class clazz, String dataIdentifier) + { + WorldSavedData worldsaveddata = (WorldSavedData)this.loadedDataMap.get(dataIdentifier); + + if (worldsaveddata != null) + { + return worldsaveddata; + } + else + { + if (this.saveHandler != null) + { + try + { + File file1 = this.saveHandler.getMapFileFromName(dataIdentifier); + + if (file1 != null && file1.exists()) + { + try + { + worldsaveddata = (WorldSavedData)clazz.getConstructor(new Class[] {String.class}).newInstance(new Object[] {dataIdentifier}); + } + catch (Exception exception) + { + throw new RuntimeException("Failed to instantiate " + clazz.toString(), exception); + } + + FileInputStream fileinputstream = new FileInputStream(file1); + NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(fileinputstream); + fileinputstream.close(); + worldsaveddata.readFromNBT(nbttagcompound.getCompoundTag("data")); + } + } + catch (Exception exception1) + { + exception1.printStackTrace(); + } + } + + if (worldsaveddata != null) + { + this.loadedDataMap.put(dataIdentifier, worldsaveddata); + this.loadedDataList.add(worldsaveddata); + } + + return worldsaveddata; + } + } + + /** + * Assigns the given String id to the given MapDataBase, removing any existing ones of the same id. + */ + public void setData(String dataIdentifier, WorldSavedData data) + { + if (this.loadedDataMap.containsKey(dataIdentifier)) + { + this.loadedDataList.remove(this.loadedDataMap.remove(dataIdentifier)); + } + + this.loadedDataMap.put(dataIdentifier, data); + this.loadedDataList.add(data); + } + + /** + * Saves all dirty loaded MapDataBases to disk. + */ + public void saveAllData() + { + for (int i = 0; i < this.loadedDataList.size(); ++i) + { + WorldSavedData worldsaveddata = (WorldSavedData)this.loadedDataList.get(i); + + if (worldsaveddata.isDirty()) + { + this.saveData(worldsaveddata); + worldsaveddata.setDirty(false); + } + } + } + + /** + * Saves the given MapDataBase to disk. + */ + private void saveData(WorldSavedData p_75747_1_) + { + if (this.saveHandler != null) + { + try + { + File file1 = this.saveHandler.getMapFileFromName(p_75747_1_.mapName); + + if (file1 != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + p_75747_1_.writeToNBT(nbttagcompound); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setTag("data", nbttagcompound); + FileOutputStream fileoutputstream = new FileOutputStream(file1); + CompressedStreamTools.writeCompressed(nbttagcompound1, fileoutputstream); + fileoutputstream.close(); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + } + + /** + * Loads the idCounts Map from the 'idcounts' file. + */ + private void loadIdCounts() + { + try + { + this.idCounts.clear(); + + if (this.saveHandler == null) + { + return; + } + + File file1 = this.saveHandler.getMapFileFromName("idcounts"); + + if (file1 != null && file1.exists()) + { + DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1)); + NBTTagCompound nbttagcompound = CompressedStreamTools.read(datainputstream); + datainputstream.close(); + + for (String s : nbttagcompound.getKeySet()) + { + NBTBase nbtbase = nbttagcompound.getTag(s); + + if (nbtbase instanceof NBTTagShort) + { + NBTTagShort nbttagshort = (NBTTagShort)nbtbase; + short short1 = nbttagshort.getShort(); + this.idCounts.put(s, Short.valueOf(short1)); + } + } + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + + /** + * Returns an unique new data id for the given prefix and saves the idCounts map to the 'idcounts' file. + */ + public int getUniqueDataId(String key) + { + Short oshort = (Short)this.idCounts.get(key); + + if (oshort == null) + { + oshort = Short.valueOf((short)0); + } + else + { + oshort = Short.valueOf((short)(oshort.shortValue() + 1)); + } + + this.idCounts.put(key, oshort); + + if (this.saveHandler == null) + { + return oshort.shortValue(); + } + else + { + try + { + File file1 = this.saveHandler.getMapFileFromName("idcounts"); + + if (file1 != null) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + for (String s : this.idCounts.keySet()) + { + short short1 = ((Short)this.idCounts.get(s)).shortValue(); + nbttagcompound.setShort(s, short1); + } + + DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file1)); + CompressedStreamTools.write(nbttagcompound, dataoutputstream); + dataoutputstream.close(); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + + return oshort.shortValue(); + } + } +} diff --git a/src/minecraft/net/minecraft/world/storage/SaveDataMemoryStorage.java b/src/minecraft/net/minecraft/world/storage/SaveDataMemoryStorage.java new file mode 100644 index 0000000..cd5a4b6 --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/SaveDataMemoryStorage.java @@ -0,0 +1,43 @@ +package net.minecraft.world.storage; + +import net.minecraft.world.WorldSavedData; + +public class SaveDataMemoryStorage extends MapStorage +{ + public SaveDataMemoryStorage() + { + super((ISaveHandler)null); + } + + /** + * Loads an existing MapDataBase corresponding to the given String id from disk, instantiating the given Class, or + * returns null if none such file exists. args: Class to instantiate, String dataid + */ + public WorldSavedData loadData(Class clazz, String dataIdentifier) + { + return (WorldSavedData)this.loadedDataMap.get(dataIdentifier); + } + + /** + * Assigns the given String id to the given MapDataBase, removing any existing ones of the same id. + */ + public void setData(String dataIdentifier, WorldSavedData data) + { + this.loadedDataMap.put(dataIdentifier, data); + } + + /** + * Saves all dirty loaded MapDataBases to disk. + */ + public void saveAllData() + { + } + + /** + * Returns an unique new data id for the given prefix and saves the idCounts map to the 'idcounts' file. + */ + public int getUniqueDataId(String key) + { + return 0; + } +} diff --git a/src/minecraft/net/minecraft/world/storage/SaveFormatComparator.java b/src/minecraft/net/minecraft/world/storage/SaveFormatComparator.java new file mode 100644 index 0000000..ca0f5f2 --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/SaveFormatComparator.java @@ -0,0 +1,89 @@ +package net.minecraft.world.storage; + +import net.minecraft.world.WorldSettings; + +public class SaveFormatComparator implements Comparable +{ + /** the file name of this save */ + private final String fileName; + + /** the displayed name of this save file */ + private final String displayName; + private final long lastTimePlayed; + private final long sizeOnDisk; + private final boolean requiresConversion; + + /** Instance of EnumGameType. */ + private final WorldSettings.GameType theEnumGameType; + private final boolean hardcore; + private final boolean cheatsEnabled; + + public SaveFormatComparator(String fileNameIn, String displayNameIn, long lastTimePlayedIn, long sizeOnDiskIn, WorldSettings.GameType theEnumGameTypeIn, boolean requiresConversionIn, boolean hardcoreIn, boolean cheatsEnabledIn) + { + this.fileName = fileNameIn; + this.displayName = displayNameIn; + this.lastTimePlayed = lastTimePlayedIn; + this.sizeOnDisk = sizeOnDiskIn; + this.theEnumGameType = theEnumGameTypeIn; + this.requiresConversion = requiresConversionIn; + this.hardcore = hardcoreIn; + this.cheatsEnabled = cheatsEnabledIn; + } + + /** + * return the file name + */ + public String getFileName() + { + return this.fileName; + } + + /** + * return the display name of the save + */ + public String getDisplayName() + { + return this.displayName; + } + + public long getSizeOnDisk() + { + return this.sizeOnDisk; + } + + public boolean requiresConversion() + { + return this.requiresConversion; + } + + public long getLastTimePlayed() + { + return this.lastTimePlayed; + } + + public int compareTo(SaveFormatComparator p_compareTo_1_) + { + return this.lastTimePlayed < p_compareTo_1_.lastTimePlayed ? 1 : (this.lastTimePlayed > p_compareTo_1_.lastTimePlayed ? -1 : this.fileName.compareTo(p_compareTo_1_.fileName)); + } + + /** + * Gets the EnumGameType. + */ + public WorldSettings.GameType getEnumGameType() + { + return this.theEnumGameType; + } + + public boolean isHardcoreModeEnabled() + { + return this.hardcore; + } + + /** + * @return {@code true} if cheats are enabled for this world + */ + public boolean getCheatsEnabled() + { + return this.cheatsEnabled; + } +} diff --git a/src/minecraft/net/minecraft/world/storage/SaveFormatOld.java b/src/minecraft/net/minecraft/world/storage/SaveFormatOld.java new file mode 100644 index 0000000..9d16b35 --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/SaveFormatOld.java @@ -0,0 +1,274 @@ +package net.minecraft.world.storage; + +import com.google.common.collect.Lists; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.List; +import net.minecraft.client.AnvilConverterException; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IProgressUpdate; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class SaveFormatOld implements ISaveFormat +{ + private static final Logger logger = LogManager.getLogger(); + + /** + * Reference to the File object representing the directory for the world saves + */ + protected final File savesDirectory; + + public SaveFormatOld(File p_i2147_1_) + { + if (!p_i2147_1_.exists()) + { + p_i2147_1_.mkdirs(); + } + + this.savesDirectory = p_i2147_1_; + } + + /** + * Returns the name of the save format. + */ + public String getName() + { + return "Old Format"; + } + + public List getSaveList() throws AnvilConverterException + { + List list = Lists.newArrayList(); + + for (int i = 0; i < 5; ++i) + { + String s = "World" + (i + 1); + WorldInfo worldinfo = this.getWorldInfo(s); + + if (worldinfo != null) + { + list.add(new SaveFormatComparator(s, "", worldinfo.getLastTimePlayed(), worldinfo.getSizeOnDisk(), worldinfo.getGameType(), false, worldinfo.isHardcoreModeEnabled(), worldinfo.areCommandsAllowed())); + } + } + + return list; + } + + public void flushCache() + { + } + + /** + * Returns the world's WorldInfo object + */ + public WorldInfo getWorldInfo(String saveName) + { + File file1 = new File(this.savesDirectory, saveName); + + if (!file1.exists()) + { + return null; + } + else + { + File file2 = new File(file1, "level.dat"); + + if (file2.exists()) + { + try + { + NBTTagCompound nbttagcompound2 = CompressedStreamTools.readCompressed(new FileInputStream(file2)); + NBTTagCompound nbttagcompound3 = nbttagcompound2.getCompoundTag("Data"); + return new WorldInfo(nbttagcompound3); + } + catch (Exception exception1) + { + logger.error((String)("Exception reading " + file2), (Throwable)exception1); + } + } + + file2 = new File(file1, "level.dat_old"); + + if (file2.exists()) + { + try + { + NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file2)); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); + return new WorldInfo(nbttagcompound1); + } + catch (Exception exception) + { + logger.error((String)("Exception reading " + file2), (Throwable)exception); + } + } + + return null; + } + } + + /** + * Renames the world by storing the new name in level.dat. It does *not* rename the directory containing the world + * data. + */ + public void renameWorld(String dirName, String newName) + { + File file1 = new File(this.savesDirectory, dirName); + + if (file1.exists()) + { + File file2 = new File(file1, "level.dat"); + + if (file2.exists()) + { + try + { + NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file2)); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); + nbttagcompound1.setString("LevelName", newName); + CompressedStreamTools.writeCompressed(nbttagcompound, new FileOutputStream(file2)); + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + } + } + + public boolean func_154335_d(String p_154335_1_) + { + File file1 = new File(this.savesDirectory, p_154335_1_); + + if (file1.exists()) + { + return false; + } + else + { + try + { + file1.mkdir(); + file1.delete(); + return true; + } + catch (Throwable throwable) + { + logger.warn("Couldn\'t make new level", throwable); + return false; + } + } + } + + /** + * @args: Takes one argument - the name of the directory of the world to delete. @desc: Delete the world by deleting + * the associated directory recursively. + */ + public boolean deleteWorldDirectory(String p_75802_1_) + { + File file1 = new File(this.savesDirectory, p_75802_1_); + + if (!file1.exists()) + { + return true; + } + else + { + logger.info("Deleting level " + p_75802_1_); + + for (int i = 1; i <= 5; ++i) + { + logger.info("Attempt " + i + "..."); + + if (deleteFiles(file1.listFiles())) + { + break; + } + + logger.warn("Unsuccessful in deleting contents."); + + if (i < 5) + { + try + { + Thread.sleep(500L); + } + catch (InterruptedException var5) + { + ; + } + } + } + + return file1.delete(); + } + } + + /** + * @args: Takes one argument - the list of files and directories to delete. @desc: Deletes the files and directory + * listed in the list recursively. + */ + protected static boolean deleteFiles(File[] files) + { + for (int i = 0; i < files.length; ++i) + { + File file1 = files[i]; + logger.debug("Deleting " + file1); + + if (file1.isDirectory() && !deleteFiles(file1.listFiles())) + { + logger.warn("Couldn\'t delete directory " + file1); + return false; + } + + if (!file1.delete()) + { + logger.warn("Couldn\'t delete file " + file1); + return false; + } + } + + return true; + } + + /** + * Returns back a loader for the specified save directory + */ + public ISaveHandler getSaveLoader(String saveName, boolean storePlayerdata) + { + return new SaveHandler(this.savesDirectory, saveName, storePlayerdata); + } + + public boolean func_154334_a(String saveName) + { + return false; + } + + /** + * gets if the map is old chunk saving (true) or McRegion (false) + */ + public boolean isOldMapFormat(String saveName) + { + return false; + } + + /** + * converts the map to mcRegion + */ + public boolean convertMapFormat(String filename, IProgressUpdate progressCallback) + { + return false; + } + + /** + * Return whether the given world can be loaded. + */ + public boolean canLoadWorld(String p_90033_1_) + { + File file1 = new File(this.savesDirectory, p_90033_1_); + return file1.isDirectory(); + } +} diff --git a/src/minecraft/net/minecraft/world/storage/SaveHandler.java b/src/minecraft/net/minecraft/world/storage/SaveHandler.java new file mode 100644 index 0000000..ef0d505 --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/SaveHandler.java @@ -0,0 +1,352 @@ +package net.minecraft.world.storage; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.chunk.storage.IChunkLoader; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class SaveHandler implements ISaveHandler, IPlayerFileData +{ + private static final Logger logger = LogManager.getLogger(); + + /** The directory in which to save world data. */ + private final File worldDirectory; + + /** The directory in which to save player data. */ + private final File playersDirectory; + private final File mapDataDir; + + /** + * The time in milliseconds when this field was initialized. Stored in the session lock file. + */ + private final long initializationTime = MinecraftServer.getCurrentTimeMillis(); + + /** The directory name of the world */ + private final String saveDirectoryName; + + public SaveHandler(File savesDirectory, String directoryName, boolean playersDirectoryIn) + { + this.worldDirectory = new File(savesDirectory, directoryName); + this.worldDirectory.mkdirs(); + this.playersDirectory = new File(this.worldDirectory, "playerdata"); + this.mapDataDir = new File(this.worldDirectory, "data"); + this.mapDataDir.mkdirs(); + this.saveDirectoryName = directoryName; + + if (playersDirectoryIn) + { + this.playersDirectory.mkdirs(); + } + + this.setSessionLock(); + } + + /** + * Creates a session lock file for this process + */ + private void setSessionLock() + { + try + { + File file1 = new File(this.worldDirectory, "session.lock"); + DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file1)); + + try + { + dataoutputstream.writeLong(this.initializationTime); + } + finally + { + dataoutputstream.close(); + } + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + throw new RuntimeException("Failed to check session lock, aborting"); + } + } + + /** + * Gets the File object corresponding to the base directory of this world. + */ + public File getWorldDirectory() + { + return this.worldDirectory; + } + + /** + * Checks the session lock to prevent save collisions + */ + public void checkSessionLock() throws MinecraftException + { + try + { + File file1 = new File(this.worldDirectory, "session.lock"); + DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1)); + + try + { + if (datainputstream.readLong() != this.initializationTime) + { + throw new MinecraftException("The save is being accessed from another location, aborting"); + } + } + finally + { + datainputstream.close(); + } + } + catch (IOException var7) + { + throw new MinecraftException("Failed to check session lock, aborting"); + } + } + + /** + * initializes and returns the chunk loader for the specified world provider + */ + public IChunkLoader getChunkLoader(WorldProvider provider) + { + throw new RuntimeException("Old Chunk Storage is no longer supported."); + } + + /** + * Loads and returns the world info + */ + public WorldInfo loadWorldInfo() + { + File file1 = new File(this.worldDirectory, "level.dat"); + + if (file1.exists()) + { + try + { + NBTTagCompound nbttagcompound2 = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + NBTTagCompound nbttagcompound3 = nbttagcompound2.getCompoundTag("Data"); + return new WorldInfo(nbttagcompound3); + } + catch (Exception exception1) + { + exception1.printStackTrace(); + } + } + + file1 = new File(this.worldDirectory, "level.dat_old"); + + if (file1.exists()) + { + try + { + NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data"); + return new WorldInfo(nbttagcompound1); + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + + return null; + } + + /** + * Saves the given World Info with the given NBTTagCompound as the Player. + */ + public void saveWorldInfoWithPlayer(WorldInfo worldInformation, NBTTagCompound tagCompound) + { + NBTTagCompound nbttagcompound = worldInformation.cloneNBTCompound(tagCompound); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setTag("Data", nbttagcompound); + + try + { + File file1 = new File(this.worldDirectory, "level.dat_new"); + File file2 = new File(this.worldDirectory, "level.dat_old"); + File file3 = new File(this.worldDirectory, "level.dat"); + CompressedStreamTools.writeCompressed(nbttagcompound1, new FileOutputStream(file1)); + + if (file2.exists()) + { + file2.delete(); + } + + file3.renameTo(file2); + + if (file3.exists()) + { + file3.delete(); + } + + file1.renameTo(file3); + + if (file1.exists()) + { + file1.delete(); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + + /** + * used to update level.dat from old format to MCRegion format + */ + public void saveWorldInfo(WorldInfo worldInformation) + { + NBTTagCompound nbttagcompound = worldInformation.getNBTTagCompound(); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setTag("Data", nbttagcompound); + + try + { + File file1 = new File(this.worldDirectory, "level.dat_new"); + File file2 = new File(this.worldDirectory, "level.dat_old"); + File file3 = new File(this.worldDirectory, "level.dat"); + CompressedStreamTools.writeCompressed(nbttagcompound1, new FileOutputStream(file1)); + + if (file2.exists()) + { + file2.delete(); + } + + file3.renameTo(file2); + + if (file3.exists()) + { + file3.delete(); + } + + file1.renameTo(file3); + + if (file1.exists()) + { + file1.delete(); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + + /** + * Writes the player data to disk from the specified PlayerEntityMP. + */ + public void writePlayerData(EntityPlayer player) + { + try + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + player.writeToNBT(nbttagcompound); + File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat.tmp"); + File file2 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat"); + CompressedStreamTools.writeCompressed(nbttagcompound, new FileOutputStream(file1)); + + if (file2.exists()) + { + file2.delete(); + } + + file1.renameTo(file2); + } + catch (Exception var5) + { + logger.warn("Failed to save player data for " + player.getName()); + } + } + + /** + * Reads the player data from disk into the specified PlayerEntityMP. + */ + public NBTTagCompound readPlayerData(EntityPlayer player) + { + NBTTagCompound nbttagcompound = null; + + try + { + File file1 = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat"); + + if (file1.exists() && file1.isFile()) + { + nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file1)); + } + } + catch (Exception var4) + { + logger.warn("Failed to load player data for " + player.getName()); + } + + if (nbttagcompound != null) + { + player.readFromNBT(nbttagcompound); + } + + return nbttagcompound; + } + + public IPlayerFileData getPlayerNBTManager() + { + return this; + } + + /** + * Returns an array of usernames for which player.dat exists for. + */ + public String[] getAvailablePlayerDat() + { + String[] astring = this.playersDirectory.list(); + + if (astring == null) + { + astring = new String[0]; + } + + for (int i = 0; i < astring.length; ++i) + { + if (astring[i].endsWith(".dat")) + { + astring[i] = astring[i].substring(0, astring[i].length() - 4); + } + } + + return astring; + } + + /** + * Called to flush all changes to disk, waiting for them to complete. + */ + public void flush() + { + } + + /** + * Gets the file location of the given map + */ + public File getMapFileFromName(String mapName) + { + return new File(this.mapDataDir, mapName + ".dat"); + } + + /** + * Returns the name of the directory where world information is saved. + */ + public String getWorldDirectoryName() + { + return this.saveDirectoryName; + } +} diff --git a/src/minecraft/net/minecraft/world/storage/SaveHandlerMP.java b/src/minecraft/net/minecraft/world/storage/SaveHandlerMP.java new file mode 100644 index 0000000..be46bdf --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/SaveHandlerMP.java @@ -0,0 +1,83 @@ +package net.minecraft.world.storage; + +import java.io.File; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.MinecraftException; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.chunk.storage.IChunkLoader; + +public class SaveHandlerMP implements ISaveHandler +{ + /** + * Loads and returns the world info + */ + public WorldInfo loadWorldInfo() + { + return null; + } + + /** + * Checks the session lock to prevent save collisions + */ + public void checkSessionLock() throws MinecraftException + { + } + + /** + * initializes and returns the chunk loader for the specified world provider + */ + public IChunkLoader getChunkLoader(WorldProvider provider) + { + return null; + } + + /** + * Saves the given World Info with the given NBTTagCompound as the Player. + */ + public void saveWorldInfoWithPlayer(WorldInfo worldInformation, NBTTagCompound tagCompound) + { + } + + /** + * used to update level.dat from old format to MCRegion format + */ + public void saveWorldInfo(WorldInfo worldInformation) + { + } + + public IPlayerFileData getPlayerNBTManager() + { + return null; + } + + /** + * Called to flush all changes to disk, waiting for them to complete. + */ + public void flush() + { + } + + /** + * Gets the file location of the given map + */ + public File getMapFileFromName(String mapName) + { + return null; + } + + /** + * Returns the name of the directory where world information is saved. + */ + public String getWorldDirectoryName() + { + return "none"; + } + + /** + * Gets the File object corresponding to the base directory of this world. + */ + public File getWorldDirectory() + { + return null; + } +} diff --git a/src/minecraft/net/minecraft/world/storage/ThreadedFileIOBase.java b/src/minecraft/net/minecraft/world/storage/ThreadedFileIOBase.java new file mode 100644 index 0000000..29491fc --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/ThreadedFileIOBase.java @@ -0,0 +1,101 @@ +package net.minecraft.world.storage; + +import com.google.common.collect.Lists; +import java.util.Collections; +import java.util.List; + +public class ThreadedFileIOBase implements Runnable +{ + /** Instance of ThreadedFileIOBase */ + private static final ThreadedFileIOBase threadedIOInstance = new ThreadedFileIOBase(); + private List threadedIOQueue = Collections.synchronizedList(Lists.newArrayList()); + private volatile long writeQueuedCounter; + private volatile long savedIOCounter; + private volatile boolean isThreadWaiting; + + private ThreadedFileIOBase() + { + Thread thread = new Thread(this, "File IO Thread"); + thread.setPriority(1); + thread.start(); + } + + /** + * Retrieves an instance of the threadedFileIOBase. + */ + public static ThreadedFileIOBase getThreadedIOInstance() + { + return threadedIOInstance; + } + + public void run() + { + while (true) + { + this.processQueue(); + } + } + + /** + * Process the items that are in the queue + */ + private void processQueue() + { + for (int i = 0; i < this.threadedIOQueue.size(); ++i) + { + IThreadedFileIO ithreadedfileio = (IThreadedFileIO)this.threadedIOQueue.get(i); + boolean flag = ithreadedfileio.writeNextIO(); + + if (!flag) + { + this.threadedIOQueue.remove(i--); + ++this.savedIOCounter; + } + + try + { + Thread.sleep(this.isThreadWaiting ? 0L : 10L); + } + catch (InterruptedException interruptedexception1) + { + interruptedexception1.printStackTrace(); + } + } + + if (this.threadedIOQueue.isEmpty()) + { + try + { + Thread.sleep(25L); + } + catch (InterruptedException interruptedexception) + { + interruptedexception.printStackTrace(); + } + } + } + + /** + * threaded io + */ + public void queueIO(IThreadedFileIO p_75735_1_) + { + if (!this.threadedIOQueue.contains(p_75735_1_)) + { + ++this.writeQueuedCounter; + this.threadedIOQueue.add(p_75735_1_); + } + } + + public void waitForFinish() throws InterruptedException + { + this.isThreadWaiting = true; + + while (this.writeQueuedCounter != this.savedIOCounter) + { + Thread.sleep(10L); + } + + this.isThreadWaiting = false; + } +} diff --git a/src/minecraft/net/minecraft/world/storage/WorldInfo.java b/src/minecraft/net/minecraft/world/storage/WorldInfo.java new file mode 100644 index 0000000..d716151 --- /dev/null +++ b/src/minecraft/net/minecraft/world/storage/WorldInfo.java @@ -0,0 +1,959 @@ +package net.minecraft.world.storage; + +import java.util.concurrent.Callable; + +import animeware.cosmetic.Booleans; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.BlockPos; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.GameRules; +import net.minecraft.world.World; +import net.minecraft.world.WorldSettings; +import net.minecraft.world.WorldType; + +public class WorldInfo +{ + public static final EnumDifficulty DEFAULT_DIFFICULTY = EnumDifficulty.NORMAL; + + /** Holds the seed of the currently world. */ + private long randomSeed; + private WorldType terrainType = WorldType.DEFAULT; + private String generatorOptions = ""; + + /** The spawn zone position X coordinate. */ + private int spawnX; + + /** The spawn zone position Y coordinate. */ + private int spawnY; + + /** The spawn zone position Z coordinate. */ + private int spawnZ; + + /** Total time for this world. */ + private long totalTime; + + /** The current world time in ticks, ranging from 0 to 23999. */ + private static long worldTime; + + /** The last time the player was in this world. */ + private long lastTimePlayed; + + /** The size of entire save of current world on the disk, isn't exactly. */ + private long sizeOnDisk; + private NBTTagCompound playerTag; + private int dimension; + + /** The name of the save defined at world creation. */ + private String levelName; + + /** Introduced in beta 1.3, is the save version for future control. */ + private int saveVersion; + private int cleanWeatherTime; + + /** True if it's raining, false otherwise. */ + private boolean raining; + + /** Number of ticks until next rain. */ + private int rainTime; + + /** Is thunderbolts failing now? */ + private boolean thundering; + + /** Number of ticks untils next thunderbolt. */ + private int thunderTime; + + /** The Game Type. */ + private WorldSettings.GameType theGameType; + + /** + * Whether the map features (e.g. strongholds) generation is enabled or disabled. + */ + private boolean mapFeaturesEnabled; + + /** Hardcore mode flag */ + private boolean hardcore; + private boolean allowCommands; + private boolean initialized; + private EnumDifficulty difficulty; + private boolean difficultyLocked; + private double borderCenterX = 0.0D; + private double borderCenterZ = 0.0D; + private double borderSize = 6.0E7D; + private long borderSizeLerpTime = 0L; + private double borderSizeLerpTarget = 0.0D; + private double borderSafeZone = 5.0D; + private double borderDamagePerBlock = 0.2D; + private int borderWarningDistance = 5; + private int borderWarningTime = 15; + private GameRules theGameRules = new GameRules(); + + protected WorldInfo() + { + } + + public WorldInfo(NBTTagCompound nbt) + { + this.randomSeed = nbt.getLong("RandomSeed"); + + if (nbt.hasKey("generatorName", 8)) + { + String s = nbt.getString("generatorName"); + this.terrainType = WorldType.parseWorldType(s); + + if (this.terrainType == null) + { + this.terrainType = WorldType.DEFAULT; + } + else if (this.terrainType.isVersioned()) + { + int i = 0; + + if (nbt.hasKey("generatorVersion", 99)) + { + i = nbt.getInteger("generatorVersion"); + } + + this.terrainType = this.terrainType.getWorldTypeForGeneratorVersion(i); + } + + if (nbt.hasKey("generatorOptions", 8)) + { + this.generatorOptions = nbt.getString("generatorOptions"); + } + } + + this.theGameType = WorldSettings.GameType.getByID(nbt.getInteger("GameType")); + + if (nbt.hasKey("MapFeatures", 99)) + { + this.mapFeaturesEnabled = nbt.getBoolean("MapFeatures"); + } + else + { + this.mapFeaturesEnabled = true; + } + + this.spawnX = nbt.getInteger("SpawnX"); + this.spawnY = nbt.getInteger("SpawnY"); + this.spawnZ = nbt.getInteger("SpawnZ"); + this.totalTime = nbt.getLong("Time"); + + if (nbt.hasKey("DayTime", 99)) + { + this.worldTime = nbt.getLong("DayTime"); + } + else + { + this.worldTime = this.totalTime; + } + + this.lastTimePlayed = nbt.getLong("LastPlayed"); + this.sizeOnDisk = nbt.getLong("SizeOnDisk"); + this.levelName = nbt.getString("LevelName"); + this.saveVersion = nbt.getInteger("version"); + this.cleanWeatherTime = nbt.getInteger("clearWeatherTime"); + this.rainTime = nbt.getInteger("rainTime"); + this.raining = nbt.getBoolean("raining"); + this.thunderTime = nbt.getInteger("thunderTime"); + this.thundering = nbt.getBoolean("thundering"); + this.hardcore = nbt.getBoolean("hardcore"); + + if (nbt.hasKey("initialized", 99)) + { + this.initialized = nbt.getBoolean("initialized"); + } + else + { + this.initialized = true; + } + + if (nbt.hasKey("allowCommands", 99)) + { + this.allowCommands = nbt.getBoolean("allowCommands"); + } + else + { + this.allowCommands = this.theGameType == WorldSettings.GameType.CREATIVE; + } + + if (nbt.hasKey("Player", 10)) + { + this.playerTag = nbt.getCompoundTag("Player"); + this.dimension = this.playerTag.getInteger("Dimension"); + } + + if (nbt.hasKey("GameRules", 10)) + { + this.theGameRules.readFromNBT(nbt.getCompoundTag("GameRules")); + } + + if (nbt.hasKey("Difficulty", 99)) + { + this.difficulty = EnumDifficulty.getDifficultyEnum(nbt.getByte("Difficulty")); + } + + if (nbt.hasKey("DifficultyLocked", 1)) + { + this.difficultyLocked = nbt.getBoolean("DifficultyLocked"); + } + + if (nbt.hasKey("BorderCenterX", 99)) + { + this.borderCenterX = nbt.getDouble("BorderCenterX"); + } + + if (nbt.hasKey("BorderCenterZ", 99)) + { + this.borderCenterZ = nbt.getDouble("BorderCenterZ"); + } + + if (nbt.hasKey("BorderSize", 99)) + { + this.borderSize = nbt.getDouble("BorderSize"); + } + + if (nbt.hasKey("BorderSizeLerpTime", 99)) + { + this.borderSizeLerpTime = nbt.getLong("BorderSizeLerpTime"); + } + + if (nbt.hasKey("BorderSizeLerpTarget", 99)) + { + this.borderSizeLerpTarget = nbt.getDouble("BorderSizeLerpTarget"); + } + + if (nbt.hasKey("BorderSafeZone", 99)) + { + this.borderSafeZone = nbt.getDouble("BorderSafeZone"); + } + + if (nbt.hasKey("BorderDamagePerBlock", 99)) + { + this.borderDamagePerBlock = nbt.getDouble("BorderDamagePerBlock"); + } + + if (nbt.hasKey("BorderWarningBlocks", 99)) + { + this.borderWarningDistance = nbt.getInteger("BorderWarningBlocks"); + } + + if (nbt.hasKey("BorderWarningTime", 99)) + { + this.borderWarningTime = nbt.getInteger("BorderWarningTime"); + } + } + + public WorldInfo(WorldSettings settings, String name) + { + this.populateFromWorldSettings(settings); + this.levelName = name; + this.difficulty = DEFAULT_DIFFICULTY; + this.initialized = false; + } + + public void populateFromWorldSettings(WorldSettings settings) + { + this.randomSeed = settings.getSeed(); + this.theGameType = settings.getGameType(); + this.mapFeaturesEnabled = settings.isMapFeaturesEnabled(); + this.hardcore = settings.getHardcoreEnabled(); + this.terrainType = settings.getTerrainType(); + this.generatorOptions = settings.getWorldName(); + this.allowCommands = settings.areCommandsAllowed(); + } + + public WorldInfo(WorldInfo worldInformation) + { + this.randomSeed = worldInformation.randomSeed; + this.terrainType = worldInformation.terrainType; + this.generatorOptions = worldInformation.generatorOptions; + this.theGameType = worldInformation.theGameType; + this.mapFeaturesEnabled = worldInformation.mapFeaturesEnabled; + this.spawnX = worldInformation.spawnX; + this.spawnY = worldInformation.spawnY; + this.spawnZ = worldInformation.spawnZ; + this.totalTime = worldInformation.totalTime; + this.worldTime = worldInformation.worldTime; + this.lastTimePlayed = worldInformation.lastTimePlayed; + this.sizeOnDisk = worldInformation.sizeOnDisk; + this.playerTag = worldInformation.playerTag; + this.dimension = worldInformation.dimension; + this.levelName = worldInformation.levelName; + this.saveVersion = worldInformation.saveVersion; + this.rainTime = worldInformation.rainTime; + this.raining = worldInformation.raining; + this.thunderTime = worldInformation.thunderTime; + this.thundering = worldInformation.thundering; + this.hardcore = worldInformation.hardcore; + this.allowCommands = worldInformation.allowCommands; + this.initialized = worldInformation.initialized; + this.theGameRules = worldInformation.theGameRules; + this.difficulty = worldInformation.difficulty; + this.difficultyLocked = worldInformation.difficultyLocked; + this.borderCenterX = worldInformation.borderCenterX; + this.borderCenterZ = worldInformation.borderCenterZ; + this.borderSize = worldInformation.borderSize; + this.borderSizeLerpTime = worldInformation.borderSizeLerpTime; + this.borderSizeLerpTarget = worldInformation.borderSizeLerpTarget; + this.borderSafeZone = worldInformation.borderSafeZone; + this.borderDamagePerBlock = worldInformation.borderDamagePerBlock; + this.borderWarningTime = worldInformation.borderWarningTime; + this.borderWarningDistance = worldInformation.borderWarningDistance; + } + + /** + * Gets the NBTTagCompound for the worldInfo + */ + public NBTTagCompound getNBTTagCompound() + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + this.updateTagCompound(nbttagcompound, this.playerTag); + return nbttagcompound; + } + + /** + * Creates a new NBTTagCompound for the world, with the given NBTTag as the "Player" + */ + public NBTTagCompound cloneNBTCompound(NBTTagCompound nbt) + { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + this.updateTagCompound(nbttagcompound, nbt); + return nbttagcompound; + } + + private void updateTagCompound(NBTTagCompound nbt, NBTTagCompound playerNbt) + { + nbt.setLong("RandomSeed", this.randomSeed); + nbt.setString("generatorName", this.terrainType.getWorldTypeName()); + nbt.setInteger("generatorVersion", this.terrainType.getGeneratorVersion()); + nbt.setString("generatorOptions", this.generatorOptions); + nbt.setInteger("GameType", this.theGameType.getID()); + nbt.setBoolean("MapFeatures", this.mapFeaturesEnabled); + nbt.setInteger("SpawnX", this.spawnX); + nbt.setInteger("SpawnY", this.spawnY); + nbt.setInteger("SpawnZ", this.spawnZ); + nbt.setLong("Time", this.totalTime); + nbt.setLong("DayTime", this.worldTime); + nbt.setLong("SizeOnDisk", this.sizeOnDisk); + nbt.setLong("LastPlayed", MinecraftServer.getCurrentTimeMillis()); + nbt.setString("LevelName", this.levelName); + nbt.setInteger("version", this.saveVersion); + nbt.setInteger("clearWeatherTime", this.cleanWeatherTime); + nbt.setInteger("rainTime", this.rainTime); + nbt.setBoolean("raining", this.raining); + nbt.setInteger("thunderTime", this.thunderTime); + nbt.setBoolean("thundering", this.thundering); + nbt.setBoolean("hardcore", this.hardcore); + nbt.setBoolean("allowCommands", this.allowCommands); + nbt.setBoolean("initialized", this.initialized); + nbt.setDouble("BorderCenterX", this.borderCenterX); + nbt.setDouble("BorderCenterZ", this.borderCenterZ); + nbt.setDouble("BorderSize", this.borderSize); + nbt.setLong("BorderSizeLerpTime", this.borderSizeLerpTime); + nbt.setDouble("BorderSafeZone", this.borderSafeZone); + nbt.setDouble("BorderDamagePerBlock", this.borderDamagePerBlock); + nbt.setDouble("BorderSizeLerpTarget", this.borderSizeLerpTarget); + nbt.setDouble("BorderWarningBlocks", (double)this.borderWarningDistance); + nbt.setDouble("BorderWarningTime", (double)this.borderWarningTime); + + if (this.difficulty != null) + { + nbt.setByte("Difficulty", (byte)this.difficulty.getDifficultyId()); + } + + nbt.setBoolean("DifficultyLocked", this.difficultyLocked); + nbt.setTag("GameRules", this.theGameRules.writeToNBT()); + + if (playerNbt != null) + { + nbt.setTag("Player", playerNbt); + } + } + + /** + * Returns the seed of current world. + */ + public long getSeed() + { + return this.randomSeed; + } + + /** + * Returns the x spawn position + */ + public int getSpawnX() + { + return this.spawnX; + } + + /** + * Return the Y axis spawning point of the player. + */ + public int getSpawnY() + { + return this.spawnY; + } + + /** + * Returns the z spawn position + */ + public int getSpawnZ() + { + return this.spawnZ; + } + + public long getWorldTotalTime() + { + return this.totalTime; + } + + /** + * Get current world time + */ + public long getWorldTime() + { + return this.worldTime; + } + + public long getSizeOnDisk() + { + return this.sizeOnDisk; + } + + /** + * Returns the player's NBTTagCompound to be loaded + */ + public NBTTagCompound getPlayerNBTTagCompound() + { + return this.playerTag; + } + + /** + * Set the x spawn position to the passed in value + */ + public void setSpawnX(int x) + { + this.spawnX = x; + } + + /** + * Sets the y spawn position + */ + public void setSpawnY(int y) + { + this.spawnY = y; + } + + /** + * Set the z spawn position to the passed in value + */ + public void setSpawnZ(int z) + { + this.spawnZ = z; + } + + public void setWorldTotalTime(long time) + { + this.totalTime = time; + } + + /** + * Set current world time + */ + public void setWorldTime(long time) + { + + //int wrldtime = (int) time; + /*if(Animeware.night) { + this.worldTime = 15000; + } else if(Animeware.day) { + this.worldTime = 10000; + //vecer 14000 + //rano 22000 + } else if(Animeware.morning) { + this.worldTime = 14000; + } else if(Animeware.evening) { + this.worldTime = 22000; + }else { + this.worldTime = time; + }*/ + if(Booleans.night) { + this.worldTime = 15000; + }else if(Booleans.day) { + this.worldTime = 10000; + }else if(Booleans.morning) { + this.worldTime = 22000; + }else if(Booleans.evening) { + this.worldTime = 14000; + }else if(Booleans.timechanger) { + this.worldTime = WorldInfo.worldTime; + }else { + this.worldTime = time; +} + + } + + public void setSpawn(BlockPos spawnPoint) + { + this.spawnX = spawnPoint.getX(); + this.spawnY = spawnPoint.getY(); + this.spawnZ = spawnPoint.getZ(); + } + + /** + * Get current world name + */ + public String getWorldName() + { + return this.levelName; + } + + public void setWorldName(String worldName) + { + this.levelName = worldName; + } + + /** + * Returns the save version of this world + */ + public int getSaveVersion() + { + return this.saveVersion; + } + + /** + * Sets the save version of the world + */ + public void setSaveVersion(int version) + { + this.saveVersion = version; + } + + /** + * Return the last time the player was in this world. + */ + public long getLastTimePlayed() + { + return this.lastTimePlayed; + } + + public int getCleanWeatherTime() + { + return this.cleanWeatherTime; + } + + public void setCleanWeatherTime(int cleanWeatherTimeIn) + { + this.cleanWeatherTime = cleanWeatherTimeIn; + } + + /** + * Returns true if it is thundering, false otherwise. + */ + public boolean isThundering() + { + return this.thundering; + } + + /** + * Sets whether it is thundering or not. + */ + public void setThundering(boolean thunderingIn) + { + this.thundering = thunderingIn; + } + + /** + * Returns the number of ticks until next thunderbolt. + */ + public int getThunderTime() + { + return this.thunderTime; + } + + /** + * Defines the number of ticks until next thunderbolt. + */ + public void setThunderTime(int time) + { + this.thunderTime = time; + } + + /** + * Returns true if it is raining, false otherwise. + */ + public boolean isRaining() + { + return this.raining; + } + + /** + * Sets whether it is raining or not. + */ + public void setRaining(boolean isRaining) + { + this.raining = isRaining; + } + + /** + * Return the number of ticks until rain. + */ + public int getRainTime() + { + return this.rainTime; + } + + /** + * Sets the number of ticks until rain. + */ + public void setRainTime(int time) + { + this.rainTime = time; + } + + /** + * Gets the GameType. + */ + public WorldSettings.GameType getGameType() + { + return this.theGameType; + } + + /** + * Get whether the map features (e.g. strongholds) generation is enabled or disabled. + */ + public boolean isMapFeaturesEnabled() + { + return this.mapFeaturesEnabled; + } + + public void setMapFeaturesEnabled(boolean enabled) + { + this.mapFeaturesEnabled = enabled; + } + + /** + * Sets the GameType. + */ + public void setGameType(WorldSettings.GameType type) + { + this.theGameType = type; + } + + /** + * Returns true if hardcore mode is enabled, otherwise false + */ + public boolean isHardcoreModeEnabled() + { + return this.hardcore; + } + + public void setHardcore(boolean hardcoreIn) + { + this.hardcore = hardcoreIn; + } + + public WorldType getTerrainType() + { + return this.terrainType; + } + + public void setTerrainType(WorldType type) + { + this.terrainType = type; + } + + public String getGeneratorOptions() + { + return this.generatorOptions; + } + + /** + * Returns true if commands are allowed on this World. + */ + public boolean areCommandsAllowed() + { + return this.allowCommands; + } + + public void setAllowCommands(boolean allow) + { + this.allowCommands = allow; + } + + /** + * Returns true if the World is initialized. + */ + public boolean isInitialized() + { + return this.initialized; + } + + /** + * Sets the initialization status of the World. + */ + public void setServerInitialized(boolean initializedIn) + { + this.initialized = initializedIn; + } + + /** + * Gets the GameRules class Instance. + */ + public GameRules getGameRulesInstance() + { + return this.theGameRules; + } + + /** + * Returns the border center X position + */ + public double getBorderCenterX() + { + return this.borderCenterX; + } + + /** + * Returns the border center Z position + */ + public double getBorderCenterZ() + { + return this.borderCenterZ; + } + + public double getBorderSize() + { + return this.borderSize; + } + + /** + * Sets the border size + */ + public void setBorderSize(double size) + { + this.borderSize = size; + } + + /** + * Returns the border lerp time + */ + public long getBorderLerpTime() + { + return this.borderSizeLerpTime; + } + + /** + * Sets the border lerp time + */ + public void setBorderLerpTime(long time) + { + this.borderSizeLerpTime = time; + } + + /** + * Returns the border lerp target + */ + public double getBorderLerpTarget() + { + return this.borderSizeLerpTarget; + } + + /** + * Sets the border lerp target + */ + public void setBorderLerpTarget(double lerpSize) + { + this.borderSizeLerpTarget = lerpSize; + } + + /** + * Sets the border center Z position + */ + public void getBorderCenterZ(double posZ) + { + this.borderCenterZ = posZ; + } + + /** + * Sets the border center X position + */ + public void getBorderCenterX(double posX) + { + this.borderCenterX = posX; + } + + /** + * Returns the border safe zone + */ + public double getBorderSafeZone() + { + return this.borderSafeZone; + } + + /** + * Sets the border safe zone + */ + public void setBorderSafeZone(double amount) + { + this.borderSafeZone = amount; + } + + /** + * Returns the border damage per block + */ + public double getBorderDamagePerBlock() + { + return this.borderDamagePerBlock; + } + + /** + * Sets the border damage per block + */ + public void setBorderDamagePerBlock(double damage) + { + this.borderDamagePerBlock = damage; + } + + /** + * Returns the border warning distance + */ + public int getBorderWarningDistance() + { + return this.borderWarningDistance; + } + + /** + * Returns the border warning time + */ + public int getBorderWarningTime() + { + return this.borderWarningTime; + } + + /** + * Sets the border warning distance + */ + public void setBorderWarningDistance(int amountOfBlocks) + { + this.borderWarningDistance = amountOfBlocks; + } + + /** + * Sets the border warning time + */ + public void setBorderWarningTime(int ticks) + { + this.borderWarningTime = ticks; + } + + public EnumDifficulty getDifficulty() + { + return this.difficulty; + } + + public void setDifficulty(EnumDifficulty newDifficulty) + { + this.difficulty = newDifficulty; + } + + public boolean isDifficultyLocked() + { + return this.difficultyLocked; + } + + public void setDifficultyLocked(boolean locked) + { + this.difficultyLocked = locked; + } + + /** + * Adds this WorldInfo instance to the crash report. + */ + public void addToCrashReport(CrashReportCategory category) + { + category.addCrashSectionCallable("Level seed", new Callable() + { + public String call() throws Exception + { + return String.valueOf(WorldInfo.this.getSeed()); + } + }); + category.addCrashSectionCallable("Level generator", new Callable() + { + public String call() throws Exception + { + return String.format("ID %02d - %s, ver %d. Features enabled: %b", new Object[] {Integer.valueOf(WorldInfo.this.terrainType.getWorldTypeID()), WorldInfo.this.terrainType.getWorldTypeName(), Integer.valueOf(WorldInfo.this.terrainType.getGeneratorVersion()), Boolean.valueOf(WorldInfo.this.mapFeaturesEnabled)}); + } + }); + category.addCrashSectionCallable("Level generator options", new Callable() + { + public String call() throws Exception + { + return WorldInfo.this.generatorOptions; + } + }); + category.addCrashSectionCallable("Level spawn location", new Callable() + { + public String call() throws Exception + { + return CrashReportCategory.getCoordinateInfo((double)WorldInfo.this.spawnX, (double)WorldInfo.this.spawnY, (double)WorldInfo.this.spawnZ); + } + }); + category.addCrashSectionCallable("Level time", new Callable() + { + public String call() throws Exception + { + return String.format("%d game time, %d day time", new Object[] {Long.valueOf(WorldInfo.this.totalTime), Long.valueOf(WorldInfo.this.worldTime)}); + } + }); + category.addCrashSectionCallable("Level dimension", new Callable() + { + public String call() throws Exception + { + return String.valueOf(WorldInfo.this.dimension); + } + }); + category.addCrashSectionCallable("Level storage version", new Callable() + { + public String call() throws Exception + { + String s = "Unknown?"; + + try + { + switch (WorldInfo.this.saveVersion) + { + case 19132: + s = "McRegion"; + break; + + case 19133: + s = "Anvil"; + } + } + catch (Throwable var3) + { + ; + } + + return String.format("0x%05X - %s", new Object[] {Integer.valueOf(WorldInfo.this.saveVersion), s}); + } + }); + category.addCrashSectionCallable("Level weather", new Callable() + { + public String call() throws Exception + { + return String.format("Rain time: %d (now: %b), thunder time: %d (now: %b)", new Object[] {Integer.valueOf(WorldInfo.this.rainTime), Boolean.valueOf(WorldInfo.this.raining), Integer.valueOf(WorldInfo.this.thunderTime), Boolean.valueOf(WorldInfo.this.thundering)}); + } + }); + category.addCrashSectionCallable("Level game mode", new Callable() + { + public String call() throws Exception + { + return String.format("Game mode: %s (ID %d). Hardcore: %b. Cheats: %b", new Object[] {WorldInfo.this.theGameType.getName(), Integer.valueOf(WorldInfo.this.theGameType.getID()), Boolean.valueOf(WorldInfo.this.hardcore), Boolean.valueOf(WorldInfo.this.allowCommands)}); + } + }); + } +} diff --git a/src/minecraft/net/minecraftforge/client/model/IModelPart.java b/src/minecraft/net/minecraftforge/client/model/IModelPart.java new file mode 100644 index 0000000..257cb22 --- /dev/null +++ b/src/minecraft/net/minecraftforge/client/model/IModelPart.java @@ -0,0 +1,5 @@ +package net.minecraftforge.client.model; + +public interface IModelPart +{ +} diff --git a/src/minecraft/net/minecraftforge/client/model/IModelState.java b/src/minecraft/net/minecraftforge/client/model/IModelState.java new file mode 100644 index 0000000..4f10b20 --- /dev/null +++ b/src/minecraft/net/minecraftforge/client/model/IModelState.java @@ -0,0 +1,8 @@ +package net.minecraftforge.client.model; + +import com.google.common.base.Optional; + +public interface IModelState +{ + Optional apply(Optional var1); +} diff --git a/src/minecraft/net/minecraftforge/client/model/ITransformation.java b/src/minecraft/net/minecraftforge/client/model/ITransformation.java new file mode 100644 index 0000000..196dd68 --- /dev/null +++ b/src/minecraft/net/minecraftforge/client/model/ITransformation.java @@ -0,0 +1,13 @@ +package net.minecraftforge.client.model; + +import javax.vecmath.Matrix4f; +import net.minecraft.util.EnumFacing; + +public interface ITransformation +{ + Matrix4f getMatrix(); + + EnumFacing rotate(EnumFacing var1); + + int rotate(EnumFacing var1, int var2); +} diff --git a/src/minecraft/net/minecraftforge/client/model/TRSRTransformation.java b/src/minecraft/net/minecraftforge/client/model/TRSRTransformation.java new file mode 100644 index 0000000..070b1c3 --- /dev/null +++ b/src/minecraft/net/minecraftforge/client/model/TRSRTransformation.java @@ -0,0 +1,12 @@ +package net.minecraftforge.client.model; + +import javax.vecmath.Matrix4f; +import org.apache.commons.lang3.NotImplementedException; + +public class TRSRTransformation +{ + public TRSRTransformation(Matrix4f matrix) + { + throw new NotImplementedException("Forge dummy class"); + } +} diff --git a/src/minecraft/net/minecraftforge/client/model/pipeline/IVertexConsumer.java b/src/minecraft/net/minecraftforge/client/model/pipeline/IVertexConsumer.java new file mode 100644 index 0000000..bd8f2ea --- /dev/null +++ b/src/minecraft/net/minecraftforge/client/model/pipeline/IVertexConsumer.java @@ -0,0 +1,17 @@ +package net.minecraftforge.client.model.pipeline; + +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.EnumFacing; + +public interface IVertexConsumer +{ + VertexFormat getVertexFormat(); + + void setQuadTint(int var1); + + void setQuadOrientation(EnumFacing var1); + + void setQuadColored(); + + void put(int var1, float... var2); +} diff --git a/src/minecraft/net/minecraftforge/client/model/pipeline/IVertexProducer.java b/src/minecraft/net/minecraftforge/client/model/pipeline/IVertexProducer.java new file mode 100644 index 0000000..6662ed8 --- /dev/null +++ b/src/minecraft/net/minecraftforge/client/model/pipeline/IVertexProducer.java @@ -0,0 +1,6 @@ +package net.minecraftforge.client.model.pipeline; + +public interface IVertexProducer +{ + void pipe(IVertexConsumer var1); +} diff --git a/src/minecraft/net/minecraftforge/common/property/IUnlistedProperty.java b/src/minecraft/net/minecraftforge/common/property/IUnlistedProperty.java new file mode 100644 index 0000000..fc14479 --- /dev/null +++ b/src/minecraft/net/minecraftforge/common/property/IUnlistedProperty.java @@ -0,0 +1,12 @@ +package net.minecraftforge.common.property; + +public interface IUnlistedProperty +{ + String getName(); + + boolean isValid(V var1); + + Class getType(); + + String valueToString(V var1); +} diff --git a/src/minecraft/optifine/BetterGrass.java b/src/minecraft/optifine/BetterGrass.java new file mode 100644 index 0000000..054b74d --- /dev/null +++ b/src/minecraft/optifine/BetterGrass.java @@ -0,0 +1,84 @@ +package optifine; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.BlockGrass; +import net.minecraft.block.BlockMycelium; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.SimpleBakedModel; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; + +public class BetterGrass +{ + private static IBakedModel modelEmpty = new SimpleBakedModel(new ArrayList(), new ArrayList(), false, false, (TextureAtlasSprite)null, (ItemCameraTransforms)null); + private static IBakedModel modelCubeMycelium = null; + private static IBakedModel modelCubeGrassSnowy = null; + private static IBakedModel modelCubeGrass = null; + + public static void update() + { + modelCubeGrass = BlockModelUtils.makeModelCube((String)"minecraft:blocks/grass_top", 0); + modelCubeGrassSnowy = BlockModelUtils.makeModelCube((String)"minecraft:blocks/snow", -1); + modelCubeMycelium = BlockModelUtils.makeModelCube((String)"minecraft:blocks/mycelium_top", -1); + } + + public static List getFaceQuads(IBlockAccess p_getFaceQuads_0_, Block p_getFaceQuads_1_, BlockPos p_getFaceQuads_2_, EnumFacing p_getFaceQuads_3_, List p_getFaceQuads_4_) + { + if (p_getFaceQuads_3_ != EnumFacing.UP && p_getFaceQuads_3_ != EnumFacing.DOWN) + { + if (p_getFaceQuads_1_ instanceof BlockMycelium) + { + return Config.isBetterGrassFancy() ? (getBlockAt(p_getFaceQuads_2_.down(), p_getFaceQuads_3_, p_getFaceQuads_0_) == Blocks.mycelium ? modelCubeMycelium.getFaceQuads(p_getFaceQuads_3_) : p_getFaceQuads_4_) : modelCubeMycelium.getFaceQuads(p_getFaceQuads_3_); + } + else + { + if (p_getFaceQuads_1_ instanceof BlockGrass) + { + Block block = p_getFaceQuads_0_.getBlockState(p_getFaceQuads_2_.up()).getBlock(); + boolean flag = block == Blocks.snow || block == Blocks.snow_layer; + + if (!Config.isBetterGrassFancy()) + { + if (flag) + { + return modelCubeGrassSnowy.getFaceQuads(p_getFaceQuads_3_); + } + + return modelCubeGrass.getFaceQuads(p_getFaceQuads_3_); + } + + if (flag) + { + if (getBlockAt(p_getFaceQuads_2_, p_getFaceQuads_3_, p_getFaceQuads_0_) == Blocks.snow_layer) + { + return modelCubeGrassSnowy.getFaceQuads(p_getFaceQuads_3_); + } + } + else if (getBlockAt(p_getFaceQuads_2_.down(), p_getFaceQuads_3_, p_getFaceQuads_0_) == Blocks.grass) + { + return modelCubeGrass.getFaceQuads(p_getFaceQuads_3_); + } + } + + return p_getFaceQuads_4_; + } + } + else + { + return p_getFaceQuads_4_; + } + } + + private static Block getBlockAt(BlockPos p_getBlockAt_0_, EnumFacing p_getBlockAt_1_, IBlockAccess p_getBlockAt_2_) + { + BlockPos blockpos = p_getBlockAt_0_.offset(p_getBlockAt_1_); + Block block = p_getBlockAt_2_.getBlockState(blockpos).getBlock(); + return block; + } +} diff --git a/src/minecraft/optifine/BetterSnow.java b/src/minecraft/optifine/BetterSnow.java new file mode 100644 index 0000000..38f83db --- /dev/null +++ b/src/minecraft/optifine/BetterSnow.java @@ -0,0 +1,104 @@ +package optifine; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockBush; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.block.BlockFence; +import net.minecraft.block.BlockFenceGate; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.BlockFlowerPot; +import net.minecraft.block.BlockLever; +import net.minecraft.block.BlockMushroom; +import net.minecraft.block.BlockPane; +import net.minecraft.block.BlockRedstoneTorch; +import net.minecraft.block.BlockReed; +import net.minecraft.block.BlockSapling; +import net.minecraft.block.BlockSnow; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.BlockTorch; +import net.minecraft.block.BlockWall; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; + +public class BetterSnow +{ + private static IBakedModel modelSnowLayer = null; + + public static void update() + { + modelSnowLayer = Config.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(Blocks.snow_layer.getDefaultState()); + } + + public static IBakedModel getModelSnowLayer() + { + return modelSnowLayer; + } + + public static IBlockState getStateSnowLayer() + { + return Blocks.snow_layer.getDefaultState(); + } + + public static boolean shouldRender(IBlockAccess p_shouldRender_0_, Block p_shouldRender_1_, IBlockState p_shouldRender_2_, BlockPos p_shouldRender_3_) + { + return !checkBlock(p_shouldRender_1_, p_shouldRender_2_) ? false : hasSnowNeighbours(p_shouldRender_0_, p_shouldRender_3_); + } + + private static boolean hasSnowNeighbours(IBlockAccess p_hasSnowNeighbours_0_, BlockPos p_hasSnowNeighbours_1_) + { + Block block = Blocks.snow_layer; + return p_hasSnowNeighbours_0_.getBlockState(p_hasSnowNeighbours_1_.north()).getBlock() != block && p_hasSnowNeighbours_0_.getBlockState(p_hasSnowNeighbours_1_.south()).getBlock() != block && p_hasSnowNeighbours_0_.getBlockState(p_hasSnowNeighbours_1_.west()).getBlock() != block && p_hasSnowNeighbours_0_.getBlockState(p_hasSnowNeighbours_1_.east()).getBlock() != block ? false : p_hasSnowNeighbours_0_.getBlockState(p_hasSnowNeighbours_1_.down()).getBlock().isOpaqueCube(); + } + + private static boolean checkBlock(Block p_checkBlock_0_, IBlockState p_checkBlock_1_) + { + if (p_checkBlock_0_.isFullCube()) + { + return false; + } + else if (p_checkBlock_0_.isOpaqueCube()) + { + return false; + } + else if (p_checkBlock_0_ instanceof BlockSnow) + { + return false; + } + else if (!(p_checkBlock_0_ instanceof BlockBush) || !(p_checkBlock_0_ instanceof BlockDoublePlant) && !(p_checkBlock_0_ instanceof BlockFlower) && !(p_checkBlock_0_ instanceof BlockMushroom) && !(p_checkBlock_0_ instanceof BlockSapling) && !(p_checkBlock_0_ instanceof BlockTallGrass)) + { + if (!(p_checkBlock_0_ instanceof BlockFence) && !(p_checkBlock_0_ instanceof BlockFenceGate) && !(p_checkBlock_0_ instanceof BlockFlowerPot) && !(p_checkBlock_0_ instanceof BlockPane) && !(p_checkBlock_0_ instanceof BlockReed) && !(p_checkBlock_0_ instanceof BlockWall)) + { + if (p_checkBlock_0_ instanceof BlockRedstoneTorch && p_checkBlock_1_.getValue(BlockTorch.FACING) == EnumFacing.UP) + { + return true; + } + else + { + if (p_checkBlock_0_ instanceof BlockLever) + { + Object object = p_checkBlock_1_.getValue(BlockLever.FACING); + + if (object == BlockLever.EnumOrientation.UP_X || object == BlockLever.EnumOrientation.UP_Z) + { + return true; + } + } + + return false; + } + } + else + { + return true; + } + } + else + { + return true; + } + } +} diff --git a/src/minecraft/optifine/Blender.java b/src/minecraft/optifine/Blender.java new file mode 100644 index 0000000..25f89bc --- /dev/null +++ b/src/minecraft/optifine/Blender.java @@ -0,0 +1,148 @@ +package optifine; + +import net.minecraft.client.renderer.GlStateManager; + +public class Blender +{ + public static final int BLEND_ALPHA = 0; + public static final int BLEND_ADD = 1; + public static final int BLEND_SUBSTRACT = 2; + public static final int BLEND_MULTIPLY = 3; + public static final int BLEND_DODGE = 4; + public static final int BLEND_BURN = 5; + public static final int BLEND_SCREEN = 6; + public static final int BLEND_OVERLAY = 7; + public static final int BLEND_REPLACE = 8; + public static final int BLEND_DEFAULT = 1; + + public static int parseBlend(String p_parseBlend_0_) + { + if (p_parseBlend_0_ == null) + { + return 1; + } + else + { + p_parseBlend_0_ = p_parseBlend_0_.toLowerCase().trim(); + + if (p_parseBlend_0_.equals("alpha")) + { + return 0; + } + else if (p_parseBlend_0_.equals("add")) + { + return 1; + } + else if (p_parseBlend_0_.equals("subtract")) + { + return 2; + } + else if (p_parseBlend_0_.equals("multiply")) + { + return 3; + } + else if (p_parseBlend_0_.equals("dodge")) + { + return 4; + } + else if (p_parseBlend_0_.equals("burn")) + { + return 5; + } + else if (p_parseBlend_0_.equals("screen")) + { + return 6; + } + else if (p_parseBlend_0_.equals("overlay")) + { + return 7; + } + else if (p_parseBlend_0_.equals("replace")) + { + return 8; + } + else + { + Config.warn("Unknown blend: " + p_parseBlend_0_); + return 1; + } + } + } + + public static void setupBlend(int p_setupBlend_0_, float p_setupBlend_1_) + { + switch (p_setupBlend_0_) + { + case 0: + GlStateManager.disableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + GlStateManager.color(1.0F, 1.0F, 1.0F, p_setupBlend_1_); + break; + + case 1: + GlStateManager.disableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 1); + GlStateManager.color(1.0F, 1.0F, 1.0F, p_setupBlend_1_); + break; + + case 2: + GlStateManager.disableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(775, 0); + GlStateManager.color(p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_, 1.0F); + break; + + case 3: + GlStateManager.disableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(774, 771); + GlStateManager.color(p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_); + break; + + case 4: + GlStateManager.disableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(1, 1); + GlStateManager.color(p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_, 1.0F); + break; + + case 5: + GlStateManager.disableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(0, 769); + GlStateManager.color(p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_, 1.0F); + break; + + case 6: + GlStateManager.disableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(1, 769); + GlStateManager.color(p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_, 1.0F); + break; + + case 7: + GlStateManager.disableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(774, 768); + GlStateManager.color(p_setupBlend_1_, p_setupBlend_1_, p_setupBlend_1_, 1.0F); + break; + + case 8: + GlStateManager.enableAlpha(); + GlStateManager.disableBlend(); + GlStateManager.color(1.0F, 1.0F, 1.0F, p_setupBlend_1_); + } + + GlStateManager.enableTexture2D(); + } + + public static void clearBlend(float p_clearBlend_0_) + { + GlStateManager.disableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 1); + GlStateManager.color(1.0F, 1.0F, 1.0F, p_clearBlend_0_); + } +} diff --git a/src/minecraft/optifine/BlockModelUtils.java b/src/minecraft/optifine/BlockModelUtils.java new file mode 100644 index 0000000..28904aa --- /dev/null +++ b/src/minecraft/optifine/BlockModelUtils.java @@ -0,0 +1,58 @@ +package optifine; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.BlockFaceUV; +import net.minecraft.client.renderer.block.model.BlockPartFace; +import net.minecraft.client.renderer.block.model.BlockPartRotation; +import net.minecraft.client.renderer.block.model.FaceBakery; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.ModelRotation; +import net.minecraft.client.resources.model.SimpleBakedModel; +import net.minecraft.util.EnumFacing; +import org.lwjgl.util.vector.Vector3f; + +public class BlockModelUtils +{ + public static IBakedModel makeModelCube(String p_makeModelCube_0_, int p_makeModelCube_1_) + { + TextureAtlasSprite textureatlassprite = Config.getMinecraft().getTextureMapBlocks().getAtlasSprite(p_makeModelCube_0_); + return makeModelCube(textureatlassprite, p_makeModelCube_1_); + } + + public static IBakedModel makeModelCube(TextureAtlasSprite p_makeModelCube_0_, int p_makeModelCube_1_) + { + List list = new ArrayList(); + EnumFacing[] aenumfacing = EnumFacing.VALUES; + List list1 = new ArrayList(aenumfacing.length); + + for (int i = 0; i < aenumfacing.length; ++i) + { + EnumFacing enumfacing = aenumfacing[i]; + List list2 = new ArrayList(); + list2.add(makeBakedQuad(enumfacing, p_makeModelCube_0_, p_makeModelCube_1_)); + list1.add(list2); + } + + IBakedModel ibakedmodel = new SimpleBakedModel(list, list1, true, true, p_makeModelCube_0_, ItemCameraTransforms.DEFAULT); + return ibakedmodel; + } + + private static BakedQuad makeBakedQuad(EnumFacing p_makeBakedQuad_0_, TextureAtlasSprite p_makeBakedQuad_1_, int p_makeBakedQuad_2_) + { + Vector3f vector3f = new Vector3f(0.0F, 0.0F, 0.0F); + Vector3f vector3f1 = new Vector3f(16.0F, 16.0F, 16.0F); + BlockFaceUV blockfaceuv = new BlockFaceUV(new float[] {0.0F, 0.0F, 16.0F, 16.0F}, 0); + BlockPartFace blockpartface = new BlockPartFace(p_makeBakedQuad_0_, p_makeBakedQuad_2_, "#" + p_makeBakedQuad_0_.getName(), blockfaceuv); + ModelRotation modelrotation = ModelRotation.X0_Y0; + BlockPartRotation blockpartrotation = null; + boolean flag = false; + boolean flag1 = true; + FaceBakery facebakery = new FaceBakery(); + BakedQuad bakedquad = facebakery.makeBakedQuad(vector3f, vector3f1, blockpartface, p_makeBakedQuad_1_, p_makeBakedQuad_0_, modelrotation, blockpartrotation, flag, flag1); + return bakedquad; + } +} diff --git a/src/minecraft/optifine/BlockPosM.java b/src/minecraft/optifine/BlockPosM.java new file mode 100644 index 0000000..b7c4a39 --- /dev/null +++ b/src/minecraft/optifine/BlockPosM.java @@ -0,0 +1,199 @@ +package optifine; + +import com.google.common.collect.AbstractIterator; +import java.util.Iterator; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; + +public class BlockPosM extends BlockPos +{ + private int mx; + private int my; + private int mz; + private int level; + private BlockPosM[] facings; + private boolean needsUpdate; + + public BlockPosM(int p_i22_1_, int p_i22_2_, int p_i22_3_) + { + this(p_i22_1_, p_i22_2_, p_i22_3_, 0); + } + + public BlockPosM(double p_i23_1_, double p_i23_3_, double p_i23_5_) + { + this(MathHelper.floor_double(p_i23_1_), MathHelper.floor_double(p_i23_3_), MathHelper.floor_double(p_i23_5_)); + } + + public BlockPosM(int p_i24_1_, int p_i24_2_, int p_i24_3_, int p_i24_4_) + { + super(0, 0, 0); + this.mx = p_i24_1_; + this.my = p_i24_2_; + this.mz = p_i24_3_; + this.level = p_i24_4_; + } + + /** + * Get the X coordinate + */ + public int getX() + { + return this.mx; + } + + /** + * Get the Y coordinate + */ + public int getY() + { + return this.my; + } + + /** + * Get the Z coordinate + */ + public int getZ() + { + return this.mz; + } + + public void setXyz(int p_setXyz_1_, int p_setXyz_2_, int p_setXyz_3_) + { + this.mx = p_setXyz_1_; + this.my = p_setXyz_2_; + this.mz = p_setXyz_3_; + this.needsUpdate = true; + } + + public void setXyz(double p_setXyz_1_, double p_setXyz_3_, double p_setXyz_5_) + { + this.setXyz(MathHelper.floor_double(p_setXyz_1_), MathHelper.floor_double(p_setXyz_3_), MathHelper.floor_double(p_setXyz_5_)); + } + + /** + * Offset this BlockPos 1 block in the given direction + */ + public BlockPos offset(EnumFacing facing) + { + if (this.level <= 0) + { + return super.offset(facing, 1); + } + else + { + if (this.facings == null) + { + this.facings = new BlockPosM[EnumFacing.VALUES.length]; + } + + if (this.needsUpdate) + { + this.update(); + } + + int i = facing.getIndex(); + BlockPosM blockposm = this.facings[i]; + + if (blockposm == null) + { + int j = this.mx + facing.getFrontOffsetX(); + int k = this.my + facing.getFrontOffsetY(); + int l = this.mz + facing.getFrontOffsetZ(); + blockposm = new BlockPosM(j, k, l, this.level - 1); + this.facings[i] = blockposm; + } + + return blockposm; + } + } + + /** + * Offsets this BlockPos n blocks in the given direction + */ + public BlockPos offset(EnumFacing facing, int n) + { + return n == 1 ? this.offset(facing) : super.offset(facing, n); + } + + private void update() + { + for (int i = 0; i < 6; ++i) + { + BlockPosM blockposm = this.facings[i]; + + if (blockposm != null) + { + EnumFacing enumfacing = EnumFacing.VALUES[i]; + int j = this.mx + enumfacing.getFrontOffsetX(); + int k = this.my + enumfacing.getFrontOffsetY(); + int l = this.mz + enumfacing.getFrontOffsetZ(); + blockposm.setXyz(j, k, l); + } + } + + this.needsUpdate = false; + } + + public static Iterable getAllInBoxMutable(BlockPos p_getAllInBoxMutable_0_, BlockPos p_getAllInBoxMutable_1_) + { + final BlockPos blockpos = new BlockPos(Math.min(p_getAllInBoxMutable_0_.getX(), p_getAllInBoxMutable_1_.getX()), Math.min(p_getAllInBoxMutable_0_.getY(), p_getAllInBoxMutable_1_.getY()), Math.min(p_getAllInBoxMutable_0_.getZ(), p_getAllInBoxMutable_1_.getZ())); + final BlockPos blockpos1 = new BlockPos(Math.max(p_getAllInBoxMutable_0_.getX(), p_getAllInBoxMutable_1_.getX()), Math.max(p_getAllInBoxMutable_0_.getY(), p_getAllInBoxMutable_1_.getY()), Math.max(p_getAllInBoxMutable_0_.getZ(), p_getAllInBoxMutable_1_.getZ())); + return new Iterable() + { + public Iterator iterator() + { + return new AbstractIterator() + { + private BlockPosM theBlockPosM = null; + protected BlockPosM computeNext0() + { + if (this.theBlockPosM == null) + { + this.theBlockPosM = new BlockPosM(blockpos.getX(), blockpos.getY(), blockpos.getZ(), 3); + return this.theBlockPosM; + } + else if (this.theBlockPosM.equals(blockpos1)) + { + return (BlockPosM)this.endOfData(); + } + else + { + int i = this.theBlockPosM.getX(); + int j = this.theBlockPosM.getY(); + int k = this.theBlockPosM.getZ(); + + if (i < blockpos1.getX()) + { + ++i; + } + else if (j < blockpos1.getY()) + { + i = blockpos.getX(); + ++j; + } + else if (k < blockpos1.getZ()) + { + i = blockpos.getX(); + j = blockpos.getY(); + ++k; + } + + this.theBlockPosM.setXyz(i, j, k); + return this.theBlockPosM; + } + } + protected Object computeNext() + { + return this.computeNext0(); + } + }; + } + }; + } + + public BlockPos getImmutable() + { + return new BlockPos(this.getX(), this.getY(), this.getZ()); + } +} diff --git a/src/minecraft/optifine/CacheLocal.java b/src/minecraft/optifine/CacheLocal.java new file mode 100644 index 0000000..cd6b82e --- /dev/null +++ b/src/minecraft/optifine/CacheLocal.java @@ -0,0 +1,76 @@ +package optifine; + +public class CacheLocal +{ + private int maxX = 18; + private int maxY = 128; + private int maxZ = 18; + private int offsetX = 0; + private int offsetY = 0; + private int offsetZ = 0; + private int[][][] cache = (int[][][])null; + private int[] lastZs = null; + private int lastDz = 0; + + public CacheLocal(int p_i25_1_, int p_i25_2_, int p_i25_3_) + { + this.maxX = p_i25_1_; + this.maxY = p_i25_2_; + this.maxZ = p_i25_3_; + this.cache = new int[p_i25_1_][p_i25_2_][p_i25_3_]; + this.resetCache(); + } + + public void resetCache() + { + for (int i = 0; i < this.maxX; ++i) + { + int[][] aint = this.cache[i]; + + for (int j = 0; j < this.maxY; ++j) + { + int[] aint1 = aint[j]; + + for (int k = 0; k < this.maxZ; ++k) + { + aint1[k] = -1; + } + } + } + } + + public void setOffset(int p_setOffset_1_, int p_setOffset_2_, int p_setOffset_3_) + { + this.offsetX = p_setOffset_1_; + this.offsetY = p_setOffset_2_; + this.offsetZ = p_setOffset_3_; + this.resetCache(); + } + + public int get(int p_get_1_, int p_get_2_, int p_get_3_) + { + try + { + this.lastZs = this.cache[p_get_1_ - this.offsetX][p_get_2_ - this.offsetY]; + this.lastDz = p_get_3_ - this.offsetZ; + return this.lastZs[this.lastDz]; + } + catch (ArrayIndexOutOfBoundsException arrayindexoutofboundsexception) + { + arrayindexoutofboundsexception.printStackTrace(); + return -1; + } + } + + public void setLast(int p_setLast_1_) + { + try + { + this.lastZs[this.lastDz] = p_setLast_1_; + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } +} diff --git a/src/minecraft/optifine/CacheLocalByte.java b/src/minecraft/optifine/CacheLocalByte.java new file mode 100644 index 0000000..49612b2 --- /dev/null +++ b/src/minecraft/optifine/CacheLocalByte.java @@ -0,0 +1,76 @@ +package optifine; + +public class CacheLocalByte +{ + private int maxX = 18; + private int maxY = 128; + private int maxZ = 18; + private int offsetX = 0; + private int offsetY = 0; + private int offsetZ = 0; + private byte[][][] cache = (byte[][][])null; + private byte[] lastZs = null; + private int lastDz = 0; + + public CacheLocalByte(int p_i26_1_, int p_i26_2_, int p_i26_3_) + { + this.maxX = p_i26_1_; + this.maxY = p_i26_2_; + this.maxZ = p_i26_3_; + this.cache = new byte[p_i26_1_][p_i26_2_][p_i26_3_]; + this.resetCache(); + } + + public void resetCache() + { + for (int i = 0; i < this.maxX; ++i) + { + byte[][] abyte = this.cache[i]; + + for (int j = 0; j < this.maxY; ++j) + { + byte[] abyte1 = abyte[j]; + + for (int k = 0; k < this.maxZ; ++k) + { + abyte1[k] = -1; + } + } + } + } + + public void setOffset(int p_setOffset_1_, int p_setOffset_2_, int p_setOffset_3_) + { + this.offsetX = p_setOffset_1_; + this.offsetY = p_setOffset_2_; + this.offsetZ = p_setOffset_3_; + this.resetCache(); + } + + public byte get(int p_get_1_, int p_get_2_, int p_get_3_) + { + try + { + this.lastZs = this.cache[p_get_1_ - this.offsetX][p_get_2_ - this.offsetY]; + this.lastDz = p_get_3_ - this.offsetZ; + return this.lastZs[this.lastDz]; + } + catch (ArrayIndexOutOfBoundsException arrayindexoutofboundsexception) + { + arrayindexoutofboundsexception.printStackTrace(); + return (byte) - 1; + } + } + + public void setLast(byte p_setLast_1_) + { + try + { + this.lastZs[this.lastDz] = p_setLast_1_; + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } +} diff --git a/src/minecraft/optifine/CapeUtils.java b/src/minecraft/optifine/CapeUtils.java new file mode 100644 index 0000000..f2e3138 --- /dev/null +++ b/src/minecraft/optifine/CapeUtils.java @@ -0,0 +1,81 @@ +package optifine; + +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.awt.image.ImageObserver; +import java.io.File; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.IImageBuffer; +import net.minecraft.client.renderer.ImageBufferDownload; +import net.minecraft.client.renderer.ThreadDownloadImageData; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.FilenameUtils; + +public class CapeUtils +{ + public static void downloadCape(final AbstractClientPlayer p_downloadCape_0_) + { + String s = p_downloadCape_0_.getNameClear(); + + if (s != null && !s.isEmpty()) + { + String s1 = "http://s.optifine.net/capes/" + s + ".png"; + String s2 = FilenameUtils.getBaseName(s1); + final ResourceLocation resourcelocation = new ResourceLocation("capeof/" + s2); + TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); + ITextureObject itextureobject = texturemanager.getTexture(resourcelocation); + + if (itextureobject != null && itextureobject instanceof ThreadDownloadImageData) + { + ThreadDownloadImageData threaddownloadimagedata = (ThreadDownloadImageData)itextureobject; + + if (threaddownloadimagedata.imageFound != null) + { + if (threaddownloadimagedata.imageFound.booleanValue()) + { + p_downloadCape_0_.setLocationOfCape(resourcelocation); + } + + return; + } + } + + IImageBuffer iimagebuffer = new IImageBuffer() + { + ImageBufferDownload ibd = new ImageBufferDownload(); + public BufferedImage parseUserSkin(BufferedImage image) + { + return CapeUtils.parseCape(image); + } + public void skinAvailable() + { + p_downloadCape_0_.setLocationOfCape(resourcelocation); + } + }; + ThreadDownloadImageData threaddownloadimagedata1 = new ThreadDownloadImageData((File)null, s1, (ResourceLocation)null, iimagebuffer); + threaddownloadimagedata1.pipeline = true; + texturemanager.loadTexture(resourcelocation, threaddownloadimagedata1); + } + } + + public static BufferedImage parseCape(BufferedImage p_parseCape_0_) + { + int i = 64; + int j = 32; + int k = p_parseCape_0_.getWidth(); + + for (int l = p_parseCape_0_.getHeight(); i < k || j < l; j *= 2) + { + i *= 2; + } + + BufferedImage bufferedimage = new BufferedImage(i, j, 2); + Graphics graphics = bufferedimage.getGraphics(); + graphics.drawImage(p_parseCape_0_, 0, 0, (ImageObserver)null); + graphics.dispose(); + return bufferedimage; + } +} diff --git a/src/minecraft/optifine/ChunkUtils.java b/src/minecraft/optifine/ChunkUtils.java new file mode 100644 index 0000000..c56707f --- /dev/null +++ b/src/minecraft/optifine/ChunkUtils.java @@ -0,0 +1,110 @@ +package optifine; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.world.chunk.Chunk; + +public class ChunkUtils +{ + private static Field fieldHasEntities = null; + private static boolean fieldHasEntitiesMissing = false; + + public static boolean hasEntities(Chunk p_hasEntities_0_) + { + if (fieldHasEntities == null) + { + if (fieldHasEntitiesMissing) + { + return true; + } + + fieldHasEntities = findFieldHasEntities(p_hasEntities_0_); + + if (fieldHasEntities == null) + { + fieldHasEntitiesMissing = true; + return true; + } + } + + try + { + return fieldHasEntities.getBoolean(p_hasEntities_0_); + } + catch (Exception exception) + { + Config.warn("Error calling Chunk.hasEntities"); + Config.warn(exception.getClass().getName() + " " + exception.getMessage()); + fieldHasEntitiesMissing = true; + return true; + } + } + + private static Field findFieldHasEntities(Chunk p_findFieldHasEntities_0_) + { + try + { + List list = new ArrayList(); + List list1 = new ArrayList(); + Field[] afield = Chunk.class.getDeclaredFields(); + + for (int i = 0; i < afield.length; ++i) + { + Field field = afield[i]; + + if (field.getType() == Boolean.TYPE) + { + field.setAccessible(true); + list.add(field); + list1.add(field.get(p_findFieldHasEntities_0_)); + } + } + + p_findFieldHasEntities_0_.setHasEntities(false); + List list2 = new ArrayList(); + + for (Object field1 : list) + { + list2.add(((Field) field1).get(p_findFieldHasEntities_0_)); + } + + p_findFieldHasEntities_0_.setHasEntities(true); + List list3 = new ArrayList(); + + for (Object field2 : list) + { + list3.add(((Field) field2).get(p_findFieldHasEntities_0_)); + } + + List list4 = new ArrayList(); + + for (int j = 0; j < ((List)list).size(); ++j) + { + Field field3 = (Field)list.get(j); + Boolean obool = (Boolean)list2.get(j); + Boolean obool1 = (Boolean)list3.get(j); + + if (!obool.booleanValue() && obool1.booleanValue()) + { + list4.add(field3); + Boolean obool2 = (Boolean)list1.get(j); + field3.set(p_findFieldHasEntities_0_, obool2); + } + } + + if (list4.size() == 1) + { + Field field4 = (Field)list4.get(0); + return field4; + } + } + catch (Exception exception) + { + Config.warn(exception.getClass().getName() + " " + exception.getMessage()); + } + + Config.warn("Error finding Chunk.hasEntities"); + return null; + } +} diff --git a/src/minecraft/optifine/ClearWater.java b/src/minecraft/optifine/ClearWater.java new file mode 100644 index 0000000..57eafd1 --- /dev/null +++ b/src/minecraft/optifine/ClearWater.java @@ -0,0 +1,108 @@ +package optifine; + +import net.minecraft.block.BlockLeavesBase; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.EmptyChunk; +import net.minecraft.world.chunk.IChunkProvider; + +public class ClearWater +{ + public static void updateWaterOpacity(GameSettings p_updateWaterOpacity_0_, World p_updateWaterOpacity_1_) + { + if (p_updateWaterOpacity_0_ != null) + { + int i = 3; + + if (p_updateWaterOpacity_0_.ofClearWater) + { + i = 1; + } + + BlockLeavesBase.setLightOpacity(Blocks.water, i); + BlockLeavesBase.setLightOpacity(Blocks.flowing_water, i); + } + + if (p_updateWaterOpacity_1_ != null) + { + IChunkProvider ichunkprovider = p_updateWaterOpacity_1_.getChunkProvider(); + + if (ichunkprovider != null) + { + Entity entity = Config.getMinecraft().getRenderViewEntity(); + + if (entity != null) + { + int j = (int)entity.posX / 16; + int k = (int)entity.posZ / 16; + int l = j - 512; + int i1 = j + 512; + int j1 = k - 512; + int k1 = k + 512; + int l1 = 0; + + for (int i2 = l; i2 < i1; ++i2) + { + for (int j2 = j1; j2 < k1; ++j2) + { + if (ichunkprovider.chunkExists(i2, j2)) + { + Chunk chunk = ichunkprovider.provideChunk(i2, j2); + + if (chunk != null && !(chunk instanceof EmptyChunk)) + { + int k2 = i2 << 4; + int l2 = j2 << 4; + int i3 = k2 + 16; + int j3 = l2 + 16; + BlockPosM blockposm = new BlockPosM(0, 0, 0); + BlockPosM blockposm1 = new BlockPosM(0, 0, 0); + + for (int k3 = k2; k3 < i3; ++k3) + { + for (int l3 = l2; l3 < j3; ++l3) + { + blockposm.setXyz(k3, 0, l3); + BlockPos blockpos = p_updateWaterOpacity_1_.getPrecipitationHeight(blockposm); + + for (int i4 = 0; i4 < blockpos.getY(); ++i4) + { + blockposm1.setXyz(k3, i4, l3); + IBlockState iblockstate = p_updateWaterOpacity_1_.getBlockState(blockposm1); + + if (iblockstate.getBlock().getMaterial() == Material.water) + { + p_updateWaterOpacity_1_.markBlocksDirtyVertical(k3, l3, blockposm1.getY(), blockpos.getY()); + ++l1; + break; + } + } + } + } + } + } + } + } + + if (l1 > 0) + { + String s = "server"; + + if (Config.isMinecraftThread()) + { + s = "client"; + } + + Config.dbg("ClearWater (" + s + ") relighted " + l1 + " chunks"); + } + } + } + } + } +} diff --git a/src/minecraft/optifine/CloudRenderer.java b/src/minecraft/optifine/CloudRenderer.java new file mode 100644 index 0000000..0be38ec --- /dev/null +++ b/src/minecraft/optifine/CloudRenderer.java @@ -0,0 +1,105 @@ +package optifine; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import org.lwjgl.opengl.GL11; + +public class CloudRenderer +{ + private Minecraft mc; + private boolean updated = false; + private boolean renderFancy = false; + int cloudTickCounter; + float partialTicks; + private int glListClouds = -1; + private int cloudTickCounterUpdate = 0; + private double cloudPlayerX = 0.0D; + private double cloudPlayerY = 0.0D; + private double cloudPlayerZ = 0.0D; + + public CloudRenderer(Minecraft p_i28_1_) + { + this.mc = p_i28_1_; + this.glListClouds = GLAllocation.generateDisplayLists(1); + } + + public void prepareToRender(boolean p_prepareToRender_1_, int p_prepareToRender_2_, float p_prepareToRender_3_) + { + if (this.renderFancy != p_prepareToRender_1_) + { + this.updated = false; + } + + this.renderFancy = p_prepareToRender_1_; + this.cloudTickCounter = p_prepareToRender_2_; + this.partialTicks = p_prepareToRender_3_; + } + + public boolean shouldUpdateGlList() + { + if (!this.updated) + { + return true; + } + else if (this.cloudTickCounter >= this.cloudTickCounterUpdate + 20) + { + return true; + } + else + { + Entity entity = this.mc.getRenderViewEntity(); + boolean flag = this.cloudPlayerY + (double)entity.getEyeHeight() < 128.0D + (double)(this.mc.gameSettings.ofCloudsHeight * 128.0F); + boolean flag1 = entity.prevPosY + (double)entity.getEyeHeight() < 128.0D + (double)(this.mc.gameSettings.ofCloudsHeight * 128.0F); + return flag1 != flag; + } + } + + public void startUpdateGlList() + { + GL11.glNewList(this.glListClouds, GL11.GL_COMPILE); + } + + public void endUpdateGlList() + { + GL11.glEndList(); + this.cloudTickCounterUpdate = this.cloudTickCounter; + this.cloudPlayerX = this.mc.getRenderViewEntity().prevPosX; + this.cloudPlayerY = this.mc.getRenderViewEntity().prevPosY; + this.cloudPlayerZ = this.mc.getRenderViewEntity().prevPosZ; + this.updated = true; + GlStateManager.resetColor(); + } + + public void renderGlList() + { + Entity entity = this.mc.getRenderViewEntity(); + double d0 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double)this.partialTicks; + double d1 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double)this.partialTicks; + double d2 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)this.partialTicks; + double d3 = (double)((float)(this.cloudTickCounter - this.cloudTickCounterUpdate) + this.partialTicks); + float f = (float)(d0 - this.cloudPlayerX + d3 * 0.03D); + float f1 = (float)(d1 - this.cloudPlayerY); + float f2 = (float)(d2 - this.cloudPlayerZ); + GlStateManager.pushMatrix(); + + if (this.renderFancy) + { + GlStateManager.translate(-f / 12.0F, -f1, -f2 / 12.0F); + } + else + { + GlStateManager.translate(-f, -f1, -f2); + } + + GlStateManager.callList(this.glListClouds); + GlStateManager.popMatrix(); + GlStateManager.resetColor(); + } + + public void reset() + { + this.updated = false; + } +} diff --git a/src/minecraft/optifine/CompactArrayList.java b/src/minecraft/optifine/CompactArrayList.java new file mode 100644 index 0000000..002bf35 --- /dev/null +++ b/src/minecraft/optifine/CompactArrayList.java @@ -0,0 +1,152 @@ +package optifine; + +import java.util.ArrayList; + +public class CompactArrayList +{ + private ArrayList list; + private int initialCapacity; + private float loadFactor; + private int countValid; + + public CompactArrayList() + { + this(10, 0.75F); + } + + public CompactArrayList(int p_i29_1_) + { + this(p_i29_1_, 0.75F); + } + + public CompactArrayList(int p_i30_1_, float p_i30_2_) + { + this.list = null; + this.initialCapacity = 0; + this.loadFactor = 1.0F; + this.countValid = 0; + this.list = new ArrayList(p_i30_1_); + this.initialCapacity = p_i30_1_; + this.loadFactor = p_i30_2_; + } + + public void add(int p_add_1_, Object p_add_2_) + { + if (p_add_2_ != null) + { + ++this.countValid; + } + + this.list.add(p_add_1_, p_add_2_); + } + + public boolean add(Object p_add_1_) + { + if (p_add_1_ != null) + { + ++this.countValid; + } + + return this.list.add(p_add_1_); + } + + public Object set(int p_set_1_, Object p_set_2_) + { + Object object = this.list.set(p_set_1_, p_set_2_); + + if (p_set_2_ != object) + { + if (object == null) + { + ++this.countValid; + } + + if (p_set_2_ == null) + { + --this.countValid; + } + } + + return object; + } + + public Object remove(int p_remove_1_) + { + Object object = this.list.remove(p_remove_1_); + + if (object != null) + { + --this.countValid; + } + + return object; + } + + public void clear() + { + this.list.clear(); + this.countValid = 0; + } + + public void compact() + { + if (this.countValid <= 0 && this.list.size() <= 0) + { + this.clear(); + } + else if (this.list.size() > this.initialCapacity) + { + float f = (float)this.countValid * 1.0F / (float)this.list.size(); + + if (f <= this.loadFactor) + { + int i = 0; + + for (int j = 0; j < this.list.size(); ++j) + { + Object object = this.list.get(j); + + if (object != null) + { + if (j != i) + { + this.list.set(i, object); + } + + ++i; + } + } + + for (int k = this.list.size() - 1; k >= i; --k) + { + this.list.remove(k); + } + } + } + } + + public boolean contains(Object p_contains_1_) + { + return this.list.contains(p_contains_1_); + } + + public Object get(int p_get_1_) + { + return this.list.get(p_get_1_); + } + + public boolean isEmpty() + { + return this.list.isEmpty(); + } + + public int size() + { + return this.list.size(); + } + + public int getCountValid() + { + return this.countValid; + } +} diff --git a/src/minecraft/optifine/Config.java b/src/minecraft/optifine/Config.java new file mode 100644 index 0000000..9e9f658 --- /dev/null +++ b/src/minecraft/optifine/Config.java @@ -0,0 +1,2153 @@ +package optifine; + +import java.awt.Dimension; +import java.awt.image.BufferedImage; +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Array; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Properties; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.imageio.ImageIO; +import net.minecraft.client.LoadingScreenRenderer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.DefaultResourcePack; +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.client.resources.ResourcePackRepository; +import net.minecraft.client.resources.ResourcePackRepository.Entry; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.server.integrated.IntegratedServer; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldServer; +import org.apache.commons.io.IOUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.LWJGLException; +import org.lwjgl.Sys; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL20; +import org.lwjgl.opengl.GL12; +import org.lwjgl.opengl.GL30; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.opengl.PixelFormat; +import org.lwjgl.util.glu.GLU; +import shadersmod.client.Shaders; + +public class Config +{ + public static final String OF_NAME = "OptiFine"; + public static final String MC_VERSION = "1.8.8"; + public static final String OF_EDITION = "HD_U"; + public static final String OF_RELEASE = "H8"; + public static final String VERSION = "OptiFine_1.8.8_HD_U_H8"; + private static String newRelease = null; + private static boolean notify64BitJava = false; + public static String openGlVersion = null; + public static String openGlRenderer = null; + public static String openGlVendor = null; + public static String[] openGlExtensions = null; + public static GlVersion glVersion = null; + public static GlVersion glslVersion = null; + public static int minecraftVersionInt = -1; + public static boolean fancyFogAvailable = false; + public static boolean occlusionAvailable = false; + private static GameSettings gameSettings = null; + private static Minecraft minecraft = Minecraft.getMinecraft(); + private static boolean initialized = false; + private static Thread minecraftThread = null; + private static DisplayMode desktopDisplayMode = null; + private static DisplayMode[] displayModes = null; + private static int antialiasingLevel = 0; + private static int availableProcessors = 0; + public static boolean zoomMode = false; + private static int texturePackClouds = 0; + public static boolean waterOpacityChanged = false; + private static boolean fullscreenModeChecked = false; + private static boolean desktopModeChecked = false; + private static DefaultResourcePack defaultResourcePackLazy = null; + public static final Float DEF_ALPHA_FUNC_LEVEL = Float.valueOf(0.1F); + private static final Logger LOGGER = LogManager.getLogger(); + + public static String getVersion() + { + return "OptiFine_1.8.8_HD_U_H8"; + } + + public static String getVersionDebug() + { + StringBuffer stringbuffer = new StringBuffer(32); + + if (isDynamicLights()) + { + stringbuffer.append("DL: "); + stringbuffer.append(String.valueOf(DynamicLights.getCount())); + stringbuffer.append(", "); + } + + stringbuffer.append("OptiFine_1.8.8_HD_U_H8"); + String s = Shaders.getShaderPackName(); + + if (s != null) + { + stringbuffer.append(", "); + stringbuffer.append(s); + } + + return stringbuffer.toString(); + } + + public static void initGameSettings(GameSettings p_initGameSettings_0_) + { + if (gameSettings == null) + { + gameSettings = p_initGameSettings_0_; + desktopDisplayMode = Display.getDesktopDisplayMode(); + updateAvailableProcessors(); + ReflectorForge.putLaunchBlackboard("optifine.ForgeSplashCompatible", Boolean.TRUE); + } + } + + public static void initDisplay() + { + checkInitialized(); + antialiasingLevel = gameSettings.ofAaLevel; + checkDisplaySettings(); + checkDisplayMode(); + minecraftThread = Thread.currentThread(); + updateThreadPriorities(); + Shaders.startup(Minecraft.getMinecraft()); + } + + public static void checkInitialized() + { + if (!initialized) + { + if (Display.isCreated()) + { + initialized = true; + checkOpenGlCaps(); + startVersionCheckThread(); + } + } + } + + private static void checkOpenGlCaps() + { + log(""); + log(getVersion()); + log("Build: " + getBuild()); + log("OS: " + System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version")); + log("Java: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor")); + log("VM: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor")); + log("LWJGL: " + Sys.getVersion()); + openGlVersion = GL11.glGetString(GL11.GL_VERSION); + openGlRenderer = GL11.glGetString(GL11.GL_RENDERER); + openGlVendor = GL11.glGetString(GL11.GL_VENDOR); + log("OpenGL: " + openGlRenderer + ", version " + openGlVersion + ", " + openGlVendor); + log("OpenGL Version: " + getOpenGlVersionString()); + + if (!GLContext.getCapabilities().OpenGL12) + { + log("OpenGL Mipmap levels: Not available (GL12.GL_TEXTURE_MAX_LEVEL)"); + } + + fancyFogAvailable = GLContext.getCapabilities().GL_NV_fog_distance; + + if (!fancyFogAvailable) + { + log("OpenGL Fancy fog: Not available (GL_NV_fog_distance)"); + } + + occlusionAvailable = GLContext.getCapabilities().GL_ARB_occlusion_query; + + if (!occlusionAvailable) + { + log("OpenGL Occlussion culling: Not available (GL_ARB_occlusion_query)"); + } + + int i = TextureUtils.getGLMaximumTextureSize(); + dbg("Maximum texture size: " + i + "x" + i); + } + + private static String getBuild() + { + try + { + InputStream inputstream = Config.class.getResourceAsStream("/buildof.txt"); + + if (inputstream == null) + { + return null; + } + else + { + String s = readLines(inputstream)[0]; + return s; + } + } + catch (Exception exception) + { + warn("" + exception.getClass().getName() + ": " + exception.getMessage()); + return null; + } + } + + public static boolean isFancyFogAvailable() + { + return fancyFogAvailable; + } + + public static boolean isOcclusionAvailable() + { + return occlusionAvailable; + } + + public static int getMinecraftVersionInt() + { + if (minecraftVersionInt < 0) + { + String[] astring = tokenize("1.8.8", "."); + int i = 0; + + if (astring.length > 0) + { + i += 10000 * parseInt(astring[0], 0); + } + + if (astring.length > 1) + { + i += 100 * parseInt(astring[1], 0); + } + + if (astring.length > 2) + { + i += 1 * parseInt(astring[2], 0); + } + + minecraftVersionInt = i; + } + + return minecraftVersionInt; + } + + public static String getOpenGlVersionString() + { + GlVersion glversion = getGlVersion(); + String s = "" + glversion.getMajor() + "." + glversion.getMinor() + "." + glversion.getRelease(); + return s; + } + + private static GlVersion getGlVersionLwjgl() + { + return GLContext.getCapabilities().OpenGL44 ? new GlVersion(4, 4) : (GLContext.getCapabilities().OpenGL43 ? new GlVersion(4, 3) : (GLContext.getCapabilities().OpenGL42 ? new GlVersion(4, 2) : (GLContext.getCapabilities().OpenGL41 ? new GlVersion(4, 1) : (GLContext.getCapabilities().OpenGL40 ? new GlVersion(4, 0) : (GLContext.getCapabilities().OpenGL33 ? new GlVersion(3, 3) : (GLContext.getCapabilities().OpenGL32 ? new GlVersion(3, 2) : (GLContext.getCapabilities().OpenGL31 ? new GlVersion(3, 1) : (GLContext.getCapabilities().OpenGL30 ? new GlVersion(3, 0) : (GLContext.getCapabilities().OpenGL21 ? new GlVersion(2, 1) : (GLContext.getCapabilities().OpenGL20 ? new GlVersion(2, 0) : (GLContext.getCapabilities().OpenGL15 ? new GlVersion(1, 5) : (GLContext.getCapabilities().OpenGL14 ? new GlVersion(1, 4) : (GLContext.getCapabilities().OpenGL13 ? new GlVersion(1, 3) : (GLContext.getCapabilities().OpenGL12 ? new GlVersion(1, 2) : (GLContext.getCapabilities().OpenGL11 ? new GlVersion(1, 1) : new GlVersion(1, 0)))))))))))))))); + } + + public static GlVersion getGlVersion() + { + if (glVersion == null) + { + String s = GL11.glGetString(GL11.GL_VERSION); + glVersion = parseGlVersion(s, (GlVersion)null); + + if (glVersion == null) + { + glVersion = getGlVersionLwjgl(); + } + + if (glVersion == null) + { + glVersion = new GlVersion(1, 0); + } + } + + return glVersion; + } + + public static GlVersion getGlslVersion() + { + if (glslVersion == null) + { + String s = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION); + glslVersion = parseGlVersion(s, (GlVersion)null); + + if (glslVersion == null) + { + glslVersion = new GlVersion(1, 10); + } + } + + return glslVersion; + } + + public static GlVersion parseGlVersion(String p_parseGlVersion_0_, GlVersion p_parseGlVersion_1_) + { + try + { + if (p_parseGlVersion_0_ == null) + { + return p_parseGlVersion_1_; + } + else + { + Pattern pattern = Pattern.compile("([0-9]+)\\.([0-9]+)(\\.([0-9]+))?(.+)?"); + Matcher matcher = pattern.matcher(p_parseGlVersion_0_); + + if (!matcher.matches()) + { + return p_parseGlVersion_1_; + } + else + { + int i = Integer.parseInt(matcher.group(1)); + int j = Integer.parseInt(matcher.group(2)); + int k = matcher.group(4) != null ? Integer.parseInt(matcher.group(4)) : 0; + String s = matcher.group(5); + return new GlVersion(i, j, k, s); + } + } + } + catch (Exception exception) + { + exception.printStackTrace(); + return p_parseGlVersion_1_; + } + } + + public static String[] getOpenGlExtensions() + { + if (openGlExtensions == null) + { + openGlExtensions = detectOpenGlExtensions(); + } + + return openGlExtensions; + } + + private static String[] detectOpenGlExtensions() + { + try + { + GlVersion glversion = getGlVersion(); + + if (glversion.getMajor() >= 3) + { + int i = GL11.glGetInteger(33309); + + if (i > 0) + { + String[] astring = new String[i]; + + for (int j = 0; j < i; ++j) + { + astring[j] = GL30.glGetStringi(7939, j); + } + + return astring; + } + } + } + catch (Exception exception1) + { + exception1.printStackTrace(); + } + + try + { + String s = GL11.glGetString(GL11.GL_EXTENSIONS); + String[] astring1 = s.split(" "); + return astring1; + } + catch (Exception exception) + { + exception.printStackTrace(); + return new String[0]; + } + } + + public static void updateThreadPriorities() + { + updateAvailableProcessors(); + int i = 8; + + if (isSingleProcessor()) + { + if (isSmoothWorld()) + { + minecraftThread.setPriority(10); + setThreadPriority("Server thread", 1); + } + else + { + minecraftThread.setPriority(5); + setThreadPriority("Server thread", 5); + } + } + else + { + minecraftThread.setPriority(10); + setThreadPriority("Server thread", 5); + } + } + + private static void setThreadPriority(String p_setThreadPriority_0_, int p_setThreadPriority_1_) + { + try + { + ThreadGroup threadgroup = Thread.currentThread().getThreadGroup(); + + if (threadgroup == null) + { + return; + } + + int i = (threadgroup.activeCount() + 10) * 2; + Thread[] athread = new Thread[i]; + threadgroup.enumerate(athread, false); + + for (int j = 0; j < athread.length; ++j) + { + Thread thread = athread[j]; + + if (thread != null && thread.getName().startsWith(p_setThreadPriority_0_)) + { + thread.setPriority(p_setThreadPriority_1_); + } + } + } + catch (Throwable throwable) + { + warn(throwable.getClass().getName() + ": " + throwable.getMessage()); + } + } + + public static boolean isMinecraftThread() + { + return Thread.currentThread() == minecraftThread; + } + + private static void startVersionCheckThread() + { + VersionCheckThread versioncheckthread = new VersionCheckThread(); + versioncheckthread.start(); + } + + public static boolean isMipmaps() + { + return gameSettings.mipmapLevels > 0; + } + + public static int getMipmapLevels() + { + return gameSettings.mipmapLevels; + } + + public static int getMipmapType() + { + switch (gameSettings.ofMipmapType) + { + case 0: + return 9986; + + case 1: + return 9986; + + case 2: + if (isMultiTexture()) + { + return 9985; + } + + return 9986; + + case 3: + if (isMultiTexture()) + { + return 9987; + } + + return 9986; + + default: + return 9986; + } + } + + public static boolean isUseAlphaFunc() + { + float f = getAlphaFuncLevel(); + return f > DEF_ALPHA_FUNC_LEVEL.floatValue() + 1.0E-5F; + } + + public static float getAlphaFuncLevel() + { + return DEF_ALPHA_FUNC_LEVEL.floatValue(); + } + + public static boolean isFogFancy() + { + return !isFancyFogAvailable() ? false : gameSettings.ofFogType == 2; + } + + public static boolean isFogFast() + { + return gameSettings.ofFogType == 1; + } + + public static boolean isFogOff() + { + return gameSettings.ofFogType == 3; + } + + public static float getFogStart() + { + return gameSettings.ofFogStart; + } + + public static void dbg(String p_dbg_0_) + { + LOGGER.info("[OptiFine] " + p_dbg_0_); + } + + public static void warn(String p_warn_0_) + { + LOGGER.warn("[OptiFine] " + p_warn_0_); + } + + public static void error(String p_error_0_) + { + LOGGER.error("[OptiFine] " + p_error_0_); + } + + public static void log(String p_log_0_) + { + dbg(p_log_0_); + } + + public static int getUpdatesPerFrame() + { + return gameSettings.ofChunkUpdates; + } + + public static boolean isDynamicUpdates() + { + return gameSettings.ofChunkUpdatesDynamic; + } + + public static boolean isRainFancy() + { + return gameSettings.ofRain == 0 ? gameSettings.fancyGraphics : gameSettings.ofRain == 2; + } + + public static boolean isRainOff() + { + return gameSettings.ofRain == 3; + } + + public static boolean isCloudsFancy() + { + return gameSettings.ofClouds != 0 ? gameSettings.ofClouds == 2 : (isShaders() && !Shaders.shaderPackClouds.isDefault() ? Shaders.shaderPackClouds.isFancy() : (texturePackClouds != 0 ? texturePackClouds == 2 : gameSettings.fancyGraphics)); + } + + public static boolean isCloudsOff() + { + return gameSettings.ofClouds != 0 ? gameSettings.ofClouds == 3 : (isShaders() && !Shaders.shaderPackClouds.isDefault() ? Shaders.shaderPackClouds.isOff() : (texturePackClouds != 0 ? texturePackClouds == 3 : false)); + } + + public static void updateTexturePackClouds() + { + texturePackClouds = 0; + IResourceManager iresourcemanager = getResourceManager(); + + if (iresourcemanager != null) + { + try + { + InputStream inputstream = iresourcemanager.getResource(new ResourceLocation("mcpatcher/color.properties")).getInputStream(); + + if (inputstream == null) + { + return; + } + + Properties properties = new Properties(); + properties.load(inputstream); + inputstream.close(); + String s = properties.getProperty("clouds"); + + if (s == null) + { + return; + } + + dbg("Texture pack clouds: " + s); + s = s.toLowerCase(); + + if (s.equals("fast")) + { + texturePackClouds = 1; + } + + if (s.equals("fancy")) + { + texturePackClouds = 2; + } + + if (s.equals("off")) + { + texturePackClouds = 3; + } + } + catch (Exception var4) + { + ; + } + } + } + + public static ModelManager getModelManager() + { + return minecraft.getRenderItem().modelManager; + } + + public static boolean isTreesFancy() + { + return gameSettings.ofTrees == 0 ? gameSettings.fancyGraphics : gameSettings.ofTrees != 1; + } + + public static boolean isTreesSmart() + { + return gameSettings.ofTrees == 4; + } + + public static boolean isCullFacesLeaves() + { + return gameSettings.ofTrees == 0 ? !gameSettings.fancyGraphics : gameSettings.ofTrees == 4; + } + + public static boolean isDroppedItemsFancy() + { + return gameSettings.ofDroppedItems == 0 ? gameSettings.fancyGraphics : gameSettings.ofDroppedItems == 2; + } + + public static int limit(int p_limit_0_, int p_limit_1_, int p_limit_2_) + { + return p_limit_0_ < p_limit_1_ ? p_limit_1_ : (p_limit_0_ > p_limit_2_ ? p_limit_2_ : p_limit_0_); + } + + public static float limit(float p_limit_0_, float p_limit_1_, float p_limit_2_) + { + return p_limit_0_ < p_limit_1_ ? p_limit_1_ : (p_limit_0_ > p_limit_2_ ? p_limit_2_ : p_limit_0_); + } + + public static double limit(double p_limit_0_, double p_limit_2_, double p_limit_4_) + { + return p_limit_0_ < p_limit_2_ ? p_limit_2_ : (p_limit_0_ > p_limit_4_ ? p_limit_4_ : p_limit_0_); + } + + public static float limitTo1(float p_limitTo1_0_) + { + return p_limitTo1_0_ < 0.0F ? 0.0F : (p_limitTo1_0_ > 1.0F ? 1.0F : p_limitTo1_0_); + } + + public static boolean isAnimatedWater() + { + return gameSettings.ofAnimatedWater != 2; + } + + public static boolean isGeneratedWater() + { + return gameSettings.ofAnimatedWater == 1; + } + + public static boolean isAnimatedPortal() + { + return gameSettings.ofAnimatedPortal; + } + + public static boolean isAnimatedLava() + { + return gameSettings.ofAnimatedLava != 2; + } + + public static boolean isGeneratedLava() + { + return gameSettings.ofAnimatedLava == 1; + } + + public static boolean isAnimatedFire() + { + return gameSettings.ofAnimatedFire; + } + + public static boolean isAnimatedRedstone() + { + return gameSettings.ofAnimatedRedstone; + } + + public static boolean isAnimatedExplosion() + { + return gameSettings.ofAnimatedExplosion; + } + + public static boolean isAnimatedFlame() + { + return gameSettings.ofAnimatedFlame; + } + + public static boolean isAnimatedSmoke() + { + return gameSettings.ofAnimatedSmoke; + } + + public static boolean isVoidParticles() + { + return gameSettings.ofVoidParticles; + } + + public static boolean isWaterParticles() + { + return gameSettings.ofWaterParticles; + } + + public static boolean isRainSplash() + { + return gameSettings.ofRainSplash; + } + + public static boolean isPortalParticles() + { + return gameSettings.ofPortalParticles; + } + + public static boolean isPotionParticles() + { + return gameSettings.ofPotionParticles; + } + + public static boolean isFireworkParticles() + { + return gameSettings.ofFireworkParticles; + } + + public static float getAmbientOcclusionLevel() + { + return isShaders() && Shaders.aoLevel >= 0.0F ? Shaders.aoLevel : gameSettings.ofAoLevel; + } + + public static String arrayToString(Object[] p_arrayToString_0_) + { + if (p_arrayToString_0_ == null) + { + return ""; + } + else + { + StringBuffer stringbuffer = new StringBuffer(p_arrayToString_0_.length * 5); + + for (int i = 0; i < p_arrayToString_0_.length; ++i) + { + Object object = p_arrayToString_0_[i]; + + if (i > 0) + { + stringbuffer.append(", "); + } + + stringbuffer.append(String.valueOf(object)); + } + + return stringbuffer.toString(); + } + } + + public static String arrayToString(int[] p_arrayToString_0_) + { + if (p_arrayToString_0_ == null) + { + return ""; + } + else + { + StringBuffer stringbuffer = new StringBuffer(p_arrayToString_0_.length * 5); + + for (int i = 0; i < p_arrayToString_0_.length; ++i) + { + int j = p_arrayToString_0_[i]; + + if (i > 0) + { + stringbuffer.append(", "); + } + + stringbuffer.append(String.valueOf(j)); + } + + return stringbuffer.toString(); + } + } + + public static Minecraft getMinecraft() + { + return minecraft; + } + + public static TextureManager getTextureManager() + { + return minecraft.getTextureManager(); + } + + public static IResourceManager getResourceManager() + { + return minecraft.getResourceManager(); + } + + public static InputStream getResourceStream(ResourceLocation p_getResourceStream_0_) throws IOException + { + return getResourceStream(minecraft.getResourceManager(), p_getResourceStream_0_); + } + + public static InputStream getResourceStream(IResourceManager p_getResourceStream_0_, ResourceLocation p_getResourceStream_1_) throws IOException + { + IResource iresource = p_getResourceStream_0_.getResource(p_getResourceStream_1_); + return iresource == null ? null : iresource.getInputStream(); + } + + public static IResource getResource(ResourceLocation p_getResource_0_) throws IOException + { + return minecraft.getResourceManager().getResource(p_getResource_0_); + } + + public static boolean hasResource(ResourceLocation p_hasResource_0_) + { + IResourcePack iresourcepack = getDefiningResourcePack(p_hasResource_0_); + return iresourcepack != null; + } + + public static boolean hasResource(IResourceManager p_hasResource_0_, ResourceLocation p_hasResource_1_) + { + try + { + IResource iresource = p_hasResource_0_.getResource(p_hasResource_1_); + return iresource != null; + } + catch (IOException var3) + { + return false; + } + } + + public static IResourcePack[] getResourcePacks() + { + ResourcePackRepository resourcepackrepository = minecraft.getResourcePackRepository(); + List list = resourcepackrepository.getRepositoryEntries(); + List list1 = new ArrayList(); + + for (Object resourcepackrepository$entry : list) + { + list1.add(((Entry) resourcepackrepository$entry).getResourcePack()); + } + + if (resourcepackrepository.getResourcePackInstance() != null) + { + list1.add(resourcepackrepository.getResourcePackInstance()); + } + + IResourcePack[] airesourcepack = (IResourcePack[])((IResourcePack[])list1.toArray(new IResourcePack[list1.size()])); + return airesourcepack; + } + + public static String getResourcePackNames() + { + if (minecraft.getResourcePackRepository() == null) + { + return ""; + } + else + { + IResourcePack[] airesourcepack = getResourcePacks(); + + if (airesourcepack.length <= 0) + { + return getDefaultResourcePack().getPackName(); + } + else + { + String[] astring = new String[airesourcepack.length]; + + for (int i = 0; i < airesourcepack.length; ++i) + { + astring[i] = airesourcepack[i].getPackName(); + } + + String s = arrayToString((Object[])astring); + return s; + } + } + } + + public static DefaultResourcePack getDefaultResourcePack() + { + if (defaultResourcePackLazy == null) + { + Minecraft minecraft = Minecraft.getMinecraft(); + defaultResourcePackLazy = (DefaultResourcePack)Reflector.getFieldValue(minecraft, Reflector.Minecraft_defaultResourcePack); + + if (defaultResourcePackLazy == null) + { + ResourcePackRepository resourcepackrepository = minecraft.getResourcePackRepository(); + + if (resourcepackrepository != null) + { + defaultResourcePackLazy = (DefaultResourcePack)resourcepackrepository.rprDefaultResourcePack; + } + } + } + + return defaultResourcePackLazy; + } + + public static boolean isFromDefaultResourcePack(ResourceLocation p_isFromDefaultResourcePack_0_) + { + IResourcePack iresourcepack = getDefiningResourcePack(p_isFromDefaultResourcePack_0_); + return iresourcepack == getDefaultResourcePack(); + } + + public static IResourcePack getDefiningResourcePack(ResourceLocation p_getDefiningResourcePack_0_) + { + ResourcePackRepository resourcepackrepository = minecraft.getResourcePackRepository(); + IResourcePack iresourcepack = resourcepackrepository.getResourcePackInstance(); + + if (iresourcepack != null && iresourcepack.resourceExists(p_getDefiningResourcePack_0_)) + { + return iresourcepack; + } + else + { + List list = (List)Reflector.getFieldValue(resourcepackrepository, Reflector.ResourcePackRepository_repositoryEntries); + + if (list != null) + { + for (int i = list.size() - 1; i >= 0; --i) + { + ResourcePackRepository.Entry resourcepackrepository$entry = (ResourcePackRepository.Entry)list.get(i); + IResourcePack iresourcepack1 = resourcepackrepository$entry.getResourcePack(); + + if (iresourcepack1.resourceExists(p_getDefiningResourcePack_0_)) + { + return iresourcepack1; + } + } + } + + return getDefaultResourcePack().resourceExists(p_getDefiningResourcePack_0_) ? getDefaultResourcePack() : null; + } + } + + public static RenderGlobal getRenderGlobal() + { + return minecraft.renderGlobal; + } + + public static boolean isBetterGrass() + { + return gameSettings.ofBetterGrass != 3; + } + + public static boolean isBetterGrassFancy() + { + return gameSettings.ofBetterGrass == 2; + } + + public static boolean isWeatherEnabled() + { + return gameSettings.ofWeather; + } + + public static boolean isSkyEnabled() + { + return gameSettings.ofSky; + } + + public static boolean isSunMoonEnabled() + { + return gameSettings.ofSunMoon; + } + + public static boolean isSunTexture() + { + return !isSunMoonEnabled() ? false : !isShaders() || Shaders.isSun(); + } + + public static boolean isMoonTexture() + { + return !isSunMoonEnabled() ? false : !isShaders() || Shaders.isMoon(); + } + + public static boolean isVignetteEnabled() + { + return isShaders() && !Shaders.isVignette() ? false : (gameSettings.ofVignette == 0 ? gameSettings.fancyGraphics : gameSettings.ofVignette == 2); + } + + public static boolean isStarsEnabled() + { + return gameSettings.ofStars; + } + + public static void sleep(long p_sleep_0_) + { + try + { + Thread.sleep(p_sleep_0_); + } + catch (InterruptedException interruptedexception) + { + interruptedexception.printStackTrace(); + } + } + + public static boolean isTimeDayOnly() + { + return gameSettings.ofTime == 1; + } + + public static boolean isTimeDefault() + { + return gameSettings.ofTime == 0; + } + + public static boolean isTimeNightOnly() + { + return gameSettings.ofTime == 2; + } + + public static boolean isClearWater() + { + return gameSettings.ofClearWater; + } + + public static int getAnisotropicFilterLevel() + { + return gameSettings.ofAfLevel; + } + + public static boolean isAnisotropicFiltering() + { + return getAnisotropicFilterLevel() > 1; + } + + public static int getAntialiasingLevel() + { + return antialiasingLevel; + } + + public static boolean isAntialiasing() + { + return getAntialiasingLevel() > 0; + } + + public static boolean isAntialiasingConfigured() + { + return getGameSettings().ofAaLevel > 0; + } + + public static boolean isMultiTexture() + { + return getAnisotropicFilterLevel() > 1 ? true : getAntialiasingLevel() > 0; + } + + public static boolean between(int p_between_0_, int p_between_1_, int p_between_2_) + { + return p_between_0_ >= p_between_1_ && p_between_0_ <= p_between_2_; + } + + public static boolean isDrippingWaterLava() + { + return gameSettings.ofDrippingWaterLava; + } + + public static boolean isBetterSnow() + { + return gameSettings.ofBetterSnow; + } + + public static Dimension getFullscreenDimension() + { + if (desktopDisplayMode == null) + { + return null; + } + else if (gameSettings == null) + { + return new Dimension(desktopDisplayMode.getWidth(), desktopDisplayMode.getHeight()); + } + else + { + String s = gameSettings.ofFullscreenMode; + + if (s.equals("Default")) + { + return new Dimension(desktopDisplayMode.getWidth(), desktopDisplayMode.getHeight()); + } + else + { + String[] astring = tokenize(s, " x"); + return astring.length < 2 ? new Dimension(desktopDisplayMode.getWidth(), desktopDisplayMode.getHeight()) : new Dimension(parseInt(astring[0], -1), parseInt(astring[1], -1)); + } + } + } + + public static int parseInt(String p_parseInt_0_, int p_parseInt_1_) + { + try + { + if (p_parseInt_0_ == null) + { + return p_parseInt_1_; + } + else + { + p_parseInt_0_ = p_parseInt_0_.trim(); + return Integer.parseInt(p_parseInt_0_); + } + } + catch (NumberFormatException var3) + { + return p_parseInt_1_; + } + } + + public static float parseFloat(String p_parseFloat_0_, float p_parseFloat_1_) + { + try + { + if (p_parseFloat_0_ == null) + { + return p_parseFloat_1_; + } + else + { + p_parseFloat_0_ = p_parseFloat_0_.trim(); + return Float.parseFloat(p_parseFloat_0_); + } + } + catch (NumberFormatException var3) + { + return p_parseFloat_1_; + } + } + + public static boolean parseBoolean(String p_parseBoolean_0_, boolean p_parseBoolean_1_) + { + try + { + if (p_parseBoolean_0_ == null) + { + return p_parseBoolean_1_; + } + else + { + p_parseBoolean_0_ = p_parseBoolean_0_.trim(); + return Boolean.parseBoolean(p_parseBoolean_0_); + } + } + catch (NumberFormatException var3) + { + return p_parseBoolean_1_; + } + } + + public static String[] tokenize(String p_tokenize_0_, String p_tokenize_1_) + { + StringTokenizer stringtokenizer = new StringTokenizer(p_tokenize_0_, p_tokenize_1_); + List list = new ArrayList(); + + while (stringtokenizer.hasMoreTokens()) + { + String s = stringtokenizer.nextToken(); + list.add(s); + } + + String[] astring = (String[])((String[])list.toArray(new String[list.size()])); + return astring; + } + + public static DisplayMode getDesktopDisplayMode() + { + return desktopDisplayMode; + } + + public static DisplayMode[] getDisplayModes() + { + if (displayModes == null) + { + try + { + DisplayMode[] adisplaymode = Display.getAvailableDisplayModes(); + Set set = getDisplayModeDimensions(adisplaymode); + List list = new ArrayList(); + + for (Dimension dimension : set) + { + DisplayMode[] adisplaymode1 = getDisplayModes(adisplaymode, dimension); + DisplayMode displaymode = getDisplayMode(adisplaymode1, desktopDisplayMode); + + if (displaymode != null) + { + list.add(displaymode); + } + } + + DisplayMode[] adisplaymode2 = (DisplayMode[])((DisplayMode[])list.toArray(new DisplayMode[list.size()])); + Arrays.sort(adisplaymode2, new DisplayModeComparator()); + return adisplaymode2; + } + catch (Exception exception) + { + exception.printStackTrace(); + displayModes = new DisplayMode[] {desktopDisplayMode}; + } + } + + return displayModes; + } + + public static DisplayMode getLargestDisplayMode() + { + DisplayMode[] adisplaymode = getDisplayModes(); + + if (adisplaymode != null && adisplaymode.length >= 1) + { + DisplayMode displaymode = adisplaymode[adisplaymode.length - 1]; + return desktopDisplayMode.getWidth() > displaymode.getWidth() ? desktopDisplayMode : (desktopDisplayMode.getWidth() == displaymode.getWidth() && desktopDisplayMode.getHeight() > displaymode.getHeight() ? desktopDisplayMode : displaymode); + } + else + { + return desktopDisplayMode; + } + } + + private static Set getDisplayModeDimensions(DisplayMode[] p_getDisplayModeDimensions_0_) + { + Set set = new HashSet(); + + for (int i = 0; i < p_getDisplayModeDimensions_0_.length; ++i) + { + DisplayMode displaymode = p_getDisplayModeDimensions_0_[i]; + Dimension dimension = new Dimension(displaymode.getWidth(), displaymode.getHeight()); + set.add(dimension); + } + + return set; + } + + private static DisplayMode[] getDisplayModes(DisplayMode[] p_getDisplayModes_0_, Dimension p_getDisplayModes_1_) + { + List list = new ArrayList(); + + for (int i = 0; i < p_getDisplayModes_0_.length; ++i) + { + DisplayMode displaymode = p_getDisplayModes_0_[i]; + + if ((double)displaymode.getWidth() == p_getDisplayModes_1_.getWidth() && (double)displaymode.getHeight() == p_getDisplayModes_1_.getHeight()) + { + list.add(displaymode); + } + } + + DisplayMode[] adisplaymode = (DisplayMode[])((DisplayMode[])list.toArray(new DisplayMode[list.size()])); + return adisplaymode; + } + + private static DisplayMode getDisplayMode(DisplayMode[] p_getDisplayMode_0_, DisplayMode p_getDisplayMode_1_) + { + if (p_getDisplayMode_1_ != null) + { + for (int i = 0; i < p_getDisplayMode_0_.length; ++i) + { + DisplayMode displaymode = p_getDisplayMode_0_[i]; + + if (displaymode.getBitsPerPixel() == p_getDisplayMode_1_.getBitsPerPixel() && displaymode.getFrequency() == p_getDisplayMode_1_.getFrequency()) + { + return displaymode; + } + } + } + + if (p_getDisplayMode_0_.length <= 0) + { + return null; + } + else + { + Arrays.sort(p_getDisplayMode_0_, new DisplayModeComparator()); + return p_getDisplayMode_0_[p_getDisplayMode_0_.length - 1]; + } + } + + public static String[] getDisplayModeNames() + { + DisplayMode[] adisplaymode = getDisplayModes(); + String[] astring = new String[adisplaymode.length]; + + for (int i = 0; i < adisplaymode.length; ++i) + { + DisplayMode displaymode = adisplaymode[i]; + String s = "" + displaymode.getWidth() + "x" + displaymode.getHeight(); + astring[i] = s; + } + + return astring; + } + + public static DisplayMode getDisplayMode(Dimension p_getDisplayMode_0_) throws LWJGLException + { + DisplayMode[] adisplaymode = getDisplayModes(); + + for (int i = 0; i < adisplaymode.length; ++i) + { + DisplayMode displaymode = adisplaymode[i]; + + if (displaymode.getWidth() == p_getDisplayMode_0_.width && displaymode.getHeight() == p_getDisplayMode_0_.height) + { + return displaymode; + } + } + + return desktopDisplayMode; + } + + public static boolean isAnimatedTerrain() + { + return gameSettings.ofAnimatedTerrain; + } + + public static boolean isAnimatedTextures() + { + return gameSettings.ofAnimatedTextures; + } + + public static boolean isSwampColors() + { + return gameSettings.ofSwampColors; + } + + public static boolean isRandomMobs() + { + return gameSettings.ofRandomMobs; + } + + public static void checkGlError(String p_checkGlError_0_) + { + int i = GL11.glGetError(); + + if (i != 0) + { + String s = GLU.gluErrorString(i); + error("OpenGlError: " + i + " (" + s + "), at: " + p_checkGlError_0_); + } + } + + public static boolean isSmoothBiomes() + { + return gameSettings.ofSmoothBiomes; + } + + public static boolean isCustomColors() + { + return gameSettings.ofCustomColors; + } + + public static boolean isCustomSky() + { + return gameSettings.ofCustomSky; + } + + public static boolean isCustomFonts() + { + return gameSettings.ofCustomFonts; + } + + public static boolean isShowCapes() + { + return gameSettings.ofShowCapes; + } + + public static boolean isConnectedTextures() + { + return gameSettings.ofConnectedTextures != 3; + } + + public static boolean isNaturalTextures() + { + return gameSettings.ofNaturalTextures; + } + + public static boolean isConnectedTexturesFancy() + { + return gameSettings.ofConnectedTextures == 2; + } + + public static boolean isFastRender() + { + return gameSettings.ofFastRender; + } + + public static boolean isTranslucentBlocksFancy() + { + return gameSettings.ofTranslucentBlocks == 0 ? gameSettings.fancyGraphics : gameSettings.ofTranslucentBlocks == 2; + } + + public static boolean isShaders() + { + return Shaders.shaderPackLoaded; + } + + public static String[] readLines(File p_readLines_0_) throws IOException + { + FileInputStream fileinputstream = new FileInputStream(p_readLines_0_); + return readLines((InputStream)fileinputstream); + } + + public static String[] readLines(InputStream p_readLines_0_) throws IOException + { + List list = new ArrayList(); + InputStreamReader inputstreamreader = new InputStreamReader(p_readLines_0_, "ASCII"); + BufferedReader bufferedreader = new BufferedReader(inputstreamreader); + + while (true) + { + String s = bufferedreader.readLine(); + + if (s == null) + { + String[] astring = (String[])((String[])list.toArray(new String[list.size()])); + return astring; + } + + list.add(s); + } + } + + public static String readFile(File p_readFile_0_) throws IOException + { + FileInputStream fileinputstream = new FileInputStream(p_readFile_0_); + return readInputStream(fileinputstream, "ASCII"); + } + + public static String readInputStream(InputStream p_readInputStream_0_) throws IOException + { + return readInputStream(p_readInputStream_0_, "ASCII"); + } + + public static String readInputStream(InputStream p_readInputStream_0_, String p_readInputStream_1_) throws IOException + { + InputStreamReader inputstreamreader = new InputStreamReader(p_readInputStream_0_, p_readInputStream_1_); + BufferedReader bufferedreader = new BufferedReader(inputstreamreader); + StringBuffer stringbuffer = new StringBuffer(); + + while (true) + { + String s = bufferedreader.readLine(); + + if (s == null) + { + return stringbuffer.toString(); + } + + stringbuffer.append(s); + stringbuffer.append("\n"); + } + } + + public static byte[] readAll(InputStream p_readAll_0_) throws IOException + { + ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); + byte[] abyte = new byte[1024]; + + while (true) + { + int i = p_readAll_0_.read(abyte); + + if (i < 0) + { + p_readAll_0_.close(); + byte[] abyte1 = bytearrayoutputstream.toByteArray(); + return abyte1; + } + + bytearrayoutputstream.write(abyte, 0, i); + } + } + + public static GameSettings getGameSettings() + { + return gameSettings; + } + + public static String getNewRelease() + { + return newRelease; + } + + public static void setNewRelease(String p_setNewRelease_0_) + { + newRelease = p_setNewRelease_0_; + } + + public static int compareRelease(String p_compareRelease_0_, String p_compareRelease_1_) + { + String[] astring = splitRelease(p_compareRelease_0_); + String[] astring1 = splitRelease(p_compareRelease_1_); + String s = astring[0]; + String s1 = astring1[0]; + + if (!s.equals(s1)) + { + return s.compareTo(s1); + } + else + { + int i = parseInt(astring[1], -1); + int j = parseInt(astring1[1], -1); + + if (i != j) + { + return i - j; + } + else + { + String s2 = astring[2]; + String s3 = astring1[2]; + + if (!s2.equals(s3)) + { + if (s2.isEmpty()) + { + return 1; + } + + if (s3.isEmpty()) + { + return -1; + } + } + + return s2.compareTo(s3); + } + } + } + + private static String[] splitRelease(String p_splitRelease_0_) + { + if (p_splitRelease_0_ != null && p_splitRelease_0_.length() > 0) + { + Pattern pattern = Pattern.compile("([A-Z])([0-9]+)(.*)"); + Matcher matcher = pattern.matcher(p_splitRelease_0_); + + if (!matcher.matches()) + { + return new String[] {"", "", ""}; + } + else + { + String s = normalize(matcher.group(1)); + String s1 = normalize(matcher.group(2)); + String s2 = normalize(matcher.group(3)); + return new String[] {s, s1, s2}; + } + } + else + { + return new String[] {"", "", ""}; + } + } + + public static int intHash(int p_intHash_0_) + { + p_intHash_0_ = p_intHash_0_ ^ 61 ^ p_intHash_0_ >> 16; + p_intHash_0_ = p_intHash_0_ + (p_intHash_0_ << 3); + p_intHash_0_ = p_intHash_0_ ^ p_intHash_0_ >> 4; + p_intHash_0_ = p_intHash_0_ * 668265261; + p_intHash_0_ = p_intHash_0_ ^ p_intHash_0_ >> 15; + return p_intHash_0_; + } + + public static int getRandom(BlockPos p_getRandom_0_, int p_getRandom_1_) + { + int i = intHash(p_getRandom_1_ + 37); + i = intHash(i + p_getRandom_0_.getX()); + i = intHash(i + p_getRandom_0_.getZ()); + i = intHash(i + p_getRandom_0_.getY()); + return i; + } + + public static WorldServer getWorldServer() + { + World world = minecraft.theWorld; + + if (world == null) + { + return null; + } + else if (!minecraft.isIntegratedServerRunning()) + { + return null; + } + else + { + IntegratedServer integratedserver = minecraft.getIntegratedServer(); + + if (integratedserver == null) + { + return null; + } + else + { + WorldProvider worldprovider = world.provider; + + if (worldprovider == null) + { + return null; + } + else + { + int i = worldprovider.getDimensionId(); + + try + { + WorldServer worldserver = integratedserver.worldServerForDimension(i); + return worldserver; + } + catch (NullPointerException var5) + { + return null; + } + } + } + } + } + + public static int getAvailableProcessors() + { + return availableProcessors; + } + + public static void updateAvailableProcessors() + { + availableProcessors = Runtime.getRuntime().availableProcessors(); + } + + public static boolean isSingleProcessor() + { + return getAvailableProcessors() <= 1; + } + + public static boolean isSmoothWorld() + { + return gameSettings.ofSmoothWorld; + } + + public static boolean isLazyChunkLoading() + { + return !isSingleProcessor() ? false : gameSettings.ofLazyChunkLoading; + } + + public static boolean isDynamicFov() + { + return gameSettings.ofDynamicFov; + } + + public static boolean isAlternateBlocks() + { + return gameSettings.allowBlockAlternatives; + } + + public static int getChunkViewDistance() + { + if (gameSettings == null) + { + return 10; + } + else + { + int i = gameSettings.renderDistanceChunks; + return i; + } + } + + public static boolean equals(Object p_equals_0_, Object p_equals_1_) + { + return p_equals_0_ == p_equals_1_ ? true : (p_equals_0_ == null ? false : p_equals_0_.equals(p_equals_1_)); + } + + public static boolean equalsOne(Object p_equalsOne_0_, Object[] p_equalsOne_1_) + { + if (p_equalsOne_1_ == null) + { + return false; + } + else + { + for (int i = 0; i < p_equalsOne_1_.length; ++i) + { + Object object = p_equalsOne_1_[i]; + + if (equals(p_equalsOne_0_, object)) + { + return true; + } + } + + return false; + } + } + + public static boolean isSameOne(Object p_isSameOne_0_, Object[] p_isSameOne_1_) + { + if (p_isSameOne_1_ == null) + { + return false; + } + else + { + for (int i = 0; i < p_isSameOne_1_.length; ++i) + { + Object object = p_isSameOne_1_[i]; + + if (p_isSameOne_0_ == object) + { + return true; + } + } + + return false; + } + } + + public static String normalize(String p_normalize_0_) + { + return p_normalize_0_ == null ? "" : p_normalize_0_; + } + + public static void checkDisplaySettings() + { + int i = getAntialiasingLevel(); + + if (i > 0) + { + DisplayMode displaymode = Display.getDisplayMode(); + dbg("FSAA Samples: " + i); + + try + { + Display.destroy(); + Display.setDisplayMode(displaymode); + Display.create((new PixelFormat()).withDepthBits(24).withSamples(i)); + Display.setResizable(false); + Display.setResizable(true); + } + catch (LWJGLException lwjglexception2) + { + warn("Error setting FSAA: " + i + "x"); + lwjglexception2.printStackTrace(); + + try + { + Display.setDisplayMode(displaymode); + Display.create((new PixelFormat()).withDepthBits(24)); + Display.setResizable(false); + Display.setResizable(true); + } + catch (LWJGLException lwjglexception1) + { + lwjglexception1.printStackTrace(); + + try + { + Display.setDisplayMode(displaymode); + Display.create(); + Display.setResizable(false); + Display.setResizable(true); + } + catch (LWJGLException lwjglexception) + { + lwjglexception.printStackTrace(); + } + } + } + + if (!Minecraft.isRunningOnMac && getDefaultResourcePack() != null) + { + InputStream inputstream = null; + InputStream inputstream1 = null; + + try + { + inputstream = getDefaultResourcePack().getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png")); + inputstream1 = getDefaultResourcePack().getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png")); + + if (inputstream != null && inputstream1 != null) + { + Display.setIcon(new ByteBuffer[] {readIconImage(inputstream), readIconImage(inputstream1)}); + } + } + catch (IOException ioexception) + { + warn("Error setting window icon: " + ioexception.getClass().getName() + ": " + ioexception.getMessage()); + } + finally + { + IOUtils.closeQuietly(inputstream); + IOUtils.closeQuietly(inputstream1); + } + } + } + } + + private static ByteBuffer readIconImage(InputStream p_readIconImage_0_) throws IOException + { + BufferedImage bufferedimage = ImageIO.read(p_readIconImage_0_); + int[] aint = bufferedimage.getRGB(0, 0, bufferedimage.getWidth(), bufferedimage.getHeight(), (int[])null, 0, bufferedimage.getWidth()); + ByteBuffer bytebuffer = ByteBuffer.allocate(4 * aint.length); + + for (int i : aint) + { + bytebuffer.putInt(i << 8 | i >> 24 & 255); + } + + bytebuffer.flip(); + return bytebuffer; + } + + public static void checkDisplayMode() + { + try + { + if (minecraft.isFullScreen()) + { + if (fullscreenModeChecked) + { + return; + } + + fullscreenModeChecked = true; + desktopModeChecked = false; + DisplayMode displaymode = Display.getDisplayMode(); + Dimension dimension = getFullscreenDimension(); + + if (dimension == null) + { + return; + } + + if (displaymode.getWidth() == dimension.width && displaymode.getHeight() == dimension.height) + { + return; + } + + DisplayMode displaymode1 = getDisplayMode(dimension); + + if (displaymode1 == null) + { + return; + } + + Display.setDisplayMode(displaymode1); + minecraft.displayWidth = Display.getDisplayMode().getWidth(); + minecraft.displayHeight = Display.getDisplayMode().getHeight(); + + if (minecraft.displayWidth <= 0) + { + minecraft.displayWidth = 1; + } + + if (minecraft.displayHeight <= 0) + { + minecraft.displayHeight = 1; + } + + if (minecraft.currentScreen != null) + { + ScaledResolution scaledresolution = new ScaledResolution(minecraft); + int i = scaledresolution.getScaledWidth(); + int j = scaledresolution.getScaledHeight(); + minecraft.currentScreen.setWorldAndResolution(minecraft, i, j); + } + + minecraft.loadingScreen = new LoadingScreenRenderer(minecraft); + updateFramebufferSize(); + Display.setFullscreen(true); + minecraft.gameSettings.updateVSync(); + GlStateManager.enableTexture2D(); + } + else + { + if (desktopModeChecked) + { + return; + } + + desktopModeChecked = true; + fullscreenModeChecked = false; + minecraft.gameSettings.updateVSync(); + Display.update(); + GlStateManager.enableTexture2D(); + Display.setResizable(false); + Display.setResizable(true); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + gameSettings.ofFullscreenMode = "Default"; + gameSettings.saveOfOptions(); + } + } + + public static void updateFramebufferSize() + { + minecraft.getFramebuffer().createBindFramebuffer(minecraft.displayWidth, minecraft.displayHeight); + + if (minecraft.entityRenderer != null) + { + minecraft.entityRenderer.updateShaderGroupSize(minecraft.displayWidth, minecraft.displayHeight); + } + } + + public static Object[] addObjectToArray(Object[] p_addObjectToArray_0_, Object p_addObjectToArray_1_) + { + if (p_addObjectToArray_0_ == null) + { + throw new NullPointerException("The given array is NULL"); + } + else + { + int i = p_addObjectToArray_0_.length; + int j = i + 1; + Object[] aobject = (Object[])((Object[])Array.newInstance(p_addObjectToArray_0_.getClass().getComponentType(), j)); + System.arraycopy(p_addObjectToArray_0_, 0, aobject, 0, i); + aobject[i] = p_addObjectToArray_1_; + return aobject; + } + } + + public static Object[] addObjectToArray(Object[] p_addObjectToArray_0_, Object p_addObjectToArray_1_, int p_addObjectToArray_2_) + { + List list = new ArrayList(Arrays.asList(p_addObjectToArray_0_)); + list.add(p_addObjectToArray_2_, p_addObjectToArray_1_); + Object[] aobject = (Object[])((Object[])Array.newInstance(p_addObjectToArray_0_.getClass().getComponentType(), list.size())); + return list.toArray(aobject); + } + + public static Object[] addObjectsToArray(Object[] p_addObjectsToArray_0_, Object[] p_addObjectsToArray_1_) + { + if (p_addObjectsToArray_0_ == null) + { + throw new NullPointerException("The given array is NULL"); + } + else if (p_addObjectsToArray_1_.length == 0) + { + return p_addObjectsToArray_0_; + } + else + { + int i = p_addObjectsToArray_0_.length; + int j = i + p_addObjectsToArray_1_.length; + Object[] aobject = (Object[])((Object[])Array.newInstance(p_addObjectsToArray_0_.getClass().getComponentType(), j)); + System.arraycopy(p_addObjectsToArray_0_, 0, aobject, 0, i); + System.arraycopy(p_addObjectsToArray_1_, 0, aobject, i, p_addObjectsToArray_1_.length); + return aobject; + } + } + + public static boolean isCustomItems() + { + return gameSettings.ofCustomItems; + } + + public static void drawFps() + { + int i = Minecraft.getDebugFPS(); + String s = getUpdates(minecraft.debug); + int j = minecraft.renderGlobal.getCountActiveRenderers(); + int k = minecraft.renderGlobal.getCountEntitiesRendered(); + int l = minecraft.renderGlobal.getCountTileEntitiesRendered(); + String s1 = "" + i + " fps, C: " + j + ", E: " + k + "+" + l + ", U: " + s; + minecraft.fontRendererObj.drawString(s1, 2, 2, -2039584); + } + + private static String getUpdates(String p_getUpdates_0_) + { + int i = p_getUpdates_0_.indexOf(40); + + if (i < 0) + { + return ""; + } + else + { + int j = p_getUpdates_0_.indexOf(32, i); + return j < 0 ? "" : p_getUpdates_0_.substring(i + 1, j); + } + } + + public static int getBitsOs() + { + String s = System.getenv("ProgramFiles(X86)"); + return s != null ? 64 : 32; + } + + public static int getBitsJre() + { + String[] astring = new String[] {"sun.arch.data.model", "com.ibm.vm.bitmode", "os.arch"}; + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + String s1 = System.getProperty(s); + + if (s1 != null && s1.contains("64")) + { + return 64; + } + } + + return 32; + } + + public static boolean isNotify64BitJava() + { + return notify64BitJava; + } + + public static void setNotify64BitJava(boolean p_setNotify64BitJava_0_) + { + notify64BitJava = p_setNotify64BitJava_0_; + } + + public static boolean isConnectedModels() + { + return false; + } + + public static void showGuiMessage(String p_showGuiMessage_0_, String p_showGuiMessage_1_) + { + GuiMessage guimessage = new GuiMessage(minecraft.currentScreen, p_showGuiMessage_0_, p_showGuiMessage_1_); + minecraft.displayGuiScreen(guimessage); + } + + public static int[] addIntToArray(int[] p_addIntToArray_0_, int p_addIntToArray_1_) + { + return addIntsToArray(p_addIntToArray_0_, new int[] {p_addIntToArray_1_}); + } + + public static int[] addIntsToArray(int[] p_addIntsToArray_0_, int[] p_addIntsToArray_1_) + { + if (p_addIntsToArray_0_ != null && p_addIntsToArray_1_ != null) + { + int i = p_addIntsToArray_0_.length; + int j = i + p_addIntsToArray_1_.length; + int[] aint = new int[j]; + System.arraycopy(p_addIntsToArray_0_, 0, aint, 0, i); + + for (int k = 0; k < p_addIntsToArray_1_.length; ++k) + { + aint[k + i] = p_addIntsToArray_1_[k]; + } + + return aint; + } + else + { + throw new NullPointerException("The given array is NULL"); + } + } + + public static DynamicTexture getMojangLogoTexture(DynamicTexture p_getMojangLogoTexture_0_) + { + try + { + ResourceLocation resourcelocation = new ResourceLocation("textures/gui/title/mojang.png"); + InputStream inputstream = getResourceStream(resourcelocation); + + if (inputstream == null) + { + return p_getMojangLogoTexture_0_; + } + else + { + BufferedImage bufferedimage = ImageIO.read(inputstream); + + if (bufferedimage == null) + { + return p_getMojangLogoTexture_0_; + } + else + { + DynamicTexture dynamictexture = new DynamicTexture(bufferedimage); + return dynamictexture; + } + } + } + catch (Exception exception) + { + warn(exception.getClass().getName() + ": " + exception.getMessage()); + return p_getMojangLogoTexture_0_; + } + } + + public static void writeFile(File p_writeFile_0_, String p_writeFile_1_) throws IOException + { + FileOutputStream fileoutputstream = new FileOutputStream(p_writeFile_0_); + byte[] abyte = p_writeFile_1_.getBytes("ASCII"); + fileoutputstream.write(abyte); + fileoutputstream.close(); + } + + public static TextureMap getTextureMap() + { + return getMinecraft().getTextureMapBlocks(); + } + + public static boolean isDynamicLights() + { + return gameSettings.ofDynamicLights != 3; + } + + public static boolean isDynamicLightsFast() + { + return gameSettings.ofDynamicLights == 1; + } + + public static boolean isDynamicHandLight() + { + return !isDynamicLights() ? false : (isShaders() ? Shaders.isDynamicHandLight() : true); + } +} diff --git a/src/minecraft/optifine/ConnectedParser.java b/src/minecraft/optifine/ConnectedParser.java new file mode 100644 index 0000000..09c015a --- /dev/null +++ b/src/minecraft/optifine/ConnectedParser.java @@ -0,0 +1,792 @@ +package optifine; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDoublePlant; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.biome.BiomeGenBase; + +public class ConnectedParser +{ + private String context = null; + private static final MatchBlock[] NO_MATCH_BLOCKS = new MatchBlock[0]; + + public ConnectedParser(String p_i31_1_) + { + this.context = p_i31_1_; + } + + public String parseName(String p_parseName_1_) + { + String s = p_parseName_1_; + int i = p_parseName_1_.lastIndexOf(47); + + if (i >= 0) + { + s = p_parseName_1_.substring(i + 1); + } + + int j = s.lastIndexOf(46); + + if (j >= 0) + { + s = s.substring(0, j); + } + + return s; + } + + public String parseBasePath(String p_parseBasePath_1_) + { + int i = p_parseBasePath_1_.lastIndexOf(47); + return i < 0 ? "" : p_parseBasePath_1_.substring(0, i); + } + + public MatchBlock[] parseMatchBlocks(String p_parseMatchBlocks_1_) + { + if (p_parseMatchBlocks_1_ == null) + { + return null; + } + else + { + List list = new ArrayList(); + String[] astring = Config.tokenize(p_parseMatchBlocks_1_, " "); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + MatchBlock[] amatchblock = this.parseMatchBlock(s); + + if (amatchblock == null) + { + return NO_MATCH_BLOCKS; + } + + list.addAll(Arrays.asList(amatchblock)); + } + + MatchBlock[] amatchblock1 = (MatchBlock[])((MatchBlock[])list.toArray(new MatchBlock[list.size()])); + return amatchblock1; + } + } + + public MatchBlock[] parseMatchBlock(String p_parseMatchBlock_1_) + { + if (p_parseMatchBlock_1_ == null) + { + return null; + } + else + { + p_parseMatchBlock_1_ = p_parseMatchBlock_1_.trim(); + + if (p_parseMatchBlock_1_.length() <= 0) + { + return null; + } + else + { + String[] astring = Config.tokenize(p_parseMatchBlock_1_, ":"); + String s = "minecraft"; + int i = 0; + + if (astring.length > 1 && this.isFullBlockName(astring)) + { + s = astring[0]; + i = 1; + } + else + { + s = "minecraft"; + i = 0; + } + + String s1 = astring[i]; + String[] astring1 = (String[])Arrays.copyOfRange(astring, i + 1, astring.length); + Block[] ablock = this.parseBlockPart(s, s1); + + if (ablock == null) + { + return null; + } + else + { + MatchBlock[] amatchblock = new MatchBlock[ablock.length]; + + for (int j = 0; j < ablock.length; ++j) + { + Block block = ablock[j]; + int k = Block.getIdFromBlock(block); + int[] aint = null; + + if (astring1.length > 0) + { + aint = this.parseBlockMetadatas(block, astring1); + + if (aint == null) + { + return null; + } + } + + MatchBlock matchblock = new MatchBlock(k, aint); + amatchblock[j] = matchblock; + } + + return amatchblock; + } + } + } + } + + public boolean isFullBlockName(String[] p_isFullBlockName_1_) + { + if (p_isFullBlockName_1_.length < 2) + { + return false; + } + else + { + String s = p_isFullBlockName_1_[1]; + return s.length() < 1 ? false : (this.startsWithDigit(s) ? false : !s.contains("=")); + } + } + + public boolean startsWithDigit(String p_startsWithDigit_1_) + { + if (p_startsWithDigit_1_ == null) + { + return false; + } + else if (p_startsWithDigit_1_.length() < 1) + { + return false; + } + else + { + char c0 = p_startsWithDigit_1_.charAt(0); + return Character.isDigit(c0); + } + } + + public Block[] parseBlockPart(String p_parseBlockPart_1_, String p_parseBlockPart_2_) + { + if (this.startsWithDigit(p_parseBlockPart_2_)) + { + int[] aint = this.parseIntList(p_parseBlockPart_2_); + + if (aint == null) + { + return null; + } + else + { + Block[] ablock1 = new Block[aint.length]; + + for (int j = 0; j < aint.length; ++j) + { + int i = aint[j]; + Block block1 = Block.getBlockById(i); + + if (block1 == null) + { + this.warn("Block not found for id: " + i); + return null; + } + + ablock1[j] = block1; + } + + return ablock1; + } + } + else + { + String s = p_parseBlockPart_1_ + ":" + p_parseBlockPart_2_; + Block block = Block.getBlockFromName(s); + + if (block == null) + { + this.warn("Block not found for name: " + s); + return null; + } + else + { + Block[] ablock = new Block[] {block}; + return ablock; + } + } + } + + public int[] parseBlockMetadatas(Block p_parseBlockMetadatas_1_, String[] p_parseBlockMetadatas_2_) + { + if (p_parseBlockMetadatas_2_.length <= 0) + { + return null; + } + else + { + String s = p_parseBlockMetadatas_2_[0]; + + if (this.startsWithDigit(s)) + { + int[] aint = this.parseIntList(s); + return aint; + } + else + { + IBlockState iblockstate = p_parseBlockMetadatas_1_.getDefaultState(); + Collection collection = iblockstate.getPropertyNames(); + Map> map = new HashMap(); + + for (int i = 0; i < p_parseBlockMetadatas_2_.length; ++i) + { + String s1 = p_parseBlockMetadatas_2_[i]; + + if (s1.length() > 0) + { + String[] astring = Config.tokenize(s1, "="); + + if (astring.length != 2) + { + this.warn("Invalid block property: " + s1); + return null; + } + + String s2 = astring[0]; + String s3 = astring[1]; + IProperty iproperty = ConnectedProperties.getProperty(s2, collection); + + if (iproperty == null) + { + this.warn("Property not found: " + s2 + ", block: " + p_parseBlockMetadatas_1_); + return null; + } + + List list = (List)map.get(s2); + + if (list == null) + { + list = new ArrayList(); + map.put(iproperty, list); + } + + String[] astring1 = Config.tokenize(s3, ","); + + for (int j = 0; j < astring1.length; ++j) + { + String s4 = astring1[j]; + Comparable comparable = parsePropertyValue(iproperty, s4); + + if (comparable == null) + { + this.warn("Property value not found: " + s4 + ", property: " + s2 + ", block: " + p_parseBlockMetadatas_1_); + return null; + } + + list.add(comparable); + } + } + } + + if (map.isEmpty()) + { + return null; + } + else + { + List list1 = new ArrayList(); + + for (int k = 0; k < 16; ++k) + { + int l = k; + + try + { + IBlockState iblockstate1 = this.getStateFromMeta(p_parseBlockMetadatas_1_, l); + + if (this.matchState(iblockstate1, map)) + { + list1.add(Integer.valueOf(l)); + } + } + catch (IllegalArgumentException var18) + { + ; + } + } + + if (list1.size() == 16) + { + return null; + } + else + { + int[] aint1 = new int[list1.size()]; + + for (int i1 = 0; i1 < aint1.length; ++i1) + { + aint1[i1] = ((Integer)list1.get(i1)).intValue(); + } + + return aint1; + } + } + } + } + } + + private IBlockState getStateFromMeta(Block p_getStateFromMeta_1_, int p_getStateFromMeta_2_) + { + try + { + IBlockState iblockstate = p_getStateFromMeta_1_.getStateFromMeta(p_getStateFromMeta_2_); + + if (p_getStateFromMeta_1_ == Blocks.double_plant && p_getStateFromMeta_2_ > 7) + { + IBlockState iblockstate1 = p_getStateFromMeta_1_.getStateFromMeta(p_getStateFromMeta_2_ & 7); + iblockstate = iblockstate.withProperty(BlockDoublePlant.VARIANT, iblockstate1.getValue(BlockDoublePlant.VARIANT)); + } + + return iblockstate; + } + catch (IllegalArgumentException var5) + { + return p_getStateFromMeta_1_.getDefaultState(); + } + } + + public static Comparable parsePropertyValue(IProperty p_parsePropertyValue_0_, String p_parsePropertyValue_1_) + { + Class oclass = p_parsePropertyValue_0_.getValueClass(); + Comparable comparable = parseValue(p_parsePropertyValue_1_, oclass); + + if (comparable == null) + { + Collection collection = p_parsePropertyValue_0_.getAllowedValues(); + comparable = getPropertyValue(p_parsePropertyValue_1_, collection); + } + + return comparable; + } + + public static Comparable getPropertyValue(String p_getPropertyValue_0_, Collection p_getPropertyValue_1_) + { + for (Object comparable : p_getPropertyValue_1_) + { + if (String.valueOf((Object)comparable).equals(p_getPropertyValue_0_)) + { + return (Comparable) comparable; + } + } + + return null; + } + + public static Comparable parseValue(String p_parseValue_0_, Class p_parseValue_1_) + { + return (Comparable)(p_parseValue_1_ == String.class ? p_parseValue_0_ : (p_parseValue_1_ == Boolean.class ? Boolean.valueOf(p_parseValue_0_) : (p_parseValue_1_ == Float.class ? Float.valueOf(p_parseValue_0_) : (p_parseValue_1_ == Double.class ? Double.valueOf(p_parseValue_0_) : (p_parseValue_1_ == Integer.class ? Integer.valueOf(p_parseValue_0_) : (p_parseValue_1_ == Long.class ? Long.valueOf(p_parseValue_0_) : null)))))); + } + + public boolean matchState(IBlockState p_matchState_1_, Map> p_matchState_2_) + { + for (IProperty iproperty : p_matchState_2_.keySet()) + { + List list = (List)p_matchState_2_.get(iproperty); + Comparable comparable = p_matchState_1_.getValue(iproperty); + + if (comparable == null) + { + return false; + } + + if (!list.contains(comparable)) + { + return false; + } + } + + return true; + } + + public BiomeGenBase[] parseBiomes(String p_parseBiomes_1_) + { + if (p_parseBiomes_1_ == null) + { + return null; + } + else + { + String[] astring = Config.tokenize(p_parseBiomes_1_, " "); + List list = new ArrayList(); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + BiomeGenBase biomegenbase = this.findBiome(s); + + if (biomegenbase == null) + { + this.warn("Biome not found: " + s); + } + else + { + list.add(biomegenbase); + } + } + + BiomeGenBase[] abiomegenbase = (BiomeGenBase[])((BiomeGenBase[])list.toArray(new BiomeGenBase[list.size()])); + return abiomegenbase; + } + } + + public BiomeGenBase findBiome(String p_findBiome_1_) + { + p_findBiome_1_ = p_findBiome_1_.toLowerCase(); + + if (p_findBiome_1_.equals("nether")) + { + return BiomeGenBase.hell; + } + else + { + BiomeGenBase[] abiomegenbase = BiomeGenBase.getBiomeGenArray(); + + for (int i = 0; i < abiomegenbase.length; ++i) + { + BiomeGenBase biomegenbase = abiomegenbase[i]; + + if (biomegenbase != null) + { + String s = biomegenbase.biomeName.replace(" ", "").toLowerCase(); + + if (s.equals(p_findBiome_1_)) + { + return biomegenbase; + } + } + } + + return null; + } + } + + public int parseInt(String p_parseInt_1_) + { + if (p_parseInt_1_ == null) + { + return -1; + } + else + { + int i = Config.parseInt(p_parseInt_1_, -1); + + if (i < 0) + { + this.warn("Invalid number: " + p_parseInt_1_); + } + + return i; + } + } + + public int parseInt(String p_parseInt_1_, int p_parseInt_2_) + { + if (p_parseInt_1_ == null) + { + return p_parseInt_2_; + } + else + { + int i = Config.parseInt(p_parseInt_1_, -1); + + if (i < 0) + { + this.warn("Invalid number: " + p_parseInt_1_); + return p_parseInt_2_; + } + else + { + return i; + } + } + } + + public int[] parseIntList(String p_parseIntList_1_) + { + if (p_parseIntList_1_ == null) + { + return null; + } + else + { + List list = new ArrayList(); + String[] astring = Config.tokenize(p_parseIntList_1_, " ,"); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + + if (s.contains("-")) + { + String[] astring1 = Config.tokenize(s, "-"); + + if (astring1.length != 2) + { + this.warn("Invalid interval: " + s + ", when parsing: " + p_parseIntList_1_); + } + else + { + int k = Config.parseInt(astring1[0], -1); + int l = Config.parseInt(astring1[1], -1); + + if (k >= 0 && l >= 0 && k <= l) + { + for (int i1 = k; i1 <= l; ++i1) + { + list.add(Integer.valueOf(i1)); + } + } + else + { + this.warn("Invalid interval: " + s + ", when parsing: " + p_parseIntList_1_); + } + } + } + else + { + int j = Config.parseInt(s, -1); + + if (j < 0) + { + this.warn("Invalid number: " + s + ", when parsing: " + p_parseIntList_1_); + } + else + { + list.add(Integer.valueOf(j)); + } + } + } + + int[] aint = new int[list.size()]; + + for (int j1 = 0; j1 < aint.length; ++j1) + { + aint[j1] = ((Integer)list.get(j1)).intValue(); + } + + return aint; + } + } + + public boolean[] parseFaces(String p_parseFaces_1_, boolean[] p_parseFaces_2_) + { + if (p_parseFaces_1_ == null) + { + return p_parseFaces_2_; + } + else + { + EnumSet enumset = EnumSet.allOf(EnumFacing.class); + String[] astring = Config.tokenize(p_parseFaces_1_, " ,"); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + + if (s.equals("sides")) + { + enumset.add(EnumFacing.NORTH); + enumset.add(EnumFacing.SOUTH); + enumset.add(EnumFacing.WEST); + enumset.add(EnumFacing.EAST); + } + else if (s.equals("all")) + { + enumset.addAll(Arrays.asList(EnumFacing.VALUES)); + } + else + { + EnumFacing enumfacing = this.parseFace(s); + + if (enumfacing != null) + { + enumset.add(enumfacing); + } + } + } + + boolean[] aboolean = new boolean[EnumFacing.VALUES.length]; + + for (int j = 0; j < aboolean.length; ++j) + { + aboolean[j] = enumset.contains(EnumFacing.VALUES[j]); + } + + return aboolean; + } + } + + public EnumFacing parseFace(String p_parseFace_1_) + { + p_parseFace_1_ = p_parseFace_1_.toLowerCase(); + + if (!p_parseFace_1_.equals("bottom") && !p_parseFace_1_.equals("down")) + { + if (!p_parseFace_1_.equals("top") && !p_parseFace_1_.equals("up")) + { + if (p_parseFace_1_.equals("north")) + { + return EnumFacing.NORTH; + } + else if (p_parseFace_1_.equals("south")) + { + return EnumFacing.SOUTH; + } + else if (p_parseFace_1_.equals("east")) + { + return EnumFacing.EAST; + } + else if (p_parseFace_1_.equals("west")) + { + return EnumFacing.WEST; + } + else + { + Config.warn("Unknown face: " + p_parseFace_1_); + return null; + } + } + else + { + return EnumFacing.UP; + } + } + else + { + return EnumFacing.DOWN; + } + } + + public void dbg(String p_dbg_1_) + { + Config.dbg("" + this.context + ": " + p_dbg_1_); + } + + public void warn(String p_warn_1_) + { + Config.warn("" + this.context + ": " + p_warn_1_); + } + + public RangeListInt parseRangeListInt(String p_parseRangeListInt_1_) + { + if (p_parseRangeListInt_1_ == null) + { + return null; + } + else + { + RangeListInt rangelistint = new RangeListInt(); + String[] astring = Config.tokenize(p_parseRangeListInt_1_, " ,"); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + RangeInt rangeint = this.parseRangeInt(s); + + if (rangeint == null) + { + return null; + } + + rangelistint.addRange(rangeint); + } + + return rangelistint; + } + } + + private RangeInt parseRangeInt(String p_parseRangeInt_1_) + { + if (p_parseRangeInt_1_ == null) + { + return null; + } + else if (p_parseRangeInt_1_.indexOf(45) >= 0) + { + String[] astring = Config.tokenize(p_parseRangeInt_1_, "-"); + + if (astring.length != 2) + { + this.warn("Invalid range: " + p_parseRangeInt_1_); + return null; + } + else + { + int j = Config.parseInt(astring[0], -1); + int k = Config.parseInt(astring[1], -1); + + if (j >= 0 && k >= 0) + { + return new RangeInt(j, k); + } + else + { + this.warn("Invalid range: " + p_parseRangeInt_1_); + return null; + } + } + } + else + { + int i = Config.parseInt(p_parseRangeInt_1_, -1); + + if (i < 0) + { + this.warn("Invalid integer: " + p_parseRangeInt_1_); + return null; + } + else + { + return new RangeInt(i, i); + } + } + } + + public static boolean parseBoolean(String p_parseBoolean_0_) + { + return p_parseBoolean_0_ == null ? false : p_parseBoolean_0_.toLowerCase().equals("true"); + } + + public static int parseColor(String p_parseColor_0_, int p_parseColor_1_) + { + if (p_parseColor_0_ == null) + { + return p_parseColor_1_; + } + else + { + p_parseColor_0_ = p_parseColor_0_.trim(); + + try + { + int i = Integer.parseInt(p_parseColor_0_, 16) & 16777215; + return i; + } + catch (NumberFormatException var3) + { + return p_parseColor_1_; + } + } + } +} diff --git a/src/minecraft/optifine/ConnectedProperties.java b/src/minecraft/optifine/ConnectedProperties.java new file mode 100644 index 0000000..0f1c3e0 --- /dev/null +++ b/src/minecraft/optifine/ConnectedProperties.java @@ -0,0 +1,951 @@ +package optifine; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Properties; +import net.minecraft.block.properties.IProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.biome.BiomeGenBase; + +public class ConnectedProperties +{ + public String name = null; + public String basePath = null; + public MatchBlock[] matchBlocks = null; + public int[] metadatas = null; + public String[] matchTiles = null; + public int method = 0; + public String[] tiles = null; + public int connect = 0; + public int faces = 63; + public BiomeGenBase[] biomes = null; + public int minHeight = 0; + public int maxHeight = 1024; + public int renderPass = 0; + public boolean innerSeams = false; + public int width = 0; + public int height = 0; + public int[] weights = null; + public int symmetry = 1; + public int[] sumWeights = null; + public int sumAllWeights = 1; + public TextureAtlasSprite[] matchTileIcons = null; + public TextureAtlasSprite[] tileIcons = null; + public static final int METHOD_NONE = 0; + public static final int METHOD_CTM = 1; + public static final int METHOD_HORIZONTAL = 2; + public static final int METHOD_TOP = 3; + public static final int METHOD_RANDOM = 4; + public static final int METHOD_REPEAT = 5; + public static final int METHOD_VERTICAL = 6; + public static final int METHOD_FIXED = 7; + public static final int METHOD_HORIZONTAL_VERTICAL = 8; + public static final int METHOD_VERTICAL_HORIZONTAL = 9; + public static final int CONNECT_NONE = 0; + public static final int CONNECT_BLOCK = 1; + public static final int CONNECT_TILE = 2; + public static final int CONNECT_MATERIAL = 3; + public static final int CONNECT_UNKNOWN = 128; + public static final int FACE_BOTTOM = 1; + public static final int FACE_TOP = 2; + public static final int FACE_NORTH = 4; + public static final int FACE_SOUTH = 8; + public static final int FACE_WEST = 16; + public static final int FACE_EAST = 32; + public static final int FACE_SIDES = 60; + public static final int FACE_ALL = 63; + public static final int FACE_UNKNOWN = 128; + public static final int SYMMETRY_NONE = 1; + public static final int SYMMETRY_OPPOSITE = 2; + public static final int SYMMETRY_ALL = 6; + public static final int SYMMETRY_UNKNOWN = 128; + + public ConnectedProperties(Properties p_i32_1_, String p_i32_2_) + { + ConnectedParser connectedparser = new ConnectedParser("ConnectedTextures"); + this.name = connectedparser.parseName(p_i32_2_); + this.basePath = connectedparser.parseBasePath(p_i32_2_); + this.matchBlocks = connectedparser.parseMatchBlocks(p_i32_1_.getProperty("matchBlocks")); + this.metadatas = connectedparser.parseIntList(p_i32_1_.getProperty("metadata")); + this.matchTiles = this.parseMatchTiles(p_i32_1_.getProperty("matchTiles")); + this.method = parseMethod(p_i32_1_.getProperty("method")); + this.tiles = this.parseTileNames(p_i32_1_.getProperty("tiles")); + this.connect = parseConnect(p_i32_1_.getProperty("connect")); + this.faces = parseFaces(p_i32_1_.getProperty("faces")); + this.biomes = connectedparser.parseBiomes(p_i32_1_.getProperty("biomes")); + this.minHeight = connectedparser.parseInt(p_i32_1_.getProperty("minHeight"), -1); + this.maxHeight = connectedparser.parseInt(p_i32_1_.getProperty("maxHeight"), 1024); + this.renderPass = connectedparser.parseInt(p_i32_1_.getProperty("renderPass")); + this.innerSeams = ConnectedParser.parseBoolean(p_i32_1_.getProperty("innerSeams")); + this.width = connectedparser.parseInt(p_i32_1_.getProperty("width")); + this.height = connectedparser.parseInt(p_i32_1_.getProperty("height")); + this.weights = connectedparser.parseIntList(p_i32_1_.getProperty("weights")); + this.symmetry = parseSymmetry(p_i32_1_.getProperty("symmetry")); + } + + private String[] parseMatchTiles(String p_parseMatchTiles_1_) + { + if (p_parseMatchTiles_1_ == null) + { + return null; + } + else + { + String[] astring = Config.tokenize(p_parseMatchTiles_1_, " "); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + + if (s.endsWith(".png")) + { + s = s.substring(0, s.length() - 4); + } + + s = TextureUtils.fixResourcePath(s, this.basePath); + astring[i] = s; + } + + return astring; + } + } + + private static String parseName(String p_parseName_0_) + { + String s = p_parseName_0_; + int i = p_parseName_0_.lastIndexOf(47); + + if (i >= 0) + { + s = p_parseName_0_.substring(i + 1); + } + + int j = s.lastIndexOf(46); + + if (j >= 0) + { + s = s.substring(0, j); + } + + return s; + } + + private static String parseBasePath(String p_parseBasePath_0_) + { + int i = p_parseBasePath_0_.lastIndexOf(47); + return i < 0 ? "" : p_parseBasePath_0_.substring(0, i); + } + + private String[] parseTileNames(String p_parseTileNames_1_) + { + if (p_parseTileNames_1_ == null) + { + return null; + } + else + { + List list = new ArrayList(); + String[] astring = Config.tokenize(p_parseTileNames_1_, " ,"); + label32: + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + + if (s.contains("-")) + { + String[] astring1 = Config.tokenize(s, "-"); + + if (astring1.length == 2) + { + int j = Config.parseInt(astring1[0], -1); + int k = Config.parseInt(astring1[1], -1); + + if (j >= 0 && k >= 0) + { + if (j > k) + { + Config.warn("Invalid interval: " + s + ", when parsing: " + p_parseTileNames_1_); + continue; + } + + int l = j; + + while (true) + { + if (l > k) + { + continue label32; + } + + list.add(String.valueOf(l)); + ++l; + } + } + } + } + + list.add(s); + } + + String[] astring2 = (String[])((String[])list.toArray(new String[list.size()])); + + for (int i1 = 0; i1 < astring2.length; ++i1) + { + String s1 = astring2[i1]; + s1 = TextureUtils.fixResourcePath(s1, this.basePath); + + if (!s1.startsWith(this.basePath) && !s1.startsWith("textures/") && !s1.startsWith("mcpatcher/")) + { + s1 = this.basePath + "/" + s1; + } + + if (s1.endsWith(".png")) + { + s1 = s1.substring(0, s1.length() - 4); + } + + String s2 = "textures/blocks/"; + + if (s1.startsWith(s2)) + { + s1 = s1.substring(s2.length()); + } + + if (s1.startsWith("/")) + { + s1 = s1.substring(1); + } + + astring2[i1] = s1; + } + + return astring2; + } + } + + private static int parseSymmetry(String p_parseSymmetry_0_) + { + if (p_parseSymmetry_0_ == null) + { + return 1; + } + else if (p_parseSymmetry_0_.equals("opposite")) + { + return 2; + } + else if (p_parseSymmetry_0_.equals("all")) + { + return 6; + } + else + { + Config.warn("Unknown symmetry: " + p_parseSymmetry_0_); + return 1; + } + } + + private static int parseFaces(String p_parseFaces_0_) + { + if (p_parseFaces_0_ == null) + { + return 63; + } + else + { + String[] astring = Config.tokenize(p_parseFaces_0_, " ,"); + int i = 0; + + for (int j = 0; j < astring.length; ++j) + { + String s = astring[j]; + int k = parseFace(s); + i |= k; + } + + return i; + } + } + + private static int parseFace(String p_parseFace_0_) + { + p_parseFace_0_ = p_parseFace_0_.toLowerCase(); + + if (!p_parseFace_0_.equals("bottom") && !p_parseFace_0_.equals("down")) + { + if (!p_parseFace_0_.equals("top") && !p_parseFace_0_.equals("up")) + { + if (p_parseFace_0_.equals("north")) + { + return 4; + } + else if (p_parseFace_0_.equals("south")) + { + return 8; + } + else if (p_parseFace_0_.equals("east")) + { + return 32; + } + else if (p_parseFace_0_.equals("west")) + { + return 16; + } + else if (p_parseFace_0_.equals("sides")) + { + return 60; + } + else if (p_parseFace_0_.equals("all")) + { + return 63; + } + else + { + Config.warn("Unknown face: " + p_parseFace_0_); + return 128; + } + } + else + { + return 2; + } + } + else + { + return 1; + } + } + + private static int parseConnect(String p_parseConnect_0_) + { + if (p_parseConnect_0_ == null) + { + return 0; + } + else if (p_parseConnect_0_.equals("block")) + { + return 1; + } + else if (p_parseConnect_0_.equals("tile")) + { + return 2; + } + else if (p_parseConnect_0_.equals("material")) + { + return 3; + } + else + { + Config.warn("Unknown connect: " + p_parseConnect_0_); + return 128; + } + } + + public static IProperty getProperty(String p_getProperty_0_, Collection p_getProperty_1_) + { + for (Object iproperty : p_getProperty_1_) + { + if (p_getProperty_0_.equals(((IProperty) iproperty).getName())) + { + return (IProperty) iproperty; + } + } + + return null; + } + + private static int parseMethod(String p_parseMethod_0_) + { + if (p_parseMethod_0_ == null) + { + return 1; + } + else if (!p_parseMethod_0_.equals("ctm") && !p_parseMethod_0_.equals("glass")) + { + if (!p_parseMethod_0_.equals("horizontal") && !p_parseMethod_0_.equals("bookshelf")) + { + if (p_parseMethod_0_.equals("vertical")) + { + return 6; + } + else if (p_parseMethod_0_.equals("top")) + { + return 3; + } + else if (p_parseMethod_0_.equals("random")) + { + return 4; + } + else if (p_parseMethod_0_.equals("repeat")) + { + return 5; + } + else if (p_parseMethod_0_.equals("fixed")) + { + return 7; + } + else if (!p_parseMethod_0_.equals("horizontal+vertical") && !p_parseMethod_0_.equals("h+v")) + { + if (!p_parseMethod_0_.equals("vertical+horizontal") && !p_parseMethod_0_.equals("v+h")) + { + Config.warn("Unknown method: " + p_parseMethod_0_); + return 0; + } + else + { + return 9; + } + } + else + { + return 8; + } + } + else + { + return 2; + } + } + else + { + return 1; + } + } + + public boolean isValid(String p_isValid_1_) + { + if (this.name != null && this.name.length() > 0) + { + if (this.basePath == null) + { + Config.warn("No base path found: " + p_isValid_1_); + return false; + } + else + { + if (this.matchBlocks == null) + { + this.matchBlocks = this.detectMatchBlocks(); + } + + if (this.matchTiles == null && this.matchBlocks == null) + { + this.matchTiles = this.detectMatchTiles(); + } + + if (this.matchBlocks == null && this.matchTiles == null) + { + Config.warn("No matchBlocks or matchTiles specified: " + p_isValid_1_); + return false; + } + else if (this.method == 0) + { + Config.warn("No method: " + p_isValid_1_); + return false; + } + else if (this.tiles != null && this.tiles.length > 0) + { + if (this.connect == 0) + { + this.connect = this.detectConnect(); + } + + if (this.connect == 128) + { + Config.warn("Invalid connect in: " + p_isValid_1_); + return false; + } + else if (this.renderPass > 0) + { + Config.warn("Render pass not supported: " + this.renderPass); + return false; + } + else if ((this.faces & 128) != 0) + { + Config.warn("Invalid faces in: " + p_isValid_1_); + return false; + } + else if ((this.symmetry & 128) != 0) + { + Config.warn("Invalid symmetry in: " + p_isValid_1_); + return false; + } + else + { + switch (this.method) + { + case 1: + return this.isValidCtm(p_isValid_1_); + + case 2: + return this.isValidHorizontal(p_isValid_1_); + + case 3: + return this.isValidTop(p_isValid_1_); + + case 4: + return this.isValidRandom(p_isValid_1_); + + case 5: + return this.isValidRepeat(p_isValid_1_); + + case 6: + return this.isValidVertical(p_isValid_1_); + + case 7: + return this.isValidFixed(p_isValid_1_); + + case 8: + return this.isValidHorizontalVertical(p_isValid_1_); + + case 9: + return this.isValidVerticalHorizontal(p_isValid_1_); + + default: + Config.warn("Unknown method: " + p_isValid_1_); + return false; + } + } + } + else + { + Config.warn("No tiles specified: " + p_isValid_1_); + return false; + } + } + } + else + { + Config.warn("No name found: " + p_isValid_1_); + return false; + } + } + + private int detectConnect() + { + return this.matchBlocks != null ? 1 : (this.matchTiles != null ? 2 : 128); + } + + private MatchBlock[] detectMatchBlocks() + { + int[] aint = this.detectMatchBlockIds(); + + if (aint == null) + { + return null; + } + else + { + MatchBlock[] amatchblock = new MatchBlock[aint.length]; + + for (int i = 0; i < amatchblock.length; ++i) + { + amatchblock[i] = new MatchBlock(aint[i]); + } + + return amatchblock; + } + } + + private int[] detectMatchBlockIds() + { + if (!this.name.startsWith("block")) + { + return null; + } + else + { + int i = "block".length(); + int j; + + for (j = i; j < this.name.length(); ++j) + { + char c0 = this.name.charAt(j); + + if (c0 < 48 || c0 > 57) + { + break; + } + } + + if (j == i) + { + return null; + } + else + { + String s = this.name.substring(i, j); + int k = Config.parseInt(s, -1); + return k < 0 ? null : new int[] {k}; + } + } + } + + private String[] detectMatchTiles() + { + TextureAtlasSprite textureatlassprite = getIcon(this.name); + return textureatlassprite == null ? null : new String[] {this.name}; + } + + private static TextureAtlasSprite getIcon(String p_getIcon_0_) + { + TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks(); + TextureAtlasSprite textureatlassprite = texturemap.getSpriteSafe(p_getIcon_0_); + + if (textureatlassprite != null) + { + return textureatlassprite; + } + else + { + textureatlassprite = texturemap.getSpriteSafe("blocks/" + p_getIcon_0_); + return textureatlassprite; + } + } + + private boolean isValidCtm(String p_isValidCtm_1_) + { + if (this.tiles == null) + { + this.tiles = this.parseTileNames("0-11 16-27 32-43 48-58"); + } + + if (this.tiles.length < 47) + { + Config.warn("Invalid tiles, must be at least 47: " + p_isValidCtm_1_); + return false; + } + else + { + return true; + } + } + + private boolean isValidHorizontal(String p_isValidHorizontal_1_) + { + if (this.tiles == null) + { + this.tiles = this.parseTileNames("12-15"); + } + + if (this.tiles.length != 4) + { + Config.warn("Invalid tiles, must be exactly 4: " + p_isValidHorizontal_1_); + return false; + } + else + { + return true; + } + } + + private boolean isValidVertical(String p_isValidVertical_1_) + { + if (this.tiles == null) + { + Config.warn("No tiles defined for vertical: " + p_isValidVertical_1_); + return false; + } + else if (this.tiles.length != 4) + { + Config.warn("Invalid tiles, must be exactly 4: " + p_isValidVertical_1_); + return false; + } + else + { + return true; + } + } + + private boolean isValidHorizontalVertical(String p_isValidHorizontalVertical_1_) + { + if (this.tiles == null) + { + Config.warn("No tiles defined for horizontal+vertical: " + p_isValidHorizontalVertical_1_); + return false; + } + else if (this.tiles.length != 7) + { + Config.warn("Invalid tiles, must be exactly 7: " + p_isValidHorizontalVertical_1_); + return false; + } + else + { + return true; + } + } + + private boolean isValidVerticalHorizontal(String p_isValidVerticalHorizontal_1_) + { + if (this.tiles == null) + { + Config.warn("No tiles defined for vertical+horizontal: " + p_isValidVerticalHorizontal_1_); + return false; + } + else if (this.tiles.length != 7) + { + Config.warn("Invalid tiles, must be exactly 7: " + p_isValidVerticalHorizontal_1_); + return false; + } + else + { + return true; + } + } + + private boolean isValidRandom(String p_isValidRandom_1_) + { + if (this.tiles != null && this.tiles.length > 0) + { + if (this.weights != null) + { + if (this.weights.length > this.tiles.length) + { + Config.warn("More weights defined than tiles, trimming weights: " + p_isValidRandom_1_); + int[] aint = new int[this.tiles.length]; + System.arraycopy(this.weights, 0, aint, 0, aint.length); + this.weights = aint; + } + + if (this.weights.length < this.tiles.length) + { + Config.warn("Less weights defined than tiles, expanding weights: " + p_isValidRandom_1_); + int[] aint1 = new int[this.tiles.length]; + System.arraycopy(this.weights, 0, aint1, 0, this.weights.length); + int i = MathUtils.getAverage(this.weights); + + for (int j = this.weights.length; j < aint1.length; ++j) + { + aint1[j] = i; + } + + this.weights = aint1; + } + + this.sumWeights = new int[this.weights.length]; + int k = 0; + + for (int l = 0; l < this.weights.length; ++l) + { + k += this.weights[l]; + this.sumWeights[l] = k; + } + + this.sumAllWeights = k; + + if (this.sumAllWeights <= 0) + { + Config.warn("Invalid sum of all weights: " + k); + this.sumAllWeights = 1; + } + } + + return true; + } + else + { + Config.warn("Tiles not defined: " + p_isValidRandom_1_); + return false; + } + } + + private boolean isValidRepeat(String p_isValidRepeat_1_) + { + if (this.tiles == null) + { + Config.warn("Tiles not defined: " + p_isValidRepeat_1_); + return false; + } + else if (this.width > 0 && this.width <= 16) + { + if (this.height > 0 && this.height <= 16) + { + if (this.tiles.length != this.width * this.height) + { + Config.warn("Number of tiles does not equal width x height: " + p_isValidRepeat_1_); + return false; + } + else + { + return true; + } + } + else + { + Config.warn("Invalid height: " + p_isValidRepeat_1_); + return false; + } + } + else + { + Config.warn("Invalid width: " + p_isValidRepeat_1_); + return false; + } + } + + private boolean isValidFixed(String p_isValidFixed_1_) + { + if (this.tiles == null) + { + Config.warn("Tiles not defined: " + p_isValidFixed_1_); + return false; + } + else if (this.tiles.length != 1) + { + Config.warn("Number of tiles should be 1 for method: fixed."); + return false; + } + else + { + return true; + } + } + + private boolean isValidTop(String p_isValidTop_1_) + { + if (this.tiles == null) + { + this.tiles = this.parseTileNames("66"); + } + + if (this.tiles.length != 1) + { + Config.warn("Invalid tiles, must be exactly 1: " + p_isValidTop_1_); + return false; + } + else + { + return true; + } + } + + public void updateIcons(TextureMap p_updateIcons_1_) + { + if (this.matchTiles != null) + { + this.matchTileIcons = registerIcons(this.matchTiles, p_updateIcons_1_); + } + + if (this.tiles != null) + { + this.tileIcons = registerIcons(this.tiles, p_updateIcons_1_); + } + } + + private static TextureAtlasSprite[] registerIcons(String[] p_registerIcons_0_, TextureMap p_registerIcons_1_) + { + if (p_registerIcons_0_ == null) + { + return null; + } + else + { + List list = new ArrayList(); + + for (int i = 0; i < p_registerIcons_0_.length; ++i) + { + String s = p_registerIcons_0_[i]; + ResourceLocation resourcelocation = new ResourceLocation(s); + String s1 = resourcelocation.getResourceDomain(); + String s2 = resourcelocation.getResourcePath(); + + if (!s2.contains("/")) + { + s2 = "textures/blocks/" + s2; + } + + String s3 = s2 + ".png"; + ResourceLocation resourcelocation1 = new ResourceLocation(s1, s3); + boolean flag = Config.hasResource(resourcelocation1); + + if (!flag) + { + Config.warn("File not found: " + s3); + } + + String s4 = "textures/"; + String s5 = s2; + + if (s2.startsWith(s4)) + { + s5 = s2.substring(s4.length()); + } + + ResourceLocation resourcelocation2 = new ResourceLocation(s1, s5); + TextureAtlasSprite textureatlassprite = p_registerIcons_1_.registerSprite(resourcelocation2); + list.add(textureatlassprite); + } + + TextureAtlasSprite[] atextureatlassprite = (TextureAtlasSprite[])((TextureAtlasSprite[])list.toArray(new TextureAtlasSprite[list.size()])); + return atextureatlassprite; + } + } + + public boolean matchesBlockId(int p_matchesBlockId_1_) + { + return Matches.blockId(p_matchesBlockId_1_, this.matchBlocks); + } + + public boolean matchesBlock(int p_matchesBlock_1_, int p_matchesBlock_2_) + { + return !Matches.block(p_matchesBlock_1_, p_matchesBlock_2_, this.matchBlocks) ? false : Matches.metadata(p_matchesBlock_2_, this.metadatas); + } + + public boolean matchesIcon(TextureAtlasSprite p_matchesIcon_1_) + { + return Matches.sprite(p_matchesIcon_1_, this.matchTileIcons); + } + + public String toString() + { + return "CTM name: " + this.name + ", basePath: " + this.basePath + ", matchBlocks: " + Config.arrayToString((Object[])this.matchBlocks) + ", matchTiles: " + Config.arrayToString((Object[])this.matchTiles); + } + + public boolean matchesBiome(BiomeGenBase p_matchesBiome_1_) + { + return Matches.biome(p_matchesBiome_1_, this.biomes); + } + + public int getMetadataMax() + { + int i = -1; + i = this.getMax(this.metadatas, i); + + if (this.matchBlocks != null) + { + for (int j = 0; j < this.matchBlocks.length; ++j) + { + MatchBlock matchblock = this.matchBlocks[j]; + i = this.getMax(matchblock.getMetadatas(), i); + } + } + + return i; + } + + private int getMax(int[] p_getMax_1_, int p_getMax_2_) + { + if (p_getMax_1_ == null) + { + return p_getMax_2_; + } + else + { + for (int i = 0; i < p_getMax_1_.length; ++i) + { + int j = p_getMax_1_[i]; + + if (j > p_getMax_2_) + { + p_getMax_2_ = j; + } + } + + return p_getMax_2_; + } + } +} diff --git a/src/minecraft/optifine/ConnectedTextures.java b/src/minecraft/optifine/ConnectedTextures.java new file mode 100644 index 0000000..34726cc --- /dev/null +++ b/src/minecraft/optifine/ConnectedTextures.java @@ -0,0 +1,1534 @@ +package optifine; + +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.block.BlockPane; +import net.minecraft.block.BlockQuartz; +import net.minecraft.block.BlockRotatedPillar; +import net.minecraft.block.state.BlockStateBase; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.biome.BiomeGenBase; + +public class ConnectedTextures +{ + private static Map[] spriteQuadMaps = null; + private static ConnectedProperties[][] blockProperties = (ConnectedProperties[][])null; + private static ConnectedProperties[][] tileProperties = (ConnectedProperties[][])null; + private static boolean multipass = false; + private static final int Y_NEG_DOWN = 0; + private static final int Y_POS_UP = 1; + private static final int Z_NEG_NORTH = 2; + private static final int Z_POS_SOUTH = 3; + private static final int X_NEG_WEST = 4; + private static final int X_POS_EAST = 5; + private static final int Y_AXIS = 0; + private static final int Z_AXIS = 1; + private static final int X_AXIS = 2; + private static final String[] propSuffixes = new String[] {"", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}; + private static final int[] ctmIndexes = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 0, 0, 0, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, 0, 0, 0, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 0, 0, 0, 0, 0}; + public static final IBlockState AIR_DEFAULT_STATE = Blocks.air.getDefaultState(); + private static TextureAtlasSprite emptySprite = null; + + public static synchronized BakedQuad getConnectedTexture(IBlockAccess p_getConnectedTexture_0_, IBlockState p_getConnectedTexture_1_, BlockPos p_getConnectedTexture_2_, BakedQuad p_getConnectedTexture_3_, RenderEnv p_getConnectedTexture_4_) + { + TextureAtlasSprite textureatlassprite = p_getConnectedTexture_3_.getSprite(); + + if (textureatlassprite == null) + { + return p_getConnectedTexture_3_; + } + else + { + Block block = p_getConnectedTexture_1_.getBlock(); + EnumFacing enumfacing = p_getConnectedTexture_3_.getFace(); + + if (block instanceof BlockPane && textureatlassprite.getIconName().startsWith("minecraft:blocks/glass_pane_top")) + { + IBlockState iblockstate = p_getConnectedTexture_0_.getBlockState(p_getConnectedTexture_2_.offset(p_getConnectedTexture_3_.getFace())); + + if (iblockstate == p_getConnectedTexture_1_) + { + return getQuad(emptySprite, block, p_getConnectedTexture_1_, p_getConnectedTexture_3_); + } + } + + TextureAtlasSprite textureatlassprite1 = getConnectedTextureMultiPass(p_getConnectedTexture_0_, p_getConnectedTexture_1_, p_getConnectedTexture_2_, enumfacing, textureatlassprite, p_getConnectedTexture_4_); + return textureatlassprite1 == textureatlassprite ? p_getConnectedTexture_3_ : getQuad(textureatlassprite1, block, p_getConnectedTexture_1_, p_getConnectedTexture_3_); + } + } + + private static BakedQuad getQuad(TextureAtlasSprite p_getQuad_0_, Block p_getQuad_1_, IBlockState p_getQuad_2_, BakedQuad p_getQuad_3_) + { + if (spriteQuadMaps == null) + { + return p_getQuad_3_; + } + else + { + int i = p_getQuad_0_.getIndexInMap(); + + if (i >= 0 && i < spriteQuadMaps.length) + { + Map map = spriteQuadMaps[i]; + + if (map == null) + { + map = new IdentityHashMap(1); + spriteQuadMaps[i] = map; + } + + BakedQuad bakedquad = (BakedQuad)map.get(p_getQuad_3_); + + if (bakedquad == null) + { + bakedquad = makeSpriteQuad(p_getQuad_3_, p_getQuad_0_); + map.put(p_getQuad_3_, bakedquad); + } + + return bakedquad; + } + else + { + return p_getQuad_3_; + } + } + } + + private static BakedQuad makeSpriteQuad(BakedQuad p_makeSpriteQuad_0_, TextureAtlasSprite p_makeSpriteQuad_1_) + { + int[] aint = (int[])p_makeSpriteQuad_0_.getVertexData().clone(); + TextureAtlasSprite textureatlassprite = p_makeSpriteQuad_0_.getSprite(); + + for (int i = 0; i < 4; ++i) + { + fixVertex(aint, i, textureatlassprite, p_makeSpriteQuad_1_); + } + + BakedQuad bakedquad = new BakedQuad(aint, p_makeSpriteQuad_0_.getTintIndex(), p_makeSpriteQuad_0_.getFace(), p_makeSpriteQuad_1_); + return bakedquad; + } + + private static void fixVertex(int[] p_fixVertex_0_, int p_fixVertex_1_, TextureAtlasSprite p_fixVertex_2_, TextureAtlasSprite p_fixVertex_3_) + { + int i = p_fixVertex_0_.length / 4; + int j = i * p_fixVertex_1_; + float f = Float.intBitsToFloat(p_fixVertex_0_[j + 4]); + float f1 = Float.intBitsToFloat(p_fixVertex_0_[j + 4 + 1]); + double d0 = p_fixVertex_2_.getSpriteU16(f); + double d1 = p_fixVertex_2_.getSpriteV16(f1); + p_fixVertex_0_[j + 4] = Float.floatToRawIntBits(p_fixVertex_3_.getInterpolatedU(d0)); + p_fixVertex_0_[j + 4 + 1] = Float.floatToRawIntBits(p_fixVertex_3_.getInterpolatedV(d1)); + } + + private static TextureAtlasSprite getConnectedTextureMultiPass(IBlockAccess p_getConnectedTextureMultiPass_0_, IBlockState p_getConnectedTextureMultiPass_1_, BlockPos p_getConnectedTextureMultiPass_2_, EnumFacing p_getConnectedTextureMultiPass_3_, TextureAtlasSprite p_getConnectedTextureMultiPass_4_, RenderEnv p_getConnectedTextureMultiPass_5_) + { + TextureAtlasSprite textureatlassprite = getConnectedTextureSingle(p_getConnectedTextureMultiPass_0_, p_getConnectedTextureMultiPass_1_, p_getConnectedTextureMultiPass_2_, p_getConnectedTextureMultiPass_3_, p_getConnectedTextureMultiPass_4_, true, p_getConnectedTextureMultiPass_5_); + + if (!multipass) + { + return textureatlassprite; + } + else if (textureatlassprite == p_getConnectedTextureMultiPass_4_) + { + return textureatlassprite; + } + else + { + TextureAtlasSprite textureatlassprite1 = textureatlassprite; + + for (int i = 0; i < 3; ++i) + { + TextureAtlasSprite textureatlassprite2 = getConnectedTextureSingle(p_getConnectedTextureMultiPass_0_, p_getConnectedTextureMultiPass_1_, p_getConnectedTextureMultiPass_2_, p_getConnectedTextureMultiPass_3_, textureatlassprite1, false, p_getConnectedTextureMultiPass_5_); + + if (textureatlassprite2 == textureatlassprite1) + { + break; + } + + textureatlassprite1 = textureatlassprite2; + } + + return textureatlassprite1; + } + } + + public static TextureAtlasSprite getConnectedTextureSingle(IBlockAccess p_getConnectedTextureSingle_0_, IBlockState p_getConnectedTextureSingle_1_, BlockPos p_getConnectedTextureSingle_2_, EnumFacing p_getConnectedTextureSingle_3_, TextureAtlasSprite p_getConnectedTextureSingle_4_, boolean p_getConnectedTextureSingle_5_, RenderEnv p_getConnectedTextureSingle_6_) + { + Block block = p_getConnectedTextureSingle_1_.getBlock(); + + if (!(p_getConnectedTextureSingle_1_ instanceof BlockStateBase)) + { + return p_getConnectedTextureSingle_4_; + } + else + { + BlockStateBase blockstatebase = (BlockStateBase)p_getConnectedTextureSingle_1_; + + if (tileProperties != null) + { + int i = p_getConnectedTextureSingle_4_.getIndexInMap(); + + if (i >= 0 && i < tileProperties.length) + { + ConnectedProperties[] aconnectedproperties = tileProperties[i]; + + if (aconnectedproperties != null) + { + int j = getSide(p_getConnectedTextureSingle_3_); + + for (int k = 0; k < aconnectedproperties.length; ++k) + { + ConnectedProperties connectedproperties = aconnectedproperties[k]; + + if (connectedproperties != null && connectedproperties.matchesBlockId(blockstatebase.getBlockId())) + { + TextureAtlasSprite textureatlassprite = getConnectedTexture(connectedproperties, p_getConnectedTextureSingle_0_, blockstatebase, p_getConnectedTextureSingle_2_, j, p_getConnectedTextureSingle_4_, p_getConnectedTextureSingle_6_); + + if (textureatlassprite != null) + { + return textureatlassprite; + } + } + } + } + } + } + + if (blockProperties != null && p_getConnectedTextureSingle_5_) + { + int l = p_getConnectedTextureSingle_6_.getBlockId(); + + if (l >= 0 && l < blockProperties.length) + { + ConnectedProperties[] aconnectedproperties1 = blockProperties[l]; + + if (aconnectedproperties1 != null) + { + int i1 = getSide(p_getConnectedTextureSingle_3_); + + for (int j1 = 0; j1 < aconnectedproperties1.length; ++j1) + { + ConnectedProperties connectedproperties1 = aconnectedproperties1[j1]; + + if (connectedproperties1 != null && connectedproperties1.matchesIcon(p_getConnectedTextureSingle_4_)) + { + TextureAtlasSprite textureatlassprite1 = getConnectedTexture(connectedproperties1, p_getConnectedTextureSingle_0_, blockstatebase, p_getConnectedTextureSingle_2_, i1, p_getConnectedTextureSingle_4_, p_getConnectedTextureSingle_6_); + + if (textureatlassprite1 != null) + { + return textureatlassprite1; + } + } + } + } + } + } + + return p_getConnectedTextureSingle_4_; + } + } + + public static int getSide(EnumFacing p_getSide_0_) + { + if (p_getSide_0_ == null) + { + return -1; + } + else + { + switch (p_getSide_0_) + { + case DOWN: + return 0; + + case UP: + return 1; + + case EAST: + return 5; + + case WEST: + return 4; + + case NORTH: + return 2; + + case SOUTH: + return 3; + + default: + return -1; + } + } + } + + private static EnumFacing getFacing(int p_getFacing_0_) + { + switch (p_getFacing_0_) + { + case 0: + return EnumFacing.DOWN; + + case 1: + return EnumFacing.UP; + + case 2: + return EnumFacing.NORTH; + + case 3: + return EnumFacing.SOUTH; + + case 4: + return EnumFacing.WEST; + + case 5: + return EnumFacing.EAST; + + default: + return EnumFacing.UP; + } + } + + private static TextureAtlasSprite getConnectedTexture(ConnectedProperties p_getConnectedTexture_0_, IBlockAccess p_getConnectedTexture_1_, BlockStateBase p_getConnectedTexture_2_, BlockPos p_getConnectedTexture_3_, int p_getConnectedTexture_4_, TextureAtlasSprite p_getConnectedTexture_5_, RenderEnv p_getConnectedTexture_6_) + { + int i = 0; + int j = p_getConnectedTexture_2_.getMetadata(); + int k = j; + Block block = p_getConnectedTexture_2_.getBlock(); + + if (block instanceof BlockRotatedPillar) + { + i = getWoodAxis(p_getConnectedTexture_4_, j); + + if (p_getConnectedTexture_0_.getMetadataMax() <= 3) + { + k = j & 3; + } + } + + if (block instanceof BlockQuartz) + { + i = getQuartzAxis(p_getConnectedTexture_4_, j); + + if (p_getConnectedTexture_0_.getMetadataMax() <= 2 && k > 2) + { + k = 2; + } + } + + if (!p_getConnectedTexture_0_.matchesBlock(p_getConnectedTexture_2_.getBlockId(), k)) + { + return null; + } + else + { + if (p_getConnectedTexture_4_ >= 0 && p_getConnectedTexture_0_.faces != 63) + { + int l = p_getConnectedTexture_4_; + + if (i != 0) + { + l = fixSideByAxis(p_getConnectedTexture_4_, i); + } + + if ((1 << l & p_getConnectedTexture_0_.faces) == 0) + { + return null; + } + } + + int i1 = p_getConnectedTexture_3_.getY(); + + if (i1 >= p_getConnectedTexture_0_.minHeight && i1 <= p_getConnectedTexture_0_.maxHeight) + { + if (p_getConnectedTexture_0_.biomes != null) + { + BiomeGenBase biomegenbase = p_getConnectedTexture_1_.getBiomeGenForCoords(p_getConnectedTexture_3_); + + if (!p_getConnectedTexture_0_.matchesBiome(biomegenbase)) + { + return null; + } + } + + switch (p_getConnectedTexture_0_.method) + { + case 1: + return getConnectedTextureCtm(p_getConnectedTexture_0_, p_getConnectedTexture_1_, p_getConnectedTexture_2_, p_getConnectedTexture_3_, i, p_getConnectedTexture_4_, p_getConnectedTexture_5_, j, p_getConnectedTexture_6_); + + case 2: + return getConnectedTextureHorizontal(p_getConnectedTexture_0_, p_getConnectedTexture_1_, p_getConnectedTexture_2_, p_getConnectedTexture_3_, i, p_getConnectedTexture_4_, p_getConnectedTexture_5_, j); + + case 3: + return getConnectedTextureTop(p_getConnectedTexture_0_, p_getConnectedTexture_1_, p_getConnectedTexture_2_, p_getConnectedTexture_3_, i, p_getConnectedTexture_4_, p_getConnectedTexture_5_, j); + + case 4: + return getConnectedTextureRandom(p_getConnectedTexture_0_, p_getConnectedTexture_3_, p_getConnectedTexture_4_); + + case 5: + return getConnectedTextureRepeat(p_getConnectedTexture_0_, p_getConnectedTexture_3_, p_getConnectedTexture_4_); + + case 6: + return getConnectedTextureVertical(p_getConnectedTexture_0_, p_getConnectedTexture_1_, p_getConnectedTexture_2_, p_getConnectedTexture_3_, i, p_getConnectedTexture_4_, p_getConnectedTexture_5_, j); + + case 7: + return getConnectedTextureFixed(p_getConnectedTexture_0_); + + case 8: + return getConnectedTextureHorizontalVertical(p_getConnectedTexture_0_, p_getConnectedTexture_1_, p_getConnectedTexture_2_, p_getConnectedTexture_3_, i, p_getConnectedTexture_4_, p_getConnectedTexture_5_, j); + + case 9: + return getConnectedTextureVerticalHorizontal(p_getConnectedTexture_0_, p_getConnectedTexture_1_, p_getConnectedTexture_2_, p_getConnectedTexture_3_, i, p_getConnectedTexture_4_, p_getConnectedTexture_5_, j); + + default: + return null; + } + } + else + { + return null; + } + } + } + + private static int fixSideByAxis(int p_fixSideByAxis_0_, int p_fixSideByAxis_1_) + { + switch (p_fixSideByAxis_1_) + { + case 0: + return p_fixSideByAxis_0_; + + case 1: + switch (p_fixSideByAxis_0_) + { + case 0: + return 2; + + case 1: + return 3; + + case 2: + return 1; + + case 3: + return 0; + + default: + return p_fixSideByAxis_0_; + } + + case 2: + switch (p_fixSideByAxis_0_) + { + case 0: + return 4; + + case 1: + return 5; + + case 2: + case 3: + default: + return p_fixSideByAxis_0_; + + case 4: + return 1; + + case 5: + return 0; + } + + default: + return p_fixSideByAxis_0_; + } + } + + private static int getWoodAxis(int p_getWoodAxis_0_, int p_getWoodAxis_1_) + { + int i = (p_getWoodAxis_1_ & 12) >> 2; + + switch (i) + { + case 1: + return 2; + + case 2: + return 1; + + default: + return 0; + } + } + + private static int getQuartzAxis(int p_getQuartzAxis_0_, int p_getQuartzAxis_1_) + { + switch (p_getQuartzAxis_1_) + { + case 3: + return 2; + + case 4: + return 1; + + default: + return 0; + } + } + + private static TextureAtlasSprite getConnectedTextureRandom(ConnectedProperties p_getConnectedTextureRandom_0_, BlockPos p_getConnectedTextureRandom_1_, int p_getConnectedTextureRandom_2_) + { + if (p_getConnectedTextureRandom_0_.tileIcons.length == 1) + { + return p_getConnectedTextureRandom_0_.tileIcons[0]; + } + else + { + int i = p_getConnectedTextureRandom_2_ / p_getConnectedTextureRandom_0_.symmetry * p_getConnectedTextureRandom_0_.symmetry; + int j = Config.getRandom(p_getConnectedTextureRandom_1_, i) & Integer.MAX_VALUE; + int k = 0; + + if (p_getConnectedTextureRandom_0_.weights == null) + { + k = j % p_getConnectedTextureRandom_0_.tileIcons.length; + } + else + { + int l = j % p_getConnectedTextureRandom_0_.sumAllWeights; + int[] aint = p_getConnectedTextureRandom_0_.sumWeights; + + for (int i1 = 0; i1 < aint.length; ++i1) + { + if (l < aint[i1]) + { + k = i1; + break; + } + } + } + + return p_getConnectedTextureRandom_0_.tileIcons[k]; + } + } + + private static TextureAtlasSprite getConnectedTextureFixed(ConnectedProperties p_getConnectedTextureFixed_0_) + { + return p_getConnectedTextureFixed_0_.tileIcons[0]; + } + + private static TextureAtlasSprite getConnectedTextureRepeat(ConnectedProperties p_getConnectedTextureRepeat_0_, BlockPos p_getConnectedTextureRepeat_1_, int p_getConnectedTextureRepeat_2_) + { + if (p_getConnectedTextureRepeat_0_.tileIcons.length == 1) + { + return p_getConnectedTextureRepeat_0_.tileIcons[0]; + } + else + { + int i = p_getConnectedTextureRepeat_1_.getX(); + int j = p_getConnectedTextureRepeat_1_.getY(); + int k = p_getConnectedTextureRepeat_1_.getZ(); + int l = 0; + int i1 = 0; + + switch (p_getConnectedTextureRepeat_2_) + { + case 0: + l = i; + i1 = k; + break; + + case 1: + l = i; + i1 = k; + break; + + case 2: + l = -i - 1; + i1 = -j; + break; + + case 3: + l = i; + i1 = -j; + break; + + case 4: + l = k; + i1 = -j; + break; + + case 5: + l = -k - 1; + i1 = -j; + } + + l = l % p_getConnectedTextureRepeat_0_.width; + i1 = i1 % p_getConnectedTextureRepeat_0_.height; + + if (l < 0) + { + l += p_getConnectedTextureRepeat_0_.width; + } + + if (i1 < 0) + { + i1 += p_getConnectedTextureRepeat_0_.height; + } + + int j1 = i1 * p_getConnectedTextureRepeat_0_.width + l; + return p_getConnectedTextureRepeat_0_.tileIcons[j1]; + } + } + + private static TextureAtlasSprite getConnectedTextureCtm(ConnectedProperties p_getConnectedTextureCtm_0_, IBlockAccess p_getConnectedTextureCtm_1_, IBlockState p_getConnectedTextureCtm_2_, BlockPos p_getConnectedTextureCtm_3_, int p_getConnectedTextureCtm_4_, int p_getConnectedTextureCtm_5_, TextureAtlasSprite p_getConnectedTextureCtm_6_, int p_getConnectedTextureCtm_7_, RenderEnv p_getConnectedTextureCtm_8_) + { + boolean[] aboolean = p_getConnectedTextureCtm_8_.getBorderFlags(); + + switch (p_getConnectedTextureCtm_5_) + { + case 0: + aboolean[0] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.west(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[1] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.east(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[2] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.north(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[3] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.south(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + break; + + case 1: + aboolean[0] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.west(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[1] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.east(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[2] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.south(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[3] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.north(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + break; + + case 2: + aboolean[0] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.east(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[1] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.west(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[2] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.down(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[3] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.up(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + break; + + case 3: + aboolean[0] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.west(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[1] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.east(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[2] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.down(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[3] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.up(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + break; + + case 4: + aboolean[0] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.north(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[1] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.south(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[2] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.down(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[3] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.up(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + break; + + case 5: + aboolean[0] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.south(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[1] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.north(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[2] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.down(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[3] = isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.up(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + } + + int i = 0; + + if (aboolean[0] & !aboolean[1] & !aboolean[2] & !aboolean[3]) + { + i = 3; + } + else if (!aboolean[0] & aboolean[1] & !aboolean[2] & !aboolean[3]) + { + i = 1; + } + else if (!aboolean[0] & !aboolean[1] & aboolean[2] & !aboolean[3]) + { + i = 12; + } + else if (!aboolean[0] & !aboolean[1] & !aboolean[2] & aboolean[3]) + { + i = 36; + } + else if (aboolean[0] & aboolean[1] & !aboolean[2] & !aboolean[3]) + { + i = 2; + } + else if (!aboolean[0] & !aboolean[1] & aboolean[2] & aboolean[3]) + { + i = 24; + } + else if (aboolean[0] & !aboolean[1] & aboolean[2] & !aboolean[3]) + { + i = 15; + } + else if (aboolean[0] & !aboolean[1] & !aboolean[2] & aboolean[3]) + { + i = 39; + } + else if (!aboolean[0] & aboolean[1] & aboolean[2] & !aboolean[3]) + { + i = 13; + } + else if (!aboolean[0] & aboolean[1] & !aboolean[2] & aboolean[3]) + { + i = 37; + } + else if (!aboolean[0] & aboolean[1] & aboolean[2] & aboolean[3]) + { + i = 25; + } + else if (aboolean[0] & !aboolean[1] & aboolean[2] & aboolean[3]) + { + i = 27; + } + else if (aboolean[0] & aboolean[1] & !aboolean[2] & aboolean[3]) + { + i = 38; + } + else if (aboolean[0] & aboolean[1] & aboolean[2] & !aboolean[3]) + { + i = 14; + } + else if (aboolean[0] & aboolean[1] & aboolean[2] & aboolean[3]) + { + i = 26; + } + + if (i == 0) + { + return p_getConnectedTextureCtm_0_.tileIcons[i]; + } + else if (!Config.isConnectedTexturesFancy()) + { + return p_getConnectedTextureCtm_0_.tileIcons[i]; + } + else + { + switch (p_getConnectedTextureCtm_5_) + { + case 0: + aboolean[0] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.east().north(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[1] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.west().north(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[2] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.east().south(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[3] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.west().south(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + break; + + case 1: + aboolean[0] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.east().south(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[1] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.west().south(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[2] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.east().north(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[3] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.west().north(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + break; + + case 2: + aboolean[0] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.west().down(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[1] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.east().down(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[2] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.west().up(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[3] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.east().up(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + break; + + case 3: + aboolean[0] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.east().down(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[1] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.west().down(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[2] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.east().up(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[3] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.west().up(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + break; + + case 4: + aboolean[0] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.down().south(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[1] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.down().north(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[2] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.up().south(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[3] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.up().north(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + break; + + case 5: + aboolean[0] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.down().north(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[1] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.down().south(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[2] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.up().north(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + aboolean[3] = !isNeighbour(p_getConnectedTextureCtm_0_, p_getConnectedTextureCtm_1_, p_getConnectedTextureCtm_2_, p_getConnectedTextureCtm_3_.up().south(), p_getConnectedTextureCtm_5_, p_getConnectedTextureCtm_6_, p_getConnectedTextureCtm_7_); + } + + if (i == 13 && aboolean[0]) + { + i = 4; + } + else if (i == 15 && aboolean[1]) + { + i = 5; + } + else if (i == 37 && aboolean[2]) + { + i = 16; + } + else if (i == 39 && aboolean[3]) + { + i = 17; + } + else if (i == 14 && aboolean[0] && aboolean[1]) + { + i = 7; + } + else if (i == 25 && aboolean[0] && aboolean[2]) + { + i = 6; + } + else if (i == 27 && aboolean[3] && aboolean[1]) + { + i = 19; + } + else if (i == 38 && aboolean[3] && aboolean[2]) + { + i = 18; + } + else if (i == 14 && !aboolean[0] && aboolean[1]) + { + i = 31; + } + else if (i == 25 && aboolean[0] && !aboolean[2]) + { + i = 30; + } + else if (i == 27 && !aboolean[3] && aboolean[1]) + { + i = 41; + } + else if (i == 38 && aboolean[3] && !aboolean[2]) + { + i = 40; + } + else if (i == 14 && aboolean[0] && !aboolean[1]) + { + i = 29; + } + else if (i == 25 && !aboolean[0] && aboolean[2]) + { + i = 28; + } + else if (i == 27 && aboolean[3] && !aboolean[1]) + { + i = 43; + } + else if (i == 38 && !aboolean[3] && aboolean[2]) + { + i = 42; + } + else if (i == 26 && aboolean[0] && aboolean[1] && aboolean[2] && aboolean[3]) + { + i = 46; + } + else if (i == 26 && !aboolean[0] && aboolean[1] && aboolean[2] && aboolean[3]) + { + i = 9; + } + else if (i == 26 && aboolean[0] && !aboolean[1] && aboolean[2] && aboolean[3]) + { + i = 21; + } + else if (i == 26 && aboolean[0] && aboolean[1] && !aboolean[2] && aboolean[3]) + { + i = 8; + } + else if (i == 26 && aboolean[0] && aboolean[1] && aboolean[2] && !aboolean[3]) + { + i = 20; + } + else if (i == 26 && aboolean[0] && aboolean[1] && !aboolean[2] && !aboolean[3]) + { + i = 11; + } + else if (i == 26 && !aboolean[0] && !aboolean[1] && aboolean[2] && aboolean[3]) + { + i = 22; + } + else if (i == 26 && !aboolean[0] && aboolean[1] && !aboolean[2] && aboolean[3]) + { + i = 23; + } + else if (i == 26 && aboolean[0] && !aboolean[1] && aboolean[2] && !aboolean[3]) + { + i = 10; + } + else if (i == 26 && aboolean[0] && !aboolean[1] && !aboolean[2] && aboolean[3]) + { + i = 34; + } + else if (i == 26 && !aboolean[0] && aboolean[1] && aboolean[2] && !aboolean[3]) + { + i = 35; + } + else if (i == 26 && aboolean[0] && !aboolean[1] && !aboolean[2] && !aboolean[3]) + { + i = 32; + } + else if (i == 26 && !aboolean[0] && aboolean[1] && !aboolean[2] && !aboolean[3]) + { + i = 33; + } + else if (i == 26 && !aboolean[0] && !aboolean[1] && aboolean[2] && !aboolean[3]) + { + i = 44; + } + else if (i == 26 && !aboolean[0] && !aboolean[1] && !aboolean[2] && aboolean[3]) + { + i = 45; + } + + return p_getConnectedTextureCtm_0_.tileIcons[i]; + } + } + + private static boolean isNeighbour(ConnectedProperties p_isNeighbour_0_, IBlockAccess p_isNeighbour_1_, IBlockState p_isNeighbour_2_, BlockPos p_isNeighbour_3_, int p_isNeighbour_4_, TextureAtlasSprite p_isNeighbour_5_, int p_isNeighbour_6_) + { + IBlockState iblockstate = p_isNeighbour_1_.getBlockState(p_isNeighbour_3_); + + if (p_isNeighbour_2_ == iblockstate) + { + return true; + } + else if (p_isNeighbour_0_.connect == 2) + { + if (iblockstate == null) + { + return false; + } + else if (iblockstate == AIR_DEFAULT_STATE) + { + return false; + } + else + { + TextureAtlasSprite textureatlassprite = getNeighbourIcon(p_isNeighbour_1_, p_isNeighbour_3_, iblockstate, p_isNeighbour_4_); + return textureatlassprite == p_isNeighbour_5_; + } + } + else + { + return p_isNeighbour_0_.connect == 3 ? (iblockstate == null ? false : (iblockstate == AIR_DEFAULT_STATE ? false : iblockstate.getBlock().getMaterial() == p_isNeighbour_2_.getBlock().getMaterial())) : false; + } + } + + private static TextureAtlasSprite getNeighbourIcon(IBlockAccess p_getNeighbourIcon_0_, BlockPos p_getNeighbourIcon_1_, IBlockState p_getNeighbourIcon_2_, int p_getNeighbourIcon_3_) + { + p_getNeighbourIcon_2_ = p_getNeighbourIcon_2_.getBlock().getActualState(p_getNeighbourIcon_2_, p_getNeighbourIcon_0_, p_getNeighbourIcon_1_); + IBakedModel ibakedmodel = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(p_getNeighbourIcon_2_); + + if (ibakedmodel == null) + { + return null; + } + else + { + EnumFacing enumfacing = getFacing(p_getNeighbourIcon_3_); + List list = ibakedmodel.getFaceQuads(enumfacing); + + if (list.size() > 0) + { + BakedQuad bakedquad1 = (BakedQuad)list.get(0); + return bakedquad1.getSprite(); + } + else + { + List list1 = ibakedmodel.getGeneralQuads(); + + for (int i = 0; i < list1.size(); ++i) + { + BakedQuad bakedquad = (BakedQuad)list1.get(i); + + if (bakedquad.getFace() == enumfacing) + { + return bakedquad.getSprite(); + } + } + + return null; + } + } + } + + private static TextureAtlasSprite getConnectedTextureHorizontal(ConnectedProperties p_getConnectedTextureHorizontal_0_, IBlockAccess p_getConnectedTextureHorizontal_1_, IBlockState p_getConnectedTextureHorizontal_2_, BlockPos p_getConnectedTextureHorizontal_3_, int p_getConnectedTextureHorizontal_4_, int p_getConnectedTextureHorizontal_5_, TextureAtlasSprite p_getConnectedTextureHorizontal_6_, int p_getConnectedTextureHorizontal_7_) + { + boolean flag; + boolean flag1; + flag = false; + flag1 = false; + label0: + + switch (p_getConnectedTextureHorizontal_4_) + { + case 0: + switch (p_getConnectedTextureHorizontal_5_) + { + case 0: + case 1: + return null; + + case 2: + flag = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.east(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + flag1 = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.west(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + break label0; + + case 3: + flag = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.west(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + flag1 = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.east(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + break label0; + + case 4: + flag = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.north(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + flag1 = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.south(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + break label0; + + case 5: + flag = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.south(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + flag1 = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.north(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + + default: + break label0; + } + + case 1: + switch (p_getConnectedTextureHorizontal_5_) + { + case 0: + flag = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.west(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + flag1 = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.east(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + break label0; + + case 1: + flag = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.west(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + flag1 = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.east(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + break label0; + + case 2: + case 3: + return null; + + case 4: + flag = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.down(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + flag1 = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.up(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + break label0; + + case 5: + flag = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.up(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + flag1 = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.down(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + + default: + break label0; + } + + case 2: + switch (p_getConnectedTextureHorizontal_5_) + { + case 0: + flag = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.north(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + flag1 = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.south(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + break; + + case 1: + flag = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.north(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + flag1 = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.south(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + break; + + case 2: + flag = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.down(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + flag1 = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.up(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + break; + + case 3: + flag = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.up(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + flag1 = isNeighbour(p_getConnectedTextureHorizontal_0_, p_getConnectedTextureHorizontal_1_, p_getConnectedTextureHorizontal_2_, p_getConnectedTextureHorizontal_3_.down(), p_getConnectedTextureHorizontal_5_, p_getConnectedTextureHorizontal_6_, p_getConnectedTextureHorizontal_7_); + break; + + case 4: + case 5: + return null; + } + } + + int i = 3; + + if (flag) + { + if (flag1) + { + i = 1; + } + else + { + i = 2; + } + } + else if (flag1) + { + i = 0; + } + else + { + i = 3; + } + + return p_getConnectedTextureHorizontal_0_.tileIcons[i]; + } + + private static TextureAtlasSprite getConnectedTextureVertical(ConnectedProperties p_getConnectedTextureVertical_0_, IBlockAccess p_getConnectedTextureVertical_1_, IBlockState p_getConnectedTextureVertical_2_, BlockPos p_getConnectedTextureVertical_3_, int p_getConnectedTextureVertical_4_, int p_getConnectedTextureVertical_5_, TextureAtlasSprite p_getConnectedTextureVertical_6_, int p_getConnectedTextureVertical_7_) + { + boolean flag = false; + boolean flag1 = false; + + switch (p_getConnectedTextureVertical_4_) + { + case 0: + if (p_getConnectedTextureVertical_5_ == 1 || p_getConnectedTextureVertical_5_ == 0) + { + return null; + } + + flag = isNeighbour(p_getConnectedTextureVertical_0_, p_getConnectedTextureVertical_1_, p_getConnectedTextureVertical_2_, p_getConnectedTextureVertical_3_.down(), p_getConnectedTextureVertical_5_, p_getConnectedTextureVertical_6_, p_getConnectedTextureVertical_7_); + flag1 = isNeighbour(p_getConnectedTextureVertical_0_, p_getConnectedTextureVertical_1_, p_getConnectedTextureVertical_2_, p_getConnectedTextureVertical_3_.up(), p_getConnectedTextureVertical_5_, p_getConnectedTextureVertical_6_, p_getConnectedTextureVertical_7_); + break; + + case 1: + if (p_getConnectedTextureVertical_5_ == 3 || p_getConnectedTextureVertical_5_ == 2) + { + return null; + } + + flag = isNeighbour(p_getConnectedTextureVertical_0_, p_getConnectedTextureVertical_1_, p_getConnectedTextureVertical_2_, p_getConnectedTextureVertical_3_.south(), p_getConnectedTextureVertical_5_, p_getConnectedTextureVertical_6_, p_getConnectedTextureVertical_7_); + flag1 = isNeighbour(p_getConnectedTextureVertical_0_, p_getConnectedTextureVertical_1_, p_getConnectedTextureVertical_2_, p_getConnectedTextureVertical_3_.north(), p_getConnectedTextureVertical_5_, p_getConnectedTextureVertical_6_, p_getConnectedTextureVertical_7_); + break; + + case 2: + if (p_getConnectedTextureVertical_5_ == 5 || p_getConnectedTextureVertical_5_ == 4) + { + return null; + } + + flag = isNeighbour(p_getConnectedTextureVertical_0_, p_getConnectedTextureVertical_1_, p_getConnectedTextureVertical_2_, p_getConnectedTextureVertical_3_.west(), p_getConnectedTextureVertical_5_, p_getConnectedTextureVertical_6_, p_getConnectedTextureVertical_7_); + flag1 = isNeighbour(p_getConnectedTextureVertical_0_, p_getConnectedTextureVertical_1_, p_getConnectedTextureVertical_2_, p_getConnectedTextureVertical_3_.east(), p_getConnectedTextureVertical_5_, p_getConnectedTextureVertical_6_, p_getConnectedTextureVertical_7_); + } + + int i = 3; + + if (flag) + { + if (flag1) + { + i = 1; + } + else + { + i = 2; + } + } + else if (flag1) + { + i = 0; + } + else + { + i = 3; + } + + return p_getConnectedTextureVertical_0_.tileIcons[i]; + } + + private static TextureAtlasSprite getConnectedTextureHorizontalVertical(ConnectedProperties p_getConnectedTextureHorizontalVertical_0_, IBlockAccess p_getConnectedTextureHorizontalVertical_1_, IBlockState p_getConnectedTextureHorizontalVertical_2_, BlockPos p_getConnectedTextureHorizontalVertical_3_, int p_getConnectedTextureHorizontalVertical_4_, int p_getConnectedTextureHorizontalVertical_5_, TextureAtlasSprite p_getConnectedTextureHorizontalVertical_6_, int p_getConnectedTextureHorizontalVertical_7_) + { + TextureAtlasSprite[] atextureatlassprite = p_getConnectedTextureHorizontalVertical_0_.tileIcons; + TextureAtlasSprite textureatlassprite = getConnectedTextureHorizontal(p_getConnectedTextureHorizontalVertical_0_, p_getConnectedTextureHorizontalVertical_1_, p_getConnectedTextureHorizontalVertical_2_, p_getConnectedTextureHorizontalVertical_3_, p_getConnectedTextureHorizontalVertical_4_, p_getConnectedTextureHorizontalVertical_5_, p_getConnectedTextureHorizontalVertical_6_, p_getConnectedTextureHorizontalVertical_7_); + + if (textureatlassprite != null && textureatlassprite != p_getConnectedTextureHorizontalVertical_6_ && textureatlassprite != atextureatlassprite[3]) + { + return textureatlassprite; + } + else + { + TextureAtlasSprite textureatlassprite1 = getConnectedTextureVertical(p_getConnectedTextureHorizontalVertical_0_, p_getConnectedTextureHorizontalVertical_1_, p_getConnectedTextureHorizontalVertical_2_, p_getConnectedTextureHorizontalVertical_3_, p_getConnectedTextureHorizontalVertical_4_, p_getConnectedTextureHorizontalVertical_5_, p_getConnectedTextureHorizontalVertical_6_, p_getConnectedTextureHorizontalVertical_7_); + return textureatlassprite1 == atextureatlassprite[0] ? atextureatlassprite[4] : (textureatlassprite1 == atextureatlassprite[1] ? atextureatlassprite[5] : (textureatlassprite1 == atextureatlassprite[2] ? atextureatlassprite[6] : textureatlassprite1)); + } + } + + private static TextureAtlasSprite getConnectedTextureVerticalHorizontal(ConnectedProperties p_getConnectedTextureVerticalHorizontal_0_, IBlockAccess p_getConnectedTextureVerticalHorizontal_1_, IBlockState p_getConnectedTextureVerticalHorizontal_2_, BlockPos p_getConnectedTextureVerticalHorizontal_3_, int p_getConnectedTextureVerticalHorizontal_4_, int p_getConnectedTextureVerticalHorizontal_5_, TextureAtlasSprite p_getConnectedTextureVerticalHorizontal_6_, int p_getConnectedTextureVerticalHorizontal_7_) + { + TextureAtlasSprite[] atextureatlassprite = p_getConnectedTextureVerticalHorizontal_0_.tileIcons; + TextureAtlasSprite textureatlassprite = getConnectedTextureVertical(p_getConnectedTextureVerticalHorizontal_0_, p_getConnectedTextureVerticalHorizontal_1_, p_getConnectedTextureVerticalHorizontal_2_, p_getConnectedTextureVerticalHorizontal_3_, p_getConnectedTextureVerticalHorizontal_4_, p_getConnectedTextureVerticalHorizontal_5_, p_getConnectedTextureVerticalHorizontal_6_, p_getConnectedTextureVerticalHorizontal_7_); + + if (textureatlassprite != null && textureatlassprite != p_getConnectedTextureVerticalHorizontal_6_ && textureatlassprite != atextureatlassprite[3]) + { + return textureatlassprite; + } + else + { + TextureAtlasSprite textureatlassprite1 = getConnectedTextureHorizontal(p_getConnectedTextureVerticalHorizontal_0_, p_getConnectedTextureVerticalHorizontal_1_, p_getConnectedTextureVerticalHorizontal_2_, p_getConnectedTextureVerticalHorizontal_3_, p_getConnectedTextureVerticalHorizontal_4_, p_getConnectedTextureVerticalHorizontal_5_, p_getConnectedTextureVerticalHorizontal_6_, p_getConnectedTextureVerticalHorizontal_7_); + return textureatlassprite1 == atextureatlassprite[0] ? atextureatlassprite[4] : (textureatlassprite1 == atextureatlassprite[1] ? atextureatlassprite[5] : (textureatlassprite1 == atextureatlassprite[2] ? atextureatlassprite[6] : textureatlassprite1)); + } + } + + private static TextureAtlasSprite getConnectedTextureTop(ConnectedProperties p_getConnectedTextureTop_0_, IBlockAccess p_getConnectedTextureTop_1_, IBlockState p_getConnectedTextureTop_2_, BlockPos p_getConnectedTextureTop_3_, int p_getConnectedTextureTop_4_, int p_getConnectedTextureTop_5_, TextureAtlasSprite p_getConnectedTextureTop_6_, int p_getConnectedTextureTop_7_) + { + boolean flag = false; + + switch (p_getConnectedTextureTop_4_) + { + case 0: + if (p_getConnectedTextureTop_5_ == 1 || p_getConnectedTextureTop_5_ == 0) + { + return null; + } + + flag = isNeighbour(p_getConnectedTextureTop_0_, p_getConnectedTextureTop_1_, p_getConnectedTextureTop_2_, p_getConnectedTextureTop_3_.up(), p_getConnectedTextureTop_5_, p_getConnectedTextureTop_6_, p_getConnectedTextureTop_7_); + break; + + case 1: + if (p_getConnectedTextureTop_5_ == 3 || p_getConnectedTextureTop_5_ == 2) + { + return null; + } + + flag = isNeighbour(p_getConnectedTextureTop_0_, p_getConnectedTextureTop_1_, p_getConnectedTextureTop_2_, p_getConnectedTextureTop_3_.south(), p_getConnectedTextureTop_5_, p_getConnectedTextureTop_6_, p_getConnectedTextureTop_7_); + break; + + case 2: + if (p_getConnectedTextureTop_5_ == 5 || p_getConnectedTextureTop_5_ == 4) + { + return null; + } + + flag = isNeighbour(p_getConnectedTextureTop_0_, p_getConnectedTextureTop_1_, p_getConnectedTextureTop_2_, p_getConnectedTextureTop_3_.east(), p_getConnectedTextureTop_5_, p_getConnectedTextureTop_6_, p_getConnectedTextureTop_7_); + } + + if (flag) + { + return p_getConnectedTextureTop_0_.tileIcons[0]; + } + else + { + return null; + } + } + + public static void updateIcons(TextureMap p_updateIcons_0_) + { + blockProperties = (ConnectedProperties[][])null; + tileProperties = (ConnectedProperties[][])null; + spriteQuadMaps = null; + + if (Config.isConnectedTextures()) + { + IResourcePack[] airesourcepack = Config.getResourcePacks(); + + for (int i = airesourcepack.length - 1; i >= 0; --i) + { + IResourcePack iresourcepack = airesourcepack[i]; + updateIcons(p_updateIcons_0_, iresourcepack); + } + + updateIcons(p_updateIcons_0_, Config.getDefaultResourcePack()); + ResourceLocation resourcelocation = new ResourceLocation("mcpatcher/ctm/default/empty"); + emptySprite = p_updateIcons_0_.registerSprite(resourcelocation); + spriteQuadMaps = new Map[p_updateIcons_0_.getCountRegisteredSprites() + 1]; + + if (blockProperties.length <= 0) + { + blockProperties = (ConnectedProperties[][])null; + } + + if (tileProperties.length <= 0) + { + tileProperties = (ConnectedProperties[][])null; + } + } + } + + private static void updateIconEmpty(TextureMap p_updateIconEmpty_0_) + { + } + + public static void updateIcons(TextureMap p_updateIcons_0_, IResourcePack p_updateIcons_1_) + { + String[] astring = ResUtils.collectFiles(p_updateIcons_1_, "mcpatcher/ctm/", ".properties", getDefaultCtmPaths()); + Arrays.sort((Object[])astring); + List list = makePropertyList(tileProperties); + List list1 = makePropertyList(blockProperties); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + Config.dbg("ConnectedTextures: " + s); + + try + { + ResourceLocation resourcelocation = new ResourceLocation(s); + InputStream inputstream = p_updateIcons_1_.getInputStream(resourcelocation); + + if (inputstream == null) + { + Config.warn("ConnectedTextures file not found: " + s); + } + else + { + Properties properties = new Properties(); + properties.load(inputstream); + ConnectedProperties connectedproperties = new ConnectedProperties(properties, s); + + if (connectedproperties.isValid(s)) + { + connectedproperties.updateIcons(p_updateIcons_0_); + addToTileList(connectedproperties, list); + addToBlockList(connectedproperties, list1); + } + } + } + catch (FileNotFoundException var11) + { + Config.warn("ConnectedTextures file not found: " + s); + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + + blockProperties = propertyListToArray(list1); + tileProperties = propertyListToArray(list); + multipass = detectMultipass(); + Config.dbg("Multipass connected textures: " + multipass); + } + + private static List makePropertyList(ConnectedProperties[][] p_makePropertyList_0_) + { + List list = new ArrayList(); + + if (p_makePropertyList_0_ != null) + { + for (int i = 0; i < p_makePropertyList_0_.length; ++i) + { + ConnectedProperties[] aconnectedproperties = p_makePropertyList_0_[i]; + List list1 = null; + + if (aconnectedproperties != null) + { + list1 = new ArrayList(Arrays.asList(aconnectedproperties)); + } + + list.add(list1); + } + } + + return list; + } + + private static boolean detectMultipass() + { + List list = new ArrayList(); + + for (int i = 0; i < tileProperties.length; ++i) + { + ConnectedProperties[] aconnectedproperties = tileProperties[i]; + + if (aconnectedproperties != null) + { + list.addAll(Arrays.asList(aconnectedproperties)); + } + } + + for (int k = 0; k < blockProperties.length; ++k) + { + ConnectedProperties[] aconnectedproperties2 = blockProperties[k]; + + if (aconnectedproperties2 != null) + { + list.addAll(Arrays.asList(aconnectedproperties2)); + } + } + + ConnectedProperties[] aconnectedproperties1 = (ConnectedProperties[])((ConnectedProperties[])list.toArray(new ConnectedProperties[list.size()])); + Set set1 = new HashSet(); + Set set = new HashSet(); + + for (int j = 0; j < aconnectedproperties1.length; ++j) + { + ConnectedProperties connectedproperties = aconnectedproperties1[j]; + + if (connectedproperties.matchTileIcons != null) + { + set1.addAll(Arrays.asList(connectedproperties.matchTileIcons)); + } + + if (connectedproperties.tileIcons != null) + { + set.addAll(Arrays.asList(connectedproperties.tileIcons)); + } + } + + set1.retainAll(set); + return !set1.isEmpty(); + } + + private static ConnectedProperties[][] propertyListToArray(List p_propertyListToArray_0_) + { + ConnectedProperties[][] aconnectedproperties = new ConnectedProperties[p_propertyListToArray_0_.size()][]; + + for (int i = 0; i < p_propertyListToArray_0_.size(); ++i) + { + List list = (List)p_propertyListToArray_0_.get(i); + + if (list != null) + { + ConnectedProperties[] aconnectedproperties1 = (ConnectedProperties[])((ConnectedProperties[])list.toArray(new ConnectedProperties[list.size()])); + aconnectedproperties[i] = aconnectedproperties1; + } + } + + return aconnectedproperties; + } + + private static void addToTileList(ConnectedProperties p_addToTileList_0_, List p_addToTileList_1_) + { + if (p_addToTileList_0_.matchTileIcons != null) + { + for (int i = 0; i < p_addToTileList_0_.matchTileIcons.length; ++i) + { + TextureAtlasSprite textureatlassprite = p_addToTileList_0_.matchTileIcons[i]; + + if (!(textureatlassprite instanceof TextureAtlasSprite)) + { + Config.warn("TextureAtlasSprite is not TextureAtlasSprite: " + textureatlassprite + ", name: " + textureatlassprite.getIconName()); + } + else + { + int j = textureatlassprite.getIndexInMap(); + + if (j < 0) + { + Config.warn("Invalid tile ID: " + j + ", icon: " + textureatlassprite.getIconName()); + } + else + { + addToList(p_addToTileList_0_, p_addToTileList_1_, j); + } + } + } + } + } + + private static void addToBlockList(ConnectedProperties p_addToBlockList_0_, List p_addToBlockList_1_) + { + if (p_addToBlockList_0_.matchBlocks != null) + { + for (int i = 0; i < p_addToBlockList_0_.matchBlocks.length; ++i) + { + int j = p_addToBlockList_0_.matchBlocks[i].getBlockId(); + + if (j < 0) + { + Config.warn("Invalid block ID: " + j); + } + else + { + addToList(p_addToBlockList_0_, p_addToBlockList_1_, j); + } + } + } + } + + private static void addToList(ConnectedProperties p_addToList_0_, List p_addToList_1_, int p_addToList_2_) + { + while (p_addToList_2_ >= p_addToList_1_.size()) + { + p_addToList_1_.add(null); + } + + List list = (List)p_addToList_1_.get(p_addToList_2_); + + if (list == null) + { + list = new ArrayList(); + p_addToList_1_.set(p_addToList_2_, list); + } + + list.add(p_addToList_0_); + } + + private static String[] getDefaultCtmPaths() + { + List list = new ArrayList(); + String s = "mcpatcher/ctm/default/"; + + if (Config.isFromDefaultResourcePack(new ResourceLocation("textures/blocks/glass.png"))) + { + list.add(s + "glass.properties"); + list.add(s + "glasspane.properties"); + } + + if (Config.isFromDefaultResourcePack(new ResourceLocation("textures/blocks/bookshelf.png"))) + { + list.add(s + "bookshelf.properties"); + } + + if (Config.isFromDefaultResourcePack(new ResourceLocation("textures/blocks/sandstone_normal.png"))) + { + list.add(s + "sandstone.properties"); + } + + String[] astring = new String[] {"white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "silver", "cyan", "purple", "blue", "brown", "green", "red", "black"}; + + for (int i = 0; i < astring.length; ++i) + { + String s1 = astring[i]; + + if (Config.isFromDefaultResourcePack(new ResourceLocation("textures/blocks/glass_" + s1 + ".png"))) + { + list.add(s + i + "_glass_" + s1 + "/glass_" + s1 + ".properties"); + list.add(s + i + "_glass_" + s1 + "/glass_pane_" + s1 + ".properties"); + } + } + + String[] astring1 = (String[])((String[])list.toArray(new String[list.size()])); + return astring1; + } + + public static int getPaneTextureIndex(boolean p_getPaneTextureIndex_0_, boolean p_getPaneTextureIndex_1_, boolean p_getPaneTextureIndex_2_, boolean p_getPaneTextureIndex_3_) + { + return p_getPaneTextureIndex_1_ && p_getPaneTextureIndex_0_ ? (p_getPaneTextureIndex_2_ ? (p_getPaneTextureIndex_3_ ? 34 : 50) : (p_getPaneTextureIndex_3_ ? 18 : 2)) : (p_getPaneTextureIndex_1_ && !p_getPaneTextureIndex_0_ ? (p_getPaneTextureIndex_2_ ? (p_getPaneTextureIndex_3_ ? 35 : 51) : (p_getPaneTextureIndex_3_ ? 19 : 3)) : (!p_getPaneTextureIndex_1_ && p_getPaneTextureIndex_0_ ? (p_getPaneTextureIndex_2_ ? (p_getPaneTextureIndex_3_ ? 33 : 49) : (p_getPaneTextureIndex_3_ ? 17 : 1)) : (p_getPaneTextureIndex_2_ ? (p_getPaneTextureIndex_3_ ? 32 : 48) : (p_getPaneTextureIndex_3_ ? 16 : 0)))); + } + + public static int getReversePaneTextureIndex(int p_getReversePaneTextureIndex_0_) + { + int i = p_getReversePaneTextureIndex_0_ % 16; + return i == 1 ? p_getReversePaneTextureIndex_0_ + 2 : (i == 3 ? p_getReversePaneTextureIndex_0_ - 2 : p_getReversePaneTextureIndex_0_); + } + + public static TextureAtlasSprite getCtmTexture(ConnectedProperties p_getCtmTexture_0_, int p_getCtmTexture_1_, TextureAtlasSprite p_getCtmTexture_2_) + { + if (p_getCtmTexture_0_.method != 1) + { + return p_getCtmTexture_2_; + } + else if (p_getCtmTexture_1_ >= 0 && p_getCtmTexture_1_ < ctmIndexes.length) + { + int i = ctmIndexes[p_getCtmTexture_1_]; + TextureAtlasSprite[] atextureatlassprite = p_getCtmTexture_0_.tileIcons; + return i >= 0 && i < atextureatlassprite.length ? atextureatlassprite[i] : p_getCtmTexture_2_; + } + else + { + return p_getCtmTexture_2_; + } + } +} diff --git a/src/minecraft/optifine/CrashReportCpu.java b/src/minecraft/optifine/CrashReportCpu.java new file mode 100644 index 0000000..7ff2fdf --- /dev/null +++ b/src/minecraft/optifine/CrashReportCpu.java @@ -0,0 +1,12 @@ +package optifine; + +import java.util.concurrent.Callable; +import net.minecraft.client.renderer.OpenGlHelper; + +public class CrashReportCpu implements Callable +{ + public Object call() throws Exception + { + return OpenGlHelper.func_183029_j(); + } +} diff --git a/src/minecraft/optifine/CrashReporter.java b/src/minecraft/optifine/CrashReporter.java new file mode 100644 index 0000000..85ff38f --- /dev/null +++ b/src/minecraft/optifine/CrashReporter.java @@ -0,0 +1,122 @@ +package optifine; + +import java.util.HashMap; +import java.util.Map; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import shadersmod.client.Shaders; + +public class CrashReporter +{ + public static void onCrashReport(CrashReport p_onCrashReport_0_, CrashReportCategory p_onCrashReport_1_) + { + try + { + GameSettings gamesettings = Config.getGameSettings(); + + if (gamesettings == null) + { + return; + } + + if (!gamesettings.snooperEnabled) + { + return; + } + + Throwable throwable = p_onCrashReport_0_.getCrashCause(); + + if (throwable == null) + { + return; + } + + if (throwable.getClass() == Throwable.class) + { + return; + } + + if (throwable.getClass().getName().contains(".fml.client.SplashProgress")) + { + return; + } + + extendCrashReport(p_onCrashReport_1_); + String s = "http://optifine.net/crashReport"; + String s1 = makeReport(p_onCrashReport_0_); + byte[] abyte = s1.getBytes("ASCII"); + IFileUploadListener ifileuploadlistener = new IFileUploadListener() + { + public void fileUploadFinished(String p_fileUploadFinished_1_, byte[] p_fileUploadFinished_2_, Throwable p_fileUploadFinished_3_) + { + } + }; + Map map = new HashMap(); + map.put("OF-Version", Config.getVersion()); + map.put("OF-Summary", makeSummary(p_onCrashReport_0_)); + FileUploadThread fileuploadthread = new FileUploadThread(s, map, abyte, ifileuploadlistener); + fileuploadthread.setPriority(10); + fileuploadthread.start(); + Thread.sleep(1000L); + } + catch (Exception exception) + { + Config.dbg(exception.getClass().getName() + ": " + exception.getMessage()); + } + } + + private static String makeReport(CrashReport p_makeReport_0_) + { + StringBuffer stringbuffer = new StringBuffer(); + stringbuffer.append("OptiFineVersion: " + Config.getVersion() + "\n"); + stringbuffer.append("Summary: " + makeSummary(p_makeReport_0_) + "\n"); + stringbuffer.append("\n"); + stringbuffer.append(p_makeReport_0_.getCompleteReport()); + stringbuffer.append("\n"); + return stringbuffer.toString(); + } + + private static String makeSummary(CrashReport p_makeSummary_0_) + { + Throwable throwable = p_makeSummary_0_.getCrashCause(); + + if (throwable == null) + { + return "Unknown"; + } + else + { + StackTraceElement[] astacktraceelement = throwable.getStackTrace(); + String s = "unknown"; + + if (astacktraceelement.length > 0) + { + s = astacktraceelement[0].toString().trim(); + } + + String s1 = throwable.getClass().getName() + ": " + throwable.getMessage() + " (" + p_makeSummary_0_.getDescription() + ")" + " [" + s + "]"; + return s1; + } + } + + public static void extendCrashReport(CrashReportCategory p_extendCrashReport_0_) + { + p_extendCrashReport_0_.addCrashSection("OptiFine Version", Config.getVersion()); + + if (Config.getGameSettings() != null) + { + p_extendCrashReport_0_.addCrashSection("Render Distance Chunks", "" + Config.getChunkViewDistance()); + p_extendCrashReport_0_.addCrashSection("Mipmaps", "" + Config.getMipmapLevels()); + p_extendCrashReport_0_.addCrashSection("Anisotropic Filtering", "" + Config.getAnisotropicFilterLevel()); + p_extendCrashReport_0_.addCrashSection("Antialiasing", "" + Config.getAntialiasingLevel()); + p_extendCrashReport_0_.addCrashSection("Multitexture", "" + Config.isMultiTexture()); + } + + p_extendCrashReport_0_.addCrashSection("Shaders", "" + Shaders.getShaderPackName()); + p_extendCrashReport_0_.addCrashSection("OpenGlVersion", "" + Config.openGlVersion); + p_extendCrashReport_0_.addCrashSection("OpenGlRenderer", "" + Config.openGlRenderer); + p_extendCrashReport_0_.addCrashSection("OpenGlVendor", "" + Config.openGlVendor); + p_extendCrashReport_0_.addCrashSection("CpuCount", "" + Config.getAvailableProcessors()); + } +} diff --git a/src/minecraft/optifine/CustomColorFader.java b/src/minecraft/optifine/CustomColorFader.java new file mode 100644 index 0000000..37b1bc4 --- /dev/null +++ b/src/minecraft/optifine/CustomColorFader.java @@ -0,0 +1,50 @@ +package optifine; + +import net.minecraft.util.Vec3; + +public class CustomColorFader +{ + private Vec3 color = null; + private long timeUpdate = System.currentTimeMillis(); + + public Vec3 getColor(double p_getColor_1_, double p_getColor_3_, double p_getColor_5_) + { + if (this.color == null) + { + this.color = new Vec3(p_getColor_1_, p_getColor_3_, p_getColor_5_); + return this.color; + } + else + { + long i = System.currentTimeMillis(); + long j = i - this.timeUpdate; + + if (j == 0L) + { + return this.color; + } + else + { + this.timeUpdate = i; + + if (Math.abs(p_getColor_1_ - this.color.xCoord) < 0.004D && Math.abs(p_getColor_3_ - this.color.yCoord) < 0.004D && Math.abs(p_getColor_5_ - this.color.zCoord) < 0.004D) + { + return this.color; + } + else + { + double d0 = (double)j * 0.001D; + d0 = Config.limit(d0, 0.0D, 1.0D); + double d1 = p_getColor_1_ - this.color.xCoord; + double d2 = p_getColor_3_ - this.color.yCoord; + double d3 = p_getColor_5_ - this.color.zCoord; + double d4 = this.color.xCoord + d1 * d0; + double d5 = this.color.yCoord + d2 * d0; + double d6 = this.color.zCoord + d3 * d0; + this.color = new Vec3(d4, d5, d6); + return this.color; + } + } + } + } +} diff --git a/src/minecraft/optifine/CustomColormap.java b/src/minecraft/optifine/CustomColormap.java new file mode 100644 index 0000000..67519af --- /dev/null +++ b/src/minecraft/optifine/CustomColormap.java @@ -0,0 +1,551 @@ +package optifine; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashSet; +import java.util.Properties; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import net.minecraft.block.Block; +import net.minecraft.block.state.BlockStateBase; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.biome.BiomeGenBase; + +public class CustomColormap implements CustomColors.IColorizer +{ + public String name = null; + public String basePath = null; + private int format = -1; + private MatchBlock[] matchBlocks = null; + private String source = null; + private int color = -1; + private int yVariance = 0; + private int yOffset = 0; + private int width = 0; + private int height = 0; + private int[] colors = null; + private float[][] colorsRgb = (float[][])null; + private static final int FORMAT_UNKNOWN = -1; + private static final int FORMAT_VANILLA = 0; + private static final int FORMAT_GRID = 1; + private static final int FORMAT_FIXED = 2; + public static final String FORMAT_VANILLA_STRING = "vanilla"; + public static final String FORMAT_GRID_STRING = "grid"; + public static final String FORMAT_FIXED_STRING = "fixed"; + public static final String[] FORMAT_STRINGS = new String[] {"vanilla", "grid", "fixed"}; + public static final String KEY_FORMAT = "format"; + public static final String KEY_BLOCKS = "blocks"; + public static final String KEY_SOURCE = "source"; + public static final String KEY_COLOR = "color"; + public static final String KEY_Y_VARIANCE = "yVariance"; + public static final String KEY_Y_OFFSET = "yOffset"; + + public CustomColormap(Properties p_i33_1_, String p_i33_2_, int p_i33_3_, int p_i33_4_, String p_i33_5_) + { + ConnectedParser connectedparser = new ConnectedParser("Colormap"); + this.name = connectedparser.parseName(p_i33_2_); + this.basePath = connectedparser.parseBasePath(p_i33_2_); + this.format = this.parseFormat(p_i33_1_.getProperty("format", p_i33_5_)); + this.matchBlocks = connectedparser.parseMatchBlocks(p_i33_1_.getProperty("blocks")); + this.source = parseTexture(p_i33_1_.getProperty("source"), p_i33_2_, this.basePath); + this.color = ConnectedParser.parseColor(p_i33_1_.getProperty("color"), -1); + this.yVariance = connectedparser.parseInt(p_i33_1_.getProperty("yVariance"), 0); + this.yOffset = connectedparser.parseInt(p_i33_1_.getProperty("yOffset"), 0); + this.width = p_i33_3_; + this.height = p_i33_4_; + } + + private int parseFormat(String p_parseFormat_1_) + { + if (p_parseFormat_1_ == null) + { + return 0; + } + else if (p_parseFormat_1_.equals("vanilla")) + { + return 0; + } + else if (p_parseFormat_1_.equals("grid")) + { + return 1; + } + else if (p_parseFormat_1_.equals("fixed")) + { + return 2; + } + else + { + warn("Unknown format: " + p_parseFormat_1_); + return -1; + } + } + + public boolean isValid(String p_isValid_1_) + { + if (this.format != 0 && this.format != 1) + { + if (this.format != 2) + { + return false; + } + + if (this.color < 0) + { + this.color = 16777215; + } + } + else + { + if (this.source == null) + { + warn("Source not defined: " + p_isValid_1_); + return false; + } + + this.readColors(); + + if (this.colors == null) + { + return false; + } + + if (this.color < 0) + { + if (this.format == 0) + { + this.color = this.getColor(127, 127); + } + + if (this.format == 1) + { + this.color = this.getColorGrid(BiomeGenBase.plains, new BlockPos(0, 64, 0)); + } + } + } + + return true; + } + + public boolean isValidMatchBlocks(String p_isValidMatchBlocks_1_) + { + if (this.matchBlocks == null) + { + this.matchBlocks = this.detectMatchBlocks(); + + if (this.matchBlocks == null) + { + warn("Match blocks not defined: " + p_isValidMatchBlocks_1_); + return false; + } + } + + return true; + } + + private MatchBlock[] detectMatchBlocks() + { + Block block = Block.getBlockFromName(this.name); + + if (block != null) + { + return new MatchBlock[] {new MatchBlock(Block.getIdFromBlock(block))}; + } + else + { + Pattern pattern = Pattern.compile("^block([0-9]+).*$"); + Matcher matcher = pattern.matcher(this.name); + + if (matcher.matches()) + { + String s = matcher.group(1); + int i = Config.parseInt(s, -1); + + if (i >= 0) + { + return new MatchBlock[] {new MatchBlock(i)}; + } + } + + ConnectedParser connectedparser = new ConnectedParser("Colormap"); + MatchBlock[] amatchblock = connectedparser.parseMatchBlock(this.name); + return amatchblock != null ? amatchblock : null; + } + } + + private void readColors() + { + try + { + this.colors = null; + + if (this.source == null) + { + return; + } + + String s = this.source + ".png"; + ResourceLocation resourcelocation = new ResourceLocation(s); + InputStream inputstream = Config.getResourceStream(resourcelocation); + + if (inputstream == null) + { + return; + } + + BufferedImage bufferedimage = TextureUtil.readBufferedImage(inputstream); + + if (bufferedimage == null) + { + return; + } + + int i = bufferedimage.getWidth(); + int j = bufferedimage.getHeight(); + boolean flag = this.width < 0 || this.width == i; + boolean flag1 = this.height < 0 || this.height == j; + + if (!flag || !flag1) + { + dbg("Non-standard palette size: " + i + "x" + j + ", should be: " + this.width + "x" + this.height + ", path: " + s); + } + + this.width = i; + this.height = j; + + if (this.width <= 0 || this.height <= 0) + { + warn("Invalid palette size: " + i + "x" + j + ", path: " + s); + return; + } + + this.colors = new int[i * j]; + bufferedimage.getRGB(0, 0, i, j, this.colors, 0, i); + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + + private static void dbg(String p_dbg_0_) + { + Config.dbg("CustomColors: " + p_dbg_0_); + } + + private static void warn(String p_warn_0_) + { + Config.warn("CustomColors: " + p_warn_0_); + } + + private static String parseTexture(String p_parseTexture_0_, String p_parseTexture_1_, String p_parseTexture_2_) + { + if (p_parseTexture_0_ != null) + { + String s1 = ".png"; + + if (p_parseTexture_0_.endsWith(s1)) + { + p_parseTexture_0_ = p_parseTexture_0_.substring(0, p_parseTexture_0_.length() - s1.length()); + } + + p_parseTexture_0_ = fixTextureName(p_parseTexture_0_, p_parseTexture_2_); + return p_parseTexture_0_; + } + else + { + String s = p_parseTexture_1_; + int i = p_parseTexture_1_.lastIndexOf(47); + + if (i >= 0) + { + s = p_parseTexture_1_.substring(i + 1); + } + + int j = s.lastIndexOf(46); + + if (j >= 0) + { + s = s.substring(0, j); + } + + s = fixTextureName(s, p_parseTexture_2_); + return s; + } + } + + private static String fixTextureName(String p_fixTextureName_0_, String p_fixTextureName_1_) + { + p_fixTextureName_0_ = TextureUtils.fixResourcePath(p_fixTextureName_0_, p_fixTextureName_1_); + + if (!p_fixTextureName_0_.startsWith(p_fixTextureName_1_) && !p_fixTextureName_0_.startsWith("textures/") && !p_fixTextureName_0_.startsWith("mcpatcher/")) + { + p_fixTextureName_0_ = p_fixTextureName_1_ + "/" + p_fixTextureName_0_; + } + + if (p_fixTextureName_0_.endsWith(".png")) + { + p_fixTextureName_0_ = p_fixTextureName_0_.substring(0, p_fixTextureName_0_.length() - 4); + } + + String s = "textures/blocks/"; + + if (p_fixTextureName_0_.startsWith(s)) + { + p_fixTextureName_0_ = p_fixTextureName_0_.substring(s.length()); + } + + if (p_fixTextureName_0_.startsWith("/")) + { + p_fixTextureName_0_ = p_fixTextureName_0_.substring(1); + } + + return p_fixTextureName_0_; + } + + public boolean matchesBlock(BlockStateBase p_matchesBlock_1_) + { + return Matches.block(p_matchesBlock_1_, this.matchBlocks); + } + + public int getColorRandom() + { + if (this.format == 2) + { + return this.color; + } + else + { + int i = CustomColors.random.nextInt(this.colors.length); + return this.colors[i]; + } + } + + public int getColor(int p_getColor_1_) + { + p_getColor_1_ = Config.limit(p_getColor_1_, 0, this.colors.length - 1); + return this.colors[p_getColor_1_] & 16777215; + } + + public int getColor(int p_getColor_1_, int p_getColor_2_) + { + p_getColor_1_ = Config.limit(p_getColor_1_, 0, this.width - 1); + p_getColor_2_ = Config.limit(p_getColor_2_, 0, this.height - 1); + return this.colors[p_getColor_2_ * this.width + p_getColor_1_] & 16777215; + } + + public float[][] getColorsRgb() + { + if (this.colorsRgb == null) + { + this.colorsRgb = toRgb(this.colors); + } + + return this.colorsRgb; + } + + public int getColor(IBlockAccess p_getColor_1_, BlockPos p_getColor_2_) + { + BiomeGenBase biomegenbase = CustomColors.getColorBiome(p_getColor_1_, p_getColor_2_); + return this.getColor(biomegenbase, p_getColor_2_); + } + + public boolean isColorConstant() + { + return this.format == 2; + } + + public int getColor(BiomeGenBase p_getColor_1_, BlockPos p_getColor_2_) + { + return this.format == 0 ? this.getColorVanilla(p_getColor_1_, p_getColor_2_) : (this.format == 1 ? this.getColorGrid(p_getColor_1_, p_getColor_2_) : this.color); + } + + public int getColorSmooth(IBlockAccess p_getColorSmooth_1_, double p_getColorSmooth_2_, double p_getColorSmooth_4_, double p_getColorSmooth_6_, int p_getColorSmooth_8_) + { + if (this.format == 2) + { + return this.color; + } + else + { + int i = MathHelper.floor_double(p_getColorSmooth_2_); + int j = MathHelper.floor_double(p_getColorSmooth_4_); + int k = MathHelper.floor_double(p_getColorSmooth_6_); + int l = 0; + int i1 = 0; + int j1 = 0; + int k1 = 0; + BlockPosM blockposm = new BlockPosM(0, 0, 0); + + for (int l1 = i - p_getColorSmooth_8_; l1 <= i + p_getColorSmooth_8_; ++l1) + { + for (int i2 = k - p_getColorSmooth_8_; i2 <= k + p_getColorSmooth_8_; ++i2) + { + blockposm.setXyz(l1, j, i2); + int j2 = this.getColor((IBlockAccess)p_getColorSmooth_1_, blockposm); + l += j2 >> 16 & 255; + i1 += j2 >> 8 & 255; + j1 += j2 & 255; + ++k1; + } + } + + int k2 = l / k1; + int l2 = i1 / k1; + int i3 = j1 / k1; + return k2 << 16 | l2 << 8 | i3; + } + } + + private int getColorVanilla(BiomeGenBase p_getColorVanilla_1_, BlockPos p_getColorVanilla_2_) + { + double d0 = (double)MathHelper.clamp_float(p_getColorVanilla_1_.getFloatTemperature(p_getColorVanilla_2_), 0.0F, 1.0F); + double d1 = (double)MathHelper.clamp_float(p_getColorVanilla_1_.getFloatRainfall(), 0.0F, 1.0F); + d1 = d1 * d0; + int i = (int)((1.0D - d0) * (double)(this.width - 1)); + int j = (int)((1.0D - d1) * (double)(this.height - 1)); + return this.getColor(i, j); + } + + private int getColorGrid(BiomeGenBase p_getColorGrid_1_, BlockPos p_getColorGrid_2_) + { + int i = p_getColorGrid_1_.biomeID; + int j = p_getColorGrid_2_.getY() - this.yOffset; + + if (this.yVariance > 0) + { + int k = p_getColorGrid_2_.getX() << 16 + p_getColorGrid_2_.getZ(); + int l = Config.intHash(k); + int i1 = this.yVariance * 2 + 1; + int j1 = (l & 255) % i1 - this.yVariance; + j += j1; + } + + return this.getColor(i, j); + } + + public int getLength() + { + return this.format == 2 ? 1 : this.colors.length; + } + + public int getWidth() + { + return this.width; + } + + public int getHeight() + { + return this.height; + } + + private static float[][] toRgb(int[] p_toRgb_0_) + { + float[][] afloat = new float[p_toRgb_0_.length][3]; + + for (int i = 0; i < p_toRgb_0_.length; ++i) + { + int j = p_toRgb_0_[i]; + float f = (float)(j >> 16 & 255) / 255.0F; + float f1 = (float)(j >> 8 & 255) / 255.0F; + float f2 = (float)(j & 255) / 255.0F; + float[] afloat1 = afloat[i]; + afloat1[0] = f; + afloat1[1] = f1; + afloat1[2] = f2; + } + + return afloat; + } + + public void addMatchBlock(MatchBlock p_addMatchBlock_1_) + { + if (this.matchBlocks == null) + { + this.matchBlocks = new MatchBlock[0]; + } + + this.matchBlocks = (MatchBlock[])((MatchBlock[])Config.addObjectToArray(this.matchBlocks, p_addMatchBlock_1_)); + } + + public void addMatchBlock(int p_addMatchBlock_1_, int p_addMatchBlock_2_) + { + MatchBlock matchblock = this.getMatchBlock(p_addMatchBlock_1_); + + if (matchblock != null) + { + if (p_addMatchBlock_2_ >= 0) + { + matchblock.addMetadata(p_addMatchBlock_2_); + } + } + else + { + this.addMatchBlock(new MatchBlock(p_addMatchBlock_1_, p_addMatchBlock_2_)); + } + } + + private MatchBlock getMatchBlock(int p_getMatchBlock_1_) + { + if (this.matchBlocks == null) + { + return null; + } + else + { + for (int i = 0; i < this.matchBlocks.length; ++i) + { + MatchBlock matchblock = this.matchBlocks[i]; + + if (matchblock.getBlockId() == p_getMatchBlock_1_) + { + return matchblock; + } + } + + return null; + } + } + + public int[] getMatchBlockIds() + { + if (this.matchBlocks == null) + { + return null; + } + else + { + Set set = new HashSet(); + + for (int i = 0; i < this.matchBlocks.length; ++i) + { + MatchBlock matchblock = this.matchBlocks[i]; + + if (matchblock.getBlockId() >= 0) + { + set.add(Integer.valueOf(matchblock.getBlockId())); + } + } + + Integer[] ainteger = (Integer[])((Integer[])set.toArray(new Integer[set.size()])); + int[] aint = new int[ainteger.length]; + + for (int j = 0; j < ainteger.length; ++j) + { + aint[j] = ainteger[j].intValue(); + } + + return aint; + } + } + + public String toString() + { + return "" + this.basePath + "/" + this.name + ", blocks: " + Config.arrayToString((Object[])this.matchBlocks) + ", source: " + this.source; + } +} diff --git a/src/minecraft/optifine/CustomColors.java b/src/minecraft/optifine/CustomColors.java new file mode 100644 index 0000000..d2d9192 --- /dev/null +++ b/src/minecraft/optifine/CustomColors.java @@ -0,0 +1,1875 @@ +package optifine; + +import java.awt.image.BufferedImage; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Random; +import java.util.Set; +import javax.imageio.ImageIO; +import net.minecraft.block.Block; +import net.minecraft.block.BlockRedstoneWire; +import net.minecraft.block.BlockStem; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.BlockStateBase; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.item.Item; +import net.minecraft.item.ItemMonsterPlacer; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionHelper; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.world.ColorizerFoliage; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; + +public class CustomColors +{ + private static String paletteFormatDefault = "vanilla"; + private static CustomColormap waterColors = null; + private static CustomColormap foliagePineColors = null; + private static CustomColormap foliageBirchColors = null; + private static CustomColormap swampFoliageColors = null; + private static CustomColormap swampGrassColors = null; + private static CustomColormap[] colorsBlockColormaps = null; + private static CustomColormap[][] blockColormaps = (CustomColormap[][])null; + private static CustomColormap skyColors = null; + private static CustomColorFader skyColorFader = new CustomColorFader(); + private static CustomColormap fogColors = null; + private static CustomColorFader fogColorFader = new CustomColorFader(); + private static CustomColormap underwaterColors = null; + private static CustomColorFader underwaterColorFader = new CustomColorFader(); + private static CustomColormap[] lightMapsColorsRgb = null; + private static int lightmapMinDimensionId = 0; + private static float[][] sunRgbs = new float[16][3]; + private static float[][] torchRgbs = new float[16][3]; + private static CustomColormap redstoneColors = null; + private static CustomColormap xpOrbColors = null; + private static int xpOrbTime = -1; + private static CustomColormap durabilityColors = null; + private static CustomColormap stemColors = null; + private static CustomColormap stemMelonColors = null; + private static CustomColormap stemPumpkinColors = null; + private static CustomColormap myceliumParticleColors = null; + private static boolean useDefaultGrassFoliageColors = true; + private static int particleWaterColor = -1; + private static int particlePortalColor = -1; + private static int lilyPadColor = -1; + private static int expBarTextColor = -1; + private static int bossTextColor = -1; + private static int signTextColor = -1; + private static Vec3 fogColorNether = null; + private static Vec3 fogColorEnd = null; + private static Vec3 skyColorEnd = null; + private static int[] spawnEggPrimaryColors = null; + private static int[] spawnEggSecondaryColors = null; + private static float[][] wolfCollarColors = (float[][])null; + private static float[][] sheepColors = (float[][])null; + private static int[] textColors = null; + private static int[] mapColorsOriginal = null; + private static int[] potionColors = null; + private static final IBlockState BLOCK_STATE_DIRT = Blocks.dirt.getDefaultState(); + private static final IBlockState BLOCK_STATE_WATER = Blocks.water.getDefaultState(); + public static Random random = new Random(); + private static final CustomColors.IColorizer COLORIZER_GRASS = new CustomColors.IColorizer() + { + public int getColor(IBlockAccess p_getColor_1_, BlockPos p_getColor_2_) + { + BiomeGenBase biomegenbase = CustomColors.getColorBiome(p_getColor_1_, p_getColor_2_); + return CustomColors.swampGrassColors != null && biomegenbase == BiomeGenBase.swampland ? CustomColors.swampGrassColors.getColor(biomegenbase, p_getColor_2_) : biomegenbase.getGrassColorAtPos(p_getColor_2_); + } + public boolean isColorConstant() + { + return false; + } + }; + private static final CustomColors.IColorizer COLORIZER_FOLIAGE = new CustomColors.IColorizer() + { + public int getColor(IBlockAccess p_getColor_1_, BlockPos p_getColor_2_) + { + BiomeGenBase biomegenbase = CustomColors.getColorBiome(p_getColor_1_, p_getColor_2_); + return CustomColors.swampFoliageColors != null && biomegenbase == BiomeGenBase.swampland ? CustomColors.swampFoliageColors.getColor(biomegenbase, p_getColor_2_) : biomegenbase.getFoliageColorAtPos(p_getColor_2_); + } + public boolean isColorConstant() + { + return false; + } + }; + private static final CustomColors.IColorizer COLORIZER_FOLIAGE_PINE = new CustomColors.IColorizer() + { + public int getColor(IBlockAccess p_getColor_1_, BlockPos p_getColor_2_) + { + return CustomColors.foliagePineColors != null ? CustomColors.foliagePineColors.getColor(p_getColor_1_, p_getColor_2_) : ColorizerFoliage.getFoliageColorPine(); + } + public boolean isColorConstant() + { + return CustomColors.foliagePineColors == null; + } + }; + private static final CustomColors.IColorizer COLORIZER_FOLIAGE_BIRCH = new CustomColors.IColorizer() + { + public int getColor(IBlockAccess p_getColor_1_, BlockPos p_getColor_2_) + { + return CustomColors.foliageBirchColors != null ? CustomColors.foliageBirchColors.getColor(p_getColor_1_, p_getColor_2_) : ColorizerFoliage.getFoliageColorBirch(); + } + public boolean isColorConstant() + { + return CustomColors.foliageBirchColors == null; + } + }; + private static final CustomColors.IColorizer COLORIZER_WATER = new CustomColors.IColorizer() + { + public int getColor(IBlockAccess p_getColor_1_, BlockPos p_getColor_2_) + { + BiomeGenBase biomegenbase = CustomColors.getColorBiome(p_getColor_1_, p_getColor_2_); + return CustomColors.waterColors != null ? CustomColors.waterColors.getColor(biomegenbase, p_getColor_2_) : (Reflector.ForgeBiome_getWaterColorMultiplier.exists() ? Reflector.callInt(biomegenbase, Reflector.ForgeBiome_getWaterColorMultiplier, new Object[0]) : biomegenbase.waterColorMultiplier); + } + public boolean isColorConstant() + { + return false; + } + }; + + public static void update() + { + paletteFormatDefault = "vanilla"; + waterColors = null; + foliageBirchColors = null; + foliagePineColors = null; + swampGrassColors = null; + swampFoliageColors = null; + skyColors = null; + fogColors = null; + underwaterColors = null; + redstoneColors = null; + xpOrbColors = null; + xpOrbTime = -1; + durabilityColors = null; + stemColors = null; + myceliumParticleColors = null; + lightMapsColorsRgb = null; + particleWaterColor = -1; + particlePortalColor = -1; + lilyPadColor = -1; + expBarTextColor = -1; + bossTextColor = -1; + signTextColor = -1; + fogColorNether = null; + fogColorEnd = null; + skyColorEnd = null; + colorsBlockColormaps = null; + blockColormaps = (CustomColormap[][])null; + useDefaultGrassFoliageColors = true; + spawnEggPrimaryColors = null; + spawnEggSecondaryColors = null; + wolfCollarColors = (float[][])null; + sheepColors = (float[][])null; + textColors = null; + setMapColors(mapColorsOriginal); + potionColors = null; + PotionHelper.clearPotionColorCache(); + paletteFormatDefault = getValidProperty("mcpatcher/color.properties", "palette.format", CustomColormap.FORMAT_STRINGS, "vanilla"); + String s = "mcpatcher/colormap/"; + String[] astring = new String[] {"water.png", "watercolorX.png"}; + waterColors = getCustomColors(s, astring, 256, 256); + updateUseDefaultGrassFoliageColors(); + + if (Config.isCustomColors()) + { + String[] astring1 = new String[] {"pine.png", "pinecolor.png"}; + foliagePineColors = getCustomColors(s, astring1, 256, 256); + String[] astring2 = new String[] {"birch.png", "birchcolor.png"}; + foliageBirchColors = getCustomColors(s, astring2, 256, 256); + String[] astring3 = new String[] {"swampgrass.png", "swampgrasscolor.png"}; + swampGrassColors = getCustomColors(s, astring3, 256, 256); + String[] astring4 = new String[] {"swampfoliage.png", "swampfoliagecolor.png"}; + swampFoliageColors = getCustomColors(s, astring4, 256, 256); + String[] astring5 = new String[] {"sky0.png", "skycolor0.png"}; + skyColors = getCustomColors(s, astring5, 256, 256); + String[] astring6 = new String[] {"fog0.png", "fogcolor0.png"}; + fogColors = getCustomColors(s, astring6, 256, 256); + String[] astring7 = new String[] {"underwater.png", "underwatercolor.png"}; + underwaterColors = getCustomColors(s, astring7, 256, 256); + String[] astring8 = new String[] {"redstone.png", "redstonecolor.png"}; + redstoneColors = getCustomColors(s, astring8, 16, 1); + xpOrbColors = getCustomColors(s + "xporb.png", -1, -1); + durabilityColors = getCustomColors(s + "durability.png", -1, -1); + String[] astring9 = new String[] {"stem.png", "stemcolor.png"}; + stemColors = getCustomColors(s, astring9, 8, 1); + stemPumpkinColors = getCustomColors(s + "pumpkinstem.png", 8, 1); + stemMelonColors = getCustomColors(s + "melonstem.png", 8, 1); + String[] astring10 = new String[] {"myceliumparticle.png", "myceliumparticlecolor.png"}; + myceliumParticleColors = getCustomColors(s, astring10, -1, -1); + Pair pair = parseLightmapsRgb(); + lightMapsColorsRgb = (CustomColormap[])pair.getLeft(); + lightmapMinDimensionId = ((Integer)pair.getRight()).intValue(); + readColorProperties("mcpatcher/color.properties"); + blockColormaps = readBlockColormaps(new String[] {s + "custom/", s + "blocks/"}, colorsBlockColormaps, 256, 256); + updateUseDefaultGrassFoliageColors(); + } + } + + private static String getValidProperty(String p_getValidProperty_0_, String p_getValidProperty_1_, String[] p_getValidProperty_2_, String p_getValidProperty_3_) + { + try + { + ResourceLocation resourcelocation = new ResourceLocation(p_getValidProperty_0_); + InputStream inputstream = Config.getResourceStream(resourcelocation); + + if (inputstream == null) + { + return p_getValidProperty_3_; + } + else + { + Properties properties = new Properties(); + properties.load(inputstream); + inputstream.close(); + String s = properties.getProperty(p_getValidProperty_1_); + + if (s == null) + { + return p_getValidProperty_3_; + } + else + { + List list = Arrays.asList(p_getValidProperty_2_); + + if (!list.contains(s)) + { + warn("Invalid value: " + p_getValidProperty_1_ + "=" + s); + warn("Expected values: " + Config.arrayToString((Object[])p_getValidProperty_2_)); + return p_getValidProperty_3_; + } + else + { + dbg("" + p_getValidProperty_1_ + "=" + s); + return s; + } + } + } + } + catch (FileNotFoundException var9) + { + return p_getValidProperty_3_; + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + return p_getValidProperty_3_; + } + } + + private static Pair parseLightmapsRgb() + { + String s = "mcpatcher/lightmap/world"; + String s1 = ".png"; + String[] astring = ResUtils.collectFiles(s, s1); + Map map = new HashMap(); + + for (int i = 0; i < astring.length; ++i) + { + String s2 = astring[i]; + String s3 = StrUtils.removePrefixSuffix(s2, s, s1); + int j = Config.parseInt(s3, Integer.MIN_VALUE); + + if (j == Integer.MIN_VALUE) + { + warn("Invalid dimension ID: " + s3 + ", path: " + s2); + } + else + { + map.put(Integer.valueOf(j), s2); + } + } + + Set set = map.keySet(); + Integer[] ainteger = (Integer[])set.toArray(new Integer[set.size()]); + Arrays.sort((Object[])ainteger); + + if (ainteger.length <= 0) + { + return new ImmutablePair((Object)null, Integer.valueOf(0)); + } + else + { + int j1 = ainteger[0].intValue(); + int k1 = ainteger[ainteger.length - 1].intValue(); + int k = k1 - j1 + 1; + CustomColormap[] acustomcolormap = new CustomColormap[k]; + + for (int l = 0; l < ainteger.length; ++l) + { + Integer integer = ainteger[l]; + String s4 = (String)map.get(integer); + CustomColormap customcolormap = getCustomColors(s4, -1, -1); + + if (customcolormap != null) + { + if (customcolormap.getWidth() < 16) + { + warn("Invalid lightmap width: " + customcolormap.getWidth() + ", path: " + s4); + } + else + { + int i1 = integer.intValue() - j1; + acustomcolormap[i1] = customcolormap; + } + } + } + + return new ImmutablePair(acustomcolormap, Integer.valueOf(j1)); + } + } + + private static int getTextureHeight(String p_getTextureHeight_0_, int p_getTextureHeight_1_) + { + try + { + InputStream inputstream = Config.getResourceStream(new ResourceLocation(p_getTextureHeight_0_)); + + if (inputstream == null) + { + return p_getTextureHeight_1_; + } + else + { + BufferedImage bufferedimage = ImageIO.read(inputstream); + inputstream.close(); + return bufferedimage == null ? p_getTextureHeight_1_ : bufferedimage.getHeight(); + } + } + catch (IOException var4) + { + return p_getTextureHeight_1_; + } + } + + private static void readColorProperties(String p_readColorProperties_0_) + { + try + { + ResourceLocation resourcelocation = new ResourceLocation(p_readColorProperties_0_); + InputStream inputstream = Config.getResourceStream(resourcelocation); + + if (inputstream == null) + { + return; + } + + dbg("Loading " + p_readColorProperties_0_); + Properties properties = new Properties(); + properties.load(inputstream); + inputstream.close(); + particleWaterColor = readColor(properties, new String[] {"particle.water", "drop.water"}); + particlePortalColor = readColor(properties, "particle.portal"); + lilyPadColor = readColor(properties, "lilypad"); + expBarTextColor = readColor(properties, "text.xpbar"); + bossTextColor = readColor(properties, "text.boss"); + signTextColor = readColor(properties, "text.sign"); + fogColorNether = readColorVec3(properties, "fog.nether"); + fogColorEnd = readColorVec3(properties, "fog.end"); + skyColorEnd = readColorVec3(properties, "sky.end"); + colorsBlockColormaps = readCustomColormaps(properties, p_readColorProperties_0_); + spawnEggPrimaryColors = readSpawnEggColors(properties, p_readColorProperties_0_, "egg.shell.", "Spawn egg shell"); + spawnEggSecondaryColors = readSpawnEggColors(properties, p_readColorProperties_0_, "egg.spots.", "Spawn egg spot"); + wolfCollarColors = readDyeColors(properties, p_readColorProperties_0_, "collar.", "Wolf collar"); + sheepColors = readDyeColors(properties, p_readColorProperties_0_, "sheep.", "Sheep"); + textColors = readTextColors(properties, p_readColorProperties_0_, "text.code.", "Text"); + int[] aint = readMapColors(properties, p_readColorProperties_0_, "map.", "Map"); + + if (aint != null) + { + if (mapColorsOriginal == null) + { + mapColorsOriginal = getMapColors(); + } + + setMapColors(aint); + } + + potionColors = readPotionColors(properties, p_readColorProperties_0_, "potion.", "Potion"); + xpOrbTime = Config.parseInt(properties.getProperty("xporb.time"), -1); + } + catch (FileNotFoundException var5) + { + return; + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + + private static CustomColormap[] readCustomColormaps(Properties p_readCustomColormaps_0_, String p_readCustomColormaps_1_) + { + List list = new ArrayList(); + String s = "palette.block."; + Map map = new HashMap(); + + for (Object s1 : p_readCustomColormaps_0_.keySet()) + { + String s2 = p_readCustomColormaps_0_.getProperty((String) s1); + + if (((String) s1).startsWith(s)) + { + map.put(s1, s2); + } + } + + String[] astring = (String[])((String[])map.keySet().toArray(new String[map.size()])); + + for (int j = 0; j < astring.length; ++j) + { + String s6 = astring[j]; + String s3 = p_readCustomColormaps_0_.getProperty(s6); + dbg("Block palette: " + s6 + " = " + s3); + String s4 = s6.substring(s.length()); + String s5 = TextureUtils.getBasePath(p_readCustomColormaps_1_); + s4 = TextureUtils.fixResourcePath(s4, s5); + CustomColormap customcolormap = getCustomColors(s4, 256, 256); + + if (customcolormap == null) + { + warn("Colormap not found: " + s4); + } + else + { + ConnectedParser connectedparser = new ConnectedParser("CustomColors"); + MatchBlock[] amatchblock = connectedparser.parseMatchBlocks(s3); + + if (amatchblock != null && amatchblock.length > 0) + { + for (int i = 0; i < amatchblock.length; ++i) + { + MatchBlock matchblock = amatchblock[i]; + customcolormap.addMatchBlock(matchblock); + } + + list.add(customcolormap); + } + else + { + warn("Invalid match blocks: " + s3); + } + } + } + + if (list.size() <= 0) + { + return null; + } + else + { + CustomColormap[] acustomcolormap = (CustomColormap[])((CustomColormap[])list.toArray(new CustomColormap[list.size()])); + return acustomcolormap; + } + } + + private static CustomColormap[][] readBlockColormaps(String[] p_readBlockColormaps_0_, CustomColormap[] p_readBlockColormaps_1_, int p_readBlockColormaps_2_, int p_readBlockColormaps_3_) + { + String[] astring = ResUtils.collectFiles(p_readBlockColormaps_0_, new String[] {".properties"}); + Arrays.sort((Object[])astring); + List list = new ArrayList(); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + dbg("Block colormap: " + s); + + try + { + ResourceLocation resourcelocation = new ResourceLocation("minecraft", s); + InputStream inputstream = Config.getResourceStream(resourcelocation); + + if (inputstream == null) + { + warn("File not found: " + s); + } + else + { + Properties properties = new Properties(); + properties.load(inputstream); + CustomColormap customcolormap = new CustomColormap(properties, s, p_readBlockColormaps_2_, p_readBlockColormaps_3_, paletteFormatDefault); + + if (customcolormap.isValid(s) && customcolormap.isValidMatchBlocks(s)) + { + addToBlockList(customcolormap, list); + } + } + } + catch (FileNotFoundException var12) + { + warn("File not found: " + s); + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + + if (p_readBlockColormaps_1_ != null) + { + for (int j = 0; j < p_readBlockColormaps_1_.length; ++j) + { + CustomColormap customcolormap1 = p_readBlockColormaps_1_[j]; + addToBlockList(customcolormap1, list); + } + } + + if (list.size() <= 0) + { + return (CustomColormap[][])null; + } + else + { + CustomColormap[][] acustomcolormap = blockListToArray(list); + return acustomcolormap; + } + } + + private static void addToBlockList(CustomColormap p_addToBlockList_0_, List p_addToBlockList_1_) + { + int[] aint = p_addToBlockList_0_.getMatchBlockIds(); + + if (aint != null && aint.length > 0) + { + for (int i = 0; i < aint.length; ++i) + { + int j = aint[i]; + + if (j < 0) + { + warn("Invalid block ID: " + j); + } + else + { + addToList(p_addToBlockList_0_, p_addToBlockList_1_, j); + } + } + } + else + { + warn("No match blocks: " + Config.arrayToString(aint)); + } + } + + private static void addToList(CustomColormap p_addToList_0_, List p_addToList_1_, int p_addToList_2_) + { + while (p_addToList_2_ >= p_addToList_1_.size()) + { + p_addToList_1_.add(null); + } + + List list = (List)p_addToList_1_.get(p_addToList_2_); + + if (list == null) + { + list = new ArrayList(); + p_addToList_1_.set(p_addToList_2_, list); + } + + list.add(p_addToList_0_); + } + + private static CustomColormap[][] blockListToArray(List p_blockListToArray_0_) + { + CustomColormap[][] acustomcolormap = new CustomColormap[p_blockListToArray_0_.size()][]; + + for (int i = 0; i < p_blockListToArray_0_.size(); ++i) + { + List list = (List)p_blockListToArray_0_.get(i); + + if (list != null) + { + CustomColormap[] acustomcolormap1 = (CustomColormap[])((CustomColormap[])list.toArray(new CustomColormap[list.size()])); + acustomcolormap[i] = acustomcolormap1; + } + } + + return acustomcolormap; + } + + private static int readColor(Properties p_readColor_0_, String[] p_readColor_1_) + { + for (int i = 0; i < p_readColor_1_.length; ++i) + { + String s = p_readColor_1_[i]; + int j = readColor(p_readColor_0_, s); + + if (j >= 0) + { + return j; + } + } + + return -1; + } + + private static int readColor(Properties p_readColor_0_, String p_readColor_1_) + { + String s = p_readColor_0_.getProperty(p_readColor_1_); + + if (s == null) + { + return -1; + } + else + { + s = s.trim(); + int i = parseColor(s); + + if (i < 0) + { + warn("Invalid color: " + p_readColor_1_ + " = " + s); + return i; + } + else + { + dbg(p_readColor_1_ + " = " + s); + return i; + } + } + } + + private static int parseColor(String p_parseColor_0_) + { + if (p_parseColor_0_ == null) + { + return -1; + } + else + { + p_parseColor_0_ = p_parseColor_0_.trim(); + + try + { + int i = Integer.parseInt(p_parseColor_0_, 16) & 16777215; + return i; + } + catch (NumberFormatException var2) + { + return -1; + } + } + } + + private static Vec3 readColorVec3(Properties p_readColorVec3_0_, String p_readColorVec3_1_) + { + int i = readColor(p_readColorVec3_0_, p_readColorVec3_1_); + + if (i < 0) + { + return null; + } + else + { + int j = i >> 16 & 255; + int k = i >> 8 & 255; + int l = i & 255; + float f = (float)j / 255.0F; + float f1 = (float)k / 255.0F; + float f2 = (float)l / 255.0F; + return new Vec3((double)f, (double)f1, (double)f2); + } + } + + private static CustomColormap getCustomColors(String p_getCustomColors_0_, String[] p_getCustomColors_1_, int p_getCustomColors_2_, int p_getCustomColors_3_) + { + for (int i = 0; i < p_getCustomColors_1_.length; ++i) + { + String s = p_getCustomColors_1_[i]; + s = p_getCustomColors_0_ + s; + CustomColormap customcolormap = getCustomColors(s, p_getCustomColors_2_, p_getCustomColors_3_); + + if (customcolormap != null) + { + return customcolormap; + } + } + + return null; + } + + public static CustomColormap getCustomColors(String p_getCustomColors_0_, int p_getCustomColors_1_, int p_getCustomColors_2_) + { + try + { + ResourceLocation resourcelocation = new ResourceLocation(p_getCustomColors_0_); + + if (!Config.hasResource(resourcelocation)) + { + return null; + } + else + { + dbg("Colormap " + p_getCustomColors_0_); + Properties properties = new Properties(); + String s = StrUtils.replaceSuffix(p_getCustomColors_0_, ".png", ".properties"); + ResourceLocation resourcelocation1 = new ResourceLocation(s); + + if (Config.hasResource(resourcelocation1)) + { + InputStream inputstream = Config.getResourceStream(resourcelocation1); + properties.load(inputstream); + inputstream.close(); + dbg("Colormap properties: " + s); + } + else + { + properties.put("format", paletteFormatDefault); + properties.put("source", p_getCustomColors_0_); + s = p_getCustomColors_0_; + } + + CustomColormap customcolormap = new CustomColormap(properties, s, p_getCustomColors_1_, p_getCustomColors_2_, paletteFormatDefault); + return !customcolormap.isValid(s) ? null : customcolormap; + } + } + catch (Exception exception) + { + exception.printStackTrace(); + return null; + } + } + + public static void updateUseDefaultGrassFoliageColors() + { + useDefaultGrassFoliageColors = foliageBirchColors == null && foliagePineColors == null && swampGrassColors == null && swampFoliageColors == null && Config.isSwampColors() && Config.isSmoothBiomes(); + } + + public static int getColorMultiplier(BakedQuad p_getColorMultiplier_0_, Block p_getColorMultiplier_1_, IBlockAccess p_getColorMultiplier_2_, BlockPos p_getColorMultiplier_3_, RenderEnv p_getColorMultiplier_4_) + { + if (blockColormaps != null) + { + IBlockState iblockstate = p_getColorMultiplier_4_.getBlockState(); + + if (!p_getColorMultiplier_0_.hasTintIndex()) + { + if (p_getColorMultiplier_1_ == Blocks.grass) + { + iblockstate = BLOCK_STATE_DIRT; + } + + if (p_getColorMultiplier_1_ == Blocks.redstone_wire) + { + return -1; + } + } + + if (p_getColorMultiplier_1_ == Blocks.double_plant && p_getColorMultiplier_4_.getMetadata() >= 8) + { + p_getColorMultiplier_3_ = p_getColorMultiplier_3_.down(); + iblockstate = p_getColorMultiplier_2_.getBlockState(p_getColorMultiplier_3_); + } + + CustomColormap customcolormap = getBlockColormap(iblockstate); + + if (customcolormap != null) + { + if (Config.isSmoothBiomes() && !customcolormap.isColorConstant()) + { + return getSmoothColorMultiplier(p_getColorMultiplier_2_, p_getColorMultiplier_3_, customcolormap, p_getColorMultiplier_4_.getColorizerBlockPosM()); + } + + return customcolormap.getColor(p_getColorMultiplier_2_, p_getColorMultiplier_3_); + } + } + + if (!p_getColorMultiplier_0_.hasTintIndex()) + { + return -1; + } + else if (p_getColorMultiplier_1_ == Blocks.waterlily) + { + return getLilypadColorMultiplier(p_getColorMultiplier_2_, p_getColorMultiplier_3_); + } + else if (p_getColorMultiplier_1_ == Blocks.redstone_wire) + { + return getRedstoneColor(p_getColorMultiplier_4_.getBlockState()); + } + else if (p_getColorMultiplier_1_ instanceof BlockStem) + { + return getStemColorMultiplier(p_getColorMultiplier_1_, p_getColorMultiplier_2_, p_getColorMultiplier_3_, p_getColorMultiplier_4_); + } + else if (useDefaultGrassFoliageColors) + { + return -1; + } + else + { + int i = p_getColorMultiplier_4_.getMetadata(); + CustomColors.IColorizer customcolors$icolorizer; + + if (p_getColorMultiplier_1_ != Blocks.grass && p_getColorMultiplier_1_ != Blocks.tallgrass && p_getColorMultiplier_1_ != Blocks.double_plant) + { + if (p_getColorMultiplier_1_ == Blocks.double_plant) + { + customcolors$icolorizer = COLORIZER_GRASS; + + if (i >= 8) + { + p_getColorMultiplier_3_ = p_getColorMultiplier_3_.down(); + } + } + else if (p_getColorMultiplier_1_ == Blocks.leaves) + { + switch (i & 3) + { + case 0: + customcolors$icolorizer = COLORIZER_FOLIAGE; + break; + + case 1: + customcolors$icolorizer = COLORIZER_FOLIAGE_PINE; + break; + + case 2: + customcolors$icolorizer = COLORIZER_FOLIAGE_BIRCH; + break; + + default: + customcolors$icolorizer = COLORIZER_FOLIAGE; + } + } + else if (p_getColorMultiplier_1_ == Blocks.leaves2) + { + customcolors$icolorizer = COLORIZER_FOLIAGE; + } + else + { + if (p_getColorMultiplier_1_ != Blocks.vine) + { + return -1; + } + + customcolors$icolorizer = COLORIZER_FOLIAGE; + } + } + else + { + customcolors$icolorizer = COLORIZER_GRASS; + } + + return Config.isSmoothBiomes() && !customcolors$icolorizer.isColorConstant() ? getSmoothColorMultiplier(p_getColorMultiplier_2_, p_getColorMultiplier_3_, customcolors$icolorizer, p_getColorMultiplier_4_.getColorizerBlockPosM()) : customcolors$icolorizer.getColor(p_getColorMultiplier_2_, p_getColorMultiplier_3_); + } + } + + protected static BiomeGenBase getColorBiome(IBlockAccess p_getColorBiome_0_, BlockPos p_getColorBiome_1_) + { + BiomeGenBase biomegenbase = p_getColorBiome_0_.getBiomeGenForCoords(p_getColorBiome_1_); + + if (biomegenbase == BiomeGenBase.swampland && !Config.isSwampColors()) + { + biomegenbase = BiomeGenBase.plains; + } + + return biomegenbase; + } + + private static CustomColormap getBlockColormap(IBlockState p_getBlockColormap_0_) + { + if (blockColormaps == null) + { + return null; + } + else if (!(p_getBlockColormap_0_ instanceof BlockStateBase)) + { + return null; + } + else + { + BlockStateBase blockstatebase = (BlockStateBase)p_getBlockColormap_0_; + int i = blockstatebase.getBlockId(); + + if (i >= 0 && i < blockColormaps.length) + { + CustomColormap[] acustomcolormap = blockColormaps[i]; + + if (acustomcolormap == null) + { + return null; + } + else + { + for (int j = 0; j < acustomcolormap.length; ++j) + { + CustomColormap customcolormap = acustomcolormap[j]; + + if (customcolormap.matchesBlock(blockstatebase)) + { + return customcolormap; + } + } + + return null; + } + } + else + { + return null; + } + } + } + + private static int getSmoothColorMultiplier(IBlockAccess p_getSmoothColorMultiplier_0_, BlockPos p_getSmoothColorMultiplier_1_, CustomColors.IColorizer p_getSmoothColorMultiplier_2_, BlockPosM p_getSmoothColorMultiplier_3_) + { + int i = 0; + int j = 0; + int k = 0; + int l = p_getSmoothColorMultiplier_1_.getX(); + int i1 = p_getSmoothColorMultiplier_1_.getY(); + int j1 = p_getSmoothColorMultiplier_1_.getZ(); + BlockPosM blockposm = p_getSmoothColorMultiplier_3_; + + for (int k1 = l - 1; k1 <= l + 1; ++k1) + { + for (int l1 = j1 - 1; l1 <= j1 + 1; ++l1) + { + blockposm.setXyz(k1, i1, l1); + int i2 = p_getSmoothColorMultiplier_2_.getColor(p_getSmoothColorMultiplier_0_, blockposm); + i += i2 >> 16 & 255; + j += i2 >> 8 & 255; + k += i2 & 255; + } + } + + int j2 = i / 9; + int k2 = j / 9; + int l2 = k / 9; + return j2 << 16 | k2 << 8 | l2; + } + + public static int getFluidColor(IBlockAccess p_getFluidColor_0_, IBlockState p_getFluidColor_1_, BlockPos p_getFluidColor_2_, RenderEnv p_getFluidColor_3_) + { + Block block = p_getFluidColor_1_.getBlock(); + CustomColors.IColorizer customcolors$icolorizer = getBlockColormap(p_getFluidColor_1_); + + if (customcolors$icolorizer == null && block.getMaterial() == Material.water) + { + customcolors$icolorizer = COLORIZER_WATER; + } + + return customcolors$icolorizer == null ? block.colorMultiplier(p_getFluidColor_0_, p_getFluidColor_2_) : (Config.isSmoothBiomes() && !customcolors$icolorizer.isColorConstant() ? getSmoothColorMultiplier(p_getFluidColor_0_, p_getFluidColor_2_, customcolors$icolorizer, p_getFluidColor_3_.getColorizerBlockPosM()) : customcolors$icolorizer.getColor(p_getFluidColor_0_, p_getFluidColor_2_)); + } + + public static void updatePortalFX(EntityFX p_updatePortalFX_0_) + { + if (particlePortalColor >= 0) + { + int i = particlePortalColor; + int j = i >> 16 & 255; + int k = i >> 8 & 255; + int l = i & 255; + float f = (float)j / 255.0F; + float f1 = (float)k / 255.0F; + float f2 = (float)l / 255.0F; + p_updatePortalFX_0_.setRBGColorF(f, f1, f2); + } + } + + public static void updateMyceliumFX(EntityFX p_updateMyceliumFX_0_) + { + if (myceliumParticleColors != null) + { + int i = myceliumParticleColors.getColorRandom(); + int j = i >> 16 & 255; + int k = i >> 8 & 255; + int l = i & 255; + float f = (float)j / 255.0F; + float f1 = (float)k / 255.0F; + float f2 = (float)l / 255.0F; + p_updateMyceliumFX_0_.setRBGColorF(f, f1, f2); + } + } + + private static int getRedstoneColor(IBlockState p_getRedstoneColor_0_) + { + if (redstoneColors == null) + { + return -1; + } + else + { + int i = getRedstoneLevel(p_getRedstoneColor_0_, 15); + int j = redstoneColors.getColor(i); + return j; + } + } + + public static void updateReddustFX(EntityFX p_updateReddustFX_0_, IBlockAccess p_updateReddustFX_1_, double p_updateReddustFX_2_, double p_updateReddustFX_4_, double p_updateReddustFX_6_) + { + if (redstoneColors != null) + { + IBlockState iblockstate = p_updateReddustFX_1_.getBlockState(new BlockPos(p_updateReddustFX_2_, p_updateReddustFX_4_, p_updateReddustFX_6_)); + int i = getRedstoneLevel(iblockstate, 15); + int j = redstoneColors.getColor(i); + int k = j >> 16 & 255; + int l = j >> 8 & 255; + int i1 = j & 255; + float f = (float)k / 255.0F; + float f1 = (float)l / 255.0F; + float f2 = (float)i1 / 255.0F; + p_updateReddustFX_0_.setRBGColorF(f, f1, f2); + } + } + + private static int getRedstoneLevel(IBlockState p_getRedstoneLevel_0_, int p_getRedstoneLevel_1_) + { + Block block = p_getRedstoneLevel_0_.getBlock(); + + if (!(block instanceof BlockRedstoneWire)) + { + return p_getRedstoneLevel_1_; + } + else + { + Object object = p_getRedstoneLevel_0_.getValue(BlockRedstoneWire.POWER); + + if (!(object instanceof Integer)) + { + return p_getRedstoneLevel_1_; + } + else + { + Integer integer = (Integer)object; + return integer.intValue(); + } + } + } + + public static float getXpOrbTimer(float p_getXpOrbTimer_0_) + { + if (xpOrbTime <= 0) + { + return p_getXpOrbTimer_0_; + } + else + { + float f = 628.0F / (float)xpOrbTime; + return p_getXpOrbTimer_0_ * f; + } + } + + public static int getXpOrbColor(float p_getXpOrbColor_0_) + { + if (xpOrbColors == null) + { + return -1; + } + else + { + int i = (int)Math.round((double)((MathHelper.sin(p_getXpOrbColor_0_) + 1.0F) * (float)(xpOrbColors.getLength() - 1)) / 2.0D); + int j = xpOrbColors.getColor(i); + return j; + } + } + + public static int getDurabilityColor(int p_getDurabilityColor_0_) + { + if (durabilityColors == null) + { + return -1; + } + else + { + int i = p_getDurabilityColor_0_ * durabilityColors.getLength() / 255; + int j = durabilityColors.getColor(i); + return j; + } + } + + public static void updateWaterFX(EntityFX p_updateWaterFX_0_, IBlockAccess p_updateWaterFX_1_, double p_updateWaterFX_2_, double p_updateWaterFX_4_, double p_updateWaterFX_6_) + { + if (waterColors != null || blockColormaps != null) + { + BlockPos blockpos = new BlockPos(p_updateWaterFX_2_, p_updateWaterFX_4_, p_updateWaterFX_6_); + RenderEnv renderenv = RenderEnv.getInstance(p_updateWaterFX_1_, BLOCK_STATE_WATER, blockpos); + int i = getFluidColor(p_updateWaterFX_1_, BLOCK_STATE_WATER, blockpos, renderenv); + int j = i >> 16 & 255; + int k = i >> 8 & 255; + int l = i & 255; + float f = (float)j / 255.0F; + float f1 = (float)k / 255.0F; + float f2 = (float)l / 255.0F; + + if (particleWaterColor >= 0) + { + int i1 = particleWaterColor >> 16 & 255; + int j1 = particleWaterColor >> 8 & 255; + int k1 = particleWaterColor & 255; + f *= (float)i1 / 255.0F; + f1 *= (float)j1 / 255.0F; + f2 *= (float)k1 / 255.0F; + } + + p_updateWaterFX_0_.setRBGColorF(f, f1, f2); + } + } + + private static int getLilypadColorMultiplier(IBlockAccess p_getLilypadColorMultiplier_0_, BlockPos p_getLilypadColorMultiplier_1_) + { + return lilyPadColor < 0 ? Blocks.waterlily.colorMultiplier(p_getLilypadColorMultiplier_0_, p_getLilypadColorMultiplier_1_) : lilyPadColor; + } + + private static Vec3 getFogColorNether(Vec3 p_getFogColorNether_0_) + { + return fogColorNether == null ? p_getFogColorNether_0_ : fogColorNether; + } + + private static Vec3 getFogColorEnd(Vec3 p_getFogColorEnd_0_) + { + return fogColorEnd == null ? p_getFogColorEnd_0_ : fogColorEnd; + } + + private static Vec3 getSkyColorEnd(Vec3 p_getSkyColorEnd_0_) + { + return skyColorEnd == null ? p_getSkyColorEnd_0_ : skyColorEnd; + } + + public static Vec3 getSkyColor(Vec3 p_getSkyColor_0_, IBlockAccess p_getSkyColor_1_, double p_getSkyColor_2_, double p_getSkyColor_4_, double p_getSkyColor_6_) + { + if (skyColors == null) + { + return p_getSkyColor_0_; + } + else + { + int i = skyColors.getColorSmooth(p_getSkyColor_1_, p_getSkyColor_2_, p_getSkyColor_4_, p_getSkyColor_6_, 3); + int j = i >> 16 & 255; + int k = i >> 8 & 255; + int l = i & 255; + float f = (float)j / 255.0F; + float f1 = (float)k / 255.0F; + float f2 = (float)l / 255.0F; + float f3 = (float)p_getSkyColor_0_.xCoord / 0.5F; + float f4 = (float)p_getSkyColor_0_.yCoord / 0.66275F; + float f5 = (float)p_getSkyColor_0_.zCoord; + f = f * f3; + f1 = f1 * f4; + f2 = f2 * f5; + Vec3 vec3 = skyColorFader.getColor((double)f, (double)f1, (double)f2); + return vec3; + } + } + + private static Vec3 getFogColor(Vec3 p_getFogColor_0_, IBlockAccess p_getFogColor_1_, double p_getFogColor_2_, double p_getFogColor_4_, double p_getFogColor_6_) + { + if (fogColors == null) + { + return p_getFogColor_0_; + } + else + { + int i = fogColors.getColorSmooth(p_getFogColor_1_, p_getFogColor_2_, p_getFogColor_4_, p_getFogColor_6_, 3); + int j = i >> 16 & 255; + int k = i >> 8 & 255; + int l = i & 255; + float f = (float)j / 255.0F; + float f1 = (float)k / 255.0F; + float f2 = (float)l / 255.0F; + float f3 = (float)p_getFogColor_0_.xCoord / 0.753F; + float f4 = (float)p_getFogColor_0_.yCoord / 0.8471F; + float f5 = (float)p_getFogColor_0_.zCoord; + f = f * f3; + f1 = f1 * f4; + f2 = f2 * f5; + Vec3 vec3 = fogColorFader.getColor((double)f, (double)f1, (double)f2); + return vec3; + } + } + + public static Vec3 getUnderwaterColor(IBlockAccess p_getUnderwaterColor_0_, double p_getUnderwaterColor_1_, double p_getUnderwaterColor_3_, double p_getUnderwaterColor_5_) + { + if (underwaterColors == null) + { + return null; + } + else + { + int i = underwaterColors.getColorSmooth(p_getUnderwaterColor_0_, p_getUnderwaterColor_1_, p_getUnderwaterColor_3_, p_getUnderwaterColor_5_, 3); + int j = i >> 16 & 255; + int k = i >> 8 & 255; + int l = i & 255; + float f = (float)j / 255.0F; + float f1 = (float)k / 255.0F; + float f2 = (float)l / 255.0F; + Vec3 vec3 = underwaterColorFader.getColor((double)f, (double)f1, (double)f2); + return vec3; + } + } + + private static int getStemColorMultiplier(Block p_getStemColorMultiplier_0_, IBlockAccess p_getStemColorMultiplier_1_, BlockPos p_getStemColorMultiplier_2_, RenderEnv p_getStemColorMultiplier_3_) + { + CustomColormap customcolormap = stemColors; + + if (p_getStemColorMultiplier_0_ == Blocks.pumpkin_stem && stemPumpkinColors != null) + { + customcolormap = stemPumpkinColors; + } + + if (p_getStemColorMultiplier_0_ == Blocks.melon_stem && stemMelonColors != null) + { + customcolormap = stemMelonColors; + } + + if (customcolormap == null) + { + return -1; + } + else + { + int i = p_getStemColorMultiplier_3_.getMetadata(); + return customcolormap.getColor(i); + } + } + + public static boolean updateLightmap(World p_updateLightmap_0_, float p_updateLightmap_1_, int[] p_updateLightmap_2_, boolean p_updateLightmap_3_) + { + if (p_updateLightmap_0_ == null) + { + return false; + } + else if (lightMapsColorsRgb == null) + { + return false; + } + else + { + int i = p_updateLightmap_0_.provider.getDimensionId(); + int j = i - lightmapMinDimensionId; + + if (j >= 0 && j < lightMapsColorsRgb.length) + { + CustomColormap customcolormap = lightMapsColorsRgb[j]; + + if (customcolormap == null) + { + return false; + } + else + { + int k = customcolormap.getHeight(); + + if (p_updateLightmap_3_ && k < 64) + { + return false; + } + else + { + int l = customcolormap.getWidth(); + + if (l < 16) + { + warn("Invalid lightmap width: " + l + " for dimension: " + i); + lightMapsColorsRgb[j] = null; + return false; + } + else + { + int i1 = 0; + + if (p_updateLightmap_3_) + { + i1 = l * 16 * 2; + } + + float f = 1.1666666F * (p_updateLightmap_0_.getSunBrightness(1.0F) - 0.2F); + + if (p_updateLightmap_0_.getLastLightningBolt() > 0) + { + f = 1.0F; + } + + f = Config.limitTo1(f); + float f1 = f * (float)(l - 1); + float f2 = Config.limitTo1(p_updateLightmap_1_ + 0.5F) * (float)(l - 1); + float f3 = Config.limitTo1(Config.getGameSettings().gammaSetting); + boolean flag = f3 > 1.0E-4F; + float[][] afloat = customcolormap.getColorsRgb(); + getLightMapColumn(afloat, f1, i1, l, sunRgbs); + getLightMapColumn(afloat, f2, i1 + 16 * l, l, torchRgbs); + float[] afloat1 = new float[3]; + + for (int j1 = 0; j1 < 16; ++j1) + { + for (int k1 = 0; k1 < 16; ++k1) + { + for (int l1 = 0; l1 < 3; ++l1) + { + float f4 = Config.limitTo1(sunRgbs[j1][l1] + torchRgbs[k1][l1]); + + if (flag) + { + float f5 = 1.0F - f4; + f5 = 1.0F - f5 * f5 * f5 * f5; + f4 = f3 * f5 + (1.0F - f3) * f4; + } + + afloat1[l1] = f4; + } + + int i2 = (int)(afloat1[0] * 255.0F); + int j2 = (int)(afloat1[1] * 255.0F); + int k2 = (int)(afloat1[2] * 255.0F); + p_updateLightmap_2_[j1 * 16 + k1] = -16777216 | i2 << 16 | j2 << 8 | k2; + } + } + + return true; + } + } + } + } + else + { + return false; + } + } + } + + private static void getLightMapColumn(float[][] p_getLightMapColumn_0_, float p_getLightMapColumn_1_, int p_getLightMapColumn_2_, int p_getLightMapColumn_3_, float[][] p_getLightMapColumn_4_) + { + int i = (int)Math.floor((double)p_getLightMapColumn_1_); + int j = (int)Math.ceil((double)p_getLightMapColumn_1_); + + if (i == j) + { + for (int i1 = 0; i1 < 16; ++i1) + { + float[] afloat3 = p_getLightMapColumn_0_[p_getLightMapColumn_2_ + i1 * p_getLightMapColumn_3_ + i]; + float[] afloat4 = p_getLightMapColumn_4_[i1]; + + for (int j1 = 0; j1 < 3; ++j1) + { + afloat4[j1] = afloat3[j1]; + } + } + } + else + { + float f = 1.0F - (p_getLightMapColumn_1_ - (float)i); + float f1 = 1.0F - ((float)j - p_getLightMapColumn_1_); + + for (int k = 0; k < 16; ++k) + { + float[] afloat = p_getLightMapColumn_0_[p_getLightMapColumn_2_ + k * p_getLightMapColumn_3_ + i]; + float[] afloat1 = p_getLightMapColumn_0_[p_getLightMapColumn_2_ + k * p_getLightMapColumn_3_ + j]; + float[] afloat2 = p_getLightMapColumn_4_[k]; + + for (int l = 0; l < 3; ++l) + { + afloat2[l] = afloat[l] * f + afloat1[l] * f1; + } + } + } + } + + public static Vec3 getWorldFogColor(Vec3 p_getWorldFogColor_0_, WorldClient p_getWorldFogColor_1_, Entity p_getWorldFogColor_2_, float p_getWorldFogColor_3_) + { + int i = p_getWorldFogColor_1_.provider.getDimensionId(); + + switch (i) + { + case -1: + p_getWorldFogColor_0_ = getFogColorNether(p_getWorldFogColor_0_); + break; + + case 0: + Minecraft minecraft = Minecraft.getMinecraft(); + p_getWorldFogColor_0_ = getFogColor(p_getWorldFogColor_0_, minecraft.theWorld, p_getWorldFogColor_2_.posX, p_getWorldFogColor_2_.posY + 1.0D, p_getWorldFogColor_2_.posZ); + break; + + case 1: + p_getWorldFogColor_0_ = getFogColorEnd(p_getWorldFogColor_0_); + } + + return p_getWorldFogColor_0_; + } + + public static Vec3 getWorldSkyColor(Vec3 p_getWorldSkyColor_0_, World p_getWorldSkyColor_1_, Entity p_getWorldSkyColor_2_, float p_getWorldSkyColor_3_) + { + int i = p_getWorldSkyColor_1_.provider.getDimensionId(); + + switch (i) + { + case 0: + Minecraft minecraft = Minecraft.getMinecraft(); + p_getWorldSkyColor_0_ = getSkyColor(p_getWorldSkyColor_0_, minecraft.theWorld, p_getWorldSkyColor_2_.posX, p_getWorldSkyColor_2_.posY + 1.0D, p_getWorldSkyColor_2_.posZ); + break; + + case 1: + p_getWorldSkyColor_0_ = getSkyColorEnd(p_getWorldSkyColor_0_); + } + + return p_getWorldSkyColor_0_; + } + + private static int[] readSpawnEggColors(Properties p_readSpawnEggColors_0_, String p_readSpawnEggColors_1_, String p_readSpawnEggColors_2_, String p_readSpawnEggColors_3_) + { + List list = new ArrayList(); + Set set = p_readSpawnEggColors_0_.keySet(); + int i = 0; + + for (Object s : set) + { + String s1 = p_readSpawnEggColors_0_.getProperty((String) s); + + if (((String) s).startsWith(p_readSpawnEggColors_2_)) + { + String s2 = StrUtils.removePrefix((String) s, p_readSpawnEggColors_2_); + int j = getEntityId(s2); + int k = parseColor(s1); + + if (j >= 0 && k >= 0) + { + while (((List)list).size() <= j) + { + list.add(Integer.valueOf(-1)); + } + + list.set(j, Integer.valueOf(k)); + ++i; + } + else + { + warn("Invalid spawn egg color: " + s + " = " + s1); + } + } + } + + if (i <= 0) + { + return null; + } + else + { + dbg(p_readSpawnEggColors_3_ + " colors: " + i); + int[] aint = new int[list.size()]; + + for (int l = 0; l < aint.length; ++l) + { + aint[l] = ((Integer)list.get(l)).intValue(); + } + + return aint; + } + } + + private static int getSpawnEggColor(ItemMonsterPlacer p_getSpawnEggColor_0_, ItemStack p_getSpawnEggColor_1_, int p_getSpawnEggColor_2_, int p_getSpawnEggColor_3_) + { + int i = p_getSpawnEggColor_1_.getMetadata(); + int[] aint = p_getSpawnEggColor_2_ == 0 ? spawnEggPrimaryColors : spawnEggSecondaryColors; + + if (aint == null) + { + return p_getSpawnEggColor_3_; + } + else if (i >= 0 && i < aint.length) + { + int j = aint[i]; + return j < 0 ? p_getSpawnEggColor_3_ : j; + } + else + { + return p_getSpawnEggColor_3_; + } + } + + public static int getColorFromItemStack(ItemStack p_getColorFromItemStack_0_, int p_getColorFromItemStack_1_, int p_getColorFromItemStack_2_) + { + if (p_getColorFromItemStack_0_ == null) + { + return p_getColorFromItemStack_2_; + } + else + { + Item item = p_getColorFromItemStack_0_.getItem(); + return item == null ? p_getColorFromItemStack_2_ : (item instanceof ItemMonsterPlacer ? getSpawnEggColor((ItemMonsterPlacer)item, p_getColorFromItemStack_0_, p_getColorFromItemStack_1_, p_getColorFromItemStack_2_) : p_getColorFromItemStack_2_); + } + } + + private static float[][] readDyeColors(Properties p_readDyeColors_0_, String p_readDyeColors_1_, String p_readDyeColors_2_, String p_readDyeColors_3_) + { + EnumDyeColor[] aenumdyecolor = EnumDyeColor.values(); + Map map = new HashMap(); + + for (int i = 0; i < aenumdyecolor.length; ++i) + { + EnumDyeColor enumdyecolor = aenumdyecolor[i]; + map.put(enumdyecolor.getName(), enumdyecolor); + } + + float[][] afloat1 = new float[aenumdyecolor.length][]; + int k = 0; + + for (Object s : p_readDyeColors_0_.keySet()) + { + String s1 = p_readDyeColors_0_.getProperty((String) s); + + if (((String) s).startsWith(p_readDyeColors_2_)) + { + String s2 = StrUtils.removePrefix((String) s, p_readDyeColors_2_); + + if (s2.equals("lightBlue")) + { + s2 = "light_blue"; + } + + EnumDyeColor enumdyecolor1 = (EnumDyeColor)map.get(s2); + int j = parseColor(s1); + + if (enumdyecolor1 != null && j >= 0) + { + float[] afloat = new float[] {(float)(j >> 16 & 255) / 255.0F, (float)(j >> 8 & 255) / 255.0F, (float)(j & 255) / 255.0F}; + afloat1[enumdyecolor1.ordinal()] = afloat; + ++k; + } + else + { + warn("Invalid color: " + s + " = " + s1); + } + } + } + + if (k <= 0) + { + return (float[][])null; + } + else + { + dbg(p_readDyeColors_3_ + " colors: " + k); + return afloat1; + } + } + + private static float[] getDyeColors(EnumDyeColor p_getDyeColors_0_, float[][] p_getDyeColors_1_, float[] p_getDyeColors_2_) + { + if (p_getDyeColors_1_ == null) + { + return p_getDyeColors_2_; + } + else if (p_getDyeColors_0_ == null) + { + return p_getDyeColors_2_; + } + else + { + float[] afloat = p_getDyeColors_1_[p_getDyeColors_0_.ordinal()]; + return afloat == null ? p_getDyeColors_2_ : afloat; + } + } + + public static float[] getWolfCollarColors(EnumDyeColor p_getWolfCollarColors_0_, float[] p_getWolfCollarColors_1_) + { + return getDyeColors(p_getWolfCollarColors_0_, wolfCollarColors, p_getWolfCollarColors_1_); + } + + public static float[] getSheepColors(EnumDyeColor p_getSheepColors_0_, float[] p_getSheepColors_1_) + { + return getDyeColors(p_getSheepColors_0_, sheepColors, p_getSheepColors_1_); + } + + private static int[] readTextColors(Properties p_readTextColors_0_, String p_readTextColors_1_, String p_readTextColors_2_, String p_readTextColors_3_) + { + int[] aint = new int[32]; + Arrays.fill((int[])aint, (int) - 1); + int i = 0; + + for (Object s : p_readTextColors_0_.keySet()) + { + String s1 = p_readTextColors_0_.getProperty((String) s); + + if (((String) s).startsWith(p_readTextColors_2_)) + { + String s2 = StrUtils.removePrefix((String) s, p_readTextColors_2_); + int j = Config.parseInt(s2, -1); + int k = parseColor(s1); + + if (j >= 0 && j < aint.length && k >= 0) + { + aint[j] = k; + ++i; + } + else + { + warn("Invalid color: " + s + " = " + s1); + } + } + } + + if (i <= 0) + { + return null; + } + else + { + dbg(p_readTextColors_3_ + " colors: " + i); + return aint; + } + } + + public static int getTextColor(int p_getTextColor_0_, int p_getTextColor_1_) + { + if (textColors == null) + { + return p_getTextColor_1_; + } + else if (p_getTextColor_0_ >= 0 && p_getTextColor_0_ < textColors.length) + { + int i = textColors[p_getTextColor_0_]; + return i < 0 ? p_getTextColor_1_ : i; + } + else + { + return p_getTextColor_1_; + } + } + + private static int[] readMapColors(Properties p_readMapColors_0_, String p_readMapColors_1_, String p_readMapColors_2_, String p_readMapColors_3_) + { + int[] aint = new int[MapColor.mapColorArray.length]; + Arrays.fill((int[])aint, (int) - 1); + int i = 0; + + for (Object s : p_readMapColors_0_.keySet()) + { + String s1 = p_readMapColors_0_.getProperty((String) s); + + if (((String) s).startsWith(p_readMapColors_2_)) + { + String s2 = StrUtils.removePrefix((String) s, p_readMapColors_2_); + int j = getMapColorIndex(s2); + int k = parseColor(s1); + + if (j >= 0 && j < aint.length && k >= 0) + { + aint[j] = k; + ++i; + } + else + { + warn("Invalid color: " + s + " = " + s1); + } + } + } + + if (i <= 0) + { + return null; + } + else + { + dbg(p_readMapColors_3_ + " colors: " + i); + return aint; + } + } + + private static int[] readPotionColors(Properties p_readPotionColors_0_, String p_readPotionColors_1_, String p_readPotionColors_2_, String p_readPotionColors_3_) + { + int[] aint = new int[Potion.potionTypes.length]; + Arrays.fill((int[])aint, (int) - 1); + int i = 0; + + for (Object s : p_readPotionColors_0_.keySet()) + { + String s1 = p_readPotionColors_0_.getProperty((String) s); + + if (((String) s).startsWith(p_readPotionColors_2_)) + { + int j = getPotionId((String) s); + int k = parseColor(s1); + + if (j >= 0 && j < aint.length && k >= 0) + { + aint[j] = k; + ++i; + } + else + { + warn("Invalid color: " + s + " = " + s1); + } + } + } + + if (i <= 0) + { + return null; + } + else + { + dbg(p_readPotionColors_3_ + " colors: " + i); + return aint; + } + } + + private static int getPotionId(String p_getPotionId_0_) + { + if (p_getPotionId_0_.equals("potion.water")) + { + return 0; + } + else + { + Potion[] apotion = Potion.potionTypes; + + for (int i = 0; i < apotion.length; ++i) + { + Potion potion = apotion[i]; + + if (potion != null && potion.getName().equals(p_getPotionId_0_)) + { + return potion.getId(); + } + } + + return -1; + } + } + + public static int getPotionColor(int p_getPotionColor_0_, int p_getPotionColor_1_) + { + if (potionColors == null) + { + return p_getPotionColor_1_; + } + else if (p_getPotionColor_0_ >= 0 && p_getPotionColor_0_ < potionColors.length) + { + int i = potionColors[p_getPotionColor_0_]; + return i < 0 ? p_getPotionColor_1_ : i; + } + else + { + return p_getPotionColor_1_; + } + } + + private static int getMapColorIndex(String p_getMapColorIndex_0_) + { + return p_getMapColorIndex_0_ == null ? -1 : (p_getMapColorIndex_0_.equals("air") ? MapColor.airColor.colorIndex : (p_getMapColorIndex_0_.equals("grass") ? MapColor.grassColor.colorIndex : (p_getMapColorIndex_0_.equals("sand") ? MapColor.sandColor.colorIndex : (p_getMapColorIndex_0_.equals("cloth") ? MapColor.clothColor.colorIndex : (p_getMapColorIndex_0_.equals("tnt") ? MapColor.tntColor.colorIndex : (p_getMapColorIndex_0_.equals("ice") ? MapColor.iceColor.colorIndex : (p_getMapColorIndex_0_.equals("iron") ? MapColor.ironColor.colorIndex : (p_getMapColorIndex_0_.equals("foliage") ? MapColor.foliageColor.colorIndex : (p_getMapColorIndex_0_.equals("clay") ? MapColor.clayColor.colorIndex : (p_getMapColorIndex_0_.equals("dirt") ? MapColor.dirtColor.colorIndex : (p_getMapColorIndex_0_.equals("stone") ? MapColor.stoneColor.colorIndex : (p_getMapColorIndex_0_.equals("water") ? MapColor.waterColor.colorIndex : (p_getMapColorIndex_0_.equals("wood") ? MapColor.woodColor.colorIndex : (p_getMapColorIndex_0_.equals("quartz") ? MapColor.quartzColor.colorIndex : (p_getMapColorIndex_0_.equals("gold") ? MapColor.goldColor.colorIndex : (p_getMapColorIndex_0_.equals("diamond") ? MapColor.diamondColor.colorIndex : (p_getMapColorIndex_0_.equals("lapis") ? MapColor.lapisColor.colorIndex : (p_getMapColorIndex_0_.equals("emerald") ? MapColor.emeraldColor.colorIndex : (p_getMapColorIndex_0_.equals("podzol") ? MapColor.obsidianColor.colorIndex : (p_getMapColorIndex_0_.equals("netherrack") ? MapColor.netherrackColor.colorIndex : (!p_getMapColorIndex_0_.equals("snow") && !p_getMapColorIndex_0_.equals("white") ? (!p_getMapColorIndex_0_.equals("adobe") && !p_getMapColorIndex_0_.equals("orange") ? (p_getMapColorIndex_0_.equals("magenta") ? MapColor.magentaColor.colorIndex : (!p_getMapColorIndex_0_.equals("light_blue") && !p_getMapColorIndex_0_.equals("lightBlue") ? (p_getMapColorIndex_0_.equals("yellow") ? MapColor.yellowColor.colorIndex : (p_getMapColorIndex_0_.equals("lime") ? MapColor.limeColor.colorIndex : (p_getMapColorIndex_0_.equals("pink") ? MapColor.pinkColor.colorIndex : (p_getMapColorIndex_0_.equals("gray") ? MapColor.grayColor.colorIndex : (p_getMapColorIndex_0_.equals("silver") ? MapColor.silverColor.colorIndex : (p_getMapColorIndex_0_.equals("cyan") ? MapColor.cyanColor.colorIndex : (p_getMapColorIndex_0_.equals("purple") ? MapColor.purpleColor.colorIndex : (p_getMapColorIndex_0_.equals("blue") ? MapColor.blueColor.colorIndex : (p_getMapColorIndex_0_.equals("brown") ? MapColor.brownColor.colorIndex : (p_getMapColorIndex_0_.equals("green") ? MapColor.greenColor.colorIndex : (p_getMapColorIndex_0_.equals("red") ? MapColor.redColor.colorIndex : (p_getMapColorIndex_0_.equals("black") ? MapColor.blackColor.colorIndex : -1)))))))))))) : MapColor.lightBlueColor.colorIndex)) : MapColor.adobeColor.colorIndex) : MapColor.snowColor.colorIndex))))))))))))))))))))); + } + + private static int[] getMapColors() + { + MapColor[] amapcolor = MapColor.mapColorArray; + int[] aint = new int[amapcolor.length]; + Arrays.fill((int[])aint, (int) - 1); + + for (int i = 0; i < amapcolor.length && i < aint.length; ++i) + { + MapColor mapcolor = amapcolor[i]; + + if (mapcolor != null) + { + aint[i] = mapcolor.colorValue; + } + } + + return aint; + } + + private static void setMapColors(int[] p_setMapColors_0_) + { + if (p_setMapColors_0_ != null) + { + MapColor[] amapcolor = MapColor.mapColorArray; + boolean flag = false; + + for (int i = 0; i < amapcolor.length && i < p_setMapColors_0_.length; ++i) + { + MapColor mapcolor = amapcolor[i]; + + if (mapcolor != null) + { + int j = p_setMapColors_0_[i]; + + if (j >= 0 && mapcolor.colorValue != j) + { + mapcolor.colorValue = j; + flag = true; + } + } + } + + if (flag) + { + Minecraft.getMinecraft().getTextureManager().reloadBannerTextures(); + } + } + } + + private static int getEntityId(String p_getEntityId_0_) + { + if (p_getEntityId_0_ == null) + { + return -1; + } + else + { + int i = EntityList.getIDFromString(p_getEntityId_0_); + + if (i < 0) + { + return -1; + } + else + { + String s = EntityList.getStringFromID(i); + return !Config.equals(p_getEntityId_0_, s) ? -1 : i; + } + } + } + + private static void dbg(String p_dbg_0_) + { + Config.dbg("CustomColors: " + p_dbg_0_); + } + + private static void warn(String p_warn_0_) + { + Config.warn("CustomColors: " + p_warn_0_); + } + + public static int getExpBarTextColor(int p_getExpBarTextColor_0_) + { + return expBarTextColor < 0 ? p_getExpBarTextColor_0_ : expBarTextColor; + } + + public static int getBossTextColor(int p_getBossTextColor_0_) + { + return bossTextColor < 0 ? p_getBossTextColor_0_ : bossTextColor; + } + + public static int getSignTextColor(int p_getSignTextColor_0_) + { + return signTextColor < 0 ? p_getSignTextColor_0_ : signTextColor; + } + + public interface IColorizer + { + int getColor(IBlockAccess var1, BlockPos var2); + + boolean isColorConstant(); + } +} diff --git a/src/minecraft/optifine/CustomItemProperties.java b/src/minecraft/optifine/CustomItemProperties.java new file mode 100644 index 0000000..0099ec1 --- /dev/null +++ b/src/minecraft/optifine/CustomItemProperties.java @@ -0,0 +1,908 @@ +package optifine; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.TreeSet; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.BlockPart; +import net.minecraft.client.renderer.block.model.BlockPartFace; +import net.minecraft.client.renderer.block.model.FaceBakery; +import net.minecraft.client.renderer.block.model.ItemModelGenerator; +import net.minecraft.client.renderer.block.model.ModelBlock; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.client.resources.model.ModelRotation; +import net.minecraft.client.resources.model.SimpleBakedModel; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class CustomItemProperties +{ + public String name = null; + public String basePath = null; + public int type = 1; + public int[] items = null; + public String texture = null; + public Map mapTextures = null; + public RangeListInt damage = null; + public boolean damagePercent = false; + public int damageMask = 0; + public RangeListInt stackSize = null; + public RangeListInt enchantmentIds = null; + public RangeListInt enchantmentLevels = null; + public NbtTagValue[] nbtTagValues = null; + public int blend = 1; + public float speed = 0.0F; + public float rotation = 0.0F; + public int layer = 0; + public float duration = 1.0F; + public int weight = 0; + public ResourceLocation textureLocation = null; + public Map mapTextureLocations = null; + public TextureAtlasSprite sprite = null; + public Map mapSprites = null; + public IBakedModel model = null; + public Map mapModels = null; + private int textureWidth = 0; + private int textureHeight = 0; + public static final int TYPE_UNKNOWN = 0; + public static final int TYPE_ITEM = 1; + public static final int TYPE_ENCHANTMENT = 2; + public static final int TYPE_ARMOR = 3; + + public CustomItemProperties(Properties p_i34_1_, String p_i34_2_) + { + this.name = parseName(p_i34_2_); + this.basePath = parseBasePath(p_i34_2_); + this.type = this.parseType(p_i34_1_.getProperty("type")); + this.items = this.parseItems(p_i34_1_.getProperty("items"), p_i34_1_.getProperty("matchItems")); + this.mapTextures = parseTextures(p_i34_1_, this.basePath); + this.texture = parseTexture(p_i34_1_.getProperty("texture"), p_i34_1_.getProperty("tile"), p_i34_1_.getProperty("source"), p_i34_2_, this.basePath, this.type, this.mapTextures); + String s = p_i34_1_.getProperty("damage"); + + if (s != null) + { + this.damagePercent = s.contains("%"); + s.replace("%", ""); + this.damage = this.parseRangeListInt(s); + this.damageMask = this.parseInt(p_i34_1_.getProperty("damageMask"), 0); + } + + this.stackSize = this.parseRangeListInt(p_i34_1_.getProperty("stackSize")); + this.enchantmentIds = this.parseRangeListInt(p_i34_1_.getProperty("enchantmentIDs")); + this.enchantmentLevels = this.parseRangeListInt(p_i34_1_.getProperty("enchantmentLevels")); + this.nbtTagValues = this.parseNbtTagValues(p_i34_1_); + this.blend = Blender.parseBlend(p_i34_1_.getProperty("blend")); + this.speed = this.parseFloat(p_i34_1_.getProperty("speed"), 0.0F); + this.rotation = this.parseFloat(p_i34_1_.getProperty("rotation"), 0.0F); + this.layer = this.parseInt(p_i34_1_.getProperty("layer"), 0); + this.weight = this.parseInt(p_i34_1_.getProperty("weight"), 0); + this.duration = this.parseFloat(p_i34_1_.getProperty("duration"), 1.0F); + } + + private static String parseName(String p_parseName_0_) + { + String s = p_parseName_0_; + int i = p_parseName_0_.lastIndexOf(47); + + if (i >= 0) + { + s = p_parseName_0_.substring(i + 1); + } + + int j = s.lastIndexOf(46); + + if (j >= 0) + { + s = s.substring(0, j); + } + + return s; + } + + private static String parseBasePath(String p_parseBasePath_0_) + { + int i = p_parseBasePath_0_.lastIndexOf(47); + return i < 0 ? "" : p_parseBasePath_0_.substring(0, i); + } + + private int parseType(String p_parseType_1_) + { + if (p_parseType_1_ == null) + { + return 1; + } + else if (p_parseType_1_.equals("item")) + { + return 1; + } + else if (p_parseType_1_.equals("enchantment")) + { + return 2; + } + else if (p_parseType_1_.equals("armor")) + { + return 3; + } + else + { + Config.warn("Unknown method: " + p_parseType_1_); + return 0; + } + } + + private int[] parseItems(String p_parseItems_1_, String p_parseItems_2_) + { + if (p_parseItems_1_ == null) + { + p_parseItems_1_ = p_parseItems_2_; + } + + if (p_parseItems_1_ == null) + { + return null; + } + else + { + p_parseItems_1_ = p_parseItems_1_.trim(); + Set set = new TreeSet(); + String[] astring = Config.tokenize(p_parseItems_1_, " "); + label45: + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + int j = Config.parseInt(s, -1); + + if (j >= 0) + { + set.add(new Integer(j)); + } + else + { + if (s.contains("-")) + { + String[] astring1 = Config.tokenize(s, "-"); + + if (astring1.length == 2) + { + int k = Config.parseInt(astring1[0], -1); + int l = Config.parseInt(astring1[1], -1); + + if (k >= 0 && l >= 0) + { + int i1 = Math.min(k, l); + int j1 = Math.max(k, l); + int k1 = i1; + + while (true) + { + if (k1 > j1) + { + continue label45; + } + + set.add(new Integer(k1)); + ++k1; + } + } + } + } + + Item item = Item.getByNameOrId(s); + + if (item == null) + { + Config.warn("Item not found: " + s); + } + else + { + int i2 = Item.getIdFromItem(item); + + if (i2 < 0) + { + Config.warn("Item not found: " + s); + } + else + { + set.add(new Integer(i2)); + } + } + } + } + + Integer[] ainteger = (Integer[])((Integer[])set.toArray(new Integer[set.size()])); + int[] aint = new int[ainteger.length]; + + for (int l1 = 0; l1 < aint.length; ++l1) + { + aint[l1] = ainteger[l1].intValue(); + } + + return aint; + } + } + + private static String parseTexture(String p_parseTexture_0_, String p_parseTexture_1_, String p_parseTexture_2_, String p_parseTexture_3_, String p_parseTexture_4_, int p_parseTexture_5_, Map p_parseTexture_6_) + { + if (p_parseTexture_0_ == null) + { + p_parseTexture_0_ = p_parseTexture_1_; + } + + if (p_parseTexture_0_ == null) + { + p_parseTexture_0_ = p_parseTexture_2_; + } + + if (p_parseTexture_0_ != null) + { + String s2 = ".png"; + + if (p_parseTexture_0_.endsWith(s2)) + { + p_parseTexture_0_ = p_parseTexture_0_.substring(0, p_parseTexture_0_.length() - s2.length()); + } + + p_parseTexture_0_ = fixTextureName(p_parseTexture_0_, p_parseTexture_4_); + return p_parseTexture_0_; + } + else if (p_parseTexture_5_ == 3) + { + return null; + } + else + { + if (p_parseTexture_6_ != null) + { + String s = (String)p_parseTexture_6_.get("texture.bow_standby"); + + if (s != null) + { + return s; + } + } + + String s1 = p_parseTexture_3_; + int i = p_parseTexture_3_.lastIndexOf(47); + + if (i >= 0) + { + s1 = p_parseTexture_3_.substring(i + 1); + } + + int j = s1.lastIndexOf(46); + + if (j >= 0) + { + s1 = s1.substring(0, j); + } + + s1 = fixTextureName(s1, p_parseTexture_4_); + return s1; + } + } + + private static Map parseTextures(Properties p_parseTextures_0_, String p_parseTextures_1_) + { + String s = "texture."; + Map map = getMatchingProperties(p_parseTextures_0_, s); + + if (map.size() <= 0) + { + return null; + } + else + { + Set set = map.keySet(); + Map map1 = new LinkedHashMap(); + + for (Object s1 : set) + { + String s2 = (String)map.get(s1); + s2 = fixTextureName(s2, p_parseTextures_1_); + map1.put(s1, s2); + } + + return map1; + } + } + + private static String fixTextureName(String p_fixTextureName_0_, String p_fixTextureName_1_) + { + p_fixTextureName_0_ = TextureUtils.fixResourcePath(p_fixTextureName_0_, p_fixTextureName_1_); + + if (!p_fixTextureName_0_.startsWith(p_fixTextureName_1_) && !p_fixTextureName_0_.startsWith("textures/") && !p_fixTextureName_0_.startsWith("mcpatcher/")) + { + p_fixTextureName_0_ = p_fixTextureName_1_ + "/" + p_fixTextureName_0_; + } + + if (p_fixTextureName_0_.endsWith(".png")) + { + p_fixTextureName_0_ = p_fixTextureName_0_.substring(0, p_fixTextureName_0_.length() - 4); + } + + String s = "textures/blocks/"; + + if (p_fixTextureName_0_.startsWith(s)) + { + p_fixTextureName_0_ = p_fixTextureName_0_.substring(s.length()); + } + + if (p_fixTextureName_0_.startsWith("/")) + { + p_fixTextureName_0_ = p_fixTextureName_0_.substring(1); + } + + return p_fixTextureName_0_; + } + + private int parseInt(String p_parseInt_1_, int p_parseInt_2_) + { + if (p_parseInt_1_ == null) + { + return p_parseInt_2_; + } + else + { + p_parseInt_1_ = p_parseInt_1_.trim(); + int i = Config.parseInt(p_parseInt_1_, Integer.MIN_VALUE); + + if (i == Integer.MIN_VALUE) + { + Config.warn("Invalid integer: " + p_parseInt_1_); + return p_parseInt_2_; + } + else + { + return i; + } + } + } + + private float parseFloat(String p_parseFloat_1_, float p_parseFloat_2_) + { + if (p_parseFloat_1_ == null) + { + return p_parseFloat_2_; + } + else + { + p_parseFloat_1_ = p_parseFloat_1_.trim(); + float f = Config.parseFloat(p_parseFloat_1_, Float.MIN_VALUE); + + if (f == Float.MIN_VALUE) + { + Config.warn("Invalid float: " + p_parseFloat_1_); + return p_parseFloat_2_; + } + else + { + return f; + } + } + } + + private RangeListInt parseRangeListInt(String p_parseRangeListInt_1_) + { + if (p_parseRangeListInt_1_ == null) + { + return null; + } + else + { + String[] astring = Config.tokenize(p_parseRangeListInt_1_, " "); + RangeListInt rangelistint = new RangeListInt(); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + RangeInt rangeint = this.parseRangeInt(s); + + if (rangeint == null) + { + Config.warn("Invalid range list: " + p_parseRangeListInt_1_); + return null; + } + + rangelistint.addRange(rangeint); + } + + return rangelistint; + } + } + + private RangeInt parseRangeInt(String p_parseRangeInt_1_) + { + if (p_parseRangeInt_1_ == null) + { + return null; + } + else + { + p_parseRangeInt_1_ = p_parseRangeInt_1_.trim(); + int i = p_parseRangeInt_1_.length() - p_parseRangeInt_1_.replace("-", "").length(); + + if (i > 1) + { + Config.warn("Invalid range: " + p_parseRangeInt_1_); + return null; + } + else + { + String[] astring = Config.tokenize(p_parseRangeInt_1_, "- "); + int[] aint = new int[astring.length]; + + for (int j = 0; j < astring.length; ++j) + { + String s = astring[j]; + int k = Config.parseInt(s, -1); + + if (k < 0) + { + Config.warn("Invalid range: " + p_parseRangeInt_1_); + return null; + } + + aint[j] = k; + } + + if (aint.length == 1) + { + int i1 = aint[0]; + + if (p_parseRangeInt_1_.startsWith("-")) + { + return new RangeInt(0, i1); + } + else if (p_parseRangeInt_1_.endsWith("-")) + { + return new RangeInt(i1, 255); + } + else + { + return new RangeInt(i1, i1); + } + } + else if (aint.length == 2) + { + int l = Math.min(aint[0], aint[1]); + int j1 = Math.max(aint[0], aint[1]); + return new RangeInt(l, j1); + } + else + { + Config.warn("Invalid range: " + p_parseRangeInt_1_); + return null; + } + } + } + } + + private NbtTagValue[] parseNbtTagValues(Properties p_parseNbtTagValues_1_) + { + String s = "nbt."; + Map map = getMatchingProperties(p_parseNbtTagValues_1_, s); + + if (map.size() <= 0) + { + return null; + } + else + { + List list = new ArrayList(); + + for (Object s1 : map.keySet()) + { + String s2 = (String)map.get(s1); + String s3 = ((String) s1).substring(s.length()); + NbtTagValue nbttagvalue = new NbtTagValue(s3, s2); + list.add(nbttagvalue); + } + + NbtTagValue[] anbttagvalue = (NbtTagValue[])((NbtTagValue[])list.toArray(new NbtTagValue[list.size()])); + return anbttagvalue; + } + } + + private static Map getMatchingProperties(Properties p_getMatchingProperties_0_, String p_getMatchingProperties_1_) + { + Map map = new LinkedHashMap(); + + for (Object s : p_getMatchingProperties_0_.keySet()) + { + String s1 = p_getMatchingProperties_0_.getProperty((String) s); + + if (((String) s).startsWith(p_getMatchingProperties_1_)) + { + map.put(s, s1); + } + } + + return map; + } + + public boolean isValid(String p_isValid_1_) + { + if (this.name != null && this.name.length() > 0) + { + if (this.basePath == null) + { + Config.warn("No base path found: " + p_isValid_1_); + return false; + } + else if (this.type == 0) + { + Config.warn("No type defined: " + p_isValid_1_); + return false; + } + else if ((this.type == 1 || this.type == 3) && this.items == null) + { + Config.warn("No items defined: " + p_isValid_1_); + return false; + } + else if (this.texture == null && this.mapTextures == null) + { + Config.warn("No texture specified: " + p_isValid_1_); + return false; + } + else if (this.type == 2 && this.enchantmentIds == null) + { + Config.warn("No enchantmentIDs specified: " + p_isValid_1_); + return false; + } + else + { + return true; + } + } + else + { + Config.warn("No name found: " + p_isValid_1_); + return false; + } + } + + public void updateIcons(TextureMap p_updateIcons_1_) + { + if (this.texture != null) + { + this.textureLocation = this.getTextureLocation(this.texture); + + if (this.type == 1) + { + ResourceLocation resourcelocation = this.getSpriteLocation(this.textureLocation); + this.sprite = p_updateIcons_1_.registerSprite(resourcelocation); + } + } + + if (this.mapTextures != null) + { + this.mapTextureLocations = new HashMap(); + this.mapSprites = new HashMap(); + + for (String s : this.mapTextures.keySet()) + { + String s1 = (String)this.mapTextures.get(s); + ResourceLocation resourcelocation1 = this.getTextureLocation(s1); + this.mapTextureLocations.put(s, resourcelocation1); + + if (this.type == 1) + { + ResourceLocation resourcelocation2 = this.getSpriteLocation(resourcelocation1); + TextureAtlasSprite textureatlassprite = p_updateIcons_1_.registerSprite(resourcelocation2); + this.mapSprites.put(s, textureatlassprite); + } + } + } + } + + private ResourceLocation getTextureLocation(String p_getTextureLocation_1_) + { + if (p_getTextureLocation_1_ == null) + { + return null; + } + else + { + ResourceLocation resourcelocation = new ResourceLocation(p_getTextureLocation_1_); + String s = resourcelocation.getResourceDomain(); + String s1 = resourcelocation.getResourcePath(); + + if (!s1.contains("/")) + { + s1 = "textures/blocks/" + s1; + } + + String s2 = s1 + ".png"; + ResourceLocation resourcelocation1 = new ResourceLocation(s, s2); + boolean flag = Config.hasResource(resourcelocation1); + + if (!flag) + { + Config.warn("File not found: " + s2); + } + + return resourcelocation1; + } + } + + private ResourceLocation getSpriteLocation(ResourceLocation p_getSpriteLocation_1_) + { + String s = p_getSpriteLocation_1_.getResourcePath(); + s = StrUtils.removePrefix(s, "textures/"); + s = StrUtils.removeSuffix(s, ".png"); + ResourceLocation resourcelocation = new ResourceLocation(p_getSpriteLocation_1_.getResourceDomain(), s); + return resourcelocation; + } + + public void updateModel(TextureMap p_updateModel_1_, ItemModelGenerator p_updateModel_2_) + { + String[] astring = this.getModelTextures(); + boolean flag = this.isUseTint(); + this.model = makeBakedModel(p_updateModel_1_, p_updateModel_2_, astring, flag); + + if (this.type == 1 && this.mapTextures != null) + { + for (String s : this.mapTextures.keySet()) + { + String s1 = (String)this.mapTextures.get(s); + String s2 = StrUtils.removePrefix(s, "texture."); + + if (s2.startsWith("bow") || s2.startsWith("fishing_rod")) + { + String[] astring1 = new String[] {s1}; + IBakedModel ibakedmodel = makeBakedModel(p_updateModel_1_, p_updateModel_2_, astring1, flag); + + if (this.mapModels == null) + { + this.mapModels = new HashMap(); + } + + this.mapModels.put(s2, ibakedmodel); + } + } + } + } + + private boolean isUseTint() + { + return true; + } + + private static IBakedModel makeBakedModel(TextureMap p_makeBakedModel_0_, ItemModelGenerator p_makeBakedModel_1_, String[] p_makeBakedModel_2_, boolean p_makeBakedModel_3_) + { + ModelBlock modelblock = makeModelBlock(p_makeBakedModel_2_); + ModelBlock modelblock1 = p_makeBakedModel_1_.makeItemModel(p_makeBakedModel_0_, modelblock); + IBakedModel ibakedmodel = bakeModel(p_makeBakedModel_0_, modelblock1, p_makeBakedModel_3_); + return ibakedmodel; + } + + private String[] getModelTextures() + { + if (this.type == 1 && this.items.length == 1) + { + Item item = Item.getItemById(this.items[0]); + + if (item == Items.potionitem && this.damage != null && this.damage.getCountRanges() > 0) + { + RangeInt rangeint = this.damage.getRange(0); + int i = rangeint.getMin(); + boolean flag = (i & 16384) != 0; + String s5 = this.getMapTexture(this.mapTextures, "texture.potion_overlay", "items/potion_overlay"); + String s6 = null; + + if (flag) + { + s6 = this.getMapTexture(this.mapTextures, "texture.potion_bottle_splash", "items/potion_bottle_splash"); + } + else + { + s6 = this.getMapTexture(this.mapTextures, "texture.potion_bottle_drinkable", "items/potion_bottle_drinkable"); + } + + return new String[] {s5, s6}; + } + + if (item instanceof ItemArmor) + { + ItemArmor itemarmor = (ItemArmor)item; + + if (itemarmor.getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER) + { + String s = "leather"; + String s1 = "helmet"; + + if (itemarmor.armorType == 0) + { + s1 = "helmet"; + } + + if (itemarmor.armorType == 1) + { + s1 = "chestplate"; + } + + if (itemarmor.armorType == 2) + { + s1 = "leggings"; + } + + if (itemarmor.armorType == 3) + { + s1 = "boots"; + } + + String s2 = s + "_" + s1; + String s3 = this.getMapTexture(this.mapTextures, "texture." + s2, "items/" + s2); + String s4 = this.getMapTexture(this.mapTextures, "texture." + s2 + "_overlay", "items/" + s2 + "_overlay"); + return new String[] {s3, s4}; + } + } + } + + return new String[] {this.texture}; + } + + private String getMapTexture(Map p_getMapTexture_1_, String p_getMapTexture_2_, String p_getMapTexture_3_) + { + if (p_getMapTexture_1_ == null) + { + return p_getMapTexture_3_; + } + else + { + String s = (String)p_getMapTexture_1_.get(p_getMapTexture_2_); + return s == null ? p_getMapTexture_3_ : s; + } + } + + private static ModelBlock makeModelBlock(String[] p_makeModelBlock_0_) + { + StringBuffer stringbuffer = new StringBuffer(); + stringbuffer.append("{\"parent\": \"builtin/generated\",\"textures\": {"); + + for (int i = 0; i < p_makeModelBlock_0_.length; ++i) + { + String s = p_makeModelBlock_0_[i]; + + if (i > 0) + { + stringbuffer.append(", "); + } + + stringbuffer.append("\"layer" + i + "\": \"" + s + "\""); + } + + stringbuffer.append("}}"); + String s1 = stringbuffer.toString(); + ModelBlock modelblock = ModelBlock.deserialize(s1); + return modelblock; + } + + private static IBakedModel bakeModel(TextureMap p_bakeModel_0_, ModelBlock p_bakeModel_1_, boolean p_bakeModel_2_) + { + ModelRotation modelrotation = ModelRotation.X0_Y0; + boolean flag = false; + TextureAtlasSprite textureatlassprite = p_bakeModel_0_.getSpriteSafe(p_bakeModel_1_.resolveTextureName("particle")); + SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(p_bakeModel_1_)).setTexture(textureatlassprite); + + for (BlockPart blockpart : p_bakeModel_1_.getElements()) + { + for (EnumFacing enumfacing : blockpart.mapFaces.keySet()) + { + BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); + + if (!p_bakeModel_2_) + { + blockpartface = new BlockPartFace(blockpartface.cullFace, -1, blockpartface.texture, blockpartface.blockFaceUV); + } + + TextureAtlasSprite textureatlassprite1 = p_bakeModel_0_.getSpriteSafe(p_bakeModel_1_.resolveTextureName(blockpartface.texture)); + BakedQuad bakedquad = makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelrotation, flag); + + if (blockpartface.cullFace == null) + { + simplebakedmodel$builder.addGeneralQuad(bakedquad); + } + else + { + simplebakedmodel$builder.addFaceQuad(modelrotation.rotateFace(blockpartface.cullFace), bakedquad); + } + } + } + + return simplebakedmodel$builder.makeBakedModel(); + } + + private static BakedQuad makeBakedQuad(BlockPart p_makeBakedQuad_0_, BlockPartFace p_makeBakedQuad_1_, TextureAtlasSprite p_makeBakedQuad_2_, EnumFacing p_makeBakedQuad_3_, ModelRotation p_makeBakedQuad_4_, boolean p_makeBakedQuad_5_) + { + FaceBakery facebakery = new FaceBakery(); + return facebakery.makeBakedQuad(p_makeBakedQuad_0_.positionFrom, p_makeBakedQuad_0_.positionTo, p_makeBakedQuad_1_, p_makeBakedQuad_2_, p_makeBakedQuad_3_, p_makeBakedQuad_4_, p_makeBakedQuad_0_.partRotation, p_makeBakedQuad_5_, p_makeBakedQuad_0_.shade); + } + + public String toString() + { + return "" + this.basePath + "/" + this.name + ", type: " + this.type + ", items: [" + Config.arrayToString(this.items) + "], textture: " + this.texture; + } + + public float getTextureWidth(TextureManager p_getTextureWidth_1_) + { + if (this.textureWidth <= 0) + { + if (this.textureLocation != null) + { + ITextureObject itextureobject = p_getTextureWidth_1_.getTexture(this.textureLocation); + int i = itextureobject.getGlTextureId(); + int j = GlStateManager.getBoundTexture(); + GlStateManager.bindTexture(i); + this.textureWidth = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); + GlStateManager.bindTexture(j); + } + + if (this.textureWidth <= 0) + { + this.textureWidth = 16; + } + } + + return (float)this.textureWidth; + } + + public float getTextureHeight(TextureManager p_getTextureHeight_1_) + { + if (this.textureHeight <= 0) + { + if (this.textureLocation != null) + { + ITextureObject itextureobject = p_getTextureHeight_1_.getTexture(this.textureLocation); + int i = itextureobject.getGlTextureId(); + int j = GlStateManager.getBoundTexture(); + GlStateManager.bindTexture(i); + this.textureHeight = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT); + GlStateManager.bindTexture(j); + } + + if (this.textureHeight <= 0) + { + this.textureHeight = 16; + } + } + + return (float)this.textureHeight; + } + + public IBakedModel getModel(ModelResourceLocation p_getModel_1_) + { + if (p_getModel_1_ != null && this.mapTextures != null) + { + String s = p_getModel_1_.getResourcePath(); + + if (this.mapModels != null) + { + IBakedModel ibakedmodel = (IBakedModel)this.mapModels.get(s); + + if (ibakedmodel != null) + { + return ibakedmodel; + } + } + } + + return this.model; + } +} diff --git a/src/minecraft/optifine/CustomItems.java b/src/minecraft/optifine/CustomItems.java new file mode 100644 index 0000000..e095c49 --- /dev/null +++ b/src/minecraft/optifine/CustomItems.java @@ -0,0 +1,954 @@ +package optifine; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.ItemModelGenerator; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.potion.Potion; +import net.minecraft.util.ResourceLocation; +import shadersmod.client.Shaders; +import shadersmod.client.ShadersRender; + +public class CustomItems +{ + private static CustomItemProperties[][] itemProperties = (CustomItemProperties[][])null; + private static CustomItemProperties[][] enchantmentProperties = (CustomItemProperties[][])null; + private static Map mapPotionIds = null; + private static ItemModelGenerator itemModelGenerator = new ItemModelGenerator(); + private static boolean useGlint = true; + public static final int MASK_POTION_SPLASH = 16384; + public static final int MASK_POTION_NAME = 63; + public static final String KEY_TEXTURE_OVERLAY = "texture.potion_overlay"; + public static final String KEY_TEXTURE_SPLASH = "texture.potion_bottle_splash"; + public static final String KEY_TEXTURE_DRINKABLE = "texture.potion_bottle_drinkable"; + public static final String DEFAULT_TEXTURE_OVERLAY = "items/potion_overlay"; + public static final String DEFAULT_TEXTURE_SPLASH = "items/potion_bottle_splash"; + public static final String DEFAULT_TEXTURE_DRINKABLE = "items/potion_bottle_drinkable"; + private static final int[] EMPTY_INT_ARRAY = new int[0]; + private static final int[][] EMPTY_INT2_ARRAY = new int[0][]; + + public static void updateIcons(TextureMap p_updateIcons_0_) + { + itemProperties = (CustomItemProperties[][])null; + enchantmentProperties = (CustomItemProperties[][])null; + useGlint = true; + + if (Config.isCustomItems()) + { + readCitProperties("mcpatcher/cit.properties"); + IResourcePack[] airesourcepack = Config.getResourcePacks(); + + for (int i = airesourcepack.length - 1; i >= 0; --i) + { + IResourcePack iresourcepack = airesourcepack[i]; + updateIcons(p_updateIcons_0_, iresourcepack); + } + + updateIcons(p_updateIcons_0_, Config.getDefaultResourcePack()); + + if (itemProperties.length <= 0) + { + itemProperties = (CustomItemProperties[][])null; + } + + if (enchantmentProperties.length <= 0) + { + enchantmentProperties = (CustomItemProperties[][])null; + } + } + } + + private static void readCitProperties(String p_readCitProperties_0_) + { + try + { + ResourceLocation resourcelocation = new ResourceLocation(p_readCitProperties_0_); + InputStream inputstream = Config.getResourceStream(resourcelocation); + + if (inputstream == null) + { + return; + } + + Config.dbg("CustomItems: Loading " + p_readCitProperties_0_); + Properties properties = new Properties(); + properties.load(inputstream); + inputstream.close(); + useGlint = Config.parseBoolean(properties.getProperty("useGlint"), true); + } + catch (FileNotFoundException var4) + { + return; + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + + private static void updateIcons(TextureMap p_updateIcons_0_, IResourcePack p_updateIcons_1_) + { + String[] astring = ResUtils.collectFiles(p_updateIcons_1_, (String)"mcpatcher/cit/", (String)".properties", (String[])null); + Map map = makeAutoImageProperties(p_updateIcons_1_); + + if (map.size() > 0) + { + Set set = map.keySet(); + String[] astring1 = (String[])((String[])set.toArray(new String[set.size()])); + astring = (String[])((String[])Config.addObjectsToArray(astring, astring1)); + } + + Arrays.sort((Object[])astring); + List list = makePropertyList(itemProperties); + List list1 = makePropertyList(enchantmentProperties); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + Config.dbg("CustomItems: " + s); + + try + { + CustomItemProperties customitemproperties = null; + + if (map.containsKey(s)) + { + customitemproperties = (CustomItemProperties)map.get(s); + } + + if (customitemproperties == null) + { + ResourceLocation resourcelocation = new ResourceLocation(s); + InputStream inputstream = p_updateIcons_1_.getInputStream(resourcelocation); + + if (inputstream == null) + { + Config.warn("CustomItems file not found: " + s); + continue; + } + + Properties properties = new Properties(); + properties.load(inputstream); + customitemproperties = new CustomItemProperties(properties, s); + } + + if (customitemproperties.isValid(s)) + { + customitemproperties.updateIcons(p_updateIcons_0_); + addToItemList(customitemproperties, list); + addToEnchantmentList(customitemproperties, list1); + } + } + catch (FileNotFoundException var12) + { + Config.warn("CustomItems file not found: " + s); + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + + itemProperties = propertyListToArray(list); + enchantmentProperties = propertyListToArray(list1); + Comparator comparator = getPropertiesComparator(); + + for (int j = 0; j < itemProperties.length; ++j) + { + CustomItemProperties[] acustomitemproperties = itemProperties[j]; + + if (acustomitemproperties != null) + { + Arrays.sort(acustomitemproperties, comparator); + } + } + + for (int k = 0; k < enchantmentProperties.length; ++k) + { + CustomItemProperties[] acustomitemproperties1 = enchantmentProperties[k]; + + if (acustomitemproperties1 != null) + { + Arrays.sort(acustomitemproperties1, comparator); + } + } + } + + private static Comparator getPropertiesComparator() + { + Comparator comparator = new Comparator() + { + public int compare(Object p_compare_1_, Object p_compare_2_) + { + CustomItemProperties customitemproperties = (CustomItemProperties)p_compare_1_; + CustomItemProperties customitemproperties1 = (CustomItemProperties)p_compare_2_; + return customitemproperties.layer != customitemproperties1.layer ? customitemproperties.layer - customitemproperties1.layer : (customitemproperties.weight != customitemproperties1.weight ? customitemproperties1.weight - customitemproperties.weight : (!customitemproperties.basePath.equals(customitemproperties1.basePath) ? customitemproperties.basePath.compareTo(customitemproperties1.basePath) : customitemproperties.name.compareTo(customitemproperties1.name))); + } + }; + return comparator; + } + + public static void updateModels() + { + if (itemProperties != null) + { + for (int i = 0; i < itemProperties.length; ++i) + { + CustomItemProperties[] acustomitemproperties = itemProperties[i]; + + if (acustomitemproperties != null) + { + for (int j = 0; j < acustomitemproperties.length; ++j) + { + CustomItemProperties customitemproperties = acustomitemproperties[j]; + + if (customitemproperties != null && customitemproperties.type == 1) + { + TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks(); + customitemproperties.updateModel(texturemap, itemModelGenerator); + } + } + } + } + } + } + + private static Map makeAutoImageProperties(IResourcePack p_makeAutoImageProperties_0_) + { + Map map = new HashMap(); + map.putAll(makePotionImageProperties(p_makeAutoImageProperties_0_, false)); + map.putAll(makePotionImageProperties(p_makeAutoImageProperties_0_, true)); + return map; + } + + private static Map makePotionImageProperties(IResourcePack p_makePotionImageProperties_0_, boolean p_makePotionImageProperties_1_) + { + Map map = new HashMap(); + String s = p_makePotionImageProperties_1_ ? "splash/" : "normal/"; + String[] astring = new String[] {"mcpatcher/cit/potion/" + s, "mcpatcher/cit/Potion/" + s}; + String[] astring1 = new String[] {".png"}; + String[] astring2 = ResUtils.collectFiles(p_makePotionImageProperties_0_, astring, astring1); + + for (int i = 0; i < astring2.length; ++i) + { + String s1 = astring2[i]; + String name = StrUtils.removePrefixSuffix(s1, astring, astring1); + Properties properties = makePotionProperties(name, p_makePotionImageProperties_1_, s1); + + if (properties != null) + { + String s3 = StrUtils.removeSuffix(s1, astring1) + ".properties"; + CustomItemProperties customitemproperties = new CustomItemProperties(properties, s3); + map.put(s3, customitemproperties); + } + } + + return map; + } + + private static Properties makePotionProperties(String p_makePotionProperties_0_, boolean p_makePotionProperties_1_, String p_makePotionProperties_2_) + { + if (StrUtils.endsWith(p_makePotionProperties_0_, new String[] {"_n", "_s"})) + { + return null; + } + else if (p_makePotionProperties_0_.equals("empty") && !p_makePotionProperties_1_) + { + int l = Item.getIdFromItem(Items.glass_bottle); + Properties properties = new Properties(); + properties.put("type", "item"); + properties.put("items", "" + l); + return properties; + } + else + { + int i = Item.getIdFromItem(Items.potionitem); + int[] aint = (int[])((int[])getMapPotionIds().get(p_makePotionProperties_0_)); + + if (aint == null) + { + Config.warn("Potion not found for image: " + p_makePotionProperties_2_); + return null; + } + else + { + StringBuffer stringbuffer = new StringBuffer(); + + for (int j = 0; j < aint.length; ++j) + { + int k = aint[j]; + + if (p_makePotionProperties_1_) + { + k |= 16384; + } + + if (j > 0) + { + stringbuffer.append(" "); + } + + stringbuffer.append(k); + } + + int i1 = 16447; + Properties properties1 = new Properties(); + properties1.put("type", "item"); + properties1.put("items", "" + i); + properties1.put("damage", "" + stringbuffer.toString()); + properties1.put("damageMask", "" + i1); + + if (p_makePotionProperties_1_) + { + properties1.put("texture.potion_bottle_splash", p_makePotionProperties_0_); + } + else + { + properties1.put("texture.potion_bottle_drinkable", p_makePotionProperties_0_); + } + + return properties1; + } + } + } + + private static Map getMapPotionIds() + { + if (mapPotionIds == null) + { + mapPotionIds = new LinkedHashMap(); + mapPotionIds.put("water", new int[] {0}); + mapPotionIds.put("awkward", new int[] {16}); + mapPotionIds.put("thick", new int[] {32}); + mapPotionIds.put("potent", new int[] {48}); + mapPotionIds.put("regeneration", getPotionIds(1)); + mapPotionIds.put("moveSpeed", getPotionIds(2)); + mapPotionIds.put("fireResistance", getPotionIds(3)); + mapPotionIds.put("poison", getPotionIds(4)); + mapPotionIds.put("heal", getPotionIds(5)); + mapPotionIds.put("nightVision", getPotionIds(6)); + mapPotionIds.put("clear", getPotionIds(7)); + mapPotionIds.put("bungling", getPotionIds(23)); + mapPotionIds.put("charming", getPotionIds(39)); + mapPotionIds.put("rank", getPotionIds(55)); + mapPotionIds.put("weakness", getPotionIds(8)); + mapPotionIds.put("damageBoost", getPotionIds(9)); + mapPotionIds.put("moveSlowdown", getPotionIds(10)); + mapPotionIds.put("diffuse", getPotionIds(11)); + mapPotionIds.put("smooth", getPotionIds(27)); + mapPotionIds.put("refined", getPotionIds(43)); + mapPotionIds.put("acrid", getPotionIds(59)); + mapPotionIds.put("harm", getPotionIds(12)); + mapPotionIds.put("waterBreathing", getPotionIds(13)); + mapPotionIds.put("invisibility", getPotionIds(14)); + mapPotionIds.put("thin", getPotionIds(15)); + mapPotionIds.put("debonair", getPotionIds(31)); + mapPotionIds.put("sparkling", getPotionIds(47)); + mapPotionIds.put("stinky", getPotionIds(63)); + } + + return mapPotionIds; + } + + private static int[] getPotionIds(int p_getPotionIds_0_) + { + return new int[] {p_getPotionIds_0_, p_getPotionIds_0_ + 16, p_getPotionIds_0_ + 32, p_getPotionIds_0_ + 48}; + } + + private static int getPotionNameDamage(String p_getPotionNameDamage_0_) + { + String s = "potion." + p_getPotionNameDamage_0_; + Potion[] apotion = Potion.potionTypes; + + for (int i = 0; i < apotion.length; ++i) + { + Potion potion = apotion[i]; + + if (potion != null) + { + String s1 = potion.getName(); + + if (s.equals(s1)) + { + return potion.getId(); + } + } + } + + return -1; + } + + private static List makePropertyList(CustomItemProperties[][] p_makePropertyList_0_) + { + List list = new ArrayList(); + + if (p_makePropertyList_0_ != null) + { + for (int i = 0; i < p_makePropertyList_0_.length; ++i) + { + CustomItemProperties[] acustomitemproperties = p_makePropertyList_0_[i]; + List list1 = null; + + if (acustomitemproperties != null) + { + list1 = new ArrayList(Arrays.asList(acustomitemproperties)); + } + + list.add(list1); + } + } + + return list; + } + + private static CustomItemProperties[][] propertyListToArray(List p_propertyListToArray_0_) + { + CustomItemProperties[][] acustomitemproperties = new CustomItemProperties[p_propertyListToArray_0_.size()][]; + + for (int i = 0; i < p_propertyListToArray_0_.size(); ++i) + { + List list = (List)p_propertyListToArray_0_.get(i); + + if (list != null) + { + CustomItemProperties[] acustomitemproperties1 = (CustomItemProperties[])((CustomItemProperties[])list.toArray(new CustomItemProperties[list.size()])); + Arrays.sort(acustomitemproperties1, new CustomItemsComparator()); + acustomitemproperties[i] = acustomitemproperties1; + } + } + + return acustomitemproperties; + } + + private static void addToItemList(CustomItemProperties p_addToItemList_0_, List p_addToItemList_1_) + { + if (p_addToItemList_0_.items != null) + { + for (int i = 0; i < p_addToItemList_0_.items.length; ++i) + { + int j = p_addToItemList_0_.items[i]; + + if (j <= 0) + { + Config.warn("Invalid item ID: " + j); + } + else + { + addToList(p_addToItemList_0_, p_addToItemList_1_, j); + } + } + } + } + + private static void addToEnchantmentList(CustomItemProperties p_addToEnchantmentList_0_, List p_addToEnchantmentList_1_) + { + if (p_addToEnchantmentList_0_.type == 2) + { + if (p_addToEnchantmentList_0_.enchantmentIds != null) + { + for (int i = 0; i < 256; ++i) + { + if (p_addToEnchantmentList_0_.enchantmentIds.isInRange(i)) + { + addToList(p_addToEnchantmentList_0_, p_addToEnchantmentList_1_, i); + } + } + } + } + } + + private static void addToList(CustomItemProperties p_addToList_0_, List p_addToList_1_, int p_addToList_2_) + { + while (p_addToList_2_ >= p_addToList_1_.size()) + { + p_addToList_1_.add(null); + } + + List list = (List)p_addToList_1_.get(p_addToList_2_); + + if (list == null) + { + list = new ArrayList(); + p_addToList_1_.set(p_addToList_2_, list); + } + + list.add(p_addToList_0_); + } + + public static IBakedModel getCustomItemModel(ItemStack p_getCustomItemModel_0_, IBakedModel p_getCustomItemModel_1_, ModelResourceLocation p_getCustomItemModel_2_) + { + if (p_getCustomItemModel_1_.isGui3d()) + { + return p_getCustomItemModel_1_; + } + else if (itemProperties == null) + { + return p_getCustomItemModel_1_; + } + else + { + CustomItemProperties customitemproperties = getCustomItemProperties(p_getCustomItemModel_0_, 1); + return customitemproperties == null ? p_getCustomItemModel_1_ : customitemproperties.getModel(p_getCustomItemModel_2_); + } + } + + public static boolean bindCustomArmorTexture(ItemStack p_bindCustomArmorTexture_0_, int p_bindCustomArmorTexture_1_, String p_bindCustomArmorTexture_2_) + { + if (itemProperties == null) + { + return false; + } + else + { + ResourceLocation resourcelocation = getCustomArmorLocation(p_bindCustomArmorTexture_0_, p_bindCustomArmorTexture_1_, p_bindCustomArmorTexture_2_); + + if (resourcelocation == null) + { + return false; + } + else + { + Config.getTextureManager().bindTexture(resourcelocation); + return true; + } + } + } + + private static ResourceLocation getCustomArmorLocation(ItemStack p_getCustomArmorLocation_0_, int p_getCustomArmorLocation_1_, String p_getCustomArmorLocation_2_) + { + CustomItemProperties customitemproperties = getCustomItemProperties(p_getCustomArmorLocation_0_, 3); + + if (customitemproperties == null) + { + return null; + } + else if (customitemproperties.mapTextureLocations == null) + { + return null; + } + else + { + Item item = p_getCustomArmorLocation_0_.getItem(); + + if (!(item instanceof ItemArmor)) + { + return null; + } + else + { + ItemArmor itemarmor = (ItemArmor)item; + String s = itemarmor.getArmorMaterial().getName(); + StringBuffer stringbuffer = new StringBuffer(); + stringbuffer.append("texture."); + stringbuffer.append(s); + stringbuffer.append("_layer_"); + stringbuffer.append(p_getCustomArmorLocation_1_); + + if (p_getCustomArmorLocation_2_ != null) + { + stringbuffer.append("_"); + stringbuffer.append(p_getCustomArmorLocation_2_); + } + + String s1 = stringbuffer.toString(); + ResourceLocation resourcelocation = (ResourceLocation)customitemproperties.mapTextureLocations.get(s1); + return resourcelocation; + } + } + } + + private static CustomItemProperties getCustomItemProperties(ItemStack p_getCustomItemProperties_0_, int p_getCustomItemProperties_1_) + { + if (itemProperties == null) + { + return null; + } + else if (p_getCustomItemProperties_0_ == null) + { + return null; + } + else + { + Item item = p_getCustomItemProperties_0_.getItem(); + int i = Item.getIdFromItem(item); + + if (i >= 0 && i < itemProperties.length) + { + CustomItemProperties[] acustomitemproperties = itemProperties[i]; + + if (acustomitemproperties != null) + { + for (int j = 0; j < acustomitemproperties.length; ++j) + { + CustomItemProperties customitemproperties = acustomitemproperties[j]; + + if (customitemproperties.type == p_getCustomItemProperties_1_ && matchesProperties(customitemproperties, p_getCustomItemProperties_0_, (int[][])null)) + { + return customitemproperties; + } + } + } + } + + return null; + } + } + + private static boolean matchesProperties(CustomItemProperties p_matchesProperties_0_, ItemStack p_matchesProperties_1_, int[][] p_matchesProperties_2_) + { + Item item = p_matchesProperties_1_.getItem(); + + if (p_matchesProperties_0_.damage != null) + { + int i = p_matchesProperties_1_.getItemDamage(); + + if (p_matchesProperties_0_.damageMask != 0) + { + i &= p_matchesProperties_0_.damageMask; + } + + if (p_matchesProperties_0_.damagePercent) + { + int j = item.getMaxDamage(); + i = (int)((double)(i * 100) / (double)j); + } + + if (!p_matchesProperties_0_.damage.isInRange(i)) + { + return false; + } + } + + if (p_matchesProperties_0_.stackSize != null && !p_matchesProperties_0_.stackSize.isInRange(p_matchesProperties_1_.stackSize)) + { + return false; + } + else + { + int[][] aint = p_matchesProperties_2_; + + if (p_matchesProperties_0_.enchantmentIds != null) + { + if (p_matchesProperties_2_ == null) + { + aint = getEnchantmentIdLevels(p_matchesProperties_1_); + } + + boolean flag = false; + + for (int k = 0; k < aint.length; ++k) + { + int l = aint[k][0]; + + if (p_matchesProperties_0_.enchantmentIds.isInRange(l)) + { + flag = true; + break; + } + } + + if (!flag) + { + return false; + } + } + + if (p_matchesProperties_0_.enchantmentLevels != null) + { + if (aint == null) + { + aint = getEnchantmentIdLevels(p_matchesProperties_1_); + } + + boolean flag1 = false; + + for (int i1 = 0; i1 < aint.length; ++i1) + { + int k1 = aint[i1][1]; + + if (p_matchesProperties_0_.enchantmentLevels.isInRange(k1)) + { + flag1 = true; + break; + } + } + + if (!flag1) + { + return false; + } + } + + if (p_matchesProperties_0_.nbtTagValues != null) + { + NBTTagCompound nbttagcompound = p_matchesProperties_1_.getTagCompound(); + + for (int j1 = 0; j1 < p_matchesProperties_0_.nbtTagValues.length; ++j1) + { + NbtTagValue nbttagvalue = p_matchesProperties_0_.nbtTagValues[j1]; + + if (!nbttagvalue.matches(nbttagcompound)) + { + return false; + } + } + } + + return true; + } + } + + private static int[][] getEnchantmentIdLevels(ItemStack p_getEnchantmentIdLevels_0_) + { + Item item = p_getEnchantmentIdLevels_0_.getItem(); + NBTTagList nbttaglist = item == Items.enchanted_book ? Items.enchanted_book.getEnchantments(p_getEnchantmentIdLevels_0_) : p_getEnchantmentIdLevels_0_.getEnchantmentTagList(); + + if (nbttaglist != null && nbttaglist.tagCount() > 0) + { + int[][] aint = new int[nbttaglist.tagCount()][2]; + + for (int i = 0; i < nbttaglist.tagCount(); ++i) + { + NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); + int j = nbttagcompound.getShort("id"); + int k = nbttagcompound.getShort("lvl"); + aint[i][0] = j; + aint[i][1] = k; + } + + return aint; + } + else + { + return EMPTY_INT2_ARRAY; + } + } + + public static boolean renderCustomEffect(RenderItem p_renderCustomEffect_0_, ItemStack p_renderCustomEffect_1_, IBakedModel p_renderCustomEffect_2_) + { + if (enchantmentProperties == null) + { + return false; + } + else if (p_renderCustomEffect_1_ == null) + { + return false; + } + else + { + int[][] aint = getEnchantmentIdLevels(p_renderCustomEffect_1_); + + if (aint.length <= 0) + { + return false; + } + else + { + Set set = null; + boolean flag = false; + TextureManager texturemanager = Config.getTextureManager(); + + for (int i = 0; i < aint.length; ++i) + { + int j = aint[i][0]; + + if (j >= 0 && j < enchantmentProperties.length) + { + CustomItemProperties[] acustomitemproperties = enchantmentProperties[j]; + + if (acustomitemproperties != null) + { + for (int k = 0; k < acustomitemproperties.length; ++k) + { + CustomItemProperties customitemproperties = acustomitemproperties[k]; + + if (set == null) + { + set = new HashSet(); + } + + if (set.add(Integer.valueOf(j)) && matchesProperties(customitemproperties, p_renderCustomEffect_1_, aint) && customitemproperties.textureLocation != null) + { + texturemanager.bindTexture(customitemproperties.textureLocation); + float f = customitemproperties.getTextureWidth(texturemanager); + + if (!flag) + { + flag = true; + GlStateManager.depthMask(false); + GlStateManager.depthFunc(514); + GlStateManager.disableLighting(); + GlStateManager.matrixMode(5890); + } + + Blender.setupBlend(customitemproperties.blend, 1.0F); + GlStateManager.pushMatrix(); + GlStateManager.scale(f / 2.0F, f / 2.0F, f / 2.0F); + float f1 = customitemproperties.speed * (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F / 8.0F; + GlStateManager.translate(f1, 0.0F, 0.0F); + GlStateManager.rotate(customitemproperties.rotation, 0.0F, 0.0F, 1.0F); + p_renderCustomEffect_0_.renderModel(p_renderCustomEffect_2_, -1); + GlStateManager.popMatrix(); + } + } + } + } + } + + if (flag) + { + GlStateManager.enableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.matrixMode(5888); + GlStateManager.enableLighting(); + GlStateManager.depthFunc(515); + GlStateManager.depthMask(true); + texturemanager.bindTexture(TextureMap.locationBlocksTexture); + } + + return flag; + } + } + } + + public static boolean renderCustomArmorEffect(EntityLivingBase p_renderCustomArmorEffect_0_, ItemStack p_renderCustomArmorEffect_1_, ModelBase p_renderCustomArmorEffect_2_, float p_renderCustomArmorEffect_3_, float p_renderCustomArmorEffect_4_, float p_renderCustomArmorEffect_5_, float p_renderCustomArmorEffect_6_, float p_renderCustomArmorEffect_7_, float p_renderCustomArmorEffect_8_, float p_renderCustomArmorEffect_9_) + { + if (enchantmentProperties == null) + { + return false; + } + else if (Config.isShaders() && Shaders.isShadowPass) + { + return false; + } + else if (p_renderCustomArmorEffect_1_ == null) + { + return false; + } + else + { + int[][] aint = getEnchantmentIdLevels(p_renderCustomArmorEffect_1_); + + if (aint.length <= 0) + { + return false; + } + else + { + Set set = null; + boolean flag = false; + TextureManager texturemanager = Config.getTextureManager(); + + for (int i = 0; i < aint.length; ++i) + { + int j = aint[i][0]; + + if (j >= 0 && j < enchantmentProperties.length) + { + CustomItemProperties[] acustomitemproperties = enchantmentProperties[j]; + + if (acustomitemproperties != null) + { + for (int k = 0; k < acustomitemproperties.length; ++k) + { + CustomItemProperties customitemproperties = acustomitemproperties[k]; + + if (set == null) + { + set = new HashSet(); + } + + if (set.add(Integer.valueOf(j)) && matchesProperties(customitemproperties, p_renderCustomArmorEffect_1_, aint) && customitemproperties.textureLocation != null) + { + texturemanager.bindTexture(customitemproperties.textureLocation); + float f = customitemproperties.getTextureWidth(texturemanager); + + if (!flag) + { + flag = true; + + if (Config.isShaders()) + { + ShadersRender.renderEnchantedGlintBegin(); + } + + GlStateManager.enableBlend(); + GlStateManager.depthFunc(514); + GlStateManager.depthMask(false); + } + + Blender.setupBlend(customitemproperties.blend, 1.0F); + GlStateManager.disableLighting(); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + GlStateManager.rotate(customitemproperties.rotation, 0.0F, 0.0F, 1.0F); + float f1 = f / 8.0F; + GlStateManager.scale(f1, f1 / 2.0F, f1); + float f2 = customitemproperties.speed * (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F / 8.0F; + GlStateManager.translate(0.0F, f2, 0.0F); + GlStateManager.matrixMode(5888); + p_renderCustomArmorEffect_2_.render(p_renderCustomArmorEffect_0_, p_renderCustomArmorEffect_3_, p_renderCustomArmorEffect_4_, p_renderCustomArmorEffect_6_, p_renderCustomArmorEffect_7_, p_renderCustomArmorEffect_8_, p_renderCustomArmorEffect_9_); + } + } + } + } + } + + if (flag) + { + GlStateManager.enableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.matrixMode(5890); + GlStateManager.loadIdentity(); + GlStateManager.matrixMode(5888); + GlStateManager.enableLighting(); + GlStateManager.depthMask(true); + GlStateManager.depthFunc(515); + GlStateManager.disableBlend(); + + if (Config.isShaders()) + { + ShadersRender.renderEnchantedGlintEnd(); + } + } + + return flag; + } + } + } + + public static boolean isUseGlint() + { + return useGlint; + } +} diff --git a/src/minecraft/optifine/CustomItemsComparator.java b/src/minecraft/optifine/CustomItemsComparator.java new file mode 100644 index 0000000..a545d66 --- /dev/null +++ b/src/minecraft/optifine/CustomItemsComparator.java @@ -0,0 +1,13 @@ +package optifine; + +import java.util.Comparator; + +public class CustomItemsComparator implements Comparator +{ + public int compare(Object p_compare_1_, Object p_compare_2_) + { + CustomItemProperties customitemproperties = (CustomItemProperties)p_compare_1_; + CustomItemProperties customitemproperties1 = (CustomItemProperties)p_compare_2_; + return customitemproperties.weight != customitemproperties1.weight ? customitemproperties1.weight - customitemproperties.weight : (!Config.equals(customitemproperties.basePath, customitemproperties1.basePath) ? customitemproperties.basePath.compareTo(customitemproperties1.basePath) : customitemproperties.name.compareTo(customitemproperties1.name)); + } +} diff --git a/src/minecraft/optifine/CustomSky.java b/src/minecraft/optifine/CustomSky.java new file mode 100644 index 0000000..a6e3e2c --- /dev/null +++ b/src/minecraft/optifine/CustomSky.java @@ -0,0 +1,177 @@ +package optifine; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class CustomSky +{ + private static CustomSkyLayer[][] worldSkyLayers = (CustomSkyLayer[][])null; + + public static void reset() + { + worldSkyLayers = (CustomSkyLayer[][])null; + } + + public static void update() + { + reset(); + + if (Config.isCustomSky()) + { + worldSkyLayers = readCustomSkies(); + } + } + + private static CustomSkyLayer[][] readCustomSkies() + { + CustomSkyLayer[][] acustomskylayer = new CustomSkyLayer[10][0]; + String s = "mcpatcher/sky/world"; + int i = -1; + + for (int j = 0; j < acustomskylayer.length; ++j) + { + String s1 = s + j + "/sky"; + List list = new ArrayList(); + + for (int k = 1; k < 1000; ++k) + { + String s2 = s1 + k + ".properties"; + + try + { + ResourceLocation resourcelocation = new ResourceLocation(s2); + InputStream inputstream = Config.getResourceStream(resourcelocation); + + if (inputstream == null) + { + break; + } + + Properties properties = new Properties(); + properties.load(inputstream); + inputstream.close(); + Config.dbg("CustomSky properties: " + s2); + String s3 = s1 + k + ".png"; + CustomSkyLayer customskylayer = new CustomSkyLayer(properties, s3); + + if (customskylayer.isValid(s2)) + { + ResourceLocation resourcelocation1 = new ResourceLocation(customskylayer.source); + ITextureObject itextureobject = TextureUtils.getTexture(resourcelocation1); + + if (itextureobject == null) + { + Config.log("CustomSky: Texture not found: " + resourcelocation1); + } + else + { + customskylayer.textureId = itextureobject.getGlTextureId(); + list.add(customskylayer); + inputstream.close(); + } + } + } + catch (FileNotFoundException var15) + { + break; + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + + if (list.size() > 0) + { + CustomSkyLayer[] acustomskylayer2 = (CustomSkyLayer[])((CustomSkyLayer[])list.toArray(new CustomSkyLayer[list.size()])); + acustomskylayer[j] = acustomskylayer2; + i = j; + } + } + + if (i < 0) + { + return (CustomSkyLayer[][])null; + } + else + { + int l = i + 1; + CustomSkyLayer[][] acustomskylayer1 = new CustomSkyLayer[l][0]; + + for (int i1 = 0; i1 < acustomskylayer1.length; ++i1) + { + acustomskylayer1[i1] = acustomskylayer[i1]; + } + + return acustomskylayer1; + } + } + + public static void renderSky(World p_renderSky_0_, TextureManager p_renderSky_1_, float p_renderSky_2_, float p_renderSky_3_) + { + if (worldSkyLayers != null) + { + if (Config.getGameSettings().renderDistanceChunks >= 8) + { + int i = p_renderSky_0_.provider.getDimensionId(); + + if (i >= 0 && i < worldSkyLayers.length) + { + CustomSkyLayer[] acustomskylayer = worldSkyLayers[i]; + + if (acustomskylayer != null) + { + long j = p_renderSky_0_.getWorldTime(); + int k = (int)(j % 24000L); + + for (int l = 0; l < acustomskylayer.length; ++l) + { + CustomSkyLayer customskylayer = acustomskylayer[l]; + + if (customskylayer.isActive(p_renderSky_0_, k)) + { + customskylayer.render(k, p_renderSky_2_, p_renderSky_3_); + } + } + + Blender.clearBlend(p_renderSky_3_); + } + } + } + } + } + + public static boolean hasSkyLayers(World p_hasSkyLayers_0_) + { + if (worldSkyLayers == null) + { + return false; + } + else if (Config.getGameSettings().renderDistanceChunks < 8) + { + return false; + } + else + { + int i = p_hasSkyLayers_0_.provider.getDimensionId(); + + if (i >= 0 && i < worldSkyLayers.length) + { + CustomSkyLayer[] acustomskylayer = worldSkyLayers[i]; + return acustomskylayer == null ? false : acustomskylayer.length > 0; + } + else + { + return false; + } + } + } +} diff --git a/src/minecraft/optifine/CustomSkyLayer.java b/src/minecraft/optifine/CustomSkyLayer.java new file mode 100644 index 0000000..1b84e82 --- /dev/null +++ b/src/minecraft/optifine/CustomSkyLayer.java @@ -0,0 +1,369 @@ +package optifine; + +import java.util.Properties; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.world.World; + +public class CustomSkyLayer +{ + public String source = null; + private int startFadeIn = -1; + private int endFadeIn = -1; + private int startFadeOut = -1; + private int endFadeOut = -1; + private int blend = 1; + private boolean rotate = false; + private float speed = 1.0F; + private float[] axis; + private RangeListInt days; + private int daysLoop; + public int textureId; + public static final float[] DEFAULT_AXIS = new float[] {1.0F, 0.0F, 0.0F}; + + public CustomSkyLayer(Properties p_i35_1_, String p_i35_2_) + { + this.axis = DEFAULT_AXIS; + this.days = null; + this.daysLoop = 8; + this.textureId = -1; + ConnectedParser connectedparser = new ConnectedParser("CustomSky"); + this.source = p_i35_1_.getProperty("source", p_i35_2_); + this.startFadeIn = this.parseTime(p_i35_1_.getProperty("startFadeIn")); + this.endFadeIn = this.parseTime(p_i35_1_.getProperty("endFadeIn")); + this.startFadeOut = this.parseTime(p_i35_1_.getProperty("startFadeOut")); + this.endFadeOut = this.parseTime(p_i35_1_.getProperty("endFadeOut")); + this.blend = Blender.parseBlend(p_i35_1_.getProperty("blend")); + this.rotate = this.parseBoolean(p_i35_1_.getProperty("rotate"), true); + this.speed = this.parseFloat(p_i35_1_.getProperty("speed"), 1.0F); + this.axis = this.parseAxis(p_i35_1_.getProperty("axis"), DEFAULT_AXIS); + this.days = connectedparser.parseRangeListInt(p_i35_1_.getProperty("days")); + this.daysLoop = connectedparser.parseInt(p_i35_1_.getProperty("daysLoop"), 8); + } + + private int parseTime(String p_parseTime_1_) + { + if (p_parseTime_1_ == null) + { + return -1; + } + else + { + String[] astring = Config.tokenize(p_parseTime_1_, ":"); + + if (astring.length != 2) + { + Config.warn("Invalid time: " + p_parseTime_1_); + return -1; + } + else + { + String s = astring[0]; + String s1 = astring[1]; + int i = Config.parseInt(s, -1); + int j = Config.parseInt(s1, -1); + + if (i >= 0 && i <= 23 && j >= 0 && j <= 59) + { + i = i - 6; + + if (i < 0) + { + i += 24; + } + + int k = i * 1000 + (int)((double)j / 60.0D * 1000.0D); + return k; + } + else + { + Config.warn("Invalid time: " + p_parseTime_1_); + return -1; + } + } + } + } + + private boolean parseBoolean(String p_parseBoolean_1_, boolean p_parseBoolean_2_) + { + if (p_parseBoolean_1_ == null) + { + return p_parseBoolean_2_; + } + else if (p_parseBoolean_1_.toLowerCase().equals("true")) + { + return true; + } + else if (p_parseBoolean_1_.toLowerCase().equals("false")) + { + return false; + } + else + { + Config.warn("Unknown boolean: " + p_parseBoolean_1_); + return p_parseBoolean_2_; + } + } + + private float parseFloat(String p_parseFloat_1_, float p_parseFloat_2_) + { + if (p_parseFloat_1_ == null) + { + return p_parseFloat_2_; + } + else + { + float f = Config.parseFloat(p_parseFloat_1_, Float.MIN_VALUE); + + if (f == Float.MIN_VALUE) + { + Config.warn("Invalid value: " + p_parseFloat_1_); + return p_parseFloat_2_; + } + else + { + return f; + } + } + } + + private float[] parseAxis(String p_parseAxis_1_, float[] p_parseAxis_2_) + { + if (p_parseAxis_1_ == null) + { + return p_parseAxis_2_; + } + else + { + String[] astring = Config.tokenize(p_parseAxis_1_, " "); + + if (astring.length != 3) + { + Config.warn("Invalid axis: " + p_parseAxis_1_); + return p_parseAxis_2_; + } + else + { + float[] afloat = new float[3]; + + for (int i = 0; i < astring.length; ++i) + { + afloat[i] = Config.parseFloat(astring[i], Float.MIN_VALUE); + + if (afloat[i] == Float.MIN_VALUE) + { + Config.warn("Invalid axis: " + p_parseAxis_1_); + return p_parseAxis_2_; + } + + if (afloat[i] < -1.0F || afloat[i] > 1.0F) + { + Config.warn("Invalid axis values: " + p_parseAxis_1_); + return p_parseAxis_2_; + } + } + + float f2 = afloat[0]; + float f = afloat[1]; + float f1 = afloat[2]; + + if (f2 * f2 + f * f + f1 * f1 < 1.0E-5F) + { + Config.warn("Invalid axis values: " + p_parseAxis_1_); + return p_parseAxis_2_; + } + else + { + float[] afloat1 = new float[] {f1, f, -f2}; + return afloat1; + } + } + } + } + + public boolean isValid(String p_isValid_1_) + { + if (this.source == null) + { + Config.warn("No source texture: " + p_isValid_1_); + return false; + } + else + { + this.source = TextureUtils.fixResourcePath(this.source, TextureUtils.getBasePath(p_isValid_1_)); + + if (this.startFadeIn >= 0 && this.endFadeIn >= 0 && this.endFadeOut >= 0) + { + int i = this.normalizeTime(this.endFadeIn - this.startFadeIn); + + if (this.startFadeOut < 0) + { + this.startFadeOut = this.normalizeTime(this.endFadeOut - i); + + if (this.timeBetween(this.startFadeOut, this.startFadeIn, this.endFadeIn)) + { + this.startFadeOut = this.endFadeIn; + } + } + + int j = this.normalizeTime(this.startFadeOut - this.endFadeIn); + int k = this.normalizeTime(this.endFadeOut - this.startFadeOut); + int l = this.normalizeTime(this.startFadeIn - this.endFadeOut); + int i1 = i + j + k + l; + + if (i1 != 24000) + { + Config.warn("Invalid fadeIn/fadeOut times, sum is not 24h: " + i1); + return false; + } + else if (this.speed < 0.0F) + { + Config.warn("Invalid speed: " + this.speed); + return false; + } + else if (this.daysLoop <= 0) + { + Config.warn("Invalid daysLoop: " + this.daysLoop); + return false; + } + else + { + return true; + } + } + else + { + Config.warn("Invalid times, required are: startFadeIn, endFadeIn and endFadeOut."); + return false; + } + } + } + + private int normalizeTime(int p_normalizeTime_1_) + { + while (p_normalizeTime_1_ >= 24000) + { + p_normalizeTime_1_ -= 24000; + } + + while (p_normalizeTime_1_ < 0) + { + p_normalizeTime_1_ += 24000; + } + + return p_normalizeTime_1_; + } + + public void render(int p_render_1_, float p_render_2_, float p_render_3_) + { + float f = p_render_3_ * this.getFadeBrightness(p_render_1_); + f = Config.limit(f, 0.0F, 1.0F); + + if (f >= 1.0E-4F) + { + GlStateManager.bindTexture(this.textureId); + Blender.setupBlend(this.blend, f); + GlStateManager.pushMatrix(); + + if (this.rotate) + { + GlStateManager.rotate(p_render_2_ * 360.0F * this.speed, this.axis[0], this.axis[1], this.axis[2]); + } + + Tessellator tessellator = Tessellator.getInstance(); + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F); + this.renderSide(tessellator, 4); + GlStateManager.pushMatrix(); + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + this.renderSide(tessellator, 1); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); + this.renderSide(tessellator, 0); + GlStateManager.popMatrix(); + GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); + this.renderSide(tessellator, 5); + GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); + this.renderSide(tessellator, 2); + GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); + this.renderSide(tessellator, 3); + GlStateManager.popMatrix(); + } + } + + private float getFadeBrightness(int p_getFadeBrightness_1_) + { + if (this.timeBetween(p_getFadeBrightness_1_, this.startFadeIn, this.endFadeIn)) + { + int k = this.normalizeTime(this.endFadeIn - this.startFadeIn); + int l = this.normalizeTime(p_getFadeBrightness_1_ - this.startFadeIn); + return (float)l / (float)k; + } + else if (this.timeBetween(p_getFadeBrightness_1_, this.endFadeIn, this.startFadeOut)) + { + return 1.0F; + } + else if (this.timeBetween(p_getFadeBrightness_1_, this.startFadeOut, this.endFadeOut)) + { + int i = this.normalizeTime(this.endFadeOut - this.startFadeOut); + int j = this.normalizeTime(p_getFadeBrightness_1_ - this.startFadeOut); + return 1.0F - (float)j / (float)i; + } + else + { + return 0.0F; + } + } + + private void renderSide(Tessellator p_renderSide_1_, int p_renderSide_2_) + { + WorldRenderer worldrenderer = p_renderSide_1_.getWorldRenderer(); + double d0 = (double)(p_renderSide_2_ % 3) / 3.0D; + double d1 = (double)(p_renderSide_2_ / 3) / 2.0D; + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(-100.0D, -100.0D, -100.0D).tex(d0, d1).endVertex(); + worldrenderer.pos(-100.0D, -100.0D, 100.0D).tex(d0, d1 + 0.5D).endVertex(); + worldrenderer.pos(100.0D, -100.0D, 100.0D).tex(d0 + 0.3333333333333333D, d1 + 0.5D).endVertex(); + worldrenderer.pos(100.0D, -100.0D, -100.0D).tex(d0 + 0.3333333333333333D, d1).endVertex(); + p_renderSide_1_.draw(); + } + + public boolean isActive(World p_isActive_1_, int p_isActive_2_) + { + if (this.timeBetween(p_isActive_2_, this.endFadeOut, this.startFadeIn)) + { + return false; + } + else + { + if (this.days != null) + { + long i = p_isActive_1_.getWorldTime(); + long j; + + for (j = i - (long)this.startFadeIn; j < 0L; j += (long)(24000 * this.daysLoop)) + { + ; + } + + int k = (int)(j / 24000L); + int l = k % this.daysLoop; + + if (!this.days.isInRange(l)) + { + return false; + } + } + + return true; + } + } + + private boolean timeBetween(int p_timeBetween_1_, int p_timeBetween_2_, int p_timeBetween_3_) + { + return p_timeBetween_2_ <= p_timeBetween_3_ ? p_timeBetween_1_ >= p_timeBetween_2_ && p_timeBetween_1_ <= p_timeBetween_3_ : p_timeBetween_1_ >= p_timeBetween_2_ || p_timeBetween_1_ <= p_timeBetween_3_; + } +} diff --git a/src/minecraft/optifine/DisplayModeComparator.java b/src/minecraft/optifine/DisplayModeComparator.java new file mode 100644 index 0000000..4203bb8 --- /dev/null +++ b/src/minecraft/optifine/DisplayModeComparator.java @@ -0,0 +1,14 @@ +package optifine; + +import java.util.Comparator; +import org.lwjgl.opengl.DisplayMode; + +public class DisplayModeComparator implements Comparator +{ + public int compare(Object p_compare_1_, Object p_compare_2_) + { + DisplayMode displaymode = (DisplayMode)p_compare_1_; + DisplayMode displaymode1 = (DisplayMode)p_compare_2_; + return displaymode.getWidth() != displaymode1.getWidth() ? displaymode.getWidth() - displaymode1.getWidth() : (displaymode.getHeight() != displaymode1.getHeight() ? displaymode.getHeight() - displaymode1.getHeight() : (displaymode.getBitsPerPixel() != displaymode1.getBitsPerPixel() ? displaymode.getBitsPerPixel() - displaymode1.getBitsPerPixel() : (displaymode.getFrequency() != displaymode1.getFrequency() ? displaymode.getFrequency() - displaymode1.getFrequency() : 0))); + } +} diff --git a/src/minecraft/optifine/DynamicLight.java b/src/minecraft/optifine/DynamicLight.java new file mode 100644 index 0000000..f1406ba --- /dev/null +++ b/src/minecraft/optifine/DynamicLight.java @@ -0,0 +1,180 @@ +package optifine; + +import java.util.HashSet; +import java.util.Set; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.chunk.CompiledChunk; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class DynamicLight +{ + private Entity entity = null; + private double offsetY = 0.0D; + private double lastPosX = -2.147483648E9D; + private double lastPosY = -2.147483648E9D; + private double lastPosZ = -2.147483648E9D; + private int lastLightLevel = 0; + private boolean underwater = false; + private long timeCheckMs = 0L; + private Set setLitChunkPos = new HashSet(); + private BlockPos.MutableBlockPos blockPosMutable = new BlockPos.MutableBlockPos(); + + public DynamicLight(Entity p_i36_1_) + { + this.entity = p_i36_1_; + this.offsetY = (double)p_i36_1_.getEyeHeight(); + } + + public void update(RenderGlobal p_update_1_) + { + if (Config.isDynamicLightsFast()) + { + long i = System.currentTimeMillis(); + + if (i < this.timeCheckMs + 500L) + { + return; + } + + this.timeCheckMs = i; + } + + double d6 = this.entity.posX - 0.5D; + double d0 = this.entity.posY - 0.5D + this.offsetY; + double d1 = this.entity.posZ - 0.5D; + int j = DynamicLights.getLightLevel(this.entity); + double d2 = d6 - this.lastPosX; + double d3 = d0 - this.lastPosY; + double d4 = d1 - this.lastPosZ; + double d5 = 0.1D; + + if (Math.abs(d2) > d5 || Math.abs(d3) > d5 || Math.abs(d4) > d5 || this.lastLightLevel != j) + { + this.lastPosX = d6; + this.lastPosY = d0; + this.lastPosZ = d1; + this.lastLightLevel = j; + this.underwater = false; + World world = p_update_1_.getWorld(); + + if (world != null) + { + this.blockPosMutable.func_181079_c(MathHelper.floor_double(d6), MathHelper.floor_double(d0), MathHelper.floor_double(d1)); + IBlockState iblockstate = world.getBlockState(this.blockPosMutable); + Block block = iblockstate.getBlock(); + this.underwater = block == Blocks.water; + } + + Set set = new HashSet(); + + if (j > 0) + { + EnumFacing enumfacing2 = (MathHelper.floor_double(d6) & 15) >= 8 ? EnumFacing.EAST : EnumFacing.WEST; + EnumFacing enumfacing = (MathHelper.floor_double(d0) & 15) >= 8 ? EnumFacing.UP : EnumFacing.DOWN; + EnumFacing enumfacing1 = (MathHelper.floor_double(d1) & 15) >= 8 ? EnumFacing.SOUTH : EnumFacing.NORTH; + BlockPos blockpos = new BlockPos(d6, d0, d1); + RenderChunk renderchunk = p_update_1_.getRenderChunk(blockpos); + RenderChunk renderchunk1 = p_update_1_.getRenderChunk(renderchunk, enumfacing2); + RenderChunk renderchunk2 = p_update_1_.getRenderChunk(renderchunk, enumfacing1); + RenderChunk renderchunk3 = p_update_1_.getRenderChunk(renderchunk1, enumfacing1); + RenderChunk renderchunk4 = p_update_1_.getRenderChunk(renderchunk, enumfacing); + RenderChunk renderchunk5 = p_update_1_.getRenderChunk(renderchunk4, enumfacing2); + RenderChunk renderchunk6 = p_update_1_.getRenderChunk(renderchunk4, enumfacing1); + RenderChunk renderchunk7 = p_update_1_.getRenderChunk(renderchunk5, enumfacing1); + this.updateChunkLight(renderchunk, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk1, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk2, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk3, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk4, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk5, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk6, this.setLitChunkPos, set); + this.updateChunkLight(renderchunk7, this.setLitChunkPos, set); + } + + this.updateLitChunks(p_update_1_); + this.setLitChunkPos = set; + } + } + + private void updateChunkLight(RenderChunk p_updateChunkLight_1_, Set p_updateChunkLight_2_, Set p_updateChunkLight_3_) + { + if (p_updateChunkLight_1_ != null) + { + CompiledChunk compiledchunk = p_updateChunkLight_1_.getCompiledChunk(); + + if (compiledchunk != null && !compiledchunk.isEmpty()) + { + p_updateChunkLight_1_.setNeedsUpdate(true); + } + + BlockPos blockpos = p_updateChunkLight_1_.getPosition(); + + if (p_updateChunkLight_2_ != null) + { + p_updateChunkLight_2_.remove(blockpos); + } + + if (p_updateChunkLight_3_ != null) + { + p_updateChunkLight_3_.add(blockpos); + } + } + } + + public void updateLitChunks(RenderGlobal p_updateLitChunks_1_) + { + for (BlockPos blockpos : this.setLitChunkPos) + { + RenderChunk renderchunk = p_updateLitChunks_1_.getRenderChunk(blockpos); + this.updateChunkLight(renderchunk, (Set)null, (Set)null); + } + } + + public Entity getEntity() + { + return this.entity; + } + + public double getLastPosX() + { + return this.lastPosX; + } + + public double getLastPosY() + { + return this.lastPosY; + } + + public double getLastPosZ() + { + return this.lastPosZ; + } + + public int getLastLightLevel() + { + return this.lastLightLevel; + } + + public boolean isUnderwater() + { + return this.underwater; + } + + public double getOffsetY() + { + return this.offsetY; + } + + public String toString() + { + return "Entity: " + this.entity + ", offsetY: " + this.offsetY; + } +} diff --git a/src/minecraft/optifine/DynamicLights.java b/src/minecraft/optifine/DynamicLights.java new file mode 100644 index 0000000..2f5c350 --- /dev/null +++ b/src/minecraft/optifine/DynamicLights.java @@ -0,0 +1,328 @@ +package optifine; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityMagmaCube; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityFireball; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; + +public class DynamicLights +{ + private static Map mapDynamicLights = new HashMap(); + private static long timeUpdateMs = 0L; + private static final double MAX_DIST = 7.5D; + private static final double MAX_DIST_SQ = 56.25D; + private static final int LIGHT_LEVEL_MAX = 15; + private static final int LIGHT_LEVEL_FIRE = 15; + private static final int LIGHT_LEVEL_BLAZE = 10; + private static final int LIGHT_LEVEL_MAGMA_CUBE = 8; + private static final int LIGHT_LEVEL_MAGMA_CUBE_CORE = 13; + private static final int LIGHT_LEVEL_GLOWSTONE_DUST = 8; + private static final int LIGHT_LEVEL_PRISMARINE_CRYSTALS = 8; + + public static void entityAdded(Entity p_entityAdded_0_, RenderGlobal p_entityAdded_1_) + { + } + + public static void entityRemoved(Entity p_entityRemoved_0_, RenderGlobal p_entityRemoved_1_) + { + synchronized (mapDynamicLights) + { + DynamicLight dynamiclight = (DynamicLight)mapDynamicLights.remove(IntegerCache.valueOf(p_entityRemoved_0_.getEntityId())); + + if (dynamiclight != null) + { + dynamiclight.updateLitChunks(p_entityRemoved_1_); + } + } + } + + public static void update(RenderGlobal p_update_0_) + { + long i = System.currentTimeMillis(); + + if (i >= timeUpdateMs + 50L) + { + timeUpdateMs = i; + + synchronized (mapDynamicLights) + { + updateMapDynamicLights(p_update_0_); + + if (mapDynamicLights.size() > 0) + { + for (DynamicLight dynamiclight : mapDynamicLights.values()) + { + dynamiclight.update(p_update_0_); + } + } + } + } + } + + private static void updateMapDynamicLights(RenderGlobal p_updateMapDynamicLights_0_) + { + World world = p_updateMapDynamicLights_0_.getWorld(); + + if (world != null) + { + for (Entity entity : world.getLoadedEntityList()) + { + int i = getLightLevel(entity); + + if (i > 0) + { + Integer integer = IntegerCache.valueOf(entity.getEntityId()); + DynamicLight dynamiclight = (DynamicLight)mapDynamicLights.get(integer); + + if (dynamiclight == null) + { + dynamiclight = new DynamicLight(entity); + mapDynamicLights.put(integer, dynamiclight); + } + } + else + { + Integer integer1 = IntegerCache.valueOf(entity.getEntityId()); + DynamicLight dynamiclight1 = (DynamicLight)mapDynamicLights.remove(integer1); + + if (dynamiclight1 != null) + { + dynamiclight1.updateLitChunks(p_updateMapDynamicLights_0_); + } + } + } + } + } + + public static int getCombinedLight(BlockPos p_getCombinedLight_0_, int p_getCombinedLight_1_) + { + double d0 = getLightLevel(p_getCombinedLight_0_); + p_getCombinedLight_1_ = getCombinedLight(d0, p_getCombinedLight_1_); + return p_getCombinedLight_1_; + } + + public static int getCombinedLight(Entity p_getCombinedLight_0_, int p_getCombinedLight_1_) + { + double d0 = (double)getLightLevel(p_getCombinedLight_0_); + p_getCombinedLight_1_ = getCombinedLight(d0, p_getCombinedLight_1_); + return p_getCombinedLight_1_; + } + + public static int getCombinedLight(double p_getCombinedLight_0_, int p_getCombinedLight_2_) + { + if (p_getCombinedLight_0_ > 0.0D) + { + int i = (int)(p_getCombinedLight_0_ * 16.0D); + int j = p_getCombinedLight_2_ & 255; + + if (i > j) + { + p_getCombinedLight_2_ = p_getCombinedLight_2_ & -256; + p_getCombinedLight_2_ = p_getCombinedLight_2_ | i; + } + } + + return p_getCombinedLight_2_; + } + + public static double getLightLevel(BlockPos p_getLightLevel_0_) + { + double d0 = 0.0D; + + synchronized (mapDynamicLights) + { + for (DynamicLight dynamiclight : mapDynamicLights.values()) + { + int i = dynamiclight.getLastLightLevel(); + + if (i > 0) + { + double d1 = dynamiclight.getLastPosX(); + double d2 = dynamiclight.getLastPosY(); + double d3 = dynamiclight.getLastPosZ(); + double d4 = (double)p_getLightLevel_0_.getX() - d1; + double d5 = (double)p_getLightLevel_0_.getY() - d2; + double d6 = (double)p_getLightLevel_0_.getZ() - d3; + double d7 = d4 * d4 + d5 * d5 + d6 * d6; + + if (dynamiclight.isUnderwater() && !Config.isClearWater()) + { + i = Config.limit(i - 2, 0, 15); + d7 *= 2.0D; + } + + if (d7 <= 56.25D) + { + double d8 = Math.sqrt(d7); + double d9 = 1.0D - d8 / 7.5D; + double d10 = d9 * (double)i; + + if (d10 > d0) + { + d0 = d10; + } + } + } + } + } + + double d11 = Config.limit(d0, 0.0D, 15.0D); + return d11; + } + + public static int getLightLevel(ItemStack p_getLightLevel_0_) + { + if (p_getLightLevel_0_ == null) + { + return 0; + } + else + { + Item item = p_getLightLevel_0_.getItem(); + + if (item instanceof ItemBlock) + { + ItemBlock itemblock = (ItemBlock)item; + Block block = itemblock.getBlock(); + + if (block != null) + { + return block.getLightValue(); + } + } + + return item == Items.lava_bucket ? Blocks.lava.getLightValue() : (item != Items.blaze_rod && item != Items.blaze_powder ? (item == Items.glowstone_dust ? 8 : (item == Items.prismarine_crystals ? 8 : (item == Items.magma_cream ? 8 : (item == Items.nether_star ? Blocks.beacon.getLightValue() / 2 : 0)))) : 10); + } + } + + public static int getLightLevel(Entity p_getLightLevel_0_) + { + if (p_getLightLevel_0_ == Config.getMinecraft().getRenderViewEntity() && !Config.isDynamicHandLight()) + { + return 0; + } + else + { + if (p_getLightLevel_0_ instanceof EntityPlayer) + { + EntityPlayer entityplayer = (EntityPlayer)p_getLightLevel_0_; + + if (entityplayer.isSpectator()) + { + return 0; + } + } + + if (p_getLightLevel_0_.isBurning()) + { + return 15; + } + else if (p_getLightLevel_0_ instanceof EntityFireball) + { + return 15; + } + else if (p_getLightLevel_0_ instanceof EntityTNTPrimed) + { + return 15; + } + else if (p_getLightLevel_0_ instanceof EntityBlaze) + { + EntityBlaze entityblaze = (EntityBlaze)p_getLightLevel_0_; + return entityblaze.func_70845_n() ? 15 : 10; + } + else if (p_getLightLevel_0_ instanceof EntityMagmaCube) + { + EntityMagmaCube entitymagmacube = (EntityMagmaCube)p_getLightLevel_0_; + return (double)entitymagmacube.squishFactor > 0.6D ? 13 : 8; + } + else + { + if (p_getLightLevel_0_ instanceof EntityCreeper) + { + EntityCreeper entitycreeper = (EntityCreeper)p_getLightLevel_0_; + + if ((double)entitycreeper.getCreeperFlashIntensity(0.0F) > 0.001D) + { + return 15; + } + } + + if (p_getLightLevel_0_ instanceof EntityLivingBase) + { + EntityLivingBase entitylivingbase = (EntityLivingBase)p_getLightLevel_0_; + ItemStack itemstack2 = entitylivingbase.getHeldItem(); + int i = getLightLevel(itemstack2); + ItemStack itemstack1 = entitylivingbase.getEquipmentInSlot(4); + int j = getLightLevel(itemstack1); + return Math.max(i, j); + } + else if (p_getLightLevel_0_ instanceof EntityItem) + { + EntityItem entityitem = (EntityItem)p_getLightLevel_0_; + ItemStack itemstack = getItemStack(entityitem); + return getLightLevel(itemstack); + } + else + { + return 0; + } + } + } + } + + public static void removeLights(RenderGlobal p_removeLights_0_) + { + synchronized (mapDynamicLights) + { + Collection collection = mapDynamicLights.values(); + Iterator iterator = collection.iterator(); + + while (iterator.hasNext()) + { + DynamicLight dynamiclight = (DynamicLight)iterator.next(); + iterator.remove(); + dynamiclight.updateLitChunks(p_removeLights_0_); + } + } + } + + public static void clear() + { + synchronized (mapDynamicLights) + { + mapDynamicLights.clear(); + } + } + + public static int getCount() + { + synchronized (mapDynamicLights) + { + return mapDynamicLights.size(); + } + } + + public static ItemStack getItemStack(EntityItem p_getItemStack_0_) + { + ItemStack itemstack = p_getItemStack_0_.getDataWatcher().getWatchableObjectItemStack(10); + return itemstack; + } +} diff --git a/src/minecraft/optifine/FieldLocatorActionKeyF3.java b/src/minecraft/optifine/FieldLocatorActionKeyF3.java new file mode 100644 index 0000000..8f096e1 --- /dev/null +++ b/src/minecraft/optifine/FieldLocatorActionKeyF3.java @@ -0,0 +1,54 @@ +package optifine; + +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; +import net.minecraft.client.Minecraft; + +public class FieldLocatorActionKeyF3 implements IFieldLocator +{ + public Field getField() + { + Class oclass = Minecraft.class; + Field field = this.getFieldRenderChunksMany(); + + if (field == null) + { + Config.log("(Reflector) Field not present: " + oclass.getName() + ".actionKeyF3 (field renderChunksMany not found)"); + return null; + } + else + { + Field field1 = ReflectorRaw.getFieldAfter(Minecraft.class, field, Boolean.TYPE, 0); + + if (field1 == null) + { + Config.log("(Reflector) Field not present: " + oclass.getName() + ".actionKeyF3"); + return null; + } + else + { + return field1; + } + } + } + + private Field getFieldRenderChunksMany() + { + Minecraft minecraft = Minecraft.getMinecraft(); + boolean flag = minecraft.renderChunksMany; + Field[] afield = Minecraft.class.getDeclaredFields(); + minecraft.renderChunksMany = true; + Field[] afield1 = ReflectorRaw.getFields(minecraft, afield, Boolean.TYPE, Boolean.TRUE); + minecraft.renderChunksMany = false; + Field[] afield2 = ReflectorRaw.getFields(minecraft, afield, Boolean.TYPE, Boolean.FALSE); + minecraft.renderChunksMany = flag; + Set set = new HashSet(Arrays.asList(afield1)); + Set set1 = new HashSet(Arrays.asList(afield2)); + Set set2 = new HashSet(set); + set2.retainAll(set1); + Field[] afield3 = (Field[])((Field[])set2.toArray(new Field[set2.size()])); + return afield3.length != 1 ? null : afield3[0]; + } +} diff --git a/src/minecraft/optifine/FieldLocatorFixed.java b/src/minecraft/optifine/FieldLocatorFixed.java new file mode 100644 index 0000000..3e7cf29 --- /dev/null +++ b/src/minecraft/optifine/FieldLocatorFixed.java @@ -0,0 +1,18 @@ +package optifine; + +import java.lang.reflect.Field; + +public class FieldLocatorFixed implements IFieldLocator +{ + private Field field; + + public FieldLocatorFixed(Field p_i37_1_) + { + this.field = p_i37_1_; + } + + public Field getField() + { + return this.field; + } +} diff --git a/src/minecraft/optifine/FieldLocatorName.java b/src/minecraft/optifine/FieldLocatorName.java new file mode 100644 index 0000000..51142b5 --- /dev/null +++ b/src/minecraft/optifine/FieldLocatorName.java @@ -0,0 +1,49 @@ +package optifine; + +import java.lang.reflect.Field; + +public class FieldLocatorName implements IFieldLocator +{ + private ReflectorClass reflectorClass = null; + private String targetFieldName = null; + + public FieldLocatorName(ReflectorClass p_i38_1_, String p_i38_2_) + { + this.reflectorClass = p_i38_1_; + this.targetFieldName = p_i38_2_; + } + + public Field getField() + { + Class oclass = this.reflectorClass.getTargetClass(); + + if (oclass == null) + { + return null; + } + else + { + try + { + Field field = oclass.getDeclaredField(this.targetFieldName); + field.setAccessible(true); + return field; + } + catch (NoSuchFieldException var3) + { + Config.log("(Reflector) Field not present: " + oclass.getName() + "." + this.targetFieldName); + return null; + } + catch (SecurityException securityexception) + { + securityexception.printStackTrace(); + return null; + } + catch (Throwable throwable) + { + throwable.printStackTrace(); + return null; + } + } + } +} diff --git a/src/minecraft/optifine/FieldLocatorType.java b/src/minecraft/optifine/FieldLocatorType.java new file mode 100644 index 0000000..f4eef78 --- /dev/null +++ b/src/minecraft/optifine/FieldLocatorType.java @@ -0,0 +1,71 @@ +package optifine; + +import java.lang.reflect.Field; + +public class FieldLocatorType implements IFieldLocator +{ + private ReflectorClass reflectorClass; + private Class targetFieldType; + private int targetFieldIndex; + + public FieldLocatorType(ReflectorClass p_i39_1_, Class p_i39_2_) + { + this(p_i39_1_, p_i39_2_, 0); + } + + public FieldLocatorType(ReflectorClass p_i40_1_, Class p_i40_2_, int p_i40_3_) + { + this.reflectorClass = null; + this.targetFieldType = null; + this.reflectorClass = p_i40_1_; + this.targetFieldType = p_i40_2_; + this.targetFieldIndex = p_i40_3_; + } + + public Field getField() + { + Class oclass = this.reflectorClass.getTargetClass(); + + if (oclass == null) + { + return null; + } + else + { + try + { + Field[] afield = oclass.getDeclaredFields(); + int i = 0; + + for (int j = 0; j < afield.length; ++j) + { + Field field = afield[j]; + + if (field.getType() == this.targetFieldType) + { + if (i == this.targetFieldIndex) + { + field.setAccessible(true); + return field; + } + + ++i; + } + } + + Config.log("(Reflector) Field not present: " + oclass.getName() + ".(type: " + this.targetFieldType + ", index: " + this.targetFieldIndex + ")"); + return null; + } + catch (SecurityException securityexception) + { + securityexception.printStackTrace(); + return null; + } + catch (Throwable throwable) + { + throwable.printStackTrace(); + return null; + } + } + } +} diff --git a/src/minecraft/optifine/FileDownloadThread.java b/src/minecraft/optifine/FileDownloadThread.java new file mode 100644 index 0000000..106b7e6 --- /dev/null +++ b/src/minecraft/optifine/FileDownloadThread.java @@ -0,0 +1,38 @@ +package optifine; + +import net.minecraft.client.Minecraft; + +public class FileDownloadThread extends Thread +{ + private String urlString = null; + private IFileDownloadListener listener = null; + + public FileDownloadThread(String p_i41_1_, IFileDownloadListener p_i41_2_) + { + this.urlString = p_i41_1_; + this.listener = p_i41_2_; + } + + public void run() + { + try + { + byte[] abyte = HttpPipeline.get(this.urlString, Minecraft.getMinecraft().getProxy()); + this.listener.fileDownloadFinished(this.urlString, abyte, (Throwable)null); + } + catch (Exception exception) + { + this.listener.fileDownloadFinished(this.urlString, (byte[])null, exception); + } + } + + public String getUrlString() + { + return this.urlString; + } + + public IFileDownloadListener getListener() + { + return this.listener; + } +} diff --git a/src/minecraft/optifine/FileUploadThread.java b/src/minecraft/optifine/FileUploadThread.java new file mode 100644 index 0000000..1b3da6e --- /dev/null +++ b/src/minecraft/optifine/FileUploadThread.java @@ -0,0 +1,47 @@ +package optifine; + +import java.util.Map; + +public class FileUploadThread extends Thread +{ + private String urlString; + private Map headers; + private byte[] content; + private IFileUploadListener listener; + + public FileUploadThread(String p_i42_1_, Map p_i42_2_, byte[] p_i42_3_, IFileUploadListener p_i42_4_) + { + this.urlString = p_i42_1_; + this.headers = p_i42_2_; + this.content = p_i42_3_; + this.listener = p_i42_4_; + } + + public void run() + { + try + { + HttpUtils.post(this.urlString, this.headers, this.content); + this.listener.fileUploadFinished(this.urlString, this.content, (Throwable)null); + } + catch (Exception exception) + { + this.listener.fileUploadFinished(this.urlString, this.content, exception); + } + } + + public String getUrlString() + { + return this.urlString; + } + + public byte[] getContent() + { + return this.content; + } + + public IFileUploadListener getListener() + { + return this.listener; + } +} diff --git a/src/minecraft/optifine/FontUtils.java b/src/minecraft/optifine/FontUtils.java new file mode 100644 index 0000000..5477bec --- /dev/null +++ b/src/minecraft/optifine/FontUtils.java @@ -0,0 +1,130 @@ +package optifine; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; +import net.minecraft.util.ResourceLocation; + +public class FontUtils +{ + public static Properties readFontProperties(ResourceLocation p_readFontProperties_0_) + { + String s = p_readFontProperties_0_.getResourcePath(); + Properties properties = new Properties(); + String s1 = ".png"; + + if (!s.endsWith(s1)) + { + return properties; + } + else + { + String s2 = s.substring(0, s.length() - s1.length()) + ".properties"; + + try + { + ResourceLocation resourcelocation = new ResourceLocation(p_readFontProperties_0_.getResourceDomain(), s2); + InputStream inputstream = Config.getResourceStream(Config.getResourceManager(), resourcelocation); + + if (inputstream == null) + { + return properties; + } + + Config.log("Loading " + s2); + properties.load(inputstream); + } + catch (FileNotFoundException var7) + { + ; + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + + return properties; + } + } + + public static void readCustomCharWidths(Properties p_readCustomCharWidths_0_, float[] p_readCustomCharWidths_1_) + { + for (Object s0 : p_readCustomCharWidths_0_.keySet()) + { + String s = (String) s0; + String s1 = "width."; + + if (s.startsWith(s1)) + { + String s2 = s.substring(s1.length()); + int i = Config.parseInt(s2, -1); + + if (i >= 0 && i < p_readCustomCharWidths_1_.length) + { + String s3 = p_readCustomCharWidths_0_.getProperty(s); + float f = Config.parseFloat(s3, -1.0F); + + if (f >= 0.0F) + { + p_readCustomCharWidths_1_[i] = f; + } + } + } + } + } + + public static float readFloat(Properties p_readFloat_0_, String p_readFloat_1_, float p_readFloat_2_) + { + String s = p_readFloat_0_.getProperty(p_readFloat_1_); + + if (s == null) + { + return p_readFloat_2_; + } + else + { + float f = Config.parseFloat(s, Float.MIN_VALUE); + + if (f == Float.MIN_VALUE) + { + Config.warn("Invalid value for " + p_readFloat_1_ + ": " + s); + return p_readFloat_2_; + } + else + { + return f; + } + } + } + + public static ResourceLocation getHdFontLocation(ResourceLocation p_getHdFontLocation_0_) + { + if (!Config.isCustomFonts()) + { + return p_getHdFontLocation_0_; + } + else if (p_getHdFontLocation_0_ == null) + { + return p_getHdFontLocation_0_; + } + else + { + String s = p_getHdFontLocation_0_.getResourcePath(); + String s1 = "textures/"; + String s2 = "mcpatcher/"; + + if (!s.startsWith(s1)) + { + return p_getHdFontLocation_0_; + } + else + { + s = s.substring(s1.length()); + s = s2 + s; + ResourceLocation resourcelocation = new ResourceLocation(p_getHdFontLocation_0_.getResourceDomain(), s); + return Config.hasResource(Config.getResourceManager(), resourcelocation) ? resourcelocation : p_getHdFontLocation_0_; + } + } + } +} diff --git a/src/minecraft/optifine/GlVersion.java b/src/minecraft/optifine/GlVersion.java new file mode 100644 index 0000000..6421410 --- /dev/null +++ b/src/minecraft/optifine/GlVersion.java @@ -0,0 +1,52 @@ +package optifine; + +public class GlVersion +{ + private int major; + private int minor; + private int release; + private String suffix; + + public GlVersion(int p_i43_1_, int p_i43_2_) + { + this(p_i43_1_, p_i43_2_, 0); + } + + public GlVersion(int p_i44_1_, int p_i44_2_, int p_i44_3_) + { + this(p_i44_1_, p_i44_2_, p_i44_3_, (String)null); + } + + public GlVersion(int p_i45_1_, int p_i45_2_, int p_i45_3_, String p_i45_4_) + { + this.major = p_i45_1_; + this.minor = p_i45_2_; + this.release = p_i45_3_; + this.suffix = p_i45_4_; + } + + public int getMajor() + { + return this.major; + } + + public int getMinor() + { + return this.minor; + } + + public int getRelease() + { + return this.release; + } + + public int toInt() + { + return this.minor > 9 ? this.major * 100 + this.minor : (this.release > 9 ? this.major * 100 + this.minor * 10 + 9 : this.major * 100 + this.minor * 10 + this.release); + } + + public String toString() + { + return this.suffix == null ? "" + this.major + "." + this.minor + "." + this.release : "" + this.major + "." + this.minor + "." + this.release + this.suffix; + } +} diff --git a/src/minecraft/optifine/GuiAnimationSettingsOF.java b/src/minecraft/optifine/GuiAnimationSettingsOF.java new file mode 100644 index 0000000..f9061db --- /dev/null +++ b/src/minecraft/optifine/GuiAnimationSettingsOF.java @@ -0,0 +1,96 @@ +package optifine; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiOptionButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; + +public class GuiAnimationSettingsOF extends GuiScreen +{ + private GuiScreen prevScreen; + protected String title; + private GameSettings settings; + private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.ANIMATED_WATER, GameSettings.Options.ANIMATED_LAVA, GameSettings.Options.ANIMATED_FIRE, GameSettings.Options.ANIMATED_PORTAL, GameSettings.Options.ANIMATED_REDSTONE, GameSettings.Options.ANIMATED_EXPLOSION, GameSettings.Options.ANIMATED_FLAME, GameSettings.Options.ANIMATED_SMOKE, GameSettings.Options.VOID_PARTICLES, GameSettings.Options.WATER_PARTICLES, GameSettings.Options.RAIN_SPLASH, GameSettings.Options.PORTAL_PARTICLES, GameSettings.Options.POTION_PARTICLES, GameSettings.Options.DRIPPING_WATER_LAVA, GameSettings.Options.ANIMATED_TERRAIN, GameSettings.Options.ANIMATED_TEXTURES, GameSettings.Options.FIREWORK_PARTICLES, GameSettings.Options.PARTICLES}; + + public GuiAnimationSettingsOF(GuiScreen p_i46_1_, GameSettings p_i46_2_) + { + this.prevScreen = p_i46_1_; + this.settings = p_i46_2_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.title = I18n.format("of.options.animationsTitle", new Object[0]); + this.buttonList.clear(); + + for (int i = 0; i < enumOptions.length; ++i) + { + GameSettings.Options gamesettings$options = enumOptions[i]; + int j = this.width / 2 - 155 + i % 2 * 160; + int k = this.height / 6 + 21 * (i / 2) - 12; + + if (!gamesettings$options.getEnumFloat()) + { + this.buttonList.add(new GuiOptionButtonOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options, this.settings.getKeyBinding(gamesettings$options))); + } + else + { + this.buttonList.add(new GuiOptionSliderOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options)); + } + } + + this.buttonList.add(new GuiButton(210, this.width / 2 - 155, this.height / 6 + 168 + 11, 70, 20, Lang.get("of.options.animation.allOn"))); + this.buttonList.add(new GuiButton(211, this.width / 2 - 155 + 80, this.height / 6 + 168 + 11, 70, 20, Lang.get("of.options.animation.allOff"))); + this.buttonList.add(new GuiOptionButton(200, this.width / 2 + 5, this.height / 6 + 168 + 11, I18n.format("gui.done", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) + { + if (button.enabled) + { + if (button.id < 200 && button instanceof GuiOptionButton) + { + this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1); + button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id)); + } + + if (button.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.prevScreen); + } + + if (button.id == 210) + { + this.mc.gameSettings.setAllAnimations(true); + } + + if (button.id == 211) + { + this.mc.gameSettings.setAllAnimations(false); + } + + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + this.setWorldAndResolution(this.mc, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight()); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 15, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/minecraft/optifine/GuiDetailSettingsOF.java b/src/minecraft/optifine/GuiDetailSettingsOF.java new file mode 100644 index 0000000..e58eaf3 --- /dev/null +++ b/src/minecraft/optifine/GuiDetailSettingsOF.java @@ -0,0 +1,82 @@ +package optifine; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiOptionButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; + +public class GuiDetailSettingsOF extends GuiScreen +{ + private GuiScreen prevScreen; + protected String title; + private GameSettings settings; + private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.CLOUDS, GameSettings.Options.CLOUD_HEIGHT, GameSettings.Options.TREES, GameSettings.Options.RAIN, GameSettings.Options.SKY, GameSettings.Options.STARS, GameSettings.Options.SUN_MOON, GameSettings.Options.SHOW_CAPES, GameSettings.Options.TRANSLUCENT_BLOCKS, GameSettings.Options.HELD_ITEM_TOOLTIPS, GameSettings.Options.DROPPED_ITEMS, GameSettings.Options.ENTITY_SHADOWS, GameSettings.Options.VIGNETTE, GameSettings.Options.DYNAMIC_FOV}; + private TooltipManager tooltipManager = new TooltipManager(this); + + public GuiDetailSettingsOF(GuiScreen p_i47_1_, GameSettings p_i47_2_) + { + this.prevScreen = p_i47_1_; + this.settings = p_i47_2_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.title = I18n.format("of.options.detailsTitle", new Object[0]); + this.buttonList.clear(); + + for (int i = 0; i < enumOptions.length; ++i) + { + GameSettings.Options gamesettings$options = enumOptions[i]; + int j = this.width / 2 - 155 + i % 2 * 160; + int k = this.height / 6 + 21 * (i / 2) - 12; + + if (!gamesettings$options.getEnumFloat()) + { + this.buttonList.add(new GuiOptionButtonOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options, this.settings.getKeyBinding(gamesettings$options))); + } + else + { + this.buttonList.add(new GuiOptionSliderOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options)); + } + } + + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168 + 11, I18n.format("gui.done", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) + { + if (button.enabled) + { + if (button.id < 200 && button instanceof GuiOptionButton) + { + this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1); + button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id)); + } + + if (button.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.prevScreen); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 15, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + this.tooltipManager.drawTooltips(mouseX, mouseY, this.buttonList); + } +} diff --git a/src/minecraft/optifine/GuiMessage.java b/src/minecraft/optifine/GuiMessage.java new file mode 100644 index 0000000..68e2fa0 --- /dev/null +++ b/src/minecraft/optifine/GuiMessage.java @@ -0,0 +1,90 @@ +package optifine; + +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiOptionButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; + +public class GuiMessage extends GuiScreen +{ + private GuiScreen parentScreen; + private String messageLine1; + private String messageLine2; + private final List listLines2 = Lists.newArrayList(); + protected String confirmButtonText; + private int ticksUntilEnable; + + public GuiMessage(GuiScreen p_i48_1_, String p_i48_2_, String p_i48_3_) + { + this.parentScreen = p_i48_1_; + this.messageLine1 = p_i48_2_; + this.messageLine2 = p_i48_3_; + this.confirmButtonText = I18n.format("gui.done", new Object[0]); + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.buttonList.add(new GuiOptionButton(0, this.width / 2 - 74, this.height / 6 + 96, this.confirmButtonText)); + this.listLines2.clear(); + this.listLines2.addAll(this.fontRendererObj.listFormattedStringToWidth(this.messageLine2, this.width - 50)); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) throws IOException + { + Config.getMinecraft().displayGuiScreen(this.parentScreen); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.messageLine1, this.width / 2, 70, 16777215); + int i = 90; + + for (Object s : this.listLines2) + { + this.drawCenteredString(this.fontRendererObj, (String) s, this.width / 2, i, 16777215); + i += this.fontRendererObj.FONT_HEIGHT; + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + public void setButtonDelay(int p_setButtonDelay_1_) + { + this.ticksUntilEnable = p_setButtonDelay_1_; + + for (GuiButton guibutton : this.buttonList) + { + guibutton.enabled = false; + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + + if (--this.ticksUntilEnable == 0) + { + for (GuiButton guibutton : this.buttonList) + { + guibutton.enabled = true; + } + } + } +} diff --git a/src/minecraft/optifine/GuiOptionButtonOF.java b/src/minecraft/optifine/GuiOptionButtonOF.java new file mode 100644 index 0000000..34ddf86 --- /dev/null +++ b/src/minecraft/optifine/GuiOptionButtonOF.java @@ -0,0 +1,20 @@ +package optifine; + +import net.minecraft.client.gui.GuiOptionButton; +import net.minecraft.client.settings.GameSettings; + +public class GuiOptionButtonOF extends GuiOptionButton implements IOptionControl +{ + private GameSettings.Options option = null; + + public GuiOptionButtonOF(int p_i49_1_, int p_i49_2_, int p_i49_3_, GameSettings.Options p_i49_4_, String p_i49_5_) + { + super(p_i49_1_, p_i49_2_, p_i49_3_, p_i49_4_, p_i49_5_); + this.option = p_i49_4_; + } + + public GameSettings.Options getOption() + { + return this.option; + } +} diff --git a/src/minecraft/optifine/GuiOptionSliderOF.java b/src/minecraft/optifine/GuiOptionSliderOF.java new file mode 100644 index 0000000..38fa9de --- /dev/null +++ b/src/minecraft/optifine/GuiOptionSliderOF.java @@ -0,0 +1,20 @@ +package optifine; + +import net.minecraft.client.gui.GuiOptionSlider; +import net.minecraft.client.settings.GameSettings; + +public class GuiOptionSliderOF extends GuiOptionSlider implements IOptionControl +{ + private GameSettings.Options option = null; + + public GuiOptionSliderOF(int p_i50_1_, int p_i50_2_, int p_i50_3_, GameSettings.Options p_i50_4_) + { + super(p_i50_1_, p_i50_2_, p_i50_3_, p_i50_4_); + this.option = p_i50_4_; + } + + public GameSettings.Options getOption() + { + return this.option; + } +} diff --git a/src/minecraft/optifine/GuiOtherSettingsOF.java b/src/minecraft/optifine/GuiOtherSettingsOF.java new file mode 100644 index 0000000..4868187 --- /dev/null +++ b/src/minecraft/optifine/GuiOtherSettingsOF.java @@ -0,0 +1,102 @@ +package optifine; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiOptionButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiYesNo; +import net.minecraft.client.gui.GuiYesNoCallback; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; + +public class GuiOtherSettingsOF extends GuiScreen implements GuiYesNoCallback +{ + private GuiScreen prevScreen; + protected String title; + private GameSettings settings; + private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.LAGOMETER, GameSettings.Options.PROFILER, GameSettings.Options.WEATHER, GameSettings.Options.TIME, GameSettings.Options.USE_FULLSCREEN, GameSettings.Options.FULLSCREEN_MODE, GameSettings.Options.SHOW_FPS, GameSettings.Options.AUTOSAVE_TICKS, GameSettings.Options.ANAGLYPH}; + private TooltipManager tooltipManager = new TooltipManager(this); + + public GuiOtherSettingsOF(GuiScreen p_i51_1_, GameSettings p_i51_2_) + { + this.prevScreen = p_i51_1_; + this.settings = p_i51_2_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.title = I18n.format("of.options.otherTitle", new Object[0]); + this.buttonList.clear(); + + for (int i = 0; i < enumOptions.length; ++i) + { + GameSettings.Options gamesettings$options = enumOptions[i]; + int j = this.width / 2 - 155 + i % 2 * 160; + int k = this.height / 6 + 21 * (i / 2) - 12; + + if (!gamesettings$options.getEnumFloat()) + { + this.buttonList.add(new GuiOptionButtonOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options, this.settings.getKeyBinding(gamesettings$options))); + } + else + { + this.buttonList.add(new GuiOptionSliderOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options)); + } + } + + this.buttonList.add(new GuiButton(210, this.width / 2 - 100, this.height / 6 + 168 + 11 - 44, I18n.format("of.options.other.reset", new Object[0]))); + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168 + 11, I18n.format("gui.done", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) + { + if (button.enabled) + { + if (button.id < 200 && button instanceof GuiOptionButton) + { + this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1); + button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id)); + } + + if (button.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.prevScreen); + } + + if (button.id == 210) + { + this.mc.gameSettings.saveOptions(); + GuiYesNo guiyesno = new GuiYesNo(this, I18n.format("of.message.other.reset", new Object[0]), "", 9999); + this.mc.displayGuiScreen(guiyesno); + } + } + } + + public void confirmClicked(boolean result, int id) + { + if (result) + { + this.mc.gameSettings.resetSettings(); + } + + this.mc.displayGuiScreen(this); + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 15, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + this.tooltipManager.drawTooltips(mouseX, mouseY, this.buttonList); + } +} diff --git a/src/minecraft/optifine/GuiPerformanceSettingsOF.java b/src/minecraft/optifine/GuiPerformanceSettingsOF.java new file mode 100644 index 0000000..d7c2d1b --- /dev/null +++ b/src/minecraft/optifine/GuiPerformanceSettingsOF.java @@ -0,0 +1,82 @@ +package optifine; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiOptionButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; + +public class GuiPerformanceSettingsOF extends GuiScreen +{ + private GuiScreen prevScreen; + protected String title; + private GameSettings settings; + private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.SMOOTH_FPS, GameSettings.Options.SMOOTH_WORLD, GameSettings.Options.FAST_RENDER, GameSettings.Options.FAST_MATH, GameSettings.Options.CHUNK_UPDATES, GameSettings.Options.CHUNK_UPDATES_DYNAMIC, GameSettings.Options.LAZY_CHUNK_LOADING}; + private TooltipManager tooltipManager = new TooltipManager(this); + + public GuiPerformanceSettingsOF(GuiScreen p_i52_1_, GameSettings p_i52_2_) + { + this.prevScreen = p_i52_1_; + this.settings = p_i52_2_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.title = I18n.format("of.options.performanceTitle", new Object[0]); + this.buttonList.clear(); + + for (int i = 0; i < enumOptions.length; ++i) + { + GameSettings.Options gamesettings$options = enumOptions[i]; + int j = this.width / 2 - 155 + i % 2 * 160; + int k = this.height / 6 + 21 * (i / 2) - 12; + + if (!gamesettings$options.getEnumFloat()) + { + this.buttonList.add(new GuiOptionButtonOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options, this.settings.getKeyBinding(gamesettings$options))); + } + else + { + this.buttonList.add(new GuiOptionSliderOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options)); + } + } + + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168 + 11, I18n.format("gui.done", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) + { + if (button.enabled) + { + if (button.id < 200 && button instanceof GuiOptionButton) + { + this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1); + button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id)); + } + + if (button.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.prevScreen); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 15, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + this.tooltipManager.drawTooltips(mouseX, mouseY, this.buttonList); + } +} diff --git a/src/minecraft/optifine/GuiQualitySettingsOF.java b/src/minecraft/optifine/GuiQualitySettingsOF.java new file mode 100644 index 0000000..aced7dd --- /dev/null +++ b/src/minecraft/optifine/GuiQualitySettingsOF.java @@ -0,0 +1,89 @@ +package optifine; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiOptionButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; + +public class GuiQualitySettingsOF extends GuiScreen +{ + private GuiScreen prevScreen; + protected String title; + private GameSettings settings; + private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.MIPMAP_TYPE, GameSettings.Options.AF_LEVEL, GameSettings.Options.AA_LEVEL, GameSettings.Options.CLEAR_WATER, GameSettings.Options.RANDOM_MOBS, GameSettings.Options.BETTER_GRASS, GameSettings.Options.BETTER_SNOW, GameSettings.Options.CUSTOM_FONTS, GameSettings.Options.CUSTOM_COLORS, GameSettings.Options.SWAMP_COLORS, GameSettings.Options.SMOOTH_BIOMES, GameSettings.Options.CONNECTED_TEXTURES, GameSettings.Options.NATURAL_TEXTURES, GameSettings.Options.CUSTOM_SKY, GameSettings.Options.CUSTOM_ITEMS, GameSettings.Options.DYNAMIC_LIGHTS}; + private TooltipManager tooltipManager = new TooltipManager(this); + + public GuiQualitySettingsOF(GuiScreen p_i53_1_, GameSettings p_i53_2_) + { + this.prevScreen = p_i53_1_; + this.settings = p_i53_2_; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.title = I18n.format("of.options.qualityTitle", new Object[0]); + this.buttonList.clear(); + + for (int i = 0; i < enumOptions.length; ++i) + { + GameSettings.Options gamesettings$options = enumOptions[i]; + int j = this.width / 2 - 155 + i % 2 * 160; + int k = this.height / 6 + 21 * (i / 2) - 12; + + if (!gamesettings$options.getEnumFloat()) + { + this.buttonList.add(new GuiOptionButtonOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options, this.settings.getKeyBinding(gamesettings$options))); + } + else + { + this.buttonList.add(new GuiOptionSliderOF(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options)); + } + } + + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168 + 11, I18n.format("gui.done", new Object[0]))); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) + { + if (button.enabled) + { + if (button.id < 200 && button instanceof GuiOptionButton) + { + this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1); + button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id)); + } + + if (button.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.prevScreen); + } + + if (button.id != GameSettings.Options.AA_LEVEL.ordinal()) + { + ScaledResolution scaledresolution = new ScaledResolution(this.mc); + this.setWorldAndResolution(this.mc, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight()); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 15, 16777215); + super.drawScreen(mouseX, mouseY, partialTicks); + this.tooltipManager.drawTooltips(mouseX, mouseY, this.buttonList); + } +} diff --git a/src/minecraft/optifine/GuiScreenOF.java b/src/minecraft/optifine/GuiScreenOF.java new file mode 100644 index 0000000..efc89c8 --- /dev/null +++ b/src/minecraft/optifine/GuiScreenOF.java @@ -0,0 +1,54 @@ +package optifine; + +import java.io.IOException; +import java.util.List; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiVideoSettings; + +public class GuiScreenOF extends GuiScreen +{ + protected void actionPerformedRightClick(GuiButton p_actionPerformedRightClick_1_) throws IOException + { + } + + /** + * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton + */ + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException + { + super.mouseClicked(mouseX, mouseY, mouseButton); + + if (mouseButton == 1) + { + GuiButton guibutton = getSelectedButton(this.buttonList, mouseX, mouseY); + + if (guibutton != null && guibutton.enabled) + { + guibutton.playPressSound(this.mc.getSoundHandler()); + this.actionPerformedRightClick(guibutton); + } + } + } + + public static GuiButton getSelectedButton(List p_getSelectedButton_0_, int p_getSelectedButton_1_, int p_getSelectedButton_2_) + { + for (int i = 0; i < p_getSelectedButton_0_.size(); ++i) + { + GuiButton guibutton = (GuiButton)p_getSelectedButton_0_.get(i); + + if (guibutton.visible) + { + int j = GuiVideoSettings.getButtonWidth(guibutton); + int k = GuiVideoSettings.getButtonHeight(guibutton); + + if (p_getSelectedButton_1_ >= guibutton.xPosition && p_getSelectedButton_2_ >= guibutton.yPosition && p_getSelectedButton_1_ < guibutton.xPosition + j && p_getSelectedButton_2_ < guibutton.yPosition + k) + { + return guibutton; + } + } + } + + return null; + } +} diff --git a/src/minecraft/optifine/HttpListener.java b/src/minecraft/optifine/HttpListener.java new file mode 100644 index 0000000..8e41ca3 --- /dev/null +++ b/src/minecraft/optifine/HttpListener.java @@ -0,0 +1,8 @@ +package optifine; + +public interface HttpListener +{ + void finished(HttpRequest var1, HttpResponse var2); + + void failed(HttpRequest var1, Exception var2); +} diff --git a/src/minecraft/optifine/HttpPipeline.java b/src/minecraft/optifine/HttpPipeline.java new file mode 100644 index 0000000..58f4ec8 --- /dev/null +++ b/src/minecraft/optifine/HttpPipeline.java @@ -0,0 +1,213 @@ +package optifine; + +import java.io.IOException; +import java.io.InterruptedIOException; +import java.net.Proxy; +import java.net.URL; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +public class HttpPipeline +{ + private static Map mapConnections = new HashMap(); + public static final String HEADER_USER_AGENT = "User-Agent"; + public static final String HEADER_HOST = "Host"; + public static final String HEADER_ACCEPT = "Accept"; + public static final String HEADER_LOCATION = "Location"; + public static final String HEADER_KEEP_ALIVE = "Keep-Alive"; + public static final String HEADER_CONNECTION = "Connection"; + public static final String HEADER_VALUE_KEEP_ALIVE = "keep-alive"; + public static final String HEADER_TRANSFER_ENCODING = "Transfer-Encoding"; + public static final String HEADER_VALUE_CHUNKED = "chunked"; + + public static void addRequest(String p_addRequest_0_, HttpListener p_addRequest_1_) throws IOException + { + addRequest(p_addRequest_0_, p_addRequest_1_, Proxy.NO_PROXY); + } + + public static void addRequest(String p_addRequest_0_, HttpListener p_addRequest_1_, Proxy p_addRequest_2_) throws IOException + { + HttpRequest httprequest = makeRequest(p_addRequest_0_, p_addRequest_2_); + HttpPipelineRequest httppipelinerequest = new HttpPipelineRequest(httprequest, p_addRequest_1_); + addRequest(httppipelinerequest); + } + + public static HttpRequest makeRequest(String p_makeRequest_0_, Proxy p_makeRequest_1_) throws IOException + { + URL url = new URL(p_makeRequest_0_); + + if (!url.getProtocol().equals("http")) + { + throw new IOException("Only protocol http is supported: " + url); + } + else + { + String s = url.getFile(); + String s1 = url.getHost(); + int i = url.getPort(); + + if (i <= 0) + { + i = 80; + } + + String s2 = "GET"; + String s3 = "HTTP/1.1"; + Map map = new LinkedHashMap(); + map.put("User-Agent", "Java/" + System.getProperty("java.version")); + map.put("Host", s1); + map.put("Accept", "text/html, image/gif, image/png"); + map.put("Connection", "keep-alive"); + byte[] abyte = new byte[0]; + HttpRequest httprequest = new HttpRequest(s1, i, p_makeRequest_1_, s2, s, s3, map, abyte); + return httprequest; + } + } + + public static void addRequest(HttpPipelineRequest p_addRequest_0_) + { + HttpRequest httprequest = p_addRequest_0_.getHttpRequest(); + + for (HttpPipelineConnection httppipelineconnection = getConnection(httprequest.getHost(), httprequest.getPort(), httprequest.getProxy()); !httppipelineconnection.addRequest(p_addRequest_0_); httppipelineconnection = getConnection(httprequest.getHost(), httprequest.getPort(), httprequest.getProxy())) + { + removeConnection(httprequest.getHost(), httprequest.getPort(), httprequest.getProxy(), httppipelineconnection); + } + } + + private static synchronized HttpPipelineConnection getConnection(String p_getConnection_0_, int p_getConnection_1_, Proxy p_getConnection_2_) + { + String s = makeConnectionKey(p_getConnection_0_, p_getConnection_1_, p_getConnection_2_); + HttpPipelineConnection httppipelineconnection = (HttpPipelineConnection)mapConnections.get(s); + + if (httppipelineconnection == null) + { + httppipelineconnection = new HttpPipelineConnection(p_getConnection_0_, p_getConnection_1_, p_getConnection_2_); + mapConnections.put(s, httppipelineconnection); + } + + return httppipelineconnection; + } + + private static synchronized void removeConnection(String p_removeConnection_0_, int p_removeConnection_1_, Proxy p_removeConnection_2_, HttpPipelineConnection p_removeConnection_3_) + { + String s = makeConnectionKey(p_removeConnection_0_, p_removeConnection_1_, p_removeConnection_2_); + HttpPipelineConnection httppipelineconnection = (HttpPipelineConnection)mapConnections.get(s); + + if (httppipelineconnection == p_removeConnection_3_) + { + mapConnections.remove(s); + } + } + + private static String makeConnectionKey(String p_makeConnectionKey_0_, int p_makeConnectionKey_1_, Proxy p_makeConnectionKey_2_) + { + String s = p_makeConnectionKey_0_ + ":" + p_makeConnectionKey_1_ + "-" + p_makeConnectionKey_2_; + return s; + } + + public static byte[] get(String p_get_0_) throws IOException + { + return get(p_get_0_, Proxy.NO_PROXY); + } + + public static byte[] get(String p_get_0_, Proxy p_get_1_) throws IOException + { + HttpRequest httprequest = makeRequest(p_get_0_, p_get_1_); + HttpResponse httpresponse = executeRequest(httprequest); + + if (httpresponse.getStatus() / 100 != 2) + { + throw new IOException("HTTP response: " + httpresponse.getStatus()); + } + else + { + return httpresponse.getBody(); + } + } + + public static HttpResponse executeRequest(HttpRequest p_executeRequest_0_) throws IOException + { + final Map map = new HashMap(); + String s = "Response"; + String s1 = "Exception"; + HttpListener httplistener = new HttpListener() + { + public void finished(HttpRequest p_finished_1_, HttpResponse p_finished_2_) + { + synchronized (map) + { + map.put("Response", p_finished_2_); + map.notifyAll(); + } + } + public void failed(HttpRequest p_failed_1_, Exception p_failed_2_) + { + synchronized (map) + { + map.put("Exception", p_failed_2_); + map.notifyAll(); + } + } + }; + + synchronized (map) + { + HttpPipelineRequest httppipelinerequest = new HttpPipelineRequest(p_executeRequest_0_, httplistener); + addRequest(httppipelinerequest); + + try + { + map.wait(); + } + catch (InterruptedException var10) + { + throw new InterruptedIOException("Interrupted"); + } + + Exception exception = (Exception)map.get("Exception"); + + if (exception != null) + { + if (exception instanceof IOException) + { + throw(IOException)exception; + } + else if (exception instanceof RuntimeException) + { + throw(RuntimeException)exception; + } + else + { + throw new RuntimeException(exception.getMessage(), exception); + } + } + else + { + HttpResponse httpresponse = (HttpResponse)map.get("Response"); + + if (httpresponse == null) + { + throw new IOException("Response is null"); + } + else + { + return httpresponse; + } + } + } + } + + public static boolean hasActiveRequests() + { + for (Object httppipelineconnection : mapConnections.values()) + { + if (((HttpPipelineConnection) httppipelineconnection).hasActiveRequests()) + { + return true; + } + } + + return false; + } +} diff --git a/src/minecraft/optifine/HttpPipelineConnection.java b/src/minecraft/optifine/HttpPipelineConnection.java new file mode 100644 index 0000000..0f87997 --- /dev/null +++ b/src/minecraft/optifine/HttpPipelineConnection.java @@ -0,0 +1,430 @@ +package optifine; + +import java.io.BufferedOutputStream; +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.Proxy; +import java.net.Socket; +import java.util.LinkedList; +import java.util.List; +import java.util.regex.Pattern; + +public class HttpPipelineConnection +{ + private String host; + private int port; + private Proxy proxy; + private List listRequests; + private List listRequestsSend; + private Socket socket; + private InputStream inputStream; + private OutputStream outputStream; + private HttpPipelineSender httpPipelineSender; + private HttpPipelineReceiver httpPipelineReceiver; + private int countRequests; + private boolean responseReceived; + private long keepaliveTimeoutMs; + private int keepaliveMaxCount; + private long timeLastActivityMs; + private boolean terminated; + private static final String LF = "\n"; + public static final int TIMEOUT_CONNECT_MS = 5000; + public static final int TIMEOUT_READ_MS = 5000; + private static final Pattern patternFullUrl = Pattern.compile("^[a-zA-Z]+://.*"); + + public HttpPipelineConnection(String p_i55_1_, int p_i55_2_) + { + this(p_i55_1_, p_i55_2_, Proxy.NO_PROXY); + } + + public HttpPipelineConnection(String p_i56_1_, int p_i56_2_, Proxy p_i56_3_) + { + this.host = null; + this.port = 0; + this.proxy = Proxy.NO_PROXY; + this.listRequests = new LinkedList(); + this.listRequestsSend = new LinkedList(); + this.socket = null; + this.inputStream = null; + this.outputStream = null; + this.httpPipelineSender = null; + this.httpPipelineReceiver = null; + this.countRequests = 0; + this.responseReceived = false; + this.keepaliveTimeoutMs = 5000L; + this.keepaliveMaxCount = 1000; + this.timeLastActivityMs = System.currentTimeMillis(); + this.terminated = false; + this.host = p_i56_1_; + this.port = p_i56_2_; + this.proxy = p_i56_3_; + this.httpPipelineSender = new HttpPipelineSender(this); + this.httpPipelineSender.start(); + this.httpPipelineReceiver = new HttpPipelineReceiver(this); + this.httpPipelineReceiver.start(); + } + + public synchronized boolean addRequest(HttpPipelineRequest p_addRequest_1_) + { + if (this.isClosed()) + { + return false; + } + else + { + this.addRequest(p_addRequest_1_, this.listRequests); + this.addRequest(p_addRequest_1_, this.listRequestsSend); + ++this.countRequests; + return true; + } + } + + private void addRequest(HttpPipelineRequest p_addRequest_1_, List p_addRequest_2_) + { + p_addRequest_2_.add(p_addRequest_1_); + this.notifyAll(); + } + + public synchronized void setSocket(Socket p_setSocket_1_) throws IOException + { + if (!this.terminated) + { + if (this.socket != null) + { + throw new IllegalArgumentException("Already connected"); + } + else + { + this.socket = p_setSocket_1_; + this.socket.setTcpNoDelay(true); + this.inputStream = this.socket.getInputStream(); + this.outputStream = new BufferedOutputStream(this.socket.getOutputStream()); + this.onActivity(); + this.notifyAll(); + } + } + } + + public synchronized OutputStream getOutputStream() throws IOException, InterruptedException + { + while (this.outputStream == null) + { + this.checkTimeout(); + this.wait(1000L); + } + + return this.outputStream; + } + + public synchronized InputStream getInputStream() throws IOException, InterruptedException + { + while (this.inputStream == null) + { + this.checkTimeout(); + this.wait(1000L); + } + + return this.inputStream; + } + + public synchronized HttpPipelineRequest getNextRequestSend() throws InterruptedException, IOException + { + if (this.listRequestsSend.size() <= 0 && this.outputStream != null) + { + this.outputStream.flush(); + } + + return this.getNextRequest(this.listRequestsSend, true); + } + + public synchronized HttpPipelineRequest getNextRequestReceive() throws InterruptedException + { + return this.getNextRequest(this.listRequests, false); + } + + private HttpPipelineRequest getNextRequest(List p_getNextRequest_1_, boolean p_getNextRequest_2_) throws InterruptedException + { + while (p_getNextRequest_1_.size() <= 0) + { + this.checkTimeout(); + this.wait(1000L); + } + + this.onActivity(); + + if (p_getNextRequest_2_) + { + return (HttpPipelineRequest)p_getNextRequest_1_.remove(0); + } + else + { + return (HttpPipelineRequest)p_getNextRequest_1_.get(0); + } + } + + private void checkTimeout() + { + if (this.socket != null) + { + long i = this.keepaliveTimeoutMs; + + if (this.listRequests.size() > 0) + { + i = 5000L; + } + + long j = System.currentTimeMillis(); + + if (j > this.timeLastActivityMs + i) + { + this.terminate(new InterruptedException("Timeout " + i)); + } + } + } + + private void onActivity() + { + this.timeLastActivityMs = System.currentTimeMillis(); + } + + public synchronized void onRequestSent(HttpPipelineRequest p_onRequestSent_1_) + { + if (!this.terminated) + { + this.onActivity(); + } + } + + public synchronized void onResponseReceived(HttpPipelineRequest p_onResponseReceived_1_, HttpResponse p_onResponseReceived_2_) + { + if (!this.terminated) + { + this.responseReceived = true; + this.onActivity(); + + if (this.listRequests.size() > 0 && this.listRequests.get(0) == p_onResponseReceived_1_) + { + this.listRequests.remove(0); + p_onResponseReceived_1_.setClosed(true); + String s = p_onResponseReceived_2_.getHeader("Location"); + + if (p_onResponseReceived_2_.getStatus() / 100 == 3 && s != null && p_onResponseReceived_1_.getHttpRequest().getRedirects() < 5) + { + try + { + s = this.normalizeUrl(s, p_onResponseReceived_1_.getHttpRequest()); + HttpRequest httprequest = HttpPipeline.makeRequest(s, p_onResponseReceived_1_.getHttpRequest().getProxy()); + httprequest.setRedirects(p_onResponseReceived_1_.getHttpRequest().getRedirects() + 1); + HttpPipelineRequest httppipelinerequest = new HttpPipelineRequest(httprequest, p_onResponseReceived_1_.getHttpListener()); + HttpPipeline.addRequest(httppipelinerequest); + } + catch (IOException ioexception) + { + p_onResponseReceived_1_.getHttpListener().failed(p_onResponseReceived_1_.getHttpRequest(), ioexception); + } + } + else + { + HttpListener httplistener = p_onResponseReceived_1_.getHttpListener(); + httplistener.finished(p_onResponseReceived_1_.getHttpRequest(), p_onResponseReceived_2_); + } + + this.checkResponseHeader(p_onResponseReceived_2_); + } + else + { + throw new IllegalArgumentException("Response out of order: " + p_onResponseReceived_1_); + } + } + } + + private String normalizeUrl(String p_normalizeUrl_1_, HttpRequest p_normalizeUrl_2_) + { + if (patternFullUrl.matcher(p_normalizeUrl_1_).matches()) + { + return p_normalizeUrl_1_; + } + else if (p_normalizeUrl_1_.startsWith("//")) + { + return "http:" + p_normalizeUrl_1_; + } + else + { + String s = p_normalizeUrl_2_.getHost(); + + if (p_normalizeUrl_2_.getPort() != 80) + { + s = s + ":" + p_normalizeUrl_2_.getPort(); + } + + if (p_normalizeUrl_1_.startsWith("/")) + { + return "http://" + s + p_normalizeUrl_1_; + } + else + { + String s1 = p_normalizeUrl_2_.getFile(); + int i = s1.lastIndexOf("/"); + return i >= 0 ? "http://" + s + s1.substring(0, i + 1) + p_normalizeUrl_1_ : "http://" + s + "/" + p_normalizeUrl_1_; + } + } + } + + private void checkResponseHeader(HttpResponse p_checkResponseHeader_1_) + { + String s = p_checkResponseHeader_1_.getHeader("Connection"); + + if (s != null && !s.toLowerCase().equals("keep-alive")) + { + this.terminate(new EOFException("Connection not keep-alive")); + } + + String s1 = p_checkResponseHeader_1_.getHeader("Keep-Alive"); + + if (s1 != null) + { + String[] astring = Config.tokenize(s1, ",;"); + + for (int i = 0; i < astring.length; ++i) + { + String s2 = astring[i]; + String[] astring1 = this.split(s2, '='); + + if (astring1.length >= 2) + { + if (astring1[0].equals("timeout")) + { + int j = Config.parseInt(astring1[1], -1); + + if (j > 0) + { + this.keepaliveTimeoutMs = (long)(j * 1000); + } + } + + if (astring1[0].equals("max")) + { + int k = Config.parseInt(astring1[1], -1); + + if (k > 0) + { + this.keepaliveMaxCount = k; + } + } + } + } + } + } + + private String[] split(String p_split_1_, char p_split_2_) + { + int i = p_split_1_.indexOf(p_split_2_); + + if (i < 0) + { + return new String[] {p_split_1_}; + } + else + { + String s = p_split_1_.substring(0, i); + String s1 = p_split_1_.substring(i + 1); + return new String[] {s, s1}; + } + } + + public synchronized void onExceptionSend(HttpPipelineRequest p_onExceptionSend_1_, Exception p_onExceptionSend_2_) + { + this.terminate(p_onExceptionSend_2_); + } + + public synchronized void onExceptionReceive(HttpPipelineRequest p_onExceptionReceive_1_, Exception p_onExceptionReceive_2_) + { + this.terminate(p_onExceptionReceive_2_); + } + + private synchronized void terminate(Exception p_terminate_1_) + { + if (!this.terminated) + { + this.terminated = true; + this.terminateRequests(p_terminate_1_); + + if (this.httpPipelineSender != null) + { + this.httpPipelineSender.interrupt(); + } + + if (this.httpPipelineReceiver != null) + { + this.httpPipelineReceiver.interrupt(); + } + + try + { + if (this.socket != null) + { + this.socket.close(); + } + } + catch (IOException var3) + { + ; + } + + this.socket = null; + this.inputStream = null; + this.outputStream = null; + } + } + + private void terminateRequests(Exception p_terminateRequests_1_) + { + if (this.listRequests.size() > 0) + { + if (!this.responseReceived) + { + HttpPipelineRequest httppipelinerequest = (HttpPipelineRequest)this.listRequests.remove(0); + httppipelinerequest.getHttpListener().failed(httppipelinerequest.getHttpRequest(), p_terminateRequests_1_); + httppipelinerequest.setClosed(true); + } + + while (this.listRequests.size() > 0) + { + HttpPipelineRequest httppipelinerequest1 = (HttpPipelineRequest)this.listRequests.remove(0); + HttpPipeline.addRequest(httppipelinerequest1); + } + } + } + + public synchronized boolean isClosed() + { + return this.terminated ? true : this.countRequests >= this.keepaliveMaxCount; + } + + public int getCountRequests() + { + return this.countRequests; + } + + public synchronized boolean hasActiveRequests() + { + return this.listRequests.size() > 0; + } + + public String getHost() + { + return this.host; + } + + public int getPort() + { + return this.port; + } + + public Proxy getProxy() + { + return this.proxy; + } +} diff --git a/src/minecraft/optifine/HttpPipelineReceiver.java b/src/minecraft/optifine/HttpPipelineReceiver.java new file mode 100644 index 0000000..a7de1a3 --- /dev/null +++ b/src/minecraft/optifine/HttpPipelineReceiver.java @@ -0,0 +1,183 @@ +package optifine; + +import java.io.ByteArrayOutputStream; +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.Charset; +import java.util.LinkedHashMap; +import java.util.Map; + +public class HttpPipelineReceiver extends Thread +{ + private HttpPipelineConnection httpPipelineConnection = null; + private static final Charset ASCII = Charset.forName("ASCII"); + private static final String HEADER_CONTENT_LENGTH = "Content-Length"; + private static final char CR = '\r'; + private static final char LF = '\n'; + + public HttpPipelineReceiver(HttpPipelineConnection p_i57_1_) + { + super("HttpPipelineReceiver"); + this.httpPipelineConnection = p_i57_1_; + } + + public void run() + { + while (!Thread.interrupted()) + { + HttpPipelineRequest httppipelinerequest = null; + + try + { + httppipelinerequest = this.httpPipelineConnection.getNextRequestReceive(); + InputStream inputstream = this.httpPipelineConnection.getInputStream(); + HttpResponse httpresponse = this.readResponse(inputstream); + this.httpPipelineConnection.onResponseReceived(httppipelinerequest, httpresponse); + } + catch (InterruptedException var4) + { + return; + } + catch (Exception exception) + { + this.httpPipelineConnection.onExceptionReceive(httppipelinerequest, exception); + } + } + } + + private HttpResponse readResponse(InputStream p_readResponse_1_) throws IOException + { + String s = this.readLine(p_readResponse_1_); + String[] astring = Config.tokenize(s, " "); + + if (astring.length < 3) + { + throw new IOException("Invalid status line: " + s); + } + else + { + String s1 = astring[0]; + int i = Config.parseInt(astring[1], 0); + String s2 = astring[2]; + Map map = new LinkedHashMap(); + + while (true) + { + String s3 = this.readLine(p_readResponse_1_); + + if (s3.length() <= 0) + { + byte[] abyte = null; + String s6 = (String)map.get("Content-Length"); + + if (s6 != null) + { + int k = Config.parseInt(s6, -1); + + if (k > 0) + { + abyte = new byte[k]; + this.readFull(abyte, p_readResponse_1_); + } + } + else + { + String s7 = (String)map.get("Transfer-Encoding"); + + if (Config.equals(s7, "chunked")) + { + abyte = this.readContentChunked(p_readResponse_1_); + } + } + + return new HttpResponse(i, s, map, abyte); + } + + int j = s3.indexOf(":"); + + if (j > 0) + { + String s4 = s3.substring(0, j).trim(); + String s5 = s3.substring(j + 1).trim(); + map.put(s4, s5); + } + } + } + } + + private byte[] readContentChunked(InputStream p_readContentChunked_1_) throws IOException + { + ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); + + while (true) + { + String s = this.readLine(p_readContentChunked_1_); + String[] astring = Config.tokenize(s, "; "); + int i = Integer.parseInt(astring[0], 16); + byte[] abyte = new byte[i]; + this.readFull(abyte, p_readContentChunked_1_); + bytearrayoutputstream.write(abyte); + this.readLine(p_readContentChunked_1_); + + if (i == 0) + { + break; + } + } + + return bytearrayoutputstream.toByteArray(); + } + + private void readFull(byte[] p_readFull_1_, InputStream p_readFull_2_) throws IOException + { + int j; + + for (int i = 0; i < p_readFull_1_.length; i += j) + { + j = p_readFull_2_.read(p_readFull_1_, i, p_readFull_1_.length - i); + + if (j < 0) + { + throw new EOFException(); + } + } + } + + private String readLine(InputStream p_readLine_1_) throws IOException + { + ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); + int i = -1; + boolean flag = false; + + while (true) + { + int j = p_readLine_1_.read(); + + if (j < 0) + { + break; + } + + bytearrayoutputstream.write(j); + + if (i == 13 && j == 10) + { + flag = true; + break; + } + + i = j; + } + + byte[] abyte = bytearrayoutputstream.toByteArray(); + String s = new String(abyte, ASCII); + + if (flag) + { + s = s.substring(0, s.length() - 2); + } + + return s; + } +} diff --git a/src/minecraft/optifine/HttpPipelineRequest.java b/src/minecraft/optifine/HttpPipelineRequest.java new file mode 100644 index 0000000..961e68e --- /dev/null +++ b/src/minecraft/optifine/HttpPipelineRequest.java @@ -0,0 +1,34 @@ +package optifine; + +public class HttpPipelineRequest +{ + private HttpRequest httpRequest = null; + private HttpListener httpListener = null; + private boolean closed = false; + + public HttpPipelineRequest(HttpRequest p_i58_1_, HttpListener p_i58_2_) + { + this.httpRequest = p_i58_1_; + this.httpListener = p_i58_2_; + } + + public HttpRequest getHttpRequest() + { + return this.httpRequest; + } + + public HttpListener getHttpListener() + { + return this.httpListener; + } + + public boolean isClosed() + { + return this.closed; + } + + public void setClosed(boolean p_setClosed_1_) + { + this.closed = p_setClosed_1_; + } +} diff --git a/src/minecraft/optifine/HttpPipelineSender.java b/src/minecraft/optifine/HttpPipelineSender.java new file mode 100644 index 0000000..90dffde --- /dev/null +++ b/src/minecraft/optifine/HttpPipelineSender.java @@ -0,0 +1,79 @@ +package optifine; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.Socket; +import java.nio.charset.Charset; +import java.util.Map; + +public class HttpPipelineSender extends Thread +{ + private HttpPipelineConnection httpPipelineConnection = null; + private static final String CRLF = "\r\n"; + private static Charset ASCII = Charset.forName("ASCII"); + + public HttpPipelineSender(HttpPipelineConnection p_i59_1_) + { + super("HttpPipelineSender"); + this.httpPipelineConnection = p_i59_1_; + } + + public void run() + { + HttpPipelineRequest httppipelinerequest = null; + + try + { + this.connect(); + + while (!Thread.interrupted()) + { + httppipelinerequest = this.httpPipelineConnection.getNextRequestSend(); + HttpRequest httprequest = httppipelinerequest.getHttpRequest(); + OutputStream outputstream = this.httpPipelineConnection.getOutputStream(); + this.writeRequest(httprequest, outputstream); + this.httpPipelineConnection.onRequestSent(httppipelinerequest); + } + } + catch (InterruptedException var4) + { + return; + } + catch (Exception exception) + { + this.httpPipelineConnection.onExceptionSend(httppipelinerequest, exception); + } + } + + private void connect() throws IOException + { + String s = this.httpPipelineConnection.getHost(); + int i = this.httpPipelineConnection.getPort(); + Proxy proxy = this.httpPipelineConnection.getProxy(); + Socket socket = new Socket(proxy); + socket.connect(new InetSocketAddress(s, i), 5000); + this.httpPipelineConnection.setSocket(socket); + } + + private void writeRequest(HttpRequest p_writeRequest_1_, OutputStream p_writeRequest_2_) throws IOException + { + this.write(p_writeRequest_2_, p_writeRequest_1_.getMethod() + " " + p_writeRequest_1_.getFile() + " " + p_writeRequest_1_.getHttp() + "\r\n"); + Map map = p_writeRequest_1_.getHeaders(); + + for (String s : map.keySet()) + { + String s1 = (String)p_writeRequest_1_.getHeaders().get(s); + this.write(p_writeRequest_2_, s + ": " + s1 + "\r\n"); + } + + this.write(p_writeRequest_2_, "\r\n"); + } + + private void write(OutputStream p_write_1_, String p_write_2_) throws IOException + { + byte[] abyte = p_write_2_.getBytes(ASCII); + p_write_1_.write(abyte); + } +} diff --git a/src/minecraft/optifine/HttpRequest.java b/src/minecraft/optifine/HttpRequest.java new file mode 100644 index 0000000..3ed23fa --- /dev/null +++ b/src/minecraft/optifine/HttpRequest.java @@ -0,0 +1,85 @@ +package optifine; + +import java.net.Proxy; +import java.util.LinkedHashMap; +import java.util.Map; + +public class HttpRequest +{ + private String host = null; + private int port = 0; + private Proxy proxy = Proxy.NO_PROXY; + private String method = null; + private String file = null; + private String http = null; + private Map headers = new LinkedHashMap(); + private byte[] body = null; + private int redirects = 0; + public static final String METHOD_GET = "GET"; + public static final String METHOD_HEAD = "HEAD"; + public static final String METHOD_POST = "POST"; + public static final String HTTP_1_0 = "HTTP/1.0"; + public static final String HTTP_1_1 = "HTTP/1.1"; + + public HttpRequest(String p_i60_1_, int p_i60_2_, Proxy p_i60_3_, String p_i60_4_, String p_i60_5_, String p_i60_6_, Map p_i60_7_, byte[] p_i60_8_) + { + this.host = p_i60_1_; + this.port = p_i60_2_; + this.proxy = p_i60_3_; + this.method = p_i60_4_; + this.file = p_i60_5_; + this.http = p_i60_6_; + this.headers = p_i60_7_; + this.body = p_i60_8_; + } + + public String getHost() + { + return this.host; + } + + public int getPort() + { + return this.port; + } + + public String getMethod() + { + return this.method; + } + + public String getFile() + { + return this.file; + } + + public String getHttp() + { + return this.http; + } + + public Map getHeaders() + { + return this.headers; + } + + public byte[] getBody() + { + return this.body; + } + + public int getRedirects() + { + return this.redirects; + } + + public void setRedirects(int p_setRedirects_1_) + { + this.redirects = p_setRedirects_1_; + } + + public Proxy getProxy() + { + return this.proxy; + } +} diff --git a/src/minecraft/optifine/HttpResponse.java b/src/minecraft/optifine/HttpResponse.java new file mode 100644 index 0000000..db8c7f2 --- /dev/null +++ b/src/minecraft/optifine/HttpResponse.java @@ -0,0 +1,45 @@ +package optifine; + +import java.util.LinkedHashMap; +import java.util.Map; + +public class HttpResponse +{ + private int status = 0; + private String statusLine = null; + private Map headers = new LinkedHashMap(); + private byte[] body = null; + + public HttpResponse(int p_i61_1_, String p_i61_2_, Map p_i61_3_, byte[] p_i61_4_) + { + this.status = p_i61_1_; + this.statusLine = p_i61_2_; + this.headers = p_i61_3_; + this.body = p_i61_4_; + } + + public int getStatus() + { + return this.status; + } + + public String getStatusLine() + { + return this.statusLine; + } + + public Map getHeaders() + { + return this.headers; + } + + public String getHeader(String p_getHeader_1_) + { + return (String)this.headers.get(p_getHeader_1_); + } + + public byte[] getBody() + { + return this.body; + } +} diff --git a/src/minecraft/optifine/HttpUtils.java b/src/minecraft/optifine/HttpUtils.java new file mode 100644 index 0000000..3df1693 --- /dev/null +++ b/src/minecraft/optifine/HttpUtils.java @@ -0,0 +1,130 @@ +package optifine; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Map; +import net.minecraft.client.Minecraft; + +public class HttpUtils +{ + public static final String SERVER_URL = "http://s.optifine.net"; + public static final String POST_URL = "http://optifine.net"; + + public static byte[] get(String p_get_0_) throws IOException + { + HttpURLConnection httpurlconnection = null; + byte[] abyte1; + + try + { + URL url = new URL(p_get_0_); + httpurlconnection = (HttpURLConnection)url.openConnection(Minecraft.getMinecraft().getProxy()); + httpurlconnection.setDoInput(true); + httpurlconnection.setDoOutput(false); + httpurlconnection.connect(); + + if (httpurlconnection.getResponseCode() / 100 != 2) + { + if (httpurlconnection.getErrorStream() != null) + { + Config.readAll(httpurlconnection.getErrorStream()); + } + + throw new IOException("HTTP response: " + httpurlconnection.getResponseCode()); + } + + InputStream inputstream = httpurlconnection.getInputStream(); + byte[] abyte = new byte[httpurlconnection.getContentLength()]; + int i = 0; + + while (true) + { + int j = inputstream.read(abyte, i, abyte.length - i); + + if (j < 0) + { + throw new IOException("Input stream closed: " + p_get_0_); + } + + i += j; + + if (i >= abyte.length) + { + break; + } + } + + abyte1 = abyte; + } + finally + { + if (httpurlconnection != null) + { + httpurlconnection.disconnect(); + } + } + + return abyte1; + } + + public static String post(String p_post_0_, Map p_post_1_, byte[] p_post_2_) throws IOException + { + HttpURLConnection httpurlconnection = null; + String s3; + + try + { + URL url = new URL(p_post_0_); + httpurlconnection = (HttpURLConnection)url.openConnection(Minecraft.getMinecraft().getProxy()); + httpurlconnection.setRequestMethod("POST"); + + if (p_post_1_ != null) + { + for (Object s : p_post_1_.keySet()) + { + String s1 = "" + p_post_1_.get(s); + httpurlconnection.setRequestProperty((String) s, s1); + } + } + + httpurlconnection.setRequestProperty("Content-Type", "text/plain"); + httpurlconnection.setRequestProperty("Content-Length", "" + p_post_2_.length); + httpurlconnection.setRequestProperty("Content-Language", "en-US"); + httpurlconnection.setUseCaches(false); + httpurlconnection.setDoInput(true); + httpurlconnection.setDoOutput(true); + OutputStream outputstream = httpurlconnection.getOutputStream(); + outputstream.write(p_post_2_); + outputstream.flush(); + outputstream.close(); + InputStream inputstream = httpurlconnection.getInputStream(); + InputStreamReader inputstreamreader = new InputStreamReader(inputstream, "ASCII"); + BufferedReader bufferedreader = new BufferedReader(inputstreamreader); + StringBuffer stringbuffer = new StringBuffer(); + String s2; + + while ((s2 = bufferedreader.readLine()) != null) + { + stringbuffer.append(s2); + stringbuffer.append('\r'); + } + + bufferedreader.close(); + s3 = stringbuffer.toString(); + } + finally + { + if (httpurlconnection != null) + { + httpurlconnection.disconnect(); + } + } + + return s3; + } +} diff --git a/src/minecraft/optifine/IFieldLocator.java b/src/minecraft/optifine/IFieldLocator.java new file mode 100644 index 0000000..fe0e7b1 --- /dev/null +++ b/src/minecraft/optifine/IFieldLocator.java @@ -0,0 +1,8 @@ +package optifine; + +import java.lang.reflect.Field; + +public interface IFieldLocator +{ + Field getField(); +} diff --git a/src/minecraft/optifine/IFileDownloadListener.java b/src/minecraft/optifine/IFileDownloadListener.java new file mode 100644 index 0000000..bba14e0 --- /dev/null +++ b/src/minecraft/optifine/IFileDownloadListener.java @@ -0,0 +1,6 @@ +package optifine; + +public interface IFileDownloadListener +{ + void fileDownloadFinished(String var1, byte[] var2, Throwable var3); +} diff --git a/src/minecraft/optifine/IFileUploadListener.java b/src/minecraft/optifine/IFileUploadListener.java new file mode 100644 index 0000000..7dbe7ff --- /dev/null +++ b/src/minecraft/optifine/IFileUploadListener.java @@ -0,0 +1,6 @@ +package optifine; + +public interface IFileUploadListener +{ + void fileUploadFinished(String var1, byte[] var2, Throwable var3); +} diff --git a/src/minecraft/optifine/IOptionControl.java b/src/minecraft/optifine/IOptionControl.java new file mode 100644 index 0000000..b598cc2 --- /dev/null +++ b/src/minecraft/optifine/IOptionControl.java @@ -0,0 +1,8 @@ +package optifine; + +import net.minecraft.client.settings.GameSettings; + +public interface IOptionControl +{ + GameSettings.Options getOption(); +} diff --git a/src/minecraft/optifine/IntArray.java b/src/minecraft/optifine/IntArray.java new file mode 100644 index 0000000..3f2b135 --- /dev/null +++ b/src/minecraft/optifine/IntArray.java @@ -0,0 +1,81 @@ +package optifine; + +public class IntArray +{ + private int[] array = null; + private int position = 0; + private int limit = 0; + + public IntArray(int p_i62_1_) + { + this.array = new int[p_i62_1_]; + } + + public void put(int p_put_1_) + { + this.array[this.position] = p_put_1_; + ++this.position; + + if (this.limit < this.position) + { + this.limit = this.position; + } + } + + public void put(int p_put_1_, int p_put_2_) + { + this.array[p_put_1_] = p_put_2_; + + if (this.limit < p_put_1_) + { + this.limit = p_put_1_; + } + } + + public void position(int p_position_1_) + { + this.position = p_position_1_; + } + + public void put(int[] p_put_1_) + { + int i = p_put_1_.length; + + for (int j = 0; j < i; ++j) + { + this.array[this.position] = p_put_1_[j]; + ++this.position; + } + + if (this.limit < this.position) + { + this.limit = this.position; + } + } + + public int get(int p_get_1_) + { + return this.array[p_get_1_]; + } + + public int[] getArray() + { + return this.array; + } + + public void clear() + { + this.position = 0; + this.limit = 0; + } + + public int getLimit() + { + return this.limit; + } + + public int getPosition() + { + return this.position; + } +} diff --git a/src/minecraft/optifine/IntegerCache.java b/src/minecraft/optifine/IntegerCache.java new file mode 100644 index 0000000..de1edcf --- /dev/null +++ b/src/minecraft/optifine/IntegerCache.java @@ -0,0 +1,24 @@ +package optifine; + +public class IntegerCache +{ + private static final int CACHE_SIZE = 4096; + private static final Integer[] cache = makeCache(4096); + + private static Integer[] makeCache(int p_makeCache_0_) + { + Integer[] ainteger = new Integer[p_makeCache_0_]; + + for (int i = 0; i < p_makeCache_0_; ++i) + { + ainteger[i] = new Integer(i); + } + + return ainteger; + } + + public static Integer valueOf(int p_valueOf_0_) + { + return p_valueOf_0_ >= 0 && p_valueOf_0_ < 4096 ? cache[p_valueOf_0_] : new Integer(p_valueOf_0_); + } +} diff --git a/src/minecraft/optifine/Json.java b/src/minecraft/optifine/Json.java new file mode 100644 index 0000000..d31d908 --- /dev/null +++ b/src/minecraft/optifine/Json.java @@ -0,0 +1,98 @@ +package optifine; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; + +public class Json +{ + public static float getFloat(JsonObject p_getFloat_0_, String p_getFloat_1_, float p_getFloat_2_) + { + JsonElement jsonelement = p_getFloat_0_.get(p_getFloat_1_); + return jsonelement == null ? p_getFloat_2_ : jsonelement.getAsFloat(); + } + + public static boolean getBoolean(JsonObject p_getBoolean_0_, String p_getBoolean_1_, boolean p_getBoolean_2_) + { + JsonElement jsonelement = p_getBoolean_0_.get(p_getBoolean_1_); + return jsonelement == null ? p_getBoolean_2_ : jsonelement.getAsBoolean(); + } + + public static String getString(JsonObject p_getString_0_, String p_getString_1_) + { + return getString(p_getString_0_, p_getString_1_, (String)null); + } + + public static String getString(JsonObject p_getString_0_, String p_getString_1_, String p_getString_2_) + { + JsonElement jsonelement = p_getString_0_.get(p_getString_1_); + return jsonelement == null ? p_getString_2_ : jsonelement.getAsString(); + } + + public static float[] parseFloatArray(JsonElement p_parseFloatArray_0_, int p_parseFloatArray_1_) + { + return parseFloatArray(p_parseFloatArray_0_, p_parseFloatArray_1_, (float[])null); + } + + public static float[] parseFloatArray(JsonElement p_parseFloatArray_0_, int p_parseFloatArray_1_, float[] p_parseFloatArray_2_) + { + if (p_parseFloatArray_0_ == null) + { + return p_parseFloatArray_2_; + } + else + { + JsonArray jsonarray = p_parseFloatArray_0_.getAsJsonArray(); + + if (jsonarray.size() != p_parseFloatArray_1_) + { + throw new JsonParseException("Wrong array length: " + jsonarray.size() + ", should be: " + p_parseFloatArray_1_ + ", array: " + jsonarray); + } + else + { + float[] afloat = new float[jsonarray.size()]; + + for (int i = 0; i < afloat.length; ++i) + { + afloat[i] = jsonarray.get(i).getAsFloat(); + } + + return afloat; + } + } + } + + public static int[] parseIntArray(JsonElement p_parseIntArray_0_, int p_parseIntArray_1_) + { + return parseIntArray(p_parseIntArray_0_, p_parseIntArray_1_, (int[])null); + } + + public static int[] parseIntArray(JsonElement p_parseIntArray_0_, int p_parseIntArray_1_, int[] p_parseIntArray_2_) + { + if (p_parseIntArray_0_ == null) + { + return p_parseIntArray_2_; + } + else + { + JsonArray jsonarray = p_parseIntArray_0_.getAsJsonArray(); + + if (jsonarray.size() != p_parseIntArray_1_) + { + throw new JsonParseException("Wrong array length: " + jsonarray.size() + ", should be: " + p_parseIntArray_1_ + ", array: " + jsonarray); + } + else + { + int[] aint = new int[jsonarray.size()]; + + for (int i = 0; i < aint.length; ++i) + { + aint[i] = jsonarray.get(i).getAsInt(); + } + + return aint; + } + } + } +} diff --git a/src/minecraft/optifine/Lagometer.java b/src/minecraft/optifine/Lagometer.java new file mode 100644 index 0000000..6632baa --- /dev/null +++ b/src/minecraft/optifine/Lagometer.java @@ -0,0 +1,285 @@ +package optifine; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiIngame; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.profiler.Profiler; +import org.lwjgl.opengl.GL11; + +public class Lagometer +{ + private static Minecraft mc; + private static GameSettings gameSettings; + private static Profiler profiler; + public static boolean active = false; + public static Lagometer.TimerNano timerTick = new Lagometer.TimerNano(); + public static Lagometer.TimerNano timerScheduledExecutables = new Lagometer.TimerNano(); + public static Lagometer.TimerNano timerChunkUpload = new Lagometer.TimerNano(); + public static Lagometer.TimerNano timerChunkUpdate = new Lagometer.TimerNano(); + public static Lagometer.TimerNano timerVisibility = new Lagometer.TimerNano(); + public static Lagometer.TimerNano timerTerrain = new Lagometer.TimerNano(); + public static Lagometer.TimerNano timerServer = new Lagometer.TimerNano(); + private static long[] timesFrame = new long[512]; + private static long[] timesTick = new long[512]; + private static long[] timesScheduledExecutables = new long[512]; + private static long[] timesChunkUpload = new long[512]; + private static long[] timesChunkUpdate = new long[512]; + private static long[] timesVisibility = new long[512]; + private static long[] timesTerrain = new long[512]; + private static long[] timesServer = new long[512]; + private static boolean[] gcs = new boolean[512]; + private static int numRecordedFrameTimes = 0; + private static long prevFrameTimeNano = -1L; + private static long renderTimeNano = 0L; + private static long memTimeStartMs = System.currentTimeMillis(); + private static long memStart = getMemoryUsed(); + private static long memTimeLast = memTimeStartMs; + private static long memLast = memStart; + private static long memTimeDiffMs = 1L; + private static long memDiff = 0L; + private static int memMbSec = 0; + + public static boolean updateMemoryAllocation() + { + long i = System.currentTimeMillis(); + long j = getMemoryUsed(); + boolean flag = false; + + if (j < memLast) + { + double d0 = (double)memDiff / 1000000.0D; + double d1 = (double)memTimeDiffMs / 1000.0D; + int k = (int)(d0 / d1); + + if (k > 0) + { + memMbSec = k; + } + + memTimeStartMs = i; + memStart = j; + memTimeDiffMs = 0L; + memDiff = 0L; + flag = true; + } + else + { + memTimeDiffMs = i - memTimeStartMs; + memDiff = j - memStart; + } + + memTimeLast = i; + memLast = j; + return flag; + } + + private static long getMemoryUsed() + { + Runtime runtime = Runtime.getRuntime(); + return runtime.totalMemory() - runtime.freeMemory(); + } + + public static void updateLagometer() + { + if (mc == null) + { + mc = Minecraft.getMinecraft(); + gameSettings = mc.gameSettings; + profiler = mc.mcProfiler; + } + + if (gameSettings.showDebugInfo && (gameSettings.ofLagometer || gameSettings.field_181657_aC)) + { + active = true; + long timeNowNano = System.nanoTime(); + + if (prevFrameTimeNano == -1L) + { + prevFrameTimeNano = timeNowNano; + } + else + { + int j = numRecordedFrameTimes & timesFrame.length - 1; + ++numRecordedFrameTimes; + boolean flag = updateMemoryAllocation(); + timesFrame[j] = timeNowNano - prevFrameTimeNano - renderTimeNano; + timesTick[j] = timerTick.timeNano; + timesScheduledExecutables[j] = timerScheduledExecutables.timeNano; + timesChunkUpload[j] = timerChunkUpload.timeNano; + timesChunkUpdate[j] = timerChunkUpdate.timeNano; + timesVisibility[j] = timerVisibility.timeNano; + timesTerrain[j] = timerTerrain.timeNano; + timesServer[j] = timerServer.timeNano; + gcs[j] = flag; + timerTick.reset(); + timerScheduledExecutables.reset(); + timerVisibility.reset(); + timerChunkUpdate.reset(); + timerChunkUpload.reset(); + timerTerrain.reset(); + timerServer.reset(); + prevFrameTimeNano = System.nanoTime(); + } + } + else + { + active = false; + prevFrameTimeNano = -1L; + } + } + + public static void showLagometer(ScaledResolution p_showLagometer_0_) + { + if (gameSettings != null) + { + if (gameSettings.ofLagometer || gameSettings.field_181657_aC) + { + long i = System.nanoTime(); + GlStateManager.clear(256); + GlStateManager.matrixMode(5889); + GlStateManager.pushMatrix(); + GlStateManager.enableColorMaterial(); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, (double)mc.displayWidth, (double)mc.displayHeight, 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + GL11.glLineWidth(1.0F); + GlStateManager.disableTexture2D(); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(1, DefaultVertexFormats.POSITION_COLOR); + + for (int j = 0; j < timesFrame.length; ++j) + { + int k = (j - numRecordedFrameTimes & timesFrame.length - 1) * 100 / timesFrame.length; + k = k + 155; + float f = (float)mc.displayHeight; + long l = 0L; + + if (gcs[j]) + { + renderTime(j, timesFrame[j], k, k / 2, 0, f, worldrenderer); + } + else + { + renderTime(j, timesFrame[j], k, k, k, f, worldrenderer); + f = f - (float)renderTime(j, timesServer[j], k / 2, k / 2, k / 2, f, worldrenderer); + f = f - (float)renderTime(j, timesTerrain[j], 0, k, 0, f, worldrenderer); + f = f - (float)renderTime(j, timesVisibility[j], k, k, 0, f, worldrenderer); + f = f - (float)renderTime(j, timesChunkUpdate[j], k, 0, 0, f, worldrenderer); + f = f - (float)renderTime(j, timesChunkUpload[j], k, 0, k, f, worldrenderer); + f = f - (float)renderTime(j, timesScheduledExecutables[j], 0, 0, k, f, worldrenderer); + float f2 = f - (float)renderTime(j, timesTick[j], 0, k, k, f, worldrenderer); + } + } + + renderTimeDivider(0, timesFrame.length, 33333333L, 196, 196, 196, (float)mc.displayHeight, worldrenderer); + renderTimeDivider(0, timesFrame.length, 16666666L, 196, 196, 196, (float)mc.displayHeight, worldrenderer); + tessellator.draw(); + GlStateManager.enableTexture2D(); + int j2 = mc.displayHeight - 80; + int k2 = mc.displayHeight - 160; + mc.fontRendererObj.drawString("30", 2, k2 + 1, -8947849); + mc.fontRendererObj.drawString("30", 1, k2, -3881788); + mc.fontRendererObj.drawString("60", 2, j2 + 1, -8947849); + mc.fontRendererObj.drawString("60", 1, j2, -3881788); + GlStateManager.matrixMode(5889); + GlStateManager.popMatrix(); + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + GlStateManager.enableTexture2D(); + float f1 = 1.0F - (float)((double)(System.currentTimeMillis() - memTimeStartMs) / 1000.0D); + f1 = Config.limit(f1, 0.0F, 1.0F); + int l2 = (int)(170.0F + f1 * 85.0F); + int i1 = (int)(100.0F + f1 * 55.0F); + int j1 = (int)(10.0F + f1 * 10.0F); + int k1 = l2 << 16 | i1 << 8 | j1; + int l1 = 512 / p_showLagometer_0_.getScaleFactor() + 2; + int i2 = mc.displayHeight / p_showLagometer_0_.getScaleFactor() - 8; + GuiIngame guiingame = mc.ingameGUI; + GuiIngame.drawRect(l1 - 1, i2 - 1, l1 + 50, i2 + 10, -1605349296); + mc.fontRendererObj.drawString(" " + memMbSec + " MB/s", l1, i2, k1); + renderTimeNano = System.nanoTime() - i; + } + } + } + + private static long renderTime(int p_renderTime_0_, long p_renderTime_1_, int p_renderTime_3_, int p_renderTime_4_, int p_renderTime_5_, float p_renderTime_6_, WorldRenderer p_renderTime_7_) + { + long i = p_renderTime_1_ / 200000L; + + if (i < 3L) + { + return 0L; + } + else + { + p_renderTime_7_.pos((double)((float)p_renderTime_0_ + 0.5F), (double)(p_renderTime_6_ - (float)i + 0.5F), 0.0D).color(p_renderTime_3_, p_renderTime_4_, p_renderTime_5_, 255).endVertex(); + p_renderTime_7_.pos((double)((float)p_renderTime_0_ + 0.5F), (double)(p_renderTime_6_ + 0.5F), 0.0D).color(p_renderTime_3_, p_renderTime_4_, p_renderTime_5_, 255).endVertex(); + return i; + } + } + + private static long renderTimeDivider(int p_renderTimeDivider_0_, int p_renderTimeDivider_1_, long p_renderTimeDivider_2_, int p_renderTimeDivider_4_, int p_renderTimeDivider_5_, int p_renderTimeDivider_6_, float p_renderTimeDivider_7_, WorldRenderer p_renderTimeDivider_8_) + { + long i = p_renderTimeDivider_2_ / 200000L; + + if (i < 3L) + { + return 0L; + } + else + { + p_renderTimeDivider_8_.pos((double)((float)p_renderTimeDivider_0_ + 0.5F), (double)(p_renderTimeDivider_7_ - (float)i + 0.5F), 0.0D).color(p_renderTimeDivider_4_, p_renderTimeDivider_5_, p_renderTimeDivider_6_, 255).endVertex(); + p_renderTimeDivider_8_.pos((double)((float)p_renderTimeDivider_1_ + 0.5F), (double)(p_renderTimeDivider_7_ - (float)i + 0.5F), 0.0D).color(p_renderTimeDivider_4_, p_renderTimeDivider_5_, p_renderTimeDivider_6_, 255).endVertex(); + return i; + } + } + + public static boolean isActive() + { + return active; + } + + public static class TimerNano + { + public long timeStartNano = 0L; + public long timeNano = 0L; + + public void start() + { + if (Lagometer.active) + { + if (this.timeStartNano == 0L) + { + this.timeStartNano = System.nanoTime(); + } + } + } + + public void end() + { + if (Lagometer.active) + { + if (this.timeStartNano != 0L) + { + this.timeNano += System.nanoTime() - this.timeStartNano; + this.timeStartNano = 0L; + } + } + } + + private void reset() + { + this.timeNano = 0L; + this.timeStartNano = 0L; + } + } +} diff --git a/src/minecraft/optifine/Lang.java b/src/minecraft/optifine/Lang.java new file mode 100644 index 0000000..a0b759f --- /dev/null +++ b/src/minecraft/optifine/Lang.java @@ -0,0 +1,126 @@ +package optifine; + +import com.google.common.base.Splitter; +import com.google.common.collect.Iterables; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.util.ResourceLocation; +import org.apache.commons.io.Charsets; +import org.apache.commons.io.IOUtils; + +public class Lang +{ + private static final Splitter splitter = Splitter.on('=').limit(2); + private static final Pattern pattern = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]"); + + public static void resourcesReloaded() + { + Map map = I18n.getLocaleProperties(); + List list = new ArrayList(); + String s = "optifine/lang/"; + String s1 = "en_US"; + String s2 = ".lang"; + list.add(s + s1 + s2); + + if (!Config.getGameSettings().language.equals(s1)) + { + list.add(s + Config.getGameSettings().language + s2); + } + + String[] astring = (String[])((String[])list.toArray(new String[list.size()])); + loadResources(Config.getDefaultResourcePack(), astring, map); + IResourcePack[] airesourcepack = Config.getResourcePacks(); + + for (int i = 0; i < airesourcepack.length; ++i) + { + IResourcePack iresourcepack = airesourcepack[i]; + loadResources(iresourcepack, astring, map); + } + } + + private static void loadResources(IResourcePack p_loadResources_0_, String[] p_loadResources_1_, Map p_loadResources_2_) + { + try + { + for (int i = 0; i < p_loadResources_1_.length; ++i) + { + String s = p_loadResources_1_[i]; + ResourceLocation resourcelocation = new ResourceLocation(s); + + if (p_loadResources_0_.resourceExists(resourcelocation)) + { + InputStream inputstream = p_loadResources_0_.getInputStream(resourcelocation); + + if (inputstream != null) + { + loadLocaleData(inputstream, p_loadResources_2_); + } + } + } + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + + public static void loadLocaleData(InputStream p_loadLocaleData_0_, Map p_loadLocaleData_1_) throws IOException + { + for (String s : IOUtils.readLines(p_loadLocaleData_0_, Charsets.UTF_8)) + { + if (!s.isEmpty() && s.charAt(0) != 35) + { + String[] astring = (String[])((String[])Iterables.toArray(splitter.split(s), String.class)); + + if (astring != null && astring.length == 2) + { + String s1 = astring[0]; + String s2 = pattern.matcher(astring[1]).replaceAll("%$1s"); + p_loadLocaleData_1_.put(s1, s2); + } + } + } + } + + public static String get(String p_get_0_) + { + return I18n.format(p_get_0_, new Object[0]); + } + + public static String get(String p_get_0_, String p_get_1_) + { + String s = I18n.format(p_get_0_, new Object[0]); + return s != null && !s.equals(p_get_0_) ? s : p_get_1_; + } + + public static String getOn() + { + return I18n.format("options.on", new Object[0]); + } + + public static String getOff() + { + return I18n.format("options.off", new Object[0]); + } + + public static String getFast() + { + return I18n.format("options.graphics.fast", new Object[0]); + } + + public static String getFancy() + { + return I18n.format("options.graphics.fancy", new Object[0]); + } + + public static String getDefault() + { + return I18n.format("generator.default", new Object[0]); + } +} diff --git a/src/minecraft/optifine/ListQuadsOverlay.java b/src/minecraft/optifine/ListQuadsOverlay.java new file mode 100644 index 0000000..99a52e5 --- /dev/null +++ b/src/minecraft/optifine/ListQuadsOverlay.java @@ -0,0 +1,48 @@ +package optifine; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.init.Blocks; + +public class ListQuadsOverlay +{ + private List listQuads = new ArrayList(); + private List listBlockStates = new ArrayList(); + private List listQuadsSingle = Arrays.asList(new BakedQuad[1]); + + public void addQuad(BakedQuad p_addQuad_1_, IBlockState p_addQuad_2_) + { + this.listQuads.add(p_addQuad_1_); + this.listBlockStates.add(p_addQuad_2_); + } + + public int size() + { + return this.listQuads.size(); + } + + public BakedQuad getQuad(int p_getQuad_1_) + { + return (BakedQuad)this.listQuads.get(p_getQuad_1_); + } + + public IBlockState getBlockState(int p_getBlockState_1_) + { + return p_getBlockState_1_ >= 0 && p_getBlockState_1_ < this.listBlockStates.size() ? (IBlockState)this.listBlockStates.get(p_getBlockState_1_) : Blocks.air.getDefaultState(); + } + + public List getListQuadsSingle(BakedQuad p_getListQuadsSingle_1_) + { + this.listQuadsSingle.set(0, p_getListQuadsSingle_1_); + return this.listQuadsSingle; + } + + public void clear() + { + this.listQuads.clear(); + this.listBlockStates.clear(); + } +} diff --git a/src/minecraft/optifine/MatchBlock.java b/src/minecraft/optifine/MatchBlock.java new file mode 100644 index 0000000..63dfaa9 --- /dev/null +++ b/src/minecraft/optifine/MatchBlock.java @@ -0,0 +1,74 @@ +package optifine; + +import net.minecraft.block.state.BlockStateBase; + +public class MatchBlock +{ + private int blockId = -1; + private int[] metadatas = null; + + public MatchBlock(int p_i63_1_) + { + this.blockId = p_i63_1_; + } + + public MatchBlock(int p_i64_1_, int p_i64_2_) + { + this.blockId = p_i64_1_; + + if (p_i64_2_ >= 0 && p_i64_2_ <= 15) + { + this.metadatas = new int[] {p_i64_2_}; + } + } + + public MatchBlock(int p_i65_1_, int[] p_i65_2_) + { + this.blockId = p_i65_1_; + this.metadatas = p_i65_2_; + } + + public int getBlockId() + { + return this.blockId; + } + + public int[] getMetadatas() + { + return this.metadatas; + } + + public boolean matches(BlockStateBase p_matches_1_) + { + return p_matches_1_.getBlockId() != this.blockId ? false : Matches.metadata(p_matches_1_.getMetadata(), this.metadatas); + } + + public boolean matches(int p_matches_1_, int p_matches_2_) + { + return p_matches_1_ != this.blockId ? false : Matches.metadata(p_matches_2_, this.metadatas); + } + + public void addMetadata(int p_addMetadata_1_) + { + if (this.metadatas != null) + { + if (p_addMetadata_1_ >= 0 && p_addMetadata_1_ <= 15) + { + for (int i = 0; i < this.metadatas.length; ++i) + { + if (this.metadatas[i] == p_addMetadata_1_) + { + return; + } + } + + this.metadatas = Config.addIntToArray(this.metadatas, p_addMetadata_1_); + } + } + } + + public String toString() + { + return "" + this.blockId + ":" + Config.arrayToString(this.metadatas); + } +} diff --git a/src/minecraft/optifine/Matches.java b/src/minecraft/optifine/Matches.java new file mode 100644 index 0000000..20795e7 --- /dev/null +++ b/src/minecraft/optifine/Matches.java @@ -0,0 +1,134 @@ +package optifine; + +import net.minecraft.block.state.BlockStateBase; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.world.biome.BiomeGenBase; + +public class Matches +{ + public static boolean block(BlockStateBase p_block_0_, MatchBlock[] p_block_1_) + { + if (p_block_1_ == null) + { + return true; + } + else + { + for (int i = 0; i < p_block_1_.length; ++i) + { + MatchBlock matchblock = p_block_1_[i]; + + if (matchblock.matches(p_block_0_)) + { + return true; + } + } + + return false; + } + } + + public static boolean block(int p_block_0_, int p_block_1_, MatchBlock[] p_block_2_) + { + if (p_block_2_ == null) + { + return true; + } + else + { + for (int i = 0; i < p_block_2_.length; ++i) + { + MatchBlock matchblock = p_block_2_[i]; + + if (matchblock.matches(p_block_0_, p_block_1_)) + { + return true; + } + } + + return false; + } + } + + public static boolean blockId(int p_blockId_0_, MatchBlock[] p_blockId_1_) + { + if (p_blockId_1_ == null) + { + return true; + } + else + { + for (int i = 0; i < p_blockId_1_.length; ++i) + { + MatchBlock matchblock = p_blockId_1_[i]; + + if (matchblock.getBlockId() == p_blockId_0_) + { + return true; + } + } + + return false; + } + } + + public static boolean metadata(int p_metadata_0_, int[] p_metadata_1_) + { + if (p_metadata_1_ == null) + { + return true; + } + else + { + for (int i = 0; i < p_metadata_1_.length; ++i) + { + if (p_metadata_1_[i] == p_metadata_0_) + { + return true; + } + } + + return false; + } + } + + public static boolean sprite(TextureAtlasSprite p_sprite_0_, TextureAtlasSprite[] p_sprite_1_) + { + if (p_sprite_1_ == null) + { + return true; + } + else + { + for (int i = 0; i < p_sprite_1_.length; ++i) + { + if (p_sprite_1_[i] == p_sprite_0_) + { + return true; + } + } + + return false; + } + } + + public static boolean biome(BiomeGenBase p_biome_0_, BiomeGenBase[] p_biome_1_) + { + if (p_biome_1_ == null) + { + return true; + } + else + { + for (int i = 0; i < p_biome_1_.length; ++i) + { + if (p_biome_1_[i] == p_biome_0_) + { + return true; + } + } + + return false; + } + } +} diff --git a/src/minecraft/optifine/MathUtils.java b/src/minecraft/optifine/MathUtils.java new file mode 100644 index 0000000..92db97e --- /dev/null +++ b/src/minecraft/optifine/MathUtils.java @@ -0,0 +1,25 @@ +package optifine; + +public class MathUtils +{ + public static int getAverage(int[] p_getAverage_0_) + { + if (p_getAverage_0_.length <= 0) + { + return 0; + } + else + { + int i = 0; + + for (int j = 0; j < p_getAverage_0_.length; ++j) + { + int k = p_getAverage_0_[j]; + i += k; + } + + int l = i / p_getAverage_0_.length; + return l; + } + } +} diff --git a/src/minecraft/optifine/Mipmaps.java b/src/minecraft/optifine/Mipmaps.java new file mode 100644 index 0000000..fda3e1c --- /dev/null +++ b/src/minecraft/optifine/Mipmaps.java @@ -0,0 +1,218 @@ +package optifine; + +import java.awt.Dimension; +import java.nio.IntBuffer; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.renderer.GLAllocation; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class Mipmaps +{ + private final String iconName; + private final int width; + private final int height; + private final int[] data; + private final boolean direct; + private int[][] mipmapDatas; + private IntBuffer[] mipmapBuffers; + private Dimension[] mipmapDimensions; + + public Mipmaps(String p_i66_1_, int p_i66_2_, int p_i66_3_, int[] p_i66_4_, boolean p_i66_5_) + { + this.iconName = p_i66_1_; + this.width = p_i66_2_; + this.height = p_i66_3_; + this.data = p_i66_4_; + this.direct = p_i66_5_; + this.mipmapDimensions = makeMipmapDimensions(p_i66_2_, p_i66_3_, p_i66_1_); + this.mipmapDatas = generateMipMapData(p_i66_4_, p_i66_2_, p_i66_3_, this.mipmapDimensions); + + if (p_i66_5_) + { + this.mipmapBuffers = makeMipmapBuffers(this.mipmapDimensions, this.mipmapDatas); + } + } + + public static Dimension[] makeMipmapDimensions(int p_makeMipmapDimensions_0_, int p_makeMipmapDimensions_1_, String p_makeMipmapDimensions_2_) + { + int i = TextureUtils.ceilPowerOfTwo(p_makeMipmapDimensions_0_); + int j = TextureUtils.ceilPowerOfTwo(p_makeMipmapDimensions_1_); + + if (i == p_makeMipmapDimensions_0_ && j == p_makeMipmapDimensions_1_) + { + List list = new ArrayList(); + int k = i; + int l = j; + + while (true) + { + k /= 2; + l /= 2; + + if (k <= 0 && l <= 0) + { + Dimension[] adimension = (Dimension[])((Dimension[])list.toArray(new Dimension[list.size()])); + return adimension; + } + + if (k <= 0) + { + k = 1; + } + + if (l <= 0) + { + l = 1; + } + + int i1 = k * l * 4; + Dimension dimension = new Dimension(k, l); + list.add(dimension); + } + } + else + { + Config.warn("Mipmaps not possible (power of 2 dimensions needed), texture: " + p_makeMipmapDimensions_2_ + ", dim: " + p_makeMipmapDimensions_0_ + "x" + p_makeMipmapDimensions_1_); + return new Dimension[0]; + } + } + + public static int[][] generateMipMapData(int[] p_generateMipMapData_0_, int p_generateMipMapData_1_, int p_generateMipMapData_2_, Dimension[] p_generateMipMapData_3_) + { + int[] aint = p_generateMipMapData_0_; + int i = p_generateMipMapData_1_; + boolean flag = true; + int[][] aint1 = new int[p_generateMipMapData_3_.length][]; + + for (int j = 0; j < p_generateMipMapData_3_.length; ++j) + { + Dimension dimension = p_generateMipMapData_3_[j]; + int k = dimension.width; + int l = dimension.height; + int[] aint2 = new int[k * l]; + aint1[j] = aint2; + int i1 = j + 1; + + if (flag) + { + for (int j1 = 0; j1 < k; ++j1) + { + for (int k1 = 0; k1 < l; ++k1) + { + int l1 = aint[j1 * 2 + 0 + (k1 * 2 + 0) * i]; + int i2 = aint[j1 * 2 + 1 + (k1 * 2 + 0) * i]; + int j2 = aint[j1 * 2 + 1 + (k1 * 2 + 1) * i]; + int k2 = aint[j1 * 2 + 0 + (k1 * 2 + 1) * i]; + int l2 = alphaBlend(l1, i2, j2, k2); + aint2[j1 + k1 * k] = l2; + } + } + } + + aint = aint2; + i = k; + + if (k <= 1 || l <= 1) + { + flag = false; + } + } + + return aint1; + } + + public static int alphaBlend(int p_alphaBlend_0_, int p_alphaBlend_1_, int p_alphaBlend_2_, int p_alphaBlend_3_) + { + int i = alphaBlend(p_alphaBlend_0_, p_alphaBlend_1_); + int j = alphaBlend(p_alphaBlend_2_, p_alphaBlend_3_); + int k = alphaBlend(i, j); + return k; + } + + private static int alphaBlend(int p_alphaBlend_0_, int p_alphaBlend_1_) + { + int i = (p_alphaBlend_0_ & -16777216) >> 24 & 255; + int j = (p_alphaBlend_1_ & -16777216) >> 24 & 255; + int k = (i + j) / 2; + + if (i == 0 && j == 0) + { + i = 1; + j = 1; + } + else + { + if (i == 0) + { + p_alphaBlend_0_ = p_alphaBlend_1_; + k /= 2; + } + + if (j == 0) + { + p_alphaBlend_1_ = p_alphaBlend_0_; + k /= 2; + } + } + + int l = (p_alphaBlend_0_ >> 16 & 255) * i; + int i1 = (p_alphaBlend_0_ >> 8 & 255) * i; + int j1 = (p_alphaBlend_0_ & 255) * i; + int k1 = (p_alphaBlend_1_ >> 16 & 255) * j; + int l1 = (p_alphaBlend_1_ >> 8 & 255) * j; + int i2 = (p_alphaBlend_1_ & 255) * j; + int j2 = (l + k1) / (i + j); + int k2 = (i1 + l1) / (i + j); + int l2 = (j1 + i2) / (i + j); + return k << 24 | j2 << 16 | k2 << 8 | l2; + } + + private int averageColor(int p_averageColor_1_, int p_averageColor_2_) + { + int i = (p_averageColor_1_ & -16777216) >> 24 & 255; + int j = (p_averageColor_2_ & -16777216) >> 24 & 255; + return (i + j >> 1 << 24) + ((p_averageColor_1_ & 16711422) + (p_averageColor_2_ & 16711422) >> 1); + } + + public static IntBuffer[] makeMipmapBuffers(Dimension[] p_makeMipmapBuffers_0_, int[][] p_makeMipmapBuffers_1_) + { + if (p_makeMipmapBuffers_0_ == null) + { + return null; + } + else + { + IntBuffer[] aintbuffer = new IntBuffer[p_makeMipmapBuffers_0_.length]; + + for (int i = 0; i < p_makeMipmapBuffers_0_.length; ++i) + { + Dimension dimension = p_makeMipmapBuffers_0_[i]; + int j = dimension.width * dimension.height; + IntBuffer intbuffer = GLAllocation.createDirectIntBuffer(j); + int[] aint = p_makeMipmapBuffers_1_[i]; + intbuffer.clear(); + intbuffer.put(aint); + intbuffer.clear(); + aintbuffer[i] = intbuffer; + } + + return aintbuffer; + } + } + + public static void allocateMipmapTextures(int p_allocateMipmapTextures_0_, int p_allocateMipmapTextures_1_, String p_allocateMipmapTextures_2_) + { + Dimension[] adimension = makeMipmapDimensions(p_allocateMipmapTextures_0_, p_allocateMipmapTextures_1_, p_allocateMipmapTextures_2_); + + for (int i = 0; i < adimension.length; ++i) + { + Dimension dimension = adimension[i]; + int j = dimension.width; + int k = dimension.height; + int l = i + 1; + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, l, GL11.GL_RGBA, j, k, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)((IntBuffer)null)); + } + } +} diff --git a/src/minecraft/optifine/ModelPlayerItem.java b/src/minecraft/optifine/ModelPlayerItem.java new file mode 100644 index 0000000..9147735 --- /dev/null +++ b/src/minecraft/optifine/ModelPlayerItem.java @@ -0,0 +1,11 @@ +package optifine; + +import net.minecraft.client.model.ModelBase; + +public class ModelPlayerItem extends ModelBase +{ + public ModelPlayerItem() + { + this.isChild = false; + } +} diff --git a/src/minecraft/optifine/ModelSprite.java b/src/minecraft/optifine/ModelSprite.java new file mode 100644 index 0000000..93ebec1 --- /dev/null +++ b/src/minecraft/optifine/ModelSprite.java @@ -0,0 +1,157 @@ +package optifine; + +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.MathHelper; +import org.lwjgl.opengl.GL11; + +public class ModelSprite +{ + private ModelRenderer modelRenderer = null; + private int textureOffsetX = 0; + private int textureOffsetY = 0; + private float posX = 0.0F; + private float posY = 0.0F; + private float posZ = 0.0F; + private int sizeX = 0; + private int sizeY = 0; + private int sizeZ = 0; + private float sizeAdd = 0.0F; + private float minU = 0.0F; + private float minV = 0.0F; + private float maxU = 0.0F; + private float maxV = 0.0F; + + public ModelSprite(ModelRenderer p_i67_1_, int p_i67_2_, int p_i67_3_, float p_i67_4_, float p_i67_5_, float p_i67_6_, int p_i67_7_, int p_i67_8_, int p_i67_9_, float p_i67_10_) + { + this.modelRenderer = p_i67_1_; + this.textureOffsetX = p_i67_2_; + this.textureOffsetY = p_i67_3_; + this.posX = p_i67_4_; + this.posY = p_i67_5_; + this.posZ = p_i67_6_; + this.sizeX = p_i67_7_; + this.sizeY = p_i67_8_; + this.sizeZ = p_i67_9_; + this.sizeAdd = p_i67_10_; + this.minU = (float)p_i67_2_ / p_i67_1_.textureWidth; + this.minV = (float)p_i67_3_ / p_i67_1_.textureHeight; + this.maxU = (float)(p_i67_2_ + p_i67_7_) / p_i67_1_.textureWidth; + this.maxV = (float)(p_i67_3_ + p_i67_8_) / p_i67_1_.textureHeight; + } + + public void render(Tessellator p_render_1_, float p_render_2_) + { + GlStateManager.translate(this.posX * p_render_2_, this.posY * p_render_2_, this.posZ * p_render_2_); + float f = this.minU; + float f1 = this.maxU; + float f2 = this.minV; + float f3 = this.maxV; + + if (this.modelRenderer.mirror) + { + f = this.maxU; + f1 = this.minU; + } + + if (this.modelRenderer.mirrorV) + { + f2 = this.maxV; + f3 = this.minV; + } + + renderItemIn2D(p_render_1_, f, f2, f1, f3, this.sizeX, this.sizeY, p_render_2_ * (float)this.sizeZ, this.modelRenderer.textureWidth, this.modelRenderer.textureHeight); + GlStateManager.translate(-this.posX * p_render_2_, -this.posY * p_render_2_, -this.posZ * p_render_2_); + } + + public static void renderItemIn2D(Tessellator p_renderItemIn2D_0_, float p_renderItemIn2D_1_, float p_renderItemIn2D_2_, float p_renderItemIn2D_3_, float p_renderItemIn2D_4_, int p_renderItemIn2D_5_, int p_renderItemIn2D_6_, float p_renderItemIn2D_7_, float p_renderItemIn2D_8_, float p_renderItemIn2D_9_) + { + if (p_renderItemIn2D_7_ < 6.25E-4F) + { + p_renderItemIn2D_7_ = 6.25E-4F; + } + + float f = p_renderItemIn2D_3_ - p_renderItemIn2D_1_; + float f1 = p_renderItemIn2D_4_ - p_renderItemIn2D_2_; + double d0 = (double)(MathHelper.abs(f) * (p_renderItemIn2D_8_ / 16.0F)); + double d1 = (double)(MathHelper.abs(f1) * (p_renderItemIn2D_9_ / 16.0F)); + WorldRenderer worldrenderer = p_renderItemIn2D_0_.getWorldRenderer(); + GL11.glNormal3f(0.0F, 0.0F, -1.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(0.0D, d1, 0.0D).tex((double)p_renderItemIn2D_1_, (double)p_renderItemIn2D_4_).endVertex(); + worldrenderer.pos(d0, d1, 0.0D).tex((double)p_renderItemIn2D_3_, (double)p_renderItemIn2D_4_).endVertex(); + worldrenderer.pos(d0, 0.0D, 0.0D).tex((double)p_renderItemIn2D_3_, (double)p_renderItemIn2D_2_).endVertex(); + worldrenderer.pos(0.0D, 0.0D, 0.0D).tex((double)p_renderItemIn2D_1_, (double)p_renderItemIn2D_2_).endVertex(); + p_renderItemIn2D_0_.draw(); + GL11.glNormal3f(0.0F, 0.0F, 1.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(0.0D, 0.0D, (double)p_renderItemIn2D_7_).tex((double)p_renderItemIn2D_1_, (double)p_renderItemIn2D_2_).endVertex(); + worldrenderer.pos(d0, 0.0D, (double)p_renderItemIn2D_7_).tex((double)p_renderItemIn2D_3_, (double)p_renderItemIn2D_2_).endVertex(); + worldrenderer.pos(d0, d1, (double)p_renderItemIn2D_7_).tex((double)p_renderItemIn2D_3_, (double)p_renderItemIn2D_4_).endVertex(); + worldrenderer.pos(0.0D, d1, (double)p_renderItemIn2D_7_).tex((double)p_renderItemIn2D_1_, (double)p_renderItemIn2D_4_).endVertex(); + p_renderItemIn2D_0_.draw(); + float f2 = 0.5F * f / (float)p_renderItemIn2D_5_; + float f3 = 0.5F * f1 / (float)p_renderItemIn2D_6_; + GL11.glNormal3f(-1.0F, 0.0F, 0.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + + for (int i = 0; i < p_renderItemIn2D_5_; ++i) + { + float f4 = (float)i / (float)p_renderItemIn2D_5_; + float f5 = p_renderItemIn2D_1_ + f * f4 + f2; + worldrenderer.pos((double)f4 * d0, d1, (double)p_renderItemIn2D_7_).tex((double)f5, (double)p_renderItemIn2D_4_).endVertex(); + worldrenderer.pos((double)f4 * d0, d1, 0.0D).tex((double)f5, (double)p_renderItemIn2D_4_).endVertex(); + worldrenderer.pos((double)f4 * d0, 0.0D, 0.0D).tex((double)f5, (double)p_renderItemIn2D_2_).endVertex(); + worldrenderer.pos((double)f4 * d0, 0.0D, (double)p_renderItemIn2D_7_).tex((double)f5, (double)p_renderItemIn2D_2_).endVertex(); + } + + p_renderItemIn2D_0_.draw(); + GL11.glNormal3f(1.0F, 0.0F, 0.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + + for (int j = 0; j < p_renderItemIn2D_5_; ++j) + { + float f7 = (float)j / (float)p_renderItemIn2D_5_; + float f10 = p_renderItemIn2D_1_ + f * f7 + f2; + float f6 = f7 + 1.0F / (float)p_renderItemIn2D_5_; + worldrenderer.pos((double)f6 * d0, 0.0D, (double)p_renderItemIn2D_7_).tex((double)f10, (double)p_renderItemIn2D_2_).endVertex(); + worldrenderer.pos((double)f6 * d0, 0.0D, 0.0D).tex((double)f10, (double)p_renderItemIn2D_2_).endVertex(); + worldrenderer.pos((double)f6 * d0, d1, 0.0D).tex((double)f10, (double)p_renderItemIn2D_4_).endVertex(); + worldrenderer.pos((double)f6 * d0, d1, (double)p_renderItemIn2D_7_).tex((double)f10, (double)p_renderItemIn2D_4_).endVertex(); + } + + p_renderItemIn2D_0_.draw(); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + + for (int k = 0; k < p_renderItemIn2D_6_; ++k) + { + float f8 = (float)k / (float)p_renderItemIn2D_6_; + float f11 = p_renderItemIn2D_2_ + f1 * f8 + f3; + float f13 = f8 + 1.0F / (float)p_renderItemIn2D_6_; + worldrenderer.pos(0.0D, (double)f13 * d1, (double)p_renderItemIn2D_7_).tex((double)p_renderItemIn2D_1_, (double)f11).endVertex(); + worldrenderer.pos(d0, (double)f13 * d1, (double)p_renderItemIn2D_7_).tex((double)p_renderItemIn2D_3_, (double)f11).endVertex(); + worldrenderer.pos(d0, (double)f13 * d1, 0.0D).tex((double)p_renderItemIn2D_3_, (double)f11).endVertex(); + worldrenderer.pos(0.0D, (double)f13 * d1, 0.0D).tex((double)p_renderItemIn2D_1_, (double)f11).endVertex(); + } + + p_renderItemIn2D_0_.draw(); + GL11.glNormal3f(0.0F, -1.0F, 0.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + + for (int l = 0; l < p_renderItemIn2D_6_; ++l) + { + float f9 = (float)l / (float)p_renderItemIn2D_6_; + float f12 = p_renderItemIn2D_2_ + f1 * f9 + f3; + worldrenderer.pos(d0, (double)f9 * d1, (double)p_renderItemIn2D_7_).tex((double)p_renderItemIn2D_3_, (double)f12).endVertex(); + worldrenderer.pos(0.0D, (double)f9 * d1, (double)p_renderItemIn2D_7_).tex((double)p_renderItemIn2D_1_, (double)f12).endVertex(); + worldrenderer.pos(0.0D, (double)f9 * d1, 0.0D).tex((double)p_renderItemIn2D_1_, (double)f12).endVertex(); + worldrenderer.pos(d0, (double)f9 * d1, 0.0D).tex((double)p_renderItemIn2D_3_, (double)f12).endVertex(); + } + + p_renderItemIn2D_0_.draw(); + } +} diff --git a/src/minecraft/optifine/ModelUtils.java b/src/minecraft/optifine/ModelUtils.java new file mode 100644 index 0000000..5f05376 --- /dev/null +++ b/src/minecraft/optifine/ModelUtils.java @@ -0,0 +1,99 @@ +package optifine; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.SimpleBakedModel; +import net.minecraft.util.EnumFacing; + +public class ModelUtils +{ + public static void dbgModel(IBakedModel p_dbgModel_0_) + { + if (p_dbgModel_0_ != null) + { + Config.dbg("Model: " + p_dbgModel_0_ + ", ao: " + p_dbgModel_0_.isAmbientOcclusion() + ", gui3d: " + p_dbgModel_0_.isGui3d() + ", builtIn: " + p_dbgModel_0_.isBuiltInRenderer() + ", particle: " + p_dbgModel_0_.getParticleTexture()); + EnumFacing[] aenumfacing = EnumFacing.VALUES; + + for (int i = 0; i < aenumfacing.length; ++i) + { + EnumFacing enumfacing = aenumfacing[i]; + List list = p_dbgModel_0_.getFaceQuads(enumfacing); + dbgQuads(enumfacing.getName(), list, " "); + } + + List list1 = p_dbgModel_0_.getGeneralQuads(); + dbgQuads("General", list1, " "); + } + } + + private static void dbgQuads(String p_dbgQuads_0_, List p_dbgQuads_1_, String p_dbgQuads_2_) + { + for (Object bakedquad : p_dbgQuads_1_) + { + dbgQuad(p_dbgQuads_0_, (BakedQuad) bakedquad, p_dbgQuads_2_); + } + } + + public static void dbgQuad(String p_dbgQuad_0_, BakedQuad p_dbgQuad_1_, String p_dbgQuad_2_) + { + Config.dbg(p_dbgQuad_2_ + "Quad: " + p_dbgQuad_1_.getClass().getName() + ", type: " + p_dbgQuad_0_ + ", face: " + p_dbgQuad_1_.getFace() + ", tint: " + p_dbgQuad_1_.getTintIndex() + ", sprite: " + p_dbgQuad_1_.getSprite()); + dbgVertexData(p_dbgQuad_1_.getVertexData(), " " + p_dbgQuad_2_); + } + + public static void dbgVertexData(int[] p_dbgVertexData_0_, String p_dbgVertexData_1_) + { + int i = p_dbgVertexData_0_.length / 4; + Config.dbg(p_dbgVertexData_1_ + "Length: " + p_dbgVertexData_0_.length + ", step: " + i); + + for (int j = 0; j < 4; ++j) + { + int k = j * i; + float f = Float.intBitsToFloat(p_dbgVertexData_0_[k + 0]); + float f1 = Float.intBitsToFloat(p_dbgVertexData_0_[k + 1]); + float f2 = Float.intBitsToFloat(p_dbgVertexData_0_[k + 2]); + int l = p_dbgVertexData_0_[k + 3]; + float f3 = Float.intBitsToFloat(p_dbgVertexData_0_[k + 4]); + float f4 = Float.intBitsToFloat(p_dbgVertexData_0_[k + 5]); + Config.dbg(p_dbgVertexData_1_ + j + " xyz: " + f + "," + f1 + "," + f2 + " col: " + l + " u,v: " + f3 + "," + f4); + } + } + + public static IBakedModel duplicateModel(IBakedModel p_duplicateModel_0_) + { + List list = duplicateQuadList(p_duplicateModel_0_.getGeneralQuads()); + EnumFacing[] aenumfacing = EnumFacing.VALUES; + List list1 = new ArrayList(); + + for (int i = 0; i < aenumfacing.length; ++i) + { + EnumFacing enumfacing = aenumfacing[i]; + List list2 = p_duplicateModel_0_.getFaceQuads(enumfacing); + List list3 = duplicateQuadList(list2); + list1.add(list3); + } + + SimpleBakedModel simplebakedmodel = new SimpleBakedModel(list, list1, p_duplicateModel_0_.isAmbientOcclusion(), p_duplicateModel_0_.isGui3d(), p_duplicateModel_0_.getParticleTexture(), p_duplicateModel_0_.getItemCameraTransforms()); + return simplebakedmodel; + } + + public static List duplicateQuadList(List p_duplicateQuadList_0_) + { + List list = new ArrayList(); + + for (Object bakedquad : p_duplicateQuadList_0_) + { + BakedQuad bakedquad1 = duplicateQuad((BakedQuad) bakedquad); + list.add(bakedquad1); + } + + return list; + } + + public static BakedQuad duplicateQuad(BakedQuad p_duplicateQuad_0_) + { + BakedQuad bakedquad = new BakedQuad((int[])p_duplicateQuad_0_.getVertexData().clone(), p_duplicateQuad_0_.getTintIndex(), p_duplicateQuad_0_.getFace(), p_duplicateQuad_0_.getSprite()); + return bakedquad; + } +} diff --git a/src/minecraft/optifine/NaturalProperties.java b/src/minecraft/optifine/NaturalProperties.java new file mode 100644 index 0000000..c5c3098 --- /dev/null +++ b/src/minecraft/optifine/NaturalProperties.java @@ -0,0 +1,187 @@ +package optifine; + +import java.util.IdentityHashMap; +import java.util.Map; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; + +public class NaturalProperties +{ + public int rotation = 1; + public boolean flip = false; + private Map[] quadMaps = new Map[8]; + + public NaturalProperties(String p_i68_1_) + { + if (p_i68_1_.equals("4")) + { + this.rotation = 4; + } + else if (p_i68_1_.equals("2")) + { + this.rotation = 2; + } + else if (p_i68_1_.equals("F")) + { + this.flip = true; + } + else if (p_i68_1_.equals("4F")) + { + this.rotation = 4; + this.flip = true; + } + else if (p_i68_1_.equals("2F")) + { + this.rotation = 2; + this.flip = true; + } + else + { + Config.warn("NaturalTextures: Unknown type: " + p_i68_1_); + } + } + + public boolean isValid() + { + return this.rotation != 2 && this.rotation != 4 ? this.flip : true; + } + + public synchronized BakedQuad getQuad(BakedQuad p_getQuad_1_, int p_getQuad_2_, boolean p_getQuad_3_) + { + int i = p_getQuad_2_; + + if (p_getQuad_3_) + { + i = p_getQuad_2_ | 4; + } + + if (i > 0 && i < this.quadMaps.length) + { + Map map = this.quadMaps[i]; + + if (map == null) + { + map = new IdentityHashMap(1); + this.quadMaps[i] = map; + } + + BakedQuad bakedquad = (BakedQuad)map.get(p_getQuad_1_); + + if (bakedquad == null) + { + bakedquad = this.makeQuad(p_getQuad_1_, p_getQuad_2_, p_getQuad_3_); + map.put(p_getQuad_1_, bakedquad); + } + + return bakedquad; + } + else + { + return p_getQuad_1_; + } + } + + private BakedQuad makeQuad(BakedQuad p_makeQuad_1_, int p_makeQuad_2_, boolean p_makeQuad_3_) + { + int[] aint = p_makeQuad_1_.getVertexData(); + int i = p_makeQuad_1_.getTintIndex(); + EnumFacing enumfacing = p_makeQuad_1_.getFace(); + TextureAtlasSprite textureatlassprite = p_makeQuad_1_.getSprite(); + + if (!this.isFullSprite(p_makeQuad_1_)) + { + return p_makeQuad_1_; + } + else + { + aint = this.transformVertexData(aint, p_makeQuad_2_, p_makeQuad_3_); + BakedQuad bakedquad = new BakedQuad(aint, i, enumfacing, textureatlassprite); + return bakedquad; + } + } + + private int[] transformVertexData(int[] p_transformVertexData_1_, int p_transformVertexData_2_, boolean p_transformVertexData_3_) + { + int[] aint = (int[])p_transformVertexData_1_.clone(); + int i = 4 - p_transformVertexData_2_; + + if (p_transformVertexData_3_) + { + i += 3; + } + + i = i % 4; + int j = aint.length / 4; + + for (int k = 0; k < 4; ++k) + { + int l = k * j; + int i1 = i * j; + aint[i1 + 4] = p_transformVertexData_1_[l + 4]; + aint[i1 + 4 + 1] = p_transformVertexData_1_[l + 4 + 1]; + + if (p_transformVertexData_3_) + { + --i; + + if (i < 0) + { + i = 3; + } + } + else + { + ++i; + + if (i > 3) + { + i = 0; + } + } + } + + return aint; + } + + private boolean isFullSprite(BakedQuad p_isFullSprite_1_) + { + TextureAtlasSprite textureatlassprite = p_isFullSprite_1_.getSprite(); + float f = textureatlassprite.getMinU(); + float f1 = textureatlassprite.getMaxU(); + float f2 = f1 - f; + float f3 = f2 / 256.0F; + float f4 = textureatlassprite.getMinV(); + float f5 = textureatlassprite.getMaxV(); + float f6 = f5 - f4; + float f7 = f6 / 256.0F; + int[] aint = p_isFullSprite_1_.getVertexData(); + int i = aint.length / 4; + + for (int j = 0; j < 4; ++j) + { + int k = j * i; + float f8 = Float.intBitsToFloat(aint[k + 4]); + float f9 = Float.intBitsToFloat(aint[k + 4 + 1]); + + if (!this.equalsDelta(f8, f, f3) && !this.equalsDelta(f8, f1, f3)) + { + return false; + } + + if (!this.equalsDelta(f9, f4, f7) && !this.equalsDelta(f9, f5, f7)) + { + return false; + } + } + + return true; + } + + private boolean equalsDelta(float p_equalsDelta_1_, float p_equalsDelta_2_, float p_equalsDelta_3_) + { + float f = MathHelper.abs(p_equalsDelta_1_ - p_equalsDelta_2_); + return f < p_equalsDelta_3_; + } +} diff --git a/src/minecraft/optifine/NaturalTextures.java b/src/minecraft/optifine/NaturalTextures.java new file mode 100644 index 0000000..68ddaaf --- /dev/null +++ b/src/minecraft/optifine/NaturalTextures.java @@ -0,0 +1,186 @@ +package optifine; + +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.ArrayList; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ResourceLocation; + +public class NaturalTextures +{ + private static NaturalProperties[] propertiesByIndex = new NaturalProperties[0]; + + public static void update() + { + propertiesByIndex = new NaturalProperties[0]; + + if (Config.isNaturalTextures()) + { + String s = "optifine/natural.properties"; + + try + { + ResourceLocation resourcelocation = new ResourceLocation(s); + + if (!Config.hasResource(resourcelocation)) + { + Config.dbg("NaturalTextures: configuration \"" + s + "\" not found"); + return; + } + + boolean flag = Config.isFromDefaultResourcePack(resourcelocation); + InputStream inputstream = Config.getResourceStream(resourcelocation); + ArrayList arraylist = new ArrayList(256); + String s1 = Config.readInputStream(inputstream); + inputstream.close(); + String[] astring = Config.tokenize(s1, "\n\r"); + + if (flag) + { + Config.dbg("Natural Textures: Parsing default configuration \"" + s + "\""); + Config.dbg("Natural Textures: Valid only for textures from default resource pack"); + } + else + { + Config.dbg("Natural Textures: Parsing configuration \"" + s + "\""); + } + + TextureMap texturemap = TextureUtils.getTextureMapBlocks(); + + for (int i = 0; i < astring.length; ++i) + { + String s2 = astring[i].trim(); + + if (!s2.startsWith("#")) + { + String[] astring1 = Config.tokenize(s2, "="); + + if (astring1.length != 2) + { + Config.warn("Natural Textures: Invalid \"" + s + "\" line: " + s2); + } + else + { + String s3 = astring1[0].trim(); + String s4 = astring1[1].trim(); + TextureAtlasSprite textureatlassprite = texturemap.getSpriteSafe("minecraft:blocks/" + s3); + + if (textureatlassprite == null) + { + Config.warn("Natural Textures: Texture not found: \"" + s + "\" line: " + s2); + } + else + { + int j = textureatlassprite.getIndexInMap(); + + if (j < 0) + { + Config.warn("Natural Textures: Invalid \"" + s + "\" line: " + s2); + } + else + { + if (flag && !Config.isFromDefaultResourcePack(new ResourceLocation("textures/blocks/" + s3 + ".png"))) + { + return; + } + + NaturalProperties naturalproperties = new NaturalProperties(s4); + + if (naturalproperties.isValid()) + { + while (arraylist.size() <= j) + { + arraylist.add(null); + } + + arraylist.set(j, naturalproperties); + Config.dbg("NaturalTextures: " + s3 + " = " + s4); + } + } + } + } + } + } + + propertiesByIndex = (NaturalProperties[])((NaturalProperties[])arraylist.toArray(new NaturalProperties[arraylist.size()])); + } + catch (FileNotFoundException var17) + { + Config.warn("NaturalTextures: configuration \"" + s + "\" not found"); + return; + } + catch (Exception exception) + { + exception.printStackTrace(); + } + } + } + + public static BakedQuad getNaturalTexture(BlockPos p_getNaturalTexture_0_, BakedQuad p_getNaturalTexture_1_) + { + TextureAtlasSprite textureatlassprite = p_getNaturalTexture_1_.getSprite(); + + if (textureatlassprite == null) + { + return p_getNaturalTexture_1_; + } + else + { + NaturalProperties naturalproperties = getNaturalProperties(textureatlassprite); + + if (naturalproperties == null) + { + return p_getNaturalTexture_1_; + } + else + { + int i = ConnectedTextures.getSide(p_getNaturalTexture_1_.getFace()); + int j = Config.getRandom(p_getNaturalTexture_0_, i); + int k = 0; + boolean flag = false; + + if (naturalproperties.rotation > 1) + { + k = j & 3; + } + + if (naturalproperties.rotation == 2) + { + k = k / 2 * 2; + } + + if (naturalproperties.flip) + { + flag = (j & 4) != 0; + } + + return naturalproperties.getQuad(p_getNaturalTexture_1_, k, flag); + } + } + } + + public static NaturalProperties getNaturalProperties(TextureAtlasSprite p_getNaturalProperties_0_) + { + if (!(p_getNaturalProperties_0_ instanceof TextureAtlasSprite)) + { + return null; + } + else + { + int i = p_getNaturalProperties_0_.getIndexInMap(); + + if (i >= 0 && i < propertiesByIndex.length) + { + NaturalProperties naturalproperties = propertiesByIndex[i]; + return naturalproperties; + } + else + { + return null; + } + } + } +} diff --git a/src/minecraft/optifine/NbtTagValue.java b/src/minecraft/optifine/NbtTagValue.java new file mode 100644 index 0000000..80414f9 --- /dev/null +++ b/src/minecraft/optifine/NbtTagValue.java @@ -0,0 +1,290 @@ +package optifine; + +import java.util.Arrays; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagByte; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagDouble; +import net.minecraft.nbt.NBTTagFloat; +import net.minecraft.nbt.NBTTagInt; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagLong; +import net.minecraft.nbt.NBTTagShort; +import net.minecraft.nbt.NBTTagString; +import org.apache.commons.lang3.StringEscapeUtils; + +public class NbtTagValue +{ + private String[] parents = null; + private String name = null; + private int type = 0; + private String value = null; + private static final int TYPE_TEXT = 0; + private static final int TYPE_PATTERN = 1; + private static final int TYPE_IPATTERN = 2; + private static final int TYPE_REGEX = 3; + private static final int TYPE_IREGEX = 4; + private static final String PREFIX_PATTERN = "pattern:"; + private static final String PREFIX_IPATTERN = "ipattern:"; + private static final String PREFIX_REGEX = "regex:"; + private static final String PREFIX_IREGEX = "iregex:"; + + public NbtTagValue(String p_i69_1_, String p_i69_2_) + { + String[] astring = Config.tokenize(p_i69_1_, "."); + this.parents = (String[])Arrays.copyOfRange(astring, 0, astring.length - 1); + this.name = astring[astring.length - 1]; + + if (p_i69_2_.startsWith("pattern:")) + { + this.type = 1; + p_i69_2_ = p_i69_2_.substring("pattern:".length()); + } + else if (p_i69_2_.startsWith("ipattern:")) + { + this.type = 2; + p_i69_2_ = p_i69_2_.substring("ipattern:".length()).toLowerCase(); + } + else if (p_i69_2_.startsWith("regex:")) + { + this.type = 3; + p_i69_2_ = p_i69_2_.substring("regex:".length()); + } + else if (p_i69_2_.startsWith("iregex:")) + { + this.type = 4; + p_i69_2_ = p_i69_2_.substring("iregex:".length()).toLowerCase(); + } + else + { + this.type = 0; + } + + p_i69_2_ = StringEscapeUtils.unescapeJava(p_i69_2_); + this.value = p_i69_2_; + } + + public boolean matches(NBTTagCompound p_matches_1_) + { + if (p_matches_1_ == null) + { + return false; + } + else + { + NBTBase nbtbase = p_matches_1_; + + for (int i = 0; i < this.parents.length; ++i) + { + String s = this.parents[i]; + nbtbase = getChildTag(nbtbase, s); + + if (nbtbase == null) + { + return false; + } + } + + if (this.name.equals("*")) + { + return this.matchesAnyChild(nbtbase); + } + else + { + nbtbase = getChildTag(nbtbase, this.name); + + if (nbtbase == null) + { + return false; + } + else if (this.matches(nbtbase)) + { + return true; + } + else + { + return false; + } + } + } + } + + private boolean matchesAnyChild(NBTBase p_matchesAnyChild_1_) + { + if (p_matchesAnyChild_1_ instanceof NBTTagCompound) + { + NBTTagCompound nbttagcompound = (NBTTagCompound)p_matchesAnyChild_1_; + + for (String s : nbttagcompound.getKeySet()) + { + NBTBase nbtbase = nbttagcompound.getTag(s); + + if (this.matches(nbtbase)) + { + return true; + } + } + } + + if (p_matchesAnyChild_1_ instanceof NBTTagList) + { + NBTTagList nbttaglist = (NBTTagList)p_matchesAnyChild_1_; + int i = nbttaglist.tagCount(); + + for (int j = 0; j < i; ++j) + { + NBTBase nbtbase1 = nbttaglist.get(j); + + if (this.matches(nbtbase1)) + { + return true; + } + } + } + + return false; + } + + private static NBTBase getChildTag(NBTBase p_getChildTag_0_, String p_getChildTag_1_) + { + if (p_getChildTag_0_ instanceof NBTTagCompound) + { + NBTTagCompound nbttagcompound = (NBTTagCompound)p_getChildTag_0_; + return nbttagcompound.getTag(p_getChildTag_1_); + } + else if (p_getChildTag_0_ instanceof NBTTagList) + { + NBTTagList nbttaglist = (NBTTagList)p_getChildTag_0_; + int i = Config.parseInt(p_getChildTag_1_, -1); + return i < 0 ? null : nbttaglist.get(i); + } + else + { + return null; + } + } + + private boolean matches(NBTBase p_matches_1_) + { + if (p_matches_1_ == null) + { + return false; + } + else + { + String s = getValue(p_matches_1_); + + if (s == null) + { + return false; + } + else + { + switch (this.type) + { + case 0: + return s.equals(this.value); + + case 1: + return this.matchesPattern(s, this.value); + + case 2: + return this.matchesPattern(s.toLowerCase(), this.value); + + case 3: + return this.matchesRegex(s, this.value); + + case 4: + return this.matchesRegex(s.toLowerCase(), this.value); + + default: + throw new IllegalArgumentException("Unknown NbtTagValue type: " + this.type); + } + } + } + } + + private boolean matchesPattern(String p_matchesPattern_1_, String p_matchesPattern_2_) + { + return StrUtils.equalsMask(p_matchesPattern_1_, p_matchesPattern_2_, '*', '?'); + } + + private boolean matchesRegex(String p_matchesRegex_1_, String p_matchesRegex_2_) + { + return p_matchesRegex_1_.matches(p_matchesRegex_2_); + } + + private static String getValue(NBTBase p_getValue_0_) + { + if (p_getValue_0_ == null) + { + return null; + } + else if (p_getValue_0_ instanceof NBTTagString) + { + NBTTagString nbttagstring = (NBTTagString)p_getValue_0_; + return nbttagstring.getString(); + } + else if (p_getValue_0_ instanceof NBTTagInt) + { + NBTTagInt nbttagint = (NBTTagInt)p_getValue_0_; + return Integer.toString(nbttagint.getInt()); + } + else if (p_getValue_0_ instanceof NBTTagByte) + { + NBTTagByte nbttagbyte = (NBTTagByte)p_getValue_0_; + return Byte.toString(nbttagbyte.getByte()); + } + else if (p_getValue_0_ instanceof NBTTagShort) + { + NBTTagShort nbttagshort = (NBTTagShort)p_getValue_0_; + return Short.toString(nbttagshort.getShort()); + } + else if (p_getValue_0_ instanceof NBTTagLong) + { + NBTTagLong nbttaglong = (NBTTagLong)p_getValue_0_; + return Long.toString(nbttaglong.getLong()); + } + else if (p_getValue_0_ instanceof NBTTagFloat) + { + NBTTagFloat nbttagfloat = (NBTTagFloat)p_getValue_0_; + return Float.toString(nbttagfloat.getFloat()); + } + else if (p_getValue_0_ instanceof NBTTagDouble) + { + NBTTagDouble nbttagdouble = (NBTTagDouble)p_getValue_0_; + return Double.toString(nbttagdouble.getDouble()); + } + else + { + return p_getValue_0_.toString(); + } + } + + public String toString() + { + StringBuffer stringbuffer = new StringBuffer(); + + for (int i = 0; i < this.parents.length; ++i) + { + String s = this.parents[i]; + + if (i > 0) + { + stringbuffer.append("."); + } + + stringbuffer.append(s); + } + + if (stringbuffer.length() > 0) + { + stringbuffer.append("."); + } + + stringbuffer.append(this.name); + stringbuffer.append(" = "); + stringbuffer.append(this.value); + return stringbuffer.toString(); + } +} diff --git a/src/minecraft/optifine/NextTickHashSet.java b/src/minecraft/optifine/NextTickHashSet.java new file mode 100644 index 0000000..9797370 --- /dev/null +++ b/src/minecraft/optifine/NextTickHashSet.java @@ -0,0 +1,200 @@ +package optifine; + +import com.google.common.collect.Iterators; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; +import net.minecraft.util.BlockPos; +import net.minecraft.util.LongHashMap; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.NextTickListEntry; + +public class NextTickHashSet extends TreeSet +{ + private LongHashMap longHashMap = new LongHashMap(); + private int minX = Integer.MIN_VALUE; + private int minZ = Integer.MIN_VALUE; + private int maxX = Integer.MIN_VALUE; + private int maxZ = Integer.MIN_VALUE; + private static final int UNDEFINED = Integer.MIN_VALUE; + + public NextTickHashSet(Set p_i70_1_) + { + for (Object object : p_i70_1_) + { + this.add(object); + } + } + + public boolean contains(Object p_contains_1_) + { + if (!(p_contains_1_ instanceof NextTickListEntry)) + { + return false; + } + else + { + NextTickListEntry nextticklistentry = (NextTickListEntry)p_contains_1_; + Set set = this.getSubSet(nextticklistentry, false); + return set == null ? false : set.contains(nextticklistentry); + } + } + + public boolean add(Object p_add_1_) + { + if (!(p_add_1_ instanceof NextTickListEntry)) + { + return false; + } + else + { + NextTickListEntry nextticklistentry = (NextTickListEntry)p_add_1_; + + if (nextticklistentry == null) + { + return false; + } + else + { + Set set = this.getSubSet(nextticklistentry, true); + boolean flag = set.add(nextticklistentry); + boolean flag1 = super.add(p_add_1_); + + if (flag != flag1) + { + throw new IllegalStateException("Added: " + flag + ", addedParent: " + flag1); + } + else + { + return flag1; + } + } + } + } + + public boolean remove(Object p_remove_1_) + { + if (!(p_remove_1_ instanceof NextTickListEntry)) + { + return false; + } + else + { + NextTickListEntry nextticklistentry = (NextTickListEntry)p_remove_1_; + Set set = this.getSubSet(nextticklistentry, false); + + if (set == null) + { + return false; + } + else + { + boolean flag = set.remove(nextticklistentry); + boolean flag1 = super.remove(nextticklistentry); + + if (flag != flag1) + { + throw new IllegalStateException("Added: " + flag + ", addedParent: " + flag1); + } + else + { + return flag1; + } + } + } + } + + private Set getSubSet(NextTickListEntry p_getSubSet_1_, boolean p_getSubSet_2_) + { + if (p_getSubSet_1_ == null) + { + return null; + } + else + { + BlockPos blockpos = p_getSubSet_1_.position; + int i = blockpos.getX() >> 4; + int j = blockpos.getZ() >> 4; + return this.getSubSet(i, j, p_getSubSet_2_); + } + } + + private Set getSubSet(int p_getSubSet_1_, int p_getSubSet_2_, boolean p_getSubSet_3_) + { + long i = ChunkCoordIntPair.chunkXZ2Int(p_getSubSet_1_, p_getSubSet_2_); + HashSet hashset = (HashSet)this.longHashMap.getValueByKey(i); + + if (hashset == null && p_getSubSet_3_) + { + hashset = new HashSet(); + this.longHashMap.add(i, hashset); + } + + return hashset; + } + + public Iterator iterator() + { + if (this.minX == Integer.MIN_VALUE) + { + return super.iterator(); + } + else if (this.size() <= 0) + { + return Iterators.emptyIterator(); + } + else + { + int i = this.minX >> 4; + int j = this.minZ >> 4; + int k = this.maxX >> 4; + int l = this.maxZ >> 4; + List list = new ArrayList(); + + for (int i1 = i; i1 <= k; ++i1) + { + for (int j1 = j; j1 <= l; ++j1) + { + Set set = this.getSubSet(i1, j1, false); + + if (set != null) + { + list.add(set.iterator()); + } + } + } + + if (list.size() <= 0) + { + return Iterators.emptyIterator(); + } + else if (list.size() == 1) + { + return (Iterator)list.get(0); + } + else + { + return Iterators.concat(list.iterator()); + } + } + } + + public void setIteratorLimits(int p_setIteratorLimits_1_, int p_setIteratorLimits_2_, int p_setIteratorLimits_3_, int p_setIteratorLimits_4_) + { + this.minX = Math.min(p_setIteratorLimits_1_, p_setIteratorLimits_3_); + this.minZ = Math.min(p_setIteratorLimits_2_, p_setIteratorLimits_4_); + this.maxX = Math.max(p_setIteratorLimits_1_, p_setIteratorLimits_3_); + this.maxZ = Math.max(p_setIteratorLimits_2_, p_setIteratorLimits_4_); + } + + public void clearIteratorLimits() + { + this.minX = Integer.MIN_VALUE; + this.minZ = Integer.MIN_VALUE; + this.maxX = Integer.MIN_VALUE; + this.maxZ = Integer.MIN_VALUE; + } +} diff --git a/src/minecraft/optifine/PlayerConfiguration.java b/src/minecraft/optifine/PlayerConfiguration.java new file mode 100644 index 0000000..9eab0bf --- /dev/null +++ b/src/minecraft/optifine/PlayerConfiguration.java @@ -0,0 +1,42 @@ +package optifine; + +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBiped; + +public class PlayerConfiguration +{ + private PlayerItemModel[] playerItemModels = new PlayerItemModel[0]; + private boolean initialized = false; + + public void renderPlayerItems(ModelBiped p_renderPlayerItems_1_, AbstractClientPlayer p_renderPlayerItems_2_, float p_renderPlayerItems_3_, float p_renderPlayerItems_4_) + { + if (this.initialized) + { + for (int i = 0; i < this.playerItemModels.length; ++i) + { + PlayerItemModel playeritemmodel = this.playerItemModels[i]; + playeritemmodel.render(p_renderPlayerItems_1_, p_renderPlayerItems_2_, p_renderPlayerItems_3_, p_renderPlayerItems_4_); + } + } + } + + public boolean isInitialized() + { + return this.initialized; + } + + public void setInitialized(boolean p_setInitialized_1_) + { + this.initialized = p_setInitialized_1_; + } + + public PlayerItemModel[] getPlayerItemModels() + { + return this.playerItemModels; + } + + public void addPlayerItemModel(PlayerItemModel p_addPlayerItemModel_1_) + { + this.playerItemModels = (PlayerItemModel[])((PlayerItemModel[])Config.addObjectToArray(this.playerItemModels, p_addPlayerItemModel_1_)); + } +} diff --git a/src/minecraft/optifine/PlayerConfigurationParser.java b/src/minecraft/optifine/PlayerConfigurationParser.java new file mode 100644 index 0000000..891b3e4 --- /dev/null +++ b/src/minecraft/optifine/PlayerConfigurationParser.java @@ -0,0 +1,137 @@ +package optifine; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonParser; +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import javax.imageio.ImageIO; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +public class PlayerConfigurationParser +{ + private String player = null; + public static final String CONFIG_ITEMS = "items"; + public static final String ITEM_TYPE = "type"; + public static final String ITEM_ACTIVE = "active"; + + public PlayerConfigurationParser(String p_i71_1_) + { + this.player = p_i71_1_; + } + + public PlayerConfiguration parsePlayerConfiguration(JsonElement p_parsePlayerConfiguration_1_) + { + if (p_parsePlayerConfiguration_1_ == null) + { + throw new JsonParseException("JSON object is null, player: " + this.player); + } + else + { + JsonObject jsonobject = (JsonObject)p_parsePlayerConfiguration_1_; + PlayerConfiguration playerconfiguration = new PlayerConfiguration(); + JsonArray jsonarray = (JsonArray)jsonobject.get("items"); + + if (jsonarray != null) + { + for (int i = 0; i < jsonarray.size(); ++i) + { + JsonObject jsonobject1 = (JsonObject)jsonarray.get(i); + boolean flag = Json.getBoolean(jsonobject1, "active", true); + + if (flag) + { + String s = Json.getString(jsonobject1, "type"); + + if (s == null) + { + Config.warn("Item type is null, player: " + this.player); + } + else + { + String s1 = Json.getString(jsonobject1, "model"); + + if (s1 == null) + { + s1 = "items/" + s + "/model.cfg"; + } + + PlayerItemModel playeritemmodel = this.downloadModel(s1); + + if (playeritemmodel != null) + { + if (!playeritemmodel.isUsePlayerTexture()) + { + String s2 = Json.getString(jsonobject1, "texture"); + + if (s2 == null) + { + s2 = "items/" + s + "/users/" + this.player + ".png"; + } + + BufferedImage bufferedimage = this.downloadTextureImage(s2); + + if (bufferedimage == null) + { + continue; + } + + playeritemmodel.setTextureImage(bufferedimage); + ResourceLocation resourcelocation = new ResourceLocation("optifine.net", s2); + playeritemmodel.setTextureLocation(resourcelocation); + } + + playerconfiguration.addPlayerItemModel(playeritemmodel); + } + } + } + } + } + + return playerconfiguration; + } + } + + private BufferedImage downloadTextureImage(String p_downloadTextureImage_1_) + { + String s = "http://s.optifine.net/" + p_downloadTextureImage_1_; + + try + { + byte[] abyte = HttpPipeline.get(s, Minecraft.getMinecraft().getProxy()); + BufferedImage bufferedimage = ImageIO.read((InputStream)(new ByteArrayInputStream(abyte))); + return bufferedimage; + } + catch (IOException ioexception) + { + Config.warn("Error loading item texture " + p_downloadTextureImage_1_ + ": " + ioexception.getClass().getName() + ": " + ioexception.getMessage()); + return null; + } + } + + private PlayerItemModel downloadModel(String p_downloadModel_1_) + { + String s = "http://s.optifine.net/" + p_downloadModel_1_; + + try + { + byte[] abyte = HttpPipeline.get(s, Minecraft.getMinecraft().getProxy()); + String s1 = new String(abyte, "ASCII"); + JsonParser jsonparser = new JsonParser(); + JsonObject jsonobject = (JsonObject)jsonparser.parse(s1); + PlayerItemParser playeritemparser = new PlayerItemParser(); + PlayerItemModel playeritemmodel = PlayerItemParser.parseItemModel(jsonobject); + return playeritemmodel; + } + catch (Exception exception) + { + Config.warn("Error loading item model " + p_downloadModel_1_ + ": " + exception.getClass().getName() + ": " + exception.getMessage()); + return null; + } + } +} diff --git a/src/minecraft/optifine/PlayerConfigurationReceiver.java b/src/minecraft/optifine/PlayerConfigurationReceiver.java new file mode 100644 index 0000000..5a42b75 --- /dev/null +++ b/src/minecraft/optifine/PlayerConfigurationReceiver.java @@ -0,0 +1,39 @@ +package optifine; + +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; + +public class PlayerConfigurationReceiver implements IFileDownloadListener +{ + private String player = null; + + public PlayerConfigurationReceiver(String p_i72_1_) + { + this.player = p_i72_1_; + } + + public void fileDownloadFinished(String p_fileDownloadFinished_1_, byte[] p_fileDownloadFinished_2_, Throwable p_fileDownloadFinished_3_) + { + if (p_fileDownloadFinished_2_ != null) + { + try + { + String s = new String(p_fileDownloadFinished_2_, "ASCII"); + JsonParser jsonparser = new JsonParser(); + JsonElement jsonelement = jsonparser.parse(s); + PlayerConfigurationParser playerconfigurationparser = new PlayerConfigurationParser(this.player); + PlayerConfiguration playerconfiguration = playerconfigurationparser.parsePlayerConfiguration(jsonelement); + + if (playerconfiguration != null) + { + playerconfiguration.setInitialized(true); + PlayerConfigurations.setPlayerConfiguration(this.player, playerconfiguration); + } + } + catch (Exception exception) + { + Config.dbg("Error parsing configuration: " + p_fileDownloadFinished_1_ + ", " + exception.getClass().getName() + ": " + exception.getMessage()); + } + } + } +} diff --git a/src/minecraft/optifine/PlayerConfigurations.java b/src/minecraft/optifine/PlayerConfigurations.java new file mode 100644 index 0000000..7188c28 --- /dev/null +++ b/src/minecraft/optifine/PlayerConfigurations.java @@ -0,0 +1,62 @@ +package optifine; + +import java.util.HashMap; +import java.util.Map; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBiped; + +public class PlayerConfigurations +{ + private static Map mapConfigurations = null; + + public static void renderPlayerItems(ModelBiped p_renderPlayerItems_0_, AbstractClientPlayer p_renderPlayerItems_1_, float p_renderPlayerItems_2_, float p_renderPlayerItems_3_) + { + PlayerConfiguration playerconfiguration = getPlayerConfiguration(p_renderPlayerItems_1_); + + if (playerconfiguration != null) + { + playerconfiguration.renderPlayerItems(p_renderPlayerItems_0_, p_renderPlayerItems_1_, p_renderPlayerItems_2_, p_renderPlayerItems_3_); + } + } + + public static synchronized PlayerConfiguration getPlayerConfiguration(AbstractClientPlayer p_getPlayerConfiguration_0_) + { + String s = p_getPlayerConfiguration_0_.getNameClear(); + + if (s == null) + { + return null; + } + else + { + PlayerConfiguration playerconfiguration = (PlayerConfiguration)getMapConfigurations().get(s); + + if (playerconfiguration == null) + { + playerconfiguration = new PlayerConfiguration(); + getMapConfigurations().put(s, playerconfiguration); + PlayerConfigurationReceiver playerconfigurationreceiver = new PlayerConfigurationReceiver(s); + String s1 = "http://s.optifine.net/users/" + s + ".cfg"; + FileDownloadThread filedownloadthread = new FileDownloadThread(s1, playerconfigurationreceiver); + filedownloadthread.start(); + } + + return playerconfiguration; + } + } + + public static synchronized void setPlayerConfiguration(String p_setPlayerConfiguration_0_, PlayerConfiguration p_setPlayerConfiguration_1_) + { + getMapConfigurations().put(p_setPlayerConfiguration_0_, p_setPlayerConfiguration_1_); + } + + private static Map getMapConfigurations() + { + if (mapConfigurations == null) + { + mapConfigurations = new HashMap(); + } + + return mapConfigurations; + } +} diff --git a/src/minecraft/optifine/PlayerControllerOF.java b/src/minecraft/optifine/PlayerControllerOF.java new file mode 100644 index 0000000..6095279 --- /dev/null +++ b/src/minecraft/optifine/PlayerControllerOF.java @@ -0,0 +1,66 @@ +package optifine; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class PlayerControllerOF extends PlayerControllerMP +{ + private boolean acting = false; + + public PlayerControllerOF(Minecraft p_i73_1_, NetHandlerPlayClient p_i73_2_) + { + super(p_i73_1_, p_i73_2_); + } + + /** + * Called when the player is hitting a block with an item. + */ + public boolean clickBlock(BlockPos loc, EnumFacing face) + { + this.acting = true; + boolean flag = super.clickBlock(loc, face); + this.acting = false; + return flag; + } + + public boolean onPlayerDamageBlock(BlockPos posBlock, EnumFacing directionFacing) + { + this.acting = true; + boolean flag = super.onPlayerDamageBlock(posBlock, directionFacing); + this.acting = false; + return flag; + } + + /** + * Notifies the server of things like consuming food, etc... + */ + public boolean sendUseItem(EntityPlayer playerIn, World worldIn, ItemStack itemStackIn) + { + this.acting = true; + boolean flag = super.sendUseItem(playerIn, worldIn, itemStackIn); + this.acting = false; + return flag; + } + + public boolean onPlayerRightClick(EntityPlayerSP player, WorldClient worldIn, ItemStack heldStack, BlockPos hitPos, EnumFacing side, Vec3 hitVec) + { + this.acting = true; + boolean flag = super.onPlayerRightClick(player, worldIn, heldStack, hitPos, side, hitVec); + this.acting = false; + return flag; + } + + public boolean isActing() + { + return this.acting; + } +} diff --git a/src/minecraft/optifine/PlayerItemModel.java b/src/minecraft/optifine/PlayerItemModel.java new file mode 100644 index 0000000..32f6400 --- /dev/null +++ b/src/minecraft/optifine/PlayerItemModel.java @@ -0,0 +1,132 @@ +package optifine; + +import java.awt.Dimension; +import java.awt.image.BufferedImage; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.util.ResourceLocation; + +public class PlayerItemModel +{ + private Dimension textureSize = null; + private boolean usePlayerTexture = false; + private PlayerItemRenderer[] modelRenderers = new PlayerItemRenderer[0]; + private ResourceLocation textureLocation = null; + private BufferedImage textureImage = null; + private DynamicTexture texture = null; + private ResourceLocation locationMissing = new ResourceLocation("textures/blocks/wool_colored_red.png"); + public static final int ATTACH_BODY = 0; + public static final int ATTACH_HEAD = 1; + public static final int ATTACH_LEFT_ARM = 2; + public static final int ATTACH_RIGHT_ARM = 3; + public static final int ATTACH_LEFT_LEG = 4; + public static final int ATTACH_RIGHT_LEG = 5; + public static final int ATTACH_CAPE = 6; + + public PlayerItemModel(Dimension p_i74_1_, boolean p_i74_2_, PlayerItemRenderer[] p_i74_3_) + { + this.textureSize = p_i74_1_; + this.usePlayerTexture = p_i74_2_; + this.modelRenderers = p_i74_3_; + } + + public void render(ModelBiped p_render_1_, AbstractClientPlayer p_render_2_, float p_render_3_, float p_render_4_) + { + TextureManager texturemanager = Config.getTextureManager(); + + if (this.usePlayerTexture) + { + texturemanager.bindTexture(p_render_2_.getLocationSkin()); + } + else if (this.textureLocation != null) + { + if (this.texture == null && this.textureImage != null) + { + this.texture = new DynamicTexture(this.textureImage); + Minecraft.getMinecraft().getTextureManager().loadTexture(this.textureLocation, this.texture); + } + + texturemanager.bindTexture(this.textureLocation); + } + else + { + texturemanager.bindTexture(this.locationMissing); + } + + for (int i = 0; i < this.modelRenderers.length; ++i) + { + PlayerItemRenderer playeritemrenderer = this.modelRenderers[i]; + GlStateManager.pushMatrix(); + + if (p_render_2_.isSneaking()) + { + GlStateManager.translate(0.0F, 0.2F, 0.0F); + } + + playeritemrenderer.render(p_render_1_, p_render_3_); + GlStateManager.popMatrix(); + } + } + + public static ModelRenderer getAttachModel(ModelBiped p_getAttachModel_0_, int p_getAttachModel_1_) + { + switch (p_getAttachModel_1_) + { + case 0: + return p_getAttachModel_0_.bipedBody; + + case 1: + return p_getAttachModel_0_.bipedHead; + + case 2: + return p_getAttachModel_0_.bipedLeftArm; + + case 3: + return p_getAttachModel_0_.bipedRightArm; + + case 4: + return p_getAttachModel_0_.bipedLeftLeg; + + case 5: + return p_getAttachModel_0_.bipedRightLeg; + + default: + return null; + } + } + + public BufferedImage getTextureImage() + { + return this.textureImage; + } + + public void setTextureImage(BufferedImage p_setTextureImage_1_) + { + this.textureImage = p_setTextureImage_1_; + } + + public DynamicTexture getTexture() + { + return this.texture; + } + + public ResourceLocation getTextureLocation() + { + return this.textureLocation; + } + + public void setTextureLocation(ResourceLocation p_setTextureLocation_1_) + { + this.textureLocation = p_setTextureLocation_1_; + } + + public boolean isUsePlayerTexture() + { + return this.usePlayerTexture; + } +} diff --git a/src/minecraft/optifine/PlayerItemParser.java b/src/minecraft/optifine/PlayerItemParser.java new file mode 100644 index 0000000..40e5ea1 --- /dev/null +++ b/src/minecraft/optifine/PlayerItemParser.java @@ -0,0 +1,373 @@ +package optifine; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonParser; +import java.awt.Dimension; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.util.ResourceLocation; + +public class PlayerItemParser +{ + private static JsonParser jsonParser = new JsonParser(); + public static final String ITEM_TYPE = "type"; + public static final String ITEM_TEXTURE_SIZE = "textureSize"; + public static final String ITEM_USE_PLAYER_TEXTURE = "usePlayerTexture"; + public static final String ITEM_MODELS = "models"; + public static final String MODEL_ID = "id"; + public static final String MODEL_BASE_ID = "baseId"; + public static final String MODEL_TYPE = "type"; + public static final String MODEL_ATTACH_TO = "attachTo"; + public static final String MODEL_INVERT_AXIS = "invertAxis"; + public static final String MODEL_MIRROR_TEXTURE = "mirrorTexture"; + public static final String MODEL_TRANSLATE = "translate"; + public static final String MODEL_ROTATE = "rotate"; + public static final String MODEL_SCALE = "scale"; + public static final String MODEL_BOXES = "boxes"; + public static final String MODEL_SPRITES = "sprites"; + public static final String MODEL_SUBMODEL = "submodel"; + public static final String MODEL_SUBMODELS = "submodels"; + public static final String BOX_TEXTURE_OFFSET = "textureOffset"; + public static final String BOX_COORDINATES = "coordinates"; + public static final String BOX_SIZE_ADD = "sizeAdd"; + public static final String ITEM_TYPE_MODEL = "PlayerItem"; + public static final String MODEL_TYPE_BOX = "ModelBox"; + + public static PlayerItemModel parseItemModel(JsonObject p_parseItemModel_0_) + { + String s = Json.getString(p_parseItemModel_0_, "type"); + + if (!Config.equals(s, "PlayerItem")) + { + throw new JsonParseException("Unknown model type: " + s); + } + else + { + int[] aint = Json.parseIntArray(p_parseItemModel_0_.get("textureSize"), 2); + checkNull(aint, "Missing texture size"); + Dimension dimension = new Dimension(aint[0], aint[1]); + boolean flag = Json.getBoolean(p_parseItemModel_0_, "usePlayerTexture", false); + JsonArray jsonarray = (JsonArray)p_parseItemModel_0_.get("models"); + checkNull(jsonarray, "Missing elements"); + Map map = new HashMap(); + List list = new ArrayList(); + new ArrayList(); + + for (int i = 0; i < jsonarray.size(); ++i) + { + JsonObject jsonobject = (JsonObject)jsonarray.get(i); + String s1 = Json.getString(jsonobject, "baseId"); + + if (s1 != null) + { + JsonObject jsonobject1 = (JsonObject)map.get(s1); + + if (jsonobject1 == null) + { + Config.warn("BaseID not found: " + s1); + continue; + } + + for (Entry entry : jsonobject1.entrySet()) + { + if (!jsonobject.has((String)entry.getKey())) + { + jsonobject.add((String)entry.getKey(), (JsonElement)entry.getValue()); + } + } + } + + String s2 = Json.getString(jsonobject, "id"); + + if (s2 != null) + { + if (!map.containsKey(s2)) + { + map.put(s2, jsonobject); + } + else + { + Config.warn("Duplicate model ID: " + s2); + } + } + + PlayerItemRenderer playeritemrenderer = parseItemRenderer(jsonobject, dimension); + + if (playeritemrenderer != null) + { + list.add(playeritemrenderer); + } + } + + PlayerItemRenderer[] aplayeritemrenderer = (PlayerItemRenderer[])((PlayerItemRenderer[])list.toArray(new PlayerItemRenderer[list.size()])); + return new PlayerItemModel(dimension, flag, aplayeritemrenderer); + } + } + + private static void checkNull(Object p_checkNull_0_, String p_checkNull_1_) + { + if (p_checkNull_0_ == null) + { + throw new JsonParseException(p_checkNull_1_); + } + } + + private static ResourceLocation makeResourceLocation(String p_makeResourceLocation_0_) + { + int i = p_makeResourceLocation_0_.indexOf(58); + + if (i < 0) + { + return new ResourceLocation(p_makeResourceLocation_0_); + } + else + { + String s = p_makeResourceLocation_0_.substring(0, i); + String s1 = p_makeResourceLocation_0_.substring(i + 1); + return new ResourceLocation(s, s1); + } + } + + private static int parseAttachModel(String p_parseAttachModel_0_) + { + if (p_parseAttachModel_0_ == null) + { + return 0; + } + else if (p_parseAttachModel_0_.equals("body")) + { + return 0; + } + else if (p_parseAttachModel_0_.equals("head")) + { + return 1; + } + else if (p_parseAttachModel_0_.equals("leftArm")) + { + return 2; + } + else if (p_parseAttachModel_0_.equals("rightArm")) + { + return 3; + } + else if (p_parseAttachModel_0_.equals("leftLeg")) + { + return 4; + } + else if (p_parseAttachModel_0_.equals("rightLeg")) + { + return 5; + } + else if (p_parseAttachModel_0_.equals("cape")) + { + return 6; + } + else + { + Config.warn("Unknown attachModel: " + p_parseAttachModel_0_); + return 0; + } + } + + private static PlayerItemRenderer parseItemRenderer(JsonObject p_parseItemRenderer_0_, Dimension p_parseItemRenderer_1_) + { + String s = Json.getString(p_parseItemRenderer_0_, "type"); + + if (!Config.equals(s, "ModelBox")) + { + Config.warn("Unknown model type: " + s); + return null; + } + else + { + String s1 = Json.getString(p_parseItemRenderer_0_, "attachTo"); + int i = parseAttachModel(s1); + float f = Json.getFloat(p_parseItemRenderer_0_, "scale", 1.0F); + ModelBase modelbase = new ModelPlayerItem(); + modelbase.textureWidth = p_parseItemRenderer_1_.width; + modelbase.textureHeight = p_parseItemRenderer_1_.height; + ModelRenderer modelrenderer = parseModelRenderer(p_parseItemRenderer_0_, modelbase); + PlayerItemRenderer playeritemrenderer = new PlayerItemRenderer(i, f, modelrenderer); + return playeritemrenderer; + } + } + + private static ModelRenderer parseModelRenderer(JsonObject p_parseModelRenderer_0_, ModelBase p_parseModelRenderer_1_) + { + ModelRenderer modelrenderer = new ModelRenderer(p_parseModelRenderer_1_); + String s = Json.getString(p_parseModelRenderer_0_, "invertAxis", "").toLowerCase(); + boolean flag = s.contains("x"); + boolean flag1 = s.contains("y"); + boolean flag2 = s.contains("z"); + float[] afloat = Json.parseFloatArray(p_parseModelRenderer_0_.get("translate"), 3, new float[3]); + + if (flag) + { + afloat[0] = -afloat[0]; + } + + if (flag1) + { + afloat[1] = -afloat[1]; + } + + if (flag2) + { + afloat[2] = -afloat[2]; + } + + float[] afloat1 = Json.parseFloatArray(p_parseModelRenderer_0_.get("rotate"), 3, new float[3]); + + for (int i = 0; i < afloat1.length; ++i) + { + afloat1[i] = afloat1[i] / 180.0F * (float)Math.PI; + } + + if (flag) + { + afloat1[0] = -afloat1[0]; + } + + if (flag1) + { + afloat1[1] = -afloat1[1]; + } + + if (flag2) + { + afloat1[2] = -afloat1[2]; + } + + modelrenderer.setRotationPoint(afloat[0], afloat[1], afloat[2]); + modelrenderer.rotateAngleX = afloat1[0]; + modelrenderer.rotateAngleY = afloat1[1]; + modelrenderer.rotateAngleZ = afloat1[2]; + String s1 = Json.getString(p_parseModelRenderer_0_, "mirrorTexture", "").toLowerCase(); + boolean flag3 = s1.contains("u"); + boolean flag4 = s1.contains("v"); + + if (flag3) + { + modelrenderer.mirror = true; + } + + if (flag4) + { + modelrenderer.mirrorV = true; + } + + JsonArray jsonarray = p_parseModelRenderer_0_.getAsJsonArray("boxes"); + + if (jsonarray != null) + { + for (int j = 0; j < jsonarray.size(); ++j) + { + JsonObject jsonobject = jsonarray.get(j).getAsJsonObject(); + int[] aint = Json.parseIntArray(jsonobject.get("textureOffset"), 2); + + if (aint == null) + { + throw new JsonParseException("Texture offset not specified"); + } + + float[] afloat2 = Json.parseFloatArray(jsonobject.get("coordinates"), 6); + + if (afloat2 == null) + { + throw new JsonParseException("Coordinates not specified"); + } + + if (flag) + { + afloat2[0] = -afloat2[0] - afloat2[3]; + } + + if (flag1) + { + afloat2[1] = -afloat2[1] - afloat2[4]; + } + + if (flag2) + { + afloat2[2] = -afloat2[2] - afloat2[5]; + } + + float f = Json.getFloat(jsonobject, "sizeAdd", 0.0F); + modelrenderer.setTextureOffset(aint[0], aint[1]); + modelrenderer.addBox(afloat2[0], afloat2[1], afloat2[2], (int)afloat2[3], (int)afloat2[4], (int)afloat2[5], f); + } + } + + JsonArray jsonarray1 = p_parseModelRenderer_0_.getAsJsonArray("sprites"); + + if (jsonarray1 != null) + { + for (int k = 0; k < jsonarray1.size(); ++k) + { + JsonObject jsonobject2 = jsonarray1.get(k).getAsJsonObject(); + int[] aint1 = Json.parseIntArray(jsonobject2.get("textureOffset"), 2); + + if (aint1 == null) + { + throw new JsonParseException("Texture offset not specified"); + } + + float[] afloat3 = Json.parseFloatArray(jsonobject2.get("coordinates"), 6); + + if (afloat3 == null) + { + throw new JsonParseException("Coordinates not specified"); + } + + if (flag) + { + afloat3[0] = -afloat3[0] - afloat3[3]; + } + + if (flag1) + { + afloat3[1] = -afloat3[1] - afloat3[4]; + } + + if (flag2) + { + afloat3[2] = -afloat3[2] - afloat3[5]; + } + + float f1 = Json.getFloat(jsonobject2, "sizeAdd", 0.0F); + modelrenderer.setTextureOffset(aint1[0], aint1[1]); + modelrenderer.addSprite(afloat3[0], afloat3[1], afloat3[2], (int)afloat3[3], (int)afloat3[4], (int)afloat3[5], f1); + } + } + + JsonObject jsonobject1 = (JsonObject)p_parseModelRenderer_0_.get("submodel"); + + if (jsonobject1 != null) + { + ModelRenderer modelrenderer1 = parseModelRenderer(jsonobject1, p_parseModelRenderer_1_); + modelrenderer.addChild(modelrenderer1); + } + + JsonArray jsonarray2 = (JsonArray)p_parseModelRenderer_0_.get("submodels"); + + if (jsonarray2 != null) + { + for (int l = 0; l < jsonarray2.size(); ++l) + { + JsonObject jsonobject3 = (JsonObject)jsonarray2.get(l); + ModelRenderer modelrenderer2 = parseModelRenderer(jsonobject3, p_parseModelRenderer_1_); + modelrenderer.addChild(modelrenderer2); + } + } + + return modelrenderer; + } +} diff --git a/src/minecraft/optifine/PlayerItemRenderer.java b/src/minecraft/optifine/PlayerItemRenderer.java new file mode 100644 index 0000000..1a33d9c --- /dev/null +++ b/src/minecraft/optifine/PlayerItemRenderer.java @@ -0,0 +1,35 @@ +package optifine; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; + +public class PlayerItemRenderer +{ + private int attachTo = 0; + private float scaleFactor = 0.0F; + private ModelRenderer modelRenderer = null; + + public PlayerItemRenderer(int p_i75_1_, float p_i75_2_, ModelRenderer p_i75_3_) + { + this.attachTo = p_i75_1_; + this.scaleFactor = p_i75_2_; + this.modelRenderer = p_i75_3_; + } + + public ModelRenderer getModelRenderer() + { + return this.modelRenderer; + } + + public void render(ModelBiped p_render_1_, float p_render_2_) + { + ModelRenderer modelrenderer = PlayerItemModel.getAttachModel(p_render_1_, this.attachTo); + + if (modelrenderer != null) + { + modelrenderer.postRender(p_render_2_); + } + + this.modelRenderer.render(p_render_2_ * this.scaleFactor); + } +} diff --git a/src/minecraft/optifine/PlayerItemsLayer.java b/src/minecraft/optifine/PlayerItemsLayer.java new file mode 100644 index 0000000..c2a95dd --- /dev/null +++ b/src/minecraft/optifine/PlayerItemsLayer.java @@ -0,0 +1,70 @@ +package optifine; + +import java.util.Map; +import java.util.Set; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderPlayer; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.entity.EntityLivingBase; + +public class PlayerItemsLayer implements LayerRenderer +{ + private RenderPlayer renderPlayer = null; + + public PlayerItemsLayer(RenderPlayer p_i76_1_) + { + this.renderPlayer = p_i76_1_; + } + + public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) + { + this.renderEquippedItems(entitylivingbaseIn, scale, partialTicks); + } + + protected void renderEquippedItems(EntityLivingBase p_renderEquippedItems_1_, float p_renderEquippedItems_2_, float p_renderEquippedItems_3_) + { + if (Config.isShowCapes()) + { + if (p_renderEquippedItems_1_ instanceof AbstractClientPlayer) + { + AbstractClientPlayer abstractclientplayer = (AbstractClientPlayer)p_renderEquippedItems_1_; + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableRescaleNormal(); + GlStateManager.enableCull(); + ModelBiped modelbiped = (ModelBiped)this.renderPlayer.getMainModel(); + PlayerConfigurations.renderPlayerItems(modelbiped, abstractclientplayer, p_renderEquippedItems_2_, p_renderEquippedItems_3_); + GlStateManager.disableCull(); + } + } + } + + public boolean shouldCombineTextures() + { + return false; + } + + public static void register(Map p_register_0_) + { + Set set = p_register_0_.keySet(); + boolean flag = false; + + for (Object object : set) + { + Object object1 = p_register_0_.get(object); + + if (object1 instanceof RenderPlayer) + { + RenderPlayer renderplayer = (RenderPlayer)object1; + renderplayer.addLayer(new PlayerItemsLayer(renderplayer)); + flag = true; + } + } + + if (!flag) + { + Config.warn("PlayerItemsLayer not registered"); + } + } +} diff --git a/src/minecraft/optifine/PropertiesOrdered.java b/src/minecraft/optifine/PropertiesOrdered.java new file mode 100644 index 0000000..d9f561d --- /dev/null +++ b/src/minecraft/optifine/PropertiesOrdered.java @@ -0,0 +1,30 @@ +package optifine; + +import java.util.Collections; +import java.util.Enumeration; +import java.util.LinkedHashSet; +import java.util.Properties; +import java.util.Set; + +public class PropertiesOrdered extends Properties +{ + private Set keysOrdered = new LinkedHashSet(); + + public synchronized Object put(Object p_put_1_, Object p_put_2_) + { + this.keysOrdered.add(p_put_1_); + return super.put(p_put_1_, p_put_2_); + } + + public Set keySet() + { + Set set = super.keySet(); + this.keysOrdered.retainAll(set); + return Collections.unmodifiableSet(this.keysOrdered); + } + + public synchronized Enumeration keys() + { + return Collections.enumeration(this.keySet()); + } +} diff --git a/src/minecraft/optifine/RandomMobs.java b/src/minecraft/optifine/RandomMobs.java new file mode 100644 index 0000000..7fd344e --- /dev/null +++ b/src/minecraft/optifine/RandomMobs.java @@ -0,0 +1,420 @@ +package optifine; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Random; +import java.util.UUID; + +import animeware.util.render.AnimatedResourceLocation; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; + +public class RandomMobs +{ + private static Map locationProperties = new HashMap(); + private static RenderGlobal renderGlobal = null; + private static boolean initialized = false; + private static Random random = new Random(); + private static boolean working = false; + public static final String SUFFIX_PNG = ".png"; + public static final String SUFFIX_PROPERTIES = ".properties"; + public static final String PREFIX_TEXTURES_ENTITY = "textures/entity/"; + public static final String PREFIX_MCPATCHER_MOB = "mcpatcher/mob/"; + private static final String[] DEPENDANT_SUFFIXES = new String[] {"_armor", "_eyes", "_exploding", "_shooting", "_fur", "_eyes", "_invulnerable", "_angry", "_tame", "_collar"}; + + public static void entityLoaded(Entity p_entityLoaded_0_, World p_entityLoaded_1_) + { + if (p_entityLoaded_0_ instanceof EntityLiving) + { + if (p_entityLoaded_1_ != null) + { + EntityLiving entityliving = (EntityLiving)p_entityLoaded_0_; + entityliving.spawnPosition = entityliving.getPosition(); + entityliving.spawnBiome = p_entityLoaded_1_.getBiomeGenForCoords(entityliving.spawnPosition); + WorldServer worldserver = Config.getWorldServer(); + + if (worldserver != null) + { + Entity entity = worldserver.getEntityByID(p_entityLoaded_0_.getEntityId()); + + if (entity instanceof EntityLiving) + { + EntityLiving entityliving1 = (EntityLiving)entity; + UUID uuid = entityliving1.getUniqueID(); + long i = uuid.getLeastSignificantBits(); + int j = (int)(i & 2147483647L); + entityliving.randomMobsId = j; + } + } + } + } + } + + public static void worldChanged(World p_worldChanged_0_, World p_worldChanged_1_) + { + if (p_worldChanged_1_ != null) + { + List list = p_worldChanged_1_.getLoadedEntityList(); + + for (int i = 0; i < list.size(); ++i) + { + Entity entity = (Entity)list.get(i); + entityLoaded(entity, p_worldChanged_1_); + } + } + } + + public static ResourceLocation getTextureLocation(ResourceLocation p_getTextureLocation_0_) + { + if (working) + { + return p_getTextureLocation_0_; + } + else + { + ResourceLocation entity; + + try + { + working = true; + + if (!initialized) + { + initialize(); + } + + if (renderGlobal != null) + { + Entity entity1 = renderGlobal.renderedEntity; + + if (!(entity1 instanceof EntityLiving)) + { + ResourceLocation resourcelocation2 = p_getTextureLocation_0_; + return resourcelocation2; + } + + EntityLiving entityliving = (EntityLiving)entity1; + String s = p_getTextureLocation_0_.getResourcePath(); + + if (!s.startsWith("textures/entity/")) + { + ResourceLocation resourcelocation3 = p_getTextureLocation_0_; + return resourcelocation3; + } + + RandomMobsProperties randommobsproperties = getProperties(p_getTextureLocation_0_); + + if (randommobsproperties == null) + { + ResourceLocation resourcelocation4 = p_getTextureLocation_0_; + return resourcelocation4; + } + + ResourceLocation resourcelocation1 = randommobsproperties.getTextureLocation(p_getTextureLocation_0_, entityliving); + return resourcelocation1; + } + + entity = p_getTextureLocation_0_; + } + finally + { + working = false; + } + + return entity; + } + } + + + private static RandomMobsProperties getProperties(ResourceLocation p_getProperties_0_) + { + String s = p_getProperties_0_.getResourcePath(); + RandomMobsProperties randommobsproperties = (RandomMobsProperties)locationProperties.get(s); + + if (randommobsproperties == null) + { + randommobsproperties = makeProperties(p_getProperties_0_); + locationProperties.put(s, randommobsproperties); + } + + return randommobsproperties; + } + + private static RandomMobsProperties makeProperties(ResourceLocation p_makeProperties_0_) + { + String s = p_makeProperties_0_.getResourcePath(); + ResourceLocation resourcelocation = getPropertyLocation(p_makeProperties_0_); + + if (resourcelocation != null) + { + RandomMobsProperties randommobsproperties = parseProperties(resourcelocation, p_makeProperties_0_); + + if (randommobsproperties != null) + { + return randommobsproperties; + } + } + + ResourceLocation[] aresourcelocation = getTextureVariants(p_makeProperties_0_); + return new RandomMobsProperties(s, aresourcelocation); + } + + private static RandomMobsProperties parseProperties(ResourceLocation p_parseProperties_0_, ResourceLocation p_parseProperties_1_) + { + try + { + String s = p_parseProperties_0_.getResourcePath(); + Config.dbg("RandomMobs: " + p_parseProperties_1_.getResourcePath() + ", variants: " + s); + InputStream inputstream = Config.getResourceStream(p_parseProperties_0_); + + if (inputstream == null) + { + Config.warn("RandomMobs properties not found: " + s); + return null; + } + else + { + Properties properties = new Properties(); + properties.load(inputstream); + inputstream.close(); + RandomMobsProperties randommobsproperties = new RandomMobsProperties(properties, s, p_parseProperties_1_); + return !randommobsproperties.isValid(s) ? null : randommobsproperties; + } + } + catch (FileNotFoundException var6) + { + Config.warn("RandomMobs file not found: " + p_parseProperties_1_.getResourcePath()); + return null; + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + return null; + } + } + + private static ResourceLocation getPropertyLocation(ResourceLocation p_getPropertyLocation_0_) + { + ResourceLocation resourcelocation = getMcpatcherLocation(p_getPropertyLocation_0_); + + if (resourcelocation == null) + { + return null; + } + else + { + String s = resourcelocation.getResourceDomain(); + String s1 = resourcelocation.getResourcePath(); + String s2 = s1; + + if (s1.endsWith(".png")) + { + s2 = s1.substring(0, s1.length() - ".png".length()); + } + + String s3 = s2 + ".properties"; + ResourceLocation resourcelocation1 = new ResourceLocation(s, s3); + + if (Config.hasResource(resourcelocation1)) + { + return resourcelocation1; + } + else + { + String s4 = getParentPath(s2); + + if (s4 == null) + { + return null; + } + else + { + ResourceLocation resourcelocation2 = new ResourceLocation(s, s4 + ".properties"); + return Config.hasResource(resourcelocation2) ? resourcelocation2 : null; + } + } + } + } + + public static ResourceLocation getMcpatcherLocation(ResourceLocation p_getMcpatcherLocation_0_) + { + String s = p_getMcpatcherLocation_0_.getResourcePath(); + + if (!s.startsWith("textures/entity/")) + { + return null; + } + else + { + String s1 = "mcpatcher/mob/" + s.substring("textures/entity/".length()); + return new ResourceLocation(p_getMcpatcherLocation_0_.getResourceDomain(), s1); + } + } + + public static ResourceLocation getLocationIndexed(ResourceLocation p_getLocationIndexed_0_, int p_getLocationIndexed_1_) + { + if (p_getLocationIndexed_0_ == null) + { + return null; + } + else + { + String s = p_getLocationIndexed_0_.getResourcePath(); + int i = s.lastIndexOf(46); + + if (i < 0) + { + return null; + } + else + { + String s1 = s.substring(0, i); + String s2 = s.substring(i); + String s3 = s1 + p_getLocationIndexed_1_ + s2; + ResourceLocation resourcelocation = new ResourceLocation(p_getLocationIndexed_0_.getResourceDomain(), s3); + return resourcelocation; + } + } + } + + private static String getParentPath(String p_getParentPath_0_) + { + for (int i = 0; i < DEPENDANT_SUFFIXES.length; ++i) + { + String s = DEPENDANT_SUFFIXES[i]; + + if (p_getParentPath_0_.endsWith(s)) + { + String s1 = p_getParentPath_0_.substring(0, p_getParentPath_0_.length() - s.length()); + return s1; + } + } + + return null; + } + + private static ResourceLocation[] getTextureVariants(ResourceLocation p_getTextureVariants_0_) + { + List list = new ArrayList(); + list.add(p_getTextureVariants_0_); + ResourceLocation resourcelocation = getMcpatcherLocation(p_getTextureVariants_0_); + + if (resourcelocation == null) + { + return null; + } + else + { + for (int i = 1; i < ((List)list).size() + 10; ++i) + { + int j = i + 1; + ResourceLocation resourcelocation1 = getLocationIndexed(resourcelocation, j); + + if (Config.hasResource(resourcelocation1)) + { + list.add(resourcelocation1); + } + } + + if (list.size() <= 1) + { + return null; + } + else + { + ResourceLocation[] aresourcelocation = (ResourceLocation[])((ResourceLocation[])list.toArray(new ResourceLocation[list.size()])); + Config.dbg("RandomMobs: " + p_getTextureVariants_0_.getResourcePath() + ", variants: " + aresourcelocation.length); + return aresourcelocation; + } + } + } + + public static void resetTextures() + { + locationProperties.clear(); + + if (Config.isRandomMobs()) + { + initialize(); + } + } + + private static void initialize() + { + renderGlobal = Config.getRenderGlobal(); + + if (renderGlobal != null) + { + initialized = true; + List list = new ArrayList(); + list.add("bat"); + list.add("blaze"); + list.add("cat/black"); + list.add("cat/ocelot"); + list.add("cat/red"); + list.add("cat/siamese"); + list.add("chicken"); + list.add("cow/cow"); + list.add("cow/mooshroom"); + list.add("creeper/creeper"); + list.add("enderman/enderman"); + list.add("enderman/enderman_eyes"); + list.add("ghast/ghast"); + list.add("ghast/ghast_shooting"); + list.add("iron_golem"); + list.add("pig/pig"); + list.add("sheep/sheep"); + list.add("sheep/sheep_fur"); + list.add("silverfish"); + list.add("skeleton/skeleton"); + list.add("skeleton/wither_skeleton"); + list.add("slime/slime"); + list.add("slime/magmacube"); + list.add("snowman"); + list.add("spider/cave_spider"); + list.add("spider/spider"); + list.add("spider_eyes"); + list.add("squid"); + list.add("villager/villager"); + list.add("villager/butcher"); + list.add("villager/farmer"); + list.add("villager/librarian"); + list.add("villager/priest"); + list.add("villager/smith"); + list.add("wither/wither"); + list.add("wither/wither_armor"); + list.add("wither/wither_invulnerable"); + list.add("wolf/wolf"); + list.add("wolf/wolf_angry"); + list.add("wolf/wolf_collar"); + list.add("wolf/wolf_tame"); + list.add("zombie_pigman"); + list.add("zombie/zombie"); + list.add("zombie/zombie_villager"); + + for (int i = 0; i < ((List)list).size(); ++i) + { + String s = (String)list.get(i); + String s1 = "textures/entity/" + s + ".png"; + ResourceLocation resourcelocation = new ResourceLocation(s1); + + if (!Config.hasResource(resourcelocation)) + { + Config.warn("Not found: " + resourcelocation); + } + + getProperties(resourcelocation); + } + } + } +} diff --git a/src/minecraft/optifine/RandomMobsProperties.java b/src/minecraft/optifine/RandomMobsProperties.java new file mode 100644 index 0000000..56b3727 --- /dev/null +++ b/src/minecraft/optifine/RandomMobsProperties.java @@ -0,0 +1,181 @@ +package optifine; + +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import net.minecraft.entity.EntityLiving; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.biome.BiomeGenBase; + +public class RandomMobsProperties +{ + public String name = null; + public String basePath = null; + public ResourceLocation[] resourceLocations = null; + public RandomMobsRule[] rules = null; + + public RandomMobsProperties(String p_i77_1_, ResourceLocation[] p_i77_2_) + { + ConnectedParser connectedparser = new ConnectedParser("RandomMobs"); + this.name = connectedparser.parseName(p_i77_1_); + this.basePath = connectedparser.parseBasePath(p_i77_1_); + this.resourceLocations = p_i77_2_; + } + + public RandomMobsProperties(Properties p_i78_1_, String p_i78_2_, ResourceLocation p_i78_3_) + { + ConnectedParser connectedparser = new ConnectedParser("RandomMobs"); + this.name = connectedparser.parseName(p_i78_2_); + this.basePath = connectedparser.parseBasePath(p_i78_2_); + this.rules = this.parseRules(p_i78_1_, p_i78_3_, connectedparser); + } + + public ResourceLocation getTextureLocation(ResourceLocation p_getTextureLocation_1_, EntityLiving p_getTextureLocation_2_) + { + if (this.rules != null) + { + for (int i = 0; i < this.rules.length; ++i) + { + RandomMobsRule randommobsrule = this.rules[i]; + + if (randommobsrule.matches(p_getTextureLocation_2_)) + { + return randommobsrule.getTextureLocation(p_getTextureLocation_1_, p_getTextureLocation_2_.randomMobsId); + } + } + } + + if (this.resourceLocations != null) + { + int j = p_getTextureLocation_2_.randomMobsId; + int k = j % this.resourceLocations.length; + return this.resourceLocations[k]; + } + else + { + return p_getTextureLocation_1_; + } + } + + private RandomMobsRule[] parseRules(Properties p_parseRules_1_, ResourceLocation p_parseRules_2_, ConnectedParser p_parseRules_3_) + { + List list = new ArrayList(); + int i = p_parseRules_1_.size(); + + for (int j = 0; j < i; ++j) + { + int k = j + 1; + String s = p_parseRules_1_.getProperty("skins." + k); + + if (s != null) + { + int[] aint = p_parseRules_3_.parseIntList(s); + int[] aint1 = p_parseRules_3_.parseIntList(p_parseRules_1_.getProperty("weights." + k)); + BiomeGenBase[] abiomegenbase = p_parseRules_3_.parseBiomes(p_parseRules_1_.getProperty("biomes." + k)); + RangeListInt rangelistint = p_parseRules_3_.parseRangeListInt(p_parseRules_1_.getProperty("heights." + k)); + + if (rangelistint == null) + { + rangelistint = this.parseMinMaxHeight(p_parseRules_1_, k); + } + + RandomMobsRule randommobsrule = new RandomMobsRule(p_parseRules_2_, aint, aint1, abiomegenbase, rangelistint); + list.add(randommobsrule); + } + } + + RandomMobsRule[] arandommobsrule = (RandomMobsRule[])((RandomMobsRule[])list.toArray(new RandomMobsRule[list.size()])); + return arandommobsrule; + } + + private RangeListInt parseMinMaxHeight(Properties p_parseMinMaxHeight_1_, int p_parseMinMaxHeight_2_) + { + String s = p_parseMinMaxHeight_1_.getProperty("minHeight." + p_parseMinMaxHeight_2_); + String s1 = p_parseMinMaxHeight_1_.getProperty("maxHeight." + p_parseMinMaxHeight_2_); + + if (s == null && s1 == null) + { + return null; + } + else + { + int i = 0; + + if (s != null) + { + i = Config.parseInt(s, -1); + + if (i < 0) + { + Config.warn("Invalid minHeight: " + s); + return null; + } + } + + int j = 256; + + if (s1 != null) + { + j = Config.parseInt(s1, -1); + + if (j < 0) + { + Config.warn("Invalid maxHeight: " + s1); + return null; + } + } + + if (j < 0) + { + Config.warn("Invalid minHeight, maxHeight: " + s + ", " + s1); + return null; + } + else + { + RangeListInt rangelistint = new RangeListInt(); + rangelistint.addRange(new RangeInt(i, j)); + return rangelistint; + } + } + } + + public boolean isValid(String p_isValid_1_) + { + if (this.resourceLocations == null && this.rules == null) + { + Config.warn("No skins specified: " + p_isValid_1_); + return false; + } + else + { + if (this.rules != null) + { + for (int i = 0; i < this.rules.length; ++i) + { + RandomMobsRule randommobsrule = this.rules[i]; + + if (!randommobsrule.isValid(p_isValid_1_)) + { + return false; + } + } + } + + if (this.resourceLocations != null) + { + for (int j = 0; j < this.resourceLocations.length; ++j) + { + ResourceLocation resourcelocation = this.resourceLocations[j]; + + if (!Config.hasResource(resourcelocation)) + { + Config.warn("Texture not found: " + resourcelocation.getResourcePath()); + return false; + } + } + } + + return true; + } + } +} diff --git a/src/minecraft/optifine/RandomMobsRule.java b/src/minecraft/optifine/RandomMobsRule.java new file mode 100644 index 0000000..8e8ab65 --- /dev/null +++ b/src/minecraft/optifine/RandomMobsRule.java @@ -0,0 +1,149 @@ +package optifine; + +import net.minecraft.entity.EntityLiving; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.biome.BiomeGenBase; + +public class RandomMobsRule +{ + private ResourceLocation baseResLoc = null; + private int[] skins = null; + private ResourceLocation[] resourceLocations = null; + private int[] weights = null; + private BiomeGenBase[] biomes = null; + private RangeListInt heights = null; + public int[] sumWeights = null; + public int sumAllWeights = 1; + + public RandomMobsRule(ResourceLocation p_i79_1_, int[] p_i79_2_, int[] p_i79_3_, BiomeGenBase[] p_i79_4_, RangeListInt p_i79_5_) + { + this.baseResLoc = p_i79_1_; + this.skins = p_i79_2_; + this.weights = p_i79_3_; + this.biomes = p_i79_4_; + this.heights = p_i79_5_; + } + + public boolean isValid(String p_isValid_1_) + { + this.resourceLocations = new ResourceLocation[this.skins.length]; + ResourceLocation resourcelocation = RandomMobs.getMcpatcherLocation(this.baseResLoc); + + if (resourcelocation == null) + { + Config.warn("Invalid path: " + this.baseResLoc.getResourcePath()); + return false; + } + else + { + for (int i = 0; i < this.resourceLocations.length; ++i) + { + int j = this.skins[i]; + + if (j <= 1) + { + this.resourceLocations[i] = this.baseResLoc; + } + else + { + ResourceLocation resourcelocation1 = RandomMobs.getLocationIndexed(resourcelocation, j); + + if (resourcelocation1 == null) + { + Config.warn("Invalid path: " + this.baseResLoc.getResourcePath()); + return false; + } + + if (!Config.hasResource(resourcelocation1)) + { + Config.warn("Texture not found: " + resourcelocation1.getResourcePath()); + return false; + } + + this.resourceLocations[i] = resourcelocation1; + } + } + + if (this.weights != null) + { + if (this.weights.length > this.resourceLocations.length) + { + Config.warn("More weights defined than skins, trimming weights: " + p_isValid_1_); + int[] aint = new int[this.resourceLocations.length]; + System.arraycopy(this.weights, 0, aint, 0, aint.length); + this.weights = aint; + } + + if (this.weights.length < this.resourceLocations.length) + { + Config.warn("Less weights defined than skins, expanding weights: " + p_isValid_1_); + int[] aint1 = new int[this.resourceLocations.length]; + System.arraycopy(this.weights, 0, aint1, 0, this.weights.length); + int l = MathUtils.getAverage(this.weights); + + for (int j1 = this.weights.length; j1 < aint1.length; ++j1) + { + aint1[j1] = l; + } + + this.weights = aint1; + } + + this.sumWeights = new int[this.weights.length]; + int k = 0; + + for (int i1 = 0; i1 < this.weights.length; ++i1) + { + if (this.weights[i1] < 0) + { + Config.warn("Invalid weight: " + this.weights[i1]); + return false; + } + + k += this.weights[i1]; + this.sumWeights[i1] = k; + } + + this.sumAllWeights = k; + + if (this.sumAllWeights <= 0) + { + Config.warn("Invalid sum of all weights: " + k); + this.sumAllWeights = 1; + } + } + + return true; + } + } + + public boolean matches(EntityLiving p_matches_1_) + { + return !Matches.biome(p_matches_1_.spawnBiome, this.biomes) ? false : (this.heights != null && p_matches_1_.spawnPosition != null ? this.heights.isInRange(p_matches_1_.spawnPosition.getY()) : true); + } + + public ResourceLocation getTextureLocation(ResourceLocation p_getTextureLocation_1_, int p_getTextureLocation_2_) + { + int i = 0; + + if (this.weights == null) + { + i = p_getTextureLocation_2_ % this.resourceLocations.length; + } + else + { + int j = p_getTextureLocation_2_ % this.sumAllWeights; + + for (int k = 0; k < this.sumWeights.length; ++k) + { + if (this.sumWeights[k] > j) + { + i = k; + break; + } + } + } + + return this.resourceLocations[i]; + } +} diff --git a/src/minecraft/optifine/RangeInt.java b/src/minecraft/optifine/RangeInt.java new file mode 100644 index 0000000..e07292d --- /dev/null +++ b/src/minecraft/optifine/RangeInt.java @@ -0,0 +1,33 @@ +package optifine; + +public class RangeInt +{ + private int min; + private int max; + + public RangeInt(int p_i80_1_, int p_i80_2_) + { + this.min = Math.min(p_i80_1_, p_i80_2_); + this.max = Math.max(p_i80_1_, p_i80_2_); + } + + public boolean isInRange(int p_isInRange_1_) + { + return p_isInRange_1_ < this.min ? false : p_isInRange_1_ <= this.max; + } + + public int getMin() + { + return this.min; + } + + public int getMax() + { + return this.max; + } + + public String toString() + { + return "min: " + this.min + ", max: " + this.max; + } +} diff --git a/src/minecraft/optifine/RangeListInt.java b/src/minecraft/optifine/RangeListInt.java new file mode 100644 index 0000000..06c9fdd --- /dev/null +++ b/src/minecraft/optifine/RangeListInt.java @@ -0,0 +1,57 @@ +package optifine; + +public class RangeListInt +{ + private RangeInt[] ranges = new RangeInt[0]; + + public void addRange(RangeInt p_addRange_1_) + { + this.ranges = (RangeInt[])((RangeInt[])Config.addObjectToArray(this.ranges, p_addRange_1_)); + } + + public boolean isInRange(int p_isInRange_1_) + { + for (int i = 0; i < this.ranges.length; ++i) + { + RangeInt rangeint = this.ranges[i]; + + if (rangeint.isInRange(p_isInRange_1_)) + { + return true; + } + } + + return false; + } + + public int getCountRanges() + { + return this.ranges.length; + } + + public RangeInt getRange(int p_getRange_1_) + { + return this.ranges[p_getRange_1_]; + } + + public String toString() + { + StringBuffer stringbuffer = new StringBuffer(); + stringbuffer.append("["); + + for (int i = 0; i < this.ranges.length; ++i) + { + RangeInt rangeint = this.ranges[i]; + + if (i > 0) + { + stringbuffer.append(", "); + } + + stringbuffer.append(rangeint.toString()); + } + + stringbuffer.append("]"); + return stringbuffer.toString(); + } +} diff --git a/src/minecraft/optifine/Reflector.java b/src/minecraft/optifine/Reflector.java new file mode 100644 index 0000000..8b80e32 --- /dev/null +++ b/src/minecraft/optifine/Reflector.java @@ -0,0 +1,976 @@ +package optifine; + +import com.google.common.base.Optional; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import javax.vecmath.Matrix4f; +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiMainMenu; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.model.ModelBanner; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelBat; +import net.minecraft.client.model.ModelBlaze; +import net.minecraft.client.model.ModelBook; +import net.minecraft.client.model.ModelChest; +import net.minecraft.client.model.ModelDragon; +import net.minecraft.client.model.ModelEnderCrystal; +import net.minecraft.client.model.ModelEnderMite; +import net.minecraft.client.model.ModelGhast; +import net.minecraft.client.model.ModelGuardian; +import net.minecraft.client.model.ModelHorse; +import net.minecraft.client.model.ModelHumanoidHead; +import net.minecraft.client.model.ModelLeashKnot; +import net.minecraft.client.model.ModelMagmaCube; +import net.minecraft.client.model.ModelOcelot; +import net.minecraft.client.model.ModelRabbit; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.model.ModelSign; +import net.minecraft.client.model.ModelSilverfish; +import net.minecraft.client.model.ModelSkeletonHead; +import net.minecraft.client.model.ModelSlime; +import net.minecraft.client.model.ModelSquid; +import net.minecraft.client.model.ModelWitch; +import net.minecraft.client.model.ModelWither; +import net.minecraft.client.model.ModelWolf; +import net.minecraft.client.multiplayer.ChunkProviderClient; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.entity.RenderBoat; +import net.minecraft.client.renderer.entity.RenderLeashKnot; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.RenderMinecart; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.client.renderer.tileentity.RenderEnderCrystal; +import net.minecraft.client.renderer.tileentity.RenderItemFrame; +import net.minecraft.client.renderer.tileentity.RenderWitherSkull; +import net.minecraft.client.renderer.tileentity.TileEntityBannerRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityChestRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityEnchantmentTableRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityEnderChestRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.client.renderer.tileentity.TileEntitySignRenderer; +import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.client.resources.DefaultResourcePack; +import net.minecraft.client.resources.ResourcePackRepository; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.resources.model.ModelRotation; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemRecord; +import net.minecraft.potion.PotionEffect; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.LongHashMap; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.common.property.IUnlistedProperty; + +public class Reflector +{ + private static boolean logForge = logEntry("*** Reflector Forge ***"); + public static ReflectorClass Attributes = new ReflectorClass("net.minecraftforge.client.model.Attributes"); + public static ReflectorField Attributes_DEFAULT_BAKED_FORMAT = new ReflectorField(Attributes, "DEFAULT_BAKED_FORMAT"); + public static ReflectorClass BetterFoliageClient = new ReflectorClass("mods.betterfoliage.client.BetterFoliageClient"); + public static ReflectorClass BlamingTransformer = new ReflectorClass("net.minecraftforge.fml.common.asm.transformers.BlamingTransformer"); + public static ReflectorMethod BlamingTransformer_onCrash = new ReflectorMethod(BlamingTransformer, "onCrash"); + public static ReflectorClass ChunkWatchEvent_UnWatch = new ReflectorClass("net.minecraftforge.event.world.ChunkWatchEvent$UnWatch"); + public static ReflectorConstructor ChunkWatchEvent_UnWatch_Constructor = new ReflectorConstructor(ChunkWatchEvent_UnWatch, new Class[] {ChunkCoordIntPair.class, EntityPlayerMP.class}); + public static ReflectorClass CoreModManager = new ReflectorClass("net.minecraftforge.fml.relauncher.CoreModManager"); + public static ReflectorMethod CoreModManager_onCrash = new ReflectorMethod(CoreModManager, "onCrash"); + public static ReflectorClass DimensionManager = new ReflectorClass("net.minecraftforge.common.DimensionManager"); + public static ReflectorMethod DimensionManager_createProviderFor = new ReflectorMethod(DimensionManager, "createProviderFor"); + public static ReflectorMethod DimensionManager_getStaticDimensionIDs = new ReflectorMethod(DimensionManager, "getStaticDimensionIDs"); + public static ReflectorClass DrawScreenEvent_Pre = new ReflectorClass("net.minecraftforge.client.event.GuiScreenEvent$DrawScreenEvent$Pre"); + public static ReflectorConstructor DrawScreenEvent_Pre_Constructor = new ReflectorConstructor(DrawScreenEvent_Pre, new Class[] {GuiScreen.class, Integer.TYPE, Integer.TYPE, Float.TYPE}); + public static ReflectorClass DrawScreenEvent_Post = new ReflectorClass("net.minecraftforge.client.event.GuiScreenEvent$DrawScreenEvent$Post"); + public static ReflectorConstructor DrawScreenEvent_Post_Constructor = new ReflectorConstructor(DrawScreenEvent_Post, new Class[] {GuiScreen.class, Integer.TYPE, Integer.TYPE, Float.TYPE}); + public static ReflectorClass EntityViewRenderEvent_CameraSetup = new ReflectorClass("net.minecraftforge.client.event.EntityViewRenderEvent$CameraSetup"); + public static ReflectorConstructor EntityViewRenderEvent_CameraSetup_Constructor = new ReflectorConstructor(EntityViewRenderEvent_CameraSetup, new Class[] {EntityRenderer.class, Entity.class, Block.class, Double.TYPE, Float.TYPE, Float.TYPE, Float.TYPE}); + public static ReflectorField EntityViewRenderEvent_CameraSetup_yaw = new ReflectorField(EntityViewRenderEvent_CameraSetup, "yaw"); + public static ReflectorField EntityViewRenderEvent_CameraSetup_pitch = new ReflectorField(EntityViewRenderEvent_CameraSetup, "pitch"); + public static ReflectorField EntityViewRenderEvent_CameraSetup_roll = new ReflectorField(EntityViewRenderEvent_CameraSetup, "roll"); + public static ReflectorClass EntityViewRenderEvent_FogColors = new ReflectorClass("net.minecraftforge.client.event.EntityViewRenderEvent$FogColors"); + public static ReflectorConstructor EntityViewRenderEvent_FogColors_Constructor = new ReflectorConstructor(EntityViewRenderEvent_FogColors, new Class[] {EntityRenderer.class, Entity.class, Block.class, Double.TYPE, Float.TYPE, Float.TYPE, Float.TYPE}); + public static ReflectorField EntityViewRenderEvent_FogColors_red = new ReflectorField(EntityViewRenderEvent_FogColors, "red"); + public static ReflectorField EntityViewRenderEvent_FogColors_green = new ReflectorField(EntityViewRenderEvent_FogColors, "green"); + public static ReflectorField EntityViewRenderEvent_FogColors_blue = new ReflectorField(EntityViewRenderEvent_FogColors, "blue"); + public static ReflectorClass Event = new ReflectorClass("net.minecraftforge.fml.common.eventhandler.Event"); + public static ReflectorMethod Event_isCanceled = new ReflectorMethod(Event, "isCanceled"); + public static ReflectorClass EventBus = new ReflectorClass("net.minecraftforge.fml.common.eventhandler.EventBus"); + public static ReflectorMethod EventBus_post = new ReflectorMethod(EventBus, "post"); + public static ReflectorClass Event_Result = new ReflectorClass("net.minecraftforge.fml.common.eventhandler.Event$Result"); + public static ReflectorField Event_Result_DENY = new ReflectorField(Event_Result, "DENY"); + public static ReflectorField Event_Result_ALLOW = new ReflectorField(Event_Result, "ALLOW"); + public static ReflectorField Event_Result_DEFAULT = new ReflectorField(Event_Result, "DEFAULT"); + public static ReflectorClass ExtendedBlockState = new ReflectorClass("net.minecraftforge.common.property.ExtendedBlockState"); + public static ReflectorConstructor ExtendedBlockState_Constructor = new ReflectorConstructor(ExtendedBlockState, new Class[] {Block.class, IProperty[].class, IUnlistedProperty[].class}); + public static ReflectorClass FMLClientHandler = new ReflectorClass("net.minecraftforge.fml.client.FMLClientHandler"); + public static ReflectorMethod FMLClientHandler_instance = new ReflectorMethod(FMLClientHandler, "instance"); + public static ReflectorMethod FMLClientHandler_isLoading = new ReflectorMethod(FMLClientHandler, "isLoading"); + public static ReflectorMethod FMLClientHandler_trackBrokenTexture = new ReflectorMethod(FMLClientHandler, "trackBrokenTexture"); + public static ReflectorMethod FMLClientHandler_trackMissingTexture = new ReflectorMethod(FMLClientHandler, "trackMissingTexture"); + public static ReflectorClass FMLCommonHandler = new ReflectorClass("net.minecraftforge.fml.common.FMLCommonHandler"); + public static ReflectorMethod FMLCommonHandler_callFuture = new ReflectorMethod(FMLCommonHandler, "callFuture"); + public static ReflectorMethod FMLCommonHandler_enhanceCrashReport = new ReflectorMethod(FMLCommonHandler, "enhanceCrashReport"); + public static ReflectorMethod FMLCommonHandler_getBrandings = new ReflectorMethod(FMLCommonHandler, "getBrandings"); + public static ReflectorMethod FMLCommonHandler_handleServerAboutToStart = new ReflectorMethod(FMLCommonHandler, "handleServerAboutToStart"); + public static ReflectorMethod FMLCommonHandler_handleServerStarting = new ReflectorMethod(FMLCommonHandler, "handleServerStarting"); + public static ReflectorMethod FMLCommonHandler_instance = new ReflectorMethod(FMLCommonHandler, "instance"); + public static ReflectorClass ForgeBiome = new ReflectorClass(BiomeGenBase.class); + public static ReflectorMethod ForgeBiome_getWaterColorMultiplier = new ReflectorMethod(ForgeBiome, "getWaterColorMultiplier"); + public static ReflectorClass ForgeBlock = new ReflectorClass(Block.class); + public static ReflectorMethod ForgeBlock_addDestroyEffects = new ReflectorMethod(ForgeBlock, "addDestroyEffects"); + public static ReflectorMethod ForgeBlock_addHitEffects = new ReflectorMethod(ForgeBlock, "addHitEffects"); + public static ReflectorMethod ForgeBlock_canCreatureSpawn = new ReflectorMethod(ForgeBlock, "canCreatureSpawn"); + public static ReflectorMethod ForgeBlock_canRenderInLayer = new ReflectorMethod(ForgeBlock, "canRenderInLayer", new Class[] {EnumWorldBlockLayer.class}); + public static ReflectorMethod ForgeBlock_doesSideBlockRendering = new ReflectorMethod(ForgeBlock, "doesSideBlockRendering"); + public static ReflectorMethod ForgeBlock_getBedDirection = new ReflectorMethod(ForgeBlock, "getBedDirection"); + public static ReflectorMethod ForgeBlock_getExtendedState = new ReflectorMethod(ForgeBlock, "getExtendedState"); + public static ReflectorMethod ForgeBlock_getLightOpacity = new ReflectorMethod(ForgeBlock, "getLightOpacity"); + public static ReflectorMethod ForgeBlock_getLightValue = new ReflectorMethod(ForgeBlock, "getLightValue"); + public static ReflectorMethod ForgeBlock_hasTileEntity = new ReflectorMethod(ForgeBlock, "hasTileEntity", new Class[] {IBlockState.class}); + public static ReflectorMethod ForgeBlock_isAir = new ReflectorMethod(ForgeBlock, "isAir"); + public static ReflectorMethod ForgeBlock_isBed = new ReflectorMethod(ForgeBlock, "isBed"); + public static ReflectorMethod ForgeBlock_isBedFoot = new ReflectorMethod(ForgeBlock, "isBedFoot"); + public static ReflectorMethod ForgeBlock_isSideSolid = new ReflectorMethod(ForgeBlock, "isSideSolid"); + public static ReflectorClass ForgeEntity = new ReflectorClass(Entity.class); + public static ReflectorMethod ForgeEntity_canRiderInteract = new ReflectorMethod(ForgeEntity, "canRiderInteract"); + public static ReflectorField ForgeEntity_captureDrops = new ReflectorField(ForgeEntity, "captureDrops"); + public static ReflectorField ForgeEntity_capturedDrops = new ReflectorField(ForgeEntity, "capturedDrops"); + public static ReflectorMethod ForgeEntity_shouldRenderInPass = new ReflectorMethod(ForgeEntity, "shouldRenderInPass"); + public static ReflectorMethod ForgeEntity_shouldRiderSit = new ReflectorMethod(ForgeEntity, "shouldRiderSit"); + public static ReflectorClass ForgeEventFactory = new ReflectorClass("net.minecraftforge.event.ForgeEventFactory"); + public static ReflectorMethod ForgeEventFactory_canEntityDespawn = new ReflectorMethod(ForgeEventFactory, "canEntityDespawn"); + public static ReflectorMethod ForgeEventFactory_canEntitySpawn = new ReflectorMethod(ForgeEventFactory, "canEntitySpawn"); + public static ReflectorMethod ForgeEventFactory_renderBlockOverlay = new ReflectorMethod(ForgeEventFactory, "renderBlockOverlay"); + public static ReflectorMethod ForgeEventFactory_renderFireOverlay = new ReflectorMethod(ForgeEventFactory, "renderFireOverlay"); + public static ReflectorMethod ForgeEventFactory_renderWaterOverlay = new ReflectorMethod(ForgeEventFactory, "renderWaterOverlay"); + public static ReflectorClass ForgeHooks = new ReflectorClass("net.minecraftforge.common.ForgeHooks"); + public static ReflectorMethod ForgeHooks_onLivingAttack = new ReflectorMethod(ForgeHooks, "onLivingAttack"); + public static ReflectorMethod ForgeHooks_onLivingDeath = new ReflectorMethod(ForgeHooks, "onLivingDeath"); + public static ReflectorMethod ForgeHooks_onLivingDrops = new ReflectorMethod(ForgeHooks, "onLivingDrops"); + public static ReflectorMethod ForgeHooks_onLivingFall = new ReflectorMethod(ForgeHooks, "onLivingFall"); + public static ReflectorMethod ForgeHooks_onLivingHurt = new ReflectorMethod(ForgeHooks, "onLivingHurt"); + public static ReflectorMethod ForgeHooks_onLivingJump = new ReflectorMethod(ForgeHooks, "onLivingJump"); + public static ReflectorMethod ForgeHooks_onLivingSetAttackTarget = new ReflectorMethod(ForgeHooks, "onLivingSetAttackTarget"); + public static ReflectorMethod ForgeHooks_onLivingUpdate = new ReflectorMethod(ForgeHooks, "onLivingUpdate"); + public static ReflectorClass ForgeHooksClient = new ReflectorClass("net.minecraftforge.client.ForgeHooksClient"); + public static ReflectorMethod ForgeHooksClient_applyTransform = new ReflectorMethod(ForgeHooksClient, "applyTransform", new Class[] {Matrix4f.class, Optional.class}); + public static ReflectorMethod ForgeHooksClient_dispatchRenderLast = new ReflectorMethod(ForgeHooksClient, "dispatchRenderLast"); + public static ReflectorMethod ForgeHooksClient_drawScreen = new ReflectorMethod(ForgeHooksClient, "drawScreen"); + public static ReflectorMethod ForgeHooksClient_fillNormal = new ReflectorMethod(ForgeHooksClient, "fillNormal"); + public static ReflectorMethod ForgeHooksClient_handleCameraTransforms = new ReflectorMethod(ForgeHooksClient, "handleCameraTransforms"); + public static ReflectorMethod ForgeHooksClient_getArmorModel = new ReflectorMethod(ForgeHooksClient, "getArmorModel"); + public static ReflectorMethod ForgeHooksClient_getArmorTexture = new ReflectorMethod(ForgeHooksClient, "getArmorTexture"); + public static ReflectorMethod ForgeHooksClient_getFogDensity = new ReflectorMethod(ForgeHooksClient, "getFogDensity"); + public static ReflectorMethod ForgeHooksClient_getFOVModifier = new ReflectorMethod(ForgeHooksClient, "getFOVModifier"); + public static ReflectorMethod ForgeHooksClient_getMatrix = new ReflectorMethod(ForgeHooksClient, "getMatrix", new Class[] {ModelRotation.class}); + public static ReflectorMethod ForgeHooksClient_getOffsetFOV = new ReflectorMethod(ForgeHooksClient, "getOffsetFOV"); + public static ReflectorMethod ForgeHooksClient_loadEntityShader = new ReflectorMethod(ForgeHooksClient, "loadEntityShader"); + public static ReflectorMethod ForgeHooksClient_onDrawBlockHighlight = new ReflectorMethod(ForgeHooksClient, "onDrawBlockHighlight"); + public static ReflectorMethod ForgeHooksClient_onFogRender = new ReflectorMethod(ForgeHooksClient, "onFogRender"); + public static ReflectorMethod ForgeHooksClient_onTextureStitchedPre = new ReflectorMethod(ForgeHooksClient, "onTextureStitchedPre"); + public static ReflectorMethod ForgeHooksClient_onTextureStitchedPost = new ReflectorMethod(ForgeHooksClient, "onTextureStitchedPost"); + public static ReflectorMethod ForgeHooksClient_orientBedCamera = new ReflectorMethod(ForgeHooksClient, "orientBedCamera"); + public static ReflectorMethod ForgeHooksClient_putQuadColor = new ReflectorMethod(ForgeHooksClient, "putQuadColor"); + public static ReflectorMethod ForgeHooksClient_renderFirstPersonHand = new ReflectorMethod(ForgeHooksClient, "renderFirstPersonHand"); + public static ReflectorMethod ForgeHooksClient_renderMainMenu = new ReflectorMethod(ForgeHooksClient, "renderMainMenu"); + public static ReflectorMethod ForgeHooksClient_setRenderLayer = new ReflectorMethod(ForgeHooksClient, "setRenderLayer"); + public static ReflectorMethod ForgeHooksClient_setRenderPass = new ReflectorMethod(ForgeHooksClient, "setRenderPass"); + public static ReflectorMethod ForgeHooksClient_transform = new ReflectorMethod(ForgeHooksClient, "transform"); + public static ReflectorClass ForgeItem = new ReflectorClass(Item.class); + public static ReflectorMethod ForgeItem_getDurabilityForDisplay = new ReflectorMethod(ForgeItem, "getDurabilityForDisplay"); + public static ReflectorMethod ForgeItem_getModel = new ReflectorMethod(ForgeItem, "getModel"); + public static ReflectorMethod ForgeItem_onEntitySwing = new ReflectorMethod(ForgeItem, "onEntitySwing"); + public static ReflectorMethod ForgeItem_shouldCauseReequipAnimation = new ReflectorMethod(ForgeItem, "shouldCauseReequipAnimation"); + public static ReflectorMethod ForgeItem_showDurabilityBar = new ReflectorMethod(ForgeItem, "showDurabilityBar"); + public static ReflectorClass ForgeItemRecord = new ReflectorClass(ItemRecord.class); + public static ReflectorMethod ForgeItemRecord_getRecordResource = new ReflectorMethod(ForgeItemRecord, "getRecordResource", new Class[] {String.class}); + public static ReflectorClass ForgeModContainer = new ReflectorClass("net.minecraftforge.common.ForgeModContainer"); + public static ReflectorField ForgeModContainer_forgeLightPipelineEnabled = new ReflectorField(ForgeModContainer, "forgeLightPipelineEnabled"); + public static ReflectorClass ForgePotionEffect = new ReflectorClass(PotionEffect.class); + public static ReflectorMethod ForgePotionEffect_isCurativeItem = new ReflectorMethod(ForgePotionEffect, "isCurativeItem"); + public static ReflectorClass ForgeTileEntity = new ReflectorClass(TileEntity.class); + public static ReflectorMethod ForgeTileEntity_canRenderBreaking = new ReflectorMethod(ForgeTileEntity, "canRenderBreaking"); + public static ReflectorMethod ForgeTileEntity_getRenderBoundingBox = new ReflectorMethod(ForgeTileEntity, "getRenderBoundingBox"); + public static ReflectorMethod ForgeTileEntity_hasFastRenderer = new ReflectorMethod(ForgeTileEntity, "hasFastRenderer"); + public static ReflectorMethod ForgeTileEntity_shouldRenderInPass = new ReflectorMethod(ForgeTileEntity, "shouldRenderInPass"); + public static ReflectorClass ForgeTileEntityRendererDispatcher = new ReflectorClass(TileEntityRendererDispatcher.class); + public static ReflectorMethod ForgeTileEntityRendererDispatcher_preDrawBatch = new ReflectorMethod(ForgeTileEntityRendererDispatcher, "preDrawBatch"); + public static ReflectorMethod ForgeTileEntityRendererDispatcher_drawBatch = new ReflectorMethod(ForgeTileEntityRendererDispatcher, "drawBatch"); + public static ReflectorClass ForgeVertexFormatElementEnumUseage = new ReflectorClass(VertexFormatElement.EnumUsage.class); + public static ReflectorMethod ForgeVertexFormatElementEnumUseage_preDraw = new ReflectorMethod(ForgeVertexFormatElementEnumUseage, "preDraw"); + public static ReflectorMethod ForgeVertexFormatElementEnumUseage_postDraw = new ReflectorMethod(ForgeVertexFormatElementEnumUseage, "postDraw"); + public static ReflectorClass ForgeWorld = new ReflectorClass(World.class); + public static ReflectorMethod ForgeWorld_countEntities = new ReflectorMethod(ForgeWorld, "countEntities", new Class[] {EnumCreatureType.class, Boolean.TYPE}); + public static ReflectorMethod ForgeWorld_getPerWorldStorage = new ReflectorMethod(ForgeWorld, "getPerWorldStorage"); + public static ReflectorClass ForgeWorldProvider = new ReflectorClass(WorldProvider.class); + public static ReflectorMethod ForgeWorldProvider_getCloudRenderer = new ReflectorMethod(ForgeWorldProvider, "getCloudRenderer"); + public static ReflectorMethod ForgeWorldProvider_getSkyRenderer = new ReflectorMethod(ForgeWorldProvider, "getSkyRenderer"); + public static ReflectorMethod ForgeWorldProvider_getWeatherRenderer = new ReflectorMethod(ForgeWorldProvider, "getWeatherRenderer"); + public static ReflectorClass GuiModList = new ReflectorClass("net.minecraftforge.fml.client.GuiModList"); + public static ReflectorConstructor GuiModList_Constructor = new ReflectorConstructor(GuiModList, new Class[] {GuiScreen.class}); + public static ReflectorClass IColoredBakedQuad = new ReflectorClass("net.minecraftforge.client.model.IColoredBakedQuad"); + public static ReflectorClass IExtendedBlockState = new ReflectorClass("net.minecraftforge.common.property.IExtendedBlockState"); + public static ReflectorMethod IExtendedBlockState_getClean = new ReflectorMethod(IExtendedBlockState, "getClean"); + public static ReflectorClass IRenderHandler = new ReflectorClass("net.minecraftforge.client.IRenderHandler"); + public static ReflectorMethod IRenderHandler_render = new ReflectorMethod(IRenderHandler, "render"); + public static ReflectorClass ISmartBlockModel = new ReflectorClass("net.minecraftforge.client.model.ISmartBlockModel"); + public static ReflectorMethod ISmartBlockModel_handleBlockState = new ReflectorMethod(ISmartBlockModel, "handleBlockState"); + public static ReflectorClass ItemModelMesherForge = new ReflectorClass("net.minecraftforge.client.ItemModelMesherForge"); + public static ReflectorConstructor ItemModelMesherForge_Constructor = new ReflectorConstructor(ItemModelMesherForge, new Class[] {ModelManager.class}); + public static ReflectorClass Launch = new ReflectorClass("net.minecraft.launchwrapper.Launch"); + public static ReflectorField Launch_blackboard = new ReflectorField(Launch, "blackboard"); + public static ReflectorClass LightUtil = new ReflectorClass("net.minecraftforge.client.model.pipeline.LightUtil"); + public static ReflectorField LightUtil_itemConsumer = new ReflectorField(LightUtil, "itemConsumer"); + public static ReflectorMethod LightUtil_putBakedQuad = new ReflectorMethod(LightUtil, "putBakedQuad"); + public static ReflectorMethod LightUtil_renderQuadColor = new ReflectorMethod(LightUtil, "renderQuadColor"); + public static ReflectorField LightUtil_tessellator = new ReflectorField(LightUtil, "tessellator"); + public static ReflectorClass MinecraftForge = new ReflectorClass("net.minecraftforge.common.MinecraftForge"); + public static ReflectorField MinecraftForge_EVENT_BUS = new ReflectorField(MinecraftForge, "EVENT_BUS"); + public static ReflectorClass MinecraftForgeClient = new ReflectorClass("net.minecraftforge.client.MinecraftForgeClient"); + public static ReflectorMethod MinecraftForgeClient_getRenderPass = new ReflectorMethod(MinecraftForgeClient, "getRenderPass"); + public static ReflectorMethod MinecraftForgeClient_onRebuildChunk = new ReflectorMethod(MinecraftForgeClient, "onRebuildChunk"); + public static ReflectorClass ModelLoader = new ReflectorClass("net.minecraftforge.client.model.ModelLoader"); + public static ReflectorMethod ModelLoader_onRegisterItems = new ReflectorMethod(ModelLoader, "onRegisterItems"); + public static ReflectorClass RenderBlockOverlayEvent_OverlayType = new ReflectorClass("net.minecraftforge.client.event.RenderBlockOverlayEvent$OverlayType"); + public static ReflectorField RenderBlockOverlayEvent_OverlayType_BLOCK = new ReflectorField(RenderBlockOverlayEvent_OverlayType, "BLOCK"); + public static ReflectorClass RenderingRegistry = new ReflectorClass("net.minecraftforge.fml.client.registry.RenderingRegistry"); + public static ReflectorMethod RenderingRegistry_loadEntityRenderers = new ReflectorMethod(RenderingRegistry, "loadEntityRenderers", new Class[] {RenderManager.class, Map.class}); + public static ReflectorClass RenderItemInFrameEvent = new ReflectorClass("net.minecraftforge.client.event.RenderItemInFrameEvent"); + public static ReflectorConstructor RenderItemInFrameEvent_Constructor = new ReflectorConstructor(RenderItemInFrameEvent, new Class[] {EntityItemFrame.class, RenderItemFrame.class}); + public static ReflectorClass RenderLivingEvent_Pre = new ReflectorClass("net.minecraftforge.client.event.RenderLivingEvent$Pre"); + public static ReflectorConstructor RenderLivingEvent_Pre_Constructor = new ReflectorConstructor(RenderLivingEvent_Pre, new Class[] {EntityLivingBase.class, RendererLivingEntity.class, Double.TYPE, Double.TYPE, Double.TYPE}); + public static ReflectorClass RenderLivingEvent_Post = new ReflectorClass("net.minecraftforge.client.event.RenderLivingEvent$Post"); + public static ReflectorConstructor RenderLivingEvent_Post_Constructor = new ReflectorConstructor(RenderLivingEvent_Post, new Class[] {EntityLivingBase.class, RendererLivingEntity.class, Double.TYPE, Double.TYPE, Double.TYPE}); + public static ReflectorClass RenderLivingEvent_Specials_Pre = new ReflectorClass("net.minecraftforge.client.event.RenderLivingEvent$Specials$Pre"); + public static ReflectorConstructor RenderLivingEvent_Specials_Pre_Constructor = new ReflectorConstructor(RenderLivingEvent_Specials_Pre, new Class[] {EntityLivingBase.class, RendererLivingEntity.class, Double.TYPE, Double.TYPE, Double.TYPE}); + public static ReflectorClass RenderLivingEvent_Specials_Post = new ReflectorClass("net.minecraftforge.client.event.RenderLivingEvent$Specials$Post"); + public static ReflectorConstructor RenderLivingEvent_Specials_Post_Constructor = new ReflectorConstructor(RenderLivingEvent_Specials_Post, new Class[] {EntityLivingBase.class, RendererLivingEntity.class, Double.TYPE, Double.TYPE, Double.TYPE}); + public static ReflectorClass SplashScreen = new ReflectorClass("net.minecraftforge.fml.client.SplashProgress"); + public static ReflectorClass WorldEvent_Load = new ReflectorClass("net.minecraftforge.event.world.WorldEvent$Load"); + public static ReflectorConstructor WorldEvent_Load_Constructor = new ReflectorConstructor(WorldEvent_Load, new Class[] {World.class}); + private static boolean logVanilla = logEntry("*** Reflector Vanilla ***"); + public static ReflectorClass ChunkProviderClient = new ReflectorClass(ChunkProviderClient.class); + public static ReflectorField ChunkProviderClient_chunkMapping = new ReflectorField(ChunkProviderClient, LongHashMap.class); + public static ReflectorClass GuiMainMenu = new ReflectorClass(GuiMainMenu.class); + public static ReflectorField GuiMainMenu_splashText = new ReflectorField(GuiMainMenu, String.class); + public static ReflectorClass Minecraft = new ReflectorClass(Minecraft.class); + public static ReflectorField Minecraft_defaultResourcePack = new ReflectorField(Minecraft, DefaultResourcePack.class); + public static ReflectorClass ModelHumanoidHead = new ReflectorClass(ModelHumanoidHead.class); + public static ReflectorField ModelHumanoidHead_head = new ReflectorField(ModelHumanoidHead, ModelRenderer.class); + public static ReflectorClass ModelBat = new ReflectorClass(ModelBat.class); + public static ReflectorFields ModelBat_ModelRenderers = new ReflectorFields(ModelBat, ModelRenderer.class, 6); + public static ReflectorClass ModelBlaze = new ReflectorClass(ModelBlaze.class); + public static ReflectorField ModelBlaze_blazeHead = new ReflectorField(ModelBlaze, ModelRenderer.class); + public static ReflectorField ModelBlaze_blazeSticks = new ReflectorField(ModelBlaze, ModelRenderer[].class); + public static ReflectorClass ModelDragon = new ReflectorClass(ModelDragon.class); + public static ReflectorFields ModelDragon_ModelRenderers = new ReflectorFields(ModelDragon, ModelRenderer.class, 12); + public static ReflectorClass ModelEnderCrystal = new ReflectorClass(ModelEnderCrystal.class); + public static ReflectorFields ModelEnderCrystal_ModelRenderers = new ReflectorFields(ModelEnderCrystal, ModelRenderer.class, 3); + public static ReflectorClass RenderEnderCrystal = new ReflectorClass(RenderEnderCrystal.class); + public static ReflectorField RenderEnderCrystal_modelEnderCrystal = new ReflectorField(RenderEnderCrystal, ModelBase.class, 0); + public static ReflectorClass ModelEnderMite = new ReflectorClass(ModelEnderMite.class); + public static ReflectorField ModelEnderMite_bodyParts = new ReflectorField(ModelEnderMite, ModelRenderer[].class); + public static ReflectorClass ModelGhast = new ReflectorClass(ModelGhast.class); + public static ReflectorField ModelGhast_body = new ReflectorField(ModelGhast, ModelRenderer.class); + public static ReflectorField ModelGhast_tentacles = new ReflectorField(ModelGhast, ModelRenderer[].class); + public static ReflectorClass ModelGuardian = new ReflectorClass(ModelGuardian.class); + public static ReflectorField ModelGuardian_body = new ReflectorField(ModelGuardian, ModelRenderer.class, 0); + public static ReflectorField ModelGuardian_eye = new ReflectorField(ModelGuardian, ModelRenderer.class, 1); + public static ReflectorField ModelGuardian_spines = new ReflectorField(ModelGuardian, ModelRenderer[].class, 0); + public static ReflectorField ModelGuardian_tail = new ReflectorField(ModelGuardian, ModelRenderer[].class, 1); + public static ReflectorClass ModelHorse = new ReflectorClass(ModelHorse.class); + public static ReflectorFields ModelHorse_ModelRenderers = new ReflectorFields(ModelHorse, ModelRenderer.class, 39); + public static ReflectorClass RenderLeashKnot = new ReflectorClass(RenderLeashKnot.class); + public static ReflectorField RenderLeashKnot_leashKnotModel = new ReflectorField(RenderLeashKnot, ModelLeashKnot.class); + public static ReflectorClass ModelMagmaCube = new ReflectorClass(ModelMagmaCube.class); + public static ReflectorField ModelMagmaCube_core = new ReflectorField(ModelMagmaCube, ModelRenderer.class); + public static ReflectorField ModelMagmaCube_segments = new ReflectorField(ModelMagmaCube, ModelRenderer[].class); + public static ReflectorClass ModelOcelot = new ReflectorClass(ModelOcelot.class); + public static ReflectorFields ModelOcelot_ModelRenderers = new ReflectorFields(ModelOcelot, ModelRenderer.class, 8); + public static ReflectorClass ModelRabbit = new ReflectorClass(ModelRabbit.class); + public static ReflectorFields ModelRabbit_renderers = new ReflectorFields(ModelRabbit, ModelRenderer.class, 12); + public static ReflectorClass ModelSilverfish = new ReflectorClass(ModelSilverfish.class); + public static ReflectorField ModelSilverfish_bodyParts = new ReflectorField(ModelSilverfish, ModelRenderer[].class, 0); + public static ReflectorField ModelSilverfish_wingParts = new ReflectorField(ModelSilverfish, ModelRenderer[].class, 1); + public static ReflectorClass ModelSlime = new ReflectorClass(ModelSlime.class); + public static ReflectorFields ModelSlime_ModelRenderers = new ReflectorFields(ModelSlime, ModelRenderer.class, 4); + public static ReflectorClass ModelSquid = new ReflectorClass(ModelSquid.class); + public static ReflectorField ModelSquid_body = new ReflectorField(ModelSquid, ModelRenderer.class); + public static ReflectorField ModelSquid_tentacles = new ReflectorField(ModelSquid, ModelRenderer[].class); + public static ReflectorClass ModelWitch = new ReflectorClass(ModelWitch.class); + public static ReflectorField ModelWitch_mole = new ReflectorField(ModelWitch, ModelRenderer.class, 0); + public static ReflectorField ModelWitch_hat = new ReflectorField(ModelWitch, ModelRenderer.class, 1); + public static ReflectorClass ModelWither = new ReflectorClass(ModelWither.class); + public static ReflectorField ModelWither_bodyParts = new ReflectorField(ModelWither, ModelRenderer[].class, 0); + public static ReflectorField ModelWither_heads = new ReflectorField(ModelWither, ModelRenderer[].class, 1); + public static ReflectorClass ModelWolf = new ReflectorClass(ModelWolf.class); + public static ReflectorField ModelWolf_tail = new ReflectorField(ModelWolf, ModelRenderer.class, 6); + public static ReflectorField ModelWolf_mane = new ReflectorField(ModelWolf, ModelRenderer.class, 7); + public static ReflectorClass OptiFineClassTransformer = new ReflectorClass("optifine.OptiFineClassTransformer"); + public static ReflectorField OptiFineClassTransformer_instance = new ReflectorField(OptiFineClassTransformer, "instance"); + public static ReflectorMethod OptiFineClassTransformer_getOptiFineResource = new ReflectorMethod(OptiFineClassTransformer, "getOptiFineResource"); + public static ReflectorClass RenderBoat = new ReflectorClass(RenderBoat.class); + public static ReflectorField RenderBoat_modelBoat = new ReflectorField(RenderBoat, ModelBase.class); + public static ReflectorClass RenderMinecart = new ReflectorClass(RenderMinecart.class); + public static ReflectorField RenderMinecart_modelMinecart = new ReflectorField(RenderMinecart, ModelBase.class); + public static ReflectorClass RenderWitherSkull = new ReflectorClass(RenderWitherSkull.class); + public static ReflectorField RenderWitherSkull_model = new ReflectorField(RenderWitherSkull, ModelSkeletonHead.class); + public static ReflectorClass ResourcePackRepository = new ReflectorClass(ResourcePackRepository.class); + public static ReflectorField ResourcePackRepository_repositoryEntries = new ReflectorField(ResourcePackRepository, List.class, 1); + public static ReflectorClass TileEntityBannerRenderer = new ReflectorClass(TileEntityBannerRenderer.class); + public static ReflectorField TileEntityBannerRenderer_bannerModel = new ReflectorField(TileEntityBannerRenderer, ModelBanner.class); + public static ReflectorClass TileEntityChestRenderer = new ReflectorClass(TileEntityChestRenderer.class); + public static ReflectorField TileEntityChestRenderer_simpleChest = new ReflectorField(TileEntityChestRenderer, ModelChest.class, 0); + public static ReflectorField TileEntityChestRenderer_largeChest = new ReflectorField(TileEntityChestRenderer, ModelChest.class, 1); + public static ReflectorClass TileEntityEnchantmentTableRenderer = new ReflectorClass(TileEntityEnchantmentTableRenderer.class); + public static ReflectorField TileEntityEnchantmentTableRenderer_modelBook = new ReflectorField(TileEntityEnchantmentTableRenderer, ModelBook.class); + public static ReflectorClass TileEntityEnderChestRenderer = new ReflectorClass(TileEntityEnderChestRenderer.class); + public static ReflectorField TileEntityEnderChestRenderer_modelChest = new ReflectorField(TileEntityEnderChestRenderer, ModelChest.class); + public static ReflectorClass TileEntitySignRenderer = new ReflectorClass(TileEntitySignRenderer.class); + public static ReflectorField TileEntitySignRenderer_model = new ReflectorField(TileEntitySignRenderer, ModelSign.class); + public static ReflectorClass TileEntitySkullRenderer = new ReflectorClass(TileEntitySkullRenderer.class); + public static ReflectorField TileEntitySkullRenderer_skeletonHead = new ReflectorField(TileEntitySkullRenderer, ModelSkeletonHead.class, 0); + public static ReflectorField TileEntitySkullRenderer_humanoidHead = new ReflectorField(TileEntitySkullRenderer, ModelSkeletonHead.class, 1); + + public static void callVoid(ReflectorMethod p_callVoid_0_, Object... p_callVoid_1_) + { + try + { + Method method = p_callVoid_0_.getTargetMethod(); + + if (method == null) + { + return; + } + + method.invoke((Object)null, p_callVoid_1_); + } + catch (Throwable throwable) + { + handleException(throwable, (Object)null, p_callVoid_0_, p_callVoid_1_); + } + } + + public static boolean callBoolean(ReflectorMethod p_callBoolean_0_, Object... p_callBoolean_1_) + { + try + { + Method method = p_callBoolean_0_.getTargetMethod(); + + if (method == null) + { + return false; + } + else + { + Boolean obool = (Boolean)method.invoke((Object)null, p_callBoolean_1_); + return obool.booleanValue(); + } + } + catch (Throwable throwable) + { + handleException(throwable, (Object)null, p_callBoolean_0_, p_callBoolean_1_); + return false; + } + } + + public static int callInt(ReflectorMethod p_callInt_0_, Object... p_callInt_1_) + { + try + { + Method method = p_callInt_0_.getTargetMethod(); + + if (method == null) + { + return 0; + } + else + { + Integer integer = (Integer)method.invoke((Object)null, p_callInt_1_); + return integer.intValue(); + } + } + catch (Throwable throwable) + { + handleException(throwable, (Object)null, p_callInt_0_, p_callInt_1_); + return 0; + } + } + + public static float callFloat(ReflectorMethod p_callFloat_0_, Object... p_callFloat_1_) + { + try + { + Method method = p_callFloat_0_.getTargetMethod(); + + if (method == null) + { + return 0.0F; + } + else + { + Float f = (Float)method.invoke((Object)null, p_callFloat_1_); + return f.floatValue(); + } + } + catch (Throwable throwable) + { + handleException(throwable, (Object)null, p_callFloat_0_, p_callFloat_1_); + return 0.0F; + } + } + + public static double callDouble(ReflectorMethod p_callDouble_0_, Object... p_callDouble_1_) + { + try + { + Method method = p_callDouble_0_.getTargetMethod(); + + if (method == null) + { + return 0.0D; + } + else + { + Double d0 = (Double)method.invoke((Object)null, p_callDouble_1_); + return d0.doubleValue(); + } + } + catch (Throwable throwable) + { + handleException(throwable, (Object)null, p_callDouble_0_, p_callDouble_1_); + return 0.0D; + } + } + + public static String callString(ReflectorMethod p_callString_0_, Object... p_callString_1_) + { + try + { + Method method = p_callString_0_.getTargetMethod(); + + if (method == null) + { + return null; + } + else + { + String s = (String)method.invoke((Object)null, p_callString_1_); + return s; + } + } + catch (Throwable throwable) + { + handleException(throwable, (Object)null, p_callString_0_, p_callString_1_); + return null; + } + } + + public static Object call(ReflectorMethod p_call_0_, Object... p_call_1_) + { + try + { + Method method = p_call_0_.getTargetMethod(); + + if (method == null) + { + return null; + } + else + { + Object object = method.invoke((Object)null, p_call_1_); + return object; + } + } + catch (Throwable throwable) + { + handleException(throwable, (Object)null, p_call_0_, p_call_1_); + return null; + } + } + + public static void callVoid(Object p_callVoid_0_, ReflectorMethod p_callVoid_1_, Object... p_callVoid_2_) + { + try + { + if (p_callVoid_0_ == null) + { + return; + } + + Method method = p_callVoid_1_.getTargetMethod(); + + if (method == null) + { + return; + } + + method.invoke(p_callVoid_0_, p_callVoid_2_); + } + catch (Throwable throwable) + { + handleException(throwable, p_callVoid_0_, p_callVoid_1_, p_callVoid_2_); + } + } + + public static boolean callBoolean(Object p_callBoolean_0_, ReflectorMethod p_callBoolean_1_, Object... p_callBoolean_2_) + { + try + { + Method method = p_callBoolean_1_.getTargetMethod(); + + if (method == null) + { + return false; + } + else + { + Boolean obool = (Boolean)method.invoke(p_callBoolean_0_, p_callBoolean_2_); + return obool.booleanValue(); + } + } + catch (Throwable throwable) + { + handleException(throwable, p_callBoolean_0_, p_callBoolean_1_, p_callBoolean_2_); + return false; + } + } + + public static int callInt(Object p_callInt_0_, ReflectorMethod p_callInt_1_, Object... p_callInt_2_) + { + try + { + Method method = p_callInt_1_.getTargetMethod(); + + if (method == null) + { + return 0; + } + else + { + Integer integer = (Integer)method.invoke(p_callInt_0_, p_callInt_2_); + return integer.intValue(); + } + } + catch (Throwable throwable) + { + handleException(throwable, p_callInt_0_, p_callInt_1_, p_callInt_2_); + return 0; + } + } + + public static float callFloat(Object p_callFloat_0_, ReflectorMethod p_callFloat_1_, Object... p_callFloat_2_) + { + try + { + Method method = p_callFloat_1_.getTargetMethod(); + + if (method == null) + { + return 0.0F; + } + else + { + Float f = (Float)method.invoke(p_callFloat_0_, p_callFloat_2_); + return f.floatValue(); + } + } + catch (Throwable throwable) + { + handleException(throwable, p_callFloat_0_, p_callFloat_1_, p_callFloat_2_); + return 0.0F; + } + } + + public static double callDouble(Object p_callDouble_0_, ReflectorMethod p_callDouble_1_, Object... p_callDouble_2_) + { + try + { + Method method = p_callDouble_1_.getTargetMethod(); + + if (method == null) + { + return 0.0D; + } + else + { + Double d0 = (Double)method.invoke(p_callDouble_0_, p_callDouble_2_); + return d0.doubleValue(); + } + } + catch (Throwable throwable) + { + handleException(throwable, p_callDouble_0_, p_callDouble_1_, p_callDouble_2_); + return 0.0D; + } + } + + public static String callString(Object p_callString_0_, ReflectorMethod p_callString_1_, Object... p_callString_2_) + { + try + { + Method method = p_callString_1_.getTargetMethod(); + + if (method == null) + { + return null; + } + else + { + String s = (String)method.invoke(p_callString_0_, p_callString_2_); + return s; + } + } + catch (Throwable throwable) + { + handleException(throwable, p_callString_0_, p_callString_1_, p_callString_2_); + return null; + } + } + + public static Object call(Object p_call_0_, ReflectorMethod p_call_1_, Object... p_call_2_) + { + try + { + Method method = p_call_1_.getTargetMethod(); + + if (method == null) + { + return null; + } + else + { + Object object = method.invoke(p_call_0_, p_call_2_); + return object; + } + } + catch (Throwable throwable) + { + handleException(throwable, p_call_0_, p_call_1_, p_call_2_); + return null; + } + } + + public static Object getFieldValue(ReflectorField p_getFieldValue_0_) + { + return getFieldValue((Object)null, p_getFieldValue_0_); + } + + public static Object getFieldValue(Object p_getFieldValue_0_, ReflectorField p_getFieldValue_1_) + { + try + { + Field field = p_getFieldValue_1_.getTargetField(); + + if (field == null) + { + return null; + } + else + { + Object object = field.get(p_getFieldValue_0_); + return object; + } + } + catch (Throwable throwable) + { + throwable.printStackTrace(); + return null; + } + } + + public static Object getFieldValue(ReflectorFields p_getFieldValue_0_, int p_getFieldValue_1_) + { + ReflectorField reflectorfield = p_getFieldValue_0_.getReflectorField(p_getFieldValue_1_); + return reflectorfield == null ? null : getFieldValue(reflectorfield); + } + + public static Object getFieldValue(Object p_getFieldValue_0_, ReflectorFields p_getFieldValue_1_, int p_getFieldValue_2_) + { + ReflectorField reflectorfield = p_getFieldValue_1_.getReflectorField(p_getFieldValue_2_); + return reflectorfield == null ? null : getFieldValue(p_getFieldValue_0_, reflectorfield); + } + + public static float getFieldValueFloat(Object p_getFieldValueFloat_0_, ReflectorField p_getFieldValueFloat_1_, float p_getFieldValueFloat_2_) + { + Object object = getFieldValue(p_getFieldValueFloat_0_, p_getFieldValueFloat_1_); + + if (!(object instanceof Float)) + { + return p_getFieldValueFloat_2_; + } + else + { + Float f = (Float)object; + return f.floatValue(); + } + } + + public static boolean setFieldValue(ReflectorField p_setFieldValue_0_, Object p_setFieldValue_1_) + { + return setFieldValue((Object)null, p_setFieldValue_0_, p_setFieldValue_1_); + } + + public static boolean setFieldValue(Object p_setFieldValue_0_, ReflectorField p_setFieldValue_1_, Object p_setFieldValue_2_) + { + try + { + Field field = p_setFieldValue_1_.getTargetField(); + + if (field == null) + { + return false; + } + else + { + field.set(p_setFieldValue_0_, p_setFieldValue_2_); + return true; + } + } + catch (Throwable throwable) + { + throwable.printStackTrace(); + return false; + } + } + + public static boolean postForgeBusEvent(ReflectorConstructor p_postForgeBusEvent_0_, Object... p_postForgeBusEvent_1_) + { + Object object = newInstance(p_postForgeBusEvent_0_, p_postForgeBusEvent_1_); + return object == null ? false : postForgeBusEvent(object); + } + + public static boolean postForgeBusEvent(Object p_postForgeBusEvent_0_) + { + if (p_postForgeBusEvent_0_ == null) + { + return false; + } + else + { + Object object = getFieldValue(MinecraftForge_EVENT_BUS); + + if (object == null) + { + return false; + } + else + { + Object object1 = call(object, EventBus_post, new Object[] {p_postForgeBusEvent_0_}); + + if (!(object1 instanceof Boolean)) + { + return false; + } + else + { + Boolean obool = (Boolean)object1; + return obool.booleanValue(); + } + } + } + } + + public static Object newInstance(ReflectorConstructor p_newInstance_0_, Object... p_newInstance_1_) + { + Constructor constructor = p_newInstance_0_.getTargetConstructor(); + + if (constructor == null) + { + return null; + } + else + { + try + { + Object object = constructor.newInstance(p_newInstance_1_); + return object; + } + catch (Throwable throwable) + { + handleException(throwable, p_newInstance_0_, p_newInstance_1_); + return null; + } + } + } + + public static boolean matchesTypes(Class[] p_matchesTypes_0_, Class[] p_matchesTypes_1_) + { + if (p_matchesTypes_0_.length != p_matchesTypes_1_.length) + { + return false; + } + else + { + for (int i = 0; i < p_matchesTypes_1_.length; ++i) + { + Class oclass = p_matchesTypes_0_[i]; + Class oclass1 = p_matchesTypes_1_[i]; + + if (oclass != oclass1) + { + return false; + } + } + + return true; + } + } + + private static void dbgCall(boolean p_dbgCall_0_, String p_dbgCall_1_, ReflectorMethod p_dbgCall_2_, Object[] p_dbgCall_3_, Object p_dbgCall_4_) + { + String s = p_dbgCall_2_.getTargetMethod().getDeclaringClass().getName(); + String s1 = p_dbgCall_2_.getTargetMethod().getName(); + String s2 = ""; + + if (p_dbgCall_0_) + { + s2 = " static"; + } + + Config.dbg(p_dbgCall_1_ + s2 + " " + s + "." + s1 + "(" + Config.arrayToString(p_dbgCall_3_) + ") => " + p_dbgCall_4_); + } + + private static void dbgCallVoid(boolean p_dbgCallVoid_0_, String p_dbgCallVoid_1_, ReflectorMethod p_dbgCallVoid_2_, Object[] p_dbgCallVoid_3_) + { + String s = p_dbgCallVoid_2_.getTargetMethod().getDeclaringClass().getName(); + String s1 = p_dbgCallVoid_2_.getTargetMethod().getName(); + String s2 = ""; + + if (p_dbgCallVoid_0_) + { + s2 = " static"; + } + + Config.dbg(p_dbgCallVoid_1_ + s2 + " " + s + "." + s1 + "(" + Config.arrayToString(p_dbgCallVoid_3_) + ")"); + } + + private static void dbgFieldValue(boolean p_dbgFieldValue_0_, String p_dbgFieldValue_1_, ReflectorField p_dbgFieldValue_2_, Object p_dbgFieldValue_3_) + { + String s = p_dbgFieldValue_2_.getTargetField().getDeclaringClass().getName(); + String s1 = p_dbgFieldValue_2_.getTargetField().getName(); + String s2 = ""; + + if (p_dbgFieldValue_0_) + { + s2 = " static"; + } + + Config.dbg(p_dbgFieldValue_1_ + s2 + " " + s + "." + s1 + " => " + p_dbgFieldValue_3_); + } + + private static void handleException(Throwable p_handleException_0_, Object p_handleException_1_, ReflectorMethod p_handleException_2_, Object[] p_handleException_3_) + { + if (p_handleException_0_ instanceof InvocationTargetException) + { + Throwable throwable = p_handleException_0_.getCause(); + + if (throwable instanceof RuntimeException) + { + RuntimeException runtimeexception = (RuntimeException)throwable; + throw runtimeexception; + } + else + { + p_handleException_0_.printStackTrace(); + } + } + else + { + if (p_handleException_0_ instanceof IllegalArgumentException) + { + Config.warn("*** IllegalArgumentException ***"); + Config.warn("Method: " + p_handleException_2_.getTargetMethod()); + Config.warn("Object: " + p_handleException_1_); + Config.warn("Parameter classes: " + Config.arrayToString(getClasses(p_handleException_3_))); + Config.warn("Parameters: " + Config.arrayToString(p_handleException_3_)); + } + + Config.warn("*** Exception outside of method ***"); + Config.warn("Method deactivated: " + p_handleException_2_.getTargetMethod()); + p_handleException_2_.deactivate(); + p_handleException_0_.printStackTrace(); + } + } + + private static void handleException(Throwable p_handleException_0_, ReflectorConstructor p_handleException_1_, Object[] p_handleException_2_) + { + if (p_handleException_0_ instanceof InvocationTargetException) + { + p_handleException_0_.printStackTrace(); + } + else + { + if (p_handleException_0_ instanceof IllegalArgumentException) + { + Config.warn("*** IllegalArgumentException ***"); + Config.warn("Constructor: " + p_handleException_1_.getTargetConstructor()); + Config.warn("Parameter classes: " + Config.arrayToString(getClasses(p_handleException_2_))); + Config.warn("Parameters: " + Config.arrayToString(p_handleException_2_)); + } + + Config.warn("*** Exception outside of constructor ***"); + Config.warn("Constructor deactivated: " + p_handleException_1_.getTargetConstructor()); + p_handleException_1_.deactivate(); + p_handleException_0_.printStackTrace(); + } + } + + private static Object[] getClasses(Object[] p_getClasses_0_) + { + if (p_getClasses_0_ == null) + { + return new Class[0]; + } + else + { + Class[] aclass = new Class[p_getClasses_0_.length]; + + for (int i = 0; i < aclass.length; ++i) + { + Object object = p_getClasses_0_[i]; + + if (object != null) + { + aclass[i] = object.getClass(); + } + } + + return aclass; + } + } + + private static ReflectorField[] getReflectorFields(ReflectorClass p_getReflectorFields_0_, Class p_getReflectorFields_1_, int p_getReflectorFields_2_) + { + ReflectorField[] areflectorfield = new ReflectorField[p_getReflectorFields_2_]; + + for (int i = 0; i < areflectorfield.length; ++i) + { + areflectorfield[i] = new ReflectorField(p_getReflectorFields_0_, p_getReflectorFields_1_, i); + } + + return areflectorfield; + } + + private static boolean logEntry(String p_logEntry_0_) + { + Config.dbg(p_logEntry_0_); + return true; + } +} diff --git a/src/minecraft/optifine/ReflectorClass.java b/src/minecraft/optifine/ReflectorClass.java new file mode 100644 index 0000000..463d5b5 --- /dev/null +++ b/src/minecraft/optifine/ReflectorClass.java @@ -0,0 +1,98 @@ +package optifine; + +public class ReflectorClass +{ + private String targetClassName; + private boolean checked; + private Class targetClass; + + public ReflectorClass(String p_i81_1_) + { + this(p_i81_1_, false); + } + + public ReflectorClass(String p_i82_1_, boolean p_i82_2_) + { + this.targetClassName = null; + this.checked = false; + this.targetClass = null; + this.targetClassName = p_i82_1_; + + if (!p_i82_2_) + { + Class oclass = this.getTargetClass(); + } + } + + public ReflectorClass(Class p_i83_1_) + { + this.targetClassName = null; + this.checked = false; + this.targetClass = null; + this.targetClass = p_i83_1_; + this.targetClassName = p_i83_1_.getName(); + this.checked = true; + } + + public Class getTargetClass() + { + if (this.checked) + { + return this.targetClass; + } + else + { + this.checked = true; + + try + { + this.targetClass = Class.forName(this.targetClassName); + } + catch (ClassNotFoundException var2) + { + Config.log("(Reflector) Class not present: " + this.targetClassName); + } + catch (Throwable throwable) + { + throwable.printStackTrace(); + } + + return this.targetClass; + } + } + + public boolean exists() + { + return this.getTargetClass() != null; + } + + public String getTargetClassName() + { + return this.targetClassName; + } + + public boolean isInstance(Object p_isInstance_1_) + { + return this.getTargetClass() == null ? false : this.getTargetClass().isInstance(p_isInstance_1_); + } + + public ReflectorField makeField(String p_makeField_1_) + { + return new ReflectorField(this, p_makeField_1_); + } + + public ReflectorMethod makeMethod(String p_makeMethod_1_) + { + return new ReflectorMethod(this, p_makeMethod_1_); + } + + public ReflectorMethod makeMethod(String p_makeMethod_1_, Class[] p_makeMethod_2_) + { + return new ReflectorMethod(this, p_makeMethod_1_, p_makeMethod_2_); + } + + public ReflectorMethod makeMethod(String p_makeMethod_1_, Class[] p_makeMethod_2_, boolean p_makeMethod_3_) + { + return new ReflectorMethod(this, p_makeMethod_1_, p_makeMethod_2_, p_makeMethod_3_); + } +} diff --git a/src/minecraft/optifine/ReflectorConstructor.java b/src/minecraft/optifine/ReflectorConstructor.java new file mode 100644 index 0000000..4e69da7 --- /dev/null +++ b/src/minecraft/optifine/ReflectorConstructor.java @@ -0,0 +1,88 @@ +package optifine; + +import java.lang.reflect.Constructor; + +public class ReflectorConstructor +{ + private ReflectorClass reflectorClass = null; + private Class[] parameterTypes = null; + private boolean checked = false; + private Constructor targetConstructor = null; + + public ReflectorConstructor(ReflectorClass p_i84_1_, Class[] p_i84_2_) + { + this.reflectorClass = p_i84_1_; + this.parameterTypes = p_i84_2_; + Constructor constructor = this.getTargetConstructor(); + } + + public Constructor getTargetConstructor() + { + if (this.checked) + { + return this.targetConstructor; + } + else + { + this.checked = true; + Class oclass = this.reflectorClass.getTargetClass(); + + if (oclass == null) + { + return null; + } + else + { + try + { + this.targetConstructor = findConstructor(oclass, this.parameterTypes); + + if (this.targetConstructor == null) + { + Config.dbg("(Reflector) Constructor not present: " + oclass.getName() + ", params: " + Config.arrayToString((Object[])this.parameterTypes)); + } + + if (this.targetConstructor != null) + { + this.targetConstructor.setAccessible(true); + } + } + catch (Throwable throwable) + { + throwable.printStackTrace(); + } + + return this.targetConstructor; + } + } + } + + private static Constructor findConstructor(Class p_findConstructor_0_, Class[] p_findConstructor_1_) + { + Constructor[] aconstructor = p_findConstructor_0_.getDeclaredConstructors(); + + for (int i = 0; i < aconstructor.length; ++i) + { + Constructor constructor = aconstructor[i]; + Class[] aclass = constructor.getParameterTypes(); + + if (Reflector.matchesTypes(p_findConstructor_1_, aclass)) + { + return constructor; + } + } + + return null; + } + + public boolean exists() + { + return this.checked ? this.targetConstructor != null : this.getTargetConstructor() != null; + } + + public void deactivate() + { + this.checked = true; + this.targetConstructor = null; + } +} diff --git a/src/minecraft/optifine/ReflectorField.java b/src/minecraft/optifine/ReflectorField.java new file mode 100644 index 0000000..5e6b2a4 --- /dev/null +++ b/src/minecraft/optifine/ReflectorField.java @@ -0,0 +1,79 @@ +package optifine; + +import java.lang.reflect.Field; + +public class ReflectorField +{ + private IFieldLocator fieldLocator; + private boolean checked; + private Field targetField; + + public ReflectorField(ReflectorClass p_i85_1_, String p_i85_2_) + { + this((IFieldLocator)(new FieldLocatorName(p_i85_1_, p_i85_2_))); + } + + public ReflectorField(ReflectorClass p_i86_1_, Class p_i86_2_) + { + this(p_i86_1_, p_i86_2_, 0); + } + + public ReflectorField(ReflectorClass p_i87_1_, Class p_i87_2_, int p_i87_3_) + { + this((IFieldLocator)(new FieldLocatorType(p_i87_1_, p_i87_2_, p_i87_3_))); + } + + public ReflectorField(Field p_i88_1_) + { + this((IFieldLocator)(new FieldLocatorFixed(p_i88_1_))); + } + + public ReflectorField(IFieldLocator p_i89_1_) + { + this.fieldLocator = null; + this.checked = false; + this.targetField = null; + this.fieldLocator = p_i89_1_; + this.getTargetField(); + } + + public Field getTargetField() + { + if (this.checked) + { + return this.targetField; + } + else + { + this.checked = true; + this.targetField = this.fieldLocator.getField(); + + if (this.targetField != null) + { + this.targetField.setAccessible(true); + } + + return this.targetField; + } + } + + public Object getValue() + { + return Reflector.getFieldValue((Object)null, this); + } + + public void setValue(Object p_setValue_1_) + { + Reflector.setFieldValue((Object)null, this, p_setValue_1_); + } + + public void setValue(Object p_setValue_1_, Object p_setValue_2_) + { + Reflector.setFieldValue(p_setValue_1_, this, p_setValue_2_); + } + + public boolean exists() + { + return this.getTargetField() != null; + } +} diff --git a/src/minecraft/optifine/ReflectorFields.java b/src/minecraft/optifine/ReflectorFields.java new file mode 100644 index 0000000..a7fc5f8 --- /dev/null +++ b/src/minecraft/optifine/ReflectorFields.java @@ -0,0 +1,48 @@ +package optifine; + +public class ReflectorFields +{ + private ReflectorClass reflectorClass; + private Class fieldType; + private int fieldCount; + private ReflectorField[] reflectorFields; + + public ReflectorFields(ReflectorClass p_i90_1_, Class p_i90_2_, int p_i90_3_) + { + this.reflectorClass = p_i90_1_; + this.fieldType = p_i90_2_; + + if (p_i90_1_.exists()) + { + if (p_i90_2_ != null) + { + this.reflectorFields = new ReflectorField[p_i90_3_]; + + for (int i = 0; i < this.reflectorFields.length; ++i) + { + this.reflectorFields[i] = new ReflectorField(p_i90_1_, p_i90_2_, i); + } + } + } + } + + public ReflectorClass getReflectorClass() + { + return this.reflectorClass; + } + + public Class getFieldType() + { + return this.fieldType; + } + + public int getFieldCount() + { + return this.fieldCount; + } + + public ReflectorField getReflectorField(int p_getReflectorField_1_) + { + return p_getReflectorField_1_ >= 0 && p_getReflectorField_1_ < this.reflectorFields.length ? this.reflectorFields[p_getReflectorField_1_] : null; + } +} diff --git a/src/minecraft/optifine/ReflectorForge.java b/src/minecraft/optifine/ReflectorForge.java new file mode 100644 index 0000000..f3bdfae --- /dev/null +++ b/src/minecraft/optifine/ReflectorForge.java @@ -0,0 +1,100 @@ +package optifine; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.Map; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class ReflectorForge +{ + public static void FMLClientHandler_trackBrokenTexture(ResourceLocation p_FMLClientHandler_trackBrokenTexture_0_, String p_FMLClientHandler_trackBrokenTexture_1_) + { + if (!Reflector.FMLClientHandler_trackBrokenTexture.exists()) + { + Object object = Reflector.call(Reflector.FMLClientHandler_instance, new Object[0]); + Reflector.call(object, Reflector.FMLClientHandler_trackBrokenTexture, new Object[] {p_FMLClientHandler_trackBrokenTexture_0_, p_FMLClientHandler_trackBrokenTexture_1_}); + } + } + + public static void FMLClientHandler_trackMissingTexture(ResourceLocation p_FMLClientHandler_trackMissingTexture_0_) + { + if (!Reflector.FMLClientHandler_trackMissingTexture.exists()) + { + Object object = Reflector.call(Reflector.FMLClientHandler_instance, new Object[0]); + Reflector.call(object, Reflector.FMLClientHandler_trackMissingTexture, new Object[] {p_FMLClientHandler_trackMissingTexture_0_}); + } + } + + public static void putLaunchBlackboard(String p_putLaunchBlackboard_0_, Object p_putLaunchBlackboard_1_) + { + Map map = (Map)Reflector.getFieldValue(Reflector.Launch_blackboard); + + if (map != null) + { + map.put(p_putLaunchBlackboard_0_, p_putLaunchBlackboard_1_); + } + } + + public static boolean renderFirstPersonHand(RenderGlobal p_renderFirstPersonHand_0_, float p_renderFirstPersonHand_1_, int p_renderFirstPersonHand_2_) + { + return !Reflector.ForgeHooksClient_renderFirstPersonHand.exists() ? false : Reflector.callBoolean(Reflector.ForgeHooksClient_renderFirstPersonHand, new Object[] {p_renderFirstPersonHand_0_, Float.valueOf(p_renderFirstPersonHand_1_), Integer.valueOf(p_renderFirstPersonHand_2_)}); + } + + public static InputStream getOptiFineResourceStream(String p_getOptiFineResourceStream_0_) + { + if (!Reflector.OptiFineClassTransformer_instance.exists()) + { + return null; + } + else + { + Object object = Reflector.getFieldValue(Reflector.OptiFineClassTransformer_instance); + + if (object == null) + { + return null; + } + else + { + if (p_getOptiFineResourceStream_0_.startsWith("/")) + { + p_getOptiFineResourceStream_0_ = p_getOptiFineResourceStream_0_.substring(1); + } + + byte[] abyte = (byte[])((byte[])Reflector.call(object, Reflector.OptiFineClassTransformer_getOptiFineResource, new Object[] {p_getOptiFineResourceStream_0_})); + + if (abyte == null) + { + return null; + } + else + { + InputStream inputstream = new ByteArrayInputStream(abyte); + return inputstream; + } + } + } + } + + public static boolean blockHasTileEntity(IBlockState p_blockHasTileEntity_0_) + { + Block block = p_blockHasTileEntity_0_.getBlock(); + return !Reflector.ForgeBlock_hasTileEntity.exists() ? block.hasTileEntity() : Reflector.callBoolean(block, Reflector.ForgeBlock_hasTileEntity, new Object[] {p_blockHasTileEntity_0_}); + } + + public static boolean isItemDamaged(ItemStack p_isItemDamaged_0_) + { + return !Reflector.ForgeItem_showDurabilityBar.exists() ? p_isItemDamaged_0_.isItemDamaged() : Reflector.callBoolean(p_isItemDamaged_0_.getItem(), Reflector.ForgeItem_showDurabilityBar, new Object[] {p_isItemDamaged_0_}); + } + + public static boolean armorHasOverlay(ItemArmor p_armorHasOverlay_0_, ItemStack p_armorHasOverlay_1_) + { + int i = p_armorHasOverlay_0_.getColor(p_armorHasOverlay_1_); + return i != 16777215; + } +} diff --git a/src/minecraft/optifine/ReflectorMethod.java b/src/minecraft/optifine/ReflectorMethod.java new file mode 100644 index 0000000..9c4af68 --- /dev/null +++ b/src/minecraft/optifine/ReflectorMethod.java @@ -0,0 +1,168 @@ +package optifine; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; + +public class ReflectorMethod +{ + private ReflectorClass reflectorClass; + private String targetMethodName; + private Class[] targetMethodParameterTypes; + private boolean checked; + private Method targetMethod; + + public ReflectorMethod(ReflectorClass p_i91_1_, String p_i91_2_) + { + this(p_i91_1_, p_i91_2_, (Class[])null, false); + } + + public ReflectorMethod(ReflectorClass p_i92_1_, String p_i92_2_, Class[] p_i92_3_) + { + this(p_i92_1_, p_i92_2_, p_i92_3_, false); + } + + public ReflectorMethod(ReflectorClass p_i93_1_, String p_i93_2_, Class[] p_i93_3_, boolean p_i93_4_) + { + this.reflectorClass = null; + this.targetMethodName = null; + this.targetMethodParameterTypes = null; + this.checked = false; + this.targetMethod = null; + this.reflectorClass = p_i93_1_; + this.targetMethodName = p_i93_2_; + this.targetMethodParameterTypes = p_i93_3_; + + if (!p_i93_4_) + { + Method method = this.getTargetMethod(); + } + } + + public Method getTargetMethod() + { + if (this.checked) + { + return this.targetMethod; + } + else + { + this.checked = true; + Class oclass = this.reflectorClass.getTargetClass(); + + if (oclass == null) + { + return null; + } + else + { + try + { + if (this.targetMethodParameterTypes == null) + { + Method[] amethod = getMethods(oclass, this.targetMethodName); + + if (amethod.length <= 0) + { + Config.log("(Reflector) Method not present: " + oclass.getName() + "." + this.targetMethodName); + return null; + } + + if (amethod.length > 1) + { + Config.warn("(Reflector) More than one method found: " + oclass.getName() + "." + this.targetMethodName); + + for (int i = 0; i < amethod.length; ++i) + { + Method method = amethod[i]; + Config.warn("(Reflector) - " + method); + } + + return null; + } + + this.targetMethod = amethod[0]; + } + else + { + this.targetMethod = getMethod(oclass, this.targetMethodName, this.targetMethodParameterTypes); + } + + if (this.targetMethod == null) + { + Config.log("(Reflector) Method not present: " + oclass.getName() + "." + this.targetMethodName); + return null; + } + else + { + this.targetMethod.setAccessible(true); + return this.targetMethod; + } + } + catch (Throwable throwable) + { + throwable.printStackTrace(); + return null; + } + } + } + } + + public boolean exists() + { + return this.checked ? this.targetMethod != null : this.getTargetMethod() != null; + } + + public Class getReturnType() + { + Method method = this.getTargetMethod(); + return method == null ? null : method.getReturnType(); + } + + public void deactivate() + { + this.checked = true; + this.targetMethod = null; + } + + public static Method getMethod(Class p_getMethod_0_, String p_getMethod_1_, Class[] p_getMethod_2_) + { + Method[] amethod = p_getMethod_0_.getDeclaredMethods(); + + for (int i = 0; i < amethod.length; ++i) + { + Method method = amethod[i]; + + if (method.getName().equals(p_getMethod_1_)) + { + Class[] aclass = method.getParameterTypes(); + + if (Reflector.matchesTypes(p_getMethod_2_, aclass)) + { + return method; + } + } + } + + return null; + } + + public static Method[] getMethods(Class p_getMethods_0_, String p_getMethods_1_) + { + List list = new ArrayList(); + Method[] amethod = p_getMethods_0_.getDeclaredMethods(); + + for (int i = 0; i < amethod.length; ++i) + { + Method method = amethod[i]; + + if (method.getName().equals(p_getMethods_1_)) + { + list.add(method); + } + } + + Method[] amethod1 = (Method[])((Method[])list.toArray(new Method[list.size()])); + return amethod1; + } +} diff --git a/src/minecraft/optifine/ReflectorRaw.java b/src/minecraft/optifine/ReflectorRaw.java new file mode 100644 index 0000000..99c285f --- /dev/null +++ b/src/minecraft/optifine/ReflectorRaw.java @@ -0,0 +1,205 @@ +package optifine; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class ReflectorRaw +{ + public static Field getField(Class p_getField_0_, Class p_getField_1_) + { + try + { + Field[] afield = p_getField_0_.getDeclaredFields(); + + for (int i = 0; i < afield.length; ++i) + { + Field field = afield[i]; + + if (field.getType() == p_getField_1_) + { + field.setAccessible(true); + return field; + } + } + + return null; + } + catch (Exception var5) + { + return null; + } + } + + public static Field[] getFields(Class p_getFields_0_, Class p_getFields_1_) + { + try + { + Field[] afield = p_getFields_0_.getDeclaredFields(); + return getFields(afield, p_getFields_1_); + } + catch (Exception var3) + { + return null; + } + } + + public static Field[] getFields(Field[] p_getFields_0_, Class p_getFields_1_) + { + try + { + List list = new ArrayList(); + + for (int i = 0; i < p_getFields_0_.length; ++i) + { + Field field = p_getFields_0_[i]; + + if (field.getType() == p_getFields_1_) + { + field.setAccessible(true); + list.add(field); + } + } + + Field[] afield = (Field[])((Field[])list.toArray(new Field[list.size()])); + return afield; + } + catch (Exception var5) + { + return null; + } + } + + public static Field[] getFieldsAfter(Class p_getFieldsAfter_0_, Field p_getFieldsAfter_1_, Class p_getFieldsAfter_2_) + { + try + { + Field[] afield = p_getFieldsAfter_0_.getDeclaredFields(); + List list = Arrays.asList(afield); + int i = list.indexOf(p_getFieldsAfter_1_); + + if (i < 0) + { + return new Field[0]; + } + else + { + List list1 = list.subList(i + 1, list.size()); + Field[] afield1 = (Field[])((Field[])list1.toArray(new Field[list1.size()])); + return getFields(afield1, p_getFieldsAfter_2_); + } + } + catch (Exception var8) + { + return null; + } + } + + public static Field[] getFields(Object p_getFields_0_, Field[] p_getFields_1_, Class p_getFields_2_, Object p_getFields_3_) + { + try + { + List list = new ArrayList(); + + for (int i = 0; i < p_getFields_1_.length; ++i) + { + Field field = p_getFields_1_[i]; + + if (field.getType() == p_getFields_2_) + { + boolean flag = Modifier.isStatic(field.getModifiers()); + + if ((p_getFields_0_ != null || flag) && (p_getFields_0_ == null || !flag)) + { + field.setAccessible(true); + Object object = field.get(p_getFields_0_); + + if (object == p_getFields_3_) + { + list.add(field); + } + else if (object != null && p_getFields_3_ != null && object.equals(p_getFields_3_)) + { + list.add(field); + } + } + } + } + + Field[] afield = (Field[])((Field[])list.toArray(new Field[list.size()])); + return afield; + } + catch (Exception var9) + { + return null; + } + } + + public static Field getField(Class p_getField_0_, Class p_getField_1_, int p_getField_2_) + { + Field[] afield = getFields(p_getField_0_, p_getField_1_); + return p_getField_2_ >= 0 && p_getField_2_ < afield.length ? afield[p_getField_2_] : null; + } + + public static Field getFieldAfter(Class p_getFieldAfter_0_, Field p_getFieldAfter_1_, Class p_getFieldAfter_2_, int p_getFieldAfter_3_) + { + Field[] afield = getFieldsAfter(p_getFieldAfter_0_, p_getFieldAfter_1_, p_getFieldAfter_2_); + return p_getFieldAfter_3_ >= 0 && p_getFieldAfter_3_ < afield.length ? afield[p_getFieldAfter_3_] : null; + } + + public static Object getFieldValue(Object p_getFieldValue_0_, Class p_getFieldValue_1_, Class p_getFieldValue_2_) + { + ReflectorField reflectorfield = getReflectorField(p_getFieldValue_1_, p_getFieldValue_2_); + return reflectorfield == null ? null : (!reflectorfield.exists() ? null : Reflector.getFieldValue(p_getFieldValue_0_, reflectorfield)); + } + + public static Object getFieldValue(Object p_getFieldValue_0_, Class p_getFieldValue_1_, Class p_getFieldValue_2_, int p_getFieldValue_3_) + { + ReflectorField reflectorfield = getReflectorField(p_getFieldValue_1_, p_getFieldValue_2_, p_getFieldValue_3_); + return reflectorfield == null ? null : (!reflectorfield.exists() ? null : Reflector.getFieldValue(p_getFieldValue_0_, reflectorfield)); + } + + public static boolean setFieldValue(Object p_setFieldValue_0_, Class p_setFieldValue_1_, Class p_setFieldValue_2_, Object p_setFieldValue_3_) + { + ReflectorField reflectorfield = getReflectorField(p_setFieldValue_1_, p_setFieldValue_2_); + return reflectorfield == null ? false : (!reflectorfield.exists() ? false : Reflector.setFieldValue(p_setFieldValue_0_, reflectorfield, p_setFieldValue_3_)); + } + + public static boolean setFieldValue(Object p_setFieldValue_0_, Class p_setFieldValue_1_, Class p_setFieldValue_2_, int p_setFieldValue_3_, Object p_setFieldValue_4_) + { + ReflectorField reflectorfield = getReflectorField(p_setFieldValue_1_, p_setFieldValue_2_, p_setFieldValue_3_); + return reflectorfield == null ? false : (!reflectorfield.exists() ? false : Reflector.setFieldValue(p_setFieldValue_0_, reflectorfield, p_setFieldValue_4_)); + } + + public static ReflectorField getReflectorField(Class p_getReflectorField_0_, Class p_getReflectorField_1_) + { + Field field = getField(p_getReflectorField_0_, p_getReflectorField_1_); + + if (field == null) + { + return null; + } + else + { + ReflectorClass reflectorclass = new ReflectorClass(p_getReflectorField_0_); + return new ReflectorField(reflectorclass, field.getName()); + } + } + + public static ReflectorField getReflectorField(Class p_getReflectorField_0_, Class p_getReflectorField_1_, int p_getReflectorField_2_) + { + Field field = getField(p_getReflectorField_0_, p_getReflectorField_1_, p_getReflectorField_2_); + + if (field == null) + { + return null; + } + else + { + ReflectorClass reflectorclass = new ReflectorClass(p_getReflectorField_0_); + return new ReflectorField(reflectorclass, field.getName()); + } + } +} diff --git a/src/minecraft/optifine/RenderEnv.java b/src/minecraft/optifine/RenderEnv.java new file mode 100644 index 0000000..39d167c --- /dev/null +++ b/src/minecraft/optifine/RenderEnv.java @@ -0,0 +1,182 @@ +package optifine; + +import java.util.BitSet; +import java.util.List; +import net.minecraft.block.Block; +import net.minecraft.block.state.BlockStateBase; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.BlockModelRenderer; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.BreakingFour; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; + +public class RenderEnv +{ + private IBlockAccess blockAccess; + private IBlockState blockState; + private BlockPos blockPos; + private GameSettings gameSettings; + private int blockId = -1; + private int metadata = -1; + private int breakingAnimation = -1; + private float[] quadBounds = new float[EnumFacing.VALUES.length * 2]; + private BitSet boundsFlags = new BitSet(3); + private BlockModelRenderer.AmbientOcclusionFace aoFace = new BlockModelRenderer.AmbientOcclusionFace(); + private BlockPosM colorizerBlockPosM = null; + private boolean[] borderFlags = null; + private static ThreadLocal threadLocalInstance = new ThreadLocal(); + + private RenderEnv(IBlockAccess p_i94_1_, IBlockState p_i94_2_, BlockPos p_i94_3_) + { + this.blockAccess = p_i94_1_; + this.blockState = p_i94_2_; + this.blockPos = p_i94_3_; + this.gameSettings = Config.getGameSettings(); + } + + public static RenderEnv getInstance(IBlockAccess p_getInstance_0_, IBlockState p_getInstance_1_, BlockPos p_getInstance_2_) + { + RenderEnv renderenv = (RenderEnv)threadLocalInstance.get(); + + if (renderenv == null) + { + renderenv = new RenderEnv(p_getInstance_0_, p_getInstance_1_, p_getInstance_2_); + threadLocalInstance.set(renderenv); + return renderenv; + } + else + { + renderenv.reset(p_getInstance_0_, p_getInstance_1_, p_getInstance_2_); + return renderenv; + } + } + + private void reset(IBlockAccess p_reset_1_, IBlockState p_reset_2_, BlockPos p_reset_3_) + { + this.blockAccess = p_reset_1_; + this.blockState = p_reset_2_; + this.blockPos = p_reset_3_; + this.blockId = -1; + this.metadata = -1; + this.breakingAnimation = -1; + this.boundsFlags.clear(); + } + + public int getBlockId() + { + if (this.blockId < 0) + { + if (this.blockState instanceof BlockStateBase) + { + BlockStateBase blockstatebase = (BlockStateBase)this.blockState; + this.blockId = blockstatebase.getBlockId(); + } + else + { + this.blockId = Block.getIdFromBlock(this.blockState.getBlock()); + } + } + + return this.blockId; + } + + public int getMetadata() + { + if (this.metadata < 0) + { + if (this.blockState instanceof BlockStateBase) + { + BlockStateBase blockstatebase = (BlockStateBase)this.blockState; + this.metadata = blockstatebase.getMetadata(); + } + else + { + this.metadata = this.blockState.getBlock().getMetaFromState(this.blockState); + } + } + + return this.metadata; + } + + public float[] getQuadBounds() + { + return this.quadBounds; + } + + public BitSet getBoundsFlags() + { + return this.boundsFlags; + } + + public BlockModelRenderer.AmbientOcclusionFace getAoFace() + { + return this.aoFace; + } + + public boolean isBreakingAnimation(List p_isBreakingAnimation_1_) + { + if (this.breakingAnimation < 0 && p_isBreakingAnimation_1_.size() > 0) + { + if (p_isBreakingAnimation_1_.get(0) instanceof BreakingFour) + { + this.breakingAnimation = 1; + } + else + { + this.breakingAnimation = 0; + } + } + + return this.breakingAnimation == 1; + } + + public boolean isBreakingAnimation(BakedQuad p_isBreakingAnimation_1_) + { + if (this.breakingAnimation < 0) + { + if (p_isBreakingAnimation_1_ instanceof BreakingFour) + { + this.breakingAnimation = 1; + } + else + { + this.breakingAnimation = 0; + } + } + + return this.breakingAnimation == 1; + } + + public boolean isBreakingAnimation() + { + return this.breakingAnimation == 1; + } + + public IBlockState getBlockState() + { + return this.blockState; + } + + public BlockPosM getColorizerBlockPosM() + { + if (this.colorizerBlockPosM == null) + { + this.colorizerBlockPosM = new BlockPosM(0, 0, 0); + } + + return this.colorizerBlockPosM; + } + + public boolean[] getBorderFlags() + { + if (this.borderFlags == null) + { + this.borderFlags = new boolean[4]; + } + + return this.borderFlags; + } +} diff --git a/src/minecraft/optifine/RenderInfoLazy.java b/src/minecraft/optifine/RenderInfoLazy.java new file mode 100644 index 0000000..77584fc --- /dev/null +++ b/src/minecraft/optifine/RenderInfoLazy.java @@ -0,0 +1,32 @@ +package optifine; + +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.util.EnumFacing; + +public class RenderInfoLazy +{ + private RenderChunk renderChunk; + private RenderGlobal.ContainerLocalRenderInformation renderInfo; + + public RenderChunk getRenderChunk() + { + return this.renderChunk; + } + + public void setRenderChunk(RenderChunk p_setRenderChunk_1_) + { + this.renderChunk = p_setRenderChunk_1_; + this.renderInfo = null; + } + + public RenderGlobal.ContainerLocalRenderInformation getRenderInfo() + { + if (this.renderInfo == null) + { + this.renderInfo = new RenderGlobal.ContainerLocalRenderInformation(this.renderChunk, (EnumFacing)null, 0); + } + + return this.renderInfo; + } +} diff --git a/src/minecraft/optifine/ResUtils.java b/src/minecraft/optifine/ResUtils.java new file mode 100644 index 0000000..b273797 --- /dev/null +++ b/src/minecraft/optifine/ResUtils.java @@ -0,0 +1,179 @@ +package optifine; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import net.minecraft.client.resources.AbstractResourcePack; +import net.minecraft.client.resources.DefaultResourcePack; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.util.ResourceLocation; + +public class ResUtils +{ + public static String[] collectFiles(String p_collectFiles_0_, String p_collectFiles_1_) + { + return collectFiles(new String[] {p_collectFiles_0_}, new String[] {p_collectFiles_1_}); + } + + public static String[] collectFiles(String[] p_collectFiles_0_, String[] p_collectFiles_1_) + { + Set set = new LinkedHashSet(); + IResourcePack[] airesourcepack = Config.getResourcePacks(); + + for (int i = 0; i < airesourcepack.length; ++i) + { + IResourcePack iresourcepack = airesourcepack[i]; + String[] astring = collectFiles(iresourcepack, (String[])p_collectFiles_0_, (String[])p_collectFiles_1_, (String[])null); + set.addAll(Arrays.asList(astring)); + } + + String[] astring1 = (String[])set.toArray(new String[set.size()]); + return astring1; + } + + public static String[] collectFiles(IResourcePack p_collectFiles_0_, String p_collectFiles_1_, String p_collectFiles_2_, String[] p_collectFiles_3_) + { + return collectFiles(p_collectFiles_0_, new String[] {p_collectFiles_1_}, new String[] {p_collectFiles_2_}, p_collectFiles_3_); + } + + public static String[] collectFiles(IResourcePack p_collectFiles_0_, String[] p_collectFiles_1_, String[] p_collectFiles_2_) + { + return collectFiles(p_collectFiles_0_, (String[])p_collectFiles_1_, (String[])p_collectFiles_2_, (String[])null); + } + + public static String[] collectFiles(IResourcePack p_collectFiles_0_, String[] p_collectFiles_1_, String[] p_collectFiles_2_, String[] p_collectFiles_3_) + { + if (p_collectFiles_0_ instanceof DefaultResourcePack) + { + return collectFilesFixed(p_collectFiles_0_, p_collectFiles_3_); + } + else if (!(p_collectFiles_0_ instanceof AbstractResourcePack)) + { + return new String[0]; + } + else + { + AbstractResourcePack abstractresourcepack = (AbstractResourcePack)p_collectFiles_0_; + File file1 = abstractresourcepack.resourcePackFile; + return file1 == null ? new String[0] : (file1.isDirectory() ? collectFilesFolder(file1, "", p_collectFiles_1_, p_collectFiles_2_) : (file1.isFile() ? collectFilesZIP(file1, p_collectFiles_1_, p_collectFiles_2_) : new String[0])); + } + } + + private static String[] collectFilesFixed(IResourcePack p_collectFilesFixed_0_, String[] p_collectFilesFixed_1_) + { + if (p_collectFilesFixed_1_ == null) + { + return new String[0]; + } + else + { + List list = new ArrayList(); + + for (int i = 0; i < p_collectFilesFixed_1_.length; ++i) + { + String s = p_collectFilesFixed_1_[i]; + ResourceLocation resourcelocation = new ResourceLocation(s); + + if (p_collectFilesFixed_0_.resourceExists(resourcelocation)) + { + list.add(s); + } + } + + String[] astring = (String[])((String[])list.toArray(new String[list.size()])); + return astring; + } + } + + private static String[] collectFilesFolder(File p_collectFilesFolder_0_, String p_collectFilesFolder_1_, String[] p_collectFilesFolder_2_, String[] p_collectFilesFolder_3_) + { + List list = new ArrayList(); + String s = "assets/minecraft/"; + File[] afile = p_collectFilesFolder_0_.listFiles(); + + if (afile == null) + { + return new String[0]; + } + else + { + for (int i = 0; i < afile.length; ++i) + { + File file1 = afile[i]; + + if (file1.isFile()) + { + String s3 = p_collectFilesFolder_1_ + file1.getName(); + + if (s3.startsWith(s)) + { + s3 = s3.substring(s.length()); + + if (StrUtils.startsWith(s3, p_collectFilesFolder_2_) && StrUtils.endsWith(s3, p_collectFilesFolder_3_)) + { + list.add(s3); + } + } + } + else if (file1.isDirectory()) + { + String s1 = p_collectFilesFolder_1_ + file1.getName() + "/"; + String[] astring = collectFilesFolder(file1, s1, p_collectFilesFolder_2_, p_collectFilesFolder_3_); + + for (int j = 0; j < astring.length; ++j) + { + String s2 = astring[j]; + list.add(s2); + } + } + } + + String[] astring1 = (String[])((String[])list.toArray(new String[list.size()])); + return astring1; + } + } + + private static String[] collectFilesZIP(File p_collectFilesZIP_0_, String[] p_collectFilesZIP_1_, String[] p_collectFilesZIP_2_) + { + List list = new ArrayList(); + String s = "assets/minecraft/"; + + try + { + ZipFile zipfile = new ZipFile(p_collectFilesZIP_0_); + Enumeration enumeration = zipfile.entries(); + + while (enumeration.hasMoreElements()) + { + ZipEntry zipentry = (ZipEntry)enumeration.nextElement(); + String s1 = zipentry.getName(); + + if (s1.startsWith(s)) + { + s1 = s1.substring(s.length()); + + if (StrUtils.startsWith(s1, p_collectFilesZIP_1_) && StrUtils.endsWith(s1, p_collectFilesZIP_2_)) + { + list.add(s1); + } + } + } + + zipfile.close(); + String[] astring = (String[])((String[])list.toArray(new String[list.size()])); + return astring; + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + return new String[0]; + } + } +} diff --git a/src/minecraft/optifine/SmartLeaves.java b/src/minecraft/optifine/SmartLeaves.java new file mode 100644 index 0000000..6f2f026 --- /dev/null +++ b/src/minecraft/optifine/SmartLeaves.java @@ -0,0 +1,198 @@ +package optifine; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; + +public class SmartLeaves +{ + private static IBakedModel modelLeavesCullAcacia = null; + private static IBakedModel modelLeavesCullBirch = null; + private static IBakedModel modelLeavesCullDarkOak = null; + private static IBakedModel modelLeavesCullJungle = null; + private static IBakedModel modelLeavesCullOak = null; + private static IBakedModel modelLeavesCullSpruce = null; + private static List generalQuadsCullAcacia = null; + private static List generalQuadsCullBirch = null; + private static List generalQuadsCullDarkOak = null; + private static List generalQuadsCullJungle = null; + private static List generalQuadsCullOak = null; + private static List generalQuadsCullSpruce = null; + private static IBakedModel modelLeavesDoubleAcacia = null; + private static IBakedModel modelLeavesDoubleBirch = null; + private static IBakedModel modelLeavesDoubleDarkOak = null; + private static IBakedModel modelLeavesDoubleJungle = null; + private static IBakedModel modelLeavesDoubleOak = null; + private static IBakedModel modelLeavesDoubleSpruce = null; + + public static IBakedModel getLeavesModel(IBakedModel p_getLeavesModel_0_) + { + if (!Config.isTreesSmart()) + { + return p_getLeavesModel_0_; + } + else + { + List list = p_getLeavesModel_0_.getGeneralQuads(); + return list == generalQuadsCullAcacia ? modelLeavesDoubleAcacia : (list == generalQuadsCullBirch ? modelLeavesDoubleBirch : (list == generalQuadsCullDarkOak ? modelLeavesDoubleDarkOak : (list == generalQuadsCullJungle ? modelLeavesDoubleJungle : (list == generalQuadsCullOak ? modelLeavesDoubleOak : (list == generalQuadsCullSpruce ? modelLeavesDoubleSpruce : p_getLeavesModel_0_))))); + } + } + + public static void updateLeavesModels() + { + List list = new ArrayList(); + modelLeavesCullAcacia = getModelCull("acacia", list); + modelLeavesCullBirch = getModelCull("birch", list); + modelLeavesCullDarkOak = getModelCull("dark_oak", list); + modelLeavesCullJungle = getModelCull("jungle", list); + modelLeavesCullOak = getModelCull("oak", list); + modelLeavesCullSpruce = getModelCull("spruce", list); + generalQuadsCullAcacia = getGeneralQuadsSafe(modelLeavesCullAcacia); + generalQuadsCullBirch = getGeneralQuadsSafe(modelLeavesCullBirch); + generalQuadsCullDarkOak = getGeneralQuadsSafe(modelLeavesCullDarkOak); + generalQuadsCullJungle = getGeneralQuadsSafe(modelLeavesCullJungle); + generalQuadsCullOak = getGeneralQuadsSafe(modelLeavesCullOak); + generalQuadsCullSpruce = getGeneralQuadsSafe(modelLeavesCullSpruce); + modelLeavesDoubleAcacia = getModelDoubleFace(modelLeavesCullAcacia); + modelLeavesDoubleBirch = getModelDoubleFace(modelLeavesCullBirch); + modelLeavesDoubleDarkOak = getModelDoubleFace(modelLeavesCullDarkOak); + modelLeavesDoubleJungle = getModelDoubleFace(modelLeavesCullJungle); + modelLeavesDoubleOak = getModelDoubleFace(modelLeavesCullOak); + modelLeavesDoubleSpruce = getModelDoubleFace(modelLeavesCullSpruce); + + if (list.size() > 0) + { + Config.dbg("Enable face culling: " + Config.arrayToString(list.toArray())); + } + } + + private static List getGeneralQuadsSafe(IBakedModel p_getGeneralQuadsSafe_0_) + { + return p_getGeneralQuadsSafe_0_ == null ? null : p_getGeneralQuadsSafe_0_.getGeneralQuads(); + } + + static IBakedModel getModelCull(String p_getModelCull_0_, List p_getModelCull_1_) + { + ModelManager modelmanager = Config.getModelManager(); + + if (modelmanager == null) + { + return null; + } + else + { + ResourceLocation resourcelocation = new ResourceLocation("blockstates/" + p_getModelCull_0_ + "_leaves.json"); + + if (Config.getDefiningResourcePack(resourcelocation) != Config.getDefaultResourcePack()) + { + return null; + } + else + { + ResourceLocation resourcelocation1 = new ResourceLocation("models/block/" + p_getModelCull_0_ + "_leaves.json"); + + if (Config.getDefiningResourcePack(resourcelocation1) != Config.getDefaultResourcePack()) + { + return null; + } + else + { + ModelResourceLocation modelresourcelocation = new ModelResourceLocation(p_getModelCull_0_ + "_leaves", "normal"); + IBakedModel ibakedmodel = modelmanager.getModel(modelresourcelocation); + + if (ibakedmodel != null && ibakedmodel != modelmanager.getMissingModel()) + { + List list = ibakedmodel.getGeneralQuads(); + + if (list.size() == 0) + { + return ibakedmodel; + } + else if (list.size() != 6) + { + return null; + } + else + { + for (Object bakedquad : list) + { + List list1 = ibakedmodel.getFaceQuads(((BakedQuad) bakedquad).getFace()); + + if (list1.size() > 0) + { + return null; + } + + list1.add(bakedquad); + } + + list.clear(); + p_getModelCull_1_.add(p_getModelCull_0_ + "_leaves"); + return ibakedmodel; + } + } + else + { + return null; + } + } + } + } + } + + private static IBakedModel getModelDoubleFace(IBakedModel p_getModelDoubleFace_0_) + { + if (p_getModelDoubleFace_0_ == null) + { + return null; + } + else if (p_getModelDoubleFace_0_.getGeneralQuads().size() > 0) + { + Config.warn("SmartLeaves: Model is not cube, general quads: " + p_getModelDoubleFace_0_.getGeneralQuads().size() + ", model: " + p_getModelDoubleFace_0_); + return p_getModelDoubleFace_0_; + } + else + { + EnumFacing[] aenumfacing = EnumFacing.VALUES; + + for (int i = 0; i < aenumfacing.length; ++i) + { + EnumFacing enumfacing = aenumfacing[i]; + List list = p_getModelDoubleFace_0_.getFaceQuads(enumfacing); + + if (list.size() != 1) + { + Config.warn("SmartLeaves: Model is not cube, side: " + enumfacing + ", quads: " + list.size() + ", model: " + p_getModelDoubleFace_0_); + return p_getModelDoubleFace_0_; + } + } + + IBakedModel ibakedmodel = ModelUtils.duplicateModel(p_getModelDoubleFace_0_); + List[] alist = new List[aenumfacing.length]; + + for (int k = 0; k < aenumfacing.length; ++k) + { + EnumFacing enumfacing1 = aenumfacing[k]; + List list1 = ibakedmodel.getFaceQuads(enumfacing1); + BakedQuad bakedquad = (BakedQuad)list1.get(0); + BakedQuad bakedquad1 = new BakedQuad((int[])bakedquad.getVertexData().clone(), bakedquad.getTintIndex(), bakedquad.getFace(), bakedquad.getSprite()); + int[] aint = bakedquad1.getVertexData(); + int[] aint1 = (int[])aint.clone(); + int j = aint.length / 4; + System.arraycopy(aint, 0 * j, aint1, 3 * j, j); + System.arraycopy(aint, 1 * j, aint1, 2 * j, j); + System.arraycopy(aint, 2 * j, aint1, 1 * j, j); + System.arraycopy(aint, 3 * j, aint1, 0 * j, j); + System.arraycopy(aint1, 0, aint, 0, aint1.length); + list1.add(bakedquad1); + } + + return ibakedmodel; + } + } +} diff --git a/src/minecraft/optifine/StrUtils.java b/src/minecraft/optifine/StrUtils.java new file mode 100644 index 0000000..56701a3 --- /dev/null +++ b/src/minecraft/optifine/StrUtils.java @@ -0,0 +1,725 @@ +package optifine; + +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +public class StrUtils +{ + public static boolean equalsMask(String p_equalsMask_0_, String p_equalsMask_1_, char p_equalsMask_2_, char p_equalsMask_3_) + { + if (p_equalsMask_1_ != null && p_equalsMask_0_ != null) + { + if (p_equalsMask_1_.indexOf(p_equalsMask_2_) < 0) + { + return p_equalsMask_1_.indexOf(p_equalsMask_3_) < 0 ? p_equalsMask_1_.equals(p_equalsMask_0_) : equalsMaskSingle(p_equalsMask_0_, p_equalsMask_1_, p_equalsMask_3_); + } + else + { + List list = new ArrayList(); + String s = "" + p_equalsMask_2_; + + if (p_equalsMask_1_.startsWith(s)) + { + list.add(""); + } + + StringTokenizer stringtokenizer = new StringTokenizer(p_equalsMask_1_, s); + + while (stringtokenizer.hasMoreElements()) + { + list.add(stringtokenizer.nextToken()); + } + + if (p_equalsMask_1_.endsWith(s)) + { + list.add(""); + } + + String s1 = (String)list.get(0); + + if (!startsWithMaskSingle(p_equalsMask_0_, s1, p_equalsMask_3_)) + { + return false; + } + else + { + String s2 = (String)list.get(list.size() - 1); + + if (!endsWithMaskSingle(p_equalsMask_0_, s2, p_equalsMask_3_)) + { + return false; + } + else + { + int i = 0; + + for (int j = 0; j < ((List)list).size(); ++j) + { + String s3 = (String)list.get(j); + + if (s3.length() > 0) + { + int k = indexOfMaskSingle(p_equalsMask_0_, s3, i, p_equalsMask_3_); + + if (k < 0) + { + return false; + } + + i = k + s3.length(); + } + } + + return true; + } + } + } + } + else + { + return p_equalsMask_1_ == p_equalsMask_0_; + } + } + + private static boolean equalsMaskSingle(String p_equalsMaskSingle_0_, String p_equalsMaskSingle_1_, char p_equalsMaskSingle_2_) + { + if (p_equalsMaskSingle_0_ != null && p_equalsMaskSingle_1_ != null) + { + if (p_equalsMaskSingle_0_.length() != p_equalsMaskSingle_1_.length()) + { + return false; + } + else + { + for (int i = 0; i < p_equalsMaskSingle_1_.length(); ++i) + { + char c0 = p_equalsMaskSingle_1_.charAt(i); + + if (c0 != p_equalsMaskSingle_2_ && p_equalsMaskSingle_0_.charAt(i) != c0) + { + return false; + } + } + + return true; + } + } + else + { + return p_equalsMaskSingle_0_ == p_equalsMaskSingle_1_; + } + } + + private static int indexOfMaskSingle(String p_indexOfMaskSingle_0_, String p_indexOfMaskSingle_1_, int p_indexOfMaskSingle_2_, char p_indexOfMaskSingle_3_) + { + if (p_indexOfMaskSingle_0_ != null && p_indexOfMaskSingle_1_ != null) + { + if (p_indexOfMaskSingle_2_ >= 0 && p_indexOfMaskSingle_2_ <= p_indexOfMaskSingle_0_.length()) + { + if (p_indexOfMaskSingle_0_.length() < p_indexOfMaskSingle_2_ + p_indexOfMaskSingle_1_.length()) + { + return -1; + } + else + { + for (int i = p_indexOfMaskSingle_2_; i + p_indexOfMaskSingle_1_.length() <= p_indexOfMaskSingle_0_.length(); ++i) + { + String s = p_indexOfMaskSingle_0_.substring(i, i + p_indexOfMaskSingle_1_.length()); + + if (equalsMaskSingle(s, p_indexOfMaskSingle_1_, p_indexOfMaskSingle_3_)) + { + return i; + } + } + + return -1; + } + } + else + { + return -1; + } + } + else + { + return -1; + } + } + + private static boolean endsWithMaskSingle(String p_endsWithMaskSingle_0_, String p_endsWithMaskSingle_1_, char p_endsWithMaskSingle_2_) + { + if (p_endsWithMaskSingle_0_ != null && p_endsWithMaskSingle_1_ != null) + { + if (p_endsWithMaskSingle_0_.length() < p_endsWithMaskSingle_1_.length()) + { + return false; + } + else + { + String s = p_endsWithMaskSingle_0_.substring(p_endsWithMaskSingle_0_.length() - p_endsWithMaskSingle_1_.length(), p_endsWithMaskSingle_0_.length()); + return equalsMaskSingle(s, p_endsWithMaskSingle_1_, p_endsWithMaskSingle_2_); + } + } + else + { + return p_endsWithMaskSingle_0_ == p_endsWithMaskSingle_1_; + } + } + + private static boolean startsWithMaskSingle(String p_startsWithMaskSingle_0_, String p_startsWithMaskSingle_1_, char p_startsWithMaskSingle_2_) + { + if (p_startsWithMaskSingle_0_ != null && p_startsWithMaskSingle_1_ != null) + { + if (p_startsWithMaskSingle_0_.length() < p_startsWithMaskSingle_1_.length()) + { + return false; + } + else + { + String s = p_startsWithMaskSingle_0_.substring(0, p_startsWithMaskSingle_1_.length()); + return equalsMaskSingle(s, p_startsWithMaskSingle_1_, p_startsWithMaskSingle_2_); + } + } + else + { + return p_startsWithMaskSingle_0_ == p_startsWithMaskSingle_1_; + } + } + + public static boolean equalsMask(String p_equalsMask_0_, String[] p_equalsMask_1_, char p_equalsMask_2_) + { + for (int i = 0; i < p_equalsMask_1_.length; ++i) + { + String s = p_equalsMask_1_[i]; + + if (equalsMask(p_equalsMask_0_, s, p_equalsMask_2_)) + { + return true; + } + } + + return false; + } + + public static boolean equalsMask(String p_equalsMask_0_, String p_equalsMask_1_, char p_equalsMask_2_) + { + if (p_equalsMask_1_ != null && p_equalsMask_0_ != null) + { + if (p_equalsMask_1_.indexOf(p_equalsMask_2_) < 0) + { + return p_equalsMask_1_.equals(p_equalsMask_0_); + } + else + { + List list = new ArrayList(); + String s = "" + p_equalsMask_2_; + + if (p_equalsMask_1_.startsWith(s)) + { + list.add(""); + } + + StringTokenizer stringtokenizer = new StringTokenizer(p_equalsMask_1_, s); + + while (stringtokenizer.hasMoreElements()) + { + list.add(stringtokenizer.nextToken()); + } + + if (p_equalsMask_1_.endsWith(s)) + { + list.add(""); + } + + String s1 = (String)list.get(0); + + if (!p_equalsMask_0_.startsWith(s1)) + { + return false; + } + else + { + String s2 = (String)list.get(list.size() - 1); + + if (!p_equalsMask_0_.endsWith(s2)) + { + return false; + } + else + { + int i = 0; + + for (int j = 0; j < ((List)list).size(); ++j) + { + String s3 = (String)list.get(j); + + if (s3.length() > 0) + { + int k = p_equalsMask_0_.indexOf(s3, i); + + if (k < 0) + { + return false; + } + + i = k + s3.length(); + } + } + + return true; + } + } + } + } + else + { + return p_equalsMask_1_ == p_equalsMask_0_; + } + } + + public static String[] split(String p_split_0_, String p_split_1_) + { + if (p_split_0_ != null && p_split_0_.length() > 0) + { + if (p_split_1_ == null) + { + return new String[] {p_split_0_}; + } + else + { + List list = new ArrayList(); + int i = 0; + + for (int j = 0; j < p_split_0_.length(); ++j) + { + char c0 = p_split_0_.charAt(j); + + if (equals(c0, p_split_1_)) + { + list.add(p_split_0_.substring(i, j)); + i = j + 1; + } + } + + list.add(p_split_0_.substring(i, p_split_0_.length())); + return (String[])((String[])list.toArray(new String[list.size()])); + } + } + else + { + return new String[0]; + } + } + + private static boolean equals(char p_equals_0_, String p_equals_1_) + { + for (int i = 0; i < p_equals_1_.length(); ++i) + { + if (p_equals_1_.charAt(i) == p_equals_0_) + { + return true; + } + } + + return false; + } + + public static boolean equalsTrim(String p_equalsTrim_0_, String p_equalsTrim_1_) + { + if (p_equalsTrim_0_ != null) + { + p_equalsTrim_0_ = p_equalsTrim_0_.trim(); + } + + if (p_equalsTrim_1_ != null) + { + p_equalsTrim_1_ = p_equalsTrim_1_.trim(); + } + + return equals(p_equalsTrim_0_, p_equalsTrim_1_); + } + + public static boolean isEmpty(String p_isEmpty_0_) + { + return p_isEmpty_0_ == null ? true : p_isEmpty_0_.trim().length() <= 0; + } + + public static String stringInc(String p_stringInc_0_) + { + int i = parseInt(p_stringInc_0_, -1); + + if (i == -1) + { + return ""; + } + else + { + ++i; + String s = "" + i; + return s.length() > p_stringInc_0_.length() ? "" : fillLeft("" + i, p_stringInc_0_.length(), '0'); + } + } + + public static int parseInt(String p_parseInt_0_, int p_parseInt_1_) + { + if (p_parseInt_0_ == null) + { + return p_parseInt_1_; + } + else + { + try + { + return Integer.parseInt(p_parseInt_0_); + } + catch (NumberFormatException var3) + { + return p_parseInt_1_; + } + } + } + + public static boolean isFilled(String p_isFilled_0_) + { + return !isEmpty(p_isFilled_0_); + } + + public static String addIfNotContains(String p_addIfNotContains_0_, String p_addIfNotContains_1_) + { + for (int i = 0; i < p_addIfNotContains_1_.length(); ++i) + { + if (p_addIfNotContains_0_.indexOf(p_addIfNotContains_1_.charAt(i)) < 0) + { + p_addIfNotContains_0_ = p_addIfNotContains_0_ + p_addIfNotContains_1_.charAt(i); + } + } + + return p_addIfNotContains_0_; + } + + public static String fillLeft(String p_fillLeft_0_, int p_fillLeft_1_, char p_fillLeft_2_) + { + if (p_fillLeft_0_ == null) + { + p_fillLeft_0_ = ""; + } + + if (p_fillLeft_0_.length() >= p_fillLeft_1_) + { + return p_fillLeft_0_; + } + else + { + StringBuffer stringbuffer = new StringBuffer(p_fillLeft_0_); + + while (stringbuffer.length() < p_fillLeft_1_) + { + stringbuffer.insert(0, (char)p_fillLeft_2_); + } + + return stringbuffer.toString(); + } + } + + public static String fillRight(String p_fillRight_0_, int p_fillRight_1_, char p_fillRight_2_) + { + if (p_fillRight_0_ == null) + { + p_fillRight_0_ = ""; + } + + if (p_fillRight_0_.length() >= p_fillRight_1_) + { + return p_fillRight_0_; + } + else + { + StringBuffer stringbuffer = new StringBuffer(p_fillRight_0_); + + while (stringbuffer.length() < p_fillRight_1_) + { + stringbuffer.append(p_fillRight_2_); + } + + return stringbuffer.toString(); + } + } + + public static boolean equals(Object p_equals_0_, Object p_equals_1_) + { + return p_equals_0_ == p_equals_1_ ? true : (p_equals_0_ != null && p_equals_0_.equals(p_equals_1_) ? true : p_equals_1_ != null && p_equals_1_.equals(p_equals_0_)); + } + + public static boolean startsWith(String p_startsWith_0_, String[] p_startsWith_1_) + { + if (p_startsWith_0_ == null) + { + return false; + } + else if (p_startsWith_1_ == null) + { + return false; + } + else + { + for (int i = 0; i < p_startsWith_1_.length; ++i) + { + String s = p_startsWith_1_[i]; + + if (p_startsWith_0_.startsWith(s)) + { + return true; + } + } + + return false; + } + } + + public static boolean endsWith(String p_endsWith_0_, String[] p_endsWith_1_) + { + if (p_endsWith_0_ == null) + { + return false; + } + else if (p_endsWith_1_ == null) + { + return false; + } + else + { + for (int i = 0; i < p_endsWith_1_.length; ++i) + { + String s = p_endsWith_1_[i]; + + if (p_endsWith_0_.endsWith(s)) + { + return true; + } + } + + return false; + } + } + + public static String removePrefix(String p_removePrefix_0_, String p_removePrefix_1_) + { + if (p_removePrefix_0_ != null && p_removePrefix_1_ != null) + { + if (p_removePrefix_0_.startsWith(p_removePrefix_1_)) + { + p_removePrefix_0_ = p_removePrefix_0_.substring(p_removePrefix_1_.length()); + } + + return p_removePrefix_0_; + } + else + { + return p_removePrefix_0_; + } + } + + public static String removeSuffix(String p_removeSuffix_0_, String p_removeSuffix_1_) + { + if (p_removeSuffix_0_ != null && p_removeSuffix_1_ != null) + { + if (p_removeSuffix_0_.endsWith(p_removeSuffix_1_)) + { + p_removeSuffix_0_ = p_removeSuffix_0_.substring(0, p_removeSuffix_0_.length() - p_removeSuffix_1_.length()); + } + + return p_removeSuffix_0_; + } + else + { + return p_removeSuffix_0_; + } + } + + public static String replaceSuffix(String p_replaceSuffix_0_, String p_replaceSuffix_1_, String p_replaceSuffix_2_) + { + if (p_replaceSuffix_0_ != null && p_replaceSuffix_1_ != null) + { + if (p_replaceSuffix_2_ == null) + { + p_replaceSuffix_2_ = ""; + } + + if (p_replaceSuffix_0_.endsWith(p_replaceSuffix_1_)) + { + p_replaceSuffix_0_ = p_replaceSuffix_0_.substring(0, p_replaceSuffix_0_.length() - p_replaceSuffix_1_.length()); + } + + return p_replaceSuffix_0_ + p_replaceSuffix_2_; + } + else + { + return p_replaceSuffix_0_; + } + } + + public static int findPrefix(String[] p_findPrefix_0_, String p_findPrefix_1_) + { + if (p_findPrefix_0_ != null && p_findPrefix_1_ != null) + { + for (int i = 0; i < p_findPrefix_0_.length; ++i) + { + String s = p_findPrefix_0_[i]; + + if (s.startsWith(p_findPrefix_1_)) + { + return i; + } + } + + return -1; + } + else + { + return -1; + } + } + + public static int findSuffix(String[] p_findSuffix_0_, String p_findSuffix_1_) + { + if (p_findSuffix_0_ != null && p_findSuffix_1_ != null) + { + for (int i = 0; i < p_findSuffix_0_.length; ++i) + { + String s = p_findSuffix_0_[i]; + + if (s.endsWith(p_findSuffix_1_)) + { + return i; + } + } + + return -1; + } + else + { + return -1; + } + } + + public static String[] remove(String[] p_remove_0_, int p_remove_1_, int p_remove_2_) + { + if (p_remove_0_ == null) + { + return p_remove_0_; + } + else if (p_remove_2_ > 0 && p_remove_1_ < p_remove_0_.length) + { + if (p_remove_1_ >= p_remove_2_) + { + return p_remove_0_; + } + else + { + List list = new ArrayList(p_remove_0_.length); + + for (int i = 0; i < p_remove_0_.length; ++i) + { + String s = p_remove_0_[i]; + + if (i < p_remove_1_ || i >= p_remove_2_) + { + list.add(s); + } + } + + String[] astring = (String[])list.toArray(new String[list.size()]); + return astring; + } + } + else + { + return p_remove_0_; + } + } + + public static String removeSuffix(String p_removeSuffix_0_, String[] p_removeSuffix_1_) + { + if (p_removeSuffix_0_ != null && p_removeSuffix_1_ != null) + { + int i = p_removeSuffix_0_.length(); + + for (int j = 0; j < p_removeSuffix_1_.length; ++j) + { + String s = p_removeSuffix_1_[j]; + p_removeSuffix_0_ = removeSuffix(p_removeSuffix_0_, s); + + if (p_removeSuffix_0_.length() != i) + { + break; + } + } + + return p_removeSuffix_0_; + } + else + { + return p_removeSuffix_0_; + } + } + + public static String removePrefix(String p_removePrefix_0_, String[] p_removePrefix_1_) + { + if (p_removePrefix_0_ != null && p_removePrefix_1_ != null) + { + int i = p_removePrefix_0_.length(); + + for (int j = 0; j < p_removePrefix_1_.length; ++j) + { + String s = p_removePrefix_1_[j]; + p_removePrefix_0_ = removePrefix(p_removePrefix_0_, s); + + if (p_removePrefix_0_.length() != i) + { + break; + } + } + + return p_removePrefix_0_; + } + else + { + return p_removePrefix_0_; + } + } + + public static String removePrefixSuffix(String p_removePrefixSuffix_0_, String[] p_removePrefixSuffix_1_, String[] p_removePrefixSuffix_2_) + { + p_removePrefixSuffix_0_ = removePrefix(p_removePrefixSuffix_0_, p_removePrefixSuffix_1_); + p_removePrefixSuffix_0_ = removeSuffix(p_removePrefixSuffix_0_, p_removePrefixSuffix_2_); + return p_removePrefixSuffix_0_; + } + + public static String removePrefixSuffix(String p_removePrefixSuffix_0_, String p_removePrefixSuffix_1_, String p_removePrefixSuffix_2_) + { + return removePrefixSuffix(p_removePrefixSuffix_0_, new String[] {p_removePrefixSuffix_1_}, new String[] {p_removePrefixSuffix_2_}); + } + + public static String getSegment(String p_getSegment_0_, String p_getSegment_1_, String p_getSegment_2_) + { + if (p_getSegment_0_ != null && p_getSegment_1_ != null && p_getSegment_2_ != null) + { + int i = p_getSegment_0_.indexOf(p_getSegment_1_); + + if (i < 0) + { + return null; + } + else + { + int j = p_getSegment_0_.indexOf(p_getSegment_2_, i); + return j < 0 ? null : p_getSegment_0_.substring(i, j + p_getSegment_2_.length()); + } + } + else + { + return null; + } + } +} diff --git a/src/minecraft/optifine/TextureAnimation.java b/src/minecraft/optifine/TextureAnimation.java new file mode 100644 index 0000000..02b00a8 --- /dev/null +++ b/src/minecraft/optifine/TextureAnimation.java @@ -0,0 +1,185 @@ +package optifine; + +import java.nio.ByteBuffer; +import java.util.Properties; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class TextureAnimation +{ + private String srcTex = null; + private String dstTex = null; + ResourceLocation dstTexLoc = null; + private int dstTextId = -1; + private int dstX = 0; + private int dstY = 0; + private int frameWidth = 0; + private int frameHeight = 0; + private TextureAnimationFrame[] frames = null; + private int activeFrame = 0; + byte[] srcData = null; + private ByteBuffer imageData = null; + + public TextureAnimation(String p_i95_1_, byte[] p_i95_2_, String p_i95_3_, ResourceLocation p_i95_4_, int p_i95_5_, int p_i95_6_, int p_i95_7_, int p_i95_8_, Properties p_i95_9_, int p_i95_10_) + { + this.srcTex = p_i95_1_; + this.dstTex = p_i95_3_; + this.dstTexLoc = p_i95_4_; + this.dstX = p_i95_5_; + this.dstY = p_i95_6_; + this.frameWidth = p_i95_7_; + this.frameHeight = p_i95_8_; + int i = p_i95_7_ * p_i95_8_ * 4; + + if (p_i95_2_.length % i != 0) + { + Config.warn("Invalid animated texture length: " + p_i95_2_.length + ", frameWidth: " + p_i95_7_ + ", frameHeight: " + p_i95_8_); + } + + this.srcData = p_i95_2_; + int j = p_i95_2_.length / i; + + if (p_i95_9_.get("tile.0") != null) + { + for (int k = 0; p_i95_9_.get("tile." + k) != null; ++k) + { + j = k + 1; + } + } + + String s2 = (String)p_i95_9_.get("duration"); + int l = Config.parseInt(s2, p_i95_10_); + this.frames = new TextureAnimationFrame[j]; + + for (int i1 = 0; i1 < this.frames.length; ++i1) + { + String s = (String)p_i95_9_.get("tile." + i1); + int j1 = Config.parseInt(s, i1); + String s1 = (String)p_i95_9_.get("duration." + i1); + int k1 = Config.parseInt(s1, l); + TextureAnimationFrame textureanimationframe = new TextureAnimationFrame(j1, k1); + this.frames[i1] = textureanimationframe; + } + } + + public boolean nextFrame() + { + if (this.frames.length <= 0) + { + return false; + } + else + { + if (this.activeFrame >= this.frames.length) + { + this.activeFrame = 0; + } + + TextureAnimationFrame textureanimationframe = this.frames[this.activeFrame]; + ++textureanimationframe.counter; + + if (textureanimationframe.counter < textureanimationframe.duration) + { + return false; + } + else + { + textureanimationframe.counter = 0; + ++this.activeFrame; + + if (this.activeFrame >= this.frames.length) + { + this.activeFrame = 0; + } + + return true; + } + } + } + + public int getActiveFrameIndex() + { + if (this.frames.length <= 0) + { + return 0; + } + else + { + if (this.activeFrame >= this.frames.length) + { + this.activeFrame = 0; + } + + TextureAnimationFrame textureanimationframe = this.frames[this.activeFrame]; + return textureanimationframe.index; + } + } + + public int getFrameCount() + { + return this.frames.length; + } + + public boolean updateTexture() + { + if (this.dstTextId < 0) + { + ITextureObject itextureobject = TextureUtils.getTexture(this.dstTexLoc); + + if (itextureobject == null) + { + return false; + } + + this.dstTextId = itextureobject.getGlTextureId(); + } + + if (this.imageData == null) + { + this.imageData = GLAllocation.createDirectByteBuffer(this.srcData.length); + this.imageData.put(this.srcData); + this.srcData = null; + } + + if (!this.nextFrame()) + { + return false; + } + else + { + int k = this.frameWidth * this.frameHeight * 4; + int i = this.getActiveFrameIndex(); + int j = k * i; + + if (j + k > this.imageData.capacity()) + { + return false; + } + else + { + this.imageData.position(j); + GlStateManager.bindTexture(this.dstTextId); + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, this.dstX, this.dstY, this.frameWidth, this.frameHeight, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)this.imageData); + return true; + } + } + } + + public String getSrcTex() + { + return this.srcTex; + } + + public String getDstTex() + { + return this.dstTex; + } + + public ResourceLocation getDstTexLoc() + { + return this.dstTexLoc; + } +} diff --git a/src/minecraft/optifine/TextureAnimationFrame.java b/src/minecraft/optifine/TextureAnimationFrame.java new file mode 100644 index 0000000..00058d7 --- /dev/null +++ b/src/minecraft/optifine/TextureAnimationFrame.java @@ -0,0 +1,14 @@ +package optifine; + +public class TextureAnimationFrame +{ + public int index = 0; + public int duration = 0; + public int counter = 0; + + public TextureAnimationFrame(int p_i96_1_, int p_i96_2_) + { + this.index = p_i96_1_; + this.duration = p_i96_2_; + } +} diff --git a/src/minecraft/optifine/TextureAnimations.java b/src/minecraft/optifine/TextureAnimations.java new file mode 100644 index 0000000..3f64afb --- /dev/null +++ b/src/minecraft/optifine/TextureAnimations.java @@ -0,0 +1,292 @@ +package optifine; + +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.image.BufferedImage; +import java.awt.image.ImageObserver; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import javax.imageio.ImageIO; +import net.minecraft.client.resources.IResourcePack; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.util.ResourceLocation; + +public class TextureAnimations +{ + private static TextureAnimation[] textureAnimations = null; + + public static void reset() + { + textureAnimations = null; + } + + public static void update() + { + textureAnimations = null; + IResourcePack[] airesourcepack = Config.getResourcePacks(); + textureAnimations = getTextureAnimations(airesourcepack); + + if (Config.isAnimatedTextures()) + { + updateAnimations(); + } + } + + public static void updateCustomAnimations() + { + if (textureAnimations != null) + { + if (Config.isAnimatedTextures()) + { + updateAnimations(); + } + } + } + + public static void updateAnimations() + { + if (textureAnimations != null) + { + for (int i = 0; i < textureAnimations.length; ++i) + { + TextureAnimation textureanimation = textureAnimations[i]; + textureanimation.updateTexture(); + } + } + } + + public static TextureAnimation[] getTextureAnimations(IResourcePack[] p_getTextureAnimations_0_) + { + List list = new ArrayList(); + + for (int i = 0; i < p_getTextureAnimations_0_.length; ++i) + { + IResourcePack iresourcepack = p_getTextureAnimations_0_[i]; + TextureAnimation[] atextureanimation = getTextureAnimations(iresourcepack); + + if (atextureanimation != null) + { + list.addAll(Arrays.asList(atextureanimation)); + } + } + + TextureAnimation[] atextureanimation1 = (TextureAnimation[])((TextureAnimation[])list.toArray(new TextureAnimation[list.size()])); + return atextureanimation1; + } + + public static TextureAnimation[] getTextureAnimations(IResourcePack p_getTextureAnimations_0_) + { + String[] astring = ResUtils.collectFiles(p_getTextureAnimations_0_, (String)"mcpatcher/anim", (String)".properties", (String[])null); + + if (astring.length <= 0) + { + return null; + } + else + { + List list = new ArrayList(); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + Config.dbg("Texture animation: " + s); + + try + { + ResourceLocation resourcelocation = new ResourceLocation(s); + InputStream inputstream = p_getTextureAnimations_0_.getInputStream(resourcelocation); + Properties properties = new Properties(); + properties.load(inputstream); + TextureAnimation textureanimation = makeTextureAnimation(properties, resourcelocation); + + if (textureanimation != null) + { + ResourceLocation resourcelocation1 = new ResourceLocation(textureanimation.getDstTex()); + + if (Config.getDefiningResourcePack(resourcelocation1) != p_getTextureAnimations_0_) + { + Config.dbg("Skipped: " + s + ", target texture not loaded from same resource pack"); + } + else + { + list.add(textureanimation); + } + } + } + catch (FileNotFoundException filenotfoundexception) + { + Config.warn("File not found: " + filenotfoundexception.getMessage()); + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + + TextureAnimation[] atextureanimation = (TextureAnimation[])((TextureAnimation[])list.toArray(new TextureAnimation[list.size()])); + return atextureanimation; + } + } + + public static TextureAnimation makeTextureAnimation(Properties p_makeTextureAnimation_0_, ResourceLocation p_makeTextureAnimation_1_) + { + String s = p_makeTextureAnimation_0_.getProperty("from"); + String s1 = p_makeTextureAnimation_0_.getProperty("to"); + int i = Config.parseInt(p_makeTextureAnimation_0_.getProperty("x"), -1); + int j = Config.parseInt(p_makeTextureAnimation_0_.getProperty("y"), -1); + int k = Config.parseInt(p_makeTextureAnimation_0_.getProperty("w"), -1); + int l = Config.parseInt(p_makeTextureAnimation_0_.getProperty("h"), -1); + + if (s != null && s1 != null) + { + if (i >= 0 && j >= 0 && k >= 0 && l >= 0) + { + s = s.trim(); + s1 = s1.trim(); + String s2 = TextureUtils.getBasePath(p_makeTextureAnimation_1_.getResourcePath()); + s = TextureUtils.fixResourcePath(s, s2); + s1 = TextureUtils.fixResourcePath(s1, s2); + byte[] abyte = getCustomTextureData(s, k); + + if (abyte == null) + { + Config.warn("TextureAnimation: Source texture not found: " + s1); + return null; + } + else + { + ResourceLocation resourcelocation = new ResourceLocation(s1); + + if (!Config.hasResource(resourcelocation)) + { + Config.warn("TextureAnimation: Target texture not found: " + s1); + return null; + } + else + { + TextureAnimation textureanimation = new TextureAnimation(s, abyte, s1, resourcelocation, i, j, k, l, p_makeTextureAnimation_0_, 1); + return textureanimation; + } + } + } + else + { + Config.warn("TextureAnimation: Invalid coordinates"); + return null; + } + } + else + { + Config.warn("TextureAnimation: Source or target texture not specified"); + return null; + } + } + + public static byte[] getCustomTextureData(String p_getCustomTextureData_0_, int p_getCustomTextureData_1_) + { + byte[] abyte = loadImage(p_getCustomTextureData_0_, p_getCustomTextureData_1_); + + if (abyte == null) + { + abyte = loadImage("/anim" + p_getCustomTextureData_0_, p_getCustomTextureData_1_); + } + + return abyte; + } + + private static byte[] loadImage(String p_loadImage_0_, int p_loadImage_1_) + { + GameSettings gamesettings = Config.getGameSettings(); + + try + { + ResourceLocation resourcelocation = new ResourceLocation(p_loadImage_0_); + InputStream inputstream = Config.getResourceStream(resourcelocation); + + if (inputstream == null) + { + return null; + } + else + { + BufferedImage bufferedimage = readTextureImage(inputstream); + inputstream.close(); + + if (bufferedimage == null) + { + return null; + } + else + { + if (p_loadImage_1_ > 0 && bufferedimage.getWidth() != p_loadImage_1_) + { + double d0 = (double)(bufferedimage.getHeight() / bufferedimage.getWidth()); + int j = (int)((double)p_loadImage_1_ * d0); + bufferedimage = scaleBufferedImage(bufferedimage, p_loadImage_1_, j); + } + + int k2 = bufferedimage.getWidth(); + int i = bufferedimage.getHeight(); + int[] aint = new int[k2 * i]; + byte[] abyte = new byte[k2 * i * 4]; + bufferedimage.getRGB(0, 0, k2, i, aint, 0, k2); + + for (int k = 0; k < aint.length; ++k) + { + int l = aint[k] >> 24 & 255; + int i1 = aint[k] >> 16 & 255; + int j1 = aint[k] >> 8 & 255; + int k1 = aint[k] & 255; + + if (gamesettings != null && gamesettings.anaglyph) + { + int l1 = (i1 * 30 + j1 * 59 + k1 * 11) / 100; + int i2 = (i1 * 30 + j1 * 70) / 100; + int j2 = (i1 * 30 + k1 * 70) / 100; + i1 = l1; + j1 = i2; + k1 = j2; + } + + abyte[k * 4 + 0] = (byte)i1; + abyte[k * 4 + 1] = (byte)j1; + abyte[k * 4 + 2] = (byte)k1; + abyte[k * 4 + 3] = (byte)l; + } + + return abyte; + } + } + } + catch (FileNotFoundException var18) + { + return null; + } + catch (Exception exception) + { + exception.printStackTrace(); + return null; + } + } + + private static BufferedImage readTextureImage(InputStream p_readTextureImage_0_) throws IOException + { + BufferedImage bufferedimage = ImageIO.read(p_readTextureImage_0_); + p_readTextureImage_0_.close(); + return bufferedimage; + } + + public static BufferedImage scaleBufferedImage(BufferedImage p_scaleBufferedImage_0_, int p_scaleBufferedImage_1_, int p_scaleBufferedImage_2_) + { + BufferedImage bufferedimage = new BufferedImage(p_scaleBufferedImage_1_, p_scaleBufferedImage_2_, 2); + Graphics2D graphics2d = bufferedimage.createGraphics(); + graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + graphics2d.drawImage(p_scaleBufferedImage_0_, 0, 0, p_scaleBufferedImage_1_, p_scaleBufferedImage_2_, (ImageObserver)null); + return bufferedimage; + } +} diff --git a/src/minecraft/optifine/TextureUtils.java b/src/minecraft/optifine/TextureUtils.java new file mode 100644 index 0000000..56a230e --- /dev/null +++ b/src/minecraft/optifine/TextureUtils.java @@ -0,0 +1,586 @@ +package optifine; + +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.image.BufferedImage; +import java.awt.image.ImageObserver; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.IntBuffer; +import java.util.Iterator; +import javax.imageio.ImageIO; +import javax.imageio.ImageReader; +import javax.imageio.stream.ImageInputStream; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.ITickableTextureObject; +import net.minecraft.client.renderer.texture.SimpleTexture; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.IReloadableResourceManager; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; +import org.lwjgl.opengl.GLContext; +import shadersmod.client.MultiTexID; +import shadersmod.client.Shaders; + +public class TextureUtils +{ + public static final String texGrassTop = "grass_top"; + public static final String texStone = "stone"; + public static final String texDirt = "dirt"; + public static final String texCoarseDirt = "coarse_dirt"; + public static final String texGrassSide = "grass_side"; + public static final String texStoneslabSide = "stone_slab_side"; + public static final String texStoneslabTop = "stone_slab_top"; + public static final String texBedrock = "bedrock"; + public static final String texSand = "sand"; + public static final String texGravel = "gravel"; + public static final String texLogOak = "log_oak"; + public static final String texLogBigOak = "log_big_oak"; + public static final String texLogAcacia = "log_acacia"; + public static final String texLogSpruce = "log_spruce"; + public static final String texLogBirch = "log_birch"; + public static final String texLogJungle = "log_jungle"; + public static final String texLogOakTop = "log_oak_top"; + public static final String texLogBigOakTop = "log_big_oak_top"; + public static final String texLogAcaciaTop = "log_acacia_top"; + public static final String texLogSpruceTop = "log_spruce_top"; + public static final String texLogBirchTop = "log_birch_top"; + public static final String texLogJungleTop = "log_jungle_top"; + public static final String texLeavesOak = "leaves_oak"; + public static final String texLeavesBigOak = "leaves_big_oak"; + public static final String texLeavesAcacia = "leaves_acacia"; + public static final String texLeavesBirch = "leaves_birch"; + public static final String texLeavesSpuce = "leaves_spruce"; + public static final String texLeavesJungle = "leaves_jungle"; + public static final String texGoldOre = "gold_ore"; + public static final String texIronOre = "iron_ore"; + public static final String texCoalOre = "coal_ore"; + public static final String texObsidian = "obsidian"; + public static final String texGrassSideOverlay = "grass_side_overlay"; + public static final String texSnow = "snow"; + public static final String texGrassSideSnowed = "grass_side_snowed"; + public static final String texMyceliumSide = "mycelium_side"; + public static final String texMyceliumTop = "mycelium_top"; + public static final String texDiamondOre = "diamond_ore"; + public static final String texRedstoneOre = "redstone_ore"; + public static final String texLapisOre = "lapis_ore"; + public static final String texCactusSide = "cactus_side"; + public static final String texClay = "clay"; + public static final String texFarmlandWet = "farmland_wet"; + public static final String texFarmlandDry = "farmland_dry"; + public static final String texNetherrack = "netherrack"; + public static final String texSoulSand = "soul_sand"; + public static final String texGlowstone = "glowstone"; + public static final String texLeavesSpruce = "leaves_spruce"; + public static final String texLeavesSpruceOpaque = "leaves_spruce_opaque"; + public static final String texEndStone = "end_stone"; + public static final String texSandstoneTop = "sandstone_top"; + public static final String texSandstoneBottom = "sandstone_bottom"; + public static final String texRedstoneLampOff = "redstone_lamp_off"; + public static final String texRedstoneLampOn = "redstone_lamp_on"; + public static final String texWaterStill = "water_still"; + public static final String texWaterFlow = "water_flow"; + public static final String texLavaStill = "lava_still"; + public static final String texLavaFlow = "lava_flow"; + public static final String texFireLayer0 = "fire_layer_0"; + public static final String texFireLayer1 = "fire_layer_1"; + public static final String texPortal = "portal"; + public static final String texGlass = "glass"; + public static final String texGlassPaneTop = "glass_pane_top"; + public static final String texCompass = "compass"; + public static final String texClock = "clock"; + public static TextureAtlasSprite iconGrassTop; + public static TextureAtlasSprite iconGrassSide; + public static TextureAtlasSprite iconGrassSideOverlay; + public static TextureAtlasSprite iconSnow; + public static TextureAtlasSprite iconGrassSideSnowed; + public static TextureAtlasSprite iconMyceliumSide; + public static TextureAtlasSprite iconMyceliumTop; + public static TextureAtlasSprite iconWaterStill; + public static TextureAtlasSprite iconWaterFlow; + public static TextureAtlasSprite iconLavaStill; + public static TextureAtlasSprite iconLavaFlow; + public static TextureAtlasSprite iconPortal; + public static TextureAtlasSprite iconFireLayer0; + public static TextureAtlasSprite iconFireLayer1; + public static TextureAtlasSprite iconGlass; + public static TextureAtlasSprite iconGlassPaneTop; + public static TextureAtlasSprite iconCompass; + public static TextureAtlasSprite iconClock; + public static final String SPRITE_PREFIX_BLOCKS = "minecraft:blocks/"; + public static final String SPRITE_PREFIX_ITEMS = "minecraft:items/"; + private static IntBuffer staticBuffer = GLAllocation.createDirectIntBuffer(256); + + public static void update() + { + TextureMap texturemap = getTextureMapBlocks(); + + if (texturemap != null) + { + String s = "minecraft:blocks/"; + iconGrassTop = texturemap.getSpriteSafe(s + "grass_top"); + iconGrassSide = texturemap.getSpriteSafe(s + "grass_side"); + iconGrassSideOverlay = texturemap.getSpriteSafe(s + "grass_side_overlay"); + iconSnow = texturemap.getSpriteSafe(s + "snow"); + iconGrassSideSnowed = texturemap.getSpriteSafe(s + "grass_side_snowed"); + iconMyceliumSide = texturemap.getSpriteSafe(s + "mycelium_side"); + iconMyceliumTop = texturemap.getSpriteSafe(s + "mycelium_top"); + iconWaterStill = texturemap.getSpriteSafe(s + "water_still"); + iconWaterFlow = texturemap.getSpriteSafe(s + "water_flow"); + iconLavaStill = texturemap.getSpriteSafe(s + "lava_still"); + iconLavaFlow = texturemap.getSpriteSafe(s + "lava_flow"); + iconFireLayer0 = texturemap.getSpriteSafe(s + "fire_layer_0"); + iconFireLayer1 = texturemap.getSpriteSafe(s + "fire_layer_1"); + iconPortal = texturemap.getSpriteSafe(s + "portal"); + iconGlass = texturemap.getSpriteSafe(s + "glass"); + iconGlassPaneTop = texturemap.getSpriteSafe(s + "glass_pane_top"); + String s1 = "minecraft:items/"; + iconCompass = texturemap.getSpriteSafe(s1 + "compass"); + iconClock = texturemap.getSpriteSafe(s1 + "clock"); + } + } + + public static BufferedImage fixTextureDimensions(String p_fixTextureDimensions_0_, BufferedImage p_fixTextureDimensions_1_) + { + if (p_fixTextureDimensions_0_.startsWith("/mob/zombie") || p_fixTextureDimensions_0_.startsWith("/mob/pigzombie")) + { + int i = p_fixTextureDimensions_1_.getWidth(); + int j = p_fixTextureDimensions_1_.getHeight(); + + if (i == j * 2) + { + BufferedImage bufferedimage = new BufferedImage(i, j * 2, 2); + Graphics2D graphics2d = bufferedimage.createGraphics(); + graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + graphics2d.drawImage(p_fixTextureDimensions_1_, 0, 0, i, j, (ImageObserver)null); + return bufferedimage; + } + } + + return p_fixTextureDimensions_1_; + } + + public static int ceilPowerOfTwo(int p_ceilPowerOfTwo_0_) + { + int i; + + for (i = 1; i < p_ceilPowerOfTwo_0_; i *= 2) + { + ; + } + + return i; + } + + public static int getPowerOfTwo(int p_getPowerOfTwo_0_) + { + int i = 1; + int j; + + for (j = 0; i < p_getPowerOfTwo_0_; ++j) + { + i *= 2; + } + + return j; + } + + public static int twoToPower(int p_twoToPower_0_) + { + int i = 1; + + for (int j = 0; j < p_twoToPower_0_; ++j) + { + i *= 2; + } + + return i; + } + + public static ITextureObject getTexture(ResourceLocation p_getTexture_0_) + { + ITextureObject itextureobject = Config.getTextureManager().getTexture(p_getTexture_0_); + + if (itextureobject != null) + { + return itextureobject; + } + else if (!Config.hasResource(p_getTexture_0_)) + { + return null; + } + else + { + SimpleTexture simpletexture = new SimpleTexture(p_getTexture_0_); + Config.getTextureManager().loadTexture(p_getTexture_0_, simpletexture); + return simpletexture; + } + } + + public static void resourcesReloaded(IResourceManager p_resourcesReloaded_0_) + { + if (getTextureMapBlocks() != null) + { + Config.dbg("*** Reloading custom textures ***"); + CustomSky.reset(); + TextureAnimations.reset(); + update(); + NaturalTextures.update(); + BetterGrass.update(); + BetterSnow.update(); + TextureAnimations.update(); + CustomColors.update(); + CustomSky.update(); + RandomMobs.resetTextures(); + CustomItems.updateModels(); + Shaders.resourcesReloaded(); + Lang.resourcesReloaded(); + Config.updateTexturePackClouds(); + SmartLeaves.updateLeavesModels(); + Config.getTextureManager().tick(); + } + } + + public static TextureMap getTextureMapBlocks() + { + return Minecraft.getMinecraft().getTextureMapBlocks(); + } + + public static void registerResourceListener() + { + IResourceManager iresourcemanager = Config.getResourceManager(); + + if (iresourcemanager instanceof IReloadableResourceManager) + { + IReloadableResourceManager ireloadableresourcemanager = (IReloadableResourceManager)iresourcemanager; + IResourceManagerReloadListener iresourcemanagerreloadlistener = new IResourceManagerReloadListener() + { + public void onResourceManagerReload(IResourceManager resourceManager) + { + TextureUtils.resourcesReloaded(resourceManager); + } + }; + ireloadableresourcemanager.registerReloadListener(iresourcemanagerreloadlistener); + } + + ITickableTextureObject itickabletextureobject = new ITickableTextureObject() + { + public void tick() + { + TextureAnimations.updateCustomAnimations(); + } + public void loadTexture(IResourceManager resourceManager) throws IOException + { + } + public int getGlTextureId() + { + return 0; + } + public void setBlurMipmap(boolean p_174936_1_, boolean p_174936_2_) + { + } + public void restoreLastBlurMipmap() + { + } + public MultiTexID getMultiTexID() + { + return null; + } + }; + ResourceLocation resourcelocation = new ResourceLocation("optifine/TickableTextures"); + Config.getTextureManager().loadTickableTexture(resourcelocation, itickabletextureobject); + } + + public static String fixResourcePath(String p_fixResourcePath_0_, String p_fixResourcePath_1_) + { + String s = "assets/minecraft/"; + + if (p_fixResourcePath_0_.startsWith(s)) + { + p_fixResourcePath_0_ = p_fixResourcePath_0_.substring(s.length()); + return p_fixResourcePath_0_; + } + else if (p_fixResourcePath_0_.startsWith("./")) + { + p_fixResourcePath_0_ = p_fixResourcePath_0_.substring(2); + + if (!p_fixResourcePath_1_.endsWith("/")) + { + p_fixResourcePath_1_ = p_fixResourcePath_1_ + "/"; + } + + p_fixResourcePath_0_ = p_fixResourcePath_1_ + p_fixResourcePath_0_; + return p_fixResourcePath_0_; + } + else + { + if (p_fixResourcePath_0_.startsWith("/~")) + { + p_fixResourcePath_0_ = p_fixResourcePath_0_.substring(1); + } + + String s1 = "mcpatcher/"; + + if (p_fixResourcePath_0_.startsWith("~/")) + { + p_fixResourcePath_0_ = p_fixResourcePath_0_.substring(2); + p_fixResourcePath_0_ = s1 + p_fixResourcePath_0_; + return p_fixResourcePath_0_; + } + else if (p_fixResourcePath_0_.startsWith("/")) + { + p_fixResourcePath_0_ = s1 + p_fixResourcePath_0_.substring(1); + return p_fixResourcePath_0_; + } + else + { + return p_fixResourcePath_0_; + } + } + } + + public static String getBasePath(String p_getBasePath_0_) + { + int i = p_getBasePath_0_.lastIndexOf(47); + return i < 0 ? "" : p_getBasePath_0_.substring(0, i); + } + + public static void applyAnisotropicLevel() + { + if (GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic) + { + float f = GL11.glGetFloat(34047); + float f1 = (float)Config.getAnisotropicFilterLevel(); + f1 = Math.min(f1, f); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, 34046, f1); + } + } + + public static void bindTexture(int p_bindTexture_0_) + { + GlStateManager.bindTexture(p_bindTexture_0_); + } + + public static boolean isPowerOfTwo(int p_isPowerOfTwo_0_) + { + int i = MathHelper.roundUpToPowerOfTwo(p_isPowerOfTwo_0_); + return i == p_isPowerOfTwo_0_; + } + + public static BufferedImage scaleImage(BufferedImage p_scaleImage_0_, int p_scaleImage_1_) + { + int i = p_scaleImage_0_.getWidth(); + int j = p_scaleImage_0_.getHeight(); + int k = j * p_scaleImage_1_ / i; + BufferedImage bufferedimage = new BufferedImage(p_scaleImage_1_, k, 2); + Graphics2D graphics2d = bufferedimage.createGraphics(); + Object object = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR; + + if (p_scaleImage_1_ < i || p_scaleImage_1_ % i != 0) + { + object = RenderingHints.VALUE_INTERPOLATION_BILINEAR; + } + + graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, object); + graphics2d.drawImage(p_scaleImage_0_, 0, 0, p_scaleImage_1_, k, (ImageObserver)null); + return bufferedimage; + } + + public static BufferedImage scaleToPowerOfTwo(BufferedImage p_scaleToPowerOfTwo_0_, int p_scaleToPowerOfTwo_1_) + { + if (p_scaleToPowerOfTwo_0_ == null) + { + return p_scaleToPowerOfTwo_0_; + } + else + { + int i = p_scaleToPowerOfTwo_0_.getWidth(); + int j = p_scaleToPowerOfTwo_0_.getHeight(); + int k = Math.max(i, p_scaleToPowerOfTwo_1_); + k = MathHelper.roundUpToPowerOfTwo(k); + + if (k == i) + { + return p_scaleToPowerOfTwo_0_; + } + else + { + int l = j * k / i; + BufferedImage bufferedimage = new BufferedImage(k, l, 2); + Graphics2D graphics2d = bufferedimage.createGraphics(); + Object object = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR; + + if (k % i != 0) + { + object = RenderingHints.VALUE_INTERPOLATION_BILINEAR; + } + + graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, object); + graphics2d.drawImage(p_scaleToPowerOfTwo_0_, 0, 0, k, l, (ImageObserver)null); + return bufferedimage; + } + } + } + + public static BufferedImage scaleMinTo(BufferedImage p_scaleMinTo_0_, int p_scaleMinTo_1_) + { + if (p_scaleMinTo_0_ == null) + { + return p_scaleMinTo_0_; + } + else + { + int i = p_scaleMinTo_0_.getWidth(); + int j = p_scaleMinTo_0_.getHeight(); + + if (i >= p_scaleMinTo_1_) + { + return p_scaleMinTo_0_; + } + else + { + int k; + + for (k = i; k < p_scaleMinTo_1_; k *= 2) + { + ; + } + + int l = j * k / i; + BufferedImage bufferedimage = new BufferedImage(k, l, 2); + Graphics2D graphics2d = bufferedimage.createGraphics(); + Object object = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR; + graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, object); + graphics2d.drawImage(p_scaleMinTo_0_, 0, 0, k, l, (ImageObserver)null); + return bufferedimage; + } + } + } + + public static Dimension getImageSize(InputStream p_getImageSize_0_, String p_getImageSize_1_) + { + Iterator iterator = ImageIO.getImageReadersBySuffix(p_getImageSize_1_); + + while (true) + { + if (iterator.hasNext()) + { + ImageReader imagereader = (ImageReader)iterator.next(); + Dimension dimension; + + try + { + ImageInputStream imageinputstream = ImageIO.createImageInputStream(p_getImageSize_0_); + imagereader.setInput(imageinputstream); + int i = imagereader.getWidth(imagereader.getMinIndex()); + int j = imagereader.getHeight(imagereader.getMinIndex()); + dimension = new Dimension(i, j); + } + catch (IOException var11) + { + continue; + } + finally + { + imagereader.dispose(); + } + + return dimension; + } + + return null; + } + } + + public static void dbgMipmaps(TextureAtlasSprite p_dbgMipmaps_0_) + { + int[][] aint = p_dbgMipmaps_0_.getFrameTextureData(0); + + for (int i = 0; i < aint.length; ++i) + { + int[] aint1 = aint[i]; + + if (aint1 == null) + { + Config.dbg("" + i + ": " + aint1); + } + else + { + Config.dbg("" + i + ": " + aint1.length); + } + } + } + + public static void saveGlTexture(String p_saveGlTexture_0_, int p_saveGlTexture_1_, int p_saveGlTexture_2_, int p_saveGlTexture_3_, int p_saveGlTexture_4_) + { + bindTexture(p_saveGlTexture_1_); + GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1); + GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); + File file1 = new File(p_saveGlTexture_0_); + File file2 = file1.getParentFile(); + + if (file2 != null) + { + file2.mkdirs(); + } + + for (int i = 0; i < 16; ++i) + { + File file3 = new File(p_saveGlTexture_0_ + "_" + i + ".png"); + file3.delete(); + } + + for (int i1 = 0; i1 <= p_saveGlTexture_2_; ++i1) + { + File file4 = new File(p_saveGlTexture_0_ + "_" + i1 + ".png"); + int j = p_saveGlTexture_3_ >> i1; + int k = p_saveGlTexture_4_ >> i1; + int l = j * k; + IntBuffer intbuffer = BufferUtils.createIntBuffer(l); + int[] aint = new int[l]; + GL11.glGetTexImage(GL11.GL_TEXTURE_2D, i1, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer); + intbuffer.get(aint); + BufferedImage bufferedimage = new BufferedImage(j, k, 2); + bufferedimage.setRGB(0, 0, j, k, aint, 0, j); + + try + { + ImageIO.write(bufferedimage, "png", (File)file4); + Config.dbg("Exported: " + file4); + } + catch (Exception exception) + { + Config.warn("Error writing: " + file4); + Config.warn("" + exception.getClass().getName() + ": " + exception.getMessage()); + } + } + } + + public static int getGLMaximumTextureSize() + { + for (int i = 65536; i > 0; i >>= 1) + { + GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (IntBuffer)((IntBuffer)null)); + int j = GL11.glGetError(); + int k = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); + + if (k != 0) + { + return i; + } + } + + return -1; + } +} diff --git a/src/minecraft/optifine/TooltipManager.java b/src/minecraft/optifine/TooltipManager.java new file mode 100644 index 0000000..2875691 --- /dev/null +++ b/src/minecraft/optifine/TooltipManager.java @@ -0,0 +1,131 @@ +package optifine; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiVideoSettings; +import net.minecraft.client.settings.GameSettings; + +public class TooltipManager +{ + private GuiScreen guiScreen = null; + private int lastMouseX = 0; + private int lastMouseY = 0; + private long mouseStillTime = 0L; + + public TooltipManager(GuiScreen p_i97_1_) + { + this.guiScreen = p_i97_1_; + } + + public void drawTooltips(int p_drawTooltips_1_, int p_drawTooltips_2_, List p_drawTooltips_3_) + { + if (Math.abs(p_drawTooltips_1_ - this.lastMouseX) <= 5 && Math.abs(p_drawTooltips_2_ - this.lastMouseY) <= 5) + { + int i = 700; + + if (System.currentTimeMillis() >= this.mouseStillTime + (long)i) + { + int j = this.guiScreen.width / 2 - 150; + int k = this.guiScreen.height / 6 - 7; + + if (p_drawTooltips_2_ <= k + 98) + { + k += 105; + } + + int l = j + 150 + 150; + int i1 = k + 84 + 10; + GuiButton guibutton = this.getSelectedButton(p_drawTooltips_1_, p_drawTooltips_2_, p_drawTooltips_3_); + + if (guibutton instanceof IOptionControl) + { + IOptionControl ioptioncontrol = (IOptionControl)guibutton; + GameSettings.Options gamesettings$options = ioptioncontrol.getOption(); + String[] astring = getTooltipLines(gamesettings$options); + + if (astring == null) + { + return; + } + + GuiVideoSettings.drawGradientRect(this.guiScreen, j, k, l, i1, -536870912, -536870912); + + for (int j1 = 0; j1 < astring.length; ++j1) + { + String s = astring[j1]; + int k1 = 14540253; + + if (s.endsWith("!")) + { + k1 = 16719904; + } + + FontRenderer fontrenderer = Minecraft.getMinecraft().fontRendererObj; + fontrenderer.drawStringWithShadow(s, (float)(j + 5), (float)(k + 5 + j1 * 11), k1); + } + } + } + } + else + { + this.lastMouseX = p_drawTooltips_1_; + this.lastMouseY = p_drawTooltips_2_; + this.mouseStillTime = System.currentTimeMillis(); + } + } + + private GuiButton getSelectedButton(int p_getSelectedButton_1_, int p_getSelectedButton_2_, List p_getSelectedButton_3_) + { + for (int i = 0; i < p_getSelectedButton_3_.size(); ++i) + { + GuiButton guibutton = (GuiButton)p_getSelectedButton_3_.get(i); + int j = GuiVideoSettings.getButtonWidth(guibutton); + int k = GuiVideoSettings.getButtonHeight(guibutton); + boolean flag = p_getSelectedButton_1_ >= guibutton.xPosition && p_getSelectedButton_2_ >= guibutton.yPosition && p_getSelectedButton_1_ < guibutton.xPosition + j && p_getSelectedButton_2_ < guibutton.yPosition + k; + + if (flag) + { + return guibutton; + } + } + + return null; + } + + private static String[] getTooltipLines(GameSettings.Options p_getTooltipLines_0_) + { + return getTooltipLines(p_getTooltipLines_0_.getEnumString()); + } + + private static String[] getTooltipLines(String p_getTooltipLines_0_) + { + List list = new ArrayList(); + + for (int i = 0; i < 10; ++i) + { + String s = p_getTooltipLines_0_ + ".tooltip." + (i + 1); + String s1 = Lang.get(s, (String)null); + + if (s1 == null) + { + break; + } + + list.add(s1); + } + + if (list.size() <= 0) + { + return null; + } + else + { + String[] astring = (String[])((String[])list.toArray(new String[list.size()])); + return astring; + } + } +} diff --git a/src/minecraft/optifine/VersionCheckThread.java b/src/minecraft/optifine/VersionCheckThread.java new file mode 100644 index 0000000..a252dff --- /dev/null +++ b/src/minecraft/optifine/VersionCheckThread.java @@ -0,0 +1,70 @@ +package optifine; + +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import net.minecraft.client.ClientBrandRetriever; + +public class VersionCheckThread extends Thread +{ + public void run() + { + HttpURLConnection httpurlconnection = null; + + try + { + Config.dbg("Checking for new version"); + URL url = new URL(""); + httpurlconnection = (HttpURLConnection)url.openConnection(); + + if (Config.getGameSettings().snooperEnabled) + { + httpurlconnection.setRequestProperty("OF-MC-Version", "1.8.8"); + httpurlconnection.setRequestProperty("OF-MC-Brand", "" + ClientBrandRetriever.getClientModName()); + httpurlconnection.setRequestProperty("OF-Edition", "HD_U"); + httpurlconnection.setRequestProperty("OF-Release", "H8"); + httpurlconnection.setRequestProperty("OF-Java-Version", "" + System.getProperty("java.version")); + httpurlconnection.setRequestProperty("OF-CpuCount", "" + Config.getAvailableProcessors()); + httpurlconnection.setRequestProperty("OF-OpenGL-Version", "" + Config.openGlVersion); + httpurlconnection.setRequestProperty("OF-OpenGL-Vendor", "" + Config.openGlVendor); + } + + httpurlconnection.setDoInput(true); + httpurlconnection.setDoOutput(false); + httpurlconnection.connect(); + + try + { + InputStream inputstream = httpurlconnection.getInputStream(); + String s = Config.readInputStream(inputstream); + inputstream.close(); + String[] astring = Config.tokenize(s, "\n\r"); + + if (astring.length >= 1) + { + String s1 = astring[0].trim(); + Config.dbg(""); + + if (Config.compareRelease(s1, "H8") <= 0) + { + return; + } + + Config.setNewRelease(s1); + return; + } + } + finally + { + if (httpurlconnection != null) + { + httpurlconnection.disconnect(); + } + } + } + catch (Exception exception) + { + Config.dbg(""); + } + } +} diff --git a/src/minecraft/optifine/WorldServerMultiOF.java b/src/minecraft/optifine/WorldServerMultiOF.java new file mode 100644 index 0000000..378c843 --- /dev/null +++ b/src/minecraft/optifine/WorldServerMultiOF.java @@ -0,0 +1,5 @@ +package optifine; + +public class WorldServerMultiOF +{ +} diff --git a/src/minecraft/optifine/WorldServerOF.java b/src/minecraft/optifine/WorldServerOF.java new file mode 100644 index 0000000..46e8ff2 --- /dev/null +++ b/src/minecraft/optifine/WorldServerOF.java @@ -0,0 +1,102 @@ +package optifine; + +import net.minecraft.network.play.server.S2BPacketChangeGameState; +import net.minecraft.profiler.Profiler; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.WorldServer; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; + +public class WorldServerOF extends WorldServer +{ + private MinecraftServer mcServer; + + public WorldServerOF(MinecraftServer p_i98_1_, ISaveHandler p_i98_2_, WorldInfo p_i98_3_, int p_i98_4_, Profiler p_i98_5_) + { + super(p_i98_1_, p_i98_2_, p_i98_3_, p_i98_4_, p_i98_5_); + this.mcServer = p_i98_1_; + } + + /** + * Runs a single tick for the world + */ + public void tick() + { + super.tick(); + + if (!Config.isTimeDefault()) + { + this.fixWorldTime(); + } + + if (Config.waterOpacityChanged) + { + Config.waterOpacityChanged = false; + ClearWater.updateWaterOpacity(Config.getGameSettings(), this); + } + } + + /** + * Updates all weather states. + */ + protected void updateWeather() + { + if (!Config.isWeatherEnabled()) + { + this.fixWorldWeather(); + } + + super.updateWeather(); + } + + private void fixWorldWeather() + { + if (this.worldInfo.isRaining() || this.worldInfo.isThundering()) + { + this.worldInfo.setRainTime(0); + this.worldInfo.setRaining(false); + this.setRainStrength(0.0F); + this.worldInfo.setThunderTime(0); + this.worldInfo.setThundering(false); + this.setThunderStrength(0.0F); + this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(2, 0.0F)); + this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(7, 0.0F)); + this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new S2BPacketChangeGameState(8, 0.0F)); + } + } + + private void fixWorldTime() + { + if (this.worldInfo.getGameType().getID() == 1) + { + long i = this.getWorldTime(); + long j = i % 24000L; + + if (Config.isTimeDayOnly()) + { + if (j <= 1000L) + { + this.setWorldTime(i - j + 1001L); + } + + if (j >= 11000L) + { + this.setWorldTime(i - j + 24001L); + } + } + + if (Config.isTimeNightOnly()) + { + if (j <= 14000L) + { + this.setWorldTime(i - j + 14001L); + } + + if (j >= 22000L) + { + this.setWorldTime(i - j + 24000L + 14001L); + } + } + } + } +} diff --git a/src/minecraft/pack.png b/src/minecraft/pack.png new file mode 100644 index 0000000..cfaa986 Binary files /dev/null and b/src/minecraft/pack.png differ diff --git a/src/minecraft/shadersmod/client/BlockAlias.java b/src/minecraft/shadersmod/client/BlockAlias.java new file mode 100644 index 0000000..84c4610 --- /dev/null +++ b/src/minecraft/shadersmod/client/BlockAlias.java @@ -0,0 +1,47 @@ +package shadersmod.client; + +import optifine.MatchBlock; + +public class BlockAlias +{ + private int blockId; + private MatchBlock[] matchBlocks; + + public BlockAlias(int blockId, MatchBlock[] matchBlocks) + { + this.blockId = blockId; + this.matchBlocks = matchBlocks; + } + + public int getBlockId() + { + return this.blockId; + } + + public boolean matches(int id, int metadata) + { + for (int i = 0; i < this.matchBlocks.length; ++i) + { + MatchBlock matchblock = this.matchBlocks[i]; + + if (matchblock.matches(id, metadata)) + { + return true; + } + } + + return false; + } + + public int[] getMatchBlockIds() + { + int[] aint = new int[this.matchBlocks.length]; + + for (int i = 0; i < aint.length; ++i) + { + aint[i] = this.matchBlocks[i].getBlockId(); + } + + return aint; + } +} diff --git a/src/minecraft/shadersmod/client/BlockAliases.java b/src/minecraft/shadersmod/client/BlockAliases.java new file mode 100644 index 0000000..4cf4ff6 --- /dev/null +++ b/src/minecraft/shadersmod/client/BlockAliases.java @@ -0,0 +1,170 @@ +package shadersmod.client; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import optifine.Config; +import optifine.ConnectedParser; +import optifine.MatchBlock; +import optifine.PropertiesOrdered; +import optifine.StrUtils; + +public class BlockAliases +{ + private static BlockAlias[][] blockAliases = (BlockAlias[][])null; + + public static int getMappedBlockId(int blockId, int metadata) + { + if (blockAliases == null) + { + return blockId; + } + else if (blockId >= 0 && blockId < blockAliases.length) + { + BlockAlias[] ablockalias = blockAliases[blockId]; + + if (ablockalias == null) + { + return blockId; + } + else + { + for (int i = 0; i < ablockalias.length; ++i) + { + BlockAlias blockalias = ablockalias[i]; + + if (blockalias.matches(blockId, metadata)) + { + return blockalias.getBlockId(); + } + } + + return blockId; + } + } + else + { + return blockId; + } + } + + public static void update(IShaderPack shaderPack) + { + reset(); + String s = "/shaders/block.properties"; + + try + { + InputStream inputstream = shaderPack.getResourceAsStream(s); + + if (inputstream == null) + { + return; + } + + Properties properties = new PropertiesOrdered(); + properties.load(inputstream); + inputstream.close(); + Config.dbg("[Shaders] Parsing block mappings: " + s); + List> list = new ArrayList(); + ConnectedParser connectedparser = new ConnectedParser("Shaders"); + + for (Object s10 : properties.keySet()) + { + String s1 =(String) s10; + String s2 = properties.getProperty(s1); + String s3 = "block."; + + if (!s1.startsWith(s3)) + { + Config.warn("[Shaders] Invalid block ID: " + s1); + } + else + { + String s4 = StrUtils.removePrefix(s1, s3); + int i = Config.parseInt(s4, -1); + + if (i < 0) + { + Config.warn("[Shaders] Invalid block ID: " + s1); + } + else + { + MatchBlock[] amatchblock = connectedparser.parseMatchBlocks(s2); + + if (amatchblock != null && amatchblock.length >= 1) + { + BlockAlias blockalias = new BlockAlias(i, amatchblock); + addToList(list, blockalias); + } + else + { + Config.warn("[Shaders] Invalid block ID mapping: " + s1 + "=" + s2); + } + } + } + } + + if (list.size() <= 0) + { + return; + } + + blockAliases = toArrays(list); + } + catch (IOException var15) + { + Config.warn("[Shaders] Error reading: " + s); + } + } + + private static void addToList(List> blocksAliases, BlockAlias ba) + { + int[] aint = ba.getMatchBlockIds(); + + for (int i = 0; i < aint.length; ++i) + { + int j = aint[i]; + + while (j >= blocksAliases.size()) + { + blocksAliases.add(null); + } + + List list = (List)blocksAliases.get(j); + + if (list == null) + { + list = new ArrayList(); + blocksAliases.set(j, list); + } + + list.add(ba); + } + } + + private static BlockAlias[][] toArrays(List> listBlocksAliases) + { + BlockAlias[][] ablockalias = new BlockAlias[listBlocksAliases.size()][]; + + for (int i = 0; i < ablockalias.length; ++i) + { + List list = (List)listBlocksAliases.get(i); + + if (list != null) + { + ablockalias[i] = (BlockAlias[])((BlockAlias[])list.toArray(new BlockAlias[list.size()])); + } + } + + return ablockalias; + } + + public static void reset() + { + blockAliases = (BlockAlias[][])null; + } +} diff --git a/src/minecraft/shadersmod/client/ClippingHelperShadow.java b/src/minecraft/shadersmod/client/ClippingHelperShadow.java new file mode 100644 index 0000000..771c4b1 --- /dev/null +++ b/src/minecraft/shadersmod/client/ClippingHelperShadow.java @@ -0,0 +1,319 @@ +package shadersmod.client; + +import net.minecraft.client.renderer.culling.ClippingHelper; +import net.minecraft.util.MathHelper; + +public class ClippingHelperShadow extends ClippingHelper +{ + private static ClippingHelperShadow instance = new ClippingHelperShadow(); + float[] frustumTest = new float[6]; + float[][] shadowClipPlanes = new float[10][4]; + int shadowClipPlaneCount; + float[] matInvMP = new float[16]; + float[] vecIntersection = new float[4]; + + /** + * Returns true if the box is inside all 6 clipping planes, otherwise returns false. + */ + public boolean isBoxInFrustum(double x1, double y1, double z1, double x2, double y2, double z2) + { + for (int i = 0; i < this.shadowClipPlaneCount; ++i) + { + float[] afloat = this.shadowClipPlanes[i]; + + if (this.dot4(afloat, x1, y1, z1) <= 0.0D && this.dot4(afloat, x2, y1, z1) <= 0.0D && this.dot4(afloat, x1, y2, z1) <= 0.0D && this.dot4(afloat, x2, y2, z1) <= 0.0D && this.dot4(afloat, x1, y1, z2) <= 0.0D && this.dot4(afloat, x2, y1, z2) <= 0.0D && this.dot4(afloat, x1, y2, z2) <= 0.0D && this.dot4(afloat, x2, y2, z2) <= 0.0D) + { + return false; + } + } + + return true; + } + + private double dot4(float[] plane, double x, double y, double z) + { + return (double)plane[0] * x + (double)plane[1] * y + (double)plane[2] * z + (double)plane[3]; + } + + private double dot3(float[] vecA, float[] vecB) + { + return (double)vecA[0] * (double)vecB[0] + (double)vecA[1] * (double)vecB[1] + (double)vecA[2] * (double)vecB[2]; + } + + public static ClippingHelper getInstance() + { + instance.init(); + return instance; + } + + private void normalizePlane(float[] plane) + { + float f = MathHelper.sqrt_float(plane[0] * plane[0] + plane[1] * plane[1] + plane[2] * plane[2]); + plane[0] /= f; + plane[1] /= f; + plane[2] /= f; + plane[3] /= f; + } + + private void normalize3(float[] plane) + { + float f = MathHelper.sqrt_float(plane[0] * plane[0] + plane[1] * plane[1] + plane[2] * plane[2]); + + if (f == 0.0F) + { + f = 1.0F; + } + + plane[0] /= f; + plane[1] /= f; + plane[2] /= f; + } + + private void assignPlane(float[] plane, float a, float b, float c, float d) + { + float f = (float)Math.sqrt((double)(a * a + b * b + c * c)); + plane[0] = a / f; + plane[1] = b / f; + plane[2] = c / f; + plane[3] = d / f; + } + + private void copyPlane(float[] dst, float[] src) + { + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; + } + + private void cross3(float[] out, float[] a, float[] b) + { + out[0] = a[1] * b[2] - a[2] * b[1]; + out[1] = a[2] * b[0] - a[0] * b[2]; + out[2] = a[0] * b[1] - a[1] * b[0]; + } + + private void addShadowClipPlane(float[] plane) + { + this.copyPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], plane); + } + + private float length(float x, float y, float z) + { + return (float)Math.sqrt((double)(x * x + y * y + z * z)); + } + + private float distance(float x1, float y1, float z1, float x2, float y2, float z2) + { + return this.length(x1 - x2, y1 - y2, z1 - z2); + } + + private void makeShadowPlane(float[] shadowPlane, float[] positivePlane, float[] negativePlane, float[] vecSun) + { + this.cross3(this.vecIntersection, positivePlane, negativePlane); + this.cross3(shadowPlane, this.vecIntersection, vecSun); + this.normalize3(shadowPlane); + float f = (float)this.dot3(positivePlane, negativePlane); + float f1 = (float)this.dot3(shadowPlane, negativePlane); + float f2 = this.distance(shadowPlane[0], shadowPlane[1], shadowPlane[2], negativePlane[0] * f1, negativePlane[1] * f1, negativePlane[2] * f1); + float f3 = this.distance(positivePlane[0], positivePlane[1], positivePlane[2], negativePlane[0] * f, negativePlane[1] * f, negativePlane[2] * f); + float f4 = f2 / f3; + float f5 = (float)this.dot3(shadowPlane, positivePlane); + float f6 = this.distance(shadowPlane[0], shadowPlane[1], shadowPlane[2], positivePlane[0] * f5, positivePlane[1] * f5, positivePlane[2] * f5); + float f7 = this.distance(negativePlane[0], negativePlane[1], negativePlane[2], positivePlane[0] * f, positivePlane[1] * f, positivePlane[2] * f); + float f8 = f6 / f7; + shadowPlane[3] = positivePlane[3] * f4 + negativePlane[3] * f8; + } + + public void init() + { + float[] afloat = this.projectionMatrix; + float[] afloat1 = this.modelviewMatrix; + float[] afloat2 = this.clippingMatrix; + System.arraycopy(Shaders.faProjection, 0, afloat, 0, 16); + System.arraycopy(Shaders.faModelView, 0, afloat1, 0, 16); + SMath.multiplyMat4xMat4(afloat2, afloat1, afloat); + this.assignPlane(this.frustum[0], afloat2[3] - afloat2[0], afloat2[7] - afloat2[4], afloat2[11] - afloat2[8], afloat2[15] - afloat2[12]); + this.assignPlane(this.frustum[1], afloat2[3] + afloat2[0], afloat2[7] + afloat2[4], afloat2[11] + afloat2[8], afloat2[15] + afloat2[12]); + this.assignPlane(this.frustum[2], afloat2[3] + afloat2[1], afloat2[7] + afloat2[5], afloat2[11] + afloat2[9], afloat2[15] + afloat2[13]); + this.assignPlane(this.frustum[3], afloat2[3] - afloat2[1], afloat2[7] - afloat2[5], afloat2[11] - afloat2[9], afloat2[15] - afloat2[13]); + this.assignPlane(this.frustum[4], afloat2[3] - afloat2[2], afloat2[7] - afloat2[6], afloat2[11] - afloat2[10], afloat2[15] - afloat2[14]); + this.assignPlane(this.frustum[5], afloat2[3] + afloat2[2], afloat2[7] + afloat2[6], afloat2[11] + afloat2[10], afloat2[15] + afloat2[14]); + float[] afloat3 = Shaders.shadowLightPositionVector; + float f = (float)this.dot3(this.frustum[0], afloat3); + float f1 = (float)this.dot3(this.frustum[1], afloat3); + float f2 = (float)this.dot3(this.frustum[2], afloat3); + float f3 = (float)this.dot3(this.frustum[3], afloat3); + float f4 = (float)this.dot3(this.frustum[4], afloat3); + float f5 = (float)this.dot3(this.frustum[5], afloat3); + this.shadowClipPlaneCount = 0; + + if (f >= 0.0F) + { + this.copyPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[0]); + + if (f > 0.0F) + { + if (f2 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[0], this.frustum[2], afloat3); + } + + if (f3 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[0], this.frustum[3], afloat3); + } + + if (f4 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[0], this.frustum[4], afloat3); + } + + if (f5 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[0], this.frustum[5], afloat3); + } + } + } + + if (f1 >= 0.0F) + { + this.copyPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[1]); + + if (f1 > 0.0F) + { + if (f2 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[1], this.frustum[2], afloat3); + } + + if (f3 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[1], this.frustum[3], afloat3); + } + + if (f4 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[1], this.frustum[4], afloat3); + } + + if (f5 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[1], this.frustum[5], afloat3); + } + } + } + + if (f2 >= 0.0F) + { + this.copyPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[2]); + + if (f2 > 0.0F) + { + if (f < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[2], this.frustum[0], afloat3); + } + + if (f1 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[2], this.frustum[1], afloat3); + } + + if (f4 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[2], this.frustum[4], afloat3); + } + + if (f5 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[2], this.frustum[5], afloat3); + } + } + } + + if (f3 >= 0.0F) + { + this.copyPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[3]); + + if (f3 > 0.0F) + { + if (f < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[3], this.frustum[0], afloat3); + } + + if (f1 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[3], this.frustum[1], afloat3); + } + + if (f4 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[3], this.frustum[4], afloat3); + } + + if (f5 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[3], this.frustum[5], afloat3); + } + } + } + + if (f4 >= 0.0F) + { + this.copyPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[4]); + + if (f4 > 0.0F) + { + if (f < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[4], this.frustum[0], afloat3); + } + + if (f1 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[4], this.frustum[1], afloat3); + } + + if (f2 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[4], this.frustum[2], afloat3); + } + + if (f3 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[4], this.frustum[3], afloat3); + } + } + } + + if (f5 >= 0.0F) + { + this.copyPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[5]); + + if (f5 > 0.0F) + { + if (f < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[5], this.frustum[0], afloat3); + } + + if (f1 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[5], this.frustum[1], afloat3); + } + + if (f2 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[5], this.frustum[2], afloat3); + } + + if (f3 < 0.0F) + { + this.makeShadowPlane(this.shadowClipPlanes[this.shadowClipPlaneCount++], this.frustum[5], this.frustum[3], afloat3); + } + } + } + } +} diff --git a/src/minecraft/shadersmod/client/CustomTexture.java b/src/minecraft/shadersmod/client/CustomTexture.java new file mode 100644 index 0000000..6babde7 --- /dev/null +++ b/src/minecraft/shadersmod/client/CustomTexture.java @@ -0,0 +1,37 @@ +package shadersmod.client; + +import net.minecraft.client.renderer.texture.ITextureObject; + +public class CustomTexture +{ + private int textureUnit = -1; + private String path = null; + private ITextureObject texture = null; + + public CustomTexture(int textureUnit, String path, ITextureObject texture) + { + this.textureUnit = textureUnit; + this.path = path; + this.texture = texture; + } + + public int getTextureUnit() + { + return this.textureUnit; + } + + public String getPath() + { + return this.path; + } + + public ITextureObject getTexture() + { + return this.texture; + } + + public String toString() + { + return "textureUnit: " + this.textureUnit + ", path: " + this.path + ", glTextureId: " + this.texture.getGlTextureId(); + } +} diff --git a/src/minecraft/shadersmod/client/DefaultTexture.java b/src/minecraft/shadersmod/client/DefaultTexture.java new file mode 100644 index 0000000..d9f42d9 --- /dev/null +++ b/src/minecraft/shadersmod/client/DefaultTexture.java @@ -0,0 +1,18 @@ +package shadersmod.client; + +import net.minecraft.client.renderer.texture.AbstractTexture; +import net.minecraft.client.resources.IResourceManager; + +public class DefaultTexture extends AbstractTexture +{ + public DefaultTexture() + { + this.loadTexture((IResourceManager)null); + } + + public void loadTexture(IResourceManager resourcemanager) + { + int[] aint = ShadersTex.createAIntImage(1, -1); + ShadersTex.setupTexture(this.getMultiTexID(), aint, 1, 1, false, false); + } +} diff --git a/src/minecraft/shadersmod/client/EnumShaderOption.java b/src/minecraft/shadersmod/client/EnumShaderOption.java new file mode 100644 index 0000000..5894077 --- /dev/null +++ b/src/minecraft/shadersmod/client/EnumShaderOption.java @@ -0,0 +1,49 @@ +package shadersmod.client; + +public enum EnumShaderOption +{ + ANTIALIASING("of.options.shaders.ANTIALIASING", "antialiasingLevel", "0"), + NORMAL_MAP("of.options.shaders.NORMAL_MAP", "normalMapEnabled", "true"), + SPECULAR_MAP("of.options.shaders.SPECULAR_MAP", "specularMapEnabled", "true"), + RENDER_RES_MUL("of.options.shaders.RENDER_RES_MUL", "renderResMul", "1.0"), + SHADOW_RES_MUL("of.options.shaders.SHADOW_RES_MUL", "shadowResMul", "1.0"), + HAND_DEPTH_MUL("of.options.shaders.HAND_DEPTH_MUL", "handDepthMul", "0.125"), + CLOUD_SHADOW("of.options.shaders.CLOUD_SHADOW", "cloudShadow", "true"), + OLD_HAND_LIGHT("of.options.shaders.OLD_HAND_LIGHT", "oldHandLight", "default"), + OLD_LIGHTING("of.options.shaders.OLD_LIGHTING", "oldLighting", "default"), + SHADER_PACK("of.options.shaders.SHADER_PACK", "shaderPack", ""), + TWEAK_BLOCK_DAMAGE("of.options.shaders.TWEAK_BLOCK_DAMAGE", "tweakBlockDamage", "false"), + SHADOW_CLIP_FRUSTRUM("of.options.shaders.SHADOW_CLIP_FRUSTRUM", "shadowClipFrustrum", "true"), + TEX_MIN_FIL_B("of.options.shaders.TEX_MIN_FIL_B", "TexMinFilB", "0"), + TEX_MIN_FIL_N("of.options.shaders.TEX_MIN_FIL_N", "TexMinFilN", "0"), + TEX_MIN_FIL_S("of.options.shaders.TEX_MIN_FIL_S", "TexMinFilS", "0"), + TEX_MAG_FIL_B("of.options.shaders.TEX_MAG_FIL_B", "TexMagFilB", "0"), + TEX_MAG_FIL_N("of.options.shaders.TEX_MAG_FIL_N", "TexMagFilN", "0"), + TEX_MAG_FIL_S("of.options.shaders.TEX_MAG_FIL_S", "TexMagFilS", "0"); + + private String resourceKey = null; + private String propertyKey = null; + private String valueDefault = null; + + private EnumShaderOption(String resourceKey, String propertyKey, String valueDefault) + { + this.resourceKey = resourceKey; + this.propertyKey = propertyKey; + this.valueDefault = valueDefault; + } + + public String getResourceKey() + { + return this.resourceKey; + } + + public String getPropertyKey() + { + return this.propertyKey; + } + + public String getValueDefault() + { + return this.valueDefault; + } +} diff --git a/src/minecraft/shadersmod/client/GuiButtonEnumShaderOption.java b/src/minecraft/shadersmod/client/GuiButtonEnumShaderOption.java new file mode 100644 index 0000000..a0add9d --- /dev/null +++ b/src/minecraft/shadersmod/client/GuiButtonEnumShaderOption.java @@ -0,0 +1,69 @@ +package shadersmod.client; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.resources.I18n; + +public class GuiButtonEnumShaderOption extends GuiButton +{ + private EnumShaderOption enumShaderOption = null; + + public GuiButtonEnumShaderOption(EnumShaderOption enumShaderOption, int x, int y, int widthIn, int heightIn) + { + super(enumShaderOption.ordinal(), x, y, widthIn, heightIn, getButtonText(enumShaderOption)); + this.enumShaderOption = enumShaderOption; + } + + public EnumShaderOption getEnumShaderOption() + { + return this.enumShaderOption; + } + + private static String getButtonText(EnumShaderOption eso) + { + String s = I18n.format(eso.getResourceKey(), new Object[0]) + ": "; + + switch (eso) + { + case ANTIALIASING: + return s + GuiShaders.toStringAa(Shaders.configAntialiasingLevel); + + case NORMAL_MAP: + return s + GuiShaders.toStringOnOff(Shaders.configNormalMap); + + case SPECULAR_MAP: + return s + GuiShaders.toStringOnOff(Shaders.configSpecularMap); + + case RENDER_RES_MUL: + return s + GuiShaders.toStringQuality(Shaders.configRenderResMul); + + case SHADOW_RES_MUL: + return s + GuiShaders.toStringQuality(Shaders.configShadowResMul); + + case HAND_DEPTH_MUL: + return s + GuiShaders.toStringHandDepth(Shaders.configHandDepthMul); + + case CLOUD_SHADOW: + return s + GuiShaders.toStringOnOff(Shaders.configCloudShadow); + + case OLD_HAND_LIGHT: + return s + Shaders.configOldHandLight.getUserValue(); + + case OLD_LIGHTING: + return s + Shaders.configOldLighting.getUserValue(); + + case SHADOW_CLIP_FRUSTRUM: + return s + GuiShaders.toStringOnOff(Shaders.configShadowClipFrustrum); + + case TWEAK_BLOCK_DAMAGE: + return s + GuiShaders.toStringOnOff(Shaders.configTweakBlockDamage); + + default: + return s + Shaders.getEnumShaderOption(eso); + } + } + + public void updateButtonText() + { + this.displayString = getButtonText(this.enumShaderOption); + } +} diff --git a/src/minecraft/shadersmod/client/GuiButtonShaderOption.java b/src/minecraft/shadersmod/client/GuiButtonShaderOption.java new file mode 100644 index 0000000..e10b652 --- /dev/null +++ b/src/minecraft/shadersmod/client/GuiButtonShaderOption.java @@ -0,0 +1,19 @@ +package shadersmod.client; + +import net.minecraft.client.gui.GuiButton; + +public class GuiButtonShaderOption extends GuiButton +{ + private ShaderOption shaderOption = null; + + public GuiButtonShaderOption(int buttonId, int x, int y, int widthIn, int heightIn, ShaderOption shaderOption, String text) + { + super(buttonId, x, y, widthIn, heightIn, text); + this.shaderOption = shaderOption; + } + + public ShaderOption getShaderOption() + { + return this.shaderOption; + } +} diff --git a/src/minecraft/shadersmod/client/GuiShaderOptions.java b/src/minecraft/shadersmod/client/GuiShaderOptions.java new file mode 100644 index 0000000..a8ad0ab --- /dev/null +++ b/src/minecraft/shadersmod/client/GuiShaderOptions.java @@ -0,0 +1,421 @@ +package shadersmod.client; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; +import optifine.Config; +import optifine.GuiScreenOF; +import optifine.Lang; +import optifine.StrUtils; + +public class GuiShaderOptions extends GuiScreenOF +{ + private GuiScreen prevScreen; + protected String title; + private GameSettings settings; + private int lastMouseX; + private int lastMouseY; + private long mouseStillTime; + private String screenName; + private String screenText; + private boolean changed; + public static final String OPTION_PROFILE = ""; + public static final String OPTION_EMPTY = ""; + public static final String OPTION_REST = "*"; + + public GuiShaderOptions(GuiScreen guiscreen, GameSettings gamesettings) + { + this.lastMouseX = 0; + this.lastMouseY = 0; + this.mouseStillTime = 0L; + this.screenName = null; + this.screenText = null; + this.changed = false; + this.title = "Shader Options"; + this.prevScreen = guiscreen; + this.settings = gamesettings; + } + + public GuiShaderOptions(GuiScreen guiscreen, GameSettings gamesettings, String screenName) + { + this(guiscreen, gamesettings); + this.screenName = screenName; + + if (screenName != null) + { + this.screenText = Shaders.translate("screen." + screenName, screenName); + } + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.title = I18n.format("of.options.shaderOptionsTitle", new Object[0]); + int i = 100; + int j = 0; + int k = 30; + int l = 20; + int i1 = this.width - 130; + int j1 = 120; + int k1 = 20; + int l1 = 2; + ShaderOption[] ashaderoption = Shaders.getShaderPackOptions(this.screenName); + + if (ashaderoption != null) + { + if (ashaderoption.length > 18) + { + l1 = ashaderoption.length / 9 + 1; + } + + for (int i2 = 0; i2 < ashaderoption.length; ++i2) + { + ShaderOption shaderoption = ashaderoption[i2]; + + if (shaderoption != null && shaderoption.isVisible()) + { + int j2 = i2 % l1; + int k2 = i2 / l1; + int l2 = Math.min(this.width / l1, 200); + j = (this.width - l2 * l1) / 2; + int i3 = j2 * l2 + 5 + j; + int j3 = k + k2 * l; + int k3 = l2 - 10; + String s = this.getButtonText(shaderoption, k3); + GuiButtonShaderOption guibuttonshaderoption = new GuiButtonShaderOption(i + i2, i3, j3, k3, k1, shaderoption, s); + guibuttonshaderoption.enabled = shaderoption.isEnabled(); + this.buttonList.add(guibuttonshaderoption); + } + } + } + + this.buttonList.add(new GuiButton(201, this.width / 2 - j1 - 20, this.height / 6 + 168 + 11, j1, k1, I18n.format("controls.reset", new Object[0]))); + this.buttonList.add(new GuiButton(200, this.width / 2 + 20, this.height / 6 + 168 + 11, j1, k1, I18n.format("gui.done", new Object[0]))); + } + + private String getButtonText(ShaderOption so, int btnWidth) + { + String s = so.getNameText(); + + if (so instanceof ShaderOptionScreen) + { + ShaderOptionScreen shaderoptionscreen = (ShaderOptionScreen)so; + return s + "..."; + } + else + { + FontRenderer fontrenderer = Config.getMinecraft().fontRendererObj; + + for (int i = fontrenderer.getStringWidth(": " + Lang.getOff()) + 5; fontrenderer.getStringWidth(s) + i >= btnWidth && s.length() > 0; s = s.substring(0, s.length() - 1)) + { + ; + } + + String s1 = so.isChanged() ? so.getValueColor(so.getValue()) : ""; + String s2 = so.getValueText(so.getValue()); + return s + ": " + s1 + s2; + } + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton guibutton) + { + if (guibutton.enabled) + { + if (guibutton.id < 200 && guibutton instanceof GuiButtonShaderOption) + { + GuiButtonShaderOption guibuttonshaderoption = (GuiButtonShaderOption)guibutton; + ShaderOption shaderoption = guibuttonshaderoption.getShaderOption(); + + if (shaderoption instanceof ShaderOptionScreen) + { + String s = shaderoption.getName(); + GuiShaderOptions guishaderoptions = new GuiShaderOptions(this, this.settings, s); + this.mc.displayGuiScreen(guishaderoptions); + return; + } + + if (isShiftKeyDown()) + { + shaderoption.resetValue(); + } + else + { + shaderoption.nextValue(); + } + + this.updateAllButtons(); + this.changed = true; + } + + if (guibutton.id == 201) + { + ShaderOption[] ashaderoption = Shaders.getChangedOptions(Shaders.getShaderPackOptions()); + + for (int i = 0; i < ashaderoption.length; ++i) + { + ShaderOption shaderoption1 = ashaderoption[i]; + shaderoption1.resetValue(); + this.changed = true; + } + + this.updateAllButtons(); + } + + if (guibutton.id == 200) + { + if (this.changed) + { + Shaders.saveShaderPackOptions(); + this.changed = false; + Shaders.uninit(); + } + + this.mc.displayGuiScreen(this.prevScreen); + } + } + } + + protected void actionPerformedRightClick(GuiButton btn) + { + if (btn instanceof GuiButtonShaderOption) + { + GuiButtonShaderOption guibuttonshaderoption = (GuiButtonShaderOption)btn; + ShaderOption shaderoption = guibuttonshaderoption.getShaderOption(); + + if (isShiftKeyDown()) + { + shaderoption.resetValue(); + } + else + { + shaderoption.prevValue(); + } + + this.updateAllButtons(); + this.changed = true; + } + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + super.onGuiClosed(); + + if (this.changed) + { + Shaders.saveShaderPackOptions(); + this.changed = false; + Shaders.uninit(); + } + } + + private void updateAllButtons() + { + for (GuiButton guibutton : this.buttonList) + { + if (guibutton instanceof GuiButtonShaderOption) + { + GuiButtonShaderOption guibuttonshaderoption = (GuiButtonShaderOption)guibutton; + ShaderOption shaderoption = guibuttonshaderoption.getShaderOption(); + + if (shaderoption instanceof ShaderOptionProfile) + { + ShaderOptionProfile shaderoptionprofile = (ShaderOptionProfile)shaderoption; + shaderoptionprofile.updateProfile(); + } + + guibuttonshaderoption.displayString = this.getButtonText(shaderoption, guibuttonshaderoption.getButtonWidth()); + } + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int x, int y, float f) + { + this.drawDefaultBackground(); + + if (this.screenText != null) + { + this.drawCenteredString(this.fontRendererObj, this.screenText, this.width / 2, 15, 16777215); + } + else + { + this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 15, 16777215); + } + + super.drawScreen(x, y, f); + + if (Math.abs(x - this.lastMouseX) <= 5 && Math.abs(y - this.lastMouseY) <= 5) + { + this.drawTooltips(x, y, this.buttonList); + } + else + { + this.lastMouseX = x; + this.lastMouseY = y; + this.mouseStillTime = System.currentTimeMillis(); + } + } + + private void drawTooltips(int x, int y, List buttons) + { + int i = 700; + + if (System.currentTimeMillis() >= this.mouseStillTime + (long)i) + { + int j = this.width / 2 - 150; + int k = this.height / 6 - 7; + + if (y <= k + 98) + { + k += 105; + } + + int l = j + 150 + 150; + int i1 = k + 84 + 10; + GuiButton guibutton = getSelectedButton(buttons, x, y); + + if (guibutton instanceof GuiButtonShaderOption) + { + GuiButtonShaderOption guibuttonshaderoption = (GuiButtonShaderOption)guibutton; + ShaderOption shaderoption = guibuttonshaderoption.getShaderOption(); + String[] astring = this.makeTooltipLines(shaderoption, l - j); + + if (astring == null) + { + return; + } + + this.drawGradientRect(j, k, l, i1, -536870912, -536870912); + + for (int j1 = 0; j1 < astring.length; ++j1) + { + String s = astring[j1]; + int k1 = 14540253; + + if (s.endsWith("!")) + { + k1 = 16719904; + } + + this.fontRendererObj.drawStringWithShadow(s, (float)(j + 5), (float)(k + 5 + j1 * 11), k1); + } + } + } + } + + private String[] makeTooltipLines(ShaderOption so, int width) + { + if (so instanceof ShaderOptionProfile) + { + return null; + } + else + { + String s = so.getNameText(); + String s1 = Config.normalize(so.getDescriptionText()).trim(); + String[] astring = this.splitDescription(s1); + String s2 = null; + + if (!s.equals(so.getName()) && this.settings.advancedItemTooltips) + { + s2 = "\u00a78" + Lang.get("of.general.id") + ": " + so.getName(); + } + + String s3 = null; + + if (so.getPaths() != null && this.settings.advancedItemTooltips) + { + s3 = "\u00a78" + Lang.get("of.general.from") + ": " + Config.arrayToString((Object[])so.getPaths()); + } + + String s4 = null; + + if (so.getValueDefault() != null && this.settings.advancedItemTooltips) + { + String s5 = so.isEnabled() ? so.getValueText(so.getValueDefault()) : Lang.get("of.general.ambiguous"); + s4 = "\u00a78" + Lang.getDefault() + ": " + s5; + } + + List list = new ArrayList(); + list.add(s); + list.addAll(Arrays.asList(astring)); + + if (s2 != null) + { + list.add(s2); + } + + if (s3 != null) + { + list.add(s3); + } + + if (s4 != null) + { + list.add(s4); + } + + String[] astring1 = this.makeTooltipLines(width, list); + return astring1; + } + } + + private String[] splitDescription(String desc) + { + if (desc.length() <= 0) + { + return new String[0]; + } + else + { + desc = StrUtils.removePrefix(desc, "//"); + String[] astring = desc.split("\\. "); + + for (int i = 0; i < astring.length; ++i) + { + astring[i] = "- " + astring[i].trim(); + astring[i] = StrUtils.removeSuffix(astring[i], "."); + } + + return astring; + } + } + + private String[] makeTooltipLines(int width, List args) + { + FontRenderer fontrenderer = Config.getMinecraft().fontRendererObj; + List list = new ArrayList(); + + for (int i = 0; i < args.size(); ++i) + { + String s = (String)args.get(i); + + if (s != null && s.length() > 0) + { + for (Object s1 : fontrenderer.listFormattedStringToWidth(s, width)) + { + list.add((String) s1); + } + } + } + + String[] astring = (String[])((String[])list.toArray(new String[list.size()])); + return astring; + } +} diff --git a/src/minecraft/shadersmod/client/GuiShaders.java b/src/minecraft/shadersmod/client/GuiShaders.java new file mode 100644 index 0000000..6d4b651 --- /dev/null +++ b/src/minecraft/shadersmod/client/GuiShaders.java @@ -0,0 +1,439 @@ +package shadersmod.client; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; +import optifine.Config; +import optifine.Lang; + +import org.lwjgl.Sys; + +public class GuiShaders extends GuiScreen +{ + protected GuiScreen parentGui; + protected String screenTitle = "Shaders"; + private int updateTimer = -1; + private GuiSlotShaders shaderList; + private boolean saved = false; + private static float[] QUALITY_MULTIPLIERS = new float[] {0.5F, 0.70710677F, 1.0F, 1.4142135F, 2.0F}; + private static String[] QUALITY_MULTIPLIER_NAMES = new String[] {"0.5x", "0.7x", "1x", "1.5x", "2x"}; + private static float[] HAND_DEPTH_VALUES = new float[] {0.0625F, 0.125F, 0.25F}; + private static String[] HAND_DEPTH_NAMES = new String[] {"0.5x", "1x", "2x"}; + public static final int EnumOS_UNKNOWN = 0; + public static final int EnumOS_WINDOWS = 1; + public static final int EnumOS_OSX = 2; + public static final int EnumOS_SOLARIS = 3; + public static final int EnumOS_LINUX = 4; + + public GuiShaders(GuiScreen par1GuiScreen, GameSettings par2GameSettings) + { + this.parentGui = par1GuiScreen; + } + + /** + * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the + * window resizes, the buttonList is cleared beforehand. + */ + public void initGui() + { + this.screenTitle = I18n.format("of.options.shadersTitle", new Object[0]); + + if (Shaders.shadersConfig == null) + { + Shaders.loadConfig(); + } + + int i = 120; + int j = 20; + int k = this.width - i - 10; + int l = 30; + int i1 = 20; + int j1 = this.width - i - 20; + this.shaderList = new GuiSlotShaders(this, j1, this.height, l, this.height - 50, 16); + this.shaderList.registerScrollButtons(7, 8); + this.buttonList.add(new GuiButtonEnumShaderOption(EnumShaderOption.ANTIALIASING, k, 0 * i1 + l, i, j)); + this.buttonList.add(new GuiButtonEnumShaderOption(EnumShaderOption.NORMAL_MAP, k, 1 * i1 + l, i, j)); + this.buttonList.add(new GuiButtonEnumShaderOption(EnumShaderOption.SPECULAR_MAP, k, 2 * i1 + l, i, j)); + this.buttonList.add(new GuiButtonEnumShaderOption(EnumShaderOption.RENDER_RES_MUL, k, 3 * i1 + l, i, j)); + this.buttonList.add(new GuiButtonEnumShaderOption(EnumShaderOption.SHADOW_RES_MUL, k, 4 * i1 + l, i, j)); + this.buttonList.add(new GuiButtonEnumShaderOption(EnumShaderOption.HAND_DEPTH_MUL, k, 5 * i1 + l, i, j)); + this.buttonList.add(new GuiButtonEnumShaderOption(EnumShaderOption.OLD_HAND_LIGHT, k, 6 * i1 + l, i, j)); + this.buttonList.add(new GuiButtonEnumShaderOption(EnumShaderOption.OLD_LIGHTING, k, 7 * i1 + l, i, j)); + int k1 = Math.min(150, j1 / 2 - 10); + this.buttonList.add(new GuiButton(201, j1 / 4 - k1 / 2, this.height - 25, k1, j, Lang.get("of.options.shaders.shadersFolder"))); + this.buttonList.add(new GuiButton(202, j1 / 4 * 3 - k1 / 2, this.height - 25, k1, j, I18n.format("gui.done", new Object[0]))); + this.buttonList.add(new GuiButton(203, k, this.height - 25, i, j, Lang.get("of.options.shaders.shaderOptions"))); + this.updateButtons(); + } + + public void updateButtons() + { + boolean flag = Config.isShaders(); + + for (GuiButton guibutton : this.buttonList) + { + if (guibutton.id != 201 && guibutton.id != 202 && guibutton.id != EnumShaderOption.ANTIALIASING.ordinal()) + { + guibutton.enabled = flag; + } + } + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() throws IOException + { + super.handleMouseInput(); + this.shaderList.handleMouseInput(); + } + + /** + * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) + */ + protected void actionPerformed(GuiButton button) + { + if (button.enabled) + { + if (button instanceof GuiButtonEnumShaderOption) + { + GuiButtonEnumShaderOption guibuttonenumshaderoption = (GuiButtonEnumShaderOption)button; + + switch (guibuttonenumshaderoption.getEnumShaderOption()) + { + case ANTIALIASING: + Shaders.nextAntialiasingLevel(); + Shaders.uninit(); + break; + + case NORMAL_MAP: + Shaders.configNormalMap = !Shaders.configNormalMap; + this.mc.scheduleResourcesRefresh(); + break; + + case SPECULAR_MAP: + Shaders.configSpecularMap = !Shaders.configSpecularMap; + this.mc.scheduleResourcesRefresh(); + break; + + case RENDER_RES_MUL: + float f2 = Shaders.configRenderResMul; + float[] afloat2 = QUALITY_MULTIPLIERS; + String[] astring2 = QUALITY_MULTIPLIER_NAMES; + int k = getValueIndex(f2, afloat2); + + if (isShiftKeyDown()) + { + --k; + + if (k < 0) + { + k = afloat2.length - 1; + } + } + else + { + ++k; + + if (k >= afloat2.length) + { + k = 0; + } + } + + Shaders.configRenderResMul = afloat2[k]; + Shaders.scheduleResize(); + break; + + case SHADOW_RES_MUL: + float f1 = Shaders.configShadowResMul; + float[] afloat1 = QUALITY_MULTIPLIERS; + String[] astring1 = QUALITY_MULTIPLIER_NAMES; + int j = getValueIndex(f1, afloat1); + + if (isShiftKeyDown()) + { + --j; + + if (j < 0) + { + j = afloat1.length - 1; + } + } + else + { + ++j; + + if (j >= afloat1.length) + { + j = 0; + } + } + + Shaders.configShadowResMul = afloat1[j]; + Shaders.scheduleResizeShadow(); + break; + + case HAND_DEPTH_MUL: + float f = Shaders.configHandDepthMul; + float[] afloat = HAND_DEPTH_VALUES; + String[] astring = HAND_DEPTH_NAMES; + int i = getValueIndex(f, afloat); + + if (isShiftKeyDown()) + { + --i; + + if (i < 0) + { + i = afloat.length - 1; + } + } + else + { + ++i; + + if (i >= afloat.length) + { + i = 0; + } + } + + Shaders.configHandDepthMul = afloat[i]; + break; + + case CLOUD_SHADOW: + Shaders.configCloudShadow = !Shaders.configCloudShadow; + break; + + case OLD_HAND_LIGHT: + Shaders.configOldHandLight.nextValue(); + break; + + case OLD_LIGHTING: + Shaders.configOldLighting.nextValue(); + Shaders.updateBlockLightLevel(); + this.mc.scheduleResourcesRefresh(); + break; + + case TWEAK_BLOCK_DAMAGE: + Shaders.configTweakBlockDamage = !Shaders.configTweakBlockDamage; + break; + + case TEX_MIN_FIL_B: + Shaders.configTexMinFilB = (Shaders.configTexMinFilB + 1) % 3; + Shaders.configTexMinFilN = Shaders.configTexMinFilS = Shaders.configTexMinFilB; + button.displayString = "Tex Min: " + Shaders.texMinFilDesc[Shaders.configTexMinFilB]; + ShadersTex.updateTextureMinMagFilter(); + break; + + case TEX_MAG_FIL_N: + Shaders.configTexMagFilN = (Shaders.configTexMagFilN + 1) % 2; + button.displayString = "Tex_n Mag: " + Shaders.texMagFilDesc[Shaders.configTexMagFilN]; + ShadersTex.updateTextureMinMagFilter(); + break; + + case TEX_MAG_FIL_S: + Shaders.configTexMagFilS = (Shaders.configTexMagFilS + 1) % 2; + button.displayString = "Tex_s Mag: " + Shaders.texMagFilDesc[Shaders.configTexMagFilS]; + ShadersTex.updateTextureMinMagFilter(); + break; + + case SHADOW_CLIP_FRUSTRUM: + Shaders.configShadowClipFrustrum = !Shaders.configShadowClipFrustrum; + button.displayString = "ShadowClipFrustrum: " + toStringOnOff(Shaders.configShadowClipFrustrum); + ShadersTex.updateTextureMinMagFilter(); + } + + guibuttonenumshaderoption.updateButtonText(); + } + else + { + switch (button.id) + { + case 201: + switch (getOSType()) + { + case 1: + String s = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {Shaders.shaderpacksdir.getAbsolutePath()}); + + try + { + Runtime.getRuntime().exec(s); + return; + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + break; + } + + case 2: + try + { + Runtime.getRuntime().exec(new String[] {"/usr/bin/open", Shaders.shaderpacksdir.getAbsolutePath()}); + return; + } + catch (IOException ioexception1) + { + ioexception1.printStackTrace(); + } + } + + boolean flag = false; + + try + { + Class oclass = Class.forName("java.awt.Desktop"); + Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]); + oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {(new File(this.mc.mcDataDir, Shaders.shaderpacksdirname)).toURI()}); + } + catch (Throwable throwable) + { + throwable.printStackTrace(); + flag = true; + } + + if (flag) + { + Config.dbg("Opening via system class!"); + Sys.openURL("file://" + Shaders.shaderpacksdir.getAbsolutePath()); + } + + break; + + case 202: + new File(Shaders.shadersdir, "current.cfg"); + Shaders.storeConfig(); + this.saved = true; + this.mc.displayGuiScreen(this.parentGui); + break; + + case 203: + GuiShaderOptions guishaderoptions = new GuiShaderOptions(this, Config.getGameSettings()); + Config.getMinecraft().displayGuiScreen(guishaderoptions); + break; + + default: + this.shaderList.actionPerformed(button); + } + } + } + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + super.onGuiClosed(); + + if (!this.saved) + { + Shaders.storeConfig(); + } + } + + /** + * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks + */ + public void drawScreen(int mouseX, int mouseY, float partialTicks) + { + this.drawDefaultBackground(); + this.shaderList.drawScreen(mouseX, mouseY, partialTicks); + + if (this.updateTimer <= 0) + { + this.shaderList.updateList(); + this.updateTimer += 20; + } + + this.drawCenteredString(this.fontRendererObj, this.screenTitle + " ", this.width / 2, 15, 16777215); + String s = "OpenGL: " + Shaders.glVersionString + ", " + Shaders.glVendorString + ", " + Shaders.glRendererString; + int i = this.fontRendererObj.getStringWidth(s); + + if (i < this.width - 5) + { + this.drawCenteredString(this.fontRendererObj, s, this.width / 2, this.height - 40, 8421504); + } + else + { + this.drawString(this.fontRendererObj, s, 5, this.height - 40, 8421504); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + --this.updateTimer; + } + + public Minecraft getMc() + { + return this.mc; + } + + public void drawCenteredString(String text, int x, int y, int color) + { + this.drawCenteredString(this.fontRendererObj, text, x, y, color); + } + + public static String toStringOnOff(boolean value) + { + String s = Lang.getOn(); + String s1 = Lang.getOff(); + return value ? s : s1; + } + + public static String toStringAa(int value) + { + return value == 2 ? "FXAA 2x" : (value == 4 ? "FXAA 4x" : Lang.getOff()); + } + + public static String toStringValue(float val, float[] values, String[] names) + { + int i = getValueIndex(val, values); + return names[i]; + } + + public static int getValueIndex(float val, float[] values) + { + for (int i = 0; i < values.length; ++i) + { + float f = values[i]; + + if (f >= val) + { + return i; + } + } + + return values.length - 1; + } + + public static String toStringQuality(float val) + { + return toStringValue(val, QUALITY_MULTIPLIERS, QUALITY_MULTIPLIER_NAMES); + } + + public static String toStringHandDepth(float val) + { + return toStringValue(val, HAND_DEPTH_VALUES, HAND_DEPTH_NAMES); + } + + public static int getOSType() + { + String s = System.getProperty("os.name").toLowerCase(); + return s.contains("win") ? 1 : (s.contains("mac") ? 2 : (s.contains("solaris") ? 3 : (s.contains("sunos") ? 3 : (s.contains("linux") ? 4 : (s.contains("unix") ? 4 : 0))))); + } +} diff --git a/src/minecraft/shadersmod/client/GuiSlotShaders.java b/src/minecraft/shadersmod/client/GuiSlotShaders.java new file mode 100644 index 0000000..6e15bdd --- /dev/null +++ b/src/minecraft/shadersmod/client/GuiSlotShaders.java @@ -0,0 +1,118 @@ +package shadersmod.client; + +import java.util.ArrayList; +import net.minecraft.client.gui.GuiSlot; +import optifine.Lang; + +class GuiSlotShaders extends GuiSlot +{ + private ArrayList shaderslist; + private int selectedIndex; + private long lastClickedCached = 0L; + final GuiShaders shadersGui; + + public GuiSlotShaders(GuiShaders par1GuiShaders, int width, int height, int top, int bottom, int slotHeight) + { + super(par1GuiShaders.getMc(), width, height, top, bottom, slotHeight); + this.shadersGui = par1GuiShaders; + this.updateList(); + this.amountScrolled = 0.0F; + int i = this.selectedIndex * slotHeight; + int j = (bottom - top) / 2; + + if (i > j) + { + this.scrollBy(i - j); + } + } + + /** + * Gets the width of the list + */ + public int getListWidth() + { + return this.width - 20; + } + + public void updateList() + { + this.shaderslist = Shaders.listOfShaders(); + this.selectedIndex = 0; + int i = 0; + + for (int j = this.shaderslist.size(); i < j; ++i) + { + if (((String)this.shaderslist.get(i)).equals(Shaders.currentshadername)) + { + this.selectedIndex = i; + break; + } + } + } + + protected int getSize() + { + return this.shaderslist.size(); + } + + /** + * The element in the slot that was clicked, boolean for whether it was double clicked or not + */ + protected void elementClicked(int index, boolean doubleClicked, int mouseX, int mouseY) + { + if (index != this.selectedIndex || this.lastClicked != this.lastClickedCached) + { + this.selectedIndex = index; + this.lastClickedCached = this.lastClicked; + Shaders.setShaderPack((String)this.shaderslist.get(index)); + Shaders.uninit(); + this.shadersGui.updateButtons(); + } + } + + /** + * Returns true if the element passed in is currently selected + */ + protected boolean isSelected(int index) + { + return index == this.selectedIndex; + } + + protected int getScrollBarX() + { + return this.width - 6; + } + + /** + * Return the height of the content being scrolled + */ + protected int getContentHeight() + { + return this.getSize() * 18; + } + + protected void drawBackground() + { + } + + protected void drawSlot(int index, int posX, int posY, int contentY, int mouseX, int mouseY) + { + String s = (String)this.shaderslist.get(index); + + if (s.equals(Shaders.packNameNone)) + { + s = Lang.get("of.options.shaders.packNone"); + } + else if (s.equals(Shaders.packNameDefault)) + { + s = Lang.get("of.options.shaders.packDefault"); + } + + this.shadersGui.drawCenteredString(s, this.width / 2, posY + 1, 16777215); + } + + public int getSelectedIndex() + { + return this.selectedIndex; + } +} diff --git a/src/minecraft/shadersmod/client/HFNoiseTexture.java b/src/minecraft/shadersmod/client/HFNoiseTexture.java new file mode 100644 index 0000000..d69dbac --- /dev/null +++ b/src/minecraft/shadersmod/client/HFNoiseTexture.java @@ -0,0 +1,71 @@ +package shadersmod.client; + +import java.nio.ByteBuffer; +import net.minecraft.client.renderer.GlStateManager; +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.GL11; + +public class HFNoiseTexture +{ + public int texID = GL11.glGenTextures(); + public int textureUnit = 15; + + public HFNoiseTexture(int width, int height) + { + byte[] abyte = this.genHFNoiseImage(width, height); + ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length); + bytebuffer.put(abyte); + bytebuffer.flip(); + GlStateManager.bindTexture(this.texID); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, width, height, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)bytebuffer); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GlStateManager.bindTexture(0); + } + + public int getID() + { + return this.texID; + } + + public void destroy() + { + GlStateManager.deleteTexture(this.texID); + this.texID = 0; + } + + private int random(int seed) + { + seed = seed ^ seed << 13; + seed = seed ^ seed >> 17; + seed = seed ^ seed << 5; + return seed; + } + + private byte random(int x, int y, int z) + { + int i = (this.random(x) + this.random(y * 19)) * this.random(z * 23) - z; + return (byte)(this.random(i) % 128); + } + + private byte[] genHFNoiseImage(int width, int height) + { + byte[] abyte = new byte[width * height * 3]; + int i = 0; + + for (int j = 0; j < height; ++j) + { + for (int k = 0; k < width; ++k) + { + for (int l = 1; l < 4; ++l) + { + abyte[i++] = this.random(k, j, l); + } + } + } + + return abyte; + } +} diff --git a/src/minecraft/shadersmod/client/IShaderPack.java b/src/minecraft/shadersmod/client/IShaderPack.java new file mode 100644 index 0000000..f57b732 --- /dev/null +++ b/src/minecraft/shadersmod/client/IShaderPack.java @@ -0,0 +1,14 @@ +package shadersmod.client; + +import java.io.InputStream; + +public interface IShaderPack +{ + String getName(); + + InputStream getResourceAsStream(String var1); + + boolean hasDirectory(String var1); + + void close(); +} diff --git a/src/minecraft/shadersmod/client/Iterator3d.java b/src/minecraft/shadersmod/client/Iterator3d.java new file mode 100644 index 0000000..aa6656b --- /dev/null +++ b/src/minecraft/shadersmod/client/Iterator3d.java @@ -0,0 +1,141 @@ +package shadersmod.client; + +import java.util.Iterator; + +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; +import optifine.BlockPosM; + +public class Iterator3d implements Iterator +{ + private IteratorAxis iteratorAxis; + private BlockPosM blockPos = new BlockPosM(0, 0, 0); + private int axis = 0; + private int kX; + private int kY; + private int kZ; + private static final int AXIS_X = 0; + private static final int AXIS_Y = 1; + private static final int AXIS_Z = 2; + + public Iterator3d(BlockPos posStart, BlockPos posEnd, int width, int height) + { + boolean flag = posStart.getX() > posEnd.getX(); + boolean flag1 = posStart.getY() > posEnd.getY(); + boolean flag2 = posStart.getZ() > posEnd.getZ(); + posStart = this.reverseCoord(posStart, flag, flag1, flag2); + posEnd = this.reverseCoord(posEnd, flag, flag1, flag2); + this.kX = flag ? -1 : 1; + this.kY = flag1 ? -1 : 1; + this.kZ = flag2 ? -1 : 1; + Vec3 vec3 = new Vec3((double)(posEnd.getX() - posStart.getX()), (double)(posEnd.getY() - posStart.getY()), (double)(posEnd.getZ() - posStart.getZ())); + Vec3 vec31 = vec3.normalize(); + Vec3 vec32 = new Vec3(1.0D, 0.0D, 0.0D); + double d0 = vec31.dotProduct(vec32); + double d1 = Math.abs(d0); + Vec3 vec33 = new Vec3(0.0D, 1.0D, 0.0D); + double d2 = vec31.dotProduct(vec33); + double d3 = Math.abs(d2); + Vec3 vec34 = new Vec3(0.0D, 0.0D, 1.0D); + double d4 = vec31.dotProduct(vec34); + double d5 = Math.abs(d4); + + if (d5 >= d3 && d5 >= d1) + { + this.axis = 2; + BlockPos blockpos3 = new BlockPos(posStart.getZ(), posStart.getY() - width, posStart.getX() - height); + BlockPos blockpos5 = new BlockPos(posEnd.getZ(), posStart.getY() + width + 1, posStart.getX() + height + 1); + int k = posEnd.getZ() - posStart.getZ(); + double d9 = (double)(posEnd.getY() - posStart.getY()) / (1.0D * (double)k); + double d11 = (double)(posEnd.getX() - posStart.getX()) / (1.0D * (double)k); + this.iteratorAxis = new IteratorAxis(blockpos3, blockpos5, d9, d11); + } + else if (d3 >= d1 && d3 >= d5) + { + this.axis = 1; + BlockPos blockpos2 = new BlockPos(posStart.getY(), posStart.getX() - width, posStart.getZ() - height); + BlockPos blockpos4 = new BlockPos(posEnd.getY(), posStart.getX() + width + 1, posStart.getZ() + height + 1); + int j = posEnd.getY() - posStart.getY(); + double d8 = (double)(posEnd.getX() - posStart.getX()) / (1.0D * (double)j); + double d10 = (double)(posEnd.getZ() - posStart.getZ()) / (1.0D * (double)j); + this.iteratorAxis = new IteratorAxis(blockpos2, blockpos4, d8, d10); + } + else + { + this.axis = 0; + BlockPos blockpos = new BlockPos(posStart.getX(), posStart.getY() - width, posStart.getZ() - height); + BlockPos blockpos1 = new BlockPos(posEnd.getX(), posStart.getY() + width + 1, posStart.getZ() + height + 1); + int i = posEnd.getX() - posStart.getX(); + double d6 = (double)(posEnd.getY() - posStart.getY()) / (1.0D * (double)i); + double d7 = (double)(posEnd.getZ() - posStart.getZ()) / (1.0D * (double)i); + this.iteratorAxis = new IteratorAxis(blockpos, blockpos1, d6, d7); + } + } + + private BlockPos reverseCoord(BlockPos pos, boolean revX, boolean revY, boolean revZ) + { + if (revX) + { + pos = new BlockPos(-pos.getX(), pos.getY(), pos.getZ()); + } + + if (revY) + { + pos = new BlockPos(pos.getX(), -pos.getY(), pos.getZ()); + } + + if (revZ) + { + pos = new BlockPos(pos.getX(), pos.getY(), -pos.getZ()); + } + + return pos; + } + + public boolean hasNext() + { + return this.iteratorAxis.hasNext(); + } + + public BlockPos next() + { + BlockPos blockpos = this.iteratorAxis.next(); + + switch (this.axis) + { + case 0: + this.blockPos.setXyz(blockpos.getX() * this.kX, blockpos.getY() * this.kY, blockpos.getZ() * this.kZ); + return this.blockPos; + + case 1: + this.blockPos.setXyz(blockpos.getY() * this.kX, blockpos.getX() * this.kY, blockpos.getZ() * this.kZ); + return this.blockPos; + + case 2: + this.blockPos.setXyz(blockpos.getZ() * this.kX, blockpos.getY() * this.kY, blockpos.getX() * this.kZ); + return this.blockPos; + + default: + this.blockPos.setXyz(blockpos.getX() * this.kX, blockpos.getY() * this.kY, blockpos.getZ() * this.kZ); + return this.blockPos; + } + } + + public void remove() + { + throw new RuntimeException("Not supported"); + } + + public static void main(String[] args) + { + BlockPos blockpos = new BlockPos(10, 20, 30); + BlockPos blockpos1 = new BlockPos(30, 40, 20); + Iterator3d iterator3d = new Iterator3d(blockpos, blockpos1, 1, 1); + + while (iterator3d.hasNext()) + { + BlockPos blockpos2 = iterator3d.next(); + System.out.println("" + blockpos2); + } + } +} diff --git a/src/minecraft/shadersmod/client/IteratorAxis.java b/src/minecraft/shadersmod/client/IteratorAxis.java new file mode 100644 index 0000000..8914125 --- /dev/null +++ b/src/minecraft/shadersmod/client/IteratorAxis.java @@ -0,0 +1,109 @@ +package shadersmod.client; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +import net.minecraft.util.BlockPos; +import optifine.BlockPosM; + +public class IteratorAxis implements Iterator +{ + private double yDelta; + private double zDelta; + private int xStart; + private int xEnd; + private double yStart; + private double yEnd; + private double zStart; + private double zEnd; + private int xNext; + private double yNext; + private double zNext; + private BlockPosM pos = new BlockPosM(0, 0, 0); + private boolean hasNext = false; + + public IteratorAxis(BlockPos posStart, BlockPos posEnd, double yDelta, double zDelta) + { + this.yDelta = yDelta; + this.zDelta = zDelta; + this.xStart = posStart.getX(); + this.xEnd = posEnd.getX(); + this.yStart = (double)posStart.getY(); + this.yEnd = (double)posEnd.getY() - 0.5D; + this.zStart = (double)posStart.getZ(); + this.zEnd = (double)posEnd.getZ() - 0.5D; + this.xNext = this.xStart; + this.yNext = this.yStart; + this.zNext = this.zStart; + this.hasNext = this.xNext < this.xEnd && this.yNext < this.yEnd && this.zNext < this.zEnd; + } + + public boolean hasNext() + { + return this.hasNext; + } + + public BlockPos next() + { + if (!this.hasNext) + { + throw new NoSuchElementException(); + } + else + { + this.pos.setXyz((double)this.xNext, this.yNext, this.zNext); + this.nextPos(); + this.hasNext = this.xNext < this.xEnd && this.yNext < this.yEnd && this.zNext < this.zEnd; + return this.pos; + } + } + + private void nextPos() + { + ++this.zNext; + + if (this.zNext >= this.zEnd) + { + this.zNext = this.zStart; + ++this.yNext; + + if (this.yNext >= this.yEnd) + { + this.yNext = this.yStart; + this.yStart += this.yDelta; + this.yEnd += this.yDelta; + this.yNext = this.yStart; + this.zStart += this.zDelta; + this.zEnd += this.zDelta; + this.zNext = this.zStart; + ++this.xNext; + + if (this.xNext >= this.xEnd) + { + ; + } + } + } + } + + public void remove() + { + throw new RuntimeException("Not implemented"); + } + + public static void main(String[] args) throws Exception + { + BlockPos blockpos = new BlockPos(-2, 10, 20); + BlockPos blockpos1 = new BlockPos(2, 12, 22); + double d0 = -0.5D; + double d1 = 0.5D; + IteratorAxis iteratoraxis = new IteratorAxis(blockpos, blockpos1, d0, d1); + System.out.println("Start: " + blockpos + ", end: " + blockpos1 + ", yDelta: " + d0 + ", zDelta: " + d1); + + while (iteratoraxis.hasNext()) + { + BlockPos blockpos2 = iteratoraxis.next(); + System.out.println("" + blockpos2); + } + } +} diff --git a/src/minecraft/shadersmod/client/IteratorRenderChunks.java b/src/minecraft/shadersmod/client/IteratorRenderChunks.java new file mode 100644 index 0000000..cc53872 --- /dev/null +++ b/src/minecraft/shadersmod/client/IteratorRenderChunks.java @@ -0,0 +1,38 @@ +package shadersmod.client; + +import java.util.Iterator; +import net.minecraft.client.renderer.ViewFrustum; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.util.BlockPos; +import optifine.BlockPosM; + +public class IteratorRenderChunks implements Iterator +{ + private ViewFrustum viewFrustum; + private Iterator3d Iterator3d; + private BlockPosM posBlock = new BlockPosM(0, 0, 0); + + public IteratorRenderChunks(ViewFrustum viewFrustum, BlockPos posStart, BlockPos posEnd, int width, int height) + { + this.viewFrustum = viewFrustum; + this.Iterator3d = new Iterator3d(posStart, posEnd, width, height); + } + + public boolean hasNext() + { + return this.Iterator3d.hasNext(); + } + + public RenderChunk next() + { + BlockPos blockpos = this.Iterator3d.next(); + this.posBlock.setXyz(blockpos.getX() << 4, blockpos.getY() << 4, blockpos.getZ() << 4); + RenderChunk renderchunk = this.viewFrustum.getRenderChunk(this.posBlock); + return renderchunk; + } + + public void remove() + { + throw new RuntimeException("Not implemented"); + } +} diff --git a/src/minecraft/shadersmod/client/MultiTexID.java b/src/minecraft/shadersmod/client/MultiTexID.java new file mode 100644 index 0000000..044bb1c --- /dev/null +++ b/src/minecraft/shadersmod/client/MultiTexID.java @@ -0,0 +1,15 @@ +package shadersmod.client; + +public class MultiTexID +{ + public int base; + public int norm; + public int spec; + + public MultiTexID(int baseTex, int normTex, int specTex) + { + this.base = baseTex; + this.norm = normTex; + this.spec = specTex; + } +} diff --git a/src/minecraft/shadersmod/client/Property.java b/src/minecraft/shadersmod/client/Property.java new file mode 100644 index 0000000..c2fdb58 --- /dev/null +++ b/src/minecraft/shadersmod/client/Property.java @@ -0,0 +1,141 @@ +package shadersmod.client; + +import java.util.Properties; + +import org.apache.commons.lang3.ArrayUtils; + +import optifine.Config; + +public class Property +{ + private int[] values = null; + private int defaultValue = 0; + private String propertyName = null; + private String[] propertyValues = null; + private String userName = null; + private String[] userValues = null; + private int value = 0; + + public Property(String propertyName, String[] propertyValues, String userName, String[] userValues, int defaultValue) + { + this.propertyName = propertyName; + this.propertyValues = propertyValues; + this.userName = userName; + this.userValues = userValues; + this.defaultValue = defaultValue; + + if (propertyValues.length != userValues.length) + { + throw new IllegalArgumentException("Property and user values have different lengths: " + propertyValues.length + " != " + userValues.length); + } + else if (defaultValue >= 0 && defaultValue < propertyValues.length) + { + this.value = defaultValue; + } + else + { + throw new IllegalArgumentException("Invalid default value: " + defaultValue); + } + } + + public boolean setPropertyValue(String propVal) + { + if (propVal == null) + { + this.value = this.defaultValue; + return false; + } + else + { + this.value = ArrayUtils.indexOf(this.propertyValues, propVal); + + if (this.value >= 0 && this.value < this.propertyValues.length) + { + return true; + } + else + { + this.value = this.defaultValue; + return false; + } + } + } + + public void nextValue() + { + ++this.value; + + if (this.value < 0 || this.value >= this.propertyValues.length) + { + this.value = 0; + } + } + + public void setValue(int val) + { + this.value = val; + + if (this.value < 0 || this.value >= this.propertyValues.length) + { + this.value = this.defaultValue; + } + } + + public int getValue() + { + return this.value; + } + + public String getUserValue() + { + return this.userValues[this.value]; + } + + public String getPropertyValue() + { + return this.propertyValues[this.value]; + } + + public String getUserName() + { + return this.userName; + } + + public String getPropertyName() + { + return this.propertyName; + } + + public void resetValue() + { + this.value = this.defaultValue; + } + + public boolean loadFrom(Properties props) + { + this.resetValue(); + + if (props == null) + { + return false; + } + else + { + String s = props.getProperty(this.propertyName); + return s == null ? false : this.setPropertyValue(s); + } + } + + public void saveTo(Properties props) + { + if (props != null) + { + props.setProperty(this.getPropertyName(), this.getPropertyValue()); + } + } + + public String toString() + { + return "" + this.propertyName + "=" + this.getPropertyValue() + " [" + Config.arrayToString((Object[])this.propertyValues) + "], value: " + this.value; + } +} diff --git a/src/minecraft/shadersmod/client/PropertyDefaultFastFancyOff.java b/src/minecraft/shadersmod/client/PropertyDefaultFastFancyOff.java new file mode 100644 index 0000000..28d45ce --- /dev/null +++ b/src/minecraft/shadersmod/client/PropertyDefaultFastFancyOff.java @@ -0,0 +1,44 @@ +package shadersmod.client; + +import optifine.Config; + +public class PropertyDefaultFastFancyOff extends Property +{ + public static final String[] PROPERTY_VALUES = new String[] {"default", "fast", "fancy", "off"}; + public static final String[] USER_VALUES = new String[] {"Default", "Fast", "Fancy", "OFF"}; + + public PropertyDefaultFastFancyOff(String propertyName, String userName, int defaultValue) + { + super(propertyName, PROPERTY_VALUES, userName, USER_VALUES, defaultValue); + } + + public boolean isDefault() + { + return this.getValue() == 0; + } + + public boolean isFast() + { + return this.getValue() == 1; + } + + public boolean isFancy() + { + return this.getValue() == 2; + } + + public boolean isOff() + { + return this.getValue() == 3; + } + + public boolean setPropertyValue(String propVal) + { + if (Config.equals(propVal, "none")) + { + propVal = "off"; + } + + return super.setPropertyValue(propVal); + } +} diff --git a/src/minecraft/shadersmod/client/PropertyDefaultTrueFalse.java b/src/minecraft/shadersmod/client/PropertyDefaultTrueFalse.java new file mode 100644 index 0000000..fda0d6b --- /dev/null +++ b/src/minecraft/shadersmod/client/PropertyDefaultTrueFalse.java @@ -0,0 +1,34 @@ +package shadersmod.client; + +import optifine.Lang; + +public class PropertyDefaultTrueFalse extends Property +{ + public static final String[] PROPERTY_VALUES = new String[] {"default", "true", "false"}; + public static final String[] USER_VALUES = new String[] {"Default", "ON", "OFF"}; + + public PropertyDefaultTrueFalse(String propertyName, String userName, int defaultValue) + { + super(propertyName, PROPERTY_VALUES, userName, USER_VALUES, defaultValue); + } + + public String getUserValue() + { + return this.isDefault() ? Lang.getDefault() : (this.isTrue() ? Lang.getOn() : (this.isFalse() ? Lang.getOff() : super.getUserValue())); + } + + public boolean isDefault() + { + return this.getValue() == 0; + } + + public boolean isTrue() + { + return this.getValue() == 1; + } + + public boolean isFalse() + { + return this.getValue() == 2; + } +} diff --git a/src/minecraft/shadersmod/client/SMath.java b/src/minecraft/shadersmod/client/SMath.java new file mode 100644 index 0000000..806476e --- /dev/null +++ b/src/minecraft/shadersmod/client/SMath.java @@ -0,0 +1,66 @@ +package shadersmod.client; + +import java.nio.FloatBuffer; +import java.util.Arrays; + +public class SMath +{ + static void multiplyMat4xMat4(float[] matOut, float[] matA, float[] matB) + { + for (int i = 0; i < 4; ++i) + { + for (int j = 0; j < 4; ++j) + { + matOut[4 * i + j] = matA[4 * i + 0] * matB[0 + j] + matA[4 * i + 1] * matB[4 + j] + matA[4 * i + 2] * matB[8 + j] + matA[4 * i + 3] * matB[12 + j]; + } + } + } + + static void multiplyMat4xVec4(float[] vecOut, float[] matA, float[] vecB) + { + vecOut[0] = matA[0] * vecB[0] + matA[4] * vecB[1] + matA[8] * vecB[2] + matA[12] * vecB[3]; + vecOut[1] = matA[1] * vecB[0] + matA[5] * vecB[1] + matA[9] * vecB[2] + matA[13] * vecB[3]; + vecOut[2] = matA[2] * vecB[0] + matA[6] * vecB[1] + matA[10] * vecB[2] + matA[14] * vecB[3]; + vecOut[3] = matA[3] * vecB[0] + matA[7] * vecB[1] + matA[11] * vecB[2] + matA[15] * vecB[3]; + } + + static void invertMat4(float[] matOut, float[] m) + { + matOut[0] = m[5] * m[10] * m[15] - m[5] * m[11] * m[14] - m[9] * m[6] * m[15] + m[9] * m[7] * m[14] + m[13] * m[6] * m[11] - m[13] * m[7] * m[10]; + matOut[1] = -m[1] * m[10] * m[15] + m[1] * m[11] * m[14] + m[9] * m[2] * m[15] - m[9] * m[3] * m[14] - m[13] * m[2] * m[11] + m[13] * m[3] * m[10]; + matOut[2] = m[1] * m[6] * m[15] - m[1] * m[7] * m[14] - m[5] * m[2] * m[15] + m[5] * m[3] * m[14] + m[13] * m[2] * m[7] - m[13] * m[3] * m[6]; + matOut[3] = -m[1] * m[6] * m[11] + m[1] * m[7] * m[10] + m[5] * m[2] * m[11] - m[5] * m[3] * m[10] - m[9] * m[2] * m[7] + m[9] * m[3] * m[6]; + matOut[4] = -m[4] * m[10] * m[15] + m[4] * m[11] * m[14] + m[8] * m[6] * m[15] - m[8] * m[7] * m[14] - m[12] * m[6] * m[11] + m[12] * m[7] * m[10]; + matOut[5] = m[0] * m[10] * m[15] - m[0] * m[11] * m[14] - m[8] * m[2] * m[15] + m[8] * m[3] * m[14] + m[12] * m[2] * m[11] - m[12] * m[3] * m[10]; + matOut[6] = -m[0] * m[6] * m[15] + m[0] * m[7] * m[14] + m[4] * m[2] * m[15] - m[4] * m[3] * m[14] - m[12] * m[2] * m[7] + m[12] * m[3] * m[6]; + matOut[7] = m[0] * m[6] * m[11] - m[0] * m[7] * m[10] - m[4] * m[2] * m[11] + m[4] * m[3] * m[10] + m[8] * m[2] * m[7] - m[8] * m[3] * m[6]; + matOut[8] = m[4] * m[9] * m[15] - m[4] * m[11] * m[13] - m[8] * m[5] * m[15] + m[8] * m[7] * m[13] + m[12] * m[5] * m[11] - m[12] * m[7] * m[9]; + matOut[9] = -m[0] * m[9] * m[15] + m[0] * m[11] * m[13] + m[8] * m[1] * m[15] - m[8] * m[3] * m[13] - m[12] * m[1] * m[11] + m[12] * m[3] * m[9]; + matOut[10] = m[0] * m[5] * m[15] - m[0] * m[7] * m[13] - m[4] * m[1] * m[15] + m[4] * m[3] * m[13] + m[12] * m[1] * m[7] - m[12] * m[3] * m[5]; + matOut[11] = -m[0] * m[5] * m[11] + m[0] * m[7] * m[9] + m[4] * m[1] * m[11] - m[4] * m[3] * m[9] - m[8] * m[1] * m[7] + m[8] * m[3] * m[5]; + matOut[12] = -m[4] * m[9] * m[14] + m[4] * m[10] * m[13] + m[8] * m[5] * m[14] - m[8] * m[6] * m[13] - m[12] * m[5] * m[10] + m[12] * m[6] * m[9]; + matOut[13] = m[0] * m[9] * m[14] - m[0] * m[10] * m[13] - m[8] * m[1] * m[14] + m[8] * m[2] * m[13] + m[12] * m[1] * m[10] - m[12] * m[2] * m[9]; + matOut[14] = -m[0] * m[5] * m[14] + m[0] * m[6] * m[13] + m[4] * m[1] * m[14] - m[4] * m[2] * m[13] - m[12] * m[1] * m[6] + m[12] * m[2] * m[5]; + matOut[15] = m[0] * m[5] * m[10] - m[0] * m[6] * m[9] - m[4] * m[1] * m[10] + m[4] * m[2] * m[9] + m[8] * m[1] * m[6] - m[8] * m[2] * m[5]; + float f = m[0] * matOut[0] + m[1] * matOut[4] + m[2] * matOut[8] + m[3] * matOut[12]; + + if ((double)f != 0.0D) + { + for (int i = 0; i < 16; ++i) + { + matOut[i] /= f; + } + } + else + { + Arrays.fill(matOut, 0.0F); + } + } + + static void invertMat4FBFA(FloatBuffer fbInvOut, FloatBuffer fbMatIn, float[] faInv, float[] faMat) + { + fbMatIn.get(faMat); + invertMat4(faInv, faMat); + fbInvOut.put(faInv); + } +} diff --git a/src/minecraft/shadersmod/client/SVertexAttrib.java b/src/minecraft/shadersmod/client/SVertexAttrib.java new file mode 100644 index 0000000..5471061 --- /dev/null +++ b/src/minecraft/shadersmod/client/SVertexAttrib.java @@ -0,0 +1,18 @@ +package shadersmod.client; + +import net.minecraft.client.renderer.vertex.VertexFormatElement; + +public class SVertexAttrib +{ + public int index; + public int count; + public VertexFormatElement.EnumType type; + public int offset; + + public SVertexAttrib(int index, int count, VertexFormatElement.EnumType type) + { + this.index = index; + this.count = count; + this.type = type; + } +} diff --git a/src/minecraft/shadersmod/client/SVertexBuilder.java b/src/minecraft/shadersmod/client/SVertexBuilder.java new file mode 100644 index 0000000..703f86a --- /dev/null +++ b/src/minecraft/shadersmod/client/SVertexBuilder.java @@ -0,0 +1,304 @@ +package shadersmod.client; + +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import net.minecraft.block.Block; +import net.minecraft.block.state.BlockStateBase; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL20; + +public class SVertexBuilder +{ + int vertexSize; + int offsetNormal; + int offsetUV; + int offsetUVCenter; + boolean hasNormal; + boolean hasTangent; + boolean hasUV; + boolean hasUVCenter; + long[] entityData = new long[10]; + int entityDataIndex = 0; + + public SVertexBuilder() + { + this.entityData[this.entityDataIndex] = 0L; + } + + public static void initVertexBuilder(WorldRenderer wrr) + { + wrr.sVertexBuilder = new SVertexBuilder(); + } + + public void pushEntity(long data) + { + ++this.entityDataIndex; + this.entityData[this.entityDataIndex] = data; + } + + public void popEntity() + { + this.entityData[this.entityDataIndex] = 0L; + --this.entityDataIndex; + } + + public static void pushEntity(IBlockState blockState, BlockPos blockPos, IBlockAccess blockAccess, WorldRenderer wrr) + { + Block block = blockState.getBlock(); + int i; + int j; + + if (blockState instanceof BlockStateBase) + { + BlockStateBase blockstatebase = (BlockStateBase)blockState; + i = blockstatebase.getBlockId(); + j = blockstatebase.getMetadata(); + } + else + { + i = Block.getIdFromBlock(block); + j = block.getMetaFromState(blockState); + } + + i = BlockAliases.getMappedBlockId(i, j); + int i1 = block.getRenderType(); + int k = ((i1 & 65535) << 16) + (i & 65535); + int l = j & 65535; + wrr.sVertexBuilder.pushEntity(((long)l << 32) + (long)k); + } + + public static void popEntity(WorldRenderer wrr) + { + wrr.sVertexBuilder.popEntity(); + } + + public static boolean popEntity(boolean value, WorldRenderer wrr) + { + wrr.sVertexBuilder.popEntity(); + return value; + } + + public static void endSetVertexFormat(WorldRenderer wrr) + { + SVertexBuilder svertexbuilder = wrr.sVertexBuilder; + VertexFormat vertexformat = wrr.getVertexFormat(); + svertexbuilder.vertexSize = vertexformat.getNextOffset() / 4; + svertexbuilder.hasNormal = vertexformat.hasNormal(); + svertexbuilder.hasTangent = svertexbuilder.hasNormal; + svertexbuilder.hasUV = vertexformat.hasUvOffset(0); + svertexbuilder.offsetNormal = svertexbuilder.hasNormal ? vertexformat.getNormalOffset() / 4 : 0; + svertexbuilder.offsetUV = svertexbuilder.hasUV ? vertexformat.getUvOffsetById(0) / 4 : 0; + svertexbuilder.offsetUVCenter = 8; + } + + public static void beginAddVertex(WorldRenderer wrr) + { + if (wrr.vertexCount == 0) + { + endSetVertexFormat(wrr); + } + } + + public static void endAddVertex(WorldRenderer wrr) + { + SVertexBuilder svertexbuilder = wrr.sVertexBuilder; + + if (svertexbuilder.vertexSize == 14) + { + if (wrr.drawMode == 7 && wrr.vertexCount % 4 == 0) + { + svertexbuilder.calcNormal(wrr, wrr.func_181664_j() - 4 * svertexbuilder.vertexSize); + } + + long i = svertexbuilder.entityData[svertexbuilder.entityDataIndex]; + int j = wrr.func_181664_j() - 14 + 12; + wrr.rawIntBuffer.put(j, (int)i); + wrr.rawIntBuffer.put(j + 1, (int)(i >> 32)); + } + } + + public static void beginAddVertexData(WorldRenderer wrr, int[] data) + { + if (wrr.vertexCount == 0) + { + endSetVertexFormat(wrr); + } + + SVertexBuilder svertexbuilder = wrr.sVertexBuilder; + + if (svertexbuilder.vertexSize == 14) + { + long i = svertexbuilder.entityData[svertexbuilder.entityDataIndex]; + + for (int j = 12; j + 1 < data.length; j += 14) + { + data[j] = (int)i; + data[j + 1] = (int)(i >> 32); + } + } + } + + public static void endAddVertexData(WorldRenderer wrr) + { + SVertexBuilder svertexbuilder = wrr.sVertexBuilder; + + if (svertexbuilder.vertexSize == 14 && wrr.drawMode == 7 && wrr.vertexCount % 4 == 0) + { + svertexbuilder.calcNormal(wrr, wrr.func_181664_j() - 4 * svertexbuilder.vertexSize); + } + } + + public void calcNormal(WorldRenderer wrr, int baseIndex) + { + FloatBuffer floatbuffer = wrr.rawFloatBuffer; + IntBuffer intbuffer = wrr.rawIntBuffer; + int i = wrr.func_181664_j(); + float f = floatbuffer.get(baseIndex + 0 * this.vertexSize); + float f1 = floatbuffer.get(baseIndex + 0 * this.vertexSize + 1); + float f2 = floatbuffer.get(baseIndex + 0 * this.vertexSize + 2); + float f3 = floatbuffer.get(baseIndex + 0 * this.vertexSize + this.offsetUV); + float f4 = floatbuffer.get(baseIndex + 0 * this.vertexSize + this.offsetUV + 1); + float f5 = floatbuffer.get(baseIndex + 1 * this.vertexSize); + float f6 = floatbuffer.get(baseIndex + 1 * this.vertexSize + 1); + float f7 = floatbuffer.get(baseIndex + 1 * this.vertexSize + 2); + float f8 = floatbuffer.get(baseIndex + 1 * this.vertexSize + this.offsetUV); + float f9 = floatbuffer.get(baseIndex + 1 * this.vertexSize + this.offsetUV + 1); + float f10 = floatbuffer.get(baseIndex + 2 * this.vertexSize); + float f11 = floatbuffer.get(baseIndex + 2 * this.vertexSize + 1); + float f12 = floatbuffer.get(baseIndex + 2 * this.vertexSize + 2); + float f13 = floatbuffer.get(baseIndex + 2 * this.vertexSize + this.offsetUV); + float f14 = floatbuffer.get(baseIndex + 2 * this.vertexSize + this.offsetUV + 1); + float f15 = floatbuffer.get(baseIndex + 3 * this.vertexSize); + float f16 = floatbuffer.get(baseIndex + 3 * this.vertexSize + 1); + float f17 = floatbuffer.get(baseIndex + 3 * this.vertexSize + 2); + float f18 = floatbuffer.get(baseIndex + 3 * this.vertexSize + this.offsetUV); + float f19 = floatbuffer.get(baseIndex + 3 * this.vertexSize + this.offsetUV + 1); + float f20 = f10 - f; + float f21 = f11 - f1; + float f22 = f12 - f2; + float f23 = f15 - f5; + float f24 = f16 - f6; + float f25 = f17 - f7; + float f30 = f21 * f25 - f24 * f22; + float f31 = f22 * f23 - f25 * f20; + float f32 = f20 * f24 - f23 * f21; + float f33 = f30 * f30 + f31 * f31 + f32 * f32; + float f34 = (double)f33 != 0.0D ? (float)(1.0D / Math.sqrt((double)f33)) : 1.0F; + f30 = f30 * f34; + f31 = f31 * f34; + f32 = f32 * f34; + f20 = f5 - f; + f21 = f6 - f1; + f22 = f7 - f2; + float f26 = f8 - f3; + float f27 = f9 - f4; + f23 = f10 - f; + f24 = f11 - f1; + f25 = f12 - f2; + float f28 = f13 - f3; + float f29 = f14 - f4; + float f35 = f26 * f29 - f28 * f27; + float f36 = f35 != 0.0F ? 1.0F / f35 : 1.0F; + float f37 = (f29 * f20 - f27 * f23) * f36; + float f38 = (f29 * f21 - f27 * f24) * f36; + float f39 = (f29 * f22 - f27 * f25) * f36; + float f40 = (f26 * f23 - f28 * f20) * f36; + float f41 = (f26 * f24 - f28 * f21) * f36; + float f42 = (f26 * f25 - f28 * f22) * f36; + f33 = f37 * f37 + f38 * f38 + f39 * f39; + f34 = (double)f33 != 0.0D ? (float)(1.0D / Math.sqrt((double)f33)) : 1.0F; + f37 = f37 * f34; + f38 = f38 * f34; + f39 = f39 * f34; + f33 = f40 * f40 + f41 * f41 + f42 * f42; + f34 = (double)f33 != 0.0D ? (float)(1.0D / Math.sqrt((double)f33)) : 1.0F; + f40 = f40 * f34; + f41 = f41 * f34; + f42 = f42 * f34; + float f43 = f32 * f38 - f31 * f39; + float f44 = f30 * f39 - f32 * f37; + float f45 = f31 * f37 - f30 * f38; + float f46 = f40 * f43 + f41 * f44 + f42 * f45 < 0.0F ? -1.0F : 1.0F; + int j = (int)(f30 * 127.0F) & 255; + int k = (int)(f31 * 127.0F) & 255; + int l = (int)(f32 * 127.0F) & 255; + int i1 = (l << 16) + (k << 8) + j; + intbuffer.put(baseIndex + 0 * this.vertexSize + this.offsetNormal, i1); + intbuffer.put(baseIndex + 1 * this.vertexSize + this.offsetNormal, i1); + intbuffer.put(baseIndex + 2 * this.vertexSize + this.offsetNormal, i1); + intbuffer.put(baseIndex + 3 * this.vertexSize + this.offsetNormal, i1); + int j1 = ((int)(f37 * 32767.0F) & 65535) + (((int)(f38 * 32767.0F) & 65535) << 16); + int k1 = ((int)(f39 * 32767.0F) & 65535) + (((int)(f46 * 32767.0F) & 65535) << 16); + intbuffer.put(baseIndex + 0 * this.vertexSize + 10, j1); + intbuffer.put(baseIndex + 0 * this.vertexSize + 10 + 1, k1); + intbuffer.put(baseIndex + 1 * this.vertexSize + 10, j1); + intbuffer.put(baseIndex + 1 * this.vertexSize + 10 + 1, k1); + intbuffer.put(baseIndex + 2 * this.vertexSize + 10, j1); + intbuffer.put(baseIndex + 2 * this.vertexSize + 10 + 1, k1); + intbuffer.put(baseIndex + 3 * this.vertexSize + 10, j1); + intbuffer.put(baseIndex + 3 * this.vertexSize + 10 + 1, k1); + float f47 = (f3 + f8 + f13 + f18) / 4.0F; + float f48 = (f4 + f9 + f14 + f19) / 4.0F; + floatbuffer.put(baseIndex + 0 * this.vertexSize + 8, f47); + floatbuffer.put(baseIndex + 0 * this.vertexSize + 8 + 1, f48); + floatbuffer.put(baseIndex + 1 * this.vertexSize + 8, f47); + floatbuffer.put(baseIndex + 1 * this.vertexSize + 8 + 1, f48); + floatbuffer.put(baseIndex + 2 * this.vertexSize + 8, f47); + floatbuffer.put(baseIndex + 2 * this.vertexSize + 8 + 1, f48); + floatbuffer.put(baseIndex + 3 * this.vertexSize + 8, f47); + floatbuffer.put(baseIndex + 3 * this.vertexSize + 8 + 1, f48); + } + + public static void calcNormalChunkLayer(WorldRenderer wrr) + { + if (wrr.getVertexFormat().hasNormal() && wrr.drawMode == 7 && wrr.vertexCount % 4 == 0) + { + SVertexBuilder svertexbuilder = wrr.sVertexBuilder; + endSetVertexFormat(wrr); + int i = wrr.vertexCount * svertexbuilder.vertexSize; + + for (int j = 0; j < i; j += svertexbuilder.vertexSize * 4) + { + svertexbuilder.calcNormal(wrr, j); + } + } + } + + public static void drawArrays(int drawMode, int first, int count, WorldRenderer wrr) + { + if (count != 0) + { + VertexFormat vertexformat = wrr.getVertexFormat(); + int i = vertexformat.getNextOffset(); + + if (i == 56) + { + ByteBuffer bytebuffer = wrr.getByteBuffer(); + bytebuffer.position(32); + GL20.glVertexAttribPointer(Shaders.midTexCoordAttrib, 2, GL11.GL_FLOAT, false, i, bytebuffer); + bytebuffer.position(40); + GL20.glVertexAttribPointer(Shaders.tangentAttrib, 4, GL11.GL_SHORT, false, i, bytebuffer); + bytebuffer.position(48); + GL20.glVertexAttribPointer(Shaders.entityAttrib, 3, GL11.GL_SHORT, false, i, bytebuffer); + bytebuffer.position(0); + GL20.glEnableVertexAttribArray(Shaders.midTexCoordAttrib); + GL20.glEnableVertexAttribArray(Shaders.tangentAttrib); + GL20.glEnableVertexAttribArray(Shaders.entityAttrib); + GL11.glDrawArrays(drawMode, first, count); + GL20.glDisableVertexAttribArray(Shaders.midTexCoordAttrib); + GL20.glDisableVertexAttribArray(Shaders.tangentAttrib); + GL20.glDisableVertexAttribArray(Shaders.entityAttrib); + } + else + { + GL11.glDrawArrays(drawMode, first, count); + } + } + } +} diff --git a/src/minecraft/shadersmod/client/SVertexFormat.java b/src/minecraft/shadersmod/client/SVertexFormat.java new file mode 100644 index 0000000..0dcf04b --- /dev/null +++ b/src/minecraft/shadersmod/client/SVertexFormat.java @@ -0,0 +1,72 @@ +package shadersmod.client; + +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; + +public class SVertexFormat +{ + public static final int vertexSizeBlock = 14; + public static final int offsetMidTexCoord = 8; + public static final int offsetTangent = 10; + public static final int offsetEntity = 12; + public static final VertexFormat defVertexFormatTextured = makeDefVertexFormatTextured(); + + public static VertexFormat makeDefVertexFormatBlock() + { + VertexFormat vertexformat = new VertexFormat(); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2)); + vertexformat.func_181721_a(new VertexFormatElement(1, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.UV, 2)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.PADDING, 2)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4)); + return vertexformat; + } + + public static VertexFormat makeDefVertexFormatItem() + { + VertexFormat vertexformat = new VertexFormat(); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 2)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.PADDING, 2)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4)); + return vertexformat; + } + + public static VertexFormat makeDefVertexFormatTextured() + { + VertexFormat vertexformat = new VertexFormat(); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.PADDING, 4)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 2)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.PADDING, 2)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4)); + vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4)); + return vertexformat; + } + + public static void setDefBakedFormat(VertexFormat vf) + { + vf.clear(); + vf.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3)); + vf.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4)); + vf.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2)); + vf.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 2)); + vf.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3)); + vf.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1)); + vf.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.PADDING, 2)); + vf.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4)); + vf.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4)); + } +} diff --git a/src/minecraft/shadersmod/client/SVertexFormatElement.java b/src/minecraft/shadersmod/client/SVertexFormatElement.java new file mode 100644 index 0000000..ad1ff27 --- /dev/null +++ b/src/minecraft/shadersmod/client/SVertexFormatElement.java @@ -0,0 +1,14 @@ +package shadersmod.client; + +import net.minecraft.client.renderer.vertex.VertexFormatElement; + +public class SVertexFormatElement extends VertexFormatElement +{ + int sUsage; + + public SVertexFormatElement(int sUsage, VertexFormatElement.EnumType type, int count) + { + super(0, type, VertexFormatElement.EnumUsage.PADDING, count); + this.sUsage = sUsage; + } +} diff --git a/src/minecraft/shadersmod/client/ShaderMacros.java b/src/minecraft/shadersmod/client/ShaderMacros.java new file mode 100644 index 0000000..35f0c9a --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderMacros.java @@ -0,0 +1,102 @@ +package shadersmod.client; + +import net.minecraft.util.Util; +import optifine.Config; + +public class ShaderMacros +{ + private static String PREFIX_MACRO = "MC_"; + public static final String MC_VERSION = "MC_VERSION"; + public static final String MC_GL_VERSION = "MC_GL_VERSION"; + public static final String MC_GLSL_VERSION = "MC_GLSL_VERSION"; + public static final String MC_OS_WINDOWS = "MC_OS_WINDOWS"; + public static final String MC_OS_MAC = "MC_OS_MAC"; + public static final String MC_OS_LINUX = "MC_OS_LINUX"; + public static final String MC_OS_OTHER = "MC_OS_OTHER"; + public static final String MC_GL_VENDOR_ATI = "MC_GL_VENDOR_ATI"; + public static final String MC_GL_VENDOR_INTEL = "MC_GL_VENDOR_INTEL"; + public static final String MC_GL_VENDOR_NVIDIA = "MC_GL_VENDOR_NVIDIA"; + public static final String MC_GL_VENDOR_XORG = "MC_GL_VENDOR_XORG"; + public static final String MC_GL_VENDOR_OTHER = "MC_GL_VENDOR_OTHER"; + public static final String MC_GL_RENDERER_RADEON = "MC_GL_RENDERER_RADEON"; + public static final String MC_GL_RENDERER_GEFORCE = "MC_GL_RENDERER_GEFORCE"; + public static final String MC_GL_RENDERER_QUADRO = "MC_GL_RENDERER_QUADRO"; + public static final String MC_GL_RENDERER_INTEL = "MC_GL_RENDERER_INTEL"; + public static final String MC_GL_RENDERER_GALLIUM = "MC_GL_RENDERER_GALLIUM"; + public static final String MC_GL_RENDERER_MESA = "MC_GL_RENDERER_MESA"; + public static final String MC_GL_RENDERER_OTHER = "MC_GL_RENDERER_OTHER"; + private static String[] extensionMacros; + + public static String getOs() + { + Util.EnumOS util$enumos = Util.getOSType(); + + switch (util$enumos) + { + case WINDOWS: + return "MC_OS_WINDOWS"; + + case OSX: + return "MC_OS_MAC"; + + case LINUX: + return "MC_OS_LINUX"; + + default: + return "MC_OS_OTHER"; + } + } + + public static String getVendor() + { + String s = Config.openGlVendor; + + if (s == null) + { + return "MC_GL_VENDOR_OTHER"; + } + else + { + s = s.toLowerCase(); + return s.startsWith("ati") ? "MC_GL_VENDOR_ATI" : (s.startsWith("intel") ? "MC_GL_VENDOR_INTEL" : (s.startsWith("nvidia") ? "MC_GL_VENDOR_NVIDIA" : (s.startsWith("x.org") ? "MC_GL_VENDOR_XORG" : "MC_GL_VENDOR_OTHER"))); + } + } + + public static String getRenderer() + { + String s = Config.openGlRenderer; + + if (s == null) + { + return "MC_GL_RENDERER_OTHER"; + } + else + { + s = s.toLowerCase(); + return s.startsWith("amd") ? "MC_GL_RENDERER_RADEON" : (s.startsWith("ati") ? "MC_GL_RENDERER_RADEON" : (s.startsWith("radeon") ? "MC_GL_RENDERER_RADEON" : (s.startsWith("gallium") ? "MC_GL_RENDERER_GALLIUM" : (s.startsWith("intel") ? "MC_GL_RENDERER_INTEL" : (s.startsWith("geforce") ? "MC_GL_RENDERER_GEFORCE" : (s.startsWith("nvidia") ? "MC_GL_RENDERER_GEFORCE" : (s.startsWith("quadro") ? "MC_GL_RENDERER_QUADRO" : (s.startsWith("nvs") ? "MC_GL_RENDERER_QUADRO" : (s.startsWith("mesa") ? "MC_GL_RENDERER_MESA" : "MC_GL_RENDERER_OTHER"))))))))); + } + } + + public static String getPrefixMacro() + { + return PREFIX_MACRO; + } + + public static String[] getExtensions() + { + if (extensionMacros == null) + { + String[] astring = Config.getOpenGlExtensions(); + String[] astring1 = new String[astring.length]; + + for (int i = 0; i < astring.length; ++i) + { + astring1[i] = PREFIX_MACRO + astring[i]; + } + + extensionMacros = astring1; + } + + return extensionMacros; + } +} diff --git a/src/minecraft/shadersmod/client/ShaderOption.java b/src/minecraft/shadersmod/client/ShaderOption.java new file mode 100644 index 0000000..0d28880 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderOption.java @@ -0,0 +1,221 @@ +package shadersmod.client; + +import java.util.Arrays; +import java.util.List; + +import optifine.Config; +import optifine.StrUtils; + +public abstract class ShaderOption +{ + private String name = null; + private String description = null; + private String value = null; + private String[] values = null; + private String valueDefault = null; + private String[] paths = null; + private boolean enabled = true; + private boolean visible = true; + public static final String COLOR_GREEN = "\u00a7a"; + public static final String COLOR_RED = "\u00a7c"; + public static final String COLOR_BLUE = "\u00a79"; + + public ShaderOption(String name, String description, String value, String[] values, String valueDefault, String path) + { + this.name = name; + this.description = description; + this.value = value; + this.values = values; + this.valueDefault = valueDefault; + + if (path != null) + { + this.paths = new String[] {path}; + } + } + + public String getName() + { + return this.name; + } + + public String getDescription() + { + return this.description; + } + + public String getDescriptionText() + { + String s = Config.normalize(this.description); + s = StrUtils.removePrefix(s, "//"); + s = Shaders.translate("option." + this.getName() + ".comment", s); + return s; + } + + public void setDescription(String description) + { + this.description = description; + } + + public String getValue() + { + return this.value; + } + + public boolean setValue(String value) + { + int i = getIndex(value, this.values); + + if (i < 0) + { + return false; + } + else + { + this.value = value; + return true; + } + } + + public String getValueDefault() + { + return this.valueDefault; + } + + public void resetValue() + { + this.value = this.valueDefault; + } + + public void nextValue() + { + int i = getIndex(this.value, this.values); + + if (i >= 0) + { + i = (i + 1) % this.values.length; + this.value = this.values[i]; + } + } + + public void prevValue() + { + int i = getIndex(this.value, this.values); + + if (i >= 0) + { + i = (i - 1 + this.values.length) % this.values.length; + this.value = this.values[i]; + } + } + + private static int getIndex(String str, String[] strs) + { + for (int i = 0; i < strs.length; ++i) + { + String s = strs[i]; + + if (s.equals(str)) + { + return i; + } + } + + return -1; + } + + public String[] getPaths() + { + return this.paths; + } + + public void addPaths(String[] newPaths) + { + List list = Arrays.asList(this.paths); + + for (int i = 0; i < newPaths.length; ++i) + { + String s = newPaths[i]; + + if (!list.contains(s)) + { + this.paths = (String[])((String[])Config.addObjectToArray(this.paths, s)); + } + } + } + + public boolean isEnabled() + { + return this.enabled; + } + + public void setEnabled(boolean enabled) + { + this.enabled = enabled; + } + + public boolean isChanged() + { + return !Config.equals(this.value, this.valueDefault); + } + + public boolean isVisible() + { + return this.visible; + } + + public void setVisible(boolean visible) + { + this.visible = visible; + } + + public boolean isValidValue(String val) + { + return getIndex(val, this.values) >= 0; + } + + public String getNameText() + { + return Shaders.translate("option." + this.name, this.name); + } + + public String getValueText(String val) + { + return Shaders.translate("value." + this.name + "." + val, val); + } + + public String getValueColor(String val) + { + return ""; + } + + public boolean matchesLine(String line) + { + return false; + } + + public boolean checkUsed() + { + return false; + } + + public boolean isUsedInLine(String line) + { + return false; + } + + public String getSourceLine() + { + return null; + } + + public String[] getValues() + { + return (String[])this.values.clone(); + } + + public String toString() + { + return "" + this.name + ", value: " + this.value + ", valueDefault: " + this.valueDefault + ", paths: " + Config.arrayToString((Object[])this.paths); + } +} diff --git a/src/minecraft/shadersmod/client/ShaderOptionProfile.java b/src/minecraft/shadersmod/client/ShaderOptionProfile.java new file mode 100644 index 0000000..dab1d51 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderOptionProfile.java @@ -0,0 +1,137 @@ +package shadersmod.client; + +import java.util.ArrayList; +import java.util.List; + +import optifine.Lang; + +public class ShaderOptionProfile extends ShaderOption +{ + private ShaderProfile[] profiles = null; + private ShaderOption[] options = null; + private static final String NAME_PROFILE = ""; + private static final String VALUE_CUSTOM = ""; + + public ShaderOptionProfile(ShaderProfile[] profiles, ShaderOption[] options) + { + super("", "", detectProfileName(profiles, options), getProfileNames(profiles), detectProfileName(profiles, options, true), (String)null); + this.profiles = profiles; + this.options = options; + } + + public void nextValue() + { + super.nextValue(); + + if (this.getValue().equals("")) + { + super.nextValue(); + } + + this.applyProfileOptions(); + } + + public void updateProfile() + { + ShaderProfile shaderprofile = this.getProfile(this.getValue()); + + if (shaderprofile == null || !ShaderUtils.matchProfile(shaderprofile, this.options, false)) + { + String s = detectProfileName(this.profiles, this.options); + this.setValue(s); + } + } + + private void applyProfileOptions() + { + ShaderProfile shaderprofile = this.getProfile(this.getValue()); + + if (shaderprofile != null) + { + String[] astring = shaderprofile.getOptions(); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + ShaderOption shaderoption = this.getOption(s); + + if (shaderoption != null) + { + String s1 = shaderprofile.getValue(s); + shaderoption.setValue(s1); + } + } + } + } + + private ShaderOption getOption(String name) + { + for (int i = 0; i < this.options.length; ++i) + { + ShaderOption shaderoption = this.options[i]; + + if (shaderoption.getName().equals(name)) + { + return shaderoption; + } + } + + return null; + } + + private ShaderProfile getProfile(String name) + { + for (int i = 0; i < this.profiles.length; ++i) + { + ShaderProfile shaderprofile = this.profiles[i]; + + if (shaderprofile.getName().equals(name)) + { + return shaderprofile; + } + } + + return null; + } + + public String getNameText() + { + return Lang.get("of.shaders.profile"); + } + + public String getValueText(String val) + { + return val.equals("") ? Lang.get("of.general.custom", "") : Shaders.translate("profile." + val, val); + } + + public String getValueColor(String val) + { + return val.equals("") ? "\u00a7c" : "\u00a7a"; + } + + private static String detectProfileName(ShaderProfile[] profs, ShaderOption[] opts) + { + return detectProfileName(profs, opts, false); + } + + private static String detectProfileName(ShaderProfile[] profs, ShaderOption[] opts, boolean def) + { + ShaderProfile shaderprofile = ShaderUtils.detectProfile(profs, opts, def); + return shaderprofile == null ? "" : shaderprofile.getName(); + } + + private static String[] getProfileNames(ShaderProfile[] profs) + { + List list = new ArrayList(); + + for (int i = 0; i < profs.length; ++i) + { + ShaderProfile shaderprofile = profs[i]; + list.add(shaderprofile.getName()); + } + + list.add(""); + String[] astring = (String[])((String[])list.toArray(new String[list.size()])); + return astring; + } +} diff --git a/src/minecraft/shadersmod/client/ShaderOptionRest.java b/src/minecraft/shadersmod/client/ShaderOptionRest.java new file mode 100644 index 0000000..b3d4e50 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderOptionRest.java @@ -0,0 +1,9 @@ +package shadersmod.client; + +public class ShaderOptionRest extends ShaderOption +{ + public ShaderOptionRest(String name) + { + super(name, name, (String)null, new String[] {null}, (String)null, (String)null); + } +} diff --git a/src/minecraft/shadersmod/client/ShaderOptionScreen.java b/src/minecraft/shadersmod/client/ShaderOptionScreen.java new file mode 100644 index 0000000..d39c95c --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderOptionScreen.java @@ -0,0 +1,19 @@ +package shadersmod.client; + +public class ShaderOptionScreen extends ShaderOption +{ + public ShaderOptionScreen(String name) + { + super(name, (String)null, (String)null, new String[] {null}, (String)null, (String)null); + } + + public String getNameText() + { + return Shaders.translate("screen." + this.getName(), this.getName()); + } + + public String getDescriptionText() + { + return Shaders.translate("screen." + this.getName() + ".comment", (String)null); + } +} diff --git a/src/minecraft/shadersmod/client/ShaderOptionSwitch.java b/src/minecraft/shadersmod/client/ShaderOptionSwitch.java new file mode 100644 index 0000000..ea4b868 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderOptionSwitch.java @@ -0,0 +1,105 @@ +package shadersmod.client; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import optifine.Config; +import optifine.Lang; +import optifine.StrUtils; + +public class ShaderOptionSwitch extends ShaderOption +{ + private static final Pattern PATTERN_DEFINE = Pattern.compile("^\\s*(//)?\\s*#define\\s+([A-Za-z0-9_]+)\\s*(//.*)?$"); + private static final Pattern PATTERN_IFDEF = Pattern.compile("^\\s*#if(n)?def\\s+([A-Za-z0-9_]+)(\\s*)?$"); + + public ShaderOptionSwitch(String name, String description, String value, String path) + { + super(name, description, value, new String[] {"true", "false"}, value, path); + } + + public String getSourceLine() + { + return isTrue(this.getValue()) ? "#define " + this.getName() + " // Shader option ON" : "//#define " + this.getName() + " // Shader option OFF"; + } + + public String getValueText(String val) + { + return isTrue(val) ? Lang.getOn() : Lang.getOff(); + } + + public String getValueColor(String val) + { + return isTrue(val) ? "\u00a7a" : "\u00a7c"; + } + + public static ShaderOption parseOption(String line, String path) + { + Matcher matcher = PATTERN_DEFINE.matcher(line); + + if (!matcher.matches()) + { + return null; + } + else + { + String s = matcher.group(1); + String s1 = matcher.group(2); + String s2 = matcher.group(3); + + if (s1 != null && s1.length() > 0) + { + boolean flag = Config.equals(s, "//"); + boolean flag1 = !flag; + path = StrUtils.removePrefix(path, "/shaders/"); + ShaderOption shaderoption = new ShaderOptionSwitch(s1, s2, String.valueOf(flag1), path); + return shaderoption; + } + else + { + return null; + } + } + } + + public boolean matchesLine(String line) + { + Matcher matcher = PATTERN_DEFINE.matcher(line); + + if (!matcher.matches()) + { + return false; + } + else + { + String s = matcher.group(2); + return s.matches(this.getName()); + } + } + + public boolean checkUsed() + { + return true; + } + + public boolean isUsedInLine(String line) + { + Matcher matcher = PATTERN_IFDEF.matcher(line); + + if (matcher.matches()) + { + String s = matcher.group(2); + + if (s.equals(this.getName())) + { + return true; + } + } + + return false; + } + + public static boolean isTrue(String val) + { + return Boolean.valueOf(val).booleanValue(); + } +} diff --git a/src/minecraft/shadersmod/client/ShaderOptionSwitchConst.java b/src/minecraft/shadersmod/client/ShaderOptionSwitchConst.java new file mode 100644 index 0000000..00e4a3d --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderOptionSwitchConst.java @@ -0,0 +1,69 @@ +package shadersmod.client; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import optifine.StrUtils; + +public class ShaderOptionSwitchConst extends ShaderOptionSwitch +{ + private static final Pattern PATTERN_CONST = Pattern.compile("^\\s*const\\s*bool\\s*([A-Za-z0-9_]+)\\s*=\\s*(true|false)\\s*;\\s*(//.*)?$"); + + public ShaderOptionSwitchConst(String name, String description, String value, String path) + { + super(name, description, value, path); + } + + public String getSourceLine() + { + return "const bool " + this.getName() + " = " + this.getValue() + "; // Shader option " + this.getValue(); + } + + public static ShaderOption parseOption(String line, String path) + { + Matcher matcher = PATTERN_CONST.matcher(line); + + if (!matcher.matches()) + { + return null; + } + else + { + String s = matcher.group(1); + String s1 = matcher.group(2); + String s2 = matcher.group(3); + + if (s != null && s.length() > 0) + { + path = StrUtils.removePrefix(path, "/shaders/"); + ShaderOption shaderoption = new ShaderOptionSwitchConst(s, s2, s1, path); + shaderoption.setVisible(false); + return shaderoption; + } + else + { + return null; + } + } + } + + public boolean matchesLine(String line) + { + Matcher matcher = PATTERN_CONST.matcher(line); + + if (!matcher.matches()) + { + return false; + } + else + { + String s = matcher.group(1); + return s.matches(this.getName()); + } + } + + public boolean checkUsed() + { + return false; + } +} diff --git a/src/minecraft/shadersmod/client/ShaderOptionVariable.java b/src/minecraft/shadersmod/client/ShaderOptionVariable.java new file mode 100644 index 0000000..52730a9 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderOptionVariable.java @@ -0,0 +1,119 @@ +package shadersmod.client; + +import java.util.Arrays; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import optifine.Config; +import optifine.StrUtils; + +public class ShaderOptionVariable extends ShaderOption +{ + private static final Pattern PATTERN_VARIABLE = Pattern.compile("^\\s*#define\\s+(\\w+)\\s+(-?[0-9\\.Ff]+|\\w+)\\s*(//.*)?$"); + + public ShaderOptionVariable(String name, String description, String value, String[] values, String path) + { + super(name, description, value, values, value, path); + this.setVisible(this.getValues().length > 1); + } + + public String getSourceLine() + { + return "#define " + this.getName() + " " + this.getValue() + " // Shader option " + this.getValue(); + } + + public String getValueColor(String val) + { + return "\u00a7a"; + } + + public boolean matchesLine(String line) + { + Matcher matcher = PATTERN_VARIABLE.matcher(line); + + if (!matcher.matches()) + { + return false; + } + else + { + String s = matcher.group(1); + return s.matches(this.getName()); + } + } + + public static ShaderOption parseOption(String line, String path) + { + Matcher matcher = PATTERN_VARIABLE.matcher(line); + + if (!matcher.matches()) + { + return null; + } + else + { + String s = matcher.group(1); + String s1 = matcher.group(2); + String s2 = matcher.group(3); + String s3 = StrUtils.getSegment(s2, "[", "]"); + + if (s3 != null && s3.length() > 0) + { + s2 = s2.replace(s3, "").trim(); + } + + String[] astring = parseValues(s1, s3); + + if (s != null && s.length() > 0) + { + path = StrUtils.removePrefix(path, "/shaders/"); + ShaderOption shaderoption = new ShaderOptionVariable(s, s2, s1, astring, path); + return shaderoption; + } + else + { + return null; + } + } + } + + public static String[] parseValues(String value, String valuesStr) + { + String[] astring = new String[] {value}; + + if (valuesStr == null) + { + return astring; + } + else + { + valuesStr = valuesStr.trim(); + valuesStr = StrUtils.removePrefix(valuesStr, "["); + valuesStr = StrUtils.removeSuffix(valuesStr, "]"); + valuesStr = valuesStr.trim(); + + if (valuesStr.length() <= 0) + { + return astring; + } + else + { + String[] astring1 = Config.tokenize(valuesStr, " "); + + if (astring1.length <= 0) + { + return astring; + } + else + { + if (!Arrays.asList(astring1).contains(value)) + { + astring1 = (String[])((String[])Config.addObjectToArray(astring1, value, 0)); + } + + return astring1; + } + } + } + } +} diff --git a/src/minecraft/shadersmod/client/ShaderOptionVariableConst.java b/src/minecraft/shadersmod/client/ShaderOptionVariableConst.java new file mode 100644 index 0000000..018ed85 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderOptionVariableConst.java @@ -0,0 +1,74 @@ +package shadersmod.client; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import optifine.StrUtils; + +public class ShaderOptionVariableConst extends ShaderOptionVariable +{ + private String type = null; + private static final Pattern PATTERN_CONST = Pattern.compile("^\\s*const\\s*(float|int)\\s*([A-Za-z0-9_]+)\\s*=\\s*(-?[0-9\\.]+f?F?)\\s*;\\s*(//.*)?$"); + + public ShaderOptionVariableConst(String name, String type, String description, String value, String[] values, String path) + { + super(name, description, value, values, path); + this.type = type; + } + + public String getSourceLine() + { + return "const " + this.type + " " + this.getName() + " = " + this.getValue() + "; // Shader option " + this.getValue(); + } + + public boolean matchesLine(String line) + { + Matcher matcher = PATTERN_CONST.matcher(line); + + if (!matcher.matches()) + { + return false; + } + else + { + String s = matcher.group(2); + return s.matches(this.getName()); + } + } + + public static ShaderOption parseOption(String line, String path) + { + Matcher matcher = PATTERN_CONST.matcher(line); + + if (!matcher.matches()) + { + return null; + } + else + { + String s = matcher.group(1); + String s1 = matcher.group(2); + String s2 = matcher.group(3); + String s3 = matcher.group(4); + String s4 = StrUtils.getSegment(s3, "[", "]"); + + if (s4 != null && s4.length() > 0) + { + s3 = s3.replace(s4, "").trim(); + } + + String[] astring = parseValues(s2, s4); + + if (s1 != null && s1.length() > 0) + { + path = StrUtils.removePrefix(path, "/shaders/"); + ShaderOption shaderoption = new ShaderOptionVariableConst(s1, s, s3, s2, astring, path); + return shaderoption; + } + else + { + return null; + } + } + } +} diff --git a/src/minecraft/shadersmod/client/ShaderPackDefault.java b/src/minecraft/shadersmod/client/ShaderPackDefault.java new file mode 100644 index 0000000..636559d --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderPackDefault.java @@ -0,0 +1,25 @@ +package shadersmod.client; + +import java.io.InputStream; + +public class ShaderPackDefault implements IShaderPack +{ + public void close() + { + } + + public InputStream getResourceAsStream(String resName) + { + return ShaderPackDefault.class.getResourceAsStream(resName); + } + + public String getName() + { + return Shaders.packNameDefault; + } + + public boolean hasDirectory(String name) + { + return false; + } +} diff --git a/src/minecraft/shadersmod/client/ShaderPackFolder.java b/src/minecraft/shadersmod/client/ShaderPackFolder.java new file mode 100644 index 0000000..3c253d4 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderPackFolder.java @@ -0,0 +1,47 @@ +package shadersmod.client; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +import optifine.StrUtils; + +public class ShaderPackFolder implements IShaderPack +{ + protected File packFile; + + public ShaderPackFolder(String name, File file) + { + this.packFile = file; + } + + public void close() + { + } + + public InputStream getResourceAsStream(String resName) + { + try + { + String s = StrUtils.removePrefixSuffix(resName, "/", "/"); + File file1 = new File(this.packFile, s); + return !file1.exists() ? null : new BufferedInputStream(new FileInputStream(file1)); + } + catch (Exception var4) + { + return null; + } + } + + public boolean hasDirectory(String name) + { + File file1 = new File(this.packFile, name.substring(1)); + return !file1.exists() ? false : file1.isDirectory(); + } + + public String getName() + { + return this.packFile.getName(); + } +} diff --git a/src/minecraft/shadersmod/client/ShaderPackNone.java b/src/minecraft/shadersmod/client/ShaderPackNone.java new file mode 100644 index 0000000..efe5613 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderPackNone.java @@ -0,0 +1,25 @@ +package shadersmod.client; + +import java.io.InputStream; + +public class ShaderPackNone implements IShaderPack +{ + public void close() + { + } + + public InputStream getResourceAsStream(String resName) + { + return null; + } + + public boolean hasDirectory(String name) + { + return false; + } + + public String getName() + { + return Shaders.packNameNone; + } +} diff --git a/src/minecraft/shadersmod/client/ShaderPackParser.java b/src/minecraft/shadersmod/client/ShaderPackParser.java new file mode 100644 index 0000000..0a1d236 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderPackParser.java @@ -0,0 +1,633 @@ +package shadersmod.client; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.CharArrayReader; +import java.io.CharArrayWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import optifine.Config; +import optifine.StrUtils; + +public class ShaderPackParser +{ + private static final Pattern PATTERN_VERSION = Pattern.compile("^\\s*#version\\s+.*$"); + private static final Pattern PATTERN_INCLUDE = Pattern.compile("^\\s*#include\\s+\"([A-Za-z0-9_/\\.]+)\".*$"); + private static final Set setConstNames = makeSetConstNames(); + + public static ShaderOption[] parseShaderPackOptions(IShaderPack shaderPack, String[] programNames, List listDimensions) + { + if (shaderPack == null) + { + return new ShaderOption[0]; + } + else + { + Map map = new HashMap(); + collectShaderOptions(shaderPack, "/shaders", programNames, map); + Iterator iterator = listDimensions.iterator(); + + while (iterator.hasNext()) + { + int i = ((Integer)iterator.next()).intValue(); + String s = "/shaders/world" + i; + collectShaderOptions(shaderPack, s, programNames, map); + } + + Collection collection = map.values(); + ShaderOption[] ashaderoption = (ShaderOption[])((ShaderOption[])collection.toArray(new ShaderOption[collection.size()])); + Comparator comparator = new Comparator() + { + public int compare(ShaderOption o1, ShaderOption o2) + { + return o1.getName().compareToIgnoreCase(o2.getName()); + } + }; + Arrays.sort(ashaderoption, comparator); + return ashaderoption; + } + } + + private static void collectShaderOptions(IShaderPack shaderPack, String dir, String[] programNames, Map mapOptions) + { + for (int i = 0; i < programNames.length; ++i) + { + String s = programNames[i]; + + if (!s.equals("")) + { + String s1 = dir + "/" + s + ".vsh"; + String s2 = dir + "/" + s + ".fsh"; + collectShaderOptions(shaderPack, s1, mapOptions); + collectShaderOptions(shaderPack, s2, mapOptions); + } + } + } + + private static void collectShaderOptions(IShaderPack sp, String path, Map mapOptions) + { + String[] astring = getLines(sp, path); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + ShaderOption shaderoption = getShaderOption(s, path); + + if (shaderoption != null && !shaderoption.getName().startsWith(ShaderMacros.getPrefixMacro()) && (!shaderoption.checkUsed() || isOptionUsed(shaderoption, astring))) + { + String s1 = shaderoption.getName(); + ShaderOption shaderoption1 = (ShaderOption)mapOptions.get(s1); + + if (shaderoption1 != null) + { + if (!Config.equals(shaderoption1.getValueDefault(), shaderoption.getValueDefault())) + { + Config.warn("Ambiguous shader option: " + shaderoption.getName()); + Config.warn(" - in " + Config.arrayToString((Object[])shaderoption1.getPaths()) + ": " + shaderoption1.getValueDefault()); + Config.warn(" - in " + Config.arrayToString((Object[])shaderoption.getPaths()) + ": " + shaderoption.getValueDefault()); + shaderoption1.setEnabled(false); + } + + if (shaderoption1.getDescription() == null || shaderoption1.getDescription().length() <= 0) + { + shaderoption1.setDescription(shaderoption.getDescription()); + } + + shaderoption1.addPaths(shaderoption.getPaths()); + } + else + { + mapOptions.put(s1, shaderoption); + } + } + } + } + + private static boolean isOptionUsed(ShaderOption so, String[] lines) + { + for (int i = 0; i < lines.length; ++i) + { + String s = lines[i]; + + if (so.isUsedInLine(s)) + { + return true; + } + } + + return false; + } + + private static String[] getLines(IShaderPack sp, String path) + { + try + { + List list = new ArrayList(); + String s = loadFile(path, sp, 0, list, 0); + + if (s == null) + { + return new String[0]; + } + else + { + ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(s.getBytes()); + String[] astring = Config.readLines((InputStream)bytearrayinputstream); + return astring; + } + } + catch (IOException ioexception) + { + Config.dbg(ioexception.getClass().getName() + ": " + ioexception.getMessage()); + return new String[0]; + } + } + + private static ShaderOption getShaderOption(String line, String path) + { + ShaderOption shaderoption = null; + + if (shaderoption == null) + { + shaderoption = ShaderOptionSwitch.parseOption(line, path); + } + + if (shaderoption == null) + { + shaderoption = ShaderOptionVariable.parseOption(line, path); + } + + if (shaderoption != null) + { + return shaderoption; + } + else + { + if (shaderoption == null) + { + shaderoption = ShaderOptionSwitchConst.parseOption(line, path); + } + + if (shaderoption == null) + { + shaderoption = ShaderOptionVariableConst.parseOption(line, path); + } + + return shaderoption != null && setConstNames.contains(shaderoption.getName()) ? shaderoption : null; + } + } + + private static Set makeSetConstNames() + { + Set set = new HashSet(); + set.add("shadowMapResolution"); + set.add("shadowDistance"); + set.add("shadowIntervalSize"); + set.add("generateShadowMipmap"); + set.add("generateShadowColorMipmap"); + set.add("shadowHardwareFiltering"); + set.add("shadowHardwareFiltering0"); + set.add("shadowHardwareFiltering1"); + set.add("shadowtex0Mipmap"); + set.add("shadowtexMipmap"); + set.add("shadowtex1Mipmap"); + set.add("shadowcolor0Mipmap"); + set.add("shadowColor0Mipmap"); + set.add("shadowcolor1Mipmap"); + set.add("shadowColor1Mipmap"); + set.add("shadowtex0Nearest"); + set.add("shadowtexNearest"); + set.add("shadow0MinMagNearest"); + set.add("shadowtex1Nearest"); + set.add("shadow1MinMagNearest"); + set.add("shadowcolor0Nearest"); + set.add("shadowColor0Nearest"); + set.add("shadowColor0MinMagNearest"); + set.add("shadowcolor1Nearest"); + set.add("shadowColor1Nearest"); + set.add("shadowColor1MinMagNearest"); + set.add("wetnessHalflife"); + set.add("drynessHalflife"); + set.add("eyeBrightnessHalflife"); + set.add("centerDepthHalflife"); + set.add("sunPathRotation"); + set.add("ambientOcclusionLevel"); + set.add("superSamplingLevel"); + set.add("noiseTextureResolution"); + return set; + } + + public static ShaderProfile[] parseProfiles(Properties props, ShaderOption[] shaderOptions) + { + String s = "profile."; + List list = new ArrayList(); + + for (Object s10 : props.keySet()) + { + String s1 =(String) s10; + if (s1.startsWith(s)) + { + String s2 = s1.substring(s.length()); + props.getProperty(s1); + Set set = new HashSet(); + ShaderProfile shaderprofile = parseProfile(s2, props, set, shaderOptions); + + if (shaderprofile != null) + { + list.add(shaderprofile); + } + } + } + + if (list.size() <= 0) + { + return null; + } + else + { + ShaderProfile[] ashaderprofile = (ShaderProfile[])((ShaderProfile[])list.toArray(new ShaderProfile[list.size()])); + return ashaderprofile; + } + } + + private static ShaderProfile parseProfile(String name, Properties props, Set parsedProfiles, ShaderOption[] shaderOptions) + { + String s = "profile."; + String s1 = s + name; + + if (parsedProfiles.contains(s1)) + { + Config.warn("[Shaders] Profile already parsed: " + name); + return null; + } + else + { + parsedProfiles.add(name); + ShaderProfile shaderprofile = new ShaderProfile(name); + String s2 = props.getProperty(s1); + String[] astring = Config.tokenize(s2, " "); + + for (int i = 0; i < astring.length; ++i) + { + String s3 = astring[i]; + + if (s3.startsWith(s)) + { + String s6 = s3.substring(s.length()); + ShaderProfile shaderprofile1 = parseProfile(s6, props, parsedProfiles, shaderOptions); + + if (shaderprofile != null) + { + shaderprofile.addOptionValues(shaderprofile1); + shaderprofile.addDisabledPrograms(shaderprofile1.getDisabledPrograms()); + } + } + else + { + String[] astring1 = Config.tokenize(s3, ":="); + + if (astring1.length == 1) + { + String s7 = astring1[0]; + boolean flag = true; + + if (s7.startsWith("!")) + { + flag = false; + s7 = s7.substring(1); + } + + String s8 = "program."; + + if (!flag && s7.startsWith("program.")) + { + String s9 = s7.substring(s8.length()); + + if (!Shaders.isProgramPath(s9)) + { + Config.warn("Invalid program: " + s9 + " in profile: " + shaderprofile.getName()); + } + else + { + shaderprofile.addDisabledProgram(s9); + } + } + else + { + ShaderOption shaderoption1 = ShaderUtils.getShaderOption(s7, shaderOptions); + + if (!(shaderoption1 instanceof ShaderOptionSwitch)) + { + Config.warn("[Shaders] Invalid option: " + s7); + } + else + { + shaderprofile.addOptionValue(s7, String.valueOf(flag)); + shaderoption1.setVisible(true); + } + } + } + else if (astring1.length != 2) + { + Config.warn("[Shaders] Invalid option value: " + s3); + } + else + { + String s4 = astring1[0]; + String s5 = astring1[1]; + ShaderOption shaderoption = ShaderUtils.getShaderOption(s4, shaderOptions); + + if (shaderoption == null) + { + Config.warn("[Shaders] Invalid option: " + s3); + } + else if (!shaderoption.isValidValue(s5)) + { + Config.warn("[Shaders] Invalid value: " + s3); + } + else + { + shaderoption.setVisible(true); + shaderprofile.addOptionValue(s4, s5); + } + } + } + } + + return shaderprofile; + } + } + + public static Map parseGuiScreens(Properties props, ShaderProfile[] shaderProfiles, ShaderOption[] shaderOptions) + { + Map map = new HashMap(); + parseGuiScreen("screen", props, map, shaderProfiles, shaderOptions); + return map.isEmpty() ? null : map; + } + + private static boolean parseGuiScreen(String key, Properties props, Map map, ShaderProfile[] shaderProfiles, ShaderOption[] shaderOptions) + { + String s = props.getProperty(key); + + if (s == null) + { + return false; + } + else + { + List list = new ArrayList(); + Set set = new HashSet(); + String[] astring = Config.tokenize(s, " "); + + for (int i = 0; i < astring.length; ++i) + { + String s1 = astring[i]; + + if (s1.equals("")) + { + list.add((ShaderOption)null); + } + else if (set.contains(s1)) + { + Config.warn("[Shaders] Duplicate option: " + s1 + ", key: " + key); + } + else + { + set.add(s1); + + if (s1.equals("")) + { + if (shaderProfiles == null) + { + Config.warn("[Shaders] Option profile can not be used, no profiles defined: " + s1 + ", key: " + key); + } + else + { + ShaderOptionProfile shaderoptionprofile = new ShaderOptionProfile(shaderProfiles, shaderOptions); + list.add(shaderoptionprofile); + } + } + else if (s1.equals("*")) + { + ShaderOption shaderoption1 = new ShaderOptionRest(""); + list.add(shaderoption1); + } + else if (s1.startsWith("[") && s1.endsWith("]")) + { + String s2 = StrUtils.removePrefixSuffix(s1, "[", "]"); + + if (!s2.matches("^[a-zA-Z0-9_]+$")) + { + Config.warn("[Shaders] Invalid screen: " + s1 + ", key: " + key); + } + else if (!parseGuiScreen("screen." + s2, props, map, shaderProfiles, shaderOptions)) + { + Config.warn("[Shaders] Invalid screen: " + s1 + ", key: " + key); + } + else + { + ShaderOptionScreen shaderoptionscreen = new ShaderOptionScreen(s2); + list.add(shaderoptionscreen); + } + } + else + { + ShaderOption shaderoption = ShaderUtils.getShaderOption(s1, shaderOptions); + + if (shaderoption == null) + { + Config.warn("[Shaders] Invalid option: " + s1 + ", key: " + key); + list.add((ShaderOption)null); + } + else + { + shaderoption.setVisible(true); + list.add(shaderoption); + } + } + } + } + + ShaderOption[] ashaderoption = (ShaderOption[])((ShaderOption[])list.toArray(new ShaderOption[list.size()])); + map.put(key, ashaderoption); + return true; + } + } + + public static BufferedReader resolveIncludes(BufferedReader reader, String filePath, IShaderPack shaderPack, int fileIndex, List listFiles, int includeLevel) throws IOException + { + String s = "/"; + int i = filePath.lastIndexOf("/"); + + if (i >= 0) + { + s = filePath.substring(0, i); + } + + CharArrayWriter chararraywriter = new CharArrayWriter(); + int j = -1; + Set set = new LinkedHashSet(); + int k = 1; + + while (true) + { + String s1 = reader.readLine(); + + if (s1 == null) + { + char[] achar = chararraywriter.toCharArray(); + + if (j >= 0 && set.size() > 0) + { + StringBuilder stringbuilder = new StringBuilder(); + + for (String s7 : set) + { + stringbuilder.append("#define "); + stringbuilder.append(s7); + stringbuilder.append("\n"); + } + + String s6 = stringbuilder.toString(); + StringBuilder stringbuilder1 = new StringBuilder(new String(achar)); + stringbuilder1.insert(j, s6); + String s10 = stringbuilder1.toString(); + achar = s10.toCharArray(); + } + + CharArrayReader chararrayreader = new CharArrayReader(achar); + return new BufferedReader(chararrayreader); + } + + if (j < 0) + { + Matcher matcher = PATTERN_VERSION.matcher(s1); + + if (matcher.matches()) + { + String s2 = "#define MC_VERSION " + Config.getMinecraftVersionInt() + "\n" + "#define " + "MC_GL_VERSION" + " " + Config.getGlVersion().toInt() + "\n" + "#define " + "MC_GLSL_VERSION" + " " + Config.getGlslVersion().toInt() + "\n" + "#define " + ShaderMacros.getOs() + "\n" + "#define " + ShaderMacros.getVendor() + "\n" + "#define " + ShaderMacros.getRenderer() + "\n"; + String s3 = s1 + "\n" + s2; + String s4 = "#line " + (k + 1) + " " + fileIndex; + s1 = s3 + s4; + j = chararraywriter.size() + s3.length(); + } + } + + Matcher matcher1 = PATTERN_INCLUDE.matcher(s1); + + if (matcher1.matches()) + { + String s5 = matcher1.group(1); + boolean flag = s5.startsWith("/"); + String s8 = flag ? "/shaders" + s5 : s + "/" + s5; + + if (!listFiles.contains(s8)) + { + listFiles.add(s8); + } + + int l = listFiles.indexOf(s8) + 1; + s1 = loadFile(s8, shaderPack, l, listFiles, includeLevel); + + if (s1 == null) + { + throw new IOException("Included file not found: " + filePath); + } + + if (s1.endsWith("\n")) + { + s1 = s1.substring(0, s1.length() - 1); + } + + s1 = "#line 1 " + l + "\n" + s1 + "\n" + "#line " + (k + 1) + " " + fileIndex; + } + + if (j >= 0 && s1.contains(ShaderMacros.getPrefixMacro())) + { + String[] astring = findExtensions(s1, ShaderMacros.getExtensions()); + + for (int i1 = 0; i1 < astring.length; ++i1) + { + String s9 = astring[i1]; + set.add(s9); + } + } + + chararraywriter.write(s1); + chararraywriter.write("\n"); + ++k; + } + } + + private static String[] findExtensions(String line, String[] extensions) + { + List list = new ArrayList(); + + for (int i = 0; i < extensions.length; ++i) + { + String s = extensions[i]; + + if (line.contains(s)) + { + list.add(s); + } + } + + String[] astring = (String[])((String[])list.toArray(new String[list.size()])); + return astring; + } + + private static String loadFile(String filePath, IShaderPack shaderPack, int fileIndex, List listFiles, int includeLevel) throws IOException + { + if (includeLevel >= 10) + { + throw new IOException("#include depth exceeded: " + includeLevel + ", file: " + filePath); + } + else + { + ++includeLevel; + InputStream inputstream = shaderPack.getResourceAsStream(filePath); + + if (inputstream == null) + { + return null; + } + else + { + InputStreamReader inputstreamreader = new InputStreamReader(inputstream, "ASCII"); + BufferedReader bufferedreader = new BufferedReader(inputstreamreader); + bufferedreader = resolveIncludes(bufferedreader, filePath, shaderPack, fileIndex, listFiles, includeLevel); + CharArrayWriter chararraywriter = new CharArrayWriter(); + + while (true) + { + String s = bufferedreader.readLine(); + + if (s == null) + { + return chararraywriter.toString(); + } + + chararraywriter.write(s); + chararraywriter.write("\n"); + } + } + } + } +} diff --git a/src/minecraft/shadersmod/client/ShaderPackZip.java b/src/minecraft/shadersmod/client/ShaderPackZip.java new file mode 100644 index 0000000..be43f4f --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderPackZip.java @@ -0,0 +1,81 @@ +package shadersmod.client; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import optifine.StrUtils; + +public class ShaderPackZip implements IShaderPack +{ + protected File packFile; + protected ZipFile packZipFile; + + public ShaderPackZip(String name, File file) + { + this.packFile = file; + this.packZipFile = null; + } + + public void close() + { + if (this.packZipFile != null) + { + try + { + this.packZipFile.close(); + } + catch (Exception var2) + { + ; + } + + this.packZipFile = null; + } + } + + public InputStream getResourceAsStream(String resName) + { + try + { + if (this.packZipFile == null) + { + this.packZipFile = new ZipFile(this.packFile); + } + + String s = StrUtils.removePrefix(resName, "/"); + ZipEntry zipentry = this.packZipFile.getEntry(s); + return zipentry == null ? null : this.packZipFile.getInputStream(zipentry); + } + catch (Exception var4) + { + return null; + } + } + + public boolean hasDirectory(String resName) + { + try + { + if (this.packZipFile == null) + { + this.packZipFile = new ZipFile(this.packFile); + } + + String s = StrUtils.removePrefix(resName, "/"); + ZipEntry zipentry = this.packZipFile.getEntry(s); + return zipentry != null; + } + catch (IOException var4) + { + return false; + } + } + + public String getName() + { + return this.packFile.getName(); + } +} diff --git a/src/minecraft/shadersmod/client/ShaderProfile.java b/src/minecraft/shadersmod/client/ShaderProfile.java new file mode 100644 index 0000000..5cf40da --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderProfile.java @@ -0,0 +1,84 @@ +package shadersmod.client; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +public class ShaderProfile +{ + private String name = null; + private Map mapOptionValues = new HashMap(); + private Set disabledPrograms = new HashSet(); + + public ShaderProfile(String name) + { + this.name = name; + } + + public String getName() + { + return this.name; + } + + public void addOptionValue(String option, String value) + { + this.mapOptionValues.put(option, value); + } + + public void addOptionValues(ShaderProfile prof) + { + if (prof != null) + { + this.mapOptionValues.putAll(prof.mapOptionValues); + } + } + + public void applyOptionValues(ShaderOption[] options) + { + for (int i = 0; i < options.length; ++i) + { + ShaderOption shaderoption = options[i]; + String s = shaderoption.getName(); + String s1 = (String)this.mapOptionValues.get(s); + + if (s1 != null) + { + shaderoption.setValue(s1); + } + } + } + + public String[] getOptions() + { + Set set = this.mapOptionValues.keySet(); + String[] astring = (String[])((String[])set.toArray(new String[set.size()])); + return astring; + } + + public String getValue(String key) + { + return (String)this.mapOptionValues.get(key); + } + + public void addDisabledProgram(String program) + { + this.disabledPrograms.add(program); + } + + public Collection getDisabledPrograms() + { + return new HashSet(this.disabledPrograms); + } + + public void addDisabledPrograms(Collection programs) + { + this.disabledPrograms.addAll(programs); + } + + public boolean isProgramDisabled(String program) + { + return this.disabledPrograms.contains(program); + } +} diff --git a/src/minecraft/shadersmod/client/ShaderProgramData.java b/src/minecraft/shadersmod/client/ShaderProgramData.java new file mode 100644 index 0000000..196a3c1 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderProgramData.java @@ -0,0 +1,161 @@ +package shadersmod.client; + +import org.lwjgl.opengl.ARBShaderObjects; + +public class ShaderProgramData +{ + public int programIDGL; + public int uniform_texture; + public int uniform_lightmap; + public int uniform_normals; + public int uniform_specular; + public int uniform_shadow; + public int uniform_watershadow; + public int uniform_shadowtex0; + public int uniform_shadowtex1; + public int uniform_depthtex0; + public int uniform_depthtex1; + public int uniform_shadowcolor; + public int uniform_shadowcolor0; + public int uniform_shadowcolor1; + public int uniform_noisetex; + public int uniform_gcolor; + public int uniform_gdepth; + public int uniform_gnormal; + public int uniform_composite; + public int uniform_gaux1; + public int uniform_gaux2; + public int uniform_gaux3; + public int uniform_gaux4; + public int uniform_colortex0; + public int uniform_colortex1; + public int uniform_colortex2; + public int uniform_colortex3; + public int uniform_colortex4; + public int uniform_colortex5; + public int uniform_colortex6; + public int uniform_colortex7; + public int uniform_gdepthtex; + public int uniform_depthtex2; + public int uniform_tex; + public int uniform_heldItemId; + public int uniform_heldBlockLightValue; + public int uniform_fogMode; + public int uniform_fogColor; + public int uniform_skyColor; + public int uniform_worldTime; + public int uniform_moonPhase; + public int uniform_frameTimeCounter; + public int uniform_sunAngle; + public int uniform_shadowAngle; + public int uniform_rainStrength; + public int uniform_aspectRatio; + public int uniform_viewWidth; + public int uniform_viewHeight; + public int uniform_near; + public int uniform_far; + public int uniform_sunPosition; + public int uniform_moonPosition; + public int uniform_upPosition; + public int uniform_previousCameraPosition; + public int uniform_cameraPosition; + public int uniform_gbufferModelView; + public int uniform_gbufferModelViewInverse; + public int uniform_gbufferPreviousProjection; + public int uniform_gbufferProjection; + public int uniform_gbufferProjectionInverse; + public int uniform_gbufferPreviousModelView; + public int uniform_shadowProjection; + public int uniform_shadowProjectionInverse; + public int uniform_shadowModelView; + public int uniform_shadowModelViewInverse; + public int uniform_wetness; + public int uniform_eyeAltitude; + public int uniform_eyeBrightness; + public int uniform_eyeBrightnessSmooth; + public int uniform_terrainTextureSize; + public int uniform_terrainIconSize; + public int uniform_isEyeInWater; + public int uniform_hideGUI; + public int uniform_centerDepthSmooth; + public int uniform_atlasSize; + + public ShaderProgramData(int programID) + { + this.programIDGL = programID; + this.uniform_texture = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"texture"); + this.uniform_lightmap = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"lightmap"); + this.uniform_normals = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"normals"); + this.uniform_specular = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"specular"); + this.uniform_shadow = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"shadow"); + this.uniform_watershadow = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"watershadow"); + this.uniform_shadowtex0 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"shadowtex0"); + this.uniform_shadowtex1 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"shadowtex1"); + this.uniform_depthtex0 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"depthtex0"); + this.uniform_depthtex1 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"depthtex1"); + this.uniform_shadowcolor = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"shadowcolor"); + this.uniform_shadowcolor0 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"shadowcolor0"); + this.uniform_shadowcolor1 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"shadowcolor1"); + this.uniform_noisetex = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"noisetex"); + this.uniform_gcolor = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gcolor"); + this.uniform_gdepth = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gdepth"); + this.uniform_gnormal = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gnormal"); + this.uniform_composite = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"composite"); + this.uniform_gaux1 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gaux1"); + this.uniform_gaux2 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gaux2"); + this.uniform_gaux3 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gaux3"); + this.uniform_gaux4 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gaux4"); + this.uniform_colortex0 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"colortex0"); + this.uniform_colortex1 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"colortex1"); + this.uniform_colortex2 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"colortex2"); + this.uniform_colortex3 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"colortex3"); + this.uniform_colortex4 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"colortex4"); + this.uniform_colortex5 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"colortex5"); + this.uniform_colortex6 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"colortex6"); + this.uniform_colortex7 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"colortex7"); + this.uniform_gdepthtex = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gdepthtex"); + this.uniform_depthtex2 = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"depthtex2"); + this.uniform_tex = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"tex"); + this.uniform_heldItemId = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"heldItemId"); + this.uniform_heldBlockLightValue = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"heldBlockLightValue"); + this.uniform_fogMode = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"fogMode"); + this.uniform_fogColor = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"fogColor"); + this.uniform_skyColor = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"skyColor"); + this.uniform_worldTime = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"worldTime"); + this.uniform_moonPhase = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"moonPhase"); + this.uniform_frameTimeCounter = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"frameTimeCounter"); + this.uniform_sunAngle = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"sunAngle"); + this.uniform_shadowAngle = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"shadowAngle"); + this.uniform_rainStrength = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"rainStrength"); + this.uniform_aspectRatio = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"aspectRatio"); + this.uniform_viewWidth = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"viewWidth"); + this.uniform_viewHeight = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"viewHeight"); + this.uniform_near = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"near"); + this.uniform_far = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"far"); + this.uniform_sunPosition = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"sunPosition"); + this.uniform_moonPosition = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"moonPosition"); + this.uniform_upPosition = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"upPosition"); + this.uniform_previousCameraPosition = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"previousCameraPosition"); + this.uniform_cameraPosition = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"cameraPosition"); + this.uniform_gbufferModelView = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gbufferModelView"); + this.uniform_gbufferModelViewInverse = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gbufferModelViewInverse"); + this.uniform_gbufferPreviousProjection = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gbufferPreviousProjection"); + this.uniform_gbufferProjection = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gbufferProjection"); + this.uniform_gbufferProjectionInverse = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gbufferProjectionInverse"); + this.uniform_gbufferPreviousModelView = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"gbufferPreviousModelView"); + this.uniform_shadowProjection = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"shadowProjection"); + this.uniform_shadowProjectionInverse = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"shadowProjectionInverse"); + this.uniform_shadowModelView = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"shadowModelView"); + this.uniform_shadowModelViewInverse = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"shadowModelViewInverse"); + this.uniform_wetness = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"wetness"); + this.uniform_eyeAltitude = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"eyeAltitude"); + this.uniform_eyeBrightness = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"eyeBrightness"); + this.uniform_eyeBrightnessSmooth = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"eyeBrightnessSmooth"); + this.uniform_terrainTextureSize = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"terrainTextureSize"); + this.uniform_terrainIconSize = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"terrainIconSize"); + this.uniform_isEyeInWater = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"isEyeInWater"); + this.uniform_hideGUI = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"hideGUI"); + this.uniform_centerDepthSmooth = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"centerDepthSmooth"); + this.uniform_atlasSize = ARBShaderObjects.glGetUniformLocationARB(programID, (CharSequence)"atlasSize"); + } +} diff --git a/src/minecraft/shadersmod/client/ShaderUniformBase.java b/src/minecraft/shadersmod/client/ShaderUniformBase.java new file mode 100644 index 0000000..69e7166 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderUniformBase.java @@ -0,0 +1,47 @@ +package shadersmod.client; + +import org.lwjgl.opengl.ARBShaderObjects; + +public abstract class ShaderUniformBase +{ + private String name; + private int program = -1; + private int location = -1; + + public ShaderUniformBase(String name) + { + this.name = name; + } + + public void setProgram(int program) + { + if (this.program != program) + { + this.program = program; + this.location = ARBShaderObjects.glGetUniformLocationARB(program, (CharSequence)this.name); + this.onProgramChanged(); + } + } + + protected abstract void onProgramChanged(); + + public String getName() + { + return this.name; + } + + public int getProgram() + { + return this.program; + } + + public int getLocation() + { + return this.location; + } + + public boolean isDefined() + { + return this.location >= 0; + } +} diff --git a/src/minecraft/shadersmod/client/ShaderUniformFloat4.java b/src/minecraft/shadersmod/client/ShaderUniformFloat4.java new file mode 100644 index 0000000..eac5741 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderUniformFloat4.java @@ -0,0 +1,42 @@ +package shadersmod.client; + +import org.lwjgl.opengl.ARBShaderObjects; + +public class ShaderUniformFloat4 extends ShaderUniformBase +{ + private float[] values = new float[4]; + + public ShaderUniformFloat4(String name) + { + super(name); + } + + protected void onProgramChanged() + { + this.values[0] = 0.0F; + this.values[1] = 0.0F; + this.values[2] = 0.0F; + this.values[3] = 0.0F; + } + + public void setValue(float f0, float f1, float f2, float f3) + { + if (this.getLocation() >= 0) + { + if (this.values[0] != f0 || this.values[1] != f1 || this.values[2] != f2 || this.values[3] != f3) + { + ARBShaderObjects.glUniform4fARB(this.getLocation(), f0, f1, f2, f3); + Shaders.checkGLError(this.getName()); + this.values[0] = f0; + this.values[1] = f1; + this.values[2] = f2; + this.values[3] = f3; + } + } + } + + public float[] getValues() + { + return this.values; + } +} diff --git a/src/minecraft/shadersmod/client/ShaderUniformInt.java b/src/minecraft/shadersmod/client/ShaderUniformInt.java new file mode 100644 index 0000000..cb43239 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderUniformInt.java @@ -0,0 +1,36 @@ +package shadersmod.client; + +import org.lwjgl.opengl.ARBShaderObjects; + +public class ShaderUniformInt extends ShaderUniformBase +{ + private int value = -1; + + public ShaderUniformInt(String name) + { + super(name); + } + + protected void onProgramChanged() + { + this.value = -1; + } + + public void setValue(int value) + { + if (this.getLocation() >= 0) + { + if (this.value != value) + { + ARBShaderObjects.glUniform1iARB(this.getLocation(), value); + Shaders.checkGLError(this.getName()); + this.value = value; + } + } + } + + public int getValue() + { + return this.value; + } +} diff --git a/src/minecraft/shadersmod/client/ShaderUtils.java b/src/minecraft/shadersmod/client/ShaderUtils.java new file mode 100644 index 0000000..9a3168e --- /dev/null +++ b/src/minecraft/shadersmod/client/ShaderUtils.java @@ -0,0 +1,85 @@ +package shadersmod.client; + +import optifine.Config; + +public class ShaderUtils +{ + public static ShaderOption getShaderOption(String name, ShaderOption[] opts) + { + if (opts == null) + { + return null; + } + else + { + for (int i = 0; i < opts.length; ++i) + { + ShaderOption shaderoption = opts[i]; + + if (shaderoption.getName().equals(name)) + { + return shaderoption; + } + } + + return null; + } + } + + public static ShaderProfile detectProfile(ShaderProfile[] profs, ShaderOption[] opts, boolean def) + { + if (profs == null) + { + return null; + } + else + { + for (int i = 0; i < profs.length; ++i) + { + ShaderProfile shaderprofile = profs[i]; + + if (matchProfile(shaderprofile, opts, def)) + { + return shaderprofile; + } + } + + return null; + } + } + + public static boolean matchProfile(ShaderProfile prof, ShaderOption[] opts, boolean def) + { + if (prof == null) + { + return false; + } + else if (opts == null) + { + return false; + } + else + { + String[] astring = prof.getOptions(); + + for (int i = 0; i < astring.length; ++i) + { + String s = astring[i]; + ShaderOption shaderoption = getShaderOption(s, opts); + + if (shaderoption != null) + { + String s1 = def ? shaderoption.getValueDefault() : shaderoption.getValue(); + String s2 = prof.getValue(s); + + if (!Config.equals(s1, s2)) + { + return false; + } + } + } + + return true; + } + } +} diff --git a/src/minecraft/shadersmod/client/Shaders.java b/src/minecraft/shadersmod/client/Shaders.java new file mode 100644 index 0000000..01c1005 --- /dev/null +++ b/src/minecraft/shadersmod/client/Shaders.java @@ -0,0 +1,4922 @@ +package shadersmod.client; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.commons.io.IOUtils; +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.ARBFragmentShader; +import org.lwjgl.opengl.ARBShaderObjects; +import org.lwjgl.opengl.ARBVertexShader; +import org.lwjgl.opengl.ContextCapabilities; +import org.lwjgl.opengl.EXTFramebufferObject; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; +import org.lwjgl.opengl.GL14; +import org.lwjgl.opengl.GL20; +import org.lwjgl.opengl.GL30; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.util.glu.GLU; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import optifine.Config; +import optifine.CustomColors; +import optifine.Lang; +import optifine.PropertiesOrdered; +import optifine.Reflector; +import optifine.StrUtils; +import shadersmod.common.SMCLog; + +public class Shaders +{ + static Minecraft mc; + static EntityRenderer entityRenderer; + public static boolean isInitializedOnce = false; + public static boolean isShaderPackInitialized = false; + public static ContextCapabilities capabilities; + public static String glVersionString; + public static String glVendorString; + public static String glRendererString; + public static boolean hasGlGenMipmap = false; + public static boolean hasForge = false; + public static int numberResetDisplayList = 0; + static boolean needResetModels = false; + private static int renderDisplayWidth = 0; + private static int renderDisplayHeight = 0; + public static int renderWidth = 0; + public static int renderHeight = 0; + public static boolean isRenderingWorld = false; + public static boolean isRenderingSky = false; + public static boolean isCompositeRendered = false; + public static boolean isRenderingDfb = false; + public static boolean isShadowPass = false; + public static boolean isSleeping; + private static boolean isRenderingFirstPersonHand; + + private static boolean isHandRenderedMain; + + private static boolean isHandRenderedOff; + + private static boolean skipRenderHandMain; + + private static boolean skipRenderHandOff; + public static boolean renderItemKeepDepthMask = false; + public static boolean itemToRenderMainTranslucent = false; + static float[] sunPosition = new float[4]; + static float[] moonPosition = new float[4]; + static float[] shadowLightPosition = new float[4]; + static float[] upPosition = new float[4]; + static float[] shadowLightPositionVector = new float[4]; + static float[] upPosModelView = new float[] {0.0F, 100.0F, 0.0F, 0.0F}; + static float[] sunPosModelView = new float[] {0.0F, 100.0F, 0.0F, 0.0F}; + static float[] moonPosModelView = new float[] {0.0F, -100.0F, 0.0F, 0.0F}; + private static float[] tempMat = new float[16]; + static float clearColorR; + static float clearColorG; + static float clearColorB; + static float skyColorR; + static float skyColorG; + static float skyColorB; + static long worldTime = 0L; + static long lastWorldTime = 0L; + static long diffWorldTime = 0L; + static float celestialAngle = 0.0F; + static float sunAngle = 0.0F; + static float shadowAngle = 0.0F; + static int moonPhase = 0; + static long systemTime = 0L; + static long lastSystemTime = 0L; + static long diffSystemTime = 0L; + static int frameCounter = 0; + static float frameTime = 0.0F; + static float frameTimeCounter = 0.0F; + static int systemTimeInt32 = 0; + static float rainStrength = 0.0F; + static float wetness = 0.0F; + public static float wetnessHalfLife = 600.0F; + public static float drynessHalfLife = 200.0F; + public static float eyeBrightnessHalflife = 10.0F; + static boolean usewetness = false; + static int isEyeInWater = 0; + static int eyeBrightness = 0; + static float eyeBrightnessFadeX = 0.0F; + static float eyeBrightnessFadeY = 0.0F; + static float eyePosY = 0.0F; + static float centerDepth = 0.0F; + static float centerDepthSmooth = 0.0F; + static float centerDepthSmoothHalflife = 1.0F; + static boolean centerDepthSmoothEnabled = false; + static int superSamplingLevel = 1; + static float nightVision = 0.0F; + static float blindness = 0.0F; + static boolean updateChunksErrorRecorded = false; + static boolean lightmapEnabled = false; + static boolean fogEnabled = true; + public static int entityAttrib = 10; + public static int midTexCoordAttrib = 11; + public static int tangentAttrib = 12; + public static boolean useEntityAttrib = false; + public static boolean useMidTexCoordAttrib = false; + public static boolean useMultiTexCoord3Attrib = false; + public static boolean useTangentAttrib = false; + public static boolean progUseEntityAttrib = false; + public static boolean progUseMidTexCoordAttrib = false; + public static boolean progUseTangentAttrib = false; + public static int atlasSizeX = 0; + public static int atlasSizeY = 0; + public static ShaderUniformFloat4 uniformEntityColor = new ShaderUniformFloat4("entityColor"); + public static ShaderUniformInt uniformEntityId = new ShaderUniformInt("entityId"); + public static ShaderUniformInt uniformBlockEntityId = new ShaderUniformInt("blockEntityId"); + static double previousCameraPositionX; + static double previousCameraPositionY; + static double previousCameraPositionZ; + static double cameraPositionX; + static double cameraPositionY; + static double cameraPositionZ; + static int shadowPassInterval = 0; + public static boolean needResizeShadow = false; + static int shadowMapWidth = 1024; + static int shadowMapHeight = 1024; + static int spShadowMapWidth = 1024; + static int spShadowMapHeight = 1024; + static float shadowMapFOV = 90.0F; + static float shadowMapHalfPlane = 160.0F; + static boolean shadowMapIsOrtho = true; + static float shadowDistanceRenderMul = -1.0F; + static int shadowPassCounter = 0; + static int preShadowPassThirdPersonView; + public static boolean shouldSkipDefaultShadow = false; + static boolean waterShadowEnabled = false; + static final int MaxDrawBuffers = 8; + static final int MaxColorBuffers = 8; + static final int MaxDepthBuffers = 3; + static final int MaxShadowColorBuffers = 8; + static final int MaxShadowDepthBuffers = 2; + static int usedColorBuffers = 0; + static int usedDepthBuffers = 0; + static int usedShadowColorBuffers = 0; + static int usedShadowDepthBuffers = 0; + static int usedColorAttachs = 0; + static int usedDrawBuffers = 0; + static int dfb = 0; + static int sfb = 0; + private static int[] gbuffersFormat = new int[8]; + private static boolean[] gbuffersClear = new boolean[8]; + public static int activeProgram = 0; + public static final int ProgramNone = 0; + public static final int ProgramBasic = 1; + public static final int ProgramTextured = 2; + public static final int ProgramTexturedLit = 3; + public static final int ProgramSkyBasic = 4; + public static final int ProgramSkyTextured = 5; + public static final int ProgramClouds = 6; + public static final int ProgramTerrain = 7; + public static final int ProgramTerrainSolid = 8; + public static final int ProgramTerrainCutoutMip = 9; + public static final int ProgramTerrainCutout = 10; + public static final int ProgramDamagedBlock = 11; + public static final int ProgramWater = 12; + public static final int ProgramBlock = 13; + public static final int ProgramBeaconBeam = 14; + public static final int ProgramItem = 15; + public static final int ProgramEntities = 16; + public static final int ProgramArmorGlint = 17; + public static final int ProgramSpiderEyes = 18; + public static final int ProgramHand = 19; + public static final int ProgramWeather = 20; + public static final int ProgramComposite = 21; + public static final int ProgramComposite1 = 22; + public static final int ProgramComposite2 = 23; + public static final int ProgramComposite3 = 24; + public static final int ProgramComposite4 = 25; + public static final int ProgramComposite5 = 26; + public static final int ProgramComposite6 = 27; + public static final int ProgramComposite7 = 28; + public static final int ProgramFinal = 29; + public static final int ProgramShadow = 30; + public static final int ProgramShadowSolid = 31; + public static final int ProgramShadowCutout = 32; + public static final int ProgramCount = 33; + public static final int MaxCompositePasses = 8; + private static final String[] programNames = new String[] {"", "gbuffers_basic", "gbuffers_textured", "gbuffers_textured_lit", "gbuffers_skybasic", "gbuffers_skytextured", "gbuffers_clouds", "gbuffers_terrain", "gbuffers_terrain_solid", "gbuffers_terrain_cutout_mip", "gbuffers_terrain_cutout", "gbuffers_damagedblock", "gbuffers_water", "gbuffers_block", "gbuffers_beaconbeam", "gbuffers_item", "gbuffers_entities", "gbuffers_armor_glint", "gbuffers_spidereyes", "gbuffers_hand", "gbuffers_weather", "composite", "composite1", "composite2", "composite3", "composite4", "composite5", "composite6", "composite7", "final", "shadow", "shadow_solid", "shadow_cutout"}; + private static final int[] programBackups = new int[] {0, 0, 1, 2, 1, 2, 2, 3, 7, 7, 7, 7, 7, 7, 2, 3, 3, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30}; + static int[] programsID = new int[33]; + private static int[] programsRef = new int[33]; + private static int programIDCopyDepth = 0; + private static String[] programsDrawBufSettings = new String[33]; + private static String newDrawBufSetting = null; + static IntBuffer[] programsDrawBuffers = new IntBuffer[33]; + static IntBuffer activeDrawBuffers = null; + private static String[] programsColorAtmSettings = new String[33]; + private static String newColorAtmSetting = null; + private static String activeColorAtmSettings = null; + private static int[] programsCompositeMipmapSetting = new int[33]; + private static int newCompositeMipmapSetting = 0; + private static int activeCompositeMipmapSetting = 0; + public static Properties loadedShaders = null; + public static Properties shadersConfig = null; + public static ITextureObject defaultTexture = null; + public static boolean normalMapEnabled = false; + public static boolean[] shadowHardwareFilteringEnabled = new boolean[2]; + public static boolean[] shadowMipmapEnabled = new boolean[2]; + public static boolean[] shadowFilterNearest = new boolean[2]; + public static boolean[] shadowColorMipmapEnabled = new boolean[8]; + public static boolean[] shadowColorFilterNearest = new boolean[8]; + public static boolean configTweakBlockDamage = true; + public static boolean configCloudShadow = true; + public static float configHandDepthMul = 0.125F; + public static float configRenderResMul = 1.0F; + public static float configShadowResMul = 1.0F; + public static int configTexMinFilB = 0; + public static int configTexMinFilN = 0; + public static int configTexMinFilS = 0; + public static int configTexMagFilB = 0; + public static int configTexMagFilN = 0; + public static int configTexMagFilS = 0; + public static boolean configShadowClipFrustrum = true; + public static boolean configNormalMap = true; + public static boolean configSpecularMap = true; + public static PropertyDefaultTrueFalse configOldLighting = new PropertyDefaultTrueFalse("oldLighting", "Classic Lighting", 0); + public static PropertyDefaultTrueFalse configOldHandLight = new PropertyDefaultTrueFalse("oldHandLight", "Old Hand Light", 0); + public static int configAntialiasingLevel = 0; + public static final int texMinFilRange = 3; + public static final int texMagFilRange = 2; + public static final String[] texMinFilDesc = new String[] {"Nearest", "Nearest-Nearest", "Nearest-Linear"}; + public static final String[] texMagFilDesc = new String[] {"Nearest", "Linear"}; + public static final int[] texMinFilValue = new int[] {9728, 9984, 9986}; + public static final int[] texMagFilValue = new int[] {9728, 9729}; + static IShaderPack shaderPack = null; + public static boolean shaderPackLoaded = false; + static File currentshader; + static String currentshadername; + public static String packNameNone = "OFF"; + static String packNameDefault = "(internal)"; + static String shaderpacksdirname = "shaderpacks"; + static String optionsfilename = "optionsshaders.txt"; + static File shadersdir; + static File shaderpacksdir; + static File configFile; + static ShaderOption[] shaderPackOptions = null; + static ShaderProfile[] shaderPackProfiles = null; + static Map shaderPackGuiScreens = null; + public static PropertyDefaultFastFancyOff shaderPackClouds = new PropertyDefaultFastFancyOff("clouds", "Clouds", 0); + public static PropertyDefaultTrueFalse shaderPackOldLighting = new PropertyDefaultTrueFalse("oldLighting", "Classic Lighting", 0); + public static PropertyDefaultTrueFalse shaderPackOldHandLight = new PropertyDefaultTrueFalse("oldHandLight", "Old Hand Light", 0); + public static PropertyDefaultTrueFalse shaderPackDynamicHandLight = new PropertyDefaultTrueFalse("dynamicHandLight", "Dynamic Hand Light", 0); + public static PropertyDefaultTrueFalse shaderPackShadowTranslucent = new PropertyDefaultTrueFalse("shadowTranslucent", "Shadow Translucent", 0); + public static PropertyDefaultTrueFalse shaderPackUnderwaterOverlay = new PropertyDefaultTrueFalse("underwaterOverlay", "Underwater Overlay", 0); + public static PropertyDefaultTrueFalse shaderPackSun = new PropertyDefaultTrueFalse("sun", "Sun", 0); + public static PropertyDefaultTrueFalse shaderPackMoon = new PropertyDefaultTrueFalse("moon", "Moon", 0); + public static PropertyDefaultTrueFalse shaderPackVignette = new PropertyDefaultTrueFalse("vignette", "Vignette", 0); + public static PropertyDefaultTrueFalse shaderPackBackFaceSolid = new PropertyDefaultTrueFalse("backFace.solid", "Back-face Solid", 0); + public static PropertyDefaultTrueFalse shaderPackBackFaceCutout = new PropertyDefaultTrueFalse("backFace.cutout", "Back-face Cutout", 0); + public static PropertyDefaultTrueFalse shaderPackBackFaceCutoutMipped = new PropertyDefaultTrueFalse("backFace.cutoutMipped", "Back-face Cutout Mipped", 0); + public static PropertyDefaultTrueFalse shaderPackBackFaceTranslucent = new PropertyDefaultTrueFalse("backFace.translucent", "Back-face Translucent", 0); + private static Map shaderPackResources = new HashMap(); + private static World currentWorld = null; + private static List shaderPackDimensions = new ArrayList(); + private static CustomTexture[] customTexturesGbuffers = null; + private static CustomTexture[] customTexturesComposite = null; + private static final int STAGE_GBUFFERS = 0; + private static final int STAGE_COMPOSITE = 1; + private static final String[] STAGE_NAMES = new String[] {"gbuffers", "composite"}; + public static final boolean enableShadersOption = true; + private static final boolean enableShadersDebug = true; + private static final boolean saveFinalShaders = System.getProperty("shaders.debug.save", "false").equals("true"); + public static float blockLightLevel05 = 0.5F; + public static float blockLightLevel06 = 0.6F; + public static float blockLightLevel08 = 0.8F; + public static float aoLevel = -1.0F; + public static float sunPathRotation = 0.0F; + public static float shadowAngleInterval = 0.0F; + public static int fogMode = 0; + public static float fogColorR; + public static float fogColorG; + public static float fogColorB; + public static float shadowIntervalSize = 2.0F; + public static int terrainIconSize = 16; + public static int[] terrainTextureSize = new int[2]; + private static HFNoiseTexture noiseTexture; + private static boolean noiseTextureEnabled = false; + private static int noiseTextureResolution = 256; + static final int[] dfbColorTexturesA = new int[16]; + static final int[] colorTexturesToggle = new int[8]; + static final int[] colorTextureTextureImageUnit = new int[] {0, 1, 2, 3, 7, 8, 9, 10}; + static final boolean[][] programsToggleColorTextures = new boolean[33][8]; + private static final int bigBufferSize = 2196; + private static final ByteBuffer bigBuffer = (ByteBuffer)BufferUtils.createByteBuffer(2196).limit(0); + static final float[] faProjection = new float[16]; + static final float[] faProjectionInverse = new float[16]; + static final float[] faModelView = new float[16]; + static final float[] faModelViewInverse = new float[16]; + static final float[] faShadowProjection = new float[16]; + static final float[] faShadowProjectionInverse = new float[16]; + static final float[] faShadowModelView = new float[16]; + static final float[] faShadowModelViewInverse = new float[16]; + static final FloatBuffer projection = nextFloatBuffer(16); + static final FloatBuffer projectionInverse = nextFloatBuffer(16); + static final FloatBuffer modelView = nextFloatBuffer(16); + static final FloatBuffer modelViewInverse = nextFloatBuffer(16); + static final FloatBuffer shadowProjection = nextFloatBuffer(16); + static final FloatBuffer shadowProjectionInverse = nextFloatBuffer(16); + static final FloatBuffer shadowModelView = nextFloatBuffer(16); + static final FloatBuffer shadowModelViewInverse = nextFloatBuffer(16); + static final FloatBuffer previousProjection = nextFloatBuffer(16); + static final FloatBuffer previousModelView = nextFloatBuffer(16); + static final FloatBuffer tempMatrixDirectBuffer = nextFloatBuffer(16); + static final FloatBuffer tempDirectFloatBuffer = nextFloatBuffer(16); + static final IntBuffer dfbColorTextures = nextIntBuffer(16); + static final IntBuffer dfbDepthTextures = nextIntBuffer(3); + static final IntBuffer sfbColorTextures = nextIntBuffer(8); + static final IntBuffer sfbDepthTextures = nextIntBuffer(2); + static final IntBuffer dfbDrawBuffers = nextIntBuffer(8); + static final IntBuffer sfbDrawBuffers = nextIntBuffer(8); + static final IntBuffer drawBuffersNone = nextIntBuffer(8); + static final IntBuffer drawBuffersAll = nextIntBuffer(8); + static final IntBuffer drawBuffersClear0 = nextIntBuffer(8); + static final IntBuffer drawBuffersClear1 = nextIntBuffer(8); + static final IntBuffer drawBuffersClearColor = nextIntBuffer(8); + static final IntBuffer drawBuffersColorAtt0 = nextIntBuffer(8); + static final IntBuffer[] drawBuffersBuffer = nextIntBufferArray(33, 8); + static Map mapBlockToEntityData; + private static final Pattern gbufferFormatPattern = Pattern.compile("[ \t]*const[ \t]*int[ \t]*(\\w+)Format[ \t]*=[ \t]*([RGBA0123456789FUI_SNORM]*)[ \t]*;.*"); + private static final Pattern gbufferClearPattern = Pattern.compile("[ \t]*const[ \t]*bool[ \t]*(\\w+)Clear[ \t]*=[ \t]*false[ \t]*;.*"); + private static final Pattern gbufferMipmapEnabledPattern = Pattern.compile("[ \t]*const[ \t]*bool[ \t]*(\\w+)MipmapEnabled[ \t]*=[ \t]*true[ \t]*;.*"); + private static final String[] formatNames = new String[] {"R8", "RG8", "RGB8", "RGBA8", "R8_SNORM", "RG8_SNORM", "RGB8_SNORM", "RGBA8_SNORM", "R16", "RG16", "RGB16", "RGBA16", "R16_SNORM", "RG16_SNORM", "RGB16_SNORM", "RGBA16_SNORM", "R32F", "RG32F", "RGB32F", "RGBA32F", "R32I", "RG32I", "RGB32I", "RGBA32I", "R32UI", "RG32UI", "RGB32UI", "RGBA32UI", "R3_G3_B2", "RGB5_A1", "RGB10_A2", "R11F_G11F_B10F"}; + private static final int[] formatIds = new int[] {33321, 33323, 32849, 32856, 36756, 36757, 36758, 36759, 33322, 33324, 32852, 32859, 36760, 36761, 36762, 36763, 33326, 33328, 34837, 34836, 33333, 33339, 36227, 36226, 33334, 33340, 36209, 36208, 10768, 32855, 32857, 35898}; + private static final Pattern patternLoadEntityDataMap = Pattern.compile("\\s*([\\w:]+)\\s*=\\s*([-]?\\d+)\\s*"); + public static int[] entityData = new int[32]; + public static int entityDataIndex = 0; + + public static boolean isSkipRenderHand() { + return skipRenderHandMain; + } + + private static ByteBuffer nextByteBuffer(int size) + { + ByteBuffer bytebuffer = bigBuffer; + int i = bytebuffer.limit(); + bytebuffer.position(i).limit(i + size); + return bytebuffer.slice(); + } + + private static IntBuffer nextIntBuffer(int size) + { + ByteBuffer bytebuffer = bigBuffer; + int i = bytebuffer.limit(); + bytebuffer.position(i).limit(i + size * 4); + return bytebuffer.asIntBuffer(); + } + + private static FloatBuffer nextFloatBuffer(int size) + { + ByteBuffer bytebuffer = bigBuffer; + int i = bytebuffer.limit(); + bytebuffer.position(i).limit(i + size * 4); + return bytebuffer.asFloatBuffer(); + } + + private static IntBuffer[] nextIntBufferArray(int count, int size) + { + IntBuffer[] aintbuffer = new IntBuffer[count]; + + for (int i = 0; i < count; ++i) + { + aintbuffer[i] = nextIntBuffer(size); + } + + return aintbuffer; + } + + public static void loadConfig() + { + SMCLog.info("Load ShadersMod configuration."); + + try + { + if (!shaderpacksdir.exists()) + { + shaderpacksdir.mkdir(); + } + } + catch (Exception var8) + { + SMCLog.severe("Failed to open the shaderpacks directory: " + shaderpacksdir); + } + + shadersConfig = new PropertiesOrdered(); + shadersConfig.setProperty(EnumShaderOption.SHADER_PACK.getPropertyKey(), ""); + + if (configFile.exists()) + { + try + { + FileReader filereader = new FileReader(configFile); + shadersConfig.load((Reader)filereader); + filereader.close(); + } + catch (Exception var7) + { + ; + } + } + + if (!configFile.exists()) + { + try + { + storeConfig(); + } + catch (Exception var6) + { + ; + } + } + + EnumShaderOption[] aenumshaderoption = EnumShaderOption.values(); + + for (int i = 0; i < aenumshaderoption.length; ++i) + { + EnumShaderOption enumshaderoption = aenumshaderoption[i]; + String s = enumshaderoption.getPropertyKey(); + String s1 = enumshaderoption.getValueDefault(); + String s2 = shadersConfig.getProperty(s, s1); + setEnumShaderOption(enumshaderoption, s2); + } + + loadShaderPack(); + } + + private static void setEnumShaderOption(EnumShaderOption eso, String str) + { + if (str == null) + { + str = eso.getValueDefault(); + } + + switch (eso) + { + case ANTIALIASING: + configAntialiasingLevel = Config.parseInt(str, 0); + break; + + case NORMAL_MAP: + configNormalMap = Config.parseBoolean(str, true); + break; + + case SPECULAR_MAP: + configSpecularMap = Config.parseBoolean(str, true); + break; + + case RENDER_RES_MUL: + configRenderResMul = Config.parseFloat(str, 1.0F); + break; + + case SHADOW_RES_MUL: + configShadowResMul = Config.parseFloat(str, 1.0F); + break; + + case HAND_DEPTH_MUL: + configHandDepthMul = Config.parseFloat(str, 0.125F); + break; + + case CLOUD_SHADOW: + configCloudShadow = Config.parseBoolean(str, true); + break; + + case OLD_HAND_LIGHT: + configOldHandLight.setPropertyValue(str); + break; + + case OLD_LIGHTING: + configOldLighting.setPropertyValue(str); + break; + + case SHADER_PACK: + currentshadername = str; + break; + + case TWEAK_BLOCK_DAMAGE: + configTweakBlockDamage = Config.parseBoolean(str, true); + break; + + case SHADOW_CLIP_FRUSTRUM: + configShadowClipFrustrum = Config.parseBoolean(str, true); + break; + + case TEX_MIN_FIL_B: + configTexMinFilB = Config.parseInt(str, 0); + break; + + case TEX_MIN_FIL_N: + configTexMinFilN = Config.parseInt(str, 0); + break; + + case TEX_MIN_FIL_S: + configTexMinFilS = Config.parseInt(str, 0); + break; + + case TEX_MAG_FIL_B: + configTexMagFilB = Config.parseInt(str, 0); + break; + + case TEX_MAG_FIL_N: + configTexMagFilB = Config.parseInt(str, 0); + break; + + case TEX_MAG_FIL_S: + configTexMagFilB = Config.parseInt(str, 0); + break; + + default: + throw new IllegalArgumentException("Unknown option: " + eso); + } + } + + public static void storeConfig() + { + SMCLog.info("Save ShadersMod configuration."); + + if (shadersConfig == null) + { + shadersConfig = new PropertiesOrdered(); + } + + EnumShaderOption[] aenumshaderoption = EnumShaderOption.values(); + + for (int i = 0; i < aenumshaderoption.length; ++i) + { + EnumShaderOption enumshaderoption = aenumshaderoption[i]; + String s = enumshaderoption.getPropertyKey(); + String s1 = getEnumShaderOption(enumshaderoption); + shadersConfig.setProperty(s, s1); + } + + try + { + FileWriter filewriter = new FileWriter(configFile); + shadersConfig.store((Writer)filewriter, (String)null); + filewriter.close(); + } + catch (Exception exception) + { + SMCLog.severe("Error saving configuration: " + exception.getClass().getName() + ": " + exception.getMessage()); + } + } + + public static String getEnumShaderOption(EnumShaderOption eso) + { + switch (eso) + { + case ANTIALIASING: + return Integer.toString(configAntialiasingLevel); + + case NORMAL_MAP: + return Boolean.toString(configNormalMap); + + case SPECULAR_MAP: + return Boolean.toString(configSpecularMap); + + case RENDER_RES_MUL: + return Float.toString(configRenderResMul); + + case SHADOW_RES_MUL: + return Float.toString(configShadowResMul); + + case HAND_DEPTH_MUL: + return Float.toString(configHandDepthMul); + + case CLOUD_SHADOW: + return Boolean.toString(configCloudShadow); + + case OLD_HAND_LIGHT: + return configOldHandLight.getPropertyValue(); + + case OLD_LIGHTING: + return configOldLighting.getPropertyValue(); + + case SHADER_PACK: + return currentshadername; + + case TWEAK_BLOCK_DAMAGE: + return Boolean.toString(configTweakBlockDamage); + + case SHADOW_CLIP_FRUSTRUM: + return Boolean.toString(configShadowClipFrustrum); + + case TEX_MIN_FIL_B: + return Integer.toString(configTexMinFilB); + + case TEX_MIN_FIL_N: + return Integer.toString(configTexMinFilN); + + case TEX_MIN_FIL_S: + return Integer.toString(configTexMinFilS); + + case TEX_MAG_FIL_B: + return Integer.toString(configTexMagFilB); + + case TEX_MAG_FIL_N: + return Integer.toString(configTexMagFilB); + + case TEX_MAG_FIL_S: + return Integer.toString(configTexMagFilB); + + default: + throw new IllegalArgumentException("Unknown option: " + eso); + } + } + + public static void setShaderPack(String par1name) + { + currentshadername = par1name; + shadersConfig.setProperty(EnumShaderOption.SHADER_PACK.getPropertyKey(), par1name); + loadShaderPack(); + } + + public static void loadShaderPack() + { + boolean flag = shaderPackLoaded; + boolean flag1 = isOldLighting(); + shaderPackLoaded = false; + + if (shaderPack != null) + { + shaderPack.close(); + shaderPack = null; + shaderPackResources.clear(); + shaderPackDimensions.clear(); + shaderPackOptions = null; + shaderPackProfiles = null; + shaderPackGuiScreens = null; + shaderPackClouds.resetValue(); + shaderPackOldHandLight.resetValue(); + shaderPackDynamicHandLight.resetValue(); + shaderPackOldLighting.resetValue(); + resetCustomTextures(); + } + + boolean flag2 = false; + + if (Config.isAntialiasing()) + { + SMCLog.info("Shaders can not be loaded, Antialiasing is enabled: " + Config.getAntialiasingLevel() + "x"); + flag2 = true; + } + + if (Config.isAnisotropicFiltering()) + { + SMCLog.info("Shaders can not be loaded, Anisotropic Filtering is enabled: " + Config.getAnisotropicFilterLevel() + "x"); + flag2 = true; + } + + if (Config.isFastRender()) + { + SMCLog.info("Shaders can not be loaded, Fast Render is enabled."); + flag2 = true; + } + + String s = shadersConfig.getProperty(EnumShaderOption.SHADER_PACK.getPropertyKey(), packNameDefault); + + if (!s.isEmpty() && !s.equals(packNameNone) && !flag2) + { + if (s.equals(packNameDefault)) + { + shaderPack = new ShaderPackDefault(); + shaderPackLoaded = true; + } + else + { + try + { + File file1 = new File(shaderpacksdir, s); + + if (file1.isDirectory()) + { + shaderPack = new ShaderPackFolder(s, file1); + shaderPackLoaded = true; + } + else if (file1.isFile() && s.toLowerCase().endsWith(".zip")) + { + shaderPack = new ShaderPackZip(s, file1); + shaderPackLoaded = true; + } + } + catch (Exception var6) + { + ; + } + } + } + + if (shaderPack != null) + { + SMCLog.info("Loaded shaderpack: " + getShaderPackName()); + } + else + { + SMCLog.info("No shaderpack loaded."); + shaderPack = new ShaderPackNone(); + } + + loadShaderPackResources(); + loadShaderPackDimensions(); + shaderPackOptions = loadShaderPackOptions(); + loadShaderPackProperties(); + boolean flag4 = shaderPackLoaded != flag; + boolean flag3 = isOldLighting() != flag1; + + if (flag4 || flag3) + { + DefaultVertexFormats.updateVertexFormats(); + + if (Reflector.LightUtil.exists()) + { + Reflector.LightUtil_itemConsumer.setValue((Object)null); + Reflector.LightUtil_tessellator.setValue((Object)null); + } + + updateBlockLightLevel(); + mc.scheduleResourcesRefresh(); + } + } + + private static void loadShaderPackDimensions() + { + shaderPackDimensions.clear(); + + for (int i = -128; i <= 128; ++i) + { + String s = "/shaders/world" + i; + + if (shaderPack.hasDirectory(s)) + { + shaderPackDimensions.add(Integer.valueOf(i)); + } + } + + if (shaderPackDimensions.size() > 0) + { + Integer[] ainteger = (Integer[])((Integer[])shaderPackDimensions.toArray(new Integer[shaderPackDimensions.size()])); + Config.dbg("[Shaders] Worlds: " + Config.arrayToString((Object[])ainteger)); + } + } + + private static void loadShaderPackProperties() + { + shaderPackClouds.resetValue(); + shaderPackOldHandLight.resetValue(); + shaderPackDynamicHandLight.resetValue(); + shaderPackOldLighting.resetValue(); + shaderPackShadowTranslucent.resetValue(); + shaderPackUnderwaterOverlay.resetValue(); + shaderPackSun.resetValue(); + shaderPackMoon.resetValue(); + shaderPackVignette.resetValue(); + shaderPackBackFaceSolid.resetValue(); + shaderPackBackFaceCutout.resetValue(); + shaderPackBackFaceCutoutMipped.resetValue(); + shaderPackBackFaceTranslucent.resetValue(); + BlockAliases.reset(); + + if (shaderPack != null) + { + BlockAliases.update(shaderPack); + String s = "/shaders/shaders.properties"; + + try + { + InputStream inputstream = shaderPack.getResourceAsStream(s); + + if (inputstream == null) + { + return; + } + + Properties properties = new PropertiesOrdered(); + properties.load(inputstream); + inputstream.close(); + shaderPackClouds.loadFrom(properties); + shaderPackOldHandLight.loadFrom(properties); + shaderPackDynamicHandLight.loadFrom(properties); + shaderPackOldLighting.loadFrom(properties); + shaderPackShadowTranslucent.loadFrom(properties); + shaderPackUnderwaterOverlay.loadFrom(properties); + shaderPackSun.loadFrom(properties); + shaderPackVignette.loadFrom(properties); + shaderPackMoon.loadFrom(properties); + shaderPackBackFaceSolid.loadFrom(properties); + shaderPackBackFaceCutout.loadFrom(properties); + shaderPackBackFaceCutoutMipped.loadFrom(properties); + shaderPackBackFaceTranslucent.loadFrom(properties); + shaderPackProfiles = ShaderPackParser.parseProfiles(properties, shaderPackOptions); + shaderPackGuiScreens = ShaderPackParser.parseGuiScreens(properties, shaderPackProfiles, shaderPackOptions); + customTexturesGbuffers = loadCustomTextures(properties, 0); + customTexturesComposite = loadCustomTextures(properties, 1); + } + catch (IOException var3) + { + Config.warn("[Shaders] Error reading: " + s); + } + } + } + + private static CustomTexture[] loadCustomTextures(Properties props, int stage) + { + String s = "texture." + STAGE_NAMES[stage] + "."; + Set set = props.keySet(); + List list = new ArrayList(); + + for (Object s10 : set) + { + String s1 = (String) s10; + if (s1.startsWith(s)) + { + String s2 = s1.substring(s.length()); + String s3 = props.getProperty(s1).trim(); + int i = getTextureIndex(stage, s2); + + if (i < 0) + { + SMCLog.warning("Invalid texture name: " + s1); + } + else + { + try + { + String s4 = "shaders/" + StrUtils.removePrefix(s3, "/"); + InputStream inputstream = shaderPack.getResourceAsStream(s4); + + if (inputstream == null) + { + SMCLog.warning("Texture not found: " + s3); + } + else + { + IOUtils.closeQuietly(inputstream); + SimpleShaderTexture simpleshadertexture = new SimpleShaderTexture(s4); + simpleshadertexture.loadTexture(mc.getResourceManager()); + CustomTexture customtexture = new CustomTexture(i, s4, simpleshadertexture); + list.add(customtexture); + } + } + catch (IOException ioexception) + { + SMCLog.warning("Error loading texture: " + s3); + SMCLog.warning("" + ioexception.getClass().getName() + ": " + ioexception.getMessage()); + } + } + } + } + + if (list.size() <= 0) + { + return null; + } + else + { + CustomTexture[] acustomtexture = (CustomTexture[])((CustomTexture[])list.toArray(new CustomTexture[list.size()])); + return acustomtexture; + } + } + + private static int getTextureIndex(int stage, String name) + { + if (stage == 0) + { + if (name.equals("texture")) + { + return 0; + } + + if (name.equals("lightmap")) + { + return 1; + } + + if (name.equals("normals")) + { + return 2; + } + + if (name.equals("specular")) + { + return 3; + } + + if (name.equals("shadowtex0") || name.equals("watershadow")) + { + return 4; + } + + if (name.equals("shadow")) + { + return waterShadowEnabled ? 5 : 4; + } + + if (name.equals("shadowtex1")) + { + return 5; + } + + if (name.equals("depthtex0")) + { + return 6; + } + + if (name.equals("gaux1")) + { + return 7; + } + + if (name.equals("gaux2")) + { + return 8; + } + + if (name.equals("gaux3")) + { + return 9; + } + + if (name.equals("gaux4")) + { + return 10; + } + + if (name.equals("depthtex1")) + { + return 12; + } + + if (name.equals("shadowcolor0") || name.equals("shadowcolor")) + { + return 13; + } + + if (name.equals("shadowcolor1")) + { + return 14; + } + + if (name.equals("noisetex")) + { + return 15; + } + } + + if (stage == 1) + { + if (name.equals("colortex0") || name.equals("colortex0")) + { + return 0; + } + + if (name.equals("colortex1") || name.equals("gdepth")) + { + return 1; + } + + if (name.equals("colortex2") || name.equals("gnormal")) + { + return 2; + } + + if (name.equals("colortex3") || name.equals("composite")) + { + return 3; + } + + if (name.equals("shadowtex0") || name.equals("watershadow")) + { + return 4; + } + + if (name.equals("shadow")) + { + return waterShadowEnabled ? 5 : 4; + } + + if (name.equals("shadowtex1")) + { + return 5; + } + + if (name.equals("depthtex0") || name.equals("gdepthtex")) + { + return 6; + } + + if (name.equals("colortex4") || name.equals("gaux1")) + { + return 7; + } + + if (name.equals("colortex5") || name.equals("gaux2")) + { + return 8; + } + + if (name.equals("colortex6") || name.equals("gaux3")) + { + return 9; + } + + if (name.equals("colortex7") || name.equals("gaux4")) + { + return 10; + } + + if (name.equals("depthtex1")) + { + return 11; + } + + if (name.equals("depthtex2")) + { + return 12; + } + + if (name.equals("shadowcolor0") || name.equals("shadowcolor")) + { + return 13; + } + + if (name.equals("shadowcolor1")) + { + return 14; + } + + if (name.equals("noisetex")) + { + return 15; + } + } + + return -1; + } + + private static void bindCustomTextures(CustomTexture[] cts) + { + if (cts != null) + { + for (int i = 0; i < cts.length; ++i) + { + CustomTexture customtexture = cts[i]; + GlStateManager.setActiveTexture(33984 + customtexture.getTextureUnit()); + ITextureObject itextureobject = customtexture.getTexture(); + GlStateManager.bindTexture(itextureobject.getGlTextureId()); + } + } + } + + private static void resetCustomTextures() + { + deleteCustomTextures(customTexturesGbuffers); + deleteCustomTextures(customTexturesComposite); + customTexturesGbuffers = null; + customTexturesComposite = null; + } + + private static void deleteCustomTextures(CustomTexture[] cts) + { + if (cts != null) + { + for (int i = 0; i < cts.length; ++i) + { + CustomTexture customtexture = cts[i]; + ITextureObject itextureobject = customtexture.getTexture(); + TextureUtil.deleteTexture(itextureobject.getGlTextureId()); + } + } + } + + public static ShaderOption[] getShaderPackOptions(String screenName) + { + ShaderOption[] ashaderoption = (ShaderOption[])shaderPackOptions.clone(); + + if (shaderPackGuiScreens == null) + { + if (shaderPackProfiles != null) + { + ShaderOptionProfile shaderoptionprofile = new ShaderOptionProfile(shaderPackProfiles, ashaderoption); + ashaderoption = (ShaderOption[])((ShaderOption[])Config.addObjectToArray(ashaderoption, shaderoptionprofile, 0)); + } + + ashaderoption = getVisibleOptions(ashaderoption); + return ashaderoption; + } + else + { + String s = screenName != null ? "screen." + screenName : "screen"; + ShaderOption[] ashaderoption1 = (ShaderOption[])shaderPackGuiScreens.get(s); + + if (ashaderoption1 == null) + { + return new ShaderOption[0]; + } + else + { + List list = new ArrayList(); + + for (int i = 0; i < ashaderoption1.length; ++i) + { + ShaderOption shaderoption = ashaderoption1[i]; + + if (shaderoption == null) + { + list.add((ShaderOption)null); + } + else if (shaderoption instanceof ShaderOptionRest) + { + ShaderOption[] ashaderoption2 = getShaderOptionsRest(shaderPackGuiScreens, ashaderoption); + list.addAll(Arrays.asList(ashaderoption2)); + } + else + { + list.add(shaderoption); + } + } + + ShaderOption[] ashaderoption3 = (ShaderOption[])((ShaderOption[])list.toArray(new ShaderOption[list.size()])); + return ashaderoption3; + } + } + } + + private static ShaderOption[] getShaderOptionsRest(Map mapScreens, ShaderOption[] ops) + { + Set set = new HashSet(); + + for (String s : mapScreens.keySet()) + { + ShaderOption[] ashaderoption = (ShaderOption[])mapScreens.get(s); + + for (int i = 0; i < ashaderoption.length; ++i) + { + ShaderOption shaderoption = ashaderoption[i]; + + if (shaderoption != null) + { + set.add(shaderoption.getName()); + } + } + } + + List list = new ArrayList(); + + for (int j = 0; j < ops.length; ++j) + { + ShaderOption shaderoption1 = ops[j]; + + if (shaderoption1.isVisible()) + { + String s1 = shaderoption1.getName(); + + if (!set.contains(s1)) + { + list.add(shaderoption1); + } + } + } + + ShaderOption[] ashaderoption1 = (ShaderOption[])((ShaderOption[])list.toArray(new ShaderOption[list.size()])); + return ashaderoption1; + } + + public static ShaderOption getShaderOption(String name) + { + return ShaderUtils.getShaderOption(name, shaderPackOptions); + } + + public static ShaderOption[] getShaderPackOptions() + { + return shaderPackOptions; + } + + private static ShaderOption[] getVisibleOptions(ShaderOption[] ops) + { + List list = new ArrayList(); + + for (int i = 0; i < ops.length; ++i) + { + ShaderOption shaderoption = ops[i]; + + if (shaderoption.isVisible()) + { + list.add(shaderoption); + } + } + + ShaderOption[] ashaderoption = (ShaderOption[])((ShaderOption[])list.toArray(new ShaderOption[list.size()])); + return ashaderoption; + } + + public static void saveShaderPackOptions() + { + saveShaderPackOptions(shaderPackOptions, shaderPack); + } + + private static void saveShaderPackOptions(ShaderOption[] sos, IShaderPack sp) + { + Properties properties = new Properties(); + + if (shaderPackOptions != null) + { + for (int i = 0; i < sos.length; ++i) + { + ShaderOption shaderoption = sos[i]; + + if (shaderoption.isChanged() && shaderoption.isEnabled()) + { + properties.setProperty(shaderoption.getName(), shaderoption.getValue()); + } + } + } + + try + { + saveOptionProperties(sp, properties); + } + catch (IOException ioexception) + { + Config.warn("[Shaders] Error saving configuration for " + shaderPack.getName()); + ioexception.printStackTrace(); + } + } + + private static void saveOptionProperties(IShaderPack sp, Properties props) throws IOException + { + String s = shaderpacksdirname + "/" + sp.getName() + ".txt"; + File file1 = new File(Minecraft.getMinecraft().mcDataDir, s); + + if (props.isEmpty()) + { + file1.delete(); + } + else + { + FileOutputStream fileoutputstream = new FileOutputStream(file1); + props.store((OutputStream)fileoutputstream, (String)null); + fileoutputstream.flush(); + fileoutputstream.close(); + } + } + + private static ShaderOption[] loadShaderPackOptions() + { + try + { + ShaderOption[] ashaderoption = ShaderPackParser.parseShaderPackOptions(shaderPack, programNames, shaderPackDimensions); + Properties properties = loadOptionProperties(shaderPack); + + for (int i = 0; i < ashaderoption.length; ++i) + { + ShaderOption shaderoption = ashaderoption[i]; + String s = properties.getProperty(shaderoption.getName()); + + if (s != null) + { + shaderoption.resetValue(); + + if (!shaderoption.setValue(s)) + { + Config.warn("[Shaders] Invalid value, option: " + shaderoption.getName() + ", value: " + s); + } + } + } + + return ashaderoption; + } + catch (IOException ioexception) + { + Config.warn("[Shaders] Error reading configuration for " + shaderPack.getName()); + ioexception.printStackTrace(); + return null; + } + } + + private static Properties loadOptionProperties(IShaderPack sp) throws IOException + { + Properties properties = new Properties(); + String s = shaderpacksdirname + "/" + sp.getName() + ".txt"; + File file1 = new File(Minecraft.getMinecraft().mcDataDir, s); + + if (file1.exists() && file1.isFile() && file1.canRead()) + { + FileInputStream fileinputstream = new FileInputStream(file1); + properties.load((InputStream)fileinputstream); + fileinputstream.close(); + return properties; + } + else + { + return properties; + } + } + + public static ShaderOption[] getChangedOptions(ShaderOption[] ops) + { + List list = new ArrayList(); + + for (int i = 0; i < ops.length; ++i) + { + ShaderOption shaderoption = ops[i]; + + if (shaderoption.isEnabled() && shaderoption.isChanged()) + { + list.add(shaderoption); + } + } + + ShaderOption[] ashaderoption = (ShaderOption[])((ShaderOption[])list.toArray(new ShaderOption[list.size()])); + return ashaderoption; + } + + private static String applyOptions(String line, ShaderOption[] ops) + { + if (ops != null && ops.length > 0) + { + for (int i = 0; i < ops.length; ++i) + { + ShaderOption shaderoption = ops[i]; + String s = shaderoption.getName(); + + if (shaderoption.matchesLine(line)) + { + line = shaderoption.getSourceLine(); + break; + } + } + + return line; + } + else + { + return line; + } + } + + static ArrayList listOfShaders() + { + ArrayList arraylist = new ArrayList(); + arraylist.add(packNameNone); + arraylist.add(packNameDefault); + + try + { + if (!shaderpacksdir.exists()) + { + shaderpacksdir.mkdir(); + } + + File[] afile = shaderpacksdir.listFiles(); + + for (int i = 0; i < afile.length; ++i) + { + File file1 = afile[i]; + String s = file1.getName(); + + if (file1.isDirectory()) + { + File file2 = new File(file1, "shaders"); + + if (file2.exists() && file2.isDirectory()) + { + arraylist.add(s); + } + } + else if (file1.isFile() && s.toLowerCase().endsWith(".zip")) + { + arraylist.add(s); + } + } + } + catch (Exception var6) + { + ; + } + + return arraylist; + } + + static String versiontostring(int vv) + { + String s = Integer.toString(vv); + return Integer.toString(Integer.parseInt(s.substring(1, 3))) + "." + Integer.toString(Integer.parseInt(s.substring(3, 5))) + "." + Integer.toString(Integer.parseInt(s.substring(5))); + } + + static void checkOptifine() + { + } + + public static int checkFramebufferStatus(String location) + { + int i = EXTFramebufferObject.glCheckFramebufferStatusEXT(36160); + + if (i != 36053) + { + System.err.format("FramebufferStatus 0x%04X at %s\n", new Object[] {Integer.valueOf(i), location}); + } + + return i; + } + + public static int checkGLError(String location) + { + int i = GL11.glGetError(); + + if (i != 0) + { + boolean flag = false; + + if (!flag) + { + if (i == 1286) + { + int j = EXTFramebufferObject.glCheckFramebufferStatusEXT(36160); + System.err.format("GL error 0x%04X: %s (Fb status 0x%04X) at %s\n", new Object[] {Integer.valueOf(i), GLU.gluErrorString(i), Integer.valueOf(j), location}); + } + else + { + System.err.format("GL error 0x%04X: %s at %s\n", new Object[] {Integer.valueOf(i), GLU.gluErrorString(i), location}); + } + } + } + + return i; + } + + public static int checkGLError(String location, String info) + { + int i = GL11.glGetError(); + + if (i != 0) + { + System.err.format("GL error 0x%04x: %s at %s %s\n", new Object[] {Integer.valueOf(i), GLU.gluErrorString(i), location, info}); + } + + return i; + } + + public static int checkGLError(String location, String info1, String info2) + { + int i = GL11.glGetError(); + + if (i != 0) + { + System.err.format("GL error 0x%04x: %s at %s %s %s\n", new Object[] {Integer.valueOf(i), GLU.gluErrorString(i), location, info1, info2}); + } + + return i; + } + + private static void printChat(String str) + { + mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(str)); + } + + private static void printChatAndLogError(String str) + { + SMCLog.severe(str); + mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(str)); + } + + public static void printIntBuffer(String title, IntBuffer buf) + { + StringBuilder stringbuilder = new StringBuilder(128); + stringbuilder.append(title).append(" [pos ").append(buf.position()).append(" lim ").append(buf.limit()).append(" cap ").append(buf.capacity()).append(" :"); + int i = buf.limit(); + + for (int j = 0; j < i; ++j) + { + stringbuilder.append(" ").append(buf.get(j)); + } + + stringbuilder.append("]"); + SMCLog.info(stringbuilder.toString()); + } + + public static void startup(Minecraft mc) + { + checkShadersModInstalled(); + Shaders.mc = mc; + mc = Minecraft.getMinecraft(); + capabilities = GLContext.getCapabilities(); + glVersionString = GL11.glGetString(GL11.GL_VERSION); + glVendorString = GL11.glGetString(GL11.GL_VENDOR); + glRendererString = GL11.glGetString(GL11.GL_RENDERER); + SMCLog.info("ShadersMod version: 2.4.12"); + SMCLog.info("OpenGL Version: " + glVersionString); + SMCLog.info("Vendor: " + glVendorString); + SMCLog.info("Renderer: " + glRendererString); + SMCLog.info("Capabilities: " + (capabilities.OpenGL20 ? " 2.0 " : " - ") + (capabilities.OpenGL21 ? " 2.1 " : " - ") + (capabilities.OpenGL30 ? " 3.0 " : " - ") + (capabilities.OpenGL32 ? " 3.2 " : " - ") + (capabilities.OpenGL40 ? " 4.0 " : " - ")); + SMCLog.info("GL_MAX_DRAW_BUFFERS: " + GL11.glGetInteger(GL20.GL_MAX_DRAW_BUFFERS)); + SMCLog.info("GL_MAX_COLOR_ATTACHMENTS_EXT: " + GL11.glGetInteger(36063)); + SMCLog.info("GL_MAX_TEXTURE_IMAGE_UNITS: " + GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS)); + hasGlGenMipmap = capabilities.OpenGL30; + loadConfig(); + } + + private static String toStringYN(boolean b) + { + return b ? "Y" : "N"; + } + + public static void updateBlockLightLevel() + { + if (isOldLighting()) + { + blockLightLevel05 = 0.5F; + blockLightLevel06 = 0.6F; + blockLightLevel08 = 0.8F; + } + else + { + blockLightLevel05 = 1.0F; + blockLightLevel06 = 1.0F; + blockLightLevel08 = 1.0F; + } + } + + public static boolean isOldHandLight() + { + return !configOldHandLight.isDefault() ? configOldHandLight.isTrue() : (!shaderPackOldHandLight.isDefault() ? shaderPackOldHandLight.isTrue() : true); + } + + public static boolean isDynamicHandLight() + { + return !shaderPackDynamicHandLight.isDefault() ? shaderPackDynamicHandLight.isTrue() : true; + } + + public static boolean isOldLighting() + { + return !configOldLighting.isDefault() ? configOldLighting.isTrue() : (!shaderPackOldLighting.isDefault() ? shaderPackOldLighting.isTrue() : true); + } + + public static boolean isRenderShadowTranslucent() + { + return !shaderPackShadowTranslucent.isFalse(); + } + + public static boolean isUnderwaterOverlay() + { + return !shaderPackUnderwaterOverlay.isFalse(); + } + + public static boolean isSun() + { + return !shaderPackSun.isFalse(); + } + + public static boolean isMoon() + { + return !shaderPackMoon.isFalse(); + } + + public static boolean isVignette() + { + return !shaderPackVignette.isFalse(); + } + + public static boolean isRenderBackFace(EnumWorldBlockLayer blockLayerIn) + { + switch (blockLayerIn) + { + case SOLID: + return shaderPackBackFaceSolid.isTrue(); + + case CUTOUT: + return shaderPackBackFaceCutout.isTrue(); + + case CUTOUT_MIPPED: + return shaderPackBackFaceCutoutMipped.isTrue(); + + case TRANSLUCENT: + return shaderPackBackFaceTranslucent.isTrue(); + + default: + return false; + } + } + + public static void init() + { + boolean flag; + + if (!isInitializedOnce) + { + isInitializedOnce = true; + flag = true; + } + else + { + flag = false; + } + + if (!isShaderPackInitialized) + { + checkGLError("Shaders.init pre"); + + if (getShaderPackName() != null) + { + ; + } + + if (!capabilities.OpenGL20) + { + printChatAndLogError("No OpenGL 2.0"); + } + + if (!capabilities.GL_EXT_framebuffer_object) + { + printChatAndLogError("No EXT_framebuffer_object"); + } + + dfbDrawBuffers.position(0).limit(8); + dfbColorTextures.position(0).limit(16); + dfbDepthTextures.position(0).limit(3); + sfbDrawBuffers.position(0).limit(8); + sfbDepthTextures.position(0).limit(2); + sfbColorTextures.position(0).limit(8); + usedColorBuffers = 4; + usedDepthBuffers = 1; + usedShadowColorBuffers = 0; + usedShadowDepthBuffers = 0; + usedColorAttachs = 1; + usedDrawBuffers = 1; + Arrays.fill((int[])gbuffersFormat, (int)6408); + Arrays.fill(gbuffersClear, true); + Arrays.fill(shadowHardwareFilteringEnabled, false); + Arrays.fill(shadowMipmapEnabled, false); + Arrays.fill(shadowFilterNearest, false); + Arrays.fill(shadowColorMipmapEnabled, false); + Arrays.fill(shadowColorFilterNearest, false); + centerDepthSmoothEnabled = false; + noiseTextureEnabled = false; + sunPathRotation = 0.0F; + shadowIntervalSize = 2.0F; + shadowDistanceRenderMul = -1.0F; + aoLevel = -1.0F; + useEntityAttrib = false; + useMidTexCoordAttrib = false; + useMultiTexCoord3Attrib = false; + useTangentAttrib = false; + waterShadowEnabled = false; + updateChunksErrorRecorded = false; + updateBlockLightLevel(); + ShaderProfile shaderprofile = ShaderUtils.detectProfile(shaderPackProfiles, shaderPackOptions, false); + String s = ""; + + if (currentWorld != null) + { + int i = currentWorld.provider.getDimensionId(); + + if (shaderPackDimensions.contains(Integer.valueOf(i))) + { + s = "world" + i + "/"; + } + } + + if (saveFinalShaders) + { + clearDirectory(new File(shaderpacksdir, "debug")); + } + + for (int k1 = 0; k1 < 33; ++k1) + { + String s1 = programNames[k1]; + + if (s1.equals("")) + { + programsID[k1] = programsRef[k1] = 0; + programsDrawBufSettings[k1] = null; + programsColorAtmSettings[k1] = null; + programsCompositeMipmapSetting[k1] = 0; + } + else + { + newDrawBufSetting = null; + newColorAtmSetting = null; + newCompositeMipmapSetting = 0; + String s2 = s + s1; + + if (shaderprofile != null && shaderprofile.isProgramDisabled(s2)) + { + SMCLog.info("Program disabled: " + s2); + s1 = ""; + s2 = s + s1; + } + + String s3 = "/shaders/" + s2; + int j = setupProgram(k1, s3 + ".vsh", s3 + ".fsh"); + + if (j > 0) + { + SMCLog.info("Program loaded: " + s2); + } + + programsID[k1] = programsRef[k1] = j; + programsDrawBufSettings[k1] = j != 0 ? newDrawBufSetting : null; + programsColorAtmSettings[k1] = j != 0 ? newColorAtmSetting : null; + programsCompositeMipmapSetting[k1] = j != 0 ? newCompositeMipmapSetting : 0; + } + } + + int l1 = GL11.glGetInteger(GL20.GL_MAX_DRAW_BUFFERS); + new HashMap(); + + for (int i2 = 0; i2 < 33; ++i2) + { + Arrays.fill(programsToggleColorTextures[i2], false); + + if (i2 == 29) + { + programsDrawBuffers[i2] = null; + } + else if (programsID[i2] == 0) + { + if (i2 == 30) + { + programsDrawBuffers[i2] = drawBuffersNone; + } + else + { + programsDrawBuffers[i2] = drawBuffersColorAtt0; + } + } + else + { + String s4 = programsDrawBufSettings[i2]; + + if (s4 != null) + { + IntBuffer intbuffer = drawBuffersBuffer[i2]; + int k = s4.length(); + + if (k > usedDrawBuffers) + { + usedDrawBuffers = k; + } + + if (k > l1) + { + k = l1; + } + + programsDrawBuffers[i2] = intbuffer; + intbuffer.limit(k); + + for (int l = 0; l < k; ++l) + { + int i1 = 0; + + if (s4.length() > l) + { + int j1 = s4.charAt(l) - 48; + + if (i2 != 30) + { + if (j1 >= 0 && j1 <= 7) + { + programsToggleColorTextures[i2][j1] = true; + i1 = j1 + 36064; + + if (j1 > usedColorAttachs) + { + usedColorAttachs = j1; + } + + if (j1 > usedColorBuffers) + { + usedColorBuffers = j1; + } + } + } + else if (j1 >= 0 && j1 <= 1) + { + i1 = j1 + 36064; + + if (j1 > usedShadowColorBuffers) + { + usedShadowColorBuffers = j1; + } + } + } + + intbuffer.put(l, i1); + } + } + else if (i2 != 30 && i2 != 31 && i2 != 32) + { + programsDrawBuffers[i2] = dfbDrawBuffers; + usedDrawBuffers = usedColorBuffers; + Arrays.fill(programsToggleColorTextures[i2], 0, usedColorBuffers, true); + } + else + { + programsDrawBuffers[i2] = sfbDrawBuffers; + } + } + } + + usedColorAttachs = usedColorBuffers; + shadowPassInterval = usedShadowDepthBuffers > 0 ? 1 : 0; + shouldSkipDefaultShadow = usedShadowDepthBuffers > 0; + SMCLog.info("usedColorBuffers: " + usedColorBuffers); + SMCLog.info("usedDepthBuffers: " + usedDepthBuffers); + SMCLog.info("usedShadowColorBuffers: " + usedShadowColorBuffers); + SMCLog.info("usedShadowDepthBuffers: " + usedShadowDepthBuffers); + SMCLog.info("usedColorAttachs: " + usedColorAttachs); + SMCLog.info("usedDrawBuffers: " + usedDrawBuffers); + dfbDrawBuffers.position(0).limit(usedDrawBuffers); + dfbColorTextures.position(0).limit(usedColorBuffers * 2); + + for (int j2 = 0; j2 < usedDrawBuffers; ++j2) + { + dfbDrawBuffers.put(j2, 36064 + j2); + } + + if (usedDrawBuffers > l1) + { + printChatAndLogError("[Shaders] Error: Not enough draw buffers, needed: " + usedDrawBuffers + ", available: " + l1); + } + + sfbDrawBuffers.position(0).limit(usedShadowColorBuffers); + + for (int k2 = 0; k2 < usedShadowColorBuffers; ++k2) + { + sfbDrawBuffers.put(k2, 36064 + k2); + } + + for (int l2 = 0; l2 < 33; ++l2) + { + int i3; + + for (i3 = l2; programsID[i3] == 0 && programBackups[i3] != i3; i3 = programBackups[i3]) + { + ; + } + + if (i3 != l2 && l2 != 30) + { + programsID[l2] = programsID[i3]; + programsDrawBufSettings[l2] = programsDrawBufSettings[i3]; + programsDrawBuffers[l2] = programsDrawBuffers[i3]; + } + } + + resize(); + resizeShadow(); + + if (noiseTextureEnabled) + { + setupNoiseTexture(); + } + + if (defaultTexture == null) + { + defaultTexture = ShadersTex.createDefaultTexture(); + } + + GlStateManager.pushMatrix(); + GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); + preCelestialRotate(); + postCelestialRotate(); + GlStateManager.popMatrix(); + isShaderPackInitialized = true; + loadEntityDataMap(); + resetDisplayList(); + + if (!flag) + { + ; + } + + checkGLError("Shaders.init"); + } + } + + public static void resetDisplayList() + { + ++numberResetDisplayList; + needResetModels = true; + SMCLog.info("Reset world renderers"); + mc.renderGlobal.loadRenderers(); + } + + public static void resetDisplayListModels() + { + if (needResetModels) + { + needResetModels = false; + SMCLog.info("Reset model renderers"); + + for (Object render : mc.getRenderManager().getEntityRenderMap().values()) + { + if (render instanceof RendererLivingEntity) + { + RendererLivingEntity rendererlivingentity = (RendererLivingEntity)render; + resetDisplayListModel(rendererlivingentity.getMainModel()); + } + } + } + } + + public static void resetDisplayListModel(ModelBase model) + { + if (model != null) + { + for (Object object : model.boxList) + { + if (object instanceof ModelRenderer) + { + resetDisplayListModelRenderer((ModelRenderer)object); + } + } + } + } + + public static void resetDisplayListModelRenderer(ModelRenderer mrr) + { + mrr.resetDisplayList(); + + if (mrr.childModels != null) + { + int i = 0; + + for (int j = mrr.childModels.size(); i < j; ++i) + { + resetDisplayListModelRenderer((ModelRenderer)mrr.childModels.get(i)); + } + } + } + + private static int setupProgram(int program, String vShaderPath, String fShaderPath) + { + checkGLError("pre setupProgram"); + int i = ARBShaderObjects.glCreateProgramObjectARB(); + checkGLError("create"); + + if (i != 0) + { + progUseEntityAttrib = false; + progUseMidTexCoordAttrib = false; + progUseTangentAttrib = false; + int j = createVertShader(vShaderPath); + int k = createFragShader(fShaderPath); + checkGLError("create"); + + if (j == 0 && k == 0) + { + ARBShaderObjects.glDeleteObjectARB(i); + i = 0; + } + else + { + if (j != 0) + { + ARBShaderObjects.glAttachObjectARB(i, j); + checkGLError("attach"); + } + + if (k != 0) + { + ARBShaderObjects.glAttachObjectARB(i, k); + checkGLError("attach"); + } + + if (progUseEntityAttrib) + { + ARBVertexShader.glBindAttribLocationARB(i, entityAttrib, (CharSequence)"mc_Entity"); + checkGLError("mc_Entity"); + } + + if (progUseMidTexCoordAttrib) + { + ARBVertexShader.glBindAttribLocationARB(i, midTexCoordAttrib, (CharSequence)"mc_midTexCoord"); + checkGLError("mc_midTexCoord"); + } + + if (progUseTangentAttrib) + { + ARBVertexShader.glBindAttribLocationARB(i, tangentAttrib, (CharSequence)"at_tangent"); + checkGLError("at_tangent"); + } + + ARBShaderObjects.glLinkProgramARB(i); + + if (GL20.glGetProgrami(i, 35714) != 1) + { + SMCLog.severe("Error linking program: " + i); + } + + printLogInfo(i, vShaderPath + ", " + fShaderPath); + + if (j != 0) + { + ARBShaderObjects.glDetachObjectARB(i, j); + ARBShaderObjects.glDeleteObjectARB(j); + } + + if (k != 0) + { + ARBShaderObjects.glDetachObjectARB(i, k); + ARBShaderObjects.glDeleteObjectARB(k); + } + + programsID[program] = i; + useProgram(program); + ARBShaderObjects.glValidateProgramARB(i); + useProgram(0); + printLogInfo(i, vShaderPath + ", " + fShaderPath); + int l = GL20.glGetProgrami(i, 35715); + + if (l != 1) + { + String s = "\""; + printChatAndLogError("[Shaders] Error: Invalid program " + s + programNames[program] + s); + ARBShaderObjects.glDeleteObjectARB(i); + i = 0; + } + } + } + + return i; + } + + private static int createVertShader(String filename) + { + int i = ARBShaderObjects.glCreateShaderObjectARB(ARBVertexShader.GL_VERTEX_SHADER_ARB); + + if (i == 0) + { + return 0; + } + else + { + StringBuilder stringbuilder = new StringBuilder(131072); + BufferedReader bufferedreader = null; + + try + { + bufferedreader = new BufferedReader(new InputStreamReader(shaderPack.getResourceAsStream(filename))); + } + catch (Exception var8) + { + try + { + bufferedreader = new BufferedReader(new FileReader(new File(filename))); + } + catch (Exception var7) + { + ARBShaderObjects.glDeleteObjectARB(i); + return 0; + } + } + + ShaderOption[] ashaderoption = getChangedOptions(shaderPackOptions); + List list = new ArrayList(); + + if (bufferedreader != null) + { + try + { + bufferedreader = ShaderPackParser.resolveIncludes(bufferedreader, filename, shaderPack, 0, list, 0); + + while (true) + { + String s = bufferedreader.readLine(); + + if (s == null) + { + bufferedreader.close(); + break; + } + + s = applyOptions(s, ashaderoption); + stringbuilder.append(s).append('\n'); + + if (s.matches("attribute [_a-zA-Z0-9]+ mc_Entity.*")) + { + useEntityAttrib = true; + progUseEntityAttrib = true; + } + else if (s.matches("attribute [_a-zA-Z0-9]+ mc_midTexCoord.*")) + { + useMidTexCoordAttrib = true; + progUseMidTexCoordAttrib = true; + } + else if (s.matches(".*gl_MultiTexCoord3.*")) + { + useMultiTexCoord3Attrib = true; + } + else if (s.matches("attribute [_a-zA-Z0-9]+ at_tangent.*")) + { + useTangentAttrib = true; + progUseTangentAttrib = true; + } + } + } + catch (Exception exception) + { + SMCLog.severe("Couldn\'t read " + filename + "!"); + exception.printStackTrace(); + ARBShaderObjects.glDeleteObjectARB(i); + return 0; + } + } + + if (saveFinalShaders) + { + saveShader(filename, stringbuilder.toString()); + } + + ARBShaderObjects.glShaderSourceARB(i, (CharSequence)stringbuilder); + ARBShaderObjects.glCompileShaderARB(i); + + if (GL20.glGetShaderi(i, 35713) != 1) + { + SMCLog.severe("Error compiling vertex shader: " + filename); + } + + printShaderLogInfo(i, filename, list); + return i; + } + } + + private static int createFragShader(String filename) + { + int i = ARBShaderObjects.glCreateShaderObjectARB(ARBFragmentShader.GL_FRAGMENT_SHADER_ARB); + + if (i == 0) + { + return 0; + } + else + { + StringBuilder stringbuilder = new StringBuilder(131072); + BufferedReader bufferedreader = null; + + try + { + bufferedreader = new BufferedReader(new InputStreamReader(shaderPack.getResourceAsStream(filename))); + } + catch (Exception var13) + { + try + { + bufferedreader = new BufferedReader(new FileReader(new File(filename))); + } + catch (Exception var12) + { + ARBShaderObjects.glDeleteObjectARB(i); + return 0; + } + } + + ShaderOption[] ashaderoption = getChangedOptions(shaderPackOptions); + List list = new ArrayList(); + + if (bufferedreader != null) + { + try + { + bufferedreader = ShaderPackParser.resolveIncludes(bufferedreader, filename, shaderPack, 0, list, 0); + + while (true) + { + String s = bufferedreader.readLine(); + + if (s == null) + { + bufferedreader.close(); + break; + } + + s = applyOptions(s, ashaderoption); + stringbuilder.append(s).append('\n'); + + if (!s.matches("#version .*")) + { + if (s.matches("uniform [ _a-zA-Z0-9]+ shadow;.*")) + { + if (usedShadowDepthBuffers < 1) + { + usedShadowDepthBuffers = 1; + } + } + else if (s.matches("uniform [ _a-zA-Z0-9]+ watershadow;.*")) + { + waterShadowEnabled = true; + + if (usedShadowDepthBuffers < 2) + { + usedShadowDepthBuffers = 2; + } + } + else if (s.matches("uniform [ _a-zA-Z0-9]+ shadowtex0;.*")) + { + if (usedShadowDepthBuffers < 1) + { + usedShadowDepthBuffers = 1; + } + } + else if (s.matches("uniform [ _a-zA-Z0-9]+ shadowtex1;.*")) + { + if (usedShadowDepthBuffers < 2) + { + usedShadowDepthBuffers = 2; + } + } + else if (s.matches("uniform [ _a-zA-Z0-9]+ shadowcolor;.*")) + { + if (usedShadowColorBuffers < 1) + { + usedShadowColorBuffers = 1; + } + } + else if (s.matches("uniform [ _a-zA-Z0-9]+ shadowcolor0;.*")) + { + if (usedShadowColorBuffers < 1) + { + usedShadowColorBuffers = 1; + } + } + else if (s.matches("uniform [ _a-zA-Z0-9]+ shadowcolor1;.*")) + { + if (usedShadowColorBuffers < 2) + { + usedShadowColorBuffers = 2; + } + } + else if (s.matches("uniform [ _a-zA-Z0-9]+ depthtex0;.*")) + { + if (usedDepthBuffers < 1) + { + usedDepthBuffers = 1; + } + } + else if (s.matches("uniform [ _a-zA-Z0-9]+ depthtex1;.*")) + { + if (usedDepthBuffers < 2) + { + usedDepthBuffers = 2; + } + } + else if (s.matches("uniform [ _a-zA-Z0-9]+ depthtex2;.*")) + { + if (usedDepthBuffers < 3) + { + usedDepthBuffers = 3; + } + } + else if (s.matches("uniform [ _a-zA-Z0-9]+ gdepth;.*")) + { + if (gbuffersFormat[1] == 6408) + { + gbuffersFormat[1] = 34836; + } + } + else if (usedColorBuffers < 5 && s.matches("uniform [ _a-zA-Z0-9]+ gaux1;.*")) + { + usedColorBuffers = 5; + } + else if (usedColorBuffers < 6 && s.matches("uniform [ _a-zA-Z0-9]+ gaux2;.*")) + { + usedColorBuffers = 6; + } + else if (usedColorBuffers < 7 && s.matches("uniform [ _a-zA-Z0-9]+ gaux3;.*")) + { + usedColorBuffers = 7; + } + else if (usedColorBuffers < 8 && s.matches("uniform [ _a-zA-Z0-9]+ gaux4;.*")) + { + usedColorBuffers = 8; + } + else if (usedColorBuffers < 5 && s.matches("uniform [ _a-zA-Z0-9]+ colortex4;.*")) + { + usedColorBuffers = 5; + } + else if (usedColorBuffers < 6 && s.matches("uniform [ _a-zA-Z0-9]+ colortex5;.*")) + { + usedColorBuffers = 6; + } + else if (usedColorBuffers < 7 && s.matches("uniform [ _a-zA-Z0-9]+ colortex6;.*")) + { + usedColorBuffers = 7; + } + else if (usedColorBuffers < 8 && s.matches("uniform [ _a-zA-Z0-9]+ colortex7;.*")) + { + usedColorBuffers = 8; + } + else if (s.matches("uniform [ _a-zA-Z0-9]+ centerDepthSmooth;.*")) + { + centerDepthSmoothEnabled = true; + } + else if (s.matches("/\\* SHADOWRES:[0-9]+ \\*/.*")) + { + String[] astring17 = s.split("(:| )", 4); + SMCLog.info("Shadow map resolution: " + astring17[2]); + spShadowMapWidth = spShadowMapHeight = Integer.parseInt(astring17[2]); + shadowMapWidth = shadowMapHeight = Math.round((float)spShadowMapWidth * configShadowResMul); + } + else if (s.matches("[ \t]*const[ \t]*int[ \t]*shadowMapResolution[ \t]*=[ \t]*-?[0-9.]+f?;.*")) + { + String[] astring16 = s.split("(=[ \t]*|;)"); + SMCLog.info("Shadow map resolution: " + astring16[1]); + spShadowMapWidth = spShadowMapHeight = Integer.parseInt(astring16[1]); + shadowMapWidth = shadowMapHeight = Math.round((float)spShadowMapWidth * configShadowResMul); + } + else if (s.matches("/\\* SHADOWFOV:[0-9\\.]+ \\*/.*")) + { + String[] astring15 = s.split("(:| )", 4); + SMCLog.info("Shadow map field of view: " + astring15[2]); + shadowMapFOV = Float.parseFloat(astring15[2]); + shadowMapIsOrtho = false; + } + else if (s.matches("/\\* SHADOWHPL:[0-9\\.]+ \\*/.*")) + { + String[] astring14 = s.split("(:| )", 4); + SMCLog.info("Shadow map half-plane: " + astring14[2]); + shadowMapHalfPlane = Float.parseFloat(astring14[2]); + shadowMapIsOrtho = true; + } + else if (s.matches("[ \t]*const[ \t]*float[ \t]*shadowDistance[ \t]*=[ \t]*-?[0-9.]+f?;.*")) + { + String[] astring13 = s.split("(=[ \t]*|;)"); + SMCLog.info("Shadow map distance: " + astring13[1]); + shadowMapHalfPlane = Float.parseFloat(astring13[1]); + shadowMapIsOrtho = true; + } + else if (s.matches("[ \t]*const[ \t]*float[ \t]*shadowDistanceRenderMul[ \t]*=[ \t]*-?[0-9.]+f?;.*")) + { + String[] astring12 = s.split("(=[ \t]*|;)"); + SMCLog.info("Shadow distance render mul: " + astring12[1]); + shadowDistanceRenderMul = Float.parseFloat(astring12[1]); + } + else if (s.matches("[ \t]*const[ \t]*float[ \t]*shadowIntervalSize[ \t]*=[ \t]*-?[0-9.]+f?;.*")) + { + String[] astring11 = s.split("(=[ \t]*|;)"); + SMCLog.info("Shadow map interval size: " + astring11[1]); + shadowIntervalSize = Float.parseFloat(astring11[1]); + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*generateShadowMipmap[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("Generate shadow mipmap"); + Arrays.fill(shadowMipmapEnabled, true); + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*generateShadowColorMipmap[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("Generate shadow color mipmap"); + Arrays.fill(shadowColorMipmapEnabled, true); + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*shadowHardwareFiltering[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("Hardware shadow filtering enabled."); + Arrays.fill(shadowHardwareFilteringEnabled, true); + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*shadowHardwareFiltering0[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("shadowHardwareFiltering0"); + shadowHardwareFilteringEnabled[0] = true; + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*shadowHardwareFiltering1[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("shadowHardwareFiltering1"); + shadowHardwareFilteringEnabled[1] = true; + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*(shadowtex0Mipmap|shadowtexMipmap)[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("shadowtex0Mipmap"); + shadowMipmapEnabled[0] = true; + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*(shadowtex1Mipmap)[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("shadowtex1Mipmap"); + shadowMipmapEnabled[1] = true; + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*(shadowcolor0Mipmap|shadowColor0Mipmap)[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("shadowcolor0Mipmap"); + shadowColorMipmapEnabled[0] = true; + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*(shadowcolor1Mipmap|shadowColor1Mipmap)[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("shadowcolor1Mipmap"); + shadowColorMipmapEnabled[1] = true; + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*(shadowtex0Nearest|shadowtexNearest|shadow0MinMagNearest)[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("shadowtex0Nearest"); + shadowFilterNearest[0] = true; + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*(shadowtex1Nearest|shadow1MinMagNearest)[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("shadowtex1Nearest"); + shadowFilterNearest[1] = true; + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*(shadowcolor0Nearest|shadowColor0Nearest|shadowColor0MinMagNearest)[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("shadowcolor0Nearest"); + shadowColorFilterNearest[0] = true; + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*(shadowcolor1Nearest|shadowColor1Nearest|shadowColor1MinMagNearest)[ \t]*=[ \t]*true[ \t]*;.*")) + { + SMCLog.info("shadowcolor1Nearest"); + shadowColorFilterNearest[1] = true; + } + else if (s.matches("/\\* WETNESSHL:[0-9\\.]+ \\*/.*")) + { + String[] astring10 = s.split("(:| )", 4); + SMCLog.info("Wetness halflife: " + astring10[2]); + wetnessHalfLife = Float.parseFloat(astring10[2]); + } + else if (s.matches("[ \t]*const[ \t]*float[ \t]*wetnessHalflife[ \t]*=[ \t]*-?[0-9.]+f?;.*")) + { + String[] astring9 = s.split("(=[ \t]*|;)"); + SMCLog.info("Wetness halflife: " + astring9[1]); + wetnessHalfLife = Float.parseFloat(astring9[1]); + } + else if (s.matches("/\\* DRYNESSHL:[0-9\\.]+ \\*/.*")) + { + String[] astring8 = s.split("(:| )", 4); + SMCLog.info("Dryness halflife: " + astring8[2]); + drynessHalfLife = Float.parseFloat(astring8[2]); + } + else if (s.matches("[ \t]*const[ \t]*float[ \t]*drynessHalflife[ \t]*=[ \t]*-?[0-9.]+f?;.*")) + { + String[] astring7 = s.split("(=[ \t]*|;)"); + SMCLog.info("Dryness halflife: " + astring7[1]); + drynessHalfLife = Float.parseFloat(astring7[1]); + } + else if (s.matches("[ \t]*const[ \t]*float[ \t]*eyeBrightnessHalflife[ \t]*=[ \t]*-?[0-9.]+f?;.*")) + { + String[] astring6 = s.split("(=[ \t]*|;)"); + SMCLog.info("Eye brightness halflife: " + astring6[1]); + eyeBrightnessHalflife = Float.parseFloat(astring6[1]); + } + else if (s.matches("[ \t]*const[ \t]*float[ \t]*centerDepthHalflife[ \t]*=[ \t]*-?[0-9.]+f?;.*")) + { + String[] astring5 = s.split("(=[ \t]*|;)"); + SMCLog.info("Center depth halflife: " + astring5[1]); + centerDepthSmoothHalflife = Float.parseFloat(astring5[1]); + } + else if (s.matches("[ \t]*const[ \t]*float[ \t]*sunPathRotation[ \t]*=[ \t]*-?[0-9.]+f?;.*")) + { + String[] astring4 = s.split("(=[ \t]*|;)"); + SMCLog.info("Sun path rotation: " + astring4[1]); + sunPathRotation = Float.parseFloat(astring4[1]); + } + else if (s.matches("[ \t]*const[ \t]*float[ \t]*ambientOcclusionLevel[ \t]*=[ \t]*-?[0-9.]+f?;.*")) + { + String[] astring3 = s.split("(=[ \t]*|;)"); + SMCLog.info("AO Level: " + astring3[1]); + aoLevel = Config.limit(Float.parseFloat(astring3[1]), 0.0F, 1.0F); + } + else if (s.matches("[ \t]*const[ \t]*int[ \t]*superSamplingLevel[ \t]*=[ \t]*-?[0-9.]+f?;.*")) + { + String[] astring2 = s.split("(=[ \t]*|;)"); + int i1 = Integer.parseInt(astring2[1]); + + if (i1 > 1) + { + SMCLog.info("Super sampling level: " + i1 + "x"); + superSamplingLevel = i1; + } + else + { + superSamplingLevel = 1; + } + } + else if (s.matches("[ \t]*const[ \t]*int[ \t]*noiseTextureResolution[ \t]*=[ \t]*-?[0-9.]+f?;.*")) + { + String[] astring1 = s.split("(=[ \t]*|;)"); + SMCLog.info("Noise texture enabled"); + SMCLog.info("Noise texture resolution: " + astring1[1]); + noiseTextureResolution = Integer.parseInt(astring1[1]); + noiseTextureEnabled = true; + } + else if (s.matches("[ \t]*const[ \t]*int[ \t]*\\w+Format[ \t]*=[ \t]*[RGBA0123456789FUI_SNORM]*[ \t]*;.*")) + { + Matcher matcher2 = gbufferFormatPattern.matcher(s); + matcher2.matches(); + String s3 = matcher2.group(1); + String s4 = matcher2.group(2); + int k = getBufferIndexFromString(s3); + int l = getTextureFormatFromString(s4); + + if (k >= 0 && l != 0) + { + gbuffersFormat[k] = l; + SMCLog.info("%s format: %s", new Object[] {s3, s4}); + } + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*\\w+Clear[ \t]*=[ \t]*false[ \t]*;.*")) + { + if (filename.matches(".*composite[0-9]?.fsh")) + { + Matcher matcher1 = gbufferClearPattern.matcher(s); + matcher1.matches(); + String s2 = matcher1.group(1); + int j1 = getBufferIndexFromString(s2); + + if (j1 >= 0) + { + gbuffersClear[j1] = false; + SMCLog.info("%s clear disabled", new Object[] {s2}); + } + } + } + else if (s.matches("/\\* GAUX4FORMAT:RGBA32F \\*/.*")) + { + SMCLog.info("gaux4 format : RGB32AF"); + gbuffersFormat[7] = 34836; + } + else if (s.matches("/\\* GAUX4FORMAT:RGB32F \\*/.*")) + { + SMCLog.info("gaux4 format : RGB32F"); + gbuffersFormat[7] = 34837; + } + else if (s.matches("/\\* GAUX4FORMAT:RGB16 \\*/.*")) + { + SMCLog.info("gaux4 format : RGB16"); + gbuffersFormat[7] = 32852; + } + else if (s.matches("[ \t]*const[ \t]*bool[ \t]*\\w+MipmapEnabled[ \t]*=[ \t]*true[ \t]*;.*")) + { + if (filename.matches(".*composite[0-9]?.fsh") || filename.matches(".*final.fsh")) + { + Matcher matcher = gbufferMipmapEnabledPattern.matcher(s); + matcher.matches(); + String s1 = matcher.group(1); + int j = getBufferIndexFromString(s1); + + if (j >= 0) + { + newCompositeMipmapSetting |= 1 << j; + SMCLog.info("%s mipmap enabled", new Object[] {s1}); + } + } + } + else if (s.matches("/\\* DRAWBUFFERS:[0-7N]* \\*/.*")) + { + String[] astring = s.split("(:| )", 4); + newDrawBufSetting = astring[2]; + } + } + } + } + catch (Exception exception) + { + SMCLog.severe("Couldn\'t read " + filename + "!"); + exception.printStackTrace(); + ARBShaderObjects.glDeleteObjectARB(i); + return 0; + } + } + + if (saveFinalShaders) + { + saveShader(filename, stringbuilder.toString()); + } + + ARBShaderObjects.glShaderSourceARB(i, (CharSequence)stringbuilder); + ARBShaderObjects.glCompileShaderARB(i); + + if (GL20.glGetShaderi(i, 35713) != 1) + { + SMCLog.severe("Error compiling fragment shader: " + filename); + } + + printShaderLogInfo(i, filename, list); + return i; + } + } + + private static void saveShader(String filename, String code) + { + try + { + File file1 = new File(shaderpacksdir, "debug/" + filename); + file1.getParentFile().mkdirs(); + Config.writeFile(file1, code); + } + catch (IOException ioexception) + { + Config.warn("Error saving: " + filename); + ioexception.printStackTrace(); + } + } + + private static void clearDirectory(File dir) + { + if (dir.exists()) + { + if (dir.isDirectory()) + { + File[] afile = dir.listFiles(); + + if (afile != null) + { + for (int i = 0; i < afile.length; ++i) + { + File file1 = afile[i]; + + if (file1.isDirectory()) + { + clearDirectory(file1); + } + + file1.delete(); + } + } + } + } + } + + private static boolean printLogInfo(int obj, String name) + { + IntBuffer intbuffer = BufferUtils.createIntBuffer(1); + ARBShaderObjects.glGetObjectParameterARB(obj, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB, (IntBuffer)intbuffer); + int i = intbuffer.get(); + + if (i > 1) + { + ByteBuffer bytebuffer = BufferUtils.createByteBuffer(i); + intbuffer.flip(); + ARBShaderObjects.glGetInfoLogARB(obj, intbuffer, bytebuffer); + byte[] abyte = new byte[i]; + bytebuffer.get(abyte); + + if (abyte[i - 1] == 0) + { + abyte[i - 1] = 10; + } + + String s = new String(abyte); + SMCLog.info("Info log: " + name + "\n" + s); + return false; + } + else + { + return true; + } + } + + private static boolean printShaderLogInfo(int shader, String name, List listFiles) + { + IntBuffer intbuffer = BufferUtils.createIntBuffer(1); + int i = GL20.glGetShaderi(shader, 35716); + + if (i <= 1) + { + return true; + } + else + { + for (int j = 0; j < listFiles.size(); ++j) + { + String s = (String)listFiles.get(j); + SMCLog.info("File: " + (j + 1) + " = " + s); + } + + String s1 = GL20.glGetShaderInfoLog(shader, i); + SMCLog.info("Shader info log: " + name + "\n" + s1); + return false; + } + } + + public static void setDrawBuffers(IntBuffer drawBuffers) + { + if (drawBuffers == null) + { + drawBuffers = drawBuffersNone; + } + + if (activeDrawBuffers != drawBuffers) + { + activeDrawBuffers = drawBuffers; + GL20.glDrawBuffers(drawBuffers); + } + } + + public static void useProgram(int program) + { + checkGLError("pre-useProgram"); + + if (isShadowPass) + { + program = 30; + + if (programsID[30] == 0) + { + normalMapEnabled = false; + return; + } + } + + if (activeProgram != program) + { + activeProgram = program; + ARBShaderObjects.glUseProgramObjectARB(programsID[program]); + + if (programsID[program] == 0) + { + normalMapEnabled = false; + } + else + { + if (checkGLError("useProgram ", programNames[program]) != 0) + { + programsID[program] = 0; + } + + IntBuffer intbuffer = programsDrawBuffers[program]; + + if (isRenderingDfb) + { + setDrawBuffers(intbuffer); + checkGLError(programNames[program], " draw buffers = ", programsDrawBufSettings[program]); + } + + activeCompositeMipmapSetting = programsCompositeMipmapSetting[program]; + uniformEntityColor.setProgram(programsID[activeProgram]); + uniformEntityId.setProgram(programsID[activeProgram]); + uniformBlockEntityId.setProgram(programsID[activeProgram]); + + switch (program) + { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 16: + case 18: + case 19: + case 20: + normalMapEnabled = true; + setProgramUniform1i("texture", 0); + setProgramUniform1i("lightmap", 1); + setProgramUniform1i("normals", 2); + setProgramUniform1i("specular", 3); + setProgramUniform1i("shadow", waterShadowEnabled ? 5 : 4); + setProgramUniform1i("watershadow", 4); + setProgramUniform1i("shadowtex0", 4); + setProgramUniform1i("shadowtex1", 5); + setProgramUniform1i("depthtex0", 6); + + if (customTexturesGbuffers != null) + { + setProgramUniform1i("gaux1", 7); + setProgramUniform1i("gaux2", 8); + setProgramUniform1i("gaux3", 9); + setProgramUniform1i("gaux4", 10); + } + + setProgramUniform1i("depthtex1", 12); + setProgramUniform1i("shadowcolor", 13); + setProgramUniform1i("shadowcolor0", 13); + setProgramUniform1i("shadowcolor1", 14); + setProgramUniform1i("noisetex", 15); + break; + + case 14: + case 15: + case 17: + default: + normalMapEnabled = false; + break; + + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + normalMapEnabled = false; + setProgramUniform1i("gcolor", 0); + setProgramUniform1i("gdepth", 1); + setProgramUniform1i("gnormal", 2); + setProgramUniform1i("composite", 3); + setProgramUniform1i("gaux1", 7); + setProgramUniform1i("gaux2", 8); + setProgramUniform1i("gaux3", 9); + setProgramUniform1i("gaux4", 10); + setProgramUniform1i("colortex0", 0); + setProgramUniform1i("colortex1", 1); + setProgramUniform1i("colortex2", 2); + setProgramUniform1i("colortex3", 3); + setProgramUniform1i("colortex4", 7); + setProgramUniform1i("colortex5", 8); + setProgramUniform1i("colortex6", 9); + setProgramUniform1i("colortex7", 10); + setProgramUniform1i("shadow", waterShadowEnabled ? 5 : 4); + setProgramUniform1i("watershadow", 4); + setProgramUniform1i("shadowtex0", 4); + setProgramUniform1i("shadowtex1", 5); + setProgramUniform1i("gdepthtex", 6); + setProgramUniform1i("depthtex0", 6); + setProgramUniform1i("depthtex1", 11); + setProgramUniform1i("depthtex2", 12); + setProgramUniform1i("shadowcolor", 13); + setProgramUniform1i("shadowcolor0", 13); + setProgramUniform1i("shadowcolor1", 14); + setProgramUniform1i("noisetex", 15); + break; + + case 30: + case 31: + case 32: + setProgramUniform1i("tex", 0); + setProgramUniform1i("texture", 0); + setProgramUniform1i("lightmap", 1); + setProgramUniform1i("normals", 2); + setProgramUniform1i("specular", 3); + setProgramUniform1i("shadow", waterShadowEnabled ? 5 : 4); + setProgramUniform1i("watershadow", 4); + setProgramUniform1i("shadowtex0", 4); + setProgramUniform1i("shadowtex1", 5); + + if (customTexturesGbuffers != null) + { + setProgramUniform1i("gaux1", 7); + setProgramUniform1i("gaux2", 8); + setProgramUniform1i("gaux3", 9); + setProgramUniform1i("gaux4", 10); + } + + setProgramUniform1i("shadowcolor", 13); + setProgramUniform1i("shadowcolor0", 13); + setProgramUniform1i("shadowcolor1", 14); + setProgramUniform1i("noisetex", 15); + } + + ItemStack itemstack = mc.thePlayer != null ? mc.thePlayer.getHeldItem() : null; + Item item = itemstack != null ? itemstack.getItem() : null; + int i = -1; + Block block = null; + + if (item != null) + { + i = Item.itemRegistry.getIDForObject(item); + block = (Block)Block.blockRegistry.getObjectById(i); + } + + int j = block != null ? block.getLightValue() : 0; + setProgramUniform1i("heldItemId", i); + setProgramUniform1i("heldBlockLightValue", j); + setProgramUniform1i("fogMode", fogEnabled ? fogMode : 0); + setProgramUniform3f("fogColor", fogColorR, fogColorG, fogColorB); + setProgramUniform3f("skyColor", skyColorR, skyColorG, skyColorB); + setProgramUniform1i("worldTime", (int)(worldTime % 24000L)); + setProgramUniform1i("worldDay", (int)(worldTime / 24000L)); + setProgramUniform1i("moonPhase", moonPhase); + setProgramUniform1i("frameCounter", frameCounter); + setProgramUniform1f("frameTime", frameTime); + setProgramUniform1f("frameTimeCounter", frameTimeCounter); + setProgramUniform1f("sunAngle", sunAngle); + setProgramUniform1f("shadowAngle", shadowAngle); + setProgramUniform1f("rainStrength", rainStrength); + setProgramUniform1f("aspectRatio", (float)renderWidth / (float)renderHeight); + setProgramUniform1f("viewWidth", (float)renderWidth); + setProgramUniform1f("viewHeight", (float)renderHeight); + setProgramUniform1f("near", 0.05F); + setProgramUniform1f("far", (float)(mc.gameSettings.renderDistanceChunks * 16)); + setProgramUniform3f("sunPosition", sunPosition[0], sunPosition[1], sunPosition[2]); + setProgramUniform3f("moonPosition", moonPosition[0], moonPosition[1], moonPosition[2]); + setProgramUniform3f("shadowLightPosition", shadowLightPosition[0], shadowLightPosition[1], shadowLightPosition[2]); + setProgramUniform3f("upPosition", upPosition[0], upPosition[1], upPosition[2]); + setProgramUniform3f("previousCameraPosition", (float)previousCameraPositionX, (float)previousCameraPositionY, (float)previousCameraPositionZ); + setProgramUniform3f("cameraPosition", (float)cameraPositionX, (float)cameraPositionY, (float)cameraPositionZ); + setProgramUniformMatrix4ARB("gbufferModelView", false, modelView); + setProgramUniformMatrix4ARB("gbufferModelViewInverse", false, modelViewInverse); + setProgramUniformMatrix4ARB("gbufferPreviousProjection", false, previousProjection); + setProgramUniformMatrix4ARB("gbufferProjection", false, projection); + setProgramUniformMatrix4ARB("gbufferProjectionInverse", false, projectionInverse); + setProgramUniformMatrix4ARB("gbufferPreviousModelView", false, previousModelView); + + if (usedShadowDepthBuffers > 0) + { + setProgramUniformMatrix4ARB("shadowProjection", false, shadowProjection); + setProgramUniformMatrix4ARB("shadowProjectionInverse", false, shadowProjectionInverse); + setProgramUniformMatrix4ARB("shadowModelView", false, shadowModelView); + setProgramUniformMatrix4ARB("shadowModelViewInverse", false, shadowModelViewInverse); + } + + setProgramUniform1f("wetness", wetness); + setProgramUniform1f("eyeAltitude", eyePosY); + setProgramUniform2i("eyeBrightness", eyeBrightness & 65535, eyeBrightness >> 16); + setProgramUniform2i("eyeBrightnessSmooth", Math.round(eyeBrightnessFadeX), Math.round(eyeBrightnessFadeY)); + setProgramUniform2i("terrainTextureSize", terrainTextureSize[0], terrainTextureSize[1]); + setProgramUniform1i("terrainIconSize", terrainIconSize); + setProgramUniform1i("isEyeInWater", isEyeInWater); + setProgramUniform1f("nightVision", nightVision); + setProgramUniform1f("blindness", blindness); + setProgramUniform1f("screenBrightness", mc.gameSettings.gammaSetting); + setProgramUniform1i("hideGUI", mc.gameSettings.hideGUI ? 1 : 0); + setProgramUniform1f("centerDepthSmooth", centerDepthSmooth); + setProgramUniform2i("atlasSize", atlasSizeX, atlasSizeY); + checkGLError("useProgram ", programNames[program]); + } + } + } + + public static void setProgramUniform1i(String name, int x) + { + int i = programsID[activeProgram]; + + if (i != 0) + { + int j = ARBShaderObjects.glGetUniformLocationARB(i, (CharSequence)name); + ARBShaderObjects.glUniform1iARB(j, x); + checkGLError(programNames[activeProgram], name); + } + } + + public static void setProgramUniform2i(String name, int x, int y) + { + int i = programsID[activeProgram]; + + if (i != 0) + { + int j = ARBShaderObjects.glGetUniformLocationARB(i, (CharSequence)name); + ARBShaderObjects.glUniform2iARB(j, x, y); + checkGLError(programNames[activeProgram], name); + } + } + + public static void setProgramUniform1f(String name, float x) + { + int i = programsID[activeProgram]; + + if (i != 0) + { + int j = ARBShaderObjects.glGetUniformLocationARB(i, (CharSequence)name); + ARBShaderObjects.glUniform1fARB(j, x); + checkGLError(programNames[activeProgram], name); + } + } + + public static void setProgramUniform3f(String name, float x, float y, float z) + { + int i = programsID[activeProgram]; + + if (i != 0) + { + int j = ARBShaderObjects.glGetUniformLocationARB(i, (CharSequence)name); + ARBShaderObjects.glUniform3fARB(j, x, y, z); + checkGLError(programNames[activeProgram], name); + } + } + + public static void setProgramUniformMatrix4ARB(String name, boolean transpose, FloatBuffer matrix) + { + int i = programsID[activeProgram]; + + if (i != 0 && matrix != null) + { + int j = ARBShaderObjects.glGetUniformLocationARB(i, (CharSequence)name); + ARBShaderObjects.glUniformMatrix4ARB(j, transpose, matrix); + checkGLError(programNames[activeProgram], name); + } + } + + private static int getBufferIndexFromString(String name) + { + return !name.equals("colortex0") && !name.equals("gcolor") ? (!name.equals("colortex1") && !name.equals("gdepth") ? (!name.equals("colortex2") && !name.equals("gnormal") ? (!name.equals("colortex3") && !name.equals("composite") ? (!name.equals("colortex4") && !name.equals("gaux1") ? (!name.equals("colortex5") && !name.equals("gaux2") ? (!name.equals("colortex6") && !name.equals("gaux3") ? (!name.equals("colortex7") && !name.equals("gaux4") ? -1 : 7) : 6) : 5) : 4) : 3) : 2) : 1) : 0; + } + + private static int getTextureFormatFromString(String par) + { + par = par.trim(); + + for (int i = 0; i < formatNames.length; ++i) + { + String s = formatNames[i]; + + if (par.equals(s)) + { + return formatIds[i]; + } + } + + return 0; + } + + private static void setupNoiseTexture() + { + if (noiseTexture == null) + { + noiseTexture = new HFNoiseTexture(noiseTextureResolution, noiseTextureResolution); + } + } + + private static void loadEntityDataMap() + { + mapBlockToEntityData = new IdentityHashMap(300); + + if (mapBlockToEntityData.isEmpty()) + { + for (ResourceLocation resourcelocation : Block.blockRegistry.getKeys()) + { + Block block = (Block)Block.blockRegistry.getObject(resourcelocation); + int i = Block.blockRegistry.getIDForObject(block); + mapBlockToEntityData.put(block, Integer.valueOf(i)); + } + } + + BufferedReader bufferedreader = null; + + try + { + bufferedreader = new BufferedReader(new InputStreamReader(shaderPack.getResourceAsStream("/mc_Entity_x.txt"))); + } + catch (Exception var8) + { + ; + } + + if (bufferedreader != null) + { + String s1; + + try + { + while ((s1 = bufferedreader.readLine()) != null) + { + Matcher matcher = patternLoadEntityDataMap.matcher(s1); + + if (matcher.matches()) + { + String s2 = matcher.group(1); + String s = matcher.group(2); + int j = Integer.parseInt(s); + Block block1 = Block.getBlockFromName(s2); + + if (block1 != null) + { + mapBlockToEntityData.put(block1, Integer.valueOf(j)); + } + else + { + SMCLog.warning("Unknown block name %s", new Object[] {s2}); + } + } + else + { + SMCLog.warning("unmatched %s\n", new Object[] {s1}); + } + } + } + catch (Exception var9) + { + SMCLog.warning("Error parsing mc_Entity_x.txt"); + } + } + + if (bufferedreader != null) + { + try + { + bufferedreader.close(); + } + catch (Exception var7) + { + ; + } + } + } + + private static IntBuffer fillIntBufferZero(IntBuffer buf) + { + int i = buf.limit(); + + for (int j = buf.position(); j < i; ++j) + { + buf.put(j, 0); + } + + return buf; + } + + public static void uninit() + { + if (isShaderPackInitialized) + { + checkGLError("Shaders.uninit pre"); + + for (int i = 0; i < 33; ++i) + { + if (programsRef[i] != 0) + { + ARBShaderObjects.glDeleteObjectARB(programsRef[i]); + checkGLError("del programRef"); + } + + programsRef[i] = 0; + programsID[i] = 0; + programsDrawBufSettings[i] = null; + programsDrawBuffers[i] = null; + programsCompositeMipmapSetting[i] = 0; + } + + if (dfb != 0) + { + EXTFramebufferObject.glDeleteFramebuffersEXT(dfb); + dfb = 0; + checkGLError("del dfb"); + } + + if (sfb != 0) + { + EXTFramebufferObject.glDeleteFramebuffersEXT(sfb); + sfb = 0; + checkGLError("del sfb"); + } + + if (dfbDepthTextures != null) + { + GlStateManager.deleteTextures(dfbDepthTextures); + fillIntBufferZero(dfbDepthTextures); + checkGLError("del dfbDepthTextures"); + } + + if (dfbColorTextures != null) + { + GlStateManager.deleteTextures(dfbColorTextures); + fillIntBufferZero(dfbColorTextures); + checkGLError("del dfbTextures"); + } + + if (sfbDepthTextures != null) + { + GlStateManager.deleteTextures(sfbDepthTextures); + fillIntBufferZero(sfbDepthTextures); + checkGLError("del shadow depth"); + } + + if (sfbColorTextures != null) + { + GlStateManager.deleteTextures(sfbColorTextures); + fillIntBufferZero(sfbColorTextures); + checkGLError("del shadow color"); + } + + if (dfbDrawBuffers != null) + { + fillIntBufferZero(dfbDrawBuffers); + } + + if (noiseTexture != null) + { + noiseTexture.destroy(); + noiseTexture = null; + } + + SMCLog.info("Uninit"); + shadowPassInterval = 0; + shouldSkipDefaultShadow = false; + isShaderPackInitialized = false; + checkGLError("Shaders.uninit"); + } + } + + public static void scheduleResize() + { + renderDisplayHeight = 0; + } + + public static void scheduleResizeShadow() + { + needResizeShadow = true; + } + + private static void resize() + { + renderDisplayWidth = mc.displayWidth; + renderDisplayHeight = mc.displayHeight; + renderWidth = Math.round((float)renderDisplayWidth * configRenderResMul); + renderHeight = Math.round((float)renderDisplayHeight * configRenderResMul); + setupFrameBuffer(); + } + + private static void resizeShadow() + { + needResizeShadow = false; + shadowMapWidth = Math.round((float)spShadowMapWidth * configShadowResMul); + shadowMapHeight = Math.round((float)spShadowMapHeight * configShadowResMul); + setupShadowFrameBuffer(); + } + + private static void setupFrameBuffer() + { + if (dfb != 0) + { + EXTFramebufferObject.glDeleteFramebuffersEXT(dfb); + GlStateManager.deleteTextures(dfbDepthTextures); + GlStateManager.deleteTextures(dfbColorTextures); + } + + dfb = EXTFramebufferObject.glGenFramebuffersEXT(); + GL11.glGenTextures((IntBuffer)dfbDepthTextures.clear().limit(usedDepthBuffers)); + GL11.glGenTextures((IntBuffer)dfbColorTextures.clear().limit(16)); + dfbDepthTextures.position(0); + dfbColorTextures.position(0); + dfbColorTextures.get(dfbColorTexturesA).position(0); + EXTFramebufferObject.glBindFramebufferEXT(36160, dfb); + GL20.glDrawBuffers(0); + GL11.glReadBuffer(0); + + for (int i = 0; i < usedDepthBuffers; ++i) + { + GlStateManager.bindTexture(dfbDepthTextures.get(i)); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_DEPTH_TEXTURE_MODE, GL11.GL_LUMINANCE); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_DEPTH_COMPONENT, renderWidth, renderHeight, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (FloatBuffer)((FloatBuffer)null)); + } + + EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36096, 3553, dfbDepthTextures.get(0), 0); + GL20.glDrawBuffers(dfbDrawBuffers); + GL11.glReadBuffer(0); + checkGLError("FT d"); + + for (int k = 0; k < usedColorBuffers; ++k) + { + GlStateManager.bindTexture(dfbColorTexturesA[k]); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, gbuffersFormat[k], renderWidth, renderHeight, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (ByteBuffer)((ByteBuffer)null)); + EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36064 + k, 3553, dfbColorTexturesA[k], 0); + checkGLError("FT c"); + } + + for (int l = 0; l < usedColorBuffers; ++l) + { + GlStateManager.bindTexture(dfbColorTexturesA[8 + l]); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, gbuffersFormat[l], renderWidth, renderHeight, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (ByteBuffer)((ByteBuffer)null)); + checkGLError("FT ca"); + } + + int i1 = EXTFramebufferObject.glCheckFramebufferStatusEXT(36160); + + if (i1 == 36058) + { + printChatAndLogError("[Shaders] Error: Failed framebuffer incomplete formats"); + + for (int j = 0; j < usedColorBuffers; ++j) + { + GlStateManager.bindTexture(dfbColorTextures.get(j)); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, renderWidth, renderHeight, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (ByteBuffer)((ByteBuffer)null)); + EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36064 + j, 3553, dfbColorTextures.get(j), 0); + checkGLError("FT c"); + } + + i1 = EXTFramebufferObject.glCheckFramebufferStatusEXT(36160); + + if (i1 == 36053) + { + SMCLog.info("complete"); + } + } + + GlStateManager.bindTexture(0); + + if (i1 != 36053) + { + printChatAndLogError("[Shaders] Error: Failed creating framebuffer! (Status " + i1 + ")"); + } + else + { + SMCLog.info("Framebuffer created."); + } + } + + private static void setupShadowFrameBuffer() + { + if (usedShadowDepthBuffers != 0) + { + if (sfb != 0) + { + EXTFramebufferObject.glDeleteFramebuffersEXT(sfb); + GlStateManager.deleteTextures(sfbDepthTextures); + GlStateManager.deleteTextures(sfbColorTextures); + } + + sfb = EXTFramebufferObject.glGenFramebuffersEXT(); + EXTFramebufferObject.glBindFramebufferEXT(36160, sfb); + GL11.glDrawBuffer(0); + GL11.glReadBuffer(0); + GL11.glGenTextures((IntBuffer)sfbDepthTextures.clear().limit(usedShadowDepthBuffers)); + GL11.glGenTextures((IntBuffer)sfbColorTextures.clear().limit(usedShadowColorBuffers)); + sfbDepthTextures.position(0); + sfbColorTextures.position(0); + + for (int i = 0; i < usedShadowDepthBuffers; ++i) + { + GlStateManager.bindTexture(sfbDepthTextures.get(i)); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10496.0F); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10496.0F); + int j = shadowFilterNearest[i] ? 9728 : 9729; + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, j); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, j); + + if (shadowHardwareFilteringEnabled[i]) + { + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_COMPARE_MODE, GL14.GL_COMPARE_R_TO_TEXTURE); + } + + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_DEPTH_COMPONENT, shadowMapWidth, shadowMapHeight, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (FloatBuffer)((FloatBuffer)null)); + } + + EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36096, 3553, sfbDepthTextures.get(0), 0); + checkGLError("FT sd"); + + for (int k = 0; k < usedShadowColorBuffers; ++k) + { + GlStateManager.bindTexture(sfbColorTextures.get(k)); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10496.0F); + GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10496.0F); + int i1 = shadowColorFilterNearest[k] ? 9728 : 9729; + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, i1); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, i1); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, shadowMapWidth, shadowMapHeight, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (ByteBuffer)((ByteBuffer)null)); + EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36064 + k, 3553, sfbColorTextures.get(k), 0); + checkGLError("FT sc"); + } + + GlStateManager.bindTexture(0); + + if (usedShadowColorBuffers > 0) + { + GL20.glDrawBuffers(sfbDrawBuffers); + } + + int l = EXTFramebufferObject.glCheckFramebufferStatusEXT(36160); + + if (l != 36053) + { + printChatAndLogError("[Shaders] Error: Failed creating shadow framebuffer! (Status " + l + ")"); + } + else + { + SMCLog.info("Shadow framebuffer created."); + } + } + } + + public static void beginRender(Minecraft minecraft, float partialTicks, long finishTimeNano) + { + checkGLError("pre beginRender"); + checkWorldChanged(mc.theWorld); + mc = minecraft; + mc.mcProfiler.startSection("init"); + entityRenderer = mc.entityRenderer; + + if (!isShaderPackInitialized) + { + try + { + init(); + } + catch (IllegalStateException illegalstateexception) + { + if (Config.normalize(illegalstateexception.getMessage()).equals("Function is not supported")) + { + printChatAndLogError("[Shaders] Error: " + illegalstateexception.getMessage()); + illegalstateexception.printStackTrace(); + setShaderPack(packNameNone); + return; + } + } + } + + if (mc.displayWidth != renderDisplayWidth || mc.displayHeight != renderDisplayHeight) + { + resize(); + } + + if (needResizeShadow) + { + resizeShadow(); + } + + worldTime = mc.theWorld.getWorldTime(); + diffWorldTime = (worldTime - lastWorldTime) % 24000L; + + if (diffWorldTime < 0L) + { + diffWorldTime += 24000L; + } + + lastWorldTime = worldTime; + moonPhase = mc.theWorld.getMoonPhase(); + ++frameCounter; + + if (frameCounter >= 720720) + { + frameCounter = 0; + } + + systemTime = System.currentTimeMillis(); + + if (lastSystemTime == 0L) + { + lastSystemTime = systemTime; + } + + diffSystemTime = systemTime - lastSystemTime; + lastSystemTime = systemTime; + frameTime = (float)diffSystemTime / 1000.0F; + frameTimeCounter += frameTime; + frameTimeCounter %= 3600.0F; + rainStrength = minecraft.theWorld.getRainStrength(partialTicks); + float f = (float)diffSystemTime * 0.01F; + float f1 = (float)Math.exp(Math.log(0.5D) * (double)f / (double)(wetness < rainStrength ? drynessHalfLife : wetnessHalfLife)); + wetness = wetness * f1 + rainStrength * (1.0F - f1); + Entity entity = mc.getRenderViewEntity(); + + if (entity != null) + { + isSleeping = entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPlayerSleeping(); + eyePosY = (float)entity.posY * partialTicks + (float)entity.lastTickPosY * (1.0F - partialTicks); + eyeBrightness = entity.getBrightnessForRender(partialTicks); + f1 = (float)diffSystemTime * 0.01F; + float f2 = (float)Math.exp(Math.log(0.5D) * (double)f1 / (double)eyeBrightnessHalflife); + eyeBrightnessFadeX = eyeBrightnessFadeX * f2 + (float)(eyeBrightness & 65535) * (1.0F - f2); + eyeBrightnessFadeY = eyeBrightnessFadeY * f2 + (float)(eyeBrightness >> 16) * (1.0F - f2); + isEyeInWater = mc.gameSettings.thirdPersonView == 0 && !isSleeping && mc.thePlayer.isInsideOfMaterial(Material.water) ? 1 : 0; + + if (mc.thePlayer != null) + { + nightVision = 0.0F; + + if (mc.thePlayer.isPotionActive(Potion.nightVision)) + { + nightVision = Config.getMinecraft().entityRenderer.getNightVisionBrightness(mc.thePlayer, partialTicks); + } + + blindness = 0.0F; + + if (mc.thePlayer.isPotionActive(Potion.blindness)) + { + int i = mc.thePlayer.getActivePotionEffect(Potion.blindness).getDuration(); + blindness = Config.limit((float)i / 20.0F, 0.0F, 1.0F); + } + } + + Vec3 vec3 = mc.theWorld.getSkyColor(entity, partialTicks); + vec3 = CustomColors.getWorldSkyColor(vec3, currentWorld, entity, partialTicks); + skyColorR = (float)vec3.xCoord; + skyColorG = (float)vec3.yCoord; + skyColorB = (float)vec3.zCoord; + } + + isRenderingWorld = true; + isCompositeRendered = false; + isHandRenderedMain = false; + + if (usedShadowDepthBuffers >= 1) + { + GlStateManager.setActiveTexture(33988); + GlStateManager.bindTexture(sfbDepthTextures.get(0)); + + if (usedShadowDepthBuffers >= 2) + { + GlStateManager.setActiveTexture(33989); + GlStateManager.bindTexture(sfbDepthTextures.get(1)); + } + } + + GlStateManager.setActiveTexture(33984); + + for (int j = 0; j < usedColorBuffers; ++j) + { + GlStateManager.bindTexture(dfbColorTexturesA[j]); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GlStateManager.bindTexture(dfbColorTexturesA[8 + j]); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + } + + GlStateManager.bindTexture(0); + + for (int k = 0; k < 4 && 4 + k < usedColorBuffers; ++k) + { + GlStateManager.setActiveTexture(33991 + k); + GlStateManager.bindTexture(dfbColorTextures.get(4 + k)); + } + + GlStateManager.setActiveTexture(33990); + GlStateManager.bindTexture(dfbDepthTextures.get(0)); + + if (usedDepthBuffers >= 2) + { + GlStateManager.setActiveTexture(33995); + GlStateManager.bindTexture(dfbDepthTextures.get(1)); + + if (usedDepthBuffers >= 3) + { + GlStateManager.setActiveTexture(33996); + GlStateManager.bindTexture(dfbDepthTextures.get(2)); + } + } + + for (int l = 0; l < usedShadowColorBuffers; ++l) + { + GlStateManager.setActiveTexture(33997 + l); + GlStateManager.bindTexture(sfbColorTextures.get(l)); + } + + if (noiseTextureEnabled) + { + GlStateManager.setActiveTexture(33984 + noiseTexture.textureUnit); + GlStateManager.bindTexture(noiseTexture.getID()); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + } + + bindCustomTextures(customTexturesGbuffers); + GlStateManager.setActiveTexture(33984); + previousCameraPositionX = cameraPositionX; + previousCameraPositionY = cameraPositionY; + previousCameraPositionZ = cameraPositionZ; + previousProjection.position(0); + projection.position(0); + previousProjection.put(projection); + previousProjection.position(0); + projection.position(0); + previousModelView.position(0); + modelView.position(0); + previousModelView.put(modelView); + previousModelView.position(0); + modelView.position(0); + checkGLError("beginRender"); + ShadersRender.renderShadowMap(entityRenderer, 0, partialTicks, finishTimeNano); + mc.mcProfiler.endSection(); + EXTFramebufferObject.glBindFramebufferEXT(36160, dfb); + + for (int i1 = 0; i1 < usedColorBuffers; ++i1) + { + colorTexturesToggle[i1] = 0; + EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36064 + i1, 3553, dfbColorTexturesA[i1], 0); + } + + checkGLError("end beginRender"); + } + + private static void checkWorldChanged(World worldd) + { + if (currentWorld != worldd) + { + World world = currentWorld; + currentWorld = worldd; + + if (world != null && worldd != null) + { + int i = world.provider.getDimensionId(); + int j = worldd.provider.getDimensionId(); + boolean flag = shaderPackDimensions.contains(Integer.valueOf(i)); + boolean flag1 = shaderPackDimensions.contains(Integer.valueOf(j)); + + if (flag || flag1) + { + uninit(); + } + } + } + } + + public static void beginRenderPass(int pass, float partialTicks, long finishTimeNano) + { + if (!isShadowPass) + { + EXTFramebufferObject.glBindFramebufferEXT(36160, dfb); + GL11.glViewport(0, 0, renderWidth, renderHeight); + activeDrawBuffers = null; + ShadersTex.bindNSTextures(defaultTexture.getMultiTexID()); + useProgram(2); + checkGLError("end beginRenderPass"); + } + } + + public static void setViewport(int vx, int vy, int vw, int vh) + { + GlStateManager.colorMask(true, true, true, true); + + if (isShadowPass) + { + GL11.glViewport(0, 0, shadowMapWidth, shadowMapHeight); + } + else + { + GL11.glViewport(0, 0, renderWidth, renderHeight); + EXTFramebufferObject.glBindFramebufferEXT(36160, dfb); + isRenderingDfb = true; + GlStateManager.enableCull(); + GlStateManager.enableDepth(); + setDrawBuffers(drawBuffersNone); + useProgram(2); + checkGLError("beginRenderPass"); + } + } + + public static int setFogMode(int val) + { + fogMode = val; + return val; + } + + public static void setFogColor(float r, float g, float b) + { + fogColorR = r; + fogColorG = g; + fogColorB = b; + } + + public static void setClearColor(float red, float green, float blue, float alpha) + { + GlStateManager.clearColor(red, green, blue, alpha); + clearColorR = red; + clearColorG = green; + clearColorB = blue; + } + + public static void clearRenderBuffer() + { + if (isShadowPass) + { + checkGLError("shadow clear pre"); + EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36096, 3553, sfbDepthTextures.get(0), 0); + GL11.glClearColor(1.0F, 1.0F, 1.0F, 1.0F); + GL20.glDrawBuffers(programsDrawBuffers[30]); + checkFramebufferStatus("shadow clear"); + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); + checkGLError("shadow clear"); + } + else + { + checkGLError("clear pre"); + + if (gbuffersClear[0]) + { + GL20.glDrawBuffers(36064); + GL11.glClear(16384); + } + + if (gbuffersClear[1]) + { + GL20.glDrawBuffers(36065); + GL11.glClearColor(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glClear(16384); + } + + for (int i = 2; i < usedColorBuffers; ++i) + { + if (gbuffersClear[i]) + { + GL20.glDrawBuffers(36064 + i); + GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); + GL11.glClear(16384); + } + } + + setDrawBuffers(dfbDrawBuffers); + checkFramebufferStatus("clear"); + checkGLError("clear"); + } + } + + public static void setCamera(float partialTicks) + { + Entity entity = mc.getRenderViewEntity(); + double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; + cameraPositionX = d0; + cameraPositionY = d1; + cameraPositionZ = d2; + GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, (FloatBuffer)projection.position(0)); + SMath.invertMat4FBFA((FloatBuffer)projectionInverse.position(0), (FloatBuffer)projection.position(0), faProjectionInverse, faProjection); + projection.position(0); + projectionInverse.position(0); + GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, (FloatBuffer)modelView.position(0)); + SMath.invertMat4FBFA((FloatBuffer)modelViewInverse.position(0), (FloatBuffer)modelView.position(0), faModelViewInverse, faModelView); + modelView.position(0); + modelViewInverse.position(0); + checkGLError("setCamera"); + } + + public static void setCameraShadow(float partialTicks) + { + Entity entity = mc.getRenderViewEntity(); + double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; + cameraPositionX = d0; + cameraPositionY = d1; + cameraPositionZ = d2; + GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, (FloatBuffer)projection.position(0)); + SMath.invertMat4FBFA((FloatBuffer)projectionInverse.position(0), (FloatBuffer)projection.position(0), faProjectionInverse, faProjection); + projection.position(0); + projectionInverse.position(0); + GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, (FloatBuffer)modelView.position(0)); + SMath.invertMat4FBFA((FloatBuffer)modelViewInverse.position(0), (FloatBuffer)modelView.position(0), faModelViewInverse, faModelView); + modelView.position(0); + modelViewInverse.position(0); + GL11.glViewport(0, 0, shadowMapWidth, shadowMapHeight); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + + if (shadowMapIsOrtho) + { + GL11.glOrtho((double)(-shadowMapHalfPlane), (double)shadowMapHalfPlane, (double)(-shadowMapHalfPlane), (double)shadowMapHalfPlane, 0.05000000074505806D, 256.0D); + } + else + { + GLU.gluPerspective(shadowMapFOV, (float)shadowMapWidth / (float)shadowMapHeight, 0.05F, 256.0F); + } + + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -100.0F); + GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + celestialAngle = mc.theWorld.getCelestialAngle(partialTicks); + sunAngle = celestialAngle < 0.75F ? celestialAngle + 0.25F : celestialAngle - 0.75F; + float f = celestialAngle * -360.0F; + float f1 = shadowAngleInterval > 0.0F ? f % shadowAngleInterval - shadowAngleInterval * 0.5F : 0.0F; + + if ((double)sunAngle <= 0.5D) + { + GL11.glRotatef(f - f1, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(sunPathRotation, 1.0F, 0.0F, 0.0F); + shadowAngle = sunAngle; + } + else + { + GL11.glRotatef(f + 180.0F - f1, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(sunPathRotation, 1.0F, 0.0F, 0.0F); + shadowAngle = sunAngle - 0.5F; + } + + if (shadowMapIsOrtho) + { + float f2 = shadowIntervalSize; + float f3 = f2 / 2.0F; + GL11.glTranslatef((float)d0 % f2 - f3, (float)d1 % f2 - f3, (float)d2 % f2 - f3); + } + + float f9 = sunAngle * ((float)Math.PI * 2F); + float f10 = (float)Math.cos((double)f9); + float f4 = (float)Math.sin((double)f9); + float f5 = sunPathRotation * ((float)Math.PI * 2F); + float f6 = f10; + float f7 = f4 * (float)Math.cos((double)f5); + float f8 = f4 * (float)Math.sin((double)f5); + + if ((double)sunAngle > 0.5D) + { + f6 = -f10; + f7 = -f7; + f8 = -f8; + } + + shadowLightPositionVector[0] = f6; + shadowLightPositionVector[1] = f7; + shadowLightPositionVector[2] = f8; + shadowLightPositionVector[3] = 0.0F; + GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, (FloatBuffer)shadowProjection.position(0)); + SMath.invertMat4FBFA((FloatBuffer)shadowProjectionInverse.position(0), (FloatBuffer)shadowProjection.position(0), faShadowProjectionInverse, faShadowProjection); + shadowProjection.position(0); + shadowProjectionInverse.position(0); + GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, (FloatBuffer)shadowModelView.position(0)); + SMath.invertMat4FBFA((FloatBuffer)shadowModelViewInverse.position(0), (FloatBuffer)shadowModelView.position(0), faShadowModelViewInverse, faShadowModelView); + shadowModelView.position(0); + shadowModelViewInverse.position(0); + setProgramUniformMatrix4ARB("gbufferProjection", false, projection); + setProgramUniformMatrix4ARB("gbufferProjectionInverse", false, projectionInverse); + setProgramUniformMatrix4ARB("gbufferPreviousProjection", false, previousProjection); + setProgramUniformMatrix4ARB("gbufferModelView", false, modelView); + setProgramUniformMatrix4ARB("gbufferModelViewInverse", false, modelViewInverse); + setProgramUniformMatrix4ARB("gbufferPreviousModelView", false, previousModelView); + setProgramUniformMatrix4ARB("shadowProjection", false, shadowProjection); + setProgramUniformMatrix4ARB("shadowProjectionInverse", false, shadowProjectionInverse); + setProgramUniformMatrix4ARB("shadowModelView", false, shadowModelView); + setProgramUniformMatrix4ARB("shadowModelViewInverse", false, shadowModelViewInverse); + mc.gameSettings.thirdPersonView = 1; + checkGLError("setCamera"); + } + + public static void preCelestialRotate() + { + GL11.glRotatef(sunPathRotation * 1.0F, 0.0F, 0.0F, 1.0F); + checkGLError("preCelestialRotate"); + } + + public static void postCelestialRotate() + { + FloatBuffer floatbuffer = tempMatrixDirectBuffer; + floatbuffer.clear(); + GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, floatbuffer); + floatbuffer.get(tempMat, 0, 16); + SMath.multiplyMat4xVec4(sunPosition, tempMat, sunPosModelView); + SMath.multiplyMat4xVec4(moonPosition, tempMat, moonPosModelView); + System.arraycopy(shadowAngle == sunAngle ? sunPosition : moonPosition, 0, shadowLightPosition, 0, 3); + setProgramUniform3f("sunPosition", sunPosition[0], sunPosition[1], sunPosition[2]); + setProgramUniform3f("moonPosition", moonPosition[0], moonPosition[1], moonPosition[2]); + setProgramUniform3f("shadowLightPosition", shadowLightPosition[0], shadowLightPosition[1], shadowLightPosition[2]); + checkGLError("postCelestialRotate"); + } + + public static void setUpPosition() + { + FloatBuffer floatbuffer = tempMatrixDirectBuffer; + floatbuffer.clear(); + GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, floatbuffer); + floatbuffer.get(tempMat, 0, 16); + SMath.multiplyMat4xVec4(upPosition, tempMat, upPosModelView); + setProgramUniform3f("upPosition", upPosition[0], upPosition[1], upPosition[2]); + } + + public static void genCompositeMipmap() + { + if (hasGlGenMipmap) + { + for (int i = 0; i < usedColorBuffers; ++i) + { + if ((activeCompositeMipmapSetting & 1 << i) != 0) + { + GlStateManager.setActiveTexture(33984 + colorTextureTextureImageUnit[i]); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR); + GL30.glGenerateMipmap(3553); + } + } + + GlStateManager.setActiveTexture(33984); + } + } + + public static void drawComposite() + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glBegin(GL11.GL_QUADS); + GL11.glTexCoord2f(0.0F, 0.0F); + GL11.glVertex3f(0.0F, 0.0F, 0.0F); + GL11.glTexCoord2f(1.0F, 0.0F); + GL11.glVertex3f(1.0F, 0.0F, 0.0F); + GL11.glTexCoord2f(1.0F, 1.0F); + GL11.glVertex3f(1.0F, 1.0F, 0.0F); + GL11.glTexCoord2f(0.0F, 1.0F); + GL11.glVertex3f(0.0F, 1.0F, 0.0F); + GL11.glEnd(); + } + + public static void renderCompositeFinal() + { + if (!isShadowPass) + { + checkGLError("pre-renderCompositeFinal"); + GL11.glPushMatrix(); + GL11.glLoadIdentity(); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glPushMatrix(); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, 1.0D, 0.0D, 1.0D, 0.0D, 1.0D); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableTexture2D(); + GlStateManager.disableAlpha(); + GlStateManager.disableBlend(); + GlStateManager.enableDepth(); + GlStateManager.depthFunc(519); + GlStateManager.depthMask(false); + GlStateManager.disableLighting(); + + if (usedShadowDepthBuffers >= 1) + { + GlStateManager.setActiveTexture(33988); + GlStateManager.bindTexture(sfbDepthTextures.get(0)); + + if (usedShadowDepthBuffers >= 2) + { + GlStateManager.setActiveTexture(33989); + GlStateManager.bindTexture(sfbDepthTextures.get(1)); + } + } + + for (int i = 0; i < usedColorBuffers; ++i) + { + GlStateManager.setActiveTexture(33984 + colorTextureTextureImageUnit[i]); + GlStateManager.bindTexture(dfbColorTexturesA[i]); + } + + GlStateManager.setActiveTexture(33990); + GlStateManager.bindTexture(dfbDepthTextures.get(0)); + + if (usedDepthBuffers >= 2) + { + GlStateManager.setActiveTexture(33995); + GlStateManager.bindTexture(dfbDepthTextures.get(1)); + + if (usedDepthBuffers >= 3) + { + GlStateManager.setActiveTexture(33996); + GlStateManager.bindTexture(dfbDepthTextures.get(2)); + } + } + + for (int j1 = 0; j1 < usedShadowColorBuffers; ++j1) + { + GlStateManager.setActiveTexture(33997 + j1); + GlStateManager.bindTexture(sfbColorTextures.get(j1)); + } + + if (noiseTextureEnabled) + { + GlStateManager.setActiveTexture(33984 + noiseTexture.textureUnit); + GlStateManager.bindTexture(noiseTexture.getID()); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + } + + bindCustomTextures(customTexturesComposite); + GlStateManager.setActiveTexture(33984); + boolean flag = true; + + for (int j = 0; j < usedColorBuffers; ++j) + { + EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36064 + j, 3553, dfbColorTexturesA[8 + j], 0); + } + + EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36096, 3553, dfbDepthTextures.get(0), 0); + GL20.glDrawBuffers(dfbDrawBuffers); + checkGLError("pre-composite"); + + for (int k1 = 0; k1 < 8; ++k1) + { + if (programsID[21 + k1] != 0) + { + useProgram(21 + k1); + checkGLError(programNames[21 + k1]); + + if (activeCompositeMipmapSetting != 0) + { + genCompositeMipmap(); + } + + drawComposite(); + + for (int k = 0; k < usedColorBuffers; ++k) + { + if (programsToggleColorTextures[21 + k1][k]) + { + int l = colorTexturesToggle[k]; + int i1 = colorTexturesToggle[k] = 8 - l; + GlStateManager.setActiveTexture(33984 + colorTextureTextureImageUnit[k]); + GlStateManager.bindTexture(dfbColorTexturesA[i1 + k]); + EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36064 + k, 3553, dfbColorTexturesA[l + k], 0); + } + } + + GlStateManager.setActiveTexture(33984); + } + } + + checkGLError("composite"); + isRenderingDfb = false; + mc.getFramebuffer().bindFramebuffer(true); + OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, 3553, mc.getFramebuffer().framebufferTexture, 0); + GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight); + + if (EntityRenderer.anaglyphEnable) + { + boolean flag1 = EntityRenderer.anaglyphField != 0; + GlStateManager.colorMask(flag1, !flag1, !flag1, true); + } + + GlStateManager.depthMask(true); + GL11.glClearColor(clearColorR, clearColorG, clearColorB, 1.0F); + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableTexture2D(); + GlStateManager.disableAlpha(); + GlStateManager.disableBlend(); + GlStateManager.enableDepth(); + GlStateManager.depthFunc(519); + GlStateManager.depthMask(false); + checkGLError("pre-final"); + useProgram(29); + checkGLError("final"); + + if (activeCompositeMipmapSetting != 0) + { + genCompositeMipmap(); + } + + drawComposite(); + checkGLError("renderCompositeFinal"); + isCompositeRendered = true; + GlStateManager.enableLighting(); + GlStateManager.enableTexture2D(); + GlStateManager.enableAlpha(); + GlStateManager.enableBlend(); + GlStateManager.depthFunc(515); + GlStateManager.depthMask(true); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glPopMatrix(); + useProgram(0); + } + } + + public static void endRender() + { + if (isShadowPass) + { + checkGLError("shadow endRender"); + } + else + { + if (!isCompositeRendered) + { + renderCompositeFinal(); + } + + isRenderingWorld = false; + GlStateManager.colorMask(true, true, true, true); + useProgram(0); + RenderHelper.disableStandardItemLighting(); + checkGLError("endRender end"); + } + } + + public static void beginSky() + { + isRenderingSky = true; + fogEnabled = true; + setDrawBuffers(dfbDrawBuffers); + useProgram(5); + pushEntity(-2, 0); + } + + public static void setSkyColor(Vec3 v3color) + { + skyColorR = (float)v3color.xCoord; + skyColorG = (float)v3color.yCoord; + skyColorB = (float)v3color.zCoord; + setProgramUniform3f("skyColor", skyColorR, skyColorG, skyColorB); + } + + public static void drawHorizon() + { + WorldRenderer worldrenderer = Tessellator.getInstance().getWorldRenderer(); + float f = (float)(mc.gameSettings.renderDistanceChunks * 16); + double d0 = (double)f * 0.9238D; + double d1 = (double)f * 0.3826D; + double d2 = -d1; + double d3 = -d0; + double d4 = 16.0D; + double d5 = -cameraPositionY; + worldrenderer.begin(7, DefaultVertexFormats.POSITION); + worldrenderer.pos(d2, d5, d3).endVertex(); + worldrenderer.pos(d2, d4, d3).endVertex(); + worldrenderer.pos(d3, d4, d2).endVertex(); + worldrenderer.pos(d3, d5, d2).endVertex(); + worldrenderer.pos(d3, d5, d2).endVertex(); + worldrenderer.pos(d3, d4, d2).endVertex(); + worldrenderer.pos(d3, d4, d1).endVertex(); + worldrenderer.pos(d3, d5, d1).endVertex(); + worldrenderer.pos(d3, d5, d1).endVertex(); + worldrenderer.pos(d3, d4, d1).endVertex(); + worldrenderer.pos(d2, d4, d1).endVertex(); + worldrenderer.pos(d2, d5, d1).endVertex(); + worldrenderer.pos(d2, d5, d1).endVertex(); + worldrenderer.pos(d2, d4, d1).endVertex(); + worldrenderer.pos(d1, d4, d0).endVertex(); + worldrenderer.pos(d1, d5, d0).endVertex(); + worldrenderer.pos(d1, d5, d0).endVertex(); + worldrenderer.pos(d1, d4, d0).endVertex(); + worldrenderer.pos(d0, d4, d1).endVertex(); + worldrenderer.pos(d0, d5, d1).endVertex(); + worldrenderer.pos(d0, d5, d1).endVertex(); + worldrenderer.pos(d0, d4, d1).endVertex(); + worldrenderer.pos(d0, d4, d2).endVertex(); + worldrenderer.pos(d0, d5, d2).endVertex(); + worldrenderer.pos(d0, d5, d2).endVertex(); + worldrenderer.pos(d0, d4, d2).endVertex(); + worldrenderer.pos(d1, d4, d3).endVertex(); + worldrenderer.pos(d1, d5, d3).endVertex(); + worldrenderer.pos(d1, d5, d3).endVertex(); + worldrenderer.pos(d1, d4, d3).endVertex(); + worldrenderer.pos(d2, d4, d3).endVertex(); + worldrenderer.pos(d2, d5, d3).endVertex(); + Tessellator.getInstance().draw(); + } + + public static void preSkyList() + { + setUpPosition(); + GL11.glColor3f(fogColorR, fogColorG, fogColorB); + drawHorizon(); + GL11.glColor3f(skyColorR, skyColorG, skyColorB); + } + + public static void endSky() + { + isRenderingSky = false; + setDrawBuffers(dfbDrawBuffers); + useProgram(lightmapEnabled ? 3 : 2); + popEntity(); + } + + public static void beginUpdateChunks() + { + checkGLError("beginUpdateChunks1"); + checkFramebufferStatus("beginUpdateChunks1"); + + if (!isShadowPass) + { + useProgram(7); + } + + checkGLError("beginUpdateChunks2"); + checkFramebufferStatus("beginUpdateChunks2"); + } + + public static void endUpdateChunks() + { + checkGLError("endUpdateChunks1"); + checkFramebufferStatus("endUpdateChunks1"); + + if (!isShadowPass) + { + useProgram(7); + } + + checkGLError("endUpdateChunks2"); + checkFramebufferStatus("endUpdateChunks2"); + } + + public static boolean shouldRenderClouds(GameSettings gs) + { + if (!shaderPackLoaded) + { + return true; + } + else + { + checkGLError("shouldRenderClouds"); + return isShadowPass ? configCloudShadow : gs.clouds > 0; + } + } + + public static void beginClouds() + { + fogEnabled = true; + pushEntity(-3, 0); + useProgram(6); + } + + public static void endClouds() + { + disableFog(); + popEntity(); + useProgram(lightmapEnabled ? 3 : 2); + } + + public static void beginEntities() + { + if (isRenderingWorld) + { + useProgram(16); + resetDisplayListModels(); + } + } + + public static void nextEntity(Entity entity) + { + if (isRenderingWorld) + { + useProgram(16); + setEntityId(entity); + } + } + + public static void setEntityId(Entity entity) + { + if (isRenderingWorld && !isShadowPass && uniformEntityId.isDefined()) + { + int i = EntityList.getEntityID(entity); + uniformEntityId.setValue(i); + } + } + + public static void beginSpiderEyes() + { + if (isRenderingWorld && programsID[18] != programsID[0]) + { + useProgram(18); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.0F); + GlStateManager.blendFunc(770, 771); + } + } + + public static void endEntities() + { + if (isRenderingWorld) + { + useProgram(lightmapEnabled ? 3 : 2); + } + } + + public static void setEntityColor(float r, float g, float b, float a) + { + if (isRenderingWorld && !isShadowPass) + { + uniformEntityColor.setValue(r, g, b, a); + } + } + + public static void beginLivingDamage() + { + if (isRenderingWorld) + { + ShadersTex.bindTexture(defaultTexture); + + if (!isShadowPass) + { + setDrawBuffers(drawBuffersColorAtt0); + } + } + } + + public static void endLivingDamage() + { + if (isRenderingWorld && !isShadowPass) + { + setDrawBuffers(programsDrawBuffers[16]); + } + } + + public static void beginBlockEntities() + { + if (isRenderingWorld) + { + checkGLError("beginBlockEntities"); + useProgram(13); + } + } + + public static void nextBlockEntity(TileEntity tileEntity) + { + if (isRenderingWorld) + { + checkGLError("nextBlockEntity"); + useProgram(13); + setBlockEntityId(tileEntity); + } + } + + public static void setBlockEntityId(TileEntity tileEntity) + { + if (isRenderingWorld && !isShadowPass && uniformBlockEntityId.isDefined()) + { + Block block = tileEntity.getBlockType(); + int i = Block.getIdFromBlock(block); + uniformBlockEntityId.setValue(i); + } + } + + public static void endBlockEntities() + { + if (isRenderingWorld) + { + checkGLError("endBlockEntities"); + useProgram(lightmapEnabled ? 3 : 2); + ShadersTex.bindNSTextures(defaultTexture.getMultiTexID()); + } + } + + public static void beginLitParticles() + { + useProgram(3); + } + + public static void beginParticles() + { + useProgram(2); + } + + public static void endParticles() + { + useProgram(3); + } + + public static void readCenterDepth() + { + if (!isShadowPass && centerDepthSmoothEnabled) + { + tempDirectFloatBuffer.clear(); + GL11.glReadPixels(renderWidth / 2, renderHeight / 2, 1, 1, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (FloatBuffer)tempDirectFloatBuffer); + centerDepth = tempDirectFloatBuffer.get(0); + float f = (float)diffSystemTime * 0.01F; + float f1 = (float)Math.exp(Math.log(0.5D) * (double)f / (double)centerDepthSmoothHalflife); + centerDepthSmooth = centerDepthSmooth * f1 + centerDepth * (1.0F - f1); + } + } + + public static void beginWeather() + { + if (!isShadowPass) + { + if (usedDepthBuffers >= 3) + { + GlStateManager.setActiveTexture(33996); + GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, renderWidth, renderHeight); + GlStateManager.setActiveTexture(33984); + } + + GlStateManager.enableDepth(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(770, 771); + GlStateManager.enableAlpha(); + useProgram(20); + } + } + + public static void endWeather() + { + GlStateManager.disableBlend(); + useProgram(3); + } + + public static void preWater() + { + if (usedDepthBuffers >= 2) + { + GlStateManager.setActiveTexture(33995); + checkGLError("pre copy depth"); + GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, renderWidth, renderHeight); + checkGLError("copy depth"); + GlStateManager.setActiveTexture(33984); + } + + ShadersTex.bindNSTextures(defaultTexture.getMultiTexID()); + } + + public static void beginWater() + { + if (isRenderingWorld) + { + if (!isShadowPass) + { + useProgram(12); + GlStateManager.enableBlend(); + GlStateManager.depthMask(true); + } + else + { + GlStateManager.depthMask(true); + } + } + } + + public static void endWater() + { + if (isRenderingWorld) + { + if (isShadowPass) + { + ; + } + + useProgram(lightmapEnabled ? 3 : 2); + } + } + + public static void beginProjectRedHalo() + { + if (isRenderingWorld) + { + useProgram(1); + } + } + + public static void endProjectRedHalo() + { + if (isRenderingWorld) + { + useProgram(3); + } + } + + public static void applyHandDepth() + { + if ((double)configHandDepthMul != 1.0D) + { + GL11.glScaled(1.0D, 1.0D, (double)configHandDepthMul); + } + } + + public static void beginHand() + { + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glPushMatrix(); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glPushMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + useProgram(19); + checkGLError("beginHand"); + checkFramebufferStatus("beginHand"); + } + + public static void endHand() + { + checkGLError("pre endHand"); + checkFramebufferStatus("pre endHand"); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glPopMatrix(); + GlStateManager.blendFunc(770, 771); + checkGLError("endHand"); + } + + public static void beginFPOverlay() + { + GlStateManager.disableLighting(); + GlStateManager.disableBlend(); + } + + public static void endFPOverlay() + { + } + + public static void glEnableWrapper(int cap) + { + GL11.glEnable(cap); + + if (cap == 3553) + { + enableTexture2D(); + } + else if (cap == 2912) + { + enableFog(); + } + } + + public static void glDisableWrapper(int cap) + { + GL11.glDisable(cap); + + if (cap == 3553) + { + disableTexture2D(); + } + else if (cap == 2912) + { + disableFog(); + } + } + + public static void sglEnableT2D(int cap) + { + GL11.glEnable(cap); + enableTexture2D(); + } + + public static void sglDisableT2D(int cap) + { + GL11.glDisable(cap); + disableTexture2D(); + } + + public static void sglEnableFog(int cap) + { + GL11.glEnable(cap); + enableFog(); + } + + public static void sglDisableFog(int cap) + { + GL11.glDisable(cap); + disableFog(); + } + + public static void enableTexture2D() + { + if (isRenderingSky) + { + useProgram(5); + } + else if (activeProgram == 1) + { + useProgram(lightmapEnabled ? 3 : 2); + } + } + + public static void disableTexture2D() + { + if (isRenderingSky) + { + useProgram(4); + } + else if (activeProgram == 2 || activeProgram == 3) + { + useProgram(1); + } + } + + public static void beginLeash() + { + useProgram(1); + } + + public static void endLeash() + { + useProgram(16); + } + + public static void enableFog() + { + fogEnabled = true; + setProgramUniform1i("fogMode", fogMode); + } + + public static void disableFog() + { + fogEnabled = false; + setProgramUniform1i("fogMode", 0); + } + + public static void setFog(int fogMode) + { + GlStateManager.setFog(fogMode); + fogMode = fogMode; + + if (fogEnabled) + { + setProgramUniform1i("fogMode", fogMode); + } + } + + public static void sglFogi(int pname, int param) + { + GL11.glFogi(pname, param); + + if (pname == 2917) + { + fogMode = param; + + if (fogEnabled) + { + setProgramUniform1i("fogMode", fogMode); + } + } + } + + public static void enableLightmap() + { + lightmapEnabled = true; + + if (activeProgram == 2) + { + useProgram(3); + } + } + + public static void disableLightmap() + { + lightmapEnabled = false; + + if (activeProgram == 3) + { + useProgram(2); + } + } + + public static int getEntityData() + { + return entityData[entityDataIndex * 2]; + } + + public static int getEntityData2() + { + return entityData[entityDataIndex * 2 + 1]; + } + + public static int setEntityData1(int data1) + { + entityData[entityDataIndex * 2] = entityData[entityDataIndex * 2] & 65535 | data1 << 16; + return data1; + } + + public static int setEntityData2(int data2) + { + entityData[entityDataIndex * 2 + 1] = entityData[entityDataIndex * 2 + 1] & -65536 | data2 & 65535; + return data2; + } + + public static void pushEntity(int data0, int data1) + { + ++entityDataIndex; + entityData[entityDataIndex * 2] = data0 & 65535 | data1 << 16; + entityData[entityDataIndex * 2 + 1] = 0; + } + + public static void pushEntity(int data0) + { + ++entityDataIndex; + entityData[entityDataIndex * 2] = data0 & 65535; + entityData[entityDataIndex * 2 + 1] = 0; + } + + public static void pushEntity(Block block) + { + ++entityDataIndex; + entityData[entityDataIndex * 2] = Block.blockRegistry.getIDForObject(block) & 65535 | block.getRenderType() << 16; + entityData[entityDataIndex * 2 + 1] = 0; + } + + public static void popEntity() + { + entityData[entityDataIndex * 2] = 0; + entityData[entityDataIndex * 2 + 1] = 0; + --entityDataIndex; + } + + public static void mcProfilerEndSection() + { + mc.mcProfiler.endSection(); + } + + public static String getShaderPackName() + { + return shaderPack == null ? null : (shaderPack instanceof ShaderPackNone ? null : shaderPack.getName()); + } + + public static InputStream getShaderPackResourceStream(String path) + { + return shaderPack == null ? null : shaderPack.getResourceAsStream(path); + } + + public static void nextAntialiasingLevel() + { + configAntialiasingLevel += 2; + configAntialiasingLevel = configAntialiasingLevel / 2 * 2; + + if (configAntialiasingLevel > 4) + { + configAntialiasingLevel = 0; + } + + configAntialiasingLevel = Config.limit(configAntialiasingLevel, 0, 4); + } + + public static void checkShadersModInstalled() + { + try + { + Class oclass = Class.forName("shadersmod.transform.SMCClassTransformer"); + } + catch (Throwable var1) + { + return; + } + + throw new RuntimeException("Shaders Mod detected. Please remove it, OptiFine has built-in support for shaders."); + } + + public static void resourcesReloaded() + { + loadShaderPackResources(); + } + + private static void loadShaderPackResources() + { + shaderPackResources = new HashMap(); + + if (shaderPackLoaded) + { + List list = new ArrayList(); + String s = "/shaders/lang/"; + String s1 = "en_US"; + String s2 = ".lang"; + list.add(s + s1 + s2); + + if (!Config.getGameSettings().language.equals(s1)) + { + list.add(s + Config.getGameSettings().language + s2); + } + + try + { + for (String s3 : list) + { + InputStream inputstream = shaderPack.getResourceAsStream(s3); + + if (inputstream != null) + { + Properties properties = new Properties(); + Lang.loadLocaleData(inputstream, properties); + inputstream.close(); + + for (Object s4 : properties.keySet()) + { + String s5 = properties.getProperty((String) s4); + shaderPackResources.put((String) s4, s5); + } + } + } + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + } + + public static String translate(String key, String def) + { + String s = (String)shaderPackResources.get(key); + return s == null ? def : s; + } + + public static boolean isProgramPath(String program) + { + if (program == null) + { + return false; + } + else if (program.length() <= 0) + { + return false; + } + else + { + int i = program.lastIndexOf("/"); + + if (i >= 0) + { + program = program.substring(i + 1); + } + + return Arrays.asList(programNames).contains(program); + } + } + + public static void setItemToRenderMain(ItemStack itemToRenderMain) + { + itemToRenderMainTranslucent = isTranslucentBlock(itemToRenderMain); + } + + public static boolean isItemToRenderMainTranslucent() + { + return itemToRenderMainTranslucent; + } + + private static boolean isTranslucentBlock(ItemStack stack) + { + if (stack == null) + { + return false; + } + else + { + Item item = stack.getItem(); + + if (item == null) + { + return false; + } + else if (!(item instanceof ItemBlock)) + { + return false; + } + else + { + ItemBlock itemblock = (ItemBlock)item; + Block block = itemblock.getBlock(); + + if (block == null) + { + return false; + } + else + { + EnumWorldBlockLayer enumworldblocklayer = block.getBlockLayer(); + return enumworldblocklayer == EnumWorldBlockLayer.TRANSLUCENT; + } + } + } + } + + public static boolean isRenderBothHands() + { + return false; + } + + public static boolean isHandRenderedMain() + { + return isHandRenderedMain; + } + + public static void setHandRenderedMain(boolean isHandRenderedMain) + { + isHandRenderedMain = isHandRenderedMain; + } + + public static float getShadowRenderDistance() + { + return shadowDistanceRenderMul < 0.0F ? -1.0F : shadowMapHalfPlane * shadowDistanceRenderMul; + } + + static + { + shadersdir = new File(Minecraft.getMinecraft().mcDataDir, "shaders"); + shaderpacksdir = new File(Minecraft.getMinecraft().mcDataDir, shaderpacksdirname); + configFile = new File(Minecraft.getMinecraft().mcDataDir, optionsfilename); + drawBuffersNone.limit(0); + drawBuffersColorAtt0.put(36064).position(0).limit(1); + } +} diff --git a/src/minecraft/shadersmod/client/ShadersRender.java b/src/minecraft/shadersmod/client/ShadersRender.java new file mode 100644 index 0000000..4a9aa1f --- /dev/null +++ b/src/minecraft/shadersmod/client/ShadersRender.java @@ -0,0 +1,477 @@ +package shadersmod.client; + +import java.nio.IntBuffer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderGlobal; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.culling.ClippingHelper; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.culling.ICamera; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.Entity; +import net.minecraft.util.EnumWorldBlockLayer; +import optifine.Reflector; + +import org.lwjgl.opengl.EXTFramebufferObject; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL20; +import org.lwjgl.opengl.GL30; + +public class ShadersRender +{ + public static void setFrustrumPosition(Frustum frustrum, double x, double y, double z) + { + frustrum.setPosition(x, y, z); + } + + public static void setupTerrain(RenderGlobal renderGlobal, Entity viewEntity, double partialTicks, ICamera camera, int frameCount, boolean playerSpectator) + { + renderGlobal.setupTerrain(viewEntity, partialTicks, camera, frameCount, playerSpectator); + } + + public static void beginTerrainSolid() + { + if (Shaders.isRenderingWorld) + { + Shaders.fogEnabled = true; + Shaders.useProgram(7); + } + } + + public static void beginTerrainCutoutMipped() + { + if (Shaders.isRenderingWorld) + { + Shaders.useProgram(7); + } + } + + public static void beginTerrainCutout() + { + if (Shaders.isRenderingWorld) + { + Shaders.useProgram(7); + } + } + + public static void endTerrain() + { + if (Shaders.isRenderingWorld) + { + Shaders.useProgram(3); + } + } + + public static void beginTranslucent() + { + if (Shaders.isRenderingWorld) + { + if (Shaders.usedDepthBuffers >= 2) + { + GlStateManager.setActiveTexture(33995); + Shaders.checkGLError("pre copy depth"); + GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, Shaders.renderWidth, Shaders.renderHeight); + Shaders.checkGLError("copy depth"); + GlStateManager.setActiveTexture(33984); + } + + Shaders.useProgram(12); + } + } + + public static void endTranslucent() + { + if (Shaders.isRenderingWorld) + { + Shaders.useProgram(3); + } + } + + public static void renderHand0(EntityRenderer er, float par1, int par2) + { + if (!Shaders.isShadowPass) + { + boolean flag = Shaders.isItemToRenderMainTranslucent(); + + if (!flag) + { + Shaders.readCenterDepth(); + Shaders.beginHand(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + er.renderHand(par1, par2, true, false, false); + Shaders.endHand(); + Shaders.setHandRenderedMain(true); + } + } + } + + public static void renderHand1(EntityRenderer er, float par1, int par2) + { + if (!Shaders.isShadowPass && !Shaders.isHandRenderedMain()) + { + Shaders.readCenterDepth(); + GlStateManager.enableBlend(); + Shaders.beginHand(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + er.renderHand(par1, par2, true, false, true); + Shaders.endHand(); + Shaders.setHandRenderedMain(true); + } + } + + public static void renderItemFP(ItemRenderer itemRenderer, float par1, boolean renderTranslucent) + { + GlStateManager.depthMask(true); + + if (renderTranslucent) + { + GlStateManager.depthFunc(519); + GL11.glPushMatrix(); + IntBuffer intbuffer = Shaders.activeDrawBuffers; + Shaders.setDrawBuffers(Shaders.drawBuffersNone); + Shaders.renderItemKeepDepthMask = true; + itemRenderer.renderItemInFirstPerson(par1); + Shaders.renderItemKeepDepthMask = false; + Shaders.setDrawBuffers(intbuffer); + GL11.glPopMatrix(); + } + + GlStateManager.depthFunc(515); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + itemRenderer.renderItemInFirstPerson(par1); + } + + public static void renderFPOverlay(EntityRenderer er, float par1, int par2) + { + if (!Shaders.isShadowPass) + { + Shaders.beginFPOverlay(); + er.renderHand(par1, par2, false, true, false); + Shaders.endFPOverlay(); + } + } + + public static void beginBlockDamage() + { + if (Shaders.isRenderingWorld) + { + Shaders.useProgram(11); + + if (Shaders.programsID[11] == Shaders.programsID[7]) + { + Shaders.setDrawBuffers(Shaders.drawBuffersColorAtt0); + GlStateManager.depthMask(false); + } + } + } + + public static void endBlockDamage() + { + if (Shaders.isRenderingWorld) + { + GlStateManager.depthMask(true); + Shaders.useProgram(3); + } + } + + public static void renderShadowMap(EntityRenderer entityRenderer, int pass, float partialTicks, long finishTimeNano) + { + if (Shaders.usedShadowDepthBuffers > 0 && --Shaders.shadowPassCounter <= 0) + { + Minecraft minecraft = Minecraft.getMinecraft(); + minecraft.mcProfiler.endStartSection("shadow pass"); + RenderGlobal renderglobal = minecraft.renderGlobal; + Shaders.isShadowPass = true; + Shaders.shadowPassCounter = Shaders.shadowPassInterval; + Shaders.preShadowPassThirdPersonView = minecraft.gameSettings.thirdPersonView; + minecraft.gameSettings.thirdPersonView = 1; + Shaders.checkGLError("pre shadow"); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glPushMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glPushMatrix(); + minecraft.mcProfiler.endStartSection("shadow clear"); + EXTFramebufferObject.glBindFramebufferEXT(36160, Shaders.sfb); + Shaders.checkGLError("shadow bind sfb"); + Shaders.useProgram(30); + minecraft.mcProfiler.endStartSection("shadow camera"); + entityRenderer.setupCameraTransform(partialTicks, 2); + Shaders.setCameraShadow(partialTicks); + ActiveRenderInfo.updateRenderInfo(minecraft.thePlayer, minecraft.gameSettings.thirdPersonView == 2); + Shaders.checkGLError("shadow camera"); + GL20.glDrawBuffers(Shaders.sfbDrawBuffers); + Shaders.checkGLError("shadow drawbuffers"); + GL11.glReadBuffer(0); + Shaders.checkGLError("shadow readbuffer"); + EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36096, 3553, Shaders.sfbDepthTextures.get(0), 0); + + if (Shaders.usedShadowColorBuffers != 0) + { + EXTFramebufferObject.glFramebufferTexture2DEXT(36160, 36064, 3553, Shaders.sfbColorTextures.get(0), 0); + } + + Shaders.checkFramebufferStatus("shadow fb"); + GL11.glClearColor(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glClear(Shaders.usedShadowColorBuffers != 0 ? GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT : GL11.GL_DEPTH_BUFFER_BIT); + Shaders.checkGLError("shadow clear"); + minecraft.mcProfiler.endStartSection("shadow frustum"); + ClippingHelper clippinghelper = ClippingHelperShadow.getInstance(); + minecraft.mcProfiler.endStartSection("shadow culling"); + Frustum frustum = new Frustum(clippinghelper); + Entity entity = minecraft.getRenderViewEntity(); + double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; + double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; + double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; + frustum.setPosition(d0, d1, d2); + GlStateManager.shadeModel(7425); + GlStateManager.enableDepth(); + GlStateManager.depthFunc(515); + GlStateManager.depthMask(true); + GlStateManager.colorMask(true, true, true, true); + GlStateManager.disableCull(); + minecraft.mcProfiler.endStartSection("shadow prepareterrain"); + minecraft.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + minecraft.mcProfiler.endStartSection("shadow setupterrain"); + int i = 0; + i = entityRenderer.frameCount; + entityRenderer.frameCount = i + 1; + renderglobal.setupTerrain(entity, (double)partialTicks, frustum, i, minecraft.thePlayer.isSpectator()); + minecraft.mcProfiler.endStartSection("shadow updatechunks"); + minecraft.mcProfiler.endStartSection("shadow terrain"); + GlStateManager.matrixMode(5888); + GlStateManager.pushMatrix(); + GlStateManager.disableAlpha(); + renderglobal.renderBlockLayer(EnumWorldBlockLayer.SOLID, (double)partialTicks, 2, entity); + Shaders.checkGLError("shadow terrain solid"); + GlStateManager.enableAlpha(); + renderglobal.renderBlockLayer(EnumWorldBlockLayer.CUTOUT_MIPPED, (double)partialTicks, 2, entity); + Shaders.checkGLError("shadow terrain cutoutmipped"); + minecraft.getTextureManager().getTexture(TextureMap.locationBlocksTexture).setBlurMipmap(false, false); + renderglobal.renderBlockLayer(EnumWorldBlockLayer.CUTOUT, (double)partialTicks, 2, entity); + Shaders.checkGLError("shadow terrain cutout"); + minecraft.getTextureManager().getTexture(TextureMap.locationBlocksTexture).restoreLastBlurMipmap(); + GlStateManager.shadeModel(7424); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + minecraft.mcProfiler.endStartSection("shadow entities"); + + if (Reflector.ForgeHooksClient_setRenderPass.exists()) + { + Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] {Integer.valueOf(0)}); + } + + renderglobal.renderEntities(entity, frustum, partialTicks); + Shaders.checkGLError("shadow entities"); + GlStateManager.matrixMode(5888); + GlStateManager.popMatrix(); + GlStateManager.depthMask(true); + GlStateManager.disableBlend(); + GlStateManager.enableCull(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.alphaFunc(516, 0.1F); + + if (Shaders.usedShadowDepthBuffers >= 2) + { + GlStateManager.setActiveTexture(33989); + Shaders.checkGLError("pre copy shadow depth"); + GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, Shaders.shadowMapWidth, Shaders.shadowMapHeight); + Shaders.checkGLError("copy shadow depth"); + GlStateManager.setActiveTexture(33984); + } + + GlStateManager.disableBlend(); + GlStateManager.depthMask(true); + minecraft.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + GlStateManager.shadeModel(7425); + Shaders.checkGLError("shadow pre-translucent"); + GL20.glDrawBuffers(Shaders.sfbDrawBuffers); + Shaders.checkGLError("shadow drawbuffers pre-translucent"); + Shaders.checkFramebufferStatus("shadow pre-translucent"); + + if (Shaders.isRenderShadowTranslucent()) + { + minecraft.mcProfiler.endStartSection("shadow translucent"); + renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, 2, entity); + Shaders.checkGLError("shadow translucent"); + } + + if (Reflector.ForgeHooksClient_setRenderPass.exists()) + { + RenderHelper.enableStandardItemLighting(); + Reflector.call(Reflector.ForgeHooksClient_setRenderPass, new Object[] {Integer.valueOf(1)}); + renderglobal.renderEntities(entity, frustum, partialTicks); + Reflector.call(Reflector.ForgeHooksClient_setRenderPass, new Object[] {Integer.valueOf(-1)}); + RenderHelper.disableStandardItemLighting(); + Shaders.checkGLError("shadow entities 1"); + } + + GlStateManager.shadeModel(7424); + GlStateManager.depthMask(true); + GlStateManager.enableCull(); + GlStateManager.disableBlend(); + GL11.glFlush(); + Shaders.checkGLError("shadow flush"); + Shaders.isShadowPass = false; + minecraft.gameSettings.thirdPersonView = Shaders.preShadowPassThirdPersonView; + minecraft.mcProfiler.endStartSection("shadow postprocess"); + + if (Shaders.hasGlGenMipmap) + { + if (Shaders.usedShadowDepthBuffers >= 1) + { + if (Shaders.shadowMipmapEnabled[0]) + { + GlStateManager.setActiveTexture(33988); + GlStateManager.bindTexture(Shaders.sfbDepthTextures.get(0)); + GL30.glGenerateMipmap(3553); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.shadowFilterNearest[0] ? GL11.GL_NEAREST_MIPMAP_NEAREST : GL11.GL_LINEAR_MIPMAP_LINEAR); + } + + if (Shaders.usedShadowDepthBuffers >= 2 && Shaders.shadowMipmapEnabled[1]) + { + GlStateManager.setActiveTexture(33989); + GlStateManager.bindTexture(Shaders.sfbDepthTextures.get(1)); + GL30.glGenerateMipmap(3553); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.shadowFilterNearest[1] ? GL11.GL_NEAREST_MIPMAP_NEAREST : GL11.GL_LINEAR_MIPMAP_LINEAR); + } + + GlStateManager.setActiveTexture(33984); + } + + if (Shaders.usedShadowColorBuffers >= 1) + { + if (Shaders.shadowColorMipmapEnabled[0]) + { + GlStateManager.setActiveTexture(33997); + GlStateManager.bindTexture(Shaders.sfbColorTextures.get(0)); + GL30.glGenerateMipmap(3553); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.shadowColorFilterNearest[0] ? GL11.GL_NEAREST_MIPMAP_NEAREST : GL11.GL_LINEAR_MIPMAP_LINEAR); + } + + if (Shaders.usedShadowColorBuffers >= 2 && Shaders.shadowColorMipmapEnabled[1]) + { + GlStateManager.setActiveTexture(33998); + GlStateManager.bindTexture(Shaders.sfbColorTextures.get(1)); + GL30.glGenerateMipmap(3553); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.shadowColorFilterNearest[1] ? GL11.GL_NEAREST_MIPMAP_NEAREST : GL11.GL_LINEAR_MIPMAP_LINEAR); + } + + GlStateManager.setActiveTexture(33984); + } + } + + Shaders.checkGLError("shadow postprocess"); + EXTFramebufferObject.glBindFramebufferEXT(36160, Shaders.dfb); + GL11.glViewport(0, 0, Shaders.renderWidth, Shaders.renderHeight); + Shaders.activeDrawBuffers = null; + minecraft.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + Shaders.useProgram(7); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + Shaders.checkGLError("shadow end"); + } + } + + public static void preRenderChunkLayer(EnumWorldBlockLayer blockLayerIn) + { + if (Shaders.isRenderBackFace(blockLayerIn)) + { + GlStateManager.disableCull(); + } + + if (OpenGlHelper.useVbo()) + { + GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); + GL20.glEnableVertexAttribArray(Shaders.midTexCoordAttrib); + GL20.glEnableVertexAttribArray(Shaders.tangentAttrib); + GL20.glEnableVertexAttribArray(Shaders.entityAttrib); + } + } + + public static void postRenderChunkLayer(EnumWorldBlockLayer blockLayerIn) + { + if (OpenGlHelper.useVbo()) + { + GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); + GL20.glDisableVertexAttribArray(Shaders.midTexCoordAttrib); + GL20.glDisableVertexAttribArray(Shaders.tangentAttrib); + GL20.glDisableVertexAttribArray(Shaders.entityAttrib); + } + + if (Shaders.isRenderBackFace(blockLayerIn)) + { + GlStateManager.enableCull(); + } + } + + public static void setupArrayPointersVbo() + { + int i = 14; + GL11.glVertexPointer(3, GL11.GL_FLOAT, 56, 0L); + GL11.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 56, 12L); + GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 56, 16L); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glTexCoordPointer(2, GL11.GL_SHORT, 56, 24L); + OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); + GL11.glNormalPointer(GL11.GL_BYTE, 56, 28L); + GL20.glVertexAttribPointer(Shaders.midTexCoordAttrib, 2, GL11.GL_FLOAT, false, 56, 32L); + GL20.glVertexAttribPointer(Shaders.tangentAttrib, 4, GL11.GL_SHORT, false, 56, 40L); + GL20.glVertexAttribPointer(Shaders.entityAttrib, 3, GL11.GL_SHORT, false, 56, 48L); + } + + public static void beaconBeamBegin() + { + Shaders.useProgram(14); + } + + public static void beaconBeamStartQuad1() + { + } + + public static void beaconBeamStartQuad2() + { + } + + public static void beaconBeamDraw1() + { + } + + public static void beaconBeamDraw2() + { + GlStateManager.disableBlend(); + } + + public static void renderEnchantedGlintBegin() + { + Shaders.useProgram(17); + } + + public static void renderEnchantedGlintEnd() + { + if (Shaders.isRenderingWorld) + { + if (Shaders.isRenderBothHands()) + { + Shaders.useProgram(19); + } + else + { + Shaders.useProgram(16); + } + } + else + { + Shaders.useProgram(0); + } + } +} diff --git a/src/minecraft/shadersmod/client/ShadersTex.java b/src/minecraft/shadersmod/client/ShadersTex.java new file mode 100644 index 0000000..6043919 --- /dev/null +++ b/src/minecraft/shadersmod/client/ShadersTex.java @@ -0,0 +1,990 @@ +package shadersmod.client; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.imageio.ImageIO; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.texture.AbstractTexture; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.LayeredTexture; +import net.minecraft.client.renderer.texture.Stitcher; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.util.ResourceLocation; +import optifine.Config; + +import org.lwjgl.BufferUtils; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; +import shadersmod.common.SMCLog; + +public class ShadersTex +{ + public static final int initialBufferSize = 1048576; + public static ByteBuffer byteBuffer = BufferUtils.createByteBuffer(4194304); + public static IntBuffer intBuffer = byteBuffer.asIntBuffer(); + public static int[] intArray = new int[1048576]; + public static final int defBaseTexColor = 0; + public static final int defNormTexColor = -8421377; + public static final int defSpecTexColor = 0; + public static Map multiTexMap = new HashMap(); + public static TextureMap updatingTextureMap = null; + public static TextureAtlasSprite updatingSprite = null; + public static MultiTexID updatingTex = null; + public static MultiTexID boundTex = null; + public static int updatingPage = 0; + public static String iconName = null; + public static IResourceManager resManager = null; + static ResourceLocation resLocation = null; + static int imageSize = 0; + + public static IntBuffer getIntBuffer(int size) + { + if (intBuffer.capacity() < size) + { + int i = roundUpPOT(size); + byteBuffer = BufferUtils.createByteBuffer(i * 4); + intBuffer = byteBuffer.asIntBuffer(); + } + + return intBuffer; + } + + public static int[] getIntArray(int size) + { + if (intArray == null) + { + intArray = new int[1048576]; + } + + if (intArray.length < size) + { + intArray = new int[roundUpPOT(size)]; + } + + return intArray; + } + + public static int roundUpPOT(int x) + { + int i = x - 1; + i = i | i >> 1; + i = i | i >> 2; + i = i | i >> 4; + i = i | i >> 8; + i = i | i >> 16; + return i + 1; + } + + public static int log2(int x) + { + int i = 0; + + if ((x & -65536) != 0) + { + i += 16; + x >>= 16; + } + + if ((x & 65280) != 0) + { + i += 8; + x >>= 8; + } + + if ((x & 240) != 0) + { + i += 4; + x >>= 4; + } + + if ((x & 6) != 0) + { + i += 2; + x >>= 2; + } + + if ((x & 2) != 0) + { + ++i; + } + + return i; + } + + public static IntBuffer fillIntBuffer(int size, int value) + { + int[] aint = getIntArray(size); + IntBuffer intbuffer = getIntBuffer(size); + Arrays.fill((int[])intArray, 0, size, (int)value); + intBuffer.put(intArray, 0, size); + return intBuffer; + } + + public static int[] createAIntImage(int size) + { + int[] aint = new int[size * 3]; + Arrays.fill((int[])aint, 0, size, (int)0); + Arrays.fill(aint, size, size * 2, -8421377); + Arrays.fill((int[])aint, size * 2, size * 3, (int)0); + return aint; + } + + public static int[] createAIntImage(int size, int color) + { + int[] aint = new int[size * 3]; + Arrays.fill((int[])aint, 0, size, (int)color); + Arrays.fill(aint, size, size * 2, -8421377); + Arrays.fill((int[])aint, size * 2, size * 3, (int)0); + return aint; + } + + public static MultiTexID getMultiTexID(AbstractTexture tex) + { + MultiTexID multitexid = tex.multiTex; + + if (multitexid == null) + { + int i = tex.getGlTextureId(); + multitexid = (MultiTexID)multiTexMap.get(Integer.valueOf(i)); + + if (multitexid == null) + { + multitexid = new MultiTexID(i, GL11.glGenTextures(), GL11.glGenTextures()); + multiTexMap.put(Integer.valueOf(i), multitexid); + } + + tex.multiTex = multitexid; + } + + return multitexid; + } + + public static void deleteTextures(AbstractTexture atex, int texid) + { + MultiTexID multitexid = atex.multiTex; + + if (multitexid != null) + { + atex.multiTex = null; + multiTexMap.remove(Integer.valueOf(multitexid.base)); + GlStateManager.deleteTexture(multitexid.norm); + GlStateManager.deleteTexture(multitexid.spec); + + if (multitexid.base != texid) + { + SMCLog.warning("Error : MultiTexID.base mismatch: " + multitexid.base + ", texid: " + texid); + GlStateManager.deleteTexture(multitexid.base); + } + } + } + + public static void bindNSTextures(int normTex, int specTex) + { + if (Shaders.isRenderingWorld && GlStateManager.getActiveTextureUnit() == 33984) + { + GlStateManager.setActiveTexture(33986); + GlStateManager.bindTexture(normTex); + GlStateManager.setActiveTexture(33987); + GlStateManager.bindTexture(specTex); + GlStateManager.setActiveTexture(33984); + } + } + + public static void bindNSTextures(MultiTexID multiTex) + { + bindNSTextures(multiTex.norm, multiTex.spec); + } + + public static void bindTextures(int baseTex, int normTex, int specTex) + { + if (Shaders.isRenderingWorld && GlStateManager.getActiveTextureUnit() == 33984) + { + GlStateManager.setActiveTexture(33986); + GlStateManager.bindTexture(normTex); + GlStateManager.setActiveTexture(33987); + GlStateManager.bindTexture(specTex); + GlStateManager.setActiveTexture(33984); + } + + GlStateManager.bindTexture(baseTex); + } + + public static void bindTextures(MultiTexID multiTex) + { + boundTex = multiTex; + + if (Shaders.isRenderingWorld && GlStateManager.getActiveTextureUnit() == 33984) + { + if (Shaders.configNormalMap) + { + GlStateManager.setActiveTexture(33986); + GlStateManager.bindTexture(multiTex.norm); + } + + if (Shaders.configSpecularMap) + { + GlStateManager.setActiveTexture(33987); + GlStateManager.bindTexture(multiTex.spec); + } + + GlStateManager.setActiveTexture(33984); + } + + GlStateManager.bindTexture(multiTex.base); + } + + public static void bindTexture(ITextureObject tex) + { + int i = tex.getGlTextureId(); + + if (tex instanceof TextureMap) + { + Shaders.atlasSizeX = ((TextureMap)tex).atlasWidth; + Shaders.atlasSizeY = ((TextureMap)tex).atlasHeight; + bindTextures(tex.getMultiTexID()); + } + else + { + Shaders.atlasSizeX = 0; + Shaders.atlasSizeY = 0; + bindTextures(tex.getMultiTexID()); + } + } + + public static void bindTextureMapForUpdateAndRender(TextureManager tm, ResourceLocation resLoc) + { + TextureMap texturemap = (TextureMap)tm.getTexture(resLoc); + Shaders.atlasSizeX = texturemap.atlasWidth; + Shaders.atlasSizeY = texturemap.atlasHeight; + bindTextures(updatingTex = texturemap.getMultiTexID()); + } + + public static void bindTextures(int baseTex) + { + MultiTexID multitexid = (MultiTexID)multiTexMap.get(Integer.valueOf(baseTex)); + bindTextures(multitexid); + } + + public static void initDynamicTexture(int texID, int width, int height, DynamicTexture tex) + { + MultiTexID multitexid = tex.getMultiTexID(); + int[] aint = tex.getTextureData(); + int i = width * height; + Arrays.fill(aint, i, i * 2, -8421377); + Arrays.fill((int[])aint, i * 2, i * 3, (int)0); + TextureUtil.allocateTexture(multitexid.base, width, height); + TextureUtil.setTextureBlurMipmap(false, false); + TextureUtil.setTextureClamped(false); + TextureUtil.allocateTexture(multitexid.norm, width, height); + TextureUtil.setTextureBlurMipmap(false, false); + TextureUtil.setTextureClamped(false); + TextureUtil.allocateTexture(multitexid.spec, width, height); + TextureUtil.setTextureBlurMipmap(false, false); + TextureUtil.setTextureClamped(false); + GlStateManager.bindTexture(multitexid.base); + } + + public static void updateDynamicTexture(int texID, int[] src, int width, int height, DynamicTexture tex) + { + MultiTexID multitexid = tex.getMultiTexID(); + GlStateManager.bindTexture(multitexid.base); + updateDynTexSubImage1(src, width, height, 0, 0, 0); + GlStateManager.bindTexture(multitexid.norm); + updateDynTexSubImage1(src, width, height, 0, 0, 1); + GlStateManager.bindTexture(multitexid.spec); + updateDynTexSubImage1(src, width, height, 0, 0, 2); + GlStateManager.bindTexture(multitexid.base); + } + + public static void updateDynTexSubImage1(int[] src, int width, int height, int posX, int posY, int page) + { + int i = width * height; + IntBuffer intbuffer = getIntBuffer(i); + intbuffer.clear(); + int j = page * i; + + if (src.length >= j + i) + { + intbuffer.put(src, j, i).position(0).limit(i); + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, posX, posY, width, height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer); + intbuffer.clear(); + } + } + + public static ITextureObject createDefaultTexture() + { + DynamicTexture dynamictexture = new DynamicTexture(1, 1); + dynamictexture.getTextureData()[0] = -1; + dynamictexture.updateDynamicTexture(); + return dynamictexture; + } + + public static void allocateTextureMap(int texID, int mipmapLevels, int width, int height, Stitcher stitcher, TextureMap tex) + { + SMCLog.info("allocateTextureMap " + mipmapLevels + " " + width + " " + height + " "); + updatingTextureMap = tex; + tex.atlasWidth = width; + tex.atlasHeight = height; + MultiTexID multitexid = getMultiTexID(tex); + updatingTex = multitexid; + TextureUtil.allocateTextureImpl(multitexid.base, mipmapLevels, width, height); + + if (Shaders.configNormalMap) + { + TextureUtil.allocateTextureImpl(multitexid.norm, mipmapLevels, width, height); + } + + if (Shaders.configSpecularMap) + { + TextureUtil.allocateTextureImpl(multitexid.spec, mipmapLevels, width, height); + } + + GlStateManager.bindTexture(texID); + } + + public static TextureAtlasSprite setSprite(TextureAtlasSprite tas) + { + updatingSprite = tas; + return tas; + } + + public static String setIconName(String name) + { + iconName = name; + return name; + } + + public static void uploadTexSubForLoadAtlas(int[][] data, int width, int height, int xoffset, int yoffset, boolean linear, boolean clamp) + { + TextureUtil.uploadTextureMipmap(data, width, height, xoffset, yoffset, linear, clamp); + boolean flag = false; + + if (Shaders.configNormalMap) + { + int[][] aint = readImageAndMipmaps(iconName + "_n", width, height, data.length, flag, -8421377); + GlStateManager.bindTexture(updatingTex.norm); + TextureUtil.uploadTextureMipmap(aint, width, height, xoffset, yoffset, linear, clamp); + } + + if (Shaders.configSpecularMap) + { + int[][] aint1 = readImageAndMipmaps(iconName + "_s", width, height, data.length, flag, 0); + GlStateManager.bindTexture(updatingTex.spec); + TextureUtil.uploadTextureMipmap(aint1, width, height, xoffset, yoffset, linear, clamp); + } + + GlStateManager.bindTexture(updatingTex.base); + } + + public static int[][] readImageAndMipmaps(String name, int width, int height, int numLevels, boolean border, int defColor) + { + int[][] aint = new int[numLevels][]; + int[] aint1; + aint[0] = aint1 = new int[width * height]; + boolean flag = false; + BufferedImage bufferedimage = readImage(updatingTextureMap.completeResourceLocation(new ResourceLocation(name), 0)); + + if (bufferedimage != null) + { + int i = bufferedimage.getWidth(); + int j = bufferedimage.getHeight(); + + if (i + (border ? 16 : 0) == width) + { + flag = true; + bufferedimage.getRGB(0, 0, i, i, aint1, 0, i); + } + } + + if (!flag) + { + Arrays.fill(aint1, defColor); + } + + GlStateManager.bindTexture(updatingTex.spec); + aint = genMipmapsSimple(aint.length - 1, width, aint); + return aint; + } + + public static BufferedImage readImage(ResourceLocation resLoc) + { + try + { + if (!Config.hasResource(resLoc)) + { + return null; + } + else + { + InputStream inputstream = Config.getResourceStream(resLoc); + + if (inputstream == null) + { + return null; + } + else + { + BufferedImage bufferedimage = ImageIO.read(inputstream); + inputstream.close(); + return bufferedimage; + } + } + } + catch (IOException var3) + { + return null; + } + } + + public static int[][] genMipmapsSimple(int maxLevel, int width, int[][] data) + { + for (int i = 1; i <= maxLevel; ++i) + { + if (data[i] == null) + { + int j = width >> i; + int k = j * 2; + int[] aint = data[i - 1]; + int[] aint1 = data[i] = new int[j * j]; + + for (int i1 = 0; i1 < j; ++i1) + { + for (int l = 0; l < j; ++l) + { + int j1 = i1 * 2 * k + l * 2; + aint1[i1 * j + l] = blend4Simple(aint[j1], aint[j1 + 1], aint[j1 + k], aint[j1 + k + 1]); + } + } + } + } + + return data; + } + + public static void uploadTexSub(int[][] data, int width, int height, int xoffset, int yoffset, boolean linear, boolean clamp) + { + TextureUtil.uploadTextureMipmap(data, width, height, xoffset, yoffset, linear, clamp); + + if (Shaders.configNormalMap || Shaders.configSpecularMap) + { + if (Shaders.configNormalMap) + { + GlStateManager.bindTexture(updatingTex.norm); + uploadTexSub1(data, width, height, xoffset, yoffset, 1); + } + + if (Shaders.configSpecularMap) + { + GlStateManager.bindTexture(updatingTex.spec); + uploadTexSub1(data, width, height, xoffset, yoffset, 2); + } + + GlStateManager.bindTexture(updatingTex.base); + } + } + + public static void uploadTexSub1(int[][] src, int width, int height, int posX, int posY, int page) + { + int i = width * height; + IntBuffer intbuffer = getIntBuffer(i); + int j = src.length; + int k = 0; + int l = width; + int i1 = height; + int j1 = posX; + + for (int k1 = posY; l > 0 && i1 > 0 && k < j; ++k) + { + int l1 = l * i1; + int[] aint = src[k]; + intbuffer.clear(); + + if (aint.length >= l1 * (page + 1)) + { + intbuffer.put(aint, l1 * page, l1).position(0).limit(l1); + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, k, j1, k1, l, i1, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer); + } + + l >>= 1; + i1 >>= 1; + j1 >>= 1; + k1 >>= 1; + } + + intbuffer.clear(); + } + + public static int blend4Alpha(int c0, int c1, int c2, int c3) + { + int i = c0 >>> 24 & 255; + int j = c1 >>> 24 & 255; + int k = c2 >>> 24 & 255; + int l = c3 >>> 24 & 255; + int i1 = i + j + k + l; + int j1 = (i1 + 2) / 4; + int k1; + + if (i1 != 0) + { + k1 = i1; + } + else + { + k1 = 4; + i = 1; + j = 1; + k = 1; + l = 1; + } + + int l1 = (k1 + 1) / 2; + int i2 = j1 << 24 | ((c0 >>> 16 & 255) * i + (c1 >>> 16 & 255) * j + (c2 >>> 16 & 255) * k + (c3 >>> 16 & 255) * l + l1) / k1 << 16 | ((c0 >>> 8 & 255) * i + (c1 >>> 8 & 255) * j + (c2 >>> 8 & 255) * k + (c3 >>> 8 & 255) * l + l1) / k1 << 8 | ((c0 >>> 0 & 255) * i + (c1 >>> 0 & 255) * j + (c2 >>> 0 & 255) * k + (c3 >>> 0 & 255) * l + l1) / k1 << 0; + return i2; + } + + public static int blend4Simple(int c0, int c1, int c2, int c3) + { + int i = ((c0 >>> 24 & 255) + (c1 >>> 24 & 255) + (c2 >>> 24 & 255) + (c3 >>> 24 & 255) + 2) / 4 << 24 | ((c0 >>> 16 & 255) + (c1 >>> 16 & 255) + (c2 >>> 16 & 255) + (c3 >>> 16 & 255) + 2) / 4 << 16 | ((c0 >>> 8 & 255) + (c1 >>> 8 & 255) + (c2 >>> 8 & 255) + (c3 >>> 8 & 255) + 2) / 4 << 8 | ((c0 >>> 0 & 255) + (c1 >>> 0 & 255) + (c2 >>> 0 & 255) + (c3 >>> 0 & 255) + 2) / 4 << 0; + return i; + } + + public static void genMipmapAlpha(int[] aint, int offset, int width, int height) + { + Math.min(width, height); + int o2 = offset; + int w2 = width; + int h2 = height; + int o1 = 0; + int w1 = 0; + int h1 = 0; + int i; + + for (i = 0; w2 > 1 && h2 > 1; o2 = o1) + { + o1 = o2 + w2 * h2; + w1 = w2 / 2; + h1 = h2 / 2; + + for (int l1 = 0; l1 < h1; ++l1) + { + int i2 = o1 + l1 * w1; + int j2 = o2 + l1 * 2 * w2; + + for (int k2 = 0; k2 < w1; ++k2) + { + aint[i2 + k2] = blend4Alpha(aint[j2 + k2 * 2], aint[j2 + k2 * 2 + 1], aint[j2 + w2 + k2 * 2], aint[j2 + w2 + k2 * 2 + 1]); + } + } + + ++i; + w2 = w1; + h2 = h1; + } + + while (i > 0) + { + --i; + w2 = width >> i; + h2 = height >> i; + o2 = o1 - w2 * h2; + int l2 = o2; + + for (int i3 = 0; i3 < h2; ++i3) + { + for (int j3 = 0; j3 < w2; ++j3) + { + if (aint[l2] == 0) + { + aint[l2] = aint[o1 + i3 / 2 * w1 + j3 / 2] & 16777215; + } + + ++l2; + } + } + + o1 = o2; + w1 = w2; + } + } + + public static void genMipmapSimple(int[] aint, int offset, int width, int height) + { + Math.min(width, height); + int o2 = offset; + int w2 = width; + int h2 = height; + int o1 = 0; + int w1 = 0; + int h1 = 0; + int i; + + for (i = 0; w2 > 1 && h2 > 1; o2 = o1) + { + o1 = o2 + w2 * h2; + w1 = w2 / 2; + h1 = h2 / 2; + + for (int l1 = 0; l1 < h1; ++l1) + { + int i2 = o1 + l1 * w1; + int j2 = o2 + l1 * 2 * w2; + + for (int k2 = 0; k2 < w1; ++k2) + { + aint[i2 + k2] = blend4Simple(aint[j2 + k2 * 2], aint[j2 + k2 * 2 + 1], aint[j2 + w2 + k2 * 2], aint[j2 + w2 + k2 * 2 + 1]); + } + } + + ++i; + w2 = w1; + h2 = h1; + } + + while (i > 0) + { + --i; + w2 = width >> i; + h2 = height >> i; + o2 = o1 - w2 * h2; + int l2 = o2; + + for (int i3 = 0; i3 < h2; ++i3) + { + for (int j3 = 0; j3 < w2; ++j3) + { + if (aint[l2] == 0) + { + aint[l2] = aint[o1 + i3 / 2 * w1 + j3 / 2] & 16777215; + } + + ++l2; + } + } + + o1 = o2; + w1 = w2; + } + } + + public static boolean isSemiTransparent(int[] aint, int width, int height) + { + int i = width * height; + + if (aint[0] >>> 24 == 255 && aint[i - 1] == 0) + { + return true; + } + else + { + for (int j = 0; j < i; ++j) + { + int k = aint[j] >>> 24; + + if (k != 0 && k != 255) + { + return true; + } + } + + return false; + } + } + + public static void updateSubTex1(int[] src, int width, int height, int posX, int posY) + { + int i = 0; + int j = width; + int k = height; + int l = posX; + + for (int i1 = posY; j > 0 && k > 0; i1 /= 2) + { + GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, i, l, i1, 0, 0, j, k); + ++i; + j /= 2; + k /= 2; + l /= 2; + } + } + + public static void setupTexture(MultiTexID multiTex, int[] src, int width, int height, boolean linear, boolean clamp) + { + int i = linear ? 9729 : 9728; + int j = clamp ? 10496 : 10497; + int k = width * height; + IntBuffer intbuffer = getIntBuffer(k); + intbuffer.clear(); + intbuffer.put(src, 0, k).position(0).limit(k); + GlStateManager.bindTexture(multiTex.base); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, i); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, i); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, j); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, j); + intbuffer.put(src, k, k).position(0).limit(k); + GlStateManager.bindTexture(multiTex.norm); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, i); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, i); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, j); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, j); + intbuffer.put(src, k * 2, k).position(0).limit(k); + GlStateManager.bindTexture(multiTex.spec); + GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, i); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, i); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, j); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, j); + GlStateManager.bindTexture(multiTex.base); + } + + public static void updateSubImage(MultiTexID multiTex, int[] src, int width, int height, int posX, int posY, boolean linear, boolean clamp) + { + int i = width * height; + IntBuffer intbuffer = getIntBuffer(i); + intbuffer.clear(); + intbuffer.put(src, 0, i); + intbuffer.position(0).limit(i); + GlStateManager.bindTexture(multiTex.base); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, posX, posY, width, height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer); + + if (src.length == i * 3) + { + intbuffer.clear(); + intbuffer.put(src, i, i).position(0); + intbuffer.position(0).limit(i); + } + + GlStateManager.bindTexture(multiTex.norm); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, posX, posY, width, height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer); + + if (src.length == i * 3) + { + intbuffer.clear(); + intbuffer.put(src, i * 2, i); + intbuffer.position(0).limit(i); + } + + GlStateManager.bindTexture(multiTex.spec); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, posX, posY, width, height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)intbuffer); + GlStateManager.setActiveTexture(33984); + } + + public static ResourceLocation getNSMapLocation(ResourceLocation location, String mapName) + { + String s = location.getResourcePath(); + String[] astring = s.split(".png"); + String s1 = astring[0]; + return new ResourceLocation(location.getResourceDomain(), s1 + "_" + mapName + ".png"); + } + + public static void loadNSMap(IResourceManager manager, ResourceLocation location, int width, int height, int[] aint) + { + if (Shaders.configNormalMap) + { + loadNSMap1(manager, getNSMapLocation(location, "n"), width, height, aint, width * height, -8421377); + } + + if (Shaders.configSpecularMap) + { + loadNSMap1(manager, getNSMapLocation(location, "s"), width, height, aint, width * height * 2, 0); + } + } + + public static void loadNSMap1(IResourceManager manager, ResourceLocation location, int width, int height, int[] aint, int offset, int defaultColor) + { + boolean flag = false; + + try + { + IResource iresource = manager.getResource(location); + BufferedImage bufferedimage = ImageIO.read(iresource.getInputStream()); + + if (bufferedimage != null && bufferedimage.getWidth() == width && bufferedimage.getHeight() == height) + { + bufferedimage.getRGB(0, 0, width, height, aint, offset, width); + flag = true; + } + } + catch (IOException var10) + { + ; + } + + if (!flag) + { + Arrays.fill(aint, offset, offset + width * height, defaultColor); + } + } + + public static int loadSimpleTexture(int textureID, BufferedImage bufferedimage, boolean linear, boolean clamp, IResourceManager resourceManager, ResourceLocation location, MultiTexID multiTex) + { + int i = bufferedimage.getWidth(); + int j = bufferedimage.getHeight(); + int k = i * j; + int[] aint = getIntArray(k * 3); + bufferedimage.getRGB(0, 0, i, j, aint, 0, i); + loadNSMap(resourceManager, location, i, j, aint); + setupTexture(multiTex, aint, i, j, linear, clamp); + return textureID; + } + + public static void mergeImage(int[] aint, int dstoff, int srcoff, int size) + { + } + + public static int blendColor(int color1, int color2, int factor1) + { + int i = 255 - factor1; + return ((color1 >>> 24 & 255) * factor1 + (color2 >>> 24 & 255) * i) / 255 << 24 | ((color1 >>> 16 & 255) * factor1 + (color2 >>> 16 & 255) * i) / 255 << 16 | ((color1 >>> 8 & 255) * factor1 + (color2 >>> 8 & 255) * i) / 255 << 8 | ((color1 >>> 0 & 255) * factor1 + (color2 >>> 0 & 255) * i) / 255 << 0; + } + + public static void loadLayeredTexture(LayeredTexture tex, IResourceManager manager, List list) + { + int i = 0; + int j = 0; + int k = 0; + int[] aint = null; + + for (Object s : list) + { + if (s != null) + { + try + { + ResourceLocation resourcelocation = new ResourceLocation((String) s); + InputStream inputstream = manager.getResource(resourcelocation).getInputStream(); + BufferedImage bufferedimage = ImageIO.read(inputstream); + + if (k == 0) + { + i = bufferedimage.getWidth(); + j = bufferedimage.getHeight(); + k = i * j; + aint = createAIntImage(k, 0); + } + + int[] aint1 = getIntArray(k * 3); + bufferedimage.getRGB(0, 0, i, j, aint1, 0, i); + loadNSMap(manager, resourcelocation, i, j, aint1); + + for (int l = 0; l < k; ++l) + { + int i1 = aint1[l] >>> 24 & 255; + aint[k * 0 + l] = blendColor(aint1[k * 0 + l], aint[k * 0 + l], i1); + aint[k * 1 + l] = blendColor(aint1[k * 1 + l], aint[k * 1 + l], i1); + aint[k * 2 + l] = blendColor(aint1[k * 2 + l], aint[k * 2 + l], i1); + } + } + catch (IOException ioexception) + { + ioexception.printStackTrace(); + } + } + } + + setupTexture(tex.getMultiTexID(), aint, i, j, false, false); + } + + static void updateTextureMinMagFilter() + { + TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); + ITextureObject itextureobject = texturemanager.getTexture(TextureMap.locationBlocksTexture); + + if (itextureobject != null) + { + MultiTexID multitexid = itextureobject.getMultiTexID(); + GlStateManager.bindTexture(multitexid.base); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilB]); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilB]); + GlStateManager.bindTexture(multitexid.norm); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilN]); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilN]); + GlStateManager.bindTexture(multitexid.spec); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, Shaders.texMinFilValue[Shaders.configTexMinFilS]); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, Shaders.texMagFilValue[Shaders.configTexMagFilS]); + GlStateManager.bindTexture(0); + } + } + + public static IResource loadResource(IResourceManager manager, ResourceLocation location) throws IOException + { + resManager = manager; + resLocation = location; + return manager.getResource(location); + } + + public static int[] loadAtlasSprite(BufferedImage bufferedimage, int startX, int startY, int w, int h, int[] aint, int offset, int scansize) + { + imageSize = w * h; + bufferedimage.getRGB(startX, startY, w, h, aint, offset, scansize); + loadNSMap(resManager, resLocation, w, h, aint); + return aint; + } + + public static int[][] getFrameTexData(int[][] src, int width, int height, int frameIndex) + { + int i = src.length; + int[][] aint = new int[i][]; + + for (int j = 0; j < i; ++j) + { + int[] aint1 = src[j]; + + if (aint1 != null) + { + int k = (width >> j) * (height >> j); + int[] aint2 = new int[k * 3]; + aint[j] = aint2; + int l = aint1.length / 3; + int i1 = k * frameIndex; + int j1 = 0; + System.arraycopy(aint1, i1, aint2, j1, k); + i1 = i1 + l; + j1 = j1 + k; + System.arraycopy(aint1, i1, aint2, j1, k); + i1 = i1 + l; + j1 = j1 + k; + System.arraycopy(aint1, i1, aint2, j1, k); + } + } + + return aint; + } + + public static int[][] prepareAF(TextureAtlasSprite tas, int[][] src, int width, int height) + { + boolean flag = true; + return src; + } + + public static void fixTransparentColor(TextureAtlasSprite tas, int[] aint) + { + } +} diff --git a/src/minecraft/shadersmod/client/ShadowUtils.java b/src/minecraft/shadersmod/client/ShadowUtils.java new file mode 100644 index 0000000..af384ef --- /dev/null +++ b/src/minecraft/shadersmod/client/ShadowUtils.java @@ -0,0 +1,41 @@ +package shadersmod.client; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.renderer.ViewFrustum; +import net.minecraft.client.renderer.chunk.RenderChunk; +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; + +public class ShadowUtils +{ + public static Iterator makeShadowChunkIterator(WorldClient world, double partialTicks, Entity viewEntity, int renderDistanceChunks, ViewFrustum viewFrustum) + { + float f = Shaders.getShadowRenderDistance(); + + if (f > 0.0F && f < (float)((renderDistanceChunks - 1) * 16)) + { + int i = MathHelper.ceiling_float_int(f / 16.0F) + 1; + float f6 = world.getCelestialAngleRadians((float)partialTicks); + float f1 = Shaders.sunPathRotation * 0.017453292F; + float f2 = f6 > ((float)Math.PI / 2F) && f6 < ((float)Math.PI * 3F / 2F) ? f6 + (float)Math.PI : f6; + float f3 = -MathHelper.sin(f2); + float f4 = MathHelper.cos(f2) * MathHelper.cos(f1); + float f5 = -MathHelper.cos(f2) * MathHelper.sin(f1); + BlockPos blockpos = new BlockPos(MathHelper.floor_double(viewEntity.posX) >> 4, MathHelper.floor_double(viewEntity.posY) >> 4, MathHelper.floor_double(viewEntity.posZ) >> 4); + BlockPos blockpos1 = blockpos.add((double)(-f3 * (float)i), (double)(-f4 * (float)i), (double)(-f5 * (float)i)); + BlockPos blockpos2 = blockpos.add((double)(f3 * (float)renderDistanceChunks), (double)(f4 * (float)renderDistanceChunks), (double)(f5 * (float)renderDistanceChunks)); + IteratorRenderChunks iteratorrenderchunks = new IteratorRenderChunks(viewFrustum, blockpos1, blockpos2, i, i); + return iteratorrenderchunks; + } + else + { + List list = Arrays.asList(viewFrustum.renderChunks); + Iterator iterator = list.iterator(); + return iterator; + } + } +} diff --git a/src/minecraft/shadersmod/client/SimpleShaderTexture.java b/src/minecraft/shadersmod/client/SimpleShaderTexture.java new file mode 100644 index 0000000..659a70e --- /dev/null +++ b/src/minecraft/shadersmod/client/SimpleShaderTexture.java @@ -0,0 +1,118 @@ +package shadersmod.client; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import java.awt.image.BufferedImage; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.ArrayList; +import net.minecraft.client.renderer.texture.AbstractTexture; +import net.minecraft.client.renderer.texture.TextureUtil; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.data.AnimationMetadataSection; +import net.minecraft.client.resources.data.AnimationMetadataSectionSerializer; +import net.minecraft.client.resources.data.FontMetadataSection; +import net.minecraft.client.resources.data.FontMetadataSectionSerializer; +import net.minecraft.client.resources.data.IMetadataSerializer; +import net.minecraft.client.resources.data.LanguageMetadataSection; +import net.minecraft.client.resources.data.LanguageMetadataSectionSerializer; +import net.minecraft.client.resources.data.PackMetadataSection; +import net.minecraft.client.resources.data.PackMetadataSectionSerializer; +import net.minecraft.client.resources.data.TextureMetadataSection; +import net.minecraft.client.resources.data.TextureMetadataSectionSerializer; +import org.apache.commons.io.IOUtils; +import shadersmod.common.SMCLog; + +public class SimpleShaderTexture extends AbstractTexture +{ + private String texturePath; + private static final IMetadataSerializer METADATA_SERIALIZER = makeMetadataSerializer(); + + public SimpleShaderTexture(String texturePath) + { + this.texturePath = texturePath; + } + + public void loadTexture(IResourceManager resourceManager) throws IOException + { + this.deleteGlTexture(); + InputStream inputstream = Shaders.getShaderPackResourceStream(this.texturePath); + + if (inputstream == null) + { + throw new FileNotFoundException("Shader texture not found: " + this.texturePath); + } + else + { + try + { + BufferedImage bufferedimage = TextureUtil.readBufferedImage(inputstream); + TextureMetadataSection texturemetadatasection = this.loadTextureMetadataSection(); + TextureUtil.uploadTextureImageAllocate(this.getGlTextureId(), bufferedimage, texturemetadatasection.getTextureBlur(), texturemetadatasection.getTextureClamp()); + } + finally + { + IOUtils.closeQuietly(inputstream); + } + } + } + + private TextureMetadataSection loadTextureMetadataSection() + { + String s = this.texturePath + ".mcmeta"; + String s1 = "texture"; + InputStream inputstream = Shaders.getShaderPackResourceStream(s); + + if (inputstream != null) + { + IMetadataSerializer imetadataserializer = METADATA_SERIALIZER; + BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(inputstream)); + TextureMetadataSection texturemetadatasection1; + + try + { + JsonObject jsonobject = (new JsonParser()).parse((Reader)bufferedreader).getAsJsonObject(); + TextureMetadataSection texturemetadatasection = (TextureMetadataSection)imetadataserializer.parseMetadataSection(s1, jsonobject); + + if (texturemetadatasection == null) + { + return new TextureMetadataSection(false, false, new ArrayList()); + } + + texturemetadatasection1 = texturemetadatasection; + } + catch (RuntimeException runtimeexception) + { + SMCLog.warning("Error reading metadata: " + s); + SMCLog.warning("" + runtimeexception.getClass().getName() + ": " + runtimeexception.getMessage()); + return new TextureMetadataSection(false, false, new ArrayList()); + } + finally + { + IOUtils.closeQuietly((Reader)bufferedreader); + IOUtils.closeQuietly(inputstream); + } + + return texturemetadatasection1; + } + else + { + return new TextureMetadataSection(false, false, new ArrayList()); + } + } + + private static IMetadataSerializer makeMetadataSerializer() + { + IMetadataSerializer imetadataserializer = new IMetadataSerializer(); + imetadataserializer.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class); + imetadataserializer.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class); + imetadataserializer.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class); + imetadataserializer.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class); + imetadataserializer.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class); + return imetadataserializer; + } +} diff --git a/src/minecraft/shadersmod/common/SMCLog.java b/src/minecraft/shadersmod/common/SMCLog.java new file mode 100644 index 0000000..c6b5f7f --- /dev/null +++ b/src/minecraft/shadersmod/common/SMCLog.java @@ -0,0 +1,54 @@ +package shadersmod.common; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public abstract class SMCLog +{ + private static final Logger LOGGER = LogManager.getLogger(); + private static final String PREFIX = "[Shaders] "; + + public static void severe(String message) + { + LOGGER.error("[Shaders] " + message); + } + + public static void warning(String message) + { + LOGGER.warn("[Shaders] " + message); + } + + public static void info(String message) + { + LOGGER.info("[Shaders] " + message); + } + + public static void fine(String message) + { + LOGGER.debug("[Shaders] " + message); + } + + public static void severe(String format, Object... args) + { + String s = String.format(format, args); + LOGGER.error("[Shaders] " + s); + } + + public static void warning(String format, Object... args) + { + String s = String.format(format, args); + LOGGER.warn("[Shaders] " + s); + } + + public static void info(String format, Object... args) + { + String s = String.format(format, args); + LOGGER.info("[Shaders] " + s); + } + + public static void fine(String format, Object... args) + { + String s = String.format(format, args); + LOGGER.debug("[Shaders] " + s); + } +} diff --git a/src/minecraft/shadersmod/common/SMCVersion.java b/src/minecraft/shadersmod/common/SMCVersion.java new file mode 100644 index 0000000..346b454 --- /dev/null +++ b/src/minecraft/shadersmod/common/SMCVersion.java @@ -0,0 +1,9 @@ +package shadersmod.common; + +public class SMCVersion +{ + public static final String mcVersion = "1.8.8"; + public static final String versionString = "2.4.12"; + public static final int versionNumber = 132108; + public static final int buildNumber = 83; +} diff --git a/src/old clickgui2.txt b/src/old clickgui2.txt new file mode 100644 index 0000000..c1d5e7f --- /dev/null +++ b/src/old clickgui2.txt @@ -0,0 +1,417 @@ +package animeware.ui; + +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; + +import org.lwjgl.opengl.GL11; + +import animeware.Animeware; +import animeware.hud.HUDConfigScreen; +import animeware.hud.mod.HudMod; +import animeware.ui.comp.Changelog; +import animeware.ui.comp.ClickGUIButtonDark; +import animeware.ui.comp.CosmeticsCGButton; +import animeware.ui.comp.HomeCGButton; +import animeware.ui.comp.InfoCGButton; +import animeware.ui.comp.ServersCGButton; +import animeware.ui.comp.SettingsCGButton; +import animeware.ui.comp.ToggleableCGButton; +import animeware.ui.comp.WebsiteCGButton; +import animeware.util.font.FontUtil; +import animeware.util.render.ColorMode; +import animeware.util.render.ColorUtils; +import animeware.util.render.DrawUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.server.MinecraftServer; + +public class ClickGUI2 extends GuiScreen{ + /* */ private final GuiScreen field_146598_a; + /* 40 */ private static String Cape = "Cape"; + /* 41 */ private static String Wings = "Wings"; + /* 42 */ private static String ToggleSprint = "Toggle Sprint"; + /* 43 */ private static String Halo = "Halo"; + /* 44 */ private static String FPS = "FPS"; + /* 45 */ private static String Keystrokes = "Keystrokes"; + /* 46 */ private static String Ping = "Ping"; + /* 47 */ private static String ArmorStatus = "Armor Status"; + /* 48 */ private static String Time = "Time"; + /* 49 */ private static String PotionStatus = "Potion Status"; + /* 50 */ private static String ModPosition = "ModPosition"; + /* */ + /* */ private GuiButton field_146596_f; + /* */ + /* */ private GuiButton field_146597_g; + /* */ + /* 56 */ private String field_146599_h = "survival"; + /* */ private boolean field_146600_i; + + public int x, y, w, h; + public HudMod m; + private boolean enabled; + /* */ + /* */ public ClickGUI2(GuiScreen p_i1055_1_) { + /* 60 */ this.field_146598_a = p_i1055_1_; + /* */ } + /* */ public void initGui() { + if (Animeware.TNTTimer) { + this.buttonList.add(new ClickGUIButtonDark(1, this.width / 2 - 51, this.height / 2 - 30, 120, 20, + I18n.format("§4TNTTimer", new Object[0]))); + } else if (!Animeware.TNTTimer) { + this.buttonList.add(new ClickGUIButtonDark(1, this.width / 2 - 51, this.height / 2 - 30, 120, 20, + I18n.format("TNTTimer", new Object[0]))); + } + if (Animeware.BlockOverlayRed) { + this.buttonList.add(new ClickGUIButtonDark(2, this.width / 2 - 51, this.height / 2 - 60, 120, 20, + I18n.format("§4BlockOverlay", new Object[0]))); + } else if (!Animeware.BlockOverlayRed) { + this.buttonList.add(new ClickGUIButtonDark(2, this.width / 2 - 51, this.height / 2 - 60, 120, 20, + I18n.format("BlockOverlay", new Object[0]))); + } + if (Animeware.BlockOverlayPurple) { + this.buttonList.add(new ClickGUIButtonDark(3, this.width / 2 - 51, this.height / 2 - 90, 120, 20, + I18n.format("§4BlockOverlayPurple", new Object[0]))); + } else if (!Animeware.BlockOverlayPurple) { + this.buttonList.add(new ClickGUIButtonDark(3, this.width / 2 - 51, this.height / 2 - 90, 120, 20, + I18n.format("BlockOverlayPurple", new Object[0]))); + } + if (Animeware.BlockOverlayChroma) { + this.buttonList.add(new ClickGUIButtonDark(4, this.width / 2 - 51, this.height / 2 - 120, 120, 20, + I18n.format("§4BlockOverlayChroma", new Object[0]))); + } else if (!Animeware.BlockOverlayChroma) { + this.buttonList.add(new ClickGUIButtonDark(4, this.width / 2 - 51, this.height / 2 - 120, 120, 20, + I18n.format("BlockOverlayChroma", new Object[0]))); + } + if (Animeware.ScrollZoom) { + this.buttonList.add(new ClickGUIButtonDark(5, this.width / 2 - 51, this.height / 2 - 0, 120, 20, + I18n.format("§4ScrollZoom", new Object[0]))); + } else if (!Animeware.ScrollZoom) { + this.buttonList.add(new ClickGUIButtonDark(5, this.width / 2 - 51, this.height / 2 - 0, 120, 20, + I18n.format("ScrollZoom", new Object[0]))); + } + if (Animeware.itemphys) { + this.buttonList.add(new ClickGUIButtonDark(6, this.width / 2 - 51, this.height / 2 + 30, 120, 20, + I18n.format("§4Item Physics", new Object[0]))); + } else if (!Animeware.itemphys) { + this.buttonList.add(new ClickGUIButtonDark(6, this.width / 2 - 51, this.height / 2 + 30, 120, 20, + I18n.format("Item Physics", new Object[0]))); + } + if (Animeware.MoreParticles) { + this.buttonList.add(new ClickGUIButtonDark(7, this.width / 2 - 51, this.height / 2 + 60, 120, 20, + I18n.format("§4More Particles", new Object[0]))); + } else if (!Animeware.MoreParticles) { + this.buttonList.add(new ClickGUIButtonDark(7, this.width / 2 - 51, this.height / 2 + 60, 120, 20, + I18n.format("More Particles", new Object[0]))); + } + if (Animeware.SmallSword) { + this.buttonList.add(new ClickGUIButtonDark(8, this.width / 2 - 51, this.height / 2 + 90, 120, 20, + I18n.format("§4Small Sword", new Object[0]))); + } else if (!Animeware.SmallSword) { + this.buttonList.add(new ClickGUIButtonDark(8, this.width / 2 - 51, this.height / 2 + 90, 120, 20, + I18n.format("Small Sword", new Object[0]))); + } + if (Animeware.SwordSpin) { + this.buttonList.add(new ClickGUIButtonDark(9, this.width / 2 - 51, this.height / 2 + 120, 120, 20, + I18n.format("§4Sword Spin", new Object[0]))); + } else if (!Animeware.SwordSpin) { + this.buttonList.add(new ClickGUIButtonDark(9, this.width / 2 - 51, this.height / 2 + 120, 120, 20, + I18n.format("Sword Spin", new Object[0]))); + } + + this.buttonList.add(new HomeCGButton(100, 262, height / 3 - 50, "")); + this.buttonList.add(new SettingsCGButton(200, 262, height / 3 - 10, "")); + this.buttonList.add(new CosmeticsCGButton(300, 262, height / 3 + 30, "")); + this.buttonList.add(new ToggleableCGButton(400, 262, height / 3 + 70, "")); + this.buttonList.add(new ServersCGButton(500, 262, height / 3 + 110, "")); + this.buttonList.add(new WebsiteCGButton(600, 262, height / 3 + 150, "")); + this.buttonList.add(new InfoCGButton(700, 262, height / 3 + 190, "")); + + /* */ + /* 132 */ //this.buttonList.add(new GuiButton(1022, this.width / 2 - 91, this.height / 2 + 104, 180, 20, + /* 133 */ //I18n.format("", new Object[0]))); + /* */ } + /* */ protected void actionPerformed(GuiButton button) throws IOException { + /* */ boolean flag, flag1; + /* 152 */ switch (button.id) { + /* */ case 1: + /* 198 */ Animeware.TNTTimer = !Animeware.TNTTimer; + /* */ + /* 200 */ if (Animeware.TNTTimer) { + /* 201 */ this.buttonList.set(0, new ClickGUIButtonDark(1, this.width / 2 - 51, this.height / 2 - 30, 120, 20, + /* 202 */ I18n.format("§4TNTTimer", new Object[0]))); + /* 203 */ } else if (!Animeware.TNTTimer) { + /* 204 */ this.buttonList.set(0, new ClickGUIButtonDark(1, this.width / 2 - 51, this.height / 2 - 30, 120, 20, + /* 205 */ I18n.format("TNTTimer", new Object[0]))); + /* */ } + break; + case 2: + Animeware.BlockOverlayRed = !Animeware.BlockOverlayRed; + /* */ + /* 200 */ if (Animeware.BlockOverlayRed) { + /* 201 */ this.buttonList.set(1, new ClickGUIButtonDark(2, this.width / 2 - 51, this.height / 2 - 60, 120, 20, + /* 202 */ I18n.format("§4BlockOverlay", new Object[0]))); + /* 203 */ } else if (!Animeware.BlockOverlayRed) { + /* 204 */ this.buttonList.set(1, new ClickGUIButtonDark(2, this.width / 2 - 51, this.height / 2 - 60, 120, 20, + /* 205 */ I18n.format("BlockOverlay", new Object[0]))); + /* */ } + break; + case 3: + Animeware.BlockOverlayPurple = !Animeware.BlockOverlayPurple; + /* */ + /* 200 */ if (Animeware.BlockOverlayPurple) { + /* 201 */ this.buttonList.set(2, new ClickGUIButtonDark(3, this.width / 2 - 51, this.height / 2 - 90, 120, 20, + /* 202 */ I18n.format("§4BlockOverlayPurple", new Object[0]))); + /* 203 */ } else if (!Animeware.BlockOverlayPurple) { + /* 204 */ this.buttonList.set(2, new ClickGUIButtonDark(3, this.width / 2 - 51, this.height / 2 - 90, 120, 20, + /* 205 */ I18n.format("BlockOverlayPurple", new Object[0]))); + /* */ } + break; + case 4: + Animeware.BlockOverlayChroma = !Animeware.BlockOverlayChroma; + /* */ + /* 200 */ if (Animeware.BlockOverlayChroma) { + /* 201 */ this.buttonList.set(3, new ClickGUIButtonDark(4, this.width / 2 - 51, this.height / 2 - 120, 120, 20, + /* 202 */ I18n.format("§4BlockOverlayChroma", new Object[0]))); + /* 203 */ } else if (!Animeware.BlockOverlayChroma) { + /* 204 */ this.buttonList.set(3, new ClickGUIButtonDark(4, this.width / 2 - 51, this.height / 2 - 120, 120, 20, + /* 205 */ I18n.format("BlockOverlayChroma", new Object[0]))); + /* */ } + break; + case 5: + Animeware.ScrollZoom = !Animeware.ScrollZoom; + /* */ + /* 200 */ if (Animeware.ScrollZoom) { + /* 201 */ this.buttonList.set(4, new ClickGUIButtonDark(5, this.width / 2 - 51, this.height / 2 - 0, 120, 20, + /* 202 */ I18n.format("§4ScrollZoom", new Object[0]))); + /* 203 */ } else if (!Animeware.ScrollZoom) { + /* 204 */ this.buttonList.set(4, new ClickGUIButtonDark(5, this.width / 2 - 51, this.height / 2 - 0, 120, 20, + /* 205 */ I18n.format("ScrollZoom", new Object[0]))); + /* */ } + break; + case 6: + Animeware.itemphys = !Animeware.itemphys; + /* */ + /* 200 */ if (Animeware.itemphys) { + /* 201 */ this.buttonList.set(5, new ClickGUIButtonDark(6, this.width / 2 - 51, this.height / 2 + 30, 120, 20, + /* 202 */ I18n.format("§4Item Physics", new Object[0]))); + /* 203 */ } else if (!Animeware.itemphys) { + /* 204 */ this.buttonList.set(5, new ClickGUIButtonDark(6, this.width / 2 - 51, this.height / 2 + 30, 120, 20, + /* 205 */ I18n.format("Item Physics", new Object[0]))); + /* */ } + break; + case 7: + Animeware.MoreParticles = !Animeware.MoreParticles; + /* */ + /* 200 */ if (Animeware.MoreParticles) { + /* 201 */ this.buttonList.set(6, new ClickGUIButtonDark(7, this.width / 2 - 51, this.height / 2 + 60, 120, 20, + /* 202 */ I18n.format("§4More Particles", new Object[0]))); + /* 203 */ } else if (!Animeware.MoreParticles) { + /* 204 */ this.buttonList.set(6, new ClickGUIButtonDark(7, this.width / 2 - 51, this.height / 2 + 60, 120, 20, + /* 205 */ I18n.format("More Particles", new Object[0]))); + /* */ } + break; + case 8: + Animeware.SmallSword = !Animeware.SmallSword; + /* */ + /* 200 */ if (Animeware.SmallSword) { + /* 201 */ this.buttonList.set(7, new ClickGUIButtonDark(8, this.width / 2 - 51, this.height / 2 + 90, 120, 20, + /* 202 */ I18n.format("§4Small Sword", new Object[0]))); + /* 203 */ } else if (!Animeware.SmallSword) { + /* 204 */ this.buttonList.set(7, new ClickGUIButtonDark(8, this.width / 2 - 51, this.height / 2 + 90, 120, 20, + /* 205 */ I18n.format("Small Sword", new Object[0]))); + /* */ } + break; + case 9: + Animeware.SwordSpin = !Animeware.SwordSpin; + /* */ + /* 200 */ if (Animeware.SwordSpin) { + /* 201 */ this.buttonList.set(8, new ClickGUIButtonDark(9, this.width / 2 - 51, this.height / 2 + 120, 120, 20, + /* 202 */ I18n.format("§4Sword Spin", new Object[0]))); + /* 203 */ } else if (!Animeware.SwordSpin) { + /* 204 */ this.buttonList.set(8, new ClickGUIButtonDark(9, this.width / 2 - 51, this.height / 2 + 120, 120, 20, + /* 205 */ I18n.format("Sword Spin", new Object[0]))); + /* */ } + break; + case 100: + mc.displayGuiScreen(new ClickGUI()); + break; + case 200: + mc.displayGuiScreen(new HUDConfigScreen()); + break; + case 300: + mc.displayGuiScreen(new CosmeticGUI(null)); + break; + case 400: + mc.displayGuiScreen(new ClickGUI2(null)); + break; + case 500: + mc.displayGuiScreen(new GuiMultiplayerIngame()); + break; + case 600: + try { + Desktop desktop = java.awt.Desktop.getDesktop(); + URI oURL = new URI("http://hynomacka.ddns.net"); + desktop.browse(oURL); + } catch (Exception e) { + e.printStackTrace(); + } + break; + case 700: + mc.displayGuiScreen(new Changelog()); + break; + + /* */ + /* */ + /* */ + case 1022: + break; + } //this.mc.displayGuiScreen(new HUDConfigScreen()); + } + + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + //drawDefaultBackground(); + //Minecraft.getMinecraft().entityRenderer.loadShader(new ResourceLocation("shaders/post/blur.json")); + //FontUtil.normal.drawString("Animeware", 340, 135, ColorMode.getWhiteColor()); + GL11.glColor4f(1F, 1F, 1F, 1F); + //if(MinecraftServer.getServer().isSinglePlayer()) { + Playerdraw(370, 330, 25, 50, 0, mc.thePlayer); + ScaledResolution sr = new ScaledResolution(mc); + /*Discord GUI:*/ + //DrawUtil.drawRoundedRect(170, 60, sr.getScaledWidth() - 170, sr.getScaledHeight() - 100, 10, ColorMode.getClickGuiColor()); + //DrawUtil.drawRoundedRect(200, 75, sr.getScaledWidth() - 460, sr.getScaledHeight() - 100, 12, ColorMode.getClickGuiMidColor()); + //Gui.drawRect(300, 75, sr.getScaledWidth() - 170, sr.getScaledHeight() - 100, ColorMode.getClickGuiInnerColor()); + //Gui.drawRect(195, 105, sr.getScaledWidth() - 170, sr.getScaledHeight() - 410, ColorMode.getClickGuiColor()); + + //DrawUtil.drawRoundedRect(200, 115, sr.getScaledWidth() - 665, sr.getScaledHeight() - 375, 13, ColorMode.getClickGuiInnerColor()); + //DrawUtil.drawRoundedRect(203, 110, sr.getScaledWidth() - 663, sr.getScaledHeight() - 385, 14, ColorMode.getClickGuiInnerColor()); + //DrawUtil.drawRoundedRect(203, 110, sr.getScaledWidth() - 663, sr.getScaledHeight() - 385, 24, ColorMode.getClickGuiInnerColor()); + //DrawUtil.drawRoundedRect(203, 110, sr.getScaledWidth() - 663, sr.getScaledHeight() - 385, 14, ColorMode.getClickGuiInnerColor()); + //DrawUtil.drawRoundedRect(203, 210, sr.getScaledWidth() - 663, sr.getScaledHeight() - 395, 14, ColorMode.getClickGuiInnerColor()); + + /*NetworkPlayerInfo playerinfo = + mc.getNetHandler().getPlayerInfo(player.getUniqueID()); + if(playerinfo != null) { + mc.getTextureManager().bindTexture(playerinfo.getLocationSkin()); + GL11.glColor4f(1F, 1F, 1F, 1F); + Gui.drawScaledCustomSizeModalRect((int) x -5, (int) y - 5, 8F, 8F, 8 , 8, 20, 20, 64F, 64F); + }*/ + + DrawUtil.drawRoundedRect(312, 125, sr.getScaledWidth() - 220, sr.getScaledHeight() - 373, 18, ColorMode.getClickGuiMidColor()); //text bg + DrawUtil.drawRoundedRect(320, 150, sr.getScaledWidth() - 220, sr.getScaledHeight() - 130, 18, ColorMode.getClickGuiColor()); //side + DrawUtil.drawRoundedRect(415, 120, sr.getScaledWidth() - 220, sr.getScaledHeight() - 130, 18, ColorMode.getClickGuiColor()); //main bg + DrawUtil.drawRoundedRect(420, 125, sr.getScaledWidth() - 225, sr.getScaledHeight() - 135, 18, ColorMode.getClickGuiMidColor()); //main + DrawUtil.drawRoundedRect(255, 120, sr.getScaledWidth() - 655, sr.getScaledHeight() - 130, 18, ColorMode.getClickGuiColor()); //second main bg + DrawUtil.drawRoundedRect(260, 125, sr.getScaledWidth() - 660, sr.getScaledHeight() - 135, 18, ColorMode.getClickGuiMidColor()); //second main + + + //GlStateManager.pushMatrix(); + //GlStateManager.scale(0.8, 0.8, 0.8); + FontUtil.normal.drawString("Animeware", 340, 135, ColorMode.getRedColor()); + //FontUtil.normal.drawString("A", 340, 135, ColorUtils.astolfoColors(0, 100, 400L)); + //FontUtil.normal.drawString("n", 340 + 7, 135, ColorUtils.astolfoColors(0, 100, 300L)); + //FontUtil.normal.drawString("i", 340 + 13, 135, ColorUtils.astolfoColors(0, 100, 200L)); + //FontUtil.normal.drawString("m", 340 + 15, 135, ColorUtils.astolfoColors(0, 100, 100L)); + //FontUtil.normal.drawString("e", 340 + 23, 135, ColorUtils.astolfoColors(0, 100, 0L)); + //FontUtil.normal.drawString("w", 340 + 29, 135, ColorUtils.astolfoColors(0, 100, -100L)); + //FontUtil.normal.drawString("a", 340 + 36, 135, ColorUtils.astolfoColors(0, 100, -200L)); + //FontUtil.normal.drawString("r", 340 + 42, 135, ColorUtils.astolfoColors(0, 100, -300L)); + //FontUtil.normal.drawString("e", 340 + 46, 135, ColorUtils.astolfoColors(0, 100, -400L)); + //mc.getTextureManager().bindTexture(new ResourceLocation ("Animeware/text_white.png")); + //this.drawModalRectWithCustomSizedTexture(345, 95, 0, 0, 250, 250, 250, 250); + + FontUtil.normal.drawString( "", this.width / 2 - 31, this.height / 2 - 120, + -1); + super.drawScreen(mouseX, mouseY, partialTicks); + } + public static void Playerdraw(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent) + { + if(MinecraftServer.getServer().isSinglePlayer()) { + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)posX, (float)posY, 50.0F); + GlStateManager.scale((float)(-65), (float)65, (float)65); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + float f = ent.renderYawOffset; + float f1 = ent.rotationYaw; + float f2 = ent.rotationPitch; + float f3 = ent.prevRotationYawHead; + float f4 = ent.rotationYawHead; + GlStateManager.rotate(155.0F, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); + ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F; + ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F; + ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F; + ent.rotationYawHead = ent.rotationYaw; + ent.prevRotationYawHead = ent.rotationYaw; + GlStateManager.translate(0.0F, 0.0F, 0.0F); + RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); + rendermanager.setPlayerViewY(180.0F); + rendermanager.setRenderShadow(false); + rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + rendermanager.setRenderShadow(true); + ent.renderYawOffset = f; + ent.rotationYaw = f1; + ent.rotationPitch = f2; + ent.prevRotationYawHead = f3; + ent.rotationYawHead = f4; + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } else if(Minecraft.getMinecraft().getCurrentServerData() != null) { + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float)posX, (float)posY, 50.0F); + GlStateManager.scale((float)(-65), (float)65, (float)65); + GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); + float f = ent.renderYawOffset; + float f1 = ent.rotationYaw; + float f2 = ent.rotationPitch; + float f3 = ent.prevRotationYawHead; + float f4 = ent.rotationYawHead; + GlStateManager.rotate(155.0F, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); + ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F; + ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F; + ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F; + ent.rotationYawHead = ent.rotationYaw; + ent.prevRotationYawHead = ent.rotationYaw; + GlStateManager.translate(0.0F, 0.0F, 0.0F); + RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); + rendermanager.setPlayerViewY(180.0F); + rendermanager.setRenderShadow(false); + rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + rendermanager.setRenderShadow(true); + ent.renderYawOffset = f; + ent.rotationYaw = f1; + ent.rotationPitch = f2; + ent.prevRotationYawHead = f3; + ent.rotationYawHead = f4; + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + } else { + + } + } +} + +